{
  "en-US": {
    "/docs/api/accelerator": {
      "locale": "en-US",
      "slug": "accelerator",
      "href": "/docs/api/accelerator",
      "crowdinFileId": "256277",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/accelerator.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"accelerator\"><a href=\"#accelerator\">Accelerator</a></h1>\n<blockquote>\n<p>Define keyboard shortcuts.</p>\n</blockquote>\n<p>Accelerators are Strings that can contain multiple modifiers and a single key code,\ncombined by the <code>+</code> character, and are used to define keyboard shortcuts\nthroughout your application.</p>\n<p>Examples:</p>\n<ul>\n<li><code>CommandOrControl+A</code></li>\n<li><code>CommandOrControl+Shift+Z</code></li>\n</ul>\n<p>Shortcuts are registered with the <a href=\"/docs/api/global-shortcut\"><code>globalShortcut</code></a> module\nusing the <a href=\"/docs/api/global-shortcut#globalshortcutregisteraccelerator-callback\"><code>register</code></a>\nmethod, i.e.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Register a 'CommandOrControl+Y' shortcut listener.</span>\n  globalShortcut.register(<span class=\"hljs-string\">'CommandOrControl+Y'</span>, () => {\n    <span class=\"hljs-comment\">// Do stuff when Y and either Command/Control is pressed.</span>\n  })\n})\n</code></pre>\n<h2 id=\"platform-notice\"><a href=\"#platform-notice\">Platform notice</a></h2>\n<p>On Linux and Windows, the <code>Command</code> key does not have any effect so\nuse <code>CommandOrControl</code> which represents <code>Command</code> on macOS and <code>Control</code> on\nLinux and Windows to define some accelerators.</p>\n<p>Use <code>Alt</code> instead of <code>Option</code>. The <code>Option</code> key only exists on macOS, whereas\nthe <code>Alt</code> key is available on all platforms.</p>\n<p>The <code>Super</code> (or <code>Meta</code>) key is mapped to the <code>Windows</code> key on Windows and Linux and\n<code>Cmd</code> on macOS.</p>\n<h2 id=\"available-modifiers\"><a href=\"#available-modifiers\">Available modifiers</a></h2>\n<ul>\n<li><code>Command</code> (or <code>Cmd</code> for short)</li>\n<li><code>Control</code> (or <code>Ctrl</code> for short)</li>\n<li><code>CommandOrControl</code> (or <code>CmdOrCtrl</code> for short)</li>\n<li><code>Alt</code></li>\n<li><code>Option</code></li>\n<li><code>AltGr</code></li>\n<li><code>Shift</code></li>\n<li><code>Super</code></li>\n<li><code>Meta</code></li>\n</ul>\n<h2 id=\"available-key-codes\"><a href=\"#available-key-codes\">Available key codes</a></h2>\n<ul>\n<li><code>0</code> to <code>9</code></li>\n<li><code>A</code> to <code>Z</code></li>\n<li><code>F1</code> to <code>F24</code></li>\n<li>Punctuation like <code>~</code>, <code>!</code>, <code>@</code>, <code>#</code>, <code>$</code>, etc.</li>\n<li><code>Plus</code></li>\n<li><code>Space</code></li>\n<li><code>Tab</code></li>\n<li><code>Capslock</code></li>\n<li><code>Numlock</code></li>\n<li><code>Scrolllock</code></li>\n<li><code>Backspace</code></li>\n<li><code>Delete</code></li>\n<li><code>Insert</code></li>\n<li><code>Return</code> (or <code>Enter</code> as alias)</li>\n<li><code>Up</code>, <code>Down</code>, <code>Left</code> and <code>Right</code></li>\n<li><code>Home</code> and <code>End</code></li>\n<li><code>PageUp</code> and <code>PageDown</code></li>\n<li><code>Escape</code> (or <code>Esc</code> for short)</li>\n<li><code>VolumeUp</code>, <code>VolumeDown</code> and <code>VolumeMute</code></li>\n<li><code>MediaNextTrack</code>, <code>MediaPreviousTrack</code>, <code>MediaStop</code> and <code>MediaPlayPause</code></li>\n<li><code>PrintScreen</code></li>\n<li>NumPad Keys<ul>\n<li><code>num0</code> - <code>num9</code></li>\n<li><code>numdec</code> - decimal key</li>\n<li><code>numadd</code> - numpad <code>+</code> key</li>\n<li><code>numsub</code> - numpad <code>-</code> key</li>\n<li><code>nummult</code> - numpad <code>*</code> key</li>\n<li><code>numdiv</code> - numpad <code>÷</code> key</li>\n</ul></li>\n</ul>",
      "title": "Accelerator",
      "description": "Define keyboard shortcuts."
    },
    "/docs/tutorial/accessibility": {
      "locale": "en-US",
      "slug": "accessibility",
      "href": "/docs/tutorial/accessibility",
      "crowdinFileId": "256173",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/accessibility.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"accessibility\"><a href=\"#accessibility\">Accessibility</a></h1>\n<p>Making accessible applications is important and we're happy to provide\nfunctionality to <a href=\"https://electronjs.org/devtron\">Devtron</a> and <a href=\"https://electronjs.org/spectron\">Spectron</a> that gives\ndevelopers the opportunity to make their apps better for everyone.</p>\n<hr>\n<p>Accessibility concerns in Electron applications are similar to those of\nwebsites because they're both ultimately HTML. With Electron apps, however,\nyou can't use the online resources for accessibility audits because your app\ndoesn't have a URL to point the auditor to.</p>\n<p>These features bring those auditing tools to your Electron app. You can\nchoose to add audits to your tests with Spectron or use them within DevTools\nwith Devtron. Read on for a summary of the tools.</p>\n<h2 id=\"spectron\"><a href=\"#spectron\">Spectron</a></h2>\n<p>In the testing framework Spectron, you can now audit each window and <code>&#x3C;webview></code>\ntag in your application. For example:</p>\n<pre><code class=\"hljs language-javascript\">app.client.auditAccessibility().then(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\">audit</span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (audit.failed) {\n    <span class=\"hljs-built_in\">console</span>.error(audit.message)\n  }\n})\n</code></pre>\n<p>You can read more about this feature in <a href=\"https://github.com/electron/spectron#accessibility-testing\">Spectron's documentation</a>.</p>\n<h2 id=\"devtron\"><a href=\"#devtron\">Devtron</a></h2>\n<p>In Devtron, there is an accessibility tab which will allow you to audit a\npage in your app, sort and filter the results.</p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/1305617/17156618/9f9bcd72-533f-11e6-880d-389115f40a2a.png\" alt=\"devtron screenshot\"></p>\n<p>Both of these tools are using the <a href=\"https://github.com/GoogleChrome/accessibility-developer-tools\">Accessibility Developer Tools</a>\nlibrary built by Google for Chrome. You can learn more about the accessibility\naudit rules this library uses on that <a href=\"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules\">repository's wiki</a>.</p>\n<p>If you know of other great accessibility tools for Electron, add them to the\naccessibility documentation with a pull request.</p>\n<h2 id=\"manually-enabling-accessibility-features\"><a href=\"#manually-enabling-accessibility-features\">Manually enabling accessibility features</a></h2>\n<p>Electron applications will automatically enable accessibility features in the\npresence of assistive technology (e.g. <a href=\"https://www.freedomscientific.com/products/software/jaws/\">JAWS</a>\non Windows or <a href=\"https://help.apple.com/voiceover/mac/10.15/\">VoiceOver</a> on macOS).\nSee Chrome's <a href=\"https://www.chromium.org/developers/design-documents/accessibility#TOC-How-Chrome-detects-the-presence-of-Assistive-Technology\">accessibility documentation</a> for more details.</p>\n<p>You can also manually toggle these features either within your Electron application\nor by setting flags in third-party native software.</p>\n<h3 id=\"using-electrons-api\"><a href=\"#using-electrons-api\">Using Electron's API</a></h3>\n<p>By using the <a href=\"/docs/api/app#appsetaccessibilitysupportenabledenabled-macos-windows\"><code>app.setAccessibilitySupportEnabled(enabled)</code></a>\nAPI, you can manually expose Chrome's accessibility tree to users in the application preferences.\nNote that the user's system assistive utilities have priority over this setting and\nwill override it.</p>\n<h3 id=\"within-third-party-software\"><a href=\"#within-third-party-software\">Within third-party software</a></h3>\n<h4 id=\"macos\"><a href=\"#macos\">macOS</a></h4>\n<p>On macOS, third-party assistive technology can toggle accessibility features inside\nElectron applications by setting the <code>AXManualAccessibility</code> attribute\nprogrammatically:</p>\n<pre><code class=\"hljs language-objc\"><span class=\"hljs-built_in\">CFStringRef</span> kAXManualAccessibility = <span class=\"hljs-built_in\">CFSTR</span>(<span class=\"hljs-string\">\"AXManualAccessibility\"</span>);\n\n+ (<span class=\"hljs-keyword\">void</span>)enableAccessibility:(<span class=\"hljs-built_in\">BOOL</span>)enable inElectronApplication:(<span class=\"hljs-built_in\">NSRunningApplication</span> *)app\n{\n    AXUIElementRef appRef = AXUIElementCreateApplication(app.processIdentifier);\n    <span class=\"hljs-keyword\">if</span> (appRef == <span class=\"hljs-literal\">nil</span>)\n        <span class=\"hljs-keyword\">return</span>;\n\n    <span class=\"hljs-built_in\">CFBooleanRef</span> value = enable ? kCFBooleanTrue : kCFBooleanFalse;\n    AXUIElementSetAttributeValue(appRef, kAXManualAccessibility, value);\n    <span class=\"hljs-built_in\">CFRelease</span>(appRef);\n}\n</code></pre>",
      "title": "Accessibility",
      "description": ""
    },
    "/docs/api/app": {
      "locale": "en-US",
      "slug": "app",
      "href": "/docs/api/app",
      "crowdinFileId": "256279",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/app.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"app\"><a href=\"#app\">app</a></h1>\n<blockquote>\n<p>Control your application's event lifecycle.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>The following example shows how to quit the application when the last window is\nclosed:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  app.quit()\n})\n</code></pre>\n<h2 id=\"events\"><a href=\"#events\">Events</a></h2>\n<p>The <code>app</code> object emits the following events:</p>\n<h3 id=\"event-will-finish-launching\"><a href=\"#event-will-finish-launching\">Event: 'will-finish-launching'</a></h3>\n<p>Emitted when the application has finished basic startup. On Windows and Linux,\nthe <code>will-finish-launching</code> event is the same as the <code>ready</code> event; on macOS,\nthis event represents the <code>applicationWillFinishLaunching</code> notification of\n<code>NSApplication</code>. You would usually set up listeners for the <code>open-file</code> and\n<code>open-url</code> events here, and start the crash reporter and auto updater.</p>\n<p>In most cases, you should do everything in the <code>ready</code> event handler.</p>\n<h3 id=\"event-ready\"><a href=\"#event-ready\">Event: 'ready'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>launchInfo</code> Record&#x3C;string, any> | <a href=\"/docs/api/structures/notification-response\">NotificationResponse</a> <em>macOS</em></li>\n</ul>\n<p>Emitted once, when Electron has finished initializing. On macOS, <code>launchInfo</code>\nholds the <code>userInfo</code> of the <code>NSUserNotification</code> or information from\n<a href=\"/docs/api/structures/notification-response\"><code>UNNotificationResponse</code></a> that was used to open the\napplication, if it was launched from Notification Center. You can also call\n<code>app.isReady()</code> to check if this event has already fired and <code>app.whenReady()</code>\nto get a Promise that is fulfilled when Electron is initialized.</p>\n<h3 id=\"event-window-all-closed\"><a href=\"#event-window-all-closed\">Event: 'window-all-closed'</a></h3>\n<p>Emitted when all windows have been closed.</p>\n<p>If you do not subscribe to this event and all windows are closed, the default\nbehavior is to quit the app; however, if you subscribe, you control whether the\napp quits or not. If the user pressed <code>Cmd + Q</code>, or the developer called\n<code>app.quit()</code>, Electron will first try to close all the windows and then emit the\n<code>will-quit</code> event, and in this case the <code>window-all-closed</code> event would not be\nemitted.</p>\n<h3 id=\"event-before-quit\"><a href=\"#event-before-quit\">Event: 'before-quit'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted before the application starts closing its windows.\nCalling <code>event.preventDefault()</code> will prevent the default behavior, which is\nterminating the application.</p>\n<p><strong>Note:</strong> If application quit was initiated by <code>autoUpdater.quitAndInstall()</code>,\nthen <code>before-quit</code> is emitted <em>after</em> emitting <code>close</code> event on all windows and\nclosing them.</p>\n<p><strong>Note:</strong> On Windows, this event will not be emitted if the app is closed due\nto a shutdown/restart of the system or a user logout.</p>\n<h3 id=\"event-will-quit\"><a href=\"#event-will-quit\">Event: 'will-quit'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when all windows have been closed and the application will quit.\nCalling <code>event.preventDefault()</code> will prevent the default behavior, which is\nterminating the application.</p>\n<p>See the description of the <code>window-all-closed</code> event for the differences between\nthe <code>will-quit</code> and <code>window-all-closed</code> events.</p>\n<p><strong>Note:</strong> On Windows, this event will not be emitted if the app is closed due\nto a shutdown/restart of the system or a user logout.</p>\n<h3 id=\"event-quit\"><a href=\"#event-quit\">Event: 'quit'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>exitCode</code> Integer</li>\n</ul>\n<p>Emitted when the application is quitting.</p>\n<p><strong>Note:</strong> On Windows, this event will not be emitted if the app is closed due\nto a shutdown/restart of the system or a user logout.</p>\n<h3 id=\"event-open-file-macos\"><a href=\"#event-open-file-macos\">Event: 'open-file' <em>macOS</em></a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>path</code> String</li>\n</ul>\n<p>Emitted when the user wants to open a file with the application. The <code>open-file</code>\nevent is usually emitted when the application is already open and the OS wants\nto reuse the application to open the file. <code>open-file</code> is also emitted when a\nfile is dropped onto the dock and the application is not yet running. Make sure\nto listen for the <code>open-file</code> event very early in your application startup to\nhandle this case (even before the <code>ready</code> event is emitted).</p>\n<p>You should call <code>event.preventDefault()</code> if you want to handle this event.</p>\n<p>On Windows, you have to parse <code>process.argv</code> (in the main process) to get the\nfilepath.</p>\n<h3 id=\"event-open-url-macos\"><a href=\"#event-open-url-macos\">Event: 'open-url' <em>macOS</em></a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when the user wants to open a URL with the application. Your application's\n<code>Info.plist</code> file must define the URL scheme within the <code>CFBundleURLTypes</code> key, and\nset <code>NSPrincipalClass</code> to <code>AtomApplication</code>.</p>\n<p>You should call <code>event.preventDefault()</code> if you want to handle this event.</p>\n<h3 id=\"event-activate-macos\"><a href=\"#event-activate-macos\">Event: 'activate' <em>macOS</em></a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>hasVisibleWindows</code> Boolean</li>\n</ul>\n<p>Emitted when the application is activated. Various actions can trigger\nthis event, such as launching the application for the first time, attempting\nto re-launch the application when it's already running, or clicking on the\napplication's dock or taskbar icon.</p>\n<h3 id=\"event-did-become-active-macos\"><a href=\"#event-did-become-active-macos\">Event: 'did-become-active' <em>macOS</em></a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when mac application become active. Difference from <code>activate</code> event is\nthat <code>did-become-active</code> is emitted every time the app becomes active, not only\nwhen Dock icon is clicked or application is re-launched.</p>\n<h3 id=\"event-continue-activity-macos\"><a href=\"#event-continue-activity-macos\">Event: 'continue-activity' <em>macOS</em></a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - A string identifying the activity. Maps to\n<a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> unknown - Contains app-specific state stored by the activity on\nanother device.</li>\n<li><code>details</code> Object<ul>\n<li><code>webpageURL</code> String (optional) - A string identifying the URL of the webpage accessed by the activity on another device, if available.</li>\n</ul></li>\n</ul>\n<p>Emitted during <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> when an activity from a different device wants\nto be resumed. You should call <code>event.preventDefault()</code> if you want to handle\nthis event.</p>\n<p>A user activity can be continued only in an app that has the same developer Team\nID as the activity's source app and that supports the activity's type.\nSupported activity types are specified in the app's <code>Info.plist</code> under the\n<code>NSUserActivityTypes</code> key.</p>\n<h3 id=\"event-will-continue-activity-macos\"><a href=\"#event-will-continue-activity-macos\">Event: 'will-continue-activity' <em>macOS</em></a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - A string identifying the activity. Maps to\n<a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n</ul>\n<p>Emitted during <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> before an activity from a different device wants\nto be resumed. You should call <code>event.preventDefault()</code> if you want to handle\nthis event.</p>\n<h3 id=\"event-continue-activity-error-macos\"><a href=\"#event-continue-activity-error-macos\">Event: 'continue-activity-error' <em>macOS</em></a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - A string identifying the activity. Maps to\n<a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>error</code> String - A string with the error's localized description.</li>\n</ul>\n<p>Emitted during <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> when an activity from a different device\nfails to be resumed.</p>\n<h3 id=\"event-activity-was-continued-macos\"><a href=\"#event-activity-was-continued-macos\">Event: 'activity-was-continued' <em>macOS</em></a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - A string identifying the activity. Maps to\n<a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> unknown - Contains app-specific state stored by the activity.</li>\n</ul>\n<p>Emitted during <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> after an activity from this device was successfully\nresumed on another one.</p>\n<h3 id=\"event-update-activity-state-macos\"><a href=\"#event-update-activity-state-macos\">Event: 'update-activity-state' <em>macOS</em></a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - A string identifying the activity. Maps to\n<a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> unknown - Contains app-specific state stored by the activity.</li>\n</ul>\n<p>Emitted when <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">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>\n<h3 id=\"event-new-window-for-tab-macos\"><a href=\"#event-new-window-for-tab-macos\">Event: 'new-window-for-tab' <em>macOS</em></a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the user clicks the native macOS new tab button. The new\ntab button is only visible if the current <code>BrowserWindow</code> has a\n<code>tabbingIdentifier</code></p>\n<h3 id=\"event-browser-window-blur\"><a href=\"#event-browser-window-blur\">Event: 'browser-window-blur'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Emitted when a <a href=\"/docs/api/browser-window\">browserWindow</a> gets blurred.</p>\n<h3 id=\"event-browser-window-focus\"><a href=\"#event-browser-window-focus\">Event: 'browser-window-focus'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Emitted when a <a href=\"/docs/api/browser-window\">browserWindow</a> gets focused.</p>\n<h3 id=\"event-browser-window-created\"><a href=\"#event-browser-window-created\">Event: 'browser-window-created'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Emitted when a new <a href=\"/docs/api/browser-window\">browserWindow</a> is created.</p>\n<h3 id=\"event-web-contents-created\"><a href=\"#event-web-contents-created\">Event: 'web-contents-created'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitted when a new <a href=\"/docs/api/web-contents\">webContents</a> is created.</p>\n<h3 id=\"event-certificate-error\"><a href=\"#event-certificate-error\">Event: 'certificate-error'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>url</code> String</li>\n<li><code>error</code> String - The error code</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>isTrusted</code> Boolean - Whether to consider the certificate as trusted</li>\n</ul></li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Emitted when failed to verify the <code>certificate</code> for <code>url</code>, to trust the\ncertificate you should prevent the default behavior with\n<code>event.preventDefault()</code> and call <code>callback(true)</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'certificate-error'</span>, (event, webContents, url, error, certificate, callback) => {\n  <span class=\"hljs-keyword\">if</span> (url === <span class=\"hljs-string\">'https://github.com'</span>) {\n    <span class=\"hljs-comment\">// Verification logic.</span>\n    event.preventDefault()\n    callback(<span class=\"hljs-literal\">true</span>)\n  } <span class=\"hljs-keyword\">else</span> {\n    callback(<span class=\"hljs-literal\">false</span>)\n  }\n})\n</code></pre>\n<h3 id=\"event-select-client-certificate\"><a href=\"#event-select-client-certificate\">Event: 'select-client-certificate'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>url</code> URL</li>\n<li><code>certificateList</code> <a href=\"/docs/api/structures/certificate\">Certificate[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> (optional)</li>\n</ul></li>\n</ul>\n<p>Emitted when a client certificate is requested.</p>\n<p>The <code>url</code> corresponds to the navigation entry requesting the client certificate\nand <code>callback</code> can be called with an entry filtered from the list. Using\n<code>event.preventDefault()</code> prevents the application from using the first\ncertificate from the store.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'select-client-certificate'</span>, (event, webContents, url, list, callback) => {\n  event.preventDefault()\n  callback(list[<span class=\"hljs-number\">0</span>])\n})\n</code></pre>\n<h3 id=\"event-login\"><a href=\"#event-login\">Event: 'login'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>authenticationResponseDetails</code> Object<ul>\n<li><code>url</code> URL</li>\n</ul></li>\n<li><code>authInfo</code> Object<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (optional)</li>\n<li><code>password</code> String (optional)</li>\n</ul></li>\n</ul>\n<p>Emitted when <code>webContents</code> wants to do basic auth.</p>\n<p>The default behavior is to cancel all authentications. To override this you\nshould prevent the default behavior with <code>event.preventDefault()</code> and call\n<code>callback(username, password)</code> with the credentials.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'login'</span>, (event, webContents, details, authInfo, callback) => {\n  event.preventDefault()\n  callback(<span class=\"hljs-string\">'username'</span>, <span class=\"hljs-string\">'secret'</span>)\n})\n</code></pre>\n<p>If <code>callback</code> is called without a username or password, the authentication\nrequest will be cancelled and the authentication error will be returned to the\npage.</p>\n<h3 id=\"event-gpu-info-update\"><a href=\"#event-gpu-info-update\">Event: 'gpu-info-update'</a></h3>\n<p>Emitted whenever there is a GPU info update.</p>\n<h3 id=\"event-gpu-process-crashed-deprecated\"><a href=\"#event-gpu-process-crashed-deprecated\">Event: 'gpu-process-crashed' <em>Deprecated</em></a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>Emitted when the GPU process crashes or is killed.</p>\n<p><strong>Deprecated:</strong> This event is superceded by the <code>child-process-gone</code> event\nwhich contains more information about why the child process disappeared. It\nisn't always because it crashed. The <code>killed</code> boolean can be replaced by\nchecking <code>reason === 'killed'</code> when you switch to that event.</p>\n<h3 id=\"event-renderer-process-crashed-deprecated\"><a href=\"#event-renderer-process-crashed-deprecated\">Event: 'renderer-process-crashed' <em>Deprecated</em></a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>Emitted when the renderer process of <code>webContents</code> crashes or is killed.</p>\n<p><strong>Deprecated:</strong> This event is superceded by the <code>render-process-gone</code> event\nwhich contains more information about why the render process disappeared. It\nisn't always because it crashed.  The <code>killed</code> boolean can be replaced by\nchecking <code>reason === 'killed'</code> when you switch to that event.</p>\n<h3 id=\"event-render-process-gone\"><a href=\"#event-render-process-gone\">Event: 'render-process-gone'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>details</code> Object<ul>\n<li><code>reason</code> String - The reason the render process is gone.  Possible values:<ul>\n<li><code>clean-exit</code> - Process exited with an exit code of zero</li>\n<li><code>abnormal-exit</code> - Process exited with a non-zero exit code</li>\n<li><code>killed</code> - Process was sent a SIGTERM or otherwise killed externally</li>\n<li><code>crashed</code> - Process crashed</li>\n<li><code>oom</code> - Process ran out of memory</li>\n<li><code>launch-failed</code> - Process never successfully launched</li>\n<li><code>integrity-failure</code> - Windows code integrity checks failed</li>\n</ul></li>\n<li><code>exitCode</code> Integer - The exit code of the process, unless <code>reason</code> is\n<code>launch-failed</code>, in which case <code>exitCode</code> will be a platform-specific\nlaunch failure error code.</li>\n</ul></li>\n</ul>\n<p>Emitted when the renderer process unexpectedly disappears.  This is normally\nbecause it was crashed or killed.</p>\n<h3 id=\"event-child-process-gone\"><a href=\"#event-child-process-gone\">Event: 'child-process-gone'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>type</code> String - Process type. One of the following values:<ul>\n<li><code>Utility</code></li>\n<li><code>Zygote</code></li>\n<li><code>Sandbox helper</code></li>\n<li><code>GPU</code></li>\n<li><code>Pepper Plugin</code></li>\n<li><code>Pepper Plugin Broker</code></li>\n<li><code>Unknown</code></li>\n</ul></li>\n<li><code>reason</code> String - The reason the child process is gone. Possible values:<ul>\n<li><code>clean-exit</code> - Process exited with an exit code of zero</li>\n<li><code>abnormal-exit</code> - Process exited with a non-zero exit code</li>\n<li><code>killed</code> - Process was sent a SIGTERM or otherwise killed externally</li>\n<li><code>crashed</code> - Process crashed</li>\n<li><code>oom</code> - Process ran out of memory</li>\n<li><code>launch-failed</code> - Process never successfully launched</li>\n<li><code>integrity-failure</code> - Windows code integrity checks failed</li>\n</ul></li>\n<li><code>exitCode</code> Number - The exit code for the process\n(e.g. status from waitpid if on posix, from GetExitCodeProcess on Windows).</li>\n<li><code>serviceName</code> String (optional) - The non-localized name of the process.</li>\n<li><code>name</code> String (optional) - The name of the process.\nExamples for utility: <code>Audio Service</code>, <code>Content Decryption Module Service</code>, <code>Network Service</code>, <code>Video Capture</code>, etc.</li>\n</ul></li>\n</ul>\n<p>Emitted when the child process unexpectedly disappears. This is normally\nbecause it was crashed or killed. It does not include renderer processes.</p>\n<h3 id=\"event-accessibility-support-changed-macos-windows\"><a href=\"#event-accessibility-support-changed-macos-windows\">Event: 'accessibility-support-changed' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>accessibilitySupportEnabled</code> Boolean - <code>true</code> when Chrome's accessibility\nsupport is enabled, <code>false</code> otherwise.</li>\n</ul>\n<p>Emitted when Chrome's accessibility support changes. This event fires when\nassistive technologies, such as screen readers, are enabled or disabled.\nSee <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">https://www.chromium.org/developers/design-documents/accessibility</a> for more\ndetails.</p>\n<h3 id=\"event-session-created\"><a href=\"#event-session-created\">Event: 'session-created'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>session</code> <a href=\"/docs/api/session\">Session</a></li>\n</ul>\n<p>Emitted when Electron has created a new <code>session</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'session-created'</span>, (session) => {\n  <span class=\"hljs-built_in\">console</span>.log(session)\n})\n</code></pre>\n<h3 id=\"event-second-instance\"><a href=\"#event-second-instance\">Event: 'second-instance'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>argv</code> String[] - An array of the second instance's command line arguments</li>\n<li><code>workingDirectory</code> String - The second instance's working directory</li>\n</ul>\n<p>This event will be emitted inside the primary instance of your application\nwhen a second instance has been executed and calls <code>app.requestSingleInstanceLock()</code>.</p>\n<p><code>argv</code> is an Array of the second instance's command line arguments,\nand <code>workingDirectory</code> is its current working directory. Usually\napplications respond to this by making their primary window focused and\nnon-minimized.</p>\n<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>\n<p>This event is guaranteed to be emitted after the <code>ready</code> event of <code>app</code>\ngets emitted.</p>\n<p><strong>Note:</strong> Extra command line arguments might be added by Chromium,\nsuch as <code>--original-process-start-time</code>.</p>\n<h3 id=\"event-desktop-capturer-get-sources\"><a href=\"#event-desktop-capturer-get-sources\">Event: 'desktop-capturer-get-sources'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitted when <code>desktopCapturer.getSources()</code> is called in the renderer process of <code>webContents</code>.\nCalling <code>event.preventDefault()</code> will make it return empty sources.</p>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>app</code> object has the following methods:</p>\n<p><strong>Note:</strong> Some methods are only available on specific operating systems and are\nlabeled as such.</p>\n<h3 id=\"appquit\"><a href=\"#appquit\"><code>app.quit()</code></a></h3>\n<p>Try to close all windows. The <code>before-quit</code> event will be emitted first. If all\nwindows are successfully closed, the <code>will-quit</code> event will be emitted and by\ndefault the application will terminate.</p>\n<p>This method guarantees that all <code>beforeunload</code> and <code>unload</code> event handlers are\ncorrectly executed. It is possible that a window cancels the quitting by\nreturning <code>false</code> in the <code>beforeunload</code> event handler.</p>\n<h3 id=\"appexitexitcode\"><a href=\"#appexitexitcode\"><code>app.exit([exitCode])</code></a></h3>\n<ul>\n<li><code>exitCode</code> Integer (optional)</li>\n</ul>\n<p>Exits immediately with <code>exitCode</code>. <code>exitCode</code> defaults to 0.</p>\n<p>All windows will be closed immediately without asking the user, and the <code>before-quit</code>\nand <code>will-quit</code> events will not be emitted.</p>\n<h3 id=\"apprelaunchoptions\"><a href=\"#apprelaunchoptions\"><code>app.relaunch([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a></li>\n<li><code>execPath</code> String (optional)</li>\n</ul></li>\n</ul>\n<p>Relaunches the app when current instance exits.</p>\n<p>By default, the new instance will use the same working directory and command line\narguments with current instance. When <code>args</code> is specified, the <code>args</code> will be\npassed as command line arguments instead. When <code>execPath</code> is specified, the\n<code>execPath</code> will be executed for relaunch instead of current app.</p>\n<p>Note that this method does not quit the app when executed, you have to call\n<code>app.quit</code> or <code>app.exit</code> after calling <code>app.relaunch</code> to make the app restart.</p>\n<p>When <code>app.relaunch</code> is called for multiple times, multiple instances will be\nstarted after current instance exited.</p>\n<p>An example of restarting current instance immediately and adding a new command\nline argument to the new instance:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.relaunch({ <span class=\"hljs-attr\">args</span>: process.argv.slice(<span class=\"hljs-number\">1</span>).concat([<span class=\"hljs-string\">'--relaunch'</span>]) })\napp.exit(<span class=\"hljs-number\">0</span>)\n</code></pre>\n<h3 id=\"appisready\"><a href=\"#appisready\"><code>app.isReady()</code></a></h3>\n<p>Returns <code>Boolean</code> - <code>true</code> if Electron has finished initializing, <code>false</code> otherwise.\nSee also <code>app.whenReady()</code>.</p>\n<h3 id=\"appwhenready\"><a href=\"#appwhenready\"><code>app.whenReady()</code></a></h3>\n<p>Returns <code>Promise&#x3C;void></code> - fulfilled when Electron is initialized.\nMay be used as a convenient alternative to checking <code>app.isReady()</code>\nand subscribing to the <code>ready</code> event if the app is not ready yet.</p>\n<h3 id=\"appfocusoptions\"><a href=\"#appfocusoptions\"><code>app.focus([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>steal</code> Boolean <em>macOS</em> - Make the receiver the active app even if another app is\ncurrently active.</li>\n</ul></li>\n</ul>\n<p>On Linux, focuses on the first visible window. On macOS, makes the application\nthe active app. On Windows, focuses on the application's first window.</p>\n<p>You should seek to use the <code>steal</code> option as sparingly as possible.</p>\n<h3 id=\"apphide-macos\"><a href=\"#apphide-macos\"><code>app.hide()</code> <em>macOS</em></a></h3>\n<p>Hides all application windows without minimizing them.</p>\n<h3 id=\"appshow-macos\"><a href=\"#appshow-macos\"><code>app.show()</code> <em>macOS</em></a></h3>\n<p>Shows application windows after they were hidden. Does not automatically focus\nthem.</p>\n<h3 id=\"appsetapplogspathpath\"><a href=\"#appsetapplogspathpath\"><code>app.setAppLogsPath([path])</code></a></h3>\n<ul>\n<li><code>path</code> String (optional) - A custom path for your logs. Must be absolute.</li>\n</ul>\n<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>\n<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>macOS</em>, and inside the <code>userData</code> directory on <em>Linux</em> and <em>Windows</em>.</p>\n<h3 id=\"appgetapppath\"><a href=\"#appgetapppath\"><code>app.getAppPath()</code></a></h3>\n<p>Returns <code>String</code> - The current application directory.</p>\n<h3 id=\"appgetpathname\"><a href=\"#appgetpathname\"><code>app.getPath(name)</code></a></h3>\n<ul>\n<li><code>name</code> String - You can request the following paths by the name:<ul>\n<li><code>home</code> User's home directory.</li>\n<li><code>appData</code> Per-user application data directory, which by default points to:<ul>\n<li><code>%APPDATA%</code> on Windows</li>\n<li><code>$XDG_CONFIG_HOME</code> or <code>~/.config</code> on Linux</li>\n<li><code>~/Library/Application Support</code> on macOS</li>\n</ul></li>\n<li><code>userData</code> The directory for storing your app's configuration files, which by\ndefault it is the <code>appData</code> directory appended with your app's name.</li>\n<li><code>cache</code></li>\n<li><code>temp</code> Temporary directory.</li>\n<li><code>exe</code> The current executable file.</li>\n<li><code>module</code> The <code>libchromiumcontent</code> library.</li>\n<li><code>desktop</code> The current user's Desktop directory.</li>\n<li><code>documents</code> Directory for a user's \"My Documents\".</li>\n<li><code>downloads</code> Directory for a user's downloads.</li>\n<li><code>music</code> Directory for a user's music.</li>\n<li><code>pictures</code> Directory for a user's pictures.</li>\n<li><code>videos</code> Directory for a user's videos.</li>\n<li><code>recent</code> Directory for the user's recent files (Windows only).</li>\n<li><code>logs</code> Directory for your app's log folder.</li>\n<li><code>crashDumps</code> Directory where crash dumps are stored.</li>\n</ul></li>\n</ul>\n<p>Returns <code>String</code> - A path to a special directory or file associated with <code>name</code>. On\nfailure, an <code>Error</code> is thrown.</p>\n<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>\n<h3 id=\"appgetfileiconpath-options\"><a href=\"#appgetfileiconpath-options\"><code>app.getFileIcon(path[, options])</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>size</code> String<ul>\n<li><code>small</code> - 16x16</li>\n<li><code>normal</code> - 32x32</li>\n<li><code>large</code> - 48x48 on <em>Linux</em>, 32x32 on <em>Windows</em>, unsupported on <em>macOS</em>.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - fulfilled with the app's icon, which is a <a href=\"/docs/api/native-image\">NativeImage</a>.</p>\n<p>Fetches a path's associated icon.</p>\n<p>On <em>Windows</em>, there a 2 kinds of icons:</p>\n<ul>\n<li>Icons associated with certain file extensions, like <code>.mp3</code>, <code>.png</code>, etc.</li>\n<li>Icons inside the file itself, like <code>.exe</code>, <code>.dll</code>, <code>.ico</code>.</li>\n</ul>\n<p>On <em>Linux</em> and <em>macOS</em>, icons depend on the application associated with file mime type.</p>\n<h3 id=\"appsetpathname-path\"><a href=\"#appsetpathname-path\"><code>app.setPath(name, path)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n<li><code>path</code> String</li>\n</ul>\n<p>Overrides the <code>path</code> to a special directory or file associated with <code>name</code>.\nIf the path specifies a directory that does not exist, an <code>Error</code> is thrown.\nIn that case, the directory should be created with <code>fs.mkdirSync</code> or similar.</p>\n<p>You can only override paths of a <code>name</code> defined in <code>app.getPath</code>.</p>\n<p>By default, web pages' cookies and caches will be stored under the <code>userData</code>\ndirectory. If you want to change this location, you have to override the\n<code>userData</code> path before the <code>ready</code> event of the <code>app</code> module is emitted.</p>\n<h3 id=\"appgetversion\"><a href=\"#appgetversion\"><code>app.getVersion()</code></a></h3>\n<p>Returns <code>String</code> - The version of the loaded application. If no version is found in the\napplication's <code>package.json</code> file, the version of the current bundle or\nexecutable is returned.</p>\n<h3 id=\"appgetname\"><a href=\"#appgetname\"><code>app.getName()</code></a></h3>\n<p>Returns <code>String</code> - The current application's name, which is the name in the application's\n<code>package.json</code> file.</p>\n<p>Usually the <code>name</code> field of <code>package.json</code> is a short lowercase name, according\nto the npm modules spec. You should usually also specify a <code>productName</code>\nfield, which is your application's full capitalized name, and which will be\npreferred over <code>name</code> by Electron.</p>\n<h3 id=\"appsetnamename\"><a href=\"#appsetnamename\"><code>app.setName(name)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n</ul>\n<p>Overrides the current application's name.</p>\n<p><strong>Note:</strong> This function overrides the name used internally by Electron; it does not affect the name that the OS uses.</p>\n<h3 id=\"appgetlocale\"><a href=\"#appgetlocale\"><code>app.getLocale()</code></a></h3>\n<p>Returns <code>String</code> - The current application locale, fetched using Chromium's <code>l10n_util</code> library.\nPossible return values are documented <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:ui/base/l10n/l10n_util.cc\">here</a>.</p>\n<p>To set the locale, you'll want to use a command line switch at app startup, which may be found <a href=\"/docs/api/command-line-switches\">here</a>.</p>\n<p><strong>Note:</strong> When distributing your packaged app, you have to also ship the\n<code>locales</code> folder.</p>\n<p><strong>Note:</strong> On Windows, you have to call it after the <code>ready</code> events gets emitted.</p>\n<h3 id=\"appgetlocalecountrycode\"><a href=\"#appgetlocalecountrycode\"><code>app.getLocaleCountryCode()</code></a></h3>\n<p>Returns <code>String</code> - User operating system's locale two-letter <a href=\"https://www.iso.org/iso-3166-country-codes.html\">ISO 3166</a> country code. The value is taken from native OS APIs.</p>\n<p><strong>Note:</strong> When unable to detect locale country code, it returns empty string.</p>\n<h3 id=\"appaddrecentdocumentpath-macos-windows\"><a href=\"#appaddrecentdocumentpath-macos-windows\"><code>app.addRecentDocument(path)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Adds <code>path</code> to the recent documents list.</p>\n<p>This list is managed by the OS. On Windows, you can visit the list from the task\nbar, and on macOS, you can visit it from dock menu.</p>\n<h3 id=\"appclearrecentdocuments-macos-windows\"><a href=\"#appclearrecentdocuments-macos-windows\"><code>app.clearRecentDocuments()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Clears the recent documents list.</p>\n<h3 id=\"appsetasdefaultprotocolclientprotocol-path-args\"><a href=\"#appsetasdefaultprotocolclientprotocol-path-args\"><code>app.setAsDefaultProtocolClient(protocol[, path, args])</code></a></h3>\n<ul>\n<li><code>protocol</code> String - The name of your protocol, without <code>://</code>. For example,\nif you want your app to handle <code>electron://</code> links, call this method with\n<code>electron</code> as the parameter.</li>\n<li><code>path</code> String (optional) <em>Windows</em> - The path to the Electron executable.\nDefaults to <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - Arguments passed to the executable.\nDefaults to an empty array</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the call succeeded.</p>\n<p>Sets the current executable as the default handler for a protocol (aka URI\nscheme). It allows you to integrate your app deeper into the operating system.\nOnce registered, all links with <code>your-protocol://</code> will be opened with the\ncurrent executable. The whole link, including protocol, will be passed to your\napplication as a parameter.</p>\n<p><strong>Note:</strong> On macOS, you can only register protocols that have been added to\nyour app's <code>info.plist</code>, which cannot be modified at runtime. However, you can\nchange the file during build time via <a href=\"https://www.electronforge.io/\">Electron Forge</a>,\n<a href=\"https://github.com/electron/electron-packager\">Electron Packager</a>, or by editing <code>info.plist</code> with a text\neditor. Please refer to <a href=\"https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102207-TPXREF115\">Apple's documentation</a> for details.</p>\n<p><strong>Note:</strong> In a Windows Store environment (when packaged as an <code>appx</code>) this API\nwill return <code>true</code> for all calls but the registry key it sets won't be accessible\nby other applications.  In order to register your Windows Store application\nas a default protocol handler you must <a href=\"https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol\">declare the protocol in your manifest</a>.</p>\n<p>The API uses the Windows Registry and <code>LSSetDefaultHandlerForURLScheme</code> internally.</p>\n<h3 id=\"appremoveasdefaultprotocolclientprotocol-path-args-macos-windows\"><a href=\"#appremoveasdefaultprotocolclientprotocol-path-args-macos-windows\"><code>app.removeAsDefaultProtocolClient(protocol[, path, args])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>protocol</code> String - The name of your protocol, without <code>://</code>.</li>\n<li><code>path</code> String (optional) <em>Windows</em> - Defaults to <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - Defaults to an empty array</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the call succeeded.</p>\n<p>This method checks if the current executable as the default handler for a\nprotocol (aka URI scheme). If so, it will remove the app as the default handler.</p>\n<h3 id=\"appisdefaultprotocolclientprotocol-path-args\"><a href=\"#appisdefaultprotocolclientprotocol-path-args\"><code>app.isDefaultProtocolClient(protocol[, path, args])</code></a></h3>\n<ul>\n<li><code>protocol</code> String - The name of your protocol, without <code>://</code>.</li>\n<li><code>path</code> String (optional) <em>Windows</em> - Defaults to <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - Defaults to an empty array</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the current executable is the default handler for a\nprotocol (aka URI scheme).</p>\n<p><strong>Note:</strong> On macOS, you can use this method to check if the app has been\nregistered as the default protocol handler for a protocol. You can also verify\nthis by checking <code>~/Library/Preferences/com.apple.LaunchServices.plist</code> on the\nmacOS machine. Please refer to\n<a href=\"https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme\">Apple's documentation</a> for details.</p>\n<p>The API uses the Windows Registry and <code>LSCopyDefaultHandlerForURLScheme</code> internally.</p>\n<h3 id=\"appgetapplicationnameforprotocolurl\"><a href=\"#appgetapplicationnameforprotocolurl\"><code>app.getApplicationNameForProtocol(url)</code></a></h3>\n<ul>\n<li><code>url</code> String - a URL with the protocol name to check. Unlike the other\nmethods in this family, this accepts an entire URL, including <code>://</code> at a\nminimum (e.g. <code>https://</code>).</li>\n</ul>\n<p>Returns <code>String</code> - Name of the application handling the protocol, or an empty\nstring if there is no handler. For instance, if Electron is the default\nhandler of the URL, this could be <code>Electron</code> on Windows and Mac. However,\ndon't rely on the precise format which is not guaranteed to remain unchanged.\nExpect a different format on Linux, possibly with a <code>.desktop</code> suffix.</p>\n<p>This method returns the application name of the default handler for the protocol\n(aka URI scheme) of a URL.</p>\n<h3 id=\"appgetapplicationinfoforprotocolurl-macos-windows\"><a href=\"#appgetapplicationinfoforprotocolurl-macos-windows\"><code>app.getApplicationInfoForProtocol(url)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>url</code> String - a URL with the protocol name to check. Unlike the other\nmethods in this family, this accepts an entire URL, including <code>://</code> at a\nminimum (e.g. <code>https://</code>).</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Object></code> - Resolve with an object containing the following:</p>\n<ul>\n<li><code>icon</code> NativeImage - the display icon of the app handling the protocol.</li>\n<li><code>path</code> String  - installation path of the app handling the protocol.</li>\n<li><code>name</code> String - display name of the app handling the protocol.</li>\n</ul>\n<p>This method returns a promise that contains the application name, icon and path of the default handler for the protocol\n(aka URI scheme) of a URL.</p>\n<h3 id=\"appsetusertaskstasks-windows\"><a href=\"#appsetusertaskstasks-windows\"><code>app.setUserTasks(tasks)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>tasks</code> <a href=\"/docs/api/structures/task\">Task[]</a> - Array of <code>Task</code> objects</li>\n</ul>\n<p>Adds <code>tasks</code> to the <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks\">Tasks</a> category of the Jump List on Windows.</p>\n<p><code>tasks</code> is an array of <a href=\"/docs/api/structures/task\"><code>Task</code></a> objects.</p>\n<p>Returns <code>Boolean</code> - Whether the call succeeded.</p>\n<p><strong>Note:</strong> If you'd like to customize the Jump List even more use\n<code>app.setJumpList(categories)</code> instead.</p>\n<h3 id=\"appgetjumplistsettings-windows\"><a href=\"#appgetjumplistsettings-windows\"><code>app.getJumpListSettings()</code> <em>Windows</em></a></h3>\n<p>Returns <code>Object</code>:</p>\n<ul>\n<li><code>minItems</code> Integer - The minimum number of items that will be shown in the\nJump List (for a more detailed description of this value see the\n<a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx\">MSDN docs</a>).</li>\n<li><code>removedItems</code> <a href=\"/docs/api/structures/jump-list-item\">JumpListItem[]</a> - Array of <code>JumpListItem</code>\nobjects that correspond to items that the user has explicitly removed from custom categories in the\nJump List. These items must not be re-added to the Jump List in the <strong>next</strong>\ncall to <code>app.setJumpList()</code>, Windows will not display any custom category\nthat contains any of the removed items.</li>\n</ul>\n<h3 id=\"appsetjumplistcategories-windows\"><a href=\"#appsetjumplistcategories-windows\"><code>app.setJumpList(categories)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>categories</code> <a href=\"/docs/api/structures/jump-list-category\">JumpListCategory[]</a> | <code>null</code> - Array of <code>JumpListCategory</code> objects.</li>\n</ul>\n<p>Sets or removes a custom Jump List for the application, and returns one of the\nfollowing strings:</p>\n<ul>\n<li><code>ok</code> - Nothing went wrong.</li>\n<li><code>error</code> - One or more errors occurred, enable runtime logging to figure out\nthe likely cause.</li>\n<li><code>invalidSeparatorError</code> - An attempt was made to add a separator to a\ncustom category in the Jump List. Separators are only allowed in the\nstandard <code>Tasks</code> category.</li>\n<li><code>fileTypeRegistrationError</code> - An attempt was made to add a file link to\nthe Jump List for a file type the app isn't registered to handle.</li>\n<li><code>customCategoryAccessDeniedError</code> - Custom categories can't be added to the\nJump List due to user privacy or group policy settings.</li>\n</ul>\n<p>If <code>categories</code> is <code>null</code> the previously set custom Jump List (if any) will be\nreplaced by the standard Jump List for the app (managed by Windows).</p>\n<p><strong>Note:</strong> If a <code>JumpListCategory</code> object has neither the <code>type</code> nor the <code>name</code>\nproperty set then its <code>type</code> is assumed to be <code>tasks</code>. If the <code>name</code> property\nis set but the <code>type</code> property is omitted then the <code>type</code> is assumed to be\n<code>custom</code>.</p>\n<p><strong>Note:</strong> Users can remove items from custom categories, and Windows will not\nallow a removed item to be added back into a custom category until <strong>after</strong>\nthe next successful call to <code>app.setJumpList(categories)</code>. Any attempt to\nre-add a removed item to a custom category earlier than that will result in the\nentire custom category being omitted from the Jump List. The list of removed\nitems can be obtained using <code>app.getJumpListSettings()</code>.</p>\n<p><strong>Note:</strong> The maximum length of a Jump List item's <code>description</code> property is\n260 characters. Beyond this limit, the item will not be added to the Jump\nList, nor will it be displayed.</p>\n<p>Here's a very simple example of creating a custom Jump List:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setJumpList([\n  {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'custom'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Recent Projects'</span>,\n    <span class=\"hljs-attr\">items</span>: [\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'file'</span>, <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'C:\\\\Projects\\\\project1.proj'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'file'</span>, <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'C:\\\\Projects\\\\project2.proj'</span> }\n    ]\n  },\n  { <span class=\"hljs-comment\">// has a name so `type` is assumed to be \"custom\"</span>\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Tools'</span>,\n    <span class=\"hljs-attr\">items</span>: [\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Tool A'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--run-tool-a'</span>,\n        <span class=\"hljs-attr\">icon</span>: process.execPath,\n        <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Runs Tool A'</span>\n      },\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Tool B'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--run-tool-b'</span>,\n        <span class=\"hljs-attr\">icon</span>: process.execPath,\n        <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Runs Tool B'</span>\n      }\n    ]\n  },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'frequent'</span> },\n  { <span class=\"hljs-comment\">// has no name and no type so `type` is assumed to be \"tasks\"</span>\n    <span class=\"hljs-attr\">items</span>: [\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'New Project'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--new-project'</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Create a new project.'</span>\n      },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Recover Project'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--recover-project'</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Recover Project'</span>\n      }\n    ]\n  }\n])\n</code></pre>\n<h3 id=\"apprequestsingleinstancelock\"><a href=\"#apprequestsingleinstancelock\"><code>app.requestSingleInstanceLock()</code></a></h3>\n<p>Returns <code>Boolean</code></p>\n<p>The return value of this method indicates whether or not this instance of your\napplication successfully obtained the lock.  If it failed to obtain the lock,\nyou can assume that another instance of your application is already running with\nthe lock and exit immediately.</p>\n<p>I.e. This method returns <code>true</code> if your process is the primary instance of your\napplication and your app should continue loading.  It returns <code>false</code> if your\nprocess should immediately quit as it has sent its parameters to another\ninstance that has already acquired the lock.</p>\n<p>On macOS, the system enforces single instance automatically when users try to open\na second instance of your app in Finder, and the <code>open-file</code> and <code>open-url</code>\nevents will be emitted for that. However when users start your app in command\nline, the system's single instance mechanism will be bypassed, and you have to\nuse this method to ensure single instance.</p>\n<p>An example of activating the window of primary instance when a second instance\nstarts:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> myWindow = <span class=\"hljs-literal\">null</span>\n\n<span class=\"hljs-keyword\">const</span> gotTheLock = app.requestSingleInstanceLock()\n\n<span class=\"hljs-keyword\">if</span> (!gotTheLock) {\n  app.quit()\n} <span class=\"hljs-keyword\">else</span> {\n  app.on(<span class=\"hljs-string\">'second-instance'</span>, (event, commandLine, workingDirectory) => {\n    <span class=\"hljs-comment\">// Someone tried to run a second instance, we should focus our window.</span>\n    <span class=\"hljs-keyword\">if</span> (myWindow) {\n      <span class=\"hljs-keyword\">if</span> (myWindow.isMinimized()) myWindow.restore()\n      myWindow.focus()\n    }\n  })\n\n  <span class=\"hljs-comment\">// Create myWindow, load the rest of the app, etc...</span>\n  app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    myWindow = createWindow()\n  })\n}\n</code></pre>\n<h3 id=\"apphassingleinstancelock\"><a href=\"#apphassingleinstancelock\"><code>app.hasSingleInstanceLock()</code></a></h3>\n<p>Returns <code>Boolean</code></p>\n<p>This method returns whether or not this instance of your app is currently\nholding the single instance lock.  You can request the lock with\n<code>app.requestSingleInstanceLock()</code> and release with\n<code>app.releaseSingleInstanceLock()</code></p>\n<h3 id=\"appreleasesingleinstancelock\"><a href=\"#appreleasesingleinstancelock\"><code>app.releaseSingleInstanceLock()</code></a></h3>\n<p>Releases all locks that were created by <code>requestSingleInstanceLock</code>. This will\nallow multiple instances of the application to once again run side by side.</p>\n<h3 id=\"appsetuseractivitytype-userinfo-webpageurl-macos\"><a href=\"#appsetuseractivitytype-userinfo-webpageurl-macos\"><code>app.setUserActivity(type, userInfo[, webpageURL])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>type</code> String - Uniquely identifies the activity. Maps to\n<a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> any - App-specific state to store for use by another device.</li>\n<li><code>webpageURL</code> String (optional) - The webpage to load in a browser if no suitable app is\ninstalled on the resuming device. The scheme must be <code>http</code> or <code>https</code>.</li>\n</ul>\n<p>Creates an <code>NSUserActivity</code> and sets it as the current activity. The activity\nis eligible for <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> to another device afterward.</p>\n<h3 id=\"appgetcurrentactivitytype-macos\"><a href=\"#appgetcurrentactivitytype-macos\"><code>app.getCurrentActivityType()</code> <em>macOS</em></a></h3>\n<p>Returns <code>String</code> - The type of the currently running activity.</p>\n<h3 id=\"appinvalidatecurrentactivity-macos\"><a href=\"#appinvalidatecurrentactivity-macos\"><code>app.invalidateCurrentActivity()</code> <em>macOS</em></a></h3>\n<p>Invalidates the current <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> user activity.</p>\n<h3 id=\"appresigncurrentactivity-macos\"><a href=\"#appresigncurrentactivity-macos\"><code>app.resignCurrentActivity()</code> <em>macOS</em></a></h3>\n<p>Marks the current <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> user activity as inactive without invalidating it.</p>\n<h3 id=\"appupdatecurrentactivitytype-userinfo-macos\"><a href=\"#appupdatecurrentactivitytype-userinfo-macos\"><code>app.updateCurrentActivity(type, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>type</code> String - Uniquely identifies the activity. Maps to\n<a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> any - App-specific state to store for use by another device.</li>\n</ul>\n<p>Updates the current activity if its type matches <code>type</code>, merging the entries from\n<code>userInfo</code> into its current <code>userInfo</code> dictionary.</p>\n<h3 id=\"appsetappusermodelidid-windows\"><a href=\"#appsetappusermodelidid-windows\"><code>app.setAppUserModelId(id)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>id</code> String</li>\n</ul>\n<p>Changes the <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> to <code>id</code>.</p>\n<h3 id=\"appsetactivationpolicypolicy-macos\"><a href=\"#appsetactivationpolicypolicy-macos\"><code>app.setActivationPolicy(policy)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>policy</code> String - Can be 'regular', 'accessory', or 'prohibited'.</li>\n</ul>\n<p>Sets the activation policy for a given app.</p>\n<p>Activation policy types:</p>\n<ul>\n<li>'regular' - The application is an ordinary app that appears in the Dock and may have a user interface.</li>\n<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>\n<li>'prohibited' - The application doesn’t appear in the Dock and may not create windows or be activated.</li>\n</ul>\n<h3 id=\"appimportcertificateoptions-callback-linux\"><a href=\"#appimportcertificateoptions-callback-linux\"><code>app.importCertificate(options, callback)</code> <em>Linux</em></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>certificate</code> String - Path for the pkcs12 file.</li>\n<li><code>password</code> String - Passphrase for the certificate.</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>result</code> Integer - Result of import.</li>\n</ul></li>\n</ul>\n<p>Imports the certificate in pkcs12 format into the platform certificate store.\n<code>callback</code> is called with the <code>result</code> of import operation, a value of <code>0</code>\nindicates success while any other value indicates failure according to Chromium <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">net_error_list</a>.</p>\n<h3 id=\"appconfigurehostresolveroptions\"><a href=\"#appconfigurehostresolveroptions\"><code>app.configureHostResolver(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>enableBuiltInResolver</code> Boolean (optional) - Whether the built-in host\nresolver is used in preference to getaddrinfo. When enabled, the built-in\nresolver will attempt to use the system's DNS settings to do DNS lookups\nitself. Enabled by default on macOS, disabled by default on Windows and\nLinux.</li>\n<li><code>secureDnsMode</code> String (optional) - Can be \"off\", \"automatic\" or \"secure\".\nConfigures the DNS-over-HTTP mode. When \"off\", no DoH lookups will be\nperformed. When \"automatic\", DoH lookups will be performed first if DoH is\navailable, and insecure DNS lookups will be performed as a fallback. When\n\"secure\", only DoH lookups will be performed. Defaults to \"automatic\".</li>\n<li><code>secureDnsServers</code> String[] (optional) - A list of DNS-over-HTTP\nserver templates. See <a href=\"https://datatracker.ietf.org/doc/html/rfc8484#section-3\">RFC8484 § 3</a> for details on the template format.\nMost servers support the POST method; the template for such servers is\nsimply a URI. Note that for <a href=\"https://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&#x26;ss=chromium%2Fchromium%2Fsrc\">some DNS providers</a>, the\nresolver will automatically upgrade to DoH unless DoH is explicitly\ndisabled, even if there are no DoH servers provided in this list.</li>\n<li><code>enableAdditionalDnsQueryTypes</code> Boolean (optional) - Controls whether additional DNS\nquery types, e.g. HTTPS (DNS type 65) will be allowed besides the\ntraditional A and AAAA queries when a request is being made via insecure\nDNS. Has no effect on Secure DNS which always allows additional types.\nDefaults to true.</li>\n</ul></li>\n</ul>\n<p>Configures host resolution (DNS and DNS-over-HTTPS). By default, the following\nresolvers will be used, in order:</p>\n<ol>\n<li>DNS-over-HTTPS, if the <a href=\"https://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&#x26;ss=chromium%2Fchromium%2Fsrc\">DNS provider supports it</a>, then</li>\n<li>the built-in resolver (enabled on macOS only by default), then</li>\n<li>the system's resolver (e.g. <code>getaddrinfo</code>).</li>\n</ol>\n<p>This can be configured to either restrict usage of non-encrypted DNS\n(<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>\n<p>To disable insecure DNS, you can specify a <code>secureDnsMode</code> of <code>\"secure\"</code>. If you do\nso, you should make sure to provide a list of DNS-over-HTTPS servers to use, in\ncase the user's DNS configuration does not include a provider that supports\nDoH.</p>\n<pre><code class=\"hljs language-js\">app.configureHostResolver({\n  <span class=\"hljs-attr\">secureDnsMode</span>: <span class=\"hljs-string\">'secure'</span>,\n  <span class=\"hljs-attr\">secureDnsServers</span>: [\n    <span class=\"hljs-string\">'https://cloudflare-dns.com/dns-query'</span>\n  ]\n})\n</code></pre>\n<p>This API must be called after the <code>ready</code> event is emitted.</p>\n<h3 id=\"appdisablehardwareacceleration\"><a href=\"#appdisablehardwareacceleration\"><code>app.disableHardwareAcceleration()</code></a></h3>\n<p>Disables hardware acceleration for current app.</p>\n<p>This method can only be called before app is ready.</p>\n<h3 id=\"appdisabledomainblockingfor3dapis\"><a href=\"#appdisabledomainblockingfor3dapis\"><code>app.disableDomainBlockingFor3DAPIs()</code></a></h3>\n<p>By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per\ndomain basis if the GPU processes crashes too frequently. This function\ndisables that behavior.</p>\n<p>This method can only be called before app is ready.</p>\n<h3 id=\"appgetappmetrics\"><a href=\"#appgetappmetrics\"><code>app.getAppMetrics()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/process-metric\"><code>ProcessMetric[]</code></a>: Array of <code>ProcessMetric</code> objects that correspond to memory and CPU usage statistics of all the processes associated with the app.</p>\n<h3 id=\"appgetgpufeaturestatus\"><a href=\"#appgetgpufeaturestatus\"><code>app.getGPUFeatureStatus()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/gpu-feature-status\"><code>GPUFeatureStatus</code></a> - The Graphics Feature Status from <code>chrome://gpu/</code>.</p>\n<p><strong>Note:</strong> This information is only usable after the <code>gpu-info-update</code> event is emitted.</p>\n<h3 id=\"appgetgpuinfoinfotype\"><a href=\"#appgetgpuinfoinfotype\"><code>app.getGPUInfo(infoType)</code></a></h3>\n<ul>\n<li><code>infoType</code> String - Can be <code>basic</code> or <code>complete</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;unknown></code></p>\n<p>For <code>infoType</code> equal to <code>complete</code>:\nPromise is fulfilled with <code>Object</code> containing all the GPU Information as in <a href=\"https://chromium.googlesource.com/chromium/src/+/4178e190e9da409b055e5dff469911ec6f6b716f/gpu/config/gpu_info.cc\">chromium's GPUInfo object</a>. This includes the version and driver information that's shown on <code>chrome://gpu</code> page.</p>\n<p>For <code>infoType</code> equal to <code>basic</code>:\nPromise is fulfilled with <code>Object</code> containing fewer attributes than when requested with <code>complete</code>. Here's an example of basic response:</p>\n<pre><code class=\"hljs language-js\">{\n  <span class=\"hljs-attr\">auxAttributes</span>:\n   {\n     <span class=\"hljs-attr\">amdSwitchable</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">canSupportThreadedTextureMailbox</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">directComposition</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">directRendering</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">glResetNotificationStrategy</span>: <span class=\"hljs-number\">0</span>,\n     <span class=\"hljs-attr\">inProcessGpu</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">initializationTime</span>: <span class=\"hljs-number\">0</span>,\n     <span class=\"hljs-attr\">jpegDecodeAcceleratorSupported</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">optimus</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">passthroughCmdDecoder</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">sandboxed</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">softwareRendering</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">supportsOverlays</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">videoDecodeAcceleratorFlags</span>: <span class=\"hljs-number\">0</span>\n   },\n  <span class=\"hljs-attr\">gpuDevice</span>:\n   [{ <span class=\"hljs-attr\">active</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">deviceId</span>: <span class=\"hljs-number\">26657</span>, <span class=\"hljs-attr\">vendorId</span>: <span class=\"hljs-number\">4098</span> },\n     { <span class=\"hljs-attr\">active</span>: <span class=\"hljs-literal\">false</span>, <span class=\"hljs-attr\">deviceId</span>: <span class=\"hljs-number\">3366</span>, <span class=\"hljs-attr\">vendorId</span>: <span class=\"hljs-number\">32902</span> }],\n  <span class=\"hljs-attr\">machineModelName</span>: <span class=\"hljs-string\">'MacBookPro'</span>,\n  <span class=\"hljs-attr\">machineModelVersion</span>: <span class=\"hljs-string\">'11.5'</span>\n}\n</code></pre>\n<p>Using <code>basic</code> should be preferred if only basic information like <code>vendorId</code> or <code>driverId</code> is needed.</p>\n<h3 id=\"appsetbadgecountcount-linux-macos\"><a href=\"#appsetbadgecountcount-linux-macos\"><code>app.setBadgeCount([count])</code> <em>Linux</em> <em>macOS</em></a></h3>\n<ul>\n<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>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the call succeeded.</p>\n<p>Sets the counter badge for current app. Setting the count to <code>0</code> will hide the\nbadge.</p>\n<p>On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.</p>\n<p><strong>Note:</strong> Unity launcher requires a <code>.desktop</code> file to work. For more information,\nplease read the <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Unity integration documentation</a>.</p>\n<h3 id=\"appgetbadgecount-linux-macos\"><a href=\"#appgetbadgecount-linux-macos\"><code>app.getBadgeCount()</code> <em>Linux</em> <em>macOS</em></a></h3>\n<p>Returns <code>Integer</code> - The current value displayed in the counter badge.</p>\n<h3 id=\"appisunityrunning-linux\"><a href=\"#appisunityrunning-linux\"><code>app.isUnityRunning()</code> <em>Linux</em></a></h3>\n<p>Returns <code>Boolean</code> - Whether the current desktop environment is Unity launcher.</p>\n<h3 id=\"appgetloginitemsettingsoptions-macos-windows\"><a href=\"#appgetloginitemsettingsoptions-macos-windows\"><code>app.getLoginItemSettings([options])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>path</code> String (optional) <em>Windows</em> - The executable path to compare against.\nDefaults to <code>process.execPath</code>.</li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - The command-line arguments to compare\nagainst. Defaults to an empty array.</li>\n</ul></li>\n</ul>\n<p>If you provided <code>path</code> and <code>args</code> options to <code>app.setLoginItemSettings</code>, then you\nneed to pass the same arguments here for <code>openAtLogin</code> to be set correctly.</p>\n<p>Returns <code>Object</code>:</p>\n<ul>\n<li><code>openAtLogin</code> Boolean - <code>true</code> if the app is set to open at login.</li>\n<li><code>openAsHidden</code> Boolean <em>macOS</em> - <code>true</code> if the app is set to open as hidden at login.\nThis setting is not available on <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>wasOpenedAtLogin</code> Boolean <em>macOS</em> - <code>true</code> if the app was opened at login\nautomatically. This setting is not available on <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>wasOpenedAsHidden</code> Boolean <em>macOS</em> - <code>true</code> if the app was opened as a hidden login\nitem. This indicates that the app should not open any windows at startup.\nThis setting is not available on <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>restoreState</code> Boolean <em>macOS</em> - <code>true</code> if the app was opened as a login item that\nshould restore the state from the previous session. This indicates that the\napp should restore the windows that were open the last time the app was\nclosed. This setting is not available on <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>executableWillLaunchAtLogin</code> Boolean <em>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>\n<li><code>launchItems</code> Object[] <em>Windows</em><ul>\n<li><code>name</code> String <em>Windows</em> - name value of a registry entry.</li>\n<li><code>path</code> String <em>Windows</em> - The executable to an app that corresponds to a registry entry.</li>\n<li><code>args</code> String[] <em>Windows</em> - the command-line arguments to pass to the executable.</li>\n<li><code>scope</code> String <em>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>\n<li><code>enabled</code> Boolean <em>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>\n</ul></li>\n</ul>\n<h3 id=\"appsetloginitemsettingssettings-macos-windows\"><a href=\"#appsetloginitemsettingssettings-macos-windows\"><code>app.setLoginItemSettings(settings)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>settings</code> Object<ul>\n<li><code>openAtLogin</code> Boolean (optional) - <code>true</code> to open the app at login, <code>false</code> to remove\nthe app as a login item. Defaults to <code>false</code>.</li>\n<li><code>openAsHidden</code> Boolean (optional) <em>macOS</em> - <code>true</code> to open the app as hidden. Defaults to\n<code>false</code>. The user can edit this setting from the System Preferences so\n<code>app.getLoginItemSettings().wasOpenedAsHidden</code> should be checked when the app\nis opened to know the current value. This setting is not available on <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>path</code> String (optional) <em>Windows</em> - The executable to launch at login.\nDefaults to <code>process.execPath</code>.</li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - The command-line arguments to pass to\nthe executable. Defaults to an empty array. Take care to wrap paths in\nquotes.</li>\n<li><code>enabled</code> Boolean (optional) <em>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.\nDefaults to <code>true</code>.</li>\n<li><code>name</code> String (optional) <em>Windows</em> - value name to write into registry. Defaults to the app's AppUserModelId().\nSet the app's login item settings.</li>\n</ul></li>\n</ul>\n<p>To work with Electron's <code>autoUpdater</code> on Windows, which uses <a href=\"https://github.com/Squirrel/Squirrel.Windows\">Squirrel</a>,\nyou'll want to set the launch path to Update.exe, and pass arguments that specify your\napplication name. For example:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> appFolder = path.dirname(process.execPath)\n<span class=\"hljs-keyword\">const</span> updateExe = path.resolve(appFolder, <span class=\"hljs-string\">'..'</span>, <span class=\"hljs-string\">'Update.exe'</span>)\n<span class=\"hljs-keyword\">const</span> exeName = path.basename(process.execPath)\n\napp.setLoginItemSettings({\n  <span class=\"hljs-attr\">openAtLogin</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">path</span>: updateExe,\n  <span class=\"hljs-attr\">args</span>: [\n    <span class=\"hljs-string\">'--processStart'</span>, <span class=\"hljs-string\">`\"<span class=\"hljs-subst\">${exeName}</span>\"`</span>,\n    <span class=\"hljs-string\">'--process-start-args'</span>, <span class=\"hljs-string\">`\"--hidden\"`</span>\n  ]\n})\n</code></pre>\n<h3 id=\"appisaccessibilitysupportenabled-macos-windows\"><a href=\"#appisaccessibilitysupportenabled-macos-windows\"><code>app.isAccessibilitySupportEnabled()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Returns <code>Boolean</code> - <code>true</code> if Chrome's accessibility support is enabled,\n<code>false</code> otherwise. This API will return <code>true</code> if the use of assistive\ntechnologies, such as screen readers, has been detected. See\n<a href=\"https://www.chromium.org/developers/design-documents/accessibility\">https://www.chromium.org/developers/design-documents/accessibility</a> for more\ndetails.</p>\n<h3 id=\"appsetaccessibilitysupportenabledenabled-macos-windows\"><a href=\"#appsetaccessibilitysupportenabledenabled-macos-windows\"><code>app.setAccessibilitySupportEnabled(enabled)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>enabled</code> Boolean - Enable or disable <a href=\"https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree\">accessibility tree</a> rendering</li>\n</ul>\n<p>Manually enables Chrome's accessibility support, allowing to expose accessibility switch to users in application settings. See <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">Chromium's accessibility docs</a> for more\ndetails. Disabled by default.</p>\n<p>This API must be called after the <code>ready</code> event is emitted.</p>\n<p><strong>Note:</strong> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.</p>\n<h3 id=\"appshowaboutpanel\"><a href=\"#appshowaboutpanel\"><code>app.showAboutPanel()</code></a></h3>\n<p>Show the app's about panel options. These options can be overridden with <code>app.setAboutPanelOptions(options)</code>.</p>\n<h3 id=\"appsetaboutpaneloptionsoptions\"><a href=\"#appsetaboutpaneloptionsoptions\"><code>app.setAboutPanelOptions(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>applicationName</code> String (optional) - The app's name.</li>\n<li><code>applicationVersion</code> String (optional) - The app's version.</li>\n<li><code>copyright</code> String (optional) - Copyright information.</li>\n<li><code>version</code> String (optional) <em>macOS</em> - The app's build version number.</li>\n<li><code>credits</code> String (optional) <em>macOS</em> <em>Windows</em> - Credit information.</li>\n<li><code>authors</code> String<a href=\"/docs/api/optional\"></a> <em>Linux</em> - List of app authors.</li>\n<li><code>website</code> String (optional) <em>Linux</em> - The app's website.</li>\n<li><code>iconPath</code> String (optional) <em>Linux</em> <em>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>\n</ul></li>\n</ul>\n<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://developer.apple.com/reference/appkit/nsapplication/1428479-orderfrontstandardaboutpanelwith?language=objc\">Apple docs</a> for more details. On Linux, values must be set in order to be shown; there are no defaults.</p>\n<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://developer.apple.com/documentation/appkit/nsaboutpaneloptioncredits?language=objc\">documentation</a> for more information.</p>\n<h3 id=\"appisemojipanelsupported\"><a href=\"#appisemojipanelsupported\"><code>app.isEmojiPanelSupported()</code></a></h3>\n<p>Returns <code>Boolean</code> - whether or not the current OS version allows for native emoji pickers.</p>\n<h3 id=\"appshowemojipanel-macos-windows\"><a href=\"#appshowemojipanel-macos-windows\"><code>app.showEmojiPanel()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Show the platform's native emoji picker.</p>\n<h3 id=\"appstartaccessingsecurityscopedresourcebookmarkdata-mas\"><a href=\"#appstartaccessingsecurityscopedresourcebookmarkdata-mas\"><code>app.startAccessingSecurityScopedResource(bookmarkData)</code> <em>mas</em></a></h3>\n<ul>\n<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>\n</ul>\n<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://developer.apple.com/reference/foundation/nsurl/1417051-startaccessingsecurityscopedreso?language=objc\">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>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Start accessing the file.</span>\n<span class=\"hljs-keyword\">const</span> stopAccessingSecurityScopedResource = app.startAccessingSecurityScopedResource(data)\n<span class=\"hljs-comment\">// You can now access the file outside of the sandbox 🎉</span>\n\n<span class=\"hljs-comment\">// Remember to stop accessing the file once you've finished with it.</span>\nstopAccessingSecurityScopedResource()\n</code></pre>\n<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://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">Apple's documentation</a> for a description of how this system works.</p>\n<h3 id=\"appenablesandbox\"><a href=\"#appenablesandbox\"><code>app.enableSandbox()</code></a></h3>\n<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>\n<p>This method can only be called before app is ready.</p>\n<h3 id=\"appisinapplicationsfolder-macos\"><a href=\"#appisinapplicationsfolder-macos\"><code>app.isInApplicationsFolder()</code> <em>macOS</em></a></h3>\n<p>Returns <code>Boolean</code> - Whether the application is currently running from the\nsystems Application folder. Use in combination with <code>app.moveToApplicationsFolder()</code></p>\n<h3 id=\"appmovetoapplicationsfolderoptions-macos\"><a href=\"#appmovetoapplicationsfolderoptions-macos\"><code>app.moveToApplicationsFolder([options])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>conflictHandler</code> Function\\<boolean> (optional) - A handler for potential conflict in move failure.<ul>\n<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>\n</ul></boolean></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the move was successful. Please note that if\nthe move is successful, your application will quit and relaunch.</p>\n<p>No confirmation dialog will be presented by default. If you wish to allow\nthe user to confirm the operation, you may do so using the\n<a href=\"/docs/api/dialog\"><code>dialog</code></a> API.</p>\n<p><strong>NOTE:</strong> This method throws errors if anything other than the user causes the\nmove to fail. For instance if the user cancels the authorization dialog, this\nmethod returns false. If we fail to perform the copy, then this method will\nthrow an error. The message in the error should be informative and tell\nyou exactly what went wrong.</p>\n<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>\n<p>For example:</p>\n<pre><code class=\"hljs language-js\">app.moveToApplicationsFolder({\n  <span class=\"hljs-attr\">conflictHandler</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">conflictType</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (conflictType === <span class=\"hljs-string\">'exists'</span>) {\n      <span class=\"hljs-keyword\">return</span> dialog.showMessageBoxSync({\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'question'</span>,\n        <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Halt Move'</span>, <span class=\"hljs-string\">'Continue Move'</span>],\n        <span class=\"hljs-attr\">defaultId</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'An app of this name already exists'</span>\n      }) === <span class=\"hljs-number\">1</span>\n    }\n  }\n})\n</code></pre>\n<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>\n<h3 id=\"appissecurekeyboardentryenabled-macos\"><a href=\"#appissecurekeyboardentryenabled-macos\"><code>app.isSecureKeyboardEntryEnabled()</code> <em>macOS</em></a></h3>\n<p>Returns <code>Boolean</code> - whether <code>Secure Keyboard Entry</code> is enabled.</p>\n<p>By default this API will return <code>false</code>.</p>\n<h3 id=\"appsetsecurekeyboardentryenabledenabled-macos\"><a href=\"#appsetsecurekeyboardentryenabledenabled-macos\"><code>app.setSecureKeyboardEntryEnabled(enabled)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>enabled</code> Boolean - Enable or disable <code>Secure Keyboard Entry</code></li>\n</ul>\n<p>Set the <code>Secure Keyboard Entry</code> is enabled in your application.</p>\n<p>By using this API, important information such as password and other sensitive information can be prevented from being intercepted by other processes.</p>\n<p>See <a href=\"https://developer.apple.com/library/archive/technotes/tn2150/_index.html\">Apple's documentation</a> for more\ndetails.</p>\n<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>\n<h2 id=\"properties\"><a href=\"#properties\">Properties</a></h2>\n<h3 id=\"appaccessibilitysupportenabled-macos-windows\"><a href=\"#appaccessibilitysupportenabled-macos-windows\"><code>app.accessibilitySupportEnabled</code> <em>macOS</em> <em>Windows</em></a></h3>\n<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>\n<p>See <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">Chromium's accessibility docs</a> for more details. Disabled by default.</p>\n<p>This API must be called after the <code>ready</code> event is emitted.</p>\n<p><strong>Note:</strong> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.</p>\n<h3 id=\"appapplicationmenu\"><a href=\"#appapplicationmenu\"><code>app.applicationMenu</code></a></h3>\n<p>A <code>Menu | null</code> property that returns <a href=\"/docs/api/menu\"><code>Menu</code></a> if one has been set and <code>null</code> otherwise.\nUsers can pass a <a href=\"/docs/api/menu\">Menu</a> to set this property.</p>\n<h3 id=\"appbadgecount-linux-macos\"><a href=\"#appbadgecount-linux-macos\"><code>app.badgeCount</code> <em>Linux</em> <em>macOS</em></a></h3>\n<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>\n<p>On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher.</p>\n<p><strong>Note:</strong> Unity launcher requires a <code>.desktop</code> file to work. For more information,\nplease read the <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Unity integration documentation</a>.</p>\n<p><strong>Note:</strong> On macOS, you need to ensure that your application has the permission\nto display notifications for this property to take effect.</p>\n<h3 id=\"appcommandline-readonly\"><a href=\"#appcommandline-readonly\"><code>app.commandLine</code> <em>Readonly</em></a></h3>\n<p>A <a href=\"/docs/api/command-line\"><code>CommandLine</code></a> object that allows you to read and manipulate the\ncommand line arguments that Chromium uses.</p>\n<h3 id=\"appdock-macos-readonly\"><a href=\"#appdock-macos-readonly\"><code>app.dock</code> <em>macOS</em> <em>Readonly</em></a></h3>\n<p>A <a href=\"/docs/api/dock\"><code>Dock</code></a> <code>| undefined</code> object that allows you to perform actions on your app icon in the user's\ndock on macOS.</p>\n<h3 id=\"appispackaged-readonly\"><a href=\"#appispackaged-readonly\"><code>app.isPackaged</code> <em>Readonly</em></a></h3>\n<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>\n<h3 id=\"appname\"><a href=\"#appname\"><code>app.name</code></a></h3>\n<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>\n<p>Usually the <code>name</code> field of <code>package.json</code> is a short lowercase name, according\nto the npm modules spec. You should usually also specify a <code>productName</code>\nfield, which is your application's full capitalized name, and which will be\npreferred over <code>name</code> by Electron.</p>\n<h3 id=\"appuseragentfallback\"><a href=\"#appuseragentfallback\"><code>app.userAgentFallback</code></a></h3>\n<p>A <code>String</code> which is the user agent string Electron will use as a global fallback.</p>\n<p>This is the user agent that will be used when no user agent is set at the\n<code>webContents</code> or <code>session</code> level.  It is useful for ensuring that your entire\napp has the same user agent.  Set to a custom value as early as possible\nin your app's initialization to ensure that your overridden value is used.</p>\n<h3 id=\"apprunningunderrosettatranslation-macos-readonly-deprecated\"><a href=\"#apprunningunderrosettatranslation-macos-readonly-deprecated\"><code>app.runningUnderRosettaTranslation</code> <em>macOS</em> <em>Readonly</em> <em>Deprecated</em></a></h3>\n<p>A <code>Boolean</code> which when <code>true</code> indicates that the app is currently running\nunder the <a href=\"https://en.wikipedia.org/wiki/Rosetta_(software)\">Rosetta Translator Environment</a>.</p>\n<p>You can use this property to prompt users to download the arm64 version of\nyour application when they are running the x64 version under Rosetta\nincorrectly.</p>\n<p><strong>Deprecated:</strong> This property is superceded by the <code>runningUnderARM64Translation</code>\nproperty which detects when the app is being translated to ARM64 in both macOS\nand Windows.</p>\n<h3 id=\"apprunningunderarm64translation-readonly-macos-windows\"><a href=\"#apprunningunderarm64translation-readonly-macos-windows\"><code>app.runningUnderARM64Translation</code> <em>Readonly</em> <em>macOS</em> <em>Windows</em></a></h3>\n<p>A <code>Boolean</code> which when <code>true</code> indicates that the app is currently running under\nan ARM64 translator (like the macOS\n<a href=\"https://en.wikipedia.org/wiki/Rosetta_(software)\">Rosetta Translator Environment</a>\nor Windows <a href=\"https://en.wikipedia.org/wiki/Windows_on_Windows\">WOW</a>).</p>\n<p>You can use this property to prompt users to download the arm64 version of\nyour application when they are running the x64 version under Rosetta\nincorrectly.</p>",
      "title": "app",
      "description": "Control your application's event lifecycle."
    },
    "/docs/tutorial/application-debugging": {
      "locale": "en-US",
      "slug": "application-debugging",
      "href": "/docs/tutorial/application-debugging",
      "crowdinFileId": "256175",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/application-debugging.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"application-debugging\"><a href=\"#application-debugging\">Application Debugging</a></h1>\n<p>Whenever your Electron application is not behaving the way you wanted it to,\nan array of debugging tools might help you find coding errors, performance\nbottlenecks, or optimization opportunities.</p>\n<h2 id=\"renderer-process\"><a href=\"#renderer-process\">Renderer Process</a></h2>\n<p>The most comprehensive tool to debug individual renderer processes is the\nChromium Developer Toolset. It is available for all renderer processes,\nincluding instances of <code>BrowserWindow</code>, <code>BrowserView</code>, and <code>WebView</code>. You\ncan open them programmatically by calling the <code>openDevTools()</code> API on the\n<code>webContents</code> of the instance:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.openDevTools()\n</code></pre>\n<p>Google offers <a href=\"https://developer.chrome.com/devtools\">excellent documentation for their developer tools</a>.\nWe recommend that you make yourself familiar with them - they are usually one\nof the most powerful utilities in any Electron Developer's tool belt.</p>\n<h2 id=\"main-process\"><a href=\"#main-process\">Main Process</a></h2>\n<p>Debugging the main process is a bit trickier, since you cannot open\ndeveloper tools for them. The Chromium Developer Tools can <a href=\"https://nodejs.org/en/docs/inspector/\">be used\nto debug Electron's main process</a> thanks to a closer collaboration\nbetween Google / Chrome and Node.js, but you might encounter oddities like\n<code>require</code> not being present in the console.</p>\n<p>For more information, see the <a href=\"/docs/tutorial/debugging-main-process\">Debugging the Main Process documentation</a>.</p>\n<h2 id=\"v8-crashes\"><a href=\"#v8-crashes\">V8 Crashes</a></h2>\n<p>If the V8 context crashes, the DevTools will display this message.</p>\n<p><code>DevTools was disconnected from the page. Once page is reloaded, DevTools will automatically reconnect.</code></p>\n<p>Chromium logs can be enabled via the <code>ELECTRON_ENABLE_LOGGING</code> environment variable. For more information, see the <a href=\"/docs/api/environment-variables#electron_enable_logging\">environment variables documentation</a>.</p>\n<p>Alternatively, the command line argument <code>--enable-logging</code> can be passed. More information is available in the <a href=\"/docs/api/command-line-switches#--enable-loggingfile\">command line switches documentation</a>.</p>",
      "title": "Application Debugging",
      "description": ""
    },
    "/docs/tutorial/application-distribution": {
      "locale": "en-US",
      "slug": "application-distribution",
      "href": "/docs/tutorial/application-distribution",
      "crowdinFileId": "256177",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/application-distribution.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"application-distribution\"><a href=\"#application-distribution\">Application Distribution</a></h1>\n<h2 id=\"overview\"><a href=\"#overview\">Overview</a></h2>\n<p>To distribute your app with Electron, you need to package and rebrand it.\nTo do this, you can either use specialized tooling or manual approaches.</p>\n<h2 id=\"with-tooling\"><a href=\"#with-tooling\">With tooling</a></h2>\n<p>You can use the following tools to distribute your application:</p>\n<ul>\n<li><a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a></li>\n<li><a href=\"https://github.com/electron-userland/electron-builder\">electron-builder</a></li>\n<li><a href=\"https://github.com/electron/electron-packager\">electron-packager</a></li>\n</ul>\n<p>These tools will take care of all the steps you need to take to end up with a\ndistributable Electron application, such as bundling your application,\nrebranding the executable, and setting the right icons.</p>\n<p>You can check the example of how to package your app with <code>electron-forge</code> in\nthe <a href=\"/docs/tutorial/quick-start#package-and-distribute-your-application\">Quick Start guide</a>.</p>\n<h2 id=\"manual-distribution\"><a href=\"#manual-distribution\">Manual distribution</a></h2>\n<h3 id=\"with-prebuilt-binaries\"><a href=\"#with-prebuilt-binaries\">With prebuilt binaries</a></h3>\n<p>To distribute your app manually, you need to download Electron's <a href=\"https://github.com/electron/electron/releases\">prebuilt\nbinaries</a>. Next, the folder\ncontaining your app should be named <code>app</code> and placed in Electron's resources\ndirectory as shown in the following examples.</p>\n<blockquote>\n<p><em>NOTE:</em> the location of Electron's prebuilt binaries is indicated\nwith <code>electron/</code> in the examples below.</p>\n</blockquote>\n<p><em>On macOS:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/Electron.app/Contents/Resources/app/\n├── package.json\n├── main.js\n└── index.html\n</code></pre>\n<p><em>On Windows and Linux:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/resources/app\n├── package.json\n├── main.js\n└── index.html\n</code></pre>\n<p>Then execute <code>Electron.app</code> on macOS, <code>electron</code> on Linux, or <code>electron.exe</code>\non Windows, and Electron will start as your app. The <code>electron</code> directory\nwill then be your distribution to deliver to users.</p>\n<h3 id=\"with-an-app-source-code-archive\"><a href=\"#with-an-app-source-code-archive\">With an app source code archive</a></h3>\n<p>Instead of from shipping your app by copying all of its source files, you can\npackage your app into an <a href=\"https://github.com/electron/asar\">asar</a> archive to improve the performance of reading\nfiles on platforms like Windows, if you are not already using a bundler such\nas Parcel or Webpack.</p>\n<p>To use an <code>asar</code> archive to replace the <code>app</code> folder, you need to rename the\narchive to <code>app.asar</code>, and put it under Electron's resources directory like\nbelow, and Electron will then try to read the archive and start from it.</p>\n<p><em>On macOS:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/Electron.app/Contents/Resources/\n└── app.asar\n</code></pre>\n<p><em>On Windows and Linux:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/resources/\n└── app.asar\n</code></pre>\n<p>You can find more details on how to use <code>asar</code> in the\n<a href=\"https://github.com/electron/asar\"><code>electron/asar</code> repository</a>.</p>\n<h3 id=\"rebranding-with-downloaded-binaries\"><a href=\"#rebranding-with-downloaded-binaries\">Rebranding with downloaded binaries</a></h3>\n<p>After bundling your app into Electron, you will want to rebrand Electron\nbefore distributing it to users.</p>\n<h4 id=\"macos\"><a href=\"#macos\">macOS</a></h4>\n<p>You can rename <code>Electron.app</code> to any name you want, and you also have to rename\nthe <code>CFBundleDisplayName</code>, <code>CFBundleIdentifier</code> and <code>CFBundleName</code> fields in the\nfollowing files:</p>\n<ul>\n<li><code>Electron.app/Contents/Info.plist</code></li>\n<li><code>Electron.app/Contents/Frameworks/Electron Helper.app/Contents/Info.plist</code></li>\n</ul>\n<p>You can also rename the helper app to avoid showing <code>Electron Helper</code> in the\nActivity Monitor, but make sure you have renamed the helper app's executable\nfile's name.</p>\n<p>The structure of a renamed app would be like:</p>\n<pre><code class=\"hljs language-plaintext\">MyApp.app/Contents\n├── Info.plist\n├── MacOS/\n│   └── MyApp\n└── Frameworks/\n    └── MyApp Helper.app\n        ├── Info.plist\n        └── MacOS/\n            └── MyApp Helper\n</code></pre>\n<h4 id=\"windows\"><a href=\"#windows\">Windows</a></h4>\n<p>You can rename <code>electron.exe</code> to any name you like, and edit its icon and other\ninformation with tools like <a href=\"https://github.com/electron/rcedit\">rcedit</a>.</p>\n<h4 id=\"linux\"><a href=\"#linux\">Linux</a></h4>\n<p>You can rename the <code>electron</code> executable to any name you like.</p>\n<h3 id=\"rebranding-by-rebuilding-electron-from-source\"><a href=\"#rebranding-by-rebuilding-electron-from-source\">Rebranding by rebuilding Electron from source</a></h3>\n<p>It is also possible to rebrand Electron by changing the product name and\nbuilding it from source. To do this you need to set the build argument\ncorresponding to the product name (<code>electron_product_name = \"YourProductName\"</code>)\nin the <code>args.gn</code> file and rebuild.</p>",
      "title": "Application Distribution",
      "description": "NOTE: the location of Electron's prebuilt binaries is indicated\nwith electron/ in the examples below."
    },
    "/docs/api/auto-updater": {
      "locale": "en-US",
      "slug": "auto-updater",
      "href": "/docs/api/auto-updater",
      "crowdinFileId": "256281",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/auto-updater.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"autoupdater\"><a href=\"#autoupdater\">autoUpdater</a></h1>\n<blockquote>\n<p>Enable apps to automatically update themselves.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><strong>See also: <a href=\"/docs/tutorial/updates\">A detailed guide about how to implement updates in your application</a>.</strong></p>\n<p><code>autoUpdater</code> is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h2 id=\"platform-notices\"><a href=\"#platform-notices\">Platform Notices</a></h2>\n<p>Currently, only macOS and Windows are supported. There is no built-in support\nfor auto-updater on Linux, so it is recommended to use the\ndistribution's package manager to update your app.</p>\n<p>In addition, there are some subtle differences on each platform:</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>On macOS, the <code>autoUpdater</code> module is built upon <a href=\"https://github.com/Squirrel/Squirrel.Mac\">Squirrel.Mac</a>,\nmeaning you don't need any special setup to make it work. For server-side\nrequirements, you can read <a href=\"https://github.com/Squirrel/Squirrel.Mac#server-support\">Server Support</a>. Note that <a href=\"https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW35\">App\nTransport Security</a> (ATS) applies to all requests made as part of the\nupdate process. Apps that need to disable ATS can add the\n<code>NSAllowsArbitraryLoads</code> key to their app's plist.</p>\n<p><strong>Note:</strong> Your application must be signed for automatic updates on macOS.\nThis is a requirement of <code>Squirrel.Mac</code>.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<p>On Windows, you have to install your app into a user's machine before you can\nuse the <code>autoUpdater</code>, so it is recommended that you use the\n<a href=\"https://github.com/electron/windows-installer\">electron-winstaller</a>, <a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a> or the <a href=\"https://github.com/electron/grunt-electron-installer\">grunt-electron-installer</a> package to generate a Windows installer.</p>\n<p>When using <a href=\"https://github.com/electron/windows-installer\">electron-winstaller</a> or <a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a> make sure you do not try to update your app <a href=\"https://github.com/electron/windows-installer#handling-squirrel-events\">the first time it runs</a> (Also see <a href=\"https://github.com/electron/electron/issues/7155\">this issue for more info</a>). It's also recommended to use <a href=\"https://github.com/mongodb-js/electron-squirrel-startup\">electron-squirrel-startup</a> to get desktop shortcuts for your app.</p>\n<p>The installer generated with Squirrel will create a shortcut icon with an\n<a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> in the format of\n<code>com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE</code>, examples are\n<code>com.squirrel.slack.Slack</code> and <code>com.squirrel.code.Code</code>. You have to use the\nsame ID for your app with <code>app.setAppUserModelId</code> API, otherwise Windows will\nnot be able to pin your app properly in task bar.</p>\n<p>Like Squirrel.Mac, Windows can host updates on S3 or any other static file host.\nYou can read the documents of <a href=\"https://github.com/Squirrel/Squirrel.Windows\">Squirrel.Windows</a> to get more details\nabout how Squirrel.Windows works.</p>\n<h2 id=\"events\"><a href=\"#events\">Events</a></h2>\n<p>The <code>autoUpdater</code> object emits the following events:</p>\n<h3 id=\"event-error\"><a href=\"#event-error\">Event: 'error'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>error</code> Error</li>\n</ul>\n<p>Emitted when there is an error while updating.</p>\n<h3 id=\"event-checking-for-update\"><a href=\"#event-checking-for-update\">Event: 'checking-for-update'</a></h3>\n<p>Emitted when checking if an update has started.</p>\n<h3 id=\"event-update-available\"><a href=\"#event-update-available\">Event: 'update-available'</a></h3>\n<p>Emitted when there is an available update. The update is downloaded\nautomatically.</p>\n<h3 id=\"event-update-not-available\"><a href=\"#event-update-not-available\">Event: 'update-not-available'</a></h3>\n<p>Emitted when there is no available update.</p>\n<h3 id=\"event-update-downloaded\"><a href=\"#event-update-downloaded\">Event: 'update-downloaded'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>releaseNotes</code> String</li>\n<li><code>releaseName</code> String</li>\n<li><code>releaseDate</code> Date</li>\n<li><code>updateURL</code> String</li>\n</ul>\n<p>Emitted when an update has been downloaded.</p>\n<p>On Windows only <code>releaseName</code> is available.</p>\n<p><strong>Note:</strong> It is not strictly necessary to handle this event. A successfully\ndownloaded update will still be applied the next time the application starts.</p>\n<h3 id=\"event-before-quit-for-update\"><a href=\"#event-before-quit-for-update\">Event: 'before-quit-for-update'</a></h3>\n<p>This event is emitted after a user calls <code>quitAndInstall()</code>.</p>\n<p>When this API is called, the <code>before-quit</code> event is not emitted before all windows are closed. As a result you should listen to this event if you wish to perform actions before the windows are closed while a process is quitting, as well as listening to <code>before-quit</code>.</p>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>autoUpdater</code> object has the following methods:</p>\n<h3 id=\"autoupdatersetfeedurloptions\"><a href=\"#autoupdatersetfeedurloptions\"><code>autoUpdater.setFeedURL(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>url</code> String</li>\n<li><code>headers</code> Record&#x3C;String, String> (optional) <em>macOS</em> - HTTP request headers.</li>\n<li><code>serverType</code> String (optional) <em>macOS</em> - Can be <code>json</code> or <code>default</code>, see the <a href=\"https://github.com/Squirrel/Squirrel.Mac\">Squirrel.Mac</a>\nREADME for more information.</li>\n</ul></li>\n</ul>\n<p>Sets the <code>url</code> and initialize the auto updater.</p>\n<h3 id=\"autoupdatergetfeedurl\"><a href=\"#autoupdatergetfeedurl\"><code>autoUpdater.getFeedURL()</code></a></h3>\n<p>Returns <code>String</code> - The current update feed URL.</p>\n<h3 id=\"autoupdatercheckforupdates\"><a href=\"#autoupdatercheckforupdates\"><code>autoUpdater.checkForUpdates()</code></a></h3>\n<p>Asks the server whether there is an update. You must call <code>setFeedURL</code> before\nusing this API.</p>\n<p><strong>Note:</strong> If an update is available it will be downloaded automatically.\nCalling <code>autoUpdater.checkForUpdates()</code> twice will download the update two times.</p>\n<h3 id=\"autoupdaterquitandinstall\"><a href=\"#autoupdaterquitandinstall\"><code>autoUpdater.quitAndInstall()</code></a></h3>\n<p>Restarts the app and installs the update after it has been downloaded. It\nshould only be called after <code>update-downloaded</code> has been emitted.</p>\n<p>Under the hood calling <code>autoUpdater.quitAndInstall()</code> will close all application\nwindows first, and automatically call <code>app.quit()</code> after all windows have been\nclosed.</p>\n<p><strong>Note:</strong> It is not strictly necessary to call this function to apply an update,\nas a successfully downloaded update will always be applied the next time the\napplication starts.</p>",
      "title": "autoUpdater",
      "description": "Enable apps to automatically update themselves."
    },
    "/docs/tutorial/automated-testing-with-a-custom-driver": {
      "locale": "en-US",
      "slug": "automated-testing-with-a-custom-driver",
      "href": "/docs/tutorial/automated-testing-with-a-custom-driver",
      "crowdinFileId": "256179",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/automated-testing-with-a-custom-driver.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"automated-testing-with-a-custom-driver\"><a href=\"#automated-testing-with-a-custom-driver\">Automated Testing with a Custom Driver</a></h1>\n<p>To write automated tests for your Electron app, you will need a way to \"drive\" your application. <a href=\"https://electronjs.org/spectron\">Spectron</a> is a commonly-used solution which lets you emulate user actions via <a href=\"https://webdriver.io/\">WebDriver</a>. However, it's also possible to write your own custom driver using node's builtin IPC-over-STDIO. The benefit of a custom driver is that it tends to require less overhead than Spectron, and lets you expose custom methods to your test suite.</p>\n<p>To create a custom driver, we'll use Node.js' <a href=\"https://nodejs.org/api/child_process.html\">child_process</a> API. The test suite will spawn the Electron process, then establish a simple messaging protocol:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> childProcess = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'child_process'</span>)\n<span class=\"hljs-keyword\">const</span> electronPath = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// spawn the process</span>\n<span class=\"hljs-keyword\">const</span> env = { <span class=\"hljs-comment\">/* ... */</span> }\n<span class=\"hljs-keyword\">const</span> stdio = [<span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'ipc'</span>]\n<span class=\"hljs-keyword\">const</span> appProcess = childProcess.spawn(electronPath, [<span class=\"hljs-string\">'./app'</span>], { stdio, env })\n\n<span class=\"hljs-comment\">// listen for IPC messages from the app</span>\nappProcess.on(<span class=\"hljs-string\">'message'</span>, (msg) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// send an IPC message to the app</span>\nappProcess.send({ <span class=\"hljs-attr\">my</span>: <span class=\"hljs-string\">'message'</span> })\n</code></pre>\n<p>From within the Electron app, you can listen for messages and send replies using the Node.js <a href=\"https://nodejs.org/api/process.html\">process</a> API:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// listen for IPC messages from the test suite</span>\nprocess.on(<span class=\"hljs-string\">'message'</span>, (msg) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// send an IPC message to the test suite</span>\nprocess.send({ <span class=\"hljs-attr\">my</span>: <span class=\"hljs-string\">'message'</span> })\n</code></pre>\n<p>We can now communicate from the test suite to the Electron app using the <code>appProcess</code> object.</p>\n<p>For convenience, you may want to wrap <code>appProcess</code> in a driver object that provides more high-level functions. Here is an example of how you can do this:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">TestDriver</span> </span>{\n  <span class=\"hljs-keyword\">constructor</span> ({ path, args, env }) {\n    <span class=\"hljs-keyword\">this</span>.rpcCalls = []\n\n    <span class=\"hljs-comment\">// start child process</span>\n    env.APP_TEST_DRIVER = <span class=\"hljs-number\">1</span> <span class=\"hljs-comment\">// let the app know it should listen for messages</span>\n    <span class=\"hljs-keyword\">this</span>.process = childProcess.spawn(path, args, { <span class=\"hljs-attr\">stdio</span>: [<span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'ipc'</span>], env })\n\n    <span class=\"hljs-comment\">// handle rpc responses</span>\n    <span class=\"hljs-keyword\">this</span>.process.on(<span class=\"hljs-string\">'message'</span>, (message) => {\n      <span class=\"hljs-comment\">// pop the handler</span>\n      <span class=\"hljs-keyword\">const</span> rpcCall = <span class=\"hljs-keyword\">this</span>.rpcCalls[message.msgId]\n      <span class=\"hljs-keyword\">if</span> (!rpcCall) <span class=\"hljs-keyword\">return</span>\n      <span class=\"hljs-keyword\">this</span>.rpcCalls[message.msgId] = <span class=\"hljs-literal\">null</span>\n      <span class=\"hljs-comment\">// reject/resolve</span>\n      <span class=\"hljs-keyword\">if</span> (message.reject) rpcCall.reject(message.reject)\n      <span class=\"hljs-keyword\">else</span> rpcCall.resolve(message.resolve)\n    })\n\n    <span class=\"hljs-comment\">// wait for ready</span>\n    <span class=\"hljs-keyword\">this</span>.isReady = <span class=\"hljs-keyword\">this</span>.rpc(<span class=\"hljs-string\">'isReady'</span>).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">err</span>) =></span> {\n      <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Application failed to start'</span>, err)\n      <span class=\"hljs-keyword\">this</span>.stop()\n      process.exit(<span class=\"hljs-number\">1</span>)\n    })\n  }\n\n  <span class=\"hljs-comment\">// simple RPC call</span>\n  <span class=\"hljs-comment\">// to use: driver.rpc('method', 1, 2, 3).then(...)</span>\n  <span class=\"hljs-keyword\">async</span> rpc (cmd, ...args) {\n    <span class=\"hljs-comment\">// send rpc request</span>\n    <span class=\"hljs-keyword\">const</span> msgId = <span class=\"hljs-keyword\">this</span>.rpcCalls.length\n    <span class=\"hljs-keyword\">this</span>.process.send({ msgId, cmd, args })\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\">(<span class=\"hljs-params\">resolve, reject</span>) =></span> <span class=\"hljs-keyword\">this</span>.rpcCalls.push({ resolve, reject }))\n  }\n\n  stop () {\n    <span class=\"hljs-keyword\">this</span>.process.kill()\n  }\n}\n</code></pre>\n<p>In the app, you'd need to write a simple handler for the RPC calls:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">if</span> (process.env.APP_TEST_DRIVER) {\n  process.on(<span class=\"hljs-string\">'message'</span>, onMessage)\n}\n\n<span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">onMessage</span> (<span class=\"hljs-params\">{ msgId, cmd, args }</span>) </span>{\n  <span class=\"hljs-keyword\">let</span> method = METHODS[cmd]\n  <span class=\"hljs-keyword\">if</span> (!method) method = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Invalid method: '</span> + cmd)\n  <span class=\"hljs-keyword\">try</span> {\n    <span class=\"hljs-keyword\">const</span> resolve = <span class=\"hljs-keyword\">await</span> method(...args)\n    process.send({ msgId, resolve })\n  } <span class=\"hljs-keyword\">catch</span> (err) {\n    <span class=\"hljs-keyword\">const</span> reject = {\n      <span class=\"hljs-attr\">message</span>: err.message,\n      <span class=\"hljs-attr\">stack</span>: err.stack,\n      <span class=\"hljs-attr\">name</span>: err.name\n    }\n    process.send({ msgId, reject })\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> METHODS = {\n  isReady () {\n    <span class=\"hljs-comment\">// do any setup needed</span>\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-comment\">// define your RPC-able methods here</span>\n}\n</code></pre>\n<p>Then, in your test suite, you can use your test-driver as follows:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> test = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'ava'</span>)\n<span class=\"hljs-keyword\">const</span> electronPath = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> app = <span class=\"hljs-keyword\">new</span> TestDriver({\n  <span class=\"hljs-attr\">path</span>: electronPath,\n  <span class=\"hljs-attr\">args</span>: [<span class=\"hljs-string\">'./app'</span>],\n  <span class=\"hljs-attr\">env</span>: {\n    <span class=\"hljs-attr\">NODE_ENV</span>: <span class=\"hljs-string\">'test'</span>\n  }\n})\ntest.before(<span class=\"hljs-keyword\">async</span> t => {\n  <span class=\"hljs-keyword\">await</span> app.isReady\n})\ntest.after.always(<span class=\"hljs-string\">'cleanup'</span>, <span class=\"hljs-keyword\">async</span> t => {\n  <span class=\"hljs-keyword\">await</span> app.stop()\n})\n</code></pre>",
      "title": "Automated Testing with a Custom Driver",
      "description": ""
    },
    "/docs/development/azure-vm-setup": {
      "locale": "en-US",
      "slug": "azure-vm-setup",
      "href": "/docs/development/azure-vm-setup",
      "crowdinFileId": "256129",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/azure-vm-setup.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"updating-an-appveyor-azure-image\"><a href=\"#updating-an-appveyor-azure-image\">Updating an Appveyor Azure Image</a></h1>\n<p>Electron CI on Windows uses AppVeyor, which in turn uses Azure VM images to run.  Occasionally, these VM images need to be updated due to changes in Chromium requirements.  In order to update you will need <a href=\"https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6\">PowerShell</a> and the <a href=\"https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-1.8.0&#x26;viewFallbackFrom=azurermps-6.13.0\">Azure PowerShell module</a>.</p>\n<p>Occasionally we need to update these images owing to changes in Chromium or other miscellaneous build requirement changes.</p>\n<p>Example Use Case:\n* We need <code>VS15.9</code> and we have <code>VS15.7</code> installed; this would require us to update an Azure image.</p>\n<ol>\n<li>\n<p>Identify the image you wish to modify.</p>\n<ul>\n<li>In <a href=\"https://github.com/electron/electron/blob/main/appveyor.yml\">appveyor.yml</a>, the image is identified by the property <em>image</em>.<ul>\n<li>The names used correspond to the <em>\"images\"</em> defined for a build cloud, eg the <a href=\"https://windows-ci.electronjs.org/build-clouds/8\">libcc-20 cloud</a>.</li>\n</ul></li>\n<li>Find the image you wish to modify in the build cloud and make note of the <strong>VHD Blob Path</strong> for that image, which is the value for that corresponding key.<ul>\n<li>You will need this URI path to copy into a new image.</li>\n</ul></li>\n<li>You will also need the storage account name which is labeled in AppVeyor as the <strong>Disk Storage Account Name</strong></li>\n</ul>\n</li>\n<li>\n<p>Get the Azure storage account key</p>\n<ul>\n<li>Log into Azure using credentials stored in LastPass (under Azure Enterprise) and then find the storage account corresponding to the name found in AppVeyor.<ul>\n<li>Example, for <code>appveyorlibccbuilds</code> <strong>Disk Storage Account Name</strong> you'd look for <code>appveyorlibccbuilds</code> in the list of storage accounts @ Home &#x3C; Storage Accounts<ul>\n<li>Click into it and look for <code>Access Keys</code>, and then you can use any of the keys present in the list.</li>\n</ul></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Get the full virtual machine image URI from Azure</p>\n<ul>\n<li>Navigate to Home &#x3C; Storage Accounts &#x3C; <code>$ACCT_NAME</code> &#x3C; Blobs &#x3C; Images<ul>\n<li>In the following list, look for the VHD path name you got from Appveyor and then click on it.<ul>\n<li>Copy the whole URL from the top of the subsequent window.</li>\n</ul></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Copy the image using the <a href=\"https://github.com/appveyor/ci/blob/master/scripts/enterprise/copy-master-image-azure.ps1\">Copy Master Image PowerShell script</a>.</p>\n<ul>\n<li>It is essential to copy the VM because if you spin up a VM against an image that image cannot at the same time be used by AppVeyor.</li>\n<li>Use the storage account name, key, and URI obtained from Azure to run this script.<ul>\n<li>See Step 3 for URI &#x26; when prompted, press enter to use same storage account as destination.</li>\n<li>Use default destination container name <code>(images)</code></li>\n<li>Also, when naming the copy, use a name that indicates what the new image will contain (if that has changed) and date stamp.<ul>\n<li>Ex. <code>libcc-20core-vs2017-15.9-2019-04-15.vhd</code></li>\n</ul></li>\n</ul></li>\n<li>Go into Azure and get the URI for the newly created image as described in a previous step</li>\n</ul>\n</li>\n<li>\n<p>Spin up a new VM using the <a href=\"https://github.com/appveyor/ci/blob/master/scripts/enterprise/create_master_vm_from_vhd.ps1\">Create Master VM from VHD PowerShell</a>.</p>\n<ul>\n<li>From PowerShell, execute <code>ps1</code> file with <code>./create_master_vm_from_vhd.ps1</code></li>\n<li>You will need the credential information available in the AppVeyor build cloud definition.<ul>\n<li>This includes:<ul>\n<li>Client ID</li>\n<li>Client Secret</li>\n<li>Tenant ID</li>\n<li>Subscription ID</li>\n<li>Resource Group</li>\n<li>Virtual Network</li>\n</ul></li>\n</ul></li>\n<li>You will also need to specify<ul>\n<li>Master VM name - just a unique name to identify the temporary VM</li>\n<li>Master VM size - use <code>Standard_F32s_v2</code></li>\n<li>Master VHD URI - use URI obtained @ end of previous step</li>\n<li>Location use <code>East US</code></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Log back into Azure and find the VM you just created in Home &#x3C; Virtual Machines &#x3C; <code>$YOUR_NEW_VM</code></p>\n<ul>\n<li>You can download a RDP (Remote Desktop) file to access the VM.</li>\n</ul>\n</li>\n<li>\n<p>Using Microsoft Remote Desktop, click <code>Connect</code> to connect to the VM.</p>\n<ul>\n<li>Credentials for logging into the VM are found in LastPass under the <code>AppVeyor Enterprise master VM</code> credentials.</li>\n</ul>\n</li>\n<li>\n<p>Modify the VM as required.</p>\n</li>\n<li>\n<p>Shut down the VM and then delete it in Azure.</p>\n</li>\n<li>\n<p>Add the new image to the Appveyor Cloud settings or modify an existing image to point to the new VHD.</p>\n</li>\n</ol>",
      "title": "Updating an Appveyor Azure Image",
      "description": ""
    },
    "/docs/api/structures/bluetooth-device": {
      "locale": "en-US",
      "slug": "bluetooth-device",
      "href": "/docs/api/structures/bluetooth-device",
      "crowdinFileId": "256411",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/bluetooth-device.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"bluetoothdevice-object\"><a href=\"#bluetoothdevice-object\">BluetoothDevice Object</a></h1>\n<ul>\n<li><code>deviceName</code> String</li>\n<li><code>deviceId</code> String</li>\n</ul>",
      "title": "BluetoothDevice Object",
      "description": ""
    },
    "/docs/tutorial/boilerplates-and-clis": {
      "locale": "en-US",
      "slug": "boilerplates-and-clis",
      "href": "/docs/tutorial/boilerplates-and-clis",
      "crowdinFileId": "256181",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/boilerplates-and-clis.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"boilerplates-and-clis\"><a href=\"#boilerplates-and-clis\">Boilerplates and CLIs</a></h1>\n<p>Electron development is unopinionated - there is no \"one true way\" to develop,\nbuild, package, or release an Electron application. Additional features for\nElectron, both for build- and run-time, can usually be found on\n<a href=\"https://www.npmjs.com/search?q=electron\">npm</a> in individual packages, allowing developers to build both\nthe app and build pipeline they need.</p>\n<p>That level of modularity and extendability ensures that all developers working\nwith Electron, both big and small in team-size, are never restricted in what\nthey can or cannot do at any time during their development lifecycle. However,\nfor many developers, one of the community-driven boilerplates or command line\ntools might make it dramatically easier to compile, package, and release an\napp.</p>\n<h2 id=\"boilerplate-vs-cli\"><a href=\"#boilerplate-vs-cli\">Boilerplate vs CLI</a></h2>\n<p>A boilerplate is only a starting point - a canvas, so to speak - from which\nyou build your application. They usually come in the form of a repository you\ncan clone and customize to your heart's content.</p>\n<p>A command line tool on the other hand continues to support you throughout the\ndevelopment and release. They are more helpful and supportive but enforce\nguidelines on how your code should be structured and built. <em>Especially for\nbeginners, using a command line tool is likely to be helpful</em>.</p>\n<h2 id=\"electron-forge\"><a href=\"#electron-forge\">electron-forge</a></h2>\n<p>A \"complete tool for building modern Electron applications\". Electron Forge\nunifies the existing (and well maintained) build tools for Electron development\ninto a cohesive package so that anyone can jump right in to Electron\ndevelopment.</p>\n<p>Forge comes with <a href=\"https://electronforge.io/templates\">a ready-to-use template</a> using Webpack as a bundler. It includes an example typescript configuration and provides two configuration files to enable easy customization. It uses the same core modules used by the\ngreater Electron community (like <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>) –\nchanges made by Electron maintainers (like Slack) benefit Forge's users, too.</p>\n<p>You can find more information and documentation on <a href=\"https://electronforge.io/\">electronforge.io</a>.</p>\n<h2 id=\"electron-builder\"><a href=\"#electron-builder\">electron-builder</a></h2>\n<p>A \"complete solution to package and build a ready-for-distribution Electron app\"\nthat focuses on an integrated experience. <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> adds one\nsingle dependency focused on simplicity and manages all further requirements\ninternally.</p>\n<p><code>electron-builder</code> replaces features and modules used by the Electron\nmaintainers (such as the auto-updater) with custom ones. They are generally\ntighter integrated but will have less in common with popular Electron apps\nlike Atom, Visual Studio Code, or Slack.</p>\n<p>You can find more information and documentation in <a href=\"https://github.com/electron-userland/electron-builder\">the repository</a>.</p>\n<h2 id=\"electron-react-boilerplate\"><a href=\"#electron-react-boilerplate\">electron-react-boilerplate</a></h2>\n<p>If you don't want any tools but only a solid boilerplate to build from,\nCT Lin's <a href=\"https://github.com/chentsulin/electron-react-boilerplate\"><code>electron-react-boilerplate</code></a> might be worth\na look. It's quite popular in the community and uses <code>electron-builder</code>\ninternally.</p>\n<h2 id=\"other-tools-and-boilerplates\"><a href=\"#other-tools-and-boilerplates\">Other Tools and Boilerplates</a></h2>\n<p>The <a href=\"https://github.com/sindresorhus/awesome-electron#boilerplates\">\"Awesome Electron\" list</a> contains more tools and boilerplates\nto choose from. If you find the length of the list intimidating, don't\nforget that adding tools as you go along is a valid approach, too.</p>",
      "title": "Boilerplates and CLIs",
      "description": ""
    },
    "/docs/breaking-changes": {
      "locale": "en-US",
      "slug": "breaking-changes",
      "href": "/docs/breaking-changes",
      "crowdinFileId": "256117",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/breaking-changes.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"breaking-changes\"><a href=\"#breaking-changes\">Breaking Changes</a></h1>\n<p>Breaking changes will be documented here, and deprecation warnings added to JS code where possible, at least <a href=\"/docs/tutorial/electron-versioning#semver\">one major version</a> before the change is made.</p>\n<h3 id=\"types-of-breaking-changes\"><a href=\"#types-of-breaking-changes\">Types of Breaking Changes</a></h3>\n<p>This document uses the following convention to categorize breaking changes:</p>\n<ul>\n<li><strong>API Changed:</strong> An API was changed in such a way that code that has not been updated is guaranteed to throw an exception.</li>\n<li><strong>Behavior Changed:</strong> The behavior of Electron has changed, but not in such a way that an exception will necessarily be thrown.</li>\n<li><strong>Default Changed:</strong> Code depending on the old default may break, not necessarily throwing an exception. The old behavior can be restored by explicitly specifying the value.</li>\n<li><strong>Deprecated:</strong> An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.</li>\n<li><strong>Removed:</strong> An API or feature was removed, and is no longer supported by Electron.</li>\n</ul>\n<h2 id=\"planned-breaking-api-changes-140\"><a href=\"#planned-breaking-api-changes-140\">Planned Breaking API Changes (14.0)</a></h2>\n<h3 id=\"removed-remote-module\"><a href=\"#removed-remote-module\">Removed: <code>remote</code> module</a></h3>\n<p>The <code>remote</code> module was deprecated in Electron 12, and will be removed in\nElectron 14. It is replaced by the\n<a href=\"https://github.com/electron/remote\"><code>@electron/remote</code></a> module.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 12:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Replace with:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote'</span>)\n\n<span class=\"hljs-comment\">// In the main process:</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote/main'</span>).initialize()\n</code></pre>\n<h3 id=\"removed-appallowrendererprocessreuse\"><a href=\"#removed-appallowrendererprocessreuse\">Removed: <code>app.allowRendererProcessReuse</code></a></h3>\n<p>The <code>app.allowRendererProcessReuse</code> property will be removed as part of our plan to\nmore closely align with Chromium's process model for security, performance and maintainability.</p>\n<p>For more detailed information see <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"removed-browser-window-affinity\"><a href=\"#removed-browser-window-affinity\">Removed: Browser Window Affinity</a></h3>\n<p>The <code>affinity</code> option when constructing a new <code>BrowserWindow</code> will be removed\nas part of our plan to more closely align with Chromium's process model for security,\nperformance and maintainability.</p>\n<p>For more detailed information see <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"api-changed-windowopen\"><a href=\"#api-changed-windowopen\">API Changed: <code>window.open()</code></a></h3>\n<p>The optional parameter <code>frameName</code> will no longer set the title of the window. This now follows the specification described by the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters\">native documentation</a> under the corresponding parameter <code>windowName</code>.</p>\n<p>If you were using this parameter to set the title of a window, you can instead use <a href=\"/docs/api/browser-window#winsettitletitle\">win.setTitle(title)</a>.</p>\n<h3 id=\"removed-worldsafeexecutejavascript\"><a href=\"#removed-worldsafeexecutejavascript\">Removed: <code>worldSafeExecuteJavaScript</code></a></h3>\n<p>In Electron 14, <code>worldSafeExecuteJavaScript</code> will be removed.  There is no alternative, please\nensure your code works with this property enabled.  It has been enabled by default since Electron\n12.</p>\n<p>You will be affected by this change if you use either <code>webFrame.executeJavaScript</code> or <code>webFrame.executeJavaScriptInIsolatedWorld</code>. You will need to ensure that values returned by either of those methods are supported by the <a href=\"/docs/api/context-bridge#parameter--error--return-type-support\">Context Bridge API</a> as these methods use the same value passing semantics.</p>\n<h3 id=\"default-changed-nativewindowopen-defaults-to-true\"><a href=\"#default-changed-nativewindowopen-defaults-to-true\">Default Changed: <code>nativeWindowOpen</code> defaults to <code>true</code></a></h3>\n<p>Prior to Electron 14, <code>window.open</code> was by default shimmed to use\n<code>BrowserWindowProxy</code>. This meant that <code>window.open('about:blank')</code> did not work\nto open synchronously scriptable child windows, among other incompatibilities.\n<code>nativeWindowOpen</code> is no longer experimental, and is now the default.</p>\n<p>See the documentation for <a href=\"/docs/api/window-open\">window.open in Electron</a>\nfor more details.</p>\n<h3 id=\"removed-browserwindowconstructoroptions-inheriting-from-parent-windows\"><a href=\"#removed-browserwindowconstructoroptions-inheriting-from-parent-windows\">Removed: BrowserWindowConstructorOptions inheriting from parent windows</a></h3>\n<p>Prior to Electron 14, windows opened with <code>window.open</code> would inherit\nBrowserWindow constructor options such as <code>transparent</code> and <code>resizable</code> from\ntheir parent window. Beginning with Electron 14, this behavior is removed, and\nwindows will not inherit any BrowserWindow constructor options from their\nparents.</p>\n<p>Instead, explicitly set options for the new window with <code>setWindowOpenHandler</code>:</p>\n<pre><code class=\"hljs language-js\">webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n  <span class=\"hljs-keyword\">return</span> {\n    <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span>,\n    <span class=\"hljs-attr\">overrideBrowserWindowOptions</span>: {\n      <span class=\"hljs-comment\">// ...</span>\n    }\n  }\n})\n</code></pre>\n<h3 id=\"removed-additionalfeatures\"><a href=\"#removed-additionalfeatures\">Removed: <code>additionalFeatures</code></a></h3>\n<p>The deprecated <code>additionalFeatures</code> property in the <code>new-window</code> and\n<code>did-create-window</code> events of WebContents has been removed. Since <code>new-window</code>\nuses positional arguments, the argument is still present, but will always be\nthe empty array <code>[]</code>. (Though note, the <code>new-window</code> event itself is\ndeprecated, and is replaced by <code>setWindowOpenHandler</code>.) Bare keys in window\nfeatures will now present as keys with the value <code>true</code> in the options object.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 14</span>\n<span class=\"hljs-comment\">// Triggered by window.open('...', '', 'my-key')</span>\nwebContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (<span class=\"hljs-built_in\">window</span>, details) => {\n  <span class=\"hljs-keyword\">if</span> (details.additionalFeatures.includes(<span class=\"hljs-string\">'my-key'</span>)) {\n    <span class=\"hljs-comment\">// ...</span>\n  }\n})\n\n<span class=\"hljs-comment\">// Replace with</span>\nwebContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (<span class=\"hljs-built_in\">window</span>, details) => {\n  <span class=\"hljs-keyword\">if</span> (details.options[<span class=\"hljs-string\">'my-key'</span>]) {\n    <span class=\"hljs-comment\">// ...</span>\n  }\n})\n</code></pre>\n<h2 id=\"planned-breaking-api-changes-130\"><a href=\"#planned-breaking-api-changes-130\">Planned Breaking API Changes (13.0)</a></h2>\n<h3 id=\"api-changed-sessionsetpermissioncheckhandlerhandler\"><a href=\"#api-changed-sessionsetpermissioncheckhandlerhandler\">API Changed: <code>session.setPermissionCheckHandler(handler)</code></a></h3>\n<p>The <code>handler</code> methods first parameter was previously always a <code>webContents</code>, it can now sometimes be <code>null</code>.  You should use the <code>requestingOrigin</code>, <code>embeddingOrigin</code> and <code>securityOrigin</code> properties to respond to the permission check correctly.  As the <code>webContents</code> can be <code>null</code> it can no longer be relied on.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Old code</span>\nsession.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (webContents.getURL().startsWith(<span class=\"hljs-string\">'https://google.com/'</span>) &#x26;&#x26; permission === <span class=\"hljs-string\">'notification'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n\n<span class=\"hljs-comment\">// Replace with</span>\nsession.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(requestingOrigin).hostname === <span class=\"hljs-string\">'google.com'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notification'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n</code></pre>\n<h3 id=\"removed-shellmoveitemtotrash\"><a href=\"#removed-shellmoveitemtotrash\">Removed: <code>shell.moveItemToTrash()</code></a></h3>\n<p>The deprecated synchronous <code>shell.moveItemToTrash()</code> API has been removed. Use\nthe asynchronous <code>shell.trashItem()</code> instead.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 13</span>\nshell.moveItemToTrash(path)\n<span class=\"hljs-comment\">// Replace with</span>\nshell.trashItem(path).then(<span class=\"hljs-comment\">/* ... */</span>)\n</code></pre>\n<h3 id=\"removed-browserwindow-extension-apis\"><a href=\"#removed-browserwindow-extension-apis\">Removed: <code>BrowserWindow</code> extension APIs</a></h3>\n<p>The deprecated extension APIs have been removed:</p>\n<ul>\n<li><code>BrowserWindow.addExtension(path)</code></li>\n<li><code>BrowserWindow.addDevToolsExtension(path)</code></li>\n<li><code>BrowserWindow.removeExtension(name)</code></li>\n<li><code>BrowserWindow.removeDevToolsExtension(name)</code></li>\n<li><code>BrowserWindow.getExtensions()</code></li>\n<li><code>BrowserWindow.getDevToolsExtensions()</code></li>\n</ul>\n<p>Use the session APIs instead:</p>\n<ul>\n<li><code>ses.loadExtension(path)</code></li>\n<li><code>ses.removeExtension(extension_id)</code></li>\n<li><code>ses.getAllExtensions()</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 13</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 13</span>\nBrowserWindow.removeExtension(name)\nBrowserWindow.removeDevToolsExtension(name)\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.removeExtension(extension_id)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 13</span>\nBrowserWindow.getExtensions()\nBrowserWindow.getDevToolsExtensions()\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.getAllExtensions()\n</code></pre>\n<h3 id=\"removed-methods-in-systempreferences\"><a href=\"#removed-methods-in-systempreferences\">Removed: methods in <code>systemPreferences</code></a></h3>\n<p>The following <code>systemPreferences</code> methods have been deprecated:</p>\n<ul>\n<li><code>systemPreferences.isDarkMode()</code></li>\n<li><code>systemPreferences.isInvertedColorScheme()</code></li>\n<li><code>systemPreferences.isHighContrastColorScheme()</code></li>\n</ul>\n<p>Use the following <code>nativeTheme</code> properties instead:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code></li>\n<li><code>nativeTheme.shouldUseInvertedColorScheme</code></li>\n<li><code>nativeTheme.shouldUseHighContrastColors</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 13</span>\nsystemPreferences.isDarkMode()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseDarkColors\n\n<span class=\"hljs-comment\">// Removed in Electron 13</span>\nsystemPreferences.isInvertedColorScheme()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseInvertedColorScheme\n\n<span class=\"hljs-comment\">// Removed in Electron 13</span>\nsystemPreferences.isHighContrastColorScheme()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseHighContrastColors\n</code></pre>\n<h3 id=\"deprecated-webcontents-new-window-event\"><a href=\"#deprecated-webcontents-new-window-event\">Deprecated: WebContents <code>new-window</code> event</a></h3>\n<p>The <code>new-window</code> event of WebContents has been deprecated. It is replaced by <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler()</code></a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 13</span>\nwebContents.on(<span class=\"hljs-string\">'new-window'</span>, (event) => {\n  event.preventDefault()\n})\n\n<span class=\"hljs-comment\">// Replace with</span>\nwebContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n</code></pre>\n<h2 id=\"planned-breaking-api-changes-120\"><a href=\"#planned-breaking-api-changes-120\">Planned Breaking API Changes (12.0)</a></h2>\n<h3 id=\"removed-pepper-flash-support\"><a href=\"#removed-pepper-flash-support\">Removed: Pepper Flash support</a></h3>\n<p>Chromium has removed support for Flash, and so we must follow suit. See\nChromium's <a href=\"https://www.chromium.org/flash-roadmap\">Flash Roadmap</a> for more\ndetails.</p>\n<h3 id=\"default-changed-worldsafeexecutejavascript-defaults-to-true\"><a href=\"#default-changed-worldsafeexecutejavascript-defaults-to-true\">Default Changed: <code>worldSafeExecuteJavaScript</code> defaults to <code>true</code></a></h3>\n<p>In Electron 12, <code>worldSafeExecuteJavaScript</code> will be enabled by default.  To restore\nthe previous behavior, <code>worldSafeExecuteJavaScript: false</code> must be specified in WebPreferences.\nPlease note that setting this option to <code>false</code> is <strong>insecure</strong>.</p>\n<p>This option will be removed in Electron 14 so please migrate your code to support the default\nvalue.</p>\n<h3 id=\"default-changed-contextisolation-defaults-to-true\"><a href=\"#default-changed-contextisolation-defaults-to-true\">Default Changed: <code>contextIsolation</code> defaults to <code>true</code></a></h3>\n<p>In Electron 12, <code>contextIsolation</code> will be enabled by default.  To restore\nthe previous behavior, <code>contextIsolation: false</code> must be specified in WebPreferences.</p>\n<p>We <a href=\"/docs/tutorial/security#3-enable-context-isolation-for-remote-content\">recommend having contextIsolation enabled</a> for the security of your application.</p>\n<p>Another implication is that <code>require()</code> cannot be used in the renderer process unless\n<code>nodeIntegration</code> is <code>true</code> and <code>contextIsolation</code> is <code>false</code>.</p>\n<p>For more details see: <a href=\"https://github.com/electron/electron/issues/23506\">https://github.com/electron/electron/issues/23506</a></p>\n<h3 id=\"removed-crashreportergetcrashesdirectory\"><a href=\"#removed-crashreportergetcrashesdirectory\">Removed: <code>crashReporter.getCrashesDirectory()</code></a></h3>\n<p>The <code>crashReporter.getCrashesDirectory</code> method has been removed. Usage\nshould be replaced by <code>app.getPath('crashDumps')</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 12</span>\ncrashReporter.getCrashesDirectory()\n<span class=\"hljs-comment\">// Replace with</span>\napp.getPath(<span class=\"hljs-string\">'crashDumps'</span>)\n</code></pre>\n<h3 id=\"removed-crashreporter-methods-in-the-renderer-process\"><a href=\"#removed-crashreporter-methods-in-the-renderer-process\">Removed: <code>crashReporter</code> methods in the renderer process</a></h3>\n<p>The following <code>crashReporter</code> methods are no longer available in the renderer\nprocess:</p>\n<ul>\n<li><code>crashReporter.start</code></li>\n<li><code>crashReporter.getLastCrashReport</code></li>\n<li><code>crashReporter.getUploadedReports</code></li>\n<li><code>crashReporter.getUploadToServer</code></li>\n<li><code>crashReporter.setUploadToServer</code></li>\n<li><code>crashReporter.getCrashesDirectory</code></li>\n</ul>\n<p>They should be called only from the main process.</p>\n<p>See <a href=\"https://github.com/electron/electron/pull/23265\">#23265</a> for more details.</p>\n<h3 id=\"default-changed-crashreporterstart-compress-true-\"><a href=\"#default-changed-crashreporterstart-compress-true-\">Default Changed: <code>crashReporter.start({ compress: true })</code></a></h3>\n<p>The default value of the <code>compress</code> option to <code>crashReporter.start</code> has changed\nfrom <code>false</code> to <code>true</code>. This means that crash dumps will be uploaded to the\ncrash ingestion server with the <code>Content-Encoding: gzip</code> header, and the body\nwill be compressed.</p>\n<p>If your crash ingestion server does not support compressed payloads, you can\nturn off compression by specifying <code>{ compress: false }</code> in the crash reporter\noptions.</p>\n<h3 id=\"deprecated-remote-module\"><a href=\"#deprecated-remote-module\">Deprecated: <code>remote</code> module</a></h3>\n<p>The <code>remote</code> module is deprecated in Electron 12, and will be removed in\nElectron 14. It is replaced by the\n<a href=\"https://github.com/electron/remote\"><code>@electron/remote</code></a> module.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 12:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Replace with:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote'</span>)\n\n<span class=\"hljs-comment\">// In the main process:</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote/main'</span>).initialize()\n</code></pre>\n<h3 id=\"deprecated-shellmoveitemtotrash\"><a href=\"#deprecated-shellmoveitemtotrash\">Deprecated: <code>shell.moveItemToTrash()</code></a></h3>\n<p>The synchronous <code>shell.moveItemToTrash()</code> has been replaced by the new,\nasynchronous <code>shell.trashItem()</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 12</span>\nshell.moveItemToTrash(path)\n<span class=\"hljs-comment\">// Replace with</span>\nshell.trashItem(path).then(<span class=\"hljs-comment\">/* ... */</span>)\n</code></pre>\n<h2 id=\"planned-breaking-api-changes-110\"><a href=\"#planned-breaking-api-changes-110\">Planned Breaking API Changes (11.0)</a></h2>\n<h3 id=\"removed-browserviewdestroy-fromid-fromwebcontents-getallviews-and-id-property-of-browserview\"><a href=\"#removed-browserviewdestroy-fromid-fromwebcontents-getallviews-and-id-property-of-browserview\">Removed: <code>BrowserView.{destroy, fromId, fromWebContents, getAllViews}</code> and <code>id</code> property of <code>BrowserView</code></a></h3>\n<p>The experimental APIs <code>BrowserView.{destroy, fromId, fromWebContents, getAllViews}</code>\nhave now been removed. Additionally, the <code>id</code> property of <code>BrowserView</code>\nhas also been removed.</p>\n<p>For more detailed information, see <a href=\"https://github.com/electron/electron/pull/23578\">#23578</a>.</p>\n<h2 id=\"planned-breaking-api-changes-100\"><a href=\"#planned-breaking-api-changes-100\">Planned Breaking API Changes (10.0)</a></h2>\n<h3 id=\"deprecated-companyname-argument-to-crashreporterstart\"><a href=\"#deprecated-companyname-argument-to-crashreporterstart\">Deprecated: <code>companyName</code> argument to <code>crashReporter.start()</code></a></h3>\n<p>The <code>companyName</code> argument to <code>crashReporter.start()</code>, which was previously\nrequired, is now optional, and further, is deprecated. To get the same\nbehavior in a non-deprecated way, you can pass a <code>companyName</code> value in\n<code>globalExtra</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 10</span>\ncrashReporter.start({ <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Umbrella Corporation'</span> })\n<span class=\"hljs-comment\">// Replace with</span>\ncrashReporter.start({ <span class=\"hljs-attr\">globalExtra</span>: { <span class=\"hljs-attr\">_companyName</span>: <span class=\"hljs-string\">'Umbrella Corporation'</span> } })\n</code></pre>\n<h3 id=\"deprecated-crashreportergetcrashesdirectory\"><a href=\"#deprecated-crashreportergetcrashesdirectory\">Deprecated: <code>crashReporter.getCrashesDirectory()</code></a></h3>\n<p>The <code>crashReporter.getCrashesDirectory</code> method has been deprecated. Usage\nshould be replaced by <code>app.getPath('crashDumps')</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 10</span>\ncrashReporter.getCrashesDirectory()\n<span class=\"hljs-comment\">// Replace with</span>\napp.getPath(<span class=\"hljs-string\">'crashDumps'</span>)\n</code></pre>\n<h3 id=\"deprecated-crashreporter-methods-in-the-renderer-process\"><a href=\"#deprecated-crashreporter-methods-in-the-renderer-process\">Deprecated: <code>crashReporter</code> methods in the renderer process</a></h3>\n<p>Calling the following <code>crashReporter</code> methods from the renderer process is\ndeprecated:</p>\n<ul>\n<li><code>crashReporter.start</code></li>\n<li><code>crashReporter.getLastCrashReport</code></li>\n<li><code>crashReporter.getUploadedReports</code></li>\n<li><code>crashReporter.getUploadToServer</code></li>\n<li><code>crashReporter.setUploadToServer</code></li>\n<li><code>crashReporter.getCrashesDirectory</code></li>\n</ul>\n<p>The only non-deprecated methods remaining in the <code>crashReporter</code> module in the\nrenderer are <code>addExtraParameter</code>, <code>removeExtraParameter</code> and <code>getParameters</code>.</p>\n<p>All above methods remain non-deprecated when called from the main process.</p>\n<p>See <a href=\"https://github.com/electron/electron/pull/23265\">#23265</a> for more details.</p>\n<h3 id=\"deprecated-crashreporterstart-compress-false-\"><a href=\"#deprecated-crashreporterstart-compress-false-\">Deprecated: <code>crashReporter.start({ compress: false })</code></a></h3>\n<p>Setting <code>{ compress: false }</code> in <code>crashReporter.start</code> is deprecated. Nearly\nall crash ingestion servers support gzip compression. This option will be\nremoved in a future version of Electron.</p>\n<h3 id=\"default-changed-enableremotemodule-defaults-to-false\"><a href=\"#default-changed-enableremotemodule-defaults-to-false\">Default Changed: <code>enableRemoteModule</code> defaults to <code>false</code></a></h3>\n<p>In Electron 9, using the remote module without explicitly enabling it via the\n<code>enableRemoteModule</code> WebPreferences option began emitting a warning. In\nElectron 10, the remote module is now disabled by default. To use the remote\nmodule, <code>enableRemoteModule: true</code> must be specified in WebPreferences:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> w = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">enableRemoteModule</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<p>We <a href=\"https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31\">recommend moving away from the remote\nmodule</a>.</p>\n<h3 id=\"protocolunregisterprotocol\"><a href=\"#protocolunregisterprotocol\"><code>protocol.unregisterProtocol</code></a></h3>\n<h3 id=\"protocoluninterceptprotocol\"><a href=\"#protocoluninterceptprotocol\"><code>protocol.uninterceptProtocol</code></a></h3>\n<p>The APIs are now synchronous and the optional callback is no longer needed.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Deprecated</span>\nprotocol.unregisterProtocol(scheme, () => { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nprotocol.unregisterProtocol(scheme)\n</code></pre>\n<h3 id=\"protocolregisterfileprotocol\"><a href=\"#protocolregisterfileprotocol\"><code>protocol.registerFileProtocol</code></a></h3>\n<h3 id=\"protocolregisterbufferprotocol\"><a href=\"#protocolregisterbufferprotocol\"><code>protocol.registerBufferProtocol</code></a></h3>\n<h3 id=\"protocolregisterstringprotocol\"><a href=\"#protocolregisterstringprotocol\"><code>protocol.registerStringProtocol</code></a></h3>\n<h3 id=\"protocolregisterhttpprotocol\"><a href=\"#protocolregisterhttpprotocol\"><code>protocol.registerHttpProtocol</code></a></h3>\n<h3 id=\"protocolregisterstreamprotocol\"><a href=\"#protocolregisterstreamprotocol\"><code>protocol.registerStreamProtocol</code></a></h3>\n<h3 id=\"protocolinterceptfileprotocol\"><a href=\"#protocolinterceptfileprotocol\"><code>protocol.interceptFileProtocol</code></a></h3>\n<h3 id=\"protocolinterceptstringprotocol\"><a href=\"#protocolinterceptstringprotocol\"><code>protocol.interceptStringProtocol</code></a></h3>\n<h3 id=\"protocolinterceptbufferprotocol\"><a href=\"#protocolinterceptbufferprotocol\"><code>protocol.interceptBufferProtocol</code></a></h3>\n<h3 id=\"protocolintercepthttpprotocol\"><a href=\"#protocolintercepthttpprotocol\"><code>protocol.interceptHttpProtocol</code></a></h3>\n<h3 id=\"protocolinterceptstreamprotocol\"><a href=\"#protocolinterceptstreamprotocol\"><code>protocol.interceptStreamProtocol</code></a></h3>\n<p>The APIs are now synchronous and the optional callback is no longer needed.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Deprecated</span>\nprotocol.registerFileProtocol(scheme, handler, () => { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nprotocol.registerFileProtocol(scheme, handler)\n</code></pre>\n<p>The registered or intercepted protocol does not have effect on current page\nuntil navigation happens.</p>\n<h3 id=\"protocolisprotocolhandled\"><a href=\"#protocolisprotocolhandled\"><code>protocol.isProtocolHandled</code></a></h3>\n<p>This API is deprecated and users should use <code>protocol.isProtocolRegistered</code>\nand <code>protocol.isProtocolIntercepted</code> instead.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Deprecated</span>\nprotocol.isProtocolHandled(scheme).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> isRegistered = protocol.isProtocolRegistered(scheme)\n<span class=\"hljs-keyword\">const</span> isIntercepted = protocol.isProtocolIntercepted(scheme)\n</code></pre>\n<h2 id=\"planned-breaking-api-changes-90\"><a href=\"#planned-breaking-api-changes-90\">Planned Breaking API Changes (9.0)</a></h2>\n<h3 id=\"default-changed-loading-non-context-aware-native-modules-in-the-renderer-process-is-disabled-by-default\"><a href=\"#default-changed-loading-non-context-aware-native-modules-in-the-renderer-process-is-disabled-by-default\">Default Changed: Loading non-context-aware native modules in the renderer process is disabled by default</a></h3>\n<p>As of Electron 9 we do not allow loading of non-context-aware native modules in\nthe renderer process.  This is to improve security, performance and maintainability\nof Electron as a project.</p>\n<p>If this impacts you, you can temporarily set <code>app.allowRendererProcessReuse</code> to <code>false</code>\nto revert to the old behavior.  This flag will only be an option until Electron 11 so\nyou should plan to update your native modules to be context aware.</p>\n<p>For more detailed information see <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"deprecated-browserwindow-extension-apis\"><a href=\"#deprecated-browserwindow-extension-apis\">Deprecated: <code>BrowserWindow</code> extension APIs</a></h3>\n<p>The following extension APIs have been deprecated:</p>\n<ul>\n<li><code>BrowserWindow.addExtension(path)</code></li>\n<li><code>BrowserWindow.addDevToolsExtension(path)</code></li>\n<li><code>BrowserWindow.removeExtension(name)</code></li>\n<li><code>BrowserWindow.removeDevToolsExtension(name)</code></li>\n<li><code>BrowserWindow.getExtensions()</code></li>\n<li><code>BrowserWindow.getDevToolsExtensions()</code></li>\n</ul>\n<p>Use the session APIs instead:</p>\n<ul>\n<li><code>ses.loadExtension(path)</code></li>\n<li><code>ses.removeExtension(extension_id)</code></li>\n<li><code>ses.getAllExtensions()</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 9</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 9</span>\nBrowserWindow.removeExtension(name)\nBrowserWindow.removeDevToolsExtension(name)\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.removeExtension(extension_id)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 9</span>\nBrowserWindow.getExtensions()\nBrowserWindow.getDevToolsExtensions()\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.getAllExtensions()\n</code></pre>\n<h3 id=\"removed-webviewgetwebcontents\"><a href=\"#removed-webviewgetwebcontents\">Removed: <code>&#x3C;webview>.getWebContents()</code></a></h3>\n<p>This API, which was deprecated in Electron 8.0, is now removed.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 9.0</span>\nwebview.getWebContents()\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> { remote } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nremote.webContents.fromId(webview.getWebContentsId())\n</code></pre>\n<h3 id=\"removed-webframesetlayoutzoomlevellimits\"><a href=\"#removed-webframesetlayoutzoomlevellimits\">Removed: <code>webFrame.setLayoutZoomLevelLimits()</code></a></h3>\n<p>Chromium has removed support for changing the layout zoom level limits, and it\nis beyond Electron's capacity to maintain it. The function was deprecated in\nElectron 8.x, and has been removed in Electron 9.x. The layout zoom level limits\nare now fixed at a minimum of 0.25 and a maximum of 5.0, as defined\n<a href=\"https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11\">here</a>.</p>\n<h3 id=\"behavior-changed-sending-non-js-objects-over-ipc-now-throws-an-exception\"><a href=\"#behavior-changed-sending-non-js-objects-over-ipc-now-throws-an-exception\">Behavior Changed: Sending non-JS objects over IPC now throws an exception</a></h3>\n<p>In Electron 8.0, IPC was changed to use the Structured Clone Algorithm,\nbringing significant performance improvements. To help ease the transition, the\nold IPC serialization algorithm was kept and used for some objects that aren't\nserializable with Structured Clone. In particular, DOM objects (e.g. <code>Element</code>,\n<code>Location</code> and <code>DOMMatrix</code>), Node.js objects backed by C++ classes (e.g.\n<code>process.env</code>, some members of <code>Stream</code>), and Electron objects backed by C++\nclasses (e.g. <code>WebContents</code>, <code>BrowserWindow</code> and <code>WebFrame</code>) are not\nserializable with Structured Clone. Whenever the old algorithm was invoked, a\ndeprecation warning was printed.</p>\n<p>In Electron 9.0, the old serialization algorithm has been removed, and sending\nsuch non-serializable objects will now throw an \"object could not be cloned\"\nerror.</p>\n<h3 id=\"api-changed-shellopenitem-is-now-shellopenpath\"><a href=\"#api-changed-shellopenitem-is-now-shellopenpath\">API Changed: <code>shell.openItem</code> is now <code>shell.openPath</code></a></h3>\n<p>The <code>shell.openItem</code> API has been replaced with an asynchronous <code>shell.openPath</code> API.\nYou can see the original API proposal and reasoning <a href=\"https://github.com/electron/governance/blob/main/wg-api/spec-documents/shell-openitem.md\">here</a>.</p>\n<h2 id=\"planned-breaking-api-changes-80\"><a href=\"#planned-breaking-api-changes-80\">Planned Breaking API Changes (8.0)</a></h2>\n<h3 id=\"behavior-changed-values-sent-over-ipc-are-now-serialized-with-structured-clone-algorithm\"><a href=\"#behavior-changed-values-sent-over-ipc-are-now-serialized-with-structured-clone-algorithm\">Behavior Changed: Values sent over IPC are now serialized with Structured Clone Algorithm</a></h3>\n<p>The algorithm used to serialize objects sent over IPC (through\n<code>ipcRenderer.send</code>, <code>ipcRenderer.sendSync</code>, <code>WebContents.send</code> and related\nmethods) has been switched from a custom algorithm to V8's built-in <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured\nClone Algorithm</a>, the same algorithm used to serialize messages for\n<code>postMessage</code>. This brings about a 2x performance improvement for large\nmessages, but also brings some breaking changes in behavior.</p>\n<ul>\n<li>Sending Functions, Promises, WeakMaps, WeakSets, or objects containing any\nsuch values, over IPC will now throw an exception, instead of silently\nconverting the functions to <code>undefined</code>.</li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Previously:</span>\nipcRenderer.send(<span class=\"hljs-string\">'channel'</span>, { <span class=\"hljs-attr\">value</span>: <span class=\"hljs-number\">3</span>, <span class=\"hljs-attr\">someFunction</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {} })\n<span class=\"hljs-comment\">// => results in { value: 3 } arriving in the main process</span>\n\n<span class=\"hljs-comment\">// From Electron 8:</span>\nipcRenderer.send(<span class=\"hljs-string\">'channel'</span>, { <span class=\"hljs-attr\">value</span>: <span class=\"hljs-number\">3</span>, <span class=\"hljs-attr\">someFunction</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {} })\n<span class=\"hljs-comment\">// => throws Error(\"() => {} could not be cloned.\")</span>\n</code></pre>\n<ul>\n<li><code>NaN</code>, <code>Infinity</code> and <code>-Infinity</code> will now be correctly serialized, instead\nof being converted to <code>null</code>.</li>\n<li>Objects containing cyclic references will now be correctly serialized,\ninstead of being converted to <code>null</code>.</li>\n<li><code>Set</code>, <code>Map</code>, <code>Error</code> and <code>RegExp</code> values will be correctly serialized,\ninstead of being converted to <code>{}</code>.</li>\n<li><code>BigInt</code> values will be correctly serialized, instead of being converted to\n<code>null</code>.</li>\n<li>Sparse arrays will be serialized as such, instead of being converted to dense\narrays with <code>null</code>s.</li>\n<li><code>Date</code> objects will be transferred as <code>Date</code> objects, instead of being\nconverted to their ISO string representation.</li>\n<li>Typed Arrays (such as <code>Uint8Array</code>, <code>Uint16Array</code>, <code>Uint32Array</code> and so on)\nwill be transferred as such, instead of being converted to Node.js <code>Buffer</code>.</li>\n<li>Node.js <code>Buffer</code> objects will be transferred as <code>Uint8Array</code>s. You can\nconvert a <code>Uint8Array</code> back to a Node.js <code>Buffer</code> by wrapping the underlying\n<code>ArrayBuffer</code>:</li>\n</ul>\n<pre><code class=\"hljs language-js\">Buffer.from(value.buffer, value.byteOffset, value.byteLength)\n</code></pre>\n<p>Sending any objects that aren't native JS types, such as DOM objects (e.g.\n<code>Element</code>, <code>Location</code>, <code>DOMMatrix</code>), Node.js objects (e.g. <code>process.env</code>,\n<code>Stream</code>), or Electron objects (e.g. <code>WebContents</code>, <code>BrowserWindow</code>,\n<code>WebFrame</code>) is deprecated. In Electron 8, these objects will be serialized as\nbefore with a DeprecationWarning message, but starting in Electron 9, sending\nthese kinds of objects will throw a 'could not be cloned' error.</p>\n<h3 id=\"deprecated-webviewgetwebcontents\"><a href=\"#deprecated-webviewgetwebcontents\">Deprecated: <code>&#x3C;webview>.getWebContents()</code></a></h3>\n<p>This API is implemented using the <code>remote</code> module, which has both performance\nand security implications. Therefore its usage should be explicit.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebview.getWebContents()\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> { remote } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nremote.webContents.fromId(webview.getWebContentsId())\n</code></pre>\n<p>However, it is recommended to avoid using the <code>remote</code> module altogether.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain, webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> getGuestForWebContents = <span class=\"hljs-function\">(<span class=\"hljs-params\">webContentsId, contents</span>) =></span> {\n  <span class=\"hljs-keyword\">const</span> guest = webContents.fromId(webContentsId)\n  <span class=\"hljs-keyword\">if</span> (!guest) {\n    <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">`Invalid webContentsId: <span class=\"hljs-subst\">${webContentsId}</span>`</span>)\n  }\n  <span class=\"hljs-keyword\">if</span> (guest.hostWebContents !== contents) {\n    <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Access denied to webContents'</span>)\n  }\n  <span class=\"hljs-keyword\">return</span> guest\n}\n\nipcMain.handle(<span class=\"hljs-string\">'openDevTools'</span>, (event, webContentsId) => {\n  <span class=\"hljs-keyword\">const</span> guest = getGuestForWebContents(webContentsId, event.sender)\n  guest.openDevTools()\n})\n\n<span class=\"hljs-comment\">// renderer</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nipcRenderer.invoke(<span class=\"hljs-string\">'openDevTools'</span>, webview.getWebContentsId())\n</code></pre>\n<h3 id=\"deprecated-webframesetlayoutzoomlevellimits\"><a href=\"#deprecated-webframesetlayoutzoomlevellimits\">Deprecated: <code>webFrame.setLayoutZoomLevelLimits()</code></a></h3>\n<p>Chromium has removed support for changing the layout zoom level limits, and it\nis beyond Electron's capacity to maintain it. The function will emit a warning\nin Electron 8.x, and cease to exist in Electron 9.x. The layout zoom level\nlimits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined\n<a href=\"https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11\">here</a>.</p>\n<h3 id=\"deprecated-events-in-systempreferences\"><a href=\"#deprecated-events-in-systempreferences\">Deprecated events in <code>systemPreferences</code></a></h3>\n<p>The following <code>systemPreferences</code> events have been deprecated:</p>\n<ul>\n<li><code>inverted-color-scheme-changed</code></li>\n<li><code>high-contrast-color-scheme-changed</code></li>\n</ul>\n<p>Use the new <code>updated</code> event on the <code>nativeTheme</code> module instead.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.on(<span class=\"hljs-string\">'inverted-color-scheme-changed'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\nsystemPreferences.on(<span class=\"hljs-string\">'high-contrast-color-scheme-changed'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\n\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.on(<span class=\"hljs-string\">'updated'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\n</code></pre>\n<h3 id=\"deprecated-methods-in-systempreferences\"><a href=\"#deprecated-methods-in-systempreferences\">Deprecated: methods in <code>systemPreferences</code></a></h3>\n<p>The following <code>systemPreferences</code> methods have been deprecated:</p>\n<ul>\n<li><code>systemPreferences.isDarkMode()</code></li>\n<li><code>systemPreferences.isInvertedColorScheme()</code></li>\n<li><code>systemPreferences.isHighContrastColorScheme()</code></li>\n</ul>\n<p>Use the following <code>nativeTheme</code> properties instead:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code></li>\n<li><code>nativeTheme.shouldUseInvertedColorScheme</code></li>\n<li><code>nativeTheme.shouldUseHighContrastColors</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.isDarkMode()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseDarkColors\n\n<span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.isInvertedColorScheme()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseInvertedColorScheme\n\n<span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.isHighContrastColorScheme()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseHighContrastColors\n</code></pre>\n<h2 id=\"planned-breaking-api-changes-70\"><a href=\"#planned-breaking-api-changes-70\">Planned Breaking API Changes (7.0)</a></h2>\n<h3 id=\"deprecated-atomio-node-headers-url\"><a href=\"#deprecated-atomio-node-headers-url\">Deprecated: Atom.io Node Headers URL</a></h3>\n<p>This is the URL specified as <code>disturl</code> in a <code>.npmrc</code> file or as the <code>--dist-url</code>\ncommand line flag when building native Node modules.  Both will be supported for\nthe foreseeable future but it is recommended that you switch.</p>\n<p>Deprecated: <a href=\"https://atom.io/download/electron\">https://atom.io/download/electron</a></p>\n<p>Replace with: <a href=\"https://electronjs.org/headers\">https://electronjs.org/headers</a></p>\n<h3 id=\"api-changed-sessionclearauthcache-no-longer-accepts-options\"><a href=\"#api-changed-sessionclearauthcache-no-longer-accepts-options\">API Changed: <code>session.clearAuthCache()</code> no longer accepts options</a></h3>\n<p>The <code>session.clearAuthCache</code> API no longer accepts options for what to clear, and instead unconditionally clears the whole cache.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nsession.clearAuthCache({ <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'password'</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nsession.clearAuthCache()\n</code></pre>\n<h3 id=\"api-changed-powermonitorquerysystemidlestate-is-now-powermonitorgetsystemidlestate\"><a href=\"#api-changed-powermonitorquerysystemidlestate-is-now-powermonitorgetsystemidlestate\">API Changed: <code>powerMonitor.querySystemIdleState</code> is now <code>powerMonitor.getSystemIdleState</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\npowerMonitor.querySystemIdleState(threshold, callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleState = powerMonitor.getSystemIdleState(threshold)\n</code></pre>\n<h3 id=\"api-changed-powermonitorquerysystemidletime-is-now-powermonitorgetsystemidletime\"><a href=\"#api-changed-powermonitorquerysystemidletime-is-now-powermonitorgetsystemidletime\">API Changed: <code>powerMonitor.querySystemIdleTime</code> is now <code>powerMonitor.getSystemIdleTime</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\npowerMonitor.querySystemIdleTime(callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleTime = powerMonitor.getSystemIdleTime()\n</code></pre>\n<h3 id=\"api-changed-webframesetisolatedworldinfo-replaces-separate-methods\"><a href=\"#api-changed-webframesetisolatedworldinfo-replaces-separate-methods\">API Changed: <code>webFrame.setIsolatedWorldInfo</code> replaces separate methods</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\nwebFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)\nwebFrame.setIsolatedWorldHumanReadableName(worldId, name)\nwebFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)\n<span class=\"hljs-comment\">// Replace with</span>\nwebFrame.setIsolatedWorldInfo(\n  worldId,\n  {\n    <span class=\"hljs-attr\">securityOrigin</span>: <span class=\"hljs-string\">'some_origin'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'human_readable_name'</span>,\n    <span class=\"hljs-attr\">csp</span>: <span class=\"hljs-string\">'content_security_policy'</span>\n  })\n</code></pre>\n<h3 id=\"removed-marked-property-on-getblinkmemoryinfo\"><a href=\"#removed-marked-property-on-getblinkmemoryinfo\">Removed: <code>marked</code> property on <code>getBlinkMemoryInfo</code></a></h3>\n<p>This property was removed in Chromium 77, and as such is no longer available.</p>\n<h3 id=\"behavior-changed-webkitdirectory-attribute-for-input-typefile-now-lists-directory-contents\"><a href=\"#behavior-changed-webkitdirectory-attribute-for-input-typefile-now-lists-directory-contents\">Behavior Changed: <code>webkitdirectory</code> attribute for <code>&#x3C;input type=\"file\"/></code> now lists directory contents</a></h3>\n<p>The <code>webkitdirectory</code> property on HTML file inputs allows them to select folders.\nPrevious versions of Electron had an incorrect implementation where the <code>event.target.files</code>\nof the input returned a <code>FileList</code> that returned one <code>File</code> corresponding to the selected folder.</p>\n<p>As of Electron 7, that <code>FileList</code> is now list of all files contained within\nthe folder, similarly to Chrome, Firefox, and Edge\n(<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory\">link to MDN docs</a>).</p>\n<p>As an illustration, take a folder with this structure:</p>\n<pre><code class=\"hljs language-console\">folder\n├── file1\n├── file2\n└── file3\n</code></pre>\n<p>In Electron &#x3C;=6, this would return a <code>FileList</code> with a <code>File</code> object for:</p>\n<pre><code class=\"hljs language-console\">path/to/folder\n</code></pre>\n<p>In Electron 7, this now returns a <code>FileList</code> with a <code>File</code> object for:</p>\n<pre><code class=\"hljs language-console\">/path/to/folder/file3\n/path/to/folder/file2\n/path/to/folder/file1\n</code></pre>\n<p>Note that <code>webkitdirectory</code> no longer exposes the path to the selected folder.\nIf you require the path to the selected folder rather than the folder contents,\nsee the <code>dialog.showOpenDialog</code> API (<a href=\"/docs/api/dialog#dialogshowopendialogbrowserwindow-options\">link</a>).</p>\n<h3 id=\"api-changed-callback-based-versions-of-promisified-apis\"><a href=\"#api-changed-callback-based-versions-of-promisified-apis\">API Changed: Callback-based versions of promisified APIs</a></h3>\n<p>Electron 5 and Electron 6 introduced Promise-based versions of existing\nasynchronous APIs and deprecated their older, callback-based counterparts.\nIn Electron 7, all deprecated callback-based APIs are now removed.</p>\n<p>These functions now only return Promises:</p>\n<ul>\n<li><code>app.getFileIcon()</code> <a href=\"https://github.com/electron/electron/pull/15742\">#15742</a></li>\n<li><code>app.dock.show()</code> <a href=\"https://github.com/electron/electron/pull/16904\">#16904</a></li>\n<li><code>contentTracing.getCategories()</code> <a href=\"https://github.com/electron/electron/pull/16583\">#16583</a></li>\n<li><code>contentTracing.getTraceBufferUsage()</code> <a href=\"https://github.com/electron/electron/pull/16600\">#16600</a></li>\n<li><code>contentTracing.startRecording()</code> <a href=\"https://github.com/electron/electron/pull/16584\">#16584</a></li>\n<li><code>contentTracing.stopRecording()</code> <a href=\"https://github.com/electron/electron/pull/16584\">#16584</a></li>\n<li><code>contents.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>cookies.flushStore()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.get()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.remove()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.set()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>debugger.sendCommand()</code> <a href=\"https://github.com/electron/electron/pull/16861\">#16861</a></li>\n<li><code>dialog.showCertificateTrustDialog()</code> <a href=\"https://github.com/electron/electron/pull/17181\">#17181</a></li>\n<li><code>inAppPurchase.getProducts()</code> <a href=\"https://github.com/electron/electron/pull/17355\">#17355</a></li>\n<li><code>inAppPurchase.purchaseProduct()</code><a href=\"https://github.com/electron/electron/pull/17355\">#17355</a></li>\n<li><code>netLog.stopLogging()</code> <a href=\"https://github.com/electron/electron/pull/16862\">#16862</a></li>\n<li><code>session.clearAuthCache()</code> <a href=\"https://github.com/electron/electron/pull/17259\">#17259</a></li>\n<li><code>session.clearCache()</code>  <a href=\"https://github.com/electron/electron/pull/17185\">#17185</a></li>\n<li><code>session.clearHostResolverCache()</code> <a href=\"https://github.com/electron/electron/pull/17229\">#17229</a></li>\n<li><code>session.clearStorageData()</code> <a href=\"https://github.com/electron/electron/pull/17249\">#17249</a></li>\n<li><code>session.getBlobData()</code> <a href=\"https://github.com/electron/electron/pull/17303\">#17303</a></li>\n<li><code>session.getCacheSize()</code>  <a href=\"https://github.com/electron/electron/pull/17185\">#17185</a></li>\n<li><code>session.resolveProxy()</code> <a href=\"https://github.com/electron/electron/pull/17222\">#17222</a></li>\n<li><code>session.setProxy()</code>  <a href=\"https://github.com/electron/electron/pull/17222\">#17222</a></li>\n<li><code>shell.openExternal()</code> <a href=\"https://github.com/electron/electron/pull/16176\">#16176</a></li>\n<li><code>webContents.loadFile()</code> <a href=\"https://github.com/electron/electron/pull/15855\">#15855</a></li>\n<li><code>webContents.loadURL()</code> <a href=\"https://github.com/electron/electron/pull/15855\">#15855</a></li>\n<li><code>webContents.hasServiceWorker()</code> <a href=\"https://github.com/electron/electron/pull/16535\">#16535</a></li>\n<li><code>webContents.printToPDF()</code> <a href=\"https://github.com/electron/electron/pull/16795\">#16795</a></li>\n<li><code>webContents.savePage()</code> <a href=\"https://github.com/electron/electron/pull/16742\">#16742</a></li>\n<li><code>webFrame.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>webFrame.executeJavaScriptInIsolatedWorld()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>webviewTag.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>win.capturePage()</code> <a href=\"https://github.com/electron/electron/pull/15743\">#15743</a></li>\n</ul>\n<p>These functions now have two forms, synchronous and Promise-based asynchronous:</p>\n<ul>\n<li><code>dialog.showMessageBox()</code>/<code>dialog.showMessageBoxSync()</code> <a href=\"https://github.com/electron/electron/pull/17298\">#17298</a></li>\n<li><code>dialog.showOpenDialog()</code>/<code>dialog.showOpenDialogSync()</code> <a href=\"https://github.com/electron/electron/pull/16973\">#16973</a></li>\n<li><code>dialog.showSaveDialog()</code>/<code>dialog.showSaveDialogSync()</code> <a href=\"https://github.com/electron/electron/pull/17054\">#17054</a></li>\n</ul>\n<h2 id=\"planned-breaking-api-changes-60\"><a href=\"#planned-breaking-api-changes-60\">Planned Breaking API Changes (6.0)</a></h2>\n<h3 id=\"api-changed-winsetmenunull-is-now-winremovemenu\"><a href=\"#api-changed-winsetmenunull-is-now-winremovemenu\">API Changed: <code>win.setMenu(null)</code> is now <code>win.removeMenu()</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwin.setMenu(<span class=\"hljs-literal\">null</span>)\n<span class=\"hljs-comment\">// Replace with</span>\nwin.removeMenu()\n</code></pre>\n<h3 id=\"api-changed-electronscreen-in-the-renderer-process-should-be-accessed-via-remote\"><a href=\"#api-changed-electronscreen-in-the-renderer-process-should-be-accessed-via-remote\">API Changed: <code>electron.screen</code> in the renderer process should be accessed via <code>remote</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).screen\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.screen\n</code></pre>\n<h3 id=\"api-changed-requireing-node-builtins-in-sandboxed-renderers-no-longer-implicitly-loads-the-remote-version\"><a href=\"#api-changed-requireing-node-builtins-in-sandboxed-renderers-no-longer-implicitly-loads-the-remote-version\">API Changed: <code>require()</code>ing node builtins in sandboxed renderers no longer implicitly loads the <code>remote</code> version</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'child_process'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'child_process'</span>)\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'os'</span>)\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'path'</span>)\n</code></pre>\n<h3 id=\"deprecated-powermonitorquerysystemidlestate-replaced-with-powermonitorgetsystemidlestate\"><a href=\"#deprecated-powermonitorquerysystemidlestate-replaced-with-powermonitorgetsystemidlestate\">Deprecated: <code>powerMonitor.querySystemIdleState</code> replaced with <code>powerMonitor.getSystemIdleState</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\npowerMonitor.querySystemIdleState(threshold, callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleState = powerMonitor.getSystemIdleState(threshold)\n</code></pre>\n<h3 id=\"deprecated-powermonitorquerysystemidletime-replaced-with-powermonitorgetsystemidletime\"><a href=\"#deprecated-powermonitorquerysystemidletime-replaced-with-powermonitorgetsystemidletime\">Deprecated: <code>powerMonitor.querySystemIdleTime</code> replaced with <code>powerMonitor.getSystemIdleTime</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\npowerMonitor.querySystemIdleTime(callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleTime = powerMonitor.getSystemIdleTime()\n</code></pre>\n<h3 id=\"deprecated-appenablemixedsandbox-is-no-longer-needed\"><a href=\"#deprecated-appenablemixedsandbox-is-no-longer-needed\">Deprecated: <code>app.enableMixedSandbox()</code> is no longer needed</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\napp.enableMixedSandbox()\n</code></pre>\n<p>Mixed-sandbox mode is now enabled by default.</p>\n<h3 id=\"deprecated-traysethighlightmode\"><a href=\"#deprecated-traysethighlightmode\">Deprecated: <code>Tray.setHighlightMode</code></a></h3>\n<p>Under macOS Catalina our former Tray implementation breaks.\nApple's native substitute doesn't support changing the highlighting behavior.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\ntray.setHighlightMode(mode)\n<span class=\"hljs-comment\">// API will be removed in v7.0 without replacement.</span>\n</code></pre>\n<h2 id=\"planned-breaking-api-changes-50\"><a href=\"#planned-breaking-api-changes-50\">Planned Breaking API Changes (5.0)</a></h2>\n<h3 id=\"default-changed-nodeintegration-and-webviewtag-default-to-false-contextisolation-defaults-to-true\"><a href=\"#default-changed-nodeintegration-and-webviewtag-default-to-false-contextisolation-defaults-to-true\">Default Changed: <code>nodeIntegration</code> and <code>webviewTag</code> default to false, <code>contextIsolation</code> defaults to true</a></h3>\n<p>The following <code>webPreferences</code> option default values are deprecated in favor of the new defaults listed below.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Property</th><th>Deprecated Default</th><th>New Default</th></tr></thead><tbody><tr><td><code>contextIsolation</code></td><td><code>false</code></td><td><code>true</code></td></tr><tr><td><code>nodeIntegration</code></td><td><code>true</code></td><td><code>false</code></td></tr><tr><td><code>webviewTag</code></td><td><code>nodeIntegration</code> if set else <code>true</code></td><td><code>false</code></td></tr></tbody></table>\n<p>E.g. Re-enabling the webviewTag</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> w = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">webviewTag</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h3 id=\"behavior-changed-nodeintegration-in-child-windows-opened-via-nativewindowopen\"><a href=\"#behavior-changed-nodeintegration-in-child-windows-opened-via-nativewindowopen\">Behavior Changed: <code>nodeIntegration</code> in child windows opened via <code>nativeWindowOpen</code></a></h3>\n<p>Child windows opened with the <code>nativeWindowOpen</code> option will always have Node.js integration disabled, unless <code>nodeIntegrationInSubFrames</code> is <code>true</code>.</p>\n<h3 id=\"api-changed-registering-privileged-schemes-must-now-be-done-before-app-ready\"><a href=\"#api-changed-registering-privileged-schemes-must-now-be-done-before-app-ready\">API Changed: Registering privileged schemes must now be done before app ready</a></h3>\n<p>Renderer process APIs <code>webFrame.registerURLSchemeAsPrivileged</code> and <code>webFrame.registerURLSchemeAsBypassingCSP</code> as well as browser process API <code>protocol.registerStandardSchemes</code> have been removed.\nA new API, <code>protocol.registerSchemesAsPrivileged</code> has been added and should be used for registering custom schemes with the required privileges. Custom schemes are required to be registered before app ready.</p>\n<h3 id=\"deprecated-webframesetisolatedworld-replaced-with-webframesetisolatedworldinfo\"><a href=\"#deprecated-webframesetisolatedworld-replaced-with-webframesetisolatedworldinfo\">Deprecated: <code>webFrame.setIsolatedWorld*</code> replaced with <code>webFrame.setIsolatedWorldInfo</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)\nwebFrame.setIsolatedWorldHumanReadableName(worldId, name)\nwebFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)\n<span class=\"hljs-comment\">// Replace with</span>\nwebFrame.setIsolatedWorldInfo(\n  worldId,\n  {\n    <span class=\"hljs-attr\">securityOrigin</span>: <span class=\"hljs-string\">'some_origin'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'human_readable_name'</span>,\n    <span class=\"hljs-attr\">csp</span>: <span class=\"hljs-string\">'content_security_policy'</span>\n  })\n</code></pre>\n<h3 id=\"api-changed-webframesetspellcheckprovider-now-takes-an-asynchronous-callback\"><a href=\"#api-changed-webframesetspellcheckprovider-now-takes-an-asynchronous-callback\">API Changed: <code>webFrame.setSpellCheckProvider</code> now takes an asynchronous callback</a></h3>\n<p>The <code>spellCheck</code> callback is now asynchronous, and <code>autoCorrectWord</code> parameter has been removed.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, <span class=\"hljs-literal\">true</span>, {\n  <span class=\"hljs-attr\">spellCheck</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">text</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> !spellchecker.isMisspelled(text)\n  }\n})\n<span class=\"hljs-comment\">// Replace with</span>\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, {\n  <span class=\"hljs-attr\">spellCheck</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">words, callback</span>) =></span> {\n    callback(words.filter(<span class=\"hljs-function\"><span class=\"hljs-params\">text</span> =></span> spellchecker.isMisspelled(text)))\n  }\n})\n</code></pre>\n<h3 id=\"api-changed-webcontentsgetzoomlevel-and-webcontentsgetzoomfactor-are-now-synchronous\"><a href=\"#api-changed-webcontentsgetzoomlevel-and-webcontentsgetzoomfactor-are-now-synchronous\">API Changed: <code>webContents.getZoomLevel</code> and <code>webContents.getZoomFactor</code> are now synchronous</a></h3>\n<p><code>webContents.getZoomLevel</code> and <code>webContents.getZoomFactor</code> no longer take callback parameters,\ninstead directly returning their number values.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebContents.getZoomLevel(<span class=\"hljs-function\">(<span class=\"hljs-params\">level</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(level)\n})\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> level = webContents.getZoomLevel()\n<span class=\"hljs-built_in\">console</span>.log(level)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebContents.getZoomFactor(<span class=\"hljs-function\">(<span class=\"hljs-params\">factor</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(factor)\n})\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> factor = webContents.getZoomFactor()\n<span class=\"hljs-built_in\">console</span>.log(factor)\n</code></pre>\n<h2 id=\"planned-breaking-api-changes-40\"><a href=\"#planned-breaking-api-changes-40\">Planned Breaking API Changes (4.0)</a></h2>\n<p>The following list includes the breaking API changes made in Electron 4.0.</p>\n<h3 id=\"appmakesingleinstance\"><a href=\"#appmakesingleinstance\"><code>app.makeSingleInstance</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\napp.makeSingleInstance(<span class=\"hljs-function\">(<span class=\"hljs-params\">argv, cwd</span>) =></span> {\n  <span class=\"hljs-comment\">/* ... */</span>\n})\n<span class=\"hljs-comment\">// Replace with</span>\napp.requestSingleInstanceLock()\napp.on(<span class=\"hljs-string\">'second-instance'</span>, (event, argv, cwd) => {\n  <span class=\"hljs-comment\">/* ... */</span>\n})\n</code></pre>\n<h3 id=\"appreleasesingleinstance\"><a href=\"#appreleasesingleinstance\"><code>app.releaseSingleInstance</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\napp.releaseSingleInstance()\n<span class=\"hljs-comment\">// Replace with</span>\napp.releaseSingleInstanceLock()\n</code></pre>\n<h3 id=\"appgetgpuinfo\"><a href=\"#appgetgpuinfo\"><code>app.getGPUInfo</code></a></h3>\n<pre><code class=\"hljs language-js\">app.getGPUInfo(<span class=\"hljs-string\">'complete'</span>)\n<span class=\"hljs-comment\">// Now behaves the same with `basic` on macOS</span>\napp.getGPUInfo(<span class=\"hljs-string\">'basic'</span>)\n</code></pre>\n<h3 id=\"win_delay_load_hook\"><a href=\"#win_delay_load_hook\"><code>win_delay_load_hook</code></a></h3>\n<p>When building native modules for windows, the <code>win_delay_load_hook</code> variable in\nthe module's <code>binding.gyp</code> must be true (which is the default). If this hook is\nnot present, then the native module will fail to load on Windows, with an error\nmessage like <code>Cannot find module</code>. See the <a href=\"/docs/tutorial/using-native-node-modules\">native module\nguide</a> for more.</p>\n<h2 id=\"breaking-api-changes-30\"><a href=\"#breaking-api-changes-30\">Breaking API Changes (3.0)</a></h2>\n<p>The following list includes the breaking API changes in Electron 3.0.</p>\n<h3 id=\"app\"><a href=\"#app\"><code>app</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\napp.getAppMemoryInfo()\n<span class=\"hljs-comment\">// Replace with</span>\napp.getAppMetrics()\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-keyword\">const</span> metrics = app.getAppMetrics()\n<span class=\"hljs-keyword\">const</span> { memory } = metrics[<span class=\"hljs-number\">0</span>] <span class=\"hljs-comment\">// Deprecated property</span>\n</code></pre>\n<h3 id=\"browserwindow\"><a href=\"#browserwindow\"><code>BrowserWindow</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-keyword\">const</span> optionsA = { <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">blinkFeatures</span>: <span class=\"hljs-string\">''</span> } }\n<span class=\"hljs-keyword\">const</span> windowA = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsA)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> optionsB = { <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">enableBlinkFeatures</span>: <span class=\"hljs-string\">''</span> } }\n<span class=\"hljs-keyword\">const</span> windowB = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsB)\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">window</span>.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'media-play_pause'</span>) {\n    <span class=\"hljs-comment\">// do something</span>\n  }\n})\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">window</span>.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'media-play-pause'</span>) {\n    <span class=\"hljs-comment\">// do something</span>\n  }\n})\n</code></pre>\n<h3 id=\"clipboard\"><a href=\"#clipboard\"><code>clipboard</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nclipboard.readRtf()\n<span class=\"hljs-comment\">// Replace with</span>\nclipboard.readRTF()\n\n<span class=\"hljs-comment\">// Deprecated</span>\nclipboard.writeRtf()\n<span class=\"hljs-comment\">// Replace with</span>\nclipboard.writeRTF()\n\n<span class=\"hljs-comment\">// Deprecated</span>\nclipboard.readHtml()\n<span class=\"hljs-comment\">// Replace with</span>\nclipboard.readHTML()\n\n<span class=\"hljs-comment\">// Deprecated</span>\nclipboard.writeHtml()\n<span class=\"hljs-comment\">// Replace with</span>\nclipboard.writeHTML()\n</code></pre>\n<h3 id=\"crashreporter\"><a href=\"#crashreporter\"><code>crashReporter</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\ncrashReporter.start({\n  <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Crashly'</span>,\n  <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://crash.server.com'</span>,\n  <span class=\"hljs-attr\">autoSubmit</span>: <span class=\"hljs-literal\">true</span>\n})\n<span class=\"hljs-comment\">// Replace with</span>\ncrashReporter.start({\n  <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Crashly'</span>,\n  <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://crash.server.com'</span>,\n  <span class=\"hljs-attr\">uploadToServer</span>: <span class=\"hljs-literal\">true</span>\n})\n</code></pre>\n<h3 id=\"nativeimage\"><a href=\"#nativeimage\"><code>nativeImage</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nnativeImage.createFromBuffer(buffer, <span class=\"hljs-number\">1.0</span>)\n<span class=\"hljs-comment\">// Replace with</span>\nnativeImage.createFromBuffer(buffer, {\n  <span class=\"hljs-attr\">scaleFactor</span>: <span class=\"hljs-number\">1.0</span>\n})\n</code></pre>\n<h3 id=\"process\"><a href=\"#process\"><code>process</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-keyword\">const</span> info = process.getProcessMemoryInfo()\n</code></pre>\n<h3 id=\"screen\"><a href=\"#screen\"><code>screen</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nscreen.getMenuBarHeight()\n<span class=\"hljs-comment\">// Replace with</span>\nscreen.getPrimaryDisplay().workArea\n</code></pre>\n<h3 id=\"session\"><a href=\"#session\"><code>session</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nses.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">hostname, certificate, callback</span>) =></span> {\n  callback(<span class=\"hljs-literal\">true</span>)\n})\n<span class=\"hljs-comment\">// Replace with</span>\nses.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">request, callback</span>) =></span> {\n  callback(<span class=\"hljs-number\">0</span>)\n})\n</code></pre>\n<h3 id=\"tray\"><a href=\"#tray\"><code>Tray</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\ntray.setHighlightMode(<span class=\"hljs-literal\">true</span>)\n<span class=\"hljs-comment\">// Replace with</span>\ntray.setHighlightMode(<span class=\"hljs-string\">'on'</span>)\n\n<span class=\"hljs-comment\">// Deprecated</span>\ntray.setHighlightMode(<span class=\"hljs-literal\">false</span>)\n<span class=\"hljs-comment\">// Replace with</span>\ntray.setHighlightMode(<span class=\"hljs-string\">'off'</span>)\n</code></pre>\n<h3 id=\"webcontents\"><a href=\"#webcontents\"><code>webContents</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebContents.openDevTools({ <span class=\"hljs-attr\">detach</span>: <span class=\"hljs-literal\">true</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nwebContents.openDevTools({ <span class=\"hljs-attr\">mode</span>: <span class=\"hljs-string\">'detach'</span> })\n\n<span class=\"hljs-comment\">// Removed</span>\nwebContents.setSize(options)\n<span class=\"hljs-comment\">// There is no replacement for this API</span>\n</code></pre>\n<h3 id=\"webframe\"><a href=\"#webframe\"><code>webFrame</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.registerURLSchemeAsSecure(<span class=\"hljs-string\">'app'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\nprotocol.registerStandardSchemes([<span class=\"hljs-string\">'app'</span>], { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n\n<span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.registerURLSchemeAsPrivileged(<span class=\"hljs-string\">'app'</span>, { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nprotocol.registerStandardSchemes([<span class=\"hljs-string\">'app'</span>], { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n</code></pre>\n<h3 id=\"webview\"><a href=\"#webview\"><code>&#x3C;webview></code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed</span>\nwebview.setAttribute(<span class=\"hljs-string\">'disableguestresize'</span>, <span class=\"hljs-string\">''</span>)\n<span class=\"hljs-comment\">// There is no replacement for this API</span>\n\n<span class=\"hljs-comment\">// Removed</span>\nwebview.setAttribute(<span class=\"hljs-string\">'guestinstance'</span>, instanceId)\n<span class=\"hljs-comment\">// There is no replacement for this API</span>\n\n<span class=\"hljs-comment\">// Keyboard listeners no longer work on webview tag</span>\nwebview.onkeydown = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* handler */</span> }\nwebview.onkeyup = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* handler */</span> }\n</code></pre>\n<h3 id=\"node-headers-url\"><a href=\"#node-headers-url\">Node Headers URL</a></h3>\n<p>This is the URL specified as <code>disturl</code> in a <code>.npmrc</code> file or as the <code>--dist-url</code>\ncommand line flag when building native Node modules.</p>\n<p>Deprecated: <a href=\"https://atom.io/download/atom-shell\">https://atom.io/download/atom-shell</a></p>\n<p>Replace with: <a href=\"https://atom.io/download/electron\">https://atom.io/download/electron</a></p>\n<h2 id=\"breaking-api-changes-20\"><a href=\"#breaking-api-changes-20\">Breaking API Changes (2.0)</a></h2>\n<p>The following list includes the breaking API changes made in Electron 2.0.</p>\n<h3 id=\"browserwindow-1\"><a href=\"#browserwindow-1\"><code>BrowserWindow</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-keyword\">const</span> optionsA = { <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden-inset'</span> }\n<span class=\"hljs-keyword\">const</span> windowA = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsA)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> optionsB = { <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span> }\n<span class=\"hljs-keyword\">const</span> windowB = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsB)\n</code></pre>\n<h3 id=\"menu\"><a href=\"#menu\"><code>menu</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed</span>\nmenu.popup(browserWindow, <span class=\"hljs-number\">100</span>, <span class=\"hljs-number\">200</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Replaced with</span>\nmenu.popup(browserWindow, { <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">100</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">200</span>, <span class=\"hljs-attr\">positioningItem</span>: <span class=\"hljs-number\">2</span> })\n</code></pre>\n<h3 id=\"nativeimage-1\"><a href=\"#nativeimage-1\"><code>nativeImage</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed</span>\nnativeImage.toPng()\n<span class=\"hljs-comment\">// Replaced with</span>\nnativeImage.toPNG()\n\n<span class=\"hljs-comment\">// Removed</span>\nnativeImage.toJpeg()\n<span class=\"hljs-comment\">// Replaced with</span>\nnativeImage.toJPEG()\n</code></pre>\n<h3 id=\"process-1\"><a href=\"#process-1\"><code>process</code></a></h3>\n<ul>\n<li><code>process.versions.electron</code> and <code>process.version.chrome</code> will be made\nread-only properties for consistency with the other <code>process.versions</code>\nproperties set by Node.</li>\n</ul>\n<h3 id=\"webcontents-1\"><a href=\"#webcontents-1\"><code>webContents</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed</span>\nwebContents.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Replaced with</span>\nwebContents.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"webframe-1\"><a href=\"#webframe-1\"><code>webFrame</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed</span>\nwebFrame.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Replaced with</span>\nwebFrame.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"webview-1\"><a href=\"#webview-1\"><code>&#x3C;webview></code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed</span>\nwebview.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Replaced with</span>\nwebview.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"duplicate-arm-assets\"><a href=\"#duplicate-arm-assets\">Duplicate ARM Assets</a></h3>\n<p>Each Electron release includes two identical ARM builds with slightly different\nfilenames, like <code>electron-v1.7.3-linux-arm.zip</code> and\n<code>electron-v1.7.3-linux-armv7l.zip</code>. The asset with the <code>v7l</code> prefix was added\nto clarify to users which ARM version it supports, and to disambiguate it from\nfuture armv6l and arm64 assets that may be produced.</p>\n<p>The file <em>without the prefix</em> is still being published to avoid breaking any\nsetups that may be consuming it. Starting at 2.0, the unprefixed file will\nno longer be published.</p>\n<p>For details, see\n<a href=\"https://github.com/electron/electron/pull/6986\">6986</a>\nand\n<a href=\"https://github.com/electron/electron/pull/7189\">7189</a>.</p>",
      "title": "Breaking Changes",
      "description": ""
    },
    "/docs/api/browser-view": {
      "locale": "en-US",
      "slug": "browser-view",
      "href": "/docs/api/browser-view",
      "crowdinFileId": "256283",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-view.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"browserview\"><a href=\"#browserview\">BrowserView</a></h1>\n<p>A <code>BrowserView</code> can be used to embed additional web content into a\n<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. It is like a child window, except that it is positioned\nrelative to its owning window. It is meant to be an alternative to the\n<code>webview</code> tag.</p>\n<h2 id=\"class-browserview\"><a href=\"#class-browserview\">Class: BrowserView</a></h2>\n<blockquote>\n<p>Create and control views.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h3 id=\"example\"><a href=\"#example\">Example</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In the main process.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserView, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-keyword\">const</span> view = <span class=\"hljs-keyword\">new</span> BrowserView()\nwin.setBrowserView(view)\nview.setBounds({ <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">0</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">0</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">300</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">300</span> })\nview.webContents.loadURL(<span class=\"hljs-string\">'https://electronjs.org'</span>)\n</code></pre>\n<h3 id=\"new-browserviewoptions-experimental\"><a href=\"#new-browserviewoptions-experimental\"><code>new BrowserView([options])</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>webPreferences</code> Object (optional) - See <a href=\"/docs/api/browser-window\">BrowserWindow</a>.</li>\n</ul></li>\n</ul>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<p>Objects created with <code>new BrowserView</code> have the following properties:</p>\n<h4 id=\"viewwebcontents-experimental\"><a href=\"#viewwebcontents-experimental\"><code>view.webContents</code> <em>Experimental</em></a></h4>\n<p>A <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> object owned by this view.</p>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<p>Objects created with <code>new BrowserView</code> have the following instance methods:</p>\n<h4 id=\"viewsetautoresizeoptions-experimental\"><a href=\"#viewsetautoresizeoptions-experimental\"><code>view.setAutoResize(options)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>width</code> Boolean (optional) - If <code>true</code>, the view's width will grow and shrink together\nwith the window. <code>false</code> by default.</li>\n<li><code>height</code> Boolean (optional) - If <code>true</code>, the view's height will grow and shrink\ntogether with the window. <code>false</code> by default.</li>\n<li><code>horizontal</code> Boolean (optional) - If <code>true</code>, the view's x position and width will grow\nand shrink proportionally with the window. <code>false</code> by default.</li>\n<li><code>vertical</code> Boolean (optional) - If <code>true</code>, the view's y position and height will grow\nand shrink proportionally with the window. <code>false</code> by default.</li>\n</ul></li>\n</ul>\n<h4 id=\"viewsetboundsbounds-experimental\"><a href=\"#viewsetboundsbounds-experimental\"><code>view.setBounds(bounds)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Resizes and moves the view to the supplied bounds relative to the window.</p>\n<h4 id=\"viewgetbounds-experimental\"><a href=\"#viewgetbounds-experimental\"><code>view.getBounds()</code> <em>Experimental</em></a></h4>\n<p>Returns <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>The <code>bounds</code> of this BrowserView instance as <code>Object</code>.</p>\n<h4 id=\"viewsetbackgroundcolorcolor-experimental\"><a href=\"#viewsetbackgroundcolorcolor-experimental\"><code>view.setBackgroundColor(color)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>color</code> String - Color in <code>#aarrggbb</code> or <code>#argb</code> form. The alpha channel is\noptional.</li>\n</ul>",
      "title": "BrowserView",
      "description": "Create and control views."
    },
    "/docs/api/browser-window": {
      "locale": "en-US",
      "slug": "browser-window",
      "href": "/docs/api/browser-window",
      "crowdinFileId": "256287",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-window.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"browserwindow\"><a href=\"#browserwindow\">BrowserWindow</a></h1>\n<blockquote>\n<p>Create and control browser windows.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In the main process.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-comment\">// Load a remote URL</span>\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\n<span class=\"hljs-comment\">// Or load a local HTML file</span>\nwin.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n</code></pre>\n<h2 id=\"frameless-window\"><a href=\"#frameless-window\">Frameless window</a></h2>\n<p>To create a window without chrome, or a transparent window in arbitrary shape,\nyou can use the <a href=\"/docs/api/frameless-window\">Frameless Window</a> API.</p>\n<h2 id=\"showing-the-window-gracefully\"><a href=\"#showing-the-window-gracefully\">Showing the window gracefully</a></h2>\n<p>When loading a page in the window directly, users may see the page load incrementally,\nwhich is not a good experience for a native app. To make the window display\nwithout a visual flash, there are two solutions for different situations.</p>\n<h3 id=\"using-the-ready-to-show-event\"><a href=\"#using-the-ready-to-show-event\">Using the <code>ready-to-show</code> event</a></h3>\n<p>While loading the page, the <code>ready-to-show</code> event will be emitted when the renderer\nprocess has rendered the page for the first time if the window has not been shown yet. Showing\nthe window after this event will have no visual flash:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span> })\nwin.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => {\n  win.show()\n})\n</code></pre>\n<p>This event is usually emitted after the <code>did-finish-load</code> event, but for\npages with many remote resources, it may be emitted before the <code>did-finish-load</code>\nevent.</p>\n<p>Please note that using this event implies that the renderer will be considered \"visible\" and\npaint even though <code>show</code> is false.  This event will never fire if you use <code>paintWhenInitiallyHidden: false</code></p>\n<h3 id=\"setting-the-backgroundcolor-property\"><a href=\"#setting-the-backgroundcolor-property\">Setting the <code>backgroundColor</code> property</a></h3>\n<p>For a complex app, the <code>ready-to-show</code> event could be emitted too late, making\nthe app feel slow. In this case, it is recommended to show the window\nimmediately, and use a <code>backgroundColor</code> close to your app's background:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#2e2c29'</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<p>Note that even for apps that use <code>ready-to-show</code> event, it is still recommended\nto set <code>backgroundColor</code> to make app feel more native.</p>\n<h2 id=\"parent-and-child-windows\"><a href=\"#parent-and-child-windows\">Parent and child windows</a></h2>\n<p>By using <code>parent</code> option, you can create child windows:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> top = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n<span class=\"hljs-keyword\">const</span> child = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">parent</span>: top })\nchild.show()\ntop.show()\n</code></pre>\n<p>The <code>child</code> window will always show on top of the <code>top</code> window.</p>\n<h2 id=\"modal-windows\"><a href=\"#modal-windows\">Modal windows</a></h2>\n<p>A modal window is a child window that disables parent window, to create a modal\nwindow, you have to set both <code>parent</code> and <code>modal</code> options:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> child = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">parent</span>: top, <span class=\"hljs-attr\">modal</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span> })\nchild.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\nchild.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => {\n  child.show()\n})\n</code></pre>\n<h2 id=\"page-visibility\"><a href=\"#page-visibility\">Page visibility</a></h2>\n<p>The <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API\">Page Visibility API</a> works as follows:</p>\n<ul>\n<li>On all platforms, the visibility state tracks whether the window is\nhidden/minimized or not.</li>\n<li>Additionally, on macOS, the visibility state also tracks the window\nocclusion state. If the window is occluded (i.e. fully covered) by another\nwindow, the visibility state will be <code>hidden</code>. On other platforms, the\nvisibility state will be <code>hidden</code> only when the window is minimized or\nexplicitly hidden with <code>win.hide()</code>.</li>\n<li>If a <code>BrowserWindow</code> is created with <code>show: false</code>, the initial visibility\nstate will be <code>visible</code> despite the window actually being hidden.</li>\n<li>If <code>backgroundThrottling</code> is disabled, the visibility state will remain\n<code>visible</code> even if the window is minimized, occluded, or hidden.</li>\n</ul>\n<p>It is recommended that you pause expensive operations when the visibility\nstate is <code>hidden</code> in order to minimize power consumption.</p>\n<h2 id=\"platform-notices\"><a href=\"#platform-notices\">Platform notices</a></h2>\n<ul>\n<li>On macOS modal windows will be displayed as sheets attached to the parent window.</li>\n<li>On macOS the child windows will keep the relative position to parent window\nwhen parent window moves, while on Windows and Linux child windows will not\nmove.</li>\n<li>On Linux the type of modal windows will be changed to <code>dialog</code>.</li>\n<li>On Linux many desktop environments do not support hiding a modal window.</li>\n</ul>\n<h2 id=\"class-browserwindow\"><a href=\"#class-browserwindow\">Class: BrowserWindow</a></h2>\n<blockquote>\n<p>Create and control browser windows.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>BrowserWindow</code> is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p>It creates a new <code>BrowserWindow</code> with native properties as set by the <code>options</code>.</p>\n<h3 id=\"new-browserwindowoptions\"><a href=\"#new-browserwindowoptions\"><code>new BrowserWindow([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>width</code> Integer (optional) - Window's width in pixels. Default is <code>800</code>.</li>\n<li><code>height</code> Integer (optional) - Window's height in pixels. Default is <code>600</code>.</li>\n<li><code>x</code> Integer (optional) - (<strong>required</strong> if y is used) Window's left offset from screen.\nDefault is to center the window.</li>\n<li><code>y</code> Integer (optional) - (<strong>required</strong> if x is used) Window's top offset from screen.\nDefault is to center the window.</li>\n<li><code>useContentSize</code> Boolean (optional) - The <code>width</code> and <code>height</code> would be used as web\npage's size, which means the actual window's size will include window\nframe's size and be slightly larger. Default is <code>false</code>.</li>\n<li><code>center</code> Boolean (optional) - Show window in the center of the screen.</li>\n<li><code>minWidth</code> Integer (optional) - Window's minimum width. Default is <code>0</code>.</li>\n<li><code>minHeight</code> Integer (optional) - Window's minimum height. Default is <code>0</code>.</li>\n<li><code>maxWidth</code> Integer (optional) - Window's maximum width. Default is no limit.</li>\n<li><code>maxHeight</code> Integer (optional) - Window's maximum height. Default is no limit.</li>\n<li><code>resizable</code> Boolean (optional) - Whether window is resizable. Default is <code>true</code>.</li>\n<li><code>movable</code> Boolean (optional) - Whether window is movable. This is not implemented\non Linux. Default is <code>true</code>.</li>\n<li><code>minimizable</code> Boolean (optional) - Whether window is minimizable. This is not\nimplemented on Linux. Default is <code>true</code>.</li>\n<li><code>maximizable</code> Boolean (optional) - Whether window is maximizable. This is not\nimplemented on Linux. Default is <code>true</code>.</li>\n<li><code>closable</code> Boolean (optional) - Whether window is closable. This is not implemented\non Linux. Default is <code>true</code>.</li>\n<li><code>focusable</code> Boolean (optional) - Whether the window can be focused. Default is\n<code>true</code>. On Windows setting <code>focusable: false</code> also implies setting\n<code>skipTaskbar: true</code>. On Linux setting <code>focusable: false</code> makes the window\nstop interacting with wm, so the window will always stay on top in all\nworkspaces.</li>\n<li><code>alwaysOnTop</code> Boolean (optional) - Whether the window should always stay on top of\nother windows. Default is <code>false</code>.</li>\n<li><code>fullscreen</code> Boolean (optional) - Whether the window should show in fullscreen. When\nexplicitly set to <code>false</code> the fullscreen button will be hidden or disabled\non macOS. Default is <code>false</code>.</li>\n<li><code>fullscreenable</code> Boolean (optional) - Whether the window can be put into fullscreen\nmode. On macOS, also whether the maximize/zoom button should toggle full\nscreen mode or maximize window. Default is <code>true</code>.</li>\n<li><code>simpleFullscreen</code> Boolean (optional) - Use pre-Lion fullscreen on macOS. Default is <code>false</code>.</li>\n<li><code>skipTaskbar</code> Boolean (optional) - Whether to show the window in taskbar. Default is\n<code>false</code>.</li>\n<li><code>kiosk</code> Boolean (optional) - Whether the window is in kiosk mode. Default is <code>false</code>.</li>\n<li><code>title</code> String (optional) - Default window title. Default is <code>\"Electron\"</code>. If the HTML tag <code>&#x3C;title></code> is defined in the HTML file loaded by <code>loadURL()</code>, this property will be ignored.</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (optional) - The window icon. On Windows it is\nrecommended to use <code>ICO</code> icons to get best visual effects, you can also\nleave it undefined so the executable's icon will be used.</li>\n<li><code>show</code> Boolean (optional) - Whether window should be shown when created. Default is\n<code>true</code>.</li>\n<li><code>paintWhenInitiallyHidden</code> Boolean (optional) - Whether the renderer should be active when <code>show</code> is <code>false</code> and it has just been created.  In order for <code>document.visibilityState</code> to work correctly on first load with <code>show: false</code> you should set this to <code>false</code>.  Setting this to <code>false</code> will cause the <code>ready-to-show</code> event to not fire.  Default is <code>true</code>.</li>\n<li><code>frame</code> Boolean (optional) - Specify <code>false</code> to create a\n<a href=\"/docs/api/frameless-window\">Frameless Window</a>. Default is <code>true</code>.</li>\n<li><code>parent</code> BrowserWindow (optional) - Specify parent window. Default is <code>null</code>.</li>\n<li><code>modal</code> Boolean (optional) - Whether this is a modal window. This only works when the\nwindow is a child window. Default is <code>false</code>.</li>\n<li><code>acceptFirstMouse</code> Boolean (optional) - Whether clicking an inactive window will also\nclick through to the web contents. Default is <code>false</code> on macOS. This option is not\nconfigurable on other platforms.</li>\n<li><code>disableAutoHideCursor</code> Boolean (optional) - Whether to hide cursor when typing.\nDefault is <code>false</code>.</li>\n<li><code>autoHideMenuBar</code> Boolean (optional) - Auto hide the menu bar unless the <code>Alt</code>\nkey is pressed. Default is <code>false</code>.</li>\n<li><code>enableLargerThanScreen</code> Boolean (optional) - Enable the window to be resized larger\nthan screen. Only relevant for macOS, as other OSes allow\nlarger-than-screen windows by default. Default is <code>false</code>.</li>\n<li><code>backgroundColor</code> String (optional) - Window's background color as a hexadecimal value,\nlike <code>#66CD00</code> or <code>#FFF</code> or <code>#80FFFFFF</code> (alpha in #AARRGGBB format is supported if\n<code>transparent</code> is set to <code>true</code>). Default is <code>#FFF</code> (white).</li>\n<li><code>hasShadow</code> Boolean (optional) - Whether window should have a shadow. Default is <code>true</code>.</li>\n<li><code>opacity</code> Number (optional) - Set the initial opacity of the window, between 0.0 (fully\ntransparent) and 1.0 (fully opaque). This is only implemented on Windows and macOS.</li>\n<li><code>darkTheme</code> Boolean (optional) - Forces using dark theme for the window, only works on\nsome GTK+3 desktop environments. Default is <code>false</code>.</li>\n<li><code>transparent</code> Boolean (optional) - Makes the window <a href=\"/docs/api/frameless-window#transparent-window\">transparent</a>.\nDefault is <code>false</code>. On Windows, does not work unless the window is frameless.</li>\n<li><code>type</code> String (optional) - The type of window, default is normal window. See more about\nthis below.</li>\n<li><code>visualEffectState</code> String (optional) - Specify how the material appearance should reflect window activity state on macOS. Must be used with the <code>vibrancy</code> property. Possible values are:<ul>\n<li><code>followWindow</code> - The backdrop should automatically appear active when the window is active, and inactive when it is not. This is the default.</li>\n<li><code>active</code> - The backdrop should always appear active.</li>\n<li><code>inactive</code> - The backdrop should always appear inactive.</li>\n</ul></li>\n<li><code>titleBarStyle</code> String (optional) <em>macOS</em> <em>Windows</em> - The style of window title bar.\nDefault is <code>default</code>. Possible values are:<ul>\n<li><code>default</code> - Results in the standard title bar for macOS or Windows respectively.</li>\n<li><code>hidden</code> - Results in a hidden title bar and a full size content window. On macOS, the window still has the standard window controls (“traffic lights”) in the top left. On Windows, when combined with <code>titleBarOverlay: true</code> it will activate the Window Controls Overlay (see <code>titleBarOverlay</code> for more information), otherwise no window controls will be shown.</li>\n<li><code>hiddenInset</code> - Only on macOS, results in a hidden title bar with an alternative look\nwhere the traffic light buttons are slightly more inset from the window edge.</li>\n<li><code>customButtonsOnHover</code> - Only on macOS, results in a hidden title bar and a full size\ncontent window, the traffic light buttons will display when being hovered\nover in the top left of the window.  <strong>Note:</strong> This option is currently\nexperimental.</li>\n</ul></li>\n<li><code>trafficLightPosition</code> <a href=\"/docs/api/structures/point\">Point</a> (optional) - Set a\ncustom position for the traffic light buttons in frameless windows.</li>\n<li><code>roundedCorners</code> Boolean (optional) - Whether frameless window should have\nrounded corners on macOS. Default is <code>true</code>.</li>\n<li><code>fullscreenWindowTitle</code> Boolean (optional) <em>Deprecated</em> - Shows the title in\nthe title bar in full screen mode on macOS for <code>hiddenInset</code> titleBarStyle.\nDefault is <code>false</code>.</li>\n<li><code>thickFrame</code> Boolean (optional) - Use <code>WS_THICKFRAME</code> style for frameless windows on\nWindows, which adds standard window frame. Setting it to <code>false</code> will remove\nwindow shadow and window animations. Default is <code>true</code>.</li>\n<li><code>vibrancy</code> String (optional) - Add a type of vibrancy effect to the window, only on\nmacOS. Can be <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>titlebar</code>, <code>selection</code>,\n<code>menu</code>, <code>popover</code>, <code>sidebar</code>, <code>medium-light</code>, <code>ultra-dark</code>, <code>header</code>, <code>sheet</code>, <code>window</code>, <code>hud</code>, <code>fullscreen-ui</code>, <code>tooltip</code>, <code>content</code>, <code>under-window</code>, or <code>under-page</code>. Please note that <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>medium-light</code>, and <code>ultra-dark</code> are deprecated and have been removed in macOS Catalina (10.15).</li>\n<li><code>zoomToPageWidth</code> Boolean (optional) - Controls the behavior on macOS when\noption-clicking the green stoplight button on the toolbar or by clicking the\nWindow > Zoom menu item. If <code>true</code>, the window will grow to the preferred\nwidth of the web page when zoomed, <code>false</code> will cause it to zoom to the\nwidth of the screen. This will also affect the behavior when calling\n<code>maximize()</code> directly. Default is <code>false</code>.</li>\n<li><code>tabbingIdentifier</code> String (optional) - Tab group name, allows opening the\nwindow as a native tab on macOS 10.12+. Windows with the same tabbing\nidentifier will be grouped together. This also adds a native new tab button\nto your window's tab bar and allows your <code>app</code> and window to receive the\n<code>new-window-for-tab</code> event.</li>\n<li><code>webPreferences</code> Object (optional) - Settings of web page's features.<ul>\n<li><code>devTools</code> Boolean (optional) - Whether to enable DevTools. If it is set to <code>false</code>, can not use <code>BrowserWindow.webContents.openDevTools()</code> to open DevTools. Default is <code>true</code>.</li>\n<li><code>nodeIntegration</code> Boolean (optional) - Whether node integration is enabled.\nDefault is <code>false</code>.</li>\n<li><code>nodeIntegrationInWorker</code> Boolean (optional) - Whether node integration is\nenabled in web workers. Default is <code>false</code>. More about this can be found\nin <a href=\"/docs/tutorial/multithreading\">Multithreading</a>.</li>\n<li><code>nodeIntegrationInSubFrames</code> Boolean (optional) - Experimental option for\nenabling Node.js support in sub-frames such as iframes and child windows. All your preloads will load for\nevery iframe, you can use <code>process.isMainFrame</code> to determine if you are\nin the main frame or not.</li>\n<li><code>preload</code> String (optional) - Specifies a script that will be loaded before other\nscripts run in the page. This script will always have access to node APIs\nno matter whether node integration is turned on or off. The value should\nbe the absolute file path to the script.\nWhen node integration is turned off, the preload script can reintroduce\nNode global symbols back to the global scope. See example\n<a href=\"/docs/api/context-bridge#exposing-node-global-symbols\">here</a>.</li>\n<li><code>sandbox</code> Boolean (optional) - If set, this will sandbox the renderer\nassociated with the window, making it compatible with the Chromium\nOS-level sandbox and disabling the Node.js engine. This is not the same as\nthe <code>nodeIntegration</code> option and the APIs available to the preload script\nare more limited. Read more about the option <a href=\"/docs/tutorial/sandbox\">here</a>.</li>\n<li><code>session</code> <a href=\"/docs/api/session#class-session\">Session</a> (optional) - Sets the session used by the\npage. Instead of passing the Session object directly, you can also choose to\nuse the <code>partition</code> option instead, which accepts a partition string. When\nboth <code>session</code> and <code>partition</code> are provided, <code>session</code> will be preferred.\nDefault is the default session.</li>\n<li><code>partition</code> String (optional) - Sets the session used by the page according to the\nsession's partition string. If <code>partition</code> starts with <code>persist:</code>, the page\nwill use a persistent session available to all pages in the app with the\nsame <code>partition</code>. If there is no <code>persist:</code> prefix, the page will use an\nin-memory session. By assigning the same <code>partition</code>, multiple pages can share\nthe same session. Default is the default session.</li>\n<li><code>zoomFactor</code> Number (optional) - The default zoom factor of the page, <code>3.0</code> represents\n<code>300%</code>. Default is <code>1.0</code>.</li>\n<li><code>javascript</code> Boolean (optional) - Enables JavaScript support. Default is <code>true</code>.</li>\n<li><code>webSecurity</code> Boolean (optional) - When <code>false</code>, it will disable the\nsame-origin policy (usually using testing websites by people), and set\n<code>allowRunningInsecureContent</code> to <code>true</code> if this options has not been set\nby user. Default is <code>true</code>.</li>\n<li><code>allowRunningInsecureContent</code> Boolean (optional) - Allow an https page to run\nJavaScript, CSS or plugins from http URLs. Default is <code>false</code>.</li>\n<li><code>images</code> Boolean (optional) - Enables image support. Default is <code>true</code>.</li>\n<li><code>imageAnimationPolicy</code> String (optional) - Specifies how to run image animations (E.g. GIFs).  Can be <code>animate</code>, <code>animateOnce</code> or <code>noAnimation</code>.  Default is <code>animate</code>.</li>\n<li><code>textAreasAreResizable</code> Boolean (optional) - Make TextArea elements resizable. Default\nis <code>true</code>.</li>\n<li><code>webgl</code> Boolean (optional) - Enables WebGL support. Default is <code>true</code>.</li>\n<li><code>plugins</code> Boolean (optional) - Whether plugins should be enabled. Default is <code>false</code>.</li>\n<li><code>experimentalFeatures</code> Boolean (optional) - Enables Chromium's experimental features.\nDefault is <code>false</code>.</li>\n<li><code>scrollBounce</code> Boolean (optional) - Enables scroll bounce (rubber banding) effect on\nmacOS. Default is <code>false</code>.</li>\n<li><code>enableBlinkFeatures</code> String (optional) - A list of feature strings separated by <code>,</code>, like\n<code>CSSVariables,KeyboardEventKey</code> to enable. The full list of supported feature\nstrings can be found in the <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a>\nfile.</li>\n<li><code>disableBlinkFeatures</code> String (optional) - A list of feature strings separated by <code>,</code>,\nlike <code>CSSVariables,KeyboardEventKey</code> to disable. The full list of supported\nfeature strings can be found in the\n<a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> file.</li>\n<li><code>defaultFontFamily</code> Object (optional) - Sets the default font for the font-family.<ul>\n<li><code>standard</code> String (optional) - Defaults to <code>Times New Roman</code>.</li>\n<li><code>serif</code> String (optional) - Defaults to <code>Times New Roman</code>.</li>\n<li><code>sansSerif</code> String (optional) - Defaults to <code>Arial</code>.</li>\n<li><code>monospace</code> String (optional) - Defaults to <code>Courier New</code>.</li>\n<li><code>cursive</code> String (optional) - Defaults to <code>Script</code>.</li>\n<li><code>fantasy</code> String (optional) - Defaults to <code>Impact</code>.</li>\n</ul></li>\n<li><code>defaultFontSize</code> Integer (optional) - Defaults to <code>16</code>.</li>\n<li><code>defaultMonospaceFontSize</code> Integer (optional) - Defaults to <code>13</code>.</li>\n<li><code>minimumFontSize</code> Integer (optional) - Defaults to <code>0</code>.</li>\n<li><code>defaultEncoding</code> String (optional) - Defaults to <code>ISO-8859-1</code>.</li>\n<li><code>backgroundThrottling</code> Boolean (optional) - Whether to throttle animations and timers\nwhen the page becomes background. This also affects the\n<a href=\"#page-visibility\">Page Visibility API</a>. Defaults to <code>true</code>.</li>\n<li><code>offscreen</code> Boolean (optional) - Whether to enable offscreen rendering for the browser\nwindow. Defaults to <code>false</code>. See the\n<a href=\"/docs/tutorial/offscreen-rendering\">offscreen rendering tutorial</a> for\nmore details.</li>\n<li><code>contextIsolation</code> Boolean (optional) - Whether to run Electron APIs and\nthe specified <code>preload</code> script in a separate JavaScript context. Defaults\nto <code>true</code>. The context that the <code>preload</code> script runs in will only have\naccess to its own dedicated <code>document</code> and <code>window</code> globals, as well as\nits own set of JavaScript builtins (<code>Array</code>, <code>Object</code>, <code>JSON</code>, etc.),\nwhich are all invisible to the loaded content. The Electron API will only\nbe available in the <code>preload</code> script and not the loaded page. This option\nshould be used when loading potentially untrusted remote content to ensure\nthe loaded content cannot tamper with the <code>preload</code> script and any\nElectron APIs being used.  This option uses the same technique used by\n<a href=\"https://developer.chrome.com/extensions/content_scripts#execution-environment\">Chrome Content Scripts</a>.  You can access this\ncontext in the dev tools by selecting the 'Electron Isolated Context'\nentry in the combo box at the top of the Console tab.</li>\n<li><code>nativeWindowOpen</code> Boolean (optional) - Whether to use native\n<code>window.open()</code>. Defaults to <code>true</code>. Child windows will always have node\nintegration disabled unless <code>nodeIntegrationInSubFrames</code> is true.</li>\n<li><code>webviewTag</code> Boolean (optional) - Whether to enable the <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code> tag</a>.\nDefaults to <code>false</code>. <strong>Note:</strong> The\n<code>preload</code> script configured for the <code>&#x3C;webview></code> will have node integration\nenabled when it is executed so you should ensure remote/untrusted content\nis not able to create a <code>&#x3C;webview></code> tag with a possibly malicious <code>preload</code>\nscript. You can use the <code>will-attach-webview</code> event on <a href=\"/docs/api/web-contents\">webContents</a>\nto strip away the <code>preload</code> script and to validate or alter the\n<code>&#x3C;webview></code>'s initial settings.</li>\n<li><code>additionalArguments</code> String<a href=\"/docs/api/optional\"></a> - A list of strings that will be appended\nto <code>process.argv</code> in the renderer process of this app.  Useful for passing small\nbits of data down to renderer process preload scripts.</li>\n<li><code>safeDialogs</code> Boolean (optional) - Whether to enable browser style\nconsecutive dialog protection. Default is <code>false</code>.</li>\n<li><code>safeDialogsMessage</code> String (optional) - The message to display when\nconsecutive dialog protection is triggered. If not defined the default\nmessage would be used, note that currently the default message is in\nEnglish and not localized.</li>\n<li><code>disableDialogs</code> Boolean (optional) - Whether to disable dialogs\ncompletely. Overrides <code>safeDialogs</code>. Default is <code>false</code>.</li>\n<li><code>navigateOnDragDrop</code> Boolean (optional) - Whether dragging and dropping a\nfile or link onto the page causes a navigation. Default is <code>false</code>.</li>\n<li><code>autoplayPolicy</code> String (optional) - Autoplay policy to apply to\ncontent in the window, can be <code>no-user-gesture-required</code>,\n<code>user-gesture-required</code>, <code>document-user-activation-required</code>. Defaults to\n<code>no-user-gesture-required</code>.</li>\n<li><code>disableHtmlFullscreenWindowResize</code> Boolean (optional) - Whether to\nprevent the window from resizing when entering HTML Fullscreen. Default\nis <code>false</code>.</li>\n<li><code>accessibleTitle</code> String (optional) - An alternative title string provided only\nto accessibility tools such as screen readers. This string is not directly\nvisible to users.</li>\n<li><code>spellcheck</code> Boolean (optional) - Whether to enable the builtin spellchecker.\nDefault is <code>true</code>.</li>\n<li><code>enableWebSQL</code> Boolean (optional) - Whether to enable the <a href=\"https://www.w3.org/TR/webdatabase/\">WebSQL api</a>.\nDefault is <code>true</code>.</li>\n<li><code>v8CacheOptions</code> String (optional) - Enforces the v8 code caching policy\nused by blink. Accepted values are<ul>\n<li><code>none</code> - Disables code caching</li>\n<li><code>code</code> - Heuristic based code caching</li>\n<li><code>bypassHeatCheck</code> - Bypass code caching heuristics but with lazy compilation</li>\n<li><code>bypassHeatCheckAndEagerCompile</code> - Same as above except compilation is eager.\nDefault policy is <code>code</code>.</li>\n</ul></li>\n<li><code>enablePreferredSizeMode</code> Boolean (optional) - Whether to enable\npreferred size mode. The preferred size is the minimum size needed to\ncontain the layout of the document—without requiring scrolling. Enabling\nthis will cause the <code>preferred-size-changed</code> event to be emitted on the\n<code>WebContents</code> when the preferred size changes. Default is <code>false</code>.</li>\n</ul></li>\n<li><code>titleBarOverlay</code> Object | Boolean (optional) -  When using a frameless window in conjuction with <code>win.setWindowButtonVisibility(true)</code> on macOS or using a <code>titleBarStyle</code> so that the standard window controls (\"traffic lights\" on macOS) are visible, this property enables the Window Controls Overlay <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis\">JavaScript APIs</a> and <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables\">CSS Environment Variables</a>. Specifying <code>true</code> will result in an overlay with default system colors. Default is <code>false</code>.<ul>\n<li><code>color</code> String (optional) <em>Windows</em> - The CSS color of the Window Controls Overlay when enabled. Default is the system color.</li>\n<li><code>symbolColor</code> String (optional) <em>Windows</em> - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>When setting minimum or maximum window size with <code>minWidth</code>/<code>maxWidth</code>/\n<code>minHeight</code>/<code>maxHeight</code>, it only constrains the users. It won't prevent you from\npassing a size that does not follow size constraints to <code>setBounds</code>/<code>setSize</code> or\nto the constructor of <code>BrowserWindow</code>.</p>\n<p>The possible values and behaviors of the <code>type</code> option are platform dependent.\nPossible values are:</p>\n<ul>\n<li>On Linux, possible types are <code>desktop</code>, <code>dock</code>, <code>toolbar</code>, <code>splash</code>,\n<code>notification</code>.</li>\n<li>On macOS, possible types are <code>desktop</code>, <code>textured</code>.<ul>\n<li>The <code>textured</code> type adds metal gradient appearance\n(<code>NSTexturedBackgroundWindowMask</code>).</li>\n<li>The <code>desktop</code> type places the window at the desktop background window level\n(<code>kCGDesktopWindowLevel - 1</code>). Note that desktop window will not receive\nfocus, keyboard or mouse events, but you can use <code>globalShortcut</code> to receive\ninput sparingly.</li>\n</ul></li>\n<li>On Windows, possible type is <code>toolbar</code>.</li>\n</ul>\n<h3 id=\"instance-events\"><a href=\"#instance-events\">Instance Events</a></h3>\n<p>Objects created with <code>new BrowserWindow</code> emit the following events:</p>\n<p><strong>Note:</strong> Some events are only available on specific operating systems and are\nlabeled as such.</p>\n<h4 id=\"event-page-title-updated\"><a href=\"#event-page-title-updated\">Event: 'page-title-updated'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>Emitted when the document changed its title, calling <code>event.preventDefault()</code>\nwill prevent the native window's title from changing.\n<code>explicitSet</code> is false when title is synthesized from file URL.</p>\n<h4 id=\"event-close\"><a href=\"#event-close\">Event: 'close'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the window is going to be closed. It's emitted before the\n<code>beforeunload</code> and <code>unload</code> event of the DOM. Calling <code>event.preventDefault()</code>\nwill cancel the close.</p>\n<p>Usually you would want to use the <code>beforeunload</code> handler to decide whether the\nwindow should be closed, which will also be called when the window is\nreloaded. In Electron, returning any value other than <code>undefined</code> would cancel the\nclose. For example:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-built_in\">window</span>.onbeforeunload = <span class=\"hljs-function\">(<span class=\"hljs-params\">e</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'I do not want to be closed'</span>)\n\n  <span class=\"hljs-comment\">// Unlike usual browsers that a message box will be prompted to users, returning</span>\n  <span class=\"hljs-comment\">// a non-void value will silently cancel the close.</span>\n  <span class=\"hljs-comment\">// It is recommended to use the dialog API to let the user confirm closing the</span>\n  <span class=\"hljs-comment\">// application.</span>\n  e.returnValue = <span class=\"hljs-literal\">false</span> <span class=\"hljs-comment\">// equivalent to `return false` but not recommended</span>\n}\n</code></pre>\n<p><em><strong>Note</strong>: There is a subtle difference between the behaviors of <code>window.onbeforeunload = handler</code> and <code>window.addEventListener('beforeunload', handler)</code>. It is recommended to always set the <code>event.returnValue</code> explicitly, instead of only returning a value, as the former works more consistently within Electron.</em></p>\n<h4 id=\"event-closed\"><a href=\"#event-closed\">Event: 'closed'</a></h4>\n<p>Emitted when the window is closed. After you have received this event you should\nremove the reference to the window and avoid using it any more.</p>\n<h4 id=\"event-session-end-windows\"><a href=\"#event-session-end-windows\">Event: 'session-end' <em>Windows</em></a></h4>\n<p>Emitted when window session is going to end due to force shutdown or machine restart\nor session log off.</p>\n<h4 id=\"event-unresponsive\"><a href=\"#event-unresponsive\">Event: 'unresponsive'</a></h4>\n<p>Emitted when the web page becomes unresponsive.</p>\n<h4 id=\"event-responsive\"><a href=\"#event-responsive\">Event: 'responsive'</a></h4>\n<p>Emitted when the unresponsive web page becomes responsive again.</p>\n<h4 id=\"event-blur\"><a href=\"#event-blur\">Event: 'blur'</a></h4>\n<p>Emitted when the window loses focus.</p>\n<h4 id=\"event-focus\"><a href=\"#event-focus\">Event: 'focus'</a></h4>\n<p>Emitted when the window gains focus.</p>\n<h4 id=\"event-show\"><a href=\"#event-show\">Event: 'show'</a></h4>\n<p>Emitted when the window is shown.</p>\n<h4 id=\"event-hide\"><a href=\"#event-hide\">Event: 'hide'</a></h4>\n<p>Emitted when the window is hidden.</p>\n<h4 id=\"event-ready-to-show\"><a href=\"#event-ready-to-show\">Event: 'ready-to-show'</a></h4>\n<p>Emitted when the web page has been rendered (while not being shown) and window can be displayed without\na visual flash.</p>\n<p>Please note that using this event implies that the renderer will be considered \"visible\" and\npaint even though <code>show</code> is false.  This event will never fire if you use <code>paintWhenInitiallyHidden: false</code></p>\n<h4 id=\"event-maximize\"><a href=\"#event-maximize\">Event: 'maximize'</a></h4>\n<p>Emitted when window is maximized.</p>\n<h4 id=\"event-unmaximize\"><a href=\"#event-unmaximize\">Event: 'unmaximize'</a></h4>\n<p>Emitted when the window exits from a maximized state.</p>\n<h4 id=\"event-minimize\"><a href=\"#event-minimize\">Event: 'minimize'</a></h4>\n<p>Emitted when the window is minimized.</p>\n<h4 id=\"event-restore\"><a href=\"#event-restore\">Event: 'restore'</a></h4>\n<p>Emitted when the window is restored from a minimized state.</p>\n<h4 id=\"event-will-resize-macos-windows\"><a href=\"#event-will-resize-macos-windows\">Event: 'will-resize' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newBounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Size the window is being resized to.</li>\n<li><code>details</code> Object<ul>\n<li><code>edge</code> (String) - The edge of the window being dragged for resizing. Can be <code>bottom</code>, <code>left</code>, <code>right</code>, <code>top-left</code>, <code>top-right</code>, <code>bottom-left</code> or <code>bottom-right</code>.</li>\n</ul></li>\n</ul>\n<p>Emitted before the window is resized. Calling <code>event.preventDefault()</code> will prevent the window from being resized.</p>\n<p>Note that this is only emitted when the window is being resized manually. Resizing the window with <code>setBounds</code>/<code>setSize</code> will not emit this event.</p>\n<p>The possible values and behaviors of the <code>edge</code> option are platform dependent. Possible values are:</p>\n<ul>\n<li>On Windows, possible values are <code>bottom</code>, <code>top</code>, <code>left</code>, <code>right</code>, <code>top-left</code>, <code>top-right</code>, <code>bottom-left</code>, <code>bottom-right</code>.</li>\n<li>On macOS, possible values are <code>bottom</code> and <code>right</code>.<ul>\n<li>The value <code>bottom</code> is used to denote vertical resizing.</li>\n<li>The value <code>right</code> is used to denote horizontal resizing.</li>\n</ul></li>\n</ul>\n<h4 id=\"event-resize\"><a href=\"#event-resize\">Event: 'resize'</a></h4>\n<p>Emitted after the window has been resized.</p>\n<h4 id=\"event-resized-macos-windows\"><a href=\"#event-resized-macos-windows\">Event: 'resized' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Emitted once when the window has finished being resized.</p>\n<p>This is usually emitted when the window has been resized manually. On macOS, resizing the window with <code>setBounds</code>/<code>setSize</code> and setting the <code>animate</code> parameter to <code>true</code> will also emit this event once resizing has finished.</p>\n<h4 id=\"event-will-move-macos-windows\"><a href=\"#event-will-move-macos-windows\">Event: 'will-move' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newBounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Location the window is being moved to.</li>\n</ul>\n<p>Emitted before the window is moved. On Windows, calling <code>event.preventDefault()</code> will prevent the window from being moved.</p>\n<p>Note that this is only emitted when the window is being resized manually. Resizing the window with <code>setBounds</code>/<code>setSize</code> will not emit this event.</p>\n<h4 id=\"event-move\"><a href=\"#event-move\">Event: 'move'</a></h4>\n<p>Emitted when the window is being moved to a new position.</p>\n<h4 id=\"event-moved-macos-windows\"><a href=\"#event-moved-macos-windows\">Event: 'moved' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Emitted once when the window is moved to a new position.</p>\n<p><strong>Note</strong>: On macOS this event is an alias of <code>move</code>.</p>\n<h4 id=\"event-enter-full-screen\"><a href=\"#event-enter-full-screen\">Event: 'enter-full-screen'</a></h4>\n<p>Emitted when the window enters a full-screen state.</p>\n<h4 id=\"event-leave-full-screen\"><a href=\"#event-leave-full-screen\">Event: 'leave-full-screen'</a></h4>\n<p>Emitted when the window leaves a full-screen state.</p>\n<h4 id=\"event-enter-html-full-screen\"><a href=\"#event-enter-html-full-screen\">Event: 'enter-html-full-screen'</a></h4>\n<p>Emitted when the window enters a full-screen state triggered by HTML API.</p>\n<h4 id=\"event-leave-html-full-screen\"><a href=\"#event-leave-html-full-screen\">Event: 'leave-html-full-screen'</a></h4>\n<p>Emitted when the window leaves a full-screen state triggered by HTML API.</p>\n<h4 id=\"event-always-on-top-changed\"><a href=\"#event-always-on-top-changed\">Event: 'always-on-top-changed'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>isAlwaysOnTop</code> Boolean</li>\n</ul>\n<p>Emitted when the window is set or unset to show always on top of other windows.</p>\n<h4 id=\"event-app-command-windows-linux\"><a href=\"#event-app-command-windows-linux\">Event: 'app-command' <em>Windows</em> <em>Linux</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>command</code> String</li>\n</ul>\n<p>Emitted when an <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/ms646275(v=vs.85).aspx\">App Command</a>\nis invoked. These are typically related to keyboard media keys or browser\ncommands, as well as the \"Back\" button built into some mice on Windows.</p>\n<p>Commands are lowercased, underscores are replaced with hyphens, and the\n<code>APPCOMMAND_</code> prefix is stripped off.\ne.g. <code>APPCOMMAND_BROWSER_BACKWARD</code> is emitted as <code>browser-backward</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-comment\">// Navigate the window back when the user hits their mouse back button</span>\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'browser-backward'</span> &#x26;&#x26; win.webContents.canGoBack()) {\n    win.webContents.goBack()\n  }\n})\n</code></pre>\n<p>The following app commands are explicitly supported on Linux:</p>\n<ul>\n<li><code>browser-backward</code></li>\n<li><code>browser-forward</code></li>\n</ul>\n<h4 id=\"event-scroll-touch-begin-macos\"><a href=\"#event-scroll-touch-begin-macos\">Event: 'scroll-touch-begin' <em>macOS</em></a></h4>\n<p>Emitted when scroll wheel event phase has begun.</p>\n<h4 id=\"event-scroll-touch-end-macos\"><a href=\"#event-scroll-touch-end-macos\">Event: 'scroll-touch-end' <em>macOS</em></a></h4>\n<p>Emitted when scroll wheel event phase has ended.</p>\n<h4 id=\"event-scroll-touch-edge-macos\"><a href=\"#event-scroll-touch-edge-macos\">Event: 'scroll-touch-edge' <em>macOS</em></a></h4>\n<p>Emitted when scroll wheel event phase filed upon reaching the edge of element.</p>\n<h4 id=\"event-swipe-macos\"><a href=\"#event-swipe-macos\">Event: 'swipe' <em>macOS</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>direction</code> String</li>\n</ul>\n<p>Emitted on 3-finger swipe. Possible directions are <code>up</code>, <code>right</code>, <code>down</code>, <code>left</code>.</p>\n<p>The method underlying this event is built to handle older macOS-style trackpad swiping,\nwhere the content on the screen doesn't move with the swipe. Most macOS trackpads are not\nconfigured to allow this kind of swiping anymore, so in order for it to emit properly the\n'Swipe between pages' preference in <code>System Preferences > Trackpad > More Gestures</code> must be\nset to 'Swipe with two or three fingers'.</p>\n<h4 id=\"event-rotate-gesture-macos\"><a href=\"#event-rotate-gesture-macos\">Event: 'rotate-gesture' <em>macOS</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>rotation</code> Float</li>\n</ul>\n<p>Emitted on trackpad rotation gesture. Continually emitted until rotation gesture is\nended. The <code>rotation</code> value on each emission is the angle in degrees rotated since\nthe last emission. The last emitted event upon a rotation gesture will always be of\nvalue <code>0</code>. Counter-clockwise rotation values are positive, while clockwise ones are\nnegative.</p>\n<h4 id=\"event-sheet-begin-macos\"><a href=\"#event-sheet-begin-macos\">Event: 'sheet-begin' <em>macOS</em></a></h4>\n<p>Emitted when the window opens a sheet.</p>\n<h4 id=\"event-sheet-end-macos\"><a href=\"#event-sheet-end-macos\">Event: 'sheet-end' <em>macOS</em></a></h4>\n<p>Emitted when the window has closed a sheet.</p>\n<h4 id=\"event-new-window-for-tab-macos\"><a href=\"#event-new-window-for-tab-macos\">Event: 'new-window-for-tab' <em>macOS</em></a></h4>\n<p>Emitted when the native new tab button is clicked.</p>\n<h4 id=\"event-system-context-menu-windows\"><a href=\"#event-system-context-menu-windows\">Event: 'system-context-menu' <em>Windows</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a> - The screen coordinates the context menu was triggered at</li>\n</ul>\n<p>Emitted when the system context menu is triggered on the window, this is\nnormally only triggered when the user right clicks on the non-client area\nof your window.  This is the window titlebar or any area you have declared\nas <code>-webkit-app-region: drag</code> in a frameless window.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent the menu from being displayed.</p>\n<h3 id=\"static-methods\"><a href=\"#static-methods\">Static Methods</a></h3>\n<p>The <code>BrowserWindow</code> class has the following static methods:</p>\n<h4 id=\"browserwindowgetallwindows\"><a href=\"#browserwindowgetallwindows\"><code>BrowserWindow.getAllWindows()</code></a></h4>\n<p>Returns <code>BrowserWindow[]</code> - An array of all opened browser windows.</p>\n<h4 id=\"browserwindowgetfocusedwindow\"><a href=\"#browserwindowgetfocusedwindow\"><code>BrowserWindow.getFocusedWindow()</code></a></h4>\n<p>Returns <code>BrowserWindow | null</code> - The window that is focused in this application, otherwise returns <code>null</code>.</p>\n<h4 id=\"browserwindowfromwebcontentswebcontents\"><a href=\"#browserwindowfromwebcontentswebcontents\"><code>BrowserWindow.fromWebContents(webContents)</code></a></h4>\n<ul>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Returns <code>BrowserWindow | null</code> - The window that owns the given <code>webContents</code>\nor <code>null</code> if the contents are not owned by a window.</p>\n<h4 id=\"browserwindowfrombrowserviewbrowserview\"><a href=\"#browserwindowfrombrowserviewbrowserview\"><code>BrowserWindow.fromBrowserView(browserView)</code></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>Returns <code>BrowserWindow | null</code> - The window that owns the given <code>browserView</code>. If the given view is not attached to any window, returns <code>null</code>.</p>\n<h4 id=\"browserwindowfromidid\"><a href=\"#browserwindowfromidid\"><code>BrowserWindow.fromId(id)</code></a></h4>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Returns <code>BrowserWindow | null</code> - The window with the given <code>id</code>.</p>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<p>Objects created with <code>new BrowserWindow</code> have the following properties:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">// In this example `win` is our instance</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<h4 id=\"winwebcontents-readonly\"><a href=\"#winwebcontents-readonly\"><code>win.webContents</code> <em>Readonly</em></a></h4>\n<p>A <code>WebContents</code> object this window owns. All web page related events and\noperations will be done via it.</p>\n<p>See the <a href=\"/docs/api/web-contents\"><code>webContents</code> documentation</a> for its methods and\nevents.</p>\n<h4 id=\"winid-readonly\"><a href=\"#winid-readonly\"><code>win.id</code> <em>Readonly</em></a></h4>\n<p>A <code>Integer</code> property representing the unique ID of the window. Each ID is unique among all <code>BrowserWindow</code> instances of the entire Electron application.</p>\n<h4 id=\"winautohidemenubar\"><a href=\"#winautohidemenubar\"><code>win.autoHideMenuBar</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window menu bar should hide itself automatically. Once set, the menu bar will only show when users press the single <code>Alt</code> key.</p>\n<p>If the menu bar is already visible, setting this property to <code>true</code> won't\nhide it immediately.</p>\n<h4 id=\"winsimplefullscreen\"><a href=\"#winsimplefullscreen\"><code>win.simpleFullScreen</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in simple (pre-Lion) fullscreen mode.</p>\n<h4 id=\"winfullscreen\"><a href=\"#winfullscreen\"><code>win.fullScreen</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in fullscreen mode.</p>\n<h4 id=\"winfocusable-windows-macos\"><a href=\"#winfocusable-windows-macos\"><code>win.focusable</code> <em>Windows</em> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is focusable.</p>\n<h4 id=\"winvisibleonallworkspaces\"><a href=\"#winvisibleonallworkspaces\"><code>win.visibleOnAllWorkspaces</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is visible on all workspaces.</p>\n<p><strong>Note:</strong> Always returns false on Windows.</p>\n<h4 id=\"winshadow\"><a href=\"#winshadow\"><code>win.shadow</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window has a shadow.</p>\n<h4 id=\"winmenubarvisible-windows-linux\"><a href=\"#winmenubarvisible-windows-linux\"><code>win.menuBarVisible</code> <em>Windows</em> <em>Linux</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the menu bar should be visible.</p>\n<p><strong>Note:</strong> If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single <code>Alt</code> key.</p>\n<h4 id=\"winkiosk\"><a href=\"#winkiosk\"><code>win.kiosk</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in kiosk mode.</p>\n<h4 id=\"windocumentedited-macos\"><a href=\"#windocumentedited-macos\"><code>win.documentEdited</code> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that specifies whether the window’s document has been edited.</p>\n<p>The icon in title bar will become gray when set to <code>true</code>.</p>\n<h4 id=\"winrepresentedfilename-macos\"><a href=\"#winrepresentedfilename-macos\"><code>win.representedFilename</code> <em>macOS</em></a></h4>\n<p>A <code>String</code> property that determines the pathname of the file the window represents,\nand the icon of the file will show in window's title bar.</p>\n<h4 id=\"wintitle\"><a href=\"#wintitle\"><code>win.title</code></a></h4>\n<p>A <code>String</code> property that determines the title of the native window.</p>\n<p><strong>Note:</strong> The title of the web page can be different from the title of the native window.</p>\n<h4 id=\"winminimizable\"><a href=\"#winminimizable\"><code>win.minimizable</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window can be manually minimized by user.</p>\n<p>On Linux the setter is a no-op, although the getter returns <code>true</code>.</p>\n<h4 id=\"winmaximizable\"><a href=\"#winmaximizable\"><code>win.maximizable</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window can be manually maximized by user.</p>\n<p>On Linux the setter is a no-op, although the getter returns <code>true</code>.</p>\n<h4 id=\"winfullscreenable\"><a href=\"#winfullscreenable\"><code>win.fullScreenable</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the maximize/zoom window button toggles fullscreen mode or\nmaximizes the window.</p>\n<h4 id=\"winresizable\"><a href=\"#winresizable\"><code>win.resizable</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window can be manually resized by user.</p>\n<h4 id=\"winclosable\"><a href=\"#winclosable\"><code>win.closable</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window can be manually closed by user.</p>\n<p>On Linux the setter is a no-op, although the getter returns <code>true</code>.</p>\n<h4 id=\"winmovable\"><a href=\"#winmovable\"><code>win.movable</code></a></h4>\n<p>A <code>Boolean</code> property that determines Whether the window can be moved by user.</p>\n<p>On Linux the setter is a no-op, although the getter returns <code>true</code>.</p>\n<h4 id=\"winexcludedfromshownwindowsmenu-macos\"><a href=\"#winexcludedfromshownwindowsmenu-macos\"><code>win.excludedFromShownWindowsMenu</code> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is excluded from the application’s Windows menu. <code>false</code> by default.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-keyword\">const</span> template = [\n  {\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'windowmenu'</span>\n  }\n]\n\nwin.excludedFromShownWindowsMenu = <span class=\"hljs-literal\">true</span>\n\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\nMenu.setApplicationMenu(menu)\n</code></pre>\n<h4 id=\"winaccessibletitle\"><a href=\"#winaccessibletitle\"><code>win.accessibleTitle</code></a></h4>\n<p>A <code>String</code> property that defines an alternative title provided only to\naccessibility tools such as screen readers. This string is not directly\nvisible to users.</p>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<p>Objects created with <code>new BrowserWindow</code> have the following instance methods:</p>\n<p><strong>Note:</strong> Some methods are only available on specific operating systems and are\nlabeled as such.</p>\n<h4 id=\"windestroy\"><a href=\"#windestroy\"><code>win.destroy()</code></a></h4>\n<p>Force closing the window, the <code>unload</code> and <code>beforeunload</code> event won't be emitted\nfor the web page, and <code>close</code> event will also not be emitted\nfor this window, but it guarantees the <code>closed</code> event will be emitted.</p>\n<h4 id=\"winclose\"><a href=\"#winclose\"><code>win.close()</code></a></h4>\n<p>Try to close the window. This has the same effect as a user manually clicking\nthe close button of the window. The web page may cancel the close though. See\nthe <a href=\"#event-close\">close event</a>.</p>\n<h4 id=\"winfocus\"><a href=\"#winfocus\"><code>win.focus()</code></a></h4>\n<p>Focuses on the window.</p>\n<h4 id=\"winblur\"><a href=\"#winblur\"><code>win.blur()</code></a></h4>\n<p>Removes focus from the window.</p>\n<h4 id=\"winisfocused\"><a href=\"#winisfocused\"><code>win.isFocused()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is focused.</p>\n<h4 id=\"winisdestroyed\"><a href=\"#winisdestroyed\"><code>win.isDestroyed()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is destroyed.</p>\n<h4 id=\"winshow\"><a href=\"#winshow\"><code>win.show()</code></a></h4>\n<p>Shows and gives focus to the window.</p>\n<h4 id=\"winshowinactive\"><a href=\"#winshowinactive\"><code>win.showInactive()</code></a></h4>\n<p>Shows the window but doesn't focus on it.</p>\n<h4 id=\"winhide\"><a href=\"#winhide\"><code>win.hide()</code></a></h4>\n<p>Hides the window.</p>\n<h4 id=\"winisvisible\"><a href=\"#winisvisible\"><code>win.isVisible()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is visible to the user.</p>\n<h4 id=\"winismodal\"><a href=\"#winismodal\"><code>win.isModal()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether current window is a modal window.</p>\n<h4 id=\"winmaximize\"><a href=\"#winmaximize\"><code>win.maximize()</code></a></h4>\n<p>Maximizes the window. This will also show (but not focus) the window if it\nisn't being displayed already.</p>\n<h4 id=\"winunmaximize\"><a href=\"#winunmaximize\"><code>win.unmaximize()</code></a></h4>\n<p>Unmaximizes the window.</p>\n<h4 id=\"winismaximized\"><a href=\"#winismaximized\"><code>win.isMaximized()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is maximized.</p>\n<h4 id=\"winminimize\"><a href=\"#winminimize\"><code>win.minimize()</code></a></h4>\n<p>Minimizes the window. On some platforms the minimized window will be shown in\nthe Dock.</p>\n<h4 id=\"winrestore\"><a href=\"#winrestore\"><code>win.restore()</code></a></h4>\n<p>Restores the window from minimized state to its previous state.</p>\n<h4 id=\"winisminimized\"><a href=\"#winisminimized\"><code>win.isMinimized()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is minimized.</p>\n<h4 id=\"winsetfullscreenflag\"><a href=\"#winsetfullscreenflag\"><code>win.setFullScreen(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Sets whether the window should be in fullscreen mode.</p>\n<h4 id=\"winisfullscreen\"><a href=\"#winisfullscreen\"><code>win.isFullScreen()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in fullscreen mode.</p>\n<h4 id=\"winsetsimplefullscreenflag-macos\"><a href=\"#winsetsimplefullscreenflag-macos\"><code>win.setSimpleFullScreen(flag)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Enters or leaves simple fullscreen mode.</p>\n<p>Simple fullscreen mode emulates the native fullscreen behavior found in versions of macOS prior to Lion (10.7).</p>\n<h4 id=\"winissimplefullscreen-macos\"><a href=\"#winissimplefullscreen-macos\"><code>win.isSimpleFullScreen()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in simple (pre-Lion) fullscreen mode.</p>\n<h4 id=\"winisnormal\"><a href=\"#winisnormal\"><code>win.isNormal()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in normal state (not maximized, not minimized, not in fullscreen mode).</p>\n<h4 id=\"winsetaspectratioaspectratio-extrasize\"><a href=\"#winsetaspectratioaspectratio-extrasize\"><code>win.setAspectRatio(aspectRatio[, extraSize])</code></a></h4>\n<ul>\n<li><code>aspectRatio</code> Float - The aspect ratio to maintain for some portion of the\ncontent view.</li>\n<li><code>extraSize</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) <em>macOS</em> - The extra size not to be included while\nmaintaining the aspect ratio.</li>\n</ul>\n<p>This will make a window maintain an aspect ratio. The extra size allows a\ndeveloper to have space, specified in pixels, not included within the aspect\nratio calculations. This API already takes into account the difference between a\nwindow's size and its content size.</p>\n<p>Consider a normal window with an HD video player and associated controls.\nPerhaps there are 15 pixels of controls on the left edge, 25 pixels of controls\non the right edge and 50 pixels of controls below the player. In order to\nmaintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within\nthe player itself we would call this function with arguments of 16/9 and\n{ width: 40, height: 50 }. The second argument doesn't care where the extra width and height\nare within the content view--only that they exist. Sum any extra width and\nheight areas you have within the overall content view.</p>\n<p>The aspect ratio is not respected when window is resized programmatically with\nAPIs like <code>win.setSize</code>.</p>\n<h4 id=\"winsetbackgroundcolorbackgroundcolor\"><a href=\"#winsetbackgroundcolorbackgroundcolor\"><code>win.setBackgroundColor(backgroundColor)</code></a></h4>\n<ul>\n<li><code>backgroundColor</code> String - Window's background color as a hexadecimal value,\nlike <code>#66CD00</code> or <code>#FFF</code> or <code>#80FFFFFF</code> (alpha is supported if <code>transparent</code>\nis <code>true</code>). Default is <code>#FFF</code> (white).</li>\n</ul>\n<p>Sets the background color of the window. See <a href=\"#setting-backgroundcolor\">Setting\n<code>backgroundColor</code></a>.</p>\n<h4 id=\"winpreviewfilepath-displayname-macos\"><a href=\"#winpreviewfilepath-displayname-macos\"><code>win.previewFile(path[, displayName])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>path</code> String - The absolute path to the file to preview with QuickLook. This\nis important as Quick Look uses the file name and file extension on the path\nto determine the content type of the file to open.</li>\n<li><code>displayName</code> String (optional) - The name of the file to display on the\nQuick Look modal view. This is purely visual and does not affect the content\ntype of the file. Defaults to <code>path</code>.</li>\n</ul>\n<p>Uses <a href=\"https://en.wikipedia.org/wiki/Quick_Look\">Quick Look</a> to preview a file at a given path.</p>\n<h4 id=\"winclosefilepreview-macos\"><a href=\"#winclosefilepreview-macos\"><code>win.closeFilePreview()</code> <em>macOS</em></a></h4>\n<p>Closes the currently open <a href=\"https://en.wikipedia.org/wiki/Quick_Look\">Quick Look</a> panel.</p>\n<h4 id=\"winsetboundsbounds-animate\"><a href=\"#winsetboundsbounds-animate\"><code>win.setBounds(bounds[, animate])</code></a></h4>\n<ul>\n<li><code>bounds</code> Partial&#x3C;<a href=\"/docs/api/structures/rectangle\">Rectangle</a>></li>\n<li><code>animate</code> Boolean (optional) <em>macOS</em></li>\n</ul>\n<p>Resizes and moves the window to the supplied bounds. Any properties that are not supplied will default to their current values.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-comment\">// set all bounds properties</span>\nwin.setBounds({ <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">440</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">225</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-comment\">// set a single bounds property</span>\nwin.setBounds({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">100</span> })\n\n<span class=\"hljs-comment\">// { x: 440, y: 225, width: 100, height: 600 }</span>\n<span class=\"hljs-built_in\">console</span>.log(win.getBounds())\n</code></pre>\n<h4 id=\"wingetbounds\"><a href=\"#wingetbounds\"><code>win.getBounds()</code></a></h4>\n<p>Returns <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - The <code>bounds</code> of the window as <code>Object</code>.</p>\n<h4 id=\"wingetbackgroundcolor\"><a href=\"#wingetbackgroundcolor\"><code>win.getBackgroundColor()</code></a></h4>\n<p>Returns <code>String</code> - Gets the background color of the window. See <a href=\"#setting-backgroundcolor\">Setting\n<code>backgroundColor</code></a>.</p>\n<h4 id=\"winsetcontentboundsbounds-animate\"><a href=\"#winsetcontentboundsbounds-animate\"><code>win.setContentBounds(bounds[, animate])</code></a></h4>\n<ul>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n<li><code>animate</code> Boolean (optional) <em>macOS</em></li>\n</ul>\n<p>Resizes and moves the window's client area (e.g. the web page) to\nthe supplied bounds.</p>\n<h4 id=\"wingetcontentbounds\"><a href=\"#wingetcontentbounds\"><code>win.getContentBounds()</code></a></h4>\n<p>Returns <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - The <code>bounds</code> of the window's client area as <code>Object</code>.</p>\n<h4 id=\"wingetnormalbounds\"><a href=\"#wingetnormalbounds\"><code>win.getNormalBounds()</code></a></h4>\n<p>Returns <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - Contains the window bounds of the normal state</p>\n<p><strong>Note:</strong> whatever the current state of the window : maximized, minimized or in fullscreen, this function always returns the position and size of the window in normal state. In normal state, getBounds and getNormalBounds returns the same <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a>.</p>\n<h4 id=\"winsetenabledenable\"><a href=\"#winsetenabledenable\"><code>win.setEnabled(enable)</code></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Disable or enable the window.</p>\n<h4 id=\"winisenabled\"><a href=\"#winisenabled\"><code>win.isEnabled()</code></a></h4>\n<p>Returns <code>Boolean</code> - whether the window is enabled.</p>\n<h4 id=\"winsetsizewidth-height-animate\"><a href=\"#winsetsizewidth-height-animate\"><code>win.setSize(width, height[, animate])</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>animate</code> Boolean (optional) <em>macOS</em></li>\n</ul>\n<p>Resizes the window to <code>width</code> and <code>height</code>. If <code>width</code> or <code>height</code> are below any set minimum size constraints the window will snap to its minimum size.</p>\n<h4 id=\"wingetsize\"><a href=\"#wingetsize\"><code>win.getSize()</code></a></h4>\n<p>Returns <code>Integer[]</code> - Contains the window's width and height.</p>\n<h4 id=\"winsetcontentsizewidth-height-animate\"><a href=\"#winsetcontentsizewidth-height-animate\"><code>win.setContentSize(width, height[, animate])</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>animate</code> Boolean (optional) <em>macOS</em></li>\n</ul>\n<p>Resizes the window's client area (e.g. the web page) to <code>width</code> and <code>height</code>.</p>\n<h4 id=\"wingetcontentsize\"><a href=\"#wingetcontentsize\"><code>win.getContentSize()</code></a></h4>\n<p>Returns <code>Integer[]</code> - Contains the window's client area's width and height.</p>\n<h4 id=\"winsetminimumsizewidth-height\"><a href=\"#winsetminimumsizewidth-height\"><code>win.setMinimumSize(width, height)</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n</ul>\n<p>Sets the minimum size of window to <code>width</code> and <code>height</code>.</p>\n<h4 id=\"wingetminimumsize\"><a href=\"#wingetminimumsize\"><code>win.getMinimumSize()</code></a></h4>\n<p>Returns <code>Integer[]</code> - Contains the window's minimum width and height.</p>\n<h4 id=\"winsetmaximumsizewidth-height\"><a href=\"#winsetmaximumsizewidth-height\"><code>win.setMaximumSize(width, height)</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n</ul>\n<p>Sets the maximum size of window to <code>width</code> and <code>height</code>.</p>\n<h4 id=\"wingetmaximumsize\"><a href=\"#wingetmaximumsize\"><code>win.getMaximumSize()</code></a></h4>\n<p>Returns <code>Integer[]</code> - Contains the window's maximum width and height.</p>\n<h4 id=\"winsetresizableresizable\"><a href=\"#winsetresizableresizable\"><code>win.setResizable(resizable)</code></a></h4>\n<ul>\n<li><code>resizable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually resized by the user.</p>\n<h4 id=\"winisresizable\"><a href=\"#winisresizable\"><code>win.isResizable()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be manually resized by the user.</p>\n<h4 id=\"winsetmovablemovable-macos-windows\"><a href=\"#winsetmovablemovable-macos-windows\"><code>win.setMovable(movable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>movable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be moved by user. On Linux does nothing.</p>\n<h4 id=\"winismovable-macos-windows\"><a href=\"#winismovable-macos-windows\"><code>win.isMovable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be moved by user.</p>\n<p>On Linux always returns <code>true</code>.</p>\n<h4 id=\"winsetminimizableminimizable-macos-windows\"><a href=\"#winsetminimizableminimizable-macos-windows\"><code>win.setMinimizable(minimizable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>minimizable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually minimized by user. On Linux does nothing.</p>\n<h4 id=\"winisminimizable-macos-windows\"><a href=\"#winisminimizable-macos-windows\"><code>win.isMinimizable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be manually minimized by the user.</p>\n<p>On Linux always returns <code>true</code>.</p>\n<h4 id=\"winsetmaximizablemaximizable-macos-windows\"><a href=\"#winsetmaximizablemaximizable-macos-windows\"><code>win.setMaximizable(maximizable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>maximizable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually maximized by user. On Linux does nothing.</p>\n<h4 id=\"winismaximizable-macos-windows\"><a href=\"#winismaximizable-macos-windows\"><code>win.isMaximizable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be manually maximized by user.</p>\n<p>On Linux always returns <code>true</code>.</p>\n<h4 id=\"winsetfullscreenablefullscreenable\"><a href=\"#winsetfullscreenablefullscreenable\"><code>win.setFullScreenable(fullscreenable)</code></a></h4>\n<ul>\n<li><code>fullscreenable</code> Boolean</li>\n</ul>\n<p>Sets whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.</p>\n<h4 id=\"winisfullscreenable\"><a href=\"#winisfullscreenable\"><code>win.isFullScreenable()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.</p>\n<h4 id=\"winsetclosableclosable-macos-windows\"><a href=\"#winsetclosableclosable-macos-windows\"><code>win.setClosable(closable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>closable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually closed by user. On Linux does nothing.</p>\n<h4 id=\"winisclosable-macos-windows\"><a href=\"#winisclosable-macos-windows\"><code>win.isClosable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be manually closed by user.</p>\n<p>On Linux always returns <code>true</code>.</p>\n<h4 id=\"winsetalwaysontopflag-level-relativelevel\"><a href=\"#winsetalwaysontopflag-level-relativelevel\"><code>win.setAlwaysOnTop(flag[, level][, relativeLevel])</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n<li><code>level</code> String (optional) <em>macOS</em> <em>Windows</em> - Values include <code>normal</code>,\n<code>floating</code>, <code>torn-off-menu</code>, <code>modal-panel</code>, <code>main-menu</code>, <code>status</code>,\n<code>pop-up-menu</code>, <code>screen-saver</code>, and <del><code>dock</code></del> (Deprecated). The default is\n<code>floating</code> when <code>flag</code> is true. The <code>level</code> is reset to <code>normal</code> when the\nflag is false. Note that from <code>floating</code> to <code>status</code> included, the window is\nplaced below the Dock on macOS and below the taskbar on Windows. From\n<code>pop-up-menu</code> to a higher it is shown above the Dock on macOS and above the\ntaskbar on Windows. See the <a href=\"https://developer.apple.com/documentation/appkit/nswindow/level\">macOS docs</a> for more details.</li>\n<li><code>relativeLevel</code> Integer (optional) <em>macOS</em> - The number of layers higher to set\nthis window relative to the given <code>level</code>. The default is <code>0</code>. Note that Apple\ndiscourages setting levels higher than 1 above <code>screen-saver</code>.</li>\n</ul>\n<p>Sets whether the window should show always on top of other windows. After\nsetting this, the window is still a normal window, not a toolbox window which\ncan not be focused on.</p>\n<h4 id=\"winisalwaysontop\"><a href=\"#winisalwaysontop\"><code>win.isAlwaysOnTop()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is always on top of other windows.</p>\n<h4 id=\"winmoveabovemediasourceid\"><a href=\"#winmoveabovemediasourceid\"><code>win.moveAbove(mediaSourceId)</code></a></h4>\n<ul>\n<li><code>mediaSourceId</code> String - Window id in the format of DesktopCapturerSource's id. For example \"window:1869:0\".</li>\n</ul>\n<p>Moves window above the source window in the sense of z-order. If the\n<code>mediaSourceId</code> is not of type window or if the window does not exist then\nthis method throws an error.</p>\n<h4 id=\"winmovetop\"><a href=\"#winmovetop\"><code>win.moveTop()</code></a></h4>\n<p>Moves window to top(z-order) regardless of focus</p>\n<h4 id=\"wincenter\"><a href=\"#wincenter\"><code>win.center()</code></a></h4>\n<p>Moves window to the center of the screen.</p>\n<h4 id=\"winsetpositionx-y-animate\"><a href=\"#winsetpositionx-y-animate\"><code>win.setPosition(x, y[, animate])</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n<li><code>animate</code> Boolean (optional) <em>macOS</em></li>\n</ul>\n<p>Moves window to <code>x</code> and <code>y</code>.</p>\n<h4 id=\"wingetposition\"><a href=\"#wingetposition\"><code>win.getPosition()</code></a></h4>\n<p>Returns <code>Integer[]</code> - Contains the window's current position.</p>\n<h4 id=\"winsettitletitle\"><a href=\"#winsettitletitle\"><code>win.setTitle(title)</code></a></h4>\n<ul>\n<li><code>title</code> String</li>\n</ul>\n<p>Changes the title of native window to <code>title</code>.</p>\n<h4 id=\"wingettitle\"><a href=\"#wingettitle\"><code>win.getTitle()</code></a></h4>\n<p>Returns <code>String</code> - The title of the native window.</p>\n<p><strong>Note:</strong> The title of the web page can be different from the title of the native\nwindow.</p>\n<h4 id=\"winsetsheetoffsetoffsety-offsetx-macos\"><a href=\"#winsetsheetoffsetoffsety-offsetx-macos\"><code>win.setSheetOffset(offsetY[, offsetX])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>offsetY</code> Float</li>\n<li><code>offsetX</code> Float (optional)</li>\n</ul>\n<p>Changes the attachment point for sheets on macOS. By default, sheets are\nattached just below the window frame, but you may want to display them beneath\na HTML-rendered toolbar. For example:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-keyword\">const</span> toolbarRect = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'toolbar'</span>).getBoundingClientRect()\nwin.setSheetOffset(toolbarRect.height)\n</code></pre>\n<h4 id=\"winflashframeflag\"><a href=\"#winflashframeflag\"><code>win.flashFrame(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Starts or stops flashing the window to attract user's attention.</p>\n<h4 id=\"winsetskiptaskbarskip\"><a href=\"#winsetskiptaskbarskip\"><code>win.setSkipTaskbar(skip)</code></a></h4>\n<ul>\n<li><code>skip</code> Boolean</li>\n</ul>\n<p>Makes the window not show in the taskbar.</p>\n<h4 id=\"winsetkioskflag\"><a href=\"#winsetkioskflag\"><code>win.setKiosk(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Enters or leaves kiosk mode.</p>\n<h4 id=\"winiskiosk\"><a href=\"#winiskiosk\"><code>win.isKiosk()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in kiosk mode.</p>\n<h4 id=\"winistabletmode-windows\"><a href=\"#winistabletmode-windows\"><code>win.isTabletMode()</code> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in Windows 10 tablet mode.</p>\n<p>Since Windows 10 users can <a href=\"https://support.microsoft.com/en-us/help/17210/windows-10-use-your-pc-like-a-tablet\">use their PC as tablet</a>,\nunder this mode apps can choose to optimize their UI for tablets, such as\nenlarging the titlebar and hiding titlebar buttons.</p>\n<p>This API returns whether the window is in tablet mode, and the <code>resize</code> event\ncan be be used to listen to changes to tablet mode.</p>\n<h4 id=\"wingetmediasourceid\"><a href=\"#wingetmediasourceid\"><code>win.getMediaSourceId()</code></a></h4>\n<p>Returns <code>String</code> - Window id in the format of DesktopCapturerSource's id. For example \"window:1324:0\".</p>\n<p>More precisely the format is <code>window:id:other_id</code> where <code>id</code> is <code>HWND</code> on\nWindows, <code>CGWindowID</code> (<code>uint64_t</code>) on macOS and <code>Window</code> (<code>unsigned long</code>) on\nLinux. <code>other_id</code> is used to identify web contents (tabs) so within the same\ntop level window.</p>\n<h4 id=\"wingetnativewindowhandle\"><a href=\"#wingetnativewindowhandle\"><code>win.getNativeWindowHandle()</code></a></h4>\n<p>Returns <code>Buffer</code> - The platform-specific handle of the window.</p>\n<p>The native type of the handle is <code>HWND</code> on Windows, <code>NSView*</code> on macOS, and\n<code>Window</code> (<code>unsigned long</code>) on Linux.</p>\n<h4 id=\"winhookwindowmessagemessage-callback-windows\"><a href=\"#winhookwindowmessagemessage-callback-windows\"><code>win.hookWindowMessage(message, callback)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n<li><code>callback</code> Function<ul>\n<li><code>wParam</code> any - The <code>wParam</code> provided to the WndProc</li>\n<li><code>lParam</code> any - The <code>lParam</code> provided to the WndProc</li>\n</ul></li>\n</ul>\n<p>Hooks a windows message. The <code>callback</code> is called when\nthe message is received in the WndProc.</p>\n<h4 id=\"winiswindowmessagehookedmessage-windows\"><a href=\"#winiswindowmessagehookedmessage-windows\"><code>win.isWindowMessageHooked(message)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n</ul>\n<p>Returns <code>Boolean</code> - <code>true</code> or <code>false</code> depending on whether the message is hooked.</p>\n<h4 id=\"winunhookwindowmessagemessage-windows\"><a href=\"#winunhookwindowmessagemessage-windows\"><code>win.unhookWindowMessage(message)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n</ul>\n<p>Unhook the window message.</p>\n<h4 id=\"winunhookallwindowmessages-windows\"><a href=\"#winunhookallwindowmessages-windows\"><code>win.unhookAllWindowMessages()</code> <em>Windows</em></a></h4>\n<p>Unhooks all of the window messages.</p>\n<h4 id=\"winsetrepresentedfilenamefilename-macos\"><a href=\"#winsetrepresentedfilenamefilename-macos\"><code>win.setRepresentedFilename(filename)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>filename</code> String</li>\n</ul>\n<p>Sets the pathname of the file the window represents, and the icon of the file\nwill show in window's title bar.</p>\n<h4 id=\"wingetrepresentedfilename-macos\"><a href=\"#wingetrepresentedfilename-macos\"><code>win.getRepresentedFilename()</code> <em>macOS</em></a></h4>\n<p>Returns <code>String</code> - The pathname of the file the window represents.</p>\n<h4 id=\"winsetdocumenteditededited-macos\"><a href=\"#winsetdocumenteditededited-macos\"><code>win.setDocumentEdited(edited)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>edited</code> Boolean</li>\n</ul>\n<p>Specifies whether the window’s document has been edited, and the icon in title\nbar will become gray when set to <code>true</code>.</p>\n<h4 id=\"winisdocumentedited-macos\"><a href=\"#winisdocumentedited-macos\"><code>win.isDocumentEdited()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window's document has been edited.</p>\n<h4 id=\"winfocusonwebview\"><a href=\"#winfocusonwebview\"><code>win.focusOnWebView()</code></a></h4>\n<h4 id=\"winblurwebview\"><a href=\"#winblurwebview\"><code>win.blurWebView()</code></a></h4>\n<h4 id=\"wincapturepagerect\"><a href=\"#wincapturepagerect\"><code>win.capturePage([rect])</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (optional) - The bounds to capture</li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - Resolves with a <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Captures a snapshot of the page within <code>rect</code>. Omitting <code>rect</code> will capture the whole visible page. If the page is not visible, <code>rect</code> may be empty.</p>\n<h4 id=\"winloadurlurl-options\"><a href=\"#winloadurlurl-options\"><code>win.loadURL(url[, options])</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (optional) - An HTTP Referrer URL.</li>\n<li><code>userAgent</code> String (optional) - A user agent originating the request.</li>\n<li><code>extraHeaders</code> String (optional) - Extra headers separated by \"\\n\"</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (optional) - Base URL (with trailing path separator) for files to be loaded by the data URL. This is needed only if the specified <code>url</code> is a data URL and needs to load other files.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - the promise will resolve when the page has finished loading\n(see <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects\nif the page fails to load (see <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Same as <a href=\"/docs/api/web-contents#contentsloadurlurl-options\"><code>webContents.loadURL(url[, options])</code></a>.</p>\n<p>The <code>url</code> can be a remote address (e.g. <code>http://</code>) or a path to a local\nHTML file using the <code>file://</code> protocol.</p>\n<p>To ensure that file URLs are properly formatted, it is recommended to use\nNode's <a href=\"https://nodejs.org/api/url.html#url_url_format_urlobject\"><code>url.format</code></a>\nmethod:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>).format({\n  <span class=\"hljs-attr\">protocol</span>: <span class=\"hljs-string\">'file'</span>,\n  <span class=\"hljs-attr\">slashes</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">pathname</span>: <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>).join(__dirname, <span class=\"hljs-string\">'index.html'</span>)\n})\n\nwin.loadURL(url)\n</code></pre>\n<p>You can load a URL using a <code>POST</code> request with URL-encoded data by doing\nthe following:</p>\n<pre><code class=\"hljs language-javascript\">win.loadURL(<span class=\"hljs-string\">'http://localhost:8000/post'</span>, {\n  <span class=\"hljs-attr\">postData</span>: [{\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'rawData'</span>,\n    <span class=\"hljs-attr\">bytes</span>: Buffer.from(<span class=\"hljs-string\">'hello=world'</span>)\n  }],\n  <span class=\"hljs-attr\">extraHeaders</span>: <span class=\"hljs-string\">'Content-Type: application/x-www-form-urlencoded'</span>\n})\n</code></pre>\n<h4 id=\"winloadfilefilepath-options\"><a href=\"#winloadfilefilepath-options\"><code>win.loadFile(filePath[, options])</code></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>query</code> Record&#x3C;String, String> (optional) - Passed to <code>url.format()</code>.</li>\n<li><code>search</code> String (optional) - Passed to <code>url.format()</code>.</li>\n<li><code>hash</code> String (optional) - Passed to <code>url.format()</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - the promise will resolve when the page has finished loading\n(see <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects\nif the page fails to load (see <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Same as <code>webContents.loadFile</code>, <code>filePath</code> should be a path to an HTML\nfile relative to the root of your application.  See the <code>webContents</code> docs\nfor more information.</p>\n<h4 id=\"winreload\"><a href=\"#winreload\"><code>win.reload()</code></a></h4>\n<p>Same as <code>webContents.reload</code>.</p>\n<h4 id=\"winsetmenumenu-linux-windows\"><a href=\"#winsetmenumenu-linux-windows\"><code>win.setMenu(menu)</code> <em>Linux</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Sets the <code>menu</code> as the window's menu bar.</p>\n<h4 id=\"winremovemenu-linux-windows\"><a href=\"#winremovemenu-linux-windows\"><code>win.removeMenu()</code> <em>Linux</em> <em>Windows</em></a></h4>\n<p>Remove the window's menu bar.</p>\n<h4 id=\"winsetprogressbarprogress-options\"><a href=\"#winsetprogressbarprogress-options\"><code>win.setProgressBar(progress[, options])</code></a></h4>\n<ul>\n<li><code>progress</code> Double</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>mode</code> String <em>Windows</em> - Mode for the progress bar. Can be <code>none</code>, <code>normal</code>, <code>indeterminate</code>, <code>error</code> or <code>paused</code>.</li>\n</ul></li>\n</ul>\n<p>Sets progress value in progress bar. Valid range is [0, 1.0].</p>\n<p>Remove progress bar when progress &#x3C; 0;\nChange to indeterminate mode when progress > 1.</p>\n<p>On Linux platform, only supports Unity desktop environment, you need to specify\nthe <code>*.desktop</code> file name to <code>desktopName</code> field in <code>package.json</code>. By default,\nit will assume <code>{app.name}.desktop</code>.</p>\n<p>On Windows, a mode can be passed. Accepted values are <code>none</code>, <code>normal</code>,\n<code>indeterminate</code>, <code>error</code>, and <code>paused</code>. If you call <code>setProgressBar</code> without a\nmode set (but with a value within the valid range), <code>normal</code> will be assumed.</p>\n<h4 id=\"winsetoverlayiconoverlay-description-windows\"><a href=\"#winsetoverlayiconoverlay-description-windows\"><code>win.setOverlayIcon(overlay, description)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>overlay</code> <a href=\"/docs/api/native-image\">NativeImage</a> | null - the icon to display on the bottom\nright corner of the taskbar icon. If this parameter is <code>null</code>, the overlay is\ncleared</li>\n<li><code>description</code> String - a description that will be provided to Accessibility\nscreen readers</li>\n</ul>\n<p>Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to\nconvey some sort of application status or to passively notify the user.</p>\n<h4 id=\"winsethasshadowhasshadow\"><a href=\"#winsethasshadowhasshadow\"><code>win.setHasShadow(hasShadow)</code></a></h4>\n<ul>\n<li><code>hasShadow</code> Boolean</li>\n</ul>\n<p>Sets whether the window should have a shadow.</p>\n<h4 id=\"winhasshadow\"><a href=\"#winhasshadow\"><code>win.hasShadow()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window has a shadow.</p>\n<h4 id=\"winsetopacityopacity-windows-macos\"><a href=\"#winsetopacityopacity-windows-macos\"><code>win.setOpacity(opacity)</code> <em>Windows</em> <em>macOS</em></a></h4>\n<ul>\n<li><code>opacity</code> Number - between 0.0 (fully transparent) and 1.0 (fully opaque)</li>\n</ul>\n<p>Sets the opacity of the window. On Linux, does nothing. Out of bound number\nvalues are clamped to the [0, 1] range.</p>\n<h4 id=\"wingetopacity\"><a href=\"#wingetopacity\"><code>win.getOpacity()</code></a></h4>\n<p>Returns <code>Number</code> - between 0.0 (fully transparent) and 1.0 (fully opaque). On\nLinux, always returns 1.</p>\n<h4 id=\"winsetshaperects-windows-linux-experimental\"><a href=\"#winsetshaperects-windows-linux-experimental\"><code>win.setShape(rects)</code> <em>Windows</em> <em>Linux</em> <em>Experimental</em></a></h4>\n<ul>\n<li><code>rects</code> <a href=\"/docs/api/structures/rectangle\">Rectangle[]</a> - Sets a shape on the window.\nPassing an empty list reverts the window to being rectangular.</li>\n</ul>\n<p>Setting a window shape determines the area within the window where the system\npermits drawing and user interaction. Outside of the given region, no pixels\nwill be drawn and no mouse events will be registered. Mouse events outside of\nthe region will not be received by that window, but will fall through to\nwhatever is behind the window.</p>\n<h4 id=\"winsetthumbarbuttonsbuttons-windows\"><a href=\"#winsetthumbarbuttonsbuttons-windows\"><code>win.setThumbarButtons(buttons)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>buttons</code> <a href=\"/docs/api/structures/thumbar-button\">ThumbarButton[]</a></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the buttons were added successfully</p>\n<p>Add a thumbnail toolbar with a specified set of buttons to the thumbnail image\nof a window in a taskbar button layout. Returns a <code>Boolean</code> object indicates\nwhether the thumbnail has been added successfully.</p>\n<p>The number of buttons in thumbnail toolbar should be no greater than 7 due to\nthe limited room. Once you setup the thumbnail toolbar, the toolbar cannot be\nremoved due to the platform's limitation. But you can call the API with an empty\narray to clean the buttons.</p>\n<p>The <code>buttons</code> is an array of <code>Button</code> objects:</p>\n<ul>\n<li><code>Button</code> Object<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - The icon showing in thumbnail\ntoolbar.</li>\n<li><code>click</code> Function</li>\n<li><code>tooltip</code> String (optional) - The text of the button's tooltip.</li>\n<li><code>flags</code> String<a href=\"/docs/api/optional\"></a> - Control specific states and behaviors of the\nbutton. By default, it is <code>['enabled']</code>.</li>\n</ul></li>\n</ul>\n<p>The <code>flags</code> is an array that can include following <code>String</code>s:</p>\n<ul>\n<li><code>enabled</code> - The button is active and available to the user.</li>\n<li><code>disabled</code> - The button is disabled. It is present, but has a visual state\nindicating it will not respond to user action.</li>\n<li><code>dismissonclick</code> - When the button is clicked, the thumbnail window closes\nimmediately.</li>\n<li><code>nobackground</code> - Do not draw a button border, use only the image.</li>\n<li><code>hidden</code> - The button is not shown to the user.</li>\n<li><code>noninteractive</code> - The button is enabled but not interactive; no pressed\nbutton state is drawn. This value is intended for instances where the button\nis used in a notification.</li>\n</ul>\n<h4 id=\"winsetthumbnailclipregion-windows\"><a href=\"#winsetthumbnailclipregion-windows\"><code>win.setThumbnailClip(region)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>region</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Region of the window</li>\n</ul>\n<p>Sets the region of the window to show as the thumbnail image displayed when\nhovering over the window in the taskbar. You can reset the thumbnail to be\nthe entire window by specifying an empty region:\n<code>{ x: 0, y: 0, width: 0, height: 0 }</code>.</p>\n<h4 id=\"winsetthumbnailtooltiptooltip-windows\"><a href=\"#winsetthumbnailtooltiptooltip-windows\"><code>win.setThumbnailToolTip(toolTip)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>toolTip</code> String</li>\n</ul>\n<p>Sets the toolTip that is displayed when hovering over the window thumbnail\nin the taskbar.</p>\n<h4 id=\"winsetappdetailsoptions-windows\"><a href=\"#winsetappdetailsoptions-windows\"><code>win.setAppDetails(options)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>appId</code> String (optional) - Window's <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391569(v=vs.85).aspx\">App User Model ID</a>.\nIt has to be set, otherwise the other options will have no effect.</li>\n<li><code>appIconPath</code> String (optional) - Window's <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391573(v=vs.85).aspx\">Relaunch Icon</a>.</li>\n<li><code>appIconIndex</code> Integer (optional) - Index of the icon in <code>appIconPath</code>.\nIgnored when <code>appIconPath</code> is not set. Default is <code>0</code>.</li>\n<li><code>relaunchCommand</code> String (optional) - Window's <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391571(v=vs.85).aspx\">Relaunch Command</a>.</li>\n<li><code>relaunchDisplayName</code> String (optional) - Window's <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391572(v=vs.85).aspx\">Relaunch Display Name</a>.</li>\n</ul></li>\n</ul>\n<p>Sets the properties for the window's taskbar button.</p>\n<p><strong>Note:</strong> <code>relaunchCommand</code> and <code>relaunchDisplayName</code> must always be set\ntogether. If one of those properties is not set, then neither will be used.</p>\n<h4 id=\"winshowdefinitionforselection-macos\"><a href=\"#winshowdefinitionforselection-macos\"><code>win.showDefinitionForSelection()</code> <em>macOS</em></a></h4>\n<p>Same as <code>webContents.showDefinitionForSelection()</code>.</p>\n<h4 id=\"winseticonicon-windows-linux\"><a href=\"#winseticonicon-windows-linux\"><code>win.setIcon(icon)</code> <em>Windows</em> <em>Linux</em></a></h4>\n<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String</li>\n</ul>\n<p>Changes window icon.</p>\n<h4 id=\"winsetwindowbuttonvisibilityvisible-macos\"><a href=\"#winsetwindowbuttonvisibilityvisible-macos\"><code>win.setWindowButtonVisibility(visible)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n</ul>\n<p>Sets whether the window traffic light buttons should be visible.</p>\n<h4 id=\"winsetautohidemenubarhide\"><a href=\"#winsetautohidemenubarhide\"><code>win.setAutoHideMenuBar(hide)</code></a></h4>\n<ul>\n<li><code>hide</code> Boolean</li>\n</ul>\n<p>Sets whether the window menu bar should hide itself automatically. Once set the\nmenu bar will only show when users press the single <code>Alt</code> key.</p>\n<p>If the menu bar is already visible, calling <code>setAutoHideMenuBar(true)</code> won't hide it immediately.</p>\n<h4 id=\"winismenubarautohide\"><a href=\"#winismenubarautohide\"><code>win.isMenuBarAutoHide()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether menu bar automatically hides itself.</p>\n<h4 id=\"winsetmenubarvisibilityvisible-windows-linux\"><a href=\"#winsetmenubarvisibilityvisible-windows-linux\"><code>win.setMenuBarVisibility(visible)</code> <em>Windows</em> <em>Linux</em></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n</ul>\n<p>Sets whether the menu bar should be visible. If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single <code>Alt</code> key.</p>\n<h4 id=\"winismenubarvisible\"><a href=\"#winismenubarvisible\"><code>win.isMenuBarVisible()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the menu bar is visible.</p>\n<h4 id=\"winsetvisibleonallworkspacesvisible-options\"><a href=\"#winsetvisibleonallworkspacesvisible-options\"><code>win.setVisibleOnAllWorkspaces(visible[, options])</code></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>visibleOnFullScreen</code> Boolean (optional) <em>macOS</em> - Sets whether\nthe window should be visible above fullscreen windows.</li>\n<li><code>skipTransformProcessType</code> Boolean (optional) <em>macOS</em> - Calling\nsetVisibleOnAllWorkspaces will by default transform the process\ntype between UIElementApplication and ForegroundApplication to\nensure the correct behavior. However, this will hide the window\nand dock for a short time every time it is called. If your window\nis already of type UIElementApplication, you can bypass this\ntransformation by passing true to skipTransformProcessType.</li>\n</ul></li>\n</ul>\n<p>Sets whether the window should be visible on all workspaces.</p>\n<p><strong>Note:</strong> This API does nothing on Windows.</p>\n<h4 id=\"winisvisibleonallworkspaces\"><a href=\"#winisvisibleonallworkspaces\"><code>win.isVisibleOnAllWorkspaces()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is visible on all workspaces.</p>\n<p><strong>Note:</strong> This API always returns false on Windows.</p>\n<h4 id=\"winsetignoremouseeventsignore-options\"><a href=\"#winsetignoremouseeventsignore-options\"><code>win.setIgnoreMouseEvents(ignore[, options])</code></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>forward</code> Boolean (optional) <em>macOS</em> <em>Windows</em> - If true, forwards mouse move\nmessages to Chromium, enabling mouse related events such as <code>mouseleave</code>.\nOnly used when <code>ignore</code> is true. If <code>ignore</code> is false, forwarding is always\ndisabled regardless of this value.</li>\n</ul></li>\n</ul>\n<p>Makes the window ignore all mouse events.</p>\n<p>All mouse events happened in this window will be passed to the window below\nthis window, but if this window has focus, it will still receive keyboard\nevents.</p>\n<h4 id=\"winsetcontentprotectionenable-macos-windows\"><a href=\"#winsetcontentprotectionenable-macos-windows\"><code>win.setContentProtection(enable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Prevents the window contents from being captured by other apps.</p>\n<p>On macOS it sets the NSWindow's sharingType to NSWindowSharingNone.\nOn Windows it calls SetWindowDisplayAffinity with <code>WDA_EXCLUDEFROMCAPTURE</code>.\nFor Windows 10 version 2004 and up the window will be removed from capture entirely,\nolder Windows versions behave as if <code>WDA_MONITOR</code> is applied capturing a black window.</p>\n<h4 id=\"winsetfocusablefocusable-macos-windows\"><a href=\"#winsetfocusablefocusable-macos-windows\"><code>win.setFocusable(focusable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>focusable</code> Boolean</li>\n</ul>\n<p>Changes whether the window can be focused.</p>\n<p>On macOS it does not remove the focus from the window.</p>\n<h4 id=\"winisfocusable-macos-windows\"><a href=\"#winisfocusable-macos-windows\"><code>win.isFocusable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns whether the window can be focused.</p>\n<h4 id=\"winsetparentwindowparent\"><a href=\"#winsetparentwindowparent\"><code>win.setParentWindow(parent)</code></a></h4>\n<ul>\n<li><code>parent</code> BrowserWindow | null</li>\n</ul>\n<p>Sets <code>parent</code> as current window's parent window, passing <code>null</code> will turn\ncurrent window into a top-level window.</p>\n<h4 id=\"wingetparentwindow\"><a href=\"#wingetparentwindow\"><code>win.getParentWindow()</code></a></h4>\n<p>Returns <code>BrowserWindow</code> - The parent window.</p>\n<h4 id=\"wingetchildwindows\"><a href=\"#wingetchildwindows\"><code>win.getChildWindows()</code></a></h4>\n<p>Returns <code>BrowserWindow[]</code> - All child windows.</p>\n<h4 id=\"winsetautohidecursorautohide-macos\"><a href=\"#winsetautohidecursorautohide-macos\"><code>win.setAutoHideCursor(autoHide)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>autoHide</code> Boolean</li>\n</ul>\n<p>Controls whether to hide cursor when typing.</p>\n<h4 id=\"winselectprevioustab-macos\"><a href=\"#winselectprevioustab-macos\"><code>win.selectPreviousTab()</code> <em>macOS</em></a></h4>\n<p>Selects the previous tab when native tabs are enabled and there are other\ntabs in the window.</p>\n<h4 id=\"winselectnexttab-macos\"><a href=\"#winselectnexttab-macos\"><code>win.selectNextTab()</code> <em>macOS</em></a></h4>\n<p>Selects the next tab when native tabs are enabled and there are other\ntabs in the window.</p>\n<h4 id=\"winmergeallwindows-macos\"><a href=\"#winmergeallwindows-macos\"><code>win.mergeAllWindows()</code> <em>macOS</em></a></h4>\n<p>Merges all windows into one window with multiple tabs when native tabs\nare enabled and there is more than one open window.</p>\n<h4 id=\"winmovetabtonewwindow-macos\"><a href=\"#winmovetabtonewwindow-macos\"><code>win.moveTabToNewWindow()</code> <em>macOS</em></a></h4>\n<p>Moves the current tab into a new window if native tabs are enabled and\nthere is more than one tab in the current window.</p>\n<h4 id=\"wintoggletabbar-macos\"><a href=\"#wintoggletabbar-macos\"><code>win.toggleTabBar()</code> <em>macOS</em></a></h4>\n<p>Toggles the visibility of the tab bar if native tabs are enabled and\nthere is only one tab in the current window.</p>\n<h4 id=\"winaddtabbedwindowbrowserwindow-macos\"><a href=\"#winaddtabbedwindowbrowserwindow-macos\"><code>win.addTabbedWindow(browserWindow)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>browserWindow</code> BrowserWindow</li>\n</ul>\n<p>Adds a window as a tab on this window, after the tab for the window instance.</p>\n<h4 id=\"winsetvibrancytype-macos\"><a href=\"#winsetvibrancytype-macos\"><code>win.setVibrancy(type)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>type</code> String | null - Can be <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>titlebar</code>,\n<code>selection</code>, <code>menu</code>, <code>popover</code>, <code>sidebar</code>, <code>medium-light</code>, <code>ultra-dark</code>, <code>header</code>, <code>sheet</code>, <code>window</code>, <code>hud</code>, <code>fullscreen-ui</code>, <code>tooltip</code>, <code>content</code>, <code>under-window</code>, or <code>under-page</code>. See\nthe <a href=\"https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc\">macOS documentation</a> for more details.</li>\n</ul>\n<p>Adds a vibrancy effect to the browser window. Passing <code>null</code> or an empty string\nwill remove the vibrancy effect on the window.</p>\n<p>Note that <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>medium-light</code>, and <code>ultra-dark</code> have been\ndeprecated and will be removed in an upcoming version of macOS.</p>\n<h4 id=\"winsettrafficlightpositionposition-macos\"><a href=\"#winsettrafficlightpositionposition-macos\"><code>win.setTrafficLightPosition(position)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Set a custom position for the traffic light buttons in frameless window.</p>\n<h4 id=\"wingettrafficlightposition-macos\"><a href=\"#wingettrafficlightposition-macos\"><code>win.getTrafficLightPosition()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Point</code> - The custom position for the traffic light buttons in\nframeless window.</p>\n<h4 id=\"winsettouchbartouchbar-macos\"><a href=\"#winsettouchbartouchbar-macos\"><code>win.setTouchBar(touchBar)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>touchBar</code> TouchBar | null</li>\n</ul>\n<p>Sets the touchBar layout for the current window. Specifying <code>null</code> or\n<code>undefined</code> clears the touch bar. This method only has an effect if the\nmachine has a touch bar and is running on macOS 10.12.1+.</p>\n<p><strong>Note:</strong> The TouchBar API is currently experimental and may change or be\nremoved in future Electron releases.</p>\n<h4 id=\"winsetbrowserviewbrowserview-experimental\"><a href=\"#winsetbrowserviewbrowserview-experimental\"><code>win.setBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a> | null - Attach <code>browserView</code> to <code>win</code>.\nIf there are other <code>BrowserView</code>s attached, they will be removed from\nthis window.</li>\n</ul>\n<h4 id=\"wingetbrowserview-experimental\"><a href=\"#wingetbrowserview-experimental\"><code>win.getBrowserView()</code> <em>Experimental</em></a></h4>\n<p>Returns <code>BrowserView | null</code> - The <code>BrowserView</code> attached to <code>win</code>. Returns <code>null</code>\nif one is not attached. Throws an error if multiple <code>BrowserView</code>s are attached.</p>\n<h4 id=\"winaddbrowserviewbrowserview-experimental\"><a href=\"#winaddbrowserviewbrowserview-experimental\"><code>win.addBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>Replacement API for setBrowserView supporting work with multi browser views.</p>\n<h4 id=\"winremovebrowserviewbrowserview-experimental\"><a href=\"#winremovebrowserviewbrowserview-experimental\"><code>win.removeBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<h4 id=\"winsettopbrowserviewbrowserview-experimental\"><a href=\"#winsettopbrowserviewbrowserview-experimental\"><code>win.setTopBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>Raises <code>browserView</code> above other <code>BrowserView</code>s attached to <code>win</code>.\nThrows an error if <code>browserView</code> is not attached to <code>win</code>.</p>\n<h4 id=\"wingetbrowserviews-experimental\"><a href=\"#wingetbrowserviews-experimental\"><code>win.getBrowserViews()</code> <em>Experimental</em></a></h4>\n<p>Returns <code>BrowserView[]</code> - an array of all BrowserViews that have been attached\nwith <code>addBrowserView</code> or <code>setBrowserView</code>.</p>\n<p><strong>Note:</strong> The BrowserView API is currently experimental and may change or be\nremoved in future Electron releases.</p>",
      "title": "BrowserWindow",
      "description": "Create and control browser windows."
    },
    "/docs/api/browser-window-proxy": {
      "locale": "en-US",
      "slug": "browser-window-proxy",
      "href": "/docs/api/browser-window-proxy",
      "crowdinFileId": "256285",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-window-proxy.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-browserwindowproxy\"><a href=\"#class-browserwindowproxy\">Class: BrowserWindowProxy</a></h2>\n<blockquote>\n<p>Manipulate the child browser window</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#renderer-process\">Renderer</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>The <code>BrowserWindowProxy</code> object is returned from <code>window.open</code> and provides\nlimited functionality with the child window.</p>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<p>The <code>BrowserWindowProxy</code> object has the following instance methods:</p>\n<h4 id=\"winblur\"><a href=\"#winblur\"><code>win.blur()</code></a></h4>\n<p>Removes focus from the child window.</p>\n<h4 id=\"winclose\"><a href=\"#winclose\"><code>win.close()</code></a></h4>\n<p>Forcefully closes the child window without calling its unload event.</p>\n<h4 id=\"winevalcode\"><a href=\"#winevalcode\"><code>win.eval(code)</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n</ul>\n<p>Evaluates the code in the child window.</p>\n<h4 id=\"winfocus\"><a href=\"#winfocus\"><code>win.focus()</code></a></h4>\n<p>Focuses the child window (brings the window to front).</p>\n<h4 id=\"winprint\"><a href=\"#winprint\"><code>win.print()</code></a></h4>\n<p>Invokes the print dialog on the child window.</p>\n<h4 id=\"winpostmessagemessage-targetorigin\"><a href=\"#winpostmessagemessage-targetorigin\"><code>win.postMessage(message, targetOrigin)</code></a></h4>\n<ul>\n<li><code>message</code> any</li>\n<li><code>targetOrigin</code> String</li>\n</ul>\n<p>Sends a message to the child window with the specified origin or <code>*</code> for no\norigin preference.</p>\n<p>In addition to these methods, the child window implements <code>window.opener</code> object\nwith no properties and a single method.</p>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<p>The <code>BrowserWindowProxy</code> object has the following instance properties:</p>\n<h4 id=\"winclosed\"><a href=\"#winclosed\"><code>win.closed</code></a></h4>\n<p>A <code>Boolean</code> that is set to true after the child window gets closed.</p>",
      "title": "BrowserWindowProxy",
      "description": "Manipulate the child browser window"
    },
    "/docs/development/build-instructions-gn": {
      "locale": "en-US",
      "slug": "build-instructions-gn",
      "href": "/docs/development/build-instructions-gn",
      "crowdinFileId": "256131",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-gn.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"build-instructions\"><a href=\"#build-instructions\">Build Instructions</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong>, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"platform-prerequisites\"><a href=\"#platform-prerequisites\">Platform prerequisites</a></h2>\n<p>Check the build prerequisites for your platform before proceeding</p>\n<ul>\n<li><a href=\"/docs/development/build-instructions-macos#prerequisites\">macOS</a></li>\n<li><a href=\"/docs/development/build-instructions-linux#prerequisites\">Linux</a></li>\n<li><a href=\"/docs/development/build-instructions-windows#prerequisites\">Windows</a></li>\n</ul>\n<h2 id=\"build-tools\"><a href=\"#build-tools\">Build Tools</a></h2>\n<p><a href=\"https://github.com/electron/build-tools\">Electron's Build Tools</a> automate much of the setup for compiling Electron from source with different configurations and build targets. If you wish to set up the environment manually, the instructions are listed below.</p>\n<h2 id=\"gn-prerequisites\"><a href=\"#gn-prerequisites\">GN prerequisites</a></h2>\n<p>You'll need to install <a href=\"https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up\"><code>depot_tools</code></a>, the toolset\nused for fetching Chromium and its dependencies.</p>\n<p>Also, on Windows, you'll need to set the environment variable\n<code>DEPOT_TOOLS_WIN_TOOLCHAIN=0</code>. To do so, open <code>Control Panel</code> → <code>System and Security</code> → <code>System</code> → <code>Advanced system settings</code> and add a system variable\n<code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> with value <code>0</code>.  This tells <code>depot_tools</code> to use\nyour locally installed version of Visual Studio (by default, <code>depot_tools</code> will\ntry to download a Google-internal version that only Googlers have access to).</p>\n<h3 id=\"setting-up-the-git-cache\"><a href=\"#setting-up-the-git-cache\">Setting up the git cache</a></h3>\n<p>If you plan on checking out Electron more than once (for example, to have\nmultiple parallel directories checked out to different branches), using the git\ncache will speed up subsequent calls to <code>gclient</code>. To do this, set a\n<code>GIT_CACHE_PATH</code> environment variable:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">export</span> GIT_CACHE_PATH=<span class=\"hljs-string\">\"<span class=\"hljs-variable\">${HOME}</span>/.git_cache\"</span>\n$ mkdir -p <span class=\"hljs-string\">\"<span class=\"hljs-variable\">${GIT_CACHE_PATH}</span>\"</span>\n<span class=\"hljs-comment\"># This will use about 16G.</span>\n</code></pre>\n<h2 id=\"getting-the-code\"><a href=\"#getting-the-code\">Getting the code</a></h2>\n<pre><code class=\"hljs language-sh\">$ mkdir electron &#x26;&#x26; <span class=\"hljs-built_in\">cd</span> electron\n$ gclient config --name <span class=\"hljs-string\">\"src/electron\"</span> --unmanaged https://github.com/electron/electron\n$ gclient sync --with_branch_heads --with_tags\n<span class=\"hljs-comment\"># This will take a while, go get a coffee.</span>\n</code></pre>\n<blockquote>\n<p>Instead of <code>https://github.com/electron/electron</code>, you can use your own fork\nhere (something like <code>https://github.com/&#x3C;username>/electron</code>).</p>\n</blockquote>\n<h3 id=\"a-note-on-pullingpushing\"><a href=\"#a-note-on-pullingpushing\">A note on pulling/pushing</a></h3>\n<p>If you intend to <code>git pull</code> or <code>git push</code> from the official <code>electron</code>\nrepository in the future, you now need to update the respective folder's\norigin URLs.</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src/electron\n$ git remote remove origin\n$ git remote add origin https://github.com/electron/electron\n$ git checkout main\n$ git branch --<span class=\"hljs-built_in\">set</span>-upstream-to=origin/main\n$ <span class=\"hljs-built_in\">cd</span> -\n</code></pre>\n<p>📝 <code>gclient</code> works by checking a file called <code>DEPS</code> inside the\n<code>src/electron</code> folder for dependencies (like Chromium or Node.js).\nRunning <code>gclient sync -f</code> ensures that all dependencies required\nto build Electron match that file.</p>\n<p>So, in order to pull, you'd run the following commands:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src/electron\n$ git pull\n$ gclient sync -f\n</code></pre>\n<h2 id=\"building\"><a href=\"#building\">Building</a></h2>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src\n$ <span class=\"hljs-built_in\">export</span> CHROMIUM_BUILDTOOLS_PATH=`<span class=\"hljs-built_in\">pwd</span>`/buildtools\n$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p>Or on Windows (without the optional argument):</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src\n$ <span class=\"hljs-built_in\">set</span> CHROMIUM_BUILDTOOLS_PATH=%<span class=\"hljs-built_in\">cd</span>%\\buildtools\n$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\")\"</span>\n</code></pre>\n<p>This will generate a build directory <code>out/Testing</code> under <code>src/</code> with\nthe testing build configuration. You can replace <code>Testing</code> with another name,\nbut it should be a subdirectory of <code>out</code>.\nAlso you shouldn't have to run <code>gn gen</code> again—if you want to change the\nbuild arguments, you can run <code>gn args out/Testing</code> to bring up an editor.</p>\n<p>To see the list of available build configuration options, run <code>gn args out/Testing --list</code>.</p>\n<p><strong>For generating Testing build config of\nElectron:</strong></p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p><strong>For generating Release (aka \"non-component\" or \"static\") build config of\nElectron:</strong></p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Release --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/release.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p><strong>To build, run <code>ninja</code> with the <code>electron</code> target:</strong>\nNota Bene: This will also take a while and probably heat up your lap.</p>\n<p>For the testing configuration:</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Testing electron\n</code></pre>\n<p>For the release configuration:</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Release electron\n</code></pre>\n<p>This will build all of what was previously 'libchromiumcontent' (i.e. the\n<code>content/</code> directory of <code>chromium</code> and its dependencies, incl. WebKit and V8),\nso it will take a while.</p>\n<p>The built executable will be under <code>./out/Testing</code>:</p>\n<pre><code class=\"hljs language-sh\">$ ./out/Testing/Electron.app/Contents/MacOS/Electron\n<span class=\"hljs-comment\"># or, on Windows</span>\n$ ./out/Testing/electron.exe\n<span class=\"hljs-comment\"># or, on Linux</span>\n$ ./out/Testing/electron\n</code></pre>\n<h3 id=\"packaging\"><a href=\"#packaging\">Packaging</a></h3>\n<p>On linux, first strip the debugging and symbol information:</p>\n<pre><code class=\"hljs language-sh\">electron/script/strip-binaries.py -d out/Release\n</code></pre>\n<p>To package the electron build as a distributable zip file:</p>\n<pre><code class=\"hljs language-sh\">ninja -C out/Release electron:electron_dist_zip\n</code></pre>\n<h3 id=\"cross-compiling\"><a href=\"#cross-compiling\">Cross-compiling</a></h3>\n<p>To compile for a platform that isn't the same as the one you're building on,\nset the <code>target_cpu</code> and <code>target_os</code> GN arguments. For example, to compile an\nx86 target from an x64 host, specify <code>target_cpu = \"x86\"</code> in <code>gn args</code>.</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing-x86 --args=<span class=\"hljs-string\">'... target_cpu = \"x86\"'</span>\n</code></pre>\n<p>Not all combinations of source and target CPU/OS are supported by Chromium.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Host</th><th>Target</th><th>Status</th></tr></thead><tbody><tr><td>Windows x64</td><td>Windows arm64</td><td>Experimental</td></tr><tr><td>Windows x64</td><td>Windows x86</td><td>Automatically tested</td></tr><tr><td>Linux x64</td><td>Linux x86</td><td>Automatically tested</td></tr></tbody></table>\n<p>If you test other combinations and find them to work, please update this document :)</p>\n<p>See the GN reference for allowable values of <a href=\"https://gn.googlesource.com/gn/+/master/docs/reference.md#built_in-predefined-variables-target_os_the-desired-operating-system-for-the-build-possible-values\"><code>target_os</code></a>\nand <a href=\"https://gn.googlesource.com/gn/+/master/docs/reference.md#built_in-predefined-variables-target_cpu_the-desired-cpu-architecture-for-the-build-possible-values\"><code>target_cpu</code></a>.</p>\n<h4 id=\"windows-on-arm-experimental\"><a href=\"#windows-on-arm-experimental\">Windows on Arm (experimental)</a></h4>\n<p>To cross-compile for Windows on Arm, <a href=\"https://chromium.googlesource.com/chromium/src/+/refs/heads/master/docs/windows_build_instructions.md#Visual-Studio\">follow Chromium's guide</a> to get the necessary dependencies, SDK and libraries, then build with <code>ELECTRON_BUILDING_WOA=1</code> in your environment before running <code>gclient sync</code>.</p>\n<pre><code class=\"hljs language-bat\"><span class=\"hljs-built_in\">set</span> ELECTRON_BUILDING_WOA=<span class=\"hljs-number\">1</span>\ngclient sync -f --with_branch_heads --with_tags\n</code></pre>\n<p>Or (if using PowerShell):</p>\n<pre><code class=\"hljs language-powershell\"><span class=\"hljs-variable\">$env:ELECTRON_BUILDING_WOA</span>=<span class=\"hljs-number\">1</span>\ngclient sync -f --with_branch_heads --with_tags\n</code></pre>\n<p>Next, run <code>gn gen</code> as above with <code>target_cpu=\"arm64\"</code>.</p>\n<h2 id=\"tests\"><a href=\"#tests\">Tests</a></h2>\n<p>To run the tests, you'll first need to build the test modules against the\nsame version of Node.js that was built as part of the build process. To\ngenerate build headers for the modules to compile against, run the following\nunder <code>src/</code> directory.</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Testing third_party/electron_node:headers\n</code></pre>\n<p>You can now <a href=\"/docs/development/testing#unit-tests\">run the tests</a>.</p>\n<p>If you're debugging something, it can be helpful to pass some extra flags to\nthe Electron binary:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span> -- \\\n  --<span class=\"hljs-built_in\">enable</span>-logging -g <span class=\"hljs-string\">'BrowserWindow module'</span>\n</code></pre>\n<h2 id=\"sharing-the-git-cache-between-multiple-machines\"><a href=\"#sharing-the-git-cache-between-multiple-machines\">Sharing the git cache between multiple machines</a></h2>\n<p>It is possible to share the gclient git cache with other machines by exporting it as\nSMB share on linux, but only one process/machine can be using the cache at a\ntime. The locks created by git-cache script will try to prevent this, but it may\nnot work perfectly in a network.</p>\n<p>On Windows, SMBv2 has a directory cache that will cause problems with the git\ncache script, so it is necessary to disable it by setting the registry key</p>\n<pre><code class=\"hljs language-sh\">HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\Lanmanworkstation\\Parameters\\DirectoryCacheLifetime\n</code></pre>\n<p>to 0. More information: <a href=\"https://stackoverflow.com/a/9935126\">https://stackoverflow.com/a/9935126</a></p>\n<p>This can be set quickly in powershell (ran as administrator):</p>\n<pre><code class=\"hljs language-powershell\"><span class=\"hljs-built_in\">New-ItemProperty</span> -Path <span class=\"hljs-string\">\"HKLM:\\System\\CurrentControlSet\\Services\\Lanmanworkstation\\Parameters\"</span> -Name DirectoryCacheLifetime -Value <span class=\"hljs-number\">0</span> -PropertyType DWORD -Force\n</code></pre>\n<h2 id=\"troubleshooting\"><a href=\"#troubleshooting\">Troubleshooting</a></h2>\n<h3 id=\"gclient-sync-complains-about-rebase\"><a href=\"#gclient-sync-complains-about-rebase\">gclient sync complains about rebase</a></h3>\n<p>If <code>gclient sync</code> is interrupted the git tree may be left in a bad state, leading to a cryptic message when running <code>gclient sync</code> in the future:</p>\n<pre><code class=\"hljs language-plaintext\">2> Conflict while rebasing this branch.\n2> Fix the conflict and run gclient again.\n2> See man git-rebase for details.\n</code></pre>\n<p>If there are no git conflicts or rebases in <code>src/electron</code>, you may need to abort a <code>git am</code> in <code>src</code>:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> ../\n$ git am --abort\n$ <span class=\"hljs-built_in\">cd</span> electron\n$ gclient sync -f\n</code></pre>\n<h3 id=\"im-being-asked-for-a-usernamepassword-for-chromium-internalgooglesourcecom\"><a href=\"#im-being-asked-for-a-usernamepassword-for-chromium-internalgooglesourcecom\">I'm being asked for a username/password for chromium-internal.googlesource.com</a></h3>\n<p>If you see a prompt for <code>Username for 'https://chrome-internal.googlesource.com':</code> when running <code>gclient sync</code> on Windows, it's probably because the <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> environment variable is not set to 0. Open <code>Control Panel</code> → <code>System and Security</code> → <code>System</code> → <code>Advanced system settings</code> and add a system variable\n<code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> with value <code>0</code>.  This tells <code>depot_tools</code> to use\nyour locally installed version of Visual Studio (by default, <code>depot_tools</code> will\ntry to download a Google-internal version that only Googlers have access to).</p>",
      "title": "Build Instructions",
      "description": "Instead of https://github.com/electron/electron, you can use your own fork\nhere (something like https://github.com/<username>/electron)."
    },
    "/docs/development/build-instructions-linux": {
      "locale": "en-US",
      "slug": "build-instructions-linux",
      "href": "/docs/development/build-instructions-linux",
      "crowdinFileId": "256133",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-linux.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"build-instructions-linux\"><a href=\"#build-instructions-linux\">Build Instructions (Linux)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on Linux, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>\n<p>At least 25GB disk space and 8GB RAM.</p>\n</li>\n<li>\n<p>Python 2.7.x. Some distributions like CentOS 6.x still use Python 2.6.x\nso you may need to check your Python version with <code>python -V</code>.</p>\n<p>Please also ensure that your system and Python version support at least TLS 1.2.\nFor a quick test, run the following script:</p>\n<pre><code class=\"hljs language-sh\">$ npx @electron/check-python-tls\n</code></pre>\n<p>If the script returns that your configuration is using an outdated security\nprotocol, use your system's package manager to update Python to the latest\nversion in the 2.7.x branch. Alternatively, visit <a href=\"https://www.python.org/downloads/\">https://www.python.org/downloads/</a>\nfor detailed instructions.</p>\n</li>\n<li>\n<p>Node.js. There are various ways to install Node. You can download\nsource code from <a href=\"https://nodejs.org\">nodejs.org</a> and compile it.\nDoing so permits installing Node on your own home directory as a standard user.\nOr try repositories such as <a href=\"https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories\">NodeSource</a>.</p>\n</li>\n<li>\n<p><a href=\"https://clang.llvm.org/get_started.html\">clang</a> 3.4 or later.</p>\n</li>\n<li>\n<p>Development headers of GTK 3 and libnotify.</p>\n</li>\n</ul>\n<p>On Ubuntu, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install build-essential clang libdbus-1-dev libgtk-3-dev \\\n                       libnotify-dev libgnome-keyring-dev \\\n                       libasound2-dev libcap-dev libcups2-dev libxtst-dev \\\n                       libxss1 libnss3-dev gcc-multilib g++-multilib curl \\\n                       gperf bison python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On RHEL / CentOS, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo yum install clang dbus-devel gtk3-devel libnotify-devel \\\n                   libgnome-keyring-devel xorg-x11-server-utils libcap-devel \\\n                   cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \\\n                   nss-devel python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On Fedora, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo dnf install clang dbus-devel gtk3-devel libnotify-devel \\\n                   libgnome-keyring-devel xorg-x11-server-utils libcap-devel \\\n                   cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \\\n                   nss-devel python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On Arch Linux / Manjaro, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo pacman -Syu base-devel clang libdbus gtk2 libnotify \\\n                   libgnome-keyring alsa-lib libcap libcups libxtst \\\n                   libxss nss gcc-multilib curl gperf bison \\\n                   python2 python-dbusmock jdk8-openjdk\n</code></pre>\n<p>Other distributions may offer similar packages for installation via package\nmanagers such as pacman. Or one can compile from source code.</p>\n<h3 id=\"cross-compilation\"><a href=\"#cross-compilation\">Cross compilation</a></h3>\n<p>If you want to build for an <code>arm</code> target you should also install the following\ndependencies:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install libc6-dev-armhf-cross linux-libc-dev-armhf-cross \\\n                       g++-arm-linux-gnueabihf\n</code></pre>\n<p>Similarly for <code>arm64</code>, install the following:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install libc6-dev-arm64-cross linux-libc-dev-arm64-cross \\\n                       g++-aarch64-linux-gnu\n</code></pre>\n<p>And to cross-compile for <code>arm</code> or <code>ia32</code> targets, you should pass the\n<code>target_cpu</code> parameter to <code>gn gen</code>:</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">'import(...) target_cpu=\"arm\"'</span>\n</code></pre>\n<h2 id=\"building\"><a href=\"#building\">Building</a></h2>\n<p>See <a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a></p>\n<h2 id=\"troubleshooting\"><a href=\"#troubleshooting\">Troubleshooting</a></h2>\n<h3 id=\"error-while-loading-shared-libraries-libtinfoso5\"><a href=\"#error-while-loading-shared-libraries-libtinfoso5\">Error While Loading Shared Libraries: libtinfo.so.5</a></h3>\n<p>Prebuilt <code>clang</code> will try to link to <code>libtinfo.so.5</code>. Depending on the host\narchitecture, symlink to appropriate <code>libncurses</code>:</p>\n<pre><code class=\"hljs language-sh\">$ sudo ln -s /usr/lib/libncurses.so.5 /usr/lib/libtinfo.so.5\n</code></pre>\n<h2 id=\"advanced-topics\"><a href=\"#advanced-topics\">Advanced topics</a></h2>\n<p>The default building configuration is targeted for major desktop Linux\ndistributions. To build for a specific distribution or device, the following\ninformation may help you.</p>\n<h3 id=\"using-system-clang-instead-of-downloaded-clang-binaries\"><a href=\"#using-system-clang-instead-of-downloaded-clang-binaries\">Using system <code>clang</code> instead of downloaded <code>clang</code> binaries</a></h3>\n<p>By default Electron is built with prebuilt\n<a href=\"https://clang.llvm.org/get_started.html\"><code>clang</code></a> binaries provided by the\nChromium project. If for some reason you want to build with the <code>clang</code>\ninstalled in your system, you can specify the <code>clang_base_path</code> argument in the\nGN args.</p>\n<p>For example if you installed <code>clang</code> under <code>/usr/local/bin/clang</code>:</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">'import(\"//electron/build/args/testing.gn\") clang_base_path = \"/usr/local/bin\"'</span>\n</code></pre>\n<h3 id=\"using-compilers-other-than-clang\"><a href=\"#using-compilers-other-than-clang\">Using compilers other than <code>clang</code></a></h3>\n<p>Building Electron with compilers other than <code>clang</code> is not supported.</p>",
      "title": "Build Instructions (Linux)",
      "description": ""
    },
    "/docs/development/build-instructions-macos": {
      "locale": "en-US",
      "slug": "build-instructions-macos",
      "href": "/docs/development/build-instructions-macos",
      "crowdinFileId": "256135",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-macos.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"build-instructions-macos\"><a href=\"#build-instructions-macos\">Build Instructions (macOS)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on macOS, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>macOS >= 10.11.6</li>\n<li><a href=\"https://developer.apple.com/technologies/tools/\">Xcode</a> >= 9.0.0</li>\n<li><a href=\"https://nodejs.org\">node.js</a> (external)</li>\n<li>Python 2.7 with support for TLS 1.2</li>\n</ul>\n<h2 id=\"python\"><a href=\"#python\">Python</a></h2>\n<p>Please also ensure that your system and Python version support at least TLS 1.2.\nThis depends on both your version of macOS and Python. For a quick test, run:</p>\n<pre><code class=\"hljs language-sh\">$ npx @electron/check-python-tls\n</code></pre>\n<p>If the script returns that your configuration is using an outdated security\nprotocol, you can either update macOS to High Sierra or install a new version\nof Python 2.7.x. To upgrade Python, use <a href=\"https://brew.sh/\">Homebrew</a>:</p>\n<pre><code class=\"hljs language-sh\">$ brew install python@2 &#x26;&#x26; brew link python@2 --force\n</code></pre>\n<p>If you are using Python as provided by Homebrew, you also need to install\nthe following Python modules:</p>\n<ul>\n<li><a href=\"https://pypi.org/project/pyobjc/#description\">pyobjc</a></li>\n</ul>\n<p>You can use <code>pip</code> to install it:</p>\n<pre><code class=\"hljs language-sh\">$ pip install pyobjc\n</code></pre>\n<h2 id=\"macos-sdk\"><a href=\"#macos-sdk\">macOS SDK</a></h2>\n<p>If you're developing Electron and don't plan to redistribute your\ncustom Electron build, you may skip this section.</p>\n<p>Official Electron builds are built with <a href=\"https://download.developer.apple.com/Developer_Tools/Xcode_12.2/Xcode_12.2.xip\">Xcode 12.2</a>, and the macOS 11.0 SDK. Building with a newer SDK works too, but the releases currently use the 11.0 SDK.</p>\n<h2 id=\"building-electron\"><a href=\"#building-electron\">Building Electron</a></h2>\n<p>See <a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a>.</p>",
      "title": "Build Instructions (macOS)",
      "description": ""
    },
    "/docs/development/build-instructions-windows": {
      "locale": "en-US",
      "slug": "build-instructions-windows",
      "href": "/docs/development/build-instructions-windows",
      "crowdinFileId": "256137",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-windows.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"build-instructions-windows\"><a href=\"#build-instructions-windows\">Build Instructions (Windows)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on Windows, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>Windows 10 / Server 2012 R2 or higher</li>\n<li>Visual Studio 2017 15.7.2 or higher - <a href=\"https://www.visualstudio.com/vs/\">download VS 2019 Community Edition for\nfree</a><ul>\n<li>See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md#visual-studio\">the Chromium build documentation</a> for more details on which Visual Studio\ncomponents are required.</li>\n<li>If your Visual Studio is installed in a directory other than the default, you'll need to\nset a few environment variables to point the toolchains to your installation path.<ul>\n<li><code>vs2019_install = DRIVE:\\path\\to\\Microsoft Visual Studio\\2019\\Community</code>, replacing <code>2019</code> and <code>Community</code> with your installed versions and replacing <code>DRIVE:</code> with the drive that Visual Studio is on. Often, this will be <code>C:</code>.</li>\n<li><code>WINDOWSSDKDIR = DRIVE:\\path\\to\\Windows Kits\\10</code>, replacing <code>DRIVE:</code> with the drive that Windows Kits is on. Often, this will be <code>C:</code>.</li>\n</ul></li>\n<li><a href=\"https://pypi.org/project/pywin32/#files\">Python for Windows (pywin32) Extensions</a>\nis also needed in order to run the build process.</li>\n</ul></li>\n<li><a href=\"https://nodejs.org/download/\">Node.js</a></li>\n<li><a href=\"https://git-scm.com\">Git</a></li>\n<li>Debugging Tools for Windows of Windows SDK 10.0.15063.468 if you plan on\ncreating a full distribution since <code>symstore.exe</code> is used for creating a symbol\nstore from <code>.pdb</code> files.<ul>\n<li>Different versions of the SDK can be installed side by side. To install the\nSDK, open Visual Studio Installer, select\n<code>Modify</code> → <code>Individual Components</code>, scroll down and select the appropriate\nWindows SDK to install. Another option would be to look at the\n<a href=\"https://developer.microsoft.com/en-us/windows/downloads/sdk-archive\">Windows SDK and emulator archive</a>\nand download the standalone version of the SDK respectively.</li>\n<li>The SDK Debugging Tools must also be installed. If the Windows 10 SDK was installed\nvia the Visual Studio installer, then they can be installed by going to:\n<code>Control Panel</code> → <code>Programs</code> → <code>Programs and Features</code> → Select the \"Windows Software Development Kit\" →\n<code>Change</code> → <code>Change</code> → Check \"Debugging Tools For Windows\" → <code>Change</code>.\nOr, you can download the standalone SDK installer and use it to install the Debugging Tools.</li>\n</ul></li>\n</ul>\n<p>If you don't currently have a Windows installation,\n<a href=\"https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/\">dev.microsoftedge.com</a>\nhas timebombed versions of Windows that you can use to build Electron.</p>\n<p>Building Electron is done entirely with command-line scripts and cannot be done\nwith Visual Studio. You can develop Electron with any editor but support for\nbuilding with Visual Studio will come in the future.</p>\n<p><strong>Note:</strong> Even though Visual Studio is not used for building, it's still\n<strong>required</strong> because we need the build toolchains it provides.</p>\n<h2 id=\"exclude-source-tree-from-windows-security\"><a href=\"#exclude-source-tree-from-windows-security\">Exclude source tree from Windows Security</a></h2>\n<p>Windows Security doesn't like one of the files in the Chromium source code\n(see <a href=\"https://crbug.com/441184\">https://crbug.com/441184</a>), so it will constantly delete it, causing <code>gclient sync</code> issues.\nYou can exclude the source tree from being monitored by Windows Security by\n<a href=\"https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26\">following these instructions</a>.</p>\n<h2 id=\"building\"><a href=\"#building\">Building</a></h2>\n<p>See <a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a></p>\n<h2 id=\"32bit-build\"><a href=\"#32bit-build\">32bit Build</a></h2>\n<p>To build for the 32bit target, you need to pass <code>target_cpu = \"x86\"</code> as a GN\narg. You can build the 32bit target alongside the 64bit target by using a\ndifferent output directory for GN, e.g. <code>out/Release-x86</code>, with different\narguments.</p>\n<pre><code class=\"hljs language-powershell\">$ gn gen out/Release-x86 --args=<span class=\"hljs-string\">\"import(\\\"</span>//electron/build/args/release.gn\\<span class=\"hljs-string\">\") target_cpu=\\\"</span>x86\\<span class=\"hljs-string\">\"\"</span>\n</code></pre>\n<p>The other building steps are exactly the same.</p>\n<h2 id=\"visual-studio-project\"><a href=\"#visual-studio-project\">Visual Studio project</a></h2>\n<p>To generate a Visual Studio project, you can pass the <code>--ide=vs2017</code> parameter\nto <code>gn gen</code>:</p>\n<pre><code class=\"hljs language-powershell\">$ gn gen out/Testing --ide=vs2017\n</code></pre>\n<h2 id=\"troubleshooting\"><a href=\"#troubleshooting\">Troubleshooting</a></h2>\n<h3 id=\"command-xxxx-not-found\"><a href=\"#command-xxxx-not-found\">Command xxxx not found</a></h3>\n<p>If you encountered an error like <code>Command xxxx not found</code>, you may try to use\nthe <code>VS2015 Command Prompt</code> console to execute the build scripts.</p>\n<h3 id=\"fatal-internal-compiler-error-c1001\"><a href=\"#fatal-internal-compiler-error-c1001\">Fatal internal compiler error: C1001</a></h3>\n<p>Make sure you have the latest Visual Studio update installed.</p>\n<h3 id=\"lnk1181-cannot-open-input-file-kernel32lib\"><a href=\"#lnk1181-cannot-open-input-file-kernel32lib\">LNK1181: cannot open input file 'kernel32.lib'</a></h3>\n<p>Try reinstalling 32bit Node.js.</p>\n<h3 id=\"error-enoent-stat-cusersusernameappdataroamingnpm\"><a href=\"#error-enoent-stat-cusersusernameappdataroamingnpm\">Error: ENOENT, stat 'C:\\Users\\USERNAME\\AppData\\Roaming\\npm'</a></h3>\n<p>Creating that directory <a href=\"https://stackoverflow.com/a/25095327/102704\">should fix the problem</a>:</p>\n<pre><code class=\"hljs language-powershell\">$ mkdir ~\\AppData\\Roaming\\npm\n</code></pre>\n<h3 id=\"node-gyp-is-not-recognized-as-an-internal-or-external-command\"><a href=\"#node-gyp-is-not-recognized-as-an-internal-or-external-command\">node-gyp is not recognized as an internal or external command</a></h3>\n<p>You may get this error if you are using Git Bash for building, you should use\nPowerShell or VS2015 Command Prompt instead.</p>\n<h3 id=\"cannot-create-directory-at--filename-too-long\"><a href=\"#cannot-create-directory-at--filename-too-long\">cannot create directory at '...': Filename too long</a></h3>\n<p>node.js has some <a href=\"https://github.com/electron/node/tree/electron/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/read-pkg-up/node_modules/read-pkg/node_modules/load-json-file/node_modules/parse-json/node_modules/error-ex/node_modules/is-arrayish\">extremely long pathnames</a>, and by default git on windows doesn't handle long pathnames correctly (even though windows supports them). This should fix it:</p>\n<pre><code class=\"hljs language-sh\">$ git config --system core.longpaths <span class=\"hljs-literal\">true</span>\n</code></pre>\n<h3 id=\"error-use-of-undeclared-identifier-defaultdelegatecheckmode\"><a href=\"#error-use-of-undeclared-identifier-defaultdelegatecheckmode\">error: use of undeclared identifier 'DefaultDelegateCheckMode'</a></h3>\n<p>This can happen during build, when Debugging Tools for Windows has been installed with Windows Driver Kit. Uninstall Windows Driver Kit and install Debugging Tools with steps described above.</p>\n<h3 id=\"importerror-no-module-named-win32file\"><a href=\"#importerror-no-module-named-win32file\">ImportError: No module named win32file</a></h3>\n<p>Make sure you have installed <code>pywin32</code> with <code>pip install pywin32</code>.</p>\n<h3 id=\"build-scripts-hang-until-keypress\"><a href=\"#build-scripts-hang-until-keypress\">Build Scripts Hang Until Keypress</a></h3>\n<p>This bug is a \"feature\" of Windows' command prompt. It happens when clicking inside the prompt window with\n<code>QuickEdit</code> enabled and is intended to allow selecting and copying output text easily.\nSince each accidental click will pause the build process, you might want to disable this\nfeature in the command prompt properties.</p>",
      "title": "Build Instructions (Windows)",
      "description": ""
    },
    "/docs/development/build-system-overview": {
      "locale": "en-US",
      "slug": "build-system-overview",
      "href": "/docs/development/build-system-overview",
      "crowdinFileId": "256139",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-system-overview.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"build-system-overview\"><a href=\"#build-system-overview\">Build System Overview</a></h1>\n<p>Electron uses <a href=\"https://gn.googlesource.com/gn\">GN</a> for project generation and\n<a href=\"https://ninja-build.org/\">ninja</a> for building. Project configurations can\nbe found in the <code>.gn</code> and <code>.gni</code> files.</p>\n<h2 id=\"gn-files\"><a href=\"#gn-files\">GN Files</a></h2>\n<p>The following <code>gn</code> files contain the main rules for building Electron:</p>\n<ul>\n<li><code>BUILD.gn</code> defines how Electron itself is built and\nincludes the default configurations for linking with Chromium.</li>\n<li><code>build/args/{debug,release,all}.gn</code> contain the default build arguments for\nbuilding Electron.</li>\n</ul>\n<h2 id=\"component-build\"><a href=\"#component-build\">Component Build</a></h2>\n<p>Since Chromium is quite a large project, the final linking stage can take\nquite a few minutes, which makes it hard for development. In order to solve\nthis, Chromium introduced the \"component build\", which builds each component as\na separate shared library, making linking very quick but sacrificing file size\nand performance.</p>\n<p>Electron inherits this build option from Chromium. In <code>Debug</code> builds, the\nbinary will be linked to a shared library version of Chromium's components to\nachieve fast linking time; for <code>Release</code> builds, the binary will be linked to\nthe static library versions, so we can have the best possible binary size and\nperformance.</p>\n<h2 id=\"tests\"><a href=\"#tests\">Tests</a></h2>\n<p><strong>NB</strong> <em>this section is out of date and contains information that is no longer\nrelevant to the GN-built electron.</em></p>\n<p>Test your changes conform to the project coding style using:</p>\n<pre><code class=\"hljs language-sh\">$ npm run lint\n</code></pre>\n<p>Test functionality using:</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>Whenever you make changes to Electron source code, you'll need to re-run the\nbuild before the tests:</p>\n<pre><code class=\"hljs language-sh\">$ npm run build &#x26;&#x26; npm <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>You can make the test suite run faster by isolating the specific test or block\nyou're currently working on using Mocha's\n<a href=\"https://mochajs.org/#exclusive-tests\">exclusive tests</a> feature. Append\n<code>.only</code> to any <code>describe</code> or <code>it</code> function call:</p>\n<pre><code class=\"hljs language-js\">describe.only(<span class=\"hljs-string\">'some feature'</span>, () => {\n  <span class=\"hljs-comment\">// ... only tests in this block will be run</span>\n})\n</code></pre>\n<p>Alternatively, you can use mocha's <code>grep</code> option to only run tests matching the\ngiven regular expression pattern:</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span> -- --grep child_process\n</code></pre>\n<p>Tests that include native modules (e.g. <code>runas</code>) can't be executed with the\ndebug build (see <a href=\"https://github.com/electron/electron/issues/2558\">#2558</a> for\ndetails), but they will work with the release build.</p>\n<p>To run the tests with the release build use:</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span> -- -R\n</code></pre>",
      "title": "Build System Overview",
      "description": ""
    },
    "/docs/api/structures/certificate": {
      "locale": "en-US",
      "slug": "certificate",
      "href": "/docs/api/structures/certificate",
      "crowdinFileId": "256415",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/certificate.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"certificate-object\"><a href=\"#certificate-object\">Certificate Object</a></h1>\n<ul>\n<li><code>data</code> String - PEM encoded data</li>\n<li><code>issuer</code> <a href=\"/docs/api/structures/certificate-principal\">CertificatePrincipal</a> - Issuer principal</li>\n<li><code>issuerName</code> String - Issuer's Common Name</li>\n<li><code>issuerCert</code> Certificate - Issuer certificate (if not self-signed)</li>\n<li><code>subject</code> <a href=\"/docs/api/structures/certificate-principal\">CertificatePrincipal</a> - Subject principal</li>\n<li><code>subjectName</code> String - Subject's Common Name</li>\n<li><code>serialNumber</code> String - Hex value represented string</li>\n<li><code>validStart</code> Number - Start date of the certificate being valid in seconds</li>\n<li><code>validExpiry</code> Number - End date of the certificate being valid in seconds</li>\n<li><code>fingerprint</code> String - Fingerprint of the certificate</li>\n</ul>",
      "title": "Certificate Object",
      "description": ""
    },
    "/docs/api/structures/certificate-principal": {
      "locale": "en-US",
      "slug": "certificate-principal",
      "href": "/docs/api/structures/certificate-principal",
      "crowdinFileId": "256413",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/certificate-principal.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"certificateprincipal-object\"><a href=\"#certificateprincipal-object\">CertificatePrincipal Object</a></h1>\n<ul>\n<li><code>commonName</code> String - Common Name.</li>\n<li><code>organizations</code> String[] - Organization names.</li>\n<li><code>organizationUnits</code> String[] - Organization Unit names.</li>\n<li><code>locality</code> String - Locality.</li>\n<li><code>state</code> String - State or province.</li>\n<li><code>country</code> String - Country or region.</li>\n</ul>",
      "title": "CertificatePrincipal Object",
      "description": ""
    },
    "/docs/development/chromium-development": {
      "locale": "en-US",
      "slug": "chromium-development",
      "href": "/docs/development/chromium-development",
      "crowdinFileId": "256141",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/chromium-development.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"chromium-development\"><a href=\"#chromium-development\">Chromium Development</a></h1>\n<blockquote>\n<p>A collection of resources for learning about Chromium and tracking its development</p>\n</blockquote>\n<ul>\n<li><a href=\"https://twitter.com/ChromiumDev\">@ChromiumDev</a> on Twitter</li>\n<li><a href=\"https://twitter.com/googlechrome\">@googlechrome</a> on Twitter</li>\n<li><a href=\"https://blog.chromium.org\">Blog</a></li>\n<li><a href=\"https://cs.chromium.org/\">Code Search</a></li>\n<li><a href=\"https://cs.chromium.org/chromium/src/\">Source Code</a></li>\n<li><a href=\"https://www.chromium.org/developers/calendar\">Development Calendar and Release Info</a></li>\n<li><a href=\"https://www.chromium.org/developers/discussion-groups\">Discussion Groups</a></li>\n</ul>\n<p>See also <a href=\"/docs/development/v8-development\">V8 Development</a></p>",
      "title": "Chromium Development",
      "description": "A collection of resources for learning about Chromium and tracking its development"
    },
    "/docs/development/clang-format": {
      "locale": "en-US",
      "slug": "clang-format",
      "href": "/docs/development/clang-format",
      "crowdinFileId": "256143",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/clang-format.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"using-clang-format-on-c-code\"><a href=\"#using-clang-format-on-c-code\">Using clang-format on C++ Code</a></h1>\n<p><a href=\"https://clang.llvm.org/docs/ClangFormat.html\"><code>clang-format</code></a> is a tool to\nautomatically format C/C++/Objective-C code, so that developers don't need to\nworry about style issues during code reviews.</p>\n<p>It is highly recommended to format your changed C++ code before opening pull\nrequests, which will save you and the reviewers' time.</p>\n<p>You can install <code>clang-format</code> and <code>git-clang-format</code> via\n<code>npm install -g clang-format</code>.</p>\n<p>To automatically format a file according to Electron C++ code style, run\n<code>clang-format -i path/to/electron/file.cc</code>. It should work on macOS/Linux/Windows.</p>\n<p>The workflow to format your changed code:</p>\n<ol>\n<li>Make codes changes in Electron repository.</li>\n<li>Run <code>git add your_changed_file.cc</code>.</li>\n<li>Run <code>git-clang-format</code>, and you will probably see modifications in\n<code>your_changed_file.cc</code>, these modifications are generated from <code>clang-format</code>.</li>\n<li>Run <code>git add your_changed_file.cc</code>, and commit your change.</li>\n<li>Now the branch is ready to be opened as a pull request.</li>\n</ol>\n<p>If you want to format the changed code on your latest git commit (HEAD), you can\nrun <code>git-clang-format HEAD~1</code>. See <code>git-clang-format -h</code> for more details.</p>\n<h2 id=\"editor-integration\"><a href=\"#editor-integration\">Editor Integration</a></h2>\n<p>You can also integrate <code>clang-format</code> directly into your favorite editors.\nFor further guidance on setting up editor integration, see these pages:</p>\n<ul>\n<li><a href=\"https://atom.io/packages/clang-format\">Atom</a></li>\n<li><a href=\"https://clang.llvm.org/docs/ClangFormat.html#vim-integration\">Vim &#x26; Emacs</a></li>\n<li><a href=\"https://marketplace.visualstudio.com/items?itemName=xaver.clang-format\">Visual Studio Code</a></li>\n</ul>",
      "title": "Using clang-format on C++ Code",
      "description": ""
    },
    "/docs/development/clang-tidy": {
      "locale": "en-US",
      "slug": "clang-tidy",
      "href": "/docs/development/clang-tidy",
      "crowdinFileId": "256145",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/clang-tidy.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"using-clang-tidy-on-c-code\"><a href=\"#using-clang-tidy-on-c-code\">Using clang-tidy on C++ Code</a></h1>\n<p><a href=\"https://clang.llvm.org/extra/clang-tidy/\"><code>clang-tidy</code></a> is a tool to\nautomatically check C/C++/Objective-C code for style violations, programming\nerrors, and best practices.</p>\n<p>Electron's <code>clang-tidy</code> integration is provided as a linter script which can\nbe run with <code>npm run lint:clang-tidy</code>. While <code>clang-tidy</code> checks your on-disk\nfiles, you need to have built Electron so that it knows which compiler flags\nwere used. There is one required option for the script <code>--output-dir</code>, which\ntells the script which build directory to pull the compilation information\nfrom. A typical usage would be:\n<code>npm run lint:clang-tidy --out-dir ../out/Testing</code></p>\n<p>With no filenames provided, all C/C++/Objective-C files will be checked.\nYou can provide a list of files to be checked by passing the filenames after\nthe options:\n<code>npm run lint:clang-tidy --out-dir ../out/Testing shell/browser/api/electron_api_app.cc</code></p>\n<p>While <code>clang-tidy</code> has a\n<a href=\"https://clang.llvm.org/extra/clang-tidy/checks/list.html\">long list</a>\nof possible checks, in Electron only a few are enabled by default. At the\nmoment Electron doesn't have a <code>.clang-tidy</code> config, so <code>clang-tidy</code> will\nfind the one from Chromium at <code>src/.clang-tidy</code> and use the checks which\nChromium has enabled. You can change which checks are run by using the\n<code>--checks=</code> option. This is passed straight through to <code>clang-tidy</code>, so see\nits documentation for full details. Wildcards can be used, and checks can\nbe disabled by prefixing a <code>-</code>. By default any checks listed are added to\nthose in <code>.clang-tidy</code>, so if you'd like to limit the checks to specific\nones you should first exclude all checks then add back what you want, like\n<code>--checks=-*,performance*</code>.</p>\n<p>Running <code>clang-tidy</code> is rather slow - internally it compiles each file and\nthen runs the checks so it will always be some factor slower than compilation.\nWhile you can use parallel runs to speed it up using the <code>--jobs|-j</code> option,\n<code>clang-tidy</code> also uses a lot of memory during its checks, so it can easily\nrun into out-of-memory errors. As such the default number of jobs is one.</p>",
      "title": "Using clang-tidy on C++ Code",
      "description": ""
    },
    "/docs/api/client-request": {
      "locale": "en-US",
      "slug": "client-request",
      "href": "/docs/api/client-request",
      "crowdinFileId": "256289",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/client-request.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-clientrequest\"><a href=\"#class-clientrequest\">Class: ClientRequest</a></h2>\n<blockquote>\n<p>Make HTTP/HTTPS requests.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>ClientRequest</code> implements the <a href=\"https://nodejs.org/api/stream.html#stream_writable_streams\">Writable Stream</a>\ninterface and is therefore an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h3 id=\"new-clientrequestoptions\"><a href=\"#new-clientrequestoptions\"><code>new ClientRequest(options)</code></a></h3>\n<ul>\n<li><code>options</code> (Object | String) - If <code>options</code> is a String, it is interpreted as\nthe request URL. If it is an object, it is expected to fully specify an HTTP request via the\nfollowing properties:<ul>\n<li><code>method</code> String (optional) - The HTTP request method. Defaults to the GET\nmethod.</li>\n<li><code>url</code> String (optional) - The request URL. Must be provided in the absolute\nform with the protocol scheme specified as http or https.</li>\n<li><code>session</code> Session (optional) - The <a href=\"/docs/api/session\"><code>Session</code></a> instance with\nwhich the request is associated.</li>\n<li><code>partition</code> String (optional) - The name of the <a href=\"/docs/api/session\"><code>partition</code></a>\nwith which the request is associated. Defaults to the empty string. The\n<code>session</code> option supersedes <code>partition</code>. Thus if a <code>session</code> is explicitly\nspecified, <code>partition</code> is ignored.</li>\n<li><code>credentials</code> String (optional) - Can be <code>include</code> or <code>omit</code>. Whether to\nsend <a href=\"https://fetch.spec.whatwg.org/#credentials\">credentials</a> with this\nrequest. If set to <code>include</code>, credentials from the session associated with\nthe request will be used. If set to <code>omit</code>, credentials will not be sent\nwith the request (and the <code>'login'</code> event will not be triggered in the\nevent of a 401). This matches the behavior of the\n<a href=\"https://fetch.spec.whatwg.org/#concept-request-credentials-mode\">fetch</a>\noption of the same name. If this option is not specified, authentication\ndata from the session will be sent, and cookies will not be sent (unless\n<code>useSessionCookies</code> is set).</li>\n<li><code>useSessionCookies</code> Boolean (optional) - Whether to send cookies with this\nrequest from the provided session. If <code>credentials</code> is specified, this\noption has no effect. Default is <code>false</code>.</li>\n<li><code>protocol</code> String (optional) - Can be <code>http:</code> or <code>https:</code>. The protocol\nscheme in the form 'scheme:'. Defaults to 'http:'.</li>\n<li><code>host</code> String (optional) - The server host provided as a concatenation of\nthe hostname and the port number 'hostname:port'.</li>\n<li><code>hostname</code> String (optional) - The server host name.</li>\n<li><code>port</code> Integer (optional) - The server's listening port number.</li>\n<li><code>path</code> String (optional) - The path part of the request URL.</li>\n<li><code>redirect</code> String (optional) - Can be <code>follow</code>, <code>error</code> or <code>manual</code>. The\nredirect mode for this request. When mode is <code>error</code>, any redirection will\nbe aborted. When mode is <code>manual</code> the redirection will be cancelled unless\n<a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> is invoked synchronously\nduring the <a href=\"#event-redirect\"><code>redirect</code></a> event.  Defaults to <code>follow</code>.</li>\n<li><code>origin</code> String (optional) - The origin URL of the request.</li>\n</ul></li>\n</ul>\n<p><code>options</code> properties such as <code>protocol</code>, <code>host</code>, <code>hostname</code>, <code>port</code> and <code>path</code>\nstrictly follow the Node.js model as described in the\n<a href=\"https://nodejs.org/api/url.html\">URL</a> module.</p>\n<p>For instance, we could have created the same request to 'github.com' as follows:</p>\n<pre><code class=\"hljs language-JavaScript\"><span class=\"hljs-keyword\">const</span> request = net.request({\n  <span class=\"hljs-attr\">method</span>: <span class=\"hljs-string\">'GET'</span>,\n  <span class=\"hljs-attr\">protocol</span>: <span class=\"hljs-string\">'https:'</span>,\n  <span class=\"hljs-attr\">hostname</span>: <span class=\"hljs-string\">'github.com'</span>,\n  <span class=\"hljs-attr\">port</span>: <span class=\"hljs-number\">443</span>,\n  <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'/'</span>\n})\n</code></pre>\n<h3 id=\"instance-events\"><a href=\"#instance-events\">Instance Events</a></h3>\n<h4 id=\"event-response\"><a href=\"#event-response\">Event: 'response'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>response</code> <a href=\"/docs/api/incoming-message\">IncomingMessage</a> - An object representing the HTTP response message.</li>\n</ul>\n<h4 id=\"event-login\"><a href=\"#event-login\">Event: 'login'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>authInfo</code> Object<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (optional)</li>\n<li><code>password</code> String (optional)</li>\n</ul></li>\n</ul>\n<p>Emitted when an authenticating proxy is asking for user credentials.</p>\n<p>The <code>callback</code> function is expected to be called back with user credentials:</p>\n<ul>\n<li><code>username</code> String</li>\n<li><code>password</code> String</li>\n</ul>\n<pre><code class=\"hljs language-JavaScript\">request.on(<span class=\"hljs-string\">'login'</span>, (authInfo, callback) => {\n  callback(<span class=\"hljs-string\">'username'</span>, <span class=\"hljs-string\">'password'</span>)\n})\n</code></pre>\n<p>Providing empty credentials will cancel the request and report an authentication\nerror on the response object:</p>\n<pre><code class=\"hljs language-JavaScript\">request.on(<span class=\"hljs-string\">'response'</span>, (response) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`STATUS: <span class=\"hljs-subst\">${response.statusCode}</span>`</span>);\n  response.on(<span class=\"hljs-string\">'error'</span>, (error) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`ERROR: <span class=\"hljs-subst\">${<span class=\"hljs-built_in\">JSON</span>.stringify(error)}</span>`</span>)\n  })\n})\nrequest.on(<span class=\"hljs-string\">'login'</span>, (authInfo, callback) => {\n  callback()\n})\n</code></pre>\n<h4 id=\"event-finish\"><a href=\"#event-finish\">Event: 'finish'</a></h4>\n<p>Emitted just after the last chunk of the <code>request</code>'s data has been written into\nthe <code>request</code> object.</p>\n<h4 id=\"event-abort\"><a href=\"#event-abort\">Event: 'abort'</a></h4>\n<p>Emitted when the <code>request</code> is aborted. The <code>abort</code> event will not be fired if\nthe <code>request</code> is already closed.</p>\n<h4 id=\"event-error\"><a href=\"#event-error\">Event: 'error'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>error</code> Error - an error object providing some information about the failure.</li>\n</ul>\n<p>Emitted when the <code>net</code> module fails to issue a network request. Typically when\nthe <code>request</code> object emits an <code>error</code> event, a <code>close</code> event will subsequently\nfollow and no response object will be provided.</p>\n<h4 id=\"event-close\"><a href=\"#event-close\">Event: 'close'</a></h4>\n<p>Emitted as the last event in the HTTP request-response transaction. The <code>close</code>\nevent indicates that no more events will be emitted on either the <code>request</code> or\n<code>response</code> objects.</p>\n<h4 id=\"event-redirect\"><a href=\"#event-redirect\">Event: 'redirect'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>statusCode</code> Integer</li>\n<li><code>method</code> String</li>\n<li><code>redirectUrl</code> String</li>\n<li><code>responseHeaders</code> Record&#x3C;String, String[]></li>\n</ul>\n<p>Emitted when the server returns a redirect response (e.g. 301 Moved\nPermanently). Calling <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> will\ncontinue with the redirection.  If this event is handled,\n<a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> must be called\n<strong>synchronously</strong>, otherwise the request will be cancelled.</p>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<h4 id=\"requestchunkedencoding\"><a href=\"#requestchunkedencoding\"><code>request.chunkedEncoding</code></a></h4>\n<p>A <code>Boolean</code> specifying whether the request will use HTTP chunked transfer encoding\nor not. Defaults to false. The property is readable and writable, however it can\nbe set only before the first write operation as the HTTP headers are not yet put\non the wire. Trying to set the <code>chunkedEncoding</code> property after the first write\nwill throw an error.</p>\n<p>Using chunked encoding is strongly recommended if you need to send a large\nrequest body as data will be streamed in small chunks instead of being\ninternally buffered inside Electron process memory.</p>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<h4 id=\"requestsetheadername-value\"><a href=\"#requestsetheadername-value\"><code>request.setHeader(name, value)</code></a></h4>\n<ul>\n<li><code>name</code> String - An extra HTTP header name.</li>\n<li><code>value</code> String - An extra HTTP header value.</li>\n</ul>\n<p>Adds an extra HTTP header. The header name will be issued as-is without\nlowercasing. It can be called only before first write. Calling this method after\nthe first write will throw an error. If the passed value is not a <code>String</code>, its\n<code>toString()</code> method will be called to obtain the final value.</p>\n<p>Certain headers are restricted from being set by apps. These headers are\nlisted below. More information on restricted headers can be found in\n<a href=\"https://source.chromium.org/chromium/chromium/src/+/master:services/network/public/cpp/header_util.cc;drc=1562cab3f1eda927938f8f4a5a91991fefde66d3;bpv=1;bpt=1;l=22\">Chromium's header utils</a>.</p>\n<ul>\n<li><code>Content-Length</code></li>\n<li><code>Host</code></li>\n<li><code>Trailer</code> or <code>Te</code></li>\n<li><code>Upgrade</code></li>\n<li><code>Cookie2</code></li>\n<li><code>Keep-Alive</code></li>\n<li><code>Transfer-Encoding</code></li>\n</ul>\n<p>Additionally, setting the <code>Connection</code> header to the value <code>upgrade</code> is also disallowed.</p>\n<h4 id=\"requestgetheadername\"><a href=\"#requestgetheadername\"><code>request.getHeader(name)</code></a></h4>\n<ul>\n<li><code>name</code> String - Specify an extra header name.</li>\n</ul>\n<p>Returns <code>String</code> - The value of a previously set extra header name.</p>\n<h4 id=\"requestremoveheadername\"><a href=\"#requestremoveheadername\"><code>request.removeHeader(name)</code></a></h4>\n<ul>\n<li><code>name</code> String - Specify an extra header name.</li>\n</ul>\n<p>Removes a previously set extra header name. This method can be called only\nbefore first write. Trying to call it after the first write will throw an error.</p>\n<h4 id=\"requestwritechunk-encoding-callback\"><a href=\"#requestwritechunk-encoding-callback\"><code>request.write(chunk[, encoding][, callback])</code></a></h4>\n<ul>\n<li><code>chunk</code> (String | Buffer) - A chunk of the request body's data. If it is a\nstring, it is converted into a Buffer using the specified encoding.</li>\n<li><code>encoding</code> String (optional) - Used to convert string chunks into Buffer\nobjects. Defaults to 'utf-8'.</li>\n<li><code>callback</code> Function (optional) - Called after the write operation ends.</li>\n</ul>\n<p><code>callback</code> is essentially a dummy function introduced in the purpose of keeping\nsimilarity with the Node.js API. It is called asynchronously in the next tick\nafter <code>chunk</code> content have been delivered to the Chromium networking layer.\nContrary to the Node.js implementation, it is not guaranteed that <code>chunk</code>\ncontent have been flushed on the wire before <code>callback</code> is called.</p>\n<p>Adds a chunk of data to the request body. The first write operation may cause\nthe request headers to be issued on the wire. After the first write operation,\nit is not allowed to add or remove a custom header.</p>\n<h4 id=\"requestendchunk-encoding-callback\"><a href=\"#requestendchunk-encoding-callback\"><code>request.end([chunk][, encoding][, callback])</code></a></h4>\n<ul>\n<li><code>chunk</code> (String | Buffer) (optional)</li>\n<li><code>encoding</code> String (optional)</li>\n<li><code>callback</code> Function (optional)</li>\n</ul>\n<p>Sends the last chunk of the request data. Subsequent write or end operations\nwill not be allowed. The <code>finish</code> event is emitted just after the end operation.</p>\n<h4 id=\"requestabort\"><a href=\"#requestabort\"><code>request.abort()</code></a></h4>\n<p>Cancels an ongoing HTTP transaction. If the request has already emitted the\n<code>close</code> event, the abort operation will have no effect. Otherwise an ongoing\nevent will emit <code>abort</code> and <code>close</code> events. Additionally, if there is an ongoing\nresponse object,it will emit the <code>aborted</code> event.</p>\n<h4 id=\"requestfollowredirect\"><a href=\"#requestfollowredirect\"><code>request.followRedirect()</code></a></h4>\n<p>Continues any pending redirection. Can only be called during a <code>'redirect'</code>\nevent.</p>\n<h4 id=\"requestgetuploadprogress\"><a href=\"#requestgetuploadprogress\"><code>request.getUploadProgress()</code></a></h4>\n<p>Returns <code>Object</code>:</p>\n<ul>\n<li><code>active</code> Boolean - Whether the request is currently active. If this is false\nno other properties will be set</li>\n<li><code>started</code> Boolean - Whether the upload has started. If this is false both\n<code>current</code> and <code>total</code> will be set to 0.</li>\n<li><code>current</code> Integer - The number of bytes that have been uploaded so far</li>\n<li><code>total</code> Integer - The number of bytes that will be uploaded this request</li>\n</ul>\n<p>You can use this method in conjunction with <code>POST</code> requests to get the progress\nof a file upload or other data transfer.</p>",
      "title": "ClientRequest",
      "description": "Make HTTP/HTTPS requests."
    },
    "/docs/api/clipboard": {
      "locale": "en-US",
      "slug": "clipboard",
      "href": "/docs/api/clipboard",
      "crowdinFileId": "256291",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/clipboard.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"clipboard\"><a href=\"#clipboard\">clipboard</a></h1>\n<blockquote>\n<p>Perform copy and paste operations on the system clipboard.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>On Linux, there is also a <code>selection</code> clipboard. To manipulate it\nyou need to pass <code>selection</code> to each method:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeText(<span class=\"hljs-string\">'Example String'</span>, <span class=\"hljs-string\">'selection'</span>)\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readText(<span class=\"hljs-string\">'selection'</span>))\n</code></pre>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>clipboard</code> module has the following methods:</p>\n<p><strong>Note:</strong> Experimental APIs are marked as such and could be removed in future.</p>\n<h3 id=\"clipboardreadtexttype\"><a href=\"#clipboardreadtexttype\"><code>clipboard.readText([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Returns <code>String</code> - The content in the clipboard as plain text.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeText(<span class=\"hljs-string\">'hello i am a bit of text!'</span>)\n\n<span class=\"hljs-keyword\">const</span> text = clipboard.readText()\n<span class=\"hljs-built_in\">console</span>.log(text)\n<span class=\"hljs-comment\">// hello i am a bit of text!'</span>\n</code></pre>\n<h3 id=\"clipboardwritetexttext-type\"><a href=\"#clipboardwritetexttext-type\"><code>clipboard.writeText(text[, type])</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Writes the <code>text</code> into the clipboard as plain text.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> text = <span class=\"hljs-string\">'hello i am a bit of text!'</span>\nclipboard.writeText(text)\n</code></pre>\n<h3 id=\"clipboardreadhtmltype\"><a href=\"#clipboardreadhtmltype\"><code>clipboard.readHTML([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Returns <code>String</code> - The content in the clipboard as markup.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeHTML(<span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b>'</span>)\n<span class=\"hljs-keyword\">const</span> html = clipboard.readHTML()\n\n<span class=\"hljs-built_in\">console</span>.log(html)\n<span class=\"hljs-comment\">// &#x3C;meta charset='utf-8'>&#x3C;b>Hi&#x3C;/b></span>\n</code></pre>\n<h3 id=\"clipboardwritehtmlmarkup-type\"><a href=\"#clipboardwritehtmlmarkup-type\"><code>clipboard.writeHTML(markup[, type])</code></a></h3>\n<ul>\n<li><code>markup</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Writes <code>markup</code> to the clipboard.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeHTML(<span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b'</span>)\n</code></pre>\n<h3 id=\"clipboardreadimagetype\"><a href=\"#clipboardreadimagetype\"><code>clipboard.readImage([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Returns <a href=\"/docs/api/native-image\"><code>NativeImage</code></a> - The image content in the clipboard.</p>\n<h3 id=\"clipboardwriteimageimage-type\"><a href=\"#clipboardwriteimageimage-type\"><code>clipboard.writeImage(image[, type])</code></a></h3>\n<ul>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a></li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Writes <code>image</code> to the clipboard.</p>\n<h3 id=\"clipboardreadrtftype\"><a href=\"#clipboardreadrtftype\"><code>clipboard.readRTF([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Returns <code>String</code> - The content in the clipboard as RTF.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeRTF(<span class=\"hljs-string\">'{\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}'</span>)\n\n<span class=\"hljs-keyword\">const</span> rtf = clipboard.readRTF()\n<span class=\"hljs-built_in\">console</span>.log(rtf)\n<span class=\"hljs-comment\">// {\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}</span>\n</code></pre>\n<h3 id=\"clipboardwritertftext-type\"><a href=\"#clipboardwritertftext-type\"><code>clipboard.writeRTF(text[, type])</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Writes the <code>text</code> into the clipboard in RTF.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> rtf = <span class=\"hljs-string\">'{\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}'</span>\nclipboard.writeRTF(rtf)\n</code></pre>\n<h3 id=\"clipboardreadbookmark-macos-windows\"><a href=\"#clipboardreadbookmark-macos-windows\"><code>clipboard.readBookmark()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Returns <code>Object</code>:</p>\n<ul>\n<li><code>title</code> String</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Returns an Object containing <code>title</code> and <code>url</code> keys representing the bookmark in\nthe clipboard. The <code>title</code> and <code>url</code> values will be empty strings when the\nbookmark is unavailable.</p>\n<h3 id=\"clipboardwritebookmarktitle-url-type-macos-windows\"><a href=\"#clipboardwritebookmarktitle-url-type-macos-windows\"><code>clipboard.writeBookmark(title, url[, type])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>title</code> String</li>\n<li><code>url</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Writes the <code>title</code> and <code>url</code> into the clipboard as a bookmark.</p>\n<p><strong>Note:</strong> Most apps on Windows don't support pasting bookmarks into them so\nyou can use <code>clipboard.write</code> to write both a bookmark and fallback text to the\nclipboard.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeBookmark({\n  <span class=\"hljs-attr\">text</span>: <span class=\"hljs-string\">'https://electronjs.org'</span>,\n  <span class=\"hljs-attr\">bookmark</span>: <span class=\"hljs-string\">'Electron Homepage'</span>\n})\n</code></pre>\n<h3 id=\"clipboardreadfindtext-macos\"><a href=\"#clipboardreadfindtext-macos\"><code>clipboard.readFindText()</code> <em>macOS</em></a></h3>\n<p>Returns <code>String</code> - The text on the find pasteboard, which is the pasteboard that holds information about the current state of the active application’s find panel.</p>\n<p>This method uses synchronous IPC when called from the renderer process.\nThe cached value is reread from the find pasteboard whenever the application is activated.</p>\n<h3 id=\"clipboardwritefindtexttext-macos\"><a href=\"#clipboardwritefindtexttext-macos\"><code>clipboard.writeFindText(text)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Writes the <code>text</code> into the find pasteboard (the pasteboard that holds information about the current state of the active application’s find panel) as plain text. This method uses synchronous IPC when called from the renderer process.</p>\n<h3 id=\"clipboardcleartype\"><a href=\"#clipboardcleartype\"><code>clipboard.clear([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Clears the clipboard content.</p>\n<h3 id=\"clipboardavailableformatstype\"><a href=\"#clipboardavailableformatstype\"><code>clipboard.availableFormats([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Returns <code>String[]</code> - An array of supported formats for the clipboard <code>type</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> formats = clipboard.availableFormats()\n<span class=\"hljs-built_in\">console</span>.log(formats)\n<span class=\"hljs-comment\">// [ 'text/plain', 'text/html' ]</span>\n</code></pre>\n<h3 id=\"clipboardhasformat-type-experimental\"><a href=\"#clipboardhasformat-type-experimental\"><code>clipboard.has(format[, type])</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the clipboard supports the specified <code>format</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> hasFormat = clipboard.has(<span class=\"hljs-string\">'&#x3C;p>selection&#x3C;/p>'</span>)\n<span class=\"hljs-built_in\">console</span>.log(hasFormat)\n<span class=\"hljs-comment\">// 'true' or 'false'</span>\n</code></pre>\n<h3 id=\"clipboardreadformat-experimental\"><a href=\"#clipboardreadformat-experimental\"><code>clipboard.read(format)</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n</ul>\n<p>Returns <code>String</code> - Reads <code>format</code> type from the clipboard.</p>\n<p><code>format</code> should contain valid ASCII characters and have <code>/</code> separator.\n<code>a/c</code>, <code>a/bc</code> are valid formats while <code>/abc</code>, <code>abc/</code>, <code>a/</code>, <code>/a</code>, <code>a</code>\nare not valid.</p>\n<h3 id=\"clipboardreadbufferformat-experimental\"><a href=\"#clipboardreadbufferformat-experimental\"><code>clipboard.readBuffer(format)</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n</ul>\n<p>Returns <code>Buffer</code> - Reads <code>format</code> type from the clipboard.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> buffer = Buffer.from(<span class=\"hljs-string\">'this is binary'</span>, <span class=\"hljs-string\">'utf8'</span>)\nclipboard.writeBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>, buffer)\n\n<span class=\"hljs-keyword\">const</span> ret = clipboard.readBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>)\n\n<span class=\"hljs-built_in\">console</span>.log(buffer.equals(out))\n<span class=\"hljs-comment\">// true</span>\n</code></pre>\n<h3 id=\"clipboardwritebufferformat-buffer-type-experimental\"><a href=\"#clipboardwritebufferformat-buffer-type-experimental\"><code>clipboard.writeBuffer(format, buffer[, type])</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n<li><code>buffer</code> Buffer</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Writes the <code>buffer</code> into the clipboard as <code>format</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> buffer = Buffer.from(<span class=\"hljs-string\">'writeBuffer'</span>, <span class=\"hljs-string\">'utf8'</span>)\nclipboard.writeBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>, buffer)\n</code></pre>\n<h3 id=\"clipboardwritedata-type\"><a href=\"#clipboardwritedata-type\"><code>clipboard.write(data[, type])</code></a></h3>\n<ul>\n<li><code>data</code> Object<ul>\n<li><code>text</code> String (optional)</li>\n<li><code>html</code> String (optional)</li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> (optional)</li>\n<li><code>rtf</code> String (optional)</li>\n<li><code>bookmark</code> String (optional) - The title of the URL at <code>text</code>.</li>\n</ul></li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Writes <code>data</code> to the clipboard.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.write({\n  <span class=\"hljs-attr\">text</span>: <span class=\"hljs-string\">'test'</span>,\n  <span class=\"hljs-attr\">html</span>: <span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b>'</span>,\n  <span class=\"hljs-attr\">rtf</span>: <span class=\"hljs-string\">'{\\\\rtf1\\\\utf8 text}'</span>,\n  <span class=\"hljs-attr\">bookmark</span>: <span class=\"hljs-string\">'a title'</span>\n})\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readText())\n<span class=\"hljs-comment\">// 'test'</span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readHTML())\n<span class=\"hljs-comment\">// &#x3C;meta charset='utf-8'>&#x3C;b>Hi&#x3C;/b></span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readRTF())\n<span class=\"hljs-comment\">// '{\\\\rtf1\\\\utf8 text}'</span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readBookmark())\n<span class=\"hljs-comment\">// { title: 'a title', url: 'test' }</span>\n</code></pre>",
      "title": "clipboard",
      "description": "Perform copy and paste operations on the system clipboard."
    },
    "/docs/tutorial/code-signing": {
      "locale": "en-US",
      "slug": "code-signing",
      "href": "/docs/tutorial/code-signing",
      "crowdinFileId": "256183",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/code-signing.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"code-signing\"><a href=\"#code-signing\">Code Signing</a></h1>\n<p>Code signing is a security technology that you use to certify that an app was\ncreated by you.</p>\n<p>On macOS the system can detect any change to the app, whether the change is\nintroduced accidentally or by malicious code.</p>\n<p>On Windows, the system assigns a trust level to your code signing certificate\nwhich if you don't have, or if your trust level is low, will cause security\ndialogs to appear when users start using your application.  Trust level builds\nover time so it's better to start code signing as early as possible.</p>\n<p>While it is possible to distribute unsigned apps, it is not recommended. Both\nWindows and macOS will, by default, prevent either the download or the execution\nof unsigned applications. Starting with macOS Catalina (version 10.15), users\nhave to go through multiple manual steps to open unsigned applications.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/gatekeeper.png\" alt=\"macOS Catalina Gatekeeper warning: The app cannot be opened because the\ndeveloper cannot be verified\"></p>\n<p>As you can see, users get two options: Move the app straight to the trash or\ncancel running it. You don't want your users to see that dialog.</p>\n<p>If you are building an Electron app that you intend to package and distribute,\nit should be code-signed.</p>\n<h1 id=\"signing--notarizing-macos-builds\"><a href=\"#signing--notarizing-macos-builds\">Signing &#x26; notarizing macOS builds</a></h1>\n<p>Properly preparing macOS applications for release requires two steps: First, the\napp needs to be code-signed. Then, the app needs to be uploaded to Apple for a\nprocess called \"notarization\", where automated systems will further verify that\nyour app isn't doing anything to endanger its users.</p>\n<p>To start the process, ensure that you fulfill the requirements for signing and\nnotarizing your app:</p>\n<ol>\n<li>Enroll in the <a href=\"https://developer.apple.com/programs/\">Apple Developer Program</a> (requires an annual fee)</li>\n<li>Download and install <a href=\"https://developer.apple.com/xcode\">Xcode</a> - this requires a computer running macOS</li>\n<li>Generate, download, and install <a href=\"https://github.com/electron/electron-osx-sign/wiki/1.-Getting-Started#certificates\">signing certificates</a></li>\n</ol>\n<p>Electron's ecosystem favors configuration and freedom, so there are multiple\nways to get your application signed and notarized.</p>\n<h2 id=\"electron-forge\"><a href=\"#electron-forge\"><code>electron-forge</code></a></h2>\n<p>If you're using Electron's favorite build tool, getting your application signed\nand notarized requires a few additions to your configuration. <a href=\"https://electronforge.io\">Forge</a> is a\ncollection of the official Electron tools, using <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>,\n<a href=\"https://github.com/electron-userland/electron-osx-sign\"><code>electron-osx-sign</code></a>, and <a href=\"https://github.com/electron/electron-notarize\"><code>electron-notarize</code></a> under the hood.</p>\n<p>Let's take a look at an example configuration with all required fields. Not all\nof them are required: the tools will be clever enough to automatically find a\nsuitable <code>identity</code>, for instance, but we recommend that you are explicit.</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"my-app\"</span>,\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.0.1\"</span>,\n  <span class=\"hljs-attr\">\"config\"</span>: {\n    <span class=\"hljs-attr\">\"forge\"</span>: {\n      <span class=\"hljs-attr\">\"packagerConfig\"</span>: {\n        <span class=\"hljs-attr\">\"osxSign\"</span>: {\n          <span class=\"hljs-attr\">\"identity\"</span>: <span class=\"hljs-string\">\"Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)\"</span>,\n          <span class=\"hljs-attr\">\"hardened-runtime\"</span>: <span class=\"hljs-literal\">true</span>,\n          <span class=\"hljs-attr\">\"entitlements\"</span>: <span class=\"hljs-string\">\"entitlements.plist\"</span>,\n          <span class=\"hljs-attr\">\"entitlements-inherit\"</span>: <span class=\"hljs-string\">\"entitlements.plist\"</span>,\n          <span class=\"hljs-attr\">\"signature-flags\"</span>: <span class=\"hljs-string\">\"library\"</span>\n        },\n        <span class=\"hljs-attr\">\"osxNotarize\"</span>: {\n          <span class=\"hljs-attr\">\"appleId\"</span>: <span class=\"hljs-string\">\"felix@felix.fun\"</span>,\n          <span class=\"hljs-attr\">\"appleIdPassword\"</span>: <span class=\"hljs-string\">\"my-apple-id-password\"</span>,\n        }\n      }\n    }\n  }\n}\n</code></pre>\n<p>The <code>plist</code> file referenced here needs the following macOS-specific entitlements\nto assure the Apple security mechanisms that your app is doing these things\nwithout meaning any harm:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.allow-jit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.debugger<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>Note that up until Electron 12, the <code>com.apple.security.cs.allow-unsigned-executable-memory</code> entitlement was required\nas well. However, it should not be used anymore if it can be avoided.</p>\n<p>To see all of this in action, check out Electron Fiddle's source code,\n<a href=\"https://github.com/electron/fiddle/blob/master/forge.config.js\">especially its <code>electron-forge</code> configuration\nfile</a>.</p>\n<p>If you plan to access the microphone or camera within your app using Electron's APIs, you'll also\nneed to add the following entitlements:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.device.audio-input<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.device.camera<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>If these are not present in your app's entitlements when you invoke, for example:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> microphone = systemPreferences.askForMediaAccess(<span class=\"hljs-string\">'microphone'</span>)\n</code></pre>\n<p>Your app may crash. See the Resource Access section in <a href=\"https://developer.apple.com/documentation/security/hardened_runtime\">Hardened Runtime</a> for more information and entitlements you may need.</p>\n<h2 id=\"electron-builder\"><a href=\"#electron-builder\"><code>electron-builder</code></a></h2>\n<p>Electron Builder comes with a custom solution for signing your application. You\ncan find <a href=\"https://www.electron.build/code-signing\">its documentation here</a>.</p>\n<h2 id=\"electron-packager\"><a href=\"#electron-packager\"><code>electron-packager</code></a></h2>\n<p>If you're not using an integrated build pipeline like Forge or Builder, you\nare likely using <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>, which includes <a href=\"https://github.com/electron-userland/electron-osx-sign\"><code>electron-osx-sign</code></a> and\n<a href=\"https://github.com/electron/electron-notarize\"><code>electron-notarize</code></a>.</p>\n<p>If you're using Packager's API, you can pass <a href=\"https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html\">in configuration that both signs\nand notarizes your\napplication</a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> packager = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-packager'</span>)\n\npackager({\n  <span class=\"hljs-attr\">dir</span>: <span class=\"hljs-string\">'/path/to/my/app'</span>,\n  <span class=\"hljs-attr\">osxSign</span>: {\n    <span class=\"hljs-attr\">identity</span>: <span class=\"hljs-string\">'Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)'</span>,\n    <span class=\"hljs-string\">'hardened-runtime'</span>: <span class=\"hljs-literal\">true</span>,\n    <span class=\"hljs-attr\">entitlements</span>: <span class=\"hljs-string\">'entitlements.plist'</span>,\n    <span class=\"hljs-string\">'entitlements-inherit'</span>: <span class=\"hljs-string\">'entitlements.plist'</span>,\n    <span class=\"hljs-string\">'signature-flags'</span>: <span class=\"hljs-string\">'library'</span>\n  },\n  <span class=\"hljs-attr\">osxNotarize</span>: {\n    <span class=\"hljs-attr\">appleId</span>: <span class=\"hljs-string\">'felix@felix.fun'</span>,\n    <span class=\"hljs-attr\">appleIdPassword</span>: <span class=\"hljs-string\">'my-apple-id-password'</span>\n  }\n})\n</code></pre>\n<p>The <code>plist</code> file referenced here needs the following macOS-specific entitlements\nto assure the Apple security mechanisms that your app is doing these things\nwithout meaning any harm:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.allow-jit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.debugger<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>Up until Electron 12, the <code>com.apple.security.cs.allow-unsigned-executable-memory</code> entitlement was required\nas well. However, it should not be used anymore if it can be avoided.</p>\n<h2 id=\"mac-app-store\"><a href=\"#mac-app-store\">Mac App Store</a></h2>\n<p>See the <a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store Guide</a>.</p>\n<h1 id=\"signing-windows-builds\"><a href=\"#signing-windows-builds\">Signing Windows builds</a></h1>\n<p>Before signing Windows builds, you must do the following:</p>\n<ol>\n<li>Get a Windows Authenticode code signing certificate (requires an annual fee)</li>\n<li>Install Visual Studio to get the signing utility (the free <a href=\"https://visualstudio.microsoft.com/vs/community/\">Community\nEdition</a> is enough)</li>\n</ol>\n<p>You can get a code signing certificate from a lot of resellers. Prices vary, so\nit may be worth your time to shop around. Popular resellers include:</p>\n<ul>\n<li><a href=\"https://www.digicert.com/code-signing/microsoft-authenticode.htm\">digicert</a></li>\n<li><a href=\"https://sectigo.com/ssl-certificates-tls/code-signing\">Sectigo</a></li>\n<li>Amongst others, please shop around to find one that suits your needs, Google\nis your friend 😄</li>\n</ul>\n<p>There are a number of tools for signing your packaged app:</p>\n<ul>\n<li><a href=\"https://github.com/electron/windows-installer\"><code>electron-winstaller</code></a> will generate an installer for windows and sign it for\nyou</li>\n<li><a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a> can sign installers it generates through the\nSquirrel.Windows or MSI targets.</li>\n<li><a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> can sign some of its windows targets</li>\n</ul>\n<h2 id=\"windows-store\"><a href=\"#windows-store\">Windows Store</a></h2>\n<p>See the <a href=\"/docs/tutorial/windows-store-guide\">Windows Store Guide</a>.</p>",
      "title": "Code Signing",
      "description": ""
    },
    "/docs/development/coding-style": {
      "locale": "en-US",
      "slug": "coding-style",
      "href": "/docs/development/coding-style",
      "crowdinFileId": "256147",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/coding-style.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"coding-style\"><a href=\"#coding-style\">Coding Style</a></h1>\n<p>These are the style guidelines for coding in Electron.</p>\n<p>You can run <code>npm run lint</code> to show any style issues detected by <code>cpplint</code> and\n<code>eslint</code>.</p>\n<h2 id=\"general-code\"><a href=\"#general-code\">General Code</a></h2>\n<ul>\n<li>End files with a newline.</li>\n<li>Place requires in the following order:<ul>\n<li>Built in Node Modules (such as <code>path</code>)</li>\n<li>Built in Electron Modules (such as <code>ipc</code>, <code>app</code>)</li>\n<li>Local Modules (using relative paths)</li>\n</ul></li>\n<li>Place class properties in the following order:<ul>\n<li>Class methods and properties (methods starting with a <code>@</code>)</li>\n<li>Instance methods and properties</li>\n</ul></li>\n<li>Avoid platform-dependent code:<ul>\n<li>Use <code>path.join()</code> to concatenate filenames.</li>\n<li>Use <code>os.tmpdir()</code> rather than <code>/tmp</code> when you need to reference the\ntemporary directory.</li>\n</ul></li>\n<li>Using a plain <code>return</code> when returning explicitly at the end of a function.<ul>\n<li>Not <code>return null</code>, <code>return undefined</code>, <code>null</code> or <code>undefined</code></li>\n</ul></li>\n</ul>\n<h2 id=\"c-and-python\"><a href=\"#c-and-python\">C++ and Python</a></h2>\n<p>For C++ and Python, we follow Chromium's <a href=\"https://chromium.googlesource.com/chromium/src/+/refs/heads/main/styleguide/styleguide.md\">Coding\nStyle</a>. You can use\n<a href=\"/docs/development/clang-format\">clang-format</a> to format the C++ code automatically. There is\nalso a script <code>script/cpplint.py</code> to check whether all files conform.</p>\n<p>The Python version we are using now is Python 2.7.</p>\n<p>The C++ code uses a lot of Chromium's abstractions and types, so it's\nrecommended to get acquainted with them. A good place to start is\nChromium's <a href=\"https://www.chromium.org/developers/coding-style/important-abstractions-and-data-structures\">Important Abstractions and Data Structures</a>\ndocument. The document mentions some special types, scoped types (that\nautomatically release their memory when going out of scope), logging mechanisms\netc.</p>\n<h2 id=\"documentation\"><a href=\"#documentation\">Documentation</a></h2>\n<ul>\n<li>Write <a href=\"https://github.com/remarkjs/remark\">remark</a> markdown style.</li>\n</ul>\n<p>You can run <code>npm run lint-docs</code> to ensure that your documentation changes are\nformatted correctly.</p>\n<h2 id=\"javascript\"><a href=\"#javascript\">JavaScript</a></h2>\n<ul>\n<li>Write <a href=\"https://www.npmjs.com/package/standard\">standard</a> JavaScript style.</li>\n<li>File names should be concatenated with <code>-</code> instead of <code>_</code>, e.g.\n<code>file-name.js</code> rather than <code>file_name.js</code>, because in\n<a href=\"https://github.com/github/atom\">github/atom</a> module names are usually in\nthe <code>module-name</code> form. This rule only applies to <code>.js</code> files.</li>\n<li>Use newer ES6/ES2015 syntax where appropriate<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const\"><code>const</code></a>\nfor requires and other constants.  If the value is a primitive, use uppercase naming (eg <code>const NUMBER_OF_RETRIES = 5</code>).</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let\"><code>let</code></a>\nfor defining variables</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions\">Arrow functions</a>\ninstead of <code>function () { }</code></li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals\">Template literals</a>\ninstead of string concatenation using <code>+</code></li>\n</ul></li>\n</ul>\n<h2 id=\"naming-things\"><a href=\"#naming-things\">Naming Things</a></h2>\n<p>Electron APIs uses the same capitalization scheme as Node.js:</p>\n<ul>\n<li>When the module itself is a class like <code>BrowserWindow</code>, use <code>PascalCase</code>.</li>\n<li>When the module is a set of APIs, like <code>globalShortcut</code>, use <code>camelCase</code>.</li>\n<li>When the API is a property of object, and it is complex enough to be in a\nseparate chapter like <code>win.webContents</code>, use <code>mixedCase</code>.</li>\n<li>For other non-module APIs, use natural titles, like <code>&#x3C;webview> Tag</code> or\n<code>Process Object</code>.</li>\n</ul>\n<p>When creating a new API, it is preferred to use getters and setters instead of\njQuery's one-function style. For example, <code>.getText()</code> and <code>.setText(text)</code>\nare preferred to <code>.text([text])</code>. There is a\n<a href=\"https://github.com/electron/electron/issues/46\">discussion</a> on this.</p>",
      "title": "Coding Style",
      "description": ""
    },
    "/docs/api/command-line": {
      "locale": "en-US",
      "slug": "command-line",
      "href": "/docs/api/command-line",
      "crowdinFileId": "256295",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/command-line.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-commandline\"><a href=\"#class-commandline\">Class: CommandLine</a></h2>\n<blockquote>\n<p>Manipulate the command line arguments for your app that Chromium reads</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>The following example shows how to check if the <code>--disable-gpu</code> flag is set.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.hasSwitch(<span class=\"hljs-string\">'disable-gpu'</span>)\n</code></pre>\n<p>For more information on what kinds of flags and switches you can use, check\nout the <a href=\"/docs/api/command-line-switches\">Command Line Switches</a>\ndocument.</p>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<h4 id=\"commandlineappendswitchswitch-value\"><a href=\"#commandlineappendswitchswitch-value\"><code>commandLine.appendSwitch(switch[, value])</code></a></h4>\n<ul>\n<li><code>switch</code> String - A command-line switch, without the leading <code>--</code></li>\n<li><code>value</code> String (optional) - A value for the given switch</li>\n</ul>\n<p>Append a switch (with optional <code>value</code>) to Chromium's command line.</p>\n<p><strong>Note:</strong> This will not affect <code>process.argv</code>. The intended usage of this function is to\ncontrol Chromium's behavior.</p>\n<h4 id=\"commandlineappendargumentvalue\"><a href=\"#commandlineappendargumentvalue\"><code>commandLine.appendArgument(value)</code></a></h4>\n<ul>\n<li><code>value</code> String - The argument to append to the command line</li>\n</ul>\n<p>Append an argument to Chromium's command line. The argument will be quoted\ncorrectly. Switches will precede arguments regardless of appending order.</p>\n<p>If you're appending an argument like <code>--switch=value</code>, consider using <code>appendSwitch('switch', 'value')</code> instead.</p>\n<p><strong>Note:</strong> This will not affect <code>process.argv</code>. The intended usage of this function is to\ncontrol Chromium's behavior.</p>\n<h4 id=\"commandlinehasswitchswitch\"><a href=\"#commandlinehasswitchswitch\"><code>commandLine.hasSwitch(switch)</code></a></h4>\n<ul>\n<li><code>switch</code> String - A command-line switch</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the command-line switch is present.</p>\n<h4 id=\"commandlinegetswitchvalueswitch\"><a href=\"#commandlinegetswitchvalueswitch\"><code>commandLine.getSwitchValue(switch)</code></a></h4>\n<ul>\n<li><code>switch</code> String - A command-line switch</li>\n</ul>\n<p>Returns <code>String</code> - The command-line switch value.</p>\n<p><strong>Note:</strong> When the switch is not present or has no value, it returns empty string.</p>",
      "title": "CommandLine",
      "description": "Manipulate the command line arguments for your app that Chromium reads"
    },
    "/docs/api/command-line-switches": {
      "locale": "en-US",
      "slug": "command-line-switches",
      "href": "/docs/api/command-line-switches",
      "crowdinFileId": "256293",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/command-line-switches.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"supported-command-line-switches\"><a href=\"#supported-command-line-switches\">Supported Command Line Switches</a></h1>\n<blockquote>\n<p>Command line switches supported by Electron.</p>\n</blockquote>\n<p>You can use <a href=\"/docs/api/command-line#commandlineappendswitchswitch-value\">app.commandLine.appendSwitch</a> to append them in\nyour app's main script before the <a href=\"/docs/api/app#event-ready\">ready</a> event of the <a href=\"/docs/api/app\">app</a> module\nis emitted:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'remote-debugging-port'</span>, <span class=\"hljs-string\">'8315'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'host-rules'</span>, <span class=\"hljs-string\">'MAP * 127.0.0.1'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Your code here</span>\n})\n</code></pre>\n<h2 id=\"electron-cli-flags\"><a href=\"#electron-cli-flags\">Electron CLI Flags</a></h2>\n<h3 id=\"--auth-server-whitelisturl\"><a href=\"#--auth-server-whitelisturl\">--auth-server-whitelist=<code>url</code></a></h3>\n<p>A comma-separated list of servers for which integrated authentication is enabled.</p>\n<p>For example:</p>\n<pre><code class=\"hljs language-sh\">--auth-server-whitelist=<span class=\"hljs-string\">'*example.com, *foobar.com, *baz'</span>\n</code></pre>\n<p>then any <code>url</code> ending with <code>example.com</code>, <code>foobar.com</code>, <code>baz</code> will be considered\nfor integrated authentication. Without <code>*</code> prefix the URL has to match exactly.</p>\n<h3 id=\"--auth-negotiate-delegate-whitelisturl\"><a href=\"#--auth-negotiate-delegate-whitelisturl\">--auth-negotiate-delegate-whitelist=<code>url</code></a></h3>\n<p>A comma-separated list of servers for which delegation of user credentials is required.\nWithout <code>*</code> prefix the URL has to match exactly.</p>\n<h3 id=\"--disable-ntlm-v2\"><a href=\"#--disable-ntlm-v2\">--disable-ntlm-v2</a></h3>\n<p>Disables NTLM v2 for posix platforms, no effect elsewhere.</p>\n<h3 id=\"--disable-http-cache\"><a href=\"#--disable-http-cache\">--disable-http-cache</a></h3>\n<p>Disables the disk cache for HTTP requests.</p>\n<h3 id=\"--disable-http2\"><a href=\"#--disable-http2\">--disable-http2</a></h3>\n<p>Disable HTTP/2 and SPDY/3.1 protocols.</p>\n<h3 id=\"--disable-renderer-backgrounding\"><a href=\"#--disable-renderer-backgrounding\">--disable-renderer-backgrounding</a></h3>\n<p>Prevents Chromium from lowering the priority of invisible pages' renderer\nprocesses.</p>\n<p>This flag is global to all renderer processes, if you only want to disable\nthrottling in one window, you can take the hack of\n<a href=\"https://github.com/atom/atom/pull/9485/files\">playing silent audio</a>.</p>\n<h3 id=\"--disk-cache-sizesize\"><a href=\"#--disk-cache-sizesize\">--disk-cache-size=<code>size</code></a></h3>\n<p>Forces the maximum disk space to be used by the disk cache, in bytes.</p>\n<h3 id=\"--enable-api-filtering-logging\"><a href=\"#--enable-api-filtering-logging\">--enable-api-filtering-logging</a></h3>\n<p>Enables caller stack logging for the following APIs (filtering events):</p>\n<ul>\n<li><code>desktopCapturer.getSources()</code> / <code>desktop-capturer-get-sources</code></li>\n</ul>\n<h3 id=\"--enable-loggingfile\"><a href=\"#--enable-loggingfile\">--enable-logging[=file]</a></h3>\n<p>Prints Chromium's logging to stderr (or a log file).</p>\n<p>The <code>ELECTRON_ENABLE_LOGGING</code> environment variable has the same effect as\npassing <code>--enable-logging</code>.</p>\n<p>Passing <code>--enable-logging</code> will result in logs being printed on stderr.\nPassing <code>--enable-logging=file</code> will result in logs being saved to the file\nspecified by <code>--log-file=...</code>, or to <code>electron_debug.log</code> in the user-data\ndirectory if <code>--log-file</code> is not specified.</p>\n<blockquote>\n<p><strong>Note:</strong> On Windows, logs from child processes cannot be sent to stderr.\nLogging to a file is the most reliable way to collect logs on Windows.</p>\n</blockquote>\n<p>See also <code>--log-file</code>, <code>--log-level</code>, <code>--v</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--force-fieldtrialstrials\"><a href=\"#--force-fieldtrialstrials\">--force-fieldtrials=<code>trials</code></a></h3>\n<p>Field trials to be forcefully enabled or disabled.</p>\n<p>For example: <code>WebRTC-Audio-Red-For-Opus/Enabled/</code></p>\n<h3 id=\"--host-rulesrules\"><a href=\"#--host-rulesrules\">--host-rules=<code>rules</code></a></h3>\n<p>A comma-separated list of <code>rules</code> that control how hostnames are mapped.</p>\n<p>For example:</p>\n<ul>\n<li><code>MAP * 127.0.0.1</code> Forces all hostnames to be mapped to 127.0.0.1</li>\n<li><code>MAP *.google.com proxy</code> Forces all google.com subdomains to be resolved to\n\"proxy\".</li>\n<li><code>MAP test.com [::1]:77</code> Forces \"test.com\" to resolve to IPv6 loopback. Will\nalso force the port of the resulting socket address to be 77.</li>\n<li><code>MAP * baz, EXCLUDE www.google.com</code> Remaps everything to \"baz\", except for\n\"www.google.com\".</li>\n</ul>\n<p>These mappings apply to the endpoint host in a net request (the TCP connect\nand host resolver in a direct connection, and the <code>CONNECT</code> in an HTTP proxy\nconnection, and the endpoint host in a <code>SOCKS</code> proxy connection).</p>\n<h3 id=\"--host-resolver-rulesrules\"><a href=\"#--host-resolver-rulesrules\">--host-resolver-rules=<code>rules</code></a></h3>\n<p>Like <code>--host-rules</code> but these <code>rules</code> only apply to the host resolver.</p>\n<h3 id=\"--ignore-certificate-errors\"><a href=\"#--ignore-certificate-errors\">--ignore-certificate-errors</a></h3>\n<p>Ignores certificate related errors.</p>\n<h3 id=\"--ignore-connections-limitdomains\"><a href=\"#--ignore-connections-limitdomains\">--ignore-connections-limit=<code>domains</code></a></h3>\n<p>Ignore the connections limit for <code>domains</code> list separated by <code>,</code>.</p>\n<h3 id=\"--js-flagsflags\"><a href=\"#--js-flagsflags\">--js-flags=<code>flags</code></a></h3>\n<p>Specifies the flags passed to the Node.js engine. It has to be passed when starting\nElectron if you want to enable the <code>flags</code> in the main process.</p>\n<pre><code class=\"hljs language-sh\">$ electron --js-flags=<span class=\"hljs-string\">\"--harmony_proxies --harmony_collections\"</span> your-app\n</code></pre>\n<p>See the <a href=\"https://nodejs.org/api/cli.html\">Node.js documentation</a> or run <code>node --help</code> in your terminal for a list of available flags. Additionally, run <code>node --v8-options</code> to see a list of flags that specifically refer to Node.js's V8 JavaScript engine.</p>\n<h3 id=\"--lang\"><a href=\"#--lang\">--lang</a></h3>\n<p>Set a custom locale.</p>\n<h3 id=\"--log-filepath\"><a href=\"#--log-filepath\">--log-file=<code>path</code></a></h3>\n<p>If <code>--enable-logging</code> is specified, logs will be written to the given path. The\nparent directory must exist.</p>\n<p>Setting the <code>ELECTRON_LOG_FILE</code> environment variable is equivalent to passing\nthis flag. If both are present, the command-line switch takes precedence.</p>\n<h3 id=\"--log-net-logpath\"><a href=\"#--log-net-logpath\">--log-net-log=<code>path</code></a></h3>\n<p>Enables net log events to be saved and writes them to <code>path</code>.</p>\n<h3 id=\"--log-leveln\"><a href=\"#--log-leveln\">--log-level=<code>N</code></a></h3>\n<p>Sets the verbosity of logging when used together with <code>--enable-logging</code>.\n<code>N</code> should be one of <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h?q=logging::LogSeverity&#x26;ss=chromium\">Chrome's LogSeverities</a>.</p>\n<p>Note that two complimentary logging mechanisms in Chromium -- <code>LOG()</code>\nand <code>VLOG()</code> -- are controlled by different switches. <code>--log-level</code>\ncontrols <code>LOG()</code> messages, while <code>--v</code> and <code>--vmodule</code> control <code>VLOG()</code>\nmessages. So you may want to use a combination of these three switches\ndepending on the granularity you want and what logging calls are made\nby the code you're trying to watch.</p>\n<p>See <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h\">Chromium Logging source</a> for more information on how\n<code>LOG()</code> and <code>VLOG()</code> interact. Loosely speaking, <code>VLOG()</code> can be thought\nof as sub-levels / per-module levels inside <code>LOG(INFO)</code> to control the\nfirehose of <code>LOG(INFO)</code> data.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, <code>--v</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--no-proxy-server\"><a href=\"#--no-proxy-server\">--no-proxy-server</a></h3>\n<p>Don't use a proxy server and always make direct connections. Overrides any other\nproxy server flags that are passed.</p>\n<h3 id=\"--no-sandbox\"><a href=\"#--no-sandbox\">--no-sandbox</a></h3>\n<p>Disables the Chromium <a href=\"https://www.chromium.org/developers/design-documents/sandbox\">sandbox</a>.\nForces renderer process and Chromium helper processes to run un-sandboxed.\nShould only be used for testing.</p>\n<h3 id=\"--proxy-bypass-listhosts\"><a href=\"#--proxy-bypass-listhosts\">--proxy-bypass-list=<code>hosts</code></a></h3>\n<p>Instructs Electron to bypass the proxy server for the given semi-colon-separated\nlist of hosts. This flag has an effect only if used in tandem with\n<code>--proxy-server</code>.</p>\n<p>For example:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'proxy-bypass-list'</span>, <span class=\"hljs-string\">'&#x3C;local>;*.google.com;*foo.com;1.2.3.4:5678'</span>)\n</code></pre>\n<p>Will use the proxy server for all hosts except for local addresses (<code>localhost</code>,\n<code>127.0.0.1</code> etc.), <code>google.com</code> subdomains, hosts that contain the suffix\n<code>foo.com</code> and anything at <code>1.2.3.4:5678</code>.</p>\n<h3 id=\"--proxy-pac-urlurl\"><a href=\"#--proxy-pac-urlurl\">--proxy-pac-url=<code>url</code></a></h3>\n<p>Uses the PAC script at the specified <code>url</code>.</p>\n<h3 id=\"--proxy-serveraddressport\"><a href=\"#--proxy-serveraddressport\">--proxy-server=<code>address:port</code></a></h3>\n<p>Use a specified proxy server, which overrides the system setting. This switch\nonly affects requests with HTTP protocol, including HTTPS and WebSocket\nrequests. It is also noteworthy that not all proxy servers support HTTPS and\nWebSocket requests. The proxy URL does not support username and password\nauthentication <a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=615947\">per Chromium issue</a>.</p>\n<h3 id=\"--remote-debugging-portport\"><a href=\"#--remote-debugging-portport\">--remote-debugging-port=<code>port</code></a></h3>\n<p>Enables remote debugging over HTTP on the specified <code>port</code>.</p>\n<h3 id=\"--vlog_level\"><a href=\"#--vlog_level\">--v=<code>log_level</code></a></h3>\n<p>Gives the default maximal active V-logging level; 0 is the default. Normally\npositive values are used for V-logging levels.</p>\n<p>This switch only works when <code>--enable-logging</code> is also passed.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--vmodulepattern\"><a href=\"#--vmodulepattern\">--vmodule=<code>pattern</code></a></h3>\n<p>Gives the per-module maximal V-logging levels to override the value given by\n<code>--v</code>. E.g. <code>my_module=2,foo*=3</code> would change the logging level for all code in\nsource files <code>my_module.*</code> and <code>foo*.*</code>.</p>\n<p>Any pattern containing a forward or backward slash will be tested against the\nwhole pathname and not only the module. E.g. <code>*/foo/bar/*=2</code> would change the\nlogging level for all code in the source files under a <code>foo/bar</code> directory.</p>\n<p>This switch only works when <code>--enable-logging</code> is also passed.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, and <code>--v</code>.</p>\n<h3 id=\"--force_high_performance_gpu\"><a href=\"#--force_high_performance_gpu\">--force_high_performance_gpu</a></h3>\n<p>Force using discrete GPU when there are multiple GPUs available.</p>\n<h3 id=\"--force_low_power_gpu\"><a href=\"#--force_low_power_gpu\">--force_low_power_gpu</a></h3>\n<p>Force using integrated GPU when there are multiple GPUs available.</p>\n<h2 id=\"nodejs-flags\"><a href=\"#nodejs-flags\">Node.js Flags</a></h2>\n<p>Electron supports some of the <a href=\"https://nodejs.org/api/cli.html\">CLI flags</a> supported by Node.js.</p>\n<p><strong>Note:</strong> Passing unsupported command line switches to Electron when it is not running in <code>ELECTRON_RUN_AS_NODE</code> will have no effect.</p>\n<h3 id=\"--inspect-brkhostport\"><a href=\"#--inspect-brkhostport\">--inspect-brk[=[host:]port]</a></h3>\n<p>Activate inspector on host:port and break at start of user script. Default host:port is 127.0.0.1:9229.</p>\n<p>Aliased to <code>--debug-brk=[host:]port</code>.</p>\n<h3 id=\"--inspect-porthostport\"><a href=\"#--inspect-porthostport\">--inspect-port=[host:]port</a></h3>\n<p>Set the <code>host:port</code> to be used when the inspector is activated. Useful when activating the inspector by sending the SIGUSR1 signal. Default host is <code>127.0.0.1</code>.</p>\n<p>Aliased to <code>--debug-port=[host:]port</code>.</p>\n<h3 id=\"--inspecthostport\"><a href=\"#--inspecthostport\">--inspect[=[host:]port]</a></h3>\n<p>Activate inspector on <code>host:port</code>. Default is <code>127.0.0.1:9229</code>.</p>\n<p>V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug and profile Electron instances. The tools attach to Electron instances via a TCP port and communicate using the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">Chrome DevTools Protocol</a>.</p>\n<p>See the <a href=\"/docs/tutorial/debugging-main-process\">Debugging the Main Process</a> guide for more details.</p>\n<p>Aliased to <code>--debug[=[host:]port</code>.</p>\n<h3 id=\"--inspect-publish-uidstderrhttp\"><a href=\"#--inspect-publish-uidstderrhttp\">--inspect-publish-uid=stderr,http</a></h3>\n<p>Specify ways of the inspector web socket url exposure.</p>\n<p>By default inspector websocket url is available in stderr and under /json/list endpoint on <a href=\"http://host:port/json/list\">http://host:port/json/list</a>.</p>",
      "title": "Supported Command Line Switches",
      "description": "Command line switches supported by Electron."
    },
    "/docs/api/content-tracing": {
      "locale": "en-US",
      "slug": "content-tracing",
      "href": "/docs/api/content-tracing",
      "crowdinFileId": "256297",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/content-tracing.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"contenttracing\"><a href=\"#contenttracing\">contentTracing</a></h1>\n<blockquote>\n<p>Collect tracing data from Chromium to find performance bottlenecks and slow operations.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>This module does not include a web interface. To view recorded traces, use\n<a href=\"https://chromium.googlesource.com/catapult/+/HEAD/tracing/README.md\">trace viewer</a>, available at <code>chrome://tracing</code> in Chrome.</p>\n<p><strong>Note:</strong> You should not use this module until the <code>ready</code> event of the app\nmodule is emitted.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, contentTracing } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  (<span class=\"hljs-keyword\">async</span> () => {\n    <span class=\"hljs-keyword\">await</span> contentTracing.startRecording({\n      <span class=\"hljs-attr\">included_categories</span>: [<span class=\"hljs-string\">'*'</span>]\n    })\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Tracing started'</span>)\n    <span class=\"hljs-keyword\">await</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> setTimeout(resolve, <span class=\"hljs-number\">5000</span>))\n    <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> contentTracing.stopRecording()\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Tracing data recorded to '</span> + path)\n  })()\n})\n</code></pre>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>contentTracing</code> module has the following methods:</p>\n<h3 id=\"contenttracinggetcategories\"><a href=\"#contenttracinggetcategories\"><code>contentTracing.getCategories()</code></a></h3>\n<p>Returns <code>Promise&#x3C;String[]></code> - resolves with an array of category groups once all child processes have acknowledged the <code>getCategories</code> request</p>\n<p>Get a set of category groups. The category groups can change as new code paths\nare reached. See also the <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">list of built-in tracing\ncategories</a>.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Electron adds a non-default tracing category called <code>\"electron\"</code>.\nThis category can be used to capture Electron-specific tracing events.</p>\n</blockquote>\n<h3 id=\"contenttracingstartrecordingoptions\"><a href=\"#contenttracingstartrecordingoptions\"><code>contentTracing.startRecording(options)</code></a></h3>\n<ul>\n<li><code>options</code> (<a href=\"/docs/api/structures/trace-config\">TraceConfig</a> | <a href=\"/docs/api/structures/trace-categories-and-options\">TraceCategoriesAndOptions</a>)</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolved once all child processes have acknowledged the <code>startRecording</code> request.</p>\n<p>Start recording on all processes.</p>\n<p>Recording begins immediately locally and asynchronously on child processes\nas soon as they receive the EnableRecording request.</p>\n<p>If a recording is already running, the promise will be immediately resolved, as\nonly one trace operation can be in progress at a time.</p>\n<h3 id=\"contenttracingstoprecordingresultfilepath\"><a href=\"#contenttracingstoprecordingresultfilepath\"><code>contentTracing.stopRecording([resultFilePath])</code></a></h3>\n<ul>\n<li><code>resultFilePath</code> String (optional)</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - resolves with a path to a file that contains the traced data once all child processes have acknowledged the <code>stopRecording</code> request</p>\n<p>Stop recording on all processes.</p>\n<p>Child processes typically cache trace data and only rarely flush and send\ntrace data back to the main process. This helps to minimize the runtime overhead\nof tracing since sending trace data over IPC can be an expensive operation. So,\nto end tracing, Chromium asynchronously asks all child processes to flush any\npending trace data.</p>\n<p>Trace data will be written into <code>resultFilePath</code>. If <code>resultFilePath</code> is empty\nor not provided, trace data will be written to a temporary file, and the path\nwill be returned in the promise.</p>\n<h3 id=\"contenttracinggettracebufferusage\"><a href=\"#contenttracinggettracebufferusage\"><code>contentTracing.getTraceBufferUsage()</code></a></h3>\n<p>Returns <code>Promise&#x3C;Object></code> - Resolves with an object containing the <code>value</code> and <code>percentage</code> of trace buffer maximum usage</p>\n<ul>\n<li><code>value</code> Number</li>\n<li><code>percentage</code> Number</li>\n</ul>\n<p>Get the maximum usage across processes of trace buffer as a percentage of the\nfull state.</p>",
      "title": "contentTracing",
      "description": "Collect tracing data from Chromium to find performance bottlenecks and slow operations."
    },
    "/docs/api/context-bridge": {
      "locale": "en-US",
      "slug": "context-bridge",
      "href": "/docs/api/context-bridge",
      "crowdinFileId": "256299",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/context-bridge.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"contextbridge\"><a href=\"#contextbridge\">contextBridge</a></h1>\n<blockquote>\n<p>Create a safe, bi-directional, synchronous bridge across isolated contexts</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>An example of exposing an API to a renderer from an isolated preload script is given below:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Preload (Isolated World)</span>\n<span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(\n  <span class=\"hljs-string\">'electron'</span>,\n  {\n    <span class=\"hljs-attr\">doThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.send(<span class=\"hljs-string\">'do-a-thing'</span>)\n  }\n)\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Renderer (Main World)</span>\n\n<span class=\"hljs-built_in\">window</span>.electron.doThing()\n</code></pre>\n<h2 id=\"glossary\"><a href=\"#glossary\">Glossary</a></h2>\n<h3 id=\"main-world\"><a href=\"#main-world\">Main World</a></h3>\n<p>The \"Main World\" is the JavaScript context that your main renderer code runs in. By default, the\npage you load in your renderer executes code in this world.</p>\n<h3 id=\"isolated-world\"><a href=\"#isolated-world\">Isolated World</a></h3>\n<p>When <code>contextIsolation</code> is enabled in your <code>webPreferences</code> (this is the default behavior since Electron 12.0.0), your <code>preload</code> scripts run in an\n\"Isolated World\".  You can read more about context isolation and what it affects in the\n<a href=\"/docs/tutorial/security#3-enable-context-isolation-for-remote-content\">security</a> docs.</p>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>contextBridge</code> module has the following methods:</p>\n<h3 id=\"contextbridgeexposeinmainworldapikey-api\"><a href=\"#contextbridgeexposeinmainworldapikey-api\"><code>contextBridge.exposeInMainWorld(apiKey, api)</code></a></h3>\n<ul>\n<li><code>apiKey</code> String - The key to inject the API onto <code>window</code> with.  The API will be accessible on <code>window[apiKey]</code>.</li>\n<li><code>api</code> any - Your API, more information on what this API can be and how it works is available below.</li>\n</ul>\n<h2 id=\"usage\"><a href=\"#usage\">Usage</a></h2>\n<h3 id=\"api\"><a href=\"#api\">API</a></h3>\n<p>The <code>api</code> provided to <a href=\"#contextbridgeexposeinmainworldapikey-api\"><code>exposeInMainWorld</code></a> must be a <code>Function</code>, <code>String</code>, <code>Number</code>, <code>Array</code>, <code>Boolean</code>, or an object\nwhose keys are strings and values are a <code>Function</code>, <code>String</code>, <code>Number</code>, <code>Array</code>, <code>Boolean</code>, or another nested object that meets the same conditions.</p>\n<p><code>Function</code> values are proxied to the other context and all other values are <strong>copied</strong> and <strong>frozen</strong>. Any data / primitives sent in\nthe API become immutable and updates on either side of the bridge do not result in an update on the other side.</p>\n<p>An example of a complex API is shown below:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(\n  <span class=\"hljs-string\">'electron'</span>,\n  {\n    <span class=\"hljs-attr\">doThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.send(<span class=\"hljs-string\">'do-a-thing'</span>),\n    <span class=\"hljs-attr\">myPromises</span>: [<span class=\"hljs-built_in\">Promise</span>.resolve(), <span class=\"hljs-built_in\">Promise</span>.reject(<span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'whoops'</span>))],\n    <span class=\"hljs-attr\">anAsyncFunction</span>: <span class=\"hljs-keyword\">async</span> () => <span class=\"hljs-number\">123</span>,\n    <span class=\"hljs-attr\">data</span>: {\n      <span class=\"hljs-attr\">myFlags</span>: [<span class=\"hljs-string\">'a'</span>, <span class=\"hljs-string\">'b'</span>, <span class=\"hljs-string\">'c'</span>],\n      <span class=\"hljs-attr\">bootTime</span>: <span class=\"hljs-number\">1234</span>\n    },\n    <span class=\"hljs-attr\">nestedAPI</span>: {\n      <span class=\"hljs-attr\">evenDeeper</span>: {\n        <span class=\"hljs-attr\">youCanDoThisAsMuchAsYouWant</span>: {\n          <span class=\"hljs-attr\">fn</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ({\n            <span class=\"hljs-attr\">returnData</span>: <span class=\"hljs-number\">123</span>\n          })\n        }\n      }\n    }\n  }\n)\n</code></pre>\n<h3 id=\"api-functions\"><a href=\"#api-functions\">API Functions</a></h3>\n<p><code>Function</code> values that you bind through the <code>contextBridge</code> are proxied through Electron to ensure that contexts remain isolated.  This\nresults in some key limitations that we've outlined below.</p>\n<h4 id=\"parameter--error--return-type-support\"><a href=\"#parameter--error--return-type-support\">Parameter / Error / Return Type support</a></h4>\n<p>Because parameters, errors and return values are <strong>copied</strong> when they are sent over the bridge, there are only certain types that can be used.\nAt a high level, if the type you want to use can be serialized and deserialized into the same object it will work.  A table of type support\nhas been included below for completeness:</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Type</th><th>Complexity</th><th>Parameter Support</th><th>Return Value Support</th><th>Limitations</th></tr></thead><tbody><tr><td><code>String</code></td><td>Simple</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Number</code></td><td>Simple</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Boolean</code></td><td>Simple</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Object</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Keys must be supported using only \"Simple\" types in this table.  Values must be supported in this table.  Prototype modifications are dropped.  Sending custom classes will copy values but not the prototype.</td></tr><tr><td><code>Array</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Same limitations as the <code>Object</code> type</td></tr><tr><td><code>Error</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Errors that are thrown are also copied, this can result in the message and stack trace of the error changing slightly due to being thrown in a different context</td></tr><tr><td><code>Promise</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Promises are only proxied if they are the return value or exact parameter.  Promises nested in arrays or objects will be dropped.</td></tr><tr><td><code>Function</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Prototype modifications are dropped.  Sending classes or constructors will not work.</td></tr><tr><td><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Cloneable Types</a></td><td>Simple</td><td>✅</td><td>✅</td><td>See the linked document on cloneable types</td></tr><tr><td><code>Element</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Prototype modifications are dropped.  Sending custom elements will not work.</td></tr><tr><td><code>Blob</code></td><td>Complex</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Symbol</code></td><td>N/A</td><td>❌</td><td>❌</td><td>Symbols cannot be copied across contexts so they are dropped</td></tr></tbody></table>\n<p>If the type you care about is not in the above table, it is probably not supported.</p>\n<h3 id=\"exposing-node-global-symbols\"><a href=\"#exposing-node-global-symbols\">Exposing Node Global Symbols</a></h3>\n<p>The <code>contextBridge</code> can be used by the preload script to give your renderer access to Node APIs.\nThe table of supported types described above also applies to Node APIs that you expose through <code>contextBridge</code>.\nPlease note that many Node APIs grant access to local system resources.\nBe very cautious about which globals and APIs you expose to untrusted remote content.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> crypto = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'crypto'</span>)\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'nodeCrypto'</span>, {\n  sha256sum (data) {\n    <span class=\"hljs-keyword\">const</span> hash = crypto.createHash(<span class=\"hljs-string\">'sha256'</span>)\n    hash.update(data)\n    <span class=\"hljs-keyword\">return</span> hash.digest(<span class=\"hljs-string\">'hex'</span>)\n  }\n})\n</code></pre>",
      "title": "contextBridge",
      "description": "Create a safe, bi-directional, synchronous bridge across isolated contexts"
    },
    "/docs/tutorial/context-isolation": {
      "locale": "en-US",
      "slug": "context-isolation",
      "href": "/docs/tutorial/context-isolation",
      "crowdinFileId": "256185",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/context-isolation.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"context-isolation\"><a href=\"#context-isolation\">Context Isolation</a></h1>\n<h2 id=\"what-is-it\"><a href=\"#what-is-it\">What is it?</a></h2>\n<p>Context Isolation is a feature that ensures that both your <code>preload</code> scripts and Electron's internal logic run in a separate context to the website you load in a <a href=\"/docs/api/web-contents\"><code>webContents</code></a>.  This is important for security purposes as it helps prevent the website from accessing Electron internals or the powerful APIs your preload script has access to.</p>\n<p>This means that the <code>window</code> object that your preload script has access to is actually a <strong>different</strong> object than the website would have access to.  For example, if you set <code>window.hello = 'wave'</code> in your preload script and context isolation is enabled, <code>window.hello</code> will be undefined if the website tries to access it.</p>\n<p>Context isolation has been enabled by default since Electron 12, and it is a recommended security setting for <em>all applications</em>.</p>\n<h2 id=\"migration\"><a href=\"#migration\">Migration</a></h2>\n<blockquote>\n<p>Without context isolation, I used to provide APIs from my preload script using <code>window.X = apiObject</code>. Now what?</p>\n</blockquote>\n<h3 id=\"before-context-isolation-disabled\"><a href=\"#before-context-isolation-disabled\">Before: context isolation disabled</a></h3>\n<p>Exposing APIs from your preload script to a loaded website in the renderer process is a common use-case. With context isolation disabled, your preload script would share a common global <code>window</code> object with the renderer. You could then attach arbitrary properties to a preload script:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// preload with contextIsolation disabled</span>\n<span class=\"hljs-built_in\">window</span>.myAPI = {\n  <span class=\"hljs-attr\">doAThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {}\n}\n</code></pre>\n<p>The <code>doAThing()</code> function could then be used directly in the renderer process:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// use the exposed API in the renderer</span>\n<span class=\"hljs-built_in\">window</span>.myAPI.doAThing()\n</code></pre>\n<h3 id=\"after-context-isolation-enabled\"><a href=\"#after-context-isolation-enabled\">After: context isolation enabled</a></h3>\n<p>There is a dedicated module in Electron to help you do this in a painless way. The <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> module can be used to <strong>safely</strong> expose APIs from your preload script's isolated context to the context the website is running in. The API will also be accessible from the website on <code>window.myAPI</code> just like it was before.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// preload with contextIsolation enabled</span>\n<span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">doAThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {}\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// use the exposed API in the renderer</span>\n<span class=\"hljs-built_in\">window</span>.myAPI.doAThing()\n</code></pre>\n<p>Please read the <code>contextBridge</code> documentation linked above to fully understand its limitations. For instance, you can't send custom prototypes or symbols over the bridge.</p>\n<h2 id=\"security-considerations\"><a href=\"#security-considerations\">Security considerations</a></h2>\n<p>Just enabling <code>contextIsolation</code> and using <code>contextBridge</code> does not automatically mean that everything you do is safe. For instance, this code is <strong>unsafe</strong>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// ❌ Bad code</span>\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">send</span>: ipcRenderer.send\n})\n</code></pre>\n<p>It directly exposes a powerful API without any kind of argument filtering. This would allow any website to send arbitrary IPC messages, which you do not want to be possible. The correct way to expose IPC-based APIs would instead be to provide one method per IPC message.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// ✅ Good code</span>\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">loadPreferences</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'load-prefs'</span>)\n})\n</code></pre>\n<h2 id=\"usage-with-typescript\"><a href=\"#usage-with-typescript\">Usage with TypeScript</a></h2>\n<p>If you're building your Electron app with TypeScript, you'll want to add types to your APIs exposed over the context bridge. The renderer's <code>window</code> object won't have the correct typings unless you extend the types with a <a href=\"https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html\">declaration file</a>.</p>\n<p>For example, given this <code>preload.ts</code> script:</p>\n<pre><code class=\"hljs language-typescript\">contextBridge.exposeInMainWorld(<span class=\"hljs-string\">'electronAPI'</span>, {\n  loadPreferences: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'load-prefs'</span>)\n})\n</code></pre>\n<p>You can create a <code>renderer.d.ts</code> declaration file and globally augment the <code>Window</code> interface:</p>\n<pre><code class=\"hljs language-typescript\"><span class=\"hljs-keyword\">export</span> <span class=\"hljs-keyword\">interface</span> IElectronAPI {\n  loadPreferences: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-built_in\">Promise</span>&#x3C;<span class=\"hljs-built_in\">void</span>>,\n}\n\n<span class=\"hljs-keyword\">declare</span> global {\n  <span class=\"hljs-keyword\">interface</span> Window {\n    electronAPI: IElectronAPI\n  }\n}\n</code></pre>\n<p>Doing so will ensure that the TypeScript compiler will know about the <code>electronAPI</code> property on your global <code>window</code> object when writing scripts in your renderer process:</p>\n<pre><code class=\"hljs language-typescript\"><span class=\"hljs-built_in\">window</span>.electronAPI.loadPreferences()\n</code></pre>",
      "title": "Context Isolation",
      "description": "Without context isolation, I used to provide APIs from my preload script using window.X = apiObject. Now what?"
    },
    "/docs/api/structures/cookie": {
      "locale": "en-US",
      "slug": "cookie",
      "href": "/docs/api/structures/cookie",
      "crowdinFileId": "256417",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/cookie.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"cookie-object\"><a href=\"#cookie-object\">Cookie Object</a></h1>\n<ul>\n<li><code>name</code> String - The name of the cookie.</li>\n<li><code>value</code> String - The value of the cookie.</li>\n<li><code>domain</code> String (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains.</li>\n<li><code>hostOnly</code> Boolean (optional) - Whether the cookie is a host-only cookie; this will only be <code>true</code> if no domain was passed.</li>\n<li><code>path</code> String (optional) - The path of the cookie.</li>\n<li><code>secure</code> Boolean (optional) - Whether the cookie is marked as secure.</li>\n<li><code>httpOnly</code> Boolean (optional) - Whether the cookie is marked as HTTP only.</li>\n<li><code>session</code> Boolean (optional) - Whether the cookie is a session cookie or a persistent\ncookie with an expiration date.</li>\n<li><code>expirationDate</code> Double (optional) - The expiration date of the cookie as\nthe number of seconds since the UNIX epoch. Not provided for session\ncookies.</li>\n<li><code>sameSite</code> String - The <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies\">Same Site</a> policy applied to this cookie.  Can be <code>unspecified</code>, <code>no_restriction</code>, <code>lax</code> or <code>strict</code>.</li>\n</ul>",
      "title": "Cookie Object",
      "description": ""
    },
    "/docs/api/cookies": {
      "locale": "en-US",
      "slug": "cookies",
      "href": "/docs/api/cookies",
      "crowdinFileId": "256301",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/cookies.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-cookies\"><a href=\"#class-cookies\">Class: Cookies</a></h2>\n<blockquote>\n<p>Query and modify a session's cookies.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Instances of the <code>Cookies</code> class are accessed by using <code>cookies</code> property of\na <code>Session</code>.</p>\n<p>For example:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Query all cookies.</span>\nsession.defaultSession.cookies.get({})\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">cookies</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(cookies)\n  }).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">error</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(error)\n  })\n\n<span class=\"hljs-comment\">// Query all cookies associated with a specific url.</span>\nsession.defaultSession.cookies.get({ <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'http://www.github.com'</span> })\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">cookies</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(cookies)\n  }).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">error</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(error)\n  })\n\n<span class=\"hljs-comment\">// Set a cookie with the given cookie data;</span>\n<span class=\"hljs-comment\">// may overwrite equivalent cookies if they exist.</span>\n<span class=\"hljs-keyword\">const</span> cookie = { <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'http://www.github.com'</span>, <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'dummy_name'</span>, <span class=\"hljs-attr\">value</span>: <span class=\"hljs-string\">'dummy'</span> }\nsession.defaultSession.cookies.set(cookie)\n  .then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// success</span>\n  }, (error) => {\n    <span class=\"hljs-built_in\">console</span>.error(error)\n  })\n</code></pre>\n<h3 id=\"instance-events\"><a href=\"#instance-events\">Instance Events</a></h3>\n<p>The following events are available on instances of <code>Cookies</code>:</p>\n<h4 id=\"event-changed\"><a href=\"#event-changed\">Event: 'changed'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>cookie</code> <a href=\"/docs/api/structures/cookie\">Cookie</a> - The cookie that was changed.</li>\n<li><code>cause</code> String - The cause of the change with one of the following values:<ul>\n<li><code>explicit</code> - The cookie was changed directly by a consumer's action.</li>\n<li><code>overwrite</code> - The cookie was automatically removed due to an insert\noperation that overwrote it.</li>\n<li><code>expired</code> - The cookie was automatically removed as it expired.</li>\n<li><code>evicted</code> - The cookie was automatically evicted during garbage collection.</li>\n<li><code>expired-overwrite</code> - The cookie was overwritten with an already-expired\nexpiration date.</li>\n</ul></li>\n<li><code>removed</code> Boolean - <code>true</code> if the cookie was removed, <code>false</code> otherwise.</li>\n</ul>\n<p>Emitted when a cookie is changed because it was added, edited, removed, or\nexpired.</p>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<p>The following methods are available on instances of <code>Cookies</code>:</p>\n<h4 id=\"cookiesgetfilter\"><a href=\"#cookiesgetfilter\"><code>cookies.get(filter)</code></a></h4>\n<ul>\n<li><code>filter</code> Object<ul>\n<li><code>url</code> String (optional) - Retrieves cookies which are associated with\n<code>url</code>. Empty implies retrieving cookies of all URLs.</li>\n<li><code>name</code> String (optional) - Filters cookies by name.</li>\n<li><code>domain</code> String (optional) - Retrieves cookies whose domains match or are\nsubdomains of <code>domains</code>.</li>\n<li><code>path</code> String (optional) - Retrieves cookies whose path matches <code>path</code>.</li>\n<li><code>secure</code> Boolean (optional) - Filters cookies by their Secure property.</li>\n<li><code>session</code> Boolean (optional) - Filters out session or persistent cookies.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Cookie[]></code> - A promise which resolves an array of cookie objects.</p>\n<p>Sends a request to get all cookies matching <code>filter</code>, and resolves a promise with\nthe response.</p>\n<h4 id=\"cookiessetdetails\"><a href=\"#cookiessetdetails\"><code>cookies.set(details)</code></a></h4>\n<ul>\n<li><code>details</code> Object<ul>\n<li><code>url</code> String - The URL to associate the cookie with. The promise will be rejected if the URL is invalid.</li>\n<li><code>name</code> String (optional) - The name of the cookie. Empty by default if omitted.</li>\n<li><code>value</code> String (optional) - The value of the cookie. Empty by default if omitted.</li>\n<li><code>domain</code> String (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains. Empty by default if omitted.</li>\n<li><code>path</code> String (optional) - The path of the cookie. Empty by default if omitted.</li>\n<li><code>secure</code> Boolean (optional) - Whether the cookie should be marked as Secure. Defaults to\nfalse unless <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite#samesitenone_requires_secure\">Same Site=None</a> attribute is used.</li>\n<li><code>httpOnly</code> Boolean (optional) - Whether the cookie should be marked as HTTP only.\nDefaults to false.</li>\n<li><code>expirationDate</code> Double (optional) - The expiration date of the cookie as the number of\nseconds since the UNIX epoch. If omitted then the cookie becomes a session\ncookie and will not be retained between sessions.</li>\n<li><code>sameSite</code> String (optional) - The <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies\">Same Site</a> policy to apply to this cookie.  Can be <code>unspecified</code>, <code>no_restriction</code>, <code>lax</code> or <code>strict</code>.  Default is <code>no_restriction</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - A promise which resolves when the cookie has been set</p>\n<p>Sets a cookie with <code>details</code>.</p>\n<h4 id=\"cookiesremoveurl-name\"><a href=\"#cookiesremoveurl-name\"><code>cookies.remove(url, name)</code></a></h4>\n<ul>\n<li><code>url</code> String - The URL associated with the cookie.</li>\n<li><code>name</code> String - The name of cookie to remove.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - A promise which resolves when the cookie has been removed</p>\n<p>Removes the cookies matching <code>url</code> and <code>name</code></p>\n<h4 id=\"cookiesflushstore\"><a href=\"#cookiesflushstore\"><code>cookies.flushStore()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - A promise which resolves when the cookie store has been flushed</p>\n<p>Writes any unwritten cookies data to disk.</p>",
      "title": "Cookies",
      "description": "Query and modify a session's cookies."
    },
    "/docs/api/structures/cpu-usage": {
      "locale": "en-US",
      "slug": "cpu-usage",
      "href": "/docs/api/structures/cpu-usage",
      "crowdinFileId": "256419",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/cpu-usage.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"cpuusage-object\"><a href=\"#cpuusage-object\">CPUUsage Object</a></h1>\n<ul>\n<li><code>percentCPUUsage</code> Number - Percentage of CPU used since the last call to getCPUUsage.\nFirst call returns 0.</li>\n<li><code>idleWakeupsPerSecond</code> Number - The number of average idle CPU wakeups per second\nsince the last call to getCPUUsage. First call returns 0. Will always return 0 on\nWindows.</li>\n</ul>",
      "title": "CPUUsage Object",
      "description": ""
    },
    "/docs/api/structures/crash-report": {
      "locale": "en-US",
      "slug": "crash-report",
      "href": "/docs/api/structures/crash-report",
      "crowdinFileId": "256421",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/crash-report.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"crashreport-object\"><a href=\"#crashreport-object\">CrashReport Object</a></h1>\n<ul>\n<li><code>date</code> Date</li>\n<li><code>id</code> String</li>\n</ul>",
      "title": "CrashReport Object",
      "description": ""
    },
    "/docs/api/crash-reporter": {
      "locale": "en-US",
      "slug": "crash-reporter",
      "href": "/docs/api/crash-reporter",
      "crowdinFileId": "256303",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/crash-reporter.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"crashreporter\"><a href=\"#crashreporter\">crashReporter</a></h1>\n<blockquote>\n<p>Submit crash reports to a remote server.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>The following is an example of setting up Electron to automatically submit\ncrash reports to a remote server:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { crashReporter } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncrashReporter.start({ <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://your-domain.com/url-to-submit'</span> })\n</code></pre>\n<p>For setting up a server to accept and process crash reports, you can use\nfollowing projects:</p>\n<ul>\n<li><a href=\"https://github.com/mozilla/socorro\">socorro</a></li>\n<li><a href=\"https://github.com/electron/mini-breakpad-server\">mini-breakpad-server</a></li>\n</ul>\n<p>Or use a 3rd party hosted solution:</p>\n<ul>\n<li><a href=\"https://backtrace.io/electron/\">Backtrace</a></li>\n<li><a href=\"https://docs.sentry.io/clients/electron\">Sentry</a></li>\n<li><a href=\"https://www.bugsplat.com/docs/platforms/electron\">BugSplat</a></li>\n</ul>\n<p>Crash reports are stored temporarily before being uploaded in a directory\nunderneath the app's user data directory (called 'Crashpad' on Windows and Mac,\nor 'Crash Reports' on Linux). You can override this directory by calling\n<code>app.setPath('crashDumps', '/path/to/crashes')</code> before starting the crash\nreporter.</p>\n<p>On Windows and macOS, Electron uses\n<a href=\"https://chromium.googlesource.com/crashpad/crashpad/+/master/README.md\">crashpad</a>\nto monitor and report crashes. On Linux, Electron uses\n<a href=\"https://chromium.googlesource.com/breakpad/breakpad/+/master/\">breakpad</a>. This\nis an implementation detail driven by Chromium, and it may change in future. In\nparticular, crashpad is newer and will likely eventually replace breakpad on\nall platforms.</p>\n<h3 id=\"note-about-node-child-processes-on-linux\"><a href=\"#note-about-node-child-processes-on-linux\">Note about Node child processes on Linux</a></h3>\n<p>If you are using the Node.js <code>child_process</code> module and want to report crashes\nfrom those processes on Linux, there is an extra step you will need to take to\nproperly initialize the crash reporter in the child process. This is not\nnecessary on Mac or Windows, as those platforms use Crashpad, which\nautomatically monitors child processes.</p>\n<p>Since <code>require('electron')</code> is not available in Node child processes, the\nfollowing APIs are available on the <code>process</code> object in Node child processes.\nNote that, on Linux, each Node child process has its own separate instance of\nthe breakpad crash reporter. This is dissimilar to renderer child processes,\nwhich have a \"stub\" breakpad reporter which returns information to the main\nprocess for reporting.</p>\n<h4 id=\"processcrashreporterstartoptions\"><a href=\"#processcrashreporterstartoptions\"><code>process.crashReporter.start(options)</code></a></h4>\n<p>See <a href=\"#crashreporterstartoptions\"><code>crashReporter.start()</code></a>.</p>\n<h4 id=\"processcrashreportergetparameters\"><a href=\"#processcrashreportergetparameters\"><code>process.crashReporter.getParameters()</code></a></h4>\n<p>See <a href=\"#crashreportergetparameters\"><code>crashReporter.getParameters()</code></a>.</p>\n<h4 id=\"processcrashreporteraddextraparameterkey-value\"><a href=\"#processcrashreporteraddextraparameterkey-value\"><code>process.crashReporter.addExtraParameter(key, value)</code></a></h4>\n<p>See <a href=\"#crashreporteraddextraparameterkey-value\"><code>crashReporter.addExtraParameter(key, value)</code></a>.</p>\n<h4 id=\"processcrashreporterremoveextraparameterkey\"><a href=\"#processcrashreporterremoveextraparameterkey\"><code>process.crashReporter.removeExtraParameter(key)</code></a></h4>\n<p>See <a href=\"#crashreporterremoveextraparameterkey\"><code>crashReporter.removeExtraParameter(key)</code></a>.</p>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>crashReporter</code> module has the following methods:</p>\n<h3 id=\"crashreporterstartoptions\"><a href=\"#crashreporterstartoptions\"><code>crashReporter.start(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>submitURL</code> String (optional) - URL that crash reports will be sent to as\nPOST. Required unless <code>uploadToServer</code> is <code>false</code>.</li>\n<li><code>productName</code> String (optional) - Defaults to <code>app.name</code>.</li>\n<li><code>companyName</code> String (optional) <em>Deprecated</em> - Deprecated alias for\n<code>{ globalExtra: { _companyName: ... } }</code>.</li>\n<li><code>uploadToServer</code> Boolean (optional) - Whether crash reports should be sent\nto the server. If false, crash reports will be collected and stored in the\ncrashes directory, but not uploaded. Default is <code>true</code>.</li>\n<li><code>ignoreSystemCrashHandler</code> Boolean (optional) - If true, crashes generated\nin the main process will not be forwarded to the system crash handler.\nDefault is <code>false</code>.</li>\n<li><code>rateLimit</code> Boolean (optional) <em>macOS</em> <em>Windows</em> - If true, limit the\nnumber of crashes uploaded to 1/hour. Default is <code>false</code>.</li>\n<li><code>compress</code> Boolean (optional) - If true, crash reports will be compressed\nand uploaded with <code>Content-Encoding: gzip</code>. Default is <code>true</code>.</li>\n<li><code>extra</code> Record&#x3C;String, String> (optional) - Extra string key/value\nannotations that will be sent along with crash reports that are generated\nin the main process. Only string values are supported. Crashes generated in\nchild processes will not contain these extra\nparameters to crash reports generated from child processes, call\n<a href=\"#crashreporteraddextraparameterkey-value\"><code>addExtraParameter</code></a> from the\nchild process.</li>\n<li><code>globalExtra</code> Record&#x3C;String, String> (optional) - Extra string key/value\nannotations that will be sent along with any crash reports generated in any\nprocess. These annotations cannot be changed once the crash reporter has\nbeen started. If a key is present in both the global extra parameters and\nthe process-specific extra parameters, then the global one will take\nprecedence. By default, <code>productName</code> and the app version are included, as\nwell as the Electron version.</li>\n</ul></li>\n</ul>\n<p>This method must be called before using any other <code>crashReporter</code> APIs. Once\ninitialized this way, the crashpad handler collects crashes from all\nsubsequently created processes. The crash reporter cannot be disabled once\nstarted.</p>\n<p>This method should be called as early as possible in app startup, preferably\nbefore <code>app.on('ready')</code>. If the crash reporter is not initialized at the time\na renderer process is created, then that renderer process will not be monitored\nby the crash reporter.</p>\n<p><strong>Note:</strong> You can test out the crash reporter by generating a crash using\n<code>process.crash()</code>.</p>\n<p><strong>Note:</strong> If you need to send additional/updated <code>extra</code> parameters after your\nfirst call <code>start</code> you can call <code>addExtraParameter</code>.</p>\n<p><strong>Note:</strong> Parameters passed in <code>extra</code>, <code>globalExtra</code> or set with\n<code>addExtraParameter</code> have limits on the length of the keys and values. Key names\nmust be at most 39 bytes long, and values must be no longer than 127 bytes.\nKeys with names longer than the maximum will be silently ignored. Key values\nlonger than the maximum length will be truncated.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportergetlastcrashreport\"><a href=\"#crashreportergetlastcrashreport\"><code>crashReporter.getLastCrashReport()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/crash-report\"><code>CrashReport</code></a> - The date and ID of the\nlast crash report. Only crash reports that have been uploaded will be returned;\neven if a crash report is present on disk it will not be returned until it is\nuploaded. In the case that there are no uploaded reports, <code>null</code> is returned.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportergetuploadedreports\"><a href=\"#crashreportergetuploadedreports\"><code>crashReporter.getUploadedReports()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/crash-report\"><code>CrashReport[]</code></a>:</p>\n<p>Returns all uploaded crash reports. Each report contains the date and uploaded\nID.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportergetuploadtoserver\"><a href=\"#crashreportergetuploadtoserver\"><code>crashReporter.getUploadToServer()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether reports should be submitted to the server. Set through\nthe <code>start</code> method or <code>setUploadToServer</code>.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportersetuploadtoserveruploadtoserver\"><a href=\"#crashreportersetuploadtoserveruploadtoserver\"><code>crashReporter.setUploadToServer(uploadToServer)</code></a></h3>\n<ul>\n<li><code>uploadToServer</code> Boolean - Whether reports should be submitted to the server.</li>\n</ul>\n<p>This would normally be controlled by user preferences. This has no effect if\ncalled before <code>start</code> is called.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreporteraddextraparameterkey-value\"><a href=\"#crashreporteraddextraparameterkey-value\"><code>crashReporter.addExtraParameter(key, value)</code></a></h3>\n<ul>\n<li><code>key</code> String - Parameter key, must be no longer than 39 bytes.</li>\n<li><code>value</code> String - Parameter value, must be no longer than 127 bytes.</li>\n</ul>\n<p>Set an extra parameter to be sent with the crash report. The values specified\nhere will be sent in addition to any values set via the <code>extra</code> option when\n<code>start</code> was called.</p>\n<p>Parameters added in this fashion (or via the <code>extra</code> parameter to\n<code>crashReporter.start</code>) are specific to the calling process. Adding extra\nparameters in the main process will not cause those parameters to be sent along\nwith crashes from renderer or other child processes. Similarly, adding extra\nparameters in a renderer process will not result in those parameters being sent\nwith crashes that occur in other renderer processes or in the main process.</p>\n<p><strong>Note:</strong> Parameters have limits on the length of the keys and values. Key\nnames must be no longer than 39 bytes, and values must be no longer than 20320\nbytes. Keys with names longer than the maximum will be silently ignored. Key\nvalues longer than the maximum length will be truncated.</p>\n<p><strong>Note:</strong> On linux values that are longer than 127 bytes will be chunked into\nmultiple keys, each 127 bytes in length.  E.g. <code>addExtraParameter('foo', 'a'.repeat(130))</code>\nwill result in two chunked keys <code>foo__1</code> and <code>foo__2</code>, the first will contain\nthe first 127 bytes and the second will contain the remaining 3 bytes.  On\nyour crash reporting backend you should stitch together keys in this format.</p>\n<h3 id=\"crashreporterremoveextraparameterkey\"><a href=\"#crashreporterremoveextraparameterkey\"><code>crashReporter.removeExtraParameter(key)</code></a></h3>\n<ul>\n<li><code>key</code> String - Parameter key, must be no longer than 39 bytes.</li>\n</ul>\n<p>Remove an extra parameter from the current set of parameters. Future crashes\nwill not include this parameter.</p>\n<h3 id=\"crashreportergetparameters\"><a href=\"#crashreportergetparameters\"><code>crashReporter.getParameters()</code></a></h3>\n<p>Returns <code>Record&#x3C;String, String></code> - The current 'extra' parameters of the crash reporter.</p>\n<h2 id=\"crash-report-payload\"><a href=\"#crash-report-payload\">Crash Report Payload</a></h2>\n<p>The crash reporter will send the following data to the <code>submitURL</code> as\na <code>multipart/form-data</code> <code>POST</code>:</p>\n<ul>\n<li><code>ver</code> String - The version of Electron.</li>\n<li><code>platform</code> String - e.g. 'win32'.</li>\n<li><code>process_type</code> String - e.g. 'renderer'.</li>\n<li><code>guid</code> String - e.g. '5e1286fc-da97-479e-918b-6bfb0c3d1c72'.</li>\n<li><code>_version</code> String - The version in <code>package.json</code>.</li>\n<li><code>_productName</code> String - The product name in the <code>crashReporter</code> <code>options</code>\nobject.</li>\n<li><code>prod</code> String - Name of the underlying product. In this case Electron.</li>\n<li><code>_companyName</code> String - The company name in the <code>crashReporter</code> <code>options</code>\nobject.</li>\n<li><code>upload_file_minidump</code> File - The crash report in the format of <code>minidump</code>.</li>\n<li>All level one properties of the <code>extra</code> object in the <code>crashReporter</code>\n<code>options</code> object.</li>\n</ul>",
      "title": "crashReporter",
      "description": "Submit crash reports to a remote server."
    },
    "/docs/api/structures/custom-scheme": {
      "locale": "en-US",
      "slug": "custom-scheme",
      "href": "/docs/api/structures/custom-scheme",
      "crowdinFileId": "256423",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/custom-scheme.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"customscheme-object\"><a href=\"#customscheme-object\">CustomScheme Object</a></h1>\n<ul>\n<li><code>scheme</code> String - Custom schemes to be registered with options.</li>\n<li><code>privileges</code> Object (optional)<ul>\n<li><code>standard</code> Boolean (optional) - Default false.</li>\n<li><code>secure</code> Boolean (optional) - Default false.</li>\n<li><code>bypassCSP</code> Boolean (optional) - Default false.</li>\n<li><code>allowServiceWorkers</code> Boolean (optional) - Default false.</li>\n<li><code>supportFetchAPI</code> Boolean (optional) - Default false.</li>\n<li><code>corsEnabled</code> Boolean (optional) - Default false.</li>\n<li><code>stream</code> Boolean (optional) - Default false.</li>\n</ul></li>\n</ul>",
      "title": "CustomScheme Object",
      "description": ""
    },
    "/docs/tutorial/dark-mode": {
      "locale": "en-US",
      "slug": "dark-mode",
      "href": "/docs/tutorial/dark-mode",
      "crowdinFileId": "256187",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/dark-mode.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dark-mode\"><a href=\"#dark-mode\">Dark Mode</a></h1>\n<h2 id=\"overview\"><a href=\"#overview\">Overview</a></h2>\n<h3 id=\"automatically-update-the-native-interfaces\"><a href=\"#automatically-update-the-native-interfaces\">Automatically update the native interfaces</a></h3>\n<p>\"Native interfaces\" include the file picker, window border, dialogs, context\nmenus, and more - anything where the UI comes from your operating system and\nnot from your app. The default behavior is to opt into this automatic theming\nfrom the OS.</p>\n<h3 id=\"automatically-update-your-own-interfaces\"><a href=\"#automatically-update-your-own-interfaces\">Automatically update your own interfaces</a></h3>\n<p>If your app has its own dark mode, you should toggle it on and off in sync with\nthe system's dark mode setting. You can do this by using the\n[prefer-color-scheme] CSS media query.</p>\n<h3 id=\"manually-update-your-own-interfaces\"><a href=\"#manually-update-your-own-interfaces\">Manually update your own interfaces</a></h3>\n<p>If you want to manually switch between light/dark modes, you can do this by\nsetting the desired mode in the\n<a href=\"/docs/api/native-theme#nativethemethemesource\">themeSource</a>\nproperty of the <code>nativeTheme</code> module. This property's value will be propagated\nto your Renderer process. Any CSS rules related to <code>prefers-color-scheme</code> will\nbe updated accordingly.</p>\n<h2 id=\"macos-settings\"><a href=\"#macos-settings\">macOS settings</a></h2>\n<p>In macOS 10.14 Mojave, Apple introduced a new <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/dark-mode/\">system-wide dark mode</a>\nfor all macOS computers. If your Electron app has a dark mode, you can make it\nfollow the system-wide dark mode setting using\n<a href=\"/docs/api/native-theme\">the <code>nativeTheme</code> api</a>.</p>\n<p>In macOS 10.15 Catalina, Apple introduced a new \"automatic\" dark mode option\nfor all macOS computers. In order for the <code>nativeTheme.shouldUseDarkColors</code> and\n<code>Tray</code> APIs to work correctly in this mode on Catalina, you need to use Electron\n<code>>=7.0.0</code>, or set <code>NSRequiresAquaSystemAppearance</code> to <code>false</code> in your\n<code>Info.plist</code> file for older versions. Both <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a>\nand <a href=\"https://www.electronforge.io/\">Electron Forge</a> have a\n<a href=\"https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html#darwindarkmodesupport\"><code>darwinDarkModeSupport</code> option</a>\nto automate the <code>Info.plist</code> changes during app build time.</p>\n<p>If you wish to opt-out while using Electron > 8.0.0, you must\nset the <code>NSRequiresAquaSystemAppearance</code> key in the <code>Info.plist</code> file to\n<code>true</code>. Please note that Electron 8.0.0 and above will not let you opt-out\nof this theming, due to the use of the macOS 10.14 SDK.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<p>This example demonstrates an Electron application that derives its theme colors from the\n<code>nativeTheme</code>. Additionally, it provides theme toggle and reset controls using IPC channels.</p>\n<h3 id=\"how-does-this-work\"><a href=\"#how-does-this-work\">How does this work?</a></h3>\n<p>Starting with the <code>index.html</code> file:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"script-src 'self' 'unsafe-inline';\"</span> /></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/css\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"./styles.css\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">p</span>></span>Current theme source: <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">strong</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"theme-source\"</span>></span>System<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">strong</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">p</span>></span>\n\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"toggle-dark-mode\"</span>></span>Toggle Dark Mode<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">button</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"reset-to-system\"</span>></span>Reset to System Theme<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">button</span>></span>\n\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>And the <code>styles.css</code> file:</p>\n<pre><code class=\"hljs language-css\">@<span class=\"hljs-keyword\">media</span> (prefers-color-scheme: dark) {\n  <span class=\"hljs-selector-tag\">body</span> { <span class=\"hljs-attribute\">background</span>: <span class=\"hljs-number\">#333</span>; <span class=\"hljs-attribute\">color</span>: white; }\n}\n\n@<span class=\"hljs-keyword\">media</span> (prefers-color-scheme: light) {\n  <span class=\"hljs-selector-tag\">body</span> { <span class=\"hljs-attribute\">background</span>: <span class=\"hljs-number\">#ddd</span>; <span class=\"hljs-attribute\">color</span>: black; }\n}\n</code></pre>\n<p>The example renders an HTML page with a couple elements. The <code>&#x3C;strong id=\"theme-source\"></code>\nelement shows which theme is currently selected, and the two <code>&#x3C;button></code> elements are the\ncontrols. The CSS file uses the <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> media query\nto set the <code>&#x3C;body></code> element background and text colors.</p>\n<p>The <code>preload.js</code> script adds a new API to the <code>window</code> object called <code>darkMode</code>. This API\nexposes two IPC channels to the renderer process, <code>'dark-mode:toggle'</code> and <code>'dark-mode:system'</code>.\nIt also assigns two methods, <code>toggle</code> and <code>system</code>, which pass messages from the renderer to the\nmain process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'darkMode'</span>, {\n  <span class=\"hljs-attr\">toggle</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'dark-mode:toggle'</span>),\n  <span class=\"hljs-attr\">system</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'dark-mode:system'</span>)\n})\n</code></pre>\n<p>Now the renderer process can communicate with the main process securely and perform the necessary\nmutations to the <code>nativeTheme</code> object.</p>\n<p>The <code>renderer.js</code> file is responsible for controlling the <code>&#x3C;button></code> functionality.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'toggle-dark-mode'</span>).addEventListener(<span class=\"hljs-string\">'click'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> isDarkMode = <span class=\"hljs-keyword\">await</span> <span class=\"hljs-built_in\">window</span>.darkMode.toggle()\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'theme-source'</span>).innerHTML = isDarkMode ? <span class=\"hljs-string\">'Dark'</span> : <span class=\"hljs-string\">'Light'</span>\n})\n\n<span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'reset-to-system'</span>).addEventListener(<span class=\"hljs-string\">'click'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> <span class=\"hljs-built_in\">window</span>.darkMode.system()\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'theme-source'</span>).innerHTML = <span class=\"hljs-string\">'System'</span>\n})\n</code></pre>\n<p>Using <code>addEventListener</code>, the <code>renderer.js</code> file adds <code>'click'</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\">event listeners</a>\nto each button element. Each event listener handler makes calls to the respective <code>window.darkMode</code>\nAPI methods.</p>\n<p>Finally, the <code>main.js</code> file represents the main process and contains the actual <code>nativeTheme</code> API.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, ipcMain, nativeTheme } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  ipcMain.handle(<span class=\"hljs-string\">'dark-mode:toggle'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (nativeTheme.shouldUseDarkColors) {\n      nativeTheme.themeSource = <span class=\"hljs-string\">'light'</span>\n    } <span class=\"hljs-keyword\">else</span> {\n      nativeTheme.themeSource = <span class=\"hljs-string\">'dark'</span>\n    }\n    <span class=\"hljs-keyword\">return</span> nativeTheme.shouldUseDarkColors\n  })\n\n  ipcMain.handle(<span class=\"hljs-string\">'dark-mode:system'</span>, () => {\n    nativeTheme.themeSource = <span class=\"hljs-string\">'system'</span>\n  })\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n      createWindow()\n    }\n  })\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n</code></pre>\n<p>The <code>ipcMain.handle</code> methods are how the main process responds to the click events from the buttons\non the HTML page.</p>\n<p>The <code>'dark-mode:toggle'</code> IPC channel handler method checks the <code>shouldUseDarkColors</code> boolean property,\nsets the corresponding <code>themeSource</code>, and then returns the current <code>shouldUseDarkColors</code> property.\nLooking back on the renderer process event listener for this IPC channel, the return value from this\nhandler is utilized to assign the correct text to the <code>&#x3C;strong id='theme-source'></code> element.</p>\n<p>The <code>'dark-mode:system'</code> IPC channel handler method assigns the string <code>'system'</code> to the <code>themeSource</code>\nand returns nothing. This also corresponds with the relative renderer process event listener as the\nmethod is awaited with no return value expected.</p>\n<p>Run the example using Electron Fiddle and then click the \"Toggle Dark Mode\" button; the app should\nstart alternating between a light and dark background color.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/dark_mode.gif\" alt=\"Dark Mode\"></p>",
      "title": "Dark Mode",
      "description": ""
    },
    "/docs/development/debug-instructions-windows": {
      "locale": "en-US",
      "slug": "debug-instructions-windows",
      "href": "/docs/development/debug-instructions-windows",
      "crowdinFileId": "256149",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debug-instructions-windows.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"debugging-on-windows\"><a href=\"#debugging-on-windows\">Debugging on Windows</a></h1>\n<p>If you experience crashes or issues in Electron that you believe are not caused\nby your JavaScript application, but instead by Electron itself, debugging can\nbe a little bit tricky, especially for developers not used to native/C++\ndebugging. However, using Visual Studio, Electron's hosted Symbol Server,\nand the Electron source code, you can enable step-through debugging\nwith breakpoints inside Electron's source code.</p>\n<p><strong>See also</strong>: There's a wealth of information on debugging Chromium, much of which also applies to Electron, on the Chromium developers site: <a href=\"https://www.chromium.org/developers/how-tos/debugging-on-windows\">Debugging Chromium on Windows</a>.</p>\n<h2 id=\"requirements\"><a href=\"#requirements\">Requirements</a></h2>\n<ul>\n<li>\n<p><strong>A debug build of Electron</strong>: The easiest way is usually building it\nyourself, using the tools and prerequisites listed in the\n<a href=\"/docs/development/build-instructions-windows\">build instructions for Windows</a>. While you can\nattach to and debug Electron as you can download it directly, you will\nfind that it is heavily optimized, making debugging substantially more\ndifficult: The debugger will not be able to show you the content of all\nvariables and the execution path can seem strange because of inlining,\ntail calls, and other compiler optimizations.</p>\n</li>\n<li>\n<p><strong>Visual Studio with C++ Tools</strong>: The free community editions of Visual\nStudio 2013 and Visual Studio 2015 both work. Once installed,\n<a href=\"/docs/development/setting-up-symbol-server\">configure Visual Studio to use Electron's Symbol server</a>.\nIt will enable Visual Studio to gain a better understanding of what happens\ninside Electron, making it easier to present variables in a human-readable\nformat.</p>\n</li>\n<li>\n<p><strong>ProcMon</strong>: The <a href=\"https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx\">free SysInternals tool</a> allows you to inspect\na processes parameters, file handles, and registry operations.</p>\n</li>\n</ul>\n<h2 id=\"attaching-to-and-debugging-electron\"><a href=\"#attaching-to-and-debugging-electron\">Attaching to and Debugging Electron</a></h2>\n<p>To start a debugging session, open up PowerShell/CMD and execute your debug\nbuild of Electron, using the application to open as a parameter.</p>\n<pre><code class=\"hljs language-powershell\">$ ./out/Testing/electron.exe ~/my-electron-app/\n</code></pre>\n<h3 id=\"setting-breakpoints\"><a href=\"#setting-breakpoints\">Setting Breakpoints</a></h3>\n<p>Then, open up Visual Studio. Electron is not built with Visual Studio and hence\ndoes not contain a project file - you can however open up the source code files\n\"As File\", meaning that Visual Studio will open them up by themselves. You can\nstill set breakpoints - Visual Studio will automatically figure out that the\nsource code matches the code running in the attached process and break\naccordingly.</p>\n<p>Relevant code files can be found in <code>./shell/</code>.</p>\n<h3 id=\"attaching\"><a href=\"#attaching\">Attaching</a></h3>\n<p>You can attach the Visual Studio debugger to a running process on a local or\nremote computer. After the process is running, click Debug / Attach to Process\n(or press <code>CTRL+ALT+P</code>) to open the \"Attach to Process\" dialog box. You can use\nthis capability to debug apps that are running on a local or remote computer,\ndebug multiple processes simultaneously.</p>\n<p>If Electron is running under a different user account, select the\n<code>Show processes from all users</code> check box. Notice that depending on how many\nBrowserWindows your app opened, you will see multiple processes. A typical\none-window app will result in Visual Studio presenting you with two\n<code>Electron.exe</code> entries - one for the main process and one for the renderer\nprocess. Since the list only gives you names, there's currently no reliable\nway of figuring out which is which.</p>\n<h3 id=\"which-process-should-i-attach-to\"><a href=\"#which-process-should-i-attach-to\">Which Process Should I Attach to?</a></h3>\n<p>Code executed within the main process (that is, code found in or eventually run\nby your main JavaScript file) will run inside the main process, while other\ncode will execute inside its respective renderer process.</p>\n<p>You can be attached to multiple programs when you are debugging, but only one\nprogram is active in the debugger at any time. You can set the active program\nin the <code>Debug Location</code> toolbar or the <code>Processes window</code>.</p>\n<h2 id=\"using-procmon-to-observe-a-process\"><a href=\"#using-procmon-to-observe-a-process\">Using ProcMon to Observe a Process</a></h2>\n<p>While Visual Studio is fantastic for inspecting specific code paths, ProcMon's\nstrength is really in observing everything your application is doing with the\noperating system - it captures File, Registry, Network, Process, and Profiling\ndetails of processes. It attempts to log <strong>all</strong> events occurring and can be\nquite overwhelming, but if you seek to understand what and how your application\nis doing to the operating system, it can be a valuable resource.</p>\n<p>For an introduction to ProcMon's basic and advanced debugging features, go check\nout <a href=\"https://channel9.msdn.com/shows/defrag-tools/defrag-tools-4-process-monitor\">this video tutorial</a> provided by Microsoft.</p>",
      "title": "Debugging on Windows",
      "description": ""
    },
    "/docs/api/debugger": {
      "locale": "en-US",
      "slug": "debugger",
      "href": "/docs/api/debugger",
      "crowdinFileId": "256305",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/debugger.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-debugger\"><a href=\"#class-debugger\">Class: Debugger</a></h2>\n<blockquote>\n<p>An alternate transport for Chrome's remote debugging protocol.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Chrome Developer Tools has a <a href=\"https://chromedevtools.github.io/devtools-protocol/\">special binding</a> available at JavaScript\nruntime that allows interacting with pages and instrumenting them.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-keyword\">try</span> {\n  win.webContents.debugger.attach(<span class=\"hljs-string\">'1.1'</span>)\n} <span class=\"hljs-keyword\">catch</span> (err) {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Debugger attach failed : '</span>, err)\n}\n\nwin.webContents.debugger.on(<span class=\"hljs-string\">'detach'</span>, (event, reason) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Debugger detached due to : '</span>, reason)\n})\n\nwin.webContents.debugger.on(<span class=\"hljs-string\">'message'</span>, (event, method, params) => {\n  <span class=\"hljs-keyword\">if</span> (method === <span class=\"hljs-string\">'Network.requestWillBeSent'</span>) {\n    <span class=\"hljs-keyword\">if</span> (params.request.url === <span class=\"hljs-string\">'https://www.github.com'</span>) {\n      win.webContents.debugger.detach()\n    }\n  }\n})\n\nwin.webContents.debugger.sendCommand(<span class=\"hljs-string\">'Network.enable'</span>)\n</code></pre>\n<h3 id=\"instance-events\"><a href=\"#instance-events\">Instance Events</a></h3>\n<h4 id=\"event-detach\"><a href=\"#event-detach\">Event: 'detach'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>reason</code> String - Reason for detaching debugger.</li>\n</ul>\n<p>Emitted when the debugging session is terminated. This happens either when\n<code>webContents</code> is closed or devtools is invoked for the attached <code>webContents</code>.</p>\n<h4 id=\"event-message\"><a href=\"#event-message\">Event: 'message'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>method</code> String - Method name.</li>\n<li><code>params</code> any - Event parameters defined by the 'parameters'\nattribute in the remote debugging protocol.</li>\n<li><code>sessionId</code> String - Unique identifier of attached debugging session,\nwill match the value sent from <code>debugger.sendCommand</code>.</li>\n</ul>\n<p>Emitted whenever the debugging target issues an instrumentation event.</p>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<h4 id=\"debuggerattachprotocolversion\"><a href=\"#debuggerattachprotocolversion\"><code>debugger.attach([protocolVersion])</code></a></h4>\n<ul>\n<li><code>protocolVersion</code> String (optional) - Requested debugging protocol version.</li>\n</ul>\n<p>Attaches the debugger to the <code>webContents</code>.</p>\n<h4 id=\"debuggerisattached\"><a href=\"#debuggerisattached\"><code>debugger.isAttached()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether a debugger is attached to the <code>webContents</code>.</p>\n<h4 id=\"debuggerdetach\"><a href=\"#debuggerdetach\"><code>debugger.detach()</code></a></h4>\n<p>Detaches the debugger from the <code>webContents</code>.</p>\n<h4 id=\"debuggersendcommandmethod-commandparams-sessionid\"><a href=\"#debuggersendcommandmethod-commandparams-sessionid\"><code>debugger.sendCommand(method[, commandParams, sessionId])</code></a></h4>\n<ul>\n<li><code>method</code> String - Method name, should be one of the methods defined by the\n<a href=\"https://chromedevtools.github.io/devtools-protocol/\">remote debugging protocol</a>.</li>\n<li><code>commandParams</code> any (optional) - JSON object with request parameters.</li>\n<li><code>sessionId</code> String (optional) - send command to the target with associated\ndebugging session id. The initial value can be obtained by sending\n<a href=\"https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-attachToTarget\">Target.attachToTarget</a> message.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the response defined by\nthe 'returns' attribute of the command description in the remote debugging protocol\nor is rejected indicating the failure of the command.</p>\n<p>Send given command to the debugging target.</p>",
      "title": "Debugger",
      "description": "An alternate transport for Chrome's remote debugging protocol."
    },
    "/docs/development/debugging-instructions-macos": {
      "locale": "en-US",
      "slug": "debugging-instructions-macos",
      "href": "/docs/development/debugging-instructions-macos",
      "crowdinFileId": "256153",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debugging-instructions-macos.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"debugging-on-macos\"><a href=\"#debugging-on-macos\">Debugging on macOS</a></h1>\n<p>If you experience crashes or issues in Electron that you believe are not caused\nby your JavaScript application, but instead by Electron itself, debugging can\nbe a little bit tricky, especially for developers not used to native/C++\ndebugging. However, using lldb, and the Electron source code, you can enable\nstep-through debugging with breakpoints inside Electron's source code.\nYou can also use <a href=\"/docs/development/debugging-instructions-macos-xcode\">XCode for debugging</a> if\nyou prefer a graphical interface.</p>\n<h2 id=\"requirements\"><a href=\"#requirements\">Requirements</a></h2>\n<ul>\n<li>\n<p><strong>A debug build of Electron</strong>: The easiest way is usually building it\nyourself, using the tools and prerequisites listed in the\n<a href=\"/docs/development/build-instructions-macos\">build instructions for macOS</a>. While you can\nattach to and debug Electron as you can download it directly, you will\nfind that it is heavily optimized, making debugging substantially more\ndifficult: The debugger will not be able to show you the content of all\nvariables and the execution path can seem strange because of inlining,\ntail calls, and other compiler optimizations.</p>\n</li>\n<li>\n<p><strong>Xcode</strong>: In addition to Xcode, also install the Xcode command line tools.\nThey include LLDB, the default debugger in Xcode on macOS. It supports\ndebugging C, Objective-C and C++ on the desktop and iOS devices and simulator.</p>\n</li>\n<li>\n<p><strong>.lldbinit</strong>: Create or edit <code>~/.lldbinit</code> to allow Chromium code to be properly source-mapped.</p>\n<pre><code class=\"hljs language-plaintext\"># e.g: ['~/electron/src/tools/lldb']\nscript sys.path[:0] = ['&#x3C;...path/to/electron/src/tools/lldb>']\nscript import lldbinit\n</code></pre>\n</li>\n</ul>\n<h2 id=\"attaching-to-and-debugging-electron\"><a href=\"#attaching-to-and-debugging-electron\">Attaching to and Debugging Electron</a></h2>\n<p>To start a debugging session, open up Terminal and start <code>lldb</code>, passing a non-release\nbuild of Electron as a parameter.</p>\n<pre><code class=\"hljs language-sh\">$ lldb ./out/Testing/Electron.app\n(lldb) target create <span class=\"hljs-string\">\"./out/Testing/Electron.app\"</span>\nCurrent executable <span class=\"hljs-built_in\">set</span> to <span class=\"hljs-string\">'./out/Testing/Electron.app'</span> (x86_64).\n</code></pre>\n<h3 id=\"setting-breakpoints\"><a href=\"#setting-breakpoints\">Setting Breakpoints</a></h3>\n<p>LLDB is a powerful tool and supports multiple strategies for code inspection. For\nthis basic introduction, let's assume that you're calling a command from JavaScript\nthat isn't behaving correctly - so you'd like to break on that command's C++\ncounterpart inside the Electron source.</p>\n<p>Relevant code files can be found in <code>./shell/</code>.</p>\n<p>Let's assume that you want to debug <code>app.setName()</code>, which is defined in <code>browser.cc</code>\nas <code>Browser::SetName()</code>. Set the breakpoint using the <code>breakpoint</code> command, specifying\nfile and line to break on:</p>\n<pre><code class=\"hljs language-sh\">(lldb) breakpoint <span class=\"hljs-built_in\">set</span> --file browser.cc --line 117\nBreakpoint 1: <span class=\"hljs-built_in\">where</span> = Electron Framework`atom::Browser::SetName(std::__1::basic_string&#x3C;char, std::__1::char_traits&#x3C;char>, std::__1::allocator&#x3C;char> > const&#x26;) + 20 at browser.cc:118, address = 0x000000000015fdb4\n</code></pre>\n<p>Then, start Electron:</p>\n<pre><code class=\"hljs language-sh\">(lldb) run\n</code></pre>\n<p>The app will immediately be paused, since Electron sets the app's name on launch:</p>\n<pre><code class=\"hljs language-sh\">(lldb) run\nProcess 25244 launched: <span class=\"hljs-string\">'/Users/fr/Code/electron/out/Testing/Electron.app/Contents/MacOS/Electron'</span> (x86_64)\nProcess 25244 stopped\n* thread <span class=\"hljs-comment\">#1: tid = 0x839a4c, 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 20 at browser.cc:118, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1</span>\n    frame <span class=\"hljs-comment\">#0: 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 20 at browser.cc:118</span>\n   115  }\n   116\n   117  void Browser::SetName(const std::string&#x26; name) {\n-> 118    name_override_ = name;\n   119  }\n   120\n   121  int Browser::<span class=\"hljs-function\"><span class=\"hljs-title\">GetBadgeCount</span></span>() {\n(lldb)\n</code></pre>\n<p>To show the arguments and local variables for the current frame, run <code>frame variable</code> (or <code>fr v</code>),\nwhich will show you that the app is currently setting the name to \"Electron\".</p>\n<pre><code class=\"hljs language-sh\">(lldb) frame variable\n(atom::Browser *) this = 0x0000000108b14f20\n(const string &#x26;) name = <span class=\"hljs-string\">\"Electron\"</span>: {\n    [...]\n}\n</code></pre>\n<p>To do a source level single step in the currently selected thread, execute <code>step</code> (or <code>s</code>).\nThis would take you into <code>name_override_.empty()</code>. To proceed and do a step over,\nrun <code>next</code> (or <code>n</code>).</p>\n<pre><code class=\"hljs language-sh\">(lldb) step\nProcess 25244 stopped\n* thread <span class=\"hljs-comment\">#1: tid = 0x839a4c, 0x0000000100162dcc Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 44 at browser.cc:119, queue = 'com.apple.main-thread', stop reason = step in</span>\n    frame <span class=\"hljs-comment\">#0: 0x0000000100162dcc Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 44 at browser.cc:119</span>\n   116\n   117  void Browser::SetName(const std::string&#x26; name) {\n   118    name_override_ = name;\n-> 119  }\n   120\n   121  int Browser::<span class=\"hljs-function\"><span class=\"hljs-title\">GetBadgeCount</span></span>() {\n   122    <span class=\"hljs-built_in\">return</span> badge_count_;\n</code></pre>\n<p><strong>NOTE:</strong> If you don't see source code when you think you should, you may not have added the <code>~/.lldbinit</code> file above.</p>\n<p>To finish debugging at this point, run <code>process continue</code>. You can also continue until a certain\nline is hit in this thread (<code>thread until 100</code>). This command will run the thread in the current\nframe till it reaches line 100 in this frame or stops if it leaves the current frame.</p>\n<p>Now, if you open up Electron's developer tools and call <code>setName</code>, you will once again hit the\nbreakpoint.</p>\n<h3 id=\"further-reading\"><a href=\"#further-reading\">Further Reading</a></h3>\n<p>LLDB is a powerful tool with a great documentation. To learn more about it, consider\nApple's debugging documentation, for instance the <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-basics.html#//apple_ref/doc/uid/TP40012917-CH2-SW2\">LLDB Command Structure Reference</a>\nor the introduction to <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-terminal-workflow-tutorial.html\">Using LLDB as a Standalone Debugger</a>.</p>\n<p>You can also check out LLDB's fantastic <a href=\"https://lldb.llvm.org/tutorial.html\">manual and tutorial</a>, which\nwill explain more complex debugging scenarios.</p>",
      "title": "Debugging on macOS",
      "description": ""
    },
    "/docs/development/debugging-instructions-macos-xcode": {
      "locale": "en-US",
      "slug": "debugging-instructions-macos-xcode",
      "href": "/docs/development/debugging-instructions-macos-xcode",
      "crowdinFileId": "256151",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debugging-instructions-macos-xcode.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h2 id=\"debugging-with-xcode\"><a href=\"#debugging-with-xcode\">Debugging with XCode</a></h2>\n<h3 id=\"generate-xcode-project-for-debugging-sources-cannot-build-code-from-xcode\"><a href=\"#generate-xcode-project-for-debugging-sources-cannot-build-code-from-xcode\">Generate xcode project for debugging sources (cannot build code from xcode)</a></h3>\n<p>Run <code>gn gen</code> with the --ide=xcode argument.</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --ide=xcode\n</code></pre>\n<p>This will generate the electron.ninja.xcworkspace. You will have to open this workspace\nto set breakpoints and inspect.</p>\n<p>See <code>gn help gen</code> for more information on generating IDE projects with GN.</p>\n<h3 id=\"debugging-and-breakpoints\"><a href=\"#debugging-and-breakpoints\">Debugging and breakpoints</a></h3>\n<p>Launch Electron app after build.\nYou can now open the xcode workspace created above and attach to the Electron process\nthrough the Debug > Attach To Process > Electron debug menu. [Note: If you want to debug\nthe renderer process, you need to attach to the Electron Helper as well.]</p>\n<p>You can now set breakpoints in any of the indexed files. However, you will not be able\nto set breakpoints directly in the Chromium source.\nTo set break points in the Chromium source, you can choose Debug > Breakpoints > Create\nSymbolic Breakpoint and set any function name as the symbol. This will set the breakpoint\nfor all functions with that name, from all the classes if there are more than one.\nYou can also do this step of setting break points prior to attaching the debugger,\nhowever, actual breakpoints for symbolic breakpoint functions may not show up until the\ndebugger is attached to the app.</p>",
      "title": "Debugging with XCode",
      "description": ""
    },
    "/docs/tutorial/debugging-main-process": {
      "locale": "en-US",
      "slug": "debugging-main-process",
      "href": "/docs/tutorial/debugging-main-process",
      "crowdinFileId": "256189",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/debugging-main-process.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"debugging-the-main-process\"><a href=\"#debugging-the-main-process\">Debugging the Main Process</a></h1>\n<p>The DevTools in an Electron browser window can only debug JavaScript that's\nexecuted in that window (i.e. the web pages). To debug JavaScript that's\nexecuted in the main process you will need to use an external debugger and\nlaunch Electron with the <code>--inspect</code> or <code>--inspect-brk</code> switch.</p>\n<h2 id=\"command-line-switches\"><a href=\"#command-line-switches\">Command Line Switches</a></h2>\n<p>Use one of the following command line switches to enable debugging of the main\nprocess:</p>\n<h3 id=\"--inspectport\"><a href=\"#--inspectport\"><code>--inspect=[port]</code></a></h3>\n<p>Electron will listen for V8 inspector protocol messages on the specified <code>port</code>,\nan external debugger will need to connect on this port. The default <code>port</code> is\n<code>5858</code>.</p>\n<pre><code class=\"hljs language-shell\">electron --inspect=5858 your/app\n</code></pre>\n<h3 id=\"--inspect-brkport\"><a href=\"#--inspect-brkport\"><code>--inspect-brk=[port]</code></a></h3>\n<p>Like <code>--inspect</code> but pauses execution on the first line of JavaScript.</p>\n<h2 id=\"external-debuggers\"><a href=\"#external-debuggers\">External Debuggers</a></h2>\n<p>You will need to use a debugger that supports the V8 inspector protocol.</p>\n<ul>\n<li>Connect Chrome by visiting <code>chrome://inspect</code> and selecting to inspect the\nlaunched Electron app present there.</li>\n<li><a href=\"/docs/tutorial/debugging-vscode\">Debugging in VSCode</a></li>\n</ul>",
      "title": "Debugging the Main Process",
      "description": ""
    },
    "/docs/tutorial/debugging-vscode": {
      "locale": "en-US",
      "slug": "debugging-vscode",
      "href": "/docs/tutorial/debugging-vscode",
      "crowdinFileId": "256191",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/debugging-vscode.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"debugging-in-vscode\"><a href=\"#debugging-in-vscode\">Debugging in VSCode</a></h1>\n<p>This guide goes over how to set up VSCode debugging for both your own Electron project as well as the native Electron codebase.</p>\n<h2 id=\"debugging-your-electron-app\"><a href=\"#debugging-your-electron-app\">Debugging your Electron app</a></h2>\n<h3 id=\"main-process\"><a href=\"#main-process\">Main process</a></h3>\n<h4 id=\"1-open-an-electron-project-in-vscode\"><a href=\"#1-open-an-electron-project-in-vscode\">1. Open an Electron project in VSCode.</a></h4>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:electron/electron-quick-start.git\n$ code electron-quick-start\n</code></pre>\n<h4 id=\"2-add-a-file-vscodelaunchjson-with-the-following-configuration\"><a href=\"#2-add-a-file-vscodelaunchjson-with-the-following-configuration\">2. Add a file <code>.vscode/launch.json</code> with the following configuration:</a></h4>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.2.0\"</span>,\n  <span class=\"hljs-attr\">\"configurations\"</span>: [\n    {\n      <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"Debug Main Process\"</span>,\n      <span class=\"hljs-attr\">\"type\"</span>: <span class=\"hljs-string\">\"node\"</span>,\n      <span class=\"hljs-attr\">\"request\"</span>: <span class=\"hljs-string\">\"launch\"</span>,\n      <span class=\"hljs-attr\">\"cwd\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      <span class=\"hljs-attr\">\"runtimeExecutable\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}/node_modules/.bin/electron\"</span>,\n      <span class=\"hljs-attr\">\"windows\"</span>: {\n        <span class=\"hljs-attr\">\"runtimeExecutable\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}/node_modules/.bin/electron.cmd\"</span>\n      },\n      <span class=\"hljs-attr\">\"args\"</span> : [<span class=\"hljs-string\">\".\"</span>],\n      <span class=\"hljs-attr\">\"outputCapture\"</span>: <span class=\"hljs-string\">\"std\"</span>\n    }\n  ]\n}\n</code></pre>\n<h4 id=\"3-debugging\"><a href=\"#3-debugging\">3. Debugging</a></h4>\n<p>Set some breakpoints in <code>main.js</code>, and start debugging in the <a href=\"https://code.visualstudio.com/docs/editor/debugging\">Debug View</a>. You should be able to hit the breakpoints.</p>\n<p>Here is a pre-configured project that you can download and directly debug in VSCode: <a href=\"https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start\">https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start</a></p>\n<h2 id=\"debugging-the-electron-codebase\"><a href=\"#debugging-the-electron-codebase\">Debugging the Electron codebase</a></h2>\n<p>If you want to build Electron from source and modify the native Electron codebase, this section will help you in testing your modifications.</p>\n<p>For those unsure where to acquire this code or how to build it, <a href=\"https://github.com/electron/build-tools\">Electron's Build Tools</a> automates and explains most of this process. If you wish to manually set up the environment, you can instead use these <a href=\"/docs/development/build-instructions-gn\">build instructions</a>.</p>\n<h3 id=\"windows-c\"><a href=\"#windows-c\">Windows (C++)</a></h3>\n<h4 id=\"1-open-an-electron-project-in-vscode-1\"><a href=\"#1-open-an-electron-project-in-vscode-1\">1. Open an Electron project in VSCode.</a></h4>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:electron/electron-quick-start.git\n$ code electron-quick-start\n</code></pre>\n<h4 id=\"2-add-a-file-vscodelaunchjson-with-the-following-configuration-1\"><a href=\"#2-add-a-file-vscodelaunchjson-with-the-following-configuration-1\">2. Add a file <code>.vscode/launch.json</code> with the following configuration:</a></h4>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.2.0\"</span>,\n  <span class=\"hljs-attr\">\"configurations\"</span>: [\n    {\n      <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"(Windows) Launch\"</span>,\n      <span class=\"hljs-attr\">\"type\"</span>: <span class=\"hljs-string\">\"cppvsdbg\"</span>,\n      <span class=\"hljs-attr\">\"request\"</span>: <span class=\"hljs-string\">\"launch\"</span>,\n      <span class=\"hljs-attr\">\"program\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\\\\out\\\\your-executable-location\\\\electron.exe\"</span>,\n      <span class=\"hljs-attr\">\"args\"</span>: [<span class=\"hljs-string\">\"your-electron-project-path\"</span>],\n      <span class=\"hljs-attr\">\"stopAtEntry\"</span>: <span class=\"hljs-literal\">false</span>,\n      <span class=\"hljs-attr\">\"cwd\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      <span class=\"hljs-attr\">\"environment\"</span>: [\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_ENABLE_LOGGING\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"true\"</span>},\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_ENABLE_STACK_DUMPING\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"true\"</span>},\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_RUN_AS_NODE\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"\"</span>},\n      ],\n      <span class=\"hljs-attr\">\"externalConsole\"</span>: <span class=\"hljs-literal\">false</span>,\n      <span class=\"hljs-attr\">\"sourceFileMap\"</span>: {\n          <span class=\"hljs-attr\">\"o:\\\\\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      },\n    },\n  ]\n}\n</code></pre>\n<p><strong>Configuration Notes</strong></p>\n<ul>\n<li><code>cppvsdbg</code> requires the <a href=\"https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools\">built-in C/C++ extension</a> be enabled.</li>\n<li><code>${workspaceFolder}</code> is the full path to Chromium's <code>src</code> directory.</li>\n<li><code>your-executable-location</code> will be one of the following depending on a few items:<ul>\n<li><code>Testing</code>: If you are using the default settings of <a href=\"https://github.com/electron/build-tools\">Electron's Build-Tools</a> or the default instructions when <a href=\"/docs/development/build-instructions-gn#building\">building from source</a>.</li>\n<li><code>Release</code>: If you built a Release build rather than a Testing build.</li>\n<li><code>your-directory-name</code>: If you modified this during your build process from the default, this will be whatever you specified.</li>\n</ul></li>\n<li>The <code>args</code> array string <code>\"your-electron-project-path\"</code> should be the absolute path to either the directory or <code>main.js</code> file of the Electron project you are using for testing. In this example, it should be your path to <code>electron-quick-start</code>.</li>\n</ul>\n<h4 id=\"3-debugging-1\"><a href=\"#3-debugging-1\">3. Debugging</a></h4>\n<p>Set some breakpoints in the .cc files of your choosing in the native Electron C++ code, and start debugging in the <a href=\"https://code.visualstudio.com/docs/editor/debugging\">Debug View</a>.</p>",
      "title": "Debugging in VSCode",
      "description": ""
    },
    "/docs/api/desktop-capturer": {
      "locale": "en-US",
      "slug": "desktop-capturer",
      "href": "/docs/api/desktop-capturer",
      "crowdinFileId": "256307",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/desktop-capturer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktopcapturer\"><a href=\"#desktopcapturer\">desktopCapturer</a></h1>\n<blockquote>\n<p>Access information about media sources that can be used to capture audio and\nvideo from the desktop using the <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> API.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>The following example shows how to capture video from a desktop window whose\ntitle is <code>Electron</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In the renderer process.</span>\n<span class=\"hljs-keyword\">const</span> { desktopCapturer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ndesktopCapturer.getSources({ <span class=\"hljs-attr\">types</span>: [<span class=\"hljs-string\">'window'</span>, <span class=\"hljs-string\">'screen'</span>] }).then(<span class=\"hljs-keyword\">async</span> sources => {\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> source <span class=\"hljs-keyword\">of</span> sources) {\n    <span class=\"hljs-keyword\">if</span> (source.name === <span class=\"hljs-string\">'Electron'</span>) {\n      <span class=\"hljs-keyword\">try</span> {\n        <span class=\"hljs-keyword\">const</span> stream = <span class=\"hljs-keyword\">await</span> navigator.mediaDevices.getUserMedia({\n          <span class=\"hljs-attr\">audio</span>: <span class=\"hljs-literal\">false</span>,\n          <span class=\"hljs-attr\">video</span>: {\n            <span class=\"hljs-attr\">mandatory</span>: {\n              <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>,\n              <span class=\"hljs-attr\">chromeMediaSourceId</span>: source.id,\n              <span class=\"hljs-attr\">minWidth</span>: <span class=\"hljs-number\">1280</span>,\n              <span class=\"hljs-attr\">maxWidth</span>: <span class=\"hljs-number\">1280</span>,\n              <span class=\"hljs-attr\">minHeight</span>: <span class=\"hljs-number\">720</span>,\n              <span class=\"hljs-attr\">maxHeight</span>: <span class=\"hljs-number\">720</span>\n            }\n          }\n        })\n        handleStream(stream)\n      } <span class=\"hljs-keyword\">catch</span> (e) {\n        handleError(e)\n      }\n      <span class=\"hljs-keyword\">return</span>\n    }\n  }\n})\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleStream</span> (<span class=\"hljs-params\">stream</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> video = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'video'</span>)\n  video.srcObject = stream\n  video.onloadedmetadata = <span class=\"hljs-function\">(<span class=\"hljs-params\">e</span>) =></span> video.play()\n}\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleError</span> (<span class=\"hljs-params\">e</span>) </span>{\n  <span class=\"hljs-built_in\">console</span>.log(e)\n}\n</code></pre>\n<p>To capture video from a source provided by <code>desktopCapturer</code> the constraints\npassed to <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> must include\n<code>chromeMediaSource: 'desktop'</code>, and <code>audio: false</code>.</p>\n<p>To capture both audio and video from the entire desktop the constraints passed\nto <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> must include <code>chromeMediaSource: 'desktop'</code>,\nfor both <code>audio</code> and <code>video</code>, but should not include a <code>chromeMediaSourceId</code> constraint.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> constraints = {\n  <span class=\"hljs-attr\">audio</span>: {\n    <span class=\"hljs-attr\">mandatory</span>: {\n      <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>\n    }\n  },\n  <span class=\"hljs-attr\">video</span>: {\n    <span class=\"hljs-attr\">mandatory</span>: {\n      <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>\n    }\n  }\n}\n</code></pre>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>desktopCapturer</code> module has the following methods:</p>\n<h3 id=\"desktopcapturergetsourcesoptions\"><a href=\"#desktopcapturergetsourcesoptions\"><code>desktopCapturer.getSources(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>types</code> String[] - An array of Strings that lists the types of desktop sources\nto be captured, available types are <code>screen</code> and <code>window</code>.</li>\n<li><code>thumbnailSize</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) - The size that the media source thumbnail\nshould be scaled to. Default is <code>150</code> x <code>150</code>. Set width or height to 0 when you do not need\nthe thumbnails. This will save the processing time required for capturing the content of each\nwindow and screen.</li>\n<li><code>fetchWindowIcons</code> Boolean (optional) - Set to true to enable fetching window icons. The default\nvalue is false. When false the appIcon property of the sources return null. Same if a source has\nthe type screen.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;DesktopCapturerSource[]></code> - Resolves with an array of <a href=\"/docs/api/structures/desktop-capturer-source\"><code>DesktopCapturerSource</code></a> objects, each <code>DesktopCapturerSource</code> represents a screen or an individual window that can be captured.</p>\n<p><strong>Note</strong> Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher,\nwhich can detected by <a href=\"/docs/api/system-preferences#systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><code>systemPreferences.getMediaAccessStatus</code></a>.</p>\n<h2 id=\"caveats\"><a href=\"#caveats\">Caveats</a></h2>\n<p><code>navigator.mediaDevices.getUserMedia</code> does not work on macOS for audio capture due to a fundamental limitation whereby apps that want to access the system's audio require a <a href=\"https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/KernelExtensions/KernelExtensions.html\">signed kernel extension</a>. Chromium, and by extension Electron, does not provide this.</p>\n<p>It is possible to circumvent this limitation by capturing system audio with another macOS app like Soundflower and passing it through a virtual audio input device. This virtual device can then be queried with <code>navigator.mediaDevices.getUserMedia</code>.</p>",
      "title": "desktopCapturer",
      "description": "Access information about media sources that can be used to capture audio and\nvideo from the desktop using the navigator.mediaDevices.getUserMedia API."
    },
    "/docs/api/structures/desktop-capturer-source": {
      "locale": "en-US",
      "slug": "desktop-capturer-source",
      "href": "/docs/api/structures/desktop-capturer-source",
      "crowdinFileId": "256425",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/desktop-capturer-source.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktopcapturersource-object\"><a href=\"#desktopcapturersource-object\">DesktopCapturerSource Object</a></h1>\n<ul>\n<li><code>id</code> String - The identifier of a window or screen that can be used as a\n<code>chromeMediaSourceId</code> constraint when calling\n[<code>navigator.webkitGetUserMedia</code>]. The format of the identifier will be\n<code>window:XX:YY</code> or <code>screen:ZZ:0</code>. XX is the windowID/handle. YY is 1 for\nthe current process, and 0 for all others. ZZ is a sequential number\nthat represents the screen, and it does not equal to the index in the\nsource's name.</li>\n<li><code>name</code> String - A screen source will be named either <code>Entire Screen</code> or\n<code>Screen &#x3C;index></code>, while the name of a window source will match the window\ntitle.</li>\n<li><code>thumbnail</code> <a href=\"/docs/api/native-image\">NativeImage</a> - A thumbnail image. <strong>Note:</strong>\nThere is no guarantee that the size of the thumbnail is the same as the\n<code>thumbnailSize</code> specified in the <code>options</code> passed to\n<code>desktopCapturer.getSources</code>. The actual size depends on the scale of the\nscreen or window.</li>\n<li><code>display_id</code> String - A unique identifier that will correspond to the <code>id</code> of\nthe matching <a href=\"/docs/api/structures/display\">Display</a> returned by the <a href=\"/docs/api/screen\">Screen API</a>.\nOn some platforms, this is equivalent to the <code>XX</code> portion of the <code>id</code> field\nabove and on others it will differ. It will be an empty string if not\navailable.</li>\n<li><code>appIcon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - An icon image of the\napplication that owns the window or null if the source has a type screen.\nThe size of the icon is not known in advance and depends on what\nthe application provides.</li>\n</ul>",
      "title": "DesktopCapturerSource Object",
      "description": ""
    },
    "/docs/tutorial/devices": {
      "locale": "en-US",
      "slug": "devices",
      "href": "/docs/tutorial/devices",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/devices.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"device-access\"><a href=\"#device-access\">Device Access</a></h1>\n<p>Like Chromium based browsers, Electron provides access to device hardware\nthrough web APIs.  For the most part these APIs work like they do in a browser,\nbut there are some differences that need to be taken into account.  The primary\ndifference between Electron and browsers is what happens when device access is\nrequested.  In a browser, users are presented with a popup where they can grant\naccess to an individual device.  In Electron APIs are provided which can be\nused by a developer to either automatically pick a device or prompt users to\npick a device via a developer created interface.</p>\n<h2 id=\"web-bluetooth-api\"><a href=\"#web-bluetooth-api\">Web Bluetooth API</a></h2>\n<p>The <a href=\"https://web.dev/bluetooth/\">Web Bluetooth API</a> can be used to communicate\nwith bluetooth devices. In order to use this API in Electron, developers will\nneed to handle the <a href=\"/docs/api/web-contents#event-select-bluetooth-device\"><code>select-bluetooth-device</code> event on the webContents</a>\nassociated with the device request.</p>\n<h3 id=\"example\"><a href=\"#example\">Example</a></h3>\n<p>This example demonstrates an Electron application that automatically selects\nthe first available bluetooth device when the <code>Test Bluetooth</code> button is\nclicked.</p>\n<h2 id=\"webhid-api\"><a href=\"#webhid-api\">WebHID API</a></h2>\n<p>The <a href=\"https://web.dev/hid/\">WebHID API</a> can be used to access HID devices such\nas keyboards and gamepads.  Electron provides several APIs for working with\nthe WebHID API:</p>\n<ul>\n<li>The <a href=\"/docs/api/session#event-select-hid-device\"><code>select-hid-device</code> event on the Session</a>\ncan be used to select a HID device when a call to\n<code>navigator.hid.requestDevice</code> is made.  Additionally the <a href=\"/docs/api/session#event-hid-device-added\"><code>hid-device-added</code></a>\nand <a href=\"/docs/api/session#event-hid-device-removed\"><code>hid-device-removed</code></a> events\non the Session can be used to handle devices being plugged in or unplugged during the\n<code>navigator.hid.requestDevice</code> process.</li>\n<li><a href=\"/docs/api/session#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a>\ncan be used to provide default permissioning to devices without first calling\nfor permission to devices via <code>navigator.hid.requestDevice</code>.  Additionally,\nthe default behavior of Electron is to store granted device permision through\nthe lifetime of the corresponding WebContents.  If longer term storage is\nneeded, a developer can store granted device permissions (eg when handling\nthe <code>select-hid-device</code> event) and then read from that storage with\n<code>setDevicePermissionHandler</code>.</li>\n<li><a href=\"/docs/api/session#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a>\ncan be used to disable HID access for specific origins.</li>\n</ul>\n<h3 id=\"blocklist\"><a href=\"#blocklist\">Blocklist</a></h3>\n<p>By default Electron employs the same <a href=\"https://github.com/WICG/webhid/blob/main/blocklist.txt\">blocklist</a>\nused by Chromium.  If you wish to override this behavior, you can do so by\nsetting the <code>disable-hid-blocklist</code> flag:</p>\n<pre><code class=\"hljs language-javascript\">app.commandLine.appendSwitch(<span class=\"hljs-string\">'disable-hid-blocklist'</span>)\n</code></pre>\n<h3 id=\"example-1\"><a href=\"#example-1\">Example</a></h3>\n<p>This example demonstrates an Electron application that automatically selects\nHID devices through <a href=\"/docs/api/session#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a>\nand through <a href=\"/docs/api/session#event-select-hid-device\"><code>select-hid-device</code> event on the Session</a>\nwhen the <code>Test WebHID</code> button is clicked.</p>\n<h2 id=\"web-serial-api\"><a href=\"#web-serial-api\">Web Serial API</a></h2>\n<p>The <a href=\"https://web.dev/serial/\">Web Serial API</a> can be used to access serial\ndevices that are connected via serial port, USB, or Bluetooth.  In order to use\nthis API in Electron, developers will need to handle the\n<a href=\"/docs/api/session#event-select-serial-port\"><code>select-serial-port</code> event on the Session</a>\nassociated with the serial port request.</p>\n<p>There are several additional APIs for working with the Web Serial API:</p>\n<ul>\n<li>The <a href=\"/docs/api/session#event-serial-port-added\"><code>serial-port-added</code></a>\nand <a href=\"/docs/api/session#event-serial-port-removed\"><code>serial-port-removed</code></a> events\non the Session can be used to handle devices being plugged in or unplugged during the\n<code>navigator.serial.requestPort</code> process.</li>\n<li><a href=\"/docs/api/session#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a>\ncan be used to disable serial access for specific origins.</li>\n</ul>\n<h3 id=\"example-2\"><a href=\"#example-2\">Example</a></h3>\n<p>This example demonstrates an Electron application that automatically selects\nthe first available Arduino Uno serial device (if connected) through\n<a href=\"/docs/api/session#event-select-serial-port\"><code>select-serial-port</code> event on the Session</a>\nwhen the <code>Test Web Serial</code> button is clicked.</p>",
      "title": "Device Access",
      "description": ""
    },
    "/docs/tutorial/devtools-extension": {
      "locale": "en-US",
      "slug": "devtools-extension",
      "href": "/docs/tutorial/devtools-extension",
      "crowdinFileId": "256195",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/devtools-extension.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"devtools-extension\"><a href=\"#devtools-extension\">DevTools Extension</a></h1>\n<p>Electron supports <a href=\"https://developer.chrome.com/extensions/devtools\">Chrome DevTools extensions</a>, which can\nbe used to extend the ability of Chrome's developer tools for debugging\npopular web frameworks.</p>\n<h2 id=\"loading-a-devtools-extension-with-tooling\"><a href=\"#loading-a-devtools-extension-with-tooling\">Loading a DevTools extension with tooling</a></h2>\n<p>The easiest way to load a DevTools extension is to use third-party tooling to automate the\nprocess for you. <a href=\"https://github.com/MarshallOfSound/electron-devtools-installer\">electron-devtools-installer</a> is a popular\nNPM package that does just that.</p>\n<h2 id=\"manually-loading-a-devtools-extension\"><a href=\"#manually-loading-a-devtools-extension\">Manually loading a DevTools extension</a></h2>\n<p>If you don't want to use the tooling approach, you can also do all of the necessary\noperations by hand. To load an extension in Electron, you need to download it via Chrome,\nlocate its filesystem path, and then load it into your <a href=\"/docs/api/session\">Session</a> by calling the\n[<code>ses.loadExtension</code>] API.</p>\n<p>Using the <a href=\"https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi\">React Developer Tools</a> as an example:</p>\n<ol>\n<li>\n<p>Install the extension in Google Chrome.</p>\n</li>\n<li>\n<p>Navigate to <code>chrome://extensions</code>, and find its extension ID, which is a hash\nstring like <code>fmkadmapgofadopljbjfkapdkoienihi</code>.</p>\n</li>\n<li>\n<p>Find out the filesystem location used by Chrome for storing extensions:</p>\n<ul>\n<li>on Windows it is <code>%LOCALAPPDATA%\\Google\\Chrome\\User Data\\Default\\Extensions</code>;</li>\n<li>on Linux it could be:<ul>\n<li><code>~/.config/google-chrome/Default/Extensions/</code></li>\n<li><code>~/.config/google-chrome-beta/Default/Extensions/</code></li>\n<li><code>~/.config/google-chrome-canary/Default/Extensions/</code></li>\n<li><code>~/.config/chromium/Default/Extensions/</code></li>\n</ul></li>\n<li>on macOS it is <code>~/Library/Application Support/Google/Chrome/Default/Extensions</code>.</li>\n</ul>\n</li>\n<li>\n<p>Pass the location of the extension to the <a href=\"/docs/api/session#sesloadextensionpath-options\"><code>ses.loadExtension</code></a>\nAPI. For React Developer Tools <code>v4.9.0</code>, it looks something like:</p>\n<pre><code class=\"hljs language-javascript\"> <span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n <span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n\n <span class=\"hljs-comment\">// on macOS</span>\n <span class=\"hljs-keyword\">const</span> reactDevToolsPath = path.join(\n   os.homedir(),\n   <span class=\"hljs-string\">'/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/4.9.0_0'</span>\n )\n\n app.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n   <span class=\"hljs-keyword\">await</span> session.defaultSession.loadExtension(reactDevToolsPath)\n })\n</code></pre>\n</li>\n</ol>\n<p><strong>Notes:</strong></p>\n<ul>\n<li><code>loadExtension</code> returns a Promise with an <a href=\"/docs/api/structures/extension\">Extension object</a>,\nwhich contains metadata about the extension that was loaded. This promise needs to\nresolve (e.g. with an <code>await</code> expression) before loading a page. Otherwise, the\nextension won't be guaranteed to load.</li>\n<li><code>loadExtension</code> cannot be called before the <code>ready</code> event of the <code>app</code> module\nis emitted, nor can it be called on in-memory (non-persistent) sessions.</li>\n<li><code>loadExtension</code> must be called on every boot of your app if you want the\nextension to be loaded.</li>\n</ul>\n<h3 id=\"removing-a-devtools-extension\"><a href=\"#removing-a-devtools-extension\">Removing a DevTools extension</a></h3>\n<p>You can pass the extension's ID to the <a href=\"/docs/api/session#sesremoveextensionextensionid\"><code>ses.removeExtension</code></a> API to\nremove it from your Session. Loaded extensions are not persisted between\napp launches.</p>\n<h2 id=\"devtools-extension-support\"><a href=\"#devtools-extension-support\">DevTools extension support</a></h2>\n<p>Electron only supports\n<a href=\"/docs/api/extensions\">a limited set of <code>chrome.*</code> APIs</a>,\nso extensions using unsupported <code>chrome.*</code> APIs under the hood may not work.</p>\n<p>The following Devtools extensions have been tested to work in Electron:</p>\n<ul>\n<li><a href=\"https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi\">Ember Inspector</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi\">React Developer Tools</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/backbone-debugger/bhljhndlimiafopmmhjlgfpnnchjjbhd\">Backbone Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/jquery-debugger/dbhhnnnpaeobfddmlalhnehgclcmjimi\">jQuery Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/angularjs-batarang/ighdmehidhipcmcojjgiloacoafjmpfk\">AngularJS Batarang</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd\">Vue.js devtools</a></li>\n<li><a href=\"https://cerebraljs.com/docs/introduction/devtools.html\">Cerebral Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd\">Redux DevTools Extension</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/mobx-developer-tools/pfgnfdagidkfgccljigdamigbcnndkod\">MobX Developer Tools</a></li>\n</ul>\n<h3 id=\"what-should-i-do-if-a-devtools-extension-is-not-working\"><a href=\"#what-should-i-do-if-a-devtools-extension-is-not-working\">What should I do if a DevTools extension is not working?</a></h3>\n<p>First, please make sure the extension is still being maintained and is compatible\nwith the latest version of Google Chrome. We cannot provide additional support for\nunsupported extensions.</p>\n<p>If the extension works on Chrome but not on Electron, file a bug in Electron's\n<a href=\"https://github.com/electron/electron/issues\">issue tracker</a> and describe which part\nof the extension is not working as expected.</p>",
      "title": "DevTools Extension",
      "description": ""
    },
    "/docs/api/dialog": {
      "locale": "en-US",
      "slug": "dialog",
      "href": "/docs/api/dialog",
      "crowdinFileId": "256309",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/dialog.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dialog\"><a href=\"#dialog\">dialog</a></h1>\n<blockquote>\n<p>Display native system dialogs for opening and saving files, alerting, etc.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>An example of showing a dialog to select multiple files:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(dialog.showOpenDialog({ <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'multiSelections'</span>] }))\n</code></pre>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>dialog</code> module has the following methods:</p>\n<h3 id=\"dialogshowopendialogsyncbrowserwindow-options\"><a href=\"#dialogshowopendialogsyncbrowserwindow-options\"><code>dialog.showOpenDialogSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> String (optional)</li>\n<li><code>defaultPath</code> String (optional)</li>\n<li><code>buttonLabel</code> String (optional) - Custom label for the confirmation button, when\nleft empty the default label will be used.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (optional)</li>\n<li><code>properties</code> String[] (optional) - Contains which features the dialog should\nuse. The following values are supported:<ul>\n<li><code>openFile</code> - Allow files to be selected.</li>\n<li><code>openDirectory</code> - Allow directories to be selected.</li>\n<li><code>multiSelections</code> - Allow multiple paths to be selected.</li>\n<li><code>showHiddenFiles</code> - Show hidden files in dialog.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Allow creating new directories from dialog.</li>\n<li><code>promptToCreate</code> <em>Windows</em> - Prompt for creation if the file path entered\nin the dialog does not exist. This does not actually create the file at\nthe path but allows non-existent paths to be returned that should be\ncreated by the application.</li>\n<li><code>noResolveAliases</code> <em>macOS</em> - Disable the automatic alias (symlink) path\nresolution. Selected aliases will now return the alias path instead of\ntheir target path.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Treat packages, such as <code>.app</code> folders,\nas a directory instead of a file.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - Do not add the item being opened to the recent documents list.</li>\n</ul></li>\n<li><code>message</code> String (optional) <em>macOS</em> - Message to display above input\nboxes.</li>\n<li><code>securityScopedBookmarks</code> Boolean (optional) <em>macOS</em> <em>mas</em> - Create <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmarks</a> when packaged for the Mac App Store.</li>\n</ul></li>\n</ul>\n<p>Returns <code>String[] | undefined</code>, the file paths chosen by the user; if the dialog is cancelled it returns <code>undefined</code>.</p>\n<p>The <code>browserWindow</code> argument allows the dialog to attach itself to a parent window, making it modal.</p>\n<p>The <code>filters</code> specifies an array of file types that can be displayed or\nselected when you want to limit the user to a specific type. For example:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">filters</span>: [\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Images'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'jpg'</span>, <span class=\"hljs-string\">'png'</span>, <span class=\"hljs-string\">'gif'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Movies'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'mkv'</span>, <span class=\"hljs-string\">'avi'</span>, <span class=\"hljs-string\">'mp4'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Custom File Type'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'as'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'All Files'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'*'</span>] }\n  ]\n}\n</code></pre>\n<p>The <code>extensions</code> array should contain extensions without wildcards or dots (e.g.\n<code>'png'</code> is good but <code>'.png'</code> and <code>'*.png'</code> are bad). To show all files, use the\n<code>'*'</code> wildcard (no other wildcard is supported).</p>\n<p><strong>Note:</strong> On Windows and Linux an open dialog can not be both a file selector\nand a directory selector, so if you set <code>properties</code> to\n<code>['openFile', 'openDirectory']</code> on these platforms, a directory selector will be\nshown.</p>\n<pre><code class=\"hljs language-js\">dialog.showOpenDialogSync(mainWindow, {\n  <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'openDirectory'</span>]\n})\n</code></pre>\n<h3 id=\"dialogshowopendialogbrowserwindow-options\"><a href=\"#dialogshowopendialogbrowserwindow-options\"><code>dialog.showOpenDialog([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> String (optional)</li>\n<li><code>defaultPath</code> String (optional)</li>\n<li><code>buttonLabel</code> String (optional) - Custom label for the confirmation button, when\nleft empty the default label will be used.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (optional)</li>\n<li><code>properties</code> String[] (optional) - Contains which features the dialog should\nuse. The following values are supported:<ul>\n<li><code>openFile</code> - Allow files to be selected.</li>\n<li><code>openDirectory</code> - Allow directories to be selected.</li>\n<li><code>multiSelections</code> - Allow multiple paths to be selected.</li>\n<li><code>showHiddenFiles</code> - Show hidden files in dialog.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Allow creating new directories from dialog.</li>\n<li><code>promptToCreate</code> <em>Windows</em> - Prompt for creation if the file path entered\nin the dialog does not exist. This does not actually create the file at\nthe path but allows non-existent paths to be returned that should be\ncreated by the application.</li>\n<li><code>noResolveAliases</code> <em>macOS</em> - Disable the automatic alias (symlink) path\nresolution. Selected aliases will now return the alias path instead of\ntheir target path.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Treat packages, such as <code>.app</code> folders,\nas a directory instead of a file.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - Do not add the item being opened to the recent documents list.</li>\n</ul></li>\n<li><code>message</code> String (optional) <em>macOS</em> - Message to display above input\nboxes.</li>\n<li><code>securityScopedBookmarks</code> Boolean (optional) <em>macOS</em> <em>mas</em> - Create <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmarks</a> when packaged for the Mac App Store.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Object></code> - Resolve with an object containing the following:</p>\n<ul>\n<li><code>canceled</code> Boolean - whether or not the dialog was canceled.</li>\n<li><code>filePaths</code> String[] - An array of file paths chosen by the user. If the dialog is cancelled this will be an empty array.</li>\n<li><code>bookmarks</code> String[] (optional) <em>macOS</em> <em>mas</em> - An array matching the <code>filePaths</code> array of base64 encoded strings which contains security scoped bookmark data. <code>securityScopedBookmarks</code> must be enabled for this to be populated. (For return values, see <a href=\"#bookmarks-array\">table here</a>.)</li>\n</ul>\n<p>The <code>browserWindow</code> argument allows the dialog to attach itself to a parent window, making it modal.</p>\n<p>The <code>filters</code> specifies an array of file types that can be displayed or\nselected when you want to limit the user to a specific type. For example:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">filters</span>: [\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Images'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'jpg'</span>, <span class=\"hljs-string\">'png'</span>, <span class=\"hljs-string\">'gif'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Movies'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'mkv'</span>, <span class=\"hljs-string\">'avi'</span>, <span class=\"hljs-string\">'mp4'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Custom File Type'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'as'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'All Files'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'*'</span>] }\n  ]\n}\n</code></pre>\n<p>The <code>extensions</code> array should contain extensions without wildcards or dots (e.g.\n<code>'png'</code> is good but <code>'.png'</code> and <code>'*.png'</code> are bad). To show all files, use the\n<code>'*'</code> wildcard (no other wildcard is supported).</p>\n<p><strong>Note:</strong> On Windows and Linux an open dialog can not be both a file selector\nand a directory selector, so if you set <code>properties</code> to\n<code>['openFile', 'openDirectory']</code> on these platforms, a directory selector will be\nshown.</p>\n<pre><code class=\"hljs language-js\">dialog.showOpenDialog(mainWindow, {\n  <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'openDirectory'</span>]\n}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">result</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(result.canceled)\n  <span class=\"hljs-built_in\">console</span>.log(result.filePaths)\n}).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(err)\n})\n</code></pre>\n<h3 id=\"dialogshowsavedialogsyncbrowserwindow-options\"><a href=\"#dialogshowsavedialogsyncbrowserwindow-options\"><code>dialog.showSaveDialogSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> String (optional) - The dialog title. Cannot be displayed on some <em>Linux</em> desktop environments.</li>\n<li><code>defaultPath</code> String (optional) - Absolute directory path, absolute file\npath, or file name to use by default.</li>\n<li><code>buttonLabel</code> String (optional) - Custom label for the confirmation button, when\nleft empty the default label will be used.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (optional)</li>\n<li><code>message</code> String (optional) <em>macOS</em> - Message to display above text fields.</li>\n<li><code>nameFieldLabel</code> String (optional) <em>macOS</em> - Custom label for the text\ndisplayed in front of the filename text field.</li>\n<li><code>showsTagField</code> Boolean (optional) <em>macOS</em> - Show the tags input box,\ndefaults to <code>true</code>.</li>\n<li><code>properties</code> String[] (optional)<ul>\n<li><code>showHiddenFiles</code> - Show hidden files in dialog.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Allow creating new directories from dialog.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Treat packages, such as <code>.app</code> folders,\nas a directory instead of a file.</li>\n<li><code>showOverwriteConfirmation</code> <em>Linux</em> - Sets whether the user will be presented a confirmation dialog if the user types a file name that already exists.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - Do not add the item being saved to the recent documents list.</li>\n</ul></li>\n<li><code>securityScopedBookmarks</code> Boolean (optional) <em>macOS</em> <em>mas</em> - Create a <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmark</a> when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.</li>\n</ul></li>\n</ul>\n<p>Returns <code>String | undefined</code>, the path of the file chosen by the user; if the dialog is cancelled it returns <code>undefined</code>.</p>\n<p>The <code>browserWindow</code> argument allows the dialog to attach itself to a parent window, making it modal.</p>\n<p>The <code>filters</code> specifies an array of file types that can be displayed, see\n<code>dialog.showOpenDialog</code> for an example.</p>\n<h3 id=\"dialogshowsavedialogbrowserwindow-options\"><a href=\"#dialogshowsavedialogbrowserwindow-options\"><code>dialog.showSaveDialog([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> String (optional) - The dialog title. Cannot be displayed on some <em>Linux</em> desktop environments.</li>\n<li><code>defaultPath</code> String (optional) - Absolute directory path, absolute file\npath, or file name to use by default.</li>\n<li><code>buttonLabel</code> String (optional) - Custom label for the confirmation button, when\nleft empty the default label will be used.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (optional)</li>\n<li><code>message</code> String (optional) <em>macOS</em> - Message to display above text fields.</li>\n<li><code>nameFieldLabel</code> String (optional) <em>macOS</em> - Custom label for the text\ndisplayed in front of the filename text field.</li>\n<li><code>showsTagField</code> Boolean (optional) <em>macOS</em> - Show the tags input box, defaults to <code>true</code>.</li>\n<li><code>properties</code> String[] (optional)<ul>\n<li><code>showHiddenFiles</code> - Show hidden files in dialog.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Allow creating new directories from dialog.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Treat packages, such as <code>.app</code> folders,\nas a directory instead of a file.</li>\n<li><code>showOverwriteConfirmation</code> <em>Linux</em> - Sets whether the user will be presented a confirmation dialog if the user types a file name that already exists.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - Do not add the item being saved to the recent documents list.</li>\n</ul></li>\n<li><code>securityScopedBookmarks</code> Boolean (optional) <em>macOS</em> <em>mas</em> - Create a <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmark</a> when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Object></code> - Resolve with an object containing the following:</p>\n<ul>\n<li><code>canceled</code> Boolean - whether or not the dialog was canceled.</li>\n<li><code>filePath</code> String (optional) - If the dialog is canceled, this will be <code>undefined</code>.</li>\n<li><code>bookmark</code> String (optional) <em>macOS</em> <em>mas</em> - Base64 encoded string which contains the security scoped bookmark data for the saved file. <code>securityScopedBookmarks</code> must be enabled for this to be present. (For return values, see <a href=\"#bookmarks-array\">table here</a>.)</li>\n</ul>\n<p>The <code>browserWindow</code> argument allows the dialog to attach itself to a parent window, making it modal.</p>\n<p>The <code>filters</code> specifies an array of file types that can be displayed, see\n<code>dialog.showOpenDialog</code> for an example.</p>\n<p><strong>Note:</strong> On macOS, using the asynchronous version is recommended to avoid issues when\nexpanding and collapsing the dialog.</p>\n<h3 id=\"dialogshowmessageboxsyncbrowserwindow-options\"><a href=\"#dialogshowmessageboxsyncbrowserwindow-options\"><code>dialog.showMessageBoxSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional)</li>\n<li><code>options</code> Object<ul>\n<li><code>message</code> String - Content of the message box.</li>\n<li><code>type</code> String (optional) - Can be <code>\"none\"</code>, <code>\"info\"</code>, <code>\"error\"</code>, <code>\"question\"</code> or\n<code>\"warning\"</code>. On Windows, <code>\"question\"</code> displays the same icon as <code>\"info\"</code>, unless\nyou set an icon using the <code>\"icon\"</code> option. On macOS, both <code>\"warning\"</code> and\n<code>\"error\"</code> display the same warning icon.</li>\n<li><code>buttons</code> String[] (optional) - Array of texts for buttons. On Windows, an empty array\nwill result in one button labeled \"OK\".</li>\n<li><code>defaultId</code> Integer (optional) - Index of the button in the buttons array which will\nbe selected by default when the message box opens.</li>\n<li><code>title</code> String (optional) - Title of the message box, some platforms will not show it.</li>\n<li><code>detail</code> String (optional) - Extra information of the message.</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (optional)</li>\n<li><code>textWidth</code> Integer (optional) <em>macOS</em> - Custom width of the text in the message box.</li>\n<li><code>cancelId</code> Integer (optional) - The index of the button to be used to cancel the dialog, via\nthe <code>Esc</code> key. By default this is assigned to the first button with \"cancel\" or \"no\" as the\nlabel. If no such labeled buttons exist and this option is not set, <code>0</code> will be used as the\nreturn value.</li>\n<li><code>noLink</code> Boolean (optional) - On Windows Electron will try to figure out which one of\nthe <code>buttons</code> are common buttons (like \"Cancel\" or \"Yes\"), and show the\nothers as command links in the dialog. This can make the dialog appear in\nthe style of modern Windows apps. If you don't like this behavior, you can\nset <code>noLink</code> to <code>true</code>.</li>\n<li><code>normalizeAccessKeys</code> Boolean (optional) - Normalize the keyboard access keys\nacross platforms. Default is <code>false</code>. Enabling this assumes <code>&#x26;</code> is used in\nthe button labels for the placement of the keyboard shortcut access key\nand labels will be converted so they work correctly on each platform, <code>&#x26;</code>\ncharacters are removed on macOS, converted to <code>_</code> on Linux, and left\nuntouched on Windows. For example, a button label of <code>Vie&#x26;w</code> will be\nconverted to <code>Vie_w</code> on Linux and <code>View</code> on macOS and can be selected\nvia <code>Alt-W</code> on Windows and Linux.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code> - the index of the clicked button.</p>\n<p>Shows a message box, it will block the process until the message box is closed.\nIt returns the index of the clicked button.</p>\n<p>The <code>browserWindow</code> argument allows the dialog to attach itself to a parent window, making it modal.\nIf <code>browserWindow</code> is not shown dialog will not be attached to it. In such case it will be displayed as an independent window.</p>\n<h3 id=\"dialogshowmessageboxbrowserwindow-options\"><a href=\"#dialogshowmessageboxbrowserwindow-options\"><code>dialog.showMessageBox([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional)</li>\n<li><code>options</code> Object<ul>\n<li><code>message</code> String - Content of the message box.</li>\n<li><code>type</code> String (optional) - Can be <code>\"none\"</code>, <code>\"info\"</code>, <code>\"error\"</code>, <code>\"question\"</code> or\n<code>\"warning\"</code>. On Windows, <code>\"question\"</code> displays the same icon as <code>\"info\"</code>, unless\nyou set an icon using the <code>\"icon\"</code> option. On macOS, both <code>\"warning\"</code> and\n<code>\"error\"</code> display the same warning icon.</li>\n<li><code>buttons</code> String[] (optional) - Array of texts for buttons. On Windows, an empty array\nwill result in one button labeled \"OK\".</li>\n<li><code>defaultId</code> Integer (optional) - Index of the button in the buttons array which will\nbe selected by default when the message box opens.</li>\n<li><code>signal</code> AbortSignal (optional) - Pass an instance of <a href=\"https://nodejs.org/api/globals.html#globals_class_abortsignal\">AbortSignal</a> to\noptionally close the message box, the message box will behave as if it was\ncancelled by the user. On macOS, <code>signal</code> does not work with message boxes\nthat do not have a parent window, since those message boxes run\nsynchronously due to platform limitations.</li>\n<li><code>title</code> String (optional) - Title of the message box, some platforms will not show it.</li>\n<li><code>detail</code> String (optional) - Extra information of the message.</li>\n<li><code>checkboxLabel</code> String (optional) - If provided, the message box will\ninclude a checkbox with the given label.</li>\n<li><code>checkboxChecked</code> Boolean (optional) - Initial checked state of the\ncheckbox. <code>false</code> by default.</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> (optional)</li>\n<li><code>textWidth</code> Integer (optional) <em>macOS</em> - Custom width of the text in the message box.</li>\n<li><code>cancelId</code> Integer (optional) - The index of the button to be used to cancel the dialog, via\nthe <code>Esc</code> key. By default this is assigned to the first button with \"cancel\" or \"no\" as the\nlabel. If no such labeled buttons exist and this option is not set, <code>0</code> will be used as the\nreturn value.</li>\n<li><code>noLink</code> Boolean (optional) - On Windows Electron will try to figure out which one of\nthe <code>buttons</code> are common buttons (like \"Cancel\" or \"Yes\"), and show the\nothers as command links in the dialog. This can make the dialog appear in\nthe style of modern Windows apps. If you don't like this behavior, you can\nset <code>noLink</code> to <code>true</code>.</li>\n<li><code>normalizeAccessKeys</code> Boolean (optional) - Normalize the keyboard access keys\nacross platforms. Default is <code>false</code>. Enabling this assumes <code>&#x26;</code> is used in\nthe button labels for the placement of the keyboard shortcut access key\nand labels will be converted so they work correctly on each platform, <code>&#x26;</code>\ncharacters are removed on macOS, converted to <code>_</code> on Linux, and left\nuntouched on Windows. For example, a button label of <code>Vie&#x26;w</code> will be\nconverted to <code>Vie_w</code> on Linux and <code>View</code> on macOS and can be selected\nvia <code>Alt-W</code> on Windows and Linux.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Object></code> - resolves with a promise containing the following properties:</p>\n<ul>\n<li><code>response</code> Number - The index of the clicked button.</li>\n<li><code>checkboxChecked</code> Boolean - The checked state of the checkbox if\n<code>checkboxLabel</code> was set. Otherwise <code>false</code>.</li>\n</ul>\n<p>Shows a message box.</p>\n<p>The <code>browserWindow</code> argument allows the dialog to attach itself to a parent window, making it modal.</p>\n<h3 id=\"dialogshowerrorboxtitle-content\"><a href=\"#dialogshowerrorboxtitle-content\"><code>dialog.showErrorBox(title, content)</code></a></h3>\n<ul>\n<li><code>title</code> String - The title to display in the error box.</li>\n<li><code>content</code> String - The text content to display in the error box.</li>\n</ul>\n<p>Displays a modal dialog that shows an error message.</p>\n<p>This API can be called safely before the <code>ready</code> event the <code>app</code> module emits,\nit is usually used to report errors in early stage of startup. If called\nbefore the app <code>ready</code>event on Linux, the message will be emitted to stderr,\nand no GUI dialog will appear.</p>\n<h3 id=\"dialogshowcertificatetrustdialogbrowserwindow-options-macos-windows\"><a href=\"#dialogshowcertificatetrustdialogbrowserwindow-options-macos-windows\"><code>dialog.showCertificateTrustDialog([browserWindow, ]options)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional)</li>\n<li><code>options</code> Object<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> - The certificate to trust/import.</li>\n<li><code>message</code> String - The message to display to the user.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the certificate trust dialog is shown.</p>\n<p>On macOS, this displays a modal dialog that shows a message and certificate\ninformation, and gives the user the option of trusting/importing the\ncertificate. If you provide a <code>browserWindow</code> argument the dialog will be\nattached to the parent window, making it modal.</p>\n<p>On Windows the options are more limited, due to the Win32 APIs used:</p>\n<ul>\n<li>The <code>message</code> argument is not used, as the OS provides its own confirmation\ndialog.</li>\n<li>The <code>browserWindow</code> argument is ignored since it is not possible to make\nthis confirmation dialog modal.</li>\n</ul>\n<h2 id=\"bookmarks-array\"><a href=\"#bookmarks-array\">Bookmarks array</a></h2>\n<p><code>showOpenDialog</code>, <code>showOpenDialogSync</code>, <code>showSaveDialog</code>, and <code>showSaveDialogSync</code> will return a <code>bookmarks</code> array.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Build Type</th><th>securityScopedBookmarks boolean</th><th align=\"center\">Return Type</th><th>Return Value</th></tr></thead><tbody><tr><td>macOS mas</td><td>True</td><td align=\"center\">Success</td><td><code>['LONGBOOKMARKSTRING']</code></td></tr><tr><td>macOS mas</td><td>True</td><td align=\"center\">Error</td><td><code>['']</code> (array of empty string)</td></tr><tr><td>macOS mas</td><td>False</td><td align=\"center\">NA</td><td><code>[]</code> (empty array)</td></tr><tr><td>non mas</td><td>any</td><td align=\"center\">NA</td><td><code>[]</code> (empty array)</td></tr></tbody></table>\n<h2 id=\"sheets\"><a href=\"#sheets\">Sheets</a></h2>\n<p>On macOS, dialogs are presented as sheets attached to a window if you provide\na <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> reference in the <code>browserWindow</code> parameter, or modals if no\nwindow is provided.</p>\n<p>You can call <code>BrowserWindow.getCurrentWindow().setSheetOffset(offset)</code> to change\nthe offset from the window frame where sheets are attached.</p>",
      "title": "dialog",
      "description": "Display native system dialogs for opening and saving files, alerting, etc."
    },
    "/docs/api/structures/display": {
      "locale": "en-US",
      "slug": "display",
      "href": "/docs/api/structures/display",
      "crowdinFileId": "256427",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/display.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"display-object\"><a href=\"#display-object\">Display Object</a></h1>\n<ul>\n<li><code>id</code> Number - Unique identifier associated with the display.</li>\n<li><code>rotation</code> Number - Can be 0, 90, 180, 270, represents screen rotation in\nclock-wise degrees.</li>\n<li><code>scaleFactor</code> Number - Output device's pixel scale factor.</li>\n<li><code>touchSupport</code> String - Can be <code>available</code>, <code>unavailable</code>, <code>unknown</code>.</li>\n<li><code>monochrome</code> Boolean - Whether or not the display is a monochrome display.</li>\n<li><code>accelerometerSupport</code> String - Can be <code>available</code>, <code>unavailable</code>, <code>unknown</code>.</li>\n<li><code>colorSpace</code> String -  represent a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions</li>\n<li><code>colorDepth</code> Number - The number of bits per pixel.</li>\n<li><code>depthPerComponent</code> Number - The number of bits per color component.</li>\n<li><code>displayFrequency</code> Number - The display refresh rate.</li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - the bounds of the display in DIP points.</li>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a></li>\n<li><code>workArea</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - the work area of the display in DIP points.</li>\n<li><code>workAreaSize</code> <a href=\"/docs/api/structures/size\">Size</a></li>\n<li><code>internal</code> Boolean - <code>true</code> for an internal display and <code>false</code> for an external display</li>\n</ul>\n<p>The <code>Display</code> object represents a physical display connected to the system. A\nfake <code>Display</code> may exist on a headless system, or a <code>Display</code> may correspond to\na remote, virtual display.</p>",
      "title": "Display Object",
      "description": ""
    },
    "/docs/api/dock": {
      "locale": "en-US",
      "slug": "dock",
      "href": "/docs/api/dock",
      "crowdinFileId": "256311",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/dock.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-dock\"><a href=\"#class-dock\">Class: Dock</a></h2>\n<blockquote>\n<p>Control your app in the macOS dock</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>The following example shows how to bounce your icon on the dock.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.dock.bounce()\n</code></pre>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<h4 id=\"dockbouncetype-macos\"><a href=\"#dockbouncetype-macos\"><code>dock.bounce([type])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>critical</code> or <code>informational</code>. The default is\n<code>informational</code></li>\n</ul>\n<p>Returns <code>Integer</code> - an ID representing the request.</p>\n<p>When <code>critical</code> is passed, the dock icon will bounce until either the\napplication becomes active or the request is canceled.</p>\n<p>When <code>informational</code> is passed, the dock icon will bounce for one second.\nHowever, the request remains active until either the application becomes active\nor the request is canceled.</p>\n<p><strong>Nota Bene:</strong> This method can only be used while the app is not focused; when the app is focused it will return -1.</p>\n<h4 id=\"dockcancelbounceid-macos\"><a href=\"#dockcancelbounceid-macos\"><code>dock.cancelBounce(id)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Cancel the bounce of <code>id</code>.</p>\n<h4 id=\"dockdownloadfinishedfilepath-macos\"><a href=\"#dockdownloadfinishedfilepath-macos\"><code>dock.downloadFinished(filePath)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n</ul>\n<p>Bounces the Downloads stack if the filePath is inside the Downloads folder.</p>\n<h4 id=\"docksetbadgetext-macos\"><a href=\"#docksetbadgetext-macos\"><code>dock.setBadge(text)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Sets the string to be displayed in the dock’s badging area.</p>\n<h4 id=\"dockgetbadge-macos\"><a href=\"#dockgetbadge-macos\"><code>dock.getBadge()</code> <em>macOS</em></a></h4>\n<p>Returns <code>String</code> - The badge string of the dock.</p>\n<h4 id=\"dockhide-macos\"><a href=\"#dockhide-macos\"><code>dock.hide()</code> <em>macOS</em></a></h4>\n<p>Hides the dock icon.</p>\n<h4 id=\"dockshow-macos\"><a href=\"#dockshow-macos\"><code>dock.show()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the dock icon is shown.</p>\n<h4 id=\"dockisvisible-macos\"><a href=\"#dockisvisible-macos\"><code>dock.isVisible()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the dock icon is visible.</p>\n<h4 id=\"docksetmenumenu-macos\"><a href=\"#docksetmenumenu-macos\"><code>dock.setMenu(menu)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>menu</code> <a href=\"/docs/api/menu\">Menu</a></li>\n</ul>\n<p>Sets the application's [dock menu][dock-menu].</p>\n<h4 id=\"dockgetmenu-macos\"><a href=\"#dockgetmenu-macos\"><code>dock.getMenu()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Menu | null</code> - The application's [dock menu][dock-menu].</p>\n<h4 id=\"dockseticonimage-macos\"><a href=\"#dockseticonimage-macos\"><code>dock.setIcon(image)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>Sets the <code>image</code> associated with this dock icon.</p>",
      "title": "Dock",
      "description": "Control your app in the macOS dock"
    },
    "/docs/api/download-item": {
      "locale": "en-US",
      "slug": "download-item",
      "href": "/docs/api/download-item",
      "crowdinFileId": "256313",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/download-item.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-downloaditem\"><a href=\"#class-downloaditem\">Class: DownloadItem</a></h2>\n<blockquote>\n<p>Control file downloads from remote sources.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>DownloadItem</code> is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a> that represents a download item in Electron.\nIt is used in <code>will-download</code> event of <code>Session</code> class, and allows users to\ncontrol the download item.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In the main process.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.session.on(<span class=\"hljs-string\">'will-download'</span>, (event, item, webContents) => {\n  <span class=\"hljs-comment\">// Set the save path, making Electron not to prompt a save dialog.</span>\n  item.setSavePath(<span class=\"hljs-string\">'/tmp/save.pdf'</span>)\n\n  item.on(<span class=\"hljs-string\">'updated'</span>, (event, state) => {\n    <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'interrupted'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download is interrupted but can be resumed'</span>)\n    } <span class=\"hljs-keyword\">else</span> <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'progressing'</span>) {\n      <span class=\"hljs-keyword\">if</span> (item.isPaused()) {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download is paused'</span>)\n      } <span class=\"hljs-keyword\">else</span> {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Received bytes: <span class=\"hljs-subst\">${item.getReceivedBytes()}</span>`</span>)\n      }\n    }\n  })\n  item.once(<span class=\"hljs-string\">'done'</span>, (event, state) => {\n    <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'completed'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download successfully'</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Download failed: <span class=\"hljs-subst\">${state}</span>`</span>)\n    }\n  })\n})\n</code></pre>\n<h3 id=\"instance-events\"><a href=\"#instance-events\">Instance Events</a></h3>\n<h4 id=\"event-updated\"><a href=\"#event-updated\">Event: 'updated'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>state</code> String - Can be <code>progressing</code> or <code>interrupted</code>.</li>\n</ul>\n<p>Emitted when the download has been updated and is not done.</p>\n<p>The <code>state</code> can be one of following:</p>\n<ul>\n<li><code>progressing</code> - The download is in-progress.</li>\n<li><code>interrupted</code> - The download has interrupted and can be resumed.</li>\n</ul>\n<h4 id=\"event-done\"><a href=\"#event-done\">Event: 'done'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>state</code> String - Can be <code>completed</code>, <code>cancelled</code> or <code>interrupted</code>.</li>\n</ul>\n<p>Emitted when the download is in a terminal state. This includes a completed\ndownload, a cancelled download (via <code>downloadItem.cancel()</code>), and interrupted\ndownload that can't be resumed.</p>\n<p>The <code>state</code> can be one of following:</p>\n<ul>\n<li><code>completed</code> - The download completed successfully.</li>\n<li><code>cancelled</code> - The download has been cancelled.</li>\n<li><code>interrupted</code> - The download has interrupted and can not resume.</li>\n</ul>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<p>The <code>downloadItem</code> object has the following methods:</p>\n<h4 id=\"downloaditemsetsavepathpath\"><a href=\"#downloaditemsetsavepathpath\"><code>downloadItem.setSavePath(path)</code></a></h4>\n<ul>\n<li><code>path</code> String - Set the save file path of the download item.</li>\n</ul>\n<p>The API is only available in session's <code>will-download</code> callback function.\nIf <code>path</code> doesn't exist, Electron will try to make the directory recursively.\nIf user doesn't set the save path via the API, Electron will use the original\nroutine to determine the save path; this usually prompts a save dialog.</p>\n<h4 id=\"downloaditemgetsavepath\"><a href=\"#downloaditemgetsavepath\"><code>downloadItem.getSavePath()</code></a></h4>\n<p>Returns <code>String</code> - The save path of the download item. This will be either the path\nset via <code>downloadItem.setSavePath(path)</code> or the path selected from the shown\nsave dialog.</p>\n<h4 id=\"downloaditemsetsavedialogoptionsoptions\"><a href=\"#downloaditemsetsavedialogoptionsoptions\"><code>downloadItem.setSaveDialogOptions(options)</code></a></h4>\n<ul>\n<li><code>options</code> SaveDialogOptions - Set the save file dialog options. This object has the same\nproperties as the <code>options</code> parameter of <a href=\"/docs/api/dialog\"><code>dialog.showSaveDialog()</code></a>.</li>\n</ul>\n<p>This API allows the user to set custom options for the save dialog that opens\nfor the download item by default.\nThe API is only available in session's <code>will-download</code> callback function.</p>\n<h4 id=\"downloaditemgetsavedialogoptions\"><a href=\"#downloaditemgetsavedialogoptions\"><code>downloadItem.getSaveDialogOptions()</code></a></h4>\n<p>Returns <code>SaveDialogOptions</code> - Returns the object previously set by <code>downloadItem.setSaveDialogOptions(options)</code>.</p>\n<h4 id=\"downloaditempause\"><a href=\"#downloaditempause\"><code>downloadItem.pause()</code></a></h4>\n<p>Pauses the download.</p>\n<h4 id=\"downloaditemispaused\"><a href=\"#downloaditemispaused\"><code>downloadItem.isPaused()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the download is paused.</p>\n<h4 id=\"downloaditemresume\"><a href=\"#downloaditemresume\"><code>downloadItem.resume()</code></a></h4>\n<p>Resumes the download that has been paused.</p>\n<p><strong>Note:</strong> To enable resumable downloads the server you are downloading from must support range requests and provide both <code>Last-Modified</code> and <code>ETag</code> header values. Otherwise <code>resume()</code> will dismiss previously received bytes and restart the download from the beginning.</p>\n<h4 id=\"downloaditemcanresume\"><a href=\"#downloaditemcanresume\"><code>downloadItem.canResume()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the download can resume.</p>\n<h4 id=\"downloaditemcancel\"><a href=\"#downloaditemcancel\"><code>downloadItem.cancel()</code></a></h4>\n<p>Cancels the download operation.</p>\n<h4 id=\"downloaditemgeturl\"><a href=\"#downloaditemgeturl\"><code>downloadItem.getURL()</code></a></h4>\n<p>Returns <code>String</code> - The origin URL where the item is downloaded from.</p>\n<h4 id=\"downloaditemgetmimetype\"><a href=\"#downloaditemgetmimetype\"><code>downloadItem.getMimeType()</code></a></h4>\n<p>Returns <code>String</code> - The files mime type.</p>\n<h4 id=\"downloaditemhasusergesture\"><a href=\"#downloaditemhasusergesture\"><code>downloadItem.hasUserGesture()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the download has user gesture.</p>\n<h4 id=\"downloaditemgetfilename\"><a href=\"#downloaditemgetfilename\"><code>downloadItem.getFilename()</code></a></h4>\n<p>Returns <code>String</code> - The file name of the download item.</p>\n<p><strong>Note:</strong> The file name is not always the same as the actual one saved in local\ndisk. If user changes the file name in a prompted download saving dialog, the\nactual name of saved file will be different.</p>\n<h4 id=\"downloaditemgettotalbytes\"><a href=\"#downloaditemgettotalbytes\"><code>downloadItem.getTotalBytes()</code></a></h4>\n<p>Returns <code>Integer</code> - The total size in bytes of the download item.</p>\n<p>If the size is unknown, it returns 0.</p>\n<h4 id=\"downloaditemgetreceivedbytes\"><a href=\"#downloaditemgetreceivedbytes\"><code>downloadItem.getReceivedBytes()</code></a></h4>\n<p>Returns <code>Integer</code> - The received bytes of the download item.</p>\n<h4 id=\"downloaditemgetcontentdisposition\"><a href=\"#downloaditemgetcontentdisposition\"><code>downloadItem.getContentDisposition()</code></a></h4>\n<p>Returns <code>String</code> - The Content-Disposition field from the response\nheader.</p>\n<h4 id=\"downloaditemgetstate\"><a href=\"#downloaditemgetstate\"><code>downloadItem.getState()</code></a></h4>\n<p>Returns <code>String</code> - The current state. Can be <code>progressing</code>, <code>completed</code>, <code>cancelled</code> or <code>interrupted</code>.</p>\n<p><strong>Note:</strong> The following methods are useful specifically to resume a\n<code>cancelled</code> item when session is restarted.</p>\n<h4 id=\"downloaditemgeturlchain\"><a href=\"#downloaditemgeturlchain\"><code>downloadItem.getURLChain()</code></a></h4>\n<p>Returns <code>String[]</code> - The complete URL chain of the item including any redirects.</p>\n<h4 id=\"downloaditemgetlastmodifiedtime\"><a href=\"#downloaditemgetlastmodifiedtime\"><code>downloadItem.getLastModifiedTime()</code></a></h4>\n<p>Returns <code>String</code> - Last-Modified header value.</p>\n<h4 id=\"downloaditemgetetag\"><a href=\"#downloaditemgetetag\"><code>downloadItem.getETag()</code></a></h4>\n<p>Returns <code>String</code> - ETag header value.</p>\n<h4 id=\"downloaditemgetstarttime\"><a href=\"#downloaditemgetstarttime\"><code>downloadItem.getStartTime()</code></a></h4>\n<p>Returns <code>Double</code> - Number of seconds since the UNIX epoch when the download was\nstarted.</p>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<h4 id=\"downloaditemsavepath\"><a href=\"#downloaditemsavepath\"><code>downloadItem.savePath</code></a></h4>\n<p>A <code>String</code> property that determines the save file path of the download item.</p>\n<p>The property is only available in session's <code>will-download</code> callback function.\nIf user doesn't set the save path via the property, Electron will use the original\nroutine to determine the save path; this usually prompts a save dialog.</p>",
      "title": "DownloadItem",
      "description": "Control file downloads from remote sources."
    },
    "/docs/tutorial/electron-timelines": {
      "locale": "en-US",
      "slug": "electron-timelines",
      "href": "/docs/tutorial/electron-timelines",
      "crowdinFileId": "256197",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/electron-timelines.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-release-timelines\"><a href=\"#electron-release-timelines\">Electron Release Timelines</a></h1>\n<p>Special notes:</p>\n<ul>\n<li>The <code>-beta.1</code> and <code>stable</code> dates are our solid release dates.</li>\n<li>We strive for weekly beta releases, however we often release more betas than scheduled.</li>\n<li>All dates are our goals but there may be reasons for adjusting the stable deadline, such as security bugs.</li>\n<li>Take a look at the <a href=\"https://electronjs.org/blog/electron-5-0-timeline\">5.0.0 Timeline blog post</a> for info about publicizing our release dates.</li>\n<li>Since Electron 6.0, we've been targeting every other Chromium version and releasing our stable on the same day as Chrome stable. You can reference Chromium's release schedule <a href=\"https://chromiumdash.appspot.com/schedule\">here</a>. See <a href=\"https://www.electronjs.org/blog/12-week-cadence\">Electron's new release cadence blog post</a> for more details on our release schedule.</li>\n<li>Electron 15.0 only will include a special Alpha release. Starting in Electron 16.0, we will release on an 8-week cadence. See <a href=\"https://www.electronjs.org/blog/8-week-cadence\">Electron's new 8-week cadence blog post</a> for more details.</li>\n</ul>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Electron</th><th>Alpha</th><th>Beta</th><th>Stable</th><th>Chrome</th><th>Node</th></tr></thead><tbody><tr><td>2.0.0</td><td>--</td><td>2018-Feb-21</td><td>2018-May-01</td><td>M61</td><td>v8.9</td></tr><tr><td>3.0.0</td><td>--</td><td>2018-Jun-21</td><td>2018-Sep-18</td><td>M66</td><td>v10.2</td></tr><tr><td>4.0.0</td><td>--</td><td>2018-Oct-11</td><td>2018-Dec-20</td><td>M69</td><td>v10.11</td></tr><tr><td>5.0.0</td><td>--</td><td>2019-Jan-22</td><td>2019-Apr-24</td><td>M73</td><td>v12.0</td></tr><tr><td>6.0.0</td><td>--</td><td>2019-May-01</td><td>2019-Jul-30</td><td>M76</td><td>v12.4</td></tr><tr><td>7.0.0</td><td>--</td><td>2019-Aug-01</td><td>2019-Oct-22</td><td>M78</td><td>v12.8</td></tr><tr><td>8.0.0</td><td>--</td><td>2019-Oct-24</td><td>2020-Feb-04</td><td>M80</td><td>v12.13</td></tr><tr><td>9.0.0</td><td>--</td><td>2020-Feb-06</td><td>2020-May-19</td><td>M83</td><td>v12.14</td></tr><tr><td>10.0.0</td><td>--</td><td>2020-May-21</td><td>2020-Aug-25</td><td>M85</td><td>v12.16</td></tr><tr><td>11.0.0</td><td>--</td><td>2020-Aug-27</td><td>2020-Nov-17</td><td>M87</td><td>v12.18</td></tr><tr><td>12.0.0</td><td>--</td><td>2020-Nov-19</td><td>2021-Mar-02</td><td>M89</td><td>v14.16</td></tr><tr><td>13.0.0</td><td>--</td><td>2021-Mar-04</td><td>2021-May-25</td><td>M91</td><td>v14.16</td></tr><tr><td>14.0.0</td><td>--</td><td>2021-May-27</td><td>2021-Aug-31</td><td>M93</td><td>v14.17</td></tr><tr><td>15.0.0</td><td>2021-Jul-20</td><td>2021-Sep-01</td><td>2021-Sep-21</td><td>M94</td><td>v16.5</td></tr><tr><td>16.0.0</td><td>--</td><td>2021-Sep-23</td><td>2021-Nov-16</td><td>M96</td><td>TBD</td></tr></tbody></table>",
      "title": "Electron Release Timelines",
      "description": ""
    },
    "/docs/tutorial/electron-versioning": {
      "locale": "en-US",
      "slug": "electron-versioning",
      "href": "/docs/tutorial/electron-versioning",
      "crowdinFileId": "256199",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/electron-versioning.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-versioning\"><a href=\"#electron-versioning\">Electron Versioning</a></h1>\n<blockquote>\n<p>A detailed look at our versioning policy and implementation.</p>\n</blockquote>\n<p>As of version 2.0.0, Electron follows <a href=\"#semver\">SemVer</a>. The following command will install the most recent stable build of Electron:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron\n</code></pre>\n<p>To update an existing project to use the latest stable version:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron@latest\n</code></pre>\n<h2 id=\"version-1x\"><a href=\"#version-1x\">Version 1.x</a></h2>\n<p>Electron versions <em>&#x3C; 2.0</em> did not conform to the <a href=\"https://semver.org\">SemVer</a> spec: major versions corresponded to end-user API changes, minor versions corresponded to Chromium major releases, and patch versions corresponded to new features and bug fixes. While convenient for developers merging features, it creates problems for developers of client-facing applications. The QA testing cycles of major apps like Slack, Stride, Teams, Skype, VS Code, Atom, and Desktop can be lengthy and stability is a highly desired outcome. There is a high risk in adopting new features while trying to absorb bug fixes.</p>\n<p>Here is an example of the 1.x strategy:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-0.png\" alt=\"1.x Versioning\"></p>\n<p>An app developed with <code>1.8.1</code> cannot take the <code>1.8.3</code> bug fix without either absorbing the <code>1.8.2</code> feature, or by backporting the fix and maintaining a new release line.</p>\n<h2 id=\"version-20-and-beyond\"><a href=\"#version-20-and-beyond\">Version 2.0 and Beyond</a></h2>\n<p>There are several major changes from our 1.x strategy outlined below. Each change is intended to satisfy the needs and priorities of developers/maintainers and app developers.</p>\n<ol>\n<li>Strict use of SemVer</li>\n<li>Introduction of semver-compliant <code>-beta</code> tags</li>\n<li>Introduction of <a href=\"https://conventionalcommits.org/\">conventional commit messages</a></li>\n<li>Well-defined stabilization branches</li>\n<li>The <code>master</code> branch is versionless; only stabilization branches contain version information</li>\n</ol>\n<p>We will cover in detail how git branching works, how npm tagging works, what developers should expect to see, and how one can backport changes.</p>\n<h1 id=\"semver\"><a href=\"#semver\">SemVer</a></h1>\n<p>From 2.0 onward, Electron will follow SemVer.</p>\n<p>Below is a table explicitly mapping types of changes to their corresponding category of SemVer (e.g. Major, Minor, Patch).</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Major Version Increments</th><th>Minor Version Increments</th><th>Patch Version Increments</th></tr></thead><tbody><tr><td>Electron breaking API changes</td><td>Electron non-breaking API changes</td><td>Electron bug fixes</td></tr><tr><td>Node.js major version updates</td><td>Node.js minor version updates</td><td>Node.js patch version updates</td></tr><tr><td>Chromium version updates</td><td></td><td>fix-related chromium patches</td></tr></tbody></table>\n<p>Note that most Chromium updates will be considered breaking. Fixes that can be backported will likely be cherry-picked as patches.</p>\n<h1 id=\"stabilization-branches\"><a href=\"#stabilization-branches\">Stabilization Branches</a></h1>\n<p>Stabilization branches are branches that run parallel to master, taking in only cherry-picked commits that are related to security or stability. These branches are never merged back to master.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-1.png\" alt=\"Stabilization Branches\"></p>\n<p>Since Electron 8, stabilization branches are always <strong>major</strong> version lines, and named against the following template <code>$MAJOR-x-y</code> e.g. <code>8-x-y</code>.  Prior to that we used <strong>minor</strong> version lines and named them as <code>$MAJOR-$MINOR-x</code> e.g. <code>2-0-x</code></p>\n<p>We allow for multiple stabilization branches to exist simultaneously, and intend to support at least two in parallel at all times, backporting security fixes as necessary.\n<img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-2.png\" alt=\"Multiple Stability Branches\"></p>\n<p>Older lines will not be supported by GitHub, but other groups can take ownership and backport stability and security fixes on their own. We discourage this, but recognize that it makes life easier for many app developers.</p>\n<h1 id=\"beta-releases-and-bug-fixes\"><a href=\"#beta-releases-and-bug-fixes\">Beta Releases and Bug Fixes</a></h1>\n<p>Developers want to know which releases are <em>safe</em> to use. Even seemingly innocent features can introduce regressions in complex applications. At the same time, locking to a fixed version is dangerous because you’re ignoring security patches and bug fixes that may have come out since your version. Our goal is to allow the following standard semver ranges in <code>package.json</code> :</p>\n<ul>\n<li>Use <code>~2.0.0</code> to admit only stability or security related fixes to your <code>2.0.0</code> release.</li>\n<li>Use <code>^2.0.0</code> to admit non-breaking <em>reasonably stable</em> feature work as well as security and bug fixes.</li>\n</ul>\n<p>What’s important about the second point is that apps using <code>^</code> should still be able to expect a reasonable level of stability. To accomplish this, SemVer allows for a <em>pre-release identifier</em> to indicate a particular version is not yet <em>safe</em> or <em>stable</em>.</p>\n<p>Whatever you choose, you will periodically have to bump the version in your <code>package.json</code> as breaking changes are a fact of Chromium life.</p>\n<p>The process is as follows:</p>\n<ol>\n<li>All new major and minor releases lines begin with a beta series indicated by SemVer prerelease tags of <code>beta.N</code>, e.g. <code>2.0.0-beta.1</code>. After the first beta, subsequent beta releases must meet all of the following conditions:<ol>\n<li>The change is backwards API-compatible (deprecations are allowed)</li>\n<li>The risk to meeting our stability timeline must be low.</li>\n</ol></li>\n<li>If allowed changes need to be made once a release is beta, they are applied and the prerelease tag is incremented, e.g. <code>2.0.0-beta.2</code>.</li>\n<li>If a particular beta release is <em>generally regarded</em> as stable, it will be re-released as a stable build, changing only the version information. e.g. <code>2.0.0</code>. After the first stable, all changes must be backwards-compatible bug or security fixes.</li>\n<li>If future bug fixes or security patches need to be made once a release is stable, they are applied and the <em>patch</em> version is incremented\ne.g. <code>2.0.1</code>.</li>\n</ol>\n<p>Specifically, the above means:</p>\n<ol>\n<li>Admitting non-breaking-API changes before Week 3 in the beta cycle is okay, even if those changes have the potential to cause moderate side-effects.</li>\n<li>Admitting feature-flagged changes, that do not otherwise alter existing code paths, at most points in the beta cycle is okay. Users can explicitly enable those flags in their apps.</li>\n<li>Admitting features of any sort after Week 3 in the beta cycle is 👎 without a very good reason.</li>\n</ol>\n<p>For each major and minor bump, you should expect to see something like the following:</p>\n<pre><code class=\"hljs language-plaintext\">2.0.0-beta.1\n2.0.0-beta.2\n2.0.0-beta.3\n2.0.0\n2.0.1\n2.0.2\n</code></pre>\n<p>An example lifecycle in pictures:</p>\n<ul>\n<li>A new release branch is created that includes the latest set of features. It is published as <code>2.0.0-beta.1</code>.\n<img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-3.png\" alt=\"New Release Branch\"></li>\n<li>A bug fix comes into master that can be backported to the release branch. The patch is applied, and a new beta is published as <code>2.0.0-beta.2</code>.\n<img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-4.png\" alt=\"Bugfix Backport to Beta\"></li>\n<li>The beta is considered <em>generally stable</em> and it is published again as a non-beta under <code>2.0.0</code>.\n<img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-5.png\" alt=\"Beta to Stable\"></li>\n<li>Later, a zero-day exploit is revealed and a fix is applied to master. We backport the fix to the <code>2-0-x</code> line and release <code>2.0.1</code>.\n<img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-6.png\" alt=\"Security Backports\"></li>\n</ul>\n<p>A few examples of how various SemVer ranges will pick up new releases:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-7.png\" alt=\"Semvers and Releases\"></p>\n<h1 id=\"missing-features-alphas\"><a href=\"#missing-features-alphas\">Missing Features: Alphas</a></h1>\n<p>Our strategy has a few tradeoffs, which for now we feel are appropriate. Most importantly that new features in master may take a while before reaching a stable release line. If you want to try a new feature immediately, you will have to build Electron yourself.</p>\n<p>As a future consideration, we may introduce one or both of the following:</p>\n<ul>\n<li>alpha releases that have looser stability constraints to betas; for example it would be allowable to admit new features while a stability channel is in <em>alpha</em></li>\n</ul>\n<h1 id=\"feature-flags\"><a href=\"#feature-flags\">Feature Flags</a></h1>\n<p>Feature flags are a common practice in Chromium, and are well-established in the web-development ecosystem. In the context of Electron, a feature flag or <strong>soft branch</strong> must have the following properties:</p>\n<ul>\n<li>it is enabled/disabled either at runtime, or build-time; we do not support the concept of a request-scoped feature flag</li>\n<li>it completely segments new and old code paths; refactoring old code to support a new feature <em>violates</em> the feature-flag contract</li>\n<li>feature flags are eventually removed after the feature is released</li>\n</ul>\n<h1 id=\"semantic-commits\"><a href=\"#semantic-commits\">Semantic Commits</a></h1>\n<p>We seek to increase clarity at all levels of the update and releases process. Starting with <code>2.0.0</code> we will require pull requests adhere to the <a href=\"https://conventionalcommits.org/\">Conventional Commits</a> spec, which can be summarized as follows:</p>\n<ul>\n<li>\n<p>Commits that would result in a SemVer <strong>major</strong> bump must start their body with <code>BREAKING CHANGE:</code>.</p>\n</li>\n<li>\n<p>Commits that would result in a SemVer <strong>minor</strong> bump must start with <code>feat:</code>.</p>\n</li>\n<li>\n<p>Commits that would result in a SemVer <strong>patch</strong> bump must start with <code>fix:</code>.</p>\n</li>\n<li>\n<p>We allow squashing of commits, provided that the squashed message adheres to the above message format.</p>\n</li>\n<li>\n<p>It is acceptable for some commits in a pull request to not include a semantic prefix, as long as the pull request title contains a meaningful encompassing semantic message.</p>\n</li>\n</ul>\n<h1 id=\"versioned-master\"><a href=\"#versioned-master\">Versioned <code>master</code></a></h1>\n<ul>\n<li>The <code>master</code> branch will always contain the next major version <code>X.0.0-nightly.DATE</code> in its <code>package.json</code></li>\n<li>Release branches are never merged back to master</li>\n<li>Release branches <em>do</em> contain the correct version in their <code>package.json</code></li>\n<li>As soon as a release branch is cut for a major, master must be bumped to the next major.  I.e. <code>master</code> is always versioned as the next theoretical release branch</li>\n</ul>",
      "title": "Electron Versioning",
      "description": "A detailed look at our versioning policy and implementation."
    },
    "/docs/development/electron-vs-nwjs": {
      "locale": "en-US",
      "slug": "electron-vs-nwjs",
      "href": "/docs/development/electron-vs-nwjs",
      "crowdinFileId": "256155",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/electron-vs-nwjs.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"technical-differences-between-electron-and-nwjs\"><a href=\"#technical-differences-between-electron-and-nwjs\">Technical Differences Between Electron and NW.js</a></h1>\n<p>Like <a href=\"https://nwjs.io/\">NW.js</a>, Electron provides a platform to write desktop applications with web\ntechnologies. Both platforms enable developers to utilize HTML, JavaScript, and\nNode.js. On the surface, they seem very similar.</p>\n<p>There are however fundamental differences between the two projects that make\nElectron a completely separate product from NW.js.</p>\n<h2 id=\"1-entry-of-application\"><a href=\"#1-entry-of-application\">1) Entry of Application</a></h2>\n<p>In NW.js, the main entry point of an application can be an HTML web page. In\nthat case, NW.js will open the given entry point in a browser window.</p>\n<p>In Electron, the entry point is always a JavaScript script. Instead of providing a\nURL directly, you manually create a browser window and load an HTML file using\nthe API. You also need to listen to window events to decide when to quit the\napplication.</p>\n<p>Electron works more like the Node.js runtime. Electron's APIs are lower level so\nyou can use it for browser testing in place of\n<a href=\"https://phantomjs.org/\">PhantomJS</a>.</p>\n<h2 id=\"2-node-integration\"><a href=\"#2-node-integration\">2) Node Integration</a></h2>\n<p>In NW.js, the Node integration in web pages requires patching Chromium to work,\nwhile in Electron we chose a different way to integrate the <code>libuv</code> loop with\neach platform's message loop to avoid hacking Chromium. See the\n<a href=\"https://github.com/electron/electron/tree/main/lib/common\"><code>node_bindings</code></a> code for how that was done.</p>\n<h2 id=\"3-javascript-contexts\"><a href=\"#3-javascript-contexts\">3) JavaScript Contexts</a></h2>\n<p>If you are an experienced NW.js user, you should be familiar with the concept of\nNode context and web context. These concepts were invented because of how NW.js\nwas implemented.</p>\n<p>By using the\n<a href=\"https://github.com/nodejs/node-v0.x-archive/commit/756b622\">multi-context</a>\nfeature of Node, Electron doesn't introduce a new JavaScript context in web\npages.</p>\n<p>Note: NW.js has optionally supported multi-context since 0.13.</p>\n<h2 id=\"4-legacy-support\"><a href=\"#4-legacy-support\">4) Legacy Support</a></h2>\n<p>NW.js still offers a \"legacy release\" that supports Windows XP. It doesn't\nreceive security updates.</p>\n<p>Given that hardware manufacturers, Microsoft, Chromium, and Node.js haven't\nreleased even critical security updates for that system, we have to warn you\nthat using Windows XP is wildly insecure and outright irresponsible.</p>\n<p>However, we understand that requirements outside our wildest imagination may\nexist, so if you're looking for something like Electron that runs on Windows XP,\nthe NW.js legacy release might be the right fit for you.</p>\n<h2 id=\"5-features\"><a href=\"#5-features\">5) Features</a></h2>\n<p>There are numerous differences in the amount of supported features. Electron has\na bigger community, more production apps using it, and <a href=\"https://www.npmjs.com/search?q=electron\">a large amount of\nuserland modules available on npm</a>.</p>\n<p>As an example, Electron has built-in support for automatic updates and countless\ntools that make the creation of installers easier. As an example in favor of\nNW.js, NW.js supports more <code>Chrome.*</code> APIs for the development of Chrome Apps.</p>\n<p>Naturally, we believe that Electron is the better platform for polished\nproduction applications built with web technologies (like Visual Studio Code,\nSlack, or Facebook Messenger); however, we want to be fair to our web technology\nfriends. If you have feature needs that Electron does not meet, you might want\nto try NW.js.</p>",
      "title": "Technical Differences Between Electron and NW.js",
      "description": ""
    },
    "/docs/api/environment-variables": {
      "locale": "en-US",
      "slug": "environment-variables",
      "href": "/docs/api/environment-variables",
      "crowdinFileId": "256315",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/environment-variables.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"environment-variables\"><a href=\"#environment-variables\">Environment Variables</a></h1>\n<blockquote>\n<p>Control application configuration and behavior without changing code.</p>\n</blockquote>\n<p>Certain Electron behaviors are controlled by environment variables because they\nare initialized earlier than the command line flags and the app's code.</p>\n<p>POSIX shell example:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">export</span> ELECTRON_ENABLE_LOGGING=<span class=\"hljs-literal\">true</span>\n$ electron\n</code></pre>\n<p>Windows console example:</p>\n<pre><code class=\"hljs language-powershell\">> set ELECTRON_ENABLE_LOGGING=true\n> electron\n</code></pre>\n<h2 id=\"production-variables\"><a href=\"#production-variables\">Production Variables</a></h2>\n<p>The following environment variables are intended primarily for use at runtime\nin packaged Electron applications.</p>\n<h3 id=\"node_options\"><a href=\"#node_options\"><code>NODE_OPTIONS</code></a></h3>\n<p>Electron includes support for a subset of Node's <a href=\"https://nodejs.org/api/cli.html#cli_node_options_options\"><code>NODE_OPTIONS</code></a>. The majority are supported with the exception of those which conflict with Chromium's use of BoringSSL.</p>\n<p>Example:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">export</span> NODE_OPTIONS=<span class=\"hljs-string\">\"--no-warnings --max-old-space-size=2048\"</span>\n</code></pre>\n<p>Unsupported options are:</p>\n<pre><code class=\"hljs language-sh\">--use-bundled-ca\n--force-fips\n--<span class=\"hljs-built_in\">enable</span>-fips\n--openssl-config\n--use-openssl-ca\n</code></pre>\n<p><code>NODE_OPTIONS</code> are explicitly disallowed in packaged apps, except for the following:</p>\n<pre><code class=\"hljs language-sh\">--max-http-header-size\n--http-parser\n</code></pre>\n<h3 id=\"google_api_key\"><a href=\"#google_api_key\"><code>GOOGLE_API_KEY</code></a></h3>\n<p>Geolocation support in Electron requires the use of Google Cloud Platform's\ngeolocation webservice. To enable this feature, acquire a\n<a href=\"https://developers.google.com/maps/documentation/geolocation/get-api-key\">Google API key</a>\nand place the following code in your main process file, before opening any\nbrowser windows that will make geolocation requests:</p>\n<pre><code class=\"hljs language-javascript\">process.env.GOOGLE_API_KEY = <span class=\"hljs-string\">'YOUR_KEY_HERE'</span>\n</code></pre>\n<p>By default, a newly generated Google API key may not be allowed to make geolocation requests.\nTo enable the geolocation webservice for your project, enable it through the\n<a href=\"https://console.cloud.google.com/apis/library\">API library</a>.</p>\n<p>N.B. You will need to add a\n<a href=\"https://cloud.google.com/billing/docs/how-to/payment-methods#add_a_payment_method\">Billing Account</a>\nto the project associated to the API key for the geolocation webservice to work.</p>\n<h3 id=\"electron_no_asar\"><a href=\"#electron_no_asar\"><code>ELECTRON_NO_ASAR</code></a></h3>\n<p>Disables ASAR support. This variable is only supported in forked child processes\nand spawned child processes that set <code>ELECTRON_RUN_AS_NODE</code>.</p>\n<h3 id=\"electron_run_as_node\"><a href=\"#electron_run_as_node\"><code>ELECTRON_RUN_AS_NODE</code></a></h3>\n<p>Starts the process as a normal Node.js process.</p>\n<p>In this mode, you will be able to pass <a href=\"https://nodejs.org/api/cli.html\">cli options</a> to Node.js as\nyou would when running the normal Node.js executable, with the exception of the following flags:</p>\n<ul>\n<li>\"--openssl-config\"</li>\n<li>\"--use-bundled-ca\"</li>\n<li>\"--use-openssl-ca\",</li>\n<li>\"--force-fips\"</li>\n<li>\"--enable-fips\"</li>\n</ul>\n<p>These flags are disabled owing to the fact that Electron uses BoringSSL instead of OpenSSL when building Node.js'\n<code>crypto</code> module, and so will not work as designed.</p>\n<h3 id=\"electron_no_attach_console-windows\"><a href=\"#electron_no_attach_console-windows\"><code>ELECTRON_NO_ATTACH_CONSOLE</code> <em>Windows</em></a></h3>\n<p>Don't attach to the current console session.</p>\n<h3 id=\"electron_force_window_menu_bar-linux\"><a href=\"#electron_force_window_menu_bar-linux\"><code>ELECTRON_FORCE_WINDOW_MENU_BAR</code> <em>Linux</em></a></h3>\n<p>Don't use the global menu bar on Linux.</p>\n<h3 id=\"electron_trash-linux\"><a href=\"#electron_trash-linux\"><code>ELECTRON_TRASH</code> <em>Linux</em></a></h3>\n<p>Set the trash implementation on Linux. Default is <code>gio</code>.</p>\n<p>Options:</p>\n<ul>\n<li><code>gvfs-trash</code></li>\n<li><code>trash-cli</code></li>\n<li><code>kioclient5</code></li>\n<li><code>kioclient</code></li>\n</ul>\n<h2 id=\"development-variables\"><a href=\"#development-variables\">Development Variables</a></h2>\n<p>The following environment variables are intended primarily for development and\ndebugging purposes.</p>\n<h3 id=\"electron_enable_logging\"><a href=\"#electron_enable_logging\"><code>ELECTRON_ENABLE_LOGGING</code></a></h3>\n<p>Prints Chromium's internal logging to the console.</p>\n<p>Setting this variable is the same as passing <code>--enable-logging</code>\non the command line. For more info, see <code>--enable-logging</code> in <a href=\"/docs/api/command-line-switches#enable-loggingfile\">command-line\nswitches</a>.</p>\n<h3 id=\"electron_log_file\"><a href=\"#electron_log_file\"><code>ELECTRON_LOG_FILE</code></a></h3>\n<p>Sets the file destination for Chromium's internal logging.</p>\n<p>Setting this variable is the same as passing <code>--log-file</code>\non the command line. For more info, see <code>--log-file</code> in <a href=\"/docs/api/command-line-switches#log-filepath\">command-line\nswitches</a>.</p>\n<h3 id=\"electron_debug_drag_regions\"><a href=\"#electron_debug_drag_regions\"><code>ELECTRON_DEBUG_DRAG_REGIONS</code></a></h3>\n<p>Adds coloration to draggable regions on <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>s on macOS - draggable regions will be colored\ngreen and non-draggable regions will be colored red to aid debugging.</p>\n<h3 id=\"electron_debug_notifications\"><a href=\"#electron_debug_notifications\"><code>ELECTRON_DEBUG_NOTIFICATIONS</code></a></h3>\n<p>Adds extra logs to <a href=\"/docs/api/notification\"><code>Notification</code></a> lifecycles on macOS to aid in debugging. Extra logging will be displayed when new Notifications are created or activated. They will also be displayed when common a\ntions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.</p>\n<p>Sample output:</p>\n<pre><code class=\"hljs language-sh\">Notification created (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification displayed (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification activated (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification replied to (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\n</code></pre>\n<h3 id=\"electron_log_asar_reads\"><a href=\"#electron_log_asar_reads\"><code>ELECTRON_LOG_ASAR_READS</code></a></h3>\n<p>When Electron reads from an ASAR file, log the read offset and file path to\nthe system <code>tmpdir</code>. The resulting file can be provided to the ASAR module\nto optimize file ordering.</p>\n<h3 id=\"electron_enable_stack_dumping\"><a href=\"#electron_enable_stack_dumping\"><code>ELECTRON_ENABLE_STACK_DUMPING</code></a></h3>\n<p>Prints the stack trace to the console when Electron crashes.</p>\n<p>This environment variable will not work if the <code>crashReporter</code> is started.</p>\n<h3 id=\"electron_default_error_mode-windows\"><a href=\"#electron_default_error_mode-windows\"><code>ELECTRON_DEFAULT_ERROR_MODE</code> <em>Windows</em></a></h3>\n<p>Shows the Windows's crash dialog when Electron crashes.</p>\n<p>This environment variable will not work if the <code>crashReporter</code> is started.</p>\n<h3 id=\"electron_override_dist_path\"><a href=\"#electron_override_dist_path\"><code>ELECTRON_OVERRIDE_DIST_PATH</code></a></h3>\n<p>When running from the <code>electron</code> package, this variable tells\nthe <code>electron</code> command to use the specified build of Electron instead of\nthe one downloaded by <code>npm install</code>. Usage:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">export</span> ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Testing\n</code></pre>\n<h2 id=\"set-by-electron\"><a href=\"#set-by-electron\">Set By Electron</a></h2>\n<p>Electron sets some variables in your environment at runtime.</p>\n<h3 id=\"original_xdg_current_desktop\"><a href=\"#original_xdg_current_desktop\"><code>ORIGINAL_XDG_CURRENT_DESKTOP</code></a></h3>\n<p>This variable is set to the value of <code>XDG_CURRENT_DESKTOP</code> that your application\noriginally launched with.  Electron sometimes modifies the value of <code>XDG_CURRENT_DESKTOP</code>\nto affect other logic within Chromium so if you want access to the <em>original</em> value\nyou should look up this environment variable instead.</p>",
      "title": "Environment Variables",
      "description": "Control application configuration and behavior without changing code."
    },
    "/docs/api/structures/event": {
      "locale": "en-US",
      "slug": "event",
      "href": "/docs/api/structures/event",
      "crowdinFileId": "256429",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"event-object-extends-globalevent\"><a href=\"#event-object-extends-globalevent\">Event Object extends <code>GlobalEvent</code></a></h1>\n<ul>\n<li><code>preventDefault</code> VoidFunction</li>\n</ul>",
      "title": "Event Object extends GlobalEvent",
      "description": ""
    },
    "/docs/experimental": {
      "locale": "en-US",
      "slug": "experimental",
      "href": "/docs/experimental",
      "crowdinFileId": "256119",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/experimental.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"experimental-apis\"><a href=\"#experimental-apis\">Experimental APIs</a></h1>\n<p>Some of Electrons APIs are tagged with <code>_Experimental_</code> in the documentation.\nThis tag indicates that the API may not be considered stable and the API may\nbe removed or modified more frequently than other APIs with less warning.</p>\n<h2 id=\"conditions-for-an-api-to-be-tagged-as-experimental\"><a href=\"#conditions-for-an-api-to-be-tagged-as-experimental\">Conditions for an API to be tagged as Experimental</a></h2>\n<p>Anyone can request an API be tagged as experimental in a feature PR, disagreements\non the experimental nature of a feature can be discussed in the API WG if they\ncan't be resolved in the PR.</p>\n<h2 id=\"process-for-removing-the-experimental-tag\"><a href=\"#process-for-removing-the-experimental-tag\">Process for removing the Experimental tag</a></h2>\n<p>Once an API has been stable and in at least two major stable release lines it\ncan be nominated to have its experimental tag removed.  This discussion should\nhappen at an API WG meeting.  Things to consider when discussing / nominating:</p>\n<ul>\n<li>The above \"two major stables release lines\" condition must have been met</li>\n<li>During that time no major bugs / issues should have been caused by the adoption of this feature</li>\n<li>The API is stable enough and hasn't been heavily impacted by Chromium upgrades</li>\n<li>Is anyone using the API?</li>\n<li>Is the API fulfilling the original proposed usecases, does it have any gaps?</li>\n</ul>",
      "title": "Experimental APIs",
      "description": ""
    },
    "/docs/api/structures/extension": {
      "locale": "en-US",
      "slug": "extension",
      "href": "/docs/api/structures/extension",
      "crowdinFileId": "256433",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/extension.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"extension-object\"><a href=\"#extension-object\">Extension Object</a></h1>\n<ul>\n<li><code>id</code> String</li>\n<li><code>manifest</code> any - Copy of the <a href=\"https://developer.chrome.com/extensions/manifest\">extension's manifest data</a>.</li>\n<li><code>name</code> String</li>\n<li><code>path</code> String - The extension's file path.</li>\n<li><code>version</code> String</li>\n<li><code>url</code> String - The extension's <code>chrome-extension://</code> URL.</li>\n</ul>",
      "title": "Extension Object",
      "description": ""
    },
    "/docs/api/structures/extension-info": {
      "locale": "en-US",
      "slug": "extension-info",
      "href": "/docs/api/structures/extension-info",
      "crowdinFileId": "256431",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/extension-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"extensioninfo-object\"><a href=\"#extensioninfo-object\">ExtensionInfo Object</a></h1>\n<ul>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>",
      "title": "ExtensionInfo Object",
      "description": ""
    },
    "/docs/api/extensions": {
      "locale": "en-US",
      "slug": "extensions",
      "href": "/docs/api/extensions",
      "crowdinFileId": "256317",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/extensions.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"chrome-extension-support\"><a href=\"#chrome-extension-support\">Chrome Extension Support</a></h1>\n<p>Electron supports a subset of the <a href=\"https://developer.chrome.com/extensions/api_index\">Chrome Extensions\nAPI</a>, primarily to support DevTools extensions and\nChromium-internal extensions, but it also happens to support some other\nextension capabilities.</p>\n<blockquote>\n<p><strong>Note:</strong> Electron does not support arbitrary Chrome extensions from the\nstore, and it is a <strong>non-goal</strong> of the Electron project to be perfectly\ncompatible with Chrome's implementation of Extensions.</p>\n</blockquote>\n<h2 id=\"loading-extensions\"><a href=\"#loading-extensions\">Loading extensions</a></h2>\n<p>Electron only supports loading unpacked extensions (i.e., <code>.crx</code> files do not\nwork). Extensions are installed per-<code>session</code>. To load an extension, call\n<a href=\"/docs/api/session#sesloadextensionpath-options\"><code>ses.loadExtension</code></a>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession.loadExtension(<span class=\"hljs-string\">'path/to/unpacked/extension'</span>).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ id }</span>) =></span> {\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<p>Loaded extensions will not be automatically remembered across exits; if you do\nnot call <code>loadExtension</code> when the app runs, the extension will not be loaded.</p>\n<p>Note that loading extensions is only supported in persistent sessions.\nAttempting to load an extension into an in-memory session will throw an error.</p>\n<p>See the <a href=\"/docs/api/session\"><code>session</code></a> documentation for more information about\nloading, unloading, and querying active extensions.</p>\n<h2 id=\"supported-extensions-apis\"><a href=\"#supported-extensions-apis\">Supported Extensions APIs</a></h2>\n<p>We support the following extensions APIs, with some caveats. Other APIs may\nadditionally be supported, but support for any APIs not listed here is\nprovisional and may be removed.</p>\n<h3 id=\"chromedevtoolsinspectedwindow\"><a href=\"#chromedevtoolsinspectedwindow\"><code>chrome.devtools.inspectedWindow</code></a></h3>\n<p>All features of this API are supported.</p>\n<h3 id=\"chromedevtoolsnetwork\"><a href=\"#chromedevtoolsnetwork\"><code>chrome.devtools.network</code></a></h3>\n<p>All features of this API are supported.</p>\n<h3 id=\"chromedevtoolspanels\"><a href=\"#chromedevtoolspanels\"><code>chrome.devtools.panels</code></a></h3>\n<p>All features of this API are supported.</p>\n<h3 id=\"chromeextension\"><a href=\"#chromeextension\"><code>chrome.extension</code></a></h3>\n<p>The following properties of <code>chrome.extension</code> are supported:</p>\n<ul>\n<li><code>chrome.extension.lastError</code></li>\n</ul>\n<p>The following methods of <code>chrome.extension</code> are supported:</p>\n<ul>\n<li><code>chrome.extension.getURL</code></li>\n<li><code>chrome.extension.getBackgroundPage</code></li>\n</ul>\n<h3 id=\"chromeruntime\"><a href=\"#chromeruntime\"><code>chrome.runtime</code></a></h3>\n<p>The following properties of <code>chrome.runtime</code> are supported:</p>\n<ul>\n<li><code>chrome.runtime.lastError</code></li>\n<li><code>chrome.runtime.id</code></li>\n</ul>\n<p>The following methods of <code>chrome.runtime</code> are supported:</p>\n<ul>\n<li><code>chrome.runtime.getBackgroundPage</code></li>\n<li><code>chrome.runtime.getManifest</code></li>\n<li><code>chrome.runtime.getPlatformInfo</code></li>\n<li><code>chrome.runtime.getURL</code></li>\n<li><code>chrome.runtime.connect</code></li>\n<li><code>chrome.runtime.sendMessage</code></li>\n<li><code>chrome.runtime.reload</code></li>\n</ul>\n<p>The following events of <code>chrome.runtime</code> are supported:</p>\n<ul>\n<li><code>chrome.runtime.onStartup</code></li>\n<li><code>chrome.runtime.onInstalled</code></li>\n<li><code>chrome.runtime.onSuspend</code></li>\n<li><code>chrome.runtime.onSuspendCanceled</code></li>\n<li><code>chrome.runtime.onConnect</code></li>\n<li><code>chrome.runtime.onMessage</code></li>\n</ul>\n<h3 id=\"chromestorage\"><a href=\"#chromestorage\"><code>chrome.storage</code></a></h3>\n<p>Only <code>chrome.storage.local</code> is supported; <code>chrome.storage.sync</code> and\n<code>chrome.storage.managed</code> are not.</p>\n<h3 id=\"chrometabs\"><a href=\"#chrometabs\"><code>chrome.tabs</code></a></h3>\n<p>The following methods of <code>chrome.tabs</code> are supported:</p>\n<ul>\n<li><code>chrome.tabs.sendMessage</code></li>\n<li><code>chrome.tabs.executeScript</code></li>\n</ul>\n<blockquote>\n<p><strong>Note:</strong> In Chrome, passing <code>-1</code> as a tab ID signifies the \"currently active\ntab\". Since Electron has no such concept, passing <code>-1</code> as a tab ID is not\nsupported and will raise an error.</p>\n</blockquote>\n<h3 id=\"chromemanagement\"><a href=\"#chromemanagement\"><code>chrome.management</code></a></h3>\n<p>The following methods of <code>chrome.management</code> are supported:</p>\n<ul>\n<li><code>chrome.management.getAll</code></li>\n<li><code>chrome.management.get</code></li>\n<li><code>chrome.management.getSelf</code></li>\n<li><code>chrome.management.getPermissionWarningsById</code></li>\n<li><code>chrome.management.getPermissionWarningsByManifest</code></li>\n<li><code>chrome.management.onEnabled</code></li>\n<li><code>chrome.management.onDisabled</code></li>\n</ul>\n<h3 id=\"chromewebrequest\"><a href=\"#chromewebrequest\"><code>chrome.webRequest</code></a></h3>\n<p>All features of this API are supported.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Electron's <a href=\"/docs/api/web-request\"><code>webRequest</code></a> module takes precedence over <code>chrome.webRequest</code> if there are conflicting handlers.</p>\n</blockquote>",
      "title": "Chrome Extension Support",
      "description": "Note: Electron does not support arbitrary Chrome extensions from the\nstore, and it is a non-goal of the Electron project to be perfectly\ncompatible with Chrome's implementation of Extensions."
    },
    "/docs/faq": {
      "locale": "en-US",
      "slug": "faq",
      "href": "/docs/faq",
      "crowdinFileId": "256121",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/faq.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-faq\"><a href=\"#electron-faq\">Electron FAQ</a></h1>\n<h2 id=\"why-am-i-having-trouble-installing-electron\"><a href=\"#why-am-i-having-trouble-installing-electron\">Why am I having trouble installing Electron?</a></h2>\n<p>When running <code>npm install electron</code>, some users occasionally encounter\ninstallation errors.</p>\n<p>In almost all cases, these errors are the result of network problems and not\nactual issues with the <code>electron</code> npm package. Errors like <code>ELIFECYCLE</code>,\n<code>EAI_AGAIN</code>, <code>ECONNRESET</code>, and <code>ETIMEDOUT</code> are all indications of such\nnetwork problems. The best resolution is to try switching networks, or\nwait a bit and try installing again.</p>\n<p>You can also attempt to download Electron directly from\n<a href=\"https://github.com/electron/electron/releases\">electron/electron/releases</a>\nif installing via <code>npm</code> is failing.</p>\n<h2 id=\"when-will-electron-upgrade-to-latest-chrome\"><a href=\"#when-will-electron-upgrade-to-latest-chrome\">When will Electron upgrade to latest Chrome?</a></h2>\n<p>The Chrome version of Electron is usually bumped within one or two weeks after\na new stable Chrome version gets released. This estimate is not guaranteed and\ndepends on the amount of work involved with upgrading.</p>\n<p>Only the stable channel of Chrome is used. If an important fix is in beta or dev\nchannel, we will back-port it.</p>\n<p>For more information, please see the <a href=\"/docs/tutorial/security\">security introduction</a>.</p>\n<h2 id=\"when-will-electron-upgrade-to-latest-nodejs\"><a href=\"#when-will-electron-upgrade-to-latest-nodejs\">When will Electron upgrade to latest Node.js?</a></h2>\n<p>When a new version of Node.js gets released, we usually wait for about a month\nbefore upgrading the one in Electron. So we can avoid getting affected by bugs\nintroduced in new Node.js versions, which happens very often.</p>\n<p>New features of Node.js are usually brought by V8 upgrades, since Electron is\nusing the V8 shipped by Chrome browser, the shiny new JavaScript feature of a\nnew Node.js version is usually already in Electron.</p>\n<h2 id=\"how-to-share-data-between-web-pages\"><a href=\"#how-to-share-data-between-web-pages\">How to share data between web pages?</a></h2>\n<p>To share data between web pages (the renderer processes) the simplest way is to\nuse HTML5 APIs which are already available in browsers. Good candidates are\n<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Storage\">Storage API</a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage\"><code>localStorage</code></a>,\n<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage\"><code>sessionStorage</code></a>, and <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API\">IndexedDB</a>.</p>\n<p>Alternatively, you can use the IPC primitives that are provided by Electron. To\nshare data between the main and renderer processes, you can use the\n<a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> and <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> modules.\nTo communicate directly between web pages, you can send a\n<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> from one to the other, possibly via the main process\nusing <a href=\"/docs/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage()</code></a>.\nSubsequent communication over message ports is direct and does not detour through\nthe main process.</p>\n<h2 id=\"my-apps-tray-disappeared-after-a-few-minutes\"><a href=\"#my-apps-tray-disappeared-after-a-few-minutes\">My app's tray disappeared after a few minutes.</a></h2>\n<p>This happens when the variable which is used to store the tray gets\ngarbage collected.</p>\n<p>If you encounter this problem, the following articles may prove helpful:</p>\n<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management\">Memory Management</a></li>\n<li><a href=\"https://msdn.microsoft.com/library/bzt2dkta(v=vs.94).aspx\">Variable Scope</a></li>\n</ul>\n<p>If you want a quick fix, you can make the variables global by changing your\ncode from this:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/icon.png'</span>)\n  tray.setTitle(<span class=\"hljs-string\">'hello world'</span>)\n})\n</code></pre>\n<p>to this:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> tray = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/icon.png'</span>)\n  tray.setTitle(<span class=\"hljs-string\">'hello world'</span>)\n})\n</code></pre>\n<h2 id=\"i-can-not-use-jqueryrequirejsmeteorangularjs-in-electron\"><a href=\"#i-can-not-use-jqueryrequirejsmeteorangularjs-in-electron\">I can not use jQuery/RequireJS/Meteor/AngularJS in Electron.</a></h2>\n<p>Due to the Node.js integration of Electron, there are some extra symbols\ninserted into the DOM like <code>module</code>, <code>exports</code>, <code>require</code>. This causes problems\nfor some libraries since they want to insert the symbols with the same names.</p>\n<p>To solve this, you can turn off node integration in Electron:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In the main process.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\nwin.show()\n</code></pre>\n<p>But if you want to keep the abilities of using Node.js and Electron APIs, you\nhave to rename the symbols in the page before including other libraries:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-built_in\">window</span>.nodeRequire = <span class=\"hljs-built_in\">require</span>;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.require;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.exports;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.module;\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/javascript\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"jquery.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n</code></pre>\n<h2 id=\"requireelectronxxx-is-undefined\"><a href=\"#requireelectronxxx-is-undefined\"><code>require('electron').xxx</code> is undefined.</a></h2>\n<p>When using Electron's built-in module you might encounter an error like this:</p>\n<pre><code class=\"hljs language-sh\">> require(<span class=\"hljs-string\">'electron'</span>).webFrame.setZoomFactor(1.0)\nUncaught TypeError: Cannot <span class=\"hljs-built_in\">read</span> property <span class=\"hljs-string\">'setZoomLevel'</span> of undefined\n</code></pre>\n<p>It is very likely you are using the module in the wrong process. For example\n<code>electron.app</code> can only be used in the main process, while <code>electron.webFrame</code>\nis only available in renderer processes.</p>\n<h2 id=\"the-font-looks-blurry-what-is-this-and-what-can-i-do\"><a href=\"#the-font-looks-blurry-what-is-this-and-what-can-i-do\">The font looks blurry, what is this and what can I do?</a></h2>\n<p>If <a href=\"https://alienryderflex.com/sub_pixel/\">sub-pixel anti-aliasing</a> is deactivated, then fonts on LCD screens can look blurry. Example:</p>\n<p><img src=\"/docs/images/subpixel-rendering-screenshot.gif\" alt=\"subpixel rendering example\"></p>\n<p>Sub-pixel anti-aliasing needs a non-transparent background of the layer containing the font glyphs. (See <a href=\"https://github.com/electron/electron/issues/6344#issuecomment-420371918\">this issue</a> for more info).</p>\n<p>To achieve this goal, set the background in the constructor for <a href=\"/docs/api/browser-window\">BrowserWindow</a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#fff'</span>\n})\n</code></pre>\n<p>The effect is visible only on (some?) LCD screens. Even if you don't see a difference, some of your users may. It is best to always set the background this way, unless you have reasons not to do so.</p>\n<p>Notice that just setting the background in the CSS does not have the desired effect.</p>",
      "title": "Electron FAQ",
      "description": ""
    },
    "/docs/api/structures/file-filter": {
      "locale": "en-US",
      "slug": "file-filter",
      "href": "/docs/api/structures/file-filter",
      "crowdinFileId": "256435",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/file-filter.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"filefilter-object\"><a href=\"#filefilter-object\">FileFilter Object</a></h1>\n<ul>\n<li><code>name</code> String</li>\n<li><code>extensions</code> String[]</li>\n</ul>",
      "title": "FileFilter Object",
      "description": ""
    },
    "/docs/api/file-object": {
      "locale": "en-US",
      "slug": "file-object",
      "href": "/docs/api/file-object",
      "crowdinFileId": "256319",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/file-object.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"file-object\"><a href=\"#file-object\"><code>File</code> Object</a></h1>\n<blockquote>\n<p>Use the HTML5 <code>File</code> API to work natively with files on the filesystem.</p>\n</blockquote>\n<p>The DOM's File interface provides abstraction around native files in order to\nlet users work on native files directly with the HTML5 file API. Electron has\nadded a <code>path</code> attribute to the <code>File</code> interface which exposes the file's real\npath on filesystem.</p>\n<p>Example of getting a real path from a dragged-onto-the-app file:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">div</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"holder\"</span>></span>\n  Drag your file here\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">div</span>></span>\n\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  <span class=\"hljs-built_in\">document</span>.addEventListener(<span class=\"hljs-string\">'drop'</span>, (e) => {\n    e.preventDefault();\n    e.stopPropagation();\n\n    <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> f <span class=\"hljs-keyword\">of</span> e.dataTransfer.files) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'File(s) you dragged here: '</span>, f.path)\n    }\n  });\n  <span class=\"hljs-built_in\">document</span>.addEventListener(<span class=\"hljs-string\">'dragover'</span>, (e) => {\n    e.preventDefault();\n    e.stopPropagation();\n  });\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>",
      "title": "File Object",
      "description": "Use the HTML5 File API to work natively with files on the filesystem."
    },
    "/docs/api/structures/file-path-with-headers": {
      "locale": "en-US",
      "slug": "file-path-with-headers",
      "href": "/docs/api/structures/file-path-with-headers",
      "crowdinFileId": "256437",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/file-path-with-headers.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"filepathwithheaders-object\"><a href=\"#filepathwithheaders-object\">FilePathWithHeaders Object</a></h1>\n<ul>\n<li><code>path</code> String - The path to the file to send.</li>\n<li><code>headers</code> Record&#x3C;string, string> (optional) - Additional headers to be sent.</li>\n</ul>",
      "title": "FilePathWithHeaders Object",
      "description": ""
    },
    "/docs/api/frameless-window": {
      "locale": "en-US",
      "slug": "frameless-window",
      "href": "/docs/api/frameless-window",
      "crowdinFileId": "256321",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/frameless-window.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"frameless-window\"><a href=\"#frameless-window\">Frameless Window</a></h1>\n<blockquote>\n<p>Open a window without toolbars, borders, or other graphical \"chrome\".</p>\n</blockquote>\n<p>A frameless window is a window that has no\n<a href=\"https://developer.mozilla.org/en-US/docs/Glossary/Chrome\">chrome</a>, the parts of\nthe window, like toolbars, that are not a part of the web page. These are\noptions on the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> class.</p>\n<h2 id=\"create-a-frameless-window\"><a href=\"#create-a-frameless-window\">Create a frameless window</a></h2>\n<p>To create a frameless window, you need to set <code>frame</code> to <code>false</code> in\n<a href=\"/docs/api/browser-window\">BrowserWindow</a>'s <code>options</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h3 id=\"alternatives\"><a href=\"#alternatives\">Alternatives</a></h3>\n<p>There's an alternative way to specify a chromeless window on macOS and Windows.\nInstead of setting <code>frame</code> to <code>false</code> which disables both the titlebar and window controls,\nyou may want to have the title bar hidden and your content extend to the full window size,\nyet still preserve the window controls (\"traffic lights\" on macOS) for standard window actions.\nYou can do so by specifying the <code>titleBarStyle</code> option:</p>\n<h4 id=\"hidden\"><a href=\"#hidden\"><code>hidden</code></a></h4>\n<p>Results in a hidden title bar and a full size content window. On macOS, the title bar still has the standard window controls (“traffic lights”) in the top left.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span> })\nwin.show()\n</code></pre>\n<h3 id=\"alternatives-on-macos\"><a href=\"#alternatives-on-macos\">Alternatives on macOS</a></h3>\n<h4 id=\"hiddeninset\"><a href=\"#hiddeninset\"><code>hiddenInset</code></a></h4>\n<p>Results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span> })\nwin.show()\n</code></pre>\n<h4 id=\"custombuttonsonhover\"><a href=\"#custombuttonsonhover\"><code>customButtonsOnHover</code></a></h4>\n<p>Uses custom drawn close, and miniaturize buttons that display\nwhen hovering in the top left of the window. The fullscreen button\nis not available due to restrictions of frameless windows as they\ninterface with Apple's macOS window masks. These custom buttons prevent\nissues with mouse events that occur with the standard window toolbar buttons.\nThis option is only applicable for frameless windows.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'customButtonsOnHover'</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h2 id=\"windows-control-overlay\"><a href=\"#windows-control-overlay\">Windows Control Overlay</a></h2>\n<p>When using a frameless window in conjuction with <code>win.setWindowButtonVisibility(true)</code> on macOS, using one of the <code>titleBarStyle</code>s as described above so\nthat the traffic lights are visible, or using <code>titleBarStyle: hidden</code> on Windows, you can access the Window Controls Overlay <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis\">JavaScript APIs</a> and\n<a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables\">CSS Environment Variables</a> by setting the <code>titleBarOverlay</code> option to true. Specifying <code>true</code> will result in an overlay with default system colors.</p>\n<p>On Windows, you can also specify the color of the overlay and its symbols by setting <code>titleBarOverlay</code> to an object with the options <code>color</code> and <code>symbolColor</code>. If an option is not specified, the color will default to its system color for the window control buttons:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span>,\n  <span class=\"hljs-attr\">titleBarOverlay</span>: <span class=\"hljs-literal\">true</span>\n})\nwin.show()\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span>,\n  <span class=\"hljs-attr\">titleBarOverlay</span>: {\n    <span class=\"hljs-attr\">color</span>: <span class=\"hljs-string\">'#2f3241'</span>,\n    <span class=\"hljs-attr\">symbolColor</span>: <span class=\"hljs-string\">'#74b1be'</span>\n  }\n})\nwin.show()\n</code></pre>\n<h2 id=\"transparent-window\"><a href=\"#transparent-window\">Transparent window</a></h2>\n<p>By setting the <code>transparent</code> option to <code>true</code>, you can also make the frameless\nwindow transparent:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">transparent</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h3 id=\"limitations\"><a href=\"#limitations\">Limitations</a></h3>\n<ul>\n<li>You can not click through the transparent area. We are going to introduce an\nAPI to set window shape to solve this, see\n<a href=\"https://github.com/electron/electron/issues/1335\">our issue</a> for details.</li>\n<li>Transparent windows are not resizable. Setting <code>resizable</code> to <code>true</code> may make\na transparent window stop working on some platforms.</li>\n<li>The <code>blur</code> filter only applies to the web page, so there is no way to apply\nblur effect to the content below the window (i.e. other applications open on\nthe user's system).</li>\n<li>The window will not be transparent when DevTools is opened.</li>\n<li>On Windows operating systems,<ul>\n<li>transparent windows will not work when DWM is\ndisabled.</li>\n<li>transparent windows can not be maximized using the Windows system menu or by double clicking the title bar. The reasoning behind this can be seen on <a href=\"https://github.com/electron/electron/pull/28207\">this pull request</a>.</li>\n</ul></li>\n<li>On Linux, users have to put <code>--enable-transparent-visuals --disable-gpu</code> in\nthe command line to disable GPU and allow ARGB to make transparent window,\nthis is caused by an upstream bug that <a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=369209\">alpha channel doesn't work on some\nNVidia drivers</a> on\nLinux.</li>\n<li>On Mac, the native window shadow will not be shown on a transparent window.</li>\n</ul>\n<h2 id=\"click-through-window\"><a href=\"#click-through-window\">Click-through window</a></h2>\n<p>To create a click-through window, i.e. making the window ignore all mouse\nevents, you can call the <a href=\"/docs/api/browser-window#winsetignoremouseeventsignore-options\">win.setIgnoreMouseEvents(ignore)</a>\nAPI:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.setIgnoreMouseEvents(<span class=\"hljs-literal\">true</span>)\n</code></pre>\n<h3 id=\"forwarding\"><a href=\"#forwarding\">Forwarding</a></h3>\n<p>Ignoring mouse messages makes the web page oblivious to mouse movement, meaning\nthat mouse movement events will not be emitted. On Windows operating systems an\noptional parameter can be used to forward mouse move messages to the web page,\nallowing events such as <code>mouseleave</code> to be emitted:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> el = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'clickThroughElement'</span>)\nel.addEventListener(<span class=\"hljs-string\">'mouseenter'</span>, () => {\n  ipcRenderer.send(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, <span class=\"hljs-literal\">true</span>, { <span class=\"hljs-attr\">forward</span>: <span class=\"hljs-literal\">true</span> })\n})\nel.addEventListener(<span class=\"hljs-string\">'mouseleave'</span>, () => {\n  ipcRenderer.send(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, <span class=\"hljs-literal\">false</span>)\n})\n\n<span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, (event, ...args) => {\n  BrowserWindow.fromWebContents(event.sender).setIgnoreMouseEvents(...args)\n})\n</code></pre>\n<p>This makes the web page click-through when over <code>el</code>, and returns to normal\noutside it.</p>\n<h2 id=\"draggable-region\"><a href=\"#draggable-region\">Draggable region</a></h2>\n<p>By default, the frameless window is non-draggable. Apps need to specify\n<code>-webkit-app-region: drag</code> in CSS to tell Electron which regions are draggable\n(like the OS's standard titlebar), and apps can also use\n<code>-webkit-app-region: no-drag</code> to exclude the non-draggable area from the\ndraggable region. Note that only rectangular shapes are currently supported.</p>\n<p>Note: <code>-webkit-app-region: drag</code> is known to have problems while the developer tools are open. See this <a href=\"https://github.com/electron/electron/issues/3647\">GitHub issue</a> for more information including a workaround.</p>\n<p>To make the whole window draggable, you can add <code>-webkit-app-region: drag</code> as\n<code>body</code>'s style:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"-webkit-app-region: drag\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n</code></pre>\n<p>And note that if you have made the whole window draggable, you must also mark\nbuttons as non-draggable, otherwise it would be impossible for users to click on\nthem:</p>\n<pre><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">button</span> {\n  <span class=\"hljs-attribute\">-webkit-app-region</span>: no-drag;\n}\n</code></pre>\n<p>If you're only setting a custom titlebar as draggable, you also need to make all\nbuttons in titlebar non-draggable.</p>\n<h2 id=\"text-selection\"><a href=\"#text-selection\">Text selection</a></h2>\n<p>In a frameless window the dragging behavior may conflict with selecting text.\nFor example, when you drag the titlebar you may accidentally select the text on\nthe titlebar. To prevent this, you need to disable text selection within a\ndraggable area like this:</p>\n<pre><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.titlebar</span> {\n  <span class=\"hljs-attribute\">-webkit-user-select</span>: none;\n  <span class=\"hljs-attribute\">-webkit-app-region</span>: drag;\n}\n</code></pre>\n<h2 id=\"context-menu\"><a href=\"#context-menu\">Context menu</a></h2>\n<p>On some platforms, the draggable area will be treated as a non-client frame, so\nwhen you right click on it a system menu will pop up. To make the context menu\nbehave correctly on all platforms you should never use a custom context menu on\ndraggable areas.</p>",
      "title": "Frameless Window",
      "description": "Open a window without toolbars, borders, or other graphical \"chrome\"."
    },
    "/docs/tutorial/fuses": {
      "locale": "en-US",
      "slug": "fuses",
      "href": "/docs/tutorial/fuses",
      "crowdinFileId": "256201",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/fuses.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-fuses\"><a href=\"#electron-fuses\">Electron Fuses</a></h1>\n<blockquote>\n<p>Package time feature toggles</p>\n</blockquote>\n<h2 id=\"what-are-fuses\"><a href=\"#what-are-fuses\">What are fuses?</a></h2>\n<p>For a subset of Electron functionality it makes sense to disable certain features for an entire application.  For example, 99% of apps don't make use of <code>ELECTRON_RUN_AS_NODE</code>, these applications want to be able to ship a binary that is incapable of using that feature.  We also don't want Electron consumers building Electron from source as that is both a massive technical challenge and has a high cost of both time and money.</p>\n<p>Fuses are the solution to this problem, at a high level they are \"magic bits\" in the Electron binary that can be flipped when packaging your Electron app to enable / disable certain features / restrictions.  Because they are flipped at package time before you code sign your app the OS becomes responsible for ensuring those bits aren't flipped back via OS level code signing validation (Gatekeeper / App Locker).</p>\n<h2 id=\"how-do-i-flip-the-fuses\"><a href=\"#how-do-i-flip-the-fuses\">How do I flip the fuses?</a></h2>\n<h3 id=\"the-easy-way\"><a href=\"#the-easy-way\">The easy way</a></h3>\n<p>We've made a handy module <code>@electron/fuses</code> to make flipping these fuses easy.  Check out the README of that module for more details on usage and potential error cases.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/fuses'</span>).flipFuses(\n  <span class=\"hljs-comment\">// Path to electron</span>\n  <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>),\n  <span class=\"hljs-comment\">// Fuses to flip</span>\n  {\n    <span class=\"hljs-attr\">runAsNode</span>: <span class=\"hljs-literal\">false</span>\n  }\n)\n</code></pre>\n<h3 id=\"the-hard-way\"><a href=\"#the-hard-way\">The hard way</a></h3>\n<h4 id=\"quick-glossary\"><a href=\"#quick-glossary\">Quick Glossary</a></h4>\n<ul>\n<li><strong>Fuse Wire</strong>: A sequence of bytes in the Electron binary used to control the fuses</li>\n<li><strong>Sentinel</strong>: A static known sequence of bytes you can use to locate the fuse wire</li>\n<li><strong>Fuse Schema</strong>: The format / allowed values for the fuse wire</li>\n</ul>\n<p>Manually flipping fuses requires editing the Electron binary and modifying the fuse wire to be the sequence of bytes that represent the state of the fuses you want.</p>\n<p>Somewhere in the Electron binary there will be a sequence of bytes that look like this:</p>\n<pre><code class=\"hljs language-plaintext\">| ...binary | sentinel_bytes | fuse_version | fuse_wire_length | fuse_wire | ...binary |\n</code></pre>\n<ul>\n<li><code>sentinel_bytes</code> is always this exact string <code>dL7pKGdnNz796PbbjQWNKmHXBZaB9tsX</code></li>\n<li><code>fuse_version</code> is a single byte whose unsigned integer value represents the version of the fuse schema</li>\n<li><code>fuse_wire_length</code> is a single byte whose unsigned integer value represents the number of fuses in the following fuse wire</li>\n<li><code>fuse_wire</code> is a sequence of N bytes, each byte represents a single fuse and its state.<ul>\n<li>\"0\" (0x30) indicates the fuse is disabled</li>\n<li>\"1\" (0x31) indicates the fuse is enabled</li>\n<li>\"r\" (0x72) indicates the fuse has been removed and changing the byte to either 1 or 0 will have no effect.</li>\n</ul></li>\n</ul>\n<p>To flip a fuse you find its position in the fuse wire and change it to \"0\" or \"1\" depending on the state you'd like.</p>\n<p>You can view the current schema <a href=\"https://github.com/electron/electron/blob/main/build/fuses/fuses.json5\">here</a>.</p>",
      "title": "Electron Fuses",
      "description": "Package time feature toggles"
    },
    "/docs/api/global-shortcut": {
      "locale": "en-US",
      "slug": "global-shortcut",
      "href": "/docs/api/global-shortcut",
      "crowdinFileId": "256323",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/global-shortcut.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"globalshortcut\"><a href=\"#globalshortcut\">globalShortcut</a></h1>\n<blockquote>\n<p>Detect keyboard events when the application does not have keyboard focus.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>The <code>globalShortcut</code> module can register/unregister a global keyboard shortcut\nwith the operating system so that you can customize the operations for various\nshortcuts.</p>\n<p><strong>Note:</strong> The shortcut is global; it will work even if the app does\nnot have the keyboard focus. This module cannot be used before the <code>ready</code>\nevent of the app module is emitted.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Register a 'CommandOrControl+X' shortcut listener.</span>\n  <span class=\"hljs-keyword\">const</span> ret = globalShortcut.register(<span class=\"hljs-string\">'CommandOrControl+X'</span>, () => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'CommandOrControl+X is pressed'</span>)\n  })\n\n  <span class=\"hljs-keyword\">if</span> (!ret) {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'registration failed'</span>)\n  }\n\n  <span class=\"hljs-comment\">// Check whether a shortcut is registered.</span>\n  <span class=\"hljs-built_in\">console</span>.log(globalShortcut.isRegistered(<span class=\"hljs-string\">'CommandOrControl+X'</span>))\n})\n\napp.on(<span class=\"hljs-string\">'will-quit'</span>, () => {\n  <span class=\"hljs-comment\">// Unregister a shortcut.</span>\n  globalShortcut.unregister(<span class=\"hljs-string\">'CommandOrControl+X'</span>)\n\n  <span class=\"hljs-comment\">// Unregister all shortcuts.</span>\n  globalShortcut.unregisterAll()\n})\n</code></pre>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>globalShortcut</code> module has the following methods:</p>\n<h3 id=\"globalshortcutregisteraccelerator-callback\"><a href=\"#globalshortcutregisteraccelerator-callback\"><code>globalShortcut.register(accelerator, callback)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n<li><code>callback</code> Function</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether or not the shortcut was registered successfully.</p>\n<p>Registers a global shortcut of <code>accelerator</code>. The <code>callback</code> is called when\nthe registered shortcut is pressed by the user.</p>\n<p>When the accelerator is already taken by other applications, this call will\nsilently fail. This behavior is intended by operating systems, since they don't\nwant applications to fight for global shortcuts.</p>\n<p>The following accelerators will not be registered successfully on macOS 10.14 Mojave unless\nthe app has been authorized as a <a href=\"https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html\">trusted accessibility client</a>:</p>\n<ul>\n<li>\"Media Play/Pause\"</li>\n<li>\"Media Next Track\"</li>\n<li>\"Media Previous Track\"</li>\n<li>\"Media Stop\"</li>\n</ul>\n<h3 id=\"globalshortcutregisterallaccelerators-callback\"><a href=\"#globalshortcutregisterallaccelerators-callback\"><code>globalShortcut.registerAll(accelerators, callback)</code></a></h3>\n<ul>\n<li><code>accelerators</code> String[] - an array of <a href=\"/docs/api/accelerator\">Accelerator</a>s.</li>\n<li><code>callback</code> Function</li>\n</ul>\n<p>Registers a global shortcut of all <code>accelerator</code> items in <code>accelerators</code>. The <code>callback</code> is called when any of the registered shortcuts are pressed by the user.</p>\n<p>When a given accelerator is already taken by other applications, this call will\nsilently fail. This behavior is intended by operating systems, since they don't\nwant applications to fight for global shortcuts.</p>\n<p>The following accelerators will not be registered successfully on macOS 10.14 Mojave unless\nthe app has been authorized as a <a href=\"https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html\">trusted accessibility client</a>:</p>\n<ul>\n<li>\"Media Play/Pause\"</li>\n<li>\"Media Next Track\"</li>\n<li>\"Media Previous Track\"</li>\n<li>\"Media Stop\"</li>\n</ul>\n<h3 id=\"globalshortcutisregisteredaccelerator\"><a href=\"#globalshortcutisregisteredaccelerator\"><code>globalShortcut.isRegistered(accelerator)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether this application has registered <code>accelerator</code>.</p>\n<p>When the accelerator is already taken by other applications, this call will\nstill return <code>false</code>. This behavior is intended by operating systems, since they\ndon't want applications to fight for global shortcuts.</p>\n<h3 id=\"globalshortcutunregisteraccelerator\"><a href=\"#globalshortcutunregisteraccelerator\"><code>globalShortcut.unregister(accelerator)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n</ul>\n<p>Unregisters the global shortcut of <code>accelerator</code>.</p>\n<h3 id=\"globalshortcutunregisterall\"><a href=\"#globalshortcutunregisterall\"><code>globalShortcut.unregisterAll()</code></a></h3>\n<p>Unregisters all of the global shortcuts.</p>",
      "title": "globalShortcut",
      "description": "Detect keyboard events when the application does not have keyboard focus."
    },
    "/docs/glossary": {
      "locale": "en-US",
      "slug": "glossary",
      "href": "/docs/glossary",
      "crowdinFileId": "256123",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/glossary.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"glossary\"><a href=\"#glossary\">Glossary</a></h1>\n<p>This page defines some terminology that is commonly used in Electron development.</p>\n<h3 id=\"asar\"><a href=\"#asar\">ASAR</a></h3>\n<p>ASAR stands for Atom Shell Archive Format. An <a href=\"https://github.com/electron/asar\">asar</a> archive is a simple\n<code>tar</code>-like format that concatenates files into a single file. Electron can read\narbitrary files from it without unpacking the whole file.</p>\n<p>The ASAR format was created primarily to improve performance on Windows when\nreading large quantities of small files (e.g. when loading your app's JavaScript\ndependency tree from <code>node_modules</code>).</p>\n<h3 id=\"code-signing\"><a href=\"#code-signing\">code signing</a></h3>\n<p>Code signing is a process where an app developer digitally signs their code to\nensure that it hasn't been tampered with after packaging. Both Windows and\nmacOS implement their own version of code signing. As a desktop app developer,\nit's important that you sign your code if you plan on distributing it to the\ngeneral public.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/code-signing\">Code Signing</a> tutorial.</p>\n<h3 id=\"context-isolation\"><a href=\"#context-isolation\">context isolation</a></h3>\n<p>Context isolation is a security measure in Electron that ensures that your\npreload script cannot leak privileged Electron or Node.js APIs to the web\ncontents in your renderer process. With context isolation enabled, the\nonly way to expose APIs from your preload script is through the\n<code>contextBridge</code> API.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/context-isolation\">Context Isolation</a> tutorial.</p>\n<p>See also: <a href=\"#preload-script\">preload script</a>, <a href=\"#renderer-process\">renderer process</a></p>\n<h3 id=\"crt\"><a href=\"#crt\">CRT</a></h3>\n<p>The C Runtime Library (CRT) is the part of the C++ Standard Library that\nincorporates the ISO C99 standard library. The Visual C++ libraries that\nimplement the CRT support native code development, and both mixed native and\nmanaged code, and pure managed code for .NET development.</p>\n<h3 id=\"dmg\"><a href=\"#dmg\">DMG</a></h3>\n<p>An Apple Disk Image is a packaging format used by macOS. DMG files are\ncommonly used for distributing application \"installers\".</p>\n<h3 id=\"ime\"><a href=\"#ime\">IME</a></h3>\n<p>Input Method Editor. A program that allows users to enter characters and\nsymbols not found on their keyboard. For example, this allows users of Latin\nkeyboards to input Chinese, Japanese, Korean and Indic characters.</p>\n<h3 id=\"idl\"><a href=\"#idl\">IDL</a></h3>\n<p>Interface description language. Write function signatures and data types in a\nformat that can be used to generate interfaces in Java, C++, JavaScript, etc.</p>\n<h3 id=\"ipc\"><a href=\"#ipc\">IPC</a></h3>\n<p>IPC stands for inter-process communication. Electron uses IPC to send\nserialized JSON messages between the main and renderer processes.</p>\n<p>see also: <a href=\"#main-process\">main process</a>, <a href=\"#renderer-process\">renderer process</a></p>\n<h3 id=\"main-process\"><a href=\"#main-process\">main process</a></h3>\n<p>The main process, commonly a file named <code>main.js</code>, is the entry point to every\nElectron app. It controls the life of the app, from open to close. It also\nmanages native elements such as the Menu, Menu Bar, Dock, Tray, etc. The\nmain process is responsible for creating each new renderer process in the app.\nThe full Node API is built in.</p>\n<p>Every app's main process file is specified in the <code>main</code> property in\n<code>package.json</code>. This is how <code>electron .</code> knows what file to execute at startup.</p>\n<p>In Chromium, this process is referred to as the \"browser process\". It is\nrenamed in Electron to avoid confusion with renderer processes.</p>\n<p>See also: <a href=\"#process\">process</a>, <a href=\"#renderer-process\">renderer process</a></p>\n<h3 id=\"mas\"><a href=\"#mas\">MAS</a></h3>\n<p>Acronym for Apple's Mac App Store. For details on submitting your app to the\nMAS, see the <a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store Submission Guide</a>.</p>\n<h3 id=\"mojo\"><a href=\"#mojo\">Mojo</a></h3>\n<p>An IPC system for communicating intra- or inter-process, and that's important\nbecause Chrome is keen on being able to split its work into separate processes\nor not, depending on memory pressures etc.</p>\n<p>See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md\">https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md</a></p>\n<p>See also: <a href=\"#ipc\">IPC</a></p>\n<h3 id=\"msi\"><a href=\"#msi\">MSI</a></h3>\n<p>On Windows, MSI packages are used by the Windows Installer\n(also known as Microsoft Installer) service to install and configure\napplications.</p>\n<p>More information can be found in <a href=\"https://docs.microsoft.com/en-us/windows/win32/msi/windows-installer-portal\">Microsoft's documentation</a>.</p>\n<h3 id=\"native-modules\"><a href=\"#native-modules\">native modules</a></h3>\n<p>Native modules (also called <a href=\"https://nodejs.org/api/addons.html\">addons</a> in\nNode.js) are modules written in C or C++ that can be loaded into Node.js or\nElectron using the require() function, and used as if they were an\nordinary Node.js module. They are used primarily to provide an interface\nbetween JavaScript running in Node.js and C/C++ libraries.</p>\n<p>Native Node modules are supported by Electron, but since Electron is very\nlikely to use a different V8 version from the Node binary installed in your\nsystem, you have to manually specify the location of Electron’s headers when\nbuilding native modules.</p>\n<p>For more information, read the [Native Node Modules] tutorial.</p>\n<h3 id=\"notarization\"><a href=\"#notarization\">notarization</a></h3>\n<p>Notarization is a macOS-specific process where a developer can send a\ncode-signed app to Apple servers to get verified for malicious\ncomponents through an automated service.</p>\n<p>See also: <a href=\"#code-signing\">code signing</a></p>\n<h3 id=\"osr\"><a href=\"#osr\">OSR</a></h3>\n<p>OSR (offscreen rendering) can be used for loading heavy page in\nbackground and then displaying it after (it will be much faster).\nIt allows you to render page without showing it on screen.</p>\n<p>For more information, read the [Offscreen Rendering][osr] tutorial.</p>\n<h3 id=\"preload-script\"><a href=\"#preload-script\">preload script</a></h3>\n<p>Preload scripts contain code that executes in a renderer process\nbefore its web contents begin loading. These scripts run within\nthe renderer context, but are granted more privileges by having\naccess to Node.js APIs.</p>\n<p>See also: <a href=\"#renderer-process\">renderer process</a>, <a href=\"#context-isolation\">context isolation</a></p>\n<h3 id=\"process\"><a href=\"#process\">process</a></h3>\n<p>A process is an instance of a computer program that is being executed. Electron\napps that make use of the <a href=\"#main-process\">main</a> and one or many <a href=\"#renderer-process\">renderer</a> process are\nactually running several programs simultaneously.</p>\n<p>In Node.js and Electron, each running process has a <code>process</code> object. This\nobject is a global that provides information about, and control over, the\ncurrent process. As a global, it is always available to applications without\nusing require().</p>\n<p>See also: <a href=\"#main-process\">main process</a>, <a href=\"#renderer-process\">renderer process</a></p>\n<h3 id=\"renderer-process\"><a href=\"#renderer-process\">renderer process</a></h3>\n<p>The renderer process is a browser window in your app. Unlike the main process,\nthere can be multiple of these and each is run in a separate process.\nThey can also be hidden.</p>\n<p>See also: <a href=\"#process\">process</a>, <a href=\"#main-process\">main process</a></p>\n<h3 id=\"sandbox\"><a href=\"#sandbox\">sandbox</a></h3>\n<p>The sandbox is a security feature inherited from Chromium that restricts\nyour renderer processes to a limited set of permissions.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/sandbox\">Process Sandboxing</a> tutorial.</p>\n<p>See also: <a href=\"#process\">process</a></p>\n<h3 id=\"squirrel\"><a href=\"#squirrel\">Squirrel</a></h3>\n<p>Squirrel is an open-source framework that enables Electron apps to update\nautomatically as new versions are released. See the <a href=\"/docs/api/auto-updater\">autoUpdater</a> API for\ninfo about getting started with Squirrel.</p>\n<h3 id=\"userland\"><a href=\"#userland\">userland</a></h3>\n<p>This term originated in the Unix community, where \"userland\" or \"userspace\"\nreferred to programs that run outside of the operating system kernel. More\nrecently, the term has been popularized in the Node and npm community to\ndistinguish between the features available in \"Node core\" versus packages\npublished to the npm registry by the much larger \"user\" community.</p>\n<p>Like Node, Electron is focused on having a small set of APIs that provide\nall the necessary primitives for developing multi-platform desktop applications.\nThis design philosophy allows Electron to remain a flexible tool without being\noverly prescriptive about how it should be used. Userland enables users to\ncreate and share tools that provide additional functionality on top of what is\navailable in \"core\".</p>\n<h3 id=\"v8\"><a href=\"#v8\">V8</a></h3>\n<p>V8 is Google's open source JavaScript engine. It is written in C++ and is\nused in Google Chrome. V8 can run standalone, or can be embedded into any C++ application.</p>\n<p>Electron builds V8 as part of Chromium and then points Node to that V8 when\nbuilding it.</p>\n<p>V8's version numbers always correspond to those of Google Chrome. Chrome 59\nincludes V8 5.9, Chrome 58 includes V8 5.8, etc.</p>\n<ul>\n<li><a href=\"https://v8.dev/\">v8.dev</a></li>\n<li><a href=\"https://nodejs.org/api/v8.html\">nodejs.org/api/v8.html</a></li>\n<li><a href=\"/docs/development/v8-development\">docs/development/v8-development.md</a></li>\n</ul>\n<h3 id=\"webview\"><a href=\"#webview\">webview</a></h3>\n<p><code>webview</code> tags are used to embed 'guest' content (such as external web pages) in\nyour Electron app. They are similar to <code>iframe</code>s, but differ in that each\nwebview runs in a separate process. It doesn't have the same\npermissions as your web page and all interactions between your app and\nembedded content will be asynchronous. This keeps your app safe from the\nembedded content.</p>",
      "title": "Glossary",
      "description": ""
    },
    "/docs/development/goma": {
      "locale": "en-US",
      "slug": "goma",
      "href": "/docs/development/goma",
      "crowdinFileId": "256157",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/goma.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"goma\"><a href=\"#goma\">Goma</a></h1>\n<blockquote>\n<p>Goma is a distributed compiler service for open-source projects such as\nChromium and Android.</p>\n</blockquote>\n<p>Electron has a deployment of a custom Goma Backend that we make available to\nall Electron Maintainers.  See the <a href=\"#access\">Access</a> section below for details\non authentication.  There is also a <code>cache-only</code> Goma endpoint that will be\nused by default if you do not have credentials.  Requests to the cache-only\nGoma will not hit our cluster, but will read from our cache and should result\nin significantly faster build times.</p>\n<h2 id=\"enabling-goma\"><a href=\"#enabling-goma\">Enabling Goma</a></h2>\n<p>Currently the only supported way to use Goma is to use our <a href=\"https://github.com/electron/build-tools\">Build Tools</a>.\nGoma configuration is automatically included when you set up <code>build-tools</code>.</p>\n<p>If you are a maintainer and have access to our cluster, please ensure that you run\n<code>e init</code> with <code>--goma=cluster</code> in order to configure <code>build-tools</code> to use\nthe Goma cluster.  If you have an existing config, you can just set <code>\"goma\": \"cluster\"</code>\nin your config file.</p>\n<h2 id=\"building-with-goma\"><a href=\"#building-with-goma\">Building with Goma</a></h2>\n<p>When you are using Goma you can run <code>ninja</code> with a substantially higher <code>j</code>\nvalue than would normally be supported by your machine.</p>\n<p>Please do not set a value higher than <strong>200</strong> on Windows or Linux and\n<strong>50</strong> on macOS. We monitor Goma system usage, and users found to be abusing\nit with unreasonable concurrency will be de-activated.</p>\n<pre><code class=\"hljs language-bash\">ninja -C out/Testing electron -j 200\n</code></pre>\n<p>If you're using <code>build-tools</code>, appropriate <code>-j</code> values will automatically\nbe used for you.</p>\n<h2 id=\"monitoring-goma\"><a href=\"#monitoring-goma\">Monitoring Goma</a></h2>\n<p>If you access <a href=\"http://localhost:8088\">http://localhost:8088</a> on your local\nmachine you can monitor compile jobs as they flow through the goma system.</p>\n<h2 id=\"access\"><a href=\"#access\">Access</a></h2>\n<p>For security and cost reasons, access to Electron's Goma cluster is currently restricted\nto Electron Maintainers.  If you want access please head to <code>#access-requests</code> in\nSlack and ping <code>@goma-squad</code> to ask for access.  Please be aware that being a\nmaintainer does not <em>automatically</em> grant access and access is determined on a\ncase by case basis.</p>\n<h2 id=\"uptime--support\"><a href=\"#uptime--support\">Uptime / Support</a></h2>\n<p>We have automated monitoring of our Goma cluster and cache at <a href=\"https://status.notgoma.com\">https://status.notgoma.com</a></p>\n<p>We do not provide support for usage of Goma and any issues raised asking for help / having\nissues will <em>probably</em> be closed without much reason, we do not have the capacity to handle\nthat kind of support.</p>",
      "title": "Goma",
      "description": "Goma is a distributed compiler service for open-source projects such as\nChromium and Android."
    },
    "/docs/api/structures/gpu-feature-status": {
      "locale": "en-US",
      "slug": "gpu-feature-status",
      "href": "/docs/api/structures/gpu-feature-status",
      "crowdinFileId": "256439",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/gpu-feature-status.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"gpufeaturestatus-object\"><a href=\"#gpufeaturestatus-object\">GPUFeatureStatus Object</a></h1>\n<ul>\n<li><code>2d_canvas</code> String - Canvas.</li>\n<li><code>flash_3d</code> String - Flash.</li>\n<li><code>flash_stage3d</code> String - Flash Stage3D.</li>\n<li><code>flash_stage3d_baseline</code> String - Flash Stage3D Baseline profile.</li>\n<li><code>gpu_compositing</code> String - Compositing.</li>\n<li><code>multiple_raster_threads</code> String - Multiple Raster Threads.</li>\n<li><code>native_gpu_memory_buffers</code> String - Native GpuMemoryBuffers.</li>\n<li><code>rasterization</code> String - Rasterization.</li>\n<li><code>video_decode</code> String - Video Decode.</li>\n<li><code>video_encode</code> String - Video Encode.</li>\n<li><code>vpx_decode</code> String - VPx Video Decode.</li>\n<li><code>webgl</code> String - WebGL.</li>\n<li><code>webgl2</code> String - WebGL2.</li>\n</ul>\n<p>Possible values:</p>\n<ul>\n<li><code>disabled_software</code> - Software only. Hardware acceleration disabled (yellow)</li>\n<li><code>disabled_off</code> - Disabled (red)</li>\n<li><code>disabled_off_ok</code> - Disabled (yellow)</li>\n<li><code>unavailable_software</code> - Software only, hardware acceleration unavailable (yellow)</li>\n<li><code>unavailable_off</code> - Unavailable (red)</li>\n<li><code>unavailable_off_ok</code> - Unavailable (yellow)</li>\n<li><code>enabled_readback</code> - Hardware accelerated but at reduced performance (yellow)</li>\n<li><code>enabled_force</code> - Hardware accelerated on all pages (green)</li>\n<li><code>enabled</code> - Hardware accelerated (green)</li>\n<li><code>enabled_on</code> - Enabled (green)</li>\n<li><code>enabled_force_on</code> - Force enabled (green)</li>\n</ul>",
      "title": "GPUFeatureStatus Object",
      "description": ""
    },
    "/docs/api/structures/hid-device": {
      "locale": "en-US",
      "slug": "hid-device",
      "href": "/docs/api/structures/hid-device",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/hid-device.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"hiddevice-object\"><a href=\"#hiddevice-object\">HIDDevice Object</a></h1>\n<ul>\n<li><code>deviceId</code> String - Unique identifier for the device.</li>\n<li><code>name</code> String - Name of the device.</li>\n<li><code>vendorId</code> Integer - The USB vendor ID.</li>\n<li><code>productId</code> Integer - The USB product ID.</li>\n<li><code>serialNumber</code> String (optional) - The USB device serial number.</li>\n<li><code>guid</code> String (optional) - Unique identifier for the HID interface.  A device may have multiple HID interfaces.</li>\n</ul>",
      "title": "HIDDevice Object",
      "description": ""
    },
    "/docs/api/in-app-purchase": {
      "locale": "en-US",
      "slug": "in-app-purchase",
      "href": "/docs/api/in-app-purchase",
      "crowdinFileId": "256325",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/in-app-purchase.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"inapppurchase\"><a href=\"#inapppurchase\">inAppPurchase</a></h1>\n<blockquote>\n<p>In-app purchases on Mac App Store.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h2 id=\"events\"><a href=\"#events\">Events</a></h2>\n<p>The <code>inAppPurchase</code> module emits the following events:</p>\n<h3 id=\"event-transactions-updated\"><a href=\"#event-transactions-updated\">Event: 'transactions-updated'</a></h3>\n<p>Emitted when one or more transactions have been updated.</p>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>transactions</code> Transaction[] - Array of <a href=\"/docs/api/structures/transaction\"><code>Transaction</code></a> objects.</li>\n</ul>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>inAppPurchase</code> module has the following methods:</p>\n<h3 id=\"inapppurchasepurchaseproductproductid-quantity\"><a href=\"#inapppurchasepurchaseproductproductid-quantity\"><code>inAppPurchase.purchaseProduct(productID[, quantity])</code></a></h3>\n<ul>\n<li><code>productID</code> String - The identifiers of the product to purchase. (The identifier of <code>com.example.app.product1</code> is <code>product1</code>).</li>\n<li><code>quantity</code> Integer (optional) - The number of items the user wants to purchase.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Boolean></code> - Returns <code>true</code> if the product is valid and added to the payment queue.</p>\n<p>You should listen for the <code>transactions-updated</code> event as soon as possible and certainly before you call <code>purchaseProduct</code>.</p>\n<h3 id=\"inapppurchasegetproductsproductids\"><a href=\"#inapppurchasegetproductsproductids\"><code>inAppPurchase.getProducts(productIDs)</code></a></h3>\n<ul>\n<li><code>productIDs</code> String[] - The identifiers of the products to get.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Product[]></code> - Resolves with an array of <a href=\"/docs/api/structures/product\"><code>Product</code></a> objects.</p>\n<p>Retrieves the product descriptions.</p>\n<h3 id=\"inapppurchasecanmakepayments\"><a href=\"#inapppurchasecanmakepayments\"><code>inAppPurchase.canMakePayments()</code></a></h3>\n<p>Returns <code>Boolean</code> - whether a user can make a payment.</p>\n<h3 id=\"inapppurchaserestorecompletedtransactions\"><a href=\"#inapppurchaserestorecompletedtransactions\"><code>inAppPurchase.restoreCompletedTransactions()</code></a></h3>\n<p>Restores finished transactions. This method can be called either to install purchases on additional devices, or to restore purchases for an application that the user deleted and reinstalled.</p>\n<p><a href=\"https://developer.apple.com/documentation/storekit/skpaymentqueue?language=objc\">The payment queue</a> delivers a new transaction for each previously completed transaction that can be restored. Each transaction includes a copy of the original transaction.</p>\n<h3 id=\"inapppurchasegetreceipturl\"><a href=\"#inapppurchasegetreceipturl\"><code>inAppPurchase.getReceiptURL()</code></a></h3>\n<p>Returns <code>String</code> - the path to the receipt.</p>\n<h3 id=\"inapppurchasefinishalltransactions\"><a href=\"#inapppurchasefinishalltransactions\"><code>inAppPurchase.finishAllTransactions()</code></a></h3>\n<p>Completes all pending transactions.</p>\n<h3 id=\"inapppurchasefinishtransactionbydatedate\"><a href=\"#inapppurchasefinishtransactionbydatedate\"><code>inAppPurchase.finishTransactionByDate(date)</code></a></h3>\n<ul>\n<li><code>date</code> String - The ISO formatted date of the transaction to finish.</li>\n</ul>\n<p>Completes the pending transactions corresponding to the date.</p>",
      "title": "inAppPurchase",
      "description": "In-app purchases on Mac App Store."
    },
    "/docs/tutorial/in-app-purchases": {
      "locale": "en-US",
      "slug": "in-app-purchases",
      "href": "/docs/tutorial/in-app-purchases",
      "crowdinFileId": "256203",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/in-app-purchases.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"in-app-purchases-macos\"><a href=\"#in-app-purchases-macos\">In-App Purchases (macOS)</a></h1>\n<h2 id=\"preparing\"><a href=\"#preparing\">Preparing</a></h2>\n<h3 id=\"paid-applications-agreement\"><a href=\"#paid-applications-agreement\">Paid Applications Agreement</a></h3>\n<p>If you haven't already, you’ll need to sign the Paid Applications Agreement and set up your banking and tax information in iTunes Connect.</p>\n<p><a href=\"https://help.apple.com/itunes-connect/developer/#/devb6df5ee51\">iTunes Connect Developer Help: Agreements, tax, and banking overview</a></p>\n<h3 id=\"create-your-in-app-purchases\"><a href=\"#create-your-in-app-purchases\">Create Your In-App Purchases</a></h3>\n<p>Then, you'll need to configure your in-app purchases in iTunes Connect, and include details such as name, pricing, and description that highlights the features and functionality of your in-app purchase.</p>\n<p><a href=\"https://help.apple.com/itunes-connect/developer/#/devae49fb316\">iTunes Connect Developer Help: Create an in-app purchase</a></p>\n<h3 id=\"change-the-cfbundleidentifier\"><a href=\"#change-the-cfbundleidentifier\">Change the CFBundleIdentifier</a></h3>\n<p>To test In-App Purchase in development with Electron you'll have to change the <code>CFBundleIdentifier</code> in <code>node_modules/electron/dist/Electron.app/Contents/Info.plist</code>. You have to replace <code>com.github.electron</code> by the bundle identifier of the application you created with iTunes Connect.</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>CFBundleIdentifier<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>com.example.app<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n</code></pre>\n<h2 id=\"code-example\"><a href=\"#code-example\">Code example</a></h2>\n<p>Here is an example that shows how to use In-App Purchases in Electron. You'll have to replace the product ids by the identifiers of the products created with iTunes Connect (the identifier of <code>com.example.app.product1</code> is <code>product1</code>). Note that you have to listen to the <code>transactions-updated</code> event as soon as possible in your app.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { inAppPurchase } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> PRODUCT_IDS = [<span class=\"hljs-string\">'id1'</span>, <span class=\"hljs-string\">'id2'</span>]\n\n<span class=\"hljs-comment\">// Listen for transactions as soon as possible.</span>\ninAppPurchase.on(<span class=\"hljs-string\">'transactions-updated'</span>, (event, transactions) => {\n  <span class=\"hljs-keyword\">if</span> (!<span class=\"hljs-built_in\">Array</span>.isArray(transactions)) {\n    <span class=\"hljs-keyword\">return</span>\n  }\n\n  <span class=\"hljs-comment\">// Check each transaction.</span>\n  transactions.forEach(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\">transaction</span>) </span>{\n    <span class=\"hljs-keyword\">const</span> payment = transaction.payment\n\n    <span class=\"hljs-keyword\">switch</span> (transaction.transactionState) {\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'purchasing'</span>:\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Purchasing <span class=\"hljs-subst\">${payment.productIdentifier}</span>...`</span>)\n        <span class=\"hljs-keyword\">break</span>\n\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'purchased'</span>: {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${payment.productIdentifier}</span> purchased.`</span>)\n\n        <span class=\"hljs-comment\">// Get the receipt url.</span>\n        <span class=\"hljs-keyword\">const</span> receiptURL = inAppPurchase.getReceiptURL()\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Receipt URL: <span class=\"hljs-subst\">${receiptURL}</span>`</span>)\n\n        <span class=\"hljs-comment\">// Submit the receipt file to the server and check if it is valid.</span>\n        <span class=\"hljs-comment\">// @see https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html</span>\n        <span class=\"hljs-comment\">// ...</span>\n        <span class=\"hljs-comment\">// If the receipt is valid, the product is purchased</span>\n        <span class=\"hljs-comment\">// ...</span>\n\n        <span class=\"hljs-comment\">// Finish the transaction.</span>\n        inAppPurchase.finishTransactionByDate(transaction.transactionDate)\n\n        <span class=\"hljs-keyword\">break</span>\n      }\n\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'failed'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Failed to purchase <span class=\"hljs-subst\">${payment.productIdentifier}</span>.`</span>)\n\n        <span class=\"hljs-comment\">// Finish the transaction.</span>\n        inAppPurchase.finishTransactionByDate(transaction.transactionDate)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'restored'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The purchase of <span class=\"hljs-subst\">${payment.productIdentifier}</span> has been restored.`</span>)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'deferred'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The purchase of <span class=\"hljs-subst\">${payment.productIdentifier}</span> has been deferred.`</span>)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-attr\">default</span>:\n        <span class=\"hljs-keyword\">break</span>\n    }\n  })\n})\n\n<span class=\"hljs-comment\">// Check if the user is allowed to make in-app purchase.</span>\n<span class=\"hljs-keyword\">if</span> (!inAppPurchase.canMakePayments()) {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The user is not allowed to make in-app purchase.'</span>)\n}\n\n<span class=\"hljs-comment\">// Retrieve and display the product descriptions.</span>\ninAppPurchase.getProducts(PRODUCT_IDS).then(<span class=\"hljs-function\"><span class=\"hljs-params\">products</span> =></span> {\n  <span class=\"hljs-comment\">// Check the parameters.</span>\n  <span class=\"hljs-keyword\">if</span> (!<span class=\"hljs-built_in\">Array</span>.isArray(products) || products.length &#x3C;= <span class=\"hljs-number\">0</span>) {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Unable to retrieve the product informations.'</span>)\n    <span class=\"hljs-keyword\">return</span>\n  }\n\n  <span class=\"hljs-comment\">// Display the name and price of each product.</span>\n  products.forEach(<span class=\"hljs-function\"><span class=\"hljs-params\">product</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The price of <span class=\"hljs-subst\">${product.localizedTitle}</span> is <span class=\"hljs-subst\">${product.formattedPrice}</span>.`</span>)\n  })\n\n  <span class=\"hljs-comment\">// Ask the user which product he/she wants to purchase.</span>\n  <span class=\"hljs-keyword\">const</span> selectedProduct = products[<span class=\"hljs-number\">0</span>]\n  <span class=\"hljs-keyword\">const</span> selectedQuantity = <span class=\"hljs-number\">1</span>\n\n  <span class=\"hljs-comment\">// Purchase the selected product.</span>\n  inAppPurchase.purchaseProduct(selectedProduct.productIdentifier, selectedQuantity).then(<span class=\"hljs-function\"><span class=\"hljs-params\">isProductValid</span> =></span> {\n    <span class=\"hljs-keyword\">if</span> (!isProductValid) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The product is not valid.'</span>)\n      <span class=\"hljs-keyword\">return</span>\n    }\n\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The payment has been added to the payment queue.'</span>)\n  })\n})\n</code></pre>",
      "title": "In-App Purchases (macOS)",
      "description": ""
    },
    "/docs/api/incoming-message": {
      "locale": "en-US",
      "slug": "incoming-message",
      "href": "/docs/api/incoming-message",
      "crowdinFileId": "256327",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/incoming-message.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-incomingmessage\"><a href=\"#class-incomingmessage\">Class: IncomingMessage</a></h2>\n<blockquote>\n<p>Handle responses to HTTP/HTTPS requests.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>IncomingMessage</code> implements the <a href=\"https://nodejs.org/api/stream.html#stream_readable_streams\">Readable Stream</a>\ninterface and is therefore an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h3 id=\"instance-events\"><a href=\"#instance-events\">Instance Events</a></h3>\n<h4 id=\"event-data\"><a href=\"#event-data\">Event: 'data'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>chunk</code> Buffer - A chunk of response body's data.</li>\n</ul>\n<p>The <code>data</code> event is the usual method of transferring response data into\napplicative code.</p>\n<h4 id=\"event-end\"><a href=\"#event-end\">Event: 'end'</a></h4>\n<p>Indicates that response body has ended. Must be placed before 'data' event.</p>\n<h4 id=\"event-aborted\"><a href=\"#event-aborted\">Event: 'aborted'</a></h4>\n<p>Emitted when a request has been canceled during an ongoing HTTP transaction.</p>\n<h4 id=\"event-error\"><a href=\"#event-error\">Event: 'error'</a></h4>\n<p>Returns:</p>\n<p><code>error</code> Error - Typically holds an error string identifying failure root cause.</p>\n<p>Emitted when an error was encountered while streaming response data events. For\ninstance, if the server closes the underlying while the response is still\nstreaming, an <code>error</code> event will be emitted on the response object and a <code>close</code>\nevent will subsequently follow on the request object.</p>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<p>An <code>IncomingMessage</code> instance has the following readable properties:</p>\n<h4 id=\"responsestatuscode\"><a href=\"#responsestatuscode\"><code>response.statusCode</code></a></h4>\n<p>An <code>Integer</code> indicating the HTTP response status code.</p>\n<h4 id=\"responsestatusmessage\"><a href=\"#responsestatusmessage\"><code>response.statusMessage</code></a></h4>\n<p>A <code>String</code> representing the HTTP status message.</p>\n<h4 id=\"responseheaders\"><a href=\"#responseheaders\"><code>response.headers</code></a></h4>\n<p>A <code>Record&#x3C;string, string | string[]></code> representing the HTTP response headers. The <code>headers</code> object is\nformatted as follows:</p>\n<ul>\n<li>All header names are lowercased.</li>\n<li>Duplicates of <code>age</code>, <code>authorization</code>, <code>content-length</code>, <code>content-type</code>,\n<code>etag</code>, <code>expires</code>, <code>from</code>, <code>host</code>, <code>if-modified-since</code>, <code>if-unmodified-since</code>,\n<code>last-modified</code>, <code>location</code>, <code>max-forwards</code>, <code>proxy-authorization</code>, <code>referer</code>,\n<code>retry-after</code>, <code>server</code>, or <code>user-agent</code> are discarded.</li>\n<li><code>set-cookie</code> is always an array. Duplicates are added to the array.</li>\n<li>For duplicate <code>cookie</code> headers, the values are joined together with '; '.</li>\n<li>For all other headers, the values are joined together with ', '.</li>\n</ul>\n<h4 id=\"responsehttpversion\"><a href=\"#responsehttpversion\"><code>response.httpVersion</code></a></h4>\n<p>A <code>String</code> indicating the HTTP protocol version number. Typical values are '1.0'\nor '1.1'. Additionally <code>httpVersionMajor</code> and <code>httpVersionMinor</code> are two\nInteger-valued readable properties that return respectively the HTTP major and\nminor version numbers.</p>\n<h4 id=\"responsehttpversionmajor\"><a href=\"#responsehttpversionmajor\"><code>response.httpVersionMajor</code></a></h4>\n<p>An <code>Integer</code> indicating the HTTP protocol major version number.</p>\n<h4 id=\"responsehttpversionminor\"><a href=\"#responsehttpversionminor\"><code>response.httpVersionMinor</code></a></h4>\n<p>An <code>Integer</code> indicating the HTTP protocol minor version number.</p>",
      "title": "IncomingMessage",
      "description": "Handle responses to HTTP/HTTPS requests."
    },
    "/docs/api/structures/input-event": {
      "locale": "en-US",
      "slug": "input-event",
      "href": "/docs/api/structures/input-event",
      "crowdinFileId": "256441",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"inputevent-object\"><a href=\"#inputevent-object\">InputEvent Object</a></h1>\n<ul>\n<li><code>modifiers</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of modifiers of the event, can\nbe <code>shift</code>, <code>control</code>, <code>ctrl</code>, <code>alt</code>, <code>meta</code>, <code>command</code>, <code>cmd</code>, <code>isKeypad</code>,\n<code>isAutoRepeat</code>, <code>leftButtonDown</code>, <code>middleButtonDown</code>, <code>rightButtonDown</code>,\n<code>capsLock</code>, <code>numLock</code>, <code>left</code>, <code>right</code>.</li>\n</ul>",
      "title": "InputEvent Object",
      "description": ""
    },
    "/docs/tutorial/installation": {
      "locale": "en-US",
      "slug": "installation",
      "href": "/docs/tutorial/installation",
      "crowdinFileId": "256205",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/installation.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"advanced-installation-instructions\"><a href=\"#advanced-installation-instructions\">Advanced Installation Instructions</a></h1>\n<p>To install prebuilt Electron binaries, use <a href=\"https://docs.npmjs.com\"><code>npm</code></a>.\nThe preferred method is to install Electron as a development dependency in your\napp:</p>\n<pre><code class=\"hljs language-sh\">npm install electron --save-dev\n</code></pre>\n<p>See the <a href=\"/docs/tutorial/electron-versioning\">Electron versioning doc</a> for info on how to\nmanage Electron versions in your apps.</p>\n<h2 id=\"running-electron-ad-hoc\"><a href=\"#running-electron-ad-hoc\">Running Electron ad-hoc</a></h2>\n<p>If you're in a pinch and would prefer to not use <code>npm install</code> in your local\nproject, you can also run Electron ad-hoc using the <a href=\"https://docs.npmjs.com/cli/v7/commands/npx\"><code>npx</code></a> command runner\nbundled with <code>npm</code>:</p>\n<pre><code class=\"hljs language-sh\">npx electron .\n</code></pre>\n<p>The above command will run the current working directory with Electron. Note that\nany dependencies in your app will not be installed.</p>\n<h2 id=\"customization\"><a href=\"#customization\">Customization</a></h2>\n<p>If you want to change the architecture that is downloaded (e.g., <code>ia32</code> on an\n<code>x64</code> machine), you can use the <code>--arch</code> flag with npm install or set the\n<code>npm_config_arch</code> environment variable:</p>\n<pre><code class=\"hljs language-shell\">npm install --arch=ia32 electron\n</code></pre>\n<p>In addition to changing the architecture, you can also specify the platform\n(e.g., <code>win32</code>, <code>linux</code>, etc.) using the <code>--platform</code> flag:</p>\n<pre><code class=\"hljs language-shell\">npm install --platform=win32 electron\n</code></pre>\n<h2 id=\"proxies\"><a href=\"#proxies\">Proxies</a></h2>\n<p>If you need to use an HTTP proxy, you need to set the <code>ELECTRON_GET_USE_PROXY</code> variable to any\nvalue, plus additional environment variables depending on your host system's Node version:</p>\n<ul>\n<li><a href=\"https://github.com/gajus/global-agent/blob/v2.1.5/README.md#environment-variables\">Node 10 and above</a></li>\n<li><a href=\"https://github.com/np-maintain/global-tunnel/blob/v2.7.1/README.md#auto-config\">Before Node 10</a></li>\n</ul>\n<h2 id=\"custom-mirrors-and-caches\"><a href=\"#custom-mirrors-and-caches\">Custom Mirrors and Caches</a></h2>\n<p>During installation, the <code>electron</code> module will call out to\n<a href=\"https://github.com/electron/get\"><code>@electron/get</code></a> to download prebuilt binaries of\nElectron for your platform. It will do so by contacting GitHub's\nrelease download page (<code>https://github.com/electron/electron/releases/tag/v$VERSION</code>,\nwhere <code>$VERSION</code> is the exact version of Electron).</p>\n<p>If you are unable to access GitHub or you need to provide a custom build, you\ncan do so by either providing a mirror or an existing cache directory.</p>\n<h4 id=\"mirror\"><a href=\"#mirror\">Mirror</a></h4>\n<p>You can use environment variables to override the base URL, the path at which to\nlook for Electron binaries, and the binary filename. The URL used by <code>@electron/get</code>\nis composed as follows:</p>\n<pre><code class=\"hljs language-javascript\">url = ELECTRON_MIRROR + ELECTRON_CUSTOM_DIR + <span class=\"hljs-string\">'/'</span> + ELECTRON_CUSTOM_FILENAME\n</code></pre>\n<p>For instance, to use the China CDN mirror:</p>\n<pre><code class=\"hljs language-shell\">ELECTRON_MIRROR=\"https://cdn.npm.taobao.org/dist/electron/\"\n</code></pre>\n<p>By default, <code>ELECTRON_CUSTOM_DIR</code> is set to <code>v$VERSION</code>. To change the format,\nuse the <code>{{ version }}</code> placeholder. For example, <code>version-{{ version }}</code>\nresolves to <code>version-5.0.0</code>, <code>{{ version }}</code> resolves to <code>5.0.0</code>, and\n<code>v{{ version }}</code> is equivalent to the default. As a more concrete example, to\nuse the China non-CDN mirror:</p>\n<pre><code class=\"hljs language-shell\">ELECTRON_MIRROR=\"https://npm.taobao.org/mirrors/electron/\"\nELECTRON_CUSTOM_DIR=\"{{ version }}\"\n</code></pre>\n<p>The above configuration will download from URLs such as\n<code>https://npm.taobao.org/mirrors/electron/8.0.0/electron-v8.0.0-linux-x64.zip</code>.</p>\n<p>If your mirror serves artifacts with different checksums to the official\nElectron release you may have to set <code>ELECTRON_USE_REMOTE_CHECKSUMS=1</code> to\nforce Electron to use the remote <code>SHASUMS256.txt</code> file to verify the checksum\ninstead of the embedded checksums.</p>\n<h4 id=\"cache\"><a href=\"#cache\">Cache</a></h4>\n<p>Alternatively, you can override the local cache. <code>@electron/get</code> will cache\ndownloaded binaries in a local directory to not stress your network. You can use\nthat cache folder to provide custom builds of Electron or to avoid making contact\nwith the network at all.</p>\n<ul>\n<li>Linux: <code>$XDG_CACHE_HOME</code> or <code>~/.cache/electron/</code></li>\n<li>macOS: <code>~/Library/Caches/electron/</code></li>\n<li>Windows: <code>$LOCALAPPDATA/electron/Cache</code> or <code>~/AppData/Local/electron/Cache/</code></li>\n</ul>\n<p>On environments that have been using older versions of Electron, you might find the\ncache also in <code>~/.electron</code>.</p>\n<p>You can also override the local cache location by providing a <code>electron_config_cache</code>\nenvironment variable.</p>\n<p>The cache contains the version's official zip file as well as a checksum, stored as\na text file. A typical cache might look like this:</p>\n<pre><code class=\"hljs language-sh\">├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9electron-v1.7.9-darwin-x64.zip\n│   └── electron-v1.7.9-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1electron-v1.8.1-darwin-x64.zip\n│   └── electron-v1.8.1-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1electron-v1.8.2-beta.1-darwin-x64.zip\n│   └── electron-v1.8.2-beta.1-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2electron-v1.8.2-beta.2-darwin-x64.zip\n│   └── electron-v1.8.2-beta.2-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3electron-v1.8.2-beta.3-darwin-x64.zip\n│   └── electron-v1.8.2-beta.3-darwin-x64.zip\n└── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3SHASUMS256.txt\n    └── SHASUMS256.txt\n</code></pre>\n<h2 id=\"skip-binary-download\"><a href=\"#skip-binary-download\">Skip binary download</a></h2>\n<p>Under the hood, Electron's JavaScript API binds to a binary that contains its\nimplementations. Because this binary is crucial to the function of any Electron app,\nit is downloaded by default in the <code>postinstall</code> step every time you install <code>electron</code>\nfrom the npm registry.</p>\n<p>However, if you want to install your project's dependencies but don't need to use\nElectron functionality, you can set the <code>ELECTRON_SKIP_BINARY_DOWNLOAD</code> environment\nvariable to prevent the binary from being downloaded. For instance, this feature can\nbe useful in continuous integration environments when running unit tests that mock\nout the <code>electron</code> module.</p>\n<pre><code class=\"hljs language-sh\">ELECTRON_SKIP_BINARY_DOWNLOAD=1 npm install\n</code></pre>\n<h2 id=\"troubleshooting\"><a href=\"#troubleshooting\">Troubleshooting</a></h2>\n<p>When running <code>npm install electron</code>, some users occasionally encounter\ninstallation errors.</p>\n<p>In almost all cases, these errors are the result of network problems and not\nactual issues with the <code>electron</code> npm package. Errors like <code>ELIFECYCLE</code>,\n<code>EAI_AGAIN</code>, <code>ECONNRESET</code>, and <code>ETIMEDOUT</code> are all indications of such\nnetwork problems. The best resolution is to try switching networks, or\nwait a bit and try installing again.</p>\n<p>You can also attempt to download Electron directly from\n<a href=\"https://github.com/electron/electron/releases\">electron/electron/releases</a>\nif installing via <code>npm</code> is failing.</p>\n<p>If installation fails with an <code>EACCESS</code> error you may need to\n<a href=\"https://docs.npmjs.com/getting-started/fixing-npm-permissions\">fix your npm permissions</a>.</p>\n<p>If the above error persists, the <a href=\"https://docs.npmjs.com/misc/config#unsafe-perm\">unsafe-perm</a> flag may need to be\nset to true:</p>\n<pre><code class=\"hljs language-sh\">sudo npm install electron --unsafe-perm=<span class=\"hljs-literal\">true</span>\n</code></pre>\n<p>On slower networks, it may be advisable to use the <code>--verbose</code> flag in order to\nshow download progress:</p>\n<pre><code class=\"hljs language-sh\">npm install --verbose electron\n</code></pre>\n<p>If you need to force a re-download of the asset and the SHASUM file set the\n<code>force_no_cache</code> environment variable to <code>true</code>.</p>",
      "title": "Advanced Installation Instructions",
      "description": ""
    },
    "/docs/tutorial/introduction": {
      "locale": "en-US",
      "slug": "introduction",
      "href": "/docs/tutorial/introduction",
      "crowdinFileId": "256207",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/introduction.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"introduction\"><a href=\"#introduction\">Introduction</a></h1>\n<p>Welcome to the Electron documentation! If this is your first time developing\nan Electron app, read through this Getting Started section to get familiar with the\nbasics. Otherwise, feel free to explore our guides and API documentation!</p>\n<h2 id=\"what-is-electron\"><a href=\"#what-is-electron\">What is Electron?</a></h2>\n<p>Electron is a framework for building desktop applications using JavaScript,\nHTML, and CSS. By embedding <a href=\"https://www.chromium.org/\">Chromium</a> and <a href=\"https://nodejs.org/\">Node.js</a> into its\nbinary, Electron allows you to maintain one JavaScript codebase and create\ncross-platform apps that work on Windows, macOS, and Linux — no native development\nexperience required.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<p>These docs operate under the assumption that the reader is familiar with both\nNode.js and general web development. If you need to get more comfortable with\neither of these areas, we recommend the following resources:</p>\n<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web\">Getting started with the Web (MDN)</a></li>\n<li><a href=\"https://nodejs.dev/learn\">Introduction to Node.js</a></li>\n</ul>\n<p>Moreover, you'll have a better time understanding how Electron works if you get\nacquainted with Chromium's process model. You can get a brief overview of\nChrome architecture with the <a href=\"https://www.google.com/googlebooks/chrome/\">Chrome comic</a>, which was released alongside\nChrome's launch back in 2008. Although it's been over a decade since then, the\ncore principles introduced in the comic remain helpful to understand Electron.</p>\n<h2 id=\"running-examples-with-electron-fiddle\"><a href=\"#running-examples-with-electron-fiddle\">Running examples with Electron Fiddle</a></h2>\n<p><a href=\"https://electronjs.org/fiddle\">Electron Fiddle</a> is a sandbox app written with Electron and supported by\nElectron's maintainers. We highly recommend installing it as a learning tool to\nexperiment with Electron's APIs or to prototype features during development.</p>\n<p>Fiddle also integrates nicely with our documentation. When browsing through examples\nin our tutorials, you'll frequently see an \"Open in Electron Fiddle\" button underneath\na code block. If you have Fiddle installed, this button will open a\n<code>fiddle.electronjs.org</code> link that will automatically load the example into Fiddle,\nno copy-pasting required.</p>\n<h2 id=\"getting-help\"><a href=\"#getting-help\">Getting help</a></h2>\n<p>Are you getting stuck anywhere? Here are a few links to places to look:</p>\n<ul>\n<li>If you need help with developing your app, our <a href=\"https://discord.gg/electron\">community Discord server</a>\nis a great place to get advice from other Electron app developers.</li>\n<li>If you suspect you're running into a bug with the <code>electron</code> package, please check\nthe <a href=\"https://github.com/electron/electron/issues\">GitHub issue tracker</a> to see if any existing issues match your\nproblem. If not, feel free to fill out our bug report template and submit a new issue.</li>\n</ul>",
      "title": "Introduction",
      "description": ""
    },
    "/docs/api/structures/io-counters": {
      "locale": "en-US",
      "slug": "io-counters",
      "href": "/docs/api/structures/io-counters",
      "crowdinFileId": "256443",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/io-counters.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"iocounters-object\"><a href=\"#iocounters-object\">IOCounters Object</a></h1>\n<ul>\n<li><code>readOperationCount</code> Number - The number of I/O read operations.</li>\n<li><code>writeOperationCount</code> Number - The number of I/O write operations.</li>\n<li><code>otherOperationCount</code> Number - Then number of I/O other operations.</li>\n<li><code>readTransferCount</code> Number - The number of I/O read transfers.</li>\n<li><code>writeTransferCount</code> Number - The number of I/O write transfers.</li>\n<li><code>otherTransferCount</code> Number - Then number of I/O other transfers.</li>\n</ul>",
      "title": "IOCounters Object",
      "description": ""
    },
    "/docs/api/ipc-main": {
      "locale": "en-US",
      "slug": "ipc-main",
      "href": "/docs/api/ipc-main",
      "crowdinFileId": "256329",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/ipc-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmain\"><a href=\"#ipcmain\">ipcMain</a></h1>\n<blockquote>\n<p>Communicate asynchronously from the main process to renderer processes.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>The <code>ipcMain</code> module is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">Event Emitter</a>. When used in the main\nprocess, it handles asynchronous and synchronous messages sent from a renderer\nprocess (web page). Messages sent from a renderer will be emitted to this\nmodule.</p>\n<h2 id=\"sending-messages\"><a href=\"#sending-messages\">Sending Messages</a></h2>\n<p>It is also possible to send messages from the main process to the renderer\nprocess, see <a href=\"/docs/api/web-contents#contentssendchannel-args\">webContents.send</a> for more information.</p>\n<ul>\n<li>When sending a message, the event name is the <code>channel</code>.</li>\n<li>To reply to a synchronous message, you need to set <code>event.returnValue</code>.</li>\n<li>To send an asynchronous message back to the sender, you can use\n<code>event.reply(...)</code>.  This helper method will automatically handle messages\ncoming from frames that aren't the main frame (e.g. iframes) whereas\n<code>event.sender.send(...)</code> will always send to the main frame.</li>\n</ul>\n<p>An example of sending and handling messages between the render and main\nprocesses:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In main process.</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'asynchronous-message'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"ping\"</span>\n  event.reply(<span class=\"hljs-string\">'asynchronous-reply'</span>, <span class=\"hljs-string\">'pong'</span>)\n})\n\nipcMain.on(<span class=\"hljs-string\">'synchronous-message'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"ping\"</span>\n  event.returnValue = <span class=\"hljs-string\">'pong'</span>\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In renderer process (web page).</span>\n<span class=\"hljs-comment\">// NB. Electron APIs are only accessible from preload, unless contextIsolation is disabled.</span>\n<span class=\"hljs-comment\">// See https://www.electronjs.org/docs/tutorial/process-model#preload-scripts for more details.</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(ipcRenderer.sendSync(<span class=\"hljs-string\">'synchronous-message'</span>, <span class=\"hljs-string\">'ping'</span>)) <span class=\"hljs-comment\">// prints \"pong\"</span>\n\nipcRenderer.on(<span class=\"hljs-string\">'asynchronous-reply'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"pong\"</span>\n})\nipcRenderer.send(<span class=\"hljs-string\">'asynchronous-message'</span>, <span class=\"hljs-string\">'ping'</span>)\n</code></pre>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>ipcMain</code> module has the following method to listen for events:</p>\n<h3 id=\"ipcmainonchannel-listener\"><a href=\"#ipcmainonchannel-listener\"><code>ipcMain.on(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>event</code> IpcMainEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Listens to <code>channel</code>, when a new message arrives <code>listener</code> would be called with\n<code>listener(event, args...)</code>.</p>\n<h3 id=\"ipcmainoncechannel-listener\"><a href=\"#ipcmainoncechannel-listener\"><code>ipcMain.once(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>event</code> IpcMainEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Adds a one time <code>listener</code> function for the event. This <code>listener</code> is invoked\nonly the next time a message is sent to <code>channel</code>, after which it is removed.</p>\n<h3 id=\"ipcmainremovelistenerchannel-listener\"><a href=\"#ipcmainremovelistenerchannel-listener\"><code>ipcMain.removeListener(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Removes the specified <code>listener</code> from the listener array for the specified\n<code>channel</code>.</p>\n<h3 id=\"ipcmainremovealllistenerschannel\"><a href=\"#ipcmainremovealllistenerschannel\"><code>ipcMain.removeAllListeners([channel])</code></a></h3>\n<ul>\n<li><code>channel</code> String (optional)</li>\n</ul>\n<p>Removes listeners of the specified <code>channel</code>.</p>\n<h3 id=\"ipcmainhandlechannel-listener\"><a href=\"#ipcmainhandlechannel-listener\"><code>ipcMain.handle(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function&#x3C;Promise\\<void> | any><ul>\n<li><code>event</code> IpcMainInvokeEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></void></li>\n</ul>\n<p>Adds a handler for an <code>invoke</code>able IPC. This handler will be called whenever a\nrenderer calls <code>ipcRenderer.invoke(channel, ...args)</code>.</p>\n<p>If <code>listener</code> returns a Promise, the eventual result of the promise will be\nreturned as a reply to the remote caller. Otherwise, the return value of the\nlistener will be used as the value of the reply.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\nipcMain.handle(<span class=\"hljs-string\">'my-invokable-ipc'</span>, <span class=\"hljs-keyword\">async</span> (event, ...args) => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> somePromise(...args)\n  <span class=\"hljs-keyword\">return</span> result\n})\n\n<span class=\"hljs-comment\">// Renderer process</span>\n<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> ipcRenderer.invoke(<span class=\"hljs-string\">'my-invokable-ipc'</span>, arg1, arg2)\n  <span class=\"hljs-comment\">// ...</span>\n}\n</code></pre>\n<p>The <code>event</code> that is passed as the first argument to the handler is the same as\nthat passed to a regular event listener. It includes information about which\nWebContents is the source of the invoke request.</p>\n<p>Errors thrown through <code>handle</code> in the main process are not transparent as they\nare serialized and only the <code>message</code> property from the original error is\nprovided to the renderer process. Please refer to\n<a href=\"https://github.com/electron/electron/issues/24427\">#24427</a> for details.</p>\n<h3 id=\"ipcmainhandleoncechannel-listener\"><a href=\"#ipcmainhandleoncechannel-listener\"><code>ipcMain.handleOnce(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function&#x3C;Promise\\<void> | any><ul>\n<li><code>event</code> IpcMainInvokeEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></void></li>\n</ul>\n<p>Handles a single <code>invoke</code>able IPC message, then removes the listener. See\n<code>ipcMain.handle(channel, listener)</code>.</p>\n<h3 id=\"ipcmainremovehandlerchannel\"><a href=\"#ipcmainremovehandlerchannel\"><code>ipcMain.removeHandler(channel)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n</ul>\n<p>Removes any handler for <code>channel</code>, if present.</p>\n<h2 id=\"ipcmainevent-object\"><a href=\"#ipcmainevent-object\">IpcMainEvent object</a></h2>\n<p>The documentation for the <code>event</code> object passed to the <code>callback</code> can be found\nin the <a href=\"/docs/api/structures/ipc-main-event\"><code>ipc-main-event</code></a> structure docs.</p>\n<h2 id=\"ipcmaininvokeevent-object\"><a href=\"#ipcmaininvokeevent-object\">IpcMainInvokeEvent object</a></h2>\n<p>The documentation for the <code>event</code> object passed to <code>handle</code> callbacks can be\nfound in the <a href=\"/docs/api/structures/ipc-main-invoke-event\"><code>ipc-main-invoke-event</code></a>\nstructure docs.</p>",
      "title": "ipcMain",
      "description": "Communicate asynchronously from the main process to renderer processes."
    },
    "/docs/api/structures/ipc-main-event": {
      "locale": "en-US",
      "slug": "ipc-main-event",
      "href": "/docs/api/structures/ipc-main-event",
      "crowdinFileId": "256445",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-main-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmainevent-object-extends-event\"><a href=\"#ipcmainevent-object-extends-event\">IpcMainEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>processId</code> Integer - The internal ID of the renderer process that sent this message</li>\n<li><code>frameId</code> Integer - The ID of the renderer frame that sent this message</li>\n<li><code>returnValue</code> any - Set this to the value to be returned in a synchronous message</li>\n<li><code>sender</code> WebContents - Returns the <code>webContents</code> that sent the message</li>\n<li><code>senderFrame</code> WebFrameMain <em>Readonly</em> - The frame that sent this message</li>\n<li><code>ports</code> MessagePortMain[] - A list of MessagePorts that were transferred with this message</li>\n<li><code>reply</code> Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling.  You should use this method to \"reply\" to the sent message in order to guarantee the reply will go to the correct process and frame.<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>",
      "title": "IpcMainEvent Object extends Event",
      "description": ""
    },
    "/docs/api/structures/ipc-main-invoke-event": {
      "locale": "en-US",
      "slug": "ipc-main-invoke-event",
      "href": "/docs/api/structures/ipc-main-invoke-event",
      "crowdinFileId": "256447",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-main-invoke-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmaininvokeevent-object-extends-event\"><a href=\"#ipcmaininvokeevent-object-extends-event\">IpcMainInvokeEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>processId</code> Integer - The internal ID of the renderer process that sent this message</li>\n<li><code>frameId</code> Integer - The ID of the renderer frame that sent this message</li>\n<li><code>sender</code> WebContents - Returns the <code>webContents</code> that sent the message</li>\n<li><code>senderFrame</code> WebFrameMain <em>Readonly</em> - The frame that sent this message</li>\n</ul>",
      "title": "IpcMainInvokeEvent Object extends Event",
      "description": ""
    },
    "/docs/api/ipc-renderer": {
      "locale": "en-US",
      "slug": "ipc-renderer",
      "href": "/docs/api/ipc-renderer",
      "crowdinFileId": "256331",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/ipc-renderer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcrenderer\"><a href=\"#ipcrenderer\">ipcRenderer</a></h1>\n<blockquote>\n<p>Communicate asynchronously from a renderer process to the main process.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>The <code>ipcRenderer</code> module is an  <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>. It provides a few\nmethods so you can send synchronous and asynchronous messages from the render\nprocess (web page) to the main process. You can also receive replies from the\nmain process.</p>\n<p>See <a href=\"/docs/api/ipc-main\">ipcMain</a> for code examples.</p>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>ipcRenderer</code> module has the following method to listen for events and send messages:</p>\n<h3 id=\"ipcrendereronchannel-listener\"><a href=\"#ipcrendereronchannel-listener\"><code>ipcRenderer.on(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>event</code> IpcRendererEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Listens to <code>channel</code>, when a new message arrives <code>listener</code> would be called with\n<code>listener(event, args...)</code>.</p>\n<h3 id=\"ipcrendereroncechannel-listener\"><a href=\"#ipcrendereroncechannel-listener\"><code>ipcRenderer.once(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>event</code> IpcRendererEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Adds a one time <code>listener</code> function for the event. This <code>listener</code> is invoked\nonly the next time a message is sent to <code>channel</code>, after which it is removed.</p>\n<h3 id=\"ipcrendererremovelistenerchannel-listener\"><a href=\"#ipcrendererremovelistenerchannel-listener\"><code>ipcRenderer.removeListener(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Removes the specified <code>listener</code> from the listener array for the specified\n<code>channel</code>.</p>\n<h3 id=\"ipcrendererremovealllistenerschannel\"><a href=\"#ipcrendererremovealllistenerschannel\"><code>ipcRenderer.removeAllListeners(channel)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n</ul>\n<p>Removes all listeners, or those of the specified <code>channel</code>.</p>\n<h3 id=\"ipcrenderersendchannel-args\"><a href=\"#ipcrenderersendchannel-args\"><code>ipcRenderer.send(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to the main process via <code>channel</code>, along with\narguments. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone\nAlgorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be\nincluded. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will\nthrow an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or\nspecial Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as\n<code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over\nElectron's IPC to the main process, as the main process would have no way to decode\nthem. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>The main process handles it by listening for <code>channel</code> with the\n<a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> module.</p>\n<p>If you need to transfer a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> to the main process, use <a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a>.</p>\n<p>If you want to receive a single response from the main process, like the result of a method call, consider using <a href=\"#ipcrendererinvokechannel-args\"><code>ipcRenderer.invoke</code></a>.</p>\n<h3 id=\"ipcrendererinvokechannel-args\"><a href=\"#ipcrendererinvokechannel-args\"><code>ipcRenderer.invoke(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - Resolves with the response from the main process.</p>\n<p>Send a message to the main process via <code>channel</code> and expect a result\nasynchronously. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone\nAlgorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be\nincluded. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will\nthrow an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or\nspecial Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as\n<code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over\nElectron's IPC to the main process, as the main process would have no way to decode\nthem. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>The main process should listen for <code>channel</code> with\n<a href=\"/docs/api/ipc-main#ipcmainhandlechannel-listener\"><code>ipcMain.handle()</code></a>.</p>\n<p>For example:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.invoke(<span class=\"hljs-string\">'some-name'</span>, someArgument).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">result</span>) =></span> {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// Main process</span>\nipcMain.handle(<span class=\"hljs-string\">'some-name'</span>, <span class=\"hljs-keyword\">async</span> (event, someArgument) => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> doSomeWork(someArgument)\n  <span class=\"hljs-keyword\">return</span> result\n})\n</code></pre>\n<p>If you need to transfer a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> to the main process, use <a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a>.</p>\n<p>If you do not need a response to the message, consider using <a href=\"#ipcrenderersendchannel-args\"><code>ipcRenderer.send</code></a>.</p>\n<h3 id=\"ipcrenderersendsyncchannel-args\"><a href=\"#ipcrenderersendsyncchannel-args\"><code>ipcRenderer.sendSync(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Returns <code>any</code> - The value sent back by the <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> handler.</p>\n<p>Send a message to the main process via <code>channel</code> and expect a result\nsynchronously. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone\nAlgorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be\nincluded. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will\nthrow an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or\nspecial Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as\n<code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over\nElectron's IPC to the main process, as the main process would have no way to decode\nthem. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>The main process handles it by listening for <code>channel</code> with <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> module,\nand replies by setting <code>event.returnValue</code>.</p>\n<blockquote>\n<p>⚠️ <strong>WARNING</strong>: Sending a synchronous message will block the whole\nrenderer process until the reply is received, so use this method only as a\nlast resort. It's much better to use the asynchronous version,\n<a href=\"/docs/api/ipc-renderer#ipcrendererinvokechannel-args\"><code>invoke()</code></a>.</p>\n</blockquote>\n<h3 id=\"ipcrendererpostmessagechannel-message-transfer\"><a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage(channel, message, [transfer])</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePort<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Send a message to the main process, optionally transferring ownership of zero\nor more <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> objects.</p>\n<p>The transferred <code>MessagePort</code> objects will be available in the main process as\n<a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> objects by accessing the <code>ports</code>\nproperty of the emitted event.</p>\n<p>For example:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Renderer process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannel()\nipcRenderer.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Main process</span>\nipcMain.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<p>For more information on using <code>MessagePort</code> and <code>MessageChannel</code>, see the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\">MDN\ndocumentation</a>.</p>\n<h3 id=\"ipcrenderersendtowebcontentsid-channel-args\"><a href=\"#ipcrenderersendtowebcontentsid-channel-args\"><code>ipcRenderer.sendTo(webContentsId, channel, ...args)</code></a></h3>\n<ul>\n<li><code>webContentsId</code> Number</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Sends a message to a window with <code>webContentsId</code> via <code>channel</code>.</p>\n<h3 id=\"ipcrenderersendtohostchannel-args\"><a href=\"#ipcrenderersendtohostchannel-args\"><code>ipcRenderer.sendToHost(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Like <code>ipcRenderer.send</code> but the event will be sent to the <code>&#x3C;webview></code> element in\nthe host page instead of the main process.</p>\n<h2 id=\"event-object\"><a href=\"#event-object\">Event object</a></h2>\n<p>The documentation for the <code>event</code> object passed to the <code>callback</code> can be found\nin the <a href=\"/docs/api/structures/ipc-renderer-event\"><code>ipc-renderer-event</code></a> structure docs.</p>",
      "title": "ipcRenderer",
      "description": "Communicate asynchronously from a renderer process to the main process."
    },
    "/docs/api/structures/ipc-renderer-event": {
      "locale": "en-US",
      "slug": "ipc-renderer-event",
      "href": "/docs/api/structures/ipc-renderer-event",
      "crowdinFileId": "256449",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-renderer-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcrendererevent-object-extends-event\"><a href=\"#ipcrendererevent-object-extends-event\">IpcRendererEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>sender</code> IpcRenderer - The <code>IpcRenderer</code> instance that emitted the event originally</li>\n<li><code>senderId</code> Integer - The <code>webContents.id</code> that sent the message, you can call <code>event.sender.sendTo(event.senderId, ...)</code> to reply to the message, see <a href=\"/docs/api/ipc-renderer#ipcrenderersendtowebcontentsid-channel-args\">ipcRenderer.sendTo</a> for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set <code>event.senderId</code> to <code>0</code>.</li>\n<li><code>ports</code> MessagePort[] - A list of MessagePorts that were transferred with this message</li>\n</ul>",
      "title": "IpcRendererEvent Object extends Event",
      "description": ""
    },
    "/docs/development/issues": {
      "locale": "en-US",
      "slug": "issues",
      "href": "/docs/development/issues",
      "crowdinFileId": "256159",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/issues.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"issues-in-electron\"><a href=\"#issues-in-electron\">Issues In Electron</a></h1>\n<ul>\n<li><a href=\"#how-to-contribute-to-issues\">How to Contribute to Issues</a></li>\n<li><a href=\"#asking-for-general-help\">Asking for General Help</a></li>\n<li><a href=\"#submitting-a-bug-report\">Submitting a Bug Report</a></li>\n<li><a href=\"#triaging-a-bug-report\">Triaging a Bug Report</a></li>\n<li><a href=\"#resolving-a-bug-report\">Resolving a Bug Report</a></li>\n</ul>\n<h2 id=\"how-to-contribute-to-issues\"><a href=\"#how-to-contribute-to-issues\">How to Contribute to Issues</a></h2>\n<p>For any issue, there are fundamentally three ways an individual can\ncontribute:</p>\n<ol>\n<li>By opening the issue for discussion: If you believe that you have found\na new bug in Electron, you should report it by creating a new issue in\nthe <a href=\"https://github.com/electron/electron/issues\"><code>electron/electron</code> issue tracker</a>.</li>\n<li>By helping to triage the issue: You can do this either by providing\nassistive details (a reproducible test case that demonstrates a bug) or by\nproviding suggestions to address the issue.</li>\n<li>By helping to resolve the issue: This can be done by demonstrating\nthat the issue is not a bug or is fixed; but more often, by opening\na pull request that changes the source in <code>electron/electron</code> in a\nconcrete and reviewable manner.</li>\n</ol>\n<h2 id=\"asking-for-general-help\"><a href=\"#asking-for-general-help\">Asking for General Help</a></h2>\n<p><a href=\"/docs/tutorial/support#finding-support\">\"Finding Support\"</a> has a\nlist of resources for getting programming help, reporting security issues,\ncontributing, and more. Please use the issue tracker for bugs only!</p>\n<h2 id=\"submitting-a-bug-report\"><a href=\"#submitting-a-bug-report\">Submitting a Bug Report</a></h2>\n<p>To submit a bug report:</p>\n<p>When opening a new issue in the <a href=\"https://github.com/electron/electron/issues/new/choose\"><code>electron/electron</code> issue tracker</a>, users\nwill be presented with a template that should be filled in.</p>\n<p>If you believe that you have found a bug in Electron, please fill out the template\nto the best of your ability.</p>\n<p>The two most important pieces of information needed to evaluate the report are\na description of the bug and a simple test case to recreate it. It is easier to fix\na bug if it can be reproduced.</p>\n<p>See <a href=\"https://stackoverflow.com/help/mcve\">How to create a Minimal, Complete, and Verifiable example</a>.</p>\n<h2 id=\"triaging-a-bug-report\"><a href=\"#triaging-a-bug-report\">Triaging a Bug Report</a></h2>\n<p>It's common for open issues to involve discussion. Some contributors may\nhave differing opinions, including whether the behavior is a bug or feature.\nThis discussion is part of the process and should be kept focused, helpful,\nand professional.</p>\n<p>Terse responses that provide neither additional context nor supporting detail\nare not helpful or professional. To many, such responses are annoying and\nunfriendly.</p>\n<p>Contributors are encouraged to solve issues collaboratively and help one\nanother make progress. If you encounter an issue that you feel is invalid, or\nwhich contains incorrect information, explain <em>why</em> you feel that way with\nadditional supporting context, and be willing to be convinced that you may\nbe wrong. By doing so, we can often reach the correct outcome faster.</p>\n<h2 id=\"resolving-a-bug-report\"><a href=\"#resolving-a-bug-report\">Resolving a Bug Report</a></h2>\n<p>Most issues are resolved by opening a pull request. The process for opening and\nreviewing a pull request is similar to that of opening and triaging issues, but\ncarries with it a necessary review and approval workflow that ensures that the\nproposed changes meet the minimal quality and functional guidelines of the\nElectron project.</p>",
      "title": "Issues In Electron",
      "description": ""
    },
    "/docs/api/structures/jump-list-category": {
      "locale": "en-US",
      "slug": "jump-list-category",
      "href": "/docs/api/structures/jump-list-category",
      "crowdinFileId": "256451",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/jump-list-category.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"jumplistcategory-object\"><a href=\"#jumplistcategory-object\">JumpListCategory Object</a></h1>\n<ul>\n<li><code>type</code> String (optional) - One of the following:<ul>\n<li><code>tasks</code> - Items in this category will be placed into the standard <code>Tasks</code>\ncategory. There can be only one such category, and it will always be\ndisplayed at the bottom of the Jump List.</li>\n<li><code>frequent</code> - Displays a list of files frequently opened by the app, the\nname of the category and its items are set by Windows.</li>\n<li><code>recent</code> - Displays a list of files recently opened by the app, the name\nof the category and its items are set by Windows. Items may be added to\nthis category indirectly using <code>app.addRecentDocument(path)</code>.</li>\n<li><code>custom</code> - Displays tasks or file links, <code>name</code> must be set by the app.</li>\n</ul></li>\n<li><code>name</code> String (optional) - Must be set if <code>type</code> is <code>custom</code>, otherwise it should be\nomitted.</li>\n<li><code>items</code> JumpListItem<a href=\"/docs/api/structures/optional\"></a> - Array of <a href=\"/docs/api/structures/jump-list-item\"><code>JumpListItem</code></a> objects if <code>type</code> is <code>tasks</code> or\n<code>custom</code>, otherwise it should be omitted.</li>\n</ul>\n<p><strong>Note:</strong> If a <code>JumpListCategory</code> object has neither the <code>type</code> nor the <code>name</code>\nproperty set then its <code>type</code> is assumed to be <code>tasks</code>. If the <code>name</code> property\nis set but the <code>type</code> property is omitted then the <code>type</code> is assumed to be\n<code>custom</code>.</p>\n<p><strong>Note:</strong> The maximum length of a Jump List item's <code>description</code> property is\n260 characters. Beyond this limit, the item will not be added to the Jump\nList, nor will it be displayed.</p>",
      "title": "JumpListCategory Object",
      "description": ""
    },
    "/docs/api/structures/jump-list-item": {
      "locale": "en-US",
      "slug": "jump-list-item",
      "href": "/docs/api/structures/jump-list-item",
      "crowdinFileId": "256453",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/jump-list-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"jumplistitem-object\"><a href=\"#jumplistitem-object\">JumpListItem Object</a></h1>\n<ul>\n<li><code>type</code> String (optional) - One of the following:<ul>\n<li><code>task</code> - A task will launch an app with specific arguments.</li>\n<li><code>separator</code> - Can be used to separate items in the standard <code>Tasks</code>\ncategory.</li>\n<li><code>file</code> - A file link will open a file using the app that created the\nJump List, for this to work the app must be registered as a handler for\nthe file type (though it doesn't have to be the default handler).</li>\n</ul></li>\n<li><code>path</code> String (optional) - Path of the file to open, should only be set if <code>type</code> is\n<code>file</code>.</li>\n<li><code>program</code> String (optional) - Path of the program to execute, usually you should\nspecify <code>process.execPath</code> which opens the current program. Should only be\nset if <code>type</code> is <code>task</code>.</li>\n<li><code>args</code> String (optional) - The command line arguments when <code>program</code> is executed. Should\nonly be set if <code>type</code> is <code>task</code>.</li>\n<li><code>title</code> String (optional) - The text to be displayed for the item in the Jump List.\nShould only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>description</code> String (optional) - Description of the task (displayed in a tooltip).\nShould only be set if <code>type</code> is <code>task</code>. Maximum length 260 characters.</li>\n<li><code>iconPath</code> String (optional) - The absolute path to an icon to be displayed in a\nJump List, which can be an arbitrary resource file that contains an icon\n(e.g. <code>.ico</code>, <code>.exe</code>, <code>.dll</code>). You can usually specify <code>process.execPath</code> to\nshow the program icon.</li>\n<li><code>iconIndex</code> Number (optional) - The index of the icon in the resource file. If a\nresource file contains multiple icons this value can be used to specify the\nzero-based index of the icon that should be displayed for this task. If a\nresource file contains only one icon, this property should be set to zero.</li>\n<li><code>workingDirectory</code> String (optional) - The working directory. Default is empty.</li>\n</ul>",
      "title": "JumpListItem Object",
      "description": ""
    },
    "/docs/api/structures/keyboard-event": {
      "locale": "en-US",
      "slug": "keyboard-event",
      "href": "/docs/api/structures/keyboard-event",
      "crowdinFileId": "256455",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/keyboard-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"keyboardevent-object\"><a href=\"#keyboardevent-object\">KeyboardEvent Object</a></h1>\n<ul>\n<li><code>ctrlKey</code> Boolean (optional) - whether the Control key was used in an accelerator to trigger the Event</li>\n<li><code>metaKey</code> Boolean (optional) - whether a meta key was used in an accelerator to trigger the Event</li>\n<li><code>shiftKey</code> Boolean (optional) - whether a Shift key was used in an accelerator to trigger the Event</li>\n<li><code>altKey</code> Boolean (optional) - whether an Alt key was used in an accelerator to trigger the Event</li>\n<li><code>triggeredByAccelerator</code> Boolean (optional) - whether an accelerator was used to trigger the event as opposed to another user gesture like mouse click</li>\n</ul>",
      "title": "KeyboardEvent Object",
      "description": ""
    },
    "/docs/api/structures/keyboard-input-event": {
      "locale": "en-US",
      "slug": "keyboard-input-event",
      "href": "/docs/api/structures/keyboard-input-event",
      "crowdinFileId": "256457",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/keyboard-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"keyboardinputevent-object-extends-inputevent\"><a href=\"#keyboardinputevent-object-extends-inputevent\">KeyboardInputEvent Object extends <code>InputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>keyDown</code>, <code>keyUp</code> or <code>char</code>.</li>\n<li><code>keyCode</code> String - The character that will be sent\nas the keyboard event. Should only use the valid key codes in\n<a href=\"/docs/api/accelerator\">Accelerator</a>.</li>\n</ul>",
      "title": "KeyboardInputEvent Object extends InputEvent",
      "description": ""
    },
    "/docs/tutorial/keyboard-shortcuts": {
      "locale": "en-US",
      "slug": "keyboard-shortcuts",
      "href": "/docs/tutorial/keyboard-shortcuts",
      "crowdinFileId": "256209",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/keyboard-shortcuts.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"keyboard-shortcuts\"><a href=\"#keyboard-shortcuts\">Keyboard Shortcuts</a></h1>\n<h2 id=\"overview\"><a href=\"#overview\">Overview</a></h2>\n<p>This feature allows you to configure local and global keyboard shortcuts\nfor your Electron application.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<h3 id=\"local-shortcuts\"><a href=\"#local-shortcuts\">Local Shortcuts</a></h3>\n<p>Local keyboard shortcuts are triggered only when the application is focused.\nTo configure a local keyboard shortcut, you need to specify an <a href=\"/docs/api/accelerator\"><code>accelerator</code></a>\nproperty when creating a <a href=\"/docs/api/menu-item\">MenuItem</a> within the <a href=\"/docs/api/menu\">Menu</a> module.</p>\n<p>Starting with a working application from the\n<a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the\nfollowing lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/local\"><span class=\"hljs-keyword\">const</span> { Menu, MenuItem } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> menu = <span class=\"hljs-keyword\">new</span> Menu()\nmenu.append(<span class=\"hljs-keyword\">new</span> MenuItem({\n  <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Electron'</span>,\n  <span class=\"hljs-attr\">submenu</span>: [{\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'help'</span>,\n    <span class=\"hljs-attr\">accelerator</span>: process.platform === <span class=\"hljs-string\">'darwin'</span> ? <span class=\"hljs-string\">'Alt+Cmd+I'</span> : <span class=\"hljs-string\">'Alt+Shift+I'</span>,\n    <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Electron rocks!'</span>) }\n  }]\n}))\n\nMenu.setApplicationMenu(menu)\n</code></pre>\n<blockquote>\n<p>NOTE: In the code above, you can see that the accelerator differs based on the\nuser's operating system. For MacOS, it is <code>Alt+Cmd+I</code>, whereas for Linux and\nWindows, it is <code>Alt+Shift+I</code>.</p>\n</blockquote>\n<p>After launching the Electron application, you should see the application menu\nalong with the local shortcut you just defined:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/local-shortcut.png\" alt=\"Menu with a local shortcut\"></p>\n<p>If you click <code>Help</code> or press the defined accelerator and then open the terminal\nthat you ran your Electron application from, you will see the message that was\ngenerated after triggering the <code>click</code> event: \"Electron rocks!\".</p>\n<h3 id=\"global-shortcuts\"><a href=\"#global-shortcuts\">Global Shortcuts</a></h3>\n<p>To configure a global keyboard shortcut, you need to use the <a href=\"/docs/api/global-shortcut\">globalShortcut</a>\nmodule to detect keyboard events even when the application does not have\nkeyboard focus.</p>\n<p>Starting with a working application from the\n<a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the\nfollowing lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/global\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  globalShortcut.register(<span class=\"hljs-string\">'Alt+CommandOrControl+I'</span>, () => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Electron loves global shortcuts!'</span>)\n  })\n}).then(createWindow)\n</code></pre>\n<blockquote>\n<p>NOTE: In the code above, the <code>CommandOrControl</code> combination uses <code>Command</code>\non macOS and <code>Control</code> on Windows/Linux.</p>\n</blockquote>\n<p>After launching the Electron application, if you press the defined key\ncombination then open the terminal that you ran your Electron application from,\nyou will see that Electron loves global shortcuts!</p>\n<h3 id=\"shortcuts-within-a-browserwindow\"><a href=\"#shortcuts-within-a-browserwindow\">Shortcuts within a BrowserWindow</a></h3>\n<h4 id=\"using-web-apis\"><a href=\"#using-web-apis\">Using web APIs</a></h4>\n<p>If you want to handle keyboard shortcuts within a <a href=\"/docs/api/browser-window\">BrowserWindow</a>, you can\nlisten for the <code>keyup</code> and <code>keydown</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/Events\">DOM events</a> inside the\nrenderer process using the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\">addEventListener() API</a>.</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/web-apis\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleKeyPress</span>(<span class=\"hljs-params\">event</span>) </span>{\n  <span class=\"hljs-comment\">// You can put code here to handle the keypress.</span>\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">\"last-keypress\"</span>).innerText = event.key;\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`You pressed <span class=\"hljs-subst\">${event.key}</span>`</span>);\n}\n\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'keyup'</span>, handleKeyPress, <span class=\"hljs-literal\">true</span>);\n</code></pre>\n<blockquote>\n<p>Note:  the third parameter <code>true</code> indicates that the listener will always receive\nkey presses before other listeners so they can't have <code>stopPropagation()</code>\ncalled on them.</p>\n</blockquote>\n<h4 id=\"intercepting-events-in-the-main-process\"><a href=\"#intercepting-events-in-the-main-process\">Intercepting events in the main process</a></h4>\n<p>The <a href=\"/docs/api/web-contents#event-before-input-event\"><code>before-input-event</code></a> event\nis emitted before dispatching <code>keydown</code> and <code>keyup</code> events in the page. It can\nbe used to catch and handle custom shortcuts that are not visible in the menu.</p>\n<p>Starting with a working application from the\n<a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the\nfollowing lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/interception-from-main\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n  win.webContents.on(<span class=\"hljs-string\">'before-input-event'</span>, (event, input) => {\n    <span class=\"hljs-keyword\">if</span> (input.control &#x26;&#x26; input.key.toLowerCase() === <span class=\"hljs-string\">'i'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Pressed Control+I'</span>)\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<p>After launching the Electron application, if you open the terminal that you ran\nyour Electron application from and press <code>Ctrl+I</code> key combination, you will\nsee that this key combination was successfully intercepted.</p>\n<h4 id=\"using-third-party-libraries\"><a href=\"#using-third-party-libraries\">Using third-party libraries</a></h4>\n<p>If you don't want to do manual shortcut parsing, there are libraries that do\nadvanced key detection, such as <a href=\"https://github.com/ccampbell/mousetrap\">mousetrap</a>. Below are examples of usage of the\n<code>mousetrap</code> running in the Renderer process:</p>\n<pre><code class=\"hljs language-js\">Mousetrap.bind(<span class=\"hljs-string\">'4'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'4'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'?'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'show shortcuts!'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'esc'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'escape'</span>) }, <span class=\"hljs-string\">'keyup'</span>)\n\n<span class=\"hljs-comment\">// combinations</span>\nMousetrap.bind(<span class=\"hljs-string\">'command+shift+k'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'command shift k'</span>) })\n\n<span class=\"hljs-comment\">// map multiple combinations to the same callback</span>\nMousetrap.bind([<span class=\"hljs-string\">'command+k'</span>, <span class=\"hljs-string\">'ctrl+k'</span>], () => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'command k or control k'</span>)\n\n  <span class=\"hljs-comment\">// return false to prevent default behavior and stop event from bubbling</span>\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n\n<span class=\"hljs-comment\">// gmail style sequences</span>\nMousetrap.bind(<span class=\"hljs-string\">'g i'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'go to inbox'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'* a'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'select all'</span>) })\n\n<span class=\"hljs-comment\">// konami code!</span>\nMousetrap.bind(<span class=\"hljs-string\">'up up down down left right left right b a enter'</span>, () => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'konami code'</span>)\n})\n</code></pre>",
      "title": "Keyboard Shortcuts",
      "description": "NOTE: In the code above, you can see that the accelerator differs based on the\nuser's operating system. For MacOS, it is Alt+Cmd+I, whereas for Linux and\nWindows, it is Alt+Shift+I."
    },
    "/docs/tutorial/launch-app-from-url-in-another-app": {
      "locale": "en-US",
      "slug": "launch-app-from-url-in-another-app",
      "href": "/docs/tutorial/launch-app-from-url-in-another-app",
      "crowdinFileId": "256211",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/launch-app-from-url-in-another-app.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<hr>\n<p>title: Launching Your Electron App From a URL In Another App\ndescription: This guide will take you through the process of setting your electron app as the default handler for a specific protocol.\nslug: launch-app-from-url-in-another-app</p>\n<h2 id=\"hide_title-true\"><a href=\"#hide_title-true\">hide_title: true</a></h2>\n<h1 id=\"launching-your-electron-app-from-a-url-in-another-app\"><a href=\"#launching-your-electron-app-from-a-url-in-another-app\">Launching Your Electron App From A URL In Another App</a></h1>\n<h2 id=\"overview\"><a href=\"#overview\">Overview</a></h2>\n<!-- ✍ Update this section if you want to provide more details -->\n<p>This guide will take you through the process of setting your Electron app as the default\nhandler for a specific <a href=\"https://www.electronjs.org/docs/api/protocol\">protocol</a>.</p>\n<p>By the end of this tutorial, we will have set our app to intercept and handle\nany clicked URLs that start with a specific protocol. In this guide, the protocol\nwe will use will be \"<code>electron-fiddle://</code>\".</p>\n<h2 id=\"examples\"><a href=\"#examples\">Examples</a></h2>\n<h3 id=\"main-process-mainjs\"><a href=\"#main-process-mainjs\">Main Process (main.js)</a></h3>\n<p>First, we will import the required modules from <code>electron</code>. These modules help\ncontrol our application lifecycle and create a native browser window.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n</code></pre>\n<p>Next, we will proceed to register our application to handle all \"<code>electron-fiddle://</code>\" protocols.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">if</span> (process.defaultApp) {\n  <span class=\"hljs-keyword\">if</span> (process.argv.length >= <span class=\"hljs-number\">2</span>) {\n    app.setAsDefaultProtocolClient(<span class=\"hljs-string\">'electron-fiddle'</span>, process.execPath, [path.resolve(process.argv[<span class=\"hljs-number\">1</span>])])\n  }\n} <span class=\"hljs-keyword\">else</span> {\n  app.setAsDefaultProtocolClient(<span class=\"hljs-string\">'electron-fiddle'</span>)\n}\n</code></pre>\n<p>We will now define the function in charge of creating our browser window and load our application's <code>index.html</code> file.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> createWindow = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Create the browser window.</span>\n  mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  mainWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n</code></pre>\n<p>In this next step, we will create our  <code>BrowserWindow</code> and tell our application how to handle an event in which an external protocol is clicked.</p>\n<p>This code will be different in Windows compared to MacOS and Linux. This is due to Windows requiring additional code in order to open the contents of the protocol link within the same Electron instance. Read more about this <a href=\"https://www.electronjs.org/docs/api/app#apprequestsingleinstancelock\">here</a>.</p>\n<h4 id=\"windows-code\"><a href=\"#windows-code\">Windows code:</a></h4>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> gotTheLock = app.requestSingleInstanceLock()\n\n<span class=\"hljs-keyword\">if</span> (!gotTheLock) {\n  app.quit()\n} <span class=\"hljs-keyword\">else</span> {\n  app.on(<span class=\"hljs-string\">'second-instance'</span>, (event, commandLine, workingDirectory) => {\n    <span class=\"hljs-comment\">// Someone tried to run a second instance, we should focus our window.</span>\n    <span class=\"hljs-keyword\">if</span> (mainWindow) {\n      <span class=\"hljs-keyword\">if</span> (mainWindow.isMinimized()) mainWindow.restore()\n      mainWindow.focus()\n    }\n  })\n\n  <span class=\"hljs-comment\">// Create mainWindow, load the rest of the app, etc...</span>\n  app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    createWindow()\n  })\n\n  <span class=\"hljs-comment\">// Handle the protocol. In this case, we choose to show an Error Box.</span>\n  app.on(<span class=\"hljs-string\">'open-url'</span>, (event, url) => {\n    dialog.showErrorBox(<span class=\"hljs-string\">'Welcome Back'</span>, <span class=\"hljs-string\">`You arrived from: <span class=\"hljs-subst\">${url}</span>`</span>)\n  })\n}\n</code></pre>\n<h4 id=\"macos-and-linux-code\"><a href=\"#macos-and-linux-code\">MacOS and Linux code:</a></h4>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// This method will be called when Electron has finished</span>\n<span class=\"hljs-comment\">// initialization and is ready to create browser windows.</span>\n<span class=\"hljs-comment\">// Some APIs can only be used after this event occurs.</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n})\n\n<span class=\"hljs-comment\">// Handle the protocol. In this case, we choose to show an Error Box.</span>\napp.on(<span class=\"hljs-string\">'open-url'</span>, (event, url) => {\n  dialog.showErrorBox(<span class=\"hljs-string\">'Welcome Back'</span>, <span class=\"hljs-string\">`You arrived from: <span class=\"hljs-subst\">${url}</span>`</span>)\n})\n</code></pre>\n<p>Finally, we will add some additional code to handle when someone closes our application.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Quit when all windows are closed, except on macOS. There, it's common</span>\n<span class=\"hljs-comment\">// for applications and their menu bar to stay active until the user quits</span>\n<span class=\"hljs-comment\">// explicitly with Cmd + Q.</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h2 id=\"important-notes\"><a href=\"#important-notes\">Important notes</a></h2>\n<h3 id=\"packaging\"><a href=\"#packaging\">Packaging</a></h3>\n<p>On macOS and Linux, this feature will only work when your app is packaged. It will not work when\nyou're launching it in development from the command-line. When you package your app you'll need to\nmake sure the macOS <code>Info.plist</code> and the Linux <code>.desktop</code> files for the app are updated to include\nthe new protocol handler. Some of the Electron tools for bundling and distributing apps handle\nthis for you.</p>\n<h4 id=\"electron-forge\"><a href=\"#electron-forge\"></a><a href=\"https://electronforge.io\">Electron Forge</a></h4>\n<p>If you're using Electron Forge, adjust <code>packagerConfig</code> for macOS support, and the configuration for\nthe appropriate Linux makers for Linux support, in your <a href=\"https://www.electronforge.io/configuration\">Forge\nconfiguration</a> <em>(please note the following example only\nshows the bare minimum needed to add the configuration changes)</em>:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"config\"</span>: {\n    <span class=\"hljs-attr\">\"forge\"</span>: {\n      <span class=\"hljs-attr\">\"packagerConfig\"</span>: {\n        <span class=\"hljs-attr\">\"protocols\"</span>: [\n          {\n            <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"Electron Fiddle\"</span>,\n            <span class=\"hljs-attr\">\"schemes\"</span>: [<span class=\"hljs-string\">\"electron-fiddle\"</span>]\n          }\n        ]\n      },\n      <span class=\"hljs-attr\">\"makers\"</span>: [\n        {\n          <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"@electron-forge/maker-deb\"</span>,\n          <span class=\"hljs-attr\">\"config\"</span>: {\n            <span class=\"hljs-attr\">\"mimeType\"</span>: [<span class=\"hljs-string\">\"x-scheme-handler/electron-fiddle\"</span>]\n          }\n        }\n      ]\n    }\n  }\n}\n</code></pre>\n<h4 id=\"electron-packager\"><a href=\"#electron-packager\"></a><a href=\"https://github.com/electron/electron-packager\">Electron Packager</a></h4>\n<p>For macOS support:</p>\n<p>If you're using Electron Packager's API, adding support for protocol handlers is similar to how\nElectron Forge is handled, except\n<code>protocols</code> is part of the Packager options passed to the <code>packager</code> function.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> packager = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-packager'</span>)\n\npackager({\n  <span class=\"hljs-comment\">// ...other options...</span>\n  <span class=\"hljs-attr\">protocols</span>: [\n    {\n      <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Electron Fiddle'</span>,\n      <span class=\"hljs-attr\">schemes</span>: [<span class=\"hljs-string\">'electron-fiddle'</span>]\n    }\n  ]\n\n}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">paths</span> =></span> <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`SUCCESS: Created <span class=\"hljs-subst\">${paths.join(<span class=\"hljs-string\">', '</span>)}</span>`</span>))\n  .catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">`ERROR: <span class=\"hljs-subst\">${err.message}</span>`</span>))\n</code></pre>\n<p>If you're using Electron Packager's CLI, use the <code>--protocol</code> and <code>--protocol-name</code> flags. For\nexample:</p>\n<pre><code class=\"hljs language-shell\">npx electron-packager . --protocol=electron-fiddle --protocol-name=\"Electron Fiddle\"\n</code></pre>\n<h2 id=\"conclusion\"><a href=\"#conclusion\">Conclusion</a></h2>\n<p>After you start your Electron app, you can enter in a URL in your browser that contains the custom\nprotocol, for example <code>\"electron-fiddle://open\"</code> and observe that the application will respond and\nshow an error dialog box.</p>\n<!--\n    Because Electron examples usually require multiple files (HTML, CSS, JS\n    for the main and renderer process, etc.), we use this custom code block\n    for Fiddle (https://www.electronjs.org/fiddle).\n    Please modify any of the files in the referenced folder to fit your\n    example.\n    The content in this codeblock will not be rendered in the website so you\n    can leave it empty.\n-->\n<!-- ✍ Explanation of the code below -->",
      "title": "Launching Your Electron App From A URL In Another App",
      "description": ""
    },
    "/docs/tutorial/linux-desktop-actions": {
      "locale": "en-US",
      "slug": "linux-desktop-actions",
      "href": "/docs/tutorial/linux-desktop-actions",
      "crowdinFileId": "256213",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/linux-desktop-actions.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktop-launcher-actions-linux\"><a href=\"#desktop-launcher-actions-linux\">Desktop Launcher Actions (Linux)</a></h1>\n<h2 id=\"overview\"><a href=\"#overview\">Overview</a></h2>\n<p>On many Linux environments, you can add custom entries to the system launcher\nby modifying the <code>.desktop</code> file. For Canonical's Unity documentation, see\n<a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Adding Shortcuts to a Launcher</a>. For details on a more generic\nimplementation, see the <a href=\"https://specifications.freedesktop.org/desktop-entry-spec/1.1/ar01s11.html\">freedesktop.org Specification</a>.</p>\n<p><img src=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles?action=AttachFile&#x26;do=get&#x26;target=shortcuts.png\" alt=\"audacious\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example of launcher shortcuts in Audacious\naudio player</p>\n</blockquote>\n<p>To create a shortcut, you need to provide <code>Name</code> and <code>Exec</code> properties for the\nentry you want to add to the shortcut menu. Unity will execute the command\ndefined in the <code>Exec</code> field after the user clicked the shortcut menu item.\nAn example of the <code>.desktop</code> file may look as follows:</p>\n<pre><code class=\"hljs language-plaintext\">Actions=PlayPause;Next;Previous\n\n[Desktop Action PlayPause]\nName=Play-Pause\nExec=audacious -t\nOnlyShowIn=Unity;\n\n[Desktop Action Next]\nName=Next\nExec=audacious -f\nOnlyShowIn=Unity;\n\n[Desktop Action Previous]\nName=Previous\nExec=audacious -r\nOnlyShowIn=Unity;\n</code></pre>\n<p>The preferred way for Unity to instruct your application on what to do is using\nparameters. You can find them in your application in the global variable\n<code>process.argv</code>.</p>",
      "title": "Desktop Launcher Actions (Linux)",
      "description": "NOTE: The screenshot above is an example of launcher shortcuts in Audacious\naudio player"
    },
    "/docs/tutorial/mac-app-store-submission-guide": {
      "locale": "en-US",
      "slug": "mac-app-store-submission-guide",
      "href": "/docs/tutorial/mac-app-store-submission-guide",
      "crowdinFileId": "256215",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/mac-app-store-submission-guide.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"mac-app-store-submission-guide\"><a href=\"#mac-app-store-submission-guide\">Mac App Store Submission Guide</a></h1>\n<p>This guide provides information on:</p>\n<ul>\n<li>How to sign Electron apps on macOS;</li>\n<li>How to submit Electron apps to Mac App Store (MAS);</li>\n<li>The limitations of the MAS build.</li>\n</ul>\n<h2 id=\"requirements\"><a href=\"#requirements\">Requirements</a></h2>\n<p>To sign Electron apps, the following tools must be installed first:</p>\n<ul>\n<li>Xcode 11 or above.</li>\n<li>The <a href=\"https://github.com/electron/electron-osx-sign\">electron-osx-sign</a> npm module.</li>\n</ul>\n<p>You also have to register an Apple Developer account and join the\n<a href=\"https://developer.apple.com/support/compare-memberships/\">Apple Developer Program</a>.</p>\n<h2 id=\"sign-electron-apps\"><a href=\"#sign-electron-apps\">Sign Electron apps</a></h2>\n<p>Electron apps can be distributed through Mac App Store or outside it. Each way\nrequires different ways of signing and testing. This guide focuses on\ndistribution via Mac App Store, but will also mention other methods.</p>\n<p>The following steps describe how to get the certificates from Apple, how to sign\nElectron apps, and how to test them.</p>\n<h3 id=\"get-certificates\"><a href=\"#get-certificates\">Get certificates</a></h3>\n<p>The simplest way to get signing certificates is to use Xcode:</p>\n<ol>\n<li>Open Xcode and open \"Accounts\" preferences;</li>\n<li>Sign in with your Apple account;</li>\n<li>Select a team and click \"Manage Certificates\";</li>\n<li>In the lower-left corner of the signing certificates sheet, click the Add\nbutton (+), and add following certificates:<ul>\n<li>\"Apple Development\"</li>\n<li>\"Apple Distribution\"</li>\n</ul></li>\n</ol>\n<p>The \"Apple Development\" certificate is used to sign apps for development and\ntesting, on machines that have been registered on Apple Developer website. The\nmethod of registration will be described in\n<a href=\"#prepare-provisioning-profile\">Prepare provisioning profile</a>.</p>\n<p>Apps signed with the \"Apple Development\" certificate cannot be submitted to Mac\nApp Store. For that purpose, apps must be signed with the \"Apple Distribution\"\ncertificate instead. But note that apps signed with the \"Apple Distribution\"\ncertificate cannot run directly, they must be re-signed by Apple to be able to\nrun, which will only be possible after being downloaded from the Mac App Store.</p>\n<h4 id=\"other-certificates\"><a href=\"#other-certificates\">Other certificates</a></h4>\n<p>You may notice that there are also other kinds of certificates.</p>\n<p>The \"Developer ID Application\" certificate is used to sign apps before\ndistributing them outside the Mac App Store.</p>\n<p>The \"Developer ID Installer\" and \"Mac Installer Distribution\" certificates are\nused to sign the Mac Installer Package instead of the app itself. Most Electron\napps do not use Mac Installer Package so they are generally not needed.</p>\n<p>The full list of certificate types can be found\n<a href=\"https://help.apple.com/xcode/mac/current/#/dev80c6204ec\">here</a>.</p>\n<p>Apps signed with \"Apple Development\" and \"Apple Distribution\" certificates can\nonly run under <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandbox</a>, so they must use the MAS build of\nElectron. However, the \"Developer ID Application\" certificate does not have this\nrestrictions, so apps signed with it can use either the normal build or the MAS\nbuild of Electron.</p>\n<h4 id=\"legacy-certificate-names\"><a href=\"#legacy-certificate-names\">Legacy certificate names</a></h4>\n<p>Apple has been changing the names of certificates during past years, you might\nencounter them when reading old documentations, and some utilities are still\nusing one of the old names.</p>\n<ul>\n<li>The \"Apple Distribution\" certificate was also named as \"3rd Party Mac\nDeveloper Application\" and \"Mac App Distribution\".</li>\n<li>The \"Apple Development\" certificate was also named as \"Mac Developer\" and\n\"Development\".</li>\n</ul>\n<h3 id=\"prepare-provisioning-profile\"><a href=\"#prepare-provisioning-profile\">Prepare provisioning profile</a></h3>\n<p>If you want to test your app on your local machine before submitting your app to\nthe Mac App Store, you have to sign the app with the \"Apple Development\"\ncertificate with the provisioning profile embedded in the app bundle.</p>\n<p>To <a href=\"https://help.apple.com/developer-account/#/devf2eb157f8\">create a provisioning profile</a>,\nyou can follow the below steps:</p>\n<ol>\n<li>Open the \"Certificates, Identifiers &#x26; Profiles\" page on the\n<a href=\"https://developer.apple.com/account\">Apple Developer</a> website.</li>\n<li>Add a new App ID for your app in the \"Identifiers\" page.</li>\n<li>Register your local machine in the \"Devices\" page. You can find your\nmachine's \"Device ID\" in the \"Hardware\" page of the \"System Information\" app.</li>\n<li>Register a new Provisioning Profile in the \"Profiles\" page, and download it\nto <code>/path/to/yourapp.provisionprofile</code>.</li>\n</ol>\n<h3 id=\"enable-apples-app-sandbox\"><a href=\"#enable-apples-app-sandbox\">Enable Apple's App Sandbox</a></h3>\n<p>Apps submitted to the Mac App Store must run under Apple's\n<a href=\"https://developer.apple.com/app-sandboxing/\">App Sandbox</a>, and only the MAS build of Electron can run with\nthe App Sandbox. The standard darwin build of Electron will fail to launch\nwhen run under App Sandbox.</p>\n<p>When signing the app with <code>electron-osx-sign</code>, it will automatically add the\nnecessary entitlements to your app's entitlements, but if you are using custom\nentitlements, you must ensure App Sandbox capacity is added:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<h4 id=\"extra-steps-without-electron-osx-sign\"><a href=\"#extra-steps-without-electron-osx-sign\">Extra steps without <code>electron-osx-sign</code></a></h4>\n<p>If you are signing your app without using <code>electron-osx-sign</code>, you must ensure\nthe app bundle's entitlements have at least following keys:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.application-groups<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">array</span>></span>\n      <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>TEAM_ID.your.bundle.id<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n    <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">array</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>The <code>TEAM_ID</code> should be replaced with your Apple Developer account's Team ID,\nand the <code>your.bundle.id</code> should be replaced with the App ID of the app.</p>\n<p>And the following entitlements must be added to the binaries and helpers in\nthe app's bundle:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.inherit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>And the app bundle's <code>Info.plist</code> must include <code>ElectronTeamID</code> key, which has\nyour Apple Developer account's Team ID as its value:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n  ...\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>ElectronTeamID<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>TEAM_ID<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>When using <code>electron-osx-sign</code> the <code>ElectronTeamID</code> key will be added\nautomatically by extracting the Team ID from the certificate's name. You may\nneed to manually add this key if <code>electron-osx-sign</code> could not find the correct\nTeam ID.</p>\n<h3 id=\"sign-apps-for-development\"><a href=\"#sign-apps-for-development\">Sign apps for development</a></h3>\n<p>To sign an app that can run on your development machine, you must sign it with\nthe \"Apple Development\" certificate and pass the provisioning profile to\n<code>electron-osx-sign</code>.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Apple Development'</span> --provisioning-profile=/path/to/yourapp.provisionprofile\n</code></pre>\n<p>If you are signing without <code>electron-osx-sign</code>, you must place the provisioning\nprofile to <code>YourApp.app/Contents/embedded.provisionprofile</code>.</p>\n<p>The signed app can only run on the machines that registered by the provisioning\nprofile, and this is the only way to test the signed app before submitting to\nMac App Store.</p>\n<h3 id=\"sign-apps-for-submitting-to-the-mac-app-store\"><a href=\"#sign-apps-for-submitting-to-the-mac-app-store\">Sign apps for submitting to the Mac App Store</a></h3>\n<p>To sign an app that will be submitted to Mac App Store, you must sign it with\nthe \"Apple Distribution\" certificate. Note that apps signed with this\ncertificate will not run anywhere, unless it is downloaded from Mac App Store.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Apple Distribution'</span>\n</code></pre>\n<h3 id=\"sign-apps-for-distribution-outside-the-mac-app-store\"><a href=\"#sign-apps-for-distribution-outside-the-mac-app-store\">Sign apps for distribution outside the Mac App Store</a></h3>\n<p>If you don't plan to submit the app to Mac App Store, you can sign it the\n\"Developer ID Application\" certificate. In this way there is no requirement on\nApp Sandbox, and you should use the normal darwin build of Electron if you don't\nuse App Sandbox.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Developer ID Application'</span> --no-gatekeeper-assess\n</code></pre>\n<p>By passing <code>--no-gatekeeper-assess</code>, the <code>electron-osx-sign</code> will skip the macOS\nGateKeeper check as your app usually has not been notarized yet by this step.</p>\n<!-- TODO(zcbenz): Add a chapter about App Notarization -->\n<p>This guide does not cover <a href=\"https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution\">App Notarization</a>, but you might\nwant to do it otherwise Apple may prevent users from using your app outside Mac\nApp Store.</p>\n<h2 id=\"submit-apps-to-the-mac-app-store\"><a href=\"#submit-apps-to-the-mac-app-store\">Submit Apps to the Mac App Store</a></h2>\n<p>After signing the app with the \"Apple Distribution\" certificate, you can\ncontinue to submit it to Mac App Store.</p>\n<p>However, this guide do not ensure your app will be approved by Apple; you\nstill need to read Apple's <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/SubmittingYourApp/SubmittingYourApp.html\">Submitting Your App</a> guide on\nhow to meet the Mac App Store requirements.</p>\n<h3 id=\"upload\"><a href=\"#upload\">Upload</a></h3>\n<p>The Application Loader should be used to upload the signed app to iTunes\nConnect for processing, making sure you have <a href=\"https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/CreatingiTunesConnectRecord.html\">created a record</a>\nbefore uploading.</p>\n<p>If you are seeing errors like private APIs uses, you should check if the app is\nusing the MAS build of Electron.</p>\n<h3 id=\"submit-for-review\"><a href=\"#submit-for-review\">Submit for review</a></h3>\n<p>After uploading, you should <a href=\"https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html\">submit your app for review</a>.</p>\n<h2 id=\"limitations-of-mas-build\"><a href=\"#limitations-of-mas-build\">Limitations of MAS Build</a></h2>\n<p>In order to satisfy all requirements for app sandboxing, the following modules\nhave been disabled in the MAS build:</p>\n<ul>\n<li><code>crashReporter</code></li>\n<li><code>autoUpdater</code></li>\n</ul>\n<p>and the following behaviors have been changed:</p>\n<ul>\n<li>Video capture may not work for some machines.</li>\n<li>Certain accessibility features may not work.</li>\n<li>Apps will not be aware of DNS changes.</li>\n</ul>\n<p>Also, due to the usage of app sandboxing, the resources which can be accessed by\nthe app are strictly limited; you can read <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandboxing</a> for\nmore information.</p>\n<h3 id=\"additional-entitlements\"><a href=\"#additional-entitlements\">Additional entitlements</a></h3>\n<p>Depending on which Electron APIs your app uses, you may need to add additional\nentitlements to your app's entitlements file. Otherwise, the App Sandbox may\nprevent you from using them.</p>\n<h4 id=\"network-access\"><a href=\"#network-access\">Network access</a></h4>\n<p>Enable outgoing network connections to allow your app to connect to a server:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.network.client<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>Enable incoming network connections to allow your app to open a network\nlistening socket:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.network.server<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>See the <a href=\"https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW9\">Enabling Network Access documentation</a> for more\ndetails.</p>\n<h4 id=\"dialogshowopendialog\"><a href=\"#dialogshowopendialog\">dialog.showOpenDialog</a></h4>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.files.user-selected.read-only<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>See the <a href=\"https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6\">Enabling User-Selected File Access documentation</a> for\nmore details.</p>\n<h4 id=\"dialogshowsavedialog\"><a href=\"#dialogshowsavedialog\">dialog.showSaveDialog</a></h4>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.files.user-selected.read-write<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>See the <a href=\"https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6\">Enabling User-Selected File Access documentation</a> for\nmore details.</p>\n<h2 id=\"cryptographic-algorithms-used-by-electron\"><a href=\"#cryptographic-algorithms-used-by-electron\">Cryptographic Algorithms Used by Electron</a></h2>\n<p>Depending on the countries in which you are releasing your app, you may be\nrequired to provide information on the cryptographic algorithms used in your\nsoftware. See the <a href=\"https://help.apple.com/app-store-connect/#/devc3f64248f\">encryption export compliance docs</a> for\nmore information.</p>\n<p>Electron uses following cryptographic algorithms:</p>\n<ul>\n<li>AES - <a href=\"https://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf\">NIST SP 800-38A</a>, <a href=\"https://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf\">NIST SP 800-38D</a>, <a href=\"https://www.ietf.org/rfc/rfc3394.txt\">RFC 3394</a></li>\n<li>HMAC - <a href=\"https://csrc.nist.gov/publications/fips/fips198-1/FIPS-198-1_final.pdf\">FIPS 198-1</a></li>\n<li>ECDSA - ANS X9.62–2005</li>\n<li>ECDH - ANS X9.63–2001</li>\n<li>HKDF - <a href=\"https://csrc.nist.gov/publications/nistpubs/800-56C/SP-800-56C.pdf\">NIST SP 800-56C</a></li>\n<li>PBKDF2 - <a href=\"https://tools.ietf.org/html/rfc2898\">RFC 2898</a></li>\n<li>RSA - <a href=\"https://www.ietf.org/rfc/rfc3447\">RFC 3447</a></li>\n<li>SHA - <a href=\"https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf\">FIPS 180-4</a></li>\n<li>Blowfish - <a href=\"https://www.schneier.com/cryptography/blowfish/\">https://www.schneier.com/cryptography/blowfish/</a></li>\n<li>CAST - <a href=\"https://tools.ietf.org/html/rfc2144\">RFC 2144</a>, <a href=\"https://tools.ietf.org/html/rfc2612\">RFC 2612</a></li>\n<li>DES - <a href=\"https://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf\">FIPS 46-3</a></li>\n<li>DH - <a href=\"https://tools.ietf.org/html/rfc2631\">RFC 2631</a></li>\n<li>DSA - <a href=\"https://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+X9.30-1%3A1997\">ANSI X9.30</a></li>\n<li>EC - <a href=\"https://www.secg.org/sec1-v2.pdf\">SEC 1</a></li>\n<li>IDEA - \"On the Design and Security of Block Ciphers\" book by X. Lai</li>\n<li>MD2 - <a href=\"https://tools.ietf.org/html/rfc1319\">RFC 1319</a></li>\n<li>MD4 - <a href=\"https://tools.ietf.org/html/rfc6150\">RFC 6150</a></li>\n<li>MD5 - <a href=\"https://tools.ietf.org/html/rfc1321\">RFC 1321</a></li>\n<li>MDC2 - <a href=\"https://wiki.openssl.org/index.php/Manual:Mdc2(3)\">ISO/IEC 10118-2</a></li>\n<li>RC2 - <a href=\"https://tools.ietf.org/html/rfc2268\">RFC 2268</a></li>\n<li>RC4 - <a href=\"https://tools.ietf.org/html/rfc4345\">RFC 4345</a></li>\n<li>RC5 - <a href=\"https://people.csail.mit.edu/rivest/Rivest-rc5rev.pdf\">https://people.csail.mit.edu/rivest/Rivest-rc5rev.pdf</a></li>\n<li>RIPEMD - <a href=\"https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2010118-3:2004\">ISO/IEC 10118-3</a></li>\n</ul>",
      "title": "Mac App Store Submission Guide",
      "description": ""
    },
    "/docs/tutorial/macos-dock": {
      "locale": "en-US",
      "slug": "macos-dock",
      "href": "/docs/tutorial/macos-dock",
      "crowdinFileId": "256217",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/macos-dock.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dock-macos\"><a href=\"#dock-macos\">Dock (macOS)</a></h1>\n<p>Electron has APIs to configure the app's icon in the macOS Dock. A macOS-only\nAPI exists to create a custom dock menu, but Electron also uses the app dock\nicon as the entry point for cross-platform features like\n<a href=\"/docs/tutorial/recent-documents\">recent documents</a> and <a href=\"/docs/tutorial/progress-bar\">application progress</a>.</p>\n<p>The custom dock is commonly used to add shortcuts to tasks the user wouldn't\nwant to open the whole app window for.</p>\n<p><strong>Dock menu of Terminal.app:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5069962/6032658a-6e9c-11e4-9953-aa84006bdfff.png\" alt=\"Dock Menu\"></p>\n<p>To set your custom dock menu, you need to use the\n<a href=\"/docs/api/dock#docksetmenumenu-macos\"><code>app.dock.setMenu</code></a> API,\nwhich is only available on macOS.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<p>Starting with a working application from the\n<a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the\nfollowing lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/macos-dock-menu\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\n<span class=\"hljs-keyword\">const</span> dockMenu = Menu.buildFromTemplate([\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Window'</span>,\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'New Window'</span>) }\n  }, {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Window with Settings'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Basic'</span> },\n      { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Pro'</span> }\n    ]\n  },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Command...'</span> }\n])\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">if</span> (process.platform === <span class=\"hljs-string\">'darwin'</span>) {\n    app.dock.setMenu(dockMenu)\n  }\n}).then(createWindow)\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n\n</code></pre>\n<p>After launching the Electron application, right click the application icon.\nYou should see the custom menu you just defined:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/macos-dock-menu.png\" alt=\"macOS dock menu\"></p>",
      "title": "Dock (macOS)",
      "description": ""
    },
    "/docs/api/structures/memory-info": {
      "locale": "en-US",
      "slug": "memory-info",
      "href": "/docs/api/structures/memory-info",
      "crowdinFileId": "256459",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/memory-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"memoryinfo-object\"><a href=\"#memoryinfo-object\">MemoryInfo Object</a></h1>\n<ul>\n<li><code>workingSetSize</code> Integer - The amount of memory currently pinned to actual physical RAM.</li>\n<li><code>peakWorkingSetSize</code> Integer - The maximum amount of memory that has ever been pinned\nto actual physical RAM.</li>\n<li><code>privateBytes</code> Integer (optional) <em>Windows</em> - The amount of memory not shared by other processes, such as\nJS heap or HTML content.</li>\n</ul>\n<p>Note that all statistics are reported in Kilobytes.</p>",
      "title": "MemoryInfo Object",
      "description": ""
    },
    "/docs/api/structures/memory-usage-details": {
      "locale": "en-US",
      "slug": "memory-usage-details",
      "href": "/docs/api/structures/memory-usage-details",
      "crowdinFileId": "256461",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/memory-usage-details.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"memoryusagedetails-object\"><a href=\"#memoryusagedetails-object\">MemoryUsageDetails Object</a></h1>\n<ul>\n<li><code>count</code> Number</li>\n<li><code>size</code> Number</li>\n<li><code>liveSize</code> Number</li>\n</ul>",
      "title": "MemoryUsageDetails Object",
      "description": ""
    },
    "/docs/api/menu": {
      "locale": "en-US",
      "slug": "menu",
      "href": "/docs/api/menu",
      "crowdinFileId": "256335",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/menu.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"menu\"><a href=\"#menu\">Menu</a></h1>\n<h2 id=\"class-menu\"><a href=\"#class-menu\">Class: Menu</a></h2>\n<blockquote>\n<p>Create native application menus and context menus.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h3 id=\"new-menu\"><a href=\"#new-menu\"><code>new Menu()</code></a></h3>\n<p>Creates a new menu.</p>\n<h3 id=\"static-methods\"><a href=\"#static-methods\">Static Methods</a></h3>\n<p>The <code>Menu</code> class has the following static methods:</p>\n<h4 id=\"menusetapplicationmenumenu\"><a href=\"#menusetapplicationmenumenu\"><code>Menu.setApplicationMenu(menu)</code></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Sets <code>menu</code> as the application menu on macOS. On Windows and Linux, the\n<code>menu</code> will be set as each window's top menu.</p>\n<p>Also on Windows and Linux, you can use a <code>&#x26;</code> in the top-level item name to\nindicate which letter should get a generated accelerator. For example, using\n<code>&#x26;File</code> for the file menu would result in a generated <code>Alt-F</code> accelerator that\nopens the associated menu. The indicated character in the button label then gets an\nunderline, and the <code>&#x26;</code> character is not displayed on the button label.</p>\n<p>In order to escape the <code>&#x26;</code> character in an item name, add a proceeding <code>&#x26;</code>. For example, <code>&#x26;&#x26;File</code> would result in <code>&#x26;File</code> displayed on the button label.</p>\n<p>Passing <code>null</code> will suppress the default menu. On Windows and Linux,\nthis has the additional effect of removing the menu bar from the window.</p>\n<p><strong>Note:</strong> The default menu will be created automatically if the app does not set one.\nIt contains standard items such as <code>File</code>, <code>Edit</code>, <code>View</code>, <code>Window</code> and <code>Help</code>.</p>\n<h4 id=\"menugetapplicationmenu\"><a href=\"#menugetapplicationmenu\"><code>Menu.getApplicationMenu()</code></a></h4>\n<p>Returns <code>Menu | null</code> - The application menu, if set, or <code>null</code>, if not set.</p>\n<p><strong>Note:</strong> The returned <code>Menu</code> instance doesn't support dynamic addition or\nremoval of menu items. <a href=\"#instance-properties\">Instance properties</a> can still\nbe dynamically modified.</p>\n<h4 id=\"menusendactiontofirstresponderaction-macos\"><a href=\"#menusendactiontofirstresponderaction-macos\"><code>Menu.sendActionToFirstResponder(action)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>action</code> String</li>\n</ul>\n<p>Sends the <code>action</code> to the first responder of application. This is used for\nemulating default macOS menu behaviors. Usually you would use the\n<a href=\"/docs/api/menu-item#roles\"><code>role</code></a> property of a <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>.</p>\n<p>See the <a href=\"https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW7\">macOS Cocoa Event Handling Guide</a>\nfor more information on macOS' native actions.</p>\n<h4 id=\"menubuildfromtemplatetemplate\"><a href=\"#menubuildfromtemplatetemplate\"><code>Menu.buildFromTemplate(template)</code></a></h4>\n<ul>\n<li><code>template</code> (MenuItemConstructorOptions | MenuItem)[]</li>\n</ul>\n<p>Returns <code>Menu</code></p>\n<p>Generally, the <code>template</code> is an array of <code>options</code> for constructing a\n<a href=\"/docs/api/menu-item\">MenuItem</a>. The usage can be referenced above.</p>\n<p>You can also attach other fields to the element of the <code>template</code> and they will become properties of the constructed menu items.</p>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<p>The <code>menu</code> object has the following instance methods:</p>\n<h4 id=\"menupopupoptions\"><a href=\"#menupopupoptions\"><code>menu.popup([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional) - Default is the focused window.</li>\n<li><code>x</code> Number (optional) - Default is the current mouse cursor position.\nMust be declared if <code>y</code> is declared.</li>\n<li><code>y</code> Number (optional) - Default is the current mouse cursor position.\nMust be declared if <code>x</code> is declared.</li>\n<li><code>positioningItem</code> Number (optional) <em>macOS</em> - The index of the menu item to\nbe positioned under the mouse cursor at the specified coordinates. Default\nis -1.</li>\n<li><code>callback</code> Function (optional) - Called when menu is closed.</li>\n</ul></li>\n</ul>\n<p>Pops up this menu as a context menu in the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<h4 id=\"menuclosepopupbrowserwindow\"><a href=\"#menuclosepopupbrowserwindow\"><code>menu.closePopup([browserWindow])</code></a></h4>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional) - Default is the focused window.</li>\n</ul>\n<p>Closes the context menu in the <code>browserWindow</code>.</p>\n<h4 id=\"menuappendmenuitem\"><a href=\"#menuappendmenuitem\"><code>menu.append(menuItem)</code></a></h4>\n<ul>\n<li><code>menuItem</code> <a href=\"/docs/api/menu-item\">MenuItem</a></li>\n</ul>\n<p>Appends the <code>menuItem</code> to the menu.</p>\n<h4 id=\"menugetmenuitembyidid\"><a href=\"#menugetmenuitembyidid\"><code>menu.getMenuItemById(id)</code></a></h4>\n<ul>\n<li><code>id</code> String</li>\n</ul>\n<p>Returns <code>MenuItem | null</code> the item with the specified <code>id</code></p>\n<h4 id=\"menuinsertpos-menuitem\"><a href=\"#menuinsertpos-menuitem\"><code>menu.insert(pos, menuItem)</code></a></h4>\n<ul>\n<li><code>pos</code> Integer</li>\n<li><code>menuItem</code> <a href=\"/docs/api/menu-item\">MenuItem</a></li>\n</ul>\n<p>Inserts the <code>menuItem</code> to the <code>pos</code> position of the menu.</p>\n<h3 id=\"instance-events\"><a href=\"#instance-events\">Instance Events</a></h3>\n<p>Objects created with <code>new Menu</code> or returned by <code>Menu.buildFromTemplate</code> emit the following events:</p>\n<p><strong>Note:</strong> Some events are only available on specific operating systems and are\nlabeled as such.</p>\n<h4 id=\"event-menu-will-show\"><a href=\"#event-menu-will-show\">Event: 'menu-will-show'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when <code>menu.popup()</code> is called.</p>\n<h4 id=\"event-menu-will-close\"><a href=\"#event-menu-will-close\">Event: 'menu-will-close'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when a popup is closed either manually or with <code>menu.closePopup()</code>.</p>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<p><code>menu</code> objects also have the following properties:</p>\n<h4 id=\"menuitems\"><a href=\"#menuitems\"><code>menu.items</code></a></h4>\n<p>A <code>MenuItem[]</code> array containing the menu's items.</p>\n<p>Each <code>Menu</code> consists of multiple <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>s and each <code>MenuItem</code>\ncan have a submenu.</p>\n<h2 id=\"examples\"><a href=\"#examples\">Examples</a></h2>\n<p>An example of creating the application menu with the simple template API:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> isMac = process.platform === <span class=\"hljs-string\">'darwin'</span>\n\n<span class=\"hljs-keyword\">const</span> template = [\n  <span class=\"hljs-comment\">// { role: 'appMenu' }</span>\n  ...(isMac ? [{\n    <span class=\"hljs-attr\">label</span>: app.name,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'about'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'services'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'hide'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'hideOthers'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'unhide'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'quit'</span> }\n    ]\n  }] : []),\n  <span class=\"hljs-comment\">// { role: 'fileMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'File'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      isMac ? { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'close'</span> } : { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'quit'</span> }\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'editMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Edit'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'undo'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'redo'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'cut'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'copy'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'paste'</span> },\n      ...(isMac ? [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'pasteAndMatchStyle'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'delete'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'selectAll'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        {\n          <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Speech'</span>,\n          <span class=\"hljs-attr\">submenu</span>: [\n            { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'startSpeaking'</span> },\n            { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'stopSpeaking'</span> }\n          ]\n        }\n      ] : [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'delete'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'selectAll'</span> }\n      ])\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'viewMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'View'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'reload'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'forceReload'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'toggleDevTools'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'resetZoom'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoomIn'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoomOut'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'togglefullscreen'</span> }\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'windowMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Window'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'minimize'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoom'</span> },\n      ...(isMac ? [\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'front'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'window'</span> }\n      ] : [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'close'</span> }\n      ])\n    ]\n  },\n  {\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'help'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      {\n        <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Learn More'</span>,\n        <span class=\"hljs-attr\">click</span>: <span class=\"hljs-keyword\">async</span> () => {\n          <span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n          <span class=\"hljs-keyword\">await</span> shell.openExternal(<span class=\"hljs-string\">'https://electronjs.org'</span>)\n        }\n      }\n    ]\n  }\n]\n\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\nMenu.setApplicationMenu(menu)\n</code></pre>\n<h3 id=\"render-process\"><a href=\"#render-process\">Render process</a></h3>\n<p>To create menus initiated by the renderer process, send the required\ninformation to the main process using IPC and have the main process display the\nmenu on behalf of the renderer.</p>\n<p>Below is an example of showing a menu when the user right clicks the page:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer</span>\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'contextmenu'</span>, (e) => {\n  e.preventDefault()\n  ipcRenderer.send(<span class=\"hljs-string\">'show-context-menu'</span>)\n})\n\nipcRenderer.on(<span class=\"hljs-string\">'context-menu-command'</span>, (e, command) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// main</span>\nipcMain.on(<span class=\"hljs-string\">'show-context-menu'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> template = [\n    {\n      <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Menu Item 1'</span>,\n      <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { event.sender.send(<span class=\"hljs-string\">'context-menu-command'</span>, <span class=\"hljs-string\">'menu-item-1'</span>) }\n    },\n    { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Menu Item 2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'checkbox'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> }\n  ]\n  <span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\n  menu.popup(BrowserWindow.fromWebContents(event.sender))\n})\n</code></pre>\n<h2 id=\"notes-on-macos-application-menu\"><a href=\"#notes-on-macos-application-menu\">Notes on macOS Application Menu</a></h2>\n<p>macOS has a completely different style of application menu from Windows and\nLinux. Here are some notes on making your app's menu more native-like.</p>\n<h3 id=\"standard-menus\"><a href=\"#standard-menus\">Standard Menus</a></h3>\n<p>On macOS there are many system-defined standard menus, like the <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc\"><code>Services</code></a> and\n<code>Windows</code> menus. To make your menu a standard menu, you should set your menu's\n<code>role</code> to one of the following and Electron will recognize them and make them\nbecome standard menus:</p>\n<ul>\n<li><code>window</code></li>\n<li><code>help</code></li>\n<li><code>services</code></li>\n</ul>\n<h3 id=\"standard-menu-item-actions\"><a href=\"#standard-menu-item-actions\">Standard Menu Item Actions</a></h3>\n<p>macOS has provided standard actions for some menu items, like <code>About xxx</code>,\n<code>Hide xxx</code>, and <code>Hide Others</code>. To set the action of a menu item to a standard\naction, you should set the <code>role</code> attribute of the menu item.</p>\n<h3 id=\"main-menus-name\"><a href=\"#main-menus-name\">Main Menu's Name</a></h3>\n<p>On macOS the label of the application menu's first item is always your app's\nname, no matter what label you set. To change it, modify your app bundle's\n<code>Info.plist</code> file. See\n<a href=\"https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html\">About Information Property List Files</a>\nfor more information.</p>\n<h2 id=\"setting-menu-for-specific-browser-window-linux-windows\"><a href=\"#setting-menu-for-specific-browser-window-linux-windows\">Setting Menu for Specific Browser Window (<em>Linux</em> <em>Windows</em>)</a></h2>\n<p>The <a href=\"/docs/api/browser-window#winsetmenumenu-linux-windows\"><code>setMenu</code> method</a> of browser windows can set the menu of certain\nbrowser windows.</p>\n<h2 id=\"menu-item-position\"><a href=\"#menu-item-position\">Menu Item Position</a></h2>\n<p>You can make use of <code>before</code>, <code>after</code>, <code>beforeGroupContaining</code>, <code>afterGroupContaining</code> and <code>id</code> to control how the item will be placed when building a menu with <code>Menu.buildFromTemplate</code>.</p>\n<ul>\n<li><code>before</code> - Inserts this item before the item with the specified label. If the\nreferenced item doesn't exist the item will be inserted at the end of\nthe menu. Also implies that the menu item in question should be placed in the same “group” as the item.</li>\n<li><code>after</code> - Inserts this item after the item with the specified label. If the\nreferenced item doesn't exist the item will be inserted at the end of\nthe menu. Also implies that the menu item in question should be placed in the same “group” as the item.</li>\n<li><code>beforeGroupContaining</code> - Provides a means for a single context menu to declare\nthe placement of their containing group before the containing group of the item with the specified label.</li>\n<li><code>afterGroupContaining</code> - Provides a means for a single context menu to declare\nthe placement of their containing group after the containing group of the item with the specified label.</li>\n</ul>\n<p>By default, items will be inserted in the order they exist in the template unless one of the specified positioning keywords is used.</p>\n<h3 id=\"examples-1\"><a href=\"#examples-1\">Examples</a></h3>\n<p>Template:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'4'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'four'</span> }\n]\n</code></pre>\n<p>Menu:</p>\n<pre><code class=\"hljs language-sh\">- 1\n- 2\n- 3\n- 4\n</code></pre>\n<p>Template:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span> },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span>, <span class=\"hljs-attr\">beforeGroupContaining</span>: [<span class=\"hljs-string\">'1'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'4'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'four'</span>, <span class=\"hljs-attr\">afterGroupContaining</span>: [<span class=\"hljs-string\">'2'</span>] },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span> }\n]\n</code></pre>\n<p>Menu:</p>\n<pre><code class=\"hljs language-sh\">- 3\n- 4\n- ---\n- 1\n- ---\n- 2\n</code></pre>\n<p>Template:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span>, <span class=\"hljs-attr\">after</span>: [<span class=\"hljs-string\">'3'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span>, <span class=\"hljs-attr\">before</span>: [<span class=\"hljs-string\">'1'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span> }\n]\n</code></pre>\n<p>Menu:</p>\n<pre><code class=\"hljs language-sh\">- ---\n- 3\n- 2\n- 1\n</code></pre>",
      "title": "Menu",
      "description": "Create native application menus and context menus."
    },
    "/docs/api/menu-item": {
      "locale": "en-US",
      "slug": "menu-item",
      "href": "/docs/api/menu-item",
      "crowdinFileId": "256333",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/menu-item.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-menuitem\"><a href=\"#class-menuitem\">Class: MenuItem</a></h2>\n<blockquote>\n<p>Add items to native application menus and context menus.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>See <a href=\"/docs/api/menu\"><code>Menu</code></a> for examples.</p>\n<h3 id=\"new-menuitemoptions\"><a href=\"#new-menuitemoptions\"><code>new MenuItem(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>click</code> Function (optional) - Will be called with\n<code>click(menuItem, browserWindow, event)</code> when the menu item is clicked.<ul>\n<li><code>menuItem</code> MenuItem</li>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | undefined - This will not be defined if no window is open.</li>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n</ul></li>\n<li><code>role</code> String (optional) - Can be <code>undo</code>, <code>redo</code>, <code>cut</code>, <code>copy</code>, <code>paste</code>, <code>pasteAndMatchStyle</code>, <code>delete</code>, <code>selectAll</code>, <code>reload</code>, <code>forceReload</code>, <code>toggleDevTools</code>, <code>resetZoom</code>, <code>zoomIn</code>, <code>zoomOut</code>, <code>toggleSpellChecker</code>, <code>togglefullscreen</code>, <code>window</code>, <code>minimize</code>, <code>close</code>, <code>help</code>, <code>about</code>, <code>services</code>, <code>hide</code>, <code>hideOthers</code>, <code>unhide</code>, <code>quit</code>, <code>startSpeaking</code>, <code>stopSpeaking</code>, <code>zoom</code>, <code>front</code>, <code>appMenu</code>, <code>fileMenu</code>, <code>editMenu</code>, <code>viewMenu</code>, <code>shareMenu</code>, <code>recentDocuments</code>, <code>toggleTabBar</code>, <code>selectNextTab</code>, <code>selectPreviousTab</code>, <code>mergeAllWindows</code>, <code>clearRecentDocuments</code>, <code>moveTabToNewWindow</code> or <code>windowMenu</code> - Define the action of the menu item, when specified the\n<code>click</code> property will be ignored. See <a href=\"#roles\">roles</a>.</li>\n<li><code>type</code> String (optional) - Can be <code>normal</code>, <code>separator</code>, <code>submenu</code>, <code>checkbox</code> or\n<code>radio</code>.</li>\n<li><code>label</code> String (optional)</li>\n<li><code>sublabel</code> String (optional)</li>\n<li><code>toolTip</code> String (optional) <em>macOS</em> - Hover text for this menu item.</li>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a> (optional)</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (optional)</li>\n<li><code>enabled</code> Boolean (optional) - If false, the menu item will be greyed out and\nunclickable.</li>\n<li><code>acceleratorWorksWhenHidden</code> Boolean (optional) <em>macOS</em> - default is <code>true</code>, and when <code>false</code> will prevent the accelerator from triggering the item if the item is not visible`.</li>\n<li><code>visible</code> Boolean (optional) - If false, the menu item will be entirely hidden.</li>\n<li><code>checked</code> Boolean (optional) - Should only be specified for <code>checkbox</code> or <code>radio</code> type\nmenu items.</li>\n<li><code>registerAccelerator</code> Boolean (optional) <em>Linux</em> <em>Windows</em> - If false, the accelerator won't be registered\nwith the system, but it will still be displayed. Defaults to true.</li>\n<li><code>sharingItem</code> SharingItem (optional) <em>macOS</em> - The item to share when the <code>role</code> is <code>shareMenu</code>.</li>\n<li><code>submenu</code> (MenuItemConstructorOptions[] | <a href=\"/docs/api/menu\">Menu</a>) (optional) - Should be specified\nfor <code>submenu</code> type menu items. If <code>submenu</code> is specified, the <code>type: 'submenu'</code> can be omitted.\nIf the value is not a <a href=\"/docs/api/menu\"><code>Menu</code></a> then it will be automatically converted to one using\n<code>Menu.buildFromTemplate</code>.</li>\n<li><code>id</code> String (optional) - Unique within a single menu. If defined then it can be used\nas a reference to this item by the position attribute.</li>\n<li><code>before</code> String<a href=\"/docs/api/optional\"></a> - Inserts this item before the item with the specified label. If\nthe referenced item doesn't exist the item will be inserted at the end of  the menu. Also implies\nthat the menu item in question should be placed in the same “group” as the item.</li>\n<li><code>after</code> String<a href=\"/docs/api/optional\"></a> - Inserts this item after the item with the specified label. If the\nreferenced item doesn't exist the item will be inserted at the end of\nthe menu.</li>\n<li><code>beforeGroupContaining</code> String<a href=\"/docs/api/optional\"></a> - Provides a means for a single context menu to declare\nthe placement of their containing group before the containing group of the item\nwith the specified label.</li>\n<li><code>afterGroupContaining</code> String<a href=\"/docs/api/optional\"></a> - Provides a means for a single context menu to declare\nthe placement of their containing group after the containing group of the item\nwith the specified label.</li>\n</ul></li>\n</ul>\n<p><strong>Note:</strong> <code>acceleratorWorksWhenHidden</code> is specified as being macOS-only because accelerators always work when items are hidden on Windows and Linux. The option is exposed to users to give them the option to turn it off, as this is possible in native macOS development. This property is only usable on macOS High Sierra 10.13 or newer.</p>\n<h3 id=\"roles\"><a href=\"#roles\">Roles</a></h3>\n<p>Roles allow menu items to have predefined behaviors.</p>\n<p>It is best to specify <code>role</code> for any menu item that matches a standard role,\nrather than trying to manually implement the behavior in a <code>click</code> function.\nThe built-in <code>role</code> behavior will give the best native experience.</p>\n<p>The <code>label</code> and <code>accelerator</code> values are optional when using a <code>role</code> and will\ndefault to appropriate values for each platform.</p>\n<p>Every menu item must have either a <code>role</code>, <code>label</code>, or in the case of a separator\na <code>type</code>.</p>\n<p>The <code>role</code> property can have following values:</p>\n<ul>\n<li><code>undo</code></li>\n<li><code>about</code> - Trigger a native about panel (custom message box on Window, which does not provide its own).</li>\n<li><code>redo</code></li>\n<li><code>cut</code></li>\n<li><code>copy</code></li>\n<li><code>paste</code></li>\n<li><code>pasteAndMatchStyle</code></li>\n<li><code>selectAll</code></li>\n<li><code>delete</code></li>\n<li><code>minimize</code> - Minimize current window.</li>\n<li><code>close</code> - Close current window.</li>\n<li><code>quit</code> - Quit the application.</li>\n<li><code>reload</code> - Reload the current window.</li>\n<li><code>forceReload</code> - Reload the current window ignoring the cache.</li>\n<li><code>toggleDevTools</code> - Toggle developer tools in the current window.</li>\n<li><code>togglefullscreen</code> - Toggle full screen mode on the current window.</li>\n<li><code>resetZoom</code> - Reset the focused page's zoom level to the original size.</li>\n<li><code>zoomIn</code> - Zoom in the focused page by 10%.</li>\n<li><code>zoomOut</code> - Zoom out the focused page by 10%.</li>\n<li><code>toggleSpellChecker</code> - Enable/disable builtin spell checker.</li>\n<li><code>fileMenu</code> - Whole default \"File\" menu (Close / Quit)</li>\n<li><code>editMenu</code> - Whole default \"Edit\" menu (Undo, Copy, etc.).</li>\n<li><code>viewMenu</code> - Whole default \"View\" menu (Reload, Toggle Developer Tools, etc.)</li>\n<li><code>windowMenu</code> - Whole default \"Window\" menu (Minimize, Zoom, etc.).</li>\n</ul>\n<p>The following additional roles are available on <em>macOS</em>:</p>\n<ul>\n<li><code>appMenu</code> - Whole default \"App\" menu (About, Services, etc.)</li>\n<li><code>hide</code> - Map to the <code>hide</code> action.</li>\n<li><code>hideOthers</code> - Map to the <code>hideOtherApplications</code> action.</li>\n<li><code>unhide</code> - Map to the <code>unhideAllApplications</code> action.</li>\n<li><code>startSpeaking</code> - Map to the <code>startSpeaking</code> action.</li>\n<li><code>stopSpeaking</code> - Map to the <code>stopSpeaking</code> action.</li>\n<li><code>front</code> - Map to the <code>arrangeInFront</code> action.</li>\n<li><code>zoom</code> - Map to the <code>performZoom</code> action.</li>\n<li><code>toggleTabBar</code> - Map to the <code>toggleTabBar</code> action.</li>\n<li><code>selectNextTab</code> - Map to the <code>selectNextTab</code> action.</li>\n<li><code>selectPreviousTab</code> - Map to the <code>selectPreviousTab</code> action.</li>\n<li><code>mergeAllWindows</code> - Map to the <code>mergeAllWindows</code> action.</li>\n<li><code>moveTabToNewWindow</code> - Map to the <code>moveTabToNewWindow</code> action.</li>\n<li><code>window</code> - The submenu is a \"Window\" menu.</li>\n<li><code>help</code> - The submenu is a \"Help\" menu.</li>\n<li><code>services</code> - The submenu is a <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc\">\"Services\"</a> menu. This is only intended for use in the Application Menu and is <em>not</em> the same as the \"Services\" submenu used in context menus in macOS apps, which is not implemented in Electron.</li>\n<li><code>recentDocuments</code> - The submenu is an \"Open Recent\" menu.</li>\n<li><code>clearRecentDocuments</code> - Map to the <code>clearRecentDocuments</code> action.</li>\n<li><code>shareMenu</code> - The submenu is <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/\">share menu</a>. The <code>sharingItem</code> property must also be set to indicate the item to share.</li>\n</ul>\n<p>When specifying a <code>role</code> on macOS, <code>label</code> and <code>accelerator</code> are the only\noptions that will affect the menu item. All other options will be ignored.\nLowercase <code>role</code>, e.g. <code>toggledevtools</code>, is still supported.</p>\n<p><strong>Nota Bene:</strong> The <code>enabled</code> and <code>visibility</code> properties are not available for top-level menu items in the tray on macOS.</p>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<p>The following properties are available on instances of <code>MenuItem</code>:</p>\n<h4 id=\"menuitemid\"><a href=\"#menuitemid\"><code>menuItem.id</code></a></h4>\n<p>A <code>String</code> indicating the item's unique id, this property can be\ndynamically changed.</p>\n<h4 id=\"menuitemlabel\"><a href=\"#menuitemlabel\"><code>menuItem.label</code></a></h4>\n<p>A <code>String</code> indicating the item's visible label.</p>\n<h4 id=\"menuitemclick\"><a href=\"#menuitemclick\"><code>menuItem.click</code></a></h4>\n<p>A <code>Function</code> that is fired when the MenuItem receives a click event.\nIt can be called with <code>menuItem.click(event, focusedWindow, focusedWebContents)</code>.</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>focusedWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n<li><code>focusedWebContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<h4 id=\"menuitemsubmenu\"><a href=\"#menuitemsubmenu\"><code>menuItem.submenu</code></a></h4>\n<p>A <code>Menu</code> (optional) containing the menu\nitem's submenu, if present.</p>\n<h4 id=\"menuitemtype\"><a href=\"#menuitemtype\"><code>menuItem.type</code></a></h4>\n<p>A <code>String</code> indicating the type of the item. Can be <code>normal</code>, <code>separator</code>, <code>submenu</code>, <code>checkbox</code> or <code>radio</code>.</p>\n<h4 id=\"menuitemrole\"><a href=\"#menuitemrole\"><code>menuItem.role</code></a></h4>\n<p>A <code>String</code> (optional) indicating the item's role, if set. Can be <code>undo</code>, <code>redo</code>, <code>cut</code>, <code>copy</code>, <code>paste</code>, <code>pasteAndMatchStyle</code>, <code>delete</code>, <code>selectAll</code>, <code>reload</code>, <code>forceReload</code>, <code>toggleDevTools</code>, <code>resetZoom</code>, <code>zoomIn</code>, <code>zoomOut</code>, <code>toggleSpellChecker</code>, <code>togglefullscreen</code>, <code>window</code>, <code>minimize</code>, <code>close</code>, <code>help</code>, <code>about</code>, <code>services</code>, <code>hide</code>, <code>hideOthers</code>, <code>unhide</code>, <code>quit</code>, <code>startSpeaking</code>, <code>stopSpeaking</code>, <code>zoom</code>, <code>front</code>, <code>appMenu</code>, <code>fileMenu</code>, <code>editMenu</code>, <code>viewMenu</code>, <code>shareMenu</code>, <code>recentDocuments</code>, <code>toggleTabBar</code>, <code>selectNextTab</code>, <code>selectPreviousTab</code>, <code>mergeAllWindows</code>, <code>clearRecentDocuments</code>, <code>moveTabToNewWindow</code> or <code>windowMenu</code></p>\n<h4 id=\"menuitemaccelerator\"><a href=\"#menuitemaccelerator\"><code>menuItem.accelerator</code></a></h4>\n<p>An <code>Accelerator</code> (optional) indicating the item's accelerator, if set.</p>\n<h4 id=\"menuitemuseraccelerator-readonly-macos\"><a href=\"#menuitemuseraccelerator-readonly-macos\"><code>menuItem.userAccelerator</code> <em>Readonly</em> <em>macOS</em></a></h4>\n<p>An <code>Accelerator | null</code> indicating the item's <a href=\"https://developer.apple.com/documentation/appkit/nsmenuitem/1514850-userkeyequivalent?language=objc\">user-assigned accelerator</a> for the menu item.</p>\n<p><strong>Note:</strong> This property is only initialized after the <code>MenuItem</code> has been added to a <code>Menu</code>. Either via <code>Menu.buildFromTemplate</code> or via <code>Menu.append()/insert()</code>.  Accessing before initialization will just return <code>null</code>.</p>\n<h4 id=\"menuitemicon\"><a href=\"#menuitemicon\"><code>menuItem.icon</code></a></h4>\n<p>A <code>NativeImage | String</code> (optional) indicating the\nitem's icon, if set.</p>\n<h4 id=\"menuitemsublabel\"><a href=\"#menuitemsublabel\"><code>menuItem.sublabel</code></a></h4>\n<p>A <code>String</code> indicating the item's sublabel.</p>\n<h4 id=\"menuitemtooltip-macos\"><a href=\"#menuitemtooltip-macos\"><code>menuItem.toolTip</code> <em>macOS</em></a></h4>\n<p>A <code>String</code> indicating the item's hover text.</p>\n<h4 id=\"menuitemenabled\"><a href=\"#menuitemenabled\"><code>menuItem.enabled</code></a></h4>\n<p>A <code>Boolean</code> indicating whether the item is enabled, this property can be\ndynamically changed.</p>\n<h4 id=\"menuitemvisible\"><a href=\"#menuitemvisible\"><code>menuItem.visible</code></a></h4>\n<p>A <code>Boolean</code> indicating whether the item is visible, this property can be\ndynamically changed.</p>\n<h4 id=\"menuitemchecked\"><a href=\"#menuitemchecked\"><code>menuItem.checked</code></a></h4>\n<p>A <code>Boolean</code> indicating whether the item is checked, this property can be\ndynamically changed.</p>\n<p>A <code>checkbox</code> menu item will toggle the <code>checked</code> property on and off when\nselected.</p>\n<p>A <code>radio</code> menu item will turn on its <code>checked</code> property when clicked, and\nwill turn off that property for all adjacent items in the same menu.</p>\n<p>You can add a <code>click</code> function for additional behavior.</p>\n<h4 id=\"menuitemregisteraccelerator\"><a href=\"#menuitemregisteraccelerator\"><code>menuItem.registerAccelerator</code></a></h4>\n<p>A <code>Boolean</code> indicating if the accelerator should be registered with the\nsystem or just displayed.</p>\n<p>This property can be dynamically changed.</p>\n<h4 id=\"menuitemsharingitem-macos\"><a href=\"#menuitemsharingitem-macos\"><code>menuItem.sharingItem</code> <em>macOS</em></a></h4>\n<p>A <code>SharingItem</code> indicating the item to share when the <code>role</code> is <code>shareMenu</code>.</p>\n<p>This property can be dynamically changed.</p>\n<h4 id=\"menuitemcommandid\"><a href=\"#menuitemcommandid\"><code>menuItem.commandId</code></a></h4>\n<p>A <code>Number</code> indicating an item's sequential unique id.</p>\n<h4 id=\"menuitemmenu\"><a href=\"#menuitemmenu\"><code>menuItem.menu</code></a></h4>\n<p>A <code>Menu</code> that the item is a part of.</p>",
      "title": "MenuItem",
      "description": "Add items to native application menus and context menus."
    },
    "/docs/api/message-channel-main": {
      "locale": "en-US",
      "slug": "message-channel-main",
      "href": "/docs/api/message-channel-main",
      "crowdinFileId": "256337",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/message-channel-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messagechannelmain\"><a href=\"#messagechannelmain\">MessageChannelMain</a></h1>\n<p><code>MessageChannelMain</code> is the main-process-side equivalent of the DOM\n<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\"><code>MessageChannel</code></a> object. Its singular function is to create a pair of\nconnected <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> objects.</p>\n<p>See the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> documentation for more information on using\nchannel messaging.</p>\n<h2 id=\"class-messagechannelmain\"><a href=\"#class-messagechannelmain\">Class: MessageChannelMain</a></h2>\n<blockquote>\n<p>Channel interface for channel messaging in the main process.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>Example:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nw.webContents.postMessage(<span class=\"hljs-string\">'port'</span>, <span class=\"hljs-literal\">null</span>, [port2])\nport1.postMessage({ <span class=\"hljs-attr\">some</span>: <span class=\"hljs-string\">'message'</span> })\n\n<span class=\"hljs-comment\">// Renderer process</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e) => {\n  <span class=\"hljs-comment\">// e.ports is a list of ports sent along with this message</span>\n  e.ports[<span class=\"hljs-number\">0</span>].on(<span class=\"hljs-string\">'message'</span>, (messageEvent) => {\n    <span class=\"hljs-built_in\">console</span>.log(messageEvent.data)\n  })\n})\n</code></pre>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<h4 id=\"channelport1\"><a href=\"#channelport1\"><code>channel.port1</code></a></h4>\n<p>A <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> property.</p>\n<h4 id=\"channelport2\"><a href=\"#channelport2\"><code>channel.port2</code></a></h4>\n<p>A <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> property.</p>",
      "title": "MessageChannelMain",
      "description": "Channel interface for channel messaging in the main process."
    },
    "/docs/api/message-port-main": {
      "locale": "en-US",
      "slug": "message-port-main",
      "href": "/docs/api/message-port-main",
      "crowdinFileId": "256339",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/message-port-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messageportmain\"><a href=\"#messageportmain\">MessagePortMain</a></h1>\n<p><code>MessagePortMain</code> is the main-process-side equivalent of the DOM\n<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> object. It behaves similarly to the DOM version, with the\nexception that it uses the Node.js <code>EventEmitter</code> event system, instead of the\nDOM <code>EventTarget</code> system. This means you should use <code>port.on('message', ...)</code>\nto listen for events, instead of <code>port.onmessage = ...</code> or\n<code>port.addEventListener('message', ...)</code></p>\n<p>See the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> documentation for more information on using\nchannel messaging.</p>\n<p><code>MessagePortMain</code> is an [EventEmitter][event-emitter].</p>\n<h2 id=\"class-messageportmain\"><a href=\"#class-messageportmain\">Class: MessagePortMain</a></h2>\n<blockquote>\n<p>Port interface for channel messaging in the main process.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<h4 id=\"portpostmessagemessage-transfer\"><a href=\"#portpostmessagemessage-transfer\"><code>port.postMessage(message, [transfer])</code></a></h4>\n<ul>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Sends a message from the port, and optionally, transfers ownership of objects\nto other browsing contexts.</p>\n<h4 id=\"portstart\"><a href=\"#portstart\"><code>port.start()</code></a></h4>\n<p>Starts the sending of messages queued on the port. Messages will be queued\nuntil this method is called.</p>\n<h4 id=\"portclose\"><a href=\"#portclose\"><code>port.close()</code></a></h4>\n<p>Disconnects the port, so it is no longer active.</p>\n<h3 id=\"instance-events\"><a href=\"#instance-events\">Instance Events</a></h3>\n<h4 id=\"event-message\"><a href=\"#event-message\">Event: 'message'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>messageEvent</code> Object<ul>\n<li><code>data</code> any</li>\n<li><code>ports</code> MessagePortMain[]</li>\n</ul></li>\n</ul>\n<p>Emitted when a MessagePortMain object receives a message.</p>\n<h4 id=\"event-close\"><a href=\"#event-close\">Event: 'close'</a></h4>\n<p>Emitted when the remote end of a MessagePortMain object becomes disconnected.</p>",
      "title": "MessagePortMain",
      "description": "Port interface for channel messaging in the main process."
    },
    "/docs/tutorial/message-ports": {
      "locale": "en-US",
      "slug": "message-ports",
      "href": "/docs/tutorial/message-ports",
      "crowdinFileId": "256219",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/message-ports.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messageports-in-electron\"><a href=\"#messageports-in-electron\">MessagePorts in Electron</a></h1>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a>s are a web feature that allow passing messages between\ndifferent contexts. It's like <code>window.postMessage</code>, but on different channels.\nThe goal of this document is to describe how Electron extends the Channel\nMessaging model, and to give some examples of how you might use MessagePorts in\nyour app.</p>\n<p>Here is a very brief example of what a MessagePort is and how it works:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer.js ///////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-comment\">// MessagePorts are created in pairs. A connected pair of message ports is</span>\n<span class=\"hljs-comment\">// called a channel.</span>\n<span class=\"hljs-keyword\">const</span> channel = <span class=\"hljs-keyword\">new</span> MessageChannel()\n\n<span class=\"hljs-comment\">// The only difference between port1 and port2 is in how you use them. Messages</span>\n<span class=\"hljs-comment\">// sent to port1 will be received by port2 and vice-versa.</span>\n<span class=\"hljs-keyword\">const</span> port1 = channel.port1\n<span class=\"hljs-keyword\">const</span> port2 = channel.port2\n\n<span class=\"hljs-comment\">// It's OK to send a message on the channel before the other end has registered</span>\n<span class=\"hljs-comment\">// a listener. Messages will be queued until a listener is registered.</span>\nport2.postMessage({ <span class=\"hljs-attr\">answer</span>: <span class=\"hljs-number\">42</span> })\n\n<span class=\"hljs-comment\">// Here we send the other end of the channel, port1, to the main process. It's</span>\n<span class=\"hljs-comment\">// also possible to send MessagePorts to other frames, or to Web Workers, etc.</span>\nipcRenderer.postMessage(<span class=\"hljs-string\">'port'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-comment\">// In the main process, we receive the port.</span>\nipcMain.on(<span class=\"hljs-string\">'port'</span>, (event) => {\n  <span class=\"hljs-comment\">// When we receive a MessagePort in the main process, it becomes a</span>\n  <span class=\"hljs-comment\">// MessagePortMain.</span>\n  <span class=\"hljs-keyword\">const</span> port = event.ports[<span class=\"hljs-number\">0</span>]\n\n  <span class=\"hljs-comment\">// MessagePortMain uses the Node.js-style events API, rather than the</span>\n  <span class=\"hljs-comment\">// web-style events API. So .on('message', ...) instead of .onmessage = ...</span>\n  port.on(<span class=\"hljs-string\">'message'</span>, (event) => {\n    <span class=\"hljs-comment\">// data is { answer: 42 }</span>\n    <span class=\"hljs-keyword\">const</span> data = event.data\n  })\n\n  <span class=\"hljs-comment\">// MessagePortMain queues messages until the .start() method has been called.</span>\n  port.start()\n})\n</code></pre>\n<p>The <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> documentation is a great way to learn more about\nhow MessagePorts work.</p>\n<h2 id=\"messageports-in-the-main-process\"><a href=\"#messageports-in-the-main-process\">MessagePorts in the main process</a></h2>\n<p>In the renderer, the <code>MessagePort</code> class behaves exactly as it does on the web.\nThe main process is not a web page, though—it has no Blink integration—and so\nit does not have the <code>MessagePort</code> or <code>MessageChannel</code> classes. In order to\nhandle and interact with MessagePorts in the main process, Electron adds two\nnew classes: <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> and <a href=\"/docs/api/message-channel-main\"><code>MessageChannelMain</code></a>. These behave\nsimilarly to the analogous classes in the renderer.</p>\n<p><code>MessagePort</code> objects can be created in either the renderer or the main\nprocess, and passed back and forth using the <a href=\"/docs/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a> and\n<a href=\"/docs/api/web-contents#contentspostmessagechannel-message-transfer\"><code>WebContents.postMessage</code></a> methods. Note that the usual IPC methods like\n<code>send</code> and <code>invoke</code> cannot be used to transfer <code>MessagePort</code>s, only the\n<code>postMessage</code> methods can transfer <code>MessagePort</code>s.</p>\n<p>By passing <code>MessagePort</code>s via the main process, you can connect two pages that\nmight not otherwise be able to communicate (e.g. due to same-origin\nrestrictions).</p>\n<h2 id=\"extension-close-event\"><a href=\"#extension-close-event\">Extension: <code>close</code> event</a></h2>\n<p>Electron adds one feature to <code>MessagePort</code> that isn't present on the web, in\norder to make MessagePorts more useful. That is the <code>close</code> event, which is\nemitted when the other end of the channel is closed. Ports can also be\nimplicitly closed by being garbage-collected.</p>\n<p>In the renderer, you can listen for the <code>close</code> event either by assigning to\n<code>port.onclose</code> or by calling <code>port.addEventListener('close', ...)</code>. In the main\nprocess, you can listen for the <code>close</code> event by calling <code>port.on('close', ...)</code>.</p>\n<h2 id=\"example-use-cases\"><a href=\"#example-use-cases\">Example use cases</a></h2>\n<h3 id=\"worker-process\"><a href=\"#worker-process\">Worker process</a></h3>\n<p>In this example, your app has a worker process implemented as a hidden window.\nYou want the app page to be able to communicate directly with the worker\nprocess, without the performance overhead of relaying via the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow, app, ipcMain, MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-comment\">// The worker process is a hidden BrowserWindow, so that it will have access</span>\n  <span class=\"hljs-comment\">// to a full Blink context (including e.g. &#x3C;canvas>, audio, fetch(), etc.)</span>\n  <span class=\"hljs-keyword\">const</span> worker = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span> }\n  })\n  <span class=\"hljs-keyword\">await</span> worker.loadFile(<span class=\"hljs-string\">'worker.html'</span>)\n\n  <span class=\"hljs-comment\">// The main window will send work to the worker process and receive results</span>\n  <span class=\"hljs-comment\">// over a MessagePort.</span>\n  <span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span> }\n  })\n  mainWindow.loadFile(<span class=\"hljs-string\">'app.html'</span>)\n\n  <span class=\"hljs-comment\">// We can't use ipcMain.handle() here, because the reply needs to transfer a</span>\n  <span class=\"hljs-comment\">// MessagePort.</span>\n  ipcMain.on(<span class=\"hljs-string\">'request-worker-channel'</span>, (event) => {\n    <span class=\"hljs-comment\">// For security reasons, let's make sure only the frames we expect can</span>\n    <span class=\"hljs-comment\">// access the worker.</span>\n    <span class=\"hljs-keyword\">if</span> (event.senderFrame === mainWindow.webContents.mainFrame) {\n      <span class=\"hljs-comment\">// Create a new channel ...</span>\n      <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\n      <span class=\"hljs-comment\">// ... send one end to the worker ...</span>\n      worker.webContents.postMessage(<span class=\"hljs-string\">'new-client'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n      <span class=\"hljs-comment\">// ... and the other end to the main window.</span>\n      event.senderFrame.postMessage(<span class=\"hljs-string\">'provide-worker-channel'</span>, <span class=\"hljs-literal\">null</span>, [port2])\n      <span class=\"hljs-comment\">// Now the main window and the worker can communicate with each other</span>\n      <span class=\"hljs-comment\">// without going through the main process!</span>\n    }\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- worker.html ------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">doWork</span>(<span class=\"hljs-params\">input</span>) </span>{\n  <span class=\"hljs-comment\">// Something cpu-intensive.</span>\n  <span class=\"hljs-keyword\">return</span> input * <span class=\"hljs-number\">2</span>\n}\n\n<span class=\"hljs-comment\">// We might get multiple clients, for instance if there are multiple windows,</span>\n<span class=\"hljs-comment\">// or if the main window reloads.</span>\nipcRenderer.on(<span class=\"hljs-string\">'new-client'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n  port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    <span class=\"hljs-comment\">// The event data can be any serializable object (and the event could even</span>\n    <span class=\"hljs-comment\">// carry other MessagePorts with it!)</span>\n    <span class=\"hljs-keyword\">const</span> result = doWork(event.data)\n    port.postMessage(result)\n  }\n})\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- app.html ---------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// We request that the main process sends us a channel we can use to</span>\n<span class=\"hljs-comment\">// communicate with the worker.</span>\nipcRenderer.send(<span class=\"hljs-string\">'request-worker-channel'</span>)\n\nipcRenderer.once(<span class=\"hljs-string\">'provide-worker-channel'</span>, (event) => {\n  <span class=\"hljs-comment\">// Once we receive the reply, we can take the port...</span>\n  <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n  <span class=\"hljs-comment\">// ... register a handler to receive results ...</span>\n  port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'received result:'</span>, event.data)\n  }\n  <span class=\"hljs-comment\">// ... and start sending it work!</span>\n  port.postMessage(<span class=\"hljs-number\">21</span>)\n})\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h3 id=\"reply-streams\"><a href=\"#reply-streams\">Reply streams</a></h3>\n<p>Electron's built-in IPC methods only support two modes: fire-and-forget\n(e.g. <code>send</code>), or request-response (e.g. <code>invoke</code>). Using MessageChannels, you\ncan implement a \"response stream\", where a single request responds with a\nstream of data.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer.js ///////////////////////////////////////////////////////////////</span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">makeStreamingRequest</span> (<span class=\"hljs-params\">element, callback</span>) </span>{\n  <span class=\"hljs-comment\">// MessageChannels are lightweight--it's cheap to create a new one for each</span>\n  <span class=\"hljs-comment\">// request.</span>\n  <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannel()\n\n  <span class=\"hljs-comment\">// We send one end of the port to the main process ...</span>\n  ipcRenderer.postMessage(\n    <span class=\"hljs-string\">'give-me-a-stream'</span>,\n    { element, <span class=\"hljs-attr\">count</span>: <span class=\"hljs-number\">10</span> },\n    [port2]\n  )\n\n  <span class=\"hljs-comment\">// ... and we hang on to the other end. The main process will send messages</span>\n  <span class=\"hljs-comment\">// to its end of the port, and close it when it's finished.</span>\n  port1.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    callback(event.data)\n  }\n  port1.onclose = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'stream ended'</span>)\n  }\n}\n\nmakeStreamingRequest(<span class=\"hljs-number\">42</span>, (data) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'got response data:'</span>, event.data)\n})\n<span class=\"hljs-comment\">// We will see \"got response data: 42\" 10 times.</span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n\nipcMain.on(<span class=\"hljs-string\">'give-me-a-stream'</span>, (event, msg) => {\n  <span class=\"hljs-comment\">// The renderer has sent us a MessagePort that it wants us to send our</span>\n  <span class=\"hljs-comment\">// response over.</span>\n  <span class=\"hljs-keyword\">const</span> [replyPort] = event.ports\n\n  <span class=\"hljs-comment\">// Here we send the messages synchronously, but we could just as easily store</span>\n  <span class=\"hljs-comment\">// the port somewhere and send messages asynchronously.</span>\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">let</span> i = <span class=\"hljs-number\">0</span>; i &#x3C; msg.count; i++) {\n    replyPort.postMessage(msg.element)\n  }\n\n  <span class=\"hljs-comment\">// We close the port when we're done to indicate to the other end that we</span>\n  <span class=\"hljs-comment\">// won't be sending any more messages. This isn't strictly necessary--if we</span>\n  <span class=\"hljs-comment\">// didn't explicitly close the port, it would eventually be garbage</span>\n  <span class=\"hljs-comment\">// collected, which would also trigger the 'close' event in the renderer.</span>\n  replyPort.close()\n})\n</code></pre>\n<h3 id=\"communicating-directly-between-the-main-process-and-the-main-world-of-a-context-isolated-page\"><a href=\"#communicating-directly-between-the-main-process-and-the-main-world-of-a-context-isolated-page\">Communicating directly between the main process and the main world of a context-isolated page</a></h3>\n<p>When <a href=\"/docs/tutorial/context-isolation\">context isolation</a> is enabled, IPC messages from the main process to\nthe renderer are delivered to the isolated world, rather than to the main\nworld. Sometimes you want to deliver messages to the main world directly,\nwithout having to step through the isolated world.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow, app, MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-comment\">// Create a BrowserWindow with contextIsolation enabled.</span>\n  <span class=\"hljs-keyword\">const</span> bw = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">contextIsolation</span>: <span class=\"hljs-literal\">true</span>,\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n  bw.loadURL(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-comment\">// We'll be sending one end of this channel to the main world of the</span>\n  <span class=\"hljs-comment\">// context-isolated page.</span>\n  <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\n\n  <span class=\"hljs-comment\">// It's OK to send a message on the channel before the other end has</span>\n  <span class=\"hljs-comment\">// registered a listener. Messages will be queued until a listener is</span>\n  <span class=\"hljs-comment\">// registered.</span>\n  port2.postMessage({ <span class=\"hljs-attr\">test</span>: <span class=\"hljs-number\">21</span> })\n\n  <span class=\"hljs-comment\">// We can also receive messages from the main world of the renderer.</span>\n  port2.on(<span class=\"hljs-string\">'message'</span>, (event) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'from renderer main world:'</span>, event.data)\n  })\n  port2.start()\n\n  <span class=\"hljs-comment\">// The preload script will receive this IPC message and transfer the port</span>\n  <span class=\"hljs-comment\">// over to the main world.</span>\n  bw.webContents.postMessage(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// preload.js ////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// We need to wait until the main world is ready to receive the message before</span>\n<span class=\"hljs-comment\">// sending the port. We create this promise in the preload so it's guaranteed</span>\n<span class=\"hljs-comment\">// to register the onload listener before the load event is fired.</span>\n<span class=\"hljs-keyword\">const</span> windowLoaded = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> {\n  <span class=\"hljs-built_in\">window</span>.onload = resolve\n})\n\nipcRenderer.on(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-keyword\">async</span> (event) => {\n  <span class=\"hljs-keyword\">await</span> windowLoaded\n  <span class=\"hljs-comment\">// We use regular window.postMessage to transfer the port from the isolated</span>\n  <span class=\"hljs-comment\">// world to the main world.</span>\n  <span class=\"hljs-built_in\">window</span>.postMessage(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-string\">'*'</span>, event.ports)\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- index.html -------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-built_in\">window</span>.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n  <span class=\"hljs-comment\">// event.source === window means the message is coming from the preload</span>\n  <span class=\"hljs-comment\">// script, as opposed to from an &#x3C;iframe> or other source.</span>\n  <span class=\"hljs-keyword\">if</span> (event.source === <span class=\"hljs-built_in\">window</span> &#x26;&#x26; event.data === <span class=\"hljs-string\">'main-world-port'</span>) {\n    <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n    <span class=\"hljs-comment\">// Once we have the port, we can communicate directly with the main</span>\n    <span class=\"hljs-comment\">// process.</span>\n    port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'from main process:'</span>, event.data)\n      port.postMessage(event.data * <span class=\"hljs-number\">2</span>)\n    }\n  }\n}\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>",
      "title": "MessagePorts in Electron",
      "description": ""
    },
    "/docs/api/structures/mime-typed-buffer": {
      "locale": "en-US",
      "slug": "mime-typed-buffer",
      "href": "/docs/api/structures/mime-typed-buffer",
      "crowdinFileId": "256463",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mime-typed-buffer.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mimetypedbuffer-object\"><a href=\"#mimetypedbuffer-object\">MimeTypedBuffer Object</a></h1>\n<ul>\n<li><code>mimeType</code> String (optional) - MIME type of the buffer.</li>\n<li><code>charset</code> String (optional) - Charset of the buffer.</li>\n<li><code>data</code> Buffer - The actual Buffer content.</li>\n</ul>",
      "title": "MimeTypedBuffer Object",
      "description": ""
    },
    "/docs/api/structures/mouse-input-event": {
      "locale": "en-US",
      "slug": "mouse-input-event",
      "href": "/docs/api/structures/mouse-input-event",
      "crowdinFileId": "256465",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mouse-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mouseinputevent-object-extends-inputevent\"><a href=\"#mouseinputevent-object-extends-inputevent\">MouseInputEvent Object extends <code>InputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>mouseDown</code>,\n<code>mouseUp</code>, <code>mouseEnter</code>, <code>mouseLeave</code>, <code>contextMenu</code>, <code>mouseWheel</code> or <code>mouseMove</code>.</li>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n<li><code>button</code> String (optional) - The button pressed, can be <code>left</code>, <code>middle</code>, <code>right</code>.</li>\n<li><code>globalX</code> Integer (optional)</li>\n<li><code>globalY</code> Integer (optional)</li>\n<li><code>movementX</code> Integer (optional)</li>\n<li><code>movementY</code> Integer (optional)</li>\n<li><code>clickCount</code> Integer (optional)</li>\n</ul>",
      "title": "MouseInputEvent Object extends InputEvent",
      "description": ""
    },
    "/docs/api/structures/mouse-wheel-input-event": {
      "locale": "en-US",
      "slug": "mouse-wheel-input-event",
      "href": "/docs/api/structures/mouse-wheel-input-event",
      "crowdinFileId": "256467",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mouse-wheel-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mousewheelinputevent-object-extends-mouseinputevent\"><a href=\"#mousewheelinputevent-object-extends-mouseinputevent\">MouseWheelInputEvent Object extends <code>MouseInputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>mouseWheel</code>.</li>\n<li><code>deltaX</code> Integer (optional)</li>\n<li><code>deltaY</code> Integer (optional)</li>\n<li><code>wheelTicksX</code> Integer (optional)</li>\n<li><code>wheelTicksY</code> Integer (optional)</li>\n<li><code>accelerationRatioX</code> Integer (optional)</li>\n<li><code>accelerationRatioY</code> Integer (optional)</li>\n<li><code>hasPreciseScrollingDeltas</code> Boolean (optional)</li>\n<li><code>canScroll</code> Boolean (optional)</li>\n</ul>",
      "title": "MouseWheelInputEvent Object extends MouseInputEvent",
      "description": ""
    },
    "/docs/tutorial/multithreading": {
      "locale": "en-US",
      "slug": "multithreading",
      "href": "/docs/tutorial/multithreading",
      "crowdinFileId": "256221",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/multithreading.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"multithreading\"><a href=\"#multithreading\">Multithreading</a></h1>\n<p>With <a href=\"https://developer.mozilla.org/en/docs/Web/API/Web_Workers_API/Using_web_workers\">Web Workers</a>, it is possible to run JavaScript in OS-level\nthreads.</p>\n<h2 id=\"multi-threaded-nodejs\"><a href=\"#multi-threaded-nodejs\">Multi-threaded Node.js</a></h2>\n<p>It is possible to use Node.js features in Electron's Web Workers, to do\nso the <code>nodeIntegrationInWorker</code> option should be set to <code>true</code> in\n<code>webPreferences</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegrationInWorker</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<p>The <code>nodeIntegrationInWorker</code> can be used independent of <code>nodeIntegration</code>, but\n<code>sandbox</code> must not be set to <code>true</code>.</p>\n<h2 id=\"available-apis\"><a href=\"#available-apis\">Available APIs</a></h2>\n<p>All built-in modules of Node.js are supported in Web Workers, and <code>asar</code>\narchives can still be read with Node.js APIs. However none of Electron's\nbuilt-in modules can be used in a multi-threaded environment.</p>\n<h2 id=\"native-nodejs-modules\"><a href=\"#native-nodejs-modules\">Native Node.js modules</a></h2>\n<p>Any native Node.js module can be loaded directly in Web Workers, but it is\nstrongly recommended not to do so. Most existing native modules have been\nwritten assuming single-threaded environment, using them in Web Workers will\nlead to crashes and memory corruptions.</p>\n<p>Note that even if a native Node.js module is thread-safe it's still not safe to\nload it in a Web Worker because the <code>process.dlopen</code> function is not thread\nsafe.</p>\n<p>The only way to load a native module safely for now, is to make sure the app\nloads no native modules after the Web Workers get started.</p>\n<pre><code class=\"hljs language-javascript\">process.dlopen = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Load native module is not safe'</span>)\n}\n<span class=\"hljs-keyword\">const</span> worker = <span class=\"hljs-keyword\">new</span> Worker(<span class=\"hljs-string\">'script.js'</span>)\n</code></pre>",
      "title": "Multithreading",
      "description": ""
    },
    "/docs/tutorial/native-file-drag-drop": {
      "locale": "en-US",
      "slug": "native-file-drag-drop",
      "href": "/docs/tutorial/native-file-drag-drop",
      "crowdinFileId": "256223",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/native-file-drag-drop.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"native-file-drag--drop\"><a href=\"#native-file-drag--drop\">Native File Drag &#x26; Drop</a></h1>\n<h2 id=\"overview\"><a href=\"#overview\">Overview</a></h2>\n<p>Certain kinds of applications that manipulate files might want to support\nthe operating system's native file drag &#x26; drop feature. Dragging files into\nweb content is common and supported by many websites. Electron additionally\nsupports dragging files and content out from web content into the operating\nsystem's world.</p>\n<p>To implement this feature in your app, you need to call the\n<a href=\"/docs/api/web-contents#contentsstartdragitem\"><code>webContents.startDrag(item)</code></a>\nAPI in response to the <code>ondragstart</code> event.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<p>An example demonstrating how you can create a file on the fly to be dragged out of the window.</p>\n<h3 id=\"preloadjs\"><a href=\"#preloadjs\">Preload.js</a></h3>\n<p>In <code>preload.js</code> use the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> to inject a method <code>window.electron.startDrag(...)</code> that will send an IPC message to the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'electron'</span>, {\n  <span class=\"hljs-attr\">startDrag</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">fileName</span>) =></span> {\n    ipcRenderer.send(<span class=\"hljs-string\">'ondragstart'</span>, path.join(process.cwd(), fileName))\n  }\n})\n</code></pre>\n<h3 id=\"indexhtml\"><a href=\"#indexhtml\">Index.html</a></h3>\n<p>Add a draggable element to <code>index.html</code>, and reference your renderer script:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">div</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"border:2px solid black;border-radius:3px;padding:5px;display:inline-block\"</span> <span class=\"hljs-attr\">draggable</span>=<span class=\"hljs-string\">\"true\"</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"drag\"</span>></span>Drag me<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">div</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h3 id=\"rendererjs\"><a href=\"#rendererjs\">Renderer.js</a></h3>\n<p>In <code>renderer.js</code> set up the renderer process to handle drag events by calling the method you added via the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> above.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'drag'</span>).ondragstart = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n  event.preventDefault()\n  <span class=\"hljs-built_in\">window</span>.electron.startDrag(<span class=\"hljs-string\">'drag-and-drop.md'</span>)\n}\n</code></pre>\n<h3 id=\"mainjs\"><a href=\"#mainjs\">Main.js</a></h3>\n<p>In the Main process (<code>main.js</code> file), expand the received event with a path to the file that is\nbeing dragged and an icon:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/drag-and-drop\"><span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nipcMain.on(<span class=\"hljs-string\">'ondragstart'</span>, (event, filePath) => {\n  event.sender.startDrag({\n    <span class=\"hljs-attr\">file</span>: filePath,\n    <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'/path/to/icon.png'</span>\n  })\n})\n</code></pre>\n<p>After launching the Electron application, try dragging and dropping\nthe item from the BrowserWindow onto your desktop. In this guide,\nthe item is a Markdown file located in the root of the project:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/drag-and-drop.gif\" alt=\"Drag and drop\"></p>",
      "title": "Native File Drag & Drop",
      "description": ""
    },
    "/docs/api/native-image": {
      "locale": "en-US",
      "slug": "native-image",
      "href": "/docs/api/native-image",
      "crowdinFileId": "256341",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/native-image.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nativeimage\"><a href=\"#nativeimage\">nativeImage</a></h1>\n<blockquote>\n<p>Create tray, dock, and application icons using PNG or JPG files.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>In Electron, for the APIs that take images, you can pass either file paths or\n<code>NativeImage</code> instances. An empty image will be used when <code>null</code> is passed.</p>\n<p>For example, when creating a tray or setting a window's icon, you can pass an\nimage file path as a <code>String</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'/Users/somebody/images/window.png'</span> })\n<span class=\"hljs-built_in\">console</span>.log(appIcon, win)\n</code></pre>\n<p>Or read the image from the clipboard, which returns a <code>NativeImage</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { clipboard, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> image = clipboard.readImage()\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(image)\n<span class=\"hljs-built_in\">console</span>.log(appIcon)\n</code></pre>\n<h2 id=\"supported-formats\"><a href=\"#supported-formats\">Supported Formats</a></h2>\n<p>Currently <code>PNG</code> and <code>JPEG</code> image formats are supported. <code>PNG</code> is recommended\nbecause of its support for transparency and lossless compression.</p>\n<p>On Windows, you can also load <code>ICO</code> icons from file paths. For best visual\nquality, it is recommended to include at least the following sizes in the:</p>\n<ul>\n<li>Small icon<ul>\n<li>16x16 (100% DPI scale)</li>\n<li>20x20 (125% DPI scale)</li>\n<li>24x24 (150% DPI scale)</li>\n<li>32x32 (200% DPI scale)</li>\n</ul></li>\n<li>Large icon<ul>\n<li>32x32 (100% DPI scale)</li>\n<li>40x40 (125% DPI scale)</li>\n<li>48x48 (150% DPI scale)</li>\n<li>64x64 (200% DPI scale)</li>\n<li>256x256</li>\n</ul></li>\n</ul>\n<p>Check the <em>Size requirements</em> section in <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dn742485(v=vs.85).aspx\">this article</a>.</p>\n<h2 id=\"high-resolution-image\"><a href=\"#high-resolution-image\">High Resolution Image</a></h2>\n<p>On platforms that have high-DPI support such as Apple Retina displays, you can\nappend <code>@2x</code> after image's base filename to mark it as a high resolution image.</p>\n<p>For example, if <code>icon.png</code> is a normal image that has standard resolution, then\n<code>icon@2x.png</code> will be treated as a high resolution image that has double DPI\ndensity.</p>\n<p>If you want to support displays with different DPI densities at the same time,\nyou can put images with different sizes in the same folder and use the filename\nwithout DPI suffixes. For example:</p>\n<pre><code class=\"hljs language-plaintext\">images/\n├── icon.png\n├── icon@2x.png\n└── icon@3x.png\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-built_in\">console</span>.log(appIcon)\n</code></pre>\n<p>The following suffixes for DPI are also supported:</p>\n<ul>\n<li><code>@1x</code></li>\n<li><code>@1.25x</code></li>\n<li><code>@1.33x</code></li>\n<li><code>@1.4x</code></li>\n<li><code>@1.5x</code></li>\n<li><code>@1.8x</code></li>\n<li><code>@2x</code></li>\n<li><code>@2.5x</code></li>\n<li><code>@3x</code></li>\n<li><code>@4x</code></li>\n<li><code>@5x</code></li>\n</ul>\n<h2 id=\"template-image\"><a href=\"#template-image\">Template Image</a></h2>\n<p>Template images consist of black and an alpha channel.\nTemplate images are not intended to be used as standalone images and are usually\nmixed with other content to create the desired final appearance.</p>\n<p>The most common case is to use template images for a menu bar icon, so it can\nadapt to both light and dark menu bars.</p>\n<p><strong>Note:</strong> Template image is only supported on macOS.</p>\n<p>To mark an image as a template image, its filename should end with the word\n<code>Template</code>. For example:</p>\n<ul>\n<li><code>xxxTemplate.png</code></li>\n<li><code>xxxTemplate@2x.png</code></li>\n</ul>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>nativeImage</code> module has the following methods, all of which return\nan instance of the <code>NativeImage</code> class:</p>\n<h3 id=\"nativeimagecreateempty\"><a href=\"#nativeimagecreateempty\"><code>nativeImage.createEmpty()</code></a></h3>\n<p>Returns <code>NativeImage</code></p>\n<p>Creates an empty <code>NativeImage</code> instance.</p>\n<h3 id=\"nativeimagecreatethumbnailfrompathpath-maxsize-macos-windows\"><a href=\"#nativeimagecreatethumbnailfrompathpath-maxsize-macos-windows\"><code>nativeImage.createThumbnailFromPath(path, maxSize)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>path</code> String - path to a file that we intend to construct a thumbnail out of.</li>\n<li><code>maxSize</code> <a href=\"/docs/api/structures/size\">Size</a> - the maximum width and height (positive numbers) the thumbnail returned can be. The Windows implementation will ignore <code>maxSize.height</code> and scale the height according to <code>maxSize.width</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - fulfilled with the file's thumbnail preview image, which is a <a href=\"/docs/api/native-image\">NativeImage</a>.</p>\n<h3 id=\"nativeimagecreatefrompathpath\"><a href=\"#nativeimagecreatefrompathpath\"><code>nativeImage.createFromPath(path)</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Returns <code>NativeImage</code></p>\n<p>Creates a new <code>NativeImage</code> instance from a file located at <code>path</code>. This method\nreturns an empty image if the <code>path</code> does not exist, cannot be read, or is not\na valid image.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> nativeImage = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).nativeImage\n\n<span class=\"hljs-keyword\">const</span> image = nativeImage.createFromPath(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-built_in\">console</span>.log(image)\n</code></pre>\n<h3 id=\"nativeimagecreatefrombitmapbuffer-options\"><a href=\"#nativeimagecreatefrombitmapbuffer-options\"><code>nativeImage.createFromBitmap(buffer, options)</code></a></h3>\n<ul>\n<li><code>buffer</code> <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a></li>\n<li><code>options</code> Object<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>scaleFactor</code> Double (optional) - Defaults to 1.0.</li>\n</ul></li>\n</ul>\n<p>Returns <code>NativeImage</code></p>\n<p>Creates a new <code>NativeImage</code> instance from <code>buffer</code> that contains the raw bitmap\npixel data returned by <code>toBitmap()</code>. The specific format is platform-dependent.</p>\n<h3 id=\"nativeimagecreatefrombufferbuffer-options\"><a href=\"#nativeimagecreatefrombufferbuffer-options\"><code>nativeImage.createFromBuffer(buffer[, options])</code></a></h3>\n<ul>\n<li><code>buffer</code> <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a></li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>width</code> Integer (optional) - Required for bitmap buffers.</li>\n<li><code>height</code> Integer (optional) - Required for bitmap buffers.</li>\n<li><code>scaleFactor</code> Double (optional) - Defaults to 1.0.</li>\n</ul></li>\n</ul>\n<p>Returns <code>NativeImage</code></p>\n<p>Creates a new <code>NativeImage</code> instance from <code>buffer</code>. Tries to decode as PNG or JPEG first.</p>\n<h3 id=\"nativeimagecreatefromdataurldataurl\"><a href=\"#nativeimagecreatefromdataurldataurl\"><code>nativeImage.createFromDataURL(dataURL)</code></a></h3>\n<ul>\n<li><code>dataURL</code> String</li>\n</ul>\n<p>Returns <code>NativeImage</code></p>\n<p>Creates a new <code>NativeImage</code> instance from <code>dataURL</code>.</p>\n<h3 id=\"nativeimagecreatefromnamedimageimagename-hslshift-macos\"><a href=\"#nativeimagecreatefromnamedimageimagename-hslshift-macos\"><code>nativeImage.createFromNamedImage(imageName[, hslShift])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>imageName</code> String</li>\n<li><code>hslShift</code> Number<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Returns <code>NativeImage</code></p>\n<p>Creates a new <code>NativeImage</code> instance from the NSImage that maps to the\ngiven image name. See <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/system-icons/\"><code>System Icons</code></a>\nfor a list of possible values.</p>\n<p>The <code>hslShift</code> is applied to the image with the following rules:</p>\n<ul>\n<li><code>hsl_shift[0]</code> (hue): The absolute hue value for the image - 0 and 1 map\nto 0 and 360 on the hue color wheel (red).</li>\n<li><code>hsl_shift[1]</code> (saturation): A saturation shift for the image, with the\nfollowing key values:\n0 = remove all color.\n0.5 = leave unchanged.\n1 = fully saturate the image.</li>\n<li><code>hsl_shift[2]</code> (lightness): A lightness shift for the image, with the\nfollowing key values:\n0 = remove all lightness (make all pixels black).\n0.5 = leave unchanged.\n1 = full lightness (make all pixels white).</li>\n</ul>\n<p>This means that <code>[-1, 0, 1]</code> will make the image completely white and\n<code>[-1, 1, 0]</code> will make the image completely black.</p>\n<p>In some cases, the <code>NSImageName</code> doesn't match its string representation; one example of this is <code>NSFolderImageName</code>, whose string representation would actually be <code>NSFolder</code>. Therefore, you'll need to determine the correct string representation for your image before passing it in. This can be done with the following:</p>\n<p><code>echo -e '#import &#x3C;Cocoa/Cocoa.h>\\nint main() { NSLog(@\"%@\", SYSTEM_IMAGE_NAME); }' | clang -otest -x objective-c -framework Cocoa - &#x26;&#x26; ./test</code></p>\n<p>where <code>SYSTEM_IMAGE_NAME</code> should be replaced with any value from <a href=\"https://developer.apple.com/documentation/appkit/nsimagename?language=objc\">this list</a>.</p>\n<h2 id=\"class-nativeimage\"><a href=\"#class-nativeimage\">Class: NativeImage</a></h2>\n<blockquote>\n<p>Natively wrap images such as tray, dock, and application icons.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<p>The following methods are available on instances of the <code>NativeImage</code> class:</p>\n<h4 id=\"imagetopngoptions\"><a href=\"#imagetopngoptions\"><code>image.toPNG([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>scaleFactor</code> Double (optional) - Defaults to 1.0.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Buffer</code> - A <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> that contains the image's <code>PNG</code> encoded data.</p>\n<h4 id=\"imagetojpegquality\"><a href=\"#imagetojpegquality\"><code>image.toJPEG(quality)</code></a></h4>\n<ul>\n<li><code>quality</code> Integer - Between 0 - 100.</li>\n</ul>\n<p>Returns <code>Buffer</code> - A <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> that contains the image's <code>JPEG</code> encoded data.</p>\n<h4 id=\"imagetobitmapoptions\"><a href=\"#imagetobitmapoptions\"><code>image.toBitmap([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>scaleFactor</code> Double (optional) - Defaults to 1.0.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Buffer</code> - A <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> that contains a copy of the image's raw bitmap pixel\ndata.</p>\n<h4 id=\"imagetodataurloptions\"><a href=\"#imagetodataurloptions\"><code>image.toDataURL([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>scaleFactor</code> Double (optional) - Defaults to 1.0.</li>\n</ul></li>\n</ul>\n<p>Returns <code>String</code> - The data URL of the image.</p>\n<h4 id=\"imagegetbitmapoptions\"><a href=\"#imagegetbitmapoptions\"><code>image.getBitmap([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>scaleFactor</code> Double (optional) - Defaults to 1.0.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Buffer</code> - A <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> that contains the image's raw bitmap pixel data.</p>\n<p>The difference between <code>getBitmap()</code> and <code>toBitmap()</code> is that <code>getBitmap()</code> does not\ncopy the bitmap data, so you have to use the returned Buffer immediately in\ncurrent event loop tick; otherwise the data might be changed or destroyed.</p>\n<h4 id=\"imagegetnativehandle-macos\"><a href=\"#imagegetnativehandle-macos\"><code>image.getNativeHandle()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Buffer</code> - A <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> that stores C pointer to underlying native handle of\nthe image. On macOS, a pointer to <code>NSImage</code> instance would be returned.</p>\n<p>Notice that the returned pointer is a weak pointer to the underlying native\nimage instead of a copy, so you <em>must</em> ensure that the associated\n<code>nativeImage</code> instance is kept around.</p>\n<h4 id=\"imageisempty\"><a href=\"#imageisempty\"><code>image.isEmpty()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the image is empty.</p>\n<h4 id=\"imagegetsizescalefactor\"><a href=\"#imagegetsizescalefactor\"><code>image.getSize([scaleFactor])</code></a></h4>\n<ul>\n<li><code>scaleFactor</code> Double (optional) - Defaults to 1.0.</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/size\"><code>Size</code></a>.</p>\n<p>If <code>scaleFactor</code> is passed, this will return the size corresponding to the image representation most closely matching the passed value.</p>\n<h4 id=\"imagesettemplateimageoption\"><a href=\"#imagesettemplateimageoption\"><code>image.setTemplateImage(option)</code></a></h4>\n<ul>\n<li><code>option</code> Boolean</li>\n</ul>\n<p>Marks the image as a template image.</p>\n<h4 id=\"imageistemplateimage\"><a href=\"#imageistemplateimage\"><code>image.isTemplateImage()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the image is a template image.</p>\n<h4 id=\"imagecroprect\"><a href=\"#imagecroprect\"><code>image.crop(rect)</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - The area of the image to crop.</li>\n</ul>\n<p>Returns <code>NativeImage</code> - The cropped image.</p>\n<h4 id=\"imageresizeoptions\"><a href=\"#imageresizeoptions\"><code>image.resize(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>width</code> Integer (optional) - Defaults to the image's width.</li>\n<li><code>height</code> Integer (optional) - Defaults to the image's height.</li>\n<li><code>quality</code> String (optional) - The desired quality of the resize image.\nPossible values are <code>good</code>, <code>better</code>, or <code>best</code>. The default is <code>best</code>.\nThese values express a desired quality/speed tradeoff. They are translated\ninto an algorithm-specific method that depends on the capabilities\n(CPU, GPU) of the underlying platform. It is possible for all three methods\nto be mapped to the same algorithm on a given platform.</li>\n</ul></li>\n</ul>\n<p>Returns <code>NativeImage</code> - The resized image.</p>\n<p>If only the <code>height</code> or the <code>width</code> are specified then the current aspect ratio\nwill be preserved in the resized image.</p>\n<h4 id=\"imagegetaspectratioscalefactor\"><a href=\"#imagegetaspectratioscalefactor\"><code>image.getAspectRatio([scaleFactor])</code></a></h4>\n<ul>\n<li><code>scaleFactor</code> Double (optional) - Defaults to 1.0.</li>\n</ul>\n<p>Returns <code>Float</code> - The image's aspect ratio.</p>\n<p>If <code>scaleFactor</code> is passed, this will return the aspect ratio corresponding to the image representation most closely matching the passed value.</p>\n<h4 id=\"imagegetscalefactors\"><a href=\"#imagegetscalefactors\"><code>image.getScaleFactors()</code></a></h4>\n<p>Returns <code>Float[]</code> - An array of all scale factors corresponding to representations for a given nativeImage.</p>\n<h4 id=\"imageaddrepresentationoptions\"><a href=\"#imageaddrepresentationoptions\"><code>image.addRepresentation(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>scaleFactor</code> Double - The scale factor to add the image representation for.</li>\n<li><code>width</code> Integer (optional) - Defaults to 0. Required if a bitmap buffer\nis specified as <code>buffer</code>.</li>\n<li><code>height</code> Integer (optional) - Defaults to 0. Required if a bitmap buffer\nis specified as <code>buffer</code>.</li>\n<li><code>buffer</code> Buffer (optional) - The buffer containing the raw image data.</li>\n<li><code>dataURL</code> String (optional) - The data URL containing either a base 64\nencoded PNG or JPEG image.</li>\n</ul></li>\n</ul>\n<p>Add an image representation for a specific scale factor. This can be used\nto explicitly add different scale factor representations to an image. This\ncan be called on empty images.</p>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<h4 id=\"nativeimageismactemplateimage-macos\"><a href=\"#nativeimageismactemplateimage-macos\"><code>nativeImage.isMacTemplateImage</code> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the image is considered a <a href=\"https://developer.apple.com/documentation/appkit/nsimage/1520017-template\">template image</a>.</p>\n<p>Please note that this property only has an effect on macOS.</p>",
      "title": "nativeImage",
      "description": "Create tray, dock, and application icons using PNG or JPG files."
    },
    "/docs/api/native-theme": {
      "locale": "en-US",
      "slug": "native-theme",
      "href": "/docs/api/native-theme",
      "crowdinFileId": "256343",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/native-theme.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nativetheme\"><a href=\"#nativetheme\">nativeTheme</a></h1>\n<blockquote>\n<p>Read and respond to changes in Chromium's native color theme.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h2 id=\"events\"><a href=\"#events\">Events</a></h2>\n<p>The <code>nativeTheme</code> module emits the following events:</p>\n<h3 id=\"event-updated\"><a href=\"#event-updated\">Event: 'updated'</a></h3>\n<p>Emitted when something in the underlying NativeTheme has changed. This normally\nmeans that either the value of <code>shouldUseDarkColors</code>,\n<code>shouldUseHighContrastColors</code> or <code>shouldUseInvertedColorScheme</code> has changed.\nYou will have to check them to determine which one has changed.</p>\n<h2 id=\"properties\"><a href=\"#properties\">Properties</a></h2>\n<p>The <code>nativeTheme</code> module has the following properties:</p>\n<h3 id=\"nativethemeshouldusedarkcolors-readonly\"><a href=\"#nativethemeshouldusedarkcolors-readonly\"><code>nativeTheme.shouldUseDarkColors</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> for if the OS / Chromium currently has a dark mode enabled or is\nbeing instructed to show a dark-style UI.  If you want to modify this value you\nshould use <code>themeSource</code> below.</p>\n<h3 id=\"nativethemethemesource\"><a href=\"#nativethemethemesource\"><code>nativeTheme.themeSource</code></a></h3>\n<p>A <code>String</code> property that can be <code>system</code>, <code>light</code> or <code>dark</code>.  It is used to override and supersede\nthe value that Chromium has chosen to use internally.</p>\n<p>Setting this property to <code>system</code> will remove the override and\neverything will be reset to the OS default.  By default <code>themeSource</code> is <code>system</code>.</p>\n<p>Settings this property to <code>dark</code> will have the following effects:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code> will be <code>true</code> when accessed</li>\n<li>Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the dark UI.</li>\n<li>Any UI the OS renders on macOS including menus, window frames, etc. will use the dark UI.</li>\n<li>The <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> CSS query will match <code>dark</code> mode.</li>\n<li>The <code>updated</code> event will be emitted</li>\n</ul>\n<p>Settings this property to <code>light</code> will have the following effects:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code> will be <code>false</code> when accessed</li>\n<li>Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the light UI.</li>\n<li>Any UI the OS renders on macOS including menus, window frames, etc. will use the light UI.</li>\n<li>The <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> CSS query will match <code>light</code> mode.</li>\n<li>The <code>updated</code> event will be emitted</li>\n</ul>\n<p>The usage of this property should align with a classic \"dark mode\" state machine in your application\nwhere the user has three options.</p>\n<ul>\n<li><code>Follow OS</code> --> <code>themeSource = 'system'</code></li>\n<li><code>Dark Mode</code> --> <code>themeSource = 'dark'</code></li>\n<li><code>Light Mode</code> --> <code>themeSource = 'light'</code></li>\n</ul>\n<p>Your application should then always use <code>shouldUseDarkColors</code> to determine what CSS to apply.</p>\n<h3 id=\"nativethemeshouldusehighcontrastcolors-macos-windows-readonly\"><a href=\"#nativethemeshouldusehighcontrastcolors-macos-windows-readonly\"><code>nativeTheme.shouldUseHighContrastColors</code> <em>macOS</em> <em>Windows</em> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> for if the OS / Chromium currently has high-contrast mode enabled\nor is being instructed to show a high-contrast UI.</p>\n<h3 id=\"nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly\"><a href=\"#nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly\"><code>nativeTheme.shouldUseInvertedColorScheme</code> <em>macOS</em> <em>Windows</em> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> for if the OS / Chromium currently has an inverted color scheme\nor is being instructed to use an inverted color scheme.</p>",
      "title": "nativeTheme",
      "description": "Read and respond to changes in Chromium's native color theme."
    },
    "/docs/api/net": {
      "locale": "en-US",
      "slug": "net",
      "href": "/docs/api/net",
      "crowdinFileId": "256347",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/net.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"net\"><a href=\"#net\">net</a></h1>\n<blockquote>\n<p>Issue HTTP/HTTPS requests using Chromium's native networking library</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>The <code>net</code> module is a client-side API for issuing HTTP(S) requests. It is\nsimilar to the <a href=\"https://nodejs.org/api/http.html\">HTTP</a> and\n<a href=\"https://nodejs.org/api/https.html\">HTTPS</a> modules of Node.js but uses\nChromium's native networking library instead of the Node.js implementation,\noffering better support for web proxies. It also supports checking network status.</p>\n<p>The following is a non-exhaustive list of why you may consider using the <code>net</code>\nmodule instead of the native Node.js modules:</p>\n<ul>\n<li>Automatic management of system proxy configuration, support of the wpad\nprotocol and proxy pac configuration files.</li>\n<li>Automatic tunneling of HTTPS requests.</li>\n<li>Support for authenticating proxies using basic, digest, NTLM, Kerberos or\nnegotiate authentication schemes.</li>\n<li>Support for traffic monitoring proxies: Fiddler-like proxies used for access\ncontrol and monitoring.</li>\n</ul>\n<p>The API components (including classes, methods, properties and event names) are similar to those used in\nNode.js.</p>\n<p>Example usage:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> { net } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n  <span class=\"hljs-keyword\">const</span> request = net.request(<span class=\"hljs-string\">'https://github.com'</span>)\n  request.on(<span class=\"hljs-string\">'response'</span>, (response) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`STATUS: <span class=\"hljs-subst\">${response.statusCode}</span>`</span>)\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`HEADERS: <span class=\"hljs-subst\">${<span class=\"hljs-built_in\">JSON</span>.stringify(response.headers)}</span>`</span>)\n    response.on(<span class=\"hljs-string\">'data'</span>, (chunk) => {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`BODY: <span class=\"hljs-subst\">${chunk}</span>`</span>)\n    })\n    response.on(<span class=\"hljs-string\">'end'</span>, () => {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'No more data in response.'</span>)\n    })\n  })\n  request.end()\n})\n</code></pre>\n<p>The <code>net</code> API can be used only after the application emits the <code>ready</code> event.\nTrying to use the module before the <code>ready</code> event will throw an error.</p>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>net</code> module has the following methods:</p>\n<h3 id=\"netrequestoptions\"><a href=\"#netrequestoptions\"><code>net.request(options)</code></a></h3>\n<ul>\n<li><code>options</code> (ClientRequestConstructorOptions | String) - The <code>ClientRequest</code> constructor options.</li>\n</ul>\n<p>Returns <a href=\"/docs/api/client-request\"><code>ClientRequest</code></a></p>\n<p>Creates a <a href=\"/docs/api/client-request\"><code>ClientRequest</code></a> instance using the provided\n<code>options</code> which are directly forwarded to the <code>ClientRequest</code> constructor.\nThe <code>net.request</code> method would be used to issue both secure and insecure HTTP\nrequests according to the specified protocol scheme in the <code>options</code> object.</p>\n<h3 id=\"netisonline\"><a href=\"#netisonline\"><code>net.isOnline()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether there is currently internet connection.</p>\n<p>A return value of <code>false</code> is a pretty strong indicator that the user\nwon't be able to connect to remote sites. However, a return value of\n<code>true</code> is inconclusive; even if some link is up, it is uncertain\nwhether a particular connection attempt to a particular remote site\nwill be successful.</p>\n<h2 id=\"properties\"><a href=\"#properties\">Properties</a></h2>\n<h3 id=\"netonline-readonly\"><a href=\"#netonline-readonly\"><code>net.online</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> property. Whether there is currently internet connection.</p>\n<p>A return value of <code>false</code> is a pretty strong indicator that the user\nwon't be able to connect to remote sites. However, a return value of\n<code>true</code> is inconclusive; even if some link is up, it is uncertain\nwhether a particular connection attempt to a particular remote site\nwill be successful.</p>",
      "title": "net",
      "description": "Issue HTTP/HTTPS requests using Chromium's native networking library"
    },
    "/docs/api/net-log": {
      "locale": "en-US",
      "slug": "net-log",
      "href": "/docs/api/net-log",
      "crowdinFileId": "256345",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/net-log.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"netlog\"><a href=\"#netlog\">netLog</a></h1>\n<blockquote>\n<p>Logging network events for a session.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { netLog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> netLog.startLogging(<span class=\"hljs-string\">'/path/to/net-log'</span>)\n  <span class=\"hljs-comment\">// After some network events</span>\n  <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> netLog.stopLogging()\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Net-logs written to'</span>, path)\n})\n</code></pre>\n<p>See <a href=\"/docs/api/command-line-switches#--log-net-logpath\"><code>--log-net-log</code></a> to log network events throughout the app's lifecycle.</p>\n<p><strong>Note:</strong> All methods unless specified can only be used after the <code>ready</code> event\nof the <code>app</code> module gets emitted.</p>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<h3 id=\"netlogstartloggingpath-options\"><a href=\"#netlogstartloggingpath-options\"><code>netLog.startLogging(path[, options])</code></a></h3>\n<ul>\n<li><code>path</code> String - File path to record network logs.</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>captureMode</code> String (optional) - What kinds of data should be captured. By\ndefault, only metadata about requests will be captured. Setting this to\n<code>includeSensitive</code> will include cookies and authentication data. Setting\nit to <code>everything</code> will include all bytes transferred on sockets. Can be\n<code>default</code>, <code>includeSensitive</code> or <code>everything</code>.</li>\n<li><code>maxFileSize</code> Number (optional) - When the log grows beyond this size,\nlogging will automatically stop. Defaults to unlimited.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the net log has begun recording.</p>\n<p>Starts recording network events to <code>path</code>.</p>\n<h3 id=\"netlogstoplogging\"><a href=\"#netlogstoplogging\"><code>netLog.stopLogging()</code></a></h3>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the net log has been flushed to disk.</p>\n<p>Stops recording network events. If not called, net logging will automatically end when app quits.</p>\n<h2 id=\"properties\"><a href=\"#properties\">Properties</a></h2>\n<h3 id=\"netlogcurrentlylogging-readonly\"><a href=\"#netlogcurrentlylogging-readonly\"><code>netLog.currentlyLogging</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> property that indicates whether network logs are currently being recorded.</p>",
      "title": "netLog",
      "description": "Logging network events for a session."
    },
    "/docs/api/structures/new-window-web-contents-event": {
      "locale": "en-US",
      "slug": "new-window-web-contents-event",
      "href": "/docs/api/structures/new-window-web-contents-event",
      "crowdinFileId": "256469",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/new-window-web-contents-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"newwindowwebcontentsevent-object-extends-event\"><a href=\"#newwindowwebcontentsevent-object-extends-event\">NewWindowWebContentsEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>newGuest</code> BrowserWindow (optional)</li>\n</ul>",
      "title": "NewWindowWebContentsEvent Object extends Event",
      "description": ""
    },
    "/docs/api/notification": {
      "locale": "en-US",
      "slug": "notification",
      "href": "/docs/api/notification",
      "crowdinFileId": "256349",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/notification.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"notification\"><a href=\"#notification\">Notification</a></h1>\n<blockquote>\n<p>Create OS desktop notifications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h2 id=\"using-in-the-renderer-process\"><a href=\"#using-in-the-renderer-process\">Using in the renderer process</a></h2>\n<p>If you want to show Notifications from a renderer process you should use the <a href=\"/docs/tutorial/notifications\">HTML5 Notification API</a></p>\n<h2 id=\"class-notification\"><a href=\"#class-notification\">Class: Notification</a></h2>\n<blockquote>\n<p>Create OS desktop notifications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>Notification</code> is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p>It creates a new <code>Notification</code> with native properties as set by the <code>options</code>.</p>\n<h3 id=\"static-methods\"><a href=\"#static-methods\">Static Methods</a></h3>\n<p>The <code>Notification</code> class has the following static methods:</p>\n<h4 id=\"notificationissupported\"><a href=\"#notificationissupported\"><code>Notification.isSupported()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether or not desktop notifications are supported on the current system</p>\n<h3 id=\"new-notificationoptions\"><a href=\"#new-notificationoptions\"><code>new Notification([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>title</code> String (optional) - A title for the notification, which will be shown at the top of the notification window when it is shown.</li>\n<li><code>subtitle</code> String (optional) <em>macOS</em> - A subtitle for the notification, which will be displayed below the title.</li>\n<li><code>body</code> String (optional) - The body text of the notification, which will be displayed below the title or subtitle.</li>\n<li><code>silent</code> Boolean (optional) - Whether or not to emit an OS notification noise when showing the notification.</li>\n<li><code>icon</code> (String | <a href=\"/docs/api/native-image\">NativeImage</a>) (optional) - An icon to use in the notification.</li>\n<li><code>hasReply</code> Boolean (optional) <em>macOS</em> - Whether or not to add an inline reply option to the notification.</li>\n<li><code>timeoutType</code> String (optional) <em>Linux</em> <em>Windows</em> - The timeout duration of the notification. Can be 'default' or 'never'.</li>\n<li><code>replyPlaceholder</code> String (optional) <em>macOS</em> - The placeholder to write in the inline reply input field.</li>\n<li><code>sound</code> String (optional) <em>macOS</em> - The name of the sound file to play when the notification is shown.</li>\n<li><code>urgency</code> String (optional) <em>Linux</em> - The urgency level of the notification. Can be 'normal', 'critical', or 'low'.</li>\n<li><code>actions</code> <a href=\"/docs/api/structures/notification-action\">NotificationAction[]</a> (optional) <em>macOS</em> - Actions to add to the notification. Please read the available actions and limitations in the <code>NotificationAction</code> documentation.</li>\n<li><code>closeButtonText</code> String (optional) <em>macOS</em> - A custom title for the close button of an alert. An empty string will cause the default localized text to be used.</li>\n<li><code>toastXml</code> String (optional) <em>Windows</em> - A custom description of the Notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification.</li>\n</ul></li>\n</ul>\n<h3 id=\"instance-events\"><a href=\"#instance-events\">Instance Events</a></h3>\n<p>Objects created with <code>new Notification</code> emit the following events:</p>\n<p><strong>Note:</strong> Some events are only available on specific operating systems and are\nlabeled as such.</p>\n<h4 id=\"event-show\"><a href=\"#event-show\">Event: 'show'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the notification is shown to the user, note this could be fired\nmultiple times as a notification can be shown multiple times through the\n<code>show()</code> method.</p>\n<h4 id=\"event-click\"><a href=\"#event-click\">Event: 'click'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the notification is clicked by the user.</p>\n<h4 id=\"event-close\"><a href=\"#event-close\">Event: 'close'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the notification is closed by manual intervention from the user.</p>\n<p>This event is not guaranteed to be emitted in all cases where the notification\nis closed.</p>\n<h4 id=\"event-reply-macos\"><a href=\"#event-reply-macos\">Event: 'reply' <em>macOS</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>reply</code> String - The string the user entered into the inline reply field.</li>\n</ul>\n<p>Emitted when the user clicks the \"Reply\" button on a notification with <code>hasReply: true</code>.</p>\n<h4 id=\"event-action-macos\"><a href=\"#event-action-macos\">Event: 'action' <em>macOS</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>index</code> Number - The index of the action that was activated.</li>\n</ul>\n<h4 id=\"event-failed-windows\"><a href=\"#event-failed-windows\">Event: 'failed' <em>Windows</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>error</code> String - The error encountered during execution of the <code>show()</code> method.</li>\n</ul>\n<p>Emitted when an error is encountered while creating and showing the native notification.</p>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<p>Objects created with <code>new Notification</code> have the following instance methods:</p>\n<h4 id=\"notificationshow\"><a href=\"#notificationshow\"><code>notification.show()</code></a></h4>\n<p>Immediately shows the notification to the user, please note this means unlike the\nHTML5 Notification implementation, instantiating a <code>new Notification</code> does\nnot immediately show it to the user, you need to call this method before the OS\nwill display it.</p>\n<p>If the notification has been shown before, this method will dismiss the previously\nshown notification and create a new one with identical properties.</p>\n<h4 id=\"notificationclose\"><a href=\"#notificationclose\"><code>notification.close()</code></a></h4>\n<p>Dismisses the notification.</p>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<h4 id=\"notificationtitle\"><a href=\"#notificationtitle\"><code>notification.title</code></a></h4>\n<p>A <code>String</code> property representing the title of the notification.</p>\n<h4 id=\"notificationsubtitle\"><a href=\"#notificationsubtitle\"><code>notification.subtitle</code></a></h4>\n<p>A <code>String</code> property representing the subtitle of the notification.</p>\n<h4 id=\"notificationbody\"><a href=\"#notificationbody\"><code>notification.body</code></a></h4>\n<p>A <code>String</code> property representing the body of the notification.</p>\n<h4 id=\"notificationreplyplaceholder\"><a href=\"#notificationreplyplaceholder\"><code>notification.replyPlaceholder</code></a></h4>\n<p>A <code>String</code> property representing the reply placeholder of the notification.</p>\n<h4 id=\"notificationsound\"><a href=\"#notificationsound\"><code>notification.sound</code></a></h4>\n<p>A <code>String</code> property representing the sound of the notification.</p>\n<h4 id=\"notificationclosebuttontext\"><a href=\"#notificationclosebuttontext\"><code>notification.closeButtonText</code></a></h4>\n<p>A <code>String</code> property representing the close button text of the notification.</p>\n<h4 id=\"notificationsilent\"><a href=\"#notificationsilent\"><code>notification.silent</code></a></h4>\n<p>A <code>Boolean</code> property representing whether the notification is silent.</p>\n<h4 id=\"notificationhasreply\"><a href=\"#notificationhasreply\"><code>notification.hasReply</code></a></h4>\n<p>A <code>Boolean</code> property representing whether the notification has a reply action.</p>\n<h4 id=\"notificationurgency-linux\"><a href=\"#notificationurgency-linux\"><code>notification.urgency</code> <em>Linux</em></a></h4>\n<p>A <code>String</code> property representing the urgency level of the notification. Can be 'normal', 'critical', or 'low'.</p>\n<p>Default is 'low' - see <a href=\"https://developer.gnome.org/notification-spec/#urgency-levels\">NotifyUrgency</a> for more information.</p>\n<h4 id=\"notificationtimeouttype-linux-windows\"><a href=\"#notificationtimeouttype-linux-windows\"><code>notification.timeoutType</code> <em>Linux</em> <em>Windows</em></a></h4>\n<p>A <code>String</code> property representing the type of timeout duration for the notification. Can be 'default' or 'never'.</p>\n<p>If <code>timeoutType</code> is set to 'never', the notification never expires. It stays open until closed by the calling API or the user.</p>\n<h4 id=\"notificationactions\"><a href=\"#notificationactions\"><code>notification.actions</code></a></h4>\n<p>A <a href=\"/docs/api/structures/notification-action\"><code>NotificationAction[]</code></a> property representing the actions of the notification.</p>\n<h4 id=\"notificationtoastxml-windows\"><a href=\"#notificationtoastxml-windows\"><code>notification.toastXml</code> <em>Windows</em></a></h4>\n<p>A <code>String</code> property representing the custom Toast XML of the notification.</p>\n<h3 id=\"playing-sounds\"><a href=\"#playing-sounds\">Playing Sounds</a></h3>\n<p>On macOS, you can specify the name of the sound you'd like to play when the\nnotification is shown. Any of the default sounds (under System Preferences >\nSound) can be used, in addition to custom sound files. Be sure that the sound\nfile is copied under the app bundle (e.g., <code>YourApp.app/Contents/Resources</code>),\nor one of the following locations:</p>\n<ul>\n<li><code>~/Library/Sounds</code></li>\n<li><code>/Library/Sounds</code></li>\n<li><code>/Network/Library/Sounds</code></li>\n<li><code>/System/Library/Sounds</code></li>\n</ul>\n<p>See the <a href=\"https://developer.apple.com/documentation/appkit/nssound\"><code>NSSound</code></a> docs for more information.</p>",
      "title": "Notification",
      "description": "Create OS desktop notifications"
    },
    "/docs/api/structures/notification-action": {
      "locale": "en-US",
      "slug": "notification-action",
      "href": "/docs/api/structures/notification-action",
      "crowdinFileId": "256471",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/notification-action.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificationaction-object\"><a href=\"#notificationaction-object\">NotificationAction Object</a></h1>\n<ul>\n<li><code>type</code> String - The type of action, can be <code>button</code>.</li>\n<li><code>text</code> String (optional) - The label for the given action.</li>\n</ul>\n<h2 id=\"platform--action-support\"><a href=\"#platform--action-support\">Platform / Action Support</a></h2>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Action Type</th><th>Platform Support</th><th>Usage of <code>text</code></th><th>Default <code>text</code></th><th>Limitations</th></tr></thead><tbody><tr><td><code>button</code></td><td>macOS</td><td>Used as the label for the button</td><td>\"Show\" (or a localized string by system default if first of such <code>button</code>, otherwise empty)</td><td>Only the first one is used. If multiple are provided, those beyond the first will be listed as additional actions (displayed when mouse active over the action button). Any such action also is incompatible with <code>hasReply</code> and will be ignored if <code>hasReply</code> is <code>true</code>.</td></tr></tbody></table>\n<h3 id=\"button-support-on-macos\"><a href=\"#button-support-on-macos\">Button support on macOS</a></h3>\n<p>In order for extra notification buttons to work on macOS your app must meet the\nfollowing criteria.</p>\n<ul>\n<li>App is signed</li>\n<li>App has it's <code>NSUserNotificationAlertStyle</code> set to <code>alert</code> in the <code>Info.plist</code>.</li>\n</ul>\n<p>If either of these requirements are not met the button won't appear.</p>",
      "title": "NotificationAction Object",
      "description": ""
    },
    "/docs/api/structures/notification-response": {
      "locale": "en-US",
      "slug": "notification-response",
      "href": "/docs/api/structures/notification-response",
      "crowdinFileId": "256473",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/notification-response.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificationresponse-object\"><a href=\"#notificationresponse-object\">NotificationResponse Object</a></h1>\n<ul>\n<li><code>actionIdentifier</code> String - The identifier string of the action that the user selected.</li>\n<li><code>date</code> Number - The delivery date of the notification.</li>\n<li><code>identifier</code> String - The unique identifier for this notification request.</li>\n<li><code>userInfo</code> Record&#x3C;String, any> - A dictionary of custom information associated with the notification.</li>\n<li><code>userText</code> String (optional) - The text entered or chosen by the user.</li>\n</ul>",
      "title": "NotificationResponse Object",
      "description": ""
    },
    "/docs/tutorial/notifications": {
      "locale": "en-US",
      "slug": "notifications",
      "href": "/docs/tutorial/notifications",
      "crowdinFileId": "256225",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/notifications.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"notifications\"><a href=\"#notifications\">Notifications</a></h1>\n<h2 id=\"overview\"><a href=\"#overview\">Overview</a></h2>\n<p>All three operating systems provide means for applications to send\nnotifications to the user. The technique of showing notifications is different\nfor the Main and Renderer processes.</p>\n<p>For the Renderer process, Electron conveniently allows developers to send\nnotifications with the <a href=\"https://notifications.spec.whatwg.org/\">HTML5 Notification API</a>,\nusing the currently running operating system's native notification APIs\nto display it.</p>\n<p>To show notifications in the Main process, you need to use the\n<a href=\"/docs/api/notification\">Notification</a> module.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<h3 id=\"show-notifications-in-the-renderer-process\"><a href=\"#show-notifications-in-the-renderer-process\">Show notifications in the Renderer process</a></h3>\n<p>Starting with a working application from the\n<a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, add the following line to the\n<code>index.html</code> file before the closing <code>&#x3C;/body></code> tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<p>...and add the <code>renderer.js</code> file:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/notifications/renderer\"><span class=\"hljs-keyword\">const</span> NOTIFICATION_TITLE = <span class=\"hljs-string\">'Title'</span>\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_BODY = <span class=\"hljs-string\">'Notification from the Renderer process. Click to log to console.'</span>\n<span class=\"hljs-keyword\">const</span> CLICK_MESSAGE = <span class=\"hljs-string\">'Notification clicked'</span>\n\n<span class=\"hljs-keyword\">new</span> Notification(NOTIFICATION_TITLE, { <span class=\"hljs-attr\">body</span>: NOTIFICATION_BODY })\n  .onclick = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-built_in\">console</span>.log(CLICK_MESSAGE)\n</code></pre>\n<p>After launching the Electron application, you should see the notification:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/notification-renderer.png\" alt=\"Notification in the Renderer process\"></p>\n<p>Additionally, if you click on the notification, the DOM will update to show \"Notification clicked!\".</p>\n<h3 id=\"show-notifications-in-the-main-process\"><a href=\"#show-notifications-in-the-main-process\">Show notifications in the Main process</a></h3>\n<p>Starting with a working application from the\n<a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/notifications/main\"><span class=\"hljs-keyword\">const</span> { Notification } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_TITLE = <span class=\"hljs-string\">'Basic Notification'</span>\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_BODY = <span class=\"hljs-string\">'Notification from the Main process'</span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">showNotification</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">new</span> Notification({ <span class=\"hljs-attr\">title</span>: NOTIFICATION_TITLE, <span class=\"hljs-attr\">body</span>: NOTIFICATION_BODY }).show()\n}\n\napp.whenReady().then(createWindow).then(showNotification)\n</code></pre>\n<p>After launching the Electron application, you should see the system notification:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/notification-main.png\" alt=\"Notification in the Main process\"></p>\n<h2 id=\"additional-information\"><a href=\"#additional-information\">Additional information</a></h2>\n<p>While code and user experience across operating systems are similar, there\nare subtle differences.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<ul>\n<li>On Windows 10, a shortcut to your app with an\n<a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> must be installed to the\nStart Menu. This can be overkill during development, so adding\n<code>node_modules\\electron\\dist\\electron.exe</code> to your Start Menu also does the\ntrick. Navigate to the file in Explorer, right-click and 'Pin to Start Menu'.\nYou will then need to add the line <code>app.setAppUserModelId(process.execPath)</code> to\nyour main process to see notifications.</li>\n<li>On Windows 8.1 and Windows 8, a shortcut to your app with an <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User\nModel ID</a> must be installed to the Start screen. Note,\nhowever, that it does not need to be pinned to the Start screen.</li>\n<li>On Windows 7, notifications work via a custom implementation which visually\nresembles the native one on newer systems.</li>\n</ul>\n<p>Electron attempts to automate the work around the Application User Model ID. When\nElectron is used together with the installation and update framework Squirrel,\n<a href=\"https://github.com/electron/windows-installer/blob/master/README.md#handling-squirrel-events\">shortcuts will automatically be set correctly</a>. Furthermore,\nElectron will detect that Squirrel was used and will automatically call\n<code>app.setAppUserModelId()</code> with the correct value. During development, you may have\nto call <a href=\"/docs/api/app#appsetappusermodelidid-windows\"><code>app.setAppUserModelId()</code></a> yourself.</p>\n<p>Furthermore, in Windows 8, the maximum length for the notification body is 250\ncharacters, with the Windows team recommending that notifications should be kept\nto 200 characters. That said, that limitation has been removed in Windows 10, with\nthe Windows team asking developers to be reasonable. Attempting to send gigantic\namounts of text to the API (thousands of characters) might result in instability.</p>\n<h4 id=\"advanced-notifications\"><a href=\"#advanced-notifications\">Advanced Notifications</a></h4>\n<p>Later versions of Windows allow for advanced notifications, with custom templates,\nimages, and other flexible elements. To send those notifications (from either the\nmain process or the renderer process), use the userland module\n<a href=\"https://github.com/felixrieseberg/electron-windows-notifications\">electron-windows-notifications</a>,\nwhich uses native Node addons to send <code>ToastNotification</code> and <code>TileNotification</code> objects.</p>\n<p>While notifications including buttons work with <code>electron-windows-notifications</code>,\nhandling replies requires the use of\n<a href=\"https://github.com/felixrieseberg/electron-windows-interactive-notifications\"><code>electron-windows-interactive-notifications</code></a>,\nwhich helps with registering the required COM components and calling your\nElectron app with the entered user data.</p>\n<h4 id=\"quiet-hours--presentation-mode\"><a href=\"#quiet-hours--presentation-mode\">Quiet Hours / Presentation Mode</a></h4>\n<p>To detect whether or not you're allowed to send a notification, use the\nuserland module <a href=\"https://github.com/felixrieseberg/electron-notification-state\">electron-notification-state</a>.</p>\n<p>This allows you to determine ahead of time whether or not Windows will\nsilently throw the notification away.</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>Notifications are straight-forward on macOS, but you should be aware of\n<a href=\"https://developer.apple.com/macos/human-interface-guidelines/system-capabilities/notifications/\">Apple's Human Interface guidelines regarding notifications</a>.</p>\n<p>Note that notifications are limited to 256 bytes in size and will be truncated\nif you exceed that limit.</p>\n<h4 id=\"do-not-disturb--session-state\"><a href=\"#do-not-disturb--session-state\">Do not disturb / Session State</a></h4>\n<p>To detect whether or not you're allowed to send a notification, use the userland module\n<a href=\"https://github.com/felixrieseberg/electron-notification-state\">electron-notification-state</a>.</p>\n<p>This will allow you to detect ahead of time whether or not the notification will be displayed.</p>\n<h3 id=\"linux\"><a href=\"#linux\">Linux</a></h3>\n<p>Notifications are sent using <code>libnotify</code> which can show notifications on any\ndesktop environment that follows <a href=\"https://developer.gnome.org/notification-spec/\">Desktop Notifications\nSpecification</a>, including Cinnamon, Enlightenment, Unity,\nGNOME, KDE.</p>",
      "title": "Notifications",
      "description": ""
    },
    "/docs/tutorial/offscreen-rendering": {
      "locale": "en-US",
      "slug": "offscreen-rendering",
      "href": "/docs/tutorial/offscreen-rendering",
      "crowdinFileId": "256227",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/offscreen-rendering.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"offscreen-rendering\"><a href=\"#offscreen-rendering\">Offscreen Rendering</a></h1>\n<h2 id=\"overview\"><a href=\"#overview\">Overview</a></h2>\n<p>Offscreen rendering lets you obtain the content of a <code>BrowserWindow</code> in a\nbitmap, so it can be rendered anywhere, for example, on texture in a 3D scene.\nThe offscreen rendering in Electron uses a similar approach to that of the\n<a href=\"https://bitbucket.org/chromiumembedded/cef\">Chromium Embedded Framework</a>\nproject.</p>\n<p><em>Notes</em>:</p>\n<ul>\n<li>There are two rendering modes that can be used (see the section below) and only\nthe dirty area is passed to the <code>paint</code> event to be more efficient.</li>\n<li>You can stop/continue the rendering as well as set the frame rate.</li>\n<li>The maximum frame rate is 240 because greater values bring only performance\nlosses with no benefits.</li>\n<li>When nothing is happening on a webpage, no frames are generated.</li>\n<li>An offscreen window is always created as a\n<a href=\"/docs/api/frameless-window\">Frameless Window</a>.</li>\n</ul>\n<h3 id=\"rendering-modes\"><a href=\"#rendering-modes\">Rendering Modes</a></h3>\n<h4 id=\"gpu-accelerated\"><a href=\"#gpu-accelerated\">GPU accelerated</a></h4>\n<p>GPU accelerated rendering means that the GPU is used for composition. Because of\nthat, the frame has to be copied from the GPU which requires more resources,\nthus this mode is slower than the Software output device. The benefit of this\nmode is that WebGL and 3D CSS animations are supported.</p>\n<h4 id=\"software-output-device\"><a href=\"#software-output-device\">Software output device</a></h4>\n<p>This mode uses a software output device for rendering in the CPU, so the frame\ngeneration is much faster. As a result, this mode is preferred over the GPU\naccelerated one.</p>\n<p>To enable this mode, GPU acceleration has to be disabled by calling the\n<a href=\"/docs/api/app#appdisablehardwareacceleration\"><code>app.disableHardwareAcceleration()</code></a> API.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/offscreen-rendering\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\napp.disableHardwareAcceleration()\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">offscreen</span>: <span class=\"hljs-literal\">true</span> } })\n\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  win.webContents.on(<span class=\"hljs-string\">'paint'</span>, (event, dirty, image) => {\n    fs.writeFileSync(<span class=\"hljs-string\">'ex.png'</span>, image.toPNG())\n  })\n  win.webContents.setFrameRate(<span class=\"hljs-number\">60</span>)\n})\n</code></pre>\n<p>After launching the Electron application, navigate to your application's\nworking folder, where you'll find the rendered image.</p>",
      "title": "Offscreen Rendering",
      "description": ""
    },
    "/docs/tutorial/online-offline-events": {
      "locale": "en-US",
      "slug": "online-offline-events",
      "href": "/docs/tutorial/online-offline-events",
      "crowdinFileId": "256229",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/online-offline-events.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"onlineoffline-event-detection\"><a href=\"#onlineoffline-event-detection\">Online/Offline Event Detection</a></h1>\n<h2 id=\"overview\"><a href=\"#overview\">Overview</a></h2>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Online_and_offline_events\">Online and offline event</a>\ndetection can be implemented in the Renderer process using the\n<a href=\"http://html5index.org/Offline%20-%20NavigatorOnLine.html\"><code>navigator.onLine</code></a>\nattribute, part of standard HTML5 API.</p>\n<p>The <code>navigator.onLine</code> attribute returns:</p>\n<ul>\n<li><code>false</code> if all network requests are guaranteed to fail (e.g. when disconnected from the network).</li>\n<li><code>true</code> in all other cases.</li>\n</ul>\n<p>Since many cases return <code>true</code>, you should treat with care situations of\ngetting false positives, as we cannot always assume that <code>true</code> value means\nthat Electron can access the Internet. For example, in cases when the computer\nis running a virtualization software that has virtual Ethernet adapters in \"always\nconnected\" state. Therefore, if you want to determine the Internet access\nstatus of Electron, you should develop additional means for this check.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<p>Starting with an HTML file <code>index.html</code>, this example will demonstrate how the <code>navigator.onLine</code> API can be used to build a connection status indicator.</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"script-src 'self' 'unsafe-inline';\"</span> /></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Connection status: <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">strong</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">'status'</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">strong</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>In order to mutate the DOM, create a <code>renderer.js</code> file that adds event listeners to the <code>'online'</code> and <code>'offline'</code> <code>window</code> events. The event handler sets the content of the <code>&#x3C;strong id='status'></code> element depending on the result of <code>navigator.onLine</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">updateOnlineStatus</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'status'</span>).innerHTML = navigator.onLine ? <span class=\"hljs-string\">'online'</span> : <span class=\"hljs-string\">'offline'</span>\n}\n\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'online'</span>, updateOnlineStatus)\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'offline'</span>, updateOnlineStatus)\n\nupdateOnlineStatus()\n</code></pre>\n<p>Finally, create a <code>main.js</code> file for main process that creates the window.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> onlineStatusWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">400</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">100</span>\n  })\n\n  onlineStatusWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n      createWindow()\n    }\n  })\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n</code></pre>\n<p>After launching the Electron application, you should see the notification:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/connection-status.png\" alt=\"Connection status\"></p>\n<blockquote>\n<p>Note: If you need to communicate the connection status to the main process, use the <a href=\"/docs/api/ipc-renderer\">IPC renderer</a> API.</p>\n</blockquote>",
      "title": "Online/Offline Event Detection",
      "description": "Note: If you need to communicate the connection status to the main process, use the IPC renderer API."
    },
    "/docs/development/patches": {
      "locale": "en-US",
      "slug": "patches",
      "href": "/docs/development/patches",
      "crowdinFileId": "256161",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/patches.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"patches-in-electron\"><a href=\"#patches-in-electron\">Patches in Electron</a></h1>\n<p>Electron is built on two major upstream projects: Chromium and Node.js. Each of these projects has several of their own dependencies, too. We try our best to use these dependencies exactly as they are but sometimes we can't achieve our goals without patching those upstream dependencies to fit our use cases.</p>\n<h2 id=\"patch-justification\"><a href=\"#patch-justification\">Patch justification</a></h2>\n<p>Every patch in Electron is a maintenance burden. When upstream code changes, patches can break—sometimes without even a patch conflict or a compilation error. It's an ongoing effort to keep our patch set up-to-date and effective. So we strive to keep our patch count at a minimum. To that end, every patch must describe its reason for existence in its commit message. That reason must be one of the following:</p>\n<ol>\n<li>The patch is temporary, and is intended to be (or has been) committed upstream or otherwise eventually removed. Include a link to an upstream PR or code review if available, or a procedure for verifying whether the patch is still needed at a later date.</li>\n<li>The patch allows the code to compile in the Electron environment, but cannot be upstreamed because it's Electron-specific (e.g. patching out references to Chrome's <code>Profile</code>). Include reasoning about why the change cannot be implemented without a patch (e.g. by subclassing or copying the code).</li>\n<li>The patch makes Electron-specific changes in functionality which are fundamentally incompatible with upstream.</li>\n</ol>\n<p>In general, all the upstream projects we work with are friendly folks and are often happy to accept refactorings that allow the code in question to be compatible with both Electron and the upstream project. (See e.g. <a href=\"https://chromium-review.googlesource.com/c/chromium/src/+/1637040\">this</a> change in Chromium, which allowed us to remove a patch that did the same thing, or <a href=\"https://github.com/nodejs/node/pull/22110\">this</a> change in Node, which was a no-op for Node but fixed a bug in Electron.) <strong>We should aim to upstream changes whenever we can, and avoid indefinite-lifetime patches</strong>.</p>\n<h2 id=\"patch-system\"><a href=\"#patch-system\">Patch system</a></h2>\n<p>If you find yourself in the unfortunate position of having to make a change which can only be made through patching an upstream project, you'll need to know how to manage patches in Electron.</p>\n<p>All patches to upstream projects in Electron are contained in the <code>patches/</code> directory. Each subdirectory of <code>patches/</code> contains several patch files, along with a <code>.patches</code> file which lists the order in which the patches should be applied. Think of these files as making up a series of git commits that are applied on top of the upstream project after we check it out.</p>\n<pre><code class=\"hljs language-plaintext\">patches\n├── config.json   &#x3C;-- this describes which patchset directory is applied to what project\n├── chromium\n│   ├── .patches\n│   ├── accelerator.patch\n│   ├── add_contentgpuclient_precreatemessageloop_callback.patch\n│   ⋮\n├── node\n│   ├── .patches\n│   ├── add_openssl_is_boringssl_guard_to_oaep_hash_check.patch\n│   ├── build_add_gn_build_files.patch\n│   ⋮\n⋮\n</code></pre>\n<p>To help manage these patch sets, we provide two tools: <code>git-import-patches</code> and <code>git-export-patches</code>. <code>git-import-patches</code> imports a set of patch files into a git repository by applying each patch in the correct order and creating a commit for each one. <code>git-export-patches</code> does the reverse; it exports a series of git commits in a repository into a set of files in a directory and an accompanying <code>.patches</code> file.</p>\n<blockquote>\n<p>Side note: the reason we use a <code>.patches</code> file to maintain the order of applied patches, rather than prepending a number like <code>001-</code> to each file, is because it reduces conflicts related to patch ordering. It prevents the situation where two PRs both add a patch at the end of the series with the same numbering and end up both getting merged resulting in a duplicate identifier, and it also reduces churn when a patch is added or deleted in the middle of the series.</p>\n</blockquote>\n<h3 id=\"usage\"><a href=\"#usage\">Usage</a></h3>\n<h4 id=\"adding-a-new-patch\"><a href=\"#adding-a-new-patch\">Adding a new patch</a></h4>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n$ vim some/code/file.cc\n$ git commit\n$ ../../electron/script/git-export-patches -o ../../electron/patches/node\n</code></pre>\n<blockquote>\n<p><strong>NOTE</strong>: <code>git-export-patches</code> ignores any uncommitted files, so you must create a commit if you want your changes to be exported. The subject line of the commit message will be used to derive the patch file name, and the body of the commit message should include the reason for the patch's existence.</p>\n</blockquote>\n<p>Re-exporting patches will sometimes cause shasums in unrelated patches to change. This is generally harmless and can be ignored (but go ahead and add those changes to your PR, it'll stop them from showing up for other people).</p>\n<h4 id=\"editing-an-existing-patch\"><a href=\"#editing-an-existing-patch\">Editing an existing patch</a></h4>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/v8\n$ vim some/code/file.cc\n$ git <span class=\"hljs-built_in\">log</span>\n<span class=\"hljs-comment\"># Find the commit sha of the patch you want to edit.</span>\n$ git commit --fixup [COMMIT_SHA]\n$ git rebase --autosquash -i [COMMIT_SHA]^\n$ ../electron/script/git-export-patches -o ../electron/patches/v8\n</code></pre>\n<h4 id=\"removing-a-patch\"><a href=\"#removing-a-patch\">Removing a patch</a></h4>\n<pre><code class=\"hljs language-bash\">$ vim src/electron/patches/node/.patches\n<span class=\"hljs-comment\"># Delete the line with the name of the patch you want to remove</span>\n$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n$ git reset --hard refs/patches/upstream-head\n$ ../../electron/script/git-import-patches ../../electron/patches/node\n$ ../../electron/script/git-export-patches -o ../../electron/patches/node\n</code></pre>\n<p>Note that <code>git-import-patches</code> will mark the commit that was <code>HEAD</code> when it was run as <code>refs/patches/upstream-head</code>. This lets you keep track of which commits are from Electron patches (those that come after <code>refs/patches/upstream-head</code>) and which commits are in upstream (those before <code>refs/patches/upstream-head</code>).</p>\n<h4 id=\"resolving-conflicts\"><a href=\"#resolving-conflicts\">Resolving conflicts</a></h4>\n<p>When updating an upstream dependency, patches may fail to apply cleanly. Often, the conflict can be resolved automatically by git with a 3-way merge. You can instruct <code>git-import-patches</code> to use the 3-way merge algorithm by passing the <code>-3</code> argument:</p>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n<span class=\"hljs-comment\"># If the patch application failed midway through, you can reset it with:</span>\n$ git am --abort\n<span class=\"hljs-comment\"># And then retry with 3-way merge:</span>\n$ ../../electron/script/git-import-patches -3 ../../electron/patches/node\n</code></pre>\n<p>If <code>git-import-patches -3</code> encounters a merge conflict that it can't resolve automatically, it will pause and allow you to resolve the conflict manually. Once you have resolved the conflict, <code>git add</code> the resolved files and continue to apply the rest of the patches by running <code>git am --continue</code>.</p>",
      "title": "Patches in Electron",
      "description": "Side note: the reason we use a .patches file to maintain the order of applied patches, rather than prepending a number like 001- to each file, is because it reduces conflicts related to patch ordering. It prevents the situation where two PRs both add a patch at the end of the series with the same numbering and end up both getting merged resulting in a duplicate identifier, and it also reduces churn when a patch is added or deleted in the middle of the series."
    },
    "/docs/tutorial/performance": {
      "locale": "en-US",
      "slug": "performance",
      "href": "/docs/tutorial/performance",
      "crowdinFileId": "256231",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/performance.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"performance\"><a href=\"#performance\">Performance</a></h1>\n<p>Developers frequently ask about strategies to optimize the performance of\nElectron applications. Software engineers, consumers, and framework developers\ndo not always agree on one single definition of what \"performance\" means. This\ndocument outlines some of the Electron maintainers' favorite ways to reduce the\namount of memory, CPU, and disk resources being used while ensuring that your\napp is responsive to user input and completes operations as quickly as\npossible. Furthermore, we want all performance strategies to maintain a high\nstandard for your app's security.</p>\n<p>Wisdom and information about how to build performant websites with JavaScript\ngenerally applies to Electron apps, too. To a certain extent, resources\ndiscussing how to build performant Node.js applications also apply, but be\ncareful to understand that the term \"performance\" means different things for\na Node.js backend than it does for an application running on a client.</p>\n<p>This list is provided for your convenience – and is, much like our\n<a href=\"/docs/tutorial/security\">security checklist</a> – not meant to exhaustive. It is probably possible\nto build a slow Electron app that follows all the steps outlined below. Electron\nis a powerful development platform that enables you, the developer, to do more\nor less whatever you want. All that freedom means that performance is largely\nyour responsibility.</p>\n<h2 id=\"measure-measure-measure\"><a href=\"#measure-measure-measure\">Measure, Measure, Measure</a></h2>\n<p>The list below contains a number of steps that are fairly straightforward and\neasy to implement. However, building the most performant version of your app\nwill require you to go beyond a number of steps. Instead, you will have to\nclosely examine all the code running in your app by carefully profiling and\nmeasuring. Where are the bottlenecks? When the user clicks a button, what\noperations take up the brunt of the time? While the app is simply idling, which\nobjects take up the most memory?</p>\n<p>Time and time again, we have seen that the most successful strategy for building\na performant Electron app is to profile the running code, find the most\nresource-hungry piece of it, and to optimize it. Repeating this seemingly\nlaborious process over and over again will dramatically increase your app's\nperformance. Experience from working with major apps like Visual Studio Code or\nSlack has shown that this practice is by far the most reliable strategy to\nimprove performance.</p>\n<p>To learn more about how to profile your app's code, familiarize yourself with\nthe Chrome Developer Tools. For advanced analysis looking at multiple processes\nat once, consider the <a href=\"https://www.chromium.org/developers/how-tos/trace-event-profiling-tool\">Chrome Tracing</a> tool.</p>\n<h3 id=\"recommended-reading\"><a href=\"#recommended-reading\">Recommended Reading</a></h3>\n<ul>\n<li><a href=\"https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/\">Get Started With Analyzing Runtime Performance</a></li>\n<li><a href=\"https://www.youtube.com/watch?v=r0OeHRUCCb4\">Talk: \"Visual Studio Code - The First Second\"</a></li>\n</ul>\n<h2 id=\"checklist\"><a href=\"#checklist\">Checklist</a></h2>\n<p>Chances are that your app could be a little leaner, faster, and generally less\nresource-hungry if you attempt these steps.</p>\n<ol>\n<li><a href=\"#1-carelessly-including-modules\">Carelessly including modules</a></li>\n<li><a href=\"#2-loading-and-running-code-too-soon\">Loading and running code too soon</a></li>\n<li><a href=\"#3-blocking-the-main-process\">Blocking the main process</a></li>\n<li><a href=\"#4-blocking-the-renderer-process\">Blocking the renderer process</a></li>\n<li><a href=\"#5-unnecessary-polyfills\">Unnecessary polyfills</a></li>\n<li><a href=\"#6-unnecessary-or-blocking-network-requests\">Unnecessary or blocking network requests</a></li>\n<li><a href=\"#7-bundle-your-code\">Bundle your code</a></li>\n</ol>\n<h2 id=\"1-carelessly-including-modules\"><a href=\"#1-carelessly-including-modules\">1) Carelessly including modules</a></h2>\n<p>Before adding a Node.js module to your application, examine said module. How\nmany dependencies does that module include? What kind of resources does\nit need to simply be called in a <code>require()</code> statement? You might find\nthat the module with the most downloads on the NPM package registry or the most stars on GitHub\nis not in fact the leanest or smallest one available.</p>\n<h3 id=\"why\"><a href=\"#why\">Why?</a></h3>\n<p>The reasoning behind this recommendation is best illustrated with a real-world\nexample. During the early days of Electron, reliable detection of network\nconnectivity was a problem, resulting many apps to use a module that exposed a\nsimple <code>isOnline()</code> method.</p>\n<p>That module detected your network connectivity by attempting to reach out to a\nnumber of well-known endpoints. For the list of those endpoints, it depended on\na different module, which also contained a list of well-known ports. This\ndependency itself relied on a module containing information about ports, which\ncame in the form of a JSON file with more than 100,000 lines of content.\nWhenever the module was loaded (usually in a <code>require('module')</code> statement),\nit would load all its dependencies and eventually read and parse this JSON\nfile. Parsing many thousands lines of JSON is a very expensive operation. On\na slow machine it can take up whole seconds of time.</p>\n<p>In many server contexts, startup time is virtually irrelevant. A Node.js server\nthat requires information about all ports is likely actually \"more performant\"\nif it loads all required information into memory whenever the server boots at\nthe benefit of serving requests faster. The module discussed in this example is\nnot a \"bad\" module. Electron apps, however, should not be loading, parsing, and\nstoring in memory information that it does not actually need.</p>\n<p>In short, a seemingly excellent module written primarily for Node.js servers\nrunning Linux might be bad news for your app's performance. In this particular\nexample, the correct solution was to use no module at all, and to instead use\nconnectivity checks included in later versions of Chromium.</p>\n<h3 id=\"how\"><a href=\"#how\">How?</a></h3>\n<p>When considering a module, we recommend that you check:</p>\n<ol>\n<li>the size of dependencies included</li>\n<li>the resources required to load (<code>require()</code>) it</li>\n<li>the resources required to perform the action you're interested in</li>\n</ol>\n<p>Generating a CPU profile and a heap memory profile for loading a module can be done\nwith a single command on the command line. In the example below, we're looking at\nthe popular module <code>request</code>.</p>\n<pre><code class=\"hljs language-sh\">node --cpu-prof --heap-prof -e <span class=\"hljs-string\">\"require('request')\"</span>\n</code></pre>\n<p>Executing this command results in a <code>.cpuprofile</code> file and a <code>.heapprofile</code>\nfile in the directory you executed it in. Both files can be analyzed using\nthe Chrome Developer Tools, using the <code>Performance</code> and <code>Memory</code> tabs\nrespectively.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/performance-cpu-prof.png\" alt=\"Performance CPU Profile\"></p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/performance-heap-prof.png\" alt=\"Performance Heap Memory Profile\"></p>\n<p>In this example, on the author's machine, we saw that loading <code>request</code> took\nalmost half a second, whereas <code>node-fetch</code> took dramatically less memory\nand less than 50ms.</p>\n<h2 id=\"2-loading-and-running-code-too-soon\"><a href=\"#2-loading-and-running-code-too-soon\">2) Loading and running code too soon</a></h2>\n<p>If you have expensive setup operations, consider deferring those. Inspect all\nthe work being executed right after the application starts. Instead of firing\noff all operations right away, consider staggering them in a sequence more\nclosely aligned with the user's journey.</p>\n<p>In traditional Node.js development, we're used to putting all our <code>require()</code>\nstatements at the top. If you're currently writing your Electron application\nusing the same strategy <em>and</em> are using sizable modules that you do not\nimmediately need, apply the same strategy and defer loading to a more\nopportune time.</p>\n<h3 id=\"why-1\"><a href=\"#why-1\">Why?</a></h3>\n<p>Loading modules is a surprisingly expensive operation, especially on Windows.\nWhen your app starts, it should not make users wait for operations that are\ncurrently not necessary.</p>\n<p>This might seem obvious, but many applications tend to do a large amount of\nwork immediately after the app has launched - like checking for updates,\ndownloading content used in a later flow, or performing heavy disk I/O\noperations.</p>\n<p>Let's consider Visual Studio Code as an example. When you open a file, it will\nimmediately display the file to you without any code highlighting, prioritizing\nyour ability to interact with the text. Once it has done that work, it will\nmove on to code highlighting.</p>\n<h3 id=\"how-1\"><a href=\"#how-1\">How?</a></h3>\n<p>Let's consider an example and assume that your application is parsing files\nin the fictitious <code>.foo</code> format. In order to do that, it relies on the\nequally fictitious <code>foo-parser</code> module. In traditional Node.js development,\nyou might write code that eagerly loads dependencies:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> fooParser = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'foo-parser'</span>)\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">Parser</span> </span>{\n  <span class=\"hljs-keyword\">constructor</span> () {\n    <span class=\"hljs-keyword\">this</span>.files = fs.readdirSync(<span class=\"hljs-string\">'.'</span>)\n  }\n\n  getParsedFiles () {\n    <span class=\"hljs-keyword\">return</span> fooParser.parse(<span class=\"hljs-keyword\">this</span>.files)\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> parser = <span class=\"hljs-keyword\">new</span> Parser()\n\n<span class=\"hljs-built_in\">module</span>.exports = { parser }\n</code></pre>\n<p>In the above example, we're doing a lot of work that's being executed as soon\nas the file is loaded. Do we need to get parsed files right away? Could we\ndo this work a little later, when <code>getParsedFiles()</code> is actually called?</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// \"fs\" is likely already being loaded, so the `require()` call is cheap</span>\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">Parser</span> </span>{\n  <span class=\"hljs-keyword\">async</span> getFiles () {\n    <span class=\"hljs-comment\">// Touch the disk as soon as `getFiles` is called, not sooner.</span>\n    <span class=\"hljs-comment\">// Also, ensure that we're not blocking other operations by using</span>\n    <span class=\"hljs-comment\">// the asynchronous version.</span>\n    <span class=\"hljs-keyword\">this</span>.files = <span class=\"hljs-keyword\">this</span>.files || <span class=\"hljs-keyword\">await</span> fs.readdir(<span class=\"hljs-string\">'.'</span>)\n\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-keyword\">this</span>.files\n  }\n\n  <span class=\"hljs-keyword\">async</span> getParsedFiles () {\n    <span class=\"hljs-comment\">// Our fictitious foo-parser is a big and expensive module to load, so</span>\n    <span class=\"hljs-comment\">// defer that work until we actually need to parse files.</span>\n    <span class=\"hljs-comment\">// Since `require()` comes with a module cache, the `require()` call</span>\n    <span class=\"hljs-comment\">// will only be expensive once - subsequent calls of `getParsedFiles()`</span>\n    <span class=\"hljs-comment\">// will be faster.</span>\n    <span class=\"hljs-keyword\">const</span> fooParser = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'foo-parser'</span>)\n    <span class=\"hljs-keyword\">const</span> files = <span class=\"hljs-keyword\">await</span> <span class=\"hljs-keyword\">this</span>.getFiles()\n\n    <span class=\"hljs-keyword\">return</span> fooParser.parse(files)\n  }\n}\n\n<span class=\"hljs-comment\">// This operation is now a lot cheaper than in our previous example</span>\n<span class=\"hljs-keyword\">const</span> parser = <span class=\"hljs-keyword\">new</span> Parser()\n\n<span class=\"hljs-built_in\">module</span>.exports = { parser }\n</code></pre>\n<p>In short, allocate resources \"just in time\" rather than allocating them all\nwhen your app starts.</p>\n<h2 id=\"3-blocking-the-main-process\"><a href=\"#3-blocking-the-main-process\">3) Blocking the main process</a></h2>\n<p>Electron's main process (sometimes called \"browser process\") is special: It is\nthe parent process to all your app's other processes and the primary process\nthe operating system interacts with. It handles windows, interactions, and the\ncommunication between various components inside your app. It also houses the\nUI thread.</p>\n<p>Under no circumstances should you block this process and the UI thread with\nlong-running operations. Blocking the UI thread means that your entire app\nwill freeze until the main process is ready to continue processing.</p>\n<h3 id=\"why-2\"><a href=\"#why-2\">Why?</a></h3>\n<p>The main process and its UI thread are essentially the control tower for major\noperations inside your app. When the operating system tells your app about a\nmouse click, it'll go through the main process before it reaches your window.\nIf your window is rendering a buttery-smooth animation, it'll need to talk to\nthe GPU process about that – once again going through the main process.</p>\n<p>Electron and Chromium are careful to put heavy disk I/O and CPU-bound operations\nonto new threads to avoid blocking the UI thread. You should do the same.</p>\n<h3 id=\"how-2\"><a href=\"#how-2\">How?</a></h3>\n<p>Electron's powerful multi-process architecture stands ready to assist you with\nyour long-running tasks, but also includes a small number of performance traps.</p>\n<p>1) For long running CPU-heavy tasks, make use of\n<a href=\"https://nodejs.org/api/worker_threads.html\">worker threads</a>, consider moving them to the BrowserWindow, or\n(as a last resort) spawn a dedicated process.</p>\n<p>2) Avoid using the synchronous IPC and the <code>remote</code> module as much as possible.\nWhile there are legitimate use cases, it is far too easy to unknowingly block\nthe UI thread using the <code>remote</code> module.</p>\n<p>3) Avoid using blocking I/O operations in the main process. In short, whenever\ncore Node.js modules (like <code>fs</code> or <code>child_process</code>) offer a synchronous or an\nasynchronous version, you should prefer the asynchronous and non-blocking\nvariant.</p>\n<h2 id=\"4-blocking-the-renderer-process\"><a href=\"#4-blocking-the-renderer-process\">4) Blocking the renderer process</a></h2>\n<p>Since Electron ships with a current version of Chrome, you can make use of the\nlatest and greatest features the Web Platform offers to defer or offload heavy\noperations in a way that keeps your app smooth and responsive.</p>\n<h3 id=\"why-3\"><a href=\"#why-3\">Why?</a></h3>\n<p>Your app probably has a lot of JavaScript to run in the renderer process. The\ntrick is to execute operations as quickly as possible without taking away\nresources needed to keep scrolling smooth, respond to user input, or animations\nat 60fps.</p>\n<p>Orchestrating the flow of operations in your renderer's code is\nparticularly useful if users complain about your app sometimes \"stuttering\".</p>\n<h3 id=\"how-3\"><a href=\"#how-3\">How?</a></h3>\n<p>Generally speaking, all advice for building performant web apps for modern\nbrowsers apply to Electron's renderers, too. The two primary tools at your\ndisposal  are currently <code>requestIdleCallback()</code> for small operations and\n<code>Web Workers</code> for long-running operations.</p>\n<p><em><code>requestIdleCallback()</code></em> allows developers to queue up a function to be\nexecuted as soon as the process is entering an idle period. It enables you to\nperform low-priority or background work without impacting the user experience.\nFor more information about how to use it,\n<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\">check out its documentation on MDN</a>.</p>\n<p><em>Web Workers</em> are a powerful tool to run code on a separate thread. There are\nsome caveats to consider – consult Electron's\n<a href=\"/docs/tutorial/multithreading\">multithreading documentation</a> and the\n<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers\">MDN documentation for Web Workers</a>. They're an ideal solution\nfor any operation that requires a lot of CPU power for an extended period of\ntime.</p>\n<h2 id=\"5-unnecessary-polyfills\"><a href=\"#5-unnecessary-polyfills\">5) Unnecessary polyfills</a></h2>\n<p>One of Electron's great benefits is that you know exactly which engine will\nparse your JavaScript, HTML, and CSS. If you're re-purposing code that was\nwritten for the web at large, make sure to not polyfill features included in\nElectron.</p>\n<h3 id=\"why-4\"><a href=\"#why-4\">Why?</a></h3>\n<p>When building a web application for today's Internet, the oldest environments\ndictate what features you can and cannot use. Even though Electron supports\nwell-performing CSS filters and animations, an older browser might not. Where\nyou could use WebGL, your developers may have chosen a more resource-hungry\nsolution to support older phones.</p>\n<p>When it comes to JavaScript, you may have included toolkit libraries like\njQuery for DOM selectors or polyfills like the <code>regenerator-runtime</code> to support\n<code>async/await</code>.</p>\n<p>It is rare for a JavaScript-based polyfill to be faster than the equivalent\nnative feature in Electron. Do not slow down your Electron app by shipping your\nown version of standard web platform features.</p>\n<h3 id=\"how-4\"><a href=\"#how-4\">How?</a></h3>\n<p>Operate under the assumption that polyfills in current versions of Electron\nare unnecessary. If you have doubts, check <a href=\"https://caniuse.com/\">caniuse.com</a>\nand check if the <a href=\"/docs/api/process#processversionschrome-readonly\">version of Chromium used in your Electron version</a>\nsupports the feature you desire.</p>\n<p>In addition, carefully examine the libraries you use. Are they really necessary?\n<code>jQuery</code>, for example, was such a success that many of its features are now part\nof the <a href=\"http://youmightnotneedjquery.com/\">standard JavaScript feature set available</a>.</p>\n<p>If you're using a transpiler/compiler like TypeScript, examine its configuration\nand ensure that you're targeting the latest ECMAScript version supported by\nElectron.</p>\n<h2 id=\"6-unnecessary-or-blocking-network-requests\"><a href=\"#6-unnecessary-or-blocking-network-requests\">6) Unnecessary or blocking network requests</a></h2>\n<p>Avoid fetching rarely changing resources from the internet if they could easily\nbe bundled with your application.</p>\n<h3 id=\"why-5\"><a href=\"#why-5\">Why?</a></h3>\n<p>Many users of Electron start with an entirely web-based app that they're\nturning into a desktop application. As web developers, we are used to loading\nresources from a variety of content delivery networks. Now that you are\nshipping a proper desktop application, attempt to \"cut the cord\" where possible\nand avoid letting your users wait for resources that never change and could\neasily be included  in your app.</p>\n<p>A typical example is Google Fonts. Many developers make use of Google's\nimpressive collection of free fonts, which comes with a content delivery\nnetwork. The pitch is straightforward: Include a few lines of CSS and Google\nwill take care of the rest.</p>\n<p>When building an Electron app, your users are better served if you download\nthe fonts and include them in your app's bundle.</p>\n<h3 id=\"how-5\"><a href=\"#how-5\">How?</a></h3>\n<p>In an ideal world, your application wouldn't need the network to operate at\nall. To get there, you must understand what resources your app is downloading\n- and how large those resources are.</p>\n<p>To do so, open up the developer tools. Navigate to the <code>Network</code> tab and check\nthe <code>Disable cache</code> option. Then, reload your renderer. Unless your app\nprohibits such reloads, you can usually trigger a reload by hitting <code>Cmd + R</code>\nor <code>Ctrl + R</code> with the developer tools in focus.</p>\n<p>The tools will now meticulously record all network requests. In a first pass,\ntake stock of all the resources being downloaded, focusing on the larger files\nfirst. Are any of them images, fonts, or media files that don't change and\ncould be included with your bundle? If so, include them.</p>\n<p>As a next step, enable <code>Network Throttling</code>. Find the drop-down that currently\nreads <code>Online</code> and select a slower speed such as <code>Fast 3G</code>. Reload your\nrenderer and see if there are any resources that your app is unnecessarily\nwaiting for. In many cases, an app will wait for a network request to complete\ndespite not actually needing the involved resource.</p>\n<p>As a tip, loading resources from the Internet that you might want to change\nwithout shipping an application update is a powerful strategy. For advanced\ncontrol over how resources are being loaded, consider investing in\n<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API\">Service Workers</a>.</p>\n<h2 id=\"7-bundle-your-code\"><a href=\"#7-bundle-your-code\">7) Bundle your code</a></h2>\n<p>As already pointed out in\n\"<a href=\"#2-loading-and-running-code-too-soon\">Loading and running code too soon</a>\",\ncalling <code>require()</code> is an expensive operation. If you are able to do so,\nbundle your application's code into a single file.</p>\n<h3 id=\"why-6\"><a href=\"#why-6\">Why?</a></h3>\n<p>Modern JavaScript development usually involves many files and modules. While\nthat's perfectly fine for developing with Electron, we heavily recommend that\nyou bundle all your code into one single file to ensure that the overhead\nincluded in calling <code>require()</code> is only paid once when your application loads.</p>\n<h3 id=\"how-6\"><a href=\"#how-6\">How?</a></h3>\n<p>There are numerous JavaScript bundlers out there and we know better than to\nanger the community by recommending one tool over another. We do however\nrecommend that you use a bundler that is able to handle Electron's unique\nenvironment that needs to handle both Node.js and browser environments.</p>\n<p>As of writing this article, the popular choices include <a href=\"https://webpack.js.org/\">Webpack</a>,\n<a href=\"https://parceljs.org/\">Parcel</a>, and <a href=\"https://rollupjs.org/\">rollup.js</a>.</p>",
      "title": "Performance",
      "description": ""
    },
    "/docs/api/structures/point": {
      "locale": "en-US",
      "slug": "point",
      "href": "/docs/api/structures/point",
      "crowdinFileId": "256475",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/point.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"point-object\"><a href=\"#point-object\">Point Object</a></h1>\n<ul>\n<li><code>x</code> Number</li>\n<li><code>y</code> Number</li>\n</ul>\n<p><strong>Note:</strong> Both <code>x</code> and <code>y</code> must be whole integers, when providing a point object\nas input to an Electron API we will automatically round your <code>x</code> and <code>y</code> values\nto the nearest whole integer.</p>",
      "title": "Point Object",
      "description": ""
    },
    "/docs/api/structures/post-body": {
      "locale": "en-US",
      "slug": "post-body",
      "href": "/docs/api/structures/post-body",
      "crowdinFileId": "256477",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/post-body.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"postbody-object\"><a href=\"#postbody-object\">PostBody Object</a></h1>\n<ul>\n<li><code>data</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)[] - The post data to be sent to the\nnew window.</li>\n<li><code>contentType</code> String - The <code>content-type</code> header used for the data. One of\n<code>application/x-www-form-urlencoded</code> or <code>multipart/form-data</code>. Corresponds to\nthe <code>enctype</code> attribute of the submitted HTML form.</li>\n<li><code>boundary</code> String (optional) - The boundary used to separate multiple parts of\nthe message. Only valid when <code>contentType</code> is <code>multipart/form-data</code>.</li>\n</ul>\n<p>Note that keys starting with <code>--</code> are not currently supported. For example, this will errantly submit as <code>multipart/form-data</code> when <code>nativeWindowOpen</code> is set to <code>false</code> in webPreferences:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">form</span>\n  <span class=\"hljs-attr\">target</span>=<span class=\"hljs-string\">\"_blank\"</span>\n  <span class=\"hljs-attr\">method</span>=<span class=\"hljs-string\">\"POST\"</span>\n  <span class=\"hljs-attr\">enctype</span>=<span class=\"hljs-string\">\"application/x-www-form-urlencoded\"</span>\n  <span class=\"hljs-attr\">action</span>=<span class=\"hljs-string\">\"https://postman-echo.com/post\"</span>\n></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">input</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text\"</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">\"--theKey\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">input</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"submit\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">form</span>></span>\n</code></pre>",
      "title": "PostBody Object",
      "description": ""
    },
    "/docs/api/power-monitor": {
      "locale": "en-US",
      "slug": "power-monitor",
      "href": "/docs/api/power-monitor",
      "crowdinFileId": "256351",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/power-monitor.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"powermonitor\"><a href=\"#powermonitor\">powerMonitor</a></h1>\n<blockquote>\n<p>Monitor power state changes.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h2 id=\"events\"><a href=\"#events\">Events</a></h2>\n<p>The <code>powerMonitor</code> module emits the following events:</p>\n<h3 id=\"event-suspend\"><a href=\"#event-suspend\">Event: 'suspend'</a></h3>\n<p>Emitted when the system is suspending.</p>\n<h3 id=\"event-resume\"><a href=\"#event-resume\">Event: 'resume'</a></h3>\n<p>Emitted when system is resuming.</p>\n<h3 id=\"event-on-ac-macos-windows\"><a href=\"#event-on-ac-macos-windows\">Event: 'on-ac' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Emitted when the system changes to AC power.</p>\n<h3 id=\"event-on-battery-macos--windows\"><a href=\"#event-on-battery-macos--windows\">Event: 'on-battery' <em>macOS</em>  <em>Windows</em></a></h3>\n<p>Emitted when system changes to battery power.</p>\n<h3 id=\"event-shutdown-linux-macos\"><a href=\"#event-shutdown-linux-macos\">Event: 'shutdown' <em>Linux</em> <em>macOS</em></a></h3>\n<p>Emitted when the system is about to reboot or shut down. If the event handler\ninvokes <code>e.preventDefault()</code>, Electron will attempt to delay system shutdown in\norder for the app to exit cleanly. If <code>e.preventDefault()</code> is called, the app\nshould exit as soon as possible by calling something like <code>app.quit()</code>.</p>\n<h3 id=\"event-lock-screen-macos-windows\"><a href=\"#event-lock-screen-macos-windows\">Event: 'lock-screen' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Emitted when the system is about to lock the screen.</p>\n<h3 id=\"event-unlock-screen-macos-windows\"><a href=\"#event-unlock-screen-macos-windows\">Event: 'unlock-screen' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Emitted as soon as the systems screen is unlocked.</p>\n<h3 id=\"event-user-did-become-active-macos\"><a href=\"#event-user-did-become-active-macos\">Event: 'user-did-become-active' <em>macOS</em></a></h3>\n<p>Emitted when a login session is activated. See <a href=\"https://developer.apple.com/documentation/appkit/nsworkspacesessiondidbecomeactivenotification?language=objc\">documentation</a> for more information.</p>\n<h3 id=\"event-user-did-resign-active-macos\"><a href=\"#event-user-did-resign-active-macos\">Event: 'user-did-resign-active' <em>macOS</em></a></h3>\n<p>Emitted when a login session is deactivated. See <a href=\"https://developer.apple.com/documentation/appkit/nsworkspacesessiondidresignactivenotification?language=objc\">documentation</a> for more information.</p>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>powerMonitor</code> module has the following methods:</p>\n<h3 id=\"powermonitorgetsystemidlestateidlethreshold\"><a href=\"#powermonitorgetsystemidlestateidlethreshold\"><code>powerMonitor.getSystemIdleState(idleThreshold)</code></a></h3>\n<ul>\n<li><code>idleThreshold</code> Integer</li>\n</ul>\n<p>Returns <code>String</code> - The system's current state. Can be <code>active</code>, <code>idle</code>, <code>locked</code> or <code>unknown</code>.</p>\n<p>Calculate the system idle state. <code>idleThreshold</code> is the amount of time (in seconds)\nbefore considered idle.  <code>locked</code> is available on supported systems only.</p>\n<h3 id=\"powermonitorgetsystemidletime\"><a href=\"#powermonitorgetsystemidletime\"><code>powerMonitor.getSystemIdleTime()</code></a></h3>\n<p>Returns <code>Integer</code> - Idle time in seconds</p>\n<p>Calculate system idle time in seconds.</p>\n<h3 id=\"powermonitorisonbatterypower\"><a href=\"#powermonitorisonbatterypower\"><code>powerMonitor.isOnBatteryPower()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the system is on battery power.</p>\n<p>To monitor for changes in this property, use the <code>on-battery</code> and <code>on-ac</code>\nevents.</p>\n<h2 id=\"properties\"><a href=\"#properties\">Properties</a></h2>\n<h3 id=\"powermonitoronbatterypower\"><a href=\"#powermonitoronbatterypower\"><code>powerMonitor.onBatteryPower</code></a></h3>\n<p>A <code>Boolean</code> property. True if the system is on battery power.</p>\n<p>See <a href=\"#powermonitorisonbatterypower\"><code>powerMonitor.isOnBatteryPower()</code></a>.</p>",
      "title": "powerMonitor",
      "description": "Monitor power state changes."
    },
    "/docs/api/power-save-blocker": {
      "locale": "en-US",
      "slug": "power-save-blocker",
      "href": "/docs/api/power-save-blocker",
      "crowdinFileId": "256353",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/power-save-blocker.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"powersaveblocker\"><a href=\"#powersaveblocker\">powerSaveBlocker</a></h1>\n<blockquote>\n<p>Block the system from entering low-power (sleep) mode.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>For example:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { powerSaveBlocker } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> id = powerSaveBlocker.start(<span class=\"hljs-string\">'prevent-display-sleep'</span>)\n<span class=\"hljs-built_in\">console</span>.log(powerSaveBlocker.isStarted(id))\n\npowerSaveBlocker.stop(id)\n</code></pre>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>powerSaveBlocker</code> module has the following methods:</p>\n<h3 id=\"powersaveblockerstarttype\"><a href=\"#powersaveblockerstarttype\"><code>powerSaveBlocker.start(type)</code></a></h3>\n<ul>\n<li><code>type</code> String - Power save blocker type.<ul>\n<li><code>prevent-app-suspension</code> - Prevent the application from being suspended.\nKeeps system active but allows screen to be turned off. Example use cases:\ndownloading a file or playing audio.</li>\n<li><code>prevent-display-sleep</code> - Prevent the display from going to sleep. Keeps\nsystem and screen active. Example use case: playing video.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code> - The blocker ID that is assigned to this power blocker.</p>\n<p>Starts preventing the system from entering lower-power mode. Returns an integer\nidentifying the power save blocker.</p>\n<p><strong>Note:</strong> <code>prevent-display-sleep</code> has higher precedence over\n<code>prevent-app-suspension</code>. Only the highest precedence type takes effect. In\nother words, <code>prevent-display-sleep</code> always takes precedence over\n<code>prevent-app-suspension</code>.</p>\n<p>For example, an API calling A requests for <code>prevent-app-suspension</code>, and\nanother calling B requests for <code>prevent-display-sleep</code>. <code>prevent-display-sleep</code>\nwill be used until B stops its request. After that, <code>prevent-app-suspension</code>\nis used.</p>\n<h3 id=\"powersaveblockerstopid\"><a href=\"#powersaveblockerstopid\"><code>powerSaveBlocker.stop(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer - The power save blocker id returned by <code>powerSaveBlocker.start</code>.</li>\n</ul>\n<p>Stops the specified power save blocker.</p>\n<h3 id=\"powersaveblockerisstartedid\"><a href=\"#powersaveblockerisstartedid\"><code>powerSaveBlocker.isStarted(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer - The power save blocker id returned by <code>powerSaveBlocker.start</code>.</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the corresponding <code>powerSaveBlocker</code> has started.</p>",
      "title": "powerSaveBlocker",
      "description": "Block the system from entering low-power (sleep) mode."
    },
    "/docs/api/structures/printer-info": {
      "locale": "en-US",
      "slug": "printer-info",
      "href": "/docs/api/structures/printer-info",
      "crowdinFileId": "256479",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/printer-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"printerinfo-object\"><a href=\"#printerinfo-object\">PrinterInfo Object</a></h1>\n<ul>\n<li><code>name</code> String - the name of the printer as understood by the OS.</li>\n<li><code>displayName</code> String - the name of the printer as shown in Print Preview.</li>\n<li><code>description</code> String - a longer description of the printer's type.</li>\n<li><code>status</code> Number - the current status of the printer.</li>\n<li><code>isDefault</code> Boolean - whether or not a given printer is set as the default printer on the OS.</li>\n<li><code>options</code> Object - an object containing a variable number of platform-specific printer information.</li>\n</ul>\n<p>The number represented by <code>status</code> means different things on different platforms: on Windows its potential values can be found <a href=\"https://docs.microsoft.com/en-us/windows/win32/printdocs/printer-info-2\">here</a>, and on Linux and macOS they can be found <a href=\"https://www.cups.org/doc/cupspm.html\">here</a>.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<p>Below is an example of some of the additional options that may be set which\nmay be different on each platform.</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Austin_4th_Floor_Printer___C02XK13BJHD4'</span>,\n  <span class=\"hljs-attr\">displayName</span>: <span class=\"hljs-string\">'Austin 4th Floor Printer @ C02XK13BJHD4'</span>,\n  <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'TOSHIBA ColorMFP'</span>,\n  <span class=\"hljs-attr\">status</span>: <span class=\"hljs-number\">3</span>,\n  <span class=\"hljs-attr\">isDefault</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">options</span>: {\n    <span class=\"hljs-attr\">copies</span>: <span class=\"hljs-string\">'1'</span>,\n    <span class=\"hljs-string\">'device-uri'</span>: <span class=\"hljs-string\">'dnssd://Austin%204th%20Floor%20Printer%20%40%20C02XK13BJHD4._ipps._tcp.local./?uuid=71687f1e-1147-3274-6674-22de61b110bd'</span>,\n    <span class=\"hljs-attr\">finishings</span>: <span class=\"hljs-string\">'3'</span>,\n    <span class=\"hljs-string\">'job-cancel-after'</span>: <span class=\"hljs-string\">'10800'</span>,\n    <span class=\"hljs-string\">'job-hold-until'</span>: <span class=\"hljs-string\">'no-hold'</span>,\n    <span class=\"hljs-string\">'job-priority'</span>: <span class=\"hljs-string\">'50'</span>,\n    <span class=\"hljs-string\">'job-sheets'</span>: <span class=\"hljs-string\">'none,none'</span>,\n    <span class=\"hljs-string\">'marker-change-time'</span>: <span class=\"hljs-string\">'0'</span>,\n    <span class=\"hljs-string\">'number-up'</span>: <span class=\"hljs-string\">'1'</span>,\n    <span class=\"hljs-string\">'printer-commands'</span>: <span class=\"hljs-string\">'ReportLevels,PrintSelfTestPage,com.toshiba.ColourProfiles.update,com.toshiba.EFiling.update,com.toshiba.EFiling.checkPassword'</span>,\n    <span class=\"hljs-string\">'printer-info'</span>: <span class=\"hljs-string\">'Austin 4th Floor Printer @ C02XK13BJHD4'</span>,\n    <span class=\"hljs-string\">'printer-is-accepting-jobs'</span>: <span class=\"hljs-string\">'true'</span>,\n    <span class=\"hljs-string\">'printer-is-shared'</span>: <span class=\"hljs-string\">'false'</span>,\n    <span class=\"hljs-string\">'printer-is-temporary'</span>: <span class=\"hljs-string\">'false'</span>,\n    <span class=\"hljs-string\">'printer-location'</span>: <span class=\"hljs-string\">''</span>,\n    <span class=\"hljs-string\">'printer-make-and-model'</span>: <span class=\"hljs-string\">'TOSHIBA ColorMFP'</span>,\n    <span class=\"hljs-string\">'printer-state'</span>: <span class=\"hljs-string\">'3'</span>,\n    <span class=\"hljs-string\">'printer-state-change-time'</span>: <span class=\"hljs-string\">'1573472937'</span>,\n    <span class=\"hljs-string\">'printer-state-reasons'</span>: <span class=\"hljs-string\">'offline-report,com.toshiba.snmp.failed'</span>,\n    <span class=\"hljs-string\">'printer-type'</span>: <span class=\"hljs-string\">'10531038'</span>,\n    <span class=\"hljs-string\">'printer-uri-supported'</span>: <span class=\"hljs-string\">'ipp://localhost/printers/Austin_4th_Floor_Printer___C02XK13BJHD4'</span>,\n    <span class=\"hljs-attr\">system_driverinfo</span>: <span class=\"hljs-string\">'T'</span>\n  }\n}\n</code></pre>",
      "title": "PrinterInfo Object",
      "description": ""
    },
    "/docs/api/process": {
      "locale": "en-US",
      "slug": "process",
      "href": "/docs/api/process",
      "crowdinFileId": "256355",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/process.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"process\"><a href=\"#process\">process</a></h1>\n<blockquote>\n<p>Extensions to process object.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>Electron's <code>process</code> object is extended from the\n<a href=\"https://nodejs.org/api/process.html\">Node.js <code>process</code> object</a>.\nIt adds the following events, properties, and methods:</p>\n<h2 id=\"sandbox\"><a href=\"#sandbox\">Sandbox</a></h2>\n<p>In sandboxed renderers the <code>process</code> object contains only a subset of the APIs:</p>\n<ul>\n<li><code>crash()</code></li>\n<li><code>hang()</code></li>\n<li><code>getCreationTime()</code></li>\n<li><code>getHeapStatistics()</code></li>\n<li><code>getBlinkMemoryInfo()</code></li>\n<li><code>getProcessMemoryInfo()</code></li>\n<li><code>getSystemMemoryInfo()</code></li>\n<li><code>getSystemVersion()</code></li>\n<li><code>getCPUUsage()</code></li>\n<li><code>getIOCounters()</code></li>\n<li><code>uptime()</code></li>\n<li><code>argv</code></li>\n<li><code>execPath</code></li>\n<li><code>env</code></li>\n<li><code>pid</code></li>\n<li><code>arch</code></li>\n<li><code>platform</code></li>\n<li><code>sandboxed</code></li>\n<li><code>contextIsolated</code></li>\n<li><code>type</code></li>\n<li><code>version</code></li>\n<li><code>versions</code></li>\n<li><code>mas</code></li>\n<li><code>windowsStore</code></li>\n<li><code>contextId</code></li>\n</ul>\n<h2 id=\"events\"><a href=\"#events\">Events</a></h2>\n<h3 id=\"event-loaded\"><a href=\"#event-loaded\">Event: 'loaded'</a></h3>\n<p>Emitted when Electron has loaded its internal initialization script and is\nbeginning to load the web page or the main script.</p>\n<h2 id=\"properties\"><a href=\"#properties\">Properties</a></h2>\n<h3 id=\"processdefaultapp-readonly\"><a href=\"#processdefaultapp-readonly\"><code>process.defaultApp</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>. When app is started by being passed as parameter to the default app, this\nproperty is <code>true</code> in the main process, otherwise it is <code>undefined</code>.</p>\n<h3 id=\"processismainframe-readonly\"><a href=\"#processismainframe-readonly\"><code>process.isMainFrame</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>, <code>true</code> when the current renderer context is the \"main\" renderer\nframe. If you want the ID of the current frame you should use <code>webFrame.routingId</code>.</p>\n<h3 id=\"processmas-readonly\"><a href=\"#processmas-readonly\"><code>process.mas</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>. For Mac App Store build, this property is <code>true</code>, for other builds it is\n<code>undefined</code>.</p>\n<h3 id=\"processnoasar\"><a href=\"#processnoasar\"><code>process.noAsar</code></a></h3>\n<p>A <code>Boolean</code> that controls ASAR support inside your application. Setting this to <code>true</code>\nwill disable the support for <code>asar</code> archives in Node's built-in modules.</p>\n<h3 id=\"processnodeprecation\"><a href=\"#processnodeprecation\"><code>process.noDeprecation</code></a></h3>\n<p>A <code>Boolean</code> that controls whether or not deprecation warnings are printed to <code>stderr</code>.\nSetting this to <code>true</code> will silence deprecation warnings. This property is used\ninstead of the <code>--no-deprecation</code> command line flag.</p>\n<h3 id=\"processresourcespath-readonly\"><a href=\"#processresourcespath-readonly\"><code>process.resourcesPath</code> <em>Readonly</em></a></h3>\n<p>A <code>String</code> representing the path to the resources directory.</p>\n<h3 id=\"processsandboxed-readonly\"><a href=\"#processsandboxed-readonly\"><code>process.sandboxed</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>. When the renderer process is sandboxed, this property is <code>true</code>,\notherwise it is <code>undefined</code>.</p>\n<h3 id=\"processcontextisolated-readonly\"><a href=\"#processcontextisolated-readonly\"><code>process.contextIsolated</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> that indicates whether the current renderer context has <code>contextIsolation</code> enabled.\nIt is <code>undefined</code> in the main process.</p>\n<h3 id=\"processthrowdeprecation\"><a href=\"#processthrowdeprecation\"><code>process.throwDeprecation</code></a></h3>\n<p>A <code>Boolean</code> that controls whether or not deprecation warnings will be thrown as\nexceptions. Setting this to <code>true</code> will throw errors for deprecations. This\nproperty is used instead of the <code>--throw-deprecation</code> command line flag.</p>\n<h3 id=\"processtracedeprecation\"><a href=\"#processtracedeprecation\"><code>process.traceDeprecation</code></a></h3>\n<p>A <code>Boolean</code> that controls whether or not deprecations printed to <code>stderr</code> include\ntheir stack trace. Setting this to <code>true</code> will print stack traces for deprecations.\nThis property is instead of the <code>--trace-deprecation</code> command line flag.</p>\n<h3 id=\"processtraceprocesswarnings\"><a href=\"#processtraceprocesswarnings\"><code>process.traceProcessWarnings</code></a></h3>\n<p>A <code>Boolean</code> that controls whether or not process warnings printed to <code>stderr</code> include\ntheir stack trace. Setting this to <code>true</code> will print stack traces for process warnings\n(including deprecations). This property is instead of the <code>--trace-warnings</code> command\nline flag.</p>\n<h3 id=\"processtype-readonly\"><a href=\"#processtype-readonly\"><code>process.type</code> <em>Readonly</em></a></h3>\n<p>A <code>String</code> representing the current process's type, can be:</p>\n<ul>\n<li><code>browser</code> - The main process</li>\n<li><code>renderer</code> - A renderer process</li>\n<li><code>worker</code> - In a web worker</li>\n</ul>\n<h3 id=\"processversionschrome-readonly\"><a href=\"#processversionschrome-readonly\"><code>process.versions.chrome</code> <em>Readonly</em></a></h3>\n<p>A <code>String</code> representing Chrome's version string.</p>\n<h3 id=\"processversionselectron-readonly\"><a href=\"#processversionselectron-readonly\"><code>process.versions.electron</code> <em>Readonly</em></a></h3>\n<p>A <code>String</code> representing Electron's version string.</p>\n<h3 id=\"processwindowsstore-readonly\"><a href=\"#processwindowsstore-readonly\"><code>process.windowsStore</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>. If the app is running as a Windows Store app (appx), this property is <code>true</code>,\nfor otherwise it is <code>undefined</code>.</p>\n<h3 id=\"processcontextid-readonly\"><a href=\"#processcontextid-readonly\"><code>process.contextId</code> <em>Readonly</em></a></h3>\n<p>A <code>String</code> (optional) representing a globally unique ID of the current JavaScript context.\nEach frame has its own JavaScript context. When contextIsolation is enabled, the isolated\nworld also has a separate JavaScript context.\nThis property is only available in the renderer process.</p>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>process</code> object has the following methods:</p>\n<h3 id=\"processcrash\"><a href=\"#processcrash\"><code>process.crash()</code></a></h3>\n<p>Causes the main thread of the current process crash.</p>\n<h3 id=\"processgetcreationtime\"><a href=\"#processgetcreationtime\"><code>process.getCreationTime()</code></a></h3>\n<p>Returns <code>Number | null</code> - The number of milliseconds since epoch, or <code>null</code> if the information is unavailable</p>\n<p>Indicates the creation time of the application.\nThe time is represented as number of milliseconds since epoch. It returns null if it is unable to get the process creation time.</p>\n<h3 id=\"processgetcpuusage\"><a href=\"#processgetcpuusage\"><code>process.getCPUUsage()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/cpu-usage\"><code>CPUUsage</code></a></p>\n<h3 id=\"processgetiocounters-windows-linux\"><a href=\"#processgetiocounters-windows-linux\"><code>process.getIOCounters()</code> <em>Windows</em> <em>Linux</em></a></h3>\n<p>Returns <a href=\"/docs/api/structures/io-counters\"><code>IOCounters</code></a></p>\n<h3 id=\"processgetheapstatistics\"><a href=\"#processgetheapstatistics\"><code>process.getHeapStatistics()</code></a></h3>\n<p>Returns <code>Object</code>:</p>\n<ul>\n<li><code>totalHeapSize</code> Integer</li>\n<li><code>totalHeapSizeExecutable</code> Integer</li>\n<li><code>totalPhysicalSize</code> Integer</li>\n<li><code>totalAvailableSize</code> Integer</li>\n<li><code>usedHeapSize</code> Integer</li>\n<li><code>heapSizeLimit</code> Integer</li>\n<li><code>mallocedMemory</code> Integer</li>\n<li><code>peakMallocedMemory</code> Integer</li>\n<li><code>doesZapGarbage</code> Boolean</li>\n</ul>\n<p>Returns an object with V8 heap statistics. Note that all statistics are reported in Kilobytes.</p>\n<h3 id=\"processgetblinkmemoryinfo\"><a href=\"#processgetblinkmemoryinfo\"><code>process.getBlinkMemoryInfo()</code></a></h3>\n<p>Returns <code>Object</code>:</p>\n<ul>\n<li><code>allocated</code> Integer - Size of all allocated objects in Kilobytes.</li>\n<li><code>marked</code> Integer - Size of all marked objects in Kilobytes.</li>\n<li><code>total</code> Integer - Total allocated space in Kilobytes.</li>\n</ul>\n<p>Returns an object with Blink memory information.\nIt can be useful for debugging rendering / DOM related memory issues.\nNote that all values are reported in Kilobytes.</p>\n<h3 id=\"processgetprocessmemoryinfo\"><a href=\"#processgetprocessmemoryinfo\"><code>process.getProcessMemoryInfo()</code></a></h3>\n<p>Returns <code>Promise&#x3C;ProcessMemoryInfo></code> - Resolves with a <a href=\"/docs/api/structures/process-memory-info\">ProcessMemoryInfo</a></p>\n<p>Returns an object giving memory usage statistics about the current process. Note\nthat all statistics are reported in Kilobytes.\nThis api should be called after app ready.</p>\n<p>Chromium does not provide <code>residentSet</code> value for macOS. This is because macOS\nperforms in-memory compression of pages that haven't been recently used. As a\nresult the resident set size value is not what one would expect. <code>private</code> memory\nis more representative of the actual pre-compression memory usage of the process\non macOS.</p>\n<h3 id=\"processgetsystemmemoryinfo\"><a href=\"#processgetsystemmemoryinfo\"><code>process.getSystemMemoryInfo()</code></a></h3>\n<p>Returns <code>Object</code>:</p>\n<ul>\n<li><code>total</code> Integer - The total amount of physical memory in Kilobytes available to the\nsystem.</li>\n<li><code>free</code> Integer - The total amount of memory not being used by applications or disk\ncache.</li>\n<li><code>swapTotal</code> Integer <em>Windows</em> <em>Linux</em> - The total amount of swap memory in Kilobytes available to the\nsystem.</li>\n<li><code>swapFree</code> Integer <em>Windows</em> <em>Linux</em> - The free amount of swap memory in Kilobytes available to the\nsystem.</li>\n</ul>\n<p>Returns an object giving memory usage statistics about the entire system. Note\nthat all statistics are reported in Kilobytes.</p>\n<h3 id=\"processgetsystemversion\"><a href=\"#processgetsystemversion\"><code>process.getSystemVersion()</code></a></h3>\n<p>Returns <code>String</code> - The version of the host operating system.</p>\n<p>Example:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> version = process.getSystemVersion()\n<span class=\"hljs-built_in\">console</span>.log(version)\n<span class=\"hljs-comment\">// On macOS -> '10.13.6'</span>\n<span class=\"hljs-comment\">// On Windows -> '10.0.17763'</span>\n<span class=\"hljs-comment\">// On Linux -> '4.15.0-45-generic'</span>\n</code></pre>\n<p><strong>Note:</strong> It returns the actual operating system version instead of kernel version on macOS unlike <code>os.release()</code>.</p>\n<h3 id=\"processtakeheapsnapshotfilepath\"><a href=\"#processtakeheapsnapshotfilepath\"><code>process.takeHeapSnapshot(filePath)</code></a></h3>\n<ul>\n<li><code>filePath</code> String - Path to the output file.</li>\n</ul>\n<p>Returns <code>Boolean</code> - Indicates whether the snapshot has been created successfully.</p>\n<p>Takes a V8 heap snapshot and saves it to <code>filePath</code>.</p>\n<h3 id=\"processhang\"><a href=\"#processhang\"><code>process.hang()</code></a></h3>\n<p>Causes the main thread of the current process hang.</p>\n<h3 id=\"processsetfdlimitmaxdescriptors-macos-linux\"><a href=\"#processsetfdlimitmaxdescriptors-macos-linux\"><code>process.setFdLimit(maxDescriptors)</code> <em>macOS</em> <em>Linux</em></a></h3>\n<ul>\n<li><code>maxDescriptors</code> Integer</li>\n</ul>\n<p>Sets the file descriptor soft limit to <code>maxDescriptors</code> or the OS hard\nlimit, whichever is lower for the current process.</p>",
      "title": "process",
      "description": "Extensions to process object."
    },
    "/docs/api/structures/process-memory-info": {
      "locale": "en-US",
      "slug": "process-memory-info",
      "href": "/docs/api/structures/process-memory-info",
      "crowdinFileId": "256481",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/process-memory-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"processmemoryinfo-object\"><a href=\"#processmemoryinfo-object\">ProcessMemoryInfo Object</a></h1>\n<ul>\n<li><code>residentSet</code> Integer <em>Linux</em> <em>Windows</em> - The amount of memory\ncurrently pinned to actual physical RAM in Kilobytes.</li>\n<li><code>private</code> Integer - The amount of memory not shared by other processes, such as JS heap or HTML content in Kilobytes.</li>\n<li><code>shared</code> Integer - The amount of memory shared between processes, typically\nmemory consumed by the Electron code itself in Kilobytes.</li>\n</ul>",
      "title": "ProcessMemoryInfo Object",
      "description": ""
    },
    "/docs/api/structures/process-metric": {
      "locale": "en-US",
      "slug": "process-metric",
      "href": "/docs/api/structures/process-metric",
      "crowdinFileId": "256483",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/process-metric.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"processmetric-object\"><a href=\"#processmetric-object\">ProcessMetric Object</a></h1>\n<ul>\n<li><code>pid</code> Integer - Process id of the process.</li>\n<li><code>type</code> String - Process type. One of the following values:<ul>\n<li><code>Browser</code></li>\n<li><code>Tab</code></li>\n<li><code>Utility</code></li>\n<li><code>Zygote</code></li>\n<li><code>Sandbox helper</code></li>\n<li><code>GPU</code></li>\n<li><code>Pepper Plugin</code></li>\n<li><code>Pepper Plugin Broker</code></li>\n<li><code>Unknown</code></li>\n</ul></li>\n<li><code>serviceName</code> String (optional) - The non-localized name of the process.</li>\n<li><code>name</code> String (optional) - The name of the process.\nExamples for utility: <code>Audio Service</code>, <code>Content Decryption Module Service</code>, <code>Network Service</code>, <code>Video Capture</code>, etc.</li>\n<li><code>cpu</code> <a href=\"/docs/api/structures/cpu-usage\">CPUUsage</a> - CPU usage of the process.</li>\n<li><code>creationTime</code> Number - Creation time for this process.\nThe time is represented as number of milliseconds since epoch.\nSince the <code>pid</code> can be reused after a process dies,\nit is useful to use both the <code>pid</code> and the <code>creationTime</code> to uniquely identify a process.</li>\n<li><code>memory</code> <a href=\"/docs/api/structures/memory-info\">MemoryInfo</a> - Memory information for the process.</li>\n<li><code>sandboxed</code> Boolean (optional) <em>macOS</em> <em>Windows</em> - Whether the process is sandboxed on OS level.</li>\n<li><code>integrityLevel</code> String (optional) <em>Windows</em> - One of the following values:<ul>\n<li><code>untrusted</code></li>\n<li><code>low</code></li>\n<li><code>medium</code></li>\n<li><code>high</code></li>\n<li><code>unknown</code></li>\n</ul></li>\n</ul>",
      "title": "ProcessMetric Object",
      "description": ""
    },
    "/docs/tutorial/process-model": {
      "locale": "en-US",
      "slug": "process-model",
      "href": "/docs/tutorial/process-model",
      "crowdinFileId": "256233",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/process-model.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"process-model\"><a href=\"#process-model\">Process Model</a></h1>\n<p>Electron inherits its multi-process architecture from Chromium, which makes the framework\narchitecturally very similar to a modern web browser. In this guide, we'll expound on\nthe conceptual knowledge of Electron that we applied in the minimal <a href=\"/docs/tutorial/quick-start\">quick start app</a>.</p>\n<h2 id=\"why-not-a-single-process\"><a href=\"#why-not-a-single-process\">Why not a single process?</a></h2>\n<p>Web browsers are incredibly complicated applications. Aside from their primary ability\nto display web content, they have many secondary responsibilities,\nsuch as managing multiple windows (or tabs) and loading third-party extensions.</p>\n<p>In the earlier days, browsers usually used a single process for all of this\nfunctionality. Although this pattern meant less overhead for each tab you had open,\nit also meant that one website crashing or hanging would affect the entire browser.</p>\n<h2 id=\"the-multi-process-model\"><a href=\"#the-multi-process-model\">The multi-process model</a></h2>\n<p>To solve this problem, the Chrome team decided that each tab would render in its own\nprocess, limiting the harm that buggy or malicious code on a web page could cause to\nthe app as a whole. A single browser process then controls these processes, as well\nas the application lifecycle as a whole. This diagram below from the <a href=\"https://www.google.com/googlebooks/chrome/\">Chrome Comic</a>\nvisualizes this model:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/chrome-processes.png\" alt=\"Chrome&#x27;s multi-process architecture\"></p>\n<p>Electron applications are structured very similarly. As an app developer, you control\ntwo types of processes: main and renderer. These are analogous to Chrome's own browser\nand renderer processes outlined above.</p>\n<h2 id=\"the-main-process\"><a href=\"#the-main-process\">The main process</a></h2>\n<p>Each Electron app has a single main process, which acts as the application's entry\npoint. The main process runs in a Node.js environment, meaning it has the ability\nto <code>require</code> modules and use all of Node.js APIs.</p>\n<h3 id=\"window-management\"><a href=\"#window-management\">Window management</a></h3>\n<p>The main process' primary purpose is to create and manage application windows with the\n<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> module.</p>\n<p>Each instance of the <code>BrowserWindow</code> class creates an application window that loads\na web page in a separate renderer process. You can interact with this web content\nfrom the main process using the window's <a href=\"/docs/api/web-contents\"><code>webContents</code></a> object.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> contents = win.webContents\n<span class=\"hljs-built_in\">console</span>.log(contents)\n</code></pre>\n<blockquote>\n<p>Note: A renderer process is also created for <a href=\"/docs/tutorial/web-embeds\">web embeds</a> such as the\n<code>BrowserView</code> module. The <code>webContents</code> object is also accessible for embedded\nweb content.</p>\n</blockquote>\n<p>Because the <code>BrowserWindow</code> module is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\"><code>EventEmitter</code></a>, you can also\nadd handlers for various user events (for example, minimizing or maximizing your window).</p>\n<p>When a <code>BrowserWindow</code> instance is destroyed, its corresponding renderer process gets\nterminated as well.</p>\n<h3 id=\"application-lifecycle\"><a href=\"#application-lifecycle\">Application lifecycle</a></h3>\n<p>The main process also controls your application's lifecycle through Electron's\n<a href=\"/docs/api/app\"><code>app</code></a> module. This module provides a large set of events and methods\nthat you can use to add custom application behaviour (for instance, programatically\nquitting your application, modifying the application dock, or showing an About panel).</p>\n<p>As a practical example, the app shown in the <a href=\"/docs/tutorial/quick-start#manage-your-windows-lifecycle\">quick start guide</a>\nuses <code>app</code> APIs to create a more native application window experience.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// quitting the app when no windows are open on non-macOS platforms</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h3 id=\"native-apis\"><a href=\"#native-apis\">Native APIs</a></h3>\n<p>To extend Electron's features beyond being a Chromium wrapper for web contents, the\nmain process also adds custom APIs to interact with the user's operating system.\nElectron exposes various modules that control native desktop functionality, such\nas menus, dialogs, and tray icons.</p>\n<p>For a full list of Electron's main process modules, check out our API documentation.</p>\n<h2 id=\"the-renderer-process\"><a href=\"#the-renderer-process\">The renderer process</a></h2>\n<p>Each Electron app spawns a separate renderer process for each open <code>BrowserWindow</code>\n(and each web embed). As its name implies, a renderer is responsible for\n<em>rendering</em> web content. For all intents and purposes, code ran in renderer processes\nshould behave according to web standards (insofar as Chromium does, at least).</p>\n<p>Therefore, all user interfaces and app functionality within a single browser\nwindow should be written with the same tools and paradigms that you use on the\nweb.</p>\n<p>Although explaining every web spec is out of scope for this guide, the bare minimum\nto understand is:</p>\n<ul>\n<li>An HTML file is your entry point for the renderer process.</li>\n<li>UI styling is added through Cascading Style Sheets (CSS).</li>\n<li>Executable JavaScript code can be added through <code>&#x3C;script></code> elements.</li>\n</ul>\n<p>Moreover, this also means that the renderer has no direct access to <code>require</code>\nor other Node.js APIs. In order to directly include NPM modules in the renderer,\nyou must use the same bundler toolchains (for example, <code>webpack</code> or <code>parcel</code>) that you\nuse on the web.</p>\n<blockquote>\n<p>Note: Renderer processes can be spawned with a full Node.js environment for ease of\ndevelopment. Historically, this used to be the default, but this feature was disabled\nfor security reasons.</p>\n</blockquote>\n<p>At this point, you might be wondering how your renderer process user interfaces\ncan interact with Node.js and Electron's native desktop functionality if these\nfeatures are only accessible from the main process. In fact, there is no direct\nway to import Electron's content scripts.</p>\n<h2 id=\"preload-scripts\"><a href=\"#preload-scripts\">Preload scripts</a></h2>\n<!-- Note: This guide doesn't take sandboxing into account, which might fundamentally \nchange the statements here. -->\n<p>Preload scripts contain code that executes in a renderer process before its web content\nbegins loading. These scripts run within the renderer context, but are granted more\nprivileges by having access to Node.js APIs.</p>\n<p>A preload script can be attached to the main process in the <code>BrowserWindow</code> constructor's\n<code>webPreferences</code> option.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">//...</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">preload</span>: <span class=\"hljs-string\">'path/to/preload.js'</span>\n  }\n})\n<span class=\"hljs-comment\">//...</span>\n</code></pre>\n<p>Because the preload script shares a global <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window\"><code>Window</code></a> interface with the\nrenderers and can access Node.js APIs, it serves to enhance your renderer by exposing\narbitrary APIs in the <code>window</code> global that your web contents can then consume.</p>\n<p>Although preload scripts share a <code>window</code> global with the renderer they're attached to,\nyou cannot directly attach any variables from the preload script to <code>window</code> because of\nthe <a href=\"/docs/tutorial/context-isolation\"><code>contextIsolation</code></a> default.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.myAPI = {\n  <span class=\"hljs-attr\">desktop</span>: <span class=\"hljs-literal\">true</span>\n}\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-built_in\">window</span>.myAPI)\n<span class=\"hljs-comment\">// => undefined</span>\n</code></pre>\n<p>Context Isolation means that preload scripts are isolated from the renderer's main world\nto avoid leaking any privileged APIs into your web content's code.</p>\n<p>Instead, use the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> module to accomplish this\nsecurely:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">desktop</span>: <span class=\"hljs-literal\">true</span>\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-built_in\">window</span>.myAPI)\n<span class=\"hljs-comment\">// => { desktop: true }</span>\n</code></pre>\n<p>This feature is incredibly useful for two main purposes:</p>\n<ul>\n<li>By exposing <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> helpers to the renderer, you can use\ninter-process communication (IPC) to trigger main process tasks from the\nrenderer (and vice-versa).</li>\n<li>If you're developing an Electron wrapper for an existing web app hosted on a remote\nURL, you can add custom properties onto the renderer's <code>window</code> global that can\nbe used for desktop-only logic on the web client's side.</li>\n</ul>",
      "title": "Process Model",
      "description": "Note: A renderer process is also created for web embeds such as the\nBrowserView module. The webContents object is also accessible for embedded\nweb content."
    },
    "/docs/api/structures/product": {
      "locale": "en-US",
      "slug": "product",
      "href": "/docs/api/structures/product",
      "crowdinFileId": "256485",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/product.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"product-object\"><a href=\"#product-object\">Product Object</a></h1>\n<ul>\n<li><code>productIdentifier</code> String - The string that identifies the product to the Apple App Store.</li>\n<li><code>localizedDescription</code> String - A description of the product.</li>\n<li><code>localizedTitle</code> String - The name of the product.</li>\n<li><code>contentVersion</code> String - A string that identifies the version of the content.</li>\n<li><code>contentLengths</code> Number[] - The total size of the content, in bytes.</li>\n<li><code>price</code> Number - The cost of the product in the local currency.</li>\n<li><code>formattedPrice</code> String - The locale formatted price of the product.</li>\n<li><code>currencyCode</code> String - 3 character code presenting a product's currency based on the ISO 4217 standard.</li>\n<li><code>isDownloadable</code> Boolean - A Boolean value that indicates whether the App Store has downloadable content for this product. <code>true</code> if at least one file has been associated with the product.</li>\n</ul>",
      "title": "Product Object",
      "description": ""
    },
    "/docs/tutorial/progress-bar": {
      "locale": "en-US",
      "slug": "progress-bar",
      "href": "/docs/tutorial/progress-bar",
      "crowdinFileId": "256235",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/progress-bar.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"taskbar-progress-bar-windows--macos\"><a href=\"#taskbar-progress-bar-windows--macos\">Taskbar Progress Bar (Windows &#x26; macOS)</a></h1>\n<h2 id=\"overview\"><a href=\"#overview\">Overview</a></h2>\n<p>A progress bar enables a window to provide progress information to the user\nwithout the need of switching to the window itself.</p>\n<p>On Windows, you can use a taskbar button to display a progress bar.</p>\n<p>![Windows Progress Bar][https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png]</p>\n<p>On macOS, the progress bar will be displayed as a part of the dock icon.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/macos-progress-bar.png\" alt=\"macOS Progress Bar\"></p>\n<p>On Linux, the Unity graphical interface also has a similar feature that allows\nyou to specify the progress bar in the launcher.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/linux-progress-bar.png\" alt=\"Linux Progress Bar\"></p>\n<blockquote>\n<p>NOTE: on Windows, each window can have its own progress bar, whereas on macOS\nand Linux (Unity) there can be only one progress bar for the application.</p>\n</blockquote>\n<hr>\n<p>All three cases are covered by the same API - the\n<a href=\"/docs/api/browser-window#winsetprogressbarprogress-options\"><code>setProgressBar()</code></a> method available on an instance of\n<code>BrowserWindow</code>. To indicate your progress, call this method with a number\nbetween <code>0</code> and <code>1</code>. For example, if you have a long-running task that is\ncurrently at 63% towards completion, you would call it as\n<code>setProgressBar(0.63)</code>.</p>\n<p>Setting the parameter to negative values (e.g. <code>-1</code>) will remove the progress\nbar. Setting it to a value greater than <code>1</code> will indicate an indeterminate progress bar\nin Windows or clamp to 100% in other operating systems. An indeterminate progress bar\nremains active but does not show an actual percentage, and is used for situations when\nyou do not know how long an operation will take to complete.</p>\n<p>See the <a href=\"/docs/api/browser-window#winsetprogressbarprogress-options\">API documentation for more options and modes</a>.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<p>In this example, we add a progress bar to the main window that increments over time\nusing Node.js timers.</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/progress-bar\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> progressInterval\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-keyword\">const</span> INCREMENT = <span class=\"hljs-number\">0.03</span>\n  <span class=\"hljs-keyword\">const</span> INTERVAL_DELAY = <span class=\"hljs-number\">100</span> <span class=\"hljs-comment\">// ms</span>\n\n  <span class=\"hljs-keyword\">let</span> c = <span class=\"hljs-number\">0</span>\n  progressInterval = setInterval(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// update progress bar to next value</span>\n    <span class=\"hljs-comment\">// values between 0 and 1 will show progress, >1 will show indeterminate or stick at 100%</span>\n    win.setProgressBar(c)\n\n    <span class=\"hljs-comment\">// increment or reset progress bar</span>\n    <span class=\"hljs-keyword\">if</span> (c &#x3C; <span class=\"hljs-number\">2</span>) c += INCREMENT\n    <span class=\"hljs-keyword\">else</span> c = <span class=\"hljs-number\">0</span>\n  }, INTERVAL_DELAY)\n}\n\napp.whenReady().then(createWindow)\n\n<span class=\"hljs-comment\">// before the app is terminated, clear both timers</span>\napp.on(<span class=\"hljs-string\">'before-quit'</span>, () => {\n  clearInterval(progressInterval)\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<p>After launching the Electron application, the dock (macOS) or taskbar (Windows, Unity)\nshould show a progress bar that starts at zero and progresses through 100% to completion.\nIt should then show indeterminate (Windows) or pin to 100% (other operating systems)\nbriefly and then loop.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/dock-progress-bar.png\" alt=\"macOS dock progress bar\"></p>\n<p>For macOS, the progress bar will also be indicated for your application\nwhen using <a href=\"https://support.apple.com/en-us/HT204100\">Mission Control</a>:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/mission-control-progress-bar.png\" alt=\"Mission Control Progress Bar\"></p>",
      "title": "Taskbar Progress Bar (Windows & macOS)",
      "description": "NOTE: on Windows, each window can have its own progress bar, whereas on macOS\nand Linux (Unity) there can be only one progress bar for the application."
    },
    "/docs/api/protocol": {
      "locale": "en-US",
      "slug": "protocol",
      "href": "/docs/api/protocol",
      "crowdinFileId": "256357",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/protocol.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocol\"><a href=\"#protocol\">protocol</a></h1>\n<blockquote>\n<p>Register a custom protocol and intercept existing protocol requests.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>An example of implementing a protocol that has the same effect as the\n<code>file://</code> protocol:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })\n})\n</code></pre>\n<p><strong>Note:</strong> All methods unless specified can only be used after the <code>ready</code> event\nof the <code>app</code> module gets emitted.</p>\n<h2 id=\"using-protocol-with-a-custom-partition-or-session\"><a href=\"#using-protocol-with-a-custom-partition-or-session\">Using <code>protocol</code> with a custom <code>partition</code> or <code>session</code></a></h2>\n<p>A protocol is registered to a specific Electron <a href=\"/docs/api/session\"><code>session</code></a>\nobject. If you don't specify a session, then your <code>protocol</code> will be applied to\nthe default session that Electron uses. However, if you define a <code>partition</code> or\n<code>session</code> on your <code>browserWindow</code>'s <code>webPreferences</code>, then that window will use\na different session and your custom protocol will not work if you just use\n<code>electron.protocol.XXX</code>.</p>\n<p>To have your custom protocol work in combination with a custom session, you need\nto register it to that session explicitly.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session, app, protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> partition = <span class=\"hljs-string\">'persist:example'</span>\n  <span class=\"hljs-keyword\">const</span> ses = session.fromPartition(partition)\n\n  ses.protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })\n\n  mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { partition } })\n})\n</code></pre>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>protocol</code> module has the following methods:</p>\n<h3 id=\"protocolregisterschemesasprivilegedcustomschemes\"><a href=\"#protocolregisterschemesasprivilegedcustomschemes\"><code>protocol.registerSchemesAsPrivileged(customSchemes)</code></a></h3>\n<ul>\n<li><code>customSchemes</code> <a href=\"/docs/api/structures/custom-scheme\">CustomScheme[]</a></li>\n</ul>\n<p><strong>Note:</strong> This method can only be used before the <code>ready</code> event of the <code>app</code>\nmodule gets emitted and can be called only once.</p>\n<p>Registers the <code>scheme</code> as standard, secure, bypasses content security policy for\nresources, allows registering ServiceWorker, supports fetch API, and streaming\nvideo/audio. Specify a privilege with the value of <code>true</code> to enable the capability.</p>\n<p>An example of registering a privileged scheme, that bypasses Content Security\nPolicy:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nprotocol.registerSchemesAsPrivileged([\n  { <span class=\"hljs-attr\">scheme</span>: <span class=\"hljs-string\">'foo'</span>, <span class=\"hljs-attr\">privileges</span>: { <span class=\"hljs-attr\">bypassCSP</span>: <span class=\"hljs-literal\">true</span> } }\n])\n</code></pre>\n<p>A standard scheme adheres to what RFC 3986 calls <a href=\"https://tools.ietf.org/html/rfc3986#section-3\">generic URI\nsyntax</a>. For example <code>http</code> and\n<code>https</code> are standard schemes, while <code>file</code> is not.</p>\n<p>Registering a scheme as standard allows relative and absolute resources to\nbe resolved correctly when served. Otherwise the scheme will behave like the\n<code>file</code> protocol, but without the ability to resolve relative URLs.</p>\n<p>For example when you load following page with custom protocol without\nregistering it as standard scheme, the image will not be loaded because\nnon-standard schemes can not recognize relative URLs:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">img</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">'test.png'</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n</code></pre>\n<p>Registering a scheme as standard will allow access to files through the\n<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/LocalFileSystem\">FileSystem API</a>. Otherwise the renderer will throw a security\nerror for the scheme.</p>\n<p>By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB,\ncookies) are disabled for non standard schemes. So in general if you want to\nregister a custom protocol to replace the <code>http</code> protocol, you have to register\nit as a standard scheme.</p>\n<p>Protocols that use streams (http and stream protocols) should set <code>stream: true</code>.\nThe <code>&#x3C;video></code> and <code>&#x3C;audio></code> HTML elements expect protocols to buffer their\nresponses by default. The <code>stream</code> flag configures those elements to correctly\nexpect streaming responses.</p>\n<h3 id=\"protocolregisterfileprotocolscheme-handler\"><a href=\"#protocolregisterfileprotocolscheme-handler\"><code>protocol.registerFileProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send a file as the response. The\n<code>handler</code> will be called with <code>request</code> and <code>callback</code> where <code>request</code> is\nan incoming request for the <code>scheme</code>.</p>\n<p>To handle the <code>request</code>, the <code>callback</code> should be called with either the file's\npath or an object that has a <code>path</code> property, e.g. <code>callback(filePath)</code> or\n<code>callback({ path: filePath })</code>. The <code>filePath</code> must be an absolute path.</p>\n<p>By default the <code>scheme</code> is treated like <code>http:</code>, which is parsed differently\nfrom protocols that follow the \"generic URI syntax\" like <code>file:</code>.</p>\n<h3 id=\"protocolregisterbufferprotocolscheme-handler\"><a href=\"#protocolregisterbufferprotocolscheme-handler\"><code>protocol.registerBufferProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (Buffer | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send a <code>Buffer</code> as a response.</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code>\nshould be called with either a <code>Buffer</code> object or an object that has the <code>data</code>\nproperty.</p>\n<p>Example:</p>\n<pre><code class=\"hljs language-javascript\">protocol.registerBufferProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback({ <span class=\"hljs-attr\">mimeType</span>: <span class=\"hljs-string\">'text/html'</span>, <span class=\"hljs-attr\">data</span>: Buffer.from(<span class=\"hljs-string\">'&#x3C;h5>Response&#x3C;/h5>'</span>) })\n})\n</code></pre>\n<h3 id=\"protocolregisterstringprotocolscheme-handler\"><a href=\"#protocolregisterstringprotocolscheme-handler\"><code>protocol.registerStringProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send a <code>String</code> as a response.</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code>\nshould be called with either a <code>String</code> or an object that has the <code>data</code>\nproperty.</p>\n<h3 id=\"protocolregisterhttpprotocolscheme-handler\"><a href=\"#protocolregisterhttpprotocolscheme-handler\"><code>protocol.registerHttpProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> ProtocolResponse</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send an HTTP request as a response.</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code>\nshould be called with an object that has the <code>url</code> property.</p>\n<h3 id=\"protocolregisterstreamprotocolscheme-handler\"><a href=\"#protocolregisterstreamprotocolscheme-handler\"><code>protocol.registerStreamProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (ReadableStream | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send a stream as a response.</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the\n<code>callback</code> should be called with either a <a href=\"https://nodejs.org/api/stream.html#stream_class_stream_readable\"><code>ReadableStream</code></a> object or an object that\nhas the <code>data</code> property.</p>\n<p>Example:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { PassThrough } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'stream'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createStream</span> (<span class=\"hljs-params\">text</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> rv = <span class=\"hljs-keyword\">new</span> PassThrough() <span class=\"hljs-comment\">// PassThrough is also a Readable stream</span>\n  rv.push(text)\n  rv.push(<span class=\"hljs-literal\">null</span>)\n  <span class=\"hljs-keyword\">return</span> rv\n}\n\nprotocol.registerStreamProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback({\n    <span class=\"hljs-attr\">statusCode</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">headers</span>: {\n      <span class=\"hljs-string\">'content-type'</span>: <span class=\"hljs-string\">'text/html'</span>\n    },\n    <span class=\"hljs-attr\">data</span>: createStream(<span class=\"hljs-string\">'&#x3C;h5>Response&#x3C;/h5>'</span>)\n  })\n})\n</code></pre>\n<p>It is possible to pass any object that implements the readable stream API (emits\n<code>data</code>/<code>end</code>/<code>error</code> events). For example, here's how a file could be returned:</p>\n<pre><code class=\"hljs language-javascript\">protocol.registerStreamProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback(fs.createReadStream(<span class=\"hljs-string\">'index.html'</span>))\n})\n</code></pre>\n<h3 id=\"protocolunregisterprotocolscheme\"><a href=\"#protocolunregisterprotocolscheme\"><code>protocol.unregisterProtocol(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully unregistered</p>\n<p>Unregisters the custom protocol of <code>scheme</code>.</p>\n<h3 id=\"protocolisprotocolregisteredscheme\"><a href=\"#protocolisprotocolregisteredscheme\"><code>protocol.isProtocolRegistered(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether <code>scheme</code> is already registered.</p>\n<h3 id=\"protocolinterceptfileprotocolscheme-handler\"><a href=\"#protocolinterceptfileprotocolscheme-handler\"><code>protocol.interceptFileProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepts <code>scheme</code> protocol and uses <code>handler</code> as the protocol's new handler\nwhich sends a file as a response.</p>\n<h3 id=\"protocolinterceptstringprotocolscheme-handler\"><a href=\"#protocolinterceptstringprotocolscheme-handler\"><code>protocol.interceptStringProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepts <code>scheme</code> protocol and uses <code>handler</code> as the protocol's new handler\nwhich sends a <code>String</code> as a response.</p>\n<h3 id=\"protocolinterceptbufferprotocolscheme-handler\"><a href=\"#protocolinterceptbufferprotocolscheme-handler\"><code>protocol.interceptBufferProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (Buffer | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepts <code>scheme</code> protocol and uses <code>handler</code> as the protocol's new handler\nwhich sends a <code>Buffer</code> as a response.</p>\n<h3 id=\"protocolintercepthttpprotocolscheme-handler\"><a href=\"#protocolintercepthttpprotocolscheme-handler\"><code>protocol.interceptHttpProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepts <code>scheme</code> protocol and uses <code>handler</code> as the protocol's new handler\nwhich sends a new HTTP request as a response.</p>\n<h3 id=\"protocolinterceptstreamprotocolscheme-handler\"><a href=\"#protocolinterceptstreamprotocolscheme-handler\"><code>protocol.interceptStreamProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (ReadableStream | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Same as <code>protocol.registerStreamProtocol</code>, except that it replaces an existing\nprotocol handler.</p>\n<h3 id=\"protocoluninterceptprotocolscheme\"><a href=\"#protocoluninterceptprotocolscheme\"><code>protocol.uninterceptProtocol(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully unintercepted</p>\n<p>Remove the interceptor installed for <code>scheme</code> and restore its original handler.</p>\n<h3 id=\"protocolisprotocolinterceptedscheme\"><a href=\"#protocolisprotocolinterceptedscheme\"><code>protocol.isProtocolIntercepted(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether <code>scheme</code> is already intercepted.</p>",
      "title": "protocol",
      "description": "Register a custom protocol and intercept existing protocol requests."
    },
    "/docs/api/structures/protocol-request": {
      "locale": "en-US",
      "slug": "protocol-request",
      "href": "/docs/api/structures/protocol-request",
      "crowdinFileId": "256487",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-request.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolrequest-object\"><a href=\"#protocolrequest-object\">ProtocolRequest Object</a></h1>\n<ul>\n<li><code>url</code> String</li>\n<li><code>referrer</code> String</li>\n<li><code>method</code> String</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/upload-data\">UploadData[]</a> (optional)</li>\n<li><code>headers</code> Record&#x3C;String, String></li>\n</ul>",
      "title": "ProtocolRequest Object",
      "description": ""
    },
    "/docs/api/structures/protocol-response": {
      "locale": "en-US",
      "slug": "protocol-response",
      "href": "/docs/api/structures/protocol-response",
      "crowdinFileId": "256491",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-response.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolresponse-object\"><a href=\"#protocolresponse-object\">ProtocolResponse Object</a></h1>\n<ul>\n<li><code>error</code> Integer (optional) - When assigned, the <code>request</code> will fail with the\n<code>error</code> number . For the available error numbers you can use, please see the\n<a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">net error list</a>.</li>\n<li><code>statusCode</code> Number (optional) - The HTTP response code, default is 200.</li>\n<li><code>charset</code> String (optional) - The charset of response body, default is\n<code>\"utf-8\"</code>.</li>\n<li><code>mimeType</code> String (optional) - The MIME type of response body, default is\n<code>\"text/html\"</code>. Setting <code>mimeType</code> would implicitly set the <code>content-type</code>\nheader in response, but if <code>content-type</code> is already set in <code>headers</code>, the\n<code>mimeType</code> would be ignored.</li>\n<li><code>headers</code> Record&#x3C;string, string | string[]> (optional) - An object containing the response headers. The\nkeys must be String, and values must be either String or Array of String.</li>\n<li><code>data</code> (Buffer | String | ReadableStream) (optional) - The response body. When\nreturning stream as response, this is a Node.js readable stream representing\nthe response body. When returning <code>Buffer</code> as response, this is a <code>Buffer</code>.\nWhen returning <code>String</code> as response, this is a <code>String</code>. This is ignored for\nother types of responses.</li>\n<li><code>path</code> String (optional) - Path to the file which would be sent as response\nbody. This is only used for file responses.</li>\n<li><code>url</code> String (optional) - Download the <code>url</code> and pipe the result as response\nbody. This is only used for URL responses.</li>\n<li><code>referrer</code> String (optional) - The <code>referrer</code> URL. This is only used for file\nand URL responses.</li>\n<li><code>method</code> String (optional) - The HTTP <code>method</code>. This is only used for file\nand URL responses.</li>\n<li><code>session</code> Session (optional) - The session used for requesting URL, by default\nthe HTTP request will reuse the current session. Setting <code>session</code> to <code>null</code>\nwould use a random independent session. This is only used for URL responses.</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/protocol-response-upload-data\">ProtocolResponseUploadData</a> (optional) - The data used as upload data. This is only\nused for URL responses when <code>method</code> is <code>\"POST\"</code>.</li>\n</ul>",
      "title": "ProtocolResponse Object",
      "description": ""
    },
    "/docs/api/structures/protocol-response-upload-data": {
      "locale": "en-US",
      "slug": "protocol-response-upload-data",
      "href": "/docs/api/structures/protocol-response-upload-data",
      "crowdinFileId": "256489",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-response-upload-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolresponseuploaddata-object\"><a href=\"#protocolresponseuploaddata-object\">ProtocolResponseUploadData Object</a></h1>\n<ul>\n<li><code>contentType</code> String - MIME type of the content.</li>\n<li><code>data</code> String | Buffer - Content to be sent.</li>\n</ul>",
      "title": "ProtocolResponseUploadData Object",
      "description": ""
    },
    "/docs/development/pull-requests": {
      "locale": "en-US",
      "slug": "pull-requests",
      "href": "/docs/development/pull-requests",
      "crowdinFileId": "256163",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/pull-requests.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"pull-requests\"><a href=\"#pull-requests\">Pull Requests</a></h1>\n<ul>\n<li><a href=\"#setting-up-your-local-environment\">Setting up your local environment</a><ul>\n<li><a href=\"#step-1-fork\">Step 1: Fork</a></li>\n<li><a href=\"#step-2-build\">Step 2: Build</a></li>\n<li><a href=\"#step-3-branch\">Step 3: Branch</a></li>\n</ul></li>\n<li><a href=\"#making-changes\">Making Changes</a><ul>\n<li><a href=\"#step-4-code\">Step 4: Code</a></li>\n<li><a href=\"#step-5-commit\">Step 5: Commit</a><ul>\n<li><a href=\"#commit-message-guidelines\">Commit message guidelines</a></li>\n</ul></li>\n<li><a href=\"#step-6-rebase\">Step 6: Rebase</a></li>\n<li><a href=\"#step-7-test\">Step 7: Test</a></li>\n<li><a href=\"#step-8-push\">Step 8: Push</a></li>\n<li><a href=\"#step-9-opening-the-pull-request\">Step 9: Opening the Pull Request</a></li>\n<li><a href=\"#step-10-discuss-and-update\">Step 10: Discuss and Update</a><ul>\n<li><a href=\"#approval-and-request-changes-workflow\">Approval and Request Changes Workflow</a></li>\n</ul></li>\n<li><a href=\"#step-11-landing\">Step 11: Landing</a></li>\n<li><a href=\"#continuous-integration-testing\">Continuous Integration Testing</a></li>\n</ul></li>\n</ul>\n<h2 id=\"setting-up-your-local-environment\"><a href=\"#setting-up-your-local-environment\">Setting up your local environment</a></h2>\n<h3 id=\"step-1-fork\"><a href=\"#step-1-fork\">Step 1: Fork</a></h3>\n<p>Fork the project <a href=\"https://github.com/electron/electron\">on GitHub</a> and clone your fork\nlocally.</p>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:username/electron.git\n$ <span class=\"hljs-built_in\">cd</span> electron\n$ git remote add upstream https://github.com/electron/electron.git\n$ git fetch upstream\n</code></pre>\n<h3 id=\"step-2-build\"><a href=\"#step-2-build\">Step 2: Build</a></h3>\n<p>Build steps and dependencies differ slightly depending on your operating system.\nSee these detailed guides on building Electron locally:</p>\n<ul>\n<li><a href=\"/docs/development/build-instructions-macos\">Building on macOS</a></li>\n<li><a href=\"/docs/development/build-instructions-linux\">Building on Linux</a></li>\n<li><a href=\"/docs/development/build-instructions-windows\">Building on Windows</a></li>\n</ul>\n<p>Once you've built the project locally, you're ready to start making changes!</p>\n<h3 id=\"step-3-branch\"><a href=\"#step-3-branch\">Step 3: Branch</a></h3>\n<p>To keep your development environment organized, create local branches to\nhold your work. These should be branched directly off of the <code>main</code> branch.</p>\n<pre><code class=\"hljs language-sh\">$ git checkout -b my-branch -t upstream/main\n</code></pre>\n<h2 id=\"making-changes\"><a href=\"#making-changes\">Making Changes</a></h2>\n<h3 id=\"step-4-code\"><a href=\"#step-4-code\">Step 4: Code</a></h3>\n<p>Most pull requests opened against the <code>electron/electron</code> repository include\nchanges to either the C/C++ code in the <code>shell/</code> folder,\nthe JavaScript code in the <code>lib/</code> folder, the documentation in <code>docs/api/</code>\nor tests in the <code>spec/</code> folder.</p>\n<p>Please be sure to run <code>npm run lint</code> from time to time on any code changes\nto ensure that they follow the project's code style.</p>\n<p>See <a href=\"/docs/development/coding-style\">coding style</a> for\nmore information about best practice when modifying code in different parts of\nthe project.</p>\n<h3 id=\"step-5-commit\"><a href=\"#step-5-commit\">Step 5: Commit</a></h3>\n<p>It is recommended to keep your changes grouped logically within individual\ncommits. Many contributors find it easier to review changes that are split\nacross multiple commits. There is no limit to the number of commits in a\npull request.</p>\n<pre><code class=\"hljs language-sh\">$ git add my/changed/files\n$ git commit\n</code></pre>\n<p>Note that multiple commits often get squashed when they are landed.</p>\n<h4 id=\"commit-message-guidelines\"><a href=\"#commit-message-guidelines\">Commit message guidelines</a></h4>\n<p>A good commit message should describe what changed and why. The Electron project\nuses <a href=\"https://conventionalcommits.org/\">semantic commit messages</a> to streamline\nthe release process.</p>\n<p>Before a pull request can be merged, it <strong>must</strong> have a pull request title with a semantic prefix.</p>\n<p>Examples of commit messages with semantic prefixes:</p>\n<ul>\n<li><code>fix: don't overwrite prevent_default if default wasn't prevented</code></li>\n<li><code>feat: add app.isPackaged() method</code></li>\n<li><code>docs: app.isDefaultProtocolClient is now available on Linux</code></li>\n</ul>\n<p>Common prefixes:</p>\n<ul>\n<li>fix: A bug fix</li>\n<li>feat: A new feature</li>\n<li>docs: Documentation changes</li>\n<li>test: Adding missing tests or correcting existing tests</li>\n<li>build: Changes that affect the build system</li>\n<li>ci: Changes to our CI configuration files and scripts</li>\n<li>perf: A code change that improves performance</li>\n<li>refactor: A code change that neither fixes a bug nor adds a feature</li>\n<li>style: Changes that do not affect the meaning of the code (linting)</li>\n</ul>\n<p>Other things to keep in mind when writing a commit message:</p>\n<ol>\n<li>The first line should:<ul>\n<li>contain a short description of the change (preferably 50 characters or less,\nand no more than 72 characters)</li>\n<li>be entirely in lowercase with the exception of proper nouns, acronyms, and\nthe words that refer to code, like function/variable names</li>\n</ul></li>\n<li>Keep the second line blank.</li>\n<li>Wrap all other lines at 72 columns.</li>\n</ol>\n<h4 id=\"breaking-changes\"><a href=\"#breaking-changes\">Breaking Changes</a></h4>\n<p>A commit that has the text <code>BREAKING CHANGE:</code> at the beginning of its optional\nbody or footer section introduces a breaking API change (correlating with Major\nin semantic versioning). A breaking change can be part of commits of any type.\ne.g., a <code>fix:</code>, <code>feat:</code> &#x26; <code>chore:</code> types would all be valid, in addition to any\nother type.</p>\n<p>See <a href=\"https://conventionalcommits.org\">conventionalcommits.org</a> for more details.</p>\n<h3 id=\"step-6-rebase\"><a href=\"#step-6-rebase\">Step 6: Rebase</a></h3>\n<p>Once you have committed your changes, it is a good idea to use <code>git rebase</code>\n(not <code>git merge</code>) to synchronize your work with the main repository.</p>\n<pre><code class=\"hljs language-sh\">$ git fetch upstream\n$ git rebase upstream/main\n</code></pre>\n<p>This ensures that your working branch has the latest changes from <code>electron/electron</code>\nmain.</p>\n<h3 id=\"step-7-test\"><a href=\"#step-7-test\">Step 7: Test</a></h3>\n<p>Bug fixes and features should always come with tests. A\n<a href=\"/docs/development/testing\">testing guide</a> has been\nprovided to make the process easier. Looking at other tests to see how they\nshould be structured can also help.</p>\n<p>Before submitting your changes in a pull request, always run the full\ntest suite. To run the tests:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>Make sure the linter does not report any issues and that all tests pass.\nPlease do not submit patches that fail either check.</p>\n<p>If you are updating tests and want to run a single spec to check it:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span> -match=menu\n</code></pre>\n<p>The above would only run spec modules matching <code>menu</code>, which is useful for\nanyone who's working on tests that would otherwise be at the very end of\nthe testing cycle.</p>\n<h3 id=\"step-8-push\"><a href=\"#step-8-push\">Step 8: Push</a></h3>\n<p>Once your commits are ready to go -- with passing tests and linting --\nbegin the process of opening a pull request by pushing your working branch\nto your fork on GitHub.</p>\n<pre><code class=\"hljs language-sh\">$ git push origin my-branch\n</code></pre>\n<h3 id=\"step-9-opening-the-pull-request\"><a href=\"#step-9-opening-the-pull-request\">Step 9: Opening the Pull Request</a></h3>\n<p>From within GitHub, opening a new pull request will present you with a template\nthat should be filled out:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"xml\"><span class=\"hljs-comment\">&#x3C;!--\nThank you for your pull request. Please provide a description above and review\nthe requirements below.\n\nBug fixes and new features should include tests and possibly benchmarks.\n\nContributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.md\n--></span></span>\n</code></pre>\n<h3 id=\"step-10-discuss-and-update\"><a href=\"#step-10-discuss-and-update\">Step 10: Discuss and update</a></h3>\n<p>You will probably get feedback or requests for changes to your pull request.\nThis is a big part of the submission process so don't be discouraged! Some\ncontributors may sign off on the pull request right away. Others may have\ndetailed comments or feedback. This is a necessary part of the process\nin order to evaluate whether the changes are correct and necessary.</p>\n<p>To make changes to an existing pull request, make the changes to your local\nbranch, add a new commit with those changes, and push those to your fork.\nGitHub will automatically update the pull request.</p>\n<pre><code class=\"hljs language-sh\">$ git add my/changed/files\n$ git commit\n$ git push origin my-branch\n</code></pre>\n<p>There are a number of more advanced mechanisms for managing commits using\n<code>git rebase</code> that can be used, but are beyond the scope of this guide.</p>\n<p>Feel free to post a comment in the pull request to ping reviewers if you are\nawaiting an answer on something. If you encounter words or acronyms that\nseem unfamiliar, refer to this\n<a href=\"https://sites.google.com/a/chromium.org/dev/glossary\">glossary</a>.</p>\n<h4 id=\"approval-and-request-changes-workflow\"><a href=\"#approval-and-request-changes-workflow\">Approval and Request Changes Workflow</a></h4>\n<p>All pull requests require approval from a\n<a href=\"https://github.com/electron/electron/blob/main/.github/CODEOWNERS\">Code Owner</a>\nof the area you modified in order to land. Whenever a maintainer reviews a pull\nrequest they may request changes. These may be small, such as fixing a typo, or\nmay involve substantive changes. Such requests are intended to be helpful, but\nat times may come across as abrupt or unhelpful, especially if they do not include\nconcrete suggestions on <em>how</em> to change them.</p>\n<p>Try not to be discouraged. If you feel that a review is unfair, say so or seek\nthe input of another project contributor. Often such comments are the result of\na reviewer having taken insufficient time to review and are not ill-intended.\nSuch difficulties can often be resolved with a bit of patience. That said,\nreviewers should be expected to provide helpful feedback.</p>\n<h3 id=\"step-11-landing\"><a href=\"#step-11-landing\">Step 11: Landing</a></h3>\n<p>In order to land, a pull request needs to be reviewed and approved by\nat least one Electron Code Owner and pass CI. After that, if there are no\nobjections from other contributors, the pull request can be merged.</p>\n<p>Congratulations and thanks for your contribution!</p>\n<h3 id=\"continuous-integration-testing\"><a href=\"#continuous-integration-testing\">Continuous Integration Testing</a></h3>\n<p>Every pull request is tested on the Continuous Integration (CI) system to\nconfirm that it works on Electron's supported platforms.</p>\n<p>Ideally, the pull request will pass (\"be green\") on all of CI's platforms.\nThis means that all tests pass and there are no linting errors. However,\nit is not uncommon for the CI infrastructure itself to fail on specific\nplatforms or for so-called \"flaky\" tests to fail (\"be red\"). Each CI\nfailure must be manually inspected to determine the cause.</p>\n<p>CI starts automatically when you open a pull request, but only\ncore maintainers can restart a CI run. If you believe CI is giving a\nfalse negative, ask a maintainer to restart the tests.</p>",
      "title": "Pull Requests",
      "description": ""
    },
    "/docs/tutorial/quick-start": {
      "locale": "en-US",
      "slug": "quick-start",
      "href": "/docs/tutorial/quick-start",
      "crowdinFileId": "256237",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/quick-start.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"quick-start\"><a href=\"#quick-start\">Quick Start</a></h1>\n<p>This guide will step you through the process of creating a barebones Hello World app in\nElectron, similar to <a href=\"https://github.com/electron/electron-quick-start\"><code>electron/electron-quick-start</code></a>.</p>\n<p>By the end of this tutorial, your app will open a browser window that displays a web page\nwith information about which Chromium, Node.js, and Electron versions are running.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<p>To use Electron, you need to install <a href=\"https://nodejs.org/en/download/\">Node.js</a>. We recommend that you\nuse the latest <code>LTS</code> version available.</p>\n<blockquote>\n<p>Please install Node.js using pre-built installers for your platform.\nYou may encounter incompatibility issues with different development tools otherwise.</p>\n</blockquote>\n<p>To check that Node.js was installed correctly, type the following commands in your\nterminal client:</p>\n<pre><code class=\"hljs language-sh\">node -v\nnpm -v\n</code></pre>\n<p>The commands should print the versions of Node.js and npm accordingly.</p>\n<p><strong>Note:</strong> Since Electron embeds Node.js into its binary, the version of Node.js running\nyour code is unrelated to the version running on your system.</p>\n<h2 id=\"create-your-application\"><a href=\"#create-your-application\">Create your application</a></h2>\n<h3 id=\"scaffold-the-project\"><a href=\"#scaffold-the-project\">Scaffold the project</a></h3>\n<p>Electron apps follow the same general structure as other Node.js projects.\nStart by creating a folder and initializing an npm package.</p>\n<pre><code class=\"hljs language-sh\">mkdir my-electron-app &#x26;&#x26; <span class=\"hljs-built_in\">cd</span> my-electron-app\nnpm init\n</code></pre>\n<p>The interactive <code>init</code> command will prompt you to set some fields in your config.\nThere are a few rules to follow for the purposes of this tutorial:</p>\n<ul>\n<li><code>entry point</code> should be <code>main.js</code>.</li>\n<li><code>author</code> and <code>description</code> can be any value, but are necessary for\n<a href=\"#package-and-distribute-your-application\">app packaging</a>.</li>\n</ul>\n<p>Your <code>package.json</code> file should look something like this:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"my-electron-app\"</span>,\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"1.0.0\"</span>,\n  <span class=\"hljs-attr\">\"description\"</span>: <span class=\"hljs-string\">\"Hello World!\"</span>,\n  <span class=\"hljs-attr\">\"main\"</span>: <span class=\"hljs-string\">\"main.js\"</span>,\n  <span class=\"hljs-attr\">\"author\"</span>: <span class=\"hljs-string\">\"Jane Doe\"</span>,\n  <span class=\"hljs-attr\">\"license\"</span>: <span class=\"hljs-string\">\"MIT\"</span>\n}\n</code></pre>\n<p>Then, install the <code>electron</code> package into your app's <code>devDependencies</code>.</p>\n<pre><code class=\"hljs language-sh\">$ npm install --save-dev electron\n</code></pre>\n<blockquote>\n<p>Note: If you're encountering any issues with installing Electron, please\nrefer to the <a href=\"/docs/tutorial/installation\">Advanced Installation</a> guide.</p>\n</blockquote>\n<p>Finally, you want to be able to execute Electron. In the <a href=\"https://docs.npmjs.com/cli/v7/using-npm/scripts\"><code>scripts</code></a>\nfield of your <code>package.json</code> config, add a <code>start</code> command like so:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"scripts\"</span>: {\n    <span class=\"hljs-attr\">\"start\"</span>: <span class=\"hljs-string\">\"electron .\"</span>\n  }\n}\n</code></pre>\n<p>This <code>start</code> command will let you open your app in development mode.</p>\n<pre><code class=\"hljs language-sh\">npm start\n</code></pre>\n<blockquote>\n<p>Note: This script tells Electron to run on your project's root folder. At this stage,\nyour app will immediately throw an error telling you that it cannot find an app to run.</p>\n</blockquote>\n<h3 id=\"run-the-main-process\"><a href=\"#run-the-main-process\">Run the main process</a></h3>\n<p>The entry point of any Electron application is its <code>main</code> script. This script controls the\n<strong>main process</strong>, which runs in a full Node.js environment and is responsible for\ncontrolling your app's lifecycle, displaying native interfaces, performing privileged\noperations, and managing renderer processes (more on that later).</p>\n<p>During execution, Electron will look for this script in the <a href=\"https://docs.npmjs.com/cli/v7/configuring-npm/package-json#main\"><code>main</code></a>\nfield of the app's <code>package.json</code> config, which you should have configured during the\n<a href=\"#scaffold-the-project\">app scaffolding</a> step.</p>\n<p>To initialize the <code>main</code> script, create an empty file named <code>main.js</code> in the root folder\nof your project.</p>\n<blockquote>\n<p>Note: If you run the <code>start</code> script again at this point, your app will no longer throw\nany errors! However, it won't do anything yet because we haven't added any code into\n<code>main.js</code>.</p>\n</blockquote>\n<h3 id=\"create-a-web-page\"><a href=\"#create-a-web-page\">Create a web page</a></h3>\n<p>Before we can create a window for our application, we need to create the content that\nwill be loaded into it. In Electron, each window displays web contents that can be loaded\nfrom either from a local HTML file or a remote URL.</p>\n<p>For this tutorial, you will be doing the former. Create an <code>index.html</code> file in the root\nfolder of your project:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-comment\">&#x3C;!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"X-Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    We are using Node.js <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"node-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    Chromium <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"chrome-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    and Electron <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"electron-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>.\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<blockquote>\n<p>Note: Looking at this HTML document, you can observe that the version numbers are\nmissing from the body text. We'll manually insert them later using JavaScript.</p>\n</blockquote>\n<h3 id=\"opening-your-web-page-in-a-browser-window\"><a href=\"#opening-your-web-page-in-a-browser-window\">Opening your web page in a browser window</a></h3>\n<p>Now that you have a web page, load it into an application window. To do so, you'll\nneed two Electron modules:</p>\n<ul>\n<li>The <a href=\"/docs/api/app\"><code>app</code></a> module, which controls your application's event lifecycle.</li>\n<li>The <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> module, which creates and manages application\nwindows.</li>\n</ul>\n<p>Because the main process runs Node.js, you can import these as <a href=\"https://nodejs.org/docs/latest/api/modules.html#modules_modules_commonjs_modules\">CommonJS</a>\nmodules at the top of your file:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>Then, add a <code>createWindow()</code> function that loads <code>index.html</code> into a new <code>BrowserWindow</code>\ninstance.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n</code></pre>\n<p>Next, call this <code>createWindow()</code> function to open your window.</p>\n<p>In Electron, browser windows can only be created after the <code>app</code> module's\n<a href=\"/docs/api/app#event-ready\"><code>ready</code></a> event is fired. You can wait for this event by using the\n<a href=\"/docs/api/app#appwhenready\"><code>app.whenReady()</code></a> API. Call <code>createWindow()</code> after <code>whenReady()</code>\nresolves its Promise.</p>\n<pre><code class=\"hljs language-js\">app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n})\n</code></pre>\n<blockquote>\n<p>Note: At this point, your Electron application should successfully\nopen a window that displays your web page!</p>\n</blockquote>\n<h3 id=\"manage-your-windows-lifecycle\"><a href=\"#manage-your-windows-lifecycle\">Manage your window's lifecycle</a></h3>\n<p>Although you can now open a browser window, you'll need some additional boilerplate code\nto make it feel more native to each platform. Application windows behave differently on\neach OS, and Electron puts the responsibility on developers to implement these\nconventions in their app.</p>\n<p>In general, you can use the <code>process</code> global's <a href=\"https://nodejs.org/api/process.html#process_process_platform\"><code>platform</code></a> attribute\nto run code specifically for certain operating systems.</p>\n<h4 id=\"quit-the-app-when-all-windows-are-closed-windows--linux\"><a href=\"#quit-the-app-when-all-windows-are-closed-windows--linux\">Quit the app when all windows are closed (Windows &#x26; Linux)</a></h4>\n<p>On Windows and Linux, exiting all windows generally quits an application entirely.</p>\n<p>To implement this, listen for the <code>app</code> module's <a href=\"/docs/api/app#event-window-all-closed\"><code>'window-all-closed'</code></a>\nevent, and call <a href=\"/docs/api/app#appquit\"><code>app.quit()</code></a> if the user is not on macOS (<code>darwin</code>).</p>\n<pre><code class=\"hljs language-js\">app.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h4 id=\"open-a-window-if-none-are-open-macos\"><a href=\"#open-a-window-if-none-are-open-macos\">Open a window if none are open (macOS)</a></h4>\n<p>Whereas Linux and Windows apps quit when they have no windows open, macOS apps generally\ncontinue running even without any windows open, and activating the app when no windows\nare available should open a new one.</p>\n<p>To implement this feature, listen for the <code>app</code> module's <a href=\"/docs/api/app#event-activate-macos\"><code>activate</code></a>\nevent, and call your existing <code>createWindow()</code> method if no browser windows are open.</p>\n<p>Because windows cannot be created before the <code>ready</code> event, you should only listen for\n<code>activate</code> events after your app is initialized. Do this by attaching your event listener\nfrom within your existing <code>whenReady()</code> callback.</p>\n<pre><code class=\"hljs language-js\">app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) createWindow()\n  })\n})\n</code></pre>\n<blockquote>\n<p>Note: At this point, your window controls should be fully functional!</p>\n</blockquote>\n<h3 id=\"access-nodejs-from-the-renderer-with-a-preload-script\"><a href=\"#access-nodejs-from-the-renderer-with-a-preload-script\">Access Node.js from the renderer with a preload script</a></h3>\n<p>Now, the last thing to do is print out the version numbers for Electron and its\ndependencies onto your web page.</p>\n<p>Accessing this information is trivial to do in the main process through Node's\nglobal <code>process</code> object. However, you can't just edit the DOM from the main\nprocess because it has no access to the renderer's <code>document</code> context.\nThey're in entirely different processes!</p>\n<blockquote>\n<p>Note: If you need a more in-depth look at Electron processes, see the\n<a href=\"/docs/tutorial/process-model\">Process Model</a> document.</p>\n</blockquote>\n<p>This is where attaching a <strong>preload</strong> script to your renderer comes in handy.\nA preload script runs before the renderer process is loaded, and has access to both\nrenderer globals (e.g. <code>window</code> and <code>document</code>) and a Node.js environment.</p>\n<p>Create a new script named <code>preload.js</code> as such:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'DOMContentLoaded'</span>, () => {\n  <span class=\"hljs-keyword\">const</span> replaceText = <span class=\"hljs-function\">(<span class=\"hljs-params\">selector, text</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> element = <span class=\"hljs-built_in\">document</span>.getElementById(selector)\n    <span class=\"hljs-keyword\">if</span> (element) element.innerText = text\n  }\n\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> dependency <span class=\"hljs-keyword\">of</span> [<span class=\"hljs-string\">'chrome'</span>, <span class=\"hljs-string\">'node'</span>, <span class=\"hljs-string\">'electron'</span>]) {\n    replaceText(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${dependency}</span>-version`</span>, process.versions[dependency])\n  }\n})\n</code></pre>\n<p>The above code accesses the Node.js <code>process.versions</code> object and runs a basic <code>replaceText</code>\nhelper function to insert the version numbers into the HTML document.</p>\n<p>To attach this script to your renderer process, pass in the path to your preload script\nto the <code>webPreferences.preload</code> option in your existing <code>BrowserWindow</code> constructor.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// include the Node.js 'path' module at the top of your file</span>\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-comment\">// modify your existing createWindow() function</span>\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n<span class=\"hljs-comment\">// ...</span>\n</code></pre>\n<p>There are two Node.js concepts that are used here:</p>\n<ul>\n<li>The <a href=\"https://nodejs.org/api/modules.html#modules_dirname\"><code>__dirname</code></a> string points to the path of the currently executing script\n(in this case, your project's root folder).</li>\n<li>The <a href=\"https://nodejs.org/api/path.html#path_path_join_paths\"><code>path.join</code></a> API joins multiple path segments together, creating a\ncombined path string that works across all platforms.</li>\n</ul>\n<p>We use a path relative to the currently executing JavaScript file so that your relative\npath will work in both development and packaged mode.</p>\n<h3 id=\"bonus-add-functionality-to-your-web-contents\"><a href=\"#bonus-add-functionality-to-your-web-contents\">Bonus: Add functionality to your web contents</a></h3>\n<p>At this point, you might be wondering how to add more functionality to your application.</p>\n<p>For any interactions with your web contents, you want to add scripts to your\nrenderer process. Because the renderer runs in a normal web environment, you can add a\n<code>&#x3C;script></code> tag right before your <code>index.html</code> file's closing <code>&#x3C;/body></code> tag to include\nany arbitrary scripts you want:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"./renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<p>The code contained in <code>renderer.js</code> can then use the same JavaScript APIs and tooling\nyou use for typical front-end development, such as using <a href=\"https://webpack.js.org\"><code>webpack</code></a> to bundle\nand minify your code or <a href=\"https://reactjs.org\">React</a> to manage your user interfaces.</p>\n<h3 id=\"recap\"><a href=\"#recap\">Recap</a></h3>\n<p>After following the above steps, you should have a fully functional\nElectron application that looks like this:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/simplest-electron-app.png\" alt=\"Simplest Electron app\"></p>\n<!--TODO(erickzhao): Remove the individual code blocks for static website -->\n<p>The full code is available below:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\n\n<span class=\"hljs-comment\">// Modules to control application life and create native browser window</span>\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-comment\">// Create the browser window.</span>\n  <span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  <span class=\"hljs-comment\">// and load the index.html of the app.</span>\n  mainWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-comment\">// Open the DevTools.</span>\n  <span class=\"hljs-comment\">// mainWindow.webContents.openDevTools()</span>\n}\n\n<span class=\"hljs-comment\">// This method will be called when Electron has finished</span>\n<span class=\"hljs-comment\">// initialization and is ready to create browser windows.</span>\n<span class=\"hljs-comment\">// Some APIs can only be used after this event occurs.</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n    <span class=\"hljs-comment\">// On macOS it's common to re-create a window in the app when the</span>\n    <span class=\"hljs-comment\">// dock icon is clicked and there are no other windows open.</span>\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) createWindow()\n  })\n})\n\n<span class=\"hljs-comment\">// Quit when all windows are closed, except on macOS. There, it's common</span>\n<span class=\"hljs-comment\">// for applications and their menu bar to stay active until the user quits</span>\n<span class=\"hljs-comment\">// explicitly with Cmd + Q.</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n\n<span class=\"hljs-comment\">// In this file you can include the rest of your app's specific main process</span>\n<span class=\"hljs-comment\">// code. You can also put them in separate files and require them here.</span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// preload.js</span>\n\n<span class=\"hljs-comment\">// All of the Node.js APIs are available in the preload process.</span>\n<span class=\"hljs-comment\">// It has the same sandbox as a Chrome extension.</span>\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'DOMContentLoaded'</span>, () => {\n  <span class=\"hljs-keyword\">const</span> replaceText = <span class=\"hljs-function\">(<span class=\"hljs-params\">selector, text</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> element = <span class=\"hljs-built_in\">document</span>.getElementById(selector)\n    <span class=\"hljs-keyword\">if</span> (element) element.innerText = text\n  }\n\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> dependency <span class=\"hljs-keyword\">of</span> [<span class=\"hljs-string\">'chrome'</span>, <span class=\"hljs-string\">'node'</span>, <span class=\"hljs-string\">'electron'</span>]) {\n    replaceText(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${dependency}</span>-version`</span>, process.versions[dependency])\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!--index.html--></span>\n\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-comment\">&#x3C;!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"X-Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    We are using Node.js <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"node-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    Chromium <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"chrome-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    and Electron <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"electron-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>.\n\n    <span class=\"hljs-comment\">&#x3C;!-- You can also require other files to run in this process --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"./renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>To summarize all the steps we've done:</p>\n<ul>\n<li>We bootstrapped a Node.js application and added Electron as a dependency.</li>\n<li>We created a <code>main.js</code> script that runs our main process, which controls our app\nand runs in a Node.js environment. In this script, we used Electron's <code>app</code> and\n<code>BrowserWindow</code> modules to create a browser window that displays web content\nin a separate process (the renderer).</li>\n<li>In order to access certain Node.js functionality in the renderer, we attached\na preload script to our <code>BrowserWindow</code> constructor.</li>\n</ul>\n<h2 id=\"package-and-distribute-your-application\"><a href=\"#package-and-distribute-your-application\">Package and distribute your application</a></h2>\n<p>The fastest way to distribute your newly created app is using\n<a href=\"https://www.electronforge.io\">Electron Forge</a>.</p>\n<ol>\n<li>\n<p>Add Electron Forge as a development dependency of your app, and use its <code>import</code> command to set up\nForge's scaffolding:</p>\n<pre><code class=\"hljs language-routeros\">```sh npm2yarn\nnpm install --save-dev @electron-forge/cli\nnpx electron-forge import\n\n✔ Checking your<span class=\"hljs-built_in\"> system\n</span>✔ Initializing Git Repository\n✔ Writing modified package.json file\n✔ Installing dependencies\n✔ Writing modified package.json file\n✔ Fixing .gitignore\n\nWe have ATTEMPTED <span class=\"hljs-keyword\">to</span> convert your app <span class=\"hljs-keyword\">to</span> be <span class=\"hljs-keyword\">in</span> a format that electron-forge understands.\n\nThanks <span class=\"hljs-keyword\">for</span> using <span class=\"hljs-string\">\"electron-forge\"</span>!!!\n```\n</code></pre>\n</li>\n<li>\n<p>Create a distributable using Forge's <code>make</code> command:</p>\n<pre><code class=\"hljs language-sh\">npm run make\n\n> my-electron-app@1.0.0 make /my-electron-app\n> electron-forge make\n\n✔ Checking your system\n✔ Resolving Forge Config\nWe need to package your application before we can make it\n✔ Preparing to Package Application <span class=\"hljs-keyword\">for</span> arch: x64\n✔ Preparing native dependencies\n✔ Packaging Application\nMaking <span class=\"hljs-keyword\">for</span> the following targets: zip\n✔ Making <span class=\"hljs-keyword\">for</span> target: zip - On platform: darwin - For arch: x64\n</code></pre>\n<p>Electron Forge creates the <code>out</code> folder where your package will be located:</p>\n<pre><code class=\"hljs language-plain\">// Example for macOS\nout/\n├── out/make/zip/darwin/x64/my-electron-app-darwin-x64-1.0.0.zip\n├── ...\n└── out/my-electron-app-darwin-x64/my-electron-app.app/Contents/MacOS/my-electron-app\n</code></pre>\n</li>\n</ol>",
      "title": "Quick Start",
      "description": "Please install Node.js using pre-built installers for your platform.\nYou may encounter incompatibility issues with different development tools otherwise."
    },
    "/docs/README": {
      "locale": "en-US",
      "slug": "README",
      "href": "/docs/README",
      "crowdinFileId": "256115",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/README.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"official-guides\"><a href=\"#official-guides\">Official Guides</a></h1>\n<p>Please make sure that you use the documents that match your Electron version.\nThe version number should be a part of the page URL. If it's not, you are\nprobably using the documentation of a development branch which may contain API\nchanges that are not compatible with your Electron version. To view older\nversions of the documentation, you can\n<a href=\"https://github.com/electron/electron/tree/v1.4.0\">browse by tag</a>\non GitHub by opening the \"Switch branches/tags\" dropdown and selecting the tag\nthat matches your version.</p>\n<h2 id=\"faq\"><a href=\"#faq\">FAQ</a></h2>\n<p>There are questions that are asked quite often. Check this out before creating\nan issue:</p>\n<ul>\n<li><a href=\"/docs/faq\">Electron FAQ</a></li>\n</ul>\n<h2 id=\"guides-and-tutorials\"><a href=\"#guides-and-tutorials\">Guides and Tutorials</a></h2>\n<h3 id=\"getting-started\"><a href=\"#getting-started\">Getting started</a></h3>\n<ul>\n<li><a href=\"/docs/tutorial/introduction\">Introduction</a></li>\n<li><a href=\"/docs/tutorial/quick-start\">Quick Start</a></li>\n<li><a href=\"/docs/tutorial/process-model\">Process Model</a></li>\n</ul>\n<h3 id=\"learning-the-basics\"><a href=\"#learning-the-basics\">Learning the basics</a></h3>\n<ul>\n<li>Adding Features to Your App<ul>\n<li><a href=\"/docs/tutorial/notifications\">Notifications</a></li>\n<li><a href=\"/docs/tutorial/recent-documents\">Recent Documents</a></li>\n<li><a href=\"/docs/tutorial/progress-bar\">Application Progress</a></li>\n<li><a href=\"/docs/tutorial/macos-dock\">Custom Dock Menu</a></li>\n<li><a href=\"/docs/tutorial/windows-taskbar\">Custom Windows Taskbar</a></li>\n<li><a href=\"/docs/tutorial/linux-desktop-actions\">Custom Linux Desktop Actions</a></li>\n<li><a href=\"/docs/tutorial/keyboard-shortcuts\">Keyboard Shortcuts</a></li>\n<li><a href=\"/docs/tutorial/online-offline-events\">Offline/Online Detection</a></li>\n<li><a href=\"/docs/tutorial/represented-file\">Represented File for macOS BrowserWindows</a></li>\n<li><a href=\"/docs/tutorial/native-file-drag-drop\">Native File Drag &#x26; Drop</a></li>\n<li><a href=\"/docs/tutorial/offscreen-rendering\">Offscreen Rendering</a></li>\n<li><a href=\"/docs/tutorial/dark-mode\">Dark Mode</a></li>\n<li><a href=\"/docs/tutorial/web-embeds\">Web embeds in Electron</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis\">Boilerplates and CLIs</a><ul>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#boilerplate-vs-cli\">Boilerplate vs CLI</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-forge\">electron-forge</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-builder\">electron-builder</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-react-boilerplate\">electron-react-boilerplate</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#other-tools-and-boilerplates\">Other Tools and Boilerplates</a></li>\n</ul></li>\n</ul>\n<h3 id=\"advanced-steps\"><a href=\"#advanced-steps\">Advanced steps</a></h3>\n<ul>\n<li>Application Architecture<ul>\n<li><a href=\"/docs/tutorial/using-native-node-modules\">Using Native Node.js Modules</a></li>\n<li><a href=\"/docs/tutorial/performance\">Performance Strategies</a></li>\n<li><a href=\"/docs/tutorial/security\">Security Strategies</a></li>\n<li><a href=\"/docs/tutorial/sandbox\">Process Sandboxing</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/accessibility\">Accessibility</a><ul>\n<li><a href=\"/docs/tutorial/accessibility#manually-enabling-accessibility-features\">Manually Enabling Accessibility Features</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/application-debugging\">Testing and Debugging</a><ul>\n<li><a href=\"/docs/tutorial/debugging-main-process\">Debugging the Main Process</a></li>\n<li><a href=\"/docs/tutorial/debugging-vscode\">Debugging with Visual Studio Code</a></li>\n<li><a href=\"/docs/tutorial/using-selenium-and-webdriver\">Using Selenium and WebDriver</a></li>\n<li><a href=\"/docs/tutorial/testing-on-headless-ci\">Testing on Headless CI Systems (Travis, Jenkins)</a></li>\n<li><a href=\"/docs/tutorial/devtools-extension\">DevTools Extension</a></li>\n<li><a href=\"/docs/tutorial/automated-testing-with-a-custom-driver\">Automated Testing with a Custom Driver</a></li>\n<li><a href=\"/docs/tutorial/repl\">REPL</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/application-distribution\">Distribution</a><ul>\n<li><a href=\"/docs/tutorial/support#supported-platforms\">Supported Platforms</a></li>\n<li><a href=\"/docs/tutorial/code-signing\">Code Signing</a></li>\n<li><a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store</a></li>\n<li><a href=\"/docs/tutorial/windows-store-guide\">Windows Store</a></li>\n<li><a href=\"/docs/tutorial/snapcraft\">Snapcraft</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/updates\">Updates</a><ul>\n<li><a href=\"/docs/tutorial/updates#deploying-an-update-server\">Deploying an Update Server</a></li>\n<li><a href=\"/docs/tutorial/updates#implementing-updates-in-your-app\">Implementing Updates in Your App</a></li>\n<li><a href=\"/docs/tutorial/updates#applying-updates\">Applying Updates</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/support\">Getting Support</a></li>\n</ul>\n<h2 id=\"detailed-tutorials\"><a href=\"#detailed-tutorials\">Detailed Tutorials</a></h2>\n<p>These individual tutorials expand on topics discussed in the guide above.</p>\n<ul>\n<li><a href=\"/docs/tutorial/installation\">Installing Electron</a><ul>\n<li><a href=\"/docs/tutorial/installation#proxies\">Proxies</a></li>\n<li><a href=\"/docs/tutorial/installation#custom-mirrors-and-caches\">Custom Mirrors and Caches</a></li>\n<li><a href=\"/docs/tutorial/installation#troubleshooting\">Troubleshooting</a></li>\n</ul></li>\n<li>Electron Releases &#x26; Developer Feedback<ul>\n<li><a href=\"/docs/tutorial/electron-versioning\">Versioning Policy</a></li>\n<li><a href=\"/docs/tutorial/electron-timelines\">Release Timelines</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/testing-widevine-cdm\">Testing Widevine CDM</a></li>\n</ul>\n<hr>\n<ul>\n<li><a href=\"/docs/glossary\">Glossary of Terms</a></li>\n</ul>\n<h2 id=\"api-references\"><a href=\"#api-references\">API References</a></h2>\n<ul>\n<li><a href=\"/docs/api/synopsis\">Synopsis</a></li>\n<li><a href=\"/docs/api/process\">Process Object</a></li>\n<li><a href=\"/docs/api/command-line-switches\">Supported Command Line Switches</a></li>\n<li><a href=\"/docs/api/environment-variables\">Environment Variables</a></li>\n<li><a href=\"/docs/api/extensions\">Chrome Extensions Support</a></li>\n<li><a href=\"/docs/breaking-changes\">Breaking API Changes</a></li>\n</ul>\n<h3 id=\"custom-dom-elements\"><a href=\"#custom-dom-elements\">Custom DOM Elements:</a></h3>\n<ul>\n<li><a href=\"/docs/api/file-object\"><code>File</code> Object</a></li>\n<li><a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code> Tag</a></li>\n<li><a href=\"/docs/api/window-open\"><code>window.open</code> Function</a></li>\n<li><a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code> Object</a></li>\n</ul>\n<h3 id=\"modules-for-the-main-process\"><a href=\"#modules-for-the-main-process\">Modules for the Main Process:</a></h3>\n<ul>\n<li><a href=\"/docs/api/app\">app</a></li>\n<li><a href=\"/docs/api/auto-updater\">autoUpdater</a></li>\n<li><a href=\"/docs/api/browser-view\">BrowserView</a></li>\n<li><a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n<li><a href=\"/docs/api/content-tracing\">contentTracing</a></li>\n<li><a href=\"/docs/api/dialog\">dialog</a></li>\n<li><a href=\"/docs/api/global-shortcut\">globalShortcut</a></li>\n<li><a href=\"/docs/api/in-app-purchase\">inAppPurchase</a></li>\n<li><a href=\"/docs/api/ipc-main\">ipcMain</a></li>\n<li><a href=\"/docs/api/menu\">Menu</a></li>\n<li><a href=\"/docs/api/menu-item\">MenuItem</a></li>\n<li><a href=\"/docs/api/message-channel-main\">MessageChannelMain</a></li>\n<li><a href=\"/docs/api/message-port-main\">MessagePortMain</a></li>\n<li><a href=\"/docs/api/net\">net</a></li>\n<li><a href=\"/docs/api/net-log\">netLog</a></li>\n<li><a href=\"/docs/api/native-theme\">nativeTheme</a></li>\n<li><a href=\"/docs/api/notification\">Notification</a></li>\n<li><a href=\"/docs/api/power-monitor\">powerMonitor</a></li>\n<li><a href=\"/docs/api/power-save-blocker\">powerSaveBlocker</a></li>\n<li><a href=\"/docs/api/protocol\">protocol</a></li>\n<li><a href=\"/docs/api/screen\">screen</a></li>\n<li><a href=\"/docs/api/session\">session</a></li>\n<li><a href=\"/docs/api/share-menu\">ShareMenu</a></li>\n<li><a href=\"/docs/api/system-preferences\">systemPreferences</a></li>\n<li><a href=\"/docs/api/touch-bar\">TouchBar</a></li>\n<li><a href=\"/docs/api/tray\">Tray</a></li>\n<li><a href=\"/docs/api/web-contents\">webContents</a></li>\n<li><a href=\"/docs/api/web-frame-main\">webFrameMain</a></li>\n</ul>\n<h3 id=\"modules-for-the-renderer-process-web-page\"><a href=\"#modules-for-the-renderer-process-web-page\">Modules for the Renderer Process (Web Page):</a></h3>\n<ul>\n<li><a href=\"/docs/api/context-bridge\">contextBridge</a></li>\n<li><a href=\"/docs/api/ipc-renderer\">ipcRenderer</a></li>\n<li><a href=\"/docs/api/web-frame\">webFrame</a></li>\n</ul>\n<h3 id=\"modules-for-both-processes\"><a href=\"#modules-for-both-processes\">Modules for Both Processes:</a></h3>\n<ul>\n<li><a href=\"/docs/api/clipboard\">clipboard</a></li>\n<li><a href=\"/docs/api/crash-reporter\">crashReporter</a></li>\n<li><a href=\"/docs/api/desktop-capturer\">desktopCapturer</a></li>\n<li><a href=\"/docs/api/native-image\">nativeImage</a></li>\n<li><a href=\"/docs/api/shell\">shell</a></li>\n</ul>\n<h2 id=\"development\"><a href=\"#development\">Development</a></h2>\n<p>See <a href=\"/docs/development/README\">development/README.md</a></p>",
      "title": "Official Guides",
      "description": ""
    },
    "/docs/development/README": {
      "locale": "en-US",
      "slug": "README",
      "href": "/docs/development/README",
      "crowdinFileId": "256127",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/README.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"developing-electron\"><a href=\"#developing-electron\">Developing Electron</a></h1>\n<p>These guides are intended for people working on the Electron project itself.\nFor guides on Electron app development, see\n<a href=\"/docs/README#guides-and-tutorials\">/docs/README.md</a>.</p>\n<ul>\n<li><a href=\"https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md\">Code of Conduct</a></li>\n<li><a href=\"https://github.com/electron/electron/blob/main/CONTRIBUTING.md\">Contributing to Electron</a></li>\n<li><a href=\"/docs/development/issues\">Issues</a></li>\n<li><a href=\"/docs/development/pull-requests\">Pull Requests</a></li>\n<li><a href=\"/docs/development/coding-style#documentation\">Documentation Styleguide</a></li>\n<li><a href=\"/docs/development/source-code-directory-structure\">Source Code Directory Structure</a></li>\n<li><a href=\"/docs/development/coding-style\">Coding Style</a></li>\n<li><a href=\"/docs/development/clang-format\">Using clang-format on C++ Code</a></li>\n<li><a href=\"/docs/development/clang-tidy\">Using clang-tidy on C++ Code</a></li>\n<li><a href=\"/docs/development/build-system-overview\">Build System Overview</a></li>\n<li><a href=\"/docs/development/build-instructions-macos\">Build Instructions (macOS)</a></li>\n<li><a href=\"/docs/development/build-instructions-windows\">Build Instructions (Windows)</a></li>\n<li><a href=\"/docs/development/build-instructions-linux\">Build Instructions (Linux)</a></li>\n<li><a href=\"/docs/development/chromium-development\">Chromium Development</a></li>\n<li><a href=\"/docs/development/v8-development\">V8 Development</a></li>\n<li><a href=\"/docs/development/testing\">Testing</a></li>\n<li><a href=\"/docs/development/debug-instructions-windows\">Debugging on Windows</a></li>\n<li><a href=\"/docs/development/debugging-instructions-macos\">Debugging on macOS</a></li>\n<li><a href=\"/docs/development/setting-up-symbol-server\">Setting Up Symbol Server in Debugger</a></li>\n<li><a href=\"/docs/development/patches\">Patches</a></li>\n</ul>",
      "title": "Developing Electron",
      "description": ""
    },
    "/docs/tutorial/recent-documents": {
      "locale": "en-US",
      "slug": "recent-documents",
      "href": "/docs/tutorial/recent-documents",
      "crowdinFileId": "256239",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/recent-documents.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"recent-documents-windows--macos\"><a href=\"#recent-documents-windows--macos\">Recent Documents (Windows &#x26; macOS)</a></h1>\n<h2 id=\"overview\"><a href=\"#overview\">Overview</a></h2>\n<p>Windows and macOS provide access to a list of recent documents opened by\nthe application via JumpList or dock menu, respectively.</p>\n<p><strong>JumpList:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/2289/23446924/11a27b98-fdfc-11e6-8485-cc3b1e86b80a.png\" alt=\"JumpList Recent Files\"></p>\n<p><strong>Application dock menu:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5069610/2aa80758-6e97-11e4-8cfb-c1a414a10774.png\" alt=\"macOS Dock Menu\"></p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<h3 id=\"managing-recent-documents\"><a href=\"#managing-recent-documents\">Managing recent documents</a></h3>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/recent-documents\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\n<span class=\"hljs-keyword\">const</span> fileName = <span class=\"hljs-string\">'recently-used.md'</span>\nfs.writeFile(fileName, <span class=\"hljs-string\">'Lorem Ipsum'</span>, () => {\n  app.addRecentDocument(path.join(__dirname, fileName))\n})\n\napp.whenReady().then(createWindow)\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  app.clearRecentDocuments()\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<h4 id=\"adding-a-recent-document\"><a href=\"#adding-a-recent-document\">Adding a recent document</a></h4>\n<p>To add a file to recent documents, use the\n<a href=\"/docs/api/app#appaddrecentdocumentpath-macos-windows\">app.addRecentDocument</a> API.</p>\n<p>After launching the Electron application, right click the application icon.\nIn this guide, the item is a Markdown file located in the root of the project.\nYou should see <code>recently-used.md</code> added to the list of recent files:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/recent-documents.png\" alt=\"Recent document\"></p>\n<h4 id=\"clearing-the-list-of-recent-documents\"><a href=\"#clearing-the-list-of-recent-documents\">Clearing the list of recent documents</a></h4>\n<p>To clear the list of recent documents, use the\n<a href=\"/docs/api/app#appclearrecentdocuments-macos-windows\">app.clearRecentDocuments</a> API.\nIn this guide, the list of documents is cleared once all windows have been\nclosed.</p>\n<h2 id=\"additional-information\"><a href=\"#additional-information\">Additional information</a></h2>\n<h3 id=\"windows-notes\"><a href=\"#windows-notes\">Windows Notes</a></h3>\n<p>To use this feature on Windows, your application has to be registered as\na handler of the file type of the document, otherwise the file won't appear\nin JumpList even after you have added it. You can find everything\non registering your application in <a href=\"https://msdn.microsoft.com/en-us/library/cc144104(VS.85).aspx\">Application Registration</a>.</p>\n<p>When a user clicks a file from the JumpList, a new instance of your application\nwill be started with the path of the file added as a command line argument.</p>\n<h3 id=\"macos-notes\"><a href=\"#macos-notes\">macOS Notes</a></h3>\n<h4 id=\"add-the-recent-documents-list-to-the-application-menu\"><a href=\"#add-the-recent-documents-list-to-the-application-menu\">Add the Recent Documents list to the application menu</a></h4>\n<p>You can add menu items to access and clear recent documents by adding the\nfollowing code snippet to your menu template:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"submenu\"</span>:[\n    {\n      <span class=\"hljs-attr\">\"label\"</span>:<span class=\"hljs-string\">\"Open Recent\"</span>,\n      <span class=\"hljs-attr\">\"role\"</span>:<span class=\"hljs-string\">\"recentdocuments\"</span>,\n      <span class=\"hljs-attr\">\"submenu\"</span>:[\n        {\n          <span class=\"hljs-attr\">\"label\"</span>:<span class=\"hljs-string\">\"Clear Recent\"</span>,\n          <span class=\"hljs-attr\">\"role\"</span>:<span class=\"hljs-string\">\"clearrecentdocuments\"</span>\n        }\n      ]\n    }\n  ]\n}\n</code></pre>\n<p>Make sure the application menu is added after the <a href=\"/docs/api/app#event-ready\"><code>'ready'</code></a>\nevent and not before, or the menu item will be disabled:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> template = [\n  <span class=\"hljs-comment\">// Menu template here</span>\n]\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  Menu.setApplicationMenu(menu)\n})\n</code></pre>\n<p><img src=\"https://user-images.githubusercontent.com/3168941/33003655-ea601c3a-cd70-11e7-97fa-7c062149cfb1.png\" alt=\"macOS Recent Documents menu item\"></p>\n<p>When a file is requested from the recent documents menu, the <code>open-file</code> event\nof <code>app</code> module will be emitted for it.</p>",
      "title": "Recent Documents (Windows & macOS)",
      "description": ""
    },
    "/docs/api/structures/rectangle": {
      "locale": "en-US",
      "slug": "rectangle",
      "href": "/docs/api/structures/rectangle",
      "crowdinFileId": "256493",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/rectangle.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"rectangle-object\"><a href=\"#rectangle-object\">Rectangle Object</a></h1>\n<ul>\n<li><code>x</code> Number - The x coordinate of the origin of the rectangle (must be an integer).</li>\n<li><code>y</code> Number - The y coordinate of the origin of the rectangle (must be an integer).</li>\n<li><code>width</code> Number - The width of the rectangle (must be an integer).</li>\n<li><code>height</code> Number - The height of the rectangle (must be an integer).</li>\n</ul>",
      "title": "Rectangle Object",
      "description": ""
    },
    "/docs/api/structures/referrer": {
      "locale": "en-US",
      "slug": "referrer",
      "href": "/docs/api/structures/referrer",
      "crowdinFileId": "256495",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/referrer.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"referrer-object\"><a href=\"#referrer-object\">Referrer Object</a></h1>\n<ul>\n<li><code>url</code> String - HTTP Referrer URL.</li>\n<li><code>policy</code> String - Can be <code>default</code>, <code>unsafe-url</code>,\n<code>no-referrer-when-downgrade</code>, <code>no-referrer</code>, <code>origin</code>,\n<code>strict-origin-when-cross-origin</code>, <code>same-origin</code> or <code>strict-origin</code>.\nSee the <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy\">Referrer-Policy spec</a> for more details on the\nmeaning of these values.</li>\n</ul>",
      "title": "Referrer Object",
      "description": ""
    },
    "/docs/tutorial/repl": {
      "locale": "en-US",
      "slug": "repl",
      "href": "/docs/tutorial/repl",
      "crowdinFileId": "256241",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/repl.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"repl\"><a href=\"#repl\">REPL</a></h1>\n<p><a href=\"https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop\">Read-Eval-Print-Loop</a> (REPL)\nis a simple, interactive computer programming environment that takes single user\ninputs (i.e. single expressions), evaluates them, and returns the result to the user.</p>\n<h2 id=\"main-process\"><a href=\"#main-process\">Main process</a></h2>\n<p>Electron exposes the <a href=\"https://nodejs.org/dist/latest/docs/api/repl.html\">Node.js <code>repl</code> module</a>\nthrough the <code>--interactive</code> CLI flag. Assuming you have <code>electron</code> installed as a local project\ndependency, you should be able to access the REPL with the following command:</p>\n<pre><code class=\"hljs language-sh\">./node_modules/.bin/electron --interactive\n</code></pre>\n<p><strong>Note:</strong> <code>electron --interactive</code> is not available on Windows\n(see <a href=\"https://github.com/electron/electron/pull/5776\">electron/electron#5776</a> for more details).</p>\n<h2 id=\"renderer-process\"><a href=\"#renderer-process\">Renderer process</a></h2>\n<p>You can use the DevTools Console tab to get a REPL for any renderer process.\nTo learn more, read <a href=\"https://developer.chrome.com/docs/devtools/console/\">the Chrome documentation</a>.</p>",
      "title": "REPL",
      "description": ""
    },
    "/docs/tutorial/represented-file": {
      "locale": "en-US",
      "slug": "represented-file",
      "href": "/docs/tutorial/represented-file",
      "crowdinFileId": "256243",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/represented-file.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"representing-files-in-a-browserwindow-macos\"><a href=\"#representing-files-in-a-browserwindow-macos\">Representing Files in a BrowserWindow (macOS)</a></h1>\n<h2 id=\"overview\"><a href=\"#overview\">Overview</a></h2>\n<p>On macOS, you can set a represented file for any window in your application.\nThe represented file's icon will be shown in the title bar, and when users\n<code>Command-Click</code> or <code>Control-Click</code>, a popup with a path to the file will be\nshown.</p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5082061/670a949a-6f14-11e4-987a-9aaa04b23c1d.png\" alt=\"Represented File\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example where this feature is used to indicate the currently opened file in the Atom text editor.</p>\n</blockquote>\n<p>You can also set the edited state for a window so that the file icon can\nindicate whether the document in this window has been modified.</p>\n<p>To set the represented file of window, you can use the\n<a href=\"/docs/api/browser-window#winsetrepresentedfilenamefilename-macos\">BrowserWindow.setRepresentedFilename</a> and\n<a href=\"/docs/api/browser-window#winsetdocumenteditededited-macos\">BrowserWindow.setDocumentEdited</a> APIs.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/represented-file\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>);\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.setRepresentedFilename(os.homedir())\n  win.setDocumentEdited(<span class=\"hljs-literal\">true</span>)\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<p>After launching the Electron application, click on the title with <code>Command</code> or\n<code>Control</code> key pressed. You should see a popup with the represented file at the top.\nIn this guide, this is the current user's home directory:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/represented-file.png\" alt=\"Represented file\"></p>",
      "title": "Representing Files in a BrowserWindow (macOS)",
      "description": "NOTE: The screenshot above is an example where this feature is used to indicate the currently opened file in the Atom text editor."
    },
    "/docs/api/safe-storage": {
      "locale": "en-US",
      "slug": "safe-storage",
      "href": "/docs/api/safe-storage",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/safe-storage.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"safestorage\"><a href=\"#safestorage\">safeStorage</a></h1>\n<blockquote>\n<p>Allows access to simple encryption and decryption of strings for storage on the local machine.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>This module protects data stored on disk from being accessed by other applications or users with full disk access.</p>\n<p>Note that on Mac, access to the system Keychain is required and\nthese calls can block the current thread to collect user input.\nThe same is true for Linux, if a password management tool is available.</p>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>safeStorage</code> module has the following methods:</p>\n<h3 id=\"safestorageisencryptionavailable\"><a href=\"#safestorageisencryptionavailable\"><code>safeStorage.isEncryptionAvailable()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether encryption is available.</p>\n<p>On Linux, returns true if the secret key is\navailable. On MacOS, returns true if Keychain is available.\nOn Windows, returns true with no other preconditions.</p>\n<h3 id=\"safestorageencryptstringplaintext\"><a href=\"#safestorageencryptstringplaintext\"><code>safeStorage.encryptString(plainText)</code></a></h3>\n<ul>\n<li><code>plainText</code> String</li>\n</ul>\n<p>Returns <code>Buffer</code> -  An array of bytes representing the encrypted string.</p>\n<p>This function will throw an error if encryption fails.</p>\n<h3 id=\"safestoragedecryptstringencrypted\"><a href=\"#safestoragedecryptstringencrypted\"><code>safeStorage.decryptString(encrypted)</code></a></h3>\n<ul>\n<li><code>encrypted</code> Buffer</li>\n</ul>\n<p>Returns <code>String</code> - the decrypted string. Decrypts the encrypted buffer\nobtained  with <code>safeStorage.encryptString</code> back into a string.</p>\n<p>This function will throw an error if decryption fails.</p>",
      "title": "safeStorage",
      "description": "Allows access to simple encryption and decryption of strings for storage on the local machine."
    },
    "/docs/tutorial/sandbox": {
      "locale": "en-US",
      "slug": "sandbox",
      "href": "/docs/tutorial/sandbox",
      "crowdinFileId": "256245",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/sandbox.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"process-sandboxing\"><a href=\"#process-sandboxing\">Process Sandboxing</a></h1>\n<p>One key security feature in Chromium is that processes can be executed within a sandbox.\nThe sandbox limits the harm that malicious code can cause by limiting access to most\nsystem resources — sandboxed processes can only freely use CPU cycles and memory.\nIn order to perform operations requiring additional privilege, sandboxed processes\nuse dedicated communication channels to delegate tasks to more privileged processes.</p>\n<p>In Chromium, sandboxing is applied to most processes other than the main process.\nThis includes renderer processes, as well as utility processes such as the audio service,\nthe GPU service and the network service.</p>\n<p>See Chromium's <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/design/sandbox.md\">Sandbox design document</a> for more information.</p>\n<h2 id=\"electrons-sandboxing-policies\"><a href=\"#electrons-sandboxing-policies\">Electron's sandboxing policies</a></h2>\n<p>Electron comes with a mixed sandbox environment, meaning sandboxed processes can run\nalongside privileged ones. By default, renderer processes are not sandboxed, but\nutility processes are. Note that as in Chromium, the main (browser) process is\nprivileged and cannot be sandboxed.</p>\n<p>Historically, this mixed sandbox approach was established because having Node.js available\nin the renderer is an extremely powerful tool for app developers. Unfortunately, this\nfeature is also an equally massive security vulnerability.</p>\n<p>Theoretically, unsandboxed renderers are not a problem for desktop applications that\nonly display trusted code, but they make Electron less secure than Chromium for\ndisplaying untrusted web content. However, even purportedly trusted code may be\ndangerous — there are countless attack vectors that malicious actors can use, from\ncross-site scripting to content injection to man-in-the-middle attacks on remotely loaded\nwebsites, just to name a few. For this reason, we recommend enabling renderer sandboxing\nfor the vast majority of cases under an abundance of caution.</p>\n<!--TODO: update this guide when #28466 is either solved or closed -->\n<p>Note that there is an active discussion in the issue tracker to enable renderer sandboxing\nby default. See <a href=\"https://github.com/electron/electron/issues/28466\">#28466</a>) for details.</p>\n<h2 id=\"sandbox-behaviour-in-electron\"><a href=\"#sandbox-behaviour-in-electron\">Sandbox behaviour in Electron</a></h2>\n<p>Sandboxed processes in Electron behave <em>mostly</em> in the same way as Chromium's do, but\nElectron has a few additional concepts to consider because it interfaces with Node.js.</p>\n<h3 id=\"renderer-processes\"><a href=\"#renderer-processes\">Renderer processes</a></h3>\n<p>When renderer processes in Electron are sandboxed, they behave in the same way as a\nregular Chrome renderer would. A sandboxed renderer won't have a Node.js\nenvironment initialized.</p>\n<!-- TODO(erickzhao): when we have a solid guide for IPC, link it here -->\n<p>Therefore, when the sandbox is enabled, renderer processes can only perform privileged\ntasks (such as interacting with the filesystem, making changes to the system, or spawning\nsubprocesses) by delegating these tasks to the main process via inter-process\ncommunication (IPC).</p>\n<h3 id=\"preload-scripts\"><a href=\"#preload-scripts\">Preload scripts</a></h3>\n<p>In order to allow renderer processes to communicate with the main process, preload\nscripts attached to sandboxed renderers will still have a polyfilled subset of Node.js\nAPIs available. A <code>require</code> function similar to Node's <code>require</code> module is exposed,\nbut can only import a subset of Electron and Node's built-in modules:</p>\n<ul>\n<li><code>electron</code> (only renderer process modules)</li>\n<li><a href=\"https://nodejs.org/api/events.html\"><code>events</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html\"><code>timers</code></a></li>\n<li><a href=\"https://nodejs.org/api/url.html\"><code>url</code></a></li>\n</ul>\n<p>In addition, the preload script also polyfills certain Node.js primitives as globals:</p>\n<ul>\n<li><a href=\"https://nodejs.org/api/Buffer.html\"><code>Buffer</code></a></li>\n<li><a href=\"/docs/api/process\"><code>process</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html#timers_clearimmediate_immediate\"><code>clearImmediate</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html#timers_setimmediate_callback_args\"><code>setImmediate</code></a></li>\n</ul>\n<p>Because the <code>require</code> function is a polyfill with limited functionality, you will not be\nable to use <a href=\"https://nodejs.org/api/modules.html#modules_modules_commonjs_modules\">CommonJS modules</a> to separate your preload script into multiple\nfiles. If you need to split your preload code, use a bundler such as <a href=\"https://webpack.js.org/\">webpack</a>\nor <a href=\"https://parceljs.org/\">Parcel</a>.</p>\n<p>Note that because the environment presented to the <code>preload</code> script is substantially\nmore privileged than that of a sandboxed renderer, it is still possible to leak\nprivileged APIs to untrusted code running in the renderer process unless\n<a href=\"/docs/tutorial/context-isolation\"><code>contextIsolation</code></a> is enabled.</p>\n<h2 id=\"configuring-the-sandbox\"><a href=\"#configuring-the-sandbox\">Configuring the sandbox</a></h2>\n<h3 id=\"enabling-the-sandbox-for-a-single-process\"><a href=\"#enabling-the-sandbox-for-a-single-process\">Enabling the sandbox for a single process</a></h3>\n<p>In Electron, renderer sandboxing can be enabled on a per-process basis with\nthe <code>sandbox: true</code> preference in the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> constructor.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">sandbox</span>: <span class=\"hljs-literal\">true</span>\n    }\n  })\n  win.loadURL(<span class=\"hljs-string\">'https://google.com'</span>)\n})\n</code></pre>\n<h3 id=\"enabling-the-sandbox-globally\"><a href=\"#enabling-the-sandbox-globally\">Enabling the sandbox globally</a></h3>\n<p>If you want to force sandboxing for all renderers, you can also use the\n<a href=\"/docs/api/app#appenablesandbox\"><code>app.enableSandbox</code></a> API. Note that this API has to be called before the\napp's <code>ready</code> event.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\napp.enableSandbox()\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// no need to pass `sandbox: true` since `app.enableSandbox()` was called.</span>\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://google.com'</span>)\n})\n</code></pre>\n<h3 id=\"disabling-chromiums-sandbox-testing-only\"><a href=\"#disabling-chromiums-sandbox-testing-only\">Disabling Chromium's sandbox (testing only)</a></h3>\n<p>You can also disable Chromium's sandbox entirely with the <a href=\"/docs/api/command-line-switches#--no-sandbox\"><code>--no-sandbox</code></a>\nCLI flag, which will disable the sandbox for all processes (including utility processes).\nWe highly recommend that you only use this flag for testing purposes, and <strong>never</strong>\nin production.</p>\n<p>Note that the <code>sandbox: true</code> option will still disable the renderer's Node.js\nenvironment.</p>\n<h2 id=\"a-note-on-rendering-untrusted-content\"><a href=\"#a-note-on-rendering-untrusted-content\">A note on rendering untrusted content</a></h2>\n<p>Rendering untrusted content in Electron is still somewhat uncharted territory,\nthough some apps are finding success (e.g. <a href=\"https://github.com/beakerbrowser/beaker\">Beaker Browser</a>).\nOur goal is to get as close to Chrome as we can in terms of the security of\nsandboxed content, but ultimately we will always be behind due to a few fundamental\nissues:</p>\n<ol>\n<li>We do not have the dedicated resources or expertise that Chromium has to\napply to the security of its product. We do our best to make use of what we\nhave, to inherit everything we can from Chromium, and to respond quickly to\nsecurity issues, but Electron cannot be as secure as Chromium without the\nresources that Chromium is able to dedicate.</li>\n<li>Some security features in Chrome (such as Safe Browsing and Certificate\nTransparency) require a centralized authority and dedicated servers, both of\nwhich run counter to the goals of the Electron project. As such, we disable\nthose features in Electron, at the cost of the associated security they\nwould otherwise bring.</li>\n<li>There is only one Chromium, whereas there are many thousands of apps built\non Electron, all of which behave slightly differently. Accounting for those\ndifferences can yield a huge possibility space, and make it challenging to\nensure the security of the platform in unusual use cases.</li>\n<li>We can't push security updates to users directly, so we rely on app vendors\nto upgrade the version of Electron underlying their app in order for\nsecurity updates to reach users.</li>\n</ol>\n<p>While we make our best effort to backport Chromium security fixes to older\nversions of Electron, we do not make a guarantee that every fix will be\nbackported. Your best chance at staying secure is to be on the latest stable\nversion of Electron.</p>",
      "title": "Process Sandboxing",
      "description": ""
    },
    "/docs/api/screen": {
      "locale": "en-US",
      "slug": "screen",
      "href": "/docs/api/screen",
      "crowdinFileId": "256361",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/screen.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"screen\"><a href=\"#screen\">screen</a></h1>\n<blockquote>\n<p>Retrieve information about screen size, displays, cursor position, etc.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>This module cannot be used until the <code>ready</code> event of the <code>app</code>\nmodule is emitted.</p>\n<p><code>screen</code> is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p><strong>Note:</strong> In the renderer / DevTools, <code>window.screen</code> is a reserved DOM\nproperty, so writing <code>let { screen } = require('electron')</code> will not work.</p>\n<p>An example of creating a window that fills the whole screen:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/screen/fit-screen\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, screen } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> { width, height } = screen.getPrimaryDisplay().workAreaSize\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ width, height })\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>Another example of creating a window in the external display:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, screen } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> displays = screen.getAllDisplays()\n  <span class=\"hljs-keyword\">const</span> externalDisplay = displays.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">display</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> display.bounds.x !== <span class=\"hljs-number\">0</span> || display.bounds.y !== <span class=\"hljs-number\">0</span>\n  })\n\n  <span class=\"hljs-keyword\">if</span> (externalDisplay) {\n    win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n      <span class=\"hljs-attr\">x</span>: externalDisplay.bounds.x + <span class=\"hljs-number\">50</span>,\n      <span class=\"hljs-attr\">y</span>: externalDisplay.bounds.y + <span class=\"hljs-number\">50</span>\n    })\n    win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  }\n})\n</code></pre>\n<h2 id=\"events\"><a href=\"#events\">Events</a></h2>\n<p>The <code>screen</code> module emits the following events:</p>\n<h3 id=\"event-display-added\"><a href=\"#event-display-added\">Event: 'display-added'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newDisplay</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n</ul>\n<p>Emitted when <code>newDisplay</code> has been added.</p>\n<h3 id=\"event-display-removed\"><a href=\"#event-display-removed\">Event: 'display-removed'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>oldDisplay</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n</ul>\n<p>Emitted when <code>oldDisplay</code> has been removed.</p>\n<h3 id=\"event-display-metrics-changed\"><a href=\"#event-display-metrics-changed\">Event: 'display-metrics-changed'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>display</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n<li><code>changedMetrics</code> String[]</li>\n</ul>\n<p>Emitted when one or more metrics change in a <code>display</code>. The <code>changedMetrics</code> is\nan array of strings that describe the changes. Possible changes are <code>bounds</code>,\n<code>workArea</code>, <code>scaleFactor</code> and <code>rotation</code>.</p>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>screen</code> module has the following methods:</p>\n<h3 id=\"screengetcursorscreenpoint\"><a href=\"#screengetcursorscreenpoint\"><code>screen.getCursorScreenPoint()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>The current absolute position of the mouse pointer.</p>\n<p><strong>Note:</strong> The return value is a DIP point, not a screen physical point.</p>\n<h3 id=\"screengetprimarydisplay\"><a href=\"#screengetprimarydisplay\"><code>screen.getPrimaryDisplay()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/display\"><code>Display</code></a> - The primary display.</p>\n<h3 id=\"screengetalldisplays\"><a href=\"#screengetalldisplays\"><code>screen.getAllDisplays()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/display\"><code>Display[]</code></a> - An array of displays that are currently available.</p>\n<h3 id=\"screengetdisplaynearestpointpoint\"><a href=\"#screengetdisplaynearestpointpoint\"><code>screen.getDisplayNearestPoint(point)</code></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/display\"><code>Display</code></a> - The display nearest the specified point.</p>\n<h3 id=\"screengetdisplaymatchingrect\"><a href=\"#screengetdisplaymatchingrect\"><code>screen.getDisplayMatching(rect)</code></a></h3>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/display\"><code>Display</code></a> - The display that most closely\nintersects the provided bounds.</p>\n<h3 id=\"screenscreentodippointpoint-windows\"><a href=\"#screenscreentodippointpoint-windows\"><code>screen.screenToDipPoint(point)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>Converts a screen physical point to a screen DIP point.\nThe DPI scale is performed relative to the display containing the physical point.</p>\n<h3 id=\"screendiptoscreenpointpoint-windows\"><a href=\"#screendiptoscreenpointpoint-windows\"><code>screen.dipToScreenPoint(point)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>Converts a screen DIP point to a screen physical point.\nThe DPI scale is performed relative to the display containing the DIP point.</p>\n<h3 id=\"screenscreentodiprectwindow-rect-windows\"><a href=\"#screenscreentodiprectwindow-rect-windows\"><code>screen.screenToDipRect(window, rect)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | null</li>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>Converts a screen physical rect to a screen DIP rect.\nThe DPI scale is performed relative to the display nearest to <code>window</code>.\nIf <code>window</code> is null, scaling will be performed to the display nearest to <code>rect</code>.</p>\n<h3 id=\"screendiptoscreenrectwindow-rect-windows\"><a href=\"#screendiptoscreenrectwindow-rect-windows\"><code>screen.dipToScreenRect(window, rect)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | null</li>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>Converts a screen DIP rect to a screen physical rect.\nThe DPI scale is performed relative to the display nearest to <code>window</code>.\nIf <code>window</code> is null, scaling will be performed to the display nearest to <code>rect</code>.</p>",
      "title": "screen",
      "description": "Retrieve information about screen size, displays, cursor position, etc."
    },
    "/docs/api/structures/scrubber-item": {
      "locale": "en-US",
      "slug": "scrubber-item",
      "href": "/docs/api/structures/scrubber-item",
      "crowdinFileId": "256497",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/scrubber-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"scrubberitem-object\"><a href=\"#scrubberitem-object\">ScrubberItem Object</a></h1>\n<ul>\n<li><code>label</code> String (optional) - The text to appear in this item.</li>\n<li><code>icon</code> NativeImage (optional) - The image to appear in this item.</li>\n</ul>",
      "title": "ScrubberItem Object",
      "description": ""
    },
    "/docs/tutorial/security": {
      "locale": "en-US",
      "slug": "security",
      "href": "/docs/tutorial/security",
      "crowdinFileId": "256247",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/security.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"security-native-capabilities-and-your-responsibility\"><a href=\"#security-native-capabilities-and-your-responsibility\">Security, Native Capabilities, and Your Responsibility</a></h1>\n<p>As web developers, we usually enjoy the strong security net of the browser -\nthe risks associated with the code we write are relatively small. Our websites\nare granted limited powers in a sandbox, and we trust that our users enjoy a\nbrowser built by a large team of engineers that is able to quickly respond to\nnewly discovered security threats.</p>\n<p>When working with Electron, it is important to understand that Electron is not\na web browser. It allows you to build feature-rich desktop applications with\nfamiliar web technologies, but your code wields much greater power. JavaScript\ncan access the filesystem, user shell, and more. This allows you to build\nhigh quality native applications, but the inherent security risks scale with\nthe additional powers granted to your code.</p>\n<p>With that in mind, be aware that displaying arbitrary content from untrusted\nsources poses a severe security risk that Electron is not intended to handle.\nIn fact, the most popular Electron apps (Atom, Slack, Visual Studio Code, etc)\ndisplay primarily local content (or trusted, secure remote content without Node\nintegration) – if your application executes code from an online source, it is\nyour responsibility to ensure that the code is not malicious.</p>\n<h2 id=\"reporting-security-issues\"><a href=\"#reporting-security-issues\">Reporting Security Issues</a></h2>\n<p>For information on how to properly disclose an Electron vulnerability,\nsee <a href=\"https://github.com/electron/electron/tree/main/SECURITY.md\">SECURITY.md</a></p>\n<h2 id=\"chromium-security-issues-and-upgrades\"><a href=\"#chromium-security-issues-and-upgrades\">Chromium Security Issues and Upgrades</a></h2>\n<p>Electron keeps up to date with alternating Chromium releases. For more information,\nsee the <a href=\"https://electronjs.org/blog/12-week-cadence\">Electron Release Cadence blog post</a>.</p>\n<h2 id=\"security-is-everyones-responsibility\"><a href=\"#security-is-everyones-responsibility\">Security Is Everyone's Responsibility</a></h2>\n<p>It is important to remember that the security of your Electron application is\nthe result of the overall security of the framework foundation\n(<em>Chromium</em>, <em>Node.js</em>), Electron itself, all NPM dependencies and\nyour code. As such, it is your responsibility to follow a few important best\npractices:</p>\n<ul>\n<li>\n<p><strong>Keep your application up-to-date with the latest Electron framework release.</strong>\nWhen releasing your product, you’re also shipping a bundle composed of Electron,\nChromium shared library and Node.js. Vulnerabilities affecting these components\nmay impact the security of your application. By updating Electron to the latest\nversion, you ensure that critical vulnerabilities (such as <em>nodeIntegration bypasses</em>)\nare already patched and cannot be exploited in your application. For more information,\nsee \"<a href=\"#16-use-a-current-version-of-electron\">Use a current version of Electron</a>\".</p>\n</li>\n<li>\n<p><strong>Evaluate your dependencies.</strong> While NPM provides half a million reusable packages,\nit is your responsibility to choose trusted 3rd-party libraries. If you use outdated\nlibraries affected by known vulnerabilities or rely on poorly maintained code,\nyour application security could be in jeopardy.</p>\n</li>\n<li>\n<p><strong>Adopt secure coding practices.</strong> The first line of defense for your application\nis your own code. Common web vulnerabilities, such as Cross-Site Scripting (XSS),\nhave a higher security impact on Electron applications hence it is highly recommended\nto adopt secure software development best practices and perform security testing.</p>\n</li>\n</ul>\n<h2 id=\"isolation-for-untrusted-content\"><a href=\"#isolation-for-untrusted-content\">Isolation For Untrusted Content</a></h2>\n<p>A security issue exists whenever you receive code from an untrusted source (e.g.\na remote server) and execute it locally. As an example, consider a remote\nwebsite being displayed inside a default <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. If\nan attacker somehow manages to change said content (either by attacking the\nsource directly, or by sitting between your app and the actual destination), they\nwill be able to execute native code on the user's machine.</p>\n<blockquote>\n<p>⚠️ Under no circumstances should you load and execute remote code with\nNode.js integration enabled. Instead, use only local files (packaged together\nwith your application) to execute Node.js code. To display remote content, use\nthe <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> tag or <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, make sure\nto disable the <code>nodeIntegration</code> and enable <code>contextIsolation</code>.</p>\n</blockquote>\n<h2 id=\"electron-security-warnings\"><a href=\"#electron-security-warnings\">Electron Security Warnings</a></h2>\n<p>From Electron 2.0 on, developers will see warnings and recommendations printed\nto the developer console. They only show up when the binary's name is Electron,\nindicating that a developer is currently looking at the console.</p>\n<p>You can force-enable or force-disable these warnings by setting\n<code>ELECTRON_ENABLE_SECURITY_WARNINGS</code> or <code>ELECTRON_DISABLE_SECURITY_WARNINGS</code> on\neither <code>process.env</code> or the <code>window</code> object.</p>\n<h2 id=\"checklist-security-recommendations\"><a href=\"#checklist-security-recommendations\">Checklist: Security Recommendations</a></h2>\n<p>You should at least follow these steps to improve the security of your application:</p>\n<ol>\n<li><a href=\"#1-only-load-secure-content\">Only load secure content</a></li>\n<li><a href=\"#2-do-not-enable-nodejs-integration-for-remote-content\">Disable the Node.js integration in all renderers that display remote content</a></li>\n<li><a href=\"#3-enable-context-isolation-for-remote-content\">Enable context isolation in all renderers that display remote content</a></li>\n<li><a href=\"#4-enable-sandboxing\">Enable sandboxing</a></li>\n<li><a href=\"#5-handle-session-permission-requests-from-remote-content\">Use <code>ses.setPermissionRequestHandler()</code> in all sessions that load remote content</a></li>\n<li><a href=\"#6-do-not-disable-websecurity\">Do not disable <code>webSecurity</code></a></li>\n<li><a href=\"#7-define-a-content-security-policy\">Define a <code>Content-Security-Policy</code></a> and use restrictive rules (i.e. <code>script-src 'self'</code>)</li>\n<li><a href=\"#8-do-not-set-allowrunninginsecurecontent-to-true\">Do not set <code>allowRunningInsecureContent</code> to <code>true</code></a></li>\n<li><a href=\"#9-do-not-enable-experimental-features\">Do not enable experimental features</a></li>\n<li><a href=\"#10-do-not-use-enableblinkfeatures\">Do not use <code>enableBlinkFeatures</code></a></li>\n<li><a href=\"#11-do-not-use-allowpopups\"><code>&#x3C;webview></code>: Do not use <code>allowpopups</code></a></li>\n<li><a href=\"#12-verify-webview-options-before-creation\"><code>&#x3C;webview></code>: Verify options and params</a></li>\n<li><a href=\"#13-disable-or-limit-navigation\">Disable or limit navigation</a></li>\n<li><a href=\"#14-disable-or-limit-creation-of-new-windows\">Disable or limit creation of new windows</a></li>\n<li><a href=\"#15-do-not-use-openexternal-with-untrusted-content\">Do not use <code>openExternal</code> with untrusted content</a></li>\n<li><a href=\"#16-use-a-current-version-of-electron\">Use a current version of Electron</a></li>\n</ol>\n<p>To automate the detection of misconfigurations and insecure patterns, it is\npossible to use\n<a href=\"https://github.com/doyensec/electronegativity\">electronegativity</a>. For\nadditional details on potential weaknesses and implementation bugs when\ndeveloping applications using Electron, please refer to this <a href=\"https://doyensec.com/resources/us-17-Carettoni-Electronegativity-A-Study-Of-Electron-Security-wp.pdf\">guide for\ndevelopers and auditors</a></p>\n<h2 id=\"1-only-load-secure-content\"><a href=\"#1-only-load-secure-content\">1) Only Load Secure Content</a></h2>\n<p>Any resources not included with your application should be loaded using a\nsecure protocol like <code>HTTPS</code>. In other words, do not use insecure protocols\nlike <code>HTTP</code>. Similarly, we recommend the use of <code>WSS</code> over <code>WS</code>, <code>FTPS</code> over\n<code>FTP</code>, and so on.</p>\n<h3 id=\"why\"><a href=\"#why\">Why?</a></h3>\n<p><code>HTTPS</code> has three main benefits:</p>\n<p>1) It authenticates the remote server, ensuring your app connects to the correct\nhost instead of an impersonator.\n2) It ensures data integrity, asserting that the data was not modified while in\ntransit between your application and the host.\n3) It encrypts the traffic between your user and the destination host, making it\nmore difficult to eavesdrop on the information sent between your app and\nthe host.</p>\n<h3 id=\"how\"><a href=\"#how\">How?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\nbrowserWindow.loadURL(<span class=\"hljs-string\">'http://example.com'</span>)\n\n<span class=\"hljs-comment\">// Good</span>\nbrowserWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Bad --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">crossorigin</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://example.com/react.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"http://example.com/style.css\"</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Good --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">crossorigin</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://example.com/react.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"https://example.com/style.css\"</span>></span>\n</code></pre>\n<h2 id=\"2-do-not-enable-nodejs-integration-for-remote-content\"><a href=\"#2-do-not-enable-nodejs-integration-for-remote-content\">2) Do not enable Node.js Integration for Remote Content</a></h2>\n<p><em>This recommendation is the default behavior in Electron since 5.0.0.</em></p>\n<p>It is paramount that you do not enable Node.js integration in any renderer\n(<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>, <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, or\n<a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>) that loads remote content. The goal is to limit the\npowers you grant to remote content, thus making it dramatically more difficult\nfor an attacker to harm your users should they gain the ability to execute\nJavaScript on your website.</p>\n<p>After this, you can grant additional permissions for specific hosts. For example,\nif you are opening a BrowserWindow pointed at <code>https://example.com/</code>, you can\ngive that website exactly the abilities it needs, but no more.</p>\n<h3 id=\"why-1\"><a href=\"#why-1\">Why?</a></h3>\n<p>A cross-site-scripting (XSS) attack is more dangerous if an attacker can jump\nout of the renderer process and execute code on the user's computer.\nCross-site-scripting attacks are fairly common - and while an issue, their\npower is usually limited to messing with the website that they are executed on.\nDisabling Node.js integration helps prevent an XSS from being escalated into a\nso-called \"Remote Code Execution\" (RCE) attack.</p>\n<h3 id=\"how-1\"><a href=\"#how-1\">How?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span>,\n    <span class=\"hljs-attr\">nodeIntegrationInWorker</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n\nmainWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">preload</span>: path.join(app.getAppPath(), <span class=\"hljs-string\">'preload.js'</span>)\n  }\n})\n\nmainWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Bad --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">nodeIntegration</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Good --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>When disabling Node.js integration, you can still expose APIs to your website that\ndo consume Node.js modules or features. Preload scripts continue to have access\nto <code>require</code> and other Node.js features, allowing developers to expose a custom\nAPI to remotely loaded content.</p>\n<p>In the following example preload script, the later loaded website will have\naccess to a <code>window.readConfig()</code> method, but no Node.js features.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { readFileSync } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-built_in\">window</span>.readConfig = <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> data = readFileSync(<span class=\"hljs-string\">'./config.json'</span>)\n  <span class=\"hljs-keyword\">return</span> data\n}\n</code></pre>\n<h2 id=\"3-enable-context-isolation-for-remote-content\"><a href=\"#3-enable-context-isolation-for-remote-content\">3) Enable Context Isolation for Remote Content</a></h2>\n<p>Context isolation is an Electron feature that allows developers to run code\nin preload scripts and in Electron APIs in a dedicated JavaScript context. In\npractice, that means that global objects like <code>Array.prototype.push</code> or\n<code>JSON.parse</code> cannot be modified by scripts running in the renderer process.</p>\n<p>Electron uses the same technology as Chromium's <a href=\"https://developer.chrome.com/extensions/content_scripts#execution-environment\">Content Scripts</a>\nto enable this behavior.</p>\n<p>Even when <code>nodeIntegration: false</code> is used, to truly enforce strong isolation\nand prevent the use of Node primitives <code>contextIsolation</code> <strong>must</strong> also be used.</p>\n<h3 id=\"why--how\"><a href=\"#why--how\">Why &#x26; How?</a></h3>\n<p>For more information on what <code>contextIsolation</code> is and how to enable it please\nsee our dedicated <a href=\"/docs/tutorial/context-isolation\">Context Isolation</a> document.</p>\n<h2 id=\"4-enable-sandboxing\"><a href=\"#4-enable-sandboxing\">4) Enable Sandboxing</a></h2>\n<p><a href=\"/docs/tutorial/sandbox\">Sandboxing</a> is a Chromium feature that uses the operating system to\nsignificantly limit what renderer processes have access to. You should enable\nthe sandbox in all renderers. Loading, reading or processing any untrusted\ncontent in an unsandboxed process, including the main process, is not advised.</p>\n<h3 id=\"how-2\"><a href=\"#how-2\">How?</a></h3>\n<p>When creating a window, pass the <code>sandbox: true</code> option in <code>webPreferences</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">sandbox</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h2 id=\"5-handle-session-permission-requests-from-remote-content\"><a href=\"#5-handle-session-permission-requests-from-remote-content\">5) Handle Session Permission Requests From Remote Content</a></h2>\n<p>You may have seen permission requests while using Chrome: They pop up whenever\nthe website attempts to use a feature that the user has to manually approve (\nlike notifications).</p>\n<p>The API is based on the <a href=\"https://developer.chrome.com/extensions/permissions\">Chromium permissions API</a>\nand implements the same types of permissions.</p>\n<h3 id=\"why-2\"><a href=\"#why-2\">Why?</a></h3>\n<p>By default, Electron will automatically approve all permission requests unless\nthe developer has manually configured a custom handler. While a solid default,\nsecurity-conscious developers might want to assume the very opposite.</p>\n<h3 id=\"how-3\"><a href=\"#how-3\">How?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession\n  .fromPartition(<span class=\"hljs-string\">'some-partition'</span>)\n  .setPermissionRequestHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, callback</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> url = webContents.getURL()\n\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'notifications'</span>) {\n      <span class=\"hljs-comment\">// Approves the permissions request</span>\n      callback(<span class=\"hljs-literal\">true</span>)\n    }\n\n    <span class=\"hljs-comment\">// Verify URL</span>\n    <span class=\"hljs-keyword\">if</span> (!url.startsWith(<span class=\"hljs-string\">'https://example.com/'</span>)) {\n      <span class=\"hljs-comment\">// Denies the permissions request</span>\n      <span class=\"hljs-keyword\">return</span> callback(<span class=\"hljs-literal\">false</span>)\n    }\n  })\n</code></pre>\n<h2 id=\"6-do-not-disable-websecurity\"><a href=\"#6-do-not-disable-websecurity\">6) Do Not Disable WebSecurity</a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>You may have already guessed that disabling the <code>webSecurity</code> property on a\nrenderer process (<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>,\n<a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, or <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>) disables crucial\nsecurity features.</p>\n<p>Do not disable <code>webSecurity</code> in production applications.</p>\n<h3 id=\"why-3\"><a href=\"#why-3\">Why?</a></h3>\n<p>Disabling <code>webSecurity</code> will disable the same-origin policy and set\n<code>allowRunningInsecureContent</code> property to <code>true</code>. In other words, it allows\nthe execution of insecure code from different domains.</p>\n<h3 id=\"how-4\"><a href=\"#how-4\">How?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">webSecurity</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Bad --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">disablewebsecurity</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Good --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<h2 id=\"7-define-a-content-security-policy\"><a href=\"#7-define-a-content-security-policy\">7) Define a Content Security Policy</a></h2>\n<p>A Content Security Policy (CSP) is an additional layer of protection against\ncross-site-scripting attacks and data injection attacks. We recommend that they\nbe enabled by any website you load inside Electron.</p>\n<h3 id=\"why-4\"><a href=\"#why-4\">Why?</a></h3>\n<p>CSP allows the server serving content to restrict and control the resources\nElectron can load for that given web page. <code>https://example.com</code> should\nbe allowed to load scripts from the origins you defined while scripts from\n<code>https://evil.attacker.com</code> should not be allowed to run. Defining a CSP is an\neasy way to improve your application's security.</p>\n<p>The following CSP will allow Electron to execute scripts from the current\nwebsite and from <code>apis.example.com</code>.</p>\n<pre><code class=\"hljs language-plaintext\">// Bad\nContent-Security-Policy: '*'\n\n// Good\nContent-Security-Policy: script-src 'self' https://apis.example.com\n</code></pre>\n<h3 id=\"csp-http-header\"><a href=\"#csp-http-header\">CSP HTTP Header</a></h3>\n<p>Electron respects the <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy\"><code>Content-Security-Policy</code> HTTP header</a>\nwhich can be set using Electron's\n<a href=\"/docs/api/web-request#webrequestonheadersreceivedfilter-listener\"><code>webRequest.onHeadersReceived</code></a>\nhandler:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession.defaultSession.webRequest.onHeadersReceived(<span class=\"hljs-function\">(<span class=\"hljs-params\">details, callback</span>) =></span> {\n  callback({\n    <span class=\"hljs-attr\">responseHeaders</span>: {\n      ...details.responseHeaders,\n      <span class=\"hljs-string\">'Content-Security-Policy'</span>: [<span class=\"hljs-string\">'default-src \\'none\\''</span>]\n    }\n  })\n})\n</code></pre>\n<h3 id=\"csp-meta-tag\"><a href=\"#csp-meta-tag\">CSP Meta Tag</a></h3>\n<p>CSP's preferred delivery mechanism is an HTTP header, however it is not possible\nto use this method when loading a resource using the <code>file://</code> protocol. It can\nbe useful in some cases, such as using the <code>file://</code> protocol, to set a policy\non a page directly in the markup using a <code>&#x3C;meta></code> tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'none'\"</span>></span>\n</code></pre>\n<h2 id=\"8-do-not-set-allowrunninginsecurecontent-to-true\"><a href=\"#8-do-not-set-allowrunninginsecurecontent-to-true\">8) Do Not Set <code>allowRunningInsecureContent</code> to <code>true</code></a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>By default, Electron will not allow websites loaded over <code>HTTPS</code> to load and\nexecute scripts, CSS, or plugins from insecure sources (<code>HTTP</code>). Setting the\nproperty <code>allowRunningInsecureContent</code> to <code>true</code> disables that protection.</p>\n<p>Loading the initial HTML of a website over <code>HTTPS</code> and attempting to load\nsubsequent resources via <code>HTTP</code> is also known as \"mixed content\".</p>\n<h3 id=\"why-5\"><a href=\"#why-5\">Why?</a></h3>\n<p>Loading content over <code>HTTPS</code> assures the authenticity and integrity\nof the loaded resources while encrypting the traffic itself. See the section on\n<a href=\"#1-only-load-secure-content\">only displaying secure content</a> for more details.</p>\n<h3 id=\"how-5\"><a href=\"#how-5\">How?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">allowRunningInsecureContent</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({})\n</code></pre>\n<h2 id=\"9-do-not-enable-experimental-features\"><a href=\"#9-do-not-enable-experimental-features\">9) Do Not Enable Experimental Features</a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>Advanced users of Electron can enable experimental Chromium features using the\n<code>experimentalFeatures</code> property.</p>\n<h3 id=\"why-6\"><a href=\"#why-6\">Why?</a></h3>\n<p>Experimental features are, as the name suggests, experimental and have not been\nenabled for all Chromium users. Furthermore, their impact on Electron as a whole\nhas likely not been tested.</p>\n<p>Legitimate use cases exist, but unless you know what you are doing, you should\nnot enable this property.</p>\n<h3 id=\"how-6\"><a href=\"#how-6\">How?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">experimentalFeatures</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({})\n</code></pre>\n<h2 id=\"10-do-not-use-enableblinkfeatures\"><a href=\"#10-do-not-use-enableblinkfeatures\">10) Do Not Use <code>enableBlinkFeatures</code></a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>Blink is the name of the rendering engine behind Chromium. As with\n<code>experimentalFeatures</code>, the <code>enableBlinkFeatures</code> property allows developers to\nenable features that have been disabled by default.</p>\n<h3 id=\"why-7\"><a href=\"#why-7\">Why?</a></h3>\n<p>Generally speaking, there are likely good reasons if a feature was not enabled\nby default. Legitimate use cases for enabling specific features exist. As a\ndeveloper, you should know exactly why you need to enable a feature, what the\nramifications are, and how it impacts the security of your application. Under\nno circumstances should you enable features speculatively.</p>\n<h3 id=\"how-7\"><a href=\"#how-7\">How?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">enableBlinkFeatures</span>: <span class=\"hljs-string\">'ExecCommandInJavaScript'</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n</code></pre>\n<h2 id=\"11-do-not-use-allowpopups\"><a href=\"#11-do-not-use-allowpopups\">11) Do Not Use <code>allowpopups</code></a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>If you are using <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>, you might need the pages and scripts\nloaded in your <code>&#x3C;webview></code> tag to open new windows. The <code>allowpopups</code> attribute\nenables them to create new <a href=\"/docs/api/browser-window\"><code>BrowserWindows</code></a> using the\n<code>window.open()</code> method. <code>&#x3C;webview></code> tags are otherwise not allowed to create new\nwindows.</p>\n<h3 id=\"why-8\"><a href=\"#why-8\">Why?</a></h3>\n<p>If you do not need popups, you are better off not allowing the creation of\nnew <a href=\"/docs/api/browser-window\"><code>BrowserWindows</code></a> by default. This follows the principle\nof minimally required access: Don't let a website create new popups unless\nyou know it needs that feature.</p>\n<h3 id=\"how-8\"><a href=\"#how-8\">How?</a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Bad --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">allowpopups</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Good --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<h2 id=\"12-verify-webview-options-before-creation\"><a href=\"#12-verify-webview-options-before-creation\">12) Verify WebView Options Before Creation</a></h2>\n<p>A WebView created in a renderer process that does not have Node.js integration\nenabled will not be able to enable integration itself. However, a WebView will\nalways create an independent renderer process with its own <code>webPreferences</code>.</p>\n<p>It is a good idea to control the creation of new <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> tags\nfrom the main process and to verify that their webPreferences do not disable\nsecurity features.</p>\n<h3 id=\"why-9\"><a href=\"#why-9\">Why?</a></h3>\n<p>Since <code>&#x3C;webview></code> live in the DOM, they can be created by a script running on your\nwebsite even if Node.js integration is otherwise disabled.</p>\n<p>Electron enables developers to disable various security features that control\na renderer process. In most cases, developers do not need to disable any of\nthose features - and you should therefore not allow different configurations\nfor newly created <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> tags.</p>\n<h3 id=\"how-9\"><a href=\"#how-9\">How?</a></h3>\n<p>Before a <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> tag is attached, Electron will fire the\n<code>will-attach-webview</code> event on the hosting <code>webContents</code>. Use the event to\nprevent the creation of <code>webViews</code> with possibly insecure options.</p>\n<pre><code class=\"hljs language-js\">app.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.on(<span class=\"hljs-string\">'will-attach-webview'</span>, (event, webPreferences, params) => {\n    <span class=\"hljs-comment\">// Strip away preload scripts if unused or verify their location is legitimate</span>\n    <span class=\"hljs-keyword\">delete</span> webPreferences.preload\n    <span class=\"hljs-keyword\">delete</span> webPreferences.preloadURL\n\n    <span class=\"hljs-comment\">// Disable Node.js integration</span>\n    webPreferences.nodeIntegration = <span class=\"hljs-literal\">false</span>\n\n    <span class=\"hljs-comment\">// Verify URL being loaded</span>\n    <span class=\"hljs-keyword\">if</span> (!params.src.startsWith(<span class=\"hljs-string\">'https://example.com/'</span>)) {\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<p>Again, this list merely minimizes the risk, it does not remove it. If your goal\nis to display a website, a browser will be a more secure option.</p>\n<h2 id=\"13-disable-or-limit-navigation\"><a href=\"#13-disable-or-limit-navigation\">13) Disable or limit navigation</a></h2>\n<p>If your app has no need to navigate or only needs to navigate to known pages,\nit is a good idea to limit navigation outright to that known scope, disallowing\nany other kinds of navigation.</p>\n<h3 id=\"why-10\"><a href=\"#why-10\">Why?</a></h3>\n<p>Navigation is a common attack vector. If an attacker can convince your app to\nnavigate away from its current page, they can possibly force your app to open\nweb sites on the Internet. Even if your <code>webContents</code> are configured to be more\nsecure (like having <code>nodeIntegration</code> disabled or <code>contextIsolation</code> enabled),\ngetting your app to open a random web site will make the work of exploiting your\napp a lot easier.</p>\n<p>A common attack pattern is that the attacker convinces your app's users to\ninteract with the app in such a way that it navigates to one of the attacker's\npages. This is usually done via links, plugins, or other user-generated content.</p>\n<h3 id=\"how-10\"><a href=\"#how-10\">How?</a></h3>\n<p>If your app has no need for navigation, you can call <code>event.preventDefault()</code>\nin a <a href=\"/docs/api/web-contents#event-will-navigate\"><code>will-navigate</code></a> handler. If you know which pages your app\nmight navigate to, check the URL in the event handler and only let navigation\noccur if it matches the URLs you're expecting.</p>\n<p>We recommend that you use Node's parser for URLs. Simple string comparisons can\nsometimes be fooled - a <code>startsWith('https://example.com')</code> test would let\n<code>https://example.com.attacker.com</code> through.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> URL = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>).URL\n\napp.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.on(<span class=\"hljs-string\">'will-navigate'</span>, (event, navigationUrl) => {\n    <span class=\"hljs-keyword\">const</span> parsedUrl = <span class=\"hljs-keyword\">new</span> URL(navigationUrl)\n\n    <span class=\"hljs-keyword\">if</span> (parsedUrl.origin !== <span class=\"hljs-string\">'https://example.com'</span>) {\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<h2 id=\"14-disable-or-limit-creation-of-new-windows\"><a href=\"#14-disable-or-limit-creation-of-new-windows\">14) Disable or limit creation of new windows</a></h2>\n<p>If you have a known set of windows, it's a good idea to limit the creation of\nadditional windows in your app.</p>\n<h3 id=\"why-11\"><a href=\"#why-11\">Why?</a></h3>\n<p>Much like navigation, the creation of new <code>webContents</code> is a common attack\nvector. Attackers attempt to convince your app to create new windows, frames,\nor other renderer processes with more privileges than they had before; or\nwith pages opened that they couldn't open before.</p>\n<p>If you have no need to create windows in addition to the ones you know you'll\nneed to create, disabling the creation buys you a little bit of extra\nsecurity at no cost. This is commonly the case for apps that open one\n<code>BrowserWindow</code> and do not need to open an arbitrary number of additional\nwindows at runtime.</p>\n<h3 id=\"how-11\"><a href=\"#how-11\">How?</a></h3>\n<p><a href=\"/docs/api/web-contents\"><code>webContents</code></a> will delegate to its <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\">window open\nhandler</a> before creating new windows. The handler will\nreceive, amongst other parameters, the <code>url</code> the window was requested to open\nand the options used to create it. We recommend that you register a handler to\nmonitor the creation of windows, and deny any unexpected window creation.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n    <span class=\"hljs-comment\">// In this example, we'll ask the operating system</span>\n    <span class=\"hljs-comment\">// to open this event's url in the default browser.</span>\n    <span class=\"hljs-comment\">//</span>\n    <span class=\"hljs-comment\">// See the following item for considerations regarding what</span>\n    <span class=\"hljs-comment\">// URLs should be allowed through to shell.openExternal.</span>\n    <span class=\"hljs-keyword\">if</span> (isSafeForExternalOpen(url)) {\n      setImmediate(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n        shell.openExternal(url)\n      })\n    }\n\n    <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n  })\n})\n</code></pre>\n<h2 id=\"15-do-not-use-openexternal-with-untrusted-content\"><a href=\"#15-do-not-use-openexternal-with-untrusted-content\">15) Do not use <code>openExternal</code> with untrusted content</a></h2>\n<p>Shell's <a href=\"/docs/api/shell#shellopenexternalurl-options\"><code>openExternal</code></a> allows opening a given protocol URI with\nthe desktop's native utilities. On macOS, for instance, this function is similar\nto the <code>open</code> terminal command utility and will open the specific application\nbased on the URI and filetype association.</p>\n<h3 id=\"why-12\"><a href=\"#why-12\">Why?</a></h3>\n<p>Improper use of <a href=\"/docs/api/shell#shellopenexternalurl-options\"><code>openExternal</code></a> can be leveraged to compromise\nthe user's host. When openExternal is used with untrusted content, it can be\nleveraged to execute arbitrary commands.</p>\n<h3 id=\"how-12\"><a href=\"#how-12\">How?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">//  Bad</span>\n<span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nshell.openExternal(USER_CONTROLLED_DATA_HERE)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">//  Good</span>\n<span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nshell.openExternal(<span class=\"hljs-string\">'https://example.com/index.html'</span>)\n</code></pre>\n<h2 id=\"16-use-a-current-version-of-electron\"><a href=\"#16-use-a-current-version-of-electron\">16) Use a current version of Electron</a></h2>\n<p>You should strive for always using the latest available version of Electron.\nWhenever a new major version is released, you should attempt to update your\napp as quickly as possible.</p>\n<h3 id=\"why-13\"><a href=\"#why-13\">Why?</a></h3>\n<p>An application built with an older version of Electron, Chromium, and Node.js\nis an easier target than an application that is using more recent versions of\nthose components. Generally speaking, security issues and exploits for older\nversions of Chromium and Node.js are more widely available.</p>\n<p>Both Chromium and Node.js are impressive feats of engineering built by\nthousands of talented developers. Given their popularity, their security is\ncarefully tested and analyzed by equally skilled security researchers. Many of\nthose researchers <a href=\"https://en.wikipedia.org/wiki/Responsible_disclosure\">disclose vulnerabilities responsibly</a>,\nwhich generally means that researchers will give Chromium and Node.js some time\nto fix issues before publishing them. Your application will be more secure if\nit is running a recent version of Electron (and thus, Chromium and Node.js) for\nwhich potential security issues are not as widely known.</p>",
      "title": "Security, Native Capabilities, and Your Responsibility",
      "description": "⚠️ Under no circumstances should you load and execute remote code with\nNode.js integration enabled. Instead, use only local files (packaged together\nwith your application) to execute Node.js code. To display remote content, use\nthe <webview> tag or BrowserView, make sure\nto disable the nodeIntegration and enable contextIsolation."
    },
    "/docs/api/structures/segmented-control-segment": {
      "locale": "en-US",
      "slug": "segmented-control-segment",
      "href": "/docs/api/structures/segmented-control-segment",
      "crowdinFileId": "256499",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/segmented-control-segment.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"segmentedcontrolsegment-object\"><a href=\"#segmentedcontrolsegment-object\">SegmentedControlSegment Object</a></h1>\n<ul>\n<li><code>label</code> String (optional) - The text to appear in this segment.</li>\n<li><code>icon</code> NativeImage (optional) - The image to appear in this segment.</li>\n<li><code>enabled</code> Boolean (optional) - Whether this segment is selectable. Default: true.</li>\n</ul>",
      "title": "SegmentedControlSegment Object",
      "description": ""
    },
    "/docs/api/structures/serial-port": {
      "locale": "en-US",
      "slug": "serial-port",
      "href": "/docs/api/structures/serial-port",
      "crowdinFileId": "256501",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/serial-port.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"serialport-object\"><a href=\"#serialport-object\">SerialPort Object</a></h1>\n<ul>\n<li><code>portId</code> String - Unique identifier for the port.</li>\n<li><code>portName</code> String - Name of the port.</li>\n<li><code>displayName</code> String - A string suitable for display to the user for describing this device.</li>\n<li><code>vendorId</code> String - Optional USB vendor ID.</li>\n<li><code>productId</code> String - Optional USB product ID.</li>\n<li><code>serialNumber</code> String - The USB device serial number.</li>\n<li><code>usbDriverName</code> String (optional) - Represents a single serial port on macOS can be enumerated by multiple drivers.</li>\n<li><code>deviceInstanceId</code> String (optional) - A stable identifier on Windows that can be used for device permissions.</li>\n</ul>",
      "title": "SerialPort Object",
      "description": ""
    },
    "/docs/api/structures/service-worker-info": {
      "locale": "en-US",
      "slug": "service-worker-info",
      "href": "/docs/api/structures/service-worker-info",
      "crowdinFileId": "256503",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/service-worker-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"serviceworkerinfo-object\"><a href=\"#serviceworkerinfo-object\">ServiceWorkerInfo Object</a></h1>\n<ul>\n<li><code>scriptUrl</code> String - The full URL to the script that this service worker runs</li>\n<li><code>scope</code> String - The base URL that this service worker is active for.</li>\n<li><code>renderProcessId</code> Number - The virtual ID of the process that this service worker is running in.  This is not an OS level PID.  This aligns with the ID set used for <code>webContents.getProcessId()</code>.</li>\n</ul>",
      "title": "ServiceWorkerInfo Object",
      "description": ""
    },
    "/docs/api/service-workers": {
      "locale": "en-US",
      "slug": "service-workers",
      "href": "/docs/api/service-workers",
      "crowdinFileId": "256363",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/service-workers.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-serviceworkers\"><a href=\"#class-serviceworkers\">Class: ServiceWorkers</a></h2>\n<blockquote>\n<p>Query and receive events from a sessions active service workers.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Instances of the <code>ServiceWorkers</code> class are accessed by using <code>serviceWorkers</code> property of\na <code>Session</code>.</p>\n<p>For example:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Get all service workers.</span>\n<span class=\"hljs-built_in\">console</span>.log(session.defaultSession.serviceWorkers.getAllRunning())\n\n<span class=\"hljs-comment\">// Handle logs and get service worker info</span>\nsession.defaultSession.serviceWorkers.on(<span class=\"hljs-string\">'console-message'</span>, (event, messageDetails) => {\n  <span class=\"hljs-built_in\">console</span>.log(\n    <span class=\"hljs-string\">'Got service worker message'</span>,\n    messageDetails,\n    <span class=\"hljs-string\">'from'</span>,\n    session.defaultSession.serviceWorkers.getFromVersionID(messageDetails.versionId)\n  )\n})\n</code></pre>\n<h3 id=\"instance-events\"><a href=\"#instance-events\">Instance Events</a></h3>\n<p>The following events are available on instances of <code>ServiceWorkers</code>:</p>\n<h4 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>messageDetails</code> Object - Information about the console message<ul>\n<li><code>message</code> String - The actual console message</li>\n<li><code>versionId</code> Number - The version ID of the service worker that sent the log message</li>\n<li><code>source</code> String - The type of source for this message.  Can be <code>javascript</code>, <code>xml</code>, <code>network</code>, <code>console-api</code>, <code>storage</code>, <code>app-cache</code>, <code>rendering</code>, <code>security</code>, <code>deprecation</code>, <code>worker</code>, <code>violation</code>, <code>intervention</code>, <code>recommendation</code> or <code>other</code>.</li>\n<li><code>level</code> Number - The log level, from 0 to 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>sourceUrl</code> String - The URL the message came from</li>\n<li><code>lineNumber</code> Number - The line number of the source that triggered this console message</li>\n</ul></li>\n</ul>\n<p>Emitted when a service worker logs something to the console.</p>\n<h4 id=\"event-registration-completed\"><a href=\"#event-registration-completed\">Event: 'registration-completed'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object - Information about the registered service worker<ul>\n<li><code>scope</code> String - The base URL that a service worker is registered for</li>\n</ul></li>\n</ul>\n<p>Emitted when a service worker has been registered. Can occur after a call to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\"><code>navigator.serviceWorker.register('/sw.js')</code></a> successfully resolves or when a Chrome extension is loaded.</p>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<p>The following methods are available on instances of <code>ServiceWorkers</code>:</p>\n<h4 id=\"serviceworkersgetallrunning\"><a href=\"#serviceworkersgetallrunning\"><code>serviceWorkers.getAllRunning()</code></a></h4>\n<p>Returns <code>Record&#x3C;Number, ServiceWorkerInfo></code> - A <a href=\"/docs/api/structures/service-worker-info\">ServiceWorkerInfo</a> object where the keys are the service worker version ID and the values are the information about that service worker.</p>\n<h4 id=\"serviceworkersgetfromversionidversionid\"><a href=\"#serviceworkersgetfromversionidversionid\"><code>serviceWorkers.getFromVersionID(versionId)</code></a></h4>\n<ul>\n<li><code>versionId</code> Number</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/service-worker-info\"><code>ServiceWorkerInfo</code></a> - Information about this service worker</p>\n<p>If the service worker does not exist or is not running this method will throw an exception.</p>",
      "title": "ServiceWorkers",
      "description": "Query and receive events from a sessions active service workers."
    },
    "/docs/api/session": {
      "locale": "en-US",
      "slug": "session",
      "href": "/docs/api/session",
      "crowdinFileId": "256365",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/session.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"session\"><a href=\"#session\">session</a></h1>\n<blockquote>\n<p>Manage browser sessions, cookies, cache, proxy settings, etc.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>The <code>session</code> module can be used to create new <code>Session</code> objects.</p>\n<p>You can also access the <code>session</code> of existing pages by using the <code>session</code>\nproperty of <a href=\"/docs/api/web-contents\"><code>WebContents</code></a>, or from the <code>session</code> module.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> ses = win.webContents.session\n<span class=\"hljs-built_in\">console</span>.log(ses.getUserAgent())\n</code></pre>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>session</code> module has the following methods:</p>\n<h3 id=\"sessionfrompartitionpartition-options\"><a href=\"#sessionfrompartitionpartition-options\"><code>session.fromPartition(partition[, options])</code></a></h3>\n<ul>\n<li><code>partition</code> String</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>cache</code> Boolean - Whether to enable cache.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Session</code> - A session instance from <code>partition</code> string. When there is an existing\n<code>Session</code> with the same <code>partition</code>, it will be returned; otherwise a new\n<code>Session</code> instance will be created with <code>options</code>.</p>\n<p>If <code>partition</code> starts with <code>persist:</code>, the page will use a persistent session\navailable to all pages in the app with the same <code>partition</code>. if there is no\n<code>persist:</code> prefix, the page will use an in-memory session. If the <code>partition</code> is\nempty then default session of the app will be returned.</p>\n<p>To create a <code>Session</code> with <code>options</code>, you have to ensure the <code>Session</code> with the\n<code>partition</code> has never been used before. There is no way to change the <code>options</code>\nof an existing <code>Session</code> object.</p>\n<h2 id=\"properties\"><a href=\"#properties\">Properties</a></h2>\n<p>The <code>session</code> module has the following properties:</p>\n<h3 id=\"sessiondefaultsession\"><a href=\"#sessiondefaultsession\"><code>session.defaultSession</code></a></h3>\n<p>A <code>Session</code> object, the default session object of the app.</p>\n<h2 id=\"class-session\"><a href=\"#class-session\">Class: Session</a></h2>\n<blockquote>\n<p>Get and set properties of a session.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>You can create a <code>Session</code> object in the <code>session</code> module:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> ses = session.fromPartition(<span class=\"hljs-string\">'persist:name'</span>)\n<span class=\"hljs-built_in\">console</span>.log(ses.getUserAgent())\n</code></pre>\n<h3 id=\"instance-events\"><a href=\"#instance-events\">Instance Events</a></h3>\n<p>The following events are available on instances of <code>Session</code>:</p>\n<h4 id=\"event-will-download\"><a href=\"#event-will-download\">Event: 'will-download'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>item</code> <a href=\"/docs/api/download-item\">DownloadItem</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitted when Electron is about to download <code>item</code> in <code>webContents</code>.</p>\n<p>Calling <code>event.preventDefault()</code> will cancel the download and <code>item</code> will not be\navailable from next tick of the process.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nsession.defaultSession.on(<span class=\"hljs-string\">'will-download'</span>, (event, item, webContents) => {\n  event.preventDefault()\n  <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'got'</span>)(item.getURL()).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">response</span>) =></span> {\n    <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>).writeFileSync(<span class=\"hljs-string\">'/somewhere'</span>, response.body)\n  })\n})\n</code></pre>\n<h4 id=\"event-extension-loaded\"><a href=\"#event-extension-loaded\">Event: 'extension-loaded'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Emitted after an extension is loaded. This occurs whenever an extension is\nadded to the \"enabled\" set of extensions. This includes:</p>\n<ul>\n<li>Extensions being loaded from <code>Session.loadExtension</code>.</li>\n<li>Extensions being reloaded:<ul>\n<li>from a crash.</li>\n<li>if the extension requested it (<a href=\"https://developer.chrome.com/extensions/runtime#method-reload\"><code>chrome.runtime.reload()</code></a>).</li>\n</ul></li>\n</ul>\n<h4 id=\"event-extension-unloaded\"><a href=\"#event-extension-unloaded\">Event: 'extension-unloaded'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Emitted after an extension is unloaded. This occurs when\n<code>Session.removeExtension</code> is called.</p>\n<h4 id=\"event-extension-ready\"><a href=\"#event-extension-ready\">Event: 'extension-ready'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Emitted after an extension is loaded and all necessary browser state is\ninitialized to support the start of the extension's background page.</p>\n<h4 id=\"event-preconnect\"><a href=\"#event-preconnect\">Event: 'preconnect'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preconnectUrl</code> String - The URL being requested for preconnection by the\nrenderer.</li>\n<li><code>allowCredentials</code> Boolean - True if the renderer is requesting that the\nconnection include credentials (see the\n<a href=\"https://w3c.github.io/resource-hints/#preconnect\">spec</a> for more details.)</li>\n</ul>\n<p>Emitted when a render process requests preconnection to a URL, generally due to\na <a href=\"https://w3c.github.io/resource-hints/\">resource hint</a>.</p>\n<h4 id=\"event-spellcheck-dictionary-initialized\"><a href=\"#event-spellcheck-dictionary-initialized\">Event: 'spellcheck-dictionary-initialized'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file has been successfully initialized. This\noccurs after the file has been downloaded.</p>\n<h4 id=\"event-spellcheck-dictionary-download-begin\"><a href=\"#event-spellcheck-dictionary-download-begin\">Event: 'spellcheck-dictionary-download-begin'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file starts downloading</p>\n<h4 id=\"event-spellcheck-dictionary-download-success\"><a href=\"#event-spellcheck-dictionary-download-success\">Event: 'spellcheck-dictionary-download-success'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file has been successfully downloaded</p>\n<h4 id=\"event-spellcheck-dictionary-download-failure\"><a href=\"#event-spellcheck-dictionary-download-failure\">Event: 'spellcheck-dictionary-download-failure'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file download fails.  For details\non the failure you should collect a netlog and inspect the download\nrequest.</p>\n<h4 id=\"event-select-hid-device\"><a href=\"#event-select-hid-device\">Event: 'select-hid-device'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>deviceList</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>deviceId</code> String | null (optional)</li>\n</ul></li>\n</ul>\n<p>Emitted when a HID device needs to be selected when a call to\n<code>navigator.hid.requestDevice</code> is made. <code>callback</code> should be called with\n<code>deviceId</code> to be selected; passing no arguments to <code>callback</code> will\ncancel the request.  Additionally, permissioning on <code>navigator.hid</code> can\nbe further managed by using <a href=\"#sessetpermissioncheckhandlerhandler\">ses.setPermissionCheckHandler(handler)</a>\nand <a href=\"#sessetdevicepermissionhandlerhandler\">ses.setDevicePermissionHandler(handler)`</a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.webContents.session.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin, details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-comment\">// Add logic here to determine if permission should be given to allow HID selection</span>\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  <span class=\"hljs-comment\">// Optionally, retrieve previously persisted devices from a persistent store</span>\n  <span class=\"hljs-keyword\">const</span> grantedDevices = fetchGrantedDevices()\n\n  win.webContents.session.setDevicePermissionHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(details.origin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; details.deviceType === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-keyword\">if</span> (details.device.vendorId === <span class=\"hljs-number\">123</span> &#x26;&#x26; details.device.productId === <span class=\"hljs-number\">345</span>) {\n        <span class=\"hljs-comment\">// Always allow this type of device (this allows skipping the call to `navigator.hid.requestDevice` first)</span>\n        <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n      }\n\n      <span class=\"hljs-comment\">// Search through the list of devices that have previously been granted permission</span>\n      <span class=\"hljs-keyword\">return</span> grantedDevices.some(<span class=\"hljs-function\">(<span class=\"hljs-params\">grantedDevice</span>) =></span> {\n        <span class=\"hljs-keyword\">return</span> grantedDevice.vendorId === details.device.vendorId &#x26;&#x26;\n              grantedDevice.productId === details.device.productId &#x26;&#x26;\n              grantedDevice.serialNumber &#x26;&#x26; grantedDevice.serialNumber === details.device.serialNumber\n      })\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  win.webContents.session.on(<span class=\"hljs-string\">'select-hid-device'</span>, (event, details, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedDevice = details.deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    callback(selectedPort?.deviceId)\n  })\n})\n</code></pre>\n<h4 id=\"event-hid-device-added\"><a href=\"#event-hid-device-added\">Event: 'hid-device-added'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n</ul>\n<p>Emitted when a new HID device becomes available. For example, when a new USB device is plugged in.</p>\n<p>This event will only be emitted after <code>navigator.hid.requestDevice</code> has been called and <code>select-hid-device</code> has fired.</p>\n<h4 id=\"event-hid-device-removed\"><a href=\"#event-hid-device-removed\">Event: 'hid-device-removed'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n</ul>\n<p>Emitted when a HID device has been removed.  For example, this event will fire when a USB device is unplugged.</p>\n<p>This event will only be emitted after <code>navigator.hid.requestDevice</code> has been called and <code>select-hid-device</code> has fired.</p>\n<h4 id=\"event-select-serial-port\"><a href=\"#event-select-serial-port\">Event: 'select-serial-port'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>portList</code> <a href=\"/docs/api/structures/serial-port\">SerialPort[]</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>portId</code> String</li>\n</ul></li>\n</ul>\n<p>Emitted when a serial port needs to be selected when a call to\n<code>navigator.serial.requestPort</code> is made. <code>callback</code> should be called with\n<code>portId</code> to be selected, passing an empty string to <code>callback</code> will\ncancel the request.  Additionally, permissioning on <code>navigator.serial</code> can\nbe managed by using <a href=\"#sessetpermissioncheckhandlerhandler\">ses.setPermissionCheckHandler(handler)</a>\nwith the <code>serial</code> permission.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n  win.webContents.session.on(<span class=\"hljs-string\">'select-serial-port'</span>, (event, portList, webContents, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedPort = portList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    <span class=\"hljs-keyword\">if</span> (!selectedPort) {\n      callback(<span class=\"hljs-string\">''</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      callback(selectedPort.portId)\n    }\n  })\n})\n</code></pre>\n<h4 id=\"event-serial-port-added\"><a href=\"#event-serial-port-added\">Event: 'serial-port-added'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>port</code> <a href=\"/docs/api/structures/serial-port\">SerialPort</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitted after <code>navigator.serial.requestPort</code> has been called and <code>select-serial-port</code> has fired if a new serial port becomes available.  For example, this event will fire when a new USB device is plugged in.</p>\n<h4 id=\"event-serial-port-removed\"><a href=\"#event-serial-port-removed\">Event: 'serial-port-removed'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>port</code> <a href=\"/docs/api/structures/serial-port\">SerialPort</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitted after <code>navigator.serial.requestPort</code> has been called and <code>select-serial-port</code> has fired if a serial port has been removed.  For example, this event will fire when a USB device is unplugged.</p>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<p>The following methods are available on instances of <code>Session</code>:</p>\n<h4 id=\"sesgetcachesize\"><a href=\"#sesgetcachesize\"><code>ses.getCacheSize()</code></a></h4>\n<p>Returns <code>Promise&#x3C;Integer></code> - the session's current cache size, in bytes.</p>\n<h4 id=\"sesclearcache\"><a href=\"#sesclearcache\"><code>ses.clearCache()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the cache clear operation is complete.</p>\n<p>Clears the session’s HTTP cache.</p>\n<h4 id=\"sesclearstoragedataoptions\"><a href=\"#sesclearstoragedataoptions\"><code>ses.clearStorageData([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>origin</code> String (optional) - Should follow <code>window.location.origin</code>’s representation\n<code>scheme://host:port</code>.</li>\n<li><code>storages</code> String<a href=\"/docs/api/optional\"></a> - The types of storages to clear, can contain:\n<code>appcache</code>, <code>cookies</code>, <code>filesystem</code>, <code>indexdb</code>, <code>localstorage</code>,\n<code>shadercache</code>, <code>websql</code>, <code>serviceworkers</code>, <code>cachestorage</code>. If not\nspecified, clear all storage types.</li>\n<li><code>quotas</code> String<a href=\"/docs/api/optional\"></a> - The types of quotas to clear, can contain:\n<code>temporary</code>, <code>persistent</code>, <code>syncable</code>. If not specified, clear all quotas.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the storage data has been cleared.</p>\n<h4 id=\"sesflushstoragedata\"><a href=\"#sesflushstoragedata\"><code>ses.flushStorageData()</code></a></h4>\n<p>Writes any unwritten DOMStorage data to disk.</p>\n<h4 id=\"sessetproxyconfig\"><a href=\"#sessetproxyconfig\"><code>ses.setProxy(config)</code></a></h4>\n<ul>\n<li><code>config</code> Object<ul>\n<li><code>mode</code> String (optional) - The proxy mode. Should be one of <code>direct</code>,\n<code>auto_detect</code>, <code>pac_script</code>, <code>fixed_servers</code> or <code>system</code>. If it's\nunspecified, it will be automatically determined based on other specified\noptions.<ul>\n<li><code>direct</code>\nIn direct mode all connections are created directly, without any proxy involved.</li>\n<li><code>auto_detect</code>\nIn auto_detect mode the proxy configuration is determined by a PAC script that can\nbe downloaded at <a href=\"http://wpad/wpad.dat\">http://wpad/wpad.dat</a>.</li>\n<li><code>pac_script</code>\nIn pac_script mode the proxy configuration is determined by a PAC script that is\nretrieved from the URL specified in the <code>pacScript</code>. This is the default mode\nif <code>pacScript</code> is specified.</li>\n<li><code>fixed_servers</code>\nIn fixed_servers mode the proxy configuration is specified in <code>proxyRules</code>.\nThis is the default mode if <code>proxyRules</code> is specified.</li>\n<li><code>system</code>\nIn system mode the proxy configuration is taken from the operating system.\nNote that the system mode is different from setting no proxy configuration.\nIn the latter case, Electron falls back to the system settings\nonly if no command-line options influence the proxy configuration.</li>\n</ul></li>\n<li><code>pacScript</code> String (optional) - The URL associated with the PAC file.</li>\n<li><code>proxyRules</code> String (optional) - Rules indicating which proxies to use.</li>\n<li><code>proxyBypassRules</code> String (optional) - Rules indicating which URLs should\nbypass the proxy settings.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the proxy setting process is complete.</p>\n<p>Sets the proxy settings.</p>\n<p>When <code>mode</code> is unspecified, <code>pacScript</code> and <code>proxyRules</code> are provided together, the <code>proxyRules</code>\noption is ignored and <code>pacScript</code> configuration is applied.</p>\n<p>You may need <code>ses.closeAllConnections</code> to close currently in flight connections to prevent\npooled sockets using previous proxy from being reused by future requests.</p>\n<p>The <code>proxyRules</code> has to follow the rules below:</p>\n<pre><code class=\"hljs language-sh\">proxyRules = schemeProxies[<span class=\"hljs-string\">\";\"</span>&#x3C;schemeProxies>]\nschemeProxies = [&#x3C;urlScheme><span class=\"hljs-string\">\"=\"</span>]&#x3C;proxyURIList>\nurlScheme = <span class=\"hljs-string\">\"http\"</span> | <span class=\"hljs-string\">\"https\"</span> | <span class=\"hljs-string\">\"ftp\"</span> | <span class=\"hljs-string\">\"socks\"</span>\nproxyURIList = &#x3C;proxyURL>[<span class=\"hljs-string\">\",\"</span>&#x3C;proxyURIList>]\nproxyURL = [&#x3C;proxyScheme><span class=\"hljs-string\">\"://\"</span>]&#x3C;proxyHost>[<span class=\"hljs-string\">\":\"</span>&#x3C;proxyPort>]\n</code></pre>\n<p>For example:</p>\n<ul>\n<li><code>http=foopy:80;ftp=foopy2</code> - Use HTTP proxy <code>foopy:80</code> for <code>http://</code> URLs, and\nHTTP proxy <code>foopy2:80</code> for <code>ftp://</code> URLs.</li>\n<li><code>foopy:80</code> - Use HTTP proxy <code>foopy:80</code> for all URLs.</li>\n<li><code>foopy:80,bar,direct://</code> - Use HTTP proxy <code>foopy:80</code> for all URLs, failing\nover to <code>bar</code> if <code>foopy:80</code> is unavailable, and after that using no proxy.</li>\n<li><code>socks4://foopy</code> - Use SOCKS v4 proxy <code>foopy:1080</code> for all URLs.</li>\n<li><code>http=foopy,socks5://bar.com</code> - Use HTTP proxy <code>foopy</code> for http URLs, and fail\nover to the SOCKS5 proxy <code>bar.com</code> if <code>foopy</code> is unavailable.</li>\n<li><code>http=foopy,direct://</code> - Use HTTP proxy <code>foopy</code> for http URLs, and use no\nproxy if <code>foopy</code> is unavailable.</li>\n<li><code>http=foopy;socks=foopy2</code> - Use HTTP proxy <code>foopy</code> for http URLs, and use\n<code>socks4://foopy2</code> for all other URLs.</li>\n</ul>\n<p>The <code>proxyBypassRules</code> is a comma separated list of rules described below:</p>\n<ul>\n<li>\n<p><code>[ URL_SCHEME \"://\" ] HOSTNAME_PATTERN [ \":\" &#x3C;port> ]</code></p>\n<p> Match all hostnames that match the pattern HOSTNAME_PATTERN.</p>\n<p> Examples:\n\"foobar.com\", \"<em>foobar.com\", \"</em>.foobar.com\", \"<em>foobar.com:99\",\n\"<a href=\"https://x\">https://x</a>.</em>.y.com:99\"</p>\n</li>\n<li>\n<p><code>\".\" HOSTNAME_SUFFIX_PATTERN [ \":\" PORT ]</code></p>\n<p> Match a particular domain suffix.</p>\n<p> Examples:\n\".google.com\", \".com\", \"<a href=\"http://.google.com\">http://.google.com</a>\"</p>\n</li>\n<li>\n<p><code>[ SCHEME \"://\" ] IP_LITERAL [ \":\" PORT ]</code></p>\n<p> Match URLs which are IP address literals.</p>\n<p> Examples:\n\"127.0.1\", \"[0:0::1]\", \"[::1]\", \"<a href=\"http://%5B::1%5D:99\">http://[::1]:99</a>\"</p>\n</li>\n<li>\n<p><code>IP_LITERAL \"/\" PREFIX_LENGTH_IN_BITS</code></p>\n<p> Match any URL that is to an IP literal that falls between the\ngiven range. IP range is specified using CIDR notation.</p>\n<p> Examples:\n\"192.168.1.1/16\", \"fefe:13::abc/33\".</p>\n</li>\n<li>\n<p><code>&#x3C;local></code></p>\n<p> Match local addresses. The meaning of <code>&#x3C;local></code> is whether the\nhost matches one of: \"127.0.0.1\", \"::1\", \"localhost\".</p>\n</li>\n</ul>\n<h4 id=\"sesresolveproxyurl\"><a href=\"#sesresolveproxyurl\"><code>ses.resolveProxy(url)</code></a></h4>\n<ul>\n<li><code>url</code> URL</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - Resolves with the proxy information for <code>url</code>.</p>\n<h4 id=\"sesforcereloadproxyconfig\"><a href=\"#sesforcereloadproxyconfig\"><code>ses.forceReloadProxyConfig()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the all internal states of proxy service is reset and the latest proxy configuration is reapplied if it's already available. The pac script will be fetched from <code>pacScript</code> again if the proxy mode is <code>pac_script</code>.</p>\n<h4 id=\"sessetdownloadpathpath\"><a href=\"#sessetdownloadpathpath\"><code>ses.setDownloadPath(path)</code></a></h4>\n<ul>\n<li><code>path</code> String - The download location.</li>\n</ul>\n<p>Sets download saving directory. By default, the download directory will be the\n<code>Downloads</code> under the respective app folder.</p>\n<h4 id=\"sesenablenetworkemulationoptions\"><a href=\"#sesenablenetworkemulationoptions\"><code>ses.enableNetworkEmulation(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>offline</code> Boolean (optional) - Whether to emulate network outage. Defaults\nto false.</li>\n<li><code>latency</code> Double (optional) - RTT in ms. Defaults to 0 which will disable\nlatency throttling.</li>\n<li><code>downloadThroughput</code> Double (optional) - Download rate in Bps. Defaults to 0\nwhich will disable download throttling.</li>\n<li><code>uploadThroughput</code> Double (optional) - Upload rate in Bps. Defaults to 0\nwhich will disable upload throttling.</li>\n</ul></li>\n</ul>\n<p>Emulates network with the given configuration for the <code>session</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// To emulate a GPRS connection with 50kbps throughput and 500 ms latency.</span>\n<span class=\"hljs-built_in\">window</span>.webContents.session.enableNetworkEmulation({\n  <span class=\"hljs-attr\">latency</span>: <span class=\"hljs-number\">500</span>,\n  <span class=\"hljs-attr\">downloadThroughput</span>: <span class=\"hljs-number\">6400</span>,\n  <span class=\"hljs-attr\">uploadThroughput</span>: <span class=\"hljs-number\">6400</span>\n})\n\n<span class=\"hljs-comment\">// To emulate a network outage.</span>\n<span class=\"hljs-built_in\">window</span>.webContents.session.enableNetworkEmulation({ <span class=\"hljs-attr\">offline</span>: <span class=\"hljs-literal\">true</span> })\n</code></pre>\n<h4 id=\"sespreconnectoptions\"><a href=\"#sespreconnectoptions\"><code>ses.preconnect(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>url</code> String - URL for preconnect. Only the origin is relevant for opening the socket.</li>\n<li><code>numSockets</code> Number (optional) - number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.</li>\n</ul></li>\n</ul>\n<p>Preconnects the given number of sockets to an origin.</p>\n<h4 id=\"sescloseallconnections\"><a href=\"#sescloseallconnections\"><code>ses.closeAllConnections()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when all connections are closed.</p>\n<p><strong>Note:</strong> It will terminate / fail all requests currently in flight.</p>\n<h4 id=\"sesdisablenetworkemulation\"><a href=\"#sesdisablenetworkemulation\"><code>ses.disableNetworkEmulation()</code></a></h4>\n<p>Disables any network emulation already active for the <code>session</code>. Resets to\nthe original network configuration.</p>\n<h4 id=\"sessetcertificateverifyprocproc\"><a href=\"#sessetcertificateverifyprocproc\"><code>ses.setCertificateVerifyProc(proc)</code></a></h4>\n<ul>\n<li><code>proc</code> Function | null<ul>\n<li><code>request</code> Object<ul>\n<li><code>hostname</code> String</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>validatedCertificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>verificationResult</code> String - Verification result from chromium.</li>\n<li><code>errorCode</code> Integer - Error code.</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>verificationResult</code> Integer - Value can be one of certificate error codes\nfrom <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">here</a>.\nApart from the certificate error codes, the following special codes can be used.<ul>\n<li><code>0</code> - Indicates success and disables Certificate Transparency verification.</li>\n<li><code>-2</code> - Indicates failure.</li>\n<li><code>-3</code> - Uses the verification result from chromium.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Sets the certificate verify proc for <code>session</code>, the <code>proc</code> will be called with\n<code>proc(request, callback)</code> whenever a server certificate\nverification is requested. Calling <code>callback(0)</code> accepts the certificate,\ncalling <code>callback(-2)</code> rejects it.</p>\n<p>Calling <code>setCertificateVerifyProc(null)</code> will revert back to default certificate\nverify proc.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.webContents.session.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">request, callback</span>) =></span> {\n  <span class=\"hljs-keyword\">const</span> { hostname } = request\n  <span class=\"hljs-keyword\">if</span> (hostname === <span class=\"hljs-string\">'github.com'</span>) {\n    callback(<span class=\"hljs-number\">0</span>)\n  } <span class=\"hljs-keyword\">else</span> {\n    callback(<span class=\"hljs-number\">-2</span>)\n  }\n})\n</code></pre>\n<blockquote>\n<p><strong>NOTE:</strong> The result of this procedure is cached by the network service.</p>\n</blockquote>\n<h4 id=\"sessetpermissionrequesthandlerhandler\"><a href=\"#sessetpermissionrequesthandlerhandler\"><code>ses.setPermissionRequestHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Function | null<ul>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a> - WebContents requesting the permission.  Please note that if the request comes from a subframe you should use <code>requestingUrl</code> to check the request origin.</li>\n<li><code>permission</code> String - The type of requested permission.<ul>\n<li><code>clipboard-read</code> - Request access to read from the clipboard.</li>\n<li><code>media</code> -  Request access to media devices such as camera, microphone and speakers.</li>\n<li><code>display-capture</code> - Request access to capture the screen.</li>\n<li><code>mediaKeySystem</code> - Request access to DRM protected content.</li>\n<li><code>geolocation</code> - Request access to user's current location.</li>\n<li><code>notifications</code> - Request notification creation and the ability to display them in the user's system tray.</li>\n<li><code>midi</code> - Request MIDI access in the <code>webmidi</code> API.</li>\n<li><code>midiSysex</code> - Request the use of system exclusive messages in the <code>webmidi</code> API.</li>\n<li><code>pointerLock</code> - Request to directly interpret mouse movements as an input method. Click <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API\">here</a> to know more.</li>\n<li><code>fullscreen</code> - Request for the app to enter fullscreen mode.</li>\n<li><code>openExternal</code> - Request to open links in external applications.</li>\n<li><code>unknown</code> - An unrecognized permission request</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>permissionGranted</code> Boolean - Allow or deny the permission.</li>\n</ul></li>\n<li><code>details</code> Object - Some properties are only available on certain permission types.<ul>\n<li><code>externalURL</code> String (optional) - The url of the <code>openExternal</code> request.</li>\n<li><code>mediaTypes</code> String<a href=\"/docs/api/optional\"></a> - The types of media access being requested, elements can be <code>video</code>\nor <code>audio</code></li>\n<li><code>requestingUrl</code> String - The last URL the requesting frame loaded</li>\n<li><code>isMainFrame</code> Boolean - Whether the frame making the request is the main frame</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Sets the handler which can be used to respond to permission requests for the <code>session</code>.\nCalling <code>callback(true)</code> will allow the permission and <code>callback(false)</code> will reject it.\nTo clear the handler, call <code>setPermissionRequestHandler(null)</code>.  Please note that\nyou must also implement <code>setPermissionCheckHandler</code> to get complete permission handling.\nMost web APIs do a permission check and then make a permission request if the check is denied.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nsession.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).setPermissionRequestHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, callback</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (webContents.getURL() === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notifications'</span>) {\n    <span class=\"hljs-keyword\">return</span> callback(<span class=\"hljs-literal\">false</span>) <span class=\"hljs-comment\">// denied.</span>\n  }\n\n  callback(<span class=\"hljs-literal\">true</span>)\n})\n</code></pre>\n<h4 id=\"sessetpermissioncheckhandlerhandler\"><a href=\"#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Function\\<boolean> | null<ul>\n<li><code>webContents</code> (<a href=\"/docs/api/web-contents\">WebContents</a> | null) - WebContents checking the permission.  Please note that if the request comes from a subframe you should use <code>requestingUrl</code> to check the request origin.  All cross origin sub frames making permission checks will pass a <code>null</code> webContents to this handler, while certain other permission checks such as <code>notifications</code> checks will always pass <code>null</code>.  You should use <code>embeddingOrigin</code> and <code>requestingOrigin</code> to determine what origin the owning frame and the requesting frame are on respectively.</li>\n<li><code>permission</code> String - Type of permission check.  Valid values are <code>midiSysex</code>, <code>notifications</code>, <code>geolocation</code>, <code>media</code>,<code>mediaKeySystem</code>,<code>midi</code>, <code>pointerLock</code>, <code>fullscreen</code>, <code>openExternal</code>, <code>hid</code>, or <code>serial</code>.</li>\n<li><code>requestingOrigin</code> String - The origin URL of the permission check</li>\n<li><code>details</code> Object - Some properties are only available on certain permission types.<ul>\n<li><code>embeddingOrigin</code> String (optional) - The origin of the frame embedding the frame that made the permission check.  Only set for cross-origin sub frames making permission checks.</li>\n<li><code>securityOrigin</code> String (optional) - The security origin of the <code>media</code> check.</li>\n<li><code>mediaType</code> String (optional) - The type of media access being requested, can be <code>video</code>,\n<code>audio</code> or <code>unknown</code></li>\n<li><code>requestingUrl</code> String (optional) - The last URL the requesting frame loaded.  This is not provided for cross-origin sub frames making permission checks.</li>\n<li><code>isMainFrame</code> Boolean - Whether the frame making the request is the main frame</li>\n</ul></li>\n</ul></boolean></li>\n</ul>\n<p>Sets the handler which can be used to respond to permission checks for the <code>session</code>.\nReturning <code>true</code> will allow the permission and <code>false</code> will reject it.  Please note that\nyou must also implement <code>setPermissionRequestHandler</code> to get complete permission handling.\nMost web APIs do a permission check and then make a permission request if the check is denied.\nTo clear the handler, call <code>setPermissionCheckHandler(null)</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>)\nsession.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(requestingOrigin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notifications'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span> <span class=\"hljs-comment\">// granted</span>\n  }\n\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span> <span class=\"hljs-comment\">// denied</span>\n})\n</code></pre>\n<h4 id=\"sessetdevicepermissionhandlerhandler\"><a href=\"#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Function\\<boolean> | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>deviceType</code> String - The type of device that permission is being requested on, can be <code>hid</code>.</li>\n<li><code>origin</code> String - The origin URL of the device permission check.</li>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice</a> - the device that permission is being requested for.</li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a> - WebFrameMain checking the device permission.</li>\n</ul></li>\n</ul></boolean></li>\n</ul>\n<p>Sets the handler which can be used to respond to device permission checks for the <code>session</code>.\nReturning <code>true</code> will allow the device to be permitted and <code>false</code> will reject it.\nTo clear the handler, call <code>setDevicePermissionHandler(null)</code>.\nThis handler can be used to provide default permissioning to devices without first calling for permission\nto devices (eg via <code>navigator.hid.requestDevice</code>).  If this handler is not defined, the default device\npermissions as granted through device selection (eg via <code>navigator.hid.requestDevice</code>) will be used.\nAdditionally, the default behavior of Electron is to store granted device permision through the lifetime\nof the corresponding WebContents.  If longer term storage is needed, a developer can store granted device\npermissions (eg when handling the <code>select-hid-device</code> event) and then read from that storage with <code>setDevicePermissionHandler</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.webContents.session.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin, details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-comment\">// Add logic here to determine if permission should be given to allow HID selection</span>\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  <span class=\"hljs-comment\">// Optionally, retrieve previously persisted devices from a persistent store</span>\n  <span class=\"hljs-keyword\">const</span> grantedDevices = fetchGrantedDevices()\n\n  win.webContents.session.setDevicePermissionHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(details.origin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; details.deviceType === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-keyword\">if</span> (details.device.vendorId === <span class=\"hljs-number\">123</span> &#x26;&#x26; details.device.productId === <span class=\"hljs-number\">345</span>) {\n        <span class=\"hljs-comment\">// Always allow this type of device (this allows skipping the call to `navigator.hid.requestDevice` first)</span>\n        <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n      }\n\n      <span class=\"hljs-comment\">// Search through the list of devices that have previously been granted permission</span>\n      <span class=\"hljs-keyword\">return</span> grantedDevices.some(<span class=\"hljs-function\">(<span class=\"hljs-params\">grantedDevice</span>) =></span> {\n        <span class=\"hljs-keyword\">return</span> grantedDevice.vendorId === details.device.vendorId &#x26;&#x26;\n              grantedDevice.productId === details.device.productId &#x26;&#x26;\n              grantedDevice.serialNumber &#x26;&#x26; grantedDevice.serialNumber === details.device.serialNumber\n      })\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  win.webContents.session.on(<span class=\"hljs-string\">'select-hid-device'</span>, (event, details, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedDevice = details.deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    callback(selectedPort?.deviceId)\n  })\n})\n</code></pre>\n<h4 id=\"sesclearhostresolvercache\"><a href=\"#sesclearhostresolvercache\"><code>ses.clearHostResolverCache()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the operation is complete.</p>\n<p>Clears the host resolver cache.</p>\n<h4 id=\"sesallowntlmcredentialsfordomainsdomains\"><a href=\"#sesallowntlmcredentialsfordomainsdomains\"><code>ses.allowNTLMCredentialsForDomains(domains)</code></a></h4>\n<ul>\n<li><code>domains</code> String - A comma-separated list of servers for which\nintegrated authentication is enabled.</li>\n</ul>\n<p>Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate\nauthentication.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">// consider any url ending with `example.com`, `foobar.com`, `baz`</span>\n<span class=\"hljs-comment\">// for integrated authentication.</span>\nsession.defaultSession.allowNTLMCredentialsForDomains(<span class=\"hljs-string\">'*example.com, *foobar.com, *baz'</span>)\n\n<span class=\"hljs-comment\">// consider all urls for integrated authentication.</span>\nsession.defaultSession.allowNTLMCredentialsForDomains(<span class=\"hljs-string\">'*'</span>)\n</code></pre>\n<h4 id=\"sessetuseragentuseragent-acceptlanguages\"><a href=\"#sessetuseragentuseragent-acceptlanguages\"><code>ses.setUserAgent(userAgent[, acceptLanguages])</code></a></h4>\n<ul>\n<li><code>userAgent</code> String</li>\n<li><code>acceptLanguages</code> String (optional)</li>\n</ul>\n<p>Overrides the <code>userAgent</code> and <code>acceptLanguages</code> for this session.</p>\n<p>The <code>acceptLanguages</code> must a comma separated ordered list of language codes, for\nexample <code>\"en-US,fr,de,ko,zh-CN,ja\"</code>.</p>\n<p>This doesn't affect existing <code>WebContents</code>, and each <code>WebContents</code> can use\n<code>webContents.setUserAgent</code> to override the session-wide user agent.</p>\n<h4 id=\"sesispersistent\"><a href=\"#sesispersistent\"><code>ses.isPersistent()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether or not this session is a persistent one. The default\n<code>webContents</code> session of a <code>BrowserWindow</code> is persistent. When creating a session\nfrom a partition, session prefixed with <code>persist:</code> will be persistent, while others\nwill be temporary.</p>\n<h4 id=\"sesgetuseragent\"><a href=\"#sesgetuseragent\"><code>ses.getUserAgent()</code></a></h4>\n<p>Returns <code>String</code> - The user agent for this session.</p>\n<h4 id=\"sessetsslconfigconfig\"><a href=\"#sessetsslconfigconfig\"><code>ses.setSSLConfig(config)</code></a></h4>\n<ul>\n<li><code>config</code> Object<ul>\n<li><code>minVersion</code> String (optional) - Can be <code>tls1</code>, <code>tls1.1</code>, <code>tls1.2</code> or <code>tls1.3</code>. The\nminimum SSL version to allow when connecting to remote servers. Defaults to\n<code>tls1</code>.</li>\n<li><code>maxVersion</code> String (optional) - Can be <code>tls1.2</code> or <code>tls1.3</code>. The maximum SSL version\nto allow when connecting to remote servers. Defaults to <code>tls1.3</code>.</li>\n<li><code>disabledCipherSuites</code> Integer<a href=\"/docs/api/optional\"></a> - List of cipher suites which\nshould be explicitly prevented from being used in addition to those\ndisabled by the net built-in policy.\nSupported literal forms: 0xAABB, where AA is <code>cipher_suite[0]</code> and BB is\n<code>cipher_suite[1]</code>, as defined in RFC 2246, Section 7.4.1.2. Unrecognized but\nparsable cipher suites in this form will not return an error.\nEx: To disable TLS_RSA_WITH_RC4_128_MD5, specify 0x0004, while to\ndisable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002.\nNote that TLSv1.3 ciphers cannot be disabled using this mechanism.</li>\n</ul></li>\n</ul>\n<p>Sets the SSL configuration for the session. All subsequent network requests\nwill use the new configuration. Existing network connections (such as WebSocket\nconnections) will not be terminated, but old sockets in the pool will not be\nreused for new connections.</p>\n<h4 id=\"sesgetblobdataidentifier\"><a href=\"#sesgetblobdataidentifier\"><code>ses.getBlobData(identifier)</code></a></h4>\n<ul>\n<li><code>identifier</code> String - Valid UUID.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Buffer></code> - resolves with blob data.</p>\n<h4 id=\"sesdownloadurlurl\"><a href=\"#sesdownloadurlurl\"><code>ses.downloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code>.\nThe API will generate a <a href=\"/docs/api/download-item\">DownloadItem</a> that can be accessed\nwith the <a href=\"#event-will-download\">will-download</a> event.</p>\n<p><strong>Note:</strong> This does not perform any security checks that relate to a page's origin,\nunlike <a href=\"/docs/api/web-contents#contentsdownloadurlurl\"><code>webContents.downloadURL</code></a>.</p>\n<h4 id=\"sescreateinterrupteddownloadoptions\"><a href=\"#sescreateinterrupteddownloadoptions\"><code>ses.createInterruptedDownload(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>path</code> String - Absolute path of the download.</li>\n<li><code>urlChain</code> String[] - Complete URL chain for the download.</li>\n<li><code>mimeType</code> String (optional)</li>\n<li><code>offset</code> Integer - Start range for the download.</li>\n<li><code>length</code> Integer - Total length of the download.</li>\n<li><code>lastModified</code> String (optional) - Last-Modified header value.</li>\n<li><code>eTag</code> String (optional) - ETag header value.</li>\n<li><code>startTime</code> Double (optional) - Time when download was started in\nnumber of seconds since UNIX epoch.</li>\n</ul></li>\n</ul>\n<p>Allows resuming <code>cancelled</code> or <code>interrupted</code> downloads from previous <code>Session</code>.\nThe API will generate a <a href=\"/docs/api/download-item\">DownloadItem</a> that can be accessed with the <a href=\"#event-will-download\">will-download</a>\nevent. The <a href=\"/docs/api/download-item\">DownloadItem</a> will not have any <code>WebContents</code> associated with it and\nthe initial state will be <code>interrupted</code>. The download will start only when the\n<code>resume</code> API is called on the <a href=\"/docs/api/download-item\">DownloadItem</a>.</p>\n<h4 id=\"sesclearauthcache\"><a href=\"#sesclearauthcache\"><code>ses.clearAuthCache()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the session’s HTTP authentication cache has been cleared.</p>\n<h4 id=\"sessetpreloadspreloads\"><a href=\"#sessetpreloadspreloads\"><code>ses.setPreloads(preloads)</code></a></h4>\n<ul>\n<li><code>preloads</code> String[] - An array of absolute path to preload scripts</li>\n</ul>\n<p>Adds scripts that will be executed on ALL web contents that are associated with\nthis session just before normal <code>preload</code> scripts run.</p>\n<h4 id=\"sesgetpreloads\"><a href=\"#sesgetpreloads\"><code>ses.getPreloads()</code></a></h4>\n<p>Returns <code>String[]</code> an array of paths to preload scripts that have been\nregistered.</p>\n<h4 id=\"sessetspellcheckerenabledenable\"><a href=\"#sessetspellcheckerenabledenable\"><code>ses.setSpellCheckerEnabled(enable)</code></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Sets whether to enable the builtin spell checker.</p>\n<h4 id=\"sesisspellcheckerenabled\"><a href=\"#sesisspellcheckerenabled\"><code>ses.isSpellCheckerEnabled()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the builtin spell checker is enabled.</p>\n<h4 id=\"sessetspellcheckerlanguageslanguages\"><a href=\"#sessetspellcheckerlanguageslanguages\"><code>ses.setSpellCheckerLanguages(languages)</code></a></h4>\n<ul>\n<li><code>languages</code> String[] - An array of language codes to enable the spellchecker for.</li>\n</ul>\n<p>The built in spellchecker does not automatically detect what language a user is typing in.  In order for the\nspell checker to correctly check their words you must call this API with an array of language codes.  You can\nget the list of supported language codes with the <code>ses.availableSpellCheckerLanguages</code> property.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and will detect your language automatically.  This API is a no-op on macOS.</p>\n<h4 id=\"sesgetspellcheckerlanguages\"><a href=\"#sesgetspellcheckerlanguages\"><code>ses.getSpellCheckerLanguages()</code></a></h4>\n<p>Returns <code>String[]</code> - An array of language codes the spellchecker is enabled for.  If this list is empty the spellchecker\nwill fallback to using <code>en-US</code>.  By default on launch if this setting is an empty list Electron will try to populate this\nsetting with the current OS locale.  This setting is persisted across restarts.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and has its own list of languages.  This API is a no-op on macOS.</p>\n<h4 id=\"sessetspellcheckerdictionarydownloadurlurl\"><a href=\"#sessetspellcheckerdictionarydownloadurlurl\"><code>ses.setSpellCheckerDictionaryDownloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String - A base URL for Electron to download hunspell dictionaries from.</li>\n</ul>\n<p>By default Electron will download hunspell dictionaries from the Chromium CDN.  If you want to override this\nbehavior you can use this API to point the dictionary downloader at your own hosted version of the hunspell\ndictionaries.  We publish a <code>hunspell_dictionaries.zip</code> file with each release which contains the files you need\nto host here, the file server must be <strong>case insensitive</strong> you must upload each file twice, once with the case it\nhas in the ZIP file and once with the filename as all lower case.</p>\n<p>If the files present in <code>hunspell_dictionaries.zip</code> are available at <code>https://example.com/dictionaries/language-code.bdic</code>\nthen you should call this api with <code>ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')</code>.  Please\nnote the trailing slash.  The URL to the dictionaries is formed as <code>${url}${filename}</code>.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and therefore we do not download any dictionary files.  This API is a no-op on macOS.</p>\n<h4 id=\"seslistwordsinspellcheckerdictionary\"><a href=\"#seslistwordsinspellcheckerdictionary\"><code>ses.listWordsInSpellCheckerDictionary()</code></a></h4>\n<p>Returns <code>Promise&#x3C;String[]></code> - An array of all words in app's custom dictionary.\nResolves when the full dictionary is loaded from disk.</p>\n<h4 id=\"sesaddwordtospellcheckerdictionaryword\"><a href=\"#sesaddwordtospellcheckerdictionaryword\"><code>ses.addWordToSpellCheckerDictionary(word)</code></a></h4>\n<ul>\n<li><code>word</code> String - The word you want to add to the dictionary</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the word was successfully written to the custom dictionary. This API\nwill not work on non-persistent (in-memory) sessions.</p>\n<p><strong>Note:</strong> On macOS and Windows 10 this word will be written to the OS custom dictionary as well</p>\n<h4 id=\"sesremovewordfromspellcheckerdictionaryword\"><a href=\"#sesremovewordfromspellcheckerdictionaryword\"><code>ses.removeWordFromSpellCheckerDictionary(word)</code></a></h4>\n<ul>\n<li><code>word</code> String - The word you want to remove from the dictionary</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the word was successfully removed from the custom dictionary. This API\nwill not work on non-persistent (in-memory) sessions.</p>\n<p><strong>Note:</strong> On macOS and Windows 10 this word will be removed from the OS custom dictionary as well</p>\n<h4 id=\"sesloadextensionpath-options\"><a href=\"#sesloadextensionpath-options\"><code>ses.loadExtension(path[, options])</code></a></h4>\n<ul>\n<li><code>path</code> String - Path to a directory containing an unpacked Chrome extension</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>allowFileAccess</code> Boolean - Whether to allow the extension to read local files over <code>file://</code>\nprotocol and inject content scripts into <code>file://</code> pages. This is required e.g. for loading\ndevtools extensions on <code>file://</code> URLs. Defaults to false.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Extension></code> - resolves when the extension is loaded.</p>\n<p>This method will raise an exception if the extension could not be loaded. If\nthere are warnings when installing the extension (e.g. if the extension\nrequests an API that Electron does not support) then they will be logged to the\nconsole.</p>\n<p>Note that Electron does not support the full range of Chrome extensions APIs.\nSee <a href=\"/docs/api/extensions#supported-extensions-apis\">Supported Extensions APIs</a> for\nmore details on what is supported.</p>\n<p>Note that in previous versions of Electron, extensions that were loaded would\nbe remembered for future runs of the application. This is no longer the case:\n<code>loadExtension</code> must be called on every boot of your app if you want the\nextension to be loaded.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.on(<span class=\"hljs-string\">'ready'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> session.defaultSession.loadExtension(\n    path.join(__dirname, <span class=\"hljs-string\">'react-devtools'</span>),\n    <span class=\"hljs-comment\">// allowFileAccess is required to load the devtools extension on file:// URLs.</span>\n    { <span class=\"hljs-attr\">allowFileAccess</span>: <span class=\"hljs-literal\">true</span> }\n  )\n  <span class=\"hljs-comment\">// Note that in order to use the React DevTools extension, you'll need to</span>\n  <span class=\"hljs-comment\">// download and unzip a copy of the extension.</span>\n})\n</code></pre>\n<p>This API does not support loading packed (.crx) extensions.</p>\n<p><strong>Note:</strong> This API cannot be called before the <code>ready</code> event of the <code>app</code> module\nis emitted.</p>\n<p><strong>Note:</strong> Loading extensions into in-memory (non-persistent) sessions is not\nsupported and will throw an error.</p>\n<h4 id=\"sesremoveextensionextensionid\"><a href=\"#sesremoveextensionextensionid\"><code>ses.removeExtension(extensionId)</code></a></h4>\n<ul>\n<li><code>extensionId</code> String - ID of extension to remove</li>\n</ul>\n<p>Unloads an extension.</p>\n<p><strong>Note:</strong> This API cannot be called before the <code>ready</code> event of the <code>app</code> module\nis emitted.</p>\n<h4 id=\"sesgetextensionextensionid\"><a href=\"#sesgetextensionextensionid\"><code>ses.getExtension(extensionId)</code></a></h4>\n<ul>\n<li><code>extensionId</code> String - ID of extension to query</li>\n</ul>\n<p>Returns <code>Extension</code> | <code>null</code> - The loaded extension with the given ID.</p>\n<p><strong>Note:</strong> This API cannot be called before the <code>ready</code> event of the <code>app</code> module\nis emitted.</p>\n<h4 id=\"sesgetallextensions\"><a href=\"#sesgetallextensions\"><code>ses.getAllExtensions()</code></a></h4>\n<p>Returns <code>Extension[]</code> - A list of all loaded extensions.</p>\n<p><strong>Note:</strong> This API cannot be called before the <code>ready</code> event of the <code>app</code> module\nis emitted.</p>\n<h4 id=\"sesgetstoragepath\"><a href=\"#sesgetstoragepath\"><code>ses.getStoragePath()</code></a></h4>\n<p>A <code>String | null</code> indicating the absolute file system path where data for this\nsession is persisted on disk.  For in memory sessions this returns <code>null</code>.</p>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<p>The following properties are available on instances of <code>Session</code>:</p>\n<h4 id=\"sesavailablespellcheckerlanguages-readonly\"><a href=\"#sesavailablespellcheckerlanguages-readonly\"><code>ses.availableSpellCheckerLanguages</code> <em>Readonly</em></a></h4>\n<p>A <code>String[]</code> array which consists of all the known available spell checker languages.  Providing a language\ncode to the <code>setSpellCheckerLanguages</code> API that isn't in this array will result in an error.</p>\n<h4 id=\"sesspellcheckerenabled\"><a href=\"#sesspellcheckerenabled\"><code>ses.spellCheckerEnabled</code></a></h4>\n<p>A <code>Boolean</code> indicating whether builtin spell checker is enabled.</p>\n<h4 id=\"sesstoragepath-readonly\"><a href=\"#sesstoragepath-readonly\"><code>ses.storagePath</code> <em>Readonly</em></a></h4>\n<p>A <code>String | null</code> indicating the absolute file system path where data for this\nsession is persisted on disk.  For in memory sessions this returns <code>null</code>.</p>\n<h4 id=\"sescookies-readonly\"><a href=\"#sescookies-readonly\"><code>ses.cookies</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/cookies\"><code>Cookies</code></a> object for this session.</p>\n<h4 id=\"sesserviceworkers-readonly\"><a href=\"#sesserviceworkers-readonly\"><code>ses.serviceWorkers</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/service-workers\"><code>ServiceWorkers</code></a> object for this session.</p>\n<h4 id=\"seswebrequest-readonly\"><a href=\"#seswebrequest-readonly\"><code>ses.webRequest</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/web-request\"><code>WebRequest</code></a> object for this session.</p>\n<h4 id=\"sesprotocol-readonly\"><a href=\"#sesprotocol-readonly\"><code>ses.protocol</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/protocol\"><code>Protocol</code></a> object for this session.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> protocol = session.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).protocol\n  <span class=\"hljs-keyword\">if</span> (!protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })) {\n    <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Failed to register protocol'</span>)\n  }\n})\n</code></pre>\n<h4 id=\"sesnetlog-readonly\"><a href=\"#sesnetlog-readonly\"><code>ses.netLog</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/net-log\"><code>NetLog</code></a> object for this session.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> netLog = session.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).netLog\n  netLog.startLogging(<span class=\"hljs-string\">'/path/to/net-log'</span>)\n  <span class=\"hljs-comment\">// After some network events</span>\n  <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> netLog.stopLogging()\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Net-logs written to'</span>, path)\n})\n</code></pre>",
      "title": "session",
      "description": "Manage browser sessions, cookies, cache, proxy settings, etc."
    },
    "/docs/development/setting-up-symbol-server": {
      "locale": "en-US",
      "slug": "setting-up-symbol-server",
      "href": "/docs/development/setting-up-symbol-server",
      "crowdinFileId": "256165",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/setting-up-symbol-server.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"setting-up-symbol-server-in-debugger\"><a href=\"#setting-up-symbol-server-in-debugger\">Setting Up Symbol Server in Debugger</a></h1>\n<p>Debug symbols allow you to have better debugging sessions. They have information\nabout the functions contained in executables and dynamic libraries and provide\nyou with information to get clean call stacks. A Symbol Server allows the\ndebugger to load the correct symbols, binaries and sources automatically without\nforcing users to download large debugging files. The server functions like\n<a href=\"https://support.microsoft.com/kb/311503\">Microsoft's symbol server</a> so the\ndocumentation there can be useful.</p>\n<p>Note that because released Electron builds are heavily optimized, debugging is\nnot always easy. The debugger will not be able to show you the content of all\nvariables and the execution path can seem strange because of inlining, tail\ncalls, and other compiler optimizations. The only workaround is to build an\nunoptimized local build.</p>\n<p>The official symbol server URL for Electron is\n<a href=\"https://symbols.electronjs.org\">https://symbols.electronjs.org</a>.\nYou cannot visit this URL directly, you must add it to the symbol path of your\ndebugging tool. In the examples below, a local cache directory is used to avoid\nrepeatedly fetching the PDB from the server. Replace <code>c:\\code\\symbols</code> with an\nappropriate cache directory on your machine.</p>\n<h2 id=\"using-the-symbol-server-in-windbg\"><a href=\"#using-the-symbol-server-in-windbg\">Using the Symbol Server in Windbg</a></h2>\n<p>The Windbg symbol path is configured with a string value delimited with asterisk\ncharacters. To use only the Electron symbol server, add the following entry to\nyour symbol path (<strong>Note:</strong> you can replace <code>c:\\code\\symbols</code> with any writable\ndirectory on your computer, if you'd prefer a different location for downloaded\nsymbols):</p>\n<pre><code class=\"hljs language-powershell\">SRV*c:\\code\\symbols\\*https://symbols.electronjs.org\n</code></pre>\n<p>Set this string as <code>_NT_SYMBOL_PATH</code> in the environment, using the Windbg menus,\nor by typing the <code>.sympath</code> command. If you would like to get symbols from\nMicrosoft's symbol server as well, you should list that first:</p>\n<pre><code class=\"hljs language-powershell\">SRV*c:\\code\\symbols\\*https://msdl.microsoft.com/download/symbols;SRV*c:\\code\\symbols\\*https://symbols.electronjs.org\n</code></pre>\n<h2 id=\"using-the-symbol-server-in-visual-studio\"><a href=\"#using-the-symbol-server-in-visual-studio\">Using the symbol server in Visual Studio</a></h2>\n<p><img src=\"https://mdn.mozillademos.org/files/733/symbol-server-vc8express-menu.jpg\" alt=\"Tools -> Options\">\n<img src=\"https://mdn.mozillademos.org/files/2497/2005_options.gif\" alt=\"Symbols Settings\"></p>\n<h2 id=\"troubleshooting-symbols-will-not-load\"><a href=\"#troubleshooting-symbols-will-not-load\">Troubleshooting: Symbols will not load</a></h2>\n<p>Type the following commands in Windbg to print why symbols are not loading:</p>\n<pre><code class=\"hljs language-powershell\">> !sym noisy\n> .reload /f electron.exe\n</code></pre>",
      "title": "Setting Up Symbol Server in Debugger",
      "description": ""
    },
    "/docs/api/share-menu": {
      "locale": "en-US",
      "slug": "share-menu",
      "href": "/docs/api/share-menu",
      "crowdinFileId": "256367",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/share-menu.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharemenu\"><a href=\"#sharemenu\">ShareMenu</a></h1>\n<p>The <code>ShareMenu</code> class creates <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/\">Share Menu</a> on macOS, which can be\nused to share information from the current context to apps, social media\naccounts, and other services.</p>\n<p>For including the share menu as a submenu of other menus, please use the\n<code>shareMenu</code> role of <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>.</p>\n<h2 id=\"class-sharemenu\"><a href=\"#class-sharemenu\">Class: ShareMenu</a></h2>\n<blockquote>\n<p>Create share menu on macOS.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h3 id=\"new-sharemenusharingitem\"><a href=\"#new-sharemenusharingitem\"><code>new ShareMenu(sharingItem)</code></a></h3>\n<ul>\n<li><code>sharingItem</code> SharingItem - The item to share.</li>\n</ul>\n<p>Creates a new share menu.</p>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<p>The <code>shareMenu</code> object has the following instance methods:</p>\n<h4 id=\"sharemenupopupoptions\"><a href=\"#sharemenupopupoptions\"><code>shareMenu.popup([options])</code></a></h4>\n<ul>\n<li><code>options</code> PopupOptions (optional)<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional) - Default is the focused window.</li>\n<li><code>x</code> Number (optional) - Default is the current mouse cursor position.\nMust be declared if <code>y</code> is declared.</li>\n<li><code>y</code> Number (optional) - Default is the current mouse cursor position.\nMust be declared if <code>x</code> is declared.</li>\n<li><code>positioningItem</code> Number (optional) <em>macOS</em> - The index of the menu item to\nbe positioned under the mouse cursor at the specified coordinates. Default\nis -1.</li>\n<li><code>callback</code> Function (optional) - Called when menu is closed.</li>\n</ul></li>\n</ul>\n<p>Pops up this menu as a context menu in the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<h4 id=\"sharemenuclosepopupbrowserwindow\"><a href=\"#sharemenuclosepopupbrowserwindow\"><code>shareMenu.closePopup([browserWindow])</code></a></h4>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional) - Default is the focused window.</li>\n</ul>\n<p>Closes the context menu in the <code>browserWindow</code>.</p>",
      "title": "ShareMenu",
      "description": "Create share menu on macOS."
    },
    "/docs/api/structures/shared-worker-info": {
      "locale": "en-US",
      "slug": "shared-worker-info",
      "href": "/docs/api/structures/shared-worker-info",
      "crowdinFileId": "256505",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/shared-worker-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharedworkerinfo-object\"><a href=\"#sharedworkerinfo-object\">SharedWorkerInfo Object</a></h1>\n<ul>\n<li><code>id</code> String - The unique id of the shared worker.</li>\n<li><code>url</code> String - The url of the shared worker.</li>\n</ul>",
      "title": "SharedWorkerInfo Object",
      "description": ""
    },
    "/docs/api/structures/sharing-item": {
      "locale": "en-US",
      "slug": "sharing-item",
      "href": "/docs/api/structures/sharing-item",
      "crowdinFileId": "256507",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/sharing-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharingitem-object\"><a href=\"#sharingitem-object\">SharingItem Object</a></h1>\n<ul>\n<li><code>texts</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of text to share.</li>\n<li><code>filePaths</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of files to share.</li>\n<li><code>urls</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of URLs to share.</li>\n</ul>",
      "title": "SharingItem Object",
      "description": ""
    },
    "/docs/api/shell": {
      "locale": "en-US",
      "slug": "shell",
      "href": "/docs/api/shell",
      "crowdinFileId": "256369",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/shell.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"shell\"><a href=\"#shell\">shell</a></h1>\n<blockquote>\n<p>Manage files and URLs using their default applications.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a> (non-sandboxed only)</p>\n<p>The <code>shell</code> module provides functions related to desktop integration.</p>\n<p>An example of opening a URL in the user's default browser:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nshell.openExternal(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<p><strong>Note:</strong> While the <code>shell</code> module can be used in the renderer process, it will not function in a sandboxed renderer.</p>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>shell</code> module has the following methods:</p>\n<h3 id=\"shellshowiteminfolderfullpath\"><a href=\"#shellshowiteminfolderfullpath\"><code>shell.showItemInFolder(fullPath)</code></a></h3>\n<ul>\n<li><code>fullPath</code> String</li>\n</ul>\n<p>Show the given file in a file manager. If possible, select the file.</p>\n<h3 id=\"shellopenpathpath\"><a href=\"#shellopenpathpath\"><code>shell.openPath(path)</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - Resolves with a string containing the error message corresponding to the failure if a failure occurred, otherwise \"\".</p>\n<p>Open the given file in the desktop's default manner.</p>\n<h3 id=\"shellopenexternalurl-options\"><a href=\"#shellopenexternalurl-options\"><code>shell.openExternal(url[, options])</code></a></h3>\n<ul>\n<li><code>url</code> String - Max 2081 characters on windows.</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>activate</code> Boolean (optional) <em>macOS</em> - <code>true</code> to bring the opened application to the foreground. The default is <code>true</code>.</li>\n<li><code>workingDirectory</code> String (optional) <em>Windows</em> - The working directory.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code></p>\n<p>Open the given external protocol URL in the desktop's default manner. (For example, mailto: URLs in the user's default mail agent).</p>\n<h3 id=\"shelltrashitempath\"><a href=\"#shelltrashitempath\"><code>shell.trashItem(path)</code></a></h3>\n<ul>\n<li><code>path</code> String - path to the item to be moved to the trash.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the operation has been completed.\nRejects if there was an error while deleting the requested item.</p>\n<p>This moves a path to the OS-specific trash location (Trash on macOS, Recycle\nBin on Windows, and a desktop-environment-specific location on Linux).</p>\n<h3 id=\"shellbeep\"><a href=\"#shellbeep\"><code>shell.beep()</code></a></h3>\n<p>Play the beep sound.</p>\n<h3 id=\"shellwriteshortcutlinkshortcutpath-operation-options-windows\"><a href=\"#shellwriteshortcutlinkshortcutpath-operation-options-windows\"><code>shell.writeShortcutLink(shortcutPath[, operation], options)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>shortcutPath</code> String</li>\n<li><code>operation</code> String (optional) - Default is <code>create</code>, can be one of following:<ul>\n<li><code>create</code> - Creates a new shortcut, overwriting if necessary.</li>\n<li><code>update</code> - Updates specified properties only on an existing shortcut.</li>\n<li><code>replace</code> - Overwrites an existing shortcut, fails if the shortcut doesn't\nexist.</li>\n</ul></li>\n<li><code>options</code> <a href=\"/docs/api/structures/shortcut-details\">ShortcutDetails</a></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the shortcut was created successfully.</p>\n<p>Creates or updates a shortcut link at <code>shortcutPath</code>.</p>\n<h3 id=\"shellreadshortcutlinkshortcutpath-windows\"><a href=\"#shellreadshortcutlinkshortcutpath-windows\"><code>shell.readShortcutLink(shortcutPath)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>shortcutPath</code> String</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/shortcut-details\"><code>ShortcutDetails</code></a></p>\n<p>Resolves the shortcut link at <code>shortcutPath</code>.</p>\n<p>An exception will be thrown when any error happens.</p>",
      "title": "shell",
      "description": "Manage files and URLs using their default applications."
    },
    "/docs/api/structures/shortcut-details": {
      "locale": "en-US",
      "slug": "shortcut-details",
      "href": "/docs/api/structures/shortcut-details",
      "crowdinFileId": "256509",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/shortcut-details.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"shortcutdetails-object\"><a href=\"#shortcutdetails-object\">ShortcutDetails Object</a></h1>\n<ul>\n<li><code>target</code> String - The target to launch from this shortcut.</li>\n<li><code>cwd</code> String (optional) - The working directory. Default is empty.</li>\n<li><code>args</code> String (optional) - The arguments to be applied to <code>target</code> when\nlaunching from this shortcut. Default is empty.</li>\n<li><code>description</code> String (optional) - The description of the shortcut. Default\nis empty.</li>\n<li><code>icon</code> String (optional) - The path to the icon, can be a DLL or EXE. <code>icon</code>\nand <code>iconIndex</code> have to be set together. Default is empty, which uses the\ntarget's icon.</li>\n<li><code>iconIndex</code> Number (optional) - The resource ID of icon when <code>icon</code> is a\nDLL or EXE. Default is 0.</li>\n<li><code>appUserModelId</code> String (optional) - The Application User Model ID. Default\nis empty.</li>\n<li><code>toastActivatorClsid</code> String (optional) - The Application Toast Activator CLSID. Needed\nfor participating in Action Center.</li>\n</ul>",
      "title": "ShortcutDetails Object",
      "description": ""
    },
    "/docs/api/structures/size": {
      "locale": "en-US",
      "slug": "size",
      "href": "/docs/api/structures/size",
      "crowdinFileId": "256511",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/size.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"size-object\"><a href=\"#size-object\">Size Object</a></h1>\n<ul>\n<li><code>width</code> Number</li>\n<li><code>height</code> Number</li>\n</ul>",
      "title": "Size Object",
      "description": ""
    },
    "/docs/tutorial/snapcraft": {
      "locale": "en-US",
      "slug": "snapcraft",
      "href": "/docs/tutorial/snapcraft",
      "crowdinFileId": "256249",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/snapcraft.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"snapcraft-guide-linux\"><a href=\"#snapcraft-guide-linux\">Snapcraft Guide (Linux)</a></h1>\n<p>This guide provides information on how to package your Electron application\nfor any Snapcraft environment, including the Ubuntu Software Center.</p>\n<h2 id=\"background-and-requirements\"><a href=\"#background-and-requirements\">Background and Requirements</a></h2>\n<p>Together with the broader Linux community, Canonical aims to fix many of the\ncommon software installation problems with the <a href=\"https://snapcraft.io/\"><code>snapcraft</code></a>\nproject. Snaps are containerized software packages that include required\ndependencies, auto-update, and work on all major Linux distributions without\nsystem modification.</p>\n<p>There are three ways to create a <code>.snap</code> file:</p>\n<p>1) Using <a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a> or\n<a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a>, both tools that come with <code>snap</code>\nsupport out of the box. This is the easiest option.\n2) Using <code>electron-installer-snap</code>, which takes <code>electron-packager</code>'s output.\n3) Using an already created <code>.deb</code> package.</p>\n<p>In some cases, you will need to have the <code>snapcraft</code> tool installed.\nInstructions to install <code>snapcraft</code> for your particular distribution are\navailable <a href=\"https://snapcraft.io/docs/installing-snapcraft\">here</a>.</p>\n<h2 id=\"using-electron-installer-snap\"><a href=\"#using-electron-installer-snap\">Using <code>electron-installer-snap</code></a></h2>\n<p>The module works like <a href=\"https://github.com/electron/windows-installer\"><code>electron-winstaller</code></a> and similar\nmodules in that its scope is limited to building snap packages. You can install\nit with:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron-installer-snap\n</code></pre>\n<h3 id=\"step-1-package-your-electron-application\"><a href=\"#step-1-package-your-electron-application\">Step 1: Package Your Electron Application</a></h3>\n<p>Package the application using <a href=\"https://github.com/electron/electron-packager\">electron-packager</a> (or a\nsimilar tool). Make sure to remove <code>node_modules</code> that you don't need in your\nfinal application, since any module you don't actually need will increase\nyour application's size.</p>\n<p>The output should look roughly like this:</p>\n<pre><code class=\"hljs language-plaintext\">.\n└── dist\n    └── app-linux-x64\n        ├── LICENSE\n        ├── LICENSES.chromium.html\n        ├── content_shell.pak\n        ├── app\n        ├── icudtl.dat\n        ├── libgcrypt.so.11\n        ├── libnode.so\n        ├── locales\n        ├── resources\n        ├── v8_context_snapshot.bin\n        └── version\n</code></pre>\n<h3 id=\"step-2-running-electron-installer-snap\"><a href=\"#step-2-running-electron-installer-snap\">Step 2: Running <code>electron-installer-snap</code></a></h3>\n<p>From a terminal that has <code>snapcraft</code> in its <code>PATH</code>, run <code>electron-installer-snap</code>\nwith the only required parameter <code>--src</code>, which is the location of your packaged\nElectron application created in the first step.</p>\n<pre><code class=\"hljs language-sh\">npx electron-installer-snap --src=out/myappname-linux-x64\n</code></pre>\n<p>If you have an existing build pipeline, you can use <code>electron-installer-snap</code>\nprogrammatically. For more information, see the <a href=\"https://docs.snapcraft.io/build-snaps/syntax\">Snapcraft API docs</a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> snap = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-installer-snap'</span>)\n\nsnap(options)\n  .then(<span class=\"hljs-function\"><span class=\"hljs-params\">snapPath</span> =></span> <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Created snap at <span class=\"hljs-subst\">${snapPath}</span>!`</span>))\n</code></pre>\n<h2 id=\"using-snapcraft-with-electron-packager\"><a href=\"#using-snapcraft-with-electron-packager\">Using <code>snapcraft</code> with <code>electron-packager</code></a></h2>\n<h3 id=\"step-1-create-sample-snapcraft-project\"><a href=\"#step-1-create-sample-snapcraft-project\">Step 1: Create Sample Snapcraft Project</a></h3>\n<p>Create your project directory and add the following to <code>snap/snapcraft.yaml</code>:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">electron-packager-hello-world</span>\n<span class=\"hljs-attr\">version:</span> <span class=\"hljs-string\">'0.1'</span>\n<span class=\"hljs-attr\">summary:</span> <span class=\"hljs-string\">Hello</span> <span class=\"hljs-string\">World</span> <span class=\"hljs-string\">Electron</span> <span class=\"hljs-string\">app</span>\n<span class=\"hljs-attr\">description:</span> <span class=\"hljs-string\">|\n  Simple Hello World Electron app as an example\n</span><span class=\"hljs-attr\">base:</span> <span class=\"hljs-string\">core18</span>\n<span class=\"hljs-attr\">confinement:</span> <span class=\"hljs-string\">strict</span>\n<span class=\"hljs-attr\">grade:</span> <span class=\"hljs-string\">stable</span>\n\n<span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">electron-packager-hello-world:</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">electron-quick-start/electron-quick-start</span> <span class=\"hljs-string\">--no-sandbox</span>\n    <span class=\"hljs-attr\">extensions:</span> <span class=\"hljs-string\">[gnome-3-34]</span>\n    <span class=\"hljs-attr\">plugs:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">browser-support</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">network</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">network-bind</span>\n    <span class=\"hljs-attr\">environment:</span>\n      <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n      <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n      <span class=\"hljs-attr\">TMPDIR:</span> <span class=\"hljs-string\">$XDG_RUNTIME_DIR</span>\n\n<span class=\"hljs-attr\">parts:</span>\n  <span class=\"hljs-attr\">electron-quick-start:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">nil</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">https://github.com/electron/electron-quick-start.git</span>\n    <span class=\"hljs-attr\">override-build:</span> <span class=\"hljs-string\">|\n        npm install electron electron-packager\n        npx electron-packager . --overwrite --platform=linux --output=release-build --prune=true\n        cp -rv ./electron-quick-start-linux-* $SNAPCRAFT_PART_INSTALL/electron-quick-start\n</span>    <span class=\"hljs-attr\">build-snaps:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">node/14/stable</span>\n    <span class=\"hljs-attr\">build-packages:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">unzip</span>\n    <span class=\"hljs-attr\">stage-packages:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnss3</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnspr4</span>\n</code></pre>\n<p>If you want to apply this example to an existing project:</p>\n<ul>\n<li>Replace <code>source: https://github.com/electron/electron-quick-start.git</code> with <code>source: .</code>.</li>\n<li>Replace all instances of <code>electron-quick-start</code> with your project's name.</li>\n</ul>\n<h3 id=\"step-2-build-the-snap\"><a href=\"#step-2-build-the-snap\">Step 2: Build the snap</a></h3>\n<pre><code class=\"hljs language-sh\">$ snapcraft\n\n&#x3C;output snipped>\nSnapped electron-packager-hello-world_0.1_amd64.snap\n</code></pre>\n<h3 id=\"step-3-install-the-snap\"><a href=\"#step-3-install-the-snap\">Step 3: Install the snap</a></h3>\n<pre><code class=\"hljs language-sh\">sudo snap install electron-packager-hello-world_0.1_amd64.snap --dangerous\n</code></pre>\n<h3 id=\"step-4-run-the-snap\"><a href=\"#step-4-run-the-snap\">Step 4: Run the snap</a></h3>\n<pre><code class=\"hljs language-sh\">electron-packager-hello-world\n</code></pre>\n<h2 id=\"using-an-existing-debian-package\"><a href=\"#using-an-existing-debian-package\">Using an Existing Debian Package</a></h2>\n<p>Snapcraft is capable of taking an existing <code>.deb</code> file and turning it into\na <code>.snap</code> file. The creation of a snap is configured using a <code>snapcraft.yaml</code>\nfile that describes the sources, dependencies, description, and other core\nbuilding blocks.</p>\n<h3 id=\"step-1-create-a-debian-package\"><a href=\"#step-1-create-a-debian-package\">Step 1: Create a Debian Package</a></h3>\n<p>If you do not already have a <code>.deb</code> package, using <code>electron-installer-snap</code>\nmight be an easier path to create snap packages. However, multiple solutions\nfor creating Debian packages exist, including <a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a>,\n<a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> or\n<a href=\"https://github.com/unindented/electron-installer-debian\"><code>electron-installer-debian</code></a>.</p>\n<h3 id=\"step-2-create-a-snapcraftyaml\"><a href=\"#step-2-create-a-snapcraftyaml\">Step 2: Create a snapcraft.yaml</a></h3>\n<p>For more information on the available configuration options, see the\n<a href=\"https://docs.snapcraft.io/build-snaps/syntax\">documentation on the snapcraft syntax</a>.\nLet's look at an example:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">myApp</span>\n<span class=\"hljs-attr\">version:</span> <span class=\"hljs-string\">'2.0.0'</span>\n<span class=\"hljs-attr\">summary:</span> <span class=\"hljs-string\">A</span> <span class=\"hljs-string\">little</span> <span class=\"hljs-string\">description</span> <span class=\"hljs-string\">for</span> <span class=\"hljs-string\">the</span> <span class=\"hljs-string\">app.</span>\n<span class=\"hljs-attr\">description:</span> <span class=\"hljs-string\">|\n You know what? This app is amazing! It does all the things\n for you. Some say it keeps you young, maybe even happy.\n</span>\n<span class=\"hljs-attr\">grade:</span> <span class=\"hljs-string\">stable</span>\n<span class=\"hljs-attr\">confinement:</span> <span class=\"hljs-string\">classic</span>\n\n<span class=\"hljs-attr\">parts:</span>\n  <span class=\"hljs-attr\">slack:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">dump</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">my-deb.deb</span>\n    <span class=\"hljs-attr\">source-type:</span> <span class=\"hljs-string\">deb</span>\n    <span class=\"hljs-attr\">after:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">desktop-gtk3</span>\n    <span class=\"hljs-attr\">stage-packages:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libasound2</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnotify4</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnspr4</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnss3</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libpcre3</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libpulse0</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libxss1</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libxtst6</span>\n  <span class=\"hljs-attr\">electron-launch:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">dump</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">files/</span>\n    <span class=\"hljs-attr\">prepare:</span> <span class=\"hljs-string\">|\n      chmod +x bin/electron-launch\n</span>\n<span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">myApp:</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">bin/electron-launch</span> <span class=\"hljs-string\">$SNAP/usr/lib/myApp/myApp</span>\n    <span class=\"hljs-attr\">desktop:</span> <span class=\"hljs-string\">usr/share/applications/myApp.desktop</span>\n    <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n    <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n    <span class=\"hljs-attr\">environment:</span>\n      <span class=\"hljs-attr\">TMPDIR:</span> <span class=\"hljs-string\">$XDG_RUNTIME_DIR</span>\n</code></pre>\n<p>As you can see, the <code>snapcraft.yaml</code> instructs the system to launch a file\ncalled <code>electron-launch</code>. In this example, it passes information on to the\napp's binary:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-meta\">#!/bin/sh\n</span>\n<span class=\"hljs-built_in\">exec</span> <span class=\"hljs-string\">\"<span class=\"hljs-variable\">$@</span>\"</span> --executed-from=<span class=\"hljs-string\">\"<span class=\"hljs-variable\">$(pwd)</span>\"</span> --pid=$$ > /dev/null 2>&#x26;1 &#x26;\n</code></pre>\n<p>Alternatively, if you're building your <code>snap</code> with <code>strict</code> confinement, you\ncan use the <code>desktop-launch</code> command:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">myApp:</span>\n    <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n    <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">env</span> <span class=\"hljs-string\">TMPDIR=$XDG_RUNTIME_DIR</span> <span class=\"hljs-string\">PATH=/usr/local/bin:${PATH}</span> <span class=\"hljs-string\">${SNAP}/bin/desktop-launch</span> <span class=\"hljs-string\">$SNAP/myApp/desktop</span>\n    <span class=\"hljs-attr\">desktop:</span> <span class=\"hljs-string\">usr/share/applications/desktop.desktop</span>\n</code></pre>",
      "title": "Snapcraft Guide (Linux)",
      "description": ""
    },
    "/docs/development/source-code-directory-structure": {
      "locale": "en-US",
      "slug": "source-code-directory-structure",
      "href": "/docs/development/source-code-directory-structure",
      "crowdinFileId": "256167",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/source-code-directory-structure.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"source-code-directory-structure\"><a href=\"#source-code-directory-structure\">Source Code Directory Structure</a></h1>\n<p>The source code of Electron is separated into a few parts, mostly\nfollowing Chromium on the separation conventions.</p>\n<p>You may need to become familiar with <a href=\"https://dev.chromium.org/developers/design-documents/multi-process-architecture\">Chromium's multi-process\narchitecture</a>\nto understand the source code better.</p>\n<h2 id=\"structure-of-source-code\"><a href=\"#structure-of-source-code\">Structure of Source Code</a></h2>\n<pre><code class=\"hljs language-diff\">Electron\n├── build/ - Build configuration files needed to build with GN.\n├── buildflags/ - Determines the set of features that can be conditionally built.\n├── chromium_src/ - Source code copied from Chromium that isn't part of the content layer.\n├── default_app/ - A default app run when Electron is started without\n|                  providing a consumer app.\n├── docs/ - Electron's documentation.\n|   ├── api/ - Documentation for Electron's externally-facing modules and APIs.\n|   ├── development/ - Documentation to aid in developing for and with Electron.\n|   ├── fiddles/ - A set of code snippets one can run in Electron Fiddle.\n|   ├── images/ - Images used in documentation.\n|   └── tutorial/ - Tutorial documents for various aspects of Electron.\n├── lib/ - JavaScript/TypeScript source code.\n|   ├── browser/ - Main process initialization code.\n|   |   ├── api/ - API implementation for main process modules.\n|   |   └── remote/ - Code related to the remote module as it is\n|   |                 used in the main process.\n|   ├── common/ - Relating to logic needed by both main and renderer processes.\n|   |   └── api/ - API implementation for modules that can be used in\n|   |              both the main and renderer processes\n|   ├── isolated_renderer/ - Handles creation of isolated renderer processes when\n|   |                        contextIsolation is enabled.\n|   ├── renderer/ - Renderer process initialization code.\n|   |   ├── api/ - API implementation for renderer process modules.\n|   |   ├── extension/ - Code related to use of Chrome Extensions\n|   |   |                in Electron's renderer process.\n|   |   ├── remote/ - Logic that handles use of the remote module in\n|   |   |             the main process.\n|   |   └── web-view/ - Logic that handles the use of webviews in the\n|   |                   renderer process.\n|   ├── sandboxed_renderer/ - Logic that handles creation of sandboxed renderer\n|   |   |                     processes.\n|   |   └── api/ - API implementation for sandboxed renderer processes.\n|   └── worker/ - Logic that handles proper functionality of Node.js\n|                 environments in Web Workers.\n├── patches/ - Patches applied on top of Electron's core dependencies\n|   |          in order to handle differences between our use cases and\n|   |          default functionality.\n|   ├── boringssl/ - Patches applied to Google's fork of OpenSSL, BoringSSL.\n|   ├── chromium/ - Patches applied to Chromium.\n|   ├── node/ - Patches applied on top of Node.js.\n|   └── v8/ - Patches applied on top of Google's V8 engine.\n├── shell/ - C++ source code.\n|   ├── app/ - System entry code.\n|   ├── browser/ - The frontend including the main window, UI, and all of the\n|   |   |          main process things. This talks to the renderer to manage web\n|   |   |          pages.\n|   |   ├── ui/ - Implementation of UI stuff for different platforms.\n|   |   |   ├── cocoa/ - Cocoa specific source code.\n|   |   |   ├── win/ - Windows GUI specific source code.\n|   |   |   └── x/ - X11 specific source code.\n|   |   ├── api/ - The implementation of the main process APIs.\n|   |   ├── net/ - Network related code.\n|   |   ├── mac/ - Mac specific Objective-C source code.\n|   |   └── resources/ - Icons, platform-dependent files, etc.\n|   ├── renderer/ - Code that runs in renderer process.\n|   |   └── api/ - The implementation of renderer process APIs.\n|   └── common/ - Code that used by both the main and renderer processes,\n|       |         including some utility functions and code to integrate node's\n|       |         message loop into Chromium's message loop.\n|       └── api/ - The implementation of common APIs, and foundations of\n|                  Electron's built-in modules.\n├── spec/ - Components of Electron's test suite run in the renderer process.\n├── spec-main/ - Components of Electron's test suite run in the main process.\n└── BUILD.gn - Building rules of Electron.\n</code></pre>\n<h2 id=\"structure-of-other-directories\"><a href=\"#structure-of-other-directories\">Structure of Other Directories</a></h2>\n<ul>\n<li><strong>.circleci</strong> - Config file for CI with CircleCI.</li>\n<li><strong>.github</strong> - GitHub-specific config files including issues templates and CODEOWNERS.</li>\n<li><strong>dist</strong> - Temporary directory created by <code>script/create-dist.py</code> script\nwhen creating a distribution.</li>\n<li><strong>node_modules</strong> - Third party node modules used for building.</li>\n<li><strong>npm</strong> - Logic for installation of Electron via npm.</li>\n<li><strong>out</strong> - Temporary output directory of <code>ninja</code>.</li>\n<li><strong>script</strong> - Scripts used for development purpose like building, packaging,\ntesting, etc.</li>\n</ul>\n<pre><code class=\"hljs language-diff\">script/ - The set of all scripts Electron runs for a variety of purposes.\n├── codesign/ - Fakes codesigning for Electron apps; used for testing.\n├── lib/ - Miscellaneous python utility scripts.\n└── release/ - Scripts run during Electron's release process.\n    ├── notes/ - Generates release notes for new Electron versions.\n    └── uploaders/ - Uploads various release-related files during release.\n</code></pre>\n<ul>\n<li><strong>typings</strong> - TypeScript typings for Electron's internal code.</li>\n</ul>",
      "title": "Source Code Directory Structure",
      "description": ""
    },
    "/docs/tutorial/spellchecker": {
      "locale": "en-US",
      "slug": "spellchecker",
      "href": "/docs/tutorial/spellchecker",
      "crowdinFileId": "256251",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/spellchecker.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"spellchecker\"><a href=\"#spellchecker\">SpellChecker</a></h1>\n<p>Electron has built-in support for Chromium's spellchecker since Electron 8.  On Windows and Linux this is powered by Hunspell dictionaries, and on macOS it makes use of the native spellchecker APIs.</p>\n<h2 id=\"how-to-enable-the-spellchecker\"><a href=\"#how-to-enable-the-spellchecker\">How to enable the spellchecker?</a></h2>\n<p>For Electron 9 and higher the spellchecker is enabled by default.  For Electron 8 you need to enable it in <code>webPreferences</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> myWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">spellcheck</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h2 id=\"how-to-set-the-languages-the-spellchecker-uses\"><a href=\"#how-to-set-the-languages-the-spellchecker-uses\">How to set the languages the spellchecker uses?</a></h2>\n<p>On macOS as we use the native APIs there is no way to set the language that the spellchecker uses. By default on macOS the native spellchecker will automatically detect the language being used for you.</p>\n<p>For Windows and Linux there are a few Electron APIs you should use to set the languages for the spellchecker.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Sets the spellchecker to check English US and French</span>\nmyWindow.session.setSpellCheckerLanguages([<span class=\"hljs-string\">'en-US'</span>, <span class=\"hljs-string\">'fr'</span>])\n\n<span class=\"hljs-comment\">// An array of all available language codes</span>\n<span class=\"hljs-keyword\">const</span> possibleLanguages = myWindow.session.availableSpellCheckerLanguages\n</code></pre>\n<p>By default the spellchecker will enable the language matching the current OS locale.</p>\n<h2 id=\"how-do-i-put-the-results-of-the-spellchecker-in-my-context-menu\"><a href=\"#how-do-i-put-the-results-of-the-spellchecker-in-my-context-menu\">How do I put the results of the spellchecker in my context menu?</a></h2>\n<p>All the required information to generate a context menu is provided in the <a href=\"/docs/api/web-contents#event-context-menu\"><code>context-menu</code></a> event on each <code>webContents</code> instance.  A small example\nof how to make a context menu with this information is provided below.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { Menu, MenuItem } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nmyWindow.webContents.on(<span class=\"hljs-string\">'context-menu'</span>, (event, params) => {\n  <span class=\"hljs-keyword\">const</span> menu = <span class=\"hljs-keyword\">new</span> Menu()\n\n  <span class=\"hljs-comment\">// Add each spelling suggestion</span>\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> suggestion <span class=\"hljs-keyword\">of</span> params.dictionarySuggestions) {\n    menu.append(<span class=\"hljs-keyword\">new</span> MenuItem({\n      <span class=\"hljs-attr\">label</span>: suggestion,\n      <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> mainWindow.webContents.replaceMisspelling(suggestion)\n    }))\n  }\n\n  <span class=\"hljs-comment\">// Allow users to add the misspelled word to the dictionary</span>\n  <span class=\"hljs-keyword\">if</span> (params.misspelledWord) {\n    menu.append(\n      <span class=\"hljs-keyword\">new</span> MenuItem({\n        <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Add to dictionary'</span>,\n        <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> mainWindow.webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord)\n      })\n    )\n  }\n\n  menu.popup()\n})\n</code></pre>\n<h2 id=\"does-the-spellchecker-use-any-google-services\"><a href=\"#does-the-spellchecker-use-any-google-services\">Does the spellchecker use any Google services?</a></h2>\n<p>Although the spellchecker itself does not send any typings, words or user input to Google services the hunspell dictionary files are downloaded from a Google CDN by default.  If you want to avoid this you can provide an alternative URL to download the dictionaries from.</p>\n<pre><code class=\"hljs language-js\">myWindow.session.setSpellCheckerDictionaryDownloadURL(<span class=\"hljs-string\">'https://example.com/dictionaries/'</span>)\n</code></pre>\n<p>Check out the docs for <a href=\"/docs/api/session#sessetspellcheckerdictionarydownloadurlurl\"><code>session.setSpellCheckerDictionaryDownloadURL</code></a> for more information on where to get the dictionary files from and how you need to host them.</p>",
      "title": "SpellChecker",
      "description": ""
    },
    "/docs/styleguide": {
      "locale": "en-US",
      "slug": "styleguide",
      "href": "/docs/styleguide",
      "crowdinFileId": "256125",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/styleguide.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-documentation-style-guide\"><a href=\"#electron-documentation-style-guide\">Electron Documentation Style Guide</a></h1>\n<p>These are the guidelines for writing Electron documentation.</p>\n<h2 id=\"headings\"><a href=\"#headings\">Headings</a></h2>\n<ul>\n<li>Each page must have a single <code>#</code>-level title at the top.</li>\n<li>Chapters in the same page must have <code>##</code>-level headings.</li>\n<li>Sub-chapters need to increase the number of <code>#</code> in the heading according to\ntheir nesting depth.</li>\n<li>The page's title must follow <a href=\"https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case\">APA title case</a>.</li>\n<li>All chapters must follow <a href=\"https://apastyle.apa.org/style-grammar-guidelines/capitalization/sentence-case\">APA sentence case</a>.</li>\n</ul>\n<p>Using <code>Quick Start</code> as example:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># Quick Start</span>\n\n...\n\n<span class=\"hljs-section\">## Main process</span>\n\n...\n\n<span class=\"hljs-section\">## Renderer process</span>\n\n...\n\n<span class=\"hljs-section\">## Run your app</span>\n\n...\n\n<span class=\"hljs-section\">### Run as a distribution</span>\n\n...\n\n<span class=\"hljs-section\">### Manually downloaded Electron binary</span>\n\n...\n</code></pre>\n<p>For API references, there are exceptions to this rule.</p>\n<h2 id=\"markdown-rules\"><a href=\"#markdown-rules\">Markdown rules</a></h2>\n<p>This repository uses the <a href=\"https://github.com/DavidAnson/markdownlint\"><code>markdownlint</code></a> package to enforce consistent\nMarkdown styling. For the exact rules, see the <code>.markdownlint.json</code> file in the root\nfolder.</p>\n<p>There are a few style guidelines that aren't covered by the linter rules:</p>\n<!--TODO(erickzhao): make sure this matches with the lint:markdownlint task-->\n<ul>\n<li>Use <code>sh</code> instead of <code>cmd</code> in code blocks (due to the syntax highlighter).</li>\n<li>Keep line lengths between 80 and 100 characters if possible for readability\npurposes.</li>\n<li>No nesting lists more than 2 levels (due to the markdown renderer).</li>\n<li>All <code>js</code> and <code>javascript</code> code blocks are linted with\n<a href=\"https://www.npmjs.com/package/standard-markdown\">standard-markdown</a>.</li>\n<li>For unordered lists, use asterisks instead of dashes.</li>\n</ul>\n<h2 id=\"picking-words\"><a href=\"#picking-words\">Picking words</a></h2>\n<ul>\n<li>Use \"will\" over \"would\" when describing outcomes.</li>\n<li>Prefer \"in the ___ process\" over \"on\".</li>\n</ul>\n<h2 id=\"api-references\"><a href=\"#api-references\">API references</a></h2>\n<p>The following rules only apply to the documentation of APIs.</p>\n<h3 id=\"title-and-description\"><a href=\"#title-and-description\">Title and description</a></h3>\n<p>Each module's API doc must use the actual object name returned by <code>require('electron')</code>\nas its title (such as <code>BrowserWindow</code>, <code>autoUpdater</code>, and <code>session</code>).</p>\n<p>Directly under the page title, add a one-line description of the module\nas a markdown quote (beginning with <code>></code>).</p>\n<p>Using the <code>session</code> module as an example:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># session</span>\n\n<span class=\"hljs-quote\">> Manage browser sessions, cookies, cache, proxy settings, etc.</span>\n</code></pre>\n<h3 id=\"module-methods-and-events\"><a href=\"#module-methods-and-events\">Module methods and events</a></h3>\n<p>For modules that are not classes, their methods and events must be listed under\nthe <code>## Methods</code> and <code>## Events</code> chapters.</p>\n<p>Using <code>autoUpdater</code> as an example:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># autoUpdater</span>\n\n<span class=\"hljs-section\">## Events</span>\n\n<span class=\"hljs-section\">### Event: 'error'</span>\n\n<span class=\"hljs-section\">## Methods</span>\n\n<span class=\"hljs-section\">### `autoUpdater.setFeedURL(url[, requestHeaders])`</span>\n</code></pre>\n<h3 id=\"classes\"><a href=\"#classes\">Classes</a></h3>\n<ul>\n<li>API classes or classes that are part of modules must be listed under a\n<code>## Class: TheClassName</code> chapter.</li>\n<li>One page can have multiple classes.</li>\n<li>Constructors must be listed with <code>###</code>-level headings.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static\">Static Methods</a>\nmust be listed under a <code>### Static Methods</code> chapter.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Prototype_methods\">Instance Methods</a>\nmust be listed under an <code>### Instance Methods</code> chapter.</li>\n<li>All methods that have a return value must start their description with\n\"Returns <code>[TYPE]</code> - [Return description]\"<ul>\n<li>If the method returns an <code>Object</code>, its structure can be specified using a colon\nfollowed by a newline then an unordered list of properties in the same style as\nfunction parameters.</li>\n</ul></li>\n<li>Instance Events must be listed under an <code>### Instance Events</code> chapter.</li>\n<li>Instance Properties must be listed under an <code>### Instance Properties</code> chapter.<ul>\n<li>Instance Properties must start with \"A [Property Type] ...\"</li>\n</ul></li>\n</ul>\n<p>Using the <code>Session</code> and <code>Cookies</code> classes as an example:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># session</span>\n\n<span class=\"hljs-section\">## Methods</span>\n\n<span class=\"hljs-section\">### session.fromPartition(partition)</span>\n\n<span class=\"hljs-section\">## Static Properties</span>\n\n<span class=\"hljs-section\">### session.defaultSession</span>\n\n<span class=\"hljs-section\">## Class: Session</span>\n\n<span class=\"hljs-section\">### Instance Events</span>\n\n<span class=\"hljs-section\">#### Event: 'will-download'</span>\n\n<span class=\"hljs-section\">### Instance Methods</span>\n\n<span class=\"hljs-section\">#### `ses.getCacheSize()`</span>\n\n<span class=\"hljs-section\">### Instance Properties</span>\n\n<span class=\"hljs-section\">#### `ses.cookies`</span>\n\n<span class=\"hljs-section\">## Class: Cookies</span>\n\n<span class=\"hljs-section\">### Instance Methods</span>\n\n<span class=\"hljs-section\">#### `cookies.get(filter, callback)`</span>\n</code></pre>\n<h3 id=\"methods-and-their-arguments\"><a href=\"#methods-and-their-arguments\">Methods and their arguments</a></h3>\n<p>The methods chapter must be in the following form:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### `objectName.methodName(required[, optional]))`</span>\n<span class=\"hljs-bullet\">\n* </span><span class=\"hljs-code\">`required`</span> String - A parameter description.\n<span class=\"hljs-bullet\">* </span><span class=\"hljs-code\">`optional`</span> Integer (optional) - Another parameter description.\n\n...\n</code></pre>\n<h4 id=\"heading-level\"><a href=\"#heading-level\">Heading level</a></h4>\n<p>The heading can be <code>###</code> or <code>####</code>-levels depending on whether the method\nbelongs to a module or a class.</p>\n<h4 id=\"function-signature\"><a href=\"#function-signature\">Function signature</a></h4>\n<p>For modules, the <code>objectName</code> is the module's name. For classes, it must be the\nname of the instance of the class, and must not be the same as the module's\nname.</p>\n<p>For example, the methods of the <code>Session</code> class under the <code>session</code> module must\nuse <code>ses</code> as the <code>objectName</code>.</p>\n<p>Optional arguments are notated by square brackets <code>[]</code> surrounding the optional\nargument as well as the comma required if this optional argument follows another\nargument:</p>\n<pre><code class=\"hljs language-markdown\">required[, optional]\n</code></pre>\n<h4 id=\"argument-descriptions\"><a href=\"#argument-descriptions\">Argument descriptions</a></h4>\n<p>More detailed information on each of the arguments is noted in an unordered list\nbelow the method. The type of argument is notated by either JavaScript primitives\n(e.g. <code>String</code>, <code>Promise</code>, or <code>Object</code>), a custom API structure like Electron's\n<a href=\"/docs/api/structures/cookie\"><code>Cookie</code></a>, or the wildcard <code>any</code>.</p>\n<p>If the argument is of type <code>Array</code>, use <code>[]</code> shorthand with the type of value\ninside the array (for example,<code>any[]</code> or <code>String[]</code>).</p>\n<p>If the argument is of type <code>Promise</code>, parametrize the type with what the promise\nresolves to (for example, <code>Promise&#x3C;void></code> or <code>Promise&#x3C;String></code>).</p>\n<p>If an argument can be of multiple types, separate the types with <code>|</code>.</p>\n<p>The description for <code>Function</code> type arguments should make it clear how it may be\ncalled and list the types of the parameters that will be passed to it.</p>\n<h4 id=\"platform-specific-functionality\"><a href=\"#platform-specific-functionality\">Platform-specific functionality</a></h4>\n<p>If an argument or a method is unique to certain platforms, those platforms are\ndenoted using a space-delimited italicized list following the datatype. Values\ncan be <code>macOS</code>, <code>Windows</code> or <code>Linux</code>.</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-bullet\">* </span><span class=\"hljs-code\">`animate`</span> Boolean (optional) <span class=\"hljs-emphasis\">_macOS_</span> <span class=\"hljs-emphasis\">_Windows_</span> - Animate the thing.\n</code></pre>\n<h3 id=\"events\"><a href=\"#events\">Events</a></h3>\n<p>The events chapter must be in following form:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### Event: 'wake-up'</span>\n\nReturns:\n<span class=\"hljs-bullet\">\n* </span><span class=\"hljs-code\">`time`</span> String\n\n...\n</code></pre>\n<p>The heading can be <code>###</code> or <code>####</code>-levels depending on whether the event\nbelongs to a module or a class.</p>\n<p>The arguments of an event follow the same rules as methods.</p>\n<h3 id=\"properties\"><a href=\"#properties\">Properties</a></h3>\n<p>The properties chapter must be in following form:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### session.defaultSession</span>\n\n...\n</code></pre>\n<p>The heading can be <code>###</code> or <code>####</code>-levels depending on whether the property\nbelongs to a module or a class.</p>\n<h2 id=\"documentation-translations\"><a href=\"#documentation-translations\">Documentation translations</a></h2>\n<p>See <a href=\"https://github.com/electron/i18n#readme\">electron/i18n</a></p>",
      "title": "Electron Documentation Style Guide",
      "description": ""
    },
    "/docs/tutorial/support": {
      "locale": "en-US",
      "slug": "support",
      "href": "/docs/tutorial/support",
      "crowdinFileId": "256253",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/support.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-support\"><a href=\"#electron-support\">Electron Support</a></h1>\n<h2 id=\"finding-support\"><a href=\"#finding-support\">Finding Support</a></h2>\n<p>If you have a security concern,\nplease see the <a href=\"https://github.com/electron/electron/tree/main/SECURITY.md\">security document</a>.</p>\n<p>If you're looking for programming help,\nfor answers to questions,\nor to join in discussion with other developers who use Electron,\nyou can interact with the community in these locations:</p>\n<ul>\n<li><a href=\"https://discord.com/invite/electron\"><code>Electron's Discord</code></a> has channels for:<ul>\n<li>Getting help</li>\n<li>Ecosystem apps like <a href=\"https://github.com/electron-userland/electron-forge\">Electron Forge</a> and <a href=\"https://github.com/electron/fiddle\">Electron Fiddle</a></li>\n<li>Sharing ideas with other Electron app developers</li>\n<li>And more!</li>\n</ul></li>\n<li><a href=\"https://discuss.atom.io/c/electron\"><code>electron</code></a> category on the Atom forums</li>\n<li><code>#electron</code> channel on <a href=\"https://discuss.atom.io/t/join-us-on-slack/16638?source_topic_id=25406\">Atom's Slack</a></li>\n<li><a href=\"https://telegram.me/electron_ru\"><code>electron-ru</code></a> <em>(Russian)</em></li>\n<li><a href=\"https://electron-br.slack.com\"><code>electron-br</code></a> <em>(Brazilian Portuguese)</em></li>\n<li><a href=\"https://electron-kr.github.io/electron-kr\"><code>electron-kr</code></a> <em>(Korean)</em></li>\n<li><a href=\"https://electron-jp.slack.com\"><code>electron-jp</code></a> <em>(Japanese)</em></li>\n<li><a href=\"https://electron-tr.herokuapp.com\"><code>electron-tr</code></a> <em>(Turkish)</em></li>\n<li><a href=\"https://electron-id.slack.com\"><code>electron-id</code></a> <em>(Indonesia)</em></li>\n<li><a href=\"https://electronpl.github.io\"><code>electron-pl</code></a> <em>(Poland)</em></li>\n</ul>\n<p>If you'd like to contribute to Electron,\nsee the <a href=\"https://github.com/electron/electron/blob/main/CONTRIBUTING.md\">contributing document</a>.</p>\n<p>If you've found a bug in a <a href=\"#supported-versions\">supported version</a> of Electron,\nplease report it with the <a href=\"/docs/development/issues\">issue tracker</a>.</p>\n<p><a href=\"https://github.com/sindresorhus/awesome-electron\">awesome-electron</a>\nis a community-maintained list of useful example apps,\ntools and resources.</p>\n<h2 id=\"supported-versions\"><a href=\"#supported-versions\">Supported Versions</a></h2>\n<p><em><strong>Note:</strong> Beginning in September 2021 with Electron 15, the Electron team\nwill temporarily support the latest <strong>four</strong> stable major versions. This\nextended support is intended to help Electron developers transition to\nthe <a href=\"https://electronjs.org/blog/8-week-cadence\">new eight week release cadence</a>, and will continue until May 2022, with\nthe release of Electron 19. At that time, the Electron team will drop support\nback to the latest three stable major versions.</em></p>\n<p>The latest three <em>stable</em> major versions are supported by the Electron team.\nFor example, if the latest release is 6.1.x, then the 5.0.x as well\nas the 4.2.x series are supported.  We only support the latest minor release\nfor each stable release series.  This means that in the case of a security fix\n6.1.x will receive the fix, but we will not release a new version of 6.0.x.</p>\n<p>The latest stable release unilaterally receives all fixes from <code>main</code>,\nand the version prior to that receives the vast majority of those fixes\nas time and bandwidth warrants. The oldest supported release line will receive\nonly security fixes directly.</p>\n<p>All supported release lines will accept external pull requests to backport\nfixes previously merged to <code>main</code>, though this may be on a case-by-case\nbasis for some older supported lines. All contested decisions around release\nline backports will be resolved by the <a href=\"https://github.com/electron/governance/tree/main/wg-releases\">Releases Working Group</a> as an agenda item at their weekly meeting the week the backport PR is raised.</p>\n<p>When an API is changed or removed in a way that breaks existing functionality, the\nprevious functionality will be supported for a minimum of two major versions when\npossible before being removed. For example, if a function takes three arguments,\nand that number is reduced to two in major version 10, the three-argument version would\ncontinue to work until, at minimum, major version 12. Past the minimum two-version\nthreshold, we will attempt to support backwards compatibility beyond two versions\nuntil the maintainers feel the maintenance burden is too high to continue doing so.</p>\n<h3 id=\"currently-supported-versions\"><a href=\"#currently-supported-versions\">Currently supported versions</a></h3>\n<ul>\n<li>15.x.y</li>\n<li>14.x.y</li>\n<li>13.x.y</li>\n<li>12</li>\n</ul>\n<h3 id=\"end-of-life\"><a href=\"#end-of-life\">End-of-life</a></h3>\n<p>When a release branch reaches the end of its support cycle, the series\nwill be deprecated in NPM and a final end-of-support release will be\nmade. This release will add a warning to inform that an unsupported\nversion of Electron is in use.</p>\n<p>These steps are to help app developers learn when a branch they're\nusing becomes unsupported, but without being excessively intrusive\nto end users.</p>\n<p>If an application has exceptional circumstances and needs to stay\non an unsupported series of Electron, developers can silence the\nend-of-support warning by omitting the final release from the app's\n<code>package.json</code> <code>devDependencies</code>. For example, since the 1-6-x series\nended with an end-of-support 1.6.18 release, developers could choose\nto stay in the 1-6-x series without warnings with <code>devDependency</code> of\n<code>\"electron\": 1.6.0 - 1.6.17</code>.</p>\n<h2 id=\"supported-platforms\"><a href=\"#supported-platforms\">Supported Platforms</a></h2>\n<p>Following platforms are supported by Electron:</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>Only 64bit binaries are provided for macOS, and the minimum macOS version\nsupported is macOS 10.11 (El Capitan).</p>\n<p>Native support for Apple Silicon (<code>arm64</code>) devices was added in Electron 11.0.0.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<p>Windows 7 and later are supported, older operating systems are not supported\n(and do not work).</p>\n<p>Both <code>ia32</code> (<code>x86</code>) and <code>x64</code> (<code>amd64</code>) binaries are provided for Windows.\n<a href=\"/docs/tutorial/windows-arm\">Native support for Windows on Arm (<code>arm64</code>) devices was added in Electron 6.0.8.</a>.\nRunning apps packaged with previous versions is possible using the ia32 binary.</p>\n<h3 id=\"linux\"><a href=\"#linux\">Linux</a></h3>\n<p>The prebuilt binaries of Electron are built on Ubuntu 18.04.</p>\n<p>Whether the prebuilt binary can run on a distribution depends on whether the\ndistribution includes the libraries that Electron is linked to on the building\nplatform, so only Ubuntu 18.04 is guaranteed to work, but following platforms\nare also verified to be able to run the prebuilt binaries of Electron:</p>\n<ul>\n<li>Ubuntu 14.04 and newer</li>\n<li>Fedora 24 and newer</li>\n<li>Debian 8 and newer</li>\n</ul>",
      "title": "Electron Support",
      "description": ""
    },
    "/docs/api/synopsis": {
      "locale": "en-US",
      "slug": "synopsis",
      "href": "/docs/api/synopsis",
      "crowdinFileId": "256371",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/synopsis.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"synopsis\"><a href=\"#synopsis\">Synopsis</a></h1>\n<blockquote>\n<p>How to use Node.js and Electron APIs.</p>\n</blockquote>\n<p>All of <a href=\"https://nodejs.org/api/\">Node.js's built-in modules</a> are available in\nElectron and third-party node modules also fully supported as well (including\nthe <a href=\"/docs/tutorial/using-native-node-modules\">native modules</a>).</p>\n<p>Electron also provides some extra built-in modules for developing native\ndesktop applications. Some modules are only available in the main process, some\nare only available in the renderer process (web page), and some can be used in\neither process type.</p>\n<p>The basic rule is: if a module is <a href=\"https://en.wikipedia.org/wiki/Graphical_user_interface\">GUI</a> or low-level system related, then\nit should be only available in the main process. You need to be familiar with\nthe concept of main process vs. renderer process\nscripts to be able to use those modules.</p>\n<p>The main process script is like a normal Node.js script:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>The renderer process is no different than a normal web page, except for the\nextra ability to use node modules if <code>nodeIntegration</code> is enabled:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  <span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n  <span class=\"hljs-built_in\">console</span>.log(fs.readFileSync(__filename, <span class=\"hljs-string\">'utf8'</span>))\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<h2 id=\"destructuring-assignment\"><a href=\"#destructuring-assignment\">Destructuring assignment</a></h2>\n<p>As of 0.37, you can use\n<a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment\">destructuring assignment</a> to make it easier to use\nbuilt-in modules.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>If you need the entire <code>electron</code> module, you can require it and then using\ndestructuring to access the individual modules from <code>electron</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> electron = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = electron\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>This is equivalent to the following code:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> electron = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> app = electron.app\n<span class=\"hljs-keyword\">const</span> BrowserWindow = electron.BrowserWindow\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>",
      "title": "Synopsis",
      "description": "How to use Node.js and Electron APIs."
    },
    "/docs/api/system-preferences": {
      "locale": "en-US",
      "slug": "system-preferences",
      "href": "/docs/api/system-preferences",
      "crowdinFileId": "256373",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/system-preferences.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"systempreferences\"><a href=\"#systempreferences\">systemPreferences</a></h1>\n<blockquote>\n<p>Get system preferences.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(systemPreferences.isDarkMode())\n</code></pre>\n<h2 id=\"events\"><a href=\"#events\">Events</a></h2>\n<p>The <code>systemPreferences</code> object emits the following events:</p>\n<h3 id=\"event-accent-color-changed-windows\"><a href=\"#event-accent-color-changed-windows\">Event: 'accent-color-changed' <em>Windows</em></a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newColor</code> String - The new RGBA color the user assigned to be their system\naccent color.</li>\n</ul>\n<h3 id=\"event-color-changed-windows\"><a href=\"#event-color-changed-windows\">Event: 'color-changed' <em>Windows</em></a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<h3 id=\"event-inverted-color-scheme-changed-windows-deprecated\"><a href=\"#event-inverted-color-scheme-changed-windows-deprecated\">Event: 'inverted-color-scheme-changed' <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>invertedColorScheme</code> Boolean - <code>true</code> if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is being used, <code>false</code> otherwise.</li>\n</ul>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#event-updated\"><code>updated</code></a> event on the <code>nativeTheme</code> module.</p>\n<h3 id=\"event-high-contrast-color-scheme-changed-windows-deprecated\"><a href=\"#event-high-contrast-color-scheme-changed-windows-deprecated\">Event: 'high-contrast-color-scheme-changed' <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>highContrastColorScheme</code> Boolean - <code>true</code> if a high contrast theme is being used, <code>false</code> otherwise.</li>\n</ul>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#event-updated\"><code>updated</code></a> event on the <code>nativeTheme</code> module.</p>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<h3 id=\"systempreferencesisdarkmode-macos-windows-deprecated\"><a href=\"#systempreferencesisdarkmode-macos-windows-deprecated\"><code>systemPreferences.isDarkMode()</code> <em>macOS</em> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Returns <code>Boolean</code> - Whether the system is in Dark Mode.</p>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#nativethemeshouldusedarkcolors-readonly\"><code>nativeTheme.shouldUseDarkColors</code></a> API.</p>\n<h3 id=\"systempreferencesisswipetrackingfromscrolleventsenabled-macos\"><a href=\"#systempreferencesisswipetrackingfromscrolleventsenabled-macos\"><code>systemPreferences.isSwipeTrackingFromScrollEventsEnabled()</code> <em>macOS</em></a></h3>\n<p>Returns <code>Boolean</code> - Whether the Swipe between pages setting is on.</p>\n<h3 id=\"systempreferencespostnotificationevent-userinfo-deliverimmediately-macos\"><a href=\"#systempreferencespostnotificationevent-userinfo-deliverimmediately-macos\"><code>systemPreferences.postNotification(event, userInfo[, deliverImmediately])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n<li><code>deliverImmediately</code> Boolean (optional) - <code>true</code> to post notifications immediately even when the subscribing app is inactive.</li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object\nthat contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencespostlocalnotificationevent-userinfo-macos\"><a href=\"#systempreferencespostlocalnotificationevent-userinfo-macos\"><code>systemPreferences.postLocalNotification(event, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object\nthat contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencespostworkspacenotificationevent-userinfo-macos\"><a href=\"#systempreferencespostworkspacenotificationevent-userinfo-macos\"><code>systemPreferences.postWorkspaceNotification(event, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object\nthat contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencessubscribenotificationevent-callback-macos\"><a href=\"#systempreferencessubscribenotificationevent-callback-macos\"><code>systemPreferences.subscribeNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> String</li>\n</ul></li>\n</ul>\n<p>Returns <code>Number</code> - The ID of this subscription</p>\n<p>Subscribes to native notifications of macOS, <code>callback</code> will be called with\n<code>callback(event, userInfo)</code> when the corresponding <code>event</code> happens. The\n<code>userInfo</code> is an Object that contains the user information dictionary sent\nalong with the notification. The <code>object</code> is the sender of the notification,\nand only supports <code>NSString</code> values for now.</p>\n<p>The <code>id</code> of the subscriber is returned, which can be used to unsubscribe the\n<code>event</code>.</p>\n<p>Under the hood this API subscribes to <code>NSDistributedNotificationCenter</code>,\nexample values of <code>event</code> are:</p>\n<ul>\n<li><code>AppleInterfaceThemeChangedNotification</code></li>\n<li><code>AppleAquaColorVariantChanged</code></li>\n<li><code>AppleColorPreferencesChangedNotification</code></li>\n<li><code>AppleShowScrollBarsSettingChanged</code></li>\n</ul>\n<h3 id=\"systempreferencessubscribelocalnotificationevent-callback-macos\"><a href=\"#systempreferencessubscribelocalnotificationevent-callback-macos\"><code>systemPreferences.subscribeLocalNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> String</li>\n</ul></li>\n</ul>\n<p>Returns <code>Number</code> - The ID of this subscription</p>\n<p>Same as <code>subscribeNotification</code>, but uses <code>NSNotificationCenter</code> for local defaults.\nThis is necessary for events such as <code>NSUserDefaultsDidChangeNotification</code>.</p>\n<h3 id=\"systempreferencessubscribeworkspacenotificationevent-callback-macos\"><a href=\"#systempreferencessubscribeworkspacenotificationevent-callback-macos\"><code>systemPreferences.subscribeWorkspaceNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> String</li>\n</ul></li>\n</ul>\n<p>Returns <code>Number</code> - The ID of this subscription</p>\n<p>Same as <code>subscribeNotification</code>, but uses <code>NSWorkspace.sharedWorkspace.notificationCenter</code>.\nThis is necessary for events such as <code>NSWorkspaceDidActivateApplicationNotification</code>.</p>\n<h3 id=\"systempreferencesunsubscribenotificationid-macos\"><a href=\"#systempreferencesunsubscribenotificationid-macos\"><code>systemPreferences.unsubscribeNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Removes the subscriber with <code>id</code>.</p>\n<h3 id=\"systempreferencesunsubscribelocalnotificationid-macos\"><a href=\"#systempreferencesunsubscribelocalnotificationid-macos\"><code>systemPreferences.unsubscribeLocalNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Same as <code>unsubscribeNotification</code>, but removes the subscriber from <code>NSNotificationCenter</code>.</p>\n<h3 id=\"systempreferencesunsubscribeworkspacenotificationid-macos\"><a href=\"#systempreferencesunsubscribeworkspacenotificationid-macos\"><code>systemPreferences.unsubscribeWorkspaceNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Same as <code>unsubscribeNotification</code>, but removes the subscriber from <code>NSWorkspace.sharedWorkspace.notificationCenter</code>.</p>\n<h3 id=\"systempreferencesregisterdefaultsdefaults-macos\"><a href=\"#systempreferencesregisterdefaultsdefaults-macos\"><code>systemPreferences.registerDefaults(defaults)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>defaults</code> Record&#x3C;String, String | Boolean | Number> - a dictionary of (<code>key: value</code>) user defaults</li>\n</ul>\n<p>Add the specified defaults to your application's <code>NSUserDefaults</code>.</p>\n<h3 id=\"systempreferencesgetuserdefaulttype-extends-keyof-userdefaulttypeskey-type-macos\"><a href=\"#systempreferencesgetuserdefaulttype-extends-keyof-userdefaulttypeskey-type-macos\"><code>systemPreferences.getUserDefault&#x3C;Type extends keyof UserDefaultTypes>(key, type)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n<li><code>type</code> Type - Can be <code>string</code>, <code>boolean</code>, <code>integer</code>, <code>float</code>, <code>double</code>,\n<code>url</code>, <code>array</code> or <code>dictionary</code>.</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/user-default-types\"><code>UserDefaultTypes[Type]</code></a> - The value of <code>key</code> in <code>NSUserDefaults</code>.</p>\n<p>Some popular <code>key</code> and <code>type</code>s are:</p>\n<ul>\n<li><code>AppleInterfaceStyle</code>: <code>string</code></li>\n<li><code>AppleAquaColorVariant</code>: <code>integer</code></li>\n<li><code>AppleHighlightColor</code>: <code>string</code></li>\n<li><code>AppleShowScrollBars</code>: <code>string</code></li>\n<li><code>NSNavRecentPlaces</code>: <code>array</code></li>\n<li><code>NSPreferredWebServices</code>: <code>dictionary</code></li>\n<li><code>NSUserDictionaryReplacementItems</code>: <code>array</code></li>\n</ul>\n<h3 id=\"systempreferencessetuserdefaultkey-type-value-macos\"><a href=\"#systempreferencessetuserdefaultkey-type-value-macos\"><code>systemPreferences.setUserDefault(key, type, value)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n<li><code>type</code> String - Can be <code>string</code>, <code>boolean</code>, <code>integer</code>, <code>float</code>, <code>double</code>, <code>url</code>, <code>array</code> or <code>dictionary</code>.</li>\n<li><code>value</code> String</li>\n</ul>\n<p>Set the value of <code>key</code> in <code>NSUserDefaults</code>.</p>\n<p>Note that <code>type</code> should match actual type of <code>value</code>. An exception is thrown\nif they don't.</p>\n<p>Some popular <code>key</code> and <code>type</code>s are:</p>\n<ul>\n<li><code>ApplePressAndHoldEnabled</code>: <code>boolean</code></li>\n</ul>\n<h3 id=\"systempreferencesremoveuserdefaultkey-macos\"><a href=\"#systempreferencesremoveuserdefaultkey-macos\"><code>systemPreferences.removeUserDefault(key)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Removes the <code>key</code> in <code>NSUserDefaults</code>. This can be used to restore the default\nor global value of a <code>key</code> previously set with <code>setUserDefault</code>.</p>\n<h3 id=\"systempreferencesisaeroglassenabled-windows\"><a href=\"#systempreferencesisaeroglassenabled-windows\"><code>systemPreferences.isAeroGlassEnabled()</code> <em>Windows</em></a></h3>\n<p>Returns <code>Boolean</code> - <code>true</code> if <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/aa969540.aspx\">DWM composition</a> (Aero Glass) is\nenabled, and <code>false</code> otherwise.</p>\n<p>An example of using it to determine if you should create a transparent window or\nnot (transparent windows won't work correctly when DWM composition is disabled):</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> browserOptions = { <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">1000</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">800</span> }\n\n<span class=\"hljs-comment\">// Make the window transparent only if the platform supports it.</span>\n<span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'win32'</span> || systemPreferences.isAeroGlassEnabled()) {\n  browserOptions.transparent = <span class=\"hljs-literal\">true</span>\n  browserOptions.frame = <span class=\"hljs-literal\">false</span>\n}\n\n<span class=\"hljs-comment\">// Create the window.</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow(browserOptions)\n\n<span class=\"hljs-comment\">// Navigate.</span>\n<span class=\"hljs-keyword\">if</span> (browserOptions.transparent) {\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/index.html`</span>)\n} <span class=\"hljs-keyword\">else</span> {\n  <span class=\"hljs-comment\">// No transparency, so we load a fallback that uses basic styles.</span>\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/fallback.html`</span>)\n}\n</code></pre>\n<h3 id=\"systempreferencesgetaccentcolor-windows-macos\"><a href=\"#systempreferencesgetaccentcolor-windows-macos\"><code>systemPreferences.getAccentColor()</code> <em>Windows</em> <em>macOS</em></a></h3>\n<p>Returns <code>String</code> - The users current system wide accent color preference in RGBA\nhexadecimal form.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> color = systemPreferences.getAccentColor() <span class=\"hljs-comment\">// `\"aabbccdd\"`</span>\n<span class=\"hljs-keyword\">const</span> red = color.substr(<span class=\"hljs-number\">0</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"aa\"</span>\n<span class=\"hljs-keyword\">const</span> green = color.substr(<span class=\"hljs-number\">2</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"bb\"</span>\n<span class=\"hljs-keyword\">const</span> blue = color.substr(<span class=\"hljs-number\">4</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"cc\"</span>\n<span class=\"hljs-keyword\">const</span> alpha = color.substr(<span class=\"hljs-number\">6</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"dd\"</span>\n</code></pre>\n<p>This API is only available on macOS 10.14 Mojave or newer.</p>\n<h3 id=\"systempreferencesgetcolorcolor-windows-macos\"><a href=\"#systempreferencesgetcolorcolor-windows-macos\"><code>systemPreferences.getColor(color)</code> <em>Windows</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>color</code> String - One of the following values:<ul>\n<li>On <strong>Windows</strong>:<ul>\n<li><code>3d-dark-shadow</code> - Dark shadow for three-dimensional display elements.</li>\n<li><code>3d-face</code> - Face color for three-dimensional display elements and for dialog\nbox backgrounds.</li>\n<li><code>3d-highlight</code> - Highlight color for three-dimensional display elements.</li>\n<li><code>3d-light</code> - Light color for three-dimensional display elements.</li>\n<li><code>3d-shadow</code> - Shadow color for three-dimensional display elements.</li>\n<li><code>active-border</code> - Active window border.</li>\n<li><code>active-caption</code> - Active window title bar. Specifies the left side color in\nthe color gradient of an active window's title bar if the gradient effect is\nenabled.</li>\n<li><code>active-caption-gradient</code> - Right side color in the color gradient of an\nactive window's title bar.</li>\n<li><code>app-workspace</code> - Background color of multiple document interface (MDI)\napplications.</li>\n<li><code>button-text</code> - Text on push buttons.</li>\n<li><code>caption-text</code> - Text in caption, size box, and scroll bar arrow box.</li>\n<li><code>desktop</code> - Desktop background color.</li>\n<li><code>disabled-text</code> - Grayed (disabled) text.</li>\n<li><code>highlight</code> - Item(s) selected in a control.</li>\n<li><code>highlight-text</code> - Text of item(s) selected in a control.</li>\n<li><code>hotlight</code> - Color for a hyperlink or hot-tracked item.</li>\n<li><code>inactive-border</code> - Inactive window border.</li>\n<li><code>inactive-caption</code> - Inactive window caption. Specifies the left side color\nin the color gradient of an inactive window's title bar if the gradient\neffect is enabled.</li>\n<li><code>inactive-caption-gradient</code> - Right side color in the color gradient of an\ninactive window's title bar.</li>\n<li><code>inactive-caption-text</code> - Color of text in an inactive caption.</li>\n<li><code>info-background</code> - Background color for tooltip controls.</li>\n<li><code>info-text</code> - Text color for tooltip controls.</li>\n<li><code>menu</code> - Menu background.</li>\n<li><code>menu-highlight</code> - The color used to highlight menu items when the menu\nappears as a flat menu.</li>\n<li><code>menubar</code> - The background color for the menu bar when menus appear as flat\nmenus.</li>\n<li><code>menu-text</code> - Text in menus.</li>\n<li><code>scrollbar</code> - Scroll bar gray area.</li>\n<li><code>window</code> - Window background.</li>\n<li><code>window-frame</code> - Window frame.</li>\n<li><code>window-text</code> - Text in windows.</li>\n</ul></li>\n<li>On <strong>macOS</strong><ul>\n<li><code>alternate-selected-control-text</code> - The text on a selected surface in a list or table. <em>deprecated</em></li>\n<li><code>control-background</code> - The background of a large interface element, such as a browser or table.</li>\n<li><code>control</code> - The surface of a control.</li>\n<li><code>control-text</code> -The text of a control that isn’t disabled.</li>\n<li><code>disabled-control-text</code> - The text of a control that’s disabled.</li>\n<li><code>find-highlight</code> - The color of a find indicator.</li>\n<li><code>grid</code> - The gridlines of an interface element such as a table.</li>\n<li><code>header-text</code> - The text of a header cell in a table.</li>\n<li><code>highlight</code> - The virtual light source onscreen.</li>\n<li><code>keyboard-focus-indicator</code> - The ring that appears around the currently focused control when using the keyboard for interface navigation.</li>\n<li><code>label</code> - The text of a label containing primary content.</li>\n<li><code>link</code> - A link to other content.</li>\n<li><code>placeholder-text</code> -  A placeholder string in a control or text view.</li>\n<li><code>quaternary-label</code> - The text of a label of lesser importance than a tertiary label such as watermark text.</li>\n<li><code>scrubber-textured-background</code> - The background of a scrubber in the Touch Bar.</li>\n<li><code>secondary-label</code> - The text of a label of lesser importance than a normal label such as a label used to represent a subheading or additional information.</li>\n<li><code>selected-content-background</code> - The background for selected content in a key window or view.</li>\n<li><code>selected-control</code> - The surface of a selected control.</li>\n<li><code>selected-control-text</code> - The text of a selected control.</li>\n<li><code>selected-menu-item-text</code> - The text of a selected menu.</li>\n<li><code>selected-text-background</code> - The background of selected text.</li>\n<li><code>selected-text</code> - Selected text.</li>\n<li><code>separator</code> - A separator between different sections of content.</li>\n<li><code>shadow</code> - The virtual shadow cast by a raised object onscreen.</li>\n<li><code>tertiary-label</code> - The text of a label of lesser importance than a secondary label such as a label used to represent disabled text.</li>\n<li><code>text-background</code> - Text background.</li>\n<li><code>text</code> -  The text in a document.</li>\n<li><code>under-page-background</code> -  The background behind a document's content.</li>\n<li><code>unemphasized-selected-content-background</code> - The selected content in a non-key window or view.</li>\n<li><code>unemphasized-selected-text-background</code> - A background for selected text in a non-key window or view.</li>\n<li><code>unemphasized-selected-text</code> - Selected text in a non-key window or view.</li>\n<li><code>window-background</code> - The background of a window.</li>\n<li><code>window-frame-text</code> - The text in the window's titlebar area.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>String</code> - The system color setting in RGB hexadecimal form (<code>#ABCDEF</code>).\nSee the <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx\">Windows docs</a> and the <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#dynamic-system-colors\">macOS docs</a> for more details.</p>\n<p>The following colors are only available on macOS 10.14: <code>find-highlight</code>, <code>selected-content-background</code>, <code>separator</code>, <code>unemphasized-selected-content-background</code>, <code>unemphasized-selected-text-background</code>, and <code>unemphasized-selected-text</code>.</p>\n<h3 id=\"systempreferencesgetsystemcolorcolor-macos\"><a href=\"#systempreferencesgetsystemcolorcolor-macos\"><code>systemPreferences.getSystemColor(color)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>color</code> String - One of the following values:<ul>\n<li><code>blue</code></li>\n<li><code>brown</code></li>\n<li><code>gray</code></li>\n<li><code>green</code></li>\n<li><code>orange</code></li>\n<li><code>pink</code></li>\n<li><code>purple</code></li>\n<li><code>red</code></li>\n<li><code>yellow</code></li>\n</ul></li>\n</ul>\n<p>Returns <code>String</code> - The standard system color formatted as <code>#RRGGBBAA</code>.</p>\n<p>Returns one of several standard system colors that automatically adapt to vibrancy and changes in accessibility settings like 'Increase contrast' and 'Reduce transparency'. See <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#system-colors\">Apple Documentation</a> for  more details.</p>\n<h3 id=\"systempreferencesisinvertedcolorscheme-windows-deprecated\"><a href=\"#systempreferencesisinvertedcolorscheme-windows-deprecated\"><code>systemPreferences.isInvertedColorScheme()</code> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Returns <code>Boolean</code> - <code>true</code> if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is active, <code>false</code> otherwise.</p>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly\"><code>nativeTheme.shouldUseInvertedColorScheme</code></a> API.</p>\n<h3 id=\"systempreferencesishighcontrastcolorscheme-macos-windows-deprecated\"><a href=\"#systempreferencesishighcontrastcolorscheme-macos-windows-deprecated\"><code>systemPreferences.isHighContrastColorScheme()</code> <em>macOS</em> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Returns <code>Boolean</code> - <code>true</code> if a high contrast theme is active, <code>false</code> otherwise.</p>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#nativethemeshouldusehighcontrastcolors-macos-windows-readonly\"><code>nativeTheme.shouldUseHighContrastColors</code></a> API.</p>\n<h3 id=\"systempreferencesgeteffectiveappearance-macos\"><a href=\"#systempreferencesgeteffectiveappearance-macos\"><code>systemPreferences.getEffectiveAppearance()</code> <em>macOS</em></a></h3>\n<p>Returns <code>String</code> - Can be <code>dark</code>, <code>light</code> or <code>unknown</code>.</p>\n<p>Gets the macOS appearance setting that is currently applied to your application,\nmaps to <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc\">NSApplication.effectiveAppearance</a></p>\n<h3 id=\"systempreferencesgetapplevelappearance-macos-deprecated\"><a href=\"#systempreferencesgetapplevelappearance-macos-deprecated\"><code>systemPreferences.getAppLevelAppearance()</code> <em>macOS</em> <em>Deprecated</em></a></h3>\n<p>Returns <code>String</code> | <code>null</code> - Can be <code>dark</code>, <code>light</code> or <code>unknown</code>.</p>\n<p>Gets the macOS appearance setting that you have declared you want for\nyour application, maps to <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc\">NSApplication.appearance</a>.\nYou can use the <code>setAppLevelAppearance</code> API to set this value.</p>\n<h3 id=\"systempreferencessetapplevelappearanceappearance-macos-deprecated\"><a href=\"#systempreferencessetapplevelappearanceappearance-macos-deprecated\"><code>systemPreferences.setAppLevelAppearance(appearance)</code> <em>macOS</em> <em>Deprecated</em></a></h3>\n<ul>\n<li><code>appearance</code> String | null - Can be <code>dark</code> or <code>light</code></li>\n</ul>\n<p>Sets the appearance setting for your application, this should override the\nsystem default and override the value of <code>getEffectiveAppearance</code>.</p>\n<h3 id=\"systempreferencescanprompttouchid-macos\"><a href=\"#systempreferencescanprompttouchid-macos\"><code>systemPreferences.canPromptTouchID()</code> <em>macOS</em></a></h3>\n<p>Returns <code>Boolean</code> - whether or not this device has the ability to use Touch ID.</p>\n<p><strong>NOTE:</strong> This API will return <code>false</code> on macOS systems older than Sierra 10.12.2.</p>\n<h3 id=\"systempreferencesprompttouchidreason-macos\"><a href=\"#systempreferencesprompttouchidreason-macos\"><code>systemPreferences.promptTouchID(reason)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>reason</code> String - The reason you are asking for Touch ID authentication</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves if the user has successfully authenticated with Touch ID.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsystemPreferences.promptTouchID(<span class=\"hljs-string\">'To get consent for a Security-Gated Thing'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">success</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'You have successfully authenticated with Touch ID!'</span>)\n}).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(err)\n})\n</code></pre>\n<p>This API itself will not protect your user data; rather, it is a mechanism to allow you to do so. Native apps will need to set <a href=\"https://developer.apple.com/documentation/security/secaccesscontrolcreateflags?language=objc\">Access Control Constants</a> like <a href=\"https://developer.apple.com/documentation/security/secaccesscontrolcreateflags/ksecaccesscontroluserpresence?language=objc\"><code>kSecAccessControlUserPresence</code></a> on their keychain entry so that reading it would auto-prompt for Touch ID biometric consent. This could be done with <a href=\"https://github.com/atom/node-keytar\"><code>node-keytar</code></a>, such that one would store an encryption key with <code>node-keytar</code> and only fetch it if <code>promptTouchID()</code> resolves.</p>\n<p><strong>NOTE:</strong> This API will return a rejected Promise on macOS systems older than Sierra 10.12.2.</p>\n<h3 id=\"systempreferencesistrustedaccessibilityclientprompt-macos\"><a href=\"#systempreferencesistrustedaccessibilityclientprompt-macos\"><code>systemPreferences.isTrustedAccessibilityClient(prompt)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>prompt</code> Boolean - whether or not the user will be informed via prompt if the current process is untrusted.</li>\n</ul>\n<p>Returns <code>Boolean</code> - <code>true</code> if the current process is a trusted accessibility client and <code>false</code> if it is not.</p>\n<h3 id=\"systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><a href=\"#systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><code>systemPreferences.getMediaAccessStatus(mediaType)</code> <em>Windows</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>mediaType</code> String - Can be <code>microphone</code>, <code>camera</code> or <code>screen</code>.</li>\n</ul>\n<p>Returns <code>String</code> - Can be <code>not-determined</code>, <code>granted</code>, <code>denied</code>, <code>restricted</code> or <code>unknown</code>.</p>\n<p>This user consent was not required on macOS 10.13 High Sierra or lower so this method will always return <code>granted</code>.\nmacOS 10.14 Mojave or higher requires consent for <code>microphone</code> and <code>camera</code> access.\nmacOS 10.15 Catalina or higher requires consent for <code>screen</code> access.</p>\n<p>Windows 10 has a global setting controlling <code>microphone</code> and <code>camera</code> access for all win32 applications.\nIt will always return <code>granted</code> for <code>screen</code> and for all media types on older versions of Windows.</p>\n<h3 id=\"systempreferencesaskformediaaccessmediatype-macos\"><a href=\"#systempreferencesaskformediaaccessmediatype-macos\"><code>systemPreferences.askForMediaAccess(mediaType)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>mediaType</code> String - the type of media being requested; can be <code>microphone</code>, <code>camera</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Boolean></code> - A promise that resolves with <code>true</code> if consent was granted and <code>false</code> if it was denied. If an invalid <code>mediaType</code> is passed, the promise will be rejected. If an access request was denied and later is changed through the System Preferences pane, a restart of the app will be required for the new permissions to take effect. If access has already been requested and denied, it <em>must</em> be changed through the preference pane; an alert will not pop up and the promise will resolve with the existing access status.</p>\n<p><strong>Important:</strong> In order to properly leverage this API, you <a href=\"https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos?language=objc\">must set</a> the <code>NSMicrophoneUsageDescription</code> and <code>NSCameraUsageDescription</code> strings in your app's <code>Info.plist</code> file. The values for these keys will be used to populate the permission dialogs so that the user will be properly informed as to the purpose of the permission request. See <a href=\"/docs/tutorial/application-distribution#macos\">Electron Application Distribution</a> for more information about how to set these in the context of Electron.</p>\n<p>This user consent was not required until macOS 10.14 Mojave, so this method will always return <code>true</code> if your system is running 10.13 High Sierra or lower.</p>\n<h3 id=\"systempreferencesgetanimationsettings\"><a href=\"#systempreferencesgetanimationsettings\"><code>systemPreferences.getAnimationSettings()</code></a></h3>\n<p>Returns <code>Object</code>:</p>\n<ul>\n<li><code>shouldRenderRichAnimation</code> Boolean - Returns true if rich animations should be rendered. Looks at session type (e.g. remote desktop) and accessibility settings to give guidance for heavy animations.</li>\n<li><code>scrollAnimationsEnabledBySystem</code> Boolean - Determines on a per-platform basis whether scroll animations (e.g. produced by home/end key) should be enabled.</li>\n<li><code>prefersReducedMotion</code> Boolean - Determines whether the user desires reduced motion based on platform APIs.</li>\n</ul>\n<p>Returns an object with system animation settings.</p>\n<h2 id=\"properties\"><a href=\"#properties\">Properties</a></h2>\n<h3 id=\"systempreferencesapplevelappearance-macos\"><a href=\"#systempreferencesapplevelappearance-macos\"><code>systemPreferences.appLevelAppearance</code> <em>macOS</em></a></h3>\n<p>A <code>String</code> property that can be <code>dark</code>, <code>light</code> or <code>unknown</code>. It determines the macOS appearance setting for\nyour application. This maps to values in: <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc\">NSApplication.appearance</a>. Setting this will override the\nsystem default as well as the value of <code>getEffectiveAppearance</code>.</p>\n<p>Possible values that can be set are <code>dark</code> and <code>light</code>, and possible return values are <code>dark</code>, <code>light</code>, and <code>unknown</code>.</p>\n<p>This property is only available on macOS 10.14 Mojave or newer.</p>\n<h3 id=\"systempreferenceseffectiveappearance-macos-readonly\"><a href=\"#systempreferenceseffectiveappearance-macos-readonly\"><code>systemPreferences.effectiveAppearance</code> <em>macOS</em> <em>Readonly</em></a></h3>\n<p>A <code>String</code> property that can be <code>dark</code>, <code>light</code> or <code>unknown</code>.</p>\n<p>Returns the macOS appearance setting that is currently applied to your application,\nmaps to <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc\">NSApplication.effectiveAppearance</a></p>",
      "title": "systemPreferences",
      "description": "Get system preferences."
    },
    "/docs/api/structures/task": {
      "locale": "en-US",
      "slug": "task",
      "href": "/docs/api/structures/task",
      "crowdinFileId": "256513",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/task.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"task-object\"><a href=\"#task-object\">Task Object</a></h1>\n<ul>\n<li><code>program</code> String - Path of the program to execute, usually you should\nspecify <code>process.execPath</code> which opens the current program.</li>\n<li><code>arguments</code> String - The command line arguments when <code>program</code> is\nexecuted.</li>\n<li><code>title</code> String - The string to be displayed in a JumpList.</li>\n<li><code>description</code> String - Description of this task.</li>\n<li><code>iconPath</code> String - The absolute path to an icon to be displayed in a\nJumpList, which can be an arbitrary resource file that contains an icon. You\ncan usually specify <code>process.execPath</code> to show the icon of the program.</li>\n<li><code>iconIndex</code> Number - The icon index in the icon file. If an icon file\nconsists of two or more icons, set this value to identify the icon. If an\nicon file consists of one icon, this value is 0.</li>\n<li><code>workingDirectory</code> String (optional) - The working directory. Default is empty.</li>\n</ul>",
      "title": "Task Object",
      "description": ""
    },
    "/docs/development/testing": {
      "locale": "en-US",
      "slug": "testing",
      "href": "/docs/development/testing",
      "crowdinFileId": "256169",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/testing.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"testing\"><a href=\"#testing\">Testing</a></h1>\n<p>We aim to keep the code coverage of Electron high. We ask that all pull\nrequest not only pass all existing tests, but ideally also add new tests\nto cover changed code and new scenarios. Ensuring that we capture as\nmany code paths and use cases of Electron as possible ensures that we\nall ship apps with fewer bugs.</p>\n<p>This repository comes with linting rules for both JavaScript and C++ –\nas well as unit and integration tests. To learn more about Electron's\ncoding style, please see the <a href=\"/docs/development/coding-style\">coding-style</a> document.</p>\n<h2 id=\"linting\"><a href=\"#linting\">Linting</a></h2>\n<p>To ensure that your JavaScript is in compliance with the Electron coding\nstyle, run <code>npm run lint-js</code>, which will run <code>standard</code> against both\nElectron itself as well as the unit tests. If you are using an editor\nwith a plugin/addon system, you might want to use one of the many\n<a href=\"https://standardjs.com/#are-there-text-editor-plugins\">StandardJS addons</a> to be informed of coding style\nviolations before you ever commit them.</p>\n<p>To run <code>standard</code> with parameters, run <code>npm run lint-js --</code> followed by\narguments you want passed to <code>standard</code>.</p>\n<p>To ensure that your C++ is in compliance with the Electron coding style,\nrun <code>npm run lint-cpp</code>, which runs a <code>cpplint</code> script. We recommend that\nyou use <code>clang-format</code> and prepared <a href=\"/docs/development/clang-format\">a short tutorial</a>.</p>\n<p>There is not a lot of Python in this repository, but it too is governed\nby coding style rules. <code>npm run lint-py</code> will check all Python, using\n<code>pylint</code> to do so.</p>\n<h2 id=\"unit-tests\"><a href=\"#unit-tests\">Unit Tests</a></h2>\n<p>If you are not using <a href=\"https://github.com/electron/build-tools\">build-tools</a>,\nensure that that name you have configured for your\nlocal build of Electron is one of <code>Testing</code>, <code>Release</code>, <code>Default</code>, <code>Debug</code>, or\nyou have set <code>process.env.ELECTRON_OUT_DIR</code>. Without these set, Electron will fail\nto perform some pre-testing steps.</p>\n<p>To run all unit tests, run <code>npm run test</code>. The unit tests are an Electron\napp (surprise!) that can be found in the <code>spec</code> folder. Note that it has\nits own <code>package.json</code> and that its dependencies are therefore not defined\nin the top-level <code>package.json</code>.</p>\n<p>To run only specific tests matching a pattern, run <code>npm run test -- -g=PATTERN</code>, replacing the <code>PATTERN</code> with a regex that matches the tests\nyou would like to run. As an example: If you want to run only IPC tests, you\nwould run <code>npm run test -- -g ipc</code>.</p>\n<h3 id=\"testing-on-windows-10-devices\"><a href=\"#testing-on-windows-10-devices\">Testing on Windows 10 devices</a></h3>\n<h4 id=\"extra-steps-to-run-the-unit-test\"><a href=\"#extra-steps-to-run-the-unit-test\">Extra steps to run the unit test:</a></h4>\n<ol>\n<li>\n<p>Visual Studio 2019 must be installed.</p>\n</li>\n<li>\n<p>Node headers have to be compiled for your configuration.</p>\n<pre><code class=\"hljs language-powershell\">ninja -C out\\Testing third_party\\electron_node:headers\n</code></pre>\n</li>\n<li>\n<p>The electron.lib has to be copied as node.lib.</p>\n<pre><code class=\"hljs language-powershell\">cd out\\Testing\nmkdir gen\\node_headers\\Release\ncopy electron.lib gen\\node_headers\\Release\\node.lib\n</code></pre>\n</li>\n</ol>\n<h4 id=\"missing-fonts\"><a href=\"#missing-fonts\">Missing fonts</a></h4>\n<p><a href=\"https://docs.microsoft.com/en-us/typography/fonts/windows_10_font_list\">Some Windows 10 devices</a> do not ship with the Meiryo font installed, which may cause a font fallback test to fail. To install Meiryo:</p>\n<ol>\n<li>Push the Windows key and search for <em>Manage optional features</em>.</li>\n<li>Click <em>Add a feature</em>.</li>\n<li>Select <em>Japanese Supplemental Fonts</em> and click <em>Install</em>.</li>\n</ol>\n<h4 id=\"pixel-measurements\"><a href=\"#pixel-measurements\">Pixel measurements</a></h4>\n<p>Some tests which rely on precise pixel measurements may not work correctly on\ndevices with Hi-DPI screen settings due to floating point precision errors.\nTo run these tests correctly, make sure the device is set to 100% scaling.</p>\n<p>To configure display scaling:</p>\n<ol>\n<li>Push the Windows key and search for <em>Display settings</em>.</li>\n<li>Under <em>Scale and layout</em>, make sure that the device is set to 100%.</li>\n</ol>",
      "title": "Testing",
      "description": ""
    },
    "/docs/tutorial/testing-on-headless-ci": {
      "locale": "en-US",
      "slug": "testing-on-headless-ci",
      "href": "/docs/tutorial/testing-on-headless-ci",
      "crowdinFileId": "256255",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/testing-on-headless-ci.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"testing-on-headless-ci-systems-travis-ci-jenkins\"><a href=\"#testing-on-headless-ci-systems-travis-ci-jenkins\">Testing on Headless CI Systems (Travis CI, Jenkins)</a></h1>\n<p>Being based on Chromium, Electron requires a display driver to function.\nIf Chromium can't find a display driver, Electron will fail to launch -\nand therefore not executing any of your tests, regardless of how you are running\nthem. Testing Electron-based apps on Travis, Circle, Jenkins or similar Systems\nrequires therefore a little bit of configuration. In essence, we need to use\na virtual display driver.</p>\n<h2 id=\"configuring-the-virtual-display-server\"><a href=\"#configuring-the-virtual-display-server\">Configuring the Virtual Display Server</a></h2>\n<p>First, install <a href=\"https://en.wikipedia.org/wiki/Xvfb\">Xvfb</a>.\nIt's a virtual framebuffer, implementing the X11 display server protocol -\nit performs all graphical operations in memory without showing any screen output,\nwhich is exactly what we need.</p>\n<p>Then, create a virtual Xvfb screen and export an environment variable\ncalled DISPLAY that points to it. Chromium in Electron will automatically look\nfor <code>$DISPLAY</code>, so no further configuration of your app is required.\nThis step can be automated with Anaïs Betts'\n<a href=\"https://github.com/anaisbetts/xvfb-maybe\">xvfb-maybe</a>: Prepend your test\ncommands with <code>xvfb-maybe</code> and the little tool will automatically configure\nXvfb, if required by the current system. On Windows or macOS, it will\ndo nothing.</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-comment\">## On Windows or macOS, this invokes electron-mocha</span>\n<span class=\"hljs-comment\">## On Linux, if we are in a headless environment, this will be equivalent</span>\n<span class=\"hljs-comment\">## to xvfb-run electron-mocha ./test/*.js</span>\nxvfb-maybe electron-mocha ./<span class=\"hljs-built_in\">test</span>/*.js\n</code></pre>\n<h3 id=\"travis-ci\"><a href=\"#travis-ci\">Travis CI</a></h3>\n<p>On Travis, your <code>.travis.yml</code> should look roughly like this:</p>\n<pre><code class=\"hljs language-yml\"><span class=\"hljs-attr\">addons:</span>\n  <span class=\"hljs-attr\">apt:</span>\n    <span class=\"hljs-attr\">packages:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">xvfb</span>\n\n<span class=\"hljs-attr\">install:</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">export</span> <span class=\"hljs-string\">DISPLAY=':99.0'</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">Xvfb</span> <span class=\"hljs-string\">:99</span> <span class=\"hljs-string\">-screen</span> <span class=\"hljs-number\">0</span> <span class=\"hljs-string\">1024x768x24</span> <span class=\"hljs-string\">></span> <span class=\"hljs-string\">/dev/null</span> <span class=\"hljs-number\">2</span><span class=\"hljs-string\">>&#x26;1</span> <span class=\"hljs-string\">&#x26;</span>\n</code></pre>\n<h3 id=\"jenkins\"><a href=\"#jenkins\">Jenkins</a></h3>\n<p>For Jenkins, a <a href=\"https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin\">Xvfb plugin is available</a>.</p>\n<h3 id=\"circle-ci\"><a href=\"#circle-ci\">Circle CI</a></h3>\n<p>Circle CI is awesome and has Xvfb and <code>$DISPLAY</code>\n<a href=\"https://circleci.com/docs/environment#browsers\">already set up, so no further configuration is required</a>.</p>\n<h3 id=\"appveyor\"><a href=\"#appveyor\">AppVeyor</a></h3>\n<p>AppVeyor runs on Windows, supporting Selenium, Chromium, Electron and similar\ntools out of the box - no configuration is required.</p>",
      "title": "Testing on Headless CI Systems (Travis CI, Jenkins)",
      "description": ""
    },
    "/docs/tutorial/testing-widevine-cdm": {
      "locale": "en-US",
      "slug": "testing-widevine-cdm",
      "href": "/docs/tutorial/testing-widevine-cdm",
      "crowdinFileId": "256257",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/testing-widevine-cdm.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"testing-widevine-cdm\"><a href=\"#testing-widevine-cdm\">Testing Widevine CDM</a></h1>\n<p>In Electron you can use the Widevine CDM library shipped with Chrome browser.</p>\n<p>Widevine Content Decryption Modules (CDMs) are how streaming services protect\ncontent using HTML5 video to web browsers without relying on an NPAPI plugin\nlike Flash or Silverlight. Widevine support is an alternative solution for\nstreaming services that currently rely on Silverlight for playback of\nDRM-protected video content. It will allow websites to show DRM-protected video\ncontent in Firefox without the use of NPAPI plugins. The Widevine CDM runs in an\nopen-source CDM sandbox providing better user security than NPAPI plugins.</p>\n<h4 id=\"note-on-vmp\"><a href=\"#note-on-vmp\">Note on VMP</a></h4>\n<p>As of <a href=\"https://electronjs.org/releases#1.8.1\"><code>Electron v1.8.0 (Chrome v59)</code></a>,\nthe below steps are may only be some of the necessary steps to enable Widevine;\nany app on or after that version intending to use the Widevine CDM may need to\nbe signed using a license obtained from <a href=\"https://www.widevine.com/\">Widevine</a>\nitself.</p>\n<p>Per <a href=\"https://www.widevine.com/\">Widevine</a>:</p>\n<blockquote>\n<p>Chrome 59 (and later) includes support for Verified Media Path (VMP). VMP\nprovides a method to verify the authenticity of a device platform. For browser\ndeployments, this will provide an additional signal to determine if a\nbrowser-based implementation is reliable and secure.</p>\n<p>The proxy integration guide has been updated with information about VMP and\nhow to issue licenses.</p>\n<p>Widevine recommends our browser-based integrations (vendors and browser-based\napplications) add support for VMP.</p>\n</blockquote>\n<p>To enable video playback with this new restriction,\n<a href=\"https://castlabs.com/open-source/downstream/\">castLabs</a> has created a\n<a href=\"https://github.com/castlabs/electron-releases\">fork</a> that has implemented the\nnecessary changes to enable Widevine to be played in an Electron application if\none has obtained the necessary licenses from widevine.</p>\n<h2 id=\"getting-the-library\"><a href=\"#getting-the-library\">Getting the library</a></h2>\n<p>Open <code>chrome://components/</code> in Chrome browser, find <code>Widevine Content Decryption Module</code>\nand make sure it is up to date, then you can find the library files from the\napplication directory.</p>\n<h3 id=\"on-windows\"><a href=\"#on-windows\">On Windows</a></h3>\n<p>The library file <code>widevinecdm.dll</code> will be under\n<code>Program Files(x86)/Google/Chrome/Application/CHROME_VERSION/WidevineCdm/_platform_specific/win_(x86|x64)/</code>\ndirectory.</p>\n<h3 id=\"on-macos\"><a href=\"#on-macos\">On macOS</a></h3>\n<p>The library file <code>libwidevinecdm.dylib</code> will be under\n<code>/Applications/Google Chrome.app/Contents/Versions/CHROME_VERSION/Google Chrome Framework.framework/Versions/A/Libraries/WidevineCdm/_platform_specific/mac_(x86|x64)/</code>\ndirectory.</p>\n<p><strong>Note:</strong> Make sure that chrome version used by Electron is greater than or\nequal to the <code>min_chrome_version</code> value of Chrome's widevine cdm component.\nThe value can be found in <code>manifest.json</code> under <code>WidevineCdm</code> directory.</p>\n<h2 id=\"using-the-library\"><a href=\"#using-the-library\">Using the library</a></h2>\n<p>After getting the library files, you should pass the path to the file\nwith <code>--widevine-cdm-path</code> command line switch, and the library's version\nwith <code>--widevine-cdm-version</code> switch. The command line switches have to be\npassed before the <code>ready</code> event of <code>app</code> module gets emitted.</p>\n<p>Example code:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// You have to pass the directory that contains widevine library here, it is</span>\n<span class=\"hljs-comment\">// * `libwidevinecdm.dylib` on macOS,</span>\n<span class=\"hljs-comment\">// * `widevinecdm.dll` on Windows.</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'widevine-cdm-path'</span>, <span class=\"hljs-string\">'/path/to/widevine_library'</span>)\n<span class=\"hljs-comment\">// The version of plugin can be got from `chrome://components` page in Chrome.</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'widevine-cdm-version'</span>, <span class=\"hljs-string\">'1.4.8.866'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.show()\n})\n</code></pre>\n<h2 id=\"verifying-widevine-cdm-support\"><a href=\"#verifying-widevine-cdm-support\">Verifying Widevine CDM support</a></h2>\n<p>To verify whether widevine works, you can use following ways:</p>\n<ul>\n<li>Open <a href=\"https://shaka-player-demo.appspot.com/\">https://shaka-player-demo.appspot.com/</a> and load a manifest that uses\n<code>Widevine</code>.</li>\n<li>Open <a href=\"http://www.dash-player.com/demo/drm-test-area/\">http://www.dash-player.com/demo/drm-test-area/</a>, check whether the page\nsays <code>bitdash uses Widevine in your browser</code>, then play the video.</li>\n</ul>",
      "title": "Testing Widevine CDM",
      "description": "Chrome 59 (and later) includes support for Verified Media Path (VMP). VMP\nprovides a method to verify the authenticity of a device platform. For browser\ndeployments, this will provide an additional signal to determine if a\nbrowser-based implementation is reliable and secure.\nThe proxy integration guide has been updated with information about VMP and\nhow to issue licenses.\nWidevine recommends our browser-based integrations (vendors and browser-based\napplications) add support for VMP."
    },
    "/docs/api/structures/thumbar-button": {
      "locale": "en-US",
      "slug": "thumbar-button",
      "href": "/docs/api/structures/thumbar-button",
      "crowdinFileId": "256515",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/thumbar-button.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"thumbarbutton-object\"><a href=\"#thumbarbutton-object\">ThumbarButton Object</a></h1>\n<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - The icon showing in thumbnail\ntoolbar.</li>\n<li><code>click</code> Function</li>\n<li><code>tooltip</code> String (optional) - The text of the button's tooltip.</li>\n<li><code>flags</code> String<a href=\"/docs/api/structures/optional\"></a> - Control specific states and behaviors of the\nbutton. By default, it is <code>['enabled']</code>.</li>\n</ul>\n<p>The <code>flags</code> is an array that can include following <code>String</code>s:</p>\n<ul>\n<li><code>enabled</code> - The button is active and available to the user.</li>\n<li><code>disabled</code> - The button is disabled. It is present, but has a visual state\nindicating it will not respond to user action.</li>\n<li><code>dismissonclick</code> - When the button is clicked, the thumbnail window closes\nimmediately.</li>\n<li><code>nobackground</code> - Do not draw a button border, use only the image.</li>\n<li><code>hidden</code> - The button is not shown to the user.</li>\n<li><code>noninteractive</code> - The button is enabled but not interactive; no pressed\nbutton state is drawn. This value is intended for instances where the button\nis used in a notification.</li>\n</ul>",
      "title": "ThumbarButton Object",
      "description": ""
    },
    "/docs/api/touch-bar": {
      "locale": "en-US",
      "slug": "touch-bar",
      "href": "/docs/api/touch-bar",
      "crowdinFileId": "256395",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"touchbar\"><a href=\"#touchbar\">TouchBar</a></h1>\n<h2 id=\"class-touchbar\"><a href=\"#class-touchbar\">Class: TouchBar</a></h2>\n<blockquote>\n<p>Create TouchBar layouts for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h3 id=\"new-touchbaroptions\"><a href=\"#new-touchbaroptions\"><code>new TouchBar(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>items</code> (<a href=\"/docs/api/touch-bar-button\">TouchBarButton</a> | <a href=\"/docs/api/touch-bar-color-picker\">TouchBarColorPicker</a> | <a href=\"/docs/api/touch-bar-group\">TouchBarGroup</a> | <a href=\"/docs/api/touch-bar-label\">TouchBarLabel</a> | <a href=\"/docs/api/touch-bar-popover\">TouchBarPopover</a> | <a href=\"/docs/api/touch-bar-scrubber\">TouchBarScrubber</a> | <a href=\"/docs/api/touch-bar-segmented-control\">TouchBarSegmentedControl</a> | <a href=\"/docs/api/touch-bar-slider\">TouchBarSlider</a> | <a href=\"/docs/api/touch-bar-spacer\">TouchBarSpacer</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>escapeItem</code> (<a href=\"/docs/api/touch-bar-button\">TouchBarButton</a> | <a href=\"/docs/api/touch-bar-color-picker\">TouchBarColorPicker</a> | <a href=\"/docs/api/touch-bar-group\">TouchBarGroup</a> | <a href=\"/docs/api/touch-bar-label\">TouchBarLabel</a> | <a href=\"/docs/api/touch-bar-popover\">TouchBarPopover</a> | <a href=\"/docs/api/touch-bar-scrubber\">TouchBarScrubber</a> | <a href=\"/docs/api/touch-bar-segmented-control\">TouchBarSegmentedControl</a> | <a href=\"/docs/api/touch-bar-slider\">TouchBarSlider</a> | <a href=\"/docs/api/touch-bar-spacer\">TouchBarSpacer</a> | null) (optional)</li>\n</ul></li>\n</ul>\n<p>Creates a new touch bar with the specified items. Use\n<code>BrowserWindow.setTouchBar</code> to add the <code>TouchBar</code> to a window.</p>\n<p><strong>Note:</strong> The TouchBar API is currently experimental and may change or be\nremoved in future Electron releases.</p>\n<p><strong>Tip:</strong> If you don't have a MacBook with Touch Bar, you can use\n<a href=\"https://github.com/sindresorhus/touch-bar-simulator\">Touch Bar Simulator</a>\nto test Touch Bar usage in your app.</p>\n<h3 id=\"static-properties\"><a href=\"#static-properties\">Static Properties</a></h3>\n<h4 id=\"touchbarbutton\"><a href=\"#touchbarbutton\"><code>TouchBarButton</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-button\"><code>typeof TouchBarButton</code></a> reference to the <code>TouchBarButton</code> class.</p>\n<h4 id=\"touchbarcolorpicker\"><a href=\"#touchbarcolorpicker\"><code>TouchBarColorPicker</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-color-picker\"><code>typeof TouchBarColorPicker</code></a> reference to the <code>TouchBarColorPicker</code> class.</p>\n<h4 id=\"touchbargroup\"><a href=\"#touchbargroup\"><code>TouchBarGroup</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-group\"><code>typeof TouchBarGroup</code></a> reference to the <code>TouchBarGroup</code> class.</p>\n<h4 id=\"touchbarlabel\"><a href=\"#touchbarlabel\"><code>TouchBarLabel</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-label\"><code>typeof TouchBarLabel</code></a> reference to the <code>TouchBarLabel</code> class.</p>\n<h4 id=\"touchbarpopover\"><a href=\"#touchbarpopover\"><code>TouchBarPopover</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-popover\"><code>typeof TouchBarPopover</code></a> reference to the <code>TouchBarPopover</code> class.</p>\n<h4 id=\"touchbarscrubber\"><a href=\"#touchbarscrubber\"><code>TouchBarScrubber</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-scrubber\"><code>typeof TouchBarScrubber</code></a> reference to the <code>TouchBarScrubber</code> class.</p>\n<h4 id=\"touchbarsegmentedcontrol\"><a href=\"#touchbarsegmentedcontrol\"><code>TouchBarSegmentedControl</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-segmented-control\"><code>typeof TouchBarSegmentedControl</code></a> reference to the <code>TouchBarSegmentedControl</code> class.</p>\n<h4 id=\"touchbarslider\"><a href=\"#touchbarslider\"><code>TouchBarSlider</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-slider\"><code>typeof TouchBarSlider</code></a> reference to the <code>TouchBarSlider</code> class.</p>\n<h4 id=\"touchbarspacer\"><a href=\"#touchbarspacer\"><code>TouchBarSpacer</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-spacer\"><code>typeof TouchBarSpacer</code></a> reference to the <code>TouchBarSpacer</code> class.</p>\n<h4 id=\"touchbarotheritemsproxy\"><a href=\"#touchbarotheritemsproxy\"><code>TouchBarOtherItemsProxy</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-other-items-proxy\"><code>typeof TouchBarOtherItemsProxy</code></a> reference to the <code>TouchBarOtherItemsProxy</code> class.</p>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<p>The following properties are available on instances of <code>TouchBar</code>:</p>\n<h4 id=\"touchbarescapeitem\"><a href=\"#touchbarescapeitem\"><code>touchBar.escapeItem</code></a></h4>\n<p>A <code>TouchBarItem</code> that will replace the \"esc\" button on the touch bar when set.\nSetting to <code>null</code> restores the default \"esc\" button. Changing this value\nimmediately updates the escape item in the touch bar.</p>\n<h2 id=\"examples\"><a href=\"#examples\">Examples</a></h2>\n<p>Below is an example of a simple slot machine touch bar game with a button\nand some labels.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, TouchBar } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> { TouchBarLabel, TouchBarButton, TouchBarSpacer } = TouchBar\n\n<span class=\"hljs-keyword\">let</span> spinning = <span class=\"hljs-literal\">false</span>\n\n<span class=\"hljs-comment\">// Reel labels</span>\n<span class=\"hljs-keyword\">const</span> reel1 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n<span class=\"hljs-keyword\">const</span> reel2 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n<span class=\"hljs-keyword\">const</span> reel3 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n\n<span class=\"hljs-comment\">// Spin result label</span>\n<span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n\n<span class=\"hljs-comment\">// Spin button</span>\n<span class=\"hljs-keyword\">const</span> spin = <span class=\"hljs-keyword\">new</span> TouchBarButton({\n  <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'🎰 Spin'</span>,\n  <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#7851A9'</span>,\n  <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// Ignore clicks if already spinning</span>\n    <span class=\"hljs-keyword\">if</span> (spinning) {\n      <span class=\"hljs-keyword\">return</span>\n    }\n\n    spinning = <span class=\"hljs-literal\">true</span>\n    result.label = <span class=\"hljs-string\">''</span>\n\n    <span class=\"hljs-keyword\">let</span> timeout = <span class=\"hljs-number\">10</span>\n    <span class=\"hljs-keyword\">const</span> spinLength = <span class=\"hljs-number\">4</span> * <span class=\"hljs-number\">1000</span> <span class=\"hljs-comment\">// 4 seconds</span>\n    <span class=\"hljs-keyword\">const</span> startTime = <span class=\"hljs-built_in\">Date</span>.now()\n\n    <span class=\"hljs-keyword\">const</span> spinReels = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      updateReels()\n\n      <span class=\"hljs-keyword\">if</span> ((<span class=\"hljs-built_in\">Date</span>.now() - startTime) >= spinLength) {\n        finishSpin()\n      } <span class=\"hljs-keyword\">else</span> {\n        <span class=\"hljs-comment\">// Slow down a bit on each spin</span>\n        timeout *= <span class=\"hljs-number\">1.1</span>\n        setTimeout(spinReels, timeout)\n      }\n    }\n\n    spinReels()\n  }\n})\n\n<span class=\"hljs-keyword\">const</span> getRandomValue = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> values = [<span class=\"hljs-string\">'🍒'</span>, <span class=\"hljs-string\">'💎'</span>, <span class=\"hljs-string\">'7️⃣'</span>, <span class=\"hljs-string\">'🍊'</span>, <span class=\"hljs-string\">'🔔'</span>, <span class=\"hljs-string\">'⭐'</span>, <span class=\"hljs-string\">'🍇'</span>, <span class=\"hljs-string\">'🍀'</span>]\n  <span class=\"hljs-keyword\">return</span> values[<span class=\"hljs-built_in\">Math</span>.floor(<span class=\"hljs-built_in\">Math</span>.random() * values.length)]\n}\n\n<span class=\"hljs-keyword\">const</span> updateReels = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  reel1.label = getRandomValue()\n  reel2.label = getRandomValue()\n  reel3.label = getRandomValue()\n}\n\n<span class=\"hljs-keyword\">const</span> finishSpin = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> uniqueValues = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Set</span>([reel1.label, reel2.label, reel3.label]).size\n  <span class=\"hljs-keyword\">if</span> (uniqueValues === <span class=\"hljs-number\">1</span>) {\n    <span class=\"hljs-comment\">// All 3 values are the same</span>\n    result.label = <span class=\"hljs-string\">'💰 Jackpot!'</span>\n    result.textColor = <span class=\"hljs-string\">'#FDFF00'</span>\n  } <span class=\"hljs-keyword\">else</span> <span class=\"hljs-keyword\">if</span> (uniqueValues === <span class=\"hljs-number\">2</span>) {\n    <span class=\"hljs-comment\">// 2 values are the same</span>\n    result.label = <span class=\"hljs-string\">'😍 Winner!'</span>\n    result.textColor = <span class=\"hljs-string\">'#FDFF00'</span>\n  } <span class=\"hljs-keyword\">else</span> {\n    <span class=\"hljs-comment\">// No values are the same</span>\n    result.label = <span class=\"hljs-string\">'🙁 Spin Again'</span>\n    result.textColor = <span class=\"hljs-literal\">null</span>\n  }\n  spinning = <span class=\"hljs-literal\">false</span>\n}\n\n<span class=\"hljs-keyword\">const</span> touchBar = <span class=\"hljs-keyword\">new</span> TouchBar({\n  <span class=\"hljs-attr\">items</span>: [\n    spin,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'large'</span> }),\n    reel1,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'small'</span> }),\n    reel2,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'small'</span> }),\n    reel3,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'large'</span> }),\n    result\n  ]\n})\n\n<span class=\"hljs-keyword\">let</span> <span class=\"hljs-built_in\">window</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-built_in\">window</span> = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span>,\n    <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span>,\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#000'</span>\n  })\n  <span class=\"hljs-built_in\">window</span>.loadURL(<span class=\"hljs-string\">'about:blank'</span>)\n  <span class=\"hljs-built_in\">window</span>.setTouchBar(touchBar)\n})\n</code></pre>\n<h3 id=\"running-the-above-example\"><a href=\"#running-the-above-example\">Running the above example</a></h3>\n<p>To run the example above, you'll need to (assuming you've got a terminal open in the directory you want to run the example):</p>\n<ol>\n<li>Save the above file to your computer as <code>touchbar.js</code></li>\n<li>Install Electron via <code>npm install electron</code></li>\n<li>Run the example inside Electron: <code>./node_modules/.bin/electron touchbar.js</code></li>\n</ol>\n<p>You should then see a new Electron window and the app running in your touch bar (or touch bar emulator).</p>",
      "title": "TouchBar",
      "description": "Create TouchBar layouts for native macOS applications"
    },
    "/docs/api/touch-bar-button": {
      "locale": "en-US",
      "slug": "touch-bar-button",
      "href": "/docs/api/touch-bar-button",
      "crowdinFileId": "256375",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-button.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarbutton\"><a href=\"#class-touchbarbutton\">Class: TouchBarButton</a></h2>\n<blockquote>\n<p>Create a button in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarbuttonoptions\"><a href=\"#new-touchbarbuttonoptions\"><code>new TouchBarButton(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>label</code> String (optional) - Button text.</li>\n<li><code>accessibilityLabel</code> String (optional) - A short description of the button for use by screenreaders like VoiceOver.</li>\n<li><code>backgroundColor</code> String (optional) - Button background color in hex format,\ni.e <code>#ABCDEF</code>.</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String (optional) - Button icon.</li>\n<li><code>iconPosition</code> String (optional) - Can be <code>left</code>, <code>right</code> or <code>overlay</code>. Defaults to <code>overlay</code>.</li>\n<li><code>click</code> Function (optional) - Function to call when the button is clicked.</li>\n<li><code>enabled</code> Boolean (optional) - Whether the button is in an enabled state.  Default is <code>true</code>.</li>\n</ul></li>\n</ul>\n<p>When defining <code>accessibilityLabel</code>, ensure you have considered macOS <a href=\"https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc\">best practices</a>.</p>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<p>The following properties are available on instances of <code>TouchBarButton</code>:</p>\n<h4 id=\"touchbarbuttonaccessibilitylabel\"><a href=\"#touchbarbuttonaccessibilitylabel\"><code>touchBarButton.accessibilityLabel</code></a></h4>\n<p>A <code>String</code> representing the description of the button to be read by a screen reader. Will only be read by screen readers if no label is set.</p>\n<h4 id=\"touchbarbuttonlabel\"><a href=\"#touchbarbuttonlabel\"><code>touchBarButton.label</code></a></h4>\n<p>A <code>String</code> representing the button's current text. Changing this value immediately updates the button\nin the touch bar.</p>\n<h4 id=\"touchbarbuttonbackgroundcolor\"><a href=\"#touchbarbuttonbackgroundcolor\"><code>touchBarButton.backgroundColor</code></a></h4>\n<p>A <code>String</code> hex code representing the button's current background color. Changing this value immediately updates\nthe button in the touch bar.</p>\n<h4 id=\"touchbarbuttonicon\"><a href=\"#touchbarbuttonicon\"><code>touchBarButton.icon</code></a></h4>\n<p>A <code>NativeImage</code> representing the button's current icon. Changing this value immediately updates the button\nin the touch bar.</p>\n<h4 id=\"touchbarbuttoniconposition\"><a href=\"#touchbarbuttoniconposition\"><code>touchBarButton.iconPosition</code></a></h4>\n<p>A <code>String</code> - Can be <code>left</code>, <code>right</code> or <code>overlay</code>.  Defaults to <code>overlay</code>.</p>\n<h4 id=\"touchbarbuttonenabled\"><a href=\"#touchbarbuttonenabled\"><code>touchBarButton.enabled</code></a></h4>\n<p>A <code>Boolean</code> representing whether the button is in an enabled state.</p>",
      "title": "TouchBarButton",
      "description": "Create a button in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-color-picker": {
      "locale": "en-US",
      "slug": "touch-bar-color-picker",
      "href": "/docs/api/touch-bar-color-picker",
      "crowdinFileId": "256377",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-color-picker.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarcolorpicker\"><a href=\"#class-touchbarcolorpicker\">Class: TouchBarColorPicker</a></h2>\n<blockquote>\n<p>Create a color picker in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarcolorpickeroptions\"><a href=\"#new-touchbarcolorpickeroptions\"><code>new TouchBarColorPicker(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>availableColors</code> String<a href=\"/docs/api/optional\"></a> - Array of hex color strings to\nappear as possible colors to select.</li>\n<li><code>selectedColor</code> String (optional) - The selected hex color in the picker,\ni.e <code>#ABCDEF</code>.</li>\n<li><code>change</code> Function (optional) - Function to call when a color is selected.<ul>\n<li><code>color</code> String - The color that the user selected from the picker.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<p>The following properties are available on instances of <code>TouchBarColorPicker</code>:</p>\n<h4 id=\"touchbarcolorpickeravailablecolors\"><a href=\"#touchbarcolorpickeravailablecolors\"><code>touchBarColorPicker.availableColors</code></a></h4>\n<p>A <code>String[]</code> array representing the color picker's available colors to select. Changing this value immediately\nupdates the color picker in the touch bar.</p>\n<h4 id=\"touchbarcolorpickerselectedcolor\"><a href=\"#touchbarcolorpickerselectedcolor\"><code>touchBarColorPicker.selectedColor</code></a></h4>\n<p>A <code>String</code> hex code representing the color picker's currently selected color. Changing this value immediately\nupdates the color picker in the touch bar.</p>",
      "title": "TouchBarColorPicker",
      "description": "Create a color picker in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-group": {
      "locale": "en-US",
      "slug": "touch-bar-group",
      "href": "/docs/api/touch-bar-group",
      "crowdinFileId": "256379",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-group.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbargroup\"><a href=\"#class-touchbargroup\">Class: TouchBarGroup</a></h2>\n<blockquote>\n<p>Create a group in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbargroupoptions\"><a href=\"#new-touchbargroupoptions\"><code>new TouchBarGroup(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>items</code> <a href=\"/docs/api/touch-bar\">TouchBar</a> - Items to display as a group.</li>\n</ul></li>\n</ul>",
      "title": "TouchBarGroup",
      "description": "Create a group in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-label": {
      "locale": "en-US",
      "slug": "touch-bar-label",
      "href": "/docs/api/touch-bar-label",
      "crowdinFileId": "256381",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-label.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarlabel\"><a href=\"#class-touchbarlabel\">Class: TouchBarLabel</a></h2>\n<blockquote>\n<p>Create a label in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarlabeloptions\"><a href=\"#new-touchbarlabeloptions\"><code>new TouchBarLabel(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>label</code> String (optional) - Text to display.</li>\n<li><code>accessibilityLabel</code> String (optional) - A short description of the button for use by screenreaders like VoiceOver.</li>\n<li><code>textColor</code> String (optional) - Hex color of text, i.e <code>#ABCDEF</code>.</li>\n</ul></li>\n</ul>\n<p>When defining <code>accessibilityLabel</code>, ensure you have considered macOS <a href=\"https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc\">best practices</a>.</p>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<p>The following properties are available on instances of <code>TouchBarLabel</code>:</p>\n<h4 id=\"touchbarlabellabel\"><a href=\"#touchbarlabellabel\"><code>touchBarLabel.label</code></a></h4>\n<p>A <code>String</code> representing the label's current text. Changing this value immediately updates the label in\nthe touch bar.</p>\n<h4 id=\"touchbarlabelaccessibilitylabel\"><a href=\"#touchbarlabelaccessibilitylabel\"><code>touchBarLabel.accessibilityLabel</code></a></h4>\n<p>A <code>String</code> representing the description of the label to be read by a screen reader.</p>\n<h4 id=\"touchbarlabeltextcolor\"><a href=\"#touchbarlabeltextcolor\"><code>touchBarLabel.textColor</code></a></h4>\n<p>A <code>String</code> hex code representing the label's current text color. Changing this value immediately updates the\nlabel in the touch bar.</p>",
      "title": "TouchBarLabel",
      "description": "Create a label in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-other-items-proxy": {
      "locale": "en-US",
      "slug": "touch-bar-other-items-proxy",
      "href": "/docs/api/touch-bar-other-items-proxy",
      "crowdinFileId": "256383",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-other-items-proxy.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarotheritemsproxy\"><a href=\"#class-touchbarotheritemsproxy\">Class: TouchBarOtherItemsProxy</a></h2>\n<blockquote>\n<p>Instantiates a special \"other items proxy\", which nests TouchBar elements inherited\nfrom Chromium at the space indicated by the proxy. By default, this proxy is added\nto each TouchBar at the end of the input. For more information, see the AppKit docs on\n<a href=\"https://developer.apple.com/documentation/appkit/nstouchbaritemidentifierotheritemsproxy\">NSTouchBarItemIdentifierOtherItemsProxy</a></p>\n<p>Note: Only one instance of this class can be added per TouchBar.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarotheritemsproxy\"><a href=\"#new-touchbarotheritemsproxy\"><code>new TouchBarOtherItemsProxy()</code></a></h3>",
      "title": "TouchBarOtherItemsProxy",
      "description": "Instantiates a special \"other items proxy\", which nests TouchBar elements inherited\nfrom Chromium at the space indicated by the proxy. By default, this proxy is added\nto each TouchBar at the end of the input. For more information, see the AppKit docs on\nNSTouchBarItemIdentifierOtherItemsProxy\nNote: Only one instance of this class can be added per TouchBar."
    },
    "/docs/api/touch-bar-popover": {
      "locale": "en-US",
      "slug": "touch-bar-popover",
      "href": "/docs/api/touch-bar-popover",
      "crowdinFileId": "256385",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-popover.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarpopover\"><a href=\"#class-touchbarpopover\">Class: TouchBarPopover</a></h2>\n<blockquote>\n<p>Create a popover in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarpopoveroptions\"><a href=\"#new-touchbarpopoveroptions\"><code>new TouchBarPopover(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>label</code> String (optional) - Popover button text.</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> (optional) - Popover button icon.</li>\n<li><code>items</code> <a href=\"/docs/api/touch-bar\">TouchBar</a> - Items to display in the popover.</li>\n<li><code>showCloseButton</code> Boolean (optional) - <code>true</code> to display a close button\non the left of the popover, <code>false</code> to not show it. Default is <code>true</code>.</li>\n</ul></li>\n</ul>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<p>The following properties are available on instances of <code>TouchBarPopover</code>:</p>\n<h4 id=\"touchbarpopoverlabel\"><a href=\"#touchbarpopoverlabel\"><code>touchBarPopover.label</code></a></h4>\n<p>A <code>String</code> representing the popover's current button text. Changing this value immediately updates the\npopover in the touch bar.</p>\n<h4 id=\"touchbarpopovericon\"><a href=\"#touchbarpopovericon\"><code>touchBarPopover.icon</code></a></h4>\n<p>A <code>NativeImage</code> representing the popover's current button icon. Changing this value immediately updates the\npopover in the touch bar.</p>",
      "title": "TouchBarPopover",
      "description": "Create a popover in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-scrubber": {
      "locale": "en-US",
      "slug": "touch-bar-scrubber",
      "href": "/docs/api/touch-bar-scrubber",
      "crowdinFileId": "256387",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-scrubber.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarscrubber\"><a href=\"#class-touchbarscrubber\">Class: TouchBarScrubber</a></h2>\n<blockquote>\n<p>Create a scrubber (a scrollable selector)</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarscrubberoptions\"><a href=\"#new-touchbarscrubberoptions\"><code>new TouchBarScrubber(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>items</code> <a href=\"/docs/api/structures/scrubber-item\">ScrubberItem[]</a> - An array of items to place in this scrubber.</li>\n<li><code>select</code> Function (optional) - Called when the user taps an item that was not the last tapped item.<ul>\n<li><code>selectedIndex</code> Integer - The index of the item the user selected.</li>\n</ul></li>\n<li><code>highlight</code> Function (optional) - Called when the user taps any item.<ul>\n<li><code>highlightedIndex</code> Integer - The index of the item the user touched.</li>\n</ul></li>\n<li><code>selectedStyle</code> String (optional) - Selected item style. Can be <code>background</code>, <code>outline</code> or <code>none</code>. Defaults to <code>none</code>.</li>\n<li><code>overlayStyle</code> String (optional) - Selected overlay item style. Can be <code>background</code>, <code>outline</code> or <code>none</code>. Defaults to <code>none</code>.</li>\n<li><code>showArrowButtons</code> Boolean (optional) - Whether to show arrow buttons. Defaults to <code>false</code> and is only shown if <code>items</code> is non-empty.</li>\n<li><code>mode</code> String (optional) - Can be <code>fixed</code> or <code>free</code>. The default is <code>free</code>.</li>\n<li><code>continuous</code> Boolean (optional) - Defaults to <code>true</code>.</li>\n</ul></li>\n</ul>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<p>The following properties are available on instances of <code>TouchBarScrubber</code>:</p>\n<h4 id=\"touchbarscrubberitems\"><a href=\"#touchbarscrubberitems\"><code>touchBarScrubber.items</code></a></h4>\n<p>A <code>ScrubberItem[]</code> array representing the items in this scrubber. Updating this value immediately\nupdates the control in the touch bar. Updating deep properties inside this array <strong>does not update the touch bar</strong>.</p>\n<h4 id=\"touchbarscrubberselectedstyle\"><a href=\"#touchbarscrubberselectedstyle\"><code>touchBarScrubber.selectedStyle</code></a></h4>\n<p>A <code>String</code> representing the style that selected items in the scrubber should have. Updating this value immediately\nupdates the control in the touch bar. Possible values:</p>\n<ul>\n<li><code>background</code> - Maps to <code>[NSScrubberSelectionStyle roundedBackgroundStyle]</code>.</li>\n<li><code>outline</code> - Maps to <code>[NSScrubberSelectionStyle outlineOverlayStyle]</code>.</li>\n<li><code>none</code> - Removes all styles.</li>\n</ul>\n<h4 id=\"touchbarscrubberoverlaystyle\"><a href=\"#touchbarscrubberoverlaystyle\"><code>touchBarScrubber.overlayStyle</code></a></h4>\n<p>A <code>String</code> representing the style that selected items in the scrubber should have. This style is overlayed on top\nof the scrubber item instead of being placed behind it. Updating this value immediately updates the control in the\ntouch bar. Possible values:</p>\n<ul>\n<li><code>background</code> - Maps to <code>[NSScrubberSelectionStyle roundedBackgroundStyle]</code>.</li>\n<li><code>outline</code> - Maps to <code>[NSScrubberSelectionStyle outlineOverlayStyle]</code>.</li>\n<li><code>none</code> - Removes all styles.</li>\n</ul>\n<h4 id=\"touchbarscrubbershowarrowbuttons\"><a href=\"#touchbarscrubbershowarrowbuttons\"><code>touchBarScrubber.showArrowButtons</code></a></h4>\n<p>A <code>Boolean</code> representing whether to show the left / right selection arrows in this scrubber. Updating this value\nimmediately updates the control in the touch bar.</p>\n<h4 id=\"touchbarscrubbermode\"><a href=\"#touchbarscrubbermode\"><code>touchBarScrubber.mode</code></a></h4>\n<p>A <code>String</code> representing the mode of this scrubber. Updating this value immediately\nupdates the control in the touch bar. Possible values:</p>\n<ul>\n<li><code>fixed</code> - Maps to <code>NSScrubberModeFixed</code>.</li>\n<li><code>free</code> - Maps to <code>NSScrubberModeFree</code>.</li>\n</ul>\n<h4 id=\"touchbarscrubbercontinuous\"><a href=\"#touchbarscrubbercontinuous\"><code>touchBarScrubber.continuous</code></a></h4>\n<p>A <code>Boolean</code> representing whether this scrubber is continuous or not. Updating this value immediately\nupdates the control in the touch bar.</p>",
      "title": "TouchBarScrubber",
      "description": "Create a scrubber (a scrollable selector)"
    },
    "/docs/api/touch-bar-segmented-control": {
      "locale": "en-US",
      "slug": "touch-bar-segmented-control",
      "href": "/docs/api/touch-bar-segmented-control",
      "crowdinFileId": "256389",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-segmented-control.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarsegmentedcontrol\"><a href=\"#class-touchbarsegmentedcontrol\">Class: TouchBarSegmentedControl</a></h2>\n<blockquote>\n<p>Create a segmented control (a button group) where one button has a selected state</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarsegmentedcontroloptions\"><a href=\"#new-touchbarsegmentedcontroloptions\"><code>new TouchBarSegmentedControl(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>segmentStyle</code> String (optional) - Style of the segments:<ul>\n<li><code>automatic</code> - Default. The appearance of the segmented control is\nautomatically determined based on the type of window in which the control\nis displayed and the position within the window. Maps to <code>NSSegmentStyleAutomatic</code>.</li>\n<li><code>rounded</code> - The control is displayed using the rounded style. Maps to <code>NSSegmentStyleRounded</code>.</li>\n<li><code>textured-rounded</code> - The control is displayed using the textured rounded\nstyle. Maps to <code>NSSegmentStyleTexturedRounded</code>.</li>\n<li><code>round-rect</code> - The control is displayed using the round rect style. Maps to <code>NSSegmentStyleRoundRect</code>.</li>\n<li><code>textured-square</code> - The control is displayed using the textured square\nstyle. Maps to <code>NSSegmentStyleTexturedSquare</code>.</li>\n<li><code>capsule</code> - The control is displayed using the capsule style. Maps to <code>NSSegmentStyleCapsule</code>.</li>\n<li><code>small-square</code> - The control is displayed using the small square style. Maps to <code>NSSegmentStyleSmallSquare</code>.</li>\n<li><code>separated</code> - The segments in the control are displayed very close to each\nother but not touching. Maps to <code>NSSegmentStyleSeparated</code>.</li>\n</ul></li>\n<li><code>mode</code> String (optional) - The selection mode of the control:<ul>\n<li><code>single</code> - Default. One item selected at a time, selecting one deselects the previously selected item. Maps to <code>NSSegmentSwitchTrackingSelectOne</code>.</li>\n<li><code>multiple</code> - Multiple items can be selected at a time. Maps to <code>NSSegmentSwitchTrackingSelectAny</code>.</li>\n<li><code>buttons</code> - Make the segments act as buttons, each segment can be pressed and released but never marked as active. Maps to <code>NSSegmentSwitchTrackingMomentary</code>.</li>\n</ul></li>\n<li><code>segments</code> <a href=\"/docs/api/structures/segmented-control-segment\">SegmentedControlSegment[]</a> - An array of segments to place in this control.</li>\n<li><code>selectedIndex</code> Integer (optional) - The index of the currently selected segment, will update automatically with user interaction. When the mode is <code>multiple</code> it will be the last selected item.</li>\n<li><code>change</code> Function (optional) - Called when the user selects a new segment.<ul>\n<li><code>selectedIndex</code> Integer - The index of the segment the user selected.</li>\n<li><code>isSelected</code> Boolean - Whether as a result of user selection the segment is selected or not.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<p>The following properties are available on instances of <code>TouchBarSegmentedControl</code>:</p>\n<h4 id=\"touchbarsegmentedcontrolsegmentstyle\"><a href=\"#touchbarsegmentedcontrolsegmentstyle\"><code>touchBarSegmentedControl.segmentStyle</code></a></h4>\n<p>A <code>String</code> representing the controls current segment style. Updating this value immediately updates the control\nin the touch bar.</p>\n<h4 id=\"touchbarsegmentedcontrolsegments\"><a href=\"#touchbarsegmentedcontrolsegments\"><code>touchBarSegmentedControl.segments</code></a></h4>\n<p>A <code>SegmentedControlSegment[]</code> array representing the segments in this control. Updating this value immediately\nupdates the control in the touch bar. Updating deep properties inside this array <strong>does not update the touch bar</strong>.</p>\n<h4 id=\"touchbarsegmentedcontrolselectedindex\"><a href=\"#touchbarsegmentedcontrolselectedindex\"><code>touchBarSegmentedControl.selectedIndex</code></a></h4>\n<p>An <code>Integer</code> representing the currently selected segment. Changing this value immediately updates the control\nin the touch bar. User interaction with the touch bar will update this value automatically.</p>\n<h4 id=\"touchbarsegmentedcontrolmode\"><a href=\"#touchbarsegmentedcontrolmode\"><code>touchBarSegmentedControl.mode</code></a></h4>\n<p>A <code>String</code> representing the current selection mode of the control.  Can be <code>single</code>, <code>multiple</code> or <code>buttons</code>.</p>",
      "title": "TouchBarSegmentedControl",
      "description": "Create a segmented control (a button group) where one button has a selected state"
    },
    "/docs/api/touch-bar-slider": {
      "locale": "en-US",
      "slug": "touch-bar-slider",
      "href": "/docs/api/touch-bar-slider",
      "crowdinFileId": "256391",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-slider.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarslider\"><a href=\"#class-touchbarslider\">Class: TouchBarSlider</a></h2>\n<blockquote>\n<p>Create a slider in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarslideroptions\"><a href=\"#new-touchbarslideroptions\"><code>new TouchBarSlider(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>label</code> String (optional) - Label text.</li>\n<li><code>value</code> Integer (optional) - Selected value.</li>\n<li><code>minValue</code> Integer (optional) - Minimum value.</li>\n<li><code>maxValue</code> Integer (optional) - Maximum value.</li>\n<li><code>change</code> Function (optional) - Function to call when the slider is changed.<ul>\n<li><code>newValue</code> Number - The value that the user selected on the Slider.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<p>The following properties are available on instances of <code>TouchBarSlider</code>:</p>\n<h4 id=\"touchbarsliderlabel\"><a href=\"#touchbarsliderlabel\"><code>touchBarSlider.label</code></a></h4>\n<p>A <code>String</code> representing the slider's current text. Changing this value immediately updates the slider\nin the touch bar.</p>\n<h4 id=\"touchbarslidervalue\"><a href=\"#touchbarslidervalue\"><code>touchBarSlider.value</code></a></h4>\n<p>A <code>Number</code> representing the slider's current value. Changing this value immediately updates the slider\nin the touch bar.</p>\n<h4 id=\"touchbarsliderminvalue\"><a href=\"#touchbarsliderminvalue\"><code>touchBarSlider.minValue</code></a></h4>\n<p>A <code>Number</code> representing the slider's current minimum value. Changing this value immediately updates the\nslider in the touch bar.</p>\n<h4 id=\"touchbarslidermaxvalue\"><a href=\"#touchbarslidermaxvalue\"><code>touchBarSlider.maxValue</code></a></h4>\n<p>A <code>Number</code> representing the slider's current maximum value. Changing this value immediately updates the\nslider in the touch bar.</p>",
      "title": "TouchBarSlider",
      "description": "Create a slider in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-spacer": {
      "locale": "en-US",
      "slug": "touch-bar-spacer",
      "href": "/docs/api/touch-bar-spacer",
      "crowdinFileId": "256393",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-spacer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarspacer\"><a href=\"#class-touchbarspacer\">Class: TouchBarSpacer</a></h2>\n<blockquote>\n<p>Create a spacer between two items in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarspaceroptions\"><a href=\"#new-touchbarspaceroptions\"><code>new TouchBarSpacer(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>size</code> String (optional) - Size of spacer, possible values are:<ul>\n<li><code>small</code> - Small space between items. Maps to <code>NSTouchBarItemIdentifierFixedSpaceSmall</code>. This is the default.</li>\n<li><code>large</code> - Large space between items. Maps to <code>NSTouchBarItemIdentifierFixedSpaceLarge</code>.</li>\n<li><code>flexible</code> - Take up all available space. Maps to <code>NSTouchBarItemIdentifierFlexibleSpace</code>.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<p>The following properties are available on instances of <code>TouchBarSpacer</code>:</p>\n<h4 id=\"touchbarspacersize\"><a href=\"#touchbarspacersize\"><code>touchBarSpacer.size</code></a></h4>\n<p>A <code>String</code> representing the size of the spacer.  Can be <code>small</code>, <code>large</code> or <code>flexible</code>.</p>",
      "title": "TouchBarSpacer",
      "description": "Create a spacer between two items in the touch bar for native macOS applications"
    },
    "/docs/api/structures/trace-categories-and-options": {
      "locale": "en-US",
      "slug": "trace-categories-and-options",
      "href": "/docs/api/structures/trace-categories-and-options",
      "crowdinFileId": "256517",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/trace-categories-and-options.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"tracecategoriesandoptions-object\"><a href=\"#tracecategoriesandoptions-object\">TraceCategoriesAndOptions Object</a></h1>\n<ul>\n<li><code>categoryFilter</code> String - A filter to control what category groups\nshould be traced. A filter can have an optional '-' prefix to exclude\ncategory groups that contain a matching category. Having both included\nand excluded category patterns in the same list is not supported. Examples:\n<code>test_MyTest*</code>, <code>test_MyTest*,test_OtherStuff</code>, <code>-excluded_category1,-excluded_category2</code>.</li>\n<li><code>traceOptions</code> String - Controls what kind of tracing is enabled,\nit is a comma-delimited sequence of the following strings:\n<code>record-until-full</code>, <code>record-continuously</code>, <code>trace-to-console</code>, <code>enable-sampling</code>, <code>enable-systrace</code>,\ne.g. <code>'record-until-full,enable-sampling'</code>.\nThe first 3 options are trace recording modes and hence mutually exclusive.\nIf more than one trace recording modes appear in the <code>traceOptions</code> string,\nthe last one takes precedence. If none of the trace recording modes are\nspecified, recording mode is <code>record-until-full</code>.\nThe trace option will first be reset to the default option (<code>record_mode</code> set\nto <code>record-until-full</code>, <code>enable_sampling</code> and <code>enable_systrace</code>\nset to <code>false</code>) before options parsed from <code>traceOptions</code> are applied on it.</li>\n</ul>",
      "title": "TraceCategoriesAndOptions Object",
      "description": ""
    },
    "/docs/api/structures/trace-config": {
      "locale": "en-US",
      "slug": "trace-config",
      "href": "/docs/api/structures/trace-config",
      "crowdinFileId": "256519",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/trace-config.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"traceconfig-object\"><a href=\"#traceconfig-object\">TraceConfig Object</a></h1>\n<ul>\n<li><code>recording_mode</code> String (optional) - Can be <code>record-until-full</code>, <code>record-continuously</code>, <code>record-as-much-as-possible</code> or <code>trace-to-console</code>. Defaults to <code>record-until-full</code>.</li>\n<li><code>trace_buffer_size_in_kb</code> number (optional) - maximum size of the trace\nrecording buffer in kilobytes. Defaults to 100MB.</li>\n<li><code>trace_buffer_size_in_events</code> number (optional) - maximum size of the trace\nrecording buffer in events.</li>\n<li><code>enable_argument_filter</code> boolean (optional) - if true, filter event data\naccording to a specific list of events that have been manually vetted to not\ninclude any PII. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/services/tracing/public/cpp/trace_event_args_whitelist.cc\">the implementation in\nChromium</a> for specifics.</li>\n<li><code>included_categories</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of tracing categories to\ninclude. Can include glob-like patterns using <code>*</code> at the end of the category\nname. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">tracing categories</a> for the list of categories.</li>\n<li><code>excluded_categories</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of tracing categories to\nexclude. Can include glob-like patterns using <code>*</code> at the end of the category\nname. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">tracing categories</a> for the list of categories.</li>\n<li><code>included_process_ids</code> number<a href=\"/docs/api/structures/optional\"></a> - a list of process IDs to\ninclude in the trace. If not specified, trace all processes.</li>\n<li><code>histogram_names</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of <a href=\"https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md\">histogram</a> names to report\nwith the trace.</li>\n<li><code>memory_dump_config</code> Record&#x3C;String, any> (optional) - if the\n<code>disabled-by-default-memory-infra</code> category is enabled, this contains\noptional additional configuration for data collection. See the <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/memory-infra/memory_infra_startup_tracing.md#the-advanced-way\">Chromium\nmemory-infra docs</a> for more information.</li>\n</ul>\n<p>An example TraceConfig that roughly matches what Chrome DevTools records:</p>\n<pre><code class=\"hljs language-js\">{\n  <span class=\"hljs-attr\">recording_mode</span>: <span class=\"hljs-string\">'record-until-full'</span>,\n  <span class=\"hljs-attr\">included_categories</span>: [\n    <span class=\"hljs-string\">'devtools.timeline'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline.frame'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline.stack'</span>,\n    <span class=\"hljs-string\">'v8.execute'</span>,\n    <span class=\"hljs-string\">'blink.console'</span>,\n    <span class=\"hljs-string\">'blink.user_timing'</span>,\n    <span class=\"hljs-string\">'latencyInfo'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-v8.cpu_profiler'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-v8.cpu_profiler.hires'</span>\n  ],\n  <span class=\"hljs-attr\">excluded_categories</span>: [<span class=\"hljs-string\">'*'</span>]\n}\n</code></pre>",
      "title": "TraceConfig Object",
      "description": ""
    },
    "/docs/api/structures/transaction": {
      "locale": "en-US",
      "slug": "transaction",
      "href": "/docs/api/structures/transaction",
      "crowdinFileId": "256521",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/transaction.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"transaction-object\"><a href=\"#transaction-object\">Transaction Object</a></h1>\n<ul>\n<li><code>transactionIdentifier</code> String - A string that uniquely identifies a successful payment transaction.</li>\n<li><code>transactionDate</code> String - The date the transaction was added to the App Store’s payment queue.</li>\n<li><code>originalTransactionIdentifier</code> String - The identifier of the restored transaction by the App Store.</li>\n<li><code>transactionState</code> String - The transaction state, can be <code>purchasing</code>, <code>purchased</code>, <code>failed</code>, <code>restored</code> or <code>deferred</code>.</li>\n<li><code>errorCode</code> Integer - The error code if an error occurred while processing the transaction.</li>\n<li><code>errorMessage</code> String - The error message if an error occurred while processing the transaction.</li>\n<li><code>payment</code> Object<ul>\n<li><code>productIdentifier</code> String - The identifier of the purchased product.</li>\n<li><code>quantity</code> Integer  - The quantity purchased.</li>\n</ul></li>\n</ul>",
      "title": "Transaction Object",
      "description": ""
    },
    "/docs/api/tray": {
      "locale": "en-US",
      "slug": "tray",
      "href": "/docs/api/tray",
      "crowdinFileId": "256397",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/tray.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"tray\"><a href=\"#tray\">Tray</a></h1>\n<h2 id=\"class-tray\"><a href=\"#class-tray\">Class: Tray</a></h2>\n<blockquote>\n<p>Add icons and context menus to the system's notification area.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>Tray</code> is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> tray = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/my/icon'</span>)\n  <span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item3'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item4'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n  ])\n  tray.setToolTip(<span class=\"hljs-string\">'This is my application.'</span>)\n  tray.setContextMenu(contextMenu)\n})\n</code></pre>\n<p><strong>Platform limitations:</strong></p>\n<ul>\n<li>On Linux the app indicator will be used if it is supported, otherwise\n<code>GtkStatusIcon</code> will be used instead.</li>\n<li>On Linux distributions that only have app indicator support, you have to\ninstall <code>libappindicator1</code> to make the tray icon work.</li>\n<li>App indicator will only be shown when it has a context menu.</li>\n<li>When app indicator is used on Linux, the <code>click</code> event is ignored.</li>\n<li>On Linux in order for changes made to individual <code>MenuItem</code>s to take effect,\nyou have to call <code>setContextMenu</code> again. For example:</li>\n</ul>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> appIcon = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/my/icon'</span>)\n  <span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n  ])\n\n  <span class=\"hljs-comment\">// Make a change to the context menu</span>\n  contextMenu.items[<span class=\"hljs-number\">1</span>].checked = <span class=\"hljs-literal\">false</span>\n\n  <span class=\"hljs-comment\">// Call this again for Linux because we modified the context menu</span>\n  appIcon.setContextMenu(contextMenu)\n})\n</code></pre>\n<ul>\n<li>On Windows it is recommended to use <code>ICO</code> icons to get best visual effects.</li>\n</ul>\n<p>If you want to keep exact same behaviors on all platforms, you should not\nrely on the <code>click</code> event and always attach a context menu to the tray icon.</p>\n<h3 id=\"new-trayimage-guid\"><a href=\"#new-trayimage-guid\"><code>new Tray(image, [guid])</code></a></h3>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n<li><code>guid</code> String (optional) <em>Windows</em> - Assigns a GUID to the tray icon. If the executable is signed and the signature contains an organization in the subject line then the GUID is permanently associated with that signature. OS level settings like the position of the tray icon in the system tray will persist even if the path to the executable changes. If the executable is not code-signed then the GUID is permanently associated with the path to the executable. Changing the path to the executable will break the creation of the tray icon and a new GUID must be used. However, it is highly recommended to use the GUID parameter only in conjunction with code-signed executable. If an App defines multiple tray icons then each icon must use a separate GUID.</li>\n</ul>\n<p>Creates a new tray icon associated with the <code>image</code>.</p>\n<h3 id=\"instance-events\"><a href=\"#instance-events\">Instance Events</a></h3>\n<p>The <code>Tray</code> module emits the following events:</p>\n<h4 id=\"event-click\"><a href=\"#event-click\">Event: 'click'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - The bounds of tray icon.</li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - The position of the event.</li>\n</ul>\n<p>Emitted when the tray icon is clicked.</p>\n<h4 id=\"event-right-click-macos-windows\"><a href=\"#event-right-click-macos-windows\">Event: 'right-click' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - The bounds of tray icon.</li>\n</ul>\n<p>Emitted when the tray icon is right clicked.</p>\n<h4 id=\"event-double-click-macos-windows\"><a href=\"#event-double-click-macos-windows\">Event: 'double-click' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - The bounds of tray icon.</li>\n</ul>\n<p>Emitted when the tray icon is double clicked.</p>\n<h4 id=\"event-balloon-show-windows\"><a href=\"#event-balloon-show-windows\">Event: 'balloon-show' <em>Windows</em></a></h4>\n<p>Emitted when the tray balloon shows.</p>\n<h4 id=\"event-balloon-click-windows\"><a href=\"#event-balloon-click-windows\">Event: 'balloon-click' <em>Windows</em></a></h4>\n<p>Emitted when the tray balloon is clicked.</p>\n<h4 id=\"event-balloon-closed-windows\"><a href=\"#event-balloon-closed-windows\">Event: 'balloon-closed' <em>Windows</em></a></h4>\n<p>Emitted when the tray balloon is closed because of timeout or user manually\ncloses it.</p>\n<h4 id=\"event-drop-macos\"><a href=\"#event-drop-macos\">Event: 'drop' <em>macOS</em></a></h4>\n<p>Emitted when any dragged items are dropped on the tray icon.</p>\n<h4 id=\"event-drop-files-macos\"><a href=\"#event-drop-files-macos\">Event: 'drop-files' <em>macOS</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>files</code> String[] - The paths of the dropped files.</li>\n</ul>\n<p>Emitted when dragged files are dropped in the tray icon.</p>\n<h4 id=\"event-drop-text-macos\"><a href=\"#event-drop-text-macos\">Event: 'drop-text' <em>macOS</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>text</code> String - the dropped text string.</li>\n</ul>\n<p>Emitted when dragged text is dropped in the tray icon.</p>\n<h4 id=\"event-drag-enter-macos\"><a href=\"#event-drag-enter-macos\">Event: 'drag-enter' <em>macOS</em></a></h4>\n<p>Emitted when a drag operation enters the tray icon.</p>\n<h4 id=\"event-drag-leave-macos\"><a href=\"#event-drag-leave-macos\">Event: 'drag-leave' <em>macOS</em></a></h4>\n<p>Emitted when a drag operation exits the tray icon.</p>\n<h4 id=\"event-drag-end-macos\"><a href=\"#event-drag-end-macos\">Event: 'drag-end' <em>macOS</em></a></h4>\n<p>Emitted when a drag operation ends on the tray or ends at another location.</p>\n<h4 id=\"event-mouse-up-macos\"><a href=\"#event-mouse-up-macos\">Event: 'mouse-up' <em>macOS</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - The position of the event.</li>\n</ul>\n<p>Emitted when the mouse is released from clicking the tray icon.</p>\n<p>Note: This will not be emitted if you have set a context menu for your Tray using <code>tray.setContextMenu</code>, as a result of macOS-level constraints.</p>\n<h4 id=\"event-mouse-down-macos\"><a href=\"#event-mouse-down-macos\">Event: 'mouse-down' <em>macOS</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - The position of the event.</li>\n</ul>\n<p>Emitted when the mouse clicks the tray icon.</p>\n<h4 id=\"event-mouse-enter-macos\"><a href=\"#event-mouse-enter-macos\">Event: 'mouse-enter' <em>macOS</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - The position of the event.</li>\n</ul>\n<p>Emitted when the mouse enters the tray icon.</p>\n<h4 id=\"event-mouse-leave-macos\"><a href=\"#event-mouse-leave-macos\">Event: 'mouse-leave' <em>macOS</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - The position of the event.</li>\n</ul>\n<p>Emitted when the mouse exits the tray icon.</p>\n<h4 id=\"event-mouse-move-macos-windows\"><a href=\"#event-mouse-move-macos-windows\">Event: 'mouse-move' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - The position of the event.</li>\n</ul>\n<p>Emitted when the mouse moves in the tray icon.</p>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<p>The <code>Tray</code> class has the following methods:</p>\n<h4 id=\"traydestroy\"><a href=\"#traydestroy\"><code>tray.destroy()</code></a></h4>\n<p>Destroys the tray icon immediately.</p>\n<h4 id=\"traysetimageimage\"><a href=\"#traysetimageimage\"><code>tray.setImage(image)</code></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>Sets the <code>image</code> associated with this tray icon.</p>\n<h4 id=\"traysetpressedimageimage-macos\"><a href=\"#traysetpressedimageimage-macos\"><code>tray.setPressedImage(image)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>Sets the <code>image</code> associated with this tray icon when pressed on macOS.</p>\n<h4 id=\"traysettooltiptooltip\"><a href=\"#traysettooltiptooltip\"><code>tray.setToolTip(toolTip)</code></a></h4>\n<ul>\n<li><code>toolTip</code> String</li>\n</ul>\n<p>Sets the hover text for this tray icon.</p>\n<h4 id=\"traysettitletitle-options-macos\"><a href=\"#traysettitletitle-options-macos\"><code>tray.setTitle(title[, options])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>title</code> String</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>fontType</code> String (optional) - The font family variant to display, can be <code>monospaced</code> or <code>monospacedDigit</code>. <code>monospaced</code> is available in macOS 10.15+ and <code>monospacedDigit</code> is available in macOS 10.11+.  When left blank, the title uses the default system font.</li>\n</ul></li>\n</ul>\n<p>Sets the title displayed next to the tray icon in the status bar (Support ANSI colors).</p>\n<h4 id=\"traygettitle-macos\"><a href=\"#traygettitle-macos\"><code>tray.getTitle()</code> <em>macOS</em></a></h4>\n<p>Returns <code>String</code> - the title displayed next to the tray icon in the status bar</p>\n<h4 id=\"traysetignoredoubleclickeventsignore-macos\"><a href=\"#traysetignoredoubleclickeventsignore-macos\"><code>tray.setIgnoreDoubleClickEvents(ignore)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n</ul>\n<p>Sets the option to ignore double click events. Ignoring these events allows you\nto detect every individual click of the tray icon.</p>\n<p>This value is set to false by default.</p>\n<h4 id=\"traygetignoredoubleclickevents-macos\"><a href=\"#traygetignoredoubleclickevents-macos\"><code>tray.getIgnoreDoubleClickEvents()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether double click events will be ignored.</p>\n<h4 id=\"traydisplayballoonoptions-windows\"><a href=\"#traydisplayballoonoptions-windows\"><code>tray.displayBalloon(options)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (optional) - Icon to use when <code>iconType</code> is <code>custom</code>.</li>\n<li><code>iconType</code> String (optional) - Can be <code>none</code>, <code>info</code>, <code>warning</code>, <code>error</code> or <code>custom</code>. Default is <code>custom</code>.</li>\n<li><code>title</code> String</li>\n<li><code>content</code> String</li>\n<li><code>largeIcon</code> Boolean (optional) - The large version of the icon should be used. Default is <code>true</code>. Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_large_icon-0x00000020\"><code>NIIF_LARGE_ICON</code></a>.</li>\n<li><code>noSound</code> Boolean (optional) - Do not play the associated sound. Default is <code>false</code>. Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_nosound-0x00000010\"><code>NIIF_NOSOUND</code></a>.</li>\n<li><code>respectQuietTime</code> Boolean (optional) - Do not display the balloon notification if the current user is in \"quiet time\". Default is <code>false</code>. Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_respect_quiet_time-0x00000080\"><code>NIIF_RESPECT_QUIET_TIME</code></a>.</li>\n</ul></li>\n</ul>\n<p>Displays a tray balloon.</p>\n<h4 id=\"trayremoveballoon-windows\"><a href=\"#trayremoveballoon-windows\"><code>tray.removeBalloon()</code> <em>Windows</em></a></h4>\n<p>Removes a tray balloon.</p>\n<h4 id=\"trayfocus-windows\"><a href=\"#trayfocus-windows\"><code>tray.focus()</code> <em>Windows</em></a></h4>\n<p>Returns focus to the taskbar notification area.\nNotification area icons should use this message when they have completed their UI operation.\nFor example, if the icon displays a shortcut menu, but the user presses ESC to cancel it,\nuse <code>tray.focus()</code> to return focus to the notification area.</p>\n<h4 id=\"traypopupcontextmenumenu-position-macos-windows\"><a href=\"#traypopupcontextmenumenu-position-macos-windows\"><code>tray.popUpContextMenu([menu, position])</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>menu</code> Menu (optional)</li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> (optional) - The pop up position.</li>\n</ul>\n<p>Pops up the context menu of the tray icon. When <code>menu</code> is passed, the <code>menu</code> will\nbe shown instead of the tray icon's context menu.</p>\n<p>The <code>position</code> is only available on Windows, and it is (0, 0) by default.</p>\n<h4 id=\"trayclosecontextmenu-macos-windows\"><a href=\"#trayclosecontextmenu-macos-windows\"><code>tray.closeContextMenu()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Closes an open context menu, as set by <code>tray.setContextMenu()</code>.</p>\n<h4 id=\"traysetcontextmenumenu\"><a href=\"#traysetcontextmenumenu\"><code>tray.setContextMenu(menu)</code></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Sets the context menu for this icon.</p>\n<h4 id=\"traygetbounds-macos-windows\"><a href=\"#traygetbounds-macos-windows\"><code>tray.getBounds()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>The <code>bounds</code> of this tray icon as <code>Object</code>.</p>\n<h4 id=\"trayisdestroyed\"><a href=\"#trayisdestroyed\"><code>tray.isDestroyed()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the tray icon is destroyed.</p>",
      "title": "Tray",
      "description": "Add icons and context menus to the system's notification area."
    },
    "/docs/tutorial/tray": {
      "locale": "en-US",
      "slug": "tray",
      "href": "/docs/tutorial/tray",
      "crowdinFileId": "256259",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/tray.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<hr>\n<p>title: Tray\ndescription: This guide will take you through the process of creating\na Tray icon with its own context menu to the system's notification area.\nslug: tray</p>\n<h2 id=\"hide_title-true\"><a href=\"#hide_title-true\">hide_title: true</a></h2>\n<h1 id=\"tray\"><a href=\"#tray\">Tray</a></h1>\n<h2 id=\"overview\"><a href=\"#overview\">Overview</a></h2>\n<!-- ✍ Update this section if you want to provide more details -->\n<p>This guide will take you through the process of creating a\n<a href=\"https://www.electronjs.org/docs/api/tray\">Tray</a> icon with\nits own context menu to the system's notification area.</p>\n<p>On MacOS and Ubuntu, the Tray will be located on the top\nright corner of your screen, adjacent to your battery and wifi icons.\nOn Windows, the Tray will usually be located in the bottom right corner.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<h3 id=\"mainjs\"><a href=\"#mainjs\">main.js</a></h3>\n<p>First we must import <code>app</code>, <code>Tray</code>, <code>Menu</code>, <code>nativeImage</code> from <code>electron</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, Tray, Menu, nativeImage } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>Next we will create our Tray. To do this, we will use a\n<a href=\"https://www.electronjs.org/docs/api/native-image\"><code>NativeImage</code></a> icon,\nwhich can be created through any one of these\n<a href=\"https://www.electronjs.org/docs/api/native-image#methods\">methods</a>.\nNote that we wrap our Tray creation code within an\n<a href=\"https://www.electronjs.org/docs/api/app#appwhenready\"><code>app.whenReady</code></a>\nas we will need to wait for our electron app to finish initializing.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">let</span> tray\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> icon = nativeImage.createFromPath(<span class=\"hljs-string\">'path/to/asset.png'</span>)\n  tray = <span class=\"hljs-keyword\">new</span> Tray(icon)\n\n  <span class=\"hljs-comment\">// note: your contextMenu, Tooltip and Title code will go here!</span>\n})\n</code></pre>\n<p>Great! Now we can start attaching a context menu to our Tray, like so:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item3'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item4'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n])\n\ntray.setContextMenu(contextMenu)\n</code></pre>\n<p>The code above will create 4 separate radio-type items in the context menu.\nTo read more about constructing native menus, click\n<a href=\"https://www.electronjs.org/docs/api/menu#menubuildfromtemplatetemplate\">here</a>.</p>\n<p>Finally, let's give our tray a tooltip and a title.</p>\n<pre><code class=\"hljs language-js\">tray.setToolTip(<span class=\"hljs-string\">'This is my application'</span>)\ntray.setTitle(<span class=\"hljs-string\">'This is my title'</span>)\n</code></pre>\n<h2 id=\"conclusion\"><a href=\"#conclusion\">Conclusion</a></h2>\n<p>After you start your electron app, you should see the Tray residing\nin either the top or bottom right of your screen, depending on your\noperating system.</p>",
      "title": "Tray",
      "description": ""
    },
    "/docs/tutorial/updates": {
      "locale": "en-US",
      "slug": "updates",
      "href": "/docs/tutorial/updates",
      "crowdinFileId": "256261",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/updates.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"updating-applications\"><a href=\"#updating-applications\">Updating Applications</a></h1>\n<p>There are several ways to update an Electron application. The easiest and\nofficially supported one is taking advantage of the built-in\n<a href=\"https://github.com/Squirrel\">Squirrel</a> framework and\nElectron's <a href=\"/docs/api/auto-updater\">autoUpdater</a> module.</p>\n<h2 id=\"using-updateelectronjsorg\"><a href=\"#using-updateelectronjsorg\">Using <code>update.electronjs.org</code></a></h2>\n<p>The Electron team maintains <a href=\"https://github.com/electron/update.electronjs.org\">update.electronjs.org</a>, a free and open-source\nwebservice that Electron apps can use to self-update. The service is designed\nfor Electron apps that meet the following criteria:</p>\n<ul>\n<li>App runs on macOS or Windows</li>\n<li>App has a public GitHub repository</li>\n<li>Builds are published to GitHub Releases</li>\n<li>Builds are code-signed</li>\n</ul>\n<p>The easiest way to use this service is by installing <a href=\"https://github.com/electron/update-electron-app\">update-electron-app</a>,\na Node.js module preconfigured for use with update.electronjs.org.</p>\n<p>Install the module:</p>\n<pre><code class=\"hljs language-sh\">npm install update-electron-app\n</code></pre>\n<p>Invoke the updater from your app's main process file:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'update-electron-app'</span>)()\n</code></pre>\n<p>By default, this module will check for updates at app startup, then every ten\nminutes. When an update is found, it will automatically be downloaded in the background. When the download completes, a dialog is displayed allowing the user\nto restart the app.</p>\n<p>If you need to customize your configuration, you can\n<a href=\"https://github.com/electron/update-electron-app\">pass options to <code>update-electron-app</code></a>\nor\n<a href=\"https://github.com/electron/update.electronjs.org\">use the update service directly</a>.</p>\n<h2 id=\"deploying-an-update-server\"><a href=\"#deploying-an-update-server\">Deploying an Update Server</a></h2>\n<p>If you're developing a private Electron application, or if you're not\npublishing releases to GitHub Releases, it may be necessary to run your own\nupdate server.</p>\n<p>Depending on your needs, you can choose from one of these:</p>\n<ul>\n<li><a href=\"https://github.com/vercel/hazel\">Hazel</a> – Update server for private or open-source apps which can be\ndeployed for free on <a href=\"https://vercel.com\">Vercel</a>. It pulls from <a href=\"https://help.github.com/articles/creating-releases/\">GitHub Releases</a>\nand leverages the power of GitHub's CDN.</li>\n<li><a href=\"https://github.com/GitbookIO/nuts\">Nuts</a> – Also uses <a href=\"https://help.github.com/articles/creating-releases/\">GitHub Releases</a>, but caches app\nupdates on disk and supports private repositories.</li>\n<li><a href=\"https://github.com/ArekSredzki/electron-release-server\">electron-release-server</a> – Provides a dashboard for\nhandling releases and does not require releases to originate on GitHub.</li>\n<li><a href=\"https://github.com/atlassian/nucleus\">Nucleus</a> – A complete update server for Electron apps maintained by\nAtlassian. Supports multiple applications and channels; uses a static file store\nto minify server cost.</li>\n</ul>\n<h2 id=\"implementing-updates-in-your-app\"><a href=\"#implementing-updates-in-your-app\">Implementing Updates in Your App</a></h2>\n<p>Once you've deployed your update server, continue with importing the required\nmodules in your code. The following code might vary for different server\nsoftware, but it works like described when using\n<a href=\"https://github.com/vercel/hazel\">Hazel</a>.</p>\n<p><strong>Important:</strong> Please ensure that the code below will only be executed in\nyour packaged app, and not in development. You can use\n<a href=\"https://github.com/sindresorhus/electron-is-dev\">electron-is-dev</a> to check for\nthe environment.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, autoUpdater, dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>Next, construct the URL of the update server and tell\n<a href=\"/docs/api/auto-updater\">autoUpdater</a> about it:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> server = <span class=\"hljs-string\">'https://your-deployment-url.com'</span>\n<span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-string\">`<span class=\"hljs-subst\">${server}</span>/update/<span class=\"hljs-subst\">${process.platform}</span>/<span class=\"hljs-subst\">${app.getVersion()}</span>`</span>\n\nautoUpdater.setFeedURL({ url })\n</code></pre>\n<p>As the final step, check for updates. The example below will check every minute:</p>\n<pre><code class=\"hljs language-javascript\">setInterval(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  autoUpdater.checkForUpdates()\n}, <span class=\"hljs-number\">60000</span>)\n</code></pre>\n<p>Once your application is <a href=\"/docs/tutorial/application-distribution\">packaged</a>,\nit will receive an update for each new\n<a href=\"https://help.github.com/articles/creating-releases/\">GitHub Release</a> that you\npublish.</p>\n<h2 id=\"applying-updates\"><a href=\"#applying-updates\">Applying Updates</a></h2>\n<p>Now that you've configured the basic update mechanism for your application, you\nneed to ensure that the user will get notified when there's an update. This\ncan be achieved using the autoUpdater API\n<a href=\"/docs/api/auto-updater#events\">events</a>:</p>\n<pre><code class=\"hljs language-javascript\">autoUpdater.on(<span class=\"hljs-string\">'update-downloaded'</span>, (event, releaseNotes, releaseName) => {\n  <span class=\"hljs-keyword\">const</span> dialogOpts = {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'info'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Restart'</span>, <span class=\"hljs-string\">'Later'</span>],\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Application Update'</span>,\n    <span class=\"hljs-attr\">message</span>: process.platform === <span class=\"hljs-string\">'win32'</span> ? releaseNotes : releaseName,\n    <span class=\"hljs-attr\">detail</span>: <span class=\"hljs-string\">'A new version has been downloaded. Restart the application to apply the updates.'</span>\n  }\n\n  dialog.showMessageBox(dialogOpts).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">returnValue</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (returnValue.response === <span class=\"hljs-number\">0</span>) autoUpdater.quitAndInstall()\n  })\n})\n</code></pre>\n<p>Also make sure that errors are\n<a href=\"/docs/api/auto-updater#event-error\">being handled</a>. Here's an example\nfor logging them to <code>stderr</code>:</p>\n<pre><code class=\"hljs language-javascript\">autoUpdater.on(<span class=\"hljs-string\">'error'</span>, message => {\n  <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'There was a problem updating the application'</span>)\n  <span class=\"hljs-built_in\">console</span>.error(message)\n})\n</code></pre>\n<h2 id=\"handling-updates-manually\"><a href=\"#handling-updates-manually\">Handling Updates Manually</a></h2>\n<p>Because the requests made by Auto Update aren't under your direct control, you may find situations that are difficult to handle (such as if the update server is behind authentication). The <code>url</code> field does support files, which means that with some effort, you can sidestep the server-communication aspect of the process. <a href=\"https://github.com/electron/electron/issues/5020#issuecomment-477636990\">Here's an example of how this could work</a>.</p>",
      "title": "Updating Applications",
      "description": ""
    },
    "/docs/api/structures/upload-data": {
      "locale": "en-US",
      "slug": "upload-data",
      "href": "/docs/api/structures/upload-data",
      "crowdinFileId": "256523",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploaddata-object\"><a href=\"#uploaddata-object\">UploadData Object</a></h1>\n<ul>\n<li><code>bytes</code> Buffer - Content being sent.</li>\n<li><code>file</code> String (optional) - Path of file being uploaded.</li>\n<li><code>blobUUID</code> String (optional) - UUID of blob data. Use <a href=\"/docs/api/session#sesgetblobdataidentifier\">ses.getBlobData</a> method\nto retrieve the data.</li>\n</ul>",
      "title": "UploadData Object",
      "description": ""
    },
    "/docs/api/structures/upload-file": {
      "locale": "en-US",
      "slug": "upload-file",
      "href": "/docs/api/structures/upload-file",
      "crowdinFileId": "256525",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-file.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploadfile-object\"><a href=\"#uploadfile-object\">UploadFile Object</a></h1>\n<ul>\n<li><code>type</code> 'file' - <code>file</code>.</li>\n<li><code>filePath</code> String - Path of file to be uploaded.</li>\n<li><code>offset</code> Integer - Defaults to <code>0</code>.</li>\n<li><code>length</code> Integer - Number of bytes to read from <code>offset</code>.\nDefaults to <code>0</code>.</li>\n<li><code>modificationTime</code> Double - Last Modification time in\nnumber of seconds since the UNIX epoch.</li>\n</ul>",
      "title": "UploadFile Object",
      "description": ""
    },
    "/docs/api/structures/upload-raw-data": {
      "locale": "en-US",
      "slug": "upload-raw-data",
      "href": "/docs/api/structures/upload-raw-data",
      "crowdinFileId": "256527",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-raw-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploadrawdata-object\"><a href=\"#uploadrawdata-object\">UploadRawData Object</a></h1>\n<ul>\n<li><code>type</code> 'rawData' - <code>rawData</code>.</li>\n<li><code>bytes</code> Buffer - Data to be uploaded.</li>\n</ul>",
      "title": "UploadRawData Object",
      "description": ""
    },
    "/docs/api/structures/user-default-types": {
      "locale": "en-US",
      "slug": "user-default-types",
      "href": "/docs/api/structures/user-default-types",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/user-default-types.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"userdefaulttypes-object\"><a href=\"#userdefaulttypes-object\">UserDefaultTypes Object</a></h1>\n<ul>\n<li><code>string</code> String</li>\n<li><code>boolean</code> Boolean</li>\n<li><code>integer</code> Number</li>\n<li><code>float</code> Number</li>\n<li><code>double</code> Number</li>\n<li><code>url</code> String</li>\n<li><code>array</code> Array\\<unknown></unknown></li>\n<li><code>dictionary</code> Record\\&#x3C;string, unknown></li>\n</ul>\n<p>This type is a helper alias, no object will never exist of this type.</p>",
      "title": "UserDefaultTypes Object",
      "description": ""
    },
    "/docs/tutorial/using-native-node-modules": {
      "locale": "en-US",
      "slug": "using-native-node-modules",
      "href": "/docs/tutorial/using-native-node-modules",
      "crowdinFileId": "256263",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-native-node-modules.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"native-node-modules\"><a href=\"#native-node-modules\">Native Node Modules</a></h1>\n<p>Native Node.js modules are supported by Electron, but since Electron has a different\n<a href=\"https://en.wikipedia.org/wiki/Application_binary_interface\">application binary interface (ABI)</a> from a given Node.js binary (due to\ndifferences such as using Chromium's BoringSSL instead of OpenSSL), the native\nmodules you use will need to be recompiled for Electron. Otherwise,\nyou will get the following class of error when you try to run your app:</p>\n<pre><code class=\"hljs language-sh\">Error: The module <span class=\"hljs-string\">'/path/to/native/module.node'</span>\nwas compiled against a different Node.js version using\nNODE_MODULE_VERSION <span class=\"hljs-variable\">$XYZ</span>. This version of Node.js requires\nNODE_MODULE_VERSION <span class=\"hljs-variable\">$ABC</span>. Please try re-compiling or re-installing\nthe module (<span class=\"hljs-keyword\">for</span> instance, using `npm rebuild` or `npm install`).\n</code></pre>\n<h2 id=\"how-to-install-native-modules\"><a href=\"#how-to-install-native-modules\">How to install native modules</a></h2>\n<p>There are several different ways to install native modules:</p>\n<h3 id=\"installing-modules-and-rebuilding-for-electron\"><a href=\"#installing-modules-and-rebuilding-for-electron\">Installing modules and rebuilding for Electron</a></h3>\n<p>You can install modules like other Node projects, and then rebuild the modules\nfor Electron with the <a href=\"https://github.com/electron/electron-rebuild\"><code>electron-rebuild</code></a> package. This\nmodule can automatically determine the version of Electron and handle the\nmanual steps of downloading headers and rebuilding native modules for your app.\nIf you are using <a href=\"https://electronforge.io/\">Electron Forge</a>, this tool is used automatically\nin both development mode and when making distributables.</p>\n<p>For example, to install the standalone <code>electron-rebuild</code> tool and then rebuild\nmodules with it via the command line:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron-rebuild\n\n<span class=\"hljs-comment\"># Every time you run \"npm install\", run this:</span>\n./node_modules/.bin/electron-rebuild\n\n<span class=\"hljs-comment\"># If you have trouble on Windows, try:</span>\n.\\node_modules\\.bin\\electron-rebuild.cmd\n</code></pre>\n<p>For more information on usage and integration with other tools such as <a href=\"https://github.com/electron/electron-packager\">Electron\nPackager</a>, consult the project's README.</p>\n<h3 id=\"using-npm\"><a href=\"#using-npm\">Using <code>npm</code></a></h3>\n<p>By setting a few environment variables, you can use <code>npm</code> to install modules\ndirectly.</p>\n<p>For example, to install all dependencies for Electron:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-comment\"># Electron's version.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_target=1.2.3\n<span class=\"hljs-comment\"># The architecture of Electron, see https://electronjs.org/docs/tutorial/support#supported-platforms</span>\n<span class=\"hljs-comment\"># for supported architectures.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_arch=x64\n<span class=\"hljs-built_in\">export</span> npm_config_target_arch=x64\n<span class=\"hljs-comment\"># Download headers for Electron.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_disturl=https://electronjs.org/headers\n<span class=\"hljs-comment\"># Tell node-pre-gyp that we are building for Electron.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_runtime=electron\n<span class=\"hljs-comment\"># Tell node-pre-gyp to build module from source code.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_build_from_source=<span class=\"hljs-literal\">true</span>\n<span class=\"hljs-comment\"># Install all dependencies, and store cache to ~/.electron-gyp.</span>\nHOME=~/.electron-gyp npm install\n</code></pre>\n<h3 id=\"manually-building-for-electron\"><a href=\"#manually-building-for-electron\">Manually building for Electron</a></h3>\n<p>If you are a developer developing a native module and want to test it against\nElectron, you might want to rebuild the module for Electron manually. You can\nuse <code>node-gyp</code> directly to build for Electron:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">cd</span> /path-to-module/\nHOME=~/.electron-gyp node-gyp rebuild --target=1.2.3 --arch=x64 --dist-url=https://electronjs.org/headers\n</code></pre>\n<ul>\n<li><code>HOME=~/.electron-gyp</code> changes where to find development headers.</li>\n<li><code>--target=1.2.3</code> is the version of Electron.</li>\n<li><code>--dist-url=...</code> specifies where to download the headers.</li>\n<li><code>--arch=x64</code> says the module is built for a 64-bit system.</li>\n</ul>\n<h3 id=\"manually-building-for-a-custom-build-of-electron\"><a href=\"#manually-building-for-a-custom-build-of-electron\">Manually building for a custom build of Electron</a></h3>\n<p>To compile native Node modules against a custom build of Electron that doesn't\nmatch a public release, instruct <code>npm</code> to use the version of Node you have bundled\nwith your custom build.</p>\n<pre><code class=\"hljs language-sh\">npm rebuild --nodedir=/path/to/src/out/Default/gen/node_headers\n</code></pre>\n<h2 id=\"troubleshooting\"><a href=\"#troubleshooting\">Troubleshooting</a></h2>\n<p>If you installed a native module and found it was not working, you need to check\nthe following things:</p>\n<ul>\n<li>When in doubt, run <code>electron-rebuild</code> first.</li>\n<li>Make sure the native module is compatible with the target platform and\narchitecture for your Electron app.</li>\n<li>Make sure <code>win_delay_load_hook</code> is not set to <code>false</code> in the module's <code>binding.gyp</code>.</li>\n<li>After you upgrade Electron, you usually need to rebuild the modules.</li>\n</ul>\n<h3 id=\"a-note-about-win_delay_load_hook\"><a href=\"#a-note-about-win_delay_load_hook\">A note about <code>win_delay_load_hook</code></a></h3>\n<p>On Windows, by default, <code>node-gyp</code> links native modules against <code>node.dll</code>.\nHowever, in Electron 4.x and higher, the symbols needed by native modules are\nexported by <code>electron.exe</code>, and there is no <code>node.dll</code>. In order to load native\nmodules on Windows, <code>node-gyp</code> installs a <a href=\"https://msdn.microsoft.com/en-us/library/z9h1h6ty.aspx\">delay-load\nhook</a> that triggers\nwhen the native module is loaded, and redirects the <code>node.dll</code> reference to use\nthe loading executable instead of looking for <code>node.dll</code> in the library search\npath (which would turn up nothing). As such, on Electron 4.x and higher,\n<code>'win_delay_load_hook': 'true'</code> is required to load native modules.</p>\n<p>If you get an error like <code>Module did not self-register</code>, or <code>The specified procedure could not be found</code>, it may mean that the module you're trying to use\ndid not correctly include the delay-load hook.  If the module is built with\nnode-gyp, ensure that the <code>win_delay_load_hook</code> variable is set to <code>true</code> in\nthe <code>binding.gyp</code> file, and isn't getting overridden anywhere.  If the module\nis built with another system, you'll need to ensure that you build with a\ndelay-load hook installed in the main <code>.node</code> file. Your <code>link.exe</code> invocation\nshould look like this:</p>\n<pre><code class=\"hljs language-plaintext\"> link.exe /OUT:\"foo.node\" \"...\\node.lib\" delayimp.lib /DELAYLOAD:node.exe /DLL\n     \"my_addon.obj\" \"win_delay_load_hook.obj\"\n</code></pre>\n<p>In particular, it's important that:</p>\n<ul>\n<li>you link against <code>node.lib</code> from <em>Electron</em> and not Node. If you link against\nthe wrong <code>node.lib</code> you will get load-time errors when you require the\nmodule in Electron.</li>\n<li>you include the flag <code>/DELAYLOAD:node.exe</code>. If the <code>node.exe</code> link is not\ndelayed, then the delay-load hook won't get a chance to fire and the node\nsymbols won't be correctly resolved.</li>\n<li><code>win_delay_load_hook.obj</code> is linked directly into the final DLL. If the hook\nis set up in a dependent DLL, it won't fire at the right time.</li>\n</ul>\n<p>See <a href=\"https://github.com/nodejs/node-gyp/blob/e2401e1395bef1d3c8acec268b42dc5fb71c4a38/src/win_delay_load_hook.cc\"><code>node-gyp</code></a>\nfor an example delay-load hook if you're implementing your own.</p>\n<h2 id=\"modules-that-rely-on-prebuild\"><a href=\"#modules-that-rely-on-prebuild\">Modules that rely on <code>prebuild</code></a></h2>\n<p><a href=\"https://github.com/prebuild/prebuild\"><code>prebuild</code></a> provides a way to publish\nnative Node modules with prebuilt binaries for multiple versions of Node\nand Electron.</p>\n<p>If the <code>prebuild</code>-powered module provide binaries for the usage in Electron,\nmake sure to omit <code>--build-from-source</code> and the <code>npm_config_build_from_source</code>\nenvironment variable in order to take full advantage of the prebuilt binaries.</p>\n<h2 id=\"modules-that-rely-on-node-pre-gyp\"><a href=\"#modules-that-rely-on-node-pre-gyp\">Modules that rely on <code>node-pre-gyp</code></a></h2>\n<p>The <a href=\"https://github.com/mapbox/node-pre-gyp\"><code>node-pre-gyp</code> tool</a> provides a way to deploy native Node\nmodules with prebuilt binaries, and many popular modules are using it.</p>\n<p>Sometimes those modules work fine under Electron, but when there are no\nElectron-specific binaries available, you'll need to build from source.\nBecause of this, it is recommended to use <code>electron-rebuild</code> for these modules.</p>\n<p>If you are following the <code>npm</code> way of installing modules, you'll need to pass\n<code>--build-from-source</code> to <code>npm</code>, or set the <code>npm_config_build_from_source</code>\nenvironment variable.</p>",
      "title": "Native Node Modules",
      "description": ""
    },
    "/docs/tutorial/using-pepper-flash-plugin": {
      "locale": "en-US",
      "slug": "using-pepper-flash-plugin",
      "href": "/docs/tutorial/using-pepper-flash-plugin",
      "crowdinFileId": "256265",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-pepper-flash-plugin.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"pepper-flash-plugin\"><a href=\"#pepper-flash-plugin\">Pepper Flash Plugin</a></h1>\n<p>Electron no longer supports the Pepper Flash plugin, as Chrome has removed support.</p>\n<p>See <a href=\"https://www.chromium.org/flash-roadmap\">Chromium's Flash Roadmap</a> for more\ndetails.</p>",
      "title": "Pepper Flash Plugin",
      "description": ""
    },
    "/docs/tutorial/using-selenium-and-webdriver": {
      "locale": "en-US",
      "slug": "using-selenium-and-webdriver",
      "href": "/docs/tutorial/using-selenium-and-webdriver",
      "crowdinFileId": "256267",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-selenium-and-webdriver.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"selenium-and-webdriver\"><a href=\"#selenium-and-webdriver\">Selenium and WebDriver</a></h1>\n<p>From <a href=\"https://sites.google.com/a/chromium.org/chromedriver/\">ChromeDriver - WebDriver for Chrome</a>:</p>\n<blockquote>\n<p>WebDriver is an open source tool for automated testing of web apps across many\nbrowsers. It provides capabilities for navigating to web pages, user input,\nJavaScript execution, and more. ChromeDriver is a standalone server which\nimplements WebDriver's wire protocol for Chromium. It is being developed by\nmembers of the Chromium and WebDriver teams.</p>\n</blockquote>\n<h2 id=\"setting-up-spectron\"><a href=\"#setting-up-spectron\">Setting up Spectron</a></h2>\n<p><a href=\"https://electronjs.org/spectron\">Spectron</a> is the officially supported ChromeDriver testing framework\nfor Electron. It is built on top of <a href=\"https://webdriver.io/\">WebdriverIO</a> and\nhas helpers to access Electron APIs in your tests and bundles ChromeDriver.</p>\n<pre><code class=\"hljs language-sh\">$ npm install --save-dev spectron\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// A simple test to verify a visible window is opened with a title</span>\n<span class=\"hljs-keyword\">const</span> Application = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spectron'</span>).Application\n<span class=\"hljs-keyword\">const</span> assert = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'assert'</span>)\n\n<span class=\"hljs-keyword\">const</span> myApp = <span class=\"hljs-keyword\">new</span> Application({\n  <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'/Applications/MyApp.app/Contents/MacOS/MyApp'</span>\n})\n\n<span class=\"hljs-keyword\">const</span> verifyWindowIsVisibleWithTitle = <span class=\"hljs-keyword\">async</span> (app) => {\n  <span class=\"hljs-keyword\">await</span> app.start()\n  <span class=\"hljs-keyword\">try</span> {\n    <span class=\"hljs-comment\">// Check if the window is visible</span>\n    <span class=\"hljs-keyword\">const</span> isVisible = <span class=\"hljs-keyword\">await</span> app.browserWindow.isVisible()\n    <span class=\"hljs-comment\">// Verify the window is visible</span>\n    assert.strictEqual(isVisible, <span class=\"hljs-literal\">true</span>)\n    <span class=\"hljs-comment\">// Get the window's title</span>\n    <span class=\"hljs-keyword\">const</span> title = <span class=\"hljs-keyword\">await</span> app.client.getTitle()\n    <span class=\"hljs-comment\">// Verify the window's title</span>\n    assert.strictEqual(title, <span class=\"hljs-string\">'My App'</span>)\n  } <span class=\"hljs-keyword\">catch</span> (error) {\n    <span class=\"hljs-comment\">// Log any failures</span>\n    <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Test failed'</span>, error.message)\n  }\n  <span class=\"hljs-comment\">// Stop the application</span>\n  <span class=\"hljs-keyword\">await</span> app.stop()\n}\n\nverifyWindowIsVisibleWithTitle(myApp)\n</code></pre>\n<h2 id=\"setting-up-with-webdriverjs\"><a href=\"#setting-up-with-webdriverjs\">Setting up with WebDriverJs</a></h2>\n<p><a href=\"https://www.selenium.dev/selenium/docs/api/javascript/index.html\">WebDriverJs</a> provides\na Node package for testing with web driver, we will use it as an example.</p>\n<h3 id=\"1-start-chromedriver\"><a href=\"#1-start-chromedriver\">1. Start ChromeDriver</a></h3>\n<p>First you need to download the <code>chromedriver</code> binary, and run it:</p>\n<pre><code class=\"hljs language-sh\">$ npm install electron-chromedriver\n$ ./node_modules/.bin/chromedriver\nStarting ChromeDriver (v2.10.291558) on port 9515\nOnly <span class=\"hljs-built_in\">local</span> connections are allowed.\n</code></pre>\n<p>Remember the port number <code>9515</code>, which will be used later</p>\n<h3 id=\"2-install-webdriverjs\"><a href=\"#2-install-webdriverjs\">2. Install WebDriverJS</a></h3>\n<pre><code class=\"hljs language-sh\">$ npm install selenium-webdriver\n</code></pre>\n<h3 id=\"3-connect-to-chromedriver\"><a href=\"#3-connect-to-chromedriver\">3. Connect to ChromeDriver</a></h3>\n<p>The usage of <code>selenium-webdriver</code> with Electron is the same with\nupstream, except that you have to manually specify how to connect\nchrome driver and where to find Electron's binary:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webdriver = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'selenium-webdriver'</span>)\n\n<span class=\"hljs-keyword\">const</span> driver = <span class=\"hljs-keyword\">new</span> webdriver.Builder()\n  <span class=\"hljs-comment\">// The \"9515\" is the port opened by chrome driver.</span>\n  .usingServer(<span class=\"hljs-string\">'http://localhost:9515'</span>)\n  .withCapabilities({\n    <span class=\"hljs-string\">'goog:chromeOptions'</span>: {\n      <span class=\"hljs-comment\">// Here is the path to your Electron binary.</span>\n      <span class=\"hljs-attr\">binary</span>: <span class=\"hljs-string\">'/Path-to-Your-App.app/Contents/MacOS/Electron'</span>\n    }\n  })\n  .forBrowser(<span class=\"hljs-string\">'chrome'</span>) <span class=\"hljs-comment\">// note: use .forBrowser('electron') for selenium-webdriver &#x3C;= 3.6.0</span>\n  .build()\n\ndriver.get(<span class=\"hljs-string\">'http://www.google.com'</span>)\ndriver.findElement(webdriver.By.name(<span class=\"hljs-string\">'q'</span>)).sendKeys(<span class=\"hljs-string\">'webdriver'</span>)\ndriver.findElement(webdriver.By.name(<span class=\"hljs-string\">'btnG'</span>)).click()\ndriver.wait(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">return</span> driver.getTitle().then(<span class=\"hljs-function\">(<span class=\"hljs-params\">title</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> title === <span class=\"hljs-string\">'webdriver - Google Search'</span>\n  })\n}, <span class=\"hljs-number\">1000</span>)\n\ndriver.quit()\n</code></pre>\n<h2 id=\"setting-up-with-webdriverio\"><a href=\"#setting-up-with-webdriverio\">Setting up with WebdriverIO</a></h2>\n<p><a href=\"https://webdriver.io/\">WebdriverIO</a> provides a Node package for testing with web\ndriver.</p>\n<h3 id=\"1-start-chromedriver-1\"><a href=\"#1-start-chromedriver-1\">1. Start ChromeDriver</a></h3>\n<p>First you need to download the <code>chromedriver</code> binary, and run it:</p>\n<pre><code class=\"hljs language-sh\">$ npm install electron-chromedriver\n$ ./node_modules/.bin/chromedriver --url-base=wd/hub --port=9515\nStarting ChromeDriver (v2.10.291558) on port 9515\nOnly <span class=\"hljs-built_in\">local</span> connections are allowed.\n</code></pre>\n<p>Remember the port number <code>9515</code>, which will be used later</p>\n<h3 id=\"2-install-webdriverio\"><a href=\"#2-install-webdriverio\">2. Install WebdriverIO</a></h3>\n<pre><code class=\"hljs language-sh\">$ npm install webdriverio\n</code></pre>\n<h3 id=\"3-connect-to-chrome-driver\"><a href=\"#3-connect-to-chrome-driver\">3. Connect to chrome driver</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webdriverio = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'webdriverio'</span>)\n<span class=\"hljs-keyword\">const</span> options = {\n  <span class=\"hljs-attr\">host</span>: <span class=\"hljs-string\">'localhost'</span>, <span class=\"hljs-comment\">// Use localhost as chrome driver server</span>\n  <span class=\"hljs-attr\">port</span>: <span class=\"hljs-number\">9515</span>, <span class=\"hljs-comment\">// \"9515\" is the port opened by chrome driver.</span>\n  <span class=\"hljs-attr\">desiredCapabilities</span>: {\n    <span class=\"hljs-attr\">browserName</span>: <span class=\"hljs-string\">'chrome'</span>,\n    <span class=\"hljs-string\">'goog:chromeOptions'</span>: {\n      <span class=\"hljs-attr\">binary</span>: <span class=\"hljs-string\">'/Path-to-Your-App/electron'</span>, <span class=\"hljs-comment\">// Path to your Electron binary.</span>\n      <span class=\"hljs-attr\">args</span>: [<span class=\"hljs-comment\">/* cli arguments */</span>] <span class=\"hljs-comment\">// Optional, perhaps 'app=' + /path/to/your/app/</span>\n    }\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> client = webdriverio.remote(options)\n\nclient\n  .init()\n  .url(<span class=\"hljs-string\">'http://google.com'</span>)\n  .setValue(<span class=\"hljs-string\">'#q'</span>, <span class=\"hljs-string\">'webdriverio'</span>)\n  .click(<span class=\"hljs-string\">'#btnG'</span>)\n  .getTitle().then(<span class=\"hljs-function\">(<span class=\"hljs-params\">title</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Title was: '</span> + title)\n  })\n  .end()\n</code></pre>\n<h2 id=\"workflow\"><a href=\"#workflow\">Workflow</a></h2>\n<p>To test your application without rebuilding Electron,\n<a href=\"/docs/tutorial/application-distribution\">place</a>\nyour app source into Electron's resource directory.</p>\n<p>Alternatively, pass an argument to run with your Electron binary that points to\nyour app's folder. This eliminates the need to copy-paste your app into\nElectron's resource directory.</p>",
      "title": "Selenium and WebDriver",
      "description": "WebDriver is an open source tool for automated testing of web apps across many\nbrowsers. It provides capabilities for navigating to web pages, user input,\nJavaScript execution, and more. ChromeDriver is a standalone server which\nimplements WebDriver's wire protocol for Chromium. It is being developed by\nmembers of the Chromium and WebDriver teams."
    },
    "/docs/development/v8-development": {
      "locale": "en-US",
      "slug": "v8-development",
      "href": "/docs/development/v8-development",
      "crowdinFileId": "256171",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/v8-development.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"v8-development\"><a href=\"#v8-development\">V8 Development</a></h1>\n<blockquote>\n<p>A collection of resources for learning and using V8</p>\n</blockquote>\n<ul>\n<li><a href=\"https://v8.dev/docs/trace\">V8 Tracing</a></li>\n<li><a href=\"https://v8.dev/docs/profile\">V8 Profiler</a> - Profiler combinations which are useful for profiling: <code>--prof</code>, <code>--trace-ic</code>, <code>--trace-opt</code>, <code>--trace-deopt</code>, <code>--print-bytecode</code>, <code>--print-opt-code</code></li>\n<li><a href=\"https://docs.google.com/document/d/11T2CRex9hXxoJwbYqVQ32yIPMh0uouUZLdyrtmMoL44/edit?ts=56f27d9d#heading=h.6jz9dj3bnr8t\">V8 Interpreter Design</a></li>\n<li><a href=\"https://v8.dev/docs/turbofan\">Optimizing compiler</a></li>\n<li><a href=\"https://v8.dev/docs/gdb-jit\">V8 GDB Debugging</a></li>\n</ul>\n<p>See also <a href=\"/docs/development/chromium-development\">Chromium Development</a></p>",
      "title": "V8 Development",
      "description": "A collection of resources for learning and using V8"
    },
    "/docs/api/web-contents": {
      "locale": "en-US",
      "slug": "web-contents",
      "href": "/docs/api/web-contents",
      "crowdinFileId": "256399",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-contents.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webcontents\"><a href=\"#webcontents\">webContents</a></h1>\n<blockquote>\n<p>Render and control web pages.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>webContents</code> is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.\nIt is responsible for rendering and controlling a web page and is a property of\nthe <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> object. An example of accessing the\n<code>webContents</code> object:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> contents = win.webContents\n<span class=\"hljs-built_in\">console</span>.log(contents)\n</code></pre>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>These methods can be accessed from the <code>webContents</code> module:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(webContents)\n</code></pre>\n<h3 id=\"webcontentsgetallwebcontents\"><a href=\"#webcontentsgetallwebcontents\"><code>webContents.getAllWebContents()</code></a></h3>\n<p>Returns <code>WebContents[]</code> - An array of all <code>WebContents</code> instances. This will contain web contents\nfor all windows, webviews, opened devtools, and devtools extension background pages.</p>\n<h3 id=\"webcontentsgetfocusedwebcontents\"><a href=\"#webcontentsgetfocusedwebcontents\"><code>webContents.getFocusedWebContents()</code></a></h3>\n<p>Returns <code>WebContents</code> - The web contents that is focused in this application, otherwise\nreturns <code>null</code>.</p>\n<h3 id=\"webcontentsfromidid\"><a href=\"#webcontentsfromidid\"><code>webContents.fromId(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Returns <code>WebContents</code> | undefined - A WebContents instance with the given ID, or\n<code>undefined</code> if there is no WebContents associated with the given ID.</p>\n<h3 id=\"webcontentsfromdevtoolstargetidtargetid\"><a href=\"#webcontentsfromdevtoolstargetidtargetid\"><code>webContents.fromDevToolsTargetId(targetId)</code></a></h3>\n<ul>\n<li><code>targetId</code> String - The Chrome DevTools Protocol <a href=\"https://chromedevtools.github.io/devtools-protocol/tot/Target/#type-TargetID\">TargetID</a> associated with the WebContents instance.</li>\n</ul>\n<p>Returns <code>WebContents</code> | undefined - A WebContents instance with the given TargetID, or\n<code>undefined</code> if there is no WebContents associated with the given TargetID.</p>\n<p>When communicating with the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">Chrome DevTools Protocol</a>,\nit can be useful to lookup a WebContents instance based on its assigned TargetID.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">lookupTargetId</span> (<span class=\"hljs-params\">browserWindow</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> wc = browserWindow.webContents\n  <span class=\"hljs-keyword\">await</span> wc.debugger.attach(<span class=\"hljs-string\">'1.3'</span>)\n  <span class=\"hljs-keyword\">const</span> { targetInfo } = <span class=\"hljs-keyword\">await</span> wc.debugger.sendCommand(<span class=\"hljs-string\">'Target.getTargetInfo'</span>)\n  <span class=\"hljs-keyword\">const</span> { targetId } = targetInfo\n  <span class=\"hljs-keyword\">const</span> targetWebContents = <span class=\"hljs-keyword\">await</span> webContents.fromDevToolsTargetId(targetId)\n}\n</code></pre>\n<h2 id=\"class-webcontents\"><a href=\"#class-webcontents\">Class: WebContents</a></h2>\n<blockquote>\n<p>Render and control the contents of a BrowserWindow instance.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"instance-events\"><a href=\"#instance-events\">Instance Events</a></h3>\n<h4 id=\"event-did-finish-load\"><a href=\"#event-did-finish-load\">Event: 'did-finish-load'</a></h4>\n<p>Emitted when the navigation is done, i.e. the spinner of the tab has stopped\nspinning, and the <code>onload</code> event was dispatched.</p>\n<h4 id=\"event-did-fail-load\"><a href=\"#event-did-fail-load\">Event: 'did-fail-load'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>This event is like <code>did-finish-load</code> but emitted when the load failed.\nThe full list of error codes and their meaning is available <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">here</a>.</p>\n<h4 id=\"event-did-fail-provisional-load\"><a href=\"#event-did-fail-provisional-load\">Event: 'did-fail-provisional-load'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>This event is like <code>did-fail-load</code> but emitted when the load was cancelled\n(e.g. <code>window.stop()</code> was invoked).</p>\n<h4 id=\"event-did-frame-finish-load\"><a href=\"#event-did-frame-finish-load\">Event: 'did-frame-finish-load'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when a frame has done navigation.</p>\n<h4 id=\"event-did-start-loading\"><a href=\"#event-did-start-loading\">Event: 'did-start-loading'</a></h4>\n<p>Corresponds to the points in time when the spinner of the tab started spinning.</p>\n<h4 id=\"event-did-stop-loading\"><a href=\"#event-did-stop-loading\">Event: 'did-stop-loading'</a></h4>\n<p>Corresponds to the points in time when the spinner of the tab stopped spinning.</p>\n<h4 id=\"event-dom-ready\"><a href=\"#event-dom-ready\">Event: 'dom-ready'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the document in the top-level frame is loaded.</p>\n<h4 id=\"event-page-title-updated\"><a href=\"#event-page-title-updated\">Event: 'page-title-updated'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>Fired when page title is set during navigation. <code>explicitSet</code> is false when\ntitle is synthesized from file url.</p>\n<h4 id=\"event-page-favicon-updated\"><a href=\"#event-page-favicon-updated\">Event: 'page-favicon-updated'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>favicons</code> String[] - Array of URLs.</li>\n</ul>\n<p>Emitted when page receives favicon urls.</p>\n<h4 id=\"event-new-window-deprecated\"><a href=\"#event-new-window-deprecated\">Event: 'new-window' <em>Deprecated</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> NewWindowWebContentsEvent</li>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>,\n<code>new-window</code>, <code>save-to-disk</code> and <code>other</code>.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - The options which will be used for creating the new\n<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</li>\n<li><code>additionalFeatures</code> String[] - The non-standard features (features not handled\nby Chromium or Electron) given to <code>window.open()</code>. Deprecated, and will now\nalways be the empty array <code>[]</code>.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer that will be\npassed to the new window. May or may not result in the <code>Referer</code> header being\nsent, depending on the referrer policy.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that\nwill be sent to the new window, along with the appropriate headers that will\nbe set. If no post data is to be sent, the value will be <code>null</code>. Only defined\nwhen the window is being created by a form that set <code>target=_blank</code>.</li>\n</ul>\n<p>Deprecated in favor of <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>.</p>\n<p>Emitted when the page requests to open a new window for a <code>url</code>. It could be\nrequested by <code>window.open</code> or an external link like <code>&#x3C;a target='_blank'></code>.</p>\n<p>By default a new <code>BrowserWindow</code> will be created for the <code>url</code>.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent Electron from automatically creating a\nnew <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. If you call <code>event.preventDefault()</code> and manually create a new\n<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> then you must set <code>event.newGuest</code> to reference the new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>\ninstance, failing to do so may result in unexpected behavior. For example:</p>\n<pre><code class=\"hljs language-javascript\">myBrowserWindow.webContents.on(<span class=\"hljs-string\">'new-window'</span>, (event, url, frameName, disposition, options, additionalFeatures, referrer, postBody) => {\n  event.preventDefault()\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webContents</span>: options.webContents, <span class=\"hljs-comment\">// use existing webContents if provided</span>\n    <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span>\n  })\n  win.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => win.show())\n  <span class=\"hljs-keyword\">if</span> (!options.webContents) {\n    <span class=\"hljs-keyword\">const</span> loadOptions = {\n      <span class=\"hljs-attr\">httpReferrer</span>: referrer\n    }\n    <span class=\"hljs-keyword\">if</span> (postBody != <span class=\"hljs-literal\">null</span>) {\n      <span class=\"hljs-keyword\">const</span> { data, contentType, boundary } = postBody\n      loadOptions.postData = postBody.data\n      loadOptions.extraHeaders = <span class=\"hljs-string\">`content-type: <span class=\"hljs-subst\">${contentType}</span>; boundary=<span class=\"hljs-subst\">${boundary}</span>`</span>\n    }\n\n    win.loadURL(url, loadOptions) <span class=\"hljs-comment\">// existing webContents will be navigated automatically</span>\n  }\n  event.newGuest = win\n})\n</code></pre>\n<h4 id=\"event-did-create-window\"><a href=\"#event-did-create-window\">Event: 'did-create-window'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>window</code> BrowserWindow</li>\n<li><code>details</code> Object<ul>\n<li><code>url</code> String - URL for the created window.</li>\n<li><code>frameName</code> String - Name given to the created window in the\n<code>window.open()</code> call.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - The options used to create the\nBrowserWindow. They are merged in increasing precedence: parsed options\nfrom the <code>features</code> string from <code>window.open()</code>, security-related\nwebPreferences inherited from the parent, and options given by\n<a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>.\nUnrecognized options are not filtered out.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer that will be\npassed to the new window. May or may not result in the <code>Referer</code> header\nbeing sent, depending on the referrer policy.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data\nthat will be sent to the new window, along with the appropriate headers\nthat will be set. If no post data is to be sent, the value will be <code>null</code>.\nOnly defined when the window is being created by a form that set\n<code>target=_blank</code>.</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>,\n<code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> and <code>other</code>.</li>\n</ul></li>\n</ul>\n<p>Emitted <em>after</em> successful creation of a window via <code>window.open</code> in the renderer.\nNot emitted if the creation of the window is canceled from\n<a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>.</p>\n<p>See <a href=\"/docs/api/window-open\"><code>window.open()</code></a> for more details and how to use this in conjunction with <code>webContents.setWindowOpenHandler</code>.</p>\n<h4 id=\"event-will-navigate\"><a href=\"#event-will-navigate\">Event: 'will-navigate'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when a user or the page wants to start navigation. It can happen when\nthe <code>window.location</code> object is changed or a user clicks a link in the page.</p>\n<p>This event will not emit when the navigation is started programmatically with\nAPIs like <code>webContents.loadURL</code> and <code>webContents.back</code>.</p>\n<p>It is also not emitted for in-page navigations, such as clicking anchor links\nor updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for\nthis purpose.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent the navigation.</p>\n<h4 id=\"event-did-start-navigation\"><a href=\"#event-did-start-navigation\">Event: 'did-start-navigation'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame (including main) starts navigating. <code>isInPlace</code> will be\n<code>true</code> for in-page navigations.</p>\n<h4 id=\"event-will-redirect\"><a href=\"#event-will-redirect\">Event: 'will-redirect'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted as a server side redirect occurs during navigation.  For example a 302\nredirect.</p>\n<p>This event will be emitted after <code>did-start-navigation</code> and always before the\n<code>did-redirect-navigation</code> event for the same navigation.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent the navigation (not just the\nredirect).</p>\n<h4 id=\"event-did-redirect-navigation\"><a href=\"#event-did-redirect-navigation\">Event: 'did-redirect-navigation'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted after a server side redirect occurs during navigation.  For example a 302\nredirect.</p>\n<p>This event cannot be prevented, if you want to prevent redirects you should\ncheckout out the <code>will-redirect</code> event above.</p>\n<h4 id=\"event-did-navigate\"><a href=\"#event-did-navigate\">Event: 'did-navigate'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - empty for non HTTP navigations</li>\n</ul>\n<p>Emitted when a main frame navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links\nor updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for\nthis purpose.</p>\n<h4 id=\"event-did-frame-navigate\"><a href=\"#event-did-frame-navigate\">Event: 'did-frame-navigate'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - empty for non HTTP navigations,</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links\nor updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for\nthis purpose.</p>\n<h4 id=\"event-did-navigate-in-page\"><a href=\"#event-did-navigate-in-page\">Event: 'did-navigate-in-page'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when an in-page navigation happened in any frame.</p>\n<p>When in-page navigation happens, the page URL changes but does not cause\nnavigation outside of the page. Examples of this occurring are when anchor links\nare clicked or when the DOM <code>hashchange</code> event is triggered.</p>\n<h4 id=\"event-will-prevent-unload\"><a href=\"#event-will-prevent-unload\">Event: 'will-prevent-unload'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when a <code>beforeunload</code> event handler is attempting to cancel a page unload.</p>\n<p>Calling <code>event.preventDefault()</code> will ignore the <code>beforeunload</code> event handler\nand allow the page to be unloaded.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.webContents.on(<span class=\"hljs-string\">'will-prevent-unload'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> choice = dialog.showMessageBoxSync(win, {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'question'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Leave'</span>, <span class=\"hljs-string\">'Stay'</span>],\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Do you want to leave this site?'</span>,\n    <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'Changes you made may not be saved.'</span>,\n    <span class=\"hljs-attr\">defaultId</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">cancelId</span>: <span class=\"hljs-number\">1</span>\n  })\n  <span class=\"hljs-keyword\">const</span> leave = (choice === <span class=\"hljs-number\">0</span>)\n  <span class=\"hljs-keyword\">if</span> (leave) {\n    event.preventDefault()\n  }\n})\n</code></pre>\n<p><strong>Note:</strong> This will be emitted for <code>BrowserViews</code> but will <em>not</em> be respected - this is because we have chosen not to tie the <code>BrowserView</code> lifecycle to its owning BrowserWindow should one exist per the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event\">specification</a>.</p>\n<h4 id=\"event-crashed-deprecated\"><a href=\"#event-crashed-deprecated\">Event: 'crashed' <em>Deprecated</em></a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>Emitted when the renderer process crashes or is killed.</p>\n<p><strong>Deprecated:</strong> This event is superceded by the <code>render-process-gone</code> event\nwhich contains more information about why the render process disappeared. It\nisn't always because it crashed.  The <code>killed</code> boolean can be replaced by\nchecking <code>reason === 'killed'</code> when you switch to that event.</p>\n<h4 id=\"event-render-process-gone\"><a href=\"#event-render-process-gone\">Event: 'render-process-gone'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>reason</code> String - The reason the render process is gone.  Possible values:<ul>\n<li><code>clean-exit</code> - Process exited with an exit code of zero</li>\n<li><code>abnormal-exit</code> - Process exited with a non-zero exit code</li>\n<li><code>killed</code> - Process was sent a SIGTERM or otherwise killed externally</li>\n<li><code>crashed</code> - Process crashed</li>\n<li><code>oom</code> - Process ran out of memory</li>\n<li><code>launch-failed</code> - Process never successfully launched</li>\n<li><code>integrity-failure</code> - Windows code integrity checks failed</li>\n</ul></li>\n<li><code>exitCode</code> Integer - The exit code of the process, unless <code>reason</code> is\n<code>launch-failed</code>, in which case <code>exitCode</code> will be a platform-specific\nlaunch failure error code.</li>\n</ul></li>\n</ul>\n<p>Emitted when the renderer process unexpectedly disappears.  This is normally\nbecause it was crashed or killed.</p>\n<h4 id=\"event-unresponsive\"><a href=\"#event-unresponsive\">Event: 'unresponsive'</a></h4>\n<p>Emitted when the web page becomes unresponsive.</p>\n<h4 id=\"event-responsive\"><a href=\"#event-responsive\">Event: 'responsive'</a></h4>\n<p>Emitted when the unresponsive web page becomes responsive again.</p>\n<h4 id=\"event-plugin-crashed\"><a href=\"#event-plugin-crashed\">Event: 'plugin-crashed'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>\n<p>Emitted when a plugin process has crashed.</p>\n<h4 id=\"event-destroyed\"><a href=\"#event-destroyed\">Event: 'destroyed'</a></h4>\n<p>Emitted when <code>webContents</code> is destroyed.</p>\n<h4 id=\"event-before-input-event\"><a href=\"#event-before-input-event\">Event: 'before-input-event'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>input</code> Object - Input properties.<ul>\n<li><code>type</code> String - Either <code>keyUp</code> or <code>keyDown</code>.</li>\n<li><code>key</code> String - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.key</a>.</li>\n<li><code>code</code> String - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.code</a>.</li>\n<li><code>isAutoRepeat</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.repeat</a>.</li>\n<li><code>isComposing</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.isComposing</a>.</li>\n<li><code>shift</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.shiftKey</a>.</li>\n<li><code>control</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.controlKey</a>.</li>\n<li><code>alt</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.altKey</a>.</li>\n<li><code>meta</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.metaKey</a>.</li>\n<li><code>location</code> Number - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.location</a>.</li>\n<li><code>modifiers</code> String[] - See <a href=\"/docs/api/structures/input-event\">InputEvent.modifiers</a>.</li>\n</ul></li>\n</ul>\n<p>Emitted before dispatching the <code>keydown</code> and <code>keyup</code> events in the page.\nCalling <code>event.preventDefault</code> will prevent the page <code>keydown</code>/<code>keyup</code> events\nand the menu shortcuts.</p>\n<p>To only prevent the menu shortcuts, use\n<a href=\"#contentssetignoremenushortcutsignore\"><code>setIgnoreMenuShortcuts</code></a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\nwin.webContents.on(<span class=\"hljs-string\">'before-input-event'</span>, (event, input) => {\n  <span class=\"hljs-comment\">// For example, only enable application menu keyboard shortcuts when</span>\n  <span class=\"hljs-comment\">// Ctrl/Cmd are down.</span>\n  win.webContents.setIgnoreMenuShortcuts(!input.control &#x26;&#x26; !input.meta)\n})\n</code></pre>\n<h4 id=\"event-enter-html-full-screen\"><a href=\"#event-enter-html-full-screen\">Event: 'enter-html-full-screen'</a></h4>\n<p>Emitted when the window enters a full-screen state triggered by HTML API.</p>\n<h4 id=\"event-leave-html-full-screen\"><a href=\"#event-leave-html-full-screen\">Event: 'leave-html-full-screen'</a></h4>\n<p>Emitted when the window leaves a full-screen state triggered by HTML API.</p>\n<h4 id=\"event-zoom-changed\"><a href=\"#event-zoom-changed\">Event: 'zoom-changed'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>zoomDirection</code> String - Can be <code>in</code> or <code>out</code>.</li>\n</ul>\n<p>Emitted when the user is requesting to change the zoom level using the mouse wheel.</p>\n<h4 id=\"event-devtools-opened\"><a href=\"#event-devtools-opened\">Event: 'devtools-opened'</a></h4>\n<p>Emitted when DevTools is opened.</p>\n<h4 id=\"event-devtools-closed\"><a href=\"#event-devtools-closed\">Event: 'devtools-closed'</a></h4>\n<p>Emitted when DevTools is closed.</p>\n<h4 id=\"event-devtools-focused\"><a href=\"#event-devtools-focused\">Event: 'devtools-focused'</a></h4>\n<p>Emitted when DevTools is focused / opened.</p>\n<h4 id=\"event-certificate-error\"><a href=\"#event-certificate-error\">Event: 'certificate-error'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>error</code> String - The error code.</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>isTrusted</code> Boolean - Indicates whether the certificate can be considered trusted.</li>\n</ul></li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Emitted when failed to verify the <code>certificate</code> for <code>url</code>.</p>\n<p>The usage is the same with <a href=\"/docs/api/app#event-certificate-error\">the <code>certificate-error</code> event of\n<code>app</code></a>.</p>\n<h4 id=\"event-select-client-certificate\"><a href=\"#event-select-client-certificate\">Event: 'select-client-certificate'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> URL</li>\n<li><code>certificateList</code> <a href=\"/docs/api/structures/certificate\">Certificate[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> - Must be a certificate from the given list.</li>\n</ul></li>\n</ul>\n<p>Emitted when a client certificate is requested.</p>\n<p>The usage is the same with <a href=\"/docs/api/app#event-select-client-certificate\">the <code>select-client-certificate</code> event of\n<code>app</code></a>.</p>\n<h4 id=\"event-login\"><a href=\"#event-login\">Event: 'login'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>authenticationResponseDetails</code> Object<ul>\n<li><code>url</code> URL</li>\n</ul></li>\n<li><code>authInfo</code> Object<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (optional)</li>\n<li><code>password</code> String (optional)</li>\n</ul></li>\n</ul>\n<p>Emitted when <code>webContents</code> wants to do basic auth.</p>\n<p>The usage is the same with <a href=\"/docs/api/app#event-login\">the <code>login</code> event of <code>app</code></a>.</p>\n<h4 id=\"event-found-in-page\"><a href=\"#event-found-in-page\">Event: 'found-in-page'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>result</code> Object<ul>\n<li><code>requestId</code> Integer</li>\n<li><code>activeMatchOrdinal</code> Integer - Position of the active match.</li>\n<li><code>matches</code> Integer - Number of Matches.</li>\n<li><code>selectionArea</code> Rectangle - Coordinates of first match region.</li>\n<li><code>finalUpdate</code> Boolean</li>\n</ul></li>\n</ul>\n<p>Emitted when a result is available for\n[<code>webContents.findInPage</code>] request.</p>\n<h4 id=\"event-media-started-playing\"><a href=\"#event-media-started-playing\">Event: 'media-started-playing'</a></h4>\n<p>Emitted when media starts playing.</p>\n<h4 id=\"event-media-paused\"><a href=\"#event-media-paused\">Event: 'media-paused'</a></h4>\n<p>Emitted when media is paused or done playing.</p>\n<h4 id=\"event-did-change-theme-color\"><a href=\"#event-did-change-theme-color\">Event: 'did-change-theme-color'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>color</code> (String | null) - Theme color is in format of '#rrggbb'. It is <code>null</code> when no theme color is set.</li>\n</ul>\n<p>Emitted when a page's theme color changes. This is usually due to encountering\na meta tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">'theme-color'</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">'#ff0000'</span>></span>\n</code></pre>\n<h4 id=\"event-update-target-url\"><a href=\"#event-update-target-url\">Event: 'update-target-url'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when mouse moves over a link or the keyboard moves the focus to a link.</p>\n<h4 id=\"event-cursor-changed\"><a href=\"#event-cursor-changed\">Event: 'cursor-changed'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String</li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> (optional)</li>\n<li><code>scale</code> Float (optional) - scaling factor for the custom cursor.</li>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) - the size of the <code>image</code>.</li>\n<li><code>hotspot</code> <a href=\"/docs/api/structures/point\">Point</a> (optional) - coordinates of the custom cursor's hotspot.</li>\n</ul>\n<p>Emitted when the cursor's type changes. The <code>type</code> parameter can be <code>default</code>,\n<code>crosshair</code>, <code>pointer</code>, <code>text</code>, <code>wait</code>, <code>help</code>, <code>e-resize</code>, <code>n-resize</code>,\n<code>ne-resize</code>, <code>nw-resize</code>, <code>s-resize</code>, <code>se-resize</code>, <code>sw-resize</code>, <code>w-resize</code>,\n<code>ns-resize</code>, <code>ew-resize</code>, <code>nesw-resize</code>, <code>nwse-resize</code>, <code>col-resize</code>,\n<code>row-resize</code>, <code>m-panning</code>, <code>e-panning</code>, <code>n-panning</code>, <code>ne-panning</code>, <code>nw-panning</code>,\n<code>s-panning</code>, <code>se-panning</code>, <code>sw-panning</code>, <code>w-panning</code>, <code>move</code>, <code>vertical-text</code>,\n<code>cell</code>, <code>context-menu</code>, <code>alias</code>, <code>progress</code>, <code>nodrop</code>, <code>copy</code>, <code>none</code>,\n<code>not-allowed</code>, <code>zoom-in</code>, <code>zoom-out</code>, <code>grab</code>, <code>grabbing</code> or <code>custom</code>.</p>\n<p>If the <code>type</code> parameter is <code>custom</code>, the <code>image</code> parameter will hold the custom\ncursor image in a <a href=\"/docs/api/native-image\"><code>NativeImage</code></a>, and <code>scale</code>, <code>size</code> and <code>hotspot</code> will hold\nadditional information about the custom cursor.</p>\n<h4 id=\"event-context-menu\"><a href=\"#event-context-menu\">Event: 'context-menu'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>params</code> Object<ul>\n<li><code>x</code> Integer - x coordinate.</li>\n<li><code>y</code> Integer - y coordinate.</li>\n<li><code>frame</code> WebFrameMain - Frame from which the context menu was invoked.</li>\n<li><code>linkURL</code> String - URL of the link that encloses the node the context menu\nwas invoked on.</li>\n<li><code>linkText</code> String - Text associated with the link. May be an empty\nstring if the contents of the link are an image.</li>\n<li><code>pageURL</code> String - URL of the top level page that the context menu was\ninvoked on.</li>\n<li><code>frameURL</code> String - URL of the subframe that the context menu was invoked\non.</li>\n<li><code>srcURL</code> String - Source URL for the element that the context menu\nwas invoked on. Elements with source URLs are images, audio and video.</li>\n<li><code>mediaType</code> String - Type of the node the context menu was invoked on. Can\nbe <code>none</code>, <code>image</code>, <code>audio</code>, <code>video</code>, <code>canvas</code>, <code>file</code> or <code>plugin</code>.</li>\n<li><code>hasImageContents</code> Boolean - Whether the context menu was invoked on an image\nwhich has non-empty contents.</li>\n<li><code>isEditable</code> Boolean - Whether the context is editable.</li>\n<li><code>selectionText</code> String - Text of the selection that the context menu was\ninvoked on.</li>\n<li><code>titleText</code> String - Title text of the selection that the context menu was\ninvoked on.</li>\n<li><code>altText</code> String - Alt text of the selection that the context menu was\ninvoked on.</li>\n<li><code>suggestedFilename</code> String - Suggested filename to be used when saving file through 'Save\nLink As' option of context menu.</li>\n<li><code>selectionRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Rect representing the coordinates in the document space of the selection.</li>\n<li><code>selectionStartOffset</code> Number - Start position of the selection text.</li>\n<li><code>referrerPolicy</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer policy of the frame on which the menu is invoked.</li>\n<li><code>misspelledWord</code> String - The misspelled word under the cursor, if any.</li>\n<li><code>dictionarySuggestions</code> String[] - An array of suggested words to show the\nuser to replace the <code>misspelledWord</code>.  Only available if there is a misspelled\nword and spellchecker is enabled.</li>\n<li><code>frameCharset</code> String - The character encoding of the frame on which the\nmenu was invoked.</li>\n<li><code>inputFieldType</code> String - If the context menu was invoked on an input\nfield, the type of that field. Possible values are <code>none</code>, <code>plainText</code>,\n<code>password</code>, <code>other</code>.</li>\n<li><code>spellcheckEnabled</code> Boolean - If the context is editable, whether or not spellchecking is enabled.</li>\n<li><code>menuSourceType</code> String - Input source that invoked the context menu.\nCan be <code>none</code>, <code>mouse</code>, <code>keyboard</code>, <code>touch</code>, <code>touchMenu</code>, <code>longPress</code>, <code>longTap</code>, <code>touchHandle</code>, <code>stylus</code>, <code>adjustSelection</code>, or <code>adjustSelectionReset</code>.</li>\n<li><code>mediaFlags</code> Object - The flags for the media element the context menu was\ninvoked on.<ul>\n<li><code>inError</code> Boolean - Whether the media element has crashed.</li>\n<li><code>isPaused</code> Boolean - Whether the media element is paused.</li>\n<li><code>isMuted</code> Boolean - Whether the media element is muted.</li>\n<li><code>hasAudio</code> Boolean - Whether the media element has audio.</li>\n<li><code>isLooping</code> Boolean - Whether the media element is looping.</li>\n<li><code>isControlsVisible</code> Boolean - Whether the media element's controls are\nvisible.</li>\n<li><code>canToggleControls</code> Boolean - Whether the media element's controls are\ntoggleable.</li>\n<li><code>canPrint</code> Boolean - Whether the media element can be printed.</li>\n<li><code>canSave</code> Boolean - Whether or not the media element can be downloaded.</li>\n<li><code>canShowPictureInPicture</code> Boolean - Whether the media element can show picture-in-picture.</li>\n<li><code>isShowingPictureInPicture</code> Boolean - Whether the media element is currently showing picture-in-picture.</li>\n<li><code>canRotate</code> Boolean - Whether the media element can be rotated.</li>\n<li><code>canLoop</code> Boolean - Whether the media element can be looped.</li>\n</ul></li>\n<li><code>editFlags</code> Object - These flags indicate whether the renderer believes it\nis able to perform the corresponding action.<ul>\n<li><code>canUndo</code> Boolean - Whether the renderer believes it can undo.</li>\n<li><code>canRedo</code> Boolean - Whether the renderer believes it can redo.</li>\n<li><code>canCut</code> Boolean - Whether the renderer believes it can cut.</li>\n<li><code>canCopy</code> Boolean - Whether the renderer believes it can copy.</li>\n<li><code>canPaste</code> Boolean - Whether the renderer believes it can paste.</li>\n<li><code>canDelete</code> Boolean - Whether the renderer believes it can delete.</li>\n<li><code>canSelectAll</code> Boolean - Whether the renderer believes it can select all.</li>\n<li><code>canEditRichly</code> Boolean - Whether the renderer believes it can edit text richly.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Emitted when there is a new context menu that needs to be handled.</p>\n<h4 id=\"event-select-bluetooth-device\"><a href=\"#event-select-bluetooth-device\">Event: 'select-bluetooth-device'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>devices</code> <a href=\"/docs/api/structures/bluetooth-device\">BluetoothDevice[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>deviceId</code> String</li>\n</ul></li>\n</ul>\n<p>Emitted when bluetooth device needs to be selected on call to\n<code>navigator.bluetooth.requestDevice</code>. To use <code>navigator.bluetooth</code> api\n<code>webBluetooth</code> should be enabled. If <code>event.preventDefault</code> is not called,\nfirst available device will be selected. <code>callback</code> should be called with\n<code>deviceId</code> to be selected, passing empty string to <code>callback</code> will\ncancel the request.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'enable-experimental-web-platform-features'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.webContents.on(<span class=\"hljs-string\">'select-bluetooth-device'</span>, (event, deviceList, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> result = deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.deviceName === <span class=\"hljs-string\">'test'</span>\n    })\n    <span class=\"hljs-keyword\">if</span> (!result) {\n      callback(<span class=\"hljs-string\">''</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      callback(result.deviceId)\n    }\n  })\n})\n</code></pre>\n<h4 id=\"event-paint\"><a href=\"#event-paint\">Event: 'paint'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>dirtyRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> - The image data of the whole frame.</li>\n</ul>\n<p>Emitted when a new frame is generated. Only the dirty area is passed in the\nbuffer.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">offscreen</span>: <span class=\"hljs-literal\">true</span> } })\nwin.webContents.on(<span class=\"hljs-string\">'paint'</span>, (event, dirty, image) => {\n  <span class=\"hljs-comment\">// updateBitmap(dirty, image.getBitmap())</span>\n})\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n</code></pre>\n<h4 id=\"event-devtools-reload-page\"><a href=\"#event-devtools-reload-page\">Event: 'devtools-reload-page'</a></h4>\n<p>Emitted when the devtools window instructs the webContents to reload</p>\n<h4 id=\"event-will-attach-webview\"><a href=\"#event-will-attach-webview\">Event: 'will-attach-webview'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webPreferences</code> WebPreferences - The web preferences that will be used by the guest\npage. This object can be modified to adjust the preferences for the guest\npage.</li>\n<li><code>params</code> Record&#x3C;string, string> - The other <code>&#x3C;webview></code> parameters such as the <code>src</code> URL.\nThis object can be modified to adjust the parameters of the guest page.</li>\n</ul>\n<p>Emitted when a <code>&#x3C;webview></code>'s web contents is being attached to this web\ncontents. Calling <code>event.preventDefault()</code> will destroy the guest page.</p>\n<p>This event can be used to configure <code>webPreferences</code> for the <code>webContents</code>\nof a <code>&#x3C;webview></code> before it's loaded, and provides the ability to set settings\nthat can't be set via <code>&#x3C;webview></code> attributes.</p>\n<p><strong>Note:</strong> The specified <code>preload</code> script option will appear as <code>preloadURL</code>\n(not <code>preload</code>) in the <code>webPreferences</code> object emitted with this event.</p>\n<h4 id=\"event-did-attach-webview\"><a href=\"#event-did-attach-webview\">Event: 'did-attach-webview'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> WebContents - The guest web contents that is used by the\n<code>&#x3C;webview></code>.</li>\n</ul>\n<p>Emitted when a <code>&#x3C;webview></code> has been attached to this web contents.</p>\n<h4 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>level</code> Integer - The log level, from 0 to 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>message</code> String - The actual console message</li>\n<li><code>line</code> Integer - The line number of the source that triggered this console message</li>\n<li><code>sourceId</code> String</li>\n</ul>\n<p>Emitted when the associated window logs a console message.</p>\n<h4 id=\"event-preload-error\"><a href=\"#event-preload-error\">Event: 'preload-error'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preloadPath</code> String</li>\n<li><code>error</code> Error</li>\n</ul>\n<p>Emitted when the preload script <code>preloadPath</code> throws an unhandled exception <code>error</code>.</p>\n<h4 id=\"event-ipc-message\"><a href=\"#event-ipc-message\">Event: 'ipc-message'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Emitted when the renderer process sends an asynchronous message via <code>ipcRenderer.send()</code>.</p>\n<h4 id=\"event-ipc-message-sync\"><a href=\"#event-ipc-message-sync\">Event: 'ipc-message-sync'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Emitted when the renderer process sends a synchronous message via <code>ipcRenderer.sendSync()</code>.</p>\n<h4 id=\"event-desktop-capturer-get-sources\"><a href=\"#event-desktop-capturer-get-sources\">Event: 'desktop-capturer-get-sources'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when <code>desktopCapturer.getSources()</code> is called in the renderer process.\nCalling <code>event.preventDefault()</code> will make it return empty sources.</p>\n<h4 id=\"event-preferred-size-changed\"><a href=\"#event-preferred-size-changed\">Event: 'preferred-size-changed'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preferredSize</code> <a href=\"/docs/api/structures/size\">Size</a> - The minimum size needed to\ncontain the layout of the document—without requiring scrolling.</li>\n</ul>\n<p>Emitted when the <code>WebContents</code> preferred size has changed.</p>\n<p>This event will only be emitted when <code>enablePreferredSizeMode</code> is set to <code>true</code>\nin <code>webPreferences</code>.</p>\n<h4 id=\"event-frame-created\"><a href=\"#event-frame-created\">Event: 'frame-created'</a></h4>\n<p>Returns:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>frame</code> WebFrameMain</li>\n</ul></li>\n</ul>\n<p>Emitted when the <a href=\"/docs/api/web-contents#contentsmainframe-readonly\">mainFrame</a>, an <code>&#x3C;iframe></code>, or a nested <code>&#x3C;iframe></code> is loaded within the page.</p>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<h4 id=\"contentsloadurlurl-options\"><a href=\"#contentsloadurlurl-options\"><code>contents.loadURL(url[, options])</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (optional) - An HTTP Referrer url.</li>\n<li><code>userAgent</code> String (optional) - A user agent originating the request.</li>\n<li><code>extraHeaders</code> String (optional) - Extra headers separated by \"\\n\".</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified <code>url</code> is a data url and needs to load other files.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - the promise will resolve when the page has finished loading\n(see <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects\nif the page fails to load (see\n<a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>). A noop rejection handler is already attached, which avoids unhandled rejection errors.</p>\n<p>Loads the <code>url</code> in the window. The <code>url</code> must contain the protocol prefix,\ne.g. the <code>http://</code> or <code>file://</code>. If the load should bypass http cache then\nuse the <code>pragma</code> header to achieve it.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> options = { <span class=\"hljs-attr\">extraHeaders</span>: <span class=\"hljs-string\">'pragma: no-cache\\n'</span> }\nwebContents.loadURL(<span class=\"hljs-string\">'https://github.com'</span>, options)\n</code></pre>\n<h4 id=\"contentsloadfilefilepath-options\"><a href=\"#contentsloadfilefilepath-options\"><code>contents.loadFile(filePath[, options])</code></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>query</code> Record&#x3C;String, String> (optional) - Passed to <code>url.format()</code>.</li>\n<li><code>search</code> String (optional) - Passed to <code>url.format()</code>.</li>\n<li><code>hash</code> String (optional) - Passed to <code>url.format()</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - the promise will resolve when the page has finished loading\n(see <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects\nif the page fails to load (see <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Loads the given file in the window, <code>filePath</code> should be a path to\nan HTML file relative to the root of your application.  For instance\nan app structure like this:</p>\n<pre><code class=\"hljs language-sh\">| root\n| - package.json\n| - src\n|   - main.js\n|   - index.html\n</code></pre>\n<p>Would require code like this</p>\n<pre><code class=\"hljs language-js\">win.loadFile(<span class=\"hljs-string\">'src/index.html'</span>)\n</code></pre>\n<h4 id=\"contentsdownloadurlurl\"><a href=\"#contentsdownloadurlurl\"><code>contents.downloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code> without navigating. The\n<code>will-download</code> event of <code>session</code> will be triggered.</p>\n<h4 id=\"contentsgeturl\"><a href=\"#contentsgeturl\"><code>contents.getURL()</code></a></h4>\n<p>Returns <code>String</code> - The URL of the current web page.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> currentURL = win.webContents.getURL()\n  <span class=\"hljs-built_in\">console</span>.log(currentURL)\n})\n</code></pre>\n<h4 id=\"contentsgettitle\"><a href=\"#contentsgettitle\"><code>contents.getTitle()</code></a></h4>\n<p>Returns <code>String</code> - The title of the current web page.</p>\n<h4 id=\"contentsisdestroyed\"><a href=\"#contentsisdestroyed\"><code>contents.isDestroyed()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the web page is destroyed.</p>\n<h4 id=\"contentsfocus\"><a href=\"#contentsfocus\"><code>contents.focus()</code></a></h4>\n<p>Focuses the web page.</p>\n<h4 id=\"contentsisfocused\"><a href=\"#contentsisfocused\"><code>contents.isFocused()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the web page is focused.</p>\n<h4 id=\"contentsisloading\"><a href=\"#contentsisloading\"><code>contents.isLoading()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether web page is still loading resources.</p>\n<h4 id=\"contentsisloadingmainframe\"><a href=\"#contentsisloadingmainframe\"><code>contents.isLoadingMainFrame()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the main frame (and not just iframes or frames within it) is\nstill loading.</p>\n<h4 id=\"contentsiswaitingforresponse\"><a href=\"#contentsiswaitingforresponse\"><code>contents.isWaitingForResponse()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the web page is waiting for a first-response from the main\nresource of the page.</p>\n<h4 id=\"contentsstop\"><a href=\"#contentsstop\"><code>contents.stop()</code></a></h4>\n<p>Stops any pending navigation.</p>\n<h4 id=\"contentsreload\"><a href=\"#contentsreload\"><code>contents.reload()</code></a></h4>\n<p>Reloads the current web page.</p>\n<h4 id=\"contentsreloadignoringcache\"><a href=\"#contentsreloadignoringcache\"><code>contents.reloadIgnoringCache()</code></a></h4>\n<p>Reloads current page and ignores cache.</p>\n<h4 id=\"contentscangoback\"><a href=\"#contentscangoback\"><code>contents.canGoBack()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the browser can go back to previous web page.</p>\n<h4 id=\"contentscangoforward\"><a href=\"#contentscangoforward\"><code>contents.canGoForward()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the browser can go forward to next web page.</p>\n<h4 id=\"contentscangotooffsetoffset\"><a href=\"#contentscangotooffsetoffset\"><code>contents.canGoToOffset(offset)</code></a></h4>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the web page can go to <code>offset</code>.</p>\n<h4 id=\"contentsclearhistory\"><a href=\"#contentsclearhistory\"><code>contents.clearHistory()</code></a></h4>\n<p>Clears the navigation history.</p>\n<h4 id=\"contentsgoback\"><a href=\"#contentsgoback\"><code>contents.goBack()</code></a></h4>\n<p>Makes the browser go back a web page.</p>\n<h4 id=\"contentsgoforward\"><a href=\"#contentsgoforward\"><code>contents.goForward()</code></a></h4>\n<p>Makes the browser go forward a web page.</p>\n<h4 id=\"contentsgotoindexindex\"><a href=\"#contentsgotoindexindex\"><code>contents.goToIndex(index)</code></a></h4>\n<ul>\n<li><code>index</code> Integer</li>\n</ul>\n<p>Navigates browser to the specified absolute web page index.</p>\n<h4 id=\"contentsgotooffsetoffset\"><a href=\"#contentsgotooffsetoffset\"><code>contents.goToOffset(offset)</code></a></h4>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Navigates to the specified offset from the \"current entry\".</p>\n<h4 id=\"contentsiscrashed\"><a href=\"#contentsiscrashed\"><code>contents.isCrashed()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the renderer process has crashed.</p>\n<h4 id=\"contentsforcefullycrashrenderer\"><a href=\"#contentsforcefullycrashrenderer\"><code>contents.forcefullyCrashRenderer()</code></a></h4>\n<p>Forcefully terminates the renderer process that is currently hosting this\n<code>webContents</code>. This will cause the <code>render-process-gone</code> event to be emitted\nwith the <code>reason=killed || reason=crashed</code>. Please note that some webContents share renderer\nprocesses and therefore calling this method may also crash the host process\nfor other webContents as well.</p>\n<p>Calling <code>reload()</code> immediately after calling this\nmethod will force the reload to occur in a new process. This should be used\nwhen this process is unstable or unusable, for instance in order to recover\nfrom the <code>unresponsive</code> event.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'unresponsive'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> { response } = <span class=\"hljs-keyword\">await</span> dialog.showMessageBox({\n    <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'App X has become unresponsive'</span>,\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Do you want to try forcefully reloading the app?'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'OK'</span>, <span class=\"hljs-string\">'Cancel'</span>],\n    <span class=\"hljs-attr\">cancelId</span>: <span class=\"hljs-number\">1</span>\n  })\n  <span class=\"hljs-keyword\">if</span> (response === <span class=\"hljs-number\">0</span>) {\n    contents.forcefullyCrashRenderer()\n    contents.reload()\n  }\n})\n</code></pre>\n<h4 id=\"contentssetuseragentuseragent\"><a href=\"#contentssetuseragentuseragent\"><code>contents.setUserAgent(userAgent)</code></a></h4>\n<ul>\n<li><code>userAgent</code> String</li>\n</ul>\n<p>Overrides the user agent for this web page.</p>\n<h4 id=\"contentsgetuseragent\"><a href=\"#contentsgetuseragent\"><code>contents.getUserAgent()</code></a></h4>\n<p>Returns <code>String</code> - The user agent for this web page.</p>\n<h4 id=\"contentsinsertcsscss-options\"><a href=\"#contentsinsertcsscss-options\"><code>contents.insertCSS(css[, options])</code></a></h4>\n<ul>\n<li><code>css</code> String</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>cssOrigin</code> String (optional) - Can be either 'user' or 'author'; Specifying 'user' enables you to prevent websites from overriding the CSS you insert. Default is 'author'.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - A promise that resolves with a key for the inserted CSS that can later be used to remove the CSS via <code>contents.removeInsertedCSS(key)</code>.</p>\n<p>Injects CSS into the current web page and returns a unique key for the inserted\nstylesheet.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n  contents.insertCSS(<span class=\"hljs-string\">'html, body { background-color: #f00; }'</span>)\n})\n</code></pre>\n<h4 id=\"contentsremoveinsertedcsskey\"><a href=\"#contentsremoveinsertedcsskey\"><code>contents.removeInsertedCSS(key)</code></a></h4>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves if the removal was successful.</p>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified\nby its key, which is returned from <code>contents.insertCSS(css)</code>.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'did-finish-load'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> key = <span class=\"hljs-keyword\">await</span> contents.insertCSS(<span class=\"hljs-string\">'html, body { background-color: #f00; }'</span>)\n  contents.removeInsertedCSS(key)\n})\n</code></pre>\n<h4 id=\"contentsexecutejavascriptcode-usergesture\"><a href=\"#contentsexecutejavascriptcode-usergesture\"><code>contents.executeJavaScript(code[, userGesture])</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code\nor is rejected if the result of the code is a rejected promise.</p>\n<p>Evaluates <code>code</code> in page.</p>\n<p>In the browser window some HTML APIs like <code>requestFullScreen</code> can only be\ninvoked by a gesture from the user. Setting <code>userGesture</code> to <code>true</code> will remove\nthis limitation.</p>\n<p>Code execution will be suspended until web page stop loading.</p>\n<pre><code class=\"hljs language-js\">contents.executeJavaScript(<span class=\"hljs-string\">'fetch(\"https://jsonplaceholder.typicode.com/users/1\").then(resp => resp.json())'</span>, <span class=\"hljs-literal\">true</span>)\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">result</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(result) <span class=\"hljs-comment\">// Will be the JSON object from the fetch call</span>\n  })\n</code></pre>\n<h4 id=\"contentsexecutejavascriptinisolatedworldworldid-scripts-usergesture\"><a href=\"#contentsexecutejavascriptinisolatedworldworldid-scripts-usergesture\"><code>contents.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture])</code></a></h4>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default world, <code>999</code> is the world used by Electron's <code>contextIsolation</code> feature.  You can provide any integer here.</li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/web-source\">WebSource[]</a></li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code\nor is rejected if the result of the code is a rejected promise.</p>\n<p>Works like <code>executeJavaScript</code> but evaluates <code>scripts</code> in an isolated context.</p>\n<h4 id=\"contentssetignoremenushortcutsignore\"><a href=\"#contentssetignoremenushortcutsignore\"><code>contents.setIgnoreMenuShortcuts(ignore)</code></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n</ul>\n<p>Ignore application menu shortcuts while this web contents is focused.</p>\n<h4 id=\"contentssetwindowopenhandlerhandler\"><a href=\"#contentssetwindowopenhandlerhandler\"><code>contents.setWindowOpenHandler(handler)</code></a></h4>\n<ul>\n<li>\n<p><code>handler</code> Function&#x3C;{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}></p>\n<ul>\n<li><code>details</code> Object<ul>\n<li><code>url</code> String - The <em>resolved</em> version of the URL passed to <code>window.open()</code>. e.g. opening a window with <code>window.open('foo')</code> will yield something like <code>https://the-origin/the/current/path/foo</code>.</li>\n<li><code>frameName</code> String - Name of the window provided in <code>window.open()</code></li>\n<li><code>features</code> String - Comma separated list of window features provided to <code>window.open()</code>.</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>,\n<code>new-window</code>, <code>save-to-disk</code> or <code>other</code>.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer that will be\npassed to the new window. May or may not result in the <code>Referer</code> header being\nsent, depending on the referrer policy.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that\nwill be sent to the new window, along with the appropriate headers that will\nbe set. If no post data is to be sent, the value will be <code>null</code>. Only defined\nwhen the window is being created by a form that set <code>target=_blank</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}</code> - <code>deny</code> cancels the creation of the new\nwindow. <code>allow</code> will allow the new window to be created. Specifying <code>overrideBrowserWindowOptions</code> allows customization of the created window.\nReturning an unrecognized value such as a null, undefined, or an object\nwithout a recognized 'action' value will result in a console error and have\nthe same effect as returning <code>{action: 'deny'}</code>.</p>\n</li>\n</ul>\n<p>Called before creating a window a new window is requested by the renderer, e.g.\nby <code>window.open()</code>, a link with <code>target=\"_blank\"</code>, shift+clicking on a link, or\nsubmitting a form with <code>&#x3C;form target=\"_blank\"></code>. See\n<a href=\"/docs/api/window-open\"><code>window.open()</code></a> for more details and how to use this in\nconjunction with <code>did-create-window</code>.</p>\n<h4 id=\"contentssetaudiomutedmuted\"><a href=\"#contentssetaudiomutedmuted\"><code>contents.setAudioMuted(muted)</code></a></h4>\n<ul>\n<li><code>muted</code> Boolean</li>\n</ul>\n<p>Mute the audio on the current web page.</p>\n<h4 id=\"contentsisaudiomuted\"><a href=\"#contentsisaudiomuted\"><code>contents.isAudioMuted()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether this page has been muted.</p>\n<h4 id=\"contentsiscurrentlyaudible\"><a href=\"#contentsiscurrentlyaudible\"><code>contents.isCurrentlyAudible()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether audio is currently playing.</p>\n<h4 id=\"contentssetzoomfactorfactor\"><a href=\"#contentssetzoomfactorfactor\"><code>contents.setZoomFactor(factor)</code></a></h4>\n<ul>\n<li><code>factor</code> Double - Zoom factor; default is 1.0.</li>\n</ul>\n<p>Changes the zoom factor to the specified factor. Zoom factor is\nzoom percent divided by 100, so 300% = 3.0.</p>\n<p>The factor must be greater than 0.0.</p>\n<h4 id=\"contentsgetzoomfactor\"><a href=\"#contentsgetzoomfactor\"><code>contents.getZoomFactor()</code></a></h4>\n<p>Returns <code>Number</code> - the current zoom factor.</p>\n<h4 id=\"contentssetzoomlevellevel\"><a href=\"#contentssetzoomlevellevel\"><code>contents.setZoomLevel(level)</code></a></h4>\n<ul>\n<li><code>level</code> Number - Zoom level.</li>\n</ul>\n<p>Changes the zoom level to the specified level. The original size is 0 and each\nincrement above or below represents zooming 20% larger or smaller to default\nlimits of 300% and 50% of original size, respectively. The formula for this is\n<code>scale := 1.2 ^ level</code>.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the\nzoom level for a specific domain propagates across all instances of windows with\nthe same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h4 id=\"contentsgetzoomlevel\"><a href=\"#contentsgetzoomlevel\"><code>contents.getZoomLevel()</code></a></h4>\n<p>Returns <code>Number</code> - the current zoom level.</p>\n<h4 id=\"contentssetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#contentssetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>contents.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h4>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code></p>\n<p>Sets the maximum and minimum pinch-to-zoom level.</p>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom is disabled by default in Electron. To re-enable it, call:</p>\n<pre><code class=\"hljs language-js\">contents.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">3</span>)\n</code></pre>\n</blockquote>\n<h4 id=\"contentsundo\"><a href=\"#contentsundo\"><code>contents.undo()</code></a></h4>\n<p>Executes the editing command <code>undo</code> in web page.</p>\n<h4 id=\"contentsredo\"><a href=\"#contentsredo\"><code>contents.redo()</code></a></h4>\n<p>Executes the editing command <code>redo</code> in web page.</p>\n<h4 id=\"contentscut\"><a href=\"#contentscut\"><code>contents.cut()</code></a></h4>\n<p>Executes the editing command <code>cut</code> in web page.</p>\n<h4 id=\"contentscopy\"><a href=\"#contentscopy\"><code>contents.copy()</code></a></h4>\n<p>Executes the editing command <code>copy</code> in web page.</p>\n<h4 id=\"contentscopyimageatx-y\"><a href=\"#contentscopyimageatx-y\"><code>contents.copyImageAt(x, y)</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Copy the image at the given position to the clipboard.</p>\n<h4 id=\"contentspaste\"><a href=\"#contentspaste\"><code>contents.paste()</code></a></h4>\n<p>Executes the editing command <code>paste</code> in web page.</p>\n<h4 id=\"contentspasteandmatchstyle\"><a href=\"#contentspasteandmatchstyle\"><code>contents.pasteAndMatchStyle()</code></a></h4>\n<p>Executes the editing command <code>pasteAndMatchStyle</code> in web page.</p>\n<h4 id=\"contentsdelete\"><a href=\"#contentsdelete\"><code>contents.delete()</code></a></h4>\n<p>Executes the editing command <code>delete</code> in web page.</p>\n<h4 id=\"contentsselectall\"><a href=\"#contentsselectall\"><code>contents.selectAll()</code></a></h4>\n<p>Executes the editing command <code>selectAll</code> in web page.</p>\n<h4 id=\"contentsunselect\"><a href=\"#contentsunselect\"><code>contents.unselect()</code></a></h4>\n<p>Executes the editing command <code>unselect</code> in web page.</p>\n<h4 id=\"contentsreplacetext\"><a href=\"#contentsreplacetext\"><code>contents.replace(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes the editing command <code>replace</code> in web page.</p>\n<h4 id=\"contentsreplacemisspellingtext\"><a href=\"#contentsreplacemisspellingtext\"><code>contents.replaceMisspelling(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes the editing command <code>replaceMisspelling</code> in web page.</p>\n<h4 id=\"contentsinserttexttext\"><a href=\"#contentsinserttexttext\"><code>contents.insertText(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code></p>\n<p>Inserts <code>text</code> to the focused element.</p>\n<h4 id=\"contentsfindinpagetext-options\"><a href=\"#contentsfindinpagetext-options\"><code>contents.findInPage(text[, options])</code></a></h4>\n<ul>\n<li><code>text</code> String - Content to be searched, must not be empty.</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>forward</code> Boolean (optional) - Whether to search forward or backward, defaults to <code>true</code>.</li>\n<li><code>findNext</code> Boolean (optional) - Whether to begin a new text finding session with this request. Should be <code>true</code> for initial requests, and <code>false</code> for follow-up requests. Defaults to <code>false</code>.</li>\n<li><code>matchCase</code> Boolean (optional) - Whether search should be case-sensitive,\ndefaults to <code>false</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code> - The request id used for the request.</p>\n<p>Starts a request to find all matches for the <code>text</code> in the web page. The result of the request\ncan be obtained by subscribing to <a href=\"/docs/api/web-contents#event-found-in-page\"><code>found-in-page</code></a> event.</p>\n<h4 id=\"contentsstopfindinpageaction\"><a href=\"#contentsstopfindinpageaction\"><code>contents.stopFindInPage(action)</code></a></h4>\n<ul>\n<li><code>action</code> String - Specifies the action to take place when ending\n[<code>webContents.findInPage</code>] request.<ul>\n<li><code>clearSelection</code> - Clear the selection.</li>\n<li><code>keepSelection</code> - Translate the selection into a normal selection.</li>\n<li><code>activateSelection</code> - Focus and click the selection node.</li>\n</ul></li>\n</ul>\n<p>Stops any <code>findInPage</code> request for the <code>webContents</code> with the provided <code>action</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nwebContents.on(<span class=\"hljs-string\">'found-in-page'</span>, (event, result) => {\n  <span class=\"hljs-keyword\">if</span> (result.finalUpdate) webContents.stopFindInPage(<span class=\"hljs-string\">'clearSelection'</span>)\n})\n\n<span class=\"hljs-keyword\">const</span> requestId = webContents.findInPage(<span class=\"hljs-string\">'api'</span>)\n<span class=\"hljs-built_in\">console</span>.log(requestId)\n</code></pre>\n<h4 id=\"contentscapturepagerect\"><a href=\"#contentscapturepagerect\"><code>contents.capturePage([rect])</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (optional) - The area of the page to be captured.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - Resolves with a <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Captures a snapshot of the page within <code>rect</code>. Omitting <code>rect</code> will capture the whole visible page.</p>\n<h4 id=\"contentsisbeingcaptured\"><a href=\"#contentsisbeingcaptured\"><code>contents.isBeingCaptured()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether this page is being captured. It returns true when the capturer count\nis large then 0.</p>\n<h4 id=\"contentsincrementcapturercountsize-stayhidden-stayawake\"><a href=\"#contentsincrementcapturercountsize-stayhidden-stayawake\"><code>contents.incrementCapturerCount([size, stayHidden, stayAwake])</code></a></h4>\n<ul>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) - The preferred size for the capturer.</li>\n<li><code>stayHidden</code> Boolean (optional) -  Keep the page hidden instead of visible.</li>\n<li><code>stayAwake</code> Boolean (optional) -  Keep the system awake instead of allowing it to sleep.</li>\n</ul>\n<p>Increase the capturer count by one. The page is considered visible when its browser window is\nhidden and the capturer count is non-zero. If you would like the page to stay hidden, you should ensure that <code>stayHidden</code> is set to true.</p>\n<p>This also affects the Page Visibility API.</p>\n<h4 id=\"contentsdecrementcapturercountstayhidden-stayawake\"><a href=\"#contentsdecrementcapturercountstayhidden-stayawake\"><code>contents.decrementCapturerCount([stayHidden, stayAwake])</code></a></h4>\n<ul>\n<li><code>stayHidden</code> Boolean (optional) -  Keep the page in hidden state instead of visible.</li>\n<li><code>stayAwake</code> Boolean (optional) -  Keep the system awake instead of allowing it to sleep.</li>\n</ul>\n<p>Decrease the capturer count by one. The page will be set to hidden or occluded state when its\nbrowser window is hidden or occluded and the capturer count reaches zero. If you want to\ndecrease the hidden capturer count instead you should set <code>stayHidden</code> to true.</p>\n<h4 id=\"contentsgetprinters\"><a href=\"#contentsgetprinters\"><code>contents.getPrinters()</code></a></h4>\n<p>Get the system printer list.</p>\n<p>Returns <a href=\"/docs/api/structures/printer-info\"><code>PrinterInfo[]</code></a></p>\n<h4 id=\"contentsprintoptions-callback\"><a href=\"#contentsprintoptions-callback\"><code>contents.print([options], [callback])</code></a></h4>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>silent</code> Boolean (optional) - Don't ask user for print settings. Default is <code>false</code>.</li>\n<li><code>printBackground</code> Boolean (optional) - Prints the background color and image of\nthe web page. Default is <code>false</code>.</li>\n<li><code>deviceName</code> String (optional) - Set the printer device name to use. Must be the system-defined name and not the 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.</li>\n<li><code>color</code> Boolean (optional) - Set whether the printed web page will be in color or grayscale. Default is <code>true</code>.</li>\n<li><code>margins</code> Object (optional)<ul>\n<li><code>marginType</code> String (optional) - Can be <code>default</code>, <code>none</code>, <code>printableArea</code>, or <code>custom</code>. If <code>custom</code> is chosen, you will also need to specify <code>top</code>, <code>bottom</code>, <code>left</code>, and <code>right</code>.</li>\n<li><code>top</code> Number (optional) - The top margin of the printed web page, in pixels.</li>\n<li><code>bottom</code> Number (optional) - The bottom margin of the printed web page, in pixels.</li>\n<li><code>left</code> Number (optional) - The left margin of the printed web page, in pixels.</li>\n<li><code>right</code> Number (optional) - The right margin of the printed web page, in pixels.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - Whether the web page should be printed in landscape mode. Default is <code>false</code>.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page.</li>\n<li><code>pagesPerSheet</code> Number (optional) - The number of pages to print per page sheet.</li>\n<li><code>collate</code> Boolean (optional) - Whether the web page should be collated.</li>\n<li><code>copies</code> Number (optional) - The number of copies of the web page to print.</li>\n<li><code>pageRanges</code> Object<a href=\"/docs/api/optional\"></a> - The page range to print. On macOS, only one range is honored.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>duplexMode</code> String (optional) - Set the duplex mode of the printed web page. Can be <code>simplex</code>, <code>shortEdge</code>, or <code>longEdge</code>.</li>\n<li><code>dpi</code> Record&#x3C;string, number> (optional)<ul>\n<li><code>horizontal</code> Number (optional) - The horizontal dpi.</li>\n<li><code>vertical</code> Number (optional) - The vertical dpi.</li>\n</ul></li>\n<li><code>header</code> String (optional) - String to be printed as page header.</li>\n<li><code>footer</code> String (optional) - String to be printed as page footer.</li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the printed document. Can be <code>A3</code>,\n<code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code>.</li>\n</ul></li>\n<li><code>callback</code> Function (optional)<ul>\n<li><code>success</code> Boolean - Indicates success of the print call.</li>\n<li><code>failureReason</code> String - Error description called back if the print fails.</li>\n</ul></li>\n</ul>\n<p>When a custom <code>pageSize</code> is passed, Chromium attempts to validate platform specific minimum values for <code>width_microns</code> and <code>height_microns</code>. Width and height must both be minimum 353 microns but may be higher on some operating systems.</p>\n<p>Prints window's web page. When <code>silent</code> is set to <code>true</code>, Electron will pick\nthe system's default printer if <code>deviceName</code> is empty and the default settings for printing.</p>\n<p>Use <code>page-break-before: always;</code> CSS style to force to print to a new page.</p>\n<p>Example usage:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> options = {\n  <span class=\"hljs-attr\">silent</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">deviceName</span>: <span class=\"hljs-string\">'My-Printer'</span>,\n  <span class=\"hljs-attr\">pageRanges</span>: [{\n    <span class=\"hljs-attr\">from</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">to</span>: <span class=\"hljs-number\">1</span>\n  }]\n}\nwin.webContents.print(options, (success, errorType) => {\n  <span class=\"hljs-keyword\">if</span> (!success) <span class=\"hljs-built_in\">console</span>.log(errorType)\n})\n</code></pre>\n<h4 id=\"contentsprinttopdfoptions\"><a href=\"#contentsprinttopdfoptions\"><code>contents.printToPDF(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>headerFooter</code> Record&#x3C;string, string> (optional) - the header and footer for the PDF.<ul>\n<li><code>title</code> String - The title for the PDF header.</li>\n<li><code>url</code> String - the url for the PDF footer.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - <code>true</code> for landscape, <code>false</code> for portrait.</li>\n<li><code>marginsType</code> Integer (optional) - Specifies the type of margins to use. Uses 0 for\ndefault margin, 1 for no margin, and 2 for minimum margin.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page. Can range from 0 to 100.</li>\n<li><code>pageRanges</code> Record&#x3C;string, number> (optional) - The page range to print.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the generated PDF. Can be <code>A3</code>,\n<code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code> and <code>width</code> in microns.</li>\n<li><code>printBackground</code> Boolean (optional) - Whether to print CSS backgrounds.</li>\n<li><code>printSelectionOnly</code> Boolean (optional) - Whether to print selection only.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Buffer></code> - Resolves with the generated PDF data.</p>\n<p>Prints window's web page as PDF with Chromium's preview printing custom\nsettings.</p>\n<p>The <code>landscape</code> will be ignored if <code>@page</code> CSS at-rule is used in the web page.</p>\n<p>By default, an empty <code>options</code> will be regarded as:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">marginsType</span>: <span class=\"hljs-number\">0</span>,\n  <span class=\"hljs-attr\">printBackground</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">printSelectionOnly</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">landscape</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">pageSize</span>: <span class=\"hljs-string\">'A4'</span>,\n  <span class=\"hljs-attr\">scaleFactor</span>: <span class=\"hljs-number\">100</span>\n}\n</code></pre>\n<p>Use <code>page-break-before: always;</code> CSS style to force to print to a new page.</p>\n<p>An example of <code>webContents.printToPDF</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n<span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\nwin.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n  <span class=\"hljs-comment\">// Use default printing options</span>\n  win.webContents.printToPDF({}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">data</span> =></span> {\n    <span class=\"hljs-keyword\">const</span> pdfPath = path.join(os.homedir(), <span class=\"hljs-string\">'Desktop'</span>, <span class=\"hljs-string\">'temp.pdf'</span>)\n    fs.writeFile(pdfPath, data, (error) => {\n      <span class=\"hljs-keyword\">if</span> (error) <span class=\"hljs-keyword\">throw</span> error\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Wrote PDF successfully to <span class=\"hljs-subst\">${pdfPath}</span>`</span>)\n    })\n  }).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">error</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Failed to write PDF to <span class=\"hljs-subst\">${pdfPath}</span>: `</span>, error)\n  })\n})\n</code></pre>\n<h4 id=\"contentsaddworkspacepath\"><a href=\"#contentsaddworkspacepath\"><code>contents.addWorkSpace(path)</code></a></h4>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Adds the specified path to DevTools workspace. Must be used after DevTools\ncreation:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.on(<span class=\"hljs-string\">'devtools-opened'</span>, () => {\n  win.webContents.addWorkSpace(__dirname)\n})\n</code></pre>\n<h4 id=\"contentsremoveworkspacepath\"><a href=\"#contentsremoveworkspacepath\"><code>contents.removeWorkSpace(path)</code></a></h4>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Removes the specified path from DevTools workspace.</p>\n<h4 id=\"contentssetdevtoolswebcontentsdevtoolswebcontents\"><a href=\"#contentssetdevtoolswebcontentsdevtoolswebcontents\"><code>contents.setDevToolsWebContents(devToolsWebContents)</code></a></h4>\n<ul>\n<li><code>devToolsWebContents</code> WebContents</li>\n</ul>\n<p>Uses the <code>devToolsWebContents</code> as the target <code>WebContents</code> to show devtools.</p>\n<p>The <code>devToolsWebContents</code> must not have done any navigation, and it should not\nbe used for other purposes after the call.</p>\n<p>By default Electron manages the devtools by creating an internal <code>WebContents</code>\nwith native view, which developers have very limited control of. With the\n<code>setDevToolsWebContents</code> method, developers can use any <code>WebContents</code> to show\nthe devtools in it, including <code>BrowserWindow</code>, <code>BrowserView</code> and <code>&#x3C;webview></code>\ntag.</p>\n<p>Note that closing the devtools does not destroy the <code>devToolsWebContents</code>, it\nis caller's responsibility to destroy <code>devToolsWebContents</code>.</p>\n<p>An example of showing devtools in a <code>&#x3C;webview></code> tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">style</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/css\"</span>></span><span class=\"css\">\n    * { <span class=\"hljs-attribute\">margin</span>: <span class=\"hljs-number\">0</span>; }\n    <span class=\"hljs-selector-id\">#browser</span> { <span class=\"hljs-attribute\">height</span>: <span class=\"hljs-number\">70%</span>; }\n    <span class=\"hljs-selector-id\">#devtools</span> { <span class=\"hljs-attribute\">height</span>: <span class=\"hljs-number\">30%</span>; }\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">style</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"browser\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"devtools\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"about:blank\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n    <span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n    <span class=\"hljs-keyword\">const</span> emittedOnce = <span class=\"hljs-function\">(<span class=\"hljs-params\">element, eventName</span>) =></span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> {\n      element.addEventListener(eventName, event => resolve(event), { <span class=\"hljs-attr\">once</span>: <span class=\"hljs-literal\">true</span> })\n    })\n    <span class=\"hljs-keyword\">const</span> browserView = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'browser'</span>)\n    <span class=\"hljs-keyword\">const</span> devtoolsView = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'devtools'</span>)\n    <span class=\"hljs-keyword\">const</span> browserReady = emittedOnce(browserView, <span class=\"hljs-string\">'dom-ready'</span>)\n    <span class=\"hljs-keyword\">const</span> devtoolsReady = emittedOnce(devtoolsView, <span class=\"hljs-string\">'dom-ready'</span>)\n    <span class=\"hljs-built_in\">Promise</span>.all([browserReady, devtoolsReady]).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      <span class=\"hljs-keyword\">const</span> targetId = browserView.getWebContentsId()\n      <span class=\"hljs-keyword\">const</span> devtoolsId = devtoolsView.getWebContentsId()\n      ipcRenderer.send(<span class=\"hljs-string\">'open-devtools'</span>, targetId, devtoolsId)\n    })\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain, webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'open-devtools'</span>, (event, targetContentsId, devtoolsContentsId) => {\n  <span class=\"hljs-keyword\">const</span> target = webContents.fromId(targetContentsId)\n  <span class=\"hljs-keyword\">const</span> devtools = webContents.fromId(devtoolsContentsId)\n  target.setDevToolsWebContents(devtools)\n  target.openDevTools()\n})\n</code></pre>\n<p>An example of showing devtools in a <code>BrowserWindow</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n<span class=\"hljs-keyword\">let</span> devtools = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  devtools = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  win.webContents.setDevToolsWebContents(devtools.webContents)\n  win.webContents.openDevTools({ <span class=\"hljs-attr\">mode</span>: <span class=\"hljs-string\">'detach'</span> })\n})\n</code></pre>\n<h4 id=\"contentsopendevtoolsoptions\"><a href=\"#contentsopendevtoolsoptions\"><code>contents.openDevTools([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>mode</code> String - Opens the devtools with specified dock state, can be\n<code>right</code>, <code>bottom</code>, <code>undocked</code>, <code>detach</code>. Defaults to last used dock state.\nIn <code>undocked</code> mode it's possible to dock back. In <code>detach</code> mode it's not.</li>\n<li><code>activate</code> Boolean (optional) - Whether to bring the opened devtools window\nto the foreground. The default is <code>true</code>.</li>\n</ul></li>\n</ul>\n<p>Opens the devtools.</p>\n<p>When <code>contents</code> is a <code>&#x3C;webview></code> tag, the <code>mode</code> would be <code>detach</code> by default,\nexplicitly passing an empty <code>mode</code> can force using last used dock state.</p>\n<h4 id=\"contentsclosedevtools\"><a href=\"#contentsclosedevtools\"><code>contents.closeDevTools()</code></a></h4>\n<p>Closes the devtools.</p>\n<h4 id=\"contentsisdevtoolsopened\"><a href=\"#contentsisdevtoolsopened\"><code>contents.isDevToolsOpened()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the devtools is opened.</p>\n<h4 id=\"contentsisdevtoolsfocused\"><a href=\"#contentsisdevtoolsfocused\"><code>contents.isDevToolsFocused()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the devtools view is focused .</p>\n<h4 id=\"contentstoggledevtools\"><a href=\"#contentstoggledevtools\"><code>contents.toggleDevTools()</code></a></h4>\n<p>Toggles the developer tools.</p>\n<h4 id=\"contentsinspectelementx-y\"><a href=\"#contentsinspectelementx-y\"><code>contents.inspectElement(x, y)</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Starts inspecting element at position (<code>x</code>, <code>y</code>).</p>\n<h4 id=\"contentsinspectsharedworker\"><a href=\"#contentsinspectsharedworker\"><code>contents.inspectSharedWorker()</code></a></h4>\n<p>Opens the developer tools for the shared worker context.</p>\n<h4 id=\"contentsinspectsharedworkerbyidworkerid\"><a href=\"#contentsinspectsharedworkerbyidworkerid\"><code>contents.inspectSharedWorkerById(workerId)</code></a></h4>\n<ul>\n<li><code>workerId</code> String</li>\n</ul>\n<p>Inspects the shared worker based on its ID.</p>\n<h4 id=\"contentsgetallsharedworkers\"><a href=\"#contentsgetallsharedworkers\"><code>contents.getAllSharedWorkers()</code></a></h4>\n<p>Returns <a href=\"/docs/api/structures/shared-worker-info\"><code>SharedWorkerInfo[]</code></a> - Information about all Shared Workers.</p>\n<h4 id=\"contentsinspectserviceworker\"><a href=\"#contentsinspectserviceworker\"><code>contents.inspectServiceWorker()</code></a></h4>\n<p>Opens the developer tools for the service worker context.</p>\n<h4 id=\"contentssendchannel-args\"><a href=\"#contentssendchannel-args\"><code>contents.send(channel, ...args)</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to the renderer process via <code>channel</code>, along with\narguments. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone\nAlgorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>postMessage</code></a>, so prototype chains will not be\nincluded. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will\nthrow an exception.</p>\n<blockquote>\n<p><strong>NOTE</strong>: Sending non-standard JavaScript types such as DOM objects or\nspecial Electron objects will throw an exception.</p>\n</blockquote>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the\n<a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>An example of sending messages from the main process to the renderer process:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In the main process.</span>\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/index.html`</span>)\n  win.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n    win.webContents.send(<span class=\"hljs-string\">'ping'</span>, <span class=\"hljs-string\">'whoooooooh!'</span>)\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- index.html --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n    <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).ipcRenderer.on(<span class=\"hljs-string\">'ping'</span>, (event, message) => {\n      <span class=\"hljs-built_in\">console</span>.log(message) <span class=\"hljs-comment\">// Prints 'whoooooooh!'</span>\n    })\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<h4 id=\"contentssendtoframeframeid-channel-args\"><a href=\"#contentssendtoframeframeid-channel-args\"><code>contents.sendToFrame(frameId, channel, ...args)</code></a></h4>\n<ul>\n<li><code>frameId</code> Integer | [number, number] - the ID of the frame to send to, or a\npair of <code>[processId, frameId]</code> if the frame is in a different process to the\nmain frame.</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to a specific frame in a renderer process via\n<code>channel</code>, along with arguments. Arguments will be serialized with the\n<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>postMessage</code></a>, so prototype\nchains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or\nWeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or\nspecial Electron objects will throw an exception.</p>\n</blockquote>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the\n<a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>If you want to get the <code>frameId</code> of a given renderer context you should use\nthe <code>webFrame.routingId</code> value.  E.g.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// In a renderer process</span>\n<span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'My frameId is:'</span>, <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).webFrame.routingId)\n</code></pre>\n<p>You can also read <code>frameId</code> from all incoming IPC messages in the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// In the main process</span>\nipcMain.on(<span class=\"hljs-string\">'ping'</span>, (event) => {\n  <span class=\"hljs-built_in\">console</span>.info(<span class=\"hljs-string\">'Message came from frameId:'</span>, event.frameId)\n})\n</code></pre>\n<h4 id=\"contentspostmessagechannel-message-transfer\"><a href=\"#contentspostmessagechannel-message-transfer\"><code>contents.postMessage(channel, message, [transfer])</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Send a message to the renderer process, optionally transferring ownership of\nzero or more [<code>MessagePortMain</code>][] objects.</p>\n<p>The transferred <code>MessagePortMain</code> objects will be available in the renderer\nprocess by accessing the <code>ports</code> property of the emitted event. When they\narrive in the renderer, they will be native DOM <code>MessagePort</code> objects.</p>\n<p>For example:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nwebContents.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<h4 id=\"contentsenabledeviceemulationparameters\"><a href=\"#contentsenabledeviceemulationparameters\"><code>contents.enableDeviceEmulation(parameters)</code></a></h4>\n<ul>\n<li><code>parameters</code> Object<ul>\n<li><code>screenPosition</code> String - Specify the screen type to emulate\n(default: <code>desktop</code>):<ul>\n<li><code>desktop</code> - Desktop screen type.</li>\n<li><code>mobile</code> - Mobile screen type.</li>\n</ul></li>\n<li><code>screenSize</code> <a href=\"/docs/api/structures/size\">Size</a> - Set the emulated screen size (screenPosition == mobile).</li>\n<li><code>viewPosition</code> <a href=\"/docs/api/structures/point\">Point</a> - Position the view on the screen\n(screenPosition == mobile) (default: <code>{ x: 0, y: 0 }</code>).</li>\n<li><code>deviceScaleFactor</code> Integer - Set the device scale factor (if zero defaults to\noriginal device scale factor) (default: <code>0</code>).</li>\n<li><code>viewSize</code> <a href=\"/docs/api/structures/size\">Size</a> - Set the emulated view size (empty means no override)</li>\n<li><code>scale</code> Float - Scale of emulated view inside available space (not in fit to\nview mode) (default: <code>1</code>).</li>\n</ul></li>\n</ul>\n<p>Enable device emulation with the given parameters.</p>\n<h4 id=\"contentsdisabledeviceemulation\"><a href=\"#contentsdisabledeviceemulation\"><code>contents.disableDeviceEmulation()</code></a></h4>\n<p>Disable device emulation enabled by <code>webContents.enableDeviceEmulation</code>.</p>\n<h4 id=\"contentssendinputeventinputevent\"><a href=\"#contentssendinputeventinputevent\"><code>contents.sendInputEvent(inputEvent)</code></a></h4>\n<ul>\n<li><code>inputEvent</code> <a href=\"/docs/api/structures/mouse-input-event\">MouseInputEvent</a> | <a href=\"/docs/api/structures/mouse-wheel-input-event\">MouseWheelInputEvent</a> | <a href=\"/docs/api/structures/keyboard-input-event\">KeyboardInputEvent</a></li>\n</ul>\n<p>Sends an input <code>event</code> to the page.\n<strong>Note:</strong> The <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> containing the contents needs to be focused for\n<code>sendInputEvent()</code> to work.</p>\n<h4 id=\"contentsbeginframesubscriptiononlydirty-callback\"><a href=\"#contentsbeginframesubscriptiononlydirty-callback\"><code>contents.beginFrameSubscription([onlyDirty ,]callback)</code></a></h4>\n<ul>\n<li><code>onlyDirty</code> Boolean (optional) - Defaults to <code>false</code>.</li>\n<li><code>callback</code> Function<ul>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a></li>\n<li><code>dirtyRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul></li>\n</ul>\n<p>Begin subscribing for presentation events and captured frames, the <code>callback</code>\nwill be called with <code>callback(image, dirtyRect)</code> when there is a presentation\nevent.</p>\n<p>The <code>image</code> is an instance of <a href=\"/docs/api/native-image\">NativeImage</a> that stores the\ncaptured frame.</p>\n<p>The <code>dirtyRect</code> is an object with <code>x, y, width, height</code> properties that\ndescribes which part of the page was repainted. If <code>onlyDirty</code> is set to\n<code>true</code>, <code>image</code> will only contain the repainted area. <code>onlyDirty</code> defaults to\n<code>false</code>.</p>\n<h4 id=\"contentsendframesubscription\"><a href=\"#contentsendframesubscription\"><code>contents.endFrameSubscription()</code></a></h4>\n<p>End subscribing for frame presentation events.</p>\n<h4 id=\"contentsstartdragitem\"><a href=\"#contentsstartdragitem\"><code>contents.startDrag(item)</code></a></h4>\n<ul>\n<li><code>item</code> Object<ul>\n<li><code>file</code> String - The path to the file being dragged.</li>\n<li><code>files</code> String<a href=\"/docs/api/optional\"></a> - The paths to the files being dragged. (<code>files</code> will override <code>file</code> field)</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String - The image must be\nnon-empty on macOS.</li>\n</ul></li>\n</ul>\n<p>Sets the <code>item</code> as dragging item for current drag-drop operation, <code>file</code> is the\nabsolute path of the file to be dragged, and <code>icon</code> is the image showing under\nthe cursor when dragging.</p>\n<h4 id=\"contentssavepagefullpath-savetype\"><a href=\"#contentssavepagefullpath-savetype\"><code>contents.savePage(fullPath, saveType)</code></a></h4>\n<ul>\n<li><code>fullPath</code> String - The full file path.</li>\n<li><code>saveType</code> String - Specify the save type.<ul>\n<li><code>HTMLOnly</code> - Save only the HTML of the page.</li>\n<li><code>HTMLComplete</code> - Save complete-html page.</li>\n<li><code>MHTML</code> - Save complete-html page as MHTML.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves if the page is saved.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\nwin.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  win.webContents.savePage(<span class=\"hljs-string\">'/tmp/test.html'</span>, <span class=\"hljs-string\">'HTMLComplete'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Page was saved successfully.'</span>)\n  }).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(err)\n  })\n})\n</code></pre>\n<h4 id=\"contentsshowdefinitionforselection-macos\"><a href=\"#contentsshowdefinitionforselection-macos\"><code>contents.showDefinitionForSelection()</code> <em>macOS</em></a></h4>\n<p>Shows pop-up dictionary that searches the selected word on the page.</p>\n<h4 id=\"contentsisoffscreen\"><a href=\"#contentsisoffscreen\"><code>contents.isOffscreen()</code></a></h4>\n<p>Returns <code>Boolean</code> - Indicates whether <em>offscreen rendering</em> is enabled.</p>\n<h4 id=\"contentsstartpainting\"><a href=\"#contentsstartpainting\"><code>contents.startPainting()</code></a></h4>\n<p>If <em>offscreen rendering</em> is enabled and not painting, start painting.</p>\n<h4 id=\"contentsstoppainting\"><a href=\"#contentsstoppainting\"><code>contents.stopPainting()</code></a></h4>\n<p>If <em>offscreen rendering</em> is enabled and painting, stop painting.</p>\n<h4 id=\"contentsispainting\"><a href=\"#contentsispainting\"><code>contents.isPainting()</code></a></h4>\n<p>Returns <code>Boolean</code> - If <em>offscreen rendering</em> is enabled returns whether it is currently painting.</p>\n<h4 id=\"contentssetframeratefps\"><a href=\"#contentssetframeratefps\"><code>contents.setFrameRate(fps)</code></a></h4>\n<ul>\n<li><code>fps</code> Integer</li>\n</ul>\n<p>If <em>offscreen rendering</em> is enabled sets the frame rate to the specified number.\nOnly values between 1 and 240 are accepted.</p>\n<h4 id=\"contentsgetframerate\"><a href=\"#contentsgetframerate\"><code>contents.getFrameRate()</code></a></h4>\n<p>Returns <code>Integer</code> - If <em>offscreen rendering</em> is enabled returns the current frame rate.</p>\n<h4 id=\"contentsinvalidate\"><a href=\"#contentsinvalidate\"><code>contents.invalidate()</code></a></h4>\n<p>Schedules a full repaint of the window this web contents is in.</p>\n<p>If <em>offscreen rendering</em> is enabled invalidates the frame and generates a new\none through the <code>'paint'</code> event.</p>\n<h4 id=\"contentsgetwebrtciphandlingpolicy\"><a href=\"#contentsgetwebrtciphandlingpolicy\"><code>contents.getWebRTCIPHandlingPolicy()</code></a></h4>\n<p>Returns <code>String</code> - Returns the WebRTC IP Handling Policy.</p>\n<h4 id=\"contentssetwebrtciphandlingpolicypolicy\"><a href=\"#contentssetwebrtciphandlingpolicypolicy\"><code>contents.setWebRTCIPHandlingPolicy(policy)</code></a></h4>\n<ul>\n<li><code>policy</code> String - Specify the WebRTC IP Handling Policy.<ul>\n<li><code>default</code> - Exposes user's public and local IPs. This is the default\nbehavior. When this policy is used, WebRTC has the right to enumerate all\ninterfaces and bind them to discover public interfaces.</li>\n<li><code>default_public_interface_only</code> - Exposes user's public IP, but does not\nexpose user's local IP. When this policy is used, WebRTC should only use the\ndefault route used by http. This doesn't expose any local addresses.</li>\n<li><code>default_public_and_private_interfaces</code> - Exposes user's public and local\nIPs. When this policy is used, WebRTC should only use the default route used\nby http. This also exposes the associated default private address. Default\nroute is the route chosen by the OS on a multi-homed endpoint.</li>\n<li><code>disable_non_proxied_udp</code> - Does not expose public or local IPs. When this\npolicy is used, WebRTC should only use TCP to contact peers or servers unless\nthe proxy server supports UDP.</li>\n</ul></li>\n</ul>\n<p>Setting the WebRTC IP handling policy allows you to control which IPs are\nexposed via WebRTC. See <a href=\"https://browserleaks.com/webrtc\">BrowserLeaks</a> for\nmore details.</p>\n<h4 id=\"contentsgetosprocessid\"><a href=\"#contentsgetosprocessid\"><code>contents.getOSProcessId()</code></a></h4>\n<p>Returns <code>Integer</code> - The operating system <code>pid</code> of the associated renderer\nprocess.</p>\n<h4 id=\"contentsgetprocessid\"><a href=\"#contentsgetprocessid\"><code>contents.getProcessId()</code></a></h4>\n<p>Returns <code>Integer</code> - The Chromium internal <code>pid</code> of the associated renderer. Can\nbe compared to the <code>frameProcessId</code> passed by frame specific navigation events\n(e.g. <code>did-frame-navigate</code>)</p>\n<h4 id=\"contentstakeheapsnapshotfilepath\"><a href=\"#contentstakeheapsnapshotfilepath\"><code>contents.takeHeapSnapshot(filePath)</code></a></h4>\n<ul>\n<li><code>filePath</code> String - Path to the output file.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Indicates whether the snapshot has been created successfully.</p>\n<p>Takes a V8 heap snapshot and saves it to <code>filePath</code>.</p>\n<h4 id=\"contentsgetbackgroundthrottling\"><a href=\"#contentsgetbackgroundthrottling\"><code>contents.getBackgroundThrottling()</code></a></h4>\n<p>Returns <code>Boolean</code> - whether or not this WebContents will throttle animations and timers\nwhen the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentssetbackgroundthrottlingallowed\"><a href=\"#contentssetbackgroundthrottlingallowed\"><code>contents.setBackgroundThrottling(allowed)</code></a></h4>\n<ul>\n<li><code>allowed</code> Boolean</li>\n</ul>\n<p>Controls whether or not this WebContents will throttle animations and timers\nwhen the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentsgettype\"><a href=\"#contentsgettype\"><code>contents.getType()</code></a></h4>\n<p>Returns <code>String</code> - the type of the webContent. Can be <code>backgroundPage</code>, <code>window</code>, <code>browserView</code>, <code>remote</code>, <code>webview</code> or <code>offscreen</code>.</p>\n<h4 id=\"contentssetimageanimationpolicypolicy\"><a href=\"#contentssetimageanimationpolicypolicy\"><code>contents.setImageAnimationPolicy(policy)</code></a></h4>\n<ul>\n<li><code>policy</code> String - Can be <code>animate</code>, <code>animateOnce</code> or <code>noAnimation</code>.</li>\n</ul>\n<p>Sets the image animation policy for this webContents.  The policy only affects\n<em>new</em> images, existing images that are currently being animated are unaffected.\nThis is a known limitation in Chromium, you can force image animation to be\nrecalculated with <code>img.src = img.src</code> which will result in no network traffic\nbut will update the animation policy.</p>\n<p>This corresponds to the <a href=\"https://developer.chrome.com/docs/extensions/reference/accessibilityFeatures/#property-animationPolicy\">animationPolicy</a> accessibility feature in Chromium.</p>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<h4 id=\"contentsaudiomuted\"><a href=\"#contentsaudiomuted\"><code>contents.audioMuted</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether this page is muted.</p>\n<h4 id=\"contentsuseragent\"><a href=\"#contentsuseragent\"><code>contents.userAgent</code></a></h4>\n<p>A <code>String</code> property that determines the user agent for this web page.</p>\n<h4 id=\"contentszoomlevel\"><a href=\"#contentszoomlevel\"><code>contents.zoomLevel</code></a></h4>\n<p>A <code>Number</code> property that determines the zoom level for this web contents.</p>\n<p>The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. The formula for this is <code>scale := 1.2 ^ level</code>.</p>\n<h4 id=\"contentszoomfactor\"><a href=\"#contentszoomfactor\"><code>contents.zoomFactor</code></a></h4>\n<p>A <code>Number</code> property that determines the zoom factor for this web contents.</p>\n<p>The zoom factor is the zoom percent divided by 100, so 300% = 3.0.</p>\n<h4 id=\"contentsframerate\"><a href=\"#contentsframerate\"><code>contents.frameRate</code></a></h4>\n<p>An <code>Integer</code> property that sets the frame rate of the web contents to the specified number.\nOnly values between 1 and 240 are accepted.</p>\n<p>Only applicable if <em>offscreen rendering</em> is enabled.</p>\n<h4 id=\"contentsid-readonly\"><a href=\"#contentsid-readonly\"><code>contents.id</code> <em>Readonly</em></a></h4>\n<p>A <code>Integer</code> representing the unique ID of this WebContents. Each ID is unique among all <code>WebContents</code> instances of the entire Electron application.</p>\n<h4 id=\"contentssession-readonly\"><a href=\"#contentssession-readonly\"><code>contents.session</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/session\"><code>Session</code></a> used by this webContents.</p>\n<h4 id=\"contentshostwebcontents-readonly\"><a href=\"#contentshostwebcontents-readonly\"><code>contents.hostWebContents</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> instance that might own this <code>WebContents</code>.</p>\n<h4 id=\"contentsdevtoolswebcontents-readonly\"><a href=\"#contentsdevtoolswebcontents-readonly\"><code>contents.devToolsWebContents</code> <em>Readonly</em></a></h4>\n<p>A <code>WebContents | null</code> property that represents the of DevTools <code>WebContents</code> associated with a given <code>WebContents</code>.</p>\n<p><strong>Note:</strong> Users should never store this object because it may become <code>null</code>\nwhen the DevTools has been closed.</p>\n<h4 id=\"contentsdebugger-readonly\"><a href=\"#contentsdebugger-readonly\"><code>contents.debugger</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/debugger\"><code>Debugger</code></a> instance for this webContents.</p>\n<h4 id=\"contentsbackgroundthrottling\"><a href=\"#contentsbackgroundthrottling\"><code>contents.backgroundThrottling</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether or not this WebContents will throttle animations and timers\nwhen the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentsmainframe-readonly\"><a href=\"#contentsmainframe-readonly\"><code>contents.mainFrame</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/web-frame-main\"><code>WebFrameMain</code></a> property that represents the top frame of the page's frame hierarchy.</p>",
      "title": "webContents",
      "description": "Render and control web pages."
    },
    "/docs/tutorial/web-embeds": {
      "locale": "en-US",
      "slug": "web-embeds",
      "href": "/docs/tutorial/web-embeds",
      "crowdinFileId": "256269",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/web-embeds.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"web-embeds\"><a href=\"#web-embeds\">Web Embeds</a></h1>\n<h2 id=\"overview\"><a href=\"#overview\">Overview</a></h2>\n<p>If you want to embed (third-party) web content in an Electron <code>BrowserWindow</code>,\nthere are three options available to you: <code>&#x3C;iframe></code> tags, <code>&#x3C;webview></code> tags,\nand <code>BrowserViews</code>. Each one offers slightly different functionality and is\nuseful in different situations. To help you choose between these, this guide\nexplains the differences and capabilities of each option.</p>\n<h3 id=\"iframes\"><a href=\"#iframes\">Iframes</a></h3>\n<p>Iframes in Electron behave like iframes in regular browsers. An <code>&#x3C;iframe></code>\nelement in your page can show external web pages, provided that their\n<a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP\">Content Security Policy</a>\nallows it. To limit the number of capabilities of a site in an <code>&#x3C;iframe></code> tag,\nit is recommended to use the <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox\"><code>sandbox</code> attribute</a>\nand only allow the capabilities you want to support.</p>\n<h3 id=\"webviews\"><a href=\"#webviews\">WebViews</a></h3>\n<blockquote>\n<p>Important Note:\n<a href=\"/docs/api/webview-tag#warning\">we do not recommend you to use WebViews</a>,\nas this tag undergoes dramatic architectural changes that may affect stability\nof your application. Consider switching to alternatives, like <code>iframe</code> and\nElectron's <code>BrowserView</code>, or an architecture that avoids embedded content\nby design.</p>\n</blockquote>\n<p><a href=\"/docs/api/webview-tag\">WebViews</a> are based on Chromium's WebViews and are not\nexplicitly supported by Electron. We do not guarantee that the WebView API will\nremain available in future versions of Electron. To use <code>&#x3C;webview></code> tags, you\nwill need to set <code>webviewTag</code> to <code>true</code> in the <code>webPreferences</code> of your\n<code>BrowserWindow</code>.</p>\n<p>WebView is a custom element (<code>&#x3C;webview></code>) that will only work inside Electron.\nThey are implemented as an \"out-of-process iframe\". This means that all\ncommunication with the <code>&#x3C;webview></code> is done asynchronously using IPC. The\n<code>&#x3C;webview></code> element has many custom methods and events, similar to\n<code>webContents</code>, that provide you with greater control over the content.</p>\n<p>Compared to an <code>&#x3C;iframe></code>, <code>&#x3C;webview></code> tends to be slightly slower but offers\nmuch greater control in loading and communicating with the third-party content\nand handling various events.</p>\n<h3 id=\"browserviews\"><a href=\"#browserviews\">BrowserViews</a></h3>\n<p><a href=\"/docs/api/browser-view\">BrowserViews</a> are not a part of the DOM - instead,\nthey are created in and controlled by your Main process. They are simply\nanother layer of web content on top of your existing window. This means\nthat they are completely separate from your own <code>BrowserWindow</code> content and\ntheir position is not controlled by the DOM or CSS. Instead, it is controlled\nby setting the bounds in the Main process.</p>\n<p><code>BrowserViews</code> offer the greatest control over their contents, since they\nimplement the <code>webContents</code> similarly to how the <code>BrowserWindow</code> does it.\nHowever, as <code>BrowserViews</code> are not a part of your DOM, but are rather overlaid\non top of them, you will have to manage their position manually.</p>",
      "title": "Web Embeds",
      "description": "Important Note:\nwe do not recommend you to use WebViews,\nas this tag undergoes dramatic architectural changes that may affect stability\nof your application. Consider switching to alternatives, like iframe and\nElectron's BrowserView, or an architecture that avoids embedded content\nby design."
    },
    "/docs/api/web-frame": {
      "locale": "en-US",
      "slug": "web-frame",
      "href": "/docs/api/web-frame",
      "crowdinFileId": "256403",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-frame.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webframe\"><a href=\"#webframe\">webFrame</a></h1>\n<blockquote>\n<p>Customize the rendering of the current web page.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p><code>webFrame</code> export of the Electron module is an instance of the <code>WebFrame</code>\nclass representing the top frame of the current <code>BrowserWindow</code>. Sub-frames can\nbe retrieved by certain properties and methods (e.g. <code>webFrame.firstChild</code>).</p>\n<p>An example of zooming current page to 200%.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nwebFrame.setZoomFactor(<span class=\"hljs-number\">2</span>)\n</code></pre>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>WebFrame</code> class has the following instance methods:</p>\n<h3 id=\"webframesetzoomfactorfactor\"><a href=\"#webframesetzoomfactorfactor\"><code>webFrame.setZoomFactor(factor)</code></a></h3>\n<ul>\n<li><code>factor</code> Double - Zoom factor; default is 1.0.</li>\n</ul>\n<p>Changes the zoom factor to the specified factor. Zoom factor is\nzoom percent divided by 100, so 300% = 3.0.</p>\n<p>The factor must be greater than 0.0.</p>\n<h3 id=\"webframegetzoomfactor\"><a href=\"#webframegetzoomfactor\"><code>webFrame.getZoomFactor()</code></a></h3>\n<p>Returns <code>Number</code> - The current zoom factor.</p>\n<h3 id=\"webframesetzoomlevellevel\"><a href=\"#webframesetzoomlevellevel\"><code>webFrame.setZoomLevel(level)</code></a></h3>\n<ul>\n<li><code>level</code> Number - Zoom level.</li>\n</ul>\n<p>Changes the zoom level to the specified level. The original size is 0 and each\nincrement above or below represents zooming 20% larger or smaller to default\nlimits of 300% and 50% of original size, respectively.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the\nzoom level for a specific domain propagates across all instances of windows with\nthe same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h3 id=\"webframegetzoomlevel\"><a href=\"#webframegetzoomlevel\"><code>webFrame.getZoomLevel()</code></a></h3>\n<p>Returns <code>Number</code> - The current zoom level.</p>\n<h3 id=\"webframesetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#webframesetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>webFrame.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h3>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>Sets the maximum and minimum pinch-to-zoom level.</p>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom is disabled by default in Electron. To re-enable it, call:</p>\n<pre><code class=\"hljs language-js\">webFrame.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">3</span>)\n</code></pre>\n</blockquote>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom shortcuts are\ncontrolled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem roles in the application\nMenu. To disable shortcuts, manually <a href=\"/docs/api/menu#examples\">define the Menu</a> and omit zoom roles\nfrom the definition.</p>\n</blockquote>\n<h3 id=\"webframesetspellcheckproviderlanguage-provider\"><a href=\"#webframesetspellcheckproviderlanguage-provider\"><code>webFrame.setSpellCheckProvider(language, provider)</code></a></h3>\n<ul>\n<li><code>language</code> String</li>\n<li><code>provider</code> Object<ul>\n<li><code>spellCheck</code> Function<ul>\n<li><code>words</code> String[]</li>\n<li><code>callback</code> Function<ul>\n<li><code>misspeltWords</code> String[]</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Sets a provider for spell checking in input fields and text areas.</p>\n<p>If you want to use this method you must disable the builtin spellchecker when you\nconstruct the window.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">spellcheck</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\n</code></pre>\n<p>The <code>provider</code> must be an object that has a <code>spellCheck</code> method that accepts\nan array of individual words for spellchecking.\nThe <code>spellCheck</code> function runs asynchronously and calls the <code>callback</code> function\nwith an array of misspelt words when complete.</p>\n<p>An example of using <a href=\"https://github.com/atom/node-spellchecker\">node-spellchecker</a> as provider:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> spellChecker = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spellchecker'</span>)\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, {\n  spellCheck (words, callback) {\n    setTimeout(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      <span class=\"hljs-keyword\">const</span> spellchecker = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spellchecker'</span>)\n      <span class=\"hljs-keyword\">const</span> misspelled = words.filter(<span class=\"hljs-function\"><span class=\"hljs-params\">x</span> =></span> spellchecker.isMisspelled(x))\n      callback(misspelled)\n    }, <span class=\"hljs-number\">0</span>)\n  }\n})\n</code></pre>\n<h3 id=\"webframeinsertcsscss\"><a href=\"#webframeinsertcsscss\"><code>webFrame.insertCSS(css)</code></a></h3>\n<ul>\n<li><code>css</code> String - CSS source code.</li>\n</ul>\n<p>Returns <code>String</code> - A key for the inserted CSS that can later be used to remove\nthe CSS via <code>webFrame.removeInsertedCSS(key)</code>.</p>\n<p>Injects CSS into the current web page and returns a unique key for the inserted\nstylesheet.</p>\n<h3 id=\"webframeremoveinsertedcsskey\"><a href=\"#webframeremoveinsertedcsskey\"><code>webFrame.removeInsertedCSS(key)</code></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified\nby its key, which is returned from <code>webFrame.insertCSS(css)</code>.</p>\n<h3 id=\"webframeinserttexttext\"><a href=\"#webframeinserttexttext\"><code>webFrame.insertText(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Inserts <code>text</code> to the focused element.</p>\n<h3 id=\"webframeexecutejavascriptcode-usergesture-callback\"><a href=\"#webframeexecutejavascriptcode-usergesture-callback\"><code>webFrame.executeJavaScript(code[, userGesture, callback])</code></a></h3>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n<li><code>callback</code> Function (optional) - Called after script has been executed. Unless\nthe frame is suspended (e.g. showing a modal alert), execution will be\nsynchronous and the callback will be invoked before the method returns. For\ncompatibility with an older version of this method, the error parameter is\nsecond.<ul>\n<li><code>result</code> Any</li>\n<li><code>error</code> Error</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed\ncode or is rejected if execution throws or results in a rejected promise.</p>\n<p>Evaluates <code>code</code> in page.</p>\n<p>In the browser window some HTML APIs like <code>requestFullScreen</code> can only be\ninvoked by a gesture from the user. Setting <code>userGesture</code> to <code>true</code> will remove\nthis limitation.</p>\n<h3 id=\"webframeexecutejavascriptinisolatedworldworldid-scripts-usergesture-callback\"><a href=\"#webframeexecutejavascriptinisolatedworldworldid-scripts-usergesture-callback\"><code>webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture, callback])</code></a></h3>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript\nin, <code>0</code> is the default main world (where content runs), <code>999</code> is the\nworld used by Electron's <code>contextIsolation</code> feature. Accepts values\nin the range 1..536870911.</li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/web-source\">WebSource[]</a></li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n<li><code>callback</code> Function (optional) - Called after script has been executed. Unless\nthe frame is suspended (e.g. showing a modal alert), execution will be\nsynchronous and the callback will be invoked before the method returns.  For\ncompatibility with an older version of this method, the error parameter is\nsecond.<ul>\n<li><code>result</code> Any</li>\n<li><code>error</code> Error</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed\ncode or is rejected if execution could not start.</p>\n<p>Works like <code>executeJavaScript</code> but evaluates <code>scripts</code> in an isolated context.</p>\n<p>Note that when the execution of script fails, the returned promise will not\nreject and the <code>result</code> would be <code>undefined</code>. This is because Chromium does not\ndispatch errors of isolated worlds to foreign worlds.</p>\n<h3 id=\"webframesetisolatedworldinfoworldid-info\"><a href=\"#webframesetisolatedworldinfoworldid-info\"><code>webFrame.setIsolatedWorldInfo(worldId, info)</code></a></h3>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default world, <code>999</code> is the world used by Electrons <code>contextIsolation</code> feature. Chrome extensions reserve the range of IDs in <code>[1 &#x3C;&#x3C; 20, 1 &#x3C;&#x3C; 29)</code>. You can provide any integer here.</li>\n<li><code>info</code> Object<ul>\n<li><code>securityOrigin</code> String (optional) - Security origin for the isolated world.</li>\n<li><code>csp</code> String (optional) - Content Security Policy for the isolated world.</li>\n<li><code>name</code> String (optional) - Name for isolated world. Useful in devtools.</li>\n</ul></li>\n</ul>\n<p>Set the security origin, content security policy and name of the isolated world.\nNote: If the <code>csp</code> is specified, then the <code>securityOrigin</code> also has to be specified.</p>\n<h3 id=\"webframegetresourceusage\"><a href=\"#webframegetresourceusage\"><code>webFrame.getResourceUsage()</code></a></h3>\n<p>Returns <code>Object</code>:</p>\n<ul>\n<li><code>images</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>cssStyleSheets</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>xslStyleSheets</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>fonts</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>other</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n</ul>\n<p>Returns an object describing usage information of Blink's internal memory\ncaches.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(webFrame.getResourceUsage())\n</code></pre>\n<p>This will generate:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">images</span>: {\n    <span class=\"hljs-attr\">count</span>: <span class=\"hljs-number\">22</span>,\n    <span class=\"hljs-attr\">size</span>: <span class=\"hljs-number\">2549</span>,\n    <span class=\"hljs-attr\">liveSize</span>: <span class=\"hljs-number\">2542</span>\n  },\n  <span class=\"hljs-attr\">cssStyleSheets</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> },\n  <span class=\"hljs-attr\">xslStyleSheets</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> },\n  <span class=\"hljs-attr\">fonts</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> },\n  <span class=\"hljs-attr\">other</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> }\n}\n</code></pre>\n<h3 id=\"webframeclearcache\"><a href=\"#webframeclearcache\"><code>webFrame.clearCache()</code></a></h3>\n<p>Attempts to free memory that is no longer being used (like images from a\nprevious navigation).</p>\n<p>Note that blindly calling this method probably makes Electron slower since it\nwill have to refill these emptied caches, you should only call it if an event\nin your app has occurred that makes you think your page is actually using less\nmemory (i.e. you have navigated from a super heavy page to a mostly empty one,\nand intend to stay there).</p>\n<h3 id=\"webframegetframeforselectorselector\"><a href=\"#webframegetframeforselectorselector\"><code>webFrame.getFrameForSelector(selector)</code></a></h3>\n<ul>\n<li><code>selector</code> String - CSS selector for a frame element.</li>\n</ul>\n<p>Returns <code>WebFrame</code> - The frame element in <code>webFrame's</code> document selected by\n<code>selector</code>, <code>null</code> would be returned if <code>selector</code> does not select a frame or\nif the frame is not in the current renderer process.</p>\n<h3 id=\"webframefindframebynamename\"><a href=\"#webframefindframebynamename\"><code>webFrame.findFrameByName(name)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n</ul>\n<p>Returns <code>WebFrame</code> - A child of <code>webFrame</code> with the supplied <code>name</code>, <code>null</code>\nwould be returned if there's no such frame or if the frame is not in the current\nrenderer process.</p>\n<h3 id=\"webframefindframebyroutingidroutingid\"><a href=\"#webframefindframebyroutingidroutingid\"><code>webFrame.findFrameByRoutingId(routingId)</code></a></h3>\n<ul>\n<li><code>routingId</code> Integer - An <code>Integer</code> representing the unique frame id in the\ncurrent renderer process. Routing IDs can be retrieved from <code>WebFrame</code>\ninstances (<code>webFrame.routingId</code>) and are also passed by frame\nspecific <code>WebContents</code> navigation events (e.g. <code>did-frame-navigate</code>)</li>\n</ul>\n<p>Returns <code>WebFrame</code> - that has the supplied <code>routingId</code>, <code>null</code> if not found.</p>\n<h3 id=\"webframeiswordmisspelledword\"><a href=\"#webframeiswordmisspelledword\"><code>webFrame.isWordMisspelled(word)</code></a></h3>\n<ul>\n<li><code>word</code> String - The word to be spellchecked.</li>\n</ul>\n<p>Returns <code>Boolean</code> - True if the word is misspelled according to the built in\nspellchecker, false otherwise. If no dictionary is loaded, always return false.</p>\n<h3 id=\"webframegetwordsuggestionsword\"><a href=\"#webframegetwordsuggestionsword\"><code>webFrame.getWordSuggestions(word)</code></a></h3>\n<ul>\n<li><code>word</code> String - The misspelled word.</li>\n</ul>\n<p>Returns <code>String[]</code> - A list of suggested words for a given word. If the word\nis spelled correctly, the result will be empty.</p>\n<h2 id=\"properties\"><a href=\"#properties\">Properties</a></h2>\n<h3 id=\"webframetop-readonly\"><a href=\"#webframetop-readonly\"><code>webFrame.top</code> <em>Readonly</em></a></h3>\n<p>A <code>WebFrame | null</code> representing top frame in frame hierarchy to which <code>webFrame</code>\nbelongs, the property would be <code>null</code> if top frame is not in the current\nrenderer process.</p>\n<h3 id=\"webframeopener-readonly\"><a href=\"#webframeopener-readonly\"><code>webFrame.opener</code> <em>Readonly</em></a></h3>\n<p>A <code>WebFrame | null</code> representing the frame which opened <code>webFrame</code>, the property would\nbe <code>null</code> if there's no opener or opener is not in the current renderer process.</p>\n<h3 id=\"webframeparent-readonly\"><a href=\"#webframeparent-readonly\"><code>webFrame.parent</code> <em>Readonly</em></a></h3>\n<p>A <code>WebFrame | null</code> representing parent frame of <code>webFrame</code>, the property would be\n<code>null</code> if <code>webFrame</code> is top or parent is not in the current renderer process.</p>\n<h3 id=\"webframefirstchild-readonly\"><a href=\"#webframefirstchild-readonly\"><code>webFrame.firstChild</code> <em>Readonly</em></a></h3>\n<p>A <code>WebFrame | null</code> representing the first child frame of <code>webFrame</code>, the property\nwould be <code>null</code> if <code>webFrame</code> has no children or if first child is not in the\ncurrent renderer process.</p>\n<h3 id=\"webframenextsibling-readonly\"><a href=\"#webframenextsibling-readonly\"><code>webFrame.nextSibling</code> <em>Readonly</em></a></h3>\n<p>A <code>WebFrame | null</code> representing next sibling frame, the property would be <code>null</code> if\n<code>webFrame</code> is the last frame in its parent or if the next sibling is not in the\ncurrent renderer process.</p>\n<h3 id=\"webframeroutingid-readonly\"><a href=\"#webframeroutingid-readonly\"><code>webFrame.routingId</code> <em>Readonly</em></a></h3>\n<p>An <code>Integer</code> representing the unique frame id in the current renderer process.\nDistinct WebFrame instances that refer to the same underlying frame will have\nthe same <code>routingId</code>.</p>",
      "title": "webFrame",
      "description": "Customize the rendering of the current web page."
    },
    "/docs/api/web-frame-main": {
      "locale": "en-US",
      "slug": "web-frame-main",
      "href": "/docs/api/web-frame-main",
      "crowdinFileId": "256401",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-frame-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webframemain\"><a href=\"#webframemain\">webFrameMain</a></h1>\n<blockquote>\n<p>Control web pages and iframes.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>The <code>webFrameMain</code> module can be used to lookup frames across existing\n<a href=\"/docs/api/web-contents\"><code>WebContents</code></a> instances. Navigation events are the common\nuse case.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, webFrameMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://twitter.com'</span>)\n\nwin.webContents.on(\n  <span class=\"hljs-string\">'did-frame-navigate'</span>,\n  (event, url, isMainFrame, frameProcessId, frameRoutingId) => {\n    <span class=\"hljs-keyword\">const</span> frame = webFrameMain.fromId(frameProcessId, frameRoutingId)\n    <span class=\"hljs-keyword\">if</span> (frame) {\n      <span class=\"hljs-keyword\">const</span> code = <span class=\"hljs-string\">'document.body.innerHTML = document.body.innerHTML.replaceAll(\"heck\", \"h*ck\")'</span>\n      frame.executeJavaScript(code)\n    }\n  }\n)\n</code></pre>\n<p>You can also access frames of existing pages by using the <code>mainFrame</code> property\nof <a href=\"/docs/api/web-contents\"><code>WebContents</code></a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">main</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  <span class=\"hljs-keyword\">await</span> win.loadURL(<span class=\"hljs-string\">'https://reddit.com'</span>)\n\n  <span class=\"hljs-keyword\">const</span> youtubeEmbeds = win.webContents.mainFrame.frames.filter(<span class=\"hljs-function\">(<span class=\"hljs-params\">frame</span>) =></span> {\n    <span class=\"hljs-keyword\">try</span> {\n      <span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-keyword\">new</span> URL(frame.url)\n      <span class=\"hljs-keyword\">return</span> url.host === <span class=\"hljs-string\">'www.youtube.com'</span>\n    } <span class=\"hljs-keyword\">catch</span> {\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n    }\n  })\n\n  <span class=\"hljs-built_in\">console</span>.log(youtubeEmbeds)\n}\n\nmain()\n</code></pre>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>These methods can be accessed from the <code>webFrameMain</code> module:</p>\n<h3 id=\"webframemainfromidprocessid-routingid\"><a href=\"#webframemainfromidprocessid-routingid\"><code>webFrameMain.fromId(processId, routingId)</code></a></h3>\n<ul>\n<li><code>processId</code> Integer - An <code>Integer</code> representing the internal ID of the process which owns the frame.</li>\n<li><code>routingId</code> Integer - An <code>Integer</code> representing the unique frame ID in the\ncurrent renderer process. Routing IDs can be retrieved from <code>WebFrameMain</code>\ninstances (<code>frame.routingId</code>) and are also passed by frame\nspecific <code>WebContents</code> navigation events (e.g. <code>did-frame-navigate</code>).</li>\n</ul>\n<p>Returns <code>WebFrameMain | undefined</code> - A frame with the given process and routing IDs,\nor <code>undefined</code> if there is no WebFrameMain associated with the given IDs.</p>\n<h2 id=\"class-webframemain\"><a href=\"#class-webframemain\">Class: WebFrameMain</a></h2>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"instance-events\"><a href=\"#instance-events\">Instance Events</a></h3>\n<h4 id=\"event-dom-ready\"><a href=\"#event-dom-ready\">Event: 'dom-ready'</a></h4>\n<p>Emitted when the document is loaded.</p>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<h4 id=\"frameexecutejavascriptcode-usergesture\"><a href=\"#frameexecutejavascriptcode-usergesture\"><code>frame.executeJavaScript(code[, userGesture])</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;unknown></code> - A promise that resolves with the result of the executed\ncode or is rejected if execution throws or results in a rejected promise.</p>\n<p>Evaluates <code>code</code> in page.</p>\n<p>In the browser window some HTML APIs like <code>requestFullScreen</code> can only be\ninvoked by a gesture from the user. Setting <code>userGesture</code> to <code>true</code> will remove\nthis limitation.</p>\n<h4 id=\"framereload\"><a href=\"#framereload\"><code>frame.reload()</code></a></h4>\n<p>Returns <code>boolean</code> - Whether the reload was initiated successfully. Only results in <code>false</code> when the frame has no history.</p>\n<h4 id=\"framesendchannel-args\"><a href=\"#framesendchannel-args\"><code>frame.send(channel, ...args)</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to the renderer process via <code>channel</code>, along with\narguments. Arguments will be serialized with the [Structured Clone\nAlgorithm][SCA], just like [<code>postMessage</code>][], so prototype chains will not be\nincluded. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will\nthrow an exception.</p>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the\n<a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<h4 id=\"framepostmessagechannel-message-transfer\"><a href=\"#framepostmessagechannel-message-transfer\"><code>frame.postMessage(channel, message, [transfer])</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Send a message to the renderer process, optionally transferring ownership of\nzero or more [<code>MessagePortMain</code>][] objects.</p>\n<p>The transferred <code>MessagePortMain</code> objects will be available in the renderer\nprocess by accessing the <code>ports</code> property of the emitted event. When they\narrive in the renderer, they will be native DOM <code>MessagePort</code> objects.</p>\n<p>For example:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nwebContents.mainFrame.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<h3 id=\"instance-properties\"><a href=\"#instance-properties\">Instance Properties</a></h3>\n<h4 id=\"frameurl-readonly\"><a href=\"#frameurl-readonly\"><code>frame.url</code> <em>Readonly</em></a></h4>\n<p>A <code>string</code> representing the current URL of the frame.</p>\n<h4 id=\"frametop-readonly\"><a href=\"#frametop-readonly\"><code>frame.top</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain | null</code> representing top frame in the frame hierarchy to which <code>frame</code>\nbelongs.</p>\n<h4 id=\"frameparent-readonly\"><a href=\"#frameparent-readonly\"><code>frame.parent</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain | null</code> representing parent frame of <code>frame</code>, the property would be\n<code>null</code> if <code>frame</code> is the top frame in the frame hierarchy.</p>\n<h4 id=\"frameframes-readonly\"><a href=\"#frameframes-readonly\"><code>frame.frames</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain[]</code> collection containing the direct descendents of <code>frame</code>.</p>\n<h4 id=\"frameframesinsubtree-readonly\"><a href=\"#frameframesinsubtree-readonly\"><code>frame.framesInSubtree</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain[]</code> collection containing every frame in the subtree of <code>frame</code>,\nincluding itself. This can be useful when traversing through all frames.</p>\n<h4 id=\"frameframetreenodeid-readonly\"><a href=\"#frameframetreenodeid-readonly\"><code>frame.frameTreeNodeId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the id of the frame's internal FrameTreeNode\ninstance. This id is browser-global and uniquely identifies a frame that hosts\ncontent. The identifier is fixed at the creation of the frame and stays\nconstant for the lifetime of the frame. When the frame is removed, the id is\nnot used again.</p>\n<h4 id=\"framename-readonly\"><a href=\"#framename-readonly\"><code>frame.name</code> <em>Readonly</em></a></h4>\n<p>A <code>String</code> representing the frame name.</p>\n<h4 id=\"frameosprocessid-readonly\"><a href=\"#frameosprocessid-readonly\"><code>frame.osProcessId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the operating system <code>pid</code> of the process which owns this frame.</p>\n<h4 id=\"frameprocessid-readonly\"><a href=\"#frameprocessid-readonly\"><code>frame.processId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the Chromium internal <code>pid</code> of the process which owns this frame.\nThis is not the same as the OS process ID; to read that use <code>frame.osProcessId</code>.</p>\n<h4 id=\"frameroutingid-readonly\"><a href=\"#frameroutingid-readonly\"><code>frame.routingId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the unique frame id in the current renderer process.\nDistinct <code>WebFrameMain</code> instances that refer to the same underlying frame will\nhave the same <code>routingId</code>.</p>\n<h4 id=\"framevisibilitystate-readonly\"><a href=\"#framevisibilitystate-readonly\"><code>frame.visibilityState</code> <em>Readonly</em></a></h4>\n<p>A <code>string</code> representing the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState\">visibility state</a> of the frame.</p>\n<p>See also how the <a href=\"/docs/api/browser-window#page-visibility\">Page Visibility API</a> is affected by other Electron APIs.</p>",
      "title": "webFrameMain",
      "description": "Control web pages and iframes."
    },
    "/docs/api/web-request": {
      "locale": "en-US",
      "slug": "web-request",
      "href": "/docs/api/web-request",
      "crowdinFileId": "256405",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-request.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-webrequest\"><a href=\"#class-webrequest\">Class: WebRequest</a></h2>\n<blockquote>\n<p>Intercept and modify the contents of a request at various stages of its lifetime.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Instances of the <code>WebRequest</code> class are accessed by using the <code>webRequest</code>\nproperty of a <code>Session</code>.</p>\n<p>The methods of <code>WebRequest</code> accept an optional <code>filter</code> and a <code>listener</code>. The\n<code>listener</code> will be called with <code>listener(details)</code> when the API's event has\nhappened. The <code>details</code> object describes the request.</p>\n<p>⚠️ Only the last attached <code>listener</code> will be used. Passing <code>null</code> as <code>listener</code> will unsubscribe from the event.</p>\n<p>The <code>filter</code> object has a <code>urls</code> property which is an Array of URL\npatterns that will be used to filter out the requests that do not match the URL\npatterns. If the <code>filter</code> is omitted then all requests will be matched.</p>\n<p>For certain events the <code>listener</code> is passed with a <code>callback</code>, which should be\ncalled with a <code>response</code> object when <code>listener</code> has done its work.</p>\n<p>An example of adding <code>User-Agent</code> header for requests:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Modify the user agent for all requests to the following urls.</span>\n<span class=\"hljs-keyword\">const</span> filter = {\n  <span class=\"hljs-attr\">urls</span>: [<span class=\"hljs-string\">'https://*.github.com/*'</span>, <span class=\"hljs-string\">'*://electron.github.io'</span>]\n}\n\nsession.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback) => {\n  details.requestHeaders[<span class=\"hljs-string\">'User-Agent'</span>] = <span class=\"hljs-string\">'MyAgent'</span>\n  callback({ <span class=\"hljs-attr\">requestHeaders</span>: details.requestHeaders })\n})\n</code></pre>\n<h3 id=\"instance-methods\"><a href=\"#instance-methods\">Instance Methods</a></h3>\n<p>The following methods are available on instances of <code>WebRequest</code>:</p>\n<h4 id=\"webrequestonbeforerequestfilter-listener\"><a href=\"#webrequestonbeforerequestfilter-listener\"><code>webRequest.onBeforeRequest([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (optional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/upload-data\">UploadData[]</a></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> Object<ul>\n<li><code>cancel</code> Boolean (optional)</li>\n<li><code>redirectURL</code> String (optional) - The original request is prevented from\nbeing sent or completed and is instead redirected to the given URL.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details, callback)</code> when a request\nis about to occur.</p>\n<p>The <code>uploadData</code> is an array of <code>UploadData</code> objects.</p>\n<p>The <code>callback</code> has to be called with an <code>response</code> object.</p>\n<p>Some examples of valid <code>urls</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-string\">'http://foo:1234/'</span>\n<span class=\"hljs-string\">'http://foo.com/'</span>\n<span class=\"hljs-string\">'http://foo:1234/bar'</span>\n<span class=\"hljs-string\">'*://*/*'</span>\n<span class=\"hljs-string\">'*://example.com/*'</span>\n<span class=\"hljs-string\">'*://example.com/foo/*'</span>\n<span class=\"hljs-string\">'http://*.foo:1234/'</span>\n<span class=\"hljs-string\">'file://foo:1234/bar'</span>\n<span class=\"hljs-string\">'http://foo:*/'</span>\n<span class=\"hljs-string\">'*://www.foo.com/'</span>\n</code></pre>\n<h4 id=\"webrequestonbeforesendheadersfilter-listener\"><a href=\"#webrequestonbeforesendheadersfilter-listener\"><code>webRequest.onBeforeSendHeaders([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (optional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>beforeSendResponse</code> Object\n<em> <code>cancel</code> Boolean (optional)\n</em> <code>requestHeaders</code> Record&#x3C;string, string | string[]> (optional) - When provided, request will be made\nwith these headers.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details, callback)</code> before sending\nan HTTP request, once the request headers are available. This may occur after a\nTCP connection is made to the server, but before any http data is sent.</p>\n<p>The <code>callback</code> has to be called with a <code>response</code> object.</p>\n<h4 id=\"webrequestonsendheadersfilter-listener\"><a href=\"#webrequestonsendheadersfilter-listener\"><code>webRequest.onSendHeaders([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (optional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> just before a request is\ngoing to be sent to the server, modifications of previous <code>onBeforeSendHeaders</code>\nresponse are visible by the time this listener is fired.</p>\n<h4 id=\"webrequestonheadersreceivedfilter-listener\"><a href=\"#webrequestonheadersreceivedfilter-listener\"><code>webRequest.onHeadersReceived([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (optional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>statusLine</code> String</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>headersReceivedResponse</code> Object<ul>\n<li><code>cancel</code> Boolean (optional)</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string | string[]> (optional) - When provided, the server is assumed\nto have responded with these headers.</li>\n<li><code>statusLine</code> String (optional) - Should be provided when overriding\n<code>responseHeaders</code> to change header status otherwise original response\nheader's status will be used.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details, callback)</code> when HTTP\nresponse headers of a request have been received.</p>\n<p>The <code>callback</code> has to be called with a <code>response</code> object.</p>\n<h4 id=\"webrequestonresponsestartedfilter-listener\"><a href=\"#webrequestonresponsestartedfilter-listener\"><code>webRequest.onResponseStarted([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (optional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n<li><code>fromCache</code> Boolean - Indicates whether the response was fetched from disk\ncache.</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when first byte of the\nresponse body is received. For HTTP requests, this means that the status line\nand response headers are available.</p>\n<h4 id=\"webrequestonbeforeredirectfilter-listener\"><a href=\"#webrequestonbeforeredirectfilter-listener\"><code>webRequest.onBeforeRedirect([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (optional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>redirectURL</code> String</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n<li><code>ip</code> String (optional) - The server IP address that the request was\nactually sent to.</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when a server initiated\nredirect is about to occur.</p>\n<h4 id=\"webrequestoncompletedfilter-listener\"><a href=\"#webrequestoncompletedfilter-listener\"><code>webRequest.onCompleted([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (optional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n<li><code>error</code> String</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when a request is\ncompleted.</p>\n<h4 id=\"webrequestonerroroccurredfilter-listener\"><a href=\"#webrequestonerroroccurredfilter-listener\"><code>webRequest.onErrorOccurred([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (optional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>error</code> String - The error description.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when an error occurs.</p>",
      "title": "WebRequest",
      "description": "Intercept and modify the contents of a request at various stages of its lifetime."
    },
    "/docs/api/structures/web-request-filter": {
      "locale": "en-US",
      "slug": "web-request-filter",
      "href": "/docs/api/structures/web-request-filter",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/web-request-filter.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"webrequestfilter-object\"><a href=\"#webrequestfilter-object\">WebRequestFilter Object</a></h1>\n<ul>\n<li><code>urls</code> String[] - Array of URL patterns that will be used to filter out the requests that do not match the URL patterns.</li>\n</ul>",
      "title": "WebRequestFilter Object",
      "description": ""
    },
    "/docs/api/structures/web-source": {
      "locale": "en-US",
      "slug": "web-source",
      "href": "/docs/api/structures/web-source",
      "crowdinFileId": "256529",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/web-source.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"websource-object\"><a href=\"#websource-object\">WebSource Object</a></h1>\n<ul>\n<li><code>code</code> String</li>\n<li><code>url</code> String (optional)</li>\n<li><code>startLine</code> Integer (optional) - Default is 1.</li>\n</ul>",
      "title": "WebSource Object",
      "description": ""
    },
    "/docs/api/webview-tag": {
      "locale": "en-US",
      "slug": "webview-tag",
      "href": "/docs/api/webview-tag",
      "crowdinFileId": "256407",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/webview-tag.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webview-tag\"><a href=\"#webview-tag\"><code>&#x3C;webview></code> Tag</a></h1>\n<h2 id=\"warning\"><a href=\"#warning\">Warning</a></h2>\n<p>Electron's <code>webview</code> tag is based on <a href=\"https://developer.chrome.com/docs/extensions/reference/webviewTag/\">Chromium's <code>webview</code></a>, which\nis undergoing dramatic architectural changes. This impacts the stability of <code>webviews</code>,\nincluding rendering, navigation, and event routing. We currently recommend to not\nuse the <code>webview</code> tag and to consider alternatives, like <code>iframe</code>, <a href=\"/docs/api/browser-view\">Electron's <code>BrowserView</code></a>,\nor an architecture that avoids embedded content altogether.</p>\n<h2 id=\"enabling\"><a href=\"#enabling\">Enabling</a></h2>\n<p>By default the <code>webview</code> tag is disabled in Electron >= 5.  You need to enable the tag by\nsetting the <code>webviewTag</code> webPreferences option when constructing your <code>BrowserWindow</code>. For\nmore information see the <a href=\"/docs/api/browser-window\">BrowserWindow constructor docs</a>.</p>\n<h2 id=\"overview\"><a href=\"#overview\">Overview</a></h2>\n<blockquote>\n<p>Display external web content in an isolated frame and process.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#renderer-process\">Renderer</a><br>\n<em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Use the <code>webview</code> tag to embed 'guest' content (such as web pages) in your\nElectron app. The guest content is contained within the <code>webview</code> container.\nAn embedded page within your app controls how the guest content is laid out and\nrendered.</p>\n<p>Unlike an <code>iframe</code>, the <code>webview</code> runs in a separate process than your\napp. It doesn't have the same permissions as your web page and all interactions\nbetween your app and embedded content will be asynchronous. This keeps your app\nsafe from the embedded content. <strong>Note:</strong> Most methods called on the\nwebview from the host page require a synchronous call to the main process.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<p>To embed a web page in your app, add the <code>webview</code> tag to your app's embedder\npage (this is the app page that will display the guest content). In its simplest\nform, the <code>webview</code> tag includes the <code>src</code> of the web page and css styles that\ncontrol the appearance of the <code>webview</code> container:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"foo\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"display:inline-flex; width:640px; height:480px\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>If you want to control the guest content in any way, you can write JavaScript\nthat listens for <code>webview</code> events and responds to those events using the\n<code>webview</code> methods. Here's sample code with two event listeners: one that listens\nfor the web page to start loading, the other for the web page to stop loading,\nand displays a \"loading...\" message during the load time:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  onload = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\n    <span class=\"hljs-keyword\">const</span> indicator = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'.indicator'</span>)\n\n    <span class=\"hljs-keyword\">const</span> loadstart = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      indicator.innerText = <span class=\"hljs-string\">'loading...'</span>\n    }\n\n    <span class=\"hljs-keyword\">const</span> loadstop = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      indicator.innerText = <span class=\"hljs-string\">''</span>\n    }\n\n    webview.addEventListener(<span class=\"hljs-string\">'did-start-loading'</span>, loadstart)\n    webview.addEventListener(<span class=\"hljs-string\">'did-stop-loading'</span>, loadstop)\n  }\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h2 id=\"internal-implementation\"><a href=\"#internal-implementation\">Internal implementation</a></h2>\n<p>Under the hood <code>webview</code> is implemented with <a href=\"https://www.chromium.org/developers/design-documents/oop-iframes\">Out-of-Process iframes (OOPIFs)</a>.\nThe <code>webview</code> tag is essentially a custom element using shadow DOM to wrap an\n<code>iframe</code> element inside it.</p>\n<p>So the behavior of <code>webview</code> is very similar to a cross-domain <code>iframe</code>, as\nexamples:</p>\n<ul>\n<li>When clicking into a <code>webview</code>, the page focus will move from the embedder\nframe to <code>webview</code>.</li>\n<li>You can not add keyboard, mouse, and scroll event listeners to <code>webview</code>.</li>\n<li>All reactions between the embedder frame and <code>webview</code> are asynchronous.</li>\n</ul>\n<h2 id=\"css-styling-notes\"><a href=\"#css-styling-notes\">CSS Styling Notes</a></h2>\n<p>Please note that the <code>webview</code> tag's style uses <code>display:flex;</code> internally to\nensure the child <code>iframe</code> element fills the full height and width of its <code>webview</code>\ncontainer when used with traditional and flexbox layouts. Please do not\noverwrite the default <code>display:flex;</code> CSS property, unless specifying\n<code>display:inline-flex;</code> for inline layout.</p>\n<h2 id=\"tag-attributes\"><a href=\"#tag-attributes\">Tag Attributes</a></h2>\n<p>The <code>webview</code> tag has the following attributes:</p>\n<h3 id=\"src\"><a href=\"#src\"><code>src</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> representing the visible URL. Writing to this attribute initiates top-level\nnavigation.</p>\n<p>Assigning <code>src</code> its own value will reload the current page.</p>\n<p>The <code>src</code> attribute can also accept data URLs, such as\n<code>data:text/plain,Hello, world!</code>.</p>\n<h3 id=\"nodeintegration\"><a href=\"#nodeintegration\"><code>nodeintegration</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://www.google.com/\"</span> <span class=\"hljs-attr\">nodeintegration</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page in <code>webview</code> will have node\nintegration and can use node APIs like <code>require</code> and <code>process</code> to access low\nlevel system resources. Node integration is disabled by default in the guest\npage.</p>\n<h3 id=\"nodeintegrationinsubframes\"><a href=\"#nodeintegrationinsubframes\"><code>nodeintegrationinsubframes</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://www.google.com/\"</span> <span class=\"hljs-attr\">nodeintegrationinsubframes</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code> for the experimental option for enabling NodeJS support in sub-frames such as iframes\ninside the <code>webview</code>. All your preloads will load for every iframe, you can\nuse <code>process.isMainFrame</code> to determine if you are in the main frame or not.\nThis option is disabled by default in the guest page.</p>\n<h3 id=\"plugins\"><a href=\"#plugins\"><code>plugins</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">plugins</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page in <code>webview</code> will be able to use\nbrowser plugins. Plugins are disabled by default.</p>\n<h3 id=\"preload\"><a href=\"#preload\"><code>preload</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- from a file --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">preload</span>=<span class=\"hljs-string\">\"./test.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n<span class=\"hljs-comment\">&#x3C;!-- or if you want to load from an asar archive --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">preload</span>=<span class=\"hljs-string\">\"./app.asar/test.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that specifies a script that will be loaded before other scripts run in the guest\npage. The protocol of script's URL must be <code>file:</code> (even when using <code>asar:</code> archives) because\nit will be loaded by Node's <code>require</code> under the hood, which treats <code>asar:</code> archives as virtual\ndirectories.</p>\n<p>When the guest page doesn't have node integration this script will still have\naccess to all Node APIs, but global objects injected by Node will be deleted\nafter this script has finished executing.</p>\n<p><strong>Note:</strong> This option will appear as <code>preloadURL</code> (not <code>preload</code>) in\nthe <code>webPreferences</code> specified to the <code>will-attach-webview</code> event.</p>\n<h3 id=\"httpreferrer\"><a href=\"#httpreferrer\"><code>httpreferrer</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">httpreferrer</span>=<span class=\"hljs-string\">\"http://cheng.guru\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the referrer URL for the guest page.</p>\n<h3 id=\"useragent\"><a href=\"#useragent\"><code>useragent</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">useragent</span>=<span class=\"hljs-string\">\"Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the user agent for the guest page before the page is navigated to. Once the\npage is loaded, use the <code>setUserAgent</code> method to change the user agent.</p>\n<h3 id=\"disablewebsecurity\"><a href=\"#disablewebsecurity\"><code>disablewebsecurity</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">disablewebsecurity</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page will have web security disabled.\nWeb security is enabled by default.</p>\n<h3 id=\"partition\"><a href=\"#partition\"><code>partition</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span> <span class=\"hljs-attr\">partition</span>=<span class=\"hljs-string\">\"persist:github\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://electronjs.org\"</span> <span class=\"hljs-attr\">partition</span>=<span class=\"hljs-string\">\"electron\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the session used by the page. If <code>partition</code> starts with <code>persist:</code>, the\npage will use a persistent session available to all pages in the app with the\nsame <code>partition</code>. if there is no <code>persist:</code> prefix, the page will use an\nin-memory session. By assigning the same <code>partition</code>, multiple pages can share\nthe same session. If the <code>partition</code> is unset then default session of the app\nwill be used.</p>\n<p>This value can only be modified before the first navigation, since the session\nof an active renderer process cannot change. Subsequent attempts to modify the\nvalue will fail with a DOM exception.</p>\n<h3 id=\"allowpopups\"><a href=\"#allowpopups\"><code>allowpopups</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">allowpopups</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page will be allowed to open new\nwindows. Popups are disabled by default.</p>\n<h3 id=\"webpreferences\"><a href=\"#webpreferences\"><code>webpreferences</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span> <span class=\"hljs-attr\">webpreferences</span>=<span class=\"hljs-string\">\"allowRunningInsecureContent, javascript=no\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> which is a comma separated list of strings which specifies the web preferences to be set on the webview.\nThe full list of supported preference strings can be found in <a href=\"/docs/api/browser-window#new-browserwindowoptions\">BrowserWindow</a>.</p>\n<p>The string follows the same format as the features string in <code>window.open</code>.\nA name by itself is given a <code>true</code> boolean value.\nA preference can be set to another value by including an <code>=</code>, followed by the value.\nSpecial values <code>yes</code> and <code>1</code> are interpreted as <code>true</code>, while <code>no</code> and <code>0</code> are interpreted as <code>false</code>.</p>\n<h3 id=\"enableblinkfeatures\"><a href=\"#enableblinkfeatures\"><code>enableblinkfeatures</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">enableblinkfeatures</span>=<span class=\"hljs-string\">\"PreciseMemoryInfo, CSSVariables\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> which is a list of strings which specifies the blink features to be enabled separated by <code>,</code>.\nThe full list of supported feature strings can be found in the\n<a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> file.</p>\n<h3 id=\"disableblinkfeatures\"><a href=\"#disableblinkfeatures\"><code>disableblinkfeatures</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">disableblinkfeatures</span>=<span class=\"hljs-string\">\"PreciseMemoryInfo, CSSVariables\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> which is a list of strings which specifies the blink features to be disabled separated by <code>,</code>.\nThe full list of supported feature strings can be found in the\n<a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> file.</p>\n<h2 id=\"methods\"><a href=\"#methods\">Methods</a></h2>\n<p>The <code>webview</code> tag has the following methods:</p>\n<p><strong>Note:</strong> The webview element must be loaded before using the methods.</p>\n<p><strong>Example</strong></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'dom-ready'</span>, () => {\n  webview.openDevTools()\n})\n</code></pre>\n<h3 id=\"webviewloadurlurl-options\"><a href=\"#webviewloadurlurl-options\"><code>&#x3C;webview>.loadURL(url[, options])</code></a></h3>\n<ul>\n<li><code>url</code> URL</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (optional) - An HTTP Referrer url.</li>\n<li><code>userAgent</code> String (optional) - A user agent originating the request.</li>\n<li><code>extraHeaders</code> String (optional) - Extra headers separated by \"\\n\"</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified <code>url</code> is a data url and needs to load other files.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - The promise will resolve when the page has finished loading\n(see <a href=\"/docs/api/webview-tag#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects\nif the page fails to load (see\n<a href=\"/docs/api/webview-tag#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Loads the <code>url</code> in the webview, the <code>url</code> must contain the protocol prefix,\ne.g. the <code>http://</code> or <code>file://</code>.</p>\n<h3 id=\"webviewdownloadurlurl\"><a href=\"#webviewdownloadurlurl\"><code>&#x3C;webview>.downloadURL(url)</code></a></h3>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code> without navigating.</p>\n<h3 id=\"webviewgeturl\"><a href=\"#webviewgeturl\"><code>&#x3C;webview>.getURL()</code></a></h3>\n<p>Returns <code>String</code> - The URL of guest page.</p>\n<h3 id=\"webviewgettitle\"><a href=\"#webviewgettitle\"><code>&#x3C;webview>.getTitle()</code></a></h3>\n<p>Returns <code>String</code> - The title of guest page.</p>\n<h3 id=\"webviewisloading\"><a href=\"#webviewisloading\"><code>&#x3C;webview>.isLoading()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether guest page is still loading resources.</p>\n<h3 id=\"webviewisloadingmainframe\"><a href=\"#webviewisloadingmainframe\"><code>&#x3C;webview>.isLoadingMainFrame()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the main frame (and not just iframes or frames within it) is\nstill loading.</p>\n<h3 id=\"webviewiswaitingforresponse\"><a href=\"#webviewiswaitingforresponse\"><code>&#x3C;webview>.isWaitingForResponse()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the guest page is waiting for a first-response for the\nmain resource of the page.</p>\n<h3 id=\"webviewstop\"><a href=\"#webviewstop\"><code>&#x3C;webview>.stop()</code></a></h3>\n<p>Stops any pending navigation.</p>\n<h3 id=\"webviewreload\"><a href=\"#webviewreload\"><code>&#x3C;webview>.reload()</code></a></h3>\n<p>Reloads the guest page.</p>\n<h3 id=\"webviewreloadignoringcache\"><a href=\"#webviewreloadignoringcache\"><code>&#x3C;webview>.reloadIgnoringCache()</code></a></h3>\n<p>Reloads the guest page and ignores cache.</p>\n<h3 id=\"webviewcangoback\"><a href=\"#webviewcangoback\"><code>&#x3C;webview>.canGoBack()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the guest page can go back.</p>\n<h3 id=\"webviewcangoforward\"><a href=\"#webviewcangoforward\"><code>&#x3C;webview>.canGoForward()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the guest page can go forward.</p>\n<h3 id=\"webviewcangotooffsetoffset\"><a href=\"#webviewcangotooffsetoffset\"><code>&#x3C;webview>.canGoToOffset(offset)</code></a></h3>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the guest page can go to <code>offset</code>.</p>\n<h3 id=\"webviewclearhistory\"><a href=\"#webviewclearhistory\"><code>&#x3C;webview>.clearHistory()</code></a></h3>\n<p>Clears the navigation history.</p>\n<h3 id=\"webviewgoback\"><a href=\"#webviewgoback\"><code>&#x3C;webview>.goBack()</code></a></h3>\n<p>Makes the guest page go back.</p>\n<h3 id=\"webviewgoforward\"><a href=\"#webviewgoforward\"><code>&#x3C;webview>.goForward()</code></a></h3>\n<p>Makes the guest page go forward.</p>\n<h3 id=\"webviewgotoindexindex\"><a href=\"#webviewgotoindexindex\"><code>&#x3C;webview>.goToIndex(index)</code></a></h3>\n<ul>\n<li><code>index</code> Integer</li>\n</ul>\n<p>Navigates to the specified absolute index.</p>\n<h3 id=\"webviewgotooffsetoffset\"><a href=\"#webviewgotooffsetoffset\"><code>&#x3C;webview>.goToOffset(offset)</code></a></h3>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Navigates to the specified offset from the \"current entry\".</p>\n<h3 id=\"webviewiscrashed\"><a href=\"#webviewiscrashed\"><code>&#x3C;webview>.isCrashed()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the renderer process has crashed.</p>\n<h3 id=\"webviewsetuseragentuseragent\"><a href=\"#webviewsetuseragentuseragent\"><code>&#x3C;webview>.setUserAgent(userAgent)</code></a></h3>\n<ul>\n<li><code>userAgent</code> String</li>\n</ul>\n<p>Overrides the user agent for the guest page.</p>\n<h3 id=\"webviewgetuseragent\"><a href=\"#webviewgetuseragent\"><code>&#x3C;webview>.getUserAgent()</code></a></h3>\n<p>Returns <code>String</code> - The user agent for guest page.</p>\n<h3 id=\"webviewinsertcsscss\"><a href=\"#webviewinsertcsscss\"><code>&#x3C;webview>.insertCSS(css)</code></a></h3>\n<ul>\n<li><code>css</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - A promise that resolves with a key for the inserted\nCSS that can later be used to remove the CSS via\n<code>&#x3C;webview>.removeInsertedCSS(key)</code>.</p>\n<p>Injects CSS into the current web page and returns a unique key for the inserted\nstylesheet.</p>\n<h3 id=\"webviewremoveinsertedcsskey\"><a href=\"#webviewremoveinsertedcsskey\"><code>&#x3C;webview>.removeInsertedCSS(key)</code></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves if the removal was successful.</p>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified\nby its key, which is returned from <code>&#x3C;webview>.insertCSS(css)</code>.</p>\n<h3 id=\"webviewexecutejavascriptcode-usergesture\"><a href=\"#webviewexecutejavascriptcode-usergesture\"><code>&#x3C;webview>.executeJavaScript(code[, userGesture])</code></a></h3>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (optional) - Default <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code\nor is rejected if the result of the code is a rejected promise.</p>\n<p>Evaluates <code>code</code> in page. If <code>userGesture</code> is set, it will create the user\ngesture context in the page. HTML APIs like <code>requestFullScreen</code>, which require\nuser action, can take advantage of this option for automation.</p>\n<h3 id=\"webviewopendevtools\"><a href=\"#webviewopendevtools\"><code>&#x3C;webview>.openDevTools()</code></a></h3>\n<p>Opens a DevTools window for guest page.</p>\n<h3 id=\"webviewclosedevtools\"><a href=\"#webviewclosedevtools\"><code>&#x3C;webview>.closeDevTools()</code></a></h3>\n<p>Closes the DevTools window of guest page.</p>\n<h3 id=\"webviewisdevtoolsopened\"><a href=\"#webviewisdevtoolsopened\"><code>&#x3C;webview>.isDevToolsOpened()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether guest page has a DevTools window attached.</p>\n<h3 id=\"webviewisdevtoolsfocused\"><a href=\"#webviewisdevtoolsfocused\"><code>&#x3C;webview>.isDevToolsFocused()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether DevTools window of guest page is focused.</p>\n<h3 id=\"webviewinspectelementx-y\"><a href=\"#webviewinspectelementx-y\"><code>&#x3C;webview>.inspectElement(x, y)</code></a></h3>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Starts inspecting element at position (<code>x</code>, <code>y</code>) of guest page.</p>\n<h3 id=\"webviewinspectsharedworker\"><a href=\"#webviewinspectsharedworker\"><code>&#x3C;webview>.inspectSharedWorker()</code></a></h3>\n<p>Opens the DevTools for the shared worker context present in the guest page.</p>\n<h3 id=\"webviewinspectserviceworker\"><a href=\"#webviewinspectserviceworker\"><code>&#x3C;webview>.inspectServiceWorker()</code></a></h3>\n<p>Opens the DevTools for the service worker context present in the guest page.</p>\n<h3 id=\"webviewsetaudiomutedmuted\"><a href=\"#webviewsetaudiomutedmuted\"><code>&#x3C;webview>.setAudioMuted(muted)</code></a></h3>\n<ul>\n<li><code>muted</code> Boolean</li>\n</ul>\n<p>Set guest page muted.</p>\n<h3 id=\"webviewisaudiomuted\"><a href=\"#webviewisaudiomuted\"><code>&#x3C;webview>.isAudioMuted()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether guest page has been muted.</p>\n<h3 id=\"webviewiscurrentlyaudible\"><a href=\"#webviewiscurrentlyaudible\"><code>&#x3C;webview>.isCurrentlyAudible()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether audio is currently playing.</p>\n<h3 id=\"webviewundo\"><a href=\"#webviewundo\"><code>&#x3C;webview>.undo()</code></a></h3>\n<p>Executes editing command <code>undo</code> in page.</p>\n<h3 id=\"webviewredo\"><a href=\"#webviewredo\"><code>&#x3C;webview>.redo()</code></a></h3>\n<p>Executes editing command <code>redo</code> in page.</p>\n<h3 id=\"webviewcut\"><a href=\"#webviewcut\"><code>&#x3C;webview>.cut()</code></a></h3>\n<p>Executes editing command <code>cut</code> in page.</p>\n<h3 id=\"webviewcopy\"><a href=\"#webviewcopy\"><code>&#x3C;webview>.copy()</code></a></h3>\n<p>Executes editing command <code>copy</code> in page.</p>\n<h3 id=\"webviewpaste\"><a href=\"#webviewpaste\"><code>&#x3C;webview>.paste()</code></a></h3>\n<p>Executes editing command <code>paste</code> in page.</p>\n<h3 id=\"webviewpasteandmatchstyle\"><a href=\"#webviewpasteandmatchstyle\"><code>&#x3C;webview>.pasteAndMatchStyle()</code></a></h3>\n<p>Executes editing command <code>pasteAndMatchStyle</code> in page.</p>\n<h3 id=\"webviewdelete\"><a href=\"#webviewdelete\"><code>&#x3C;webview>.delete()</code></a></h3>\n<p>Executes editing command <code>delete</code> in page.</p>\n<h3 id=\"webviewselectall\"><a href=\"#webviewselectall\"><code>&#x3C;webview>.selectAll()</code></a></h3>\n<p>Executes editing command <code>selectAll</code> in page.</p>\n<h3 id=\"webviewunselect\"><a href=\"#webviewunselect\"><code>&#x3C;webview>.unselect()</code></a></h3>\n<p>Executes editing command <code>unselect</code> in page.</p>\n<h3 id=\"webviewreplacetext\"><a href=\"#webviewreplacetext\"><code>&#x3C;webview>.replace(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes editing command <code>replace</code> in page.</p>\n<h3 id=\"webviewreplacemisspellingtext\"><a href=\"#webviewreplacemisspellingtext\"><code>&#x3C;webview>.replaceMisspelling(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes editing command <code>replaceMisspelling</code> in page.</p>\n<h3 id=\"webviewinserttexttext\"><a href=\"#webviewinserttexttext\"><code>&#x3C;webview>.insertText(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code></p>\n<p>Inserts <code>text</code> to the focused element.</p>\n<h3 id=\"webviewfindinpagetext-options\"><a href=\"#webviewfindinpagetext-options\"><code>&#x3C;webview>.findInPage(text[, options])</code></a></h3>\n<ul>\n<li><code>text</code> String - Content to be searched, must not be empty.</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>forward</code> Boolean (optional) - Whether to search forward or backward, defaults to <code>true</code>.</li>\n<li><code>findNext</code> Boolean (optional) - Whether to begin a new text finding session with this request. Should be <code>true</code> for initial requests, and <code>false</code> for follow-up requests. Defaults to <code>false</code>.</li>\n<li><code>matchCase</code> Boolean (optional) - Whether search should be case-sensitive,\ndefaults to <code>false</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code> - The request id used for the request.</p>\n<p>Starts a request to find all matches for the <code>text</code> in the web page. The result of the request\ncan be obtained by subscribing to <a href=\"/docs/api/webview-tag#event-found-in-page\"><code>found-in-page</code></a> event.</p>\n<h3 id=\"webviewstopfindinpageaction\"><a href=\"#webviewstopfindinpageaction\"><code>&#x3C;webview>.stopFindInPage(action)</code></a></h3>\n<ul>\n<li><code>action</code> String - Specifies the action to take place when ending\n<a href=\"#webviewfindinpagetext-options\"><code>&#x3C;webview>.findInPage</code></a> request.<ul>\n<li><code>clearSelection</code> - Clear the selection.</li>\n<li><code>keepSelection</code> - Translate the selection into a normal selection.</li>\n<li><code>activateSelection</code> - Focus and click the selection node.</li>\n</ul></li>\n</ul>\n<p>Stops any <code>findInPage</code> request for the <code>webview</code> with the provided <code>action</code>.</p>\n<h3 id=\"webviewprintoptions\"><a href=\"#webviewprintoptions\"><code>&#x3C;webview>.print([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>silent</code> Boolean (optional) - Don't ask user for print settings. Default is <code>false</code>.</li>\n<li><code>printBackground</code> Boolean (optional) - Prints the background color and image of\nthe web page. Default is <code>false</code>.</li>\n<li><code>deviceName</code> String (optional) - Set the printer device name to use. Must be the system-defined name and not the 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.</li>\n<li><code>color</code> Boolean (optional) - Set whether the printed web page will be in color or grayscale. Default is <code>true</code>.</li>\n<li><code>margins</code> Object (optional)<ul>\n<li><code>marginType</code> String (optional) - Can be <code>default</code>, <code>none</code>, <code>printableArea</code>, or <code>custom</code>. If <code>custom</code> is chosen, you will also need to specify <code>top</code>, <code>bottom</code>, <code>left</code>, and <code>right</code>.</li>\n<li><code>top</code> Number (optional) - The top margin of the printed web page, in pixels.</li>\n<li><code>bottom</code> Number (optional) - The bottom margin of the printed web page, in pixels.</li>\n<li><code>left</code> Number (optional) - The left margin of the printed web page, in pixels.</li>\n<li><code>right</code> Number (optional) - The right margin of the printed web page, in pixels.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - Whether the web page should be printed in landscape mode. Default is <code>false</code>.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page.</li>\n<li><code>pagesPerSheet</code> Number (optional) - The number of pages to print per page sheet.</li>\n<li><code>collate</code> Boolean (optional) - Whether the web page should be collated.</li>\n<li><code>copies</code> Number (optional) - The number of copies of the web page to print.</li>\n<li><code>pageRanges</code> Object<a href=\"/docs/api/optional\"></a> - The page range to print.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>duplexMode</code> String (optional) - Set the duplex mode of the printed web page. Can be <code>simplex</code>, <code>shortEdge</code>, or <code>longEdge</code>.</li>\n<li><code>dpi</code> Record&#x3C;string, number> (optional)<ul>\n<li><code>horizontal</code> Number (optional) - The horizontal dpi.</li>\n<li><code>vertical</code> Number (optional) - The vertical dpi.</li>\n</ul></li>\n<li><code>header</code> String (optional) - String to be printed as page header.</li>\n<li><code>footer</code> String (optional) - String to be printed as page footer.</li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the printed document. Can be <code>A3</code>,\n<code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code></p>\n<p>Prints <code>webview</code>'s web page. Same as <code>webContents.print([options])</code>.</p>\n<h3 id=\"webviewprinttopdfoptions\"><a href=\"#webviewprinttopdfoptions\"><code>&#x3C;webview>.printToPDF(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>headerFooter</code> Record&#x3C;string, string> (optional) - the header and footer for the PDF.<ul>\n<li><code>title</code> String - The title for the PDF header.</li>\n<li><code>url</code> String - the url for the PDF footer.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - <code>true</code> for landscape, <code>false</code> for portrait.</li>\n<li><code>marginsType</code> Integer (optional) - Specifies the type of margins to use. Uses 0 for\ndefault margin, 1 for no margin, and 2 for minimum margin.\nand <code>width</code> in microns.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page. Can range from 0 to 100.</li>\n<li><code>pageRanges</code> Record&#x3C;string, number> (optional) - The page range to print. On macOS, only the first range is honored.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the generated PDF. Can be <code>A3</code>,\n<code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code></li>\n<li><code>printBackground</code> Boolean (optional) - Whether to print CSS backgrounds.</li>\n<li><code>printSelectionOnly</code> Boolean (optional) - Whether to print selection only.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Uint8Array></code> - Resolves with the generated PDF data.</p>\n<p>Prints <code>webview</code>'s web page as PDF, Same as <code>webContents.printToPDF(options)</code>.</p>\n<h3 id=\"webviewcapturepagerect\"><a href=\"#webviewcapturepagerect\"><code>&#x3C;webview>.capturePage([rect])</code></a></h3>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (optional) - The area of the page to be captured.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - Resolves with a <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Captures a snapshot of the page within <code>rect</code>. Omitting <code>rect</code> will capture the whole visible page.</p>\n<h3 id=\"webviewsendchannel-args\"><a href=\"#webviewsendchannel-args\"><code>&#x3C;webview>.send(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code></p>\n<p>Send an asynchronous message to renderer process via <code>channel</code>, you can also\nsend arbitrary arguments. The renderer process can handle the message by\nlistening to the <code>channel</code> event with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>See <a href=\"/docs/api/web-contents#contentssendchannel-args\">webContents.send</a> for\nexamples.</p>\n<h3 id=\"webviewsendtoframeframeid-channel-args\"><a href=\"#webviewsendtoframeframeid-channel-args\"><code>&#x3C;webview>.sendToFrame(frameId, channel, ...args)</code></a></h3>\n<ul>\n<li><code>frameId</code> [number, number] - <code>[processId, frameId]</code></li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code></p>\n<p>Send an asynchronous message to renderer process via <code>channel</code>, you can also\nsend arbitrary arguments. The renderer process can handle the message by\nlistening to the <code>channel</code> event with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>See <a href=\"/docs/api/web-contents#contentssendtoframeframeid-channel-args\">webContents.sendToFrame</a> for\nexamples.</p>\n<h3 id=\"webviewsendinputeventevent\"><a href=\"#webviewsendinputeventevent\"><code>&#x3C;webview>.sendInputEvent(event)</code></a></h3>\n<ul>\n<li><code>event</code>  <a href=\"/docs/api/structures/mouse-input-event\">MouseInputEvent</a> | <a href=\"/docs/api/structures/mouse-wheel-input-event\">MouseWheelInputEvent</a> | <a href=\"/docs/api/structures/keyboard-input-event\">KeyboardInputEvent</a></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code></p>\n<p>Sends an input <code>event</code> to the page.</p>\n<p>See <a href=\"/docs/api/web-contents#contentssendinputeventinputevent\">webContents.sendInputEvent</a>\nfor detailed description of <code>event</code> object.</p>\n<h3 id=\"webviewsetzoomfactorfactor\"><a href=\"#webviewsetzoomfactorfactor\"><code>&#x3C;webview>.setZoomFactor(factor)</code></a></h3>\n<ul>\n<li><code>factor</code> Number - Zoom factor.</li>\n</ul>\n<p>Changes the zoom factor to the specified factor. Zoom factor is\nzoom percent divided by 100, so 300% = 3.0.</p>\n<h3 id=\"webviewsetzoomlevellevel\"><a href=\"#webviewsetzoomlevellevel\"><code>&#x3C;webview>.setZoomLevel(level)</code></a></h3>\n<ul>\n<li><code>level</code> Number - Zoom level.</li>\n</ul>\n<p>Changes the zoom level to the specified level. The original size is 0 and each\nincrement above or below represents zooming 20% larger or smaller to default\nlimits of 300% and 50% of original size, respectively. The formula for this is\n<code>scale := 1.2 ^ level</code>.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the\nzoom level for a specific domain propagates across all instances of windows with\nthe same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h3 id=\"webviewgetzoomfactor\"><a href=\"#webviewgetzoomfactor\"><code>&#x3C;webview>.getZoomFactor()</code></a></h3>\n<p>Returns <code>Number</code> - the current zoom factor.</p>\n<h3 id=\"webviewgetzoomlevel\"><a href=\"#webviewgetzoomlevel\"><code>&#x3C;webview>.getZoomLevel()</code></a></h3>\n<p>Returns <code>Number</code> - the current zoom level.</p>\n<h3 id=\"webviewsetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#webviewsetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>&#x3C;webview>.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h3>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code></p>\n<p>Sets the maximum and minimum pinch-to-zoom level.</p>\n<h3 id=\"webviewshowdefinitionforselection-macos\"><a href=\"#webviewshowdefinitionforselection-macos\"><code>&#x3C;webview>.showDefinitionForSelection()</code> <em>macOS</em></a></h3>\n<p>Shows pop-up dictionary that searches the selected word on the page.</p>\n<h3 id=\"webviewgetwebcontentsid\"><a href=\"#webviewgetwebcontentsid\"><code>&#x3C;webview>.getWebContentsId()</code></a></h3>\n<p>Returns <code>Number</code> - The WebContents ID of this <code>webview</code>.</p>\n<h2 id=\"dom-events\"><a href=\"#dom-events\">DOM Events</a></h2>\n<p>The following DOM events are available to the <code>webview</code> tag:</p>\n<h3 id=\"event-load-commit\"><a href=\"#event-load-commit\">Event: 'load-commit'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Fired when a load has committed. This includes navigation within the current\ndocument as well as subframe document-level loads, but does not include\nasynchronous resource loads.</p>\n<h3 id=\"event-did-finish-load\"><a href=\"#event-did-finish-load\">Event: 'did-finish-load'</a></h3>\n<p>Fired when the navigation is done, i.e. the spinner of the tab will stop\nspinning, and the <code>onload</code> event is dispatched.</p>\n<h3 id=\"event-did-fail-load\"><a href=\"#event-did-fail-load\">Event: 'did-fail-load'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>This event is like <code>did-finish-load</code>, but fired when the load failed or was\ncancelled, e.g. <code>window.stop()</code> is invoked.</p>\n<h3 id=\"event-did-frame-finish-load\"><a href=\"#event-did-frame-finish-load\">Event: 'did-frame-finish-load'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Fired when a frame has done navigation.</p>\n<h3 id=\"event-did-start-loading\"><a href=\"#event-did-start-loading\">Event: 'did-start-loading'</a></h3>\n<p>Corresponds to the points in time when the spinner of the tab starts spinning.</p>\n<h3 id=\"event-did-stop-loading\"><a href=\"#event-did-stop-loading\">Event: 'did-stop-loading'</a></h3>\n<p>Corresponds to the points in time when the spinner of the tab stops spinning.</p>\n<h3 id=\"event-did-attach\"><a href=\"#event-did-attach\">Event: 'did-attach'</a></h3>\n<p>Fired when attached to the embedder web contents.</p>\n<h3 id=\"event-dom-ready\"><a href=\"#event-dom-ready\">Event: 'dom-ready'</a></h3>\n<p>Fired when document in the given frame is loaded.</p>\n<h3 id=\"event-page-title-updated\"><a href=\"#event-page-title-updated\">Event: 'page-title-updated'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>Fired when page title is set during navigation. <code>explicitSet</code> is false when\ntitle is synthesized from file url.</p>\n<h3 id=\"event-page-favicon-updated\"><a href=\"#event-page-favicon-updated\">Event: 'page-favicon-updated'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>favicons</code> String[] - Array of URLs.</li>\n</ul>\n<p>Fired when page receives favicon urls.</p>\n<h3 id=\"event-enter-html-full-screen\"><a href=\"#event-enter-html-full-screen\">Event: 'enter-html-full-screen'</a></h3>\n<p>Fired when page enters fullscreen triggered by HTML API.</p>\n<h3 id=\"event-leave-html-full-screen\"><a href=\"#event-leave-html-full-screen\">Event: 'leave-html-full-screen'</a></h3>\n<p>Fired when page leaves fullscreen triggered by HTML API.</p>\n<h3 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>level</code> Integer - The log level, from 0 to 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>message</code> String - The actual console message</li>\n<li><code>line</code> Integer - The line number of the source that triggered this console message</li>\n<li><code>sourceId</code> String</li>\n</ul>\n<p>Fired when the guest window logs a console message.</p>\n<p>The following example code forwards all log messages to the embedder's console\nwithout regard for log level or other properties.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'console-message'</span>, (e) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Guest page logged a message:'</span>, e.message)\n})\n</code></pre>\n<h3 id=\"event-found-in-page\"><a href=\"#event-found-in-page\">Event: 'found-in-page'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>result</code> Object<ul>\n<li><code>requestId</code> Integer</li>\n<li><code>activeMatchOrdinal</code> Integer - Position of the active match.</li>\n<li><code>matches</code> Integer - Number of Matches.</li>\n<li><code>selectionArea</code> Rectangle - Coordinates of first match region.</li>\n<li><code>finalUpdate</code> Boolean</li>\n</ul></li>\n</ul>\n<p>Fired when a result is available for\n<a href=\"#webviewfindinpagetext-options\"><code>webview.findInPage</code></a> request.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'found-in-page'</span>, (e) => {\n  webview.stopFindInPage(<span class=\"hljs-string\">'keepSelection'</span>)\n})\n\n<span class=\"hljs-keyword\">const</span> requestId = webview.findInPage(<span class=\"hljs-string\">'test'</span>)\n<span class=\"hljs-built_in\">console</span>.log(requestId)\n</code></pre>\n<h3 id=\"event-new-window\"><a href=\"#event-new-window\">Event: 'new-window'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>,\n<code>new-window</code>, <code>save-to-disk</code> and <code>other</code>.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - The options which should be used for creating the new\n<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</li>\n</ul>\n<p>Fired when the guest page attempts to open a new browser window.</p>\n<p>The following example code opens the new url in system's default browser.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\n\nwebview.addEventListener(<span class=\"hljs-string\">'new-window'</span>, <span class=\"hljs-keyword\">async</span> (e) => {\n  <span class=\"hljs-keyword\">const</span> protocol = (<span class=\"hljs-keyword\">new</span> URL(e.url)).protocol\n  <span class=\"hljs-keyword\">if</span> (protocol === <span class=\"hljs-string\">'http:'</span> || protocol === <span class=\"hljs-string\">'https:'</span>) {\n    <span class=\"hljs-keyword\">await</span> shell.openExternal(e.url)\n  }\n})\n</code></pre>\n<h3 id=\"event-will-navigate\"><a href=\"#event-will-navigate\">Event: 'will-navigate'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when a user or the page wants to start navigation. It can happen when\nthe <code>window.location</code> object is changed or a user clicks a link in the page.</p>\n<p>This event will not emit when the navigation is started programmatically with\nAPIs like <code>&#x3C;webview>.loadURL</code> and <code>&#x3C;webview>.back</code>.</p>\n<p>It is also not emitted during in-page navigation, such as clicking anchor links\nor updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for\nthis purpose.</p>\n<p>Calling <code>event.preventDefault()</code> does <strong>NOT</strong> have any effect.</p>\n<h3 id=\"event-did-start-navigation\"><a href=\"#event-did-start-navigation\">Event: 'did-start-navigation'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame (including main) starts navigating. <code>isInPlace</code> will be\n<code>true</code> for in-page navigations.</p>\n<h3 id=\"event-did-redirect-navigation\"><a href=\"#event-did-redirect-navigation\">Event: 'did-redirect-navigation'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted after a server side redirect occurs during navigation. For example a 302\nredirect.</p>\n<h3 id=\"event-did-navigate\"><a href=\"#event-did-navigate\">Event: 'did-navigate'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when a navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links\nor updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for\nthis purpose.</p>\n<h3 id=\"event-did-frame-navigate\"><a href=\"#event-did-frame-navigate\">Event: 'did-frame-navigate'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - empty for non HTTP navigations,</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links\nor updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for\nthis purpose.</p>\n<h3 id=\"event-did-navigate-in-page\"><a href=\"#event-did-navigate-in-page\">Event: 'did-navigate-in-page'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when an in-page navigation happened.</p>\n<p>When in-page navigation happens, the page URL changes but does not cause\nnavigation outside of the page. Examples of this occurring are when anchor links\nare clicked or when the DOM <code>hashchange</code> event is triggered.</p>\n<h3 id=\"event-close\"><a href=\"#event-close\">Event: 'close'</a></h3>\n<p>Fired when the guest page attempts to close itself.</p>\n<p>The following example code navigates the <code>webview</code> to <code>about:blank</code> when the\nguest attempts to close itself.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'close'</span>, () => {\n  webview.src = <span class=\"hljs-string\">'about:blank'</span>\n})\n</code></pre>\n<h3 id=\"event-ipc-message\"><a href=\"#event-ipc-message\">Event: 'ipc-message'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>frameId</code> [number, number] - pair of <code>[processId, frameId]</code>.</li>\n<li><code>channel</code> String</li>\n<li><code>args</code> any[]</li>\n</ul>\n<p>Fired when the guest page has sent an asynchronous message to embedder page.</p>\n<p>With <code>sendToHost</code> method and <code>ipc-message</code> event you can communicate\nbetween guest page and embedder page:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In embedder page.</span>\n<span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'ipc-message'</span>, (event) => {\n  <span class=\"hljs-built_in\">console</span>.log(event.channel)\n  <span class=\"hljs-comment\">// Prints \"pong\"</span>\n})\nwebview.send(<span class=\"hljs-string\">'ping'</span>)\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In guest page.</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcRenderer.on(<span class=\"hljs-string\">'ping'</span>, () => {\n  ipcRenderer.sendToHost(<span class=\"hljs-string\">'pong'</span>)\n})\n</code></pre>\n<h3 id=\"event-crashed\"><a href=\"#event-crashed\">Event: 'crashed'</a></h3>\n<p>Fired when the renderer process is crashed.</p>\n<h3 id=\"event-plugin-crashed\"><a href=\"#event-plugin-crashed\">Event: 'plugin-crashed'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>\n<p>Fired when a plugin process is crashed.</p>\n<h3 id=\"event-destroyed\"><a href=\"#event-destroyed\">Event: 'destroyed'</a></h3>\n<p>Fired when the WebContents is destroyed.</p>\n<h3 id=\"event-media-started-playing\"><a href=\"#event-media-started-playing\">Event: 'media-started-playing'</a></h3>\n<p>Emitted when media starts playing.</p>\n<h3 id=\"event-media-paused\"><a href=\"#event-media-paused\">Event: 'media-paused'</a></h3>\n<p>Emitted when media is paused or done playing.</p>\n<h3 id=\"event-did-change-theme-color\"><a href=\"#event-did-change-theme-color\">Event: 'did-change-theme-color'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>themeColor</code> String</li>\n</ul>\n<p>Emitted when a page's theme color changes. This is usually due to encountering a meta tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">'theme-color'</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">'#ff0000'</span>></span>\n</code></pre>\n<h3 id=\"event-update-target-url\"><a href=\"#event-update-target-url\">Event: 'update-target-url'</a></h3>\n<p>Returns:</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when mouse moves over a link or the keyboard moves the focus to a link.</p>\n<h3 id=\"event-devtools-opened\"><a href=\"#event-devtools-opened\">Event: 'devtools-opened'</a></h3>\n<p>Emitted when DevTools is opened.</p>\n<h3 id=\"event-devtools-closed\"><a href=\"#event-devtools-closed\">Event: 'devtools-closed'</a></h3>\n<p>Emitted when DevTools is closed.</p>\n<h3 id=\"event-devtools-focused\"><a href=\"#event-devtools-focused\">Event: 'devtools-focused'</a></h3>\n<p>Emitted when DevTools is focused / opened.</p>",
      "title": "<webview> Tag",
      "description": "Display external web content in an isolated frame and process."
    },
    "/docs/api/window-open": {
      "locale": "en-US",
      "slug": "window-open",
      "href": "/docs/api/window-open",
      "crowdinFileId": "256409",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/window-open.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"opening-windows-from-the-renderer\"><a href=\"#opening-windows-from-the-renderer\">Opening windows from the renderer</a></h1>\n<p>There are several ways to control how windows are created from trusted or\nuntrusted content within a renderer. Windows can be created from the renderer in two ways:</p>\n<ul>\n<li>clicking on links or submitting forms adorned with <code>target=_blank</code></li>\n<li>JavaScript calling <code>window.open()</code></li>\n</ul>\n<p>For same-origin content, the new window is created within the same process,\nenabling the parent to access the child window directly. This can be very\nuseful for app sub-windows that act as preference panels, or similar, as the\nparent can render to the sub-window directly, as if it were a <code>div</code> in the\nparent. This is the same behavior as in the browser.</p>\n<p>When <code>nativeWindowOpen</code> is set to false, <code>window.open</code> instead results in the\ncreation of a <a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code></a>, a light wrapper\naround <code>BrowserWindow</code>.</p>\n<p>Electron pairs this native Chrome <code>Window</code> with a BrowserWindow under the hood.\nYou can take advantage of all the customization available when creating a\nBrowserWindow in the main process by using <code>webContents.setWindowOpenHandler()</code>\nfor renderer-created windows.</p>\n<p>BrowserWindow constructor options are set by, in increasing precedence\norder: parsed options from the <code>features</code> string from <code>window.open()</code>,\nsecurity-related webPreferences inherited from the parent, and options given by\n<a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>.\nNote that <code>webContents.setWindowOpenHandler</code> has final say and full privilege\nbecause it is invoked in the main process.</p>\n<h3 id=\"windowopenurl-framename-features\"><a href=\"#windowopenurl-framename-features\"><code>window.open(url[, frameName][, features])</code></a></h3>\n<ul>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String (optional)</li>\n<li><code>features</code> String (optional)</li>\n</ul>\n<p>Returns <a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code></a> | <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window\"><code>Window</code></a></p>\n<p><code>features</code> is a comma-separated key-value list, following the standard format of\nthe browser. Electron will parse <code>BrowserWindowConstructorOptions</code> out of this\nlist where possible, for convenience. For full control and better ergonomics,\nconsider using <code>webContents.setWindowOpenHandler</code> to customize the\nBrowserWindow creation.</p>\n<p>A subset of <code>WebPreferences</code> can be set directly,\nunnested, from the features string: <code>zoomFactor</code>, <code>nodeIntegration</code>, <code>preload</code>,\n<code>javascript</code>, <code>contextIsolation</code>, and <code>webviewTag</code>.</p>\n<p>For example:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">'https://github.com'</span>, <span class=\"hljs-string\">'_blank'</span>, <span class=\"hljs-string\">'top=500,left=200,frame=false,nodeIntegration=no'</span>)\n</code></pre>\n<p><strong>Notes:</strong></p>\n<ul>\n<li>Node integration will always be disabled in the opened <code>window</code> if it is\ndisabled on the parent window.</li>\n<li>Context isolation will always be enabled in the opened <code>window</code> if it is\nenabled on the parent window.</li>\n<li>JavaScript will always be disabled in the opened <code>window</code> if it is disabled on\nthe parent window.</li>\n<li>Non-standard features (that are not handled by Chromium or Electron) given in\n<code>features</code> will be passed to any registered <code>webContents</code>'s\n<code>did-create-window</code> event handler in the <code>options</code> argument.</li>\n<li><code>frameName</code> follows the specification of <code>windowName</code> located in the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters\">native documentation</a>.</li>\n</ul>\n<p>To customize or cancel the creation of the window, you can optionally set an\noverride handler with <code>webContents.setWindowOpenHandler()</code> from the main\nprocess. Returning <code>{ action: 'deny' }</code> cancels the window. Returning <code>{ action: 'allow', overrideBrowserWindowOptions: { ... } }</code> will allow opening\nthe window and setting the <code>BrowserWindowConstructorOptions</code> to be used when\ncreating the window. Note that this is more powerful than passing options\nthrough the feature string, as the renderer has more limited privileges in\ndeciding security preferences than the main process.</p>\n<h3 id=\"native-window-example\"><a href=\"#native-window-example\">Native <code>Window</code> example</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// main.js</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-comment\">// In this example, only windows with the `about:blank` url will be created.</span>\n<span class=\"hljs-comment\">// All other urls will be blocked.</span>\nmainWindow.webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (url === <span class=\"hljs-string\">'about:blank'</span>) {\n    <span class=\"hljs-keyword\">return</span> {\n      <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span>,\n      <span class=\"hljs-attr\">overrideBrowserWindowOptions</span>: {\n        <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span>,\n        <span class=\"hljs-attr\">fullscreenable</span>: <span class=\"hljs-literal\">false</span>,\n        <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'black'</span>,\n        <span class=\"hljs-attr\">webPreferences</span>: {\n          <span class=\"hljs-attr\">preload</span>: <span class=\"hljs-string\">'my-child-window-preload-script.js'</span>\n        }\n      }\n    }\n  }\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// renderer process (mainWindow)</span>\n<span class=\"hljs-keyword\">const</span> childWindow = <span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">''</span>, <span class=\"hljs-string\">'modal'</span>)\nchildWindow.document.write(<span class=\"hljs-string\">'&#x3C;h1>Hello&#x3C;/h1>'</span>)\n</code></pre>\n<h3 id=\"browserwindowproxy-example\"><a href=\"#browserwindowproxy-example\"><code>BrowserWindowProxy</code> example</a></h3>\n<pre><code class=\"hljs language-javascript\">\n<span class=\"hljs-comment\">// main.js</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nativeWindowOpen</span>: <span class=\"hljs-literal\">false</span> }\n})\n\nmainWindow.webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (url.startsWith(<span class=\"hljs-string\">'https://github.com/'</span>)) {\n    <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span> }\n  }\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n\nmainWindow.webContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (childWindow) => {\n  <span class=\"hljs-comment\">// For example...</span>\n  childWindow.webContents.on(<span class=\"hljs-string\">'will-navigate'</span>, (e) => {\n    e.preventDefault()\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// renderer.js</span>\n<span class=\"hljs-keyword\">const</span> windowProxy = <span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">'https://github.com/'</span>, <span class=\"hljs-literal\">null</span>, <span class=\"hljs-string\">'minimizable=false'</span>)\nwindowProxy.postMessage(<span class=\"hljs-string\">'hi'</span>, <span class=\"hljs-string\">'*'</span>)\n</code></pre>",
      "title": "Opening windows from the renderer",
      "description": ""
    },
    "/docs/tutorial/windows-arm": {
      "locale": "en-US",
      "slug": "windows-arm",
      "href": "/docs/tutorial/windows-arm",
      "crowdinFileId": "256271",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-arm.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"windows-on-arm\"><a href=\"#windows-on-arm\">Windows on ARM</a></h1>\n<p>If your app runs with Electron 6.0.8 or later, you can now build it for Windows 10 on Arm. This considerably improves performance, but requires recompilation of any native modules used in your app. It may also require small fixups to your build and packaging scripts.</p>\n<h2 id=\"running-a-basic-app\"><a href=\"#running-a-basic-app\">Running a basic app</a></h2>\n<p>If your app doesn't use any native modules, then it's really easy to create an Arm version of your app.</p>\n<ol>\n<li>Make sure that your app's <code>node_modules</code> directory is empty.</li>\n<li>Using a <em>Command Prompt</em>, run <code>set npm_config_arch=arm64</code> before running <code>npm install</code>/<code>yarn install</code> as usual.</li>\n<li><a href=\"/docs/tutorial/quick-start#prerequisites\">If you have Electron installed as a development dependency</a>, npm will download and unpack the arm64 version. You can then package and distribute your app as normal.</li>\n</ol>\n<h2 id=\"general-considerations\"><a href=\"#general-considerations\">General considerations</a></h2>\n<h3 id=\"architecture-specific-code\"><a href=\"#architecture-specific-code\">Architecture-specific code</a></h3>\n<p>Lots of Windows-specific code contains if... else logic that selects between either the x64 or x86 architectures.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">if</span> (process.arch === <span class=\"hljs-string\">'x64'</span>) {\n  <span class=\"hljs-comment\">// Do 64-bit thing...</span>\n} <span class=\"hljs-keyword\">else</span> {\n  <span class=\"hljs-comment\">// Do 32-bit thing...</span>\n}\n</code></pre>\n<p>If you want to target arm64, logic like this will typically select the wrong architecture, so carefully check your application and build scripts for conditions like this. In custom build and packaging scripts, you should always check the value of <code>npm_config_arch</code> in the environment, rather than relying on the current process arch.</p>\n<h3 id=\"native-modules\"><a href=\"#native-modules\">Native modules</a></h3>\n<p>If you use native modules, you must make sure that they compile against v142 of the MSVC compiler (provided in Visual Studio 2017). You must also check that any pre-built <code>.dll</code> or <code>.lib</code> files provided or referenced by the native module are available for Windows on Arm.</p>\n<h3 id=\"testing-your-app\"><a href=\"#testing-your-app\">Testing your app</a></h3>\n<p>To test your app, use a Windows on Arm device running Windows 10 (version 1903 or later). Make sure that you copy your application over to the target device - Chromium's sandbox will not work correctly when loading your application assets from a network location.</p>\n<h2 id=\"development-prerequisites\"><a href=\"#development-prerequisites\">Development prerequisites</a></h2>\n<h3 id=\"nodejsnode-gyp\"><a href=\"#nodejsnode-gyp\">Node.js/node-gyp</a></h3>\n<p><a href=\"https://nodejs.org/en/\">Node.js v12.9.0 or later is recommended.</a> If updating to a new version of Node is  undesirable, you can instead <a href=\"https://github.com/nodejs/node-gyp/wiki/Updating-npm&#x27;s-bundled-node-gyp\">update npm's copy of node-gyp manually</a> to version 5.0.2 or later, which contains the required changes to compile native modules for Arm.</p>\n<h3 id=\"visual-studio-2017\"><a href=\"#visual-studio-2017\">Visual Studio 2017</a></h3>\n<p>Visual Studio 2017 (any edition) is required for cross-compiling native modules. You can download Visual Studio Community 2017 via Microsoft's <a href=\"https://visualstudio.microsoft.com/dev-essentials/\">Visual Studio Dev Essentials program</a>. After installation, you can add the Arm-specific components by running the following from a <em>Command Prompt</em>:</p>\n<pre><code class=\"hljs language-powershell\">vs_installer.exe ^\n--add Microsoft.VisualStudio.Workload.NativeDesktop ^\n--add Microsoft.VisualStudio.Component.VC.ATLMFC ^\n--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ^\n--add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ^\n--includeRecommended\n</code></pre>\n<h4 id=\"creating-a-cross-compilation-command-prompt\"><a href=\"#creating-a-cross-compilation-command-prompt\">Creating a cross-compilation command prompt</a></h4>\n<p>Setting <code>npm_config_arch=arm64</code> in the environment creates the correct arm64 <code>.obj</code> files, but the standard <em>Developer Command Prompt for VS 2017</em> will use the x64 linker. To fix this:</p>\n<ol>\n<li>Duplicate the <em>x64_x86 Cross Tools Command Prompt for VS 2017</em> shortcut (e.g. by locating it in the start menu, right clicking, selecting <em>Open File Location</em>, copying and pasting) to somewhere convenient.</li>\n<li>Right click the new shortcut and choose <em>Properties</em>.</li>\n<li>Change the <em>Target</em> field to read <code>vcvarsamd64_arm64.bat</code> at the end instead of <code>vcvarsamd64_x86.bat</code>.</li>\n</ol>\n<p>If done successfully, the command prompt should print something similar to this on startup:</p>\n<pre><code class=\"hljs language-bat\">**********************************************************************\n** Visual Studio <span class=\"hljs-number\">2017</span> Developer Command Prompt v15.<span class=\"hljs-number\">9</span>.<span class=\"hljs-number\">15</span>\n** Copyright (c) <span class=\"hljs-number\">2017</span> Microsoft Corporation\n**********************************************************************\n[vcvarsall.bat] Environment initialized <span class=\"hljs-keyword\">for</span>: 'x64_arm64'\n</code></pre>\n<p>If you want to develop your application directly on a Windows on Arm device, substitute <code>vcvarsx86_arm64.bat</code> in <em>Target</em> so that cross-compilation can happen with the device's x86 emulation.</p>\n<h3 id=\"linking-against-the-correct-nodelib\"><a href=\"#linking-against-the-correct-nodelib\">Linking against the correct <code>node.lib</code></a></h3>\n<p>By default, <code>node-gyp</code> unpacks Electron's node headers and downloads the x86 and x64 versions of <code>node.lib</code> into <code>%APPDATA%\\..\\Local\\node-gyp\\Cache</code>, but it does not download the arm64 version (<a href=\"https://github.com/nodejs/node-gyp/pull/1875\">a fix for this is in development</a>.) To fix this:</p>\n<ol>\n<li>Download the arm64 <code>node.lib</code> from <a href=\"https://electronjs.org/headers/v6.0.9/win-arm64/node.lib\">https://electronjs.org/headers/v6.0.9/win-arm64/node.lib</a></li>\n<li>Move it to <code>%APPDATA%\\..\\Local\\node-gyp\\Cache\\6.0.9\\arm64\\node.lib</code></li>\n</ol>\n<p>Substitute <code>6.0.9</code> for the version you're using.</p>\n<h2 id=\"cross-compiling-native-modules\"><a href=\"#cross-compiling-native-modules\">Cross-compiling native modules</a></h2>\n<p>After completing all of the above, open your cross-compilation command prompt and run <code>set npm_config_arch=arm64</code>. Then use <code>npm install</code> to build your project as normal. As with cross-compiling x86 modules, you may need to remove <code>node_modules</code> to force recompilation of native modules if they were previously compiled for another architecture.</p>\n<h2 id=\"debugging-native-modules\"><a href=\"#debugging-native-modules\">Debugging native modules</a></h2>\n<p>Debugging native modules can be done with Visual Studio 2017 (running on your development machine) and corresponding <a href=\"https://docs.microsoft.com/en-us/visualstudio/debugger/remote-debugging-cpp?view=vs-2019\">Visual Studio Remote Debugger</a> running on the target device. To debug:</p>\n<ol>\n<li>Launch your app <code>.exe</code> on the target device via the <em>Command Prompt</em> (passing <code>--inspect-brk</code> to pause it before any native modules are loaded).</li>\n<li>Launch Visual Studio 2017 on your development machine.</li>\n<li>Connect to the target device by selecting <em>Debug > Attach to Process...</em> and enter the device's IP address and the port number displayed by the Visual Studio Remote Debugger tool.</li>\n<li>Click <em>Refresh</em> and select the <a href=\"/docs/development/debug-instructions-windows\">appropriate Electron process to attach</a>.</li>\n<li>You may need to make sure that any symbols for native modules in your app are loaded correctly. To configure this, head to <em>Debug > Options...</em> in Visual Studio 2017, and add the folders containing your <code>.pdb</code> symbols under <em>Debugging > Symbols</em>.</li>\n<li>Once attached, set any appropriate breakpoints and resume JavaScript execution using Chrome's <a href=\"/docs/tutorial/debugging-main-process\">remote tools for Node</a>.</li>\n</ol>\n<h2 id=\"getting-additional-help\"><a href=\"#getting-additional-help\">Getting additional help</a></h2>\n<p>If you encounter a problem with this documentation, or if your app works when compiled for x86 but not for arm64, please <a href=\"/docs/development/issues\">file an issue</a> with \"Windows on Arm\" in the title.</p>",
      "title": "Windows on ARM",
      "description": ""
    },
    "/docs/tutorial/windows-store-guide": {
      "locale": "en-US",
      "slug": "windows-store-guide",
      "href": "/docs/tutorial/windows-store-guide",
      "crowdinFileId": "256273",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-store-guide.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"windows-store-guide\"><a href=\"#windows-store-guide\">Windows Store Guide</a></h1>\n<p>With Windows 10, the good old win32 executable got a new sibling: The Universal\nWindows Platform. The new <code>.appx</code> format does not only enable a number of new\npowerful APIs like Cortana or Push Notifications, but through the Windows Store,\nalso simplifies installation and updating.</p>\n<p>Microsoft <a href=\"https://github.com/catalystcode/electron-windows-store\">developed a tool that compiles Electron apps as <code>.appx</code> packages</a>,\nenabling developers to use some of the goodies found in the new application\nmodel. This guide explains how to use it - and what the capabilities and\nlimitations of an Electron AppX package are.</p>\n<h2 id=\"background-and-requirements\"><a href=\"#background-and-requirements\">Background and Requirements</a></h2>\n<p>Windows 10 \"Anniversary Update\" is able to run win32 <code>.exe</code> binaries by\nlaunching them together with a virtualized filesystem and registry. Both are\ncreated during compilation by running app and installer inside a Windows\nContainer, allowing Windows to identify exactly which modifications to the\noperating system are done during installation. Pairing the executable with a\nvirtual filesystem and a virtual registry allows Windows to enable one-click\ninstallation and uninstallation.</p>\n<p>In addition, the exe is launched inside the appx model - meaning that it can use\nmany of the APIs available to the Universal Windows Platform. To gain even more\ncapabilities, an Electron app can pair up with an invisible UWP background task\nlaunched together with the <code>exe</code> - sort of launched as a sidekick to run tasks\nin the background, receive push notifications, or to communicate with other UWP\napplications.</p>\n<p>To compile any existing Electron app, ensure that you have the following\nrequirements:</p>\n<ul>\n<li>Windows 10 with Anniversary Update (released August 2nd, 2016)</li>\n<li>The Windows 10 SDK, <a href=\"https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk\">downloadable here</a></li>\n<li>At least Node 4 (to check, run <code>node -v</code>)</li>\n</ul>\n<p>Then, go and install the <code>electron-windows-store</code> CLI:</p>\n<pre><code class=\"hljs language-sh\">npm install -g electron-windows-store\n</code></pre>\n<h2 id=\"step-1-package-your-electron-application\"><a href=\"#step-1-package-your-electron-application\">Step 1: Package Your Electron Application</a></h2>\n<p>Package the application using <a href=\"https://github.com/electron/electron-packager\">electron-packager</a> (or a similar tool).\nMake sure to remove <code>node_modules</code> that you don't need in your final application, since\nany module you don't actually need will increase your application's size.</p>\n<p>The output should look roughly like this:</p>\n<pre><code class=\"hljs language-plaintext\">├── Ghost.exe\n├── LICENSE\n├── content_resources_200_percent.pak\n├── content_shell.pak\n├── d3dcompiler_47.dll\n├── ffmpeg.dll\n├── icudtl.dat\n├── libEGL.dll\n├── libGLESv2.dll\n├── locales\n│   ├── am.pak\n│   ├── ar.pak\n│   ├── [...]\n├── node.dll\n├── resources\n│   └── app.asar\n├── v8_context_snapshot.bin\n├── squirrel.exe\n└── ui_resources_200_percent.pak\n</code></pre>\n<h2 id=\"step-2-running-electron-windows-store\"><a href=\"#step-2-running-electron-windows-store\">Step 2: Running electron-windows-store</a></h2>\n<p>From an elevated PowerShell (run it \"as Administrator\"), run\n<code>electron-windows-store</code> with the required parameters, passing both the input\nand output directories, the app's name and version, and confirmation that\n<code>node_modules</code> should be flattened.</p>\n<pre><code class=\"hljs language-powershell\">electron-windows-store `\n    --input-directory C:\\myelectronapp `\n    --output-directory C:\\output\\myelectronapp `\n    --package-version <span class=\"hljs-number\">1.0</span>.<span class=\"hljs-number\">0.0</span> `\n    --package-name myelectronapp\n</code></pre>\n<p>Once executed, the tool goes to work: It accepts your Electron app as an input,\nflattening the <code>node_modules</code>. Then, it archives your application as <code>app.zip</code>.\nUsing an installer and a Windows Container, the tool creates an \"expanded\" AppX\npackage - including the Windows Application Manifest (<code>AppXManifest.xml</code>) as\nwell as the virtual file system and the virtual registry inside your output\nfolder.</p>\n<p>Once the expanded AppX files are created, the tool uses the Windows App Packager\n(<code>MakeAppx.exe</code>) to create a single-file AppX package from those files on disk.\nFinally, the tool can be used to create a trusted certificate on your computer\nto sign the new AppX package. With the signed AppX package, the CLI can also\nautomatically install the package on your machine.</p>\n<h2 id=\"step-3-using-the-appx-package\"><a href=\"#step-3-using-the-appx-package\">Step 3: Using the AppX Package</a></h2>\n<p>In order to run your package, your users will need Windows 10 with the so-called\n\"Anniversary Update\" - details on how to update Windows can be found <a href=\"https://blogs.windows.com/windowsexperience/2016/08/02/how-to-get-the-windows-10-anniversary-update\">here</a>.</p>\n<p>In opposition to traditional UWP apps, packaged apps currently need to undergo a\nmanual verification process, for which you can apply <a href=\"https://developer.microsoft.com/en-us/windows/projects/campaigns/desktop-bridge\">here</a>.\nIn the meantime, all users will be able to install your package by double-clicking it,\nso a submission to the store might not be necessary if you're looking for an\neasier installation method. In managed environments (usually enterprises), the\n<code>Add-AppxPackage</code> <a href=\"https://technet.microsoft.com/en-us/library/hh856048.aspx\">PowerShell Cmdlet can be used to install it in an automated fashion</a>.</p>\n<p>Another important limitation is that the compiled AppX package still contains a\nwin32 executable - and will therefore not run on Xbox, HoloLens, or Phones.</p>\n<h2 id=\"optional-add-uwp-features-using-a-backgroundtask\"><a href=\"#optional-add-uwp-features-using-a-backgroundtask\">Optional: Add UWP Features using a BackgroundTask</a></h2>\n<p>You can pair your Electron app up with an invisible UWP background task that\ngets to make full use of Windows 10 features - like push notifications,\nCortana integration, or live tiles.</p>\n<p>To check out how an Electron app that uses a background task to send toast\nnotifications and live tiles, <a href=\"https://github.com/felixrieseberg/electron-uwp-background\">check out the Microsoft-provided sample</a>.</p>\n<h2 id=\"optional-convert-using-container-virtualization\"><a href=\"#optional-convert-using-container-virtualization\">Optional: Convert using Container Virtualization</a></h2>\n<p>To generate the AppX package, the <code>electron-windows-store</code> CLI uses a template\nthat should work for most Electron apps. However, if you are using a custom\ninstaller, or should you experience any trouble with the generated package, you\ncan attempt to create a package using compilation with a Windows Container - in\nthat mode, the CLI will install and run your application in blank Windows Container\nto determine what modifications your application is exactly doing to the operating\nsystem.</p>\n<p>Before running the CLI for the first time, you will have to setup the \"Windows Desktop App\nConverter\". This will take a few minutes, but don't worry - you only have to do\nthis once. Download and Desktop App Converter from <a href=\"https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-run-desktop-app-converter\">here</a>.\nYou will receive two files: <code>DesktopAppConverter.zip</code> and <code>BaseImage-14316.wim</code>.</p>\n<ol>\n<li>Unzip <code>DesktopAppConverter.zip</code>. From an elevated PowerShell (opened with\n\"run as Administrator\", ensure that your systems execution policy allows us to\nrun everything we intend to run by calling <code>Set-ExecutionPolicy bypass</code>.</li>\n<li>Then, run the installation of the Desktop App Converter, passing in the\nlocation of the Windows base Image (downloaded as <code>BaseImage-14316.wim</code>), by\ncalling <code>.\\DesktopAppConverter.ps1 -Setup -BaseImage .\\BaseImage-14316.wim</code>.</li>\n<li>If running the above command prompts you for a reboot, please restart your\nmachine and run the above command again after a successful restart.</li>\n</ol>\n<p>Once installation succeeded, you can move on to compiling your Electron app.</p>",
      "title": "Windows Store Guide",
      "description": ""
    },
    "/docs/tutorial/windows-taskbar": {
      "locale": "en-US",
      "slug": "windows-taskbar",
      "href": "/docs/tutorial/windows-taskbar",
      "crowdinFileId": "256275",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-taskbar.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"taskbar-customization-windows\"><a href=\"#taskbar-customization-windows\">Taskbar Customization (Windows)</a></h1>\n<h2 id=\"overview\"><a href=\"#overview\">Overview</a></h2>\n<p>Electron has APIs to configure the app's icon in the Windows taskbar. This API\nsupports both Windows-only features like <a href=\"#jumplist\">creation of a <code>JumpList</code></a>,\n<a href=\"#thumbnail-toolbars\">custom thumbnails and toolbars</a>,\n<a href=\"#icon-overlays-in-taskbar\">icon overlays</a>, and the so-called\n<a href=\"#flash-frame\">\"Flash Frame\" effect</a>, and cross-platform features\nlike <a href=\"/docs/tutorial/recent-documents\">recent documents</a> and\n<a href=\"/docs/tutorial/progress-bar\">application progress</a>.</p>\n<h2 id=\"jumplist\"><a href=\"#jumplist\">JumpList</a></h2>\n<p>Windows allows apps to define a custom context menu that shows up when users\nright-click the app's icon in the taskbar. That context menu is called\n<code>JumpList</code>. You specify custom actions in the <code>Tasks</code> category of JumpList,\nas quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#tasks\">MSDN</a>:</p>\n<blockquote>\n<p>Applications define tasks based on both the program's features and the key\nthings a user is expected to do with them. Tasks should be context-free, in\nthat the application does not need to be running for them to work. They\nshould also be the statistically most common actions that a normal user would\nperform in an application, such as compose an email message or open the\ncalendar in a mail program, create a new document in a word processor, launch\nan application in a certain mode, or launch one of its subcommands. An\napplication should not clutter the menu with advanced features that standard\nusers won't need or one-time actions such as registration. Do not use tasks\nfor promotional items such as upgrades or special offers.</p>\n<p>It is strongly recommended that the task list be static. It should remain the\nsame regardless of the state or status of the application. While it is\npossible to vary the list dynamically, you should consider that this could\nconfuse the user who does not expect that portion of the destination list to\nchange.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420539.png\" alt=\"IE\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example of general tasks of\nInternet Explorer</p>\n</blockquote>\n<p>Unlike the dock menu in macOS which is a real menu, user tasks in Windows work\nlike application shortcuts. For example, when a user clicks a task, the program\nwill be executed with specified arguments.</p>\n<p>To set user tasks for your application, you can use\n<a href=\"/docs/api/app#appsetusertaskstasks-windows\">app.setUserTasks</a> API.</p>\n<h4 id=\"examples\"><a href=\"#examples\">Examples</a></h4>\n<h5 id=\"set-user-tasks\"><a href=\"#set-user-tasks\">Set user tasks</a></h5>\n<p>Starting with a working application from the\n<a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the\nfollowing lines:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setUserTasks([\n  {\n    <span class=\"hljs-attr\">program</span>: process.execPath,\n    <span class=\"hljs-attr\">arguments</span>: <span class=\"hljs-string\">'--new-window'</span>,\n    <span class=\"hljs-attr\">iconPath</span>: process.execPath,\n    <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'New Window'</span>,\n    <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Create a new window'</span>\n  }\n])\n</code></pre>\n<h5 id=\"clear-tasks-list\"><a href=\"#clear-tasks-list\">Clear tasks list</a></h5>\n<p>To clear your tasks list, you need to call <code>app.setUserTasks</code> with an empty\narray in the <code>main.js</code> file.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setUserTasks([])\n</code></pre>\n<blockquote>\n<p>NOTE: The user tasks will still be displayed even after closing your\napplication, so the icon and program path specified for a task should exist until your application is uninstalled.</p>\n</blockquote>\n<h3 id=\"thumbnail-toolbars\"><a href=\"#thumbnail-toolbars\">Thumbnail Toolbars</a></h3>\n<p>On Windows, you can add a thumbnail toolbar with specified buttons to a taskbar\nlayout of an application window. It provides users with a way to access a\nparticular window's command without restoring or activating the window.</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#thumbnail-toolbars\">MSDN</a>:</p>\n<blockquote>\n<p>This toolbar is the familiar standard toolbar common control. It has a\nmaximum of seven buttons. Each button's ID, image, tooltip, and state are defined\nin a structure, which is then passed to the taskbar. The application can show,\nenable, disable, or hide buttons from the thumbnail toolbar as required by its\ncurrent state.</p>\n<p>For example, Windows Media Player might offer standard media transport controls\nsuch as play, pause, mute, and stop.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420540.png\" alt=\"player\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example of thumbnail toolbar of Windows\nMedia Player</p>\n</blockquote>\n<p>To set thumbnail toolbar in your application, you need to use\n<a href=\"/docs/api/browser-window#winsetthumbarbuttonsbuttons-windows\">BrowserWindow.setThumbarButtons</a></p>\n<h4 id=\"examples-1\"><a href=\"#examples-1\">Examples</a></h4>\n<h5 id=\"set-thumbnail-toolbar\"><a href=\"#set-thumbnail-toolbar\">Set thumbnail toolbar</a></h5>\n<p>Starting with a working application from the\n<a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the\nfollowing lines:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.setThumbarButtons([\n  {\n    <span class=\"hljs-attr\">tooltip</span>: <span class=\"hljs-string\">'button1'</span>,\n    <span class=\"hljs-attr\">icon</span>: path.join(__dirname, <span class=\"hljs-string\">'button1.png'</span>),\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'button1 clicked'</span>) }\n  }, {\n    <span class=\"hljs-attr\">tooltip</span>: <span class=\"hljs-string\">'button2'</span>,\n    <span class=\"hljs-attr\">icon</span>: path.join(__dirname, <span class=\"hljs-string\">'button2.png'</span>),\n    <span class=\"hljs-attr\">flags</span>: [<span class=\"hljs-string\">'enabled'</span>, <span class=\"hljs-string\">'dismissonclick'</span>],\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'button2 clicked.'</span>) }\n  }\n])\n</code></pre>\n<h5 id=\"clear-thumbnail-toolbar\"><a href=\"#clear-thumbnail-toolbar\">Clear thumbnail toolbar</a></h5>\n<p>To clear thumbnail toolbar buttons, you need to call\n<code>BrowserWindow.setThumbarButtons</code> with an empty array in the <code>main.js</code> file.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.setThumbarButtons([])\n</code></pre>\n<h3 id=\"icon-overlays-in-taskbar\"><a href=\"#icon-overlays-in-taskbar\">Icon Overlays in Taskbar</a></h3>\n<p>On Windows, a taskbar button can use a small overlay to display application\nstatus.</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#icon-overlays\">MSDN</a>:</p>\n<blockquote>\n<p>Icon overlays serve as a contextual notification of status, and are intended\nto negate the need for a separate notification area status icon to communicate\nthat information to the user. For instance, the new mail status in Microsoft\nOutlook, currently shown in the notification area, can now be indicated\nthrough an overlay on the taskbar button. Again, you must decide during your\ndevelopment cycle which method is best for your application. Overlay icons are\nintended to supply important, long-standing status or notifications such as\nnetwork status, messenger status, or new mail. The user should not be\npresented with constantly changing overlays or animations.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420441.png\" alt=\"Overlay on taskbar button\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example of overlay on a taskbar button</p>\n</blockquote>\n<p>To set the overlay icon for a window, you need to use the\n<a href=\"/docs/api/browser-window#winsetoverlayiconoverlay-description-windows\">BrowserWindow.setOverlayIcon</a> API.</p>\n<h4 id=\"example\"><a href=\"#example\">Example</a></h4>\n<p>Starting with a working application from the\n<a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the\nfollowing lines:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.setOverlayIcon(<span class=\"hljs-string\">'path/to/overlay.png'</span>, <span class=\"hljs-string\">'Description for overlay'</span>)\n</code></pre>\n<h3 id=\"flash-frame\"><a href=\"#flash-frame\">Flash Frame</a></h3>\n<p>On Windows, you can highlight the taskbar button to get the user's attention.\nThis is similar to bouncing the dock icon in macOS.</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-flashwindow#remarks\">MSDN</a>:</p>\n<blockquote>\n<p>Typically, a window is flashed to inform the user that the window requires\nattention but that it does not currently have the keyboard focus.</p>\n</blockquote>\n<p>To flash the BrowserWindow taskbar button, you need to use the\n<a href=\"/docs/api/browser-window#winflashframeflag\">BrowserWindow.flashFrame</a> API.</p>\n<h4 id=\"example-1\"><a href=\"#example-1\">Example</a></h4>\n<p>Starting with a working application from the\n<a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the\nfollowing lines:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.once(<span class=\"hljs-string\">'focus'</span>, () => win.flashFrame(<span class=\"hljs-literal\">false</span>))\nwin.flashFrame(<span class=\"hljs-literal\">true</span>)\n</code></pre>\n<blockquote>\n<p>NOTE: Don't forget to call <code>win.flashFrame(false)</code> to turn off the flash.\nIn the above example, it is called when the window comes into focus,\nbut you might use a timeout or some other event to disable it.</p>\n</blockquote>",
      "title": "Taskbar Customization (Windows)",
      "description": "Applications define tasks based on both the program's features and the key\nthings a user is expected to do with them. Tasks should be context-free, in\nthat the application does not need to be running for them to work. They\nshould also be the statistically most common actions that a normal user would\nperform in an application, such as compose an email message or open the\ncalendar in a mail program, create a new document in a word processor, launch\nan application in a certain mode, or launch one of its subcommands. An\napplication should not clutter the menu with advanced features that standard\nusers won't need or one-time actions such as registration. Do not use tasks\nfor promotional items such as upgrades or special offers.\nIt is strongly recommended that the task list be static. It should remain the\nsame regardless of the state or status of the application. While it is\npossible to vary the list dynamically, you should consider that this could\nconfuse the user who does not expect that portion of the destination list to\nchange."
    }
  },
  "ja-JP": {
    "/docs/api/accelerator": {
      "locale": "ja-JP",
      "slug": "accelerator",
      "href": "/docs/api/accelerator",
      "crowdinFileId": "256277",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/accelerator.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"accelerator\"><a href=\"#accelerator\">Accelerator</a></h1>\n<blockquote>\n<p>キーボードショートカットを定義します。</p>\n</blockquote>\n<p>Accelerator は、<code>+</code> によって結合された複数の修飾キーと単一のキーコードを含む文字列で、アプリケーション全体でキーボードショートカットを定義するために使われます。</p>\n<p>例:</p>\n<ul>\n<li><code>CommandOrControl+A</code></li>\n<li><code>CommandOrControl+Shift+Z</code></li>\n</ul>\n<p>以下のようにショートカットは <a href=\"/docs/api/global-shortcut#globalshortcutregisteraccelerator-callback\"><code>register</code></a> メソッドを使って <a href=\"/docs/api/global-shortcut\"><code>globalShortcut</code></a> モジュールに登録されます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Register a 'CommandOrControl+Y' shortcut listener.</span>\n  globalShortcut.register(<span class=\"hljs-string\">'CommandOrControl+Y'</span>, () => {\n    <span class=\"hljs-comment\">// Y と Command/Control が押下されたときに処理を行います。</span>\n  })\n})\n</code></pre>\n<h2 id=\"プラットフォームに関する注意事項\"><a href=\"#プラットフォームに関する注意事項\">プラットフォームに関する注意事項</a></h2>\n<p>Linux と Windows の場合、<code>Command</code> キーは効果がありません。Accelerator を定義するのに、macOS では <code>Command</code>、Linux と Windows では <code>Control</code> を表す、<code>CommandOrControl</code> を使うようにしてください。</p>\n<p><code>Option</code> ではなく <code>Alt</code> を使用してください。 <code>Option</code> キーは macOS にしか存在しませんが、<code>Alt</code> キーは全てのプラットフォームで利用可能です。</p>\n<p><code>Super</code> (または <code>Meta</code>) キーは、WindowsとLinuxの場合は <code>Windows</code> キー、macOSの場合は <code>Cmd</code> にマッピングされます。</p>\n<h2 id=\"利用可能な修飾キー\"><a href=\"#利用可能な修飾キー\">利用可能な修飾キー</a></h2>\n<ul>\n<li><code>Command</code> (または略して <code>Cmd</code>)</li>\n<li><code>Control</code> (または略して <code>Ctrl</code>)</li>\n<li><code>CommandOrControl</code> (または略して <code>CmdOrCtrl</code>)</li>\n<li><code>Alt</code></li>\n<li><code>Option</code></li>\n<li><code>AltGr</code></li>\n<li><code>Shift</code></li>\n<li><code>Super</code></li>\n<li><code>メタ情報</code></li>\n</ul>\n<h2 id=\"利用可能なキーコード\"><a href=\"#利用可能なキーコード\">利用可能なキーコード</a></h2>\n<ul>\n<li><code>0</code> から <code>9</code></li>\n<li><code>A</code> から <code>Z</code></li>\n<li><code>F1</code> から <code>F24</code></li>\n<li><code>~</code>、<code>!</code>、<code>@</code>、<code>#</code>、<code>$</code> などの記号</li>\n<li><code>Plus</code></li>\n<li><code>Space</code></li>\n<li><code>Tab</code></li>\n<li><code>Capslock</code></li>\n<li><code>Numlock</code></li>\n<li><code>スクロールロック</code></li>\n<li><code>Backspace</code></li>\n<li><code>削除</code></li>\n<li><code>Insert</code></li>\n<li><code>Return</code> (またはエイリアスとして <code>Enter</code>)</li>\n<li><code>Up</code> と <code>Down</code>、 <code>Left</code>、 <code>Right</code></li>\n<li><code>Home</code> と <code>End</code></li>\n<li><code>PageUp</code> と <code>PageDown</code></li>\n<li><code>Escape</code> (または略して <code>Esc</code>)</li>\n<li><code>VolumeUp</code> と <code>VolumeDown</code>、 <code>VolumeMute</code></li>\n<li><code>MediaNextTrack</code> と <code>MediaPreviousTrack</code>、 <code>MediaStop</code>、 <code>MediaPlayPause</code></li>\n<li><code>PrintScreen</code></li>\n<li>NumPad Keys<ul>\n<li><code>num0</code> から <code>num9</code></li>\n<li><code>numdec</code> - 数字キー</li>\n<li><code>numadd</code> - テンキーの <code>+</code> キー</li>\n<li><code>numsub</code> - テンキーの <code>-</code> キー</li>\n<li><code>nummult</code> - テンキーの <code>*</code> キー</li>\n<li><code>numdiv</code> - テンキーの <code>÷</code> キー</li>\n</ul></li>\n</ul>",
      "title": "Accelerator",
      "description": "キーボードショートカットを定義します。"
    },
    "/docs/tutorial/accessibility": {
      "locale": "ja-JP",
      "slug": "accessibility",
      "href": "/docs/tutorial/accessibility",
      "crowdinFileId": "256173",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/accessibility.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"アクセシビリティ\"><a href=\"#アクセシビリティ\">アクセシビリティ</a></h1>\n<p>アクセシビリティの高いアプリケーションを作ることは重要です。私たちは、開発者がすべてのユーザとってより良いアプリケーションを開発することを手助けする機能として <a href=\"https://electronjs.org/devtron\">Devtron</a> と <a href=\"https://electronjs.org/spectron\">Spectron</a> を提供してます。</p>\n<hr>\n<p>Electron アプリケーションのアクセシビリティに関する懸念は、どちらも最終的に HTML であるため、ウェブサイトと同様です。 しかし、Electron アプリケーションでは、アプリケーションに監査機を指す URL がないため、アクセシビリティ監査にオンラインリソースを使用することはできません。</p>\n<p>これらの機能は、監査ツールを Electron アプリに提供します。 Spectron でテストに監査を追加するか、開発者向けツール内で Devtron で監査を使用するかを選択できます。 ツールの概要については、以下を参照してください。</p>\n<h2 id=\"spectron\"><a href=\"#spectron\">Spectron</a></h2>\n<p>Spectron テストフレームワークで、アプリケーション内の各ウィンドウと <code>&#x3C;webview></code> タグを監視できます。 以下がその例です。</p>\n<pre><code class=\"hljs language-javascript\">app.client.auditAccessibility().then(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\">audit</span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (audit.failed) {\n    <span class=\"hljs-built_in\">console</span>.error(audit.message)\n  }\n})\n</code></pre>\n<p>この機能の詳細は <a href=\"https://github.com/electron/spectron#accessibility-testing\">Spectron のドキュメント</a> にて閲覧できます。</p>\n<h2 id=\"devtron\"><a href=\"#devtron\">Devtron</a></h2>\n<p>Devtron にはアクセシビリティタブがあり、アプリ内のページを監査し、結果を並べ替えてフィルタリングすることができます。</p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/1305617/17156618/9f9bcd72-533f-11e6-880d-389115f40a2a.png\" alt=\"devtron スクリーンショット\"></p>\n<p>これらのツールはいずれも、Google for Chrome で作成された <a href=\"https://github.com/GoogleChrome/accessibility-developer-tools\">Accessibility Developer Tools</a> ライブラリを使用しています。 このライブラリが使用しているアクセシビリティ監査のルールに関する詳細は、<a href=\"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules\">リポジトリの wiki</a> に記載されています。</p>\n<p>Electron 向けの他の優れたアクセシビリティツールについて知っている場合は、アクセシビリティドキュメントにプルリクエストを加えてください。</p>\n<h2 id=\"アクセシビリティ機能を手動で有効にする\"><a href=\"#アクセシビリティ機能を手動で有効にする\">アクセシビリティ機能を手動で有効にする</a></h2>\n<p>Electron アプリケーションは、支援技術 (Windows の <a href=\"https://www.freedomscientific.com/products/software/jaws/\">JAWS</a> や macOS の <a href=\"https://help.apple.com/voiceover/mac/10.15/\">VoiceOver</a>など) が動いている場合にアクセシビリティ機能を自動で有効にします。 詳細については、Chrome の <a href=\"https://www.chromium.org/developers/design-documents/accessibility#TOC-How-Chrome-detects-the-presence-of-Assistive-Technology\">アクセシビリティドキュメント</a> を参照してください。</p>\n<p>これらの機能は、Electron アプリケーション内からか、サードパーティのネイティブソフトウェアでフラグを設定することで手動切り替えできます。</p>\n<h3 id=\"electron-の-api-を使用する\"><a href=\"#electron-の-api-を使用する\">Electron の API を使用する</a></h3>\n<p><a href=\"/docs/api/app#appsetaccessibilitysupportenabledenabled-macos-windows\"><code>app.setAccessibilitySupportEnabled(enabled)</code></a> API を使うことで、アプリケーション設定で Chrome のアクセシビリティを有効にする機能を手動設置できます。 注意として、ユーザーのシステム支援ユーティリティはこの設定よりも優先され、これを上書きします。</p>\n<h3 id=\"サードパーティーソフトウェア内から\"><a href=\"#サードパーティーソフトウェア内から\">サードパーティーソフトウェア内から</a></h3>\n<h4 id=\"macos\"><a href=\"#macos\">macOS</a></h4>\n<p>macOS では、サードパーティの支援技術により <code>AXManualAccessibility</code> 属性をプログラムで設定することで、Electron アプリケーション内のアクセシビリティ機能を切り替えられます。</p>\n<pre><code class=\"hljs language-objc\"><span class=\"hljs-built_in\">CFStringRef</span> kAXManualAccessibility = <span class=\"hljs-built_in\">CFSTR</span>(<span class=\"hljs-string\">\"AXManualAccessibility\"</span>);\n\n+ (<span class=\"hljs-keyword\">void</span>)enableAccessibility:(<span class=\"hljs-built_in\">BOOL</span>)enable inElectronApplication:(<span class=\"hljs-built_in\">NSRunningApplication</span> *)app\n{\n    AXUIElementRef appRef = AXUIElementCreateApplication(app.processIdentifier);\n    <span class=\"hljs-keyword\">if</span> (appRef == <span class=\"hljs-literal\">nil</span>)\n        <span class=\"hljs-keyword\">return</span>;\n\n    <span class=\"hljs-built_in\">CFBooleanRef</span> value = enable ? kCFBooleanTrue : kCFBooleanFalse;\n    AXUIElementSetAttributeValue(appRef, kAXManualAccessibility, value);\n    <span class=\"hljs-built_in\">CFRelease</span>(appRef);\n}\n</code></pre>",
      "title": "アクセシビリティ",
      "description": ""
    },
    "/docs/api/app": {
      "locale": "ja-JP",
      "slug": "app",
      "href": "/docs/api/app",
      "crowdinFileId": "256279",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/app.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"app\"><a href=\"#app\">app</a></h1>\n<blockquote>\n<p>アプリケーションのイベントライフサイクルを制御します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>以下の例では最後のウインドウが閉じられたときにアプリケーションを終了する方法を示します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  app.quit()\n})\n</code></pre>\n<h2 id=\"イベント\"><a href=\"#イベント\">イベント</a></h2>\n<p><code>app</code> オブジェクトでは以下のイベントが発生します。</p>\n<h3 id=\"イベント-will-finish-launching\"><a href=\"#イベント-will-finish-launching\">イベント: 'will-finish-launching'</a></h3>\n<p>アプリケーションが基本的な起動処理を完了したときに発生します。 Windows と Linux上では、<code>will-finish-launching</code> イベントは <code>ready</code> イベントと同じです。macOS上では、このイベントは<code>NSApplication</code> の <code>applicationWillFinishLaunching</code> 通知を表しています。 通常、ここでは、<code>open-file</code> や <code>open-url</code> イベントのリスナーを設定したり、クラッシュレポーターや自動アップデーターを開始したりします。</p>\n<p>ほとんどの場合、<code>ready</code> イベントハンドラーですべてのことを行うようにするべきです。</p>\n<h3 id=\"イベント-ready\"><a href=\"#イベント-ready\">イベント: 'ready'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>launchInfo</code> Record&#x3C;string, any> | <a href=\"/docs/api/structures/notification-response\">NotificationResponse</a> <em>macOS</em></li>\n</ul>\n<p>Electron が一度、初期化処理を完了したときに発生します。 macOS で通知センターから起動された場合、<code>launchInfo</code> は、<code>NSUserNotification</code> の <code>userInfo</code>、またはアプリケーションを開く際に使用された <a href=\"/docs/api/structures/notification-response\"><code>UNNotificationResponse</code></a> からの情報を保持しています。 また、<code>app.isReady()</code> を呼び出してこのイベントが発生したことがあるかどうかを確認したり、<code>app.whenReady()</code> を呼び出して Electron 初期化時に解決される Promise を取得したりできます。</p>\n<h3 id=\"イベント-window-all-closed\"><a href=\"#イベント-window-all-closed\">イベント: 'window-all-closed'</a></h3>\n<p>すべてのウィンドウが閉じられたときに発生します。</p>\n<p>このイベントを購読せずに全てのウインドウを閉じた場合、既定の動作としてアプリは終了します。しかし、このイベントを購読している場合は、アプリを終了するかどうかを制御することができます。 ユーザが <code>Cmd + Q</code> を押下したり、開発者が <code>app.quit()</code> を呼び出したりした場合では、Electron はまず全てのウインドウを閉じようとして、その後に <code>will-quit</code> イベントを発生させます。しかし、この場合は <code>window-all-closed</code> イベントは発生しません。</p>\n<h3 id=\"イベント-before-quit\"><a href=\"#イベント-before-quit\">イベント: 'before-quit'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>アプリケーションがウィンドウを閉じ始める前に発生します。 <code>event.preventDefault()</code> を呼び出すことで、アプリケーションが終了する既定の動作を阻害できます。</p>\n<p><strong>注:</strong> アプリケーションの終了が <code>autoUpdater.quitAndInstall()</code> によって開始された場合、全てのウインドウで <code>close</code> イベントを発生させ、それらが閉じた<em>後</em> に <code>before-quit</code> が発生します。</p>\n<p><strong>注釈:</strong> Windows では、このイベントはシステムのシャットダウン/再起動やユーザーのログアウトでアプリケーションが閉じられようとしている場合には発生しません。</p>\n<h3 id=\"イベント-will-quit\"><a href=\"#イベント-will-quit\">イベント: 'will-quit'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>すべてのウィンドウが閉じられ、アプリが終了しようとしているときに発生します。 <code>event.preventDefault()</code> を呼び出すことで、アプリケーションが終了する既定の動作を阻害できます。</p>\n<p><code>will-quit</code> と <code>window-all-closed</code> イベントの差異を確認するためには、<code>window-all-closed</code> イベントの説明もお読みください。</p>\n<p><strong>注釈:</strong> Windows では、このイベントはシステムのシャットダウン/再起動やユーザーのログアウトでアプリケーションが閉じられようとしている場合には発生しません。</p>\n<h3 id=\"イベント-quit\"><a href=\"#イベント-quit\">イベント: 'quit'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>exitCode</code> Integer</li>\n</ul>\n<p>アプリケーションが終了するときに発生します。</p>\n<p><strong>注釈:</strong> Windows では、このイベントはシステムのシャットダウン/再起動やユーザーのログアウトでアプリケーションが閉じられようとしている場合には発生しません。</p>\n<h3 id=\"イベント-open-file-macos\"><a href=\"#イベント-open-file-macos\">イベント: 'open-file' <em>macOS</em></a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>path</code> String</li>\n</ul>\n<p>ユーザがアプリケーションでファイルを開こうとしたときに発生します。 <code>open-file</code> イベントは、大抵の場合ファイルをアプリケーションが既に開いていて、OS が開くために再利用しようとしたときに発生します。 <code>open-file</code> は、Dock にファイルがドロップされて、アプリケーションがまだ起動していないときにも発生します。 このようなケースに対処するために、アプリケーション起動時の非常に早い段階 ( <code>ready</code> イベントが発生するよりも前) で <code>open-file</code> イベントを監視するようにしてください。</p>\n<p>このイベントを処理する場合、<code>event.preventDefault()</code> を呼び出す必要があります。</p>\n<p>Windows では、ファイルパスを取得するために (メインプロセスの) <code>process.argv</code> をパースしなければなりません。</p>\n<h3 id=\"イベント-open-url-macos\"><a href=\"#イベント-open-url-macos\">イベント: 'open-url' <em>macOS</em></a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n</ul>\n<p>ユーザがこのアプリケーションで URL を開こうとしたときに発生します。 アプリケーションの <code>Info.plist</code> ファイルで <code>CFBundleURLTypes</code> キーの中に URL スキームを定義し、<code>NSPrincipalClass</code> に <code>AtomApplication</code> を設定しなければなりません。</p>\n<p>このイベントを処理する場合、<code>event.preventDefault()</code> を呼び出す必要があります。</p>\n<h3 id=\"イベント-activate-macos\"><a href=\"#イベント-activate-macos\">イベント: 'activate' <em>macOS</em></a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>hasVisibleWindows</code> Boolean</li>\n</ul>\n<p>アプリケーションがアクティブになったときに発生します。 アプリケーションが最初に起動される、既に実行中のときにアプリケーションを再起動しようとする、アプリケーションの Dock やタスクバーのアイコンをクリックするなど、いろいろなアクションがこのイベントの引き金となり得ます。</p>\n<h3 id=\"イベント-did-become-active-macos\"><a href=\"#イベント-did-become-active-macos\">イベント: 'did-become-active' <em>macOS</em></a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>macOS のアプリケーションがアクティブになったときに発生します。 <code>activate</code>イベントとの違い: <code>did-become-active</code> が発生するのはアプリがアクティブになる度に発生します。Dock アイコンがクリックしたり、アプリが再起動したときだけではありません。</p>\n<h3 id=\"イベント-continue-activity-macos\"><a href=\"#イベント-continue-activity-macos\">イベント: 'continue-activity' <em>macOS</em></a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - アクティビティを識別する文字列。 <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a> と対応しています。</li>\n<li><code>userInfo</code> unknown - 別のデバイスのアクティビティによって保存されたアプリ固有の情報が含まれています。</li>\n<li><code>details</code> Object<ul>\n<li><code>webpageURL</code> String (任意) - 利用可能な場合、別デバイス上の操作でアクセスしたウェブページの URL を特定する文字列になります。</li>\n</ul></li>\n</ul>\n<p><a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">ハンドオフ</a> 中に別のデバイスからのアクティビティを継続しようとしたときに発生します。 このイベントを処理する場合、<code>event.preventDefault()</code> を呼び出す必要があります。</p>\n<p>ユーザのアクティビティはアクティビティ元のアプリと同一の開発者チームIDを持ち、アクティビティタイプをサポートするアプリでしか継続させることができません。 サポートされるアクティビティタイプは、アプリの <code>Info.plist</code> の <code>NSUserActivityTypes</code> キーで指定されています。</p>\n<h3 id=\"イベント-will-continue-activity-macos\"><a href=\"#イベント-will-continue-activity-macos\">イベント: 'will-continue-activity' <em>macOS</em></a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - アクティビティを識別する文字列。 <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a> と対応しています。</li>\n</ul>\n<p><a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">ハンドオフ</a> 中に別のデバイスからのアクティビティを継続しようとする前に発生します。 このイベントを処理する場合、<code>event.preventDefault()</code> を呼び出す必要があります。</p>\n<h3 id=\"イベント-continue-activity-error-macos\"><a href=\"#イベント-continue-activity-error-macos\">イベント: 'continue-activity-error' <em>macOS</em></a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - アクティビティを識別する文字列。 <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a> と対応しています。</li>\n<li><code>error</code> String - エラーのローカライズされた説明としての文字列。</li>\n</ul>\n<p><a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">ハンドオフ</a> 中に別のデバイスからのアクティビティを継続できなかったときに発生します。</p>\n<h3 id=\"イベント-activity-was-continued-macos\"><a href=\"#イベント-activity-was-continued-macos\">イベント: 'activity-was-continued' <em>macOS</em></a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - アクティビティを識別する文字列。 <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a> と対応しています。</li>\n<li><code>userInfo</code> unknown - アクティビティによって保存されたアプリ固有の情報が含まれています。</li>\n</ul>\n<p><a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">ハンドオフ</a> 中にこのデバイスからのアクティビティを他のデバイスで継続させることに成功した後で発生します。</p>\n<h3 id=\"イベント-update-activity-state-macos\"><a href=\"#イベント-update-activity-state-macos\">イベント: 'update-activity-state' <em>macOS</em></a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - アクティビティを識別する文字列。 <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a> と対応しています。</li>\n<li><code>userInfo</code> unknown - アクティビティによって保存されたアプリ固有の情報が含まれています。</li>\n</ul>\n<p><a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">ハンドオフ</a> が別のデバイスでまさに継続されようとしているときに発生します。 送信される情報を更新する必要がある場合、<code>event.preventDefault()</code> をすぐに呼び出してください。そして、新しい <code>userInfo</code> ディクショナリを組み立てて、<code>app.updateCurrentActivity()</code> をタイミングよく呼び出してください。 さもなくば操作は失敗し、<code>continue-activity-error</code> が呼び出されます。</p>\n<h3 id=\"イベント-new-window-for-tab-macos\"><a href=\"#イベント-new-window-for-tab-macos\">イベント: 'new-window-for-tab' <em>macOS</em></a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>ユーザーが macOS ネイティブの新規タブボタンをクリックすると発生します。 新規タブボタンは現在の <code>BrowserWindow</code> に <code>tabbingIdentifier</code> が設定されている場合にだけ表示されます。</p>\n<h3 id=\"イベント-browser-window-blur\"><a href=\"#イベント-browser-window-blur\">イベント: 'browser-window-blur'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p><a href=\"/docs/api/browser-window\">browserWindow</a> のフォーカスが外れたときに発生します。</p>\n<h3 id=\"イベント-browser-window-focus\"><a href=\"#イベント-browser-window-focus\">イベント: 'browser-window-focus'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p><a href=\"/docs/api/browser-window\">browserWindow</a> がフォーカスを得たときに発生します。</p>\n<h3 id=\"イベント-browser-window-created\"><a href=\"#イベント-browser-window-created\">イベント: 'browser-window-created'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>新しい <a href=\"/docs/api/browser-window\">browserWindow</a> が生成されたときに発生します。</p>\n<h3 id=\"イベント-web-contents-created\"><a href=\"#イベント-web-contents-created\">イベント: 'web-contents-created'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>新しい <a href=\"/docs/api/web-contents\">webContents</a> が生成されたときに発生します。</p>\n<h3 id=\"イベント-certificate-error\"><a href=\"#イベント-certificate-error\">イベント: 'certificate-error'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>url</code> String</li>\n<li><code>error</code> String - エラーコード</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>isTrusted</code> Boolean - 証明書を信頼できるものと見なすかどうか</li>\n</ul></li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p><code>url</code> に対する <code>certificate</code> の検証に失敗したときに発生します。証明書を信頼するためには、<code>event.preventDefault()</code> で既定の動作をキャンセルして、<code>callback(true)</code> を呼び出すようにしてください。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'certificate-error'</span>, (event, webContents, url, error, certificate, callback) => {\n  <span class=\"hljs-keyword\">if</span> (url === <span class=\"hljs-string\">'https://github.com'</span>) {\n    <span class=\"hljs-comment\">// 検証ロジック。</span>\n    event.preventDefault()\n    callback(<span class=\"hljs-literal\">true</span>)\n  } <span class=\"hljs-keyword\">else</span> {\n    callback(<span class=\"hljs-literal\">false</span>)\n  }\n})\n</code></pre>\n<h3 id=\"イベント-select-client-certificate\"><a href=\"#イベント-select-client-certificate\">イベント: 'select-client-certificate'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>url</code> URL</li>\n<li><code>certificateList</code> <a href=\"/docs/api/structures/certificate\">Certificate[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> (optional)</li>\n</ul></li>\n</ul>\n<p>クライアント証明書が要求されたときに発生します。</p>\n<p><code>url</code> がクライアント証明書を要求しているナビゲーションエントリーに対応していれば、リストからフィルターされたエントリーで <code>callback</code> を呼び出すことができます。 <code>event.preventDefault()</code> を使うことで、アプリケーションがストアから最初の証明書を使うのをキャンセルできます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'select-client-certificate'</span>, (event, webContents, url, list, callback) => {\n  event.preventDefault()\n  callback(list[<span class=\"hljs-number\">0</span>])\n})\n</code></pre>\n<h3 id=\"イベント-login\"><a href=\"#イベント-login\">イベント: 'login'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>authenticationResponseDetails</code> Object<ul>\n<li><code>url</code> URL</li>\n</ul></li>\n<li><code>authInfo</code> Object<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (任意)</li>\n<li><code>password</code> String (任意)</li>\n</ul></li>\n</ul>\n<p><code>webContents</code> がBasic認証を要求すると発生します。</p>\n<p>既定の動作では、全てに認証をキャンセルします。 これを変更するには、<code>event.preventDefault()</code> で既定の動作をキャンセルして、資格情報と共に <code>callback(username, password)</code> を呼び出すようにしてください。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'login'</span>, (event, webContents, details, authInfo, callback) => {\n  event.preventDefault()\n  callback(<span class=\"hljs-string\">'username'</span>, <span class=\"hljs-string\">'secret'</span>)\n})\n</code></pre>\n<p>ユーザー名またはパスワードを渡さずに <code>callback</code> を呼び出すと、認証リクエストはキャンセルされ、認証エラーがページに返されます。</p>\n<h3 id=\"イベント-gpu-info-update\"><a href=\"#イベント-gpu-info-update\">イベント: 'gpu-info-update'</a></h3>\n<p>GPU 情報の更新がある場合に発生します。</p>\n<h3 id=\"イベント-gpu-process-crashed-非推奨\"><a href=\"#イベント-gpu-process-crashed-非推奨\">イベント: 'gpu-process-crashed' <em>非推奨</em></a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>GPU プロセスがクラッシュしたり、強制終了されたりしたときに発生します。</p>\n<p><strong>非推奨:</strong> このイベントは <code>child-process-gone</code> イベント によって引き継がれます。このイベントには、子プロセスが失われた理由についての詳細情報が含まれています。 これはクラッシュした場合に限りません。 移植する場合は、Boolean 型の <code>killed</code> だと <code>reason === 'killed'</code> をチェックするように置き換えればできます。</p>\n<h3 id=\"イベント-renderer-process-crashed-deprecated\"><a href=\"#イベント-renderer-process-crashed-deprecated\">イベント: 'renderer-process-crashed' <em>Deprecated</em></a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p><code>webContents</code> のレンダラープロセスがクラッシュ、または強制終了されたときに発行されます。</p>\n<p><strong>非推奨:</strong> このイベントは <code>render-process-gone</code> イベント によって引き継がれます。このイベントには、子プロセスが失われた理由についての詳細情報が含まれています。 これはクラッシュした場合に限りません。  移植する場合は、Boolean 型の <code>killed</code> だと <code>reason === 'killed'</code> をチェックするように置き換えればできます。</p>\n<h3 id=\"イベント-render-process-gone\"><a href=\"#イベント-render-process-gone\">イベント: 'render-process-gone'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>details</code> Object<ul>\n<li><code>reason</code> String - レンダープロセスがなくなった理由。  取りうる値:<ul>\n<li><code>clean-exit</code> - 終了コードが0でプロセスが終了した</li>\n<li><code>abnormal-exit</code> - ゼロでない終了コードでプロセスを終了しました。</li>\n<li><code>killed</code> - プロセスへSIGTERMシグナルが送信されたか、その他の方法で殺されました。</li>\n<li><code>crashed</code> - プロセスがクラッシュした</li>\n<li><code>oom</code> - プロセスがメモリ不足になった</li>\n<li><code>launch-failed</code> - プロセスが正常に起動されなかった</li>\n<li><code>integrity-failure</code> - Windows コードの整合性チェックに失敗しました</li>\n</ul></li>\n<li><code>exitCode</code> Integer - プロセスの終了コードです。<code>reason</code> が <code>launch-failed</code> でなければ、<code>exitCode</code> はプラットフォーム固有の起動失敗のエラーコードになります。</li>\n</ul></li>\n</ul>\n<p>renderer processが予期せず消えたときに発生します。  プロセスがクラッシュした場合やまたは殺された場合、これは正常です。</p>\n<h3 id=\"イベント-child-process-gone\"><a href=\"#イベント-child-process-gone\">イベント: 'child-process-gone'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>type</code> String - プロセスの種別。 以下の値のいずれかです。<ul>\n<li><code>Utility</code></li>\n<li><code>Zygote</code></li>\n<li><code>Sandbox helper</code></li>\n<li><code>GPU</code></li>\n<li><code>Pepper Plugin</code></li>\n<li><code>Pepper Plugin Broker</code></li>\n<li><code>Unknown</code></li>\n</ul></li>\n<li><code>reason</code> String - 子プロセスがなくなった理由。 取りうる値:<ul>\n<li><code>clean-exit</code> - 終了コードが0でプロセスが終了した</li>\n<li><code>abnormal-exit</code> - ゼロでない終了コードでプロセスを終了しました。</li>\n<li><code>killed</code> - プロセスへSIGTERMシグナルが送信されたか、その他の方法で殺されました。</li>\n<li><code>crashed</code> - プロセスがクラッシュした</li>\n<li><code>oom</code> - プロセスがメモリ不足になった</li>\n<li><code>launch-failed</code> - プロセスが正常に起動されなかった</li>\n<li><code>integrity-failure</code> - Windows コードの整合性チェックに失敗しました</li>\n</ul></li>\n<li><code>exitCode</code> Number - プロセスの終了コード (例: posix の場合は waitpid からのステータス、Windowsの場合は GetExitCodeProcess) 。</li>\n<li><code>serviceName</code> String (任意) - そのプロセスのローカライズされていない名前。</li>\n<li><code>name</code> String (任意) - そのプロセスの名前。 ユーティリティの例: <code>Audio Service</code>, <code>Content Decryption Module Service</code>, <code>Network Service</code>, <code>Video Capture</code>など</li>\n</ul></li>\n</ul>\n<p>子 processが予期せず消えたときに発生します。 プロセスがクラッシュした場合やまたは殺された場合、これは正常です。 レンダラープロセスを含みません。</p>\n<h3 id=\"イベント-accessibility-support-changed-macos-windows\"><a href=\"#イベント-accessibility-support-changed-macos-windows\">イベント: 'accessibility-support-changed' <em>macOS</em> <em>Windows</em></a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>accessibilitySupportEnabled</code> Boolean - Chromeのユーザ補助機能が有効な場合は <code>true</code>、そうでない場合は <code>false</code>。</li>\n</ul>\n<p>Chromeのユーザ補助機能が変更されると発生します。 このイベントはスクリーンリーダーのような支援技術が有効にされたり、無効にされたりしたときに発火します。 詳細については、<a href=\"https://www.chromium.org/developers/design-documents/accessibility\">https://www.chromium.org/developers/design-documents/accessibility</a> を参照してください。</p>\n<h3 id=\"イベント-session-created\"><a href=\"#イベント-session-created\">イベント: 'session-created'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>session</code> <a href=\"/docs/api/session\">Session</a></li>\n</ul>\n<p>Electron が新しい <code>session</code> を作成したときに発生します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'session-created'</span>, (session) => {\n  <span class=\"hljs-built_in\">console</span>.log(session)\n})\n</code></pre>\n<h3 id=\"イベント-second-instance\"><a href=\"#イベント-second-instance\">イベント: 'second-instance'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>argv</code> String[] - 2番目のインスタンスのコマンドライン引数の配列</li>\n<li><code>workingDirectory</code> String - 2番目のインスタンスの作業ディレクトリ</li>\n</ul>\n<p>このイベントは、2 つ目のインスタンスが実行され <code>app.requestSingleInstanceLock()</code> が実行されたとき、アプリケーションの1つ目のインスタンス内で発火されます。</p>\n<p><code>argv</code> は2番目のインスタンスのコマンドライン引数の配列で、<code>workingDirectory</code> はその現在の作業ディレクトリです。 通常、アプリケーションはこれに対して1番目のウインドウにフォーカスを当て、最小化しないように対応します。</p>\n<p><strong>注意:</strong> 2 番目のインスタンスが最初のインスタンスとは別のユーザーによって起動された場合、 <code>argv</code> 配列には引数が含まれません。</p>\n<p>このイベントは <code>app</code> の <code>ready</code> イベントが発生した後で実行されることが保証されます。</p>\n<p><strong>注意:</strong> Chromiumがコマンドライン引数を追加することがあります。例えば、<code>--original-process-start-time</code>があります。</p>\n<h3 id=\"イベント-desktop-capturer-get-sources\"><a href=\"#イベント-desktop-capturer-get-sources\">イベント: 'desktop-capturer-get-sources'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p><code>webContents</code> のレンダラープロセス内で <code>desktopCapture.getSources()</code> が呼ばれたときに発生します。 <code>event.preventDefault()</code> を呼び出すと、空のソースを返します。</p>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>app</code> オブジェクトには以下のメソッドがあります。</p>\n<p><strong>注:</strong> いくつかのメソッドは特定のオペレーティングシステムでのみ利用可能で、そのように注記がつけられています。</p>\n<h3 id=\"appquit\"><a href=\"#appquit\"><code>app.quit()</code></a></h3>\n<p>すべてのウインドウを閉じようとします。 <code>before-quit</code> イベントが最初に発生します。 すべてのウインドウを閉じることに成功した場合、<code>will-quit</code> イベントが発生し、既定ではアプリケーションは終了します。</p>\n<p>このメソッドは、すべての <code>beforeunload</code> および <code>unload</code> イベントハンドラーが正しく実行されることを保証します。 <code>beforeunload</code> イベントハンドラーで <code>false</code> を返すことによって、ウインドウが終了処理をキャンセルすることができます。</p>\n<h3 id=\"appexitexitcode\"><a href=\"#appexitexitcode\"><code>app.exit([exitCode])</code></a></h3>\n<ul>\n<li><code>exitCode</code> Integer (任意)</li>\n</ul>\n<p><code>exitCode</code> ですぐに終了します。 <code>exitCode</code> の省略値は 0 です。</p>\n<p>ユーザに確認することなくすべてのウインドウがすぐに閉じられ、<code>before-quit</code> および <code>will-quit</code> イベントは発生しません。</p>\n<h3 id=\"apprelaunchoptions\"><a href=\"#apprelaunchoptions\"><code>app.relaunch([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (任意)<ul>\n<li><code>args</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a></li>\n<li><code>execPath</code> String (任意)</li>\n</ul></li>\n</ul>\n<p>現在のインスタンスが終了したときに、アプリを再起動します。</p>\n<p>既定では新しいインスタンスは現在のインスタンスと同じ作業ディレクトリおよびコマンドライン引数を使用します。 <code>args</code> が指定された場合、<code>args</code> がコマンドライン引数として代わりに引き渡されます。 <code>execPath</code> が指定された場合、<code>execPath</code> が再起動のため現在のアプリに代わって実行されます。</p>\n<p>このメソッドは実行されているアプリを終了しないことに注意してください。アプリを再起動するには、<code>app.relaunch</code> を呼び出した後、<code>app.quit</code> または <code>app.exit</code> を呼び出さなければなりません。</p>\n<p><code>app.relaunch</code> を複数回呼び出した場合、現在のインスタンスが終了した後、複数のインスタンスが開始されます。</p>\n<p>現在のインスタンスをすぐに再起動し、新しいコマンドライン引数を新しいインスタンスに追加する例:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.relaunch({ <span class=\"hljs-attr\">args</span>: process.argv.slice(<span class=\"hljs-number\">1</span>).concat([<span class=\"hljs-string\">'--relaunch'</span>]) })\napp.exit(<span class=\"hljs-number\">0</span>)\n</code></pre>\n<h3 id=\"appisready\"><a href=\"#appisready\"><code>app.isReady()</code></a></h3>\n<p>戻り値 <code>Boolean</code> - Electronの初期化が完了している場合、<code>true</code>、そうでない場合、<code>false</code>。 <code>app.whenReady()</code> も参照してください。</p>\n<h3 id=\"appwhenready\"><a href=\"#appwhenready\"><code>app.whenReady()</code></a></h3>\n<p>Returns <code>Promise&#x3C;void></code> - Electron が初期化されるときに実行される Promise。 <code>app.isReady()</code> を確認してアプリの準備がまだできていないときに <code>ready</code> イベントに登録するための、便利な代替手段として使用できます。</p>\n<h3 id=\"appfocusoptions\"><a href=\"#appfocusoptions\"><code>app.focus([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (任意)<ul>\n<li><code>steal</code> Boolean <em>macOS</em> - 他のアプリが現在アクティブな場合でも、受信者をアクティブなアプリにします。</li>\n</ul></li>\n</ul>\n<p>Linux では、最初の表示ウィンドウにフォーカスします。 macOS では、アプリケーションがアクティブになります。 Windows では、アプリケーションの最初のウィンドウにフォーカスします。</p>\n<p>できるだけ慎重に <code>steal</code> オプションを使用してください。</p>\n<h3 id=\"apphide-macos\"><a href=\"#apphide-macos\"><code>app.hide()</code> <em>macOS</em></a></h3>\n<p>最小化することなくアプリケーションのすべてのウインドウを非表示にします。</p>\n<h3 id=\"appshow-macos\"><a href=\"#appshow-macos\"><code>app.show()</code> <em>macOS</em></a></h3>\n<p>非表示にされたアプリケーションのウインドウを表示します。 自動的にフォーカスしません。</p>\n<h3 id=\"appsetapplogspathpath\"><a href=\"#appsetapplogspathpath\"><code>app.setAppLogsPath([path])</code></a></h3>\n<ul>\n<li><code>path</code> String (任意) - ログのカスタムパス。 絶対パスでなければなりません。</li>\n</ul>\n<p>アプリがロギングするディレクトリを設定または作成します。これは <code>app.getPath()</code> や <code>app.setPath(pathName, newPath)</code> で操作できます。</p>\n<p><code>path</code> 引数なしで <code>app.setAppLogsPath()</code> を呼び出すと、このディレクトリは、<em>macOS</em> では <code>~/Library/Logs/アプリ名</code> に、<em>Linux</em> と <em>Windows</em> では <code>userData</code> ディレクトリ内に設定されます。</p>\n<h3 id=\"appgetapppath\"><a href=\"#appgetapppath\"><code>app.getAppPath()</code></a></h3>\n<p>戻り値 <code>String</code> - 現在のアプリケーションのディレクトリ。</p>\n<h3 id=\"appgetpathname\"><a href=\"#appgetpathname\"><code>app.getPath(name)</code></a></h3>\n<ul>\n<li><code>name</code> String - 以下のパスを名前で要求することができます。<ul>\n<li><code>home</code> ユーザのホームディレクトリ。</li>\n<li><code>appData</code> - 既定のユーザ毎のアプリケーションデータディレクトリ。<ul>\n<li>Windowsの場合、<code>%APPDATA%</code></li>\n<li>Linuxの場合、<code>$XDG_CONFIG_HOME</code> もしくは <code>~/.config</code></li>\n<li>macOSの場合、<code>~/Library/Application Support</code></li>\n</ul></li>\n<li><code>userData</code> アプリの設定ファイルが保存されるディレクトリで、既定ではアプリの名前で追加された <code>appData</code> のディレクトリ。</li>\n<li><code>キャッシュ</code></li>\n<li><code>temp</code> 一時ディレクトリ。</li>\n<li><code>exe</code> 現在の実行ファイル。</li>\n<li><code>module</code> <code>libchromiumcontent</code> ライブラリ。</li>\n<li><code>desktop</code> 現在のユーザのデスクトップディレクトリ。</li>\n<li><code>documents</code> ユーザの\"マイドキュメント\"のディレクトリ。</li>\n<li><code>downloads</code> ユーザのダウンロードのディレクトリ。</li>\n<li><code>music</code> ユーザのミュージックのディレクトリ。</li>\n<li><code>pictures</code> ユーザのピクチャのディレクトリ。</li>\n<li><code>videos</code> ユーザのビデオのディレクトリ。</li>\n<li><code>recent</code> ユーザーの最近のファイルのめのディレクトリ(Windows のみ)。</li>\n<li><code>logs</code> アプリのログフォルダのディレクトリ。</li>\n<li><code>crashDumps</code> クラッシュダンプが格納されているディレクトリ。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>String</code> - <code>name</code> に関連付けられた特別なディレクトリもしくはファイルのパス。 失敗した場合、<code>Error</code> が送出されます。</p>\n<p><code>app.setAppLogsPath()</code> を呼び出すよりも先に <code>app.getPath('logs')</code> が呼び出された場合、<code>path</code> 引数なしで <code>app.setAppLogsPath()</code> を呼び出すのに等しい、デフォルトのログディレクトリが作成されます。</p>\n<h3 id=\"appgetfileiconpath-options\"><a href=\"#appgetfileiconpath-options\"><code>app.getFileIcon(path[, options])</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>size</code> String<ul>\n<li><code>small</code> - 16x16</li>\n<li><code>normal</code> - 32x32</li>\n<li><code>large</code> - <em>Linux</em> の場合は 48x48、<em>Windows</em>の場合は 32x32、<em>macOS</em> の場合はサポートされていません。</li>\n</ul></li>\n</ul></li>\n</ul>\n<p><code>Promise&#x3C;NativeImage></code>を返す - <a href=\"/docs/api/native-image\">NativeImage</a>でアプリのアイコンを埋めます。</p>\n<p>パスに関連付けられているアイコンを取得します。</p>\n<p><em>Windows</em> の場合、2種類のアイコンがあります。</p>\n<ul>\n<li><code>.mp3</code>、<code>.png</code> など、特定のファイル拡張子に関連付けられたアイコン。</li>\n<li><code>.exe</code>、<code>.dll</code>、<code>.ico</code> のような、ファイル自体に含まれるアイコン。</li>\n</ul>\n<p><em>Linux</em> と <em>macOS</em> の場合、アイコンはファイルのMIMEタイプに関連付けられたアプリケーションによって決まります。</p>\n<h3 id=\"appsetpathname-path\"><a href=\"#appsetpathname-path\"><code>app.setPath(name, path)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n<li><code>path</code> String</li>\n</ul>\n<p><code>name</code> に関連付けられた特別なディレクトリもしくはファイルの <code>path</code> を上書きします。 パスとして存在しないディレクトリが指定された場合、<code>Error</code> が投げられます。 その場合、そのディレクトリを <code>fs.mkdirSync</code> や類似のもので作成するべきです。</p>\n<p><code>app.getPath</code> で定義されている <code>name</code> のパスだけを上書きすることができます。</p>\n<p>既定では、WebページのCookieとキャッシュは <code>userData</code> ディレクトリに保存されます。 この場所を変更するには、<code>app</code> モジュールの <code>ready</code> イベントが発生する前に <code>userData</code> を上書きする必要があります。</p>\n<h3 id=\"appgetversion\"><a href=\"#appgetversion\"><code>app.getVersion()</code></a></h3>\n<p>戻り値 <code>String</code> - ロードされたアプリケーションのバージョン。 アプリケーションの <code>package.json</code> ファイルにバージョンが見つからない場合、現在のバンドルもしくは実行可能ファイルのバージョンが返却されます。</p>\n<h3 id=\"appgetname\"><a href=\"#appgetname\"><code>app.getName()</code></a></h3>\n<p>戻り値 <code>String</code> - アプリケーションの <code>package.json</code> ファイルで名前として設定された現在のアプリケーション名。</p>\n<p>通常、<code>package.json</code> の <code>name</code> フィールドは、npm のモジュール仕様に基づいて小文字だけの短い名前が設定されます。 通常、すべて大文字で始まるアプリケーションの名前となる <code>productName</code> フィールドも指定してください。Electronによって、<code>name</code> よりも優先されます。</p>\n<h3 id=\"appsetnamename\"><a href=\"#appsetnamename\"><code>app.setName(name)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n</ul>\n<p>現在のアプリケーションの名前を上書きします。</p>\n<p><strong>注釈:</strong> この関数は、Electron 内で使用する名前を上書きします。OS が使用する名前には影響しません。</p>\n<h3 id=\"appgetlocale\"><a href=\"#appgetlocale\"><code>app.getLocale()</code></a></h3>\n<p>戻り値 <code>String</code> - 現在のアプリケーションのロケールで、Chromium の <code>l10n_util</code> ライブラリを用いて取得されます。 取りうる戻り値については <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:ui/base/l10n/l10n_util.cc\">こちら</a> にドキュメントがあります。</p>\n<p>ロケールを設定するには、アプリケーションの起動時にコマンドラインスイッチを使用する必要があります。これについては、<a href=\"/docs/api/command-line-switches\">こちら</a> を参照してください。</p>\n<p><strong>注:</strong> アプリをパッケージ化して配布する場合、<code>locales</code> フォルダを同梱する必要があります。</p>\n<p><strong>Note:</strong>Windows の <code>準備ができて</code> のイベントが出力される後を呼び出すことがあります。</p>\n<h3 id=\"appgetlocalecountrycode\"><a href=\"#appgetlocalecountrycode\"><code>app.getLocaleCountryCode()</code></a></h3>\n<p>戻り値 <code>String</code> - 2 文字の <a href=\"https://www.iso.org/iso-3166-country-codes.html\">ISO 3166</a> 国名コードで、ユーザーの OS のロケールを示します。 この値はネイティブの OS API から取得します。</p>\n<p><strong>注意:</strong> ロケールの国コードを取得できなかった場合、これは空文字列を返します。</p>\n<h3 id=\"appaddrecentdocumentpath-macos-windows\"><a href=\"#appaddrecentdocumentpath-macos-windows\"><code>app.addRecentDocument(path)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p><code>path</code> を最近使ったドキュメントのリストに追加します。</p>\n<p>このリストは OS が管理します。 Windows の場合はタスクバーからリストにアクセスでき、macOS の場合は Dock メニューからリストにアクセスできます。</p>\n<h3 id=\"appclearrecentdocuments-macos-windows\"><a href=\"#appclearrecentdocuments-macos-windows\"><code>app.clearRecentDocuments()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>最近使ったドキュメントのリストをクリアします。</p>\n<h3 id=\"appsetasdefaultprotocolclientprotocol-path-args\"><a href=\"#appsetasdefaultprotocolclientprotocol-path-args\"><code>app.setAsDefaultProtocolClient(protocol[, path, args])</code></a></h3>\n<ul>\n<li><code>protocol</code> String - <code>://</code> を除くプロトコルの名前。 例えば、アプリで <code>electron://</code> リンクを処理したい場合、引数を <code>electron</code> にしてこのメソッドを呼び出してください。</li>\n<li><code>path</code> String (任意) <em>Windows</em> - Electron 実行形式へのパス。 省略値は <code>process.execPath</code> です。</li>\n<li><code>args</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> <em>Windows</em> - 実行形式に渡す引数。 省略値は空の配列です。</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - 呼び出しが成功したかどうか。</p>\n<p>このメソッドは現在の実行形式をプロトコル (または URI スキーム) の既定のハンドラーとして設定します。 これにより、アプリをオペレーティングシステムと密接に統合できます。 登録すると、<code>プロトコル://</code> によるすべてのリンクは現在の実行形式で開かれるようになります。 プロトコルを含むリンク全体が、アプリケーションに引数として渡されます。</p>\n<p><strong>注:</strong> macOS の場合はアプリの <code>info.plist</code> に追加されているプロトコルしか登録できず、実行時に変更できません。 しかし、<a href=\"https://www.electronforge.io/\">Electron Forge</a> や <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a> を介するかテキストエディタで <code>info.plist</code> を編集することで、ビルド時にファイルを変更できます。 詳細は <a href=\"https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102207-TPXREF115\">Apple社のドキュメント</a> を参照するようにしてください。</p>\n<p><strong>注釈:</strong> Windows ストア 環境 (<code>appx</code> としてパッケージされている) 場合、この API はすべての呼び出しに <code>true</code> を返しますが、それにセットされたレジストリキーは他のアプリケーションからアクセスできません。  Windows ストア アプリケーションをデフォルトのプロトコルハンドラとして登録するには、<a href=\"https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol\">マニフェストでプロトコルを宣言する</a> 必要があります。</p>\n<p>この API は内部的に Windows レジストリ や <code>LSSetDefaultHandlerForURLScheme</code> を使用します。</p>\n<h3 id=\"appremoveasdefaultprotocolclientprotocol-path-args-macos-windows\"><a href=\"#appremoveasdefaultprotocolclientprotocol-path-args-macos-windows\"><code>app.removeAsDefaultProtocolClient(protocol[, path, args])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>protocol</code> String - <code>://</code> を除くプロトコルの名前。</li>\n<li><code>path</code> String (任意) <em>Windows</em> - 省略値は <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> <em>Windows</em> - 省略値は空の配列</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - 呼び出しが成功したかどうか。</p>\n<p>このメソッドは、現在の実行ファイルがプロトコル (または URI スキーム) のデフォルトハンドラであるかどうかをチェックします。 その場合、既定のハンドラーからアプリを削除します。</p>\n<h3 id=\"appisdefaultprotocolclientprotocol-path-args\"><a href=\"#appisdefaultprotocolclientprotocol-path-args\"><code>app.isDefaultProtocolClient(protocol[, path, args])</code></a></h3>\n<ul>\n<li><code>protocol</code> String - <code>://</code> を除くプロトコルの名前。</li>\n<li><code>path</code> String (任意) <em>Windows</em> - 省略値は <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> <em>Windows</em> - 省略値は空の配列</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - 現在の実行形式がプロトコル (または URI スキーム) の既定のハンドラーかどうか。</p>\n<p><strong>注:</strong> macOSの場合、このメソッドは、アプリがプロトコルの既定のハンドラーとして登録されていたかをチェックするのに使えます。 macOSのマシン上の <code>~/Library/Preferences/com.apple.LaunchServices.plist</code> を確認することでもこれを検証することができます。 詳細は <a href=\"https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme\">Apple社のドキュメント</a> を参照するようにしてください。</p>\n<p>この API は内部的に Windows レジストリ や <code>LSCopyDefaultHandlerForURLScheme</code> を使用します。</p>\n<h3 id=\"appgetapplicationnameforprotocolurl\"><a href=\"#appgetapplicationnameforprotocolurl\"><code>app.getApplicationNameForProtocol(url)</code></a></h3>\n<ul>\n<li><code>url</code> String - 確認するプロトコル名が付いた URL。 類似の他メソッドとは異なり、少なくとも <code>://</code> までを含む URL 全体を受け付けます (例: <code>https://</code>)。</li>\n</ul>\n<p>戻り値 <code>String</code> - そのプロトコルを処理するアプリケーションの名前。ハンドラーがない場合は空の文字列です。 たとえば、Electron がその URL のデフォルトハンドラーである場合、Windows と Mac では <code>Electron</code> になります。 ただし、厳密な形式に依存しないでください。変更されている可能性があります。 Linux では、<code>.desktop</code> 接尾子を付けた別の形式が必要でしょう。</p>\n<p>このメソッドは、URL のプロトコル (別名 URI スキーム) のデフォルトハンドラーであるアプリケーション名を返します。</p>\n<h3 id=\"appgetapplicationinfoforprotocolurl-macos-windows\"><a href=\"#appgetapplicationinfoforprotocolurl-macos-windows\"><code>app.getApplicationInfoForProtocol(url)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>url</code> String - 確認するプロトコル名が付いた URL。 類似の他メソッドとは異なり、少なくとも <code>://</code> までを含む URL 全体を受け付けます (例: <code>https://</code>)。</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;Object></code> - 以下を含むオブジェクトで実行されます。</p>\n<ul>\n<li><code>icon</code> NativeImage - プロトコルを処理するアプリの表示アイコン。</li>\n<li><code>path</code> String - プロトコルを扱うアプリのインストールパス。</li>\n<li><code>name</code> String - プロトコルを扱うアプリの表示名。</li>\n</ul>\n<p>このメソッドは、URL のプロトコル (別名 URI スキーム) のデフォルトハンドラーであるアプリケーション名、アイコン、パスを含むPromiseを返します。</p>\n<h3 id=\"appsetusertaskstasks-windows\"><a href=\"#appsetusertaskstasks-windows\"><code>app.setUserTasks(tasks)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>tasks</code> <a href=\"/docs/api/structures/task\">Task[]</a> - <code>Task</code> オブジェクトの配列</li>\n</ul>\n<p><code>tasks</code> を Windows でのジャンプリストの <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks\">タスク</a> カテゴリに追加します。</p>\n<p><code>tasks</code> は <a href=\"/docs/api/structures/task\"><code>Task</code></a> オブジェクトの配列です。</p>\n<p>戻り値 <code>Boolean</code> - 呼び出しが成功したかどうか。</p>\n<p><strong>注:</strong> ジャンプリストをもっとカスタマイズしたい場合は、<code>app.setJumpList(categories)</code> を代わりに使用してください。</p>\n<h3 id=\"appgetjumplistsettings-windows\"><a href=\"#appgetjumplistsettings-windows\"><code>app.getJumpListSettings()</code> <em>Windows</em></a></h3>\n<p>戻り値 <code>Object</code>:</p>\n<ul>\n<li><code>minItems</code> Integer - ジャンプリストに表示されるアイテムの最小の数 (この値の詳細な説明は <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx\">MSDN ドキュメント</a> を参照してください) 。</li>\n<li><code>removedItems</code> <a href=\"/docs/api/structures/jump-list-item\">JumpListItem[]</a> - ユーザが、ジャンプリストのカスタムカテゴリから明示的に削除したアイテムに対応した、<code>JumpListItem</code> オブジェクトの配列。 これらのアイテムを<strong>直後の</strong> <code>app.setJumpList()</code> の呼び出しでジャンプリストに再度追加してはいけません。Windowsは削除されたアイテムを含むいかなるカスタムカテゴリも表示することはできません。</li>\n</ul>\n<h3 id=\"appsetjumplistcategories-windows\"><a href=\"#appsetjumplistcategories-windows\"><code>app.setJumpList(categories)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>categories</code> <a href=\"/docs/api/structures/jump-list-category\">JumpListCategory[]</a> | <code>null</code> - <code>JumpListCategory</code> オブジェクトの配列。</li>\n</ul>\n<p>アプリケーションのカスタムジャンプリストを設定もしくは削除し、以下の文字列のいずれかを返します。</p>\n<ul>\n<li><code>ok</code> - 正常。</li>\n<li><code>error</code> - 1つ以上のエラーが発生しました。何が原因かを把握するためには、実行時ログを有効にします。</li>\n<li><code>invalidSeparatorError</code> - ジャンプリストのカスタムカテゴリに区切りを追加しようとしました。 区切りは標準の <code>タスク</code> カテゴリでしか使用できません。</li>\n<li><code>fileTypeRegistrationError</code> - アプリが処理できると登録されていないファイルタイプのファイルリンクをジャンプリストに追加しようとしました。</li>\n<li><code>customCategoryAccessDeniedError</code> - ユーザープライバシーもしくはグループポリシー設定のため、ジャンプリストにカスタムカテゴリを追加できません。</li>\n</ul>\n<p><code>categories</code> が <code>null</code> の場合、その前に設定されていたカスタムジャンプリスト (あれば) は、(Windowsによって管理される) アプリ標準のジャンプリストに置換されます。</p>\n<p><strong>注:</strong> <code>JumpListCategory</code> オブジェクトに <code>type</code> プロパティも <code>name</code> プロパティも設定されなかった場合、<code>type</code> は <code>tasks</code> と見做されます。 <code>name</code> プロパティは設定されている一方で <code>type</code> プロパティが省略された場合、<code>type</code> は <code>custom</code> と見做されます。</p>\n<p><strong>注:</strong> ユーザはカスタムカテゴリからアイテムを削除できますが、Windows では次の <code>app.setJumpList(categories)</code> の呼び出しが成功した <strong>後</strong> でないと、削除されたアイテムをカスタムカテゴリに追加し直すことができません。 それより早くカスタムカテゴリに削除されたアイテムを再度追加しようとすると、ジャンプリストからカスタムカテゴリ全体が外れてしまいます。 削除されたアイテムのリストは、<code>app.getJumpListSettings()</code> を使って取得できます。</p>\n<p><strong>注:</strong> ジャンプリストのアイテムの <code>description</code> プロパティは最大長は 260 文字です。 この制限を超えると、アイテムはジャンプリストに追加されず、表示されません。</p>\n<p>カスタムジャンプリストを作成する非常に簡単な例は以下の通りです。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setJumpList([\n  {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'custom'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'最近開いたプロジェクト'</span>,\n    <span class=\"hljs-attr\">items</span>: [\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'file'</span>, <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'C:\\\\Projects\\\\project1.proj'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'file'</span>, <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'C:\\\\Projects\\\\project2.proj'</span> }\n    ]\n  },\n  { <span class=\"hljs-comment\">// 名前があるため `type` は \"custom\" になります</span>\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'ツール'</span>,\n    <span class=\"hljs-attr\">items</span>: [\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'ツール A'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--run-tool-a'</span>,\n        <span class=\"hljs-attr\">icon</span>: process.execPath,\n        <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'ツール A を実行する'</span>\n      },\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'ツール B'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--run-tool-b'</span>,\n        <span class=\"hljs-attr\">icon</span>: process.execPath,\n        <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'ツール B を実行する'</span>\n      }\n    ]\n  },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'frequent'</span> },\n  { <span class=\"hljs-comment\">// 名前がないため `type` は \"tasks\" になります</span>\n    <span class=\"hljs-attr\">items</span>: [\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'新規プロジェクト'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--new-project'</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'新規プロジェクトを作成します。'</span>\n      },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'プロジェクトの復元'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--recover-project'</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'プロジェクトを復元します。'</span>\n      }\n    ]\n  }\n])\n</code></pre>\n<h3 id=\"apprequestsingleinstancelock\"><a href=\"#apprequestsingleinstancelock\"><code>app.requestSingleInstanceLock()</code></a></h3>\n<p>戻り値 <code>Boolean</code></p>\n<p>このメソッドの戻り値は、アプリケーションのこのインスタンスのロックが成功したかどうかを表します。  ロック状態にできなかった場合、アプリケーションの他のインスタンスが既にロックされており、ただちに終了すると想定できます。</p>\n<p>つまり、 このメソッドは、プロセスがアプリケーションの 1 つ目のインスタンスで、アプリがロード処理を続行する必要がある場合に <code>true</code> を返します。  既にロック状態にしたものとは別のインスタンスにパラメータを送信したためプロセスが直ちに終了する必要がある場合は、<code>false</code> を返します。</p>\n<p>macOSの場合、ユーザがFinderでアプリの2番目のインスタンスを開こうとしたとき、システムは自動的にシングルインスタンスになるようにし、<code>open-file</code> と <code>open-url</code> イベントが発生します。 ただし、ユーザがアプリをコマンドラインで開始する場合、シングルインスタンスを強制するシステムの仕組みが迂回されるため、シングルインスタンスであることを保証するには、このメソッドを使う必要があります。</p>\n<p>2番目のインスタンスが開始されたとき、1番目のインスタンスのウインドウをアクティブにする例:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> myWindow = <span class=\"hljs-literal\">null</span>\n\n<span class=\"hljs-keyword\">const</span> gotTheLock = app.requestSingleInstanceLock()\n\n<span class=\"hljs-keyword\">if</span> (!gotTheLock) {\n  app.quit()\n} <span class=\"hljs-keyword\">else</span> {\n  app.on(<span class=\"hljs-string\">'second-instance'</span>, (event, commandLine, workingDirectory) => {\n    <span class=\"hljs-comment\">// 誰かが2つ目のインスタンスを実行したとき、このウィンドウにフォーカスします。</span>\n    <span class=\"hljs-keyword\">if</span> (myWindow) {\n      <span class=\"hljs-keyword\">if</span> (myWindow.isMinimized()) myWindow.restore()\n      myWindow.focus()\n    }\n  })\n\n  <span class=\"hljs-comment\">// myWindow を作成したり、アプリの残りをロードしたり、...</span>\n  app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    myWindow = createWindow()\n  })\n}\n</code></pre>\n<h3 id=\"apphassingleinstancelock\"><a href=\"#apphassingleinstancelock\"><code>app.hasSingleInstanceLock()</code></a></h3>\n<p>戻り値 <code>Boolean</code></p>\n<p>このメソッドはアプリのこのインスタンスが現在シングルインスタンスロックをされているかどうかを返します。  <code>app.requestSingleInstanceLock()</code> でロックを要求し、<code>app.releaseSingleInstanceLock()</code> で解放できます。</p>\n<h3 id=\"appreleasesingleinstancelock\"><a href=\"#appreleasesingleinstancelock\"><code>app.releaseSingleInstanceLock()</code></a></h3>\n<p><code>requestSingleInstanceLock</code> によって作成されたすべてのロックを解放します。 これにより、並列実行するための複数インスタンスのアプリケーションが再び許可されます。</p>\n<h3 id=\"appsetuseractivitytype-userinfo-webpageurl-macos\"><a href=\"#appsetuseractivitytype-userinfo-webpageurl-macos\"><code>app.setUserActivity(type, userInfo[, webpageURL])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>type</code> String - アクティビティを一意に識別します。 <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a> と対応しています。</li>\n<li><code>userInfo</code> any - 別のデバイスで使用するために保存されたアプリ固有の情報。</li>\n<li><code>webpageURL</code> String (任意) - 継続されたデバイスに適切なアプリがインストールされていない場合にブラウザで読み込もうとしたウェブページ。 スキームは <code>http</code> もしくは <code>https</code> でなければなりません。</li>\n</ul>\n<p><code>NSUserActivity</code> を作成し、現在のアクティビティとして設定します。 そのアクティビティは後に別のデバイスでの <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">ハンドオフ</a> に適用されます。</p>\n<h3 id=\"appgetcurrentactivitytype-macos\"><a href=\"#appgetcurrentactivitytype-macos\"><code>app.getCurrentActivityType()</code> <em>macOS</em></a></h3>\n<p>戻り値 <code>String</code> - 現在実行されているアクティビティのタイプ。</p>\n<h3 id=\"appinvalidatecurrentactivity-macos\"><a href=\"#appinvalidatecurrentactivity-macos\"><code>app.invalidateCurrentActivity()</code> <em>macOS</em></a></h3>\n<p>現在の <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">ハンドオフ</a> ユーザアクティビティを無効にします。</p>\n<h3 id=\"appresigncurrentactivity-macos\"><a href=\"#appresigncurrentactivity-macos\"><code>app.resignCurrentActivity()</code> <em>macOS</em></a></h3>\n<p>現在の <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">ハンドオフ</a> ユーザーアクティビティを、無効にせずに不活性化します。</p>\n<h3 id=\"appupdatecurrentactivitytype-userinfo-macos\"><a href=\"#appupdatecurrentactivitytype-userinfo-macos\"><code>app.updateCurrentActivity(type, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>type</code> String - アクティビティを一意に識別します。 <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a> と対応しています。</li>\n<li><code>userInfo</code> any - 別のデバイスで使用するために保存されたアプリ固有の情報。</li>\n</ul>\n<p>タイプが <code>type</code> と一致した場合、現在のアクティビティを更新し、現在の <code>userInfo</code> ディスクショナリに <code>userInfo</code> のエントリを統合します。</p>\n<h3 id=\"appsetappusermodelidid-windows\"><a href=\"#appsetappusermodelidid-windows\"><code>app.setAppUserModelId(id)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>id</code> String</li>\n</ul>\n<p><a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">アプリケーションユーザモデル ID</a> を <code>id</code> に変更します。</p>\n<h3 id=\"appsetactivationpolicypolicy-macos\"><a href=\"#appsetactivationpolicypolicy-macos\"><code>app.setActivationPolicy(policy)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>policy</code> String - 'regular', 'accessory', 'formited' のいずれか。</li>\n</ul>\n<p>アプリのアクティベーションポリシーを設定します。</p>\n<p>アクティベーションポリシーの種類:</p>\n<ul>\n<li>'regular' - アプリケーションはDockに表示される通常のアプリで、ユーザーインターフェイスを持っている可能性があります。</li>\n<li>'accessory' - このアプリケーションはドックに表示されませんし、メニューバーも持ちません。プログラムまたはウィンドウの1つをクリックすることでアクティベートできます。</li>\n<li>'prohibited' - アプリケーションはドックに表示できないし、ウィンドウを作成できないし、アクティベートできません。</li>\n</ul>\n<h3 id=\"appimportcertificateoptions-callback-linux\"><a href=\"#appimportcertificateoptions-callback-linux\"><code>app.importCertificate(options, callback)</code> <em>Linux</em></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>certificate</code> String - PACS#12ファイルのパス。</li>\n<li><code>password</code> String - 証明書のパスフレーズ。</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>result</code> Integer - インポート結果。</li>\n</ul></li>\n</ul>\n<p>プラットフォームの証明書ストアにPACS#12形式で証明書をインポートします。 インポート操作の <code>result</code> で <code>callback</code> が呼び出されます。<code>0</code> という値は成功を意味しますが、その他の値はChromium の <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">net_error_list</a> の通り、失敗を意味します。</p>\n<h3 id=\"appconfigurehostresolveroptions\"><a href=\"#appconfigurehostresolveroptions\"><code>app.configureHostResolver(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>enableBuiltInResolver</code> Boolean (任意) - getaddrinfo ではなく組み込みのホストリゾルバを使用するかどうか。 有効にすると、組み込みリゾルバはシステムの DNS 設定を使用し、単体で DNS ルックアップを実行しようとします。 macOS ではデフォルトで有効、Windows と Linux ではデフォルトで無効になっています。</li>\n<li><code>secureDnsMode</code> String (任意) - \"off\"、\"automatic\"、\"secure\" のいずれかにできます。 DNS-over-HTTP モードを設定します。 \"off\" の場合、DoH ルックアップは行われません。 \"automatic\" の場合、DoH が利用可能であれば DoH ルックアップが最初に実行され、安全でない DNS 検索がフォールバックとして実行されます。 \"secure\" の場合、DoH ルックアップのみが行われます。 既定値は \"automatic\" です。</li>\n<li><code>secureDnsServers</code> String[] (任意) - DNS-over-HTTP サーバのテンプレートのリスト。 テンプレートのフォーマットについては、<a href=\"https://datatracker.ietf.org/doc/html/rfc8484#section-3\">RFC8484 § 3</a> をご参照ください。 ほとんどのサーバーは POST メソッドをサポートしており、そういったサーバーのテンプレートは単なる URI です。 なお、<a href=\"https://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&#x26;ss=chromium%2Fchromium%2Fsrc\">一部のDNSプロバイダ</a> では、このリストに DoH サーバーが提供されていなくても、DoH が明示的に無効化されていない限りリゾルバを自動的に DoH へアップグレードします。</li>\n<li><code>enableAdditionalDnsQueryTypes</code> Boolean (任意) - 安全でない DNS 経由でリクエストが行われた場合に、従来の A および AAAA のクエリに加えて HTTPS (DNS タイプ 65) などの追加の DNS クエリタイプを許可するかどうかを制御します。 追加タイプを常に許可するセキュア DNS には影響しません。 省略値は true です。</li>\n</ul></li>\n</ul>\n<p>ホスト解決 (DNS と DNS-over-HTTPS) を設定します。 デフォルトでは、以下のリゾルバがこの順番で使用されます。</p>\n<ol>\n<li>DNS-over-HTTPS、<a href=\"https://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&#x26;ss=chromium%2Fchromium%2Fsrc\">DNS プロバイダがサポートしている</a> 場合</li>\n<li>組み込みリゾルバ (macOS のみデフォルトで有効)</li>\n<li>システムのリゾルバ (<code>getaddrinfo</code> など)</li>\n</ol>\n<p>これは、暗号化されていない DNS の使用を制限する (<code>secureDnsMode: \"secure\"</code>) か、DNS-over-HTTPS を無効にする (<code>secureDnsMode: \"off\"</code>) ように設定できます。 また、組み込みリゾルバの有効化または無効化もできます。</p>\n<p>安全でない DNS を無効にするには、 <code>secureDnsMode</code> に <code>\"secure\"</code> を指定します。 その場合、ユーザーの DNS 設定に DoH をサポートするプロバイダが無い場合に備えて、使用する DNS-over-HTTPS サーバのリストを提供しなければなりません。</p>\n<pre><code class=\"hljs language-js\">app.configureHostResolver({\n  <span class=\"hljs-attr\">secureDnsMode</span>: <span class=\"hljs-string\">'secure'</span>,\n  <span class=\"hljs-attr\">secureDnsServers</span>: [\n    <span class=\"hljs-string\">'https://cloudflare-dns.com/dns-query'</span>\n  ]\n})\n</code></pre>\n<p>この API は <code>ready</code> イベントが発生した後で呼ばなければいけません。</p>\n<h3 id=\"appdisablehardwareacceleration\"><a href=\"#appdisablehardwareacceleration\"><code>app.disableHardwareAcceleration()</code></a></h3>\n<p>現在のアプリのハードウェアアクセラレーションを無効にします。</p>\n<p>このメソッドはアプリが ready になる前だけでしか呼び出すことができません。</p>\n<h3 id=\"appdisabledomainblockingfor3dapis\"><a href=\"#appdisabledomainblockingfor3dapis\"><code>app.disableDomainBlockingFor3DAPIs()</code></a></h3>\n<p>既定では、GPU プロセスがあまりに頻繁にクラッシュする場合、ドメイン単位の原則に基づき、再起動するまで Chromium は 3D API (例えばWebGL) を無効にします。 この関数はこの振る舞いを無効にします。</p>\n<p>このメソッドはアプリが ready になる前だけでしか呼び出すことができません。</p>\n<h3 id=\"appgetappmetrics\"><a href=\"#appgetappmetrics\"><code>app.getAppMetrics()</code></a></h3>\n<p>戻り値 <a href=\"/docs/api/structures/process-metric\"><code>ProcessMetric[]</code></a>: <code>ProcessMetric</code> オブジェクトの配列で、アプリに関連付けられたすべてのプロセスのメモリや CPU 使用率の統計情報に対応しています。</p>\n<h3 id=\"appgetgpufeaturestatus\"><a href=\"#appgetgpufeaturestatus\"><code>app.getGPUFeatureStatus()</code></a></h3>\n<p>戻り値 <a href=\"/docs/api/structures/gpu-feature-status\"><code>GPUFeatureStatus</code></a> - <code>chrome://gpu/</code> から取得したグラフィックス機能のステータス。</p>\n<p><strong>注:</strong> この情報は <code>gpu-info-update</code> イベントが発行された後にのみ利用できます。</p>\n<h3 id=\"appgetgpuinfoinfotype\"><a href=\"#appgetgpuinfoinfotype\"><code>app.getGPUInfo(infoType)</code></a></h3>\n<ul>\n<li><code>infoType</code> String - <code>basic</code> か <code>complete</code> にできます。</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;unknown></code></p>\n<p><code>infoType</code> が <code>complete</code> に等しい場合、Promise は <a href=\"https://chromium.googlesource.com/chromium/src/+/4178e190e9da409b055e5dff469911ec6f6b716f/gpu/config/gpu_info.cc\">Chromium の GPUInfo オブジェクト</a> 内におけるすべてのGPU情報を含んだ <code>Object</code> で解決されます。 これには <code>chrome://gpu</code> ページ上で表示されるバージョンとドライバ情報が含まれます。</p>\n<p><code>infoType</code> が <code>basic</code> に等しい場合、Promise は <code>complete</code> でのGPU情報より少ない属性を含んだ <code>Object</code> で解決されます。 basic の応答の例はこちらです。</p>\n<pre><code class=\"hljs language-js\">{\n  <span class=\"hljs-attr\">auxAttributes</span>:\n   {\n     <span class=\"hljs-attr\">amdSwitchable</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">canSupportThreadedTextureMailbox</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">directComposition</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">directRendering</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">glResetNotificationStrategy</span>: <span class=\"hljs-number\">0</span>,\n     <span class=\"hljs-attr\">inProcessGpu</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">initializationTime</span>: <span class=\"hljs-number\">0</span>,\n     <span class=\"hljs-attr\">jpegDecodeAcceleratorSupported</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">optimus</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">passthroughCmdDecoder</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">sandboxed</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">softwareRendering</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">supportsOverlays</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">videoDecodeAcceleratorFlags</span>: <span class=\"hljs-number\">0</span>\n   },\n  <span class=\"hljs-attr\">gpuDevice</span>:\n   [{ <span class=\"hljs-attr\">active</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">deviceId</span>: <span class=\"hljs-number\">26657</span>, <span class=\"hljs-attr\">vendorId</span>: <span class=\"hljs-number\">4098</span> },\n     { <span class=\"hljs-attr\">active</span>: <span class=\"hljs-literal\">false</span>, <span class=\"hljs-attr\">deviceId</span>: <span class=\"hljs-number\">3366</span>, <span class=\"hljs-attr\">vendorId</span>: <span class=\"hljs-number\">32902</span> }],\n  <span class=\"hljs-attr\">machineModelName</span>: <span class=\"hljs-string\">'MacBookPro'</span>,\n  <span class=\"hljs-attr\">machineModelVersion</span>: <span class=\"hljs-string\">'11.5'</span>\n}\n</code></pre>\n<p><code>vendorId</code> や <code>driverId</code> のような基本的な情報だけ必要であれば、<code>basic</code> を用いることが好ましいです。</p>\n<h3 id=\"appsetbadgecountcount-linux-macos\"><a href=\"#appsetbadgecountcount-linux-macos\"><code>app.setBadgeCount([count])</code> <em>Linux</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>count</code> Integer (任意) - 値が指定されている場合は、指定された値のバッジを設定します。そうでない場合、macOS では無地の白点 (通知数不明などの意味) を表示します。 Linux で値を指定しない場合、バッジは表示されません。</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - 呼び出しが成功したかどうか。</p>\n<p>現在のアプリのカウンターバッジを設定します。 カウントを <code>0</code> に設定すると、バッジを非表示にします。</p>\n<p>macOS では Dock アイコンに表示されます。 Linux では Unity ランチャーでのみ動作します。</p>\n<p><strong>注意:</strong> Unity ランチャーは動作にあたって <code>.desktop</code> ファイルを必要とします。 詳しい情報は、<a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Unity 統合ドキュメント</a> をご覧ください。</p>\n<h3 id=\"appgetbadgecount-linux-macos\"><a href=\"#appgetbadgecount-linux-macos\"><code>app.getBadgeCount()</code> <em>Linux</em> <em>macOS</em></a></h3>\n<p>戻り値 <code>Integer</code> - カウンターバッジに表示されている現在の値。</p>\n<h3 id=\"appisunityrunning-linux\"><a href=\"#appisunityrunning-linux\"><code>app.isUnityRunning()</code> <em>Linux</em></a></h3>\n<p>戻り値 <code>Boolean</code> - 現在のデスクトップ環境がUnityランチャーであるかどうか。</p>\n<h3 id=\"appgetloginitemsettingsoptions-macos-windows\"><a href=\"#appgetloginitemsettingsoptions-macos-windows\"><code>app.getLoginItemSettings([options])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>options</code> Object (任意)<ul>\n<li><code>path</code> String (任意) <em>Windows</em> - 比較対象となる実行パス。 省略値は <code>process.execPath</code> です。</li>\n<li><code>args</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> <em>Windows</em> - 比較するコマンドライン引数。 省略値は空の配列です。</li>\n</ul></li>\n</ul>\n<p><code>app.setLoginItemSettings</code> に <code>path</code> と <code>args</code> オプションを指定した場合、<code>openAtLogin</code> が正しく設定されるように、ここで同じ引数を引き渡す必要があります。</p>\n<p>戻り値 <code>Object</code>:</p>\n<ul>\n<li><code>openAtLogin</code> Boolean - アプリがログイン時に開くように設定されている場合、<code>true</code>。</li>\n<li><code>openAsHidden</code> Boolean <em>macOS</em> - アプリがログイン時に隠して開くように設定されている場合 <code>true</code> です。 この設定は <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS ビルド</a> では利用できません。</li>\n<li><code>wasOpenedAtLogin</code> Boolean <em>macOS</em> - アプリがログイン時に自動的に開かれた場合 <code>true</code> です。 この設定は <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS ビルド</a> では利用できません。</li>\n<li><code>wasOpenedAsHidden</code> Boolean <em>macOS</em> - アプリが非表示のログイン項目として開かれていた場合 <code>true</code> です。 これは、アプリが起動時に何もウインドウを開いてはいけないことを示します。 この設定は <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS ビルド</a> では利用できません。</li>\n<li><code>restoreState</code> Boolean <em>macOS</em> - 以前のセッションから状態を復元する必要があるログイン項目としてアプリを開いた場合 <code>true</code> です。 アプリが最後に閉じたとき開いていたウインドウをアプリが復元する必要があることを示します。 この設定は <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS ビルド</a> では利用できません。</li>\n<li><code>executableWillLaunchAtLogin</code> Boolean <em>Windows</em> - <code>true</code> アプリはログイン時に開くように設定されており、その実行キーが無効化されていない場合。 <code>openAtLogin</code>は<code>args</code> オプションを無視する点が異なっています。与えられた実行ファイルがログイン時<strong>なんらか</strong>の引数が与えれた場合にこのプロパティは 真 になります。</li>\n<li><code>launchItems</code> Object[] <em>Windows</em><ul>\n<li><code>name</code> String <em>Windows</em> - レジストリエントリの名前の値。</li>\n<li><code>path</code> String <em>Windows</em> - レジストリエントリに対応するアプリの実行可能ファイル。</li>\n<li><code>args</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> <em>Windows</em> - 実行ファイルに渡すコマンドライン引数。</li>\n<li><code>scope</code> String <em>Windows</em> - <code>user</code> または <code>machine</code> のどちらか。 レジストリエントリが <code>HKEY_CURRENT USER</code> または <code>HKEY_LOCAL_MACHINE</code> の下にあるかどうかを示します。</li>\n<li><code>enabled</code> Boolean <em>Windows</em> - 次の場合<code>true</code>になります。アプリレジストリキーが承認されているため、タスクマネージャと Windows 設定で <code>enabled</code> として表示されている場合。</li>\n</ul></li>\n</ul>\n<h3 id=\"appsetloginitemsettingssettings-macos-windows\"><a href=\"#appsetloginitemsettingssettings-macos-windows\"><code>app.setLoginItemSettings(settings)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>settings</code> Object<ul>\n<li><code>openAtLogin</code> Boolean (任意) - アプリをログイン時に開く場合は <code>true</code>、ログイン項目からアプリを外す場合は <code>false</code> にします。 省略値は <code>false</code> 。</li>\n<li><code>openAsHidden</code> Boolean (任意) <em>macOS</em> - アプリを非表示で開く場合 <code>true</code> にします。 省略値は <code>false</code> です。 ユーザはこの設定をシステム環境設定から変更することができるので、現在の値を取得するために <code>app.getLoginItemSettings().wasOpenedAsHidden</code> をアプリが開かれたときに確認するようにしてください。 この設定は <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS ビルド</a> では利用できません。</li>\n<li><code>path</code> String (任意) <em>Windows</em> - ログイン時に起動する実行形式。 省略値は <code>process.execPath</code> です。</li>\n<li><code>args</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> <em>Windows</em> - 実行ファイルに渡すコマンドライン引数。 省略値は空の配列です。 パスはテンプレート文字列にするようにしましょう。</li>\n<li><code>enabled</code> Boolean (任意) <em>Windows</em> - <code>true</code> の場合、スタートアップが承認したレジストリキーを変更し、 <code>タスクマネージャと Windows 設定で</code> アプリを有効/無効にします。 省略値は <code>true</code> です。</li>\n<li><code>name</code> String (任意) <em>Windows</em> - レジストリに書きこむ値の名前。 デフォルトはアプリの AppUserModelId() です。 アプリのログイン項目設定を設定します。</li>\n</ul></li>\n</ul>\n<p>Windows 上で Electron の <code>autoUpdater</code> を <a href=\"https://github.com/Squirrel/Squirrel.Windows\">Squirrel</a> を使って動かす場合、起動パスを Update.exe に設定し、渡す引数にアプリケーション名を指定してください。 以下がその例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> appFolder = path.dirname(process.execPath)\n<span class=\"hljs-keyword\">const</span> updateExe = path.resolve(appFolder, <span class=\"hljs-string\">'..'</span>, <span class=\"hljs-string\">'Update.exe'</span>)\n<span class=\"hljs-keyword\">const</span> exeName = path.basename(process.execPath)\n\napp.setLoginItemSettings({\n  <span class=\"hljs-attr\">openAtLogin</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">path</span>: updateExe,\n  <span class=\"hljs-attr\">args</span>: [\n    <span class=\"hljs-string\">'--processStart'</span>, <span class=\"hljs-string\">`\"<span class=\"hljs-subst\">${exeName}</span>\"`</span>,\n    <span class=\"hljs-string\">'--process-start-args'</span>, <span class=\"hljs-string\">`\"--hidden\"`</span>\n  ]\n})\n</code></pre>\n<h3 id=\"appisaccessibilitysupportenabled-macos-windows\"><a href=\"#appisaccessibilitysupportenabled-macos-windows\"><code>app.isAccessibilitySupportEnabled()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>戻り値 <code>Boolean</code> - Chromeのユーザ補助機能が有効な場合、<code>true</code>、そうでない場合、<code>false</code>。 このAPIは、スクリーンリーダーなどの支援技術を使っていることが検出された場合、<code>true</code> を返します。 詳細については、<a href=\"https://www.chromium.org/developers/design-documents/accessibility\">https://www.chromium.org/developers/design-documents/accessibility</a> を参照してください。</p>\n<h3 id=\"appsetaccessibilitysupportenabledenabled-macos-windows\"><a href=\"#appsetaccessibilitysupportenabledenabled-macos-windows\"><code>app.setAccessibilitySupportEnabled(enabled)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>enabled</code> Boolean - <a href=\"https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree\">アクセシビリティツリー</a>レンダリングを有効もしくは無効にします。</li>\n</ul>\n<p>手動でChromeのユーザ補助機能を有効にすると、アプリケーションの設定でユーザにアクセシビリティスイッチを出すことができます。 詳細については <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">Chromium のアクセシビリティドキュメント</a> を参照してください。 既定では無効です。</p>\n<p>この API は <code>ready</code> イベントが発生した後で呼ばなければいけません。</p>\n<p><strong>注:</strong> アクセシビリティツリーをレンダリングすると、アプリのパフォーマンスに顕著な影響を与える可能性があります。 既定で有効にすべきではありません。</p>\n<h3 id=\"appshowaboutpanel\"><a href=\"#appshowaboutpanel\"><code>app.showAboutPanel()</code></a></h3>\n<p>アプリの About パネルを表示します。 このオプションは <code>app.setAboutPanelOptions(options)</code>で上書きできます。</p>\n<h3 id=\"appsetaboutpaneloptionsoptions\"><a href=\"#appsetaboutpaneloptionsoptions\"><code>app.setAboutPanelOptions(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>applicationName</code> String (任意) - アプリの名前。</li>\n<li><code>applicationVersion</code> String (任意) - アプリのバージョン。</li>\n<li><code>copyright</code> String (任意) - 著作権情報。</li>\n<li><code>version</code> String (任意) <em>macOS</em> - アプリのビルドバージョン番号。</li>\n<li><code>credits</code> String (任意) <em>macOS</em> <em>Windows</em> - クレジット情報。</li>\n<li><code>authors</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> <em>Linux</em> - アプリの作者のリスト。</li>\n<li><code>website</code> String (任意) <em>Linux</em> - アプリのウェブサイト。</li>\n<li><code>iconPath</code> String (任意) <em>Linux</em> <em>Windows</em> - JPEGまたはPNGフォーッマットの、アプリのアイコンへのパス。 Linux で、アスペクト比を保ったまま 64×64 ピクセルで表示されます。</li>\n</ul></li>\n</ul>\n<p>Aboutパネルのオプションを設定します。 macOS の場合、これはアプリの <code>.plist</code> ファイルで定義された値を上書きします。 詳細は <a href=\"https://developer.apple.com/reference/appkit/nsapplication/1428479-orderfrontstandardaboutpanelwith?language=objc\">Apple のドキュメント</a> を参照してください。 Linuxの場合、表示するために値をセットしなければなりません。デフォルトの値はありません。</p>\n<p><code>credits</code> を設定していなくてもアプリに表示したい場合、AppKit は NSBundle の main クラスメソッドから返されたバンドル内で、\"Credits.html\"、\"Credits.rtf\"、\"Credits.rtfd\" の順番でファイルを探します。 最初に見つかったファイルが使用されます。見つからない場合、その情報の部分は空白のままです。 詳細は Apple の <a href=\"https://developer.apple.com/documentation/appkit/nsaboutpaneloptioncredits?language=objc\">ドキュメント</a> を参照してください。</p>\n<h3 id=\"appisemojipanelsupported\"><a href=\"#appisemojipanelsupported\"><code>app.isEmojiPanelSupported()</code></a></h3>\n<p>戻り値 <code>Boolean</code> - 現在の OS バージョンがネイティブの絵文字ピッカーを許可しているかどうか。</p>\n<h3 id=\"appshowemojipanel-macos-windows\"><a href=\"#appshowemojipanel-macos-windows\"><code>app.showEmojiPanel()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>プラットフォームのネイティブの絵文字ピッカーを表示します。</p>\n<h3 id=\"appstartaccessingsecurityscopedresourcebookmarkdata-mas\"><a href=\"#appstartaccessingsecurityscopedresourcebookmarkdata-mas\"><code>app.startAccessingSecurityScopedResource(bookmarkData)</code> <em>mas</em></a></h3>\n<ul>\n<li><code>bookmarkData</code> String - <code>dialog.showOpenDialog</code> または <code>dialog.showSaveDialog</code> メソッドによって返された、base64 でエンコードされたセキュリティスコープのブックマークデータ。</li>\n</ul>\n<p>戻り値 <code>Function</code> - セキュリティスコープ付きファイルへのアクセスが終了すれば、この関数の呼び出しを <strong>しなければなりません</strong>。 ブックマークへのアクセスを忘れた場合は、<a href=\"https://developer.apple.com/reference/foundation/nsurl/1417051-startaccessingsecurityscopedreso?language=objc\">カーネルリソースがリークします</a>。アプリが再起動されるまで、サンドボックスの外部にアクセスする権限は失われます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// ファイルアクセス開始</span>\n<span class=\"hljs-keyword\">const</span> stopAccessingSecurityScopedResource = app.startAccessingSecurityScopedResource(data)\n<span class=\"hljs-comment\">// サンドボックス外のファイルにアクセスできるようになりました 🎉</span>\n\n<span class=\"hljs-comment\">// ファイルへのアクセスが終わったらアクセス停止を忘れずに。</span>\nstopAccessingSecurityScopedResource()\n</code></pre>\n<p>セキュリティスコープ付きリソースへのアクセスを開始します。 このメソッドでは、Mac App Store 用にパッケージ化された Electron アプリケーションが、ユーザーが選択したファイルにアクセスするためにサンドボックスの外部にアクセスすることがあります。 このシステムの動作の詳細は、<a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">Apple のドキュメント</a> を参照してください。</p>\n<h3 id=\"appenablesandbox\"><a href=\"#appenablesandbox\"><code>app.enableSandbox()</code></a></h3>\n<p>アプリで完全サンドボックスモードを有効にします。 これは、WebPreferences の <code>sandbox</code> フラグの値に関係なく、すべてのレンダラーがサンドボックスで起動されることを意味します。</p>\n<p>このメソッドはアプリが ready になる前だけでしか呼び出すことができません。</p>\n<h3 id=\"appisinapplicationsfolder-macos\"><a href=\"#appisinapplicationsfolder-macos\"><code>app.isInApplicationsFolder()</code> <em>macOS</em></a></h3>\n<p>戻り値 <code>Boolean</code> - アプリケーションが現在、システムのアプリケーションフォルダから実行されているかどうか。 <code>app.moveToApplicationsFolder()</code> と組み合わせて使ってください。</p>\n<h3 id=\"appmovetoapplicationsfolderoptions-macos\"><a href=\"#appmovetoapplicationsfolderoptions-macos\"><code>app.moveToApplicationsFolder([options])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>options</code> Object (任意)<ul>\n<li><code>conflictHandler</code> Function\\<boolean> (任意) - 移動に失敗したときの潜在的競合のハンドラ。<ul>\n<li><code>conflictType</code> String - ハンドラーが遭遇した移動で起こった競合の種類。<code>exists</code> か <code>existsAndRunning</code> になります。<code>exists</code> は同じ名前のアプリがアプリケーションディレクトリに存在し、<code>existsAndRunning</code> は存在し且つ現在実行されていることを意味します。</li>\n</ul></boolean></li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Boolean</code> - 移動が成功したかどうか。 移動が成功した場合、アプリケーションは終了し、再起動されることに注意してください。</p>\n<p>デフォルトでは確認ダイアログは表示されません。 ユーザに操作の確認をさせたい場合は、<a href=\"/docs/api/dialog\"><code>dialog</code></a> API で実現できます。</p>\n<p><strong>注意:</strong> このメソッドはユーザ以外が移動の失敗を引き起こした場合にもエラーを送出します。 例えば、ユーザが承認ダイアログをキャンセルした場合、このメソッドは false を返します。 コピーの実行に失敗した場合、このメソッドはエラーをスローします。 エラーのメッセージは意味の分かるものにする必要があり、何が間違っているのかを正確に知らせるようにしてください。</p>\n<p>既定では、移動するアプリと同じ名前のアプリがアプリケーションディレクトリに存在し実行されて <em>いない</em> 場合、既存のアプリはゴミ箱に移動され、新たなアプリがその場所に移動します。 <em>実行されている</em> 場合、既存の実行中のアプリはフォーカスを引き継ぎ、新たなアプリは自動的に終了します。 この挙動は、オプションの競合ハンドラを提供することで変更できます。この場合、ハンドラによって返されるブール値によって、移動の競合がデフォルトの動作で解決されるかどうかを決定します。  つまり、<code>false</code> を返すとそれ以上のアクションは行われなくなります。<code>true</code> を返すとデフォルトの動作になり、メソッドが続行されます。</p>\n<p>以下がその例です。</p>\n<pre><code class=\"hljs language-js\">app.moveToApplicationsFolder({\n  <span class=\"hljs-attr\">conflictHandler</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">conflictType</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (conflictType === <span class=\"hljs-string\">'exists'</span>) {\n      <span class=\"hljs-keyword\">return</span> dialog.showMessageBoxSync({\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'question'</span>,\n        <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'移動を中止'</span>, <span class=\"hljs-string\">'移動を続行'</span>],\n        <span class=\"hljs-attr\">defaultId</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'この名前のアプリはすでに存在します'</span>\n      }) === <span class=\"hljs-number\">1</span>\n    }\n  }\n})\n</code></pre>\n<p>そのユーザーディレクトリにアプリが既に存在する場合、ユーザーが '移動を続行' を選択すると、関数は既定の動作を続行し、既存のアプリは破棄され、新たなアプリはその場所に移動します。</p>\n<h3 id=\"appissecurekeyboardentryenabled-macos\"><a href=\"#appissecurekeyboardentryenabled-macos\"><code>app.isSecureKeyboardEntryEnabled()</code> <em>macOS</em></a></h3>\n<p>戻り値 <code>Boolean</code> - <code>キーボード入力のセキュリティを保護</code> が有効になっているかどうか。</p>\n<p>この API は既定で <code>false</code> を返します。</p>\n<h3 id=\"appsetsecurekeyboardentryenabledenabled-macos\"><a href=\"#appsetsecurekeyboardentryenabledenabled-macos\"><code>app.setSecureKeyboardEntryEnabled(enabled)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>enabled</code> Boolean - <code>キーボード入力のセキュリティを保護</code> を有効にするかどうか</li>\n</ul>\n<p>アプリケーションの <code>キーボード入力のセキュリティを保護</code> の有効化を設定します。</p>\n<p>この API を利用すると、パスワードなどの重要な情報や機密情報を他のプロセスの傍受から防げます。</p>\n<p>詳しくは <a href=\"https://developer.apple.com/library/archive/technotes/tn2150/_index.html\">Apple のドキュメント</a> を参照してください。</p>\n<p><strong>注意:</strong> <code>キーボード入力のセキュリティを保護</code> は必要なときにのみ有効にし、不要なときには無効にしてください。</p>\n<h2 id=\"プロパティ\"><a href=\"#プロパティ\">プロパティ</a></h2>\n<h3 id=\"appaccessibilitysupportenabled-macos-windows\"><a href=\"#appaccessibilitysupportenabled-macos-windows\"><code>app.accessibilitySupportEnabled</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>この <code>Boolean</code> プロパティは、Chrome のアクセシビリティサポートが有効になっている場合は <code>true</code>、それ以外の場合は <code>false</code> になります。 このプロパティは、テキスト読み上げなどのアシスト技術を使っていることが検出された場合、<code>true</code> を返します。 手動でこのプロパティを <code>true</code> にセットして Chrome のアクセシビリティサポートを有効にすると、開発者はアプリケーション設定内でユーザにアクセシビリティスイッチを出すことができます。</p>\n<p>詳細については <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">Chromium のアクセシビリティドキュメント</a> を参照してください。 既定では無効です。</p>\n<p>この API は <code>ready</code> イベントが発生した後で呼ばなければいけません。</p>\n<p><strong>注:</strong> アクセシビリティツリーをレンダリングすると、アプリのパフォーマンスに顕著な影響を与える可能性があります。 既定で有効にすべきではありません。</p>\n<h3 id=\"appapplicationmenu\"><a href=\"#appapplicationmenu\"><code>app.applicationMenu</code></a></h3>\n<p><code>Menu | null</code> 型のプロパティです。セットされている場合は <a href=\"/docs/api/menu\"><code>Menu</code></a> を、それ以外は <code>null</code> を返します。 ユーザはこのプロパティに <a href=\"/docs/api/menu\">Menu</a> を渡すことができます。</p>\n<h3 id=\"appbadgecount-linux-macos\"><a href=\"#appbadgecount-linux-macos\"><code>app.badgeCount</code> <em>Linux</em> <em>macOS</em></a></h3>\n<p><code>Integer</code> 型のプロパティです。現在のアプリのバッジカウントを返します。 カウントを <code>0</code> に設定するとバッジを非表示にします。</p>\n<p>macOS では、ゼロ以外の整数を設定すると、ドックアイコンに表示されます。 Linux では Unity ランチャーでのみ動作します。</p>\n<p><strong>注意:</strong> Unity ランチャーは動作にあたって <code>.desktop</code> ファイルを必要とします。 詳しい情報は、<a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Unity 統合ドキュメント</a> をご覧ください。</p>\n<p><strong>注意:</strong> macOS でこのプロパティを有効にするには、アプリケーションに通知を表示する権限があるかどうか確認する必要があります。</p>\n<h3 id=\"appcommandline-読み出し専用\"><a href=\"#appcommandline-読み出し専用\"><code>app.commandLine</code> <em>読み出し専用</em></a></h3>\n<p><a href=\"/docs/api/command-line\"><code>CommandLine</code></a> オブジェクトです。Chromium が使用するコマンドライン引数の読み取りと操作ができます。</p>\n<h3 id=\"appdock-macos-readonly\"><a href=\"#appdock-macos-readonly\"><code>app.dock</code> <em>macOS</em> <em>Readonly</em></a></h3>\n<p><a href=\"/docs/api/dock\"><code>Dock</code></a> <code>| undefined</code> 型のオブジェクトです。macOS のユーザーの Dock 内のアプリアイコンにおけるアクションを実行できます。</p>\n<h3 id=\"appispackaged-読み出し専用\"><a href=\"#appispackaged-読み出し専用\"><code>app.isPackaged</code> <em>読み出し専用</em></a></h3>\n<p>アプリがパッケージされている場合は<code>true</code>、それ以外は <code>false</code> を返す <code>Boolean</code> プロパティ。 多くのアプリケーションでは、このプロパティを用いて開発版の環境と製品版の環境を区別できます。</p>\n<h3 id=\"appname\"><a href=\"#appname\"><code>app.name</code></a></h3>\n<p><code>String</code> 型のプロパティです。現在のアプリケーション名を示します。アプリケーションの <code>package.json</code> ファイル内にある名前になります。</p>\n<p>通常、<code>package.json</code> の <code>name</code> フィールドは、npm のモジュール仕様に基づいて小文字だけの短い名前が設定されます。 通常、すべて大文字で始まるアプリケーションの名前となる <code>productName</code> フィールドも指定してください。Electronによって、<code>name</code> よりも優先されます。</p>\n<h3 id=\"appuseragentfallback\"><a href=\"#appuseragentfallback\"><code>app.userAgentFallback</code></a></h3>\n<p>この <code>String</code> は Electron がグローバルフォールバックとして使用するユーザーエージェント文字列です。</p>\n<p>これは、<code>webContents</code> または <code>session</code> レベルでユーザーエージェントが設定されていない場合に使用されるユーザーエージェントです。  アプリ全体が同じユーザーエージェントを持っていることを確認するのに役立ちます。  オーバーライドされた値が確実に使用されるように、アプリの初期化のできるだけ早い段階でカスタム値に設定してください。</p>\n<h3 id=\"apprunningunderrosettatranslation-macos-readonly-deprecated\"><a href=\"#apprunningunderrosettatranslation-macos-readonly-deprecated\"><code>app.runningUnderRosettaTranslation</code> <em>macOS</em> <em>Readonly</em> <em>Deprecated</em></a></h3>\n<p><code>Boolean</code> 型で、<code>true</code> の場合アプリが <a href=\"https://en.wikipedia.org/wiki/Rosetta_(software)\">Rosetta 変換環境</a> 下で動作していることを示します。</p>\n<p>このプロパティを使用すれば、x64 版を Rosetta で誤って実行している場合に、arm64 版のアプリケーションをダウンロードするようにユーザーに促すことができます。</p>\n<p><strong>非推奨:</strong> このプロパティは <code>runningUnderARM64Translation</code> プロパティに置き換えられます。こちらは macOS と Windows の両方でアプリを ARM64 に変換したかどうかを検出します。</p>\n<h3 id=\"apprunningunderarm64translation-readonly-macos-windows\"><a href=\"#apprunningunderarm64translation-readonly-macos-windows\"><code>app.runningUnderARM64Translation</code> <em>Readonly</em> <em>macOS</em> <em>Windows</em></a></h3>\n<p><code>Boolean</code> 型で、<code>true</code>の場合はアプリが現在 ARM64 変換機 (macOS の <a href=\"https://en.wikipedia.org/wiki/Rosetta_(software)\">Rosetta 変換環境</a> や Windows の <a href=\"https://en.wikipedia.org/wiki/Windows_on_Windows\">WOW</a> など) で動作していることを示します。</p>\n<p>このプロパティを使用すれば、x64 版を Rosetta で誤って実行している場合に、arm64 版のアプリケーションをダウンロードするようにユーザーに促すことができます。</p>",
      "title": "app",
      "description": "アプリケーションのイベントライフサイクルを制御します。"
    },
    "/docs/tutorial/application-debugging": {
      "locale": "ja-JP",
      "slug": "application-debugging",
      "href": "/docs/tutorial/application-debugging",
      "crowdinFileId": "256175",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/application-debugging.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"アプリケーションのデバッグ\"><a href=\"#アプリケーションのデバッグ\">アプリケーションのデバッグ</a></h1>\n<p>Electron アプリケーションが望むように動作しないときは、デバッグツール一式がコーディングエラー、パフォーマンスのボトルネック、最適化の機会を見つけるのに役立つかもしれません。</p>\n<h2 id=\"レンダラープロセス\"><a href=\"#レンダラープロセス\">レンダラープロセス</a></h2>\n<p>個々のレンダラープロセスをデバッグするための最も包括的なツールは、Chromium Developer Toolset です。 <code>BrowserWindow</code>、<code>BrowserView</code>、<code>WebView</code> のインスタンスを含むすべてのレンダラープロセスに対して利用可能です。 インスタンスの <code>webContents</code> 上で <code>openDevTools()</code> APIを呼ぶことで、プログラムで開くことができます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.openDevTools()\n</code></pre>\n<p>Google は <a href=\"https://developer.chrome.com/devtools\">開発者向けツールの優れたドキュメント</a> を提供しています。 通常、Electron 開発者のツールベルトの中で最も強力なユーティリティの1つです。自分自身に慣れさせることを推奨します。</p>\n<h2 id=\"メインプロセス\"><a href=\"#メインプロセス\">メインプロセス</a></h2>\n<p>メインプロセスのデバッグは少し難解です。なぜなら、開発者向けツールで開くことができないからです。 Google / Chrome と Node.js の緊密なコラボレーションのおかげで、Chromium デベロッパーツールを使用して <a href=\"https://nodejs.org/en/docs/inspector/\">Electron のメインプロセスをデバッグする</a> ことができます。しかし、コンソールに<code>require</code> が存在しないなどの奇妙な問題が発生する可能性があります。</p>\n<p>より詳しい情報は、<a href=\"/docs/tutorial/debugging-main-process\">メインプロセスのデバッグのドキュメント</a> を参照してください。</p>\n<h2 id=\"v8-クラッシュ\"><a href=\"#v8-クラッシュ\">V8 クラッシュ</a></h2>\n<p>V8 コンテキストがクラッシュした場合、デベロッパー ツールにこのメッセージが表示されます。</p>\n<p><code>デベロッパー ツールはページから切断されました。 ページをリロードすれば、デベロッパー ツールは自動で再接続します。</code></p>\n<p>Chromium のログは <code>ELECTRON_ENABLE_LOGGING</code> 環境変数を介して有効にできます。 詳しい情報は <a href=\"/docs/api/environment-variables#electron_enable_logging\">環境変数ドキュメント</a> を参照してください。</p>\n<p>代替として、<code>--enable-logging</code> コマンドライン引数を渡すことでもできます。 詳しい情報は <a href=\"/docs/api/command-line-switches#--enable-loggingfile\">コマンドラインスイッチドキュメント</a> を参照してください。</p>",
      "title": "アプリケーションのデバッグ",
      "description": ""
    },
    "/docs/tutorial/application-distribution": {
      "locale": "ja-JP",
      "slug": "application-distribution",
      "href": "/docs/tutorial/application-distribution",
      "crowdinFileId": "256177",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/application-distribution.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"アプリケーションの配布\"><a href=\"#アプリケーションの配布\">アプリケーションの配布</a></h1>\n<h2 id=\"概要\"><a href=\"#概要\">概要</a></h2>\n<p>Electron アプリを配布するには、パッケージ化してアイコンを変更する必要があります。 アイコンの変更にあたっては、専用ツールか手動で行うかを選べます。</p>\n<h2 id=\"ツールの利用\"><a href=\"#ツールの利用\">ツールの利用</a></h2>\n<p>アプリケーションの配布には以下のツールを使用できます。</p>\n<ul>\n<li><a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a></li>\n<li><a href=\"https://github.com/electron-userland/electron-builder\">electron-builder</a></li>\n<li><a href=\"https://github.com/electron/electron-packager\">electron-packager</a></li>\n</ul>\n<p>これらのツールは、あなたの Electron アプリケーションを配布可能にするにあたって必要な全手順を網羅しています。この手順には、アプリケーションのパッケージング、実行ファイルのリブランド、正しいアイコンの設定が含まれます。</p>\n<p><a href=\"/docs/tutorial/quick-start#package-and-distribute-your-application\">クイックスタートガイド</a> にて <code>electron-forge</code> でアプリのパッケージ方法のサンプルを確認できます。</p>\n<h2 id=\"マニュアル配布\"><a href=\"#マニュアル配布\">マニュアル配布</a></h2>\n<h3 id=\"ビルド済みバイナリの利用\"><a href=\"#ビルド済みバイナリの利用\">ビルド済みバイナリの利用</a></h3>\n<p>手動でアプリを配布する際は、Electron の <a href=\"https://github.com/electron/electron/releases\">ビルド済みバイナリ</a> をダウンロードする必要があります。 次に、アプリケーションが含まれたフォルダの名前を <code>app</code> に変更し、Electron のリソースディレクトリに以下に示すように配置します。</p>\n<blockquote>\n<p><em>注意:</em> 以下の例では、Electron のビルド済みバイナリの場所を <code>electron/</code> としています。</p>\n</blockquote>\n<p><em>macOS:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/Electron.app/Contents/Resources/app/\n├── package.json\n├── main.js\n└── index.html\n</code></pre>\n<p><em>Windows および Linux:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/resources/app\n├── package.json\n├── main.js\n└── index.html\n</code></pre>\n<p>その後、macOS では <code>Electron.app</code>、Linux では <code>electron</code>、Windows では <code>electron.exe</code> を実行すると、Electron がアプリとして起動します。 そして、その <code>electron</code> ディレクトリがユーザーに頒布する頒布物となります。</p>\n<h3 id=\"アプリソースコードのアーカイブの利用\"><a href=\"#アプリソースコードのアーカイブの利用\">アプリソースコードのアーカイブの利用</a></h3>\n<p>Parcel や Webpack などのバンドラを使用していない場合、ソースファイルをすべてコピーしてアプリを頒布するのではなく <a href=\"https://github.com/electron/asar\">asar</a> アーカイブにアプリをパッケージすることで、Windows のようなプラットフォーム上でファイルの読み出しパフォーマンスを改善できます。</p>\n<p><code>app</code> フォルダの代わりに <code>asar</code> アーカイブを使用するためには、アーカイブファイルを <code>app.asar</code> という名前に変更し、Electron のリソースディレクトリに以下のように配置する必要があります。そうすれば、Electron はアーカイブを読み込みを試み、そこから起動します。</p>\n<p><em>macOS:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/Electron.app/Contents/Resources/\n└── app.asar\n</code></pre>\n<p><em>Windows および Linux:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/resources/\n└── app.asar\n</code></pre>\n<p><a href=\"https://github.com/electron/asar\"><code>electron/asar</code> リポジトリ </a>に <code>asar</code> の使い方の詳細を掲載してあります。</p>\n<h3 id=\"ダウンロードしたバイナリの名称変更\"><a href=\"#ダウンロードしたバイナリの名称変更\">ダウンロードしたバイナリの名称変更</a></h3>\n<p>アプリを Electron にバンドルした後、ユーザーに配布する前に、 Electron の名称変更をしたいでしょう。</p>\n<h4 id=\"macos\"><a href=\"#macos\">macOS</a></h4>\n<p><code>Electron.app</code> のファイル名は、好きな任意の名前に変更することが出来ます。その場合、以下のファイル内の <code>CFBundleDisplayName</code>、<code>CFBundleIdentifier</code>、<code>CFBundleName</code> も変更する必要があります。</p>\n<ul>\n<li><code>Electron.app/Contents/Info.plist</code></li>\n<li><code>Electron.app/Contents/Frameworks/Electron Helper.app/Contents/Info.plist</code></li>\n</ul>\n<p>アクティビティモニタ上で <code>Electron Helper</code> と表示されるのを避けるために、ヘルパーアプリの名前を変更することも出来ます。ただし、ヘルパーアプリの実行ファイル名が変更されていることを確認してください。</p>\n<p>名前を変更したアプリケーションの構造は以下のようになります。</p>\n<pre><code class=\"hljs language-plaintext\">MyApp.app/Contents\n├── Info.plist\n├── MacOS/\n│   └── MyApp\n└── Frameworks/\n    └── MyApp Helper.app\n        ├── Info.plist\n        └── MacOS/\n            └── MyApp Helper\n</code></pre>\n<h4 id=\"windows\"><a href=\"#windows\">Windows</a></h4>\n<p><code>electron.exe</code> のファイル名は、任意の名前に変更することが出来ます。また、アイコンやその他の情報を <a href=\"https://github.com/electron/rcedit\">rcedit</a> のようなツールで編集出来ます。</p>\n<h4 id=\"linux\"><a href=\"#linux\">Linux</a></h4>\n<p><code>electron</code> 実行形式の名前は好きな任意の名前に変更できます。</p>\n<h3 id=\"ソースから-electron-を再ビルドすることによる名称変更\"><a href=\"#ソースから-electron-を再ビルドすることによる名称変更\">ソースから Electron を再ビルドすることによる名称変更</a></h3>\n<p>ソースからプロダクト名を変更してビルドすることで、Electron を名称変更することも可能です。 これを行うには、製品名に対応するビルド引数 (<code>electron_product_name = \"YourProductName\" </code>) を <code>args.gn</code> ファイルに設定して再ビルドする必要があります。</p>",
      "title": "アプリケーションの配布",
      "description": "注意: 以下の例では、Electron のビルド済みバイナリの場所を electron/ としています。"
    },
    "/docs/api/auto-updater": {
      "locale": "ja-JP",
      "slug": "auto-updater",
      "href": "/docs/api/auto-updater",
      "crowdinFileId": "256281",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/auto-updater.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"autoupdater\"><a href=\"#autoupdater\">autoUpdater</a></h1>\n<blockquote>\n<p>アプリを自動的に更新することができます。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><strong>こちらも参照: <a href=\"/docs/tutorial/updates\">アプリケーションを更新する</a></strong></p>\n<p><code>autoUpdater</code> は <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a> を継承しています。</p>\n<h2 id=\"プラットフォームに関する注意事項\"><a href=\"#プラットフォームに関する注意事項\">プラットフォームに関する注意事項</a></h2>\n<p>現在、macOS と Windows にのみ対応しています。 Linux では、自動更新の組み込みサポートがないので、アプリ更新にはディストリビューションのパッケージマネージャーの使用を推奨しています。</p>\n<p>さらに、各プラットフォームではいくつかの微妙な違いがあります。</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>macOSでは、<code>autoUpdater</code> モジュールは <a href=\"https://github.com/Squirrel/Squirrel.Mac\">Squirrel.Mac</a> で構築されているので、動作させるのに特別なセットアップ作業をする必要はありません。 サーバー側の要件については、<a href=\"https://github.com/Squirrel/Squirrel.Mac#server-support\">サーバーサポート</a> をお読みください。 <a href=\"https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW35\">アプリケーショントランスポートセキュリティ</a> (ATS) が、更新処理の一部としてなされるすべてのリクエストに適用されることに注意してください。 アプリのplistに <code>NSAllowsArbitraryLoads</code> キーを追加することで、ATSを無効にすることができます。</p>\n<p><strong>注:</strong> macOS で自動更新を有効にするには、アプリ署名が必要です。 これは <code>Squirrel.Mac</code> の動作要件です。</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<p>Windows で <code>autoUpdater</code> を使用するには、アプリをユーザのマシンにインストールする必要があります。<a href=\"https://github.com/electron/windows-installer\">electron-winstaller</a>、<a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a>、<a href=\"https://github.com/electron/grunt-electron-installer\">grunt-electron-installer</a> のいずれかのパッケージで Windows インストーラを生成することを推奨します。</p>\n<p><a href=\"https://github.com/electron/windows-installer\">electron-winstaller</a> または <a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a> を使用する場合、<a href=\"https://github.com/electron/windows-installer#handling-squirrel-events\">初回実行時に</a> アプリを更新しようとしないようにしてください (<a href=\"https://github.com/electron/electron/issues/7155\">この issue の詳細情報</a> も参照)。 アプリのデスクトップショートカットを作成する <a href=\"https://github.com/mongodb-js/electron-squirrel-startup\">electron-squirrel-startup</a> も使用することを推奨します。</p>\n<p>Squirrel で作成されたインストーラは、例えば、<code>com.squirrel.slack.Slack</code> や <code>com.squirrel.code.Code</code> といった<code>com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE</code> という形式の <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">アプリケーションユーザ ID</a> を持つショートカットアイコンを作成します。 <code>app.setAppUserModelId</code> APIでアプリに対して同じIDを使うようにしてください。そうでないと、Windowsはタスクバーにアプリを正しくピン留めすることができません。</p>\n<p>Squirrel.Mac と同様に、Windows でも S3 やその他の静的ファイルホストで更新プログラムをホストできます。 Squirrel.Windows の仕組みの詳細については、<a href=\"https://github.com/Squirrel/Squirrel.Windows\">Squirrel.Windows</a> のドキュメントをお読みください。</p>\n<h2 id=\"イベント\"><a href=\"#イベント\">イベント</a></h2>\n<p><code>autoUpdater</code> オブジェクトは以下のイベントを発生させます。</p>\n<h3 id=\"イベント-error\"><a href=\"#イベント-error\">イベント: 'error'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>error</code> Error</li>\n</ul>\n<p>更新中にエラーがあるときに出力されます。</p>\n<h3 id=\"イベント-checking-for-update\"><a href=\"#イベント-checking-for-update\">イベント: 'checking-for-update'</a></h3>\n<p>更新が始まったかどうかをチェックするときに放出されます。</p>\n<h3 id=\"イベント-update-available\"><a href=\"#イベント-update-available\">イベント: 'update-available'</a></h3>\n<p>利用可能な更新がある場合に発生します。 更新は自動ダウンロードされます。</p>\n<h3 id=\"イベント-update-not-available\"><a href=\"#イベント-update-not-available\">イベント: 'update-not-available'</a></h3>\n<p>利用可能な更新がない場合に出力されます。</p>\n<h3 id=\"イベント-update-downloaded\"><a href=\"#イベント-update-downloaded\">イベント: 'update-downloaded'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>releaseNotes</code> String</li>\n<li><code>releaseName</code> String</li>\n<li><code>releaseDate</code> Date</li>\n<li><code>updateURL</code> String</li>\n</ul>\n<p>更新プログラムがダウンロードされたときに発生します。</p>\n<p>Windowsでは <code>releaseName</code> のみ利用可能です。</p>\n<p><strong>注:</strong> 必ずこのイベントを処理する必要はありません。 ダウンロードに成功した更新は、次回のアプリケーション起動時でも適用されます。</p>\n<h3 id=\"イベント-before-quit-for-update\"><a href=\"#イベント-before-quit-for-update\">イベント: 'before-quit-for-update'</a></h3>\n<p>このイベントは、ユーザが呼び出した <code>quitAndInstall()</code> の後に発火されます。</p>\n<p>この API が呼ばれた時、すべてのウィンドウが閉じられる前に <code>before-quit</code> イベントは発火されません。 結果として、プロセス終了時にウィンドウが閉じられる前にアクションを実行するために、<code>before-quit</code> をリッスンする場合は、このイベントも同様にリッスンする必要があります。</p>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>autoUpdater</code> オブジェクトには以下のメソッドがあります</p>\n<h3 id=\"autoupdatersetfeedurloptions\"><a href=\"#autoupdatersetfeedurloptions\"><code>autoUpdater.setFeedURL(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>url</code> String</li>\n<li><code>headers</code> Record&#x3C;String, String> (任意) <em>macOS</em> - HTTP リクエストのヘッダ。</li>\n<li><code>serverType</code> String (任意) <em>macOS</em> - <code>json</code>、<code>default</code> のいずれかです。詳細は <a href=\"https://github.com/Squirrel/Squirrel.Mac\">Squirrel.Mac</a> README を参照してください。</li>\n</ul></li>\n</ul>\n<p><code>url</code> を設定して自動更新を初期化します。</p>\n<h3 id=\"autoupdatergetfeedurl\"><a href=\"#autoupdatergetfeedurl\"><code>autoUpdater.getFeedURL()</code></a></h3>\n<p>戻り値 <code>String</code> - 現在の更新フィードURL。</p>\n<h3 id=\"autoupdatercheckforupdates\"><a href=\"#autoupdatercheckforupdates\"><code>autoUpdater.checkForUpdates()</code></a></h3>\n<p>更新があるかどうかサーバーに問い合わせます。 この API を使用する前に <code>setFeedURL</code> を呼び出す必要があります。</p>\n<p><strong>注意:</strong> アップデート可能であれは、自動でダウンロードされます。 <code>autoUpdater.checkForUpdates()</code> を 2 回呼び出すと、更新データを 2 回ダウンロードすることになります。</p>\n<h3 id=\"autoupdaterquitandinstall\"><a href=\"#autoupdaterquitandinstall\"><code>autoUpdater.quitAndInstall()</code></a></h3>\n<p>ダウンロード後にアプリを再起動し、更新をインストールします。 <code>update-downloaded</code> が発生した後でしか呼び出さないでください。</p>\n<p><code>autoUpdater.quitAndInstall()</code> を呼ぶと、この中では最初にすべてのアプリケーションウィンドウを閉じ、すべてのウィンドウが閉じられた後に自動的に <code>app.quit()</code> を呼び出します。</p>\n<p><strong>注意:</strong> アップデートを適用するために必ずこの関数を呼ぶ必要はなく、ダウンロードに成功したアップデートは次回のアプリケーション起動時に必ず適用されます。</p>",
      "title": "autoUpdater",
      "description": "アプリを自動的に更新することができます。"
    },
    "/docs/tutorial/automated-testing-with-a-custom-driver": {
      "locale": "ja-JP",
      "slug": "automated-testing-with-a-custom-driver",
      "href": "/docs/tutorial/automated-testing-with-a-custom-driver",
      "crowdinFileId": "256179",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/automated-testing-with-a-custom-driver.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"カスタムドライバーを使った自動テスト\"><a href=\"#カスタムドライバーを使った自動テスト\">カスタムドライバーを使った自動テスト</a></h1>\n<p>Electron アプリの自動テストを作成するには、アプリケーションを「ドライブ」する方法が必要になります。 <a href=\"https://electronjs.org/spectron\">Spectron</a> は、<a href=\"https://webdriver.io/\">WebDriver</a> を介してユーザの操作をエミュレートする、一般的な解決方法です。 ただし、Node に組み込まれている IPC 越し標準入出力を使用して独自のカスタムドライバを書くことも可能です。 カスタムドライバの利点は、Spectron よりもオーバーヘッドが少なくて済むことです。また、カスタムメソッドをあなたのテストスイートに公開できます。</p>\n<p>カスタムドライバを作成するには、Node.js の <a href=\"https://nodejs.org/api/child_process.html\">child_process</a> API を使用します。 テストスイートは、以下のように Electron プロセスを spawn してから、簡単なメッセージングプロトコルを確立します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> childProcess = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'child_process'</span>)\n<span class=\"hljs-keyword\">const</span> electronPath = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// プロセスの生成</span>\n<span class=\"hljs-keyword\">const</span> env = { <span class=\"hljs-comment\">/* ... */</span> }\n<span class=\"hljs-keyword\">const</span> stdio = [<span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'ipc'</span>]\n<span class=\"hljs-keyword\">const</span> appProcess = childProcess.spawn(electronPath, [<span class=\"hljs-string\">'./app'</span>], { stdio, env })\n\n<span class=\"hljs-comment\">// アプリからの IPC メッセージをリッスン</span>\nappProcess.on(<span class=\"hljs-string\">'message'</span>, (msg) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// アプリへ IPC メッセージを送る</span>\nappProcess.send({ <span class=\"hljs-attr\">my</span>: <span class=\"hljs-string\">'message'</span> })\n</code></pre>\n<p>Electron アプリケーション内からは、Node.js の <a href=\"https://nodejs.org/api/process.html\">process</a> API を使用して、メッセージをリッスンして返信を送信できます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// テストスイートからの IPC メッセージをリッスンする</span>\nprocess.on(<span class=\"hljs-string\">'message'</span>, (msg) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// テストスイートへ IPC メッセージを送る</span>\nprocess.send({ <span class=\"hljs-attr\">my</span>: <span class=\"hljs-string\">'message'</span> })\n</code></pre>\n<p>これで、<code>appProcess</code> オブジェクトを使用してテストスイートから Electron アプリケーションに通信できます。</p>\n<p>利便性のために、より高度な機能を提供するドライバオブジェクトで <code>appProcess</code> をラップすることをお勧めします。 以下は、これをどのようにするかの例です。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">TestDriver</span> </span>{\n  <span class=\"hljs-keyword\">constructor</span> ({ path, args, env }) {\n    <span class=\"hljs-keyword\">this</span>.rpcCalls = []\n\n    <span class=\"hljs-comment\">// 子プロセスの開始</span>\n    env.APP_TEST_DRIVER = <span class=\"hljs-number\">1</span> <span class=\"hljs-comment\">// メッセージをリッスンする必要性をアプリに知らせる</span>\n    <span class=\"hljs-keyword\">this</span>.process = childProcess.spawn(path, args, { <span class=\"hljs-attr\">stdio</span>: [<span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'ipc'</span>], env })\n\n    <span class=\"hljs-comment\">// RPC レスポンスのハンドリング</span>\n    <span class=\"hljs-keyword\">this</span>.process.on(<span class=\"hljs-string\">'message'</span>, (message) => {\n      <span class=\"hljs-comment\">// ハンドラを除去</span>\n      <span class=\"hljs-keyword\">const</span> rpcCall = <span class=\"hljs-keyword\">this</span>.rpcCalls[message.msgId]\n      <span class=\"hljs-keyword\">if</span> (!rpcCall) <span class=\"hljs-keyword\">return</span>\n      <span class=\"hljs-keyword\">this</span>.rpcCalls[message.msgId] = <span class=\"hljs-literal\">null</span>\n      <span class=\"hljs-comment\">// 拒否/解決</span>\n      <span class=\"hljs-keyword\">if</span> (message.reject) rpcCall.reject(message.reject)\n      <span class=\"hljs-keyword\">else</span> rpcCall.resolve(message.resolve)\n    })\n\n    <span class=\"hljs-comment\">// ready を待つ</span>\n    <span class=\"hljs-keyword\">this</span>.isReady = <span class=\"hljs-keyword\">this</span>.rpc(<span class=\"hljs-string\">'isReady'</span>).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">err</span>) =></span> {\n      <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Application failed to start'</span>, err)\n      <span class=\"hljs-keyword\">this</span>.stop()\n      process.exit(<span class=\"hljs-number\">1</span>)\n    })\n  }\n\n  <span class=\"hljs-comment\">// 簡単な RPC 呼び出し</span>\n  <span class=\"hljs-comment\">// to use: driver.rpc('method', 1, 2, 3).then(...)</span>\n  <span class=\"hljs-keyword\">async</span> rpc (cmd, ...args) {\n    <span class=\"hljs-comment\">// rpc リクエストを送信する</span>\n    <span class=\"hljs-keyword\">const</span> msgId = <span class=\"hljs-keyword\">this</span>.rpcCalls.length\n    <span class=\"hljs-keyword\">this</span>.process.send({ msgId, cmd, args })\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\">(<span class=\"hljs-params\">resolve, reject</span>) =></span> <span class=\"hljs-keyword\">this</span>.rpcCalls.push({ resolve, reject }))\n  }\n\n  stop () {\n    <span class=\"hljs-keyword\">this</span>.process.kill()\n  }\n}\n</code></pre>\n<p>このアプリでは、RPC 呼び出しのために簡単なハンドラを作成する必要があります。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">if</span> (process.env.APP_TEST_DRIVER) {\n  process.on(<span class=\"hljs-string\">'message'</span>, onMessage)\n}\n\n<span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">onMessage</span> (<span class=\"hljs-params\">{ msgId, cmd, args }</span>) </span>{\n  <span class=\"hljs-keyword\">let</span> method = METHODS[cmd]\n  <span class=\"hljs-keyword\">if</span> (!method) method = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Invalid method: '</span> + cmd)\n  <span class=\"hljs-keyword\">try</span> {\n    <span class=\"hljs-keyword\">const</span> resolve = <span class=\"hljs-keyword\">await</span> method(...args)\n    process.send({ msgId, resolve })\n  } <span class=\"hljs-keyword\">catch</span> (err) {\n    <span class=\"hljs-keyword\">const</span> reject = {\n      <span class=\"hljs-attr\">message</span>: err.message,\n      <span class=\"hljs-attr\">stack</span>: err.stack,\n      <span class=\"hljs-attr\">name</span>: err.name\n    }\n    process.send({ msgId, reject })\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> METHODS = {\n  isReady () {\n    <span class=\"hljs-comment\">// ここで必要なセットアップをします</span>\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-comment\">// ここで RPC 可能なメソッドを定義します</span>\n}\n</code></pre>\n<p>すると、テストスイート内では、以下のようにテストドライバを使用できます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> test = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'ava'</span>)\n<span class=\"hljs-keyword\">const</span> electronPath = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> app = <span class=\"hljs-keyword\">new</span> TestDriver({\n  <span class=\"hljs-attr\">path</span>: electronPath,\n  <span class=\"hljs-attr\">args</span>: [<span class=\"hljs-string\">'./app'</span>],\n  <span class=\"hljs-attr\">env</span>: {\n    <span class=\"hljs-attr\">NODE_ENV</span>: <span class=\"hljs-string\">'test'</span>\n  }\n})\ntest.before(<span class=\"hljs-keyword\">async</span> t => {\n  <span class=\"hljs-keyword\">await</span> app.isReady\n})\ntest.after.always(<span class=\"hljs-string\">'cleanup'</span>, <span class=\"hljs-keyword\">async</span> t => {\n  <span class=\"hljs-keyword\">await</span> app.stop()\n})\n</code></pre>",
      "title": "カスタムドライバーを使った自動テスト",
      "description": ""
    },
    "/docs/development/azure-vm-setup": {
      "locale": "ja-JP",
      "slug": "azure-vm-setup",
      "href": "/docs/development/azure-vm-setup",
      "crowdinFileId": "256129",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/azure-vm-setup.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"appveyor-azure-イメージを更新する\"><a href=\"#appveyor-azure-イメージを更新する\">Appveyor Azure イメージを更新する</a></h1>\n<p>Windows 上の Electron CI は AppVeyor を使用し、AppVeyor は Azure VM イメージを実行に使用します。  場合によっては、Chromium の要件が変更されたため、これらの VM イメージを更新する必要があります。  更新するには、<a href=\"https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6\">PowerShell</a> と <a href=\"https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-1.8.0&#x26;viewFallbackFrom=azurermps-6.13.0\">Azure PowerShell モジュール</a> が必要です。</p>\n<p>時折、Chromium の変更やその他のビルド要件の変更により、これらのイメージを更新する必要があります。</p>\n<p>ユースケースの例:\n* <code>VS15.9</code> が必要なのに <code>VS15.7</code> がインストールされているので、Azure イメージを更新する必要がある。</p>\n<ol>\n<li>\n<p>修正したいイメージを指定します。</p>\n<ul>\n<li><a href=\"https://github.com/electron/electron/blob/main/appveyor.yml\">appveyor.yml</a> では、イメージは <em>image</em> プロパティで識別されます。<ul>\n<li>使用される名前は、クラウドを構築するために定義された <em>\"イメージ\"</em>、たとえば <a href=\"https://windows-ci.electronjs.org/build-clouds/8\">libcc-20 クラウド</a> に対応しています。</li>\n</ul></li>\n<li>ビルドクラウドで変更するイメージを探し、そのイメージの <strong>VHD Blob Path</strong> をメモします。これはキーに対応する値です。<ul>\n<li>新しいイメージにコピーするにはこの URI パスが必要になります。</li>\n</ul></li>\n<li>また、AppVeyor 上で <strong>ディスクストレージアカウント名</strong> とラベル付けされたストレージアカウント名も必要になります。</li>\n</ul>\n</li>\n<li>\n<p>Azure ストレージアカウントキーを取得します</p>\n<ul>\n<li>LastPass (Azure Enterprise 傘下) に保存されている資格情報を使用して Azure にログインし、AppVeyor にある名前に対応するストレージアカウントを探します。<ul>\n<li>例えば、<code>appveyorlibccbuilds</code> という <strong>ディスクストレージアカウント名</strong> の場合、ストレージアカウントのリスト @ ホーム &#x3C; ストレージアカウントで <code>appveyorlibccbuilds</code> を探します。<ul>\n<li>それをクリックして <code>アクセスキー</code> を見つけます。そして、リストにあるキーのうちどれでも使うことができます。</li>\n</ul></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Azure からフルの仮想マシンイメージ URI を取得します</p>\n<ul>\n<li>ホーム &#x3C; ストレージアカウント &#x3C; <code>$ACCT_NAME</code> &#x3C; Blobs &#x3C; イメージ に移動します。<ul>\n<li>そのリスト内の、Appveyor から入手した VHD パス名を探してクリックします。<ul>\n<li>出てきたウィンドウ上から URL 全体をコピーします。</li>\n</ul></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p><a href=\"https://github.com/appveyor/ci/blob/master/scripts/enterprise/copy-master-image-azure.ps1\">マスターイメージ PowerShell スクリプトをコピー</a> を用いてイメージをコピーします。</p>\n<ul>\n<li>VM をイメージに対して起動する場合、そのイメージを AppVeyor で同時に使用することはできないため、VM をコピーする必要があります。</li>\n<li>このスクリプトを実行するために、Azure から取得したストレージアカウント名、キー、URI を使用します。<ul>\n<li>URI についてはステップ 3 を参照してください。プロンプトが表示されたら、エンターを押してコピー先となるように同じストレージアカウントを使用します。</li>\n<li>デフォルトのコピーされたコンテナ名 <code>(images)</code> を使用します</li>\n<li>また、コピーの名前を変更するときは、(変更されている場合は) 新しいイメージに含まれる内容と日付スタンプを示す名前を使用します。<ul>\n<li>例: <code>libcc-20core-vs2017-15.9-2019-04-15.vhd</code></li>\n</ul></li>\n</ul></li>\n<li>前の手順で説明したように、Azure に行き、新しく作成したイメージの URI を取得します。</li>\n</ul>\n</li>\n<li>\n<p><a href=\"https://github.com/appveyor/ci/blob/master/scripts/enterprise/create_master_vm_from_vhd.ps1\">VHD PowerShell からマスター VM を作成</a> を用いて新しい VM を起動します。</p>\n<ul>\n<li>PowerShell から、<code>./create_master_vm_from_vhd.ps1</code> のような <code>ps1</code> ファイルを実行します。</li>\n<li>AppVeyor ビルドクラウド定義で利用可能な認証情報が必要になります。<ul>\n<li>これは以下のものが含まれます。<ul>\n<li>クライアント ID</li>\n<li>クライアントの秘密</li>\n<li>テナント ID</li>\n<li>サブスクリプション ID</li>\n<li>リソースグループ</li>\n<li>仮想ネットワーク</li>\n</ul></li>\n</ul></li>\n<li>更に以下の指定が必要です<ul>\n<li>マスター VM 名 - 一時 VM を識別するための一意な名前です</li>\n<li>マスター VM 容量 - <code>Standard_F32s_v2</code> を使用します</li>\n<li>マスター VHD URI - 前のステップの最後で取得した URI を使用します</li>\n<li>位置情報は <code>East US</code> を使用します</li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Azure にログインし直して先ほど作成した VM を探します。ホーム &#x3C; 仮想マシン &#x3C; <code>$YOUR_NEW_VM</code> を見てください。</p>\n<ul>\n<li>RDP (Remote Desktop) ファイルをダウンロードして VM にアクセスできます。</li>\n</ul>\n</li>\n<li>\n<p>Microsoft リモート デスクトップを使用して、<code>接続</code> をクリックして VM に接続します。</p>\n<ul>\n<li>VM にログインするための認証情報は、LastPass の <code>AppVeyor Enterprise マスター VM</code> 認証情報下にあります。</li>\n</ul>\n</li>\n<li>\n<p>必要に応じて VM を変更してください。</p>\n</li>\n<li>\n<p>Azure で VM をシャットダウンして削除します。</p>\n</li>\n<li>\n<p>Appveyor クラウドの設定に新しいイメージを追加するか、新しい VHD を指すように既存のイメージを変更します。</p>\n</li>\n</ol>",
      "title": "Appveyor Azure イメージを更新する",
      "description": ""
    },
    "/docs/api/structures/bluetooth-device": {
      "locale": "ja-JP",
      "slug": "bluetooth-device",
      "href": "/docs/api/structures/bluetooth-device",
      "crowdinFileId": "256411",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/bluetooth-device.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"bluetoothdevice-object\"><a href=\"#bluetoothdevice-object\">BluetoothDevice Object</a></h1>\n<ul>\n<li><code>deviceName</code> String</li>\n<li><code>deviceId</code> String</li>\n</ul>",
      "title": "BluetoothDevice Object",
      "description": ""
    },
    "/docs/tutorial/boilerplates-and-clis": {
      "locale": "ja-JP",
      "slug": "boilerplates-and-clis",
      "href": "/docs/tutorial/boilerplates-and-clis",
      "crowdinFileId": "256181",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/boilerplates-and-clis.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ボイラープレートとcli\"><a href=\"#ボイラープレートとcli\">ボイラープレートとCLI</a></h1>\n<p>Electron での開発は特定のやり方に固執しておらず、開発、ビルド、パッケージ、リリースに「一つの正しいやり方」はありません。 Electron への追加機能は、ビルドと実行時の両方において、大抵の場合 <a href=\"https://www.npmjs.com/search?q=electron\">npm</a> 上で独立したパッケージとして見つけられます。開発者は必要なアプリとビルドパイプラインの両方を構築できます。</p>\n<p>このレベルのモジュール性と拡張性のために、チーム規模の大小を問わず、Electron を使用しているすべての開発者が、開発ライフサイクル中のいかなる可能なことも不可能なことも決して制限されません。 しかし、多くの開発者にとっては、コミュニティ主導のボイラープレートやコマンドラインツールを使用すると、アプリのコンパイル、パッケージ、リリースが劇的に簡単になるかもしれません。</p>\n<h2 id=\"ボイラープレート-vs-cli\"><a href=\"#ボイラープレート-vs-cli\">ボイラープレート vs CLI</a></h2>\n<p>ボイラープレートはアプリケーションを構築するためのスタート地点、いわばカンバスです。 通常、ボイラープレートはクローン可能なレポジトリとして提供され、自分の要求に応じたカスタマイズができます。</p>\n<p>一方で、コマンドラインツールは開発からリリースまでをサポートしてくれます。 より多くの点で開発を手助けしてくれますが、コードの構成やビルド方法についての制約を強制します。 <em>特に初心者はコマンドラインツールを使うのが良いでしょう。</em></p>\n<h2 id=\"electron-forge\"><a href=\"#electron-forge\">electron-forge</a></h2>\n<p>\"モダンなElectronアプリケーションを作成する完璧なツール\"。 Electron Forge は、既存の (よく保守されている) Electron 開発用のビルドツール群をまとまったパッケージに統合しており、誰でもすぐに Electron 開発に着手できるようにします。</p>\n<p>Forge には Webpack をバンドラーとして利用するための <a href=\"https://electronforge.io/templates\">即席テンプレート</a> があります。 Typescript の構成例が含まれており、簡単にカスタマイズできる構成ファイル 2 つが提供されています。 これは、大規模な Electron コミュニティで使用されているものと同じコアモジュールを使用しています (<a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a> など)。(Slack のような) Electron メンテナによる変更は、Forge のユーザにも有益です。</p>\n<p>詳細とドキュメントは <a href=\"https://electronforge.io/\">electronforge.io</a> で見ることができます。</p>\n<h2 id=\"electron-builder\"><a href=\"#electron-builder\">electron-builder</a></h2>\n<p>この \"Electron アプリをパッケージしてビルドして即配布できる完璧ソリューション\" は総合的な経験に焦点を当てています。 <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> は、単純さに重点を置いた単一の依存関係を1つ追加し、他の要件は内部で管理します。</p>\n<p><code>electron-builder</code> は、Electron メンテナー (自動更新プログラムなど) が使用する機能やモジュールをカスタムのものに置き換えます。 これらは一般的に緊密に統合されていますが、Atom、Visual Studio Code や、Slack のような人気のある Electron アプリケーションとの共通点は少なくなります。</p>\n<p>より詳しい情報やドキュメントは <a href=\"https://github.com/electron-userland/electron-builder\">レポジトリ</a> にあります。</p>\n<h2 id=\"electron-react-boilerplate\"><a href=\"#electron-react-boilerplate\">electron-react-boilerplate</a></h2>\n<p>ツールを使わずにしっかりしたボイラープレートのみを作成する場合、CT Lin の <a href=\"https://github.com/chentsulin/electron-react-boilerplate\"><code>electron-react-boilerplate</code></a> は一見の価値があるかもしれません。 これはコミュニティで非常に人気があり、<code>electron-builder</code> は内部で使用しています。</p>\n<h2 id=\"その他のツール、ボイラープレート\"><a href=\"#その他のツール、ボイラープレート\">その他のツール、ボイラープレート</a></h2>\n<p><a href=\"https://github.com/sindresorhus/awesome-electron#boilerplates\">\"Awesome Electron\" リスト</a> ではより多くのツールやボイラープレートを紹介しています。 リストの長さのあまり探すことに足がすくんでしまう場合は、ツールを追加することも有効な方法であることを忘れないでください。</p>",
      "title": "ボイラープレートとCLI",
      "description": ""
    },
    "/docs/breaking-changes": {
      "locale": "ja-JP",
      "slug": "breaking-changes",
      "href": "/docs/breaking-changes",
      "crowdinFileId": "256117",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/breaking-changes.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"破壊的変更\"><a href=\"#破壊的変更\">破壊的変更</a></h1>\n<p>破壊的な変更は変更の <a href=\"/docs/tutorial/electron-versioning#semver\">一つ前のメジャーバージョン</a> についてここに文書化され、可能であれば非推奨の警告を JS コードに加えます。</p>\n<h3 id=\"破壊的変更の種別\"><a href=\"#破壊的変更の種別\">破壊的変更の種別</a></h3>\n<p>このドキュメントでは、以下の規約によって破壊的な変更を分類しています。</p>\n<ul>\n<li><strong>API 変更:</strong> 古いコードで例外の発生が保証されるように API が変更されました。</li>\n<li><strong>動作変更:</strong> Electron の動作が変更されましたが、例外が必ず発生する訳ではありません。</li>\n<li><strong>省略値変更:</strong> 古い省略値に依存するコードは動かなくなるかもしれませんが、必ずしも例外は発生しません。 値を明示することで以前の動作に戻すことができます。</li>\n<li><strong>非推奨:</strong> API は非推奨になりました。 この API は引き続き機能しますが、非推奨の警告を発し、将来のリリースで削除されます。</li>\n<li><strong>削除:</strong> API または機能が削除され、Electron でサポートされなくなりました。</li>\n</ul>\n<h2 id=\"予定されている破壊的なapiの変更-140\"><a href=\"#予定されている破壊的なapiの変更-140\">予定されている破壊的なAPIの変更 (14.0)</a></h2>\n<h3 id=\"削除-remote-モジュール\"><a href=\"#削除-remote-モジュール\">削除: <code>remote</code> モジュール</a></h3>\n<p><code>remote</code> モジュールは Electron 12 で非推奨となりました。Electron 14 で削除される予定です。 これは <a href=\"https://github.com/electron/remote\"><code>@electron/remote</code></a> モジュールに置き換えられます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 12では非推奨:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// こちらに置換:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote'</span>)\n\n<span class=\"hljs-comment\">// メインプロセスでは:</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote/main'</span>).initialize()\n</code></pre>\n<h3 id=\"削除-appallowrendererprocessreuse\"><a href=\"#削除-appallowrendererprocessreuse\">削除: <code>app.allowRendererProcessReuse</code></a></h3>\n<p><code>app.allowRendererProcessReuse</code> プロパティは、セキュリティ、パフォーマンス、保守性のために Chromium のプロセスモデルとより密接に連携する計画の一環として削除されます。</p>\n<p>詳細は <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a> を参照してください。</p>\n<h3 id=\"削除-browser-window-の-affinity\"><a href=\"#削除-browser-window-の-affinity\">削除: Browser Window の Affinity</a></h3>\n<p><code>BrowserWindow</code> を新規構築する際の <code>affinity</code> オプションは、セキュリティ、パフォーマンス、保守性のために Chromium のプロセスモデルとの共同連携計画の一環として削除されます。</p>\n<p>詳細は <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a> を参照してください。</p>\n<h3 id=\"api-変更-windowopen\"><a href=\"#api-変更-windowopen\">API 変更: <code>window.open()</code></a></h3>\n<p>任意引数 <code>frameName</code> は、ウィンドウのタイトルに設定されなくなります。 これにより、<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters\">ネイティブの document</a> に対応するパラメータ <code>windowName</code> で説明されている仕様に従うことになりました。</p>\n<p>この引数でウィンドウのタイトルを設定していた場合は、代わりに <a href=\"/docs/api/browser-window#winsettitletitle\">win.setTitle(title)</a> を利用できます。</p>\n<h3 id=\"削除-worldsafeexecutejavascript\"><a href=\"#削除-worldsafeexecutejavascript\">削除: <code>worldSafeExecuteJavaScript</code></a></h3>\n<p>Electron 14 では、 <code>worldSafeExecuteJavaScript</code> が削除されます。  代替手段はありませんので、このプロパティが有効になった上でのコードの動作を確認してください。  これは Electron 12 からデフォルトで有効になっています。\n12.</p>\n<p><code>webFrame.executeJavaScript</code> か <code>webFrame.executeJavaScriptInIsolatedWorld</code> のいずれかを使用している場合、この変更の影響を受けます。 これらのメソッドは同じ値渡しセマンティクスを使用しているため、<a href=\"/docs/api/context-bridge#parameter--error--return-type-support\">Context Bridge API</a> がサポートしている戻り値かどうかを確認する必要があります。</p>\n<h3 id=\"省略値変更-nativewindowopen-の省略値を-true-に\"><a href=\"#省略値変更-nativewindowopen-の省略値を-true-に\">省略値変更: <code>nativeWindowOpen</code> の省略値を <code>true</code> に</a></h3>\n<p>Electron 14 より前の <code>window.open</code> は既定で <code>BrowserWindowProxy</code> を使用していました。 このため、<code>window.open('about:blank')</code> では同期的にスクリプトで操作可能な子ウィンドウを開くことができないなどといった、非互換性がありました。 <code>nativeWindowOpen</code> は実験的でなくなり、既定値になります。</p>\n<p>詳細については <a href=\"/docs/api/window-open\">Electron での window.open</a> をご参照ください</p>\n<h3 id=\"削除-親ウインドウからの-browserwindowconstructoroptions-の継承\"><a href=\"#削除-親ウインドウからの-browserwindowconstructoroptions-の継承\">削除: 親ウインドウからの BrowserWindowConstructorOptions の継承</a></h3>\n<p>Electron 14 より前は、<code>window.open</code> で開いたウインドウは、親ウインドウから <code>transparent</code> や <code>resizable</code> などの BrowserWindow コンストラクタのオプションを継承していました。 Electron 14 以降ではこの動作は削除され、ウインドウは親から BrowserWindow コンストラクタのオプションを継承しません。</p>\n<p>代わりに、<code>setWindowOpenHandler</code> で以下のように新しいウインドウのオプションを明示的に設定してください。</p>\n<pre><code class=\"hljs language-js\">webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n  <span class=\"hljs-keyword\">return</span> {\n    <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span>,\n    <span class=\"hljs-attr\">overrideBrowserWindowOptions</span>: {\n      <span class=\"hljs-comment\">// ...</span>\n    }\n  }\n})\n</code></pre>\n<h3 id=\"削除-additionalfeatures\"><a href=\"#削除-additionalfeatures\">削除: <code>additionalFeatures</code></a></h3>\n<p>WebContents の <code>new-window</code> イベントと <code>did-create-window</code> イベントの、非推奨となっていた <code>additionalFeatures</code> プロパティは削除されました。 <code>new-window</code> は引数の順番があるのでこの引数はまだ残りますが、常に空の配列 <code>[]</code> になります。 (ただし注意として、<code>new-window</code> イベント自体は非推奨であり <code>setWindowOpenHandler</code> に置き換えられます。) ウインドウ機能のキーに値が無い場合は、オプションオブジェクトで <code>true</code> の値を持つキーとして表示されるようになりました。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 14 で削除</span>\n<span class=\"hljs-comment\">// window.open('...', '', 'my-key') で動く</span>\nwebContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (<span class=\"hljs-built_in\">window</span>, details) => {\n  <span class=\"hljs-keyword\">if</span> (details.additionalFeatures.includes(<span class=\"hljs-string\">'my-key'</span>)) {\n    <span class=\"hljs-comment\">// ...</span>\n  }\n})\n\n<span class=\"hljs-comment\">// こちらに置換</span>\nwebContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (<span class=\"hljs-built_in\">window</span>, details) => {\n  <span class=\"hljs-keyword\">if</span> (details.options[<span class=\"hljs-string\">'my-key'</span>]) {\n    <span class=\"hljs-comment\">// ...</span>\n  }\n})\n</code></pre>\n<h2 id=\"予定されている破壊的なapiの変更-130\"><a href=\"#予定されている破壊的なapiの変更-130\">予定されている破壊的なAPIの変更 (13.0)</a></h2>\n<h3 id=\"api-変更-sessionsetpermissioncheckhandlerhandler\"><a href=\"#api-変更-sessionsetpermissioncheckhandlerhandler\">API 変更: <code>session.setPermissionCheckHandler(handler)</code></a></h3>\n<p><code>handler</code> メソッドの第 1 引数は、前までは必ず <code>webContents</code> でしたが、これからは <code>null</code> になることもあります。  <code>requestingOrigin</code>、<code>embeddingOrigin</code>、<code>securityOrigin</code> プロパティを使用して、権限の確認へ正しく対応する必要があります。  <code>webContents</code> が <code>null</code> になることがあるので、これに依存しないようにしてください。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 古いコード</span>\nsession.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (webContents.getURL().startsWith(<span class=\"hljs-string\">'https://google.com/'</span>) &#x26;&#x26; permission === <span class=\"hljs-string\">'notification'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n\n<span class=\"hljs-comment\">// こちらに置換</span>\nsession.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(requestingOrigin).hostname === <span class=\"hljs-string\">'google.com'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notification'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n</code></pre>\n<h3 id=\"削除-shellmoveitemtotrash\"><a href=\"#削除-shellmoveitemtotrash\">削除: <code>shell.moveItemToTrash()</code></a></h3>\n<p>非推奨となっていた同期型の <code>shell.moveItemToTrash()</code> API が削除されました。 代わりに非同期の <code>shell.trashItem()</code> を使用してください。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 13 では削除されます。</span>\nshell.moveItemToTrash(path)\n<span class=\"hljs-comment\">// 以下と置き換えてください</span>\nshell.trashItem(path).then(<span class=\"hljs-comment\">/* ... */</span>)\n</code></pre>\n<h3 id=\"削除-browserwindow-拡張機能-api\"><a href=\"#削除-browserwindow-拡張機能-api\">削除: <code>BrowserWindow</code> 拡張機能 API</a></h3>\n<p>以下の非推奨の API が削除されました。</p>\n<ul>\n<li><code>BrowserWindow.addExtension(path)</code></li>\n<li><code>BrowserWindow.addDevToolsExtension(path)</code></li>\n<li><code>BrowserWindow.removeExtension(name)</code></li>\n<li><code>BrowserWindow.removeDevToolsExtension(name)</code></li>\n<li><code>BrowserWindow.getExtensions()</code></li>\n<li><code>BrowserWindow.getDevToolsExtensions()</code></li>\n</ul>\n<p>代わりに以下の session API を使用してください。</p>\n<ul>\n<li><code>ses.loadExtension(path)</code></li>\n<li><code>ses.removeExtension(extension_id)</code></li>\n<li><code>ses.getAllExtensions()</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 13 で削除</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// こちらに置換</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 13 で削除</span>\nBrowserWindow.removeExtension(name)\nBrowserWindow.removeDevToolsExtension(name)\n<span class=\"hljs-comment\">// こちらに置換</span>\nsession.defaultSession.removeExtension(extension_id)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 13 で削除</span>\nBrowserWindow.getExtensions()\nBrowserWindow.getDevToolsExtensions()\n<span class=\"hljs-comment\">// こちらに置換</span>\nsession.defaultSession.getAllExtensions()\n</code></pre>\n<h3 id=\"削除した-systempreferences-のメソッド\"><a href=\"#削除した-systempreferences-のメソッド\">削除した <code>systemPreferences</code> のメソッド</a></h3>\n<p>以下の <code>systemPreferences</code> のメソッドは非推奨になりました。</p>\n<ul>\n<li><code>systemPreferences.isDarkMode()</code></li>\n<li><code>systemPreferences.isInvertedColorScheme()</code></li>\n<li><code>systemPreferences.isHighContrastColorScheme()</code></li>\n</ul>\n<p>代わりに、次の <code>nativeTheme</code> プロパティを使用します。</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code></li>\n<li><code>nativeTheme.shouldUseInvertedColorScheme</code></li>\n<li><code>nativeTheme.shouldUseHighContrastColors</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 13 で削除</span>\nsystemPreferences.isDarkMode()\n<span class=\"hljs-comment\">// こちらに置換</span>\nnativeTheme.shouldUseDarkColors\n\n<span class=\"hljs-comment\">// Electron 13 で削除</span>\nsystemPreferences.isInvertedColorScheme()\n<span class=\"hljs-comment\">// こちらに置換</span>\nnativeTheme.shouldUseInvertedColorScheme\n\n<span class=\"hljs-comment\">// Electron 13 で削除</span>\nsystemPreferences.isHighContrastColorScheme()\n<span class=\"hljs-comment\">// こちらに置換</span>\nnativeTheme.shouldUseHighContrastColors\n</code></pre>\n<h3 id=\"非推奨-webcontents-new-window-イベント\"><a href=\"#非推奨-webcontents-new-window-イベント\">非推奨: WebContents <code>new-window</code> イベント</a></h3>\n<p>WebContents の <code>new-window</code> イベントは非推奨となりました。 これは <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler()</code></a> に置き換えられます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 13 で非推奨</span>\nwebContents.on(<span class=\"hljs-string\">'new-window'</span>, (event) => {\n  event.preventDefault()\n})\n\n<span class=\"hljs-comment\">// こちらに置換</span>\nwebContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n</code></pre>\n<h2 id=\"予定されている破壊的なapiの変更-120\"><a href=\"#予定されている破壊的なapiの変更-120\">予定されている破壊的なAPIの変更 (12.0)</a></h2>\n<h3 id=\"削除-pepper-flash-サポート\"><a href=\"#削除-pepper-flash-サポート\">削除: Pepper Flash サポート</a></h3>\n<p>Chromium が Flash のサポートを削除したため、私たちもこれに従わなければなりません。 詳細については、Chromium の <a href=\"https://www.chromium.org/flash-roadmap\">Flash Roadmap</a> を参照してください。</p>\n<h3 id=\"省略値変更-worldsafeexecutejavascript-の省略値を-true-に\"><a href=\"#省略値変更-worldsafeexecutejavascript-の省略値を-true-に\">省略値変更: <code>worldSafeExecuteJavaScript</code> の省略値を <code>true</code> に</a></h3>\n<p>Electron 12 からは <code>worldSafeExecuteJavaScript</code> が既定で有効です。  以前の動作に戻すには、WebPreferences で <code>worldSafeExecuteJavaScript: false</code> を指定する必要があります。 このオプションを <code>false</code> に設定すると <strong>安全ではなくなる</strong> ことに注意してください。</p>\n<p>このオプションは Electron 14 で削除予定なので、デフォルト値をサポートするようにコードを移行してください。</p>\n<h3 id=\"省略値変更-contextisolation-の省略値を-true-に\"><a href=\"#省略値変更-contextisolation-の省略値を-true-に\">省略値変更: <code>contextIsolation</code> の省略値を <code>true</code> に</a></h3>\n<p>Electron 12 からは <code>contextIsolation</code> が既定で有効です。  以前の動作に戻すには、WebPreferences で <code>contextIsolation: false</code> を指定する必要があります。</p>\n<p>アプリケーションのセキュリティのために、<a href=\"/docs/tutorial/security#3-enable-context-isolation-for-remote-content\">contextIsolation の有効化を推奨します</a>。</p>\n<p>これは、<code>nodeIntegration</code> が <code>true</code> かつ <code>contextIsolation</code> が <code>false</code> でない限り、<code>require()</code> がレンダラープロセスで使用できなくなるということでもあります。</p>\n<p>詳細はこちら: <a href=\"https://github.com/electron/electron/issues/23506\">https://github.com/electron/electron/issues/23506</a></p>\n<h3 id=\"削除-crashreportergetcrashesdirectory\"><a href=\"#削除-crashreportergetcrashesdirectory\">削除: <code>crashReporter.getCrashesDirectory()</code></a></h3>\n<p><code>crashReporter.getCrashesDirectory</code> メソッドは削除されました。 <code>app.getPath('crashDumps)</code>に置き換える必要があります。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 12 で削除</span>\ncrashReporter.getCrashesDirectory()\n<span class=\"hljs-comment\">// こちらに置換</span>\napp.getPath(<span class=\"hljs-string\">'crashDumps'</span>)\n</code></pre>\n<h3 id=\"削除-レンダラープロセス内での-crashreporter-メソッド\"><a href=\"#削除-レンダラープロセス内での-crashreporter-メソッド\">削除: レンダラープロセス内での <code>crashReporter</code> メソッド</a></h3>\n<p>以下の <code>crashReporter</code> メソッドはレンダラープロセスで利用できなくなります。</p>\n<ul>\n<li><code>crashReporter.start</code></li>\n<li><code>crashReporter.getLastCrashReport</code></li>\n<li><code>crashReporter.getUploadedReports</code></li>\n<li><code>crashReporter.getUploadToServer</code></li>\n<li><code>crashReporter.setUploadToServer</code></li>\n<li><code>crashReporter.getCrashesDirectory</code></li>\n</ul>\n<p>これらは、メインプロセスから呼び出ことしかできません。</p>\n<p>詳しくは <a href=\"https://github.com/electron/electron/pull/23265\">#23265</a> を参照してください。</p>\n<h3 id=\"既定値の変更-crashreporterstart-compress-true-\"><a href=\"#既定値の変更-crashreporterstart-compress-true-\">既定値の変更: <code>crashReporter.start({ compress: true })</code></a></h3>\n<p><code>crashReporter.start</code> の <code>compress</code> オプションの既定値が <code>false</code> から <code>true</code> へ変更されました。 つまり、クラッシュのダンプは <code>Content-Encoding: gzip</code> ヘッダで、本文が圧縮されてクラッシュ収集サーバーにアップロードされます。</p>\n<p>クラッシュ収集サーバーが圧縮形式のペイロードをサポートしていない場合、クラッシュレポーターのオプションで <code>{ compress: false }</code> を指定すれば圧縮をオフにできます。</p>\n<h3 id=\"非推奨-remote-モジュール\"><a href=\"#非推奨-remote-モジュール\">非推奨: <code>remote</code> モジュール</a></h3>\n<p><code>remote</code> モジュールは Electron 12 で非推奨となり、Electron 14 で削除される予定です。 これは <a href=\"https://github.com/electron/remote\"><code>@electron/remote</code></a> モジュールに置き換えられます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 12では非推奨:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// こちらに置換:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote'</span>)\n\n<span class=\"hljs-comment\">// メインプロセスでは:</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote/main'</span>).initialize()\n</code></pre>\n<h3 id=\"非推奨-shellmoveitemtotrash\"><a href=\"#非推奨-shellmoveitemtotrash\">非推奨: <code>shell.moveItemToTrash()</code></a></h3>\n<p>同期的な <code>shell.moveItemToTrash()</code> は、新しく非同期的な <code>shell.trashItem()</code> に置き換えられました。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 12 では非推奨</span>\nshell.moveItemToTrash(path)\n<span class=\"hljs-comment\">// 以下と置き換えてください。</span>\nshell.trashItem(path).then(<span class=\"hljs-comment\">/* ... */</span>)\n</code></pre>\n<h2 id=\"予定されている破壊的なapiの変更-110\"><a href=\"#予定されている破壊的なapiの変更-110\">予定されている破壊的なAPIの変更 (11.0)</a></h2>\n<h3 id=\"削除-browserviewdestroy-fromid-fromwebcontents-getallviews-と-browserview-の-id-プロパティ\"><a href=\"#削除-browserviewdestroy-fromid-fromwebcontents-getallviews-と-browserview-の-id-プロパティ\">削除: <code>BrowserView.{destroy, fromId, fromWebContents, getAllViews}</code> と <code>BrowserView</code> の <code>id</code> プロパティ</a></h3>\n<p>実験的 API <code>BrowserView.{destroy, fromId, fromWebContents, getAllViews}</code> が削除されました。 加えて、<code>BrowserView</code> の <code>id</code> プロパティも削除されました。</p>\n<p>詳細な情報は、<a href=\"https://github.com/electron/electron/pull/23578\">#23578</a> を参照してください。</p>\n<h2 id=\"予定されている破壊的なapiの変更-100\"><a href=\"#予定されている破壊的なapiの変更-100\">予定されている破壊的なAPIの変更 (10.0)</a></h2>\n<h3 id=\"非推奨-crashreporterstart-関数のcompanyname-引数\"><a href=\"#非推奨-crashreporterstart-関数のcompanyname-引数\">非推奨: <code>crashReporter.start()</code> 関数の<code>companyName</code> 引数</a></h3>\n<p><code>crashReporter.start()</code>の引数の<code>companyName</code> は以前は必須でしたが、省略可能になり、今後廃止することになりました。 非推奨ではない方法で以前と同じ動作を実現するには、 <code>globalExtra </code> に<code>companyName</code> の値を渡します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 10 で非推奨</span>\ncrashReporter.start({ <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Umbrella Corporation'</span> })\n<span class=\"hljs-comment\">// 置き換え</span>\ncrashReporter.start({ <span class=\"hljs-attr\">globalExtra</span>: { <span class=\"hljs-attr\">_companyName</span>: <span class=\"hljs-string\">'Umbrella Corporation'</span> } })\n</code></pre>\n<h3 id=\"非推奨-crashreportergetcrashesdirectory\"><a href=\"#非推奨-crashreportergetcrashesdirectory\">非推奨: <code>crashReporter.getCrashesDirectory()</code></a></h3>\n<p><code>crashReporter.getCrashesDirectory</code> メソッドは非推奨となりました。 <code>app.getPath('crashDumps)</code>に置き換える必要があります。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 10 では非推奨</span>\ncrashReporter.getCrashesDirectory()\n<span class=\"hljs-comment\">// 置き換え</span>\napp.getPath(<span class=\"hljs-string\">'crashDumps'</span>)\n</code></pre>\n<h3 id=\"非推奨-レンダラープロセス内での-crashreporter-メソッド\"><a href=\"#非推奨-レンダラープロセス内での-crashreporter-メソッド\">非推奨: レンダラープロセス内での <code>crashReporter</code> メソッド</a></h3>\n<p>レンダラープロセスから以下の <code>crashReporter</code> メソッドを呼び出すことは非推奨になります。:</p>\n<ul>\n<li><code>crashReporter.start</code></li>\n<li><code>crashReporter.getLastCrashReport</code></li>\n<li><code>crashReporter.getUploadedReports</code></li>\n<li><code>crashReporter.getUploadToServer</code></li>\n<li><code>crashReporter.setUploadToServer</code></li>\n<li><code>crashReporter.getCrashesDirectory</code></li>\n</ul>\n<p>レンダラーの <code>crashReporter</code> モジュールに残っている非推奨ではないメソッドは、 <code>extraParameter</code>と <code>removeExtraParameter</code> と<code>getParameters</code>だけです。</p>\n<p>上記のすべてのメソッドは、メインプロセスから呼び出されたときに非推奨のままです。</p>\n<p>詳しくは <a href=\"https://github.com/electron/electron/pull/23265\">#23265</a> を参照してください。</p>\n<h3 id=\"非推奨-crashreporterstart-compress-false-\"><a href=\"#非推奨-crashreporterstart-compress-false-\">非推奨: <code>crashReporter.start({ compress: false })</code></a></h3>\n<p><code>crashReporter.start</code> に <code>{ compress: false }</code> を指定することは非推奨です。 ほぼすべてのクラッシュ収集サーバーは gzip 圧縮をサポートしているためです。 このオプションは将来バージョンの Electron で削除されます。</p>\n<h3 id=\"省略値変更-enableremotemodule-の省略値を-false-に\"><a href=\"#省略値変更-enableremotemodule-の省略値を-false-に\">省略値変更: <code>enableRemoteModule</code> の省略値を <code>false</code> に</a></h3>\n<p>Electron 9 では、<code>enableRemoteModule</code> WebPreferences オプションによって明示的に有効にせずに remote モジュールを使用すると、警告を出すようになりました。 Electron 10 では、remote モジュールはデフォルトで利用できなくなります。 remote モジュールを使用するには、以下のように WebPreferences で <code>enableRemoteModule: true</code> を指定する必要があります。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> w = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">enableRemoteModule</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<p>私たちは <a href=\"https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31\">remote モジュールから離れるように推奨しています</a>。</p>\n<h3 id=\"protocolunregisterprotocol\"><a href=\"#protocolunregisterprotocol\"><code>protocol.unregisterProtocol</code></a></h3>\n<h3 id=\"protocoluninterceptprotocol\"><a href=\"#protocoluninterceptprotocol\"><code>protocol.uninterceptProtocol</code></a></h3>\n<p>API は同期になり、任意のコールバックは不要になりました。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// 非推奨</span>\nprotocol.unregisterProtocol(scheme, () => { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// こちらに置換</span>\nprotocol.unregisterProtocol(scheme)\n</code></pre>\n<h3 id=\"protocolregisterfileprotocol\"><a href=\"#protocolregisterfileprotocol\"><code>protocol.registerFileProtocol</code></a></h3>\n<h3 id=\"protocolregisterbufferprotocol\"><a href=\"#protocolregisterbufferprotocol\"><code>protocol.registerBufferProtocol</code></a></h3>\n<h3 id=\"protocolregisterstringprotocol\"><a href=\"#protocolregisterstringprotocol\"><code>protocol.registerStringProtocol</code></a></h3>\n<h3 id=\"protocolregisterhttpprotocol\"><a href=\"#protocolregisterhttpprotocol\"><code>protocol.registerHttpProtocol</code></a></h3>\n<h3 id=\"protocolregisterstreamprotocol\"><a href=\"#protocolregisterstreamprotocol\"><code>protocol.registerStreamProtocol</code></a></h3>\n<h3 id=\"protocolinterceptfileprotocol\"><a href=\"#protocolinterceptfileprotocol\"><code>protocol.interceptFileProtocol</code></a></h3>\n<h3 id=\"protocolinterceptstringprotocol\"><a href=\"#protocolinterceptstringprotocol\"><code>protocol.interceptStringProtocol</code></a></h3>\n<h3 id=\"protocolinterceptbufferprotocol\"><a href=\"#protocolinterceptbufferprotocol\"><code>protocol.interceptBufferProtocol</code></a></h3>\n<h3 id=\"protocolintercepthttpprotocol\"><a href=\"#protocolintercepthttpprotocol\"><code>protocol.interceptHttpProtocol</code></a></h3>\n<h3 id=\"protocolinterceptstreamprotocol\"><a href=\"#protocolinterceptstreamprotocol\"><code>protocol.interceptStreamProtocol</code></a></h3>\n<p>API は同期になり、任意のコールバックは不要になりました。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// 非推奨</span>\nprotocol.registerFileProtocol(scheme, handler, () => { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// こちらに置換</span>\nprotocol.registerFileProtocol(scheme, handler)\n</code></pre>\n<p>登録または干渉されたプロトコルは、ナビゲーションが発生するまで現在のページに影響しません。</p>\n<h3 id=\"protocolisprotocolhandled\"><a href=\"#protocolisprotocolhandled\"><code>protocol.isProtocolHandled</code></a></h3>\n<p>この API は非推奨です。ユーザーは、代わりに <code>protocol.isProtocolRegistered</code> および <code>protocol.isProtocolIntercepted</code> を使用する必要があります。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// 非推奨</span>\nprotocol.isProtocolHandled(scheme).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// こちらに置換</span>\n<span class=\"hljs-keyword\">const</span> isRegistered = protocol.isProtocolRegistered(scheme)\n<span class=\"hljs-keyword\">const</span> isIntercepted = protocol.isProtocolIntercepted(scheme)\n</code></pre>\n<h2 id=\"予定されている破壊的なapiの変更-90\"><a href=\"#予定されている破壊的なapiの変更-90\">予定されている破壊的なAPIの変更 (9.0)</a></h2>\n<h3 id=\"省略値変更-レンダラープロセス内でコンテキスト未対応のネイティブモジュールのロードがデフォルトで無効に\"><a href=\"#省略値変更-レンダラープロセス内でコンテキスト未対応のネイティブモジュールのロードがデフォルトで無効に\">省略値変更: レンダラープロセス内でコンテキスト未対応のネイティブモジュールのロードがデフォルトで無効に</a></h3>\n<p>Electron 9 では、レンダラープロセスでコンテキスト未対応のネイティブモジュールをロードすることはできなくなります。  これは Electron のプロジェクトとしてのセキュリティ、パフォーマンス、保守性を向上させるためです。</p>\n<p>これが影響する場合、<code>app.allowRendererProcessReuse</code> を <code>false</code> に設定して一時的に以前の動作に戻すことができます。  このフラグは Electron 11 までの設定となっており、ネイティブモジュールを更新してコンテキストに対応する必要があります。</p>\n<p>詳細は <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a> を参照してください。</p>\n<h3 id=\"非推奨-browserwindow-拡張機能-api\"><a href=\"#非推奨-browserwindow-拡張機能-api\">非推奨: <code>BrowserWindow</code> 拡張機能 API</a></h3>\n<p>これらの拡張機能 API は非推奨になりました。</p>\n<ul>\n<li><code>BrowserWindow.addExtension(path)</code></li>\n<li><code>BrowserWindow.addDevToolsExtension(path)</code></li>\n<li><code>BrowserWindow.removeExtension(name)</code></li>\n<li><code>BrowserWindow.removeDevToolsExtension(name)</code></li>\n<li><code>BrowserWindow.getExtensions()</code></li>\n<li><code>BrowserWindow.getDevToolsExtensions()</code></li>\n</ul>\n<p>代わりに以下の session API を使用してください。</p>\n<ul>\n<li><code>ses.loadExtension(path)</code></li>\n<li><code>ses.removeExtension(extension_id)</code></li>\n<li><code>ses.getAllExtensions()</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 9 で非推奨化</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// こちらに置換</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 9 で非推奨化</span>\nBrowserWindow.removeExtension(name)\nBrowserWindow.removeDevToolsExtension(name)\n<span class=\"hljs-comment\">// こちらに置換</span>\nsession.defaultSession.removeExtension(extension_id)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 9 で非推奨化</span>\nBrowserWindow.getExtensions()\nBrowserWindow.getDevToolsExtensions()\n<span class=\"hljs-comment\">// こちらに置換</span>\nsession.defaultSession.getAllExtensions()\n</code></pre>\n<h3 id=\"削除-webviewgetwebcontents\"><a href=\"#削除-webviewgetwebcontents\">削除: <code>&#x3C;webview>.getWebContents()</code></a></h3>\n<p>Electron 8.0 で非推奨となっていた、この API は削除されました。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 9.0 で削除</span>\nwebview.getWebContents()\n<span class=\"hljs-comment\">// こちらに置換</span>\n<span class=\"hljs-keyword\">const</span> { remote } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nremote.webContents.fromId(webview.getWebContentsId())\n</code></pre>\n<h3 id=\"削除-webframesetlayoutzoomlevellimits\"><a href=\"#削除-webframesetlayoutzoomlevellimits\">削除: <code>webFrame.setLayoutZoomLevelLimits()</code></a></h3>\n<p>Chromium は、レイアウトのズームレベル制限を変更するサポートを削除しました。そのうえ、これは Elcetron でメンテナンスできるものではありません。 この関数は Electron 8.x で非推奨となり、Electron 9.x で削除されました。 レイアウトのズームレベル制限は、<a href=\"https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11\">こちら</a> で定義されているように最小 0.25 から最大 5.0 に固定されました。</p>\n<h3 id=\"動作変更-ipc-で非-js-オブジェクトを送信すると、例外が送出されるように\"><a href=\"#動作変更-ipc-で非-js-オブジェクトを送信すると、例外が送出されるように\">動作変更: IPC で非 JS オブジェクトを送信すると、例外が送出されるように</a></h3>\n<p>Electron 8.0 では、構造化複製アルゴリズムを使用するように IPC が変更され、パフォーマンスが大幅に改善されました。 移行を容易にするため、旧 IPC シリアライズアルゴリズムは、構造化複製でシリアライズできない一部のオブジェクトにそのまま使用されます。 特に、DOM オブジェクト (<code>Element</code>、<code>Location</code>、<code>DOMMatrix</code> など)、内部に C++ のクラスがある Node.js オブジェクト (<code>process.env</code>、<code>Stream</code> のいくつかのメンバーなど)、内部に C++ のクラスがある Electron オブジェクト (<code>WebContents</code>、<code>BrowserWindow</code>、<code>WebFrame</code> など) は、構造化複製ではシリアライズできません。 旧アルゴリズムが呼び出されるたびに、非推奨の警告が出力されます。</p>\n<p>Electron 9.0 では、旧シリアライズアルゴリズムが削除されました。先ほどのシリアライズ不可能なオブジェクトを送信すると、\"object could not be cloned\" (オブジェクトを複製できませんでした) というエラーが送出されます。</p>\n<h3 id=\"api-変更-shellopenitem-は-shellopenpath-に\"><a href=\"#api-変更-shellopenitem-は-shellopenpath-に\">API 変更: <code>shell.openItem</code> は <code>shell.openPath</code> に</a></h3>\n<p><code>shell.openItem</code> API は非同期の <code>shell.openPath</code> API に置き換えられました。 元の API の提案と理由は <a href=\"https://github.com/electron/governance/blob/main/wg-api/spec-documents/shell-openitem.md\">こちら</a> で確認できます。</p>\n<h2 id=\"予定されている破壊的なapiの変更-80\"><a href=\"#予定されている破壊的なapiの変更-80\">予定されている破壊的なAPIの変更 (8.0)</a></h2>\n<h3 id=\"動作変更-ipc-を介して送信される値が構造化複製アルゴリズムでシリアライズされるように\"><a href=\"#動作変更-ipc-を介して送信される値が構造化複製アルゴリズムでシリアライズされるように\">動作変更: IPC を介して送信される値が構造化複製アルゴリズムでシリアライズされるように</a></h3>\n<p>IPC を介して (<code>ipcRenderer.send</code>、<code>ipcRenderer.sendSync</code>、<code>WebContents.send</code> 及び関連メソッドから) オブジェクトを送信できます。このオブジェクトのシリアライズに使用されるアルゴリズムが、カスタムアルゴリズムから V8 組み込みの <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">構造化複製アルゴリズム</a> に切り替わります。これは <code>postMessage</code> のメッセージのシリアライズに使用されるものと同じアルゴリズムです。 これにより、大きなメッセージに対するパフォーマンスが 2 倍向上しますが、動作に重大な変更が加えられます。</p>\n<ul>\n<li>関数、Promise、WeakMap、WeakSet、これらの値を含むオブジェクトを IPC 経由で送信すると、関数らを暗黙的に <code>undefined</code> に変換していましたが、代わりに例外が送出されるようになります。</li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 以前:</span>\nipcRenderer.send(<span class=\"hljs-string\">'channel'</span>, { <span class=\"hljs-attr\">value</span>: <span class=\"hljs-number\">3</span>, <span class=\"hljs-attr\">someFunction</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {} })\n<span class=\"hljs-comment\">// => メインプロセスに { value: 3 } が着く</span>\n\n<span class=\"hljs-comment\">// Electron 8 から:</span>\nipcRenderer.send(<span class=\"hljs-string\">'channel'</span>, { <span class=\"hljs-attr\">value</span>: <span class=\"hljs-number\">3</span>, <span class=\"hljs-attr\">someFunction</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {} })\n<span class=\"hljs-comment\">// => Error(\"() => {} could not be cloned.\") を投げる</span>\n</code></pre>\n<ul>\n<li><code>NaN</code>、<code>Infinity</code>、<code>-Infinity</code> は、<code>null</code> に変換するのではなく、正しくシリアライズします。</li>\n<li>循環参照を含むオブジェクトは、<code>null</code> に変換するのではなく、正しくシリアライズします。</li>\n<li><code>Set</code>、<code>Map</code>、<code>Error</code>、<code>RegExp</code> の値は、<code>{}</code> に変換するのではなく、正しくシリアライズします。</li>\n<li><code>BigInt</code> の値は、<code>null</code> に変換するのではなく、正しくシリアライズします。</li>\n<li>疎配列は、<code>null</code> の密配列に変換するのではなく、そのままシリアライズします。</li>\n<li><code>Date</code> オブジェクトは、ISO 文字列表現に変換するのではなく、<code>Date</code> オブジェクトとして転送します。</li>\n<li>型付き配列 (<code>Uint8Array</code>、<code>Uint16Array</code>、<code>Uint32Array</code> など) は、Node.js の <code>Buffer</code> に変換するのではなく、そのまま転送します。</li>\n<li>Node.js の <code>Buffer</code> オブジェクトは、<code>Uint8Array</code> として転送します。 基底となる <code>ArrayBuffer</code> をラップすることで、<code>Uint8Array</code> を Node.js の <code>Buffer</code> に変換できます。</li>\n</ul>\n<pre><code class=\"hljs language-js\">Buffer.from(value.buffer, value.byteOffset, value.byteLength)\n</code></pre>\n<p>ネイティブな JS 型ではないオブジェクト、すなわち DOM オブジェクト (<code>Element</code>、<code>Location</code>、<code>DOMMatrix</code> など)、Node.js オブジェクト (<code>process.env</code>、<code>Stream</code> のいくつかのメンバーなど)、Electron オブジェクト (<code>WebContents</code>、<code>BrowserWindow</code>、<code>WebFrame</code> など) のようなものは非推奨です。 Electron 8 では、これらのオブジェクトは DeprecationWarning メッセージで以前と同様にシリアライズされます。しかし、Electron 9 以降でこういった類のオブジェクトを送信すると \"could not be cloned\" エラーが送出されます。</p>\n<h3 id=\"非推奨-webviewgetwebcontents\"><a href=\"#非推奨-webviewgetwebcontents\">非推奨: <code>&#x3C;webview>.getWebContents()</code></a></h3>\n<p>この API は、パフォーマンスとセキュリティの両方に影響する <code>remote</code> モジュールを使用して実装されます。 したがって、その用途がはっきりとしている必要があります。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\nwebview.getWebContents()\n<span class=\"hljs-comment\">// こちらに置換</span>\n<span class=\"hljs-keyword\">const</span> { remote } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nremote.webContents.fromId(webview.getWebContentsId())\n</code></pre>\n<p>ただし、<code>remote</code> モジュールをできる限り使用しないことを推奨します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// メイン</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain, webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> getGuestForWebContents = <span class=\"hljs-function\">(<span class=\"hljs-params\">webContentsId, contents</span>) =></span> {\n  <span class=\"hljs-keyword\">const</span> guest = webContents.fromId(webContentsId)\n  <span class=\"hljs-keyword\">if</span> (!guest) {\n    <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">`Invalid webContentsId: <span class=\"hljs-subst\">${webContentsId}</span>`</span>)\n  }\n  <span class=\"hljs-keyword\">if</span> (guest.hostWebContents !== contents) {\n    <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Access denied to webContents'</span>)\n  }\n  <span class=\"hljs-keyword\">return</span> guest\n}\n\nipcMain.handle(<span class=\"hljs-string\">'openDevTools'</span>, (event, webContentsId) => {\n  <span class=\"hljs-keyword\">const</span> guest = getGuestForWebContents(webContentsId, event.sender)\n  guest.openDevTools()\n})\n\n<span class=\"hljs-comment\">// レンダラー</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nipcRenderer.invoke(<span class=\"hljs-string\">'openDevTools'</span>, webview.getWebContentsId())\n</code></pre>\n<h3 id=\"非推奨-webframesetlayoutzoomlevellimits\"><a href=\"#非推奨-webframesetlayoutzoomlevellimits\">非推奨: <code>webFrame.setLayoutZoomLevelLimits()</code></a></h3>\n<p>Chromium は、レイアウトのズームレベル制限を変更するサポートを削除しました。そのうえ、これは Elcetron でメンテナンスできるものではありません。 この関数は Electron 8.x に警告を出力し、Electron 9.x に存在しなくなります。 レイアウトのズームレベル制限は、<a href=\"https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11\">こちら</a> で定義されているように最小 0.25 から最大 5.0 に固定されました。</p>\n<h3 id=\"非推奨化した-systempreferences-のイベント\"><a href=\"#非推奨化した-systempreferences-のイベント\">非推奨化した <code>systemPreferences</code> のイベント</a></h3>\n<p>以下の <code>systemPreferences</code> のイベントは非推奨になりました。</p>\n<ul>\n<li><code>inverted-color-scheme-changed</code></li>\n<li><code>high-contrast-color-scheme-changed</code></li>\n</ul>\n<p>代わりに <code>nativeTheme</code> の新しいイベントである <code>updated</code> を使用してください。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\nsystemPreferences.on(<span class=\"hljs-string\">'inverted-color-scheme-changed'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\nsystemPreferences.on(<span class=\"hljs-string\">'high-contrast-color-scheme-changed'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\n\n<span class=\"hljs-comment\">// こちらに置換</span>\nnativeTheme.on(<span class=\"hljs-string\">'updated'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\n</code></pre>\n<h3 id=\"非推奨化した-systempreferences-のメソッド\"><a href=\"#非推奨化した-systempreferences-のメソッド\">非推奨化した <code>systemPreferences</code> のメソッド</a></h3>\n<p>以下の <code>systemPreferences</code> のメソッドは非推奨になりました。</p>\n<ul>\n<li><code>systemPreferences.isDarkMode()</code></li>\n<li><code>systemPreferences.isInvertedColorScheme()</code></li>\n<li><code>systemPreferences.isHighContrastColorScheme()</code></li>\n</ul>\n<p>代わりに、次の <code>nativeTheme</code> プロパティを使用します。</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code></li>\n<li><code>nativeTheme.shouldUseInvertedColorScheme</code></li>\n<li><code>nativeTheme.shouldUseHighContrastColors</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.isDarkMode()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseDarkColors\n\n<span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.isInvertedColorScheme()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseInvertedColorScheme\n\n<span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.isHighContrastColorScheme()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseHighContrastC\n</code></pre>\n<h2 id=\"予定されている破壊的なapiの変更-70\"><a href=\"#予定されている破壊的なapiの変更-70\">予定されている破壊的なAPIの変更 (7.0)</a></h2>\n<h3 id=\"非推奨-atomio-の-node-ヘッダー-url\"><a href=\"#非推奨-atomio-の-node-ヘッダー-url\">非推奨: Atom.io の Node ヘッダー URL</a></h3>\n<p>これは <code>.npmrc</code> ファイル内の <code>disturl</code> か、ネイティブ Node モジュールをビルドするときの <code>--dist-url</code> コマンドライン引数で指定する URL です。  両方とも近い将来サポートされますが、切り替えることを推奨します。</p>\n<p>非推奨: <a href=\"https://atom.io/download/electron\">https://atom.io/download/electron</a></p>\n<p>こちらに置換: <a href=\"https://electronjs.org/headers\">https://electronjs.org/headers</a></p>\n<h3 id=\"api-変更-sessionclearauthcache-が引数を受け取らないように\"><a href=\"#api-変更-sessionclearauthcache-が引数を受け取らないように\">API 変更: <code>session.clearAuthCache()</code> が引数を受け取らないように</a></h3>\n<p><code>session.clearAuthCache</code> API は、消去対象のオプションを受け入れなくなり、代わりにキャッシュ全体を無条件に消去します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\nsession.clearAuthCache({ <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'password'</span> })\n<span class=\"hljs-comment\">// こちらに置換</span>\nsession.clearAuthCache()\n</code></pre>\n<h3 id=\"api-変更-powermonitorquerysystemidlestate-は-powermonitorgetsystemidlestate-に\"><a href=\"#api-変更-powermonitorquerysystemidlestate-は-powermonitorgetsystemidlestate-に\">API 変更: <code>powerMonitor.querySystemIdleState</code> は <code>powerMonitor.getSystemIdleState</code> に</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 7.0 で削除</span>\npowerMonitor.querySystemIdleState(threshold, callback)\n<span class=\"hljs-comment\">// こちらの非同期 API に置換</span>\n<span class=\"hljs-keyword\">const</span> idleState = powerMonitor.getSystemIdleState(threshold)\n</code></pre>\n<h3 id=\"api-変更-powermonitorquerysystemidletime-は-powermonitorgetsystemidletime-に\"><a href=\"#api-変更-powermonitorquerysystemidletime-は-powermonitorgetsystemidletime-に\">API 変更: <code>powerMonitor.querySystemIdleTime</code> は <code>powerMonitor.getSystemIdleTime</code> に</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 7.0 で削除</span>\npowerMonitor.querySystemIdleTime(callback)\n<span class=\"hljs-comment\">// こちらの非同期 API に置換</span>\n<span class=\"hljs-keyword\">const</span> idleTime = powerMonitor.getSystemIdleTime()\n</code></pre>\n<h3 id=\"api-変更-webframesetisolatedworldinfo-で分散したメソッドを置換\"><a href=\"#api-変更-webframesetisolatedworldinfo-で分散したメソッドを置換\">API 変更: <code>webFrame.setIsolatedWorldInfo</code> で分散したメソッドを置換</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Electron 7.0 で削除</span>\nwebFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)\nwebFrame.setIsolatedWorldHumanReadableName(worldId, name)\nwebFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)\n<span class=\"hljs-comment\">// こちらに置換</span>\nwebFrame.setIsolatedWorldInfo(\n  worldId,\n  {\n    <span class=\"hljs-attr\">securityOrigin</span>: <span class=\"hljs-string\">'some_origin'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'human_readable_name'</span>,\n    <span class=\"hljs-attr\">csp</span>: <span class=\"hljs-string\">'content_security_policy'</span>\n  })\n</code></pre>\n<h3 id=\"削除-getblinkmemoryinfo-の-marked-プロパティ\"><a href=\"#削除-getblinkmemoryinfo-の-marked-プロパティ\">削除: <code>getBlinkMemoryInfo</code> の <code>marked</code> プロパティ</a></h3>\n<p>このプロパティは Chromium 77 で削除されたため、利用できなくなりました。</p>\n<h3 id=\"動作変更-input-typefile-の-webkitdirectory-属性でディレクトリの内容を取るように\"><a href=\"#動作変更-input-typefile-の-webkitdirectory-属性でディレクトリの内容を取るように\">動作変更: <code>&#x3C;input type=\"file\"/></code> の <code>webkitdirectory</code> 属性でディレクトリの内容を取るように</a></h3>\n<p><code>webkitdirectory</code> プロパティは、HTML ファイル上の input でフォルダーを選択できるようにします。 以前の Electron のバージョンでは、input の <code>event.target.files</code> において、選択したフォルダーに対応する 1 つの <code>File</code> が入った <code>FileList</code> を返すという誤った実装がありました。</p>\n<p>Electron 7 では、Chrome、Firefox、Edge と同様 (<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory\">MDNドキュメントへのリンク</a>) に、<code>FileList</code> はフォルダー内に含まれるすべてのファイルのリストになりました。</p>\n<p>例として、以下の構造のフォルダーを使用します。</p>\n<pre><code class=\"hljs language-console\">folder\n├── file1\n├── file2\n└── file3\n</code></pre>\n<p>Electron &#x3C;= 6 では、以下のような <code>File</code> オブジェクトが 1 つ入った <code>FileList</code> を返します。</p>\n<pre><code class=\"hljs language-console\">path/to/folder\n</code></pre>\n<p>Electron 7 では、以下のような <code>File</code> オブジェクトが入った <code>FileList</code> を返します。</p>\n<pre><code class=\"hljs language-console\">/path/to/folder/file3\n/path/to/folder/file2\n/path/to/folder/file1\n</code></pre>\n<p><code>webkitdirectory</code> は、選択したフォルダーへのパスを公開しないことに注意してください。 フォルダーの内容ではなく選択したフォルダーへのパスが必要な場合は、<code>dialog.showOpenDialog</code> API (<a href=\"/docs/api/dialog#dialogshowopendialogbrowserwindow-options\">リンク</a>) を参照してください。</p>\n<h3 id=\"api-変更-promise-ベースの-api-の-callback-ベース版\"><a href=\"#api-変更-promise-ベースの-api-の-callback-ベース版\">API 変更: Promise ベースの API の Callback ベース版</a></h3>\n<p>Electron 5 とElectron 6 では、既存の非同期 API の Promise ベース版を導入し、対応する古いコールバックベースのものは非推奨にしました。 Electron 7 では、非推奨のコールバックベースの API がすべて削除されます。</p>\n<p>これらの関数は Promise を返すようになりました。</p>\n<ul>\n<li><code>app.getFileIcon()</code> <a href=\"https://github.com/electron/electron/pull/15742\">#15742</a></li>\n<li><code>app.dock.show()</code> <a href=\"https://github.com/electron/electron/pull/16904\">#16904</a></li>\n<li><code>contentTracing.getCategories()</code> <a href=\"https://github.com/electron/electron/pull/16583\">#16583</a></li>\n<li><code>contentTracing.getTraceBufferUsage()</code> <a href=\"https://github.com/electron/electron/pull/16600\">#16600</a></li>\n<li><code>contentTracing.startRecording()</code> <a href=\"https://github.com/electron/electron/pull/16584\">#16584</a></li>\n<li><code>contentTracing.stopRecording()</code> <a href=\"https://github.com/electron/electron/pull/16584\">#16584</a></li>\n<li><code>contents.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>cookies.flushStore()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.get()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.remove()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.set()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>debugger.sendCommand()</code> <a href=\"https://github.com/electron/electron/pull/16861\">#16861</a></li>\n<li><code>dialog.showCertificateTrustDialog()</code> <a href=\"https://github.com/electron/electron/pull/17181\">#17181</a></li>\n<li><code>inAppPurchase.getProducts()</code> <a href=\"https://github.com/electron/electron/pull/17355\">#17355</a></li>\n<li><code>inAppPurchase.purchaseProduct()</code><a href=\"https://github.com/electron/electron/pull/17355\">#17355</a></li>\n<li><code>netLog.stopLogging()</code> <a href=\"https://github.com/electron/electron/pull/16862\">#16862</a></li>\n<li><code>session.clearAuthCache()</code> <a href=\"https://github.com/electron/electron/pull/17259\">#17259</a></li>\n<li><code>session.clearCache()</code>  <a href=\"https://github.com/electron/electron/pull/17185\">#17185</a></li>\n<li><code>session.clearHostResolverCache()</code> <a href=\"https://github.com/electron/electron/pull/17229\">#17229</a></li>\n<li><code>session.clearStorageData()</code> <a href=\"https://github.com/electron/electron/pull/17249\">#17249</a></li>\n<li><code>session.getBlobData()</code> <a href=\"https://github.com/electron/electron/pull/17303\">#17303</a></li>\n<li><code>session.getCacheSize()</code>  <a href=\"https://github.com/electron/electron/pull/17185\">#17185</a></li>\n<li><code>session.resolveProxy()</code> <a href=\"https://github.com/electron/electron/pull/17222\">#17222</a></li>\n<li><code>session.setProxy()</code>  <a href=\"https://github.com/electron/electron/pull/17222\">#17222</a></li>\n<li><code>shell.openExternal()</code> <a href=\"https://github.com/electron/electron/pull/16176\">#16176</a></li>\n<li><code>webContents.loadFile()</code> <a href=\"https://github.com/electron/electron/pull/15855\">#15855</a></li>\n<li><code>webContents.loadURL()</code> <a href=\"https://github.com/electron/electron/pull/15855\">#15855</a></li>\n<li><code>webContents.hasServiceWorker()</code> <a href=\"https://github.com/electron/electron/pull/16535\">#16535</a></li>\n<li><code>webContents.printToPDF()</code> <a href=\"https://github.com/electron/electron/pull/16795\">#16795</a></li>\n<li><code>webContents.savePage()</code> <a href=\"https://github.com/electron/electron/pull/16742\">#16742</a></li>\n<li><code>webFrame.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>webFrame.executeJavaScriptInIsolatedWorld()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>webviewTag.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>win.capturePage()</code> <a href=\"https://github.com/electron/electron/pull/15743\">#15743</a></li>\n</ul>\n<p>これらの関数には、同期と Promise ベースの非同期、2 つの形式があります。</p>\n<ul>\n<li><code>dialog.showMessageBox()</code>/<code>dialog.showMessageBoxSync()</code> <a href=\"https://github.com/electron/electron/pull/17298\">#17298</a></li>\n<li><code>dialog.showOpenDialog()</code>/<code>dialog.showOpenDialogSync()</code> <a href=\"https://github.com/electron/electron/pull/16973\">#16973</a></li>\n<li><code>dialog.showSaveDialog()</code>/<code>dialog.showSaveDialogSync()</code> <a href=\"https://github.com/electron/electron/pull/17054\">#17054</a></li>\n</ul>\n<h2 id=\"予定されている破壊的なapiの変更-60\"><a href=\"#予定されている破壊的なapiの変更-60\">予定されている破壊的なAPIの変更 (6.0)</a></h2>\n<h3 id=\"api-変更-winsetmenunull-は-winremovemenu-に\"><a href=\"#api-変更-winsetmenunull-は-winremovemenu-に\">API 変更: <code>win.setMenu(null)</code> は <code>win.removeMenu()</code> に</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\nwin.setMenu(<span class=\"hljs-literal\">null</span>)\n<span class=\"hljs-comment\">// こちらに置換</span>\nwin.removeMenu()\n</code></pre>\n<h3 id=\"api-変更-レンダラープロセスの-electronscreen-が-remote-を介してアクセスするように\"><a href=\"#api-変更-レンダラープロセスの-electronscreen-が-remote-を介してアクセスするように\">API 変更: レンダラープロセスの <code>electron.screen</code> が <code>remote</code> を介してアクセスするように</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).screen\n<span class=\"hljs-comment\">// こちらに置換</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.screen\n</code></pre>\n<h3 id=\"api-変更-サンドボックスレンダラー内の-node-組み込みの-require-で-remote-のものを読み込まないように\"><a href=\"#api-変更-サンドボックスレンダラー内の-node-組み込みの-require-で-remote-のものを読み込まないように\">API 変更: サンドボックスレンダラー内の Node 組み込みの <code>require()</code> で <code>remote</code> のものを読み込まないように</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'child_process'</span>)\n<span class=\"hljs-comment\">// こちらに置換</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'child_process'</span>)\n\n<span class=\"hljs-comment\">// 非推奨</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-comment\">// こちらに置換</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-comment\">// 非推奨</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n<span class=\"hljs-comment\">// こちらに置換</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'os'</span>)\n\n<span class=\"hljs-comment\">// 非推奨</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n<span class=\"hljs-comment\">// こちらに置換</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'path'</span>)\n</code></pre>\n<h3 id=\"非推奨-powermonitorquerysystemidlestate-を-powermonitorgetsystemidlestate-で置換\"><a href=\"#非推奨-powermonitorquerysystemidlestate-を-powermonitorgetsystemidlestate-で置換\">非推奨: <code>powerMonitor.querySystemIdleState</code> を <code>powerMonitor.getSystemIdleState</code> で置換</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\npowerMonitor.querySystemIdleState(threshold, callback)\n<span class=\"hljs-comment\">// こちらの非同期 API に置換</span>\n<span class=\"hljs-keyword\">const</span> idleState = powerMonitor.getSystemIdleState(threshold)\n</code></pre>\n<h3 id=\"非推奨-powermonitorquerysystemidletime-を-powermonitorgetsystemidletime-で置換\"><a href=\"#非推奨-powermonitorquerysystemidletime-を-powermonitorgetsystemidletime-で置換\">非推奨: <code>powerMonitor.querySystemIdleTime</code> を <code>powerMonitor.getSystemIdleTime</code> で置換</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\npowerMonitor.querySystemIdleTime(callback)\n<span class=\"hljs-comment\">// こちらの非同期 API に置換</span>\n<span class=\"hljs-keyword\">const</span> idleTime = powerMonitor.getSystemIdleTime()\n</code></pre>\n<h3 id=\"非推奨-appenablemixedsandbox-が不要に\"><a href=\"#非推奨-appenablemixedsandbox-が不要に\">非推奨: <code>app.enableMixedSandbox()</code> が不要に</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\napp.enableMixedSandbox()\n</code></pre>\n<p>混合サンドボックスモードはデフォルトで有効になりました。</p>\n<h3 id=\"非推奨-traysethighlightmode\"><a href=\"#非推奨-traysethighlightmode\">非推奨: <code>Tray.setHighlightMode</code></a></h3>\n<p>macOS Catalina 下では、以前の Tray 実装は破壊されています。 Apple のネイティブの代替実装は、強調表示動作の変更をサポートしていません。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\ntray.setHighlightMode(mode)\n<span class=\"hljs-comment\">// API は v7.0 で削除され、置換はできません</span>\n</code></pre>\n<h2 id=\"予定されている破壊的なapiの変更-50\"><a href=\"#予定されている破壊的なapiの変更-50\">予定されている破壊的なAPIの変更 (5.0)</a></h2>\n<h3 id=\"省略値変更-nodeintegration-と-webviewtag-の省略値は-false-に、contextisolation-の省略値は-true-に\"><a href=\"#省略値変更-nodeintegration-と-webviewtag-の省略値は-false-に、contextisolation-の省略値は-true-に\">省略値変更: <code>nodeIntegration</code> と <code>webviewTag</code> の省略値は false に、<code>contextIsolation</code> の省略値は true に</a></h3>\n<p>以下の <code>webPreferences</code> オプションの初期値は、以下の記載された新しい初期値のために非推奨になっています。</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>属性</th><th>非推奨の初期値</th><th>新しい初期値</th></tr></thead><tbody><tr><td><code>contextIsolation</code></td><td><code>false</code></td><td><code>true</code></td></tr><tr><td><code>nodeIntegration</code></td><td><code>true</code></td><td><code>false</code></td></tr><tr><td><code>webviewTag</code></td><td><code>nodeIntegration</code> を設定しなければ <code>true</code></td><td><code>false</code></td></tr></tbody></table>\n<p>以下は例です。 webviewTag を再有効化しています。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> w = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">webviewTag</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h3 id=\"動作変更-子ウインドウ内の-nodeintegration-は-nativewindowopen-を介して開かれるように\"><a href=\"#動作変更-子ウインドウ内の-nodeintegration-は-nativewindowopen-を介して開かれるように\">動作変更: 子ウインドウ内の <code>nodeIntegration</code> は <code>nativeWindowOpen</code> を介して開かれるように</a></h3>\n<p><code>nativeWindowOpen</code> オプションで開かれる子ウインドウは、<code>nodeIntegrationInSubFrames</code> が <code>true</code> でなければ Node.js インテグレーションが無効化されます。</p>\n<h3 id=\"api-変更-特権スキームの登録は-app-の-ready-より前に行わなければならないように\"><a href=\"#api-変更-特権スキームの登録は-app-の-ready-より前に行わなければならないように\">API 変更: 特権スキームの登録は app の ready より前に行わなければならないように</a></h3>\n<p>レンダラプロセス API <code>webFrame.registerURLSchemeAsPrivileged </code> と <code>webFrame.registerURLSchemeAsBypassingCSP</code>、ならびにブラウザプロセス API <code>protocol.registerStandardSchemes</code> を削除しました。 新しい API <code>protocol.registerSchemesAsPrivileged</code> が追加されました。これらは、必要な権限でカスタムスキームを登録するために使用する必要があります。 カスタムスキームは、アプリの準備が整う前に登録する必要があります。</p>\n<h3 id=\"非推奨-webframesetisolatedworld-を-webframesetisolatedworldinfo-で置換\"><a href=\"#非推奨-webframesetisolatedworld-を-webframesetisolatedworldinfo-で置換\">非推奨: <code>webFrame.setIsolatedWorld*</code> を <code>webFrame.setIsolatedWorldInfo</code> で置換</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\nwebFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)\nwebFrame.setIsolatedWorldHumanReadableName(worldId, name)\nwebFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)\n<span class=\"hljs-comment\">// こちらに置換</span>\nwebFrame.setIsolatedWorldInfo(\n  worldId,\n  {\n    <span class=\"hljs-attr\">securityOrigin</span>: <span class=\"hljs-string\">'some_origin'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'human_readable_name'</span>,\n    <span class=\"hljs-attr\">csp</span>: <span class=\"hljs-string\">'content_security_policy'</span>\n  })\n</code></pre>\n<h3 id=\"api-変更-webframesetspellcheckprovider-が非同期コールバックを取るように\"><a href=\"#api-変更-webframesetspellcheckprovider-が非同期コールバックを取るように\">API 変更: <code>webFrame.setSpellCheckProvider</code> が非同期コールバックを取るように</a></h3>\n<p><code>spellCheck</code> コールバックは非同期になり、<code>autoCorrectWord</code> パラメーターは削除されました。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, <span class=\"hljs-literal\">true</span>, {\n  <span class=\"hljs-attr\">spellCheck</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">text</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> !spellchecker.isMisspelled(text)\n  }\n})\n<span class=\"hljs-comment\">// こちらに置換</span>\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, {\n  <span class=\"hljs-attr\">spellCheck</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">words, callback</span>) =></span> {\n    callback(words.filter(<span class=\"hljs-function\"><span class=\"hljs-params\">text</span> =></span> spellchecker.isMisspelled(text)))\n  }\n})\n</code></pre>\n<h3 id=\"api-変更-webcontentsgetzoomlevel-と-webcontentsgetzoomfactor-が同期実行に\"><a href=\"#api-変更-webcontentsgetzoomlevel-と-webcontentsgetzoomfactor-が同期実行に\">API 変更: <code>webContents.getZoomLevel</code> と <code>webContents.getZoomFactor</code> が同期実行に</a></h3>\n<p><code>webContents.getZoomLevel</code> と <code>webContents.getZoomFactor</code> はコールバック引数を受け取らなくなり、代わりに数値を直接返すようになります。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\nwebContents.getZoomLevel(<span class=\"hljs-function\">(<span class=\"hljs-params\">level</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(level)\n})\n<span class=\"hljs-comment\">// こちらに置換</span>\n<span class=\"hljs-keyword\">const</span> level = webContents.getZoomLevel()\n<span class=\"hljs-built_in\">console</span>.log(level)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\nwebContents.getZoomFactor(<span class=\"hljs-function\">(<span class=\"hljs-params\">factor</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(factor)\n})\n<span class=\"hljs-comment\">// こちらに置換</span>\n<span class=\"hljs-keyword\">const</span> factor = webContents.getZoomFactor()\n<span class=\"hljs-built_in\">console</span>.log(factor)\n</code></pre>\n<h2 id=\"予定されている破壊的なapiの変更-40\"><a href=\"#予定されている破壊的なapiの変更-40\">予定されている破壊的なAPIの変更 (4.0)</a></h2>\n<p>以下のリストには Electron 4.0 でなされた破壊的な API の変更が含まれています。</p>\n<h3 id=\"appmakesingleinstance\"><a href=\"#appmakesingleinstance\"><code>app.makeSingleInstance</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\napp.makeSingleInstance(<span class=\"hljs-function\">(<span class=\"hljs-params\">argv, cwd</span>) =></span> {\n  <span class=\"hljs-comment\">/* ... */</span>\n})\n<span class=\"hljs-comment\">// こちらに置換</span>\napp.requestSingleInstanceLock()\napp.on(<span class=\"hljs-string\">'second-instance'</span>, (event, argv, cwd) => {\n  <span class=\"hljs-comment\">/* ... */</span>\n})\n</code></pre>\n<h3 id=\"appreleasesingleinstance\"><a href=\"#appreleasesingleinstance\"><code>app.releaseSingleInstance</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\napp.releaseSingleInstance()\n<span class=\"hljs-comment\">// こちらに置換</span>\napp.releaseSingleInstanceLock()\n</code></pre>\n<h3 id=\"appgetgpuinfo\"><a href=\"#appgetgpuinfo\"><code>app.getGPUInfo</code></a></h3>\n<pre><code class=\"hljs language-js\">app.getGPUInfo(<span class=\"hljs-string\">'complete'</span>)\n<span class=\"hljs-comment\">// macOS 上では `basic` と同様に振る舞う</span>\napp.getGPUInfo(<span class=\"hljs-string\">'basic'</span>)\n</code></pre>\n<h3 id=\"win_delay_load_hook\"><a href=\"#win_delay_load_hook\"><code>win_delay_load_hook</code></a></h3>\n<p>Windows でネイティブモジュールをビルドするとき、モジュールの <code>binding.gyp</code> 内の <code>win_delay_load_hook</code> 変数は true (これが初期値) にならなければいけません。 このフックが存在しない場合ネイティブモジュールは Windows 上でロードできず、<code>モジュールが見つかりません</code> のようなエラーメッセージが表示されます。 より詳しくは <a href=\"/docs/tutorial/using-native-node-modules\">ネイティブモジュールガイド</a> を参照してください。</p>\n<h2 id=\"破壊的な-api-の変更-30\"><a href=\"#破壊的な-api-の変更-30\">破壊的な API の変更 (3.0)</a></h2>\n<p>以下のリストには Electron 3.0 での破壊的な API の変更が含まれています。</p>\n<h3 id=\"app\"><a href=\"#app\"><code>app</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\napp.getAppMemoryInfo()\n<span class=\"hljs-comment\">// こちらに置換</span>\napp.getAppMetrics()\n\n<span class=\"hljs-comment\">// 非推奨</span>\n<span class=\"hljs-keyword\">const</span> metrics = app.getAppMetrics()\n<span class=\"hljs-keyword\">const</span> { memory } = metrics[<span class=\"hljs-number\">0</span>] <span class=\"hljs-comment\">// 非推奨なプロパティ</span>\n</code></pre>\n<h3 id=\"browserwindow\"><a href=\"#browserwindow\"><code>BrowserWindow</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\n<span class=\"hljs-keyword\">const</span> optionsA = { <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">blinkFeatures</span>: <span class=\"hljs-string\">''</span> } }\n<span class=\"hljs-keyword\">const</span> windowA = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsA)\n<span class=\"hljs-comment\">// こちらに置き換えてください</span>\n<span class=\"hljs-keyword\">const</span> optionsB = { <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">enableBlinkFeatures</span>: <span class=\"hljs-string\">''</span> } }\n<span class=\"hljs-keyword\">const</span> windowB = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsB)\n\n<span class=\"hljs-comment\">// 非推奨</span>\n<span class=\"hljs-built_in\">window</span>.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'media-play_pause'</span>) {\n    <span class=\"hljs-comment\">// do something</span>\n  }\n})\n<span class=\"hljs-comment\">// こちらに置き換えてください</span>\n<span class=\"hljs-built_in\">window</span>.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'media-play-pause'</span>) {\n    <span class=\"hljs-comment\">// do something</span>\n  }\n})\n</code></pre>\n<h3 id=\"clipboard\"><a href=\"#clipboard\">`clipboard</a></h3>\n<p>`</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\nclipboard.readRtf()\n<span class=\"hljs-comment\">// こちらに置換</span>\nclipboard.readRTF()\n\n<span class=\"hljs-comment\">// 非推奨</span>\nclipboard.writeRtf()\n<span class=\"hljs-comment\">// こちらに置換</span>\nclipboard.writeRTF()\n\n<span class=\"hljs-comment\">// 非推奨</span>\nclipboard.readHtml()\n<span class=\"hljs-comment\">// こちらに置換</span>\nclipboard.readHTML()\n\n<span class=\"hljs-comment\">// 非推奨</span>\nclipboard.writeHtml()\n<span class=\"hljs-comment\">// こちらに置換</span>\nclipboard.writeHTML()\n</code></pre>\n<h3 id=\"crashreporter\"><a href=\"#crashreporter\"><code>crashReporter</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\ncrashReporter.start({\n  <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Crashly'</span>,\n  <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://crash.server.com'</span>,\n  <span class=\"hljs-attr\">autoSubmit</span>: <span class=\"hljs-literal\">true</span>\n})\n<span class=\"hljs-comment\">// こちらに置換</span>\ncrashReporter.start({\n  <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Crashly'</span>,\n  <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://crash.server.com'</span>,\n  <span class=\"hljs-attr\">uploadToServer</span>: <span class=\"hljs-literal\">true</span>\n})\n</code></pre>\n<h3 id=\"nativeimage\"><a href=\"#nativeimage\"><code>nativeImage</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\nnativeImage.createFromBuffer(buffer, <span class=\"hljs-number\">1.0</span>)\n<span class=\"hljs-comment\">// こちらに置換</span>\nnativeImage.createFromBuffer(buffer, {\n  <span class=\"hljs-attr\">scaleFactor</span>: <span class=\"hljs-number\">1.0</span>\n})\n</code></pre>\n<h3 id=\"プロセス\"><a href=\"#プロセス\"><code>プロセス</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\n<span class=\"hljs-keyword\">const</span> info = process.getProcessMemoryInfo()\n</code></pre>\n<h3 id=\"screen\"><a href=\"#screen\"><code>screen</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\nscreen.getMenuBarHeight()\n<span class=\"hljs-comment\">// こちらに置換</span>\nscreen.getPrimaryDisplay().workArea\n</code></pre>\n<h3 id=\"session\"><a href=\"#session\"><code>session</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\nses.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">hostname, certificate, callback</span>) =></span> {\n  callback(<span class=\"hljs-literal\">true</span>)\n})\n<span class=\"hljs-comment\">// こちらに置換</span>\nses.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">request, callback</span>) =></span> {\n  callback(<span class=\"hljs-number\">0</span>)\n})\n</code></pre>\n<h3 id=\"tray\"><a href=\"#tray\"><code>Tray</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\ntray.setHighlightMode(<span class=\"hljs-literal\">true</span>)\n<span class=\"hljs-comment\">// こちらに置換</span>\ntray.setHighlightMode(<span class=\"hljs-string\">'on'</span>)\n\n<span class=\"hljs-comment\">// 非推奨</span>\ntray.setHighlightMode(<span class=\"hljs-literal\">false</span>)\n<span class=\"hljs-comment\">// こちらに置換</span>\ntray.setHighlightMode(<span class=\"hljs-string\">'off'</span>)\n</code></pre>\n<h3 id=\"webcontents\"><a href=\"#webcontents\"><code>webContents</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\nwebContents.openDevTools({ <span class=\"hljs-attr\">detach</span>: <span class=\"hljs-literal\">true</span> })\n<span class=\"hljs-comment\">// こちらに置換</span>\nwebContents.openDevTools({ <span class=\"hljs-attr\">mode</span>: <span class=\"hljs-string\">'detach'</span> })\n\n<span class=\"hljs-comment\">// 削除されました</span>\nwebContents.setSize(options)\n<span class=\"hljs-comment\">// この API は置換できません</span>\n</code></pre>\n<h3 id=\"webframe\"><a href=\"#webframe\"><code>webFrame</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\nwebFrame.registerURLSchemeAsSecure(<span class=\"hljs-string\">'app'</span>)\n<span class=\"hljs-comment\">// こちらに置換</span>\nprotocol.registerStandardSchemes([<span class=\"hljs-string\">'app'</span>], { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n\n<span class=\"hljs-comment\">// 非推奨</span>\nwebFrame.registerURLSchemeAsPrivileged(<span class=\"hljs-string\">'app'</span>, { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n<span class=\"hljs-comment\">// こちらに置換</span>\nprotocol.registerStandardSchemes([<span class=\"hljs-string\">'app'</span>], { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n</code></pre>\n<h3 id=\"webview\"><a href=\"#webview\"><code>&#x3C;webview></code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 削除されました</span>\nwebview.setAttribute(<span class=\"hljs-string\">'disableguestresize'</span>, <span class=\"hljs-string\">''</span>)\n<span class=\"hljs-comment\">// この API は置換できません</span>\n\n<span class=\"hljs-comment\">// 削除されました</span>\nwebview.setAttribute(<span class=\"hljs-string\">'guestinstance'</span>, instanceId)\n<span class=\"hljs-comment\">// この API は置換できません</span>\n\n<span class=\"hljs-comment\">// webview タグ上ではキーボードリスナは動作しなくなります</span>\nwebview.onkeydown = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* handler */</span> }\nwebview.onkeyup = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* handler */</span> }\n</code></pre>\n<h3 id=\"node-headers-url\"><a href=\"#node-headers-url\">Node Headers URL</a></h3>\n<p>これは <code>.npmrc</code> ファイル内の <code>disturl</code> か、ネイティブ Node モジュールをビルドするときの <code>--dist-url</code> コマンドライン引数で指定する URL です。</p>\n<p>非推奨: <a href=\"https://atom.io/download/atom-shell\">https://atom.io/download/atom-shell</a></p>\n<p>こちらに置換: <a href=\"https://atom.io/download/electron\">https://atom.io/download/electron</a></p>\n<h2 id=\"破壊的な-api-の変更-20\"><a href=\"#破壊的な-api-の変更-20\">破壊的な API の変更 (2.0)</a></h2>\n<p>以下のリストには Electron 2.0 でなされた破壊的な API の変更が含まれています。</p>\n<h3 id=\"browserwindow-1\"><a href=\"#browserwindow-1\"><code>BrowserWindow</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非推奨</span>\n<span class=\"hljs-keyword\">const</span> optionsA = { <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden-inset'</span> }\n<span class=\"hljs-keyword\">const</span> windowA = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsA)\n<span class=\"hljs-comment\">// こちらに置換</span>\n<span class=\"hljs-keyword\">const</span> optionsB = { <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span> }\n<span class=\"hljs-keyword\">const</span> windowB = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsB)\n</code></pre>\n<h3 id=\"menu\"><a href=\"#menu\"><code>menu</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 削除されました</span>\nmenu.popup(browserWindow, <span class=\"hljs-number\">100</span>, <span class=\"hljs-number\">200</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// こちらに置換</span>\nmenu.popup(browserWindow, { <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">100</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">200</span>, <span class=\"hljs-attr\">positioningItem</span>: <span class=\"hljs-number\">2</span> })\n</code></pre>\n<h3 id=\"nativeimage-1\"><a href=\"#nativeimage-1\"><code>nativeImage</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 削除されました</span>\nnativeImage.toPng()\n<span class=\"hljs-comment\">// こちらに置換</span>\nnativeImage.toPNG()\n\n<span class=\"hljs-comment\">// 削除されました</span>\nnativeImage.toJpeg()\n<span class=\"hljs-comment\">// こちらに置換</span>\nnativeImage.toJPEG()\n</code></pre>\n<h3 id=\"プロセス-1\"><a href=\"#プロセス-1\"><code>プロセス</code></a></h3>\n<ul>\n<li><code>process.versions.electron</code> と <code>process.version.chrome</code> は、Node によって定められた他の <code>process.versions</code> プロパティと一貫性を持つために読み取り専用プロパティになりました。</li>\n</ul>\n<h3 id=\"webcontents-1\"><a href=\"#webcontents-1\"><code>webContents</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 削除されました</span>\nwebContents.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// こちらに置換</span>\nwebContents.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"webframe-1\"><a href=\"#webframe-1\"><code>webFrame</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 削除されました</span>\nwebFrame.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// こちらに置換</span>\nwebFrame.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"webview-1\"><a href=\"#webview-1\"><code>&#x3C;webview></code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 削除されました</span>\nwebview.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// こちらに置換</span>\nwebview.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"重複する-arm-アセット\"><a href=\"#重複する-arm-アセット\">重複する ARM アセット</a></h3>\n<p>どの Electron リリースにも、<code>electron-v1.7.3-linux-arm.zip</code> や <code>electron-v1.7.3-linux-armv7l.zip</code> のような少しファイル名が異なる2つの同一な ARM ビルドが含まれます。 サポートされている ARM バージョンをユーザに明確にし、将来作成される armv6l および arm64 アセットらと明確にするために、<code>v7l</code> という接頭子を持つアセットが追加されました。</p>\n<p><em>接頭子が付いていない</em> ファイルは、まだそれを使用している可能性がある設定を破壊しないために公開しています。 2.0 からは、接頭子のないファイルは公開されなくなりました。</p>\n<p>詳細は、<a href=\"https://github.com/electron/electron/pull/6986\">6986</a> と <a href=\"https://github.com/electron/electron/pull/7189\">7189</a> を参照してください。</p>",
      "title": "破壊的変更",
      "description": ""
    },
    "/docs/api/browser-view": {
      "locale": "ja-JP",
      "slug": "browser-view",
      "href": "/docs/api/browser-view",
      "crowdinFileId": "256283",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-view.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"browserview\"><a href=\"#browserview\">BrowserView</a></h1>\n<p><code>BrowserView</code> は、<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> に追加のウェブコンテンツを埋め込むのに使用することができます。 外側のウインドウを基準にして配置される点を除いて、子ウインドウのようなものです。 <code>webview</code> タグの代替となるものです。</p>\n<h2 id=\"クラス-browserview\"><a href=\"#クラス-browserview\">クラス: BrowserView</a></h2>\n<blockquote>\n<p>ビューを作成したり、制御したりします。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h3 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// メインプロセス</span>\n<span class=\"hljs-keyword\">const</span> { BrowserView, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-keyword\">const</span> view = <span class=\"hljs-keyword\">new</span> BrowserView()\nwin.setBrowserView(view)\nview.setBounds({ <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">0</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">0</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">300</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">300</span> })\nview.webContents.loadURL(<span class=\"hljs-string\">'https://electronjs.org'</span>)\n</code></pre>\n<h3 id=\"new-browserviewoptions-実験的\"><a href=\"#new-browserviewoptions-実験的\"><code>new BrowserView([options])</code> <em>実験的</em></a></h3>\n<ul>\n<li><code>options</code> Object (任意)<ul>\n<li><code>webPreferences</code> Object (任意) - <a href=\"/docs/api/browser-window\">BrowserWindow</a> を参照してください。</li>\n</ul></li>\n</ul>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<p><code>new BrowserView</code> で作成されたオブジェクトは、以下のプロパティを持っています。</p>\n<h4 id=\"viewwebcontents-実験的\"><a href=\"#viewwebcontents-実験的\"><code>view.webContents</code> <em>実験的</em></a></h4>\n<p>このビューによって保持されている <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> オブジェクト。</p>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<p><code>new BrowserView</code> で作成されたオブジェクトは、次のインスタンスメソッドを持っています。</p>\n<h4 id=\"viewsetautoresizeoptions-実験的\"><a href=\"#viewsetautoresizeoptions-実験的\"><code>view.setAutoResize(options)</code> <em>実験的</em></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>width</code> Boolean (任意) - <code>true</code> の場合、ビューの横幅はウインドウと一緒に伸び縮みします。 省略値は <code>false</code> です。</li>\n<li><code>height</code> Boolean (任意) - <code>true</code> の場合、ビューの高さはウインドウと一緒に伸び縮みします。 省略値は <code>false</code> です。</li>\n<li><code>horizontal</code> Boolean (任意) - <code>true</code> の場合、ビューの x 位置と幅はウィンドウに比例して増減します。 省略値は <code>false</code> です。</li>\n<li><code>vertical</code> Boolean (任意) - <code>true</code> の場合、ビューの y 位置と高さはウィンドウに比例して増減します。 省略値は <code>false</code> です。</li>\n</ul></li>\n</ul>\n<h4 id=\"viewsetboundsbounds-実験的\"><a href=\"#viewsetboundsbounds-実験的\"><code>view.setBounds(bounds)</code> <em>実験的</em></a></h4>\n<ul>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>ウインドウを基準に指定された境界までビューをリサイズしたり、移動させたりします。</p>\n<h4 id=\"viewgetbounds-実験的\"><a href=\"#viewgetbounds-実験的\"><code>view.getBounds()</code> <em>実験的</em></a></h4>\n<p>戻り値 <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p><code>Object</code> としてのこの BrowserView インスタンスの <code>bounds</code>。</p>\n<h4 id=\"viewsetbackgroundcolorcolor-実験的\"><a href=\"#viewsetbackgroundcolorcolor-実験的\"><code>view.setBackgroundColor(color)</code> <em>実験的</em></a></h4>\n<ul>\n<li><code>color</code> String - <code>#aarrggbb</code> や <code>#argb</code> といった形式の色。 アルファチャンネルは任意です。</li>\n</ul>",
      "title": "BrowserView",
      "description": "ビューを作成したり、制御したりします。"
    },
    "/docs/api/browser-window": {
      "locale": "ja-JP",
      "slug": "browser-window",
      "href": "/docs/api/browser-window",
      "crowdinFileId": "256287",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-window.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"browserwindow\"><a href=\"#browserwindow\">BrowserWindow</a></h1>\n<blockquote>\n<p>ブラウザウィンドウを作成したり、制御したりします。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// メインプロセス</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-comment\">// 外部 URL を読み込む</span>\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\n<span class=\"hljs-comment\">// またはローカルの HTML ファイルを読み込む</span>\nwin.loadURL(<span class=\"hljs-string\">'index.html'</span>)\n</code></pre>\n<h2 id=\"フレームレスウィンドウ\"><a href=\"#フレームレスウィンドウ\">フレームレスウィンドウ</a></h2>\n<p><a href=\"/docs/api/frameless-window\">Frameless Window</a> APIを使うと、枠がないウインドウや任意の形状の透明なウインドウを作成することができます。</p>\n<h2 id=\"ウインドウを違和感なく表示する\"><a href=\"#ウインドウを違和感なく表示する\">ウインドウを違和感なく表示する</a></h2>\n<p>ウインドウにページを直接ロードすると、ユーザにはページが徐々にロードされるように見えるかもしれません。これはネイティブアプリとしては良い挙動ではありません。 ちらつかせることなくウインドウを表示するには、さまざまな状況に応じた 2 つの解決策があります。</p>\n<h3 id=\"ready-to-show-イベントを使用する\"><a href=\"#ready-to-show-イベントを使用する\"><code>ready-to-show</code> イベントを使用する</a></h3>\n<p>ページのロード中、ウインドウがまだ表示されていない場合、レンダラープロセスが初めてページをレンダリングし終わったとき、<code>ready-to-show</code> イベントが発生します。 このイベントの後にウインドウを表示させれば、チラつくことはありません。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span> })\nwin.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => {\n  win.show()\n})\n</code></pre>\n<p>このイベントは、通常、<code>did-finish-load</code> イベントの後に発生しますが、大量のリモートリソースがあるページでは、<code>did-finish-load</code> イベントの前に発生する可能性があります。</p>\n<p>このイベントを使用すると、<code>show</code> が false でもレンダラーが \"見えている\" と見なされ、描画されることに注意してください。  <code>paintWhenInitiallyHidden: false</code> を使用すると、このイベントは発生しません。</p>\n<h3 id=\"backgroundcolor-プロパティを設定する\"><a href=\"#backgroundcolor-プロパティを設定する\"><code>backgroundColor</code> プロパティを設定する</a></h3>\n<p>複雑なアプリでは、<code>ready-to-show</code> イベントが発生するのに時間がかかり過ぎて、アプリが遅いと感じさせる可能性があります。 このような場合、ウインドウをすぐに表示し、アプリの背景に近い <code>backgroundColor</code> を使うことを推奨します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#2e2c29'</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<p><code>ready-to-show</code> イベントを使用しているアプリに対しても、アプリがよりネイティブに感じられるように <code>backgroundColor</code> を設定することが推奨されます。</p>\n<h2 id=\"親ウィンドウと子ウィンドウ\"><a href=\"#親ウィンドウと子ウィンドウ\">親ウィンドウと子ウィンドウ</a></h2>\n<p><code>parent</code> オプションを使用することで、子ウインドウを作成することができます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> top = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n<span class=\"hljs-keyword\">const</span> child = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">parent</span>: top })\nchild.show()\ntop.show()\n</code></pre>\n<p><code>child</code> ウインドウは、常に <code>top</code> ウインドウの前面に表示されます。</p>\n<h2 id=\"モーダルウィンドウ\"><a href=\"#モーダルウィンドウ\">モーダルウィンドウ</a></h2>\n<p>モーダルウインドウは親ウインドウを無効化する子ウインドウです。モーダルウインドウを作成するには、<code>parent</code> と <code>modal</code> オプションの両方を設定しなければなりません。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> child = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">parent</span>: top, <span class=\"hljs-attr\">modal</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span> })\nchild.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\nchild.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => {\n  child.show()\n})\n</code></pre>\n<h2 id=\"ページの表示状態\"><a href=\"#ページの表示状態\">ページの表示状態</a></h2>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API\">Page Visibility API</a> は、以下のように動作します。</p>\n<ul>\n<li>すべてのプラットフォームおいて、表示状態はウインドウが非表示/最小化されているかどうかをトラッキングします。</li>\n<li>さらに、macOSでは、表示状態はウインドウが重なり合った状態もトラッキングします。 ウインドウが別のウインドウと重なり合った (例えば、完全に覆い隠された) 場合、表示状態は、<code>hidden</code> になります。 他のプラットフォーム上では、ウインドウが最小化されるか、明示的に <code>win.hide()</code> で非表示にされた場合のみ、表示状態は <code>hidden</code> になります。</li>\n<li><code>BrowserWindow</code> が <code>show: false</code> で作成された場合、ウインドウが実際には非表示であるにも関わらず、初期の表示状態は <code>visible</code> になります。</li>\n<li><code>backgroundThrottling</code> が無効の場合、ウインドウを最小化したり、重ねたり、非表示にしたりしても、表示状態は <code>visible</code> のままになります。</li>\n</ul>\n<p>消費電力を最小にするために、表示状態が <code>hidden</code> のとき、高負荷な操作を一時停止することを推奨します。</p>\n<h2 id=\"プラットフォームに関する注意事項\"><a href=\"#プラットフォームに関する注意事項\">プラットフォームに関する注意事項</a></h2>\n<ul>\n<li>macOSでは、モーダルウインドウは親ウインドウに付随したシートとして表示されます。</li>\n<li>親ウインドウが移動したとき、macOSでは、子ウインドウは親ウインドウに対する相対的な位置を維持しますが、WindowsとLinuxでは、子ウインドウは移動しません。</li>\n<li>Linuxでは、モーダルウインドウの型は、<code>dialog</code> に変更されます。</li>\n<li>Linuxでは、多くのデスクトップ環境は、モーダルウインドウを非表示にすることをサポートしていません。</li>\n</ul>\n<h2 id=\"クラス-browserwindow\"><a href=\"#クラス-browserwindow\">クラス: BrowserWindow</a></h2>\n<blockquote>\n<p>ブラウザウィンドウを作成したり、制御したりします。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>BrowserWindow</code> は <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a> を継承しています。</p>\n<p><code>options</code> によって設定されたネイティブプロパティで新しい <code>BrowserWindow</code> を生成します。</p>\n<h3 id=\"new-browserwindowoptions\"><a href=\"#new-browserwindowoptions\"><code>new BrowserWindow([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (任意)<ul>\n<li><code>width</code> Integer (任意) - ピクセル単位でのウインドウの幅。 省略値は <code>800</code> です。</li>\n<li><code>height</code> Integer (任意) - ピクセル単位でのウインドウの高さ。 省略値は <code>600</code> です。</li>\n<li><code>x</code> Integer (任意) - (y が使われている場合は <strong>必須</strong>) ウインドウの画面左のオフセット。 省略すると、ウインドウは中央に配置されます。</li>\n<li><code>y</code> Integer (任意) - (x が使われている場合は <strong>必須</strong>) ウインドウの画面上のオフセット。 省略すると、ウインドウは中央に配置されます。</li>\n<li><code>useContentSize</code> Boolean (任意) - <code>width</code> と <code>height</code> が、Webページのサイズとして使用されます。この場合、実際のウインドウのサイズは、ウインドウ枠のサイズが含まれ、若干大きくなることを意味します。 省略値は <code>false</code> です。</li>\n<li><code>center</code> Boolean (任意) - ウインドウを画面中央に表示します。</li>\n<li><code>minWidth</code> Integer (任意) - ウインドウの最小の幅。 省略値は <code>0</code> です。</li>\n<li><code>minHeight</code> Integer (任意) - ウィンドウの最小の高さ。 省略値は <code>0</code> です。</li>\n<li><code>maxWidth</code> Integer (任意) - ウインドウの最大の幅。 省略すると無制限です。</li>\n<li><code>maxHeight</code> Integer (任意) - ウインドウの最大の高さ。 省略すると無制限です。</li>\n<li><code>resizable</code> Boolean (任意) - ウインドウがリサイズ可能かどうか。 省略値は <code>true</code> です。</li>\n<li><code>movable</code> Boolean (任意) - ウインドウが移動可能かどうか。 これは Linux では実装されていません。 省略値は <code>true</code> です。</li>\n<li><code>minimizable</code> Boolean (任意) - ウインドウが最小化可能かどうか。 これは Linux では実装されていません。 省略値は <code>true</code> です。</li>\n<li><code>maximizable</code> Boolean (任意) - ウインドウが最大化可能かどうか。 これは Linux では実装されていません。 省略値は <code>true</code> です。</li>\n<li><code>closable</code> Boolean (任意) - ウインドウを閉じることができるかどうか。 これは Linux では実装されていません。 省略値は <code>true</code> です。</li>\n<li><code>focusable</code> Boolean (任意) - ウインドウにフォーカスを当てることができるかどうか。 省略値は <code>true</code> です。 Windowsでは、<code>focusable: false</code> と設定することは、<code>skipTaskbar: true</code> と設定することにもなります。 Linuxでは、<code>focusable: false</code> と設定することは、ウインドウがwmとのやり取りを停止することになるため、ウインドウがすべてのワークスペースで常に前面に表示されます。</li>\n<li><code>alwaysOnTop</code> Boolean (任意) - ウインドウを常に他のウインドウの前面に表示させるかどうか。 省略値は <code>false</code> です。</li>\n<li><code>fullscreen</code> Boolean (任意) - ウインドウをフルスクリーンで表示させるかどうか。 明示的に <code>false</code> と設定された場合、macOSでは、フルスクリーンボタンが非表示または無効になります。 省略値は <code>false</code> です。</li>\n<li><code>fullscreenable</code> Boolean (任意) - ウインドウをフルスクリーンモードにすることができるかどうか。 macOSでは、さらに、最大化/ズームボタンが、フルスクリーンモードまたはウインドウ最大化に切り替わるかどうか。 省略値は <code>true</code> です。</li>\n<li><code>simpleFullscreen</code> Boolean (任意) - macOS で Lion より前のフルスクリーンを使用します。 省略値は <code>false</code> です。</li>\n<li><code>skipTaskbar</code> Boolean (任意) - ウインドウをタスクバーに表示するかどうか。 省略値は <code>false</code> です。</li>\n<li><code>kiosk</code> Boolean (任意) - ウインドウがキオスクモードかどうか。 省略値は <code>false</code> です。</li>\n<li><code>title</code> String (任意) - デフォルトのウインドウタイトル。 省略値は <code>\"Electron\"</code> です。 HTML タグの <code>&#x3C;title></code> が <code>loadURL()</code> でロードされた HTML ファイル内で定義されている場合、このプロパティは無視されます。</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (任意) - ウインドウのアイコン。 Windowsでは、最高の視覚効果を得るためには、<code>ICO</code> アイコンを使うことを推奨します。未定義のままにすることもできますが、その場合、実行可能ファイルのアイコンが使われます。</li>\n<li><code>show</code> Boolean (任意) - 生成時にウインドウを表示するかどうか。 省略値は <code>true</code> です。</li>\n<li><code>paintWhenInitiallyHidden</code> Boolean (任意) - <code>show</code> が <code>false</code> で作成されたばかりのときに、レンダラーをアクティブにするかどうか。  <code>show: false</code> での <code>document.visibilityState</code> が最初のロードで正しく機能するには、これを <code>false</code> に設定する必要があります。  これを <code>false</code> に設定すると、<code>ready-to-show</code> イベントが発生しなくなります。  省略値は <code>true</code> です。</li>\n<li><code>frame</code> Boolean (任意) - <code>false</code> を指定すると <a href=\"/docs/api/frameless-window\">フレームレスウインドウ</a> を生成します。 省略値は <code>true</code> です。</li>\n<li><code>parent</code> BrowserWindow (任意) - 親ウインドウを指定します。 省略値は <code>null</code> です。</li>\n<li><code>modal</code> Boolean (任意) - これをモーダルウインドウにするかどうか。 これは、このウインドウが子ウインドウの場合にのみ機能します。 省略値は <code>false</code> です。</li>\n<li><code>acceptFirstMouse</code> Boolean (任意) - 非アクティブのウインドウをクリックしたとき、ウェブコンテンツにもクリックを渡すかどうか。 macOS での既定値は <code>false</code> です。 このオプションは他プラットフォームでは設定できません。</li>\n<li><code>disableAutoHideCursor</code> Boolean (任意) - タイプ中にカーソルを非表示にするかどうか。 省略値は <code>false</code> です。</li>\n<li><code>autoHideMenuBar</code> Boolean (任意) - <code>Alt</code> キーが押されていなければ、メニューバーを自動で非表示にします。 省略値は <code>false</code> です。</li>\n<li><code>enableLargerThanScreen</code> Boolean (任意) - ウインドウを画面よりも大きいサイズに変更できるようにします。 他の OS はデフォルトで画面よりも大きなウィンドウを許可するため、macOS にのみ関係します。 省略値は <code>false</code> です。</li>\n<li><code>backgroundColor</code> String (任意) - <code>#66CD00</code> や <code>#FFF</code> や <code>#80FFFFFF</code> (<code>transparent</code> を <code>true</code> にセットすれば #AARRGGBB 形式のアルファ値をサポートします) のような16進数の値でのウインドウの背景色。 省略値は <code>#FFF</code> (白) です。</li>\n<li><code>hasShadow</code> Boolean (任意) - ウインドウに影を付けるかどうか。 省略値は <code>true</code> です。</li>\n<li><code>opacity</code> Number (任意) - ウインドウの初期透明度を 0.0 (完全に透明) から 1.0 (完全に不透明) の間で設定します。 これは Windows と macOS でのみ実装されています。</li>\n<li><code>darkTheme</code> Boolean (任意) - ウインドウに対してダークテーマの使用を強制します。いくつかの GTK+3 デスクトップ環境でしか動作しません。 省略値は <code>false</code> です。</li>\n<li><code>transparent</code> Boolean (任意) - ウインドウを <a href=\"/docs/api/frameless-window#transparent-window\">透明</a> にします。 省略値は <code>false</code> です。 Windows では、ウィンドウがフレームレスでない限り機能しません。</li>\n<li><code>type</code> String (任意) - ウインドウのタイプで、省略すると通常のウインドウになります。 詳しくは後述します。</li>\n<li><code>visualEffectState</code> String (任意) - macOS 上のウィンドウのアクティビティ状態をマテリアルの外観に反映させる方法を指定します。 <code>vibrancy</code>プロパティと一緒に使用する必要があります。 以下は取りうる値です。<ul>\n<li><code>followWindow</code> - ウィンドウがアクティブなときにはアクティブに、そうでないときには非アクティブになるよう背景が自動的に表示されます。 これが既定値です。</li>\n<li><code>active</code> - 背景が常にアクティブに表示されます。</li>\n<li><code>inactive</code> - 背景が常に非アクティブに表示されます。</li>\n</ul></li>\n<li><code>titleBarStyle</code> String (任意) <em>macOS</em> <em>Windows</em> - ウインドウのタイトルバーのスタイル。 省略値は <code>default</code> です。 以下は取りうる値です。<ul>\n<li><code>default</code> - macOS や Windows ごとの標準的なタイトルバーになります。</li>\n<li><code>hidden</code> - タイトルバーが隠れ、フルサイズのコンテンツウインドウになります。 macOS では、ウインドウの左上に標準ウインドウコントロール (\"信号機ボタン\") が付きます。 Windows では、<code>titleBarOverlay: true</code> と合わせることでウインドウコントロールオーバーレイ (詳細は <code>titleBarOverlay</code> を参照) が有効になり、さもなくばウインドウコントロールは表示されません。</li>\n<li><code>hiddenInset</code> - macOS 限定で、タイトルバーが非表示になり、信号機ボタンがウインドウ端から少し離れたところに表示されるようになります。</li>\n<li><code>customButtonsOnHover</code> - macOS 限定で、タイトルバーが非表示になり、フルサイズコンテンツのウインドウが表示されます。ウィンドウの左上にカーソルを置くと信号機ボタンが表示されるようになります。  <strong>注:</strong> 現在、これは実験的な機能です。</li>\n</ul></li>\n<li><code>trafficLightPosition</code> <a href=\"/docs/api/structures/point\">Point</a> (任意) - フレームレスウインドウにおける信号機ボタンのカスタム位置を設定します。</li>\n<li><code>roundedCorners</code> Boolean (任意) - macOS でのフレームレスウインドウが丸角であるべきかどうか。 省略値は <code>true</code> です。</li>\n<li><code>fullscreenWindowTitle</code> Boolean (任意) <em>非推奨</em> - macOSで titleBarStyle が <code>hiddenInset</code> のフルスクリーンモードでタイトルバーにタイトルを表示するかどうか。 省略値は <code>false</code> です。</li>\n<li><code>thickFrame</code> Boolean (任意) - Windowsのフレームレスウインドウに対して、標準のウインドウ枠を追加する <code>WS_THICKFRAME</code> スタイルを使用します。 <code>false</code> に設定すると、ウインドウの影とウインドウアニメーションがなくなります。 省略値は <code>true</code> です。</li>\n<li><code>vibrancy</code> String (任意) - macOSでのみ、ウインドウに曇りガラス効果の種類を追加します。 <code>appearance-based</code>、<code>light</code>、<code>dark</code>、<code>titlebar</code>、<code>selection</code>、<code>menu</code>、<code>popover</code>、<code>sidebar</code>、<code>medium-light</code>、<code>ultra-dark</code>、<code>header</code>、<code>sheet</code>、<code>window</code>、<code>hud</code>、<code>fullscreen-ui</code>、<code>tooltip</code>、<code>content</code>、<code>under-window</code> または <code>under-page</code> にすることができます。 <code>appearance-based</code>、<code>light</code>、<code>dark</code>、<code>medium-light</code>、<code>ultra-dark</code> は非推奨になっており、macOS Catalina (10.15) で削除されたことにご注意ください。</li>\n<li><code>zoomToPageWidth</code> Boolean (任意) - macOS で、option キーを押しながら緑の信号ボタンをクリックしたり、ウインドウ > ズーム のメニュー項目をクリックしたりしたときの動作を制御します。 <code>true</code> の場合、ズームしたとき、ウインドウはWebページの最適な幅に拡大されます。<code>false</code> だと、画面の幅にズームされます。 これは、<code>maximize()</code> を直接呼び出したときの動作にも影響を与えます。 省略値は <code>false</code> です。</li>\n<li><code>tabbingIdentifier</code> String (任意) - タブのグループ名で、macOS 10.12以上の場合、ネイティブのタブとしてウインドウを開くことができます。 同一のタブ識別子を持つウインドウは、一緒にグループ化されます。 これはネイティブのタブボタンをウインドウのタブバーに追加し、<code>app</code> とウインドウが <code>new-window-for-tab</code> イベントを受け取ることができるようになります。</li>\n<li><code>webPreferences</code> Object (任意) - ウェブページの機能の設定です。<ul>\n<li><code>devTools</code> Boolean (任意) - デベロッパーツールを有効にするかどうか。 <code>false</code> に設定すると、<code>BrowserWindow.webContents.openDevTools()</code> を使ってデベロッパーツールを開くことはできません。 省略値は <code>true</code> です。</li>\n<li><code>nodeIntegration</code> Boolean (任意) - Node インテグレーションを有効にするかどうか。 省略値は <code>false</code> です。</li>\n<li><code>nodeIntegrationInWorker</code> Boolean (任意) - WebワーカーでNode統合を有効にするかどうか。 省略値は <code>false</code> です。 これについての詳細は、<a href=\"/docs/tutorial/multithreading\">マルチスレッド</a> を参照してください。</li>\n<li><code>nodeIntegrationInSubFrames</code> Boolean (任意) - iframe や子ウインドウのようなサブフレーム内で Node.js サポートを有効にする実験的な機能です。 すべてのプリロードは iframe 毎にロードされます。メインフレーム内かそうでないか判断するには <code>process.isMainFrame</code> が使用できます。</li>\n<li><code>preload</code> String (任意) - 他のスクリプトがページで実行される前にロードされるスクリプトを指定します。 このスクリプトは、Node統合がオンまたはオフであるかに関係なく常にNode APIにアクセスできます。 値は、スクリプトへの絶対ファイルパスにする必要があります。 Node統合がオフのときでも、プレロードされたスクリプトは、Nodeのグローバルシンボルをグローバルスコープに再導入できます。 <a href=\"/docs/api/context-bridge#exposing-node-global-symbols\">ここ</a> の例を参照してください。</li>\n<li><code>sandbox</code> Boolean (任意) - 設定された場合、ウインドウと関連付けられているレンダラーをサンドボックス化します。これは、ChromiumのOSレベルのサンドボックスと互換性を持ち、Node.jsエンジンを無効化します。 これは <code>nodeIntegration</code> オプションと同じではなく、プレロードスクリプトで利用可能なAPIよりもさらに制限がかかります。 このオプションの詳細については、<a href=\"/docs/tutorial/sandbox\">ここ</a> をお読みください。</li>\n<li><code>session</code> <a href=\"/docs/api/session#class-session\">Session</a> (任意) - ページで使用されるセッションを設定します。 Session オブジェクトを直接引き渡す代わりに、パーティション文字列を受け付ける <code>partition</code> オプションを使用することを選択することもできます。 <code>session</code> と <code>partition</code> の両方が指定されたときは、<code>session</code> が優先されます。 省略値は、既定のセッションです。</li>\n<li><code>partition</code> String (任意) - セッションのパーティション文字列に従って、ページで使用されるセッションを設定します。 <code>partition</code> が <code>persist:</code> 始まりの場合、ページはアプリの全ページで利用可能な永続的なセッションを同じ <code>partition</code> で使用します。 <code>persist:</code> プレフィックスがない場合、ページは、インメモリセッションを使用します。 同じ <code>partition</code> を割り当てることによって、複数のページが同じセッションを共有できます。 省略値は、既定のセッションです。</li>\n<li><code>zoomFactor</code> Number (任意) - ページの既定のズーム倍率で、<code>3.0</code> は <code>300%</code> を表します。 省略値は <code>1.0</code> です。</li>\n<li><code>javascript</code> Boolean (任意) - JavaScript サポートを有効にします。 省略値は <code>true</code> です。</li>\n<li><code>webSecurity</code> Boolean (任意) - <code>false</code> のとき、同一オリジンポリシー (通常、テスト用Webサイトを使用します) が無効になり、ユーザによって設定されない場合、<code>allowRunningInsecureContent</code> が <code>true</code> に設定されます。 省略値は <code>true</code> です。</li>\n<li><code>allowRunningInsecureContent</code> Boolean (任意) - https のページで http の URL からの JavaScript、CSS やプラグインを実行することを許可します。 省略値は <code>false</code> です。</li>\n<li><code>images</code> Boolean (任意) - 画像のサポートを有効にします。 省略値は <code>true</code> です。</li>\n<li><code>imageAnimationPolicy</code> String (任意) - 画像アニメーションの実行方法を指定します。(例: GIF)。  <code>animate</code>、<code>animateOnce</code>、<code>noAnimation</code> のいずれかにできます。  省略値は <code>animate</code> です。</li>\n<li><code>textAreasAreResizable</code> Boolean (任意) - TextArea 要素のサイズを変更可能にします。 省略値は <code>true</code> です。</li>\n<li><code>webgl</code> Boolean (任意) - WebGL のサポートを有効にします。 省略値は <code>true</code> です。</li>\n<li><code>plugins</code> Boolean (任意) - プラグインを有効にするかどうか。 省略値は <code>false</code> です。</li>\n<li><code>experimentalFeatures</code> Boolean (任意) - Chromium の実験的な機能を有効にします。 省略値は <code>false</code> です。</li>\n<li><code>scrollBounce</code> Boolean (任意) - macOS でスクロールバウンス (ラバーバンディング) 効果を有効にします。 省略値は <code>false</code> です。</li>\n<li><code>enableBlinkFeatures</code> String (任意) - <code>CSSVariables,KeyboardEventKey</code> のように <code>,</code> で区切られた有効にする機能の文字列のリスト。 サポートされている機能の文字列の完全なリストは、<a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> ファイルで確認することができます。</li>\n<li><code>disableBlinkFeatures</code> String (任意) - <code>CSSVariables,KeyboardEventKey</code> のように <code>,</code> で区切られた無効にする機能の文字列のリスト。 サポートされている機能の文字列の完全なリストは、<a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> ファイルで確認することができます。</li>\n<li><code>defaultFontFamily</code> Object (任意) - 各フォントファミリーの既定フォントを設定します。<ul>\n<li><code>standard</code> String (任意) - 省略値は、<code>Times New Roman</code> です。</li>\n<li><code>serif</code> String (任意) - 省略値は、<code>Times New Roman</code> です。</li>\n<li><code>sansSerif</code> String (任意) - 省略値は、<code>Arial</code> です。</li>\n<li><code>monospace</code> String (任意) - 省略値は、<code>Courier New</code> です。</li>\n<li><code>cursive</code> String (任意) - 省略値は、<code>Script</code> です。</li>\n<li><code>fantasy</code> String (任意) - 省略値は、<code>Impact</code> です。</li>\n</ul></li>\n<li><code>defaultFontSize</code> Integer (任意) - 省略値は、<code>16</code> です。</li>\n<li><code>defaultMonospaceFontSize</code> Integer (任意) - 省略値は、<code>13</code> です。</li>\n<li><code>minimumFontSize</code> Integer (任意) - 省略値は、<code>0</code> です。</li>\n<li><code>defaultEncoding</code> String (任意) - 省略値は、<code>ISO-8859-1</code> です。</li>\n<li><code>backgroundThrottling</code> Boolean (任意) - ページがバックグラウンドになったとき、アニメーションやタイマーを抑制するかどうか。 これは <a href=\"#page-visibility\">Page Visibility API</a> にも影響を与えます。 省略値は <code>true</code> です。</li>\n<li><code>offscreen</code> Boolean (任意) - ブラウザウィンドウでオフスクリーンレンダリングを有効にするかどうか。 省略値は <code>false</code> 。 詳細については、<a href=\"/docs/tutorial/offscreen-rendering\">オフスクリーンレンダリングのチュートリアル</a> を参照してください。</li>\n<li><code>contextIsolation</code> Boolean (任意) - Electron APIと指定された <code>preload</code> スクリプトを別々のJavaScriptコンテキストで実行するかどうか。 省略値は <code>true</code> です。 <code>preload</code> スクリプトが実行されるコンテキストでは、専用の <code>document</code> および <code>window</code> グローバルと、独自の JavaScript ビルドインのセット (<code>Array</code>, <code>Object</code>, <code>JSON</code> など) にのみアクセスできます。これらすべてはロードされたコンテンツからは見えません。 Electron API は <code>preload</code> スクリプトでのみ利用可能で、読み込まれたページでは利用できません。 このオプションは、信頼できない可能性のあるリモートコンテンツをロードする際に使用します。ロードされたコンテンツが <code>preload</code> スクリプトや使用する Electron API を改ざんできないようにするためです。  このオプションは、<a href=\"https://developer.chrome.com/extensions/content_scripts#execution-environment\">Chrome のコンテンツスクリプト</a> のものと同じ技術を使用しています。  Console タブの一番上のコンボボックスの中にある 'Electron Isolated Context' という項目を選択することによって、開発者ツールでこのコンテキストにアクセスできます。</li>\n<li><code>nativeWindowOpen</code> Boolean (任意) - ネイティブの <code>window.open()</code> を使用するかどうか。 省略値は <code>true</code> です。 子ウインドウは、<code>nodeIntegrationInSubFrames</code> が true でなければ node integration は無効化されます。</li>\n<li><code>webviewTag</code> Boolean (任意) - <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code> タグ</a> を有効にするかどうか。 省略値は <code>false</code> 。 <strong>注:</strong> <code>&#x3C;webview></code> に設定された <code>preload</code> スクリプトは、実行時にNode統合が有効になるので、潜在的に悪意のある <code>preload</code> スクリプトを含む <code>&#x3C;webview></code> タグをリモート/信頼できないコンテンツに作成させないようにする必要があります。 <code>preload</code> スクリプトを除去したり、検証したり、<code>&#x3C;webview></code> の初期設定を変更したりするために、<a href=\"/docs/api/web-contents\">webContents</a> の <code>will-attach-webview</code> イベントを使うことができます。</li>\n<li><code>additionalArguments</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> - このアプリケーションのレンダラープロセスで <code>process.argv</code> に追加される文字列のリスト。  小規模なデータをレンダラープロセスのプリロードスクリプトに渡すのに便利です。</li>\n<li><code>safeDialogs</code> Boolean (任意) - ブラウザによる連続ダイアログ保護を有効にするかどうか。 省略値は <code>false</code> です。</li>\n<li><code>safeDialogsMessage</code> String (任意) - 連続したダイアログからの保護が機能したときに表示されるメッセージ。 定義されていなければデフォルトメッセージが使われますが、現在のデフォルトメッセージは英語であり、ローカライズされていないことに注意してください。</li>\n<li><code>disableDialogs</code> Boolean (任意) - ダイアログを完全に無効化するかどうか。 <code>safeDialogs</code> を上書きします。 省略値は <code>false</code> です。</li>\n<li><code>navigateOnDragDrop</code> Boolean (任意) - ファイルやリンクをページにドラッグ &#x26; ドロップした際にナビゲーションするかどうか。 省略値は <code>false</code> です。</li>\n<li><code>autoplayPolicy</code> String (任意) - ウインドウ内のコンテンツに適用される自動再生ポリシーで、<code>no-user-gesture-required</code>、<code>user-gesture-required</code>、<code>document-user-activation-required</code> にできます。 省略値は <code>no-user-gesture-required</code> です。</li>\n<li><code>disableHtmlFullscreenWindowResize</code> Boolean (任意) - HTML フルスクリーンになった時にウィンドウのサイズ変更を禁止するかどうか。 省略値は <code>false</code> です。</li>\n<li><code>accessibleTitle</code> String (任意) - スクリーンリーダーなどのアクセシビリティツールにのみ提供される代替タイトル文字列。 この文字列はユーザに直接表示されません。</li>\n<li><code>spellcheck</code> Boolean (任意) - 組み込みスペルチェックを有効にするかどうか。 省略値は <code>true</code> です。</li>\n<li><code>enableWebSQL</code> Boolean (任意) - <a href=\"https://www.w3.org/TR/webdatabase/\">WebSQL API</a> を有効にするかどうか。 省略値は <code>true</code> です。</li>\n<li><code>v8CacheOptions</code> String (任意) - blink が使用する v8 コードキャッシュポリシーを強制します。 以下は取りうる値です。<ul>\n<li><code>none</code> - コードキャッシュ無効化</li>\n<li><code>code</code> - ヒューリスティックベースのコードキャッシュ</li>\n<li><code>bypassHeatCheck</code> - ヒューリスティックのコードキャッシュをバイパスしつつ遅延コンパイル</li>\n<li><code>bypassHeatCheckAndEagerCompile</code> - 上と同じにしつつ先行コンパイルします。 既定のポリシーは <code>code</code> です。</li>\n</ul></li>\n<li><code>enablePreferredSizeMode</code> Boolean (任意) - 優先サイズモードを有効にするかどうか。 優先サイズとは、document のレイアウトをスクロール無しで格納するにあたって必要な最小サイズのことです。 これを有効にすると、優先サイズが変更されたときに <code>WebContents</code>で<code>preferred-size-changed</code>イベントが発生します。 省略値は <code>false</code> です。</li>\n</ul></li>\n<li><code>titleBarOverlay</code> Object | Boolean (任意) -  フレームレスウインドウを macOS の <code>win.setWindowButtonVisibility(true)</code> と組み合わせて使用している場合や、<code>titleBarStyle</code> を使用して標準ウインドウコントロール (macOS では \"信号機ボタン\") が表示されている場合、このプロパティはウインドウコントロールオーバーレイで <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis\">JavaScript API</a> と <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables\">CSS 環境変数</a> を有効にします。 <code>true</code> を指定すると、オーバーレイはデフォルトのシステムカラーになります。 省略値は <code>false</code> です。<ul>\n<li><code>color</code> String (任意) <em>Windows</em> - 有効化されたウインドウコントロールオーバーレイの CSS の色。 既定値はシステムカラーです。</li>\n<li><code>symbolColor</code> String (任意) <em>Windows</em> - 有効化されたウインドウコントロールオーバーレイ内の記号の CSS の色。 既定値はシステムカラーです。</li>\n</ul></li>\n</ul></li>\n</ul>\n<p><code>minWidth</code>/<code>maxWidth</code>/<code>minHeight</code>/<code>maxHeight</code> で最小もしくは最大のウインドウサイズを設定するのは、ユーザを束縛するだけです。 サイズ制約に関係しないサイズを <code>setBounds</code>/<code>setSize</code> や <code>BrowserWindow</code> のコンストラクタに渡すことは差し支えありません。</p>\n<p><code>type</code> オプションに設定できる値と動作は、プラットフォーム依存です。 以下は取りうる値です。</p>\n<ul>\n<li>Linuxでは、設定できる値は、<code>desktop</code>、<code>dock</code>、<code>toolbar</code>、<code>splash</code>、<code>notification</code> です。</li>\n<li>macOS で設定できるタイプは、<code>desktop</code>、<code>textured</code> です。<ul>\n<li><code>textured</code> タイプは、メタルのグラデーションの外観 (<code>NSTexturedBackgroundWindowMask</code>) を追加します。</li>\n<li><code>desktop</code> タイプは、ウインドウをデスクトップのバックグラウンドウインドウのレベル (<code>kCGDesktopWindowLevel - 1</code>) に配置します。 デスクトップウインドウはフォーカス、キーボードやマウスイベントを受け付けようとしないことに注意してください。しかしながら、<code>globalShortcut</code> を使って、かろうじて入力を受け付けることはできます。</li>\n</ul></li>\n<li>Windowsでは、設定できるタイプは、<code>toolbar</code> です。</li>\n</ul>\n<h3 id=\"インスタンスイベント\"><a href=\"#インスタンスイベント\">インスタンスイベント</a></h3>\n<p><code>new BrowserWindow</code> で作成されたオブジェクトでは以下のイベントが発生します。</p>\n<p><strong>注:</strong> いくつかのイベントは特定のオペレーティングシステムでのみ利用可能で、そのように注記がつけられています。</p>\n<h4 id=\"イベント-page-title-updated\"><a href=\"#イベント-page-title-updated\">イベント: 'page-title-updated'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>ドキュメントのタイトルが変更されたときに発生します。<code>event.preventDefault()</code> を呼び出すことで、ネイティブウインドウのタイトルが変更されるのをキャンセルできます。 タイトルがファイルの URL から合成された場合、<code>explicitSet</code> は false です。</p>\n<h4 id=\"イベント-close\"><a href=\"#イベント-close\">イベント: 'close'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>ウインドウがクローズされようとするときに発生します。 これは、DOMの <code>beforeunload</code> と <code>unload</code> イベントの前に発生します。 <code>event.preventDefault()</code> を呼び出すことで、クローズがキャンセルされます。</p>\n<p>通常、ウインドウをクローズさせる必要があるかどうかを判断するために、<code>beforeunload</code> ハンドラーを使用したいと思うでしょうが、これは、ウインドウがリロードされるときにも呼び出されます。 Electronでは、<code>undefined</code> 以外の値を返却すれば、クローズをキャンセルします。 以下がその例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-built_in\">window</span>.onbeforeunload = <span class=\"hljs-function\">(<span class=\"hljs-params\">e</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'I do not want to be closed'</span>)\n\n  <span class=\"hljs-comment\">// メッセージボックスがユーザに表示される通常のブラウザーとは違って、</span>\n  <span class=\"hljs-comment\">// 無効でない値を返却すれば、何も表示せずにクローズをキャンセルします。</span>\n  <span class=\"hljs-comment\">// アプリケーションがクローズするのをユーザに確認させるには、</span>\n  <span class=\"hljs-comment\">// ダイアログAPIを使用することを推奨します。</span>\n  e.returnValue = <span class=\"hljs-literal\">false</span> <span class=\"hljs-comment\">// `return false` と同じですが、非推奨</span>\n}\n</code></pre>\n<p><em><strong>注</strong>: <code>window.onbeforeunload = handler</code> と <code>window.addEventListener('beforeunload', handler)</code> の動作には、微妙な違いがあります。 値のみを返すのではなく、常に明示的に <code>event.returnValue</code> を設定するようにすることを推奨します。後者の方がElectron内でより一貫性のある動作をします。</em></p>\n<h4 id=\"イベント-closed\"><a href=\"#イベント-closed\">イベント: 'closed'</a></h4>\n<p>ウインドウが閉じられたときに発生します。 このイベントを受け取った後は、ウインドウへの参照を削除し、以降そのウインドウを使用しないようにしてください。</p>\n<h4 id=\"イベント-session-end-windows\"><a href=\"#イベント-session-end-windows\">イベント: 'session-end' <em>Windows</em></a></h4>\n<p>強制的なシャットダウン、マシン再起動またはセッションのログオフによってウインドウセッションが終了されようとしたときに発生します。</p>\n<h4 id=\"イベント-unresponsive\"><a href=\"#イベント-unresponsive\">イベント: 'unresponsive'</a></h4>\n<p>Webページが応答しなくなるときに発生します。</p>\n<h4 id=\"イベント-responsive\"><a href=\"#イベント-responsive\">イベント: 'responsive'</a></h4>\n<p>応答しないWebページが再び応答するようになるときに発生します。</p>\n<h4 id=\"イベント-blur\"><a href=\"#イベント-blur\">イベント: 'blur'</a></h4>\n<p>ウインドウがフォーカスを失うときに発生します。</p>\n<h4 id=\"イベント-focus\"><a href=\"#イベント-focus\">イベント: 'focus'</a></h4>\n<p>ウインドウがフォーカスを得るときに発生します。</p>\n<h4 id=\"イベント-show\"><a href=\"#イベント-show\">イベント: 'show'</a></h4>\n<p>ウインドウが表示されるときに発生します。</p>\n<h4 id=\"イベント-hide\"><a href=\"#イベント-hide\">イベント: 'hide'</a></h4>\n<p>ウインドウが非表示になるときに発生します。</p>\n<h4 id=\"イベント-ready-to-show\"><a href=\"#イベント-ready-to-show\">イベント: 'ready-to-show'</a></h4>\n<p>Webページが (まだ表示されていないが) レンダリングされ、チラつくことなくウインドウが表示できるときに発生します。</p>\n<p>このイベントを使用すると、<code>show</code> が false でもレンダラーが \"見えている\" と見なされ、描画されることに注意してください。  <code>paintWhenInitiallyHidden: false</code> を使用すると、このイベントは発生しません。</p>\n<h4 id=\"イベント-maximize\"><a href=\"#イベント-maximize\">イベント: 'maximize'</a></h4>\n<p>ウィンドウが最大化されるときに発生します。</p>\n<h4 id=\"イベント-unmaximize\"><a href=\"#イベント-unmaximize\">イベント: 'unmaximize'</a></h4>\n<p>ウインドウが最大化状態から抜けるときに発生します。</p>\n<h4 id=\"イベント-minimize\"><a href=\"#イベント-minimize\">イベント: 'minimize'</a></h4>\n<p>ウィンドウが最小化されるときに発生します。</p>\n<h4 id=\"イベント-restore\"><a href=\"#イベント-restore\">イベント: 'restore'</a></h4>\n<p>ウインドウが最小化状態から復元されたときに発生します。</p>\n<h4 id=\"イベント-will-resize-macos-windows\"><a href=\"#イベント-will-resize-macos-windows\">イベント: 'will-resize' <em>macOS</em> <em>Windows</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newBounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - ウインドウがリサイズされようとしているサイズ。</li>\n<li><code>details</code> Object<ul>\n<li><code>edge</code> (String) - サイズ変更のためにドラッグされているウインドウの縁。 <code>bottom</code>、<code>left</code>、<code>right</code>、<code>top-left</code>、<code>top-right</code>、<code>bottom-left</code>、<code>bottom-right</code> のいずれかになります。</li>\n</ul></li>\n</ul>\n<p>ウィンドウがリサイズされる前に発生します。 <code>event.preventDefault()</code>を呼び出すことで、ウィンドウがリサイズされるのを阻止できます。</p>\n<p>このイベントは、ウィンドウが手動でリサイズされようとしているときにしか発生しません。 ウィンドウを、<code>setBounds</code>や<code>setSize</code> でリサイズする時には、このイベントは発生しません。</p>\n<p><code>edge</code> オプションに設定できる値と動作は、プラットフォーム依存です。 以下は取りうる値です。</p>\n<ul>\n<li>Windows では、有効な値は <code>bottom</code>、<code>top</code>、<code>left</code>、<code>right</code>、<code>top-left</code>、<code>top-right</code>、<code>bottom-left</code>、<code>bottom-right</code> です。</li>\n<li>macOS では、有効な値は <code>bottom</code>、<code>right</code> です。<ul>\n<li>値 <code>bottom</code> は垂直方向のサイズ変更の表現に使用されます。</li>\n<li>値 <code>right</code> は水平方向のサイズ変更の表現に使用されます。</li>\n</ul></li>\n</ul>\n<h4 id=\"イベント-resize\"><a href=\"#イベント-resize\">イベント: 'resize'</a></h4>\n<p>ウインドウがリサイズされた後に発生します。</p>\n<h4 id=\"イベント-resized-macos-windows\"><a href=\"#イベント-resized-macos-windows\">イベント: 'resized' <em>macOS</em> <em>Windows</em></a></h4>\n<p>ウインドウがリサイズされるときに一度発生します。</p>\n<p>これは、通常、ウィンドウが手動でリサイズされようとしているときにしか発生しません。 macOS の場合 <code>setBounds</code>/<code>setSize</code> でウィンドウのサイズを変更し、 <code>animate</code> パラメーターを <code>true</code> に設定すると、サイズ変更が完了したときにも、このイベントが発生します。</p>\n<h4 id=\"イベント-will-move-macos-windows\"><a href=\"#イベント-will-move-macos-windows\">イベント: 'will-move' <em>macOS</em> <em>Windows</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newBounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - ウインドウが移動されようとしている位置。</li>\n</ul>\n<p>ウィンドウが移動される前に発生します。 Windows では、 <code>event.preventDefault()</code> を呼び出すことで、ウィンドウが移動されるのを阻止できます。</p>\n<p>このイベントは、ウィンドウが手動でリサイズされようとしているときにしか発生しません。 ウィンドウを、<code>setBounds</code>や<code>setSize</code> でリサイズする時には、このイベントは発生しません。</p>\n<h4 id=\"イベント-move\"><a href=\"#イベント-move\">イベント: 'move'</a></h4>\n<p>ウインドウが新しい位置に移動されているときに発生します。</p>\n<h4 id=\"イベント-moved-macos-windows\"><a href=\"#イベント-moved-macos-windows\">イベント: 'moved' <em>macOS</em> <em>Windows</em></a></h4>\n<p>ウインドウが新しい位置に移動されるときに一回だけ、発生します。</p>\n<p><strong>注</strong>: macOSでは、このイベントは <code>move</code> のエイリアスです。</p>\n<h4 id=\"イベント-enter-full-screen\"><a href=\"#イベント-enter-full-screen\">イベント: 'enter-full-screen'</a></h4>\n<p>ウインドウがフルスクリーン状態に入るときに発生します。</p>\n<h4 id=\"イベント-leave-full-screen\"><a href=\"#イベント-leave-full-screen\">イベント: 'leave-full-screen'</a></h4>\n<p>ウインドウがフルスクリーン状態を抜けるときに発生します。</p>\n<h4 id=\"イベント-enter-html-full-screen\"><a href=\"#イベント-enter-html-full-screen\">イベント: 'enter-html-full-screen'</a></h4>\n<p>ウインドウがHTML APIによってフルスクリーン状態に入るときに発生します。</p>\n<h4 id=\"イベント-leave-html-full-screen\"><a href=\"#イベント-leave-html-full-screen\">イベント: 'leave-html-full-screen'</a></h4>\n<p>ウインドウがHTML APIによってフルスクリーン状態を抜けるときに発生します。</p>\n<h4 id=\"イベント-always-on-top-changed\"><a href=\"#イベント-always-on-top-changed\">イベント: 'always-on-top-changed'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>isAlwaysOnTop</code> Boolean</li>\n</ul>\n<p>ウインドウが常に他のウインドウの手前に表示されるように設定またはそれが解除されたときに発生します。</p>\n<h4 id=\"イベント-app-command-windows-linux\"><a href=\"#イベント-app-command-windows-linux\">イベント: 'app-command' <em>Windows</em> <em>Linux</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>command</code> String</li>\n</ul>\n<p><a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/ms646275(v=vs.85).aspx\">アプリコマンド</a> が呼び出されるときに発生します。 これらは、Windowsで幾つかのマウスに組み込まれている \"Back\" ボタンだけでなく、一般的にキーボードのメディアキーやブラウザコマンドとも関連付けられています。</p>\n<p>コマンドは小文字にされ、アンダースコアはハイフンに置き換えられ、<code>APPCOMMAND_</code>プレフィックスは外されます。 例えば、<code>APPCOMMAND_BROWSER_BACKWARD</code> は、<code>browser-backward</code> として送信されます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-comment\">// ユーザーがマウスで戻るボタンを押下したときにナビゲートする</span>\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'browser-backward'</span> &#x26;&#x26; win.webContents.canGoBack()) {\n    win.webContents.goBack()\n  }\n})\n</code></pre>\n<p>Linux 上では以下のアプリコマンドが明示的にサポートされます。</p>\n<ul>\n<li><code>browser-backward</code></li>\n<li><code>browser-forward</code></li>\n</ul>\n<h4 id=\"イベント-scroll-touch-begin-macos\"><a href=\"#イベント-scroll-touch-begin-macos\">イベント: 'scroll-touch-begin' <em>macOS</em></a></h4>\n<p>スクロールホイールイベントフェーズが開始されたときに発生します。</p>\n<h4 id=\"イベント-scroll-touch-end-macos\"><a href=\"#イベント-scroll-touch-end-macos\">イベント: 'scroll-touch-end' <em>macOS</em></a></h4>\n<p>スクロールホイールイベントフェーズが終了したときに発生します。</p>\n<h4 id=\"イベント-scroll-touch-edge-macos\"><a href=\"#イベント-scroll-touch-edge-macos\">イベント: 'scroll-touch-edge' <em>macOS</em></a></h4>\n<p>スクロールイベントフェーズが要素の端に達したことを検出したときに発生します。</p>\n<h4 id=\"イベント-swipe-macos\"><a href=\"#イベント-swipe-macos\">イベント: 'swipe' <em>macOS</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>direction</code> String</li>\n</ul>\n<p>3 本指でのスワイプ時に発火されます。 方向は <code>up</code>、<code>right</code>、<code>down</code>、<code>left</code> のいずれかになります。</p>\n<p>このイベントは、スワイプで画面の内容が移動しない、古い macOS スタイルのトラックパッドスワイプを元にしています。 ほとんどの macOS トラックパッドはもうこの類のスワイプを許可していないため、正常にイベントを発生させるためには <code>システム環境設定 > トラックパッド > その他のジェスチャ</code> の 'ページ間をスワイプ' 設定を '2本指または3本指でスワイプ' にする必要があります。</p>\n<h4 id=\"イベント-rotate-gesture-macos\"><a href=\"#イベント-rotate-gesture-macos\">イベント: 'rotate-gesture' <em>macOS</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>rotation</code> Float</li>\n</ul>\n<p>トラックパッドの回転ジェスチャで発生します。 回転ジェスチャーが終了するまで継続的に発生します。 各イベントの <code>rotation</code> 値は、最後の発生から回転した角度です。 回転ジェスチャで最後に発行されたイベントは、常に <code>0</code> の値になります。 反時計回りの回転値は正であり、時計回りの回転値は負です。</p>\n<h4 id=\"イベント-sheet-begin-macos\"><a href=\"#イベント-sheet-begin-macos\">イベント: 'sheet-begin' <em>macOS</em></a></h4>\n<p>ウインドウがシートを開くときに発生します。</p>\n<h4 id=\"イベント-sheet-end-macos\"><a href=\"#イベント-sheet-end-macos\">イベント: 'sheet-end' <em>macOS</em></a></h4>\n<p>ウインドウがシートを閉じたときに発生します。</p>\n<h4 id=\"イベント-new-window-for-tab-macos\"><a href=\"#イベント-new-window-for-tab-macos\">イベント: 'new-window-for-tab' <em>macOS</em></a></h4>\n<p>ネイティブの新規タブボタンがクリックされるときに発生します。</p>\n<h4 id=\"イベント-system-context-menu-windows\"><a href=\"#イベント-system-context-menu-windows\">イベント: 'system-context-menu' <em>Windows</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a> - コンテキストメニューがトリガーされた画面の座標。</li>\n</ul>\n<p>システムコンテキストメニューがウィンドウ上でトリガーされたときに発生します。 通常ユーザーがウィンドウのクライアントエリア以外を右クリックしたときにトリガーされます。  これは、フレームレスウィンドウで<code>-webkit-app-region: drag</code>と宣言したウィンドウタイトルバーまたは任意の領域です。</p>\n<p><code>event.preventDefault()</code> を呼ぶと、そのメニューは表示されなくなります。</p>\n<h3 id=\"静的メソッド\"><a href=\"#静的メソッド\">静的メソッド</a></h3>\n<p><code>BrowserWindow</code> クラスには、次の静的メソッドがあります。</p>\n<h4 id=\"browserwindowgetallwindows\"><a href=\"#browserwindowgetallwindows\"><code>BrowserWindow.getAllWindows()</code></a></h4>\n<p>戻り値 <code>BrowserWindow[]</code> - 開かれたすべてのブラウザウィンドウの配列。</p>\n<h4 id=\"browserwindowgetfocusedwindow\"><a href=\"#browserwindowgetfocusedwindow\"><code>BrowserWindow.getFocusedWindow()</code></a></h4>\n<p>戻り値 <code>BrowserWindow | null</code> - このアプリケーションでフォーカスされたウインドウ。それ以外は、<code>null</code> を返します。</p>\n<h4 id=\"browserwindowfromwebcontentswebcontents\"><a href=\"#browserwindowfromwebcontentswebcontents\"><code>BrowserWindow.fromWebContents(webContents)</code></a></h4>\n<ul>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>戻り値 <code>BrowserWindow | null</code> - 指定された <code>webContents</code> を保持しているウインドウ。ウインドウが保持していないコンテンツの場合は <code>null</code> です。</p>\n<h4 id=\"browserwindowfrombrowserviewbrowserview\"><a href=\"#browserwindowfrombrowserviewbrowserview\"><code>BrowserWindow.fromBrowserView(browserView)</code></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>戻り値 <code>BrowserWindow</code> - 指定された <code>browserView</code> を所有するウインドウ。 指定されたビューがどのウィンドウにもアタッチされていない場合は、 <code>null</code>を返します。</p>\n<h4 id=\"browserwindowfromidid\"><a href=\"#browserwindowfromidid\"><code>BrowserWindow.fromId(id)</code></a></h4>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>戻り値 <code>BrowserWindow | null</code> - 指定された <code>id</code> のウインドウ。</p>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<p><code>new BrowserWindow</code> で作成されたオブジェクトは、以下のプロパティを持っています。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">// この例では、 `win` がインスタンス</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<h4 id=\"winwebcontents-読み出し専用\"><a href=\"#winwebcontents-読み出し専用\"><code>win.webContents</code> <em>読み出し専用</em></a></h4>\n<p>このウィンドウが所有する <code>WebContents</code> オブジェクト。 すべての Web ページ関連のイベントおよび操作は、これを介して行われます。</p>\n<p><a href=\"/docs/api/web-contents\"><code>webContents</code> ドキュメント</a> でメソッドやイベントについて参照してください。</p>\n<h4 id=\"winid-読み出し専用\"><a href=\"#winid-読み出し専用\"><code>win.id</code> <em>読み出し専用</em></a></h4>\n<p><code>Integer</code> 型のプロパティです。そのウインドウの一意な ID を表します。 各 ID は、この Electron アプリケーション全体のすべての <code>BrowserWindow</code> インスタンス間で一意です。</p>\n<h4 id=\"winautohidemenubar\"><a href=\"#winautohidemenubar\"><code>win.autoHideMenuBar</code></a></h4>\n<p>ウインドウがユーザーによって手動で最小化できるかどうかを決定する <code>Boolean</code> 型のプロパティ。 一度設定されると、メニューバーはユーザが単独で <code>Alt</code> キーを押したときのみに表示されます。</p>\n<p>メニューバーが既に表示されている場合、このプロパティを <code>true</code> にセットしてもすぐに非表示にはなりません。</p>\n<h4 id=\"winsimplefullscreen\"><a href=\"#winsimplefullscreen\"><code>win.simpleFullScreen</code></a></h4>\n<p><code>Boolean</code> 型のプロパティです。これは、ウィンドウがシンプルな (Lion 以前の) フルスクリーンモードかどうかを決定します。</p>\n<h4 id=\"winfullscreen\"><a href=\"#winfullscreen\"><code>win.fullScreen</code></a></h4>\n<p><code>Boolean</code> 型のプロパティです。これは、ウィンドウがフルスクリーンモードかどうかを決定します。</p>\n<h4 id=\"winfocusable-windows-macos\"><a href=\"#winfocusable-windows-macos\"><code>win.focusable</code> <em>Windows</em> <em>macOS</em></a></h4>\n<p><code>Boolean</code> 型のプロパティです。ウィンドウにフォーカスできるどうかを決定します。</p>\n<h4 id=\"winvisibleonallworkspaces\"><a href=\"#winvisibleonallworkspaces\"><code>win.visibleOnAllWorkspaces</code></a></h4>\n<p><code>Boolean</code> 型のプロパティです。これは、ウィンドウがすべてのワークスペースで表示されるどうかを決定します。</p>\n<p><strong>注:</strong> Windows の場合、常に false を返します。</p>\n<h4 id=\"winshadow\"><a href=\"#winshadow\"><code>win.shadow</code></a></h4>\n<p><code>Boolean</code> 型のプロパティです。ウィンドウに影があるかどうかを決定します。</p>\n<h4 id=\"winmenubarvisible-windows-linux\"><a href=\"#winmenubarvisible-windows-linux\"><code>win.menuBarVisible</code> <em>Windows</em> <em>Linux</em></a></h4>\n<p><code>Boolean</code> 型のプロパティです。メニューバーが表示されるかどうかを決定します。</p>\n<p><strong>注:</strong> メニューバーが自動的に非表示にされている場合でも、ユーザが単に <code>Alt</code> キーを押下すれば、依然としてメニューバーを表示させることができます。</p>\n<h4 id=\"winkiosk\"><a href=\"#winkiosk\"><code>win.kiosk</code></a></h4>\n<p><code>Boolean</code> 型のプロパティです。これは、ウィンドウがキオスクモードかどうかを決定します。</p>\n<h4 id=\"windocumentedited-macos\"><a href=\"#windocumentedited-macos\"><code>win.documentEdited</code> <em>macOS</em></a></h4>\n<p><code>Boolean</code> 型のプロパティです。ウィンドウのドキュメントが編集されたかどうかを決定します。</p>\n<p><code>true</code> にすると、タイトルバーのアイコンが灰色になります。</p>\n<h4 id=\"winrepresentedfilename-macos\"><a href=\"#winrepresentedfilename-macos\"><code>win.representedFilename</code> <em>macOS</em></a></h4>\n<p><code>String</code> 型のプロパティです。ウィンドウが表すファイルのパス名を決定し、そのファイルのアイコンがウィンドウのタイトルバーに表示されます。</p>\n<h4 id=\"wintitle\"><a href=\"#wintitle\"><code>win.title</code></a></h4>\n<p><code>String</code> 型のプロパティです。ネイティブウインドウのタイトルを決定します。</p>\n<p><strong>注:</strong> ウェブページのタイトルとネイティブウインドウのタイトルは異なる可能性があります。</p>\n<h4 id=\"winminimizable\"><a href=\"#winminimizable\"><code>win.minimizable</code></a></h4>\n<p><code>Boolean</code> 型のプロパティです。ウインドウがユーザーによって手動で最小化できるかどうかを決定します。</p>\n<p>Linux ではセッターは何もしませんが、ゲッターは <code>true</code> を返します。</p>\n<h4 id=\"winmaximizable\"><a href=\"#winmaximizable\"><code>win.maximizable</code></a></h4>\n<p><code>Boolean</code> 型のプロパティです。ウインドウがユーザーによって手動で最大化できるかどうかを決定します。</p>\n<p>Linux ではセッターは何もしませんが、ゲッターは <code>true</code> を返します。</p>\n<h4 id=\"winfullscreenable\"><a href=\"#winfullscreenable\"><code>win.fullScreenable</code></a></h4>\n<p><code>Boolean</code> 型のプロパティです。ウインドウを最大化/ズームするウインドウボタンでフルスクリーンモードや最大化をトグル切り替えできるかどうかを決定します。</p>\n<h4 id=\"winresizable\"><a href=\"#winresizable\"><code>win.resizable</code></a></h4>\n<p><code>Boolean</code> 型のプロパティです。ウインドウがユーザーによって手動でサイズ変更できるかどうかを決定します。</p>\n<h4 id=\"winclosable\"><a href=\"#winclosable\"><code>win.closable</code></a></h4>\n<p><code>Boolean</code> 型のプロパティです。ウインドウがユーザーによって手動で閉じることができるかどうかを決定します。</p>\n<p>Linux ではセッターは何もしませんが、ゲッターは <code>true</code> を返します。</p>\n<h4 id=\"winmovable\"><a href=\"#winmovable\"><code>win.movable</code></a></h4>\n<p><code>Boolean</code> 型のプロパティです。ウインドウがユーザーによって移動できるかどうかを決定します。</p>\n<p>Linux ではセッターは何もしませんが、ゲッターは <code>true</code> を返します。</p>\n<h4 id=\"winexcludedfromshownwindowsmenu-macos\"><a href=\"#winexcludedfromshownwindowsmenu-macos\"><code>win.excludedFromShownWindowsMenu</code> <em>macOS</em></a></h4>\n<p>ウィンドウがアプリケーションの Windows メニューから除外されるかどうかを決定する <code>Boolean</code> プロパティ。 省略値は <code>false</code> です。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-keyword\">const</span> template = [\n  {\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'windowmenu'</span>\n  }\n]\n\nwin.excludedFromShownWindowsMenu = <span class=\"hljs-literal\">true</span>\n\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\nMenu.setApplicationMenu(menu)\n</code></pre>\n<h4 id=\"winaccessibletitle\"><a href=\"#winaccessibletitle\"><code>win.accessibleTitle</code></a></h4>\n<p>スクリーンリーダーなどのアクセシビリティツールにのみ提供される代替タイトルを定義する <code>String</code> 型のプロパティ。 この文字列はユーザに直接表示されません。</p>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<p><code>new BrowserWindow</code> で作成されたオブジェクトは、次のインスタンスメソッドを持っています。</p>\n<p><strong>注:</strong> いくつかのメソッドは特定のオペレーティングシステムでのみ利用可能で、そのように注記がつけられています。</p>\n<h4 id=\"windestroy\"><a href=\"#windestroy\"><code>win.destroy()</code></a></h4>\n<p>強制的にウインドウを閉じます。<code>unload</code> と <code>beforeunload</code> イベントはWebページで発生しません。また、<code>close</code> イベントもこのウインドウで発生しません。しかし、<code>closed</code> イベントが発生することは保証されます。</p>\n<h4 id=\"winclose\"><a href=\"#winclose\"><code>win.close()</code></a></h4>\n<p>ウインドウを閉じようとします。 これは、ユーザーが手動でウィンドウの閉じるボタンをクリックした場合と同じ効果があります。 ただし、 Web ページはウィンドウが閉じようとするのををキャンセルすることができます。 <a href=\"#event-close\">close イベント</a> を参照してください。</p>\n<h4 id=\"winfocus\"><a href=\"#winfocus\"><code>win.focus()</code></a></h4>\n<p>ウインドウにフォーカスを当てます。</p>\n<h4 id=\"winblur\"><a href=\"#winblur\"><code>win.blur()</code></a></h4>\n<p>ウインドウからフォーカスを外します。</p>\n<h4 id=\"winisfocused\"><a href=\"#winisfocused\"><code>win.isFocused()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウがフォーカスされているかどうか。</p>\n<h4 id=\"winisdestroyed\"><a href=\"#winisdestroyed\"><code>win.isDestroyed()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウが破棄されているかどうか。</p>\n<h4 id=\"winshow\"><a href=\"#winshow\"><code>win.show()</code></a></h4>\n<p>表示し、ウインドウにフォーカスを当てます。</p>\n<h4 id=\"winshowinactive\"><a href=\"#winshowinactive\"><code>win.showInactive()</code></a></h4>\n<p>ウインドウを表示しますが、フォーカスを当てません。</p>\n<h4 id=\"winhide\"><a href=\"#winhide\"><code>win.hide()</code></a></h4>\n<p>ウインドウを非表示にします。</p>\n<h4 id=\"winisvisible\"><a href=\"#winisvisible\"><code>win.isVisible()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウがユーザーに表示されているかどうか。</p>\n<h4 id=\"winismodal\"><a href=\"#winismodal\"><code>win.isModal()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - 現在のウインドウがモーダルウインドウかどうか。</p>\n<h4 id=\"winmaximize\"><a href=\"#winmaximize\"><code>win.maximize()</code></a></h4>\n<p>ウィンドウを最大化します。 ウインドウがまだ表示されていない場合、併せてウインドウを表示 (ただし、フォーカスは当たりません) します。</p>\n<h4 id=\"winunmaximize\"><a href=\"#winunmaximize\"><code>win.unmaximize()</code></a></h4>\n<p>ウインドウの最大化を解除します。</p>\n<h4 id=\"winismaximized\"><a href=\"#winismaximized\"><code>win.isMaximized()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウが最大化されているかどうか。</p>\n<h4 id=\"winminimize\"><a href=\"#winminimize\"><code>win.minimize()</code></a></h4>\n<p>ウィンドウを最小化します。 一部のプラットフォームでは、最小化されたウィンドウが Dock に表示されます。</p>\n<h4 id=\"winrestore\"><a href=\"#winrestore\"><code>win.restore()</code></a></h4>\n<p>ウインドウを最小化された状態からその前の状態に戻します。</p>\n<h4 id=\"winisminimized\"><a href=\"#winisminimized\"><code>win.isMinimized()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウが最小化されているかどうか。</p>\n<h4 id=\"winsetfullscreenflag\"><a href=\"#winsetfullscreenflag\"><code>win.setFullScreen(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>ウインドウをフルスクリーンモードにするかどうかを設定します。</p>\n<h4 id=\"winisfullscreen\"><a href=\"#winisfullscreen\"><code>win.isFullScreen()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウがフルスクリーンモードであるかどうか。</p>\n<h4 id=\"winsetsimplefullscreenflag-macos\"><a href=\"#winsetsimplefullscreenflag-macos\"><code>win.setSimpleFullScreen(flag)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>簡易フルスクリーンモードに設定したり、解除したりします。</p>\n<p>macOS Lion (10.7) より前のバージョンで見られる簡易フルスクリーンモードはネイティブのフルスクリーン動作をエミュレートします。</p>\n<h4 id=\"winissimplefullscreen-macos\"><a href=\"#winissimplefullscreen-macos\"><code>win.isSimpleFullScreen()</code> <em>macOS</em></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウが簡易 (Lionより前) フルスクリーンモードであるかどうか。</p>\n<h4 id=\"winisnormal\"><a href=\"#winisnormal\"><code>win.isNormal()</code></a></h4>\n<p>Returns <code>Boolean</code> - ウィンドウが通常の状態 (最大化されていない、最小化されていない、フルスクリーンモードではない) かどうか。</p>\n<h4 id=\"winsetaspectratioaspectratio-extrasize\"><a href=\"#winsetaspectratioaspectratio-extrasize\"><code>win.setAspectRatio(aspectRatio[, extraSize])</code></a></h4>\n<ul>\n<li><code>aspectRatio</code> Float - コンテンツビューの一部を維持するためのアスペクト比。</li>\n<li><code>extraSize</code> <a href=\"/docs/api/structures/size\">Size</a> (任意) <em>macOS</em> - アスペクト比を維持している間は含まれない余分のサイズ。</li>\n</ul>\n<p>これはウインドウのアスペクト比を維持します。 ピクセルで指定した追加のサイズによって、開発者は、アスペクト比の計算に含まれないスペースを確保することができます。 このAPIはウインドウのサイズとそのコンテンツのサイズの差異も考慮しています。</p>\n<p>HDビデオプレーヤーと関連したコントロールを持つ通常のウインドウを考えてみましょう。 ひょっとすると、左端に15ピクセルのコントロール、右端に25ピクセルのコントロール、プレーヤーの下部に50ピクセルのコントロールがあるかもしれません。 プレーヤー内で 16:9 アスペクト比 (HD @1920x1280 の標準的なアスペクト比) を維持するためには、この関数を 16/9 と { width: 40, height: 50 } の引数で呼び出します。 2番目の引数は、追加の幅と高さがコンテンツビューの中に収まるかを気にしません。それらはただ存在しているだけです。 全体のコンテンツビュー内にある余分な幅と高さの領域を単純に足し合わせます。</p>\n<p><code>win.setSize</code> などの API でプログラム上からウインドウをサイズ変更した場合、アスペクト比は維持されません。</p>\n<h4 id=\"winsetbackgroundcolorbackgroundcolor\"><a href=\"#winsetbackgroundcolorbackgroundcolor\"><code>win.setBackgroundColor(backgroundColor)</code></a></h4>\n<ul>\n<li><code>backgroundColor</code> String - <code>#66CD00</code> や <code>#FFF</code> や <code>#80FFFFFF</code> (<code>transparent</code> を <code>true</code> にすればアルファ値をサポートします) のような16進数の値でのウインドウの背景色。 省略値は <code>#FFF</code> (白) です。</li>\n</ul>\n<p>ウィンドウの背景色を設定します。 <a href=\"#setting-backgroundcolor\"><code>backgroundColor</code> 設定</a> を参照してください。</p>\n<h4 id=\"winpreviewfilepath-displayname-macos\"><a href=\"#winpreviewfilepath-displayname-macos\"><code>win.previewFile(path[, displayName])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>path</code> String - Quick Lookでプレビューするファイルへの絶対パス。 ここで、Quick Lookはパスのファイル名とファイル拡張子をファイルを開くためのコンテンツタイプを決定するのに使用する点が重要です。</li>\n<li><code>displayName</code> String (任意) - Quick Lookのモーダルビューに表示するファイルの名前。 これは純粋に見た目だけのもので、ファイルのコンテンツタイプには影響しません。 省略値は、<code>path</code> です。</li>\n</ul>\n<p>指定したパスでファイルをプレビューするために、<a href=\"https://en.wikipedia.org/wiki/Quick_Look\">Quick Look</a> を使用します。</p>\n<h4 id=\"winclosefilepreview-macos\"><a href=\"#winclosefilepreview-macos\"><code>win.closeFilePreview()</code> <em>macOS</em></a></h4>\n<p>現在開いている <a href=\"https://en.wikipedia.org/wiki/Quick_Look\">Quick Look</a> のパネルを閉じます。</p>\n<h4 id=\"winsetboundsbounds-animate\"><a href=\"#winsetboundsbounds-animate\"><code>win.setBounds(bounds[, animate])</code></a></h4>\n<ul>\n<li><code>bounds</code> Partial&#x3C;<a href=\"/docs/api/structures/rectangle\">Rectangle</a>></li>\n<li><code>animate</code> Boolean (任意) <em>macOS</em></li>\n</ul>\n<p>指定した境界までウインドウのサイズを変更して移動します。 指定されていないプロパティは、既定で現在の値になります。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-comment\">// bounds のプロパティをすべて設定</span>\nwin.setBounds({ <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">440</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">225</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-comment\">// bounds のプロパティをひとつ設定</span>\nwin.setBounds({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">100</span> })\n\n<span class=\"hljs-comment\">// { x: 440, y: 225, width: 100, height: 600 }</span>\n<span class=\"hljs-built_in\">console</span>.log(win.getBounds())\n</code></pre>\n<h4 id=\"wingetbounds\"><a href=\"#wingetbounds\"><code>win.getBounds()</code></a></h4>\n<p>戻り値 <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - ウインドウの <code>bounds</code> が <code>Object</code> になったもの。</p>\n<h4 id=\"wingetbackgroundcolor\"><a href=\"#wingetbackgroundcolor\"><code>win.getBackgroundColor()</code></a></h4>\n<p>戻り値 <code>String</code> - ウインドウの背景色を取得します。 <a href=\"#setting-backgroundcolor\"><code>backgroundColor</code> 設定</a> を参照してください。</p>\n<h4 id=\"winsetcontentboundsbounds-animate\"><a href=\"#winsetcontentboundsbounds-animate\"><code>win.setContentBounds(bounds[, animate])</code></a></h4>\n<ul>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n<li><code>animate</code> Boolean (任意) <em>macOS</em></li>\n</ul>\n<p>指定した境界までウインドウのクライアント領域 (例えば、Webページ) のサイズを変更して移動します。</p>\n<h4 id=\"wingetcontentbounds\"><a href=\"#wingetcontentbounds\"><code>win.getContentBounds()</code></a></h4>\n<p>戻り値 <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - ウインドウの内部領域の <code>bounds</code> が <code>Object</code> になったもの。</p>\n<h4 id=\"wingetnormalbounds\"><a href=\"#wingetnormalbounds\"><code>win.getNormalBounds()</code></a></h4>\n<p>Returns <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - 通常状態におけるウィンドウ境界を含む領域。</p>\n<p><strong>注意:</strong> ウインドウの現在の状態: 最大化、最小化、または全画面表示に関係なく、この関数は常に通常状態のウインドウの位置とサイズを返します。 通常状態においては、getBounds と getNormalBounds は同じ <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> を返します。</p>\n<h4 id=\"winsetenabledenable\"><a href=\"#winsetenabledenable\"><code>win.setEnabled(enable)</code></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>ウインドウを無効にするか有効にします。</p>\n<h4 id=\"winisenabled\"><a href=\"#winisenabled\"><code>win.isEnabled()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - そのウインドウが有効かどうか。</p>\n<h4 id=\"winsetsizewidth-height-animate\"><a href=\"#winsetsizewidth-height-animate\"><code>win.setSize(width, height[, animate])</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>animate</code> Boolean (任意) <em>macOS</em></li>\n</ul>\n<p>ウインドウのサイズを <code>width</code> と <code>height</code> に変更します。 <code>width</code> または <code>height</code> が最小サイズ制約の設定値より低い場合、ウィンドウはその最小サイズにスナップします。</p>\n<h4 id=\"wingetsize\"><a href=\"#wingetsize\"><code>win.getSize()</code></a></h4>\n<p>戻り値 <code>Integer[]</code> - ウインドウの幅と高さを含みます。</p>\n<h4 id=\"winsetcontentsizewidth-height-animate\"><a href=\"#winsetcontentsizewidth-height-animate\"><code>win.setContentSize(width, height[, animate])</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>animate</code> Boolean (任意) <em>macOS</em></li>\n</ul>\n<p>ウインドウのクライアント領域 (例えば、Webページ) のサイズを <code>width</code> と <code>height</code> に変更します。</p>\n<h4 id=\"wingetcontentsize\"><a href=\"#wingetcontentsize\"><code>win.getContentSize()</code></a></h4>\n<p>戻り値 <code>Integer[]</code> - ウインドウのクライアント領域の幅と高さを含みます。</p>\n<h4 id=\"winsetminimumsizewidth-height\"><a href=\"#winsetminimumsizewidth-height\"><code>win.setMinimumSize(width, height)</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n</ul>\n<p>ウインドウの最小サイズを <code>width</code> と <code>height</code> に設定します。</p>\n<h4 id=\"wingetminimumsize\"><a href=\"#wingetminimumsize\"><code>win.getMinimumSize()</code></a></h4>\n<p>戻り値 <code>Integer[]</code> - ウインドウの最小の幅と高さを含みます。</p>\n<h4 id=\"winsetmaximumsizewidth-height\"><a href=\"#winsetmaximumsizewidth-height\"><code>win.setMaximumSize(width, height)</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n</ul>\n<p>ウインドウの最大サイズを <code>width</code> と <code>height</code> に設定します。</p>\n<h4 id=\"wingetmaximumsize\"><a href=\"#wingetmaximumsize\"><code>win.getMaximumSize()</code></a></h4>\n<p>戻り値 <code>Integer[]</code> - ウインドウの最大の幅と高さを含みます。</p>\n<h4 id=\"winsetresizableresizable\"><a href=\"#winsetresizableresizable\"><code>win.setResizable(resizable)</code></a></h4>\n<ul>\n<li><code>resizable</code> Boolean</li>\n</ul>\n<p>ウインドウがユーザによって手動でサイズ変更できるかどうかを設定します。</p>\n<h4 id=\"winisresizable\"><a href=\"#winisresizable\"><code>win.isResizable()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウがユーザによって手動でサイズ変更できるかどうか。</p>\n<h4 id=\"winsetmovablemovable-macos-windows\"><a href=\"#winsetmovablemovable-macos-windows\"><code>win.setMovable(movable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>movable</code> Boolean</li>\n</ul>\n<p>ウインドウがユーザーによって手動で移動できるかどうかを設定します。 Linux では何もしません。</p>\n<h4 id=\"winismovable-macos-windows\"><a href=\"#winismovable-macos-windows\"><code>win.isMovable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウがユーザーによって移動できるかどうか。</p>\n<p>Linuxでは常に <code>true</code> を返します。</p>\n<h4 id=\"winsetminimizableminimizable-macos-windows\"><a href=\"#winsetminimizableminimizable-macos-windows\"><code>win.setMinimizable(minimizable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>minimizable</code> Boolean</li>\n</ul>\n<p>ウインドウがユーザーによって手動で最小化できるかどうかを設定します。 Linux では何もしません。</p>\n<h4 id=\"winisminimizable-macos-windows\"><a href=\"#winisminimizable-macos-windows\"><code>win.isMinimizable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウがユーザによって手動で最小化できるかどうか。</p>\n<p>Linuxでは常に <code>true</code> を返します。</p>\n<h4 id=\"winsetmaximizablemaximizable-macos-windows\"><a href=\"#winsetmaximizablemaximizable-macos-windows\"><code>win.setMaximizable(maximizable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>maximizable</code> Boolean</li>\n</ul>\n<p>ウインドウがユーザーによって手動で最大化できるかどうかを設定します。 Linux では何もしません。</p>\n<h4 id=\"winismaximizable-macos-windows\"><a href=\"#winismaximizable-macos-windows\"><code>win.isMaximizable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウがユーザーによって手動で最大化できるかどうか。</p>\n<p>Linuxでは常に <code>true</code> を返します。</p>\n<h4 id=\"winsetfullscreenablefullscreenable\"><a href=\"#winsetfullscreenablefullscreenable\"><code>win.setFullScreenable(fullscreenable)</code></a></h4>\n<ul>\n<li><code>fullscreenable</code> Boolean</li>\n</ul>\n<p>ウインドウの最大化/ズームボタンでフルスクリーンモードに切り替えるか、ウインドウを最大化するかを設定します。</p>\n<h4 id=\"winisfullscreenable\"><a href=\"#winisfullscreenable\"><code>win.isFullScreenable()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウの最大化/ズームボタンでフルスクリーンモードに切り替えるのか、それともウインドウを最大化するのか。</p>\n<h4 id=\"winsetclosableclosable-macos-windows\"><a href=\"#winsetclosableclosable-macos-windows\"><code>win.setClosable(closable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>closable</code> Boolean</li>\n</ul>\n<p>ウインドウがユーザーによって手動で閉じられるかどうかを設定します。 Linux では何もしません。</p>\n<h4 id=\"winisclosable-macos-windows\"><a href=\"#winisclosable-macos-windows\"><code>win.isClosable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウをユーザーが手動で閉じられるかどうか。</p>\n<p>Linuxでは常に <code>true</code> を返します。</p>\n<h4 id=\"winsetalwaysontopflag-level-relativelevel\"><a href=\"#winsetalwaysontopflag-level-relativelevel\"><code>win.setAlwaysOnTop(flag[, level][, relativeLevel])</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n<li><code>level</code> String (任意) <em>macOS</em> <em>Windows</em> - 値は、<code>normal</code>、<code>floating</code>、<code>torn-off-menu</code>、<code>modal-panel</code>、<code>main-menu</code>、<code>status</code>、<code>pop-up-menu</code>、<code>screen-saver</code> と <del><code>dock</code></del> (非推奨) です。 <code>flag</code> が true の場合、省略値は <code>floating</code> です。 flag が false の場合、<code>level</code> は <code>normal</code> にリセットされます。 <code>floating</code> から <code>status</code> までに含まれているものにおいて、ウィンドウは macOS では Dock の下に、Windows ではタスクバーの下に配置されることをことに注意してください。 <code>pop-up-menu</code> 以降は、macOS では Dock の上に、Windows ではタスクバーの上に表示されます。 詳細については、<a href=\"https://developer.apple.com/documentation/appkit/nswindow/level\">macOS のドキュメント</a> を参照してください。</li>\n<li><code>relativeLevel</code> Integer (任意) <em>macOS</em> - このウインドウに設定する指定した <code>level</code> より上のレイヤーの数。 省略値は、<code>0</code> です。 Apple社は、<code>screen-saver</code> より上に1以上のレベルを設定することを推奨していないことに注意してください。</li>\n</ul>\n<p>ウィンドウを常に他のウィンドウの上に表示するかどうかを設定します。 この設定を行った後でも、ウィンドウはまだ通常のものであり、フォーカスが当てられないツールボックスウィンドウではありません。</p>\n<h4 id=\"winisalwaysontop\"><a href=\"#winisalwaysontop\"><code>win.isAlwaysOnTop()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウが常に他のウインドウの上に表示されるかどうか。</p>\n<h4 id=\"winmoveabovemediasourceid\"><a href=\"#winmoveabovemediasourceid\"><code>win.moveAbove(mediaSourceId)</code></a></h4>\n<ul>\n<li><code>mediaSourceId</code> String - DesktopCapturerSource の ID の形式のウィンドウ ID。 例えば \"window:1869:0\" 。</li>\n</ul>\n<p>Z オーダーの意味で、ウィンドウをソースウィンドウの上に移動します。 <code>mediaSourceId</code> がウィンドウの ID でないか、ウィンドウが存在しない場合、このメソッドはエラーをスローします。</p>\n<h4 id=\"winmovetop\"><a href=\"#winmovetop\"><code>win.moveTop()</code></a></h4>\n<p>フォーカスに関係なく上 (Z順序) にウィンドウを移動します。</p>\n<h4 id=\"wincenter\"><a href=\"#wincenter\"><code>win.center()</code></a></h4>\n<p>ウインドウを画面の中央に移動します。</p>\n<h4 id=\"winsetpositionx-y-animate\"><a href=\"#winsetpositionx-y-animate\"><code>win.setPosition(x, y[, animate])</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n<li><code>animate</code> Boolean (任意) <em>macOS</em></li>\n</ul>\n<p>ウインドウを <code>x</code> と <code>y</code> に移動します。</p>\n<h4 id=\"wingetposition\"><a href=\"#wingetposition\"><code>win.getPosition()</code></a></h4>\n<p>戻り値 <code>Integer[]</code> - ウインドウの現在の位置を含みます。</p>\n<h4 id=\"winsettitletitle\"><a href=\"#winsettitletitle\"><code>win.setTitle(title)</code></a></h4>\n<ul>\n<li><code>title</code> String</li>\n</ul>\n<p>ネイティブのウインドウのタイトルを <code>title</code> に変更します。</p>\n<h4 id=\"wingettitle\"><a href=\"#wingettitle\"><code>win.getTitle()</code></a></h4>\n<p>戻り値 <code>String</code> - ネイティブのウインドウのタイトル。</p>\n<p><strong>注:</strong> Web ページのタイトルはネイティブのウインドウのタイトルとは異なる可能性があります。</p>\n<h4 id=\"winsetsheetoffsetoffsety-offsetx-macos\"><a href=\"#winsetsheetoffsetoffsety-offsetx-macos\"><code>win.setSheetOffset(offsetY[, offsetX])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>offsetY</code> Float</li>\n<li><code>offsetX</code> Float (optional)</li>\n</ul>\n<p>macOS においてシートを設置する位置を変更します。 既定では、シートはウィンドウフレームのすぐ下に設置されますが、 HTML で表示されたツールバーの下に表示することもできます。 以下がその例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-keyword\">const</span> toolbarRect = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'toolbar'</span>).getBoundingClientRect()\nwin.setSheetOffset(toolbarRect.height)\n</code></pre>\n<h4 id=\"winflashframeflag\"><a href=\"#winflashframeflag\"><code>win.flashFrame(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>ユーザの注意を引きつけるためにウインドウの点滅を開始または停止します。</p>\n<h4 id=\"winsetskiptaskbarskip\"><a href=\"#winsetskiptaskbarskip\"><code>win.setSkipTaskbar(skip)</code></a></h4>\n<ul>\n<li><code>skip</code> Boolean</li>\n</ul>\n<p>ウインドウがタスクバーに表示されなくなります。</p>\n<h4 id=\"winsetkioskflag\"><a href=\"#winsetkioskflag\"><code>win.setKiosk(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>キオスクモードに入ったり出たりします。</p>\n<h4 id=\"winiskiosk\"><a href=\"#winiskiosk\"><code>win.isKiosk()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウがキオスクモードであるかどうか。</p>\n<h4 id=\"winistabletmode-windows\"><a href=\"#winistabletmode-windows\"><code>win.isTabletMode()</code> <em>Windows</em></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウが Windows 10 タブレットモードであるかどうか。</p>\n<p>Windows 10 ユーザーは <a href=\"https://support.microsoft.com/en-us/help/17210/windows-10-use-your-pc-like-a-tablet\">PC をタブレットとして使用できる</a> ので、アプリはこのモードの際にタイトルバーを大きくしたり、タイトルバーのボタンを非表示にしたりと、タブレット用に UI を最適化できます。</p>\n<p>この API は、ウインドウがタブレットモードかどうかを返します。<code>resize</code> イベントでタブレットモードへの変更をリッスンすることもできます。</p>\n<h4 id=\"wingetmediasourceid\"><a href=\"#wingetmediasourceid\"><code>win.getMediaSourceId()</code></a></h4>\n<p>戻り値 <code>String</code> - DesktopCapturerSource の ID の形式のウィンドウ ID。 例えば \"window:1324:0\" 。</p>\n<p>より正確には、フォーマットは <code> window:id:other_id</code> です。ここでの <code>id</code> は、Windows では <code>HWND</code>、macOS では <code>CGWindowID</code> (<code>uint64_t</code>)、Linux では <code>Window</code> (<code>unsigned long</code>) です。 <code>other_id</code> は、同じトップレベルウィンドウ内のウェブコンテンツ (タブ) を識別するために使用されます。</p>\n<h4 id=\"wingetnativewindowhandle\"><a href=\"#wingetnativewindowhandle\"><code>win.getNativeWindowHandle()</code></a></h4>\n<p>戻り値 <code>Buffer</code> - ウインドウのプラットフォーム固有のハンドル。</p>\n<p>ハンドルのネイティブな型は、Windowsでは <code>HWND</code>、macOSでは <code>NSView*</code>、Linuxでは <code>Window</code> (<code>unsigned long</code>) です。</p>\n<h4 id=\"winhookwindowmessagemessage-callback-windows\"><a href=\"#winhookwindowmessagemessage-callback-windows\"><code>win.hookWindowMessage(message, callback)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n<li><code>callback</code> Function<ul>\n<li><code>wParam</code> any - WndProc に指定された <code>wParam</code></li>\n<li><code>lParam</code> any - WndProc に指定された <code>lParam</code></li>\n</ul></li>\n</ul>\n<p>ウィンドウメッセージをフックします。 メッセージが WndProc で受信されると、 <code>callback</code> が呼び出されます。</p>\n<h4 id=\"winiswindowmessagehookedmessage-windows\"><a href=\"#winiswindowmessagehookedmessage-windows\"><code>win.isWindowMessageHooked(message)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - メッセージがフックされているかどうかによって、<code>true</code> または <code>false</code> 。</p>\n<h4 id=\"winunhookwindowmessagemessage-windows\"><a href=\"#winunhookwindowmessagemessage-windows\"><code>win.unhookWindowMessage(message)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n</ul>\n<p>ウインドウメッセージのフックを解除します。</p>\n<h4 id=\"winunhookallwindowmessages-windows\"><a href=\"#winunhookallwindowmessages-windows\"><code>win.unhookAllWindowMessages()</code> <em>Windows</em></a></h4>\n<p>すべてのウインドウメッセージのフックを解除します。</p>\n<h4 id=\"winsetrepresentedfilenamefilename-macos\"><a href=\"#winsetrepresentedfilenamefilename-macos\"><code>win.setRepresentedFilename(filename)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>filename</code> String</li>\n</ul>\n<p>ウインドウが表すファイルのパス名を設定します。ファイルのアイコンがウインドウのタイトルバーに表示されます。</p>\n<h4 id=\"wingetrepresentedfilename-macos\"><a href=\"#wingetrepresentedfilename-macos\"><code>win.getRepresentedFilename()</code> <em>macOS</em></a></h4>\n<p>戻り値 <code>String</code> - ウインドウが表すファイルのパス名。</p>\n<h4 id=\"winsetdocumenteditededited-macos\"><a href=\"#winsetdocumenteditededited-macos\"><code>win.setDocumentEdited(edited)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>edited</code> Boolean</li>\n</ul>\n<p>ウインドウのドキュメントが編集されたかどうかを指定します。<code>true</code> に設定すると、タイトルバーのアイコンがグレーになります。</p>\n<h4 id=\"winisdocumentedited-macos\"><a href=\"#winisdocumentedited-macos\"><code>win.isDocumentEdited()</code> <em>macOS</em></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウのドキュメントが編集されたかどうか。</p>\n<h4 id=\"winfocusonwebview\"><a href=\"#winfocusonwebview\"><code>win.focusOnWebView()</code></a></h4>\n<h4 id=\"winblurwebview\"><a href=\"#winblurwebview\"><code>win.blurWebView()</code></a></h4>\n<h4 id=\"wincapturepagerect\"><a href=\"#wincapturepagerect\"><code>win.capturePage([rect])</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (任意) - キャプチャする範囲</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;NativeImage></code> - <a href=\"/docs/api/native-image\">NativeImage</a> を解決します</p>\n<p><code>rect</code> 内のページのスナップショットをキャプチャします。 <code>rect</code> を省略すると、表示されているページ全体をキャプチャします。 ページが表示されない場合、 <code>rect</code> が空である可能性があります。</p>\n<h4 id=\"winloadurlurl-options\"><a href=\"#winloadurlurl-options\"><code>win.loadURL(url[, options])</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (任意) - HTTP リファラの URL。</li>\n<li><code>userAgent</code> String (任意) - リクエスト元のユーザーエージェント。</li>\n<li><code>extraHeaders</code> String (任意) - \"\\n\" で区切られた追加のヘッダー</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a></li>\n<li><code>baseURLForDataURL</code> String (任意) - データ URL によってロードされたファイルの (最後のパス区切り文字を含む) ベース URL。 これは指定された <code>url</code> がデータ URL で、他のファイルをロードする必要がある場合のみ必要です。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - ページ読み込みが完了した時 (<a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a> を参照) に解決され、ページの読み込みに失敗した時 (<a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a> を参照) に拒否される Promise。</p>\n<p><a href=\"/docs/api/web-contents#contentsloadurlurl-options\"><code>webContents.loadURL(url[, options])</code></a> と同じです。</p>\n<p><code>url</code> は、リモートアドレス (例えば、<code>http://</code>) または <code>file://</code> プロトコルを使ってローカルのHTMLファイルのパスにすることができます。</p>\n<p>ファイルのURLが正しく構成されているようにするため、Nodeの <a href=\"https://nodejs.org/api/url.html#url_url_format_urlobject\"><code>url.format</code></a> メソッドを使用することを推奨します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>).format({\n  <span class=\"hljs-attr\">protocol</span>: <span class=\"hljs-string\">'file'</span>,\n  <span class=\"hljs-attr\">slashes</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">pathname</span>: <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>).join(__dirname, <span class=\"hljs-string\">'index.html'</span>)\n})\n\nwin.loadURL(url)\n</code></pre>\n<p>次のようにすることによって、URLエンコードされたデータで <code>POST</code> リクエストを使用してURLをロードすることができます。</p>\n<pre><code class=\"hljs language-javascript\">win.loadURL(<span class=\"hljs-string\">'http://localhost:8000/post'</span>, {\n  <span class=\"hljs-attr\">postData</span>: [{\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'rawData'</span>,\n    <span class=\"hljs-attr\">bytes</span>: Buffer.from(<span class=\"hljs-string\">'hello=world'</span>)\n  }],\n  <span class=\"hljs-attr\">extraHeaders</span>: <span class=\"hljs-string\">'Content-Type: application/x-www-form-urlencoded'</span>\n})\n</code></pre>\n<h4 id=\"winloadfilefilepath-options\"><a href=\"#winloadfilefilepath-options\"><code>win.loadFile(filePath[, options])</code></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>search</code> Record&#x3C;String, String> (任意) - <code>url.format()</code> に渡されます。</li>\n<li><code>search</code> String (任意) - <code>url.format()</code> に渡されます。</li>\n<li><code>hash</code> String (任意) - <code>url.format()</code> に渡されます。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - ページ読み込みが完了した時 (<a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a> を参照) に解決され、ページの読み込みに失敗した時 (<a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a> を参照) に拒否される Promise。</p>\n<p><code>webContents.loadFile</code> と同じく、 <code>filePath</code> はアプリケーションのルートからの HTML ファイルへの相対パスである必要があります。  詳しくは、 <code>webContents</code> ドキュメントを参照してください。</p>\n<h4 id=\"winreload\"><a href=\"#winreload\"><code>win.reload()</code></a></h4>\n<p><code>webContents.reload</code> と同じです。</p>\n<h4 id=\"winsetmenumenu-linux-windows\"><a href=\"#winsetmenumenu-linux-windows\"><code>win.setMenu(menu)</code> <em>Linux</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p><code>menu</code> をウインドウのメニューバーとして設定します。</p>\n<h4 id=\"winremovemenu-linux-windows\"><a href=\"#winremovemenu-linux-windows\"><code>win.removeMenu()</code> <em>Linux</em> <em>Windows</em></a></h4>\n<p>ウインドウのメニューバーを消去します。</p>\n<h4 id=\"winsetprogressbarprogress-options\"><a href=\"#winsetprogressbarprogress-options\"><code>win.setProgressBar(progress[, options])</code></a></h4>\n<ul>\n<li><code>progress</code> Double</li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>mode</code> String <em>Windows</em> - プログレスバーのモード。 <code>none</code> 、 <code>normal</code> 、 <code>indeterminate</code> 、 <code>error</code> 、 <code>paused</code> のいずれかが使用できます。</li>\n</ul></li>\n</ul>\n<p>プログレスバーの進捗を設定します。 有効な範囲は [0, 1.0] です。</p>\n<p>進捗 &#x3C; 0 の場合、プログレスバーは削除されます。進捗 > 1 の場合、不確定モードに変更します。</p>\n<p>Linuxプラットフォームでは、Unityデスクトップ環境のみがサポートされ、<code>package.json</code> の <code>desktopName</code> フィールドに <code>*.desktop</code> ファイル名を指定する必要があります。 既定では、<code>{app.name}.desktop</code> であるとみなされます。</p>\n<p>Windowsでは、モードを渡すことができます。 有効な値は、<code>none</code>、<code>normal</code>、<code>indeterminate</code>、<code>error</code> と <code>paused</code> です。 モードを設定せずに (ただし、有効範囲内の値で) <code>setProgressBar</code> を呼び出した場合、<code>normal</code> とみなされます。</p>\n<h4 id=\"winsetoverlayiconoverlay-description-windows\"><a href=\"#winsetoverlayiconoverlay-description-windows\"><code>win.setOverlayIcon(overlay, description)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>overlay</code> <a href=\"/docs/api/native-image\">NativeImage</a> | null - タスクバーアイコンの右下隅に表示されるアイコン。 この引数が <code>null</code> の場合、オーバーレイは消去されます。</li>\n<li><code>description</code> String - アクセシビリティスクリーンリーダーに提供される説明</li>\n</ul>\n<p>現在のタスクバーアイコンの上に、通常、何らかのアプリケーションステータスを伝えたり、ユーザーに控えめに通知したりするのに使われる16 x 16ピクセルのオーバレイを設定します。</p>\n<h4 id=\"winsethasshadowhasshadow\"><a href=\"#winsethasshadowhasshadow\"><code>win.setHasShadow(hasShadow)</code></a></h4>\n<ul>\n<li><code>hasShadow</code> Boolean</li>\n</ul>\n<p>ウインドウに影を付けるべきかどうかを設定します。</p>\n<h4 id=\"winhasshadow\"><a href=\"#winhasshadow\"><code>win.hasShadow()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウに影を表示させているかどうか。</p>\n<h4 id=\"winsetopacityopacity-windows-macos\"><a href=\"#winsetopacityopacity-windows-macos\"><code>win.setOpacity(opacity)</code> <em>Windows</em> <em>macOS</em></a></h4>\n<ul>\n<li><code>opacity</code> Number - 0.0 (完全に透明) と 1.0 (完全に不透明) の間</li>\n</ul>\n<p>ウィンドウの不透明度を設定します。 Linux では何もしません。 範囲外の値は [0, 1] に収められます。</p>\n<h4 id=\"wingetopacity\"><a href=\"#wingetopacity\"><code>win.getOpacity()</code></a></h4>\n<p>戻り値 <code>Number</code> - 0.0 (完全に透明) と 1.0 (完全に不透明) の間。 Linuxでは常に 1 を返します。</p>\n<h4 id=\"winsetshaperects-windows-linux-実験的\"><a href=\"#winsetshaperects-windows-linux-実験的\"><code>win.setShape(rects)</code> <em>Windows</em> <em>Linux</em> <em>実験的</em></a></h4>\n<ul>\n<li><code>rects</code> <a href=\"/docs/api/structures/rectangle\">Rectangle[]</a> - ウィンドウの形。 空のリストを渡すと、ウィンドウが四角形に戻ります。</li>\n</ul>\n<p>ウィンドウの形を設定すると、システム内で描画とユーザ操作が許可されているウィンドウ内の領域が決まります。 与えられた領域の外側のピクセルでは描画されず、マウスイベントも登録されません。 領域外のマウスイベントはそのウィンドウでは受信されませんが、ウィンドウの後ろにあるものにそのイベントがフォールスルーします。</p>\n<h4 id=\"winsetthumbarbuttonsbuttons-windows\"><a href=\"#winsetthumbarbuttonsbuttons-windows\"><code>win.setThumbarButtons(buttons)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>buttons</code> <a href=\"/docs/api/structures/thumbar-button\">ThumbarButton[]</a></li>\n</ul>\n<p>戻り値 <code>Boolean</code> - ボタンを追加するのに成功したかどうか</p>\n<p>タスクバーボタンレイアウトのウインドウのサムネイルイメージに指定されたボタンのセットと一緒にサムネイルツールバーを追加します。 返却される <code>Boolean</code> オブジェクトは、サムネイルを追加するのに成功したかどうかを示します。</p>\n<p>限られた空間のため、サムネイルツールバーのボタン数は、7以下にしてください。 一度、サムネイルツールバーをセットアップすると、プラットフォームの制約のため、ツールバーを削除することはできません。 しかしながら、ボタンを取り除くためにAPIを空の配列で呼び出すことはできます。</p>\n<p><code>buttons</code> は、<code>Button</code> オブジェクトの配列です。</p>\n<ul>\n<li><code>Button</code> Object<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - サムネイルツールバーで表示されるアイコン。</li>\n<li><code>click</code> Function</li>\n<li><code>tooltip</code> String (任意) - ボタンのツールチップのテキスト。</li>\n<li><code>flags</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> - ボタンの特定の状態や動作を制御します。 省略値は、<code>['enabled']</code> です。</li>\n</ul></li>\n</ul>\n<p><code>flags</code> は、以下の <code>String</code> を含めることができる配列です。</p>\n<ul>\n<li><code>enabled</code> - ボタンはアクティブで、ユーザーが使用できます。</li>\n<li><code>disabled</code> - そのボタンは無効化されます。 存在しますが、ユーザ操作に応答しないことを示す視覚的な状態です。</li>\n<li><code>dismissonclick</code> - そのボタンをクリックすると、サムネイルウインドウがすぐに閉じます。</li>\n<li><code>nobackground</code> - そのボタンの縁を描画しません。画像にのみ使用してください。</li>\n<li><code>hidden</code> - そのボタンはユーザに表示されません。</li>\n<li><code>noninteractive</code> - そのボタンは有効ですが、反応せず、押されたボタンの状態も描画されません。 この値は、例えば通知内で使用するボタンに使用されます。</li>\n</ul>\n<h4 id=\"winsetthumbnailclipregion-windows\"><a href=\"#winsetthumbnailclipregion-windows\"><code>win.setThumbnailClip(region)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>region</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - ウインドウの領域</li>\n</ul>\n<p>タスクバーのウインドウの上でホバリングするときに表示されるサムネイルイメージとして表示するウインドウの領域を設定します。 空の領域: <code>{ x: 0, y: 0, width: 0, height: 0 }</code> を指定することで、サムネイルをウインドウ全体にリセットすることができます。</p>\n<h4 id=\"winsetthumbnailtooltiptooltip-windows\"><a href=\"#winsetthumbnailtooltiptooltip-windows\"><code>win.setThumbnailToolTip(toolTip)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>toolTip</code> String</li>\n</ul>\n<p>タスクバーのウインドウサムネイルでホバリングするときに表示されるツールチップを設定します。</p>\n<h4 id=\"winsetappdetailsoptions-windows\"><a href=\"#winsetappdetailsoptions-windows\"><code>win.setAppDetails(options)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>appId</code> String (任意) - ウインドウの<a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391569(v=vs.85).aspx\">アプリユーザーモデルID</a>。 設定されないと、他のオプションは無効です。</li>\n<li><code>appIconPath</code> String (任意) - ウインドウの<a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391573(v=vs.85).aspx\">再起動アイコン</a>。</li>\n<li><code>appIconIndex</code> Integer (任意) - <code>appIconPath</code> でのアイコンのインデックス。 <code>appIconPath</code> が設定されていない場合は無視されます。 省略値は <code>0</code> です。</li>\n<li><code>relaunchCommand</code> String (任意) - ウインドウの<a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391571(v=vs.85).aspx\">再起動コマンド</a>。</li>\n<li><code>relaunchDisplayName</code> String (任意) - ウインドウの<a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391572(v=vs.85).aspx\">再起動表示名</a>。</li>\n</ul></li>\n</ul>\n<p>ウインドウのタスクバーボタンのプロパティを設定します。</p>\n<p><strong>注:</strong> <code>relaunchCommand</code> と <code>relaunchDisplayName</code> は一緒に設定する必要があります。 いずれかが設定されていない場合、どちらも使用されません。</p>\n<h4 id=\"winshowdefinitionforselection-macos\"><a href=\"#winshowdefinitionforselection-macos\"><code>win.showDefinitionForSelection()</code> <em>macOS</em></a></h4>\n<p><code>webContents.showDefinitionForSelection()</code> と同じです。</p>\n<h4 id=\"winseticonicon-windows-linux\"><a href=\"#winseticonicon-windows-linux\"><code>win.setIcon(icon)</code> <em>Windows</em> <em>Linux</em></a></h4>\n<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String</li>\n</ul>\n<p>ウインドウのアイコンを変更します。</p>\n<h4 id=\"winsetwindowbuttonvisibilityvisible-macos\"><a href=\"#winsetwindowbuttonvisibilityvisible-macos\"><code>win.setWindowButtonVisibility(visible)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n</ul>\n<p>ウインドウの信号ボタンを表示するかどうかを設定します。</p>\n<h4 id=\"winsetautohidemenubarhide\"><a href=\"#winsetautohidemenubarhide\"><code>win.setAutoHideMenuBar(hide)</code></a></h4>\n<ul>\n<li><code>hide</code> Boolean</li>\n</ul>\n<p>ウィンドウのメニューバーを自動的に非表示にするかどうかを設定します。 一度設定されると、メニューバーはユーザが単独で <code>Alt</code> キーを押したときのみに表示されます。</p>\n<p>メニューバーが既に表示されている場合、<code>setAutoHideMenuBar(true)</code> を呼び出してもすぐに非表示にはなりません。</p>\n<h4 id=\"winismenubarautohide\"><a href=\"#winismenubarautohide\"><code>win.isMenuBarAutoHide()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - メニューバーを自動的に非表示にするかどうか。</p>\n<h4 id=\"winsetmenubarvisibilityvisible-windows-linux\"><a href=\"#winsetmenubarvisibilityvisible-windows-linux\"><code>win.setMenuBarVisibility(visible)</code> <em>Windows</em> <em>Linux</em></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n</ul>\n<p>メニューバーを表示するかどうかを設定します。 メニューバーが自動的に非表示にされている場合でも、ユーザが単に <code>Alt</code> キーを押下すれば、依然としてメニューバーを表示させることができます。</p>\n<h4 id=\"winismenubarvisible\"><a href=\"#winismenubarvisible\"><code>win.isMenuBarVisible()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - メニューバーを表示しているかどうか。</p>\n<h4 id=\"winsetvisibleonallworkspacesvisible-options\"><a href=\"#winsetvisibleonallworkspacesvisible-options\"><code>win.setVisibleOnAllWorkspaces(visible[, options])</code></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>visibleOnFullScreen</code> Boolean (任意) <em>macOS</em> - ウインドウをフルスクリーンウィンドウの上で表示するかどうかを設定します。</li>\n<li><code>skipTransformProcessType</code> Boolean (任意) <em>macOS</em> - setVisibleOnAllWorkspaces を呼ぶと、デフォルトでは UIElementApplication と ForegroundApplication の間でプロセスタイプが変換され、正しい動作を保証します。 しかし、これでは呼び出されるたびに短時間だけウインドウが非表示になり、Dock も非表示になってしまいます。 ウインドウが既に UIElementApplication 型である場合、skipTransformProcessType に true を渡すことでこの変換をバイパスできます。</li>\n</ul></li>\n</ul>\n<p>ウインドウをすべてのワークスペースで表示させるかどうかを設定します。</p>\n<p><strong>注:</strong> このAPIはWindowsでは何もしません。</p>\n<h4 id=\"winisvisibleonallworkspaces\"><a href=\"#winisvisibleonallworkspaces\"><code>win.isVisibleOnAllWorkspaces()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ウインドウがすべてのワークスペースで表示されているかどうか。</p>\n<p><strong>注:</strong> このAPIはWindowsの場合、常にfalseを返します。</p>\n<h4 id=\"winsetignoremouseeventsignore-options\"><a href=\"#winsetignoremouseeventsignore-options\"><code>win.setIgnoreMouseEvents(ignore[, options])</code></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>forward</code> Boolean (任意) <em>macOS</em> <em>Windows</em> - true の場合、マウスの移動メッセージが Chromium に転送され、<code>mouseleave</code> のようなマウス関連のイベントが有効になります。 <code>ignore</code> がtrueのときだけ使用されます。 <code>ignore</code> がfalseの場合、この値に関わらず、転送は常に無効です。</li>\n</ul></li>\n</ul>\n<p>ウインドウがすべてのマウスイベントを無視するようにします。</p>\n<p>このウインドウで発生するすべてのマウスイベントは、このウインドウの下にあるウインドウに渡されますが、このウインドウにフォーカスがある場合、依然としてキーボードイベントは受信されます。</p>\n<h4 id=\"winsetcontentprotectionenable-macos-windows\"><a href=\"#winsetcontentprotectionenable-macos-windows\"><code>win.setContentProtection(enable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>他のアプリによってウインドウのコンテンツがキャプチャされるのを防止します。</p>\n<p>macOS では、NSWindow の共有タイプを NSWindowSharingNone に設定します。 Windows では、 SetWindowDisplayAffinity を <code>WDA_EXCLUDEFROMCAPTURE</code> で呼び出します。 Windows 10 バージョン 2004 以降からウインドウのキャプチャが完全に削除されましたが、古い Windows バージョンで <code>WDA_MONITOR</code> が適用された場合は黒いウィンドウをキャプチャするように動作します。</p>\n<h4 id=\"winsetfocusablefocusable-macos-windows\"><a href=\"#winsetfocusablefocusable-macos-windows\"><code>win.setFocusable(focusable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>focusable</code> Boolean</li>\n</ul>\n<p>ウインドウにフォーカスできるかどうかを変更します。</p>\n<p>macOS ではウィンドウからフォーカスは除去されません。</p>\n<h4 id=\"winisfocusable-macos-windows\"><a href=\"#winisfocusable-macos-windows\"><code>win.isFocusable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>ウインドウにフォーカスできるかどうかを返します。</p>\n<h4 id=\"winsetparentwindowparent\"><a href=\"#winsetparentwindowparent\"><code>win.setParentWindow(parent)</code></a></h4>\n<ul>\n<li><code>parent</code> BrowserWindow | null</li>\n</ul>\n<p>現在のウインドウの親ウインドウとして <code>parent</code> を設定します。<code>null</code> を渡すと、現在のウインドウをトップレベルウインドウにします。</p>\n<h4 id=\"wingetparentwindow\"><a href=\"#wingetparentwindow\"><code>win.getParentWindow()</code></a></h4>\n<p>戻り値 <code>BrowserWindow</code> - 親ウインドウ。</p>\n<h4 id=\"wingetchildwindows\"><a href=\"#wingetchildwindows\"><code>win.getChildWindows()</code></a></h4>\n<p>戻り値 <code>BrowserWindow[]</code> - すべての子ウインドウ。</p>\n<h4 id=\"winsetautohidecursorautohide-macos\"><a href=\"#winsetautohidecursorautohide-macos\"><code>win.setAutoHideCursor(autoHide)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>autoHide</code> Boolean</li>\n</ul>\n<p>タイプしているときにカーソルを非表示にするかどうかを制御します。</p>\n<h4 id=\"winselectprevioustab-macos\"><a href=\"#winselectprevioustab-macos\"><code>win.selectPreviousTab()</code> <em>macOS</em></a></h4>\n<p>ネイティブのタブが有効で、ウインドウに他のタブがあるとき、一つ前のタブを選択します。</p>\n<h4 id=\"winselectnexttab-macos\"><a href=\"#winselectnexttab-macos\"><code>win.selectNextTab()</code> <em>macOS</em></a></h4>\n<p>ネイティブのタブが有効で、ウインドウに他のタブがあるとき、次のタブを選択します。</p>\n<h4 id=\"winmergeallwindows-macos\"><a href=\"#winmergeallwindows-macos\"><code>win.mergeAllWindows()</code> <em>macOS</em></a></h4>\n<p>ネイティブのタブが有効で複数の開いているウインドウがあるとき、すべてのウインドウを複数のタブで1つのウインドウにマージします。</p>\n<h4 id=\"winmovetabtonewwindow-macos\"><a href=\"#winmovetabtonewwindow-macos\"><code>win.moveTabToNewWindow()</code> <em>macOS</em></a></h4>\n<p>ネイティブのタブが有効で現在のウインドウに複数のタブがあるとき、現在のタブを新しいウインドウに移動します。</p>\n<h4 id=\"wintoggletabbar-macos\"><a href=\"#wintoggletabbar-macos\"><code>win.toggleTabBar()</code> <em>macOS</em></a></h4>\n<p>ネイティブのタブが有効で現在のウインドウにタブが1つだけしかないとき、タブバーを表示するかどうかを切り替えます。</p>\n<h4 id=\"winaddtabbedwindowbrowserwindow-macos\"><a href=\"#winaddtabbedwindowbrowserwindow-macos\"><code>win.addTabbedWindow(browserWindow)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>browserWindow</code> BrowserWindow</li>\n</ul>\n<p>ウインドウインスタンスのタブの後ろに、このウインドウのタブとしてウインドウを追加します。</p>\n<h4 id=\"winsetvibrancytype-macos\"><a href=\"#winsetvibrancytype-macos\"><code>win.setVibrancy(type)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>type</code> String | null - <code>appearance-based</code>、<code>light</code>、<code>dark</code>、<code>titlebar</code>、<code>selection</code>、<code>menu</code>、<code>popover</code>、<code>sidebar</code>、<code>medium-light</code>、<code>ultra-dark</code>、<code>header</code>、<code>sheet</code>、<code>window</code>、<code>hud</code>、<code>fullscreen-ui</code>、<code>tooltip</code>、<code>content</code>、<code>under-window</code> または <code>under-page</code> にすることができます。 詳細については、<a href=\"https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc\">macOSのドキュメント</a> を参照してください。</li>\n</ul>\n<p>ブラウザウィンドウにバイブレンシーエフェクトを追加します。 <code>null</code> または空の文字列を渡すと、ウィンドウのバイブレンシーエフェクトを削除します。</p>\n<p>注意として、<code>appearance-based</code>、<code>light</code>、<code>dark</code>、<code>medium-light</code> と <code>ultra-dark</code> は非推奨であり、macOS の今後のバージョンで削除されます。</p>\n<h4 id=\"winsettrafficlightpositionposition-macos\"><a href=\"#winsettrafficlightpositionposition-macos\"><code>win.setTrafficLightPosition(position)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>フレームレスウインドウにおける信号機ボタンのカスタム位置を設定します。</p>\n<h4 id=\"wingettrafficlightposition-macos\"><a href=\"#wingettrafficlightposition-macos\"><code>win.getTrafficLightPosition()</code> <em>macOS</em></a></h4>\n<p>戻り値 <code>Point</code> - フレームレスウインドウにおける現在の信号機ボタンの位置。</p>\n<h4 id=\"winsettouchbartouchbar-macos\"><a href=\"#winsettouchbartouchbar-macos\"><code>win.setTouchBar(touchBar)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>touchBar</code> TouchBar | null</li>\n</ul>\n<p>現在のウインドウのTouchBarレイアウトを設定します。 <code>null</code> または <code>undefined</code> を指定すると、TouchBarがクリアされます。 このメソッドはTouchBarがあって、macOS 10.12.1以上を実行しているマシンでのみ、有効です。</p>\n<p><strong>Note:</strong> TouchBar API は現在実験的な機能です。そのため、将来的には変更されたり削除されたりする可能性があります。</p>\n<h4 id=\"winsetbrowserviewbrowserview-experimental\"><a href=\"#winsetbrowserviewbrowserview-experimental\"><code>win.setBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a> | null - <code>browserView</code> を <code>win</code> へアタッチします。 他の <code>BrowserView</code> がアタッチされている場合、それはこのウィンドウから削除されます。</li>\n</ul>\n<h4 id=\"wingetbrowserview-実験的\"><a href=\"#wingetbrowserview-実験的\"><code>win.getBrowserView()</code> <em>実験的</em></a></h4>\n<p>戻り値 <code>BrowserView | null</code> - <code>win</code> にアタッチされた <code>BrowserView</code>。 アタッチされていない場合は <code>null</code> を返します。 複数の <code>BrowserView</code> がアタッチされている場合、エラーを送出します。</p>\n<h4 id=\"winaddbrowserviewbrowserview-実験的\"><a href=\"#winaddbrowserviewbrowserview-実験的\"><code>win.addBrowserView(browserView)</code> <em>実験的</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>複数の BrowserView をサポートする setBrowserView の置換 API。</p>\n<h4 id=\"winremovebrowserviewbrowserview-実験的\"><a href=\"#winremovebrowserviewbrowserview-実験的\"><code>win.removeBrowserView(browserView)</code> <em>実験的</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<h4 id=\"winsettopbrowserviewbrowserview-実験的\"><a href=\"#winsettopbrowserviewbrowserview-実験的\"><code>win.setTopBrowserView(browserView)</code> <em>実験的</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p><code>browserView</code> を <code>win</code> にアタッチされた他の <code>BrowserView</code> の上へと持ち上げます。 <code>browserView</code> が <code>win</code> にアタッチされていない場合, エラーを送出します。</p>\n<h4 id=\"wingetbrowserviews-実験的\"><a href=\"#wingetbrowserviews-実験的\"><code>win.getBrowserViews()</code> <em>実験的</em></a></h4>\n<p>戻り値 <code>BrowserView[]</code> - <code>addBrowserView</code> または <code>setBrowserView</code> でアタッチされたすべての BrowserView の配列。</p>\n<p><strong>注:</strong> 現在のところ、BrowserView APIは実験的な機能であり、将来のElectronのリリースで変更されたり、削除されたりする可能性があります。</p>",
      "title": "BrowserWindow",
      "description": "ブラウザウィンドウを作成したり、制御したりします。"
    },
    "/docs/api/browser-window-proxy": {
      "locale": "ja-JP",
      "slug": "browser-window-proxy",
      "href": "/docs/api/browser-window-proxy",
      "crowdinFileId": "256285",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-window-proxy.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-browserwindowproxy\"><a href=\"#クラス-browserwindowproxy\">クラス: BrowserWindowProxy</a></h2>\n<blockquote>\n<p>子ブラウザウィンドウを操作します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#renderer-process\">レンダラー</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<p><code>BrowserWindowProxy</code> オブジェクトは、<code>window.open</code> から返却され、子ウインドウの限定的な機能を提供します。</p>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<p><code>BrowserWindowProxy</code> オブジェクトには、次のインスタンスメソッドがあります。</p>\n<h4 id=\"winblur\"><a href=\"#winblur\"><code>win.blur()</code></a></h4>\n<p>子ウインドウからフォーカスを外します。</p>\n<h4 id=\"winclose\"><a href=\"#winclose\"><code>win.close()</code></a></h4>\n<p>unloadイベントを呼び出すことなく、子ウインドウを強制的に閉じます。</p>\n<h4 id=\"winevalcode\"><a href=\"#winevalcode\"><code>win.eval(code)</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n</ul>\n<p>子ウインドウでコードを評価します。</p>\n<h4 id=\"winfocus\"><a href=\"#winfocus\"><code>win.focus()</code></a></h4>\n<p>子ウインドウにフォーカスします (ウインドウを前面に移動します)。</p>\n<h4 id=\"winprint\"><a href=\"#winprint\"><code>win.print()</code></a></h4>\n<p>子ウインドウで印刷ダイアログを呼び出します。</p>\n<h4 id=\"winpostmessagemessage-targetorigin\"><a href=\"#winpostmessagemessage-targetorigin\"><code>win.postMessage(message, targetOrigin)</code></a></h4>\n<ul>\n<li><code>message</code> any</li>\n<li><code>targetOrigin</code> String</li>\n</ul>\n<p>特定のオリジンまたはオリジン未設定を意味する <code>*</code> で子ウインドウにメッセージを送信します。</p>\n<p>これらのメソッドに加えて、子ウインドウには、プロパティがなく、1つのメソッドを持つ <code>window.opener</code> オブジェクトが実装されています。</p>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<p><code>BrowserWindowProxy</code> オブジェクトには、次のインスタンスプロパティがあります。</p>\n<h4 id=\"winclosed\"><a href=\"#winclosed\"><code>win.closed</code></a></h4>\n<p>子ウインドウが閉じた後にtrueが設定される <code>Boolean</code> 型のプロパティ。</p>",
      "title": "クラス: BrowserWindowProxy",
      "description": "子ブラウザウィンドウを操作します。"
    },
    "/docs/development/build-instructions-gn": {
      "locale": "ja-JP",
      "slug": "build-instructions-gn",
      "href": "/docs/development/build-instructions-gn",
      "crowdinFileId": "256131",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-gn.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"ビルド手順\"><a href=\"#ビルド手順\">ビルド手順</a></h1>\n<p>カスタム Electron バイナリの作成にあたって <strong>Electron そのもの</strong> をビルドするには、以下のガイドラインに従ってください。 アプリのコードをビルド済み Electron バイナリにバンドルして頒布する場合は、<a href=\"/docs/tutorial/application-distribution\">アプリケーション頒布</a> のガイドを参照してください。</p>\n<h2 id=\"プラットフォーム要件\"><a href=\"#プラットフォーム要件\">プラットフォーム要件</a></h2>\n<p>続行する前に、以下から各プラットフォームのビルド要件を確認してください。</p>\n<ul>\n<li><a href=\"/docs/development/build-instructions-macos#prerequisites\">macOS</a></li>\n<li><a href=\"/docs/development/build-instructions-linux#prerequisites\">Linux</a></li>\n<li><a href=\"/docs/development/build-instructions-windows#prerequisites\">Windows</a></li>\n</ul>\n<h2 id=\"ビルドツール\"><a href=\"#ビルドツール\">ビルドツール</a></h2>\n<p><a href=\"https://github.com/electron/build-tools\">Electron ビルドツール</a> は、さまざまな設定やビルドターゲットを使ってソースから Electron をコンパイルするためのセットアップの多くを自動化します。 手動で環境構築する場合の手順は以下の通りです。</p>\n<h2 id=\"gn-要件\"><a href=\"#gn-要件\">GN 要件</a></h2>\n<p><a href=\"https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up\"><code>depot_tools</code></a> をインストールする必要があります。このツールセットは Chromium とその依存関係のダウンロードに使用されます。</p>\n<p>更に Windows では、<code>DEPOT_TOOLS_WIN_TOOLCHAIN=0</code> と環境変数を設定する必要があります。 これを行うには、<code>コントロール パネル</code> → <code>システムとセキュリティ</code> → <code>システム</code> → <code>システムの詳細設定</code> を開き、<code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> 環境変数を追加して値を <code>0</code> にします。  これはローカルにインストールされているバージョンの Visual Studio を使用するように <code>depot_tools</code> に知らせます (デフォルトで <code>depot_tools</code> は Google 社員のみがアクセスできる Google 内部のバージョンをダウンロードしようとします) 。</p>\n<h3 id=\"git-キャッシュのセットアップ\"><a href=\"#git-キャッシュのセットアップ\">git キャッシュのセットアップ</a></h3>\n<p>Electron を複数回チェックアウトする予定がある場合 (例えば複数の並列ディレクトリを異なるブランチにチェックアウトさせるなど)、git キャッシュを使用することでその後の <code>gclient</code> 呼び出しを高速化できます。 これをするには <code>GIT_CACHE_PATH</code> 環境変数を以下のように設定する必要があります。</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">export</span> GIT_CACHE_PATH=<span class=\"hljs-string\">\"<span class=\"hljs-variable\">${HOME}</span>/.git_cache\"</span>\n$ mkdir -p <span class=\"hljs-string\">\"<span class=\"hljs-variable\">${GIT_CACHE_PATH}</span>\"</span>\n<span class=\"hljs-comment\"># 16G ほどあります。</span>\n</code></pre>\n<h2 id=\"コードを取得\"><a href=\"#コードを取得\">コードを取得</a></h2>\n<pre><code class=\"hljs language-sh\">$ mkdir electron-gn &#x26;&#x26; <span class=\"hljs-built_in\">cd</span> electron-gn\n$ gclient config --name <span class=\"hljs-string\">\"src/electron\"</span> --unmanaged https://github.com/electron/electron\n$ gclient sync --with_branch_heads --with_tags\n<span class=\"hljs-comment\"># これはしばらくかかります。コーヒーでも飲みに行きましょう。</span>\n</code></pre>\n<blockquote>\n<p><code>https://github.com/electron/electron</code> の代わりに、<code>https://github.com/&#x3C;username>/electron</code> のような自分のフォークを使うこともできます。</p>\n</blockquote>\n<h3 id=\"プルプッシュ時の注意\"><a href=\"#プルプッシュ時の注意\">プル/プッシュ時の注意</a></h3>\n<p>もし将来公式の <code>electron</code> レポジトリから <code>git pull</code> や <code>git push</code> をする予定であれば、現在はそれぞれのフォルダの origin URL を更新する必要があります。</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src/electron\n$ git remote remove origin\n$ git remote add origin https://github.com/electron/electron\n$ git checkout main\n$ git branch --<span class=\"hljs-built_in\">set</span>-upstream-to=origin/main\n$ <span class=\"hljs-built_in\">cd</span> -\n</code></pre>\n<p>📝 <code>gclient</code> は、Chromium や Node.js のような依存の解決のために <code>src/electron</code> フォルダ内の <code>DEPS</code> と呼ばれるファイルを確認します。 <code>gclient sync -f</code> を実行することで Electron のビルドに必要な依存関係をすべて取得します。</p>\n<p>なので、プルするには、以下のコマンドを実行するとよいでしょう。</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src/electron\n$ git pull\n$ gclient sync -f\n</code></pre>\n<h2 id=\"ビルド\"><a href=\"#ビルド\">ビルド</a></h2>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src\n$ <span class=\"hljs-built_in\">export</span> CHROMIUM_BUILDTOOLS_PATH=`<span class=\"hljs-built_in\">pwd</span>`/buildtools\n$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p>Windows 上(任意の引数はなし):</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src\n$ <span class=\"hljs-built_in\">set</span> CHROMIUM_BUILDTOOLS_PATH=%<span class=\"hljs-built_in\">cd</span>%\\buildtools\n$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\")\"</span>\n</code></pre>\n<p>これはデバッグビルドの設定とともに <code>src/</code> 下の <code>out/Testing</code> ビルドディレクトリに生成されます。 <code>Testing</code> は他の名前に置換できますが、<code>out</code> のサブディレクトリである必要があります。 更に <code>gn gen</code> を再び実行してはいけません。ビルド引数を変更したい場合、<code> gn args out/Testing</code> を実行してエディタを呼び出します。</p>\n<p>利用可能なビルド設定を一覧するには、<code>gn args out/Testing --list</code> を実行してください。</p>\n<p><strong>Electron の Testing ビルド設定は以下のとおりです。</strong></p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p><strong>Electron の Release (別名 \"non-component\" または \"static\") ビルド設定は以下のとおりです。</strong></p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Release --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/release.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p><strong>ビルドするには、<code>ninja</code> を <code>electron</code> ターゲットで実行します。</strong> 注意: これはさらなる時間を要し、パソコンも熱くなります。</p>\n<p>テスト構成は以下のとおりです。</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Testing electron\n</code></pre>\n<p>リリース構成は以下のとおりです。</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Release electron\n</code></pre>\n<p>これは、先に \"libchromiumcontent\" (<code> chromium</code> の <code>content/</code> ディレクトリと WebKit や V8 を含む依存関係) のすべてをビルドします。そのため時間がかかります。</p>\n<p>実行形式は <code>./out/Testing</code> 下に置かれます。</p>\n<pre><code class=\"hljs language-sh\">$ ./out/Testing/Electron.app/Contents/MacOS/Electron\n<span class=\"hljs-comment\"># Windowsの場合</span>\n$ ./out/Testing/electron.exe\n<span class=\"hljs-comment\"># Linuxの場合</span>\n$ ./out/Testing/electron\n</code></pre>\n<h3 id=\"パッケージ化\"><a href=\"#パッケージ化\">パッケージ化</a></h3>\n<p>Linuxの場合、デバッグ情報やシンボル情報を削除します。</p>\n<pre><code class=\"hljs language-sh\">electron/script/strip-binaries.py -d out/Release\n</code></pre>\n<p>配布可能なzipファイルとしてこのエレクトロンビルドをパッケージするには、次のようにする。</p>\n<pre><code class=\"hljs language-sh\">ninja -C out/Release electron:electron_dist_zip\n</code></pre>\n<h3 id=\"クロスコンパイル\"><a href=\"#クロスコンパイル\">クロスコンパイル</a></h3>\n<p>構築しているプラットフォームと同じでないプラットフォーム用にコンパイルするには、<code>target_cpu</code> 及び <code>target_os</code> GN 引数を設定します。 例えば、x64 ホストから x86 ターゲットをコンパイルするには、<code>gn args</code> で <code>target_cpu = \"x86\"</code> と指定します。</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing-x86 --args=<span class=\"hljs-string\">'... target_cpu = \"x86\"'</span>\n</code></pre>\n<p>ソースコードとターゲット CPU/OS のすべての組み合わせが Chromium でサポートされているわけではありません。</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Host</th><th>ターゲット</th><th>状況</th></tr></thead><tbody><tr><td>Windows x64</td><td>Windows arm64</td><td>実験中</td></tr><tr><td>Windows x64</td><td>Windows x86</td><td>自動テスト済み</td></tr><tr><td>Linux x64</td><td>Linux x86</td><td>自動テスト済み</td></tr></tbody></table>\n<p>他の組み合わせをテストしてうまく動作することがわかれば、このドキュメントを更新してください :)</p>\n<p><a href=\"https://gn.googlesource.com/gn/+/master/docs/reference.md#built_in-predefined-variables-target_os_the-desired-operating-system-for-the-build-possible-values\"><code>target_os</code></a> と <a href=\"https://gn.googlesource.com/gn/+/master/docs/reference.md#built_in-predefined-variables-target_cpu_the-desired-cpu-architecture-for-the-build-possible-values\"><code>target_cpu</code></a> の許可されている値については、 GN リファレンスを参照してください。</p>\n<h4 id=\"arm-上で-windows-実験的\"><a href=\"#arm-上で-windows-実験的\">Arm 上で Windows (実験的)</a></h4>\n<p>Arm 上の Windows 用にクロスコンパイルするには、<a href=\"https://chromium.googlesource.com/chromium/src/+/refs/heads/master/docs/windows_build_instructions.md#Visual-Studio\">Chromium のガイドに従って</a> 必要な依存関係、SDK およびライブラリを取得し、<code>gclient sync</code> を実行する前に環境内で <code>ELECTRON_BUILDING_WOA=1</code> でビルドします。</p>\n<pre><code class=\"hljs language-bat\"><span class=\"hljs-built_in\">set</span> ELECTRON_BUILDING_WOA=<span class=\"hljs-number\">1</span>\ngclient sync -f --with_branch_heads --with_tags\n</code></pre>\n<p>もしくは (PowerShell を用いる場合) こうします。</p>\n<pre><code class=\"hljs language-powershell\"><span class=\"hljs-variable\">$env:ELECTRON_BUILDING_WOA</span>=<span class=\"hljs-number\">1</span>\ngclient sync -f --with_branch_heads --with_tags\n</code></pre>\n<p>それから、上記のように <code>target_cpu=\"arm64\"</code> で <code>gn gen</code> を実行します。</p>\n<h2 id=\"テスト\"><a href=\"#テスト\">テスト</a></h2>\n<p>このテストを実行するために、あなたは最初に、このビルドプロセスの一部としてビルドする Node.js と同じバージョンに対してテストモジュールをビルドする必要があります。 再びコンパイルするモジュールのためのビルドヘッダを生成するために、<code>src/</code>ディレクトリの下で以下のように実行します。</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Testing third_party/electron_node:headers\n</code></pre>\n<p>これで <a href=\"/docs/development/testing#unit-tests\">テストを実行</a> できます。</p>\n<p>もし何かをデバッグ中であれば、以下のフラグを Electron バイナリに渡すと役に立つかもしれません。</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span> -- \\\n  --<span class=\"hljs-built_in\">enable</span>-logging -g <span class=\"hljs-string\">'BrowserWindow module'</span>\n</code></pre>\n<h2 id=\"複数マシン間での-gitのキャッシュの共有\"><a href=\"#複数マシン間での-gitのキャッシュの共有\">複数マシン間での gitのキャッシュの共有</a></h2>\n<p>gclient git キャッシュを Linux 上で SMB 共有としてエクスポートすることで、他のマシンと共有することは可能ですが、一度に一つのプロセス/マシンだけがキャッシュを使用できます。 git-cache スクリプトによって作成されたロックはこれを防止しようとしますが、ネットワーク内で完璧には動作しない可能性があります。</p>\n<p>Windows では、SMBv2 にはディレクトリキャッシュがあり、git キャッシュスクリプトに問題が発生するため、レジストリキー</p>\n<pre><code class=\"hljs language-sh\">HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\Lanmanworkstation\\Parameters\\DirectoryCacheLifetime\n</code></pre>\n<p>を0に設定して無効にする必要があります。 詳細: <a href=\"https://stackoverflow.com/a/9935126\">https://stackoverflow.com/a/9935126</a></p>\n<p>これは PowerShell 内ですぐに設定できます (管理者権限で実行します)。</p>\n<pre><code class=\"hljs language-powershell\"><span class=\"hljs-built_in\">New-ItemProperty</span> -Path <span class=\"hljs-string\">\"HKLM:\\System\\CurrentControlSet\\Services\\Lanmanworkstation\\Parameters\"</span> -Name DirectoryCacheLifetime -Value <span class=\"hljs-number\">0</span> -PropertyType DWORD -Force\n</code></pre>\n<h2 id=\"トラブルシューティング\"><a href=\"#トラブルシューティング\">トラブルシューティング</a></h2>\n<h3 id=\"gclient-sync-が-rebase-に関する問題を報告する\"><a href=\"#gclient-sync-が-rebase-に関する問題を報告する\">gclient sync が rebase に関する問題を報告する</a></h3>\n<p><code>gclient sync</code> が中断されると、git ツリーが不正な状態のままになってしまい、将来 <code>gclient sync</code> を実行したときに不可解なメッセージが表示されます。</p>\n<pre><code class=\"hljs language-plaintext\">2> Conflict while rebasing this branch.\n2> Fix the conflict and run gclient again.\n2> See man git-rebase for details.\n</code></pre>\n<p><code>src/electron</code> に git のコンフリクトやリベースがない場合は、<code>src</code> の <code>git am</code> を abort する必要があります。</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> ../\n$ git am --abort\n$ <span class=\"hljs-built_in\">cd</span> electron\n$ gclient sync -f\n</code></pre>\n<h3 id=\"chromium-internalgooglesourcecom-のユーザー名パスワードを聞かれる\"><a href=\"#chromium-internalgooglesourcecom-のユーザー名パスワードを聞かれる\">chromium-internal.googlesource.com のユーザー名/パスワードを聞かれる</a></h3>\n<p>Windows 上で <code>gclient sync</code> を実行しているときに <code>Username for 'https://chrome-internal.googlesource.com':</code> のプロンプトが表示された場合、おそらく <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> 環境変数が 0 に設定されていないからです。 <code>コントロール パネル</code> → <code>システムとセキュリティ</code> → <code>システム</code> → <code>システムの詳細設定</code> を開き、<code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> 環境変数を追加して値を <code>0</code> にします。  これはローカルにインストールされているバージョンの Visual Studio を使用するように <code>depot_tools</code> に知らせます (デフォルトで <code>depot_tools</code> は Google 社員のみがアクセスできる Google 内部のバージョンをダウンロードしようとします) 。</p>",
      "title": "ビルド手順",
      "description": "https://github.com/electron/electron の代わりに、https://github.com/<username>/electron のような自分のフォークを使うこともできます。"
    },
    "/docs/development/build-instructions-linux": {
      "locale": "ja-JP",
      "slug": "build-instructions-linux",
      "href": "/docs/development/build-instructions-linux",
      "crowdinFileId": "256133",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-linux.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"ビルド手順-linux\"><a href=\"#ビルド手順-linux\">ビルド手順 (Linux)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on Linux, for the purposes of creating custom Electron binaries. アプリのコードをビルド済み Electron バイナリにバンドルして頒布する場合は、<a href=\"/docs/tutorial/application-distribution\">アプリケーション頒布</a> のガイドを参照してください。</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>\n<p>At least 25GB disk space and 8GB RAM.</p>\n</li>\n<li>\n<p>Python 2.7.x. Some distributions like CentOS 6.x still use Python 2.6.x so you may need to check your Python version with <code>python -V</code>.</p>\n<p>Please also ensure that your system and Python version support at least TLS 1.2. For a quick test, run the following script:</p>\n<pre><code class=\"hljs language-sh\">$ npx @electron/check-python-tls\n</code></pre>\n<p>If the script returns that your configuration is using an outdated security protocol, use your system's package manager to update Python to the latest version in the 2.7.x branch. Alternatively, visit <a href=\"https://www.python.org/downloads/\">https://www.python.org/downloads/</a> for detailed instructions.</p>\n</li>\n<li>\n<p>Node.js. There are various ways to install Node. You can download source code from <a href=\"https://nodejs.org\">nodejs.org</a> and compile it. Doing so permits installing Node on your own home directory as a standard user. Or try repositories such as <a href=\"https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories\">NodeSource</a>.</p>\n</li>\n<li>\n<p><a href=\"https://clang.llvm.org/get_started.html\">clang</a> 3.4 or later.</p>\n</li>\n<li>\n<p>Development headers of GTK 3 and libnotify.</p>\n</li>\n</ul>\n<p>On Ubuntu, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install build-essential clang libdbus-1-dev libgtk-3-dev \\\n                       libnotify-dev libgnome-keyring-dev \\\n                       libasound2-dev libcap-dev libcups2-dev libxtst-dev \\\n                       libxss1 libnss3-dev gcc-multilib g++-multilib curl \\\n                       gperf bison python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On RHEL / CentOS, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo yum install clang dbus-devel gtk3-devel libnotify-devel \\\n                   libgnome-keyring-devel xorg-x11-server-utils libcap-devel \\\n                   cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \\\n                   nss-devel python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On Fedora, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo dnf install clang dbus-devel gtk3-devel libnotify-devel \\\n                   libgnome-keyring-devel xorg-x11-server-utils libcap-devel \\\n                   cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \\\n                   nss-devel python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On Arch Linux / Manjaro, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo pacman -Syu base-devel clang libdbus gtk2 libnotify \\\n                   libgnome-keyring alsa-lib libcap libcups libxtst \\\n                   libxss nss gcc-multilib curl gperf bison \\\n                   python2 python-dbusmock jdk8-openjdk\n</code></pre>\n<p>Other distributions may offer similar packages for installation via package managers such as pacman. Or one can compile from source code.</p>\n<h3 id=\"cross-compilation\"><a href=\"#cross-compilation\">Cross compilation</a></h3>\n<p>If you want to build for an <code>arm</code> target you should also install the following dependencies:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install libc6-dev-armhf-cross linux-libc-dev-armhf-cross \\\n                       g++-arm-linux-gnueabihf\n</code></pre>\n<p>Similarly for <code>arm64</code>, install the following:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install libc6-dev-arm64-cross linux-libc-dev-arm64-cross \\\n                       g++-aarch64-linux-gnu\n</code></pre>\n<p>And to cross-compile for <code>arm</code> or <code>ia32</code> targets, you should pass the <code>target_cpu</code> parameter to <code>gn gen</code>:</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">'import(...) target_cpu=\"arm\"'</span>\n</code></pre>\n<h2 id=\"ビルド\"><a href=\"#ビルド\">ビルド</a></h2>\n<p>See <a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a></p>\n<h2 id=\"トラブルシューティング\"><a href=\"#トラブルシューティング\">トラブルシューティング</a></h2>\n<h3 id=\"error-while-loading-shared-libraries-libtinfoso5\"><a href=\"#error-while-loading-shared-libraries-libtinfoso5\">Error While Loading Shared Libraries: libtinfo.so.5</a></h3>\n<p>Prebuilt <code>clang</code> will try to link to <code>libtinfo.so.5</code>. Depending on the host architecture, symlink to appropriate <code>libncurses</code>:</p>\n<pre><code class=\"hljs language-sh\">$ sudo ln -s /usr/lib/libncurses.so.5 /usr/lib/libtinfo.so.5\n</code></pre>\n<h2 id=\"advanced-topics\"><a href=\"#advanced-topics\">Advanced topics</a></h2>\n<p>The default building configuration is targeted for major desktop Linux distributions. To build for a specific distribution or device, the following information may help you.</p>\n<h3 id=\"using-system-clang-instead-of-downloaded-clang-binaries\"><a href=\"#using-system-clang-instead-of-downloaded-clang-binaries\">Using system <code>clang</code> instead of downloaded <code>clang</code> binaries</a></h3>\n<p>By default Electron is built with prebuilt <a href=\"https://clang.llvm.org/get_started.html\"><code>clang</code></a> binaries provided by the Chromium project. If for some reason you want to build with the <code>clang</code> installed in your system, you can specify the <code>clang_base_path</code> argument in the GN args.</p>\n<p>For example if you installed <code>clang</code> under <code>/usr/local/bin/clang</code>:</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">'import(\"//electron/build/args/testing.gn\") clang_base_path = \"/usr/local/bin\"'</span>\n</code></pre>\n<h3 id=\"using-compilers-other-than-clang\"><a href=\"#using-compilers-other-than-clang\">Using compilers other than <code>clang</code></a></h3>\n<p>Building Electron with compilers other than <code>clang</code> is not supported.</p>",
      "title": "ビルド手順 (Linux)",
      "description": ""
    },
    "/docs/development/build-instructions-macos": {
      "locale": "ja-JP",
      "slug": "build-instructions-macos",
      "href": "/docs/development/build-instructions-macos",
      "crowdinFileId": "256135",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-macos.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"ビルド手順-macos\"><a href=\"#ビルド手順-macos\">ビルド手順 (macOS)</a></h1>\n<p>カスタム Electron バイナリの作成にあたって macOS で <strong>Electron そのもの</strong> をビルドするには、以下のガイドラインに従ってください。 アプリのコードをビルド済み Electron バイナリにバンドルして頒布する場合は、<a href=\"/docs/tutorial/application-distribution\">アプリケーション頒布</a> のガイドを参照してください。</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>macOS >= 10.11.6</li>\n<li><a href=\"https://developer.apple.com/technologies/tools/\">Xcode</a> >= 9.0.0</li>\n<li><a href=\"https://nodejs.org\">Node.js</a> (外部)</li>\n<li>TLS 1.2 に対応した Python 2.7</li>\n</ul>\n<h2 id=\"python\"><a href=\"#python\">Python</a></h2>\n<p>Please also ensure that your system and Python version support at least TLS 1.2. これは、macOS と Python 両方のバージョンに依存します。 クイックテストをするには以下を実行します。</p>\n<pre><code class=\"hljs language-sh\">$ npx @electron/check-python-tls\n</code></pre>\n<p>スクリプトが古い構成のセキュリティプロトコルを使用していると応答した場合、macOS を High Sierra に更新するか、新しいバージョンの Python 2.7.x をインストールすることができます。 Python をアップグレードするために、以下では <a href=\"https://brew.sh/\">Homebrew</a> を使用します。</p>\n<pre><code class=\"hljs language-sh\">$ brew install python@2 &#x26;&#x26; brew link python@2 --force\n</code></pre>\n<p>Homebrew で提供される Python を使用している場合、以下の Python モジュールのインストールも必要です。</p>\n<ul>\n<li><a href=\"https://pypi.org/project/pyobjc/#description\">pyobjc</a></li>\n</ul>\n<p>以下のように <code>pip</code> を使ってインストールできます。</p>\n<pre><code class=\"hljs language-sh\">$ pip install pyobjc\n</code></pre>\n<h2 id=\"macos-sdk\"><a href=\"#macos-sdk\">macOS SDK</a></h2>\n<p>Electron を開発していて独自の Electron ビルドを再配布する予定がない場合は、このセクションを飛ばして構いません。</p>\n<p>公式の Electron ビルドは、<a href=\"https://download.developer.apple.com/Developer_Tools/Xcode_12.2/Xcode_12.2.xip\">Xcode 12.2</a> と macOS 11.0 SDK でビルドされています。 より新しい SDK でビルドして同様に動いても、現在のリリースは 11.0 SDK を使用します。</p>\n<h2 id=\"electron-のビルド\"><a href=\"#electron-のビルド\">Electron のビルド</a></h2>\n<p><a href=\"/docs/development/build-instructions-gn\">ビルド指示: GN</a>を参照してください。</p>",
      "title": "ビルド手順 (macOS)",
      "description": ""
    },
    "/docs/development/build-instructions-windows": {
      "locale": "ja-JP",
      "slug": "build-instructions-windows",
      "href": "/docs/development/build-instructions-windows",
      "crowdinFileId": "256137",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-windows.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"ビルド手順-windows\"><a href=\"#ビルド手順-windows\">ビルド手順 (Windows)</a></h1>\n<p>カスタム Electron バイナリの作成にあたって Windows で <strong>Electron そのもの</strong> をビルドするには、以下のガイドラインに従ってください。 アプリのコードをビルド済み Electron バイナリにバンドルして頒布する場合は、<a href=\"/docs/tutorial/application-distribution\">アプリケーション頒布</a> のガイドを参照してください。</p>\n<h2 id=\"必要な環境\"><a href=\"#必要な環境\">必要な環境</a></h2>\n<ul>\n<li>Windows 10 / Server 2012 R2 以上</li>\n<li>Visual Studio 2017 15.7.2 以上 - <a href=\"https://www.visualstudio.com/vs/\">VS 2019 Community Edition 無料ダウンロード</a><ul>\n<li>必要な Visual Studio コンポーネントの情報については、<a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md#visual-studio\">Chromium ビルドドキュメント</a> を参照してください。</li>\n<li>Visual Studio がデフォルト以外のディレクトリにインストールされている場合は、いくつかの環境変数を設定してツールチェインがインストールパスを指すようにする必要があります。<ul>\n<li><code>vs2019_install = DRIVE:\\path\\to\\Microsoft Visual Studio\\2019\\Community</code>、このうち <code>2019</code> と <code>Community</code> をインストールしたバージョンのものに、<code>DRIVE:</code> をVisual Studio があるドライブに置き換えます。 大抵、このドライブは <code>C:</code> です。</li>\n<li><code>WINDOWSSDKDIR = DRIVE:\\path\\to\\Windows Kits\\10</code>、このうち <code>DRIVE:</code> を Windows Kits があるドライブに置き換えます。 大抵、このドライブは <code>C:</code> です。</li>\n</ul></li>\n<li><a href=\"https://pypi.org/project/pywin32/#files\">Python for Windows (pywin32) Extensions</a> もビルドプロセスを実行するために必要です。</li>\n</ul></li>\n<li><a href=\"https://nodejs.org/download/\">Node.js</a></li>\n<li><a href=\"https://git-scm.com\">Git</a></li>\n<li>完全な頒布物を作成する予定があれば、Windows SDK 10.0.15063.468 の Windows 用デバッグツールで、<code>.pdb</code> ファイルからシンボルストアを作成するために <code>symstore.exe</code> を使用します。<ul>\n<li>異なるバージョンのSDKを並行してインストールできます。 SDK をインストールするには、Visual Studio Installer を開いて <code>変更</code> → <code>個別のコンポーネント</code> を選択し、スクロールしてインストールする適切な Windows SDK を選択します。 他に、<a href=\"https://developer.microsoft.com/en-us/windows/downloads/sdk-archive\">Windows SDK とエミュレータのアーカイブ</a> を見て、SDK のスタンドアロン版をそれぞれダウンロードすることでもできます。</li>\n<li>SDK デバッグツールもインストールする必要があります。 Windows 10 SDK が Visual Studio インストーラーを介してインストールされた場合は、次のようにしてインストールできます。 <code>コントロールパネル</code> → <code>プログラム</code> → <code>プログラムと機能</code> → \"Windows Software Development Kit\" を選択 → <code>変更</code> → <code>変更</code> → \"Debugging Tools For Windows\" にチェック → <code>変更</code>。 または、スタンドアロンの SDK インストーラをダウンロードして、それを使ってデバッグツールをインストールすることができます。</li>\n</ul></li>\n</ul>\n<p>現在 Windows インストールを持っていない場合、<a href=\"https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/\">dev.microsoftedge.com</a> に Electron をビルドするために使用できる Windows のバージョンがあります。</p>\n<p>Electron のビルドは完全にコマンドラインスクリプトで行われ、Visual Studio では実行できません。 任意のエディタで Electron を開発できますが、将来 Visual Studio を使用したビルドがサポートされます。</p>\n<p><strong>注釈:</strong> Visual Studio はビルドに使用されていませんが、それが提供するビルドツールチェーンが必要なため、まだ <strong>必要</strong> です。</p>\n<h2 id=\"windows-security-からソースのツリーを除外する\"><a href=\"#windows-security-からソースのツリーを除外する\">Windows Security からソースのツリーを除外する</a></h2>\n<p>Windows Security は Chromium ソースコード内のファイルを良く思わないようで (<a href=\"https://crbug.com/441184\">https://crbug.com/441184</a> を参照)、常にある特定のファイルを削除してしまい、<code>gclient sync</code> の問題を引き起こします。 <a href=\"https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26\">こちらの手順に従う</a> ことで、ソースのツリーを Windows Security の監視から除外できます。</p>\n<h2 id=\"ビルド\"><a href=\"#ビルド\">ビルド</a></h2>\n<p><a href=\"/docs/development/build-instructions-gn\">ビルド手順: GN</a> を参照してください。</p>\n<h2 id=\"32ビットビルド\"><a href=\"#32ビットビルド\">32ビットビルド</a></h2>\n<p>32ビットターゲット用にビルドするには、引数として<code>target_cpu = \"x86\"</code> をGNに渡す必要があります。 32ビットターゲットと共に64ビットターゲットをビルドできます。それには別の引数を使って、<code>out/Release-x86</code>のような別のディレクトリに出力させられます。</p>\n<pre><code class=\"hljs language-powershell\">$ gn gen out/Release-x86 --args=<span class=\"hljs-string\">\"import(\\\"</span>//electron/build/args/release.gn\\<span class=\"hljs-string\">\") target_cpu=\\\"</span>x86\\<span class=\"hljs-string\">\"\"</span>\n</code></pre>\n<p>他のビルド手順は全く同じです。</p>\n<h2 id=\"visual-studio-プロジェクト\"><a href=\"#visual-studio-プロジェクト\">Visual Studio プロジェクト</a></h2>\n<p>Visual Studio プロジェクトを生成するには、<code>--ide=vs2017</code> 引数を<code>gn gen</code>に渡します。</p>\n<pre><code class=\"hljs language-powershell\">$ gn gen out/Testing --ide=vs2017\n</code></pre>\n<h2 id=\"トラブルシューティング\"><a href=\"#トラブルシューティング\">トラブルシューティング</a></h2>\n<h3 id=\"command-xxxx-not-found\"><a href=\"#command-xxxx-not-found\">Command xxxx not found</a></h3>\n<p><code>Command xxxx not found</code> のようなエラーに遭遇した場合、<code>開発者コマンド プロンプト for VS2015</code> コンソールを使用してビルドスクリプトを実行してみましょう。</p>\n<h3 id=\"fatal-internal-compiler-error-c1001\"><a href=\"#fatal-internal-compiler-error-c1001\">Fatal internal compiler error: C1001</a></h3>\n<p>最新の Visual Studio アップデートがインストールされていることを確認してください。</p>\n<h3 id=\"lnk1181-cannot-open-input-file-kernel32lib\"><a href=\"#lnk1181-cannot-open-input-file-kernel32lib\">LNK1181: cannot open input file 'kernel32.lib'</a></h3>\n<p>32ビット Node.js を再インストールしてください。</p>\n<h3 id=\"error-enoent-stat-cusersusernameappdataroamingnpm\"><a href=\"#error-enoent-stat-cusersusernameappdataroamingnpm\">Error: ENOENT, stat 'C:\\Users\\USERNAME\\AppData\\Roaming\\npm'</a></h3>\n<p>以下のようにディレクトリを作成すると <a href=\"https://stackoverflow.com/a/25095327/102704\">問題</a> は解決するはずです。</p>\n<pre><code class=\"hljs language-powershell\">$ mkdir ~\\AppData\\Roaming\\npm\n</code></pre>\n<h3 id=\"node-gyp-is-not-recognized-as-an-internal-or-external-command\"><a href=\"#node-gyp-is-not-recognized-as-an-internal-or-external-command\">node-gyp is not recognized as an internal or external command</a></h3>\n<p>ビルドに Git Bash を使用している場合は、代わりに PowerShell または 開発者コマンド プロンプト for VS2015 を使用する必要があります。</p>\n<h3 id=\"cannot-create-directory-at--filename-too-long\"><a href=\"#cannot-create-directory-at--filename-too-long\">cannot create directory at '...': Filename too long</a></h3>\n<p>node.jsに<a href=\"https://github.com/electron/node/tree/electron/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/read-pkg-up/node_modules/read-pkg/node_modules/load-json-file/node_modules/parse-json/node_modules/error-ex/node_modules/is-arrayish\">長すぎるパス名</a>があるようです。標準では、Windows版のgitは、長いファイル名をきちんと処理できません。 この問題を解決するには以下のようにします：</p>\n<pre><code class=\"hljs language-sh\">$ git config --system core.longpaths <span class=\"hljs-literal\">true</span>\n</code></pre>\n<h3 id=\"error-use-of-undeclared-identifier-defaultdelegatecheckmode\"><a href=\"#error-use-of-undeclared-identifier-defaultdelegatecheckmode\">error: use of undeclared identifier 'DefaultDelegateCheckMode'</a></h3>\n<p>これは、Windows 用のデバッグツールが Windows Driver Kit とともにインストールされている場合においてビルド中に発生する可能性があります。 Windows Driver Kit をアンインストールし、上記の手順で Debugging Tools をインストールします。</p>\n<h3 id=\"importerror-no-module-named-win32file\"><a href=\"#importerror-no-module-named-win32file\">ImportError: No module named win32file</a></h3>\n<p><code>pywin32</code>がインストールされているか確認してください。これは次のコマンドでインストールします。:<code>pip install pywin32</code>.</p>\n<h3 id=\"ビルドスクリプトがキーを押さないと止まる\"><a href=\"#ビルドスクリプトがキーを押さないと止まる\">ビルドスクリプトがキーを押さないと止まる</a></h3>\n<p>このバグは Windows コマンドプロンプトの「機能」によるものです。 <code>簡易編集モード</code> を有効にしたプロンプトウィンドウ内をクリックすると発生し、出力テキストを簡単に選択してコピーできるようにすることを目的としています。 誤ってクリックするたびにビルドプロセスが一時停止するため、この機能はコマンドプロンプトのプロパティで無効にできます。</p>",
      "title": "ビルド手順 (Windows)",
      "description": ""
    },
    "/docs/development/build-system-overview": {
      "locale": "ja-JP",
      "slug": "build-system-overview",
      "href": "/docs/development/build-system-overview",
      "crowdinFileId": "256139",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-system-overview.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"ビルドシステムの概要\"><a href=\"#ビルドシステムの概要\">ビルドシステムの概要</a></h1>\n<p>Electronは、プロジェクト生成に<a href=\"https://gn.googlesource.com/gn\">GN</a>を用い、ビルドには <a href=\"https://ninja-build.org/\">ninja</a>を使用します。 プロジェクト設定は<code>.gn</code> と <code>.gni</code> ファイルを見てください。</p>\n<h2 id=\"gn-ファイル\"><a href=\"#gn-ファイル\">GN ファイル</a></h2>\n<p>以下の<code>gn</code>ファイルにはElectronのビルトのメインルールを含んでいます：</p>\n<ul>\n<li><code>BUILD.gn</code> は、Electron 自身をどのようにビルドするかを定義し、Chromium とリンクするデフォルト設定を含んでいます。</li>\n<li><code>build/args/{debug,release,all}.gn</code> には、Electronをビルドするためのデフォルトのビルド引数が含まれています。</li>\n</ul>\n<h2 id=\"コンポーネントのビルド\"><a href=\"#コンポーネントのビルド\">コンポーネントのビルド</a></h2>\n<p>Chromiumはとても巨大なプロジェクトですので、最終的なリンクの段階でかなりの時間を要し、それが開発を難しくしてしまいます。 これを解決するために、Chromiumはそれぞれのコンポーネントを別々の共有ライブラリとしてビルドを行う、「コンポーネントビルド」を採用しており、これによりファイルサイズとパフォーマンスを犠牲にすることでビルドを高速で行っています。</p>\n<p>ElectronはChromiumビルドオプションを継承します。 <code>Debug</code> ビルドでは、ライブラリはリンク時間を節約するために、Chromium のコンポーネントの共有ライブラリにバイナリがリンクされます。<code>Release</code> ビルドではバイナリは静的ライブラリにリンクされるので、適したファイルサイズとパフォーマンスを得ることができます。</p>\n<h2 id=\"テスト\"><a href=\"#テスト\">テスト</a></h2>\n<p><strong>注意</strong> <em>この章は古い内容であり、この情報は GN でビルドされた Electron には該当しません。</em></p>\n<p>プロジェクトのコーディングスタイルは以下で確認できます。</p>\n<pre><code class=\"hljs language-sh\">$ npm run lint\n</code></pre>\n<p>以下で機能テストをします。</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>Electron のソースコードを変更したため再ビルドとテストを行う場合は以下を実行します。</p>\n<pre><code class=\"hljs language-sh\">$ npm run build &#x26;&#x26; npm <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>Mocha の<a href=\"https://mochajs.org/#exclusive-tests\">排他テスト (exclusive tests)</a> 機能を使用することで、特定のテストやブロックが切り離され、連続したテストを早く実行できます。 以下のような <code>.only</code> を <code>describe</code> か <code>it</code> 関数呼び出しに加えます。</p>\n<pre><code class=\"hljs language-js\">describe.only(<span class=\"hljs-string\">'some feature'</span>, () => {\n  <span class=\"hljs-comment\">// ... このブロックのテストのみ実行されます</span>\n})\n</code></pre>\n<p>他に、Mocha の <code>grep</code> オプションで指定した正規表現に一致したテストのみを実行できます。</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span> -- --grep child_process\n</code></pre>\n<p>ネイティブモジュール (<code>runas</code> など) を含むテストは、デバッグビルドでは実行できません (詳細は <a href=\"https://github.com/electron/electron/issues/2558\">#2558</a> を参照)。リリースビルドでは動作します。</p>\n<p>リリースビルドでテストを行うには、以下のようにします。</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span> -- -R\n</code></pre>",
      "title": "ビルドシステムの概要",
      "description": ""
    },
    "/docs/api/structures/certificate": {
      "locale": "ja-JP",
      "slug": "certificate",
      "href": "/docs/api/structures/certificate",
      "crowdinFileId": "256415",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/certificate.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"certificate-object\"><a href=\"#certificate-object\">Certificate Object</a></h1>\n<ul>\n<li><code>data</code> String - PEM encoded data</li>\n<li><code>issuer</code> <a href=\"/docs/api/structures/certificate-principal\">CertificatePrincipal</a> - Issuer principal</li>\n<li><code>issuerName</code> String - Issuer's Common Name</li>\n<li><code>issuerCert</code> Certificate - Issuer certificate (if not self-signed)</li>\n<li><code>subject</code> <a href=\"/docs/api/structures/certificate-principal\">CertificatePrincipal</a> - Subject principal</li>\n<li><code>subjectName</code> String - Subject's Common Name</li>\n<li><code>serialNumber</code> String - Hex value represented string</li>\n<li><code>validStart</code> Number - Start date of the certificate being valid in seconds</li>\n<li><code>validExpiry</code> Number - End date of the certificate being valid in seconds</li>\n<li><code>fingerprint</code> String - Fingerprint of the certificate</li>\n</ul>",
      "title": "Certificate Object",
      "description": ""
    },
    "/docs/api/structures/certificate-principal": {
      "locale": "ja-JP",
      "slug": "certificate-principal",
      "href": "/docs/api/structures/certificate-principal",
      "crowdinFileId": "256413",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/certificate-principal.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"certificateprincipal-object\"><a href=\"#certificateprincipal-object\">CertificatePrincipal Object</a></h1>\n<ul>\n<li><code>commonName</code> String - Common Name.</li>\n<li><code>organizations</code> String[] - Organization names.</li>\n<li><code>organizationUnits</code> String[] - Organization Unit names.</li>\n<li><code>locality</code> String - Locality.</li>\n<li><code>state</code> String - State or province.</li>\n<li><code>country</code> String - Country or region.</li>\n</ul>",
      "title": "CertificatePrincipal Object",
      "description": ""
    },
    "/docs/development/chromium-development": {
      "locale": "ja-JP",
      "slug": "chromium-development",
      "href": "/docs/development/chromium-development",
      "crowdinFileId": "256141",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/chromium-development.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"chromium開発\"><a href=\"#chromium開発\">Chromium開発</a></h1>\n<blockquote>\n<p>Chromium の学習や Chromium の開発状況を追跡する際に参考になるリソース集です</p>\n</blockquote>\n<ul>\n<li>Twitter: <a href=\"https://twitter.com/ChromiumDev\">@ChromiumDev</a></li>\n<li>Twitter: <a href=\"https://twitter.com/googlechrome\">@googlechrome</a></li>\n<li><a href=\"https://blog.chromium.org\">ブログ</a></li>\n<li><a href=\"https://cs.chromium.org/\">コード検索</a></li>\n<li><a href=\"https://cs.chromium.org/chromium/src/\">ソースコード</a></li>\n<li><a href=\"https://www.chromium.org/developers/calendar\">開発カレンダーとリリース情報</a></li>\n<li><a href=\"https://www.chromium.org/developers/discussion-groups\">ディスカッショングループ</a></li>\n</ul>\n<p><a href=\"/docs/development/v8-development\">V8 Development</a> も参照</p>",
      "title": "Chromium開発",
      "description": "Chromium の学習や Chromium の開発状況を追跡する際に参考になるリソース集です"
    },
    "/docs/development/clang-format": {
      "locale": "ja-JP",
      "slug": "clang-format",
      "href": "/docs/development/clang-format",
      "crowdinFileId": "256143",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/clang-format.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"cのコードにclang-formatを使用する\"><a href=\"#cのコードにclang-formatを使用する\">C++のコードにclang-formatを使用する</a></h1>\n<p><a href=\"https://clang.llvm.org/docs/ClangFormat.html\"><code>clang-format</code></a> は C/C++/Objective-C のコードを自動的にフォーマットするツールです。開発者がコードレビュー中にスタイルの問題を心配する必要はありません。</p>\n<p>プルリクエストを開く前に、変更された C++ コードをフォーマットすることを強くお勧めします。これにより、あなたとレビュアーの時間が節約されます。</p>\n<p><code>npm install -g clang-format</code> を介して <code>clang-format</code> と <code>git-clang-format</code> をインストールできます。</p>\n<p>Electron C++ コードスタイルに従ってファイルを自動的にフォーマットするには、 <code>clang-format -i electron/への/パス/ファイル.cc</code> を実行します。 これは macOS/Linux/Windows で動作します。</p>\n<p>以下は変更したコードをフォーマットするワークフローです。</p>\n<ol>\n<li>Electron レポジトリ内でコードを変更します。</li>\n<li><code>git add your_changed_file.cc</code> を実行します。</li>\n<li><code>git-clang-format</code> を実行すると、<code>clang-format</code> によって生成された修正が <code>変更したファイル名.cc</code> 内に見えるはずです。</li>\n<li><code>git add your_changed_file.cc</code> を実行して、変更をコミットします。</li>\n<li>これでこのブランチはプルリクエストを開く準備ができました。</li>\n</ol>\n<p>もし最新の git コミット (HEAD) 上の変更コードをフォーマットしたい場合は、<code>git-clang-format HEAD~1</code> でできます。 より詳しくは <code>git-clang-format -h</code> を参照してください。</p>\n<h2 id=\"エディタ統合\"><a href=\"#エディタ統合\">エディタ統合</a></h2>\n<p>あなたの好きなエディタに直接 <code>clang-format</code> を統合することもできます。 エディタ統合の設定に関する詳細は、以下のページを参照してください。</p>\n<ul>\n<li><a href=\"https://atom.io/packages/clang-format\">Atom</a></li>\n<li><a href=\"https://clang.llvm.org/docs/ClangFormat.html#vim-integration\">Vim &#x26; Emacs</a></li>\n<li><a href=\"https://marketplace.visualstudio.com/items?itemName=xaver.clang-format\">Visual Studio Code</a></li>\n</ul>",
      "title": "C++のコードにclang-formatを使用する",
      "description": ""
    },
    "/docs/development/clang-tidy": {
      "locale": "ja-JP",
      "slug": "clang-tidy",
      "href": "/docs/development/clang-tidy",
      "crowdinFileId": "256145",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/clang-tidy.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"c-コードに-clang-tidy-を使用する\"><a href=\"#c-コードに-clang-tidy-を使用する\">C++ コードに clang-tidy を使用する</a></h1>\n<p><a href=\"https://clang.llvm.org/extra/clang-tidy/\"><code>clang-tidy</code></a> は C/C++/Objective-C コードのスタイル違反、プログラミングエラー、ベストプラクティスを自動でチェックするツールです。</p>\n<p>Electron の <code>clang-tidy</code> インテグレーションは、<code>npm run lint:clang-tidy</code> で実行できるリンタースクリプトとして提供しています。 <code>clang-tidy</code> でディスク上のファイルをチェックするには、使用するコンパイラーフラグが分かるように Electron をビルドしておく必要があります。 このスクリプトには、コンパイル情報を取得するビルドディレクトリを指定するオプション <code>--output-dir</code> があります。 典型的な使用方法としては <code>npm run lint:clang-tidy --out-dir ../out/Testing</code> のようになります。</p>\n<p>ファイル名を指定しない場合、すべての C/C++/Objective-C ファイルがチェックされます。 チェックするファイルのリストを指定するには、<code>npm run lint:clang-tidy --out-dir ../out/testing shell/browser/api/electron_api_app.cc</code> のようにオプションの後にそのファイル名を渡すとできます。</p>\n<p><code>clang-tidy</code> では <a href=\"https://clang.llvm.org/extra/clang-tidy/checks/list.html\">こちらの長いリスト</a> がチェック可能な項目ですが、Electron のデフォルトではこのうちいくつかのチェックしか有効になっていません。 現時点の Electron には <code>.clang-tidy</code> の設定が無いので、<code>clang-tidy</code> は Chromium 内の <code>src/.clang-tidy</code> にあるものを見つけ、Chromium が有効にしているチェックを使用します。 実行するチェックは <code>--checks=</code> オプションで変更できます。 これはそのまま <code>clang-tidy</code> に渡されるので、この詳細は clang-tidy のドキュメントを参照してください。 ワイルドカードが使用でき、<code>-</code> を頭に付けるとそのチェックを無効にできます。 デフォルトでは、リストしたチェックはすべて <code>.clang-tidy</code> のチェックに追加されます。そのため、特定のチェックを制限したい場合は、最初にすべてのチェックを除外してから <code>--checks=-*,performance*</code> のように必要なものを追加してください。</p>\n<p><code>clang-tidy</code> の実行はかなり遅いです。内部的には各ファイルをコンパイルしてからチェックするので、何らかの要因でコンパイルよりも常に遅くなります。 <code>--jobs|-j</code> オプションで並列実行して高速化できますが、<code>clang-tidy</code> もチェック中に多くのメモリを使用するので、メモリ不足エラーに陥りやすくなります。 このため、デフォルトのジョブ数は 1 です。</p>",
      "title": "C++ コードに clang-tidy を使用する",
      "description": ""
    },
    "/docs/api/client-request": {
      "locale": "ja-JP",
      "slug": "client-request",
      "href": "/docs/api/client-request",
      "crowdinFileId": "256289",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/client-request.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-clientrequest\"><a href=\"#クラス-clientrequest\">クラス: ClientRequest</a></h2>\n<blockquote>\n<p>HTTP/HTTPリクエストを行います。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<p><code>ClientRequest</code> は <a href=\"https://nodejs.org/api/stream.html#stream_writable_streams\">Writable Stream</a> インターフェースを実装しているため、 <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a> です。</p>\n<h3 id=\"new-clientrequestoptions\"><a href=\"#new-clientrequestoptions\"><code>new ClientRequest(options)</code></a></h3>\n<ul>\n<li><code>options</code> (Object | String) - もし <code>options</code> が String なら、リクエスト URL として処理されます。 オブジェクトの場合は、次のプロパティによる HTTP リクエストの完全な指定と予期されます。<ul>\n<li><code>method</code> String (任意) - HTTP リクエストのメソッド。 既定では GET メソッドです。</li>\n<li><code>url</code> String (任意) - リクエスト URL 。 http または https のプロトコルスキームを含む絶対形式である必要があります。</li>\n<li><code>session</code> Session (任意) - リクエストが関連付けられている <a href=\"/docs/api/session\"><code>Session</code></a> のインスタンス。</li>\n<li><code>partition</code> String (任意) - リクエストが関連付けられている <a href=\"/docs/api/session\"><code>partition</code></a> の名前。 省略値は、空の文字列です。 <code>session</code> オプションは <code>partition</code> を上書きします。 そのため、<code>session</code> が明示的に指定されている場合、<code>partition</code> は無視されます。</li>\n<li><code>credentials</code> String (任意) - <code>include</code> か <code>omit</code> にできます。 このリクエストと一緒に <a href=\"https://fetch.spec.whatwg.org/#credentials\">資格情報</a> を送信するかどうか。 <code>include</code> に設定した場合、リクエストに関連付けられたセッションからの資格情報が使用されます。 <code>omit</code> に設定した場合、資格情報はリクエストと一緒に送信されません (そして 401 の場合に <code>'login'</code> イベントが発生しません)。 これは、同名の <a href=\"https://fetch.spec.whatwg.org/#concept-request-credentials-mode\">fetch</a> オプションの動作と同じです。 このオプションを指定しない場合、セッションからの認証データは送信され、(<code>useSessionCookies</code> を設定しない限り) Cookie は送信されません。</li>\n<li><code>useSessionCookies</code> Boolean (任意) - 指定のセッションからこのリクエストで Cookie を送るかどうか。 <code>credentials</code> を指定した場合、このオプションの効果はありません。 省略値は <code>false</code> です。</li>\n<li><code>protocol</code> String (任意) - <code>http:</code> か <code>https:</code> にできます。 これは 'scheme:' という形式のプロトコルスキームです。 既定値は 'http:' です。</li>\n<li><code>host</code> String (任意) - ホスト名とポート番号を連結した 'hostname:port' として指定されたサーバーホスト。</li>\n<li><code>hostname</code> String (任意) - サーバーホスト名。</li>\n<li><code>port</code> Integer (任意) - サーバーのリスニングポート番号。</li>\n<li><code>path</code> String (任意) - リクエストURLのパスの部分。</li>\n<li><code>redirect</code> String (任意) - <code>follow</code>、<code>error</code>、<code>manual</code> のいずれかにできます。 これはこのリクエストのリダイレクトモードです。 モードが <code>error</code> のとき、リダイレクトは中止されます。 モードが <code>manual</code> のときは、<a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> が呼び出されるまで <a href=\"#event-redirect\"><code>redirect</code></a> イベントは同期的に中止されます。  省略値は、<code>follow</code> です。</li>\n<li><code>origin</code> String (任意) - リクエストのオリジン URL。</li>\n</ul></li>\n</ul>\n<p><code>protocol</code>、<code>host</code>、<code>hostname</code>、<code>port</code> や <code>path</code> といった <code>options</code> プロパティは、<a href=\"https://nodejs.org/api/url.html\">URL</a> モジュールで説明されている Node.js モデルに厳密に従うようにしてください。</p>\n<p>例えば、以下のようにすると、'github.com' に対してリクエストをしているのと同じです。</p>\n<pre><code class=\"hljs language-JavaScript\"><span class=\"hljs-keyword\">const</span> request = net.request({\n  <span class=\"hljs-attr\">method</span>: <span class=\"hljs-string\">'GET'</span>,\n  <span class=\"hljs-attr\">protocol</span>: <span class=\"hljs-string\">'https:'</span>,\n  <span class=\"hljs-attr\">hostname</span>: <span class=\"hljs-string\">'github.com'</span>,\n  <span class=\"hljs-attr\">port</span>: <span class=\"hljs-number\">443</span>,\n  <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'/'</span>\n})\n</code></pre>\n<h3 id=\"インスタンスイベント\"><a href=\"#インスタンスイベント\">インスタンスイベント</a></h3>\n<h4 id=\"イベント-response\"><a href=\"#イベント-response\">イベント: 'response'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>response</code> <a href=\"/docs/api/incoming-message\">IncomingMessage</a> - HTTP レスポンスメッセージを表すオブジェクト。</li>\n</ul>\n<h4 id=\"イベント-login\"><a href=\"#イベント-login\">イベント: 'login'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>authInfo</code> Object<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (任意)</li>\n<li><code>password</code> String (任意)</li>\n</ul></li>\n</ul>\n<p>認証プロキシがユーザの資格情報を要求しているときに発生します。</p>\n<p><code>callback</code> ファンクションは、ユーザの資格情報と共にコールバックされます。</p>\n<ul>\n<li><code>username</code> String</li>\n<li><code>password</code> String</li>\n</ul>\n<pre><code class=\"hljs language-JavaScript\">request.on(<span class=\"hljs-string\">'login'</span>, (authInfo, callback) => {\n  callback(<span class=\"hljs-string\">'username'</span>, <span class=\"hljs-string\">'password'</span>)\n})\n</code></pre>\n<p>空の資格情報を指定すると、リクエストがキャンセルされ、レスポンスオブジェクトで認証エラーが返ります。</p>\n<pre><code class=\"hljs language-JavaScript\">request.on(<span class=\"hljs-string\">'response'</span>, (response) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`STATUS: <span class=\"hljs-subst\">${response.statusCode}</span>`</span>);\n  response.on(<span class=\"hljs-string\">'error'</span>, (error) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`ERROR: <span class=\"hljs-subst\">${<span class=\"hljs-built_in\">JSON</span>.stringify(error)}</span>`</span>)\n  })\n})\nrequest.on(<span class=\"hljs-string\">'login'</span>, (authInfo, callback) => {\n  callback()\n})\n</code></pre>\n<h4 id=\"イベント-finish\"><a href=\"#イベント-finish\">イベント: 'finish'</a></h4>\n<p><code>request</code> のデータの最後のチャンクが <code>request</code> オブジェクトに書き込まれた直後に発生します。</p>\n<h4 id=\"イベント-abort\"><a href=\"#イベント-abort\">イベント: 'abort'</a></h4>\n<p><code>request</code> が中止されたときに発生します。 <code>request</code> が既に閉じられている場合、 <code>abort</code> イベントは発生しません。</p>\n<h4 id=\"イベント-error\"><a href=\"#イベント-error\">イベント: 'error'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>error</code> Error - 失敗に関するいくつかの情報を提供するエラーオブジェクト。</li>\n</ul>\n<p><code>net</code> モジュールがネットワークリクエストを行うのに失敗するときに発生します。 通常、<code>request</code> オブジェクトが <code>error</code> イベントを発生させるとき、続いて <code>close</code> イベントが発生し、レスポンスオブジェクトが返ることはありません。</p>\n<h4 id=\"イベント-close\"><a href=\"#イベント-close\">イベント: 'close'</a></h4>\n<p>HTTPのリクエストからレスポンスまでのやり取りの最後のイベントして発生します。 <code>close</code> イベントは、<code>request</code> または <code>response</code> オブジェクトのいずれでもこれ以上のイベントが発生しないことを示します。</p>\n<h4 id=\"イベント-redirect\"><a href=\"#イベント-redirect\">イベント: 'redirect'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>statusCode</code> Integer</li>\n<li><code>method</code> String</li>\n<li><code>redirectUrl</code> String</li>\n<li><code>responseHeaders</code> Record&#x3C;String, String[]></li>\n</ul>\n<p>サーバーがリダイレクトのレスポンス (301 Moved Permanently など) を返すときに生成されます。 <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> を呼び出すと、リダイレクトが続行されます。  このイベントを処理する場合、<a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> を <strong>同期的に</strong> で呼び出す必要があります。でなければ、リクエストはキャンセルされます。</p>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<h4 id=\"requestchunkedencoding\"><a href=\"#requestchunkedencoding\"><code>request.chunkedEncoding</code></a></h4>\n<p>リクエストがHTTPのチャンク形式転送エンコーディングを使用するかどうかを指定する <code>Boolean</code> 型。 省略値は、false です。 プロパティは読み書き可能ですが、HTTPヘッダーがまだ送信されていない最初の書き込み操作の前でしか設定できません。 最初の書き込みの後、<code>chunkedEncoding</code> プロパティを設定しようとすると、エラーがスローされます。</p>\n<p>Electronのプロセスメモリの中で内部的にバッファする代わりにデータが細切れにストリーミングされるため、大きなリクエストボディを送信する必要がある場合、チャンク形式のエンコーディングを使用することを強く推奨します。</p>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<h4 id=\"requestsetheadername-value\"><a href=\"#requestsetheadername-value\"><code>request.setHeader(name, value)</code></a></h4>\n<ul>\n<li><code>name</code> String - 追加する HTTP ヘッダーの名前。</li>\n<li><code>value</code> String - 追加する HTTP ヘッダーの値。</li>\n</ul>\n<p>別の HTTP ヘッダーを追加します。 ヘッダー名は小文字にされることなく、そのまま出力されます。 最初の書き込み前のみ呼び出すことができます。 最初の書き込み後にこのメソッドを呼び出すとエラーがスローされます。 渡された値が <code>String</code> 型でない場合、最終的な値を得るために <code>toString()</code> メソッドが呼び出されます。</p>\n<p>特定のヘッダーはアプリによって設定されないように制限されています。 これらのヘッダは以下にリストアップしています。 制限付きヘッダーの詳細は、<a href=\"https://source.chromium.org/chromium/chromium/src/+/master:services/network/public/cpp/header_util.cc;drc=1562cab3f1eda927938f8f4a5a91991fefde66d3;bpv=1;bpt=1;l=22\">Chromium のヘッダー ユーティリティ</a> を参照してください。</p>\n<ul>\n<li><code>Content-Length</code></li>\n<li><code>Host</code></li>\n<li><code>Trailer</code> または <code>Te</code></li>\n<li><code>Upgrade</code></li>\n<li><code>Cookie2</code></li>\n<li><code>Keep-Alive</code></li>\n<li><code>Transfer-Encoding</code></li>\n</ul>\n<p>さらに、<code>Connection</code> ヘッダを <code>upgrade</code> の値に設定することも禁止されています。</p>\n<h4 id=\"requestgetheadername\"><a href=\"#requestgetheadername\"><code>request.getHeader(name)</code></a></h4>\n<ul>\n<li><code>name</code> String - 追加したヘッダーの名前を指定します。</li>\n</ul>\n<p>戻り値 <code>String</code> - 先に設定した追加したヘッダーの名前の値。</p>\n<h4 id=\"requestremoveheadername\"><a href=\"#requestremoveheadername\"><code>request.removeHeader(name)</code></a></h4>\n<ul>\n<li><code>name</code> String - 追加したヘッダーの名前を指定します。</li>\n</ul>\n<p>以前に設定した追加ヘッダーの名前を削除します。 このメソッドは、最初の書き込み前のみ呼び出すことができます。 最初の書き込み後にこのメソッドを呼び出すとエラーがスローされます。</p>\n<h4 id=\"requestwritechunk-encoding-callback\"><a href=\"#requestwritechunk-encoding-callback\"><code>request.write(chunk[, encoding][, callback])</code></a></h4>\n<ul>\n<li><code>chunk</code> (String | Buffer) - リクエストボディのデータのチャンク。 文字列の場合、指定されたエンコーディングで Buffer に変換されます。</li>\n<li><code>encoding</code> String (任意) - 文字列のチャンクを Buffer オブジェクトへ変換する際に使用されます。 既定値は 'utf-8' です。</li>\n<li><code>callback</code> Function (任意) - 書き込み操作の終了後に呼び出されます。</li>\n</ul>\n<p><code>callback</code> は、Node.jsのAPIとの類似性を維持する目的で導入された本質的にはダミーのファンクションです。 <code>chunk</code> コンテンツがChromiumのネットワークレイヤーに到達した後、すぐに非同期で呼び出されます。 Node.jsの実装とは違って、<code>callback</code> が呼び出される前に <code>chunk</code> コンテンツが書き込まれていることは保証されません。</p>\n<p>リクエストボディにデータのチャンクを追加します。 最初の書き込み操作では、リクエストヘッダーも出力される可能性があります。 最初の書き込み操作の後、カスタムヘッダーを追加したり、削除したりすることはできません。</p>\n<h4 id=\"requestendchunk-encoding-callback\"><a href=\"#requestendchunk-encoding-callback\"><code>request.end([chunk][, encoding][, callback])</code></a></h4>\n<ul>\n<li><code>chunk</code> (String | Buffer) (任意)</li>\n<li><code>encoding</code> String (任意)</li>\n<li><code>callback</code> Function (任意)</li>\n</ul>\n<p>リクエストデータの最終チャンクを送信します。 後続の書き込みまたは終了の操作は許可されません。 終了操作の直後に <code>finish</code> イベントが発生します。</p>\n<h4 id=\"requestabort\"><a href=\"#requestabort\"><code>request.abort()</code></a></h4>\n<p>現在進行中のHTTPトランザクションをキャンセルします。 リクエストで既に <code>close</code> イベントが発生していた場合、中止操作は無効になります。 そうでない場合、進行中のイベントでは、<code>abort</code> と <code>close</code> イベントが発生します。 さらに、処理中のレスポンスオブジェクトがある場合、<code>aborted</code> イベントが発生します。</p>\n<h4 id=\"requestfollowredirect\"><a href=\"#requestfollowredirect\"><code>request.followRedirect()</code></a></h4>\n<p>保留中のリダイレクトを続行します。 <code>'redirect'</code> イベントの間のみ呼び出せます。</p>\n<h4 id=\"requestgetuploadprogress\"><a href=\"#requestgetuploadprogress\"><code>request.getUploadProgress()</code></a></h4>\n<p>戻り値 <code>Object</code>:</p>\n<ul>\n<li><code>active</code> Boolean - リクエストが現在アクティブかどうか。 これが false の場合、他のプロパティは設定されません。</li>\n<li><code>started</code> Boolean - アップロードが開始されたかどうか。 これが false の場合、 <code>current</code> と <code>total</code> は 0 になります。</li>\n<li><code>current</code> Integer - どのくらいアップロードしたかのバイト数。</li>\n<li><code>total</code> Integer - このリクエストでアップロードされるバイト数。</li>\n</ul>\n<p>このメソッドを <code>POST</code> リクエストと組み合わせて使用すると、ファイルのアップロードや他のデータ転送の進行状況を取得できます。</p>",
      "title": "クラス: ClientRequest",
      "description": "HTTP/HTTPリクエストを行います。"
    },
    "/docs/api/clipboard": {
      "locale": "ja-JP",
      "slug": "clipboard",
      "href": "/docs/api/clipboard",
      "crowdinFileId": "256291",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/clipboard.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"clipboard\"><a href=\"#clipboard\">clipboard</a></h1>\n<blockquote>\n<p>システムのクリップボードでコピーやペーストの操作を行います。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a>, <a href=\"/docs/glossary#renderer-process\">レンダラー</a></p>\n<p>Linux には、 <code>selection</code> クリップボードも存在します。 これを操作するには、各メソッドに <code>selection</code> を渡す必要があります。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeText(<span class=\"hljs-string\">'Example String'</span>, <span class=\"hljs-string\">'selection'</span>)\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readText(<span class=\"hljs-string\">'selection'</span>))\n</code></pre>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>clipboard</code> モジュールには以下のメソッドがあります。</p>\n<p><strong>注:</strong> 実験的なAPIにはそのように注記があり、将来的に削除される可能性があります。</p>\n<h3 id=\"clipboardreadtexttype\"><a href=\"#clipboardreadtexttype\"><code>clipboard.readText([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (任意) - <code>selection</code> または <code>clipboard</code> 。既定値は 'clipboard' です。 <code>selection</code> は Linux のみで有効です。</li>\n</ul>\n<p>戻り値 <code>String</code> - プレーンテキストでのクリップボード内のコンテンツ。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeText(<span class=\"hljs-string\">'hello i am a bit of text!'</span>)\n\n<span class=\"hljs-keyword\">const</span> text = clipboard.readText()\n<span class=\"hljs-built_in\">console</span>.log(text)\n<span class=\"hljs-comment\">// hello i am a bit of text!'</span>\n</code></pre>\n<h3 id=\"clipboardwritetexttext-type\"><a href=\"#clipboardwritetexttext-type\"><code>clipboard.writeText(text[, type])</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n<li><code>type</code> String (任意) - <code>selection</code> または <code>clipboard</code> 。既定値は 'clipboard' です。 <code>selection</code> は Linux のみで有効です。</li>\n</ul>\n<p>プレーンテキストとしてクリップボードに <code>text</code> を書き込みます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> text = <span class=\"hljs-string\">'hello i am a bit of text!'</span>\nclipboard.writeText(text)\n</code></pre>\n<h3 id=\"clipboardreadhtmltype\"><a href=\"#clipboardreadhtmltype\"><code>clipboard.readHTML([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (任意) - <code>selection</code> または <code>clipboard</code> 。既定値は 'clipboard' です。 <code>selection</code> は Linux のみで有効です。</li>\n</ul>\n<p>戻り値 <code>String</code> - マークアップでのクリップボード内のコンテンツ。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeHTML(<span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b>'</span>)\n<span class=\"hljs-keyword\">const</span> html = clipboard.readHTML()\n\n<span class=\"hljs-built_in\">console</span>.log(html)\n<span class=\"hljs-comment\">// &#x3C;meta charset='utf-8'>&#x3C;b>Hi&#x3C;/b></span>\n</code></pre>\n<h3 id=\"clipboardwritehtmlmarkup-type\"><a href=\"#clipboardwritehtmlmarkup-type\"><code>clipboard.writeHTML(markup[, type])</code></a></h3>\n<ul>\n<li><code>markup</code> String</li>\n<li><code>type</code> String (任意) - <code>selection</code> または <code>clipboard</code> 。既定値は 'clipboard' です。 <code>selection</code> は Linux のみで有効です。</li>\n</ul>\n<p>クリップボードに <code>markup</code> を書き込みます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeHTML(<span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b'</span>)\n</code></pre>\n<h3 id=\"clipboardreadimagetype\"><a href=\"#clipboardreadimagetype\"><code>clipboard.readImage([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (任意) - <code>selection</code> または <code>clipboard</code> 。既定値は 'clipboard' です。 <code>selection</code> は Linux のみで有効です。</li>\n</ul>\n<p>戻り値 <a href=\"/docs/api/native-image\"><code>NativeImage</code></a> - クリップボード内の画像コンテンツ。</p>\n<h3 id=\"clipboardwriteimageimage-type\"><a href=\"#clipboardwriteimageimage-type\"><code>clipboard.writeImage(image[, type])</code></a></h3>\n<ul>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a></li>\n<li><code>type</code> String (任意) - <code>selection</code> または <code>clipboard</code> 。既定値は 'clipboard' です。 <code>selection</code> は Linux のみで有効です。</li>\n</ul>\n<p>クリップボードに <code>image</code> を書き込みます。</p>\n<h3 id=\"clipboardreadrtftype\"><a href=\"#clipboardreadrtftype\"><code>clipboard.readRTF([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (任意) - <code>selection</code> または <code>clipboard</code> 。既定値は 'clipboard' です。 <code>selection</code> は Linux のみで有効です。</li>\n</ul>\n<p>戻り値 <code>String</code> - RTFでのクリップボード内のコンテンツ。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeRTF(<span class=\"hljs-string\">'{\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}'</span>)\n\n<span class=\"hljs-keyword\">const</span> rtf = clipboard.readRTF()\n<span class=\"hljs-built_in\">console</span>.log(rtf)\n<span class=\"hljs-comment\">// {\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}</span>\n</code></pre>\n<h3 id=\"clipboardwritertftext-type\"><a href=\"#clipboardwritertftext-type\"><code>clipboard.writeRTF(text[, type])</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n<li><code>type</code> String (任意) - <code>selection</code> または <code>clipboard</code> 。既定値は 'clipboard' です。 <code>selection</code> は Linux のみで有効です。</li>\n</ul>\n<p>RTFでクリップボードに <code>text</code> を書き込みます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> rtf = <span class=\"hljs-string\">'{\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}'</span>\nclipboard.writeRTF(rtf)\n</code></pre>\n<h3 id=\"clipboardreadbookmark-macos-windows\"><a href=\"#clipboardreadbookmark-macos-windows\"><code>clipboard.readBookmark()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>戻り値 <code>Object</code>:</p>\n<ul>\n<li><code>title</code> String</li>\n<li><code>url</code> String</li>\n</ul>\n<p>クリップボード内のブックマークを表す <code>title</code> と <code>url</code> のキーを含む Object を返します。 ブックマークが無効なとき、<code>title</code> と <code>url</code> の値は空文字です。</p>\n<h3 id=\"clipboardwritebookmarktitle-url-type-macos-windows\"><a href=\"#clipboardwritebookmarktitle-url-type-macos-windows\"><code>clipboard.writeBookmark(title, url[, type])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>title</code> String</li>\n<li><code>url</code> String</li>\n<li><code>type</code> String (任意) - <code>selection</code> または <code>clipboard</code> 。既定値は 'clipboard' です。 <code>selection</code> は Linux のみで有効です。</li>\n</ul>\n<p>ブックマークとしてクリップボードに <code>title</code> と <code>url</code> を書き込みます。</p>\n<p><strong>注:</strong> Windowsの大抵のアプリは、ブックマークのペーストをサポートしていないため、ブックマークと縮退したテキストの両方をクリップボードに書き込むため、<code>clipboard.write</code> を使うようにしてください。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeBookmark({\n  <span class=\"hljs-attr\">text</span>: <span class=\"hljs-string\">'https://electronjs.org'</span>,\n  <span class=\"hljs-attr\">bookmark</span>: <span class=\"hljs-string\">'Electron Homepage'</span>\n})\n</code></pre>\n<h3 id=\"clipboardreadfindtext-macos\"><a href=\"#clipboardreadfindtext-macos\"><code>clipboard.readFindText()</code> <em>macOS</em></a></h3>\n<p>戻り値 <code>String</code> - 検索ペーストボード上のテキストです。これは、アクティブなアプリケーションの検索パネルの現在の状態に関する情報を保持するペーストボードです。</p>\n<p>このメソッドは、レンダラープロセスから呼び出されたとき同期 IPC を使います。 アプリケーションがアクティブにされるたびに、キャッシュされた値は、検索ペーストボードから再読込されます。</p>\n<h3 id=\"clipboardwritefindtexttext-macos\"><a href=\"#clipboardwritefindtexttext-macos\"><code>clipboard.writeFindText(text)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p><code>text</code> をプレーンテキストとして検索ペーストボード (アクティブなアプリケーションの検索パネルの現在の状態に関する情報を保持するペーストボード) に書き込みます。 このメソッドは、レンダラープロセスから呼び出されたとき同期 IPC を使います。</p>\n<h3 id=\"clipboardcleartype\"><a href=\"#clipboardcleartype\"><code>clipboard.clear([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (任意) - <code>selection</code> または <code>clipboard</code> 。既定値は 'clipboard' です。 <code>selection</code> は Linux のみで有効です。</li>\n</ul>\n<p>クリップボードの内容を消去します。</p>\n<h3 id=\"clipboardavailableformatstype\"><a href=\"#clipboardavailableformatstype\"><code>clipboard.availableFormats([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (任意) - <code>selection</code> または <code>clipboard</code> 。既定値は 'clipboard' です。 <code>selection</code> は Linux のみで有効です。</li>\n</ul>\n<p>戻り値 <code>String[]</code> - クリップボードがサポートしている形式の <code>type</code> の配列。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> formats = clipboard.availableFormats()\n<span class=\"hljs-built_in\">console</span>.log(formats)\n<span class=\"hljs-comment\">// [ 'text/plain', 'text/html' ]</span>\n</code></pre>\n<h3 id=\"clipboardhasformat-type-実験的\"><a href=\"#clipboardhasformat-type-実験的\"><code>clipboard.has(format[, type])</code> <em>実験的</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n<li><code>type</code> String (任意) - <code>selection</code> または <code>clipboard</code> 。既定値は 'clipboard' です。 <code>selection</code> は Linux のみで有効です。</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - クリップボードが指定した <code>format</code> をサポートしているかどうか。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> hasFormat = clipboard.has(<span class=\"hljs-string\">'&#x3C;p>selection&#x3C;/p>'</span>)\n<span class=\"hljs-built_in\">console</span>.log(hasFormat)\n<span class=\"hljs-comment\">// 'true' か 'false'</span>\n</code></pre>\n<h3 id=\"clipboardreadformat-実験的\"><a href=\"#clipboardreadformat-実験的\"><code>clipboard.read(format)</code> <em>実験的</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n</ul>\n<p>戻り値 <code>String</code> - クリップボードから <code>format</code> 形式で読み出します。</p>\n<p><code>format</code> は有効な ASCII 文字を含み、<code>/</code> で区切られている必要があります。 <code>a/c</code>, <code>a/bc</code> は有効ですが、<code>/abc</code>, <code>abc/</code>, <code>a/</code>, <code>/a</code>, <code>a</code> は無効です。</p>\n<h3 id=\"clipboardreadbufferformat-実験的\"><a href=\"#clipboardreadbufferformat-実験的\"><code>clipboard.readBuffer(format)</code> <em>実験的</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n</ul>\n<p>戻り値 <code>Buffer</code> - クリップボードから <code>format</code> 形式で読み出します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> buffer = Buffer.from(<span class=\"hljs-string\">'this is binary'</span>, <span class=\"hljs-string\">'utf8'</span>)\nclipboard.writeBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>, buffer)\n\n<span class=\"hljs-keyword\">const</span> ret = clipboard.readBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>)\n\n<span class=\"hljs-built_in\">console</span>.log(buffer.equals(out))\n<span class=\"hljs-comment\">// true</span>\n</code></pre>\n<h3 id=\"clipboardwritebufferformat-buffer-type-実験的\"><a href=\"#clipboardwritebufferformat-buffer-type-実験的\"><code>clipboard.writeBuffer(format, buffer[, type])</code> <em>実験的</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n<li><code>buffer</code> Buffer</li>\n<li><code>type</code> String (任意) - <code>selection</code> または <code>clipboard</code> 。既定値は 'clipboard' です。 <code>selection</code> は Linux のみで有効です。</li>\n</ul>\n<p><code>format</code> でクリップボードに <code>buffer</code> を書き込みます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> buffer = Buffer.from(<span class=\"hljs-string\">'writeBuffer'</span>, <span class=\"hljs-string\">'utf8'</span>)\nclipboard.writeBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>, buffer)\n</code></pre>\n<h3 id=\"clipboardwritedata-type\"><a href=\"#clipboardwritedata-type\"><code>clipboard.write(data[, type])</code></a></h3>\n<ul>\n<li><code>data</code> Object<ul>\n<li><code>text</code> String (任意)</li>\n<li><code>html</code> String (任意)</li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> (任意)</li>\n<li><code>rtf</code> String (任意)</li>\n<li><code>bookmark</code> String (任意) - URL のタイトルの <code>text</code>。</li>\n</ul></li>\n<li><code>type</code> String (任意) - <code>selection</code> または <code>clipboard</code> 。既定値は 'clipboard' です。 <code>selection</code> は Linux のみで有効です。</li>\n</ul>\n<p>クリップボードに <code>data</code> を書き込みます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.write({\n  <span class=\"hljs-attr\">text</span>: <span class=\"hljs-string\">'test'</span>,\n  <span class=\"hljs-attr\">html</span>: <span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b>'</span>,\n  <span class=\"hljs-attr\">rtf</span>: <span class=\"hljs-string\">'{\\\\rtf1\\\\utf8 text}'</span>,\n  <span class=\"hljs-attr\">bookmark</span>: <span class=\"hljs-string\">'a title'</span>\n})\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readText())\n<span class=\"hljs-comment\">// 'test'</span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readHTML())\n<span class=\"hljs-comment\">// &#x3C;meta charset='utf-8'>&#x3C;b>Hi&#x3C;/b></span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readRTF())\n<span class=\"hljs-comment\">// '{\\\\rtf1\\\\utf8 text}'</span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readBookmark())\n<span class=\"hljs-comment\">// { title: 'a title', url: 'test' }</span>\n</code></pre>",
      "title": "clipboard",
      "description": "システムのクリップボードでコピーやペーストの操作を行います。"
    },
    "/docs/tutorial/code-signing": {
      "locale": "ja-JP",
      "slug": "code-signing",
      "href": "/docs/tutorial/code-signing",
      "crowdinFileId": "256183",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/code-signing.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"コード署名\"><a href=\"#コード署名\">コード署名</a></h1>\n<p>コード署名はセキュリティ技術のひとつで、アプリを作成したのがあなたであることを確実にするために使用します。</p>\n<p>macOS システムでは、その変更が誤りか悪意のあるコードによって導入されたのかにかかわらず、アプリに対する変更を検出できます。</p>\n<p>Windows では、コード署名証明書に信頼レベルが割り当てられています。そうでない場合や、信頼レベルが低いと、ユーザがアプリケーションを使用しようとしたときにセキュリティダイアログが表示されます。  信頼レベルは時間とともに上昇するので、できるだけ早くコード署名し始めることを推奨します。</p>\n<p>未署名のアプリを配布することは可能ですが、非推奨です。 Windows と macOS の両方は、デフォルトで未署名のアプリケーションのダウンロードや実行を阻害します。 macOS Catalina (バージョン 10.15) 以降では、ユーザーが署名されていないアプリケーションを開くには、複数ある手動の手順を実行する必要があります。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/gatekeeper.png\" alt=\"macOS Catalina Gatekeeper の警告: このアプリは、開発元が未確認のため開けません\"></p>\n<p>見かけ上、ユーザーには 2 つの選択肢があります。アプリをゴミ箱に直接移動するか、実行をキャンセルするかです。 ユーザーにそのダイアログを表示させたくはないでしょう。</p>\n<p>パッケージ化して配布する予定の Electron アプリケーションを作成している場合は、コード署名されている必要があります。</p>\n<h1 id=\"macos-ビルドへの署名--公証\"><a href=\"#macos-ビルドへの署名--公証\">macOS ビルドへの署名 &#x26; 公証</a></h1>\n<p>macOS アプリをリリースに向けて適切に準備するには、2 つのステップが必要です。まず、アプリをコード署名する必要があります。 そして、\"公証\" と呼ばれるプロセスのためにアプリを Apple にアップロードする必要があります。自動化されたシステムによって、アプリがユーザーを危険にさらすようなことをしていないかどうか、さらに確認します。</p>\n<p>このプロセスを開始するには、以下に示すアプリへの署名と公証の要件を満たしていることを確認してください。</p>\n<ol>\n<li><a href=\"https://developer.apple.com/programs/\">Apple Developer Program</a> に登録する (年会費が必要)</li>\n<li><a href=\"https://developer.apple.com/xcode\">Xcode</a> をダウンロードしてインストールする - これは macOS を実行しているコンピュータに必要です</li>\n<li><a href=\"https://github.com/electron/electron-osx-sign/wiki/1.-Getting-Started#certificates\">署名証明書</a> を生成、ダウンロードして、インストールする</li>\n</ol>\n<p>Electron のエコシステムでは構成とその自由度を重視しているため、アプリケーションの署名と公証の取得には複数の方法が用意されています。</p>\n<h2 id=\"electron-forge\"><a href=\"#electron-forge\"><code>electron-forge</code></a></h2>\n<p>好きな Electron のビルドツールを使用している場合、アプリケーションの署名と公証を行うにあたって、設定にいくつか追加する必要があります。 <a href=\"https://electronforge.io\">forge</a> は、内部で <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>、<a href=\"https://github.com/electron-userland/electron-osx-sign\"><code>electron-osx-sign</code></a>、<a href=\"https://github.com/electron/electron-notarize\"><code>electron-notarize</code></a> を使っている、Electron 公式のツールの集合体です。</p>\n<p>ここでは、すべての必須フィールドを設定した例を見てみましょう。 すべてが必須というわけでは無いのです。お使いのツールは適切な <code>identity</code> を自動的に見つけられるでしょう。それでも明示的に指定することを推奨します。</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"my-app\"</span>,\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.0.1\"</span>,\n  <span class=\"hljs-attr\">\"config\"</span>: {\n    <span class=\"hljs-attr\">\"forge\"</span>: {\n      <span class=\"hljs-attr\">\"packagerConfig\"</span>: {\n        <span class=\"hljs-attr\">\"osxSign\"</span>: {\n          <span class=\"hljs-attr\">\"identity\"</span>: <span class=\"hljs-string\">\"Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)\"</span>,\n          <span class=\"hljs-attr\">\"hardened-runtime\"</span>: <span class=\"hljs-literal\">true</span>,\n          <span class=\"hljs-attr\">\"entitlements\"</span>: <span class=\"hljs-string\">\"entitlements.plist\"</span>,\n          <span class=\"hljs-attr\">\"entitlements-inherit\"</span>: <span class=\"hljs-string\">\"entitlements.plist\"</span>,\n          <span class=\"hljs-attr\">\"signature-flags\"</span>: <span class=\"hljs-string\">\"library\"</span>\n        },\n        <span class=\"hljs-attr\">\"osxNotarize\"</span>: {\n          <span class=\"hljs-attr\">\"appleId\"</span>: <span class=\"hljs-string\">\"felix@felix.fun\"</span>,\n          <span class=\"hljs-attr\">\"appleIdPassword\"</span>: <span class=\"hljs-string\">\"my-apple-id-password\"</span>,\n        }\n      }\n    }\n  }\n}\n</code></pre>\n<p>Apple のセキュリティメカニズムを保証するため、ここで参照されている <code>plist</code> ファイルには以下のような macOS 固有の資格情報が入っている必要があります。</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.allow-jit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.debugger<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>なお、Electron 12 までは <code>com.apple.security.cs.allow-unsigned-executable-memory</code> の資格情報も必要でした。 しかし、現在はできる限り使用を避けてください。</p>\n<p>この実例をすべて見たいのであれば、Electron Fiddle のソースコード、<a href=\"https://github.com/electron/fiddle/blob/master/forge.config.js\">特に <code>electron-forge</code> の設定ファイル</a> を確認してください。</p>\n<p>Electron の API を使ってアプリ内からマイクやカメラにアクセスする場合は、以下の資格情報も追加する必要があります。</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.device.audio-input<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.device.camera<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>起動時にこれらがアプリの資格情報に存在しない場合に、以下のようにしてみます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> microphone = systemPreferences.askForMediaAccess(<span class=\"hljs-string\">'microphone'</span>)\n</code></pre>\n<p>アプリがクラッシュするでしょう。 詳しい情報や必要な資格情報については、<a href=\"https://developer.apple.com/documentation/security/hardened_runtime\">Hardened Runtime</a> の Resource Access のセクションをご覧ください。</p>\n<h2 id=\"electron-builder\"><a href=\"#electron-builder\"><code>electron-builder</code></a></h2>\n<p>Electron Builder にはアプリケーションに署名するためのカスタムソリューションが付属しています。 <a href=\"https://www.electron.build/code-signing\">そのドキュメントはこちら</a> にあります。</p>\n<h2 id=\"electron-packager\"><a href=\"#electron-packager\"><code>electron-packager</code></a></h2>\n<p>Forge や Builder のような統合されたビルドパイプラインを使用しない場合、<a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a> を使用することが多く、これは <a href=\"https://github.com/electron-userland/electron-osx-sign\"><code>electron-osx-sign</code></a> や <a href=\"https://github.com/electron/electron-notarize\"><code>electron-notarize</code></a> を同梱しています。</p>\n<p>Packager の API を使用している場合、<a href=\"https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html\">アプリケーションに署名と公証の両方を行う設定</a> を渡すことができます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> packager = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-packager'</span>)\n\npackager({\n  <span class=\"hljs-attr\">dir</span>: <span class=\"hljs-string\">'/path/to/my/app'</span>,\n  <span class=\"hljs-attr\">osxSign</span>: {\n    <span class=\"hljs-attr\">identity</span>: <span class=\"hljs-string\">'Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)'</span>,\n    <span class=\"hljs-string\">'hardened-runtime'</span>: <span class=\"hljs-literal\">true</span>,\n    <span class=\"hljs-attr\">entitlements</span>: <span class=\"hljs-string\">'entitlements.plist'</span>,\n    <span class=\"hljs-string\">'entitlements-inherit'</span>: <span class=\"hljs-string\">'entitlements.plist'</span>,\n    <span class=\"hljs-string\">'signature-flags'</span>: <span class=\"hljs-string\">'library'</span>\n  },\n  <span class=\"hljs-attr\">osxNotarize</span>: {\n    <span class=\"hljs-attr\">appleId</span>: <span class=\"hljs-string\">'felix@felix.fun'</span>,\n    <span class=\"hljs-attr\">appleIdPassword</span>: <span class=\"hljs-string\">'my-apple-id-password'</span>\n  }\n})\n</code></pre>\n<p>Apple のセキュリティメカニズムを保証するため、ここで参照されている <code>plist</code> ファイルには以下のような macOS 固有の資格情報が入っている必要があります。</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.allow-jit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.debugger<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>Electron 12 までは、<code>com.apple.security.cs.allow-unsigned-executable-memory</code> の資格情報も必要でした。 しかし、現在はできる限り使用を避けてください。</p>\n<h2 id=\"mac-app-store\"><a href=\"#mac-app-store\">Mac App Store</a></h2>\n<p><a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store Guide</a> を参照してください。</p>\n<h1 id=\"windows-ビルドの署名\"><a href=\"#windows-ビルドの署名\">Windows ビルドの署名</a></h1>\n<p>Windows ビルドに署名する前に、以下のことをしなければなりません。</p>\n<ol>\n<li>Windows Authenticode コード署名証明書を取得します (年会費が必要です)</li>\n<li>Visual Studio をインストールして署名ユーティリティを取得します (無料の <a href=\"https://visualstudio.microsoft.com/vs/community/\">Community Edition</a> で十分です)</li>\n</ol>\n<p>多くの再販業者からコード署名証明書を入手できます。 価格はさまざまですので、選ぶのに迷うでしょう。 人気のある再販業者は次のとおりです。</p>\n<ul>\n<li><a href=\"https://www.digicert.com/code-signing/microsoft-authenticode.htm\">digicert</a></li>\n<li><a href=\"https://sectigo.com/ssl-certificates-tls/code-signing\">Sectigo</a></li>\n<li>とりわけ、あなたのニーズに合ったものを見つけるのであれば探してみてください。Google は友達です 😄</li>\n</ul>\n<p>パッケージアプリケーションに署名するためのツールは以下のようにたくさんあります。</p>\n<ul>\n<li><a href=\"https://github.com/electron/windows-installer\"><code>electron-winstaller</code></a> は Windows 用インストーラを生成し、それに署名します。</li>\n<li><a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a> は Squirrel.Windows または MSI ターゲットを通して生成されたインストーラに署名できます。</li>\n<li><a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> ではその Windows ターゲットのいくつかに署名することができます</li>\n</ul>\n<h2 id=\"windows-store\"><a href=\"#windows-store\">Windows Store</a></h2>\n<p><a href=\"/docs/tutorial/windows-store-guide\">Windows Store Guide</a> を参照してください。</p>",
      "title": "コード署名",
      "description": ""
    },
    "/docs/development/coding-style": {
      "locale": "ja-JP",
      "slug": "coding-style",
      "href": "/docs/development/coding-style",
      "crowdinFileId": "256147",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/coding-style.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"コーディング-スタイル\"><a href=\"#コーディング-スタイル\">コーディング スタイル</a></h1>\n<p>これらは Electron のコーディングスタイルのガイドラインです。</p>\n<p><code>npm run lint</code> を実行すると、<code>cpplint</code> と <code>eslint</code> で検出されたスタイルの問題を表示できます。</p>\n<h2 id=\"一般的なコード\"><a href=\"#一般的なコード\">一般的なコード</a></h2>\n<ul>\n<li>ファイルを改行で終えてください。</li>\n<li>以下の順番で require を配置してください。<ul>\n<li>組み込み Node モジュール (<code>path</code> など)</li>\n<li>組み込み Electron モジュール (<code>ipc</code>、<code>app</code> など)</li>\n<li>ローカルモジュール (相対パスを使用したもの)</li>\n</ul></li>\n<li>以下の順番でクラスのプロパティを配置してください。<ul>\n<li>クラスメソッドとプロパティ (<code>@</code> で始まるメソッド)</li>\n<li>インスタンスメソッドとプロパティ</li>\n</ul></li>\n<li>プラットフォーム依存なコードは避けてください。<ul>\n<li><code>path.join()</code> を使用してファイル名を連結します。</li>\n<li>一時ディレクトリを参照する必要がある場合は、<code>/tmp</code> ではなく <code>os.tmpdir()</code> を使用してください。</li>\n</ul></li>\n<li>関数の終わりから明示的に戻るときにプレーンな <code>return</code> を使用します。<ul>\n<li><code>return null</code>、<code>return undefined</code>、<code>null</code> や <code>undefined</code> ではありません</li>\n</ul></li>\n</ul>\n<h2 id=\"c-と-python\"><a href=\"#c-と-python\">C++ と Python</a></h2>\n<p>C++ と Python の場合、Chromium の <a href=\"https://chromium.googlesource.com/chromium/src/+/refs/heads/main/styleguide/styleguide.md\">コーディングスタイル</a> に従います。 C++ のコードを自動的にフォーマットするのに、<a href=\"/docs/development/clang-format\">clang-format</a> が使用できます。 また、<code>script/cpplint.py</code> というスクリプトがあり、すべてのファイルが適しているかどうかを確認します。</p>\n<p>我たちの使用している現在の Python のバージョンは、Python 2.7 です。</p>\n<p>C++ コードは多くの Chromium の抽象クラスと型を使用しているため、それらを知ることを推奨します。 始めるには、Chromiumの <a href=\"https://www.chromium.org/developers/coding-style/important-abstractions-and-data-structures\">重要な抽象クラスとデータ構造</a> ドキュメントが良いです。 このドキュメントでは、いくつかの特別な型、スコープ付きの型 (スコープ外に出たときに自動的にメモリを解放する) 、ロギングのメカニズムなどについて記述しています。</p>\n<h2 id=\"ドキュメント\"><a href=\"#ドキュメント\">ドキュメント</a></h2>\n<ul>\n<li><a href=\"https://github.com/remarkjs/remark\">remark</a> のマークダウン形式で記述します.</li>\n</ul>\n<p><code>npm run lint-docs</code> を実行して、ドキュメントの変更が正しくフォーマットされていることを確認できます。</p>\n<h2 id=\"javascript\"><a href=\"#javascript\">JavaScript</a></h2>\n<ul>\n<li><a href=\"https://www.npmjs.com/package/standard\">standard</a> の JavaScript 形式で記述します。</li>\n<li>ファイル名は、<code>_</code> の代わりに <code>-</code> で連結する必要があります。<a href=\"https://github.com/github/atom\">github/atom</a> モジュール名は通常は <code>module-name</code> の形式になるので、<code>file_name.js</code> ではなく、<code>file-name.js</code> としてください。 このルールは、<code>.js</code> ファイルにのみ適用されます。</li>\n<li>必要に応じて、より新しい ES6/ES2015 構文を使用します<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const\"><code>const</code></a> は require とその他の定数に.  値がプリミティブの場合、名前はすべて大文字にします (例 <code>const NUMBER_OF_RETRIES = 5</code>)。</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let\"><code>let</code></a> は変数の定義に</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions\">アロー関数</a> で <code>function () { }</code> を代替する</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals\">テンプレート文字列</a> で + を使用した文字列連結を代替する <code>+</code></li>\n</ul></li>\n</ul>\n<h2 id=\"命名\"><a href=\"#命名\">命名</a></h2>\n<p>Electron API では、Node.js と同じ大文字表記が使用されます。</p>\n<ul>\n<li>モジュール自体が <code>BrowserWindow</code> のようなクラスである場合は、<code>PascalCase</code> を使用します。</li>\n<li>モジュールが <code>globalShortcut</code> のような API のセットである場合は、<code>camelCase</code> を使用します。</li>\n<li>API がオブジェクトのプロパティで、<code>win.webContents</code> のような別の章に分けられるほど複雑な場合は、<code>mixedCase</code> を使用します。</li>\n<li>他の非モジュール API の場合は、<code>&#x3C;webview>タグ</code> や <code>プロセスオブジェクト</code> などの自然なタイトルを使用します。</li>\n</ul>\n<p>新しい API を作成する場合は、jQuery の one 関数スタイルの代わりに getter と setter を使用することを推奨します。 例えば、<code>.text([text])</code> より、<code>.getText()</code> と <code>.setText(text)</code> を優先します。 こちらに、これついての <a href=\"https://github.com/electron/electron/issues/46\">ディスカッション</a> があります。</p>",
      "title": "コーディング スタイル",
      "description": ""
    },
    "/docs/api/command-line": {
      "locale": "ja-JP",
      "slug": "command-line",
      "href": "/docs/api/command-line",
      "crowdinFileId": "256295",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/command-line.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-commandline\"><a href=\"#クラス-commandline\">クラス: CommandLine</a></h2>\n<blockquote>\n<p>Chromium が読み取るアプリのコマンドライン引数を操作します</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<p>以下の例は、<code>-disable-gpu</code> フラグが設定されているかどうかを確認する方法を示しています。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.hasSwitch(<span class=\"hljs-string\">'disable-gpu'</span>)\n</code></pre>\n<p>使用できるフラグとスイッチの種類の詳細については、<a href=\"/docs/api/command-line-switches\">コマンドラインスイッチ</a> ドキュメントを参照してください。</p>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<h4 id=\"commandlineappendswitchswitch-value\"><a href=\"#commandlineappendswitchswitch-value\"><code>commandLine.appendSwitch(switch[, value])</code></a></h4>\n<ul>\n<li><code>switch</code> String - 主要なものを除くコマンドラインスイッチ <code>--</code></li>\n<li><code>value</code> String (任意) - 与えられたスイッチの値</li>\n</ul>\n<p>Chromiumのコマンドラインに (オプションの <code>value</code> と一緒に) スイッチを追加します。</p>\n<p><strong>注:</strong> これは<code>process.argv</code> に影響を与えません。 この関数は主に Chromium の振る舞いを制御するために使われます。</p>\n<h4 id=\"commandlineappendargumentvalue\"><a href=\"#commandlineappendargumentvalue\"><code>commandLine.appendArgument(value)</code></a></h4>\n<ul>\n<li><code>value</code> String - コマンドラインに追加された引数</li>\n</ul>\n<p>Chromiumのコマンドラインに引数を追加します。 引数は正しく引用符で囲ってください。 スイッチは、追加順序に関係なく引数に先行します。</p>\n<p><code>--switch=value</code> のような引数を追加している場合は、代わりに <code>appendSwitch('switch', 'value')</code> を使用することを検討してください。</p>\n<p><strong>注:</strong> これは<code>process.argv</code> に影響を与えません。 この関数は主に Chromium の振る舞いを制御するために使われます。</p>\n<h4 id=\"commandlinehasswitchswitch\"><a href=\"#commandlinehasswitchswitch\"><code>commandLine.hasSwitch(switch)</code></a></h4>\n<ul>\n<li><code>switch</code> String - コマンドラインスイッチ</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - コマンドラインスイッチがあるかどうか。</p>\n<h4 id=\"commandlinegetswitchvalueswitch\"><a href=\"#commandlinegetswitchvalueswitch\"><code>commandLine.getSwitchValue(switch)</code></a></h4>\n<ul>\n<li><code>switch</code> String - コマンドラインスイッチ</li>\n</ul>\n<p>戻り値 <code>String</code> - コマンドラインスイッチの値</p>\n<p><strong>注意:</strong> スイッチが存在しないか値がない場合、これは空文字列を返します。</p>",
      "title": "クラス: CommandLine",
      "description": "Chromium が読み取るアプリのコマンドライン引数を操作します"
    },
    "/docs/api/command-line-switches": {
      "locale": "ja-JP",
      "slug": "command-line-switches",
      "href": "/docs/api/command-line-switches",
      "crowdinFileId": "256293",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/command-line-switches.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"サポートしているコマンドラインスイッチ\"><a href=\"#サポートしているコマンドラインスイッチ\">サポートしているコマンドラインスイッチ</a></h1>\n<blockquote>\n<p>Electronによってサポートされているコマンドラインスイッチ。</p>\n</blockquote>\n<p><a href=\"/docs/api/app\">app</a> モジュールで <a href=\"/docs/api/app#event-ready\">ready</a> イベントが発生する前に、アプリのメインスクリプトで <a href=\"/docs/api/command-line#commandlineappendswitchswitch-value\">app.commandLine.appendSwitch</a> を使って、コマンドラインスイッチを追加することができます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'remote-debugging-port'</span>, <span class=\"hljs-string\">'8315'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'host-rules'</span>, <span class=\"hljs-string\">'MAP * 127.0.0.1'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// コードをここに</span>\n})\n</code></pre>\n<h2 id=\"electron-cli-フラグ\"><a href=\"#electron-cli-フラグ\">Electron CLI フラグ</a></h2>\n<h3 id=\"--auth-server-whitelisturl\"><a href=\"#--auth-server-whitelisturl\">--auth-server-whitelist=<code>url</code></a></h3>\n<p>統合認証が有効であるサーバーのコンマ区切りのリスト。</p>\n<p>以下がその例です。</p>\n<pre><code class=\"hljs language-sh\">--auth-server-whitelist=<span class=\"hljs-string\">'*example.com, *foobar.com, *baz'</span>\n</code></pre>\n<p>末尾が <code>example.com</code>、<code>foobar.com</code>、<code>baz</code> である <code>url</code> は、統合認証の対象になります。 <code>*</code> のプリフィックスがない場合は、URL は厳密に一致する必要があります。</p>\n<h3 id=\"--auth-negotiate-delegate-whitelisturl\"><a href=\"#--auth-negotiate-delegate-whitelisturl\">--auth-negotiate-delegate-whitelist=<code>url</code></a></h3>\n<p>ユーザー資格情報の委任が必要なサーバのコンマ区切りリスト。 <code>*</code> のプリフィックスがない場合は、URL は厳密に一致する必要があります。</p>\n<h3 id=\"--disable-ntlm-v2\"><a href=\"#--disable-ntlm-v2\">--disable-ntlm-v2</a></h3>\n<p>POSIX プラットフォーム向けに NTLM v2 を無効化します。他プラットフォームでの効果はありません。</p>\n<h3 id=\"--disable-http-cache\"><a href=\"#--disable-http-cache\">--disable-http-cache</a></h3>\n<p>HTTPリクエストに対するディスクキャッシュを無効にします。</p>\n<h3 id=\"--disable-http2\"><a href=\"#--disable-http2\">--disable-http2</a></h3>\n<p>HTTP/2 および SPDY/3.1 プロトコルを無効にします。</p>\n<h3 id=\"--disable-renderer-backgrounding\"><a href=\"#--disable-renderer-backgrounding\">--disable-renderer-backgrounding</a></h3>\n<p>Chromiumが隠れたページのレンダラープロセスの優先順位を下げるのを防止します。</p>\n<p>このフラグはすべてのレンダラープロセスに影響を及ぼすので、1つのウインドウの制限を無効にしたいだけの場合、<a href=\"https://github.com/atom/atom/pull/9485/files\">無音のオーディオを再生する</a>というテクニックを使うことができます。</p>\n<h3 id=\"--disk-cache-sizesize\"><a href=\"#--disk-cache-sizesize\">--disk-cache-size=<code>size</code></a></h3>\n<p>ディスクキャッシュによって使用されるバイト単位での最大のディスク容量を強制的に設定します。</p>\n<h3 id=\"--enable-api-filtering-logging\"><a href=\"#--enable-api-filtering-logging\">--enable-api-filtering-logging</a></h3>\n<p>以下の API の呼び出し元スタックログを有効にします (イベントのフィルタリング)。</p>\n<ul>\n<li><code>desktopCapturer.getSources()</code> / <code>desktop-capturer-get-sources</code></li>\n</ul>\n<h3 id=\"--enable-loggingfile\"><a href=\"#--enable-loggingfile\">--enable-logging[=file]</a></h3>\n<p>標準エラー出力 (またはログファイル) に Chromium のログを出力します。</p>\n<p><code>ELECTRON_ENABLE_LOGGING</code> 環境変数への設定は <code>--enable-logging</code> を渡すのと同じ効果です。</p>\n<p><code>--enable-logging</code> を渡すと、標準エラー出力にログを出力すます。 <code>--enable-logging=file</code> を渡すと、ログは <code>--log-file=...</code> で指定したファイルに、<code>--log-file</code> が未指定の場合はユーザデータディレクトリの <code>electron_debug.log</code> に保存されます。</p>\n<blockquote>\n<p><strong>注意:</strong> Windows では、子プロセスからのログを標準エラー出力に送信できません。 Windows でのログ収集は、ファイルへのログ出力が最も信頼できる方法です。</p>\n</blockquote>\n<p><code>--log-file</code>, <code>--log-level</code>, <code>--v</code>, <code>--vmodule</code> もご参照ください。</p>\n<h3 id=\"--force-fieldtrialstrials\"><a href=\"#--force-fieldtrialstrials\">--force-fieldtrials=<code>trials</code></a></h3>\n<p>フィールド トライアルを強制的に有効または無効にします。</p>\n<p>例: <code>WebRTC-Audio-Red-For-Opus/Enabled/</code></p>\n<h3 id=\"--host-rulesrules\"><a href=\"#--host-rulesrules\">--host-rules=<code>rules</code></a></h3>\n<p>ホスト名をどのようにマッピングするかを制御する <code>rules</code> のコンマ区切りのリスト。</p>\n<p>以下がその例です。</p>\n<ul>\n<li><code>MAP * 127.0.0.1</code> は、すべてのホスト名を強制的に127.0.0.1にマッピングします。</li>\n<li><code>MAP *.google.com proxy</code> は、すべてのgoogle.comのサブドメインを強制的に \"proxy\" で解決されるようにします。</li>\n<li><code>MAP test.com [::1]:77</code> は \"test.com\" を強制的に IPv6 ループバックへ解決されるようにします。 また、ソケットアドレスのポートを 77 に強制します。</li>\n<li><code>MAP * baz, EXCLUDE www.google.com</code> は、\"www.google.com\" 以外のすべてを \"baz\" に再マッピングします。</li>\n</ul>\n<p>これらのマッピングは、ネットワークリクエストのエンドポイントのホスト (直接接続でのTCP接続とホストリゾルバー、HTTPプロキシ接続での <code>CONNECT</code>、<code>SOCKS</code> プロキシ接続でのエンドポイントホスト) に対して適用されます。</p>\n<h3 id=\"--host-resolver-rulesrules\"><a href=\"#--host-resolver-rulesrules\">--host-resolver-rules=<code>rules</code></a></h3>\n<p><code>--host-rules</code> と似ていますが、これらの <code>rules</code> は、ホストリゾルバーにしか適用されません。</p>\n<h3 id=\"--ignore-certificate-errors\"><a href=\"#--ignore-certificate-errors\">--ignore-certificate-errors</a></h3>\n<p>証明書関連のエラーを無視します。</p>\n<h3 id=\"--ignore-connections-limitdomains\"><a href=\"#--ignore-connections-limitdomains\">--ignore-connections-limit=<code>domains</code></a></h3>\n<p><code>,</code> で区切られた <code>domains</code> リストに対する接続数の制限を無視します。</p>\n<h3 id=\"--js-flagsflags\"><a href=\"#--js-flagsflags\">--js-flags=<code>flags</code></a></h3>\n<p>Node.js エンジンへ渡されるフラグを指定します。 <code>flags</code> をメインプロセスで有効化したい場合は、 Electron の開始時に与えられる必要があります。</p>\n<pre><code class=\"hljs language-sh\">$ electron --js-flags=<span class=\"hljs-string\">\"--harmony_proxies --harmony_collections\"</span> your-app\n</code></pre>\n<p>利用できるフラグの一覧については、<a href=\"https://nodejs.org/api/cli.html\">Node.js のドキュメント</a>を参照するか、ターミナルで <code>node --help</code> を実行してください。 さらに、Node.js の V8 JavaScript エンジンに関するフラグの一覧を具体的に見るには、<code>node --v8-options</code> を実行してください。</p>\n<h3 id=\"--lang\"><a href=\"#--lang\">--lang</a></h3>\n<p>カスタムロケールを設定します。</p>\n<h3 id=\"--log-filepath\"><a href=\"#--log-filepath\">--log-file=<code>path</code></a></h3>\n<p><code>--enable-logging</code> が指定された場合、ログを指定のパスに書き込みます。 その親ディレクトリは存在していなければなりません。</p>\n<p>環境変数 <code>ELECTRON_LOG_FILE</code> への設定は、このフラグを渡すことと等価です。 両方とも存在する場合はコマンドラインスイッチを優先します。</p>\n<h3 id=\"--log-net-logpath\"><a href=\"#--log-net-logpath\">--log-net-log=<code>path</code></a></h3>\n<p>保存されるネットワークログイベントを有効にし、<code>path</code> にそれらを書き込みます。</p>\n<h3 id=\"--log-leveln\"><a href=\"#--log-leveln\">--log-level=<code>N</code></a></h3>\n<p><code>--enable-logging</code> と一緒に使用することで、ログの詳細度を設定します。 <code>N</code> は <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h?q=logging::LogSeverity&#x26;ss=chromium\">ChromeのLogSeverities</a> のいずれかでなければなりません。</p>\n<p>注意として、Chromium の 2 つの相補的なログメカニズムである <code>LOG()</code> と <code>VLOG()</code> は、それぞれ別のスイッチで制御しています。 <code>--log-level</code> は <code>LOG()</code> のメッセージを制御しますが、<code>--v</code> と <code>--vmodule</code> は <code>VLOG()</code> のメッセージを制御します。 そのため、必要な詳細度やウォッチしようとしているコードで行われているロギング呼び出しに応じて、これら 3 つのスイッチを組み合わせて使用するとよいでしょう。</p>\n<p><code>LOG()</code> と <code>VLOG()</code> の相互作用の詳細については、<a href=\"https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h\">Chromium ロギングのソース</a> をご参照ください。 大まかに言えば、<code>VLOG()</code> は大量の <code>LOG(INFO)</code> データを制御する <code>LOG(INFO)</code> 内部のサブレベル / モジュールごとのレベルと考えられます。</p>\n<p><code>--enable-logging</code>, <code>--log-level</code>, <code>--v</code>, <code>--vmodule</code> もご参照ください。</p>\n<h3 id=\"--no-proxy-server\"><a href=\"#--no-proxy-server\">--no-proxy-server</a></h3>\n<p>プロキシサーバを使わず、常に直接接続を行います。 他に与えられたプロキシサーバのフラグをすべて上書きします。</p>\n<h3 id=\"--no-sandbox\"><a href=\"#--no-sandbox\">--no-sandbox</a></h3>\n<p>Chromium の <a href=\"https://www.chromium.org/developers/design-documents/sandbox\">サンドボックス</a> を無効化します。 レンダラープロセスと Chromium ヘルパープロセスにサンドボックスなしの実行を強制します。 テスト時のみ使用すべきです。</p>\n<h3 id=\"--proxy-bypass-listhosts\"><a href=\"#--proxy-bypass-listhosts\">--proxy-bypass-list=<code>hosts</code></a></h3>\n<p>セミコロン区切りで与えられたホストに対してプロキシサーバを回避するように Electron へ指示します。 このフラグは <code>—proxy-server</code> と共に使用される場合のみ有効です。</p>\n<p>以下がその例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'proxy-bypass-list'</span>, <span class=\"hljs-string\">'&#x3C;local>;*.google.com;*foo.com;1.2.3.4:5678'</span>)\n</code></pre>\n<p>ローカルアドレス (<code>localhost</code>、<code>127.0.0.1</code> など)、<code>google.com</code> のサブドメイン、<code>foo.com</code> で終わるホストと <code>1.2.3.4:5678</code> を除く、すべてのホストに対してプロキシサーバーが使用されます。</p>\n<h3 id=\"--proxy-pac-urlurl\"><a href=\"#--proxy-pac-urlurl\">--proxy-pac-url=<code>url</code></a></h3>\n<p>指定した <code>url</code> のPACスクリプトを使用します。</p>\n<h3 id=\"--proxy-serveraddressport\"><a href=\"#--proxy-serveraddressport\">--proxy-server=<code>address:port</code></a></h3>\n<p>システム設定よりも優先して、指定したプロキシサーバーを使用します。 このスイッチは、HTTPSとWebSocketリクエストを含むHTTPプロトコルでのリクエストにしか影響しません。 また、すべてのプロキシサーバーがHTTPSとWebSocketリクエストに対応している訳ではないことにも注意してください。 プロキシ URL は <a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=615947\">各 Chromium issue</a> でのユーザー名とパスワードによる認証をサポートしていません。</p>\n<h3 id=\"--remote-debugging-portport\"><a href=\"#--remote-debugging-portport\">--remote-debugging-port=<code>port</code></a></h3>\n<p>指定された <code>port</code> でHTTP越しのリモートデバッグを有効にします。</p>\n<h3 id=\"--vlog_level\"><a href=\"#--vlog_level\">--v=<code>log_level</code></a></h3>\n<p>既定で有効な最高の V ロギングレベルを設定します。既定値は 0 です。 通常、正の値は V ロギングレベルに使用されます。</p>\n<p>このスイッチは、<code>--enable-logging</code> が一緒に渡されたときのみ機能します。</p>\n<p><code>--enable-logging</code>, <code>--log-level</code>, <code>--vmodule</code> もご参照ください。</p>\n<h3 id=\"--vmodulepattern\"><a href=\"#--vmodulepattern\">--vmodule=<code>pattern</code></a></h3>\n<p><code>--v</code> で指定された値を上書きするモジュール単位の最大のVログレベルを指定します。 以下は例です。 <code>my_module=2,foo*=3</code> は、<code>my_module.*</code> と <code>foo*.*</code> のソースファイルにあるすべてのコードのログレベルを変更します。</p>\n<p>スラッシュまたはバックスラッシュを含むパターンは、モジュールだけでなく全体のパス名に対してテストされます。 以下は例です。 <code>*/foo/bar/*=2</code> は、<code>foo/bar</code> ディレクトリの下にあるソースファイルのすべてのコードのログレベルを変更します。</p>\n<p>このスイッチは、<code>--enable-logging</code> が一緒に渡されたときのみ機能します。</p>\n<p><code>--enable-logging</code>, <code>--log-level</code>, <code>--v</code> もご参照ください。</p>\n<h3 id=\"--force_high_performance_gpu\"><a href=\"#--force_high_performance_gpu\">--force_high_performance_gpu</a></h3>\n<p>複数のGPUが利用可能な場合、離散GPUを強制的に使用します。</p>\n<h3 id=\"--force_low_power_gpu\"><a href=\"#--force_low_power_gpu\">--force_low_power_gpu</a></h3>\n<p>複数のGPUが利用可能な場合、統合GPUを強制的に使用します。</p>\n<h2 id=\"nodejs-フラグ\"><a href=\"#nodejs-フラグ\">Node.js フラグ</a></h2>\n<p>Electron は Node.js でサポートされている <a href=\"https://nodejs.org/api/cli.html\">CLI フラグ</a> の一部をサポートしています。</p>\n<p><strong>注:</strong> <code>ELECTRON_RUN_AS_NODE</code> で実行していないときに未サポートのコマンドラインスイッチを Electron に渡しても、効果はありません。</p>\n<h3 id=\"--inspect-brkhostport\"><a href=\"#--inspect-brkhostport\">--inspect-brk[=[host:]port]</a></h3>\n<p>host:port でインスペクタを起動し、ユーザスクリプトの開始時にブレークします。 host:port の省略値は 127.0.0.1:9229 です。</p>\n<p><code>--debug-brk=[host:]port</code> のエイリアスです。</p>\n<h3 id=\"--inspect-porthostport\"><a href=\"#--inspect-porthostport\">--inspect-port=[host:]port</a></h3>\n<p>インスペクタが起動したときに使用する <code>host:port</code> を設定します。 SIGUSR1 シグナルを送信してインスペクタを起動するときに便利です。 host の省略値は <code>127.0.0.1</code> です。</p>\n<p><code>--debug-port=[host:]port</code> のエイリアスです。</p>\n<h3 id=\"--inspecthostport\"><a href=\"#--inspecthostport\">--inspect[=[host:]port]</a></h3>\n<p><code>host:port</code> でインスペクタを有効にします。 省略値は <code>127.0.0.1:9229</code> です。</p>\n<p>V8 インスペクタの統合により、Chrome デベロッパー ツールや IDE などのツールで Electron インスタンスのデバッグやプロファイルが可能になりました。 ツールは TCP ポートを介して Electron インスタンスにアタッチし、<a href=\"https://chromedevtools.github.io/devtools-protocol/\">Chrome デベロッパー ツールプロトコル</a> を使用して通信します。</p>\n<p>詳細は <a href=\"/docs/tutorial/debugging-main-process\">メインプロセスのデバッグ</a> ガイドを参照してください。</p>\n<p><code>--debug[=[host:]port]</code> のエイリアスです。</p>\n<h3 id=\"--inspect-publish-uidstderrhttp\"><a href=\"#--inspect-publish-uidstderrhttp\">--inspect-publish-uid=stderr,http</a></h3>\n<p>インスペクタの WebSocket URL の公開方法を指定します。</p>\n<p>デフォルトでは、インスペクタの WebSocket URL は標準エラーで、<a href=\"http://host:port/json/list\">http://host:port/json/list</a> の /json/list エンドポイント下にあります。</p>",
      "title": "サポートしているコマンドラインスイッチ",
      "description": "Electronによってサポートされているコマンドラインスイッチ。"
    },
    "/docs/api/content-tracing": {
      "locale": "ja-JP",
      "slug": "content-tracing",
      "href": "/docs/api/content-tracing",
      "crowdinFileId": "256297",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/content-tracing.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"contenttracing\"><a href=\"#contenttracing\">contentTracing</a></h1>\n<blockquote>\n<p>Chromium からトレースデータを収集して、パフォーマンスのボトルネックや遅い操作を見つけます。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>このモジュールにはウェブインターフェイスが付属していません。 記録したトレースを見るには、<a href=\"https://chromium.googlesource.com/catapult/+/HEAD/tracing/README.md\">トレースビュアー</a> を使用します。Chrome では <code>chrome://tracing</code> で利用できます。</p>\n<p><strong>注:</strong> アプリモジュールの <code>ready</code> イベントが発生するまではこのモジュールを使用してはいけません。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, contentTracing } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  (<span class=\"hljs-keyword\">async</span> () => {\n    <span class=\"hljs-keyword\">await</span> contentTracing.startRecording({\n      <span class=\"hljs-attr\">included_categories</span>: [<span class=\"hljs-string\">'*'</span>]\n    })\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Tracing started'</span>)\n    <span class=\"hljs-keyword\">await</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> setTimeout(resolve, <span class=\"hljs-number\">5000</span>))\n    <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> contentTracing.stopRecording()\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Tracing data recorded to '</span> + path)\n  })()\n})\n</code></pre>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>contentTracing</code> モジュールには以下のメソッドがあります。</p>\n<h3 id=\"contenttracinggetcategories\"><a href=\"#contenttracinggetcategories\"><code>contentTracing.getCategories()</code></a></h3>\n<p>戻り値 <code>Promise&#x3C;String[]></code> - すべての子プロセスが <code>getCategories</code> リクエストを受諾したとき、そのカテゴリグループの配列で解決されます。</p>\n<p>カテゴリグループの集合を取得します。 新しいコードパスに到達したら、カテゴリグループは変更できます。 詳しくは <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">組み込みトレースカテゴリのリスト</a> を参照してください。</p>\n<blockquote>\n<p><strong>注意:</strong> Electron は <code>\"electron\"</code> という非デフォルトのトレースカテゴリを追加します。 このカテゴリは、Electron 固有のトレースイベントのキャプチャに使用できます。</p>\n</blockquote>\n<h3 id=\"contenttracingstartrecordingoptions\"><a href=\"#contenttracingstartrecordingoptions\"><code>contentTracing.startRecording(options)</code></a></h3>\n<ul>\n<li><code>options</code> (<a href=\"/docs/api/structures/trace-config\">TraceConfig</a> | <a href=\"/docs/api/structures/trace-categories-and-options\">TraceCategoriesAndOptions</a>)</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - すべての子プロセスが <code>startRecording</code> リクエストを受諾したときに解決されます。</p>\n<p>すべてのプロセスで記録を開始します。</p>\n<p>EnableRecordingリクエストを受信するとすぐにローカルでは即時、子プロセスでは非同期的に記録が開始されます。</p>\n<p>記録を実行中の場合、promise はすぐに解決されます。一度に一つまでしかトレース操作は処理されません。</p>\n<h3 id=\"contenttracingstoprecordingresultfilepath\"><a href=\"#contenttracingstoprecordingresultfilepath\"><code>contentTracing.stopRecording([resultFilePath])</code></a></h3>\n<ul>\n<li><code>resultFilePath</code> String (任意)</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;String></code> - すべての子プロセスが <code>stopRecording</code> リクエストを確認すると、トレースデータを格納したファイルへのパスで解決します</p>\n<p>すべてのプロセスで記録を停止します。</p>\n<p>子プロセスは、大抵、トレースデータをキャッシュし、滅多に書き出さず、メインプロセスにトレースデータを送り返すだけです。 トレースデータをIPC越しに送信するのは高負荷な操作であるため、これはトレースのランタイムオーバーヘッドを最小化するのに役立ちます。 そのため、トレースを終了するために、Chromium はすべての子プロセスに保留中のトレースデータをフラッシュするよう非同期に要求します。</p>\n<p>トレースデータは <code>resultFilePath</code> へと書き込まれます。 <code>resultFilePath</code> が空であるか提供されていない場合、トレースデータは一時ファイルに書き込まれ、そのパスは promise で返されます。</p>\n<h3 id=\"contenttracinggettracebufferusage\"><a href=\"#contenttracinggettracebufferusage\"><code>contentTracing.getTraceBufferUsage()</code></a></h3>\n<p>戻り値 <code>Promise&#x3C;Object></code> - トレースバッファの最大使用率の <code>value</code> と <code>percentage</code> を含むオブジェクトで実行されます。</p>\n<ul>\n<li><code>value</code> Number</li>\n<li><code>percentage</code> Number</li>\n</ul>\n<p>完全な形式のパーセンテージとして、トレースバッファのプロセス間の最大使用率を取得します。</p>",
      "title": "contentTracing",
      "description": "Chromium からトレースデータを収集して、パフォーマンスのボトルネックや遅い操作を見つけます。"
    },
    "/docs/api/context-bridge": {
      "locale": "ja-JP",
      "slug": "context-bridge",
      "href": "/docs/api/context-bridge",
      "crowdinFileId": "256299",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/context-bridge.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"contextbridge\"><a href=\"#contextbridge\">contextBridge</a></h1>\n<blockquote>\n<p>分離されたコンテキスト間に、安全、双方向で同期されたブリッジを作成します</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>分離されたプリロードスクリプトから API をレンダラーに公開する例を以下に示します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// プリロード (隔離ワールド)</span>\n<span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(\n  <span class=\"hljs-string\">'electron'</span>,\n  {\n    <span class=\"hljs-attr\">doThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.send(<span class=\"hljs-string\">'do-a-thing'</span>)\n  }\n)\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// レンダラー (メインワールド)</span>\n\n<span class=\"hljs-built_in\">window</span>.electron.doThing()\n</code></pre>\n<h2 id=\"用語集\"><a href=\"#用語集\">用語集</a></h2>\n<h3 id=\"メインワールド\"><a href=\"#メインワールド\">メインワールド</a></h3>\n<p>\"メインワールド\" は、メインレンダラーコードが実行される JavaScript コンテキストです。 デフォルトでは、レンダラーでロードしたページはこのワールドでコードを実行します。</p>\n<h3 id=\"隔離ワールド\"><a href=\"#隔離ワールド\">隔離ワールド</a></h3>\n<p><code>webPreferences</code> で <code>contextIsolation</code> が有効 (これは Electron 12.0.0 からの既定の動作) になっている場合、<code>preload</code> スクリプトは \"隔離ワールド\" で実行されます。  コンテキスト分離とその影響の詳細については、<a href=\"/docs/tutorial/security#3-enable-context-isolation-for-remote-content\">BrowserWindow</a> のドキュメントを参照してください。</p>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>contextBridge</code> モジュールには以下のメソッドがあります。</p>\n<h3 id=\"contextbridgeexposeinmainworldapikey-api\"><a href=\"#contextbridgeexposeinmainworldapikey-api\"><code>contextBridge.exposeInMainWorld(apiKey, api)</code></a></h3>\n<ul>\n<li><code>apiKey</code> String - <code>window</code> に API を注入するキー。  その API には <code>window[apiKey]</code> でアクセスできます。</li>\n<li><code>api</code> Record - あなたの API です。この詳細と動作については下記を参照してください。</li>\n</ul>\n<h2 id=\"使い方\"><a href=\"#使い方\">使い方</a></h2>\n<h3 id=\"api\"><a href=\"#api\">API</a></h3>\n<p><a href=\"#contextbridgeexposeinmainworldapikey-api\"><code>exposeInMainWorld</code></a> に指定する <code>api</code> は、<code>Function</code>、<code>String</code>、<code>Number</code>、<code>Array</code>、<code>Boolean</code>、または文字列のキーで <code>Function</code>、<code>String</code>、<code>Number</code>、<code>Array</code>、<code>Boolean</code>、同じ条件を満たすオブジェクトのいずれかの値の、入れ子でなければなりません。</p>\n<p><code>Function</code> 値は他のコンテキストへプロキシされ、他のすべての値は <strong>コピー</strong> か <strong>凍結</strong> されます。 API で送信されるデータ/プリミティブはイミュータブルであり、ブリッジの一方で更新しても他方のものは更新されません。</p>\n<p>複雑な API の例を以下に示します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(\n  <span class=\"hljs-string\">'electron'</span>,\n  {\n    <span class=\"hljs-attr\">doThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.send(<span class=\"hljs-string\">'do-a-thing'</span>),\n    <span class=\"hljs-attr\">myPromises</span>: [<span class=\"hljs-built_in\">Promise</span>.resolve(), <span class=\"hljs-built_in\">Promise</span>.reject(<span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'whoops'</span>))],\n    <span class=\"hljs-attr\">anAsyncFunction</span>: <span class=\"hljs-keyword\">async</span> () => <span class=\"hljs-number\">123</span>,\n    <span class=\"hljs-attr\">data</span>: {\n      <span class=\"hljs-attr\">myFlags</span>: [<span class=\"hljs-string\">'a'</span>, <span class=\"hljs-string\">'b'</span>, <span class=\"hljs-string\">'c'</span>],\n      <span class=\"hljs-attr\">bootTime</span>: <span class=\"hljs-number\">1234</span>\n    },\n    <span class=\"hljs-attr\">nestedAPI</span>: {\n      <span class=\"hljs-attr\">evenDeeper</span>: {\n        <span class=\"hljs-attr\">youCanDoThisAsMuchAsYouWant</span>: {\n          <span class=\"hljs-attr\">fn</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ({\n            <span class=\"hljs-attr\">returnData</span>: <span class=\"hljs-number\">123</span>\n          })\n        }\n      }\n    }\n  }\n)\n</code></pre>\n<h3 id=\"api-関数\"><a href=\"#api-関数\">API 関数</a></h3>\n<p><code>contextBridge</code> を介してバインドした <code>Function</code> 値は、コンテキストが分離されたままになるように Electron を介してプロキシされます。  これにより、以下に概説するいくつかの重要な制限が生じます。</p>\n<h4 id=\"引数--エラー--戻り値型のサポート\"><a href=\"#引数--エラー--戻り値型のサポート\">引数 / エラー / 戻り値型のサポート</a></h4>\n<p>引数、エラー、戻り値は、ブリッジを介して送信されるときに <strong>コピー</strong> されるため、使用できるのは特定の型のみです。 高水準なものは、使用したい型をシリアライズおよびデシリアライズして、同じように動作するオブジェクトにできます。  以下の型サポートの表に全てが載っています。</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>種類</th><th>複雑さ</th><th>引数サポート</th><th>戻り値サポート</th><th>制限事項</th></tr></thead><tbody><tr><td><code>String</code></td><td>単純</td><td>✅</td><td>✅</td><td>なし</td></tr><tr><td><code>Number</code></td><td>単純</td><td>✅</td><td>✅</td><td>なし</td></tr><tr><td><code>Boolean</code></td><td>単純</td><td>✅</td><td>✅</td><td>なし</td></tr><tr><td><code>Object</code></td><td>複雑</td><td>✅</td><td>✅</td><td>キーにはこの表の \"単純\" な型のみの使用をサポートしています。  値にはこの表のものをサポートしています。  プロトタイプの変更は削除されます。  カスタムクラスを送信すると、値はコピーされますが、プロトタイプはコピーされません。</td></tr><tr><td><code>Array</code></td><td>複雑</td><td>✅</td><td>✅</td><td>制限は <code>Object</code> 型と同じです</td></tr><tr><td><code>エラー</code></td><td>複雑</td><td>✅</td><td>✅</td><td>スローされるエラーもコピーされます。これにより、異なるコンテキストでスローされるためにエラーのメッセージとスタックトレースがわずかに変化する可能性があります。</td></tr><tr><td><code>Promise</code></td><td>複雑</td><td>✅</td><td>✅</td><td>Promise は、戻り値や実引数である場合にのみプロキシされます。  配列やオブジェクトにネストされた Promise は削除されます。</td></tr><tr><td><code>Function</code></td><td>複雑</td><td>✅</td><td>✅</td><td>プロトタイプの変更は削除されます。  クラスまたはコンストラクターを送信しても動作しません。</td></tr><tr><td><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">複製可能型</a></td><td>単純</td><td>✅</td><td>✅</td><td>複製可能型に関してはリンクのドキュメントを参照してください</td></tr><tr><td><code>Element</code></td><td>複雑</td><td>✅</td><td>✅</td><td>プロトタイプの変更は削除されます。  カスタム要素の送信は動作しません。</td></tr><tr><td><code>Blob</code></td><td>複雑</td><td>✅</td><td>✅</td><td>なし</td></tr><tr><td><code>Symbol</code></td><td>なし</td><td>❌</td><td>❌</td><td>Symbol はコンテキスト間でコピーできないため、削除されます</td></tr></tbody></table>\n<p>関心のある型が上記の表にない場合、それはおそらくサポートされていません。</p>\n<h3 id=\"node-のグローバルシンボルの公開\"><a href=\"#node-のグローバルシンボルの公開\">Node のグローバルシンボルの公開</a></h3>\n<p><code>contextBridge</code> はプリロードスクリプトで使用でき、レンダラーが Node API へアクセスできるようにします。 上記のサポート型の表は、 <code>contextBridge</code> を介して公開する Node API にも適用されます。 注意として、Node API の多くはローカルシステムのリソースへのアクセスを許してしまいます。 信頼できない外部コンテンツにおいては、公開するグローバルや API について注意が必要です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> crypto = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'crypto'</span>)\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'nodeCrypto'</span>, {\n  sha256sum (data) {\n    <span class=\"hljs-keyword\">const</span> hash = crypto.createHash(<span class=\"hljs-string\">'sha256'</span>)\n    hash.update(data)\n    <span class=\"hljs-keyword\">return</span> hash.digest(<span class=\"hljs-string\">'hex'</span>)\n  }\n})\n</code></pre>",
      "title": "contextBridge",
      "description": "分離されたコンテキスト間に、安全、双方向で同期されたブリッジを作成します"
    },
    "/docs/tutorial/context-isolation": {
      "locale": "ja-JP",
      "slug": "context-isolation",
      "href": "/docs/tutorial/context-isolation",
      "crowdinFileId": "256185",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/context-isolation.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"コンテキストの分離\"><a href=\"#コンテキストの分離\">コンテキストの分離</a></h1>\n<h2 id=\"これは何ですか\"><a href=\"#これは何ですか\">これは何ですか?</a></h2>\n<p>コンテキスト分離は、あなたの<code>プレロード</code> スクリプトと Electron の内部ロジックの両方が、 <a href=\"/docs/api/web-contents\"><code>webContents</code></a> でロードしたウェブサイトに対して別のコンテキストで実行されることを保証する機能です。  これは、ウェブサイトが Electron の内部にアクセスできないようにするためのセキュリティを向上させ、プリロードスクリプトがアクセスできる強力な API を防ぐために重要です。</p>\n<p>つまり、プリロードスクリプトがアクセスできる <code>window</code> オブジェクトは、ウェブサイトがアクセスできるオブジェクトとは実際には <strong>異なる</strong> オブジェクトであることを意味します。  例えば、コンテキストの分離が有効の場合、プリロードスクリプトで <code>window.hello = 'wave'</code> を設定してウェブサイトがこれにアクセスしようとしても、<code>window.hello</code> は undefined になります。</p>\n<p>コンテキストの分離は Electron 12 からデフォルトで有効になっており、<em>すべてのアプリケーション</em> で推奨されているセキュリティ設定です。</p>\n<h2 id=\"移行\"><a href=\"#移行\">移行</a></h2>\n<blockquote>\n<p>コンテキストが分離されていない状態で、<code>window.X = apiObject</code> を使ってプリロードスクリプトから API を提供していました。 どうすればよいですか？</p>\n</blockquote>\n<h3 id=\"ビフォー-コンテキストの分離が無効のとき\"><a href=\"#ビフォー-コンテキストの分離が無効のとき\">ビフォー: コンテキストの分離が無効のとき</a></h3>\n<p>プリロードスクリプトからレンダラープロセスで読み込まれたウェブサイトに API を公開することは、ごく一般的な使用例です。 コンテキストの分離を無効にすると、プリロードスクリプトは、共通のグローバルな <code>window</code> オブジェクトをレンダラーと共有することになります。 そして、任意のプロパティをプリロードスクリプトに添付できます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// コンテキストの分離が無効のプリロード</span>\n<span class=\"hljs-built_in\">window</span>.myAPI = {\n  <span class=\"hljs-attr\">doAThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {}\n}\n</code></pre>\n<p><code>doAThing()</code> 関数は、レンダラープロセスで直接使用できます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// レンダラー内から公開された API を使用</span>\n<span class=\"hljs-built_in\">window</span>.myAPI.doAThing()\n</code></pre>\n<h3 id=\"アフター-コンテキストの分離が有効のとき\"><a href=\"#アフター-コンテキストの分離が有効のとき\">アフター: コンテキストの分離が有効のとき</a></h3>\n<p>Electron には、これを楽に行うための専用モジュールがあります。 <a href=\"/docs/tutorial/.../api/context-bridge\"><code>contextBridge</code></a> モジュールは、プリロードスクリプトの分離したコンテキストから、ウェブサイトが実行されているコンテキストに API を <strong>安全に</strong> 公開するために使用できます。 このAPIは以前と同様に <code>window.myAPI</code> のウェブサイトからもアクセスできます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// コンテキストの分離が有効のプリロード</span>\n<span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">doAThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {}\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// レンダラー内から公開された API を使用</span>\n<span class=\"hljs-built_in\">window</span>.myAPI.doAThing()\n</code></pre>\n<p>上記の <code>contextBridge</code> ドキュメントを読んで、その制限を完全に理解してください。 例えば、カスタムプロトタイプやシンボルはブリッジで送信できません。</p>\n<h2 id=\"セキュリティ上の考慮事項\"><a href=\"#セキュリティ上の考慮事項\">セキュリティ上の考慮事項</a></h2>\n<p><code>contextIsolation</code> を有効にして、 <code>contextBridge</code> を使用するだけでは、すべてが安全であることにはなりません。 例えば、以下のコードは <strong>危険です</strong>。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// ❌ 悪いコード</span>\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI, {\n  send: ipcRenderer.send\n})\n</span></code></pre>\n<p>これは、引数のフィルタリングなどを行うことなく、強力なAPIを直接公開します。 これにより、任意のウェブサイトが、設計者の望んでいない任意の IPC メッセージを送信できるようになります。 IPC ベースの API を公開する正しい方法は、IPCメッセージごとに1つのメソッドを提供することです。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// ✅ 良いコード</span>\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI, {\n  loadPreferences: () => ipcRenderer.invoke('</span>load-prefs<span class=\"hljs-string\">')\n})\n</span></code></pre>\n<h2 id=\"typescript-との連携\"><a href=\"#typescript-との連携\">TypeScript との連携</a></h2>\n<p>TypeScript で Electron アプリを構築している場合、コンテキストブリッジを介して公開される API に型を追加する必要があります。 <a href=\"https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html\">型宣言ファイル</a> で型を拡張しないと、レンダラーの <code>window</code> オブジェクトは正しい型になりません。</p>\n<p>例えば、以下の <code>preload.ts</code> スクリプトについて考えましょう。</p>\n<pre><code class=\"hljs language-typescript\">contextBridge.exposeInMainWorld(<span class=\"hljs-string\">'electronAPI'</span>, {\n  loadPreferences: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'load-prefs'</span>)\n})\n</code></pre>\n<p><code>renderer.d.ts</code> 型宣言ファイルを作成し、<code>Window</code> インターフェースをこのようにグローバルに拡張できます。</p>\n<pre><code class=\"hljs language-typescript\"><span class=\"hljs-keyword\">export</span> <span class=\"hljs-keyword\">interface</span> IElectronAPI {\n  loadPreferences: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-built_in\">Promise</span>&#x3C;<span class=\"hljs-built_in\">void</span>>,\n}\n\n<span class=\"hljs-keyword\">declare</span> global {\n  <span class=\"hljs-keyword\">interface</span> Window {\n    electronAPI: IElectronAPI\n  }\n}\n</code></pre>\n<p>そうすることで、レンダラープロセスでスクリプトを書く際に、TypeScript コンパイラがグローバルな <code>window</code> オブジェクトの <code>electronAPI</code> プロパティを知ることができます。</p>\n<pre><code class=\"hljs language-typescript\"><span class=\"hljs-built_in\">window</span>.electronAPI.loadPreferences()\n</code></pre>",
      "title": "コンテキストの分離",
      "description": "コンテキストが分離されていない状態で、window.X = apiObject を使ってプリロードスクリプトから API を提供していました。 どうすればよいですか？"
    },
    "/docs/api/structures/cookie": {
      "locale": "ja-JP",
      "slug": "cookie",
      "href": "/docs/api/structures/cookie",
      "crowdinFileId": "256417",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/cookie.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"cookie-object\"><a href=\"#cookie-object\">Cookie Object</a></h1>\n<ul>\n<li><code>name</code> String - The name of the cookie.</li>\n<li><code>value</code> String - The value of the cookie.</li>\n<li><code>domain</code> String (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains.</li>\n<li><code>hostOnly</code> Boolean (optional) - Whether the cookie is a host-only cookie; this will only be <code>true</code> if no domain was passed.</li>\n<li><code>path</code> String (optional) - The path of the cookie.</li>\n<li><code>secure</code> Boolean (optional) - Whether the cookie is marked as secure.</li>\n<li><code>httpOnly</code> Boolean (optional) - Whether the cookie is marked as HTTP only.</li>\n<li><code>session</code> Boolean (optional) - Whether the cookie is a session cookie or a persistent cookie with an expiration date.</li>\n<li><code>expirationDate</code> Double (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies.</li>\n<li><code>sameSite</code> String - The <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies\">Same Site</a> policy applied to this cookie.  Can be <code>unspecified</code>, <code>no_restriction</code>, <code>lax</code> or <code>strict</code>.</li>\n</ul>",
      "title": "Cookie Object",
      "description": ""
    },
    "/docs/api/cookies": {
      "locale": "ja-JP",
      "slug": "cookies",
      "href": "/docs/api/cookies",
      "crowdinFileId": "256301",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/cookies.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-cookies\"><a href=\"#クラス-cookies\">クラス: Cookies</a></h2>\n<blockquote>\n<p>セッションのクッキーをクエリーしたり、変更したりします。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<p><code>Cookies</code> クラスのインスタンスには、<code>Session</code> の <code>cookies</code> プロパティを使用してアクセスします。</p>\n<p>以下がその例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// すべてのクッキーをクエリーします。</span>\nsession.defaultSession.cookies.get({})\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">cookies</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(cookies)\n  }).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">error</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(error)\n  })\n\n<span class=\"hljs-comment\">// 特定のurlに関連した全てのクッキーを問い合わせ</span>\nsession.defaultSession.cookies.get({ <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'http://www.github.com'</span> })\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">cookies</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(cookies)\n  }).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">error</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(error)\n  })\n\n<span class=\"hljs-comment\">// 与えられたクッキーデータでクッキーをセット</span>\n<span class=\"hljs-comment\">// 同等なクッキーが存在していた場合、それを上書きすることあり</span>\n<span class=\"hljs-keyword\">const</span> cookie = { <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'http://www.github.com'</span>, <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'dummy_name'</span>, <span class=\"hljs-attr\">value</span>: <span class=\"hljs-string\">'dummy'</span> }\nsession.defaultSession.cookies.set(cookie)\n  .then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// 成功</span>\n  }, (error) => {\n    <span class=\"hljs-built_in\">console</span>.error(error)\n  })\n</code></pre>\n<h3 id=\"インスタンスイベント\"><a href=\"#インスタンスイベント\">インスタンスイベント</a></h3>\n<p><code>Cookies</code> のインスタンスでは、以下のイベントが利用できます。</p>\n<h4 id=\"イベント-changed\"><a href=\"#イベント-changed\">イベント: 'changed'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>cookie</code> <a href=\"/docs/api/structures/cookie\">Cookie</a> - 変更された cookie。</li>\n<li><code>cause</code> String - 以下のいずれかの値となる変更の原因。<ul>\n<li><code>explicit</code> - ユーザーのアクションによってクッキーが直接変更されました。</li>\n<li><code>overwrite</code> - 上書きする挿入操作のため、クッキーが自動的に削除されました。</li>\n<li><code>expired</code> - 有効期限切れのため、クッキーが自動的に削除されました。</li>\n<li><code>evicted</code> - ガベージコレクション中にクッキーが自動的に破棄されました。</li>\n<li><code>expired-overwrite</code> - クッキーが既に期限切れの有効期限で上書きされました。</li>\n</ul></li>\n<li><code>removed</code> Boolean - クッキーが削除された場合、<code>true</code>、それ以外は、<code>false</code>。</li>\n</ul>\n<p>追加されたり、編集されたり、削除されたり、有効期限が切れたりすることによってクッキーが変更されたときに発生します。</p>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<p><code>Cookies</code> のインスタンスでは、以下のメソッドが利用できます。</p>\n<h4 id=\"cookiesgetfilter\"><a href=\"#cookiesgetfilter\"><code>cookies.get(filter)</code></a></h4>\n<ul>\n<li><code>filter</code> Object<ul>\n<li><code>url</code> String (任意) - <code>url</code> に関連付けられた Cookie を取得します。 空の場合は全ての URL の Cookie を取得します。</li>\n<li><code>name</code> String (任意) - 名前でクッキーをフィルタリングします。</li>\n<li><code>domain</code> String (任意) - クッキーのドメインと一致するか、ドメインが <code>domains</code> のサブドメインであるクッキーを取得します。</li>\n<li><code>path</code> String (任意) - クッキーのパスが <code>path</code> と一致するクッキーを取得します。</li>\n<li><code>secure</code> Boolean (任意) - Secureプロパティでクッキーをフィルタリングします。</li>\n<li><code>session</code> Boolean (任意) - セッションまたは永続的クッキーでフィルタリングします。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;Cookie[]></code> - cookie オブジェクトの配列で解決される Promise。</p>\n<p><code>filter</code> に一致するすべての cookie を取得するリクエストを送り、そのレスポンスで Promise を解決します。</p>\n<h4 id=\"cookiessetdetails\"><a href=\"#cookiessetdetails\"><code>cookies.set(details)</code></a></h4>\n<ul>\n<li><code>details</code> Object<ul>\n<li><code>url</code> String - クッキーに関連付けられるURL。 URL が不正な場合、 Promise は reject されます。</li>\n<li><code>name</code> String (任意) - Cookie の名前。 省略された場合は既定で空になります。</li>\n<li><code>value</code> String (任意) - Cookie の値。 省略された場合は既定で空になります。</li>\n<li><code>domain</code> String (任意) - Cookie のドメインです。これはサブドメインでも有効になるように最初のドットで正規化されます。 省略された場合は既定で空になります。</li>\n<li><code>path</code> String (optional) - Cookie のパス。 省略された場合は既定で空になります。</li>\n<li><code>secure</code> Boolean (任意) - Cookie に Secure フラグがついているか。 <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite#samesitenone_requires_secure\">Same Site=None</a> 属性が使用されていない限り、デフォルトでは false となります。</li>\n<li><code>httpOnly</code> Boolean (任意) - Cookie に HttpOnly フラグがついているか。 省略値は、false です。</li>\n<li><code>expirationDate</code> Double (任意) - UNIX時間の秒数によるCookieの有効期限。 省略した場合、クッキーはセッションクッキーになり、セッション間では保持されなくなります。</li>\n<li><code>sameSite</code> String (任意) - この Cookie に適用する <a href=\"https://developer.mozilla.org/ja/docs/Web/HTTP/Cookies#SameSite_attribute\">SameSite</a> ポリシー。  <code>unspecified</code>、<code>no_restriction</code>、<code>lax</code>、<code>strict</code> のいずれかにできます。  省略値は <code>no_restriction</code> です。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - cookie が設定されたときに解決される Promise。</p>\n<p>cookie を <code>details</code> で設定します。</p>\n<h4 id=\"cookiesremoveurl-name\"><a href=\"#cookiesremoveurl-name\"><code>cookies.remove(url, name)</code></a></h4>\n<ul>\n<li><code>url</code> String - クッキーに関連付けられたURL。</li>\n<li><code>name</code> String - 削除するクッキーの名前。</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - cookie が削除されたときに解決される Promise。</p>\n<p><code>url</code> と <code>name</code> が一致する cookie を削除します。</p>\n<h4 id=\"cookiesflushstore\"><a href=\"#cookiesflushstore\"><code>cookies.flushStore()</code></a></h4>\n<p>戻り値 <code>Promise&#x3C;void></code> - cookie ストアがフラッシュされたときに解決される Promise。</p>\n<p>未書き込みのクッキーのデータをディスクに書き込みます。</p>",
      "title": "クラス: Cookies",
      "description": "セッションのクッキーをクエリーしたり、変更したりします。"
    },
    "/docs/api/structures/cpu-usage": {
      "locale": "ja-JP",
      "slug": "cpu-usage",
      "href": "/docs/api/structures/cpu-usage",
      "crowdinFileId": "256419",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/cpu-usage.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"cpuusage-object\"><a href=\"#cpuusage-object\">CPUUsage Object</a></h1>\n<ul>\n<li><code>percentCPUUsage</code> Number - Percentage of CPU used since the last call to getCPUUsage. First call returns 0.</li>\n<li><code>idleWakeupsPerSecond</code> Number - The number of average idle CPU wakeups per second since the last call to getCPUUsage. First call returns 0. Will always return 0 on Windows.</li>\n</ul>",
      "title": "CPUUsage Object",
      "description": ""
    },
    "/docs/api/structures/crash-report": {
      "locale": "ja-JP",
      "slug": "crash-report",
      "href": "/docs/api/structures/crash-report",
      "crowdinFileId": "256421",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/crash-report.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"crashreport-object\"><a href=\"#crashreport-object\">CrashReport Object</a></h1>\n<ul>\n<li><code>date</code> Date</li>\n<li><code>id</code> String</li>\n</ul>",
      "title": "CrashReport Object",
      "description": ""
    },
    "/docs/api/crash-reporter": {
      "locale": "ja-JP",
      "slug": "crash-reporter",
      "href": "/docs/api/crash-reporter",
      "crowdinFileId": "256303",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/crash-reporter.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"crashreporter\"><a href=\"#crashreporter\">crashReporter</a></h1>\n<blockquote>\n<p>クラッシュレポートをリモートサーバーに送信します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a>, <a href=\"/docs/glossary#renderer-process\">レンダラー</a></p>\n<p>以下は、Electron が外部サーバーにクラッシュレポートを自動送信するように設定する例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { crashReporter } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncrashReporter.start({ <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://your-domain.com/url-to-submit'</span> })\n</code></pre>\n<p>クラッシュレポートを受信して処理するサーバーをセットアップするには、以下のプロジェクトを使用することができます。</p>\n<ul>\n<li><a href=\"https://github.com/mozilla/socorro\">socorro</a></li>\n<li><a href=\"https://github.com/electron/mini-breakpad-server\">mini-breakpad-server</a></li>\n</ul>\n<p>また、サードパーティによる解決方法も使用できます。</p>\n<ul>\n<li><a href=\"https://backtrace.io/electron/\">Backtrace</a></li>\n<li><a href=\"https://docs.sentry.io/clients/electron\">Sentry</a></li>\n<li><a href=\"https://www.bugsplat.com/docs/platforms/electron\">BugSplat</a></li>\n</ul>\n<p>クラッシュレポートは、アップロードされる前にアプリのユーザーデータディレクトリ下にあるディレクトリに一時保存されます (Windows と Mac では 'Crashpad'、Linux では 'Crash Reports' と呼びます)。 クラッシュし始める前に <code>app.setPath('crashDumps', '/path/to/crashes')</code> を呼び出すことで、このディレクトリをオーバーライドできます。</p>\n<p>Windows と macOS において、Electron は <a href=\"https://chromium.googlesource.com/crashpad/crashpad/+/master/README.md\">crashpad</a> を使用してクラッシュを監視し報告します。 Linux では、Electron は <a href=\"https://chromium.googlesource.com/breakpad/breakpad/+/master/\">breakpad</a> を使用します。 これは Chromium が動かす内部実装によるもので、将来的に変更される可能性があります。 特に crashpad は新しく、最終的には全プラットフォームで breakpad を置き換える可能性が高いです。</p>\n<h3 id=\"linux-上の-node-子プロセスに関する注意\"><a href=\"#linux-上の-node-子プロセスに関する注意\">Linux 上の Node 子プロセスに関する注意</a></h3>\n<p>Node.js の <code>child_process</code> モジュールを使用していて、Linux 上でそれらのプロセスからクラッシュを報告したい場合、子プロセスのクラッシュレポーターを適切に初期化するために追加の手順が必要になります。 Mac や Windows のプラットフォームでは、子プロセスを自動的に監視する Crashpad を使用しているため不要です。</p>\n<p><code>require('electron')</code> は Node の子プロセスでは利用できないので、Node の子プロセスでは <code>process</code> オブジェクトの以下の API を利用することができます。 注意として、Linux では、Node の子プロセスはそれぞれ別々の breeakpad クラッシュレポーターのインスタンスを保持します。 これはレンダラーの子プロセスとは異なり、情報をメインプロセスに返してレポートする \"スタブ\" breakpad レポーターです。</p>\n<h4 id=\"processcrashreporterstartoptions\"><a href=\"#processcrashreporterstartoptions\"><code>process.crashReporter.start(options)</code></a></h4>\n<p><a href=\"#crashreporterstartoptions\"><code>crashReporter.start()</code></a> をご参照ください。</p>\n<h4 id=\"processcrashreportergetparameters\"><a href=\"#processcrashreportergetparameters\"><code>process.crashReporter.getParameters()</code></a></h4>\n<p><a href=\"#crashreportergetparameters\"><code>crashReporter.getParameters()</code></a> をご参照ください。</p>\n<h4 id=\"processcrashreporteraddextraparameterkey-value\"><a href=\"#processcrashreporteraddextraparameterkey-value\"><code>process.crashReporter.addExtraParameter(key, value)</code></a></h4>\n<p><a href=\"#crashreporteraddextraparameterkey-value\"><code>crashReporter.addExtraParameter(key, value)</code></a> をご参照ください。</p>\n<h4 id=\"processcrashreporterremoveextraparameterkey\"><a href=\"#processcrashreporterremoveextraparameterkey\"><code>process.crashReporter.removeExtraParameter(key)</code></a></h4>\n<p><a href=\"#crashreporterremoveextraparameterkey\"><code>crashReporter.removeExtraParameter(key)</code></a> をご参照ください。</p>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>crashReporter</code> モジュールには以下のメソッドがあります。</p>\n<h3 id=\"crashreporterstartoptions\"><a href=\"#crashreporterstartoptions\"><code>crashReporter.start(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>submitURL</code> String (optional) - URL that crash reports will be sent to as POST. Required unless <code>uploadToServer</code> is <code>false</code>.</li>\n<li><code>productName</code> String (任意) - 省略値は、<code>app.name</code> です。</li>\n<li><code>companyName</code> String (任意) <em>非推奨</em> - <code>{ globalExtra: { _companyName: ... } }</code> の非推奨な別名です。</li>\n<li><code>uploadToServer</code> Boolean (任意) - クラッシュレポートをサーバーに送信するかどうか。 false の場合、クラッシュレポートは収集されてクラッシュのディレクトリに保存されますが、アップロードされません。 省略値は <code>true</code> です。</li>\n<li><code>ignoreSystemCrashHandler</code> Boolean (任意) - true の場合、メインプロセスで発生したクラッシュをシステムクラッシュハンドラに転送しません。 省略値は <code>false</code> です。</li>\n<li><code>rateLimit</code> Boolean (任意) <em>macOS</em> <em>Windows</em> - true の場合、アップロードされるクラッシュの数を 1 時間につき 1 つに制限します。 省略値は <code>false</code> です。</li>\n<li><code>compress</code> Boolean (任意) - true の場合、クラッシュレポートは圧縮され <code>Content-Encoding: gzip</code> でアップロードされます。 省略値は <code>true</code> です。</li>\n<li><code>extra</code> Record&#x3C;String, String> (任意) - メインプロセスが生成するクラッシュレポートと一緒に送信される追加のキー/バリューアノテーションの文字列。 文字列のみをサポートしています。 子プロセスから生成されたクラッシュレポートはこれらの追加パラメータを含みません。子プロセスが生成したクラッシュにこれらを含める場合は、子プロセスから <a href=\"#crashreporteraddextraparameterkey-value\"><code>addExtraParameter</code></a> を呼び出してください。</li>\n<li><code>globalExtra</code> Record&#x3C;String, String> (任意) - 任意のプロセスが生成したクラッシュレポートと一緒に送信される、追加のキー/バリューアノテーションの文字列。 これらのアノテーションは、クラッシュレポーターを起動すると変更できません。 グローバル追加パラメータとプロセス固有の追加パラメータの両方に同じキーが存在する場合、グローバルのものが優先されます。 デフォルトでは、 <code>productName</code> と、Electron のバージョンと同様のアプリのバージョンが含まれています。</li>\n</ul></li>\n</ul>\n<p>このメソッドは、他の <code>crashReporter</code> API を使用する前に呼ばれなければなりません。 このように初期化すると、crashpad ハンドラは、以降作成されたすべてのプロセスからクラッシュを収集します。 一度起動したクラッシュレポーターは無効にできません。</p>\n<p>このメソッドは、アプリの起動時にできるだけ早く、できれば <code>app.on('ready')</code> の前に呼び出す必要があります。 レンダラープロセスの作成時にクラッシュレポーターが初期化されていない場合、そのレンダラープロセスはクラッシュレポーターに監視されません。</p>\n<p><strong>注:</strong> <code>process.crash()</code> でクラッシュを生成することで、クラッシュレポーターをテストできます。</p>\n<p><strong>注意:</strong> 最初の <code>start</code> 呼び出しの後に追加/更新された <code>extra</code> パラメータを送信する必要がある場合は、<code>addExtraParameter</code> を呼び出すことでできます。</p>\n<p><strong>注:</strong> <code>extra</code>、<code>globalExtra</code> で渡すパラメータや <code>addExtraParameter</code> で設定するパラメータは、キーと値の長さに制限があります。 キー名の長さは最大 39 バイト、値の長さは 127 バイト以下でなければなりません。 最大値より長い名前を持つキーは警告を出さずに無視されます。 キーの値が最大長より長ければ切り捨てられます。</p>\n<p><strong>注意:</strong> このメソッドはメインプロセスからのみ利用できます。</p>\n<h3 id=\"crashreportergetlastcrashreport\"><a href=\"#crashreportergetlastcrashreport\"><code>crashReporter.getLastCrashReport()</code></a></h3>\n<p>戻り値 <a href=\"/docs/api/structures/crash-report\"><code>CrashReport</code></a> - 最後のクラッシュレポートの日付と ID。 アップロードされたクラッシュレポートだけを返します。例えば、クラッシュレポートがディスク上に存在したとしても、アップロードしていなければそれを返しません。 アップロードされたレポートがない場合これは、<code>null</code> を返します。</p>\n<p><strong>注意:</strong> このメソッドはメインプロセスからのみ利用できます。</p>\n<h3 id=\"crashreportergetuploadedreports\"><a href=\"#crashreportergetuploadedreports\"><code>crashReporter.getUploadedReports()</code></a></h3>\n<p>戻り値 <a href=\"/docs/api/structures/crash-report\"><code>CrashReport[]</code></a>:</p>\n<p>アップロードされたすべてのクラッシュレポートを返します。 各レポートには、日付とアップロードされた ID が含まれています。</p>\n<p><strong>注意:</strong> このメソッドはメインプロセスからのみ利用できます。</p>\n<h3 id=\"crashreportergetuploadtoserver\"><a href=\"#crashreportergetuploadtoserver\"><code>crashReporter.getUploadToServer()</code></a></h3>\n<p>戻り値 <code>Boolean</code> - レポートがサーバに送信されるべきかどうか。 <code>start</code> メソッドまたは <code>setUploadToServer</code> を通して設定されます。</p>\n<p><strong>注意:</strong> このメソッドはメインプロセスからのみ利用できます。</p>\n<h3 id=\"crashreportersetuploadtoserveruploadtoserver\"><a href=\"#crashreportersetuploadtoserveruploadtoserver\"><code>crashReporter.setUploadToServer(uploadToServer)</code></a></h3>\n<ul>\n<li><code>uploadToServer</code> Boolean - レポートがサーバーに送信されるかどうか.</li>\n</ul>\n<p>これは通常、ユーザーの設定によって制御されます。 <code>start</code> が呼ばれるまでは何もしません。</p>\n<p><strong>注意:</strong> このメソッドはメインプロセスからのみ利用できます。</p>\n<h3 id=\"crashreporteraddextraparameterkey-value\"><a href=\"#crashreporteraddextraparameterkey-value\"><code>crashReporter.addExtraParameter(key, value)</code></a></h3>\n<ul>\n<li><code>key</code> String - パラメータキー。39 バイト未満でなければなりません。</li>\n<li><code>value</code> String - パラメータの値。127 バイト未満でなければなりません。</li>\n</ul>\n<p>クラッシュレポートで送信される追加のパラメータを設定します。 ここで指定された値は、<code>start</code> が呼ばれたときに <code>extra</code> オプションで設定された値に加えて送信されます。</p>\n<p>この方法 (または <code>crashReporter.start</code> の<code>extra</code> パラメータ) で追加されたパラメータは、呼び出すプロセスに固有のものです。 メインプロセスに追加パラメータを追加しても、それらのパラメータはレンダラーや他の子プロセスからのクラッシュとは一緒に送信されません。 同様に、レンダラープロセスでパラメータを追加しても、他のレンダラープロセスやメインプロセスで発生するクラッシュでそれらのパラメータは送信されません。</p>\n<p><strong>注:</strong> パラメータはキーと値の長さに制限があります。 キー名の長さは 39 バイト未満、値の長さは 20320 バイト未満でなければなりません。 最大値より長い名前を持つキーは警告を出さずに無視されます。 キーの値が最大長より長ければ切り捨てられます。</p>\n<p><strong>注:</strong> Linux では、127 バイトより長い値は複数のキーに分割され、それぞれの長さが 127 バイトになります。  以下は例です。 <code>addExtraParameter('foo', 'a'.repeat(130))</code> の場合、2 つにチャンク化されたキー <code>foo__1</code> と <code>foo__2</code> が生成され、1 つ目のキーには最初の 127 バイトが、2 つ目のキーには残りの 3 バイトが含まれます。  クラッシュレポートのバックエンドでは、この形式のキーをつなぎ合わせる必要があります。</p>\n<h3 id=\"crashreporterremoveextraparameterkey\"><a href=\"#crashreporterremoveextraparameterkey\"><code>crashReporter.removeExtraParameter(key)</code></a></h3>\n<ul>\n<li><code>key</code> String - パラメータキー。39 バイト未満でなければなりません。</li>\n</ul>\n<p>現在のパラメータセットから追加パラメータを削除します。 今後のクラッシュにこのパラメータは含まれなくなります。</p>\n<h3 id=\"crashreportergetparameters\"><a href=\"#crashreportergetparameters\"><code>crashReporter.getParameters()</code></a></h3>\n<p>戻り値 <code>Record&#x3C;String, String></code> - クラッシュレポーターの現在の '追加' パラメータ。</p>\n<h2 id=\"クラッシュレポートの内容\"><a href=\"#クラッシュレポートの内容\">クラッシュレポートの内容</a></h2>\n<p>クラッシュレポーターは、以下のデータを <code>submitURL</code> に <code>multipart/form-data</code> の <code>POST</code> で送信します。</p>\n<ul>\n<li><code>ver</code> String - Electronのバージョン。</li>\n<li><code>platform</code> String - 例えば、'win32'。</li>\n<li><code>process_type</code> String - 例えば、'renderer'。</li>\n<li><code>guid</code> String - 例えば、'5e1286fc-da97-479e-918b-6bfb0c3d1c72'。</li>\n<li><code>_version</code> String - <code>package.json</code>内のバージョン。</li>\n<li><code>_productName</code> String - <code>crashReporter</code>の<code>options</code>内のproductName。</li>\n<li><code>prod</code> String - 基底にあるプロダクトの名前。 この場合は Electron です。</li>\n<li><code>_companyName</code> String - <code>crashReporter</code>の<code>options</code>内のcompanyName。</li>\n<li><code>upload_file_minidump</code> File - <code>minidump</code>フォーマットのクラッシュレポート。</li>\n<li><code>crashReporter</code>の<code>options</code>内の<code>extra</code>オブジェクトの全ての最上位プロパティ。</li>\n</ul>",
      "title": "crashReporter",
      "description": "クラッシュレポートをリモートサーバーに送信します。"
    },
    "/docs/api/structures/custom-scheme": {
      "locale": "ja-JP",
      "slug": "custom-scheme",
      "href": "/docs/api/structures/custom-scheme",
      "crowdinFileId": "256423",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/custom-scheme.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"customscheme-object\"><a href=\"#customscheme-object\">CustomScheme Object</a></h1>\n<ul>\n<li><code>scheme</code> String - Custom schemes to be registered with options.</li>\n<li><code>privileges</code> Object (optional)<ul>\n<li><code>standard</code> Boolean (optional) - Default false.</li>\n<li><code>secure</code> Boolean (optional) - Default false.</li>\n<li><code>bypassCSP</code> Boolean (optional) - Default false.</li>\n<li><code>allowServiceWorkers</code> Boolean (optional) - Default false.</li>\n<li><code>supportFetchAPI</code> Boolean (optional) - Default false.</li>\n<li><code>corsEnabled</code> Boolean (optional) - Default false.</li>\n<li><code>stream</code> Boolean (optional) - Default false.</li>\n</ul></li>\n</ul>",
      "title": "CustomScheme Object",
      "description": ""
    },
    "/docs/tutorial/dark-mode": {
      "locale": "ja-JP",
      "slug": "dark-mode",
      "href": "/docs/tutorial/dark-mode",
      "crowdinFileId": "256187",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/dark-mode.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ダークモード\"><a href=\"#ダークモード\">ダークモード</a></h1>\n<h2 id=\"概要\"><a href=\"#概要\">概要</a></h2>\n<h3 id=\"automatically-update-the-native-interfaces\"><a href=\"#automatically-update-the-native-interfaces\">Automatically update the native interfaces</a></h3>\n<p>\"Native interfaces\" include the file picker, window border, dialogs, context menus, and more - anything where the UI comes from your operating system and not from your app. The default behavior is to opt into this automatic theming from the OS.</p>\n<h3 id=\"automatically-update-your-own-interfaces\"><a href=\"#automatically-update-your-own-interfaces\">Automatically update your own interfaces</a></h3>\n<p>If your app has its own dark mode, you should toggle it on and off in sync with the system's dark mode setting. これは、[prefer-color-scheme] CSS メディアクエリを使用することで可能です。</p>\n<h3 id=\"manually-update-your-own-interfaces\"><a href=\"#manually-update-your-own-interfaces\">Manually update your own interfaces</a></h3>\n<p>If you want to manually switch between light/dark modes, you can do this by setting the desired mode in the <a href=\"/docs/api/native-theme#nativethemethemesource\">themeSource</a> property of the <code>nativeTheme</code> module. This property's value will be propagated to your Renderer process. Any CSS rules related to <code>prefers-color-scheme</code> will be updated accordingly.</p>\n<h2 id=\"macos-settings\"><a href=\"#macos-settings\">macOS settings</a></h2>\n<p>macOS 10.14 Mojave にて、Apple は新しい <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/dark-mode/\">システム全体のダークモード</a> を全ての macOS コンピュータに導入しました。 あなたの Electron アプリにダークモードがある場合、<a href=\"/docs/api/native-theme\"><code>nativeTheme</code> API</a> を使用してシステム全体のダークモード設定に従うようにできます。</p>\n<p>macOS 10.15 Catalina にて、Apple は新しい \"自動\" ダークモードオプションを全ての macOS コンピュータに導入しました。 Catalina 上のこのモードで <code>nativeTheme.shouldUseDarkColors</code> と <code>Tray</code> API を正しく動作させるには、Electron <code>>=7.0.0</code> を使用するか、古いバージョンの場合は <code>Info.plist</code> ファイルの <code>NSRequiresAquaSystemAppearance</code> を <code>false</code> に設定する必要があります。 <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a> と <a href=\"https://www.electronforge.io/\">Electron Forge</a> の両方には <a href=\"https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html#darwindarkmodesupport\"><code>darwinDarkModeSupport</code> オプション</a> があり、アプリビルド時の <code>Info.plist</code> の変更を自動化します。</p>\n<p>Electron > 8.0.0 を使用中でオプトアウトしたい場合は、<code>Info.plist</code> ファイルの <code>NSRequiresAquaSystemAppearance</code> キーを <code>true</code> に設定する必要があります。 Electron 8.0.0 以降では macOS 10.14 SDK を使用するため、このテーマ設定をオプトアウトすることはできません。ご注意ください。</p>\n<h2 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h2>\n<p>ここでは、<code>nativeTheme</code> から派生したテーマカラーになる Electron アプリケーションの例を示します。 加えて、IPC チャンネルを利用したテーマの切り替えとリセットの制御もできます。</p>\n<h3 id=\"これはどのように動作しているのでしょうか？\"><a href=\"#これはどのように動作しているのでしょうか？\">これはどのように動作しているのでしょうか？</a></h3>\n<p><code>index.html</code> ファイルから見ていきましょう。</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"script-src 'self' 'unsafe-inline';\"</span> /></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/css\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"./styles.css\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">p</span>></span>Current theme source: <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">strong</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"theme-source\"</span>></span>System<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">strong</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">p</span>></span>\n\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"toggle-dark-mode\"</span>></span>Toggle Dark Mode<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">button</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"reset-to-system\"</span>></span>Reset to System Theme<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">button</span>></span>\n\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>そして <code>styles.css</code> ファイルです。</p>\n<pre><code class=\"hljs language-css\">@<span class=\"hljs-keyword\">media</span> (prefers-color-scheme: dark) {\n  <span class=\"hljs-selector-tag\">body</span> { <span class=\"hljs-attribute\">background</span>: <span class=\"hljs-number\">#333</span>; <span class=\"hljs-attribute\">color</span>: white; }\n}\n\n@<span class=\"hljs-keyword\">media</span> (prefers-color-scheme: light) {\n  <span class=\"hljs-selector-tag\">body</span> { <span class=\"hljs-attribute\">background</span>: <span class=\"hljs-number\">#ddd</span>; <span class=\"hljs-attribute\">color</span>: black; }\n}\n</code></pre>\n<p>この例では、一対の要素を持つ HTML ページを描画しています。 <code>&#x3C;strong id=\"theme-source\"></code> 要素は現在選択されているテーマを示すもので、2 つの <code>&#x3C;button></code> 要素は制御用です。 CSS ファイルでは、<a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> のメディアクエリを使用して <code>&#x3C;body></code> 要素の背景色とテキスト色を設定しています。</p>\n<p><code>preload.js</code> スクリプトで、<code>window</code> オブジェクトに <code>darkMode</code> という新しい API を追加します。 この API は、<code>'dark-mode:toggle'</code> と <code>'dark-mode:system'</code> の 2 つの IPC チャンネルをレンダラープロセスへ公開します。 また、レンダラープロセスからのメッセージをメインプロセスに渡すため、<code>toggle</code> と <code>system</code> の 2 つのメソッドも代入しています。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'darkMode'</span>, {\n  <span class=\"hljs-attr\">toggle</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'dark-mode:toggle'</span>),\n  <span class=\"hljs-attr\">system</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'dark-mode:system'</span>)\n})\n</code></pre>\n<p>これで、レンダラープロセスはメインプロセスと安全に通信し、<code>nativeTheme</code> オブジェクトに必要な変更操作ができます。</p>\n<p><code>renderer.js</code> ファイルは、<code>&#x3C;button></code> の機能を制御する役割を担います。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'toggle-dark-mode'</span>).addEventListener(<span class=\"hljs-string\">'click'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> isDarkMode = <span class=\"hljs-keyword\">await</span> <span class=\"hljs-built_in\">window</span>.darkMode.toggle()\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'theme-source'</span>).innerHTML = isDarkMode ? <span class=\"hljs-string\">'Dark'</span> : <span class=\"hljs-string\">'Light'</span>\n})\n\n<span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'reset-to-system'</span>).addEventListener(<span class=\"hljs-string\">'click'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> <span class=\"hljs-built_in\">window</span>.darkMode.system()\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'theme-source'</span>).innerHTML = <span class=\"hljs-string\">'System'</span>\n})\n</code></pre>\n<p><code>addEventListener</code> を使って、<code>renderer.js</code> ファイルで <code>'click'</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\">イベントリスナー</a> を各ボタン要素に追加します。 各イベントリスナーハンドラーには、それぞれの <code>window.darkMode</code> API メソッドの呼び出しをさせます。</p>\n<p>最後に、<code>main.js</code> ファイルでメインプロセスを記述し、実際の <code>nativeTheme</code> の API を入れます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, ipcMain, nativeTheme } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  ipcMain.handle(<span class=\"hljs-string\">'dark-mode:toggle'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (nativeTheme.shouldUseDarkColors) {\n      nativeTheme.themeSource = <span class=\"hljs-string\">'light'</span>\n    } <span class=\"hljs-keyword\">else</span> {\n      nativeTheme.themeSource = <span class=\"hljs-string\">'dark'</span>\n    }\n    <span class=\"hljs-keyword\">return</span> nativeTheme.shouldUseDarkColors\n  })\n\n  ipcMain.handle(<span class=\"hljs-string\">'dark-mode:system'</span>, () => {\n    nativeTheme.themeSource = <span class=\"hljs-string\">'system'</span>\n  })\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n      createWindow()\n    }\n  })\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n</code></pre>\n<p><code>ipcMain.handle</code> メソッドは、HTML ページ上のボタンからのクリックイベントに対して、メインプロセスが応答する手段となります。</p>\n<p><code>'dark-mode:toggle'</code> IPC チャンネルハンドラーのメソッドは、<code>shouldUseDarkColors</code> 真偽値型プロパティを確認して対応する <code>themeSource</code> を設定し、現在の <code>shouldUseDarkColors</code> プロパティを返します。 この IPC チャンネルに対応するレンダラープロセスのイベントリスナーへと戻って見てみると、このハンドラーの戻り値を利用して <code>&#x3C;strong id='theme-source'></code> 要素に正しいテキストを代入しています。</p>\n<p><code>'dark-mode:system'</code> IPC チャンネルハンドラーのメソッドは、文字列<code>'system'</code> を <code>themeSource</code> に割り当てるだけで何も返しません。 これは対応するレンダラープロセスのイベントリスナーにも言えることで、このメソッドは戻り値が期待できない状態で待機しています。</p>\n<p>Electron Fiddle を使ってサンプルを実行してみましょう。\"Toggle Dark Mode\" ボタンをクリックすると、アプリの背景色が明るくなったり暗くなったりするでしょう。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/dark_mode.gif\" alt=\"ダークモード\"></p>",
      "title": "ダークモード",
      "description": ""
    },
    "/docs/development/debug-instructions-windows": {
      "locale": "ja-JP",
      "slug": "debug-instructions-windows",
      "href": "/docs/development/debug-instructions-windows",
      "crowdinFileId": "256149",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debug-instructions-windows.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"windows-におけるデバッグ\"><a href=\"#windows-におけるデバッグ\">Windows におけるデバッグ</a></h1>\n<p>JavaScript アプリケーションに起因しないと思われるクラッシュや問題が Electron 上で起こった場合、特にネイティブ/ C++ デバッグの経験がない開発者にとって少しトリッキーなデバッグになります。 しかし、Visual Studio、Electron がホストするシンボルサーバーと Electron のソースコードを使用することで、Electron のソースコード内のブレークポイントを使ったステップスルーデバッグができます。</p>\n<p><strong>こちらも参照</strong>: Chromium のデバッグに関する豊富な情報があります。その多くは Chromium 開発者サイト (<a href=\"https://www.chromium.org/developers/how-tos/debugging-on-windows\">Debugging Chromium on Windows</a>) の Electron にも適しています。</p>\n<h2 id=\"要件\"><a href=\"#要件\">要件</a></h2>\n<ul>\n<li>\n<p><strong>Electronのデバッグビルド</strong>: 最も簡単な方法は、<a href=\"/docs/development/build-instructions-windows\">ビルド手順 (Windows) </a>にリストされているツールと必要な環境を使って、自分でビルドをする方法です。 Electron を直接ダウンロードしてアタッチしデバッグできますが、Electron は高度に最適化されているためデバッグが困難であることに気付くでしょう。デバッガはすべての変数の内容は表示できませんし、インラインに展開されたり、末尾再帰やその他のコンパイラによる最適化により実行経路は奇妙に見えるはずです。</p>\n</li>\n<li>\n<p><strong>Visual Studio with C++ Tools</strong>: Visual Studio 2013 と Visual Studio 2015 の無料コミュニティ版両方が動きます。 インストール後、<a href=\"/docs/development/setting-up-symbol-server\">Electron のシンボルサーバーを使うための設定を行います</a>。 これによりVisual StudioがElectron内で起こっていることをより理解できるようになり、人が読める形式で現在の変数を表示することができます。</p>\n</li>\n<li>\n<p><strong>ProcMon</strong>: <a href=\"https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx\">無料の SysInternals ツール</a>を使うことでプロセスパラメーター、ファイル操作、レジストリ操作を検査することができます。</p>\n</li>\n</ul>\n<h2 id=\"electronへの接続とデバッグ\"><a href=\"#electronへの接続とデバッグ\">Electronへの接続とデバッグ</a></h2>\n<p>デバッグセッションを始めるには、PowerShell/CMD を開いて Electron のデバッグビルドを実行し、引数として開くアプリケーションを渡して使用します。</p>\n<pre><code class=\"hljs language-powershell\">$ ./out/Testing/electron.exe ~/my-electron-app/\n</code></pre>\n<h3 id=\"ブレークポイントの設定\"><a href=\"#ブレークポイントの設定\">ブレークポイントの設定</a></h3>\n<p>そして、Visual Studio を開きます。 Electron は Visual Studio でビルドされていないため、プロジェクトファイルは含まれていません。しかし、ソースコードファイルを \"ファイルとして\" 開くことができます。つまり、Visual Studio がそれ単独で開きます。 ブレークポイントを設定することもできます。 Visual Studio は、ソースコードがアタッチされたプロセスで実行されているコードと一致することを自動的に認識し、それに応じてブレークします。</p>\n<p>関連コードファイルは <code>./shell/</code> にあります。</p>\n<h3 id=\"アタッチ\"><a href=\"#アタッチ\">アタッチ</a></h3>\n<p>ローカルまたはリモートコンピュータ上で実行中のプロセスに Visual Studio デバッガをアタッチできます。 プロセスを実行中にしてから、\"プロセスにアタッチ\" ダイアログを開くためにプロセスにデバッグ/アタッチをクリック (または <code>CTRL+ALT+P</code> を押下) します。 この機能を使用してローカルまたはリモートコンピュータ上で実行されているアプリをデバッグし、複数のプロセスを同時にデバッグすることができます。</p>\n<p>Electron が異なるユーザアカウントで実行されている場合、<code>すべてのユーザからのプロセスを表示する</code> チェックボックスを選択してください。 開かれているアプリの BrowserWindow の数に応じて、複数のプロセスが表示されることに注意してください。 典型的な1ウインドウアプリは、Visual Studio に2つの <code>Electron.exe</code> エントリ - メインプロセス用とレンダラプロセス用を表示します。 リストは名前だけを表示するので、どちらがどちらであるかを把握する信頼できる方法は現在ありません。</p>\n<h3 id=\"どのプロセスにアタッチするべきか\"><a href=\"#どのプロセスにアタッチするべきか\">どのプロセスにアタッチするべきか</a></h3>\n<p>メインプロセス内から実行するコード (すなわちメイン JavaScript ファイル内から見られるコードまたは最終的に実行するコード) はメインプロセスで実行され、その他のコードはそれぞれのレンダラープロセスで実行されます。</p>\n<p>デバッグ中は複数のプログラムにアタッチすることができますが、随時1つのプログラムだけがデバッガでアクティブになります。 <code>デバッグの場所</code> ツールバーか <code>プロセスウインドウ</code> 内でアクティブなプログラムをセットできます。</p>\n<h2 id=\"プロセス監視にprocmonを使用する\"><a href=\"#プロセス監視にprocmonを使用する\">プロセス監視にProcMonを使用する</a></h2>\n<p>Visual Studio は特定のコードパスを検査するのには優れていますが、ProcMon の強みは、アプリケーションのオペレーティングシステムで行われているすべてのことを実際に監視していることです。プロセスのファイル、レジストリ、ネットワーク、プロセス、プロファイリングの詳細をキャプチャします。 <strong>すべての</strong>イベントをログに記録しようするので非常に巨大になる可能性がありますが、アプリケーションがオペレーティングシステムに対して何をどのようにして行っているのかを理解しようとするには価値のあるリソースになるかもしれません。</p>\n<p>ProcMon の基本及び高度なデバッグ機能については、Microsoft が提供する <a href=\"https://channel9.msdn.com/shows/defrag-tools/defrag-tools-4-process-monitor\">このビデオチュートリアル</a> を参照してください。</p>",
      "title": "Windows におけるデバッグ",
      "description": ""
    },
    "/docs/api/debugger": {
      "locale": "ja-JP",
      "slug": "debugger",
      "href": "/docs/api/debugger",
      "crowdinFileId": "256305",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/debugger.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-debugger\"><a href=\"#クラス-debugger\">クラス: Debugger</a></h2>\n<blockquote>\n<p>Chromeのリモートデバッグプロトコルに対する選択肢の1つ。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<p>Chromeの開発者ツールは、ページと相互にやり取りをしたり、ページを調整したりすることのできるJavaScriptランタイムに<a href=\"https://chromedevtools.github.io/devtools-protocol/\">特別なバインディング</a>を持っています。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-keyword\">try</span> {\n  win.webContents.debugger.attach(<span class=\"hljs-string\">'1.1'</span>)\n} <span class=\"hljs-keyword\">catch</span> (err) {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Debugger attach failed : '</span>, err)\n}\n\nwin.webContents.debugger.on(<span class=\"hljs-string\">'detach'</span>, (event, reason) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Debugger detached due to : '</span>, reason)\n})\n\nwin.webContents.debugger.on(<span class=\"hljs-string\">'message'</span>, (event, method, params) => {\n  <span class=\"hljs-keyword\">if</span> (method === <span class=\"hljs-string\">'Network.requestWillBeSent'</span>) {\n    <span class=\"hljs-keyword\">if</span> (params.request.url === <span class=\"hljs-string\">'https://www.github.com'</span>) {\n      win.webContents.debugger.detach()\n    }\n  }\n})\n\nwin.webContents.debugger.sendCommand(<span class=\"hljs-string\">'Network.enable'</span>)\n</code></pre>\n<h3 id=\"インスタンスイベント\"><a href=\"#インスタンスイベント\">インスタンスイベント</a></h3>\n<h4 id=\"イベント-detach\"><a href=\"#イベント-detach\">イベント: 'detach'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>reason</code> String - デバッガーがデタッチする理由。</li>\n</ul>\n<p>デバッグセッションが終了したときに発生します。 これは、<code>webContents</code> がクローズされるか、アタッチしていた <code>webContents</code> に対して開発者ツールが呼び出されるときに発生します。</p>\n<h4 id=\"イベント-message\"><a href=\"#イベント-message\">イベント: 'message'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>method</code> String - メソッド名。</li>\n<li><code>params</code> any - リモートデバッグプロトコルの 'parameters' 属性で定義されたイベントパラメータ。</li>\n<li><code>sessionId</code> String - アタッチされたデバッグセッションの一意な識別子で、<code>debugger.sendCommand</code> から送られる値と同じです。</li>\n</ul>\n<p>デバッグ対象で計測イベントが生じる毎に発生します。</p>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<h4 id=\"debuggerattachprotocolversion\"><a href=\"#debuggerattachprotocolversion\"><code>debugger.attach([protocolVersion])</code></a></h4>\n<ul>\n<li><code>protocolVersion</code> String (任意) - リクエストしたデバッグプロトコルのバージョン。</li>\n</ul>\n<p><code>webContents</code> にデバッガーをアタッチします。</p>\n<h4 id=\"debuggerisattached\"><a href=\"#debuggerisattached\"><code>debugger.isAttached()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - <code>webContents</code> にデバッガーがアタッチされているかどうか。</p>\n<h4 id=\"debuggerdetach\"><a href=\"#debuggerdetach\"><code>debugger.detach()</code></a></h4>\n<p><code>webContents</code> からデバッガーをデタッチします。</p>\n<h4 id=\"debuggersendcommandmethod-commandparams-sessionid\"><a href=\"#debuggersendcommandmethod-commandparams-sessionid\"><code>debugger.sendCommand(method[, commandParams, sessionId])</code></a></h4>\n<ul>\n<li><code>method</code> String - メソッド名。<a href=\"https://chromedevtools.github.io/devtools-protocol/\">リモートデバッグプロトコル</a> で定義されているメソッドのいずれかである必要があります。</li>\n<li><code>commandParams</code> any (任意) - リクエストパラメータの JSON オブジェクト。</li>\n<li><code>sessionId</code> String (任意) - デバッグセッション ID に関連付けられたターゲットにコマンドを送信します。 初期値は <a href=\"https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-attachToTarget\">Target.attachToTarget</a> メッセージを送信することで取得できます。</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;any></code> - リモートデバッグプロトコル内のコマンドの説明の 'returns' 属性で定義されたレスポンスで解決されるか、またはコマンドの失敗を示すために拒否されるプロミス。</p>\n<p>指定したコマンドをデバッグ対象に送信します。</p>",
      "title": "クラス: Debugger",
      "description": "Chromeのリモートデバッグプロトコルに対する選択肢の1つ。"
    },
    "/docs/development/debugging-instructions-macos": {
      "locale": "ja-JP",
      "slug": "debugging-instructions-macos",
      "href": "/docs/development/debugging-instructions-macos",
      "crowdinFileId": "256153",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debugging-instructions-macos.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"macos-におけるデバッグ\"><a href=\"#macos-におけるデバッグ\">macOS におけるデバッグ</a></h1>\n<p>JavaScript アプリケーションに起因しないと思われるクラッシュや問題が Electron 上で起こった場合、特にネイティブ/ C++ デバッグの経験がない開発者にとって少しトリッキーなデバッグになります。 しかし、lldb と Electron のソースコードを使用することで、Electron のソースコード内でブレークポイントを使用したステップ実行デバッグを有効にできます。 グラフィカルインタフェースを希望する場合は、<a href=\"/docs/development/debugging-instructions-macos-xcode\">Xcode におけるデバッグ</a> を使用することもできます。</p>\n<h2 id=\"要件\"><a href=\"#要件\">要件</a></h2>\n<ul>\n<li>\n<p><strong>Electronのデバッグビルド</strong>: 最も簡単な方法は、<a href=\"/docs/development/build-instructions-macos\">ビルド手順 (macOS)</a> にリストされているツールと必要な環境を使って、自分でビルドをする方法です。 Electron を直接ダウンロードしてアタッチしデバッグできますが、Electron は高度に最適化されているためデバッグが困難であることに気付くでしょう。デバッガはすべての変数の内容は表示できませんし、インラインに展開されたり、末尾再帰やその他のコンパイラによる最適化により実行経路は奇妙に見えるはずです。</p>\n</li>\n<li>\n<p><strong>Xcode</strong>: Xcode では、加えて Xcode コマンドラインツールもインストールします。 macOS の XCode には、デフォルトのデバッガの LLDB が入っています。 C、Objective-C、C++ のデバッグを、デスクトップ、iOS デバイス、シミュレータ上でサポートします。</p>\n</li>\n<li>\n<p><strong>.lldbinit</strong>: <code>~/.lldbinit</code> を以下のように作成及び編集し、Chromium コードを適切にソースマップできるようにします。</p>\n<pre><code class=\"hljs language-plaintext\"># 例: ['~/electron/src/tools/lldb']\nscript sys.path[:0] = ['&#x3C;...path/to/electron/src/tools/lldb>']\nscript import lldbinit\n</code></pre>\n</li>\n</ul>\n<h2 id=\"electronへの接続とデバッグ\"><a href=\"#electronへの接続とデバッグ\">Electronへの接続とデバッグ</a></h2>\n<p>デバッグセッションを始めるには、ターミナルを開いて Electron のリリースでないビルドを引数として渡して <code>lldb</code> を実行します。</p>\n<pre><code class=\"hljs language-sh\">$ lldb ./out/Testing/Electron.app\n(lldb) target create <span class=\"hljs-string\">\"./out/Testing/Electron.app\"</span>\nCurrent executable <span class=\"hljs-built_in\">set</span> to <span class=\"hljs-string\">'./out/Testing/Electron.app'</span> (x86_64).\n</code></pre>\n<h3 id=\"ブレークポイントの設定\"><a href=\"#ブレークポイントの設定\">ブレークポイントの設定</a></h3>\n<p>LLDBは強力なツールであり、コード検査のための複数の計画をサポートします。 この基本的な導入では、正しく動作していないコマンドを JavaScript から呼び出していると仮定しましょう。Electron ソース内に対応するコマンドの C++をブレークしたいとします。</p>\n<p>関連コードファイルは <code>./shell/</code> にあります。</p>\n<p><code>browser.cc</code> 内に <code>Browser::SetName()</code> として定義されている <code>app.setName()</code> をデバッグしたいと仮定しましょう。 <code>breakpoint</code> コマンドを用いて、以下のようにブレークするファイルと行を指定してブレークポイントを設定します。</p>\n<pre><code class=\"hljs language-sh\">(lldb) breakpoint <span class=\"hljs-built_in\">set</span> --file browser.cc --line 117\nBreakpoint 1: <span class=\"hljs-built_in\">where</span> = Electron Framework`atom::Browser::SetName(std::__1::basic_string&#x3C;char, std::__1::char_traits&#x3C;char>, std::__1::allocator&#x3C;char> > const&#x26;) + 20 at browser.cc:118, address = 0x000000000015fdb4\n</code></pre>\n<p>そして、 Electron を実行します。</p>\n<pre><code class=\"hljs language-sh\">(lldb) run\n</code></pre>\n<p>Electron は起動時にアプリの名前を設定するため、アプリはすぐに一時停止されます。</p>\n<pre><code class=\"hljs language-sh\">(lldb) run\nProcess 25244 launched: <span class=\"hljs-string\">'/Users/fr/Code/electron/out/Testing/Electron.app/Contents/MacOS/Electron'</span> (x86_64)\nProcess 25244 stopped\n* thread <span class=\"hljs-comment\">#1: tid = 0x839a4c, 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 20 at browser.cc:118, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1</span>\n    frame <span class=\"hljs-comment\">#0: 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 20 at browser.cc:118</span>\n   115  }\n   116\n   117  void Browser::SetName(const std::string&#x26; name) {\n-> 118    name_override_ = name;\n   119  }\n   120\n   121  int Browser::<span class=\"hljs-function\"><span class=\"hljs-title\">GetBadgeCount</span></span>() {\n(lldb)\n</code></pre>\n<p>現在のフレームの引数とローカル変数を表示するには、<code>frame variable</code> (または <code>fr v</code>) を実行します。アプリの名前が現在は \"Electron\" にセットされているのが表示されるでしょう。</p>\n<pre><code class=\"hljs language-sh\">(lldb) frame variable\n(atom::Browser *) this = 0x0000000108b14f20\n(const string &#x26;) name = <span class=\"hljs-string\">\"Electron\"</span>: {\n    [...]\n}\n</code></pre>\n<p>現在のスレッド内でソースレベルステップ実行するには、<code>step</code> (または <code>s</code>) を実行します。 これにより、<code>name_override_.empty()</code> に飛びます。 処理してステップオーバーするには、<code>next</code> (または <code>n</code>) を実行します。</p>\n<pre><code class=\"hljs language-sh\">(lldb) step\nProcess 25244 stopped\n* thread <span class=\"hljs-comment\">#1: tid = 0x839a4c, 0x0000000100162dcc Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 44 at browser.cc:119, queue = 'com.apple.main-thread', stop reason = step in</span>\n    frame <span class=\"hljs-comment\">#0: 0x0000000100162dcc Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 44 at browser.cc:119</span>\n   116\n   117  void Browser::SetName(const std::string&#x26; name) {\n   118    name_override_ = name;\n-> 119  }\n   120\n   121  int Browser::<span class=\"hljs-function\"><span class=\"hljs-title\">GetBadgeCount</span></span>() {\n   122    <span class=\"hljs-built_in\">return</span> badge_count_;\n</code></pre>\n<p><strong>注意:</strong> 表示しようとしてもソースコードが表示されない場合は、上記の <code>~/.lldbinit </code> ファイルを追加していない可能性があります。</p>\n<p>このポイントでのデバッグが完了したら、<code>process continue</code> を実行します。 このスレッドで特定の行がヒットするまで (<code>thread until 100</code>) 続行することもできます。 このコマンドは、このフレームの100行目に達するまで、現在のフレーム内のスレッドを実行し、現在のフレームを終了すると停止します。</p>\n<p>今、Electron の開発者ツールを開いて <code>setName</code> を呼び出すと、もう一度ブレークポイントにヒットします。</p>\n<h3 id=\"参考リンク\"><a href=\"#参考リンク\">参考リンク</a></h3>\n<p>LLDB は素晴らしいドキュメントを備えた強力なツールです。 詳細については、<a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-basics.html#//apple_ref/doc/uid/TP40012917-CH2-SW2\">LLDB コマンド構造リファレンス</a> や <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-terminal-workflow-tutorial.html\">LLDB をスタンドアロンデバッガとして使用する方法</a> などの Apple のデバッグドキュメントを参照してください。</p>\n<p>LLDB の素晴らしい <a href=\"https://lldb.llvm.org/tutorial.html\">マニュアルとチュートリアル</a> もご参考ください。さらに複雑なデバッグシナリオについて説明されています。</p>",
      "title": "macOS におけるデバッグ",
      "description": ""
    },
    "/docs/development/debugging-instructions-macos-xcode": {
      "locale": "ja-JP",
      "slug": "debugging-instructions-macos-xcode",
      "href": "/docs/development/debugging-instructions-macos-xcode",
      "crowdinFileId": "256151",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debugging-instructions-macos-xcode.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h2 id=\"xcodeでのデバッグ\"><a href=\"#xcodeでのデバッグ\">Xcodeでのデバッグ</a></h2>\n<h3 id=\"ソースデバッグ用-xcode-プロジェクトの生成-xcode-からはコードをビルドできない\"><a href=\"#ソースデバッグ用-xcode-プロジェクトの生成-xcode-からはコードをビルドできない\">ソースデバッグ用 Xcode プロジェクトの生成 (Xcode からはコードをビルドできない)</a></h3>\n<p><code>gn gen</code> に --ide=xcode 引数を加えて実行します。</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --ide=xcode\n</code></pre>\n<p>これで、electron.ninja.xcworkspace を生成します。 このワークスペースを開いて、ブレークポイントをセットしてインスペクトしなければなりません。</p>\n<p>GNでIDEプロジェクトの生成についての情報を見るには、<code>gn help gen</code>を見てください。</p>\n<h3 id=\"デバッグとブレークポイント\"><a href=\"#デバッグとブレークポイント\">デバッグとブレークポイント</a></h3>\n<p>ビルド後にElectronアプリを起動します。 上記で作成した Xcode ワークスペースを開いて、デバッグ > プロセスにアタッチ > Electron デバッグメニューから Electron プロセスにアタッチすることができます。 [注意: レンダラープロセスをデバッグする場合は、Electron Helper にもアタッチする必要があります。]</p>\n<p>インデックスファイル内のどこにでもブレークポイントを設定することができます。 ただし、Chromium ソース内でブレークポイントを直接設定することはできません。 Chromium ソース内でブレークポイントを設定するには、デバッグ > ブレークポイント > シンボリックブレークポイントの作成 を選択し、関数名をシンボルとして設定します。 これは、一つ以上クラスがある場合は、そのうちのすべてのクラスから、その名前を持つすべての関数のブレークポイントを設定します。 デバッガをアタッチする前にブレークポイントを設定する手順を実行することもできますが、シンボリックブレークポイント関数の実際のブレークポイントは、デバッガがアプリにアタッチされるまで表示されないことがあります。</p>",
      "title": "Xcodeでのデバッグ",
      "description": ""
    },
    "/docs/tutorial/debugging-main-process": {
      "locale": "ja-JP",
      "slug": "debugging-main-process",
      "href": "/docs/tutorial/debugging-main-process",
      "crowdinFileId": "256189",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/debugging-main-process.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"メインプロセスのデバッグ\"><a href=\"#メインプロセスのデバッグ\">メインプロセスのデバッグ</a></h1>\n<p>Electron ブラウザウィンドウのデベロッパー ツールは、そのウィンドウで実行されている JavaScript (例えばウェブページ) のみをデバッグできます。 メインプロセスの JavaScript をデバッグしたい場合は、Electron を <code>--inspect</code> や <code>--inspect-brk</code> フラグで起動し、外部デバッガを使用する必要があります。</p>\n<h2 id=\"コマンドラインオプション\"><a href=\"#コマンドラインオプション\">コマンドラインオプション</a></h2>\n<p>Electron のメインプロセスをデバッグするためには、以下のコマンドラインスイッチを使用します。</p>\n<h3 id=\"--inspectport\"><a href=\"#--inspectport\"><code>--inspect=[port]</code></a></h3>\n<p>Electron は、指定された <code>port</code> で V8 インスペクタープロトコルのメッセージを受け取ります。外部デバッガはこのポートに接続する必要があります。 デフォルトの <code>port</code> は <code>5858</code> です。</p>\n<pre><code class=\"hljs language-shell\">electron --inspect=5858 your/app\n</code></pre>\n<h3 id=\"--inspect-brkport\"><a href=\"#--inspect-brkport\"><code>--inspect-brk=[port]</code></a></h3>\n<p><code>--inspect</code> と同様ですが、最初の行でスクリプトを中断します。</p>\n<h2 id=\"外部デバッガ\"><a href=\"#外部デバッガ\">外部デバッガ</a></h2>\n<p>V8 インスペクタープロトコルをサポートするデバッガを使用する必要があります。</p>\n<ul>\n<li><code>chrome://inspect</code> を開いて Chrome に接続し、起動した Electron アプリのインスペクトをそこから選択します。</li>\n<li><a href=\"/docs/tutorial/debugging-vscode\">VS Code でデバッグする</a></li>\n</ul>",
      "title": "メインプロセスのデバッグ",
      "description": ""
    },
    "/docs/tutorial/debugging-vscode": {
      "locale": "ja-JP",
      "slug": "debugging-vscode",
      "href": "/docs/tutorial/debugging-vscode",
      "crowdinFileId": "256191",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/debugging-vscode.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"vs-code-でデバッグする\"><a href=\"#vs-code-でデバッグする\">VS Code でデバッグする</a></h1>\n<p>このガイドでは、自作の Electron プロジェクトとネイティブの Electron コードベース両方の VSCode デバッグを設定する方法について説明します。</p>\n<h2 id=\"electron-アプリをデバッグする\"><a href=\"#electron-アプリをデバッグする\">Electron アプリをデバッグする</a></h2>\n<h3 id=\"メインプロセス\"><a href=\"#メインプロセス\">メインプロセス</a></h3>\n<h4 id=\"1-vs-code-で-electron-プロジェクトを開く\"><a href=\"#1-vs-code-で-electron-プロジェクトを開く\">1. VS Code で Electron プロジェクトを開く</a></h4>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:electron/electron-quick-start.git\n$ code electron-quick-start\n</code></pre>\n<h4 id=\"2-以下の構成の-vscodelaunchjson-ファイルを追加する\"><a href=\"#2-以下の構成の-vscodelaunchjson-ファイルを追加する\">2. 以下の構成の <code>.vscode/launch.json</code> ファイルを追加する</a></h4>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.2.0\"</span>,\n  <span class=\"hljs-attr\">\"configurations\"</span>: [\n    {\n      <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"Debug Main Process\"</span>,\n      <span class=\"hljs-attr\">\"type\"</span>: <span class=\"hljs-string\">\"node\"</span>,\n      <span class=\"hljs-attr\">\"request\"</span>: <span class=\"hljs-string\">\"launch\"</span>,\n      <span class=\"hljs-attr\">\"cwd\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      <span class=\"hljs-attr\">\"runtimeExecutable\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}/node_modules/.bin/electron\"</span>,\n      <span class=\"hljs-attr\">\"windows\"</span>: {\n        <span class=\"hljs-attr\">\"runtimeExecutable\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}/node_modules/.bin/electron.cmd\"</span>\n      },\n      <span class=\"hljs-attr\">\"args\"</span> : [<span class=\"hljs-string\">\".\"</span>],\n      <span class=\"hljs-attr\">\"outputCapture\"</span>: <span class=\"hljs-string\">\"std\"</span>\n    }\n  ]\n}\n</code></pre>\n<h4 id=\"3-デバッグする\"><a href=\"#3-デバッグする\">3. デバッグする</a></h4>\n<p><code>main.js</code> にいくつかブレークポイントを設定し 、<a href=\"https://code.visualstudio.com/docs/editor/debugging\">デバッグ ビュー</a> からデバッグを開始します。 このとき設定したブレークポイントにヒットするはずです。</p>\n<p>ここではダウンロードして直接 VSCode 内でデバッグできる構成済みのプロジェクトを用意しています: <a href=\"https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start\">https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start</a></p>\n<h2 id=\"electron-コードベースをデバッグする\"><a href=\"#electron-コードベースをデバッグする\">Electron コードベースをデバッグする</a></h2>\n<p>ソースから Electron をビルドしてネイティブの Electron コードベースを変更したい場合は、このセクションを参照してください。</p>\n<p>このコードの入手方法やビルド方法がわからない方のために、<a href=\"https://github.com/electron/build-tools\">Electron のビルドツール</a> がこのプロセスのほとんどを自動化して説明します。 手動で環境を設定したい場合は、代わりに以下の <a href=\"/docs/development/build-instructions-gn\">ビルド手順</a> も使用できます。</p>\n<h3 id=\"windows-c\"><a href=\"#windows-c\">Windows (C++)</a></h3>\n<h4 id=\"1-vs-code-で-electron-プロジェクトを開く-1\"><a href=\"#1-vs-code-で-electron-プロジェクトを開く-1\">1. VS Code で Electron プロジェクトを開く</a></h4>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:electron/electron-quick-start.git\n$ code electron-quick-start\n</code></pre>\n<h4 id=\"2-以下の構成の-vscodelaunchjson-ファイルを追加する-1\"><a href=\"#2-以下の構成の-vscodelaunchjson-ファイルを追加する-1\">2. 以下の構成の <code>.vscode/launch.json</code> ファイルを追加する</a></h4>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.2.0\"</span>,\n  <span class=\"hljs-attr\">\"configurations\"</span>: [\n    {\n      <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"(Windows) Launch\"</span>,\n      <span class=\"hljs-attr\">\"type\"</span>: <span class=\"hljs-string\">\"cppvsdbg\"</span>,\n      <span class=\"hljs-attr\">\"request\"</span>: <span class=\"hljs-string\">\"launch\"</span>,\n      <span class=\"hljs-attr\">\"program\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\\\\out\\\\your-executable-location\\\\electron.exe\"</span>,\n      <span class=\"hljs-attr\">\"args\"</span>: [<span class=\"hljs-string\">\"your-electron-project-path\"</span>],\n      <span class=\"hljs-attr\">\"stopAtEntry\"</span>: <span class=\"hljs-literal\">false</span>,\n      <span class=\"hljs-attr\">\"cwd\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      <span class=\"hljs-attr\">\"environment\"</span>: [\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_ENABLE_LOGGING\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"true\"</span>},\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_ENABLE_STACK_DUMPING\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"true\"</span>},\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_RUN_AS_NODE\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"\"</span>},\n      ],\n      <span class=\"hljs-attr\">\"externalConsole\"</span>: <span class=\"hljs-literal\">false</span>,\n      <span class=\"hljs-attr\">\"sourceFileMap\"</span>: {\n          <span class=\"hljs-attr\">\"o:\\\\\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      },\n    },\n  ]\n}\n</code></pre>\n<p><strong>設定メモ</strong></p>\n<ul>\n<li><code>cppvsdbg</code> は <a href=\"https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools\">組み込み C/C++ 拡張</a> が有効である必要があります。</li>\n<li><code>${workspaceFolder}</code> Chromium の <code>src</code> ディレクトリのフルパスです。</li>\n<li><code>your-executable-location</code> はいくつかの項目に応じて以下のいずれかになります。<ul>\n<li><code>Testing</code>: <a href=\"https://github.com/electron/build-tools\">Electron のビルドツール</a> のデフォルト設定や、<a href=\"/docs/development/build-instructions-gn#building\">ソースからビルド</a> でのデフォルト指定を使用している場合。</li>\n<li><code>Release</code>: Testing ビルドではなく Release ビルドで構築した場合。</li>\n<li><code>your-directory-name</code>: ビルド処理中にこれをデフォルトから変更した場合は、指定したものがそのまま適用されます。</li>\n</ul></li>\n<li><code>args</code> 配列文字列内の <code>\"your-electron-project-path\"</code> は、テストに用する Electron プロジェクトのディレクトリまたは <code>main.js</code> ファイルへの絶対パスでなければなりません。 このサンプルでは、 <code>electron-quick-start</code> へのパスである必要があります。</li>\n</ul>\n<h4 id=\"3-デバッグする-1\"><a href=\"#3-デバッグする-1\">3. デバッグする</a></h4>\n<p>ネイティブの Electron C++ コード内の任意の .cc ファイルにブレークポイントを設定し、<a href=\"https://code.visualstudio.com/docs/editor/debugging\">デバッグビュー</a> でデバッグを開始しましょう。</p>",
      "title": "VS Code でデバッグする",
      "description": ""
    },
    "/docs/api/desktop-capturer": {
      "locale": "ja-JP",
      "slug": "desktop-capturer",
      "href": "/docs/api/desktop-capturer",
      "crowdinFileId": "256307",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/desktop-capturer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktopcapturer\"><a href=\"#desktopcapturer\">desktopCapturer</a></h1>\n<blockquote>\n<p><a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> APIを使用して、デスクトップからの音声と映像のキャプチャに利用できるメディアソース関連の情報にアクセスします。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a>, <a href=\"/docs/glossary#renderer-process\">レンダラー</a></p>\n<p>以下の例では、タイトルが <code>Electron</code> であるデスクトップウインドウからビデオをキャプチャする方法を示します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// レンダラープロセス</span>\n<span class=\"hljs-keyword\">const</span> { desktopCapturer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ndesktopCapturer.getSources({ <span class=\"hljs-attr\">types</span>: [<span class=\"hljs-string\">'window'</span>, <span class=\"hljs-string\">'screen'</span>] }).then(<span class=\"hljs-keyword\">async</span> sources => {\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> source <span class=\"hljs-keyword\">of</span> sources) {\n    <span class=\"hljs-keyword\">if</span> (source.name === <span class=\"hljs-string\">'Electron'</span>) {\n      <span class=\"hljs-keyword\">try</span> {\n        <span class=\"hljs-keyword\">const</span> stream = <span class=\"hljs-keyword\">await</span> navigator.mediaDevices.getUserMedia({\n          <span class=\"hljs-attr\">audio</span>: <span class=\"hljs-literal\">false</span>,\n          <span class=\"hljs-attr\">video</span>: {\n            <span class=\"hljs-attr\">mandatory</span>: {\n              <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>,\n              <span class=\"hljs-attr\">chromeMediaSourceId</span>: source.id,\n              <span class=\"hljs-attr\">minWidth</span>: <span class=\"hljs-number\">1280</span>,\n              <span class=\"hljs-attr\">maxWidth</span>: <span class=\"hljs-number\">1280</span>,\n              <span class=\"hljs-attr\">minHeight</span>: <span class=\"hljs-number\">720</span>,\n              <span class=\"hljs-attr\">maxHeight</span>: <span class=\"hljs-number\">720</span>\n            }\n          }\n        })\n        handleStream(stream)\n      } <span class=\"hljs-keyword\">catch</span> (e) {\n        handleError(e)\n      }\n      <span class=\"hljs-keyword\">return</span>\n    }\n  }\n})\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleStream</span> (<span class=\"hljs-params\">stream</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> video = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'video'</span>)\n  video.srcObject = stream\n  video.onloadedmetadata = <span class=\"hljs-function\">(<span class=\"hljs-params\">e</span>) =></span> video.play()\n}\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleError</span> (<span class=\"hljs-params\">e</span>) </span>{\n  <span class=\"hljs-built_in\">console</span>.log(e)\n}\n</code></pre>\n<p><code>desktopCapturer</code> が提供するソースから映像をキャプチャするには、<a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> に渡す制約に、<code>chromeMediaSource: 'desktop'</code> と <code>audio: false</code> を含める必要があります。</p>\n<p>デスクトップ全体から音声と映像の両方をキャプチャするには、<a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> に渡す制約に、<code>audio</code> と <code>video</code> の両方に対して <code>chromeMediaSource: 'desktop'</code> を含める必要がありますが、<code>chromeMediaSourceId</code> 制約は不要です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> constraints = {\n  <span class=\"hljs-attr\">audio</span>: {\n    <span class=\"hljs-attr\">mandatory</span>: {\n      <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>\n    }\n  },\n  <span class=\"hljs-attr\">video</span>: {\n    <span class=\"hljs-attr\">mandatory</span>: {\n      <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>\n    }\n  }\n}\n</code></pre>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>desktopCapturer</code> モジュールには以下のメソッドがあります。</p>\n<h3 id=\"desktopcapturergetsourcesoptions\"><a href=\"#desktopcapturergetsourcesoptions\"><code>desktopCapturer.getSources(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>types</code> String[] - キャプチャされるデスクトップソースの種別を列挙した文字列の配列。指定できる種別は、<code>screen</code> と <code>window</code> です。</li>\n<li><code>thumbnailSize</code> <a href=\"/docs/api/structures/size\">Size</a> (任意) - メディアソースのサムネイルを拡大縮小するサイズ。 省略値は <code>150</code> x <code>150</code> です。 サムネイルが不要な場合は、幅または高さを 0 に設定してください。 これにより、各ウィンドウおよび画面のコンテンツをキャプチャするために必要な処理時間が節約されます。</li>\n<li><code>fetchWindowIcons</code> Boolean (任意) - ウィンドウアイコンの取得を有効にするには true に設定します。 デフォルト値は false です。 false の場合、ソースの appIcon プロパティは null を返します。 ソースが screen 型の場合も同様です。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;DesktopCapturerSource[]></code> - <a href=\"/docs/api/structures/desktop-capturer-source\"><code>DesktopCapturerSource</code></a> オブジェクトの配列を使用して解決します。各 <code>DesktopCapturerSource</code> は、キャプチャできる画面または個々のウィンドウを表します。</p>\n<p><strong>注釈</strong> 画面コンテンツをキャプチャするには、macOS 10.15 Catalina 以降でのユーザーの同意が必要です。同意しているかどうかは <a href=\"/docs/api/system-preferences#systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><code>systemPreferences.getMediaAccessStatus</code></a>で検知できます。</p>\n<h2 id=\"caveats\"><a href=\"#caveats\">Caveats</a></h2>\n<p><code>navigator.mediaDevices.getUserMedia</code> はシステムのオーディオにアクセスしたいアプリが<a href=\"https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/KernelExtensions/KernelExtensions.html\">署名付きカーネル拡張</a>を必要とするという基本的な制限のため、macOS ではオーディオキャプチャが動作しません。 Chrome、ひいては Electron はこれを提供していません。</p>\n<p>Soundflower のような他の macOS アプリでシステムオーディオをキャプチャし、それを仮想オーディオ入力デバイスに渡すことでこの制限を回避することが可能です。 この仮想デバイスは、 <code>navigator.mediaDevices.getUserMedia</code>.を使用して照会できます。</p>",
      "title": "desktopCapturer",
      "description": "navigator.mediaDevices.getUserMedia APIを使用して、デスクトップからの音声と映像のキャプチャに利用できるメディアソース関連の情報にアクセスします。"
    },
    "/docs/api/structures/desktop-capturer-source": {
      "locale": "ja-JP",
      "slug": "desktop-capturer-source",
      "href": "/docs/api/structures/desktop-capturer-source",
      "crowdinFileId": "256425",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/desktop-capturer-source.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktopcapturersource-object\"><a href=\"#desktopcapturersource-object\">DesktopCapturerSource Object</a></h1>\n<ul>\n<li><code>id</code> String - The identifier of a window or screen that can be used as a <code>chromeMediaSourceId</code> constraint when calling [<code>navigator.webkitGetUserMedia</code>]. The format of the identifier will be <code>window:XX:YY</code> or <code>screen:ZZ:0</code>. XX is the windowID/handle. YY is 1 for the current process, and 0 for all others. ZZ is a sequential number that represents the screen, and it does not equal to the index in the source's name.</li>\n<li><code>name</code> String - A screen source will be named either <code>Entire Screen</code> or <code>Screen &#x3C;index></code>, while the name of a window source will match the window title.</li>\n<li><code>thumbnail</code> <a href=\"/docs/api/native-image\">NativeImage</a> - A thumbnail image. <strong>Note:</strong> There is no guarantee that the size of the thumbnail is the same as the <code>thumbnailSize</code> specified in the <code>options</code> passed to <code>desktopCapturer.getSources</code>. The actual size depends on the scale of the screen or window.</li>\n<li><code>display_id</code> String - A unique identifier that will correspond to the <code>id</code> of the matching <a href=\"/docs/api/structures/display\">Display</a> returned by the <a href=\"/docs/api/screen\">Screen API</a>. On some platforms, this is equivalent to the <code>XX</code> portion of the <code>id</code> field above and on others it will differ. It will be an empty string if not available.</li>\n<li><code>appIcon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - An icon image of the application that owns the window or null if the source has a type screen. The size of the icon is not known in advance and depends on what the application provides.</li>\n</ul>",
      "title": "DesktopCapturerSource Object",
      "description": ""
    },
    "/docs/tutorial/devices": {
      "locale": "ja-JP",
      "slug": "devices",
      "href": "/docs/tutorial/devices",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/devices.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"デバイスアクセス\"><a href=\"#デバイスアクセス\">デバイスアクセス</a></h1>\n<p>Chromium ベースのブラウザのように、Electron はウェブ API を介してデバイスハードウェアへのアクセスを提供します。  ほとんどの場合これらの API はブラウザと同じように動作しますが、いくつかの違いを考慮しなければなりません。  Electronとブラウザの主な違いは、デバイスアクセスが要求されたときに起きることです。  ブラウザでは、ユーザーにポップアップが表示され、ユーザーは個々のデバイスにアクセスを許可できます。  Electron API では、デバイスを自動選択したり開発者が作成したインターフェースを介してユーザーにデバイス選択を促したりするために、開発者が利用できる API を提供しています。</p>\n<h2 id=\"ウェブ-bluetooth-api\"><a href=\"#ウェブ-bluetooth-api\">ウェブ Bluetooth API</a></h2>\n<p><a href=\"https://web.dev/bluetooth/\">ウェブ Bluetooth API</a> は、Bluetooth デバイスとの通信に利用できます。 この API を Electron で使用するには、開発者がデバイスリクエストに関連する<a href=\"/docs/tutorial/.../api/web-contents#event-select-bluetooth-device\">webContents の <code>select-bluetooth-device</code> イベント</a> をハンドリングする必要があります。</p>\n<h3 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h3>\n<p>この例では、<code>Test Bluetooth</code> ボタンがクリックされたときに最初に利用可能な Bluetooth デバイスを自動的に選択する、Electron のアプリケーションを示しています。</p>\n<h2 id=\"webhid-api\"><a href=\"#webhid-api\">WebHID API</a></h2>\n<p><a href=\"https://web.dev/hid/\">WebHID API</a> は、キーボードやゲームパッドなどの HID デバイスのアクセスに利用できます。  Electron は、WebHID API と連携するためにいくつかの API を提供しています。</p>\n<ul>\n<li><a href=\"/docs/tutorial/.../api/session#event-select-hid-device\">Session の <code>select-hid-device</code> イベント</a> は、<code>navigator.hid.requestDevice</code> が呼び出された時に HID デバイスを選択するために利用できます。  さらに、Session の <a href=\"/docs/tutorial/.../api/session#event-hid-device-added\"><code>hid-device-added</code></a> および <a href=\"/docs/tutorial/.../api/session#event-hid-device-removed\"><code>hid-device-removed</code></a> イベントは、<code>navigator.hid.requestDevice</code> の処理中におけるデバイスの接続や除去の処理に利用できます。</li>\n<li><a href=\"/docs/tutorial/.../api/session#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a> は、先に <code>navigator.hid.requestDevice</code> を介して許可の呼び出しをせずとも、デバイスへのデフォルトの権限を提供するために利用できます。  また、Electron のデフォルトの動作では、付与されたデバイスの権限を対応する WebContents が有効の間だけ保存します。  より長期間の保存が必要な場合、開発者は付与されたデバイスのパーミッションを保存し (<code>select-hid-device</code> イベントを処理するときなど)、<code>setDevicePermissionHandler</code> でそのストレージから読み出しできます。</li>\n<li><a href=\"/docs/tutorial/.../api/session#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a> を使うと、特定オリジンの HID アクセスを無効にできます。</li>\n</ul>\n<h3 id=\"ブロックリスト\"><a href=\"#ブロックリスト\">ブロックリスト</a></h3>\n<p>デフォルトでは、Electron は Chromium が使用する <a href=\"https://github.com/WICG/webhid/blob/main/blocklist.txt\">ブロックリスト</a> と同じものを採用しています。  この動作を無効にしたい場合は、以下のように <code>disable-hid-blocklist</code> フラグで設定できます。</p>\n<pre><code class=\"hljs language-javascript\">app.commandLine.appendSwitch(<span class=\"hljs-string\">'disable-hid-blocklist'</span>)\n</code></pre>\n<h3 id=\"サンプル-1\"><a href=\"#サンプル-1\">サンプル</a></h3>\n<p>この例では、<a href=\"/docs/tutorial/.../api/session#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a> を通じて HID デバイスを自動選択する Electron アプリケーションを示しています。<code>Test WebHID</code> ボタンがクリックされると、<a href=\"/docs/api/session#event-select-hid-device\">Session の <code>select-hid-device</code></a> イベントを通じて HID デバイスを自動選択します。</p>\n<h2 id=\"web-シリアル-api\"><a href=\"#web-シリアル-api\">Web シリアル API</a></h2>\n<p><a href=\"https://web.dev/serial/\">Web シリアル API</a> を使用すると、シリアルポートや USB、Bluetooth で接続されたシリアルデバイスにアクセスできます。  この API を Electron で使用には、開発者がシリアルポートのリクエストに関する <a href=\"/docs/tutorial/.../api/session#event-select-serial-port\">Session の <code>select-serial-port</code> イベント</a> をハンドリングする必要があります。</p>\n<p>Web シリアル API の利用にあたって更にいくつかの API があります。</p>\n<ul>\n<li>Session の <a href=\"/docs/api/session#event-serial-port-added\"><code>serial-port-added</code></a> と <a href=\"/docs/api/session#event-serial-port-removed\"><code>serial-port-removed</code></a> イベントは、<code>navigator.serial.requestPort</code> の処理中におけるデバイスの接続や除去のハンドリングに使用できます。</li>\n<li><a href=\"/docs/tutorial/.../api/session#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a> を使うと、特定オリジンのシリアルアクセスを無効にできます。</li>\n</ul>\n<h3 id=\"サンプル-2\"><a href=\"#サンプル-2\">サンプル</a></h3>\n<p>この例で示している Electron アプリケーションは、<code>Test Web Serial</code> ボタンがクリックされたときに、<a href=\"/docs/api/session#event-select-serial-port\">Session の <code>select-serial-port</code> イベント</a> を通して最初に利用可能な Arduino Uno シリアルデバイスを (接続されている場合は) 自動選択します。</p>",
      "title": "デバイスアクセス",
      "description": ""
    },
    "/docs/tutorial/devtools-extension": {
      "locale": "ja-JP",
      "slug": "devtools-extension",
      "href": "/docs/tutorial/devtools-extension",
      "crowdinFileId": "256195",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/devtools-extension.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"devtools-エクステンション\"><a href=\"#devtools-エクステンション\">DevTools エクステンション</a></h1>\n<p>Electron は <a href=\"https://developer.chrome.com/extensions/devtools\">Chrome デベロッパー ツール拡張</a> をサポートしています。これは人気ウェブフレームワークのデバッグ向けに Chrome デベロッパー ツールを拡張できます。</p>\n<h2 id=\"ツールを使ったデベロッパー-ツール拡張の読み込み\"><a href=\"#ツールを使ったデベロッパー-ツール拡張の読み込み\">ツールを使ったデベロッパー ツール拡張の読み込み</a></h2>\n<p>デベロッパー ツール拡張を読み込む最も簡単な方法は、サードパーティ製ツールで手順を自動化することです。 <a href=\"https://github.com/MarshallOfSound/electron-devtools-installer\">electron-devtools-installer</a> はこれを行うにあたって人気の NPM パッケージです。</p>\n<h2 id=\"手動でのデベロッパー-ツール拡張の読み込み\"><a href=\"#手動でのデベロッパー-ツール拡張の読み込み\">手動でのデベロッパー ツール拡張の読み込み</a></h2>\n<p>ツールを使う手段をお望みでない場合は、必要な作業すべてを手で行うこともできます。 Electron で拡張機能を読み込むには、Chrome でそれをダウンロードして、そのファイルシステムのパスを探し、[<code>ses.loadExtension</code>] API を呼び出して <a href=\"/docs/api/session\">Session</a> にロードします。</p>\n<p>以下は <a href=\"https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi\">React Developer Tools</a> を使用する例です。</p>\n<ol>\n<li>\n<p>Google Chrome で拡張機能をインストールします。</p>\n</li>\n<li>\n<p><code>chrome://extensions</code> に移動し、<code>fmkadmapgofadopljbjfkapdkoienihi</code> のようなハッシュ文字列であるそれの拡張 ID を探します。</p>\n</li>\n<li>\n<p>Chrome が拡張機能の保存に使用している、ファイルシステムの場所を調べます。</p>\n<ul>\n<li>Windows では <code>%LOCALAPPDATA%\\Google\\Chrome\\User Data\\Default\\Extensions</code> です。</li>\n<li>Linux では以下のいずれかになります。<ul>\n<li><code>~/.config/google-chrome/Default/Extensions/</code></li>\n<li><code>~/.config/google-chrome-beta/Default/Extensions/</code></li>\n<li><code>~/.config/google-chrome-canary/Default/Extensions/</code></li>\n<li><code>~/.config/chromium/Default/Extensions/</code></li>\n</ul></li>\n<li>macOS では <code>~/Library/Application Support/Google/Chrome/Default/Extensions</code> になります。</li>\n</ul>\n</li>\n<li>\n<p>拡張機能の場所を<a href=\"/docs/api/session#sesloadextensionpath-options\"><code>ses.loadExtension</code></a> API に渡します。 React Developer Tools <code>v4.9.0</code> の場合、以下のようになります。</p>\n<pre><code class=\"hljs language-javascript\"> <span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n <span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n\n <span class=\"hljs-comment\">// macOS の場合</span>\n <span class=\"hljs-keyword\">const</span> reactDevToolsPath = path.join(\n   os.homedir(),\n   <span class=\"hljs-string\">'/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/4.9.0_0'</span>\n )\n\n app.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n   <span class=\"hljs-keyword\">await</span> session.defaultSession.loadExtension(reactDevToolsPath)\n })\n</code></pre>\n</li>\n</ol>\n<p><strong>注釈:</strong></p>\n<ul>\n<li><code>loadExtension</code> は <a href=\"/docs/api/structures/extension\">Extension オブジェクト</a> の Promise を返します。これには、読み込まれた拡張機能についてのメタデータが含まれます。 この Promise はページ読み込み前に (<code>await</code> 式などで) 解決する必要があります。 さもなくば、拡張の読み込みは保証されません。</li>\n<li><code>loadExtension</code> は、<code>app</code> モジュールの <code>ready</code>イベントが発生する前には呼び出せず、インメモリ (非永続) セッションでも呼び出せません。</li>\n<li>拡張機能を読み込みたい場合は、アプリを起動するたびに <code>loadExtension</code> を呼び出す必要があります。</li>\n</ul>\n<h3 id=\"デベロッパー-ツール拡張の除去\"><a href=\"#デベロッパー-ツール拡張の除去\">デベロッパー ツール拡張の除去</a></h3>\n<p>拡張の ID を <a href=\"/docs/api/session#sesremoveextensionextensionid\"><code>ses.removeExtension</code></a> API に渡すことで、Session から拡張を削除できます。 これにより、読み込んだ拡張がアプリの次回起動時にも保持されることはなくなります。</p>\n<h2 id=\"デベロッパー-ツール拡張サポート\"><a href=\"#デベロッパー-ツール拡張サポート\">デベロッパー ツール拡張サポート</a></h2>\n<p>Electron は <a href=\"/docs/api/extensions\"><code>chrome.*</code> API のうち限られたいくつか</a> のみをサポートしています。未サポートの <code>chrome.*</code> API を使用した拡張機能は動作しない可能性があります。</p>\n<p>以下のデベロッパー ツール拡張は Electron での動作がテストされています。</p>\n<ul>\n<li><a href=\"https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi\">Ember Inspector</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi\">React Developer Tools</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/backbone-debugger/bhljhndlimiafopmmhjlgfpnnchjjbhd\">Backbone Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/jquery-debugger/dbhhnnnpaeobfddmlalhnehgclcmjimi\">jQuery Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/angularjs-batarang/ighdmehidhipcmcojjgiloacoafjmpfk\">AngularJS Batarang</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd\">Vue.js devtools</a></li>\n<li><a href=\"https://cerebraljs.com/docs/introduction/devtools.html\">Cerebral Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd\">Redux DevTools Extension</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/mobx-developer-tools/pfgnfdagidkfgccljigdamigbcnndkod\">MobX Developer Tools</a></li>\n</ul>\n<h3 id=\"デベロッパー-ツール拡張が動作しない場合はどうすればいいですか\"><a href=\"#デベロッパー-ツール拡張が動作しない場合はどうすればいいですか\">デベロッパー ツール拡張が動作しない場合はどうすればいいですか?</a></h3>\n<p>まず、拡張がメンテナンスされていて、最新の Google Chrome と互換性があるかどうかを確認してください。 未サポートの拡張については、さらなるサポートを提供できません。</p>\n<p>拡張機能が Chrome で動作しているのに Electron で動作しない場合は、Electron の <a href=\"https://github.com/electron/electron/issues\">Issue トラッカー</a> にバグ報告し、拡張機能のどの部分が期待通りに動作しないかをご説明ください。</p>",
      "title": "DevTools エクステンション",
      "description": ""
    },
    "/docs/api/dialog": {
      "locale": "ja-JP",
      "slug": "dialog",
      "href": "/docs/api/dialog",
      "crowdinFileId": "256309",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/dialog.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dialog\"><a href=\"#dialog\">dialog</a></h1>\n<blockquote>\n<p>ファイルを開いたり、保存したり、アラートを出したりするために、ネイティブのシステムダイアログを表示します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>以下は複数のファイルを選択する dialog を表示する例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(dialog.showOpenDialog({ <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'multiSelections'</span>] }))\n</code></pre>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>dialog</code> モジュールには以下のメソッドがあります。</p>\n<h3 id=\"dialogshowopendialogsyncbrowserwindow-options\"><a href=\"#dialogshowopendialogsyncbrowserwindow-options\"><code>dialog.showOpenDialogSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (任意)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> String (任意)</li>\n<li><code>defaultPath</code> String (任意)</li>\n<li><code>buttonLabel</code> String (任意) - 確認ボタンのカスタムラベル。空のままにすると、既定のラベルが使用されます。</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (任意)</li>\n<li><code>properties</code> String[] (任意) - ダイアログが使うべきでない機能が入ります。 以下の値がサポートされています:<ul>\n<li><code>openFile</code> - ファイルを選択するのを許可します。</li>\n<li><code>openDirectory</code> - ディレクトリを選択するのを許可します。</li>\n<li><code>multiSelections</code> - 複数のパスを選択するのを許可します。</li>\n<li><code>showHiddenFiles</code> - ダイアログで隠しファイルを表示します。</li>\n<li><code>createDirectory</code> <em>macOS</em> - ダイアログでディレクトリを作成するのを許可します。</li>\n<li><code>promptToCreate</code> <em>Windows</em> - ダイアログで存在しないファイルパスを入力した場合に、作成を促します。 これは実際にパスにファイルを作成しませんが、アプリケーションによって作成される必要がある存在しないパスが返されることを許可します。</li>\n<li><code>noResolveAliases</code> <em>macOS</em> - 自動的なエイリアス (シンボリックリンク) によるパス解決を無効にします。 選択されたエイリアスは、ターゲットパスの代わりにエイリアスパスを返します。</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - <code>.app</code> フォルダのようなパッケージを、ファイルの代わりにディレクトリとして扱います。</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - 開いているアイテムを最近開いたドキュメントリストに追加しないようにします。</li>\n</ul></li>\n<li><code>message</code> String (任意) <em>macOS</em> - 入力ボックスの上に表示するメッセージ。</li>\n<li><code>securityScopedBookmarks</code> Boolean (任意) <em>macOS</em> <em>mas</em> - Mac App Store 向けにパッケージしたときに <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">セキュリティスコープ付きブックマーク</a> を作成します。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>String[] | undefined</code> - ユーザが選択したファイルパス。dialog がキャンセルされた場合は <code>undefined</code> を返します。</p>\n<p><code>browserWindow</code> の引数で、ダイアログは親ウインドウにアタッチされ、モーダル表示になります。</p>\n<p>特定の種類だけにユーザーを制限したいとき、<code>filters</code> には、表示または選択できるファイルの種類の配列を指定します。 以下がその例です。</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">filters</span>: [\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Images'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'jpg'</span>, <span class=\"hljs-string\">'png'</span>, <span class=\"hljs-string\">'gif'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Movies'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'mkv'</span>, <span class=\"hljs-string\">'avi'</span>, <span class=\"hljs-string\">'mp4'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Custom File Type'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'as'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'All Files'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'*'</span>] }\n  ]\n}\n</code></pre>\n<p><code>extensions</code> の配列には、ワイルドカードやドットを含む拡張子 (例えば、<code>'png'</code> は問題ありませんが、<code>'.png'</code> や <code>'*.png'</code> はいけません) を入れないで下さい。 すべてのファイルを表示するには、<code>'*'</code> ワイルドカードを使用して下さい (その他のワイルドカードはサポートされていません)。</p>\n<p><strong>注:</strong> WindowsとLinuxのオープンダイアログでは、ファイルとディレクトリの両方を選択することはできません。そのため、これらのプラットフォームで <code>properties</code> に <code>['openFile', 'openDirectory']</code> を設定すると、ディレクトリの選択が表示されます。</p>\n<pre><code class=\"hljs language-js\">dialog.showOpenDialogSync(mainWindow, {\n  <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'openDirectory'</span>]\n})\n</code></pre>\n<h3 id=\"dialogshowopendialogbrowserwindow-options\"><a href=\"#dialogshowopendialogbrowserwindow-options\"><code>dialog.showOpenDialog([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (任意)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> String (任意)</li>\n<li><code>defaultPath</code> String (任意)</li>\n<li><code>buttonLabel</code> String (任意) - 確認ボタンのカスタムラベル。空のままにすると、既定のラベルが使用されます。</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (任意)</li>\n<li><code>properties</code> String[] (任意) - ダイアログが使うべきでない機能が入ります。 以下の値がサポートされています:<ul>\n<li><code>openFile</code> - ファイルを選択するのを許可します。</li>\n<li><code>openDirectory</code> - ディレクトリを選択するのを許可します。</li>\n<li><code>multiSelections</code> - 複数のパスを選択するのを許可します。</li>\n<li><code>showHiddenFiles</code> - ダイアログで隠しファイルを表示します。</li>\n<li><code>createDirectory</code> <em>macOS</em> - ダイアログでディレクトリを作成するのを許可します。</li>\n<li><code>promptToCreate</code> <em>Windows</em> - ダイアログで存在しないファイルパスを入力した場合に、作成を促します。 これは実際にパスにファイルを作成しませんが、アプリケーションによって作成される必要がある存在しないパスが返されることを許可します。</li>\n<li><code>noResolveAliases</code> <em>macOS</em> - 自動的なエイリアス (シンボリックリンク) によるパス解決を無効にします。 選択されたエイリアスは、ターゲットパスの代わりにエイリアスパスを返します。</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - <code>.app</code> フォルダのようなパッケージを、ファイルの代わりにディレクトリとして扱います。</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - 開いているアイテムを最近開いたドキュメントリストに追加しないようにします。</li>\n</ul></li>\n<li><code>message</code> String (任意) <em>macOS</em> - 入力ボックスの上に表示するメッセージ。</li>\n<li><code>securityScopedBookmarks</code> Boolean (任意) <em>macOS</em> <em>mas</em> - Mac App Store 向けにパッケージしたときに <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">セキュリティスコープ付きブックマーク</a> を作成します。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;Object></code> - 以下を含むオブジェクトで実行されます。</p>\n<ul>\n<li><code>canceled</code> Boolean - dialog がキャンセルされたかそうでないか。</li>\n<li><code>filePaths</code> String[] - ユーザーによって選択されたファイルパスの配列. ダイアログがキャンセルされた場合、これは空の配列になります。</li>\n<li><code>bookmarks</code> String[] (任意)<em>macOS</em> <em>mas</em> - セキュリティスコープ付きブックマークを含む base64 エンコードされた <code>filePaths</code> 配列にマッチする配列。 データを取り込むために <code>securityScopedBookmarks</code> を有効にする必要があります。 (戻り値については、<a href=\"#bookmarks-array\">この表</a> を参照してください。)</li>\n</ul>\n<p><code>browserWindow</code> の引数で、ダイアログは親ウインドウにアタッチされ、モーダル表示になります。</p>\n<p>特定の種類だけにユーザーを制限したいとき、<code>filters</code> には、表示または選択できるファイルの種類の配列を指定します。 以下がその例です。</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">filters</span>: [\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Images'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'jpg'</span>, <span class=\"hljs-string\">'png'</span>, <span class=\"hljs-string\">'gif'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Movies'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'mkv'</span>, <span class=\"hljs-string\">'avi'</span>, <span class=\"hljs-string\">'mp4'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Custom File Type'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'as'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'All Files'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'*'</span>] }\n  ]\n}\n</code></pre>\n<p><code>extensions</code> の配列には、ワイルドカードやドットを含む拡張子 (例えば、<code>'png'</code> は問題ありませんが、<code>'.png'</code> や <code>'*.png'</code> はいけません) を入れないで下さい。 すべてのファイルを表示するには、<code>'*'</code> ワイルドカードを使用して下さい (その他のワイルドカードはサポートされていません)。</p>\n<p><strong>注:</strong> WindowsとLinuxのオープンダイアログでは、ファイルとディレクトリの両方を選択することはできません。そのため、これらのプラットフォームで <code>properties</code> に <code>['openFile', 'openDirectory']</code> を設定すると、ディレクトリの選択が表示されます。</p>\n<pre><code class=\"hljs language-js\">dialog.showOpenDialog(mainWindow, {\n  <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'openDirectory'</span>]\n}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">result</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(result.canceled)\n  <span class=\"hljs-built_in\">console</span>.log(result.filePaths)\n}).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(err)\n})\n</code></pre>\n<h3 id=\"dialogshowsavedialogsyncbrowserwindow-options\"><a href=\"#dialogshowsavedialogsyncbrowserwindow-options\"><code>dialog.showSaveDialogSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (任意)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> String (任意) - ダイアログのタイトル。 一部の <em>Linux</em> デスクトップ環境では表示できないことがあります。</li>\n<li><code>defaultPath</code> String (任意) - 既定で使用される絶対ディレクトリパス、絶対ファイルパスもしくはファイル名。</li>\n<li><code>buttonLabel</code> String (任意) - 確認ボタンのカスタムラベル。空のままにすると、既定のラベルが使用されます。</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (任意)</li>\n<li><code>message</code> String (任意) <em>macOS</em> - テキストフィールドの上に表示するメッセージ。</li>\n<li><code>nameFieldLabel</code> String (任意) <em>macOS</em> - ファイル名のテキストフィールドの前に表示されるテキストのカスタムラベル。</li>\n<li><code>showsTagField</code> Boolean (任意) <em>macOS</em> - タグの入力ボックスを表示します。省略値は、<code>true</code> です。</li>\n<li><code>properties</code> String[] (任意)<ul>\n<li><code>showHiddenFiles</code> - ダイアログで隠しファイルを表示します。</li>\n<li><code>createDirectory</code> <em>macOS</em> - ダイアログでディレクトリを作成するのを許可します。</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - <code>.app</code> フォルダのようなパッケージを、ファイルの代わりにディレクトリとして扱います。</li>\n<li><code>showOverwriteConfirmation</code> <em>Linux</em> - ユーザが既に存在するファイル名を入力した場合に、ユーザに確認ダイアログを表示するかどうかを設定します。</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - 開いているアイテムを最近開いたドキュメントリストに追加しないようにします。</li>\n</ul></li>\n<li><code>securityScopedBookmarks</code> Boolean (任意) <em>macOS</em> <em>mas</em> - Mac App Store 向けにパッケージしたときに <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">セキュリティスコープ付きブックマーク</a> を作成します。 このオプションが有効でファイルが存在しない場合は、選択したパスに空のファイルが作成されます。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>String | undefined</code> - ユーザが選択したファイルパス。dialog がキャンセルされた場合は <code>undefined</code> を返します。</p>\n<p><code>browserWindow</code> の引数で、ダイアログは親ウインドウにアタッチされ、モーダル表示になります。</p>\n<p><code>filters</code> には、表示することのできるファイルの種類の配列を指定します。例については、<code>dialog.showOpenDialog</code> を参照して下さい。</p>\n<h3 id=\"dialogshowsavedialogbrowserwindow-options\"><a href=\"#dialogshowsavedialogbrowserwindow-options\"><code>dialog.showSaveDialog([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (任意)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> String (任意) - ダイアログのタイトル。 一部の <em>Linux</em> デスクトップ環境では表示できないことがあります。</li>\n<li><code>defaultPath</code> String (任意) - 既定で使用される絶対ディレクトリパス、絶対ファイルパスもしくはファイル名。</li>\n<li><code>buttonLabel</code> String (任意) - 確認ボタンのカスタムラベル。空のままにすると、既定のラベルが使用されます。</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (任意)</li>\n<li><code>message</code> String (任意) <em>macOS</em> - テキストフィールドの上に表示するメッセージ。</li>\n<li><code>nameFieldLabel</code> String (任意) <em>macOS</em> - ファイル名のテキストフィールドの前に表示されるテキストのカスタムラベル。</li>\n<li><code>showsTagField</code> Boolean (任意) <em>macOS</em> - タグの入力ボックスを表示します。省略値は、<code>true</code> です。</li>\n<li><code>properties</code> String[] (任意)<ul>\n<li><code>showHiddenFiles</code> - ダイアログで隠しファイルを表示します。</li>\n<li><code>createDirectory</code> <em>macOS</em> - ダイアログでディレクトリを作成するのを許可します。</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - <code>.app</code> フォルダのようなパッケージを、ファイルの代わりにディレクトリとして扱います。</li>\n<li><code>showOverwriteConfirmation</code> <em>Linux</em> - ユーザが既に存在するファイル名を入力した場合に、ユーザに確認ダイアログを表示するかどうかを設定します。</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - 開いているアイテムを最近開いたドキュメントリストに追加しないようにします。</li>\n</ul></li>\n<li><code>securityScopedBookmarks</code> Boolean (任意) <em>macOS</em> <em>mas</em> - Mac App Store 向けにパッケージしたときに <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">セキュリティスコープ付きブックマーク</a> を作成します。 このオプションが有効でファイルが存在しない場合は、選択したパスに空のファイルが作成されます。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;Object></code> - 以下を含むオブジェクトで実行されます。</p>\n<ul>\n<li><code>canceled</code> Boolean - dialog がキャンセルされたかそうでないか。</li>\n<li><code>filePath</code> String (任意) - ダイアログがキャンセルされると、これは <code>undefined</code> になります。</li>\n<li><code>bookmark</code> String (任意)<em>macOS</em> <em>mas</em> - 保存されたファイルのセキュリティスコープのブックマークデータを含む Base64 エンコードされた文字列。 出力するために <code>securityScopedBookmarks</code> を有効にする必要があります。 (戻り値については、<a href=\"#bookmarks-array\">この表</a> を参照してください。)</li>\n</ul>\n<p><code>browserWindow</code> の引数で、ダイアログは親ウインドウにアタッチされ、モーダル表示になります。</p>\n<p><code>filters</code> には、表示することのできるファイルの種類の配列を指定します。例については、<code>dialog.showOpenDialog</code> を参照して下さい。</p>\n<p><strong>注意:</strong> macOS では、ダイアログを展開したり折りたたんだりする際の問題を避けるために、非同期バージョンを使用することを推奨します。</p>\n<h3 id=\"dialogshowmessageboxsyncbrowserwindow-options\"><a href=\"#dialogshowmessageboxsyncbrowserwindow-options\"><code>dialog.showMessageBoxSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (任意)</li>\n<li><code>options</code> Object<ul>\n<li><code>message</code> String - メッセージボックスの内容。</li>\n<li><code>type</code> String (任意) - <code>\"none\"</code>、<code>\"info\"</code>、<code>\"error\"</code>、<code>\"question\"</code>、<code>\"warning\"</code> にすることができます。 Windowsでは、<code>\"icon\"</code> のオプションを使用してアイコンを設定しない場合、<code>\"question\"</code> は、<code>\"info\"</code> と同じアイコンを表示します。 macOSでは、<code>\"warning\"</code> と <code>\"error\"</code> の両方で同じ警告アイコンを表示します。</li>\n<li><code>buttons</code> String[] (任意) - ボタン用テキストの配列。 Windows では、空の配列は 1 つの \"OK\" ボタンになります。</li>\n<li><code>defaultId</code> Integer (任意) - メッセージボックスを開いたとき、既定で選択されるボタンの配列の中のボタンのインデックス。</li>\n<li><code>title</code> String (任意) - メッセージボックスのタイトル。いくつかのプラットフォームでは表示されません。</li>\n<li><code>detail</code> String (任意) - メッセージの追加情報。</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (任意)</li>\n<li><code>textWidth</code> Integer (任意) <em>macOS</em> - メッセージボックス内のテキストのカスタムな幅。</li>\n<li><code>cancelId</code> Integer (任意) - <code>Esc</code> キー経由でダイアログをキャンセルするのに使用されるボタンのインデックス。 既定では、これはラベルとして \"cancel\" または \"no\" の付いた最初のボタンに割り当てられます。 そのようにラベル付けされたボタンがなく、このオプションが設定されていない場合、<code>0</code> が戻り値として使用されます。</li>\n<li><code>noLink</code> Boolean (任意) - WindowsでElectronはどの <code>buttons</code> が (\"Cancel\" や \"Yes\" のような) 一般的なボタンかを把握し、その他をダイアログでコマンドリンクとして表示しようとします。 これにより、モダンなWindowsアプリのスタイルでダイアログを表示させることができます。 この動作が気に入らない場合、<code>noLink</code> を <code>true</code> に設定することができます。</li>\n<li><code>normalizeAccessKeys</code> Boolean (任意) - プラットフォーム間でキーボードのアクセスキーを正規化します。 省略値は <code>false</code> です。 これを有効にすると、<code>&#x26;</code> が、ボタンのラベルでキーボードショートカットアクセスキーの位置として使用されているとみなされ、各プラットフォームで正常に動作するようにラベルが変換されます。macOSでは、<code>&#x26;</code> の文字は削除され、Linuxでは、<code>_</code> に変換され、Windowsでは、そのままにされます。 例えば、<code>Vie&#x26;w</code> というボタンラベルは、Linuxでは、<code>Vie_w</code>、macOSでは、<code>View</code> に変換され、WindowsとLinuxでは、<code>Alt-W</code> 経由で選択できます。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Integer</code> - クリックされたボタンのインデックス。</p>\n<p>メッセージボックスを表示し、メッセージボックスが閉じられるまでプロセスをブロックします。 クリックされたボタンのインデックスを返します。</p>\n<p><code>browserWindow</code> の引数で、ダイアログは親ウインドウにアタッチされ、モーダル表示になります。 <code>browserWindow</code> が表示されていない場合、dialog はアタッチされません。 この場合は独立したウインドウとして表示されます。</p>\n<h3 id=\"dialogshowmessageboxbrowserwindow-options\"><a href=\"#dialogshowmessageboxbrowserwindow-options\"><code>dialog.showMessageBox([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (任意)</li>\n<li><code>options</code> Object<ul>\n<li><code>message</code> String - メッセージボックスの内容。</li>\n<li><code>type</code> String (任意) - <code>\"none\"</code>、<code>\"info\"</code>、<code>\"error\"</code>、<code>\"question\"</code>、<code>\"warning\"</code> にすることができます。 Windowsでは、<code>\"icon\"</code> のオプションを使用してアイコンを設定しない場合、<code>\"question\"</code> は、<code>\"info\"</code> と同じアイコンを表示します。 macOSでは、<code>\"warning\"</code> と <code>\"error\"</code> の両方で同じ警告アイコンを表示します。</li>\n<li><code>buttons</code> String[] (任意) - ボタン用テキストの配列。 Windows では、空の配列は 1 つの \"OK\" ボタンになります。</li>\n<li><code>defaultId</code> Integer (任意) - メッセージボックスを開いたとき、既定で選択されるボタンの配列の中のボタンのインデックス。</li>\n<li><code>signal</code> AbortSignal (任意) - 任意でメッセージボックスを閉じるために <a href=\"https://nodejs.org/api/globals.html#globals_class_abortsignal\">AbortSignal</a> のインスタンスを渡すことができます。メッセージボックスはあたかもユーザーによってキャンセルされたかのように動作します。 macOS では、<code>signal</code> は親ウインドウのないメッセージボックスで動作しません。これらのメッセージボックスは、プラットフォーム上の制約により同期的に動作するからです。</li>\n<li><code>title</code> String (任意) - メッセージボックスのタイトル。いくつかのプラットフォームでは表示されません。</li>\n<li><code>detail</code> String (任意) - メッセージの追加情報。</li>\n<li><code>checkboxLabel</code> String (任意) - 指定した場合、メッセージボックスには、指定したラベルを持つチェックボックスが含まれます。</li>\n<li><code>checkboxChecked</code> Boolean (任意) - チェックボックスの初期のチェック状態。 省略値は <code>false</code> です。</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> (任意)</li>\n<li><code>textWidth</code> Integer (任意) <em>macOS</em> - メッセージボックス内のテキストのカスタムな幅。</li>\n<li><code>cancelId</code> Integer (任意) - <code>Esc</code> キー経由でダイアログをキャンセルするのに使用されるボタンのインデックス。 既定では、これはラベルとして \"cancel\" または \"no\" の付いた最初のボタンに割り当てられます。 そのようにラベル付けされたボタンがなく、このオプションが設定されていない場合、<code>0</code> が戻り値として使用されます。</li>\n<li><code>noLink</code> Boolean (任意) - WindowsでElectronはどの <code>buttons</code> が (\"Cancel\" や \"Yes\" のような) 一般的なボタンかを把握し、その他をダイアログでコマンドリンクとして表示しようとします。 これにより、モダンなWindowsアプリのスタイルでダイアログを表示させることができます。 この動作が気に入らない場合、<code>noLink</code> を <code>true</code> に設定することができます。</li>\n<li><code>normalizeAccessKeys</code> Boolean (任意) - プラットフォーム間でキーボードのアクセスキーを正規化します。 省略値は <code>false</code> です。 これを有効にすると、<code>&#x26;</code> が、ボタンのラベルでキーボードショートカットアクセスキーの位置として使用されているとみなされ、各プラットフォームで正常に動作するようにラベルが変換されます。macOSでは、<code>&#x26;</code> の文字は削除され、Linuxでは、<code>_</code> に変換され、Windowsでは、そのままにされます。 例えば、<code>Vie&#x26;w</code> というボタンラベルは、Linuxでは、<code>Vie_w</code>、macOSでは、<code>View</code> に変換され、WindowsとLinuxでは、<code>Alt-W</code> 経由で選択できます。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;Object></code> - 以下のプロパティを含む Promise で解決されます。</p>\n<ul>\n<li><code>response</code> Number - クリックされたボタンのインデックス。</li>\n<li><code>checkboxChecked</code> Boolean - <code>checkboxLabel</code> が設定された場合、チェックボックスのチェック状態。 そうでない場合は <code>false</code> になります。</li>\n</ul>\n<p>メッセージボックスを表示します。</p>\n<p><code>browserWindow</code> の引数で、ダイアログは親ウインドウにアタッチされ、モーダル表示になります。</p>\n<h3 id=\"dialogshowerrorboxtitle-content\"><a href=\"#dialogshowerrorboxtitle-content\"><code>dialog.showErrorBox(title, content)</code></a></h3>\n<ul>\n<li><code>title</code> String - エラーボックスに表示するタイトル.</li>\n<li><code>content</code> String - エラーボックスに表示するテキストの内容.</li>\n</ul>\n<p>エラーメッセージを表示するモーダルダイアログを表示します。</p>\n<p><code>app</code> モジュールで <code>ready</code> イベントが発生する前でも、このAPIは安全に呼び出すことができます。これは、起動の初期段階でのエラーを報告するのによく使用されます。 Linuxで、appの <code>ready</code> イベントの前に呼び出すと、メッセージは標準エラーに出力され、GUIのダイアログは表示されません。</p>\n<h3 id=\"dialogshowcertificatetrustdialogbrowserwindow-options-macos-windows\"><a href=\"#dialogshowcertificatetrustdialogbrowserwindow-options-macos-windows\"><code>dialog.showCertificateTrustDialog([browserWindow, ]options)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (任意)</li>\n<li><code>options</code> Object<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> - 信頼/インポートする証明書。</li>\n<li><code>message</code> String - ユーザーに表示するメッセージ。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - 証明書信頼ダイアログが表示されると実行されます。</p>\n<p>macOSでは、これはメッセージと証明書情報を表示するモーダルダイアログを表示し、ユーザーに証明書を信頼/インポートする選択肢を提供します。 <code>browserWindow</code> の引数を指定すると、ダイアログは親ウインドウにアタッチされ、モーダル表示になります。</p>\n<p>Windowsでは、使用されているWin32 APIのため、オプションはより限定的です。</p>\n<ul>\n<li>OSが独自の確認ダイアログを提供しているため、<code>message</code> の引数は使用されません。</li>\n<li>この確認ダイアログをモーダル表示にすることができないため、<code>browserWindow</code> の引数は無視されます。</li>\n</ul>\n<h2 id=\"ブックマーク配列\"><a href=\"#ブックマーク配列\">ブックマーク配列</a></h2>\n<p><code>showOpenDialog</code>、<code>showOpenDialogSync</code>、<code>showSaveDialog</code>、 <code>showSaveDialogSync</code> は <code>bookmarks</code> と言う配列を返します。</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>ビルド種別</th><th>securityScopedBookmarks 真偽値</th><th align=\"center\">戻り値の型</th><th>返り値</th></tr></thead><tbody><tr><td>macOS mas</td><td>True</td><td align=\"center\">Success</td><td><code>['LONGBOOKMARKSTRING']</code></td></tr><tr><td>macOS mas</td><td>True</td><td align=\"center\">エラー</td><td><code>['']</code> (空文字列の配列)</td></tr><tr><td>macOS mas</td><td>False</td><td align=\"center\">なし</td><td><code>[]</code> (空の配列)</td></tr><tr><td>non mas</td><td>any</td><td align=\"center\">なし</td><td><code>[]</code> (空の配列)</td></tr></tbody></table>\n<h2 id=\"シート\"><a href=\"#シート\">シート</a></h2>\n<p>macOS では、<code>browserWindow</code> パラメータに <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> の参照を指定した場合、ダイアログは、ウインドウにアタッチされたシートとして表示されます。ウインドウを指定しない場合、モーダルで表示されます。</p>\n<p><code>BrowserWindow.getCurrentWindow().setSheetOffset(offset)</code> を呼び出すことで、シートがアタッチされるウインドウフレームからのオフセットを変更することができます。</p>",
      "title": "dialog",
      "description": "ファイルを開いたり、保存したり、アラートを出したりするために、ネイティブのシステムダイアログを表示します。"
    },
    "/docs/api/structures/display": {
      "locale": "ja-JP",
      "slug": "display",
      "href": "/docs/api/structures/display",
      "crowdinFileId": "256427",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/display.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"display-object\"><a href=\"#display-object\">Display Object</a></h1>\n<ul>\n<li><code>id</code> Number - Unique identifier associated with the display.</li>\n<li><code>rotation</code> Number - Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.</li>\n<li><code>scaleFactor</code> Number - Output device's pixel scale factor.</li>\n<li><code>touchSupport</code> String - Can be <code>available</code>, <code>unavailable</code>, <code>unknown</code>.</li>\n<li><code>monochrome</code> Boolean - Whether or not the display is a monochrome display.</li>\n<li><code>accelerometerSupport</code> String - Can be <code>available</code>, <code>unavailable</code>, <code>unknown</code>.</li>\n<li><code>colorSpace</code> String -  represent a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions</li>\n<li><code>colorDepth</code> Number - The number of bits per pixel.</li>\n<li><code>depthPerComponent</code> Number - The number of bits per color component.</li>\n<li><code>displayFrequency</code> Number - The display refresh rate.</li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - the bounds of the display in DIP points.</li>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a></li>\n<li><code>workArea</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - the work area of the display in DIP points.</li>\n<li><code>workAreaSize</code> <a href=\"/docs/api/structures/size\">Size</a></li>\n<li><code>internal</code> Boolean - <code>true</code> for an internal display and <code>false</code> for an external display</li>\n</ul>\n<p>The <code>Display</code> object represents a physical display connected to the system. A fake <code>Display</code> may exist on a headless system, or a <code>Display</code> may correspond to a remote, virtual display.</p>",
      "title": "Display Object",
      "description": ""
    },
    "/docs/api/dock": {
      "locale": "ja-JP",
      "slug": "dock",
      "href": "/docs/api/dock",
      "crowdinFileId": "256311",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/dock.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-dock\"><a href=\"#クラス-dock\">クラス: Dock</a></h2>\n<blockquote>\n<p>macOS Dock 内のアプリを制御する</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<p>以下の例は、Dock でアイコンをバウンスさせる方法を示しています。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.dock.bounce()\n</code></pre>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<h4 id=\"dockbouncetype-macos\"><a href=\"#dockbouncetype-macos\"><code>dock.bounce([type])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>type</code> String (任意) - <code>critical</code> か <code>informational</code> にできます。 省略値は、<code>informational</code> です。</li>\n</ul>\n<p>戻り値 <code>Integer</code> - このリクエストを表すID。</p>\n<p><code>critical</code> が渡された場合、ドックのアイコンはアプリケーションがアクティブになるか、リクエストがキャンセルされるまでバウンスします。</p>\n<p><code>informational</code> が渡されると、ドックアイコンが 1 秒間バウンスします。 ただし、アプリケーションがアクティブになるかリクエストがキャンセルされるまで、そのリクエストはアクティブのままです。</p>\n<p><strong>注釈:</strong> このメソッドは、アプリがフォーカスされていないときにのみ使用できます。アプリがフォーカスされていると -1 を返します。</p>\n<h4 id=\"dockcancelbounceid-macos\"><a href=\"#dockcancelbounceid-macos\"><code>dock.cancelBounce(id)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p><code>id</code> のバウンスをキャンセルします。</p>\n<h4 id=\"dockdownloadfinishedfilepath-macos\"><a href=\"#dockdownloadfinishedfilepath-macos\"><code>dock.downloadFinished(filePath)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n</ul>\n<p>filePath がダウンロードフォルダの中の場合、ダウンロードのスタックをバウンスさせます。</p>\n<h4 id=\"docksetbadgetext-macos\"><a href=\"#docksetbadgetext-macos\"><code>dock.setBadge(text)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>ドックのバッジ領域に表示される文字列を設定します。</p>\n<h4 id=\"dockgetbadge-macos\"><a href=\"#dockgetbadge-macos\"><code>dock.getBadge()</code> <em>macOS</em></a></h4>\n<p>戻り値 <code>String</code> - ドックのバッジ文字列。</p>\n<h4 id=\"dockhide-macos\"><a href=\"#dockhide-macos\"><code>dock.hide()</code> <em>macOS</em></a></h4>\n<p>ドックのアイコンを非表示にする</p>\n<h4 id=\"dockshow-macos\"><a href=\"#dockshow-macos\"><code>dock.show()</code> <em>macOS</em></a></h4>\n<p>戻り値 <code>Promise&#x3C;void></code> - Dock のアイコンが表示されたときに実行されます。</p>\n<h4 id=\"dockisvisible-macos\"><a href=\"#dockisvisible-macos\"><code>dock.isVisible()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Boolean</code> - Dock のアイコンが表示されているかどうか。</p>\n<h4 id=\"docksetmenumenu-macos\"><a href=\"#docksetmenumenu-macos\"><code>dock.setMenu(menu)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>menu</code> <a href=\"/docs/api/menu\">Menu</a></li>\n</ul>\n<p>アプリケーションの [Dock メニュー][dock-menu] を設定します。</p>\n<h4 id=\"dockgetmenu-macos\"><a href=\"#dockgetmenu-macos\"><code>dock.getMenu()</code> <em>macOS</em></a></h4>\n<p>戻り値 <code>Menu | null</code> - アプリケーションの [Dock メニュー][dock-menu]。</p>\n<h4 id=\"dockseticonimage-macos\"><a href=\"#dockseticonimage-macos\"><code>dock.setIcon(image)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>このドックアイコンに関連付けられた <code>image</code> を設定します。</p>",
      "title": "クラス: Dock",
      "description": "macOS Dock 内のアプリを制御する"
    },
    "/docs/api/download-item": {
      "locale": "ja-JP",
      "slug": "download-item",
      "href": "/docs/api/download-item",
      "crowdinFileId": "256313",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/download-item.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-downloaditem\"><a href=\"#クラス-downloaditem\">クラス: DownloadItem</a></h2>\n<blockquote>\n<p>リモートソースからのファイルのダウンロードを制御します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<p><code>DownloadItem</code> は <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a> を継承しており、Electron でのダウンロードアイテムを表します。 これは <code>Session</code> クラスの <code>will-download</code> イベントで使用されており、ユーザーがダウンロードアイテムを制御できるようにします。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// メインプロセス</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.session.on(<span class=\"hljs-string\">'will-download'</span>, (event, item, webContents) => {\n  <span class=\"hljs-comment\">// 保存パスを設定して、Electronに保存ダイアログを出さないようにします。</span>\n  item.setSavePath(<span class=\"hljs-string\">'/tmp/save.pdf'</span>)\n\n  item.on(<span class=\"hljs-string\">'updated'</span>, (event, state) => {\n    <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'interrupted'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download is interrupted but can be resumed'</span>)\n    } <span class=\"hljs-keyword\">else</span> <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'progressing'</span>) {\n      <span class=\"hljs-keyword\">if</span> (item.isPaused()) {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download is paused'</span>)\n      } <span class=\"hljs-keyword\">else</span> {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Received bytes: <span class=\"hljs-subst\">${item.getReceivedBytes()}</span>`</span>)\n      }\n    }\n  })\n  item.once(<span class=\"hljs-string\">'done'</span>, (event, state) => {\n    <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'completed'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download successfully'</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Download failed: <span class=\"hljs-subst\">${state}</span>`</span>)\n    }\n  })\n})\n</code></pre>\n<h3 id=\"インスタンスイベント\"><a href=\"#インスタンスイベント\">インスタンスイベント</a></h3>\n<h4 id=\"イベント-updated\"><a href=\"#イベント-updated\">イベント: 'updated'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>state</code> String - <code>progressing</code> か <code>interrupted</code> にできます。</li>\n</ul>\n<p>ダウンロードが更新され、まだ未完了であるときに発生します。</p>\n<p><code>state</code> は、次のいずれかになります。</p>\n<ul>\n<li><code>progressing</code> - ダウンロードが進行中です。</li>\n<li><code>interrupted</code> - ダウンロードが中断されましたが、再開することができます。</li>\n</ul>\n<h4 id=\"イベント-done\"><a href=\"#イベント-done\">イベント: 'done'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>state</code> String - <code>completed</code>、<code>cancelled</code> か <code>interrupted</code> にできます。</li>\n</ul>\n<p>ダウンロードが終了状態となったときに発生します。 これは完了したダウンロード、キャンセルされたダウンロード (<code>downloadItem.cancel()</code> によって) 、再開できる中断されたダウンロードを含みます。</p>\n<p><code>state</code> は、次のいずれかになります。</p>\n<ul>\n<li><code>completed</code> - ダウンロードが正常に完了しました。</li>\n<li><code>cancelled</code> - ダウンロードがキャンセルされました。</li>\n<li><code>interrupted</code> - ダウンロードが中断され、再開することができません。</li>\n</ul>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<p><code>downloadItem</code> オブジェクトには以下のメソッドがあります</p>\n<h4 id=\"downloaditemsetsavepathpath\"><a href=\"#downloaditemsetsavepathpath\"><code>downloadItem.setSavePath(path)</code></a></h4>\n<ul>\n<li><code>path</code> String - ダウロードアイテムを保存するファイルパスを設定します。</li>\n</ul>\n<p>このAPIは、セッションの <code>will-download</code> コールバック関数でのみ利用可能です。 <code>path</code> が存在しない場合、Electron はディレクトリを再帰的に作成しようとします。 ユーザがこのAPIを経由して保存先のパスを設定しない場合、Electron は、保存先のパスを決定するために独自のルーチンを使用します。通常は保存ダイアログを表示します。</p>\n<h4 id=\"downloaditemgetsavepath\"><a href=\"#downloaditemgetsavepath\"><code>downloadItem.getSavePath()</code></a></h4>\n<p>戻り値 <code>String</code> - ダウンロードアイテムの保存先パス。 これは <code>downloadItem.setSavePath(path)</code> で設定されたものか、保存ダイアログで選択されたものになります。</p>\n<h4 id=\"downloaditemsetsavedialogoptionsoptions\"><a href=\"#downloaditemsetsavedialogoptionsoptions\"><code>downloadItem.setSaveDialogOptions(options)</code></a></h4>\n<ul>\n<li><code>options</code> SaveDialogOptions - ファイル保存ダイアログのオプションを設定します。 このオブジェクトは <code>options</code> パラメータ(<a href=\"/docs/api/dialog\"><code>dialog.showSaveDialog()</code></a>の)と同じプロパティを持ちます。</li>\n</ul>\n<p>この API によって、ダウンロードアイテムに対して既定で開かれる保存ダイアログのカスタムオプションをユーザが設定できます。 このAPIは、セッションの <code>will-download</code> コールバック関数でのみ利用可能です。</p>\n<h4 id=\"downloaditemgetsavedialogoptions\"><a href=\"#downloaditemgetsavedialogoptions\"><code>downloadItem.getSaveDialogOptions()</code></a></h4>\n<p>戻り値 <code>SaveDialogOptions</code> - <code>downloadItem.setSaveDialogOptions(options)</code>によってその前に設定されたオブジェクトを返す。</p>\n<h4 id=\"downloaditempause\"><a href=\"#downloaditempause\"><code>downloadItem.pause()</code></a></h4>\n<p>ダウンロードを一時停止します。</p>\n<h4 id=\"downloaditemispaused\"><a href=\"#downloaditemispaused\"><code>downloadItem.isPaused()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ダウンロードが一時停止しているかどうか。</p>\n<h4 id=\"downloaditemresume\"><a href=\"#downloaditemresume\"><code>downloadItem.resume()</code></a></h4>\n<p>一時停止されたダウンロードを再開します。</p>\n<p><strong>注:</strong> 再開可能なダウンロードを有効にするには、ダウンロードしているサーバーがRangeリクエストをサポートしており、<code>Last-Modified</code> と <code>ETag</code> の両方のヘッダーの値を提供していなければなりません。 そうでなければ、<code>resume()</code> は、前回受信したバイト数を無視して、最初からダウンロードを再開します。</p>\n<h4 id=\"downloaditemcanresume\"><a href=\"#downloaditemcanresume\"><code>downloadItem.canResume()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ダウンロードを再開できるかどうか。</p>\n<h4 id=\"downloaditemcancel\"><a href=\"#downloaditemcancel\"><code>downloadItem.cancel()</code></a></h4>\n<p>ダウンロード操作をキャンセルします。</p>\n<h4 id=\"downloaditemgeturl\"><a href=\"#downloaditemgeturl\"><code>downloadItem.getURL()</code></a></h4>\n<p>戻り値 <code>String</code> - アイテムがダウンロードされた元の URL。</p>\n<h4 id=\"downloaditemgetmimetype\"><a href=\"#downloaditemgetmimetype\"><code>downloadItem.getMimeType()</code></a></h4>\n<p>戻り値 <code>String</code> - ファイルのMIMEタイプ。</p>\n<h4 id=\"downloaditemhasusergesture\"><a href=\"#downloaditemhasusergesture\"><code>downloadItem.hasUserGesture()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ダウンロードにユーザージェスチャがあるかどうか。</p>\n<h4 id=\"downloaditemgetfilename\"><a href=\"#downloaditemgetfilename\"><code>downloadItem.getFilename()</code></a></h4>\n<p>戻り値 <code>String</code> - ダウンロードアイテムのファイル名。</p>\n<p><strong>注:</strong> ファイル名は常にローカルディスクに保存したものと同じではありません。 ユーザーが表示されたダウンロード保存ダイアログでファイル名を変更した場合、保存されたファイルの実際の名前は異なります。</p>\n<h4 id=\"downloaditemgettotalbytes\"><a href=\"#downloaditemgettotalbytes\"><code>downloadItem.getTotalBytes()</code></a></h4>\n<p>戻り値 <code>Integer</code> - ダウンロードアイテムのバイト単位での合計サイズ。</p>\n<p>サイズが不明な場合、0を返します。</p>\n<h4 id=\"downloaditemgetreceivedbytes\"><a href=\"#downloaditemgetreceivedbytes\"><code>downloadItem.getReceivedBytes()</code></a></h4>\n<p>戻り値 <code>Integer</code> - ダウンロードアイテムの受信したバイト数。</p>\n<h4 id=\"downloaditemgetcontentdisposition\"><a href=\"#downloaditemgetcontentdisposition\"><code>downloadItem.getContentDisposition()</code></a></h4>\n<p>戻り値 <code>String</code> - レスポンスヘッダーのContent-Dispositionフィールド。</p>\n<h4 id=\"downloaditemgetstate\"><a href=\"#downloaditemgetstate\"><code>downloadItem.getState()</code></a></h4>\n<p>戻り値 <code>String</code> - 現在の状態。 <code>progressing</code> 、 <code>completed</code> 、 <code>cancelled</code> 、 <code>interrupted</code> のいずれか。</p>\n<p><strong>注:</strong> 以下のメソッドは、セッションが再開されたときに <code>cancelled</code> アイテムを再開するのに特に有用です。</p>\n<h4 id=\"downloaditemgeturlchain\"><a href=\"#downloaditemgeturlchain\"><code>downloadItem.getURLChain()</code></a></h4>\n<p>戻り値 <code>String[]</code> - すべてのリダイレクトを含むアイテムの完全な URL チェーン。</p>\n<h4 id=\"downloaditemgetlastmodifiedtime\"><a href=\"#downloaditemgetlastmodifiedtime\"><code>downloadItem.getLastModifiedTime()</code></a></h4>\n<p>戻り値 <code>String</code> - Last-Modifiedのヘッダーの値。</p>\n<h4 id=\"downloaditemgetetag\"><a href=\"#downloaditemgetetag\"><code>downloadItem.getETag()</code></a></h4>\n<p>戻り値 <code>String</code> - ETagのヘッダーの値。</p>\n<h4 id=\"downloaditemgetstarttime\"><a href=\"#downloaditemgetstarttime\"><code>downloadItem.getStartTime()</code></a></h4>\n<p>戻り値 <code>Double</code> - ダウンロードが開始されたUNIXエポックからの秒数。</p>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<h4 id=\"downloaditemsavepath\"><a href=\"#downloaditemsavepath\"><code>downloadItem.savePath</code></a></h4>\n<p><code>String</code> 型のプロパティです。ダウンロードアイテムを保存するファイルパスを決定します。</p>\n<p>このプロパティは、セッションの <code>will-download</code> コールバック関数内でのみ利用可能です。 ユーザがこのプロパティを経由して保存先のパスを設定しない場合、Electron は、保存先のパスを決定するために独自のルーチンを使用します。通常は保存ダイアログを表示します。</p>",
      "title": "クラス: DownloadItem",
      "description": "リモートソースからのファイルのダウンロードを制御します。"
    },
    "/docs/tutorial/electron-timelines": {
      "locale": "ja-JP",
      "slug": "electron-timelines",
      "href": "/docs/tutorial/electron-timelines",
      "crowdinFileId": "256197",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/electron-timelines.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-リリースタイムライン\"><a href=\"#electron-リリースタイムライン\">Electron リリースタイムライン</a></h1>\n<p>特筆事項:</p>\n<ul>\n<li><code>-beta.1</code> および <code>stable</code> の日付は、具体的なリリース日です。</li>\n<li>私たちは毎週ベータ版のリリースを目指しますが、予定より多くのベータ版をリリースすることがよくあります。</li>\n<li>これら全ての日付は私たちの目標ですが、セキュリティバグなど、安定版リリースの期限を調整する理由があるかもしれません。</li>\n<li>リリース日の公表に関する情報については、<a href=\"https://electronjs.org/blog/electron-5-0-timeline\">5.0.0 タイムラインのブログ記事</a> をご覧ください。</li>\n<li>Electron 6.0 以降、私たちは各 Chromium バージョンを対象に、Chrome 安定版と同じ日に Electron 安定版をリリースしています。 Chromium のリリーススケジュールは <a href=\"https://chromiumdash.appspot.com/schedule\">こちら</a> でご参照ください。 リリーススケジュールの詳細については、<a href=\"https://www.electronjs.org/blog/12-week-cadence\">Electron の新しいリリースケイデンスのブログ記事</a> をご覧ください。</li>\n<li>Electron 15.0 にのみ、特別なアルファリリースが含まれます。 Electron 16.0 からは、8 週間周期でのリリースを予定しています。 詳細は <a href=\"https://www.electronjs.org/blog/8-week-cadence\">Electron の新しい 8 週間ケイデンスのブログ記事</a> をご覧ください。</li>\n</ul>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Electron</th><th>アルファ</th><th>ベータ</th><th>安定版</th><th>Chrome</th><th>ノード</th></tr></thead><tbody><tr><td>2.0.0</td><td>--</td><td>2018-Feb-21</td><td>2018-May-01</td><td>M61</td><td>v8.9</td></tr><tr><td>3.0.0</td><td>--</td><td>2018-Jun-21</td><td>2018-Sep-18</td><td>M66</td><td>v10.2</td></tr><tr><td>4.0.0</td><td>--</td><td>2018-Oct-11</td><td>2018-Dec-20</td><td>M69</td><td>v10.11</td></tr><tr><td>5.0.0</td><td>--</td><td>2019-Jan-22</td><td>2019-Apr-24</td><td>M73</td><td>v12.0</td></tr><tr><td>6.0.0</td><td>--</td><td>2019-May-01</td><td>2019-Jul-30</td><td>M76</td><td>v12.4</td></tr><tr><td>7.0.0</td><td>--</td><td>2019-Aug-01</td><td>2019-Oct-22</td><td>M78</td><td>v12.8</td></tr><tr><td>8.0.0</td><td>--</td><td>2019-Oct-24</td><td>2020-Feb-04</td><td>M80</td><td>v12.13</td></tr><tr><td>9.0.0</td><td>--</td><td>2020-Feb-06</td><td>2020-May-19</td><td>M83</td><td>v12.14</td></tr><tr><td>10.0.0</td><td>--</td><td>2020-May-21</td><td>2020-May-21</td><td>M85</td><td>v12.16</td></tr><tr><td>11.0.0</td><td>--</td><td>2020-Aug-27</td><td>2020-Nov-17</td><td>M87</td><td>v12.18</td></tr><tr><td>12.0.0</td><td>--</td><td>2020-Nov-19</td><td>2021-Mar-02</td><td>M89</td><td>v14.16</td></tr><tr><td>13.0.0</td><td>--</td><td>2021-Mar-04</td><td>2021-May-25</td><td>M91</td><td>v14.16</td></tr><tr><td>14.0.0</td><td>--</td><td>2021-May-27</td><td>2021-Aug-31</td><td>M93</td><td>v14.17</td></tr><tr><td>15.0.0</td><td>2021-Jul-20</td><td>2021-Sep-01</td><td>2021-Sep-21</td><td>M94</td><td>v16.5</td></tr><tr><td>16.0.0</td><td>--</td><td>2021-Sep-23</td><td>2021-Nov-16</td><td>M96</td><td>未定</td></tr></tbody></table>",
      "title": "Electron リリースタイムライン",
      "description": ""
    },
    "/docs/tutorial/electron-versioning": {
      "locale": "ja-JP",
      "slug": "electron-versioning",
      "href": "/docs/tutorial/electron-versioning",
      "crowdinFileId": "256199",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/electron-versioning.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electronのバージョン管理\"><a href=\"#electronのバージョン管理\">Electronのバージョン管理</a></h1>\n<blockquote>\n<p>バージョン管理ポリシーと実装の詳細をご覧ください。</p>\n</blockquote>\n<p>バージョン 2.0.0 から、Electron は <a href=\"#semver\">SemVer</a> に準拠しています。 以下のコマンドで、最新の安定版 Electron のビルドをインストールできます。</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron\n</code></pre>\n<p>既存のプロジェクトを最新の安定版を使用するように更新するには、以下のようにします。</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron@latest\n</code></pre>\n<h2 id=\"version-1x\"><a href=\"#version-1x\">Version 1.x</a></h2>\n<p>Electron <em>2.0</em> より前のバージョンでは <a href=\"https://semver.org\">SemVer</a> の仕様に準拠していませんでした。メジャーバージョンはエンドユーザ API の変更に、マイナーバージョンは Chromium のメジャーリリースに、パッチバージョンは新機能やバグ修正に対応していました。 機能を統合する開発者にとっては便利ですが、クライアント向けアプリケーションの開発者には問題が生じます。 Slack、Stride、Teams、Skype、VS Code、Atom、Desktop などのメジャーなアプリの QA テストサイクルは時間がかかることがあり、安定性においては非常に望ましい結果を出します。 これは、バグ修正を吸収しようとする一方で、新しい機能を採用することに高いリスクがあります。</p>\n<p>1.x の方針の例を以下に示します。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-0.png\" alt=\"1.x バージョン管理\"></p>\n<p><code>1.8.1</code> を使用して開発されたアプリケーションは、<code>1.8.2</code> の機能を取り入れるか、修正をバックポートし、新しいリリースラインをメンテナンスすることなしに、<code>1.8.3</code> のバグ修正をとることもできません。</p>\n<h2 id=\"version-20-以降\"><a href=\"#version-20-以降\">Version 2.0 以降</a></h2>\n<p>上に概説されている 1.x の方針から、いくつかの大きな変更があります。 各変更は、開発者/管理者とアプリ開発者のニーズと優先順位を満たすためのものです。</p>\n<ol>\n<li>SemVer の厳格な使用</li>\n<li>semver 準拠の <code>-beta</code> タグの導入</li>\n<li><a href=\"https://conventionalcommits.org/\">conventional commit messages</a> の導入</li>\n<li>しっかり定義された安定ブランチ</li>\n<li><code>master</code> ブランチにはバージョンがなく、安定ブランチのみがバージョン情報を含みます。</li>\n</ol>\n<p>git のブランチ動作の仕組み、npm のタグ付けの仕組み、開発者が期待するべきこと、変更をバックポートする方法について詳しく説明します。</p>\n<h1 id=\"semver\"><a href=\"#semver\">SemVer</a></h1>\n<p>2.0 以降から、Electron は SemVer に従います。</p>\n<p>以下は、変更の種別をそれに対応する SemVer のカテゴリ (メジャー、マイナー、パッチなど) へ明示的に割り当てた表です。</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>メジャーバージョンの単位</th><th>マイナーバージョンの単位</th><th>パッチバージョンの単位</th></tr></thead><tbody><tr><td>互換性を破る Electron API の変更</td><td>互換性を破らない Electron API の変更</td><td>Electron のバグ修正</td></tr><tr><td>Node.js のメジャーバージョン更新</td><td>Node.js のマイナーバージョン更新</td><td>Node.js のパッチバージョン更新</td></tr><tr><td>Chromium のバージョン更新</td><td></td><td>Chromium パッチの修正関連</td></tr></tbody></table>\n<p>注意として、ほとんどの Chromium のアップデートは破壊的とみなされます。 バックポート可能な修正は、パッチとしてチェリーピックされます。</p>\n<h1 id=\"安定ブランチ\"><a href=\"#安定ブランチ\">安定ブランチ</a></h1>\n<p>安定ブランチは、セキュリティまたは安定性に関連する cherry-pick されたコミットのみを取り入れて、master と並行して実行されるブランチです。 これらのブランチはマスターに戻されることはありません。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-1.png\" alt=\"安定ブランチ\"></p>\n<p>Electron 8 以降、安定化ブランチは常に <strong>major</strong> のバージョンラインであり、テンプレート <code>$MAJOR-x-y</code> に沿って <code>8-x-y</code> のように名前を付けます。  以前は <strong>minor</strong> のバージョンラインを使用しており、<code>$MAJOR-$MINOR-x</code> に沿って <code>2-0-x</code> のような名前にしていました。</p>\n<p>複数の安定化ブランチを同時に存在させることができます。また、必要に応じてセキュリティ修正を後方移植しながら、少なくとも2つのサポートを常に並行してサポートする予定です。 <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-2.png\" alt=\"複数の安定化ブランチ\"></p>\n<p>それより古いものは GitHub ではサポートされませんが、他のグループは所有権を持って、自分自身で安定性とセキュリティの修正をバックポートできます。 これはお勧めできませんが、多くのアプリ開発者にとってライフが楽になると認識しています。</p>\n<h1 id=\"ベータリリースとバグ修正\"><a href=\"#ベータリリースとバグ修正\">ベータリリースとバグ修正</a></h1>\n<p>開発者はどのリリースが <em>安全</em> に使用できるかを知りたいものです。 一見無害な機能でさえ、複雑なアプリケーションに後退をもたらすことがあります。 同時に、あなたのバージョンから出るセキュリティパッチとバグ修正の可能性を無視しているので、固定バージョンへのロックは危険です。 私たちの目標は、<code>package.json</code> で以下のように標準的な semver 範囲を許可することです。</p>\n<ul>\n<li><code>~2.0.0</code> を使用すると、<code>2.0.0</code> リリースに対する安定性またはセキュリティ関連の修正のみを認めます。</li>\n<li><code>^2.0.0</code> を使用すると、セキュリティやバグ修正だけでなく、破壊的でない <em>合理的で安定した</em> 機能も認めます。</li>\n</ul>\n<p>2つ目の点に関して重要なことは、<code>^</code> を使用しているアプリはまだ妥当なレベルの安定性を期待できることです。 これを実現するために、SemVer では特定のバージョンがまだ <em>安全</em> または <em>安定</em> ではないことを示す <em>プレリリース識別子</em> を指定できるようになっています。</p>\n<p>どれを選択しても、破壊的な変更は Chromium が寿命である事実であるため、定期的に <code>package.json</code> 内のバージョンを更新する必要があります。</p>\n<p>プロセスは以下の通りです。</p>\n<ol>\n<li>すべての新しいメジャーリリースラインとマイナーリリースラインは、<code>2.0.0-beta.1</code> のような <code>beta.N</code> の SemVer プレリリースタグで示されたベータ系列で始めます。 最初のベータ版の後、その後のベータ版リリースは以下のすべての条件を満たす必要があります。<ol>\n<li>変更は API に後方互換性がある (非推奨は構いません)</li>\n<li>安定版のスケジュールを守るリスクが低くなければならない。</li>\n</ol></li>\n<li>リリースがベータ版になった後に許可された変更を加える必要がある場合は、それらが適用され、例として <code>2.0.0-beta.2</code> のようにプレリリースタグが増分されます。</li>\n<li>特定のベータリリースが <em>一般的に安定している</em> と見なされている場合、バージョン情報のみを変更して、安定したビルドとして再リリースされます。 例として、<code>2.0.0</code> のようになります。 最初の安定版以降は、すべての変更は後方互換性のあるバグまたはセキュリティ修正でなければなりません。</li>\n<li>リリースが安定した後に将来のバグ修正やセキュリティパッチを作成する必要がある場合は、それらを適用して、例として <code>2.0.1</code> のように、<em>patch</em> のバージョンを増やします。</li>\n</ol>\n<p>具体的に言うと、以下が上記の意味です。</p>\n<ol>\n<li>たとえそれらの変更が中程度の副作用を引き起こす可能性があるとしても、ベータサイクルの 3 週間前の段階で非破壊的な API の変更を承認することは問題ありません。</li>\n<li>ベータサイクルのほとんどの時点で、既存のコードパスを変更しない、機能フラグの変更を認めることは問題ありません。 ユーザーは自分のアプリでこれらのフラグを明示的に有効にできます。</li>\n<li>ベータサイクル第 3 週以降での新機能の採択は、よほどの理由がない限り 👎 です。</li>\n</ol>\n<p>メジャーとマイナーのバージョン上げのそれぞれにおいて、以下のようなものが見えるはずです。</p>\n<pre><code class=\"hljs language-plaintext\">2.0.0-beta.1\n2.0.0-beta.2\n2.0.0-beta.3\n2.0.0\n2.0.1\n2.0.2\n</code></pre>\n<p>以下は絵に描いたライフサイクルの例です。</p>\n<ul>\n<li>最新の一連の機能を含む新しいリリースブランチが作成されます。 これは <code>2.0.0-beta.1</code> として公開されます。 <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-3.png\" alt=\"新規リリースブランチ\"></li>\n<li>リリースブランチにバックポートできるバグ修正がマスターに入ります。 このパッチは適用され、新しいベータ <code>2.0.0-beta.2</code> として公開されます。 <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-4.png\" alt=\"ベータへのバグ修正のバックポート\"></li>\n<li>このベータ版は <em>一般的に安定している</em> と見なされています。そして <code>2.0.0</code> の下に非ベータ版として再度公開されます。 <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-5.png\" alt=\"ベータから安定版へ\"></li>\n<li>その後、ゼロデイのエクスプロイトが発覚し、マスターに修正が適用されます。 修正を <code>2-0-x</code> のラインにバックポートし、<code>2.0.1</code> をリリースします。 <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-6.png\" alt=\"セキュリティバックポート\"></li>\n</ul>\n<p>以下に、さまざまな SemVer 範囲で新リリースを取得する例をいくつか示します。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-7.png\" alt=\"semver とリリース\"></p>\n<h1 id=\"失なわれた機能-アルファ\"><a href=\"#失なわれた機能-アルファ\">失なわれた機能: アルファ</a></h1>\n<p>私たちの戦略にはいくつかのトレードオフがありますが、今のところそれは適切だと感じています。 最も重要なことは、master の新機能が安定したリリースラインに到達するまでにはしばらく時間がかかることです。 すぐに新しい機能を試したい場合は、自分で Electron をビルドする必要があります。</p>\n<p>今後の検討事項として、以下のうちの一方または両方を紹介する可能性があります。</p>\n<ul>\n<li>ベータ版に対する安定性の制約が緩いアルファリリース。 例えば、安定チャネルが <em>alpha</em> の間に新しい特徴を認めることが許容される。</li>\n</ul>\n<h1 id=\"機能フラグ\"><a href=\"#機能フラグ\">機能フラグ</a></h1>\n<p>機能フラグは Chromium で一般的な方法であり、Web 開発エコシステムではよく確立されています。 Electron のコンテキストでは、機能フラグまたは <strong>ソフトブランチ</strong> には次のプロパティが必要です。</p>\n<ul>\n<li>実行時またはビルド時に有効/無効になるもの。リクエストスコープ付き機能フラグの概念はサポートしていない</li>\n<li>新旧のコードパスを完全に断片化するもの。 新しい機能をサポートするために古いコードをリファクタリングすると機能フラグ規約に <em>違反する</em></li>\n<li>機能のリリース後、機能フラグは最終的に削除される</li>\n</ul>\n<h1 id=\"セマンティックなコミット\"><a href=\"#セマンティックなコミット\">セマンティックなコミット</a></h1>\n<p>私達は更新およびリリースプロセスのすべてのレベルで明快さを増すよう努めます。 <code>2.0.0</code> 以降、プルリクエストは <a href=\"https://conventionalcommits.org/\">従来のコミット</a> の仕様に準拠する必要があります。これは以下のようにまとめることができます。</p>\n<ul>\n<li>\n<p><strong>major</strong> バージョンを上げるコミットの本文は <code>BREAKING CHANGE:</code> で始まる必要があります。</p>\n</li>\n<li>\n<p><strong>minor</strong> バージョンを上げるコミットは <code>feat:</code> で始まる必要があります。</p>\n</li>\n<li>\n<p><strong>patch</strong> バージョンを上げるコミットは <code>fix:</code> で始まる必要があります。</p>\n</li>\n<li>\n<p>squash したメッセージも上記のメッセージフォーマットを遵守するという条件下で、コミットの squash を許可します。</p>\n</li>\n<li>\n<p>プルリクエストのタイトルが意味のある包括的なセマンティックメッセージを含むのであれば、プルリクエストにおけるいくつかのコミットがセマンティックプレフィックスを含まないことは許容できます。</p>\n</li>\n</ul>\n<h1 id=\"バージョン付けされた-master\"><a href=\"#バージョン付けされた-master\">バージョン付けされた <code>master</code></a></h1>\n<ul>\n<li><code>master</code> ブランチは、常に <code>package.json</code> に次のメジャーバージョンの <code>X.0.0-nightly.DATE</code> を含みます。</li>\n<li>リリースブランチが master にマージし戻されることはありません。</li>\n<li>リリースブランチは <code>package.json</code> 内に正しいバージョンを含んで <em>います</em></li>\n<li>リリースブランチがメジャーバージョンのために切られた場合、master は即座に次のメジャーバージョンへ上げる必要があります。  つまり、 <code>master</code> は常に理論上次のリリースブランチとしてバージョン管理されます</li>\n</ul>",
      "title": "Electronのバージョン管理",
      "description": "バージョン管理ポリシーと実装の詳細をご覧ください。"
    },
    "/docs/development/electron-vs-nwjs": {
      "locale": "ja-JP",
      "slug": "electron-vs-nwjs",
      "href": "/docs/development/electron-vs-nwjs",
      "crowdinFileId": "256155",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/electron-vs-nwjs.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"electron-と-nwjs-との技術的差異\"><a href=\"#electron-と-nwjs-との技術的差異\">Electron と NW.js との技術的差異</a></h1>\n<p><a href=\"https://nwjs.io/\">NW.js</a> のように、Electron はウェブ技術を使ったデスクトップアプリケーションを書くプラットフォームを提供します。 どちらのプラットフォームも、開発者は HTML、JavaScript、Node.js が利用できます。 表面上は、とても似ています。</p>\n<p>しかし、この 2 つのプロジェクトには根本的な違いがあり、Electron と NW.js は完全に別物です。</p>\n<h2 id=\"1-アプリケーションのエントリ\"><a href=\"#1-アプリケーションのエントリ\">1) アプリケーションのエントリ</a></h2>\n<p>NW.js では、アプリケーションのメインエントリポイントを HTML ウェブページにできます。 その場合、NW.js は指定のエントリポイントをブラウザウインドウで開きます。</p>\n<p>Electron では、エントリポイントは常に JavaScript スクリプトです。 URL を直接指定するのではなく、手動でブラウザウィンドウを作成し、API で HTML ファイルをロードします。 アプリケーションを終了するタイミングを決めるため、ウインドウイベントを監視する必要もあります。</p>\n<p>Electron は Node.js ランタイムのように動作します。 Electron の API はローレベルなので、<a href=\"https://phantomjs.org/\">PhantomJS</a> 代わりのブラウザテストに使うことができます。</p>\n<h2 id=\"2-node-インテグレーション\"><a href=\"#2-node-インテグレーション\">2) Node インテグレーション</a></h2>\n<p>NW.js では、ウェブページで Node インテグレーションをするには Chromium にパッチを当てる必要があります。Electron では Chromium のハッキングを避けるために各プラットフォームのメッセージループに <code>libuv</code> ループを統合する、別の選択をしました。 これがどのように行われているかについては <a href=\"https://github.com/electron/electron/tree/main/lib/common\"><code>node_bindings</code></a> コードを参照してください。</p>\n<h2 id=\"3-javascript-コンテキスト\"><a href=\"#3-javascript-コンテキスト\">3) JavaScript コンテキスト</a></h2>\n<p>NW.js の経験者であれば、Node コンテキストやウェブコンテキストの概念をご存知でしょう。 これらの概念は、NW.js の実装手段から考案されたものです。</p>\n<p>Node の <a href=\"https://github.com/nodejs/node-v0.x-archive/commit/756b622\">マルチコンテキスト</a> 機能を使用すると、Electron はウェブページ内に新しい JavaScript コンテキストを導入しません。</p>\n<p>注釈: NW.js は 0.13 からマルチコンテキストを任意でサポートしています。</p>\n<h2 id=\"4-レガシーサポート\"><a href=\"#4-レガシーサポート\">4) レガシーサポート</a></h2>\n<p>NW.js では、Windows XP 対応の \"レガシーリリース\" がまだ提供されています。 これはセキュリティアップデートを受けません。</p>\n<p>ハードウェアメーカー、Microsoft、Chromium、Node.js がシステムの重大セキュリティアップデートすらリリースしていないことを鑑みると、Windows XP の使用は危険であり、完全に自己責任であることを警告しなければなりません。</p>\n<p>しかし、私たちの想像を超える要件が存在する可能性があることは理解しています。Windows XP で動作する Electron のようなものをお探しであれば、NW.js のレガシーリリースをお勧めします。</p>\n<h2 id=\"5-機能\"><a href=\"#5-機能\">5) 機能</a></h2>\n<p>サポートする機能の量は多くの差異があります。 Electron にはより大きなコミュニティがあり、これを使用するアプリ製品の数も多く、<a href=\"https://www.npmjs.com/search?q=electron\">npm</a> で利用できる大量のユーザー製モジュールがあります。</p>\n<p>例えば、Electron には自動更新サポートが組み込まれており、インストーラ作成を容易にする無数のツールも用意されています。 NW.js の良いところを挙げると、NW.js は Chrome アプリ開発向けに <code>Chrome.*</code> API を数多くサポートしています。</p>\n<p>もちろん、ウェブ技術で構築された、洗練されたアプリケーション製品 (Visual Studio Code、Slack、Facebook Messenger など) のプラットフォームとしては Electron の方が優れていると考えます。しかし、ウェブ技術の仲間たるもの公平でありたいです。 Electron にはない機能が必要であれば、NW.js を試すのもいいかもしれません。</p>",
      "title": "Electron と NW.js との技術的差異",
      "description": ""
    },
    "/docs/api/environment-variables": {
      "locale": "ja-JP",
      "slug": "environment-variables",
      "href": "/docs/api/environment-variables",
      "crowdinFileId": "256315",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/environment-variables.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"環境変数\"><a href=\"#環境変数\">環境変数</a></h1>\n<blockquote>\n<p>コードを変更することなくアプリケーションの設定と動作を制御します。</p>\n</blockquote>\n<p>いくつかのElectronの動作は、コマンドラインのフラグやアプリのコードよりも早く初期化されるため、環境変数によって制御されます。</p>\n<p>POSIXシェルの例:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">export</span> ELECTRON_ENABLE_LOGGING=<span class=\"hljs-literal\">true</span>\n$ electron\n</code></pre>\n<p>Windowsコンソールの例:</p>\n<pre><code class=\"hljs language-powershell\">> set ELECTRON_ENABLE_LOGGING=true\n> electron\n</code></pre>\n<h2 id=\"製品用の変数\"><a href=\"#製品用の変数\">製品用の変数</a></h2>\n<p>以下の環境変数は、主にパッケージ化されたElectronアプリケーションで実行時に使用するためのものです。</p>\n<h3 id=\"node_options\"><a href=\"#node_options\"><code>NODE_OPTIONS</code></a></h3>\n<p>Electron は Node の <a href=\"https://nodejs.org/api/cli.html#cli_node_options_options\"><code>NODE_OPTIONS</code></a> の一部をサポートに含んでいます。 Chromium の BoringSSL の使用と衝突するものを除き、大多数はサポートされています。</p>\n<p>サンプル:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">export</span> NODE_OPTIONS=<span class=\"hljs-string\">\"--no-warnings --max-old-space-size=2048\"</span>\n</code></pre>\n<p>以下はサポートされていないオプションです。</p>\n<pre><code class=\"hljs language-sh\">--use-bundled-ca\n--force-fips\n--<span class=\"hljs-built_in\">enable</span>-fips\n--openssl-config\n--use-openssl-ca\n</code></pre>\n<p><code>NODE_OPTIONS</code> は、以下のようにしない限りパッケージされたアプリ内では明示的に許可されません。</p>\n<pre><code class=\"hljs language-sh\">--max-http-header-size\n--http-parser\n</code></pre>\n<h3 id=\"google_api_key\"><a href=\"#google_api_key\"><code>GOOGLE_API_KEY</code></a></h3>\n<p>Electron での地理位置情報サポートには、Google Cloud Platform の地理位置情報ウェブサービスの利用が必要です。 この機能を有効にするには、<a href=\"https://developers.google.com/maps/documentation/geolocation/get-api-key\">Google API キー</a> を取得し、ジオロケーション要求を行うブラウザウィンドウを開く前に、以下のコードをメインプロセスファイルに配置してください。</p>\n<pre><code class=\"hljs language-javascript\">process.env.GOOGLE_API_KEY = <span class=\"hljs-string\">'YOUR_KEY_HERE'</span>\n</code></pre>\n<p>デフォルトでは、新しく生成された Google API キーではジオロケーションリクエストを行えない場合があります。 プロジェクトで地理位置情報ウェブサービスを有効にするには、<a href=\"https://console.cloud.google.com/apis/library\">API ライブラリ</a> から有効にしてください。</p>\n<p>注: 地理位置情報ウェブサービスが動作するには、API キーに関連付けられたプロジェクトに <a href=\"https://cloud.google.com/billing/docs/how-to/payment-methods#add_a_payment_method\">請求先アカウント</a> を追加する必要があります。</p>\n<h3 id=\"electron_no_asar\"><a href=\"#electron_no_asar\"><code>ELECTRON_NO_ASAR</code></a></h3>\n<p>ASAR サポートを無効にします。 この変数は、<code>ELECTRON_RUN_AS_NODE</code> を設定したフォークされた子プロセスと生成された子プロセスでのみサポートされます。</p>\n<h3 id=\"electron_run_as_node\"><a href=\"#electron_run_as_node\"><code>ELECTRON_RUN_AS_NODE</code></a></h3>\n<p>通常のNode.jsプロセスとしてプロセスを開始します。</p>\n<p>このモードでは、以下のフラグを除いて、通常の Node.js 実行ファイルを実行しているときと同じように <a href=\"https://nodejs.org/api/cli.html\">CLI 引数</a> を Node.js に渡せます。</p>\n<ul>\n<li>\"--openssl-config\"</li>\n<li>\"--use-bundled-ca\"</li>\n<li>\"--use-openssl-ca\",</li>\n<li>\"--force-fips\"</li>\n<li>\"--enable-fips\"</li>\n</ul>\n<p>これらのフラグは、Electron が Node.js の <code>crypto</code> モジュール構築に OpenSSL ではなく BoringSSL を使用しているため、設計通りに動作せず無効になっています。</p>\n<h3 id=\"electron_no_attach_console-windows\"><a href=\"#electron_no_attach_console-windows\"><code>ELECTRON_NO_ATTACH_CONSOLE</code> <em>Windows</em></a></h3>\n<p>現在のコンソールセッションにアタッチしません。</p>\n<h3 id=\"electron_force_window_menu_bar-linux\"><a href=\"#electron_force_window_menu_bar-linux\"><code>ELECTRON_FORCE_WINDOW_MENU_BAR</code> <em>Linux</em></a></h3>\n<p>Linuxのグローバルメニューバーを使用しません。</p>\n<h3 id=\"electron_trash-linux\"><a href=\"#electron_trash-linux\"><code>ELECTRON_TRASH</code> <em>Linux</em></a></h3>\n<p>Linux でゴミの実装を設定します。 既定値は <code>gio</code> です。</p>\n<p>オプション:</p>\n<ul>\n<li><code>gvfs-trash</code></li>\n<li><code>trash-cli</code></li>\n<li><code>kioclient5</code></li>\n<li><code>kioclient</code></li>\n</ul>\n<h2 id=\"開発用の変数\"><a href=\"#開発用の変数\">開発用の変数</a></h2>\n<p>以下の環境変数は、主に開発とデバッグを目的としています。</p>\n<h3 id=\"electron_enable_logging\"><a href=\"#electron_enable_logging\"><code>ELECTRON_ENABLE_LOGGING</code></a></h3>\n<p>コンソールに Chromium の内部ログを出力します。</p>\n<p>この変数への設定は、コマンドラインで <code>--enable-logging</code> を渡すのと同じです。 詳しくは、<a href=\"/docs/api/command-line-switches#enable-loggingfile\">コマンドラインスイッチ</a> の <code>--enable-logging</code> をご覧ください。</p>\n<h3 id=\"electron_log_file\"><a href=\"#electron_log_file\"><code>ELECTRON_LOG_FILE</code></a></h3>\n<p>Chromium の内部ログの保存先ファイルを設定します。</p>\n<p>この変数への設定は、コマンドラインで <code>--log-file</code> を渡すのと同じです。 詳細は、 <a href=\"/docs/api/command-line-switches#log-filepath\">コマンドラインスイッチ</a> の <code>--log-file</code> をご参照ください。</p>\n<h3 id=\"electron_debug_drag_regions\"><a href=\"#electron_debug_drag_regions\"><code>ELECTRON_DEBUG_DRAG_REGIONS</code></a></h3>\n<p>macOS での <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a> のドラッグ可能な領域に色を付けます。ドラッグ可能な領域は緑、ドラッグ不可能な領域は赤で表示され、デバッグを支援します。</p>\n<h3 id=\"electron_debug_notifications\"><a href=\"#electron_debug_notifications\"><code>ELECTRON_DEBUG_NOTIFICATIONS</code></a></h3>\n<p>macOS での <a href=\"/docs/api/notification\"><code>Notification</code></a> ライフサイクルにさらなるログを追加し、デバッグを支援します。 新しい通知の作成や有効化のタイミングで、そのさらなるログが表示されます。 これは、通知が表示されたり、解除されたり、そのボタンがクリックされたり、返信されたりといった一般的なアクションが実行されたときにも表示されます。</p>\n<p>以下は出力例です。</p>\n<pre><code class=\"hljs language-sh\">Notification created (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification displayed (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification activated (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification replied to (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\n</code></pre>\n<h3 id=\"electron_log_asar_reads\"><a href=\"#electron_log_asar_reads\"><code>ELECTRON_LOG_ASAR_READS</code></a></h3>\n<p>Electron が ASAR ファイルから読み込むときに、読み取りオフセットとファイルパスをシステムの <code>tmpdir</code> へログとして出力します。 ファイルの順番を最適化するために、結果のファイルを ASAR モジュールへ与えられます。</p>\n<h3 id=\"electron_enable_stack_dumping\"><a href=\"#electron_enable_stack_dumping\"><code>ELECTRON_ENABLE_STACK_DUMPING</code></a></h3>\n<p>Electronがクラッシュすると、コンソールにスタックトレースを出力します。</p>\n<p><code>crashReporter</code> が開始されている場合、この環境変数は機能しません。</p>\n<h3 id=\"electron_default_error_mode-windows\"><a href=\"#electron_default_error_mode-windows\"><code>ELECTRON_DEFAULT_ERROR_MODE</code> <em>Windows</em></a></h3>\n<p>Electronがクラッシュすると、Windowsのクラッシュダイアログを表示します。</p>\n<p><code>crashReporter</code> が開始されている場合、この環境変数は機能しません。</p>\n<h3 id=\"electron_override_dist_path\"><a href=\"#electron_override_dist_path\"><code>ELECTRON_OVERRIDE_DIST_PATH</code></a></h3>\n<p><code>electron</code> パッケージを実行しているとき、この変数は <code>npm install</code> によってダウンロードされた代わりの Electron の指定ビルドを使用するための <code>electron</code> コマンドを知らせます。 使い方:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">export</span> ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Testing\n</code></pre>\n<h2 id=\"electron-による設定\"><a href=\"#electron-による設定\">Electron による設定</a></h2>\n<p>Electron は実行時に環境変数をいくつか設定します。</p>\n<h3 id=\"original_xdg_current_desktop\"><a href=\"#original_xdg_current_desktop\"><code>ORIGINAL_XDG_CURRENT_DESKTOP</code></a></h3>\n<p>この変数には、アプリケーション が起動した <code>XDG_CURRENT_DESKTOP</code> の値が設定されます。  Electron は <code>XDG_CURRENT_DESKTOP</code> の値を変更して Chromium 内の他のロジックに影響を与えることがあるので、<em>元々</em> の値にアクセスしたい場合は、代わりにこの環境変数を見る必要があります。</p>",
      "title": "環境変数",
      "description": "コードを変更することなくアプリケーションの設定と動作を制御します。"
    },
    "/docs/api/structures/event": {
      "locale": "ja-JP",
      "slug": "event",
      "href": "/docs/api/structures/event",
      "crowdinFileId": "256429",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"event-object-extends-globalevent\"><a href=\"#event-object-extends-globalevent\">Event Object extends <code>GlobalEvent</code></a></h1>\n<ul>\n<li><code>preventDefault</code> VoidFunction</li>\n</ul>",
      "title": "Event Object extends GlobalEvent",
      "description": ""
    },
    "/docs/experimental": {
      "locale": "ja-JP",
      "slug": "experimental",
      "href": "/docs/experimental",
      "crowdinFileId": "256119",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/experimental.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"実験的な-api\"><a href=\"#実験的な-api\">実験的な API</a></h1>\n<p>いくつかの Electrons API のドキュメントには、<code>_Experimental_</code> というタグが付けられています。 このタグは、その API が不安定であろうと考えられており、他の API に比べて警告をあまりせずに API の削除や変更が頻繁に行われるかもしれないということです。</p>\n<h2 id=\"api-が-experimental-とタグ付けされる条件\"><a href=\"#api-が-experimental-とタグ付けされる条件\">API が Experimental とタグ付けされる条件</a></h2>\n<p>新機能の PR では、誰でも API を実験的なものとしてタグ付けるよう要求できます。新機能が実験的かどうかに関する意見の相違が PR で解決できない場合、API WG で議論にかけることができます。</p>\n<h2 id=\"実験的なタグ付けを取り除くプロセス\"><a href=\"#実験的なタグ付けを取り除くプロセス\">実験的なタグ付けを取り除くプロセス</a></h2>\n<p>その API が安定しており、2 つ以上のメジャー安定版のリリースラインにある場合は、API の実験的なタグ付けの削除指名ができます。  この議論は API WG ミーティングで執り行われます。  議論/指名の際に考慮すべきこと:</p>\n<ul>\n<li>上記の \"2つのメジャーリリースライン\" の条件を満たしていること</li>\n<li>その間、この機能の採用で大きなバグや問題が発生しなかったこと</li>\n<li>API が十分に安定しており、Chromium のアップグレードに大きな影響を受けないこと</li>\n<li>その API を使う人がいるのかどうか</li>\n<li>API は提案当初のユースケースを満たしていて、かけ離れていないどうか</li>\n</ul>",
      "title": "実験的な API",
      "description": ""
    },
    "/docs/api/structures/extension": {
      "locale": "ja-JP",
      "slug": "extension",
      "href": "/docs/api/structures/extension",
      "crowdinFileId": "256433",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/extension.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"extension-object\"><a href=\"#extension-object\">Extension Object</a></h1>\n<ul>\n<li><code>id</code> String</li>\n<li><code>manifest</code> any - Copy of the <a href=\"https://developer.chrome.com/extensions/manifest\">extension's manifest data</a>.</li>\n<li><code>name</code> String</li>\n<li><code>path</code> String - The extension's file path.</li>\n<li><code>version</code> String</li>\n<li><code>url</code> String - The extension's <code>chrome-extension://</code> URL.</li>\n</ul>",
      "title": "Extension Object",
      "description": ""
    },
    "/docs/api/structures/extension-info": {
      "locale": "ja-JP",
      "slug": "extension-info",
      "href": "/docs/api/structures/extension-info",
      "crowdinFileId": "256431",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/extension-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"extensioninfo-object\"><a href=\"#extensioninfo-object\">ExtensionInfo Object</a></h1>\n<ul>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>",
      "title": "ExtensionInfo Object",
      "description": ""
    },
    "/docs/api/extensions": {
      "locale": "ja-JP",
      "slug": "extensions",
      "href": "/docs/api/extensions",
      "crowdinFileId": "256317",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/extensions.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"chrome-拡張機能サポート\"><a href=\"#chrome-拡張機能サポート\">Chrome 拡張機能サポート</a></h1>\n<p>Electron は <a href=\"https://developer.chrome.com/extensions/api_index\">Chrome 拡張機能 API</a> のサブセットをサポートしており、主にデベロッパー ツール拡張機能と Chromium 内部拡張機能をサポートしていますが、他の拡張機能もサポートしています。</p>\n<blockquote>\n<p><strong>注意:</strong> Electron はストアのすべての Chrome 拡張機能はサポートしていません。Chrome の拡張機能の実装と完全に互換性を持たせることは Electron プロジェクトの <strong>目標ではありません</strong>。</p>\n</blockquote>\n<h2 id=\"拡張機能の読み込み\"><a href=\"#拡張機能の読み込み\">拡張機能の読み込み</a></h2>\n<p>Electron は解凍された拡張機能のみの読み込みをサポートしています (例えば <code>.crx</code> ファイルは動作しません)。 拡張機能は <code>session</code> ごとにインストールされます。 拡張機能を読み込むには、以下のように <a href=\"/docs/api/session#sesloadextensionpath-options\"><code>ses.loadExtension</code></a> を呼び出します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession.loadExtension(<span class=\"hljs-string\">'path/to/unpacked/extension'</span>).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ id }</span>) =></span> {\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<p>読み込まれた拡張機能は終了時に自動で記憶されません。アプリを実行する度に<code>loadExtension</code> を呼び出さないと、拡張子は読み込まれません。</p>\n<p>注意として、拡張機能の読み込みは持続する session でのみサポートされます。 拡張機能をメモリで一時的な session に読み込もうとすると、エラーが送出されます。</p>\n<p>有効な拡張機能の読み込み、解除、クエリについての詳細は <a href=\"/docs/api/session\"><code>session</code></a> のドキュメントを参照してください。</p>\n<h2 id=\"サポートする拡張機能-api\"><a href=\"#サポートする拡張機能-api\">サポートする拡張機能 API</a></h2>\n<p>いくつかの注意点はありますが、以下の拡張機能 API をサポートしています。 他の API も追加でサポートされる可能性がありますが、ここに記載されていない API のサポートは暫定であり、削除される可能性があります。</p>\n<h3 id=\"chromedevtoolsinspectedwindow\"><a href=\"#chromedevtoolsinspectedwindow\"><code>chrome.devtools.inspectedWindow</code></a></h3>\n<p>この API はすべての機能がサポートされています。</p>\n<h3 id=\"chromedevtoolsnetwork\"><a href=\"#chromedevtoolsnetwork\"><code>chrome.devtools.network</code></a></h3>\n<p>この API はすべての機能がサポートされています。</p>\n<h3 id=\"chromedevtoolspanels\"><a href=\"#chromedevtoolspanels\"><code>chrome.devtools.panels</code></a></h3>\n<p>この API はすべての機能がサポートされています。</p>\n<h3 id=\"chromeextension\"><a href=\"#chromeextension\"><code>chrome.extension</code></a></h3>\n<p><code>chrome.extension</code> のうち以下のプロパティがサポートされています。</p>\n<ul>\n<li><code>chrome.extension.lastError</code></li>\n</ul>\n<p><code>chrome.extension</code> のうち以下のメソッドがサポートされています。</p>\n<ul>\n<li><code>chrome.extension.getURL</code></li>\n<li><code>chrome.extension.getBackgroundPage</code></li>\n</ul>\n<h3 id=\"chromeruntime\"><a href=\"#chromeruntime\"><code>chrome.runtime</code></a></h3>\n<p><code>chrome.runtime</code> のうち以下のプロパティがサポートされています。</p>\n<ul>\n<li><code>chrome.runtime.lastError</code></li>\n<li><code>chrome.runtime.id</code></li>\n</ul>\n<p><code>chrome.runtime</code> のうち以下のメソッドがサポートされています。</p>\n<ul>\n<li><code>chrome.runtime.getBackgroundPage</code></li>\n<li><code>chrome.runtime.getManifest</code></li>\n<li><code>chrome.runtime.getPlatformInfo</code></li>\n<li><code>chrome.runtime.getURL</code></li>\n<li><code>chrome.runtime.connect</code></li>\n<li><code>chrome.runtime.sendMessage</code></li>\n<li><code>chrome.runtime.reload</code></li>\n</ul>\n<p><code>chrome.runtime</code> のうち以下のイベントがサポートされています。</p>\n<ul>\n<li><code>chrome.runtime.onStartup</code></li>\n<li><code>chrome.runtime.onInstalled</code></li>\n<li><code>chrome.runtime.onSuspend</code></li>\n<li><code>chrome.runtime.onSuspendCanceled</code></li>\n<li><code>chrome.runtime.onConnect</code></li>\n<li><code>chrome.runtime.onMessage</code></li>\n</ul>\n<h3 id=\"chromestorage\"><a href=\"#chromestorage\"><code>chrome.storage</code></a></h3>\n<p><code>chrome.storage.local</code> のみがサポートされており、<code>chrome.storage.sync</code> と <code>chrome.storage.managed</code> はサポートされていません。</p>\n<h3 id=\"chrometabs\"><a href=\"#chrometabs\"><code>chrome.tabs</code></a></h3>\n<p><code>chrome.tabs</code> のうち以下のメソッドがサポートされています。</p>\n<ul>\n<li><code>chrome.tabs.sendMessage</code></li>\n<li><code>chrome.tabs.executeScript</code></li>\n</ul>\n<blockquote>\n<p><strong>注:</strong> Chrome では、タブ ID に <code>-1</code> を渡すと \"現在アクティブなタブ\" を意味します。 Electron にはそのような概念がないため、タブ ID として <code>-1</code> を渡すことはサポートされておらず、エラーとなります。</p>\n</blockquote>\n<h3 id=\"chromemanagement\"><a href=\"#chromemanagement\"><code>chrome.management</code></a></h3>\n<p><code>chrome.management</code> のうち以下のメソッドがサポートされています。</p>\n<ul>\n<li><code>chrome.management.getAll</code></li>\n<li><code>chrome.management.get</code></li>\n<li><code>chrome.management.getSelf</code></li>\n<li><code>chrome.management.getPermissionWarningsById</code></li>\n<li><code>chrome.management.getPermissionWarningsByManifest</code></li>\n<li><code>chrome.management.onEnabled</code></li>\n<li><code>chrome.management.onDisabled</code></li>\n</ul>\n<h3 id=\"chromewebrequest\"><a href=\"#chromewebrequest\"><code>chrome.webRequest</code></a></h3>\n<p>この API はすべての機能がサポートされています。</p>\n<blockquote>\n<p><strong>注意:</strong> ハンドラが競合する場合は、<code>chrome.webRequest</code> より Electron の <a href=\"/docs/api/web-request\"><code>webRequest</code></a> モジュールのものが優先されます。</p>\n</blockquote>",
      "title": "Chrome 拡張機能サポート",
      "description": "注意: Electron はストアのすべての Chrome 拡張機能はサポートしていません。Chrome の拡張機能の実装と完全に互換性を持たせることは Electron プロジェクトの 目標ではありません。"
    },
    "/docs/faq": {
      "locale": "ja-JP",
      "slug": "faq",
      "href": "/docs/faq",
      "crowdinFileId": "256121",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/faq.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-faq\"><a href=\"#electron-faq\">Electron FAQ</a></h1>\n<h2 id=\"electronがインストールできません。\"><a href=\"#electronがインストールできません。\">Electronがインストールできません。</a></h2>\n<p><code>npm install electron</code> を実行するとき、インストール時エラーが発生する場合があります。</p>\n<p>ほとんどの場合、このエラーはネットワークによるもので、<code>electron</code> の npm パッケージに問題はありません。 <code>ELIFECYCLE</code>、<code>EAI_AGAIN</code>、<code>ECONNRESET</code>、<code>ETIMEDOUT</code> といったエラーは、ネットワーク上の問題を示しています。 最善の解決策は、ネットワークを切り替えるか、少し待ってからもう一度インストールしてることです。</p>\n<p><code>npm</code> でのインストールに失敗する場合、Electron を <a href=\"https://github.com/electron/electron/releases\">electron/electron/releases</a> から直接ダウンロードすることもできます。</p>\n<h2 id=\"electronはいつ最新版のchromeにアップグレードされるのですか？\"><a href=\"#electronはいつ最新版のchromeにアップグレードされるのですか？\">Electronはいつ最新版のChromeにアップグレードされるのですか？</a></h2>\n<p>Electron 内の Chrome のバージョンは、通常であれば新しい Chrome の安定バージョンがリリースされてから 1 ~ 2 週間以内に更新します。 この期間というのは保証されておらず、バージョンアップの作業量にも依存します。</p>\n<p>Chrome の安定版のみを使用します。 重要な修正が beta や dev 版にある場合、それをバックポートします。</p>\n<p>より詳しい情報は、<a href=\"/docs/tutorial/security\">セキュリティについて</a> を参照してください。</p>\n<h2 id=\"electronはいつ最新版のnodejsにアップグレードされるのですか？\"><a href=\"#electronはいつ最新版のnodejsにアップグレードされるのですか？\">Electronはいつ最新版のNode.jsにアップグレードされるのですか？</a></h2>\n<p>新しいバージョンの Node.js がリリースされた後、通常であれば Electron 内の Node.js のアップグレードまで約 1 ヶ月待ちます。 これにより、新しい Node.js のリリースでよく発生するバグの影響を避けることができます。</p>\n<p>通常、Node.js の新しい機能は V8 のアップグレードによってもたらされますが、Electron は Chrome ブラウザーに搭載されている V8 を使用しているので、新しい Node.js に入ったばかりのピカピカに新しい JavaScript 機能は Electron ではたいてい既に導入されています。</p>\n<h2 id=\"どうやってウェブページ間でデータを共有するのでしょうか\"><a href=\"#どうやってウェブページ間でデータを共有するのでしょうか\">どうやってウェブページ間でデータを共有するのでしょうか?</a></h2>\n<p>ウェブページ (レンダラープロセス) 間でデータを共有する最も単純な方法は、ブラウザで既に提供されている HTML5 API を使用することです。 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Storage\">Storage API</a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage\"><code>localStorage</code></a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage\"><code>sessionStorage</code></a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API\">IndexedDB</a> といった良い選択肢があります。</p>\n<p>Alternatively, you can use the IPC primitives that are provided by Electron. To share data between the main and renderer processes, you can use the <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> and <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> modules. ウェブページ間で直接通信するには、<a href=\"/docs/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage()</code></a> でメインプロセスを経由して一方から他方に <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> を送ることによってできます。 Subsequent communication over message ports is direct and does not detour through the main process.</p>\n<h2 id=\"数分経つとアプリの-tray-が消失します。\"><a href=\"#数分経つとアプリの-tray-が消失します。\">数分経つとアプリの tray が消失します。</a></h2>\n<p>これは、tray を格納している変数がガベージコレクトされると発生します。</p>\n<p>以下のドキュメントが参考になるはずです。</p>\n<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management\">メモリ管理</a></li>\n<li><a href=\"https://msdn.microsoft.com/library/bzt2dkta(v=vs.94).aspx\">変数スコープ</a></li>\n</ul>\n<p>もし簡単に修正したい場合は、コードを以下のように修正して変数をグローバルにすると良いでしょう。以下の部分を</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/icon.png'</span>)\n  tray.setTitle(<span class=\"hljs-string\">'hello world'</span>)\n})\n</code></pre>\n<p>以下のように変更します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> tray = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/icon.png'</span>)\n  tray.setTitle(<span class=\"hljs-string\">'hello world'</span>)\n})\n</code></pre>\n<h2 id=\"jqueryrequirejsmeteorangularjsがelectronで使えません\"><a href=\"#jqueryrequirejsmeteorangularjsがelectronで使えません\">jQuery/RequireJS/Meteor/AngularJSがElectronで使えません</a></h2>\n<p>Electron の Node.js 組み込みの影響で、<code>module</code>、<code>exports</code>、<code>require</code> のような余分なシンボルが DOM に追加されています。 このため、いくつかのライブラリでは同名のシンボルを追加しようとして問題が発生することがあります。</p>\n<p>これを解決するために、Electron の node integration を無効にできます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// メインプロセス</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\nwin.show()\n</code></pre>\n<p>それでも Node.js と Electron API を使用した機能を維持したい場合は、他ライブラリを読み込む前に、ページ内のそのシンボル名を変更する必要があります。</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-built_in\">window</span>.nodeRequire = <span class=\"hljs-built_in\">require</span>;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.require;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.exports;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.module;\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/javascript\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"jquery.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n</code></pre>\n<h2 id=\"requireelectronxxx-が未定義です。\"><a href=\"#requireelectronxxx-が未定義です。\"><code>require('electron').xxx</code> が未定義です。</a></h2>\n<p>Electron の組み込みモジュールを使うと、以下のエラーに遭遇するかもしれません。</p>\n<pre><code class=\"hljs language-sh\">> require(<span class=\"hljs-string\">'electron'</span>).webFrame.setZoomFactor(1.0)\nUncaught TypeError: Cannot <span class=\"hljs-built_in\">read</span> property <span class=\"hljs-string\">'setZoomLevel'</span> of undefined\n</code></pre>\n<p>これは、間違ったプロセスでモジュールを使用している可能性が高いです。 たとえば、<code>electron.app</code> はメインプロセスのみ、<code>electron.webFrame</code> はレンダラープロセスのみで利用できます。</p>\n<h2 id=\"フォントがぼやけます。これはどういうものでどうすればいいのですか\"><a href=\"#フォントがぼやけます。これはどういうものでどうすればいいのですか\">フォントがぼやけます。これはどういうものでどうすればいいのですか?</a></h2>\n<p><a href=\"https://alienryderflex.com/sub_pixel/\">サブピクセルアンチエイリアス</a> が無効だと、液晶画面上のフォントはぼやけて見えます。 サンプル:</p>\n<p><img src=\"/docs/images/subpixel-rendering-screenshot.gif\" alt=\"サブピクセルレンダリングの例\"></p>\n<p>サブピクセルアンチエイリアスは不透明なレイヤーの背景が必要で、そのレイヤーはフォントグリフを含みます。 (詳しくは <a href=\"https://github.com/electron/electron/issues/6344#issuecomment-420371918\">この issue</a> を参照してください)。</p>\n<p>この目的を達成するには、<a href=\"/docs/api/browser-window\">BrowserWindow</a> のコンストラクタで背景を設定しましょう。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#fff'</span>\n})\n</code></pre>\n<p>この効果は (一部の?) 液晶画面でしか見られません。 違いが見えなくても、ユーザーの中には違って見える人がいるかもしれません。 こうしてはいけない理由がなければ、背景は基本的にこのように設定するのが良いでしょう。</p>\n<p>CSS で背景を設定するだけでは期待する効果はないことに注意してください。</p>",
      "title": "Electron FAQ",
      "description": ""
    },
    "/docs/api/structures/file-filter": {
      "locale": "ja-JP",
      "slug": "file-filter",
      "href": "/docs/api/structures/file-filter",
      "crowdinFileId": "256435",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/file-filter.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"filefilter-object\"><a href=\"#filefilter-object\">FileFilter Object</a></h1>\n<ul>\n<li><code>name</code> String</li>\n<li><code>extensions</code> String[]</li>\n</ul>",
      "title": "FileFilter Object",
      "description": ""
    },
    "/docs/api/file-object": {
      "locale": "ja-JP",
      "slug": "file-object",
      "href": "/docs/api/file-object",
      "crowdinFileId": "256319",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/file-object.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"fileオブジェクト\"><a href=\"#fileオブジェクト\"><code>File</code>オブジェクト</a></h1>\n<blockquote>\n<p>ファイルシステム上のファイルでネイティブに機能するHTML5 <code>File</code> APIを使用します。</p>\n</blockquote>\n<p>DOMのファイルインターフェースは、ユーザーがHTML5ファイルAPIで直接ネイティブファイルを扱えるように、ネイティブファイルを抽象化します。 Electronは、<code>File</code> インターフェースにファイルシステム上のファイルの実際のパスを公開する <code>path</code> 属性を追加しています。</p>\n<p>アプリの上にドラッグされたファイルから実際のパスを取得する例:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">div</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"holder\"</span>></span>\n  ファイルをここにドラッグ\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">div</span>></span>\n\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  <span class=\"hljs-built_in\">document</span>.addEventListener(<span class=\"hljs-string\">'drop'</span>, (e) => {\n    e.preventDefault();\n    e.stopPropagation();\n\n    <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> f <span class=\"hljs-keyword\">of</span> e.dataTransfer.files) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'File(s) you dragged here: '</span>, f.path)\n    }\n  });\n  <span class=\"hljs-built_in\">document</span>.addEventListener(<span class=\"hljs-string\">'dragover'</span>, (e) => {\n    e.preventDefault();\n    e.stopPropagation();\n  });\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>",
      "title": "Fileオブジェクト",
      "description": "ファイルシステム上のファイルでネイティブに機能するHTML5 File APIを使用します。"
    },
    "/docs/api/structures/file-path-with-headers": {
      "locale": "ja-JP",
      "slug": "file-path-with-headers",
      "href": "/docs/api/structures/file-path-with-headers",
      "crowdinFileId": "256437",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/file-path-with-headers.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"filepathwithheaders-object\"><a href=\"#filepathwithheaders-object\">FilePathWithHeaders Object</a></h1>\n<ul>\n<li><code>path</code> String - The path to the file to send.</li>\n<li><code>headers</code> Record&#x3C;string, string> (optional) - Additional headers to be sent.</li>\n</ul>",
      "title": "FilePathWithHeaders Object",
      "description": ""
    },
    "/docs/api/frameless-window": {
      "locale": "ja-JP",
      "slug": "frameless-window",
      "href": "/docs/api/frameless-window",
      "crowdinFileId": "256321",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/frameless-window.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"フレームレスウインドウ\"><a href=\"#フレームレスウインドウ\">フレームレスウインドウ</a></h1>\n<blockquote>\n<p>ツールバー、境界やその他のグラフィカルな\"枠\"のないウインドウを開きます。</p>\n</blockquote>\n<p>フレームレスウインドウは、Webページの一部ではないツールバーのようなウインドウの部品である <a href=\"https://developer.mozilla.org/en-US/docs/Glossary/Chrome\">chrome</a> を持たないウインドウです。 これらは、<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> クラスのオプションです。</p>\n<h2 id=\"フレームレスウィンドウを作成\"><a href=\"#フレームレスウィンドウを作成\">フレームレスウィンドウを作成</a></h2>\n<p>フレームレスウインドウを作成するには、<a href=\"/docs/api/browser-window\">BrowserWindow</a> の <code>options</code> で <code>frame</code> を <code>false</code> に設定する必要があります。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h3 id=\"代替手段\"><a href=\"#代替手段\">代替手段</a></h3>\n<p>macOS と Windows ではフレームレスウインドウを指定する方法が他にあります。 タイトルバーとウインドウコントロールの両方が無効になる <code>frame</code> を <code>false</code> に設定する方法の代わりに、タイトルバーを非表示にし、コンテンツをフルウインドウサイズに拡大しつつ、標準のウインドウアクションのためにウインドウコントロール (macOS での \"信号ボタン\") を保持し続けることもできます。 <code>titleBarStyle</code> オプションを指定すると、そのようにすることができます。</p>\n<h4 id=\"hidden\"><a href=\"#hidden\"><code>hidden</code></a></h4>\n<p>タイトルバーが隠れ、フルサイズのコンテンツウインドウになります。 macOS では、タイトルバーの左上に標準ウインドウコントロール (\"信号機ボタン\") が付きます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span> })\nwin.show()\n</code></pre>\n<h3 id=\"macosでの他の方法\"><a href=\"#macosでの他の方法\">macOSでの他の方法</a></h3>\n<h4 id=\"hiddeninset\"><a href=\"#hiddeninset\"><code>hiddenInset</code></a></h4>\n<p>ウインドウの端から信号ボタンが少し埋め込まれた別の見た目でタイトルバーが非表示になります。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span> })\nwin.show()\n</code></pre>\n<h4 id=\"custombuttonsonhover\"><a href=\"#custombuttonsonhover\"><code>customButtonsOnHover</code></a></h4>\n<p>ウインドウの左上にカーソルを合わせたときに表示されるカスタム描画の閉じる、最小化ボタンを使用します。 フルスクリーンボタンは、フレームレスウインドウの制約のために利用できません。Apple の macOS ウインドウマスクと被るからです。 これらのボタンは標準のウインドウツールバーボタンで発生するマウスイベントの問題を防止します。 このオプションは、フレームレスウインドウにのみ適用されます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'customButtonsOnHover'</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h2 id=\"ウインドウコントロールオーバーレイ\"><a href=\"#ウインドウコントロールオーバーレイ\">ウインドウコントロールオーバーレイ</a></h2>\n<p>フレームレスウインドウを macOS の <code>win.setWindowButtonVisibility(true)</code> と組み合わせて使用したり、信号機ボタンが見えるように上述の <code>titleBarStyle</code> のいずれかを使用したり、Windows の <code>titleBarStyle: hidden</code> を使用したりしているとき、<code>titleBarOverlay</code> のオプションを true に設定するとウィンドウコントロールオーバーレイ [JavaScript API][overlay-javascript-apis] と <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables\">CSS 環境変数</a> にアクセスできます。 <code>true</code> を指定すると、オーバーレイはデフォルトのシステムカラーになります。</p>\n<p>Windows では、<code>color</code> と <code>symbolColor</code> のオプションで作った <code>titleBarOverlay</code> オブジェクトを設定することで、オーバーレイとそのシンボルの色指定もできます。 以下のようにオプションを指定しない場合、ウインドウコントロールボタンの色はデフォルトでシステムカラーになります。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span>,\n  <span class=\"hljs-attr\">titleBarOverlay</span>: <span class=\"hljs-literal\">true</span>\n})\nwin.show()\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span>,\n  <span class=\"hljs-attr\">titleBarOverlay</span>: {\n    <span class=\"hljs-attr\">color</span>: <span class=\"hljs-string\">'#2f3241'</span>,\n    <span class=\"hljs-attr\">symbolColor</span>: <span class=\"hljs-string\">'#74b1be'</span>\n  }\n})\nwin.show()\n</code></pre>\n<h2 id=\"透明なウインドウ\"><a href=\"#透明なウインドウ\">透明なウインドウ</a></h2>\n<p><code>transparent</code> オプションを <code>true</code> に設定することで、フレームレスウインドウを透明にすることもできます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">transparent</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h3 id=\"制限事項\"><a href=\"#制限事項\">制限事項</a></h3>\n<ul>\n<li>透明な領域越しにクリックすることはできません。 これを解決するためにウインドウ形状を設定するAPIを紹介しようと思います。詳細は、<a href=\"https://github.com/electron/electron/issues/1335\">我々の課題</a>を参照して下さい。</li>\n<li>透明なウィンドウは、サイズを変更できません。 <code>resizable</code> を <code>true</code> に設定すると、いくつかのプラットフォームでは透明なウインドウが機能しなくなることがあります。</li>\n<li><code>blur</code> フィルターはWebページにしか適用されないため、ウインドウの下にあるコンテンツ (すなわち、ユーザーのシステムで開かれた他のアプリケーション) にぼかし効果を適用する方法はありません。</li>\n<li>デベロッパー ツールが開かれているとウインドウは透過しません。</li>\n<li>Windows オペレーティングシステムの場合、<ul>\n<li>DWM が無効だと透過ウインドウが動作しません。</li>\n<li>Windows システムメニューの利用やタイトルバーのダブルクリックでは、透過ウインドウを最大化できません。 背景にある理由は <a href=\"https://github.com/electron/electron/pull/28207\">このプルリクエスト</a> に記載してあります。</li>\n</ul></li>\n<li>Linux では、GPU を無効にして透明なウインドウを作成するための ARGB を許可するため、ユーザーがコマンドラインに <code>--enable-transparent-visuals --disable-gpu</code> を指定しなければなりません。これは、Linux における <a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=369209\">いくつかの NVidia ドライバーでアルファチャンネルが機能しない</a> という上流のバグによるものです。</li>\n<li>Mac では、ネイティブウインドウの影は透明なウインドウには表示されません。</li>\n</ul>\n<h2 id=\"クリックスルーウインドウ\"><a href=\"#クリックスルーウインドウ\">クリックスルーウインドウ</a></h2>\n<p>クリックスルーウインドウを作成する、すなわち、ウインドウにすべてのマウスイベントを無視させるには、<a href=\"/docs/api/browser-window#winsetignoremouseeventsignore-options\">win.setIgnoreMouseEvents(ignore)</a> APIを呼び出して下さい。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.setIgnoreMouseEvents(<span class=\"hljs-literal\">true</span>)\n</code></pre>\n<h3 id=\"転送\"><a href=\"#転送\">転送</a></h3>\n<p>マウスのメッセージを無視すると、Webページでマウスの移動が検出されなくなり、マウスの移動イベントが発生しません。 Windowsオペレーティングシステムでは、<code>mouseleave</code> のようなイベントを発生させられるよう、マウスの移動メッセージをWebページに転送するのに、オプションパラメーターが使用されます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> el = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'clickThroughElement'</span>)\nel.addEventListener(<span class=\"hljs-string\">'mouseenter'</span>, () => {\n  ipcRenderer.send(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, <span class=\"hljs-literal\">true</span>, { <span class=\"hljs-attr\">forward</span>: <span class=\"hljs-literal\">true</span> })\n})\nel.addEventListener(<span class=\"hljs-string\">'mouseleave'</span>, () => {\n  ipcRenderer.send(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, <span class=\"hljs-literal\">false</span>)\n})\n\n<span class=\"hljs-comment\">// メインプロセス</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, (event, ...args) => {\n  BrowserWindow.fromWebContents(event.sender).setIgnoreMouseEvents(...args)\n})\n</code></pre>\n<p>これにより、<code>el</code> の上のとき、Webページはクリックスルーになり、その外側では、通常に戻ります。</p>\n<h2 id=\"ドラッグ可能な領域\"><a href=\"#ドラッグ可能な領域\">ドラッグ可能な領域</a></h2>\n<p>既定では、フレームレスウインドウはドラッグできません。 アプリは、どの領域が (OSの標準のタイトルバーのように) ドラッグ可能であるかをElectronに伝えるため、CSSで <code>-webkit-app-region: drag</code> を指定することが必要です。また、アプリは、ドラッグ可能な領域からドラッグ不可能な領域を除外するため、<code>-webkit-app-region: no-drag</code> を使用することもできます。 現在のところ、長方形の形状しかサポートされていないことに注意して下さい。</p>\n<p>注: <code>-webkit-app-region: drag</code> は、開発者ツールが開かれている間、問題があることが知られています。 回避策を含む詳細については、この <a href=\"https://github.com/electron/electron/issues/3647\">GitHub Issue</a> を参照して下さい。</p>\n<p>ウインドウ全体をドラッグ可能にするには、<code>body</code> のスタイルとして <code>-webkit-app-region: drag</code> を追加して下さい。</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"-webkit-app-region: drag\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n</code></pre>\n<p>そして、ウインドウ全体をドラッグ可能にした場合、ボタンをドラッグ不可として同時にマークしなければなりません。そうでなければ、ユーザーがボタンをクリックすることができなくなります。</p>\n<pre><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">button</span> {\n  <span class=\"hljs-attribute\">-webkit-app-region</span>: no-drag;\n}\n</code></pre>\n<p>カスタムのタイトルバーをドラッグ可能に設定するだけの場合、同時にタイトルバーのすべてのボタンもドラッグ不可にする必要があります。</p>\n<h2 id=\"テキストの選択\"><a href=\"#テキストの選択\">テキストの選択</a></h2>\n<p>フレームレスウインドウでは、ドラッグの挙動がテキストの選択と競合する可能性があります。 例えば、タイトルバーをドラッグするとき、誤ってタイトルバーのテキストを選択する可能性があります。 これを防止するには、このようにドラッグ可能な領域内のテキスト選択を無効にする必要があります。</p>\n<pre><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.titlebar</span> {\n  <span class=\"hljs-attribute\">-webkit-user-select</span>: none;\n  <span class=\"hljs-attribute\">-webkit-app-region</span>: drag;\n}\n</code></pre>\n<h2 id=\"コンテキストメニュー\"><a href=\"#コンテキストメニュー\">コンテキストメニュー</a></h2>\n<p>いくつかのプラットフォームでは、ドラッグ可能な領域は非クライアントのフレームとして扱われます。そのため、ドラッグ可能な領域を右クリックすると、システムメニューが現れます。 すべてのプラットフォームでコンテキストメニューが正しく動作するようにするには、絶対にカスタムのコンテキストメニューをドラッグ可能な領域で使用しないようにしてください。</p>\n<p>[overlay-javascript-apis]: <a href=\"https://github\">https://github</a>. com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis</p>",
      "title": "フレームレスウインドウ",
      "description": "ツールバー、境界やその他のグラフィカルな\"枠\"のないウインドウを開きます。"
    },
    "/docs/tutorial/fuses": {
      "locale": "ja-JP",
      "slug": "fuses",
      "href": "/docs/tutorial/fuses",
      "crowdinFileId": "256201",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/fuses.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-fuse\"><a href=\"#electron-fuse\">Electron Fuse</a></h1>\n<blockquote>\n<p>パッケージ時機能切り替え</p>\n</blockquote>\n<h2 id=\"fuse-とはなんでしょうか\"><a href=\"#fuse-とはなんでしょうか\">Fuse とはなんでしょうか?</a></h2>\n<p>Electron は機能の集合体なので、アプリケーション全体に渡って特定の機能を無効化しても合理的です。  例えば、99% のアプリは <code>ELECTRON_RUN_AS_NODE</code> を利用しないので、そういったアプリでその機能が利用できないバイナリを頒布できるようにしたいのです。  Electron の消費者がソースから Electron を構築することは技術的に大きな障害であり時間とお金両方のコストがかかるため、それも避けたいと考えています。</p>\n<p>Fuse はこの問題の解決策です。高水準としては Electron バイナリ内の \"マジックビット\" であり、Electron アプリをパッケージングする際にそれらを反転させることで、特定の機能や制限を有効化/無効化できます。  アプリのコード署名前のパッケージ時に反転するので、OS は OS レベルのコード署名検証(Gatekeeper / App Locker) の時に反転しないようにする責任があります。</p>\n<h2 id=\"fuse-の反転方法は何ですか\"><a href=\"#fuse-の反転方法は何ですか\">Fuse の反転方法は何ですか?</a></h2>\n<h3 id=\"簡単な方法\"><a href=\"#簡単な方法\">簡単な方法</a></h3>\n<p>これら Fuse を簡単に反転させるために、便利なモジュール <code>@electron/fuses</code> を作成しました。  使用方法や潜在的なエラーケースといった詳細は、このモジュールの README を確認してください。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/fuses'</span>).flipFuses(\n  <span class=\"hljs-comment\">// electron のパス</span>\n  <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>),\n  <span class=\"hljs-comment\">// 反転する Fuse</span>\n  {\n    <span class=\"hljs-attr\">runAsNode</span>: <span class=\"hljs-literal\">false</span>\n  }\n)\n</code></pre>\n<h3 id=\"難しい方法\"><a href=\"#難しい方法\">難しい方法</a></h3>\n<h4 id=\"簡易用語集\"><a href=\"#簡易用語集\">簡易用語集</a></h4>\n<ul>\n<li><strong>Fuse Wire</strong>: Fuse の制御に使用する Electron バイナリ内のバイト列</li>\n<li><strong>Sentinel</strong>: Fuse Wire の位置特定に使用できる静的な既知のバイト列</li>\n<li><strong>Fuse Schema</strong>: Fuse Wire が許容する値の形式</li>\n</ul>\n<p>手動で Fuse を反転させるには、Electron バイナリを編集し必要な Fuse の状態を表すバイト列になるように Fuse Wire を修正する必要があります。</p>\n<p>Electron バイナリのどこかに、以下のようなバイト列があります。</p>\n<pre><code class=\"hljs language-plaintext\">| ...binary | sentinel_bytes | fuse_version | fuse_wire_length | fuse_wire | ...binary |\n</code></pre>\n<ul>\n<li><code>sentinel_bytes</code> は厳密にこのような文字列 <code>dL7pKGdnNz796PbbjQWNKmHXBZaB9tsX</code> です</li>\n<li><code>fuse_version</code> は単一バイトで、その符号無し整数の値が Fuse Schema のバージョンを表します。</li>\n<li><code>fuse_wire_length</code> は単一バイトで、その符号無し整数の値は後続の Fuse Wire にある Fuse の数を表します。</li>\n<li><code>fuse_wire</code> は N バイトのシーケンスで、各バイトは 1 つの Fuse とその状態を表します。<ul>\n<li>\"0\" (0x30) は無効な Fuse を表します</li>\n<li>\"1\" (0x31) は有効な Fuse を表します</li>\n<li>\"r\" (0x72) は削除された Fuse を表し、このバイトを 1 や 0 に変更しても効果はありません。</li>\n</ul></li>\n</ul>\n<p>Fuse を反転させるには、Fuse Wire の位置を見つけ、状態に応じて \"0\" または \"1\" に変更します。</p>\n<p>現在のスキーマは <a href=\"https://github.com/electron/electron/blob/main/build/fuses/fuses.json5\">こちら</a> で閲覧できます。</p>",
      "title": "Electron Fuse",
      "description": "パッケージ時機能切り替え"
    },
    "/docs/api/global-shortcut": {
      "locale": "ja-JP",
      "slug": "global-shortcut",
      "href": "/docs/api/global-shortcut",
      "crowdinFileId": "256323",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/global-shortcut.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"globalshortcut\"><a href=\"#globalshortcut\">globalShortcut</a></h1>\n<blockquote>\n<p>アプリケーションにキーボードフォーカスがないときにキーボードイベントを検出します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>globalShortcut</code> モジュールは、オペレーティングシステムに対してグローバルショートカットを登録/登録解除することができます。そのため、様々なショートカットに対する操作をカスタマイズすることができます。</p>\n<p><strong>注:</strong> ショートカットはグローバルです。そのため、アプリにキーボードフォーカスがない場合でも機能します。 app モジュールの <code>ready</code> イベントが発生するよりも前では、このモジュールは使用できません。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// 'CommandOrControl+X' ショートカットのリスナーを登録します。</span>\n  <span class=\"hljs-keyword\">const</span> ret = globalShortcut.register(<span class=\"hljs-string\">'CommandOrControl+X'</span>, () => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'CommandOrControl+X is pressed'</span>)\n  })\n\n  <span class=\"hljs-keyword\">if</span> (!ret) {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'registration failed'</span>)\n  }\n\n  <span class=\"hljs-comment\">// ショートカットが登録されているかどうかをチェックします。</span>\n  <span class=\"hljs-built_in\">console</span>.log(globalShortcut.isRegistered(<span class=\"hljs-string\">'CommandOrControl+X'</span>))\n})\n\napp.on(<span class=\"hljs-string\">'will-quit'</span>, () => {\n  <span class=\"hljs-comment\">// ショートカットを登録解除します。</span>\n  globalShortcut.unregister(<span class=\"hljs-string\">'CommandOrControl+X'</span>)\n\n  <span class=\"hljs-comment\">// すべてのショートカットを登録解除します。</span>\n  globalShortcut.unregisterAll()\n})\n</code></pre>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>globalShortcut</code> モジュールには以下のメソッドがあります。</p>\n<h3 id=\"globalshortcutregisteraccelerator-callback\"><a href=\"#globalshortcutregisteraccelerator-callback\"><code>globalShortcut.register(accelerator, callback)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n<li><code>callback</code> Function</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - ショートカットが正常に登録されたかどうか.</p>\n<p><code>accelerator</code> のグローバルショートカットを登録します。 <code>callback</code> は登録したショートカットがユーザに押下されたときに呼び出されます。</p>\n<p>アクセラレータが他のアプリケーションによってすでに使用されている場合、この呼び出しは何も通知することなく失敗します。 この動作は、アプリケーションにグローバルショートカットの取り合いをさせたくないため、オペレーティングシステムによって意図されたものです。</p>\n<p>以下のアクセラレータは、アプリが <a href=\"https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html\">信頼できるアクセシビリティクライアント</a> として認識されていない限り macOS 10.14 Mojave に正常に登録されません。</p>\n<ul>\n<li>\"Media Play/Pause\"</li>\n<li>\"Media Next Track\"</li>\n<li>\"Media Previous Track\"</li>\n<li>\"Media Stop\"</li>\n</ul>\n<h3 id=\"globalshortcutregisterallaccelerators-callback\"><a href=\"#globalshortcutregisterallaccelerators-callback\"><code>globalShortcut.registerAll(accelerators, callback)</code></a></h3>\n<ul>\n<li><code>accelerators</code> String[] - <a href=\"/docs/api/accelerator\">Accelerator</a>の配列</li>\n<li><code>callback</code> Function</li>\n</ul>\n<p><code>accelerators</code> 内の全ての <code>accelerator</code> のグローバルショートカットを登録します。 <code>callback</code> は登録したいずれかのショートカットがユーザに押下されたときに呼び出されます。</p>\n<p>与えられたアクセラレータが他のアプリケーションによってすでに使用されている場合、この呼び出しは何も通知することなく失敗します。 この動作は、アプリケーションにグローバルショートカットの取り合いをさせたくないため、オペレーティングシステムによって意図されたものです。</p>\n<p>以下のアクセラレータは、アプリが <a href=\"https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html\">信頼できるアクセシビリティクライアント</a> として認識されていない限り macOS 10.14 Mojave に正常に登録されません。</p>\n<ul>\n<li>\"Media Play/Pause\"</li>\n<li>\"Media Next Track\"</li>\n<li>\"Media Previous Track\"</li>\n<li>\"Media Stop\"</li>\n</ul>\n<h3 id=\"globalshortcutisregisteredaccelerator\"><a href=\"#globalshortcutisregisteredaccelerator\"><code>globalShortcut.isRegistered(accelerator)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n</ul>\n<p>戻り値 <code>Boolean</code> - このアプリケーションが <code>accelerator</code> を登録したかどうか。</p>\n<p>アクセラレータが他のアプリケーションによってすでに使用されている場合、この呼び出しは <code>false</code> を返すはずです。 この動作は、アプリケーションにグローバルショートカットの取り合いをさせたくないため、オペレーティングシステムによって意図されたものです。</p>\n<h3 id=\"globalshortcutunregisteraccelerator\"><a href=\"#globalshortcutunregisteraccelerator\"><code>globalShortcut.unregister(accelerator)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n</ul>\n<p><code>accelerator</code> のグローバルショートカットを登録解除します。</p>\n<h3 id=\"globalshortcutunregisterall\"><a href=\"#globalshortcutunregisterall\"><code>globalShortcut.unregisterAll()</code></a></h3>\n<p>すべてのグローバルショートカットを登録解除します。</p>",
      "title": "globalShortcut",
      "description": "アプリケーションにキーボードフォーカスがないときにキーボードイベントを検出します。"
    },
    "/docs/glossary": {
      "locale": "ja-JP",
      "slug": "glossary",
      "href": "/docs/glossary",
      "crowdinFileId": "256123",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/glossary.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"用語集\"><a href=\"#用語集\">用語集</a></h1>\n<p>このページでは、Electron の開発で一般的に使用される用語を示します。</p>\n<h3 id=\"asar\"><a href=\"#asar\">ASAR</a></h3>\n<p>ASARはAtom Shell Archive Formatの略語です。 <a href=\"https://github.com/electron/asar\">asar</a>アーカイブは、複数のファイルを1つにまとめる<code>tar</code>ライクでシンプルなアーカイブ形式です。 Electron はASARファイルから全体を解凍せずに任意のファイルを読み出すことができます。</p>\n<p>ASAR フォーマットは、主に Windows で大量の小さなファイルを読み込むとき (例: アプリケーションの JavaScript 依存関係ツリーを <code>node_modules</code> から読み込む場合など) のパフォーマンス向上のために作成されました。</p>\n<h3 id=\"コード署名\"><a href=\"#コード署名\">コード署名</a></h3>\n<p>コード署名とは、アプリ開発者によるパッケージ作成後のコード改ざんを検出するために、コードにデジタル署名を行う処理です。 Windows と macOS はどちらも独自のコード署名を実装しています。 デスクトップアプリケーションの開発者としてコードを一般公衆に頒布する予定の方は、コード署名が重要です。</p>\n<p>詳しい情報については、<a href=\"/docs/tutorial/code-signing\">コード署名</a> のチュートリアルをご参照ください。</p>\n<h3 id=\"コンテキストの分離\"><a href=\"#コンテキストの分離\">コンテキストの分離</a></h3>\n<p>コンテキストの分離は Electron によるセキュリティ施策で、プリロードスクリプトが特権的な Electron や Node.js の API をレンダラープロセスのウェブコンテンツに漏らさないようにします。 コンテキストの分離を有効にすると、プリロードスクリプトから API を公開するには <code>contextBridge</code> API を使用するしかありません。</p>\n<p>詳しい情報については、<a href=\"/docs/tutorial/context-isolation\">コンテキストの分離</a> のチュートリアルをご参照ください。</p>\n<p>関連項目: <a href=\"#preload-script\">プリロードスクリプト</a>、<a href=\"#renderer-process\">レンダラープロセス</a></p>\n<h3 id=\"crt\"><a href=\"#crt\">CRT</a></h3>\n<p>C ランタイム ライブラリ (CRT, C Run-time Library) は ISO C99 標準ライブラリが組み込まれている C++ 標準ライブラリの一部です。 ネイティブコード開発、ネイティブコードと管理コードの混在した開発、.Netの純粋な管理コードをサポートするCRTを実装するVisual C++ライブラリ</p>\n<h3 id=\"dmg\"><a href=\"#dmg\">DMG</a></h3>\n<p>Apple Disk Image (DMG) はmacOSで使用されるパッケージング形式です。 DMGファイルはインストーラーアプリケーションを配布するために使用されます。</p>\n<h3 id=\"ime\"><a href=\"#ime\">IME</a></h3>\n<p>Input Method Editorの略で、日本では「かな漢字変換システム」を指します。 日本のユーザにとっては何を今更という説明になりますが、漢字などキーボード上に存在しない文字や記号を入力するためのツールです。 日本語、中国語、韓国語に限らず、インドの言語などもIMEを使用することでアルファベット（ローマ字）から入力することができます。</p>\n<h3 id=\"idl\"><a href=\"#idl\">IDL</a></h3>\n<p>Interface description language、インターフェイス記述言語のことです。 Java、C++、JavaScript などのインターフェース生成に使用できるフォーマットで、関数のシグネチャやデータ型を記述します。</p>\n<h3 id=\"ipc\"><a href=\"#ipc\">IPC</a></h3>\n<p>IPC は Inter-Process Communication、プロセス間通信の略です。 Electron では IPC を、メインプロセスとレンダラープロセスの間でのシリアライズした JSON メッセージの送信に使用します。</p>\n<p><a href=\"#main-process\">メインプロセス</a>、<a href=\"#renderer-process\">レンダラープロセス</a>についても参照してください。</p>\n<h3 id=\"メインプロセス-main-process\"><a href=\"#メインプロセス-main-process\">メインプロセス (main process)</a></h3>\n<p>メインプロセスは通常 <code>main.js</code> というファイル名で配置され、Electron アプリのエントリポイントになります。 これはアプリが開始してから終了するまでを制御します。 また、メニュー、メニューバー、ドック、タスクトレイなどのネイティブ要素の管理も担当します。 メインプロセスは、アプリ内のレンダラプロセスの作成も担います。 完全な Node API を使用できます。</p>\n<p>各アプリのメインプロセスファイルは、<code>package.json</code> の <code>main</code> プロパティに指定します。 <code>electron .</code> はここから起動時に実行するファイルを取得します。</p>\n<p>Chromium では、このプロセスを \"ブラウザプロセス\" と呼びます。 レンダラープロセスとの混同を避けるため、Electron では名前を変更しています。</p>\n<p><a href=\"#process\">プロセス</a>、<a href=\"#renderer-process\">レンダラープロセス</a>についても参照してください。</p>\n<h3 id=\"mas\"><a href=\"#mas\">MAS</a></h3>\n<p>Apple の Mac App Store の頭文字をつなげたものです。 MAS へのアプリ登録の詳細は、<a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store 登録ガイド</a> を参照してください。</p>\n<h3 id=\"mojo\"><a href=\"#mojo\">Mojo</a></h3>\n<p>プロセス内またはプロセス間で通信するための IPC システムです。これが重要なのは、Chrome がメモリの圧迫などに応じて作業を別プロセスに分割できるかどうかを判断しているためです。</p>\n<p>（参照： <a href=\"https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md\">https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md</a> ）</p>\n<p>関連項目: <a href=\"#ipc\">IPC</a></p>\n<h3 id=\"msi\"><a href=\"#msi\">MSI</a></h3>\n<p>Windows では、アプリケーションのインストールと設定のために Windows Installer (別称 Microsoft Installer) サービスが MSI パッケージを使用します。</p>\n<p>詳しい情報は <a href=\"https://docs.microsoft.com/en-us/windows/win32/msi/windows-installer-portal\">Microsoft のドキュメント</a> に記載されています。</p>\n<h3 id=\"ネイティブモジュール-native-module\"><a href=\"#ネイティブモジュール-native-module\">ネイティブモジュール (native module)</a></h3>\n<p>ネイティブ モジュールはNode.js では<a href=\"https://nodejs.org/api/addons.html\">アドオン</a> とも呼ばれ、requireによってNode.jsやElectronへ読み込むことの出来る、C またはC++で書かれたモジュールです。通常のNode.jsモジュールと同様に使用することが出来ます。 主に、Node.jsで実行されているJavaScript と C/C++ のライブラリ間のインタフェースを提供するために使用されます。</p>\n<p>Electronは、ネイティブのNodeモジュールをサポートしていますが、システム上にインストールされたNodeとは異なるV8バージョンを使用しているので、ネイティブモジュールでビルドする時、Electronのヘッダーの場所を手動で指定する必要があります。</p>\n<p>詳しい情報については、[ネイティブ Node モジュール] のチュートリアルをご参照ください。</p>\n<h3 id=\"公証\"><a href=\"#公証\">公証</a></h3>\n<p>公証とは、macOS 特有のプロセスで、開発者がコード署名したアプリをアップルのサーバーに送り、自動サービスによって悪意あるコンポーネントの有無を検証してもらうものです。</p>\n<p>関連項目: <a href=\"#code-signing\">コード署名</a></p>\n<h3 id=\"osr\"><a href=\"#osr\">OSR</a></h3>\n<p>OSR (offscreen rendering、オフスクリーンレンダリング) を使用すると、重いページをバックグラウンドで読み込みんだ後で表示することができます (かなりの高速化が期待されます)。 画面に表示することなくページをレンダリングできます。</p>\n<p>詳しい情報については、<a href=\"/docs/tutorial/offscreen-rendering\">オフスクリーンレンダリング</a>[osr] のチュートリアルをご参照ください。</p>\n<h3 id=\"プリロードスクリプト\"><a href=\"#プリロードスクリプト\">プリロードスクリプト</a></h3>\n<p>プリロードスクリプトは、ウェブコンテンツの読み込み開始前にレンダラープロセス内で実行されるコードです。 これらのスクリプトはレンダラーのコンテキスト内で実行されますが、Node.js の API にアクセスできるようにより多くの権限が与えられています。</p>\n<p>関連項目: <a href=\"#renderer-process\">レンダラープロセス</a>、<a href=\"#context-isolation\">コンテキストの分離</a></p>\n<h3 id=\"プロセス\"><a href=\"#プロセス\">プロセス</a></h3>\n<p>プロセスは、実行されているプログラムのインスタンスです。 Electronでは、<a href=\"#main-process\">メインプロセス</a>と 1つ以上の<a href=\"#renderer-process\">レンダラープロセス</a>が動作しており、実際には同時に複数のプログラムが実行されていることになります。</p>\n<p>Node.jsとElectronでは、実行中のプロセスは、<code>process</code>オブジェクトをもっています。 このオブジェクトは現在のプロセスに関する情報を提供し、また制御を行う広域変数です。 広域変数であるため、require() を使用せずにいつでもアクセスできます。</p>\n<p><a href=\"#main-process\">メインプロセス</a>、<a href=\"#renderer-process\">レンダラープロセス</a>についても参照してください。</p>\n<h3 id=\"レンダラープロセス-renderer-process\"><a href=\"#レンダラープロセス-renderer-process\">レンダラープロセス (renderer process)</a></h3>\n<p>レンダラープロセスは、アプリ内のブラウザウインドウです。 メインプロセスと違って複数存在でき、それぞれ別のプロセスとして動作します。 また、非表示にもできます。</p>\n<p><a href=\"#process\">プロセス</a>、<a href=\"#main-process\">レンダラープロセス</a>についても参照してください。</p>\n<h3 id=\"サンドボックス\"><a href=\"#サンドボックス\">サンドボックス</a></h3>\n<p>サンドボックスとは、Chromium から受け継いだセキュリティ機能で、レンダラープロセスを限られた権限に制限するものです。</p>\n<p>詳しい情報については、<a href=\"/docs/tutorial/sandbox\">プロセスのサンドボックス化</a> のチュートリアルをご参照ください。</p>\n<p>関連項目: <a href=\"#process\">プロセス</a></p>\n<h3 id=\"squirrel\"><a href=\"#squirrel\">Squirrel</a></h3>\n<p>Squirrelは、Electronアプリケーションの新しいバージョンに対する自動更新を可能にするオープンソースフレームワークです。 Squirrelについては <a href=\"/docs/api/auto-updater\">autoUpdater</a> APIを参照してください。</p>\n<h3 id=\"ユーザーランド-userland\"><a href=\"#ユーザーランド-userland\">ユーザーランド (userland)</a></h3>\n<p>Unixコミュニティーに由来する言葉ですが、\"ユーザーランド\"や\"ユーザースペース\"は、Osカーネルの外側で動作するプログラムを意味します。 より最近では、この用語はNodeやnpmコミュニティでは、\"Node core\"で使用できる機能を、大きな\"ユーザー\"コミュニティ npmに登録して公開されたパッケージを区別されるために使用されます。</p>\n<p>Node.jsのように、Electronはマルチプラットフォームなデスクトップアプリケーション開発に必要なすべての原始的機能を提供するスモールセットAPIを提供することに焦点を当てています。 この設計思想により、Electronは過度にルールに則りすぎたものになることなく、柔軟性を持つツールであり続けることが可能になっています。 ユーザーランドは、\"core\"で使用できる物の上に追加機能を提供するツールを作成したり共有したりすることを可能にします。</p>\n<h3 id=\"v8\"><a href=\"#v8\">V8</a></h3>\n<p>V8 は Google のオープンソース JavaScript エンジンです。 C++ で書かれており、Google Chrome で使用されています。 V8 はスタンドアローンで実行することも、任意の C++ アプリケーションに組み込むこともできます。</p>\n<p>Electron は V8 を Chromium の一部としてビルドし、それからNodeをビルドする際に NodeがV8を指すようにします。</p>\n<p>V8 のバージョンは必ず Google Chrome のバージョンに対応しています。 例えば Chrome 59 には V8 5.9 が入っており、Chrome 58 には V8 5.8 が入っています。</p>\n<ul>\n<li><a href=\"https://v8.dev/\">v8.dev</a></li>\n<li><a href=\"https://nodejs.org/api/v8.html\">nodejs.org/api/v8.html</a></li>\n<li><a href=\"/docs/development/v8-development\">docs/development/v8-development.md</a></li>\n</ul>\n<h3 id=\"webview\"><a href=\"#webview\">webview</a></h3>\n<p><code>webview</code> タグは、Electron アプリに 'ゲスト' コンテンツ (外部のウェブページなど) を埋め込むために使用します。 これらは <code>iframe</code> に似ていますが、それぞれの webview が別のプロセスで実行されるという点が異なります。 あなたのウェブページとは同じ権限はもっておらず、アプリと埋め込まれたコンテンツのやりとりは非同期的な物になります。 アプリはこれにより埋め込みコンテンツから安全を保たれます。</p>",
      "title": "用語集",
      "description": ""
    },
    "/docs/development/goma": {
      "locale": "ja-JP",
      "slug": "goma",
      "href": "/docs/development/goma",
      "crowdinFileId": "256157",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/goma.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"goma\"><a href=\"#goma\">Goma</a></h1>\n<blockquote>\n<p>Goma は Chromium や Android などのオープンソースプロジェクト向けに公開されたコンパイラサービスです。</p>\n</blockquote>\n<p>Electron はカスタム Goma バックエンドのデプロイがあり、これはすべての Electron メンテナーが利用できます。  認証詳細情報については以下にある <a href=\"#access\">アクセス</a> の章を参照してください。  資格情報がない場合にデフォルトで使用される <code>cache-only</code> Goma エンドポイントもあります。  cache-only Goma へのリクエストはクラスターにヒットしませんが、キャッシュから読み取るためビルド時間が大幅に短縮されます。</p>\n<h2 id=\"goma-を有効にする\"><a href=\"#goma-を有効にする\">Goma を有効にする</a></h2>\n<p>現在、Goma の使用をサポートしている方法は、<a href=\"https://github.com/electron/build-tools\">ビルドツール</a> の使用のみです。 <code>build-tools</code> をセットアップすると、Goma の設定が自動的にインクルードされます。</p>\n<p>あなたがメンテナーかつクラスターにアクセスできる場合は、Goma クラスターを使用する <code>build-tools</code> を構成するために <code>e init</code> を <code>--goma=cluster</code> 付きで実行するようにしてください。  既存のコンフィグがある場合は、<code>\"goma\": \"cluster\"</code> をコンフィグファイルにセットするだけです。</p>\n<h2 id=\"goma-でのビルド\"><a href=\"#goma-でのビルド\">Goma でのビルド</a></h2>\n<p>Goma を使用している場合、マシンで通常サポートされている値よりも大幅に大きい値の <code>j</code> で <code>ninja</code> を実行できます。</p>\n<p>Windows や Linux では <strong>200</strong>、macOS では <strong>50</strong> より大きい値を設定しないでください。 Goma システムの使用状況は監視されており、不合理な並列実行で Goma システムを悪用していることが判明したユーザーは無効になります。</p>\n<pre><code class=\"hljs language-bash\">ninja -C out/Testing electron -j 200\n</code></pre>\n<p><code>build-tools</code> を使用している場合、適切な <code>-j</code> の値が自動的に使用されます。</p>\n<h2 id=\"goma-の監視\"><a href=\"#goma-の監視\">Goma の監視</a></h2>\n<p>ローカルマシンで <a href=\"http://localhost:8088\">http://localhost:8088</a> にアクセスすると、Goma システムを通過するコンパイルジョブを監視できます。</p>\n<h2 id=\"アクセス\"><a href=\"#アクセス\">アクセス</a></h2>\n<p>現在、セキュリティとコストの理由により Electron Goma へのアクセスは Electron メンテナーに制限されています。  アクセスしたい場合は、Slack の <code>#access-requests</code> にアクセスし、<code>@goma-squad</code> に連絡してアクセスを要求してください。  メンテナーであることはアクセスを <em>自動的に</em> 許可するものではなく、アクセスはその場に応じて許可されることに留意してください。</p>\n<h2 id=\"可用時間--サポート\"><a href=\"#可用時間--サポート\">可用時間 / サポート</a></h2>\n<p><a href=\"https://status.notgoma.com\">https://status.notgoma.com</a> で Goma クラスターとキャッシュの監視を自動化しています</p>\n<p>Goma の使用に対するサポートは提供していません。ヘルプを求める Issue は <em>ほぼ全て</em> 理由なくクローズします。そういったサポートは取り扱いません。</p>",
      "title": "Goma",
      "description": "Goma は Chromium や Android などのオープンソースプロジェクト向けに公開されたコンパイラサービスです。"
    },
    "/docs/api/structures/gpu-feature-status": {
      "locale": "ja-JP",
      "slug": "gpu-feature-status",
      "href": "/docs/api/structures/gpu-feature-status",
      "crowdinFileId": "256439",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/gpu-feature-status.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"gpufeaturestatus-object\"><a href=\"#gpufeaturestatus-object\">GPUFeatureStatus Object</a></h1>\n<ul>\n<li><code>2d_canvas</code> String - Canvas.</li>\n<li><code>flash_3d</code> String - Flash.</li>\n<li><code>flash_stage3d</code> String - Flash Stage3D.</li>\n<li><code>flash_stage3d_baseline</code> String - Flash Stage3D Baseline profile.</li>\n<li><code>gpu_compositing</code> String - Compositing.</li>\n<li><code>multiple_raster_threads</code> String - Multiple Raster Threads.</li>\n<li><code>native_gpu_memory_buffers</code> String - Native GpuMemoryBuffers.</li>\n<li><code>rasterization</code> String - Rasterization.</li>\n<li><code>video_decode</code> String - Video Decode.</li>\n<li><code>video_encode</code> String - Video Encode.</li>\n<li><code>vpx_decode</code> String - VPx Video Decode.</li>\n<li><code>webgl</code> String - WebGL.</li>\n<li><code>webgl2</code> String - WebGL2.</li>\n</ul>\n<p>取りうる値:</p>\n<ul>\n<li><code>disabled_software</code> - Software only. Hardware acceleration disabled (yellow)</li>\n<li><code>disabled_off</code> - Disabled (red)</li>\n<li><code>disabled_off_ok</code> - Disabled (yellow)</li>\n<li><code>unavailable_software</code> - Software only, hardware acceleration unavailable (yellow)</li>\n<li><code>unavailable_off</code> - Unavailable (red)</li>\n<li><code>unavailable_off_ok</code> - Unavailable (yellow)</li>\n<li><code>enabled_readback</code> - Hardware accelerated but at reduced performance (yellow)</li>\n<li><code>enabled_force</code> - Hardware accelerated on all pages (green)</li>\n<li><code>enabled</code> - Hardware accelerated (green)</li>\n<li><code>enabled_on</code> - Enabled (green)</li>\n<li><code>enabled_force_on</code> - Force enabled (green)</li>\n</ul>",
      "title": "GPUFeatureStatus Object",
      "description": ""
    },
    "/docs/api/structures/hid-device": {
      "locale": "ja-JP",
      "slug": "hid-device",
      "href": "/docs/api/structures/hid-device",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/hid-device.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"hiddevice-オブジェクト\"><a href=\"#hiddevice-オブジェクト\">HIDDevice オブジェクト</a></h1>\n<ul>\n<li><code>deviceId</code> String - デバイスの一意な識別子。</li>\n<li><code>name</code> String - デバイス名。</li>\n<li><code>vendorId</code> Integer - USB 製造元 ID。</li>\n<li><code>productId</code> Integer - USB 製品 ID。</li>\n<li><code>serialNumber</code> String (任意) - USB デバイスのシリアル番号。</li>\n<li><code>guid</code> String (任意) - HID インターフェイスの一意な識別子。  デバイスによっては複数の HID インターフェースを保持することがあります。</li>\n</ul>",
      "title": "HIDDevice オブジェクト",
      "description": ""
    },
    "/docs/api/in-app-purchase": {
      "locale": "ja-JP",
      "slug": "in-app-purchase",
      "href": "/docs/api/in-app-purchase",
      "crowdinFileId": "256325",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/in-app-purchase.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"inapppurchase\"><a href=\"#inapppurchase\">inAppPurchase</a></h1>\n<blockquote>\n<p>Mac App Store のアプリ内購入。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h2 id=\"イベント\"><a href=\"#イベント\">イベント</a></h2>\n<p><code>inAppPurchase</code> モジュールは以下のイベントが発生します。</p>\n<h3 id=\"イベント-transactions-updated\"><a href=\"#イベント-transactions-updated\">イベント: 'transactions-updated'</a></h3>\n<p>1つ以上のトランザクションが更新されたときに発生します。</p>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>transactions</code> Transaction[] - <a href=\"/docs/api/structures/transaction\"><code>Transaction</code></a> オブジェクトの配列。</li>\n</ul>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>inAppPurchase</code> モジュールには以下のメソッドがあります。</p>\n<h3 id=\"inapppurchasepurchaseproductproductid-quantity\"><a href=\"#inapppurchasepurchaseproductproductid-quantity\"><code>inAppPurchase.purchaseProduct(productID[, quantity])</code></a></h3>\n<ul>\n<li><code>productID</code> String - 購入する製品の識別子。 (<code>com.example.app.product1</code> の識別子は <code>product1</code>)。</li>\n<li><code>quantity</code> Integer (任意) - ユーザーが購入しようとしている商品数。</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;Boolean></code> - プロダクトが有効で支払いキューに追加されている場合は、<code>true</code> を返します。</p>\n<p><code>purchaseProduct</code> を呼び出す前に、できるだけ早く <code>transactions-updated</code> イベントをリッスンする必要があります。</p>\n<h3 id=\"inapppurchasegetproductsproductids\"><a href=\"#inapppurchasegetproductsproductids\"><code>inAppPurchase.getProducts(productIDs)</code></a></h3>\n<ul>\n<li><code>productIDs</code> String[] - 取得する製品の識別子。</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;Product[]></code> - <a href=\"/docs/api/structures/product\"><code>Product</code></a> オブジェクトの配列で実行されます。</p>\n<p>製品説明を探します。</p>\n<h3 id=\"inapppurchasecanmakepayments\"><a href=\"#inapppurchasecanmakepayments\"><code>inAppPurchase.canMakePayments()</code></a></h3>\n<p>戻り値 <code>Boolean</code> - ユーザが支払いできるかどうか。</p>\n<h3 id=\"inapppurchaserestorecompletedtransactions\"><a href=\"#inapppurchaserestorecompletedtransactions\"><code>inAppPurchase.restoreCompletedTransactions()</code></a></h3>\n<p>購入済みの支払いを復元します。 このメソッドは、更なるデバイスに購入品をインストールしたり、ユーザーが削除して再インストールしたアプリケーションの購入品を復元したりするために呼び出すことができます。</p>\n<p><a href=\"https://developer.apple.com/documentation/storekit/skpaymentqueue?language=objc\">支払いキュー</a> では、以前に完了した取引ごとに新しい取引情報を提供し復元できるようにします。 各取引は元の取引情報のコピーを含みます。</p>\n<h3 id=\"inapppurchasegetreceipturl\"><a href=\"#inapppurchasegetreceipturl\"><code>inAppPurchase.getReceiptURL()</code></a></h3>\n<p>戻り値 <code>String</code> - 領収書へのパス。</p>\n<h3 id=\"inapppurchasefinishalltransactions\"><a href=\"#inapppurchasefinishalltransactions\"><code>inAppPurchase.finishAllTransactions()</code></a></h3>\n<p>すべての保留中の取引を完了させます。</p>\n<h3 id=\"inapppurchasefinishtransactionbydatedate\"><a href=\"#inapppurchasefinishtransactionbydatedate\"><code>inAppPurchase.finishTransactionByDate(date)</code></a></h3>\n<ul>\n<li><code>date</code> String - 取引を終える ISO 形式の日付。</li>\n</ul>\n<p>日付に対応するすべての保留中の取引を完了させます。</p>",
      "title": "inAppPurchase",
      "description": "Mac App Store のアプリ内購入。"
    },
    "/docs/tutorial/in-app-purchases": {
      "locale": "ja-JP",
      "slug": "in-app-purchases",
      "href": "/docs/tutorial/in-app-purchases",
      "crowdinFileId": "256203",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/in-app-purchases.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"app-内課金-macos\"><a href=\"#app-内課金-macos\">App 内課金 (macOS)</a></h1>\n<h2 id=\"下準備\"><a href=\"#下準備\">下準備</a></h2>\n<h3 id=\"有料アプリケーション契約\"><a href=\"#有料アプリケーション契約\">有料アプリケーション契約</a></h3>\n<p>まだしていないのであれば、iTunes Connect 内で有料アプリケーション契約に署名し、銀行口座情報と納税フォームをセットアップする必要があります。</p>\n<p><a href=\"https://help.apple.com/itunes-connect/developer/#/devb6df5ee51\">iTunes Connect デベロッパーヘルプ: 契約／税金／口座情報の概要</a></p>\n<h3 id=\"app-内課金の作成\"><a href=\"#app-内課金の作成\">App 内課金の作成</a></h3>\n<p>次に、iTunes Connect でアプリ内購入を設定し、名前、価格、説明、アプリ内購入の特徴と機能の説明などの詳細を含める必要があります。</p>\n<p><a href=\"https://help.apple.com/itunes-connect/developer/#/devae49fb316\">iTunes Connect デベロッパーヘルプ: App 内課金の作成</a></p>\n<h3 id=\"cfbundleidentifier-を変更\"><a href=\"#cfbundleidentifier-を変更\">CFBundleIdentifier を変更</a></h3>\n<p>Electron での開発で App 内課金をテストするには、<code>node_modules/electron/dist/Electron.app/Contents/Info.plist</code> 内の <code>CFBundleIdentifier</code> を変更する必要があります。 iTunes Connect で作成したアプリケーションのバンドル ID で、<code>com.github.electron</code> を置き換える必要があります。</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>CFBundleIdentifier<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>com.example.app<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n</code></pre>\n<h2 id=\"コード例\"><a href=\"#コード例\">コード例</a></h2>\n<p>以下は、Electron でアプリ内課金を使用する方法を示した例です。 製品 ID を iTunes Connect で作成された製品の識別子で置き換える必要があります (<code>com.example.app.product1</code> の識別子は <code>product1</code> です)。 アプリ内で <code>transactions-updated</code> イベントをできる限り早くリッスンする必要があることに注意してください。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// メインプロセス</span>\n<span class=\"hljs-keyword\">const</span> { inAppPurchase } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> PRODUCT_IDS = [<span class=\"hljs-string\">'id1'</span>, <span class=\"hljs-string\">'id2'</span>]\n\n<span class=\"hljs-comment\">// できるだけ早くトランザクションをリッスンします。</span>\ninAppPurchase.on(<span class=\"hljs-string\">'transactions-updated'</span>, (event, transactions) => {\n  <span class=\"hljs-keyword\">if</span> (!<span class=\"hljs-built_in\">Array</span>.isArray(transactions)) {\n    <span class=\"hljs-keyword\">return</span>\n  }\n\n  <span class=\"hljs-comment\">// それぞれのトランザクションを確認します。</span>\n  transactions.forEach(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\">transaction</span>) </span>{\n    <span class=\"hljs-keyword\">const</span> payment = transaction.payment\n\n    <span class=\"hljs-keyword\">switch</span> (transaction.transactionState) {\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'purchasing'</span>:\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Purchasing <span class=\"hljs-subst\">${payment.productIdentifier}</span>...`</span>)\n        <span class=\"hljs-keyword\">break</span>\n\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'purchased'</span>: {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${payment.productIdentifier}</span> purchased.`</span>)\n\n        <span class=\"hljs-comment\">// 領収書の URL を取得します。</span>\n        <span class=\"hljs-keyword\">const</span> receiptURL = inAppPurchase.getReceiptURL()\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Receipt URL: <span class=\"hljs-subst\">${receiptURL}</span>`</span>)\n\n        <span class=\"hljs-comment\">// 領収書ファイルをサーバーに送信して、それが有効かどうかを確認します。</span>\n        <span class=\"hljs-comment\">// こちらを参照 https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html</span>\n        <span class=\"hljs-comment\">// ...</span>\n        <span class=\"hljs-comment\">// 領収書が有効であれば、プロダクトは購入されます</span>\n        <span class=\"hljs-comment\">// ...</span>\n\n        <span class=\"hljs-comment\">// トランザクションを終了します。</span>\n        inAppPurchase.finishTransactionByDate(transaction.transactionDate)\n\n        <span class=\"hljs-keyword\">break</span>\n      }\n\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'failed'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Failed to purchase <span class=\"hljs-subst\">${payment.productIdentifier}</span>.`</span>)\n\n        <span class=\"hljs-comment\">// トランザクションを終了します。</span>\n        inAppPurchase.finishTransactionByDate(transaction.transactionDate)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'restored'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The purchase of <span class=\"hljs-subst\">${payment.productIdentifier}</span> has been restored.`</span>)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'deferred'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The purchase of <span class=\"hljs-subst\">${payment.productIdentifier}</span> has been deferred.`</span>)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-attr\">default</span>:\n        <span class=\"hljs-keyword\">break</span>\n    }\n  })\n})\n\n<span class=\"hljs-comment\">// ユーザに App 内課金が許可されているかどうか確認します。</span>\n<span class=\"hljs-keyword\">if</span> (!inAppPurchase.canMakePayments()) {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The user is not allowed to make in-app purchase.'</span>)\n}\n\n<span class=\"hljs-comment\">// 製品の説明を探して表示します。</span>\ninAppPurchase.getProducts(PRODUCT_IDS).then(<span class=\"hljs-function\"><span class=\"hljs-params\">products</span> =></span> {\n  <span class=\"hljs-comment\">// 引数を確認します。</span>\n  <span class=\"hljs-keyword\">if</span> (!<span class=\"hljs-built_in\">Array</span>.isArray(products) || products.length &#x3C;= <span class=\"hljs-number\">0</span>) {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Unable to retrieve the product informations.'</span>)\n    <span class=\"hljs-keyword\">return</span>\n  }\n\n  <span class=\"hljs-comment\">// 各製品の名前と価格を表示します。</span>\n  products.forEach(<span class=\"hljs-function\"><span class=\"hljs-params\">product</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The price of <span class=\"hljs-subst\">${product.localizedTitle}</span> is <span class=\"hljs-subst\">${product.formattedPrice}</span>.`</span>)\n  })\n\n  <span class=\"hljs-comment\">// どの製品を購入したいかをユーザーに尋ねます。</span>\n  <span class=\"hljs-keyword\">const</span> selectedProduct = products[<span class=\"hljs-number\">0</span>]\n  <span class=\"hljs-keyword\">const</span> selectedQuantity = <span class=\"hljs-number\">1</span>\n\n  <span class=\"hljs-comment\">// 選択した製品を購入します。</span>\n  inAppPurchase.purchaseProduct(selectedProduct.productIdentifier, selectedQuantity).then(<span class=\"hljs-function\"><span class=\"hljs-params\">isProductValid</span> =></span> {\n    <span class=\"hljs-keyword\">if</span> (!isProductValid) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The product is not valid.'</span>)\n      <span class=\"hljs-keyword\">return</span>\n    }\n\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The payment has been added to the payment queue.'</span>)\n  })\n})\n</code></pre>",
      "title": "App 内課金 (macOS)",
      "description": ""
    },
    "/docs/api/incoming-message": {
      "locale": "ja-JP",
      "slug": "incoming-message",
      "href": "/docs/api/incoming-message",
      "crowdinFileId": "256327",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/incoming-message.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-incomingmessage\"><a href=\"#クラス-incomingmessage\">クラス: IncomingMessage</a></h2>\n<blockquote>\n<p>HTTP/HTTPSリクエストに対するレスポンスを処理します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<p><code>IncomingMessage</code> は <a href=\"https://nodejs.org/api/stream.html#stream_readable_streams\">Readable Stream</a> インターフェースを実装しているため、<a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a> です。</p>\n<h3 id=\"インスタンスイベント\"><a href=\"#インスタンスイベント\">インスタンスイベント</a></h3>\n<h4 id=\"イベント-data\"><a href=\"#イベント-data\">イベント: 'data'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>chunk</code> Buffer - レスポンスボディのデータのチャンク。</li>\n</ul>\n<p><code>data</code> イベントはレスポンスデータを実用的なコードに移す常套手段です。</p>\n<h4 id=\"イベント-end\"><a href=\"#イベント-end\">イベント: 'end'</a></h4>\n<p>レスポンスボディが終了したことを示します。 'data' イベントの前に配置する必要があります。</p>\n<h4 id=\"イベント-aborted\"><a href=\"#イベント-aborted\">イベント: 'aborted'</a></h4>\n<p>現在進行しているHTTPのやり取り中にリクエストがキャンセルされたときに発生します。</p>\n<h4 id=\"イベント-error\"><a href=\"#イベント-error\">イベント: 'error'</a></h4>\n<p>戻り値：</p>\n<p><code>error</code> Error - 通常は、根本的な原因を識別するエラー文字列を保持します。</p>\n<p>レスポンスデータのイベントをストリーミングしている最中にエラーが発生したときに発生します。 例えば、レスポンスのストリーミング中にサーバーがその基をクローズした場合、<code>error</code> イベントがレスポンスオブジェクトで発生し、続いて <code>close</code> イベントがリクエストオブジェクトで発生します。</p>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<p><code>IncomingMessage</code> のインスタンスには、以下の読み取り可能なプロパティがあります。</p>\n<h4 id=\"responsestatuscode\"><a href=\"#responsestatuscode\"><code>response.statusCode</code></a></h4>\n<p>HTTPレスポンスステータスコードを表す <code>Integer</code>。</p>\n<h4 id=\"responsestatusmessage\"><a href=\"#responsestatusmessage\"><code>response.statusMessage</code></a></h4>\n<p>HTTPステータスメッセージを表す <code>String</code>。</p>\n<h4 id=\"responseheaders\"><a href=\"#responseheaders\"><code>response.headers</code></a></h4>\n<p><code>Record&#x3C;string, string | string[]></code> 型。HTTP レスポンスヘッダを表します。 <code>headers</code> オブジェクトは以下のようにフォーマットされます:</p>\n<ul>\n<li>すべてのヘッダ名は小文字です。</li>\n<li><code>age</code>、<code>authorization</code>、<code>content-length</code>、<code>content-type</code>、<code>etag</code>、<code>expires</code>、<code>from</code>、<code>host</code>、<code>if-modified-since</code>、<code>if-unmodified-since</code>、<code>last-modified</code>、<code>location</code>、<code>max-forwards</code>、<code>proxy-authorization</code>、<code>referer</code>、<code>retry-after</code>、<code>server</code>、<code>user-agent</code> の重複は破棄されます。</li>\n<li><code>set-cookie</code> は常に配列です。 重複は配列へと追加されます。</li>\n<li>重複した <code>cookie</code> ヘッダは、値を '; ' で結合します。</li>\n<li>他の重複したヘッダはすべて、値を ', ' で結合します。</li>\n</ul>\n<h4 id=\"responsehttpversion\"><a href=\"#responsehttpversion\"><code>response.httpVersion</code></a></h4>\n<p>HTTPプロトコルのバージョン番号を示す <code>String</code>。 典型的な値は、'1.0'や'1.1'です。 さらに、<code>httpVersionMajor</code> と <code>httpVersionMinor</code> は、2つともIntegerの値を返す読み取り専用プロパティで、それぞれHTTPのメジャーとマイナーのバージョン番号を返します。</p>\n<h4 id=\"responsehttpversionmajor\"><a href=\"#responsehttpversionmajor\"><code>response.httpVersionMajor</code></a></h4>\n<p>HTTPプロトコルのメジャーバージョン番号を示す <code>Integer</code>。</p>\n<h4 id=\"responsehttpversionminor\"><a href=\"#responsehttpversionminor\"><code>response.httpVersionMinor</code></a></h4>\n<p>HTTPプロトコルのマイナーバージョン番号を示す <code>Integer</code>。</p>",
      "title": "クラス: IncomingMessage",
      "description": "HTTP/HTTPSリクエストに対するレスポンスを処理します。"
    },
    "/docs/api/structures/input-event": {
      "locale": "ja-JP",
      "slug": "input-event",
      "href": "/docs/api/structures/input-event",
      "crowdinFileId": "256441",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"inputevent-object\"><a href=\"#inputevent-object\">InputEvent Object</a></h1>\n<ul>\n<li><code>modifiers</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of modifiers of the event, can be <code>shift</code>, <code>control</code>, <code>ctrl</code>, <code>alt</code>, <code>meta</code>, <code>command</code>, <code>cmd</code>, <code>isKeypad</code>, <code>isAutoRepeat</code>, <code>leftButtonDown</code>, <code>middleButtonDown</code>, <code>rightButtonDown</code>, <code>capsLock</code>, <code>numLock</code>, <code>left</code>, <code>right</code>.</li>\n</ul>",
      "title": "InputEvent Object",
      "description": ""
    },
    "/docs/tutorial/installation": {
      "locale": "ja-JP",
      "slug": "installation",
      "href": "/docs/tutorial/installation",
      "crowdinFileId": "256205",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/installation.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"高度なインストール手順\"><a href=\"#高度なインストール手順\">高度なインストール手順</a></h1>\n<p>Electron のビルド済みバイナリをインストールするには、<a href=\"https://docs.npmjs.com\"><code>npm</code></a> を使用します。 アプリの開発用依存関係として Electron をインストールする方法を推奨します。</p>\n<pre><code class=\"hljs language-sh\">npm install electron --save-dev\n</code></pre>\n<p>アプリ内で Electron のバージョンを管理する方法については、<a href=\"/docs/tutorial/electron-versioning\">Electron のバージョン管理</a> を参照して下さい。</p>\n<h2 id=\"electron-の臨時実行\"><a href=\"#electron-の臨時実行\">Electron の臨時実行</a></h2>\n<p>もし急用かつローカルプロジェクト内で <code>npm install</code> を使用すべきでない場合は、以下のように <a href=\"https://docs.npmjs.com/cli/v7/commands/npx\"><code>npm</code> にバンドルされている <code>npx</code> コマンドランナー</a> を使った Electron の臨時実行もできます。</p>\n<pre><code class=\"hljs language-sh\">npx electron .\n</code></pre>\n<p>上記のコマンドは、Electron で現在のワーキングディレクトリを実行します。 注意としてアプリ内の依存関係がインストールされることはありません。</p>\n<h2 id=\"カスタマイズ\"><a href=\"#カスタマイズ\">カスタマイズ</a></h2>\n<p>ダウンロードするアーキテクチャを変更したい (例えば <code>ia32</code> を <code>x64</code> マシン上にインストールする) 場合、以下のように npm install に <code>--arch</code> フラグを指定するか、<code>npm_config_arch</code> 環境変数を指定してください。</p>\n<pre><code class=\"hljs language-shell\">npm install --arch=ia32 electron\n</code></pre>\n<p>アーキテクチャに加えてプラットフォーム (<code>win32</code>、<code>linux</code>など) も変更する場合は、更に <code>--platform</code>フラグを指定できます。</p>\n<pre><code class=\"hljs language-shell\">npm install --platform=win32 electron\n</code></pre>\n<h2 id=\"プロキシ環境下\"><a href=\"#プロキシ環境下\">プロキシ環境下</a></h2>\n<p>HTTP プロキシを使用する必要がある場合は、<code>ELECTRON_GET_USE_PROXY</code> 変数を任意の値に設定する必要があります。さらに、ホストシステムの Node のバージョンに応じて追加の環境変数を設定する必要があります。</p>\n<ul>\n<li><a href=\"https://github.com/gajus/global-agent/blob/v2.1.5/README.md#environment-variables\">Node 10 以降</a></li>\n<li><a href=\"https://github.com/np-maintain/global-tunnel/blob/v2.7.1/README.md#auto-config\">Node 10 以前</a></li>\n</ul>\n<h2 id=\"ミラーとキャッシュのカスタマイズ\"><a href=\"#ミラーとキャッシュのカスタマイズ\">ミラーとキャッシュのカスタマイズ</a></h2>\n<p>インストール中、<code>electron</code> モジュールは <a href=\"https://github.com/electron/get\"><code>@electron/get</code></a> を呼び出して、プラットフォーム用のビルド済み Electron バイナリをダウンロードします。 これは Github のリリースダウンロードページ (<code>https://github.com/electron/electron/releases/tag/v$VERSION</code>、 <code>$VERSION</code> は Electron の正確なバージョン) からダウンロードします。</p>\n<p>もし Github にアクセス出来ないかカスタムビルドを提供する必要がある場合、他に提供されているミラーや既存のキャッシュからダウンロードできます。</p>\n<h4 id=\"ミラー\"><a href=\"#ミラー\">ミラー</a></h4>\n<p>基底URL、Electron のバイナリを見つけるためのパス、バイナリのファイル名は、環境変数を用いて上書きできます。 <code>@electron/get</code> で使われる URL は以下の組み合わせです。</p>\n<pre><code class=\"hljs language-javascript\">url = ELECTRON_MIRROR + ELECTRON_CUSTOM_DIR + <span class=\"hljs-string\">'/'</span> + ELECTRON_CUSTOM_FILENAME\n</code></pre>\n<p>例として、中国の CDN ミラーを使うにはこうします。</p>\n<pre><code class=\"hljs language-shell\">ELECTRON_MIRROR=\"https://cdn.npm.taobao.org/dist/electron/\"\n</code></pre>\n<p>既定の <code>ELECTRON_CUSTOM_DIR</code> は <code>v$VERSION</code> です。 この形式を変更するには、<code>{{ version }}</code> プレースホルダーを使用します。 例えば、<code>version-{{ version }}</code> は <code>version-5.0.0</code> に解決され、<code>{{ version }}</code> は <code>5.0.0</code> に解決されます。<code>v{{ version }}</code> は既定と等価です。 より具体的な例として、中国の非 CDN ミラーを使用してみます。</p>\n<pre><code class=\"hljs language-shell\">ELECTRON_MIRROR=\"https://npm.taobao.org/mirrors/electron/\"\nELECTRON_CUSTOM_DIR=\"{{ version }}\"\n</code></pre>\n<p>上記の構成では、<code>https://npm.taobao.org/mirrors/electron/8.0.0/electron-v8.0.0-linux-x64.zip</code> の URL からダウンロードされます。</p>\n<p>ミラーが公式の Electron リリースと異なるチェックサムのアーティファクトを提供している場合、Electron が組み込みチェックサムの代わりに外部の <code>SHASUMS256.txt</code> ファイルをチェックサム検証に使うように <code>ELECTRON_USE_REMOTE_CHECKSUMS=1</code> と設定する必要があるでしょう。</p>\n<h4 id=\"キャッシュ\"><a href=\"#キャッシュ\">キャッシュ</a></h4>\n<p>代わりに、ローカルキャッシュを上書きできます。 <code>@electron/get</code> はあなたのネットワークに負荷がかからないように、ダウンロードしたバイナリをローカルディレクトリにキャッシュします。 そのキャッシュフォルダは、Electron のカスタムビルドの提供やネットワークとの接続を回避するために使用できます。</p>\n<ul>\n<li>Linux: <code>$XDG_CACHE_HOME</code> または <code>~/.cache/electron/</code></li>\n<li>macOS: <code>~/Library/Caches/electron/</code></li>\n<li>Windows: <code>$LOCALAPPDATA/electron/Cache</code> または <code>~/AppData/Local/electron/Cache/</code></li>\n</ul>\n<p>古いバージョンの Electron を使用していた環境の場合は、<code>~/.electron</code> 内にもキャッシュがあるかもしれません。</p>\n<p>また、<code>electron_config_cache</code> 環境変数を設けることでローカルキャッシュの場所を上書きできます。</p>\n<p>キャッシュには、バージョンの公式の zip ファイルと共に、テキストファイルとして格納されているチェックサムが含まれています。 典型的なキャッシュは、次のようになっています。</p>\n<pre><code class=\"hljs language-sh\">├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9electron-v1.7.9-darwin-x64.zip\n│   └── electron-v1.7.9-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1electron-v1.8.1-darwin-x64.zip\n│   └── electron-v1.8.1-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1electron-v1.8.2-beta.1-darwin-x64.zip\n│   └── electron-v1.8.2-beta.1-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2electron-v1.8.2-beta.2-darwin-x64.zip\n│   └── electron-v1.8.2-beta.2-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3electron-v1.8.2-beta.3-darwin-x64.zip\n│   └── electron-v1.8.2-beta.3-darwin-x64.zip\n└── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3SHASUMS256.txt\n    └── SHASUMS256.txt\n</code></pre>\n<h2 id=\"バイナリダウンロードのスキップ\"><a href=\"#バイナリダウンロードのスキップ\">バイナリダウンロードのスキップ</a></h2>\n<p>実際には、Electron の JavaScript API はその実装を格納するバイナリにバインドされています。 このバイナリは Electron アプリの動作に不可欠であるため、npm レジストリから <code>electron</code> をインストールするたびに <code>postinstall</code> ステップにおいて既定でダウンロードされます。</p>\n<p>しかし、プロジェクトの依存関係をインストールしたいものの Electron の機能を使う必要がない場合は、<code>ELECTRON_SKIP_BINARY_DOWNLOAD</code> 環境変数を設定してバイナリのダウンロードを抑止できます。 例えば、継続的インテグレーション環境において <code>electron</code> モジュールをモックアウトした単体テストを実行する際に、この機能が役立ちます。</p>\n<pre><code class=\"hljs language-sh\">ELECTRON_SKIP_BINARY_DOWNLOAD=1 npm install\n</code></pre>\n<h2 id=\"トラブルシューティング\"><a href=\"#トラブルシューティング\">トラブルシューティング</a></h2>\n<p><code>npm install electron</code> を実行するとき、インストール時エラーが発生する場合があります。</p>\n<p>ほとんどの場合、このエラーはネットワークによるもので、<code>electron</code> の npm パッケージに問題はありません。 <code>ELIFECYCLE</code>、<code>EAI_AGAIN</code>、<code>ECONNRESET</code>、<code>ETIMEDOUT</code> といったエラーは、ネットワーク上の問題を示しています。 最善の解決策は、ネットワークを切り替えるか、少し待ってからもう一度インストールしてることです。</p>\n<p><code>npm</code> を介したインストールに失敗する場合、Electron の <a href=\"https://github.com/electron/electron/releases\">electron/electron/releases</a> からの直接ダウンロードを試みることもできます。</p>\n<p>インストールが <code>EACCESS</code> エラーで失敗する場合は、<a href=\"https://docs.npmjs.com/getting-started/fixing-npm-permissions\">npm の権限の修正</a> が必要かもしれません。</p>\n<p>上記のエラーが続く場合は、<a href=\"https://docs.npmjs.com/misc/config#unsafe-perm\">unsafe-perm</a> フラグを true にする必要があるでしょう。</p>\n<pre><code class=\"hljs language-sh\">sudo npm install electron --unsafe-perm=<span class=\"hljs-literal\">true</span>\n</code></pre>\n<p>速度の遅いネットワークでは、<code>--verbose</code>を指定してダウンロード進捗を表示することでなにか役に立つ情報が得られるかもしれません。</p>\n<pre><code class=\"hljs language-sh\">npm install --verbose electron\n</code></pre>\n<p>強制的に再ダウンロードする必要がある場合は、<code>force_no_cache</code>環境変数を<code>true</code>に設定してください。</p>",
      "title": "高度なインストール手順",
      "description": ""
    },
    "/docs/tutorial/introduction": {
      "locale": "ja-JP",
      "slug": "introduction",
      "href": "/docs/tutorial/introduction",
      "crowdinFileId": "256207",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/introduction.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"はじめに\"><a href=\"#はじめに\">はじめに</a></h1>\n<p>Electron ドキュメントへようこそ！ 初めて Electron アプリを開発する方は、このはじめにを読んで基本的な知識を身につけてください。 そうでない方は、ガイドや API ドキュメントもご利用ください！</p>\n<h2 id=\"electron-とは何ですか\"><a href=\"#electron-とは何ですか\">Electron とは何ですか?</a></h2>\n<p>Electron は、JavaScript、HTML、CSS によるデスクトップアプリケーションを構築するフレームワークです。 Electron は <a href=\"https://www.chromium.org/\">Chromium</a> と <a href=\"https://nodejs.org/\">Node.js</a> をバイナリに組み込むことで、単一の JavaScript コードベースを維持しつつ、ネイテイブ開発経験無しでも Windows、macOS、Linux で動作するクロスプラットフォームアプリを作成できます。</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<p>このドキュメントは、読者が Node.js と一般的なウェブ開発の両方に精通していることを前提にしています。 これらの分野のいずれかに精通しておきたい方は、以下のリソースをお勧めします。</p>\n<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web\">ウェブ入門 (MDN)</a></li>\n<li><a href=\"https://nodejs.dev/learn\">Introduction to Node.js</a></li>\n</ul>\n<p>また、Chromium のプロセスモデルを知っていると Electron の仕組みをより理解しやすくなります。 2008 年の Chrome 発表と同時に公開された <a href=\"https://www.google.com/googlebooks/chrome/\">Chrome 漫画</a> には、Chrome のアーキテクチャの概要が載っています。 その公開から 10 年以上経っていますが、この漫画で紹介された基本原理は Electron の理解に役立ちます。</p>\n<h2 id=\"electron-fiddle-でサンプルを動かす\"><a href=\"#electron-fiddle-でサンプルを動かす\">Electron Fiddle でサンプルを動かす</a></h2>\n<p><a href=\"https://electronjs.org/fiddle\">Electron Fiddle</a> は Electron で書かれたサンドボックスアプリで、Electron のメンテナがサポートしています。 Electron の API を試したり開発中の機能を試作するための学習ツールとして、インストールを強く推奨します。</p>\n<p>また、Fiddle はドキュメントとうまく統合してあります。 チュートリアルのサンプルを見ていると、コードブロックの下に \"Electron Fiddle で開く\" ボタンが表示されていることがよくあります。 Fiddle がインストールされている場合、このボタンを押すと <code>fiddle.electronjs.org</code> のリンクが開き、コピーペーストせずとも自動的に Fiddle にサンプルがロードされます。</p>\n<h2 id=\"ヘルプチャンネル\"><a href=\"#ヘルプチャンネル\">ヘルプチャンネル</a></h2>\n<p>どこかで行き詰まってしまいましたか? こちらに、ご覧いただきたいリンクがいくつかあります。</p>\n<ul>\n<li>アプリ開発で助けを求めたい場合、<a href=\"https://discord.gg/electron\">コミュニティ Discord サーバー</a> で他の Electron アプリ開発者からアドバイスを受けることができます。</li>\n<li><code>electron</code> パッケージのバグが疑われる場合は、<a href=\"https://github.com/electron/electron/issues\">GitHub Issue トラッカー</a> で既存の Issue とあなたの Issue に合致するものがないかご確認ください。 もし無ければ、バグレポートのテンプレートに記入し、新しい Issue をご提出ください。</li>\n</ul>",
      "title": "はじめに",
      "description": ""
    },
    "/docs/api/structures/io-counters": {
      "locale": "ja-JP",
      "slug": "io-counters",
      "href": "/docs/api/structures/io-counters",
      "crowdinFileId": "256443",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/io-counters.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"iocounters-object\"><a href=\"#iocounters-object\">IOCounters Object</a></h1>\n<ul>\n<li><code>readOperationCount</code> Number - The number of I/O read operations.</li>\n<li><code>writeOperationCount</code> Number - The number of I/O write operations.</li>\n<li><code>otherOperationCount</code> Number - Then number of I/O other operations.</li>\n<li><code>readTransferCount</code> Number - The number of I/O read transfers.</li>\n<li><code>writeTransferCount</code> Number - The number of I/O write transfers.</li>\n<li><code>otherTransferCount</code> Number - Then number of I/O other transfers.</li>\n</ul>",
      "title": "IOCounters Object",
      "description": ""
    },
    "/docs/api/ipc-main": {
      "locale": "ja-JP",
      "slug": "ipc-main",
      "href": "/docs/api/ipc-main",
      "crowdinFileId": "256329",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/ipc-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmain\"><a href=\"#ipcmain\">ipcMain</a></h1>\n<blockquote>\n<p>メインプロセスからレンダラープロセスへ非同期で通信を行います。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>ipcMain</code> モジュールは <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">Event Emitter</a> を継承しています。 メインプロセスで使用される場合、レンダラープロセス (ウェブページ) から送られる非同期及び同期メッセージを処理します。 レンダラーから送信されたメッセージは、このモジュールに送られます。</p>\n<h2 id=\"メッセージ送信\"><a href=\"#メッセージ送信\">メッセージ送信</a></h2>\n<p>また、メインプロセスからレンダラープロセスにメッセージを送ることもできます。より詳しくは <a href=\"/docs/api/web-contents#contentssendchannel-args\">webContents.send</a> を参照して下さい。</p>\n<ul>\n<li>メッセージを送信しているとき、イベント名は <code>channel</code> です。</li>\n<li>同期メッセージに返信をするには、<code>event.returnValue</code> を設定する必要があります。</li>\n<li>非同期メッセージを送信者に返送するには、<code>event.reply(...)</code> を使用できます。  このヘルパーメソッドはメインフレームではないフレーム (例: iframe) から来るメッセージを自動的に処理します。一方、<code>event.sender.send(...)</code> は常にメインフレームに送信されます。</li>\n</ul>\n<p>レンダラー/メインプロセス間のメッセージの送信と処理の例:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// メインプロセス</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'asynchronous-message'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg)  <span class=\"hljs-comment\">// \"ping\"を表示</span>\n  event.reply(<span class=\"hljs-string\">'asynchronous-reply'</span>, <span class=\"hljs-string\">'pong'</span>)\n})\n\nipcMain.on(<span class=\"hljs-string\">'synchronous-message'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg)  <span class=\"hljs-comment\">// \"ping\"を表示</span>\n  event.returnValue = <span class=\"hljs-string\">'pong'</span>\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// レンダラープロセス（ウェブページ）</span>\n<span class=\"hljs-comment\">// 備考: Electron の API は、contextIsolation が無効でない限りプリロードからのみアクセスできます。</span>\n<span class=\"hljs-comment\">// 詳細は https://www.electronjs.org/docs/tutorial/process-model#preload-scripts をご参照ください。</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(ipcRenderer.sendSync(<span class=\"hljs-string\">'synchronous-message'</span>, <span class=\"hljs-string\">'ping'</span>)) <span class=\"hljs-comment\">// \"pong\"を表示</span>\n\nipcRenderer.on(<span class=\"hljs-string\">'asynchronous-reply'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// \"pong\"を表示</span>\n})\nipcRenderer.send(<span class=\"hljs-string\">'asynchronous-message'</span>, <span class=\"hljs-string\">'ping'</span>)\n</code></pre>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>ipcMain</code> オブジェクトは、イベントを受け取るために以下のメソッドがあります。</p>\n<h3 id=\"ipcmainonchannel-listener\"><a href=\"#ipcmainonchannel-listener\"><code>ipcMain.on(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>event</code> IpcMainEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p><code>channel</code> に新しいメッセージが来たときに <code>listener</code> が <code>listener(event, args...)</code> として呼ばれます、</p>\n<h3 id=\"ipcmainoncechannel-listener\"><a href=\"#ipcmainoncechannel-listener\"><code>ipcMain.once(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>event</code> IpcMainEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>イベントに対する一回限りの <code>listener</code> 関数を追加します。 この <code>listener</code> は、次にメッセージが <code>channel</code> へ送信されたときに、削除されてから呼び出されます。</p>\n<h3 id=\"ipcmainremovelistenerchannel-listener\"><a href=\"#ipcmainremovelistenerchannel-listener\"><code>ipcMain.removeListener(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>指定した <code>channel</code> の listener 配列から、指定した <code>listener</code> を削除します。</p>\n<h3 id=\"ipcmainremovealllistenerschannel\"><a href=\"#ipcmainremovealllistenerschannel\"><code>ipcMain.removeAllListeners([channel])</code></a></h3>\n<ul>\n<li><code>channel</code> String (任意)</li>\n</ul>\n<p>指定した <code>channel</code> の listener を全て削除します。</p>\n<h3 id=\"ipcmainhandlechannel-listener\"><a href=\"#ipcmainhandlechannel-listener\"><code>ipcMain.handle(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function&#x3C;Promise\\<void> | any><ul>\n<li><code>event</code> IpcMainInvokeEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></void></li>\n</ul>\n<p><code>invoke</code> 可能な IPC のハンドラを追加します。 このハンドラは、レンダラが <code>ipcRenderer.invoke(channel, ...args)</code> を呼び出したとき常に呼び出されます。</p>\n<p><code>listener</code> が Promise を返す場合、Promise の最終的な結果は、リモート呼び出し元への応答として返されます。 それ以外は、リスナーの戻り値が応答の値として使用されます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// メインプロセス</span>\nipcMain.handle(<span class=\"hljs-string\">'my-invokable-ipc'</span>, <span class=\"hljs-keyword\">async</span> (event, ...args) => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> somePromise(...args)\n  <span class=\"hljs-keyword\">return</span> result\n})\n\n<span class=\"hljs-comment\">// レンダラープロセス</span>\n<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> ipcRenderer.invoke(<span class=\"hljs-string\">'my-invokable-ipc'</span>, arg1, arg2)\n  <span class=\"hljs-comment\">// ...</span>\n}\n</code></pre>\n<p>ハンドラーの最初の引数として渡される <code>event</code> は、通常のイベントリスナーに渡されるものと同じです。 どの WebContents が呼び出しリクエスト元であるかに関する情報が含まれています。</p>\n<p>メインプロセスの <code>handle</code> から投げられたエラーはシリアライズされ、元のエラーからの <code>message</code> プロパティのみがレンダラープロセスに提供されるため、非透過的です。 詳細は <a href=\"https://github.com/electron/electron/issues/24427\">#24427</a> をご参照ください。</p>\n<h3 id=\"ipcmainhandleoncechannel-listener\"><a href=\"#ipcmainhandleoncechannel-listener\"><code>ipcMain.handleOnce(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function&#x3C;Promise\\<void> | any><ul>\n<li><code>event</code> IpcMainInvokeEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></void></li>\n</ul>\n<p>1 つの <code>invoke</code> 可能な IPC メッセージを処理し、リスナーを削除します。 <code>ipcMain.handle(channel, listener)</code> を参照してください。</p>\n<h3 id=\"ipcmainremovehandlerchannel\"><a href=\"#ipcmainremovehandlerchannel\"><code>ipcMain.removeHandler(channel)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n</ul>\n<p><code>channel</code> にハンドラがあれば削除します。</p>\n<h2 id=\"ipcmainevent-オブジェクト\"><a href=\"#ipcmainevent-オブジェクト\">IpcMainEvent オブジェクト</a></h2>\n<p><code>callback</code> に渡された <code>event</code> オブジェクトに関するドキュメントは、<a href=\"/docs/api/structures/ipc-main-event\"><code>ipc-main-event</code></a> 構造体ドキュメントにあります。</p>\n<h2 id=\"ipcmaininvokeevent-オブジェクト\"><a href=\"#ipcmaininvokeevent-オブジェクト\">IpcMainInvokeEvent オブジェクト</a></h2>\n<p><code>handle</code> コールバックに渡される <code>event</code> オブジェクトのドキュメントは、<a href=\"/docs/api/structures/ipc-main-invoke-event\"><code>ipc-main-invoke-event</code></a> 構造体ドキュメントにあります。</p>",
      "title": "ipcMain",
      "description": "メインプロセスからレンダラープロセスへ非同期で通信を行います。"
    },
    "/docs/api/structures/ipc-main-event": {
      "locale": "ja-JP",
      "slug": "ipc-main-event",
      "href": "/docs/api/structures/ipc-main-event",
      "crowdinFileId": "256445",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-main-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmainevent-object-extends-event\"><a href=\"#ipcmainevent-object-extends-event\">IpcMainEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>processId</code> Integer - The internal ID of the renderer process that sent this message</li>\n<li><code>frameId</code> Integer - The ID of the renderer frame that sent this message</li>\n<li><code>returnValue</code> any - Set this to the value to be returned in a synchronous message</li>\n<li><code>sender</code> WebContents - Returns the <code>webContents</code> that sent the message</li>\n<li><code>senderFrame</code> WebFrameMain <em>Readonly</em> - The frame that sent this message</li>\n<li><code>ports</code> MessagePortMain[] - A list of MessagePorts that were transferred with this message</li>\n<li><code>reply</code> Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling.  You should use this method to \"reply\" to the sent message in order to guarantee the reply will go to the correct process and frame.<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>",
      "title": "IpcMainEvent Object extends Event",
      "description": ""
    },
    "/docs/api/structures/ipc-main-invoke-event": {
      "locale": "ja-JP",
      "slug": "ipc-main-invoke-event",
      "href": "/docs/api/structures/ipc-main-invoke-event",
      "crowdinFileId": "256447",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-main-invoke-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmaininvokeevent-object-extends-event\"><a href=\"#ipcmaininvokeevent-object-extends-event\">IpcMainInvokeEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>processId</code> Integer - The internal ID of the renderer process that sent this message</li>\n<li><code>frameId</code> Integer - The ID of the renderer frame that sent this message</li>\n<li><code>sender</code> WebContents - Returns the <code>webContents</code> that sent the message</li>\n<li><code>senderFrame</code> WebFrameMain <em>Readonly</em> - The frame that sent this message</li>\n</ul>",
      "title": "IpcMainInvokeEvent Object extends Event",
      "description": ""
    },
    "/docs/api/ipc-renderer": {
      "locale": "ja-JP",
      "slug": "ipc-renderer",
      "href": "/docs/api/ipc-renderer",
      "crowdinFileId": "256331",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/ipc-renderer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcrenderer\"><a href=\"#ipcrenderer\">ipcRenderer</a></h1>\n<blockquote>\n<p>レンダラープロセスからメインプロセスに非同期通信をします。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p><code>ipcRenderer</code> モジュールは <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">Event Emitter</a> を継承しています。 レンダラープロセス (ウェブページ) からメインプロセスに同期及び非同期メッセージを送れるように、いくつかのメソッドを提供します。 メインプロセスからの返信を受け取ることもできます。</p>\n<p>サンプルコードについては <a href=\"/docs/api/ipc-main\">ipcMain</a> を参照して下さい。</p>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>ipcRenderer</code> オブジェクトは、イベントを受け取り、送るために以下のメソッドがあります。</p>\n<h3 id=\"ipcrendereronchannel-listener\"><a href=\"#ipcrendereronchannel-listener\"><code>ipcRenderer.on(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>event</code> IpcRendererEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p><code>channel</code> に新しいメッセージが来たときに <code>listener</code> が <code>listener(event, args...)</code> として呼ばれます、</p>\n<h3 id=\"ipcrendereroncechannel-listener\"><a href=\"#ipcrendereroncechannel-listener\"><code>ipcRenderer.once(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>event</code> IpcRendererEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>イベントに対する一回限りの <code>listener</code> 関数を追加します。 この <code>listener</code> は、次にメッセージが <code>channel</code> へ送信されたときに、削除されてから呼び出されます。</p>\n<h3 id=\"ipcrendererremovelistenerchannel-listener\"><a href=\"#ipcrendererremovelistenerchannel-listener\"><code>ipcRenderer.removeListener(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>指定した <code>channel</code> の listener 配列から、指定した <code>listener</code> を削除します。</p>\n<h3 id=\"ipcrendererremovealllistenerschannel\"><a href=\"#ipcrendererremovealllistenerschannel\"><code>ipcRenderer.removeAllListeners(channel)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n</ul>\n<p>指定した <code>channel</code> の listener を全て削除します。</p>\n<h3 id=\"ipcrenderersendchannel-args\"><a href=\"#ipcrenderersendchannel-args\"><code>ipcRenderer.send(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>引数と共に、<code>channel</code> を介してメインプロセスに非同期メッセージを送信します。 引数は <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a> と同じように <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">構造化複製アルゴリズム</a> によってシリアライズされるため、プロトタイプチェーンは含まれません。 関数、Promise、Symbol、WeakMap、WeakSet の送信は、例外が送出されます。</p>\n<blockquote>\n<p><strong>注意:</strong> DOM オブジェクトや特殊な Electron オブジェクトなど、非標準の JavaScript 型を送信すると例外が発生します。</p>\n<p>メインプロセスでは <code>ImageBitmap</code>、<code>File</code>、<code>DOMMatrix</code> などの DOM オブジェクトをサポートしていません。そのため、これらのオブジェクトをメインプロセスでデコードする方法がなく、Electron の IPC を介してメインプロセスに送信することはできません。 IPC 経由でこのようなオブジェクトを送信するとエラーになります。</p>\n</blockquote>\n<p>メインプロセスは <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> モジュールで <code>channel</code> を聴いてそれを処理します。</p>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> をメインプロセスに転送する必要がある場合は、<a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a> を使用してください。</p>\n<p>メソッド呼び出しの結果のようにメインプロセスから応答を一つだけ受け取りたい場合は、<a href=\"#ipcrendererinvokechannel-args\"><code>ipcRenderer.invoke</code></a> の使用を検討してください。</p>\n<h3 id=\"ipcrendererinvokechannel-args\"><a href=\"#ipcrendererinvokechannel-args\"><code>ipcRenderer.invoke(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;any></code> - メインプロセスからの応答で解決します。</p>\n<p><code>channel</code> を介して非同期でメインプロセスにメッセージを送信し、結果を待ちます。 引数は <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a> と同じように <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">構造化複製アルゴリズム</a> によってシリアライズされるため、プロトタイプチェーンは含まれません。 関数、Promise、Symbol、WeakMap、WeakSet の送信は、例外が送出されます。</p>\n<blockquote>\n<p><strong>注意:</strong> DOM オブジェクトや特殊な Electron オブジェクトなど、非標準の JavaScript 型を送信すると例外が発生します。</p>\n<p>メインプロセスでは <code>ImageBitmap</code>、<code>File</code>、<code>DOMMatrix</code> などの DOM オブジェクトをサポートしていません。そのため、これらのオブジェクトをメインプロセスでデコードする方法がなく、Electron の IPC を介してメインプロセスに送信することはできません。 IPC 経由でこのようなオブジェクトを送信するとエラーになります。</p>\n</blockquote>\n<p>メインプロセスは、<a href=\"/docs/api/ipc-main#ipcmainhandlechannel-listener\"><code>ipcMain.handle()</code></a> で <code>channel</code> をリッスンする必要があります。</p>\n<p>以下がその例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// レンダラープロセス</span>\nipcRenderer.invoke(<span class=\"hljs-string\">'some-name'</span>, someArgument).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">result</span>) =></span> {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// メインプロセス</span>\nipcMain.handle(<span class=\"hljs-string\">'some-name'</span>, <span class=\"hljs-keyword\">async</span> (event, someArgument) => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> doSomeWork(someArgument)\n  <span class=\"hljs-keyword\">return</span> result\n})\n</code></pre>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> をメインプロセスに転送する必要がある場合は、<a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a> を使用してください。</p>\n<p>メッセージの応答が必要ない場合は、<a href=\"#ipcrenderersendchannel-args\"><code>ipcRenderer.send</code></a> の使用を検討してください。</p>\n<h3 id=\"ipcrenderersendsyncchannel-args\"><a href=\"#ipcrenderersendsyncchannel-args\"><code>ipcRenderer.sendSync(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>戻り値 <code>any</code> - <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> ハンドラから返された値。</p>\n<p><code>channel</code> を介して同期でメインプロセスにメッセージを送信し、結果を待ちます。 引数は <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a> と同じように <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">構造化複製アルゴリズム</a> によってシリアライズされるため、プロトタイプチェーンは含まれません。 関数、Promise、Symbol、WeakMap、WeakSet の送信は、例外が送出されます。</p>\n<blockquote>\n<p><strong>注意:</strong> DOM オブジェクトや特殊な Electron オブジェクトなど、非標準の JavaScript 型を送信すると例外が発生します。</p>\n<p>メインプロセスでは <code>ImageBitmap</code>、<code>File</code>、<code>DOMMatrix</code> などの DOM オブジェクトをサポートしていません。そのため、これらのオブジェクトをメインプロセスでデコードする方法がなく、Electron の IPC を介してメインプロセスに送信することはできません。 IPC 経由でこのようなオブジェクトを送信するとエラーになります。</p>\n</blockquote>\n<p>メインプロセスは <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> オブジェクトで <code>channel</code> を聴いてそれを処理します。そして <code>event.returnValue</code> をセットすることで応答します。</p>\n<blockquote>\n<p>⚠️ <strong>警告</strong>: 同期メッセージを送信すると、応答を受信するまでレンダラープロセス全体がブロックされます。そのため、このメソッドは最終手段として使用してください。 非同期バージョンの、<a href=\"/docs/api/ipc-renderer#ipcrendererinvokechannel-args\"><code>invoke()</code></a> を使用することを推奨します。</p>\n</blockquote>\n<h3 id=\"ipcrendererpostmessagechannel-message-transfer\"><a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage(channel, message, [transfer])</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePort<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a></li>\n</ul>\n<p>メッセージをメインプロセスに送信し、任意でゼロ個以上の <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"> <code>MessagePort</code></a> オブジェクトの所有権を転送します。</p>\n<p>転送した <code>MessagePort</code> オブジェクトは、発生したイベントの <code>ports</code> プロパティにアクセスすることで、<a href=\"/docs/api/messageport-main\"><code>MessagePortMain</code></a> オブジェクトとしてメインプロセスで利用可能になります。</p>\n<p>以下がその例です。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// レンダラープロセス</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannel()\nipcRenderer.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// メインプロセス</span>\nipcMain.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<p><code>MessagePort</code> と <code>MessageChannel</code> の使用方法の詳細については <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\">MDN ドキュメント</a> を参照してください。</p>\n<h3 id=\"ipcrenderersendtowebcontentsid-channel-args\"><a href=\"#ipcrenderersendtowebcontentsid-channel-args\"><code>ipcRenderer.sendTo(webContentsId, channel, ...args)</code></a></h3>\n<ul>\n<li><code>webContentsId</code> Number</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p><code>channel</code> を介して <code>webContentsId</code> のウインドウにメッセージを送ります。</p>\n<h3 id=\"ipcrenderersendtohostchannel-args\"><a href=\"#ipcrenderersendtohostchannel-args\"><code>ipcRenderer.sendToHost(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p><code>ipcRenderer.send</code> に似ていますが、イベントはメインプロセスの代わりにホストページの <code>&#x3C;webview></code> に送信されます。</p>\n<h2 id=\"イベントオブジェクト\"><a href=\"#イベントオブジェクト\">イベントオブジェクト</a></h2>\n<p><code>callback</code> に渡された <code>event</code> オブジェクトに関するドキュメントは、<a href=\"/docs/api/structures/ipc-renderer-event\"><code>ipc-renderer-event</code></a> 構造体ドキュメントにあります。</p>",
      "title": "ipcRenderer",
      "description": "レンダラープロセスからメインプロセスに非同期通信をします。"
    },
    "/docs/api/structures/ipc-renderer-event": {
      "locale": "ja-JP",
      "slug": "ipc-renderer-event",
      "href": "/docs/api/structures/ipc-renderer-event",
      "crowdinFileId": "256449",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-renderer-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcrendererevent-object-extends-event\"><a href=\"#ipcrendererevent-object-extends-event\">IpcRendererEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>sender</code> IpcRenderer - The <code>IpcRenderer</code> instance that emitted the event originally</li>\n<li><code>senderId</code> Integer - The <code>webContents.id</code> that sent the message, you can call <code>event.sender.sendTo(event.senderId, ...)</code> to reply to the message, see <a href=\"/docs/api/ipc-renderer#ipcrenderersendtowebcontentsid-channel-args\">ipcRenderer.sendTo</a> for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set <code>event.senderId</code> to <code>0</code>.</li>\n<li><code>ports</code> MessagePort[] - A list of MessagePorts that were transferred with this message</li>\n</ul>",
      "title": "IpcRendererEvent Object extends Event",
      "description": ""
    },
    "/docs/development/issues": {
      "locale": "ja-JP",
      "slug": "issues",
      "href": "/docs/development/issues",
      "crowdinFileId": "256159",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/issues.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"electron-の-issue\"><a href=\"#electron-の-issue\">Electron の Issue</a></h1>\n<ul>\n<li><a href=\"#how-to-contribute-to-issues\">Issue でコントリビュートする方法</a></li>\n<li><a href=\"#asking-for-general-help\">一般的なヘルプ</a></li>\n<li><a href=\"#submitting-a-bug-report\">バグレポートの送信</a></li>\n<li><a href=\"#triaging-a-bug-report\">バグレポートのトリアージュ</a></li>\n<li><a href=\"#resolving-a-bug-report\">バグレポートの解決</a></li>\n</ul>\n<h2 id=\"issue-でコントリビュートする方法\"><a href=\"#issue-でコントリビュートする方法\">Issue でコントリビュートする方法</a></h2>\n<p>問題に対してコントリビュートする方法が3つあります：</p>\n<ol>\n<li>議論のための issue を開く: 新たな Electron の不具合を見つけたと思ったら、<a href=\"https://github.com/electron/electron/issues\"><code>electron/electron</code>の issue トラッカー</a> に新しい issue を作って報告することを推奨します。</li>\n<li>問題の選別を手伝う: あなたは補助的な詳細 (不具合を再現することのできるテストケース) を提供したり、この問題に対処するための提案を行うことによって、問題の選別を手伝うことができます。</li>\n<li>問題の解決を手伝う: 問題はそれが不具合ではなかったり修正されていると示すことでも解決されますが、より多くは具体的かつレビュー可能な方法で<code>electron/electron</code>のソースコードに変更を加えるプルリクエストを送ることによって解決されます。</li>\n</ol>\n<h2 id=\"一般的なヘルプ\"><a href=\"#一般的なヘルプ\">一般的なヘルプ</a></h2>\n<p><a href=\"/docs/tutorial/support#finding-support\">\"Finding Support\"</a> にはプログラミングヘルプ、セキュリティ Issue の報告、貢献などのリソースのリストがあります。 Issue トラッカーはバグにのみ使用してください！</p>\n<h2 id=\"バグレポートの送信\"><a href=\"#バグレポートの送信\">バグレポートの送信</a></h2>\n<p>バグレポートを送信するには:</p>\n<p><a href=\"https://github.com/electron/electron/issues/new/choose\"><code>electron/electron</code> Issue トラッカー</a> 内で新しい Issue を開くとき、ユーザには記入するべきテンプレートが表示されます。</p>\n<p>Electron のバグを発見したと思われる方は、できるだけテンプレートの記入にご協力ください。</p>\n<p>レポートを評価するために必要な、2つの最も重要な情報は、バグの説明とそれを再現するための簡単なテストケースです。 再現できる場合は、バグを修正することがより簡単になります。</p>\n<p><a href=\"https://stackoverflow.com/help/mcve\">簡潔、完璧、検証可能な例の作り方</a> を参照してください。</p>\n<h2 id=\"バグレポートのトリアージュ\"><a href=\"#バグレポートのトリアージュ\">バグレポートのトリアージュ</a></h2>\n<p>未解決の Issue には議論が伴うのが一般的です。 コントリビュータらは、その振る舞いがバグか機能かなどで意見が異なるでしょう。 この議論はプロセスの一部であり、集中し、有用で、専門的になるべきです。</p>\n<p>補足の文脈も裏付けとなる詳細も示さない簡潔な回答は、役に立たず専門的ではありません。 多くの人にとって、そのようなレスポンスは面倒で不親切です。</p>\n<p>コントリビュータは、問題を共同で解決し互いに進歩するのを手助けすることが奨励されます。 無効、または誤った情報が含まれていると思われる Issue に遭遇した場合は、その <em>理由</em> をあなたが間違っている可能性も考えて説明してください。 そうすることで、大抵の場合正しい結論に早く到達することができます。</p>\n<h2 id=\"バグレポートの解決\"><a href=\"#バグレポートの解決\">バグレポートの解決</a></h2>\n<p>ほとんどの Issue はプルリクエストを開くことで解決されます。 プルリクエストを開いてレビューするプロセスは、問題をオープンして優先順位付けするプロセスと似ています。しかし、提案された変更が Electron プロジェクトの最低限の品質と機能のガイドラインを満たすことを確実にするために必要な、レビューと承認のワークフローを伴います。</p>",
      "title": "Electron の Issue",
      "description": ""
    },
    "/docs/api/structures/jump-list-category": {
      "locale": "ja-JP",
      "slug": "jump-list-category",
      "href": "/docs/api/structures/jump-list-category",
      "crowdinFileId": "256451",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/jump-list-category.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"jumplistcategory-object\"><a href=\"#jumplistcategory-object\">JumpListCategory Object</a></h1>\n<ul>\n<li><code>type</code> String (optional) - One of the following:<ul>\n<li><code>tasks</code> - Items in this category will be placed into the standard <code>Tasks</code> category. There can be only one such category, and it will always be displayed at the bottom of the Jump List.</li>\n<li><code>frequent</code> - Displays a list of files frequently opened by the app, the name of the category and its items are set by Windows.</li>\n<li><code>recent</code> - Displays a list of files recently opened by the app, the name of the category and its items are set by Windows. Items may be added to this category indirectly using <code>app.addRecentDocument(path)</code>.</li>\n<li><code>custom</code> - Displays tasks or file links, <code>name</code> must be set by the app.</li>\n</ul></li>\n<li><code>name</code> String (optional) - Must be set if <code>type</code> is <code>custom</code>, otherwise it should be omitted.</li>\n<li><code>items</code> JumpListItem<a href=\"/docs/api/structures/optional\"></a> - Array of <a href=\"/docs/api/structures/jump-list-item\"><code>JumpListItem</code></a> objects if <code>type</code> is <code>tasks</code> or <code>custom</code>, otherwise it should be omitted.</li>\n</ul>\n<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>\n<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>",
      "title": "JumpListCategory Object",
      "description": ""
    },
    "/docs/api/structures/jump-list-item": {
      "locale": "ja-JP",
      "slug": "jump-list-item",
      "href": "/docs/api/structures/jump-list-item",
      "crowdinFileId": "256453",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/jump-list-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"jumplistitem-object\"><a href=\"#jumplistitem-object\">JumpListItem Object</a></h1>\n<ul>\n<li><code>type</code> String (optional) - One of the following:<ul>\n<li><code>task</code> - A task will launch an app with specific arguments.</li>\n<li><code>separator</code> - Can be used to separate items in the standard <code>Tasks</code> category.</li>\n<li><code>file</code> - A file link will open a file using the app that created the Jump List, for this to work the app must be registered as a handler for the file type (though it doesn't have to be the default handler).</li>\n</ul></li>\n<li><code>path</code> String (optional) - Path of the file to open, should only be set if <code>type</code> is <code>file</code>.</li>\n<li><code>program</code> String (optional) - Path of the program to execute, usually you should specify <code>process.execPath</code> which opens the current program. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>args</code> String (optional) - The command line arguments when <code>program</code> is executed. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>title</code> String (optional) - The text to be displayed for the item in the Jump List. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>description</code> String (optional) - Description of the task (displayed in a tooltip). Should only be set if <code>type</code> is <code>task</code>. Maximum length 260 characters.</li>\n<li><code>iconPath</code> String (optional) - The absolute path to an icon to be displayed in a Jump List, which can be an arbitrary resource file that contains an icon (e.g. <code>.ico</code>, <code>.exe</code>, <code>.dll</code>). You can usually specify <code>process.execPath</code> to show the program icon.</li>\n<li><code>iconIndex</code> Number (optional) - The index of the icon in the resource file. If a resource file contains multiple icons this value can be used to specify the zero-based index of the icon that should be displayed for this task. If a resource file contains only one icon, this property should be set to zero.</li>\n<li><code>workingDirectory</code> String (optional) - The working directory. Default is empty.</li>\n</ul>",
      "title": "JumpListItem Object",
      "description": ""
    },
    "/docs/api/structures/keyboard-event": {
      "locale": "ja-JP",
      "slug": "keyboard-event",
      "href": "/docs/api/structures/keyboard-event",
      "crowdinFileId": "256455",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/keyboard-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"keyboardevent-object\"><a href=\"#keyboardevent-object\">KeyboardEvent Object</a></h1>\n<ul>\n<li><code>ctrlKey</code> Boolean (optional) - whether the Control key was used in an accelerator to trigger the Event</li>\n<li><code>metaKey</code> Boolean (optional) - whether a meta key was used in an accelerator to trigger the Event</li>\n<li><code>shiftKey</code> Boolean (optional) - whether a Shift key was used in an accelerator to trigger the Event</li>\n<li><code>altKey</code> Boolean (optional) - whether an Alt key was used in an accelerator to trigger the Event</li>\n<li><code>triggeredByAccelerator</code> Boolean (optional) - whether an accelerator was used to trigger the event as opposed to another user gesture like mouse click</li>\n</ul>",
      "title": "KeyboardEvent Object",
      "description": ""
    },
    "/docs/api/structures/keyboard-input-event": {
      "locale": "ja-JP",
      "slug": "keyboard-input-event",
      "href": "/docs/api/structures/keyboard-input-event",
      "crowdinFileId": "256457",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/keyboard-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"keyboardinputevent-object-extends-inputevent\"><a href=\"#keyboardinputevent-object-extends-inputevent\">KeyboardInputEvent Object extends <code>InputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>keyDown</code>, <code>keyUp</code> or <code>char</code>.</li>\n<li><code>keyCode</code> String - The character that will be sent as the keyboard event. Should only use the valid key codes in <a href=\"/docs/api/accelerator\">Accelerator</a>.</li>\n</ul>",
      "title": "KeyboardInputEvent Object extends InputEvent",
      "description": ""
    },
    "/docs/tutorial/keyboard-shortcuts": {
      "locale": "ja-JP",
      "slug": "keyboard-shortcuts",
      "href": "/docs/tutorial/keyboard-shortcuts",
      "crowdinFileId": "256209",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/keyboard-shortcuts.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"キーボード-ショート-カット\"><a href=\"#キーボード-ショート-カット\">キーボード ショート カット</a></h1>\n<h2 id=\"概要\"><a href=\"#概要\">概要</a></h2>\n<p>この機能により、Electron アプリケーションのローカルとグローバルのキーボードショートカットを設定できます。</p>\n<h2 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h2>\n<h3 id=\"ローカルショートカット\"><a href=\"#ローカルショートカット\">ローカルショートカット</a></h3>\n<p>ローカルキーボードショートカットは、アプリケーションにフォーカスしているときのみトリガーされます。 ローカルキーボードショートカットを設定するには、<a href=\"/docs/api/menu\">Menu</a> モジュール内の <a href=\"/docs/api/menu-item\">MenuItem</a> 作成時に <a href=\"/docs/api/accelerator\"><code>accelerator</code></a> プロパティを指定する必要があります。</p>\n<p><a href=\"/docs/tutorial/quick-start\">クイックスタートガイド</a> の作業用アプリケーションから始めることにして、 <code>main.js</code> ファイルを以下の行の通りに更新します。</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/local\"><span class=\"hljs-keyword\">const</span> { Menu, MenuItem } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> menu = <span class=\"hljs-keyword\">new</span> Menu()\nmenu.append(<span class=\"hljs-keyword\">new</span> MenuItem({\n  <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Electron'</span>,\n  <span class=\"hljs-attr\">submenu</span>: [{\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'help'</span>,\n    <span class=\"hljs-attr\">accelerator</span>: process.platform === <span class=\"hljs-string\">'darwin'</span> ? <span class=\"hljs-string\">'Alt+Cmd+I'</span> : <span class=\"hljs-string\">'Alt+Shift+I'</span>,\n    <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Electron rocks!'</span>) }\n  }]\n}))\n\nMenu.setApplicationMenu(menu)\n</code></pre>\n<blockquote>\n<p>注意: 上記のコードでは、ユーザーのオペレーティングシステムによってアクセラレーターを変えていることがわかります。 macOS では <code>Alt+Cmd+I</code> で、Linux と Windows では<code>Alt+Shift+I</code> です。</p>\n</blockquote>\n<p>Electron アプリケーションを起動すると、アプリケーションメニューが先ほど定義したローカルショートカットとともに表示されます。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/local-shortcut.png\" alt=\"ローカルショートカット付きのメニュー\"></p>\n<p><code>ヘルプ</code> をクリックする又は定義したアクセラレータを押してから、Electron アプリケーションを実行したターミナルを開くと、<code>click</code> イベントがトリガーされたことで生成されたメッセージ \"Electron rocks!\" が表示されます。</p>\n<h3 id=\"グローバルショートカット\"><a href=\"#グローバルショートカット\">グローバルショートカット</a></h3>\n<p>グローバルキーボードショートカットを設定するには、<a href=\"/docs/api/global-shortcut\">globalShortcut</a> モジュールを使用して、アプリケーションにキーボードフォーカスがない場合のキーボードイベントを検出する必要があります。</p>\n<p><a href=\"/docs/tutorial/quick-start\">クイックスタートガイド</a> の作業用アプリケーションから始めることにして、 <code>main.js</code> ファイルを以下の行の通りに更新します。</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/global\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  globalShortcut.register(<span class=\"hljs-string\">'Alt+CommandOrControl+I'</span>, () => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Electron loves global shortcuts!'</span>)\n  })\n}).then(createWindow)\n</code></pre>\n<blockquote>\n<p>注意: 上記コードの <code>CommandOrControl</code> の組み合わせは、macOS では <code>Command</code> を、Windows/Linux では <code>Control</code> を使用します。</p>\n</blockquote>\n<p>Electron アプリケーションを起動した後、定義されたキーの組み合わせを押して、Electron アプリケーションを起動したターミナルを開くと、Electron はグローバルショートカット大好きだとわかりますね!</p>\n<h3 id=\"browserwindow-内のショートカット\"><a href=\"#browserwindow-内のショートカット\">BrowserWindow 内のショートカット</a></h3>\n<h4 id=\"ウェブ-api-を使用する\"><a href=\"#ウェブ-api-を使用する\">ウェブ API を使用する</a></h4>\n<p><a href=\"/docs/api/browser-window\">BrowserWindow</a> 内でキーボードショートカットを扱いたい場合は、<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\">addEventListener() API</a> を使用して <code>keyup</code> と <code>keydown</code> の <a href=\"https://developer.mozilla.org/en-US/docs/Web/Events\">DOM イベント</a> をレンダラープロセス内でリッスンすることでできます。</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/web-apis\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleKeyPress</span>(<span class=\"hljs-params\">event</span>) </span>{\n  <span class=\"hljs-comment\">// キー押下のハンドリングはここにコードを書くとできます。</span>\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">\"last-keypress\"</span>).innerText = event.key;\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`You pressed <span class=\"hljs-subst\">${event.key}</span>`</span>);\n}\n\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'keyup'</span>, handleKeyPress, <span class=\"hljs-literal\">true</span>);\n</code></pre>\n<blockquote>\n<p>注意: 第 3 引数の <code>true</code> は、このリスナーが他のリスナーよりも必ず優先してキー押下を受け取ることを示しています。そのため、このリスナー内で <code>stopPropagation()</code> を呼び出さないでください。</p>\n</blockquote>\n<h4 id=\"メインプロセス内でのイベントの受け取り\"><a href=\"#メインプロセス内でのイベントの受け取り\">メインプロセス内でのイベントの受け取り</a></h4>\n<p><a href=\"/docs/api/web-contents#event-before-input-event\"><code>before-input-event</code></a> イベントは <code>keydown</code> イベントと <code>keyup</code> イベントをディスパッチするより前に発生します。 メニューに表示されないカスタムショートカットをキャッチして処理するため使用することができます。</p>\n<p><a href=\"/docs/tutorial/quick-start\">クイックスタートガイド</a> の作業用アプリケーションから始めることにして、 <code>main.js</code> ファイルを以下の行の通りに更新します。</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/interception-from-main\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n  win.webContents.on(<span class=\"hljs-string\">'before-input-event'</span>, (event, input) => {\n    <span class=\"hljs-keyword\">if</span> (input.control &#x26;&#x26; input.key.toLowerCase() === <span class=\"hljs-string\">'i'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Pressed Control+I'</span>)\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<p>Electron アプリケーションを起動した後、Electron アプリケーションを実行したターミナルを開き、<code>Ctrl+I</code> キーの組み合わせを押すと、このキーの組み合わせが正常に受け取られたとわかります。</p>\n<h4 id=\"サードパーティライブラリを使用する\"><a href=\"#サードパーティライブラリを使用する\">サードパーティライブラリを使用する</a></h4>\n<p>ショートカットの解析を手動で行いたくない場合は、<a href=\"https://github.com/ccampbell/mousetrap\">mousetrap</a> のような高度なキー検出を行うライブラリがあります。 レンダラープロセスで <code>mousetrap</code> を実行する使用例を以下に示します。</p>\n<pre><code class=\"hljs language-js\">Mousetrap.bind(<span class=\"hljs-string\">'4'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'4'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'?'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'show shortcuts!'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'esc'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'escape'</span>) }, <span class=\"hljs-string\">'keyup'</span>)\n\n<span class=\"hljs-comment\">// 組み合わせ</span>\nMousetrap.bind(<span class=\"hljs-string\">'command+shift+k'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'command shift k'</span>) })\n\n<span class=\"hljs-comment\">// 複数の組み合わせを同じコールバックに割り当て</span>\nMousetrap.bind([<span class=\"hljs-string\">'command+k'</span>, <span class=\"hljs-string\">'ctrl+k'</span>], () => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'command k or control k'</span>)\n\n  <span class=\"hljs-comment\">// false を返すと規定の動作を抑制してイベントの伝播を止める</span>\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n\n<span class=\"hljs-comment\">// Gmail 式シーケンス</span>\nMousetrap.bind(<span class=\"hljs-string\">'g i'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'go to inbox'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'* a'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'select all'</span>) })\n\n<span class=\"hljs-comment\">// コナミコマンド!</span>\nMousetrap.bind(<span class=\"hljs-string\">'up up down down left right left right b a enter'</span>, () => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'コナミコマンド'</span>)\n})\n</code></pre>",
      "title": "キーボード ショート カット",
      "description": "注意: 上記のコードでは、ユーザーのオペレーティングシステムによってアクセラレーターを変えていることがわかります。 macOS では Alt+Cmd+I で、Linux と Windows ではAlt+Shift+I です。"
    },
    "/docs/tutorial/launch-app-from-url-in-another-app": {
      "locale": "ja-JP",
      "slug": "launch-app-from-url-in-another-app",
      "href": "/docs/tutorial/launch-app-from-url-in-another-app",
      "crowdinFileId": "256211",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/launch-app-from-url-in-another-app.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<hr>\n<p>title: 他アプリ内の URL から自分の Electron アプリを起動する\ndescription: このガイドでは、Electron アプリを特定のプロトコルのデフォルトハンドラとして設定する手順を説明します。\nslug: launch-app-from-url-in-another-app</p>\n<h2 id=\"hide_title-true\"><a href=\"#hide_title-true\">hide_title: true</a></h2>\n<h1 id=\"他アプリ内の-url-から自分の-electron-アプリを起動する\"><a href=\"#他アプリ内の-url-から自分の-electron-アプリを起動する\">他アプリ内の URL から自分の Electron アプリを起動する</a></h1>\n<h2 id=\"概要\"><a href=\"#概要\">概要</a></h2>\n<!-- ✍ Update this section if you want to provide more details -->\n<p>このガイドでは、Electron アプリを特定の <a href=\"https://www.electronjs.org/docs/api/protocol\">protocol</a> のデフォルトハンドラとして設定する手順を説明します。</p>\n<p>このチュートリアルを終える頃には、特定のプロトコルで始まる URL がクリックされた場合、アプリがそれに干渉してハンドリングするように設定できます。 このガイドでは、使用するプロトコルを \"<code>electron-fiddle://</code>\" とします。</p>\n<h2 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h2>\n<h3 id=\"メインプロセス-mainjs\"><a href=\"#メインプロセス-mainjs\">メインプロセス (main.js)</a></h3>\n<p>最初に、<code>electron</code> から必要なモジュールをインポートします。 これらのモジュールは、アプリケーションのライフサイクルの制御と、ネイティブなブラウザウインドウの作成を助けます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n</code></pre>\n<p>次に、\"<code>electron-fiddle://</code>\" プロトコルをすべて処理するために、アプリケーションを登録します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">if</span> (process.defaultApp) {\n  <span class=\"hljs-keyword\">if</span> (process.argv.length >= <span class=\"hljs-number\">2</span>) {\n    app.setAsDefaultProtocolClient(<span class=\"hljs-string\">'electron-fiddle'</span>, process.execPath, [path.resolve(process.argv[<span class=\"hljs-number\">1</span>])])\n  }\n} <span class=\"hljs-keyword\">else</span> {\n  app.setAsDefaultProtocolClient(<span class=\"hljs-string\">'electron-fiddle'</span>)\n}\n</code></pre>\n<p>ここで、ブラウザのウインドウを作成し、アプリケーションの <code>index.html</code> ファイルを読み込む関数を定義します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> createWindow = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// ブラウザウインドウを作成します。</span>\n  mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  mainWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n</code></pre>\n<p>この次のステップで、<code>BrowserWindow</code> を作成し、外部プロトコルがクリックされたイベントの処理方法をアプリケーションに伝えます。</p>\n<p>Windows でのこのコードは、MacOS や Linux と異なります。 これは、Windows で同じ Electron インスタンス内のプロトコルリンクのコンテンツを開くには、さらなるコードが必要だからです。 この詳細については、<a href=\"https://www.electronjs.org/docs/api/app#apprequestsingleinstancelock\">こちら</a> をお読みください。</p>\n<h4 id=\"windows-のコード\"><a href=\"#windows-のコード\">Windows のコード:</a></h4>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> gotTheLock = app.requestSingleInstanceLock()\n\n<span class=\"hljs-keyword\">if</span> (!gotTheLock) {\n  app.quit()\n} <span class=\"hljs-keyword\">else</span> {\n  app.on(<span class=\"hljs-string\">'second-instance'</span>, (event, commandLine, workingDirectory) => {\n    <span class=\"hljs-comment\">// 誰かが 2 つ目のインスタンスを実行しようとしたので、ウインドウにフォーカスさせなければなりません。</span>\n    <span class=\"hljs-keyword\">if</span> (mainWindow) {\n      <span class=\"hljs-keyword\">if</span> (mainWindow.isMinimized()) mainWindow.restore()\n      mainWindow.focus()\n    }\n  })\n\n  <span class=\"hljs-comment\">// mainWindow を作成する、アプリの残りを読み込む、等</span>\n  app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    createWindow()\n  })\n\n  <span class=\"hljs-comment\">// プロトコルのハンドリング。 今回は、エラーボックスを表示することにします。</span>\n  app.on(<span class=\"hljs-string\">'open-url'</span>, (event, url) => {\n    dialog.showErrorBox(<span class=\"hljs-string\">'Welcome Back'</span>, <span class=\"hljs-string\">`You arrived from: <span class=\"hljs-subst\">${url}</span>`</span>)\n  })\n}\n</code></pre>\n<h4 id=\"macos-と-linux-のコード\"><a href=\"#macos-と-linux-のコード\">macOS と Linux のコード:</a></h4>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// このメソッドは、Electron の初期化が完了し、</span>\n<span class=\"hljs-comment\">// ブラウザウインドウの作成準備ができると呼び出されます。</span>\n<span class=\"hljs-comment\">// 一部のAPIはこのイベントが発生した後にのみ利用できます。</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n})\n\n<span class=\"hljs-comment\">// プロトコルのハンドリング。 今回は、エラーボックスを表示することにします。</span>\napp.on(<span class=\"hljs-string\">'open-url'</span>, (event, url) => {\n  dialog.showErrorBox(<span class=\"hljs-string\">'Welcome Back'</span>, <span class=\"hljs-string\">`You arrived from: <span class=\"hljs-subst\">${url}</span>`</span>)\n})\n</code></pre>\n<p>最後に、誰かがアプリケーションを閉じたときの処理コードを追加します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// macOS 以外では、すべてのウインドウを閉じたときに終了します。 // ユーザが Cmd + Q で明示的に終了するまで、アプリケーションと</span>\n<span class=\"hljs-comment\">// そのメニューバーがアクティブになっているのが一般的です。</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h2 id=\"重要な注意事項\"><a href=\"#重要な注意事項\">重要な注意事項</a></h2>\n<h3 id=\"パッケージ化\"><a href=\"#パッケージ化\">パッケージ化</a></h3>\n<p>macOS と Linux では、この機能はアプリがパッケージ化されているときのみ動作します。 開発中でコマンドラインから起動した場合は動作しません。 アプリをパッケージ化する際には、アプリの macOS の <code>Info.plist</code> と Linux の <code>.desktop</code> が更新され、その新しいプロトコルハンドラが含まれていることを確認するようにしてください。 Electron のアプリのバンドル及び頒布ツールには、この処理を行ってくれるものもあります。</p>\n<h4 id=\"electron-forge\"><a href=\"#electron-forge\"></a><a href=\"https://electronforge.io\">Electron Forge</a></h4>\n<p>Electron Forge を使用している場合は、<a href=\"https://www.electronforge.io/configuration\">Forge の設定</a> において macOS サポート用に <code>packagerConfig</code> を、Linux サポート用に適切な Linux makers の設定を調整してください <em>(以下の例は、設定変更を加えるために必要な最低限のことしか示していないことに注意してください)</em>。</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"config\"</span>: {\n    <span class=\"hljs-attr\">\"forge\"</span>: {\n      <span class=\"hljs-attr\">\"packagerConfig\"</span>: {\n        <span class=\"hljs-attr\">\"protocols\"</span>: [\n          {\n            <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"Electron Fiddle\"</span>,\n            <span class=\"hljs-attr\">\"schemes\"</span>: [<span class=\"hljs-string\">\"electron-fiddle\"</span>]\n          }\n        ]\n      },\n      <span class=\"hljs-attr\">\"makers\"</span>: [\n        {\n          <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"@electron-forge/maker-deb\"</span>,\n          <span class=\"hljs-attr\">\"config\"</span>: {\n            <span class=\"hljs-attr\">\"mimeType\"</span>: [<span class=\"hljs-string\">\"x-scheme-handler/electron-fiddle\"</span>]\n          }\n        }\n      ]\n    }\n  }\n}\n</code></pre>\n<h4 id=\"electron-パッケージャ\"><a href=\"#electron-パッケージャ\"></a><a href=\"https://github.com/electron/electron-packager\">Electron パッケージャ</a></h4>\n<p>macOS サポートの場合:</p>\n<p>Electron Packager の API を使用している場合、プロトコルハンドラ対応の追加は Electron Forge と似た処理方法ですが、<code>protocols</code> が <code>packager</code> 関数に渡される Packager オプションの一部である点が異なります。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> packager = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-packager'</span>)\n\npackager({\n  <span class=\"hljs-comment\">// ...他のオプション...</span>\n  <span class=\"hljs-attr\">protocols</span>: [\n    {\n      <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Electron Fiddle'</span>,\n      <span class=\"hljs-attr\">schemes</span>: [<span class=\"hljs-string\">'electron-fiddle'</span>]\n    }\n  ]\n\n}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">paths</span> =></span> <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`SUCCESS: Created <span class=\"hljs-subst\">${paths.join(<span class=\"hljs-string\">', '</span>)}</span>`</span>))\n  .catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">`ERROR: <span class=\"hljs-subst\">${err.message}</span>`</span>))\n</code></pre>\n<p>Electron Packager の CLI を使用している場合、<code>--protocol</code> と <code>--protocol-name</code> のフラグを使用してください。 以下は例です。</p>\n<pre><code class=\"hljs language-shell\">npx electron-packager . --protocol=electron-fiddle --protocol-name=\"Electron Fiddle\"\n</code></pre>\n<h2 id=\"おわりに\"><a href=\"#おわりに\">おわりに</a></h2>\n<p>Electron アプリを起動した後、ブラウザにカスタムプロトコルを含む URL、例えば<code>\"electron-fiddle://open\"</code> を入力すると、アプリが応答してエラーダイアログボックスを表示することを確認できます。</p>\n<!--\n    Because Electron examples usually require multiple files (HTML, CSS, JS\n    for the main and renderer process, etc.), we use this custom code block\n    for Fiddle (https://www.electronjs.org/fiddle).\n    Please modify any of the files in the referenced folder to fit your\n    example.\n    The content in this codeblock will not be rendered in the website so you\n    can leave it empty.\n-->\n<!-- ✍ Explanation of the code below -->",
      "title": "他アプリ内の URL から自分の Electron アプリを起動する",
      "description": ""
    },
    "/docs/tutorial/linux-desktop-actions": {
      "locale": "ja-JP",
      "slug": "linux-desktop-actions",
      "href": "/docs/tutorial/linux-desktop-actions",
      "crowdinFileId": "256213",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/linux-desktop-actions.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"デスクトップランチャーアクション-linux\"><a href=\"#デスクトップランチャーアクション-linux\">デスクトップランチャーアクション (Linux)</a></h1>\n<h2 id=\"概要\"><a href=\"#概要\">概要</a></h2>\n<p>多くの Linux 環境では、<code>.desktop</code> ファイルを変更することでシステムランチャーにカスタムエントリを追加できます。 Canonical の Unity ドキュメントについては、<a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">ランチャーにショートカットを追加する</a> を参照してください。 より一般的な実装については、<a href=\"https://specifications.freedesktop.org/desktop-entry-spec/1.1/ar01s11.html\">freedesktop.org 仕様</a> を参照してください。</p>\n<p><img src=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles?action=AttachFile&#x26;do=get&#x26;target=shortcuts.png\" alt=\"audacious\"></p>\n<blockquote>\n<p>注意: 上のスクリーンショットは Audacious オーディオプレーヤーのランチャーショートカットの例です。</p>\n</blockquote>\n<p>ショートカットを作成するには、ショートカットメニューに追加したいエントリごとに <code>Name</code> と <code>Exec</code> プロパティを指定する必要があります。 Unity は、ユーザーがショートカットのメニューアイテムをクリックした後に <code>Exec</code> フィールドで定義されたコマンドを実行します。 <code>.desktop</code> ファイルの例を以下に示します。</p>\n<pre><code class=\"hljs language-plaintext\">Actions=PlayPause;Next;Previous\n\n[Desktop Action PlayPause]\nName=Play-Pause\nExec=audacious -t\nOnlyShowIn=Unity;\n\n[Desktop Action Next]\nName=Next\nExec=audacious -f\nOnlyShowIn=Unity;\n\n[Desktop Action Previous]\nName=Previous\nExec=audacious -r\nOnlyShowIn=Unity;\n</code></pre>\n<p>Unity がアプリケーションにやることを指定する好ましい方法は、引数の利用です。 これはアプリケーション内からグローバル変数 <code>process.argv</code> で参照できます。</p>",
      "title": "デスクトップランチャーアクション (Linux)",
      "description": "注意: 上のスクリーンショットは Audacious オーディオプレーヤーのランチャーショートカットの例です。"
    },
    "/docs/tutorial/mac-app-store-submission-guide": {
      "locale": "ja-JP",
      "slug": "mac-app-store-submission-guide",
      "href": "/docs/tutorial/mac-app-store-submission-guide",
      "crowdinFileId": "256215",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/mac-app-store-submission-guide.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"mac-app-store-への公開ガイド\"><a href=\"#mac-app-store-への公開ガイド\">Mac App Store への公開ガイド</a></h1>\n<p>このガイドでは以下の情報を提供しています。</p>\n<ul>\n<li>macOS で Electron アプリを署名する方法;</li>\n<li>Mac App Store (MAS) に Electron アプリを提出する方法;</li>\n<li>MAS ビルドの制限。</li>\n</ul>\n<h2 id=\"要件\"><a href=\"#要件\">要件</a></h2>\n<p>Electron アプリを署名するには、まず以下のツールをインストールする必要があります。</p>\n<ul>\n<li>Xcode 11 以降。</li>\n<li><a href=\"https://github.com/electron/electron-osx-sign\">electron-osx-sign</a> npm モジュール。</li>\n</ul>\n<p>また、Apple Developer アカウントを登録し <a href=\"https://developer.apple.com/support/compare-memberships/\">Apple Developer Program</a> に参加する必要があります。</p>\n<h2 id=\"electron-アプリを署名する\"><a href=\"#electron-アプリを署名する\">Electron アプリを署名する</a></h2>\n<p>Electron アプリは Mac App Store や外部サイトで頒布できます。 それぞれの方法ごとに、署名やテストの方法が異なります。 このガイドでは Mac App Store での頒布を中心に説明しますが、その他の方法についても言及します。</p>\n<p>以下の手順で、Apple から証明書を取得する方法、Electron アプリに署名する方法、テストする方法を説明します。</p>\n<h3 id=\"証明書の取得\"><a href=\"#証明書の取得\">証明書の取得</a></h3>\n<p>最も簡単に署名証明書を取得するには、Xcode を使用して以下のようします。</p>\n<ol>\n<li>Xcode を開いて設定の \"Accounts\" を開きます。</li>\n<li>Apple アカウントでサインインします。</li>\n<li>チームを選択して \"Manage Certificates\" をクリックします。</li>\n<li>署名証明書シートの左下にある追加ボタン (+) をクリックし、以下の証明書を追加します。<ul>\n<li>\"Apple Development\"</li>\n<li>\"Apple Distribution\"</li>\n</ul></li>\n</ol>\n<p>\"Apple Development\" 証明書は、Apple Developer ウェブサイトで登録したマシン上で、開発およびテスト用のアプリに署名するために使用します。 登録方法については、<a href=\"#prepare-provisioning-profile\">プロビジョニングプロファイルの準備</a> で説明します。</p>\n<p>\"Apple Development\" 証明書で署名したアプリは Mac App Store に提出できません。 このためには、代わりに \"Apple Distribution\" 証明書でアプリに署名する必要があります。 ただし注意として、\"Apple Distribution\" 証明書で署名したアプリはそのまま実行できません。実行できるようにするには Apple が再署名する必要がありますが、これは Mac App Store からダウンロードした後でのみ可能になります。</p>\n<h4 id=\"その他の証明書\"><a href=\"#その他の証明書\">その他の証明書</a></h4>\n<p>証明書の種類が他にもあることにお気づきでしょう。</p>\n<p>\"Developer ID Application\" 証明書は、アプリを Mac App Store 以外で頒布する前の署名に使用します。</p>\n<p>\"Developer ID Installer\" および \"Mac Installer Distribution\" の証明書は、アプリ自体ではなく \"Mac Installer Package\" の署名に使用します。 ほとんどの Electron アプリは Mac Installer Package を使用しないので、通常は必要ありません。</p>\n<p>証明書の種類の完全なリストは <a href=\"https://help.apple.com/xcode/mac/current/#/dev80c6204ec\">こちら</a> で見られます。</p>\n<p>\"Apple Development\" および \"Apple Distribution\" 証明書で署名されたアプリは <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandbox</a> 下でしか実行できないため、Electron の MAS ビルドを使用する必要があります。 しかし、\"Developer ID Application\" 証明書にはこの制限がないため、この証明書で署名されたアプリは Electron の通常ビルドと MAS ビルドのどちらでも使用できます。</p>\n<h4 id=\"従来の証明書の名称\"><a href=\"#従来の証明書の名称\">従来の証明書の名称</a></h4>\n<p>Apple は過去数年の間に証明書の名称を変更しており、古いドキュメントを読んでいると古い名称が出てくるかもしれません。一部のユーティリティも未だに古い名称を使用していることがあります。</p>\n<ul>\n<li>\"Apple Distribution\" 証明書は、\"3rd Party Mac Developer Application\" や \"Mac App Distribution\" という名称でもありました。</li>\n<li>\"Apple Development\" 証明書は、\"Mac Developer\" や \"Development\" という名称でもありました。</li>\n</ul>\n<h3 id=\"プロビジョニングプロファイルの準備\"><a href=\"#プロビジョニングプロファイルの準備\">プロビジョニングプロファイルの準備</a></h3>\n<p>Mac App Store へアプリを提出する前にローカルマシンでアプリをテストしたい場合は、アプリバンドルに埋め込まれたプロビジョニングプロファイル付きの \"Apple Development\" 証明書でアプリを署名する必要があります。</p>\n<p><a href=\"https://help.apple.com/developer-account/#/devf2eb157f8\">プロビジョニングプロファイルの作成</a> は、以下の手順を踏むとできます。</p>\n<ol>\n<li><a href=\"https://developer.apple.com/account\">Apple Developer</a> のウェブサイトで \"Certificates, Identifiers &#x26; Profiles\" のページを開きます。</li>\n<li>\"Identifiers\" のページ内でアプリの App ID を新規追加します。</li>\n<li>\"Devices\" のページでローカルのマシンを登録します。 お使いのマシンの \"デバイス ID\" は、\"システム情報\" アプリの \"ハードウェア\" のページで確認できます。</li>\n<li>\"Profiles\" のページで新しいプロビジョニングプロファイルを登録し、<code>/path/to/yourapp.provisionprofile</code> へダウンロードします。</li>\n</ol>\n<h3 id=\"apple-のアプリサンドボックスを有効にする\"><a href=\"#apple-のアプリサンドボックスを有効にする\">Apple のアプリサンドボックスを有効にする</a></h3>\n<p>Mac App Store に提出したアプリは Apple の <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandbox</a> 下で実行する必要があり、Electron の MAS ビルドだけが App Sandbox で実行できます。 Electron の標準の darwin ビルドでは、App Sandbox で実行すると起動に失敗します。</p>\n<p><code>electron-osx-sign</code> でアプリを署名すると、必要なエンタイトルメントが自動追加されます。しかしカスタムエンタイトルメントを使用している場合は、App Sandbox の資格が追加されていることを確認する必要があります。</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<h4 id=\"electron-osx-sign-を使わない場合のさらなる手順\"><a href=\"#electron-osx-sign-を使わない場合のさらなる手順\"><code>electron-osx-sign</code> を使わない場合のさらなる手順</a></h4>\n<p><code>electron-osx-sign</code> を使わずにアプリを署名する場合、アプリバンドルのエンタイトルメントが少なくとも以下のキーを持っていることを確認する必要があります。</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.application-groups<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">array</span>></span>\n      <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>TEAM_ID.your.bundle.id<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n    <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">array</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p><code>TEAM_ID</code> は Apple Developer アカウントの Team ID に、<code>your.bundle.id</code> はアプリの App ID に置き換えてください。</p>\n<p>また、アプリのバンドル内のバイナリやヘルパーに以下のエンタイトルメントを追加する必要があります。</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.inherit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>そしてアプリバンドルの <code>Info.plist</code> には、<code>ElectronTeamID</code> キーに Apple Developer アカウントの Team ID を値として含める必要があります。</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n  ...\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>ElectronTeamID<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>TEAM_ID<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p><code>electron-osx-sign</code> を使用する場合は、証明書の名前から Team ID を抽出することで <code>ElectronTeamID</code> キーが自動追加されます。 <code>electron-osx-sign</code> が正しい Team ID を見つけられなかった場合は、このキーを手動で追加する必要があるでしょう。</p>\n<h3 id=\"開発用にアプリを署名する\"><a href=\"#開発用にアプリを署名する\">開発用にアプリを署名する</a></h3>\n<p>開発マシン上で実行できるようにアプリを署名するには、\"Apple Development\" 証明書で署名し、そのプロビジョニングプロファイルを <code>electron-osx-sign</code> に渡す必要があります。</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Apple Development'</span> --provisioning-profile=/path/to/yourapp.provisionprofile\n</code></pre>\n<p><code>electron-osx-sign</code> を使わずに署名する場合は、プロビジョニングプロファイルを <code>YourApp.app/Contents/embedded.provisionprofile</code> に配置する必要があります。</p>\n<p>署名したアプリはプロビジョニングプロファイルによって登録されたマシン上でのみ実行可能です。これが Mac App Store に提出する前に署名したアプリをテストする唯一の方法です。</p>\n<h3 id=\"mac-app-store-へ提出するためにアプリを署名する\"><a href=\"#mac-app-store-へ提出するためにアプリを署名する\">Mac App Store へ提出するためにアプリを署名する</a></h3>\n<p>Mac App Store へ提出するアプリを署名するには、\"Apple Distribution\" 証明書で署名する必要があります。 注意として、この証明書で署名されたアプリは、Mac App Store からダウンロードしない限りどのマシンでも実行できません。</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Apple Distribution'</span>\n</code></pre>\n<h3 id=\"mac-app-store-以外で頒布するアプリケーションの署名\"><a href=\"#mac-app-store-以外で頒布するアプリケーションの署名\">Mac App Store 以外で頒布するアプリケーションの署名</a></h3>\n<p>Mac App Store への申請の予定がない場合は、\"Developer ID Application\" 証明書で署名できます。 この方法では App Sandbox 上の要件はありません。App Sandbox を使用しない場合は、Electron の通常の darwin ビルドを使用してください。</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Developer ID Application'</span> --no-gatekeeper-assess\n</code></pre>\n<p><code>--no-gatekeeper-assess</code> を指定すると、<code>electron-osx-sign</code> は macOS の GateKeeper の確認を飛ばします。通常この段階ではアプリはまだ公証されていません。</p>\n<!-- TODO(zcbenz): Add a chapter about App Notarization -->\n<p>このガイドでは、<a href=\"https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution\">App Notarization</a> については説明しません。しかし App Notarization を行っておかないと、ユーザーが Mac App Store 以外からのアプリを使用できないように Apple が阻害する可能性があるので、行っておいた方がよいでしょう。</p>\n<h2 id=\"mac-app-store-に提出する\"><a href=\"#mac-app-store-に提出する\">Mac App Store に提出する</a></h2>\n<p>\"Apple Distribution\" 証明書でアプリを署名すれば、Mac App Store に提出できます。</p>\n<p>このガイドは、Apple がアプリを承認することを保証していません。Mac App Store の登録要件を満たすには、Apple の <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/SubmittingYourApp/SubmittingYourApp.html\">アプリの提出</a> のガイドも読んでおくべきでしょう。</p>\n<h3 id=\"アップロードする\"><a href=\"#アップロードする\">アップロードする</a></h3>\n<p>手続きのために、Application Loader を使用して署名したアプリを iTunes Connect にアップロードする必要があります。アップロードする前に <a href=\"https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/CreatingiTunesConnectRecord.html\">レコードを作成した</a> ことを確認するようにしてください。</p>\n<p>非公開 API の利用といったエラーが出る場合は、アプリが Electron の MAS ビルドを使用しているかどうかを確認するとよいでしょう。</p>\n<h3 id=\"審査に提出する\"><a href=\"#審査に提出する\">審査に提出する</a></h3>\n<p>アップロードした後は、<a href=\"https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html\">アプリを審査に提出</a> しましょう。</p>\n<h2 id=\"mas-ビルドの制限\"><a href=\"#mas-ビルドの制限\">MAS ビルドの制限</a></h2>\n<p>アプリのサンドボックスですべての要件を満たすために、MASビルドで次のモジュールを無効にしてください。</p>\n<ul>\n<li><code>crashReporter</code></li>\n<li><code>autoUpdater</code></li>\n</ul>\n<p>次の挙動を変更してください。</p>\n<ul>\n<li>ビデオキャプチャーはいくつかのマシンで動作しないかもしれません。</li>\n<li>一部のアクセシビリティ機能が動作しないことがあります。</li>\n<li>アプリはDNSの変更を認識しません。</li>\n</ul>\n<p>サンドボックス化の利用により、アプリがアクセスできるリソースは厳密に制限されます。詳細は <a href=\"https://developer.apple.com/app-sandboxing/\">アプリのサンドボックス化</a> をご参照ください。</p>\n<h3 id=\"追加のエンタイトルメント\"><a href=\"#追加のエンタイトルメント\">追加のエンタイトルメント</a></h3>\n<p>アプリが使用する Electron API に応じて、アプリの entitlements ファイルに追加のエンタイトルメントが必要です。 さもなくば、App Sandbox がその使用を阻害することがあります。</p>\n<h4 id=\"ネットワークアクセス\"><a href=\"#ネットワークアクセス\">ネットワークアクセス</a></h4>\n<p>アプリがサーバーに接続できるように、以下のように発信ネットワーク接続を有効にします。</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.network.client<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>アプリがネットワーク待機ソケットを開くことを許可するために、以下のように着信ネットワーク接続を有効にします。</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.network.server<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>詳細は <a href=\"https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW9\">Enabling Network Access ドキュメント</a> を参照してください。</p>\n<h4 id=\"dialogshowopendialog\"><a href=\"#dialogshowopendialog\">dialog.showOpenDialog</a></h4>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.files.user-selected.read-only<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>詳細は <a href=\"https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6\">Enabling User-Selected File Access ドキュメント</a> を参照してください。</p>\n<h4 id=\"dialogshowsavedialog\"><a href=\"#dialogshowsavedialog\">dialog.showSaveDialog</a></h4>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.files.user-selected.read-write<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>詳細は <a href=\"https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6\">Enabling User-Selected File Access ドキュメント</a> を参照してください。</p>\n<h2 id=\"electron-が使用する暗号化アルゴリズム\"><a href=\"#electron-が使用する暗号化アルゴリズム\">Electron が使用する暗号化アルゴリズム</a></h2>\n<p>アプリをリリースする国によっては、ソフトウェアで使用されている暗号化アルゴリズムに関する情報を提供する必要があります。 詳細は <a href=\"https://help.apple.com/app-store-connect/#/devc3f64248f\">暗号輸出コンプライアンスドキュメント</a> を参照してください。</p>\n<p>Electron は次の暗号アルゴリズムを使用しています:</p>\n<ul>\n<li>AES - <a href=\"https://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf\">NIST SP 800-38A</a>, <a href=\"https://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf\">NIST SP 800-38D</a>, <a href=\"https://www.ietf.org/rfc/rfc3394.txt\">RFC 3394</a></li>\n<li>HMAC - <a href=\"https://csrc.nist.gov/publications/fips/fips198-1/FIPS-198-1_final.pdf\">FIPS 198-1</a></li>\n<li>ECDSA - ANS X9.62–2005</li>\n<li>ECDH - ANS X9.63–2001</li>\n<li>HKDF - <a href=\"https://csrc.nist.gov/publications/nistpubs/800-56C/SP-800-56C.pdf\">NIST SP 800-56C</a></li>\n<li>PBKDF2 - <a href=\"https://tools.ietf.org/html/rfc2898\">RFC 2898</a></li>\n<li>RSA - <a href=\"https://www.ietf.org/rfc/rfc3447\">RFC 3447</a></li>\n<li>SHA - <a href=\"https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf\">FIPS 180-4</a></li>\n<li>Blowfish - <a href=\"https://www.schneier.com/cryptography/blowfish/\">https://www.schneier.com/cryptography/blowfish/</a></li>\n<li>CAST - <a href=\"https://tools.ietf.org/html/rfc2144\">RFC 2144</a>, <a href=\"https://tools.ietf.org/html/rfc2612\">RFC 2612</a></li>\n<li>DES - <a href=\"https://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf\">FIPS 46-3</a></li>\n<li>DH - <a href=\"https://tools.ietf.org/html/rfc2631\">RFC 2631</a></li>\n<li>DSA - <a href=\"https://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+X9.30-1%3A1997\">ANSI X9.30</a></li>\n<li>EC - <a href=\"https://www.secg.org/sec1-v2.pdf\">SEC 1</a></li>\n<li>IDEA - \"On the Design and Security of Block Ciphers\" book by X. Lai</li>\n<li>MD2 - <a href=\"https://tools.ietf.org/html/rfc1319\">RFC 1319</a></li>\n<li>MD4 - <a href=\"https://tools.ietf.org/html/rfc6150\">RFC 6150</a></li>\n<li>MD5 - <a href=\"https://tools.ietf.org/html/rfc1321\">RFC 1321</a></li>\n<li>MDC2 - <a href=\"https://wiki.openssl.org/index.php/Manual:Mdc2(3)\">ISO/IEC 10118-2</a></li>\n<li>RC2 - <a href=\"https://tools.ietf.org/html/rfc2268\">RFC 2268</a></li>\n<li>RC4 - <a href=\"https://tools.ietf.org/html/rfc4345\">RFC 4345</a></li>\n<li>RC5 - <a href=\"https://people.csail.mit.edu/rivest/Rivest-rc5rev.pdf\">https://people.csail.mit.edu/rivest/Rivest-rc5rev.pdf</a></li>\n<li>RIPEMD - <a href=\"https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2010118-3:2004\">ISO/IEC 10118-3</a></li>\n</ul>",
      "title": "Mac App Store への公開ガイド",
      "description": ""
    },
    "/docs/tutorial/macos-dock": {
      "locale": "ja-JP",
      "slug": "macos-dock",
      "href": "/docs/tutorial/macos-dock",
      "crowdinFileId": "256217",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/macos-dock.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dock-macos\"><a href=\"#dock-macos\">Dock (macOS)</a></h1>\n<p>Electron には macOS Dock 内のアプリアイコンを設定する API があります。 カスタム Dock メニューを作成するための macOS 専用 API は存在しますが、Electron は <a href=\"/docs/tutorial/recent-documents\">最近使った書類</a> や <a href=\"/docs/tutorial/progress-bar\">アプリケーションのプログレス</a> などのクロスプラットフォーム機能のエントリポイントにアプリの Dock アイコンを使用します。</p>\n<p>カスタム Dock は、ユーザーが全てのアプリウインドウを開きたくないであろう作業のショートカット追加によく使われます。</p>\n<p><strong>ターミナルアプリのDockメニュー</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5069962/6032658a-6e9c-11e4-9953-aa84006bdfff.png\" alt=\"Dockメニュー\"></p>\n<p>カスタム Dock メニューを設定するには、macOS でのみ利用可能な <a href=\"/docs/api/dock#docksetmenumenu-macos\"><code>app.dock.setMenu</code></a> API を使用する必要があります。</p>\n<h2 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h2>\n<p><a href=\"/docs/tutorial/quick-start\">クイックスタートガイド</a> の作業用アプリケーションから始めることにして、 <code>main.js</code> ファイルを以下の行の通りに更新します。</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/macos-dock-menu\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\n<span class=\"hljs-keyword\">const</span> dockMenu = Menu.buildFromTemplate([\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Window'</span>,\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'New Window'</span>) }\n  }, {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Window with Settings'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Basic'</span> },\n      { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Pro'</span> }\n    ]\n  },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Command...'</span> }\n])\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">if</span> (process.platform === <span class=\"hljs-string\">'darwin'</span>) {\n    app.dock.setMenu(dockMenu)\n  }\n}).then(createWindow)\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n\n</code></pre>\n<p>Electron アプリケーションの起動後、アプリケーションのアイコンを右クリックしてみましょう。 先ほど定義したカスタムメニューが表示されるはずです。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/macos-dock-menu.png\" alt=\"macOS Dock メニュー\"></p>",
      "title": "Dock (macOS)",
      "description": ""
    },
    "/docs/api/structures/memory-info": {
      "locale": "ja-JP",
      "slug": "memory-info",
      "href": "/docs/api/structures/memory-info",
      "crowdinFileId": "256459",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/memory-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"memoryinfo-object\"><a href=\"#memoryinfo-object\">MemoryInfo Object</a></h1>\n<ul>\n<li><code>workingSetSize</code> Integer - The amount of memory currently pinned to actual physical RAM.</li>\n<li><code>peakWorkingSetSize</code> Integer - The maximum amount of memory that has ever been pinned to actual physical RAM.</li>\n<li><code>privateBytes</code> Integer (optional) <em>Windows</em> - The amount of memory not shared by other processes, such as JS heap or HTML content.</li>\n</ul>\n<p>Note that all statistics are reported in Kilobytes.</p>",
      "title": "MemoryInfo Object",
      "description": ""
    },
    "/docs/api/structures/memory-usage-details": {
      "locale": "ja-JP",
      "slug": "memory-usage-details",
      "href": "/docs/api/structures/memory-usage-details",
      "crowdinFileId": "256461",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/memory-usage-details.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"memoryusagedetails-object\"><a href=\"#memoryusagedetails-object\">MemoryUsageDetails Object</a></h1>\n<ul>\n<li><code>count</code> Number</li>\n<li><code>size</code> Number</li>\n<li><code>liveSize</code> Number</li>\n</ul>",
      "title": "MemoryUsageDetails Object",
      "description": ""
    },
    "/docs/api/menu": {
      "locale": "ja-JP",
      "slug": "menu",
      "href": "/docs/api/menu",
      "crowdinFileId": "256335",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/menu.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"menu\"><a href=\"#menu\">Menu</a></h1>\n<h2 id=\"クラス-menu\"><a href=\"#クラス-menu\">クラス: Menu</a></h2>\n<blockquote>\n<p>ネイティブアプリケーションのメニューとコンテキストメニューを作成します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h3 id=\"new-menu\"><a href=\"#new-menu\"><code>new Menu()</code></a></h3>\n<p>新しいメニューを作成します</p>\n<h3 id=\"静的メソッド\"><a href=\"#静的メソッド\">静的メソッド</a></h3>\n<p><code>Menu</code> クラスは以下の静的メソッドを持ちます。</p>\n<h4 id=\"menusetapplicationmenumenu\"><a href=\"#menusetapplicationmenumenu\"><code>Menu.setApplicationMenu(menu)</code></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>macOS では、 <code>menu</code> をアプリケーションメニューとして設定します。 Windows と Linux では、 <code>menu</code> は各ウィンドウのトップメニューとして設定されます。</p>\n<p>更に Windows と Linux では、最上位のアイテム名に <code>&#x26;</code> を使用して、アクセラレータを生成させるときに取得する文字を指定できます。 たとえば、ファイルメニューに <code>&#x26;File</code> を使用すると、その関連付けされたメニューを開く <code>Alt-F</code> アクセラレータが生成されます。 ボタンラベルでその指定をした文字には下線が引かれ、<code>&#x26;</code> 文字はボタンラベルに表示されません。</p>\n<p>メニューアイテム名の <code>&#x26;</code> 文字をエスケープするには、<code>&#x26;</code> を続けて書きます。 例えば、<code>&#x26;&#x26;File</code> とするとボタンラベルに <code>&#x26;File</code> が表示されます。</p>\n<p><code>null</code> を渡すと、既定のメニューが表示されなくなります。 Windows と Linux では、さらにウィンドウからメニューバーを削除します。</p>\n<p><strong>注:</strong> アプリが何も設定しない場合は自動でデフォルトメニューが作成されます。 これは <code>ファイル</code>、<code>編集</code>、<code>表示</code>、<code>ウィンドウ</code>、<code>ヘルプ</code> のような標準のアイテムを含みます。</p>\n<h4 id=\"menugetapplicationmenu\"><a href=\"#menugetapplicationmenu\"><code>Menu.getApplicationMenu()</code></a></h4>\n<p>戻り値 <code>Menu | null</code> - セットされていれば menu を、そうでなければ <code>null</code> を返します。</p>\n<p><strong>注:</strong> 返される <code>Menu</code> のインスタンスは、メニューアイテムの動的な追加または削除をサポートしていません。 <a href=\"#instance-properties\">インスタンス プロパティ</a> は動的に変更ができます。</p>\n<h4 id=\"menusendactiontofirstresponderaction-macos\"><a href=\"#menusendactiontofirstresponderaction-macos\"><code>Menu.sendActionToFirstResponder(action)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>action</code> String</li>\n</ul>\n<p><code>action</code> をアプリケーションの最初のレスポンダーに送信します。 macOS メニューの既定の動作をエミュレートするために使用されます。 通常は <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a> の <a href=\"/docs/api/menu-item#roles\"><code>role</code></a> プロパティを使用します。</p>\n<p>macOSネイティブなアクションに関しては<a href=\"https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW7\">macOS Cocoa Event Handling Guide</a>を参照してください。</p>\n<h4 id=\"menubuildfromtemplatetemplate\"><a href=\"#menubuildfromtemplatetemplate\"><code>Menu.buildFromTemplate(template)</code></a></h4>\n<ul>\n<li><code>template</code> (MenuItemConstructorOptions | MenuItem)[]</li>\n</ul>\n<p>戻り値 <code>Menu</code></p>\n<p>一般的に、<code>template</code> は <a href=\"/docs/api/menu-item\">MenuItem</a> を構築するための <code>options</code> の配列です。 使用方法は上記を参照できます。</p>\n<p><code>template</code> の要素に他のフィールドを付けることもでき、それらは構築されたメニューアイテムのプロパティになります。</p>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<p><code>menu</code> オブジェクトには以下のメソッドがあります。</p>\n<h4 id=\"menupopupoptions\"><a href=\"#menupopupoptions\"><code>menu.popup([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (任意)<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (任意) - 省略値はフォーカスされたウインドウです。</li>\n<li><code>x</code> Number (任意) - 既定ではマウスカーソルの現在位置です。 <code>y</code> が宣言されている場合は宣言する必要があります。</li>\n<li><code>y</code> Number (任意) - 既定ではマウスカーソルの現在位置です。 <code>x</code> が宣言されている場合は宣言する必要があります。</li>\n<li><code>positioningItem</code> Number (任意) <em>macOS</em> - マウスカーソルの位置に配置するメニューアイテムのインデックス。 既定値は -1 です。</li>\n<li><code>callback</code> Function (任意) - メニューが閉じたしたときに呼ばれます。</li>\n</ul></li>\n</ul>\n<p>この menu を <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> 内のコンテキストメニューとしてポップアップします。</p>\n<h4 id=\"menuclosepopupbrowserwindow\"><a href=\"#menuclosepopupbrowserwindow\"><code>menu.closePopup([browserWindow])</code></a></h4>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (任意) - 省略値はフォーカスされたウインドウです。</li>\n</ul>\n<p><code>browserWindow</code> 内のこのコンテキストメニューを閉じます。</p>\n<h4 id=\"menuappendmenuitem\"><a href=\"#menuappendmenuitem\"><code>menu.append(menuItem)</code></a></h4>\n<ul>\n<li><code>menuItem</code> <a href=\"/docs/api/menu-item\">MenuItem</a></li>\n</ul>\n<p>menu に <code>menuItem</code> を追加します。</p>\n<h4 id=\"menugetmenuitembyidid\"><a href=\"#menugetmenuitembyidid\"><code>menu.getMenuItemById(id)</code></a></h4>\n<ul>\n<li><code>id</code> String</li>\n</ul>\n<p>戻り値 <code>MenuItem | null</code> - 指定した <code>id</code> のアイテム。</p>\n<h4 id=\"menuinsertpos-menuitem\"><a href=\"#menuinsertpos-menuitem\"><code>menu.insert(pos, menuItem)</code></a></h4>\n<ul>\n<li><code>pos</code> Integer</li>\n<li><code>menuItem</code> <a href=\"/docs/api/menu-item\">MenuItem</a></li>\n</ul>\n<p>menu の <code>pos</code> の位置に <code>menuItem</code> を挿入します。</p>\n<h3 id=\"インスタンスイベント\"><a href=\"#インスタンスイベント\">インスタンスイベント</a></h3>\n<p><code>new Menu</code> で作成されたオブジェクトまたは <code>Menu.buildFromTemplate</code> によって返されたオブジェクトは、以下のイベントが発生します。</p>\n<p><strong>注:</strong> いくつかのイベントは特定のオペレーティングシステムでのみ利用可能で、そのように注記がつけられています。</p>\n<h4 id=\"イベント-menu-will-show\"><a href=\"#イベント-menu-will-show\">イベント: 'menu-will-show'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p><code>menu.popup()</code> が呼ばれたときに発生します。</p>\n<h4 id=\"イベント-menu-will-close\"><a href=\"#イベント-menu-will-close\">イベント: 'menu-will-close'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>手動か <code>menu.closePopup()</code> でポップアップが閉じられたときに発生します。</p>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<p><code>menu</code> オブジェクトには更に以下のプロパティがあります。</p>\n<h4 id=\"menuitems\"><a href=\"#menuitems\"><code>menu.items</code></a></h4>\n<p>menu のアイテムが入った配列 <code>MenuItem[]</code>。</p>\n<p>それぞれの <code>Menu</code> は複数の <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a> で構成され、それぞれの <code>MenuItem</code> はサブメニューを持つことができます。</p>\n<h2 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h2>\n<p>以下は簡易テンプレート API でアプリケーションメニューを作成した例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> isMac = process.platform === <span class=\"hljs-string\">'darwin'</span>\n\n<span class=\"hljs-keyword\">const</span> template = [\n  <span class=\"hljs-comment\">// { role: 'appMenu' }</span>\n  ...(isMac ? [{\n    <span class=\"hljs-attr\">label</span>: app.name,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'about'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'services'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'hide'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'hideOthers'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'unhide'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'quit'</span> }\n    ]\n  }] : []),\n  <span class=\"hljs-comment\">// { role: 'fileMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'ファイル'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      isMac ? { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'close'</span> } : { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'quit'</span> }\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'editMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Edit'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'undo'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'redo'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'cut'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'copy'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'paste'</span> },\n      ...(isMac ? [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'pasteAndMatchStyle'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'delete'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'selectAll'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        {\n          <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Speech'</span>,\n          <span class=\"hljs-attr\">submenu</span>: [\n            { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'startSpeaking'</span> },\n            { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'stopSpeaking'</span> }\n          ]\n        }\n      ] : [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'delete'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'selectAll'</span> }\n      ])\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'viewMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'View'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'reload'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'forceReload'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'toggleDevTools'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'resetZoom'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoomIn'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoomOut'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'togglefullscreen'</span> }\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'windowMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Window'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'minimize'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoom'</span> },\n      ...(isMac ? [\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'front'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'window'</span> }\n      ] : [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'close'</span> }\n      ])\n    ]\n  },\n  {\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'help'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      {\n        <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Learn More'</span>,\n        <span class=\"hljs-attr\">click</span>: <span class=\"hljs-keyword\">async</span> () => {\n          <span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n          <span class=\"hljs-keyword\">await</span> shell.openExternal(<span class=\"hljs-string\">'https://electronjs.org'</span>)\n        }\n      }\n    ]\n  }\n]\n\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\nMenu.setApplicationMenu(menu)\n</code></pre>\n<h3 id=\"レンダープロセス-render-process\"><a href=\"#レンダープロセス-render-process\">レンダープロセス (render process)</a></h3>\n<p>レンダラープロセスが起点となってメニューを作成するには、IPC を使用して必要な情報をメインプロセスに送信し、メインプロセスがレンダラーに代わってメニューを表示するようにします。</p>\n<p>以下は、ユーザーがページを右クリックしたときにメニューを表示する例です。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// レンダラー</span>\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'contextmenu'</span>, (e) => {\n  e.preventDefault()\n  ipcRenderer.send(<span class=\"hljs-string\">'show-context-menu'</span>)\n})\n\nipcRenderer.on(<span class=\"hljs-string\">'context-menu-command'</span>, (e, command) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// メイン</span>\nipcMain.on(<span class=\"hljs-string\">'show-context-menu'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> template = [\n    {\n      <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Menu Item 1'</span>,\n      <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { event.sender.send(<span class=\"hljs-string\">'context-menu-command'</span>, <span class=\"hljs-string\">'menu-item-1'</span>) }\n    },\n    { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Menu Item 2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'checkbox'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> }\n  ]\n  <span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\n  menu.popup(BrowserWindow.fromWebContents(event.sender))\n})\n</code></pre>\n<h2 id=\"macos-アプリケーションメニューについて\"><a href=\"#macos-アプリケーションメニューについて\">macOS アプリケーションメニューについて</a></h2>\n<p>macOS は、Windows 及び Linux とは全く異なるスタイルのアプリケーションメニューを持ちます。 ここでは、アプリのメニューをよりネイティブのようにする方法について、いくつかの注意点を示します。</p>\n<h3 id=\"標準メニュー\"><a href=\"#標準メニュー\">標準メニュー</a></h3>\n<p>macOS ではシステムが定義する標準メニューがいくつかある。例えば、<a href=\"https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc\"><code>サービス</code></a> や<code>ウインドウ</code> メニューが該当する。 メニューを標準メニューにするには、メニューの <code>role</code> を次のいずれかに設定する必要があります。Electron はそれらを認識して標準メニューにします。</p>\n<ul>\n<li><code>window</code></li>\n<li><code>help</code></li>\n<li><code>services</code></li>\n</ul>\n<h3 id=\"標準メニューアイテムアクション\"><a href=\"#標準メニューアイテムアクション\">標準メニューアイテムアクション</a></h3>\n<p>macOS はいくつかのメニューアイテムに、<code>About xxx</code> や <code>Hide xxx</code>、<code>Hide Others</code> といった標準アクションを提供しています。 メニューアイテムのアクションを標準アクションに設定するには、メニューアイテムの <code>role</code> 属性を設定する必要があります。</p>\n<h3 id=\"メインメニュー名\"><a href=\"#メインメニュー名\">メインメニュー名</a></h3>\n<p>macOS のアプリケーションメニューの最初のアイテムのラベルは、設定した名前に関係なく、アプリ名になります。 これを変えるには、アプリのバンドルの <code>Info.plist</code> ファイルを変更します。 より詳しくは、<a href=\"https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html\">Information Property List ファイルについて</a> をご参照ください。</p>\n<h2 id=\"特定のブラウザウィンドウのメニューの設定-linux-windows\"><a href=\"#特定のブラウザウィンドウのメニューの設定-linux-windows\">特定のブラウザウィンドウのメニューの設定 (<em>Linux</em> <em>Windows</em>)</a></h2>\n<p>ブラウザウインドウの <a href=\"/docs/api/browser-window#winsetmenumenu-linux-windows\"><code>setMenu</code> メソッド</a> は、特定のブラウザウインドウのメニューを設定できます。</p>\n<h2 id=\"メニューアイテムの位置\"><a href=\"#メニューアイテムの位置\">メニューアイテムの位置</a></h2>\n<p><code>Menu.buildFromTemplate</code> でメニューを構築するとき、アイテムをどのように配置するかを制御するのに、<code>before</code>, <code>after</code>, <code>beforeGroupContaining</code>, <code>afterGroupContaining</code>, <code>id</code> が使用できます。</p>\n<ul>\n<li><code>before</code> - 指定したラベルの前にこのアイテムを挿入します。 参照された項目が存在しない場合、アイテムはメニューの最後に挿入されます。 また、与えられたメニューアイテムをそのアイテムと同じ「グループ」に配置する必要があることを意味します。</li>\n<li><code>after</code> - 指定したラベルの後にこのアイテムを挿入します。 参照された項目が存在しない場合、アイテムはメニューの最後に挿入されます。 また、与えられたメニューアイテムをそのアイテムと同じ「グループ」に配置する必要があることを意味します。</li>\n<li><code>beforeGroupContaining</code> - 単一のコンテキストメニューで、指定されたラベルのアイテムを含むグループの前に、そのグループの配置を宣言する手段を提供します。</li>\n<li><code>afterGroupContaining</code> - 単一のコンテキストメニューで、指定されたラベルのアイテムを含むグループの後に、そのグループの配置を宣言する手段を提供します。</li>\n</ul>\n<p>デフォルトでは、指定された位置指定キーワードのうち1つも使用されていない限り、アイテムはテンプレートに存在する順序で挿入されます。</p>\n<h3 id=\"サンプル-1\"><a href=\"#サンプル-1\">サンプル</a></h3>\n<p>テンプレート:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'4'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'four'</span> }\n]\n</code></pre>\n<p>メニュー:</p>\n<pre><code class=\"hljs language-sh\">- 1\n- 2\n- 3\n- 4\n</code></pre>\n<p>テンプレート:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span> },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span>, <span class=\"hljs-attr\">beforeGroupContaining</span>: [<span class=\"hljs-string\">'1'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'4'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'four'</span>, <span class=\"hljs-attr\">afterGroupContaining</span>: [<span class=\"hljs-string\">'2'</span>] },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span> }\n]\n</code></pre>\n<p>メニュー:</p>\n<pre><code class=\"hljs language-sh\">- 3\n- 4\n- ---\n- 1\n- ---\n- 2\n</code></pre>\n<p>テンプレート:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span>, <span class=\"hljs-attr\">after</span>: [<span class=\"hljs-string\">'3'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span>, <span class=\"hljs-attr\">before</span>: [<span class=\"hljs-string\">'1'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span> }\n]\n</code></pre>\n<p>メニュー:</p>\n<pre><code class=\"hljs language-sh\">- ---\n- 3\n- 2\n- 1\n</code></pre>",
      "title": "Menu",
      "description": "ネイティブアプリケーションのメニューとコンテキストメニューを作成します。"
    },
    "/docs/api/menu-item": {
      "locale": "ja-JP",
      "slug": "menu-item",
      "href": "/docs/api/menu-item",
      "crowdinFileId": "256333",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/menu-item.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-menuitem\"><a href=\"#class-menuitem\">Class: MenuItem</a></h2>\n<blockquote>\n<p>ネイティブアプリケーションメニューとコンテキストメニューに項目を追加します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>サンプルについては <a href=\"/docs/api/menu\"><code>Menu</code></a> を参照して下さい。</p>\n<h3 id=\"new-menuitemoptions\"><a href=\"#new-menuitemoptions\"><code>new MenuItem(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>click</code> Function (任意) - メニューアイテムがクリックされたとき、 <code>click(menuItem, browserWindow, event)</code> で呼び出されます。<ul>\n<li><code>menuItem</code> MenuItem</li>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | undefined - ウインドウが開かれていないときは undefined になります。</li>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n</ul></li>\n<li><code>role</code> String (任意) - <code>undo</code>, <code>redo</code>, <code>cut</code>, <code>copy</code>, <code>paste</code>, <code>pasteAndMatchStyle</code>, <code>delete</code>, <code>selectAll</code>, <code>reload</code>, <code>forceReload</code>, <code>toggleDevTools</code>, <code>resetZoom</code>, <code>zoomIn</code>, <code>zoomOut</code>, <code>toggleSpellChecker</code>, <code>togglefullscreen</code>, <code>window</code>, <code>minimize</code>, <code>close</code>, <code>help</code>, <code>about</code>, <code>services</code>, <code>hide</code>, <code>hideOthers</code>, <code>unhide</code>, <code>quit</code>, <code>startSpeaking</code>, <code>stopSpeaking</code>, <code>zoom</code>, <code>front</code>, <code>appMenu</code>, <code>fileMenu</code>, <code>editMenu</code>, <code>viewMenu</code>, <code>shareMenu</code>, <code>recentDocuments</code>, <code>toggleTabBar</code>, <code>selectNextTab</code>, <code>selectPreviousTab</code>, <code>mergeAllWindows</code>, <code>clearRecentDocuments</code>, <code>moveTabToNewWindow</code>, <code>windowMenu</code> のいずれかにできます。メニューアイテムのアクションを定義します。指定すると <code>click</code> プロパティは無視されます。 <a href=\"#roles\">役割 (roles)</a> を参照してください。</li>\n<li><code>type</code> String (任意) - <code>normal</code>、<code>separator</code>、<code>submenu</code>、<code>checkbox</code>、<code>radio</code> にできる。</li>\n<li><code>label</code> String (任意)</li>\n<li><code>sublabel</code> String (任意)</li>\n<li><code>toolTip</code> String (任意) <em>macOS</em> - このメニューアイテムに浮かび上がるテキスト。</li>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a> (任意)</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (任意)</li>\n<li><code>enabled</code> Boolean (任意) - もし false なら、メニューアイテムはグレーっぽくなってクリックできない。</li>\n<li><code>acceleratorWorksWhenHidden</code> Boolean (任意) <em>macOS</em> - 省略値は <code>true</code> です。<code>false</code> のときは、アイテムが表示されていない場合にアクセラレータがアイテムをトリガーするのを防ぎます。</li>\n<li><code>visible</code> Boolean (任意) - もし false なら、メニューアイテムは全く見えなくなる。</li>\n<li><code>checked</code> Boolean (任意) - <code>checkbox</code> または <code>radio</code> の type のメニューアイテムに対してのみ指定する必要がある。</li>\n<li><code>registerAccelerator</code> Boolean (任意) <em>Linux</em> <em>Windows</em> - false の場合、アクセラレータはシステムに登録されませんが、それでも表示はされます。 省略値は true です。</li>\n<li><code>sharingItem</code> SharingItem (任意) <em>macOS</em> - <code>role</code> が <code>shareMenu</code> の場合に共有するアイテムです。</li>\n<li><code>submenu</code> (MenuItemConstructorOptions[] | <a href=\"/docs/api/menu\">Menu</a>) (任意) - <code>submenu</code> 型メニューアイテムを指定する必要があります。 もし <code>submenu</code> を指定した場合、<code>type: 'submenu'</code> は省略できます。 値が <a href=\"/docs/api/menu\"><code>Menu</code></a> でない場合は、<code>Menu.buildFromTemplate</code> を用いて自動的に変換されます。</li>\n<li><code>id</code> String (任意) - 単一のメニューの中でユニーク。 宣言されている場合は、位置属性によってこのアイテムへの参照として使用できます。</li>\n<li><code>before</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> - 指定したラベルの前にこのアイテムを挿入します。 参照された項目が存在しない場合、アイテムはメニューの最後に挿入されます。 また、与えられたメニューアイテムをそのアイテムと同じ「グループ」に配置する必要があることを意味します。</li>\n<li><code>after</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> - 指定したラベルの後にこのアイテムを挿入します。 参照された項目が存在しない場合、アイテムはメニューの最後に挿入されます。</li>\n<li><code>beforeGroupContaining</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> - 単一のコンテキストメニューで、指定されたラベルのアイテムを含むグループの前に、そのグループの配置を宣言する手段を提供します。</li>\n<li><code>afterGroupContaining</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> - 単一のコンテキストメニューで、指定されたラベルのアイテムを含むグループの後に、そのグループの配置を宣言する手段を提供します。</li>\n</ul></li>\n</ul>\n<p><strong>注釈:</strong> Windows と Linux でアイテムが非表示になっている場合のアクセラレータは常に機能するため、<code>acceleratorWorksWhenHidden</code> は macOS 専用として指定されています。 これはネイティブの macOS 開発では可能なので、オプションを無効にするオプションをユーザーに提供するためにユーザーに公開されます。 このプロパティは macOS High Sierra 10.13 以降でのみ利用可能です。</p>\n<h3 id=\"役割-roles\"><a href=\"#役割-roles\">役割 (roles)</a></h3>\n<p>Roles を使用すると、メニューアイテムに定義済みの動作を持たせることができます。</p>\n<p><code>click</code> 関数で手動で動作を実装しようとするのではなく、標準の role に一致するメニューアイテムに対して <code>role</code> を指定することが最善です。 組み込み <code>role</code> の動作は最適なネイティブの操作感を得られます。</p>\n<p><code>role</code>を使用する場合、<code>label</code> と <code>accelerator</code> の値は任意で、各プラットフォームに最適な値がデフォルトになっています。</p>\n<p>すべてのメニューアイテムは、<code>role</code>、<code>label</code>、セパレータの場合は <code>type</code> のいずれかを保持する必要があります。</p>\n<p><code>role</code> プロパティは、以下の値を持つことができます。</p>\n<ul>\n<li><code>undo</code></li>\n<li><code>about</code> - ネイティブのこの App についてのパネル (専用のパネルを提供しない、Window 上のカスタムメッセージボックス) をトリガーします。</li>\n<li><code>redo</code></li>\n<li><code>cut</code></li>\n<li><code>copy</code></li>\n<li><code>paste</code></li>\n<li><code>pasteAndMatchStyle</code></li>\n<li><code>selectAll</code></li>\n<li><code>delete</code></li>\n<li><code>minimize</code> - 現在のウィンドウを最小化する。</li>\n<li><code>close</code> - 現在のウィンドウを閉じる。</li>\n<li><code>quit</code> - アプリケーションを終了する。</li>\n<li><code>reload</code> - 現在のウィンドウをリロードする。</li>\n<li><code>forceReload</code> - キャッシュを無視して現在のウィンドウをリロードする。</li>\n<li><code>toggleDevTools</code> - 現在のウィンドウの開発者向けツールのトグル切り替えをする。</li>\n<li><code>togglefullscreen</code> - 現在のウインドウの全画面モードのトグル切り替え.</li>\n<li><code>resetZoom</code> - フォーカス中のページのズームレベルを元のサイズにリセットする。</li>\n<li><code>zoomIn</code> - フォーカス中のページを 10% 拡大する。</li>\n<li><code>zoomOut</code> - フォーカス中のページを 10% 縮小する。</li>\n<li><code>toggleSpellChecker</code> - 組み込みスペルチェッカーを有効/無効にします。</li>\n<li><code>fileMenu</code> - デフォルト\"ファイル\" メニュー全体 (Close / Quit)</li>\n<li><code>editMenu</code> - デフォルトの\"編集\"メニュー全体 (元に戻す、コピー、等)。</li>\n<li><code>viewMenu</code> - デフォルトの\"表示\"メニュー全体 (リロード、開発ツールON/OFF等)</li>\n<li><code>windowMenu</code> - デフォルトの\"ウインドウ\"メニュー全体 (最小化、ズーム等)。</li>\n</ul>\n<p>以下は <em>macOS</em> で有効な追加の role です。</p>\n<ul>\n<li><code>appMenu</code> - デフォルトの\"App\"メニュー全体 (Electronについて、サービス等)</li>\n<li><code>hide</code> - <code>hide</code> アクションに割り当てる。</li>\n<li><code>hideOthers</code> - <code>hideOtherApplications</code> アクションに割り当てる。</li>\n<li><code>unhide</code> - <code>unhideAllApplications</code> アクションに割り当てる。</li>\n<li><code>startSpeaking</code> - <code>startSpeaking</code> アクションに割り当てる。</li>\n<li><code>stopSpeaking</code> - <code>stopSpeaking</code> アクションに割り当てる。</li>\n<li><code>front</code> - <code>arrangeInFront</code> アクションに割り当てる。</li>\n<li><code>zoom</code> - <code>performZoom</code> アクションに割り当てる。</li>\n<li><code>toggleTabBar</code> - <code>toggleTabBar</code> アクションに割り当てる。</li>\n<li><code>selectNextTab</code> - <code>selectNextTab</code> アクションに割り当てる。</li>\n<li><code>selectPreviousTab</code> - <code>selectPreviousTab</code> アクションに割り当てる。</li>\n<li><code>mergeAllWindows</code> - <code>mergeAllWindows</code> アクションに割り当てる。</li>\n<li><code>moveTabToNewWindow</code> - <code>moveTabToNewWindow</code> アクションに割り当てる。</li>\n<li><code>window</code> - \"ウインドウ\"サブメニュー。</li>\n<li><code>help</code> - \"ヘルプ\"サブメニュー。</li>\n<li><code>services</code> - <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc\">\"サービス\"</a> メニューのサブメニュー。 これはこのアプリケーションのメニューにのみ使うことを意図しており、macOSアプリのコンテキストメニューで使用される \"サービス\"サブメニューと同じでは<em>ありません</em>。この\"サービス\"サブメニューはElectronでは実装しません。</li>\n<li><code>recentDocuments</code> - \"最近使った項目を開く\"サブメニュー。</li>\n<li><code>clearRecentDocuments</code> - <code>clearRecentDocuments</code> アクションに割り当てる。</li>\n<li><code>shareMenu</code> - このサブメニューは <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/\">共有メニュー</a> です。 <code>sharingItem</code> プロパティは、共有アイテムを示すためにも設定する必要があります。</li>\n</ul>\n<p>macOS の <code>role</code> を指定するとき、<code>label</code> と <code>accelerator</code> がメニューアイテムに影響を与える唯一のオプションです。 ほかのすべてのオプションは無視されます。 小文字の <code>role</code>、<code>toggledevtools</code> などもまだサポートしています。</p>\n<p><strong>注意:</strong> macOS 上の tray 内の最も上にあるメニューアイテムでは、<code>enabled</code> と <code>visibility</code> プロパティは利用できません。</p>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<p><code>MenuItem</code> のインスタンスには以下のプロパティがあります。</p>\n<h4 id=\"menuitemid\"><a href=\"#menuitemid\"><code>menuItem.id</code></a></h4>\n<p>アイテムの一意な id を示す <code>String</code>。このプロパティは動的に変更できます。</p>\n<h4 id=\"menuitemlabel\"><a href=\"#menuitemlabel\"><code>menuItem.label</code></a></h4>\n<p>そのアイテムに表示されるラベルを示す <code>String</code>。</p>\n<h4 id=\"menuitemclick\"><a href=\"#menuitemclick\"><code>menuItem.click</code></a></h4>\n<p>MenuItem がクリックイベントを受け取った時に発火される <code>Function</code>。 これは <code>menuItem.click(event, focusedWindow, focusedWebContents)</code> で呼び出されます。</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>focusedWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n<li><code>focusedWebContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<h4 id=\"menuitemsubmenu\"><a href=\"#menuitemsubmenu\"><code>menuItem.submenu</code></a></h4>\n<p>存在する場合、メニューアイテムのサブメニューを格納する <code>Menu</code> (任意)。</p>\n<h4 id=\"menuitemtype\"><a href=\"#menuitemtype\"><code>menuItem.type</code></a></h4>\n<p>そのアイテムの種類を示す <code>String</code>。 <code>normal</code> 、 <code>separator</code> 、 <code>submenu</code> 、 <code>checkbox</code> 、 <code>radio</code> のいずれか。</p>\n<h4 id=\"menuitemrole\"><a href=\"#menuitemrole\"><code>menuItem.role</code></a></h4>\n<p>セットされている場合、アイテムの役割を示す <code>String</code> (任意)。 <code>undo</code>, <code>redo</code>, <code>cut</code>, <code>copy</code>, <code>paste</code>, <code>pasteAndMatchStyle</code>, <code>delete</code>, <code>selectAll</code>, <code>reload</code>, <code>forceReload</code>, <code>toggleDevTools</code>, <code>resetZoom</code>, <code>zoomIn</code>, <code>zoomOut</code>, <code>toggleSpellChecker</code>, <code>togglefullscreen</code>, <code>window</code>, <code>minimize</code>, <code>close</code>, <code>help</code>, <code>about</code>, <code>services</code>, <code>hide</code>, <code>hideOthers</code>, <code>unhide</code>, <code>quit</code>, <code>startSpeaking</code>, <code>stopSpeaking</code>, <code>zoom</code>, <code>front</code>, <code>appMenu</code>, <code>fileMenu</code>, <code>editMenu</code>, <code>viewMenu</code>, <code>shareMenu</code>, <code>recentDocuments</code>, <code>toggleTabBar</code>, <code>selectNextTab</code>, <code>selectPreviousTab</code>, <code>mergeAllWindows</code>, <code>clearRecentDocuments</code>, <code>moveTabToNewWindow</code>, <code>windowMenu</code> のいずれかにできます。</p>\n<h4 id=\"menuitemaccelerator\"><a href=\"#menuitemaccelerator\"><code>menuItem.accelerator</code></a></h4>\n<p><code>Accelerator</code> (任意) 型で、セットされているならばそのアイテムのアクセラレータになります。</p>\n<h4 id=\"menuitemuseraccelerator-readonly-macos\"><a href=\"#menuitemuseraccelerator-readonly-macos\"><code>menuItem.userAccelerator</code> <em>Readonly</em> <em>macOS</em></a></h4>\n<p><code>Accelerator | null</code> 型で、メニューアイテムの <a href=\"https://developer.apple.com/documentation/appkit/nsmenuitem/1514850-userkeyequivalent?language=objc\">ユーザーが割り当てたアクセラレータ</a> を表します。</p>\n<p><strong>注意:</strong> このプロパティは <code>MenuItem</code> が <code>Menu</code> に追加された後にのみ初期化されます。 <code>Menu.buildFromTemplate</code> または <code>Menu.append()/insert()</code> を介してください。  初期化前にアクセスすると <code>null</code> を返します。</p>\n<h4 id=\"menuitemicon\"><a href=\"#menuitemicon\"><code>menuItem.icon</code></a></h4>\n<p>セットされている場合、アイテムのアイコンを示す <code>NativeImage | String</code> (任意)。</p>\n<h4 id=\"menuitemsublabel\"><a href=\"#menuitemsublabel\"><code>menuItem.sublabel</code></a></h4>\n<p>そのアイテムのサブラベルを示す <code>String</code>。</p>\n<h4 id=\"menuitemtooltip-macos\"><a href=\"#menuitemtooltip-macos\"><code>menuItem.toolTip</code> <em>macOS</em></a></h4>\n<p>そのアイテムに浮かび上がるテキストを示す <code>String</code>。</p>\n<h4 id=\"menuitemenabled\"><a href=\"#menuitemenabled\"><code>menuItem.enabled</code></a></h4>\n<p>アイテムが有効かどうかを示す <code>Boolean</code>。このプロパティは動的に変更できます。</p>\n<h4 id=\"menuitemvisible\"><a href=\"#menuitemvisible\"><code>menuItem.visible</code></a></h4>\n<p>アイテムが見えるかどうかを示す <code>Boolean</code>。このプロパティは動的に変更できます。</p>\n<h4 id=\"menuitemchecked\"><a href=\"#menuitemchecked\"><code>menuItem.checked</code></a></h4>\n<p>アイテムがチェックされたかどうかを示す <code>Boolean</code>。このプロパティは動的に変更できます。</p>\n<p><code>checkbox</code> メニューアイテムは、選択された時に <code>checked</code> プロパティをオンかオフにトグル切り替えします。</p>\n<p><code>radio</code> メニューアイテムは、クリックされると <code>checked</code> がオンになり、同じメニュー内の隣接するアイテムすべてのこのプロパティをオフにします。</p>\n<p>更なる動作は、<code>click</code> 関数の追加で可能です。</p>\n<h4 id=\"menuitemregisteraccelerator\"><a href=\"#menuitemregisteraccelerator\"><code>menuItem.registerAccelerator</code></a></h4>\n<p>アクセラレータをシステムに登録する必要があるのか、ただ表示するだけなのかを示す <code>Boolean</code>。</p>\n<p>このプロパティは動的に変更できます。</p>\n<h4 id=\"menuitemsharingitem-macos\"><a href=\"#menuitemsharingitem-macos\"><code>menuItem.sharingItem</code> <em>macOS</em></a></h4>\n<p><code>SharingItem</code> 型で、<code>role</code> が <code>shareMenu</code> の場合に共有するアイテムを示します。</p>\n<p>このプロパティは動的に変更できます。</p>\n<h4 id=\"menuitemcommandid\"><a href=\"#menuitemcommandid\"><code>menuItem.commandId</code></a></h4>\n<p>アイテムの連続する一意な id を示す <code>Number</code>。</p>\n<h4 id=\"menuitemmenu\"><a href=\"#menuitemmenu\"><code>menuItem.menu</code></a></h4>\n<p>そのアイテムが属する <code>Menu</code>。</p>",
      "title": "MenuItem",
      "description": "ネイティブアプリケーションメニューとコンテキストメニューに項目を追加します。"
    },
    "/docs/api/message-channel-main": {
      "locale": "ja-JP",
      "slug": "message-channel-main",
      "href": "/docs/api/message-channel-main",
      "crowdinFileId": "256337",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/message-channel-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messagechannelmain\"><a href=\"#messagechannelmain\">MessageChannelMain</a></h1>\n<p><code>MessageChannelMain</code> はメインプロセス側における DOM の <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\"><code>MessageChannel</code></a> オブジェクトです。 .</p>\n<p>チャンネルメッセージングの使用方法の詳細については、<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">チャンネルメッセージング API</a> のドキュメントを参照してください。</p>\n<h2 id=\"class-messagechannelmain\"><a href=\"#class-messagechannelmain\">Class: MessageChannelMain</a></h2>\n<blockquote>\n<p>メインプロセス内でチャンネルメッセージングをするためのチャンネルインターフェイスです。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>サンプル:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// メインプロセス</span>\n<span class=\"hljs-keyword\">const</span> { MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nw.webContents.postMessage(<span class=\"hljs-string\">'port'</span>, <span class=\"hljs-literal\">null</span>, [port2])\nport1.postMessage({ <span class=\"hljs-attr\">some</span>: <span class=\"hljs-string\">'message'</span> })\n\n<span class=\"hljs-comment\">// レンダラープロセス</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e) => {\n  <span class=\"hljs-comment\">// e.ports はこのメッセージに付加されるポートのリストです</span>\n  e.ports[<span class=\"hljs-number\">0</span>].on(<span class=\"hljs-string\">'message'</span>, (messageEvent) => {\n    <span class=\"hljs-built_in\">console</span>.log(messageEvent.data)\n  })\n})\n</code></pre>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<h4 id=\"channelport1\"><a href=\"#channelport1\"><code>channel.port1</code></a></h4>\n<p><a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> 型のプロパティ。</p>\n<h4 id=\"channelport2\"><a href=\"#channelport2\"><code>channel.port2</code></a></h4>\n<p><a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> 型のプロパティ。</p>",
      "title": "MessageChannelMain",
      "description": "メインプロセス内でチャンネルメッセージングをするためのチャンネルインターフェイスです。"
    },
    "/docs/api/message-port-main": {
      "locale": "ja-JP",
      "slug": "message-port-main",
      "href": "/docs/api/message-port-main",
      "crowdinFileId": "256339",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/message-port-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messageportmain\"><a href=\"#messageportmain\">MessagePortMain</a></h1>\n<p><code>MessagePortMain</code> は、メインプロセス側における DOM の <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> オブジェクトです。 DOM の <code>EventTarget</code> イベントシステムの代わりに Node.js の <code>EventEmitter</code> システムを使用していることを除けば、DOM のものと同様の動作をします。 これは、イベントをリッスンする際には <code>port.onmessage = ...</code> や <code>port.addEventListener('message', ...)</code> の代わりに <code>port.on('message', ...)</code> を使うべきであるということです。</p>\n<p>チャンネルメッセージングの使用方法の詳細については、<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">チャンネルメッセージング API</a> のドキュメントを参照してください。</p>\n<p><code>MessagePortMain</code> は [EventEmitter][event-emitter] を継承しています。</p>\n<h2 id=\"class-messageportmain\"><a href=\"#class-messageportmain\">Class: MessagePortMain</a></h2>\n<blockquote>\n<p>メインプロセス内でチャンネルメッセージングをするためのポートインターフェイスです。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<h4 id=\"portpostmessagemessage-transfer\"><a href=\"#portpostmessagemessage-transfer\"><code>port.postMessage(message, [transfer])</code></a></h4>\n<ul>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a></li>\n</ul>\n<p>ポートからメッセージを送信し、任意でオブジェクトの所有権を他のブラウジングコンテキストに転送します。</p>\n<h4 id=\"portstart\"><a href=\"#portstart\"><code>port.start()</code></a></h4>\n<p>ポートのキューに入れられたメッセージを送信し始めます。 このメソッドが呼び出されるまで、メッセージはキューに溜められます。</p>\n<h4 id=\"portclose\"><a href=\"#portclose\"><code>port.close()</code></a></h4>\n<p>ポートを切断し、これを無効にします。</p>\n<h3 id=\"インスタンスイベント\"><a href=\"#インスタンスイベント\">インスタンスイベント</a></h3>\n<h4 id=\"イベント-message\"><a href=\"#イベント-message\">イベント: 'message'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>messageEvent</code> Object<ul>\n<li><code>data</code> any</li>\n<li><code>ports</code> MessagePortMain[]</li>\n</ul></li>\n</ul>\n<p>MessagePortMain オブジェクトがメッセージを受信したときに発生します。</p>\n<h4 id=\"イベント-close\"><a href=\"#イベント-close\">イベント: 'close'</a></h4>\n<p>MessagePortMain オブジェクトの外部のもう一方が切断されたときに発生します。</p>",
      "title": "MessagePortMain",
      "description": "メインプロセス内でチャンネルメッセージングをするためのポートインターフェイスです。"
    },
    "/docs/tutorial/message-ports": {
      "locale": "ja-JP",
      "slug": "message-ports",
      "href": "/docs/tutorial/message-ports",
      "crowdinFileId": "256219",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/message-ports.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-での-messageport\"><a href=\"#electron-での-messageport\">Electron での MessagePort</a></h1>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> は、異なるコンテキスト間でメッセージを受け渡すことができるウェブ機能です。 <code>window.postMessage</code> に似ていますが、こちらはチャンネルが別々になります。 このドキュメントの目的は、Electron で拡張した Channel Messaging モデルの説明と、アプリ内での MessagePort の使用方法の例示です。</p>\n<p>MessagePort がどのようなものでどのように動作するのかを、以下で簡単に説明します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer.js ///////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-comment\">// MessagePort のペアを作成します。 接続されたメッセージポートのペアを</span>\n<span class=\"hljs-comment\">// チャンネルといいます。</span>\n<span class=\"hljs-keyword\">const</span> channel = <span class=\"hljs-keyword\">new</span> MessageChannel()\n\n<span class=\"hljs-comment\">// port1 と port2 の違いは、その使い方だけです。 port1 に</span>\n<span class=\"hljs-comment\">// 送信されたメッセージは port2 で受信され、逆も同様です。</span>\n<span class=\"hljs-keyword\">const</span> port1 = channel.port1\n<span class=\"hljs-keyword\">const</span> port2 = channel.port2\n\n<span class=\"hljs-comment\">// 受信側がリスナーを登録する前にそのチャンネルへメッセージを送信しても</span>\n<span class=\"hljs-comment\">// 大丈夫です。 リスナーが登録されるまでメッセージはキューに溜められます。</span>\nport2.postMessage({ <span class=\"hljs-attr\">answer</span>: <span class=\"hljs-number\">42</span> })\n\n<span class=\"hljs-comment\">// ここでチャネルの他方である port1 をメインプロセスに送信します。 MessagePort を</span>\n<span class=\"hljs-comment\">// 他のフレームや Web Worker などに送信することも可能です。</span>\nipcRenderer.postMessage(<span class=\"hljs-string\">'port'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-comment\">// メインプロセスでは、ポートを受け取ります。</span>\nipcMain.on(<span class=\"hljs-string\">'port'</span>, (event) => {\n  <span class=\"hljs-comment\">// メインプロセスで MessagePort を受信すると、それは</span>\n  <span class=\"hljs-comment\">// MessagePortMain に変化します。</span>\n  <span class=\"hljs-keyword\">const</span> port = event.ports[<span class=\"hljs-number\">0</span>]\n\n  <span class=\"hljs-comment\">// MessagePortMain はウェブ方式のイベント API ではなく</span>\n  <span class=\"hljs-comment\">// Node.js 方式のイベント API を使用しています。 そのため .onmessage = ... ではなく .on('message', ...) とします。</span>\n  port.on(<span class=\"hljs-string\">'message'</span>, (event) => {\n    <span class=\"hljs-comment\">// data は { answer: 42 }</span>\n    <span class=\"hljs-keyword\">const</span> data = event.data\n  })\n\n  <span class=\"hljs-comment\">// MessagePortMain は .start() メソッドが呼ばれるまでメッセージをキューに溜めます。</span>\n  port.start()\n})\n</code></pre>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> のドキュメントは、MessagePort の動作原理をより詳しく知るのによいでしょう。</p>\n<h2 id=\"メインプロセスでの-messageport\"><a href=\"#メインプロセスでの-messageport\">メインプロセスでの MessagePort</a></h2>\n<p>レンダラーでの <code>MessagePort</code> クラスは、ウェブ上とまったく同じように動作します。 メインプロセスはウェブページではありませんが、Blink と統合していないので <code>MessagePort</code> や <code>MessageChannel</code> のクラスがありません。 メインプロセスで MessagePort をハンドルしてやり取りするために、Electron は 2 つの新しいクラス <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> と <a href=\"/docs/api/message-channel-main\"><code>MessageChannelMain</code></a> を追加しています。 これらはレンダラーの類似クラスと同様に動作します。</p>\n<p><code>MessagePort</code> オブジェクトは、レンダラープロセスかメインプロセスのいずれかで作成し、<a href=\"/docs/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a> や <a href=\"/docs/api/web-contents#contentspostmessagechannel-message-transfer\"><code>WebContents.postMessage</code></a> メソッドを使用して反対側へ送ります。 注意として、<code>send</code> や <code>invoke</code> のような通常の IPC メソッドは <code>MessagePort</code> の転送に使用できず、<code>postMessage</code> メソッドだけが <code>MessagePort</code> を転送できます。</p>\n<p>メインプロセス経由で <code>MessagePort</code> を渡すと、他の方法では (同一オリジン制限などのため) 通信できないかもしれない 2 つのページを接続できます。</p>\n<h2 id=\"拡張-close-イベント\"><a href=\"#拡張-close-イベント\">拡張: <code>close</code> イベント</a></h2>\n<p>Electron は <code>MessagePort</code> をより便利にするため、ウェブにない機能を追加しました。 それは、チャンネルの反対側が閉じられたときに発火する <code>close</code> イベントです。 ポートはガベージコレクションによって暗黙的に閉じることもあります。</p>\n<p>レンダラーでは、<code>port.onclose</code> に代入するか <code>port.addEventListener('close', ...)</code> を呼ぶことで <code>close</code>イベントをリッスンできます。 メインプロセスでは、<code>port.on('close', ...)</code> を呼ぶことで <code>close</code> イベントをリッスンできます。</p>\n<h2 id=\"ユースケース例\"><a href=\"#ユースケース例\">ユースケース例</a></h2>\n<h3 id=\"ワーカープロセス\"><a href=\"#ワーカープロセス\">ワーカープロセス</a></h3>\n<p>この例では、アプリに隠しウインドウとして実装されたワーカープロセスがあります。 メインプロセスを介して中継する際のパフォーマンスオーバーヘッドをなくして、アプリのページとワーカープロセスが直接通信できるようにしたいとします。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow, app, ipcMain, MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-comment\">// ワーカープロセスは隠し BrowserWindow であるため、Blink のすべての</span>\n  <span class=\"hljs-comment\">// コンテキスト (&#x3C;canvas>, audio, fetch() などを含む) にアクセスできます。</span>\n  <span class=\"hljs-keyword\">const</span> worker = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span> }\n  })\n  <span class=\"hljs-keyword\">await</span> worker.loadFile(<span class=\"hljs-string\">'worker.html'</span>)\n\n  <span class=\"hljs-comment\">// メインウインドウはワーカープロセスへ仕事を送り、</span>\n  <span class=\"hljs-comment\">// MessagePort を介して結果を受信します。</span>\n  <span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span> }\n  })\n  mainWindow.loadFile(<span class=\"hljs-string\">'app.html'</span>)\n\n  <span class=\"hljs-comment\">// 返信で MessagePort を転送する必要があるので、</span>\n  <span class=\"hljs-comment\">// ここで ipcMain.handle() は使えません。</span>\n  ipcMain.on(<span class=\"hljs-string\">'request-worker-channel'</span>, (event) => {\n    <span class=\"hljs-comment\">// セキュリティ上の理由から、期待するフレームだけが</span>\n    <span class=\"hljs-comment\">// ワーカーにアクセスできるようにしておきましょう。</span>\n    <span class=\"hljs-keyword\">if</span> (event.senderFrame === mainWindow.webContents.mainFrame) {\n      <span class=\"hljs-comment\">// 新しいチャンネルを作成し...</span>\n      <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\n      <span class=\"hljs-comment\">// ...その一方をワーカーへ送り...</span>\n      worker.webContents.postMessage(<span class=\"hljs-string\">'new-client'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n      <span class=\"hljs-comment\">// ...そしてもう一方をメインウインドウへ送ります。</span>\n      event.senderFrame.postMessage(<span class=\"hljs-string\">'provide-worker-channel'</span>, <span class=\"hljs-literal\">null</span>, [port2])\n      <span class=\"hljs-comment\">// これでメインウインドウとワーカーがメインプロセスを介さずに</span>\n      <span class=\"hljs-comment\">// 通信できるようになりました!</span>\n    }\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- worker.html ------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">doWork</span>(<span class=\"hljs-params\">input</span>) </span>{\n  <span class=\"hljs-comment\">// CPU の力が必要な処理。</span>\n  <span class=\"hljs-keyword\">return</span> input * <span class=\"hljs-number\">2</span>\n}\n\n<span class=\"hljs-comment\">// 複数のウィンドウがある、メインウインドウがリロードされた、</span>\n<span class=\"hljs-comment\">// などの場合に複数クライアントを取得することがあります。</span>\nipcRenderer.on(<span class=\"hljs-string\">'new-client'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n  port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    <span class=\"hljs-comment\">// イベントデータは任意のシリアライズ可能なオブジェクトにできます</span>\n    <span class=\"hljs-comment\">// (イベントに他の MessagePort を載せることもできます!)</span>\n    <span class=\"hljs-keyword\">const</span> result = doWork(event.data)\n    port.postMessage(result)\n  }\n})\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- app.html ---------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// ワーカーとの通信に使用できるチャンネルを送るように</span>\n<span class=\"hljs-comment\">// メインプロセスへ要求します。</span>\nipcRenderer.send(<span class=\"hljs-string\">'request-worker-channel'</span>)\n\nipcRenderer.once(<span class=\"hljs-string\">'provide-worker-channel'</span>, (event) => {\n  <span class=\"hljs-comment\">// 返信を受け取ったら、ポートを取り出し...</span>\n  <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n  <span class=\"hljs-comment\">// ...結果を受信するハンドラを登録したら...</span>\n  port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'received result:'</span>, event.data)\n  }\n  <span class=\"hljs-comment\">// ...メッセージを送信して動かしましょう!</span>\n  port.postMessage(<span class=\"hljs-number\">21</span>)\n})\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h3 id=\"ストリームの返信\"><a href=\"#ストリームの返信\">ストリームの返信</a></h3>\n<p>Electron の組み込み IPC メソッドは、一方向通信 (<code>send</code> など) と送信に対する返信 (<code>invoke</code> など) の 2 つのモードしかサポートしていません。 MessageChannel を使用すれば、一つのリクエストに対してデータのストリームで応答する \"応答ストリーム\" を実装できます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer.js ///////////////////////////////////////////////////////////////</span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">makeStreamingRequest</span> (<span class=\"hljs-params\">element, callback</span>) </span>{\n  <span class=\"hljs-comment\">// MessageChannel は軽量なので、リクエストごとに新規作成してもコストが</span>\n  <span class=\"hljs-comment\">// かかりません。</span>\n  <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannel()\n\n  <span class=\"hljs-comment\">// 一方のポートをメインプロセスへ送り...</span>\n  ipcRenderer.postMessage(\n    <span class=\"hljs-string\">'give-me-a-stream'</span>,\n    { element, <span class=\"hljs-attr\">count</span>: <span class=\"hljs-number\">10</span> },\n    [port2]\n  )\n\n  <span class=\"hljs-comment\">// ...もう一方は持っておきます。 メインプロセスはその一方のポートに</span>\n  <span class=\"hljs-comment\">// メッセージを送り、終了すればこれを閉じます。</span>\n  port1.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    callback(event.data)\n  }\n  port1.onclose = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'stream ended'</span>)\n  }\n}\n\nmakeStreamingRequest(<span class=\"hljs-number\">42</span>, (data) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'got response data:'</span>, event.data)\n})\n<span class=\"hljs-comment\">// \"got response data: 42\" が 10 回見えるでしょう。</span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n\nipcMain.on(<span class=\"hljs-string\">'give-me-a-stream'</span>, (event, msg) => {\n  <span class=\"hljs-comment\">// レンダラーから応答を送信するための MessagePort が</span>\n  <span class=\"hljs-comment\">// 送られてきます。</span>\n  <span class=\"hljs-keyword\">const</span> [replyPort] = event.ports\n\n  <span class=\"hljs-comment\">// ここではメッセージを同期的に送信していますが、ポートを保存しておけば</span>\n  <span class=\"hljs-comment\">// 非同期的なメッセージ送信も同じくらい簡単にできます。</span>\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">let</span> i = <span class=\"hljs-number\">0</span>; i &#x3C; msg.count; i++) {\n    replyPort.postMessage(msg.element)\n  }\n\n  <span class=\"hljs-comment\">// 終わったらポートを閉じて、もうメッセージを送信しないことを</span>\n  <span class=\"hljs-comment\">// 相手に示します。 これは厳密には必要ではありません。</span>\n  <span class=\"hljs-comment\">// 明示的にポートを閉じなければ最終的にガベージコレクションされ、</span>\n  <span class=\"hljs-comment\">// レンダラーの 'close' イベントも発生するでしょう。</span>\n  replyPort.close()\n})\n</code></pre>\n<h3 id=\"コンテキストが分離されたページのメインプロセスとメインワールド間で直接やり取りする\"><a href=\"#コンテキストが分離されたページのメインプロセスとメインワールド間で直接やり取りする\">コンテキストが分離されたページのメインプロセスとメインワールド間で直接やり取りする</a></h3>\n<p><a href=\"/docs/tutorial/context-isolation\">コンテキスト分離</a> が有効になっている場合、メインプロセスからレンダラーへの IPC メッセージは、メインワールドではなく分離されたワールドへ送られます。 分離したワールドを介さずに、メインワールドへ直接メッセージを送りたいこともあるでしょう。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow, app, MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-comment\">// contextIsolation が有効な BrowserWindow を作成します。</span>\n  <span class=\"hljs-keyword\">const</span> bw = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">contextIsolation</span>: <span class=\"hljs-literal\">true</span>,\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n  bw.loadURL(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-comment\">// この一方のチャンネルを、コンテキスト分離ページの</span>\n  <span class=\"hljs-comment\">// メインワールドへ送ります。</span>\n  <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\n\n  <span class=\"hljs-comment\">// 相手側がリスナーを登録する前にそのチャンネルで</span>\n  <span class=\"hljs-comment\">// メッセージを送信しても大丈夫です。 リスナーが登録されるまでメッセージはキューに</span>\n  <span class=\"hljs-comment\">// 溜められます。</span>\n  port2.postMessage({ <span class=\"hljs-attr\">test</span>: <span class=\"hljs-number\">21</span> })\n\n  <span class=\"hljs-comment\">// レンダラーのメインワールドからのメッセージを受信することもできます。</span>\n  port2.on(<span class=\"hljs-string\">'message'</span>, (event) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'from renderer main world:'</span>, event.data)\n  })\n  port2.start()\n\n  <span class=\"hljs-comment\">// プリロードスクリプトはこの IPC メッセージを受信し、ポートを</span>\n  <span class=\"hljs-comment\">// メインワールドへ転送します。</span>\n  bw.webContents.postMessage(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// preload.js ////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// メインワールドがメッセージを受信できるようになるまで待ってから</span>\n<span class=\"hljs-comment\">// ポートを送信する必要があります。 この Promise をプリロードで作成することで、load イベント</span>\n<span class=\"hljs-comment\">// が発生する前に onload リスナーを登録できることが保証されます。</span>\n<span class=\"hljs-keyword\">const</span> windowLoaded = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> {\n  <span class=\"hljs-built_in\">window</span>.onload = resolve\n})\n\nipcRenderer.on(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-keyword\">async</span> (event) => {\n  <span class=\"hljs-keyword\">await</span> windowLoaded\n  <span class=\"hljs-comment\">// 分離ワールドからメインワールドへポートを転送するために、通常の</span>\n  <span class=\"hljs-comment\">// window.postMessage を使用します。</span>\n  <span class=\"hljs-built_in\">window</span>.postMessage(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-string\">'*'</span>, event.ports)\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- index.html -------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-built_in\">window</span>.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n  <span class=\"hljs-comment\">// event.source === window は、メッセージが &#x3C;iframe> や他のソースから</span>\n  <span class=\"hljs-comment\">// ではなくプリロードスクリプト由来だということです。</span>\n  <span class=\"hljs-keyword\">if</span> (event.source === <span class=\"hljs-built_in\">window</span> &#x26;&#x26; event.data === <span class=\"hljs-string\">'main-world-port'</span>) {\n    <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n    <span class=\"hljs-comment\">// ポートを確保すれば、メインプロセスと直接通信できるように</span>\n    <span class=\"hljs-comment\">// なります。</span>\n    port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'from main process:'</span>, event.data)\n      port.postMessage(event.data * <span class=\"hljs-number\">2</span>)\n    }\n  }\n}\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>",
      "title": "Electron での MessagePort",
      "description": ""
    },
    "/docs/api/structures/mime-typed-buffer": {
      "locale": "ja-JP",
      "slug": "mime-typed-buffer",
      "href": "/docs/api/structures/mime-typed-buffer",
      "crowdinFileId": "256463",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mime-typed-buffer.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mimetypedbuffer-object\"><a href=\"#mimetypedbuffer-object\">MimeTypedBuffer Object</a></h1>\n<ul>\n<li><code>mimeType</code> String (optional) - MIME type of the buffer.</li>\n<li><code>charset</code> String (optional) - Charset of the buffer.</li>\n<li><code>data</code> Buffer - The actual Buffer content.</li>\n</ul>",
      "title": "MimeTypedBuffer Object",
      "description": ""
    },
    "/docs/api/structures/mouse-input-event": {
      "locale": "ja-JP",
      "slug": "mouse-input-event",
      "href": "/docs/api/structures/mouse-input-event",
      "crowdinFileId": "256465",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mouse-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mouseinputevent-object-extends-inputevent\"><a href=\"#mouseinputevent-object-extends-inputevent\">MouseInputEvent Object extends <code>InputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>mouseDown</code>, <code>mouseUp</code>, <code>mouseEnter</code>, <code>mouseLeave</code>, <code>contextMenu</code>, <code>mouseWheel</code> or <code>mouseMove</code>.</li>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n<li><code>button</code> String (optional) - The button pressed, can be <code>left</code>, <code>middle</code>, <code>right</code>.</li>\n<li><code>globalX</code> Integer (optional)</li>\n<li><code>globalY</code> Integer (optional)</li>\n<li><code>movementX</code> Integer (optional)</li>\n<li><code>movementY</code> Integer (optional)</li>\n<li><code>clickCount</code> Integer (optional)</li>\n</ul>",
      "title": "MouseInputEvent Object extends InputEvent",
      "description": ""
    },
    "/docs/api/structures/mouse-wheel-input-event": {
      "locale": "ja-JP",
      "slug": "mouse-wheel-input-event",
      "href": "/docs/api/structures/mouse-wheel-input-event",
      "crowdinFileId": "256467",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mouse-wheel-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mousewheelinputevent-object-extends-mouseinputevent\"><a href=\"#mousewheelinputevent-object-extends-mouseinputevent\">MouseWheelInputEvent Object extends <code>MouseInputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>mouseWheel</code>.</li>\n<li><code>deltaX</code> Integer (optional)</li>\n<li><code>deltaY</code> Integer (optional)</li>\n<li><code>wheelTicksX</code> Integer (optional)</li>\n<li><code>wheelTicksY</code> Integer (optional)</li>\n<li><code>accelerationRatioX</code> Integer (optional)</li>\n<li><code>accelerationRatioY</code> Integer (optional)</li>\n<li><code>hasPreciseScrollingDeltas</code> Boolean (optional)</li>\n<li><code>canScroll</code> Boolean (optional)</li>\n</ul>",
      "title": "MouseWheelInputEvent Object extends MouseInputEvent",
      "description": ""
    },
    "/docs/tutorial/multithreading": {
      "locale": "ja-JP",
      "slug": "multithreading",
      "href": "/docs/tutorial/multithreading",
      "crowdinFileId": "256221",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/multithreading.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"マルチスレッド\"><a href=\"#マルチスレッド\">マルチスレッド</a></h1>\n<p><a href=\"https://developer.mozilla.org/en/docs/Web/API/Web_Workers_API/Using_web_workers\">Web Workers</a> により、JavaScript を OS レベルのスレッドで実行することが可能になります。</p>\n<h2 id=\"マルチスレッド-nodejs\"><a href=\"#マルチスレッド-nodejs\">マルチスレッド Node.js</a></h2>\n<p>Electron の Web Workers 内で Node.js の機能を使用するには、<code>webPreferences</code> の <code>nodeIntegrationInWorker</code> オプションを <code>true</code> に設定する必要があります。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegrationInWorker</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<p><code>nodeIntegrationInWorker</code> は <code>nodeIntegration</code> とは独立して使用できますが、<code>サンドボックス</code> は <code>true</code> に設定してはなりません。</p>\n<h2 id=\"利用可能な-api\"><a href=\"#利用可能な-api\">利用可能な API</a></h2>\n<p>Node.js の組み込みモジュールはすべて Web Workers でサポートされており、<code>asar</code> アーカイブは Node.js API で読み取ることができます。 しかし、Electron の組み込みモジュールは、マルチスレッド環境では使用できません。</p>\n<h2 id=\"ネイティブ-nodejs-モジュール\"><a href=\"#ネイティブ-nodejs-モジュール\">ネイティブ Node.js モジュール</a></h2>\n<p>任意のネイティブ Node.js モジュールを Web Workers に直接ロードできますが、そのようにしないことを強く推奨します。 既存のネイティブモジュールのほとんどはシングルスレッド環境を想定して作成されており、Web Workers でそれらを使用するとクラッシュやメモリ破壊につながります。</p>\n<p>ネイティブ Node.js モジュールがスレッドセーフであっても、<code>process.dlopen</code> 関数はスレッドセーフではないため、Web Worker でロードするのは安全ではありません。</p>\n<p>ネイティブモジュールを安全にロードする唯一の方法は、Web Workers の起動後にアプリがネイティブモジュールをロードしないようにすることです。</p>\n<pre><code class=\"hljs language-javascript\">process.dlopen = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Load native module is not safe'</span>)\n}\n<span class=\"hljs-keyword\">const</span> worker = <span class=\"hljs-keyword\">new</span> Worker(<span class=\"hljs-string\">'script.js'</span>)\n</code></pre>",
      "title": "マルチスレッド",
      "description": ""
    },
    "/docs/tutorial/native-file-drag-drop": {
      "locale": "ja-JP",
      "slug": "native-file-drag-drop",
      "href": "/docs/tutorial/native-file-drag-drop",
      "crowdinFileId": "256223",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/native-file-drag-drop.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ネイティブなファイルのドラッグドロップ\"><a href=\"#ネイティブなファイルのドラッグドロップ\">ネイティブなファイルのドラッグ&#x26;ドロップ</a></h1>\n<h2 id=\"概要\"><a href=\"#概要\">概要</a></h2>\n<p>ファイルを操作する特定の種類のアプリケーションは、オペレーティングシステムのネイティブなファイルのドラッグ&#x26;ドロップの機能をサポートしたいでしょう。 ファイルをウェブコンテンツにドラッグすることは一般的であり、多くのウェブサイトでサポートされています。 Electron はさらに、ファイルやコンテンツをウェブコンテンツからオペレーティングシステム側へドラッグすることをサポートしています。</p>\n<p>この機能をアプリに実装するには、<code>ondragstart</code> イベントへの応答として <a href=\"/docs/api/web-contents#contentsstartdragitem\">``webContents.startDrag(item)</a> API を呼ぶ必要があります。</p>\n<h2 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h2>\n<p>この例では、実行時にファイルを作成し、ウィンドウ外へとドラッグできるようにする方法を示します。</p>\n<h3 id=\"preloadjs\"><a href=\"#preloadjs\">Preload.js</a></h3>\n<p><code>preload.js</code> では、<a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> を使用してメインプロセスに IPC メッセージを送信するメソッド <code>window.electron.startDrag(...)</code> を注入します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'electron'</span>, {\n  <span class=\"hljs-attr\">startDrag</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">fileName</span>) =></span> {\n    ipcRenderer.send(<span class=\"hljs-string\">'ondragstart'</span>, path.join(process.cwd(), fileName))\n  }\n})\n</code></pre>\n<h3 id=\"indexhtml\"><a href=\"#indexhtml\">Index.html</a></h3>\n<p><code>index.html</code> にドラッグ可能な要素を追加し、レンダラースクリプトを読むようにします。</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">div</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"border:2px solid black;border-radius:3px;padding:5px;display:inline-block\"</span> <span class=\"hljs-attr\">draggable</span>=<span class=\"hljs-string\">\"true\"</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"drag\"</span>></span>Drag me<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">div</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h3 id=\"rendererjs\"><a href=\"#rendererjs\">Renderer.js</a></h3>\n<p><code>renderer.js</code> ではレンダラープロセスを設定します。上記の <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> で追加したメソッドを呼び出す形で、ドラッグイベントを処理します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'drag'</span>).ondragstart = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n  event.preventDefault()\n  <span class=\"hljs-built_in\">window</span>.electron.startDrag(<span class=\"hljs-string\">'drag-and-drop.md'</span>)\n}\n</code></pre>\n<h3 id=\"mainjs\"><a href=\"#mainjs\">Main.js</a></h3>\n<p>メインプロセス (<code>main.js</code>ファイル) で受信したイベントを、以下のようにドラッグされたファイルのパスとアイコンへと展開します。</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/drag-and-drop\"><span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nipcMain.on(<span class=\"hljs-string\">'ondragstart'</span>, (event, filePath) => {\n  event.sender.startDrag({\n    <span class=\"hljs-attr\">file</span>: filePath,\n    <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'/path/to/icon.png'</span>\n  })\n})\n</code></pre>\n<p>Electron アプリケーションを起動したら、BrowserWindow 上の アイテムをデスクトップへドラッグ &#x26; ドロップしてみてください。 このガイドでは、そのアイテムはプロジェクトのルートにある Markdown ファイルとなっています。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/drag-and-drop.gif\" alt=\"ドラッグアンドドロップ\"></p>",
      "title": "ネイティブなファイルのドラッグ&ドロップ",
      "description": ""
    },
    "/docs/api/native-image": {
      "locale": "ja-JP",
      "slug": "native-image",
      "href": "/docs/api/native-image",
      "crowdinFileId": "256341",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/native-image.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nativeimage\"><a href=\"#nativeimage\">nativeImage</a></h1>\n<blockquote>\n<p>tray や Dock やアプリケーションのアイコンを PNG や JPG ファイルで作成します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a>, <a href=\"/docs/glossary#renderer-process\">レンダラー</a></p>\n<p>Electron では、 API が画像を取る場合、ファイルパスまたは <code>NativeImage</code> インスタンスを渡すことができます。 <code>null</code> が渡されたときは空の画像が使用されます。</p>\n<p>例として、tray を作ったりウインドウのアイコンを設定したりするとき、<code>String</code> で画像ファイルパスを渡せます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'/Users/somebody/images/window.png'</span> })\n<span class=\"hljs-built_in\">console</span>.log(appIcon, win)\n</code></pre>\n<p>clipboard から画像を読む場合は、<code>NativeImage</code> が返されます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { clipboard, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> image = clipboard.readImage()\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(image)\n<span class=\"hljs-built_in\">console</span>.log(appIcon)\n</code></pre>\n<h2 id=\"サポートされているフォーマット\"><a href=\"#サポートされているフォーマット\">サポートされているフォーマット</a></h2>\n<p>現在 <code>PNG</code> と <code>JPEG</code> の画像形式に対応しています。 透明度とか可逆圧縮に対応した <code>PNG</code> をおすすめします。</p>\n<p>Windows では、ファイルパスから <code>ICO</code> アイコンを読み込むこともできます。 最高の表示品質を得るため、少なくとも以下のサイズを含めることをおすすめします:</p>\n<ul>\n<li>小さいアイコン<ul>\n<li>16x16 (DPI スケール 100%)</li>\n<li>20x20 (DPI スケール 125%)</li>\n<li>24x24 (DPI スケール 150%)</li>\n<li>32x32 (DPI スケール 200%)</li>\n</ul></li>\n<li>大きいアイコン<ul>\n<li>32x32 (DPI スケール 100%)</li>\n<li>40x40 (DPI スケール 125%)</li>\n<li>48x48 (DPI スケール 150%)</li>\n<li>64x64 (DPI スケール 200%)</li>\n<li>256x256</li>\n</ul></li>\n</ul>\n<p><a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dn742485(v=vs.85).aspx\">この記事</a> 内の <em>サイズ要件</em> の章を確認して下さい。</p>\n<h2 id=\"高解像度の画像\"><a href=\"#高解像度の画像\">高解像度の画像</a></h2>\n<p>Apple Retina ディスプレイのような高解像度をサポートしているプラットフォームにおいて、画像のファイルネームの後ろに <code>@2x</code> を加えることで、高解像度の画像としてマークすることができます。</p>\n<p>例えば、<code>icon.png</code> が通常の標準解像度の画像であれば、<code>icon@2x.png</code> が2倍のピクセル密度を持つ高解像度の画像として扱われます。</p>\n<p>同時に異なるピクセル密度のディスプレイをサポートしたい場合、同じフォルダ内に異なるサイズの画像を置き、DPI 接尾子無しでファイル名を使用して下さい。 以下がその例です。</p>\n<pre><code class=\"hljs language-plaintext\">images/\n├── icon.png\n├── icon@2x.png\n└── icon@3x.png\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-built_in\">console</span>.log(appIcon)\n</code></pre>\n<p>以下の DPI 接尾子がサポートされています。</p>\n<ul>\n<li><code>@1x</code></li>\n<li><code>@1.25x</code></li>\n<li><code>@1.33x</code></li>\n<li><code>@1.4x</code></li>\n<li><code>@1.5x</code></li>\n<li><code>@1.8x</code></li>\n<li><code>@2x</code></li>\n<li><code>@2.5x</code></li>\n<li><code>@3x</code></li>\n<li><code>@4x</code></li>\n<li><code>@5x</code></li>\n</ul>\n<h2 id=\"テンプレート画像\"><a href=\"#テンプレート画像\">テンプレート画像</a></h2>\n<p>テンプレート画像は黒色とアルファチャンネルで構成されます。 テンプレート画像は単体の画像として使用するものではなく、通常、最終的にさせたい見た目を作成するため、他のコンテンツと混合されます。</p>\n<p>最も一般的なケースは、メニューバーのアイコンに使用することです。これは明るいメニューバーと暗いメニューバーの両方に適応できます。</p>\n<p><strong>注釈:</strong> テンプレート画像は macOS でのみサポートされています。</p>\n<p>画像をテンプレート画像としてマークするには、そのファイル名が <code>Template</code> で終わる必要があります。 以下がその例です。</p>\n<ul>\n<li><code>xxxTemplate.png</code></li>\n<li><code>xxxTemplate.png</code></li>\n</ul>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>nativeImage</code> オブジェクトには以下のメソッドがあります。いずれも <code>NativeImage</code> クラスのインスタンスを返します。</p>\n<h3 id=\"nativeimagecreateempty\"><a href=\"#nativeimagecreateempty\"><code>nativeImage.createEmpty()</code></a></h3>\n<p>戻り値 <code>NativeImage</code></p>\n<p>空の <code>NativeImage</code> インスタンスを作成します。</p>\n<h3 id=\"nativeimagecreatethumbnailfrompathpath-maxsize-macos-windows\"><a href=\"#nativeimagecreatethumbnailfrompathpath-maxsize-macos-windows\"><code>nativeImage.createThumbnailFromPath(path, maxSize)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>path</code> String - サムネイルを構築するためのファイルのパス。</li>\n<li><code>maxSize</code> <a href=\"/docs/api/structures/size\">Size</a> - 返されうるサムネイルの最大の幅と高さ (正の数)。 Windows の実装では、<code>maxSize.height</code> を無視し <code>maxSize.width</code> に従って高さを拡大縮小します。</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;NativeImage></code> - これは <a href=\"/docs/api/native-image\">NativeImage</a> であるファイルのサムネイルプレビュー画像で解決されます。</p>\n<h3 id=\"nativeimagecreatefrompathpath\"><a href=\"#nativeimagecreatefrompathpath\"><code>nativeImage.createFromPath(path)</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>戻り値 <code>NativeImage</code></p>\n<p><code>path</code> のファイルから新しい <code>NativeImage</code> インスタンスを作成します。 このメソッドは、<code>path</code> が存在しない、読めない、有効な画像でない場合は、空の画像を返します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> nativeImage = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).nativeImage\n\n<span class=\"hljs-keyword\">const</span> image = nativeImage.createFromPath(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-built_in\">console</span>.log(image)\n</code></pre>\n<h3 id=\"nativeimagecreatefrombitmapbuffer-options\"><a href=\"#nativeimagecreatefrombitmapbuffer-options\"><code>nativeImage.createFromBitmap(buffer, options)</code></a></h3>\n<ul>\n<li><code>buffer</code> <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a></li>\n<li><code>options</code> Object<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>scaleFactor</code> Double (任意) - 省略値は 1.0。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>NativeImage</code></p>\n<p><code>buffer</code> から新しい <code>NativeImage</code> インスタンスを作成します。これには<code>toBitmap()</code> によって返された生のビットマップピクセルデータが含まれます。 詳細な形式はプラットフォームに依存します。</p>\n<h3 id=\"nativeimagecreatefrombufferbuffer-options\"><a href=\"#nativeimagecreatefrombufferbuffer-options\"><code>nativeImage.createFromBuffer(buffer[, options])</code></a></h3>\n<ul>\n<li><code>buffer</code> <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a></li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>width</code> Integer (任意) - ビットマップバッファに必要。</li>\n<li><code>height</code> Integer (任意) - ビットマップバッファに必要。</li>\n<li><code>scaleFactor</code> Double (任意) - 省略値は 1.0。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>NativeImage</code></p>\n<p><code>buffer</code> から <code>NativeImage</code> の新しいインスタンスを作成します。 最初に PNG または JPEG としてデコードしようとします。</p>\n<h3 id=\"nativeimagecreatefromdataurldataurl\"><a href=\"#nativeimagecreatefromdataurldataurl\"><code>nativeImage.createFromDataURL(dataURL)</code></a></h3>\n<ul>\n<li><code>dataURL</code> String</li>\n</ul>\n<p>戻り値 <code>NativeImage</code></p>\n<p><code>dataURL</code> から <code>NativeImage</code> の新しいインスタンスを作成します。</p>\n<h3 id=\"nativeimagecreatefromnamedimageimagename-hslshift-macos\"><a href=\"#nativeimagecreatefromnamedimageimagename-hslshift-macos\"><code>nativeImage.createFromNamedImage(imageName[, hslShift])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>imageName</code> String</li>\n<li><code>hslShift</code> Number<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a></li>\n</ul>\n<p>戻り値 <code>NativeImage</code></p>\n<p>指定した画像名にマップされる NSImage から <code>NativeImage</code> の新しいインスタンスを作成します。 使用可能な値のリストは、<a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/system-icons/\"><code>システムアイコン</code></a> を参照してください。</p>\n<p><code>hslShift</code> は以下のルールで画像に適用されます。</p>\n<ul>\n<li><code>hsl_shift[0]</code> (色相): 画像における色相の絶対値 - 0 から 1 が 色相カラーホイール (赤) の 0 から 360 に割り当てられます。</li>\n<li><code>hsl_shift[1]</code> (彩度): 画像における彩度の変化量。 以下のキー値を使用します: 0 = すべての色を取り除く。 0.5 = そのまま変わらない。 1 = 完全に鮮やかにする。</li>\n<li><code>hsl_shift[2]</code> (明るさ): 画像における明るさの変化量。以下のキー値を使用します。 0 = 明るさをすべて取り除く (すべてのピクセルを黒にする)。 0.5 = そのまま変わらない。 1 = 完全に明るい (すべてのピクセルを白にする)。</li>\n</ul>\n<p>つまり、<code>[-1, 0, 1]</code> は完全に白い画像になり、<code>[-1, 1, 0]</code> は完全に黒い画像になります。</p>\n<p>場合によっては、<code>NSImageName</code> はその文字列表現と一致しません。 その一例が <code>NSFolderImageName</code> で、その文字列表現は実際には <code>NSFolder</code> です。 そのため、画像を渡す前に正しい文字列表現を特定する必要があります。 これは以下のようにしてできます。</p>\n<p><code>echo -e '#import &#x3C;Cocoa/Cocoa.h>\\nint main() { NSLog(@\"%@\", SYSTEM_IMAGE_NAME); }' | clang -otest -x objective-c -framework Cocoa - &#x26;&#x26; ./test</code></p>\n<p><code>SYSTEM_IMAGE_NAME</code> は <a href=\"https://developer.apple.com/documentation/appkit/nsimagename?language=objc\">このリスト</a> から任意の値に置き換えてください。</p>\n<h2 id=\"クラス-nativeimage\"><a href=\"#クラス-nativeimage\">クラス: NativeImage</a></h2>\n<blockquote>\n<p>tray や Dock やアプリケーションアイコンのような画像を、ネイティブにラップします。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a>、<a href=\"/docs/glossary#renderer-process\">レンダラー</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<p><code>NativeImage</code> クラスのインスタンスには、以下のメソッドがあります。</p>\n<h4 id=\"imagetopngoptions\"><a href=\"#imagetopngoptions\"><code>image.toPNG([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (任意)<ul>\n<li><code>scaleFactor</code> Double (任意) - 省略値は 1.0。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Buffer</code> - <code>PNG</code> エンコードされた画像データを含む <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a>。</p>\n<h4 id=\"imagetojpegquality\"><a href=\"#imagetojpegquality\"><code>image.toJPEG(quality)</code></a></h4>\n<ul>\n<li><code>quality</code> Integer - 0 - 100 の間です。</li>\n</ul>\n<p>戻り値 <code>Buffer</code> - <code>JPEG</code> エンコードされた画像データを含む <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a>。</p>\n<h4 id=\"imagetobitmapoptions\"><a href=\"#imagetobitmapoptions\"><code>image.toBitmap([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (任意)<ul>\n<li><code>scaleFactor</code> Double (任意) - 省略値は 1.0。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Buffer</code> - 生のビットマップ画像のピクセルデータのコピーを含む <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a>。</p>\n<h4 id=\"imagetodataurloptions\"><a href=\"#imagetodataurloptions\"><code>image.toDataURL([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (任意)<ul>\n<li><code>scaleFactor</code> Double (任意) - 省略値は 1.0。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>String</code> - 画像のデータURL。</p>\n<h4 id=\"imagegetbitmapoptions\"><a href=\"#imagegetbitmapoptions\"><code>image.getBitmap([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (任意)<ul>\n<li><code>scaleFactor</code> Double (任意) - 省略値は 1.0。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Buffer</code> - 生のビットマップ画像のピクセルデータを含む <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a>。</p>\n<p><code>getBitmap()</code> と <code>toBitmap()</code> には違いがあります。<code>getBitmap()</code> はビットマップをコピーしないので、現在のイベントループティックで即座に使用しなければ、そのデータが変更または破棄される可能性があります。</p>\n<h4 id=\"imagegetnativehandle-macos\"><a href=\"#imagegetnativehandle-macos\"><code>image.getNativeHandle()</code> <em>macOS</em></a></h4>\n<p>戻り値 <code>Buffer</code> - 画像の元になるネイティブハンドルへの C ポインタを格納する <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a>。 macOS では、<code>NSImage</code> のインスタンスのポインタが返されます。</p>\n<p>返されるポインタは、コピーではなく、元のネイティブな画像へのウィークポインタであることに注意して下さい。関連する <code>nativeImage</code> インスタンスが確実に<em>保持されなければなりません</em>。</p>\n<h4 id=\"imageisempty\"><a href=\"#imageisempty\"><code>image.isEmpty()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - 画像が空かどうか。</p>\n<h4 id=\"imagegetsizescalefactor\"><a href=\"#imagegetsizescalefactor\"><code>image.getSize([scaleFactor])</code></a></h4>\n<ul>\n<li><code>scaleFactor</code> Double (任意) - 省略値は 1.0。</li>\n</ul>\n<p>戻り値 <a href=\"/docs/api/structures/size\"><code>Size</code></a>.</p>\n<p><code>scaleFactor</code> が渡された場合、渡された値に最も近い画像表現に対応するサイズを返します。</p>\n<h4 id=\"imagesettemplateimageoption\"><a href=\"#imagesettemplateimageoption\"><code>image.setTemplateImage(option)</code></a></h4>\n<ul>\n<li><code>option</code> Boolean</li>\n</ul>\n<p>画像をテンプレート画像としてマークします。</p>\n<h4 id=\"imageistemplateimage\"><a href=\"#imageistemplateimage\"><code>image.isTemplateImage()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - 画像がテンプレート画像かどうか。</p>\n<h4 id=\"imagecroprect\"><a href=\"#imagecroprect\"><code>image.crop(rect)</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - 画像をトリミングする領域。</li>\n</ul>\n<p>戻り値 <code>NativeImage</code> - トリミングされた画像。</p>\n<h4 id=\"imageresizeoptions\"><a href=\"#imageresizeoptions\"><code>image.resize(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>width</code> Integer (任意) - 省略値は画像の幅。</li>\n<li><code>height</code> Integer (任意) - 省略値は画像の高さ。</li>\n<li><code>quality</code> String (任意) - リサイズした画像の希望する画質。 値は <code>good</code>、<code>better</code>、<code>best</code> のいずれかにできます。 省略値は、<code>best</code> です。 これらの値は、必要な画質と速度のトレードオフを表現する。 これらは、動作プラットフォームの機能 (CPU、GPU) に依存するアルゴリズム固有のメソッドに変換されます。 3 つのメソッド全てを、特定プラットフォーム上の同じアルゴリズムに割り当てることもできます。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>NativeImage</code> - リサイズされた画像。</p>\n<p><code>height</code> または <code>width</code> のどちらかのみが指定された場合、アスペクト比はリサイズされた画像でも保持されます。</p>\n<h4 id=\"imagegetaspectratioscalefactor\"><a href=\"#imagegetaspectratioscalefactor\"><code>image.getAspectRatio([scaleFactor])</code></a></h4>\n<ul>\n<li><code>scaleFactor</code> Double (任意) - 省略値は 1.0。</li>\n</ul>\n<p>戻り値 <code>Float</code> - イメージのアスペクト比。</p>\n<p><code>scaleFactor</code> が渡された場合、渡された値に最も近い画像表現に対応するアスペクト比を返します。</p>\n<h4 id=\"imagegetscalefactors\"><a href=\"#imagegetscalefactors\"><code>image.getScaleFactors()</code></a></h4>\n<p>戻り値 <code>Float[]</code> - この NativeImage の表現に対応するすべての拡大率の配列。</p>\n<h4 id=\"imageaddrepresentationoptions\"><a href=\"#imageaddrepresentationoptions\"><code>image.addRepresentation(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>scaleFactor</code> Double - 画像を表現する際の拡大倍率。</li>\n<li><code>width</code> Integer (任意) - 既定値は 0 です。 <code>buffer</code> にビットマップバッファが指定されている場合は必要です。</li>\n<li><code>height</code> Integer (任意) - 既定値は 0 です。 <code>buffer</code> にビットマップバッファが指定されている場合は必要です。</li>\n<li><code>buffer</code> Buffer (任意) - 生の画像データを格納するバッファ。</li>\n<li><code>dataURL</code> String (任意) - Base64 エンコードした PNG または JPEG 画像を格納しているデータURL。</li>\n</ul></li>\n</ul>\n<p>画像の表現を指定された縮尺で追加します。 これによって、異なる縮尺の表現を明示的に画像へ追加できます。 空の画像で呼び出すことができます。</p>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<h4 id=\"nativeimageismactemplateimage-macos\"><a href=\"#nativeimageismactemplateimage-macos\"><code>nativeImage.isMacTemplateImage</code> <em>macOS</em></a></h4>\n<p><code>Boolean</code> 型のプロパティです。その画像が <a href=\"https://developer.apple.com/documentation/appkit/nsimage/1520017-template\">テンプレート画像</a> と見なされるかどうかを決定します。</p>\n<p>このプロパティは macOS にのみ影響することに注意してください。</p>",
      "title": "nativeImage",
      "description": "tray や Dock やアプリケーションのアイコンを PNG や JPG ファイルで作成します。"
    },
    "/docs/api/native-theme": {
      "locale": "ja-JP",
      "slug": "native-theme",
      "href": "/docs/api/native-theme",
      "crowdinFileId": "256343",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/native-theme.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nativetheme\"><a href=\"#nativetheme\">nativeTheme</a></h1>\n<blockquote>\n<p>Chromium のネイティブカラーテーマの変更を読み取って対応します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h2 id=\"イベント\"><a href=\"#イベント\">イベント</a></h2>\n<p><code>nativeTheme</code> モジュールには以下のイベントがあります。</p>\n<h3 id=\"イベント-updated\"><a href=\"#イベント-updated\">イベント: 'updated'</a></h3>\n<p>基になる NativeTheme の何かが変更されたときに発行されます。 これは通常、<code>shouldUseDarkColors</code>、<code>shouldUseHighContrastColors</code> または <code>shouldUseInvertedColorScheme</code> のいずれかの値が変更されたことを意味します。 それらを確認して、どれが変更されたかを判断する必要があります。</p>\n<h2 id=\"プロパティ\"><a href=\"#プロパティ\">プロパティ</a></h2>\n<p><code>nativeTheme</code> モジュールには以下のプロパティがあります。</p>\n<h3 id=\"nativethemeshouldusedarkcolors-読み出し専用\"><a href=\"#nativethemeshouldusedarkcolors-読み出し専用\"><code>nativeTheme.shouldUseDarkColors</code> <em>読み出し専用</em></a></h3>\n<p>OS / Chromium で現在ダークモードが有効になっている、またはダークスタイルの UI を表示するように指示されているかどうかの <code>Boolean</code>。  この値を変更する場合は、以下の <code>themeSource</code> を使用する必要があります。</p>\n<h3 id=\"nativethemethemesource\"><a href=\"#nativethemethemesource\"><code>nativeTheme.themeSource</code></a></h3>\n<p><code>String</code> 型のプロパティです。<code>system</code>、<code>light</code> か <code>dark</code> にできます。  Chromium が内部で使用することを選択した値をオーバーライドして置き換えるために使用されます。</p>\n<p>このプロパティを <code>system</code> に設定するとオーバーライドが削除され、すべてが OS のデフォルトにリセットされます。  既定の <code>themeSource</code> は <code>system</code> です。</p>\n<p>このプロパティを <code>dark</code> に設定すると、以下の効果があります。</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code> はアクセス時に <code>true</code> になります</li>\n<li>右クリックメニューやデベロッパー ツールなど、Linux や Windows 上で Electron がレンダリングするすべての UI は、ダーク UI を使用します。</li>\n<li>メニューやウィンドウフレームなどの OS が macOS 上でレンダリングする UI は、すべてダーク UI を使用します。</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> CSS が <code>dark</code> モードに親和します。</li>\n<li><code>updated</code> イベントが発生します。</li>\n</ul>\n<p>このプロパティを <code>light</code> に設定すると、以下の効果があります。</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code> はアクセス時に <code>false</code> になります</li>\n<li>右クリックメニューやデベロッパー ツールなど、Linux や Windows 上で Electron がレンダリングするすべての UI は、ライト UI を使用します。</li>\n<li>メニューやウィンドウフレームなどの OS が macOS 上でレンダリングする UI は、すべてライト UI を使用します。</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> CSS が <code>light</code> モードに親和します。</li>\n<li><code>updated</code> イベントが発生します。</li>\n</ul>\n<p>このプロパティを使用するにあたって、ユーザーに以下のような 3 つの選択肢がある、古典的なアプリケーションの \"ダークモード\" ステートマシンに合わせるべきです。</p>\n<ul>\n<li><code>Follow OS</code> --> <code>themeSource = 'system'</code></li>\n<li><code>Dark Mode</code> --> <code>themeSource = 'dark'</code></li>\n<li><code>Light Mode</code> --> <code>themeSource = 'light'</code></li>\n</ul>\n<p>アプリケーションは、<code>shouldUseDarkColors</code> を使用して、適用する CSS を常に決定する必要があります。</p>\n<h3 id=\"nativethemeshouldusehighcontrastcolors-macos-windows-読み出し専用\"><a href=\"#nativethemeshouldusehighcontrastcolors-macos-windows-読み出し専用\"><code>nativeTheme.shouldUseHighContrastColors</code> <em>macOS</em> <em>Windows</em> <em>読み出し専用</em></a></h3>\n<p>OS / Chromium で現在ハイコントラストモードが有効になっている、またはハイコントラスト UI を表示するように指示されているかどうかの <code>Boolean</code>。</p>\n<h3 id=\"nativethemeshoulduseinvertedcolorscheme-macos-windows-読み出し専用\"><a href=\"#nativethemeshoulduseinvertedcolorscheme-macos-windows-読み出し専用\"><code>nativeTheme.shouldUseInvertedColorScheme</code> <em>macOS</em> <em>Windows</em> <em>読み出し専用</em></a></h3>\n<p>OS / Chromium が現在反転カラースキームを持っている、または反転カラースキームを使用するように指示されているかどうかの <code>Boolean</code>。</p>",
      "title": "nativeTheme",
      "description": "Chromium のネイティブカラーテーマの変更を読み取って対応します。"
    },
    "/docs/api/net": {
      "locale": "ja-JP",
      "slug": "net",
      "href": "/docs/api/net",
      "crowdinFileId": "256347",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/net.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"net\"><a href=\"#net\">net</a></h1>\n<blockquote>\n<p>Chromium のネイティブのネットワークライブラリを使用して、 HTTP/HTTPS リクエストを発行します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>net</code> モジュールは HTTP(S) リクエストを発行するクライアントサイド API です。 これは Node.js の <a href=\"https://nodejs.org/api/http.html\">HTTP</a> および <a href=\"https://nodejs.org/api/https.html\">HTTPS</a> モジュールに似ていますが、Node.js 実装の代わりに Chromium のネイティブネットワークライブラリを使用し、ウェブプロキシをより効果的にサポートします。 また、ネットワーク状況の確認にも対応しています。</p>\n<p>以下は、完全に網羅しているわけではありませんが、ネイティブ Node.js モジュールの代わりに <code>net</code> モジュールを使用することを検討する理由のリストです。</p>\n<ul>\n<li>システムプロキシ設定の自動管理、WPAD プロトコルとプロキシの PAC 設定ファイルのサポート。</li>\n<li>HTTPS リクエストの自動トンネリング。</li>\n<li>Basic、Digest、NTLM、Kerberosを使用したプロキシの認証、またはネゴシエート認証スキームをサポート。</li>\n<li>アクセス制御および監視に使用される、Fiddler のようなトラフィック監視プロキシのサポート。</li>\n</ul>\n<p>API コンポーネント (クラス、メソッド、プロパティ、イベント名など) は、Node.js で使用されているものと同様です。</p>\n<p>使用例:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> { net } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n  <span class=\"hljs-keyword\">const</span> request = net.request(<span class=\"hljs-string\">'https://github.com'</span>)\n  request.on(<span class=\"hljs-string\">'response'</span>, (response) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`STATUS: <span class=\"hljs-subst\">${response.statusCode}</span>`</span>)\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`HEADERS: <span class=\"hljs-subst\">${<span class=\"hljs-built_in\">JSON</span>.stringify(response.headers)}</span>`</span>)\n    response.on(<span class=\"hljs-string\">'data'</span>, (chunk) => {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`BODY: <span class=\"hljs-subst\">${chunk}</span>`</span>)\n    })\n    response.on(<span class=\"hljs-string\">'end'</span>, () => {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'No more data in response.'</span>)\n    })\n  })\n  request.end()\n})\n</code></pre>\n<p><code>net</code> API は、アプリケーションが <code>ready</code> イベントを発生させた後でのみ使用できます。 <code>ready</code> イベントの前にモジュールを使用しようとすると、エラーがスローされます。</p>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>net</code> モジュールには以下のメソッドがあります。</p>\n<h3 id=\"netrequestoptions\"><a href=\"#netrequestoptions\"><code>net.request(options)</code></a></h3>\n<ul>\n<li><code>options</code> (ClientRequestConstructorOptions | String) - <code>ClientRequest</code> コンストラクタのオプション。</li>\n</ul>\n<p>戻り値 <a href=\"/docs/api/client-request\"><code>ClientRequest</code></a></p>\n<p><code>ClientRequest</code> コンストラクタに直接転送される <code>options</code> を使用して<a href=\"/docs/api/client-request\"><code>ClientRequest</code></a> インスタンスを作成します。 <code>net.request</code> メソッドは、<code>options</code> オブジェクト内の指定されたプロトコルにしたがって、セキュアとインセキュア両方の HTTP リクエストを発行するために使用されます。</p>\n<h3 id=\"netisonline\"><a href=\"#netisonline\"><code>net.isOnline()</code></a></h3>\n<p>戻り値 <code>Boolean</code> - 現在インターネットに接続しているかどうか。</p>\n<p>戻り値が <code>false</code> の場合、ユーザーがリモートサイトに接続できないことをかなり強く示しています。 しかし、<code>true</code> の戻り値は決定的ではありません。いくつかのリンクが見当たらなくても、特定リモートサイトへの特定の接続試行が成功するかどうかは不確かです。</p>\n<h2 id=\"プロパティ\"><a href=\"#プロパティ\">プロパティ</a></h2>\n<h3 id=\"netonline-読み出し専用\"><a href=\"#netonline-読み出し専用\"><code>net.online</code> <em>読み出し専用</em></a></h3>\n<p><code>Boolean</code> 型のプロパティです。 これは現在インターネットに接続しているかどうかです。</p>\n<p>戻り値が <code>false</code> の場合、ユーザーがリモートサイトに接続できないことをかなり強く示しています。 しかし、<code>true</code> の戻り値は決定的ではありません。いくつかのリンクが見当たらなくても、特定リモートサイトへの特定の接続試行が成功するかどうかは不確かです。</p>",
      "title": "net",
      "description": "Chromium のネイティブのネットワークライブラリを使用して、 HTTP/HTTPS リクエストを発行します。"
    },
    "/docs/api/net-log": {
      "locale": "ja-JP",
      "slug": "net-log",
      "href": "/docs/api/net-log",
      "crowdinFileId": "256345",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/net-log.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"netlog\"><a href=\"#netlog\">netLog</a></h1>\n<blockquote>\n<p>セッションのネットワークイベントをロギングします。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { netLog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> netLog.startLogging(<span class=\"hljs-string\">'/path/to/net-log'</span>)\n  <span class=\"hljs-comment\">// ネットワークイベントの後</span>\n  <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> netLog.stopLogging()\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Net-logs written to'</span>, path)\n})\n</code></pre>\n<p>アプリのライフサイクル全体にわたってネットワークイベントをロギングするには <a href=\"/docs/api/command-line-switches#--log-net-logpath\"><code>--log-net-log</code></a> を参照してください。</p>\n<p><strong>注釈:</strong> 指定されていないすべてのメソッドは、<code>app</code> モジュールの <code>ready</code> イベントが発生した後にのみ使用できます。</p>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<h3 id=\"netlogstartloggingpath-options\"><a href=\"#netlogstartloggingpath-options\"><code>netLog.startLogging(path[, options])</code></a></h3>\n<ul>\n<li><code>path</code> String - ネットワークログを記録するファイルパス。</li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>captureMode</code> String (任意) - キャプチャするデータの種類。 既定では、リクエストに関するメタデータのみがキャプチャされます。 これを <code>includeSensitive</code> にすると、Cookie と認証データが含まれます。 <code>everything</code> にすると、ソケットで転送されるすべてのバイトが含まれます。 <code>default</code>、<code>includeSensitive</code> または <code>everything</code> にできます。</li>\n<li><code>maxFileSize</code> Number (任意) - ログがこのサイズを超えると、ロギングは自動的に停止します。 デフォルトでは無制限です。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - ネットログの記録が開始されると解決します。</p>\n<p><code>path</code> へネットワークイベントの記録を開始する。</p>\n<h3 id=\"netlogstoplogging\"><a href=\"#netlogstoplogging\"><code>netLog.stopLogging()</code></a></h3>\n<p>戻り値 <code>Promise&#x3C;void></code> - ネットログがディスクに書き込まれたときに解決されます。</p>\n<p>ネットワークイベントの記録を停止します。 もし呼ばれなければ、ネットロギングはアプリ終了時に自動的に終了します。</p>\n<h2 id=\"プロパティ\"><a href=\"#プロパティ\">プロパティ</a></h2>\n<h3 id=\"netlogcurrentlylogging-読み出し専用\"><a href=\"#netlogcurrentlylogging-読み出し専用\"><code>netLog.currentlyLogging</code> <em>読み出し専用</em></a></h3>\n<p><code>Boolean</code> 型のプロパティです。ネットワークログが現在記録されているかどうかを示します。</p>",
      "title": "netLog",
      "description": "セッションのネットワークイベントをロギングします。"
    },
    "/docs/api/structures/new-window-web-contents-event": {
      "locale": "ja-JP",
      "slug": "new-window-web-contents-event",
      "href": "/docs/api/structures/new-window-web-contents-event",
      "crowdinFileId": "256469",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/new-window-web-contents-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"newwindowwebcontentsevent-object-extends-event\"><a href=\"#newwindowwebcontentsevent-object-extends-event\">NewWindowWebContentsEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>newGuest</code> BrowserWindow (optional)</li>\n</ul>",
      "title": "NewWindowWebContentsEvent Object extends Event",
      "description": ""
    },
    "/docs/api/notification": {
      "locale": "ja-JP",
      "slug": "notification",
      "href": "/docs/api/notification",
      "crowdinFileId": "256349",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/notification.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"notification\"><a href=\"#notification\">Notification</a></h1>\n<blockquote>\n<p>デスクトップ通知を作成します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h2 id=\"レンダラープロセスでの使い方\"><a href=\"#レンダラープロセスでの使い方\">レンダラープロセスでの使い方</a></h2>\n<p>レンダラープロセスから通知を表示したい場合は、<a href=\"/docs/tutorial/notifications\">HTML5 Notification API</a> を使用する必要があります</p>\n<h2 id=\"クラス-notification\"><a href=\"#クラス-notification\">クラス: Notification</a></h2>\n<blockquote>\n<p>デスクトップ通知を作成します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>Notification</code> は <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a> を継承しています。</p>\n<p><code>options</code> によって設定されたネイティブプロパティで新しい <code>Notification</code> を生成します。</p>\n<h3 id=\"静的メソッド\"><a href=\"#静的メソッド\">静的メソッド</a></h3>\n<p><code>Notification</code> クラスには、次の静的メソッドがあります。</p>\n<h4 id=\"notificationissupported\"><a href=\"#notificationissupported\"><code>Notification.isSupported()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - 現在のシステムでデスクトップ通知がサポートされているかどうか。</p>\n<h3 id=\"new-notificationoptions\"><a href=\"#new-notificationoptions\"><code>new Notification([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (任意)<ul>\n<li><code>title</code> String (任意) - 通知ウィンドウの上部に表示される通知のタイトル.</li>\n<li><code>subtitle</code> String (任意) <em>macOS</em> - タイトルの下に表示される、通知のサブタイトル。</li>\n<li><code>body</code> String (任意) - タイトルやサブタイトルの下に表示さる、通知の本文。</li>\n<li><code>silent</code> Boolean (任意) - 通知を表示するときにOSが通知音を鳴らすかどうか。</li>\n<li><code>icon</code> (String | <a href=\"/docs/api/native-image\">NativeImage</a>) (任意) - 通知に使用されるアイコン。</li>\n<li><code>hasReply</code> Boolean (任意) <em>macOS</em> - 通知に埋め込み返信オプションを追加するかどうか。</li>\n<li><code>timeoutType</code> String (任意) <em>Linux</em> <em>Windows</em> - 通知の消失までの時間。 'default' か 'never' にできます。</li>\n<li><code>replyPlaceholder</code> String (任意) <em>macOS</em> - 埋め込み返信入力フィールド内に書かれるプレースホルダ。</li>\n<li><code>sound</code> String (任意) <em>macOS</em> - 通知が表示されるときに再生される音声ファイルの名前。</li>\n<li><code>urgency</code> String (任意) <em>Linux</em> - 通知の緊急度レベル。 'normal'、'critical'、'low' のいずれかにできます。</li>\n<li><code>actions</code> <a href=\"/docs/api/structures/notification-action\">NotificationAction[]</a> (任意) <em>macOS</em> - 通知に追加するアクション。 <code>NotificationAction</code> ドキュメント内の有効なアクションと制限を読んで下さい。</li>\n<li><code>closeButtonText</code> String (任意) <em>macOS</em> - 通知を閉じるボタンのカスタムタイトル。 空の文字列の場合は、既定のローカライズされたテキストが使用されます。</li>\n<li><code>toastXml</code> String (任意) <em>Windows</em> - Windows 通知のカスタム記述は、上記のプロパティすべてを上書きします。 これは通知のデザインと動作の完全なカスタマイズを提供します。</li>\n</ul></li>\n</ul>\n<h3 id=\"インスタンスイベント\"><a href=\"#インスタンスイベント\">インスタンスイベント</a></h3>\n<p><code>new Notification</code> で作成されたオブジェクトでは以下のイベントが発生します。</p>\n<p><strong>注:</strong> いくつかのイベントは特定のオペレーティングシステムでのみ利用可能で、そのように注記がつけられています。</p>\n<h4 id=\"イベント-show\"><a href=\"#イベント-show\">イベント: 'show'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>通知がユーザーに表示されたときに発行されます。<code>show()</code> メソッドを使用して通知を複数回表示できることに注意して下さい。</p>\n<h4 id=\"イベント-click\"><a href=\"#イベント-click\">イベント: 'click'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>ユーザによって通知がクリックされたときに発行されます。</p>\n<h4 id=\"イベント-close\"><a href=\"#イベント-close\">イベント: 'close'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>ユーザの手によって手動で通知が閉じられたときに発行されます。</p>\n<p>このイベントは、通知が閉じられたすべての状況で発行されることは保証されていません。</p>\n<h4 id=\"イベント-reply-macos\"><a href=\"#イベント-reply-macos\">イベント: 'reply' <em>macOS</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>reply</code> String - ユーザが埋め込み返信フィールドに入力した文字列.</li>\n</ul>\n<p><code>hasReply: true</code> の通知上で、ユーザが \"返信\" ボタンをクリックしたときに発行されます。</p>\n<h4 id=\"イベント-action-macos\"><a href=\"#イベント-action-macos\">イベント: 'action' <em>macOS</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>index</code> Number - アクティベートされたアクションのインデックス.</li>\n</ul>\n<h4 id=\"イベント-failed-windows\"><a href=\"#イベント-failed-windows\">イベント: 'failed' <em>Windows</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>error</code> String - <code>show()</code> メソッドの実行中に発生したエラー。</li>\n</ul>\n<p>ネイティブ通知の作成および表示でエラーに遭遇した場合に発生します。</p>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<p><code>new Notification</code> で作成されたオブジェクトは、次のインスタンスメソッドを持っています。</p>\n<h4 id=\"notificationshow\"><a href=\"#notificationshow\"><code>notification.show()</code></a></h4>\n<p>HTML5 Notification の実装とは異なり、<code>new Notification</code> でインスタンス化するだけでは、すぐにユーザに表示されないことに注意してください。OS が表示するためにこのメソッドを呼び出す必要があります。</p>\n<p>以前にその通知が表示されている場合、このメソッドはその通知を閉じ、同じプロパティを持つ新しい通知を作成します。</p>\n<h4 id=\"notificationclose\"><a href=\"#notificationclose\"><code>notification.close()</code></a></h4>\n<p>通知を閉じます。</p>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<h4 id=\"notificationtitle\"><a href=\"#notificationtitle\"><code>notification.title</code></a></h4>\n<p>通知のタイトルを表す <code>String</code> プロパティ。</p>\n<h4 id=\"notificationsubtitle\"><a href=\"#notificationsubtitle\"><code>notification.subtitle</code></a></h4>\n<p>通知のサブタイトルを表す <code>String</code> プロパティ。</p>\n<h4 id=\"notificationbody\"><a href=\"#notificationbody\"><code>notification.body</code></a></h4>\n<p>通知の本文を表す <code>String</code> プロパティ。</p>\n<h4 id=\"notificationreplyplaceholder\"><a href=\"#notificationreplyplaceholder\"><code>notification.replyPlaceholder</code></a></h4>\n<p>通知の応答プレースホルダーを表す <code>String</code> プロパティ。</p>\n<h4 id=\"notificationsound\"><a href=\"#notificationsound\"><code>notification.sound</code></a></h4>\n<p>通知音を表す <code>String</code> プロパティ。</p>\n<h4 id=\"notificationclosebuttontext\"><a href=\"#notificationclosebuttontext\"><code>notification.closeButtonText</code></a></h4>\n<p>通知の閉じるボタンのテキストを表す <code>String</code> プロパティ。</p>\n<h4 id=\"notificationsilent\"><a href=\"#notificationsilent\"><code>notification.silent</code></a></h4>\n<p>通知が無音かどうかを表す <code>Boolean</code> プロパティ。</p>\n<h4 id=\"notificationhasreply\"><a href=\"#notificationhasreply\"><code>notification.hasReply</code></a></h4>\n<p>通知に応答アクションがあるかどうかを表す <code>Boolean</code> プロパティ。</p>\n<h4 id=\"notificationurgency-linux\"><a href=\"#notificationurgency-linux\"><code>notification.urgency</code> <em>Linux</em></a></h4>\n<p>通知の緊急度を表す <code>String</code> プロパティ。 'normal'、'critical'、'low' のいずれかにできます。</p>\n<p>省略値は 'low' - この詳細は <a href=\"https://developer.gnome.org/notification-spec/#urgency-levels\">NotifyUrgency</a> を参照してください。</p>\n<h4 id=\"notificationtimeouttype-linux-windows\"><a href=\"#notificationtimeouttype-linux-windows\"><code>notification.timeoutType</code> <em>Linux</em> <em>Windows</em></a></h4>\n<p>通知がタイムアウトする種別を表す <code>String</code> プロパティ。 'default' か 'never' にできます。</p>\n<p><code>timeoutType</code> が 'never' に設定されている場合、通知は自動的に閉じられません。 呼び出し元の API かユーザによって閉じられるまで開いたままになります。</p>\n<h4 id=\"notificationactions\"><a href=\"#notificationactions\"><code>notification.actions</code></a></h4>\n<p>通知のアクションを表す <a href=\"/docs/api/structures/notification-action\"><code>NotificationAction[]</code></a> プロパティ。</p>\n<h4 id=\"notificationtoastxml-windows\"><a href=\"#notificationtoastxml-windows\"><code>notification.toastXml</code> <em>Windows</em></a></h4>\n<p><code>String</code> 型のプロパティで、通知のカスタム Toast XML を表します。</p>\n<h3 id=\"サウンドの再生\"><a href=\"#サウンドの再生\">サウンドの再生</a></h3>\n<p>macOS では、通知が表示されたときに再生したいサウンドの名前を指定することができます。 カスタムサウンドファイルに加えて、(システム環境設定 > サウンド にある) デフォルトサウンドのいずれかを使用することができます。 サウンドファイルがアプリバンドル (<code>YourApp.app/Contents/Resources</code> など) または以下のいずれかの場所にコピーされることに留意してください。</p>\n<ul>\n<li><code>~/ライブラリ/Sounds</code></li>\n<li><code>/ライブラリ/Sounds</code></li>\n<li><code>/ネットワーク/ライブラリ/Sounds</code></li>\n<li><code>/システム/ライブラリ/Sounds</code></li>\n</ul>\n<p>より詳しくは、<a href=\"https://developer.apple.com/documentation/appkit/nssound\"><code>NSSound</code></a> ドキュメントを参照して下さい。</p>",
      "title": "Notification",
      "description": "デスクトップ通知を作成します。"
    },
    "/docs/api/structures/notification-action": {
      "locale": "ja-JP",
      "slug": "notification-action",
      "href": "/docs/api/structures/notification-action",
      "crowdinFileId": "256471",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/notification-action.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificationaction-object\"><a href=\"#notificationaction-object\">NotificationAction Object</a></h1>\n<ul>\n<li><code>type</code> String - The type of action, can be <code>button</code>.</li>\n<li><code>text</code> String (optional) - The label for the given action.</li>\n</ul>\n<h2 id=\"platform--action-support\"><a href=\"#platform--action-support\">Platform / Action Support</a></h2>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Action Type</th><th>Platform Support</th><th>Usage of <code>text</code></th><th>Default <code>text</code></th><th>Limitations</th></tr></thead><tbody><tr><td><code>button</code></td><td>macOS</td><td>Used as the label for the button</td><td>\"Show\" (or a localized string by system default if first of such <code>button</code>, otherwise empty)</td><td>Only the first one is used. If multiple are provided, those beyond the first will be listed as additional actions (displayed when mouse active over the action button). Any such action also is incompatible with <code>hasReply</code> and will be ignored if <code>hasReply</code> is <code>true</code>.</td></tr></tbody></table>\n<h3 id=\"button-support-on-macos\"><a href=\"#button-support-on-macos\">Button support on macOS</a></h3>\n<p>In order for extra notification buttons to work on macOS your app must meet the following criteria.</p>\n<ul>\n<li>App is signed</li>\n<li>App has it's <code>NSUserNotificationAlertStyle</code> set to <code>alert</code> in the <code>Info.plist</code>.</li>\n</ul>\n<p>If either of these requirements are not met the button won't appear.</p>",
      "title": "NotificationAction Object",
      "description": ""
    },
    "/docs/api/structures/notification-response": {
      "locale": "ja-JP",
      "slug": "notification-response",
      "href": "/docs/api/structures/notification-response",
      "crowdinFileId": "256473",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/notification-response.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificationresponse-object\"><a href=\"#notificationresponse-object\">NotificationResponse Object</a></h1>\n<ul>\n<li><code>actionIdentifier</code> String - The identifier string of the action that the user selected.</li>\n<li><code>date</code> Number - The delivery date of the notification.</li>\n<li><code>identifier</code> String - The unique identifier for this notification request.</li>\n<li><code>userInfo</code> Record&#x3C;String, any> - A dictionary of custom information associated with the notification.</li>\n<li><code>userText</code> String (optional) - The text entered or chosen by the user.</li>\n</ul>",
      "title": "NotificationResponse Object",
      "description": ""
    },
    "/docs/tutorial/notifications": {
      "locale": "ja-JP",
      "slug": "notifications",
      "href": "/docs/tutorial/notifications",
      "crowdinFileId": "256225",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/notifications.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"通知\"><a href=\"#通知\">通知</a></h1>\n<h2 id=\"概要\"><a href=\"#概要\">概要</a></h2>\n<p>3 つのオペレーティングシステムはすべて、アプリケーションがユーザに通知を送信する手段を提供しています。 通知を表示する方法はメインプロセスとレンダラーのプロセスで異なります。</p>\n<p>レンダラープロセスでは、現在実行中のオペレーティングシステムのネイティブ通知 API を使用する、<a href=\"https://notifications.spec.whatwg.org/\">HTML5 通知 API</a> で通知を送信して表示できます。</p>\n<p>メインプロセスで通知を表示するには、<a href=\"/docs/api/notification\">Notification</a> モジュールを使用する必要があります。</p>\n<h2 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h2>\n<h3 id=\"レンダラープロセスで通知を表示する\"><a href=\"#レンダラープロセスで通知を表示する\">レンダラープロセスで通知を表示する</a></h3>\n<p><a href=\"/docs/tutorial/quick-start\">クイックスタートガイド</a> の作業用アプリケーションから始めることにして、 <code>index.html</code> ファイルの <code>&#x3C;/body></code> タグを閉じる手前に以下の行を追加します。</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<p>…そして <code>renderer.js</code> ファイルを追加します。</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/notifications/renderer\"><span class=\"hljs-keyword\">const</span> NOTIFICATION_TITLE = <span class=\"hljs-string\">'Title'</span>\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_BODY = <span class=\"hljs-string\">'Notification from the Renderer process. Click to log to console.'</span>\n<span class=\"hljs-keyword\">const</span> CLICK_MESSAGE = <span class=\"hljs-string\">'Notification clicked'</span>\n\n<span class=\"hljs-keyword\">new</span> Notification(NOTIFICATION_TITLE, { <span class=\"hljs-attr\">body</span>: NOTIFICATION_BODY })\n  .onclick = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-built_in\">console</span>.log(CLICK_MESSAGE)\n</code></pre>\n<p>Electron アプリケーションを起動すると、以下のような通知が表示されるでしょう。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/notification-renderer.png\" alt=\"レンダラープロセスでの通知\"></p>\n<p>さらに、通知をクリックすると、DOM が更新されて \"Notification clicked!\" と表示されます。</p>\n<h3 id=\"メインプロセスで通知を表示する\"><a href=\"#メインプロセスで通知を表示する\">メインプロセスで通知を表示する</a></h3>\n<p><a href=\"/docs/tutorial/quick-start\">クイックスタートガイド</a> の作業用アプリケーションから始めることにして、 <code>main.js</code> ファイルを以下の行の通りに更新します。</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/notifications/main\"><span class=\"hljs-keyword\">const</span> { Notification } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_TITLE = <span class=\"hljs-string\">'Basic Notification'</span>\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_BODY = <span class=\"hljs-string\">'Notification from the Main process'</span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">showNotification</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">new</span> Notification({ <span class=\"hljs-attr\">title</span>: NOTIFICATION_TITLE, <span class=\"hljs-attr\">body</span>: NOTIFICATION_BODY }).show()\n}\n\napp.whenReady().then(createWindow).then(showNotification)\n</code></pre>\n<p>Electron アプリケーションを起動すると、以下のようなシステム通知が表示されるでしょう。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/notification-main.png\" alt=\"メインプロセスでの通知\"></p>\n<h2 id=\"さらなる情報\"><a href=\"#さらなる情報\">さらなる情報</a></h2>\n<p>オペレーティングシステム間でのコードとユーザエクスペリエンスは似ていますが、微妙な違いがあります。</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<ul>\n<li>Windows 10 では、スタート画面に <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">アプリケーションユーザーモデル ID</a> でアプリへのショートカットをインストールしなければなりません。 これは開発中だとやり過ぎな可能性があるため、スタートメニューに <code>node_modules\\electron\\dist\\electron.exe</code> を追加することも一つの手です。 エクスプローラーでそのファイルを開き、右クリックして 'スタート メニューにピン留めする' を選択します。 そして、通知を表示するにはメインプロセスに <code>app.setAppUserModelId(process.execPath)</code> の一行を追加する必要があります。</li>\n<li>Windows 8.1 と Windows 8 では、スタート画面に <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">アプリケーションユーザーモデル ID</a> でアプリへのショートカットをインストールしなければなりません。 注釈: ただし、スタート画面にピン留めする必要はありません。</li>\n<li>Windows 7 では、通知はカスタム実装を介して動作します。これは新しいシステムのネイティブのものと似た見た目になります。</li>\n</ul>\n<p>Electronは、アプリケーションユーザーモデル ID の作業を自動化しようとしています。 Electron をインストール&#x26;アップデートフレームワーク Squirrel と共に使用すると、<a href=\"https://github.com/electron/windows-installer/blob/master/README.md#handling-squirrel-events\">ショートカットが自動的に正しく設定されます</a>。 さらに、Electron は Squirrel が使用されたことを検出し、正しい値を指定して自動的に <code>app.setAppUserModelId()</code> を呼び出します。 開発中では、<a href=\"/docs/api/app#appsetappusermodelidid-windows\"><code>app.setAppUserModelId()</code></a> を自身で呼び出す必要があります。</p>\n<p>さらに、Windows 8では、通知本体の最大長は250文字で、Windowsチームは通知を200文字にすることを推奨しています。 この制限は Windows 10では削除されており、これは Windows チームは合理的にするために開発者の意見を聞いているということです。 巨大な量のテキスト (数千文字) を API に送信しようとすると、不安定になる可能性があります。</p>\n<h4 id=\"高度な通知\"><a href=\"#高度な通知\">高度な通知</a></h4>\n<p>Windows の以降のバージョンでは、カスタムテンプレート、イメージ、その他の柔軟な要素を使用した高度な通知が可能です。 これらの通知を (メインプロセスかレンダラープロセスから) 送信するには、<code>ToastNotification</code> と <code>TileNotification</code> オブジェクトを送るネイティブ Node アドオンを使用する、<a href=\"https://github.com/felixrieseberg/electron-windows-notifications\">electron-windows-notification</a> ユーザーランドモジュールを使用します。</p>\n<p>ボタンを含む通知は <code>electron-windows-notifications</code> で機能しますが、返信を処理するには <a href=\"https://github.com/felixrieseberg/electron-windows-interactive-notifications\"><code>electron-windows-interactive-notifications</code></a> を使用する必要があります。これにより、必要な COM コンポーネントを登録し、入力したユーザーデータを使用して Electron アプリを呼び出すことができます。</p>\n<h4 id=\"非通知--プレゼンテーションモード\"><a href=\"#非通知--プレゼンテーションモード\">非通知 / プレゼンテーションモード</a></h4>\n<p>通知を送信することが許可されているかどうかを検出するには、ユーザーランドモジュールの <a href=\"https://github.com/felixrieseberg/electron-notification-state\">electron-notification-state</a> を使用します。</p>\n<p>これにより、Windows が通知を無音で表示するかどうかを事前に判断することができます。</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>macOS 上での通知は簡単ですが、<a href=\"https://developer.apple.com/macos/human-interface-guidelines/system-capabilities/notifications/\">通知に関する Apple のヒューマンインタフェースガイドライン</a> を理解しておく必要があります。</p>\n<p>通知サイズは256バイトに制限されており、その制限を超えると切り捨てられることに注意してください。</p>\n<h4 id=\"おやすみモード--セッションステート\"><a href=\"#おやすみモード--セッションステート\">おやすみモード / セッションステート</a></h4>\n<p>通知を送信することが許可されているかどうかを検出するには、<a href=\"https://github.com/felixrieseberg/electron-notification-state\">electron-notification-state</a> ユーザーランドモジュールを使用します。</p>\n<p>これにより、通知が表示されるかどうかを事前に検出することができます。</p>\n<h3 id=\"linux\"><a href=\"#linux\">Linux</a></h3>\n<p>通知は、<a href=\"https://developer.gnome.org/notification-spec/\">デスクトップ通知仕様</a> (Cinnamon、Enlightenment、Unity、GNOME、KDE) に従ってデスクトップ環境の通知を表示できる <code>libnotify</code> を使用して送信されます。</p>",
      "title": "通知",
      "description": ""
    },
    "/docs/tutorial/offscreen-rendering": {
      "locale": "ja-JP",
      "slug": "offscreen-rendering",
      "href": "/docs/tutorial/offscreen-rendering",
      "crowdinFileId": "256227",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/offscreen-rendering.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"オフスクリーンレンダリング\"><a href=\"#オフスクリーンレンダリング\">オフスクリーンレンダリング</a></h1>\n<h2 id=\"概要\"><a href=\"#概要\">概要</a></h2>\n<p>オフスクリーンレンダリングでは <code>BrowserWindow</code> のコンテンツを ビットマップで取得できます。これは、3D シーンのテクスチャのようにどこにでも描画できます。 Electron のオフスクリーンレンダリングは <a href=\"https://bitbucket.org/chromiumembedded/cef\">Chromium 埋め込みフレームワーク</a> プロジェクトと似たアプローチを使用しています。</p>\n<p><em>注意</em>:</p>\n<ul>\n<li>レンダリングモードは 2 種類使用でき (後述)、変化した部分だけを <code>paint</code> イベントに渡すことでより効率的なレンダリングができます。</li>\n<li>描画を停止/続行したり、フレームレートを設定したりできます。</li>\n<li>最大フレームレートは 240 です。より大きな値にしてもメリットはなく、性能を損うだけです。</li>\n<li>ウェブページに何も起きなければ、フレームは生成されません。</li>\n<li>オフスクリーンウインドウは、常に <a href=\"/docs/api/frameless-window\">フレームレスウインドウ</a> として作成されます。</li>\n</ul>\n<h3 id=\"レンダリングモード\"><a href=\"#レンダリングモード\">レンダリングモード</a></h3>\n<h4 id=\"gpu-アクセラレーション\"><a href=\"#gpu-アクセラレーション\">GPU アクセラレーション</a></h4>\n<p>GPU アクセラレーションレンダリングとは、GPU が構成に使用されることを意味します。 GPU からのフレームのコピーにより多くのリソースを必要とするため、このモードはソフトウェア出力デバイスよりも遅くなります。 このモードのメリットは、WebGL と 3D CSS アニメーションがサポートされていることです。</p>\n<h4 id=\"ソフトウェア出力デバイス\"><a href=\"#ソフトウェア出力デバイス\">ソフトウェア出力デバイス</a></h4>\n<p>このモードでは、CPU レンダリングのソフトウェア出力デバイスが使用されているため、フレーム生成は非常に高速です。 したがって、このモードは GPU アクセラレーションよりも好まれます。</p>\n<p>このモードを有効にするには、<a href=\"/docs/api/app#appdisablehardwareacceleration\"><code>app.disableHardwareAcceleration()</code> API</a> を呼び出して GPU アクセラレーションを無効にする必要があります。</p>\n<h2 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h2>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/offscreen-rendering\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\napp.disableHardwareAcceleration()\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">offscreen</span>: <span class=\"hljs-literal\">true</span> } })\n\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  win.webContents.on(<span class=\"hljs-string\">'paint'</span>, (event, dirty, image) => {\n    fs.writeFileSync(<span class=\"hljs-string\">'ex.png'</span>, image.toPNG())\n  })\n  win.webContents.setFrameRate(<span class=\"hljs-number\">60</span>)\n})\n</code></pre>\n<p>この Electron アプリケーションを起動したら、アプリケーションを開いたフォルダを見てみましょう。描画された画像があるはずです。</p>",
      "title": "オフスクリーンレンダリング",
      "description": ""
    },
    "/docs/tutorial/online-offline-events": {
      "locale": "ja-JP",
      "slug": "online-offline-events",
      "href": "/docs/tutorial/online-offline-events",
      "crowdinFileId": "256229",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/online-offline-events.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"オンラインオフライン-イベントの検出\"><a href=\"#オンラインオフライン-イベントの検出\">オンライン/オフライン イベントの検出</a></h1>\n<h2 id=\"概要\"><a href=\"#概要\">概要</a></h2>\n<p>標準 HTML5 API の一部である <a href=\"http://html5index.org/Offline%20-%20NavigatorOnLine.html\"><code>navigator.onLine</code></a> 属性を使用して、<a href=\"https://developer.mozilla.org/en-US/docs/Online_and_offline_events\">オンラインおよびオフラインイベント</a> の検出をレンダラープロセスに実装できます。</p>\n<p><code>navigator.onLine</code> 属性の戻り値は以下の通りです。</p>\n<ul>\n<li><code>false</code> ネットワーク要求が失敗することが保証されている場合、つまり確実にオフラインの (ネットワークから切断されている) 場合。</li>\n<li><code>true</code> それ以外の状況。</li>\n</ul>\n<p>他のすべての条件で <code>true</code>が返されるので、<code>true</code> の値は必ずしも Electron がインターネットアクセス可能であるとは限りません。誤検出に注意する必要があります。 例えば、仮想イーサネットアダプタを \"常時接続\" 状態にした仮想化ソフトをコンピュータ上で実行している場合などです。 したがって、Electron のインターネットアクセス状況を判定したい場合には、さらにこの確認手段を開発する必要があります。</p>\n<h2 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h2>\n<p>このサンプルでは、HTML ファイル <code>index.html</code> から始めて、<code>navigator.onLine</code> API を用いた接続状態インジケータの構築方法を示します。</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"script-src 'self' 'unsafe-inline';\"</span> /></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Connection status: <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">strong</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">'status'</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">strong</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>DOM を変更するために、<code>renderer.js</code>ファイルを作成して、そこで <code>window</code> の <code>'online'</code> と <code>'offline'</code> の イベントにイベントリスナーを追加します。 イベントハンドラーでは、<code>navigator.onLine</code> の結果に応じて <code>&#x3C;strong id='status'></code> 要素の内容を設定します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">updateOnlineStatus</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'status'</span>).innerHTML = navigator.onLine ? <span class=\"hljs-string\">'online'</span> : <span class=\"hljs-string\">'offline'</span>\n}\n\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'online'</span>, updateOnlineStatus)\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'offline'</span>, updateOnlineStatus)\n\nupdateOnlineStatus()\n</code></pre>\n<p>最後に、メインプロセス用の <code>main.js</code> ファイルを作成し、そこでウインドウを作成します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> onlineStatusWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">400</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">100</span>\n  })\n\n  onlineStatusWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n      createWindow()\n    }\n  })\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n</code></pre>\n<p>Electron アプリケーションを起動すると、以下のような通知が表示されるでしょう。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/connection-status.png\" alt=\"接続状態\"></p>\n<blockquote>\n<p>注意: メインプロセスに接続状態を伝える必要がある場合は、<a href=\"/docs/api/ipc-renderer\">IPC レンダラー</a> API を使用してください。</p>\n</blockquote>",
      "title": "オンライン/オフライン イベントの検出",
      "description": "注意: メインプロセスに接続状態を伝える必要がある場合は、IPC レンダラー API を使用してください。"
    },
    "/docs/development/patches": {
      "locale": "ja-JP",
      "slug": "patches",
      "href": "/docs/development/patches",
      "crowdinFileId": "256161",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/patches.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"electron-のパッチ\"><a href=\"#electron-のパッチ\">Electron のパッチ</a></h1>\n<p>Electron は、Chromium と Node.js という 2 つのメジャーな上流プロジェクトで構築されています。 これらのプロジェクトにも、それぞれ独自の依存関係がいくつかあります。 これらの依存関係をそのまま使用するように最善を尽くしていますが、ユースケースに合わせて上流の依存関係にパッチを適用しないと目標を達成できない場合があります。</p>\n<h2 id=\"パッチの正当性\"><a href=\"#パッチの正当性\">パッチの正当性</a></h2>\n<p>Electron でのパッチは、すべてメンテナンスの負担になります。 上流のコードが変更されると、パッチが壊れる―パッチの競合やコンパイルエラーが発生することがあります。 これはパッチセットを最新かつ効果的に保つための継続的な取り組みです。 そのため、パッチの数を最小限に抑えるよう努めています。 そのために、すべてのパッチには、コミットメッセージに存在する理由を記述する必要があります。 その理由は、以下のいずれかでなければなりません。</p>\n<ol>\n<li>パッチは一時的なものであり、上流にコミットされる (またはされている) か、最終的に削除されることを意図している。 上流の PR へのリンク、利用可能であればそのコードレビュー、後でパッチがまだ必要かどうかを確認する手順、これらのうちいずれかを含めている。</li>\n<li>このパッチによってコードが Electron 環境でコンパイルできようになるが、Electron 固有の処理 (たとえば、Chrome の <code>Profile</code> への参照のパッチを当てる) であるため上流にできない。 パッチなし (たとえば、サブクラス化またはコードのコピーによるもの) では変更を実装できない理由についての論述を含む。</li>\n<li>パッチは、基本的に上流と互換性のない機能に Electron 固有の変更を加えます。</li>\n</ol>\n<p>基本的に、私たちが作業するすべての上流プロジェクトは友好的な人々が携わっており、問題のコードが Electron と上流プロジェクトの両方と互換性を持つようにするリファクタリングを喜んで受け入れてくれます。 (たとえば、Chromium の <a href=\"https://chromium-review.googlesource.com/c/chromium/src/+/1637040\">この</a> 変更を挙げると、同じことを行ったパッチを削除しています。また、Node の <a href=\"https://github.com/nodejs/node/pull/22110\">この</a> 変更は、 Electron のバグ修正でもあります。) <strong>可能な限り上流の変更を目指し、無期限のパッチを避けるべきです。</strong></p>\n<h2 id=\"パッチシステム\"><a href=\"#パッチシステム\">パッチシステム</a></h2>\n<p>上流プロジェクトにパッチを適用することによってのみ行うことができる変更を行う必要がある、という不幸な立場にいる場合は、Electron でパッチを管理する方法を知る必要があります。</p>\n<p>Electron の上流プロジェクトへのすべてのパッチは、<code>patches/</code> ディレクトリに含まれています。 <code>patches/</code> の各サブディレクトリには、いくつかのパッチファイルと、パッチを適用する順序をリストした <code>.patches</code> ファイルが含まれています。 これらのファイルは、チェックアウト後に上流プロジェクト上に適用される一連の git コミットを構成していると考えてください。</p>\n<pre><code class=\"hljs language-plaintext\">patches\n├── config.json   &#x3C;-- これはどのパッチセットディレクトリがどのプロジェクトに適用されるかを記述しています\n├── chromium\n│   ├── .patches\n│   ├── accelerator.patch\n│   ├── add_contentgpuclient_precreatemessageloop_callback.patch\n│   ⋮\n├── node\n│   ├── .patches\n│   ├── add_openssl_is_boringssl_guard_to_oaep_hash_check.patch\n│   ├── build_add_gn_build_files.patch\n│   ⋮\n⋮\n</code></pre>\n<p>これらのパッチセットを管理しやすくするために、<code>git-import-patches</code> と <code>git-export-patches</code> の 2 つのツールを提供しています。 <code>git-import-patches</code> は、各パッチを正しい順序で適用し、各パッチのコミットを作成することにより、一連のパッチファイルを git リポジトリにインポートします。 <code>git-export-patches</code> は逆の処理を行います。 リポジトリ内の一連の git コミットを、ディレクトリ内の一連のファイルとそれに付随する <code>.patches</code> ファイルにエクスポートします。</p>\n<blockquote>\n<p>補足: パッチの順序に関連した競合を減らすために、各ファイルに <code>001-</code> のような番号を追加するのではなく、<code>.patches</code> ファイルを使用して適用されるパッチの順序を維持しています。 これにより、2 つの PR の両方が同じ番号である次の連番にパッチを追加し、両方がマージされて重複した識別子になるといった状況を防ぎます。 また、連番の間のパッチが追加または削除された場合の混乱も減ります。</p>\n</blockquote>\n<h3 id=\"使い方\"><a href=\"#使い方\">使い方</a></h3>\n<h4 id=\"新しいパッチの追加\"><a href=\"#新しいパッチの追加\">新しいパッチの追加</a></h4>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n$ vim some/code/file.cc\n$ git commit\n$ ../../electron/script/git-export-patches -o ../../electron/patches/node\n</code></pre>\n<blockquote>\n<p><strong>注</strong>: <code>git-export-patches</code> はコミットされていないファイルを無視するため、変更をエクスポートする場合はコミットを作成する必要があります。 パッチファイル名はコミットメッセージの件名に使用し、コミットメッセージの本文にパッチの存在理由を含める必要があります。</p>\n</blockquote>\n<p>パッチを再エクスポートすると、無関連なパッチの SHA サムが変更される場合があります。 これは一般に無害であり、無視することができます (ただし、これらの変更を PR に追加しても他の人には見えません)。</p>\n<h4 id=\"既存のパッチを編集する\"><a href=\"#既存のパッチを編集する\">既存のパッチを編集する</a></h4>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/v8\n$ vim some/code/file.cc\n$ git <span class=\"hljs-built_in\">log</span>\n<span class=\"hljs-comment\"># 編集するパッチのコミット SHA を見つけます。</span>\n$ git commit --fixup [COMMIT_SHA]\n$ git rebase --autosquash -i [COMMIT_SHA]^\n$ ../electron/script/git-export-patches -o ../electron/patches/v8\n</code></pre>\n<h4 id=\"パッチを削除する\"><a href=\"#パッチを削除する\">パッチを削除する</a></h4>\n<pre><code class=\"hljs language-bash\">$ vim src/electron/patches/node/.patches\n<span class=\"hljs-comment\"># 削除するパッチ名の行を削除します</span>\n$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n$ git reset --hard refs/patches/upstream-head\n$ ../../electron/script/git-import-patches ../../electron/patches/node\n$ ../../electron/script/git-export-patches -o ../../electron/patches/node\n</code></pre>\n<p>注意として、<code>git-import-patches</code> は <code>refs/patches/upstream-head</code> として実行されたときに <code>HEAD</code> だったコミットをマークします。 これにより、Electron パッチからのコミット (<code>refs/patches/upstream-head</code> の後にあるコミット) と上流にあるコミット (<code>refs/patches/upstream-head</code> の前にあるコミット) を追跡できます。</p>\n<h4 id=\"コンフリクトの解決\"><a href=\"#コンフリクトの解決\">コンフリクトの解決</a></h4>\n<p>上流の依存関係を更新するとき、パッチをきれいに適用できない場合があります。 多くの場合、3 ウェイマージを使用して git で競合を自動的に解決できます。 <code>-3</code> の引数を渡すことで、3 ウェイマージアルゴリズムを使用するように <code>git-import-patches</code> に指示できます。</p>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n<span class=\"hljs-comment\"># パッチの適用が途中で失敗した場合は、以下のようにしてリセットできます。</span>\n$ git am --abort\n<span class=\"hljs-comment\"># そして 3 ウェイマージで再試行します。</span>\n$ ../../electron/script/git-import-patches -3 ../../electron/patches/node\n</code></pre>\n<p><code>git-import-patches -3</code> が自動的に解決できないマージ競合を検出した場合、一時停止し、競合を手動で解決できます。 競合を解決したら、解決したファイルを <code>git add</code> し、<code>git am --continue</code> を実行して残りのパッチを適用し続けます。</p>",
      "title": "Electron のパッチ",
      "description": "補足: パッチの順序に関連した競合を減らすために、各ファイルに 001- のような番号を追加するのではなく、.patches ファイルを使用して適用されるパッチの順序を維持しています。 これにより、2 つの PR の両方が同じ番号である次の連番にパッチを追加し、両方がマージされて重複した識別子になるといった状況を防ぎます。 また、連番の間のパッチが追加または削除された場合の混乱も減ります。"
    },
    "/docs/tutorial/performance": {
      "locale": "ja-JP",
      "slug": "performance",
      "href": "/docs/tutorial/performance",
      "crowdinFileId": "256231",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/performance.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"パフォーマンス\"><a href=\"#パフォーマンス\">パフォーマンス</a></h1>\n<p>開発者は Electron アプリケーションのパフォーマンスを最適化するための戦略について頻繁に尋ねます。 ソフトウェアエンジニア、消費者、フレームワークの開発者は、常に \"パフォーマンス\" は何を意味するかという 1 つの定義には同意しません。 このドキュメントでは、使用しているメモリ、CPU、およびディスクリソースの量を削減し、アプリがユーザー入力に応答し、操作をできるだけ早く完了するようにする、Electron メンテナー御用達の方法のいくつかを概説します。 さらに、すべてのパフォーマンス戦略においてアプリは高いセキュリティ水準を維持する必要があります。</p>\n<p>JavaScript でパフォーマンスの高いウェブサイトを構築する方法に関する知恵と情報は、Electron アプリにも一般的に適用されます。 ある程度であれば、パフォーマンスの高い Node.js アプリケーションを構築する方法を述べたノウハウも適用されますが、Node.js バックエンドでの \"パフォーマンス\" という用語はクライアントで実行されるアプリケーションとは異なることを意味することに注意してください。</p>\n<p>このリストは利便性のために提供されており、<a href=\"/docs/tutorial/security\">セキュリティチェックリスト</a> とよく似ていますが、完全なものではありません。 以下に概説するすべての手順に従っても、遅い Electron アプリを構築してしまうかもしれません。 Electron は強力な開発プラットフォームであり、開発者であるあなたがやりたいことは多かれ少なかれ行うことができます。 その自由はパフォーマンスがほとんどあなたの責任であることを意味します。</p>\n<h2 id=\"計って、測って、図る\"><a href=\"#計って、測って、図る\">計って、測って、図る</a></h2>\n<p>以下のリストには、かなり簡単で実装しやすい手順がいくつか含まれています。 しかし、アプリを最もパフォーマンスの良いバージョンに構築するには、多くの手順を越える必要があります。 代わりに、慎重にプロファイリングして測定することでアプリで実行されているすべてのコードを詳しく調べる必要があります。 ボトルネックはどこ? いつユーザーがボタンをクリックして、どの処理が時間を浪費をしている? アプリがただアイドル状態の間、どのオブジェクトが最もメモリを食っている?</p>\n<p>幾度となく、パフォーマンスの高い Electron アプリを構築するための最も成功した戦略は、実行中のコードのプロファイルを作成し、その中で最もリソースを消費する部分を見つけ、最適化することであることがわかりました。 この一見面倒なプロセスを何度も繰り返すと、アプリのパフォーマンスは劇的に向上します。 Visual Studio Code や Slack などの主要なアプリで使用された経験から、この方法がパフォーマンスを向上させる最も信頼できる戦略であることが示されています。</p>\n<p>アプリのコードをプロファイリングする方法について知りたいのであれば、Chrome デベロッパーツールと仲良くなってください。 複数のプロセスを同時に見て高度に分析するには、<a href=\"https://www.chromium.org/developers/how-tos/trace-event-profiling-tool\">Chrome Trace</a> ツールをご検討ください。</p>\n<h3 id=\"推薦図書\"><a href=\"#推薦図書\">推薦図書</a></h3>\n<ul>\n<li><a href=\"https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/\">始めよう実行時パフォーマンス分析</a></li>\n<li><a href=\"https://www.youtube.com/watch?v=r0OeHRUCCb4\">談話: \"Visual Studio Code - 最初の一秒\"</a></li>\n</ul>\n<h2 id=\"チェックリスト\"><a href=\"#チェックリスト\">チェックリスト</a></h2>\n<p>これらの手順を実行すると、アプリが少しだけ無駄なく、高速になり、一般的にリソースの消費が少なくなる可能性があります。</p>\n<ol>\n<li><a href=\"#1-carelessly-including-modules\">迂闊なモジュール採用</a></li>\n<li><a href=\"#2-loading-and-running-code-too-soon\">あまりに早いコードのロードと実行</a></li>\n<li><a href=\"#3-blocking-the-main-process\">メインプロセスをブロックしている</a></li>\n<li><a href=\"#4-blocking-the-renderer-process\">レンダラープロセスをブロックしている</a></li>\n<li><a href=\"#5-unnecessary-polyfills\">不要な polyfill</a></li>\n<li><a href=\"#6-unnecessary-or-blocking-network-requests\">不要またはブロックしているネットワークリクエスト</a></li>\n<li><a href=\"#7-bundle-your-code\">コードをバンドルする</a></li>\n</ol>\n<h2 id=\"1-迂闊なモジュール採用\"><a href=\"#1-迂闊なモジュール採用\">1) 迂闊なモジュール採用</a></h2>\n<p>Node.js モジュールをアプリケーションに追加する前に、そのモジュールを調べましょう。 そのモジュールにはどれだけの依存関係が含まれているでしょうか。 どの種類のリソースが、単に <code>require()</code> 文で呼び出す必要があるでしょうか。 NPM パッケージレジストリでダウンロード数が最も多かったり GitHub で最もスターの数が多かったりするモジュールは、実際には利用可能なもののうち最もすっきりとした最小のものではない場合があります。</p>\n<h3 id=\"なぜ？\"><a href=\"#なぜ？\">なぜ？</a></h3>\n<p>この推奨事項の背後にある理由は、実例で最もよく説明されています。 Electron の初期の頃は、ネットワーク接続の信頼できる検出が問題でした。そのため、多くのアプリは簡易な <code>isOnline()</code> メソッドを公開しているモジュールを使用していました。</p>\n<p>そのモジュールは、多くの有名なエンドポイントに到達するかどうかでネットワーク接続を検出しました。 これらのエンドポイントのリストについては、既知のポートのリストも含まれる別のモジュールに依存していました。 この依存モジュール自身は、ポートに関する情報を含むモジュールに依存していました。これは、100,000 行を超える内容の JSON ファイルの形式で提供されていました。 モジュールがロードされるたびに (通常は <code>require('module')</code> 文で)、すべての依存関係をロードし、最終的にこの JSON ファイルを読み取って解析します。 数千行の JSON の解析は非常に重い操作です。 遅いマシンでは、全体で数秒かかる場合があります。</p>\n<p>多くのサーバーコンテキストでは、起動にかかる時間は実質的に無関係です。 すべてのポートに関する情報を必要とする Node.js サーバーは、サーバーが起動してリクエストをより高速に処理できるようになると、必要なすべての情報をメモリにロードするため実際に \"パフォーマンスが向上\" します。 この例で説明するモジュールは、\"悪質な\" モジュールではありません。 ただし、Electron アプリでは、実際に必要のない情報をメモリに読み込んで解析したり保存したりするべきではありません。</p>\n<p>要するに、主に Linux で実行する Node.js サーバー用に書かれた一見優れたモジュールは、アプリのパフォーマンスにとって悪いニュースかもしれません。 この特定の例での正しいソリューションは、モジュールはまったく使用せず、代わりに Chromium の後のバージョンに含まれる接続チェックを使用することでした。</p>\n<h3 id=\"どうすればいいの？\"><a href=\"#どうすればいいの？\">どうすればいいの？</a></h3>\n<p>モジュールを検討するときは、以下を確認することを推奨します。</p>\n<ol>\n<li>含まれる依存関係のサイズ</li>\n<li>ロード (<code>require()</code>) に必要なリソース</li>\n<li>関心のあるアクションを実行するために必要なリソース</li>\n</ol>\n<p>モジュールをロードするときの CPU プロファイルとヒープメモリプロファイルの生成は、コマンドライン上の 1 つのコマンドで実行できます。 以下の例では、人気のあるモジュール <code>request</code> を見ていきます。</p>\n<pre><code class=\"hljs language-sh\">node --cpu-prof --heap-prof -e <span class=\"hljs-string\">\"require('request')\"</span>\n</code></pre>\n<p>このコマンドを実行すると、実行したディレクトリに <code>.cpuprofile</code> ファイルと <code>.heapprofile</code> ファイルが作成されます。 両方のファイルは、Chrome デベロッパーツールを使用して、それぞれ <code>Performance</code> および <code>Memory</code> タブを使用して分析できます。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/performance-cpu-prof.png\" alt=\"パフォーマンスの CPU プロファイル\"></p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/performance-heap-prof.png\" alt=\"パフォーマンスのヒープメモリプロファイル\"></p>\n<p>この例では、著者のマシンで <code>request</code> のロードに約 0.5 秒かかったのに対し、<code>node-fetch</code> のメモリ消費は劇的に少なく、50ms 未満でした。</p>\n<h2 id=\"2-あまりに早いコードのロードと実行\"><a href=\"#2-あまりに早いコードのロードと実行\">2) あまりに早いコードのロードと実行</a></h2>\n<p>重いセットアップ操作がある場合は、それらを後回しすることを検討してください。 アプリケーションの起動直後に実行されているすべての作業を調べます。 すべての操作をすぐに実行するのではなく、ユーザーの行程により近い順序で操作をずらすことを検討してください。</p>\n<p>従来の Node.js 開発では、すべての <code>require()</code> ステートメントを先頭に配置する慣習がありました。 いま同じ戦略を使用 <em>しつつ</em> すぐ必要ではないサイズの大きいモジュールを使用している Electron アプリケーションを作成している場合、同じ戦略のうえで、より適切なタイミングで読み込むように後回しします。</p>\n<h3 id=\"なぜ？-1\"><a href=\"#なぜ？-1\">なぜ？</a></h3>\n<p>モジュールのロードは、特に Windows では驚くほど重い操作です。 アプリの起動時に、ユーザーに現在必要のない操作で待たせてはなりません。</p>\n<p>これは当たり前のように思えるかもしれませんが、多くのアプリケーションは、更新の確認、後のフローで使用されるコンテンツのダウンロード、重いディスク I/O 操作の実行など、アプリの起動直後に大量の作業を行う傾向があります。</p>\n<p>例として Visual Studio Code を考えてみましょう。 ファイルを開くと、コードを強調表示せずにすぐにファイルが表示され、テキストを操作する機能が優先されます。 その作業が完了すると、コードの強調表示に進みます。</p>\n<h3 id=\"どうすればいいの？-1\"><a href=\"#どうすればいいの？-1\">どうすればいいの？</a></h3>\n<p>例として、アプリケーションが架空の <code>.foo</code> 形式のファイルを解析していると仮定しましょう。 それをするためには、同様に架空の <code>foo-parser</code> モジュールに依存します。 従来の Node.js 開発では、依存関係を先にロードするコードを作成する場合があります。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> fooParser = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'foo-parser'</span>)\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">Parser</span> </span>{\n  <span class=\"hljs-keyword\">constructor</span> () {\n    <span class=\"hljs-keyword\">this</span>.files = fs.readdirSync(<span class=\"hljs-string\">'.'</span>)\n  }\n\n  getParsedFiles () {\n    <span class=\"hljs-keyword\">return</span> fooParser.parse(<span class=\"hljs-keyword\">this</span>.files)\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> parser = <span class=\"hljs-keyword\">new</span> Parser()\n\n<span class=\"hljs-built_in\">module</span>.exports = { parser }\n</code></pre>\n<p>上記の例では、ファイルがロードされるとすぐに多くの作業が実行されます。 解析されたファイルをすぐ取得する必要があるでしょうか。 <code>getParsedFiles()</code> が実際に呼び出されたときに、これを少し後で実行できるでしょうか。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// \"fs\" はすでにロードされている可能性が高いため、この `require()` 呼び出しは軽いです</span>\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">Parser</span> </span>{\n  <span class=\"hljs-keyword\">async</span> getFiles () {\n    <span class=\"hljs-comment\">// `getFiles` が呼ばれても、すぐにはディスクに触れません。</span>\n    <span class=\"hljs-comment\">// また、非同期バージョンを使用して</span>\n    <span class=\"hljs-comment\">// 他の操作をブロックしないことを保証します。</span>\n    <span class=\"hljs-keyword\">this</span>.files = <span class=\"hljs-keyword\">this</span>.files || <span class=\"hljs-keyword\">await</span> fs.readdir(<span class=\"hljs-string\">'.'</span>)\n\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-keyword\">this</span>.files\n  }\n\n  <span class=\"hljs-keyword\">async</span> getParsedFiles () {\n    <span class=\"hljs-comment\">// この架空の foo-parser は大きくて重いモジュールであり</span>\n    <span class=\"hljs-comment\">// 実際にファイルを解析する必要があるまで動作を後回しにします。</span>\n    <span class=\"hljs-comment\">// `require()` にはモジュールキャッシュが付属しているため、</span>\n    <span class=\"hljs-comment\">// この `require()` 呼び出しは 1 回だけ重く、</span>\n    <span class=\"hljs-comment\">// 後続の `getParsedFiles()` 呼び出しはより高速になります。</span>\n    <span class=\"hljs-keyword\">const</span> fooParser = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'foo-parser'</span>)\n    <span class=\"hljs-keyword\">const</span> files = <span class=\"hljs-keyword\">await</span> <span class=\"hljs-keyword\">this</span>.getFiles()\n\n    <span class=\"hljs-keyword\">return</span> fooParser.parse(files)\n  }\n}\n\n<span class=\"hljs-comment\">// この操作は、前の例よりもはるかに軽くなりました</span>\n<span class=\"hljs-keyword\">const</span> parser = <span class=\"hljs-keyword\">new</span> Parser()\n\n<span class=\"hljs-built_in\">module</span>.exports = { parser }\n</code></pre>\n<p>要するに、アプリの起動時にリソースをすべて割り当てるのではなく、\"その時に合わせて\" リソースを割り当てます。</p>\n<h2 id=\"3-メインプロセスをブロックしている\"><a href=\"#3-メインプロセスをブロックしている\">3) メインプロセスをブロックしている</a></h2>\n<p>Electron のメインプロセス (\"ブラウザプロセス\" と呼ばれることもあります) は特別です。これは、アプリの他のすべてのプロセスの親プロセスであり、オペレーティングシステムが相互作用する一次プロセスです。 ウィンドウ、インタラクション、アプリ内のさまざまなコンポーネント間の通信を処理します。 UI スレッドも保持します。</p>\n<p>どんな状況でも、このプロセスと UI スレッドを長い実行時間の操作でブロックしてはなりません。 UI スレッドをブロックすると、メインプロセスが処理を続行できる状態になるまで、アプリ全体がフリーズします。</p>\n<h3 id=\"なぜ？-2\"><a href=\"#なぜ？-2\">なぜ？</a></h3>\n<p>メインプロセスとその UI スレッドは、基本的にアプリ内の主要な操作の制御塔です。 オペレーティングシステムがマウスクリックについてアプリに通知すると、そのクリックはウィンドウに到達する前にメインプロセスを通過します。 ウィンドウがぬるぬるした滑らかなアニメーションをレンダリングしている場合、それについて GPU プロセスとやり取りする必要があって―もう一度メインプロセスを通過します。</p>\n<p>Electron と Chromium は、UI スレッドのブロックを回避するために、新しいスレッドに重いディスク I/O および CPU バウンド操作を配置するよう配慮します。 あなたもおなじようにしましょう。</p>\n<h3 id=\"どうすればいいの？-2\"><a href=\"#どうすればいいの？-2\">どうすればいいの？</a></h3>\n<p>Electron の強力なマルチプロセスアーキテクチャは、長時間実行するタスクを支援する準備ができていますが、少数のパフォーマンストラップも含まれています。</p>\n<p>1) 長時間実行される CPU 負荷の高いタスクについては、<a href=\"https://nodejs.org/api/worker_threads.html\">Worker Thread</a> を使用するか、それらを BrowserWindow に移動することを検討するか、(最後の手段として) 専用プロセスを生成します。</p>\n<p>2) 同期 IPC と <code>remote</code> モジュールの使用はできるだけ避けてください。 正しい使用方法もありますが、<code>remote</code> モジュールを使用して知らないうちに UI スレッドをブロックするのは非常に容易です。</p>\n<p>3) メインプロセスでブロックする I/O 操作の使用を避けてください。 要するに、コア Node.js モジュール (<code>fs</code> や <code>child_process</code> など) が同期バージョンと非同期バージョンを提供している場合は、常に非同期および非ブロッキングのものを選択するべきです。</p>\n<h2 id=\"4-レンダラープロセスをブロックしている\"><a href=\"#4-レンダラープロセスをブロックしている\">4) レンダラープロセスをブロックしている</a></h2>\n<p>Electron には Chrome の最新バージョンが同梱されているため、Web Platform が提供する最新で最良の機能を利用して、アプリをスムーズかつ応答性の良いように維持する手法で重い操作を後回しまたはオフロードできます。</p>\n<h3 id=\"なぜ？-3\"><a href=\"#なぜ？-3\">なぜ？</a></h3>\n<p>レンダラープロセスで実行する JavaScript が、アプリに多く含まれているのかもしれません。 その仕掛けは、60fps でユーザー入力、アニメーションへの対応、スムーズなスクロールを維持するために、必要なリソースを奪わずに可能な限り迅速に操作を実行することです。</p>\n<p>レンダラーのコードで操作の流れを調整することは、ユーザーがアプリの \"カクつき\" を時々訴える場合に特に役立ちます。</p>\n<h3 id=\"どうすればいいの？-3\"><a href=\"#どうすればいいの？-3\">どうすればいいの？</a></h3>\n<p>平たく言えば、最新のブラウザー用の高性能ウェブアプリを構築するためのすべてのアドバイスは、Electron のレンダリングにも適用されます。 現在、自由に使える 2 つの主要なツールがあります。小規模な操作用の <code>requestIdleCallback()</code> と、長時間実行する操作用の <code>Web Workers</code> です。</p>\n<p><em><code>requestIdleCallback()</code></em> により、開発者は、プロセスがアイドル期間に入るとすぐに実行される関数をキューに入れることができます。 これにより、ユーザーエクスペリエンスに影響を与えることなく、優先度の低い作業やバックグラウンド作業を実行できます。 使用方法の詳細については、<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\">MDNのドキュメントを参照してください</a>。</p>\n<p><em>Web Worker</em> は別のスレッドでコードを実行する強力なツールです。 考慮すべき注意点がいくつかあります。注意点については、Electron の <a href=\"/docs/tutorial/multithreading\">マルチスレッドドキュメント</a> および <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers\">Web Worker の MDN ドキュメント</a> を参照してください。 長時間にわたって大量の CPU パワーを必要とするあらゆる操作に理想的な解決法です。</p>\n<h2 id=\"5-不要な-polyfill\"><a href=\"#5-不要な-polyfill\">5) 不要な polyfill</a></h2>\n<p>Electron の大きな利点の1つは、JavaScript、HTML、CSS をどのエンジンが解析するかを正確に知っていることです。 ウェブ向けに書かれたコードを再利用する場合は、Electron に含まれている機能を polyfill しないようにしてください。</p>\n<h3 id=\"なぜ？-4\"><a href=\"#なぜ？-4\">なぜ？</a></h3>\n<p>今日のインターネット用のウェブアプリケーションを構築する場合、最も古い環境では、使用できる機能と使用できない機能が決まります。 Electron はパフォーマンスの良い CSS フィルターとアニメーションをサポートしていますが、古いブラウザはそうではないかもしれません。 WebGL を使用できる場合、古いスマートフォンをサポートするために、開発者はそのようなより多くのリソースを必要とする解決方法を選択していた可能性があります。</p>\n<p>JavaScript に関しては、DOM セレクターのためだけの jQuery や <code>regenerator-runtime</code> のような <code>async/await</code> をサポートするためだけの polyfill ツールキットライブラリを含めることができます。</p>\n<p>JavaScript ベースの polyfill が Electron の同等のネイティブ機能よりも高速になることはまれです。 標準ウェブプラットフォームの機能を自作して、Electron アプリの速度を落とさないでください。</p>\n<h3 id=\"どうすればいいの？-4\"><a href=\"#どうすればいいの？-4\">どうすればいいの？</a></h3>\n<p>Electron の現在のバージョンへの ployfill は不要であるという仮定の下で操作します。 疑問がある場合は、<a href=\"https://caniuse.com/\">caniuse.com</a> を確認し、<a href=\"/docs/api/process#processversionschrome-readonly\">利用している Electron のバージョンに対応した Chromium のバージョン</a> が必要な機能をサポートしているかどうかを確認してください。</p>\n<p>さらに、使用するライブラリを注意深く調べてください。 本当に必要なものでしょうか。 たとえば、<code>jQuery</code> は非常に成功したため、その機能の多くが <a href=\"http://youmightnotneedjquery.com/\">利用可能な標準 JavaScript 機能セット</a> の一部になりました。</p>\n<p>TypeScript などのトランスパイラー/コンパイラを使用している場合は、その構成を調べて、Electron でサポートされている最新の ECMAScript バージョンをターゲットにしていることを確認してください。</p>\n<h2 id=\"6-不要またはブロックしているネットワークリクエスト\"><a href=\"#6-不要またはブロックしているネットワークリクエスト\">6) 不要またはブロックしているネットワークリクエスト</a></h2>\n<p>めったに変更されないリソースをアプリケーションへ簡単にバンドルできる場合は、インターネットから取得しないでください。</p>\n<h3 id=\"なぜ？-5\"><a href=\"#なぜ？-5\">なぜ？</a></h3>\n<p>Electron の多くのユーザーは、デスクトップアプリケーションになりつつある完全にウェブベースのアプリから始めます。 ウェブ開発者として、さまざまなコンテンツ配信ネットワークからリソースをロードすることには慣れています。 今、あなたは適切なデスクトップアプリケーションを頒布しているのですから、可能な限り「ネットを切り捨てる」ようにして、決して変更されずアプリへ簡単に同梱できそうなリソースのためにユーザーを待たせないようにしましょう。</p>\n<p>Google Fonts は典型例です。 多くの開発者は、コンテンツ配信ネットワークに付属する Google の印象的な無料フォントのコレクションを利用しています。 行程は簡単です。CSS に数行を含めると、Google が残りを処理します。</p>\n<p>Electron アプリを作成するとき、フォントをダウンロードしてアプリのバンドルに含めると、ユーザーの体感が向上します。</p>\n<h3 id=\"どうすればいいの？-5\"><a href=\"#どうすればいいの？-5\">どうすればいいの？</a></h3>\n<p>理想的な世界では、アプリケーションが動作するためにはネットワークをまったく必要としません。 そこに到達するには、アプリが何をダウンロードしていてどのくらい大きいリソースなのかを理解する必要があります。</p>\n<p>そのためには、デベロッパーツールを開きます。 <code>Network</code> タブに移動し、<code>Disable cache</code> オプションにチェックを入れます。 そして、レンダラーをリロードします。 アプリでこのようなリロードが禁止されていない限り、通常、開発者ツールにフォーカスを置いて <code>Cmd + R</code> または <code>Ctrl + R</code> を押すと、リロードを発生させられます。</p>\n<p>これでこのツールはすべてのネットワーク要求を綿密に記録します。 最初のパスでは、ダウンロードされるすべてのリソースの在庫を確認し、最初に大きなファイルに注目します。 変更されず、バンドルに含めることができるような画像、フォント、メディアファイルはあるでしょうか。 もしあれば、同梱しましょう。</p>\n<p>次のステップとして、<code>Network Throttling</code> を有効にします。 現在 <code>Online</code> と表示されているドロップダウンを見つけて、<code>Fast 3G</code> などの低速なものを選択します。 レンダラーをリロードし、アプリが不必要に待機しているリソースがあるかどうかを確認します。 アプリは多くの場合、実際に関連するリソースを必要としないにもかかわらず、ネットワークリクエストが完了するのを待っています。</p>\n<p>豆知識として、アプリケーションの更新を公開するのではなくインターネットから変更したいリソースをロードすることも強力な戦略です。 リソースのロード方法を高度に制御するには、<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API\">Service Worker</a> への注力を検討してください。</p>\n<h2 id=\"7-コードをバンドルする\"><a href=\"#7-コードをバンドルする\">7) コードをバンドルする</a></h2>\n<p>\"<a href=\"#2-loading-and-running-code-too-soon\">あまりに早いコードのロードと実行</a>\" で既に指摘したように、<code>require()</code> の呼び出しはコストのかかる操作です。 可能であれば、アプリケーションのコードを単一のファイルにバンドルしましょう。</p>\n<h3 id=\"なぜ？-6\"><a href=\"#なぜ？-6\">なぜ？</a></h3>\n<p>最新の JavaScript 開発には通常、多くのファイルとモジュールが含まれます。 Electron での開発にはこれで十分ですが、アプリケーションをロードするときに <code>require()</code> の呼び出しに含まれるオーバーヘッドが一度だけ支払われるように、すべてのコードを1つのファイルにバンドルすることを強く推奨します。</p>\n<h3 id=\"どうすればいいの？-6\"><a href=\"#どうすればいいの？-6\">どうすればいいの？</a></h3>\n<p>多数の JavaScript バンドルが存在しますが、あるツールを別のツールよりも推奨してコミュニティを怒らせるよりも、良い方法が知られています。 ただし、Node.js 環境とブラウザ環境の両方を処理する必要がある Electron 独自の環境を処理できるバンドラーを使用することを推奨します。</p>\n<p>この記事を書いている時点での一般的な選択肢には、<a href=\"https://webpack.js.org/\">Webpack</a>、<a href=\"https://parceljs.org/\">Parcel</a>、および <a href=\"https://rollupjs.org/\">rollup.js</a> があります。</p>",
      "title": "パフォーマンス",
      "description": ""
    },
    "/docs/api/structures/point": {
      "locale": "ja-JP",
      "slug": "point",
      "href": "/docs/api/structures/point",
      "crowdinFileId": "256475",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/point.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"point-object\"><a href=\"#point-object\">Point Object</a></h1>\n<ul>\n<li><code>x</code> Number</li>\n<li><code>y</code> Number</li>\n</ul>\n<p><strong>Note:</strong> Both <code>x</code> and <code>y</code> must be whole integers, when providing a point object as input to an Electron API we will automatically round your <code>x</code> and <code>y</code> values to the nearest whole integer.</p>",
      "title": "Point Object",
      "description": ""
    },
    "/docs/api/structures/post-body": {
      "locale": "ja-JP",
      "slug": "post-body",
      "href": "/docs/api/structures/post-body",
      "crowdinFileId": "256477",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/post-body.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"postbody-object\"><a href=\"#postbody-object\">PostBody Object</a></h1>\n<ul>\n<li><code>data</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)[] - The post data to be sent to the new window.</li>\n<li><code>contentType</code> String - The <code>content-type</code> header used for the data. One of <code>application/x-www-form-urlencoded</code> or <code>multipart/form-data</code>. Corresponds to the <code>enctype</code> attribute of the submitted HTML form.</li>\n<li><code>boundary</code> String (optional) - The boundary used to separate multiple parts of the message. Only valid when <code>contentType</code> is <code>multipart/form-data</code>.</li>\n</ul>\n<p>Note that keys starting with <code>--</code> are not currently supported. For example, this will errantly submit as <code>multipart/form-data</code> when <code>nativeWindowOpen</code> is set to <code>false</code> in webPreferences:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">form</span>\n  <span class=\"hljs-attr\">target</span>=<span class=\"hljs-string\">\"_blank\"</span>\n  <span class=\"hljs-attr\">method</span>=<span class=\"hljs-string\">\"POST\"</span>\n  <span class=\"hljs-attr\">enctype</span>=<span class=\"hljs-string\">\"application/x-www-form-urlencoded\"</span>\n  <span class=\"hljs-attr\">action</span>=<span class=\"hljs-string\">\"https://postman-echo.com/post\"</span>\n></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">input</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text\"</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">\"--theKey\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">input</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"submit\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">form</span>></span>\n</code></pre>",
      "title": "PostBody Object",
      "description": ""
    },
    "/docs/api/power-monitor": {
      "locale": "ja-JP",
      "slug": "power-monitor",
      "href": "/docs/api/power-monitor",
      "crowdinFileId": "256351",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/power-monitor.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"powermonitor\"><a href=\"#powermonitor\">powerMonitor</a></h1>\n<blockquote>\n<p>電源の状態の変化をモニターします。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h2 id=\"イベント\"><a href=\"#イベント\">イベント</a></h2>\n<p><code>powerMonitor</code> モジュールでは以下のイベントが発生します。</p>\n<h3 id=\"イベント-suspend\"><a href=\"#イベント-suspend\">イベント: 'suspend'</a></h3>\n<p>システムがサスペンドするときに発生します。</p>\n<h3 id=\"イベント-resume\"><a href=\"#イベント-resume\">イベント: 'resume'</a></h3>\n<p>システムが再開するときに発生します。</p>\n<h3 id=\"イベント-on-ac-macos-windows\"><a href=\"#イベント-on-ac-macos-windows\">イベント: 'on-ac' <em>macOS</em> <em>Windows</em></a></h3>\n<p>システムが AC 電源に切り替わったときに発生します。</p>\n<h3 id=\"イベント-on-battery-macos--windows\"><a href=\"#イベント-on-battery-macos--windows\">イベント: 'on-battery' <em>macOS</em>  <em>Windows</em></a></h3>\n<p>システムがバッテリー電源に切り替わったときに発生します。</p>\n<h3 id=\"イベント-shutdown-linux-macos\"><a href=\"#イベント-shutdown-linux-macos\">イベント: 'shutdown' <em>Linux</em> <em>macOS</em></a></h3>\n<p>システムが再起動またはシャットダウンしようとしているときに発生します。 イベントハンドラが <code>e.preventDefault()</code> を呼び出した場合、Electron は正常にアプリを終了するためにシステムのシャットダウンの遅延を試みます。 <code>e.preventDefault()</code> が呼ばれた場合、出来る限り <code>app.quit()</code> のようなものを呼ぶのと同じようにアプリを終了します。</p>\n<h3 id=\"イベント-lock-screen-macos-windows\"><a href=\"#イベント-lock-screen-macos-windows\">イベント: 'lock-screen' <em>macOS</em> <em>Windows</em></a></h3>\n<p>システムがスクリーンをロックしようとしているときに発生します。</p>\n<h3 id=\"イベント-unlock-screen-macos-windows\"><a href=\"#イベント-unlock-screen-macos-windows\">イベント: 'unlock-screen' <em>macOS</em> <em>Windows</em></a></h3>\n<p>システムスクリーンがアンロックされたときに発行されます。</p>\n<h3 id=\"イベント-user-did-become-active-macos\"><a href=\"#イベント-user-did-become-active-macos\">イベント: 'user-did-become-active' <em>macOS</em></a></h3>\n<p>ログインセッションがアクティブになったときに発生します。 詳細は <a href=\"https://developer.apple.com/documentation/appkit/nsworkspacesessiondidbecomeactivenotification?language=objc\">ドキュメント</a> をご参照ください。</p>\n<h3 id=\"イベント-user-did-resign-active-macos\"><a href=\"#イベント-user-did-resign-active-macos\">イベント: 'user-did-resign-active' <em>macOS</em></a></h3>\n<p>ログインセッションが非アクティブになったときに発生します。 詳細は <a href=\"https://developer.apple.com/documentation/appkit/nsworkspacesessiondidresignactivenotification?language=objc\">ドキュメント</a> をご参照ください。</p>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>powerMonitor</code> モジュールには以下のメソッドがあります。</p>\n<h3 id=\"powermonitorgetsystemidlestateidlethreshold\"><a href=\"#powermonitorgetsystemidlestateidlethreshold\"><code>powerMonitor.getSystemIdleState(idleThreshold)</code></a></h3>\n<ul>\n<li><code>idleThreshold</code> Integer</li>\n</ul>\n<p>戻り値 <code>String</code> - 現在のシステムの状態。 <code>active</code> 、 <code>idle</code> 、 <code>locked</code> 、 <code>unknown</code> のいずれか。</p>\n<p>システムのアイドル状態を計算します。 <code>idleThreshold</code> は、アイドルとみなされるまでの時間 (秒) です。  <code>locked</code> はサポートされたシステムでのみ利用可能です。</p>\n<h3 id=\"powermonitorgetsystemidletime\"><a href=\"#powermonitorgetsystemidletime\"><code>powerMonitor.getSystemIdleTime()</code></a></h3>\n<p>戻り値 <code>Integer</code> - アイドル状態の秒数</p>\n<p>システムのアイドル時間を計算します。</p>\n<h3 id=\"powermonitorisonbatterypower\"><a href=\"#powermonitorisonbatterypower\"><code>powerMonitor.isOnBatteryPower()</code></a></h3>\n<p>戻り値 <code>Boolean</code> - システムがバッテリー電源状態かどうか。</p>\n<p>このプロパティの変更を監視するには、<code>on-battery</code> および <code>on-ac</code> イベントを使用します。</p>\n<h2 id=\"プロパティ\"><a href=\"#プロパティ\">プロパティ</a></h2>\n<h3 id=\"powermonitoronbatterypower\"><a href=\"#powermonitoronbatterypower\"><code>powerMonitor.onBatteryPower</code></a></h3>\n<p><code>Boolean</code> 型のプロパティです。 システムがバッテリー電源状態ならば true です。</p>\n<p><a href=\"#powermonitorisonbatterypower\"><code>powerMonitor.isOnBatteryPower()</code></a> をご参照ください。</p>",
      "title": "powerMonitor",
      "description": "電源の状態の変化をモニターします。"
    },
    "/docs/api/power-save-blocker": {
      "locale": "ja-JP",
      "slug": "power-save-blocker",
      "href": "/docs/api/power-save-blocker",
      "crowdinFileId": "256353",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/power-save-blocker.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"powersaveblocker\"><a href=\"#powersaveblocker\">powerSaveBlocker</a></h1>\n<blockquote>\n<p>システムが省電力 (スリープ) モードに入るのを防ぎます。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>以下がその例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { powerSaveBlocker } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> id = powerSaveBlocker.start(<span class=\"hljs-string\">'prevent-display-sleep'</span>)\n<span class=\"hljs-built_in\">console</span>.log(powerSaveBlocker.isStarted(id))\n\npowerSaveBlocker.stop(id)\n</code></pre>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>powerSaveBlocker</code> モジュールには以下のメソッドがあります。</p>\n<h3 id=\"powersaveblockerstarttype\"><a href=\"#powersaveblockerstarttype\"><code>powerSaveBlocker.start(type)</code></a></h3>\n<ul>\n<li><code>type</code> String - パワーセーブブロッカーの種類。<ul>\n<li><code>prevent-app-suspension</code> - アプリケーションが休止状態に入るのを防ぎます。 システムをアクティブに保ちますが、スクリーンは電源をオフにできます。 使用例: ファイルのダウンロードや音楽の再生。</li>\n<li><code>prevent-display-sleep</code> - ディスプレイがスリープ状態に入るのを防ぎます。 システムとスクリーンをアクティブに保ちます。 使用例: 映像の再生。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Integer</code> - この powerSaveBlocker に割り当てられたブロッカー ID.</p>\n<p>システムが低電力モードに入るのを防ぎます。 パワーセーブブロッカーを識別する整数を返します。</p>\n<p><strong>注釈:</strong> <code>prevent-display-sleep</code> は <code>prevent-app-suspension</code> よりも高い優先順位を持ちます。 最も高い優先順位のタイプのみが有効になります。 つまり、<code>prevent-display-sleep</code> は <code>prevent-app-suspension</code> よりも常に優先されます。</p>\n<p>たとえば、A が呼び出した API は <code>prevent-app-suspension</code> を要求し、もう1つの B の呼び出しは <code>prevent-display-sleep</code> を要求したとします。 B が要求を停止するまで、<code>prevent-display-sleep</code> が使用されます。 その後、<code>prevent-app-suspension</code> が使用されます。</p>\n<h3 id=\"powersaveblockerstopid\"><a href=\"#powersaveblockerstopid\"><code>powerSaveBlocker.stop(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer - <code>powerSaveBlocker.start</code> で返された powerSaveBlocker の ID。</li>\n</ul>\n<p>指定した powerSaveBlocker を停止します。</p>\n<h3 id=\"powersaveblockerisstartedid\"><a href=\"#powersaveblockerisstartedid\"><code>powerSaveBlocker.isStarted(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer - <code>powerSaveBlocker.start</code> で返された powerSaveBlocker の ID。</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - 対応する <code>powerSaveBlocker</code> が開始されているかどうか。</p>",
      "title": "powerSaveBlocker",
      "description": "システムが省電力 (スリープ) モードに入るのを防ぎます。"
    },
    "/docs/api/structures/printer-info": {
      "locale": "ja-JP",
      "slug": "printer-info",
      "href": "/docs/api/structures/printer-info",
      "crowdinFileId": "256479",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/printer-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"printerinfo-object\"><a href=\"#printerinfo-object\">PrinterInfo Object</a></h1>\n<ul>\n<li><code>name</code> String - the name of the printer as understood by the OS.</li>\n<li><code>displayName</code> String - the name of the printer as shown in Print Preview.</li>\n<li><code>description</code> String - a longer description of the printer's type.</li>\n<li><code>status</code> Number - the current status of the printer.</li>\n<li><code>isDefault</code> Boolean - whether or not a given printer is set as the default printer on the OS.</li>\n<li><code>options</code> Object - an object containing a variable number of platform-specific printer information.</li>\n</ul>\n<p>The number represented by <code>status</code> means different things on different platforms: on Windows its potential values can be found <a href=\"https://docs.microsoft.com/en-us/windows/win32/printdocs/printer-info-2\">here</a>, and on Linux and macOS they can be found <a href=\"https://www.cups.org/doc/cupspm.html\">here</a>.</p>\n<h2 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h2>\n<p>Below is an example of some of the additional options that may be set which may be different on each platform.</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Austin_4th_Floor_Printer___C02XK13BJHD4'</span>,\n  <span class=\"hljs-attr\">displayName</span>: <span class=\"hljs-string\">'Austin 4th Floor Printer @ C02XK13BJHD4'</span>,\n  <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'TOSHIBA ColorMFP'</span>,\n  <span class=\"hljs-attr\">status</span>: <span class=\"hljs-number\">3</span>,\n  <span class=\"hljs-attr\">isDefault</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">options</span>: {\n    <span class=\"hljs-attr\">copies</span>: <span class=\"hljs-string\">'1'</span>,\n    <span class=\"hljs-string\">'device-uri'</span>: <span class=\"hljs-string\">'dnssd://Austin%204th%20Floor%20Printer%20%40%20C02XK13BJHD4._ipps._tcp.local./?uuid=71687f1e-1147-3274-6674-22de61b110bd'</span>,\n    <span class=\"hljs-attr\">finishings</span>: <span class=\"hljs-string\">'3'</span>,\n    <span class=\"hljs-string\">'job-cancel-after'</span>: <span class=\"hljs-string\">'10800'</span>,\n    <span class=\"hljs-string\">'job-hold-until'</span>: <span class=\"hljs-string\">'no-hold'</span>,\n    <span class=\"hljs-string\">'job-priority'</span>: <span class=\"hljs-string\">'50'</span>,\n    <span class=\"hljs-string\">'job-sheets'</span>: <span class=\"hljs-string\">'none,none'</span>,\n    <span class=\"hljs-string\">'marker-change-time'</span>: <span class=\"hljs-string\">'0'</span>,\n    <span class=\"hljs-string\">'number-up'</span>: <span class=\"hljs-string\">'1'</span>,\n    <span class=\"hljs-string\">'printer-commands'</span>: <span class=\"hljs-string\">'ReportLevels,PrintSelfTestPage,com.toshiba.ColourProfiles.update,com.toshiba.EFiling.update,com.toshiba.EFiling.checkPassword'</span>,\n    <span class=\"hljs-string\">'printer-info'</span>: <span class=\"hljs-string\">'Austin 4th Floor Printer @ C02XK13BJHD4'</span>,\n    <span class=\"hljs-string\">'printer-is-accepting-jobs'</span>: <span class=\"hljs-string\">'true'</span>,\n    <span class=\"hljs-string\">'printer-is-shared'</span>: <span class=\"hljs-string\">'false'</span>,\n    <span class=\"hljs-string\">'printer-is-temporary'</span>: <span class=\"hljs-string\">'false'</span>,\n    <span class=\"hljs-string\">'printer-location'</span>: <span class=\"hljs-string\">''</span>,\n    <span class=\"hljs-string\">'printer-make-and-model'</span>: <span class=\"hljs-string\">'TOSHIBA ColorMFP'</span>,\n    <span class=\"hljs-string\">'printer-state'</span>: <span class=\"hljs-string\">'3'</span>,\n    <span class=\"hljs-string\">'printer-state-change-time'</span>: <span class=\"hljs-string\">'1573472937'</span>,\n    <span class=\"hljs-string\">'printer-state-reasons'</span>: <span class=\"hljs-string\">'offline-report,com.toshiba.snmp.failed'</span>,\n    <span class=\"hljs-string\">'printer-type'</span>: <span class=\"hljs-string\">'10531038'</span>,\n    <span class=\"hljs-string\">'printer-uri-supported'</span>: <span class=\"hljs-string\">'ipp://localhost/printers/Austin_4th_Floor_Printer___C02XK13BJHD4'</span>,\n    <span class=\"hljs-attr\">system_driverinfo</span>: <span class=\"hljs-string\">'T'</span>\n  }\n}\n</code></pre>",
      "title": "PrinterInfo Object",
      "description": ""
    },
    "/docs/api/process": {
      "locale": "ja-JP",
      "slug": "process",
      "href": "/docs/api/process",
      "crowdinFileId": "256355",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/process.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"プロセス\"><a href=\"#プロセス\">プロセス</a></h1>\n<blockquote>\n<p>process オブジェクトの拡張です。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a>, <a href=\"/docs/glossary#renderer-process\">レンダラー</a></p>\n<p>Electron の <code>process</code> オブジェクトは、<a href=\"https://nodejs.org/api/process.html\">Node.js <code>process</code> object</a> から拡張されています。 以下のイベント、プロパティ、メソッドが追加されます。</p>\n<h2 id=\"サンドボックス\"><a href=\"#サンドボックス\">サンドボックス</a></h2>\n<p>サンドボックス化されたレンダラーでは、<code>process</code> オブジェクトには以下に示す一部の API のみが含まれます。</p>\n<ul>\n<li><code>crash()</code></li>\n<li><code>hang()</code></li>\n<li><code>getCreationTime()</code></li>\n<li><code>getHeapStatistics()</code></li>\n<li><code>getBlinkMemoryInfo()</code></li>\n<li><code>getProcessMemoryInfo()</code></li>\n<li><code>getSystemMemoryInfo()</code></li>\n<li><code>getSystemVersion()</code></li>\n<li><code>getCPUUsage()</code></li>\n<li><code>getIOCounters()</code></li>\n<li><code>uptime()</code></li>\n<li><code>argv</code></li>\n<li><code>execPath</code></li>\n<li><code>env</code></li>\n<li><code>pid</code></li>\n<li><code>arch</code></li>\n<li><code>platform</code></li>\n<li><code>sandboxed</code></li>\n<li><code>contextIsolated</code></li>\n<li><code>type</code></li>\n<li><code>version</code></li>\n<li><code>versions</code></li>\n<li><code>mas</code></li>\n<li><code>windowsStore</code></li>\n<li><code>contextId</code></li>\n</ul>\n<h2 id=\"イベント\"><a href=\"#イベント\">イベント</a></h2>\n<h3 id=\"イベント-loaded\"><a href=\"#イベント-loaded\">イベント: 'loaded'</a></h3>\n<p>Electron が内部初期化スクリプトをロードし、ウェブページまたはメインスクリプトのロードを開始したときに発生します。</p>\n<h2 id=\"プロパティ\"><a href=\"#プロパティ\">プロパティ</a></h2>\n<h3 id=\"processdefaultapp-読み出し専用\"><a href=\"#processdefaultapp-読み出し専用\"><code>process.defaultApp</code> <em>読み出し専用</em></a></h3>\n<p><code>Boolean</code>。 デフォルトアプリに、引数として渡されてアプリが起動されると、このプロパティはメインプロセス内で <code>true</code> になります。それ以外では <code>undefined</code> です。</p>\n<h3 id=\"processismainframe-読み出し専用\"><a href=\"#processismainframe-読み出し専用\"><code>process.isMainFrame</code> <em>読み出し専用</em></a></h3>\n<p><code>Boolean</code>で、現在のレンダラーコンテキストが\"main\"レンダラー フレームの場合<code>true</code>。 現在のフレームの ID が必要な場合、<code>webFrame.routingId</code> を使用すべきです。</p>\n<h3 id=\"processmas-読み出し専用\"><a href=\"#processmas-読み出し専用\"><code>process.mas</code> <em>読み出し専用</em></a></h3>\n<p><code>Boolean</code>。 Mac App Store ビルドの場合、このプロパティは <code>true</code>、他のビルドでは <code>undefined</code> です。</p>\n<h3 id=\"processnoasar\"><a href=\"#processnoasar\"><code>process.noAsar</code></a></h3>\n<p>アプリケーション内の ASAR サポートを制御する <code>Boolean</code> 。 これを<code>true</code>に設定した場合、Nodeのビルトインモジュールの<code>asar</code>アーカイブのサポートが無効になります。</p>\n<h3 id=\"processnodeprecation\"><a href=\"#processnodeprecation\"><code>process.noDeprecation</code></a></h3>\n<p>非推奨の警告が <code>stderr</code> へ出力されるかどうかを制御する <code>Boolean</code>。 これを <code>true</code> に設定すると非推奨の警告が無効になります。 <code>--no-deprecation</code> コマンドラインフラグの代わりにこのプロパティを使用します。</p>\n<h3 id=\"processresourcespath-読み出し専用\"><a href=\"#processresourcespath-読み出し専用\"><code>process.resourcesPath</code> <em>読み出し専用</em></a></h3>\n<p>リソースディレクトリのパスを表す <code>String</code>。</p>\n<h3 id=\"processsandboxed-読み出し専用\"><a href=\"#processsandboxed-読み出し専用\"><code>process.sandboxed</code> <em>読み出し専用</em></a></h3>\n<p><code>Boolean</code>。 レンダラープロセスがサンドボックス化されている場合、このプロパティは <code>true</code> です。それ以外の場合は <code>undefined</code> です。</p>\n<h3 id=\"processcontextisolated-読み出し専用\"><a href=\"#processcontextisolated-読み出し専用\"><code>process.contextIsolated</code> <em>読み出し専用</em></a></h3>\n<p><code>Boolean</code> 型で、現在のレンダラーコンテキストで <code>contextIsolation</code> が有効かどうかを示します。 これはメインプロセスでは <code>undefined</code> です。</p>\n<h3 id=\"processthrowdeprecation\"><a href=\"#processthrowdeprecation\"><code>process.throwDeprecation</code></a></h3>\n<p>非推奨の警告が例外としてスローされるかどうかを制御する <code>Boolean</code>。 これを <code>true</code> に設定すると非推奨のエラーがスローされます。 <code>--throw-deprecation</code> コマンドラインフラグの代わりにこのプロパティを使用します。</p>\n<h3 id=\"processtracedeprecation\"><a href=\"#processtracedeprecation\"><code>process.traceDeprecation</code></a></h3>\n<p><code>stderr</code> に出力される非推奨にスタックトレースを含めるかどうかを制御する <code>Boolean</code>。 これを <code>true</code> に設定すると非推奨のスタックトレースが出力されます。 <code>--trace-deprecation</code> コマンドラインフラグの代わりにこのプロパティを使用します。</p>\n<h3 id=\"processtraceprocesswarnings\"><a href=\"#processtraceprocesswarnings\"><code>process.traceProcessWarnings</code></a></h3>\n<p><code>stderr</code> に出力されるプロセスの警告にスタックトレースを含めるかどうかを制御する <code>Boolean</code>。 これを <code>true</code> に設定するとプロセスの (非推奨を含む) 警告のスタックトレースが出力されます。 <code>--trace-warnings</code> コマンドラインフラグの代わりにこのプロパティを使用します。</p>\n<h3 id=\"processtype-読み出し専用\"><a href=\"#processtype-読み出し専用\"><code>process.type</code> <em>読み出し専用</em></a></h3>\n<p>現在のプロセスの種別を表す以下の <code>String</code> のいずれかになります。</p>\n<ul>\n<li><code>browser</code> - メインプロセス</li>\n<li><code>renderer</code> - レンダラープロセス</li>\n<li><code>worker</code> - ウェブワーカー</li>\n</ul>\n<h3 id=\"processversionschrome-読み出し専用\"><a href=\"#processversionschrome-読み出し専用\"><code>process.versions.chrome</code> <em>読み出し専用</em></a></h3>\n<p>Chrome のバージョン文字列を表す <code>String</code>。</p>\n<h3 id=\"processversionselectron-読み出し専用\"><a href=\"#processversionselectron-読み出し専用\"><code>process.versions.electron</code> <em>読み出し専用</em></a></h3>\n<p>Electron のバージョン文字列を表す <code>String</code>。</p>\n<h3 id=\"processwindowsstore-読み出し専用\"><a href=\"#processwindowsstore-読み出し専用\"><code>process.windowsStore</code> <em>読み出し専用</em></a></h3>\n<p><code>Boolean</code>。 アプリが Windows Store アプリ (appx) として実行されている場合、このプロパティは <code>true</code> です。それ以外の場合は <code>undefined</code> です。</p>\n<h3 id=\"processcontextid-読み出し専用\"><a href=\"#processcontextid-読み出し専用\"><code>process.contextId</code> <em>読み出し専用</em></a></h3>\n<p><code>String</code> 型 (任意) で、現在の JavaScript コンテキストにおけるグローバルな一意の ID を表します。 各フレームにはそれぞれ JavaScript コンテキストがあります。 contextIsolation が有効な場合、隔離ワールドにも個別の JavaScript コンテキストがあります。 このプロパティはレンダラープロセスでのみ利用可能です。</p>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>process</code> オブジェクトには以下のメソッドがあります。</p>\n<h3 id=\"processcrash\"><a href=\"#processcrash\"><code>process.crash()</code></a></h3>\n<p>現在のプロセスのメインスレッドでクラッシュを発生させます。</p>\n<h3 id=\"processgetcreationtime\"><a href=\"#processgetcreationtime\"><code>process.getCreationTime()</code></a></h3>\n<p>戻り値 <code>Number | null</code> - 発生からのミリ秒数です。情報が利用できない場合は <code>null</code> を返します。</p>\n<p>アプリケーションの作成時間を示します。 時間はエポックからのミリ秒数として表されます。 プロセスの作成時間を取得できない場合は null を返します。</p>\n<h3 id=\"processgetcpuusage\"><a href=\"#processgetcpuusage\"><code>process.getCPUUsage()</code></a></h3>\n<p>戻り値 <a href=\"/docs/api/structures/cpu-usage\"><code>CPUUsage</code></a></p>\n<h3 id=\"processgetiocounters-windows-linux\"><a href=\"#processgetiocounters-windows-linux\"><code>process.getIOCounters()</code> <em>Windows</em> <em>Linux</em></a></h3>\n<p>戻り値 <a href=\"/docs/api/structures/io-counters\"><code>IOCounters</code></a></p>\n<h3 id=\"processgetheapstatistics\"><a href=\"#processgetheapstatistics\"><code>process.getHeapStatistics()</code></a></h3>\n<p>戻り値 <code>Object</code>:</p>\n<ul>\n<li><code>totalHeapSize</code> Integer</li>\n<li><code>totalHeapSizeExecutable</code> Integer</li>\n<li><code>totalPhysicalSize</code> Integer</li>\n<li><code>totalAvailableSize</code> Integer</li>\n<li><code>usedHeapSize</code> Integer</li>\n<li><code>heapSizeLimit</code> Integer</li>\n<li><code>mallocedMemory</code> Integer</li>\n<li><code>peakMallocedMemory</code> Integer</li>\n<li><code>doesZapGarbage</code> Boolean</li>\n</ul>\n<p>V8ヒープの統計を持つオブジェクトを返します。 すべての統計情報はキロバイト単位で返ってくることに注意してください。</p>\n<h3 id=\"processgetblinkmemoryinfo\"><a href=\"#processgetblinkmemoryinfo\"><code>process.getBlinkMemoryInfo()</code></a></h3>\n<p>戻り値 <code>Object</code>:</p>\n<ul>\n<li><code>allocated</code> Integer - キロバイト単位でのすべての確保されたオブジェクトのサイズ。</li>\n<li><code>marked</code> Integer - キロバイト単位でのマークされたすべてのオブジェクトのサイズ。</li>\n<li><code>total</code> Integer - キロバイト単位での確保された空間の合計。</li>\n</ul>\n<p>Blink のメモリ情報を持つオブジェクトを返します。 レンダリング/DOM 関連のメモリ問題のデバッグに役立ちます。 すべての数値はキロバイト単位で返ってくることに注意してください。</p>\n<h3 id=\"processgetprocessmemoryinfo\"><a href=\"#processgetprocessmemoryinfo\"><code>process.getProcessMemoryInfo()</code></a></h3>\n<p>戻り値 <code>Promise&#x3C;ProcessMemoryInfo></code> - <a href=\"/docs/api/structures/process-memory-info\">ProcessMemoryInfo</a> で実行されます</p>\n<p>現在のプロセスについてのメモリ使用量の統計情報を与えるオブジェクトを返します。 すべての統計情報はキロバイト単位で返ってくることに注意してください。 このAPIはアプリの準備ができた後に呼び出されるべきです。</p>\n<p>Chromium は macOS には <code>residentSet</code> の値を提供しません。 これは直近の使用されていないページを macOS がメモリ内で圧縮するためです。 結果として、residentSet の値は期待されるものではありません。 <code>private</code> メモリは、macOS でのプロセスの実際の圧縮前のメモリ使用量をよりよく表しています。</p>\n<h3 id=\"processgetsystemmemoryinfo\"><a href=\"#processgetsystemmemoryinfo\"><code>process.getSystemMemoryInfo()</code></a></h3>\n<p>戻り値 <code>Object</code>:</p>\n<ul>\n<li><code>total</code> Integer - システムで利用可能な物理メモリの合計量 (キロバイト)。</li>\n<li><code>free</code> Integer - アプリケーションまたはディスクキャッシュで使用されていないメモリの合計量。</li>\n<li><code>swapTotal</code> Integer <em>Windows</em> <em>Linux</em> - システムが使用できるスワップメモリの合計量 (キロバイト) 。</li>\n<li><code>swapFree</code> Integer <em>Windows</em> <em>Linux</em> - システムが使用できるスワップメモリの空き容量 (キロバイト)。</li>\n</ul>\n<p>システム全体についてのメモリ使用量の統計情報を与えるオブジェクトを返します。 すべての統計情報はキロバイト単位で返ってくることに注意してください。</p>\n<h3 id=\"processgetsystemversion\"><a href=\"#processgetsystemversion\"><code>process.getSystemVersion()</code></a></h3>\n<p>戻り値 <code>String</code> - ホストのオペレーティングシステムのバージョン。</p>\n<p>サンプル:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> version = process.getSystemVersion()\n<span class=\"hljs-built_in\">console</span>.log(version)\n<span class=\"hljs-comment\">// macOS -> '10.13.6'</span>\n<span class=\"hljs-comment\">// Windows -> '10.0.17763'</span>\n<span class=\"hljs-comment\">// Linux -> '4.15.0-45-generic'</span>\n</code></pre>\n<p><strong>注釈:</strong> <code>os.release()</code> とは異なり、macOS ではカーネルバージョンではなく実際のオペレーティングシステムのバージョンを返します。</p>\n<h3 id=\"processtakeheapsnapshotfilepath\"><a href=\"#processtakeheapsnapshotfilepath\"><code>process.takeHeapSnapshot(filePath)</code></a></h3>\n<ul>\n<li><code>filePath</code> String - 出力ファイルのパス</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - スナップショットの作成が成功したかどうかを示します。</p>\n<p>V8 ヒープのスナップショットを撮り、それを <code>filePath</code> に保存します。</p>\n<h3 id=\"processhang\"><a href=\"#processhang\"><code>process.hang()</code></a></h3>\n<p>現在のプロセスのメインスレッドでハングを発生させます。</p>\n<h3 id=\"processsetfdlimitmaxdescriptors-macos-linux\"><a href=\"#processsetfdlimitmaxdescriptors-macos-linux\"><code>process.setFdLimit(maxDescriptors)</code> <em>macOS</em> <em>Linux</em></a></h3>\n<ul>\n<li><code>maxDescriptors</code> Integer</li>\n</ul>\n<p>ファイルディスクリプタのソフトリミットを、<code>maxDescriptors</code> または OS のハードリミットの、いずれか低い方に設定します。</p>",
      "title": "プロセス",
      "description": "process オブジェクトの拡張です。"
    },
    "/docs/api/structures/process-memory-info": {
      "locale": "ja-JP",
      "slug": "process-memory-info",
      "href": "/docs/api/structures/process-memory-info",
      "crowdinFileId": "256481",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/process-memory-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"processmemoryinfo-object\"><a href=\"#processmemoryinfo-object\">ProcessMemoryInfo Object</a></h1>\n<ul>\n<li><code>residentSet</code> Integer <em>Linux</em> <em>Windows</em> - The amount of memory currently pinned to actual physical RAM in Kilobytes.</li>\n<li><code>private</code> Integer - The amount of memory not shared by other processes, such as JS heap or HTML content in Kilobytes.</li>\n<li><code>shared</code> Integer - The amount of memory shared between processes, typically memory consumed by the Electron code itself in Kilobytes.</li>\n</ul>",
      "title": "ProcessMemoryInfo Object",
      "description": ""
    },
    "/docs/api/structures/process-metric": {
      "locale": "ja-JP",
      "slug": "process-metric",
      "href": "/docs/api/structures/process-metric",
      "crowdinFileId": "256483",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/process-metric.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"processmetric-object\"><a href=\"#processmetric-object\">ProcessMetric Object</a></h1>\n<ul>\n<li><code>pid</code> Integer - Process id of the process.</li>\n<li><code>type</code> String - プロセスの種別。 以下の値のいずれかです。<ul>\n<li><code>Browser</code></li>\n<li><code>Tab</code></li>\n<li><code>Utility</code></li>\n<li><code>Zygote</code></li>\n<li><code>Sandbox helper</code></li>\n<li><code>GPU</code></li>\n<li><code>Pepper Plugin</code></li>\n<li><code>Pepper Plugin Broker</code></li>\n<li><code>Unknown</code></li>\n</ul></li>\n<li><code>serviceName</code> String (任意) - そのプロセスのローカライズされていない名前。</li>\n<li><code>name</code> String (任意) - そのプロセスの名前。 ユーティリティの例: <code>Audio Service</code>, <code>Content Decryption Module Service</code>, <code>Network Service</code>, <code>Video Capture</code>など</li>\n<li><code>cpu</code> <a href=\"/docs/api/structures/cpu-usage\">CPUUsage</a> - CPU usage of the process.</li>\n<li><code>creationTime</code> Number - Creation time for this process. The time is represented as number of milliseconds since epoch. Since the <code>pid</code> can be reused after a process dies, it is useful to use both the <code>pid</code> and the <code>creationTime</code> to uniquely identify a process.</li>\n<li><code>memory</code> <a href=\"/docs/api/structures/memory-info\">MemoryInfo</a> - Memory information for the process.</li>\n<li><code>sandboxed</code> Boolean (optional) <em>macOS</em> <em>Windows</em> - Whether the process is sandboxed on OS level.</li>\n<li><code>integrityLevel</code> String (optional) <em>Windows</em> - One of the following values:<ul>\n<li><code>untrusted</code></li>\n<li><code>low</code></li>\n<li><code>medium</code></li>\n<li><code>high</code></li>\n<li><code>unknown</code></li>\n</ul></li>\n</ul>",
      "title": "ProcessMetric Object",
      "description": ""
    },
    "/docs/tutorial/process-model": {
      "locale": "ja-JP",
      "slug": "process-model",
      "href": "/docs/tutorial/process-model",
      "crowdinFileId": "256233",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/process-model.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"プロセスモデル\"><a href=\"#プロセスモデル\">プロセスモデル</a></h1>\n<p>Electron は Chromium のマルチプロセスアーキテクチャを継承しており、フレームワークのアーキテクチャは最新のウェブブラウザに酷似しています。 このガイドでは、最小限の <a href=\"/docs/tutorial/quick-start\">クイックスタートアプリ</a> で適用した、Electron の概念的な知識を解説します。</p>\n<h2 id=\"なぜシングルプロセスではないのでしょうか\"><a href=\"#なぜシングルプロセスではないのでしょうか\">なぜシングルプロセスではないのでしょうか?</a></h2>\n<p>ウェブブラウザは非常に複雑なアプリケーションです。 ウェブコンテンツを表示するという主な機能のほかに、複数のウィンドウ (またはタブ) を管理したり、サードパーティの拡張機能を読み込んだりするなど、多くの副次的な役割を担っています。</p>\n<p>以前のブラウザでは、これらの機能を単一のプロセスで実現していました。 このやり方は開いているタブごとのオーバーヘッドを減らしますが、1 つのウェブサイトがクラッシュしたりハングアップしたりすると、ブラウザ全体に影響が及びます。</p>\n<h2 id=\"マルチプロセスモデル\"><a href=\"#マルチプロセスモデル\">マルチプロセスモデル</a></h2>\n<p>この問題を解決するため、Chrome チームは各タブがそれぞれのプロセスで描画するようにすると決め、ウェブページ上のバグや悪意のあるコードがアプリ全体に与える影響を制限することにしました。 単一のブラウザプロセスはこれらのプロセスを制御し、アプリケーションのライフサイクル全体を制御します。 このモデルを視覚化したのが、<a href=\"https://www.google.com/googlebooks/chrome/\">Chrome 漫画本</a> の以下の図です。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/chrome-processes.png\" alt=\"Chrome のマルチプロセスアーキテクチャ\"></p>\n<p>Electron アプリケーションも非常によく似た構造をしています。 Electron アプリ開発者の場合、メインとレンダラーの 2 種類のプロセスを制御します。 これらは、上述の Chrome 独自のブラウザプロセスとレンダラープロセスと似ています。</p>\n<h2 id=\"メインプロセス\"><a href=\"#メインプロセス\">メインプロセス</a></h2>\n<p>各 Electron アプリにつき一つのメインプロセスがあります。これはアプリケーションのエントリポイントとして機能します。 メインプロセスは Node.js 環境で動作します。つまり、モジュールを <code>require</code> したり Node.js のすべての API を利用したりできます。</p>\n<h3 id=\"ウインドウの管理\"><a href=\"#ウインドウの管理\">ウインドウの管理</a></h3>\n<p>メインプロセスの主な目的は、<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> モジュールを使ってアプリケーションウインドウを作成し管理することです。</p>\n<p><code>BrowserWindow</code> クラスの各インスタンスは、アプリケーションウインドウを作成し、その分かれたレンダラープロセス内でウェブページを読み込みます。 メインプロセスからは、ウインドウの <a href=\"/docs/api/web-contents\"><code>webContents</code></a> オブジェクトでこのウェブコンテンツを操作できます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> contents = win.webContents\n<span class=\"hljs-built_in\">console</span>.log(contents)\n</code></pre>\n<blockquote>\n<p>注意: <code>BrowserView</code> モジュールなどの <a href=\"/docs/tutorial/web-embeds\">ウェブ埋め込み</a> 用のレンダラープロセスが作成されることもあります。 <code>webContents</code> オブジェクトは、埋め込みウェブコンテンツにもアクセスできます。</p>\n</blockquote>\n<p><code>BrowserWindow</code> モジュールは <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\"><code>EventEmitter</code></a> を継承しているため、様々なユーザーイベント (例えば、ウインドウの最小化や最大化) ハンドラの追加もできます。</p>\n<p><code>BrowserWindow</code> インスタンスが破棄されると、対応するレンダラープロセスも終了します。</p>\n<h3 id=\"アプリケーションのライフサイクル\"><a href=\"#アプリケーションのライフサイクル\">アプリケーションのライフサイクル</a></h3>\n<p>メインプロセスは、Electron の <a href=\"/docs/api/app\"><code>app</code></a> モジュールを介してアプリケーションのライフサイクルも制御します。 このモジュールには、アプリケーションの動作をカスタマイズするためのイベントやメソッドが多数用意されています (例えば、プログラム側でアプリケーションを終了したり、アプリケーションの Dock を変更したり、アプリについてのパネルを表示したりできます)。</p>\n<p>実例として、<a href=\"/docs/tutorial/quick-start#manage-your-windows-lifecycle\">クイックスタートガイド</a> で紹介されているアプリでは <code>app</code> の API でよりネイティブなアプリケーションウインドウの体験を実現しています。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 非 macOS プラットフォームでウインドウが開かれていない時にアプリを終了する</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h3 id=\"ネイテイブ-api\"><a href=\"#ネイテイブ-api\">ネイテイブ API</a></h3>\n<p>ウェブコンテンツ用の Chromium ラッパーだけでなく Electron の機能を拡張するため、メインプロセスではユーザーのオペレーティングシステムと対話するカスタム API も追加しています。 Electron は、メニュー、ダイアログ、tray アイコンなど、ネイティブなデスクトップ機能を制御する様々なモジュールを公開しています。</p>\n<p>Electron のメインプロセスのモジュール一覧は、API ドキュメントをご覧ください。</p>\n<h2 id=\"レンダラープロセス\"><a href=\"#レンダラープロセス\">レンダラープロセス</a></h2>\n<p>各 Electron アプリは、開いている <code>BrowserWindow</code> (及び各ウェブ埋め込み) ごとに個別のレンダラープロセスを生成します。 その名の通り、レンダラーはウェブコンテンツの <em>レンダリング</em> を担います。 あらゆる意図と目的において、レンダラープロセスで実行するコードは (少なくとも Chromium がそうである限り) ウェブ標準に従って動作しなければなりません。</p>\n<p>そのため、あるブラウザウインドウ内のすべてのユーザーインターフェイスとアプリの機能は、ウェブの場合と同じツールとパラダイムで記述する必要があります。</p>\n<p>全ウェブ仕様の説明はこのガイドの範疇の外ですが、最低限理解しておくべきことは以下の通りでしょう。</p>\n<ul>\n<li>HTML ファイルがレンダラープロセスのエントリーポイントです。</li>\n<li>UI のスタイル付けは Cascading Style Sheets (CSS) で追加します。</li>\n<li>実行する JavaScript コードは <code>&#x3C;script></code> 要素で追加できます。</li>\n</ul>\n<p>さらにこれは、レンダラーが <code>require</code> やその他 Node.js の API に直接アクセスできないことも意味します。 NPM モジュールをレンダラーに直接組み込むには、ウェブの場合と同じバンドラーツールチェイン (例えば、<code>webpack</code> や <code>parcel</code> など) を使用する必要があります。</p>\n<blockquote>\n<p>注意: 開発を容易にするために、レンダラープロセスを完全な Node.js 環境で生成できます。 歴史的には、これがデフォルトでしたが、セキュリティ上の理由からこの機能は無効になりました。</p>\n</blockquote>\n<p>ここで、レンダラープロセスのユーザーインターフェイスが Node.js や Electron のネイティブデスクトップ機能にアクセスできずメインプロセスからのみできるのであれば、どのように協調して動作するのかと疑問に思うでしょう。 実際、Electron のコンテンツスクリプトを直接インポートする方法はありません。</p>\n<h2 id=\"プリロードスクリプト\"><a href=\"#プリロードスクリプト\">プリロードスクリプト</a></h2>\n<!-- Note: This guide doesn't take sandboxing into account, which might fundamentally \nchange the statements here. --> プリロードスクリプトは、ウェブコンテンツの読み込み開始前にレンダラープロセス内で実行されるコードです。 これらのスクリプトはレンダラーのコンテキスト内で実行されますが、Node.js の API にアクセスできるようにより多くの権限が与えられています。\n<p>プリロードスクリプトは、<code>BrowserWindow</code> コンストラクタの <code>webPreferences</code> オプションでメインプロセスからアタッチできます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">//...</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">preload</span>: <span class=\"hljs-string\">'path/to/preload.js'</span>\n  }\n})\n<span class=\"hljs-comment\">//...</span>\n</code></pre>\n<p>プリロードスクリプトは、グローバルな <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window\"><code>Window</code> </a> インターフェイスをレンダラーと共有し Node.js の API にアクセスすることができます。そのため、<code>window</code> グローバルに任意の API を公開してウェブコンテンツが利用できるようにすることで、レンダラーを強化する役割を果たしています。</p>\n<p>プリロードスクリプトはアタッチされているレンダラーと <code>window</code> グローバルを共有しますが、<a href=\"/docs/tutorial/context-isolation\"><code>contextIsolation</code></a> のデフォルト値によりプリロードスクリプトの変数は <code>window</code> に直接アタッチできません。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.myAPI = {\n  <span class=\"hljs-attr\">desktop</span>: <span class=\"hljs-literal\">true</span>\n}\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-built_in\">window</span>.myAPI)\n<span class=\"hljs-comment\">// => undefined</span>\n</code></pre>\n<p>コンテキスト分離 (contextIsolation) とは、プリロードスクリプトをレンダラーのメインワールドから分離し、特権的 API がウェブコンテンツのコードへ漏れないようにすることです。</p>\n<p>これを代わりに安全に実現するには、以下のように <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> モジュールを使用します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">desktop</span>: <span class=\"hljs-literal\">true</span>\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-built_in\">window</span>.myAPI)\n<span class=\"hljs-comment\">// => { desktop: true }</span>\n</code></pre>\n<p>この機能は、主に以下に挙げる 2 つの目的において非常に便利です。</p>\n<ul>\n<li><a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> ヘルパーをレンダラーに公開することで、プロセス間通信 (IPC) を利用してレンダラーからメインプロセスのタスクを作動できます (その逆も可能)。</li>\n<li>リモート URL でホストされている既存ウェブアプリの Electron のラッパーを開発している場合、レンダラーの <code>window</code> グローバルにカスタムプロパティを追加することで、ウェブクライアント側でデスクトップ専用のロジックを利用できます。</li>\n</ul>",
      "title": "プロセスモデル",
      "description": "注意: BrowserView モジュールなどの ウェブ埋め込み 用のレンダラープロセスが作成されることもあります。 webContents オブジェクトは、埋め込みウェブコンテンツにもアクセスできます。"
    },
    "/docs/api/structures/product": {
      "locale": "ja-JP",
      "slug": "product",
      "href": "/docs/api/structures/product",
      "crowdinFileId": "256485",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/product.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"product-object\"><a href=\"#product-object\">Product Object</a></h1>\n<ul>\n<li><code>productIdentifier</code> String - The string that identifies the product to the Apple App Store.</li>\n<li><code>localizedDescription</code> String - A description of the product.</li>\n<li><code>localizedTitle</code> String - The name of the product.</li>\n<li><code>contentVersion</code> String - A string that identifies the version of the content.</li>\n<li><code>contentLengths</code> Number[] - The total size of the content, in bytes.</li>\n<li><code>price</code> Number - The cost of the product in the local currency.</li>\n<li><code>formattedPrice</code> String - The locale formatted price of the product.</li>\n<li><code>currencyCode</code> String - 3 character code presenting a product's currency based on the ISO 4217 standard.</li>\n<li><code>isDownloadable</code> Boolean - A Boolean value that indicates whether the App Store has downloadable content for this product. <code>true</code> if at least one file has been associated with the product.</li>\n</ul>",
      "title": "Product Object",
      "description": ""
    },
    "/docs/tutorial/progress-bar": {
      "locale": "ja-JP",
      "slug": "progress-bar",
      "href": "/docs/tutorial/progress-bar",
      "crowdinFileId": "256235",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/progress-bar.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"タスクバーのプログレスバー-windows--macos\"><a href=\"#タスクバーのプログレスバー-windows--macos\">タスクバーのプログレスバー (Windows &#x26; macOS)</a></h1>\n<h2 id=\"概要\"><a href=\"#概要\">概要</a></h2>\n<p>プログレスバーは、ユーザーがウィンドウの切り替え操作をすることなくユーザーに進捗情報を提供できます。</p>\n<p>Windows では、タスクバーのボタンにプログレスバーを表示できます。</p>\n<p>![Windows プログレスバー][<a href=\"https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png%5C\">https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png\\</a>]</p>\n<p>macOS では、Dock のアイコンの一部としてプログレスバーを表示します。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/macos-progress-bar.png\" alt=\"macOS プログレスバー\"></p>\n<p>Linux では、Unity のグラフィカルインターフェイスにも同様の機能があり、ランチャー内でプログレスバーを指定できます。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/linux-progress-bar.png\" alt=\"Linux プログレスバー\"></p>\n<blockquote>\n<p>注意: Windows では各ウィンドウごとにプログレスバーを保有できますが、macOS と Linux (Unity) ではアプリケーションのプログレスバーが 1 つだけです。</p>\n</blockquote>\n<hr>\n<p><a href=\"/docs/api/browser-window#winsetprogressbarprogress-options\"><code>setProgressBar()</code></a> メソッドは、<code>BrowserWindow</code> のインスタンスから利用できます。 進捗状況を示すには、<code>0</code> から <code>1</code> の間の数でこのメソッドを呼び出します。 例えば、現在完了までの進捗率が 63% に達している長期のタスクがある場合、<code>setProgressBar(0.63)</code> のように呼び出します。</p>\n<p>引数を負の値 (例: <code>-1</code>) にすると、プログレスバーが取り除かれます。 <code>1</code> より大きい値にすると、Windows では不定のプログレスバーが表示され、他のオペレーティングシステムでは 100% に切り詰められます。 不定のプログレスバーはアクティブな状態を維持しますが、実際のパーセンテージは表示されません。これは、操作が完了するまでの時間がわからない場合に使用します。</p>\n<p><a href=\"/docs/api/browser-window#winsetprogressbarprogress-options\">より多くのオプションやモードについては API ドキュメント</a> を参照してください。</p>\n<h2 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h2>\n<p>この例では、Node.js のタイマーを使って時間経過で増えるプログレスバーをメインウインドウに追加しています。</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/progress-bar\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> progressInterval\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-keyword\">const</span> INCREMENT = <span class=\"hljs-number\">0.03</span>\n  <span class=\"hljs-keyword\">const</span> INTERVAL_DELAY = <span class=\"hljs-number\">100</span> <span class=\"hljs-comment\">// ms</span>\n\n  <span class=\"hljs-keyword\">let</span> c = <span class=\"hljs-number\">0</span>\n  progressInterval = setInterval(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// プログレスバーを次の値へと更新する</span>\n    <span class=\"hljs-comment\">// 0 から 1 の値は進捗状況を示し、1 より大きい値は不定または 100% で留まります。</span>\n    win.setProgressBar(c)\n\n    <span class=\"hljs-comment\">// プログレスバーの増加またはリセット</span>\n    <span class=\"hljs-keyword\">if</span> (c &#x3C; <span class=\"hljs-number\">2</span>) c += INCREMENT\n    <span class=\"hljs-keyword\">else</span> c = <span class=\"hljs-number\">0</span>\n  }, INTERVAL_DELAY)\n}\n\napp.whenReady().then(createWindow)\n\n<span class=\"hljs-comment\">// アプリが終了される前に、両方のタイマーを消去</span>\napp.on(<span class=\"hljs-string\">'before-quit'</span>, () => {\n  clearInterval(progressInterval)\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<p>Electron アプリケーションを起動すると、Dock (macOS) またはタスクバー (Windows、Unity) にプログレスバーが表示され、0 から始まり 100% で完了します。 その後、不定の表示 (Windows) や 100% で留まった表示 (他のオペレーティングシステム) が短時間表示され、ループします。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/dock-progress-bar.png\" alt=\"macOS Dock プログレスバー\"></p>\n<p>macOS の場合、<a href=\"https://support.apple.com/en-us/HT204100\">Mission Control</a> の使用中でもアプリケーションのプログレスバーが表示されます。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/mission-control-progress-bar.png\" alt=\"Mission Control プログレスバー\"></p>",
      "title": "タスクバーのプログレスバー (Windows & macOS)",
      "description": "注意: Windows では各ウィンドウごとにプログレスバーを保有できますが、macOS と Linux (Unity) ではアプリケーションのプログレスバーが 1 つだけです。"
    },
    "/docs/api/protocol": {
      "locale": "ja-JP",
      "slug": "protocol",
      "href": "/docs/api/protocol",
      "crowdinFileId": "256357",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/protocol.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocol\"><a href=\"#protocol\">protocol</a></h1>\n<blockquote>\n<p>カスタムプロトコルを登録し、既存のプロトコルリクエストを傍受します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>file://</code> プロトコルと同じ効果を持つプロトコルの実装の例:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })\n})\n</code></pre>\n<p><strong>注釈:</strong> 指定されていないすべてのメソッドは、<code>app</code> モジュールの <code>ready</code> イベントが発生した後にのみ使用できます。</p>\n<h2 id=\"protocol-をカスタムの-partition-や-session-で使用する\"><a href=\"#protocol-をカスタムの-partition-や-session-で使用する\"><code>protocol</code> をカスタムの <code>partition</code> や <code>session</code> で使用する</a></h2>\n<p>プロトコルは特定の Electron <a href=\"/docs/api/session\"><code>session</code></a> オブジェクトに登録されます。 セッションを指定しない場合は、Electron が使用するデフォルトセッションに <code>protocol</code> が適用されます。 ただし、<code>browserWindow</code> の <code>webPreferences</code> に <code>partition</code> または <code>session</code> を定義すると、そのウィンドウに <code>electron.protocol.XXX</code> を使用しただけでは別のセッションやカスタムプロトコルは機能しません。</p>\n<p>カスタムプロトコルをカスタムセッションと組み合わせて機能させるには、それを明示的にそのセッションに登録する必要があります。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session, app, protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> partition = <span class=\"hljs-string\">'persist:example'</span>\n  <span class=\"hljs-keyword\">const</span> ses = session.fromPartition(partition)\n\n  ses.protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })\n\n  mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { partition } })\n})\n</code></pre>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>protocol</code> モジュールには以下のメソッドがあります。</p>\n<h3 id=\"protocolregisterschemesasprivilegedcustomschemes\"><a href=\"#protocolregisterschemesasprivilegedcustomschemes\"><code>protocol.registerSchemesAsPrivileged(customSchemes)</code></a></h3>\n<ul>\n<li><code>customSchemes</code> <a href=\"/docs/api/structures/custom-scheme\">CustomScheme[]</a></li>\n</ul>\n<p><strong>注意:</strong> このメソッドは、<code>app</code> モジュールの <code>ready</code> イベントが発行される前にのみ使用でき、一度だけ呼び出すことができます。</p>\n<p><code>scheme</code> を標準の安全なものとして登録し、リソースに対するコンテンツセキュリティポリシーをバイパスし、ServiceWorker を登録し、fetch API と video/audioのストリーミングをサポートします。 機能を有効にするには、<code>true</code> の値で特権を指定します。</p>\n<p>以下はコンテンツセキュリティポリシーをバイパスする特権スキームを登録する例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nprotocol.registerSchemesAsPrivileged([\n  { <span class=\"hljs-attr\">scheme</span>: <span class=\"hljs-string\">'foo'</span>, <span class=\"hljs-attr\">privileges</span>: { <span class=\"hljs-attr\">bypassCSP</span>: <span class=\"hljs-literal\">true</span> } }\n])\n</code></pre>\n<p>標準スキームは、RFC 3986 で <a href=\"https://tools.ietf.org/html/rfc3986#section-3\">Generic URI Syntax</a> と呼ぶものに準拠しています。 例えば <code>http</code> と <code>https</code> は標準スキームですが、<code>file</code> はそうではありません。</p>\n<p>スキームを標準として登録することにより、サービスが提供されるときに相対的および絶対的なリソースが正しく解決されます。 そうでないと、スキームは <code>file</code> プロトコルのように動作しますが、相対 URL を解決することはできません。</p>\n<p>たとえば、標準スキームとして登録せずにカスタムプロトコルで以下のページをロードすると、非標準スキームが相対URLを認識できないため、イメージはロードされません。</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">img</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">'test.png'</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n</code></pre>\n<p>スキームを標準で登録すると、<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/LocalFileSystem\">FileSystem API</a> を介してファイルにアクセスできます。 そうしない場合、レンダラーはスキームのセキュリティエラーをスローします。</p>\n<p>デフォルトの非標準スキームでは、ウェブストレージ API (localStorage、sessionStorage、webSQL、indexedDB、クッキー) が無効にされます。 そのため、一般的に、カスタムプロトコルを登録して <code>http</code> プロトコルを置き換える場合は、標準のスキームとして登録する必要があります。</p>\n<p>(http やストリームプロトコルなどの、) ストリームを使用するプロトコルは、 <code>stream: true</code> を設定する必要があります。 <code>&#x3C;video></code> と <code>&#x3C;audio></code> HTML 要素はプロトコルがデフォルトで レスポンスをバッファすることを期待します。 <code>stream</code> フラグは、ストリーミング応答を期待する これらの要素を正しく設定します。</p>\n<h3 id=\"protocolregisterfileprotocolscheme-handler\"><a href=\"#protocolregisterfileprotocolscheme-handler\"><code>protocol.registerFileProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Boolean</code> - protocol が正常に登録されたかどうか</p>\n<p>ファイルをレスポンスとして送信する <code>scheme</code> のプロトコルを登録します。 <code>handler</code> は <code>request</code> と <code>callback</code> で呼び出されます。この <code>request</code> は <code>scheme</code> の接続リクエストです。</p>\n<p><code>request</code> を処理するには、<code>callback</code> を、ファイルのパスまたは <code>path</code> プロパティを持つオブジェクトのいずれかを使用して、例えば、<code>callback(filePath)</code> や <code>callback({ path: filePath })</code> で呼び出す必要があります。 <code>filePath</code> は絶対パスでなければなりません。</p>\n<p>デフォルトでは、<code>scheme</code> は <code>http:</code> のように扱われます。これは、<code>file:</code> のような \"Generic URI Syntax\" に従うプロトコルとは違った解析がなされます。</p>\n<h3 id=\"protocolregisterbufferprotocolscheme-handler\"><a href=\"#protocolregisterbufferprotocolscheme-handler\"><code>protocol.registerBufferProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (Buffer | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Boolean</code> - protocol が正常に登録されたかどうか</p>\n<p><code>Buffer</code> をレスポンスとして送信する <code>scheme</code> のプロトコルを登録します。</p>\n<p>使い方は <code>registerFileProtocol</code> と同じですが、 <code>callback</code> を、<code>Buffer</code> オブジェクトか <code>data</code> プロパティを持つオブジェクトで呼び出す必要があります。</p>\n<p>サンプル:</p>\n<pre><code class=\"hljs language-javascript\">protocol.registerBufferProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback({ <span class=\"hljs-attr\">mimeType</span>: <span class=\"hljs-string\">'text/html'</span>, <span class=\"hljs-attr\">data</span>: Buffer.from(<span class=\"hljs-string\">'&#x3C;h5>Response&#x3C;/h5>'</span>) })\n})\n</code></pre>\n<h3 id=\"protocolregisterstringprotocolscheme-handler\"><a href=\"#protocolregisterstringprotocolscheme-handler\"><code>protocol.registerStringProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Boolean</code> - protocol が正常に登録されたかどうか</p>\n<p><code>String</code> をレスポンスとして送信する <code>scheme</code> のプロトコルを登録します。</p>\n<p>使い方は <code>registerFileProtocol</code> と同じですが、 <code>callback</code> を、<code>String</code> か <code>data</code> プロパティを持つオブジェクトで呼び出す必要があります。</p>\n<h3 id=\"protocolregisterhttpprotocolscheme-handler\"><a href=\"#protocolregisterhttpprotocolscheme-handler\"><code>protocol.registerHttpProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> ProtocolResponse</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Boolean</code> - protocol が正常に登録されたかどうか</p>\n<p>HTTP リクエストをレスポンスとして送信する <code>scheme</code> のプロトコルを登録します。</p>\n<p>使い方は <code>registerFileProtocol</code> と同じですが、 <code>callback</code> を、<code>url</code> プロパティを持つオブジェクトで呼び出す必要があります。</p>\n<h3 id=\"protocolregisterstreamprotocolscheme-handler\"><a href=\"#protocolregisterstreamprotocolscheme-handler\"><code>protocol.registerStreamProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (ReadableStream | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Boolean</code> - protocol が正常に登録されたかどうか</p>\n<p>ストリームをレスポンスとして送信する <code>scheme</code> のプロトコルを登録します。</p>\n<p>使い方は <code>registerFileProtocol</code> と同じですが、 <code>callback</code> を、<a href=\"https://nodejs.org/api/stream.html#stream_class_stream_readable\"><code>ReadableStream</code></a> オブジェクトか <code>data</code> プロパティを持つオブジェクトで呼び出す必要があります。</p>\n<p>サンプル:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { PassThrough } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'stream'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createStream</span> (<span class=\"hljs-params\">text</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> rv = <span class=\"hljs-keyword\">new</span> PassThrough() <span class=\"hljs-comment\">// PassThrough も ReadableStream の一種</span>\n  rv.push(text)\n  rv.push(<span class=\"hljs-literal\">null</span>)\n  <span class=\"hljs-keyword\">return</span> rv\n}\n\nprotocol.registerStreamProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback({\n    <span class=\"hljs-attr\">statusCode</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">headers</span>: {\n      <span class=\"hljs-string\">'content-type'</span>: <span class=\"hljs-string\">'text/html'</span>\n    },\n    <span class=\"hljs-attr\">data</span>: createStream(<span class=\"hljs-string\">'&#x3C;h5>Response&#x3C;/h5>'</span>)\n  })\n})\n</code></pre>\n<p>Readable ストリーム API (<code>data</code> / <code>end</code> / <code>error</code> イベントが発生するもの) を実装するオブジェクトを渡すことが可能です。 例として、ファイルを返す方法を以下に示します。</p>\n<pre><code class=\"hljs language-javascript\">protocol.registerStreamProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback(fs.createReadStream(<span class=\"hljs-string\">'index.html'</span>))\n})\n</code></pre>\n<h3 id=\"protocolunregisterprotocolscheme\"><a href=\"#protocolunregisterprotocolscheme\"><code>protocol.unregisterProtocol(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - protocol が正常に登録解除されたかどうか</p>\n<p><code>scheme</code> のカスタムプロトコルを登録解除します。</p>\n<h3 id=\"protocolisprotocolregisteredscheme\"><a href=\"#protocolisprotocolregisteredscheme\"><code>protocol.isProtocolRegistered(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - <code>scheme</code> がすでに登録されているかどうか。</p>\n<h3 id=\"protocolinterceptfileprotocolscheme-handler\"><a href=\"#protocolinterceptfileprotocolscheme-handler\"><code>protocol.interceptFileProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Boolean</code> - protocol が正常に割り込みされたかどうか</p>\n<p><code>scheme</code> プロトコルを傍受し、ファイルをレスポンスとして送信するプロトコルの新しいハンドラとして <code>handler</code> を使用します。</p>\n<h3 id=\"protocolinterceptstringprotocolscheme-handler\"><a href=\"#protocolinterceptstringprotocolscheme-handler\"><code>protocol.interceptStringProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Boolean</code> - protocol が正常に割り込みされたかどうか</p>\n<p><code>scheme</code> プロトコルを傍受し、<code>String</code> をレスポンスとして送信するプロトコルの新しいハンドラとして <code>handler</code> を使用します。</p>\n<h3 id=\"protocolinterceptbufferprotocolscheme-handler\"><a href=\"#protocolinterceptbufferprotocolscheme-handler\"><code>protocol.interceptBufferProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (Buffer | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Boolean</code> - protocol が正常に割り込みされたかどうか</p>\n<p><code>scheme</code> プロトコルを傍受し、<code>Buffer</code> をレスポンスとして送信するプロトコルの新しいハンドラとして <code>handler</code> を使用します。</p>\n<h3 id=\"protocolintercepthttpprotocolscheme-handler\"><a href=\"#protocolintercepthttpprotocolscheme-handler\"><code>protocol.interceptHttpProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Boolean</code> - protocol が正常に割り込みされたかどうか</p>\n<p><code>scheme</code> プロトコルを傍受し、新しい HTTP リクエストをレスポンスとして送信するプロトコルの新しいハンドラとして <code>handler</code> を使用します。</p>\n<h3 id=\"protocolinterceptstreamprotocolscheme-handler\"><a href=\"#protocolinterceptstreamprotocolscheme-handler\"><code>protocol.interceptStreamProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (ReadableStream | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Boolean</code> - protocol が正常に割り込みされたかどうか</p>\n<p><code>protocol.registerStreamProtocol</code> と同じですが、既存のプロトコルハンドラを置き換える点が異なります。</p>\n<h3 id=\"protocoluninterceptprotocolscheme\"><a href=\"#protocoluninterceptprotocolscheme\"><code>protocol.uninterceptProtocol(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - protocol が正常に割り込み解除されたかどうか</p>\n<p><code>scheme</code> のためにインストールされた傍受するハンドラを削除し、元のハンドラを復元します。</p>\n<h3 id=\"protocolisprotocolinterceptedscheme\"><a href=\"#protocolisprotocolinterceptedscheme\"><code>protocol.isProtocolIntercepted(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - <code>scheme</code> がすでにインターセプトされているかどうか。</p>",
      "title": "protocol",
      "description": "カスタムプロトコルを登録し、既存のプロトコルリクエストを傍受します。"
    },
    "/docs/api/structures/protocol-request": {
      "locale": "ja-JP",
      "slug": "protocol-request",
      "href": "/docs/api/structures/protocol-request",
      "crowdinFileId": "256487",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-request.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolrequest-object\"><a href=\"#protocolrequest-object\">ProtocolRequest Object</a></h1>\n<ul>\n<li><code>url</code> String</li>\n<li><code>referrer</code> String</li>\n<li><code>method</code> String</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/upload-data\">UploadData[]</a> (optional)</li>\n<li><code>headers</code> Record&#x3C;String, String></li>\n</ul>",
      "title": "ProtocolRequest Object",
      "description": ""
    },
    "/docs/api/structures/protocol-response": {
      "locale": "ja-JP",
      "slug": "protocol-response",
      "href": "/docs/api/structures/protocol-response",
      "crowdinFileId": "256491",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-response.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolresponse-object\"><a href=\"#protocolresponse-object\">ProtocolResponse Object</a></h1>\n<ul>\n<li><code>error</code> Integer (optional) - When assigned, the <code>request</code> will fail with the <code>error</code> number . For the available error numbers you can use, please see the <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">net error list</a>.</li>\n<li><code>statusCode</code> Number (optional) - The HTTP response code, default is 200.</li>\n<li><code>charset</code> String (optional) - The charset of response body, default is <code>\"utf-8\"</code>.</li>\n<li><code>mimeType</code> String (optional) - The MIME type of response body, default is <code>\"text/html\"</code>. Setting <code>mimeType</code> would implicitly set the <code>content-type</code> header in response, but if <code>content-type</code> is already set in <code>headers</code>, the <code>mimeType</code> would be ignored.</li>\n<li><code>headers</code> Record&#x3C;string, string | string[]> (optional) - An object containing the response headers. The keys must be String, and values must be either String or Array of String.</li>\n<li><code>data</code> (Buffer | String | ReadableStream) (optional) - The response body. When returning stream as response, this is a Node.js readable stream representing the response body. When returning <code>Buffer</code> as response, this is a <code>Buffer</code>. When returning <code>String</code> as response, this is a <code>String</code>. This is ignored for other types of responses.</li>\n<li><code>path</code> String (optional) - Path to the file which would be sent as response body. This is only used for file responses.</li>\n<li><code>url</code> String (optional) - Download the <code>url</code> and pipe the result as response body. This is only used for URL responses.</li>\n<li><code>referrer</code> String (optional) - The <code>referrer</code> URL. This is only used for file and URL responses.</li>\n<li><code>method</code> String (optional) - The HTTP <code>method</code>. This is only used for file and URL responses.</li>\n<li><code>session</code> Session (optional) - The session used for requesting URL, by default the HTTP request will reuse the current session. Setting <code>session</code> to <code>null</code> would use a random independent session. This is only used for URL responses.</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/protocol-response-upload-data\">ProtocolResponseUploadData</a> (optional) - The data used as upload data. This is only used for URL responses when <code>method</code> is <code>\"POST\"</code>.</li>\n</ul>",
      "title": "ProtocolResponse Object",
      "description": ""
    },
    "/docs/api/structures/protocol-response-upload-data": {
      "locale": "ja-JP",
      "slug": "protocol-response-upload-data",
      "href": "/docs/api/structures/protocol-response-upload-data",
      "crowdinFileId": "256489",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-response-upload-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolresponseuploaddata-object\"><a href=\"#protocolresponseuploaddata-object\">ProtocolResponseUploadData Object</a></h1>\n<ul>\n<li><code>contentType</code> String - MIME type of the content.</li>\n<li><code>data</code> String | Buffer - Content to be sent.</li>\n</ul>",
      "title": "ProtocolResponseUploadData Object",
      "description": ""
    },
    "/docs/development/pull-requests": {
      "locale": "ja-JP",
      "slug": "pull-requests",
      "href": "/docs/development/pull-requests",
      "crowdinFileId": "256163",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/pull-requests.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"プルリクエスト\"><a href=\"#プルリクエスト\">プルリクエスト</a></h1>\n<ul>\n<li><a href=\"#setting-up-your-local-environment\">ローカル環境のセットアップ</a><ul>\n<li><a href=\"#step-1-fork\">ステップ1: フォーク</a></li>\n<li><a href=\"#step-2-build\">ステップ2: ビルド</a></li>\n<li><a href=\"#step-3-branch\">ステップ3: ブランチ</a></li>\n</ul></li>\n<li><a href=\"#making-changes\">変更を加える</a><ul>\n<li><a href=\"#step-4-code\">ステップ4: コーディング</a></li>\n<li><a href=\"#step-5-commit\">ステップ5: コミット</a><ul>\n<li><a href=\"#commit-message-guidelines\">コミットメッセージのガイドライン</a></li>\n</ul></li>\n<li><a href=\"#step-6-rebase\">ステップ6: リベース</a></li>\n<li><a href=\"#step-7-test\">ステップ7: テスト</a></li>\n<li><a href=\"#step-8-push\">ステップ8: プッシュ</a></li>\n<li><a href=\"#step-9-opening-the-pull-request\">ステップ9: プルリクエストを開く</a></li>\n<li><a href=\"#step-10-discuss-and-update\">ステップ10: 議論と更新</a><ul>\n<li><a href=\"#approval-and-request-changes-workflow\">承認とリクエストの変更ワークフロー</a></li>\n</ul></li>\n<li><a href=\"#step-11-landing\">ステップ11: 取り込み</a></li>\n<li><a href=\"#continuous-integration-testing\">継続的インテグレーションテスト</a></li>\n</ul></li>\n</ul>\n<h2 id=\"ローカル環境のセットアップ\"><a href=\"#ローカル環境のセットアップ\">ローカル環境のセットアップ</a></h2>\n<h3 id=\"ステップ1-フォーク\"><a href=\"#ステップ1-フォーク\">ステップ1: フォーク</a></h3>\n<p><a href=\"https://github.com/electron/electron\">GitHub</a> でプロジェクトをフォークし、ローカルでフォークをクローンします。</p>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:username/electron.git\n$ <span class=\"hljs-built_in\">cd</span> electron\n$ git remote add upstream https://github.com/electron/electron.git\n$ git fetch upstream\n</code></pre>\n<h3 id=\"ステップ2-ビルド\"><a href=\"#ステップ2-ビルド\">ステップ2: ビルド</a></h3>\n<p>ビルド手順と依存関係は、オペレーティングシステムによって若干異なります。 Electron をローカルに構築する際は、これらの詳細なガイドを参照してください。</p>\n<ul>\n<li><a href=\"/docs/development/build-instructions-macos\">macOS 上でビルド</a></li>\n<li><a href=\"/docs/development/build-instructions-linux\">Linux 上でビルド</a></li>\n<li><a href=\"/docs/development/build-instructions-windows\">Windows 上でビルド</a></li>\n</ul>\n<p>プロジェクトをローカルに構築したら、変更を始める準備が整います！</p>\n<h3 id=\"ステップ3-ブランチ\"><a href=\"#ステップ3-ブランチ\">ステップ3: ブランチ</a></h3>\n<p>開発環境を整理しておくために、作業を支えるローカルのブランチを作りましょう。 これらは、<code>main</code> ブランチから直接分岐する必要があります。</p>\n<pre><code class=\"hljs language-sh\">$ git checkout -b my-branch -t upstream/main\n</code></pre>\n<h2 id=\"変更を加える\"><a href=\"#変更を加える\">変更を加える</a></h2>\n<h3 id=\"ステップ4-コーディング\"><a href=\"#ステップ4-コーディング\">ステップ4: コーディング</a></h3>\n<p><code>electron/electron</code> リポジトリに対して開かれたほとんどのプルリクエストには、<code>shell/</code> フォルダの C/C++ コード、<code>lib/</code> フォルダの JavaScript コード、<code>docs/api/</code> のドキュメント、<code>spec/</code> フォルダのテストの変更が含まれます。</p>\n<p>コードの変更時に <code>npm run lint</code> を実行して、プロジェクトのコードスタイルに従うようにしてください。</p>\n<p>プロジェクトのさまざまな部分でコードを変更する際のベストプラクティスの詳細については、<a href=\"/docs/development/coding-style\">コーディングスタイル</a> を参照してください。</p>\n<h3 id=\"ステップ5-コミット\"><a href=\"#ステップ5-コミット\">ステップ5: コミット</a></h3>\n<p>変更を個々のコミット内で論理的にグループ化しておくことを推奨します。 コントリビューターの多くが、複数のコミットに分割された変更をより簡単に確認できます。 プルリクエストのコミット数に制限はありません。</p>\n<pre><code class=\"hljs language-sh\">$ git add my/changed/files\n$ git commit\n</code></pre>\n<p>複数のコミットは、取り込み時にしばしば縮められることに注意してください。</p>\n<h4 id=\"コミットメッセージのガイドライン\"><a href=\"#コミットメッセージのガイドライン\">コミットメッセージのガイドライン</a></h4>\n<p>良いコミットメッセージは、何が何故変更されたのか、が記述されるべきです。 このElectronプロジェクトは<a href=\"https://conventionalcommits.org/\">セマンティックコミットメッセージ</a>をつかって、このリリースプロセスを合理化しています。</p>\n<p>プルリクエストがマージされるためには、プルリクエストにタイトルがあり、それには意図を示すプレフィックスが<strong>なければなりません</strong></p>\n<p>意図を示すプレフィックスのあるコミットメッセージのの例です。:</p>\n<ul>\n<li><code>fix: don't overwrite prevent_default if default wasn't prevented</code></li>\n<li><code>feat: add app.isPackaged() method</code></li>\n<li><code>docs: app.isDefaultProtocolClient is now available on Linux</code></li>\n</ul>\n<p>プレフィックスの例:</p>\n<ul>\n<li>fix: バグ修正</li>\n<li>feat: 新機能</li>\n<li>docs: ドキュメントの変更</li>\n<li>test: 足りないテストの追加や既存のテストの訂正</li>\n<li>build: ビルドシステムに影響する変更</li>\n<li>ci: CI の設定ファイルとスクリプトへの変更</li>\n<li>perf: パフォーマンスを改善するコード変更</li>\n<li>refactor: バグ修正や機能追加の無いコード変更</li>\n<li>style: コードの意味を変えない変更 (lint)</li>\n</ul>\n<p>その他、コミットメッセージを作成するときに留意すること:</p>\n<ol>\n<li>最初の行は、以下の通りにしてください。<ul>\n<li>変更の簡単な説明を含める (50 文字以下が好ましく、72 文字を超えない)</li>\n<li>適切な名詞、頭字語、および関数/変数名のようなコードを参照する単語を除いて、完全な小文字にする</li>\n</ul></li>\n<li>2行目は空にしてください。</li>\n<li>他のすべての行は72列で折り返します。</li>\n</ol>\n<h4 id=\"破壊的変更\"><a href=\"#破壊的変更\">破壊的変更</a></h4>\n<p>オプションの本体またはフッターのセクションの先頭に <code>BREAKING CHANGE:</code> のテキストがあるコミットは、API に破壊的な (セマンティックバージョン管理におけるメジャーと相関する) 変更をもたらします。 破壊的な変更はあらゆるタイプのコミットの一部になりえます。 例として、<code>fix:</code>、<code>feat:</code>、<code>chore:</code> やその他のタイプも加えてすべて当てはまります。</p>\n<p>詳細については、<a href=\"https://conventionalcommits.org\">conventionalcommits.org</a> を参照してください。</p>\n<h3 id=\"ステップ6-リベース\"><a href=\"#ステップ6-リベース\">ステップ6: リベース</a></h3>\n<p>変更をコミットしたら、<code>git rebase</code> (<code>git merge</code> ではない) を使用してメインリポジトリと作業を同期させることを推奨します。</p>\n<pre><code class=\"hljs language-sh\">$ git fetch upstream\n$ git rebase upstream/main\n</code></pre>\n<p>これにより作業ブランチに <code>electron/electron</code> の main の最新の変更が確実に反映されます。</p>\n<h3 id=\"ステップ7-テスト\"><a href=\"#ステップ7-テスト\">ステップ7: テスト</a></h3>\n<p>バグの修正と機能追加には常にテストが必要です。 プロセスを簡単にするため、<a href=\"/docs/development/testing\">テストガイド</a> が提供されています。 それらがどのように構築されるべきかを見るため、他のテストを見ることでも手助けになれます。</p>\n<p>プルリクエストで変更を送信する前に、常に完全なテストスイートを実行してください。 テストを実行するには以下のようにします。</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>リンターが問題を報告していないこと、そしてすべてのテストが合格していることを確認してください。 いずれかのチェックに失敗したパッチは提出しないでください。</p>\n<p>テストを更新していて、単一の仕様を実行してチェックしたい場合は、以下のようにします。</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span> -match=menu\n</code></pre>\n<p>上記の例では <code>menu</code> に一致する仕様のモジュールのみが実行されます。これは、テストサイクルの最後の最後にテストに取り組んでいる人にとって役に立ちます。</p>\n<h3 id=\"ステップ8-プッシュ\"><a href=\"#ステップ8-プッシュ\">ステップ8: プッシュ</a></h3>\n<p>コミットの準備 ―― テストに合格して、lint をしている ―― ができたら、GitHub 上 のあなたのフォークに作業ブランチをプッシュして、プルリクエストを開くプロセスを開始します。</p>\n<pre><code class=\"hljs language-sh\">$ git push origin my-branch\n</code></pre>\n<h3 id=\"ステップ9-プルリクエストを開く\"><a href=\"#ステップ9-プルリクエストを開く\">ステップ9: プルリクエストを開く</a></h3>\n<p>GitHub で、新しいプルリクエストを開くと、記入する必要のあるテンプレートが表示されます。</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"xml\"><span class=\"hljs-comment\">&#x3C;!--\nプルリクエストありがとう。 上に説明を記述して、下の要件を確認してください。\n\nバグ修正や新機能には、テストやベンチマークが含まれている必要があります。\n\nコントリビューターガイド: https://github.com/electron/electron/blob/main/CONTRIBUTING.md\n--></span></span>\n</code></pre>\n<h3 id=\"ステップ10-議論と更新\"><a href=\"#ステップ10-議論と更新\">ステップ10: 議論と更新</a></h3>\n<p>おそらく、あなたはプルリクエストの変更に対するフィードバックやリクエストを得ます。 これは提出プロセスの大事な部分なので、がっかりさせないでください！ コントリビューターの中には、すぐにプルリクエストを承認する人がいます。 他の人には詳細なコメントやフィードバックがあるかもしれません。 これは、変更が正しいかどうかを評価するために必要なプロセスの一部です。</p>\n<p>既存のプルリクエストを変更するには、ローカルブランチに変更を加え、それらの変更で新しいコミットを追加し、それらをあなたのフォークにプッシュします。 GitHub は自動的にプルリクエストを更新します。</p>\n<pre><code class=\"hljs language-sh\">$ git add my/changed/files\n$ git commit\n$ git push origin my-branch\n</code></pre>\n<p>利用できる <code>git rebase</code> を使用して、コミットを管理するためのさらに高度なメカニズムがいくつかありますが、このガイドの範疇を超えています。</p>\n<p>あなたが何らかの回答を待っている場合は、Ping レビュー担当者にプルリクエスト内でコメントを投稿してください。 不慣れな言葉や頭字語に遭遇した場合は、この <a href=\"https://sites.google.com/a/chromium.org/dev/glossary\">用語集</a> を参照してください。</p>\n<h4 id=\"承認とリクエストの変更ワークフロー\"><a href=\"#承認とリクエストの変更ワークフロー\">承認とリクエストの変更ワークフロー</a></h4>\n<p>すべてのプルリクエストは、取り込むために、変更した部分の <a href=\"https://github.com/electron/electron/blob/main/.github/CODEOWNERS\">Code Owner</a> の承認が必要です。 管理者はプルリクエストをレビューするたびに、変更を要求することができます。 これらは、タイプミスを修正するなどの小さなもから、実質的な変更を伴うものまでにもなります。 このような要求は役に立ちますが、時には、特に変更する <em>やり方</em> についての具体的な提案が含まれていないために、唐突だったり親切でないものに出くわすことがあります。</p>\n<p>がっかりしないでください。 レビューが不公平であると感じる場合は、そう言い、別のプロジェクトのコントリビューターの意見を求めてください。 大抵の場合、そのようなコメントはレビュアーがレビューするのに十分な時間が無いためで、意図しないものです。 そのような困難はしばしば少しの忍耐で解決することができます。 要するに、レビュアーは親切なやりとりを提供することが期待されているということです。</p>\n<h3 id=\"ステップ11-取り込み\"><a href=\"#ステップ11-取り込み\">ステップ11: 取り込み</a></h3>\n<p>取り込まれるには、少なくとも1人の Electron の Code Ownerがレビューして承認し、CI に合格する必要があります。 その後、他のコントリビューターからの異論がない場合、プルリクエストをマージすることができます。</p>\n<p>おめでとう、あなたのコントリビューションに感謝します！</p>\n<h3 id=\"継続的インテグレーションテスト\"><a href=\"#継続的インテグレーションテスト\">継続的インテグレーションテスト</a></h3>\n<p>すべてのプルリクエストは、継続的インテグレーション (CI) システムでテストされ、 それが Electron のサポートされているプラットフォームで動作することを確認されます。</p>\n<p>理想的には、プルリクエストは CI のすべてのプラットフォーム上で合格します (\"青になる\") 。 これは、すべてのテストが合格し、lint のエラーがないことを意味します。 しかし、CI インフラストラクチャ自体が特定のプラットフォームで失敗したり、いわゆる \"flaky\" テストに失敗する (\"赤になる\") ことは珍しいことではありません。 各 CI の失敗を手動で検査して原因を特定する必要があります。</p>\n<p>プルリクエストを開くと、CI が自動的に開始されますが、メンテナーだけが CI の実行をリスタートできます。 CI が誤検知をしていると思われる場合は、メンテナーにテストをリスタートするよう依頼してください。</p>",
      "title": "プルリクエスト",
      "description": ""
    },
    "/docs/tutorial/quick-start": {
      "locale": "ja-JP",
      "slug": "quick-start",
      "href": "/docs/tutorial/quick-start",
      "crowdinFileId": "256237",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/quick-start.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"クイック-スタート\"><a href=\"#クイック-スタート\">クイック スタート</a></h1>\n<p>This guide will step you through the process of creating a barebones Hello World app in Electron, similar to <a href=\"https://github.com/electron/electron-quick-start\"><code>electron/electron-quick-start</code></a>.</p>\n<p>このチュートリアルを終えると、ブラウザウインドウを開いて Chromium、Node.js、Electron それぞれの実行バージョン情報のウェブページを表示できるアプリが完成します。</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<p>Electron を使用するには、 <a href=\"https://nodejs.org/en/download/\">Node.js</a> をインストールする必要があります。 利用可能な最新の <code>LTS</code> バージョンのインストールを推奨します。</p>\n<blockquote>\n<p>お使いのプラットフォーム向けのビルド済みインストーラを使用して、Node.js をインストールするようにしてください。 さもなくば、他の開発ツールと互換性の問題が発生することがあります。</p>\n</blockquote>\n<p>Node.js が正しくインストールされたかどうかを確認するため、お使いのターミナルクライアントで以下のコマンドを入力してください。</p>\n<pre><code class=\"hljs language-sh\">node -v\nnpm -v\n</code></pre>\n<p>このコマンドで、Node.js と npm のバージョンが表示されている必要があります。</p>\n<p><strong>注意:</strong> Electron は Node.js をバイナリに組み込んでいるため、コードを実行している Node.js のバージョンとシステムが実行しているバージョンは関係ありません。</p>\n<h2 id=\"アプリケーションを作成する\"><a href=\"#アプリケーションを作成する\">アプリケーションを作成する</a></h2>\n<h3 id=\"プロジェクトの雛形を作る\"><a href=\"#プロジェクトの雛形を作る\">プロジェクトの雛形を作る</a></h3>\n<p>Electron アプリは、他の Node.js プロジェクトと同様の一般的な構造に従います。 まず、フォルダを作成し npm パッケージを初期化します。</p>\n<pre><code class=\"hljs language-sh\">mkdir my-electron-app &#x26;&#x26; <span class=\"hljs-built_in\">cd</span> my-electron-app\nnpm init\n</code></pre>\n<p>このインタラクティブな <code>init</code> コマンドでは、設定でいくつかフィールドの入力を促されます。 このチュートリアルの目的上、以下のルールに従ってください。</p>\n<ul>\n<li><code>entry point</code> は <code>main.js</code> でなければなりません。</li>\n<li><code>author</code> と <code>description</code> はどのような値でも構いませんが、<a href=\"#package-and-distribute-your-application\">アプリのパッケージ化</a> で必要になります。</li>\n</ul>\n<p><code>package.json</code> ファイルは、以下のようになっていなければなりません。</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"my-electron-app\"</span>,\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"1.0.0\"</span>,\n  <span class=\"hljs-attr\">\"description\"</span>: <span class=\"hljs-string\">\"Hello World!\"</span>,\n  <span class=\"hljs-attr\">\"main\"</span>: <span class=\"hljs-string\">\"main.js\"</span>,\n  <span class=\"hljs-attr\">\"author\"</span>: <span class=\"hljs-string\">\"Jane Doe\"</span>,\n  <span class=\"hljs-attr\">\"license\"</span>: <span class=\"hljs-string\">\"MIT\"</span>\n}\n</code></pre>\n<p>そして、アプリの <code>devDependencies</code> に <code>electron</code> パッケージインストールします。</p>\n<pre><code class=\"hljs language-sh\">$ npm install --save-dev electron\n</code></pre>\n<blockquote>\n<p>注意: Electron のインストールで問題が発生した場合は、<a href=\"/docs/tutorial/installation\">発展的なインストール</a> のガイドをご参照ください。</p>\n</blockquote>\n<p>最後に、Electron を実行できるようにしたいと思います。 <code>package.json</code> の設定の <a href=\"https://docs.npmjs.com/cli/v7/using-npm/scripts\"><code>scripts</code></a> フィールドに、以下のような <code>start</code> コマンドを追加します。</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"scripts\"</span>: {\n    <span class=\"hljs-attr\">\"start\"</span>: <span class=\"hljs-string\">\"electron .\"</span>\n  }\n}\n</code></pre>\n<p>この <code>start</code> コマンドにより、アプリを開発モードで開けます。</p>\n<pre><code class=\"hljs language-sh\">npm start\n</code></pre>\n<blockquote>\n<p>注: このスクリプトは、Electron をプロジェクトのルートフォルダで実行するように指示しています。 今の段階のアプリでは、実行するアプリが見つからないというエラーが出ます。</p>\n</blockquote>\n<h3 id=\"メインプロセスを実行する\"><a href=\"#メインプロセスを実行する\">メインプロセスを実行する</a></h3>\n<p>Electron アプリケーションのエントリポイントは、<code>main</code> スクリプトです。 このスクリプトは、<strong>メインプロセス</strong> を制御します。メインプロセスは完全な Node.js 環境で実行され、アプリのライフサイクルの制御、ネイティブインターフェースの表示、特権的操作の実行、レンダラープロセスの管理などを行います (詳細は後述)。</p>\n<p>実行時、Electron はこのスクリプトをアプリの <code>package.json</code> の設定にある <a href=\"https://docs.npmjs.com/cli/v7/configuring-npm/package-json#main\"><code>main</code></a> フィールドから探します。これは <a href=\"#scaffold-the-project\">プロジェクトの雛形を作る</a> ステップで設定してあるはずです。</p>\n<p><code>main</code> スクリプトを書き始めるにあたって、プロジェクトのルートフォルダに <code>main.js</code> という空のファイルを作成します。</p>\n<blockquote>\n<p>注: この時点で <code>start</code> スクリプトを再度実行すると、アプリはエラーを出さなくなります。 しかし、<code>main.js</code> にコードを追加していないためまだ何もしません。</p>\n</blockquote>\n<h3 id=\"ウェブページの作成\"><a href=\"#ウェブページの作成\">ウェブページの作成</a></h3>\n<p>アプリケーションのウインドウを作成する前に、ウインドウが読み込むコンテンツを作成する必要があります。 Electron では、各ウインドウにローカルの HTML ファイルやリモート URL から読み込んだウェブコンテンツを表示します。</p>\n<p>このチュートリアルでは、前者を行います。 プロジェクトのルートフォルダに以下の <code>index.html</code> ファイルを作成しましょう。</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-comment\">&#x3C;!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"X-Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    We are using Node.js <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"node-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    Chromium <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"chrome-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    and Electron <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"electron-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>.\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<blockquote>\n<p>注: この HTML ドキュメントを見ると、バージョン番号が本文から抜けていることがわかります。 これは JavaScript で後から手動挿入します。</p>\n</blockquote>\n<h3 id=\"ブラウザウインドウでウェブページを開く\"><a href=\"#ブラウザウインドウでウェブページを開く\">ブラウザウインドウでウェブページを開く</a></h3>\n<p>ウェブページができたので、これをアプリケーションウインドウに読み込ませます。 そのためには、以下 2 つの Electron モジュールが必要です。</p>\n<ul>\n<li>アプリケーションのイベントライフサイクルを制御する、<a href=\"/docs/api/app\"><code>app</code></a> モジュール。</li>\n<li>アプリケーションウインドウを作成し管理する <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> モジュール。</li>\n</ul>\n<p>メインプロセスは Node.js で動作するので、これらを <a href=\"https://nodejs.org/docs/latest/api/modules.html#modules_modules_commonjs_modules\">CommonJS</a> モジュールとしてファイル先頭でインポートします。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>次に、<code>createWindow()</code> 関数を追加し、そこで <code>index.html</code> を新規作成した <code>BrowserWindow</code> インスタンスに読み込ませます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n</code></pre>\n<p>次に、この <code>createWindow()</code> 関数を呼び出してウインドウを開きます。</p>\n<p>Electron では、<code>app</code> モジュールの <a href=\"/docs/api/app#event-ready\"><code>ready</code></a> イベントの発生以降のみ、ブラウザウインドウを作成できます。 このイベントは、<a href=\"/docs/api/app#appwhenready\"><code>app.whenReady()</code></a> API を使用することで待てます。 <code>whenReady()</code> が Promise を解決した後、それが <code>createWindow()</code> を呼び出します。</p>\n<pre><code class=\"hljs language-js\">app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n})\n</code></pre>\n<blockquote>\n<p>注: この時点で、Electron アプリケーションはウェブページを表示するウィンドウを開くことに成功しているはずです。</p>\n</blockquote>\n<h3 id=\"ウインドウのライフサイクルを管理する\"><a href=\"#ウインドウのライフサイクルを管理する\">ウインドウのライフサイクルを管理する</a></h3>\n<p>ブラウザウインドウを開くことができるようになりましたが、各プラットフォームでよりネイティブな感じを出すためには、いくつか追加の雛形コードが必要です。 アプリケーションウィンドウは OS ごとに異なる動作をしますが、Electron はこれらの規則をアプリに実装する責任を開発者負担にしています。</p>\n<p>一般的には、<code>process</code> グローバルの <a href=\"https://nodejs.org/api/process.html#process_process_platform\"><code>platform</code></a> 属性を使用して、特定のオペレーティングシステム専用のコードを実行できます。</p>\n<h4 id=\"全ウインドウを閉じた時にアプリを終了する-windows--linux\"><a href=\"#全ウインドウを閉じた時にアプリを終了する-windows--linux\">全ウインドウを閉じた時にアプリを終了する (Windows &#x26; Linux)</a></h4>\n<p>一般的に Windows や Linux では、すべてのウィンドウを終了するとアプリケーションが完全に終了します。</p>\n<p>これを実装するには、<code>app</code> モジュールの <a href=\"/docs/api/app#event-window-all-closed\"><code>'window-all-closed'</code></a> イベントをリッスンします。このイベントが発生し、ユーザーが macOS (<code>darwin</code>) でない場合に <a href=\"/docs/api/app#appquit\"><code>app.quit()</code></a> を呼び出すようにします。</p>\n<pre><code class=\"hljs language-js\">app.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h4 id=\"開いたウインドウがない場合にウインドウを開く-macos\"><a href=\"#開いたウインドウがない場合にウインドウを開く-macos\">開いたウインドウがない場合にウインドウを開く (macOS)</a></h4>\n<p>Linux や Windows のアプリはウインドウを開いていないと終了してしまいますが、macOS のアプリは一般的にウインドウを開いていなくても起動し続け、ウインドウがないときにアプリをアクティブにすると新規ウインドウが開きます。</p>\n<p>この機能を実装するには、<code>app</code> モジュールの <a href=\"/docs/api/app#event-activate-macos\"><code>activate</code></a> イベントをリッスンします。ブラウザのウインドウが開いていなければ、既存の <code>createWindow()</code> メソッドを呼び出します。</p>\n<p><code>ready</code> イベントの前ではウインドウを作成できないので、アプリが初期化された後に <code>activate</code> イベントだけをリッスンする必要があります。 そのためには、既存の <code>whenReady()</code> コールバックの中で、イベントリスナーをアタッチします。</p>\n<pre><code class=\"hljs language-js\">app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) createWindow()\n  })\n})\n</code></pre>\n<blockquote>\n<p>注: この時点で、ウインドウのコントロールが完全に機能しているはずです。</p>\n</blockquote>\n<h3 id=\"プリロードスクリプトを使ってレンダラーから-nodejs-にアクセスする\"><a href=\"#プリロードスクリプトを使ってレンダラーから-nodejs-にアクセスする\">プリロードスクリプトを使ってレンダラーから Node.js にアクセスする</a></h3>\n<p>さて、最後にやるべきことは Electron とその依存関係のバージョン番号をウェブページに出力することです。</p>\n<p>この情報へアクセスするには、Node のグローバルである <code>process</code> オブジェクトを介してメインプロセスで行うのが簡単です。 しかし、メインプロセスはレンダラーの <code>document</code> コンテキストにアクセスできないため、メインプロセスから DOM を編集できません。 これらは全く別のプロセスだからです！</p>\n<blockquote>\n<p>注: Electron のプロセスについてもっと詳しく知りたい方は、<a href=\"/docs/tutorial/process-model\">プロセスモデル</a> のドキュメントをご覧ください。</p>\n</blockquote>\n<p>そこで、<strong>プリロード</strong> スクリプトをレンダラーにアタッチすると便利です。 プリロードスクリプトは、レンダラープロセスが読み込まれる前に実行され、レンダラーのグローバル (<code>window</code> や <code>document</code> など) と Node.js 環境の両方にアクセスできます。</p>\n<p><code>preload.js</code> という名前の新規スクリプトを以下のように作成します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'DOMContentLoaded'</span>, () => {\n  <span class=\"hljs-keyword\">const</span> replaceText = <span class=\"hljs-function\">(<span class=\"hljs-params\">selector, text</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> element = <span class=\"hljs-built_in\">document</span>.getElementById(selector)\n    <span class=\"hljs-keyword\">if</span> (element) element.innerText = text\n  }\n\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> dependency <span class=\"hljs-keyword\">of</span> [<span class=\"hljs-string\">'chrome'</span>, <span class=\"hljs-string\">'node'</span>, <span class=\"hljs-string\">'electron'</span>]) {\n    replaceText(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${dependency}</span>-version`</span>, process.versions[dependency])\n  }\n})\n</code></pre>\n<p>上記のコードでは、Node.js の <code>process.versions</code> オブジェクトにアクセスし、基本的な <code>replaceText</code> ヘルパー関数を実行して HTML ドキュメントにバージョン番号を挿入しています。</p>\n<p>このスクリプトをレンダラープロセスにアタッチするには、既存の <code>BrowserWindow</code> コンストラクタの <code>webPreferences.preload</code> 引数にプリロードスクリプトへのパスを渡します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// ファイルの先頭で Node.js の 'path' モジュールをインクルードします</span>\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-comment\">// 既存の createWindow() 関数を修正します</span>\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n        <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n<span class=\"hljs-comment\">// ...</span>\n</code></pre>\n<p>ここでは、以下 2 つの Node.js のコンセプトが使われています。</p>\n<ul>\n<li><a href=\"https://nodejs.org/api/modules.html#modules_dirname\"><code>__dirname</code></a> 文字列は、現在実行中のスクリプトのパス (ここではプロジェクトのルートフォルダ) を指しています。</li>\n<li><a href=\"https://nodejs.org/api/path.html#path_path_join_paths\"><code>path.join</code></a> API は、複数のパス断片を結合し、すべてのプラットフォームで動作する結合パス文字列を作成します。</li>\n</ul>\n<p>現在実行中の JavaScript ファイルからの相対パスを使用しているので、開発モードとパッケージモードの両方で相対パスが機能します。</p>\n<h3 id=\"おまけ-ウェブコンテンツに機能を追加する\"><a href=\"#おまけ-ウェブコンテンツに機能を追加する\">おまけ: ウェブコンテンツに機能を追加する</a></h3>\n<p>この時点で、アプリケーションに機能を追加するにはどうしたらよいかと思われるかもしれません。</p>\n<p>ウェブコンテンツとやり取りする場合は、レンダラープロセスにスクリプトを追加する必要があります。 なぜならレンダラは通常のウェブ環境で動作するので、<code>&#x3C;script></code> タグを <code>index.html</code> ファイルの最後の <code>&#x3C;/body></code> タグの直前に追加して任意のスクリプトをインクルードできます。</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"./renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<p><code>renderer.js</code> に含まれるコードは、<a href=\"https://webpack.js.org\"><code>webpack</code></a> でコードをバンドルして最小化したり、<a href=\"https://reactjs.org\">React</a> を使用してユーザーインターフェースを管理するなど、一般的なフロントエンド開発と同じ JavaScript API やツールを利用できます。</p>\n<h3 id=\"まとめ\"><a href=\"#まとめ\">まとめ</a></h3>\n<p>以上の手順により、以下のような完全な機能の Electron のアプリケーションが完成しました。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/simplest-electron-app.png\" alt=\"シンプルな Electron アプリ\"></p>\n<!--TODO(erickzhao): Remove the individual code blocks for static website -->\n<p>コード全体は以下のとおりです。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\n\n<span class=\"hljs-comment\">// アプリケーションの寿命の制御と、ネイティブなブラウザウインドウを作成するモジュール</span>\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-comment\">// ブラウザウインドウを作成します。</span>\n  <span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  <span class=\"hljs-comment\">// そしてアプリの index.html を読み込みます。</span>\n  mainWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-comment\">// デベロッパー ツールを開きます。</span>\n  <span class=\"hljs-comment\">// mainWindow.webContents.openDevTools()</span>\n}\n\n<span class=\"hljs-comment\">// このメソッドは、Electron の初期化が完了し、</span>\n<span class=\"hljs-comment\">// ブラウザウインドウの作成準備ができたときに呼ばれます。</span>\n<span class=\"hljs-comment\">// 一部のAPIはこのイベントが発生した後にのみ利用できます。</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n    <span class=\"hljs-comment\">// macOS では、Dock アイコンのクリック時に他に開いているウインドウがない</span>\n    <span class=\"hljs-comment\">// 場合、アプリ内にウインドウを再作成するのが一般的です。</span>\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) createWindow()\n  })\n})\n\n<span class=\"hljs-comment\">// macOS を除き、全ウインドウが閉じられたときに終了します。 ユーザーが</span>\n<span class=\"hljs-comment\">// Cmd + Q で明示的に終了するまで、アプリケーションとそのメニューバーを</span>\n<span class=\"hljs-comment\">// アクティブにするのが一般的です。</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n\n<span class=\"hljs-comment\">// このファイルでは、アプリ内のとある他のメインプロセスコードを</span>\n<span class=\"hljs-comment\">// インクルードできます。 </span>\n<span class=\"hljs-comment\">// 別々のファイルに分割してここで require することもできます。</span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// preload.js</span>\n\n<span class=\"hljs-comment\">// Node.js の全 API は、プリロードプロセスで利用可能です。</span>\n<span class=\"hljs-comment\">// Chrome 拡張機能と同じサンドボックスも持っています。</span>\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'DOMContentLoaded'</span>, () => {\n  <span class=\"hljs-keyword\">const</span> replaceText = <span class=\"hljs-function\">(<span class=\"hljs-params\">selector, text</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> element = <span class=\"hljs-built_in\">document</span>.getElementById(selector)\n    <span class=\"hljs-keyword\">if</span> (element) element.innerText = text\n  }\n\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> dependency <span class=\"hljs-keyword\">of</span> [<span class=\"hljs-string\">'chrome'</span>, <span class=\"hljs-string\">'node'</span>, <span class=\"hljs-string\">'electron'</span>]) {\n    replaceText(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${dependency}</span>-version`</span>, process.versions[dependency])\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!--index.html--></span>\n\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-comment\">&#x3C;!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"X-Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    We are using Node.js <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"node-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    Chromium <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"chrome-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    and Electron <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"electron-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>.\n\n    <span class=\"hljs-comment\">&#x3C;!-- このプロセスで他ファイルを require して実行することもできます --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"./renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>これまでのステップを以下にまとめます。</p>\n<ul>\n<li>\n<p>Node.js アプリケーションを立ち上げ、Electron を依存関係に追加しました。</p>\n</li>\n<li>\n<p>アプリ制御を担うメインプロセスを実行する <code>main.js</code> スクリプトを作成し、Node.js 環境で動作させました。 このスクリプトでは、Electron の <code>app</code> と <code>BrowserWindow</code> モジュールを使って、ウェブコンテンツを別のプロセス (レンダラー) で表示するブラウザウインドウを作成しました。</p>\n</li>\n<li>\n<p>レンダラーで特定の Node.js の機能にアクセスするために、<code>BrowserWindow</code> のコンストラクタでプリロードスクリプトをアタッチしました。</p>\n</li>\n</ul>\n<h2 id=\"アプリケーションのパッケージと頒布\"><a href=\"#アプリケーションのパッケージと頒布\">アプリケーションのパッケージと頒布</a></h2>\n<p>できたてのアプリを頒布する最速手段は <a href=\"https://www.electronforge.io\">Electron Forge</a> を利用する方法です。</p>\n<ol>\n<li>\n<p>アプリの開発用依存関係に Electron Forge を追加し、その <code>import</code> コマンドで Forge のセットアップをします。</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev @electron-forge/cli\nnpx electron-forge import\n\n✔ Checking your system\n✔ Initializing Git Repository\n✔ Writing modified package.json file\n✔ Installing dependencies\n✔ Writing modified package.json file\n✔ Fixing .gitignore\n\nWe have ATTEMPTED to convert your app to be <span class=\"hljs-keyword\">in</span> a format that electron-forge understands.\n\nThanks <span class=\"hljs-keyword\">for</span> using <span class=\"hljs-string\">\"electron-forge\"</span>!!!\n</code></pre>\n</li>\n<li>\n<p>以下のように Forge の <code>make</code> コマンドで頒布形式を作成します。</p>\n<pre><code class=\"hljs language-sh\">npm run make\n\n> my-electron-app@1.0.0 make /my-electron-app\n> electron-forge make\n\n✔ Checking your system\n✔ Resolving Forge Config\nWe need to package your application before we can make it\n✔ Preparing to Package Application <span class=\"hljs-keyword\">for</span> arch: x64\n✔ Preparing native dependencies\n✔ Packaging Application\nMaking <span class=\"hljs-keyword\">for</span> the following targets: zip\n✔ Making <span class=\"hljs-keyword\">for</span> target: zip - On platform: darwin - For arch: x64\n</code></pre>\n<p>Electron Forge は、<code>out</code> フォルダを作成してそこにパッケージを配置します。</p>\n<pre><code class=\"hljs language-plain\">// macOS 版の例\nout/\n├── out/make/zip/darwin/x64/my-electron-app-darwin-x64-1.0.0.zip\n├── ...\n└── out/my-electron-app-darwin-x64/my-electron-app.app/Contents/MacOS/my-electron-app\n</code></pre>\n</li>\n</ol>",
      "title": "クイック スタート",
      "description": "お使いのプラットフォーム向けのビルド済みインストーラを使用して、Node.js をインストールするようにしてください。 さもなくば、他の開発ツールと互換性の問題が発生することがあります。"
    },
    "/docs/README": {
      "locale": "ja-JP",
      "slug": "README",
      "href": "/docs/README",
      "crowdinFileId": "256115",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/README.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"公式ガイド\"><a href=\"#公式ガイド\">公式ガイド</a></h1>\n<p>電子版に合致するドキュメントを使用していることを確認してください。 バージョン番号は、ページ URL の一部である必要があります。 そうでなければ、おそらく、お使 いの電子版と互換性のないAPI 変更を含む可能性のある開発ブランチのドキュメントを使用している可能性があります。 古いバージョンのドキュメントを読むには、GitHub上で<a href=\"https://github.com/electron/electron/tree/v1.4.0\">タグを見て</a>みてください。\"Switch branches/tags\" のドロップダウンメニューを開いて、あなたが使っているバージョンと同じタグを選んでください。</p>\n<h2 id=\"faq\"><a href=\"#faq\">FAQ</a></h2>\n<p>ここにはよく聞かれる質問が載っています。 Issue を作成する前に、こちらを確認してください。</p>\n<ul>\n<li><a href=\"/docs/faq\">Electron FAQ</a></li>\n</ul>\n<h2 id=\"ガイドとチュートリアル\"><a href=\"#ガイドとチュートリアル\">ガイドとチュートリアル</a></h2>\n<h3 id=\"はじめましょう\"><a href=\"#はじめましょう\">はじめましょう</a></h3>\n<ul>\n<li><a href=\"/docs/tutorial/introduction\">はじめに</a></li>\n<li><a href=\"/docs/tutorial/quick-start\">クイック スタート</a></li>\n<li><a href=\"/docs/tutorial/process-model\">プロセスモデル</a></li>\n</ul>\n<h3 id=\"基礎を学ぶ\"><a href=\"#基礎を学ぶ\">基礎を学ぶ</a></h3>\n<ul>\n<li>アプリに機能を追加する<ul>\n<li><a href=\"/docs/tutorial/notifications\">通知</a></li>\n<li><a href=\"/docs/tutorial/recent-documents\">最近使用したドキュメント</a></li>\n<li><a href=\"/docs/tutorial/progress-bar\">アプリケーションの進行状況</a></li>\n<li><a href=\"/docs/tutorial/macos-dock\">カスタム Dock メニュー</a></li>\n<li><a href=\"/docs/tutorial/windows-taskbar\">カスタム Windows タスクバー</a></li>\n<li><a href=\"/docs/tutorial/linux-desktop-actions\">カスタム Linux デスクトップアクション</a></li>\n<li><a href=\"/docs/tutorial/keyboard-shortcuts\">キーボード ショート カット</a></li>\n<li><a href=\"/docs/tutorial/online-offline-events\">オフライン/オンライン検出</a></li>\n<li><a href=\"/docs/tutorial/represented-file\">macOS の BrowserWindow の Represented File</a></li>\n<li><a href=\"/docs/tutorial/native-file-drag-drop\">ネイティブなファイルのドラッグ&#x26;ドロップ</a></li>\n<li><a href=\"/docs/tutorial/offscreen-rendering\">オフスクリーンレンダリング</a></li>\n<li><a href=\"/docs/tutorial/dark-mode\">ダークモード</a></li>\n<li><a href=\"/docs/tutorial/web-embeds\">Electron でのウェブ埋め込み</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis\">ボイラープレートとCLI</a><ul>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#boilerplate-vs-cli\">ボイラープレート vs CLI</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-forge\">electron-forge</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-builder\">electron-builder</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-react-boilerplate\">electron-react-boilerplate</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#other-tools-and-boilerplates\">その他のツール、ボイラープレート</a></li>\n</ul></li>\n</ul>\n<h3 id=\"高度なトピック\"><a href=\"#高度なトピック\">高度なトピック</a></h3>\n<ul>\n<li>アプリケーションアーキテクチャ<ul>\n<li><a href=\"/docs/tutorial/using-native-node-modules\">ネイティブ Node.js モジュールを使用する</a></li>\n<li><a href=\"/docs/tutorial/performance\">パフォーマンス戦略</a></li>\n<li><a href=\"/docs/tutorial/security\">セキュリティ戦略</a></li>\n<li><a href=\"/docs/tutorial/sandbox\">プロセスのサンドボックス化</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/accessibility\">アクセシビリティ</a><ul>\n<li><a href=\"/docs/tutorial/accessibility#manually-enabling-accessibility-features\">アクセシビリティ機能を手動で有効にする</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/application-debugging\">テストとデバッグ</a><ul>\n<li><a href=\"/docs/tutorial/debugging-main-process\">メインプロセスのデバッグ</a></li>\n<li><a href=\"/docs/tutorial/debugging-vscode\">Visual Studio コードを使用したデバッグ</a></li>\n<li><a href=\"/docs/tutorial/using-selenium-and-webdriver\">SeleniumとWebDriverを使用する</a></li>\n<li><a href=\"/docs/tutorial/testing-on-headless-ci\">ヘッドレスCIシステムでのテスト (Travis, Jenkins)</a></li>\n<li><a href=\"/docs/tutorial/devtools-extension\">DevTools エクステンション</a></li>\n<li><a href=\"/docs/tutorial/automated-testing-with-a-custom-driver\">カスタムドライバーを使った自動テスト</a></li>\n<li><a href=\"/docs/tutorial/repl\">REPL</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/application-distribution\">配布方法</a><ul>\n<li><a href=\"/docs/tutorial/support#supported-platforms\">サポートされているプラットフォーム</a></li>\n<li><a href=\"/docs/tutorial/code-signing\">コード署名</a></li>\n<li><a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store</a></li>\n<li><a href=\"/docs/tutorial/windows-store-guide\">Windows Store</a></li>\n<li><a href=\"/docs/tutorial/snapcraft\">Snapcraft</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/updates\">アップデート</a><ul>\n<li><a href=\"/docs/tutorial/updates#deploying-an-update-server\">アップロードサーバーを配備</a></li>\n<li><a href=\"/docs/tutorial/updates#implementing-updates-in-your-app\">アプリケーションでの更新の実装</a></li>\n<li><a href=\"/docs/tutorial/updates#applying-updates\">アップデートの適用</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/support\">サポートを受ける</a></li>\n</ul>\n<h2 id=\"詳細なチュートリアル\"><a href=\"#詳細なチュートリアル\">詳細なチュートリアル</a></h2>\n<p>これらの個別のチュートリアルでは、上のガイドで説明したトピックを拡張しています。</p>\n<ul>\n<li><a href=\"/docs/tutorial/installation\">Electron のインストール</a><ul>\n<li><a href=\"/docs/tutorial/installation#proxies\">プロキシ環境下</a></li>\n<li><a href=\"/docs/tutorial/installation#custom-mirrors-and-caches\">ミラーとキャッシュのカスタマイズ</a></li>\n<li><a href=\"/docs/tutorial/installation#troubleshooting\">トラブルシューティング</a></li>\n</ul></li>\n<li>Electron のリリース &#x26; 開発者のフィードバック<ul>\n<li><a href=\"/docs/tutorial/electron-versioning\">バージョンポリシー</a></li>\n<li><a href=\"/docs/tutorial/electron-timelines\">リリースタイムライン</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/testing-widevine-cdm\">Widevine CDM のテスト</a></li>\n</ul>\n<hr>\n<ul>\n<li><a href=\"/docs/glossary\">用語集</a></li>\n</ul>\n<h2 id=\"api-リファレンス\"><a href=\"#api-リファレンス\">API リファレンス</a></h2>\n<ul>\n<li><a href=\"/docs/api/synopsis\">概要</a></li>\n<li><a href=\"/docs/api/process\">プロセスオブジェクト</a></li>\n<li><a href=\"/docs/api/command-line-switches\">サポートしているコマンドラインスイッチ</a></li>\n<li><a href=\"/docs/api/environment-variables\">環境変数</a></li>\n<li><a href=\"/docs/api/extensions\">Chrome 拡張機能サポート</a></li>\n<li><a href=\"/docs/breaking-changes\">API の破壊的変更</a></li>\n</ul>\n<h3 id=\"カスタム-dom-要素\"><a href=\"#カスタム-dom-要素\">カスタム DOM 要素</a></h3>\n<ul>\n<li><a href=\"/docs/api/file-object\"><code>File</code>オブジェクト</a></li>\n<li><a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code>タグ</a></li>\n<li><a href=\"/docs/api/window-open\"><code>window.open</code>関数</a></li>\n<li><a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code> Object</a></li>\n</ul>\n<h3 id=\"メインプロセスのモジュール\"><a href=\"#メインプロセスのモジュール\">メインプロセスのモジュール</a></h3>\n<ul>\n<li><a href=\"/docs/api/app\">app</a></li>\n<li><a href=\"/docs/api/auto-updater\">autoUpdater</a></li>\n<li><a href=\"/docs/api/browser-view\">BrowserView</a></li>\n<li><a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n<li><a href=\"/docs/api/content-tracing\">contentTracing</a></li>\n<li><a href=\"/docs/api/dialog\">dialog</a></li>\n<li><a href=\"/docs/api/global-shortcut\">globalShortcut</a></li>\n<li><a href=\"/docs/api/in-app-purchase\">inAppPurchase</a></li>\n<li><a href=\"/docs/api/ipc-main\">ipcMain</a></li>\n<li><a href=\"/docs/api/menu\">Menu</a></li>\n<li><a href=\"/docs/api/menu-item\">MenuItem</a></li>\n<li><a href=\"/docs/api/message-channel-main\">MessageChannelMain</a></li>\n<li><a href=\"/docs/api/message-port-main\">MessagePortMain</a></li>\n<li><a href=\"/docs/api/net\">net</a></li>\n<li><a href=\"/docs/api/net-log\">netLog</a></li>\n<li><a href=\"/docs/api/native-theme\">nativeTheme</a></li>\n<li><a href=\"/docs/api/notification\">Notification</a></li>\n<li><a href=\"/docs/api/power-monitor\">powerMonitor</a></li>\n<li><a href=\"/docs/api/power-save-blocker\">powerSaveBlocker</a></li>\n<li><a href=\"/docs/api/protocol\">protocol</a></li>\n<li><a href=\"/docs/api/screen\">screen</a></li>\n<li><a href=\"/docs/api/session\">session</a></li>\n<li><a href=\"/docs/api/share-menu\">ShareMenu</a></li>\n<li><a href=\"/docs/api/system-preferences\">systemPreferences</a></li>\n<li><a href=\"/docs/api/touch-bar\">TouchBar</a></li>\n<li><a href=\"/docs/api/tray\">Tray</a></li>\n<li><a href=\"/docs/api/web-contents\">webContents</a></li>\n<li><a href=\"/docs/api/web-frame-main\">webFrameMain</a></li>\n</ul>\n<h3 id=\"レンダラープロセス-webページ-のモジュール\"><a href=\"#レンダラープロセス-webページ-のモジュール\">レンダラープロセス (Webページ) のモジュール</a></h3>\n<ul>\n<li><a href=\"/docs/api/context-bridge\">contextBridge</a></li>\n<li><a href=\"/docs/api/ipc-renderer\">ipcRenderer</a></li>\n<li><a href=\"/docs/api/web-frame\">webFrame</a></li>\n</ul>\n<h3 id=\"メインプロセス・レンダラープロセスのモジュール\"><a href=\"#メインプロセス・レンダラープロセスのモジュール\">メインプロセス・レンダラープロセスのモジュール</a></h3>\n<ul>\n<li><a href=\"/docs/api/clipboard\">clipboard </a></li>\n<li><a href=\"/docs/api/crash-reporter\">crashReporter</a></li>\n<li><a href=\"/docs/api/desktop-capturer\">desktopCapturer</a></li>\n<li><a href=\"/docs/api/native-image\">nativeImage</a></li>\n<li><a href=\"/docs/api/shell\">shell</a></li>\n</ul>\n<h2 id=\"開発\"><a href=\"#開発\">開発</a></h2>\n<p><a href=\"/docs/development/README\">development/README.md</a> を参照してください</p>",
      "title": "公式ガイド",
      "description": ""
    },
    "/docs/development/README": {
      "locale": "ja-JP",
      "slug": "README",
      "href": "/docs/development/README",
      "crowdinFileId": "256127",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/README.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"electron-の開発\"><a href=\"#electron-の開発\">Electron の開発</a></h1>\n<p>これらのガイドは、Electron プロジェクトそのものに取り組む人を対象にしています。 Electron アプリ開発のガイドについては、<a href=\"/docs/README#guides-and-tutorials\">/docs/README.md</a> を参照してください。</p>\n<ul>\n<li><a href=\"https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md\">行動規範</a></li>\n<li><a href=\"https://github.com/electron/electron/blob/main/CONTRIBUTING.md\">Electron にコントリビュートする</a></li>\n<li><a href=\"/docs/development/issues\">Issues</a></li>\n<li><a href=\"/docs/development/pull-requests\">プルリクエスト</a></li>\n<li><a href=\"/docs/development/coding-style#documentation\">ドキュメントガイド</a></li>\n<li><a href=\"/docs/development/source-code-directory-structure\">ソースコードのディレクトリ構造</a></li>\n<li><a href=\"/docs/development/coding-style\">コーディング スタイル</a></li>\n<li><a href=\"/docs/development/clang-format\">C++のコードにclang-formatを使用する</a></li>\n<li><a href=\"/docs/development/clang-tidy\">C++ コードに clang-tidy を使用する</a></li>\n<li><a href=\"/docs/development/build-system-overview\">ビルドシステムの概要</a></li>\n<li><a href=\"/docs/development/build-instructions-macos\">ビルド手順 (macOS)</a></li>\n<li><a href=\"/docs/development/build-instructions-windows\">ビルド手順 (Windows)</a></li>\n<li><a href=\"/docs/development/build-instructions-linux\">ビルド手順 (Linux)</a></li>\n<li><a href=\"/docs/development/chromium-development\">Chromium開発</a></li>\n<li><a href=\"/docs/development/v8-development\">V8 開発</a></li>\n<li><a href=\"/docs/development/testing\">テスト</a></li>\n<li><a href=\"/docs/development/debug-instructions-windows\">Windows におけるデバッグ</a></li>\n<li><a href=\"/docs/development/debugging-instructions-macos\">macOS におけるデバッグ</a></li>\n<li><a href=\"/docs/development/setting-up-symbol-server\">デバッガでシンボルサーバを設定</a></li>\n<li><a href=\"/docs/development/patches\">パッチ</a></li>\n</ul>",
      "title": "Electron の開発",
      "description": ""
    },
    "/docs/tutorial/recent-documents": {
      "locale": "ja-JP",
      "slug": "recent-documents",
      "href": "/docs/tutorial/recent-documents",
      "crowdinFileId": "256239",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/recent-documents.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"最近使った書類-windows--macos\"><a href=\"#最近使った書類-windows--macos\">最近使った書類 (Windows &#x26; macOS)</a></h1>\n<h2 id=\"概要\"><a href=\"#概要\">概要</a></h2>\n<p>Windows と macOS は、それぞれジャンプリストまたは Dock メニューを介して、アプリケーションによって開かれた最近の書類のリストへのアクセスを提供します。</p>\n<p><strong>ジャンプリスト:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/2289/23446924/11a27b98-fdfc-11e6-8485-cc3b1e86b80a.png\" alt=\"ジャンプリストの最近使った書類\"></p>\n<p><strong>アプリケーションの Dock メニュー:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5069610/2aa80758-6e97-11e4-8cfb-c1a414a10774.png\" alt=\"macOS の Dock メニュー\"></p>\n<h2 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h2>\n<h3 id=\"最近開いた書類の管理\"><a href=\"#最近開いた書類の管理\">最近開いた書類の管理</a></h3>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/recent-documents\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\n<span class=\"hljs-keyword\">const</span> fileName = <span class=\"hljs-string\">'recently-used.md'</span>\nfs.writeFile(fileName, <span class=\"hljs-string\">'Lorem Ipsum'</span>, () => {\n  app.addRecentDocument(path.join(__dirname, fileName))\n})\n\napp.whenReady().then(createWindow)\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  app.clearRecentDocuments()\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<h4 id=\"最近開いた書類の追加\"><a href=\"#最近開いた書類の追加\">最近開いた書類の追加</a></h4>\n<p>最近開いた書類にファイルを追加するには、<a href=\"/docs/api/app#appaddrecentdocumentpath-macos-windows\">app.addRecentDocument</a> API を使用します。</p>\n<p>Electron アプリケーションの起動後、アプリケーションのアイコンを右クリックしてみましょう。 このガイドでは、そのアイテムはプロジェクトのルートにある Markdown ファイルとなっています。 最近開いたファイルのリストに <code>recently-used.md</code> が追加されているはずです。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/recent-documents.png\" alt=\"最近使った書類\"></p>\n<h4 id=\"最近開いた書類の消去\"><a href=\"#最近開いた書類の消去\">最近開いた書類の消去</a></h4>\n<p>最近開いた書類のリストを消去するには、<a href=\"/docs/api/app#appclearrecentdocuments-macos-windows\">app.clearRecentDocuments</a> API を使用します。 このガイドでは、すべてのウインドウを閉じた時点でその書類のリストは消去されます。</p>\n<h2 id=\"さらなる情報\"><a href=\"#さらなる情報\">さらなる情報</a></h2>\n<h3 id=\"windows-での注意\"><a href=\"#windows-での注意\">Windows での注意</a></h3>\n<p>Windows でこの機能を使用する際にアプリケーションが書類のファイルタイプのハンドラとして登録されていない場合、ファイルを追加してもジャンプリストに表示されません。 アプリケーションの登録については、<a href=\"https://msdn.microsoft.com/en-us/library/cc144104(VS.85).aspx\">Application Registration</a> にすべて記載されています。</p>\n<p>ユーザーがジャンプリストからファイルをクリックすると、アプリケーションの新しいインスタンスが、ファイルのパスがコマンドライン引数として追加されて起動されます。</p>\n<h3 id=\"macos-での注意\"><a href=\"#macos-での注意\">macOS での注意</a></h3>\n<h4 id=\"アプリケーションメニューに最近開いた書類を追加する\"><a href=\"#アプリケーションメニューに最近開いた書類を追加する\">アプリケーションメニューに最近開いた書類を追加する</a></h4>\n<p>以下のコードスニペットをメニューテンプレートに追加することで、最近開いた書類にアクセスしたり消去したりするメニュー項目を追加できます。</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"submenu\"</span>:[\n    {\n      <span class=\"hljs-attr\">\"label\"</span>:<span class=\"hljs-string\">\"Open Recent\"</span>,\n      <span class=\"hljs-attr\">\"role\"</span>:<span class=\"hljs-string\">\"recentdocuments\"</span>,\n      <span class=\"hljs-attr\">\"submenu\"</span>:[\n        {\n          <span class=\"hljs-attr\">\"label\"</span>:<span class=\"hljs-string\">\"Clear Recent\"</span>,\n          <span class=\"hljs-attr\">\"role\"</span>:<span class=\"hljs-string\">\"clearrecentdocuments\"</span>\n        }\n      ]\n    }\n  ]\n}\n</code></pre>\n<p>以下のようにアプリケーションメニューを <a href=\"/docs/api/app#event-ready\"><code>'ready'</code></a> イベントより後に追加し、それより前では追加しないようにしてください。さもなくばメニューアイテムは無効になります。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> template = [\n  <span class=\"hljs-comment\">// メニューテンプレートをこちらに</span>\n]\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  Menu.setApplicationMenu(menu)\n})\n</code></pre>\n<p><img src=\"https://user-images.githubusercontent.com/3168941/33003655-ea601c3a-cd70-11e7-97fa-7c062149cfb1.png\" alt=\"macOS 最近使った書類のメニューアイテム\"></p>\n<p>最近使った書類メニューからファイルが要求されると、それに対して <code>app</code> モジュールの <code>open-file</code> イベントが発生します。</p>",
      "title": "最近使った書類 (Windows & macOS)",
      "description": ""
    },
    "/docs/api/structures/rectangle": {
      "locale": "ja-JP",
      "slug": "rectangle",
      "href": "/docs/api/structures/rectangle",
      "crowdinFileId": "256493",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/rectangle.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"rectangle-object\"><a href=\"#rectangle-object\">Rectangle Object</a></h1>\n<ul>\n<li><code>x</code> Number - The x coordinate of the origin of the rectangle (must be an integer).</li>\n<li><code>y</code> Number - The y coordinate of the origin of the rectangle (must be an integer).</li>\n<li><code>width</code> Number - The width of the rectangle (must be an integer).</li>\n<li><code>height</code> Number - The height of the rectangle (must be an integer).</li>\n</ul>",
      "title": "Rectangle Object",
      "description": ""
    },
    "/docs/api/structures/referrer": {
      "locale": "ja-JP",
      "slug": "referrer",
      "href": "/docs/api/structures/referrer",
      "crowdinFileId": "256495",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/referrer.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"referrer-object\"><a href=\"#referrer-object\">Referrer Object</a></h1>\n<ul>\n<li><code>url</code> String - HTTP Referrer URL.</li>\n<li><code>policy</code> String - Can be <code>default</code>, <code>unsafe-url</code>, <code>no-referrer-when-downgrade</code>, <code>no-referrer</code>, <code>origin</code>, <code>strict-origin-when-cross-origin</code>, <code>same-origin</code> or <code>strict-origin</code>. See the <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy\">Referrer-Policy spec</a> for more details on the meaning of these values.</li>\n</ul>",
      "title": "Referrer Object",
      "description": ""
    },
    "/docs/tutorial/repl": {
      "locale": "ja-JP",
      "slug": "repl",
      "href": "/docs/tutorial/repl",
      "crowdinFileId": "256241",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/repl.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"repl\"><a href=\"#repl\">REPL</a></h1>\n<p><a href=\"https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop\">Read-Eval-Print-Loop</a> (REPL, レプル) はシンプルな対話型コンピュータープログラミング環境で、単一のユーザー入力 (すなわち単一の式) を受け取り、それらを評価して結果をユーザーへ返します。</p>\n<h2 id=\"メインプロセス\"><a href=\"#メインプロセス\">メインプロセス</a></h2>\n<p>Electron は <code>--interactive</code> CLI フラグに応じてその <a href=\"https://nodejs.org/dist/latest/docs/api/repl.html\">Node.js <code>repl</code> モジュール</a> を公開します。 ローカルプロジェクトの依存関係として <code>electron</code> がインストールされていれば、以下のコマンドで REPL にアクセスできるはずです。</p>\n<pre><code class=\"hljs language-sh\">./node_modules/.bin/electron --interactive\n</code></pre>\n<p><strong>注意:</strong> <code>electron --interactive</code> は Windows では利用できません (詳細は <a href=\"https://github.com/electron/electron/pull/5776\">electron/electron#5776</a> をご参照ください)。</p>\n<h2 id=\"レンダラープロセス\"><a href=\"#レンダラープロセス\">レンダラープロセス</a></h2>\n<p>デベロッパー ツールの Console タブを使用すれば、あらゆるレンダラープロセスで REPL ができます。 より詳しく学びたい方は、<a href=\"https://developer.chrome.com/docs/devtools/console/\">Chrome ドキュメント</a> をご覧ください。</p>",
      "title": "REPL",
      "description": ""
    },
    "/docs/tutorial/represented-file": {
      "locale": "ja-JP",
      "slug": "represented-file",
      "href": "/docs/tutorial/represented-file",
      "crowdinFileId": "256243",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/represented-file.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"browserwindow-が表すファイル-macos\"><a href=\"#browserwindow-が表すファイル-macos\">BrowserWindow が表すファイル (macOS)</a></h1>\n<h2 id=\"概要\"><a href=\"#概要\">概要</a></h2>\n<p>macOS では、アプリケーション内の任意のウインドウに表示中のファイルを設定できます。 表現中ファイルのアイコンはタイトルバーに表示され、ユーザーが <code>Command-Click</code> や <code>Control-Click</code> クリックをすると、ファイルへのパスを含むポップアップが表示されます。</p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5082061/670a949a-6f14-11e4-987a-9aaa04b23c1d.png\" alt=\"ウインドウが表すファイル\"></p>\n<blockquote>\n<p>注意: 上のスクリーンショットは、Atom テキストエディタで現在開いているファイルを表示するためにこの機能を使用している例です。</p>\n</blockquote>\n<p>ウインドウの編集状態を設定し、このウィンドウ内の書類が変更されたかどうかをファイルアイコンで表示することもできます。</p>\n<p>ウィンドウの表示中ファイルを設定するには、<a href=\"/docs/api/browser-window#winsetrepresentedfilenamefilename-macos\">BrowserWindow.setRepresentedFilename</a> と <a href=\"/docs/api/browser-window#winsetdocumenteditededited-macos\">BrowserWindow.setDocumentEdited</a> の API を使用します。</p>\n<h2 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h2>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/represented-file\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>);\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.setRepresentedFilename(os.homedir())\n  win.setDocumentEdited(<span class=\"hljs-literal\">true</span>)\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<p>Electron アプリケーションを起動した後、<code>Command</code> または <code>Control</code> キーを押した状態でタイトルをクリックします。 すると、ウインドウが表すファイルのポップアップが上部に表示されるはずです。 このガイドでは、これはユーザのホームディレクトリです。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/represented-file.png\" alt=\"表示中のファイル\"></p>",
      "title": "BrowserWindow が表すファイル (macOS)",
      "description": "注意: 上のスクリーンショットは、Atom テキストエディタで現在開いているファイルを表示するためにこの機能を使用している例です。"
    },
    "/docs/api/safe-storage": {
      "locale": "ja-JP",
      "slug": "safe-storage",
      "href": "/docs/api/safe-storage",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/safe-storage.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"safestorage\"><a href=\"#safestorage\">safeStorage</a></h1>\n<blockquote>\n<p>文字列をローカルマシンに保管するにあたって簡単な暗号化と復号へのアクセスを可能にします。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>このモジュールは、ディスクに保存されたデータを、フルディスクアクセス権のある他のアプリケーションやユーザのアクセスから保護します。</p>\n<p>なお、Mac ではシステムのキーチェーンへのアクセスが必要であり、これらの呼び出しがユーザ入力の収集のために現在のスレッドをブロックすることがあります。 パスワード管理ツールが利用可能な場合、Linux でも同じことが言えます。</p>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>safeStorage</code> モジュールには以下のメソッドがあります。</p>\n<h3 id=\"safestorageisencryptionavailable\"><a href=\"#safestorageisencryptionavailable\"><code>safeStorage.isEncryptionAvailable()</code></a></h3>\n<p>戻り値 <code>Boolean</code> - 暗号化が利用可能かどうか。</p>\n<p>Linux では、秘密鍵が利用可能であれば true を返します。 MacOS では、キーチェーンが利用可能な場合は true を返します。 Windows では、他の前提条件なしに true を返します。</p>\n<h3 id=\"safestorageencryptstringplaintext\"><a href=\"#safestorageencryptstringplaintext\"><code>safeStorage.encryptString(plainText)</code></a></h3>\n<ul>\n<li><code>plainText</code> String</li>\n</ul>\n<p>戻り値 <code>Buffer</code> -  暗号化した文字列を表すバイトの配列。</p>\n<p>この関数は、暗号化に失敗するとエラーを送出します。</p>\n<h3 id=\"safestoragedecryptstringencrypted\"><a href=\"#safestoragedecryptstringencrypted\"><code>safeStorage.decryptString(encrypted)</code></a></h3>\n<ul>\n<li><code>encrypted</code> Buffer</li>\n</ul>\n<p>戻り値 <code>String</code> - 復号した文字列。 <code>safeStorage.encryptString</code> で得た暗号化されたバッファを、文字列に復号します。</p>\n<p>この関数は、復号に失敗するとエラーを送出します。</p>",
      "title": "safeStorage",
      "description": "文字列をローカルマシンに保管するにあたって簡単な暗号化と復号へのアクセスを可能にします。"
    },
    "/docs/tutorial/sandbox": {
      "locale": "ja-JP",
      "slug": "sandbox",
      "href": "/docs/tutorial/sandbox",
      "crowdinFileId": "256245",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/sandbox.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"プロセスのサンドボックス化\"><a href=\"#プロセスのサンドボックス化\">プロセスのサンドボックス化</a></h1>\n<p>Chromium の重要なセキュリティ機能の一つは、プロセスをサンドボックス内で実行できることです。 サンドボックスは、ほとんどのシステムリソースへのアクセスを制限することで悪意のあるコードが引き起こす被害を制限します。サンドボックスのプロセスは、CPU サイクルとメモリのみを自由に使用できます。 サンドボックス化したプロセスで追加の特権を必要とする操作を実行するには、専用の通信チャンネルを使用してより特権のあるプロセスにタスクを委譲します。</p>\n<p>Chromium では、メインプロセス以外のほとんどのプロセスにサンドボックス化が適用されます。 これにはレンダラープロセスのほか、オーディオサービス、GPU サービス、ネットワークサービスなどのユーティリティプロセスも含まれます。</p>\n<p>詳しい情報は Chromium の <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/design/sandbox.md\">サンドボックスデザインのドキュメント</a> をご参照ください。</p>\n<h2 id=\"electron-のサンドボックス化ポリシー\"><a href=\"#electron-のサンドボックス化ポリシー\">Electron のサンドボックス化ポリシー</a></h2>\n<p>Electron には混合サンドボックス環境があります。これは、サンドボックス化したプロセスと特権プロセスを横並びに実行するというものです。 デフォルトでは、レンダラープロセスはサンドボックスではなく、ユーティリティプロセスです。 注意として、Chromium と同様にメイン (ブラウザ) プロセスは特権プロセスであり、サンドボックス化できません。</p>\n<p>歴史的には、アプリ開発者にとってレンダラーでの Node.js の利用は非常に強力なツールであるため、このような混合サンドボックス方式が確立されました。 あいにく、この機能は甚大なセキュリティ上の脆弱性でもあります。</p>\n<p>理論的には、信頼されるコードだけを表示するデスクトップアプリケーションでは非サンドボックス化レンダラーは問題になりません。しかし、信頼されないウェブコンテンツを表示する場合の Electron は、Chromium よりも堅牢性が低くなります。 クロスサイトスクリプティング、コンテンツインジェクション、遠隔で読み込んだウェブサイトへの中間者攻撃など、悪意のある人間が利用できる攻撃手段は無数にあります。 念のため、大多数の状況ではレンダラーのサンドボックスの有効化を推奨します。</p>\n<!--TODO: update this guide when #28466 is either solved or closed -->\n<p>なお Issue トラッカーではレンダラーのサンドボックス化をデフォルトで有効にするための議論が活発に行われています。 詳しくは <a href=\"https://github.com/electron/electron/issues/28466\">#28466</a>) を参照してください。</p>\n<h2 id=\"electron-でのサンドボックスの動作\"><a href=\"#electron-でのサンドボックスの動作\">Electron でのサンドボックスの動作</a></h2>\n<p>Electron のサンドボックス化したプロセスは <em>ほぼ</em> Chromium と同じように動作しますが、Electron は Node.js とのインターフェイスであるために更に考慮すべき概念がいくつかあります。</p>\n<h3 id=\"レンダラープロセス\"><a href=\"#レンダラープロセス\">レンダラープロセス</a></h3>\n<p>Electron のレンダラープロセスをサンドボックス化すると、通常の Chrome レンダラーと同じように動作します。 サンドボックス化したレンダラーは Node.js 環境が初期化されません。</p>\n<!-- TODO(erickzhao): when we have a solid guide for IPC, link it here -->\n<p>そのため、サンドボックスを有効にすると、レンダラープロセスはプロセス間通信 (IPC) を介したメインプロセスへのタスクの委譲によってのみ、特権的なタスク (ファイルシステムとのやりとり、システムへの変更、サブプロセスの生成など) を実行できます。</p>\n<h3 id=\"プリロードスクリプト\"><a href=\"#プリロードスクリプト\">プリロードスクリプト</a></h3>\n<p>レンダラープロセスがメインプロセスと通信できるようにするため、サンドボックス化したレンダラーにアタッチされるプリロードスクリプトでは Node.js API をポリフィルしたサブセットを利用できるようになっています。 Node の <code>require</code> に似た <code>require</code> 関数のモジュールを公開してありますが、これは以下 Electron や Node の組み込みモジュールのサブセットしかインポートできません。</p>\n<ul>\n<li><code>electron</code> (レンダラープロセスのモジュールのみ)</li>\n<li><a href=\"https://nodejs.org/api/events.html\"><code>events</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html\"><code>timers</code></a></li>\n<li><a href=\"https://nodejs.org/api/url.html\"><code>url</code></a></li>\n</ul>\n<p>加えて、プリロードスクリプトは以下の Node.js プリミティブもグローバルとしてポリフィルします。</p>\n<ul>\n<li><a href=\"https://nodejs.org/api/Buffer.html\"><code>Buffer</code></a></li>\n<li><a href=\"/docs/api/process\"><code>プロセス</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html#timers_clearimmediate_immediate\"><code>clearImmediate</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html#timers_setimmediate_callback_args\"><code>setImmediate</code></a></li>\n</ul>\n<p><code>require</code> 関数は機能を限定したポリフィルであるため、<a href=\"https://nodejs.org/api/modules.html#modules_modules_commonjs_modules\">CommonJS モジュール</a> を利用したプリロードスクリプトの複数ファイル分割ができません。 プリロードコードを分割する必要がある場合は、<a href=\"https://webpack.js.org/\">webpack</a> や <a href=\"https://parceljs.org/\">Parcel</a> のようなバンドラーを使用してください。</p>\n<p><code>preload</code> スクリプトに与えられる環境は、サンドボックス化したレンダラーの環境よりも大幅に特権的です。<a href=\"/docs/tutorial/context-isolation\"><code>contextIsolation</code></a> が有効になっていない限り、特権的な API をレンダラープロセスで実行している信頼されていないコードにリークできることに注意してください。</p>\n<h2 id=\"サンドボックスの設定\"><a href=\"#サンドボックスの設定\">サンドボックスの設定</a></h2>\n<h3 id=\"単一のプロセスでサンドボックスを有効にする\"><a href=\"#単一のプロセスでサンドボックスを有効にする\">単一のプロセスでサンドボックスを有効にする</a></h3>\n<p>Electron では、<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> コンストラクタで <code>sandbox: true</code> を設定することでレンダラープロセスごとにサンドボックスを有効化できます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">sandbox</span>: <span class=\"hljs-literal\">true</span>\n    }\n  })\n  win.loadURL(<span class=\"hljs-string\">'https://google.com'</span>)\n})\n</code></pre>\n<h3 id=\"アプリ全体でサンドボックスを有効にする\"><a href=\"#アプリ全体でサンドボックスを有効にする\">アプリ全体でサンドボックスを有効にする</a></h3>\n<p>すべてのレンダラーにサンドボックスを強制したい場合は、<a href=\"/docs/api/app#appenablesandbox\"><code>app.enableSandbox</code></a> API も利用できます。 注意として、この API は app の <code>ready</code> イベントより前に呼ぶ必要があります。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\napp.enableSandbox()\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// app.enableSandbox() を呼んだので `sandbox: true` の指定は不要です。</span>\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://google.com'</span>)\n})\n</code></pre>\n<h3 id=\"chromium-のサンドボックスを無効にする-テストのみ\"><a href=\"#chromium-のサンドボックスを無効にする-テストのみ\">Chromium のサンドボックスを無効にする (テストのみ)</a></h3>\n<p><a href=\"/docs/api/command-line-switches#--no-sandbox\"><code>--no-sandbox</code></a> CLI フラグで Chromium のサンドボックスを完全に無効化することもできます。これは、(ユーティリティプロセスを含む) すべてのプロセスのサンドボックスを無効化します。 このフラグはテスト目的でのみ使用し、本番環境では <strong>絶対に</strong> 使用しないことを強く推奨します。</p>\n<p>注意として、この状況で <code>sandbox: true</code> オプションを指定してもレンダラーの Node.js 環境は無効になります。</p>\n<h2 id=\"信頼されないコンテンツの描画に関する注意\"><a href=\"#信頼されないコンテンツの描画に関する注意\">信頼されないコンテンツの描画に関する注意</a></h2>\n<p>信頼されないコンテンツを Electron で描画することはまだ未知の領域ですが、いくつかのアプリケーションは成功を収めています (例: <a href=\"https://github.com/beakerbrowser/beaker\">Beaker Browser</a>)。 私たちの目標はサンドボックス化したコンテンツのセキュリティに関して Chrome にできるだけ近づくことですが、突き詰めるといくつかの基本的な問題のためにいつも後れを取ることになります。</p>\n<ol>\n<li>私たちには Chromium 製品に適したセキュリティのリソースやノウハウがありません。 今あるものを活かして Chromium からできることはすべて継承し、セキュリティ上の問題にも迅速に対応できるようにしていますが、Electron は Chromium のようにリソースを割くことができず、Chromium のようなセキュリティは確保できません。</li>\n<li>Chrome のセキュリティ機能 (セーフブラウジングや証明書の透過性など) の中には、中央集権化と専用サーバが必要なものがありますが、どちらも Electron プロジェクトの目的に反しています。 そのため、セキュリティ関連のコストが発生しないように、Electron では機能を無効にしています。</li>\n<li>Chromium は 1 つだけですが Electron には何千ものアプリが存在しており、それぞれのアプリの動作は微妙に異なります。 これらの違いを考慮すると巨大な可能性の空間が生じ、通常とは異なるユースケースでのプラットフォームのセキュリティ確保に挑戦することになります。</li>\n<li>セキュリティアップデートをユーザーに直接伝えることができないため、セキュリティアップデートをユーザーに届けるために、アプリベンダーに Electron のバージョンをアップグレードして頂いています。</li>\n</ol>\n<p>Chromium のセキュリティ修正を古いバージョンの Electron にバックポートするよう最善の努力をしていますが、すべての修正のバックポートは保証できません。 堅牢性を確保するには、Electron の最新の安定版を使用することが最善の方法です。</p>",
      "title": "プロセスのサンドボックス化",
      "description": ""
    },
    "/docs/api/screen": {
      "locale": "ja-JP",
      "slug": "screen",
      "href": "/docs/api/screen",
      "crowdinFileId": "256361",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/screen.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"screen\"><a href=\"#screen\">screen</a></h1>\n<blockquote>\n<p>画面サイズ、ディスプレイ、カーソルの位置などについての情報を取得します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>app</code> モジュールの <code>ready</code> イベントが発生するまでは、このモジュールは使用できません。</p>\n<p><code>screen</code> は <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a> です。</p>\n<p><strong>注意:</strong> レンダラー / デベロッパー ツールでは、<code>window.screen</code> は予約された DOM プロパティなので、<code>let { screen } = require('electron')</code> と書くことはできません。</p>\n<p>以下は画面全体を埋めるウインドウを作成する例です。</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/screen/fit-screen\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, screen } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> { width, height } = screen.getPrimaryDisplay().workAreaSize\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ width, height })\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>以下は外部ディスプレイにウィンドウを作成するもう一つの例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, screen } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> displays = screen.getAllDisplays()\n  <span class=\"hljs-keyword\">const</span> externalDisplay = displays.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">display</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> display.bounds.x !== <span class=\"hljs-number\">0</span> || display.bounds.y !== <span class=\"hljs-number\">0</span>\n  })\n\n  <span class=\"hljs-keyword\">if</span> (externalDisplay) {\n    win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n      <span class=\"hljs-attr\">x</span>: externalDisplay.bounds.x + <span class=\"hljs-number\">50</span>,\n      <span class=\"hljs-attr\">y</span>: externalDisplay.bounds.y + <span class=\"hljs-number\">50</span>\n    })\n    win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  }\n})\n</code></pre>\n<h2 id=\"イベント\"><a href=\"#イベント\">イベント</a></h2>\n<p><code>screen</code> モジュールには以下のイベントがあります。</p>\n<h3 id=\"イベント-display-added\"><a href=\"#イベント-display-added\">イベント: 'display-added'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newDisplay</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n</ul>\n<p><code>newDisplay</code> が追加されたときに発生します。</p>\n<h3 id=\"イベント-display-removed\"><a href=\"#イベント-display-removed\">イベント: 'display-removed'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>oldDisplay</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n</ul>\n<p><code>oldDisplay</code> が削除されたときに発生します。</p>\n<h3 id=\"イベント-display-metrics-changed\"><a href=\"#イベント-display-metrics-changed\">イベント: 'display-metrics-changed'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>display</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n<li><code>changedMetrics</code> String[]</li>\n</ul>\n<p><code>display</code> 内の一つ以上の寸法が変化したときに発生します。 <code>changedMetrics</code> は、変化を示す文字列の配列です。 <code>bounds</code>、<code>workArea</code>、<code>scaleFactor</code>、<code>rotation</code> に変化できます。</p>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>screen</code> モジュールには以下のメソッドがあります。</p>\n<h3 id=\"screengetcursorscreenpoint\"><a href=\"#screengetcursorscreenpoint\"><code>screen.getCursorScreenPoint()</code></a></h3>\n<p>戻り値 <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>マウスポインタの現在の絶対位置。</p>\n<p><strong>注:</strong> 戻り値は DIP ポイント単位です。画面の物理ポイント単位ではありません。</p>\n<h3 id=\"screengetprimarydisplay\"><a href=\"#screengetprimarydisplay\"><code>screen.getPrimaryDisplay()</code></a></h3>\n<p>戻り値 <a href=\"/docs/api/structures/display\"><code>Display</code></a> - 主要なディスプレイ。</p>\n<h3 id=\"screengetalldisplays\"><a href=\"#screengetalldisplays\"><code>screen.getAllDisplays()</code></a></h3>\n<p>戻り値 <a href=\"/docs/api/structures/display\"><code>Display[]</code></a> - 現在利用可能な display の配列。</p>\n<h3 id=\"screengetdisplaynearestpointpoint\"><a href=\"#screengetdisplaynearestpointpoint\"><code>screen.getDisplayNearestPoint(point)</code></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>戻り値 <a href=\"/docs/api/structures/display\"><code>Display</code></a> - 指定した point に最も近い display。</p>\n<h3 id=\"screengetdisplaymatchingrect\"><a href=\"#screengetdisplaymatchingrect\"><code>screen.getDisplayMatching(rect)</code></a></h3>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>戻り値 <a href=\"/docs/api/structures/display\"><code>Display</code></a> - 指定した矩形に最も近い display。</p>\n<h3 id=\"screenscreentodippointpoint-windows\"><a href=\"#screenscreentodippointpoint-windows\"><code>screen.screenToDipPoint(point)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>戻り値 <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>スクリーン上の物理的な点をスクリーン上の DIP な点に変換します。 DPI スケールは、物理的な点のあるディスプレイに対して相対的なものになります。</p>\n<h3 id=\"screendiptoscreenpointpoint-windows\"><a href=\"#screendiptoscreenpointpoint-windows\"><code>screen.dipToScreenPoint(point)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>戻り値 <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>スクリーン上の DIP な点をスクリーン上の物理的な点に変換します。 DPI スケールは、DIP な点のあるディスプレイに対して相対的なものになります。</p>\n<h3 id=\"screenscreentodiprectwindow-rect-windows\"><a href=\"#screenscreentodiprectwindow-rect-windows\"><code>screen.screenToDipRect(window, rect)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | null</li>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>戻り値 <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>スクリーンの物理矩形をスクリーンのの DIP 矩形に変換します。 DPI スケールは <code>window</code> に近いディスプレイと相対的に計算されます。 <code>window</code> が null の場合、スケールは <code>rect</code> に近いディスプレイと相対的に計算されます。</p>\n<h3 id=\"screendiptoscreenrectwindow-rect-windows\"><a href=\"#screendiptoscreenrectwindow-rect-windows\"><code>screen.dipToScreenRect(window, rect)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | null</li>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>戻り値 <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>スクリーンの DIP 矩形をスクリーンのの物理矩形に変換します。 DPI スケールは <code>window</code> に近いディスプレイと相対的に計算されます。 <code>window</code> が null の場合、スケールは <code>rect</code> に近いディスプレイと相対的に計算されます。</p>",
      "title": "screen",
      "description": "画面サイズ、ディスプレイ、カーソルの位置などについての情報を取得します。"
    },
    "/docs/api/structures/scrubber-item": {
      "locale": "ja-JP",
      "slug": "scrubber-item",
      "href": "/docs/api/structures/scrubber-item",
      "crowdinFileId": "256497",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/scrubber-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"scrubberitem-object\"><a href=\"#scrubberitem-object\">ScrubberItem Object</a></h1>\n<ul>\n<li><code>label</code> String (optional) - The text to appear in this item.</li>\n<li><code>icon</code> NativeImage (optional) - The image to appear in this item.</li>\n</ul>",
      "title": "ScrubberItem Object",
      "description": ""
    },
    "/docs/tutorial/security": {
      "locale": "ja-JP",
      "slug": "security",
      "href": "/docs/tutorial/security",
      "crowdinFileId": "256247",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/security.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"セキュリティ、ネイティブ機能、あなたの責任\"><a href=\"#セキュリティ、ネイティブ機能、あなたの責任\">セキュリティ、ネイティブ機能、あなたの責任</a></h1>\n<p>私たちは普段、Web開発者としてブラウザの強力なセキュリティを享受しています。つまり、私たちが書いたコードに起因するリスクは比較的小さいと言えます。 私たちのウェブサイトにはサンドボックスに限られた権限が与えられており、ユーザーは新たに発見されたセキュリティ上の脅威に迅速に対応できる、大規模なエンジニアチームによって構築されたブラウザを享受していると考えています。</p>\n<p>Electron で開発する時、Electron はブラウザではないということを意識することが重要です。 使い慣れたウェブ技術を使用して、機能あふれるデスクトップアプリケーションを構築できますが、あなたのコードの方がはるかに大きな力を発揮します。 JavaScript はファイルシステム、ユーザシェルなどにアクセスできます。 これはつまり、質の高いネイティブアプリケーションを作成することができる反面、あなたの書くコードに与えられた権限に応じて固有のセキュリティリスクが増加するということです。</p>\n<p>それを念頭に置いて、信頼できないソースからの任意のコンテンツを表示するということは、Electron が扱うことを意図しない重大なセキュリティリスクを引き起こすということに注意してください。 実際、人気のある Electron アプリ (Atom、Slack、Visual Studio Code、等) は、主にローカル (あるいは信頼されており、なおかつ Node integration を使用しないリモート) のコンテンツを取り扱います。もしあなたのアプリケーションがオンライン上のリソースからコードを実行する場合、あなたの責任の下でそのコードが悪意のあるものではないことを確認する必要があります。</p>\n<h2 id=\"セキュリティ問題の報告\"><a href=\"#セキュリティ問題の報告\">セキュリティ問題の報告</a></h2>\n<p>Electron の脆弱性を報告する正しい方法については <a href=\"https://github.com/electron/electron/tree/main/SECURITY.md\">SECURITY.md</a> を参照してください。</p>\n<h2 id=\"chromium-のセキュリティ問題とアップグレード\"><a href=\"#chromium-のセキュリティ問題とアップグレード\">Chromium のセキュリティ問題とアップグレード</a></h2>\n<p>Electron は、Chromiumのリリースとは交互に更新しています。 詳しくは、<a href=\"https://electronjs.org/blog/12-week-cadence\">Electron リリースケイデンスのブログ記事</a> を参照してください。</p>\n<h2 id=\"セキュリティはみんなの責任\"><a href=\"#セキュリティはみんなの責任\">セキュリティはみんなの責任</a></h2>\n<p>あなたの Electron アプリケーションのセキュリティは、フレームワーク (<em>Chromium</em>、<em>Node.js</em>)、Electron 自身、NPM の依存関係、あなたのコード のセキュリティの結果であることを覚えておくことが大事です。 そのため、いくつかの重要なベストプラックティスに従う、責任があります。</p>\n<ul>\n<li>\n<p><strong>あなたのアプリケーションは最新リリースの Electron フレームワークを使う。</strong> あなたはプロダクトをリリースしたとき、Electron、 Chromium 共有ライブラリ、Node.js を組み込んでリリースしています。 これらのコンポーネントに影響する脆弱性は、あなたのアプリケーションのセキュリティに影響する可能性があります。 Electronを最新バージョンにアップデートすることで、あなたはクリティカルな脆弱性(例えば <em>nodeIntegration bypasses</em>) にパッチを当てた状態にして、あなたのアプリケーションで発現しないようにできます。 詳細については、\"<a href=\"#16-use-a-current-version-of-electron\">現行バージョンの Electron を使う</a>\" を参照してください。</p>\n</li>\n<li>\n<p><strong>あなたのアプリの依存関係の評価する。</strong> NPM は 50万もの再利用できるパッケージを提供しています。一方、あなたは信頼するサードパーティのライブラリを選択する責任があります。 あなたが既知の脆弱性の影響を受けるライブラリを利用する場合や、あまりメンテナンスされていないコードに頼る場合、あなたのアプリケーションのセキュリティは低下し危険な状態になります。</p>\n</li>\n<li>\n<p><strong>セキュアコーディングプラクティスの採用。</strong> あなたのアプリケーションの防衛の第一歩はあなたのコードです。 クロスサイトスクリプティング (XSS) のような一般的なウェブの脆弱性は Electron アプリケーションに大きなセキュリティ上の影響を与えるため、安全なソフトウェア開発のベストプラクティスの採用とセキュリティテストの実施を強く推奨します。</p>\n</li>\n</ul>\n<h2 id=\"信用されないコンテンツの隔離\"><a href=\"#信用されないコンテンツの隔離\">信用されないコンテンツの隔離</a></h2>\n<p>信用されていないソース (例えばリモートサーバー) からコードを受け取ってローカルで実行するときは、常にセキュリティの問題が存在します。 例として、リモートのウェブサイトがデフォルト <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> 内に表示されていると考えてください。 もし攻撃者がどうにかして(情報源そのものの攻撃や中間者攻撃によって) 得られる内容を変更した場合、ユーザーのPC上でネイティブコードを実行できることになります。</p>\n<blockquote>\n<p>:警告:  Node integration が有効な環境で、リモートコードの読み込みと実行を行ってはいけません。 代わりに、Node.js コードの実行にはローカルファイル (アプリケーションと一緒にパッケージ化されているもの) だけを使用してください。 remote コンテンツを表示するには、<a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> tag または <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>を使用します。その時<code>nodeIntegration</code>を無効に、<code>contextIsolation</code>を有効にすることを確認してください。</p>\n</blockquote>\n<h2 id=\"electron-のセキュリティ警告\"><a href=\"#electron-のセキュリティ警告\">Electron のセキュリティ警告</a></h2>\n<p>Electron 2.0 からでは、開発者は、開発者コンソールに出力される警告と推奨を見られます。 バイナリ名が Electron の場合にのみ表示され、開発者が現在コンソールを見ていることを示しています。</p>\n<p>これらの警告を、 <code>process.env</code> または <code>window</code> オブジェクトに<code>ELECTRON_ENABLE_SECURITY_WARNINGS</code> または <code>ELECTRON_DISABLE_SECURITY_WARNINGS</code> を設定することで、強制的に有効または無効にできます。</p>\n<h2 id=\"チェックリスト-セキュリティ推奨事項\"><a href=\"#チェックリスト-セキュリティ推奨事項\">チェックリスト: セキュリティ推奨事項</a></h2>\n<p>あなたはあなたのアプリケーションのセキュリティーを向上させるために、少なくとも次のステップを実施してください。</p>\n<ol>\n<li><a href=\"#1-only-load-secure-content\">セキュアなコンテンツのみを読み込む</a></li>\n<li><a href=\"#2-do-not-enable-nodejs-integration-for-remote-content\">リモートコンテンツを表示する全てのレンダラーで、Node.js integration を無効にする</a></li>\n<li><a href=\"#3-enable-context-isolation-for-remote-content\">リモートコンテンツを表示するすべてのレンダラーで、コンテキストイソレーションを有効にする</a></li>\n<li><a href=\"#4-enable-sandboxing\">サンドボックス化を有効にする</a></li>\n<li><a href=\"#5-handle-session-permission-requests-from-remote-content\">リモートのコンテンツを表示するすべてのセッションで <code>ses.setPermissionRequestHandler()</code> を利用する</a></li>\n<li><a href=\"#6-do-not-disable-websecurity\"><code>webSecurity</code> を無効にしない</a></li>\n<li><a href=\"#7-define-a-content-security-policy\"><code>Content-Security-Policy</code> を定義</a>して、スクリプトの読み込み元を制限する (例: <code>script-src 'self'</code>)</li>\n<li><a href=\"#8-do-not-set-allowrunninginsecurecontent-to-true\"><code>allowRunningInsecureContent</code> を <code>true</code> にしない</a></li>\n<li><a href=\"#9-do-not-enable-experimental-features\">実験的な機能を有効にしない</a></li>\n<li><a href=\"#10-do-not-use-enableblinkfeatures\"><code>enableBlinkFeatures</code> を使用しない</a></li>\n<li><a href=\"#11-do-not-use-allowpopups\"><code>&#x3C;webview></code>: <code>allowpopups</code> を使用しない</a></li>\n<li><a href=\"#12-verify-webview-options-before-creation\"><code>&#x3C;webview></code>: オプションとパラメータを検証する</a></li>\n<li><a href=\"#13-disable-or-limit-navigation\">ナビゲーションを無効化か制限</a></li>\n<li><a href=\"#14-disable-or-limit-creation-of-new-windows\">新規ウインドウの作成を無効化か制限</a></li>\n<li><a href=\"#15-do-not-use-openexternal-with-untrusted-content\">信用されないコンテンツで <code>openExternal</code> を使用しない</a></li>\n<li><a href=\"#16-use-a-current-version-of-electron\">現行バージョンの Electron を使う</a></li>\n</ol>\n<p>設定ミスやセキュアでないパターンを自動的に検出するには、<a href=\"https://github.com/doyensec/electronegativity\">electronegativity</a>が使用できます。 Electronを使用したアプリケーション開発時の潜在的な脆弱性やバグの埋め込みについてのより詳しい情報は、<a href=\"https://doyensec.com/resources/us-17-Carettoni-Electronegativity-A-Study-Of-Electron-Security-wp.pdf\">開発者承認者向けガイドguide for developers and auditors</a>を参照してください。</p>\n<h2 id=\"1-セキュアなコンテンツのみを読み込む\"><a href=\"#1-セキュアなコンテンツのみを読み込む\">1) セキュアなコンテンツのみを読み込む</a></h2>\n<p>アプリケーションに含まれていない任意のリソースは、<code>HTTPS</code> のようなセキュアなプロトコルを使用して読み込まなければいけません。 つまり、<code>HTTP</code> のようなインセキュアなプロトコルを使用しないでください。 同様に、<code>WS</code> より <code>WSS</code>、<code>FTP</code> より <code>FTPS</code> の使用を推奨します。</p>\n<h3 id=\"なぜ？\"><a href=\"#なぜ？\">なぜ？</a></h3>\n<p><code>HTTPS</code> には、主に3つの利点があります。</p>\n<p>1) あなたのアプリが偽装者ではなく正しいホストに接続するように、リモートサーバーを認証します。 2) アプリケーションとホスト間の転送中にデータが変更されていないことを確認し、データの整合性を保証します。 3) ユーザーと宛先ホスト間のトラフィックを暗号化し、アプリとホスト間で送信される情報を盗聴することをより難しくします。</p>\n<h3 id=\"どうすればいいの？\"><a href=\"#どうすればいいの？\">どうすればいいの？</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// NG</span>\nbrowserWindow.loadURL(<span class=\"hljs-string\">'http://example.com'</span>)\n\n<span class=\"hljs-comment\">// OK</span>\nbrowserWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- NG --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">crossorigin</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://example.com/react.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"http://example.com/style.css\"</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- OK --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">crossorigin</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://example.com/react.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"https://example.com/style.css\"</span>></span>\n</code></pre>\n<h2 id=\"2-リモートコンテンツで、nodejs-integration-を有効にしない\"><a href=\"#2-リモートコンテンツで、nodejs-integration-を有効にしない\">2) リモートコンテンツで、Node.js integration を有効にしない</a></h2>\n<p><em>この推奨は、Electron 5.0.0 からデフォルトの振舞いです。</em></p>\n<p>リモートコンテンツをロードするレンダラー (<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>、<a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>、<a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>) で Node.js integration を有効にしないことが重要です。 リモートコンテンツに与える権限を制限することで、攻撃者がウェブサイトで JavaScript を実行できるようになった場合に、ユーザを傷つけることを劇的に難しくする目的があります。</p>\n<p>その後、特定のホストに対して追加の権限を与えることができます。 例えば、<code>https://example.com/</code> を指す BrowserWindow を開いている場合、あなたはそのウェブサイトに必要な権限を正確に与えることができますが、それ以上は与えられません。</p>\n<h3 id=\"なぜ？-1\"><a href=\"#なぜ？-1\">なぜ？</a></h3>\n<p>クロスサイトスクリプティング (XSS) 攻撃は、攻撃者がレンダラープロセスを飛び越えてユーザのコンピュータ上でコードを実行できる場合、より危険です。 クロスサイトスクリプティングの攻撃はかなり一般的――かつ問題が発生している間、通常では、その力は実行されているウェブサイトをめちゃくちゃにするだけです。 Node.js integration を無効にすることは、XSS が昇華され、いわゆる \"遠隔コード実行\" (RCE) 攻撃になるのを防ぐのに役立ちます。</p>\n<h3 id=\"どうすればいいの？-1\"><a href=\"#どうすればいいの？-1\">どうすればいいの？</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 悪い</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span>,\n    <span class=\"hljs-attr\">nodeIntegrationInWorker</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n\nmainWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 良い</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">preload</span>: path.join(app.getAppPath(), <span class=\"hljs-string\">'preload.js'</span>)\n  }\n})\n\nmainWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- NG --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">nodeIntegration</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- OK --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>Node.js integration を無効にすると、ウェブサイトへ Node.js モジュールまたは機能を使用する API を確認することができます。 プリロードスクリプトは引き続き <code>require</code> と他の Node.js の機能にアクセスできるため、開発者はコンテンツをリモートにロードするカスタム API を確認します。</p>\n<p>次のプレロードスクリプトの例では、後でロードされたWebサイトは <code>window.readConfig()</code> メソッドにアクセスできますが、Node.js の機能は使用できません。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { readFileSync } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-built_in\">window</span>.readConfig = <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> data = readFileSync(<span class=\"hljs-string\">'./config.json'</span>)\n  <span class=\"hljs-keyword\">return</span> data\n}\n</code></pre>\n<h2 id=\"3-リモートコンテンツで、コンテキストイソレーションを有効にする\"><a href=\"#3-リモートコンテンツで、コンテキストイソレーションを有効にする\">3) リモートコンテンツで、コンテキストイソレーションを有効にする</a></h2>\n<p>コンテキストイソレーションは、開発者が専用の JavaScript コンテキストで、プリロードスクリプトと Electron API でコードを実行できるようにする Electron の機能です。 つまり、<code>Array.prototype.push</code> や <code>JSON.parse</code> などのグローバルオブジェクトは、レンダラープロセスで実行されているスクリプトでは変更できません。</p>\n<p>Electron は Chromium の <a href=\"https://developer.chrome.com/extensions/content_scripts#execution-environment\">コンテンツスクリプト</a> と同じ技術を使用してこの動作を可能にしています。</p>\n<p><code>nodeIntegration: false</code> を使用している場合でも、真に強力なアイソレーションを強制し Node プリミティブの使用を防ぐためには、<code>contextIsolation</code> も使用 <strong>しなければなりません</strong>。</p>\n<h3 id=\"いったいどうして\"><a href=\"#いったいどうして\">いったいどうして?</a></h3>\n<p><code>contextIsolation</code> が何であるのか及びこれを有効にする方法についての情報は、<a href=\"/docs/tutorial/context-isolation\">コンテキスト隔離</a> ドキュメントをご参照ください。</p>\n<h2 id=\"4-サンドボックス化を有効にする\"><a href=\"#4-サンドボックス化を有効にする\">4) サンドボックス化を有効にする</a></h2>\n<p><a href=\"/docs/tutorial/sandbox\">サンドボックス化</a> は Chromium の機能で、オペレーティングシステムを利用してレンダラープロセスのアクセス範囲を大幅に制限します。 すべてのレンダラーでサンドボックスを有効にするべきです。 メインプロセスを含むサンドボックス化されていないプロセスでは、信頼されないコンテンツをロードしたり、読んだり、処理したりすることはお勧めしません。</p>\n<h3 id=\"どうすればいいの？-2\"><a href=\"#どうすればいいの？-2\">どうすればいいの？</a></h3>\n<p>ウインドウ作成時に、以下のように <code>webPreferences</code> に <code>sandbox: true</code> オプションを渡します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">sandbox</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h2 id=\"5-リモートのコンテンツからセッション権限リクエストを利用する\"><a href=\"#5-リモートのコンテンツからセッション権限リクエストを利用する\">5) リモートのコンテンツからセッション権限リクエストを利用する</a></h2>\n<p>Chromeを使用しているときに許可リクエストが表示されていることがあります――ユーザーが手動で承認する必要がある機能 (通知など) をウェブサイトが使用しようとするたびにポップアップが表示されます。</p>\n<p>API は <a href=\"https://developer.chrome.com/extensions/permissions\">Chromium 権限 API</a> に基づいており、同じ種類のアクセス許可を実装しています。</p>\n<h3 id=\"なぜ？-2\"><a href=\"#なぜ？-2\">なぜ？</a></h3>\n<p>デフォルトでは、開発者がカスタムハンドラを手動で設定していない限り、Electron はすべての権限リクエストを自動的に承認します。 セキュリティを意識した開発者は、堅実なデフォルトとしては、まったく反対のことを想定したかもしれません。</p>\n<h3 id=\"どうすればいいの？-3\"><a href=\"#どうすればいいの？-3\">どうすればいいの？</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession\n  .fromPartition(<span class=\"hljs-string\">'some-partition'</span>)\n  .setPermissionRequestHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, callback</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> url = webContents.getURL()\n\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'notifications'</span>) {\n      <span class=\"hljs-comment\">// 権限リクエストを承認する</span>\n      callback(<span class=\"hljs-literal\">true</span>)\n    }\n\n    <span class=\"hljs-comment\">// URL を認証する</span>\n    <span class=\"hljs-keyword\">if</span> (!url.startsWith(<span class=\"hljs-string\">'https://example.com/'</span>)) {\n      <span class=\"hljs-comment\">// 権限リクエストを拒否する</span>\n      <span class=\"hljs-keyword\">return</span> callback(<span class=\"hljs-literal\">false</span>)\n    }\n  })\n</code></pre>\n<h2 id=\"6-websecurity-を無効にしない\"><a href=\"#6-websecurity-を無効にしない\">6) webSecurity を無効にしない</a></h2>\n<p><em>Electron のデフォルトを推奨しています</em></p>\n<p>レンダラープロセス (<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>、<a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>、<a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>) 上の <code>webSecurity</code> プロパティを無効にすることは、 重要なセキュリティ機能を無効にするということです。</p>\n<p>製品としてのアプリケーションで <code>webSecurity</code> を無効にしないでください。</p>\n<h3 id=\"なぜ？-3\"><a href=\"#なぜ？-3\">なぜ？</a></h3>\n<p><code> webSecurity</code> を無効にすると、同一オリジンポリシーが無効になり、<code>allowRunningInsecureContent</code> プロパティが <code>true</code> に設定されます。 つまり、異なるドメインからの安全でないコードの実行を可能にしてしまいます。</p>\n<h3 id=\"どうすればいいの？-4\"><a href=\"#どうすればいいの？-4\">どうすればいいの？</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// NG</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">webSecurity</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// OK</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- NG --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">disablewebsecurity</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- OK --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<h2 id=\"7-content-security-policy-を定義する\"><a href=\"#7-content-security-policy-を定義する\">7) Content-Security-Policy を定義する</a></h2>\n<p>Content Security Policy (CSP) は、クロスサイトスクリプティング攻撃やデータインジェクション攻撃から保護する副層です。 Electron 内でロードする任意のウェブサイトで有効にすることを推奨します。</p>\n<h3 id=\"なぜ？-4\"><a href=\"#なぜ？-4\">なぜ？</a></h3>\n<p>CSP を使用すると、コンテンツを提供するサーバーが、指定されたウェブページに Electron がロードできるリソースを、制限および制御できます。 <code>https://example.com</code> は、<code>https://evil.attacker.com</code> からのスクリプトは許可せず、定義したオリジンのスクリプトを読み込むことを許可して実行する必要があります。 CSP を定義することは、アプリケーションのセキュリティを向上させる簡単な方法です。</p>\n<p>以下の CSP は、Electron が現在のウェブサイトと <code>apis.example.com</code> からスクリプトを実行できるようにします。</p>\n<pre><code class=\"hljs language-plaintext\">// NG\nContent-Security-Policy: '*'\n\n// OK\nContent-Security-Policy: script-src 'self' https://apis.example.com\n</code></pre>\n<h3 id=\"csp-http-ヘッダ\"><a href=\"#csp-http-ヘッダ\">CSP HTTP ヘッダ</a></h3>\n<p>Electron は <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy\"><code>Content-Security-Policy</code> HTTP ヘッダ</a> とそれぞれの <a href=\"/docs/api/web-request#webrequestonheadersreceivedfilter-listener\"><code>webRequest.onHeadersReceived</code></a> タグを尊重します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession.defaultSession.webRequest.onHeadersReceived(<span class=\"hljs-function\">(<span class=\"hljs-params\">details, callback</span>) =></span> {\n  callback({\n    <span class=\"hljs-attr\">responseHeaders</span>: {\n      ...details.responseHeaders,\n      <span class=\"hljs-string\">'Content-Security-Policy'</span>: [<span class=\"hljs-string\">'default-src \\'none\\''</span>]\n    }\n  })\n})\n</code></pre>\n<h3 id=\"csp-メタタグ\"><a href=\"#csp-メタタグ\">CSP メタタグ</a></h3>\n<p>CSP の推奨伝達メカニズムは HTTP ヘッダですが、<code>file://</code> プロトコルを使用してリソースをロードするときにこのメソッドを使用することはできません。 <code>file://</code> プロトコルを使用する場合など、<code>&#x3C;meta></code> タグを使用してマークアップのページに直接ポリシーを設定すると便利な場合があります。</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'none'\"</span>></span>\n</code></pre>\n<h2 id=\"8-allowrunninginsecurecontent-を-true-にしない\"><a href=\"#8-allowrunninginsecurecontent-を-true-にしない\">8) <code>allowRunningInsecureContent</code> を <code>true</code> にしない</a></h2>\n<p><em>Electron のデフォルトを推奨しています</em></p>\n<p>デフォルトでは、Electron は <code>HTTPS</code> 上でロードされたウェブサイト上でのみ、安全でないソース (<code>HTTP</code>) からスクリプト、CSS、またはプラグインを読み込んで実行できるようにします。 <code>allowRunningInsecureContent</code> プロパティを <code>true</code> にすることで、その保護を無効にします。</p>\n<p><code>HTTPS</code> 経由でウェブサイトの初期 HTML を読み込んで、<code>HTTP</code> 経由で後続のリソースを読み込もうとすることを \"混合コンテンツ\" といいます。</p>\n<h3 id=\"なぜ？-5\"><a href=\"#なぜ？-5\">なぜ？</a></h3>\n<p><code>HTTPS</code> を介してコンテンツをロードすると、トラフィック自体を暗号化しながら、ロードされたリソースの信憑性と完全性が保証されます。 より詳しくは、<a href=\"#1-only-load-secure-content\">セキュアなコンテンツのみを表示する</a> を参照して下さい。</p>\n<h3 id=\"どうすればいいの？-5\"><a href=\"#どうすればいいの？-5\">どうすればいいの？</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// NG</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">allowRunningInsecureContent</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// OK</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({})\n</code></pre>\n<h2 id=\"9-実験的な機能を有効にしない\"><a href=\"#9-実験的な機能を有効にしない\">9) 実験的な機能を有効にしない</a></h2>\n<p><em>Electron のデフォルトを推奨しています</em></p>\n<p>Electron の上級ユーザは、<code>experimentalFeatures</code> のプロパティを使用して Chromium の実験的な機能を有効にすることができます。</p>\n<h3 id=\"なぜ？-6\"><a href=\"#なぜ？-6\">なぜ？</a></h3>\n<p>実験的な機能は、その名前が示すように、実験的であり、Chromium のすべてのユーザに有効にされていません。 さらに、Electron 全体への影響はテストされていない可能性が高いです。</p>\n<p>正しい使用方法は存在しますが、何をしているのか分からない限り、このプロパティを有効にしないでください。</p>\n<h3 id=\"どうすればいいの？-6\"><a href=\"#どうすればいいの？-6\">どうすればいいの？</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// NG</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">experimentalFeatures</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// OK</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({})\n</code></pre>\n<h2 id=\"10-enableblinkfeatures-を使用しない\"><a href=\"#10-enableblinkfeatures-を使用しない\">10) <code>enableBlinkFeatures</code> を使用しない</a></h2>\n<p><em>Electron のデフォルトを推奨しています</em></p>\n<p>Blink は、Chromium のバックグラウンドにあるレンダリングエンジンの名前です。 <code>experimentalFeatures</code> と同様に、<code>enableBlinkFeatures</code> プロパティを使用すると、デフォルトで無効になっている機能を有効にすることができます。</p>\n<h3 id=\"なぜ？-7\"><a href=\"#なぜ？-7\">なぜ？</a></h3>\n<p>一般に、機能がデフォルトで有効になっていない場合は、よい理由が考えられます。 その機能を有効にするための、正しい使用方法は存在します。 開発者は、機能を有効にする必要がある理由、影響の内容、アプリケーションのセキュリティにどのように影響するかを正確に把握する必要があります。 どのような場合においても、機能を推論的に有効にするべきではありません。</p>\n<h3 id=\"どうすればいいの？-7\"><a href=\"#どうすればいいの？-7\">どうすればいいの？</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 悪例</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">enableBlinkFeatures</span>: <span class=\"hljs-string\">'ExecCommandInJavaScript'</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// OK</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n</code></pre>\n<h2 id=\"11-allowpopups-を使用しない\"><a href=\"#11-allowpopups-を使用しない\">11) <code>allowpopups</code> を使用しない</a></h2>\n<p><em>Electron のデフォルトを推奨しています</em></p>\n<p><a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> を使用している場合、新しいウィンドウを開くには <code>&#x3C;webview></code> タグにページとスクリプトをロードする必要があります。 <code>allowpopups</code> 属性は、<code>window.open()</code> メソッドを使用して新しい <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> を作成することができるようにします。 そうでなければ、<code>&#x3C;webview></code> は新しいウインドウを作成できません。</p>\n<h3 id=\"なぜ？-8\"><a href=\"#なぜ？-8\">なぜ？</a></h3>\n<p>ポップアップが必要ない場合は、デフォルトで新しい <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> の作成を許可しないようにしたほうがよいでしょう。 これは必要最低限なアクセスの原則に従っています。ウェブサイトにその機能が必要でない限り、新しいポップアップを作成させないでください。</p>\n<h3 id=\"どうすればいいの？-8\"><a href=\"#どうすればいいの？-8\">どうすればいいの？</a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- NG --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">allowpopups</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- OK --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<h2 id=\"12-作成前に-webview-のオプションを確認する\"><a href=\"#12-作成前に-webview-のオプションを確認する\">12) 作成前に WebView のオプションを確認する</a></h2>\n<p>Node.js integration が有効になっていないレンダラープロセスで作成された WebView は、integration 自体を有効にすることはできません。 しかし、WebView は常に独自の <code>webPreferences</code> を使用して、独立したレンダラープロセスを作成します。</p>\n<p>メインプロセスから新しい <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> タグの作成を制御し、webPreferences でセキュリティ機能を無効にしていないことを確認することを推奨します。</p>\n<h3 id=\"なぜ？-9\"><a href=\"#なぜ？-9\">なぜ？</a></h3>\n<p><code>&#x3C;webview></code> は DOM 内に存在するので、Node.js integration が無効になっていても、WebView はウェブサイトで実行されているスクリプトによって作成できます。</p>\n<p>Electron では、開発者はレンダラープロセスを制御するさまざまなセキュリティ機能を無効にすることができます。 ほとんどの場合、開発者はこれらの機能を無効にする必要はありません。したがって、新しく作成した <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> タグを使用します。</p>\n<h3 id=\"どうすればいいの？-9\"><a href=\"#どうすればいいの？-9\">どうすればいいの？</a></h3>\n<p><a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> タグが適用される前に、Electron は <code>will-attach-webview</code> イベントを <code>webContents</code> ホスト上で発火します。 安全性の低いオプションを使用して <code>webViews</code> を作成しないようにするには、このイベントを使用します。</p>\n<pre><code class=\"hljs language-js\">app.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.on(<span class=\"hljs-string\">'will-attach-webview'</span>, (event, webPreferences, params) => {\n    <span class=\"hljs-comment\">// 未使用のプリロードスクリプトを削除するか、その場所が正当であることを確認する</span>\n    <span class=\"hljs-keyword\">delete</span> webPreferences.preload\n    <span class=\"hljs-keyword\">delete</span> webPreferences.preloadURL\n\n    <span class=\"hljs-comment\">// Node.js integration を無効にする</span>\n    webPreferences.nodeIntegration = <span class=\"hljs-literal\">false</span>\n\n    <span class=\"hljs-comment\">// ロードされる URL を確認する</span>\n    <span class=\"hljs-keyword\">if</span> (!params.src.startsWith(<span class=\"hljs-string\">'https://example.com/'</span>)) {\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<p>繰り返しになりますが、このリストは単にリスクを最小化するだけで、除去するものではありません。 ウェブサイトを表示することが目的であれば、ブラウザの方が安全性の高い選択肢になります。</p>\n<h2 id=\"13-ナビゲーションを無効化か制限\"><a href=\"#13-ナビゲーションを無効化か制限\">13) ナビゲーションを無効化か制限</a></h2>\n<p>アプリにナビゲートする必要がない場合、または既知のページにナビゲートするだけの場合は、ナビゲーションをその既知の範囲に完全に制限し、他の種類のナビゲーションを禁止することをお勧めします。</p>\n<h3 id=\"なぜ？-10\"><a href=\"#なぜ？-10\">なぜ？</a></h3>\n<p>ナビゲーションは一般的な攻撃方法です。 攻撃者が現在のページから移動するようにアプリを制御することができると、インターネット上の Web サイトを開くことをアプリに強制する可能性があります。 <code>webContents</code> がより安全に設定されている (<code>nodeIntegration</code> を無効にする、<code>contextIsolation</code> を有効にするなど) 場合でも、アプリにデタラメな Web サイトを開かせる アプリを悪用する方がはるかに簡単になります。</p>\n<p>一般的な攻撃パターンは、攻撃者が、アプリでそのユーザに攻撃者のいずれかのページに移動するような方法で操作することを強いることです。 これは通常、リンク、プラグイン、またはその他のユーザー生成コンテンツを介して行われます。</p>\n<h3 id=\"どうすればいいの？-10\"><a href=\"#どうすればいいの？-10\">どうすればいいの？</a></h3>\n<p>アプリにナビゲーションが不要な場合は、<a href=\"/docs/api/web-contents#event-will-navigate\"><code>will-navigate</code></a> ハンドラ内 <code>event.preventDefault()</code> を呼び出すことができます。 アプリがどのページに移動するかがわかっている場合は、イベントハンドラで URL を確認し、予期している URL と一致する場合にのみナビゲーションを許可します。</p>\n<p>URL には Node のパーサーを使用することを推奨します。 単純な文字列比較は時々だまされる可能性があります - <code>startsWith('https://example.com')</code> テストは <code>https://example.com.attacker.com</code> を通過させます 。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> URL = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>).URL\n\napp.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.on(<span class=\"hljs-string\">'will-navigate'</span>, (event, navigationUrl) => {\n    <span class=\"hljs-keyword\">const</span> parsedUrl = <span class=\"hljs-keyword\">new</span> URL(navigationUrl)\n\n    <span class=\"hljs-keyword\">if</span> (parsedUrl.origin !== <span class=\"hljs-string\">'https://example.com'</span>) {\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<h2 id=\"14-新規ウインドウの作成を無効化か制限\"><a href=\"#14-新規ウインドウの作成を無効化か制限\">14) 新規ウインドウの作成を無効化か制限</a></h2>\n<p>既知の一連のウインドウがある場合は、アプリ内での追加ウインドウの作成を制限することをお勧めします。</p>\n<h3 id=\"なぜ？-11\"><a href=\"#なぜ？-11\">なぜ？</a></h3>\n<p>ナビゲーションと同様、新しい <code>webContents</code> の作成は一般的な攻撃手段です。 攻撃者はそのままではページを開こうとしても開くことができないために、新しいウィンドウ、フレーム、その他のレンダラープロセスをより多くの権限で作成するようにアプリに強制しようとします。</p>\n<p>あなたが作成する必要があると知っているものに加えてウィンドウを作成する必要がない場合は、作成を無効にするとノーコストで少しの追加のセキュリティが手に入ります。 これは1つの <code>BrowserWindow</code> を開き、実行時に任意の数の追加ウィンドウを開く必要がないアプリケーションで普遍的なケースです。</p>\n<h3 id=\"どうすればいいの？-11\"><a href=\"#どうすればいいの？-11\">どうすればいいの？</a></h3>\n<p><a href=\"/docs/api/web-contents\"><code>webContents</code></a> は、新しいウインドウを作成する前に、<a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\">ウインドウを開くハンドラー</a> に委譲します。 ハンドラーは、他のパラメータの中の、ウィンドウを開くように要求された <code>url</code> とそのウィンドウを作成するために使用されたオプションを受け取ります。 ウインドウの作成を監視するハンドラを登録し、予期せぬウィンドウの作成は拒否するよう推奨します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n    <span class=\"hljs-comment\">// この例では、既定のブラウザでこのイベントのURLを開くように</span>\n    <span class=\"hljs-comment\">// オペレーティングシステムに依頼します。</span>\n    <span class=\"hljs-comment\">//</span>\n    <span class=\"hljs-comment\">// shell.openExternal に渡す URL を許可する基準ついては、</span>\n    <span class=\"hljs-comment\">// 以降の項目を参照してください。</span>\n    <span class=\"hljs-keyword\">if</span> (isSafeForExternalOpen(url)) {\n      setImmediate(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n        shell.openExternal(url)\n      })\n    }\n\n    <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n  })\n})\n</code></pre>\n<h2 id=\"15-信用されないコンテンツで-openexternal-を使用しない\"><a href=\"#15-信用されないコンテンツで-openexternal-を使用しない\">15) 信用されないコンテンツで <code>openExternal</code> を使用しない</a></h2>\n<p>Shellの <a href=\"/docs/api/shell#shellopenexternalurl-options\"><code>openExternal</code></a> はデスクトップのネィティブユーティリティの指定した protocol URI で開けるようにします。 例えば、macOSの<code>open</code> ターミナルコマンドユーティリティに似た機能で、URIとそのファイルタイプの関連に基づいた特定のアプリケーションで開きます。</p>\n<h3 id=\"なぜ？-12\"><a href=\"#なぜ？-12\">なぜ？</a></h3>\n<p><a href=\"/docs/api/shell#shellopenexternalurl-options\"><code>openExternal</code></a> の不適切な利用によって、そのユーザーのホストを危険に曝す可能性があります。 openExternalを信頼できないコンテンツで使用するとき、任意のコマンドの実行を許してしまう可能性があります。</p>\n<h3 id=\"どうすればいいの？-12\"><a href=\"#どうすればいいの？-12\">どうすればいいの？</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">//  Bad</span>\n<span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nshell.openExternal(USER_CONTROLLED_DATA_HERE)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">//  Good</span>\n<span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nshell.openExternal(<span class=\"hljs-string\">'https://example.com/index.html'</span>)\n</code></pre>\n<h2 id=\"16-現行バージョンの-electron-を使う\"><a href=\"#16-現行バージョンの-electron-を使う\">16) 現行バージョンの Electron を使う</a></h2>\n<p>常に最新バージョンの Electron を使用するように努力してください。 新しいメジャーバージョンがリリースされる度に、できるだけ早くアプリを更新しましょう。</p>\n<h3 id=\"なぜ？-13\"><a href=\"#なぜ？-13\">なぜ？</a></h3>\n<p>古いバージョンの Electron、Chromium、Node.js で構築されたアプリケーションは、最新バージョンのこれらコンポーネントを使用しているアプリケーションよりも容易な標的です。 一般的に、古いバージョンの Chromium と Node.js ではより広いセキュリティ問題とエクスプロイトが適用できます。</p>\n<p>Chromium と Node.js はどちらも、何千人もの才能のある開発者によって構築された素晴らしい技術です。 人気を考えると、それらのセキュリティは同様に熟練したセキュリティ研究者によって慎重にテストされ分析されます。 これら研究者の多くは、<a href=\"https://en.wikipedia.org/wiki/Responsible_disclosure\">脆弱性を責任を持って開示</a> しています。これは一般に、研究者が問題を公開する前に Chromium と Node.js に問題を修正する時間を与えることを意味します。 最新バージョンの Electron (および Chromium と Node.js) で実行している場合、潜在的なセキュリティ問題がそれほど広く知られておらずアプリケーションはより安全になります。</p>",
      "title": "セキュリティ、ネイティブ機能、あなたの責任",
      "description": ":警告:  Node integration が有効な環境で、リモートコードの読み込みと実行を行ってはいけません。 代わりに、Node.js コードの実行にはローカルファイル (アプリケーションと一緒にパッケージ化されているもの) だけを使用してください。 remote コンテンツを表示するには、<webview> tag または BrowserViewを使用します。その時nodeIntegrationを無効に、contextIsolationを有効にすることを確認してください。"
    },
    "/docs/api/structures/segmented-control-segment": {
      "locale": "ja-JP",
      "slug": "segmented-control-segment",
      "href": "/docs/api/structures/segmented-control-segment",
      "crowdinFileId": "256499",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/segmented-control-segment.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"segmentedcontrolsegment-object\"><a href=\"#segmentedcontrolsegment-object\">SegmentedControlSegment Object</a></h1>\n<ul>\n<li><code>label</code> String (optional) - The text to appear in this segment.</li>\n<li><code>icon</code> NativeImage (optional) - The image to appear in this segment.</li>\n<li><code>enabled</code> Boolean (optional) - Whether this segment is selectable. Default: true.</li>\n</ul>",
      "title": "SegmentedControlSegment Object",
      "description": ""
    },
    "/docs/api/structures/serial-port": {
      "locale": "ja-JP",
      "slug": "serial-port",
      "href": "/docs/api/structures/serial-port",
      "crowdinFileId": "256501",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/serial-port.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"serialport-object\"><a href=\"#serialport-object\">SerialPort Object</a></h1>\n<ul>\n<li><code>portId</code> String - Unique identifier for the port.</li>\n<li><code>portName</code> String - Name of the port.</li>\n<li><code>displayName</code> String - A string suitable for display to the user for describing this device.</li>\n<li><code>vendorId</code> String - Optional USB vendor ID.</li>\n<li><code>productId</code> String - Optional USB product ID.</li>\n<li><code>serialNumber</code> String - The USB device serial number.</li>\n<li><code>usbDriverName</code> String (optional) - Represents a single serial port on macOS can be enumerated by multiple drivers.</li>\n<li><code>deviceInstanceId</code> String (optional) - A stable identifier on Windows that can be used for device permissions.</li>\n</ul>",
      "title": "SerialPort Object",
      "description": ""
    },
    "/docs/api/structures/service-worker-info": {
      "locale": "ja-JP",
      "slug": "service-worker-info",
      "href": "/docs/api/structures/service-worker-info",
      "crowdinFileId": "256503",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/service-worker-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"serviceworkerinfo-object\"><a href=\"#serviceworkerinfo-object\">ServiceWorkerInfo Object</a></h1>\n<ul>\n<li><code>scriptUrl</code> String - The full URL to the script that this service worker runs</li>\n<li><code>scope</code> String - The base URL that this service worker is active for.</li>\n<li><code>renderProcessId</code> Number - The virtual ID of the process that this service worker is running in.  This is not an OS level PID.  This aligns with the ID set used for <code>webContents.getProcessId()</code>.</li>\n</ul>",
      "title": "ServiceWorkerInfo Object",
      "description": ""
    },
    "/docs/api/service-workers": {
      "locale": "ja-JP",
      "slug": "service-workers",
      "href": "/docs/api/service-workers",
      "crowdinFileId": "256363",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/service-workers.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"serviceworkerを有効にする\"><a href=\"#serviceworkerを有効にする\">ServiceWorkerを有効にする</a></h2>\n<blockquote>\n<p>session のアクティブなサービスワーカーからのイベントを問い合わせて受信します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<p><code>ServiceWorkers</code> クラスのインスタンスは、<code>Session</code> の <code>serviceWorkers</code> プロパティを使用してアクセスします。</p>\n<p>以下がその例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// すべてのサービスワーカーを取得します。</span>\n<span class=\"hljs-built_in\">console</span>.log(session.defaultSession.serviceWorkers.getAllRunning())\n\n<span class=\"hljs-comment\">// ログを処理してサービスワーカー情報を取得します</span>\nsession.defaultSession.serviceWorkers.on(<span class=\"hljs-string\">'console-message'</span>, (event, messageDetails) => {\n  <span class=\"hljs-built_in\">console</span>.log(\n    <span class=\"hljs-string\">'Got service worker message'</span>,\n    messageDetails,\n    <span class=\"hljs-string\">'from'</span>,\n    session.defaultSession.serviceWorkers.getFromVersionID(messageDetails.versionId)\n  )\n})\n</code></pre>\n<h3 id=\"インスタンスイベント\"><a href=\"#インスタンスイベント\">インスタンスイベント</a></h3>\n<p><code>ServiceWorkers</code> のインスタンスでは、以下のイベントが利用できます。</p>\n<h4 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>messageDetails</code> Object - コンソールメッセージに関する情報<ul>\n<li><code>message</code> String - 実際のコンソールメッセージ</li>\n<li><code>versionId</code> Number - ログメッセージを送信したサービスワーカーのバージョン ID</li>\n<li><code>source</code> String - このメッセージのソースの種別。  <code>javascript</code>、<code>xml</code>、<code>network</code>、<code>console-api</code>、<code>storage</code>、<code>app-cache</code>、<code>rendering</code>、<code>security</code>、<code>deprecation</code>、<code>worker</code>、<code>violation</code>、<code>intervention</code>、<code>recommendation</code>、<code>other</code> のいずれかにできます。</li>\n<li><code>level</code> Number - 0 から 3 のログレベル。 順に <code>verbose</code>、<code>info</code>、<code>warning</code>、<code>error</code> に対応します。</li>\n<li><code>sourceUrl</code> String - メッセージが送られてきた URL</li>\n<li><code>lineNumber</code> Number - このコンソールメッセージのトリガーとなったソースの行番号</li>\n</ul></li>\n</ul>\n<p>サービスワーカーがコンソールに何かをロギングしたときに発生します。</p>\n<h4 id=\"イベント-registration-completed\"><a href=\"#イベント-registration-completed\">イベント: 'registration-completed'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object - 登録されているサービスワーカーに関する情報<ul>\n<li><code>scope</code> String - サービスワーカーが登録している基底 URL</li>\n</ul></li>\n</ul>\n<p>サービスワーカーが登録されてたときに発生します。 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\"><code>navigator.serviceWorker.register('/sw.js')</code></a> の呼び出しが成功した後や、Chrome 拡張機能が読み込まれた後に発生することがあります。</p>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<p><code>ServiceWorkers</code> のインスタンスでは、以下のメソッドが利用できます。</p>\n<h4 id=\"serviceworkersgetallrunning\"><a href=\"#serviceworkersgetallrunning\"><code>serviceWorkers.getAllRunning()</code></a></h4>\n<p>戻り値 <code>Record&#x3C;Number, ServiceWorkerInfo></code> - キーはサービスワーカーのバージョン ID、値は <a href=\"/docs/api/structures/service-worker-info\">ServiceWorkerInfo</a> オブジェクトで、そのサービスワーカーに関する情報です。</p>\n<h4 id=\"serviceworkersgetfromversionidversionid\"><a href=\"#serviceworkersgetfromversionidversionid\"><code>serviceWorkers.getFromVersionID(versionId)</code></a></h4>\n<ul>\n<li><code>versionId</code> Number</li>\n</ul>\n<p>戻り値 <a href=\"/docs/api/structures/service-worker-info\"><code>ServiceWorkerInfo</code></a> - このサービスワーカーについての情報</p>\n<p>サービスワーカーが存在しないか動作していない場合、このメソッドは例外を送出します。</p>",
      "title": "ServiceWorkerを有効にする",
      "description": "session のアクティブなサービスワーカーからのイベントを問い合わせて受信します。"
    },
    "/docs/api/session": {
      "locale": "ja-JP",
      "slug": "session",
      "href": "/docs/api/session",
      "crowdinFileId": "256365",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/session.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"session\"><a href=\"#session\">session</a></h1>\n<blockquote>\n<p>ブラウザーセッション、クッキー、キャッシュ、プロキシの設定などを管理します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>session</code> モジュールは、新しい <code>session</code> オブジェクトを作成するのに使用できます。</p>\n<p><a href=\"/docs/api/web-contents\"><code>WebContents</code></a> の <code>session</code> プロパティ、または <code>session</code> モジュールから、既存のページの <code>session</code> にアクセスすることもできます 。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> ses = win.webContents.session\n<span class=\"hljs-built_in\">console</span>.log(ses.getUserAgent())\n</code></pre>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>session</code> モジュールには以下のメソッドがあります。</p>\n<h3 id=\"sessionfrompartitionpartition-options\"><a href=\"#sessionfrompartitionpartition-options\"><code>session.fromPartition(partition[, options])</code></a></h3>\n<ul>\n<li><code>partition</code> String</li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>cache</code> Boolean - キャッシュを有効にするかどうか。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Session</code> - <code>partition</code> 文字列からの Session のインスタンス。 同じ <code>partition</code> を持つ既存の <code>session</code> が存在する場合は、それが返されます。 それ以外の場合は、<code>options</code> で新しい <code>session</code> インスタンスが作成されます。</p>\n<p><code>partition</code> が <code>persist:</code> 始まりの場合、ページはアプリの全ページで利用可能な永続的なセッションを同じ <code>partition</code> で使用します。 <code>persist:</code> プレフィックスがない場合、ページは、インメモリセッションを使用します。 <code>partition</code> が空の場合は、アプリのデフォルトのセッションが返されます。</p>\n<p><code>options</code> で <code>Session</code> を作成するには、以前に <code>partition</code> との <code>Session</code> が使用されていないことを確認する必要があります。 既存の <code>Session</code> オブジェクトの <code>options</code> を変更する方法はありません。</p>\n<h2 id=\"プロパティ\"><a href=\"#プロパティ\">プロパティ</a></h2>\n<p><code>session</code> モジュールには以下のプロパティがあります。</p>\n<h3 id=\"sessiondefaultsession\"><a href=\"#sessiondefaultsession\"><code>session.defaultSession</code></a></h3>\n<p>アプリのデフォルトの <code>Session</code> オブジェクト。</p>\n<h2 id=\"クラス-session\"><a href=\"#クラス-session\">クラス: Session</a></h2>\n<blockquote>\n<p>セッションのプロパティを取得し、設定します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<p><code>session</code> モジュールでは、<code>Session</code> オブジェクトを作成できます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> ses = session.fromPartition(<span class=\"hljs-string\">'persist:name'</span>)\n<span class=\"hljs-built_in\">console</span>.log(ses.getUserAgent())\n</code></pre>\n<h3 id=\"インスタンスイベント\"><a href=\"#インスタンスイベント\">インスタンスイベント</a></h3>\n<p><code>Session</code> のインスタンスでは、以下のイベントが利用できます。</p>\n<h4 id=\"イベント-will-download\"><a href=\"#イベント-will-download\">イベント: 'will-download'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>item</code> <a href=\"/docs/api/download-item\">DownloadItem</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Electron が <code>webContents</code> 内で <code>item</code> をダウンロードするときに発生します。</p>\n<p><code>event.preventDefault()</code> を呼び出すと、ダウンロードをキャンセルし、<code>item</code> はプロセスの次のティックから使用できなくなります。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nsession.defaultSession.on(<span class=\"hljs-string\">'will-download'</span>, (event, item, webContents) => {\n  event.preventDefault()\n  <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'got'</span>)(item.getURL()).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">response</span>) =></span> {\n    <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>).writeFileSync(<span class=\"hljs-string\">'/somewhere'</span>, response.body)\n  })\n})\n</code></pre>\n<h4 id=\"イベント-extension-loaded\"><a href=\"#イベント-extension-loaded\">イベント: 'extension-loaded'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>拡張機能が読み込まれた後に発生します。 これは、拡張機能が \"有効な\" 拡張機能のセットに追加されるたびに発生します。 これは以下のものが含まれます。</p>\n<ul>\n<li><code>Session.loadExtension</code> から拡張機能が読み込まれるとき。</li>\n<li>拡張機能が再読み込みされるとき。<ul>\n<li>クラッシュによって。</li>\n<li>拡張機能が要求したことで (<a href=\"https://developer.chrome.com/extensions/runtime#method-reload\"><code>chrome.runtime.reload()</code></a>)。</li>\n</ul></li>\n</ul>\n<h4 id=\"イベント-extension-unloaded\"><a href=\"#イベント-extension-unloaded\">イベント: 'extension-unloaded'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>拡張機能が取り除かれた後に発生します。 これは <code>Session.removeExtension</code> が呼ばれたときに発生します。</p>\n<h4 id=\"イベント-extension-ready\"><a href=\"#イベント-extension-ready\">イベント: 'extension-ready'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>拡張機能が読み込まれ、必要なブラウザの状態がすべて初期化され、拡張機能のバックグラウンドページの開始をサポートするようになった後に発生します。</p>\n<h4 id=\"イベント-preconnect\"><a href=\"#イベント-preconnect\">イベント: 'preconnect'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preconnectUrl</code> String - レンダラーによって事前接続に要求されている URL。</li>\n<li><code>allowCredentials</code> Boolean - レンダラーが接続に資格情報を含めることを要求している場合は true です (詳細については、<a href=\"https://w3c.github.io/resource-hints/#preconnect\">仕様</a> を参照してください)。</li>\n</ul>\n<p>一般的に <a href=\"https://w3c.github.io/resource-hints/\">リソースヒント</a> が原因で、レンダリングプロセスが URL への事前接続を要求したときに生成されます。</p>\n<h4 id=\"イベント-spellcheck-dictionary-initialized\"><a href=\"#イベント-spellcheck-dictionary-initialized\">イベント: 'spellcheck-dictionary-initialized'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - 辞書ファイルの言語コード</li>\n</ul>\n<p>hunspell 辞書ファイルの初期化に成功したときに発生します。 これはファイルをダウンロードした後に発生します。</p>\n<h4 id=\"イベント-spellcheck-dictionary-download-begin\"><a href=\"#イベント-spellcheck-dictionary-download-begin\">イベント: 'spellcheck-dictionary-download-begin'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - 辞書ファイルの言語コード</li>\n</ul>\n<p>hunspell 辞書ファイルのダウンロードが始まったときに発生します</p>\n<h4 id=\"イベント-spellcheck-dictionary-download-success\"><a href=\"#イベント-spellcheck-dictionary-download-success\">イベント: 'spellcheck-dictionary-download-success'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - 辞書ファイルの言語コード</li>\n</ul>\n<p>hunspell 辞書ファイルのダウンロードに成功したときに発生します</p>\n<h4 id=\"イベント-spellcheck-dictionary-download-failure\"><a href=\"#イベント-spellcheck-dictionary-download-failure\">イベント: 'spellcheck-dictionary-download-failure'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - 辞書ファイルの言語コード</li>\n</ul>\n<p>hunspell 辞書ファイルのダウンロードが失敗したときに発生します。  失敗の詳細は、netlog を収集してダウンロードリクエストを調べる必要があります。</p>\n<h4 id=\"イベント-select-hid-device\"><a href=\"#イベント-select-hid-device\">イベント: 'select-hid-device'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>deviceList</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>deviceId</code> String | null (任意)</li>\n</ul></li>\n</ul>\n<p><code>navigator.hid.requestDevice</code> の呼び出し時に HID デバイスを選択する必要がある場合に発生します。 <code>callback</code> は選択する <code>deviceId</code> で呼び出してください。<code>callback</code> に引数を渡さなければ、リクエストをキャンセルします。  また、<a href=\"#sessetpermissioncheckhandlerhandler\">ses.setPermissionCheckHandler(handler)</a> や <a href=\"#sessetdevicepermissionhandlerhandler\">ses.setDevicePermissionHandler(handler)`</a> を使うことで、<code>navigator.hid</code> の権限をさらに管理できます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.webContents.session.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin, details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-comment\">// ここにロジックを追加して、HID の選択を許可すべきかどうかを判断します</span>\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  <span class=\"hljs-comment\">// 任意で、以前に永続化されたデバイスを永続ストアから取得します</span>\n  <span class=\"hljs-keyword\">const</span> grantedDevices = fetchGrantedDevices()\n\n  win.webContents.session.setDevicePermissionHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(details.origin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; details.deviceType === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-keyword\">if</span> (details.device.vendorId === <span class=\"hljs-number\">123</span> &#x26;&#x26; details.device.productId === <span class=\"hljs-number\">345</span>) {\n        <span class=\"hljs-comment\">// このタイプのデバイスを常に許可します (これにより最初の `navigator.hid.requestDevice` の呼び出しを省略できます)</span>\n        <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n      }\n\n      <span class=\"hljs-comment\">// 過去に許可されたデバイスのリストを検索します</span>\n      <span class=\"hljs-keyword\">return</span> grantedDevices.some(<span class=\"hljs-function\">(<span class=\"hljs-params\">grantedDevice</span>) =></span> {\n        <span class=\"hljs-keyword\">return</span> grantedDevice.vendorId === details.device.vendorId &#x26;&#x26;\n              grantedDevice.productId === details.device.productId &#x26;&#x26;\n              grantedDevice.serialNumber &#x26;&#x26; grantedDevice.serialNumber === details.device.serialNumber\n      })\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  win.webContents.session.on(<span class=\"hljs-string\">'select-hid-device'</span>, (event, details, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedDevice = details.deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    callback(selectedPort?.deviceId)\n  })\n})\n</code></pre>\n<h4 id=\"イベント-hid-device-added\"><a href=\"#イベント-hid-device-added\">イベント: 'hid-device-added'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n</ul>\n<p>新しい HID デバイスが利用可能になったときに発生します。 例えば、新しい USB デバイスが接続されたときに発生します。</p>\n<p>このイベントは、<code>navigator.hid.requestDevice</code> が呼び出されて <code>select-hid-device</code> が発火した後にのみ発生します。</p>\n<h4 id=\"イベント-hid-device-removed\"><a href=\"#イベント-hid-device-removed\">イベント: 'hid-device-removed'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n</ul>\n<p>HID デバイスが接続解除されたときに発生します。  例えば、このイベントは USB デバイスが取り除かれたときに発生します。</p>\n<p>このイベントは、<code>navigator.hid.requestDevice</code> が呼び出されて <code>select-hid-device</code> が発火した後にのみ発生します。</p>\n<h4 id=\"イベント-select-serial-port\"><a href=\"#イベント-select-serial-port\">イベント: 'select-serial-port'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>portList</code> <a href=\"/docs/api/structures/serial-port\">SerialPort[]</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>portId</code> String</li>\n</ul></li>\n</ul>\n<p><code>navigator.serial.requestPort</code> の呼び出し時にシリアルポートを選択する必要がある場合に発生します。 <code>callback</code> は選んだ <code>portId</code> で呼び出されなければなりません。空の文字列を <code>callback</code> に渡すとリクエストがキャンセルされます。  さらに、<a href=\"#sessetpermissioncheckhandlerhandler\">ses.setPermissionCheckHandler(handler)</a> を <code>serial</code> パーミッションで使用することで <code>navigator.serial</code> のパーミッションを管理できます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n  win.webContents.session.on(<span class=\"hljs-string\">'select-serial-port'</span>, (event, portList, webContents, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedPort = portList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    <span class=\"hljs-keyword\">if</span> (!selectedPort) {\n      callback(<span class=\"hljs-string\">''</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      callback(selectedPort.portId)\n    }\n  })\n})\n</code></pre>\n<h4 id=\"イベント-serial-port-added\"><a href=\"#イベント-serial-port-added\">イベント: 'serial-port-added'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>port</code> <a href=\"/docs/api/structures/serial-port\">SerialPort</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p><code>navigator.serial.requestPort</code> が呼び出され新しいシリアルポートが利用可能になった場合に、<code>select-serial-port</code> が発生した後に発生します。  例えば、このイベントは新しい USB デバイスが接続されたときに発生します。</p>\n<h4 id=\"イベント-serial-port-removed\"><a href=\"#イベント-serial-port-removed\">イベント: 'serial-port-removed'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>port</code> <a href=\"/docs/api/structures/serial-port\">SerialPort</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p><code>navigator.serial.requestPort</code> が呼び出されシリアルポートが削除された場合に、<code>select-serial-port</code> が発生した後に発生します。  例えば、このイベントは USB デバイスが取り除かれたときに発生します。</p>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<p><code>Session</code> のインスタンスでは、以下のメソッドが利用できます。</p>\n<h4 id=\"sesgetcachesize\"><a href=\"#sesgetcachesize\"><code>ses.getCacheSize()</code></a></h4>\n<p>戻り値 <code>Promise&#x3C;Integer></code> - バイト単位の、session の現在のキャッシュサイズ。</p>\n<h4 id=\"sesclearcache\"><a href=\"#sesclearcache\"><code>ses.clearCache()</code></a></h4>\n<p>戻り値 <code>Promise&#x3C;void></code> - キャッシュクリア操作が完了すると実行されます。</p>\n<p>セッションの HTTP キャッシュをクリアします。</p>\n<h4 id=\"sesclearstoragedataoptions\"><a href=\"#sesclearstoragedataoptions\"><code>ses.clearStorageData([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (任意)<ul>\n<li><code>origin</code> String (任意) - <code>window.location.origin</code> の表記の <code>scheme://host:port</code> に従わなければいけません。</li>\n<li><code>storages</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> - クリアするストレージの種類。<code>appcache</code>, <code>cookies</code>, <code>filesystem</code>, <code>indexdb</code>, <code>localstorage</code>, <code>shadercache</code>, <code>websql</code>, <code>serviceworkers</code>, <code>cachestorage</code> を含めることができます。 指定しない場合は、全種類のストレージをクリアします。</li>\n<li><code>quotas</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> - クリアするクォータの種類。<code>temporary</code>, <code>persistent</code>, <code>syncable</code> を含むことができます。 指定しない場合は、全てのクオータをクリアします。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - ストレージデータがクリアされると実行されます。</p>\n<h4 id=\"sesflushstoragedata\"><a href=\"#sesflushstoragedata\"><code>ses.flushStorageData()</code></a></h4>\n<p>未書き込みの DOM ストレージのデータをディスクに書き込みます。</p>\n<h4 id=\"sessetproxyconfig\"><a href=\"#sessetproxyconfig\"><code>ses.setProxy(config)</code></a></h4>\n<ul>\n<li><code>config</code> Object<ul>\n<li><code>mode</code> String (任意) - そのプロキシのモードです。 <code>direct</code>、<code>auto_detect</code>、<code>pac_script</code>、<code>fixed_servers</code>、<code>system</code> のうちの一つであるべきです。 指定しない場合は、他の指定オプションに基づいて自動決定されます。<ul>\n<li><code>direct</code> direct モードでは、すべての接続はプロキシを介さずに直接作成されます。</li>\n<li><code>auto_detect</code> auto_detect モードでは、プロキシの設定は <a href=\"http://wpad/wpad.dat\">http://wpad/wpad.dat</a> でダウンロードできる PAC スクリプトによって決定されます。</li>\n<li><code>pac_script</code> pac_script モードでは、プロキシの設定は <code>pacScript</code> で指定された URL から取得される PAC スクリプトによって決定されます。 これは <code>pacScript</code> が指定されている場合のデフォルトモードです。</li>\n<li><code>fixed_servers</code> fixed_servers モードでは、プロキシの設定を <code>proxyRules</code> で指定します。 これは <code>proxyRules</code> が指定されている場合のデフォルトモードです。</li>\n<li><code>system</code> system モードでは、プロキシ構成をオペレーティングシステムから取得します。 system モードはプロキシ構成を設定しない場合とは異なりますのでご注意ください。 後者の場合、プロキシ設定に影響を与えるコマンドラインオプションがない場合にのみ、 Electron はシステム設定にフォールバックします。</li>\n</ul></li>\n<li><code>pacScript</code> String (任意) - PAC ファイルに関連付けられた URL。</li>\n<li><code>proxyRules</code> String (任意) - 使用するプロキシを示すルール。</li>\n<li><code>proxyBypassRules</code> String (任意) - プロキシ設定をバイパスする URL を示すルール。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - プロキシ設定処理が完了すると実行されます。</p>\n<p>プロキシ設定を設定します。</p>\n<p><code>mode</code> を指定せずに <code>pacScript</code> と<code>proxyRules</code> をどちらも一緒に指定した場合、<code>proxyRules</code> は オプションは無視され <code>pacScript</code> の設定が適用されます。</p>\n<p>以前のプロキシでプールされたソケットが将来のリクエストで再利用されるのを防ぐには、現在フライト中の接続を閉じるために <code>ses.closeAllConnections</code> が必要でしょう。</p>\n<p><code>proxyRules</code> は以下のルールに従う必要があります。</p>\n<pre><code class=\"hljs language-sh\">proxyRules = schemeProxies[<span class=\"hljs-string\">\";\"</span>&#x3C;schemeProxies>]\nschemeProxies = [&#x3C;urlScheme><span class=\"hljs-string\">\"=\"</span>]&#x3C;proxyURIList>\nurlScheme = <span class=\"hljs-string\">\"http\"</span> | <span class=\"hljs-string\">\"https\"</span> | <span class=\"hljs-string\">\"ftp\"</span> | <span class=\"hljs-string\">\"socks\"</span>\nproxyURIList = &#x3C;proxyURL>[<span class=\"hljs-string\">\",\"</span>&#x3C;proxyURIList>]\nproxyURL = [&#x3C;proxyScheme><span class=\"hljs-string\">\"://\"</span>]&#x3C;proxyHost>[<span class=\"hljs-string\">\":\"</span>&#x3C;proxyPort>]\n</code></pre>\n<p>以下がその例です。</p>\n<ul>\n<li><code>http=foopy:80;ftp=foopy2</code> - <code>http://</code> URL には HTTP プロキシ <code>foopy:80</code> を、<code>ftp://</code> URL には HTTP プロキシ <code>foopy2:80</code> を使用する。</li>\n<li><code>foopy:80</code> - すべての URL に <code>foopy:80</code> HTTP プロキシを使用する。</li>\n<li><code>foopy:80,bar,direct://</code> - すべての URL に <code>foopy:80</code> HTTP プロキシを使用する。 <code>foopy:80</code> が使用できない場合は <code>bar</code> にフェイルオーバーし、その後はプロキシを使用しません。</li>\n<li><code>socks4://foopy</code> - すべての URL に SOCKS 4 プロキシ <code>foopy:1080</code> を使用する。</li>\n<li><code>http=foopy,socks5://bar.com</code> - HTTP の URL には HTTP プロキシ <code>foopy</code> を使用し、<code>foopy</code> が使用できない場合は SOCKS 5 プロキシ <code>bar.com</code> にフェイルオーバーします。</li>\n<li><code>http=foopy,socks5://bar.com</code> - HTTP の URL には HTTP プロキシ <code>foopy</code> を使用し、<code>foopy</code> が使用できない場合はプロキシを使用しません。</li>\n<li><code>http=foopy;socks=foopy2</code> - HTTP の URL には HTTP プロキシ <code>foopy</code> を、ほかの URLには <code>socks4://foopy2</code> を使用します。</li>\n</ul>\n<p><code>proxyBypassRules</code> は以下に説明されているコンマ区切りのルールのリストです。</p>\n<ul>\n<li>\n<p><code>[ URL_SCHEME \"://\" ] HOSTNAME_PATTERN [ \":\" &#x3C;port> ]</code></p>\n<p> HOSTNAME_PATTERN パターンに一致するすべてのホスト名のマッチ。</p>\n<p> 例: \"foobar.com\", \"<em>foobar.com\", \"</em>.foobar.com\", \"<em>foobar.com:99\", \"<a href=\"https://x\">https://x</a>.</em>.y.com:99\"</p>\n</li>\n<li>\n<p><code>\".\" HOSTNAME_SUFFIX_PATTERN [ \":\" PORT ]</code></p>\n<p> 特定のドメインサフィックスのマッチ。</p>\n<p> 例: \".google.com\", \".com\", \"<a href=\"http://.google.com\">http://.google.com</a>\"</p>\n</li>\n<li>\n<p><code>[ SCHEME \"://\" ] IP_LITERAL [ \":\" PORT ]</code></p>\n<p> IP アドレスリテラルである URL のマッチ。</p>\n<p> 例: \"127.0.1\", \"[0:0::1]\", \"[::1]\", \"<a href=\"http://%5B::1%5D:99\">http://[::1]:99</a>\"</p>\n</li>\n<li>\n<p><code>IP_LITERAL \"/\" PREFIX_LENGTH_IN_BITS</code></p>\n<p> 指定された範囲内の IP リテラルに一致する URL のマッチ。 IP の範囲は CIDR 表記で指定します。</p>\n<p> 例: \"192.168.1.1/16\", \"fefe:13::abc/33\".</p>\n</li>\n<li>\n<p><code>&#x3C;local></code></p>\n<p> ローカルアドレスのマッチ。 <code>&#x3C;local></code> の意味は、ホストが \"127.0.0.1\"、\"::1\"、\"localhost\" のいずれかに一致するかどうかです。</p>\n</li>\n</ul>\n<h4 id=\"sesresolveproxyurl\"><a href=\"#sesresolveproxyurl\"><code>ses.resolveProxy(url)</code></a></h4>\n<ul>\n<li><code>url</code> URL</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;String></code> - <code>url</code> のプロキシ情報で実行されます。</p>\n<h4 id=\"sesforcereloadproxyconfig\"><a href=\"#sesforcereloadproxyconfig\"><code>ses.forceReloadProxyConfig()</code></a></h4>\n<p>戻り値 <code>Promise&#x3C;void></code> - プロキシサービスのすべての内部状態がリセットされたときに解決します。すでに利用可能な場合は最新のプロキシ設定が再適用されます。 プロキシモードが <code>pac_script</code> の場合、再び <code>pacScript</code> から PAC スクリプトが取得されます。</p>\n<h4 id=\"sessetdownloadpathpath\"><a href=\"#sessetdownloadpathpath\"><code>ses.setDownloadPath(path)</code></a></h4>\n<ul>\n<li><code>path</code> String - ダウンロード場所。</li>\n</ul>\n<p>ダウンロードの保存ディレクトリを設定します。 デフォルトでは、ダウンロードディレクトリは各アプリフォルダの下の <code>ダウンロード (Downloads)</code> になります。</p>\n<h4 id=\"sesenablenetworkemulationoptions\"><a href=\"#sesenablenetworkemulationoptions\"><code>ses.enableNetworkEmulation(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>offline</code> Boolean (任意) - ネットワークの停止をエミュレートするかどうか。 省略値は false です。</li>\n<li><code>latency</code> Double (任意) - RTT ミリ秒。 省略値は 0 で、このときレイテンシのスロットルは無効化されます。</li>\n<li><code>downloadThroughput</code> Double (任意) - 下りレート Bps。 省略値は 0 で、このときダウンロードのスロットルは無効化されます。</li>\n<li><code>uploadThroughput</code> Double (任意) - 上りレート Bps。 省略値は 0 で、このときアップロードのスロットルは無効化されます。</li>\n</ul></li>\n</ul>\n<p><code>session</code> の指定された構成でネットワークをエミュレートします。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// 50kbps のスループットと 500ms の待ち時間で GPRS 接続をエミュレートする。</span>\n<span class=\"hljs-built_in\">window</span>.webContents.session.enableNetworkEmulation({\n  <span class=\"hljs-attr\">latency</span>: <span class=\"hljs-number\">500</span>,\n  <span class=\"hljs-attr\">downloadThroughput</span>: <span class=\"hljs-number\">6400</span>,\n  <span class=\"hljs-attr\">uploadThroughput</span>: <span class=\"hljs-number\">6400</span>\n})\n\n<span class=\"hljs-comment\">// ネットワークの停止をエミュレートする。</span>\n<span class=\"hljs-built_in\">window</span>.webContents.session.enableNetworkEmulation({ <span class=\"hljs-attr\">offline</span>: <span class=\"hljs-literal\">true</span> })\n</code></pre>\n<h4 id=\"sespreconnectoptions\"><a href=\"#sespreconnectoptions\"><code>ses.preconnect(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>url</code> String - 事前接続する URL。 ソケットの開通に関係しているのはオリジンのみです。</li>\n<li><code>numSockets</code> Number (任意) - 事前接続するソケット数。 1 から 6 にしてください。 省略値は 1 です。</li>\n</ul></li>\n</ul>\n<p>指定された数のソケットをオリジンに事前接続します。</p>\n<h4 id=\"sescloseallconnections\"><a href=\"#sescloseallconnections\"><code>ses.closeAllConnections()</code></a></h4>\n<p>戻り値 <code>Promise&#x3C;void></code> - すべての接続が閉じられた時に解決されます。</p>\n<p><strong>注:</strong> 現在フライト中のすべてのリクエストが終了/失敗します。</p>\n<h4 id=\"sesdisablenetworkemulation\"><a href=\"#sesdisablenetworkemulation\"><code>ses.disableNetworkEmulation()</code></a></h4>\n<p><code>session</code> に対して既にアクティブなネットワークエミュレーションを無効にします。 元のネットワーク構成にリセットします。</p>\n<h4 id=\"sessetcertificateverifyprocproc\"><a href=\"#sessetcertificateverifyprocproc\"><code>ses.setCertificateVerifyProc(proc)</code></a></h4>\n<ul>\n<li><code>proc</code> Function | null<ul>\n<li><code>request</code> Object<ul>\n<li><code>hostname</code> String</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>validatedCertificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>verificationResult</code> String - Chromium からの認証結果。</li>\n<li><code>errorCode</code> Integer - エラーコード。</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>verificationResult</code> Integer - <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">こちら</a> の証明書エラーコードのうち一つの値を取ります。 証明書エラーコードの他に、以下の特殊コードを取ることがあります。<ul>\n<li><code>0</code> - 成功を示し、証明書の透明性の検証を無効にします。</li>\n<li><code>-2</code> - 失敗を示します。</li>\n<li><code>-3</code> - Chromium からの認証結果を使用します。</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p><code>session</code> の証明書検証プロセスを設定し、サーバー証明書の検証が要求されるたびに<code>proc</code> を <code>proc(request, callback)</code> で呼びます。 <code>callback(0)</code> を呼ぶと証明書を承認し、<code>callback(-2)</code> を呼ぶとそれを拒否します。</p>\n<p><code>setCertificateVerifyProc(null)</code> を呼び出すと、デフォルトの証明書検証プロシージャに戻ります。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.webContents.session.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">request, callback</span>) =></span> {\n  <span class=\"hljs-keyword\">const</span> { hostname } = request\n  <span class=\"hljs-keyword\">if</span> (hostname === <span class=\"hljs-string\">'github.com'</span>) {\n    callback(<span class=\"hljs-number\">0</span>)\n  } <span class=\"hljs-keyword\">else</span> {\n    callback(<span class=\"hljs-number\">-2</span>)\n  }\n})\n</code></pre>\n<blockquote>\n<p><strong>注意:</strong> このプロシージャの結果は、ネットワークサービスによってキャッシュされます。</p>\n</blockquote>\n<h4 id=\"sessetpermissionrequesthandlerhandler\"><a href=\"#sessetpermissionrequesthandlerhandler\"><code>ses.setPermissionRequestHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Function | null<ul>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a> - 権限を要求している WebContents。  リクエストがサブフレームからのものである場合、リクエストのオリジンを確認するためには <code>requestingUrl</code> を使用する必要があることに注意してください。</li>\n<li><code>permission</code> String - 要求されたパーミッションのタイプ。<ul>\n<li><code>clipboard-read</code> - クリップボードからの読み取りアクセスを要求する。</li>\n<li><code>media</code> - カメラ、マイク、スピーカーなどのメディアデバイスへのアクセスを要求する。</li>\n<li><code>display-capture</code> - 画面キャプチャへのアクセスをリクエストします。</li>\n<li><code>mediaKeySystem</code> - DRM で保護されたコンテンツへのアクセスを要求します。</li>\n<li><code>geolocation</code> - ユーザーの現在地へのアクセスを要求する。</li>\n<li><code>notifications</code> - 通知の作成とユーザーのシステムトレイに表示する機能を要求します。</li>\n<li><code>midi</code> - <code>webmidi</code> API で MIDI アクセスを要求します。</li>\n<li><code>midiSysex</code> - <code>webmidi</code> API でシステム専用メッセージの使用を要求する。</li>\n<li><code>pointerLock</code> - 入力方法としてマウスの動きを直接解釈するよう要求する。 詳細は<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API\">こちら </a> をクリックしてください。</li>\n<li><code>fullscreen</code> - アプリがフルスクリーンモードになるよう要求する。</li>\n<li><code>openExternal</code> - 外部アプリケーションでリンクを開くように要求する。</li>\n<li><code>unknown</code> - 認識されない認可リクエスト</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>permissionGranted</code> Boolean - 権限の許可か拒否.</li>\n</ul></li>\n<li><code>details</code> Object - このプロパティの一部は、特定の権限タイプでのみ使用できます。<ul>\n<li><code>externalURL</code> String (任意) - <code>openExternal</code> リクエストの URL。</li>\n<li><code>mediaTypes</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> - 要求されている、複数のメディアアクセスのタイプ。要素は <code>video</code> か <code>audio</code> にできます</li>\n<li><code>requestingUrl</code> String - リクエストしているフレームが読み込んだ最後の URL</li>\n<li><code>isMainFrame</code> Boolean - リクエストしたフレームがメインフレームかどうか</li>\n</ul></li>\n</ul></li>\n</ul>\n<p><code>session</code> の、権限の要求に応答するために使用できるハンドラを設定します。 <code>callback(true)</code> を呼ぶと権限が許可され <code>callback(false)</code> を呼ぶと拒否されます。 ハンドラをクリアするには、<code>setPermissionRequestHandler(null)</code> を呼びます。  注意として、完全な認可処理にするには <code>setPermissionCheckHandler</code> も実装しなければなりません。 ほとんどのウェブ API は権限の確認を行い、確認が拒否されている場合は認可のリクエストを行います。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nsession.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).setPermissionRequestHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, callback</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (webContents.getURL() === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notifications'</span>) {\n    <span class=\"hljs-keyword\">return</span> callback(<span class=\"hljs-literal\">false</span>) <span class=\"hljs-comment\">// 拒否。</span>\n  }\n\n  callback(<span class=\"hljs-literal\">true</span>)\n})\n</code></pre>\n<h4 id=\"sessetpermissioncheckhandlerhandler\"><a href=\"#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Function\\<boolean> | null<ul>\n<li><code>webContents</code> (<a href=\"/docs/api/web-contents\">WebContents</a> | null) - 権限を確認している WebContents  リクエストがサブフレームからのものである場合、リクエストのオリジンを確認するためには <code>requestingUrl</code> を使用する必要があることに注意してください。  すべてのクロスオリジンサブフレームによる権限の確認はハンドラの webContents に <code>null</code> が渡されますが、<code>notifications</code> の確認のような、ある特定の権限の確認では常に <code>null</code> が渡されます。  <code>embeddingOrigin</code> と <code>requestingOrigin</code> を使用して、所有しているフレームと要求しているフレームがそれぞれどのオリジンにあるかを判断する必要があります。</li>\n<li><code>permission</code> String - 権限確認の種別です。  有効な値は <code>midiSysex</code>, <code>notifications</code>, <code>geolocation</code>, <code>media</code>, <code>mediaKeySystem</code>, <code>midi</code>, <code>pointerLock</code>, <code>fullscreen</code>, <code>openExternal</code>, <code>hid</code>, <code>serial</code> のいずれかです。</li>\n<li><code>requestingOrigin</code> String - 権限チェックのオリジン URL</li>\n<li><code>details</code> Object - このプロパティの一部は、特定の権限タイプでのみ使用できます。<ul>\n<li><code>embeddingOrigin</code> String (任意) - 権限の確認をしたフレームのオリジン。  権限の確認を行うクロスオリジンのサブフレームでのみ設定されます。</li>\n<li><code>securityOrigin</code> String (任意) - <code>media</code> の確認でのセキュリティオリジン。</li>\n<li><code>mediaType</code> String (任意) - 要求されたメディアアクセスの型で、<code>video</code>、<code>audio</code> か <code>unknown</code> になります。</li>\n<li><code>requestingUrl</code> String (任意) - リクエストしているフレームが読み込んだ最後の URL.  権限の確認を行うクロスオリジンのサブフレームでは提供されません。</li>\n<li><code>isMainFrame</code> Boolean - リクエストしたフレームがメインフレームかどうか</li>\n</ul></li>\n</ul></boolean></li>\n</ul>\n<p><code>session</code> の、権限のチェックに応答するために使用できるハンドラを設定します。 <code>true</code>を返すと権限を許可し、<code>false</code> を返すとそれを拒否します。  注意として、完全な認可処理にするには <code>setPermissionRequestHandler</code> も実装しなければなりません。 ほとんどのウェブ API は権限の確認を行い、確認が拒否されている場合は認可のリクエストを行います。 ハンドラをクリアするには、<code> setPermissionCheckHandler(null)</code> を呼びます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>)\nsession.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(requestingOrigin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notifications'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span> <span class=\"hljs-comment\">// 認可</span>\n  }\n\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span> <span class=\"hljs-comment\">// 拒否</span>\n})\n</code></pre>\n<h4 id=\"sessetdevicepermissionhandlerhandler\"><a href=\"#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Function\\<boolean> | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>deviceType</code> String - 許可が求められているデバイスのタイプで、<code>hid</code> になります。</li>\n<li><code>origin</code> String - デバイス権限チェックのオリジン URL。</li>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice</a> - 許可を求められているデバイス。</li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a> - デバイスの許可を確認している WebFrameMain。</li>\n</ul></li>\n</ul></boolean></li>\n</ul>\n<p>デバイスの権限チェックの応答に使用できるハンドラを <code>session</code> に設定します。 <code>true</code> を返すとデバイスに権限を許可し、<code>false</code> を返すとそれを拒否します。 ハンドラを消去するには <code>setDevicePermissionHandler(null)</code> と呼び出します。 このハンドラは、最初にデバイスへの許可の呼び出しを (<code>navigator.hid.requestDevice</code> などを介して) せずに、デバイスへのデフォルト権限を提供するために利用できます。  このハンドラが定義されていない場合、(<code>navigator.hid.requestDevice</code> などを介した) デバイスの選択において付与された権限をデフォルトのデバイス権限として使用します。 さらに、Electron のデフォルト動作では付与されたデバイス権限を対応する WebContents が有効の間だけ保存します。  より長期間の保存が必要な場合、開発者は付与されたデバイスのパーミッションを保存し (<code>select-hid-device</code> イベントを処理するときなど)、<code>setDevicePermissionHandler</code> でそのストレージから読み出しできます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.webContents.session.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin, details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-comment\">// ここにロジックを追加して、HID の選択を許可すべきかどうかを判断します</span>\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  <span class=\"hljs-comment\">// 任意で、以前に永続化されたデバイスを永続ストアから取得します</span>\n  <span class=\"hljs-keyword\">const</span> grantedDevices = fetchGrantedDevices()\n\n  win.webContents.session.setDevicePermissionHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(details.origin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; details.deviceType === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-keyword\">if</span> (details.device.vendorId === <span class=\"hljs-number\">123</span> &#x26;&#x26; details.device.productId === <span class=\"hljs-number\">345</span>) {\n        <span class=\"hljs-comment\">// このタイプのデバイスを常に許可します (これにより最初の `navigator.hid.requestDevice` の呼び出しを省略できます)</span>\n        <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n      }\n\n      <span class=\"hljs-comment\">// 過去に許可されたデバイスのリストを検索します</span>\n      <span class=\"hljs-keyword\">return</span> grantedDevices.some(<span class=\"hljs-function\">(<span class=\"hljs-params\">grantedDevice</span>) =></span> {\n        <span class=\"hljs-keyword\">return</span> grantedDevice.vendorId === details.device.vendorId &#x26;&#x26;\n              grantedDevice.productId === details.device.productId &#x26;&#x26;\n              grantedDevice.serialNumber &#x26;&#x26; grantedDevice.serialNumber === details.device.serialNumber\n      })\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  win.webContents.session.on(<span class=\"hljs-string\">'select-hid-device'</span>, (event, details, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedDevice = details.deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    callback(selectedPort?.deviceId)\n  })\n})\n</code></pre>\n<h4 id=\"sesclearhostresolvercache\"><a href=\"#sesclearhostresolvercache\"><code>ses.clearHostResolverCache()</code></a></h4>\n<p>戻り値 <code>Promise&#x3C;void></code> - 操作が完了すると実行されます。</p>\n<p>ホスト解決のキャッシュをクリアします。</p>\n<h4 id=\"sesallowntlmcredentialsfordomainsdomains\"><a href=\"#sesallowntlmcredentialsfordomainsdomains\"><code>ses.allowNTLMCredentialsForDomains(domains)</code></a></h4>\n<ul>\n<li><code>domains</code> String - 統合認証が有効であるサーバーのコンマ区切りのリスト。</li>\n</ul>\n<p>HTTP NTLM またはネゴシエート認証の資格情報を常に送信するかどうかを動的に設定します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">// 統合認証に、`example.com`、`foobar.com`、`baz`</span>\n<span class=\"hljs-comment\">// で終わる URL を考えます。</span>\nsession.defaultSession.allowNTLMCredentialsForDomains(<span class=\"hljs-string\">'*example.com, *foobar.com, *baz'</span>)\n\n<span class=\"hljs-comment\">// 統合認証に、すべての URL を考えます。</span>\nsession.defaultSession.allowNTLMCredentialsForDomains(<span class=\"hljs-string\">'*'</span>)\n</code></pre>\n<h4 id=\"sessetuseragentuseragent-acceptlanguages\"><a href=\"#sessetuseragentuseragent-acceptlanguages\"><code>ses.setUserAgent(userAgent[, acceptLanguages])</code></a></h4>\n<ul>\n<li><code>userAgent</code> String</li>\n<li><code>acceptLanguages</code> String (任意)</li>\n</ul>\n<p>このセッションの <code>userAgent</code> と <code>acceptLanguages</code> をオーバーライドします。</p>\n<p><code>acceptLanguages</code> は、言語コードのカンマ区切りリスト (例: <code>\"en-US, fr, de, ko, zh-CN, ja\"</code>) でなければなりません。</p>\n<p>これは既存の <code>WebContents</code> には影響しません。それぞれの <code>WebContents</code> は <code>webContents.setUserAgent</code> を使用してセッション全体のユーザーエージェントをオーバーライドできます。</p>\n<h4 id=\"sesispersistent\"><a href=\"#sesispersistent\"><code>ses.isPersistent()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - このセッションが持続的なものであるかどうか。 <code>BrowserWindow</code> のデフォルトの <code>webContents</code> セッションは持続的です。 パーティションからセッションを作成する場合、<code>persist:</code> で始まるセッションは持続化され、他のセッションは一時的なものになります。</p>\n<h4 id=\"sesgetuseragent\"><a href=\"#sesgetuseragent\"><code>ses.getUserAgent()</code></a></h4>\n<p>戻り値 <code>String</code> - このセッションのユーザエージェント。</p>\n<h4 id=\"sessetsslconfigconfig\"><a href=\"#sessetsslconfigconfig\"><code>ses.setSSLConfig(config)</code></a></h4>\n<ul>\n<li><code>config</code> Object<ul>\n<li><code>minVersion</code> String (任意) - <code>tls1</code>、<code>tls1.1</code>、<code>tls1.2</code>、<code>tls1.3</code> のいずれかにできます。 これはリモートサーバーに接続する際に許可する最小の SSL バージョンです。 省略値は <code>tls1</code> です。</li>\n<li><code>maxVersion</code> String (任意) - <code>tls1.2</code> か <code>tls1.3</code> にできます。 これはリモートサーバーに接続する際に許可する最大の SSL バージョンです。 省略値は <code>tls1.3</code> です。</li>\n<li><code>disabledCipherSuites</code> Integer<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> - ネット組み込みポリシーで無効化されたものに加えて、使用を禁止すべき暗号スートを明示したリスト。 0xAABB のようなリテラルの形式をサポートしています。ここで AA は <code>cipher_suite[0]</code> であり、BB は <code>cipher_suite[1]</code> です。これは RFC 2246 のセクション 7.4.1.2 で定義されています。 識別不可かつパース可能な暗号スートの形式であっても、エラーは返しません。 例: TLS_RSA_WITH_RC4_128_MD5 を無効にするには、0x0004 を指定し、TLS_ECDSA_WITH_RC4_128_SHA を無効にするには 0xC002 を指定します。 注意として、TLSv1.3 の暗号化方式はこの仕組みで無効にできません。</li>\n</ul></li>\n</ul>\n<p>セッションの SSL 構成を設定します。 それ以降のネットワークリクエストではすべて新しい構成を使用します。 既存のネットワーク接続 (WebSocket 接続など) は終了しませんが、プール内の古いソケットは新しい接続に再利用されません。</p>\n<h4 id=\"sesgetblobdataidentifier\"><a href=\"#sesgetblobdataidentifier\"><code>ses.getBlobData(identifier)</code></a></h4>\n<ul>\n<li><code>identifier</code> String - 有効な UUID。</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;Buffer></code> - blob データで実行されます。</p>\n<h4 id=\"sesdownloadurlurl\"><a href=\"#sesdownloadurlurl\"><code>ses.downloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p><code>url</code> にあるリソースのダウンロードを初期化します。 この API は、<a href=\"#event-will-download\">will-download</a> イベントでアクセスできる <a href=\"/docs/api/download-item\">DownloadItem</a> を生成します。</p>\n<p><strong>注釈:</strong> これは <a href=\"/docs/api/web-contents#contentsdownloadurlurl\"><code>webContents.downloadURL</code></a> と異なり、ページのオリジンに関連するセキュリティチェックを実行しません。</p>\n<h4 id=\"sescreateinterrupteddownloadoptions\"><a href=\"#sescreateinterrupteddownloadoptions\"><code>ses.createInterruptedDownload(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>path</code> String - ダウンロードの絶対パス。</li>\n<li><code>urlChain</code> String[] - ダウンロードの完全な URL チェーン。</li>\n<li><code>mimeType</code> String (任意)</li>\n<li><code>offset</code> Integer - ダウンロードの範囲の始端。</li>\n<li><code>length</code> Integer - ダウンロードの長さ。</li>\n<li><code>lastModified</code> String (任意) - ヘッダの最終更新日の値。</li>\n<li><code>eTag</code> String (任意) - ヘッダの ETag の値。</li>\n<li><code>startTime</code> Double (任意) - ダウンロードが開始されたときの UNIX エポックからの秒数。</li>\n</ul></li>\n</ul>\n<p>以前の <code>Session</code> からの、<code>cancelled</code> または <code>interrupted</code> なダウンロードの再開を許可します。 APIは、<a href=\"#event-will-download\">will-download</a> イベントでアクセスできる <a href=\"/docs/api/download-item\">DownloadItem</a> を生成します。 <a href=\"/docs/api/download-item\">DownloadItem</a> はそれに関連付けられた <code>WebContents</code> を持たず、初期状態は <code>interrupted</code> です。 <a href=\"/docs/api/download-item\">DownloadItem</a> 上の <code>resume</code> API を呼ぶことでのみ、ダウンロードが開始されます。</p>\n<h4 id=\"sesclearauthcache\"><a href=\"#sesclearauthcache\"><code>ses.clearAuthCache()</code></a></h4>\n<p>戻り値 <code>Promise&#x3C;void></code> - session の HTTP 認証キャッシュがクリアされると実行されます。</p>\n<h4 id=\"sessetpreloadspreloads\"><a href=\"#sessetpreloadspreloads\"><code>ses.setPreloads(preloads)</code></a></h4>\n<ul>\n<li><code>preloads</code> String[] - プリロードスクリプトへの絶対パスの配列</li>\n</ul>\n<p>通常の <code>preload</code> スクリプトが実行される直前に、このセッションに関連するすべてのウェブコンテンツで実行されるスクリプトを追加します。</p>\n<h4 id=\"sesgetpreloads\"><a href=\"#sesgetpreloads\"><code>ses.getPreloads()</code></a></h4>\n<p>戻り値 <code>String[]</code> - 登録されているプリロードスクリプトへのパスの配列。</p>\n<h4 id=\"sessetspellcheckerenabledenable\"><a href=\"#sessetspellcheckerenabledenable\"><code>ses.setSpellCheckerEnabled(enable)</code></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>組み込みスペルチェッカーを有効にするかどうかを設定します。</p>\n<h4 id=\"sesisspellcheckerenabled\"><a href=\"#sesisspellcheckerenabled\"><code>ses.isSpellCheckerEnabled()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - 組み込みスペルチェッカーが有効化されているかどうか。</p>\n<h4 id=\"sessetspellcheckerlanguageslanguages\"><a href=\"#sessetspellcheckerlanguageslanguages\"><code>ses.setSpellCheckerLanguages(languages)</code></a></h4>\n<ul>\n<li><code>languages</code> String[] - スペルチェッカーを有効にする言語コードの配列。</li>\n</ul>\n<p>組み込みスペルチェッカーは、ユーザーが入力している言語を自動的に検出しません。  スペルチェッカーが単語を正しくチェックするには、言語コードの配列でこの API を呼び出す必要があります。  <code>ses.availableSpellCheckerLanguages</code> プロパティで、サポートしている言語コードのリストを取得できます。</p>\n<p><strong>注意:</strong> macOS では、OS のスペルチェッカーが使用されて言語が自動的に検出されます。  この API は、macOS では何もしません。</p>\n<h4 id=\"sesgetspellcheckerlanguages\"><a href=\"#sesgetspellcheckerlanguages\"><code>ses.getSpellCheckerLanguages()</code></a></h4>\n<p>戻り値 <code>String[]</code> - スペルチェッカーが有効になっている言語コードの配列。  このリストが空の場合、スペルチェッカーは <code>en-US</code> の使用へフォールバックします。  この設定が空のリストである場合、Electron は起動時に既定で現在の OS ロケールをこの設定に追加しようとします。  この設定は再起動後も持続します。</p>\n<p><strong>注意:</strong> macOS では、OS のスペルチェッカーが使用されて独自の言語リストを返します。  この API は、macOS では何もしません。</p>\n<h4 id=\"sessetspellcheckerdictionarydownloadurlurl\"><a href=\"#sessetspellcheckerdictionarydownloadurlurl\"><code>ses.setSpellCheckerDictionaryDownloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String - Electron が hunspell 辞書をダウンロードする基底 URL。</li>\n</ul>\n<p>デフォルトでは、Electron は Chromium CDN から hunspell 辞書をダウンロードします。  この動作をオーバーライドする場合は、この API を使用して、独自ホスト版の hunspell 辞書を辞書ダウンローダーが指すようにすることができます。  ホストする必要があるファイルのリリースごとに <code>hunspell_dictionaries.zip</code> ファイルをファイルサーバーで公開します。ファイルサーバーは <strong>大文字と小文字を区別しない</strong> ようにして、元通りの大文字小文字のファイルが入った ZIP ファイルと、全て小文字のファイル名にしたものの二通りを用意する必要があります。</p>\n<p><code>hunspell_dictionaries.zip</code> が <code>https://example.com/dictionaries/language-code.bdic</code> に存在して利用できる場合、<code>ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')</code> を呼び出すことになります。  末尾のスラッシュに注意してください。  辞書への URL は、<code>${url}${filename}</code> の形式になります。</p>\n<p><strong>注意:</strong> macOS では、OS のスペルチェッカーが使用されるため辞書ファイルをダウンロードしません。  この API は、macOS では何もしません。</p>\n<h4 id=\"seslistwordsinspellcheckerdictionary\"><a href=\"#seslistwordsinspellcheckerdictionary\"><code>ses.listWordsInSpellCheckerDictionary()</code></a></h4>\n<p>戻り値 <code>Promise&#x3C;String[]></code> - アプリのカスタム辞書の全単語の配列。 ディスクから完全な辞書が読み込まれたときに解決されます。</p>\n<h4 id=\"sesaddwordtospellcheckerdictionaryword\"><a href=\"#sesaddwordtospellcheckerdictionaryword\"><code>ses.addWordToSpellCheckerDictionary(word)</code></a></h4>\n<ul>\n<li><code>word</code> String - 辞書に追加したい単語</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - 単語がカスタム辞書に正常に書き込まれたかどうか。 この API は、持続的でない (一時的な) セッションでは動作しません。</p>\n<p><strong>注釈:</strong> macOS と Windows 10 では、この単語は OS カスタム辞書にも書き込まれます</p>\n<h4 id=\"sesremovewordfromspellcheckerdictionaryword\"><a href=\"#sesremovewordfromspellcheckerdictionaryword\"><code>ses.removeWordFromSpellCheckerDictionary(word)</code></a></h4>\n<ul>\n<li><code>word</code> String - 辞書から削除したい単語</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - 単語がカスタム辞書から正常に削除されたかどうか。 この API は、持続的でない (一時的な) セッションでは動作しません。</p>\n<p><strong>注釈:</strong> macOS と Windows 10 では、この単語は OS カスタム辞書からも削除されます</p>\n<h4 id=\"sesloadextensionpath-options\"><a href=\"#sesloadextensionpath-options\"><code>ses.loadExtension(path[, options])</code></a></h4>\n<ul>\n<li><code>path</code> String - 解凍されていない Chrome 拡張機能を含んだディレクトリへのパス</li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>allowFileAccess</code> Boolean - 拡張機能が <code>file://</code> プロトコルでローカルファイルを読み込んで <code>file://</code> ページにコンテンツスクリプトを注入することを許可するかどうか。 これは、例えば <code>file://</code> URL でデベロッパー ツール拡張機能を読み込むために必要です。 省略値は、false です。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;Extension></code> - 拡張機能が読み込まれたときに解決されます。</p>\n<p>このメソッドは、拡張機能を読み込めなかった場合に例外を発生させます。 拡張機能のインストール時に警告が発生した場合 (Electron が未サポートの API を拡張機能が要求した場合など) は、コンソールにログが記録されます。</p>\n<p>注意として、Electron は Chrome 拡張機能の API のすべてをサポートしていません。 サポート内容の詳細については、<a href=\"/docs/api/extensions#supported-extensions-apis\">サポートしている拡張機能 API</a> を参照してください。</p>\n<p>注意として、以前のバージョンの Electron では、読み込まれた拡張機能は以降のアプリケーション実行のために記憶されます。 現在はそうなっていません。拡張機能を読み込みたい場合は、アプリを起動するたびに <code>loadExtension</code> を呼び出す必要があります。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.on(<span class=\"hljs-string\">'ready'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> session.defaultSession.loadExtension(\n    path.join(__dirname, <span class=\"hljs-string\">'react-devtools'</span>),\n    <span class=\"hljs-comment\">// allowFileAccess は、file:// URL でのデベロッパー ツール拡張機能の読み込みに必要です。</span>\n    { <span class=\"hljs-attr\">allowFileAccess</span>: <span class=\"hljs-literal\">true</span> }\n  )\n  <span class=\"hljs-comment\">// 注意として、React デベロッパー ツール拡張機能を使用するにはそのコピーを</span>\n  <span class=\"hljs-comment\">// ダウンロードして解凍する必要があります。</span>\n})\n</code></pre>\n<p>この API は、パッケージした (.crx) 拡張機能の読み込みをサポートしていません。</p>\n<p><strong>注:</strong> このAPIは <code>app</code> モジュールの <code>ready</code> イベントが発生する前には呼び出すことはできません。</p>\n<p><strong>注:</strong> インメモリ (一時的な) セッションでの拡張機能読み込みはサポートされておらず、エラーが送出されます。</p>\n<h4 id=\"sesremoveextensionextensionid\"><a href=\"#sesremoveextensionextensionid\"><code>ses.removeExtension(extensionId)</code></a></h4>\n<ul>\n<li><code>extensionId</code> String - 削除する拡張機能の ID</li>\n</ul>\n<p>拡張機能を取り除きます。</p>\n<p><strong>注:</strong> このAPIは <code>app</code> モジュールの <code>ready</code> イベントが発生する前には呼び出すことはできません。</p>\n<h4 id=\"sesgetextensionextensionid\"><a href=\"#sesgetextensionextensionid\"><code>ses.getExtension(extensionId)</code></a></h4>\n<ul>\n<li><code>extensionId</code> String - クエリする拡張機能の ID</li>\n</ul>\n<p>戻り値 <code>Extension</code> | <code>null</code> - 指定した ID である読み込まれた拡張機能。</p>\n<p><strong>注:</strong> このAPIは <code>app</code> モジュールの <code>ready</code> イベントが発生する前には呼び出すことはできません。</p>\n<h4 id=\"sesgetallextensions\"><a href=\"#sesgetallextensions\"><code>ses.getAllExtensions()</code></a></h4>\n<p>戻り値 <code>Extension[]</code> - 読み込まれた拡張機能のリスト。</p>\n<p><strong>注:</strong> このAPIは <code>app</code> モジュールの <code>ready</code> イベントが発生する前には呼び出すことはできません。</p>\n<h4 id=\"sesgetstoragepath\"><a href=\"#sesgetstoragepath\"><code>ses.getStoragePath()</code></a></h4>\n<p><code>String | null</code> 型で、このセッションのデータが保存されているディスクのファイルシステムの絶対パスを示します。  インメモリセッションの場合、これは <code>null</code> を返します。</p>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<p><code>Session</code> のインスタンスには以下のプロパティがあります。</p>\n<h4 id=\"sesavailablespellcheckerlanguages-読み出し専用\"><a href=\"#sesavailablespellcheckerlanguages-読み出し専用\"><code>ses.availableSpellCheckerLanguages</code> <em>読み出し専用</em></a></h4>\n<p>この <code>String []</code> 配列は利用可能な既知のすべてのスペルチェッカー言語で構成されます。  この配列にない言語コードを <code>setSpellCheckerLanguages</code> API に提供すると、エラーが発生します。</p>\n<h4 id=\"sesspellcheckerenabled\"><a href=\"#sesspellcheckerenabled\"><code>ses.spellCheckerEnabled</code></a></h4>\n<p><code>Boolean</code> 型で、組み込みスペルチェッカーが有効かどうかを示します。</p>\n<h4 id=\"sesstoragepath-読み出し専用\"><a href=\"#sesstoragepath-読み出し専用\"><code>ses.storagePath</code> <em>読み出し専用</em></a></h4>\n<p><code>String | null</code> 型で、このセッションのデータが保存されているディスクのファイルシステムの絶対パスを示します。  インメモリセッションの場合、これは <code>null</code> を返します。</p>\n<h4 id=\"sescookies-読み出し専用\"><a href=\"#sescookies-読み出し専用\"><code>ses.cookies</code> <em>読み出し専用</em></a></h4>\n<p>このセッションの <a href=\"/docs/api/cookies\"><code>Cookies</code></a> オブジェクト。</p>\n<h4 id=\"sesserviceworkers-読み出し専用\"><a href=\"#sesserviceworkers-読み出し専用\"><code>ses.serviceWorkers</code> <em>読み出し専用</em></a></h4>\n<p>このセッションの <a href=\"/docs/api/service-workers\"><code>ServiceWorkers</code></a> オブジェクト。</p>\n<h4 id=\"seswebrequest-読み出し専用\"><a href=\"#seswebrequest-読み出し専用\"><code>ses.webRequest</code> <em>読み出し専用</em></a></h4>\n<p>このセッションの <a href=\"/docs/api/web-request\"><code>WebRequest</code></a> オブジェクト。</p>\n<h4 id=\"sesprotocol-読み出し専用\"><a href=\"#sesprotocol-読み出し専用\"><code>ses.protocol</code> <em>読み出し専用</em></a></h4>\n<p>このセッションの <a href=\"/docs/api/protocol\"><code>Protocol</code></a> オブジェクト。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> protocol = session.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).protocol\n  <span class=\"hljs-keyword\">if</span> (!protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })) {\n    <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Failed to register protocol'</span>)\n  }\n})\n</code></pre>\n<h4 id=\"sesnetlog-読み出し専用\"><a href=\"#sesnetlog-読み出し専用\"><code>ses.netLog</code> <em>読み出し専用</em></a></h4>\n<p>このセッションの <a href=\"/docs/api/net-log\"><code>NetLog</code></a> オブジェクト。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> netLog = session.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).netLog\n  netLog.startLogging(<span class=\"hljs-string\">'/path/to/net-log'</span>)\n  <span class=\"hljs-comment\">// ネットワークイベントの後</span>\n  <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> netLog.stopLogging()\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Net-logs written to'</span>, path)\n})\n</code></pre>",
      "title": "session",
      "description": "ブラウザーセッション、クッキー、キャッシュ、プロキシの設定などを管理します。"
    },
    "/docs/development/setting-up-symbol-server": {
      "locale": "ja-JP",
      "slug": "setting-up-symbol-server",
      "href": "/docs/development/setting-up-symbol-server",
      "crowdinFileId": "256165",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/setting-up-symbol-server.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"デバッガでシンボルサーバを設定\"><a href=\"#デバッガでシンボルサーバを設定\">デバッガでシンボルサーバを設定</a></h1>\n<p>デバッグシンボルは、よりよいデバッグセッションができるようにします。 それらは実行形式と動的ライブラリに含まれる関数についての情報を持ち、クリーンなコールスタックを取得するための情報を提供します。 Symbol Server を使用すると、デバッガは大きなデバッグファイルをユーザにダウンロードさせることなく、正しいシンボル、バイナリ、そしてソースを自動的にロードできます。 このサーバーは <a href=\"https://support.microsoft.com/kb/311503\">Microsoft's symbol server</a> のように機能するもので、そこにあるドキュメントが役立つかもしれません。</p>\n<p>リリースされた Electron ビルドは非常に最適化されているため、デバッグは必ずしも容易ではないことに注意してください。 デバッガはすべての変数の内容は表示できませんし、インラインに展開されたり、末尾再帰やその他のコンパイラによる最適化により実行経路は奇妙に見えるはずです。 唯一の回避策は、最適化されていないローカルビルドをビルドすることです。</p>\n<p>Electron の公式シンボルサーバの URL は <a href=\"https://symbols.electronjs.org\">https://symbols.electronjs.org</a> です。 この URL に直接アクセスすることはできません。デバッグツールのシンボルパスに追加する必要があります。 以下の例では、ローカルキャッシュディレクトリを使用してサーバーから PDB を繰り返し取得しないようにしています。 <code>c:\\code\\symbols</code> をコンピュータ上の適切なキャッシュディレクトリに置き換えてください。</p>\n<h2 id=\"windbg-でシンボルサーバを使用する\"><a href=\"#windbg-でシンボルサーバを使用する\">Windbg でシンボルサーバを使用する</a></h2>\n<p>Windbg シンボルパスは、アスタリスク文字で区切られた文字列値で構成されています。 Electron シンボルサーバーのみを使用するには、以下のシンボルパスに次のエントリを追加します (<strong>注意:</strong> <code>c:\\code\\symbols</code> をコンピュータ上の書き込み可能なディレクトリに置き換えてください)。</p>\n<pre><code class=\"hljs language-powershell\">SRV*c:\\code\\symbols\\*https://symbols.electronjs.org\n</code></pre>\n<p>Windbg メニューを使用するか、または <code>.sympath</code> コマンドを入力して、環境内でこの文字列を <code>_NT_SYMBOL_PATH</code> に設定します。 Microsoft のシンボルサーバーからもシンボルを取得したい場合は、先にそれを並べる必要があります。</p>\n<pre><code class=\"hljs language-powershell\">SRV*c:\\code\\symbols\\*https://msdl.microsoft.com/download/symbols;SRV*c:\\code\\symbols\\*https://symbols.electronjs.org\n</code></pre>\n<h2 id=\"visual-studio-内でシンボルサーバを使用する\"><a href=\"#visual-studio-内でシンボルサーバを使用する\">Visual Studio 内でシンボルサーバを使用する</a></h2>\n<p><img src=\"https://mdn.mozillademos.org/files/733/symbol-server-vc8express-menu.jpg\" alt=\"ツール -> 設定\"> <img src=\"https://mdn.mozillademos.org/files/2497/2005_options.gif\" alt=\"シンボル設定\"></p>\n<h2 id=\"トラブルシューティング-シンボルが読み込めない\"><a href=\"#トラブルシューティング-シンボルが読み込めない\">トラブルシューティング: シンボルが読み込めない</a></h2>\n<p>Windbg で次のコマンドを入力して、シンボルが読み込まれない理由を表示します。</p>\n<pre><code class=\"hljs language-powershell\">> !sym noisy\n> .reload /f electron.exe\n</code></pre>",
      "title": "デバッガでシンボルサーバを設定",
      "description": ""
    },
    "/docs/api/share-menu": {
      "locale": "ja-JP",
      "slug": "share-menu",
      "href": "/docs/api/share-menu",
      "crowdinFileId": "256367",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/share-menu.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharemenu\"><a href=\"#sharemenu\">ShareMenu</a></h1>\n<p><code>ShareMenu</code> クラスは、macOS 上で <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/\">共有メニュー</a> を作成し、現在のコンテキストからアプリやソーシャルメディアアカウント、その他のサービスに情報を共有するために使用できます。</p>\n<p>他のメニューのサブメニューとして共有メニューを含めるには、<a href=\"/docs/api/menu-item\"><code>MenuItem</code></a> の <code>shareMenu</code> ロールを使用してください。</p>\n<h2 id=\"クラス-sharemenu\"><a href=\"#クラス-sharemenu\">クラス: ShareMenu</a></h2>\n<blockquote>\n<p>macOS での共有メニューを作成します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h3 id=\"new-sharemenusharingitem\"><a href=\"#new-sharemenusharingitem\"><code>new ShareMenu(sharingItem)</code></a></h3>\n<ul>\n<li><code>sharingItem</code> SharingItem - 共有するアイテム。</li>\n</ul>\n<p>新しい共有メニューを作成します。</p>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<p><code>shareMenu</code> オブジェクトには以下のメソッドがあります。</p>\n<h4 id=\"sharemenupopupoptions\"><a href=\"#sharemenupopupoptions\"><code>shareMenu.popup([options])</code></a></h4>\n<ul>\n<li><code>options</code> PopupOptions (任意)<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (任意) - 省略値はフォーカスされたウインドウです。</li>\n<li><code>x</code> Number (任意) - 既定ではマウスカーソルの現在位置です。 <code>y</code> が宣言されている場合は宣言する必要があります。</li>\n<li><code>y</code> Number (任意) - 既定ではマウスカーソルの現在位置です。 <code>x</code> が宣言されている場合は宣言する必要があります。</li>\n<li><code>positioningItem</code> Number (任意) <em>macOS</em> - マウスカーソルの位置に配置するメニューアイテムのインデックス。 既定値は -1 です。</li>\n<li><code>callback</code> Function (任意) - メニューが閉じたしたときに呼ばれます。</li>\n</ul></li>\n</ul>\n<p>この menu を <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> 内のコンテキストメニューとしてポップアップします。</p>\n<h4 id=\"sharemenuclosepopupbrowserwindow\"><a href=\"#sharemenuclosepopupbrowserwindow\"><code>shareMenu.closePopup([browserWindow])</code></a></h4>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (任意) - 省略値はフォーカスされたウインドウです。</li>\n</ul>\n<p><code>browserWindow</code> 内のこのコンテキストメニューを閉じます。</p>",
      "title": "ShareMenu",
      "description": "macOS での共有メニューを作成します。"
    },
    "/docs/api/structures/shared-worker-info": {
      "locale": "ja-JP",
      "slug": "shared-worker-info",
      "href": "/docs/api/structures/shared-worker-info",
      "crowdinFileId": "256505",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/shared-worker-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharedworkerinfo-object\"><a href=\"#sharedworkerinfo-object\">SharedWorkerInfo Object</a></h1>\n<ul>\n<li><code>id</code> String - The unique id of the shared worker.</li>\n<li><code>url</code> String - The url of the shared worker.</li>\n</ul>",
      "title": "SharedWorkerInfo Object",
      "description": ""
    },
    "/docs/api/structures/sharing-item": {
      "locale": "ja-JP",
      "slug": "sharing-item",
      "href": "/docs/api/structures/sharing-item",
      "crowdinFileId": "256507",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/sharing-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharingitem-object\"><a href=\"#sharingitem-object\">SharingItem Object</a></h1>\n<ul>\n<li><code>texts</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of text to share.</li>\n<li><code>filePaths</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of files to share.</li>\n<li><code>urls</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of URLs to share.</li>\n</ul>",
      "title": "SharingItem Object",
      "description": ""
    },
    "/docs/api/shell": {
      "locale": "ja-JP",
      "slug": "shell",
      "href": "/docs/api/shell",
      "crowdinFileId": "256369",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/shell.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"shell\"><a href=\"#shell\">shell</a></h1>\n<blockquote>\n<p>デフォルトのアプリケーションを使用してファイルと URL を管理します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a>, <a href=\"/docs/glossary#renderer-process\">レンダラー</a> (非サンドボックス時のみ)</p>\n<p><code>shell</code> モジュールは、デスクトップの統合に関する機能を提供します。</p>\n<p>以下はユーザの既定のブラウザで URL を開く例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nshell.openExternal(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<p><strong>注:</strong> <code>shell</code> モジュールはレンダラープロセスで使用できますが、サンドボックス化されたレンダラーでは機能しません。</p>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>shell</code> モジュールには以下のメソッドがあります。</p>\n<h3 id=\"shellshowiteminfolderfullpath\"><a href=\"#shellshowiteminfolderfullpath\"><code>shell.showItemInFolder(fullPath)</code></a></h3>\n<ul>\n<li><code>fullPath</code> String</li>\n</ul>\n<p>指定したファイルをファイルマネージャに表示します。 可能であれば、ファイルを選択します。</p>\n<h3 id=\"shellopenpathpath\"><a href=\"#shellopenpathpath\"><code>shell.openPath(path)</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;String></code> - 障害が発生した場合、その障害に対応するエラーメッセージを含む文字列で解決します。それ以外では \"\" になります。</p>\n<p>指定したファイルをデスクトップの既定の方法で開きます。</p>\n<h3 id=\"shellopenexternalurl-options\"><a href=\"#shellopenexternalurl-options\"><code>shell.openExternal(url[, options])</code></a></h3>\n<ul>\n<li><code>url</code> String - Windows では最大2081文字です。</li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>activate</code> Boolean (任意) <em>macOS</em> - <code>true</code> で開いたアプリケーションを前面に表示します。 省略値は <code>true</code> です。</li>\n<li><code>workingDirectory</code> String (任意) <em>Windows</em> - 作業ディレクトリ。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code></p>\n<p>指定した外部プロトコルの URL をデスクトップ既定の方法で開きます。 (例えば、mailto: の URL はユーザのデフォルトのメールエージェントになります)。</p>\n<h3 id=\"shelltrashitempath\"><a href=\"#shelltrashitempath\"><code>shell.trashItem(path)</code></a></h3>\n<ul>\n<li><code>path</code> String - ゴミ箱へ送るアイテムのパス。</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - 操作が完了したときに解決します。 要求されたアイテムの削除中にエラーが発生した場合に拒否します。</p>\n<p>これにより、パスのものを OS 固有のゴミ箱の場所 (macOS ではゴミ箱、Windows ではごみ箱、Linux ではデスクトップ環境固有の場所) へ移動させます。</p>\n<h3 id=\"shellbeep\"><a href=\"#shellbeep\"><code>shell.beep()</code></a></h3>\n<p>通知音を再生します。</p>\n<h3 id=\"shellwriteshortcutlinkshortcutpath-operation-options-windows\"><a href=\"#shellwriteshortcutlinkshortcutpath-operation-options-windows\"><code>shell.writeShortcutLink(shortcutPath[, operation], options)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>shortcutPath</code> String</li>\n<li><code>operation</code> String (任意) - 省略値は <code>create</code> で、以下の値のいずれかにできます。<ul>\n<li><code>create</code> - 新しいショートカットを作成し、必要であれば上書きします。</li>\n<li><code>update</code> - 既にあるショートカットのみを、指定したプロパティで更新します。</li>\n<li><code>replace</code> - 既にあるショートカットを上書きし、存在しなければ失敗します。</li>\n</ul></li>\n<li><code>options</code> <a href=\"/docs/api/structures/shortcut-details\">ShortcutDetails</a></li>\n</ul>\n<p>戻り値 <code>Boolean</code> - ショートカットが正常に作成されたかどうか.</p>\n<p><code>shortcutPath</code> のショートカットリンクを作成か更新します。</p>\n<h3 id=\"shellreadshortcutlinkshortcutpath-windows\"><a href=\"#shellreadshortcutlinkshortcutpath-windows\"><code>shell.readShortcutLink(shortcutPath)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>shortcutPath</code> String</li>\n</ul>\n<p>戻り値 <a href=\"/docs/api/structures/shortcut-details\"><code>ShortcutDetails</code></a></p>\n<p><code>shortcutPath</code> のショートカットリンクを解決します。</p>\n<p>エラーが発生すると、例外がスローされます。</p>",
      "title": "shell",
      "description": "デフォルトのアプリケーションを使用してファイルと URL を管理します。"
    },
    "/docs/api/structures/shortcut-details": {
      "locale": "ja-JP",
      "slug": "shortcut-details",
      "href": "/docs/api/structures/shortcut-details",
      "crowdinFileId": "256509",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/shortcut-details.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"shortcutdetails-object\"><a href=\"#shortcutdetails-object\">ShortcutDetails Object</a></h1>\n<ul>\n<li><code>target</code> String - The target to launch from this shortcut.</li>\n<li><code>cwd</code> String (optional) - The working directory. Default is empty.</li>\n<li><code>args</code> String (optional) - The arguments to be applied to <code>target</code> when launching from this shortcut. Default is empty.</li>\n<li><code>description</code> String (optional) - The description of the shortcut. Default is empty.</li>\n<li><code>icon</code> String (optional) - The path to the icon, can be a DLL or EXE. <code>icon</code> and <code>iconIndex</code> have to be set together. Default is empty, which uses the target's icon.</li>\n<li><code>iconIndex</code> Number (optional) - The resource ID of icon when <code>icon</code> is a DLL or EXE. Default is 0.</li>\n<li><code>appUserModelId</code> String (optional) - The Application User Model ID. Default is empty.</li>\n<li><code>toastActivatorClsid</code> String (optional) - The Application Toast Activator CLSID. Needed for participating in Action Center.</li>\n</ul>",
      "title": "ShortcutDetails Object",
      "description": ""
    },
    "/docs/api/structures/size": {
      "locale": "ja-JP",
      "slug": "size",
      "href": "/docs/api/structures/size",
      "crowdinFileId": "256511",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/size.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"size-object\"><a href=\"#size-object\">Size Object</a></h1>\n<ul>\n<li><code>width</code> Number</li>\n<li><code>height</code> Number</li>\n</ul>",
      "title": "Size Object",
      "description": ""
    },
    "/docs/tutorial/snapcraft": {
      "locale": "ja-JP",
      "slug": "snapcraft",
      "href": "/docs/tutorial/snapcraft",
      "crowdinFileId": "256249",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/snapcraft.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"snapcraft-ガイド-linux\"><a href=\"#snapcraft-ガイド-linux\">Snapcraft ガイド (Linux)</a></h1>\n<p>このガイドは、Ubuntu Software Centerを含む、Snapcraft環境向けにあなたのElectronアプリケーションをパッケージする方法を提供します。</p>\n<h2 id=\"背景と必要条件\"><a href=\"#背景と必要条件\">背景と必要条件</a></h2>\n<p>幅広いLinux コミュニティと共に、Canonicalは共通したソフトウェアインストールの問題を解決するために、<a href=\"https://snapcraft.io/\"><code>snapcraft</code></a>プロジェクトを開始しました。 Snaps は、依存関係と自動アップデートに必要なソフトウェアパッケージを含めたパッケージであり、システムを修正することなく多くのメジャーなLinuxディストリビューションで動作します。</p>\n<p><code>.snap</code> ファイルを作成する方法は3つあります。:</p>\n<p>1) <a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a> または <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a>の使用、両方のツールは <code>snap</code>ですぐに使用できます。 これは最も簡単な選択肢です。 2) <code>electron-installer-snap</code>の使用、これは<code>electron-packager</code>のアウトプットを使用します。 3) 作成した<code>.deb</code>パッケージの使用</p>\n<p>場合によっては、<code>snapcraft</code> ツールをインストールしている必要があります。 特定ディストリビューションの <code>snapcraft</code> のインストール手順は <a href=\"https://snapcraft.io/docs/installing-snapcraft\">こちら</a> です。</p>\n<h2 id=\"electron-installer-snapの使用\"><a href=\"#electron-installer-snapの使用\"><code>electron-installer-snap</code>の使用</a></h2>\n<p>このモジュールは、<a href=\"https://github.com/electron/windows-installer\"><code>electron-winstaller</code></a>のように動作します。またそのスコープ内の類似のモジュールは、snapパッケージのビルドに制限されます。 次のようにインストールできます:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron-installer-snap\n</code></pre>\n<h3 id=\"ステップ1-electronアプリケーションのパッケージ化\"><a href=\"#ステップ1-electronアプリケーションのパッケージ化\">ステップ1: Electronアプリケーションのパッケージ化</a></h3>\n<p><a href=\"https://github.com/electron/electron-packager\">electron-packager</a> (または類似ツール) を用いてパッケージします。 アプリケーションサイズが大きくなるので、実際には必要ないモジュールを<code>node_modules</code>から確実に削除します。</p>\n<p>出力はおおよそ以下のようになります:</p>\n<pre><code class=\"hljs language-plaintext\">.\n└── dist\n    └── app-linux-x64\n        ├── LICENSE\n        ├── LICENSES.chromium.html\n        ├── content_shell.pak\n        ├── app\n        ├── icudtl.dat\n        ├── libgcrypt.so.11\n        ├── libnode.so\n        ├── locales\n        ├── resources\n        ├── v8_context_snapshot.bin\n        └── version\n</code></pre>\n<h3 id=\"ステップ2-electron-installer-snapの実行\"><a href=\"#ステップ2-electron-installer-snapの実行\">ステップ2: <code>electron-installer-snap</code>の実行</a></h3>\n<p><code>snapcraft</code> が環境変数 <code>PATH</code> に含まれている状態で、ターミナルから <code>electron-installer-snap</code>を実行します。その際に、<code>--src</code>パラメーターで、この第一ステップで作成するElectronアプリケーションの場所を指定します。</p>\n<pre><code class=\"hljs language-sh\">npx electron-installer-snap --src=out/myappname-linux-x64\n</code></pre>\n<p>もし既存のビルドパイプラインがある場合は、 <code>electron-installer-snap</code>をプログラムとして利用できます。 詳しい情報については、<a href=\"https://docs.snapcraft.io/build-snaps/syntax\">Snapcraft API docs</a>を参照してください。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> snap = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-installer-snap'</span>)\n\nsnap(options)\n  .then(<span class=\"hljs-function\"><span class=\"hljs-params\">snapPath</span> =></span> <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Created snap at <span class=\"hljs-subst\">${snapPath}</span>!`</span>))\n</code></pre>\n<h2 id=\"electron-packager-と共に-snapcraft-を使用する\"><a href=\"#electron-packager-と共に-snapcraft-を使用する\"><code>electron-packager</code> と共に <code>snapcraft</code> を使用する</a></h2>\n<h3 id=\"ステップ-1-サンプル-snapcraft-プロジェクトの作成\"><a href=\"#ステップ-1-サンプル-snapcraft-プロジェクトの作成\">ステップ 1: サンプル snapcraft プロジェクトの作成</a></h3>\n<p>プロジェクトディレクトリを作成し、<code>snap/snapcraft.yaml</code> に以下を追加します。</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">electron-packager-hello-world</span>\n<span class=\"hljs-attr\">version:</span> <span class=\"hljs-string\">'0.1'</span>\n<span class=\"hljs-attr\">summary:</span> <span class=\"hljs-string\">Hello</span> <span class=\"hljs-string\">World</span> <span class=\"hljs-string\">Electron</span> <span class=\"hljs-string\">app</span>\n<span class=\"hljs-attr\">description:</span> <span class=\"hljs-string\">|\n  Simple Hello World Electron app as an example\n</span><span class=\"hljs-attr\">base:</span> <span class=\"hljs-string\">core18</span>\n<span class=\"hljs-attr\">confinement:</span> <span class=\"hljs-string\">strict</span>\n<span class=\"hljs-attr\">grade:</span> <span class=\"hljs-string\">stable</span>\n\n<span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">electron-packager-hello-world:</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">electron-quick-start/electron-quick-start</span> <span class=\"hljs-string\">--no-sandbox</span>\n    <span class=\"hljs-attr\">extensions:</span> <span class=\"hljs-string\">[gnome-3-34]</span>\n    <span class=\"hljs-attr\">plugs:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">browser-support</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">network</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">network-bind</span>\n    <span class=\"hljs-attr\">environment:</span>\n      <span class=\"hljs-comment\"># Chromium フレームワーク/Electron の TMPDIR パスを修正し、</span>\n      <span class=\"hljs-comment\"># libappindicator が読めるリソースを確保します。</span>\n      <span class=\"hljs-attr\">TMPDIR:</span> <span class=\"hljs-string\">$XDG_RUNTIME_DIR</span>\n\n<span class=\"hljs-attr\">parts:</span>\n  <span class=\"hljs-attr\">electron-quick-start:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">nil</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">https://github.com/electron/electron-quick-start.git</span>\n    <span class=\"hljs-attr\">override-build:</span> <span class=\"hljs-string\">|\n        npm install electron electron-packager\n        npx electron-packager . --overwrite --platform=linux --output=release-build --prune=true\n        cp -rv ./electron-quick-start-linux-* $SNAPCRAFT_PART_INSTALL/electron-quick-start\n</span>    <span class=\"hljs-attr\">build-snaps:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">node/14/stable</span>\n    <span class=\"hljs-attr\">build-packages:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">unzip</span>\n    <span class=\"hljs-attr\">stage-packages:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnss3</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnspr4</span>\n</code></pre>\n<p>この例を既存のプロジェクトに適用する場合は以下のようにしましょう。</p>\n<ul>\n<li><code>source: https://github.com/electron/electron-quick-start.git</code> を <code>source: .</code> に置き換えます。</li>\n<li>すべての <code>electron-quick-start</code> の箇所をプロジェクト名に置き換えます。</li>\n</ul>\n<h3 id=\"ステップ-2-snap-のビルド\"><a href=\"#ステップ-2-snap-のビルド\">ステップ 2: snap のビルド</a></h3>\n<pre><code class=\"hljs language-sh\">$ snapcraft\n\n&#x3C;output snipped>\nSnapped electron-packager-hello-world_0.1_amd64.snap\n</code></pre>\n<h3 id=\"ステップ-3-snap-のインストール\"><a href=\"#ステップ-3-snap-のインストール\">ステップ 3: snap のインストール</a></h3>\n<pre><code class=\"hljs language-sh\">sudo snap install electron-packager-hello-world_0.1_amd64.snap --dangerous\n</code></pre>\n<h3 id=\"ステップ-4-snap-の実行\"><a href=\"#ステップ-4-snap-の実行\">ステップ 4: snap の実行</a></h3>\n<pre><code class=\"hljs language-sh\">electron-packager-hello-world\n</code></pre>\n<h2 id=\"既存のデビアンパッケージの使用\"><a href=\"#既存のデビアンパッケージの使用\">既存のデビアンパッケージの使用</a></h2>\n<p>Snapcraft は既存の<code>.deb</code>ファイルをもとに、<code>.snap</code> ファイルに変換できます。 この場合<code>snapcraft.yaml</code>を利用してsnapを作成します。このファイルは、ソース、依存関係、説明、コアのビルドブロックを記述します。</p>\n<h3 id=\"ステップ1-デビアンパッケージの作成\"><a href=\"#ステップ1-デビアンパッケージの作成\">ステップ1: デビアンパッケージの作成</a></h3>\n<p><code>.deb</code> パッケージがない場合、<code>electron-installer-snap</code>で容易 にsnapパッケージを作成できます。 しかし、Debian パッケージは作成方法がいくつかあります。例えば、<a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a> や <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a>、<a href=\"https://github.com/unindented/electron-installer-debian\"><code>electron-installer-debian</code></a> があります。</p>\n<h3 id=\"ステップ2-snapcraftyamlファイルの作成\"><a href=\"#ステップ2-snapcraftyamlファイルの作成\">ステップ2: snapcraft.yamlファイルの作成</a></h3>\n<p>利用可能な設定オプションの詳細については、<a href=\"https://docs.snapcraft.io/build-snaps/syntax\">snapcraft 構文のドキュメント</a> を参照してください。 以下で例を見てみましょう。</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">myApp</span>\n<span class=\"hljs-attr\">version:</span> <span class=\"hljs-string\">'2.0.0'</span>\n<span class=\"hljs-attr\">summary:</span> <span class=\"hljs-string\">A</span> <span class=\"hljs-string\">little</span> <span class=\"hljs-string\">description</span> <span class=\"hljs-string\">for</span> <span class=\"hljs-string\">the</span> <span class=\"hljs-string\">app.</span>\n<span class=\"hljs-attr\">description:</span> <span class=\"hljs-string\">|\n あなたは知っていますか？ このアプリはすごい。 あなたのために色々してくれます。 ある者はこれで若さが保てるといい、また幸せに慣れると言っています。\n</span>\n<span class=\"hljs-attr\">grade:</span> <span class=\"hljs-string\">stable</span>\n<span class=\"hljs-attr\">confinement:</span> <span class=\"hljs-string\">classic</span>\n\n<span class=\"hljs-attr\">parts:</span>\n  <span class=\"hljs-attr\">slack:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">dump</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">my-deb.deb</span>\n    <span class=\"hljs-attr\">source-type:</span> <span class=\"hljs-string\">deb</span>\n    <span class=\"hljs-attr\">after:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">desktop-gtk3</span>\n    <span class=\"hljs-attr\">stage-packages:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libasound2</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnotify4</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnspr4</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnss3</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libpcre3</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libpulse0</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libxss1</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libxtst6</span>\n  <span class=\"hljs-attr\">electron-launch:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">dump</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">files/</span>\n    <span class=\"hljs-attr\">prepare:</span> <span class=\"hljs-string\">|\n      chmod +x bin/electron-launch\n</span>\n<span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">myApp:</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">bin/electron-launch</span> <span class=\"hljs-string\">$SNAP/usr/lib/myApp/myApp</span>\n    <span class=\"hljs-attr\">desktop:</span> <span class=\"hljs-string\">usr/share/applications/myApp.desktop</span>\n    <span class=\"hljs-comment\"># Chromium Framework/Electron の TMPDIR パスを修正し、</span>\n    <span class=\"hljs-comment\"># libappindicator が読み取れるリソースを確保します。</span>\n    <span class=\"hljs-attr\">environment:</span>\n      <span class=\"hljs-attr\">TMPDIR:</span> <span class=\"hljs-string\">$XDG_RUNTIME_DIR</span>\n</code></pre>\n<p>ご覧の通り、<code>snapcraft.yaml</code> は <code>electron-launch</code> と呼ばれるファイルを起動するようにシステムに伝達しています。 この例では、以下のようにアプリのバイナリへ情報を渡します。</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-meta\">#!/bin/sh\n</span>\n<span class=\"hljs-built_in\">exec</span> <span class=\"hljs-string\">\"<span class=\"hljs-variable\">$@</span>\"</span> --executed-from=<span class=\"hljs-string\">\"<span class=\"hljs-variable\">$(pwd)</span>\"</span> --pid=$$ > /dev/null 2>&#x26;1 &#x26;\n</code></pre>\n<p>代替として、<code>snap</code> を <code>strict</code> 禁則でビルドした場合、以下のように <code>desktop-launch</code> コマンドを使用できます。</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">myApp:</span>\n    <span class=\"hljs-comment\"># TMPDIR パスを、Chromium Framework/Electron が</span>\n    <span class=\"hljs-comment\"># libappindicator の読み取り可能リソースを確認するために埋めます</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">env</span> <span class=\"hljs-string\">TMPDIR=$XDG_RUNTIME_DIR</span> <span class=\"hljs-string\">PATH=/usr/local/bin:${PATH}</span> <span class=\"hljs-string\">${SNAP}/bin/desktop-launch</span> <span class=\"hljs-string\">$SNAP/myApp/desktop</span>\n    <span class=\"hljs-attr\">desktop:</span> <span class=\"hljs-string\">usr/share/applications/desktop.desktop</span>\n</code></pre>",
      "title": "Snapcraft ガイド (Linux)",
      "description": ""
    },
    "/docs/development/source-code-directory-structure": {
      "locale": "ja-JP",
      "slug": "source-code-directory-structure",
      "href": "/docs/development/source-code-directory-structure",
      "crowdinFileId": "256167",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/source-code-directory-structure.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"ソースコードのディレクトリ構造\"><a href=\"#ソースコードのディレクトリ構造\">ソースコードのディレクトリ構造</a></h1>\n<p>Electron のソースコードは、いくつかの部分に分けられています。ほとんどの場合、分離規約上 Chromium に従っています。</p>\n<p>ソースコードをよりよく理解するためには、<a href=\"https://dev.chromium.org/developers/design-documents/multi-process-architecture\">Chromium のマルチプロセスアーキテクチャ</a> に慣れる必要があるかもしれません。</p>\n<h2 id=\"ソースコードの構造\"><a href=\"#ソースコードの構造\">ソースコードの構造</a></h2>\n<pre><code class=\"hljs language-diff\">Electron\n├── build/ - GN でビルドするために必要なコンフィグファイルをビルドします。\n├── buildflags/ - 条件付きビルドに使用できる機能の集合を定義します。\n├── chromium_src/ - コンテンツレイヤーの一部でない Chromium からコピーされたソースコード。\n├── default_app/ - 消費者向けアプリ以外から Electron が起動されたときに\n|                  実行されるデフォルトアプリ。\n├── docs/ - Electron のドキュメント。\n|   ├── api/ - Electron の外部向けモジュールと API のドキュメント。\n|   ├── development/ - Electron の開発と Electron による開発の支援ドキュメント。\n|   ├── fiddles/ - Electron Fiddle で実行できるコードスニペットの集合。\n|   ├── images/ - ドキュメントで使用される画像。\n|   └── tutorial/ - Electron のさまざまな観点におけるチュートリアルドキュメント。\n/ lib / - JavaScript / TypeScript شفرة المصدر.\n|   ├── browser/ - メインプロセス初期化コード。\n|   |   ├── api/ - メインプロセスモジュール API の実装。\n|   |   └── remote/ - メインプロセスで使用される\n|   |                 リモートモジュールに関連したコード。\n|   ├── common/ - メインとレンダラー両方のプロセスに必要なロジックに関連するものです。\n|   |   └── api/ - メインとレンダラー両方のプロセスに必要な\n|   |              モジュール API の実装\n|   ├── isolated_renderer/ - contextIsolation が有効なとき\n|   |                       イソレートレンダラープロセスの作成を処理します。\n|   ├── renderer/ - レンダラープロセス初期化コード。\n|   |   ├── api/ - レンダラープロセスモジュール API の実装。\n|   |   ├── extension/ - Electron レンダラープロセスでの\n|   |   |                Chrome 拡張機能の使用に関連したコード。\n|   |   ├── remote/ - メインプロセスでの remote モジュールの\n|   |   |             使用を処理するロジック。\n|   |   └── web-view/ - レンダラープロセスでの webview の\n|   |                   使用を処理するロジック。\n|   ├── sandboxed_renderer/ - サンドボックスレンダラープロセスの作成を処理する\n|   |   |                     ロジック。\n|   |   └── api/ - サンドボックスレンダラープロセス API の実装。\n|   └── worker/ - Web Worker で Node.js 環境の適切な機能を\n|                 処理するロジック。\n├── patches/ - ユースケースと元の機能との差異を扱うために、\n|   |          Electron のコア依存関係上に適用されたパッチ。\n|   ├── boringssl/ - Google の OpenSSL フォークである BoringSSL に適用されているパッチ。\n|   ├── chromium/ - Chromium に適用されているパッチ。\n|   ├── node/ - Node.js 上に適用されているパッチ。\n|   └── v8/ - Google の V8 エンジンの上に適用されているパッチ。\n├── shell/ - C++ ソースコード。\n|   ├── app/ - システムのエントリコード。\n|   ├── browser/ - メインウィンドウ、UI と\n|   |   |          メインプロセスの全てを含むフロントエンド。 これはレンダラーと連絡して Web ページを\n|   |   |          管理します。\n|   |   ├── ui/ - 異なるプラットフォーム間での UI のローレベルの実装。\n|   |   |   ├── cocoa/ - Cocoa に関連したソースコード。\n|   |   |   ├── win/ - Windows のGUIに関連したソースコード。\n|   |   |   └── x/ - X11 に関連したソースコード。\n|   |   ├── api/ - メインプロセス API の実装。\n|   |   ├── net/ - ネットワークに関連したコード。\n|   |   ├── mac/ - Mac に関連した Objective-C のソースコード。\n|   |   └── resources/ - アイコン、プラットフォーム固有のファイルなど。\n|   ├── renderer/ - レンダラープロセスで動くコード。\n|   |   └── api/ - レンダラープロセス API の実装。\n|   └── common/ - Node のメッセージループを Chromium のメッセージループに\n|       |         統合するためのユーティリティ関数やコードなど、\n|       |         メインプロセスとレンダラープロセスの両方で使用されるコード。\n|       └── api/ - 共通の API の実装と、\n|                  Electron の組み込みモジュールの基礎。\n├── spec/ - レンダラープロセスで実行される Electron の連続テストのコンポーネント。\n├── spec-main/ - メインプロセスで実行される Electron の連続テストのコンポーネント。\n└── BUILD.gn - Electronのビルドルール。\n</code></pre>\n<h2 id=\"その他のディレクトリの構造\"><a href=\"#その他のディレクトリの構造\">その他のディレクトリの構造</a></h2>\n<ul>\n<li><strong>.circleci</strong> - CircleCI を使用した CI のコンフィグファイル。</li>\n<li><strong>.github</strong> - Issue のテンプレートとコード所有者を含む GitHub 指定のコンフィグファイル。</li>\n<li><strong>dist</strong> - 配布用に作成したときに <code>script/create-dist.py</code> スクリプトが作成する一時的なディレクトリ。</li>\n<li><strong>node_modules</strong> - ビルドに使用する第三者のnodeモジュール。</li>\n<li><strong>npm</strong> - npm を介した Electron のインストールロジック。</li>\n<li><strong>out</strong> - <code>ninja</code>の一時的な出力用ディレクトリ。</li>\n<li><strong>script</strong> - ビルド、パッケージ、テストなどの開発目的に使用されるスクリプト。</li>\n</ul>\n<pre><code class=\"hljs language-diff\">script/ - Electron がさまざまな目的で実行するすべてのスクリプトの集合。\n├── codesign/ - Electron アプリのコード署名を偽装します。テスト用です。\n├── lib/ - その他の Python のユーティリティスクリプト。\n└── release/ - Electron のリリースプロセス中に実行されるスクリプト。\n    ├── notes/ - 新しいバージョンの Electron のリリースノートを生成します。\n    └── uploaders/ - リリース中にさまざまなリリースに関するファイルをアップロードします。\n</code></pre>\n<ul>\n<li><strong>typings</strong> - Electron 内部コードの TypeScript 型定義。</li>\n</ul>",
      "title": "ソースコードのディレクトリ構造",
      "description": ""
    },
    "/docs/tutorial/spellchecker": {
      "locale": "ja-JP",
      "slug": "spellchecker",
      "href": "/docs/tutorial/spellchecker",
      "crowdinFileId": "256251",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/spellchecker.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"スペルチェッカー\"><a href=\"#スペルチェッカー\">スペルチェッカー</a></h1>\n<p>v8 以降の Electron は Chromium のスペルチェッカーを内蔵しています。  WindowsとLinuxではHunspell辞書が搭載されており、macOSではネイティブのspellchecker APIが使用されています。</p>\n<h2 id=\"スペルチェッカーを有効にする方法は？\"><a href=\"#スペルチェッカーを有効にする方法は？\">スペルチェッカーを有効にする方法は？</a></h2>\n<p>Electron v9 以降では、スペルチェッカーはデフォルトで有効になっています。  Electron 8 では、 <code>webPreferences</code> で有効にする必要があります。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> myWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">spellcheck</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h2 id=\"スペルチェッカーが使用する言語を設定する方法は\"><a href=\"#スペルチェッカーが使用する言語を設定する方法は\">スペルチェッカーが使用する言語を設定する方法は?</a></h2>\n<p>macOS ではネイティブ API を使用しているため、スペルチェッカーが使用する言語を設定する方法はありません。 macOS では、デフォルトでネイティブのスペルチェッカーが自動的に使用されている言語を検出します。</p>\n<p>Windows および Linux の場合、スペルチェッカーの言語を設定するために使用する Electron API がいくつかあります。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// アメリカ英語とフランス語のチェックする</span>\nmyWindow.session.setSpellCheckerLanguages([<span class=\"hljs-string\">'en-US'</span>, <span class=\"hljs-string\">'fr'</span>])\n\n<span class=\"hljs-comment\">// 利用できる言語コードの配列</span>\n<span class=\"hljs-keyword\">const</span> possibleLanguages = myWindow.session.availableSpellCheckerLanguages\n</code></pre>\n<p>デフォルトで、spellchecker は現在の OS ロケールに一致する言語を有効にします。</p>\n<h2 id=\"スペルチェッカーの結果をコンテキストメニューに入れるには\"><a href=\"#スペルチェッカーの結果をコンテキストメニューに入れるには\">スペルチェッカーの結果をコンテキストメニューに入れるには?</a></h2>\n<p>コンテキストメニューを生成するために必要なすべての情報は、各 <a href=\"/docs/api/web-contents#event-context-menu\"><code>webContents</code></a> インスタンス上の <code>context-menu</code> イベントで提供されます。  この情報を使ってコンテキストメニューを作る簡単な方法を以下に示します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { Menu, MenuItem } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nmyWindow.webContents.on(<span class=\"hljs-string\">'context-menu'</span>, (event, params) => {\n  <span class=\"hljs-keyword\">const</span> menu = <span class=\"hljs-keyword\">new</span> Menu()\n\n  <span class=\"hljs-comment\">// スペルの補完をそれぞれ追加します</span>\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> suggestion <span class=\"hljs-keyword\">of</span> params.dictionarySuggestions) {\n    menu.append(<span class=\"hljs-keyword\">new</span> MenuItem({\n      <span class=\"hljs-attr\">label</span>: suggestion,\n      <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> mainWindow.webContents.replaceMisspelling(suggestion)\n    }))\n  }\n\n  <span class=\"hljs-comment\">// ユーザーがスペルミスの単語を辞書に登録できるようにします</span>\n  <span class=\"hljs-keyword\">if</span> (params.misspelledWord) {\n    menu.append(\n      <span class=\"hljs-keyword\">new</span> MenuItem({\n        <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Add to dictionary'</span>,\n        <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> mainWindow.webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord)\n      })\n    )\n  }\n\n  menu.popup()\n})\n</code></pre>\n<h2 id=\"スペルチェッカーは-google-サービスを使用していますか\"><a href=\"#スペルチェッカーは-google-サービスを使用していますか\">スペルチェッカーは Google サービスを使用していますか?</a></h2>\n<p>スペルチェッカー自体はタイプした文字列をGoogleサービスへ送信しませんが、 hunspell 辞書ファイルがGoogle CDNからダウンロードされます。  この動作を避けたい場合は、辞書をダウンロードするための代替URLを指定することができます。</p>\n<pre><code class=\"hljs language-js\">myWindow.session.setSpellCheckerDictionaryDownloadURL(<span class=\"hljs-string\">'https://example.com/dictionaries/'</span>)\n</code></pre>\n<p>辞書ファイルの取得場所や、ホストするにあたって必要な事項についての詳細な情報は、<a href=\"/docs/api/session#sessetspellcheckerdictionarydownloadurlurl\"><code>session.setSpellCheckerDictionaryDownloadURL</code> のドキュメントを確認してください</a>。</p>",
      "title": "スペルチェッカー",
      "description": ""
    },
    "/docs/styleguide": {
      "locale": "ja-JP",
      "slug": "styleguide",
      "href": "/docs/styleguide",
      "crowdinFileId": "256125",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/styleguide.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-ドキュメントスタイルガイド\"><a href=\"#electron-ドキュメントスタイルガイド\">Electron ドキュメントスタイルガイド</a></h1>\n<p>Electronのドキュメント（英語）を書くためのガイドラインです。</p>\n<h2 id=\"ヘッディング\"><a href=\"#ヘッディング\">ヘッディング</a></h2>\n<ul>\n<li>各ページは最上部に1つの<code>#</code>レベルのタイトルが必要です。</li>\n<li>同じページの章には、<code>##</code> レベルの見出しが必要です。</li>\n<li>節の見出しは、ネストする深さに応じて増やした <code>#</code> が必要です。</li>\n<li>ページのタイトルは <a href=\"https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case\">APA タイトルケース</a> に従う必要があります。</li>\n<li>すべての章のタイトルは <a href=\"https://apastyle.apa.org/style-grammar-guidelines/capitalization/sentence-case\">APA タイトルケース</a> に従う必要があります。</li>\n</ul>\n<p><code>Quick Start（クイックスタート）</code> を例にすると、以下のようになります。</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># Quick Start</span>\n\n...\n\n<span class=\"hljs-section\">## Main process</span>\n\n...\n\n<span class=\"hljs-section\">## Renderer process</span>\n\n...\n\n<span class=\"hljs-section\">## Run your app</span>\n\n...\n\n<span class=\"hljs-section\">### Run as a distribution</span>\n\n...\n\n<span class=\"hljs-section\">### Manually downloaded Electron binary</span>\n\n...\n</code></pre>\n<p>ただし、 API リファレンスに関してはこのルールの例外があります。</p>\n<h2 id=\"markdown-のルール\"><a href=\"#markdown-のルール\">Markdown のルール</a></h2>\n<p>このリポジトリでは、一貫した Markdown スタイルにするために <a href=\"https://github.com/DavidAnson/markdownlint\"><code>markdownlint</code></a> パッケージを使用しています。 正確なルールについては、ルートフォルダ内の <code>.markdownlint.json</code> ファイルをご参照ください。</p>\n<p>リンターのルールではカバーしきれないような、いくつかのスタイルガイドラインを以下に示します。</p>\n<!--TODO(erickzhao): make sure this matches with the lint:markdownlint task-->\n<ul>\n<li>コードブロックでは <code>cmd</code> の代わりに <code>sh</code> を使用します (構文ハイライトのため)。</li>\n<li>可読性を考慮し、行の長さはできるだけ 80 から 100 文字にしてください。</li>\n<li>2 階層以上にネストしたリストは使用できません (Markdown レンダラーのため)。</li>\n<li>すべての <code>js</code> と <code>javascript</code> コードブロックは、<a href=\"https://www.npmjs.com/package/standard-markdown\">standard-markdown</a> によって整形されます。</li>\n<li>順序無しリストには、ダッシュではなくアスタリスクを使用してください。</li>\n</ul>\n<h2 id=\"使用する言葉\"><a href=\"#使用する言葉\">使用する言葉</a></h2>\n<ul>\n<li>結果を説明するときは、「なるでしょう」より「なります」を使用します。</li>\n<li>「プロセス上」より「プロセス内」が望ましいです。</li>\n</ul>\n<h2 id=\"api-リファレンス\"><a href=\"#api-リファレンス\">API リファレンス</a></h2>\n<p>以下のルールは、API のドキュメントにのみ適用されます。</p>\n<h3 id=\"タイトルと説明\"><a href=\"#タイトルと説明\">タイトルと説明</a></h3>\n<p>各モジュールの API ドキュメントでは、<code>require('electron')</code> が返す実際のオブジェクト名をタイトルとして使用しなければなりません (<code>BrowserWindow</code>、<code>autoUpdater</code>、<code>session</code> など)。</p>\n<p>ページタイトル直下に、モジュールの説明を 1 行で Markdown の引用文として (<code>></code> 始まりで) 追加します。</p>\n<p><code>session</code> モジュールを例にすると、以下のようにします。</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># session</span>\n\n<span class=\"hljs-quote\">> ブラウザーセッション、Cookie、キャッシュ、プロキシ設定などを管理します。</span>\n</code></pre>\n<h3 id=\"モジュールメソッドとイベント\"><a href=\"#モジュールメソッドとイベント\">モジュールメソッドとイベント</a></h3>\n<p>モジュールはクラスではありません。そのメソッドとイベントは <code>## Methods</code> と <code>## Events</code> の章の下に列挙しなければなりません。</p>\n<p><code>autoUpdater</code> を例にすると、以下のようになります。</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># autoUpdater</span>\n\n<span class=\"hljs-section\">## Events</span>\n\n<span class=\"hljs-section\">### Event: 'error'</span>\n\n<span class=\"hljs-section\">## Methods</span>\n\n<span class=\"hljs-section\">### `autoUpdater.setFeedURL(url[, requestHeaders])`</span>\n</code></pre>\n<h3 id=\"クラス\"><a href=\"#クラス\">クラス</a></h3>\n<ul>\n<li>API のクラスやモジュールの一部の API クラスは <code>## Class: クラス名</code> の章の下に列挙しなければなりません。</li>\n<li>1 ページに複数のクラスがあってもかまいません。</li>\n<li>コンストラクタは <code>###</code> 階層のタイトルで列挙する必要があります。</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static\">静的メソッド</a> は <code>### Static Methods</code> の章の配下に列挙しなければなりません。</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Prototype_methods\">インスタンスメソッド</a> は <code>### Instance Methods</code> の章の配下に列挙しなければなりません。</li>\n<li>すべての戻り値があるメソッドの説明は、\"Returns <code>[型]</code> - [戻り値の説明]\" というように書き始めてください。<ul>\n<li>メソッドが <code>Object</code> を返す場合、その構造を記述します。コロンとそれに続く改行、そして関数の引数と同じスタイルでプロパティの順序なしリストにします。</li>\n</ul></li>\n<li>Instance Events は <code>### Instance Events</code> の章の下に列挙しなければなりません。</li>\n<li>Instance Properties は <code>### Instance Properties</code> の章の下に列挙しなければなりません。<ul>\n<li>インスタンスプロパティは \"A [プロパティの型] ...\" で始まる必要があります。</li>\n</ul></li>\n</ul>\n<p><code>Session</code> と <code>Cookies</code> クラスを例にすると、以下のようにします。</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># session</span>\n\n<span class=\"hljs-section\">## Methods</span>\n\n<span class=\"hljs-section\">### session.fromPartition(partition)</span>\n\n<span class=\"hljs-section\">## Static Properties</span>\n\n<span class=\"hljs-section\">### session.defaultSession</span>\n\n<span class=\"hljs-section\">## Class: Session</span>\n\n<span class=\"hljs-section\">### Instance Events</span>\n\n<span class=\"hljs-section\">#### Event: 'will-download'</span>\n\n<span class=\"hljs-section\">### Instance Methods</span>\n\n<span class=\"hljs-section\">#### `ses.getCacheSize()`</span>\n\n<span class=\"hljs-section\">### Instance Properties</span>\n\n<span class=\"hljs-section\">#### `ses.cookies`</span>\n\n<span class=\"hljs-section\">## Class: Cookies</span>\n\n<span class=\"hljs-section\">### Instance Methods</span>\n\n<span class=\"hljs-section\">#### `cookies.get(filter, callback)`</span>\n</code></pre>\n<h3 id=\"メソッドとその引数\"><a href=\"#メソッドとその引数\">メソッドとその引数</a></h3>\n<p>メソッドの章はつぎの形式でなければなません。</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### `objectName.methodName(required[, optional]))`</span>\n<span class=\"hljs-bullet\">\n* </span><span class=\"hljs-code\">`required`</span> String - 引数の説明。\n<span class=\"hljs-bullet\">* </span><span class=\"hljs-code\">`optional`</span> Integer (optional) - 他の引数の説明。\n\n...\n</code></pre>\n<h4 id=\"見出しレベル\"><a href=\"#見出しレベル\">見出しレベル</a></h4>\n<p>見出しは、メソッドがモジュールに属するかクラスに属するかに応じて、<code>###</code> か <code>####</code> レベルになります。</p>\n<h4 id=\"関数シグネチャ\"><a href=\"#関数シグネチャ\">関数シグネチャ</a></h4>\n<p>モジュールでは、<code>objectName</code> がモジュールの名前です。 クラスでは、クラスのインスタンスの名前にするべきで、モジュールの名前と同じではいけません。</p>\n<p>例として、<code>session</code> モジュール下の <code>Session</code> クラスのメソッドは <code>ses</code> を <code>objectName</code> として使用しなければなりません。</p>\n<p>任意の引数は、角括弧 <code>[]</code> で囲んで表記し、この任意の引数が他の引数に続く場合はカンマが必要です。</p>\n<pre><code class=\"hljs language-markdown\">必須[, 任意]\n</code></pre>\n<h4 id=\"引数の説明\"><a href=\"#引数の説明\">引数の説明</a></h4>\n<p>各引数の詳細は、そのメソッドの下に順序なしリストで記載します。 引数の種類は、JavaScript のプリミティブ (例: <code>String</code>、<code>Promise</code>、<code>Object</code>)、Electron の <a href=\"/docs/api/structures/cookie\"><code>Cookie</code></a> のようなカスタム API の構造体、またはワイルドカードである <code>any</code> のいずれかで表記してください。</p>\n<p>引数の型が <code>Array</code> の場合は、配列内の値の型に <code>[]</code> の省略形を使用してください (例えば、<code>any[]</code> や <code>String[]</code>)。</p>\n<p>引数が <code>Promise</code> 型の場合、Promise が何に解決するかを型引数にします (例えば、<code>Promise&#x3C;void></code> や <code>Promise&#x3C;String></code>)。</p>\n<p>引数が複数の型を取りうる場合は、<code>|</code> で型を区切ります。</p>\n<p><code>Function</code> 型引数の説明は、それがどのように呼ばれるのかを明確にし、それに渡される引数の型を列挙しなければなりません。</p>\n<h4 id=\"プラットフォーム固有の引数\"><a href=\"#プラットフォーム固有の引数\">プラットフォーム固有の引数</a></h4>\n<p>引数またはメソッドが特定のプラットフォーム固有のものである場合、そのプラットフォームはデータ型に続くスペース区切りのイタリック体リストを用いて示されます。 値は <code>macOS</code>、<code>Windows</code>、<code>Linux</code> にできます。</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-bullet\">* </span><span class=\"hljs-code\">`animate`</span> Boolean (任意) <span class=\"hljs-emphasis\">_macOS_</span> <span class=\"hljs-emphasis\">_Windows_</span> - ものをアニメーションします。\n</code></pre>\n<h3 id=\"イベント\"><a href=\"#イベント\">イベント</a></h3>\n<p>イベントの章はつぎの形式でなければなません。</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### Event: 'wake-up'</span>\n\nReturns:\n<span class=\"hljs-bullet\">\n* </span><span class=\"hljs-code\">`time`</span> String\n\n...\n</code></pre>\n<p>見出しは、イベントがモジュールに属するかクラスに属するかに応じて、<code>###</code> か <code>####</code> レベルになります。</p>\n<p>イベントの引数についてはメソッドと同じルールに従います。</p>\n<h3 id=\"プロパティ\"><a href=\"#プロパティ\">プロパティ</a></h3>\n<p>プロパティの章はつぎの形式でなければなません。</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### session.defaultSession</span>\n\n...\n</code></pre>\n<p>見出しは、プロパティがモジュールに属するかクラスに属するかに応じて、<code>###</code> か <code>####</code> レベルになります。</p>\n<h2 id=\"ドキュメントの翻訳\"><a href=\"#ドキュメントの翻訳\">ドキュメントの翻訳</a></h2>\n<p><a href=\"https://github.com/electron/i18n#readme\">electron/i18n</a> を参照してください</p>",
      "title": "Electron ドキュメントスタイルガイド",
      "description": ""
    },
    "/docs/tutorial/support": {
      "locale": "ja-JP",
      "slug": "support",
      "href": "/docs/tutorial/support",
      "crowdinFileId": "256253",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/support.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-サポート\"><a href=\"#electron-サポート\">Electron サポート</a></h1>\n<h2 id=\"サポートを探す\"><a href=\"#サポートを探す\">サポートを探す</a></h2>\n<p>セキュリティ上の相談がある場合は、<a href=\"https://github.com/electron/electron/tree/main/SECURITY.md\">セキュリティドキュメント</a> をご参照ください。</p>\n<p>プログラミングの質問とその回答を探したり、Electron を使っている他の開発者との議論に参加したりしたいのであれば、以下のロケーションのコミュニティで対話できます。</p>\n<ul>\n<li><a href=\"https://discord.com/invite/electron\"><code>Electron の Discord</code></a> にはこのようなチャンネルがあります:<ul>\n<li>ヘルプチャンネル</li>\n<li><a href=\"https://github.com/electron-userland/electron-forge\">Electron Forge</a> や <a href=\"https://github.com/electron/fiddle\">Electron Fiddle</a> のようなエコシステムアプリのチャンネル</li>\n<li>他の Electron アプリ開発者とアイデアを共有するチャンネル</li>\n<li>他にもたくさん!</li>\n</ul></li>\n<li>Atom フォーラムの <a href=\"https://discuss.atom.io/c/electron\"><code>electron</code></a> カテゴリ</li>\n<li><a href=\"https://discuss.atom.io/t/join-us-on-slack/16638?source_topic_id=25406\">Atom の Slack</a> の <code>#electron</code> チャンネル</li>\n<li><a href=\"https://telegram.me/electron_ru\"><code>electron-ru</code></a> <em>(ロシア)</em></li>\n<li><a href=\"https://electron-br.slack.com\"><code>electron-br</code></a> <em>(ブラジルポルトガル語)</em></li>\n<li><a href=\"https://electron-kr.github.io/electron-kr\"><code>electron-kr</code></a> <em>(韓国語)</em></li>\n<li><a href=\"https://electron-jp.slack.com\"><code>electron-jp</code></a> <em>(日本語)</em></li>\n<li><a href=\"https://electron-tr.herokuapp.com\"><code>electron-tr</code></a> <em>(トルコ語)</em></li>\n<li><a href=\"https://electron-id.slack.com\"><code>electron-id</code></a> <em>(インドネシア語)</em></li>\n<li><a href=\"https://electronpl.github.io\"><code>electron-pl</code></a> <em>(ポーランド語)</em></li>\n</ul>\n<p>Electron にコントリビュートしたい場合は、<a href=\"https://github.com/electron/electron/blob/main/CONTRIBUTING.md\">コントリビュートドキュメント</a> をご参照ください。</p>\n<p>Electron の <a href=\"#supported-versions\">サポートしているバージョン</a> にバグを見つけた場合は、<a href=\"/docs/development/issues\">issue tracker</a> にご報告していただけると幸いです。</p>\n<p><a href=\"https://github.com/sindresorhus/awesome-electron\">awesome-electron</a>はコミュニティで保守されている有益なサンプルアプリ、ツール、リソースのリストです。</p>\n<h2 id=\"サポートされているバージョン\"><a href=\"#サポートされているバージョン\">サポートされているバージョン</a></h2>\n<p><em><strong>注:</strong> 2021 年 9 月の Electron 15 から、Electron チームは最新から <strong>4 つの</strong> 安定版メジャーバージョンを一時的にサポートします。 このサポート延長は、Electron の開発者が <a href=\"https://electronjs.org/blog/8-week-cadence\">新しい 8 週間のリリースケイデンス</a> に移行することを目的に、2022 年 5 月の Electron 19 のリリースまで継続されます。 その時点で、Electron チームはサポートを最新から 3 つの安定版メジャーバージョンに戻します。</em></p>\n<p>最新の 3 つの <em>安定した</em> メジャーバージョンは Electron チームによってサポートされます。 たとえば、最新のリリースが 6.1.x の場合、5.0.x と 4.2.x 系列がサポートされます。  安定リリース系列ごとに最新のマイナーリリースのみをサポートしています。  つまり、セキュリティ修正の場合 6.1.x は修正を受けますが、6.0.x の新しいバージョンはリリースしません。</p>\n<p>最新の安定版リリースは一方的に <code>main</code> からすべての修正を受け取り、それ以前のバージョンは時間と容量が許すようなこれら修正の大部分を受けています。 サポートされている最も古いリリースラインには、セキュリティ修正のみが直接送られます。</p>\n<p>サポートされているすべてのリリースラインは、以前 <code>main</code> にマージされた修正をバックポートする外部のプルリクエストを受け付けます。これは、一部の古いサポートラインではケースバイケースとなります。 すべてのリリースラインのバックポートに関する紛糾は、バックポートプルリクエストが発行された週に、週1回の会議での議題項目として <a href=\"https://github.com/electron/governance/tree/main/wg-releases\">リリースワーキンググループ</a> によって解決されます。</p>\n<p>既存の機能を破壊するような API の変更や削除がされた場合、可能であれば、その機能は削除されるまでに最低 2 つのメジャーバージョンでサポートされます。 例えば、3 引数を取る関数が、メジャーバージョン 10 で 2 引数になった場合、3 引数版は少なくともメジャーバージョン 12 まで動作し続けます。 最低 2 つのバージョンという基準を過ぎた後は、メンテナンスの負担が大きすぎるとメンテナが感じるまで、2 つのバージョンより長く下位互換性をサポートします。</p>\n<h3 id=\"現在のサポート対象バージョン\"><a href=\"#現在のサポート対象バージョン\">現在のサポート対象バージョン</a></h3>\n<ul>\n<li>15.x.y</li>\n<li>14.x.y</li>\n<li>13.x.y</li>\n<li>12</li>\n</ul>\n<h3 id=\"end-of-life\"><a href=\"#end-of-life\">End-of-life</a></h3>\n<p>リリースブランチがサポートサイクルの終わりに達すると、npm では非推奨となり、最後のサポート終了リリースが行われる予定です。 このリリースでは、サポートされていないバージョンの Electron が使用されていることを知らせるための警告が追加されます。</p>\n<p>これらの手順は、使用しているブランチがサポートされなくなったときにアプリ開発者が学習できるようにするためのものですが、エンドユーザが過度に煩わされることはありません。</p>\n<p>アプリケーションに例外的な状況があり、サポートされていない一連の Electron を使用し続ける必要がある場合、開発者はアプリケーションの <code>package.json</code> 内の <code>devDependencies</code> から最終リリースを省略することでサポート終了の警告を黙らせることができます。 たとえば、1-6-x シリーズは 1.6.18 リリースでサポートを終了したため、開発者は<code>devDependency</code> を <code>\"electron\": 1.6.0 - 1.6.17</code> とすることで警告なしで 1-6-x シリーズを使用することを選択できます。</p>\n<h2 id=\"サポートされているプラットフォーム\"><a href=\"#サポートされているプラットフォーム\">サポートされているプラットフォーム</a></h2>\n<p>Electronは以下のプラットフォームをサポートしています。</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>macOS 向けには 64bit バイナリのみが提供されます。対応する macOS のバージョンは macOS 10.11 (El Capitan) 以降です。</p>\n<p>Electron 11.0.0 から、Apple Silicon (<code>arm64</code>) デバイスのネイティブサポートを追加しました。</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<p>Windows 7以降に対応しています。Vista以前のOSはサポートされておらず、動作もしません。</p>\n<p>Windows向けには<code>ia32</code> (<code>x86</code>) と<code>x64</code> (<code>amd64</code>) バイナリの両方が提供されています。 <a href=\"/docs/tutorial/windows-arm\">Electron 6.0.8 から、Windows on Arm (<code>arm64</code>) デバイスのネイティブサポートを追加しました</a>。 ia32 バイナリを使用すると、以前のバージョンでパッケージ化されたアプリを実行できます。</p>\n<h3 id=\"linux\"><a href=\"#linux\">Linux</a></h3>\n<p>Electron のビルド済みバイナリは Ubuntu 18.04 上でビルドしています。</p>\n<p>Electronがどのディストリビューションで動作するかどうかは、ビルドプラットフォームでリンクされたライブラリが存在するかによりますので、Ubuntu 18.04 のみを動作保証していますが、次のプラットフォームについてもビルド済みのElectronバイナリを実行できるか検証しています：</p>\n<ul>\n<li>Ubuntu 14.04 以降</li>\n<li>Fedora 24 以降</li>\n<li>Debian 8 以降</li>\n</ul>",
      "title": "Electron サポート",
      "description": ""
    },
    "/docs/api/synopsis": {
      "locale": "ja-JP",
      "slug": "synopsis",
      "href": "/docs/api/synopsis",
      "crowdinFileId": "256371",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/synopsis.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"概要\"><a href=\"#概要\">概要</a></h1>\n<blockquote>\n<p>Node.js と Electron API を使用する方法。</p>\n</blockquote>\n<p><a href=\"https://nodejs.org/api/\">Node.js の組み込みモジュール</a> のすべては、Electron およびサードパーティの Node モジュール (<a href=\"/docs/tutorial/using-native-node-modules\">ネイティブモジュール</a> を含む) でも完全にサポートされています。</p>\n<p>Electron はネイティブのデスクトップアプリケーションを開発するためのモジュールもいくつか追加しています。 モジュールの中には、メインプロセスでしか利用できないものもあれば、レンダラープロセス (ウェブページ) でしか利用できないもの、どちらのプロセスタイプでも利用できるものもあります。</p>\n<p>基本的なルールはとしては、モジュールが <a href=\"https://ja.wikipedia.org/wiki/%E3%82%B0%E3%83%A9%E3%83%95%E3%82%A3%E3%82%AB%E3%83%AB%E3%83%A6%E3%83%BC%E3%82%B6%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%95%E3%82%A7%E3%83%BC%E3%82%B9\">GUI</a> または低レベルのシステムに関わる場合、メインプロセスでのみ使用可能にする必要があります。 これらのモジュールを使いこなすには、メインプロセスとレンダラープロセスのスクリプトの概念に精通している必要があります。</p>\n<p>メインプロセスのスクリプトは、通常の Node.js スクリプトとほぼ同じです。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>レンダラープロセスは、<code>nodeIntegration</code> が有効になっている場合は以下のように Node のモジュールを使用できるという特別な機能を除いて、通常のウェブページと変わりません。</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  <span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n  <span class=\"hljs-built_in\">console</span>.log(fs.readFileSync(__filename, <span class=\"hljs-string\">'utf8'</span>))\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<h2 id=\"分割代入\"><a href=\"#分割代入\">分割代入</a></h2>\n<p>0.37から、<a href=\"https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment\">分割代入</a> を使用して組み込みモジュールを使いやすくすることができます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p><code>electron</code> モジュール全体が必要な場合は、それを require してから、<code>electron</code> から個々のモジュールにアクセスするために分割することができます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> electron = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = electron\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>これは以下のコードと同等です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> electron = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> app = electron.app\n<span class=\"hljs-keyword\">const</span> BrowserWindow = electron.BrowserWindow\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>",
      "title": "概要",
      "description": "Node.js と Electron API を使用する方法。"
    },
    "/docs/api/system-preferences": {
      "locale": "ja-JP",
      "slug": "system-preferences",
      "href": "/docs/api/system-preferences",
      "crowdinFileId": "256373",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/system-preferences.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"systempreferences\"><a href=\"#systempreferences\">systemPreferences</a></h1>\n<blockquote>\n<p>システムの環境設定を取得します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(systemPreferences.isDarkMode())\n</code></pre>\n<h2 id=\"イベント\"><a href=\"#イベント\">イベント</a></h2>\n<p><code>systemPreferences</code> オブジェクトは以下のイベントを発生させます。</p>\n<h3 id=\"イベント-accent-color-changed-windows\"><a href=\"#イベント-accent-color-changed-windows\">イベント: 'accent-color-changed' <em>Windows</em></a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newColor</code> String - ユーザがシステムのアクセントカラーに割り当てる新しいRGBAカラー。</li>\n</ul>\n<h3 id=\"イベント-color-changed-windows\"><a href=\"#イベント-color-changed-windows\">イベント: 'color-changed' <em>Windows</em></a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<h3 id=\"イベント-inverted-color-scheme-changed-windows-非推奨\"><a href=\"#イベント-inverted-color-scheme-changed-windows-非推奨\">イベント: 'inverted-color-scheme-changed' <em>Windows</em> <em>非推奨</em></a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>invertedColorScheme</code> Boolean - 反転配色 (明るいテキストと暗い背景のハイコントラスト配色) が使用されている場合は <code>true</code>、それ以外の場合は <code>false</code> です。</li>\n</ul>\n<p><strong>非推奨:</strong> 新しく <code>nativeTheme</code> モジュールの <a href=\"/docs/api/native-theme#event-updated\"><code>updated</code></a> イベントを使用する必要があります。</p>\n<h3 id=\"イベント-high-contrast-color-scheme-changed-windows-非推奨\"><a href=\"#イベント-high-contrast-color-scheme-changed-windows-非推奨\">イベント: 'high-contrast-color-scheme-changed' <em>Windows</em> <em>非推奨</em></a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>highContrastColorScheme</code> Boolean - ハイコントラストテーマが使用されている場合は <code>true</code>、そうでない場合は <code>false</code> です。</li>\n</ul>\n<p><strong>非推奨:</strong> 新しく <code>nativeTheme</code> モジュールの <a href=\"/docs/api/native-theme#event-updated\"><code>updated</code></a> イベントを使用する必要があります。</p>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<h3 id=\"systempreferencesisdarkmode-macos-windows-deprecated\"><a href=\"#systempreferencesisdarkmode-macos-windows-deprecated\"><code>systemPreferences.isDarkMode()</code> <em>macOS</em> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>戻り値 <code>Boolean</code> - システムがダークモードかどうか。</p>\n<p><strong>非推奨:</strong> 新しく <a href=\"/docs/api/native-theme#nativethemeshouldusedarkcolors-readonly\"><code>nativeTheme.shouldUseDarkColors</code></a> API を使用する必要があります。</p>\n<h3 id=\"systempreferencesisswipetrackingfromscrolleventsenabled-macos\"><a href=\"#systempreferencesisswipetrackingfromscrolleventsenabled-macos\"><code>systemPreferences.isSwipeTrackingFromScrollEventsEnabled()</code> <em>macOS</em></a></h3>\n<p>戻り値 <code>Boolean</code> - ページ間をスワイプの設定がオンかどうか。</p>\n<h3 id=\"systempreferencespostnotificationevent-userinfo-deliverimmediately-macos\"><a href=\"#systempreferencespostnotificationevent-userinfo-deliverimmediately-macos\"><code>systemPreferences.postNotification(event, userInfo[, deliverImmediately])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n<li><code>deliverImmediately</code> Boolean (任意) - サブスクライブ中のアプリがアクティブでなくても通知をすぐに送信する場合は <code>true</code> です。</li>\n</ul>\n<p>macOS のネイティブ通知として <code>event</code> を送信します。 <code>userInfo</code> は、通知とともに送信されるユーザ情報辞書を含むオブジェクトです。</p>\n<h3 id=\"systempreferencespostlocalnotificationevent-userinfo-macos\"><a href=\"#systempreferencespostlocalnotificationevent-userinfo-macos\"><code>systemPreferences.postLocalNotification(event, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n</ul>\n<p>macOS のネイティブ通知として <code>event</code> を送信します。 <code>userInfo</code> は、通知とともに送信されるユーザ情報辞書を含むオブジェクトです。</p>\n<h3 id=\"systempreferencespostworkspacenotificationevent-userinfo-macos\"><a href=\"#systempreferencespostworkspacenotificationevent-userinfo-macos\"><code>systemPreferences.postWorkspaceNotification(event, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n</ul>\n<p>macOS のネイティブ通知として <code>event</code> を送信します。 <code>userInfo</code> は、通知とともに送信されるユーザ情報辞書を含むオブジェクトです。</p>\n<h3 id=\"systempreferencessubscribenotificationevent-callback-macos\"><a href=\"#systempreferencessubscribenotificationevent-callback-macos\"><code>systemPreferences.subscribeNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> String</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Number</code> - この登録のID。</p>\n<p>対応する <code>event</code> が発生したときに、macOS のネイティブ通知を監視し、<code>callback</code> が <code>callback(event, userInfo)</code> で呼ばれます。 <code>userInfo</code> は、通知とともに送信されるユーザ情報辞書を含むオブジェクトです。 <code>object</code> は通知の送信者であり、現時点では <code>NSString</code> の値のみをサポートしています。</p>\n<p><code>event</code> の登録を解除するために使用できる、監視者の <code>id</code> が返されます。</p>\n<p>このAPIの下で、<code>NSDistributedNotificationCenter</code> に登録します。<code>event</code> の値の例は以下になります。</p>\n<ul>\n<li><code>AppleInterfaceThemeChangedNotification</code></li>\n<li><code>AppleAquaColorVariantChanged</code></li>\n<li><code>AppleColorPreferencesChangedNotification</code></li>\n<li><code>AppleShowScrollBarsSettingChanged</code></li>\n</ul>\n<h3 id=\"systempreferencessubscribelocalnotificationevent-callback-macos\"><a href=\"#systempreferencessubscribelocalnotificationevent-callback-macos\"><code>systemPreferences.subscribeLocalNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> String</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Number</code> - この登録のID。</p>\n<p><code>subscribeNotification</code> と同じですが、ローカルデフォルトでは <code>NSNotificationCenter</code> を使用します。 これは、<code>NSUserDefaultsDidChangeNotification</code> などのイベントに必要です。</p>\n<h3 id=\"systempreferencessubscribeworkspacenotificationevent-callback-macos\"><a href=\"#systempreferencessubscribeworkspacenotificationevent-callback-macos\"><code>systemPreferences.subscribeWorkspaceNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> String</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Number</code> - この登録のID。</p>\n<p><code>subscribeNotification</code> と同じですが、<code>NSWorkspace.sharedWorkspace.notificationCenter</code> を使用します。 これは <code>NSWorkspaceDidActivateApplicationNotification</code> といったイベントに必要です。</p>\n<h3 id=\"systempreferencesunsubscribenotificationid-macos\"><a href=\"#systempreferencesunsubscribenotificationid-macos\"><code>systemPreferences.unsubscribeNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p><code>id</code> の監視者を削除します。</p>\n<h3 id=\"systempreferencesunsubscribelocalnotificationid-macos\"><a href=\"#systempreferencesunsubscribelocalnotificationid-macos\"><code>systemPreferences.unsubscribeLocalNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p><code>unsubscribeNotification</code> と同じですが、<code>NSNotificationCenter</code> から監視者を削除します。</p>\n<h3 id=\"systempreferencesunsubscribeworkspacenotificationid-macos\"><a href=\"#systempreferencesunsubscribeworkspacenotificationid-macos\"><code>systemPreferences.unsubscribeWorkspaceNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p><code>unsubscribeNotification</code> と同じですが、<code>NSWorkspace.sharedWorkspace.notificationCenter</code> から監視者を削除します。</p>\n<h3 id=\"systempreferencesregisterdefaultsdefaults-macos\"><a href=\"#systempreferencesregisterdefaultsdefaults-macos\"><code>systemPreferences.registerDefaults(defaults)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>defaults</code> Record&#x3C;String, String | Boolean | Number> - ユーザデフォルト (<code>key: value</code>) の辞書配列</li>\n</ul>\n<p>アプリケーションの <code>NSUserDefaults</code> へ指定したデフォルトを追加します。</p>\n<h3 id=\"systempreferencesgetuserdefaulttype-extends-keyof-userdefaulttypeskey-type-macos\"><a href=\"#systempreferencesgetuserdefaulttype-extends-keyof-userdefaulttypeskey-type-macos\"><code>systemPreferences.getUserDefault&#x3C;Type extends keyof UserDefaultTypes>(key, type)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n<li><code>type</code> Type - <code>string</code>、<code>boolean</code>、<code>integer</code>、<code>float</code>、<code>double</code>、<code>url</code>、<code>array</code>、<code>dictionary</code> のいずれかにできます。</li>\n</ul>\n<p>戻り値 <a href=\"/docs/api/structures/user-default-types\"><code>UserDefaultTypes[Type]</code></a> - <code>NSUserDefaults</code> 内の <code>key</code> の値。</p>\n<p>いくつかの一般的な <code>key</code> と <code>value</code> は以下です。</p>\n<ul>\n<li><code>AppleInterfaceStyle</code>: <code>string</code></li>\n<li><code>AppleAquaColorVariant</code>: <code>integer</code></li>\n<li><code>AppleHighlightColor</code>: <code>string</code></li>\n<li><code>AppleShowScrollBars</code>: <code>string</code></li>\n<li><code>NSNavRecentPlaces</code>: <code>array</code></li>\n<li><code>NSPreferredWebServices</code>: <code>dictionary</code></li>\n<li><code>NSUserDictionaryReplacementItems</code>: <code>array</code></li>\n</ul>\n<h3 id=\"systempreferencessetuserdefaultkey-type-value-macos\"><a href=\"#systempreferencessetuserdefaultkey-type-value-macos\"><code>systemPreferences.setUserDefault(key, type, value)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n<li><code>type</code> String - <code>string</code>、<code>boolean</code>、<code>integer</code>、<code>float</code>、<code>double</code>、<code>url</code>、<code>array</code>、<code>dictionary</code> のいずれかにできます。</li>\n<li><code>value</code> String</li>\n</ul>\n<p><code>NSUserDefaults</code> 内の <code>key</code> の値を設定します。</p>\n<p><code>type</code> は <code>value</code> の実際の型と一致する必要があります。 そうでない場合は例外が送出されます。</p>\n<p>いくつかの一般的な <code>key</code> と <code>value</code> は以下です。</p>\n<ul>\n<li><code>ApplePressAndHoldEnabled</code>: <code>boolean</code></li>\n</ul>\n<h3 id=\"systempreferencesremoveuserdefaultkey-macos\"><a href=\"#systempreferencesremoveuserdefaultkey-macos\"><code>systemPreferences.removeUserDefault(key)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p><code>NSUserDefaults</code> 内のその <code>key</code> を削除します。 これは、以前に <code>setUserDefault</code>で設定された <code>key</code> のデフォルトまたはグローバル値を復元するために使用できます。</p>\n<h3 id=\"systempreferencesisaeroglassenabled-windows\"><a href=\"#systempreferencesisaeroglassenabled-windows\"><code>systemPreferences.isAeroGlassEnabled()</code> <em>Windows</em></a></h3>\n<p>戻り値 <code>Boolean</code> - <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/aa969540.aspx\">DWM Composition</a> (Aero Glass) が有効な場合は <code>true</code>、それ以外は <code>false</code>。</p>\n<p>透明なウィンドウを作成するかどうかを決定するためにこのメソッドを使用する例です (透明なウィンドウは、DWM Composition が無効のときは正しく動作しません)。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> browserOptions = { <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">1000</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">800</span> }\n\n<span class=\"hljs-comment\">// Windowを透明にする。ただしプラットフォームがサポートしている場合に限る。</span>\n<span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'win32'</span> || systemPreferences.isAeroGlassEnabled()) {\n  browserOptions.transparent = <span class=\"hljs-literal\">true</span>\n  browserOptions.frame = <span class=\"hljs-literal\">false</span>\n}\n\n<span class=\"hljs-comment\">// windowを作成します。</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow(browserOptions)\n\n<span class=\"hljs-comment\">// 移動します。</span>\n<span class=\"hljs-keyword\">if</span> (browserOptions.transparent) {\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/index.html`</span>)\n} <span class=\"hljs-keyword\">else</span> {\n  <span class=\"hljs-comment\">// 透明化がないので、基本的なスタールを使用するフォールバックを読み込む。</span>\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/fallback.html`</span>)\n}\n</code></pre>\n<h3 id=\"systempreferencesgetaccentcolor-windows-macos\"><a href=\"#systempreferencesgetaccentcolor-windows-macos\"><code>systemPreferences.getAccentColor()</code> <em>Windows</em> <em>macOS</em></a></h3>\n<p>戻り値 <code>String</code> - RGBA の16進数形式で、ユーザの現在のシステム全体のアクセント色の設定を表します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> color = systemPreferences.getAccentColor() <span class=\"hljs-comment\">// `\"aabbccdd\"`</span>\n<span class=\"hljs-keyword\">const</span> red = color.substr(<span class=\"hljs-number\">0</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"aa\"</span>\n<span class=\"hljs-keyword\">const</span> green = color.substr(<span class=\"hljs-number\">2</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"bb\"</span>\n<span class=\"hljs-keyword\">const</span> blue = color.substr(<span class=\"hljs-number\">4</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"cc\"</span>\n<span class=\"hljs-keyword\">const</span> alpha = color.substr(<span class=\"hljs-number\">6</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"dd\"</span>\n</code></pre>\n<p>この API は macOS 10.14 Mojave 以降でのみ利用可能です。</p>\n<h3 id=\"systempreferencesgetcolorcolor-windows-macos\"><a href=\"#systempreferencesgetcolorcolor-windows-macos\"><code>systemPreferences.getColor(color)</code> <em>Windows</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>color</code> String - 以下の値のいずれか。<ul>\n<li><strong>Windows</strong> の場合:<ul>\n<li><code>3d-dark-shadow</code> - 3D 表示要素の暗い影の色。</li>\n<li><code>3d-face</code> - 3D 表示要素とダイアログボックスの背景の表面の色。</li>\n<li><code>3d-highlight</code> - 3D 表示要素のハイライト色。</li>\n<li><code>3d-light</code> - 3D 表示要素の光源色。</li>\n<li><code>3d-shadow</code> - 3D 表示要素の影の色。</li>\n<li><code>active-border</code> - アクティブなウインドウの縁の色。</li>\n<li><code>active-caption</code> - アクティブなウインドウのタイトルバーの色。 グラデーション効果が有効な場合は、その左側の色になります。</li>\n<li><code>active-caption-gradient</code> - アクティブなウィンドウのタイトルバーのグラデーション色における右側の色。</li>\n<li><code>app-workspace</code> - マルチドキュメントインターフェース (MDI) アプリケーションの背景色。</li>\n<li><code>button-text</code> - 押しボタンのテキスト色。</li>\n<li><code>caption-text</code> - キャプション、サイズボックス、スクロールバー、矢印ボックス内のテキスト色。</li>\n<li><code>desktop</code> - デスクトップ背景色。</li>\n<li><code>disabled-text</code> - グレーの (無効化された) テキスト色。</li>\n<li><code>highlight</code> - コントロール内で選択されたアイテム色。</li>\n<li><code>highlight-text</code> - コントロール内で選択されたアイテムのテキスト色。</li>\n<li><code>hotlight</code> - ハイパーリンクかホットトラックされたアイテムの色。</li>\n<li><code>inactive-border</code> - 非アクティブなウインドウの縁の色。</li>\n<li><code>inactive-caption</code> - 非アクティブなウインドウのタイトルバーの色。 グラデーション効果が有効な場合は、その左側の色になります。</li>\n<li><code>inactive-caption-gradient</code> - 非アクティブなウィンドウのタイトルバーのグラデーション色における右側の色。</li>\n<li><code>inactive-caption-text</code> - 非アクティブなキャプション内のテキストの色。</li>\n<li><code>info-background</code> - ツールチップコントロールの背景色。</li>\n<li><code>info-text</code> - ツールチップコントロールのテキスト色。</li>\n<li><code>menu</code> - メニューの背景色。</li>\n<li><code>menu-highlight</code> - メニューがフラットメニューとして表示されたときにメニュー項目をハイライト表示するために使用される色。</li>\n<li><code>menubar</code> - メニューがフラットメニューとして表示されたときのメニューの背景色。</li>\n<li><code>menu-text</code> - メニューのテキスト色。</li>\n<li><code>scrollbar</code> - スクロールバーのグレーの領域の色。</li>\n<li><code>window</code> - ウインドウの背景色。</li>\n<li><code>window-frame</code> - ウインドウフレームの色。</li>\n<li><code>window-text</code> - ウインドウ内のテキスト色。</li>\n</ul></li>\n<li><strong>macOS</strong> の場合<ul>\n<li><code>alternate-selected-control-text</code> - リストまたは表の選択された面のテキスト。 <em>非推奨</em></li>\n<li><code>control-background</code> - ブラウザやテーブルなど、大きなインターフェイス要素の背景。</li>\n<li><code>control</code> - コントロールの表面。</li>\n<li><code>control-text</code> - 無効にされていないコントロールのテキスト。</li>\n<li><code>disabled-control-text</code> - 無効になっているコントロールのテキスト。</li>\n<li><code>find-highlight</code> - 検索インジケーターの色。</li>\n<li><code>grid</code> - テーブルなどのインタフェース要素のグリッド線。</li>\n<li><code>header-text</code> - テーブル内のヘッダーセルのテキスト。</li>\n<li><code>highlight</code> - 画面上の仮想光源</li>\n<li><code>keyboard-focus-indicator</code> - インタフェースナビゲーションにキーボードを使用しているときに、現在フォーカスされているコントロールの周囲に表示されるリング。</li>\n<li><code>label</code> - 一次コンテンツを含むラベルのテキスト。</li>\n<li><code>link</code> - 他のコンテンツへのリンク。</li>\n<li><code>placeholder-text</code> -  コントロールビューまたはテキストビューのプレースホルダ文字列。</li>\n<li><code>quaternary-label</code> - 透かしテキストなどの3次ラベルよりも重要度の低いラベルのテキスト。</li>\n<li><code>scrubber-textured-background</code> - タッチバーのスクラバーの背景。</li>\n<li><code>secondary-label</code> - 小見出しや追加情報を表すために使用されるラベルなど、通常のラベルよりも重要度の低いラベルのテキスト。</li>\n<li><code>selected-content-background</code> - キーウィンドウまたはビューで選択したコンテンツの背景。</li>\n<li><code>selected-control</code> - 選択したコントロールの表面</li>\n<li><code>selected-control-text</code> - 選択したコントロールのテキスト。</li>\n<li><code>selected-menu-item-text</code> - 選択されたメニューのテキスト</li>\n<li><code>selected-text-background</code> - 選択したテキストの背景</li>\n<li><code>selected-text</code> - 選択したテキスト</li>\n<li><code>separator</code> - コンテンツのさまざまなセクション間の区切り文字。</li>\n<li><code>shadow</code> - 画面上の隆起したオブジェクトによって投げかけられた仮想の影。</li>\n<li><code>tertiary-label</code> - 無効なテキストを表すために使用されるラベルなど、2次ラベルより重要度の低いラベルのテキスト。</li>\n<li><code>text-background</code> - テキストの背景</li>\n<li><code>text</code> -  文書内のテキスト</li>\n<li><code>under-page-background</code> -  文書のコンテンツの背景。</li>\n<li><code>unemphasized-selected-content-background</code> - 非キーウィンドウまたはビューで選択されているコンテンツ。</li>\n<li><code>unemphasized-selected-text-background</code> - 非キーウィンドウまたはビューで選択されているテキストの背景。</li>\n<li><code>unemphasized-selected-text</code> - 非キーウィンドウまたはビューで選択されているテキスト。</li>\n<li><code>window-background</code> - ウィンドウの背景</li>\n<li><code>window-frame-text</code> - ウィンドウのタイトルバー領域のテキスト。</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>戻り値 <code>String</code> - RGB の16進数形式 (<code>#ABCDEF</code>) のシステム色の設定。 詳細は <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx\">Windows ドキュメント</a> 及び <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#dynamic-system-colors\">macOS ドキュメント</a> をご参照ください。</p>\n<p>次の色は macOS 10.14 でのみ使用可能です。<code>find-highlight</code>、<code>selected-content-background</code>、<code>separator</code>、<code>unemphasized-selected-content-background</code>、<code>unemphasized-selected-text-background</code>、<code>unemphasized-selected-text</code>。</p>\n<h3 id=\"systempreferencesgetsystemcolorcolor-macos\"><a href=\"#systempreferencesgetsystemcolorcolor-macos\"><code>systemPreferences.getSystemColor(color)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>color</code> String - 以下の値のいずれか。<ul>\n<li><code>blue</code></li>\n<li><code>brown</code></li>\n<li><code>gray</code></li>\n<li><code>green</code></li>\n<li><code>orange</code></li>\n<li><code>pink</code></li>\n<li><code>purple</code></li>\n<li><code>red</code></li>\n<li><code>yellow</code></li>\n</ul></li>\n</ul>\n<p>戻り値 <code>String</code> - <code>#RRGGBBAA</code> の形式の標準システムカラー。</p>\n<p>「コントラストを上げる」や「透明度を下げる」など、鮮やかさやアクセシビリティ設定の変更に自動的に適応する標準のシステムカラーの1つを返します。 詳しくは、<a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#system-colors\">Apple のドキュメント</a>をご覧ください。</p>\n<h3 id=\"systempreferencesisinvertedcolorscheme-windows-非推奨\"><a href=\"#systempreferencesisinvertedcolorscheme-windows-非推奨\"><code>systemPreferences.isInvertedColorScheme()</code> <em>Windows</em> <em>非推奨</em></a></h3>\n<p>戻り値 <code>Boolean</code> - 反転配色 (明るいテキストと暗い背景のハイコントラスト配色) がアクティブの場合は <code>true</code>、それ以外の場合は <code>false</code> です。</p>\n<p><strong>非推奨:</strong> 新しく <a href=\"/docs/api/native-theme#nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly\"><code>nativeTheme.shouldUseInvertedColorScheme</code></a> API を使用する必要があります。</p>\n<h3 id=\"systempreferencesishighcontrastcolorscheme-macos-windows-非推奨\"><a href=\"#systempreferencesishighcontrastcolorscheme-macos-windows-非推奨\"><code>systemPreferences.isHighContrastColorScheme()</code> <em>macOS</em> <em>Windows</em> <em>非推奨</em></a></h3>\n<p>戻り値 <code>Boolean</code> - ハイコントラストテーマがアクティブの場合は <code>true</code>、それ以外の場合は <code>false</code> です。</p>\n<p><strong>非推奨:</strong> 新しい <a href=\"/docs/api/native-theme#nativethemeshouldusehighcontrastcolors-macos-windows-readonly\"><code>nativeTheme.shouldUseHighContrastColors</code></a> API を使用するようにしてください。</p>\n<h3 id=\"systempreferencesgeteffectiveappearance-macos\"><a href=\"#systempreferencesgeteffectiveappearance-macos\"><code>systemPreferences.getEffectiveAppearance()</code> <em>macOS</em></a></h3>\n<p>戻り値 <code>String</code> - <code>dark</code>、<code>light</code> か <code>unknown</code> になります。</p>\n<p><a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc\">NSApplication.effectiveAppearance</a> に割り当てられている、現在アプリケーションに適用されている macOS の外観設定を取得します。</p>\n<h3 id=\"systempreferencesgetapplevelappearance-macos-非推奨\"><a href=\"#systempreferencesgetapplevelappearance-macos-非推奨\"><code>systemPreferences.getAppLevelAppearance()</code> <em>macOS</em> <em>非推奨</em></a></h3>\n<p>戻り値 <code>String</code> | <code>null</code> - <code>dark</code>、<code>light</code> か <code>unknown</code> になります。</p>\n<p><a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc\">NSApplication.appearance</a> に割り当てられている、アプリケーションに必要であることを宣言した macOS の外観設定を取得します。 この値を設定するには <code>setAppLevelAppearance</code> API が使用できます。</p>\n<h3 id=\"systempreferencessetapplevelappearanceappearance-macos-非推奨\"><a href=\"#systempreferencessetapplevelappearanceappearance-macos-非推奨\"><code>systemPreferences.setAppLevelAppearance(appearance)</code> <em>macOS</em> <em>非推奨</em></a></h3>\n<ul>\n<li><code>appearance</code> String | null - <code>dark</code> か <code>light</code> にできます</li>\n</ul>\n<p>アプリケーションの外観設定を設定します。これはシステムデフォルトを上書きし、<code>getEffectiveAppearance</code> の値を上書きします。</p>\n<h3 id=\"systempreferencescanprompttouchid-macos\"><a href=\"#systempreferencescanprompttouchid-macos\"><code>systemPreferences.canPromptTouchID()</code> <em>macOS</em></a></h3>\n<p>戻り値 <code>Boolean</code> - このデバイスが Touch ID を使用できるかどうか。</p>\n<p><strong>注意:</strong> この API は Sierra 10.12.2 より古い macOS システムでは <code>false</code> を返します。</p>\n<h3 id=\"systempreferencesprompttouchidreason-macos\"><a href=\"#systempreferencesprompttouchidreason-macos\"><code>systemPreferences.promptTouchID(reason)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>reason</code> String - あなたが Touch ID 認証を求める理由</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - ユーザが Touch ID で正常に認証された場合に実行されます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsystemPreferences.promptTouchID(<span class=\"hljs-string\">'To get consent for a Security-Gated Thing'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">success</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'You have successfully authenticated with Touch ID!'</span>)\n}).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(err)\n})\n</code></pre>\n<p>この API 自体はあなたのユーザーデータを保護しません。むしろ、あなたがそうしてもよいようにするメカニズムです。 ネイティブアプリでは、キーチェーンエントリに <a href=\"https://developer.apple.com/documentation/security/secaccesscontrolcreateflags?language=objc\">アクセスコントロール定数</a> を、<a href=\"https://developer.apple.com/documentation/security/secaccesscontrolcreateflags/ksecaccesscontroluserpresence?language=objc\"><code>kSecAccessControlUserPresence</code></a> のように設定する必要があります。これを読み取ると、Touch ID の生体認証に自動的に同意するようになります。 これは <code>node-keytar</code> で暗号化キーを保存し、<code>promptTouchID()</code> の場合にのみそれを取得するように、<a href=\"https://github.com/atom/node-keytar\"><code>node-keytar</code></a> を使用して実行されます。</p>\n<p><strong>注意:</strong> この API は Sierra 10.12.2 より古い macOS システムでは拒否された Promise になります。</p>\n<h3 id=\"systempreferencesistrustedaccessibilityclientprompt-macos\"><a href=\"#systempreferencesistrustedaccessibilityclientprompt-macos\"><code>systemPreferences.isTrustedAccessibilityClient(prompt)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>prompt</code> Boolean - 現在のプロセスが信頼できない場合にユーザにプロンプトで通知するかどうか。</li>\n</ul>\n<p>戻り値 <code>Boolean</code> -現在のプロセスが信頼されたアクセシビリティクライアントである場合 <code>true</code> で、そうでない場合は <code>false</code> です。</p>\n<h3 id=\"systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><a href=\"#systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><code>systemPreferences.getMediaAccessStatus(mediaType)</code> <em>Windows</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>mediaType</code> String - <code>microphone</code>、<code>camera</code>、<code>screen</code> のいずれかにできます。</li>\n</ul>\n<p>戻り値 <code>String</code> - <code>not-determined</code>、<code>granted</code>、<code>denied</code>、<code>restricted</code> か <code>unknown</code> になります。</p>\n<p>macOS 10.13 High Sierra 以前では、このユーザーの同意は必要なかったので、このメソッドは常に <code>granted</code> を返します。 macOS 10.14 Mojave 以降では、<code>microphone</code> と <code>camera</code> へのアクセスに同意が必要です。 macOS 10.15 Catalina 以降では、<code>screen</code> へのアクセスに同意が必要です。</p>\n<p>Windows 10 には、すべての win32 アプリケーションの <code>microphone</code> と <code>camera</code> へのアクセスを制御するグローバル設定があります。 これは <code>screen</code> と古いバージョンの Windows すべてのメディアタイプに対して常に <code>granted</code> を返します。</p>\n<h3 id=\"systempreferencesaskformediaaccessmediatype-macos\"><a href=\"#systempreferencesaskformediaaccessmediatype-macos\"><code>systemPreferences.askForMediaAccess(mediaType)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>mediaType</code> String - 要求されるメディアのタイプで、<code>microphone</code>、<code>camera</code> にできます。</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;Boolean></code> - 許可された場合は <code>true</code> で、拒否された場合は <code>false</code> で解決する Promise。 無効な <code>mediaType</code> を渡した場合、Promise は reject されます。 アクセス要求が拒否されて後でシステム環境設定パネルを通して変更した場合、新しい権限の効果を得るためにアプリの再起動が必要です。 すでにアクセスを要求して拒否された場合、設定パネルを通して変更<em>しなければなりません</em>。警告はポップアップせずに Promise は現在のアクセス状態で解決します。</p>\n<p><strong>重要:</strong> この API を正しく活用するには、アプリの <code>Info.plist</code> ファイルに <code>NSMicrophoneUsageDescription</code> と <code>NSCameraUsageDescription</code> の文字列を<a href=\"https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos?language=objc\">設定する必要があります</a>。 これらのキーの値は許可ダイアログに使用され、許可要求の目的についてユーザーに適切に通知されます。 Electron のコンテキスト内でどのようにこれらを設定するのかについての更なる情報は、<a href=\"/docs/tutorial/application-distribution#macos\">Electron アプリケーション頒布</a> を参照してください。</p>\n<p>このユーザーの同意は macOS 10.14 Mojave まで必要ではなかったので、システムを 10.13 High Sierra 以下で実行している場合このメソッドは常に <code>true</code> を返します。</p>\n<h3 id=\"systempreferencesgetanimationsettings\"><a href=\"#systempreferencesgetanimationsettings\"><code>systemPreferences.getAnimationSettings()</code></a></h3>\n<p>戻り値 <code>Object</code>:</p>\n<ul>\n<li><code>shouldRenderRichAnimation</code> Boolean - リッチアニメーションをレンダリングする必要がある場合は true を返します。 セッションの種類 (例えばリモートデスクトップ) とアクセシビリティの設定を調べて、重いアニメーションのガイダンスを提供します。</li>\n<li><code>scrollAnimationsEnabledBySystem</code> Boolean - スクロールアニメーション (例えばホームキーやエンドキーで生成されるもの) を有効にするかどうかがプラットフォームごとに決定されます。</li>\n<li><code>prefersReducedMotion</code> Boolean - ユーザーがプラットフォーム API に基づいてモーションの削減を望むかどうかが決定されます。</li>\n</ul>\n<p>システムアニメーション設定を持つオブジェクトを返します。</p>\n<h2 id=\"プロパティ\"><a href=\"#プロパティ\">プロパティ</a></h2>\n<h3 id=\"systempreferencesapplevelappearance-macos\"><a href=\"#systempreferencesapplevelappearance-macos\"><code>systemPreferences.appLevelAppearance</code> <em>macOS</em></a></h3>\n<p><code>String</code> 型のプロパティです。<code>dark</code>、<code>light</code> か <code>unknown</code> にできます。 アプリケーションの macOS 外観設定を決定します。 これは <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc\">NSApplication.appearance</a> の値に対応します。 これを設定すると、システムのデフォルトと <code>getEffectiveAppearance</code> の値が上書きされます。</p>\n<p>設定可能な値は <code>dark</code> か <code>light</code> です。戻り値に取りうる値は <code>dark</code>、<code>light</code>、および <code>unknown</code>。</p>\n<p>このプロパティは macOS 10.14 Mojave 以降でのみ利用可能です。</p>\n<h3 id=\"systempreferenceseffectiveappearance-macos-readonly\"><a href=\"#systempreferenceseffectiveappearance-macos-readonly\"><code>systemPreferences.effectiveAppearance</code> <em>macOS</em> <em>Readonly</em></a></h3>\n<p><code>String</code> 型のプロパティです。<code>dark</code>、<code>light</code> か <code>unknown</code> にできます。</p>\n<p><a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc\">NSApplication.effectiveAppearance</a> に割り当てられている、現在アプリケーションに適用されている macOS の外観設定を返します。</p>",
      "title": "systemPreferences",
      "description": "システムの環境設定を取得します。"
    },
    "/docs/api/structures/task": {
      "locale": "ja-JP",
      "slug": "task",
      "href": "/docs/api/structures/task",
      "crowdinFileId": "256513",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/task.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"task-object\"><a href=\"#task-object\">Task Object</a></h1>\n<ul>\n<li><code>program</code> String - Path of the program to execute, usually you should specify <code>process.execPath</code> which opens the current program.</li>\n<li><code>arguments</code> String - The command line arguments when <code>program</code> is executed.</li>\n<li><code>title</code> String - The string to be displayed in a JumpList.</li>\n<li><code>description</code> String - Description of this task.</li>\n<li><code>iconPath</code> String - The absolute path to an icon to be displayed in a JumpList, which can be an arbitrary resource file that contains an icon. You can usually specify <code>process.execPath</code> to show the icon of the program.</li>\n<li><code>iconIndex</code> Number - The icon index in the icon file. If an icon file consists of two or more icons, set this value to identify the icon. If an icon file consists of one icon, this value is 0.</li>\n<li><code>workingDirectory</code> String (optional) - The working directory. Default is empty.</li>\n</ul>",
      "title": "Task Object",
      "description": ""
    },
    "/docs/development/testing": {
      "locale": "ja-JP",
      "slug": "testing",
      "href": "/docs/development/testing",
      "crowdinFileId": "256169",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/testing.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"テスト\"><a href=\"#テスト\">テスト</a></h1>\n<p>私達は Electron のコード網羅率を維持することを目指しています。 すべてのプルリクエストは、既存のすべてのテストに合格するだけでなく、変更されたコードと新しいシナリオをカバーする新しいテストを追加することを推奨します。 できるだけ多くのコードパスと Electron のユースケースを確保することで、より少ないバグでアプリを出荷することができます。</p>\n<p>このリポジトリには、JavaScript と C++ の両方に対する lint ルール、同様に対応するユニットテストと統合テストが付属しています。 Electron のコーディングスタイルの詳細については、<a href=\"/docs/development/coding-style\">コーディングスタイル</a> ドキュメントを参照してください。</p>\n<h2 id=\"lint\"><a href=\"#lint\">Lint</a></h2>\n<p>JavaScript が Electron コーディングスタイルに準拠していることを確認するには、<code>npm run lint-js</code> を実行します。これは、Electron 自身とユニットテストの両方に対し <code>standard</code> を実行します。 プラグイン/アドオンシステムを備えたエディタを使用している場合は、多くの <a href=\"https://standardjs.com/#are-there-text-editor-plugins\">StandardJS アドオン</a> にコーディングスタイルの違反が通知されます。</p>\n<p>引数つきで <code>standard</code> を実行するには、<code>npm run lint-js --</code> に <code>standard</code> に渡したい引数を続けて書いて実行します。</p>\n<p>C++ が Electron コーディングスタイルに準拠していることを確認するには、<code>npm run lint-cpp</code> を実行します。これは、<code>cpplint</code> スクリプトを実行します。 <code>clang-format</code> と用意された <a href=\"/docs/development/clang-format\">短いチュートリアル</a> を使うことを推奨します。</p>\n<p>このリポジトリに Python が多数あるわけではありませんが、これもコーディングスタイル規則によって管理されています。 <code>npm run lint-py</code> を実行すれば、<code>pylint</code> を使ってすべての Python をチェックします。</p>\n<h2 id=\"単体テスト\"><a href=\"#単体テスト\">単体テスト</a></h2>\n<p><a href=\"https://github.com/electron/build-tools\">build-tools</a> を使用していない場合は、Electron のローカルビルド用コンフィグ名を確認してください。これは、<code>Testing</code>、<code>Release</code>、<code>Default</code>、<code>Debug</code>、設定した <code>process.env.ELECTRON_OUT_DIR</code> のいずれかです。 これらをセットしていないと、Electron はテスト前の手順を実行できないことがあります。</p>\n<p>すべてのユニットテストを実行するには、<code>npm run test</code> を実行します。 ユニットテストは <code>spec</code> フォルダにある Electron アプリ (ｵﾄﾞﾛｷ!) です。 その <code>package.json</code> もあり、その依存関係はトップレベルの <code>package.json</code> には定義されていないことに注意してください。</p>\n<p>パターンに一致する特定のテストだけを実行するには、<code>npm run test -- -g=PATTERN</code> で、<code>PATTERN</code> を実行したいテストに一致する正規表現に置き換えて実行します。 例として、IPC テストのみを実行したい場合は、<code>npm run test -g ipc</code> を実行します。</p>\n<h3 id=\"windows-10-デバイス上でテスト\"><a href=\"#windows-10-デバイス上でテスト\">Windows 10 デバイス上でテスト</a></h3>\n<h4 id=\"単体テストを実行するための追加手順\"><a href=\"#単体テストを実行するための追加手順\">単体テストを実行するための追加手順:</a></h4>\n<ol>\n<li>\n<p>Visual Studio 2019 をインストールする必要があります。</p>\n</li>\n<li>\n<p>Node ヘッダーは構成に合わせてコンパイルする必要があります。</p>\n<pre><code class=\"hljs language-powershell\">ninja -C out\\Testing third_party\\electron_node:headers\n</code></pre>\n</li>\n<li>\n<p>electron.lib を node.lib としてコピーする必要があります。</p>\n<pre><code class=\"hljs language-powershell\">cd out\\Testing\nmkdir gen\\node_headers\\Release\ncopy electron.lib gen\\node_headers\\Release\\node.lib\n</code></pre>\n</li>\n</ol>\n<h4 id=\"フォントの欠落\"><a href=\"#フォントの欠落\">フォントの欠落</a></h4>\n<p><a href=\"https://docs.microsoft.com/en-us/typography/fonts/windows_10_font_list\">一部の Windows 10 デバイス</a> はメイリオフォントがインストールされていない状態で出荷されるため、フォントフォールバックテストが失敗する可能性があります。 メイリオをインストールするには以下のようにします。</p>\n<ol>\n<li>Windows キーを押して <em>オプション機能の管理</em> と検索します。</li>\n<li><em>機能の追加</em> をクリックします。</li>\n<li><em>日本語追加フォント</em> を選択して <em>インストール</em> をクリックします。</li>\n</ol>\n<h4 id=\"ピクセル測定\"><a href=\"#ピクセル測定\">ピクセル測定</a></h4>\n<p>正確なピクセル測定値に依存するようなテストは、浮動小数点精度の誤差のために Hi-DPI 画面設定のデバイスでは正しく動作しない場合があります。 これらのテストを正常に実行するには、そのデバイスが倍率 100% に設定されていることを確認してください。</p>\n<p>ディスプレイ倍率を設定するには、</p>\n<ol>\n<li>Windows キーを押して <em>ディスプレイの設定</em> と検索します。</li>\n<li><em>スケールとレイアウト</em> で、そのデバイスが 100% に設定されていることを確認します。</li>\n</ol>",
      "title": "テスト",
      "description": ""
    },
    "/docs/tutorial/testing-on-headless-ci": {
      "locale": "ja-JP",
      "slug": "testing-on-headless-ci",
      "href": "/docs/tutorial/testing-on-headless-ci",
      "crowdinFileId": "256255",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/testing-on-headless-ci.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ヘッドレスciシステムでのテスト-travis-ci-jenkins\"><a href=\"#ヘッドレスciシステムでのテスト-travis-ci-jenkins\">ヘッドレスCIシステムでのテスト (Travis CI, Jenkins)</a></h1>\n<p>Chromium ベースであるが故に、 Electron の動作にはディスプレイドライバが必要です。 もし、Chromiumがディスプレイドライバを見つけられない場合、Electronは起動に失敗します。そのため、あなたがどのように実行するかに関わらず、あなたのテストは実行できません。 Travis、Circle、Jenkins などのシステムで Electron ベースのアプリをテストするには、ちょっとした設定が必要です。 要するに、仮想ディスプレイドライバを使う必要があります。</p>\n<h2 id=\"仮想ディスプレイの構成\"><a href=\"#仮想ディスプレイの構成\">仮想ディスプレイの構成</a></h2>\n<p>まず、<a href=\"https://en.wikipedia.org/wiki/Xvfb\">Xvfb</a> をインストールします。 これは仮想フレームバッファで、X11 ディスプレイサーバプロトコルを実装しています。このフレームバッファは、画面出力を行うことなくメモリ内ですべてのグラフィック操作を行います。</p>\n<p>それから、仮想 Xvfb スクリーンを作成し、DISPLAY 環境変数でそれを指定します。 Electron の Chromium は自動的に <code>$DISPLAY</code> を探してくれるので、アプリの設定は特に必要ありません。 このステップは、Anaïs Betts 氏の <a href=\"https://github.com/anaisbetts/xvfb-maybe\">xvfb-maybe</a> で自動化できます。テストコマンドに <code>xvfb-maybe</code> を加えると、この小さなツールは必要な場合に自動で Xvfb を設定します。 Windows や macOSでは何もしません。</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-comment\">## Windows や macOS はelectron-mochaを起動します。</span>\n<span class=\"hljs-comment\">## Linuxで ヘッドレス環境の場合、これは</span>\n<span class=\"hljs-comment\">## xvfb-run electron-mocha ./test/*.js と同じです。</span>\nxvfb-maybe electron-mocha ./<span class=\"hljs-built_in\">test</span>/*.js\n</code></pre>\n<h3 id=\"travis-ci\"><a href=\"#travis-ci\">Travis CI</a></h3>\n<p>Travisにおいては、 <code>.travis.yml</code> を以下のようなものにしてください。</p>\n<pre><code class=\"hljs language-yml\"><span class=\"hljs-attr\">addons:</span>\n  <span class=\"hljs-attr\">apt:</span>\n    <span class=\"hljs-attr\">packages:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">xvfb</span>\n\n<span class=\"hljs-attr\">install:</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">export</span> <span class=\"hljs-string\">DISPLAY=':99.0'</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">Xvfb</span> <span class=\"hljs-string\">:99</span> <span class=\"hljs-string\">-screen</span> <span class=\"hljs-number\">0</span> <span class=\"hljs-string\">1024x768x24</span> <span class=\"hljs-string\">></span> <span class=\"hljs-string\">/dev/null</span> <span class=\"hljs-number\">2</span><span class=\"hljs-string\">>&#x26;1</span> <span class=\"hljs-string\">&#x26;</span>\n</code></pre>\n<h3 id=\"jenkins\"><a href=\"#jenkins\">Jenkins</a></h3>\n<p>Jenkins 用の <a href=\"https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin\">Xvfb プラグインが利用可能です</a>。</p>\n<h3 id=\"circle-ci\"><a href=\"#circle-ci\">Circle CI</a></h3>\n<p>Circle CI はよくできており、 Xvfb と <code>$DISPLAY</code> が <a href=\"https://circleci.com/docs/environment#browsers\">すでにセットアップされているのでこれ以上の設定は不要</a> です。</p>\n<h3 id=\"appveyor\"><a href=\"#appveyor\">AppVeyor</a></h3>\n<p>Windows上で AppVeyor は実行します。また Selenium、 Chromium、 Electron またそれに類似したツールをすぐに使用できます。 - 設定は必要ありません。</p>",
      "title": "ヘッドレスCIシステムでのテスト (Travis CI, Jenkins)",
      "description": ""
    },
    "/docs/tutorial/testing-widevine-cdm": {
      "locale": "ja-JP",
      "slug": "testing-widevine-cdm",
      "href": "/docs/tutorial/testing-widevine-cdm",
      "crowdinFileId": "256257",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/testing-widevine-cdm.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"widevine-cdm-のテスト\"><a href=\"#widevine-cdm-のテスト\">Widevine CDM のテスト</a></h1>\n<p>Electron では、Chrome ブラウザに同梱されている Widevine CDM ライブラリを使用できます。</p>\n<p>Widevine Content Decryption Modules (CDMs) は、Flash や Silverlight のような NPAPI プラグインに頼ることなく、ストリーミングサービスが HTML 5 ビデオを使用して Web ブラウザにコンテンツを保護する方法です。 Widevine サポートは、DRM 保護されたビデオコンテンツの再生に現在 Silverlight を使用しているストリーミングサービスの代替ソリューションです。 Web サイトは NPAPI プラグインを使用せずに Firefox で DRM 保護されたビデオコンテンツを表示することができます。 Widevine CDM はオープンソースの CDM サンドボックスで実行され、NPAPI プラグインよりも優れたユーザーセキュリティを提供します。</p>\n<h4 id=\"vmp-に関する注意\"><a href=\"#vmp-に関する注意\">VMP に関する注意</a></h4>\n<p><a href=\"https://electronjs.org/releases#1.8.1\"><code>Electron v1.8.0 (Chrome v59)</code></a> 以降では、以下のステップは Widevine を有効にするために必要なステップの一部に過ぎません。Widevine CDM を使用する予定の、そのバージョン以降のアプリは、<a href=\"https://www.widevine.com/\">Widevine</a> 自体から取得したライセンスを使用して署名する必要があります。</p>\n<p><a href=\"https://www.widevine.com/\">Widevine</a> あたり:</p>\n<blockquote>\n<p>Chrome 59 (以降) には、検証済みメディアパス (VMP) のサポートが含まれています。 VMP はデバイスプラットフォームの信頼性を検証する方法を提供します。 ブラウザ展開の場合、これはブラウザベースの実装が信頼性があり安全であるかどうかを判断するための追加のシグナルを提供します。</p>\n<p>プロキシ統合ガイドが VMP およびライセンスの発行方法に関する情報で更新されました。</p>\n<p>Widevine は、私たちのブラウザベースの統合 (ベンダおよびブラウザベースのアプリケーション) が VMP のサポートを追加することを推奨しています。</p>\n</blockquote>\n<p>この新しい制限でビデオの再生を可能にするために、<a href=\"https://castlabs.com/open-source/downstream/\">castLabs</a> は、Widevine から必要なライセンスを取得した場合に、Widevine を Electron アプリケーションで再生できるようにするために必要な変更を実装した <a href=\"https://github.com/castlabs/electron-releases\">fork</a> を作成しました。</p>\n<h2 id=\"ライブラリの取得\"><a href=\"#ライブラリの取得\">ライブラリの取得</a></h2>\n<p>Chrome ブラウザで <code>chrome://components/</code> を開き、<code>Widevine Content Decryption Module</code> を見つけて最新のものであることを確認したら、アプリケーションディレクトリからライブラリファイルを見つけることができます。</p>\n<h3 id=\"windowsの場合\"><a href=\"#windowsの場合\">Windowsの場合</a></h3>\n<p>ライブラリファイル <code>widevinecdm.dll</code> は、<code>Program Files(x86)/Google/Chrome/Application/CHROME_VERSION/WidevineCdm/_platform_specific/win_(x86|x64)/</code> ディレクトリにあります。</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>ライブラリファイル <code>libwidevinecdm.dylib</code> は、<code>/Applications/Google Chrome.app/Contents/Versions/CHROME_VERSION/Google Chrome Framework.framework/Versions/A/Libraries/WidevineCdm/_platform_specific/mac_(x86|x64)/</code> ディレクトリにあります。</p>\n<p><strong>注意:</strong> Electron が使用する chrome バージョンが、Chrome の widevine cdm コンポーネントの <code>min_chrome_version</code> 値以上であることを確認してください。 値は、<code>WidevineCdm</code> ディレクトリの <code>manifest.json</code> にあります。</p>\n<h2 id=\"ライブラリの使用\"><a href=\"#ライブラリの使用\">ライブラリの使用</a></h2>\n<p>ライブラリファイルを取得したら、<code>--widevine-cdm-path</code> コマンドラインスイッチを使用してファイルへのパスを渡し、<code>--widevine-cdm-version</code> スイッチを使用してライブラリのバージョンを渡す必要があります。 <code>app</code> モジュールの <code>ready</code> イベントが発行される前に、コマンドラインスイッチを渡す必要があります。</p>\n<p>コード例</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// You have to pass the directory that contains widevine library here, it is</span>\n<span class=\"hljs-comment\">// * `libwidevinecdm.dylib` on macOS,</span>\n<span class=\"hljs-comment\">// * `widevinecdm.dll` on Windows.</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'widevine-cdm-path'</span>, <span class=\"hljs-string\">'/path/to/widevine_library'</span>)\n<span class=\"hljs-comment\">// プラグインのバージョンは Chrome 内の `chrome://components` ページから取得できます。</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'widevine-cdm-version'</span>, <span class=\"hljs-string\">'1.4.8.866'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.show()\n})\n</code></pre>\n<h2 id=\"widevine-cdm-サポートの確認\"><a href=\"#widevine-cdm-サポートの確認\">Widevine CDM サポートの確認</a></h2>\n<p>widevine が機能するかどうかを確認するには、次の方法を使用できます。</p>\n<ul>\n<li><a href=\"https://shaka-player-demo.appspot.com/\">https://shaka-player-demo.appspot.com/</a> を開き、<code>Widevine</code> を使用するマニフェストを読み込みます。</li>\n<li><a href=\"http://www.dash-player.com/demo/drm-test-area/\">http://www.dash-player.com/demo/drm-test-area/</a> を開き、ページに <code>bitdash uses Widevine in your browser</code> と表示されているかどうかを確認してから、ビデオを再生します。</li>\n</ul>",
      "title": "Widevine CDM のテスト",
      "description": "Chrome 59 (以降) には、検証済みメディアパス (VMP) のサポートが含まれています。 VMP はデバイスプラットフォームの信頼性を検証する方法を提供します。 ブラウザ展開の場合、これはブラウザベースの実装が信頼性があり安全であるかどうかを判断するための追加のシグナルを提供します。\nプロキシ統合ガイドが VMP およびライセンスの発行方法に関する情報で更新されました。\nWidevine は、私たちのブラウザベースの統合 (ベンダおよびブラウザベースのアプリケーション) が VMP のサポートを追加することを推奨しています。"
    },
    "/docs/api/structures/thumbar-button": {
      "locale": "ja-JP",
      "slug": "thumbar-button",
      "href": "/docs/api/structures/thumbar-button",
      "crowdinFileId": "256515",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/thumbar-button.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"thumbarbutton-object\"><a href=\"#thumbarbutton-object\">ThumbarButton Object</a></h1>\n<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - The icon showing in thumbnail toolbar.</li>\n<li><code>click</code> Function</li>\n<li><code>tooltip</code> String (optional) - The text of the button's tooltip.</li>\n<li><code>flags</code> String<a href=\"/docs/api/structures/optional\"></a> - Control specific states and behaviors of the button. By default, it is <code>['enabled']</code>.</li>\n</ul>\n<p>The <code>flags</code> is an array that can include following <code>String</code>s:</p>\n<ul>\n<li><code>enabled</code> - The button is active and available to the user.</li>\n<li><code>disabled</code> - The button is disabled. It is present, but has a visual state indicating it will not respond to user action.</li>\n<li><code>dismissonclick</code> - When the button is clicked, the thumbnail window closes immediately.</li>\n<li><code>nobackground</code> - Do not draw a button border, use only the image.</li>\n<li><code>hidden</code> - The button is not shown to the user.</li>\n<li><code>noninteractive</code> - The button is enabled but not interactive; no pressed button state is drawn. This value is intended for instances where the button is used in a notification.</li>\n</ul>",
      "title": "ThumbarButton Object",
      "description": ""
    },
    "/docs/api/touch-bar": {
      "locale": "ja-JP",
      "slug": "touch-bar",
      "href": "/docs/api/touch-bar",
      "crowdinFileId": "256395",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"touchbar\"><a href=\"#touchbar\">TouchBar</a></h1>\n<h2 id=\"クラス-touchbar\"><a href=\"#クラス-touchbar\">クラス: TouchBar</a></h2>\n<blockquote>\n<p>ネイティブ macOS アプリ向けに、TouchBar レイアウトを作成します</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h3 id=\"new-touchbaroptions\"><a href=\"#new-touchbaroptions\"><code>new TouchBar(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>items</code> (<a href=\"/docs/api/touch-bar-button\">TouchBarButton</a> | <a href=\"/docs/api/touch-bar-color-picker\">TouchBarColorPicker</a> | <a href=\"/docs/api/touch-bar-group\">TouchBarGroup</a> | <a href=\"/docs/api/touch-bar-label\">TouchBarLabel</a> | <a href=\"/docs/api/touch-bar-popover\">TouchBarPopover</a> | <a href=\"/docs/api/touch-bar-scrubber\">TouchBarScrubber</a> | <a href=\"/docs/api/touch-bar-segmented-control\">TouchBarSegmentedControl</a> | <a href=\"/docs/api/touch-bar-slider\">TouchBarSlider</a> | <a href=\"/docs/api/touch-bar-spacer\">TouchBarSpacer</a>)<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a></li>\n<li><code>escapeItem</code> (<a href=\"/docs/api/touch-bar-button\">TouchBarButton</a> | <a href=\"/docs/api/touch-bar-color-picker\">TouchBarColorPicker</a> | <a href=\"/docs/api/touch-bar-group\">TouchBarGroup</a> | <a href=\"/docs/api/touch-bar-label\">TouchBarLabel</a> | <a href=\"/docs/api/touch-bar-popover\">TouchBarPopover</a> | <a href=\"/docs/api/touch-bar-scrubber\">TouchBarScrubber</a> | <a href=\"/docs/api/touch-bar-segmented-control\">TouchBarSegmentedControl</a> | <a href=\"/docs/api/touch-bar-slider\">TouchBarSlider</a> | <a href=\"/docs/api/touch-bar-spacer\">TouchBarSpacer</a> | null) (任意)</li>\n</ul></li>\n</ul>\n<p>指定したアイテムの新しい Touch Bar を作成します。 <code>BrowserWindow.setTouchBar</code> でウインドウに <code>TouchBar</code> を追加することができます。</p>\n<p><strong>Note:</strong> TouchBar API は現在実験的な機能です。そのため、将来的には変更されたり削除されたりする可能性があります。</p>\n<p><strong>ヒント:</strong> Touch Bar 付きの MacBook をお持ちでない場合は、Touch Bar を使用するアプリの検証に <a href=\"https://github.com/sindresorhus/touch-bar-simulator\">Touch Bar シミュレータ</a> をぜひご利用ください。</p>\n<h3 id=\"静的プロパティ\"><a href=\"#静的プロパティ\">静的プロパティ</a></h3>\n<h4 id=\"touchbarbutton\"><a href=\"#touchbarbutton\"><code>TouchBarButton</code></a></h4>\n<p><a href=\"/docs/api/touch-bar-button\"><code>typeof TouchBarButton</code></a> であり、<code>TouchBarButton</code> クラスの参照です。</p>\n<h4 id=\"touchbarcolorpicker\"><a href=\"#touchbarcolorpicker\"><code>TouchBarColorPicker</code></a></h4>\n<p><a href=\"/docs/api/touch-bar-color-picker\"><code>typeof TouchBarColorPicker</code></a> であり、<code>TouchBarColorPicker</code> クラスの参照です。</p>\n<h4 id=\"touchbargroup\"><a href=\"#touchbargroup\"><code>TouchBarGroup</code></a></h4>\n<p><a href=\"/docs/api/touch-bar-group\"><code>typeof TouchBarGroup</code></a> であり、<code>TouchBarGroup</code> クラスの参照です。</p>\n<h4 id=\"touchbarlabel\"><a href=\"#touchbarlabel\"><code>TouchBarLabel</code></a></h4>\n<p><a href=\"/docs/api/touch-bar-label\"><code>typeof TouchBarLabel</code></a> であり、<code>TouchBarLabel</code> クラスの参照です。</p>\n<h4 id=\"touchbarpopover\"><a href=\"#touchbarpopover\"><code>TouchBarPopover</code></a></h4>\n<p><a href=\"/docs/api/touch-bar-popover\"><code>typeof TouchBarPopover</code></a> であり、<code>TouchBarPopover</code> クラスの参照です。</p>\n<h4 id=\"touchbarscrubber\"><a href=\"#touchbarscrubber\"><code>TouchBarScrubber</code></a></h4>\n<p><a href=\"/docs/api/touch-bar-scrubber\"><code>typeof TouchBarScrubber</code></a> であり、<code>TouchBarScrubber</code> クラスの参照です。</p>\n<h4 id=\"touchbarsegmentedcontrol\"><a href=\"#touchbarsegmentedcontrol\"><code>TouchBarSegmentedControl</code></a></h4>\n<p><a href=\"/docs/api/touch-bar-segmented-control\"><code>typeof TouchBarSegmentedControl</code></a> であり、<code>TouchBarSegmentedControl</code> クラスの参照です。</p>\n<h4 id=\"touchbarslider\"><a href=\"#touchbarslider\"><code>TouchBarSlider</code></a></h4>\n<p><a href=\"/docs/api/touch-bar-slider\"><code>typeof TouchBarSlider</code></a> であり、<code>TouchBarSlider</code> クラスの参照です。</p>\n<h4 id=\"touchbarspacer\"><a href=\"#touchbarspacer\"><code>TouchBarSpacer</code></a></h4>\n<p><a href=\"/docs/api/touch-bar-spacer\"><code>typeof TouchBarSpacer</code></a> であり、<code>TouchBarSpacer</code> クラスの参照です。</p>\n<h4 id=\"touchbarotheritemsproxy\"><a href=\"#touchbarotheritemsproxy\"><code>TouchBarOtherItemsProxy</code></a></h4>\n<p><a href=\"/docs/api/touch-bar-other-items-proxy\"><code>typeof TouchBarOtherItemsProxy</code></a> であり、<code>TouchBarOtherItemsProxy</code> クラスの参照です。</p>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<p><code>TouchBar</code> のインスタンスには以下のプロパティがあります。</p>\n<h4 id=\"touchbarescapeitem\"><a href=\"#touchbarescapeitem\"><code>touchBar.escapeItem</code></a></h4>\n<p>設定すると、タッチバーの \"esc\" ボタンを置き換える <code>TouchBarItem</code>。 <code>null</code> に設定するとデフォルトの \"esc\" ボタンが復元されます。 この値を変更すると、タッチバーのエスケープアイテムがすぐに更新されます。</p>\n<h2 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h2>\n<p>ボタンといくつかのラベルで構成される、シンプルな TouchBar 向けスロットゲームのコード例を示します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, TouchBar } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> { TouchBarLabel, TouchBarButton, TouchBarSpacer } = TouchBar\n\n<span class=\"hljs-keyword\">let</span> spinning = <span class=\"hljs-literal\">false</span>\n\n<span class=\"hljs-comment\">// リールのラベル</span>\n<span class=\"hljs-keyword\">const</span> reel1 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n<span class=\"hljs-keyword\">const</span> reel2 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n<span class=\"hljs-keyword\">const</span> reel3 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n\n<span class=\"hljs-comment\">// 回した結果のラベル</span>\n<span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n\n<span class=\"hljs-comment\">// 回すボタン</span>\n<span class=\"hljs-keyword\">const</span> spin = <span class=\"hljs-keyword\">new</span> TouchBarButton({\n  <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'🎰 Spin'</span>,\n  <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#7851A9'</span>,\n  <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// 回転中のクリックを無視</span>\n    <span class=\"hljs-keyword\">if</span> (spinning) {\n      <span class=\"hljs-keyword\">return</span>\n    }\n\n    spinning = <span class=\"hljs-literal\">true</span>\n    result.label = <span class=\"hljs-string\">''</span>\n\n    <span class=\"hljs-keyword\">let</span> timeout = <span class=\"hljs-number\">10</span>\n    <span class=\"hljs-keyword\">const</span> spinLength = <span class=\"hljs-number\">4</span> * <span class=\"hljs-number\">1000</span> <span class=\"hljs-comment\">// 4 秒</span>\n    <span class=\"hljs-keyword\">const</span> startTime = <span class=\"hljs-built_in\">Date</span>.now()\n\n    <span class=\"hljs-keyword\">const</span> spinReels = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      updateReels()\n\n      <span class=\"hljs-keyword\">if</span> ((<span class=\"hljs-built_in\">Date</span>.now() - startTime) >= spinLength) {\n        finishSpin()\n      } <span class=\"hljs-keyword\">else</span> {\n        <span class=\"hljs-comment\">// 各回転を少し遅くする</span>\n        timeout *= <span class=\"hljs-number\">1.1</span>\n        setTimeout(spinReels, timeout)\n      }\n    }\n\n    spinReels()\n  }\n})\n\n<span class=\"hljs-keyword\">const</span> getRandomValue = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> values = [<span class=\"hljs-string\">'🍒'</span>, <span class=\"hljs-string\">'💎'</span>, <span class=\"hljs-string\">'7️⃣'</span>, <span class=\"hljs-string\">'🍊'</span>, <span class=\"hljs-string\">'🔔'</span>, <span class=\"hljs-string\">'⭐'</span>, <span class=\"hljs-string\">'🍇'</span>, <span class=\"hljs-string\">'🍀'</span>]\n  <span class=\"hljs-keyword\">return</span> values[<span class=\"hljs-built_in\">Math</span>.floor(<span class=\"hljs-built_in\">Math</span>.random() * values.length)]\n}\n\n<span class=\"hljs-keyword\">const</span> updateReels = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  reel1.label = getRandomValue()\n  reel2.label = getRandomValue()\n  reel3.label = getRandomValue()\n}\n\n<span class=\"hljs-keyword\">const</span> finishSpin = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> uniqueValues = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Set</span>([reel1.label, reel2.label, reel3.label]).size\n  <span class=\"hljs-keyword\">if</span> (uniqueValues === <span class=\"hljs-number\">1</span>) {\n    <span class=\"hljs-comment\">// 3 つすべての値が同じ場合</span>\n    result.label = <span class=\"hljs-string\">'💰 ジャックポット!'</span>\n    result.textColor = <span class=\"hljs-string\">'#FDFF00'</span>\n  } <span class=\"hljs-keyword\">else</span> <span class=\"hljs-keyword\">if</span> (uniqueValues === <span class=\"hljs-number\">2</span>) {\n    <span class=\"hljs-comment\">// 2 つの値が同じ場合</span>\n    result.label = <span class=\"hljs-string\">'😍 やったね!'</span>\n    result.textColor = <span class=\"hljs-string\">'#FDFF00'</span>\n  } <span class=\"hljs-keyword\">else</span> {\n    <span class=\"hljs-comment\">// 同じ値がない場合</span>\n    result.label = <span class=\"hljs-string\">'🙁 もう一度'</span>\n    result.textColor = <span class=\"hljs-literal\">null</span>\n  }\n  spinning = <span class=\"hljs-literal\">false</span>\n}\n\n<span class=\"hljs-keyword\">const</span> touchBar = <span class=\"hljs-keyword\">new</span> TouchBar({\n  <span class=\"hljs-attr\">items</span>: [\n    spin,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'large'</span> }),\n    reel1,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'small'</span> }),\n    reel2,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'small'</span> }),\n    reel3,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'large'</span> }),\n    result\n  ]\n})\n\n<span class=\"hljs-keyword\">let</span> <span class=\"hljs-built_in\">window</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-built_in\">window</span> = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span>,\n    <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span>,\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#000'</span>\n  })\n  <span class=\"hljs-built_in\">window</span>.loadURL(<span class=\"hljs-string\">'about:blank'</span>)\n  <span class=\"hljs-built_in\">window</span>.setTouchBar(touchBar)\n})\n</code></pre>\n<h3 id=\"上記のサンプルを実行する\"><a href=\"#上記のサンプルを実行する\">上記のサンプルを実行する</a></h3>\n<p>上記のサンプルを実行するには、(予めターミナルで適当なディレクトリを開いた上で) 以下の操作を行ってください。</p>\n<ol>\n<li>上記のコードを <code>touchbar.js</code> として保存する</li>\n<li><code>npm install electron</code> と入力し、 Electron をインストールします</li>\n<li><code>./node_modules/.bin/electron touchbar.js</code> と入力し、Electron でサンプルを実行する</li>\n</ol>\n<p>すると、 Electron のウィンドウと、 Touch Bar 上（あるいは Touch Bar エミュレータ上）で動作するサンプルアプリをご覧になる事ができるはずです。</p>",
      "title": "TouchBar",
      "description": "ネイティブ macOS アプリ向けに、TouchBar レイアウトを作成します"
    },
    "/docs/api/touch-bar-button": {
      "locale": "ja-JP",
      "slug": "touch-bar-button",
      "href": "/docs/api/touch-bar-button",
      "crowdinFileId": "256375",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-button.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-touchbarbutton\"><a href=\"#クラス-touchbarbutton\">クラス: TouchBarButton</a></h2>\n<blockquote>\n<p>ネイティブ macOS アプリケーション用のタッチバー内にボタンを作成する</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<h3 id=\"new-touchbarbuttonoptions\"><a href=\"#new-touchbarbuttonoptions\"><code>new TouchBarButton(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>label</code> String (任意) - ボタンのテキスト。</li>\n<li><code>accessibilityLabel</code> String (任意) - VoiceOver などのスクリーンリーダーが使用するボタンの簡単な説明文。</li>\n<li><code>backgroundColor</code> String (任意) - 16進数形式、即ち <code>#ABCDEF</code> のボタンの背景色。</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String (任意) - ボタンのアイコン。</li>\n<li><code>iconPosition</code> String (任意) - <code>left</code>、<code>right</code>、<code>overlay</code> にできます。 省略値は <code>overlay</code>。</li>\n<li><code>click</code> Function (任意) - ボタンがクリックされたときに呼ぶ関数。</li>\n<li><code>enabled</code> Boolean (任意) - ボタンが有効な状態かどうか。  省略値は <code>true</code> です。</li>\n</ul></li>\n</ul>\n<p><code>accessibilityLabel</code> を定義するときは、macOS <a href=\"https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc\">ベストプラクティス</a> を満たしていることを確認してください。</p>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<p><code>TouchBarButton</code> のインスタンスには以下のプロパティがあります。</p>\n<h4 id=\"touchbarbuttonaccessibilitylabel\"><a href=\"#touchbarbuttonaccessibilitylabel\"><code>touchBarButton.accessibilityLabel</code></a></h4>\n<p>スクリーンリーダーが読み上げるボタンの説明文を表す <code>String</code>。 ラベルが設定されていない場合に限り、スクリーンリーダーが読み上げます。</p>\n<h4 id=\"touchbarbuttonlabel\"><a href=\"#touchbarbuttonlabel\"><code>touchBarButton.label</code></a></h4>\n<p>ボタンの現在のテキストを表す <code>String</code>。 この値を変更すると、タッチバー内のボタンがすぐに更新されます。</p>\n<h4 id=\"touchbarbuttonbackgroundcolor\"><a href=\"#touchbarbuttonbackgroundcolor\"><code>touchBarButton.backgroundColor</code></a></h4>\n<p>ボタンの背景色を表す 16 進数の <code>String</code>。 この値を変更すると、タッチバー内のボタンがすぐに更新されます。</p>\n<h4 id=\"touchbarbuttonicon\"><a href=\"#touchbarbuttonicon\"><code>touchBarButton.icon</code></a></h4>\n<p>ボタンの現在のアイコンを表す <code>NativeImage</code>。 この値を変更すると、タッチバー内のボタンがすぐに更新されます。</p>\n<h4 id=\"touchbarbuttoniconposition\"><a href=\"#touchbarbuttoniconposition\"><code>touchBarButton.iconPosition</code></a></h4>\n<p><code>String</code> - <code>left</code> または <code>right</code> または <code>overlay</code> のいずれか。  省略値は <code>overlay</code>。</p>\n<h4 id=\"touchbarbuttonenabled\"><a href=\"#touchbarbuttonenabled\"><code>touchBarButton.enabled</code></a></h4>\n<p>ボタンが有効な状態かどうかを表す <code>Boolean</code>。</p>",
      "title": "クラス: TouchBarButton",
      "description": "ネイティブ macOS アプリケーション用のタッチバー内にボタンを作成する"
    },
    "/docs/api/touch-bar-color-picker": {
      "locale": "ja-JP",
      "slug": "touch-bar-color-picker",
      "href": "/docs/api/touch-bar-color-picker",
      "crowdinFileId": "256377",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-color-picker.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-touchbarcolorpicker\"><a href=\"#クラス-touchbarcolorpicker\">クラス: TouchBarColorPicker</a></h2>\n<blockquote>\n<p>ネイティブ macOS アプリケーション用のタッチバー内にカラーピッカーを作成する</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<h3 id=\"new-touchbarcolorpickeroptions\"><a href=\"#new-touchbarcolorpickeroptions\"><code>new TouchBarColorPicker(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>availableColors</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> - 選択可能な色として表示される、16進数の色の文字列の配列。</li>\n<li><code>selectedColor</code> String (任意) - 16進数形式、即ち <code>#ABCDEF</code> の選択された色。</li>\n<li><code>change</code> Function (任意) - 色が選択されたときに呼ばれる関数。<ul>\n<li><code>color</code> String - ユーザがピッカーから選択した色.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<p><code>TouchBarColorPicker</code> のインスタンスには以下のプロパティがあります。</p>\n<h4 id=\"touchbarcolorpickeravailablecolors\"><a href=\"#touchbarcolorpickeravailablecolors\"><code>touchBarColorPicker.availableColors</code></a></h4>\n<p>カラーピッカーで選択できる色を表す <code>String[]</code> 配列。 この値を変更すると、タッチバー内のカラーピッカーがすぐに更新されます。</p>\n<h4 id=\"touchbarcolorpickerselectedcolor\"><a href=\"#touchbarcolorpickerselectedcolor\"><code>touchBarColorPicker.selectedColor</code></a></h4>\n<p>カラーピッカーで選択した色を表す 16 進数の <code>String</code>。 この値を変更すると、タッチバー内のカラーピッカーがすぐに更新されます。</p>",
      "title": "クラス: TouchBarColorPicker",
      "description": "ネイティブ macOS アプリケーション用のタッチバー内にカラーピッカーを作成する"
    },
    "/docs/api/touch-bar-group": {
      "locale": "ja-JP",
      "slug": "touch-bar-group",
      "href": "/docs/api/touch-bar-group",
      "crowdinFileId": "256379",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-group.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-touchbargroup\"><a href=\"#クラス-touchbargroup\">クラス: TouchBarGroup</a></h2>\n<blockquote>\n<p>ネイティブ macOS アプリケーション用のタッチバー内にグループを作成する</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<h3 id=\"new-touchbargroupoptions\"><a href=\"#new-touchbargroupoptions\"><code>new TouchBarGroup(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>items</code> <a href=\"/docs/api/touch-bar\">TouchBar</a> - グループとして表示するアイテム。</li>\n</ul></li>\n</ul>",
      "title": "クラス: TouchBarGroup",
      "description": "ネイティブ macOS アプリケーション用のタッチバー内にグループを作成する"
    },
    "/docs/api/touch-bar-label": {
      "locale": "ja-JP",
      "slug": "touch-bar-label",
      "href": "/docs/api/touch-bar-label",
      "crowdinFileId": "256381",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-label.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-touchbarlabel\"><a href=\"#クラス-touchbarlabel\">クラス: TouchBarLabel</a></h2>\n<blockquote>\n<p>ネイティブ macOS アプリケーション用のタッチバー内にラベルを作成する</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<h3 id=\"new-touchbarlabeloptions\"><a href=\"#new-touchbarlabeloptions\"><code>new TouchBarLabel(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>label</code> String (任意) - 表示するテキスト。</li>\n<li><code>accessibilityLabel</code> String (任意) - VoiceOver などのスクリーンリーダーが使用するボタンの簡単な説明文。</li>\n<li><code>textColor</code> String (任意) - 16進数形式、即ち <code>#ABCDEF</code> のテキスト色。</li>\n</ul></li>\n</ul>\n<p><code>accessibilityLabel</code> を定義するときは、macOS <a href=\"https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc\">ベストプラクティス</a> を満たしていることを確認してください。</p>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<p><code>TouchBarLabel</code> のインスタンスには以下のプロパティがあります。</p>\n<h4 id=\"touchbarlabellabel\"><a href=\"#touchbarlabellabel\"><code>touchBarLabel.label</code></a></h4>\n<p>ラベルの現在のテキストを表す <code>String</code>。 この値を変更すると、タッチバー内のラベルがすぐに更新されます。</p>\n<h4 id=\"touchbarlabelaccessibilitylabel\"><a href=\"#touchbarlabelaccessibilitylabel\"><code>touchBarLabel.accessibilityLabel</code></a></h4>\n<p>スクリーンリーダーが読み上げるラベルの説明文を表す <code>String</code>。</p>\n<h4 id=\"touchbarlabeltextcolor\"><a href=\"#touchbarlabeltextcolor\"><code>touchBarLabel.textColor</code></a></h4>\n<p>ラベルの現在のテキストの色を表す 16 進数の <code>String</code>。 この値を変更すると、タッチバー内のラベルがすぐに更新されます。</p>",
      "title": "クラス: TouchBarLabel",
      "description": "ネイティブ macOS アプリケーション用のタッチバー内にラベルを作成する"
    },
    "/docs/api/touch-bar-other-items-proxy": {
      "locale": "ja-JP",
      "slug": "touch-bar-other-items-proxy",
      "href": "/docs/api/touch-bar-other-items-proxy",
      "crowdinFileId": "256383",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-other-items-proxy.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-touchbarotheritemsproxy\"><a href=\"#クラス-touchbarotheritemsproxy\">クラス: TouchBarOtherItemsProxy</a></h2>\n<blockquote>\n<p>特別な「その他のアイテムのプロキシ」をインスタンス化します。これは、プロキシが指定するスペースに、Chromiumから継承された TouchBar の要素を含有します。 既定では、入力の最後のそれぞれの TouchBar にプロキシを追加します。 詳細は、AppKit ドキュメントの <a href=\"https://developer.apple.com/documentation/appkit/nstouchbaritemidentifierotheritemsproxy\">NSTouchBarItemIdentifierOtherItemsProxy</a> を参照してください。</p>\n<p>注意: TouchBar 1 つあたりに追加できるのは、このクラスのインスタンス 1 つだけです。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<h3 id=\"new-touchbarotheritemsproxy\"><a href=\"#new-touchbarotheritemsproxy\"><code>new TouchBarOtherItemsProxy()</code></a></h3>",
      "title": "クラス: TouchBarOtherItemsProxy",
      "description": "特別な「その他のアイテムのプロキシ」をインスタンス化します。これは、プロキシが指定するスペースに、Chromiumから継承された TouchBar の要素を含有します。 既定では、入力の最後のそれぞれの TouchBar にプロキシを追加します。 詳細は、AppKit ドキュメントの NSTouchBarItemIdentifierOtherItemsProxy を参照してください。\n注意: TouchBar 1 つあたりに追加できるのは、このクラスのインスタンス 1 つだけです。"
    },
    "/docs/api/touch-bar-popover": {
      "locale": "ja-JP",
      "slug": "touch-bar-popover",
      "href": "/docs/api/touch-bar-popover",
      "crowdinFileId": "256385",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-popover.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-touchbarpopover\"><a href=\"#クラス-touchbarpopover\">クラス: TouchBarPopover</a></h2>\n<blockquote>\n<p>ネイティブ macOS アプリケーション用のタッチバー内にポップオーバーを作成する</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<h3 id=\"new-touchbarpopoveroptions\"><a href=\"#new-touchbarpopoveroptions\"><code>new TouchBarPopover(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>label</code> String (任意) - ポップオーバーするボタンのテキスト。</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> (任意) - ポップオーバーするボタンのアイコン。</li>\n<li><code>items</code> <a href=\"/docs/api/touch-bar\">TouchBar</a> - ポップオーバー内に表示するアイテム。</li>\n<li><code>showCloseButton</code> Boolean (任意) - <code>true</code> にするとポップオーバーの左に閉じるボタンを表示し、<code>false</code> にすると表示しません。 省略値は <code>true</code> です。</li>\n</ul></li>\n</ul>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<p><code>TouchBarPopover</code> のインスタンスには以下のプロパティがあります。</p>\n<h4 id=\"touchbarpopoverlabel\"><a href=\"#touchbarpopoverlabel\"><code>touchBarPopover.label</code></a></h4>\n<p>ポップオーバーの現在のボタンのテキストを表す <code>String</code>。 この値を変更すると、タッチバー内のポップオーバーのコントロールがすぐに更新されます。</p>\n<h4 id=\"touchbarpopovericon\"><a href=\"#touchbarpopovericon\"><code>touchBarPopover.icon</code></a></h4>\n<p>ポップオーバーの現在のボタンのアイコンを表す <code>NativeImage</code>。 この値を変更すると、タッチバー内のポップオーバーのコントロールがすぐに更新されます。</p>",
      "title": "クラス: TouchBarPopover",
      "description": "ネイティブ macOS アプリケーション用のタッチバー内にポップオーバーを作成する"
    },
    "/docs/api/touch-bar-scrubber": {
      "locale": "ja-JP",
      "slug": "touch-bar-scrubber",
      "href": "/docs/api/touch-bar-scrubber",
      "crowdinFileId": "256387",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-scrubber.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-touchbarscrubber\"><a href=\"#クラス-touchbarscrubber\">クラス: TouchBarScrubber</a></h2>\n<blockquote>\n<p>スクラバー (スクロールできるセレクタ) を作成します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<h3 id=\"new-touchbarscrubberoptions\"><a href=\"#new-touchbarscrubberoptions\"><code>new TouchBarScrubber(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>items</code> <a href=\"/docs/api/structures/scrubber-item\">ScrubberItem[]</a> - このスクラバーに配置するアイテムの配列.</li>\n<li><code>select</code> Function (任意) - ユーザーがタップしたアイテムが、最後にタップしたアイテムではないと呼ばれます。<ul>\n<li><code>selectedIndex</code> Integer - ユーザが選択したアイテムのインデックス.</li>\n</ul></li>\n<li><code>highlight</code> Function (任意) - ユーザが任意のアイテムをタップしたときに呼ばれます。<ul>\n<li><code>highlightedIndex</code> Integer - ユーザがタッチしたアイテムのインデックス.</li>\n</ul></li>\n<li><code>selectedStyle</code> String (任意) - 選択したアイテムのスタイル。 <code>background</code>、<code>outline</code>、<code>none</code> のいずれかにできます。 省略値は <code>none</code> です。</li>\n<li><code>overlayStyle</code> String (任意) - 選択したオーバーレイアイテムのスタイル。 <code>background</code>、<code>outline</code>、<code>none</code> のいずれかにできます。 省略値は <code>none</code> です。</li>\n<li><code>showArrowButtons</code> Boolean (任意) - 矢印ボタンを表示するかどうか。 省略値は <code>false</code> で、<code>items</code> が空でない場合にのみ表示されます。</li>\n<li><code>mode</code> String (任意) - <code>fixed</code> か <code>free</code> にできます。 省略値は <code>free</code> です。</li>\n<li><code>continuous</code> Boolean (任意) - 省略値は、<code>true</code> になります。</li>\n</ul></li>\n</ul>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<p><code>TouchBarScrubber</code> のインスタンスには以下のプロパティがあります。</p>\n<h4 id=\"touchbarscrubberitems\"><a href=\"#touchbarscrubberitems\"><code>touchBarScrubber.items</code></a></h4>\n<p>このスクラバー内のアイテムを表す <code>ScrubberItem[]</code> 配列。 この値を更新すると、タッチバーのコントロールがすぐに更新されます。 この配列の要素の中のプロパティを更新しても <strong>タッチバーは更新されません</strong>。</p>\n<h4 id=\"touchbarscrubberselectedstyle\"><a href=\"#touchbarscrubberselectedstyle\"><code>touchBarScrubber.selectedStyle</code></a></h4>\n<p>スクラバー内の選択したアイテムのスタイルを表す <code>String</code>。 この値を更新すると、タッチバーのコントロールがすぐに更新されます。 取りうる値:</p>\n<ul>\n<li><code>background</code> - <code>[NSScrubberSelectionStyle roundedBackgroundStyle]</code> に割り当て.</li>\n<li><code>outline</code> - <code>[NSScrubberSelectionStyle outlineOverlayStyle]</code> に割り当て.</li>\n<li><code>none</code> - スタイルを全て除去します。</li>\n</ul>\n<h4 id=\"touchbarscrubberoverlaystyle\"><a href=\"#touchbarscrubberoverlaystyle\"><code>touchBarScrubber.overlayStyle</code></a></h4>\n<p>スクラバー内の選択したアイテムのスタイルを表す <code>String</code>。 このスタイルは、その後ろに置かれるのではなく、スクラバーアイテムの上に重ねられます。 この値を更新すると、タッチバーのコントロールがすぐに更新されます。 取りうる値:</p>\n<ul>\n<li><code>background</code> - <code>[NSScrubberSelectionStyle roundedBackgroundStyle]</code> に割り当て.</li>\n<li><code>outline</code> - <code>[NSScrubberSelectionStyle outlineOverlayStyle]</code> に割り当て.</li>\n<li><code>none</code> - スタイルを全て除去します。</li>\n</ul>\n<h4 id=\"touchbarscrubbershowarrowbuttons\"><a href=\"#touchbarscrubbershowarrowbuttons\"><code>touchBarScrubber.showArrowButtons</code></a></h4>\n<p>このスクラバーに左 / 右の選択矢印を表示するかどうかを表す <code>Boolean</code>。 この値を更新すると、タッチバー内のコントロールがすぐに更新されます。</p>\n<h4 id=\"touchbarscrubbermode\"><a href=\"#touchbarscrubbermode\"><code>touchBarScrubber.mode</code></a></h4>\n<p>このスクラバーのモードを表す <code>String</code>。 この値を更新すると、タッチバーのコントロールがすぐに更新されます。 取りうる値:</p>\n<ul>\n<li><code>fixed</code> - <code>NSScrubberModeFixed</code> に割り当て.</li>\n<li><code>free</code> - <code>NSScrubberModeFree</code> に割り当て.</li>\n</ul>\n<h4 id=\"touchbarscrubbercontinuous\"><a href=\"#touchbarscrubbercontinuous\"><code>touchBarScrubber.continuous</code></a></h4>\n<p>このスクラバーが連続しているかどうかを表す <code>Boolean</code>。 この値を更新すると、タッチバーのコントロールがすぐに更新されます。</p>",
      "title": "クラス: TouchBarScrubber",
      "description": "スクラバー (スクロールできるセレクタ) を作成します。"
    },
    "/docs/api/touch-bar-segmented-control": {
      "locale": "ja-JP",
      "slug": "touch-bar-segmented-control",
      "href": "/docs/api/touch-bar-segmented-control",
      "crowdinFileId": "256389",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-segmented-control.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-touchbarsegmentedcontrol\"><a href=\"#クラス-touchbarsegmentedcontrol\">クラス: TouchBarSegmentedControl</a></h2>\n<blockquote>\n<p>1つのボタンが選択状態になっているセグメントコントロール (ボタングループ) を作成します</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<h3 id=\"new-touchbarsegmentedcontroloptions\"><a href=\"#new-touchbarsegmentedcontroloptions\"><code>new TouchBarSegmentedControl(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>segmentStyle</code> String (任意) - 以下のセグメントのスタイルのいずれかです。<ul>\n<li><code>automatic</code> - デフォルト。 セグメントコントロールの見た目は、コントロールを表示しているウインドウタイプとウインドウ内の位置に基づいて自動決定されます。 <code>NSSegmentStyleAutomatic</code> に対応します。</li>\n<li><code>rounded</code> - コントロールは丸みのあるスタイルで表示されます。 <code>NSSegmentStyleRounded</code> に対応します。</li>\n<li><code>textured-rounded</code> - コントロールは、テクスチャ付きの丸みのあるスタイルで表示されます。 <code>NSSegmentStyleTexturedRounded</code> に対応します。</li>\n<li><code>round-rect</code> - コントロールは丸角のスタイルで表示されます。 Maps to <code>NSSegmentStyleRoundRect</code>.</li>\n<li><code>textured-rounded</code> - コントロールは、テクスチャ付きの丸角のスタイルで表示されます。 <code>NSSegmentStyleTexturedSquare</code> に対応します。</li>\n<li><code>capsule</code> - コントロールはカプセル状のスタイルで表示されます。 <code>NSSegmentStyleCapsule</code> に対応します。</li>\n<li><code>small-square</code> - コントロールは小さな正方形のスタイルで表示されます。 <code>NSSegmentStyleSmallSquare</code> に対応します。</li>\n<li><code>separated</code> - コントロール内のセグメントは、互いに非常に近く表示されますが、接触しません。 <code>NSSegmentStyleSeparated</code> に対応します。</li>\n</ul></li>\n<li><code>mode</code> String (任意) - コントロールの選択モード。<ul>\n<li><code>single</code> - 既定値。 一度に 1 つアイテムを選択し、どれかを選択すると、前に選択したアイテムの選択が解除されます。 <code>NSSegmentSwitchTrackingSelectOne</code> に対応します。</li>\n<li><code>multiple</code> - 一度に複数のアイテムを選択できます。 <code>NSSegmentSwitchTrackingSelectAny</code> に対応します。</li>\n<li><code>buttons</code> - セグメントをボタンとして動作させ、各セグメントを押して離すことができますが、アクティブとしてマークされることはありません。 <code>NSSegmentSwitchTrackingMomentary</code> に対応します。</li>\n</ul></li>\n<li><code>segments</code> <a href=\"/docs/api/structures/segmented-control-segment\">SegmentedControlSegment[]</a> - このコントロールに配置するセグメントの配列。</li>\n<li><code>selectedIndex</code> Integer (任意) - ユーザの操作によって自動的に更新される、現在選択されているセグメントのインデックス。 <code>multiple</code> モードでは、これは最後に選択したアイテムになります。</li>\n<li><code>change</code> Function (任意) - ユーザが新しいセグメントを選択したときに呼ばれます。<ul>\n<li><code>selectedIndex</code> Integer - ユーザが選択したセグメントのインデックス。</li>\n<li><code>isSelected</code> Boolean - ユーザの選択結果として、セグメントが選択されたかどうか。</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<p><code>TouchBarSegmentedControl</code> のインスタンスには以下のプロパティがあります。</p>\n<h4 id=\"touchbarsegmentedcontrolsegmentstyle\"><a href=\"#touchbarsegmentedcontrolsegmentstyle\"><code>touchBarSegmentedControl.segmentStyle</code></a></h4>\n<p>コントロールの現在のセグメントスタイルを表す <code>String</code>。 この値を更新すると、タッチバー内のコントロールがすぐに更新されます。</p>\n<h4 id=\"touchbarsegmentedcontrolsegments\"><a href=\"#touchbarsegmentedcontrolsegments\"><code>touchBarSegmentedControl.segments</code></a></h4>\n<p>このコントロールのセグメントを表す <code>SegmentedControlSegment[]</code> 配列。 この値を更新すると、タッチバーのコントロールがすぐに更新されます。 この配列の要素の中のプロパティを更新しても <strong>タッチバーは更新されません</strong>。</p>\n<h4 id=\"touchbarsegmentedcontrolselectedindex\"><a href=\"#touchbarsegmentedcontrolselectedindex\"><code>touchBarSegmentedControl.selectedIndex</code></a></h4>\n<p>現在選択されているセグメントを表す <code>Integer</code>。 この値を変更すると、タッチバーのコントロールがすぐに更新されます。 ユーザがタッチバーに接触すると、この値が自動的に更新されます。</p>\n<h4 id=\"touchbarsegmentedcontrolmode\"><a href=\"#touchbarsegmentedcontrolmode\"><code>touchBarSegmentedControl.mode</code></a></h4>\n<p>コントロールの、現在の選択モードを表す <code>String</code>です。  <code>single</code>、<code>multiple</code>、<code>buttons</code> のいずれかにできます。</p>",
      "title": "クラス: TouchBarSegmentedControl",
      "description": "1つのボタンが選択状態になっているセグメントコントロール (ボタングループ) を作成します"
    },
    "/docs/api/touch-bar-slider": {
      "locale": "ja-JP",
      "slug": "touch-bar-slider",
      "href": "/docs/api/touch-bar-slider",
      "crowdinFileId": "256391",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-slider.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-touchbarslider\"><a href=\"#クラス-touchbarslider\">クラス: TouchBarSlider</a></h2>\n<blockquote>\n<p>ネイティブ macOS アプリケーション用のタッチバー内にスライダーを作成する</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<h3 id=\"new-touchbarslideroptions\"><a href=\"#new-touchbarslideroptions\"><code>new TouchBarSlider(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>label</code> String (任意) - ラベルのテキスト。</li>\n<li><code>value</code> Integer (任意) - 選択されている値。</li>\n<li><code>minValue</code> Integer (任意) - 最小値。</li>\n<li><code>maxValue</code> Integer (任意) - 最大値。</li>\n<li><code>change</code> Function (任意) - スライダーが変更されたときに呼ぶ関数。<ul>\n<li><code>newValue</code> Number - Slider 上でユーザが選択した値。</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<p><code>TouchBarSlider</code> のインスタンスには以下のプロパティがあります。</p>\n<h4 id=\"touchbarsliderlabel\"><a href=\"#touchbarsliderlabel\"><code>touchBarSlider.label</code></a></h4>\n<p>スライダーの現在のテキストを表す <code>String</code>。 この値を変更すると、タッチバー内のスライダーのコントロールがすぐに更新されます。</p>\n<h4 id=\"touchbarslidervalue\"><a href=\"#touchbarslidervalue\"><code>touchBarSlider.value</code></a></h4>\n<p>スライダーの現在の値を表す <code>Number</code>。 この値を変更すると、タッチバー内のスライダーのコントロールがすぐに更新されます。</p>\n<h4 id=\"touchbarsliderminvalue\"><a href=\"#touchbarsliderminvalue\"><code>touchBarSlider.minValue</code></a></h4>\n<p>スライダーの現在の最小値を表す <code>Number</code>。 この値を変更すると、タッチバー内のスライダーのコントロールがすぐに更新されます。</p>\n<h4 id=\"touchbarslidermaxvalue\"><a href=\"#touchbarslidermaxvalue\"><code>touchBarSlider.maxValue</code></a></h4>\n<p>スライダーの現在の最大値を表す <code>Number</code>。 この値を変更すると、タッチバー内のスライダーのコントロールがすぐに更新されます。</p>",
      "title": "クラス: TouchBarSlider",
      "description": "ネイティブ macOS アプリケーション用のタッチバー内にスライダーを作成する"
    },
    "/docs/api/touch-bar-spacer": {
      "locale": "ja-JP",
      "slug": "touch-bar-spacer",
      "href": "/docs/api/touch-bar-spacer",
      "crowdinFileId": "256393",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-spacer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-touchbarspacer\"><a href=\"#クラス-touchbarspacer\">クラス: TouchBarSpacer</a></h2>\n<blockquote>\n<p>ネイティブ macOS アプリケーション用のタッチバー内に2つのアイテム間のスペーサーを作成する</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<h3 id=\"new-touchbarspaceroptions\"><a href=\"#new-touchbarspaceroptions\"><code>new TouchBarSpacer(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>size</code> String (任意) - スペーサのサイズ。設定可能な値:<ul>\n<li><code>small</code> - アイテム間の小さいスペース。 <code>NSTouchBarItemIdentifierFixedSpaceSmall</code> に対応します。 これが既定値です。</li>\n<li><code>large</code> - アイテム間の大きいスペース。 <code>NSTouchBarItemIdentifierFixedSpaceLarge</code> に対応します。</li>\n<li><code>flexible</code> - 利用可能なスペース全てを埋める。 <code>NSTouchBarItemIdentifierFlexibleSpace</code> に対応します。</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<p><code>TouchBarSpacer</code> のインスタンスには以下のプロパティがあります。</p>\n<h4 id=\"touchbarspacersize\"><a href=\"#touchbarspacersize\"><code>touchBarSpacer.size</code></a></h4>\n<p>このススペーサーのサイズを表す <code>String</code>。  <code>small</code>、<code>large</code>、<code>flexible</code> のいずれかにできます。</p>",
      "title": "クラス: TouchBarSpacer",
      "description": "ネイティブ macOS アプリケーション用のタッチバー内に2つのアイテム間のスペーサーを作成する"
    },
    "/docs/api/structures/trace-categories-and-options": {
      "locale": "ja-JP",
      "slug": "trace-categories-and-options",
      "href": "/docs/api/structures/trace-categories-and-options",
      "crowdinFileId": "256517",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/trace-categories-and-options.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"tracecategoriesandoptions-object\"><a href=\"#tracecategoriesandoptions-object\">TraceCategoriesAndOptions Object</a></h1>\n<ul>\n<li><code>categoryFilter</code> String - A filter to control what category groups should be traced. A filter can have an optional '-' prefix to exclude category groups that contain a matching category. Having both included and excluded category patterns in the same list is not supported. Examples: <code>test_MyTest*</code>, <code>test_MyTest*,test_OtherStuff</code>, <code>-excluded_category1,-excluded_category2</code>.</li>\n<li><code>traceOptions</code> String - Controls what kind of tracing is enabled, it is a comma-delimited sequence of the following strings: <code>record-until-full</code>, <code>record-continuously</code>, <code>trace-to-console</code>, <code>enable-sampling</code>, <code>enable-systrace</code>, e.g. <code>'record-until-full,enable-sampling'</code>. The first 3 options are trace recording modes and hence mutually exclusive. If more than one trace recording modes appear in the <code>traceOptions</code> string, the last one takes precedence. If none of the trace recording modes are specified, recording mode is <code>record-until-full</code>. The trace option will first be reset to the default option (<code>record_mode</code> set to <code>record-until-full</code>, <code>enable_sampling</code> and <code>enable_systrace</code> set to <code>false</code>) before options parsed from <code>traceOptions</code> are applied on it.</li>\n</ul>",
      "title": "TraceCategoriesAndOptions Object",
      "description": ""
    },
    "/docs/api/structures/trace-config": {
      "locale": "ja-JP",
      "slug": "trace-config",
      "href": "/docs/api/structures/trace-config",
      "crowdinFileId": "256519",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/trace-config.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"traceconfig-object\"><a href=\"#traceconfig-object\">TraceConfig Object</a></h1>\n<ul>\n<li><code>recording_mode</code> String (optional) - Can be <code>record-until-full</code>, <code>record-continuously</code>, <code>record-as-much-as-possible</code> or <code>trace-to-console</code>. Defaults to <code>record-until-full</code>.</li>\n<li><code>trace_buffer_size_in_kb</code> number (optional) - maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.</li>\n<li><code>trace_buffer_size_in_events</code> number (optional) - maximum size of the trace recording buffer in events.</li>\n<li><code>enable_argument_filter</code> boolean (optional) - if true, filter event data according to a specific list of events that have been manually vetted to not include any PII. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/services/tracing/public/cpp/trace_event_args_whitelist.cc\">the implementation in Chromium</a> for specifics.</li>\n<li><code>included_categories</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of tracing categories to include. Can include glob-like patterns using <code>*</code> at the end of the category name. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">tracing categories</a> for the list of categories.</li>\n<li><code>excluded_categories</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of tracing categories to exclude. Can include glob-like patterns using <code>*</code> at the end of the category name. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">tracing categories</a> for the list of categories.</li>\n<li><code>included_process_ids</code> number<a href=\"/docs/api/structures/optional\"></a> - a list of process IDs to include in the trace. If not specified, trace all processes.</li>\n<li><code>histogram_names</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of <a href=\"https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md\">histogram</a> names to report with the trace.</li>\n<li><code>memory_dump_config</code> Record&#x3C;String, any> (optional) - if the <code>disabled-by-default-memory-infra</code> category is enabled, this contains optional additional configuration for data collection. See the <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/memory-infra/memory_infra_startup_tracing.md#the-advanced-way\">Chromium memory-infra docs</a> for more information.</li>\n</ul>\n<p>An example TraceConfig that roughly matches what Chrome DevTools records:</p>\n<pre><code class=\"hljs language-js\">{\n  <span class=\"hljs-attr\">recording_mode</span>: <span class=\"hljs-string\">'record-until-full'</span>,\n  <span class=\"hljs-attr\">included_categories</span>: [\n    <span class=\"hljs-string\">'devtools.timeline'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline.frame'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline.stack'</span>,\n    <span class=\"hljs-string\">'v8.execute'</span>,\n    <span class=\"hljs-string\">'blink.console'</span>,\n    <span class=\"hljs-string\">'blink.user_timing'</span>,\n    <span class=\"hljs-string\">'latencyInfo'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-v8.cpu_profiler'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-v8.cpu_profiler.hires'</span>\n  ],\n  <span class=\"hljs-attr\">excluded_categories</span>: [<span class=\"hljs-string\">'*'</span>]\n}\n</code></pre>",
      "title": "TraceConfig Object",
      "description": ""
    },
    "/docs/api/structures/transaction": {
      "locale": "ja-JP",
      "slug": "transaction",
      "href": "/docs/api/structures/transaction",
      "crowdinFileId": "256521",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/transaction.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"transaction-object\"><a href=\"#transaction-object\">Transaction Object</a></h1>\n<ul>\n<li><code>transactionIdentifier</code> String - A string that uniquely identifies a successful payment transaction.</li>\n<li><code>transactionDate</code> String - The date the transaction was added to the App Store’s payment queue.</li>\n<li><code>originalTransactionIdentifier</code> String - The identifier of the restored transaction by the App Store.</li>\n<li><code>transactionState</code> String - The transaction state, can be <code>purchasing</code>, <code>purchased</code>, <code>failed</code>, <code>restored</code> or <code>deferred</code>.</li>\n<li><code>errorCode</code> Integer - The error code if an error occurred while processing the transaction.</li>\n<li><code>errorMessage</code> String - The error message if an error occurred while processing the transaction.</li>\n<li><code>payment</code> Object<ul>\n<li><code>productIdentifier</code> String - The identifier of the purchased product.</li>\n<li><code>quantity</code> Integer  - The quantity purchased.</li>\n</ul></li>\n</ul>",
      "title": "Transaction Object",
      "description": ""
    },
    "/docs/api/tray": {
      "locale": "ja-JP",
      "slug": "tray",
      "href": "/docs/api/tray",
      "crowdinFileId": "256397",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/tray.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"tray\"><a href=\"#tray\">Tray</a></h1>\n<h2 id=\"クラス-tray\"><a href=\"#クラス-tray\">クラス: Tray</a></h2>\n<blockquote>\n<p>システムの通知領域にアイコンやコンテキスト メニューを追加します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>Tray</code> は <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a> です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> tray = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/my/icon'</span>)\n  <span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item3'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item4'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n  ])\n  tray.setToolTip(<span class=\"hljs-string\">'This is my application.'</span>)\n  tray.setContextMenu(contextMenu)\n})\n</code></pre>\n<p><strong>プラットフォームによる制限:</strong></p>\n<ul>\n<li>Linux では、アプリインジゲータがサポートされている場合はそれが使用され、それ以外では <code>GtkStatusIcon</code> が代わりに使用されます。</li>\n<li>アプリインジゲータのみがある Linux ディストリビューションでは、tray アイコンを動かすために <code>libappindicator1</code> をインストールする必要があります。</li>\n<li>アプリインジゲータはコンテキストメニューがあるときのみ表示されます。</li>\n<li>Linux でアプリインジゲータが使用されるとき、<code>click</code> イベントは無視されます。</li>\n<li>Linux では、個々の <code>MenuItem</code> に加えられた変更を有効にするには、<code>setContextMenu</code> を再び呼ぶ必要があります。 以下がその例です。</li>\n</ul>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> appIcon = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/my/icon'</span>)\n  <span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n  ])\n\n  <span class=\"hljs-comment\">// コンテキストメニューを変更する</span>\n  contextMenu.items[<span class=\"hljs-number\">1</span>].checked = <span class=\"hljs-literal\">false</span>\n\n  <span class=\"hljs-comment\">// Linux ではコンテキストメニューを変更したのでこれを呼び出し直します</span>\n  appIcon.setContextMenu(contextMenu)\n})\n</code></pre>\n<ul>\n<li>Windows では、最適な視覚効果を得るために <code>ICO</code> 形式のアイコンファイルを使用することが推奨されています。</li>\n</ul>\n<p>すべてのプラットフォームでまったく同じ動作を維持したい場合は、<code>click</code> イベントに頼らず、tray アイコンに常にコンテキストメニューを適用して下さい。</p>\n<h3 id=\"new-trayimage-guid\"><a href=\"#new-trayimage-guid\"><code>new Tray(image, [guid])</code></a></h3>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n<li><code>guid</code> String (optional) <em>Windows</em> - tray アイコンに割り当てる GUID。 実行形式が署名されていて署名の主体者が組織である場合は、GUID がその署名に恒久的に関連付けられます。 システム tray の tray アイコンの位置など OS レベルの設定は、実行ファイルのパスが変わっても維持されます。 実行形式がコード署名されていない場合は、GUID が実行形式のパスへ永続的に関連付けられます。 実行形式のパスを変更すると、tray アイコンの作成は破棄され、新しい GUID を使用する必要があります。 ただし、この GUID 引数はコード署名された実行形式のみと組み合わせて使用することを強く推奨します。 アプリが複数の tray アイコンを定義している場合は、それぞれのアイコンで別々の GUID を使用する必要があります。</li>\n</ul>\n<p><code>image</code> に関連する新しい tray アイコンを作成します。</p>\n<h3 id=\"インスタンスイベント\"><a href=\"#インスタンスイベント\">インスタンスイベント</a></h3>\n<p><code>tray</code> モジュールには以下のイベントがあります。</p>\n<h4 id=\"イベント-click\"><a href=\"#イベント-click\">イベント: 'click'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - tray アイコンの境界。</li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - イベントの位置。</li>\n</ul>\n<p>tray アイコンがクリックされたときに発行されます。</p>\n<h4 id=\"イベント-right-click-macos-windows\"><a href=\"#イベント-right-click-macos-windows\">イベント: 'right-click' <em>macOS</em> <em>Windows</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - tray アイコンの境界。</li>\n</ul>\n<p>tray アイコンが右クリックされたときに発行されます。</p>\n<h4 id=\"イベント-double-click-macos-windows\"><a href=\"#イベント-double-click-macos-windows\">イベント: 'double-click' <em>macOS</em> <em>Windows</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - tray アイコンの境界。</li>\n</ul>\n<p>tray アイコンがダブルクリックされたときに発行されます。</p>\n<h4 id=\"イベント-balloon-show-windows\"><a href=\"#イベント-balloon-show-windows\">イベント: 'balloon-show' <em>Windows</em></a></h4>\n<p>tray バルーンを表示するときに発行されます。</p>\n<h4 id=\"イベント-balloon-click-windows\"><a href=\"#イベント-balloon-click-windows\">イベント: 'balloon-click' <em>Windows</em></a></h4>\n<p>tray バルーンがクリックされたときに発行されます。</p>\n<h4 id=\"イベント-balloon-closed-windows\"><a href=\"#イベント-balloon-closed-windows\">イベント: 'balloon-closed' <em>Windows</em></a></h4>\n<p>tray バルーンが、タイムアウトかユーザの手動で、閉じられたときに発行されます。</p>\n<h4 id=\"イベント-drop-macos\"><a href=\"#イベント-drop-macos\">イベント: 'drop' <em>macOS</em></a></h4>\n<p>tray アイコン上に何かのドラッグされたアイテムがドロップされたときに発行されます。</p>\n<h4 id=\"イベント-drop-files-macos\"><a href=\"#イベント-drop-files-macos\">イベント: 'drop-files' <em>macOS</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>files</code> String[] - ドロップされたファイルのパス。</li>\n</ul>\n<p>tray アイコン上にドラッグされたファイルがドロップされたときに発行されます。</p>\n<h4 id=\"イベント-drop-text-macos\"><a href=\"#イベント-drop-text-macos\">イベント: 'drop-text' <em>macOS</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>text</code> String - ドロップされたテキスト文字列。</li>\n</ul>\n<p>tray アイコン上にドラッグされたテキストがドロップされたときに発行されます。</p>\n<h4 id=\"イベント-drag-enter-macos\"><a href=\"#イベント-drag-enter-macos\">イベント: 'drag-enter' <em>macOS</em></a></h4>\n<p>ドラッグ操作が tray アイコン内に入ったときに発行されます。</p>\n<h4 id=\"イベント-drag-leave-macos\"><a href=\"#イベント-drag-leave-macos\">イベント: 'drag-leave' <em>macOS</em></a></h4>\n<p>ドラッグ操作が tray アイコン内から出たときに発行されます。</p>\n<h4 id=\"イベント-drag-end-macos\"><a href=\"#イベント-drag-end-macos\">イベント: 'drag-end' <em>macOS</em></a></h4>\n<p>ドラッグ操作が、tray 上か他の場所で終了したときに発行されます。</p>\n<h4 id=\"イベント-mouse-up-macos\"><a href=\"#イベント-mouse-up-macos\">イベント: 'mouse-up' <em>macOS</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - イベントの位置。</li>\n</ul>\n<p>tray アイコンをクリックしてマウスを離したときに発生します。</p>\n<p>注意: macOS レベルの制約によるもので、<code>tray.setContextMenu</code> を使って tray にコンテキストメニューを設定するとこれは発生しません。</p>\n<h4 id=\"イベント-mouse-down-macos\"><a href=\"#イベント-mouse-down-macos\">イベント: 'mouse-down' <em>macOS</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - イベントの位置。</li>\n</ul>\n<p>tray アイコンをマウスクリックしたときに発生します。</p>\n<h4 id=\"イベント-mouse-enter-macos\"><a href=\"#イベント-mouse-enter-macos\">イベント: 'mouse-enter' <em>macOS</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - イベントの位置。</li>\n</ul>\n<p>マウスが tray アイコン内に入ったときに発行されます。</p>\n<h4 id=\"イベント-mouse-leave-macos\"><a href=\"#イベント-mouse-leave-macos\">イベント: 'mouse-leave' <em>macOS</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - イベントの位置。</li>\n</ul>\n<p>マウスが tray アイコン内から出たときに発行されます。</p>\n<h4 id=\"イベント-mouse-move-macos-windows\"><a href=\"#イベント-mouse-move-macos-windows\">イベント: 'mouse-move' <em>macOS</em> <em>Windows</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - イベントの位置。</li>\n</ul>\n<p>マウスが tray アイコン内で動いたときに発行されます。</p>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<p><code>Tray</code> クラスは以下のメソッドを持ちます。</p>\n<h4 id=\"traydestroy\"><a href=\"#traydestroy\"><code>tray.destroy()</code></a></h4>\n<p>tray アイコンを即座に削除します。</p>\n<h4 id=\"traysetimageimage\"><a href=\"#traysetimageimage\"><code>tray.setImage(image)</code></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>この tray アイコンに関連付けられた <code>image</code> を設定します。</p>\n<h4 id=\"traysetpressedimageimage-macos\"><a href=\"#traysetpressedimageimage-macos\"><code>tray.setPressedImage(image)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>macOS において、この tray アイコンが押されたときの関連付けられた <code>image</code> を設定します。</p>\n<h4 id=\"traysettooltiptooltip\"><a href=\"#traysettooltiptooltip\"><code>tray.setToolTip(toolTip)</code></a></h4>\n<ul>\n<li><code>toolTip</code> String</li>\n</ul>\n<p>この tray アイコンのホバーテキストを設定します。</p>\n<h4 id=\"traysettitletitle-options-macos\"><a href=\"#traysettitletitle-options-macos\"><code>tray.setTitle(title[, options])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>title</code> String</li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>fontType</code> String (任意) - 表示するフォントファミリのバリアント。 <code>monospaced</code> または <code>monospacedDigit</code> のどちらかです。 <code>monospaced</code> は macOS 10.15またはそれ以上で利用でき、 <code>monospacedDigit</code> は macOS 10.11またはそれ以上で利用できます。  空白の場合、タイトルにはデフォルトのシステムフォントを使用します。</li>\n</ul></li>\n</ul>\n<p>ステータスバー内の tray アイコンの隣に表示されるタイトル (ANSI カラーサポート) を設定します。</p>\n<h4 id=\"traygettitle-macos\"><a href=\"#traygettitle-macos\"><code>tray.getTitle()</code> <em>macOS</em></a></h4>\n<p>戻り値 <code>String</code> - ステータスバーの tray アイコンの隣に表示されるタイトル</p>\n<h4 id=\"traysetignoredoubleclickeventsignore-macos\"><a href=\"#traysetignoredoubleclickeventsignore-macos\"><code>tray.setIgnoreDoubleClickEvents(ignore)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n</ul>\n<p>ダブルクリックイベントを無視するオプションを設定します。 これらのイベントを無視することで tray アイコンそれぞれの独立したクリックを検知することを許可します。</p>\n<p>この値はデフォルトで false にセットされます。</p>\n<h4 id=\"traygetignoredoubleclickevents-macos\"><a href=\"#traygetignoredoubleclickevents-macos\"><code>tray.getIgnoreDoubleClickEvents()</code> <em>macOS</em></a></h4>\n<p>戻り値 <code>Boolean</code> - ダブルクリックイベントが無視されているかどうか。</p>\n<h4 id=\"traydisplayballoonoptions-windows\"><a href=\"#traydisplayballoonoptions-windows\"><code>tray.displayBalloon(options)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (任意) - <code>iconType</code> が <code>custom</code> のときに使うアイコン。</li>\n<li><code>iconType</code> String (任意) - <code>none</code>、<code>info</code>、<code>warning</code>、<code>error</code>、<code>custom</code> のいずれかにできます。 省略値は <code>custom</code> です。</li>\n<li><code>title</code> String</li>\n<li><code>content</code> String</li>\n<li><code>largeIcon</code> Boolean (任意) - 大きなバージョンのアイコン。できればこちらを使用します。 省略値は <code>true</code> です。 <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_large_icon-0x00000020\"><code>NIIF_LARGE_ICON</code></a> に対応します。</li>\n<li><code>noSound</code> Boolean (任意) - 関連付けられたサウンドを再生しないようにします。 省略値は <code>false</code> です。 <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_nosound-0x00000010\"><code>NIIF_NOSOUND</code></a> に対応します。</li>\n<li><code>respectQuietTime</code> Boolean (任意) - ユーザが現在 \"おやすみモード\" の場合、バルーン通知を表示しないようにします。 省略値は <code>false</code> です。 <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_respect_quiet_time-0x00000080\"><code>NIIF_RESPECT_QUIET_TIME</code></a> に対応します。</li>\n</ul></li>\n</ul>\n<p>tray のバルーンを表示します。</p>\n<h4 id=\"trayremoveballoon-windows\"><a href=\"#trayremoveballoon-windows\"><code>tray.removeBalloon()</code> <em>Windows</em></a></h4>\n<p>tray のバルーンを除去します。</p>\n<h4 id=\"trayfocus-windows\"><a href=\"#trayfocus-windows\"><code>tray.focus()</code> <em>Windows</em></a></h4>\n<p>タスクバーの通知領域にフォーカスを戻します。 通知領域アイコンは、UI 操作が完了したときにこのメッセージを使う必要があります。 たとえば、アイコンがショートカットメニューを表示しているけれど、ユーザーが ESC を押してキャンセルする場合、<code>tray.focus()</code> を使用して通知領域にフォーカスを戻します。</p>\n<h4 id=\"traypopupcontextmenumenu-position-macos-windows\"><a href=\"#traypopupcontextmenumenu-position-macos-windows\"><code>tray.popUpContextMenu([menu, position])</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>menu</code> Menu (任意)</li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> (任意) - ポップアップ位置。</li>\n</ul>\n<p>tray アイコンのコンテキストメニューをポップアップ表示します。 <code>menu</code> が渡されると、tray アイコンのコンテキストメニューの代わりに <code>menu</code> を表示します。</p>\n<p><code>position</code> は Windows でのみ有効で、省略値は (0, 0) です。</p>\n<h4 id=\"trayclosecontextmenu-macos-windows\"><a href=\"#trayclosecontextmenu-macos-windows\"><code>tray.closeContextMenu()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p><code>tray.setContextMenu()</code> でセットすることで、開かれたコンテキストメニューを閉じます。</p>\n<h4 id=\"traysetcontextmenumenu\"><a href=\"#traysetcontextmenumenu\"><code>tray.setContextMenu(menu)</code></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>このアイコンのコンテキストメニューを設定します。</p>\n<h4 id=\"traygetbounds-macos-windows\"><a href=\"#traygetbounds-macos-windows\"><code>tray.getBounds()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>戻り値 <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p><code>Object</code> としてのこの tray アイコンの <code>bounds</code>。</p>\n<h4 id=\"trayisdestroyed\"><a href=\"#trayisdestroyed\"><code>tray.isDestroyed()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - tray アイコンが破棄されたかどうか。</p>",
      "title": "Tray",
      "description": "システムの通知領域にアイコンやコンテキスト メニューを追加します。"
    },
    "/docs/tutorial/tray": {
      "locale": "ja-JP",
      "slug": "tray",
      "href": "/docs/tutorial/tray",
      "crowdinFileId": "256259",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/tray.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<hr>\n<p>title: Tray\ndescription: このガイドでは、システムの通知エリアにそれ独自のコンテキストメニューがある Tray アイコンを作成する手順を一緒に見ていきます。\nslug: tray</p>\n<h2 id=\"hide_title-true\"><a href=\"#hide_title-true\">hide_title: true</a></h2>\n<h1 id=\"tray\"><a href=\"#tray\">Tray</a></h1>\n<h2 id=\"概要\"><a href=\"#概要\">概要</a></h2>\n<!-- ✍ Update this section if you want to provide more details -->\n<p>このガイドでは、システムの通知エリアにそれ独自のコンテキストメニューがある <a href=\"https://www.electronjs.org/docs/api/tray\">Tray</a> アイコンを作成する手順を一緒に見ていきます。</p>\n<p>MacOS および Ubuntu では、Tray は画面の右上に位置し、バッテリーや Wi-Fi のアイコンと隣接します。 Windows の Tray は通常、右下に位置します。</p>\n<h2 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h2>\n<h3 id=\"mainjs\"><a href=\"#mainjs\">main.js</a></h3>\n<p>まず <code>electron</code> から <code>app</code>、<code>Tray</code>、<code>Menu</code>、<code>nativeImage</code> をインポートしなければなりません。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, Tray, Menu, nativeImage } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>次に Tray を作成します。 このために、<a href=\"https://www.electronjs.org/docs/api/native-image\"><code>NativeImage</code></a> アイコンを使用することにします。これはいずれかの <a href=\"https://www.electronjs.org/docs/api/native-image#methods\">メソッド</a> で作成できます。 Tray の作成コードを <a href=\"https://www.electronjs.org/docs/api/app#appwhenready\"><code>app.whenReady</code></a> で囲んでいるのは、Electron アプリの初期化完了を待つ必要があるからです。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">let</span> tray\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> icon = nativeImage.createFromPath(<span class=\"hljs-string\">'path/to/asset.png'</span>)\n  tray = <span class=\"hljs-keyword\">new</span> Tray(icon)\n\n  <span class=\"hljs-comment\">// 注釈: contextMenu、Tooltip、Title のコードはこちらで!</span>\n})\n</code></pre>\n<p>これでうまくいきました。 それでは以下のように Tray へコンテキストメニューを付けていきます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item3'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item4'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n])\n\ntray.setContextMenu(contextMenu)\n</code></pre>\n<p>上記のコードは、コンテキストメニューに 4 つで別々のラジオタイプのアイテムを作成します。 ネイティブメニューの構築についてご覧になりたい方は、<a href=\"https://www.electronjs.org/docs/api/menu#menubuildfromtemplatetemplate\">こちら</a> をクリックしてください。</p>\n<p>最後に、Tray にツールチップとタイトルを入れましょう。</p>\n<pre><code class=\"hljs language-js\">tray.setToolTip(<span class=\"hljs-string\">'This is my application'</span>)\ntray.setTitle(<span class=\"hljs-string\">'This is my title'</span>)\n</code></pre>\n<h2 id=\"おわりに\"><a href=\"#おわりに\">おわりに</a></h2>\n<p>Electron アプリを起動すると、オペレーティングシステムに応じて、画面の右上や右下に Tray が表示されます。\n<code>fiddle docs/fiddles/native-ui/tray</code></p>",
      "title": "Tray",
      "description": ""
    },
    "/docs/tutorial/updates": {
      "locale": "ja-JP",
      "slug": "updates",
      "href": "/docs/tutorial/updates",
      "crowdinFileId": "256261",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/updates.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"アプリケーションの更新\"><a href=\"#アプリケーションの更新\">アプリケーションの更新</a></h1>\n<p>Electron アプリケーションを更新する方法はいくつかあります。 最も簡単で、公式にサポートされているものは、組み込みの <a href=\"https://github.com/Squirrel\">Squirrel</a> フレームワークと Electron の <a href=\"/docs/api/auto-updater\">autoUpdater</a> モジュールの利用です。</p>\n<h2 id=\"updateelectronjsorgの使用\"><a href=\"#updateelectronjsorgの使用\"><code>update.electronjs.org</code>の使用</a></h2>\n<p>Electron チームは <a href=\"https://github.com/electron/update.electronjs.org\">update.electronjs.org</a> をメンテナンスしています。これは、Electron を自己更新するためのオープンソースウェブサービスです。 このサービスは次の条件を満すElectronアプリ用に設計されています。</p>\n<ul>\n<li>macOSまたはWindowsで動作するアプリである。</li>\n<li>アプリはGitHubのパブリックなリポジトリである。</li>\n<li>ビルド成果物は、GitHub Releases で提供する。</li>\n<li>ビルド成果物はコード署名されています。</li>\n</ul>\n<p>このサービスを使う最も簡単な方法は<a href=\"https://github.com/electron/update-electron-app\">update-electron-app</a>をインストールすることで、update.electronjs.orgをつかって、事前調整されたNode.js モジュールを使う方法です。</p>\n<p>モジュールのインストール</p>\n<pre><code class=\"hljs language-sh\">npm install update-electron-app\n</code></pre>\n<p>あなたのmain processファイルからこのupdaterを起動します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'update-electron-app'</span>)()\n</code></pre>\n<p>デフォルト設定で、このモジュールはアプリの起動時に更新をチェックします。または10分毎にチェックします。 アップデートがみつかったとき、自動的にバックグラウンドでダウンロードします。 そのダウンロードが完了したとき、ダイアログを表示してユーザーにアプリの再起動許可を取ります。</p>\n<p>設定をカスタマイズしたい場合、<a href=\"https://github.com/electron/update-electron-app\"><code>update-electron-app</code>にオプションを渡す</a>か、または<a href=\"https://github.com/electron/update.electronjs.org\">アップデートサービスを直接使用</a>ができます。</p>\n<h2 id=\"アップロードサーバーを配備\"><a href=\"#アップロードサーバーを配備\">アップロードサーバーを配備</a></h2>\n<p>プライベートの Electron アプリケーションを開発している場合、または GitHub リリースにリリースを公開していない場合は、独自のアップデートサーバーを実行する必要があるかもしれません。</p>\n<p>ニーズに応じて、次のいずれかから選択できます。</p>\n<ul>\n<li><a href=\"https://github.com/vercel/hazel\">Hazel</a> – <a href=\"https://vercel.com\">Vercel</a> 上に無料デプロイできる、非公開またはオープンソースのアプリのための更新サーバーです。 それは <a href=\"https://help.github.com/articles/creating-releases/\">GitHub Releases</a> から引き出され、GitHub の CDN の力を活用します。</li>\n<li><a href=\"https://github.com/GitbookIO/nuts\">Nuts</a> – <a href=\"https://help.github.com/articles/creating-releases/\">GitHub Releases</a> も使用しますが、アプリの更新をディスクにキャッシュし、プライベートリポジトリをサポートします。</li>\n<li><a href=\"https://github.com/ArekSredzki/electron-release-server\">electron-release-server</a> – リリースを処理するためのダッシュボードを提供します。リリースを GitHub で作成する必要はありません。</li>\n<li><a href=\"https://github.com/atlassian/nucleus\">Nucleus</a> – Atlassian がメンテナンスしている Electron アプリのための完全なアップデートサーバー。 複数のアプリケーションとチャンネルをサポートします。サーバーのコストを最小限に抑えるために静的ファイルストアを使用します。</li>\n</ul>\n<h2 id=\"アプリケーションでの更新の実装\"><a href=\"#アプリケーションでの更新の実装\">アプリケーションでの更新の実装</a></h2>\n<p>アップデートサーバをデプロイしたら、コードに必要なモジュールをインポートします。 次のコードはサーバソフトウェアによって異なる場合がありますが、<a href=\"https://github.com/vercel/hazel\">Hazel</a> を使用したときの説明のように機能します。</p>\n<p><strong>重要:</strong> 以下のコードは、開発中ではなく、パッケージ化されたアプリでのみ実行されるようにしてください。 <a href=\"https://github.com/sindresorhus/electron-is-dev\">electron-is-dev</a> を使って環境をチェックすることができます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, autoUpdater, dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>次に、アップデートサーバーの URL を作成し、それについて <a href=\"/docs/api/auto-updater\">autoUpdater</a> に伝えます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> server = <span class=\"hljs-string\">'https://your-deployment-url.com'</span>\n<span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-string\">`<span class=\"hljs-subst\">${server}</span>/update/<span class=\"hljs-subst\">${process.platform}</span>/<span class=\"hljs-subst\">${app.getVersion()}</span>`</span>\n\nautoUpdater.setFeedURL({ url })\n</code></pre>\n<p>最後のステップとして、更新を確認します。 以下の例では、毎分確認します。</p>\n<pre><code class=\"hljs language-javascript\">setInterval(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  autoUpdater.checkForUpdates()\n}, <span class=\"hljs-number\">60000</span>)\n</code></pre>\n<p>アプリケーションが<a href=\"/docs/tutorial/application-distribution\">パッケージ化される</a>と、公開した新しい <a href=\"https://help.github.com/articles/creating-releases/\">GitHub Release</a> ごとにアップデートが届きます。</p>\n<h2 id=\"アップデートの適用\"><a href=\"#アップデートの適用\">アップデートの適用</a></h2>\n<p>アプリケーションの基本的な更新メカニズムを設定したので、更新があるとユーザに通知されるようにする必要があります。 これは autoUpdater API <a href=\"/docs/api/auto-updater#events\">events</a> を使用して実現できます。</p>\n<pre><code class=\"hljs language-javascript\">autoUpdater.on(<span class=\"hljs-string\">'update-downloaded'</span>, (event, releaseNotes, releaseName) => {\n  <span class=\"hljs-keyword\">const</span> dialogOpts = {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'info'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Restart'</span>, <span class=\"hljs-string\">'Later'</span>],\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Application Update'</span>,\n    <span class=\"hljs-attr\">message</span>: process.platform === <span class=\"hljs-string\">'win32'</span> ? releaseNotes : releaseName,\n    <span class=\"hljs-attr\">detail</span>: <span class=\"hljs-string\">'A new version has been downloaded. Restart the application to apply the updates.'</span>\n  }\n\n  dialog.showMessageBox(dialogOpts).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">returnValue</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (returnValue.response === <span class=\"hljs-number\">0</span>) autoUpdater.quitAndInstall()\n  })\n})\n</code></pre>\n<p>エラーが <a href=\"/docs/api/auto-updater#event-error\">ハンドリングされている</a> ことも確認してください。 これは <code>stderr</code> にログを出力するための例です。</p>\n<pre><code class=\"hljs language-javascript\">autoUpdater.on(<span class=\"hljs-string\">'error'</span>, message => {\n  <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'There was a problem updating the application'</span>)\n  <span class=\"hljs-built_in\">console</span>.error(message)\n})\n</code></pre>\n<h2 id=\"更新を手動でハンドリング\"><a href=\"#更新を手動でハンドリング\">更新を手動でハンドリング</a></h2>\n<p>自動更新によるリクエストは直接管理されていないため、対応が難しい状況が発生することがあります (更新サーバーが認証下にある場合など)。 <code>url</code> フィールドはファイルをサポートしていますので、工夫次第でサーバーとの通信を回避できます。 <a href=\"https://github.com/electron/electron/issues/5020#issuecomment-477636990\">こちらにその動作例があります</a>。</p>",
      "title": "アプリケーションの更新",
      "description": ""
    },
    "/docs/api/structures/upload-data": {
      "locale": "ja-JP",
      "slug": "upload-data",
      "href": "/docs/api/structures/upload-data",
      "crowdinFileId": "256523",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploaddata-object\"><a href=\"#uploaddata-object\">UploadData Object</a></h1>\n<ul>\n<li><code>bytes</code> Buffer - Content being sent.</li>\n<li><code>file</code> String (optional) - Path of file being uploaded.</li>\n<li><code>blobUUID</code> String (optional) - UUID of blob data. Use <a href=\"/docs/api/session#sesgetblobdataidentifier\">ses.getBlobData</a> method to retrieve the data.</li>\n</ul>",
      "title": "UploadData Object",
      "description": ""
    },
    "/docs/api/structures/upload-file": {
      "locale": "ja-JP",
      "slug": "upload-file",
      "href": "/docs/api/structures/upload-file",
      "crowdinFileId": "256525",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-file.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploadfile-object\"><a href=\"#uploadfile-object\">UploadFile Object</a></h1>\n<ul>\n<li><code>type</code> 'file' - <code>file</code>.</li>\n<li><code>filePath</code> String - Path of file to be uploaded.</li>\n<li><code>offset</code> Integer - Defaults to <code>0</code>.</li>\n<li><code>length</code> Integer - Number of bytes to read from <code>offset</code>. Defaults to <code>0</code>.</li>\n<li><code>modificationTime</code> Double - Last Modification time in number of seconds since the UNIX epoch.</li>\n</ul>",
      "title": "UploadFile Object",
      "description": ""
    },
    "/docs/api/structures/upload-raw-data": {
      "locale": "ja-JP",
      "slug": "upload-raw-data",
      "href": "/docs/api/structures/upload-raw-data",
      "crowdinFileId": "256527",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-raw-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploadrawdata-object\"><a href=\"#uploadrawdata-object\">UploadRawData Object</a></h1>\n<ul>\n<li><code>type</code> 'rawData' - <code>rawData</code>.</li>\n<li><code>bytes</code> Buffer - Data to be uploaded.</li>\n</ul>",
      "title": "UploadRawData Object",
      "description": ""
    },
    "/docs/api/structures/user-default-types": {
      "locale": "ja-JP",
      "slug": "user-default-types",
      "href": "/docs/api/structures/user-default-types",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/user-default-types.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"userdefaulttypes-オブジェクト\"><a href=\"#userdefaulttypes-オブジェクト\">UserDefaultTypes オブジェクト</a></h1>\n<ul>\n<li><code>string</code> String</li>\n<li><code>boolean</code> Boolean</li>\n<li><code>integer</code> Number</li>\n<li><code>float</code> Number</li>\n<li><code>double</code> Number</li>\n<li><code>url</code> String</li>\n<li><code>array</code> Array\\<unknown></unknown></li>\n<li><code>dictionary</code> Record\\&#x3C;string, unknown></li>\n</ul>\n<p>この型はヘルパーエイリアスであり、この型のオブジェクトが存在することはありません。</p>",
      "title": "UserDefaultTypes オブジェクト",
      "description": ""
    },
    "/docs/tutorial/using-native-node-modules": {
      "locale": "ja-JP",
      "slug": "using-native-node-modules",
      "href": "/docs/tutorial/using-native-node-modules",
      "crowdinFileId": "256263",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-native-node-modules.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ネイティブ-node-モジュール\"><a href=\"#ネイティブ-node-モジュール\">ネイティブ Node モジュール</a></h1>\n<p>Electron ではネイティブ Node.js モジュールがサポートされていますが、Electron は (OpenSSL ではなく Chromium の BoringSSL を使用するなどの違いにより) 指定の Node.js バイナリと異なる <a href=\"https://en.wikipedia.org/wiki/Application_binary_interface\">アプリケーションバイナリインターフェイス (ABI)</a> であるため、使用するネイティブモジュールを Electron 向けに再コンパイルする必要があります。 そうしなければ、以下の類のエラーが実行しようとしたときに発生します。</p>\n<pre><code class=\"hljs language-sh\">Error: The module <span class=\"hljs-string\">'/path/to/native/module.node'</span>\nwas compiled against a different Node.js version using\nNODE_MODULE_VERSION <span class=\"hljs-variable\">$XYZ</span>. This version of Node.js requires\nNODE_MODULE_VERSION <span class=\"hljs-variable\">$ABC</span>. Please try re-compiling or re-installing\nthe module (<span class=\"hljs-keyword\">for</span> instance, using `npm rebuild` or `npm install`).\n</code></pre>\n<h2 id=\"ネイティブモジュールのインストール方法\"><a href=\"#ネイティブモジュールのインストール方法\">ネイティブモジュールのインストール方法</a></h2>\n<p>ネイティブモジュールをインストールするにはいくつかの異なる方法があります。</p>\n<h3 id=\"モジュールをインストールして-electron-をリビルド\"><a href=\"#モジュールをインストールして-electron-をリビルド\">モジュールをインストールして Electron をリビルド</a></h3>\n<p>他の Node プロジェクト同様にモジュールをインストールしてから、<a href=\"https://github.com/electron/electron-rebuild\"><code>electron-rebuild</code></a> パッケージで Electron 向けにモジュールを再ビルドします。 このモジュールは自動で Electron のバージョンを取得でき、ヘッダのダウンロードやアプリ向けにネイティブモジュールを再ビルドする手動の手順を処理できます。 <a href=\"https://electronforge.io/\">Electron Forge</a> を使用している場合、このツールは開発モードでも頒布物の作成でも自動で使用されます。</p>\n<p>例えば、スタンドアローンの <code>electron-rebuild</code> ツールをインストールして、コマンドラインからモジュールを再ビルドするには、以下のようにします。</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron-rebuild\n\n<span class=\"hljs-comment\"># \"npm install\" を実行するごとに、こちらを実行します。</span>\n./node_modules/.bin/electron-rebuild\n\n<span class=\"hljs-comment\"># Windows で問題が発生する場合はこちらをお試しください。</span>\n.\\node_modules\\.bin\\electron-rebuild.cmd\n</code></pre>\n<p><a href=\"https://github.com/electron/electron-packager\">Electron Packager</a> のような他ツールとの統合や使い方の詳細は、当該プロジェクトの README を参照してください。</p>\n<h3 id=\"npm-を使用\"><a href=\"#npm-を使用\"><code>npm</code> を使用</a></h3>\n<p>いくつかの環境変数を設定することにより、モジュールを直接インストールするのに <code>npm</code> を使用できます。</p>\n<p>例として、以下のように Electron 向けにすべての依存関係をインストールします。</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-comment\"># Electronのバージョン</span>\n<span class=\"hljs-built_in\">export</span> npm_config_target=1.2.3\n<span class=\"hljs-comment\"># Electron のアーキテクチャ。サポートされているアーキテクチャについては、 https://electronjs.org/docs/tutorial/support#supported-platforms</span>\n<span class=\"hljs-comment\"># を参照してください。</span>\n<span class=\"hljs-built_in\">export</span> npm_config_arch=x64\n<span class=\"hljs-built_in\">export</span> npm_config_target_arch=x64\n<span class=\"hljs-comment\"># Electronのヘッダファイルをダウンロード</span>\n<span class=\"hljs-built_in\">export</span> npm_config_disturl=https://electronjs.org/headers\n<span class=\"hljs-comment\"># node-pre-gyp にElectronのビルドであることを知らせる</span>\n<span class=\"hljs-built_in\">export</span> npm_config_runtime=electron\n<span class=\"hljs-comment\"># node-pre-gypにソースコードからのビルドであることを知らせる</span>\n<span class=\"hljs-built_in\">export</span> npm_config_build_from_source=<span class=\"hljs-literal\">true</span>\n<span class=\"hljs-comment\"># すべての依存をインストールし、キャッシュを~/.electron-gypに保存する</span>\nHOME=~/.electron-gyp npm install\n</code></pre>\n<h3 id=\"electron-の手動ビルド\"><a href=\"#electron-の手動ビルド\">Electron の手動ビルド</a></h3>\n<p>もしあなたがネイティブモジュールの開発者でElectronでの動作を検証したいのであれば、Electron用にモジュールを手動で再構築したいことと思います。 <code>node-gyp</code>を使用することで、モジュールをElectron用にビルドできます。</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">cd</span> /path-to-module/\nHOME=~/.electron-gyp node-gyp rebuild --target=1.2.3 --arch=x64 --dist-url=https://electronjs.org/headers\n</code></pre>\n<ul>\n<li><code>HOME=~/.electron-gyp</code> は開発用のヘッダーを探す場所によって変わります。</li>\n<li><code>--target=1.2.3</code> は Electron のバージョンです。</li>\n<li><code>--dist-url=...</code> はヘッダをダウンロードする場所を指定します。</li>\n<li><code>--arch=x64</code> はモジュールを 64bit システム向けにビルドします。</li>\n</ul>\n<h3 id=\"electron-のカスタムビルドを手動ビルド\"><a href=\"#electron-のカスタムビルドを手動ビルド\">Electron のカスタムビルドを手動ビルド</a></h3>\n<p>公開されているリリースと一致しない Electron のカスタムビルドに対してネイティブの Node モジュールをコンパイルするには、カスタムビルドにバンドルされている Node のバージョンを使用するように <code>npm</code> に指示します。</p>\n<pre><code class=\"hljs language-sh\">npm rebuild --nodedir=/path/to/src/out/Default/gen/node_headers\n</code></pre>\n<h2 id=\"トラブルシューティング\"><a href=\"#トラブルシューティング\">トラブルシューティング</a></h2>\n<p>もしネイティブモジュールがインストールされていてもうまく動いていないと気づいた場合は、下記のことを確認してみてください。</p>\n<ul>\n<li>何かおかしいと思ったら、まず <code>electron-rebuild</code> を実行しましょう。</li>\n<li>ネイティブモジュールが Electron アプリのターゲットプラットフォームおよびアーキテクチャと互換性があることを確認してください。</li>\n<li>モジュールの <code>binding.gyp</code> 内の <code>win_delay_load_hook</code> が <code>false</code> にセットされていないことを確認してください。</li>\n<li>Electron のアップグレード後は、モジュールの再ビルドが必要になります。</li>\n</ul>\n<h3 id=\"win_delay_load_hook-についての注釈\"><a href=\"#win_delay_load_hook-についての注釈\"><code>win_delay_load_hook</code> についての注釈</a></h3>\n<p>Windows のデフォルトでは、<code>node-gyp</code> は <code>node.dll</code> に対してネイティブモジュールをリンクします。 しかし Electron 4.x 以降では、ネイティブモジュールで必要とされるシンボルは <code>electron.exe</code> によってエクスポートされ、<code>node.dll</code> は存在しません。 Windows にネイティブモジュールをロードするために、<code>node-gyp</code> はネイティブモジュールがロードされたときにトリガーされる <a href=\"https://msdn.microsoft.com/en-us/library/z9h1h6ty.aspx\">delay-load-hook</a> をインストールします。これはライブラリの (何も出てこない) 検索パスで <code>node.dll</code> を探す代わりに、ロード可能な実行可能ファイルを使用するように <code>node.dll</code> 参照をリダイレクトします。 そのため、Electron 4.x 以降でネイティブモジュールをロードするには <code>'win_delay_load_hook': 'true'</code> が必要です。</p>\n<p><code>モジュールが自己登録されなかった</code> や <code>指定されたプロシージャが見つかりませんでした</code> のようなエラーが得られた場合は、使用しようとしているモジュールが見つからないことを意味しているかもしれません。遅延読み込みフックを正しくインクルードしてください。  モジュールが node-gyp でビルドされている場合、<code>binding.gyp</code> ファイルで <code>win_delay_load_hook</code> 変数が <code>true</code> に設定されておらず、どこかで上書きされていないことを確認します。  モジュールが別のシステムでビルドされている場合は、メインの <code>.node</code> ファイルにインストールされている遅延読み込みフックを使用してビルドする必要があります。 <code>link.exe</code> の呼び出しは以下ようにしなければなりません。</p>\n<pre><code class=\"hljs language-plaintext\"> link.exe /OUT:\"foo.node\" \"...\\node.lib\" delayimp.lib /DELAYLOAD:node.exe /DLL\n     \"my_addon.obj\" \"win_delay_load_hook.obj\"\n</code></pre>\n<p>特に、次のことが重要です。</p>\n<ul>\n<li>Node ではなく <em>Electron</em> の <code>node.lib</code> に対してリンクします。 間違った <code>node.lib</code> に対してリンクすると、Electron のモジュールが必要になったときにロード時エラーが発生します。</li>\n<li><code>/DELAYLOAD:node.exe</code> フラグをインクルードします。 <code>node.exe</code> のリンクが遅延されていない場合、遅延読み込みフックが起動する機会がなく、Node のシンボルは正しく解決されません。</li>\n<li><code>win_delay_load_hook.obj</code> は、最終的な DLL に直接リンクされます。 依存 DLL にフックが設定されていると、正しいタイミングで起動しません。</li>\n</ul>\n<p>遅延ロードフックを独自で実装する例については <a href=\"https://github.com/nodejs/node-gyp/blob/e2401e1395bef1d3c8acec268b42dc5fb71c4a38/src/win_delay_load_hook.cc\"><code>node-gyp</code></a> を参照してください。</p>\n<h2 id=\"prebuildを使用したモジュール\"><a href=\"#prebuildを使用したモジュール\"><code>prebuild</code>を使用したモジュール</a></h2>\n<p><a href=\"https://github.com/prebuild/prebuild\"><code>prebuild</code></a> は、ネイティブの Node モジュールを複数の Node と Electron のバージョン向けに、ビルド済みバイナリとともに公開する方法を提供します。</p>\n<p><code>prebuild</code> を搭載したモジュールが Electron 向けのバイナリを提供している場合、ビルド済みバイナリを最大限に活用するために <code>--build-from-source</code> と <code>npm_config_build_from_source</code> 環境変数は省略してください。</p>\n<h2 id=\"node-pre-gypを使用したモジュール\"><a href=\"#node-pre-gypを使用したモジュール\"><code>node-pre-gyp</code>を使用したモジュール</a></h2>\n<p><a href=\"https://github.com/mapbox/node-pre-gyp\"><code>node-pre-gyp</code></a>は、ビルド済みのバイナリを含んだネイティブNodeモジュールを展開する方法を提供します。多くの人気のモジュールがこのツールを使用しています。</p>\n<p>これらのモジュールが Electron でも正常に動作することはありますが、Electron 固有のバイナリがない場合はソースからビルドする必要があります。 このため、これらのモジュールには <code>electron-rebuild</code> の使用を推奨します。</p>\n<p><code>npm</code> でモジュールをインストールする場合は、<code>--build-from-source</code> を <code>npm</code> に渡すか <code>npm_config_build_from_source</code> 環境変数を設定する必要があります。</p>",
      "title": "ネイティブ Node モジュール",
      "description": ""
    },
    "/docs/tutorial/using-pepper-flash-plugin": {
      "locale": "ja-JP",
      "slug": "using-pepper-flash-plugin",
      "href": "/docs/tutorial/using-pepper-flash-plugin",
      "crowdinFileId": "256265",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-pepper-flash-plugin.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"pepper-flash-プラグイン\"><a href=\"#pepper-flash-プラグイン\">Pepper Flash プラグイン</a></h1>\n<p>Chrome がサポートを終了したため、Electron は Pepper Flash プラグインをサポートしていません。</p>\n<p>詳細は <a href=\"https://www.chromium.org/flash-roadmap\">Chromium の Flash ロードマップ</a> を参照してください。</p>",
      "title": "Pepper Flash プラグイン",
      "description": ""
    },
    "/docs/tutorial/using-selenium-and-webdriver": {
      "locale": "ja-JP",
      "slug": "using-selenium-and-webdriver",
      "href": "/docs/tutorial/using-selenium-and-webdriver",
      "crowdinFileId": "256267",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-selenium-and-webdriver.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"selenium-と-webdriver\"><a href=\"#selenium-と-webdriver\">Selenium と WebDriver</a></h1>\n<p><a href=\"https://sites.google.com/a/chromium.org/chromedriver/\">ChromeDriver - クローム向けのWebDriver</a>:</p>\n<blockquote>\n<p>WebDriverは、ブラウザを横断的なテストの自動化を実現するためのオープンソースツールです。 このドライバはウェブページの遷移、インプット項目への入力、JavaScriptの実行などの機能を提供します。 ChromeDriverはChromium向けWebDriverのワイヤープロトコルを実装した、スタンドアローンサーバです。 このドライバは、ChromiumとWebDriverチームによって開発されています。</p>\n</blockquote>\n<h2 id=\"spectronを設定する\"><a href=\"#spectronを設定する\">Spectronを設定する</a></h2>\n<p><a href=\"https://electronjs.org/spectron\">Spectron</a>はオフィシャルにサポートされているElectron向けChromeDriverテストフレームワークです。 これは<a href=\"https://webdriver.io/\">WebdriverIO</a>上に構築されており、テストプログラム内でElectron APIにアクセスする為のヘルパーとChromeDriverを内包しています。</p>\n<pre><code class=\"hljs language-sh\">$ npm install --save-dev spectron\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// A simple test to verify a visible window is opened with a title</span>\n<span class=\"hljs-keyword\">const</span> Application = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spectron'</span>).Application\n<span class=\"hljs-keyword\">const</span> assert = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'assert'</span>)\n\n<span class=\"hljs-keyword\">const</span> myApp = <span class=\"hljs-keyword\">new</span> Application({\n  <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'/Applications/MyApp.app/Contents/MacOS/MyApp'</span>\n})\n\n<span class=\"hljs-keyword\">const</span> verifyWindowIsVisibleWithTitle = <span class=\"hljs-keyword\">async</span> (app) => {\n  <span class=\"hljs-keyword\">await</span> app.start()\n  <span class=\"hljs-keyword\">try</span> {\n    <span class=\"hljs-comment\">// Check if the window is visible</span>\n    <span class=\"hljs-keyword\">const</span> isVisible = <span class=\"hljs-keyword\">await</span> app.browserWindow.isVisible()\n    <span class=\"hljs-comment\">// Verify the window is visible</span>\n    assert.strictEqual(isVisible, <span class=\"hljs-literal\">true</span>)\n    <span class=\"hljs-comment\">// Get the window's title</span>\n    <span class=\"hljs-keyword\">const</span> title = <span class=\"hljs-keyword\">await</span> app.client.getTitle()\n    <span class=\"hljs-comment\">// Verify the window's title</span>\n    assert.strictEqual(title, <span class=\"hljs-string\">'My App'</span>)\n  } <span class=\"hljs-keyword\">catch</span> (error) {\n    <span class=\"hljs-comment\">// Log any failures</span>\n    <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Test failed'</span>, error.message)\n  }\n  <span class=\"hljs-comment\">// Stop the application</span>\n  <span class=\"hljs-keyword\">await</span> app.stop()\n}\n\nverifyWindowIsVisibleWithTitle(myApp)\n</code></pre>\n<h2 id=\"webdriverjs-の設定\"><a href=\"#webdriverjs-の設定\">WebDriverJs の設定</a></h2>\n<p><a href=\"https://www.selenium.dev/selenium/docs/api/javascript/index.html\">WebDriverJs</a> は、Web Driver でテストするための Node パッケージを提供します。ここでは例として使用します。</p>\n<h3 id=\"1-chromedriver-の開始\"><a href=\"#1-chromedriver-の開始\">1. ChromeDriver の開始</a></h3>\n<p>最初に、<code>chromedriver</code> バイナリをダウンロードして実行する必要があります。</p>\n<pre><code class=\"hljs language-sh\">$ npm install electron-chromedriver\n$ ./node_modules/.bin/chromedriver\nStarting ChromeDriver (v2.10.291558) on port 9515\nOnly <span class=\"hljs-built_in\">local</span> connections are allowed.\n</code></pre>\n<p>後で使用されるポート番号 <code>9515</code> を覚えておいてください。</p>\n<h3 id=\"2-webdriverjs-のインストール\"><a href=\"#2-webdriverjs-のインストール\">2. WebDriverJS のインストール</a></h3>\n<pre><code class=\"hljs language-sh\">$ npm install selenium-webdriver\n</code></pre>\n<h3 id=\"3-chromedriver-へ接続\"><a href=\"#3-chromedriver-へ接続\">3. ChromeDriver へ接続</a></h3>\n<p>Electron での <code>selenium-webdriver</code> の使用方法は、手動で chrome driver の接続方法と Electron のバイナリの検索場所を指定する必要があることを除いて、upstream と同じです。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webdriver = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'selenium-webdriver'</span>)\n\n<span class=\"hljs-keyword\">const</span> driver = <span class=\"hljs-keyword\">new</span> webdriver.Builder()\n  <span class=\"hljs-comment\">// The \"9515\" is the port opened by chrome driver.</span>\n  .usingServer(<span class=\"hljs-string\">'http://localhost:9515'</span>)\n  .withCapabilities({\n    <span class=\"hljs-string\">'goog:chromeOptions'</span>: {\n      <span class=\"hljs-comment\">// ここに Electron バイナリへのパスを入れます。</span>\n      <span class=\"hljs-attr\">binary</span>: <span class=\"hljs-string\">'/Path-to-Your-App.app/Contents/MacOS/Electron'</span>\n    }\n  })\n  .forBrowser(<span class=\"hljs-string\">'chrome'</span>) <span class=\"hljs-comment\">// 注: selenium-webdriver &#x3C;= 3.6.0 では .forBrowser('electron') を使用します</span>\n  .build()\n\ndriver.get(<span class=\"hljs-string\">'http://www.google.com'</span>)\ndriver.findElement(webdriver.By.name(<span class=\"hljs-string\">'q'</span>)).sendKeys(<span class=\"hljs-string\">'webdriver'</span>)\ndriver.findElement(webdriver.By.name(<span class=\"hljs-string\">'btnG'</span>)).click()\ndriver.wait(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">return</span> driver.getTitle().then(<span class=\"hljs-function\">(<span class=\"hljs-params\">title</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> title === <span class=\"hljs-string\">'webdriver - Google Search'</span>\n  })\n}, <span class=\"hljs-number\">1000</span>)\n\ndriver.quit()\n</code></pre>\n<h2 id=\"webdriverio-で設定する\"><a href=\"#webdriverio-で設定する\">WebdriverIO で設定する</a></h2>\n<p><a href=\"https://webdriver.io/\">WebdriverIO</a> は、Web Driver でテストするための Node パッケージを提供します。</p>\n<h3 id=\"1-chromedriver-の開始-1\"><a href=\"#1-chromedriver-の開始-1\">1. ChromeDriver の開始</a></h3>\n<p>最初に、<code>chromedriver</code> バイナリをダウンロードして実行する必要があります。</p>\n<pre><code class=\"hljs language-sh\">$ npm install electron-chromedriver\n$ ./node_modules/.bin/chromedriver --url-base=wd/hub --port=9515\nStarting ChromeDriver (v2.10.291558) on port 9515\nOnly <span class=\"hljs-built_in\">local</span> connections are allowed.\n</code></pre>\n<p>後で使用されるポート番号 <code>9515</code> を覚えておいてください。</p>\n<h3 id=\"2-webdriverio-のインストール\"><a href=\"#2-webdriverio-のインストール\">2. WebdriverIO のインストール</a></h3>\n<pre><code class=\"hljs language-sh\">$ npm install webdriverio\n</code></pre>\n<h3 id=\"3-chromedriver-へ接続-1\"><a href=\"#3-chromedriver-へ接続-1\">3. ChromeDriver へ接続</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webdriverio = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'webdriverio'</span>)\n<span class=\"hljs-keyword\">const</span> options = {\n  <span class=\"hljs-attr\">host</span>: <span class=\"hljs-string\">'localhost'</span>, <span class=\"hljs-comment\">// Use localhost as chrome driver server</span>\n  <span class=\"hljs-attr\">port</span>: <span class=\"hljs-number\">9515</span>, <span class=\"hljs-comment\">// \"9515\" is the port opened by chrome driver.</span>\n  <span class=\"hljs-attr\">desiredCapabilities</span>: {\n    <span class=\"hljs-attr\">browserName</span>: <span class=\"hljs-string\">'chrome'</span>,\n    <span class=\"hljs-string\">'goog:chromeOptions'</span>: {\n      <span class=\"hljs-attr\">binary</span>: <span class=\"hljs-string\">'/Path-to-Your-App/electron'</span>, <span class=\"hljs-comment\">// Electron バイナリへのパス.</span>\n      <span class=\"hljs-attr\">args</span>: [<span class=\"hljs-comment\">/* Cliの引数 */</span>] <span class=\"hljs-comment\">// オプション、例えば 'app=' + /path/to/your/app/</span>\n    }\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> client = webdriverio.remote(options)\n\nclient\n  .init()\n  .url(<span class=\"hljs-string\">'http://google.com'</span>)\n  .setValue(<span class=\"hljs-string\">'#q'</span>, <span class=\"hljs-string\">'webdriverio'</span>)\n  .click(<span class=\"hljs-string\">'#btnG'</span>)\n  .getTitle().then(<span class=\"hljs-function\">(<span class=\"hljs-params\">title</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Title was: '</span> + title)\n  })\n  .end()\n</code></pre>\n<h2 id=\"ワークフロー\"><a href=\"#ワークフロー\">ワークフロー</a></h2>\n<p>Electron を再構築せずにアプリケーションをテストするには、アプリケーションソースを Electron のリソースディレクトリに<a href=\"/docs/tutorial/application-distribution\">配置します</a>。</p>\n<p>Electron バイナリに引数を渡すことでも、実行するアプリのフォルダを指定できます。 こうすれば、アプリを Electron のリソースディレクトリにコピーペーストする必要はありません。</p>",
      "title": "Selenium と WebDriver",
      "description": "WebDriverは、ブラウザを横断的なテストの自動化を実現するためのオープンソースツールです。 このドライバはウェブページの遷移、インプット項目への入力、JavaScriptの実行などの機能を提供します。 ChromeDriverはChromium向けWebDriverのワイヤープロトコルを実装した、スタンドアローンサーバです。 このドライバは、ChromiumとWebDriverチームによって開発されています。"
    },
    "/docs/development/v8-development": {
      "locale": "ja-JP",
      "slug": "v8-development",
      "href": "/docs/development/v8-development",
      "crowdinFileId": "256171",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/v8-development.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"v8-開発\"><a href=\"#v8-開発\">V8 開発</a></h1>\n<blockquote>\n<p>V8の学習や使用のためのリソースを収集しています。</p>\n</blockquote>\n<ul>\n<li><a href=\"https://v8.dev/docs/trace\">V8 トレース</a></li>\n<li><a href=\"https://v8.dev/docs/profile\">V8 プロファイラ</a> - プロファイルに便利なプロファイラの組合せ<code>--prof</code>, <code>--trace-ic</code>, <code>--trace-opt</code>, <code>--trace-deopt</code>, <code>--print-bytecode</code>, <code>--print-opt-code</code></li>\n<li><a href=\"https://docs.google.com/document/d/11T2CRex9hXxoJwbYqVQ32yIPMh0uouUZLdyrtmMoL44/edit?ts=56f27d9d#heading=h.6jz9dj3bnr8t\">V8 インタプリタ設計</a></li>\n<li><a href=\"https://v8.dev/docs/turbofan\">コンパイラ最適化</a></li>\n<li><a href=\"https://v8.dev/docs/gdb-jit\">V8 GDB デバッグ</a></li>\n</ul>\n<p><a href=\"/docs/development/chromium-development\">Chromium Development</a> も参照</p>",
      "title": "V8 開発",
      "description": "V8の学習や使用のためのリソースを収集しています。"
    },
    "/docs/api/web-contents": {
      "locale": "ja-JP",
      "slug": "web-contents",
      "href": "/docs/api/web-contents",
      "crowdinFileId": "256399",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-contents.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webcontents\"><a href=\"#webcontents\">webContents</a></h1>\n<blockquote>\n<p>ウェブページを描画、制御します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>webContents</code> は <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a> を継承しています。 <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> オブジェクトのプロパティには、ウェブページを描画し、制御する責任があります。 以下は、<code>webContents</code> オブジェクトにアクセスする例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> contents = win.webContents\n<span class=\"hljs-built_in\">console</span>.log(contents)\n</code></pre>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p>これらのメソッドは、<code>webContents</code> モジュールからアクセスできます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(webContents)\n</code></pre>\n<h3 id=\"webcontentsgetallwebcontents\"><a href=\"#webcontentsgetallwebcontents\"><code>webContents.getAllWebContents()</code></a></h3>\n<p>戻り値 <code>WebContents[]</code> - すべての <code>WebContents</code> インスタンスの配列。 これには、すべてのウインドウ、開かれた開発者向けツール、開発者向けツールのバックグラウンド拡張のページが含まれます。</p>\n<h3 id=\"webcontentsgetfocusedwebcontents\"><a href=\"#webcontentsgetfocusedwebcontents\"><code>webContents.getFocusedWebContents()</code></a></h3>\n<p>戻り値 <code>WebContents</code> - このアプリケーション内でフォーカス中の WebContents。無ければ <code>null</code>。</p>\n<h3 id=\"webcontentsfromidid\"><a href=\"#webcontentsfromidid\"><code>webContents.fromId(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>戻り値 <code>WebContents</code> | undefined - 指定 ID の WebContents インスタンス。指定 ID に関連付けられた WebContents が存在しない場合は <code>undefined</code> です。</p>\n<h3 id=\"webcontentsfromdevtoolstargetidtargetid\"><a href=\"#webcontentsfromdevtoolstargetidtargetid\"><code>webContents.fromDevToolsTargetId(targetId)</code></a></h3>\n<ul>\n<li><code>targetId</code> String - WebContents インスタンスに関連付けられた Chrome デベロッパー ツールプロトコルの <a href=\"https://chromedevtools.github.io/devtools-protocol/tot/Target/#type-TargetID\">TargetID</a>。</li>\n</ul>\n<p>戻り値 <code>WebContents</code> | undefined - 指定 TargetID の WebContents インスタンス。指定 TargetID に関連付けられた WebContents が存在しない場合は <code>undefined</code> です。</p>\n<p><a href=\"https://chromedevtools.github.io/devtools-protocol/\">Chrome デベロッパー ツールプロトコル</a> と通信する際に、割り当てられた TargetID で WebContents インスタンスを検索すると便利な場合があります。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">lookupTargetId</span> (<span class=\"hljs-params\">browserWindow</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> wc = browserWindow.webContents\n  <span class=\"hljs-keyword\">await</span> wc.debugger.attach(<span class=\"hljs-string\">'1.3'</span>)\n  <span class=\"hljs-keyword\">const</span> { targetInfo } = <span class=\"hljs-keyword\">await</span> wc.debugger.sendCommand(<span class=\"hljs-string\">'Target.getTargetInfo'</span>)\n  <span class=\"hljs-keyword\">const</span> { targetId } = targetInfo\n  <span class=\"hljs-keyword\">const</span> targetWebContents = <span class=\"hljs-keyword\">await</span> webContents.fromDevToolsTargetId(targetId)\n}\n</code></pre>\n<h2 id=\"クラス-webcontents\"><a href=\"#クラス-webcontents\">クラス: WebContents</a></h2>\n<blockquote>\n<p>BrowserWindow インスタンスのコンテンツを、描画し、制御します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<h3 id=\"インスタンスイベント\"><a href=\"#インスタンスイベント\">インスタンスイベント</a></h3>\n<h4 id=\"イベント-did-finish-load\"><a href=\"#イベント-did-finish-load\">イベント: 'did-finish-load'</a></h4>\n<p>ナビゲーションが終了した時、すなわち、タブのくるくるが止まったときや、<code>onload</code> イベントが送られた後に、発行されます。</p>\n<h4 id=\"イベント-did-fail-load\"><a href=\"#イベント-did-fail-load\">イベント: 'did-fail-load'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>このイベントは <code>did-finish-load</code> に似ていますが、ロードが失敗したときも発行されます。 エラーコードとその意味のすべてのリストは <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">こちら</a> です。</p>\n<h4 id=\"イベント-did-fail-provisional-load\"><a href=\"#イベント-did-fail-provisional-load\">イベント: 'did-fail-provisional-load'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>このイベントは <code>did-fail-load</code> に似ていますが、ロードがキャンセルされたときに発行されます (例えば <code>window.stop()</code> が呼び出されたときなど)。</p>\n<h4 id=\"イベント-did-frame-finish-load\"><a href=\"#イベント-did-frame-finish-load\">イベント: 'did-frame-finish-load'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>フレームのナビゲーションが終了したときに発行されます。</p>\n<h4 id=\"イベント-did-start-loading\"><a href=\"#イベント-did-start-loading\">イベント: 'did-start-loading'</a></h4>\n<p>タブのくるくるが始まったタイミングに対応しています。</p>\n<h4 id=\"イベント-did-stop-loading\"><a href=\"#イベント-did-stop-loading\">イベント: 'did-stop-loading'</a></h4>\n<p>タブのくるくるが止まったタイミングに対応しています。</p>\n<h4 id=\"イベント-dom-ready\"><a href=\"#イベント-dom-ready\">イベント: 'dom-ready'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>最上位フレームの document が読み込まれたときに発生します。</p>\n<h4 id=\"イベント-page-title-updated\"><a href=\"#イベント-page-title-updated\">イベント: 'page-title-updated'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>ナビゲーション中にページタイトルが設定されると発生します。 <code>explicitSet</code> は、タイトルがファイル URL から合成されている場合に false になります。</p>\n<h4 id=\"イベント-page-favicon-updated\"><a href=\"#イベント-page-favicon-updated\">イベント: 'page-favicon-updated'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>favicons</code> String[] - URLの配列。</li>\n</ul>\n<p>ページがファビコンの URL を受け取ると発行されます。</p>\n<h4 id=\"イベント-new-window-非推奨\"><a href=\"#イベント-new-window-非推奨\">イベント: 'new-window' <em>非推奨</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> NewWindowWebContentsEvent</li>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String</li>\n<li><code>disposition</code> String - <code>default</code>、<code>foreground-tab</code>、<code>background-tab</code>、<code>new-window</code>、<code>save-to-disk</code>、<code>other</code> にできる。</li>\n<li><code>options</code> BrowserWindowConstructorOptions - 新しい <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> を作成するのに使われるオプション。</li>\n<li><code>additionalFeatures</code> String[] - <code>window.open()</code> に与えられている、標準でない機能 (Chromium や Electron によって処理されない機能)。 非推奨であり、現在は必ず空の配列 <code>[]</code> になります。</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - 新しいウィンドウへ渡される Referrer。 Referrer のポリシーに依存しているので、<code>Referrer</code> ヘッダを送信されるようにしてもしなくてもかまいません。</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (任意) - 新しいウィンドウに送信する POST データと、それにセットする適切なヘッダ。 送信する POST データが無い場合、値は <code>null</code> になります。 これは <code>target=_blank</code> を設定したフォームによってウィンドウが作成されている場合にのみセットされます。</li>\n</ul>\n<p>これは <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a> に代わって非推奨となりました。</p>\n<p>ページが <code>url</code> のための新しいウィンドウを開く要求をすると発生します。 <code>window.open</code> か <code>&#x3C;a target='_blank'></code> のような外部リンクによるリクエストである可能性があります。</p>\n<p>デフォルトでは、<code>url</code> の新しい <code>BrowserWindow</code> が作成されます。</p>\n<p><code>event.preventDefault()</code> を呼ぶと、Electron が自動的に新しい <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> を作成するのを防ぎます。 もし <code>event.preventDefault()</code> を呼び、新しい <code>BrowserWindow</code> を手動で作る場合、新しい <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> インスタンスの参照を <a href=\"/docs/api/browser-window\"><code>event.newGuest</code></a> にセットしなければ、予期しない動作になる可能性があります。 以下がその例です。</p>\n<pre><code class=\"hljs language-javascript\">myBrowserWindow.webContents.on(<span class=\"hljs-string\">'new-window'</span>, (event, url, frameName, disposition, options, additionalFeatures, referrer, postBody) => {\n  event.preventDefault()\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webContents</span>: options.webContents, <span class=\"hljs-comment\">// あれば既存の webContents を使用する</span>\n    <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span>\n  })\n  win.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => win.show())\n  <span class=\"hljs-keyword\">if</span> (!options.webContents) {\n    <span class=\"hljs-keyword\">const</span> loadOptions = {\n      <span class=\"hljs-attr\">httpReferrer</span>: referrer\n    }\n    <span class=\"hljs-keyword\">if</span> (postBody != <span class=\"hljs-literal\">null</span>) {\n      <span class=\"hljs-keyword\">const</span> { data, contentType, boundary } = postBody\n      loadOptions.postData = postBody.data\n      loadOptions.extraHeaders = <span class=\"hljs-string\">`content-type: <span class=\"hljs-subst\">${contentType}</span>; boundary=<span class=\"hljs-subst\">${boundary}</span>`</span>\n    }\n\n    win.loadURL(url, loadOptions) <span class=\"hljs-comment\">// 自動で既存の webContents をナビゲーションする</span>\n  }\n  event.newGuest = win\n})\n</code></pre>\n<h4 id=\"イベント-did-create-window\"><a href=\"#イベント-did-create-window\">イベント: 'did-create-window'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>window</code> BrowserWindow</li>\n<li><code>details</code> Object<ul>\n<li><code>url</code> String - 作成したウインドウの URL。</li>\n<li><code>frameName</code> String - <code>window.open()</code> の呼び出しで作成したウインドウに指定した名前。</li>\n<li><code>options</code> BrowserWindowConstructorOptions - その BrowserWindow の作成に使用したオプション。 これらは、<code>window.open()</code> の <code>features</code> 文字列から解析されたオプション、親ウインドウから継承されたセキュリティ関連の webPreferences、<a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a> で与えられたオプションなどが優先度の高い順に結合されたものです。 認識できないオプションが取り除かれることはありません。</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - 新しいウィンドウへ渡される Referrer。 リファラのポリシーに応じた <code>Referer</code> ヘッダーが送信されるとは限りません。</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (任意) - 新しいウィンドウに送信される POST データと、設定される適切なヘッダです。 送信する POST データが無い場合、値は <code>null</code> になります。 これは <code>target=_blank</code> を設定したフォームによってウィンドウが作成されている場合にのみセットされます。</li>\n<li><code>disposition</code> String - <code>default</code>、<code>foreground-tab</code>、<code>background-tab</code>、<code>new-window</code>、<code>save-to-disk</code>、<code>other</code> にできます。</li>\n</ul></li>\n</ul>\n<p>レンダラーで <code>window.open</code> を使用したウィンドウの作成に成功した <em>後</em> に発生します。 <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a> からウインドウの作成がキャンセルされた場合には発生しません。</p>\n<p>詳細や <code>webContents.setWindowOpenHandler</code> と併せた使用方法については <a href=\"/docs/api/window-open\"><code>window.open()</code></a> をご参照ください。</p>\n<h4 id=\"イベント-will-navigate\"><a href=\"#イベント-will-navigate\">イベント: 'will-navigate'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n</ul>\n<p>ユーザーまたはページがナビゲーションを開始しようとしたときに発生します。 <code>window.location</code> オブジェクトが変更されるか、ユーザがページ内のリンクをクリックしたときに発生することがあります。</p>\n<p>このイベントは、 <code>webContents.loadURL</code> や <code>webContents.back</code> のような API によって、プログラム上から開始されるナビゲーションのときには発行されません。</p>\n<p>これは、アンカーリンクのクリックや <code>window.location.hash</code> の更新のような、ページ内ナビゲーションでも発行されません。 これを意図する場合は <code>did-navigate-in-page</code> を使用して下さい。</p>\n<p><code>event.preventDefault()</code> を呼ぶとナビゲーションが阻害されます。</p>\n<h4 id=\"イベント-did-start-navigation\"><a href=\"#イベント-did-start-navigation\">イベント: 'did-start-navigation'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>フレーム (メインを含む) がナビゲーションを始めているときに発生します。 ページ内ナビゲーションの場合、<code>isInPlace</code> が <code>true</code> になります。</p>\n<h4 id=\"イベント-will-redirect\"><a href=\"#イベント-will-redirect\">イベント: 'will-redirect'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>ナビゲーション中にサーバーサイドリダイレクトが発生すると発行されます。  302 リダイレクトなどがその例です。</p>\n<p>このイベントは常に、同一ナビゲーションで <code>did-start-navigation</code> の後かつ <code>did-redirect-navigation</code> イベントの前に発行されます。</p>\n<p><code>event.preventDefault()</code> を呼ぶとナビゲーション (リダイレクトではない) が阻害されます。</p>\n<h4 id=\"イベント-did-redirect-navigation\"><a href=\"#イベント-did-redirect-navigation\">イベント: 'did-redirect-navigation'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>ナビゲーション後にサーバーサイドリダイレクトが発生すると発行されます。  302 リダイレクトなどがその例です。</p>\n<p>このイベントを阻害することはできません。リダイレクトを防ぎたい場合は、上記の <code>will-redirect</code> イベントを確認してください。</p>\n<h4 id=\"イベント-did-navigate\"><a href=\"#イベント-did-navigate\">イベント: 'did-navigate'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - HTTP ナビゲーションが無い場合は-1</li>\n<li><code>httpStatusText</code> String - HTTP ナビゲーションが無い場合は空</li>\n</ul>\n<p>メインフレームのナビゲーションが完了したときに発生します。</p>\n<p>このイベントは、アンカーリンクのクリックや <code>window.location.hash</code> の更新のような、ページ内ナビゲーションでは発行されません。 これを意図する場合は <code>did-navigate-in-page</code> を使用して下さい。</p>\n<h4 id=\"イベント-did-frame-navigate\"><a href=\"#イベント-did-frame-navigate\">イベント: 'did-frame-navigate'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - HTTP ナビゲーションが無い場合は-1</li>\n<li><code>httpStatusText</code> String - HTTP ナビゲーションが無い場合は空。</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>フレームのナビゲーションが完了したときに発生します。</p>\n<p>このイベントは、アンカーリンクのクリックや <code>window.location.hash</code> の更新のような、ページ内ナビゲーションでは発行されません。 これを意図する場合は <code>did-navigate-in-page</code> を使用して下さい。</p>\n<h4 id=\"イベント-did-navigate-in-page\"><a href=\"#イベント-did-navigate-in-page\">イベント: 'did-navigate-in-page'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>フレームのページ内ナビゲーションが発生したときに発生します。</p>\n<p>ページ内ナビゲーションが行われるとき、ページのURLは変更されますがページ外でのナビゲーションは発生しません。 これが発生する例は、アンカーリンクがクリックされたときや、DOM の <code>hashchange</code> イベントがトリガーされたときです。</p>\n<h4 id=\"イベント-will-prevent-unload\"><a href=\"#イベント-will-prevent-unload\">イベント: 'will-prevent-unload'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p><code>beforeunload</code> イベントハンドラがページのアンロードをキャンセルしようとしたときに発行されます。</p>\n<p><code>event.preventDefault()</code> を呼ぶと、<code>beforeunload</code> イベントハンドラが無視され、 ページをアンロードできます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.webContents.on(<span class=\"hljs-string\">'will-prevent-unload'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> choice = dialog.showMessageBoxSync(win, {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'question'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Leave'</span>, <span class=\"hljs-string\">'Stay'</span>],\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Do you want to leave this site?'</span>,\n    <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'Changes you made may not be saved.'</span>,\n    <span class=\"hljs-attr\">defaultId</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">cancelId</span>: <span class=\"hljs-number\">1</span>\n  })\n  <span class=\"hljs-keyword\">const</span> leave = (choice === <span class=\"hljs-number\">0</span>)\n  <span class=\"hljs-keyword\">if</span> (leave) {\n    event.preventDefault()\n  }\n})\n</code></pre>\n<p><strong>注意:</strong> これは <code>BrowserView</code> に対して発生しますが、尊重 <em>されません</em>。これは、<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event\">仕様</a> にあるように、<code>BrowserView</code> のライフサイクルはそれを所有する BrowserWindow に結び付けないとしたためです。</p>\n<h4 id=\"イベント-crashed-非推奨\"><a href=\"#イベント-crashed-非推奨\">イベント: 'crashed' <em>非推奨</em></a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>レンダラープロセスがクラッシュしたり、強制終了されたりしたときに発行されます。</p>\n<p><strong>非推奨:</strong> このイベントは <code>render-process-gone</code> イベント によって引き継がれます。このイベントには、子プロセスが失われた理由についての詳細情報が含まれています。 これはクラッシュした場合に限りません。  移植する場合は、Boolean 型の <code>killed</code> だと <code>reason === 'killed'</code> をチェックするように置き換えればできます。</p>\n<h4 id=\"イベント-render-process-gone\"><a href=\"#イベント-render-process-gone\">イベント: 'render-process-gone'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>reason</code> String - レンダープロセスがなくなった理由。  取りうる値:<ul>\n<li><code>clean-exit</code> - 終了コードが0でプロセスが終了した</li>\n<li><code>abnormal-exit</code> - ゼロでない終了コードでプロセスを終了しました。</li>\n<li><code>killed</code> - プロセスへSIGTERMシグナルが送信されたか、その他の方法で殺されました。</li>\n<li><code>crashed</code> - プロセスがクラッシュした</li>\n<li><code>oom</code> - プロセスがメモリ不足になった</li>\n<li><code>launch-failed</code> - プロセスが正常に起動されなかった</li>\n<li><code>integrity-failure</code> - Windows コードの整合性チェックに失敗しました</li>\n</ul></li>\n<li><code>exitCode</code> Integer - プロセスの終了コードです。<code>reason</code> が <code>launch-failed</code> でなければ、<code>exitCode</code> はプラットフォーム固有の起動失敗のエラーコードになります。</li>\n</ul></li>\n</ul>\n<p>renderer processが予期せず消えたときに発生します。  プロセスがクラッシュした場合やまたは殺された場合、これは正常です。</p>\n<h4 id=\"イベント-unresponsive\"><a href=\"#イベント-unresponsive\">イベント: 'unresponsive'</a></h4>\n<p>Webページが応答しなくなるときに発生します。</p>\n<h4 id=\"イベント-responsive\"><a href=\"#イベント-responsive\">イベント: 'responsive'</a></h4>\n<p>応答しないWebページが再び応答するようになるときに発生します。</p>\n<h4 id=\"イベント-plugin-crashed\"><a href=\"#イベント-plugin-crashed\">イベント: 'plugin-crashed'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>\n<p>プラグインプロセスがクラッシュしたときに発行されます。</p>\n<h4 id=\"イベント-destroyed\"><a href=\"#イベント-destroyed\">イベント: 'destroyed'</a></h4>\n<p><code>webContents</code> が破棄されたときに発生します。</p>\n<h4 id=\"イベント-before-input-event\"><a href=\"#イベント-before-input-event\">イベント: 'before-input-event'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>input</code> Object - 入力プロパティ。<ul>\n<li><code>type</code> String - <code>keyUp</code> か <code>keyDown</code>。</li>\n<li><code>key</code> String - <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.key</a> と等価です。</li>\n<li><code>code</code> String - <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.code</a> と等価です。</li>\n<li><code>isAutoRepeat</code> Boolean - <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.repeat</a> と等価です。</li>\n<li><code>isComposing</code> Boolean - <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.isComposing</a> と等価です。</li>\n<li><code>shift</code> Boolean - <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.shiftKey</a> と等価です。</li>\n<li><code>control</code> Boolean - <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.controlKey</a> と等価です。</li>\n<li><code>alt</code> Boolean - <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.altKey</a> と等価です。</li>\n<li><code>meta</code> Boolean - <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.metaKey</a> と等価です。</li>\n<li><code>location</code> Number - <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.location</a> と同等。</li>\n<li><code>modifiers</code> String[] - <a href=\"/docs/api/structures/input-event\">InputEvent.modifiers</a> をご参照ください。</li>\n</ul></li>\n</ul>\n<p>ページ内の <code>keydown</code> と <code>keyup</code> イベントが発生する直前に発行されます。 <code>event.preventDefault</code> を呼ぶと、ページの <code>keydown</code>/<code>keyup</code> イベントとメニューショートカットを阻害します。</p>\n<p>メニューショートカットだけを阻害するには、以下のように <a href=\"#contentssetignoremenushortcutsignore\"><code>setIgnoreMenuShortcuts</code></a> を使用します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\nwin.webContents.on(<span class=\"hljs-string\">'before-input-event'</span>, (event, input) => {\n  <span class=\"hljs-comment\">// 例として、Ctrl/Cmd が押下されているときだけアプリケーションメニューの</span>\n  <span class=\"hljs-comment\">// キーボードショートカットを有効にしてみます。</span>\n  win.webContents.setIgnoreMenuShortcuts(!input.control &#x26;&#x26; !input.meta)\n})\n</code></pre>\n<h4 id=\"イベント-enter-html-full-screen\"><a href=\"#イベント-enter-html-full-screen\">イベント: 'enter-html-full-screen'</a></h4>\n<p>ウインドウがHTML APIによってフルスクリーン状態に入るときに発生します。</p>\n<h4 id=\"イベント-leave-html-full-screen\"><a href=\"#イベント-leave-html-full-screen\">イベント: 'leave-html-full-screen'</a></h4>\n<p>ウインドウがHTML APIによってフルスクリーン状態を抜けるときに発生します。</p>\n<h4 id=\"イベント-zoom-changed\"><a href=\"#イベント-zoom-changed\">イベント: 'zoom-changed'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>zoomDirection</code> String - <code>in</code> か <code>out</code> にできます。</li>\n</ul>\n<p>ユーザーがマウスホイールを使用してズームレベルの変更を要求しているときに生成されます。</p>\n<h4 id=\"イベント-devtools-opened\"><a href=\"#イベント-devtools-opened\">イベント: 'devtools-opened'</a></h4>\n<p>開発者向けツールが開かれたときに発行されます。</p>\n<h4 id=\"イベント-devtools-closed\"><a href=\"#イベント-devtools-closed\">イベント: 'devtools-closed'</a></h4>\n<p>開発者向けツールが閉じられたときに発行されます。</p>\n<h4 id=\"イベント-devtools-focused\"><a href=\"#イベント-devtools-focused\">イベント: 'devtools-focused'</a></h4>\n<p>開発者向けツールがフォーカスされた / 開かれたときに発行されます。</p>\n<h4 id=\"イベント-certificate-error\"><a href=\"#イベント-certificate-error\">イベント: 'certificate-error'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>error</code> String - エラーコード。</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>isTrusted</code> Boolean - 証明書が信頼できるとみなされるかどうかを示す。</li>\n</ul></li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p><code>url</code> の <code>certificate</code> の認証に失敗したときに発行されます。</p>\n<p>使い方は、<a href=\"/docs/api/app#event-certificate-error\"><code>app</code> の <code>certificate-error</code> イベント</a> と同じです。</p>\n<h4 id=\"イベント-select-client-certificate\"><a href=\"#イベント-select-client-certificate\">イベント: 'select-client-certificate'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> URL</li>\n<li><code>certificateList</code> <a href=\"/docs/api/structures/certificate\">Certificate[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> - 指定されたリストの証明書でなければならない。</li>\n</ul></li>\n</ul>\n<p>クライアント証明書が要求されたときに発生します。</p>\n<p>使い方は、<a href=\"/docs/api/app#event-select-client-certificate\"><code>app</code> の <code>select-client-certificate</code> イベント</a> と同じです。</p>\n<h4 id=\"イベント-login\"><a href=\"#イベント-login\">イベント: 'login'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>authenticationResponseDetails</code> Object<ul>\n<li><code>url</code> URL</li>\n</ul></li>\n<li><code>authInfo</code> Object<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (任意)</li>\n<li><code>password</code> String (任意)</li>\n</ul></li>\n</ul>\n<p><code>webContents</code> がBasic認証を要求すると発生します。</p>\n<p>使い方は、<a href=\"/docs/api/app#event-login\"><code>app</code> の <code>login</code> イベント</a> と同じです。</p>\n<h4 id=\"イベント-found-in-page\"><a href=\"#イベント-found-in-page\">イベント: 'found-in-page'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>result</code> Object<ul>\n<li><code>requestId</code> Integer</li>\n<li><code>activeMatchOrdinal</code> Integer - アクティブなマッチの位置。</li>\n<li><code>matches</code> Integer - マッチの個数。</li>\n<li><code>selectionArea</code> Rectangle - 最初に一致した領域の座標。</li>\n<li><code>finalUpdate</code> Boolean</li>\n</ul></li>\n</ul>\n<p>[<code>webContents.findINPage</code>] リクエストの結果が有効なときに発行されます。</p>\n<h4 id=\"イベント-media-started-playing\"><a href=\"#イベント-media-started-playing\">イベント: 'media-started-playing'</a></h4>\n<p>メディアの再生を開始するときに発行されます。</p>\n<h4 id=\"イベント-media-paused\"><a href=\"#イベント-media-paused\">イベント: 'media-paused'</a></h4>\n<p>メディアが一時停止、または再生が終了したときに発行されます。</p>\n<h4 id=\"イベント-did-change-theme-color\"><a href=\"#イベント-did-change-theme-color\">イベント: 'did-change-theme-color'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>color</code> (String | null) - '#rrggbb' 形式のテーマカラー。 テーマカラーが設定されていないと <code>null</code> です。</li>\n</ul>\n<p>ページのテーマカラーが変わったときに発生します。 これは通常、メタタグを発見すると起こります。</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">'theme-color'</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">'#ff0000'</span>></span>\n</code></pre>\n<h4 id=\"イベント-update-target-url\"><a href=\"#イベント-update-target-url\">イベント: 'update-target-url'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n</ul>\n<p>マウスをリンクにマウスオーバーしたり、キーボードでリンクにフォーカスしたときに発行されます。</p>\n<h4 id=\"イベント-cursor-changed\"><a href=\"#イベント-cursor-changed\">イベント: 'cursor-changed'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String</li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> (任意)</li>\n<li><code>scale</code> Float (任意) - カスタムカーソルの拡大率。</li>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a> (任意) - <code>image</code> のサイズ。</li>\n<li><code>hotspot</code> <a href=\"/docs/api/structures/point\">Point</a> (任意) - カスタムカーソルのホットスポットの座標。</li>\n</ul>\n<p>カーソルの種類が変更されたときに発行されます。 <code>type</code> は <code>default</code>、<code>crosshair</code>、<code>pointer</code>、<code>text</code>、<code>wait</code>、<code>help</code>、<code>e-resize</code>、<code>n-resize</code>,<code>ne-resize</code>、<code>nw-resize</code>、<code>s-resize</code>、<code>se-resize</code>、<code>sw-resize</code>、<code>w-resize</code>,<code>ns-resize</code>、<code>ew-resize</code>、<code>nesw-resize</code>、<code>nwse-resize</code>、<code>col-resize</code>,<code>row-resize</code>、<code>m-panning</code>、<code>e-panning</code>、<code>n-panning</code>、<code>ne-panning</code>、<code>nw-panning</code>,<code>s-panning</code>、<code>se-panning</code>、<code>sw-panning</code>、<code>w-panning</code>、<code>move</code>、<code>vertical-text</code>,<code>cell</code>、<code>context-menu</code>、<code>alias</code>、<code>progress</code>、<code>nodrop</code>、<code>copy</code>、<code>none</code>,<code>not-allowed</code>、<code>zoom-in</code>、<code>zoom-out</code>、<code>grab</code>、<code>grabbing</code>、<code>custom</code> になれます。</p>\n<p>もし <code>type</code> パラメータが <code>custom</code> の場合、<code>image</code> パラメータはカスタムカーソルの <a href=\"/docs/api/native-image\"><code>NativeImage</code></a> を、<code>scale</code>、<code>size</code>、<code>hotspot</code> はカスタムカーソルについての追加の情報を持ちます。</p>\n<h4 id=\"イベント-context-menu\"><a href=\"#イベント-context-menu\">イベント: 'context-menu'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>params</code> Object<ul>\n<li><code>x</code> Integer - x 座標。</li>\n<li><code>y</code> Integer - y 座標。</li>\n<li><code>frame</code> WebFrameMain - コンテキストメニューが呼び出されたフレーム。</li>\n<li><code>linkURL</code> String - コンテキストメニューが呼び出されたノードを囲うリンク URL。</li>\n<li><code>linkText</code> String - リンクに関連付けたテキスト。 リンクのコンテンツが画像の場合は、空文字列になります。</li>\n<li><code>pageURL</code> String - コンテキストメニューが呼び出された最上位のページの URL。</li>\n<li><code>frameURL</code> String - コンテキストメニューが呼び出されたサブフレームの URL。</li>\n<li><code>srcURL</code> String - コンテキストメニューが呼び出された要素のソース URL。 ソース URL を持つ要素は、画像、オーディオ、ビデオです。</li>\n<li><code>mediaType</code> String - コンテキストメニューが呼び出されたノードの種類。 <code>none</code>、<code>image</code>、<code>audio</code>、<code>video</code>、<code>canvas</code>、<code>file</code>、<code>plugin</code> になれる。</li>\n<li><code>hasImageContents</code> Boolean - 空でないコンテンツ画像の上でコンテキストメニューが呼び出されたかどうか。</li>\n<li><code>isEditable</code> Boolean - コンテキストが編集可能かどうか。</li>\n<li><code>selectionText</code> String - コンテキストメニューが呼び出されたときの選択テキスト。</li>\n<li><code>titleText</code> String - コンテキストメニューが呼び出された選択範囲のタイトルテキスト。</li>\n<li><code>altText</code> String - コンテキストメニューが呼び出された選択範囲の代替テキスト。</li>\n<li><code>suggestedFilename</code> String - コンテキストメニューの 'リンク先を名前を付けて保存' オプションでファイルを保存する際に使用されるファイル名の候補。</li>\n<li><code>selectionRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - 選択範囲の document 空間における座標を表す矩形。</li>\n<li><code>selectionStartOffset</code> Number - 選択テキストの開始位置。</li>\n<li><code>referrerPolicy</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - メニューが呼び出されるフレームのリファラポリシー。</li>\n<li><code>misspelledWord</code> String - カーソルの下のスペルミスした単語 (もしあるならば)。</li>\n<li><code>dictionarySuggestions</code> String[] - ユーザに <code>misspelledWord</code> の置き換えを示す推測した単語の配列。  単語のスペルミスがあり、スペルチェッカーが有効な場合にのみ利用できます。</li>\n<li><code>frameCharset</code> String - メニューが呼び出されたときのフレームのテキストエンコーディング。</li>\n<li><code>inputFieldType</code> String - 入力フィールド内でコンテキストメニューが呼び出されたときの、そのタイプ。 <code>none</code>、<code>plainText</code>、<code>password</code>、<code>other</code> になれる。</li>\n<li><code>spellcheckEnabled</code> Boolean - そのコンテキストが編集可能な場合に、スペルチェックが有効かどうか。</li>\n<li><code>menuSourceType</code> String - コンテキストメニューを呼び出した入力ソース。 <code>none</code>, <code>mouse</code>, <code>keyboard</code>, <code>touch</code>, <code>touchMenu</code>, <code>longPress</code>, <code>longTap</code>, <code>touchHandle</code>, <code>stylus</code>, <code>adjustSelection</code>, <code>adjustSelectionReset</code> のいずれかになります。</li>\n<li><code>mediaFlags</code> Object - コンテキストメニューが呼び出されたメディア要素のフラグ。<ul>\n<li><code>inError</code> Boolean - メディア要素がクラッシュしたかどうか。</li>\n<li><code>isPaused</code> Boolean - メディア要素が一時停止されているかどうか。</li>\n<li><code>isMuted</code> Boolean - メディア要素がミュートされているかどうか。</li>\n<li><code>hasAudio</code> Boolean - メディア要素に音声があるかどうか。</li>\n<li><code>isLooping</code> Boolean - メディア要素をループしているかどうか。</li>\n<li><code>isControlsVisible</code> Boolean - メディア要素のコントロールが見えるかどうか。</li>\n<li><code>canToggleControls</code> Boolean - メディア要素のコントロールがトグル切り替えできるかどうか。</li>\n<li><code>canPrint</code> Boolean - そのメディア要素が印刷できるかどうか。</li>\n<li><code>canSave</code> Boolean - そのメディア要素がダウンロードできるかどうか。</li>\n<li><code>canShowPictureInPicture</code> Boolean - そのメディア要素がピクチャインピクチャ表示できるかどうか。</li>\n<li><code>isShowingPictureInPicture</code> Boolean - そのメディア要素をピクチャインピクチャ表示しているかどうか。</li>\n<li><code>canRotate</code> Boolean - メディア要素を回転できるかどうか。</li>\n<li><code>canLoop</code> Boolean - そのメディア要素をループ再生できるかどうか。</li>\n</ul></li>\n<li><code>editFlags</code> Object - これらのフラグは、レンダラーが対応するアクションを実行できると信頼しているかどうかを示します。<ul>\n<li><code>canUndo</code> Boolean - レンダラーが、undo できると信頼しているかどうか。</li>\n<li><code>canUndo</code> Boolean - レンダラーが、redo できると信頼しているかどうか。</li>\n<li><code>canCut</code> Boolean - レンダラーが、カットできると信頼しているかどうか。</li>\n<li><code>canCopy</code> Boolean - レンダラーがコピーできると信頼しているかどうか。</li>\n<li><code>canPaste</code> Boolean - レンダラーが、ペーストできると信頼しているかどうか。</li>\n<li><code>canDelete</code> Boolean - レンダラーが、削除できると信頼しているかどうか。</li>\n<li><code>canSelectAll</code> Boolean - レンダラーが、全選択できると信頼しているかどうか。</li>\n<li><code>canEditRichly</code> Boolean - レンダラーがテキストをリッチ編集できると信頼しているかどうか。</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>処理が必要な新しいコンテキストメニューがあるときに発行されます。</p>\n<h4 id=\"イベント-select-bluetooth-device\"><a href=\"#イベント-select-bluetooth-device\">イベント: 'select-bluetooth-device'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>devices</code> <a href=\"/docs/api/structures/bluetooth-device\">BluetoothDevice[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>deviceId</code> String</li>\n</ul></li>\n</ul>\n<p><code>navigator.bluetooth.requestDevice</code> を呼ぶうえで、Bluetooth デバイスを選択する必要があるときに発行されます。 <code>navigator.bluetooth</code> を使用するには、<code>webBluetooth</code> API を有効にする必要があります。 もし <code>event.preventDefault</code> が呼ばれなければ、最初に有効なデバイスが選択されます。 <code>callback</code> は選択された <code>deviceId</code> で呼ばれます。リクエストがキャンセルされると、<code>callbback</code> に空文字列が渡されます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'enable-experimental-web-platform-features'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.webContents.on(<span class=\"hljs-string\">'select-bluetooth-device'</span>, (event, deviceList, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> result = deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.deviceName === <span class=\"hljs-string\">'test'</span>\n    })\n    <span class=\"hljs-keyword\">if</span> (!result) {\n      callback(<span class=\"hljs-string\">''</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      callback(result.deviceId)\n    }\n  })\n})\n</code></pre>\n<h4 id=\"イベント-paint\"><a href=\"#イベント-paint\">イベント: 'paint'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>dirtyRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> - フレーム全体の画像データ。</li>\n</ul>\n<p>新しいフレームが生成されたときに発生します。 バッファには変更された部分だけが渡されます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">offscreen</span>: <span class=\"hljs-literal\">true</span> } })\nwin.webContents.on(<span class=\"hljs-string\">'paint'</span>, (event, dirty, image) => {\n  <span class=\"hljs-comment\">// updateBitmap(dirty, image.getBitmap())</span>\n})\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n</code></pre>\n<h4 id=\"イベント-devtools-reload-page\"><a href=\"#イベント-devtools-reload-page\">イベント: 'devtools-reload-page'</a></h4>\n<p>開発者向けツールウインドウが webContents にリロードを指示したときに発行されます。</p>\n<h4 id=\"イベント-will-attach-webview\"><a href=\"#イベント-will-attach-webview\">イベント: 'will-attach-webview'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webPreferences</code> WebPreferences - ゲストページで使用されるウェブ設定。 このオブジェクトを変更して、ゲストページの設定を調整できます。</li>\n<li><code>params</code> Record&#x3C;string, string> - 他の <code>&#x3C;webview></code> パラメーター。<code>src</code> URL などがこれにあたります。 このオブジェクトを変更して、ゲストページのパラメーターを調整できます。</li>\n</ul>\n<p><code>&#x3C;webview></code> の webContents がこの webContents に適用されようとしているときに発行されます。 <code>event.preventDefault()</code> を呼ぶとゲストページを破棄します。</p>\n<p>このイベントは、 <code>webContents</code> の <code>&#x3C;webview></code> が読み込まれる前に <code>webPreferences</code> を設定するのに使用でき、<code>&#x3C;webview></code> の属性を通して設定できない設定を、設定する機能を提供します。</p>\n<p><strong>注釈:</strong> 指定された <code>preload</code> スクリプトオプションは、このイベントが発行された <code>webPreferences</code> オブジェクト内の、<code>preloadURL</code> (<code>preload</code> ではない) として現れます。</p>\n<h4 id=\"イベント-did-attach-webview\"><a href=\"#イベント-did-attach-webview\">イベント: 'did-attach-webview'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> WebContents - <code>&#x3C;webview></code> で使われるゲスト WebContents。</li>\n</ul>\n<p><code>&#x3C;webview></code> がこの webContents に適用されたときに発行されます。</p>\n<h4 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>level</code> Integer - 0 から 3 のログレベル。 順に <code>verbose</code>、<code>info</code>、<code>warning</code>、<code>error</code> に対応します。</li>\n<li><code>message</code> String - 実際のコンソールメッセージ</li>\n<li><code>line</code> Integer - このコンソールメッセージのトリガーとなったソースの行番号</li>\n<li><code>sourceId</code> String</li>\n</ul>\n<p>関連付けられたウインドウがコンソールメッセージを出力すると発生します。</p>\n<h4 id=\"イベント-preload-error\"><a href=\"#イベント-preload-error\">イベント: 'preload-error'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preloadPath</code> String</li>\n<li><code>error</code> Error</li>\n</ul>\n<p>プリロードスクリプト <code>preloadPath</code> がハンドルされていない例外 <code>error</code> を投げたときに発行されます。</p>\n<h4 id=\"イベント-ipc-message\"><a href=\"#イベント-ipc-message\">イベント: 'ipc-message'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>レンダラープロセスが <code> ipcRenderer.send()</code> を介して非同期メッセージを送信したときに発生します。</p>\n<h4 id=\"イベント-ipc-message-sync\"><a href=\"#イベント-ipc-message-sync\">イベント: 'ipc-message-sync'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>レンダラープロセスが <code> ipcRenderer.sendSync()</code> を介して同期メッセージを送信したときに発生します。</p>\n<h4 id=\"イベント-desktop-capturer-get-sources\"><a href=\"#イベント-desktop-capturer-get-sources\">イベント: 'desktop-capturer-get-sources'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>レンダラープロセス内で <code>desktopCapture.getSources()</code> が呼ばれたときに発生します。 <code>event.preventDefault()</code> を呼び出すと、空のソースを返します。</p>\n<h4 id=\"イベント-preferred-size-changed\"><a href=\"#イベント-preferred-size-changed\">イベント: 'preferred-size-changed'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preferredSize</code> <a href=\"/docs/api/structures/size\">Size</a> - スクロールなしでドキュメントのレイアウトを格納するのに必要な最小サイズ。</li>\n</ul>\n<p><code>WebContents</code> の優先サイズが変更された場合に発生します。</p>\n<p>このイベントは、<code>webPreferences</code> で <code>enablePreferredSizeMode</code> が <code>true</code> に設定されている場合にのみ発生します。</p>\n<h4 id=\"イベント-frame-created\"><a href=\"#イベント-frame-created\">イベント: 'frame-created'</a></h4>\n<p>戻り値：</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>frame</code> WebFrameMain</li>\n</ul></li>\n</ul>\n<p><a href=\"/docs/api/web-contents#contentsmainframe-readonly\">mainFrame</a>、<code>&#x3C;iframe></code>、ネストした <code>&#x3C;iframe></code> がページ内に読み込まれると発生します。</p>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<h4 id=\"contentsloadurlurl-options\"><a href=\"#contentsloadurlurl-options\"><code>contents.loadURL(url[, options])</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (任意) - HTTPリファラのURL。</li>\n<li><code>userAgent</code> String (任意) - リクエスト元のユーザーエージェント。</li>\n<li><code>extraHeaders</code> String (任意) - \"\\n\" で区切られた追加のヘッダー。</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a></li>\n<li><code>baseURLForDataURL</code> String (任意) - データURLによってロードされたファイルの (最後のパス区切り文字を含む) ベースURL。 これは指定された <code>url</code> がデータURLで、他のファイルをロードする必要がある場合のみ必要です。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - ページ読み込みが完了した時 (<a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a> を参照) に解決され、ページの読み込みに失敗した時 (<a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a> を参照) に拒否される Promise。 無操作拒否ハンドラーが既にアタッチされているため、未処理の拒否エラーは回避されます。</p>\n<p>ウインドウ内に <code>url</code> を読み込みます。 <code>url</code> は、<code>http://</code> や <code>file://</code> のようなプロトコルの接頭子を含まなければなりません。 HTTP キャッシュをバイパスする必要があるロードの場合は、<code>pragma</code> ヘッダを使用してそれを実現します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> options = { <span class=\"hljs-attr\">extraHeaders</span>: <span class=\"hljs-string\">'pragma: no-cache\\n'</span> }\nwebContents.loadURL(<span class=\"hljs-string\">'https://github.com'</span>, options)\n</code></pre>\n<h4 id=\"contentsloadfilefilepath-options\"><a href=\"#contentsloadfilefilepath-options\"><code>contents.loadFile(filePath[, options])</code></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>search</code> Record&#x3C;String, String> (任意) - <code>url.format()</code> に渡されます。</li>\n<li><code>search</code> String (任意) - <code>url.format()</code> に渡されます。</li>\n<li><code>hash</code> String (任意) - <code>url.format()</code> に渡されます。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - ページ読み込みが完了した時 (<a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a> を参照) に解決され、ページの読み込みに失敗した時 (<a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a> を参照) に拒否される Promise。</p>\n<p>指定されたファイルをウインドウにロードします。<code>filePath</code> は、アプリケーションのルートを基準にした HTML ファイルへのパスにする必要があります。  たとえば以下のようなアプリの構造において、</p>\n<pre><code class=\"hljs language-sh\">| root\n| - package.json\n| - src\n|   - main.js\n|   - index.html\n</code></pre>\n<p>このようなコードが必要です。</p>\n<pre><code class=\"hljs language-js\">win.loadFile(<span class=\"hljs-string\">'src/index.html'</span>)\n</code></pre>\n<h4 id=\"contentsdownloadurlurl\"><a href=\"#contentsdownloadurlurl\"><code>contents.downloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>ナビゲーションなしで <code>url</code> のリソースのダウンロードを初期化します。 <code>session</code> の <code>will-download</code> イベントが発生します。</p>\n<h4 id=\"contentsgeturl\"><a href=\"#contentsgeturl\"><code>contents.getURL()</code></a></h4>\n<p>戻り値 <code>String</code> - 現在のウェブページの URL。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> currentURL = win.webContents.getURL()\n  <span class=\"hljs-built_in\">console</span>.log(currentURL)\n})\n</code></pre>\n<h4 id=\"contentsgettitle\"><a href=\"#contentsgettitle\"><code>contents.getTitle()</code></a></h4>\n<p>戻り値 <code>String</code> - 現在のウェブページのタイトル。</p>\n<h4 id=\"contentsisdestroyed\"><a href=\"#contentsisdestroyed\"><code>contents.isDestroyed()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ウェブページが破棄されているかどうか。</p>\n<h4 id=\"contentsfocus\"><a href=\"#contentsfocus\"><code>contents.focus()</code></a></h4>\n<p>ウェブページにフォーカスします。</p>\n<h4 id=\"contentsisfocused\"><a href=\"#contentsisfocused\"><code>contents.isFocused()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ウェブページがフォーカスされているかどうか。</p>\n<h4 id=\"contentsisloading\"><a href=\"#contentsisloading\"><code>contents.isLoading()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ウェブページがまだリソースを読み込んでいるかどうか。</p>\n<h4 id=\"contentsisloadingmainframe\"><a href=\"#contentsisloadingmainframe\"><code>contents.isLoadingMainFrame()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - メインフレーム (iframe やフレーム内のフレームだけではない) がまだ読み込んでいるかどうか。</p>\n<h4 id=\"contentsiswaitingforresponse\"><a href=\"#contentsiswaitingforresponse\"><code>contents.isWaitingForResponse()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ウェブページが、ページのメインリソースからの最初の応答を待機しているかどうか。</p>\n<h4 id=\"contentsstop\"><a href=\"#contentsstop\"><code>contents.stop()</code></a></h4>\n<p>保留中のナビゲーションを停止します。</p>\n<h4 id=\"contentsreload\"><a href=\"#contentsreload\"><code>contents.reload()</code></a></h4>\n<p>現在のページを再読み込みします。</p>\n<h4 id=\"contentsreloadignoringcache\"><a href=\"#contentsreloadignoringcache\"><code>contents.reloadIgnoringCache()</code></a></h4>\n<p>現在のページを、キャッシュを無視して再読み込みします。</p>\n<h4 id=\"contentscangoback\"><a href=\"#contentscangoback\"><code>contents.canGoBack()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ブラウザが前のウェブページへ戻れるかどうか。</p>\n<h4 id=\"contentscangoforward\"><a href=\"#contentscangoforward\"><code>contents.canGoForward()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ブラウザが次のウェブページへ進めるかどうか。</p>\n<h4 id=\"contentscangotooffsetoffset\"><a href=\"#contentscangotooffsetoffset\"><code>contents.canGoToOffset(offset)</code></a></h4>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - <code>offset</code> 番目のウェブページへ行けるかどうか。</p>\n<h4 id=\"contentsclearhistory\"><a href=\"#contentsclearhistory\"><code>contents.clearHistory()</code></a></h4>\n<p>ナビゲーション履歴を消去します。</p>\n<h4 id=\"contentsgoback\"><a href=\"#contentsgoback\"><code>contents.goBack()</code></a></h4>\n<p>ブラウザを前のページへ戻させます。</p>\n<h4 id=\"contentsgoforward\"><a href=\"#contentsgoforward\"><code>contents.goForward()</code></a></h4>\n<p>ブラウザを次のページへ進めさせます。</p>\n<h4 id=\"contentsgotoindexindex\"><a href=\"#contentsgotoindexindex\"><code>contents.goToIndex(index)</code></a></h4>\n<ul>\n<li><code>index</code> Integer</li>\n</ul>\n<p>ブラウザを指定した絶対ウェブページインデックスへナビゲーションします。</p>\n<h4 id=\"contentsgotooffsetoffset\"><a href=\"#contentsgotooffsetoffset\"><code>contents.goToOffset(offset)</code></a></h4>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>現在のエントリから指定したオフセットへナビゲーションします。</p>\n<h4 id=\"contentsiscrashed\"><a href=\"#contentsiscrashed\"><code>contents.isCrashed()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - レンダラープロセスがクラッシュしたかどうか。</p>\n<h4 id=\"contentsforcefullycrashrenderer\"><a href=\"#contentsforcefullycrashrenderer\"><code>contents.forcefullyCrashRenderer()</code></a></h4>\n<p>この<code>webContents</code> を現在ホスティングしているレンダラープロセスを強制終了します。 これにより、 <code>reason=kill || reason=crashed</code> である、<code>render-process-gone</code> イベントが発生します。 レンダラープロセスを共有しているWebContents の中には、このメソッドを呼び出すと、他のウェブコンテンツのホストプロセスがクラッシュする場合がありますのでご注意ください。</p>\n<p>メソッドを呼び出した直後にこの <code>reload()</code> を呼び出すと、新しいプロセスでリロードが発生します。 これは、このプロセスが不安定または使用不可の場合、例えば <code>unresponsive</code> イベントから回復する際に使用されるべきです。</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'unresponsive'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> { response } = <span class=\"hljs-keyword\">await</span> dialog.showMessageBox({\n    <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'App X has become unresponsive'</span>,\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Do you want to try forcefully reloading the app?'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'OK'</span>, <span class=\"hljs-string\">'Cancel'</span>],\n    <span class=\"hljs-attr\">cancelId</span>: <span class=\"hljs-number\">1</span>\n  })\n  <span class=\"hljs-keyword\">if</span> (response === <span class=\"hljs-number\">0</span>) {\n    contents.forcefullyCrashRenderer()\n    contents.reload()\n  }\n})\n</code></pre>\n<h4 id=\"contentssetuseragentuseragent\"><a href=\"#contentssetuseragentuseragent\"><code>contents.setUserAgent(userAgent)</code></a></h4>\n<ul>\n<li><code>userAgent</code> String</li>\n</ul>\n<p>このウェブページのユーザエージェントをオーバーライドします。</p>\n<h4 id=\"contentsgetuseragent\"><a href=\"#contentsgetuseragent\"><code>contents.getUserAgent()</code></a></h4>\n<p>戻り値 <code>String</code> - このウェブページのユーザエージェント。</p>\n<h4 id=\"contentsinsertcsscss-options\"><a href=\"#contentsinsertcsscss-options\"><code>contents.insertCSS(css[, options])</code></a></h4>\n<ul>\n<li><code>css</code> String</li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>cssOrigin</code> String (任意) - 'user' または 'author' のいずれかです。'user' を指定すると、挿入した CSS がウェブサイトによって上書きされるのを防ぐことができます。 既定値は 'author' です。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;String></code> - 挿入された CSS のキーで解決される promise。後で <code>contents.removeInsertedCSS(key)</code> を使用して CSS を削除するために使用できます。</p>\n<p>現在のウェブページに CSS を挿入し、挿入されたスタイルシートの一意なキーを返します。</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n  contents.insertCSS(<span class=\"hljs-string\">'html, body { background-color: #f00; }'</span>)\n})\n</code></pre>\n<h4 id=\"contentsremoveinsertedcsskey\"><a href=\"#contentsremoveinsertedcsskey\"><code>contents.removeInsertedCSS(key)</code></a></h4>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - 削除に成功すると解決されます。</p>\n<p>現在のウェブページから挿入された CSS を削除します。 スタイルシートは <code>contents.insertCSS(css)</code> から返されるキーで識別されます。</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'did-finish-load'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> key = <span class=\"hljs-keyword\">await</span> contents.insertCSS(<span class=\"hljs-string\">'html, body { background-color: #f00; }'</span>)\n  contents.removeInsertedCSS(key)\n})\n</code></pre>\n<h4 id=\"contentsexecutejavascriptcode-usergesture\"><a href=\"#contentsexecutejavascriptcode-usergesture\"><code>contents.executeJavaScript(code[, userGesture])</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (任意) - 省略値は <code>false</code>。</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;any></code> - 実行されたコードの結果で resolve する Promise。コードの結果が reject な Promise である場合は reject な Promise。</p>\n<p>ページ内の <code>code</code> を評価します。</p>\n<p>ブラウザウインドウでは、<code>requestFullScreen</code> のような、いくつかの HTML API は、ユーザからのジェスチャーでのみ呼び出されます。 <code>userGesture</code> を <code>true</code> にセットすることでこの制限がなくなります。</p>\n<p>コードの実行は、ウェブページの読み込みが停止するまで中断されます。</p>\n<pre><code class=\"hljs language-js\">contents.executeJavaScript(<span class=\"hljs-string\">'fetch(\"https://jsonplaceholder.typicode.com/users/1\").then(resp => resp.json())'</span>, <span class=\"hljs-literal\">true</span>)\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">result</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(result) <span class=\"hljs-comment\">// フェッチ呼び出しの JSON オブジェクトになります</span>\n  })\n</code></pre>\n<h4 id=\"contentsexecutejavascriptinisolatedworldworldid-scripts-usergesture\"><a href=\"#contentsexecutejavascriptinisolatedworldworldid-scripts-usergesture\"><code>contents.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture])</code></a></h4>\n<ul>\n<li><code>worldId</code> Integer - JavaScript を実行するワールドの ID。<code>0</code> はデフォルトのワールドで、<code>999</code> は Electron の <code>contextIsolation</code> 機能で使用されるワールドです。  任意の整数を指定できます。</li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/web-source\">WebSource[]</a></li>\n<li><code>userGesture</code> Boolean (任意) - 省略値は <code>false</code>。</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;any></code> - 実行されたコードの結果で resolve する Promise。コードの結果が reject な Promise である場合は reject な Promise。</p>\n<p><code>executeJavaScript</code> のように動きますが、 <code>scripts</code> はイソレートコンテキスト内で評価します。</p>\n<h4 id=\"contentssetignoremenushortcutsignore\"><a href=\"#contentssetignoremenushortcutsignore\"><code>contents.setIgnoreMenuShortcuts(ignore)</code></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n</ul>\n<p>この WebContents がフォーカスされている間、アプリケーションのメニューショートカットを無視します。</p>\n<h4 id=\"contentssetwindowopenhandlerhandler\"><a href=\"#contentssetwindowopenhandlerhandler\"><code>contents.setWindowOpenHandler(handler)</code></a></h4>\n<ul>\n<li>\n<p><code>handler</code> Function&#x3C;{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}></p>\n<ul>\n<li><code>details</code> Object<ul>\n<li><code>url</code> String - <code>window.open()</code> に渡されて <em>解決された</em> URL。 例えば <code>window.open('foo')</code> でウインドウを開くと、これは <code>https://the-origin/the/current/path/foo</code> のようになります。</li>\n<li><code>frameName</code> String - <code>window.open()</code> で指定されたウインドウ名</li>\n<li><code>features</code> String - <code>window.open()</code> で指定されたウインドウ機能のカンマ区切りリスト。</li>\n<li><code>disposition</code> String - <code>default</code>、<code>foreground-tab</code>、<code>background-tab</code>、<code>new-window</code>、<code>save-to-disk</code>、<code>other</code> のいずれかにできます。</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - 新しいウィンドウへ渡される Referrer。 Referrer のポリシーに依存しているので、<code>Referrer</code> ヘッダを送信されるようにしてもしなくてもかまいません。</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (任意) - 新しいウィンドウに送信する POST データと、それにセットする適切なヘッダ。 送信する POST データが無い場合、値は <code>null</code> になります。 これは <code>target=_blank</code> を設定したフォームによってウィンドウが作成されている場合にのみセットされます。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}</code> - <code>deny</code> を返すと新規ウインドウの作成をキャンセルします。 <code>allow</code> を返すと新規ウインドウが作成されます。 <code>overrideBrowserWindowOptions</code> を指定すると、作成されるウィンドウをカスタマイズできます。 null、undefined、規定の 'action' の値を持たないオブジェクトといった認識されない値を返すと、コンソールエラーになり、<code>{action: 'deny'}</code> を返すのと同じ効果となります。</p>\n</li>\n</ul>\n<p><code>window.open()</code>、<code>target=\"_blank\"</code> のリンク、リンクのシフトクリック、<code>&#x3C;form target=\"_blank\"></code> のフォーム送信などによりレンダラーが新しいウインドウを要求すると、ウインドウ作成前に呼び出されます。 詳細や <code>did-create-window</code> と併せた使用方法については <a href=\"/docs/api/window-open\"><code>window.open()</code></a> をご参照ください。</p>\n<h4 id=\"contentssetaudiomutedmuted\"><a href=\"#contentssetaudiomutedmuted\"><code>contents.setAudioMuted(muted)</code></a></h4>\n<ul>\n<li><code>muted</code> Boolean</li>\n</ul>\n<p>現在のウェブページのオーディオをミュートします。</p>\n<h4 id=\"contentsisaudiomuted\"><a href=\"#contentsisaudiomuted\"><code>contents.isAudioMuted()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - このページがミュートされているかどうか。</p>\n<h4 id=\"contentsiscurrentlyaudible\"><a href=\"#contentsiscurrentlyaudible\"><code>contents.isCurrentlyAudible()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - 音声が現在再生中かどうか。</p>\n<h4 id=\"contentssetzoomfactorfactor\"><a href=\"#contentssetzoomfactorfactor\"><code>contents.setZoomFactor(factor)</code></a></h4>\n<ul>\n<li><code>factor</code> Double - 拡大率。省略値は 1.0 です。</li>\n</ul>\n<p>指定の拡大率に変更します。 拡大率は百分率なので、300% = 3.0 です。</p>\n<p>拡大率は 0.0 より大きい必要があります。</p>\n<h4 id=\"contentsgetzoomfactor\"><a href=\"#contentsgetzoomfactor\"><code>contents.getZoomFactor()</code></a></h4>\n<p>戻り値 <code>Number</code> - 現在の拡大率。</p>\n<h4 id=\"contentssetzoomlevellevel\"><a href=\"#contentssetzoomlevellevel\"><code>contents.setZoomLevel(level)</code></a></h4>\n<ul>\n<li><code>level</code> Number - 拡大レベル。</li>\n</ul>\n<p>指定レベルに拡大レベルを変更します。 原寸は 0 で、各増減分はそれぞれ 20% ずつの拡大または縮小を表し、デフォルトで元のサイズの 300% から 50% までに制限されています。 この式は <code>scale := 1.2 ^ level</code> です。</p>\n<blockquote>\n<p><strong>注意</strong>: Chromium でのズームポリシーはドメインごとです。すなわち、特定ドメインのズームレベルは、同じドメインのウィンドウの全インスタンスに伝播します。 ウインドウの URL が別々であれば、ウインドウごとのズームになります。</p>\n</blockquote>\n<h4 id=\"contentsgetzoomlevel\"><a href=\"#contentsgetzoomlevel\"><code>contents.getZoomLevel()</code></a></h4>\n<p>戻り値 <code>Number</code> - 現在の拡大レベル。</p>\n<h4 id=\"contentssetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#contentssetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>contents.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h4>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code></p>\n<p>ピンチによる拡大レベルの最大値と最小値を設定します。</p>\n<blockquote>\n<p><strong>注意</strong>: Electron ではデフォルトで視覚ズームは無効化されています。 再び有効にする場合は以下を呼び出します。</p>\n<pre><code class=\"hljs language-js\">contents.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">3</span>)\n</code></pre>\n</blockquote>\n<h4 id=\"contentsundo\"><a href=\"#contentsundo\"><code>contents.undo()</code></a></h4>\n<p>ウェブページの <code>undo</code> 編集コマンドを実行します。</p>\n<h4 id=\"contentsredo\"><a href=\"#contentsredo\"><code>contents.redo()</code></a></h4>\n<p>ウェブページの <code>redo</code> 編集コマンドを実行します。</p>\n<h4 id=\"contentscut\"><a href=\"#contentscut\"><code>contents.cut()</code></a></h4>\n<p>ウェブページの <code>cut</code> 編集コマンドを実行します。</p>\n<h4 id=\"contentscopy\"><a href=\"#contentscopy\"><code>contents.copy()</code></a></h4>\n<p>ウェブページの <code>copy</code> 編集コマンドを実行します。</p>\n<h4 id=\"contentscopyimageatx-y\"><a href=\"#contentscopyimageatx-y\"><code>contents.copyImageAt(x, y)</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>指定した位置の画像をクリップボードにコピーします。</p>\n<h4 id=\"contentspaste\"><a href=\"#contentspaste\"><code>contents.paste()</code></a></h4>\n<p>ウェブページの <code>paste</code> 編集コマンドを実行します。</p>\n<h4 id=\"contentspasteandmatchstyle\"><a href=\"#contentspasteandmatchstyle\"><code>contents.pasteAndMatchStyle()</code></a></h4>\n<p>ウェブページの <code>pasteAndMatchStyle</code> 編集コマンドを実行します。</p>\n<h4 id=\"contentsdelete\"><a href=\"#contentsdelete\"><code>contents.delete()</code></a></h4>\n<p>ウェブページの <code>delete</code> 編集コマンドを実行します。</p>\n<h4 id=\"contentsselectall\"><a href=\"#contentsselectall\"><code>contents.selectAll()</code></a></h4>\n<p>ウェブページの <code>selectAll</code> 編集コマンドを実行します。</p>\n<h4 id=\"contentsunselect\"><a href=\"#contentsunselect\"><code>contents.unselect()</code></a></h4>\n<p>ウェブページの <code>unselect</code> 編集コマンドを実行します。</p>\n<h4 id=\"contentsreplacetext\"><a href=\"#contentsreplacetext\"><code>contents.replace(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>ウェブページの <code>replace</code> 編集コマンドを実行します。</p>\n<h4 id=\"contentsreplacemisspellingtext\"><a href=\"#contentsreplacemisspellingtext\"><code>contents.replaceMisspelling(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>ウェブページの <code>replaceMisspelling</code> 編集コマンドを実行します。</p>\n<h4 id=\"contentsinserttexttext\"><a href=\"#contentsinserttexttext\"><code>contents.insertText(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code></p>\n<p>フォーカスされた要素に <code>text</code> を挿入します。</p>\n<h4 id=\"contentsfindinpagetext-options\"><a href=\"#contentsfindinpagetext-options\"><code>contents.findInPage(text[, options])</code></a></h4>\n<ul>\n<li><code>text</code> String - 検索するコンテンツ。空にしてはいけません。</li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>forward</code> Boolean (任意) - 前方または後方を検索するかどうか。省略値は <code>true</code>。</li>\n<li><code>findNext</code> Boolean (任意) - この要求で新規テキスト検索セッションを開始するかどうか。 最初の要求では <code>true</code> に、二度目以降の要求では <code>false</code> にする必要があります。 省略値は <code>false</code> 。</li>\n<li><code>matchCase</code> Boolean (任意) - 大文字と小文字を区別する検索かどうか。省略値は <code>false</code>。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Integer</code> - リクエストに使われたリクエスト ID。</p>\n<p>ウェブページ内の <code>text</code> のすべてのマッチを探すリクエストを開始します。 リクエストの結果は <a href=\"/docs/api/web-contents#event-found-in-page\"><code>found-in-page</code></a> イベントを読むことで取得できます。</p>\n<h4 id=\"contentsstopfindinpageaction\"><a href=\"#contentsstopfindinpageaction\"><code>contents.stopFindInPage(action)</code></a></h4>\n<ul>\n<li><code>action</code> String - [<code>webContents.findInPage</code>] リクエストを終了する際に行う動作を指定します。<ul>\n<li><code>clearSelection</code> - 選択を消去する。</li>\n<li><code>keepSelection</code> - その選択を通常の選択に変換する。</li>\n<li><code>activateSelection</code> - 選択ノードをフォーカスして、クリックする。</li>\n</ul></li>\n</ul>\n<p>指定された <code>action</code> で、<code>webContents</code> の <code>findInPage</code> リクエストを停止します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nwebContents.on(<span class=\"hljs-string\">'found-in-page'</span>, (event, result) => {\n  <span class=\"hljs-keyword\">if</span> (result.finalUpdate) webContents.stopFindInPage(<span class=\"hljs-string\">'clearSelection'</span>)\n})\n\n<span class=\"hljs-keyword\">const</span> requestId = webContents.findInPage(<span class=\"hljs-string\">'api'</span>)\n<span class=\"hljs-built_in\">console</span>.log(requestId)\n</code></pre>\n<h4 id=\"contentscapturepagerect\"><a href=\"#contentscapturepagerect\"><code>contents.capturePage([rect])</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (任意) - キャプチャするページ内の領域。</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;NativeImage></code> - <a href=\"/docs/api/native-image\">NativeImage</a> を解決します</p>\n<p><code>rect</code> 内のページのスナップショットをキャプチャします。 <code>rect</code> を省略すると、表示されているページ全体をキャプチャします。</p>\n<h4 id=\"contentsisbeingcaptured\"><a href=\"#contentsisbeingcaptured\"><code>contents.isBeingCaptured()</code></a></h4>\n<p>Returns <code>Boolean</code> - このページがキャプチャされているかどうか。 キャプチャーの数が 0 より大きい場合は true を返します。</p>\n<h4 id=\"contentsincrementcapturercountsize-stayhidden-stayawake\"><a href=\"#contentsincrementcapturercountsize-stayhidden-stayawake\"><code>contents.incrementCapturerCount([size, stayHidden, stayAwake])</code></a></h4>\n<ul>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a> (任意) - キャプチャの優先サイズ。</li>\n<li><code>stayHidden</code> Boolean (任意) -  ページを表示せずに非表示のままにします。</li>\n<li><code>stayAwake</code> Boolean (任意) -  システムをスリープさせずに、起きたままにします。</li>\n</ul>\n<p>キャプチャ回数は 1 ずつ増加します。 ブラウザーウインドウが非表示でもキャプチャ回数がゼロではない場合、ページは表示されていると見なされます。 ページを非表示のままにする場合は、<code>stayHidden</code> を true に設定していることを確認してください。</p>\n<p>これは Page Visibility API にも影響を与えます。</p>\n<h4 id=\"contentsdecrementcapturercountstayhidden-stayawake\"><a href=\"#contentsdecrementcapturercountstayhidden-stayawake\"><code>contents.decrementCapturerCount([stayHidden, stayAwake])</code></a></h4>\n<ul>\n<li><code>stayHidden</code> Boolean (任意) -  ページを表示状態にせず非表示のままにします。</li>\n<li><code>stayAwake</code> Boolean (任意) -  システムをスリープさせずに、起きたままにします。</li>\n</ul>\n<p>キャプチャ回数は 1 ずつ減少します。 ブラウザウィンドウが隠されるまたはオクルージョンされるか、キャプチャーカウントが 0 になると、ページは非表示状態やオクルージョン状態にセットされます。 代わりに非表示のキャプチャ回数を減らしたい場合は、<code>stayHidden</code> を true に設定してください。</p>\n<h4 id=\"contentsgetprinters\"><a href=\"#contentsgetprinters\"><code>contents.getPrinters()</code></a></h4>\n<p>システムプリンタのリストを取得します。</p>\n<p>戻り値 <a href=\"/docs/api/structures/printer-info\"><code>PrinterInfo[]</code></a></p>\n<h4 id=\"contentsprintoptions-callback\"><a href=\"#contentsprintoptions-callback\"><code>contents.print([options], [callback])</code></a></h4>\n<ul>\n<li><code>options</code> Object (任意)<ul>\n<li><code>silent</code> Boolean (任意) - プリンタの設定をユーザに尋ねないかどうか。 省略値は <code>false</code> です。</li>\n<li><code>printBackground</code> Boolean (任意) - ウェブページの背景色と画像を印刷するかどうか。 省略値は <code>false</code> です。</li>\n<li><code>deviceName</code> String (任意) - 使用するプリンタデバイスの名前をセットします。 '人間向けの' 名称ではなくシステム定義名である必要があります。例えば、'Brother QL-820NWB' ではなく 'Brother_QL_820NWB' とします。</li>\n<li><code>color</code> Boolean (任意) - 印刷するウェブページをカラーにするかグレースケールにするかを設定します。 省略値は <code>true</code> です。</li>\n<li><code>margins</code> Object (任意)<ul>\n<li><code>marginType</code> String (任意) - <code>default</code>、<code>none</code>、<code>printableArea</code> か <code>custom</code> にできます。 <code>custom</code> を選択した場合、<code>top</code>、<code>bottom</code>、<code>left</code>、<code>right</code> も指定する必要があります。</li>\n<li><code>top</code> Number (任意) - 印刷されたウェブページの上側のマージン。ピクセル単位です。</li>\n<li><code>bottom</code> Number (任意) - 印刷されたウェブページの下側のマージン。ピクセル単位です。</li>\n<li><code>left</code> Number (任意) - 印刷されたウェブページの左側のマージン。ピクセル単位です。</li>\n<li><code>right</code> Number (任意) - 印刷されたウェブページの右側のマージン。ピクセル単位です。</li>\n</ul></li>\n<li><code>landscape</code> Boolean (任意) - ウェブページを横向きモードで印刷するかどうか。 省略値は <code>false</code> です。</li>\n<li><code>scaleFactor</code> Number (任意) - ウェブページのスケール係数。</li>\n<li><code>pagesPerSheet</code> Number (任意) - ページシートごとに印刷するページ数。</li>\n<li><code>collate</code> Boolean (任意) - ウェブページを校合するかどうか。</li>\n<li><code>copies</code> Number (任意) - 印刷するウェブページの版数。</li>\n<li><code>pageRanges</code> Object<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> - 印刷するページ範囲。 macOS では 1 つの範囲のみが許可されています。<ul>\n<li><code>from</code> Number - 印刷する最初のページのインデックス (0 始まり)。</li>\n<li><code>to</code> Number - 印刷する最後のページのインデックス (これを含む) (0 始まり)。</li>\n</ul></li>\n<li><code>duplexMode</code> String (任意) - 印刷されるウェブページの両面モードを設定します。 <code>simplex</code>、<code>shortEdge</code>、<code>longEdge</code> のいずれかにできます。</li>\n<li><code>dpi</code> Record&#x3C;string, number> (任意)<ul>\n<li><code>horizontal</code> Number (任意) - 水平 DPI。</li>\n<li><code>vertical</code> Number (任意) - 垂直 DPI。</li>\n</ul></li>\n<li><code>header</code> String (任意) - ページヘッダーとして印刷される文字列。</li>\n<li><code>footer</code> String (任意) - ページフッターとして印刷される文字列。</li>\n<li><code>pageSize</code> String | Size (任意) - 印刷するドキュメントのページサイズを指定します。 <code>A3</code>、<code>A4</code>、<code>A5</code>、<code>Legal</code>、<code>Letter</code>、<code>Tabloid</code> のいずれかにするか、<code>height</code> を含む Object にできます。</li>\n</ul></li>\n<li><code>callback</code> Function (任意)<ul>\n<li><code>success</code> Boolean - 印刷呼び出しの成功を示す。</li>\n<li><code>failureReason</code> String - 印刷に失敗した場合に呼び戻されるエラーの説明。</li>\n</ul></li>\n</ul>\n<p>カスタムの <code>pageSize</code> を渡すと、Chromium は <code>width_microns</code> と <code>height_microns</code> それぞれのプラットフォーム固有の最小値を検証しようとします。 幅、高さともに最低 353 ミクロンでなければなりませんが、オペレーティングシステムによってはそれ以上になることがあります。</p>\n<p>ウインドウのウェブページを印刷します。 <code>silent</code> が <code>true</code> にセットされたとき、<code>deviceName</code> が空で印刷のデフォルト設定があれば、Electron はシステムのデフォルトプリンタを選択します。</p>\n<p><code>page-break-before: always;</code> CSS スタイルを使用して、強制的に改ページして印刷できます。</p>\n<p>使用例:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> options = {\n  <span class=\"hljs-attr\">silent</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">deviceName</span>: <span class=\"hljs-string\">'My-Printer'</span>,\n  <span class=\"hljs-attr\">pageRanges</span>: [{\n    <span class=\"hljs-attr\">from</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">to</span>: <span class=\"hljs-number\">1</span>\n  }]\n}\nwin.webContents.print(options, (success, errorType) => {\n  <span class=\"hljs-keyword\">if</span> (!success) <span class=\"hljs-built_in\">console</span>.log(errorType)\n})\n</code></pre>\n<h4 id=\"contentsprinttopdfoptions\"><a href=\"#contentsprinttopdfoptions\"><code>contents.printToPDF(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>headerFooter</code> Record&#x3C;string, string> (任意) - PDF のヘッダーとフッター。<ul>\n<li><code>title</code> String - PDF ヘッダーのタイトル。</li>\n<li><code>url</code> String - PDF フッターの URL。</li>\n</ul></li>\n<li><code>landscape</code> Boolean (任意) - <code>true</code> で横向き、<code>false</code> で縦向き。</li>\n<li><code>marginsType</code> Integer (optional) - 使用する余白の種類を指定します。 0 で既定値、1 で余白なし、2 で最小限の余白になります。</li>\n<li><code>scaleFactor</code> Number (任意) - ウェブページのスケール係数。 0 から 100 の範囲にできます。</li>\n<li><code>pageRanges</code> Record&#x3C;string, number> (任意) - 印刷するページ範囲。<ul>\n<li><code>from</code> Number - 印刷する最初のページのインデックス (0 始まり)。</li>\n<li><code>to</code> Number - 印刷する最後のページのインデックス (これを含む) (0 始まり)。</li>\n</ul></li>\n<li><code>pageSize</code> String | Size (任意) - 生成する PDF のページサイズを指定します。 <code>A3</code>、<code>A4</code>、<code>A5</code>、<code>Legal</code>、<code>Letter</code>、<code>Tabloid</code>、またはミクロン単位の <code>height</code> と <code>width</code> を含む Object にできます。</li>\n<li><code>printBackground</code> Boolean (任意) - CSS 背景を印刷するかどうか。</li>\n<li><code>printSelectionOnly</code> Boolean (任意) - 選択部分だけを印刷するかどうか。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;Buffer></code> - 生成された PDF データで実行されます。</p>\n<p>Chromium の印刷のカスタム設定のプレビューで、PDF としてウインドウのウェブページを出力します。</p>\n<p><code>@page</code> CSS ルールがウェブページ内で使われている場合、<code>landscape</code> は無視されます。</p>\n<p>デフォルトでは、空の <code>options</code> は以下のようにみなされます。</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">marginsType</span>: <span class=\"hljs-number\">0</span>,\n  <span class=\"hljs-attr\">printBackground</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">printSelectionOnly</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">landscape</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">pageSize</span>: <span class=\"hljs-string\">'A4'</span>,\n  <span class=\"hljs-attr\">scaleFactor</span>: <span class=\"hljs-number\">100</span>\n}\n</code></pre>\n<p><code>page-break-before: always;</code> CSS スタイルを使用して、強制的に改ページして印刷できます。</p>\n<p>これは <code>webContents.printToPDF</code> の例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n<span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\nwin.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n  <span class=\"hljs-comment\">// 既定の印刷オプションを使用します</span>\n  win.webContents.printToPDF({}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">data</span> =></span> {\n    <span class=\"hljs-keyword\">const</span> pdfPath = path.join(os.homedir(), <span class=\"hljs-string\">'Desktop'</span>, <span class=\"hljs-string\">'temp.pdf'</span>)\n    fs.writeFile(pdfPath, data, (error) => {\n      <span class=\"hljs-keyword\">if</span> (error) <span class=\"hljs-keyword\">throw</span> error\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Wrote PDF successfully to <span class=\"hljs-subst\">${pdfPath}</span>`</span>)\n    })\n  }).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">error</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Failed to write PDF to <span class=\"hljs-subst\">${pdfPath}</span>: `</span>, error)\n  })\n})\n</code></pre>\n<h4 id=\"contentsaddworkspacepath\"><a href=\"#contentsaddworkspacepath\"><code>contents.addWorkSpace(path)</code></a></h4>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>指定したパスをデベロッパー ツールのワークスペースに追加します。 デベロッパー ツールが生成された後で使用しなければいけません。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.on(<span class=\"hljs-string\">'devtools-opened'</span>, () => {\n  win.webContents.addWorkSpace(__dirname)\n})\n</code></pre>\n<h4 id=\"contentsremoveworkspacepath\"><a href=\"#contentsremoveworkspacepath\"><code>contents.removeWorkSpace(path)</code></a></h4>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>開発者向けツールのワークスペースから指定したパスを削除します。</p>\n<h4 id=\"contentssetdevtoolswebcontentsdevtoolswebcontents\"><a href=\"#contentssetdevtoolswebcontentsdevtoolswebcontents\"><code>contents.setDevToolsWebContents(devToolsWebContents)</code></a></h4>\n<ul>\n<li><code>devToolsWebContents</code> WebContents</li>\n</ul>\n<p><code>devToolsWebContents</code> を開発者向けツールを表示するターゲット <code>WebContents</code> として使用します。</p>\n<p><code>devToolsWebContents</code> はナビゲーションを行ってはいけません。また、コール後に他の目的に使用することはできません。</p>\n<p>デフォルトでは、Electron は開発者が制御を非常に制限したネイティブビューを持つ内部 <code>WebContents</code> を作成することによって開発者向けツールを管理します。 <code>setDevToolsWebContents</code> メソッドでは、開発者は任意の <code>WebContents</code> を使用して、<code>BrowserWindow</code>、<code>BrowserView</code>、<code>&#x3C;webview></code> タグなどの開発者向けツールを表示できます。</p>\n<p>開発者向けツールを閉じても <code>devToolsWebContents</code> は破棄されないことに注意してください。 <code>devToolsWebContents</code> を破棄するのは呼び出し元の責任です。</p>\n<p><code>&#x3C;webview></code> タグ内で開発者向けツールを表示する例:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">style</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/css\"</span>></span><span class=\"css\">\n    * { <span class=\"hljs-attribute\">margin</span>: <span class=\"hljs-number\">0</span>; }\n    <span class=\"hljs-selector-id\">#browser</span> { <span class=\"hljs-attribute\">height</span>: <span class=\"hljs-number\">70%</span>; }\n    <span class=\"hljs-selector-id\">#devtools</span> { <span class=\"hljs-attribute\">height</span>: <span class=\"hljs-number\">30%</span>; }\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">style</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"browser\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"devtools\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"about:blank\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n    <span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n    <span class=\"hljs-keyword\">const</span> emittedOnce = <span class=\"hljs-function\">(<span class=\"hljs-params\">element, eventName</span>) =></span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> {\n      element.addEventListener(eventName, event => resolve(event), { <span class=\"hljs-attr\">once</span>: <span class=\"hljs-literal\">true</span> })\n    })\n    <span class=\"hljs-keyword\">const</span> browserView = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'browser'</span>)\n    <span class=\"hljs-keyword\">const</span> devtoolsView = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'devtools'</span>)\n    <span class=\"hljs-keyword\">const</span> browserReady = emittedOnce(browserView, <span class=\"hljs-string\">'dom-ready'</span>)\n    <span class=\"hljs-keyword\">const</span> devtoolsReady = emittedOnce(devtoolsView, <span class=\"hljs-string\">'dom-ready'</span>)\n    <span class=\"hljs-built_in\">Promise</span>.all([browserReady, devtoolsReady]).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      <span class=\"hljs-keyword\">const</span> targetId = browserView.getWebContentsId()\n      <span class=\"hljs-keyword\">const</span> devtoolsId = devtoolsView.getWebContentsId()\n      ipcRenderer.send(<span class=\"hljs-string\">'open-devtools'</span>, targetId, devtoolsId)\n    })\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// メインプロセス</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain, webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'open-devtools'</span>, (event, targetContentsId, devtoolsContentsId) => {\n  <span class=\"hljs-keyword\">const</span> target = webContents.fromId(targetContentsId)\n  <span class=\"hljs-keyword\">const</span> devtools = webContents.fromId(devtoolsContentsId)\n  target.setDevToolsWebContents(devtools)\n  target.openDevTools()\n})\n</code></pre>\n<p><code>BrowserWindow</code> 内で開発者向けツールを表示する例:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n<span class=\"hljs-keyword\">let</span> devtools = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  devtools = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  win.webContents.setDevToolsWebContents(devtools.webContents)\n  win.webContents.openDevTools({ <span class=\"hljs-attr\">mode</span>: <span class=\"hljs-string\">'detach'</span> })\n})\n</code></pre>\n<h4 id=\"contentsopendevtoolsoptions\"><a href=\"#contentsopendevtoolsoptions\"><code>contents.openDevTools([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (任意)<ul>\n<li><code>mode</code> String - 指定したドック状態で開発者向けツールを開く。<code>right</code>、<code>bottom</code>、<code>undocked</code>、<code>detach</code> にできる。 省略値は最後に使用したときのドック状態。 <code>undocked</code> モードではドックを後ろにやれる。 <code>detach</code> モードではできない。</li>\n<li><code>activate</code> Boolean (任意) - 開かれたデベロッパー ツールウインドウを前面に表示するかどうか。 省略値は <code>true</code> です。</li>\n</ul></li>\n</ul>\n<p>開発者向けツールを開く。</p>\n<p><code>contents</code> が <code>&#x3C;webview></code> タグである場合、デフォルトでは <code>mode</code> が <code>detach</code> になり、空の <code>mode</code> を明示的に渡すと最後に使用されたドックステートを使用して強制的に実行されます。</p>\n<h4 id=\"contentsclosedevtools\"><a href=\"#contentsclosedevtools\"><code>contents.closeDevTools()</code></a></h4>\n<p>開発者向けツールを閉じる。</p>\n<h4 id=\"contentsisdevtoolsopened\"><a href=\"#contentsisdevtoolsopened\"><code>contents.isDevToolsOpened()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - 開発者向けツールが開かれているかどうか。</p>\n<h4 id=\"contentsisdevtoolsfocused\"><a href=\"#contentsisdevtoolsfocused\"><code>contents.isDevToolsFocused()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - 開発者向けツールがフォーカスされているかどうか。</p>\n<h4 id=\"contentstoggledevtools\"><a href=\"#contentstoggledevtools\"><code>contents.toggleDevTools()</code></a></h4>\n<p>開発者向けツールをトグル切り替えします。</p>\n<h4 id=\"contentsinspectelementx-y\"><a href=\"#contentsinspectelementx-y\"><code>contents.inspectElement(x, y)</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>(<code>x</code>, <code>y</code>) の位置の要素の検査を開始します。</p>\n<h4 id=\"contentsinspectsharedworker\"><a href=\"#contentsinspectsharedworker\"><code>contents.inspectSharedWorker()</code></a></h4>\n<p>共有ワーカーコンテキストの開発者向けツールを開きます。</p>\n<h4 id=\"contentsinspectsharedworkerbyidworkerid\"><a href=\"#contentsinspectsharedworkerbyidworkerid\"><code>contents.inspectSharedWorkerById(workerId)</code></a></h4>\n<ul>\n<li><code>workerId</code> String</li>\n</ul>\n<p>ID に基づいて共有ワーカーのインスペクターを起動します。</p>\n<h4 id=\"contentsgetallsharedworkers\"><a href=\"#contentsgetallsharedworkers\"><code>contents.getAllSharedWorkers()</code></a></h4>\n<p>戻り値 <a href=\"/docs/api/structures/shared-worker-info\"><code>SharedWorkerInfo[]</code></a> - すべての共有ワーカーに関する情報。</p>\n<h4 id=\"contentsinspectserviceworker\"><a href=\"#contentsinspectserviceworker\"><code>contents.inspectServiceWorker()</code></a></h4>\n<p>サービスワーカコンテキストの開発者向けツールを開きます。</p>\n<h4 id=\"contentssendchannel-args\"><a href=\"#contentssendchannel-args\"><code>contents.send(channel, ...args)</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>引数と共に、<code>channel</code> を介してレンダラープロセスに非同期メッセージを送信します。 引数は <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>postMessage</code></a> と同じように <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">構造化複製アルゴリズム</a> によってシリアライズされるため、プロトタイプチェーンは含まれません。 関数、Promise、Symbol、WeakMap、WeakSet の送信は、例外が送出されます。</p>\n<blockquote>\n<p><strong>注意</strong>: DOM オブジェクトや特殊な Electron オブジェクトなど、非標準の JavaScript 型を送信すると例外が発生します。</p>\n</blockquote>\n<p>レンダラープロセスは <code>ipcRenderer</code> モジュールで <a href=\"/docs/api/ipc-renderer\"><code>channel</code></a> を聞いてメッセージを処理できます。</p>\n<p>以下はメインプロセスからレンダラープロセスにメッセージを送る例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// メインプロセス</span>\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/index.html`</span>)\n  win.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n    win.webContents.send(<span class=\"hljs-string\">'ping'</span>, <span class=\"hljs-string\">'whoooooooh!'</span>)\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- index.html --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n    <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).ipcRenderer.on(<span class=\"hljs-string\">'ping'</span>, (event, message) => {\n      <span class=\"hljs-built_in\">console</span>.log(message) <span class=\"hljs-comment\">// Prints 'whoooooooh!'</span>\n    })\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<h4 id=\"contentssendtoframeframeid-channel-args\"><a href=\"#contentssendtoframeframeid-channel-args\"><code>contents.sendToFrame(frameId, channel, ...args)</code></a></h4>\n<ul>\n<li><code>frameId</code> Integer | [number, number] - 送信先のフレームの ID、またはフレームがメインフレームと異なるプロセスにある場合に <code>[processId, frameId]</code> の組み合わせを指定します。</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>引数と共に、<code>channel</code> を介してレンダラープロセス内の指定のフレームに非同期メッセージを送信します。 引数は <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>postMessage</code></a> と同じように <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">構造化複製アルゴリズム</a> によってシリアライズされるため、プロトタイプチェーンは含まれません。 関数、Promise、Symbol、WeakMap、WeakSet の送信は、例外が送出されます。</p>\n<blockquote>\n<p><strong>注意:</strong> DOM オブジェクトや特殊な Electron オブジェクトなど、非標準の JavaScript 型を送信すると例外が発生します。</p>\n</blockquote>\n<p>レンダラープロセスは <code>ipcRenderer</code> モジュールで <a href=\"/docs/api/ipc-renderer\"><code>channel</code></a> を聞いてメッセージを処理できます。</p>\n<p>与えられたレンダラーコンテキストの <code>frameId</code> を取得したい場合は、<code>webFrame.routingId</code> の値を使用します。  以下は例です。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// レンダラープロセス内</span>\n<span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'My frameId is:'</span>, <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).webFrame.routingId)\n</code></pre>\n<p>メインプロセス内の受信した IPC メッセージすべてから <code>frameId</code> を読み取ることもできます。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// メインプロセス内</span>\nipcMain.on(<span class=\"hljs-string\">'ping'</span>, (event) => {\n  <span class=\"hljs-built_in\">console</span>.info(<span class=\"hljs-string\">'Message came from frameId:'</span>, event.frameId)\n})\n</code></pre>\n<h4 id=\"contentspostmessagechannel-message-transfer\"><a href=\"#contentspostmessagechannel-message-transfer\"><code>contents.postMessage(channel, message, [transfer])</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a></li>\n</ul>\n<p>レンダラープロセスにメッセージを送信し、任意で 0 個以上の [<code>MessagePortMain</code>][] オブジェクトの所有権を転送します。</p>\n<p>転送された <code>MessagePortMain</code> オブジェクトは、レンダラープロセスで発生したイベントの <code>ports</code> プロパティにアクセスすれば利用できます。 レンダラーに着くと、それらはネイティブの DOM <code>MessagePort</code> オブジェクトになります。</p>\n<p>以下がその例です。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// メインプロセス</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nwebContents.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// レンダラープロセス</span>\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<h4 id=\"contentsenabledeviceemulationparameters\"><a href=\"#contentsenabledeviceemulationparameters\"><code>contents.enableDeviceEmulation(parameters)</code></a></h4>\n<ul>\n<li><code>parameters</code> Object<ul>\n<li><code>screenPosition</code> String - エミュレートする画面の種類を以下から指定します (省略値: <code>desktop</code>)。<ul>\n<li><code>desktop</code> - デスクトップ画面タイプ.</li>\n<li><code>mobile</code> - モバイル画面タイプ.</li>\n</ul></li>\n<li><code>screenSize</code> <a href=\"/docs/api/structures/size\">Size</a> - エミュレートされる画面サイズの設定 (screenPosition == mobile).</li>\n<li><code>viewPosition</code> <a href=\"/docs/api/structures/point\">Point</a> - スクリーン上のビューの位置 (screenPosition == mobile) (省略値: <code>{ x: 0, y: 0 }</code>).</li>\n<li><code>deviceScaleFactor</code> Integer - デバイスの拡大率の設定 (ゼロなら元々のデバイスの拡大率) (省略値: <code>0</code>).</li>\n<li><code>screenSize</code> <a href=\"/docs/api/structures/size\">Size</a> - エミュレートされるビューのサイズの設定 (空は上書きしないことを意味する)</li>\n<li><code>scale</code> Float - 有効なスペース内のエミュレートするビューの拡大率。 (表示モードにフィットしない) (省略値: <code>1</code>).</li>\n</ul></li>\n</ul>\n<p>与えられた引数でデバイスのエミュレートを有効にします</p>\n<h4 id=\"contentsdisabledeviceemulation\"><a href=\"#contentsdisabledeviceemulation\"><code>contents.disableDeviceEmulation()</code></a></h4>\n<p><code>webContents.enableDeviceEmulation</code> で有効にしたデバイスのエミュレートを向こうにします。</p>\n<h4 id=\"contentssendinputeventinputevent\"><a href=\"#contentssendinputeventinputevent\"><code>contents.sendInputEvent(inputEvent)</code></a></h4>\n<ul>\n<li><code>inputEvent</code> <a href=\"/docs/api/structures/mouse-input-event\">MouseInputEvent</a> | <a href=\"/docs/api/structures/mouse-wheel-input-event\">MouseWheelInputEvent</a> | <a href=\"/docs/api/structures/keyboard-input-event\">KeyboardInputEvent</a></li>\n</ul>\n<p>入力 <code>event</code> をページに送ります。 <strong>注釈:</strong> <code>sendInputEvent()</code> が動くには、そのコンテツを含む <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> がフォーカスされている必要があります。</p>\n<h4 id=\"contentsbeginframesubscriptiononlydirty-callback\"><a href=\"#contentsbeginframesubscriptiononlydirty-callback\"><code>contents.beginFrameSubscription([onlyDirty ,]callback)</code></a></h4>\n<ul>\n<li><code>onlyDirty</code> Boolean (任意) - 省略値は <code>false</code>。</li>\n<li><code>callback</code> Function<ul>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a></li>\n<li><code>dirtyRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul></li>\n</ul>\n<p>プレゼンテーションイベントとキャプチャされたフレームの監視を開始し、プレゼンテーションイベントがあれば、<code>callbabck</code> が <code>callback(image, dirtyRect)</code> で呼ばれます。</p>\n<p><code>image</code> はキャプチャされたフレームを格納する <a href=\"/docs/api/native-image\">NativeImage</a> のインスタンスです。</p>\n<p><code>dirtyRect</code> は 再描画されたページの部分を示す <code>x, y, width, height</code> プロパティのオブジェクトです。 もし <code>onlyDirty</code> が <code>true</code> にセットされている場合、<code>image</code> は再描画された領域だけを含みます。 <code>onlyDirty</code> の省略値は <code>false</code> です。</p>\n<h4 id=\"contentsendframesubscription\"><a href=\"#contentsendframesubscription\"><code>contents.endFrameSubscription()</code></a></h4>\n<p>フレームプレゼンテーションイベントの監視を終了します。</p>\n<h4 id=\"contentsstartdragitem\"><a href=\"#contentsstartdragitem\"><code>contents.startDrag(item)</code></a></h4>\n<ul>\n<li><code>item</code> Object<ul>\n<li><code>file</code> String - ドラッグされているファイルのパス。</li>\n<li><code>files</code> String<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> - ドラッグされている複数ファイルのパス。 (<code>files</code> は <code>file</code> フィールドより優先されます)</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String - 画像です。macOS では空にできません。</li>\n</ul></li>\n</ul>\n<p>現在の D&#x26;D 操作のドラッグアイテムに <code>item</code> をセットします。<code>file</code> はドラッグされるファイルへの絶対パスで、<code>icon</code> はドラッグするときにカーソルの下に表示される画像です。</p>\n<h4 id=\"contentssavepagefullpath-savetype\"><a href=\"#contentssavepagefullpath-savetype\"><code>contents.savePage(fullPath, saveType)</code></a></h4>\n<ul>\n<li><code>fullPath</code> String - 完全なファイルパス。</li>\n<li><code>saveType</code> String - 保存のタイプを指定します。<ul>\n<li><code>HTMLOnly</code> - ページの HTML だけを保存する。</li>\n<li><code>HTMLComplete</code> - 完全な HTML ページを保存する。</li>\n<li><code>MHTML</code> - MHTML として完全な HTML ページを保存する。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - ページが保存された場合に実行されます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\nwin.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  win.webContents.savePage(<span class=\"hljs-string\">'/tmp/test.html'</span>, <span class=\"hljs-string\">'HTMLComplete'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Page was saved successfully.'</span>)\n  }).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(err)\n  })\n})\n</code></pre>\n<h4 id=\"contentsshowdefinitionforselection-macos\"><a href=\"#contentsshowdefinitionforselection-macos\"><code>contents.showDefinitionForSelection()</code> <em>macOS</em></a></h4>\n<p>ページ上の選択された単語を検索するポップアップ辞書を表示します。</p>\n<h4 id=\"contentsisoffscreen\"><a href=\"#contentsisoffscreen\"><code>contents.isOffscreen()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - <em>オフスクリーンレンダリング</em> が有効にされているかどうかを示す。</p>\n<h4 id=\"contentsstartpainting\"><a href=\"#contentsstartpainting\"><code>contents.startPainting()</code></a></h4>\n<p>もし <em>オフスクリーンレンダリング</em> が有効かつ描画中でなければ、描画を開始します。</p>\n<h4 id=\"contentsstoppainting\"><a href=\"#contentsstoppainting\"><code>contents.stopPainting()</code></a></h4>\n<p>もし <em>オフスクリーンレンダリング</em> が有効かつ描画中であれば、描画を終了します。</p>\n<h4 id=\"contentsispainting\"><a href=\"#contentsispainting\"><code>contents.isPainting()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - もし <em>オフスクリーンレンダリング</em> が有効であれば、現在描画中かどうかを返します。</p>\n<h4 id=\"contentssetframeratefps\"><a href=\"#contentssetframeratefps\"><code>contents.setFrameRate(fps)</code></a></h4>\n<ul>\n<li><code>fps</code> Integer</li>\n</ul>\n<p>もし <em>オフスクリーンレンダリング</em> が有効であれば指定された数字にフレームレートをセットします。 1 から 240 の値のみを受け取ります。</p>\n<h4 id=\"contentsgetframerate\"><a href=\"#contentsgetframerate\"><code>contents.getFrameRate()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - もし <em>オフスクリーンレンダリング</em> が有効であれば、現在のフレームレートを返します。</p>\n<h4 id=\"contentsinvalidate\"><a href=\"#contentsinvalidate\"><code>contents.invalidate()</code></a></h4>\n<p>このウェブコンテンツが入っているウインドウの完全な再描画をスケジュールします。</p>\n<p>もし <em>オフスクリーンレンダリング</em> が有効であれば、フレームを無効にし、<code>'paint'</code> を通して新しいフレームを生成します。</p>\n<h4 id=\"contentsgetwebrtciphandlingpolicy\"><a href=\"#contentsgetwebrtciphandlingpolicy\"><code>contents.getWebRTCIPHandlingPolicy()</code></a></h4>\n<p>戻り値 <code>String</code> - WebRTC IP ハンドリングポリシーを返します。</p>\n<h4 id=\"contentssetwebrtciphandlingpolicypolicy\"><a href=\"#contentssetwebrtciphandlingpolicypolicy\"><code>contents.setWebRTCIPHandlingPolicy(policy)</code></a></h4>\n<ul>\n<li><code>policy</code> String - WebRTC IP ハンドリングポリシーを指定します。<ul>\n<li><code>default</code> - ユーザの公開IPとローカルIPを公開します。 これはデフォルトの動作です。 このポリシーが使用されるとき、WebRTC には、すべてのインターフェースを列挙し、それらを結合して公開インターフェースを検出する権利があります。</li>\n<li><code>default_public_interface_only</code> - ユーザの公開IPを公開しますが、ユーザのローカルIPは公開しません。 このポリシーが使用されるとき、WebRTC は HTTP が使用するデフォルトのルートのみを使用する必要があります。 これはどのローカルアドレスも公開しません。</li>\n<li><code>default_public_and_private_interfaces</code> - ユーザの公開IPとローカルIPを公開します。 このポリシーが使用されるとき、WebRTC は HTTP が使用するデフォルトのルートのみを使用する必要があります。 これは関連するデフォルトのプライベートアドレスも公開します。 デフォルトルートは、マルチホームのエンドポイント上で OS によって選択されたルートです。</li>\n<li><code>disable_non_proxied_udp</code> - パブリック IP やローカル IP を非公開にします。 このポリシーが使用される WebRTC は、プロキシサーバーが UDP をサポートしていない限り、TCP を使用してピアまたはサーバーに接続する必要があります。</li>\n</ul></li>\n</ul>\n<p>WebRTC IP ハンドリングポリシーを設定すると、WebRTC を介して公開される IP を制御できます。 より詳しくは <a href=\"https://browserleaks.com/webrtc\">BrowserLeaks</a> を参照して下さい。</p>\n<h4 id=\"contentsgetosprocessid\"><a href=\"#contentsgetosprocessid\"><code>contents.getOSProcessId()</code></a></h4>\n<p>戻り値 <code>Integer</code> - 関連するレンダラープロセスのオペレーティングシステムの <code>pid</code>。</p>\n<h4 id=\"contentsgetprocessid\"><a href=\"#contentsgetprocessid\"><code>contents.getProcessId()</code></a></h4>\n<p>戻り値 <code>Integer</code> - 関連するレンダラーの Chromium 内部の <code>pid</code>。 フレーム特有のナビゲーションイベント (<code>did-frame-navigate</code> など) で渡される <code>frameProcessId</code> と比較できます。</p>\n<h4 id=\"contentstakeheapsnapshotfilepath\"><a href=\"#contentstakeheapsnapshotfilepath\"><code>contents.takeHeapSnapshot(filePath)</code></a></h4>\n<ul>\n<li><code>filePath</code> String - 出力ファイルのパス</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - スナップショットの作成が成功したかどうかを示します。</p>\n<p>V8 ヒープのスナップショットを撮り、それを <code>filePath</code> に保存します。</p>\n<h4 id=\"contentsgetbackgroundthrottling\"><a href=\"#contentsgetbackgroundthrottling\"><code>contents.getBackgroundThrottling()</code></a></h4>\n<p>戻り値 <code>Boolean</code> - ページがバックグラウンドになったときに、この WebContents がアニメーションやタイマーを抑制するかどうか。 これは Page Visibility API にも影響を与えます。</p>\n<h4 id=\"contentssetbackgroundthrottlingallowed\"><a href=\"#contentssetbackgroundthrottlingallowed\"><code>contents.setBackgroundThrottling(allowed)</code></a></h4>\n<ul>\n<li><code>allowed</code> Boolean</li>\n</ul>\n<p>ページがバックグラウンドになったときにこの WebContents がアニメーションとタイマーを抑制するかどうかを制御します。 これは Page Visibility API にも影響を与えます。</p>\n<h4 id=\"contentsgettype\"><a href=\"#contentsgettype\"><code>contents.getType()</code></a></h4>\n<p>Returns <code>String</code> - webContents の型。 <code>backgroundPage</code>、<code>window</code>、<code>browserView</code>、<code>remote</code>、<code>webview</code> か <code>offscreen</code> になります。</p>\n<h4 id=\"contentssetimageanimationpolicypolicy\"><a href=\"#contentssetimageanimationpolicypolicy\"><code>contents.setImageAnimationPolicy(policy)</code></a></h4>\n<ul>\n<li><code>policy</code> String - <code>animate</code>、<code>animateOnce</code> か <code>noAnimation</code> にできます。</li>\n</ul>\n<p>この webContents の画像アニメーションポリシーを設定します。  このポリシーは <em>新しく読み込まれた</em> 画像にのみ適用され、現在アニメーションを行っている既存の画像は影響を受けません。 これは Chromium の既知の制限で、<code>img.src = img.src</code> とすることで画像のアニメーションを強制的に再計算させられます。この場合、ネットワークトラフィックは発生しませんが、アニメーションポリシーが更新されます。</p>\n<p>これは、Chromium のアクセシビリティ機能である <a href=\"https://developer.chrome.com/docs/extensions/reference/accessibilityFeatures/#property-animationPolicy\">animationPolicy</a> に対応します。</p>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<h4 id=\"contentsaudiomuted\"><a href=\"#contentsaudiomuted\"><code>contents.audioMuted</code></a></h4>\n<p>このページをミュートするかどうかを決定する <code>Boolean</code> プロパティ。</p>\n<h4 id=\"contentsuseragent\"><a href=\"#contentsuseragent\"><code>contents.userAgent</code></a></h4>\n<p>このウェブページのユーザーエージェントを決定する <code>String</code> プロパティ。</p>\n<h4 id=\"contentszoomlevel\"><a href=\"#contentszoomlevel\"><code>contents.zoomLevel</code></a></h4>\n<p>このウェブコンテンツのズームレベルを決定する <code>Number</code> プロパティ。</p>\n<p>原寸は 0 で、各増減分はそれぞれ 20% ずつの拡大または縮小を表し、デフォルトで元のサイズの 300% から 50% までに制限されています。 The formula for this is <code>scale := 1.2 ^ level</code>.</p>\n<h4 id=\"contentszoomfactor\"><a href=\"#contentszoomfactor\"><code>contents.zoomFactor</code></a></h4>\n<p><code>Number</code> 型のプロパティです。このウェブコンテンツのズーム率を決定します。</p>\n<p>ズーム率は百分率のズームなので、300% = 3.0 になります。</p>\n<h4 id=\"contentsframerate\"><a href=\"#contentsframerate\"><code>contents.frameRate</code></a></h4>\n<p><code>Integer</code> 型のプロパティです。ウェブコンテンツのフレームレートを指定された数値に設定します。 1 から 240 の値のみを受け取ります。</p>\n<p><em>オフスクリーンレンダリング</em> が有効な場合にのみ適用されます。</p>\n<h4 id=\"contentsid-読み出し専用\"><a href=\"#contentsid-読み出し専用\"><code>contents.id</code> <em>読み出し専用</em></a></h4>\n<p>この WebContents の一意のIDを表す <code>Integer</code>。 各 ID は、この Electron アプリケーション全体のすべての <code>WebContents</code> インスタンス間で一意です。</p>\n<h4 id=\"contentssession-読み出し専用\"><a href=\"#contentssession-読み出し専用\"><code>contents.session</code> <em>読み出し専用</em></a></h4>\n<p>この webContents で使われる <a href=\"/docs/api/session\"><code>Session</code></a>。</p>\n<h4 id=\"contentshostwebcontents-読み出し専用\"><a href=\"#contentshostwebcontents-読み出し専用\"><code>contents.hostWebContents</code> <em>読み出し専用</em></a></h4>\n<p>この <code>WebContents</code> を所有するかもしれない <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> インスタンス。</p>\n<h4 id=\"contentsdevtoolswebcontents-読み出し専用\"><a href=\"#contentsdevtoolswebcontents-読み出し専用\"><code>contents.devToolsWebContents</code> <em>読み出し専用</em></a></h4>\n<p><code>WebContents | null</code> 型のプロパティ。その <code>WebContents</code> に関連付けられたデベロッパー ツール の <code>WebContents</code> を表します。</p>\n<p><strong>注釈:</strong> 開発者向けツールが閉じられたときに <code>null</code> になる可能性があるので、このオブジェクトは決して格納しないで下さい。</p>\n<h4 id=\"contentsdebugger-読み出し専用\"><a href=\"#contentsdebugger-読み出し専用\"><code>contents.debugger</code> <em>読み出し専用</em></a></h4>\n<p>この webContents の <a href=\"/docs/api/debugger\"><code>Debugger</code></a> インスタンス。</p>\n<h4 id=\"contentsbackgroundthrottling\"><a href=\"#contentsbackgroundthrottling\"><code>contents.backgroundThrottling</code></a></h4>\n<p><code>Boolean</code> 型のプロパティです。ページがバックグラウンドになったときに、この WebContents がアニメーションやタイマーを抑制するかどうかを決定します。 これは Page Visibility API にも影響を与えます。</p>\n<h4 id=\"contentsmainframe-読み出し専用\"><a href=\"#contentsmainframe-読み出し専用\"><code>contents.mainFrame</code> <em>読み出し専用</em></a></h4>\n<p><a href=\"/docs/api/web-frame-main\"><code>WebFrameMain</code></a> 型のプロパティで、ページの最上位階層のフレームを表します。</p>",
      "title": "webContents",
      "description": "ウェブページを描画、制御します。"
    },
    "/docs/tutorial/web-embeds": {
      "locale": "ja-JP",
      "slug": "web-embeds",
      "href": "/docs/tutorial/web-embeds",
      "crowdinFileId": "256269",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/web-embeds.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ウェブ埋め込み\"><a href=\"#ウェブ埋め込み\">ウェブ埋め込み</a></h1>\n<h2 id=\"概要\"><a href=\"#概要\">概要</a></h2>\n<p>Electron の <code>BrowserWindow</code> に (サードパーティ) ウェブコンテンツを埋め込みたい場合は、<code>&#x3C;iframe></code> タグ、<code>&#x3C;webview></code> タグ、 <code>BrowserView</code> の 3 つの選択肢があります。 それぞれ多少の異なる機能を提供しており、さまざまな状況で役立ちます。 これらの選択を支援するため、このガイドではそれぞれの選択肢の違いと機能について説明します。</p>\n<h3 id=\"iframe\"><a href=\"#iframe\">iframe</a></h3>\n<p>Electron の iframe は一般的なブラウザの iframe のように動作します。 <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP\">コンテンツセキュリティポリシー</a> で許可されている場合、ページの <code>&#x3C;iframe></code> 要素に外部ウェブページを表示できます。 <code>&#x3C;iframe></code> タグ内のサイト機能を制限するために、<a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox\"><code>sandbox</code> 属性</a> を使用してサポートしたい機能のみを許可することを推奨します。</p>\n<h3 id=\"webview\"><a href=\"#webview\">WebView</a></h3>\n<blockquote>\n<p>重要な注意: WebView タグはアプリケーションの安定性に影響を与えうる劇的なアーキテクチャ変更を受けているため、<a href=\"/docs/api/webview-tag#warning\">これの利用は非推奨です</a>。 <code>iframe</code> や Electron の <code>BrowserView</code> のような代替品や、設計の段階からコンテンツ埋め込みを避けるアーキテクチャへ切り替えるように検討してください。</p>\n</blockquote>\n<p><a href=\"/docs/api/webview-tag\">WebView</a> は Chromium の WebView が基ですが、Electron は明示的にサポートしていません。 将来の Electron のバージョンでも WebView API が利用できる保証はありません。 <code>&#x3C;webview></code> タグを使用する場合、<code>BrowserWindow</code> の <code>webPreferences</code> に内で <code>webviewTag</code> を <code>true</code> に設定する必要があります。</p>\n<p>WebView は、Electron 内でのみ機能するカスタム要素 (<code>&#x3C;webview></code>) です。 これは \"プロセス外 iframe\" として実装されています。 つまり、<code>&#x3C;webview></code> とのすべての通信は IPC を用いて非同期的に行われます。 <code>&#x3C;webview></code> 要素には、<code>webContents</code> と同様に多くのカスタムメソッドとイベントがあり、コンテンツのより広い制御を提供します。</p>\n<p><code>&#x3C;iframe></code> と比較して <code>&#x3C;webview></code> はやや遅い傾向がありますが、サードパーティコンテンツのロード、通信など、さまざまなイベントの処理をより広く制御できます。</p>\n<h3 id=\"browserview\"><a href=\"#browserview\">BrowserView</a></h3>\n<p><a href=\"/docs/api/browser-view\">BrowserView</a> は DOM の一部ではなく、メインプロセスで作成および制御されます。 これは、単に既存のウインドウ上に別のレイヤーでウェブコンテンツがあるだけです。 つまり、作成してある <code>BrowserWindow</code> のコンテンツから完全に分離され、その位置は DOM や CSS によって制御されません。 その代わり、メインプロセスで領域を設定して制御します。</p>\n<p><code>BrowserView</code> は <code>BrowserWindow</code> の動作と同じになる様に <code>webContents</code> を実装しているので、コンテンツに対して最大限の制御を提供できます。 しかし、<code>BrowserView</code> は DOM の一部ではなく画面上に重ねてあるだけなので、その位置は手動で管理する必要があります。</p>",
      "title": "ウェブ埋め込み",
      "description": "重要な注意: WebView タグはアプリケーションの安定性に影響を与えうる劇的なアーキテクチャ変更を受けているため、これの利用は非推奨です。 iframe や Electron の BrowserView のような代替品や、設計の段階からコンテンツ埋め込みを避けるアーキテクチャへ切り替えるように検討してください。"
    },
    "/docs/api/web-frame": {
      "locale": "ja-JP",
      "slug": "web-frame",
      "href": "/docs/api/web-frame",
      "crowdinFileId": "256403",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-frame.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webframe\"><a href=\"#webframe\">webFrame</a></h1>\n<blockquote>\n<p>現在のウェブページの描画をカスタマイズします。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p><code>webFrame</code> は現在の <code>BrowserWindow</code> のトップフレームで表示されている <code>WebFrame</code> クラスのインスタンスをエクスポートする Electron のモジュールです。 サブフレームは特定のプロパティとメソッド (<code>webFrame.firstChild</code> など) によって取得されます。</p>\n<p>現在のページを 200% にズームするサンプルです。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nwebFrame.setZoomFactor(<span class=\"hljs-number\">2</span>)\n</code></pre>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>WebFrame</code>クラスには以下のメソッドがあります。</p>\n<h3 id=\"webframesetzoomfactorfactor\"><a href=\"#webframesetzoomfactorfactor\"><code>webFrame.setZoomFactor(factor)</code></a></h3>\n<ul>\n<li><code>factor</code> Double - 拡大率。省略値は 1.0 です。</li>\n</ul>\n<p>指定の拡大率に変更します。 拡大率は百分率なので、300% = 3.0 です。</p>\n<p>拡大率は 0.0 より大きい必要があります。</p>\n<h3 id=\"webframegetzoomfactor\"><a href=\"#webframegetzoomfactor\"><code>webFrame.getZoomFactor()</code></a></h3>\n<p>戻り値 <code>Number</code> - 現在の拡大率。</p>\n<h3 id=\"webframesetzoomlevellevel\"><a href=\"#webframesetzoomlevellevel\"><code>webFrame.setZoomLevel(level)</code></a></h3>\n<ul>\n<li><code>level</code> Number - 拡大レベル。</li>\n</ul>\n<p>指定レベルに拡大レベルを変更します。 原寸は 0 で、各増減分はそれぞれ 20% ずつの拡大または縮小を表し、デフォルトで元のサイズの 300% から 50% までに制限されています。</p>\n<blockquote>\n<p><strong>注意</strong>: Chromium でのズームポリシーはドメインごとです。すなわち、特定ドメインのズームレベルは、同じドメインのウィンドウの全インスタンスに伝播します。 ウインドウの URL が別々であれば、ウインドウごとのズームになります。</p>\n</blockquote>\n<h3 id=\"webframegetzoomlevel\"><a href=\"#webframegetzoomlevel\"><code>webFrame.getZoomLevel()</code></a></h3>\n<p>戻り値 <code>Number</code> - 現在の拡大レベル。</p>\n<h3 id=\"webframesetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#webframesetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>webFrame.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h3>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>ピンチによる拡大レベルの最大値と最小値を設定します。</p>\n<blockquote>\n<p><strong>注意</strong>: Electron ではデフォルトで視覚ズームは無効化されています。 再び有効にする場合は以下を呼び出します。</p>\n<pre><code class=\"hljs language-js\">webFrame.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">3</span>)\n</code></pre>\n</blockquote>\n<blockquote>\n<p><strong>注意</strong>: 視覚ズームはピンチによるズームの動作でのみ適用されます。 Cmd+/-/0 ズームのショートカットは、それぞれアプリケーションの Menu の 'zoomIn'、'zoomOut'、'resetZoom' の MenuItem ロールで制御されます。 ショートカットを無効にするには、手動で <a href=\"/docs/api/menu#examples\">Menu の定義</a> を行い、定義からズームのロールを除きます。</p>\n</blockquote>\n<h3 id=\"webframesetspellcheckproviderlanguage-provider\"><a href=\"#webframesetspellcheckproviderlanguage-provider\"><code>webFrame.setSpellCheckProvider(language, provider)</code></a></h3>\n<ul>\n<li><code>language</code> String</li>\n<li><code>provider</code> Object<ul>\n<li><code>spellCheck</code> Function<ul>\n<li><code>words</code> String[]</li>\n<li><code>callback</code> Function<ul>\n<li><code>misspeltWords</code> String[]</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>入力フィールドとテキストエリアのスペルチェックのプロバイダを設定します。</p>\n<p>このメソッドを使用する場合は、ウインドウを構築するときに組み込みスペルチェックを無効にする必要があります。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">spellcheck</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\n</code></pre>\n<p><code>provider</code> は、スペルチェックのために個々の単語の配列を受け取る <code>spellCheck</code> メソッドを持つオブジェクトである必要があります。 <code>spellCheck</code> 関数は非同期的に実行され、完了時にスペルミスの単語を含む <code>callback</code> 関数を呼び出します。</p>\n<p><a href=\"https://github.com/atom/node-spellchecker\">node-spellchecker</a> をプロバイダとして使用するサンプルです。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> spellChecker = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spellchecker'</span>)\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, {\n  spellCheck (words, callback) {\n    setTimeout(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      <span class=\"hljs-keyword\">const</span> spellchecker = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spellchecker'</span>)\n      <span class=\"hljs-keyword\">const</span> misspelled = words.filter(<span class=\"hljs-function\"><span class=\"hljs-params\">x</span> =></span> spellchecker.isMisspelled(x))\n      callback(misspelled)\n    }, <span class=\"hljs-number\">0</span>)\n  }\n})\n</code></pre>\n<h3 id=\"webframeinsertcsscss\"><a href=\"#webframeinsertcsscss\"><code>webFrame.insertCSS(css)</code></a></h3>\n<ul>\n<li><code>css</code> String - CSS ソースコード。</li>\n</ul>\n<p>戻り値 <code>String</code> - 挿入された CSS のキー。後で <code>webFrame.removeInsertedCSS(key)</code> を介して CSS を削除するために使用できます。</p>\n<p>現在のウェブページに CSS を挿入し、挿入されたスタイルシートの一意なキーを返します。</p>\n<h3 id=\"webframeremoveinsertedcsskey\"><a href=\"#webframeremoveinsertedcsskey\"><code>webFrame.removeInsertedCSS(key)</code></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>現在のウェブページから挿入された CSS を削除します。 スタイルシートは <code>webFrame.insertCSS(css)</code> から返されるキーで識別されます。</p>\n<h3 id=\"webframeinserttexttext\"><a href=\"#webframeinserttexttext\"><code>webFrame.insertText(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>フォーカスされた要素に <code>text</code> を挿入します。</p>\n<h3 id=\"webframeexecutejavascriptcode-usergesture-callback\"><a href=\"#webframeexecutejavascriptcode-usergesture-callback\"><code>webFrame.executeJavaScript(code[, userGesture, callback])</code></a></h3>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (任意) - 省略値は <code>false</code>。</li>\n<li><code>callback</code> Function (任意) - スクリプトの実行後に呼び出されます。 フレームがサスペンド (モーダルアラートの表示など) されない限り、実行は同期的に行われ、メソッドから戻る前にコールバックが呼び出されます。 このメソッドは古いバージョンとの互換性のため、エラーが第 2 引数です。<ul>\n<li><code>result</code> Any</li>\n<li><code>error</code> Error</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;any></code> - 実行されたコードの結果で resolve されるか、実行でスロー又は reject された結果の場合に reject される Promise。</p>\n<p>ページ内の <code>code</code> を評価します。</p>\n<p>ブラウザウインドウでは、<code>requestFullScreen</code> のような、いくつかの HTML API は、ユーザからのジェスチャーでのみ呼び出されます。 <code>userGesture</code> を <code>true</code> にセットすることでこの制限がなくなります。</p>\n<h3 id=\"webframeexecutejavascriptinisolatedworldworldid-scripts-usergesture-callback\"><a href=\"#webframeexecutejavascriptinisolatedworldworldid-scripts-usergesture-callback\"><code>webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture, callback])</code></a></h3>\n<ul>\n<li><code>worldId</code> Integer - <code>0</code> は (コンテンツを実行する) デフォルトのメインワールド、<code>999</code> は Electron の <code>contextIsolation</code> 機能で使用されるワールドです。 1..536870911 の範囲の値を受け付けます。</li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/web-source\">WebSource[]</a></li>\n<li><code>userGesture</code> Boolean (任意) - 省略値は <code>false</code>。</li>\n<li><code>callback</code> Function (任意) - スクリプトの実行後に呼び出されます。 フレームがサスペンド (モーダルアラートの表示など) されない限り、実行は同期的に行われ、メソッドから戻る前にコールバックが呼び出されます。  このメソッドは古いバージョンとの互換性のため、エラーが第 2 引数です。<ul>\n<li><code>result</code> Any</li>\n<li><code>error</code> Error</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;any></code> - コードの実行結果で resolve するか、実行を開始できなかった場合に reject される Promise。</p>\n<p><code>executeJavaScript</code> のように動きますが、 <code>scripts</code> はイソレートコンテキスト内で評価します。</p>\n<p>スクリプトの実行そのものが失敗した場合、返された Promise 拒否されず <code>result</code> は <code>undefined</code> になることに注意してください。 これは、Chromium が隔離されたワールドから外のワールドへエラーを転送しないためです。</p>\n<h3 id=\"webframesetisolatedworldinfoworldid-info\"><a href=\"#webframesetisolatedworldinfoworldid-info\"><code>webFrame.setIsolatedWorldInfo(worldId, info)</code></a></h3>\n<ul>\n<li><code>worldId</code> Integer - JavaScript を実行するワールドの ID。<code>0</code> はデフォルトのワールドで、<code>999</code> は Electron の <code>contextIsolation</code> 機能で使用されるワールドです。 Chrome 拡張機能の ID は <code>[1 &#x3C;&#x3C; 20, 1 &#x3C;&#x3C; 29)</code> の範囲で確保します。 任意の整数を指定できます。</li>\n<li><code>info</code> Object<ul>\n<li><code>securityOrigin</code> String (任意) - 隔離された空間のためのセキュリティオリジン</li>\n<li><code>csp</code> String (任意) - 隔離された空間のためのコンテンツセキュリティポリシー</li>\n<li><code>name</code> String (任意) - 隔離されたワールドの名前。 デベロッパー ツールで役立ちます。</li>\n</ul></li>\n</ul>\n<p>隔離されたワールドのセキュリティオリジン、コンテンツセキュリティポリシー、名前を設定します。 注: <code>csp</code> が指定されている場合は、<code>securityOrigin</code> も指定する必要があります。</p>\n<h3 id=\"webframegetresourceusage\"><a href=\"#webframegetresourceusage\"><code>webFrame.getResourceUsage()</code></a></h3>\n<p>戻り値 <code>Object</code>:</p>\n<ul>\n<li><code>images</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>cssStyleSheets</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>xslStyleSheets</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>fonts</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>other</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n</ul>\n<p>Blink の内部メモリキャッシュの使用情報を記述しているオブジェクトを返します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(webFrame.getResourceUsage())\n</code></pre>\n<p>これが生成されます。</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">images</span>: {\n    <span class=\"hljs-attr\">count</span>: <span class=\"hljs-number\">22</span>,\n    <span class=\"hljs-attr\">size</span>: <span class=\"hljs-number\">2549</span>,\n    <span class=\"hljs-attr\">liveSize</span>: <span class=\"hljs-number\">2542</span>\n  },\n  <span class=\"hljs-attr\">cssStyleSheets</span>: { <span class=\"hljs-comment\">/* \"images\" と同じ */</span> },\n  <span class=\"hljs-attr\">xslStyleSheets</span>: { <span class=\"hljs-comment\">/* \"images\" と同じ */</span> },\n  <span class=\"hljs-attr\">fonts</span>: { <span class=\"hljs-comment\">/* \"images\" と同じ */</span> },\n  <span class=\"hljs-attr\">other</span>: { <span class=\"hljs-comment\">/* \"images\" と同じ\" */</span> }\n}\n</code></pre>\n<h3 id=\"webframeclearcache\"><a href=\"#webframeclearcache\"><code>webFrame.clearCache()</code></a></h3>\n<p>以前使用していたメモリを解放しようとします (以前のナビゲーションの画像など)。</p>\n<p>このメソッドを盲目的に呼び出すと、空になったキャッシュを補充する必要があるため、Electron の処理速度が遅くなる可能性があることに注意してください。アプリ内のイベントが発生してページの実際のメモリ使用量が少なくなったと思われる場合にのみ呼び出すようにしてください (即ち、とても重いページから空のページへナビゲートし、そこにとどまるとき)。</p>\n<h3 id=\"webframegetframeforselectorselector\"><a href=\"#webframegetframeforselectorselector\"><code>webFrame.getFrameForSelector(selector)</code></a></h3>\n<ul>\n<li><code>selector</code> String - フレーム要素の CSS セレクタ。</li>\n</ul>\n<p>戻り値 <code>WebFrame</code> - <code>selector</code> によって選択された <code>webFrame</code> のドキュメント。<code>selector</code> がフレームを選択していないか現在のレンダラープロセスにそのフレームがない場合、<code>null</code> が返されます。</p>\n<h3 id=\"webframefindframebynamename\"><a href=\"#webframefindframebynamename\"><code>webFrame.findFrameByName(name)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n</ul>\n<p>戻り値 <code>WebFrame</code> - 与えられた <code>name</code> である <code>webFrame</code> の子。そのようなフレームが存在しないか現在のレンダラープロセスにそのフレームがない場合、<code>null</code> が返されます。</p>\n<h3 id=\"webframefindframebyroutingidroutingid\"><a href=\"#webframefindframebyroutingidroutingid\"><code>webFrame.findFrameByRoutingId(routingId)</code></a></h3>\n<ul>\n<li><code>routingId</code> Integer - 現在のレンダラープロセスでの一意なフレーム ID を表す <code>Integer</code>。 ルーティング ID は <code>WebFrame</code> インスタンス (<code>webFrame.routingId</code>) や、フレーム特有の <code>WebContents</code> ナビゲーションイベント (<code>did-frame-navigate</code> など) から取得できます。</li>\n</ul>\n<p>戻り値 <code>WebFrame</code> - 渡された <code>routingId</code> のもの。見つからなければ <code>null</code>。</p>\n<h3 id=\"webframeiswordmisspelledword\"><a href=\"#webframeiswordmisspelledword\"><code>webFrame.isWordMisspelled(word)</code></a></h3>\n<ul>\n<li><code>word</code> String - スペルチェックされる単語。</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - 組み込みスペルチェッカーでスペルミスを検知した場合は true、そうでない場合は false です。 辞書が読み込まれていない場合は、常に false を返します。</p>\n<h3 id=\"webframegetwordsuggestionsword\"><a href=\"#webframegetwordsuggestionsword\"><code>webFrame.getWordSuggestions(word)</code></a></h3>\n<ul>\n<li><code>word</code> String - スペルミスのある単語。</li>\n</ul>\n<p>戻り値 <code>String[]</code> - 指定の単語に対する候補のリスト。 単語のスペルが正しければ、結果は空です。</p>\n<h2 id=\"プロパティ\"><a href=\"#プロパティ\">プロパティ</a></h2>\n<h3 id=\"webframetop-読み出し専用\"><a href=\"#webframetop-読み出し専用\"><code>webFrame.top</code> <em>読み出し専用</em></a></h3>\n<p><code>webFrame</code> が属するフレーム階層内のトップフレームを表す <code>WebFrame | null</code>。トップフレームが現在のレンダラープロセスにない場合、プロパティは <code>null</code> になります。</p>\n<h3 id=\"webframeopener-読み出し専用\"><a href=\"#webframeopener-読み出し専用\"><code>webFrame.opener</code> <em>読み出し専用</em></a></h3>\n<p><code>webFrame</code> が開かれたフレームを表す <code>WebFrame | null</code>。開いたフレームが存在しないか現在のレンダラープロセスにない場合、プロパティは <code>null</code> になります。</p>\n<h3 id=\"webframeparent-読み出し専用\"><a href=\"#webframeparent-読み出し専用\"><code>webFrame.parent</code> <em>読み出し専用</em></a></h3>\n<p><code>webFrame</code> の親フレームを表す <code>WebFrame | null</code>。<code>webFrame</code> がトップフレームか現在のレンダラープロセスにない場合、プロパティは <code>null</code> になります。</p>\n<h3 id=\"webframefirstchild-読み出し専用\"><a href=\"#webframefirstchild-読み出し専用\"><code>webFrame.firstChild</code> <em>読み出し専用</em></a></h3>\n<p><code>webFrame</code> の最初の子フレームを表す <code>WebFrame | null</code>。<code>webFrame</code> に子フレームが存在しないか現在のレンダラープロセスにない場合、プロパティは <code>null</code> になります。</p>\n<h3 id=\"webframenextsibling-読み出し専用\"><a href=\"#webframenextsibling-読み出し専用\"><code>webFrame.nextSibling</code> <em>読み出し専用</em></a></h3>\n<p>次の兄弟フレームを表す <code>WebFrame | null</code>。<code>webFrame</code> がその親の最後の子フレームか、次の兄弟フレームが現在のレンダラープロセスにない場合、プロパティは <code>null</code> になります。</p>\n<h3 id=\"webframeroutingid-読み出し専用\"><a href=\"#webframeroutingid-読み出し専用\"><code>webFrame.routingId</code> <em>読み出し専用</em></a></h3>\n<p>現在のレンダラープロセスでの一意なフレーム ID を表す <code>Integer</code>。 同じ基底フレームを参照する WebFrame インスタンスは、同じ <code>routingId</code> を持ちます。</p>",
      "title": "webFrame",
      "description": "現在のウェブページの描画をカスタマイズします。"
    },
    "/docs/api/web-frame-main": {
      "locale": "ja-JP",
      "slug": "web-frame-main",
      "href": "/docs/api/web-frame-main",
      "crowdinFileId": "256401",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-frame-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webframemain\"><a href=\"#webframemain\">webFrameMain</a></h1>\n<blockquote>\n<p>ウェブページと iframe を制御します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>webFrameMain</code> モジュールは、既存の <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> インスタンスを横断したフレームの探索に利用できます。 ナビゲーションイベントがよくあるユースケースでしょう。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, webFrameMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://twitter.com'</span>)\n\nwin.webContents.on(\n  <span class=\"hljs-string\">'did-frame-navigate'</span>,\n  (event, url, isMainFrame, frameProcessId, frameRoutingId) => {\n    <span class=\"hljs-keyword\">const</span> frame = webFrameMain.fromId(frameProcessId, frameRoutingId)\n    <span class=\"hljs-keyword\">if</span> (frame) {\n      <span class=\"hljs-keyword\">const</span> code = <span class=\"hljs-string\">'document.body.innerHTML = document.body.innerHTML.replaceAll(\"heck\", \"h*ck\")'</span>\n      frame.executeJavaScript(code)\n    }\n  }\n)\n</code></pre>\n<p>また、<a href=\"/docs/api/web-contents\"><code>WebContents</code></a> の <code>mainFrame</code> プロパティを使用することでも既存ページのフレームへアクセスできます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">main</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  <span class=\"hljs-keyword\">await</span> win.loadURL(<span class=\"hljs-string\">'https://reddit.com'</span>)\n\n  <span class=\"hljs-keyword\">const</span> youtubeEmbeds = win.webContents.mainFrame.frames.filter(<span class=\"hljs-function\">(<span class=\"hljs-params\">frame</span>) =></span> {\n    <span class=\"hljs-keyword\">try</span> {\n      <span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-keyword\">new</span> URL(frame.url)\n      <span class=\"hljs-keyword\">return</span> url.host === <span class=\"hljs-string\">'www.youtube.com'</span>\n    } <span class=\"hljs-keyword\">catch</span> {\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n    }\n  })\n\n  <span class=\"hljs-built_in\">console</span>.log(youtubeEmbeds)\n}\n\nmain()\n</code></pre>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p>これらのメソッドは、<code>webFrameMain</code> モジュールからアクセスできます。</p>\n<h3 id=\"webframemainfromidprocessid-routingid\"><a href=\"#webframemainfromidprocessid-routingid\"><code>webFrameMain.fromId(processId, routingId)</code></a></h3>\n<ul>\n<li><code>processId</code> Integer - <code>Integer</code> 型で、そのフレームを所有しているプロセスの内部 ID を表します。</li>\n<li><code>routingId</code> Integer - <code>Integer</code> 型で、現在のレンダラープロセスでの一意なフレーム ID を表します。 ルーティング ID は、<code>WebFrameMain</code> インスタンス (<code>frame.routingId</code>) から取得できるほか、フレーム固有の <code>WebContents</code> ナビゲーションイベント (<code>did-frame-navigate</code> など) によっても渡されます。</li>\n</ul>\n<p>戻り値 <code>WebFrameMain | undefined</code> - 指定のプロセスとルーティングの ID のフレームです。指定の ID に関連付けられた WebFrameMain がない場合は <code>undefined</code> になります。</p>\n<h2 id=\"クラス-webframemain\"><a href=\"#クラス-webframemain\">クラス: WebFrameMain</a></h2>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<h3 id=\"インスタンスイベント\"><a href=\"#インスタンスイベント\">インスタンスイベント</a></h3>\n<h4 id=\"イベント-dom-ready\"><a href=\"#イベント-dom-ready\">イベント: 'dom-ready'</a></h4>\n<p>document が読み込まれたときに発生します</p>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<h4 id=\"frameexecutejavascriptcode-usergesture\"><a href=\"#frameexecutejavascriptcode-usergesture\"><code>frame.executeJavaScript(code[, userGesture])</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (任意) - 省略値は <code>false</code>。</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;unknown></code> - Promise 型で、コードの実行結果で解決され、実行で例外の送出または実行結果が拒否された Promise の場合は拒否されます。</p>\n<p>ページ内の <code>code</code> を評価します。</p>\n<p>ブラウザウインドウでは、<code>requestFullScreen</code> のような、いくつかの HTML API は、ユーザからのジェスチャーでのみ呼び出されます。 <code>userGesture</code> を <code>true</code> にセットすることでこの制限がなくなります。</p>\n<h4 id=\"framereload\"><a href=\"#framereload\"><code>frame.reload()</code></a></h4>\n<p>戻り値 <code>boolean</code> - リロードが正常に開始されたかどうか。 フレームに履歴がない場合のみ <code>false</code> になります。</p>\n<h4 id=\"framesendchannel-args\"><a href=\"#framesendchannel-args\"><code>frame.send(channel, ...args)</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>引数と共に、<code>channel</code> を介してレンダラープロセスに非同期メッセージを送信します。 引数は [<code>postMessage</code>][] と同様に [構造化複製アルゴリズム][SCA] でシリアライズされるので、プロトタイプチェーンは含まれません。 関数、Promise、Symbol、WeakMap、WeakSet の送信は、例外が送出されます。</p>\n<p>レンダラープロセスは <code>ipcRenderer</code> モジュールで <a href=\"/docs/api/ipc-renderer\"><code>channel</code></a> を聞いてメッセージを処理できます。</p>\n<h4 id=\"framepostmessagechannel-message-transfer\"><a href=\"#framepostmessagechannel-message-transfer\"><code>frame.postMessage(channel, message, [transfer])</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a></li>\n</ul>\n<p>レンダラープロセスにメッセージを送信し、任意で 0 個以上の [<code>MessagePortMain</code>][] オブジェクトの所有権を転送します。</p>\n<p>転送された <code>MessagePortMain</code> オブジェクトは、レンダラープロセスで発生したイベントの <code>ports</code> プロパティにアクセスすれば利用できます。 レンダラーに着くと、それらはネイティブの DOM <code>MessagePort</code> オブジェクトになります。</p>\n<p>以下がその例です。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// メインプロセス</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nwebContents.mainFrame.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// レンダラープロセス</span>\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<h3 id=\"インスタンスプロパティ\"><a href=\"#インスタンスプロパティ\">インスタンスプロパティ</a></h3>\n<h4 id=\"frameurl-読み出し専用\"><a href=\"#frameurl-読み出し専用\"><code>frame.url</code> <em>読み出し専用</em></a></h4>\n<p><code>string</code> 型で、そのフレームの現在の URL を表します。</p>\n<h4 id=\"frametop-読み出し専用\"><a href=\"#frametop-読み出し専用\"><code>frame.top</code> <em>読み出し専用</em></a></h4>\n<p><code>WebFrameMain | null</code> 型で、<code>frame</code> が属するフレーム階層の最上位フレームを表します。</p>\n<h4 id=\"frameparent-読み出し専用\"><a href=\"#frameparent-読み出し専用\"><code>frame.parent</code> <em>読み出し専用</em></a></h4>\n<p><code>WebFrameMain | null</code> 型で、<code>frame</code> の親フレームを表します。<code>frame</code> がそのフレーム階層の最上位フレームであれば、このプロパティは <code>null</code> です。</p>\n<h4 id=\"frameframes-読み出し専用\"><a href=\"#frameframes-読み出し専用\"><code>frame.frames</code> <em>読み出し専用</em></a></h4>\n<p><code>WebFrameMain[]</code> 型で、<code>frame</code> の直接の子フレームを格納するコレクションです。</p>\n<h4 id=\"frameframesinsubtree-読み出し専用\"><a href=\"#frameframesinsubtree-読み出し専用\"><code>frame.framesInSubtree</code> <em>読み出し専用</em></a></h4>\n<p><code>WebFrameMain[]</code> 型で、<code>frame</code> のサブツリーのうち自身を含んだ全フレームのコレクションです。 これは、すべてのフレームをトラバースするときに便利です。</p>\n<h4 id=\"frameframetreenodeid-読み出し専用\"><a href=\"#frameframetreenodeid-読み出し専用\"><code>frame.frameTreeNodeId</code> <em>読み出し専用</em></a></h4>\n<p><code>Integer</code> 型で、フレーム内部の FrameTreeNode インスタンスの ID を表します。 この ID はブラウザー内で共通となっており、コンテンツをホストするフレームを一意に識別します。 識別子はフレーム作成時に固定され、フレームが有効である間は変化しません。 フレームが削除されると、その ID が再び使用されることはありません。</p>\n<h4 id=\"framename-読み出し専用\"><a href=\"#framename-読み出し専用\"><code>frame.name</code> <em>読み出し専用</em></a></h4>\n<p><code>String</code> 型で、そのフレームの名前を表します。</p>\n<h4 id=\"frameosprocessid-読み出し専用\"><a href=\"#frameosprocessid-読み出し専用\"><code>frame.osProcessId</code> <em>読み出し専用</em></a></h4>\n<p><code>Integer</code> 型で、このフレームを所有するプロセスのオペレーティングシステムの <code>pid</code> を表します。</p>\n<h4 id=\"frameprocessid-読み出し専用\"><a href=\"#frameprocessid-読み出し専用\"><code>frame.processId</code> <em>読み出し専用</em></a></h4>\n<p><code>Integer</code> 型で、このフレームを所有するプロセスの Chromium 内部の <code>pid</code> を表します。 これは OS のプロセス ID と同じではありません。それを読み出すには <code>frame.osProcessId</code> を使用してください。</p>\n<h4 id=\"frameroutingid-読み出し専用\"><a href=\"#frameroutingid-読み出し専用\"><code>frame.routingId</code> <em>読み出し専用</em></a></h4>\n<p>現在のレンダラープロセスでの一意なフレーム ID を表す <code>Integer</code>。 同じ基底フレームを参照する <code>WebFrameMain</code> インスタンスすべては、それぞれ同じ <code>routingId</code> になります。</p>\n<h4 id=\"framevisibilitystate-読み出し専用\"><a href=\"#framevisibilitystate-読み出し専用\"><code>frame.visibilityState</code> <em>読み出し専用</em></a></h4>\n<p><code>string</code> 型で、そのフレームの <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState\">可視性の状態</a> を表します。</p>\n<p><a href=\"/docs/api/browser-window#page-visibility\">Page 可視性 API</a> が他の Electron API から受ける影響についてもご覧ください。</p>",
      "title": "webFrameMain",
      "description": "ウェブページと iframe を制御します。"
    },
    "/docs/api/web-request": {
      "locale": "ja-JP",
      "slug": "web-request",
      "href": "/docs/api/web-request",
      "crowdinFileId": "256405",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-request.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"クラス-webrequest\"><a href=\"#クラス-webrequest\">クラス: WebRequest</a></h2>\n<blockquote>\n<p>ライフタイムのさまざまな段階でリクエストのコンテンツを傍受し、変更します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#main-process\">メイン</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<p><code>WebRequest</code> クラスのインスタンスには、<code>Session</code> の <code>webRequest</code> プロパティを使用してアクセスします。</p>\n<p><code>WebRequest</code> のメソッドは、任意の <code>filter</code> と <code>listener</code> を受け取ります。 <code>listener</code> は、リクエストが終了したときに <code>listener(details)</code> で呼ばれます。 <code>details</code> オブジェクトはリクエストについて記述します。</p>\n<p>⚠️ 最後にアタッチされた <code>listener</code> のみが使用されます。 <code>null</code> を <code>listener</code> として渡すと、イベントの監視が解除されます。</p>\n<p><code>filter</code> オブジェクトには、<code>urls</code> プロパティがあります。これは、URL パターンと一致しないリクエストをフィルタリングするために使用される URL パターンの配列です。 <code>filter</code> を省略するとすべてのリクエストがマッチします。</p>\n<p>特定のイベントでは、<code>listener</code> には <code>callback</code> が渡されます。これは、<code>listener</code> が処理を終えたときに <code>response</code> オブジェクトとともに呼び出される必要があります。</p>\n<p>以下はリクエストに <code>User-Agent</code> ヘッダーを追加する例です。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// 以下の URL へのすべてのリクエストのユーザエージェントを変更します。</span>\n<span class=\"hljs-keyword\">const</span> filter = {\n  <span class=\"hljs-attr\">urls</span>: [<span class=\"hljs-string\">'https://*.github.com/*'</span>, <span class=\"hljs-string\">'*://electron.github.io'</span>]\n}\n\nsession.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback) => {\n  details.requestHeaders[<span class=\"hljs-string\">'User-Agent'</span>] = <span class=\"hljs-string\">'MyAgent'</span>\n  callback({ <span class=\"hljs-attr\">requestHeaders</span>: details.requestHeaders })\n})\n</code></pre>\n<h3 id=\"インスタンスメソッド\"><a href=\"#インスタンスメソッド\">インスタンスメソッド</a></h3>\n<p><code>WebRequest</code> のインスタンスでは、以下のメソッドが利用できます。</p>\n<h4 id=\"webrequestonbeforerequestfilter-listener\"><a href=\"#webrequestonbeforerequestfilter-listener\"><code>webRequest.onBeforeRequest([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (任意)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (任意)</li>\n<li><code>webContents</code> WebContents (任意)</li>\n<li><code>frame</code> WebFrameMain (任意)</li>\n<li><code>resourceType</code> String - <code>mainFrame</code>、<code>subFrame</code>、<code>stylesheet</code>、<code>script</code>、<code>image</code>、<code>font</code>、<code>object</code>、<code>xhr</code>、<code>ping</code>、<code>cspReport</code>、<code>media</code>、<code>webSocket</code>、<code>other</code> のいずれかにできます。</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/upload-data\">UploadData[]</a></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> Object<ul>\n<li><code>cancel</code> Boolean (任意)</li>\n<li><code>redirectURL</code> String (任意) - 元のリクエストは送信または終了されず、代わりに指定された URL にリダイレクトされます。</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p><code>listener</code> は、リクエストが発生しようとしているときに <code>listener(details, callback)</code> で呼ばれます。</p>\n<p><code>uploadData</code> は、<code>UploadData</code> オブジェクトの配列です。</p>\n<p><code>callback</code> は、<code>response</code> オブジェクトで呼ぶ必要があります。</p>\n<p>いくつか有効な <code>url</code> の例を示します。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-string\">'http://foo:1234/'</span>\n<span class=\"hljs-string\">'http://foo.com/'</span>\n<span class=\"hljs-string\">'http://foo:1234/bar'</span>\n<span class=\"hljs-string\">'*://*/*'</span>\n<span class=\"hljs-string\">'*://example.com/*'</span>\n<span class=\"hljs-string\">'*://example.com/foo/*'</span>\n<span class=\"hljs-string\">'http://*.foo:1234/'</span>\n<span class=\"hljs-string\">'file://foo:1234/bar'</span>\n<span class=\"hljs-string\">'http://foo:*/'</span>\n<span class=\"hljs-string\">'*://www.foo.com/'</span>\n</code></pre>\n<h4 id=\"webrequestonbeforesendheadersfilter-listener\"><a href=\"#webrequestonbeforesendheadersfilter-listener\"><code>webRequest.onBeforeSendHeaders([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (任意)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (任意)</li>\n<li><code>webContents</code> WebContents (任意)</li>\n<li><code>frame</code> WebFrameMain (任意)</li>\n<li><code>resourceType</code> String - <code>mainFrame</code>、<code>subFrame</code>、<code>stylesheet</code>、<code>script</code>、<code>image</code>、<code>font</code>、<code>object</code>、<code>xhr</code>、<code>ping</code>、<code>cspReport</code>、<code>media</code>、<code>webSocket</code>、<code>other</code> のいずれかにできます。</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>beforeSendResponse</code> Object<ul>\n<li><code>cancel</code> Boolean (任意)</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string | string[]> (任意) - 指定すると、これらのヘッダでリクエストが作成されます。</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>リクエストヘッダが利用可能になると、HTTP リクエストを送信する前に <code>listener</code> が <code>listener(details, callback)</code> で呼び出されます。 これは、サーバーに TCP 接続が行われた後、HTTP データが送信される前に発生する可能性があります。</p>\n<p><code>callback</code> は、<code>response</code> オブジェクトで呼ぶ必要があります。</p>\n<h4 id=\"webrequestonsendheadersfilter-listener\"><a href=\"#webrequestonsendheadersfilter-listener\"><code>webRequest.onSendHeaders([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (任意)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (任意)</li>\n<li><code>webContents</code> WebContents (任意)</li>\n<li><code>frame</code> WebFrameMain (任意)</li>\n<li><code>resourceType</code> String - <code>mainFrame</code>、<code>subFrame</code>、<code>stylesheet</code>、<code>script</code>、<code>image</code>、<code>font</code>、<code>object</code>、<code>xhr</code>、<code>ping</code>、<code>cspReport</code>、<code>media</code>、<code>webSocket</code>、<code>other</code> のいずれかにできます。</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string></li>\n</ul></li>\n</ul></li>\n</ul>\n<p><code>listener</code> は、リクエストがサーバに送信される直前に <code>listener(details)</code> で呼び出され、以前の <code>onBeforeSendHeaders</code> レスポンスの変更は、このリスナが起動される時までに表示されます。</p>\n<h4 id=\"webrequestonheadersreceivedfilter-listener\"><a href=\"#webrequestonheadersreceivedfilter-listener\"><code>webRequest.onHeadersReceived([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (任意)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (任意)</li>\n<li><code>webContents</code> WebContents (任意)</li>\n<li><code>frame</code> WebFrameMain (任意)</li>\n<li><code>resourceType</code> String - <code>mainFrame</code>、<code>subFrame</code>、<code>stylesheet</code>、<code>script</code>、<code>image</code>、<code>font</code>、<code>object</code>、<code>xhr</code>、<code>ping</code>、<code>cspReport</code>、<code>media</code>、<code>webSocket</code>、<code>other</code> のいずれかにできます。</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>statusLine</code> String</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (任意)</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>headersReceivedResponse</code> Object<ul>\n<li><code>cancel</code> Boolean (任意)</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string | string[]> (任意) - 指定すると、サーバはこれらのヘッダでレスポンスしたものとみなされます。</li>\n<li><code>statusLine</code> String (任意) - ヘッダのステータスを変更するために <code>responseHeaders</code> をオーバーライドする場合に指定する必要があります。そうしないと、元の応答ヘッダのステータスが使用されます。</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p><code>listener</code> は、HTTP リクエストのレスポンスヘッダを受信したときに <code>listener(details, callback)</code> で呼ばれます。</p>\n<p><code>callback</code> は、<code>response</code> オブジェクトで呼ぶ必要があります。</p>\n<h4 id=\"webrequestonresponsestartedfilter-listener\"><a href=\"#webrequestonresponsestartedfilter-listener\"><code>webRequest.onResponseStarted([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (任意)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (任意)</li>\n<li><code>webContents</code> WebContents (任意)</li>\n<li><code>frame</code> WebFrameMain (任意)</li>\n<li><code>resourceType</code> String - <code>mainFrame</code>、<code>subFrame</code>、<code>stylesheet</code>、<code>script</code>、<code>image</code>、<code>font</code>、<code>object</code>、<code>xhr</code>、<code>ping</code>、<code>cspReport</code>、<code>media</code>、<code>webSocket</code>、<code>other</code> のいずれかにできます。</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (任意)</li>\n<li><code>fromCache</code> Boolean - レスポンスがディスクキャッシュからフェッチされたかどうかを示します。</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n</ul></li>\n</ul></li>\n</ul>\n<p><code>listener</code> は、レスポンスボディの最初のバイトを受信したときに <code>listener(details)</code> で呼ばれます。 HTTP リクエストの場合、これはステータスラインとレスポンスヘッダが使用可能であることを意味します。</p>\n<h4 id=\"webrequestonbeforeredirectfilter-listener\"><a href=\"#webrequestonbeforeredirectfilter-listener\"><code>webRequest.onBeforeRedirect([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (任意)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (任意)</li>\n<li><code>webContents</code> WebContents (任意)</li>\n<li><code>frame</code> WebFrameMain (任意)</li>\n<li><code>resourceType</code> String - <code>mainFrame</code>、<code>subFrame</code>、<code>stylesheet</code>、<code>script</code>、<code>image</code>、<code>font</code>、<code>object</code>、<code>xhr</code>、<code>ping</code>、<code>cspReport</code>、<code>media</code>、<code>webSocket</code>、<code>other</code> のいずれかにできます。</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>redirectURL</code> String</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n<li><code>ip</code> String (任意) - リクエストが実際に送信されたサーバーの IP アドレス。</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (任意)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p><code>listener</code> は、サーバーが始めたリダイレクトが発生しようとしているときに <code>listener(details)</code> で呼ばれます。</p>\n<h4 id=\"webrequestoncompletedfilter-listener\"><a href=\"#webrequestoncompletedfilter-listener\"><code>webRequest.onCompleted([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (任意)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (任意)</li>\n<li><code>webContents</code> WebContents (任意)</li>\n<li><code>frame</code> WebFrameMain (任意)</li>\n<li><code>resourceType</code> String - <code>mainFrame</code>、<code>subFrame</code>、<code>stylesheet</code>、<code>script</code>、<code>image</code>、<code>font</code>、<code>object</code>、<code>xhr</code>、<code>ping</code>、<code>cspReport</code>、<code>media</code>、<code>webSocket</code>、<code>other</code> のいずれかにできます。</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (任意)</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n<li><code>error</code> String</li>\n</ul></li>\n</ul></li>\n</ul>\n<p><code>listener</code> は、リクエストが終了したときに <code>listener(details)</code> で呼ばれます。</p>\n<h4 id=\"webrequestonerroroccurredfilter-listener\"><a href=\"#webrequestonerroroccurredfilter-listener\"><code>webRequest.onErrorOccurred([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (任意)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (任意)</li>\n<li><code>webContents</code> WebContents (任意)</li>\n<li><code>frame</code> WebFrameMain (任意)</li>\n<li><code>resourceType</code> String - <code>mainFrame</code>、<code>subFrame</code>、<code>stylesheet</code>、<code>script</code>、<code>image</code>、<code>font</code>、<code>object</code>、<code>xhr</code>、<code>ping</code>、<code>cspReport</code>、<code>media</code>、<code>webSocket</code>、<code>other</code> のいずれかにできます。</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>error</code> String - エラーの内容。</li>\n</ul></li>\n</ul></li>\n</ul>\n<p><code>listener</code> は、エラーが発生したときに <code>listener(details)</code> で呼ばれます。</p>",
      "title": "クラス: WebRequest",
      "description": "ライフタイムのさまざまな段階でリクエストのコンテンツを傍受し、変更します。"
    },
    "/docs/api/structures/web-request-filter": {
      "locale": "ja-JP",
      "slug": "web-request-filter",
      "href": "/docs/api/structures/web-request-filter",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/web-request-filter.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"webrequestfilter-オブジェクト\"><a href=\"#webrequestfilter-オブジェクト\">WebRequestFilter オブジェクト</a></h1>\n<ul>\n<li><code>urls</code> String[] - URL パターンと一致しないリクエストを除去するために使用される URL パターンの配列。</li>\n</ul>",
      "title": "WebRequestFilter オブジェクト",
      "description": ""
    },
    "/docs/api/structures/web-source": {
      "locale": "ja-JP",
      "slug": "web-source",
      "href": "/docs/api/structures/web-source",
      "crowdinFileId": "256529",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/web-source.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"websource-object\"><a href=\"#websource-object\">WebSource Object</a></h1>\n<ul>\n<li><code>code</code> String</li>\n<li><code>url</code> String (optional)</li>\n<li><code>startLine</code> Integer (optional) - Default is 1.</li>\n</ul>",
      "title": "WebSource Object",
      "description": ""
    },
    "/docs/api/webview-tag": {
      "locale": "ja-JP",
      "slug": "webview-tag",
      "href": "/docs/api/webview-tag",
      "crowdinFileId": "256407",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/webview-tag.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webviewタグ\"><a href=\"#webviewタグ\"><code>&#x3C;webview></code>タグ</a></h1>\n<h2 id=\"警告\"><a href=\"#警告\">警告</a></h2>\n<p>Electron の <code>webview</code> タグは <a href=\"https://developer.chrome.com/docs/extensions/reference/webviewTag/\">Chromium の <code>webview</code></a> に基づきつつ、劇的に変更されています。 これはレンダリング、ナビゲーション、イベントルーティングを含む <code>webview</code> の安定性に影響しています。 私たちは <code>webview</code> タグを使用せずに、<code>iframe</code> や <a href=\"/docs/api/browser-view\">Electron の <code>BrowserView</code></a>、または埋め込みコンテンツを完全に避けるアーキテクチャにするといった代替案の検討を推奨しています。</p>\n<h2 id=\"有効にする\"><a href=\"#有効にする\">有効にする</a></h2>\n<p>既定では <code>webview</code> タグは Electron >= 5 では無効化されています。  タグを有効にするには、<code>BrowserWindow</code> を構築するときに <code>webviewTag</code> webPreferences オプションを設定します。 詳しい情報については、<a href=\"/docs/api/browser-window\">BrowserWindow コンストラクタ</a> を参照してください。</p>\n<h2 id=\"概要\"><a href=\"#概要\">概要</a></h2>\n<blockquote>\n<p>分離したフレームとプロセスに外部ウェブコンテンツを表示します。</p>\n</blockquote>\n<p>プロセス: <a href=\"/docs/glossary#renderer-process\">レンダラー</a><br> <em>このクラスは <code>'electron'</code> モジュールからはエクスポートされません。 Electron API では、他のメソッドの戻り値としてのみ利用できます。</em></p>\n<p><code>webview</code>タグを使用して、Electron アプリに 'ゲスト' コンテンツ (ウェブページなど) を埋め込むことができます。 ゲストコンテンツは <code>webview</code> コンテナに含まれています。 アプリ内の埋め込みページは、ゲストコンテンツのレイアウトとレンダリングの方法を制御します。</p>\n<p><code>iframe</code> と異なり、 <code>webview</code> はアプリとは別のプロセスで実行されます。 これはウェブページと同じ権限を持っておらず、アプリと埋め込みコンテンツの間のやりとりは全て非同期になります。 これにより、埋め込みコンテンツからアプリが保護されます。 <strong>注釈:</strong> ホストページから webview 上で呼び出されるほとんどのメソッドは、メインプロセスへの同期呼び出しを必要とします。</p>\n<h2 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h2>\n<p>アプリにウェブページを埋め込むには、アプリの埋め込みページ (これはゲストコンテンツを表示するアプリページ) へ <code>webview</code> タグを追加します。 最もシンプルな形式では、<code>webview</code> タグには、ウェブページの <code>src</code> と、<code>webview</code> コンテナの見た目を制御する CSS スタイルが含まれます。</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"foo\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"display:inline-flex; width:640px; height:480px\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>ゲストコンテンツを制御したい場合は、<code>webview</code> のイベントを傍受し、<code>webview</code> のメソッドを使用してそれらのイベントに応答する JavaScript を記述することでできます。 ここでは、2つのイベントリスナーを持つサンプルコードを示します。1つはウェブページのロード開始を、もう1つはウェブページのロード停止を傍受し、ロード時に \"ロード中...\" というメッセージを表示します。</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  onload = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\n    <span class=\"hljs-keyword\">const</span> indicator = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'.indicator'</span>)\n\n    <span class=\"hljs-keyword\">const</span> loadstart = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      indicator.innerText = <span class=\"hljs-string\">'loading...'</span>\n    }\n\n    <span class=\"hljs-keyword\">const</span> loadstop = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      indicator.innerText = <span class=\"hljs-string\">''</span>\n    }\n\n    webview.addEventListener(<span class=\"hljs-string\">'did-start-loading'</span>, loadstart)\n    webview.addEventListener(<span class=\"hljs-string\">'did-stop-loading'</span>, loadstop)\n  }\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h2 id=\"内部実装\"><a href=\"#内部実装\">内部実装</a></h2>\n<p>内部では <code>webview</code> は <a href=\"https://www.chromium.org/developers/design-documents/oop-iframes\">Out-of-Process iframe (OOPIF) </a> で実装されています。 <code>webview</code> タグは本質的には、見えない DOM を用いてその内側に <code>iframe</code> 要素をラップしたカスタム要素です。</p>\n<p>なので <code>webview</code> の動作はクロスドメイン <code>iframe</code> ととても似ています。例として、</p>\n<ul>\n<li><code>webview</code>をクリックしたとき、ページフォーカスが埋め込みフレームから <code>webview</code> に移動します。</li>\n<li><code>webview</code> にキーボード、マウス、スクロールイベントリスナを追加することはできません。</li>\n<li>埋め込みフレームと <code>webview</code> 間のすべての反応は非同期です。</li>\n</ul>\n<h2 id=\"css-スタイルの注意事項\"><a href=\"#css-スタイルの注意事項\">CSS スタイルの注意事項</a></h2>\n<p><code>webview</code> タグのスタイルでは、<code>webview</code> コンテナでの子の <code>iframe</code> 要素の高さと幅を完全に埋めるのに内部的に <code>display:flex;</code> を使用しているので、古典的かつフレックスボックスなレイアウトを使用するときは注意して下さい。 <code>display:inline-flex;</code> をインラインレイアウトに指定しない限り、デフォルトの<code>display:flex;</code> CSS プロパティを上書きしないでください。</p>\n<h2 id=\"タグの属性\"><a href=\"#タグの属性\">タグの属性</a></h2>\n<p><code>webview</code> タグには以下の属性があります。</p>\n<h3 id=\"src\"><a href=\"#src\"><code>src</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>表示される URL を表す <code>String</code>。 この属性に書き込むと、最上位のナビゲーションが始まります。</p>\n<p><code>src</code> に独自の値を代入すると、現在のページがリロードされます。</p>\n<p><code>src</code> 属性は、<code>data:text/plain,Hello, world!</code> などのデータ URL を受け取ることもできます。</p>\n<h3 id=\"nodeintegration\"><a href=\"#nodeintegration\"><code>nodeintegration</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://www.google.com/\"</span> <span class=\"hljs-attr\">nodeintegration</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p><code>Boolean</code>。 この属性が存在する場合、<code>webview</code> のゲストページは Node Integration を持ち、低レベルのシステムリソースにアクセスするのに、<code>require</code> や <code>process</code> のような Node API が使用できます。 デフォルトでは、ゲストページ内の Node Integration は無効化されています。</p>\n<h3 id=\"nodeintegrationinsubframes\"><a href=\"#nodeintegrationinsubframes\"><code>nodeintegrationinsubframes</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://www.google.com/\"</span> <span class=\"hljs-attr\">nodeintegrationinsubframes</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>この <code>Boolean</code> は <code>webview</code> 内の iframe などのサブフレームで NodeJS サポートを有効にするための実験的オプションです。 すべてのプリロードは iframe 毎にロードされます。メインフレーム内かそうでないか判断するには <code>process.isMainFrame</code> が使用できます。 デフォルトではゲストページ内のこのオプションは無効化されています。</p>\n<h3 id=\"plugins\"><a href=\"#plugins\"><code>plugins</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">plugins</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p><code>Boolean</code>。 この属性が存在する場合、<code>webview</code> 内のゲストページはブラウザのプラグインを使用できます。 プラグインはデフォルトで無効です。</p>\n<h3 id=\"preload\"><a href=\"#preload\"><code>preload</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- ファイルから --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">preload</span>=<span class=\"hljs-string\">\"./test.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n<span class=\"hljs-comment\">&#x3C;!-- または asar アーカイブから読み込みたい場合 --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">preload</span>=<span class=\"hljs-string\">\"./app.asar/test.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>この <code>String</code> は、ゲストのページで他のスクリプトを実行する前に読み込まれるスクリプトを指定します。 スクリプトの URL のプロトコルは <code>file:</code> である必要があります (<code>asar:</code> アーカイブを使用している場合でも)。これは、内部で Node の <code>require</code> によって、<code>asar:</code> アーカイブを仮想ディレクトリとして扱い読み込むためです。</p>\n<p>ゲストページに Node Integration がない場合、このスクリプトはすべての Node APIにアクセスできますが、Node によって挿入されたグローバルオブジェクトはこのスクリプトの実行が終了した後に削除されます。</p>\n<p><strong>注:</strong> このオプションは、<code>will-attach-webview</code> イベントに指定された <code>webPreferences</code> に <code>preloadURL</code> (<code>preload</code> ではない) として表示されます。</p>\n<h3 id=\"httpreferrer\"><a href=\"#httpreferrer\"><code>httpreferrer</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">httpreferrer</span>=<span class=\"hljs-string\">\"http://cheng.guru\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>ゲストページの参照先 URL を設定する <code>String</code>。</p>\n<h3 id=\"useragent\"><a href=\"#useragent\"><code>useragent</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">useragent</span>=<span class=\"hljs-string\">\"Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>ページがナビゲーションされる前に設定するゲストページのユーザーエージェントの <code>String</code>。 そのページがロードされると、<code>setUserAgent</code> メソッドでユーザーエージェントを変更します。</p>\n<h3 id=\"disablewebsecurity\"><a href=\"#disablewebsecurity\"><code>disablewebsecurity</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">disablewebsecurity</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p><code>Boolean</code>。 この属性が存在すると、ゲストページでウェブセキュリティが無効になります。 ウェブセキュリティはデフォルトで有効です。</p>\n<h3 id=\"partition\"><a href=\"#partition\"><code>partition</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span> <span class=\"hljs-attr\">partition</span>=<span class=\"hljs-string\">\"persist:github\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://electronjs.org\"</span> <span class=\"hljs-attr\">partition</span>=<span class=\"hljs-string\">\"electron\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>ページが使用するセッションを設定する <code>String</code> です。 <code>partition</code> が <code>persist:</code> 始まりの場合、ページはアプリの全ページで利用可能な永続的なセッションを同じ <code>partition</code> で使用します。 <code>persist:</code> プレフィックスがない場合、ページは、インメモリセッションを使用します。 同じ <code>partition</code> を割り当てることによって、複数のページが同じセッションを共有できます。 <code>partition</code> が設定されていない場合は、アプリのデフォルトのセッションが使用されます。</p>\n<p>アクティブなレンダラープロセスのセッションは変更できないため、この値は最初のナビゲーションの前にのみ変更できます。 その後の値の変更は、DOM 例外で失敗します。</p>\n<h3 id=\"allowpopups\"><a href=\"#allowpopups\"><code>allowpopups</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">allowpopups</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p><code>Boolean</code>。 この属性が存在すると、ゲストページは新しいウィンドウを開くことができます。 ポップアップはデフォルトで無効です。</p>\n<h3 id=\"webpreferences\"><a href=\"#webpreferences\"><code>webpreferences</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span> <span class=\"hljs-attr\">webpreferences</span>=<span class=\"hljs-string\">\"allowRunningInsecureContent, javascript=no\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>webview に設定するウェブ設定を指定する文字列のコンマ区切りリストの <code>String</code> です。 サポートされている設定の文字列の完全なリストは、<a href=\"/docs/api/browser-window#new-browserwindowoptions\">BrowserWindow</a> にあります。</p>\n<p>この文字列は、<code>window.open</code> の features 文字列と同じ形式に従います。 名前自体には <code>true</code> のブール値が与えられます。 設定は、<code>=</code> とそれに続く値を含めることによって別の値に設定できます。 特殊な値として、<code>yes</code> と <code>1</code> は <code>true</code> として解釈され、<code>no</code> と <code>0</code> は <code>false</code> として解釈されます。</p>\n<h3 id=\"enableblinkfeatures\"><a href=\"#enableblinkfeatures\"><code>enableblinkfeatures</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">enableblinkfeatures</span>=<span class=\"hljs-string\">\"PreciseMemoryInfo, CSSVariables\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>有効にする Blink 機能を指定する <code>,</code> 区切りの文字列リストである <code>String</code> です。 サポートされている機能の文字列の完全なリストは、<a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> ファイルにあります。</p>\n<h3 id=\"disableblinkfeatures\"><a href=\"#disableblinkfeatures\"><code>disableblinkfeatures</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">disableblinkfeatures</span>=<span class=\"hljs-string\">\"PreciseMemoryInfo, CSSVariables\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>無効にする Blink 機能を指定する <code>,</code> 区切りの文字列リストである <code>String</code> です。 サポートされている機能の文字列の完全なリストは、<a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> ファイルにあります。</p>\n<h2 id=\"メソッド\"><a href=\"#メソッド\">メソッド</a></h2>\n<p><code>webview</code> タグには以下のメソッドがあります。</p>\n<p><strong>注釈:</strong> メソッドを使用する前に webview 要素をロードする必要があります。</p>\n<p><strong>サンプル</strong></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'dom-ready'</span>, () => {\n  webview.openDevTools()\n})\n</code></pre>\n<h3 id=\"webviewloadurlurl-options\"><a href=\"#webviewloadurlurl-options\"><code>&#x3C;webview>.loadURL(url[, options])</code></a></h3>\n<ul>\n<li><code>url</code> URL</li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (任意) - HTTPリファラのURL。</li>\n<li><code>userAgent</code> String (任意) - リクエスト元のユーザーエージェント。</li>\n<li><code>extraHeaders</code> String (任意) - \"\\n\" で区切られた追加のヘッダー</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a></li>\n<li><code>baseURLForDataURL</code> String (任意) - データURLによってロードされたファイルの (最後のパス区切り文字を含む) ベースURL。 これは指定された <code>url</code> がデータURLで、他のファイルをロードする必要がある場合のみ必要です。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - この promise は、ページ読み込みが完了した時 (<a href=\"/docs/api/webview-tag#event-did-finish-load\"><code>did-finish-load</code></a> を参照) に解決され、ページの読み込みに失敗した時 (<a href=\"/docs/api/webview-tag#event-did-fail-load\"><code>did-fail-load</code></a> を参照) に拒否されます。</p>\n<p><code>url</code> を webview にロードします。<code>url</code> には、<code>http://</code> または <code>file://</code> のような、プロトコルのプレフィックスを含みます。</p>\n<h3 id=\"webviewdownloadurlurl\"><a href=\"#webviewdownloadurlurl\"><code>&#x3C;webview>.downloadURL(url)</code></a></h3>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>ナビゲーションなしで <code>url</code> のリソースのダウンロードを初期化します。</p>\n<h3 id=\"webviewgeturl\"><a href=\"#webviewgeturl\"><code>&#x3C;webview>.getURL()</code></a></h3>\n<p>戻り値 <code>String</code> - ゲストページの URL。</p>\n<h3 id=\"webviewgettitle\"><a href=\"#webviewgettitle\"><code>&#x3C;webview>.getTitle()</code></a></h3>\n<p>戻り値 <code>String</code> - ゲストページのタイトル。</p>\n<h3 id=\"webviewisloading\"><a href=\"#webviewisloading\"><code>&#x3C;webview>.isLoading()</code></a></h3>\n<p>戻り値 <code>Boolean</code> - ゲストページがまだリソースを読み込んでいるかどうか。</p>\n<h3 id=\"webviewisloadingmainframe\"><a href=\"#webviewisloadingmainframe\"><code>&#x3C;webview>.isLoadingMainFrame()</code></a></h3>\n<p>戻り値 <code>Boolean</code> - メインフレーム (iframe やフレーム内のフレームだけではない) がまだ読み込んでいるかどうか。</p>\n<h3 id=\"webviewiswaitingforresponse\"><a href=\"#webviewiswaitingforresponse\"><code>&#x3C;webview>.isWaitingForResponse()</code></a></h3>\n<p>戻り値 <code>Boolean</code> - ゲストページが、ページのメインリソースからの最初の応答を待機しているかどうか。</p>\n<h3 id=\"webviewstop\"><a href=\"#webviewstop\"><code>&#x3C;webview>.stop()</code></a></h3>\n<p>保留中のナビゲーションを停止します。</p>\n<h3 id=\"webviewreload\"><a href=\"#webviewreload\"><code>&#x3C;webview>.reload()</code></a></h3>\n<p>ゲストページを再読み込みします。</p>\n<h3 id=\"webviewreloadignoringcache\"><a href=\"#webviewreloadignoringcache\"><code>&#x3C;webview>.reloadIgnoringCache()</code></a></h3>\n<p>ゲストページを、キャッシュを無視して再読み込みします。</p>\n<h3 id=\"webviewcangoback\"><a href=\"#webviewcangoback\"><code>&#x3C;webview>.canGoBack()</code></a></h3>\n<p>戻り値 <code>Boolean</code> - ゲストページが前に戻れるかどうか。</p>\n<h3 id=\"webviewcangoforward\"><a href=\"#webviewcangoforward\"><code>&#x3C;webview>.canGoForward()</code></a></h3>\n<p>戻り値 <code>Boolean</code> - ゲストページが次に進めるかどうか。</p>\n<h3 id=\"webviewcangotooffsetoffset\"><a href=\"#webviewcangotooffsetoffset\"><code>&#x3C;webview>.canGoToOffset(offset)</code></a></h3>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>戻り値 <code>Boolean</code> - <code>offset</code> 番目のゲストページへ行けるかどうか。</p>\n<h3 id=\"webviewclearhistory\"><a href=\"#webviewclearhistory\"><code>&#x3C;webview>.clearHistory()</code></a></h3>\n<p>ナビゲーション履歴を消去します。</p>\n<h3 id=\"webviewgoback\"><a href=\"#webviewgoback\"><code>&#x3C;webview>.goBack()</code></a></h3>\n<p>ゲストページを前に戻します。</p>\n<h3 id=\"webviewgoforward\"><a href=\"#webviewgoforward\"><code>&#x3C;webview>.goForward()</code></a></h3>\n<p>ゲストページを次に進めます。</p>\n<h3 id=\"webviewgotoindexindex\"><a href=\"#webviewgotoindexindex\"><code>&#x3C;webview>.goToIndex(index)</code></a></h3>\n<ul>\n<li><code>index</code> Integer</li>\n</ul>\n<p>指定した絶対インデックスへナビゲーションします。</p>\n<h3 id=\"webviewgotooffsetoffset\"><a href=\"#webviewgotooffsetoffset\"><code>&#x3C;webview>.goToOffset(offset)</code></a></h3>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>現在のエントリから指定したオフセットへナビゲーションします。</p>\n<h3 id=\"webviewiscrashed\"><a href=\"#webviewiscrashed\"><code>&#x3C;webview>.isCrashed()</code></a></h3>\n<p>戻り値 <code>Boolean</code> - レンダラープロセスがクラッシュしたかどうか。</p>\n<h3 id=\"webviewsetuseragentuseragent\"><a href=\"#webviewsetuseragentuseragent\"><code>&#x3C;webview>.setUserAgent(userAgent)</code></a></h3>\n<ul>\n<li><code>userAgent</code> String</li>\n</ul>\n<p>ゲストページページのユーザエージェントをオーバーライドします。</p>\n<h3 id=\"webviewgetuseragent\"><a href=\"#webviewgetuseragent\"><code>&#x3C;webview>.getUserAgent()</code></a></h3>\n<p>戻り値 <code>String</code> - ゲストページのユーザエージェント。</p>\n<h3 id=\"webviewinsertcsscss\"><a href=\"#webviewinsertcsscss\"><code>&#x3C;webview>.insertCSS(css)</code></a></h3>\n<ul>\n<li><code>css</code> String</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;String></code> - 挿入された CSS のキーで解決される promise。後で <code>&#x3C;webview>.removeInsertedCSS(key)</code> を使用して CSS を削除するために使用できます。</p>\n<p>現在のウェブページに CSS を挿入し、挿入されたスタイルシートの一意なキーを返します。</p>\n<h3 id=\"webviewremoveinsertedcsskey\"><a href=\"#webviewremoveinsertedcsskey\"><code>&#x3C;webview>.removeInsertedCSS(key)</code></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code> - 削除に成功すると解決されます。</p>\n<p>現在のウェブページから挿入された CSS を削除します。 スタイルシートは <code>&#x3C;webview>.insertCSS(css)</code> から返されるキーで識別されます。</p>\n<h3 id=\"webviewexecutejavascriptcode-usergesture\"><a href=\"#webviewexecutejavascriptcode-usergesture\"><code>&#x3C;webview>.executeJavaScript(code[, userGesture])</code></a></h3>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (任意) - 省略値は <code>false</code>。</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;any></code> - 実行されたコードの結果で resolve する Promise。コードの結果が reject な Promise である場合は reject な Promise。</p>\n<p>ページ内の <code>code</code> を評価します。 <code>userGesture</code> が設定されている場合、ページのユーザジェスチャコンテキストが作成されます。 <code>requestFullScreen</code> のようなユーザの操作を必要とする HTML API は、このオプションを自動化に利用できます。</p>\n<h3 id=\"webviewopendevtools\"><a href=\"#webviewopendevtools\"><code>&#x3C;webview>.openDevTools()</code></a></h3>\n<p>ゲストページの開発者向けツールウインドウを開きます。</p>\n<h3 id=\"webviewclosedevtools\"><a href=\"#webviewclosedevtools\"><code>&#x3C;webview>.closeDevTools()</code></a></h3>\n<p>ゲストページの開発者向けツールウインドウを閉じます。</p>\n<h3 id=\"webviewisdevtoolsopened\"><a href=\"#webviewisdevtoolsopened\"><code>&#x3C;webview>.isDevToolsOpened()</code></a></h3>\n<p>戻り値 <code>Boolean</code> - ゲストページに開発者向けツールウインドウが適用されているかどうか。</p>\n<h3 id=\"webviewisdevtoolsfocused\"><a href=\"#webviewisdevtoolsfocused\"><code>&#x3C;webview>.isDevToolsFocused()</code></a></h3>\n<p>戻り値 <code>Boolean</code> - ゲストページの開発者向けツールウインドウがフォーカスされているかどうか。</p>\n<h3 id=\"webviewinspectelementx-y\"><a href=\"#webviewinspectelementx-y\"><code>&#x3C;webview>.inspectElement(x, y)</code></a></h3>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>ゲストページの (<code>x</code>, <code>y</code>) の位置の要素の検査を開始します。</p>\n<h3 id=\"webviewinspectsharedworker\"><a href=\"#webviewinspectsharedworker\"><code>&#x3C;webview>.inspectSharedWorker()</code></a></h3>\n<p>ゲストページに表示されている共有ワーカーコンテキストの開発者向けツールを開きます。</p>\n<h3 id=\"webviewinspectserviceworker\"><a href=\"#webviewinspectserviceworker\"><code>&#x3C;webview>.inspectServiceWorker()</code></a></h3>\n<p>ゲストページに表示されているサービスワーカコンテキストの開発者向けツールを開きます。</p>\n<h3 id=\"webviewsetaudiomutedmuted\"><a href=\"#webviewsetaudiomutedmuted\"><code>&#x3C;webview>.setAudioMuted(muted)</code></a></h3>\n<ul>\n<li><code>muted</code> Boolean</li>\n</ul>\n<p>ゲストページをミュートに設定します。</p>\n<h3 id=\"webviewisaudiomuted\"><a href=\"#webviewisaudiomuted\"><code>&#x3C;webview>.isAudioMuted()</code></a></h3>\n<p>戻り値 <code>Boolean</code> - ゲストページがミュートされているかどうか。</p>\n<h3 id=\"webviewiscurrentlyaudible\"><a href=\"#webviewiscurrentlyaudible\"><code>&#x3C;webview>.isCurrentlyAudible()</code></a></h3>\n<p>戻り値 <code>Boolean</code> - 音声が現在再生中かどうか。</p>\n<h3 id=\"webviewundo\"><a href=\"#webviewundo\"><code>&#x3C;webview>.undo()</code></a></h3>\n<p>ページの <code>undo</code> 編集コマンドを実行します。</p>\n<h3 id=\"webviewredo\"><a href=\"#webviewredo\"><code>&#x3C;webview>.redo()</code></a></h3>\n<p>ページの <code>redo</code> 編集コマンドを実行します。</p>\n<h3 id=\"webviewcut\"><a href=\"#webviewcut\"><code>&#x3C;webview>.cut()</code></a></h3>\n<p>ページの <code>cut</code> 編集コマンドを実行します。</p>\n<h3 id=\"webviewcopy\"><a href=\"#webviewcopy\"><code>&#x3C;webview>.copy()</code></a></h3>\n<p>ページの <code>copy</code> 編集コマンドを実行します。</p>\n<h3 id=\"webviewpaste\"><a href=\"#webviewpaste\"><code>&#x3C;webview>.paste()</code></a></h3>\n<p>ページの <code>paste</code> 編集コマンドを実行します。</p>\n<h3 id=\"webviewpasteandmatchstyle\"><a href=\"#webviewpasteandmatchstyle\"><code>&#x3C;webview>.pasteAndMatchStyle()</code></a></h3>\n<p>ページの <code>pasteAndMatchStyle</code> 編集コマンドを実行します。</p>\n<h3 id=\"webviewdelete\"><a href=\"#webviewdelete\"><code>&#x3C;webview>.delete()</code></a></h3>\n<p>ページの <code>delete</code> 編集コマンドを実行します。</p>\n<h3 id=\"webviewselectall\"><a href=\"#webviewselectall\"><code>&#x3C;webview>.selectAll()</code></a></h3>\n<p>ページの <code>selectAll</code> 編集コマンドを実行します。</p>\n<h3 id=\"webviewunselect\"><a href=\"#webviewunselect\"><code>&#x3C;webview>.unselect()</code></a></h3>\n<p>ページの <code>unselect</code> 編集コマンドを実行します。</p>\n<h3 id=\"webviewreplacetext\"><a href=\"#webviewreplacetext\"><code>&#x3C;webview>.replace(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>ページの <code>replace</code> 編集コマンドを実行します。</p>\n<h3 id=\"webviewreplacemisspellingtext\"><a href=\"#webviewreplacemisspellingtext\"><code>&#x3C;webview>.replaceMisspelling(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>ページの <code>replaceMisspelling</code> 編集コマンドを実行します。</p>\n<h3 id=\"webviewinserttexttext\"><a href=\"#webviewinserttexttext\"><code>&#x3C;webview>.insertText(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code></p>\n<p>フォーカスされた要素に <code>text</code> を挿入します。</p>\n<h3 id=\"webviewfindinpagetext-options\"><a href=\"#webviewfindinpagetext-options\"><code>&#x3C;webview>.findInPage(text[, options])</code></a></h3>\n<ul>\n<li><code>text</code> String - 検索するコンテンツ。空にしてはいけません。</li>\n<li><code>options</code> Object (任意)<ul>\n<li><code>forward</code> Boolean (任意) - 前方または後方を検索するかどうか。省略値は <code>true</code>。</li>\n<li><code>findNext</code> Boolean (任意) - この要求で新規テキスト検索セッションを開始するかどうか。 最初の要求では <code>true</code> に、二度目以降の要求では <code>false</code> にする必要があります。 省略値は <code>false</code> 。</li>\n<li><code>matchCase</code> Boolean (任意) - 大文字と小文字を区別する検索かどうか。省略値は <code>false</code>。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Integer</code> - リクエストに使われたリクエスト ID。</p>\n<p>ウェブページ内の <code>text</code> のすべてのマッチを探すリクエストを開始します。 リクエストの結果は <a href=\"/docs/api/webview-tag#event-found-in-page\"><code>found-in-page</code></a> イベントを読むことで取得できます。</p>\n<h3 id=\"webviewstopfindinpageaction\"><a href=\"#webviewstopfindinpageaction\"><code>&#x3C;webview>.stopFindInPage(action)</code></a></h3>\n<ul>\n<li><code>action</code> String - <a href=\"#webviewfindinpagetext-options\"><code>&#x3C;webview>.findInPage</code></a> リクエストを終了する際に行うアクションを指定します。<ul>\n<li><code>clearSelection</code> - 選択を消去する。</li>\n<li><code>keepSelection</code> - その選択を通常の選択に変換する。</li>\n<li><code>activateSelection</code> - 選択ノードをフォーカスして、クリックする。</li>\n</ul></li>\n</ul>\n<p>指定された <code>action</code> で、<code>webview</code> の <code>findInPage</code> リクエストを停止します。</p>\n<h3 id=\"webviewprintoptions\"><a href=\"#webviewprintoptions\"><code>&#x3C;webview>.print([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (任意)<ul>\n<li><code>silent</code> Boolean (任意) - プリンタの設定をユーザに尋ねないかどうか。 省略値は <code>false</code> です。</li>\n<li><code>printBackground</code> Boolean (任意) - ウェブページの背景色と画像を印刷するかどうか。 省略値は <code>false</code> です。</li>\n<li><code>deviceName</code> String (任意) - 使用するプリンタデバイスの名前をセットします。 '人間向けの' 名称ではなくシステム定義名である必要があります。例えば、'Brother QL-820NWB' ではなく 'Brother_QL_820NWB' とします。</li>\n<li><code>color</code> Boolean (任意) - 印刷するウェブページをカラーにするかグレースケールにするかを設定します。 省略値は <code>true</code> です。</li>\n<li><code>margins</code> Object (任意)<ul>\n<li><code>marginType</code> String (任意) - <code>default</code>、<code>none</code>、<code>printableArea</code> か <code>custom</code> にできます。 <code>custom</code> を選択した場合、<code>top</code>、<code>bottom</code>、<code>left</code>、<code>right</code> も指定する必要があります。</li>\n<li><code>top</code> Number (任意) - 印刷されたウェブページの上側のマージン。ピクセル単位です。</li>\n<li><code>bottom</code> Number (任意) - 印刷されたウェブページの下側のマージン。ピクセル単位です。</li>\n<li><code>left</code> Number (任意) - 印刷されたウェブページの左側のマージン。ピクセル単位です。</li>\n<li><code>right</code> Number (任意) - 印刷されたウェブページの右側のマージン。ピクセル単位です。</li>\n</ul></li>\n<li><code>landscape</code> Boolean (任意) - ウェブページを横向きモードで印刷するかどうか。 省略値は <code>false</code> です。</li>\n<li><code>scaleFactor</code> Number (任意) - ウェブページのスケール係数。</li>\n<li><code>pagesPerSheet</code> Number (任意) - ページシートごとに印刷するページ数。</li>\n<li><code>collate</code> Boolean (任意) - ウェブページを校合するかどうか。</li>\n<li><code>copies</code> Number (任意) - 印刷するウェブページの版数。</li>\n<li><code>pageRanges</code> Object<a href=\"/docs/api/%E4%BB%BB%E6%84%8F\"></a> - 印刷するページ範囲。<ul>\n<li><code>from</code> Number - 印刷する最初のページのインデックス (0 始まり)。</li>\n<li><code>to</code> Number - 印刷する最後のページのインデックス (これを含む) (0 始まり)。</li>\n</ul></li>\n<li><code>duplexMode</code> String (任意) - 印刷されるウェブページの両面モードを設定します。 <code>simplex</code>、<code>shortEdge</code>、<code>longEdge</code> のいずれかにできます。</li>\n<li><code>dpi</code> Record&#x3C;string, number> (任意)<ul>\n<li><code>horizontal</code> Number (任意) - 水平 DPI。</li>\n<li><code>vertical</code> Number (任意) - 垂直 DPI。</li>\n</ul></li>\n<li><code>header</code> String (任意) - ページヘッダーとして印刷される文字列。</li>\n<li><code>footer</code> String (任意) - ページフッターとして印刷される文字列。</li>\n<li><code>pageSize</code> String | Size (任意) - 印刷するドキュメントのページサイズを指定します。 <code>A3</code>、<code>A4</code>、<code>A5</code>、<code>Legal</code>、<code>Letter</code>、<code>Tabloid</code> のいずれかにするか、<code>height</code> を含む Object にできます。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code></p>\n<p><code>webview</code> のウェブページを印刷します。 <code>webContents.print([options])</code> と同じです。</p>\n<h3 id=\"webviewprinttopdfoptions\"><a href=\"#webviewprinttopdfoptions\"><code>&#x3C;webview>.printToPDF(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>headerFooter</code> Record&#x3C;string, string> (任意) - PDF のヘッダーとフッター。<ul>\n<li><code>title</code> String - PDF ヘッダーのタイトル。</li>\n<li><code>url</code> String - PDF フッターの URL。</li>\n</ul></li>\n<li><code>landscape</code> Boolean (任意) - <code>true</code> で横向き、<code>false</code> で縦向き。</li>\n<li><code>marginsType</code> Integer (optional) - 使用する余白の種類を指定します。 0 で既定値、1 で余白なし、2 で最小限の余白になります。 <code>width</code> はミクロン単位です。</li>\n<li><code>scaleFactor</code> Number (任意) - ウェブページのスケール係数。 0 から 100 の範囲にできます。</li>\n<li><code>pageRanges</code> Record&#x3C;string, number> (任意) - 印刷するページ範囲。 macOS では最初の範囲のみが使用されます。<ul>\n<li><code>from</code> Number - 印刷する最初のページのインデックス (0 始まり)。</li>\n<li><code>to</code> Number - 印刷する最後のページのインデックス (これを含む) (0 始まり)。</li>\n</ul></li>\n<li><code>pageSize</code> String | Size (任意) - 生成する PDF のページサイズを指定します。 <code>A3</code>、<code>A4</code>、<code>A5</code>、<code>Legal</code>、<code>Letter</code>、<code>Tabloid</code> のいずれかにするか、<code>height</code> を含む Object にできます。</li>\n<li><code>printBackground</code> Boolean (任意) - CSS 背景を印刷するかどうか。</li>\n<li><code>printSelectionOnly</code> Boolean (任意) - 選択部分だけを印刷するかどうか。</li>\n</ul></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;Uint8Array></code> - 生成された PDF データで実行されます。</p>\n<p><code>webview</code> のウェブページを PDF として印刷します。<code>webContents.printToPDF(options)</code> と同じです。</p>\n<h3 id=\"webviewcapturepagerect\"><a href=\"#webviewcapturepagerect\"><code>&#x3C;webview>.capturePage([rect])</code></a></h3>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (任意) - キャプチャするページ内の領域。</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;NativeImage></code> - <a href=\"/docs/api/native-image\">NativeImage</a> を解決します</p>\n<p><code>rect</code> 内のページのスナップショットをキャプチャします。 <code>rect</code> を省略すると、表示されているページ全体をキャプチャします。</p>\n<h3 id=\"webviewsendchannel-args\"><a href=\"#webviewsendchannel-args\"><code>&#x3C;webview>.send(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code></p>\n<p><code>channel</code> を介してレンダラープロセスに非同期メッセージを送信します。任意の引数を送ることもできます。 レンダラープロセスは <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> モジュールで <code>channel</code> イベントをリッスンしてメッセージを処理できます。</p>\n<p>サンプルについては <a href=\"/docs/api/web-contents#contentssendchannel-args\">webContents.send</a> を参照して下さい。</p>\n<h3 id=\"webviewsendtoframeframeid-channel-args\"><a href=\"#webviewsendtoframeframeid-channel-args\"><code>&#x3C;webview>.sendToFrame(frameId, channel, ...args)</code></a></h3>\n<ul>\n<li><code>frameId</code> [number, number] - <code>[processId, frameId]</code></li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code></p>\n<p><code>channel</code> を介してレンダラープロセスに非同期メッセージを送信します。任意の引数を送ることもできます。 レンダラープロセスは <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> モジュールで <code>channel</code> イベントをリッスンしてメッセージを処理できます。</p>\n<p>サンプルは <a href=\"/docs/api/web-contents#contentssendtoframeframeid-channel-args\">webContents.sendToFrame</a> をご参照ください。</p>\n<h3 id=\"webviewsendinputeventevent\"><a href=\"#webviewsendinputeventevent\"><code>&#x3C;webview>.sendInputEvent(event)</code></a></h3>\n<ul>\n<li><code>event</code>  <a href=\"/docs/api/structures/mouse-input-event\">MouseInputEvent</a> | <a href=\"/docs/api/structures/mouse-wheel-input-event\">MouseWheelInputEvent</a> | <a href=\"/docs/api/structures/keyboard-input-event\">KeyboardInputEvent</a></li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code></p>\n<p>入力 <code>event</code> をページに送ります。</p>\n<p><code>event</code> オブジェクトの詳細については、<a href=\"/docs/api/web-contents#contentssendinputeventinputevent\">webContents.sendInputEvent</a> を参照してください。</p>\n<h3 id=\"webviewsetzoomfactorfactor\"><a href=\"#webviewsetzoomfactorfactor\"><code>&#x3C;webview>.setZoomFactor(factor)</code></a></h3>\n<ul>\n<li><code>factor</code> Number - 拡大率。</li>\n</ul>\n<p>指定の拡大率に変更します。 拡大率は百分率なので、300% = 3.0 です。</p>\n<h3 id=\"webviewsetzoomlevellevel\"><a href=\"#webviewsetzoomlevellevel\"><code>&#x3C;webview>.setZoomLevel(level)</code></a></h3>\n<ul>\n<li><code>level</code> Number - 拡大レベル。</li>\n</ul>\n<p>指定レベルに拡大レベルを変更します。 原寸は 0 で、各増減分はそれぞれ 20% ずつの拡大または縮小を表し、デフォルトで元のサイズの 300% から 50% までに制限されています。 この式は <code>scale := 1.2 ^ level</code> です。</p>\n<blockquote>\n<p><strong>注意</strong>: Chromium でのズームポリシーはドメインごとです。すなわち、特定ドメインのズームレベルは、同じドメインのウィンドウの全インスタンスに伝播します。 ウインドウの URL が別々であれば、ウインドウごとのズームになります。</p>\n</blockquote>\n<h3 id=\"webviewgetzoomfactor\"><a href=\"#webviewgetzoomfactor\"><code>&#x3C;webview>.getZoomFactor()</code></a></h3>\n<p>戻り値 <code>Number</code> - 現在の拡大率。</p>\n<h3 id=\"webviewgetzoomlevel\"><a href=\"#webviewgetzoomlevel\"><code>&#x3C;webview>.getZoomLevel()</code></a></h3>\n<p>戻り値 <code>Number</code> - 現在の拡大レベル。</p>\n<h3 id=\"webviewsetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#webviewsetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>&#x3C;webview>.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h3>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>戻り値 <code>Promise&#x3C;void></code></p>\n<p>ピンチによる拡大レベルの最大値と最小値を設定します。</p>\n<h3 id=\"webviewshowdefinitionforselection-macos\"><a href=\"#webviewshowdefinitionforselection-macos\"><code>&#x3C;webview>.showDefinitionForSelection()</code> <em>macOS</em></a></h3>\n<p>ページ上の選択された単語を検索するポップアップ辞書を表示します。</p>\n<h3 id=\"webviewgetwebcontentsid\"><a href=\"#webviewgetwebcontentsid\"><code>&#x3C;webview>.getWebContentsId()</code></a></h3>\n<p>戻り値 <code>Number</code> - この <code>webview</code> の WebContents ID。</p>\n<h2 id=\"dom-イベント\"><a href=\"#dom-イベント\">DOM イベント</a></h2>\n<p><code>webview</code> タグでは、以下の DOM イベントを使用できます。</p>\n<h3 id=\"イベント-load-commit\"><a href=\"#イベント-load-commit\">イベント: 'load-commit'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>ロードを要求したときに発生します。 これには、現在のドキュメント内のナビゲーションとサブフレームのドキュメントレベルのロードが含まれますが、非同期のリソース読み込みは含まれません。</p>\n<h3 id=\"イベント-did-finish-load\"><a href=\"#イベント-did-finish-load\">イベント: 'did-finish-load'</a></h3>\n<p>ナビゲーションが終了した時、すなわち、タブのくるくるが止まったときや、<code>onload</code> イベントが送られた後に、発行されます。</p>\n<h3 id=\"イベント-did-fail-load\"><a href=\"#イベント-did-fail-load\">イベント: 'did-fail-load'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>このイベントは <code>did-finish-load</code> のようですが、ロードが失敗した、キャンセルされた、<code>window.stop()</code> が呼び出されたなどで発生します。</p>\n<h3 id=\"イベント-did-frame-finish-load\"><a href=\"#イベント-did-frame-finish-load\">イベント: 'did-frame-finish-load'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>フレームのナビゲーションが終了したときに発行されます。</p>\n<h3 id=\"イベント-did-start-loading\"><a href=\"#イベント-did-start-loading\">イベント: 'did-start-loading'</a></h3>\n<p>タブのくるくるが始まるタイミングに対応しています。</p>\n<h3 id=\"イベント-did-stop-loading\"><a href=\"#イベント-did-stop-loading\">イベント: 'did-stop-loading'</a></h3>\n<p>タブのくるくるが止まるタイミングに対応しています。</p>\n<h3 id=\"イベント-did-attach\"><a href=\"#イベント-did-attach\">イベント: 'did-attach'</a></h3>\n<p>埋め込みWebコンテンツに添付したときに発行されます。</p>\n<h3 id=\"イベント-dom-ready\"><a href=\"#イベント-dom-ready\">イベント: 'dom-ready'</a></h3>\n<p>指定のフレームの document が読み込まれたときに発行されます。</p>\n<h3 id=\"イベント-page-title-updated\"><a href=\"#イベント-page-title-updated\">イベント: 'page-title-updated'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>ナビゲーション中にページタイトルが設定されると発生します。 <code>explicitSet</code> は、タイトルがファイル URL から合成されている場合に false になります。</p>\n<h3 id=\"イベント-page-favicon-updated\"><a href=\"#イベント-page-favicon-updated\">イベント: 'page-favicon-updated'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>favicons</code> String[] - URLの配列。</li>\n</ul>\n<p>ページがファビコンの URL を受け取ると発行されます。</p>\n<h3 id=\"イベント-enter-html-full-screen\"><a href=\"#イベント-enter-html-full-screen\">イベント: 'enter-html-full-screen'</a></h3>\n<p>HTML API にトリガーされてページがフルスクリーンになるときに発生します。</p>\n<h3 id=\"イベント-leave-html-full-screen\"><a href=\"#イベント-leave-html-full-screen\">イベント: 'leave-html-full-screen'</a></h3>\n<p>HTML API にトリガーされてページがフルスクリーンから抜けるときに発生します。</p>\n<h3 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>level</code> Integer - 0 から 3 のログレベル。 順に <code>verbose</code>、<code>info</code>、<code>warning</code>、<code>error</code> に対応します。</li>\n<li><code>message</code> String - 実際のコンソールメッセージ</li>\n<li><code>line</code> Integer - このコンソールメッセージのトリガーとなったソースの行番号</li>\n<li><code>sourceId</code> String</li>\n</ul>\n<p>ゲストウィンドウがコンソールメッセージをロギングすると発行されます。</p>\n<p>以下のサンプルコードは、ログレベルやその他のプロパティに関係なく、すべてのログメッセージを埋め込みのコンソールに転送します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'console-message'</span>, (e) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'ゲストページのメッセージログ:'</span>, e.message)\n})\n</code></pre>\n<h3 id=\"イベント-found-in-page\"><a href=\"#イベント-found-in-page\">イベント: 'found-in-page'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>result</code> Object<ul>\n<li><code>requestId</code> Integer</li>\n<li><code>activeMatchOrdinal</code> Integer - アクティブなマッチの位置。</li>\n<li><code>matches</code> Integer - マッチの個数。</li>\n<li><code>selectionArea</code> Rectangle - 最初に一致した領域の座標。</li>\n<li><code>finalUpdate</code> Boolean</li>\n</ul></li>\n</ul>\n<p><a href=\"#webviewfindinpagetext-options\"><code>webview.findInPage</code></a> リクエストの結果が有効なときに発行されます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'found-in-page'</span>, (e) => {\n  webview.stopFindInPage(<span class=\"hljs-string\">'keepSelection'</span>)\n})\n\n<span class=\"hljs-keyword\">const</span> requestId = webview.findInPage(<span class=\"hljs-string\">'test'</span>)\n<span class=\"hljs-built_in\">console</span>.log(requestId)\n</code></pre>\n<h3 id=\"イベント-new-window\"><a href=\"#イベント-new-window\">イベント: 'new-window'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String</li>\n<li><code>disposition</code> String - <code>default</code>、<code>foreground-tab</code>、<code>background-tab</code>、<code>new-window</code>、<code>save-to-disk</code>、<code>other</code> にできる。</li>\n<li><code>options</code> BrowserWindowConstructorOptions - 新しい <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> を作成するのに使われるべきオプション。</li>\n</ul>\n<p>ゲストページが新しいブラウザウィンドウを開くときに発生します。</p>\n<p>以下のサンプルコードは、システムのデフォルトブラウザで新しい URL を開きます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\n\nwebview.addEventListener(<span class=\"hljs-string\">'new-window'</span>, <span class=\"hljs-keyword\">async</span> (e) => {\n  <span class=\"hljs-keyword\">const</span> protocol = (<span class=\"hljs-keyword\">new</span> URL(e.url)).protocol\n  <span class=\"hljs-keyword\">if</span> (protocol === <span class=\"hljs-string\">'http:'</span> || protocol === <span class=\"hljs-string\">'https:'</span>) {\n    <span class=\"hljs-keyword\">await</span> shell.openExternal(e.url)\n  }\n})\n</code></pre>\n<h3 id=\"イベント-will-navigate\"><a href=\"#イベント-will-navigate\">イベント: 'will-navigate'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>ユーザーまたはページがナビゲーションを開始しようとしたときに発生します。 <code>window.location</code> オブジェクトが変更されるか、ユーザがページ内のリンクをクリックしたときに発生することがあります。</p>\n<p>このイベントは、 <code>&#x3C;webview>.loadURL</code> や <code>&#x3C;webview>.back</code> のような、API によってプログラム上から開始されるナビゲーションのときには発行されません。</p>\n<p>アンカーリンクのクリックや <code>window.location.hash</code> の更新のような、ページ内ナビゲーションでも発行されません。 これを意図する場合は <code>did-navigate-in-page</code> を使用して下さい。</p>\n<p><code>event.preventDefault()</code> を呼んでも効果は <strong>ありません</strong>。</p>\n<h3 id=\"イベント-did-start-navigation\"><a href=\"#イベント-did-start-navigation\">イベント: 'did-start-navigation'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>フレーム (メインを含む) がナビゲーションを始めているときに発生します。 ページ内ナビゲーションの場合、<code>isInPlace</code> が <code>true</code> になります。</p>\n<h3 id=\"イベント-did-redirect-navigation\"><a href=\"#イベント-did-redirect-navigation\">イベント: 'did-redirect-navigation'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>ナビゲーション後にサーバーサイドリダイレクトが発生すると発行されます。 302 リダイレクトなどがその例です。</p>\n<h3 id=\"イベント-did-navigate\"><a href=\"#イベント-did-navigate\">イベント: 'did-navigate'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>ナビゲーションが完了したときに発行されます。</p>\n<p>このイベントは、アンカーリンクのクリックや <code>window.location.hash</code> の更新のような、ページ内ナビゲーションでは発行されません。 これを意図する場合は <code>did-navigate-in-page</code> を使用して下さい。</p>\n<h3 id=\"イベント-did-frame-navigate\"><a href=\"#イベント-did-frame-navigate\">イベント: 'did-frame-navigate'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - HTTP ナビゲーションが無い場合は-1</li>\n<li><code>httpStatusText</code> String - HTTP ナビゲーションが無い場合は空。</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>フレームのナビゲーションが完了したときに発生します。</p>\n<p>このイベントは、アンカーリンクのクリックや <code>window.location.hash</code> の更新のような、ページ内ナビゲーションでは発行されません。 これを意図する場合は <code>did-navigate-in-page</code> を使用して下さい。</p>\n<h3 id=\"イベント-did-navigate-in-page\"><a href=\"#イベント-did-navigate-in-page\">イベント: 'did-navigate-in-page'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>url</code> String</li>\n</ul>\n<p>ページ内ナビゲーションが発生したときに発行されます。</p>\n<p>ページ内ナビゲーションが行われるとき、ページのURLは変更されますがページ外でのナビゲーションは発生しません。 これが発生する例は、アンカーリンクがクリックされたときや、DOM の <code>hashchange</code> イベントがトリガーされたときです。</p>\n<h3 id=\"イベント-close\"><a href=\"#イベント-close\">イベント: 'close'</a></h3>\n<p>ゲストのページ自身が閉じようとしたときに発生します。</p>\n<p>以下のサンプルコードは、ゲストが自身を閉じるときに <code>webview</code> を <code>about:blank</code> にナビゲートします。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'close'</span>, () => {\n  webview.src = <span class=\"hljs-string\">'about:blank'</span>\n})\n</code></pre>\n<h3 id=\"イベント-ipc-message\"><a href=\"#イベント-ipc-message\">イベント: 'ipc-message'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>frameId</code> [number, number] - <code>[processId, frameId]</code> のペア。</li>\n<li><code>channel</code> String</li>\n<li><code>args</code> any[]</li>\n</ul>\n<p>ゲストページが埋め込みページに非同期メッセージを送信したときに発生します。</p>\n<p><code>sendToHost</code> メソッドと <code>ipc-message</code> イベントを使用すると、ゲストページと埋め込みページの間で通信できます。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// 埋め込みページ内</span>\n<span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'ipc-message'</span>, (event) => {\n  <span class=\"hljs-built_in\">console</span>.log(event.channel)\n  <span class=\"hljs-comment\">// \"pong\" が出力される</span>\n})\nwebview.send(<span class=\"hljs-string\">'ping'</span>)\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// ゲストページ内</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcRenderer.on(<span class=\"hljs-string\">'ping'</span>, () => {\n  ipcRenderer.sendToHost(<span class=\"hljs-string\">'pong'</span>)\n})\n</code></pre>\n<h3 id=\"イベント-crashed\"><a href=\"#イベント-crashed\">イベント: 'crashed'</a></h3>\n<p>レンダラープロセスがクラッシュしたときに発生します。</p>\n<h3 id=\"イベント-plugin-crashed\"><a href=\"#イベント-plugin-crashed\">イベント: 'plugin-crashed'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>\n<p>プラグインプロセスがクラッシュしたときに発行されます。</p>\n<h3 id=\"イベント-destroyed\"><a href=\"#イベント-destroyed\">イベント: 'destroyed'</a></h3>\n<p>webContents が破棄されたときに発生します。</p>\n<h3 id=\"イベント-media-started-playing\"><a href=\"#イベント-media-started-playing\">イベント: 'media-started-playing'</a></h3>\n<p>メディアの再生を開始するときに発行されます。</p>\n<h3 id=\"イベント-media-paused\"><a href=\"#イベント-media-paused\">イベント: 'media-paused'</a></h3>\n<p>メディアが一時停止、または再生が終了したときに発行されます。</p>\n<h3 id=\"イベント-did-change-theme-color\"><a href=\"#イベント-did-change-theme-color\">イベント: 'did-change-theme-color'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>themeColor</code> String</li>\n</ul>\n<p>ページのテーマカラーが変わったときに発生します。 これは通常、メタタグを発見すると起こります。</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">'theme-color'</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">'#ff0000'</span>></span>\n</code></pre>\n<h3 id=\"イベント-update-target-url\"><a href=\"#イベント-update-target-url\">イベント: 'update-target-url'</a></h3>\n<p>戻り値：</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>マウスをリンクにマウスオーバーしたり、キーボードでリンクにフォーカスしたときに発行されます。</p>\n<h3 id=\"イベント-devtools-opened\"><a href=\"#イベント-devtools-opened\">イベント: 'devtools-opened'</a></h3>\n<p>開発者向けツールが開かれたときに発行されます。</p>\n<h3 id=\"イベント-devtools-closed\"><a href=\"#イベント-devtools-closed\">イベント: 'devtools-closed'</a></h3>\n<p>開発者向けツールが閉じられたときに発行されます。</p>\n<h3 id=\"イベント-devtools-focused\"><a href=\"#イベント-devtools-focused\">イベント: 'devtools-focused'</a></h3>\n<p>開発者向けツールがフォーカスされた / 開かれたときに発行されます。</p>",
      "title": "<webview>タグ",
      "description": "分離したフレームとプロセスに外部ウェブコンテンツを表示します。"
    },
    "/docs/api/window-open": {
      "locale": "ja-JP",
      "slug": "window-open",
      "href": "/docs/api/window-open",
      "crowdinFileId": "256409",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/window-open.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"レンダラーからウインドウを開く\"><a href=\"#レンダラーからウインドウを開く\">レンダラーからウインドウを開く</a></h1>\n<p>レンダラー内での信頼されたもしくは信頼されていないコンテンツからのウインドウ作成を制御する方法がいくつかあります。 ウインドウはレンダラーから以下の 2 つの方法で作成できます。</p>\n<ul>\n<li><code>target=_blank</code> が付加された、リンクのクリックやフォームの送信</li>\n<li>JavaScript での <code>window.open()</code> 呼び出し</li>\n</ul>\n<p>同一オリジンコンテンツの場合、新しいウインドウは同じプロセス内で作成され、親が子ウィンドウに直接アクセスできるようになります。 これは、アプリのサブウインドウが環境設定パネルなどとして機能する場合に非常に便利です。親はサブウインドウに対して、あたかも親が持つ <code>div</code> のように直接レンダリングできます。 これはブラウザと同じ動作です。</p>\n<p><code>nativeWindowOpen</code> を false に設定すると、<code>window.open</code> は代わりに <code>BrowserWindow</code> の軽いラッパーである <a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code></a> を作成します。</p>\n<p>Electron は、このネイティブの Chrome <code>Window</code> と BrowserWindow をペアリングします。 レンダラーで作成されたウインドウに対して <code>webContents.setWindowOpenHandler()</code> を使用することで、メインプロセスでの BrowserWindow 作成と同じすべてのカスタマイズを活用できます。</p>\n<p>BrowserWindow コンストラクタのオプションは、<code>window.open()</code> の <code>features</code> 文字列からパースされたオプション、親ウインドウから継承されたセキュリティ関連の webPreferences、<a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a> で与えられたオプションの順に設定されます。 注意として、<code>webContents.setWindowOpenHandler</code> はメインプロセスで呼び出されるため、最終的な決定権と完全なアクセス権限があります。</p>\n<h3 id=\"windowopenurl-framename-features\"><a href=\"#windowopenurl-framename-features\"><code>window.open(url[, frameName][, features])</code></a></h3>\n<ul>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String (任意)</li>\n<li><code>features</code> String (任意)</li>\n</ul>\n<p>戻り値 <a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code></a> | <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window\"><code>Window</code></a></p>\n<p><code>features</code> は、ブラウザの標準フォーマットに従ったカンマ区切りのキーバリューリストです。 Electron は便宜上、このリストから <code>BrowserWindowConstructorOptions</code> をできるだけ解析します。 完全な制御とより良い人間工学を実現するため、<code>webContents.setWindowOpenHandler</code> で BrowserWindow の作成をカスタマイズするようにご検討ください。</p>\n<p><code>WebPreferences</code> のうちのいくつかは、次の features 文字列から直接フラットに設定できます。<code>zoomFactor</code>、<code>nodeIntegration</code>、<code>preload</code>、<code>javascript</code>、<code>contextIsolation</code>、<code>webviewTag</code> が設定できます。</p>\n<p>以下がその例です。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">'https://github.com'</span>, <span class=\"hljs-string\">'_blank'</span>, <span class=\"hljs-string\">'top=500,left=200,frame=false,nodeIntegration=no'</span>)\n</code></pre>\n<p><strong>注釈:</strong></p>\n<ul>\n<li>Node integration は、親ウィンドウで無効になっている場合は、開いた <code>window</code> でも常に無効になります。</li>\n<li>コンテキストイソレーションは、親ウィンドウで有効になっている場合は、開いた <code>window</code> で常に有効になります。</li>\n<li>JavaScript は、親ウィンドウで無効になっている場合は、開いた <code>window</code> でも常に無効になります。</li>\n<li><code>features</code> で指定された非標準機能 (Chromium や Electron によって処理されない) は、<code>options</code> 引数内の登録された <code>webContents</code> の <code>did-create-window</code> イベントハンドラに渡されます。</li>\n<li><code>frameName</code> は、<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters\">ネイティブのドキュメント</a> にある <code>windowName</code> の仕様に従います。</li>\n</ul>\n<p>ウインドウの作成をカスタマイズまたはキャンセルするにあたって、メインプロセスから <code>webContents.setWindowOpenHandler()</code> でオーバーライドハンドラーを任意設定できます。 <code>{ action: 'deny' }</code> を返すと、ウィンドウはキャンセルされます。 <code>{ action: 'allow', overrideBrowserWindowOptions: { ... } }</code> を返すと、ウインドウを開くことと、ウィンドウ作成時に使用する <code>BrowserWindowConstructorOptions</code> の設定を許可します。 これは、feature 文字列でオプションを渡すよりも強力であることに注意してください。レンダラーは、セキュリティ設定を決定する権限がメインプロセスよりも制限されているからです。</p>\n<h3 id=\"ネイティブの-window-のサンプル\"><a href=\"#ネイティブの-window-のサンプル\">ネイティブの <code>Window</code> のサンプル</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// main.js</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-comment\">// この例では、URL が `about:blank` であるウインドウのみが作成されます。</span>\n<span class=\"hljs-comment\">// ほかのすべての URL はブロックされます。</span>\nmainWindow.webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (url === <span class=\"hljs-string\">'about:blank'</span>) {\n    <span class=\"hljs-keyword\">return</span> {\n      <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span>,\n      <span class=\"hljs-attr\">overrideBrowserWindowOptions</span>: {\n        <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span>,\n        <span class=\"hljs-attr\">fullscreenable</span>: <span class=\"hljs-literal\">false</span>,\n        <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'black'</span>,\n        <span class=\"hljs-attr\">webPreferences</span>: {\n          <span class=\"hljs-attr\">preload</span>: <span class=\"hljs-string\">'my-child-window-preload-script.js'</span>\n        }\n      }\n    }\n  }\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// レンダラープロセス (mainWindow)</span>\n<span class=\"hljs-keyword\">const</span> childWindow = <span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">''</span>, <span class=\"hljs-string\">'modal'</span>)\nchildWindow.document.write(<span class=\"hljs-string\">'&#x3C;h1>Hello&#x3C;/h1>'</span>)\n</code></pre>\n<h3 id=\"browserwindowproxy-のサンプル\"><a href=\"#browserwindowproxy-のサンプル\"><code>BrowserWindowProxy</code> のサンプル</a></h3>\n<pre><code class=\"hljs language-javascript\">\n<span class=\"hljs-comment\">// main.js</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nativeWindowOpen</span>: <span class=\"hljs-literal\">false</span> }\n})\n\nmainWindow.webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (url.startsWith(<span class=\"hljs-string\">'https://github.com/'</span>)) {\n    <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span> }\n  }\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n\nmainWindow.webContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (childWindow) => {\n  <span class=\"hljs-comment\">// 例えば...</span>\n  childWindow.webContents.on(<span class=\"hljs-string\">'will-navigate'</span>, (e) => {\n    e.preventDefault()\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// renderer.js</span>\n<span class=\"hljs-keyword\">const</span> windowProxy = <span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">'https://github.com/'</span>, <span class=\"hljs-literal\">null</span>, <span class=\"hljs-string\">'minimizable=false'</span>)\nwindowProxy.postMessage(<span class=\"hljs-string\">'hi'</span>, <span class=\"hljs-string\">'*'</span>)\n</code></pre>",
      "title": "レンダラーからウインドウを開く",
      "description": ""
    },
    "/docs/tutorial/windows-arm": {
      "locale": "ja-JP",
      "slug": "windows-arm",
      "href": "/docs/tutorial/windows-arm",
      "crowdinFileId": "256271",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-arm.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"arm-版-windows\"><a href=\"#arm-版-windows\">Arm 版 Windows</a></h1>\n<p>アプリを Electron 6.0.8 以降で実行している場合、Arm 版 Windows 10 向けにビルドできます。 これによりパフォーマンスが大幅に向上しますが、アプリで使用されているネイティブモジュールを再コンパイルする必要があります。 また、ビルドおよびパッケージ化スクリプトの小さな修正が必要になる場合があります。</p>\n<h2 id=\"基本的なアプリの実行\"><a href=\"#基本的なアプリの実行\">基本的なアプリの実行</a></h2>\n<p>アプリがネイティブモジュールを使用していない場合は、アプリの Arm 版は簡単に作成できます。</p>\n<ol>\n<li>アプリの <code>node_modules</code> ディレクトリが空であることを確認してください。</li>\n<li><em>コマンドプロンプト</em> を使用して、<code>set npm_config_arch = arm64</code> を実行してから、同じように <code>npm install</code> / <code>yarn install</code> を実行します。</li>\n<li><a href=\"/docs/tutorial/quick-start#prerequisites\">Electron を開発用の依存関係としてインストールしている場合</a>、npm は arm64 版をダウンロードして解凍します。 その後、通常どおりアプリをパッケージ化して配布できます。</li>\n</ol>\n<h2 id=\"一般的な考慮事項\"><a href=\"#一般的な考慮事項\">一般的な考慮事項</a></h2>\n<h3 id=\"アーキテクチャ固有のコード\"><a href=\"#アーキテクチャ固有のコード\">アーキテクチャ固有のコード</a></h3>\n<p>Windows 固有コードの多くには if... else ロジックが含まれています。これは、x64 アーキテクチャと x86 アーキテクチャのどちらかを選択するものです。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">if</span> (process.arch === <span class=\"hljs-string\">'x64'</span>) {\n  <span class=\"hljs-comment\">// 64 ビット固有の処理をする...</span>\n} <span class=\"hljs-keyword\">else</span> {\n  <span class=\"hljs-comment\">// 32 ビット固有の処理をする...</span>\n}\n</code></pre>\n<p>arm64 をターゲットにしたい場合、このようなロジックは通常間違ったアーキテクチャを選択するため、アプリケーションを慎重に確認したうえで、このような条件のスクリプトを作成してください。 カスタムビルドおよびパッケージスクリプトでは、現在の process.arch に依存するのではなく、環境内の <code>npm_config_arch</code> の値を常に確認する必要があります。</p>\n<h3 id=\"ネイティブモジュール\"><a href=\"#ネイティブモジュール\">ネイティブモジュール</a></h3>\n<p>ネイティブモジュールを使用する場合は、MSVC コンパイラの v142 (Visual Studio 2017 で提供) に対してコンパイルしていることを確認する必要があります。 また、ネイティブモジュールによって提供または参照されているビルド済みの <code>.dll</code> または <code>.lib</code> ファイルが Arm 版 Windows で使用できることも確認する必要があります。</p>\n<h3 id=\"アプリをテストする\"><a href=\"#アプリをテストする\">アプリをテストする</a></h3>\n<p>アプリをテストするには、Windows 10 (バージョン 1903 以降) を実行している Arm 版 Windows デバイスを使用します。 必ずターゲットデバイスにアプリケーションをコピーしてください。Chromium のサンドボックスは、ネットワーク位置上からアプリケーションアセットを読み込むと正しく機能しません。</p>\n<h2 id=\"開発要件\"><a href=\"#開発要件\">開発要件</a></h2>\n<h3 id=\"nodejsnode-gyp\"><a href=\"#nodejsnode-gyp\">Node.js/node-gyp</a></h3>\n<p><a href=\"https://nodejs.org/en/\">Node.js v12.9.0 以降を推奨します。</a> 新しいバージョンの Node へのアップデートが望ましくない場合は、代わりに <a href=\"https://github.com/nodejs/node-gyp/wiki/Updating-npm&#x27;s-bundled-node-gyp\">npm の node-gyp のコピーを手動でバージョン 5.0.2 以降に更新</a> できます。これには、Arm 向けのネイティブモジュールをコンパイルするために必要な変更が含まれています。</p>\n<h3 id=\"visual-studio-2017\"><a href=\"#visual-studio-2017\">Visual Studio 2017</a></h3>\n<p>ネイティブモジュールのクロスコンパイルには、Visual Studio 2017 (いずれかのエディション) が必要です。 Visual Studio Community 2017 は、Microsoft の <a href=\"https://visualstudio.microsoft.com/dev-essentials/\">Visual Studio Dev Essentials プログラム</a> からダウンロードできます。 インストール後、<em>コマンドプロンプト</em> から次のコマンドを実行して、Arm 固有のコンポーネントを追加できます。</p>\n<pre><code class=\"hljs language-powershell\">vs_installer.exe ^\n--add Microsoft.VisualStudio.Workload.NativeDesktop ^\n--add Microsoft.VisualStudio.Component.VC.ATLMFC ^\n--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ^\n--add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ^\n--includeRecommended\n</code></pre>\n<h4 id=\"クロスコンパイルするコマンドプロンプトの作成\"><a href=\"#クロスコンパイルするコマンドプロンプトの作成\">クロスコンパイルするコマンドプロンプトの作成</a></h4>\n<p>環境で <code>npm_config_arch = arm64</code> を設定すると、正しい arm64 の <code>.obj</code> ファイルが作成されますが、VS 2017 標準の <em>開発者向けコマンドプロンプト for VS 2017</em> は x64 リンカーを使用します 。 これを修正するには以下のようにします。</p>\n<ol>\n<li><em>x64_x86 Cross Tools Command Prompt for VS 2017</em> ショートカットを複製します (たとえば、スタートメニューで見つけて、右クリックし、<em>ファイルの場所を開く</em> を選択して、コピーアンドペーストします)。</li>\n<li>新しいショートカットで右クリックして、<em>プロパティ</em> を選びます。</li>\n<li><em>Target</em> フィールドを、<code>vcvarsamd64_x86.bat</code> ではなく、最後の<code>vcvarsamd64_arm64.bat</code> を読み取るように変更します。</li>\n</ol>\n<p>正常に完了すると、そのコマンドプロンプトは起動時に以下のようなものを出力するはずです。</p>\n<pre><code class=\"hljs language-bat\">**********************************************************************\n** Visual Studio <span class=\"hljs-number\">2017</span> Developer Command Prompt v15.<span class=\"hljs-number\">9</span>.<span class=\"hljs-number\">15</span>\n** Copyright (c) <span class=\"hljs-number\">2017</span> Microsoft Corporation\n**********************************************************************\n[vcvarsall.bat] Environment initialized <span class=\"hljs-keyword\">for</span>: 'x64_arm64'\n</code></pre>\n<p>Arm 版 Windows デバイスでアプリケーションを直接開発したい場合は、デバイスの x86 エミュレーションでクロスコンパイルが発生するように、<em>Target</em> を <code>vcvarsx86_arm64.bat</code> に置き換えます。</p>\n<h3 id=\"正しい-nodelib-に対してリンクする\"><a href=\"#正しい-nodelib-に対してリンクする\">正しい <code>node.lib</code> に対してリンクする</a></h3>\n<p>デフォルトでは、<code>node-gyp</code> は Electron の node ヘッダーをアンパックし、<code>node.lib</code> の x86 および x64 バージョンを <code>%APPDATA%\\..\\Local\\node-gyp\\Cache</code> にダウンロードします。ただし、arm64 バージョンはダウンロードされません (<a href=\"https://github.com/nodejs/node-gyp/pull/1875\">この修正は開発中です</a>)。 これを修正するには以下のようにします。</p>\n<ol>\n<li><a href=\"https://electronjs.org/headers/v6.0.9/win-arm64/node.lib\">https://electronjs.org/headers/v6.0.9/win-arm64/node.lib</a> から arm64 の <code>node.lib</code> をダウンロードします</li>\n<li>それを <code>%APPDATA%\\..\\Local\\node-gyp\\Cache\\6.0.9\\arm64\\node.lib</code> に移動します</li>\n</ol>\n<p><code>6.0.9</code> は使用しているバージョンに置き換えてください。</p>\n<h2 id=\"ネイティブモジュールのクロスコンパイル\"><a href=\"#ネイティブモジュールのクロスコンパイル\">ネイティブモジュールのクロスコンパイル</a></h2>\n<p>上記のすべてを完了した後、クロスコンパイルコマンドプロンプトを開き、<code>set npm_config_arch = arm64</code> を実行します。 そして <code>npm install</code> を使用して、通常どおりプロジェクトをビルドします。 x86 モジュールのクロスコンパイルと同様に、事前に別のアーキテクチャ用にコンパイルされたネイティブモジュールを強制的に再コンパイルするには、<code>node_modules</code> を削除する必要があります。</p>\n<h2 id=\"ネイティブモジュールのデバッグ\"><a href=\"#ネイティブモジュールのデバッグ\">ネイティブモジュールのデバッグ</a></h2>\n<p>ネイティブモジュールのデバッグは、Visual Studio 2017 (開発マシン上で実行) および対応する <a href=\"https://docs.microsoft.com/en-us/visualstudio/debugger/remote-debugging-cpp?view=vs-2019\">Visual Studio Remote Debugger</a> をターゲットのデバイス上で実行することで実行できます。 デバッグするには以下のようにします。</p>\n<ol>\n<li><em>コマンドプロンプト</em> を介して、ターゲットデバイスでアプリの <code>.exe</code> を起動します (これに <code>-inspect-brk</code> を渡すと、ネイティブモジュールがロードされる前に一時停止します)。</li>\n<li>開発マシン上で Visual Studio 2017 を起動します。</li>\n<li>ターゲットのデバイスに接続するためには、<em>デバッグ > プロセスにアタッチ...</em> を選択し、デバイスの IP アドレスと Visual Studio Remote Debugger ツールに表示されているポート番号を入力します。</li>\n<li><em>更新</em> をクリックしてから、<a href=\"/docs/development/debug-instructions-windows\">割り当てるべき正しい Electron プロセス</a> を選択します。</li>\n<li>アプリのネイティブモジュールのシンボルが正しくロードされていることを確認する必要がある場合があるでしょう。 これを構成するには、Visual Studio 2017 で <em>デバッグ > オプション...</em> に進み、<em>デバッグ > シンボル</em> 下で <code>.pdb</code> シンボルが含まれたフォルダーを追加します。</li>\n<li>接続したら、適切なブレークポイントを設定し、Chrome の <a href=\"/docs/tutorial/debugging-main-process\">Node 向けリモートツール</a> を使用して JavaScript の実行を再開します。</li>\n</ol>\n<h2 id=\"さらなるヘルプが必要な場合\"><a href=\"#さらなるヘルプが必要な場合\">さらなるヘルプが必要な場合</a></h2>\n<p>このドキュメントで問題に遭遇した場合、または x86 向けにコンパイルされたアプリが動作しても arm64 向けにコンパイルされたアプリが動作しない場合は、タイトルに \"Windows on Arm\" と入れて <a href=\"/docs/development/issues\">Issue を提出</a> してください。</p>",
      "title": "Arm 版 Windows",
      "description": ""
    },
    "/docs/tutorial/windows-store-guide": {
      "locale": "ja-JP",
      "slug": "windows-store-guide",
      "href": "/docs/tutorial/windows-store-guide",
      "crowdinFileId": "256273",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-store-guide.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"windowsストア-ガイド\"><a href=\"#windowsストア-ガイド\">Windowsストア ガイド</a></h1>\n<p>Windows 10では、古き良き Win32 実行形式は新たな兄弟をむかえました: Universal Windows Platform。 新しい <code>.appx</code> フォーマットは、Cortana や Push通知のような新しい強力な API を利用できるだけでなく、Windows ストアを通じて、シンプルなインストールとアップデートが可能になります。</p>\n<p>Microsoft は <a href=\"https://github.com/catalystcode/electron-windows-store\">Electron アプリを <code>.appx</code> パッケージとしてコンパイル可能なツールを開発</a>したため、開発者は新しいアプリケーション モデルの一部を使用できます。 このガイドではその使用方法 - Electron AppX パッケージの機能と制限について解説します。</p>\n<h2 id=\"背景と必要条件\"><a href=\"#背景と必要条件\">背景と必要条件</a></h2>\n<p>Windows 10 \"Anniversary Update\" では、仮想ファイルシステムとレジストリと共に起動することで win32 <code>.exe</code> バイナリを実行できます。 どちらも、Windows Container内部でアプリとインストーラーを実行することで、インストール中のオペレーティングシステムに対する変更を正確に検出できます。 仮想ファイルシステムと仮想レジストリを実行ファイルのペアにすることで、Windowsがワンクリックでインストールとアンインストールが可能になる。</p>\n<p>さらにexeは内部的にはappxモデルとして起動される - つまりUniversal Windows Platformで利用可能なAPIの多くを使用できる。 より多くの機能として、Electronアプリは <code>exe</code>と共に、バックグラウンドでタスクを実行する、プッシュ通知を受け取る、他のUWPアプリケーションと通信するなど、表示しないUWPバックグラウンドタスクを組合せることができます。</p>\n<p>既存のElectronアプリをコンパイルするには、以下の要件を満たしていることを確認してください:</p>\n<ul>\n<li>Windows 10 with Anniversary Update (2016年8月2日にリリース)</li>\n<li>Windows 10 SDK <a href=\"https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk\">ここからダウンロード</a></li>\n<li>少なくてもNode 4 (<code>node -v</code>を実行してチェックできます)</li>\n</ul>\n<p>次に、<code>electron-windows-store</code> CLIに移動してインストールする:</p>\n<pre><code class=\"hljs language-sh\">npm install -g electron-windows-store\n</code></pre>\n<h2 id=\"ステップ1-electronアプリケーションのパッケージ化\"><a href=\"#ステップ1-electronアプリケーションのパッケージ化\">ステップ1: Electronアプリケーションのパッケージ化</a></h2>\n<p><a href=\"https://github.com/electron/electron-packager\">electron-packager</a> (または類似ツール) を用いてパッケージします。 アプリケーションサイズが大きくなるので、実際には必要ないモジュールを<code>node_modules</code>から確実に削除します。</p>\n<p>出力はおおよそ以下のようになります:</p>\n<pre><code class=\"hljs language-plaintext\">├── Ghost.exe\n├── LICENSE\n├── content_resources_200_percent.pak\n├── content_shell.pak\n├── d3dcompiler_47.dll\n├── ffmpeg.dll\n├── icudtl.dat\n├── libEGL.dll\n├── libGLESv2.dll\n├── locales\n│   ├── am.pak\n│   ├── ar.pak\n│   ├── [...]\n├── node.dll\n├── resources\n│   └── app.asar\n├── v8_context_snapshot.bin\n├── squirrel.exe\n└── ui_resources_200_percent.pak\n</code></pre>\n<h2 id=\"ステップ2-electron-windows-storeを実行\"><a href=\"#ステップ2-electron-windows-storeを実行\">ステップ2: electron-windows-storeを実行</a></h2>\n<p>昇格したPowerShell(管理者として実行) で、入力と出力ディレクトリ、アプリ名とバージョン、<code>node_modules</code>をフラット化することの確認など、必要なパラメーターと共に<code>electron-windows-store</code>を実行する。</p>\n<pre><code class=\"hljs language-powershell\">electron-windows-store `\n    --input-directory C:\\myelectronapp `\n    --output-directory C:\\output\\myelectronapp `\n    --package-version <span class=\"hljs-number\">1.0</span>.<span class=\"hljs-number\">0.0</span> `\n    --package-name myelectronapp\n</code></pre>\n<p>一度ツールが実行されると: Electronアプリを入力として受け入れて、<code>node_modules</code>をフラット化します。 次にアプリケーションを<code>app.zip</code>としてアーカイブします。 インストーラーとWindows Containerを使って、ツールは、出力フォルダーにWindows Application Manifest (<code>AppXManifest.xml</code>) 、仮想ファイルシステム、仮想レジストリーを含む「拡張された」AppXパッケージを作成します。</p>\n<p>拡張されたAppXファイルが作成されると、ツールはディスク上のそれらのファイルから、単一ファイルのAppXパッケージを作成するためにWindows App Packager(<code>MakeAppx.exe</code>) を使用します。 最後にツールはAppXパッケージを署名するためにコンピューター上に信頼された証明書を作成します。 署名されたAppXパッケージを使うと、CLIはマシンにパッケージを自動的にインストールすることもできる。</p>\n<h2 id=\"ステップ3-appxパッケージの使用\"><a href=\"#ステップ3-appxパッケージの使用\">ステップ3: AppXパッケージの使用</a></h2>\n<p>あなたのパッケージを実行するために、ユーザーは\"Anniversary Update\"と呼ばれるWindows 10が必要です。Windowsを更新する方法の詳細は<a href=\"https://blogs.windows.com/windowsexperience/2016/08/02/how-to-get-the-windows-10-anniversary-update\">ここ</a>をご参照ください。</p>\n<p>従来のUWPアプリと対照的に、パッケージ化されたアプリは、現在、<a href=\"https://developer.microsoft.com/en-us/windows/projects/campaigns/desktop-bridge\">ここ</a>で申請できる手動検証プロセスが必要です。 全てのユーザーはパッケージをダブルクリックすることでインストールできるため、もしより簡単なインストール方法を探しているのであれば、ストアへのサブミットは必要ではありません。 (通常はエンタープライズなど) 管理された環境 では、<code>Add-AppxPackage</code> <a href=\"https://technet.microsoft.com/en-us/library/hh856048.aspx\">PowerShell Cmdletを使用して自動的にインストールできる</a>。</p>\n<p>もう一つの重要な制限は、コンパイルされたAppXパッケージはまだWin32実行形式であり、Xbox、HoloLens、Phoneでは実行できないことです。</p>\n<h2 id=\"オプション-backgroundtaskを使ってuwp機能を追加\"><a href=\"#オプション-backgroundtaskを使ってuwp機能を追加\">オプション: BackgroundTaskを使ってUWP機能を追加</a></h2>\n<p>プッシュ通知、Cortana統合、ライブタイルなど、Windows 10機能を完全に使った非表示UWPバックグラウンドタスクとElectronアプリを組み合わせることができます。</p>\n<p>Electronアプリがバックグラウンドタスクを使って、トースト通知の送信とライブタイルを利用する方法は、<a href=\"https://github.com/felixrieseberg/electron-uwp-background\">マイクロソフトが提供するサンプルをチェック</a>してください。</p>\n<h2 id=\"オプション-コンテナ仮想化を使った変換\"><a href=\"#オプション-コンテナ仮想化を使った変換\">オプション: コンテナ仮想化を使った変換</a></h2>\n<p>ほとんどのElectronアプリは、AppX パッケージを生成するために<code>electron-windows-store</code> CLIで動作するテンプレートを使っている。 しかし、もしもカスタムインストーラーを使った場合や、生成されたパッケージで問題が発生した場合には、Windows Containerでコンパイルを使ったパッケージ作成を試すことができ、このモデルでは、アプリケーションがオペレーティングシステムに対して具体的にどんな変更をしているのかを検出するため、CLIは空のWindows Containerにアプリケーションをインストールして実行します。</p>\n<p>初めてCLIを実行する前に「Windows Desktop App Converter」をセットアップする必要があります。 これには数分かかりますが、一度だけなので心配する必要はありません。 <a href=\"https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-run-desktop-app-converter\">ここから</a>Desktop App Conveterをダウンロードします。 あなたは2つのファイルを受け取ります: <code>DesktopAppConverter.zip</code>と<code>BaseImage-14316.wim</code></p>\n<ol>\n<li><code>DesktopAppConverter.zip</code>を展開します。 (管理者として実行) で昇格したPowerShellで<code>Set-ExecutionPolicy bypass</code>を呼び出して、システム実行ポリシーで全ての実行を可能にします。</li>\n<li>次にDesktop App Converterのインストールを実行して、(<code>BaseImage-14316.wim</code>としてダウンロードされた) Windowsベースイメージの場所を渡して、<code>.\\DesktopAppConverter.ps1 -Setup -BaseImage .\\BaseImage-14316.wim</code>を呼び出します。</li>\n<li>上記コマンドを実行して再起動が促されたら、マシンを再起動して、再起動に成功した後で上記コマンドをもう一度実行してください。</li>\n</ol>\n<p>インストールが成功すると、Electronアプリのコンパイルに進むことができます。</p>",
      "title": "Windowsストア ガイド",
      "description": ""
    },
    "/docs/tutorial/windows-taskbar": {
      "locale": "ja-JP",
      "slug": "windows-taskbar",
      "href": "/docs/tutorial/windows-taskbar",
      "crowdinFileId": "256275",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-taskbar.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"タスクバーのカスタマイズ-windows\"><a href=\"#タスクバーのカスタマイズ-windows\">タスクバーのカスタマイズ (Windows)</a></h1>\n<h2 id=\"概要\"><a href=\"#概要\">概要</a></h2>\n<p>Electron には Windows のタスクバー中のアプリアイコンを設定するための API があります。 このAPIは、<a href=\"#jumplist\"><code>ジャンプリスト</code> の作成</a>、<a href=\"#thumbnail-toolbars\">カスタムサムネイルやツールバー</a> などの Windows 専用機能と、<a href=\"#icon-overlays-in-taskbar\">アイコンオーバーレイ</a>、いわゆる <a href=\"#flash-frame\">\"枠点滅\" 効果</a>、<a href=\"/docs/tutorial/recent-documents\">最近開いたドキュメント</a>、<a href=\"/docs/tutorial/progress-bar\">アプリケーションの進捗状況</a> などのクロスプラットフォーム機能があります。</p>\n<h2 id=\"ジャンプ-リスト\"><a href=\"#ジャンプ-リスト\">ジャンプ リスト</a></h2>\n<p>Windows では、ユーザがタスクバーのアプリのアイコンを右クリックしたときに表示されるカスタムコンテキストメニューを定義できます。 このコンテキストメニューは <code>ジャンプ リスト</code> と呼ばれます。 ジャンプリストの <code>タスク</code> カテゴリのカスタムアクションを指定します。以下は <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#tasks\">MSDN</a> からの引用です。</p>\n<blockquote>\n<p>アプリケーションは、プログラムの機能と、ユーザがそれらを使用することが期待されるべきことの両方に基づいてタスクを定義します。 タスクを実行するためにアプリケーションを実行する必要がないという点で、タスクはコンテキストフリーである必要があります。 それらは、電子メールのメッセージを作成したり、メールプログラムでカレンダーを開いたり、ワープロで新しい文書を作成したり、特定のモードでアプリケーションを起動したりするなど、通常のユーザーがアプリケーションで実行する統計的に最も一般的なアクション、またはそのサブコマンドの1つでもあります。 アプリケーションは、標準ユーザが必要としない高度な機能や、登録などの1回限りの操作でメニューを乱雑にするべきではありません。 アップグレードや特別オファーなどのプロモーションの道具にタスクを使用しないでください。</p>\n<p>タスクリストは静的にすることを強く推奨します。 これはアプリケーションの状態や状態に関係なく、同じままにするべきです。 リストを動的に変更することは可能ですが、宛先リストのその部分が変更されることを期待していないユーザを混乱させる可能性があることを考慮する必要があります。</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420539.png\" alt=\"Internet Explorer\"></p>\n<blockquote>\n<p>注意: 上のスクリーンショットは、Internet Explorer の一般的なタスクの例です。</p>\n</blockquote>\n<p>実際のメニューである macOS のドックメニューとは異なり、Windows のユーザータスクはアプリケーションショートカットのように機能します。 例えば、ユーザーがタスクをクリックするとプログラムを指定の引数で実行します。</p>\n<p>アプリケーションにユーザタスクを設定するには、以下のように <a href=\"/docs/api/app#appsetusertaskstasks-windows\">app.setUserTasks</a> API を使用します。</p>\n<h4 id=\"サンプル\"><a href=\"#サンプル\">サンプル</a></h4>\n<h5 id=\"ユーザータスクをセットする\"><a href=\"#ユーザータスクをセットする\">ユーザータスクをセットする</a></h5>\n<p><a href=\"/docs/tutorial/quick-start\">クイックスタートガイド</a> の作業用アプリケーションから始めることにして、 <code>main.js</code> ファイルを以下の行の通りに更新します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setUserTasks([\n  {\n    <span class=\"hljs-attr\">program</span>: process.execPath,\n    <span class=\"hljs-attr\">arguments</span>: <span class=\"hljs-string\">'--new-window'</span>,\n    <span class=\"hljs-attr\">iconPath</span>: process.execPath,\n    <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'New Window'</span>,\n    <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Create a new window'</span>\n  }\n])\n</code></pre>\n<h5 id=\"タスクリストを消去する\"><a href=\"#タスクリストを消去する\">タスクリストを消去する</a></h5>\n<p>タスクリストを消去するには、<code>main.js</code> ファイルで <code>app.setUserTasks</code> に空の配列を渡して呼び出す必要があります。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setUserTasks([])\n</code></pre>\n<blockquote>\n<p>注意: ユーザータスクはアプリケーションを閉じた後も表示されるので、タスクに指定したアイコンとプログラムのパスは、アプリケーションがアンインストールされるまで存在するべきです。</p>\n</blockquote>\n<h3 id=\"サムネイルツールバー\"><a href=\"#サムネイルツールバー\">サムネイルツールバー</a></h3>\n<p>Windows では、アプリケーションウィンドウのタスクバーレイアウトに、指定されたボタンを含むサムネイルツールバーを追加できます。 ウィンドウを復元したりアクティブにしたりすることなく、特定のウィンドウのコマンドにアクセスする方法をユーザーに提供します。</p>\n<p>以下は <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#thumbnail-toolbars\">MSDN</a> からの引用です。</p>\n<blockquote>\n<p>このツールバーは、おなじみの標準ツールバー共通コントロールです。 最大で7つのボタンを持てます。 各ボタンのID、画像、ツールチップ、および状態は構造体で定義され、その構造体はタスクバーに渡されます。 アプリケーションは、現在の状態に応じてサムネイルツールバーからボタンを表示、有効化、無効化、または非表示にさせることができます。</p>\n<p>たとえば、Windows Media Player では、再生、一時停止、ミュート、停止などの標準のメディア送りコントロールを提供できます。</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420540.png\" alt=\"Windows Media Player\"></p>\n<blockquote>\n<p>注意: 上のスクリーンショットは、Windows メディアプレイヤーのサムネイルツールバーの例です。</p>\n</blockquote>\n<p>アプリケーションにサムネイルツールバーを設定するには、<a href=\"/docs/api/browser-window#winsetthumbarbuttonsbuttons-windows\">BrowserWindow.setThumbarButtons</a> を使用する必要があります。</p>\n<h4 id=\"サンプル-1\"><a href=\"#サンプル-1\">サンプル</a></h4>\n<h5 id=\"サムネイルツールバーをセットする\"><a href=\"#サムネイルツールバーをセットする\">サムネイルツールバーをセットする</a></h5>\n<p><a href=\"/docs/tutorial/quick-start\">クイックスタートガイド</a> の作業用アプリケーションから始めることにして、 <code>main.js</code> ファイルを以下の行の通りに更新します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.setThumbarButtons([\n  {\n    <span class=\"hljs-attr\">tooltip</span>: <span class=\"hljs-string\">'button1'</span>,\n    <span class=\"hljs-attr\">icon</span>: path.join(__dirname, <span class=\"hljs-string\">'button1.png'</span>),\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'button1 clicked'</span>) }\n  }, {\n    <span class=\"hljs-attr\">tooltip</span>: <span class=\"hljs-string\">'button2'</span>,\n    <span class=\"hljs-attr\">icon</span>: path.join(__dirname, <span class=\"hljs-string\">'button2.png'</span>),\n    <span class=\"hljs-attr\">flags</span>: [<span class=\"hljs-string\">'enabled'</span>, <span class=\"hljs-string\">'dismissonclick'</span>],\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'button2 clicked.'</span>) }\n  }\n])\n</code></pre>\n<h5 id=\"サムネイルツールバーを消去する\"><a href=\"#サムネイルツールバーを消去する\">サムネイルツールバーを消去する</a></h5>\n<p>サムネイルツールバーをきれいにするには、<code>main.js</code> で以下のように <code>BrowserWindow.setThumbarButtons</code> を空の配列で呼び出してください。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.setThumbarButtons([])\n</code></pre>\n<h3 id=\"タスクバー内のアイコンオーバーレイ\"><a href=\"#タスクバー内のアイコンオーバーレイ\">タスクバー内のアイコンオーバーレイ</a></h3>\n<p>Windows では、タスクバーボタンで小さなオーバーレイを使用してアプリケーションのステータスを表示できます。</p>\n<p>以下は <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#icon-overlays\">MSDN</a> からの引用です。</p>\n<blockquote>\n<p>アイコンオーバーレイは状況のコンテキスト通知として機能し、その情報をユーザーに伝達するための別の通知領域ステータスアイコンの必要性を否定することを目的としています。 たとえば、現在通知領域に表示されている Microsoft Outlook の新着メールステータスは、タスクバーボタンの上にオーバーレイ表示されるようになりました。 繰り返しますが、開発サイクルの中でどの方法があなたのアプリケーションに最適であるかを決める必要があります。 オーバーレイアイコンは、ネットワークステータス、メッセンジャーステータス、新着メールなど、重要な長期にわたるステータスや通知を提供することを目的としています。 ユーザには、絶えず変化するオーバーレイやアニメーションを表示してはいけません。</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420441.png\" alt=\"タスクバーボタン上のオーバーレイ\"></p>\n<blockquote>\n<p>注意: 上のスクリーンショットは、タスクバーボタンのオーバーレイの例です。</p>\n</blockquote>\n<p>ウインドウのオーバーレイアイコンを設定するには、<a href=\"/docs/api/browser-window#winsetoverlayiconoverlay-description-windows\">BrowserWindow.setOverlayIcon</a> API を使用する必要があります。</p>\n<h4 id=\"サンプル-2\"><a href=\"#サンプル-2\">サンプル</a></h4>\n<p><a href=\"/docs/tutorial/quick-start\">クイックスタートガイド</a> の作業用アプリケーションから始めることにして、 <code>main.js</code> ファイルを以下の行の通りに更新します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.setOverlayIcon(<span class=\"hljs-string\">'path/to/overlay.png'</span>, <span class=\"hljs-string\">'Description for overlay'</span>)\n</code></pre>\n<h3 id=\"枠の点滅\"><a href=\"#枠の点滅\">枠の点滅</a></h3>\n<p>Windows では、タスクバーボタンをハイライトしてユーザの注意を引くことができます。 これは macOS で Dock アイコンがバウンスするのに似ています。</p>\n<p>以下は <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-flashwindow#remarks\">MSDN</a> からの引用です。</p>\n<blockquote>\n<p>通常、ウィンドウは注意が必要でも現在キーボードフォーカスがないことをユーザーに知らせるために点滅します。</p>\n</blockquote>\n<p>BrowserWindow のタスクバーボタンを点滅させるには、<a href=\"/docs/api/browser-window#winflashframeflag\">BrowserWindow.flashFrame</a> API を使用する必要があります。</p>\n<h4 id=\"サンプル-3\"><a href=\"#サンプル-3\">サンプル</a></h4>\n<p><a href=\"/docs/tutorial/quick-start\">クイックスタートガイド</a> の作業用アプリケーションから始めることにして、 <code>main.js</code> ファイルを以下の行の通りに更新します。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.once(<span class=\"hljs-string\">'focus'</span>, () => win.flashFrame(<span class=\"hljs-literal\">false</span>))\nwin.flashFrame(<span class=\"hljs-literal\">true</span>)\n</code></pre>\n<blockquote>\n<p>注意: <code>win.flashFrame(false)</code> を呼び出して点滅を切ることを、忘れないようにしてください。 上記の例ではウインドウがフォーカスされたときに呼び出されますが、タイムアウトなどのイベントを使用して無効にすることもできます。</p>\n</blockquote>",
      "title": "タスクバーのカスタマイズ (Windows)",
      "description": "アプリケーションは、プログラムの機能と、ユーザがそれらを使用することが期待されるべきことの両方に基づいてタスクを定義します。 タスクを実行するためにアプリケーションを実行する必要がないという点で、タスクはコンテキストフリーである必要があります。 それらは、電子メールのメッセージを作成したり、メールプログラムでカレンダーを開いたり、ワープロで新しい文書を作成したり、特定のモードでアプリケーションを起動したりするなど、通常のユーザーがアプリケーションで実行する統計的に最も一般的なアクション、またはそのサブコマンドの1つでもあります。 アプリケーションは、標準ユーザが必要としない高度な機能や、登録などの1回限りの操作でメニューを乱雑にするべきではありません。 アップグレードや特別オファーなどのプロモーションの道具にタスクを使用しないでください。\nタスクリストは静的にすることを強く推奨します。 これはアプリケーションの状態や状態に関係なく、同じままにするべきです。 リストを動的に変更することは可能ですが、宛先リストのその部分が変更されることを期待していないユーザを混乱させる可能性があることを考慮する必要があります。"
    }
  },
  "es-ES": {
    "/docs/api/accelerator": {
      "locale": "es-ES",
      "slug": "accelerator",
      "href": "/docs/api/accelerator",
      "crowdinFileId": "256277",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/accelerator.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"combinaciones-de-teclas\"><a href=\"#combinaciones-de-teclas\">Combinaciones de teclas</a></h1>\n<blockquote>\n<p>Definir atajos del teclado.</p>\n</blockquote>\n<p>Los Atajos son strings que pueden contener múltiples modificadores y un único código clave, en combinación con el carácter <code>+</code> se utilizan para definir métodos abreviados de teclado a través de su aplicación.</p>\n<p>Ejemplos:</p>\n<ul>\n<li><code>CommandOControl+A</code></li>\n<li><code>CommandOControl+Shift+Z</code></li>\n</ul>\n<p>Los atajos son registrados con el módulo e <a href=\"/docs/api/global-shortcut\"><code>globalShortcut</code></a> usando el método <a href=\"/docs/api/global-shortcut#globalshortcutregisteraccelerator-callback\"><code>register</code></a>, ejemplo.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Register a 'CommandOrControl+Y' shortcut listener.</span>\n  globalShortcut.register(<span class=\"hljs-string\">'CommandOrControl+Y'</span>, () => {\n    <span class=\"hljs-comment\">// Hacer algo cuando se presiona tanto Tecla Command o Control + Y.</span>\n  })\n})\n</code></pre>\n<h2 id=\"nota-sobre-plataformas\"><a href=\"#nota-sobre-plataformas\">Nota sobre plataformas</a></h2>\n<p>En Linux y Windows, la clave <code>Command</code> no tiene ningún efecto, así que se utilizar <code>CommandOrControl</code> que representa <code>Command</code> para macOS y <code>Control</code> para Linux y Windows para definir algunos Aceleradores.</p>\n<p>Usa <code>Alt</code> en lugar de <code>Opción</code>. La clave <code>Opción</code> sólo existe en macOS, mientras que la clave <code>Alt</code> está disponible en todas las plataformas.</p>\n<p>La clave <code>Super</code> (o <code>Meta</code>) esta asignada a la tecla <code>Windows</code> en Windows y linux, <code>Cmd</code> en macOS.</p>\n<h2 id=\"modificadores-disponibles\"><a href=\"#modificadores-disponibles\">Modificadores disponibles</a></h2>\n<ul>\n<li><code>Command</code> (o <code>Cmd</code> resumido)</li>\n<li><code>Control</code> (o <code>Ctrl</code> resumido)</li>\n<li><code>ComandoOControl</code> (o <code>CmdOrCtrl</code> resumido)</li>\n<li><code>Alt</code></li>\n<li><code>Opción</code></li>\n<li><code>Alt derecha</code></li>\n<li><code>Shift</code></li>\n<li><code>Super</code></li>\n<li><code>Meta</code></li>\n</ul>\n<h2 id=\"códigos-claves-disponibles\"><a href=\"#códigos-claves-disponibles\">Códigos claves disponibles</a></h2>\n<ul>\n<li><code>0</code> a <code>9</code></li>\n<li><code>A</code> a <code>Z</code></li>\n<li><code>F1</code> a <code>F24</code></li>\n<li>Puntuación como <code>~</code>, <code>!</code>, <code>@</code>, <code>#</code>, <code>$</code>, etc.</li>\n<li><code>Más</code></li>\n<li><code>Espacio</code></li>\n<li><code>Tab</code></li>\n<li><code>Bloq Mayús</code></li>\n<li><code>Numlock</code></li>\n<li><code>Bloqueo de desplazamiento</code></li>\n<li><code>Retroceso</code></li>\n<li><code>Suprimir</code></li>\n<li><code>Insertar</code></li>\n<li><code>Return</code> (o <code>Enter</code> como alias)</li>\n<li><code>Arriba</code>, <code>Abajo</code>, <code>Izquierda</code> y <code>Derecha</code></li>\n<li><code>Home</code> y <code>End</code></li>\n<li><code>PageUp</code> y <code>PageDown</code></li>\n<li><code>Escape</code> (o <code>Esc</code> resumido)</li>\n<li><code>VolumeUp</code>, <code>VolumeDown</code> y <code>VolumeMute</code></li>\n<li><code>MediaNextTrack</code>, <code>MediaPreviousTrack</code>, <code>MediaStop</code> y <code>MediaPlayPause</code></li>\n<li><code>PrintScreen</code></li>\n<li>Teclas del teclado numérico<ul>\n<li><code>num0</code> - <code>num9</code></li>\n<li><code>numdec</code> - clave decimal</li>\n<li><code>numadd</code> - teclado numérico tecla <code>+</code></li>\n<li><code>numsub</code> - teclado numérico tecla <code>-</code></li>\n<li><code>nummult</code> - teclado numérico tecla <code>*</code></li>\n<li><code>numdiv</code> - teclado numérico tecla <code>÷</code></li>\n</ul></li>\n</ul>",
      "title": "Combinaciones de teclas",
      "description": "Definir atajos del teclado."
    },
    "/docs/tutorial/accessibility": {
      "locale": "es-ES",
      "slug": "accessibility",
      "href": "/docs/tutorial/accessibility",
      "crowdinFileId": "256173",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/accessibility.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"accesibilidad\"><a href=\"#accesibilidad\">Accesibilidad</a></h1>\n<p>Hacer que las aplicaciones sean accesibless es importante y estemos encantados de proporcionar funcionalidad en <a href=\"https://electronjs.org/devtron\">Devtron</a> y <a href=\"https://electronjs.org/spectron\">Spectron</a> que le brinda a los programadores la oportunidad de hacer que sus aplicaciones sean mejoren para todos.</p>\n<hr>\n<p>Los problemas de accesibilidad en las aplicaciones Electron son similares a los de los sitios web debido a que ambos son básicamente HTML. Sin embargo, con las aplicaciones de Electron, no puedes usar los recursos online para las auditorías de accesibilidad, ya que la aplicación no posee una URL para apuntar al auditor.</p>\n<p>These features bring those auditing tools to your Electron app. You can choose to add audits to your tests with Spectron or use them within DevTools with Devtron. Sigue leyendo para un resumen de las herramientas.</p>\n<h2 id=\"spectron\"><a href=\"#spectron\">Spectron</a></h2>\n<p>In the testing framework Spectron, you can now audit each window and <code>&#x3C;webview></code> tag in your application. Por ejemplo:</p>\n<pre><code class=\"hljs language-javascript\">app.client.auditAccessibility().then(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\">audit</span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (audit.failed) {\n    <span class=\"hljs-built_in\">console</span>.error(audit.message)\n  }\n})\n</code></pre>\n<p>Puede leer más acerca de esta herramienta en la <a href=\"https://github.com/electron/spectron#accessibility-testing\">documentación de Spectron</a>.</p>\n<h2 id=\"devtron\"><a href=\"#devtron\">Devtron</a></h2>\n<p>In Devtron, there is an accessibility tab which will allow you to audit a page in your app, sort and filter the results.</p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/1305617/17156618/9f9bcd72-533f-11e6-880d-389115f40a2a.png\" alt=\"Capturas de devtron\"></p>\n<p>Ambas herramientas están utilizando la biblioteca <a href=\"https://github.com/GoogleChrome/accessibility-developer-tools\">Herramientas de desarrollo de accesibilidad</a> creada por Google para Chrome. Usted puede aprender más acerca de las reglas de auditoría de accesibilidad que esta biblioteca usa en la <a href=\"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules\">wiki del repositorio</a>.</p>\n<p>Si conoces de otras herramientas de gran accesibilidad para Electron, añádelas al documentado de accesibilidad con un pull request.</p>\n<h2 id=\"manually-enabling-accessibility-features\"><a href=\"#manually-enabling-accessibility-features\">Manually enabling accessibility features</a></h2>\n<p>Electron applications will automatically enable accessibility features in the presence of assistive technology (e.g. <a href=\"https://www.freedomscientific.com/products/software/jaws/\">JAWS</a> on Windows or <a href=\"https://help.apple.com/voiceover/mac/10.15/\">VoiceOver</a> on macOS). Consulte la <a href=\"https://www.chromium.org/developers/design-documents/accessibility#TOC-How-Chrome-detects-the-presence-of-Assistive-Technology\">documentación de accesibilidad de Chrome</a> para obtener más detalles.</p>\n<p>You can also manually toggle these features either within your Electron application or by setting flags in third-party native software.</p>\n<h3 id=\"using-electrons-api\"><a href=\"#using-electrons-api\">Using Electron's API</a></h3>\n<p>By using the <a href=\"/docs/api/app#appsetaccessibilitysupportenabledenabled-macos-windows\"><code>app.setAccessibilitySupportEnabled(enabled)</code></a> API, you can manually expose Chrome's accessibility tree to users in the application preferences. Note that the user's system assistive utilities have priority over this setting and will override it.</p>\n<h3 id=\"usando-software-de-terceros\"><a href=\"#usando-software-de-terceros\">Usando software de terceros</a></h3>\n<h4 id=\"macos\"><a href=\"#macos\">macOS</a></h4>\n<p>On macOS, third-party assistive technology can toggle accessibility features inside Electron applications by setting the <code>AXManualAccessibility</code> attribute programmatically:</p>\n<pre><code class=\"hljs language-objc\"><span class=\"hljs-built_in\">CFStringRef</span> kAXManualAccessibility = <span class=\"hljs-built_in\">CFSTR</span>(<span class=\"hljs-string\">\"AXManualAccessibility\"</span>);\n\n+ (<span class=\"hljs-keyword\">void</span>)enableAccessibility:(<span class=\"hljs-built_in\">BOOL</span>)enable inElectronApplication:(<span class=\"hljs-built_in\">NSRunningApplication</span> *)app\n{\n    AXUIElementRef appRef = AXUIElementCreateApplication(app.processIdentifier);\n    <span class=\"hljs-keyword\">if</span> (appRef == <span class=\"hljs-literal\">nil</span>)\n        <span class=\"hljs-keyword\">return</span>;\n\n    <span class=\"hljs-built_in\">CFBooleanRef</span> value = enable ? kCFBooleanTrue : kCFBooleanFalse;\n    AXUIElementSetAttributeValue(appRef, kAXManualAccessibility, value);\n    <span class=\"hljs-built_in\">CFRelease</span>(appRef);\n}\n</code></pre>",
      "title": "Accesibilidad",
      "description": ""
    },
    "/docs/api/app": {
      "locale": "es-ES",
      "slug": "app",
      "href": "/docs/api/app",
      "crowdinFileId": "256279",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/app.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"app\"><a href=\"#app\">app</a></h1>\n<blockquote>\n<p>Controla el ciclo de vida de los eventos de su aplicación.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p>Los siguientes ejemplos muestran como salir de la aplicación cuando la última ventana está cerrada:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  app.quit()\n})\n</code></pre>\n<h2 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h2>\n<p>El objeto <code>app</code> emite los siguientes eventos:</p>\n<h3 id=\"evento-will-finish-launching\"><a href=\"#evento-will-finish-launching\">Evento: 'will-finish-launching'</a></h3>\n<p>Emitido cuando la aplicación ha terminado su iniciación básica. En windows y Linux el evento <code>will-finish-launching</code> es el mismo que el evento <code>ready</code>; en macOS este evento representa la notificación <code>applicationWillFinishLaunching</code> de <code>NSApplication</code>. Normalmente configurará aquí los receptores para los eventos <code>open-file</code> y <code>open-url</code>, e iniciará el informador de errores y el actualizador automático.</p>\n<p>En la mayoría de los casos usted debe hacer todo desde el controlador del evento <code>ready</code>.</p>\n<h3 id=\"evento-ready\"><a href=\"#evento-ready\">Evento: 'ready'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>launchInfo</code> Record&#x3C;string, any> | <a href=\"/docs/api/structures/notification-response\">NotificationResponse</a> <em>macOS</em></li>\n</ul>\n<p>Se emite una vez, cuando Electron ha terminado de iniciarse. En macOS <code>launchInfo</code> almacena el <code>userInfo</code> de <code>NSUserNotification</code> o la información de <a href=\"/docs/api/structures/notification-response\"><code>UNNotificationResponse</code></a> que fue usado para abrir la aplicación, si este fue lanzado desde el Centro de Notificaciones. Además puede llamar a <code>app.isReady()</code> para comprobar si el evento ha sido lanzado y <code>app.whenReady()</code> para obtener una Promise que se cumple cuando Electron está inicializado.</p>\n<h3 id=\"evento-window-all-closed\"><a href=\"#evento-window-all-closed\">Evento: 'window-all-closed'</a></h3>\n<p>Emitido cuando todas las ventanas han sido cerradas.</p>\n<p>Si no se subscribe a este evento y todas las ventanas están cerradas, el comportamiento por defecto es salir de la aplicación; sin embargo, si se subscribe, usted controla si la aplicación se cierra o no. Si el usuario presionó <code>Cmd + Q</code>, o el desarrollador llamó a <code>app.quit()</code>, Electron primero tratará de cerrar todas las ventanas y entonces emitir el evento <code>will-quit</code>, y en este caso el evento <code>window-all-closed</code> no será emitido.</p>\n<h3 id=\"evento-before-quit\"><a href=\"#evento-before-quit\">Evento: 'before-quit'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n</ul>\n<p>Emitido antes de que la aplicación empiece a cerrar sus ventanas. Llamando a <code>event.preventDefault()</code> evitará el comportamiento por defecto, que es terminar la aplicación.</p>\n<p><strong>Note:</strong> Si el cierre de la aplicación fue iniciada por <code>autoUpdater.quitAndInstall()</code>, luego <code>before-quit</code> es emitido <em>after</em> emitiendo el evento <code>close</code> en todas las ventanas y cerrándolas.</p>\n<p><strong>Nota:</strong> En Windows, este evento no será emitido si la aplicación se cierra debido a un apagado/reinicio del sistema o el cierre de sesión de un usuario.</p>\n<h3 id=\"evento-will-quit\"><a href=\"#evento-will-quit\">Evento: 'will-quit'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n</ul>\n<p>Emitido cuando todas las ventanas han sido cerradas y la aplicación se cerrará. Llamando a <code>event.preventDefault()</code> evitará el comportamiento por defecto, que es terminar la aplicación.</p>\n<p>Consulte la descripción del evento <code>window-all-closed</code> por las diferencias con los eventos <code>will-quit</code> y <code>window-all-closed</code>.</p>\n<p><strong>Nota:</strong> En Windows, este evento no será emitido si la aplicación se cierra debido a un apagado/reinicio del sistema o el cierre de sesión de un usuario.</p>\n<h3 id=\"evento-quit\"><a href=\"#evento-quit\">Evento: 'quit'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>exitCode</code> Integer</li>\n</ul>\n<p>Emitido cuando la aplicación se está cerrando.</p>\n<p><strong>Nota:</strong> En Windows, este evento no será emitido si la aplicación se cierra debido a un apagado/reinicio del sistema o el cierre de sesión de un usuario.</p>\n<h3 id=\"evento-open-file-macos\"><a href=\"#evento-open-file-macos\">Evento: 'open-file' <em>macOS</em></a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>path</code> String</li>\n</ul>\n<p>Emitido cuando el usuario quiere abrir un archivo con la aplicación. El evento <code>open-file</code> es emitido usualmente cuando la aplicación está ya abierta y el sistema operativo quiere reusar la aplicación para abrir el archivo. <code>open-file</code> también es emitido cuando el archivo es soltado dentro del dock y la aplicación todavía no se está ejecutando. Asegúrese de escuchar sobre el evento <code>open-file</code> muy temprano en el el inicio de su aplicación para manejar este caso (incluso antes de que el evento <code>ready</code> sea emitido).</p>\n<p>Usted debe llamar a <code>event.preventDefault()</code> si quiere manejar este evento.</p>\n<p>En Windows, tiene que analizar <code>process.argv</code> (en el proceso principal) para encontrar la ruta del archivo.</p>\n<h3 id=\"evento-open-url-macos\"><a href=\"#evento-open-url-macos\">Evento: 'open-url' <em>macOS</em></a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitido cuando el usuario quiere abrir una URL con la aplicación. El archivo <code>Info.plist</code> de tu aplicación debe definir el esquema URL dentro de la llave <code>CFBundleURLTypes</code> y configurar <code>NSPrincipalClass</code> a <code>AtomApplication</code>.</p>\n<p>Usted debe llamar a <code>event.preventDefault()</code> si quiere manejar este evento.</p>\n<h3 id=\"evento-activate-macos\"><a href=\"#evento-activate-macos\">Evento: 'activate' <em>macOS</em></a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>hasVisibleWindows</code> Boolean</li>\n</ul>\n<p>Emitido cuando la aplicación está activada. Varias acciones puede activar este evento, como iniciar la aplicación por primera vez, intentar relanzar la aplicación cuando ya está corriendo, o hacer click en el dock de la aplicación o en el ícono de la barra de tareas.</p>\n<h3 id=\"evento-did-become-active-macos\"><a href=\"#evento-did-become-active-macos\">Evento: 'did-become-active' <em>macOS</em></a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n</ul>\n<p>Emitido cuando la aplicación mac se activa. La diferencia del evento <code>activate</code> es que <code>did-become-active</code> es emitido cada vez que la aplicación se activa, no solo cuando el icono en el Dock es pulsado o la aplicación es re-lanzada.</p>\n<h3 id=\"evento-continue-activity-macos\"><a href=\"#evento-continue-activity-macos\">Evento: 'continue-activity' <em>macOS</em></a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>type</code> String - Una cadena identificando la actividad. Se asigna a <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> unknown - Contiene el estado especifico de la aplicación guardado por la actividad en otro dispositivo.</li>\n<li><code>details</code> Object<ul>\n<li><code>webpageURL</code> String (opcional) - Una cadena que identifica la URL de la página web accedida por la actividad en otro dispositivo, si está disponible.</li>\n</ul></li>\n</ul>\n<p>Emitido durante <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> cuando una actividad de un artefacto diferente quiere ser reanudado. Usted debe llamar <code>event.preventDefault()</code> si quiere manejar este evento.</p>\n<p>La actividad de un usuario puede ser continuada solo en una aplicación que tenga la misma identificación de equipo de desarrolladores como la la aplicación fuente de las actividades y que soporte los tipos de actividad. Los tipos de actividades soportadas están en el <code>Info.plist</code> de la aplicación bajo la llave <code>NSUserActivityTypes</code>.</p>\n<h3 id=\"evento-will-continue-activity-macos\"><a href=\"#evento-will-continue-activity-macos\">Evento: 'will-continue-activity' <em>macOS</em></a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>type</code> String - Una cadena identificando la actividad. Se asigna a <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n</ul>\n<p>Emitido durante <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> cuando una actividad de un artefacto diferente quiere ser reanudado. Usted debe llamar <code>event.preventDefault()</code> si quiere manejar este evento.</p>\n<h3 id=\"evento-continue-activity-error-macos\"><a href=\"#evento-continue-activity-error-macos\">Evento: 'continue-activity-error' <em>macOS</em></a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>type</code> String - Una cadena identificando la actividad. Se asigna a <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>error</code> String - Una cadena en el idioma local con la descripción del error.</li>\n</ul>\n<p>Emitido durante <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> cuando una actividad desde un artefacto diferente falla al ser reanudada.</p>\n<h3 id=\"evento-activity-was-continued-macos\"><a href=\"#evento-activity-was-continued-macos\">Evento: 'activity-was-continued' <em>macOS</em></a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>type</code> String - Una cadena identificando la actividad. Se asigna a <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> unknown - Contiene el estado especifico de la aplicación guardado por la actividad.</li>\n</ul>\n<p>Emitido durante <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> después de que una actividad de este artefacto haya sido reanudado con éxito en otro.</p>\n<h3 id=\"evento-update-activity-state-macos\"><a href=\"#evento-update-activity-state-macos\">Evento: 'update-activity-state' <em>macOS</em></a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>type</code> String - Una cadena identificando la actividad. Se asigna a <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> unknown - Contiene el estado especifico de la aplicación guardado por la actividad.</li>\n</ul>\n<p>Emitido cuando <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> va a ser reanudado en otro artefacto. Si necesita actualizar el estado que se transferirá, debe llamar a <code>event.preventDefault ()</code> inmediatamente, crear un nuevo diccionario <code>userInfo</code> y llamar a <code>app.updateCurrentActivity()</code> de manera oportuna. De otra manera, la operación fallará en <code>continue-activity-error</code> será llamada.</p>\n<h3 id=\"evento-new-window-for-tab-macos\"><a href=\"#evento-new-window-for-tab-macos\">Evento: \"new-window-for-tab\" <em>macOS</em></a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n</ul>\n<p>Emitido cuando el usuario hace clic en el botón de nueva pestaña nativa de macOS. El botón de nueva pestaña solo es visible si el <code>BrowserWindow</code> actual tiene un <code>tabbingIdentifier</code></p>\n<h3 id=\"evento-browser-window-blur\"><a href=\"#evento-browser-window-blur\">Evento: 'browser-window-blur'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Emitido cuando el <a href=\"/docs/api/browser-window\">browserWindow</a> está borroso.</p>\n<h3 id=\"evento-browser-window-focus\"><a href=\"#evento-browser-window-focus\">Evento: 'browser-window-focus'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Emitido cuando se enfoca un <a href=\"/docs/api/browser-window\">browserWindow</a>.</p>\n<h3 id=\"evento-browser-window-created\"><a href=\"#evento-browser-window-created\">Evento: 'browser-window-created'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Emitido cuando se crea un <a href=\"/docs/api/browser-window\">browserWindow</a>.</p>\n<h3 id=\"evento-web-contenido-creado\"><a href=\"#evento-web-contenido-creado\">Evento: 'web-contenido-creado'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitido cuando un nuevo <a href=\"/docs/api/web-contents\">contenidoweb</a> es creado.</p>\n<h3 id=\"evento-certificate-error\"><a href=\"#evento-certificate-error\">Evento: 'certificate-error'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>url</code> String</li>\n<li><code>error</code> cadena - el error del código</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">certificate</a></li>\n<li><code>callback</code> Función<ul>\n<li><code>isTrusted</code> Boleano - Si considera que el certificado como de confianza</li>\n</ul></li>\n<li><code>EsElFramePrincipal</code> Boolean</li>\n</ul>\n<p>Emitido cuando falla la verificación de <code>certificate</code> por <code>url</code>, al confiar en el certificado usted debe prevenir el comportamiento con <code>event.preventDefault()</code> y llamar <code>callback(true)</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'certificate-error'</span>, (event, webContents, url, error, certificate, callback) => {\n  <span class=\"hljs-keyword\">if</span> (url === <span class=\"hljs-string\">'https://github.com'</span>) {\n    <span class=\"hljs-comment\">// Verification logic.</span>\n    event.preventDefault()\n    callback(<span class=\"hljs-literal\">true</span>)\n  } <span class=\"hljs-keyword\">else</span> {\n    callback(<span class=\"hljs-literal\">false</span>)\n  }\n})\n</code></pre>\n<h3 id=\"evento-select-client-certificate\"><a href=\"#evento-select-client-certificate\">Evento: 'select-client-certificate'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>url</code> URL</li>\n<li><code>certificateList</code><a href=\"/docs/api/structures/certificate\">Certificate[]</a></li>\n<li><code>callback</code> Función<ul>\n<li><code>certificate</code><a href=\"/docs/api/structures/certificate\">Certificate</a>(opcional)</li>\n</ul></li>\n</ul>\n<p>Emitido cuando el certificado de un cliente es requerido.</p>\n<p>La <code>url</code> corresponde a la entrada de navegación requerida al certificado del cliente y <code>callback</code> puede ser llamado con una entrada filtrada de la lista. Usando <code>event.preventDefault()</code> previene que la aplicación use el primer certificado almacenado.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'select-client-certificate'</span>, (event, webContents, url, list, callback) => {\n  event.preventDefault()\n  callback(list[<span class=\"hljs-number\">0</span>])\n})\n</code></pre>\n<h3 id=\"eventologin\"><a href=\"#eventologin\">Evento:'login'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>authenticationResponseDetails</code> Object<ul>\n<li><code>url</code> URL</li>\n</ul></li>\n<li><code>authInfo</code> Object<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>anfitrión</code> Cadena</li>\n<li><code>puerto</code> Íntegro</li>\n<li><code>realm</code> Cadena</li>\n</ul></li>\n<li><code>callback</code> Función<ul>\n<li><code>username</code> String (opcional)</li>\n<li><code>password</code> String (opcional)</li>\n</ul></li>\n</ul>\n<p>Emitido cuando <code>webContents</code> quiere hacer una autenticación básica.</p>\n<p>El comportamiento por defecto es cancelar todas las autenticaciones. Para sobrescribir esto de debe evitar el comportamiento por defecto con <code>event.preventDefault()</code> y llamar a <code>callback(username, password)</code> con las credenciales.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'login'</span>, (event, webContents, details, authInfo, callback) => {\n  event.preventDefault()\n  callback(<span class=\"hljs-string\">'username'</span>, <span class=\"hljs-string\">'secret'</span>)\n})\n</code></pre>\n<p>Si <code>callback</code> es llamado sin un nombre de usuario o contraseña, la solicitud de autenticación sera cancelada y el error de autenticación será retornado a la página.</p>\n<h3 id=\"evento-gpu-info-update\"><a href=\"#evento-gpu-info-update\">Evento: 'gpu-info-update'</a></h3>\n<p>Emitido cada vez que hay una actualización de información de la GPU.</p>\n<h3 id=\"evento-gpu-process-crashed-obsoleto\"><a href=\"#evento-gpu-process-crashed-obsoleto\">Evento: 'gpu-process-crashed' <em>Obsoleto</em></a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>killed</code> Booleano</li>\n</ul>\n<p>Emitido cuando el proceso de la GPU se crashea o es terminado.</p>\n<p><strong>Obsoleto:</strong> Este evento es reemplazado por el evento <code>child-process-gone</code> el cual contiene más información acerca de porque desapareció el proceso secundario. No siempre se debe a que haya dejado de funcionar. El booleano <code>killed</code> puede ser reemplazado al comprobar que <code>reason === 'killed'</code> cuando se cambie a ese evento.</p>\n<h3 id=\"evento-renderer-process-crashed-obsoleto\"><a href=\"#evento-renderer-process-crashed-obsoleto\">Evento: 'renderer-process-crashed' <em>Obsoleto</em></a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>killed</code> Booleano</li>\n</ul>\n<p>Emitido cuando el proceso render de <code>webContents</code> se bloquea o es matado.</p>\n<p><strong>Obsoleto:</strong> Este evento es reemplazado por el evento <code>render-process-gone</code> el cual contiene más información acerca de porque desapareció el renderer process. No siempre se debe a que haya dejado de funcionar.  El booleano <code>killed</code> puede ser reemplazado al comprobar que <code>reason === 'killed'</code> cuando se cambie a ese evento.</p>\n<h3 id=\"evento-render-process-gone\"><a href=\"#evento-render-process-gone\">Evento: 'render-process-gone'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>details</code> Object<ul>\n<li><code>reason</code> String - La razón por la que finalizo el proceso.  Posibles valores:<ul>\n<li><code>clean-exit</code> -El proceso ha finalizado con un exit code de cero</li>\n<li><code>abnormal-exit</code> - El proceso a finalizado con un exit code distinto de cero</li>\n<li><code>killed</code> - El proceso a enviado un SIGTERM o se a finalizado externamente</li>\n<li><code>crashed</code> - El proceso crasheo</li>\n<li><code>oom</code> - El proceso se quedo sin memoria</li>\n<li><code>launch-failed</code> - El proceso nunca se ha ejecutado correctamente</li>\n<li><code>integrity-failure</code> - las verificaciones de integridad de código de Windows fallaron</li>\n</ul></li>\n<li><code>exitCode</code> Integer - El código de salida del proceso, a menos que <code>reason</code> sea <code>launch-failed</code>, en cuyo caso <code>exitCode</code> será un código de error de ejecución especifico de la plataforma.</li>\n</ul></li>\n</ul>\n<p>Emitido cuando el renderer process desaparece inesperadamente.  Esto se debe comúnmente porque se crasheo o cerro.</p>\n<h3 id=\"evento-child-process-gone\"><a href=\"#evento-child-process-gone\">Evento: 'child-process-gone'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>details</code> Object<ul>\n<li><code>type</code> String - Tipo de proceso. Uno de los siguiente valores:<ul>\n<li><code>Utility</code></li>\n<li><code>Zygote</code></li>\n<li><code>Sandbox helper</code></li>\n<li><code>GPU</code></li>\n<li><code>Pepper Plugin</code></li>\n<li><code>Pepper Plugin Broker</code></li>\n<li><code>Unknown</code></li>\n</ul></li>\n<li><code>reason</code> String - La razón por la que se cerro el proceso hijo. Posibles valores:<ul>\n<li><code>clean-exit</code> -El proceso ha finalizado con un exit code de cero</li>\n<li><code>abnormal-exit</code> - El proceso a finalizado con un exit code distinto de cero</li>\n<li><code>killed</code> - El proceso a enviado un SIGTERM o se a finalizado externamente</li>\n<li><code>crashed</code> - El proceso crasheo</li>\n<li><code>oom</code> - El proceso se quedo sin memoria</li>\n<li><code>launch-failed</code> - El proceso nunca se ha ejecutado correctamente</li>\n<li><code>integrity-failure</code> - las verificaciones de integridad de código de Windows fallaron</li>\n</ul></li>\n<li><code>exitCode</code> Number - El exit code del proceso (por ejemplo, estado de waitpid si esta en posix, de GetExitCodeProcess en Windows).</li>\n<li><code>serviceName</code> String (opcional) - El nombre no localizado del proceso.</li>\n<li><code>name</code> String (opcional) - El nombre del proceso. Examples for utility: <code>Audio Service</code>, <code>Content Decryption Module Service</code>, <code>Network Service</code>, <code>Video Capture</code>, etc.</li>\n</ul></li>\n</ul>\n<p>Emitted when the child process unexpectedly disappears. Esto se debe comúnmente porque se crasheo o cerro. It does not include renderer processes.</p>\n<h3 id=\"evento-accessibility-support-changed-macos-windows\"><a href=\"#evento-accessibility-support-changed-macos-windows\">Evento: 'accessibility-support-changed' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>accessibilitySupportEnabled</code> Booleano - <code>true</code> cuando el soporte de accesibilidad de Chrome está activado, de lo contrario <code>false</code>.</li>\n</ul>\n<p>Es emitido cuando el soporte de accesibilidad de Chrome es modificado. Este evento se dispara cuando las tecnologías de asistencia, como un lector de pantalla, sin activados o desactivados. Vea <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">https://www.chromium.org/developers/design-documents/accessibility</a> para mas información.</p>\n<h3 id=\"evento-session-created\"><a href=\"#evento-session-created\">Evento: 'session-created'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>session</code> <a href=\"/docs/api/session\">Session</a></li>\n</ul>\n<p>Emitido cuando Electron ha creado una nueva <code>session</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'session-created'</span>, (session) => {\n  <span class=\"hljs-built_in\">console</span>.log(session)\n})\n</code></pre>\n<h3 id=\"evento-second-instance\"><a href=\"#evento-second-instance\">Evento: 'second-instance'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>argv</code> Cadena[] - Un arreglo de las líneas de argumentos de comandos de segunda instancia</li>\n<li><code>workingDirectory</code> Cadena - El directorio de trabajo de segunda instancia</li>\n</ul>\n<p>Este evento será emitido dentro de la primera instancia de tu aplicación cuando una segunda instancia ha sido ejecutada y llama <code>app.requestSingleInstanceLock()</code>.</p>\n<p><code>argv</code> Es un Array los argumentos de la línea de comando de la segunda instancia y <code>workingDirectory</code> es su actual directorio de trabajo. Usualmente las aplicaciones responden a esto haciendo su ventana principal concentrada y no minimizada.</p>\n<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>\n<p>Este evento garantiza que se ejecute después del evento <code>ready</code> de <code>app</code> para ser emitido.</p>\n<p><strong>Note:</strong> Chromium podría agregar argumentos extras de línea de comando, por ejemplo <code>--original-process-start-time</code>.</p>\n<h3 id=\"event-desktop-capturer-get-sources\"><a href=\"#event-desktop-capturer-get-sources\">Event: 'desktop-capturer-get-sources'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitido cuando <code>desktopCapturer.getSources()</code> es llamado en el render process del <code>webContents</code>. Llamando a <code>event.preventDefault()</code> hará que devuelva fuentes vacías.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El objeto <code>app</code> tiene los siguientes métodos:</p>\n<p><strong>Note:</strong> Algunos métodos solo están disponibles en sistemas operativos específicos y son etiquetados como tal.</p>\n<h3 id=\"appquit\"><a href=\"#appquit\"><code>app.quit()</code></a></h3>\n<p>Intenta cerrar todas las ventanas. El evento <code>before-quit</code> se producirá primero. Si todas las ventas son cerradas exitosamente, el evento <code>will-quit</code> será emitido y por defecto la aplicación se cerrará.</p>\n<p>Este método asegura que todos los controladores para los eventos <code>beforeunload</code> y <code>unload</code> se ejecutan correctamente. Es posible que una ventana cancele la salida devolviendo <code>falso</code> en el controlador de eventos <code>beforeunload</code>.</p>\n<h3 id=\"appexitexitcode\"><a href=\"#appexitexitcode\"><code>app.exit([exitCode])</code></a></h3>\n<ul>\n<li><code>exitCode</code> Íntegro (opcional)</li>\n</ul>\n<p>Sale inmediatamente con <code>exitCode</code>. <code>exitCode</code> por defecto 0.</p>\n<p>Todas las ventanas serán cerradas de inmediato sin preguntarle al usuario, y los eventos <code>before-quit</code> y <code>will-quit</code> no serán emitidos.</p>\n<h3 id=\"apprelaunchoptions\"><a href=\"#apprelaunchoptions\"><code>app.relaunch([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>args</code> String[] - (opcional)</li>\n<li><code>execPath</code> String (opcional)</li>\n</ul></li>\n</ul>\n<p>Reinicia la aplicación cuando la instancia actual se cierra.</p>\n<p>Por defecto, la nueva instancia va a usar el mismo directorio de trabajo y los argumentos de la linea de comando con la instancia actual. Cuando se especifican <code>args</code>, entonces <code>args</code> se pasarán como argumentos de línea de comandos. Si se especifica <code>execPath</code>, entonces <code>execPath</code> se ejecutará como reinicio de la aplicación en vez de la aplicación actual.</p>\n<p>Note que este método no finaliza la aplicación cuando se ejecuta, debe llamar a <code>app.quit</code> o <code>app.exit</code> después de llamar <code>app.relaunch</code> para hacer que la aplicación se reinicie.</p>\n<p>Cuando <code>app.relaunch</code> se llama múltiples veces, se iniciarán múltiples instancias después de que la instancia actual finalice.</p>\n<p>Un ejemplo de reiniciar la instancia actual de forma inmediata y agregar un nuevo argumento a la línea de comandos de la nueva instancia:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.relaunch({ <span class=\"hljs-attr\">args</span>: process.argv.slice(<span class=\"hljs-number\">1</span>).concat([<span class=\"hljs-string\">'--relaunch'</span>]) })\napp.exit(<span class=\"hljs-number\">0</span>)\n</code></pre>\n<h3 id=\"appisready\"><a href=\"#appisready\"><code>app.isReady()</code></a></h3>\n<p>Devuelve <code>Boolean</code> - <code>true</code> Si Electron ha terminado de inicializarse, de lo contrario <code>false</code>. See also <code>app.whenReady()</code>.</p>\n<h3 id=\"appwhenready\"><a href=\"#appwhenready\"><code>app.whenReady()</code></a></h3>\n<p>Retorna <code>Promise&#x3C;void></code> - cumplido cuando Electron esta inicializado. También puede ser utilizado para comprobar el estado de: <code>app.isReady()</code> y registrar al evento <code>ready</code> si la aplicación aun no esta lista.</p>\n<h3 id=\"appfocusoptions\"><a href=\"#appfocusoptions\"><code>app.focus([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>steal</code> Boolean <em>macOS</em> - Make the receiver the active app even if another app is currently active.</li>\n</ul></li>\n</ul>\n<p>En Linux, se centra en la primera ventana visible. On macOS, makes the application the active app. On Windows, focuses on the application's first window.</p>\n<p>You should seek to use the <code>steal</code> option as sparingly as possible.</p>\n<h3 id=\"apphide-macos\"><a href=\"#apphide-macos\"><code>app.hide()</code> <em>macOS</em></a></h3>\n<p>Oculta todas la ventanas de la aplicación sin minimizarlas.</p>\n<h3 id=\"appshow-macos\"><a href=\"#appshow-macos\"><code>app.show()</code> <em>macOS</em></a></h3>\n<p>Muestra las ventanas de la aplicación luego de que se ocultaron. No los enfoca automáticamente.</p>\n<h3 id=\"appsetapplogspathpath\"><a href=\"#appsetapplogspathpath\"><code>app.setAppLogsPath([path])</code></a></h3>\n<ul>\n<li><code>path</code> String (opcional) - Una ruta personalizada para tus registros. Debe ser absoluta.</li>\n</ul>\n<p>Establece o crea un directorio de registros de tu aplicación el cual puede ser manipulado con <code>app.getPath()</code> o <code>app.setPath(pathName, newPath)</code>.</p>\n<p>Llamando <code>app.setAppLogsPath()</code> sin un parámetro <code>path</code> resultará en que este directorio sea establecido a <code>~/Library/Logs/YourAppName</code> en <em>macOS</em>, y dentro del directorio <code>userData</code> en <em>Linux</em> y <em>Windows</em>.</p>\n<h3 id=\"appgetapppath\"><a href=\"#appgetapppath\"><code>app.getAppPath()</code></a></h3>\n<p>Devuelve <code>String</code> - El directorio actual de la aplicación.</p>\n<h3 id=\"appgetpathname\"><a href=\"#appgetpathname\"><code>app.getPath(name)</code></a></h3>\n<ul>\n<li><code>name</code> String - You can request the following paths by the name:<ul>\n<li><code>home</code> Directorio personal del usuario.</li>\n<li><code>appData</code> Directorio de datos de la aplicación por usuario, el cual por defecto apunta a:<ul>\n<li><code>%APPDATA%</code> en Windows</li>\n<li><code>$XDG_CONFIG_HOME</code> o <code>~/.config</code> en Linux</li>\n<li><code>~/Library/Application Support</code> en marcOS</li>\n</ul></li>\n<li><code>userData</code> El directorio para almacenar los archivos de configuración de su aplicación, que es por defecto, el directorio <code>appData</code> seguido del nombre de su aplicación.</li>\n<li><code>chaché</code></li>\n<li><code>temp</code> Directorio temporal.</li>\n<li><code>exe</code> El archivo ejecutable actual.</li>\n<li><code>module</code> La librería <code>libchromiumcontent</code>.</li>\n<li><code>desktop</code> El escritorio actual del usuario.</li>\n<li><code>documents</code> Directorio \"Mis documentos\" del usuario.</li>\n<li><code>downloads</code> Directorio para las descargas del usuario.</li>\n<li><code>music</code> Directorio para la música del usuario.</li>\n<li><code>pictures</code> Directorio para las imágenes del usuario.</li>\n<li><code>videos</code> Directorio para los vídeos del usuario.</li>\n<li><code>recent</code> Directory for the user's recent files (Windows only).</li>\n<li><code>logs</code> Directorio para los archivos de registro de la aplicación.</li>\n<li><code>crashDumps</code> Directory where crash dumps are stored.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>String</code> - Una ruta a un directorio especial o un archivo asociado con <code>name</code>. En caso de falla, un <code>Error</code> es lanzado.</p>\n<p>Si se llama a <code>app.getPath('logs')</code> sin que se llame primero a <code>app.setAppLogsPath()</code>, se creará un directorio de registro por defecto equivalente a llamar a <code>app.setAppLogsPath()</code> sin un parámetro <code>path</code>.</p>\n<h3 id=\"appgetfileiconpath-options\"><a href=\"#appgetfileiconpath-options\"><code>app.getFileIcon(path[, options])</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>size</code> String<ul>\n<li><code>pequeño</code> - 16x16</li>\n<li><code>normal</code> - 32x32</li>\n<li><code>large</code> - 48x48 en <em>Linux</em>, 32x32 en <em>Windows</em>, no soportado en <em>macOS</em>.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;NativeImage></code> - cumplido con el icono de la aplicación, el cual es un <a href=\"/docs/api/native-image\">NativeImage</a>.</p>\n<p>Obtiene el icono asociado a la ruta.</p>\n<p>En <em>Windows</em>, Hay dos tipos de iconos:</p>\n<ul>\n<li>Iconos asociados con cierta extensión de un archivo, como <code>.mp3</code>, <code>.png</code>, etc.</li>\n<li>Iconos dentro del propio archivo, como <code>.exe</code>, <code>.dll</code>, <code>.ico</code>.</li>\n</ul>\n<p>En <em>Linux</em> y <em>macOS</em>, los iconos dependen de la aplicación asociada al tipo de archivo.</p>\n<h3 id=\"appsetpathname-path\"><a href=\"#appsetpathname-path\"><code>app.setPath(name, path)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n<li><code>path</code> String</li>\n</ul>\n<p>Reemplaza el <code>path</code> a un directorio especial o un archivo asociado con <code>name</code>. Si la ruta especifica un directorio que no existe, un <code>Error</code> es lanzado. En ese caso, el directorio devería ser creado con <code>fs.mkdirSync</code> o similar.</p>\n<p>Solo puede sobrescribir rutas de un <code>name</code> definido en <code>app.getPath</code>.</p>\n<p>Por defecto, las cookies y el caché de una página web serán almacenados en el directorio <code>userData</code>. Si quiere cambiar su localización, tiene que sobrescribir la ruta de <code>userData</code> ante de que el evento <code>ready</code> del módulo <code>app</code> se emita.</p>\n<h3 id=\"appgetversion\"><a href=\"#appgetversion\"><code>app.getVersion()</code></a></h3>\n<p>Devuelve <code>String</code> - La versión de la aplicación cargada. Si no se encuentra la versión en el fichero <code>package.json</code> de la aplicación, se devuelve la versión del paquete o ejecutable.</p>\n<h3 id=\"appgetname\"><a href=\"#appgetname\"><code>app.getName()</code></a></h3>\n<p>Devuelve <code>String</code> - El nombre actual de la aplicación, que se corresponde con el nombre especificado en el fichero <code>package.json</code> de la aplicación.</p>\n<p>Usualmente el campo <code>name</code> de <code>package.json</code> es un nombre corto en minúscula, de acuerdo con las especificaciones de los módulos npm. Normalmente debe especificar un <code>productName</code> también, el cual es el nombre de su aplicación en mayúsculas, y que será preferido por Electron sobre <code>name</code>.</p>\n<h3 id=\"appsetnamename\"><a href=\"#appsetnamename\"><code>app.setName(name)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n</ul>\n<p>Reescribe el nombre de la aplicación actual.</p>\n<p><strong>Nota:</strong> Esta función anula el nombre usado internamente por Electron; no afecta el nombre que el usa el sistema operativo.</p>\n<h3 id=\"appgetlocale\"><a href=\"#appgetlocale\"><code>app.getLocale()</code></a></h3>\n<p>Devuelve <code>String</code> - Los parámetros regionales actuales de la aplicación, recopilados usando la biblioteca <code>l10n_util</code> de Chromium. Los posibles valores de retorno son documentados <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:ui/base/l10n/l10n_util.cc\">aquí</a>.</p>\n<p>Para establecer el locale, querrás usar un interruptor de línea de comandos al inicio de la aplicación, que puede encontrarse <a href=\"/docs/api/command-line-switches\">aquí</a>.</p>\n<p><strong>Nota:</strong> Al distribuir su aplicación empaquetada, también tiene que enviar las carpetas <code>locales</code>.</p>\n<p><strong>Note:</strong> En windows, tienes que llamarlo después del los eventos <code>ready</code> sean emitidos.</p>\n<h3 id=\"appgetlocalecountrycode\"><a href=\"#appgetlocalecountrycode\"><code>app.getLocaleCountryCode()</code></a></h3>\n<p>Devuelve <code>String</code> - El código de país <a href=\"https://www.iso.org/iso-3166-country-codes.html\">ISO 3166</a> de dos letras del sistema operativo del usuario. El valor es tomado desde APIs nativas del sistema operativo.</p>\n<p><strong>Note:</strong> Cuando no se puede detectar el código de país local, devuelve una cadena vacía.</p>\n<h3 id=\"appaddrecentdocumentpath-macos-windows\"><a href=\"#appaddrecentdocumentpath-macos-windows\"><code>app.addRecentDocument(path)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Añade la <code>ruta</code> a la lista de documentos recientes.</p>\n<p>Esta lista es administrada por el sistema operativo. En Windows, puede visitar la lista desde la barra de tarea y en macOS, puede visitar la desde el menu dock.</p>\n<h3 id=\"appclearrecentdocuments-macos-windows\"><a href=\"#appclearrecentdocuments-macos-windows\"><code>app.clearRecentDocuments()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Borra la lista de documentos recientes.</p>\n<h3 id=\"appsetasdefaultprotocolclientprotocol-path-args\"><a href=\"#appsetasdefaultprotocolclientprotocol-path-args\"><code>app.setAsDefaultProtocolClient(protocol[, path, args])</code></a></h3>\n<ul>\n<li><code>protocolo</code> String - El nombre de su protocolo, sin el <code>://</code>. Por ejemplo si quiere que su aplicación maneje enlaces <code>electron://</code>, llame este método con <code>electron</code> como el parámetro.</li>\n<li><code>path</code> String (optional) <em>Windows</em> - The path to the Electron executable. Por defecto a <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - Arguments passed to the executable. Por defecto a un array vacío</li>\n</ul>\n<p>Regresa <code>Boolean</code> - Siempre que el llamado fue exitoso.</p>\n<p>Establece el ejecutable actual as el manejador por defecto para un protocolo (alias esquema URI). Te permite integrar tu app aún más en el sistema operativo. Una vez registrado. todos los enlaces con <code>tu-protocolo://</code> serán abiertos con el ejecutable actual. Todo el enlace, incluyendo el protocolo, sera pasado a tu aplicación como un parámetro.</p>\n<p><strong>Nota:</strong> En macOS, solo puede registrar protocolos que han sido agregados al <code>info.plist</code> de tu aplicación, el cual no puede ser modificado en tiempo de ejecución. Sin embargo, puede cambiar el archivo durante el tiempo de construcción a través de <a href=\"https://www.electronforge.io/\">Electron Forge</a>, <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a>, o editando <code>información. listar</code> con un editor de texto. Vea la <a href=\"https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102207-TPXREF115\">Apple's documentation</a> para mas información.</p>\n<p><strong>Note:</strong> En un entorno de Windows Store (cuando se empaqueta como <code>appx</code>) esta API devolverá <code>true</code> para todas las llamadas pero la clave de registro que establece no será accesible por otras aplicaciones.  Para registrar tu aplicación de Windows Store como gestor de protocolo determinado debe <a href=\"https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol\">declare the protocol in your manifest</a>.</p>\n<p>La API usa el Registro de Windows y <code>LSSetDefaultHandlerForURLScheme</code> internamente.</p>\n<h3 id=\"appremoveasdefaultprotocolclientprotocol-path-args-macos-windows\"><a href=\"#appremoveasdefaultprotocolclientprotocol-path-args-macos-windows\"><code>app.removeAsDefaultProtocolClient(protocol[, path, args])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>protocolo</code> String - El nombre de su protocolo, sin el <code>://</code>.</li>\n<li><code>ruta</code> String (opcional) <em>Windows</em> - por defecto a <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/opcional\"></a> <em>Windows</em> - por defecto a un arreglo vacío</li>\n</ul>\n<p>Regresa <code>Boolean</code> - Siempre que el llamado fue exitoso.</p>\n<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>\n<h3 id=\"appisdefaultprotocolclientprotocol-path-args\"><a href=\"#appisdefaultprotocolclientprotocol-path-args\"><code>app.isDefaultProtocolClient(protocol[, path, args])</code></a></h3>\n<ul>\n<li><code>protocolo</code> String - El nombre de su protocolo, sin el <code>://</code>.</li>\n<li><code>ruta</code> String (opcional) <em>Windows</em> - por defecto a <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/opcional\"></a> <em>Windows</em> - por defecto a un arreglo vacío</li>\n</ul>\n<p>Deveulve <code>Boolean</code> -Si el ejecutable actual es el manejador por defecto para un protocolo (alias esquema URI).</p>\n<p><strong>Nota:</strong> En macOS puede usar este método para verificar si la aplicación ha sido registrada como controladora por defecto para un protocolo. También puedes verificar esto al marcar <code>~/Library/Preferences/com.apple.LaunchServices.plist</code> en el dispositivo macOS. Por favor vea la <a href=\"https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme\">documentación de Apple</a> para detalles.</p>\n<p>La API usa el Registro de Windows y <code>LSCopyDefaultHandlerForURLScheme</code> internamente.</p>\n<h3 id=\"appgetapplicationnameforprotocolurl\"><a href=\"#appgetapplicationnameforprotocolurl\"><code>app.getApplicationNameForProtocol(url)</code></a></h3>\n<ul>\n<li><code>url</code> String - un URL con el nombre del protocolo para verificar. A diferencia de otros métodos de esta familia, este acepta una URL entera, incluyendo <code>://</code> a un mínimo de (por ejemplo <code>https://</code>).</li>\n</ul>\n<p>Devuelve <code>String</code> - Nombre de la aplicación que controla el protocolo o un string vacío si no hay controlador. Por ejemplo, si Electron es el controlador por defecto de la URL, este podría ser  <code>Electron</code> en Windows y Mac. Sin embargo, no confíe  en el formato preciso que no se garantiza que no cambie. Espere un formato diferente en Linux, posiblemente con un sufijo <code>.desktop</code>.</p>\n<p>Este método devuelve el nombre de la aplicación del controlador para el protocolo de la URL (alias schema URI).</p>\n<h3 id=\"appgetapplicationinfoforprotocolurl-macos-windows\"><a href=\"#appgetapplicationinfoforprotocolurl-macos-windows\"><code>app.getApplicationInfoForProtocol(url)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>url</code> String - un URL con el nombre del protocolo para verificar. A diferencia de otros métodos de esta familia, este acepta una URL entera, incluyendo <code>://</code> a un mínimo de (por ejemplo <code>https://</code>).</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;Object></code> - Resuelve con un objeto conteniendo lo siguiente:</p>\n<ul>\n<li><code>icon</code> NativeImage - the display icon of the app handling the protocol.</li>\n<li><code>path</code> String  - installation path of the app handling the protocol.</li>\n<li><code>name</code> String - display name of the app handling the protocol.</li>\n</ul>\n<p>Este método devuelve una promesa que contiene el nombre, ícono y ruta de la aplicación del manejador predeterminado para el protocolo (esquema URI) de una URL.</p>\n<h3 id=\"appsetusertaskstasks-windows\"><a href=\"#appsetusertaskstasks-windows\"><code>app.setUserTasks(tasks)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>tarea</code> <a href=\"/docs/api/structures/task\">Tarea[]</a> - Arreglo de objetos <code>Tarea</code></li>\n</ul>\n<p>Agrega <code>tasks</code> a la categoría <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks\">Tasks</a> de la Jump List en Windows.</p>\n<p><code>tareas</code> es un arreglo de objetos <a href=\"/docs/api/structures/task\"><code>Task</code></a>.</p>\n<p>Regresa <code>Boolean</code> - Siempre que el llamado fue exitoso.</p>\n<p><strong>Nota:</strong> Si quisiese personalizar la lista de saltos aún más use en su lugar <code>app.setJumpList(categories)</code>.</p>\n<h3 id=\"appgetjumplistsettings-windows\"><a href=\"#appgetjumplistsettings-windows\"><code>app.getJumpListSettings()</code> <em>Windows</em></a></h3>\n<p>Devuelve <code>Objeto</code>:</p>\n<ul>\n<li><code>minItems</code> Entero - El número mínimo de elementos que será mostrado en la lista (Para una descripción detallada de este valor vea el <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx\">documento MSDN</a>).</li>\n<li><code>removedItems</code> <a href=\"/docs/api/structures/jump-list-item\">JumpListItem[]</a> - Array <code>JumpListItem</code> de objetos que corresponden a elementos que el usuario explícitamente a eliminado de la categorías personalizadas en el Jump List. Estos elementos no deben ser añadidos nuevamente a la jump list en el <strong>próximo</strong> llamado a <code>app.setJumpList()</code>, Windows no mostrará ninguna categoría personalizada que contenga alguno de los elementos removidos.</li>\n</ul>\n<h3 id=\"appsetjumplistcategories-windows\"><a href=\"#appsetjumplistcategories-windows\"><code>app.setJumpList(categories)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>categories</code> <a href=\"/docs/api/structures/jump-list-category\">JumpListCategory[]</a> | <code>null</code> - Array de objetos <code>JumpListCategory</code>.</li>\n</ul>\n<p>Configura o remueve una Jump list personalizada para la aplicación, y devuelve una de las siguientes cadenas:</p>\n<ul>\n<li><code>ok</code> - Nada salió mal.</li>\n<li><code>error</code> - Uno o más errores ocurrieron, habilite el registro del tiempo de corrida para averiguar la causa probable.</li>\n<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>\n<li><code>fileTypeRegistrationError</code> - Fue realizado un intento de añadir el enlace del archivo a la Jump list para un tipo de archivo que la aplicación no está registrada para controlar.</li>\n<li><code>customCategoryAccessDeniedError</code> - Cateogrías personalizadas no pueden ser añadidas a la Jump List debido a la privacidad del usuario o a la política del grupo.</li>\n</ul>\n<p>Si <code>categories</code> es <code>null</code> la configuración personalizada previa de la Jump List (si hay alguna) será reemplazada por la Jump List estándar para la aplicación (manejada por Windows).</p>\n<p><strong>Nota:</strong> Si un objeto <code>JumpListCategory</code> no tiene la propiedad <code>type</code> o <code>name</code> establecidas, entones se asume que el <code>type</code> es <code>tasks</code>. Si la propiedad <code>name</code> está establecida pero la propiedad <code>type</code> esta omitida entonces se asume que el <code>type</code> es <code>custom</code>.</p>\n<p><strong>Nota:</strong> Usuarios pueden remover elementos de las categorías personalizadas y Windows no permitirá que un elemento removido sea añadido de nuevo a la categoría personalizada hasta <strong>después</strong> del siguiente llamado exitoso a <code>app.setJumpList(categories)</code>. Cualquier intento de añadir nuevamente el elemento a la categoría personalizada antes que eso resultará en que la categoría entera sea omitida de la Jump List. La lista de elemento removidos puede ser obtenida usando <code>app.getJumpListSettings()</code>.</p>\n<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>\n<p>Aquí hay un ejemplo sencillo de cómo crear una Jump List personalizada:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setJumpList([\n  {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'custom'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Recent Projects'</span>,\n    <span class=\"hljs-attr\">items</span>: [\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'file'</span>, <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'C:\\\\Projects\\\\project1.proj'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'file'</span>, <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'C:\\\\Projects\\\\project2.proj'</span> }\n    ]\n  },\n  { <span class=\"hljs-comment\">// has a name so `type` is assumed to be \"custom\"</span>\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Tools'</span>,\n    <span class=\"hljs-attr\">items</span>: [\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Tool A'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--run-tool-a'</span>,\n        <span class=\"hljs-attr\">icon</span>: process.execPath,\n        <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Runs Tool A'</span>\n      },\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Tool B'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--run-tool-b'</span>,\n        <span class=\"hljs-attr\">icon</span>: process.execPath,\n        <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Runs Tool B'</span>\n      }\n    ]\n  },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'frequent'</span> },\n  { <span class=\"hljs-comment\">// has no name and no type so `type` is assumed to be \"tasks\"</span>\n    <span class=\"hljs-attr\">items</span>: [\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'New Project'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--new-project'</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Create a new project.'</span>\n      },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Recover Project'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--recover-project'</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Recover Project'</span>\n      }\n    ]\n  }\n])\n</code></pre>\n<h3 id=\"apprequestsingleinstancelock\"><a href=\"#apprequestsingleinstancelock\"><code>app.requestSingleInstanceLock()</code></a></h3>\n<p>Devuelve <code>Boolean</code></p>\n<p>El valor devuelto de este método indica si esta instancia de su aplicación obtuvo con éxito el bloqueo.  Si no se puede obtener el bloqueo, puedes asumir que otra instancia de tu aplicación ya está corriendo con el bloqueo y salir inmediatamente.</p>\n<p>I.e. Este método devuelve <code>true</code> si el proceso es la instancia principal de tu aplicación y tu aplicación debe seguir cargando.  Retorna <code>false</code> si su proceso deja inmediatamente de enviar parámetros a otra instancia que ya haya adquirido el bloqueo con anterioridad.</p>\n<p>En macOS, el sistema fuerza instancias únicas automáticamente cuando los usuario intentan abrir una segunda instancia de tu aplicación en Finder, y los eventos <code>open-file</code> y <code>open-url</code> seran emitidos por eso. Como sea, cuando los usuarios inicien tu aplicación en la linea de comando, el mecanismo de instancias única del sistema del sistema serán puenteadas, y tendrás que usar este método para asegurar una única instancia.</p>\n<p>Un ejemplo de activar la ventana de la instancia primaria cuando una de segunda instancia se inicia:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> myWindow = <span class=\"hljs-literal\">null</span>\n\n<span class=\"hljs-keyword\">const</span> gotTheLock = app.requestSingleInstanceLock()\n\n<span class=\"hljs-keyword\">if</span> (!gotTheLock) {\n  app.quit()\n} <span class=\"hljs-keyword\">else</span> {\n  app.on(<span class=\"hljs-string\">'second-instance'</span>, (event, commandLine, workingDirectory) => {\n    <span class=\"hljs-comment\">// Someone tried to run a second instance, we should focus our window.</span>\n    <span class=\"hljs-keyword\">if</span> (myWindow) {\n      <span class=\"hljs-keyword\">if</span> (myWindow.isMinimized()) myWindow.restore()\n      myWindow.focus()\n    }\n  })\n\n  <span class=\"hljs-comment\">// Create myWindow, load the rest of the app, etc...</span>\n  app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    myWindow = createWindow()\n  })\n}\n</code></pre>\n<h3 id=\"apphassingleinstancelock\"><a href=\"#apphassingleinstancelock\"><code>app.hasSingleInstanceLock()</code></a></h3>\n<p>Devuelve <code>Boolean</code></p>\n<p>Este método devuelve si esta instancia de tu aplicación es actualmente manteniendo el bloqueo de una sola instancia.  Usted puede realiza un bloqueo con <code>app.requestSingleInstanceLock()</code> o liberarlo con <code>app.releaseSingleInstanceLock()</code></p>\n<h3 id=\"appreleasesingleinstancelock\"><a href=\"#appreleasesingleinstancelock\"><code>app.releaseSingleInstanceLock()</code></a></h3>\n<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>\n<h3 id=\"appsetuseractivitytype-userinfo-webpageurl-macos\"><a href=\"#appsetuseractivitytype-userinfo-webpageurl-macos\"><code>app.setUserActivity(type, userInfo[, webpageURL])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>type</code> Caden - Raramente identifica la actividad. Se asigna a <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> any - Estado especifico de la aplicación para almacenar para su uso por otro dispositivo.</li>\n<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>\n</ul>\n<p>Crea un <code>NSUserActivity</code> y se establece como la actividad actual. La actividad es elegible para <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> a otro dispositivo luego.</p>\n<h3 id=\"appgetcurrentactivitytype-macos\"><a href=\"#appgetcurrentactivitytype-macos\"><code>app.getCurrentActivityType()</code> <em>macOS</em></a></h3>\n<p>Devuelve <code>String</code> - El tipo de la actividad que se está ejecutando actualmente.</p>\n<h3 id=\"appinvalidatecurrentactivity-macos\"><a href=\"#appinvalidatecurrentactivity-macos\"><code>app.invalidateCurrentActivity()</code> <em>macOS</em></a></h3>\n<p>Invalida la actividad actual <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> del usuario.</p>\n<h3 id=\"appresigncurrentactivity-macos\"><a href=\"#appresigncurrentactivity-macos\"><code>app.resignCurrentActivity()</code> <em>macOS</em></a></h3>\n<p>Marca la actividad actual del usuario <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> como inactiva sin invalidarla.</p>\n<h3 id=\"appupdatecurrentactivitytype-userinfo-macos\"><a href=\"#appupdatecurrentactivitytype-userinfo-macos\"><code>app.updateCurrentActivity(type, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>type</code> Caden - Raramente identifica la actividad. Se asigna a <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> any - Estado especifico de la aplicación para almacenar para su uso por otro dispositivo.</li>\n</ul>\n<p>Actualiza la actividad actual si su tipo coincide <code>type</code>, fusionando las entradas de <code>userInfo</code> en su actual diccionario <code>userInfo</code>.</p>\n<h3 id=\"appsetappusermodelidid-windows\"><a href=\"#appsetappusermodelidid-windows\"><code>app.setAppUserModelId(id)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>id</code> Cadena</li>\n</ul>\n<p>Cambia el <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Id Modelo de Usuario de la Aplicación</a> a <code>id</code>.</p>\n<h3 id=\"appsetactivationpolicypolicy-macos\"><a href=\"#appsetactivationpolicypolicy-macos\"><code>app.setActivationPolicy(policy)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>policy</code> String - Can be 'regular', 'accessory', or 'prohibited'.</li>\n</ul>\n<p>Sets the activation policy for a given app.</p>\n<p>Activation policy types:</p>\n<ul>\n<li>'regular' - The application is an ordinary app that appears in the Dock and may have a user interface.</li>\n<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>\n<li>'prohibited' - The application doesn’t appear in the Dock and may not create windows or be activated.</li>\n</ul>\n<h3 id=\"appimportcertificateoptions-callback-linux\"><a href=\"#appimportcertificateoptions-callback-linux\"><code>app.importCertificate(options, callback)</code> <em>Linux</em></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>cetificado</code> Cadena - camino para el archivo pkcs12.</li>\n<li><code>contraseña</code> Cadena - Frase clave para el certificado.</li>\n</ul></li>\n<li><code>callback</code> Función<ul>\n<li><code>resultado</code> Entero - Resultado del importe.</li>\n</ul></li>\n</ul>\n<p>Importa el certificado en formato pkcs12 dentro del certificado de la plataforma. <code>callback</code> es llamado con el <code>result</code> de la operación de importación, un valor <code>0</code> indica que fue exitoso mientras que cualquier otro valor indica que fallo de acuerdo a Chromium <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">net_error_list</a>.</p>\n<h3 id=\"appconfigurehostresolveroptions\"><a href=\"#appconfigurehostresolveroptions\"><code>app.configureHostResolver(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>enableBuiltInResolver</code> Boolean (opcional) - Si el resolver de host integrado se utiliza en preferencia para getaddrinfo. Cuando está activado, el resolver integrado intentara usar las configuraciones DNS del sistema para hacer las consultas DNS por si mismo. Activado por defecto en macOS, desactivado por defecto en Windows y Linux.</li>\n<li><code>secureDnsMode</code> String (opcional) - Puede ser \"off\", \"automatic\" o \"secure\". Configura el modo DNS-over-HTTP. Cuando es \"off\", las búsquedas DoH no se realizarán. Cuando es \"automatic\", las búsquedas DoH se realizarán primero si DoH está disponible, y las búsquedas DNS se realizarán como una reserva. Cuando es \"secure\", sólo se realizarán búsquedas DoH. Por defecto es \"automatic\".</li>\n<li><code>secureDnsServers</code> String[] (opcional) - Una lista de plantillas de servidor DNS-over-HTTP. Vea <a href=\"https://datatracker.ietf.org/doc/html/rfc8484#section-3\">RFC8484 § 3</a> para más detalles sobre el formato de la plantilla. La mayoría de los servidores soportan el método POST; la plantilla para estos servidores es simplemente una URI. Tenga en cuenta que para <a href=\"https://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&#x26;ss=chromium%2Fchromium%2Fsrc\">algunos proveedores DNS </a>, el resolver actualizará automáticamente a DoH a menos que DoH este explícitamente desactivado, incluso si no hay servidores DoH proporcionados en esta lista.</li>\n<li><code>enableAdditionalDnsQueryTypes</code> Boolean (opcional) - Controla si consultas DNS de tipos adicionales, p.e. HTTPS(DNS type 65) serán permitidas ademas de las tradicionales consultas A y AAAA cuando una solicitud esta siendo hecha a través de DNS inseguro. No tiene efecto en DNS seguro que siempre permite tipos adicionales. Defaults to true.</li>\n</ul></li>\n</ul>\n<p>Configure la resolución de host (DNS y DNS-over-HTTPS). Por defecto, se utilizarán los siguientes resolutores en orden:</p>\n<ol>\n<li>DNS-over-HTTPS, si <a href=\"https://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&#x26;ss=chromium%2Fchromium%2Fsrc\">DNS provider supports it</a>, luego</li>\n<li>el resolutor integrado (activado sólo por defecto en macOS), luego</li>\n<li>el resolver del sistema (p.e. <code>getaddrinfo</code>).</li>\n</ol>\n<p>Esto puede ser configurado tanto para restringir el uso de DNS no-encriptado (<code>secureDnsMode: \"secure\"</code>), o desactivar DNS-over-HTTPS (<code>secureDnsMode:\"off\"</code>). También es posible activar o desactivar el resolver incorporado.</p>\n<p>Para desactivar DNS inseguro, puede especificar <code>secureDnsMode</code> de <code>\"secure\"</code>. Si usted hace eso, debería asegurarse de proveer una lista de servidores DNS-overHTTPS para usar, en caso de que la configuración DNS del usuario no incluya un proveedor que soporte DoH.</p>\n<pre><code class=\"hljs language-js\">app.configureHostResolver({\n  <span class=\"hljs-attr\">secureDnsMode</span>: <span class=\"hljs-string\">'secure'</span>,\n  <span class=\"hljs-attr\">secureDnsServers</span>: [\n    <span class=\"hljs-string\">'https://cloudflare-dns.com/dns-query'</span>\n  ]\n})\n</code></pre>\n<p>Esta API debe ser llamada antes que el evento <code>ready</code> sea emitido.</p>\n<h3 id=\"appdisablehardwareacceleration\"><a href=\"#appdisablehardwareacceleration\"><code>app.disableHardwareAcceleration()</code></a></h3>\n<p>Desactiva la aceleración por hardware para esta aplicación.</p>\n<p>Este método solo puede ser llamado despues de iniciada la aplicación.</p>\n<h3 id=\"appdisabledomainblockingfor3dapis\"><a href=\"#appdisabledomainblockingfor3dapis\"><code>app.disableDomainBlockingFor3DAPIs()</code></a></h3>\n<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>\n<p>Este método solo puede ser llamado despues de iniciada la aplicación.</p>\n<h3 id=\"appgetappmetrics\"><a href=\"#appgetappmetrics\"><code>app.getAppMetrics()</code></a></h3>\n<p>Devuelve <a href=\"/docs/api/structures/process-metric\"><code>ProcessMetric[]</code></a>: Array de <code>ProcessMetric</code> objetos que corresponden a la memoria y estadísticas de uso de la CPU de todos los procesos asociados con la aplicación.</p>\n<h3 id=\"appgetgpufeaturestatus\"><a href=\"#appgetgpufeaturestatus\"><code>app.getGPUFeatureStatus()</code></a></h3>\n<p>Devuelve <a href=\"/docs/api/structures/gpu-feature-status\"><code>GPUFeatureStatus</code></a> - el estado de la función de gráficos de <code>chrome://gpu/</code>.</p>\n<p><strong>Note:</strong> Esta información sólo es usable después de que le evento <code>gpu-info-update</code> es emitido.</p>\n<h3 id=\"appgetgpuinfoinfotype\"><a href=\"#appgetgpuinfoinfotype\"><code>app.getGPUInfo(infoType)</code></a></h3>\n<ul>\n<li><code>infoType</code> String - Puede ser <code>basic</code> o <code>complete</code>.</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;unknown></code></p>\n<p>Para <code>infoType</code> igual a <code>complete</code>: La promesa es completada con <code>Object</code> conteniendo toda la información de la GPU como <a href=\"https://chromium.googlesource.com/chromium/src/+/4178e190e9da409b055e5dff469911ec6f6b716f/gpu/config/gpu_info.cc\">chromium's GPUInfo object</a>. Esto incluye la versión y la información del controlador que es mostrada en la pagina <code>chrome://gpu</code>.</p>\n<p>Para <code>infoType</code> igual a <code>basic</code>: La promesa se cumple con  <code>Object</code> que contiene pocos atributos que son solicitados con <code>complete</code>. Aquí hay un ejemplo de respuesta básica:</p>\n<pre><code class=\"hljs language-js\">{\n  <span class=\"hljs-attr\">auxAttributes</span>:\n   {\n     <span class=\"hljs-attr\">amdSwitchable</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">canSupportThreadedTextureMailbox</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">directComposition</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">directRendering</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">glResetNotificationStrategy</span>: <span class=\"hljs-number\">0</span>,\n     <span class=\"hljs-attr\">inProcessGpu</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">initializationTime</span>: <span class=\"hljs-number\">0</span>,\n     <span class=\"hljs-attr\">jpegDecodeAcceleratorSupported</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">optimus</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">passthroughCmdDecoder</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">sandboxed</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">softwareRendering</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">supportsOverlays</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">videoDecodeAcceleratorFlags</span>: <span class=\"hljs-number\">0</span>\n   },\n  <span class=\"hljs-attr\">gpuDevice</span>:\n   [{ <span class=\"hljs-attr\">active</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">deviceId</span>: <span class=\"hljs-number\">26657</span>, <span class=\"hljs-attr\">vendorId</span>: <span class=\"hljs-number\">4098</span> },\n     { <span class=\"hljs-attr\">active</span>: <span class=\"hljs-literal\">false</span>, <span class=\"hljs-attr\">deviceId</span>: <span class=\"hljs-number\">3366</span>, <span class=\"hljs-attr\">vendorId</span>: <span class=\"hljs-number\">32902</span> }],\n  <span class=\"hljs-attr\">machineModelName</span>: <span class=\"hljs-string\">'MacBookPro'</span>,\n  <span class=\"hljs-attr\">machineModelVersion</span>: <span class=\"hljs-string\">'11.5'</span>\n}\n</code></pre>\n<p>El uso de <code>basic</code> debería ser preferido si sólo se necesita información básica como <code>vendorId</code> o <code>driverId</code>.</p>\n<h3 id=\"appsetbadgecountcount-linux-macos\"><a href=\"#appsetbadgecountcount-linux-macos\"><code>app.setBadgeCount([count])</code> <em>Linux</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>count</code> Integer (opcional) - Si un valor es proporcionado, establece el badge al valor proporcionado de lo contrario en macOS, muestra un simple punto blanco (p. ej. número desconocido de notificaciones). En Linux, si un valor no es proporcionado el badge no se mostrará.</li>\n</ul>\n<p>Regresa <code>Boolean</code> - Siempre que el llamado fue exitoso.</p>\n<p>Sets the counter badge for current app. Setting the count to <code>0</code> will hide the badge.</p>\n<p>On macOS, it shows on the dock icon. En Linux, solo funciona para Unity launcher.</p>\n<p><strong>Nota:</strong> El lanzador de Unity necesita un archivo <code>.desktop</code> para funcionar. Para más información, por favor lee la <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">documentación de integración con Unity</a>.</p>\n<h3 id=\"appgetbadgecount-linux-macos\"><a href=\"#appgetbadgecount-linux-macos\"><code>app.getBadgeCount()</code> <em>Linux</em> <em>macOS</em></a></h3>\n<p>Devolver <code>Entero</code> - El valor actual establecido en la insignia contraria.</p>\n<h3 id=\"appisunityrunning-linux\"><a href=\"#appisunityrunning-linux\"><code>app.isUnityRunning()</code> <em>Linux</em></a></h3>\n<p>Devuelve <code>Boolean</code> - Aunque el ambiente del escritorio actual sea un ejecutador de Unity.</p>\n<h3 id=\"appgetloginitemsettingsoptions-macos-windows\"><a href=\"#appgetloginitemsettingsoptions-macos-windows\"><code>app.getLoginItemSettings([options])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>path</code> String (optional) <em>Windows</em> - The executable path to compare against. Por defecto a <code>process.execPath</code>.</li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - The command-line arguments to compare against. Por defecto a un array vacío.</li>\n</ul></li>\n</ul>\n<p>Su proporcionas las opciones <code>path</code> y <code>args</code> a <code>app.setLoginItemSettings</code>, entonces necesitas pasar los mismos argumentos aquí para <code>openAtLogin</code> para que sea correctamente configurado.</p>\n<p>Devuelve <code>Objeto</code>:</p>\n<ul>\n<li><code>openAtLogin</code> Boolean - <code>true</code> si la aplicación es establecida para abrirse al iniciar.</li>\n<li><code>openAsHidden</code> Boolean <em>macOS</em> - <code>true</code> if the app is set to open as hidden at login. Esta configuración no está disponible en <a href=\"/docs/tutorial/mac-app-store-submission-guide\">builds para la tienda de aplicaciones de MAC</a>.</li>\n<li><code>wasOpenedAtLogin</code> Boolean <em>macOS</em> - <code>true</code> if the app was opened at login automatically. Esta configuración no está disponible en <a href=\"/docs/tutorial/mac-app-store-submission-guide\">builds para la tienda de aplicaciones de MAC</a>.</li>\n<li><code>wasOpenedAsHidden</code> Boolean <em>macOS</em> - <code>true</code> if the app was opened as a hidden login item. Esto indica que la aplicación no debería abrir ninguna ventana al inicio. Esta configuración no está disponible en <a href=\"/docs/tutorial/mac-app-store-submission-guide\">builds para la tienda de aplicaciones de MAC</a>.</li>\n<li><code>restoreState</code> Boolean <em>macOS</em> - <code>true</code> if the app was opened as a login item that should restore the state from the previous session. Esto indica que la aplicación debería restaurar las ventanas que fueron abiertas la última vez que la aplicación fue cerrada. Esta configuración no está disponible en <a href=\"/docs/tutorial/mac-app-store-submission-guide\">builds para la tienda de aplicaciones de MAC</a>.</li>\n<li><code>executableWillLaunchAtLogin</code> Boolean <em>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>\n<li><code>launchItems</code> Object[] <em>Windows</em><ul>\n<li><code>name</code> String <em>Windows</em> - name value of a registry entry.</li>\n<li><code>path</code> String <em>Windows</em> - The executable to an app that corresponds to a registry entry.</li>\n<li><code>args</code> String[] <em>Windows</em> - the command-line arguments to pass to the executable.</li>\n<li><code>scope</code> String <em>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>\n<li><code>enabled</code> Boolean <em>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>\n</ul></li>\n</ul>\n<h3 id=\"appsetloginitemsettingssettings-macos-windows\"><a href=\"#appsetloginitemsettingssettings-macos-windows\"><code>app.setLoginItemSettings(settings)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>settings</code> Object<ul>\n<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. Por defecto es <code>false</code>.</li>\n<li><code>openAsHidden</code> Boolean (optional) <em>macOS</em> - <code>true</code> to open the app as hidden. Por defecto a <code>false</code>. El usuario puede editar esta configuración desde la Preferencias del Sistema, así que <code>app.getLoginItemSettings().wasOpenedAsHidden</code> debe ser comprobado cuanto la aplicación es abierta para conocer el valor actual. Esta configuración no está disponible en <a href=\"/docs/tutorial/mac-app-store-submission-guide\">builds para la tienda de aplicaciones de MAC</a>.</li>\n<li><code>path</code> String (optional) <em>Windows</em> - The executable to launch at login. Por defecto a <code>process.execPath</code>.</li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - The command-line arguments to pass to the executable. Por defecto a un array vacío. Take care to wrap paths in quotes.</li>\n<li><code>enabled</code> Boolean (optional) <em>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. Por defecto es <code>true</code>.</li>\n<li><code>name</code> String (optional) <em>Windows</em> - value name to write into registry. Defaults to the app's AppUserModelId(). Establece los objetos de inicio de ajuste de la aplicación.</li>\n</ul></li>\n</ul>\n<p>Para trabajar con <code>autoUpdater</code> de Electron en Windows, el cual usa <a href=\"https://github.com/Squirrel/Squirrel.Windows\">Squirrel</a>, querrás establecer el camino de ejecución de Update.exe, y pasarán los argumentos que especifican el nombre de tu aplicación. Por ejemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> appFolder = path.dirname(process.execPath)\n<span class=\"hljs-keyword\">const</span> updateExe = path.resolve(appFolder, <span class=\"hljs-string\">'..'</span>, <span class=\"hljs-string\">'Update.exe'</span>)\n<span class=\"hljs-keyword\">const</span> exeName = path.basename(process.execPath)\n\napp.setLoginItemSettings({\n  <span class=\"hljs-attr\">openAtLogin</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">path</span>: updateExe,\n  <span class=\"hljs-attr\">args</span>: [\n    <span class=\"hljs-string\">'--processStart'</span>, <span class=\"hljs-string\">`\"<span class=\"hljs-subst\">${exeName}</span>\"`</span>,\n    <span class=\"hljs-string\">'--process-start-args'</span>, <span class=\"hljs-string\">`\"--hidden\"`</span>\n  ]\n})\n</code></pre>\n<h3 id=\"appisaccessibilitysupportenabled-macos-windows\"><a href=\"#appisaccessibilitysupportenabled-macos-windows\"><code>app.isAccessibilitySupportEnabled()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Devuelve <code>Boolean</code> - <code>true</code> si la accesibilidad de soporte de Chrome es habilitado, o <code>false</code> de otra manera. Esta API devolverá <code>true</code> si el uso de tecnologías asistivas, como leectores de pantallas, son detectadas. Ver <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">https://www.chromium.org/developers/design-documents/accessibility</a> para más detalles.</p>\n<h3 id=\"appsetaccessibilitysupportenabledenabled-macos-windows\"><a href=\"#appsetaccessibilitysupportenabledenabled-macos-windows\"><code>app.setAccessibilitySupportEnabled(enabled)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>enabled</code> Boolean - Activa o desactiva el renderizado del <a href=\"https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree\">árbol de accesibilidad</a></li>\n</ul>\n<p>Manualmente habilita el soporte de accesibilidad de Chrome, lo que permite exponer el interruptor de accesibilidad a los usuarios en la configuración de la aplicación. Mira <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">Chromium's accessibility docs</a> para mas detalles. Desactivado por defecto.</p>\n<p>Esta API debe ser llamada antes que el evento <code>ready</code> sea emitido.</p>\n<p><strong>Note:</strong> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.</p>\n<h3 id=\"appshowaboutpanel\"><a href=\"#appshowaboutpanel\"><code>app.showAboutPanel()</code></a></h3>\n<p>Show the app's about panel options. These options can be overridden with <code>app.setAboutPanelOptions(options)</code>.</p>\n<h3 id=\"appsetaboutpaneloptionsoptions\"><a href=\"#appsetaboutpaneloptionsoptions\"><code>app.setAboutPanelOptions(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>applicationName</code> Cadena (opcional) - El nombre de la aplicación.</li>\n<li><code>applicationVersion</code> Cadena (opcional) - La versión de la aplicación.</li>\n<li><code>copyright</code> Cadena (opcional) - La información de Copyright.</li>\n<li><code>version</code> String (optional) <em>macOS</em> - The app's build version number.</li>\n<li><code>credits</code> String (optional) <em>macOS</em> <em>Windows</em> - Credit information.</li>\n<li><code>authors</code> String<a href=\"/docs/api/optional\"></a> <em>Linux</em> - List of app authors.</li>\n<li><code>website</code> String (optional) <em>Linux</em> - The app's website.</li>\n<li><code>iconPath</code> String (optional) <em>Linux</em> <em>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>\n</ul></li>\n</ul>\n<p>Establece el panel de opciones. This will override the values defined in the app's <code>.plist</code> file on macOS. Ver el <a href=\"https://developer.apple.com/reference/appkit/nsapplication/1428479-orderfrontstandardaboutpanelwith?language=objc\">Apple docs</a> para más detalles. En Linux, los valores deben establecerse para ser mostrados; no hay valores por defecto.</p>\n<p>Si no estableces <code>credits</code> pero aún deseas sacarlos en tu aplicación, AppKit buscará por un archivo llamado \"Credits.html\", \"Credits.rtf\", y \"Credits.rtfd\", en ese orden, en el paquete devuelto por el método de clase principal NSBundle. El primer archivo encontrado es usado, y si no se encuentra ninguno, el área de información se deja en blanco. Vea la <a href=\"https://developer.apple.com/documentation/appkit/nsaboutpaneloptioncredits?language=objc\">documentation</a> de Apple para más información.</p>\n<h3 id=\"appisemojipanelsupported\"><a href=\"#appisemojipanelsupported\"><code>app.isEmojiPanelSupported()</code></a></h3>\n<p>Devuelve <code>Boolean</code> - si la versión del sistema operativo actual permite permite o no los selectores de emoji nativos.</p>\n<h3 id=\"appshowemojipanel-macos-windows\"><a href=\"#appshowemojipanel-macos-windows\"><code>app.showEmojiPanel()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Muestra el selector de emoji nativo de la plataforma.</p>\n<h3 id=\"appstartaccessingsecurityscopedresourcebookmarkdata-mas\"><a href=\"#appstartaccessingsecurityscopedresourcebookmarkdata-mas\"><code>app.startAccessingSecurityScopedResource(bookmarkData)</code> <em>mas</em></a></h3>\n<ul>\n<li><code>bookmarkData</code> String - El marcador de datos de ámbito de seguridad de codificación base64 devuelto por los métodos <code>dialog.showOpenDialog</code> o <code>dialog.showSaveDialog</code>.</li>\n</ul>\n<p>Returns <code>Function</code> - This function <strong>must</strong> be called once you have finished accessing the security scoped file. Si no recuerdas de dejar de acceder el marcador, <a href=\"https://developer.apple.com/reference/foundation/nsurl/1417051-startaccessingsecurityscopedreso?language=objc\">recursos de nucleo se fugarán</a> y tu aplicación se perderá su capacidad de alcanzar afuera del entorno aislado completamente hasta que se reinicia tu aplicación.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Start accessing the file.</span>\n<span class=\"hljs-keyword\">const</span> stopAccessingSecurityScopedResource = app.startAccessingSecurityScopedResource(data)\n<span class=\"hljs-comment\">// You can now access the file outside of the sandbox 🎉</span>\n\n<span class=\"hljs-comment\">// Remember to stop accessing the file once you've finished with it.</span>\nstopAccessingSecurityScopedResource()\n</code></pre>\n<p>Empezar a acceder un recurso de ámbito de seguridad. Con este método las aplicaciones Electron que están empaquetadas para la Mac App Store pueden llegar fuera de su caja de arena para acceder a los archivos elegidos por el usuario. Ver a <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">Apple's documentation</a> por una descripción de cómo funciona este sistema.</p>\n<h3 id=\"appenablesandbox\"><a href=\"#appenablesandbox\"><code>app.enableSandbox()</code></a></h3>\n<p>Habilita el modo sandbox completo en la aplicación. This means that all renderers will be launched sandboxed, regardless of the value of the <code>sandbox</code> flag in WebPreferences.</p>\n<p>Este método solo puede ser llamado despues de iniciada la aplicación.</p>\n<h3 id=\"appisinapplicationsfolder-macos\"><a href=\"#appisinapplicationsfolder-macos\"><code>app.isInApplicationsFolder()</code> <em>macOS</em></a></h3>\n<p>Devuelve <code>Boolean</code> - Si la aplicación esta actualmente ejecutándose desde la carpeta de Aplicación del sistema. Use in combination with <code>app.moveToApplicationsFolder()</code></p>\n<h3 id=\"appmovetoapplicationsfolderoptions-macos\"><a href=\"#appmovetoapplicationsfolderoptions-macos\"><code>app.moveToApplicationsFolder([options])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>conflictHandler</code> Function\\<boolean> (opcional) - Un controlador para el potencial conflicto en el fallo de movimiento.<ul>\n<li><code>conflictType</code> String - El tipo de conflicto de movimiento encontrado por el controlador; puede ser <code>exists</code> o <code>existsAndRunning</code>, donde <code>exists</code> quiere decir que una aplicación con el mismo nombre está presente el directorio de las Aplicaciones y <code>existsAndRunning</code> quiere decir que que existe y que se está ejecutando actualmente.</li>\n</ul></boolean></li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Boolean</code> - Si el movimiento fue realizado correctamente. Por favor, ten en cuenta que si el movimiento es exitoso, tu aplicación se cerrará y se reiniciará.</p>\n<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=\"/docs/api/dialog\"><code>dialog</code></a> API.</p>\n<p><strong>NOTE:</strong> This method throws errors if anything other than the user causes the move to fail. Por ejemplo si el usuario cancela el dialogo de autorización, este método va a devolver falso. Si nosotros no realizamos la copia, entonces este método va a lanzar un error. The message in the error should be informative and tell you exactly what went wrong.</p>\n<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. Este comportamiento puede ser cambiado proporcionando un controlador de conflicto opcional, donde el booleano devuelto por el controlado determina si el conflicto de movimiento se resuelve o no con el controlador por defecto.  es decir, devolviendo <code>false</code> se asegura que no se tomaran más acciones, devolviendo <code>true</code> resultará en el comportamiento por defecto y el método continuando.</p>\n<p>Por ejemplo:</p>\n<pre><code class=\"hljs language-js\">app.moveToApplicationsFolder({\n  <span class=\"hljs-attr\">conflictHandler</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">conflictType</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (conflictType === <span class=\"hljs-string\">'exists'</span>) {\n      <span class=\"hljs-keyword\">return</span> dialog.showMessageBoxSync({\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'question'</span>,\n        <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Halt Move'</span>, <span class=\"hljs-string\">'Continue Move'</span>],\n        <span class=\"hljs-attr\">defaultId</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'An app of this name already exists'</span>\n      }) === <span class=\"hljs-number\">1</span>\n    }\n  }\n})\n</code></pre>\n<p>Significaría que si una aplicación ya existe en el directorio del usuario, si el usuario elige 'Continuar Mover' entonces la función debería continuar con su comportamiento por defecto y la aplicación existente será eliminada y la aplicación activa será movida en su lugar.</p>\n<h3 id=\"appissecurekeyboardentryenabled-macos\"><a href=\"#appissecurekeyboardentryenabled-macos\"><code>app.isSecureKeyboardEntryEnabled()</code> <em>macOS</em></a></h3>\n<p>Returns <code>Boolean</code> - whether <code>Secure Keyboard Entry</code> is enabled.</p>\n<p>By default this API will return <code>false</code>.</p>\n<h3 id=\"appsetsecurekeyboardentryenabledenabled-macos\"><a href=\"#appsetsecurekeyboardentryenabledenabled-macos\"><code>app.setSecureKeyboardEntryEnabled(enabled)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>enabled</code> Boolean - Enable or disable <code>Secure Keyboard Entry</code></li>\n</ul>\n<p>Set the <code>Secure Keyboard Entry</code> is enabled in your application.</p>\n<p>By using this API, important information such as password and other sensitive information can be prevented from being intercepted by other processes.</p>\n<p>See <a href=\"https://developer.apple.com/library/archive/technotes/tn2150/_index.html\">Apple's documentation</a> for more details.</p>\n<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>\n<h2 id=\"propiedades\"><a href=\"#propiedades\">Propiedades</a></h2>\n<h3 id=\"appaccessibilitysupportenabled-macos-windows\"><a href=\"#appaccessibilitysupportenabled-macos-windows\"><code>app.accessibilitySupportEnabled</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Un propiedad <code>Boolean</code> eso es <code>true</code> si el soporte de accesibilidad de Chrome esta activado, <code>false</code> de otra manera. Esta propiedad será <code>true</code> si se ha detectado el uso de tecnologías asistitivas, como lectores de pantalla. Estableciendo esta propiedad manualmente a <code>true</code> se activá el soporte de accesibilidad de Chrome, permitiendo a los desarrolladores exponer el cambio de accesibilidad a los usuarios en la configuración de la aplicación.</p>\n<p>See <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">Chromium's accessibility docs</a> for more details. Desactivado por defecto.</p>\n<p>Esta API debe ser llamada antes que el evento <code>ready</code> sea emitido.</p>\n<p><strong>Note:</strong> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.</p>\n<h3 id=\"appapplicationmenu\"><a href=\"#appapplicationmenu\"><code>app.applicationMenu</code></a></h3>\n<p>Una propiedad <code>Menu | null</code> que devuelve <a href=\"/docs/api/menu\"><code>Menu</code></a> si uno ha sido establecido y <code>null</code> de lo contrario. Los usuarios pueden pasar un <a href=\"/docs/api/menu\">Menú</a> para establecer esta propiedad.</p>\n<h3 id=\"appbadgecount-linux-macos\"><a href=\"#appbadgecount-linux-macos\"><code>app.badgeCount</code> <em>Linux</em> <em>macOS</em></a></h3>\n<p>Una propiedad <code>Integer</code> que devuelve el recuento de insignias para la aplicación actual. Setting the count to <code>0</code> will hide the badge.</p>\n<p>On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher.</p>\n<p><strong>Nota:</strong> El lanzador de Unity necesita un archivo <code>.desktop</code> para funcionar. Para más información, por favor lee la <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">documentación de integración con Unity</a>.</p>\n<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>\n<h3 id=\"appcommandline-readonly\"><a href=\"#appcommandline-readonly\"><code>app.commandLine</code> <em>Readonly</em></a></h3>\n<p>Un objeto <a href=\"/docs/api/command-line\"><code>CommandLine</code></a> que te permite leer y manipular los argumentos de linea de comando que usa Chromium.</p>\n<h3 id=\"appdock-macos-readonly\"><a href=\"#appdock-macos-readonly\"><code>app.dock</code> <em>macOS</em> <em>Readonly</em></a></h3>\n<p>A <a href=\"/docs/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>\n<h3 id=\"appispackaged-readonly\"><a href=\"#appispackaged-readonly\"><code>app.isPackaged</code> <em>Readonly</em></a></h3>\n<p>Una propiedad <code>Boolean</code> que retorna <code>true</code> si la aplicación está empaquetada, <code>false</code> si no lo está. Para muchas aplicaciones, esta propiedad puede ser usada para distinguir los ambientes de desarrollo y producción.</p>\n<h3 id=\"appname\"><a href=\"#appname\"><code>app.name</code></a></h3>\n<p>Una propiedad <code>String</code> que índica el nombre actual de la aplicación, el cual es el nombre en el archivo <code>package.json</code> de la aplicación.</p>\n<p>Usualmente el campo <code>name</code> de <code>package.json</code> es un nombre corto en minúscula, de acuerdo con las especificaciones de los módulos npm. Normalmente debe especificar un <code>productName</code> también, el cual es el nombre de su aplicación en mayúsculas, y que será preferido por Electron sobre <code>name</code>.</p>\n<h3 id=\"appuseragentfallback\"><a href=\"#appuseragentfallback\"><code>app.userAgentFallback</code></a></h3>\n<p>Un <code>String</code> que es la cadena de agente de usuario Electron usará como una regresión global.</p>\n<p>Este es el agente de usuario que se utilizará cuando ningún agente de usuario está establecido en el nivel <code>webContents</code> o <code>session</code>.  Es útil para asegurar que la aplicación entera tiene el mismo agente de usuario.  Establecer a un valor personalizado lo antes posible en la inicialización de tu aplicación para asegurar que el valor sobrescrito es usado.</p>\n<h3 id=\"apprunningunderrosettatranslation-macos-readonly-deprecated\"><a href=\"#apprunningunderrosettatranslation-macos-readonly-deprecated\"><code>app.runningUnderRosettaTranslation</code> <em>macOS</em> <em>Readonly</em> <em>Deprecated</em></a></h3>\n<p>A <code>Boolean</code> which when <code>true</code> indicates that the app is currently running under the <a href=\"https://en.wikipedia.org/wiki/Rosetta_(software)\">Rosetta Translator Environment</a>.</p>\n<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>\n<p><strong>Obsoleto:</strong> Esta propiedad es reemplazada por la propiedad <code>runningUnderARM64Translation</code> la cual detecta cuando la aplicación esta traducida a ARM64 tanto en macOS y Windows.</p>\n<h3 id=\"apprunningunderarm64translation-readonly-macos-windows\"><a href=\"#apprunningunderarm64translation-readonly-macos-windows\"><code>app.runningUnderARM64Translation</code> <em>Readonly</em> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Un <code>Boolean</code> el cual cuando es <code>true</code> indica que la aplicación actualmente está ejecutándose bajo un traductor ARM64 (como el <a href=\"https://en.wikipedia.org/wiki/Rosetta_(software)\">Rosetta Translator Environment</a> de macOS o <a href=\"https://en.wikipedia.org/wiki/Windows_on_Windows\">WOW</a> de Windows).</p>\n<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>",
      "title": "app",
      "description": "Controla el ciclo de vida de los eventos de su aplicación."
    },
    "/docs/tutorial/application-debugging": {
      "locale": "es-ES",
      "slug": "application-debugging",
      "href": "/docs/tutorial/application-debugging",
      "crowdinFileId": "256175",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/application-debugging.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"depuración-de-la-aplicación\"><a href=\"#depuración-de-la-aplicación\">Depuración de la aplicación</a></h1>\n<p>Cada vez que su aplicación de Electron no se comporta de la manera que desea, una variedad de herramientas de depuración pueden ayudarte a encontrar errores en el código, rendimiento, u oportunidades de optimización.</p>\n<h2 id=\"proceso-de-renderización\"><a href=\"#proceso-de-renderización\">Proceso de Renderización</a></h2>\n<p>La herramienta mas completa para depurar un proceso de renderización individualmente son las Chromium Developer Tools. Está disponible para todos los procesos de renderización, incluyendo <code>BrowserWindow</code>, <code>BrowserView</code>, y <code>WebView</code>. Puedes abrirla programáticamente usando la API <code>openDevTools()</code> de la instancia de <code>webContents</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.openDevTools()\n</code></pre>\n<p>Google ofrece <a href=\"https://developer.chrome.com/devtools\">documentación excelente para sus herramientas de desarrollo</a>. Recomendamos que se familiarice con ello - son una de las utilidades más versátiles para cualquier desarrollador de aplicaciones de Electron.</p>\n<h2 id=\"proceso-principal\"><a href=\"#proceso-principal\">Proceso Principal</a></h2>\n<p>La depuración del proceso principal es un poco más complicada, porque en este caso no se pueden abrir las Developer Tools. Las Chromium Developer Tools pueden <a href=\"https://nodejs.org/en/docs/inspector/\">ser usadas para depurar el proceso principal de Electron</a> gracias a una colaboración cercana entre Google / Chrome y Node.js, pero puede encontrar obstáculos como la ausencia de <code>require</code> en la consola.</p>\n<p>Para mas información, vea la <a href=\"/docs/tutorial/debugging-main-process\">documentación de Depurando el Proceso Principal</a>.</p>\n<h2 id=\"bloqueos-v8\"><a href=\"#bloqueos-v8\">Bloqueos V8</a></h2>\n<p>Si el contexto V8 se bloquea, el DevTools mostrará este mensaje.</p>\n<p><code>DevTools fue desconectado de la página. Una vez que la pagina sea recargada, DevTools se reconectará automáticamente.</code></p>\n<p>Los registros de Chromium puden ser habilitados a través de la variable de entorno <code>ELECTRON_ENABLE_LOGGING</code>. Para más información, vea la <a href=\"/docs/api/environment-variables#electron_enable_logging\">documentacion de variables de entorno</a>.</p>\n<p>Alternativamente, el argumento de linea de comando <code>--enable-logging</code> puede ser pasado. Más información esta disponible en la <a href=\"/docs/api/command-line-switches#--enable-loggingfile\">la documentación de parámetros de la línea de comando</a>.</p>",
      "title": "Depuración de la aplicación",
      "description": ""
    },
    "/docs/tutorial/application-distribution": {
      "locale": "es-ES",
      "slug": "application-distribution",
      "href": "/docs/tutorial/application-distribution",
      "crowdinFileId": "256177",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/application-distribution.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"distribución-de-la-aplicación\"><a href=\"#distribución-de-la-aplicación\">Distribución de la Aplicación</a></h1>\n<h2 id=\"descripción-general\"><a href=\"#descripción-general\">Descripción general</a></h2>\n<p>Para distribuir tu aplicación de Electron, necesitas empaquetarla y cambiar el nombre. Para hacer esto, puedes usar herramientas especializadas o manualmente.</p>\n<h2 id=\"usando-herramientas\"><a href=\"#usando-herramientas\">Usando herramientas</a></h2>\n<p>Puedes usar las siguientes herramientas para distribuir tu aplicación:</p>\n<ul>\n<li><a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a></li>\n<li><a href=\"https://github.com/electron-userland/electron-builder\">Electron-builder</a></li>\n<li><a href=\"https://github.com/electron/electron-packager\">electron-packager</a></li>\n</ul>\n<p>Estas herramientas se encargaran de todo los pasos necesarios para crear una aplicación de Electron distribuible, como empaquetar tu aplicación, cambiar el nombre del ejecutable y configurar los iconos correctos.</p>\n<p>You can check the example of how to package your app with <code>electron-forge</code> in the <a href=\"/docs/tutorial/quick-start#package-and-distribute-your-application\">Quick Start guide</a>.</p>\n<h2 id=\"proceso-manual\"><a href=\"#proceso-manual\">Proceso manual</a></h2>\n<h3 id=\"con-binarios-precompilados\"><a href=\"#con-binarios-precompilados\">Con binarios precompilados</a></h3>\n<p>Para distribuir tu aplicación manualmente, necesitas descargar los <a href=\"https://github.com/electron/electron/releases\">prebuilt binaries</a> de Electron. Luego, la carpeta que contiene tu aplicación debe llamarse <code>app</code> y colocarse en el directorio de recursos de Electron como se muestra en los siguientes ejemplos.</p>\n<blockquote>\n<p><em>NOTA:</em> la ubicación de los binarios preconstruidos de Electron esta indicado con <code>electron/</code> en los siguientes ejemplos.</p>\n</blockquote>\n<p><em>En macOS:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/Electron.app/Contents/Resources/app/\n├── package.json\n├── main.js\n└── index.html\n</code></pre>\n<p><em>En Windows y Linux:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/resources/app\n├── package.json\n├── main.js\n└── index.html\n</code></pre>\n<p>Luego ejecuta <code>Electron.app</code> en macOS, <code>electron</code> en Linux, o <code>electron.exe</code> en Windows, y tu aplicación Electron se ejecutará. El directorio <code>electron</code> será el que hay que dar a tus usuarios.</p>\n<h3 id=\"con-un-archivo-de-código-fuente-de-la-aplicación\"><a href=\"#con-un-archivo-de-código-fuente-de-la-aplicación\">Con un archivo de código fuente de la aplicación</a></h3>\n<p>En lugar de enviar tu aplicación copiando todos sus archivos de origen, puedes empaquetar tu aplicación en un archivo <a href=\"https://github.com/electron/asar\">asar</a> para mejorar el rendimiento de los archivos de lectura en plataformas como Windows, si aún no estás usando un bundler como como Parcel o WebPack.</p>\n<p>Para usar un archivo <code>asar</code> para reemplazar la carpeta <code>app</code>, debe cambiar el nombre del archivo. archive a <code>app.asar</code>, y póngalo en el directorio de recursos de Electron como a continuación, y Electron intentará leer el archivo y comenzar desde allí.</p>\n<p><em>En macOS:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/Electron.app/Contents/Resources/\n└── app.asar\n</code></pre>\n<p><em>En Windows y Linux:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/resources/\n└── app.asar\n</code></pre>\n<p>Puedes encontrar más detalles de como usar <code>asar</code> en el <a href=\"https://github.com/electron/asar\">repositorio <code>electron/asar</code> </a>.</p>\n<h3 id=\"renombrando-binarios-descargados\"><a href=\"#renombrando-binarios-descargados\">Renombrando binarios descargados</a></h3>\n<p>Después de empaquetar su aplicación en Electron, querrá cambiar la marca de Electron antes de distribuirlo a sus usuarios.</p>\n<h4 id=\"macos\"><a href=\"#macos\">macOS</a></h4>\n<p>Puede cambiar el nombre <code>Electron.app</code> a cualquier nombre que desee, y también debe cambiar el valor de los campos <code>CFBundleDisplayName</code>, <code>CFBundleIdentifier</code> y <code>CFBundleName</code> en los siguientes archivos:</p>\n<ul>\n<li><code>Electron.app/Contents/Info.plist</code></li>\n<li><code>Electron.app/Contents/Frameworks/Electron Helper.app/Contents/Info.plist</code></li>\n</ul>\n<p>También puede cambiar el nombre de la aplicación auxiliar para evitar mostrar <code>Electron Helper</code> en el Monitor de actividad, pero asegúrese de haber cambiado el nombre del archivo ejecutable de la aplicación auxiliar.</p>\n<p>La estructura de una aplicación renombrada sería similar a:</p>\n<pre><code class=\"hljs language-plaintext\">MyApp.app/Contents\n├── Info.plist\n├── MacOS/\n│   └── MyApp\n└── Frameworks/\n    └── MyApp Helper.app\n        ├── Info.plist\n        └── MacOS/\n            └── MyApp Helper\n</code></pre>\n<h4 id=\"windows\"><a href=\"#windows\">Windows</a></h4>\n<p>Puede cambiar el nombre <code>electron.exe</code> a cualquier nombre que desee, y editar su icono y otra información con herramientas como <a href=\"https://github.com/electron/rcedit\">rcedit</a>.</p>\n<h4 id=\"linux\"><a href=\"#linux\">Linux</a></h4>\n<p>Puede cambiar el nombre del archivo ejecutable <code>electron</code> a cualquier nombre que desee.</p>\n<h3 id=\"renombrar-compilando-electron-desde-el-código-fuente\"><a href=\"#renombrar-compilando-electron-desde-el-código-fuente\">Renombrar compilando Electron desde el código fuente</a></h3>\n<p>También es posible renombrar Electron simplemente cambiando el nombre del producto y volver a compilarlo desde el código fuente. Para hacerlo, necesita que el argumento de compilación se corresponda con el nombre del producto (<code>electron_product_name = \"YourProductName\"</code>) en el archivo <code>args.gn</code> y recompilarlo.</p>",
      "title": "Distribución de la Aplicación",
      "description": "NOTA: la ubicación de los binarios preconstruidos de Electron esta indicado con electron/ en los siguientes ejemplos."
    },
    "/docs/api/auto-updater": {
      "locale": "es-ES",
      "slug": "auto-updater",
      "href": "/docs/api/auto-updater",
      "crowdinFileId": "256281",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/auto-updater.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"autoupdater\"><a href=\"#autoupdater\">autoUpdater</a></h1>\n<blockquote>\n<p>Enable apps to automatically update themselves.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p><strong>Puede Ver: <a href=\"/docs/tutorial/updates\">Una guía detallada sobre cómo implementar las actualizaciones en su aplicación</a>.</strong></p>\n<p><code>autoUpdater</code> es un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h2 id=\"noticias-de-la-plataforma\"><a href=\"#noticias-de-la-plataforma\">Noticias de la plataforma</a></h2>\n<p>Actualmente, sólo macOS y Windows son soportados. No hay soporte para auto actualizaciones en Linux, por lo que es recomendable que use el gestor de paquetes de la distribución para actualizar su aplicación.</p>\n<p>Adicionalmente, hay algunas diferencias sutiles en cada plataforma:</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>En macOS, el módulo <code>autoUpdater</code> está construido sobre <a href=\"https://github.com/Squirrel/Squirrel.Mac\">Squirrel.Mac</a>, lo que significa que no necesita ninguna configuración especial para que funcione. Para los requisitos de servidor, puede leer <a href=\"https://github.com/Squirrel/Squirrel.Mac#server-support\">Soporte de servidor</a>. Tenga en cuenta que <a href=\"https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW35\">App Transport Security</a> (ATS) se aplica para todas las solicitudes creadas como parte del proceso de actualizaciones. Aplicaciones que necesitan para desactivar ATS pueden agregar la clave de <code>NSAllowsArbitraryLoads</code> a su .plist de su aplicación.</p>\n<p><strong>Nota:</strong> Su aplicación debe ser firmada para actualizaciones automáticas en macOS. Este es un requerimiento de <code>Squirrel.Mac</code>.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<p>On Windows, you have to install your app into a user's machine before you can use the <code>autoUpdater</code>, so it is recommended that you use the <a href=\"https://github.com/electron/windows-installer\">electron-winstaller</a>, <a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a> or the <a href=\"https://github.com/electron/grunt-electron-installer\">grunt-electron-installer</a> package to generate a Windows installer.</p>\n<p>When using <a href=\"https://github.com/electron/windows-installer\">electron-winstaller</a> or <a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a> make sure you do not try to update your app <a href=\"https://github.com/electron/windows-installer#handling-squirrel-events\">the first time it runs</a> (Also see <a href=\"https://github.com/electron/electron/issues/7155\">this issue for more info</a>). Se recomienda usar <a href=\"https://github.com/mongodb-js/electron-squirrel-startup\">electron-squirrel-startup</a> para obtener acceso directo en el escritorio para su aplicación.</p>\n<p>The installer generated with Squirrel will create a shortcut icon with an <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> in the format of <code>com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE</code>, examples are <code>com.squirrel.slack.Slack</code> and <code>com.squirrel.code.Code</code>. Tu debes usar el mismo ID de tu aplicación con <code>app.setAppUserModelId</code> API, de lo contrario Windows no podría ejecutarlo correctamente en la barra de tareas.</p>\n<p>Like Squirrel.Mac, Windows can host updates on S3 or any other static file host. You can read the documents of <a href=\"https://github.com/Squirrel/Squirrel.Windows\">Squirrel.Windows</a> to get more details about how Squirrel.Windows works.</p>\n<h2 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h2>\n<p>El objeto <code>app</code> emite los siguientes eventos:</p>\n<h3 id=\"evento-error\"><a href=\"#evento-error\">Evento: \"error\"</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>error</code> Error</li>\n</ul>\n<p>Aparece cuando hay un error al actualizar.</p>\n<h3 id=\"evento-comprobar-si-hay-actualizaciones\"><a href=\"#evento-comprobar-si-hay-actualizaciones\">Evento: \"comprobar si hay actualizaciones\"</a></h3>\n<p>Aparece al comprobar si una actualización ya ha empezado.</p>\n<h3 id=\"evento-actualización-disponible\"><a href=\"#evento-actualización-disponible\">Evento: \"actualización disponible\"</a></h3>\n<p>Emitido cuando hay una actualización disponible. La actualización es descargada automáticamente.</p>\n<h3 id=\"evento-update-not-available\"><a href=\"#evento-update-not-available\">Evento: 'update-not-available'</a></h3>\n<p>Aparece cuando no hay una actualización disponible.</p>\n<h3 id=\"evento-actualización-descargada\"><a href=\"#evento-actualización-descargada\">Evento: \"actualización descargada\"</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>releaseNotes</code> String</li>\n<li><code>releaseName</code> String</li>\n<li><code>releaseDate</code> Date</li>\n<li><code>updateURL</code> String</li>\n</ul>\n<p>Aparece cuando se ha descargado una actualización.</p>\n<p>Solo esta disponible en Windows <code>releaseName</code>.</p>\n<p><strong>Nota:</strong> No es estrictamente necesario manejar este evento. Una actualización descargada con éxito se aplicará la próxima vez que la aplicación inicie.</p>\n<h3 id=\"evento-before-quit-for-update\"><a href=\"#evento-before-quit-for-update\">Evento: 'before-quit-for-update'</a></h3>\n<p>Este evento se ejecuta luego que un usuario llama al método: <code>quitAndInstall()</code>.</p>\n<p>Cuando se hace el llamado a la API, el evento <code>before-quit</code> no se ejecuta hasta que todas las ventanas estén cerradas. Como resultado usted debe escuchar a este evento si desea realizar acciones antes de que las ventanas sean cerradas, mientras el proceso está finalizando, así como también escuchar al proceso: <code>before-quit</code>.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El objeto <code>autoUpdater</code> tiene los siguientes métodos:</p>\n<h3 id=\"autoupdatersetfeedurloptions\"><a href=\"#autoupdatersetfeedurloptions\"><code>autoUpdater.setFeedURL(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>url</code> String</li>\n<li><code>headers</code> Record&#x3C;String, String> (opcional) <em>macOS</em> - Cabeceras de peticiones HTTP.</li>\n<li><code>serverType</code> String (optional) <em>macOS</em> - Can be <code>json</code> or <code>default</code>, see the <a href=\"https://github.com/Squirrel/Squirrel.Mac\">Squirrel.Mac</a> README for more information.</li>\n</ul></li>\n</ul>\n<p>Configura el <code>url</code> e inicializa la actualización automática.</p>\n<h3 id=\"autoupdatergetfeedurl\"><a href=\"#autoupdatergetfeedurl\"><code>autoUpdater.getFeedURL()</code></a></h3>\n<p>Devuelve <code>String</code> - La actualización actual provee el URL.</p>\n<h3 id=\"autoupdatercheckforupdates\"><a href=\"#autoupdatercheckforupdates\"><code>autoUpdater.checkForUpdates()</code></a></h3>\n<p>Pregunta al servidor si hay una actualización. Debes llamar a <code>setFeedURL</code> antes de usar esta API.</p>\n<p><strong>Note:</strong> If an update is available it will be downloaded automatically. Calling <code>autoUpdater.checkForUpdates()</code> twice will download the update two times.</p>\n<h3 id=\"autoupdaterquitandinstall\"><a href=\"#autoupdaterquitandinstall\"><code>autoUpdater.quitAndInstall()</code></a></h3>\n<p>Reinicia la aplicación e instala la actualización después que esta ha sido descargada. Sólo debería llamarse después de que <code>update-downloaded</code> ha sido emitido.</p>\n<p>Llamar a <code>autoUpdater.quitAndInstall()</code> bajo la capucha cerrará todas las ventanas de la aplicación, y llamará automáticamente a <code>app.quit()</code> después de que se hayan cerrado todas las ventanas.</p>\n<p><strong>Note:</strong> It is not strictly necessary to call this function to apply an update, as a successfully downloaded update will always be applied the next time the application starts.</p>",
      "title": "autoUpdater",
      "description": "Enable apps to automatically update themselves."
    },
    "/docs/tutorial/automated-testing-with-a-custom-driver": {
      "locale": "es-ES",
      "slug": "automated-testing-with-a-custom-driver",
      "href": "/docs/tutorial/automated-testing-with-a-custom-driver",
      "crowdinFileId": "256179",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/automated-testing-with-a-custom-driver.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"automatizado-con-un-controlador-personalizado-de-prueba\"><a href=\"#automatizado-con-un-controlador-personalizado-de-prueba\">Automatizado con un controlador personalizado de prueba</a></h1>\n<p>Para escribir pruebas automatizadas para su aplicación Electron, necesitará una forma de \"manejar\" su aplicación. <a href=\"https://electronjs.org/spectron\">Spectron</a> es una solución de uso común que le permite emular las acciones de los usuarios a través de <a href=\"https://webdriver.io/\">WebDriver</a>. Sin embargo, también es posible escribir su propio controlador personalizado utilizando el IPC-over-STDIO incorporado en el nodo. El beneficio de un controlador personalizado es que tiende a requerir menos gastos generales que Spectron, y le permite exponer métodos personalizados a su conjunto de pruebas.</p>\n<p>Para crear un controlador personalizado, usaremos la API de Node.js <a href=\"https://nodejs.org/api/child_process.html\">child_process</a>. El conjunto de pruebas generará el proceso de Electron, luego establecerá un protocolo de mensajería simple:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> childProcess = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'child_process'</span>)\n<span class=\"hljs-keyword\">const</span> electronPath = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// spawn the process</span>\n<span class=\"hljs-keyword\">const</span> env = { <span class=\"hljs-comment\">/* ... */</span> }\n<span class=\"hljs-keyword\">const</span> stdio = [<span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'ipc'</span>]\n<span class=\"hljs-keyword\">const</span> appProcess = childProcess.spawn(electronPath, [<span class=\"hljs-string\">'./app'</span>], { stdio, env })\n\n<span class=\"hljs-comment\">// listen for IPC messages from the app</span>\nappProcess.on(<span class=\"hljs-string\">'message'</span>, (msg) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// envía un mensaje IPC a la aplicación </span>\nappProcess.send({ <span class=\"hljs-attr\">my</span>: <span class=\"hljs-string\">'message'</span> })\n</code></pre>\n<p>Desde dentro de la aplicación Electron, puedes escuchar mensajes y enviar respuestas usando la API de Node.js <a href=\"https://nodejs.org/api/process.html\">process</a>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// escuchar por mensajes IPC desde el suite de prueba</span>\nprocess.on(<span class=\"hljs-string\">'message'</span>, (msg) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// enviar un mensaje IPC al suite de prueba</span>\nprocess.send({ <span class=\"hljs-attr\">my</span>: <span class=\"hljs-string\">'message'</span> })\n</code></pre>\n<p>Ahora podemos comunicar desde la suite de test a la aplicación Electron usando el objeto <code>appProcess</code>.</p>\n<p>Por conveniencia, es posible que desee encapsular <code>appProcess</code> en un objeto controlador, que provea funciones de más alto nivel. Este es un ejemplo de como podría hacerlo:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">TestDriver</span> </span>{\n  <span class=\"hljs-keyword\">constructor</span> ({ path, args, env }) {\n    <span class=\"hljs-keyword\">this</span>.rpcCalls = []\n\n    <span class=\"hljs-comment\">// start child process</span>\n    env.APP_TEST_DRIVER = <span class=\"hljs-number\">1</span> <span class=\"hljs-comment\">// let the app know it should listen for messages</span>\n    <span class=\"hljs-keyword\">this</span>.process = childProcess.spawn(path, args, { <span class=\"hljs-attr\">stdio</span>: [<span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'ipc'</span>], env })\n\n    <span class=\"hljs-comment\">// handle rpc responses</span>\n    <span class=\"hljs-keyword\">this</span>.process.on(<span class=\"hljs-string\">'message'</span>, (message) => {\n      <span class=\"hljs-comment\">// pop the handler</span>\n      <span class=\"hljs-keyword\">const</span> rpcCall = <span class=\"hljs-keyword\">this</span>.rpcCalls[message.msgId]\n      <span class=\"hljs-keyword\">if</span> (!rpcCall) <span class=\"hljs-keyword\">return</span>\n      <span class=\"hljs-keyword\">this</span>.rpcCalls[message.msgId] = <span class=\"hljs-literal\">null</span>\n      <span class=\"hljs-comment\">// reject/resolve</span>\n      <span class=\"hljs-keyword\">if</span> (message.reject) rpcCall.reject(message.reject)\n      <span class=\"hljs-keyword\">else</span> rpcCall.resolve(message.resolve)\n    })\n\n    <span class=\"hljs-comment\">// wait for ready</span>\n    <span class=\"hljs-keyword\">this</span>.isReady = <span class=\"hljs-keyword\">this</span>.rpc(<span class=\"hljs-string\">'isReady'</span>).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">err</span>) =></span> {\n      <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Application failed to start'</span>, err)\n      <span class=\"hljs-keyword\">this</span>.stop()\n      process.exit(<span class=\"hljs-number\">1</span>)\n    })\n  }\n\n  <span class=\"hljs-comment\">// simple RPC call</span>\n  <span class=\"hljs-comment\">// to use: driver.rpc('method', 1, 2, 3).then(...)</span>\n  <span class=\"hljs-keyword\">async</span> rpc (cmd, ...args) {\n    <span class=\"hljs-comment\">// send rpc request</span>\n    <span class=\"hljs-keyword\">const</span> msgId = <span class=\"hljs-keyword\">this</span>.rpcCalls.length\n    <span class=\"hljs-keyword\">this</span>.process.send({ msgId, cmd, args })\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\">(<span class=\"hljs-params\">resolve, reject</span>) =></span> <span class=\"hljs-keyword\">this</span>.rpcCalls.push({ resolve, reject }))\n  }\n\n  stop () {\n    <span class=\"hljs-keyword\">this</span>.process.kill()\n  }\n}\n</code></pre>\n<p>En la aplicación, necesitará escribir un controlador sencillo para las llamadas RPC:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">if</span> (process.env.APP_TEST_DRIVER) {\n  process.on(<span class=\"hljs-string\">'message'</span>, onMessage)\n}\n\n<span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">onMessage</span> (<span class=\"hljs-params\">{ msgId, cmd, args }</span>) </span>{\n  <span class=\"hljs-keyword\">let</span> method = METHODS[cmd]\n  <span class=\"hljs-keyword\">if</span> (!method) method = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Invalid method: '</span> + cmd)\n  <span class=\"hljs-keyword\">try</span> {\n    <span class=\"hljs-keyword\">const</span> resolve = <span class=\"hljs-keyword\">await</span> method(...args)\n    process.send({ msgId, resolve })\n  } <span class=\"hljs-keyword\">catch</span> (err) {\n    <span class=\"hljs-keyword\">const</span> reject = {\n      <span class=\"hljs-attr\">message</span>: err.message,\n      <span class=\"hljs-attr\">stack</span>: err.stack,\n      <span class=\"hljs-attr\">name</span>: err.name\n    }\n    process.send({ msgId, reject })\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> METHODS = {\n  isReady () {\n    <span class=\"hljs-comment\">// do any setup needed</span>\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-comment\">// define your RPC-able methods here</span>\n}\n</code></pre>\n<p>Luego, en su suite de pruebas puede usar sus test-driver del siguiente modo:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> test = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'ava'</span>)\n<span class=\"hljs-keyword\">const</span> electronPath = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> app = <span class=\"hljs-keyword\">new</span> TestDriver({\n  <span class=\"hljs-attr\">path</span>: electronPath,\n  <span class=\"hljs-attr\">args</span>: [<span class=\"hljs-string\">'./app'</span>],\n  <span class=\"hljs-attr\">env</span>: {\n    <span class=\"hljs-attr\">NODE_ENV</span>: <span class=\"hljs-string\">'test'</span>\n  }\n})\ntest.before(<span class=\"hljs-keyword\">async</span> t => {\n  <span class=\"hljs-keyword\">await</span> app.isReady\n})\ntest.after.always(<span class=\"hljs-string\">'cleanup'</span>, <span class=\"hljs-keyword\">async</span> t => {\n  <span class=\"hljs-keyword\">await</span> app.stop()\n})\n</code></pre>",
      "title": "Automatizado con un controlador personalizado de prueba",
      "description": ""
    },
    "/docs/development/azure-vm-setup": {
      "locale": "es-ES",
      "slug": "azure-vm-setup",
      "href": "/docs/development/azure-vm-setup",
      "crowdinFileId": "256129",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/azure-vm-setup.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"actualizar-una-imagen-azure-appveyor\"><a href=\"#actualizar-una-imagen-azure-appveyor\">Actualizar una imagen Azure Appveyor</a></h1>\n<p>Electron CI on Windows uses AppVeyor, which in turn uses Azure VM images to run.  Ocasionalmente, estas imagenes VM necesitan actualizarse debido a cambios en los requerimientos de Chormium.  Para actualizar usted necesitará <a href=\"https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6\">PowerShell</a> y el <a href=\"https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-1.8.0&#x26;viewFallbackFrom=azurermps-6.13.0\">Azure PowerShell module</a>.</p>\n<p>Ocasionalmente necesitaremos actualizar estas imágenes debido a cambios en Chromium u otros requisitos varios de construcción.</p>\n<p>Ejemplo Caso de uso:\n* Necesitamos <code>VS15.9</code> y tenemos instalada <code>VS15.7</code>; esto requeriría que actualicemos una imagen Azure.</p>\n<ol>\n<li>\n<p>Identifique la imagen que desea modificar.</p>\n<ul>\n<li>En <a href=\"https://github.com/electron/electron/blob/main/appveyor.yml\">appveyor.yml</a>, la imagen es identificada por la propiedad <em>image</em>.<ul>\n<li>Los nombres usados corresponden a las <em>\"images\"</em> definidas para una nube de construcción, ejemplo el <a href=\"https://windows-ci.electronjs.org/build-clouds/8\">libcc-20 cloud</a>.</li>\n</ul></li>\n<li>Encuentre la imagen que desea modificar en la nube de construcción y tenga en cuenta que la <strong>VHD Blob Path</strong> para la imagen, que es el valor para la correspondiente llave.<ul>\n<li>Usted necesitará esta ruta URI para copiar dentro de una nueva imagen.</li>\n</ul></li>\n<li>Usted además necesitará el nombre de la cuenta de almacenamiento el cual es etiquetado en AppVeyor como <strong>Disk Storage Account Name</strong></li>\n</ul>\n</li>\n<li>\n<p>Obtenga la clave de la cuenta de almacenamiento Azure</p>\n<ul>\n<li>Inicie sesión en Azure usando credenciales almacenadas en LastPass (bajo Azure Enterprise) y luego encuentre la cuenta de almacenamiento correspondiente al nombre encontrado en AppVeyor.<ul>\n<li>Ejemplo, para <code>appveyorlibccbuilds</code> <strong>Disk Storage Account Name</strong> you'd look for <code>appveyorlibccbuilds</code> in the list of storage accounts @ Home &#x3C; Storage Accounts<ul>\n<li>Haga clic en él y busque <code>Access Keys</code>, y luego puede utilizar cualquiera de las claves presentes en la lista.</li>\n</ul></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Obtenga la URI completa de imagen de maquina virtual de Azure</p>\n<ul>\n<li>Navigate to Home &#x3C; Storage Accounts &#x3C; <code>$ACCT_NAME</code> &#x3C; Blobs &#x3C; Images<ul>\n<li>EN la siguiente lista, mira el nombre de ruta VHD que obtuvo de Appveyor y luego pulsa en él.<ul>\n<li>Copiar toda la URL desde la parte superior de la ventana posterior.</li>\n</ul></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Copiar la imagen usando el <a href=\"https://github.com/appveyor/ci/blob/master/scripts/enterprise/copy-master-image-azure.ps1\">Copy Master Image PowerShell script</a>.</p>\n<ul>\n<li>Es esencial copiar la VM porque si mueve una VM contra una imagen esa imagen no puede ser usada al mismo tiempo or AppVeyor.</li>\n<li>Utilizar el nombre de la cuenta de almacenamiento, clave y URI obtenidos de Azure para ejecutar este script.<ul>\n<li>Mire el paso 3 para URI &#x26; cuando se le solicite, puls enter para usar la misma cuenta de almacenamiento como destino.</li>\n<li>Usar nombre de contenedor de destino predeterminado <code>(images)</code></li>\n<li>Además, al nombrar la copia, utilice un nombre que indique lo que contendrá la nueva imagen (si ha cambiado) y la fecha.<ul>\n<li>Ej. <code>libcc-20core-vs2017-15.9-2019-04-15.vhd</code></li>\n</ul></li>\n</ul></li>\n<li>Acceda a Azure y consigua la URI para la imagen recién creada como se describe en un paso anterior</li>\n</ul>\n</li>\n<li>\n<p>Haz una nueva VM usando el <a href=\"https://github.com/appveyor/ci/blob/master/scripts/enterprise/create_master_vm_from_vhd.ps1\">Crear VM Master de VHD PowerShell</a>.</p>\n<ul>\n<li>Desde PowerShell, ejecute el archivo <code>ps1</code> con <code>./create_master_vm_from_vhd.ps1</code></li>\n<li>Usted necesitarás la información de credencial disponible en la definición de nube de AppVeyor.<ul>\n<li>Esto incluye:<ul>\n<li>ID de Cliente</li>\n<li>Secreto del Cliente</li>\n<li>Tenant ID</li>\n<li>ID de la suscripción</li>\n<li>Grupo de Recursos</li>\n<li>Red virtual</li>\n</ul></li>\n</ul></li>\n<li>También necesitará especificar<ul>\n<li>Nombre de la VM principal - sólo un nombre único para identificar la VM temporal</li>\n<li>Tamaño de la VM principal - usar <code>Standard_F32s_v2</code></li>\n<li>VHD URI Principal - usar la URI obtenida de @ end del paso anterior</li>\n<li>Ubicación usar <code>East US</code></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Vuelva a iniciar sesión en Azure y encuentre la VM que recién ha sido creada en Home &#x3C; Virtual Machines &#x3C; <code>$YOUR_NEW_VM</code></p>\n<ul>\n<li>Puede descargar un archivo RDP (escritorio remoto) para acceder a la VM.</li>\n</ul>\n</li>\n<li>\n<p>Usando Microsoft Remote Desktop, haga clic en <code>Connect</code> para conectarse a la VM.</p>\n<ul>\n<li>Las credenciales para iniciar sesión en la VM se encuentran en LastPass bajo las credenciales <code>AppVeyor Enterprise master VM</code>.</li>\n</ul>\n</li>\n<li>\n<p>Modificar la VM como sea necesario.</p>\n</li>\n<li>\n<p>Apagar la VM y luego borrarla en Azure.</p>\n</li>\n<li>\n<p>Agreagar la nueva imagen a l configuracion de la nube Appveyor o modifique una imagen para apuntar al nuevo VHD.</p>\n</li>\n</ol>",
      "title": "Actualizar una imagen Azure Appveyor",
      "description": ""
    },
    "/docs/api/structures/bluetooth-device": {
      "locale": "es-ES",
      "slug": "bluetooth-device",
      "href": "/docs/api/structures/bluetooth-device",
      "crowdinFileId": "256411",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/bluetooth-device.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"bluetoothdevice-object\"><a href=\"#bluetoothdevice-object\">BluetoothDevice Object</a></h1>\n<ul>\n<li><code>deviceName</code> String</li>\n<li><code>deviceId</code> String</li>\n</ul>",
      "title": "BluetoothDevice Object",
      "description": ""
    },
    "/docs/tutorial/boilerplates-and-clis": {
      "locale": "es-ES",
      "slug": "boilerplates-and-clis",
      "href": "/docs/tutorial/boilerplates-and-clis",
      "crowdinFileId": "256181",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/boilerplates-and-clis.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"plantillas-y-clis\"><a href=\"#plantillas-y-clis\">Plantillas y CLIs</a></h1>\n<p>El desarrollo con Electron es libre de opiniones, y no hay una \"única manera\" de desarrollar, construir, empaquetar y desplegar una aplicación Electron. Características adicionales, tanto para la fase de build como para la ejecución, pueden encontrarse con frecuencia en <a href=\"https://www.npmjs.com/search?q=electron\">npm</a> en paquetes individuales, permitiendo a los desarrolladores construir tanto las aplicaciones como los pipelines que necesiten.</p>\n<p>Ese nivel de modularidad y extensibilidad asegura que todos los desarrolladores que trabajan con Electron, ambos equipos grandes y pequeños, nunca estén restringidos en que pueden o no puedan hacer en cualquier momento durante sus ciclos de vida del desarrollo. Sin embargo, para muchos desarrolladores, uno de los boilerplates comunitarios o herramientas de línea de comandos podría facilitar dramáticamente el compilar, empacar y liberar una aplicación.</p>\n<h2 id=\"plantillas-vs-cli\"><a href=\"#plantillas-vs-cli\">Plantillas vs CLI</a></h2>\n<p>Un boilerplate es sólo un punto de partida -un lienzo en blanco, por así decirlo- a partir del cual construir su aplicación. Generalmente vienen en la forma de un repositorio, que se puede clonar y personalizar a gusto.</p>\n<p>Por otro, lado una herramienta de línea de comandos sigue para apoyarle a lo largo del desarrollo y la liberación. Son mas útiles y serviciales pero encarga lineas directrices en cómo su código debe ser estructurado y construido. <em>Especialmente para principiantes, el uso de una herramienta de linea de comando es probable que sea útil</em>.</p>\n<h2 id=\"electron-forge\"><a href=\"#electron-forge\">electron-forge</a></h2>\n<p>Una \"herramienta completa para las construcción de aplicaciones Electron modernas\". Electron Forge unifica las herramientas de construcción existentes (y bien mantenidas) para el desarrollo de Electron en un paquete cohesivo de manera que cualquiera pueda saltar directamente al desarrollo en Electron.</p>\n<p>Forge viene con <a href=\"https://electronforge.io/templates\">a ready-to-use template</a> usando Webpack como empaquetador. Incluye una configuración de tipo typescript y proporciona dos archivos de configuración para permitir una personalización fácil. Utiliza los mismos módulos de núcleo usados por la gran mayoría en la comunidad Electron (como <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>) -los cambios hechos por los mantenedores a cargo de Electron (como Slack), benefician también a los usuarios de Forge.</p>\n<p>Puede encontrar información y documentación en <a href=\"https://electronforge.io/\">electronforge.io</a>.</p>\n<h2 id=\"electron-builder\"><a href=\"#electron-builder\">Electron-builder</a></h2>\n<p>Una \" solución completa para empaquetar y construir una aplicación Electron lista para su distribución\" que se centra en una experiencia integrada. <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> añade una única dependencia enfocada en la simplicidad y gestiona todos los requisitos internamente.</p>\n<p><code>electron-builder</code> reemplaza las características y módulos usados por los mantenedores a cargo de Electron (tales como el auto-actualizador) con los personalizados. Generalmente son bien integrados pero tendrán menos en común con las aplicaciones Electron populares como Atom, Visual Studio Code, o Slack.</p>\n<p>Puede encontrar mas información y documentación en <a href=\"https://github.com/electron-userland/electron-builder\">el repositorio</a>.</p>\n<h2 id=\"electron-react-boilerplate\"><a href=\"#electron-react-boilerplate\">electron-react-boilerplate</a></h2>\n<p>Si no quiere herramientas, sólo un boilerplate sólido desde el que construir, puede que merezca la pena darle un vistazo a CT Lin's <a href=\"https://github.com/chentsulin/electron-react-boilerplate\"><code>electron-react-boilerplate</code></a>. Es muy popular en la comunidad y utiliza <code>electron-builder</code> internamente.</p>\n<h2 id=\"otras-herramientas-y-boilerplates\"><a href=\"#otras-herramientas-y-boilerplates\">Otras Herramientas y Boilerplates</a></h2>\n<p>La <a href=\"https://github.com/sindresorhus/awesome-electron#boilerplates\">lista \"Electron impresionante\"</a> contiene más herramientas y boilerplates para escoger. Si encuentra la extensión de la lista algo intimidante, no olvide que añadir herramientas mientras avanza, también es un enfoque valido.</p>",
      "title": "Plantillas y CLIs",
      "description": ""
    },
    "/docs/breaking-changes": {
      "locale": "es-ES",
      "slug": "breaking-changes",
      "href": "/docs/breaking-changes",
      "crowdinFileId": "256117",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/breaking-changes.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"restaurar-archivos-borrados\"><a href=\"#restaurar-archivos-borrados\">Restaurar archivos borrados</a></h1>\n<p>Los cambios de ruptura se documentaran aquí y se agregaran advertencias de desaprobación al código JS cuando sea posible, al menos <a href=\"/docs/tutorial/electron-versioning#semver\">una versión superior</a> se publicará, antes de que se realice cualquier cambio.</p>\n<h3 id=\"tipos-de-cambios-de-ruptura\"><a href=\"#tipos-de-cambios-de-ruptura\">Tipos de cambios de ruptura</a></h3>\n<p>Este documento usa la siguiente convención para clasificar los cambios de ruptura:</p>\n<ul>\n<li><strong>API Modificada:</strong> Se cambió una API de tal manera que se garantiza que el código que no ha sido actualizado produzca una excepción.</li>\n<li><strong>Comportamiento Modificado: </strong> El comportamiento de Electron ha cambiado, pero no de tal manera que una excepción se produzca necesariamente.</li>\n<li><strong>Valor por defecto Modificado:</strong> Código dependiente del viejo valor por defecto puede romperse, no necesariamente lanzando una excepción. El comportamiento antiguo puede ser restaurado especificando explícitamente el valor.</li>\n<li><strong>Obsoleto:</strong> Una API fue marcada como obsoleta. La API continuará funcionando, pero emitirá una advertencia de desaprobación y será eliminada en una futura versión.</li>\n<li><strong>Eliminado:</strong> Una API o característica fue eliminada y ya no es compatible por Electron.</li>\n</ul>\n<h2 id=\"cambios-planeados-en-la-api140\"><a href=\"#cambios-planeados-en-la-api140\">Cambios planeados en la API(14.0)</a></h2>\n<h3 id=\"removed-remote-module\"><a href=\"#removed-remote-module\">Removed: <code>remote</code> module</a></h3>\n<p>The <code>remote</code> module was deprecated in Electron 12, and will be removed in Electron 14. Es reemplazado por el módulo <a href=\"https://github.com/electron/remote\"><code>@electron/remote</code></a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto en Electron 12:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Reemplazar con:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote'</span>)\n\n<span class=\"hljs-comment\">// En el proceso principal:</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote/main'</span>).initialize()\n</code></pre>\n<h3 id=\"eliminada-appallowrendererprocessreuse\"><a href=\"#eliminada-appallowrendererprocessreuse\">Eliminada: <code>app.allowRendererProcessReuse</code></a></h3>\n<p>The <code>app.allowRendererProcessReuse</code> property will be removed as part of our plan to more closely align with Chromium's process model for security, performance and maintainability.</p>\n<p>Para información más detallada vea <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"eliminado-browser-window-affinity\"><a href=\"#eliminado-browser-window-affinity\">Eliminado: Browser Window Affinity</a></h3>\n<p>La opción <code>affinity</code> al construir una nueva <code>BrowserWindow</code> se eliminará como parte de nuestro plan para alinear más estrechamente con el modelo de proceso de Chromium por seguridad, rendimiento y mantenimiento.</p>\n<p>Para información más detallada vea <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"api-modificada-windowopen\"><a href=\"#api-modificada-windowopen\">API modificada: <code>window.open()</code></a></h3>\n<p>El parámetro opcional <code>frameName</code> ya no se establecerá como el título de la ventana. Esto ahora sigue la especificación descrita por la <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters\">documentación nativa</a> bajo el correspondiente parámetro <code>windowName</code>.</p>\n<p>Si estaba usando este parámetro para establecer el título de una ventana, puede usar <a href=\"/docs/api/browser-window#winsettitletitle\">win.setTitle(title)</a> en su lugar.</p>\n<h3 id=\"eliminado-worldsafeexecutejavascript\"><a href=\"#eliminado-worldsafeexecutejavascript\">Eliminado: <code>worldSafeExecuteJavaScript</code></a></h3>\n<p>En Electron 14 <code>worldSafeExecuteJavaScript</code> será eliminado.  No hay alternativa, por favor asegúrese que su código trabaja con esta propiedad activada.  Ha sido activada por defecto desde Electron\n12.</p>\n<p>Será afectado por este cambio si usted utliza <code>webFrame.executeJavaScript</code> o <code>webFrame.executeJavaScriptInIsolatedWorld</code>. Necesitará asegurase que los valores devueltos por cualquiera de esos métodos son soportados por <a href=\"/docs/api/context-bridge#parameter--error--return-type-support\">Context Bridge API</a> ya que estos métodos utilizan la misma semántica de paso de valores.</p>\n<h3 id=\"valor-por-defecto-modificado-nativewindowopen-por-defecto-a-true\"><a href=\"#valor-por-defecto-modificado-nativewindowopen-por-defecto-a-true\">Valor por defecto modificado: <code>nativeWindowOpen</code> por defecto a <code>true</code></a></h3>\n<p>Prior to Electron 14, <code>window.open</code> was by default shimmed to use <code>BrowserWindowProxy</code>. This meant that <code>window.open('about:blank')</code> did not work to open synchronously scriptable child windows, among other incompatibilities. <code>nativeWindowOpen</code> is no longer experimental, and is now the default.</p>\n<p>See the documentation for <a href=\"/docs/api/window-open\">window.open in Electron</a> for more details.</p>\n<h3 id=\"removed-browserwindowconstructoroptions-inheriting-from-parent-windows\"><a href=\"#removed-browserwindowconstructoroptions-inheriting-from-parent-windows\">Removed: BrowserWindowConstructorOptions inheriting from parent windows</a></h3>\n<p>Prior to Electron 14, windows opened with <code>window.open</code> would inherit BrowserWindow constructor options such as <code>transparent</code> and <code>resizable</code> from their parent window. Beginning with Electron 14, this behavior is removed, and windows will not inherit any BrowserWindow constructor options from their parents.</p>\n<p>Instead, explicitly set options for the new window with <code>setWindowOpenHandler</code>:</p>\n<pre><code class=\"hljs language-js\">webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n  <span class=\"hljs-keyword\">return</span> {\n    <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span>,\n    <span class=\"hljs-attr\">overrideBrowserWindowOptions</span>: {\n      <span class=\"hljs-comment\">// ...</span>\n    }\n  }\n})\n</code></pre>\n<h3 id=\"eliminada-additionalfeatures\"><a href=\"#eliminada-additionalfeatures\">Eliminada: <code>additionalFeatures</code></a></h3>\n<p>The deprecated <code>additionalFeatures</code> property in the <code>new-window</code> and <code>did-create-window</code> events of WebContents has been removed. Since <code>new-window</code> uses positional arguments, the argument is still present, but will always be the empty array <code>[]</code>. (Though note, the <code>new-window</code> event itself is deprecated, and is replaced by <code>setWindowOpenHandler</code>.) Bare keys in window features will now present as keys with the value <code>true</code> in the options object.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 14</span>\n<span class=\"hljs-comment\">// Triggered by window.open('...', '', 'my-key')</span>\nwebContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (<span class=\"hljs-built_in\">window</span>, details) => {\n  <span class=\"hljs-keyword\">if</span> (details.additionalFeatures.includes(<span class=\"hljs-string\">'my-key'</span>)) {\n    <span class=\"hljs-comment\">// ...</span>\n  }\n})\n\n<span class=\"hljs-comment\">// Replace with</span>\nwebContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (<span class=\"hljs-built_in\">window</span>, details) => {\n  <span class=\"hljs-keyword\">if</span> (details.options[<span class=\"hljs-string\">'my-key'</span>]) {\n    <span class=\"hljs-comment\">// ...</span>\n  }\n})\n</code></pre>\n<h2 id=\"cambios-planeados-en-la-api130\"><a href=\"#cambios-planeados-en-la-api130\">Cambios planeados en la API(13.0)</a></h2>\n<h3 id=\"api-modificada-sessionsetpermissioncheckhandlerhandler\"><a href=\"#api-modificada-sessionsetpermissioncheckhandlerhandler\">API modificada: <code>session.setPermissionCheckHandler(handler)</code></a></h3>\n<p>El primer parámetro de los métodos <code>handler</code> anteriormente siempre era un <code>webContents</code>, ahora puede ser a veces <code>null</code>.  Debe usar las propiedades <code>requestingOrigin</code>, <code>embeddingOrigin</code> y <code>securityOrigin</code> para responder correctamente a la verificación de permiso.  Como el <code>webContents</code> puede ser <code>null</code> ya no se puede confiar en él.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Old code</span>\nsession.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (webContents.getURL().startsWith(<span class=\"hljs-string\">'https://google.com/'</span>) &#x26;&#x26; permission === <span class=\"hljs-string\">'notification'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n\n<span class=\"hljs-comment\">// Replace with</span>\nsession.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(requestingOrigin).hostname === <span class=\"hljs-string\">'google.com'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notification'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n</code></pre>\n<h3 id=\"eliminado-shellmoveitemtotrash\"><a href=\"#eliminado-shellmoveitemtotrash\">Eliminado: <code>shell.moveItemToTrash()</code></a></h3>\n<p>Se ha eliminado la API síncrona <code>shell.moveItemToTrash()</code> obsoleta. Utilice en su lugar <code>shell.trashItem()</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 13</span>\nshell.moveItemToTrash(path)\n<span class=\"hljs-comment\">// Replace with</span>\nshell.trashItem(path).then(<span class=\"hljs-comment\">/* ... */</span>)\n</code></pre>\n<h3 id=\"eliminado-apis-de-extensión-browserwindow\"><a href=\"#eliminado-apis-de-extensión-browserwindow\">Eliminado: APIs de extensión <code>BrowserWindow</code></a></h3>\n<p>La APIs de extensión han sido eliminadas:</p>\n<ul>\n<li><code>BrowserWindow.addExtension(path)</code></li>\n<li><code>BrowserWindow.addDevToolsExtension(path)</code></li>\n<li><code>BrowserWindow.removeExtension(name)</code></li>\n<li><code>BrowserWindow.removeDevToolsExtension(name)</code></li>\n<li><code>BrowserWindow.getExtensions()</code></li>\n<li><code>BrowserWindow.getDevToolsExtensions()</code></li>\n</ul>\n<p>En su lugar use las APIs de session:</p>\n<ul>\n<li><code>ses.loadExtension(path)</code></li>\n<li><code>ses.removeExtension(extension_id)</code></li>\n<li><code>ses.getAllExtensions()</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 13</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 13</span>\nBrowserWindow.removeExtension(name)\nBrowserWindow.removeDevToolsExtension(name)\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.removeExtension(extension_id)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 13</span>\nBrowserWindow.getExtensions()\nBrowserWindow.getDevToolsExtensions()\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.getAllExtensions()\n</code></pre>\n<h3 id=\"eliminado-métodos-en-systempreferences\"><a href=\"#eliminado-métodos-en-systempreferences\">Eliminado: métodos en <code>systemPreferences</code></a></h3>\n<p>Los métodos siguientes de <code>systemPreferences</code> han quedado obsoletos:</p>\n<ul>\n<li><code>systemPreferences.isDarkMode()</code></li>\n<li><code>systemPreferences.isInvertedColorScheme()</code></li>\n<li><code>systemPreferences.isHighContrastColorScheme()</code></li>\n</ul>\n<p>En su lugar, usa las siguientes propiedades <code>nativeTheme</code>:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code></li>\n<li><code>nativeTheme.shouldUseInvertedColorScheme</code></li>\n<li><code>nativeTheme.shouldUseHighContrastColors</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 13</span>\nsystemPreferences.isDarkMode()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseDarkColors\n\n<span class=\"hljs-comment\">// Removed in Electron 13</span>\nsystemPreferences.isInvertedColorScheme()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseInvertedColorScheme\n\n<span class=\"hljs-comment\">// Removed in Electron 13</span>\nsystemPreferences.isHighContrastColorScheme()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseHighContrastColors\n</code></pre>\n<h3 id=\"en-desuso-evento-webcontens-nueva-ventana\"><a href=\"#en-desuso-evento-webcontens-nueva-ventana\">En desuso: evento Webcontens <code>nueva ventana</code></a></h3>\n<p>El evento <code>new-window</code> de WebContents está obsoleto. Es reemplazado por <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler()</code></a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto en Electron 13</span>\nwebContents.on(<span class=\"hljs-string\">'new-window'</span>, (event) => {\n  event.preventDefault()\n})\n\n<span class=\"hljs-comment\">// Reemplazar por</span>\nwebContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n</code></pre>\n<h2 id=\"cambios-planeados-en-la-api120\"><a href=\"#cambios-planeados-en-la-api120\">Cambios planeados en la API(12.0)</a></h2>\n<h3 id=\"eliminado-soporte-de-pepper-flash\"><a href=\"#eliminado-soporte-de-pepper-flash\">Eliminado: Soporte de Pepper Flash</a></h3>\n<p>Chromium a eliminado el soporte para Flash, por lo tanto nosotros debemos seguir el ejemplo. Vea el <a href=\"https://www.chromium.org/flash-roadmap\">Flash Roadmap</a> de Chromium para más detalles.</p>\n<h3 id=\"valor-por-defecto-moidificado-worldsafeexecutejavascript-por-defecto-a-true\"><a href=\"#valor-por-defecto-moidificado-worldsafeexecutejavascript-por-defecto-a-true\">Valor por defecto moidificado: <code>worldSafeExecuteJavaScript</code> por defecto a <code>true</code></a></h3>\n<p>En Electron 12, <code>worldSafeExecuteJavaScript</code> será activado por defecto.  Para restuaurar el comportamiento anterior, <code>worldSafeExecuteJavaScript: false</code> debe especificarse en WebPreferences. Por favor tenga en cuenta que estableciendo esta opción a <code>false</code> es <strong>inseguro</strong>.</p>\n<p>Esta opción sera removida en Electron 14, así que por favor migra tu código para soportar el valor por defecto.</p>\n<h3 id=\"valor-por-defecto-modificado-contextisolation-por-defecto-a-true\"><a href=\"#valor-por-defecto-modificado-contextisolation-por-defecto-a-true\">Valor por defecto modificado: <code>contextIsolation</code> por defecto a <code>true</code></a></h3>\n<p>En Electron 12, <code>contextIsolation</code> será activado por defecto.  Para restaurar el comportamiento anterior <code>contextIsolation: false</code> debe ser especificado en WebPreferences.</p>\n<p>Nosotros <a href=\"/docs/tutorial/security#3-enable-context-isolation-for-remote-content\">recomendamos tener contextIsolation activado</a> por la seguridad de su aplicación.</p>\n<p>Otra implicación es que <code>require()</code> no puede ser usada en el renderer process a menos que <code>nodeIntegration</code> sea <code>true</code> y <code>contextIsolation</code> sea <code>false</code>.</p>\n<p>Para más detalles ver: <a href=\"https://github.com/electron/electron/issues/23506\">https://github.com/electron/electron/issues/23506</a></p>\n<h3 id=\"eliminado-crashreportergetcrashesdirectory\"><a href=\"#eliminado-crashreportergetcrashesdirectory\">Eliminado: <code>crashReporter.getCrashesDirectory()</code></a></h3>\n<p>El método <code>crashReporter.getCrashesDirectory</code> ha sido eliminado. Uso debe ser reemplazado por <code>app.getPath('crashDumps')</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Eliminado en Electron 12</span>\ncrashReporter.getCrashesDirectory()\n<span class=\"hljs-comment\">// Reeamplazar con</span>\napp.getPath(<span class=\"hljs-string\">'crashDumps'</span>)\n</code></pre>\n<h3 id=\"eliminado-métodos-crashreporter-en-el-render-process\"><a href=\"#eliminado-métodos-crashreporter-en-el-render-process\">Eliminado: métodos <code>crashReporter</code> en el render process</a></h3>\n<p>Los siguientes métodos <code>crashReporter</code> ya no están disponible en el renderer process:</p>\n<ul>\n<li><code>crashReporter.start</code></li>\n<li><code>crashReporter.getLastCrashReport</code></li>\n<li><code>crashReporter.getUploadedReports</code></li>\n<li><code>crashReporter.getUploadToServer</code></li>\n<li><code>crashReporter.setUploadToServer</code></li>\n<li><code>crashReporter.getCrashesDirectory</code></li>\n</ul>\n<p>Deberían ser llamados solo desde el proceso principal.</p>\n<p>Vea <a href=\"https://github.com/electron/electron/pull/23265\">#23265</a> para más detalles.</p>\n<h3 id=\"valor-por-defecto-modificado-crashreporterstart-compress-true-\"><a href=\"#valor-por-defecto-modificado-crashreporterstart-compress-true-\">Valor por defecto modificado: <code>crashReporter.start({ compress: true })</code></a></h3>\n<p>El valor por defecto de la opción <code>compress</code> a <code>crashReporter.start</code> ha cambiado de <code>false</code> a <code>true</code>. Esto significa que los volcados se subirán al servidor de ingestión de errores con el encabezado <code>Content-Encoding: gzip</code> y el cuerpo será comprimido.</p>\n<p>Si su servidor de gestión de fallos no soporta cargas comprimidas, puedes desactivar la compresión especificando <code>{ compress: false }</code> en las opciones del reportero de errores .</p>\n<h3 id=\"obsoleto-módulo-remote\"><a href=\"#obsoleto-módulo-remote\">Obsoleto: módulo <code>remote</code></a></h3>\n<p>El módulo <code>remote</code> está obsoleto en Electron 12 y sera eliminado en Electron 14. Es reemplazado por el módulo <a href=\"https://github.com/electron/remote\"><code>@electron/remote</code></a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto en Electron 12:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Reemplazar con:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote'</span>)\n\n<span class=\"hljs-comment\">// En el proceso principal:</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote/main'</span>).initialize()\n</code></pre>\n<h3 id=\"obsoleto-shellmoveitemtotrash\"><a href=\"#obsoleto-shellmoveitemtotrash\">Obsoleto: <code>shell.moveItemToTrash()</code></a></h3>\n<p>El síncrono <code>shell.moveItemToTrash()</code> ha sido reemplazado por el nuevo asíncrono <code>shell.trashItem()</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 12</span>\nshell.moveItemToTrash(path)\n<span class=\"hljs-comment\">// Replace with</span>\nshell.trashItem(path).then(<span class=\"hljs-comment\">/* ... */</span>)\n</code></pre>\n<h2 id=\"cambios-planeados-en-la-api110\"><a href=\"#cambios-planeados-en-la-api110\">Cambios planeados en la API(11.0)</a></h2>\n<h3 id=\"eliminado-browserviewdestroy-fromid-fromwebcontents-getallviews-y-id-propiedad-de-browserview\"><a href=\"#eliminado-browserviewdestroy-fromid-fromwebcontents-getallviews-y-id-propiedad-de-browserview\">Eliminado: <code>BrowserView.{destroy, fromId, fromWebContents, getAllViews}</code> y <code>id</code> propiedad de <code>BrowserView</code></a></h3>\n<p>Las APIs experimentales <code>BrowserView.{destroy, fromId, fromWebContents, getAllViews}</code> fueron removidas. Adicionalmente, la propiedad <code>id</code> de <code>BrowserView</code> también ha sido removida.</p>\n<p>Para ver más información, consulta <a href=\"https://github.com/electron/electron/pull/23578\">#23578</a>.</p>\n<h2 id=\"cambios-planeados-en-la-api100\"><a href=\"#cambios-planeados-en-la-api100\">Cambios planeados en la API(10.0)</a></h2>\n<h3 id=\"desaprobado-argumento-companyname-para-crashreporterstart\"><a href=\"#desaprobado-argumento-companyname-para-crashreporterstart\">Desaprobado: argumento <code>companyName</code> para <code>crashReporter.start()</code></a></h3>\n<p>El argumento <code>companyName</code> para <code>crashReporter.start()</code>, que era previamente requerido, ahora es opcional, y aún más, está desaprobado. Para obtener el mismo comportamiento de una forma no desaprobada, pude pasar un valor <code>companyName</code> en <code>globalExtra</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Desaprobado en Electron 10</span>\ncrashReporter.start({ <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Umbrella Corporation'</span> })\n<span class=\"hljs-comment\">// Reemplazar con </span>\ncrashReporter.start({ <span class=\"hljs-attr\">globalExtra</span>: { <span class=\"hljs-attr\">_companyName</span>: <span class=\"hljs-string\">'Umbrella Corporation'</span> } })\n</code></pre>\n<h3 id=\"obsoleto-crashreportergetcrashesdirectory\"><a href=\"#obsoleto-crashreportergetcrashesdirectory\">Obsoleto: <code>crashReporter.getCrashesDirectory()</code></a></h3>\n<p>El método <code>crashReporter.getCrashesDirectory</code> ha sido desaprobado. Uso debe ser reemplazado por <code>app.getPath('crashDumps')</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto en Electron 10</span>\ncrashReporter.getCrashesDirectory()\n<span class=\"hljs-comment\">// Reemplazar con</span>\napp.getPath(<span class=\"hljs-string\">'crashDumps'</span>)\n</code></pre>\n<h3 id=\"obsoleto-los-métodos-crashreporter-en-el-renderer-process\"><a href=\"#obsoleto-los-métodos-crashreporter-en-el-renderer-process\">Obsoleto: los métodos <code>crashReporter</code> en el renderer process</a></h3>\n<p>Llamar a los siguientes métodos <code>crashReporter</code> desde el renderer process es obsoleto:</p>\n<ul>\n<li><code>crashReporter.start</code></li>\n<li><code>crashReporter.getLastCrashReport</code></li>\n<li><code>crashReporter.getUploadedReports</code></li>\n<li><code>crashReporter.getUploadToServer</code></li>\n<li><code>crashReporter.setUploadToServer</code></li>\n<li><code>crashReporter.getCrashesDirectory</code></li>\n</ul>\n<p>Los únicos métodos no desaprobados restantes en el modulo <code>crashReporter</code> en el render son <code>addExtraParameter</code>, <code>removeExtraParameter</code> y <code>getParameters</code>.</p>\n<p>Todos los métodos anteriores permanecen no desaprobados cuando son llamados desde el proceso principal.</p>\n<p>Vea <a href=\"https://github.com/electron/electron/pull/23265\">#23265</a> para más detalles.</p>\n<h3 id=\"obsoleto-crashreporterstart-compress-false-\"><a href=\"#obsoleto-crashreporterstart-compress-false-\">Obsoleto: <code>crashReporter.start({ compress: false })</code></a></h3>\n<p>Establecer <code>{ compress: false }</code> en <code>crashReporter.start</code> está obsoleto. Casi todos los servidores de gestión de fallos soportan compresión gzip. Esta opción será eliminada en una versión futura de Electron.</p>\n<h3 id=\"valor-por-defecto-modificado-enableremotemodule-por-defecto-a-false\"><a href=\"#valor-por-defecto-modificado-enableremotemodule-por-defecto-a-false\">Valor por defecto modificado: <code>enableRemoteModule</code> por defecto a <code>false</code></a></h3>\n<p>En Electron 9, usar el módulo remoto sin habilitarlo explícitamente a través de la opción <code>enableRemoteModule</code> WebPreferences comenzó a emitir una advertencia. En Electron 10, el módulo remote está deshabilitado por defecto. Para usar el módulo remote debe especificarse <code>enableRemoteModule: true</code> en WebPreferences:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> w = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">enableRemoteModule</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<p>Nosotros <a href=\"https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31\">recomendamos alejarse del módulo remote</a>.</p>\n<h3 id=\"protocolunregisterprotocol\"><a href=\"#protocolunregisterprotocol\"><code>protocol.unregisterProtocol</code></a></h3>\n<h3 id=\"protocoluninterceptprotocol\"><a href=\"#protocoluninterceptprotocol\"><code>protocol.uninterceptProtocol</code></a></h3>\n<p>Las APIs ahora son síncronas y el callback opcional ya no es necesario.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Obsoleto</span>\nprotocol.unregisterProtocol(scheme, () => { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Reemplazar con </span>\nprotocol.unregisterProtocol(scheme)\n</code></pre>\n<h3 id=\"protocolregisterfileprotocol\"><a href=\"#protocolregisterfileprotocol\"><code>protocol.registerFileProtocol</code></a></h3>\n<h3 id=\"protocolregisterbufferprotocol\"><a href=\"#protocolregisterbufferprotocol\"><code>protocol.registerBufferProtocol</code></a></h3>\n<h3 id=\"protocolregisterstringprotocol\"><a href=\"#protocolregisterstringprotocol\"><code>protocol.registerStringProtocol</code></a></h3>\n<h3 id=\"protocolregisterhttpprotocol\"><a href=\"#protocolregisterhttpprotocol\"><code>protocol.registerHttpProtocol</code></a></h3>\n<h3 id=\"protocolregisterstreamprotocol\"><a href=\"#protocolregisterstreamprotocol\"><code>protocol.registerStreamProtocol</code></a></h3>\n<h3 id=\"protocolinterceptfileprotocol\"><a href=\"#protocolinterceptfileprotocol\"><code>protocol.interceptFileProtocol</code></a></h3>\n<h3 id=\"protocolinterceptstringprotocol\"><a href=\"#protocolinterceptstringprotocol\"><code>protocol.interceptStringProtocol</code></a></h3>\n<h3 id=\"protocolinterceptbufferprotocol\"><a href=\"#protocolinterceptbufferprotocol\"><code>protocol.interceptBufferProtocol</code></a></h3>\n<h3 id=\"protocolintercepthttpprotocol\"><a href=\"#protocolintercepthttpprotocol\"><code>protocol.interceptHttpProtocol</code></a></h3>\n<h3 id=\"protocolinterceptstreamprotocol\"><a href=\"#protocolinterceptstreamprotocol\"><code>protocol.interceptStreamProtocol</code></a></h3>\n<p>Las APIs ahora son síncronas y el callback opcional ya no es necesario.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Obsoleto</span>\nprotocol.registerFileProtocol(scheme, handler, () => { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Reemplazar con </span>\nprotocol.registerFileProtocol(scheme, handler)\n</code></pre>\n<p>El protocolo registrado o interceptado no tiene efecto en la página actual hasta que ocurra la navegación.</p>\n<h3 id=\"protocolisprotocolhandled\"><a href=\"#protocolisprotocolhandled\"><code>protocol.isProtocolHandled</code></a></h3>\n<p>Esta API está obsoleta y los usuarios deberían usar <code>protocol.isProtocolRegistered</code> y <code>protocol.isProtocolIntercepted</code> en su lugar.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Obsoleto</span>\nprotocol.isProtocolHandled(scheme).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Reemplazar con</span>\n<span class=\"hljs-keyword\">const</span> isRegistered = protocol.isProtocolRegistered(scheme)\n<span class=\"hljs-keyword\">const</span> isIntercepted = protocol.isProtocolIntercepted(scheme)\n</code></pre>\n<h2 id=\"cambios-planeados-en-la-api90\"><a href=\"#cambios-planeados-en-la-api90\">Cambios planeados en la API(9.0)</a></h2>\n<h3 id=\"valor-por-defecto-modificado-la-carga-de-módulos-nativos-sin-contexto-conscientes-en-el-proceso-renderer-está-desactivada-por-defecto\"><a href=\"#valor-por-defecto-modificado-la-carga-de-módulos-nativos-sin-contexto-conscientes-en-el-proceso-renderer-está-desactivada-por-defecto\">Valor por defecto modificado: La carga de módulos nativos sin contexto conscientes en el proceso renderer está desactivada por defecto</a></h3>\n<p>A partir de Electron 9 no permitimos la carga de módulos nativos no conscientes del contexto en el proceso de renderizado.  Esto es para mejorar la seguridad, el rendimiento y el mantenimiento de Electron como proyecto.</p>\n<p>Si esto te impacta, puedes configurar de forma temporal <code>app.allowRendererProcessReuse</code> a <code>false</code> para revertir el comportamiento antiguo.  Esta marca solo será una opción hasta Electron 11 y deberías planear actualizar tus módulos nativos para que sean conscientes del contexto.</p>\n<p>Para información más detallada vea <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"obsoleto-apis-de-extensión-browserwindow\"><a href=\"#obsoleto-apis-de-extensión-browserwindow\">Obsoleto: APIs de extensión <code>BrowserWindow</code></a></h3>\n<p>Las siguientes APIs de extensión han sido marcadas como obsoletas:</p>\n<ul>\n<li><code>BrowserWindow.addExtension(path)</code></li>\n<li><code>BrowserWindow.addDevToolsExtension(path)</code></li>\n<li><code>BrowserWindow.removeExtension(name)</code></li>\n<li><code>BrowserWindow.removeDevToolsExtension(name)</code></li>\n<li><code>BrowserWindow.getExtensions()</code></li>\n<li><code>BrowserWindow.getDevToolsExtensions()</code></li>\n</ul>\n<p>En su lugar use las APIs de session:</p>\n<ul>\n<li><code>ses.loadExtension(path)</code></li>\n<li><code>ses.removeExtension(extension_id)</code></li>\n<li><code>ses.getAllExtensions()</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto en Electron 9</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// Reemplazar con</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto en Electron 9</span>\nBrowserWindow.removeExtension(name)\nBrowserWindow.removeDevToolsExtension(name)\n<span class=\"hljs-comment\">// Reemplazar con</span>\nsession.defaultSession.removeExtension(extension_id)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto en Electron 9</span>\nBrowserWindow.getExtensions()\nBrowserWindow.getDevToolsExtensions()\n<span class=\"hljs-comment\">// Reemplazar con</span>\nsession.defaultSession.getAllExtensions()\n</code></pre>\n<h3 id=\"eliminado-webviewgetwebcontents\"><a href=\"#eliminado-webviewgetwebcontents\">Eliminado: <code>&#x3C;webview>.getWebContents()</code></a></h3>\n<p>Esta API la cual fue marcada como obsoleta en Electron 8.0, ahora es eliminada.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Eliminado en Electron 9.0</span>\nwebview.getWebContents()\n<span class=\"hljs-comment\">// Reemplazar con </span>\n<span class=\"hljs-keyword\">const</span> { remote } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nremote.webContents.fromId(webview.getWebContentsId())\n</code></pre>\n<h3 id=\"eliminada-webframesetlayoutzoomlevellimits\"><a href=\"#eliminada-webframesetlayoutzoomlevellimits\">Eliminada: <code>webFrame.setLayoutZoomLevelLimits()</code></a></h3>\n<p>Chromium ha eliminado el soporte para cambiar los limites del nivel de zoom del diseño y esta más allá de la capacidad de Electron el mantenerlo. La función fue marcada como obsoleta en Electron 8.x, y ha sido eliminada en Electron 9.x. Los niveles de zoom limites ahora están fijados a un mínimo de 0.25 y un máximo de 5.0, como se define <a href=\"https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11\">aquí</a>.</p>\n<h3 id=\"comportamiento-modificado-enviando-objetos-no-js-sobre-ipc-ahora-lanza-una-excepción\"><a href=\"#comportamiento-modificado-enviando-objetos-no-js-sobre-ipc-ahora-lanza-una-excepción\">Comportamiento Modificado: Enviando objetos no JS sobre IPC ahora lanza una excepción</a></h3>\n<p>En Electron 8.0, el IPC se cambió para que utilizara el algoritmo de clon estructurado, con importantes mejoras de rendimiento. To help ease the transition, the old IPC serialization algorithm was kept and used for some objects that aren't serializable with Structured Clone. In particular, DOM objects (e.g. <code>Element</code>, <code>Location</code> and <code>DOMMatrix</code>), Node.js objects backed by C++ classes (e.g. <code>process.env</code>, some members of <code>Stream</code>), and Electron objects backed by C++ classes (e.g. <code>WebContents</code>, <code>BrowserWindow</code> and <code>WebFrame</code>) are not serializable with Structured Clone. Siempre que se invocaba el algoritmo anterior, se imprimía una advertencia de desaprobación.</p>\n<p>En Electron 9,0, se eliminó el algoritmo de serialización anterior, y enviar tales objetos no serializables ahora lanzará un error \"no se pudo clonar el objeto\".</p>\n<h3 id=\"api-modificada-shellopenitem-ahora-es-shellopenpath\"><a href=\"#api-modificada-shellopenitem-ahora-es-shellopenpath\">API Modificada: <code>shell.openItem</code> ahora es <code>shell.openPath</code></a></h3>\n<p>La API <code>shell.openItem</code> ha sido reemplazada con una API asíncrona <code>shell.openPath</code>. Puede ver el la propuesta y lógica original la API <a href=\"https://github.com/electron/governance/blob/main/wg-api/spec-documents/shell-openitem.md\">aquí</a>.</p>\n<h2 id=\"cambios-planeados-en-la-api80\"><a href=\"#cambios-planeados-en-la-api80\">Cambios planeados en la API(8.0)</a></h2>\n<h3 id=\"comportamiento-cambiado-los-valores-enviados-sobre-ipc-ahora-son-serializados-con-algoritmo-de-clon-estructurado\"><a href=\"#comportamiento-cambiado-los-valores-enviados-sobre-ipc-ahora-son-serializados-con-algoritmo-de-clon-estructurado\">Comportamiento Cambiado: Los valores enviados sobre IPC ahora son serializados con Algoritmo de Clon Estructurado</a></h3>\n<p>El algoritmo usado para serializar los objetos enviados sobre IPC (mediante <code>ipcRenderer.send</code>, <code>ipcRenderer.sendSync</code>, <code>WebContents.send</code> y métodos relacionados) han sido cambiados de un algoritmo personalizado a los de V8 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, el mismo algoritmo usado para serializar los mensajes para <code>postMessage</code>. Esto conlleva una mejora en el rendimiento de 2x para mensajes grandes, pero también trae algunos cambios de comportamiento.</p>\n<ul>\n<li>Enviar Functions, Promises, WeakMaps, WeakSets, o objetos que contengan tales valores sobre IPC no lanzará ninguna excepción, en lugar de convertir las funciones a <code>undefined</code>.</li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Anteriormente:</span>\nipcRenderer.send(<span class=\"hljs-string\">'channel'</span>, { <span class=\"hljs-attr\">value</span>: <span class=\"hljs-number\">3</span>, <span class=\"hljs-attr\">someFunction</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {} })\n<span class=\"hljs-comment\">// => results in { value: 3 } arriving in the main process</span>\n\n<span class=\"hljs-comment\">// Desde Electron 8:</span>\nipcRenderer.send(<span class=\"hljs-string\">'channel'</span>, { <span class=\"hljs-attr\">value</span>: <span class=\"hljs-number\">3</span>, <span class=\"hljs-attr\">someFunction</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {} })\n<span class=\"hljs-comment\">// => throws Error(\"() => {} could not be cloned.\")</span>\n</code></pre>\n<ul>\n<li><code>NaN</code>, <code>Infinity</code> y <code>-Infinity</code> Ahora serán correctamente serializados en lugar de ser convertidos a <code>null</code>.</li>\n<li>Los objectos que contengan referencias cíclicas ahora serán correctamente serializados en lugar de ser convertidos a <code>null</code>.</li>\n<li>Los valores <code>Set</code>, <code>Map</code>, <code>Error</code> y <code>RegExp</code> ahora serán correctamente serializados en lugar de ser convertidos a <code>{}</code>.</li>\n<li>Los valores <code>BigInt</code> ahora serán correctamente serializados en lugar de ser convertidos a <code>null</code>.</li>\n<li>Las matrices dispersas se serializarán como tales, en lugar de convertirse en matrices densas con <code>null</code>s.</li>\n<li>Los objetos <code>Date</code> serán transferidos como objetos <code>Date</code>, en lugar de ser convertidos en su representación de cadena ISO.</li>\n<li>Los Arrays con tipo (tales como <code>Uint8Array</code>, <code>Uint16Array</code>, <code>Uint32Array</code> y así sucesivamente) serán transferidas como tales, en lugar de ser convertida a Node.js <code>Buffer</code>.</li>\n<li>Los objetos Node.js <code>Buffer</code> serán transferidos como <code>Uint8Array</code>s. Puedes convertir un <code>Uint8Array</code> de nuevo a un Node.js <code>Buffer</code> envolviendo el <code>ArrayBuffer</code> subyacente:</li>\n</ul>\n<pre><code class=\"hljs language-js\">Buffer.from(value.buffer, value.byteOffset, value.byteLength)\n</code></pre>\n<p>Enviar objetos que no son de tipos nativos de JS, tales como objetos DOM (p.ej. <code>Element</code>, <code>Location</code>, <code>DOMMatrix</code>),objetos Node.js (p.ej. <code>process.env</code>, <code>Stream</code>), u objetos Electron (p.ej. <code>WebContents</code>, <code>BrowserWindow</code>, <code>WebFrame</code>) es obsoleto. En Electron 8, estos objetos serán serializados como antes con un mensaje DeprecationWarning, pero a partir de Electron 9, enviar estos tipos de objetos lanzará un error 'could not be cloned'.</p>\n<h3 id=\"obsoleto-webviewgetwebcontents\"><a href=\"#obsoleto-webviewgetwebcontents\">Obsoleto: <code>&#x3C;webview>.getWebContents()</code></a></h3>\n<p>Esta API está implementada usando el módulo <code>remote</code>, que tiene implicaciones de rendimiento y seguridad. Por lo tanto, su uso debe ser explícito.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\nwebview.getWebContents()\n<span class=\"hljs-comment\">// Reemplazar con</span>\n<span class=\"hljs-keyword\">const</span> { remote } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nremote.webContents.fromId(webview.getWebContentsId())\n</code></pre>\n<p>Sin embargo, es recomendado evitar el uso por completo del modulo <code>remote</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain, webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> getGuestForWebContents = <span class=\"hljs-function\">(<span class=\"hljs-params\">webContentsId, contents</span>) =></span> {\n  <span class=\"hljs-keyword\">const</span> guest = webContents.fromId(webContentsId)\n  <span class=\"hljs-keyword\">if</span> (!guest) {\n    <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">`Invalid webContentsId: <span class=\"hljs-subst\">${webContentsId}</span>`</span>)\n  }\n  <span class=\"hljs-keyword\">if</span> (guest.hostWebContents !== contents) {\n    <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Access denied to webContents'</span>)\n  }\n  <span class=\"hljs-keyword\">return</span> guest\n}\n\nipcMain.handle(<span class=\"hljs-string\">'openDevTools'</span>, (event, webContentsId) => {\n  <span class=\"hljs-keyword\">const</span> guest = getGuestForWebContents(webContentsId, event.sender)\n  guest.openDevTools()\n})\n\n<span class=\"hljs-comment\">// renderer</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nipcRenderer.invoke(<span class=\"hljs-string\">'openDevTools'</span>, webview.getWebContentsId())\n</code></pre>\n<h3 id=\"obsoleto-webframesetlayoutzoomlevellimits\"><a href=\"#obsoleto-webframesetlayoutzoomlevellimits\">Obsoleto: <code>webFrame.setLayoutZoomLevelLimits()</code></a></h3>\n<p>Chromium ha eliminado el soporte para cambiar los limites del nivel de zoom del diseño y esta más allá de la capacidad de Electron el mantenerlo. La función emitirá una advertencia en Electron 8.x, y dejará de existir en Electron 9.x. The layout zoom level limits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined <a href=\"https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11\">here</a>.</p>\n<h3 id=\"eventos-obsoletos-en-systempreferences\"><a href=\"#eventos-obsoletos-en-systempreferences\">Eventos obsoletos en <code>systemPreferences</code></a></h3>\n<p>Los siguientes eventos <code>systemPreferences</code> han sido marcados como obsoletos:</p>\n<ul>\n<li><code>inverted-color-scheme-changed</code></li>\n<li><code>high-contrast-color-scheme-changed</code></li>\n</ul>\n<p>Use el nuevo evento <code>updated</code> en el módulo <code>nativeTheme</code> en su lugar.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\nsystemPreferences.on(<span class=\"hljs-string\">'inverted-color-scheme-changed'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\nsystemPreferences.on(<span class=\"hljs-string\">'high-contrast-color-scheme-changed'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\n\n<span class=\"hljs-comment\">// Reemplazar con</span>\nnativeTheme.on(<span class=\"hljs-string\">'updated'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\n</code></pre>\n<h3 id=\"obsoleto-métodos-en-systempreferences\"><a href=\"#obsoleto-métodos-en-systempreferences\">Obsoleto: métodos en <code>systemPreferences</code></a></h3>\n<p>Los métodos siguientes de <code>systemPreferences</code> han quedado obsoletos:</p>\n<ul>\n<li><code>systemPreferences.isDarkMode()</code></li>\n<li><code>systemPreferences.isInvertedColorScheme()</code></li>\n<li><code>systemPreferences.isHighContrastColorScheme()</code></li>\n</ul>\n<p>En su lugar, usa las siguientes propiedades <code>nativeTheme</code>:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code></li>\n<li><code>nativeTheme.shouldUseInvertedColorScheme</code></li>\n<li><code>nativeTheme.shouldUseHighContrastColors</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\nsystemPreferences.isDarkMode()\n<span class=\"hljs-comment\">// Reemplazar con</span>\nnativeTheme.shouldUseDarkColors\n\n<span class=\"hljs-comment\">// Obsoleto</span>\nsystemPreferences.isInvertedColorScheme()\n<span class=\"hljs-comment\">// Reemplazar con</span>\nnativeTheme.shouldUseInvertedColorScheme\n\n<span class=\"hljs-comment\">// Obsoleto</span>\nsystemPreferences.isHighContrastColorScheme()\n<span class=\"hljs-comment\">// Reemplazar con</span>\nnativeTheme.shouldUseHighContrastColors\n</code></pre>\n<h2 id=\"cambios-planeados-en-la-api-70\"><a href=\"#cambios-planeados-en-la-api-70\">Cambios Planeados en la API (7.0)</a></h2>\n<h3 id=\"obsoleto-atomio-node-headers-url\"><a href=\"#obsoleto-atomio-node-headers-url\">Obsoleto: Atom.io Node Headers URL</a></h3>\n<p>Este es el URL especificado como <code>disturl</code> en un archivo <code>.npmrc</code> o como el comando de linea <code>--dist-url</code> al construir los módulos nativos de nodo.  Ambos serán admitidos para el futuro previsible, pero se recomienda que cambies.</p>\n<p>Obsoleto: <a href=\"https://atom.io/download/electron\">https://atom.io/download/electron</a></p>\n<p>Reemplazar con: <a href=\"https://electronjs.org/headers\">https://electronjs.org/headers</a></p>\n<h3 id=\"api-modificada-sessionclearauthcache-ya-no-acepta-opciones\"><a href=\"#api-modificada-sessionclearauthcache-ya-no-acepta-opciones\">API Modificada: <code>session.clearAuthCache()</code> ya no acepta opciones</a></h3>\n<p>La API <code>session.clearAuthCache</code> ya no acepta opciones de que limpiar y en su lugar incondicionalmente limpia la cache entera.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nsession.clearAuthCache({ <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'password'</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nsession.clearAuthCache()\n</code></pre>\n<h3 id=\"api-modificada-powermonitorquerysystemidlestate-ahora-es-powermonitorgetsystemidlestate\"><a href=\"#api-modificada-powermonitorquerysystemidlestate-ahora-es-powermonitorgetsystemidlestate\">API Modificada: <code>powerMonitor.querySystemIdleState</code> ahora es <code>powerMonitor.getSystemIdleState</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\npowerMonitor.querySystemIdleState(threshold, callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleState = powerMonitor.getSystemIdleState(threshold)\n</code></pre>\n<h3 id=\"api-modificada-powermonitorquerysystemidletime-ahora-es-powermonitorgetsystemidletime\"><a href=\"#api-modificada-powermonitorquerysystemidletime-ahora-es-powermonitorgetsystemidletime\">API Modificada: <code>powerMonitor.querySystemIdleTime</code> ahora es <code>powerMonitor.getSystemIdleTime</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Eliminada en Electron 7.0</span>\npowerMonitor.querySystemIdleTime(callback)\n<span class=\"hljs-comment\">// Reemplazar con API síncrona</span>\n<span class=\"hljs-keyword\">const</span> idleTime = powerMonitor.getSystemIdleTime()\n</code></pre>\n<h3 id=\"api-modificada-webframesetisolatedworldinfo-reemplaza-métodos-separados\"><a href=\"#api-modificada-webframesetisolatedworldinfo-reemplaza-métodos-separados\">API Modificada: <code>webFrame.setIsolatedWorldInfo</code> reemplaza métodos separados</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\nwebFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)\nwebFrame.setIsolatedWorldHumanReadableName(worldId, name)\nwebFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)\n<span class=\"hljs-comment\">// Replace with</span>\nwebFrame.setIsolatedWorldInfo(\n  worldId,\n  {\n    <span class=\"hljs-attr\">securityOrigin</span>: <span class=\"hljs-string\">'some_origin'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'human_readable_name'</span>,\n    <span class=\"hljs-attr\">csp</span>: <span class=\"hljs-string\">'content_security_policy'</span>\n  })\n</code></pre>\n<h3 id=\"eliminado-propiedad-marked-en-getblinkmemoryinfo\"><a href=\"#eliminado-propiedad-marked-en-getblinkmemoryinfo\">Eliminado: propiedad <code>marked</code> en <code>getBlinkMemoryInfo</code></a></h3>\n<p>Esta propiedad fue removida en Chromium 77, y como tal ya no está disponible.</p>\n<h3 id=\"comportamiento-cambiado-atributo-webkitdirectory-a-input-typefile-ahora-lista-el-contenido-del-directorio\"><a href=\"#comportamiento-cambiado-atributo-webkitdirectory-a-input-typefile-ahora-lista-el-contenido-del-directorio\">Comportamiento Cambiado: atributo <code>webkitdirectory</code> a <code>&#x3C;input type=\"file\"/></code> ahora lista el contenido del directorio</a></h3>\n<p>La propiedad <code>webkitdirectory</code> en las entradas de archivos HTML les permite seleccionar carpetas. Las versiones anteriores de Electron tenían una implementación incorrecta donde la entrada de <code>event.target.files</code> retornaba un <code>FileList</code> que retornaba un <code>File</code> correspondiente a la carpeta seleccionada.</p>\n<p>As of Electron 7, that <code>FileList</code> is now list of all files contained within the folder, similarly to Chrome, Firefox, and Edge (<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory\">link to MDN docs</a>).</p>\n<p>Como una ilustración, toma una carpeta con esta estructura:</p>\n<pre><code class=\"hljs language-console\">folder\n├── file1\n├── file2\n└── file3\n</code></pre>\n<p>En Electron &#x3C;=6, esto debería retornar un <code>FileList</code> con un objeto <code>File</code> para:</p>\n<pre><code class=\"hljs language-console\">path/to/folder\n</code></pre>\n<p>En Electron 7, esto ahora retorna un <code>FileList</code> con un objeto <code>File</code> para:</p>\n<pre><code class=\"hljs language-console\">/path/to/folder/file3\n/path/to/folder/file2\n/path/to/folder/file1\n</code></pre>\n<p>Tenga en cuenta que <code>webkitdirectory</code> ya no expone la ruta de la carpeta seleccionada. Si requieras la ruta a la carpeta seleccionada en lugar de los contenidos de la carpeta, ver el <code>Dialog. showOpenDialog</code> API (<a href=\"/docs/api/dialog#dialogshowopendialogbrowserwindow-options\">Link</a>).</p>\n<h3 id=\"api-modificada-versiones-basadas-en-callback-de-apis-promisificadas\"><a href=\"#api-modificada-versiones-basadas-en-callback-de-apis-promisificadas\">API Modificada: Versiones basadas en Callback de APIs promisificadas</a></h3>\n<p>Electron 5 y Electron 6 introdujeron versiones basadas en Promise de las API asíncornas existentes y desaprobaron sus contrapartes antiguas basadas en callback. En Electron 7, todas las APIs desaprobadas basadas en callback ahora están eliminadas.</p>\n<p>Estas funciones ahora sólo devuelven Promises:</p>\n<ul>\n<li><code>app.getFileIcon()</code> <a href=\"https://github.com/electron/electron/pull/15742\">#15742</a></li>\n<li><code>app.dock.show()</code> <a href=\"https://github.com/electron/electron/pull/16904\">#16904</a></li>\n<li><code>contentTracing.getCategories()</code> <a href=\"https://github.com/electron/electron/pull/16583\">#16583</a></li>\n<li><code>contentTracing.getTraceBufferUsage()</code> <a href=\"https://github.com/electron/electron/pull/16600\">#16600</a></li>\n<li><code>contentTracing.startRecording()</code> <a href=\"https://github.com/electron/electron/pull/16584\">#16584</a></li>\n<li><code>contentTracing.stopRecording()</code> <a href=\"https://github.com/electron/electron/pull/16584\">#16584</a></li>\n<li><code>contents.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>cookies.flushStore()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.get()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.remove()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.set()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>debugger.sendCommand()</code> <a href=\"https://github.com/electron/electron/pull/16861\">#16861</a></li>\n<li><code>dialog.showCertificateTrustDialog()</code> <a href=\"https://github.com/electron/electron/pull/17181\">#17181</a></li>\n<li><code>inAppPurchase.getProducts()</code> <a href=\"https://github.com/electron/electron/pull/17355\">#17355</a></li>\n<li><code>inAppPurchase.purchaseProduct()</code><a href=\"https://github.com/electron/electron/pull/17355\">#17355</a></li>\n<li><code>netLog.stopLogging()</code> <a href=\"https://github.com/electron/electron/pull/16862\">#16862</a></li>\n<li><code>session.clearAuthCache()</code> <a href=\"https://github.com/electron/electron/pull/17259\">#17259</a></li>\n<li><code>session.clearCache()</code>  <a href=\"https://github.com/electron/electron/pull/17185\">#17185</a></li>\n<li><code>session.clearHostResolverCache()</code> <a href=\"https://github.com/electron/electron/pull/17229\">#17229</a></li>\n<li><code>session.clearStorageData()</code> <a href=\"https://github.com/electron/electron/pull/17249\">#17249</a></li>\n<li><code>session.getBlobData()</code> <a href=\"https://github.com/electron/electron/pull/17303\">#17303</a></li>\n<li><code>session.getCacheSize()</code>  <a href=\"https://github.com/electron/electron/pull/17185\">#17185</a></li>\n<li><code>session.resolveProxy()</code> <a href=\"https://github.com/electron/electron/pull/17222\">#17222</a></li>\n<li><code>session.setProxy()</code>  <a href=\"https://github.com/electron/electron/pull/17222\">#17222</a></li>\n<li><code>shell.openExternal()</code> <a href=\"https://github.com/electron/electron/pull/16176\">#16176</a></li>\n<li><code>webContents.loadFile()</code> <a href=\"https://github.com/electron/electron/pull/15855\">#15855</a></li>\n<li><code>webContents.loadURL()</code> <a href=\"https://github.com/electron/electron/pull/15855\">#15855</a></li>\n<li><code>webContents.hasServiceWorker()</code> <a href=\"https://github.com/electron/electron/pull/16535\">#16535</a></li>\n<li><code>webContents.printToPDF()</code> <a href=\"https://github.com/electron/electron/pull/16795\">#16795</a></li>\n<li><code>webContents.savePage()</code> <a href=\"https://github.com/electron/electron/pull/16742\">#16742</a></li>\n<li><code>webFrame.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>webFrame.executeJavaScriptInIsolatedWorld()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>webviewTag.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>win.capturePage()</code> <a href=\"https://github.com/electron/electron/pull/15743\">#15743</a></li>\n</ul>\n<p>These functions now have two forms, synchronous and Promise-based asynchronous:</p>\n<ul>\n<li><code>dialog.showMessageBox()</code>/<code>dialog.showMessageBoxSync()</code> <a href=\"https://github.com/electron/electron/pull/17298\">#17298</a></li>\n<li><code>dialog.showOpenDialog()</code>/<code>dialog.showOpenDialogSync()</code> <a href=\"https://github.com/electron/electron/pull/16973\">#16973</a></li>\n<li><code>dialog.showSaveDialog()</code>/<code>dialog.showSaveDialogSync()</code> <a href=\"https://github.com/electron/electron/pull/17054\">#17054</a></li>\n</ul>\n<h2 id=\"cambios-planeados-en-la-api-60\"><a href=\"#cambios-planeados-en-la-api-60\">Cambios Planeados en la API (6.0)</a></h2>\n<h3 id=\"api-modificada-winsetmenunull-ahora-es-winremovemenu\"><a href=\"#api-modificada-winsetmenunull-ahora-es-winremovemenu\">API Modificada: <code>win.setMenu(null)</code> ahora es <code>win.removeMenu()</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecado</span>\nwin.setMenu(<span class=\"hljs-literal\">null</span>)\n<span class=\"hljs-comment\">// Reemplazar con </span>\nwin.removeMenu()\n</code></pre>\n<h3 id=\"api-modificada-electronscreen-en-el-proceso-renderer-debe-ser-accedido-a-través-de-remote\"><a href=\"#api-modificada-electronscreen-en-el-proceso-renderer-debe-ser-accedido-a-través-de-remote\">API Modificada: <code>electron.screen</code> en el proceso renderer debe ser accedido a través de <code>remote</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecado</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).screen\n<span class=\"hljs-comment\">// Reemplazar con </span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.screen\n</code></pre>\n<h3 id=\"api-modificada-require-los-ing-integrados-de-node-builtins-en-renderizadores-sandboxed-no-carga-más-de-forma-implícita-la-versión-remote\"><a href=\"#api-modificada-require-los-ing-integrados-de-node-builtins-en-renderizadores-sandboxed-no-carga-más-de-forma-implícita-la-versión-remote\">API Modificada: <code>require()</code> los ing integrados de node builtins en renderizadores sandboxed no carga más de forma implícita la versión <code>remote</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecado</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'child_process'</span>)\n<span class=\"hljs-comment\">// Reemplazar con</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'child_process'</span>)\n\n<span class=\"hljs-comment\">// Deprecado</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-comment\">// Reemplazar con</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-comment\">// Deprecado</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n<span class=\"hljs-comment\">// Reemplazar con</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'os'</span>)\n\n<span class=\"hljs-comment\">// Deprecado</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n<span class=\"hljs-comment\">// Reemplazar con</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'path'</span>)\n</code></pre>\n<h3 id=\"obsoleto-powermonitorquerysystemidlestate-reemplazar-con-powermonitorgetsystemidlestate\"><a href=\"#obsoleto-powermonitorquerysystemidlestate-reemplazar-con-powermonitorgetsystemidlestate\">Obsoleto: <code>powerMonitor.querySystemIdleState</code> reemplazar con <code>powerMonitor.getSystemIdleState</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\npowerMonitor.querySystemIdleState(threshold, callback)\n<span class=\"hljs-comment\">// Reemplazar con API síncrona</span>\n<span class=\"hljs-keyword\">const</span> idleState = powerMonitor.getSystemIdleState(threshold)\n</code></pre>\n<h3 id=\"obsoleto-powermonitorquerysystemidletime-reemplazado-con-powermonitorgetsystemidletime\"><a href=\"#obsoleto-powermonitorquerysystemidletime-reemplazado-con-powermonitorgetsystemidletime\">Obsoleto: <code>powerMonitor.querySystemIdleTime</code> reemplazado con <code>powerMonitor.getSystemIdleTime</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\npowerMonitor.querySystemIdleTime(callback)\n<span class=\"hljs-comment\">// Reemplazar con API síncrona</span>\n<span class=\"hljs-keyword\">const</span> idleTime = powerMonitor.getSystemIdleTime()\n</code></pre>\n<h3 id=\"obsoleto-appenablemixedsandbox-ya-no-es-necesario\"><a href=\"#obsoleto-appenablemixedsandbox-ya-no-es-necesario\">Obsoleto: <code>app.enableMixedSandbox()</code> ya no es necesario</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\napp.enableMixedSandbox()\n</code></pre>\n<p>El modo Mixed-sandbox ahora está activado por defecto.</p>\n<h3 id=\"obsoleto-traysethighlightmode\"><a href=\"#obsoleto-traysethighlightmode\">Obsoleto: <code>Tray.setHighlightMode</code></a></h3>\n<p>Bajo macOS Catalina nuestra implementación Tray se rompe. El sustituto nativo de Apple no soporta cambiar el comportamiento de resaltado.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecado</span>\ntray.setHighlightMode(mode)\n<span class=\"hljs-comment\">// API sera eliminada en V7.0 sin reemplazo.</span>\n</code></pre>\n<h2 id=\"cambios-planeados-en-la-api-50\"><a href=\"#cambios-planeados-en-la-api-50\">Cambios Planeados en la API (5.0)</a></h2>\n<h3 id=\"valor-por-defecto-modificado-nodeintegration-y-webviewtag-por-defecto-a-false-contextisolation-por-defecto-a-true\"><a href=\"#valor-por-defecto-modificado-nodeintegration-y-webviewtag-por-defecto-a-false-contextisolation-por-defecto-a-true\">Valor por defecto modificado: <code>nodeIntegration</code> y <code>webviewTag</code> por defecto a false, <code>contextIsolation</code> por defecto a true</a></h3>\n<p>Los siguientes valores por defectos de opción <code>webPreferences</code> están obsoletos a favor de los nuevos valores por defectos listados a continuación.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Propiedad</th><th>Valor obsoleto</th><th>El valor por defecto nuevo</th></tr></thead><tbody><tr><td><code>contextIsolation</code></td><td><code>false</code></td><td><code>true</code></td></tr><tr><td><code>nodeIntegration</code></td><td><code>true</code></td><td><code>false</code></td></tr><tr><td><code>webviewTag</code></td><td><code>nodeIntegration</code> if set else <code>true</code></td><td><code>false</code></td></tr></tbody></table>\n<p>P.e. Volver a habilitar el webviewTag</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> w = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">webviewTag</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h3 id=\"comportamiento-modificado-nodeintegration-en-ventanas-hijas-abiertas-a-través-de-nativewindowopen\"><a href=\"#comportamiento-modificado-nodeintegration-en-ventanas-hijas-abiertas-a-través-de-nativewindowopen\">Comportamiento Modificado: <code>nodeIntegration</code> en ventanas hijas abiertas a través de <code>nativeWindowOpen</code></a></h3>\n<p>Child windows opened with the <code>nativeWindowOpen</code> option will always have Node.js integration disabled, unless <code>nodeIntegrationInSubFrames</code> is <code>true</code>.</p>\n<h3 id=\"api-modificada-el-registro-de-esquemas-privilegiados-ahora-debe-hacerse-antes-de-que-la-aplicación-este-lista\"><a href=\"#api-modificada-el-registro-de-esquemas-privilegiados-ahora-debe-hacerse-antes-de-que-la-aplicación-este-lista\">API Modificada: El registro de esquemas privilegiados ahora debe hacerse antes de que la aplicación este lista</a></h3>\n<p>Renderer process APIs <code>webFrame.registerURLSchemeAsPrivileged</code> and <code>webFrame.registerURLSchemeAsBypassingCSP</code> as well as browser process API <code>protocol.registerStandardSchemes</code> have been removed. Una nueva API, <code>protocol.registerSchemesAsPrivileged</code> ha sido agregada y debe ser usada para registrar esquemas personalizados con los privilegios requeridos. Se requieren esquemas personalizados para ser registrados antes de que la aplicación esté lista.</p>\n<h3 id=\"obsoleto-webframesetisolatedworld-reemplazado-con-webframesetisolatedworldinfo\"><a href=\"#obsoleto-webframesetisolatedworld-reemplazado-con-webframesetisolatedworldinfo\">Obsoleto: <code>webFrame.setIsolatedWorld*</code> reemplazado con <code>webFrame.setIsolatedWorldInfo</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)\nwebFrame.setIsolatedWorldHumanReadableName(worldId, name)\nwebFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)\n<span class=\"hljs-comment\">// Replace with</span>\nwebFrame.setIsolatedWorldInfo(\n  worldId,\n  {\n    <span class=\"hljs-attr\">securityOrigin</span>: <span class=\"hljs-string\">'some_origin'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'human_readable_name'</span>,\n    <span class=\"hljs-attr\">csp</span>: <span class=\"hljs-string\">'content_security_policy'</span>\n  })\n</code></pre>\n<h3 id=\"api-modificada-webframesetspellcheckprovider-ahora-toma-un-callbak-asíncrono\"><a href=\"#api-modificada-webframesetspellcheckprovider-ahora-toma-un-callbak-asíncrono\">API Modificada: <code>webFrame.setSpellCheckProvider</code> ahora toma un callbak asíncrono</a></h3>\n<p>El callback <code>spellCheck</code> ahora es asincrónico y el parámetro <code>autoCorrectWord</code> ha sido removido.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, <span class=\"hljs-literal\">true</span>, {\n  <span class=\"hljs-attr\">spellCheck</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">text</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> !spellchecker.isMisspelled(text)\n  }\n})\n<span class=\"hljs-comment\">// Reemplazar con</span>\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, {\n  <span class=\"hljs-attr\">spellCheck</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">words, callback</span>) =></span> {\n    callback(words.filter(<span class=\"hljs-function\"><span class=\"hljs-params\">text</span> =></span> spellchecker.isMisspelled(text)))\n  }\n})\n</code></pre>\n<h3 id=\"api-modificada-webcontentsgetzoomlevel-y-webcontentsgetzoomfactor-ahora-son-síncrono\"><a href=\"#api-modificada-webcontentsgetzoomlevel-y-webcontentsgetzoomfactor-ahora-son-síncrono\">API Modificada: <code>webContents.getZoomLevel</code> y <code>webContents.getZoomFactor</code> ahora son síncrono</a></h3>\n<p><code>webContents.getZoomLevel</code> y <code>webContents.getZoomFactor</code> ya no toman parámetros callback, en su lugar devuelven directamente sus valores numéricos.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebContents.getZoomLevel(<span class=\"hljs-function\">(<span class=\"hljs-params\">level</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(level)\n})\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> level = webContents.getZoomLevel()\n<span class=\"hljs-built_in\">console</span>.log(level)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebContents.getZoomFactor(<span class=\"hljs-function\">(<span class=\"hljs-params\">factor</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(factor)\n})\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> factor = webContents.getZoomFactor()\n<span class=\"hljs-built_in\">console</span>.log(factor)\n</code></pre>\n<h2 id=\"cambios-planeados-en-la-api40\"><a href=\"#cambios-planeados-en-la-api40\">Cambios planeados en la API(4.0)</a></h2>\n<p>La siguiente lista incluye cambios efectuados en la API 4.0 de Electrón.</p>\n<h3 id=\"appmakesingleinstance\"><a href=\"#appmakesingleinstance\"><code>app.makeSingleInstance</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\napp.makeSingleInstance(<span class=\"hljs-function\">(<span class=\"hljs-params\">argv, cwd</span>) =></span> {\n  <span class=\"hljs-comment\">/* ... */</span>\n})\n<span class=\"hljs-comment\">// Replace with</span>\napp.requestSingleInstanceLock()\napp.on(<span class=\"hljs-string\">'second-instance'</span>, (event, argv, cwd) => {\n  <span class=\"hljs-comment\">/* ... */</span>\n})\n</code></pre>\n<h3 id=\"appreleasesingleinstance\"><a href=\"#appreleasesingleinstance\"><code>app.releaseSingleInstance</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\napp.releaseSingleInstance()\n<span class=\"hljs-comment\">// Reemplazar con</span>\napp.releaseSingleInstanceLock()\n</code></pre>\n<h3 id=\"appgetgpuinfo\"><a href=\"#appgetgpuinfo\"><code>app.getGPUInfo</code></a></h3>\n<pre><code class=\"hljs language-js\">app.getGPUInfo(<span class=\"hljs-string\">'completo'</span>)\n<span class=\"hljs-comment\">// Ahora se comporta lo mismo con `basic` en macOS</span>\napp.getGPUInfo(<span class=\"hljs-string\">'básico'</span>)\n</code></pre>\n<h3 id=\"win_delay_load_hook\"><a href=\"#win_delay_load_hook\"><code>win_delay_load_hook</code></a></h3>\n<p>Cuando se construye módulos nativos para windows, la variable <code>win_delay_load_hook</code> del módulo <code>binding.gyp</code> debe ser true (el cual es por defecto). Si este hook no esta presente, luego el módulo nativo va a fallar al cargar en Windows, con un mensaje de error como <code>Cannot find module</code>. Consulte la <a href=\"/docs/tutorial/using-native-node-modules\">guía de módulo nativo</a> para más infromación.</p>\n<h2 id=\"cambios-en-la-api30\"><a href=\"#cambios-en-la-api30\">Cambios en la API(3.0)</a></h2>\n<p>La siguiente lista incluye cambios efectuados en la API 3.0 de Electrón.</p>\n<h3 id=\"app\"><a href=\"#app\"><code>app</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\napp.getAppMemoryInfo()\n<span class=\"hljs-comment\">// Remplazar con</span>\napp.getAppMetrics()\n\n<span class=\"hljs-comment\">// Obsoleto</span>\n<span class=\"hljs-keyword\">const</span> metrics = app.getAppMetrics()\n<span class=\"hljs-keyword\">const</span> { memory } = metrics[<span class=\"hljs-number\">0</span>] <span class=\"hljs-comment\">// Propiedad Obsoleta</span>\n</code></pre>\n<h3 id=\"browserwindow\"><a href=\"#browserwindow\"><code>BrowserWindow</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\n<span class=\"hljs-keyword\">const</span> optionsA = { <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">blinkFeatures</span>: <span class=\"hljs-string\">''</span> } }\n<span class=\"hljs-keyword\">const</span> windowA = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsA)\n<span class=\"hljs-comment\">// Reemplazar con</span>\n<span class=\"hljs-keyword\">const</span> optionsB = { <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">enableBlinkFeatures</span>: <span class=\"hljs-string\">''</span> } }\n<span class=\"hljs-keyword\">const</span> windowB = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsB)\n\n<span class=\"hljs-comment\">// Obsoleto</span>\n<span class=\"hljs-built_in\">window</span>.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'media-play_pause'</span>) {\n    <span class=\"hljs-comment\">// do something</span>\n  }\n})\n<span class=\"hljs-comment\">// Reemplazar con</span>\n<span class=\"hljs-built_in\">window</span>.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'media-play-pause'</span>) {\n    <span class=\"hljs-comment\">// do something</span>\n  }\n})\n</code></pre>\n<h3 id=\"clipboard\"><a href=\"#clipboard\"><code>clipboard</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Cambiar</span>\nclipboard.readRtf()\n<span class=\"hljs-comment\">// Reemplazar con</span>\nclipboard.readRTF()\n\n<span class=\"hljs-comment\">// Cambiar</span>\nclipboard.writeRtf()\n<span class=\"hljs-comment\">// Reemplazar con</span>\nclipboard.writeRTF()\n\n<span class=\"hljs-comment\">// Cambiar</span>\nclipboard.readHtml()\n<span class=\"hljs-comment\">// Reemplazar con</span>\nclipboard.readHTML()\n\n<span class=\"hljs-comment\">// Cambiar</span>\nclipboard.writeHtml()\n<span class=\"hljs-comment\">// Reemplazar con</span>\nclipboard.writeHTML()\n</code></pre>\n<h3 id=\"crashreporter\"><a href=\"#crashreporter\"><code>crashReporter</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Cambiar</span>\ncrashReporter.start({\n  <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Crashly'</span>,\n  <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://crash.server.com'</span>,\n  <span class=\"hljs-attr\">autoSubmit</span>: <span class=\"hljs-literal\">true</span>\n})\n<span class=\"hljs-comment\">// Reemplazar con</span>\ncrashReporter.start({\n  <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Crashly'</span>,\n  <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://crash.server.com'</span>,\n  <span class=\"hljs-attr\">uploadToServer</span>: <span class=\"hljs-literal\">true</span>\n})\n</code></pre>\n<h3 id=\"nativeimage\"><a href=\"#nativeimage\"><code>nativeImage</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\nnativeImage.createFromBuffer(buffer, <span class=\"hljs-number\">1.0</span>)\n<span class=\"hljs-comment\">// Reemplazar con</span>\nnativeImage.createFromBuffer(buffer, {\n  <span class=\"hljs-attr\">scaleFactor</span>: <span class=\"hljs-number\">1.0</span>\n})\n</code></pre>\n<h3 id=\"process\"><a href=\"#process\"><code>process</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\n<span class=\"hljs-keyword\">const</span> info = process.getProcessMemoryInfo()\n</code></pre>\n<h3 id=\"screen\"><a href=\"#screen\"><code>screen</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\nscreen.getMenuBarHeight()\n<span class=\"hljs-comment\">// Reemplazar con</span>\nscreen.getPrimaryDisplay().workArea\n</code></pre>\n<h3 id=\"session\"><a href=\"#session\"><code>session</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecado</span>\nses.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">hostname, certificate, callback</span>) =></span> {\n  callback(<span class=\"hljs-literal\">true</span>)\n})\n<span class=\"hljs-comment\">// Reemplazar con</span>\nses.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">request, callback</span>) =></span> {\n  callback(<span class=\"hljs-number\">0</span>)\n})\n</code></pre>\n<h3 id=\"tray\"><a href=\"#tray\"><code>Tray</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Cambiar</span>\ntray.setHighlightMode(<span class=\"hljs-literal\">true</span>)\n<span class=\"hljs-comment\">// Reemplazar con</span>\ntray.setHighlightMode(<span class=\"hljs-string\">'on'</span>)\n\n<span class=\"hljs-comment\">// Cambiar</span>\ntray.setHighlightMode(<span class=\"hljs-literal\">false</span>)\n<span class=\"hljs-comment\">// Reemplazar con</span>\ntray.setHighlightMode(<span class=\"hljs-string\">'off'</span>)\n</code></pre>\n<h3 id=\"webcontents\"><a href=\"#webcontents\"><code>webContents</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebContents.openDevTools({ <span class=\"hljs-attr\">detach</span>: <span class=\"hljs-literal\">true</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nwebContents.openDevTools({ <span class=\"hljs-attr\">mode</span>: <span class=\"hljs-string\">'detach'</span> })\n\n<span class=\"hljs-comment\">// Removed</span>\nwebContents.setSize(options)\n<span class=\"hljs-comment\">// There is no replacement for this API</span>\n</code></pre>\n<h3 id=\"webframe\"><a href=\"#webframe\"><code>webFrame</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.registerURLSchemeAsSecure(<span class=\"hljs-string\">'app'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\nprotocol.registerStandardSchemes([<span class=\"hljs-string\">'app'</span>], { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n\n<span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.registerURLSchemeAsPrivileged(<span class=\"hljs-string\">'app'</span>, { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nprotocol.registerStandardSchemes([<span class=\"hljs-string\">'app'</span>], { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n</code></pre>\n<h3 id=\"webview\"><a href=\"#webview\"><code>&#x3C;webview></code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Eliminado</span>\nwebview.setAttribute(<span class=\"hljs-string\">'disableguestresize'</span>, <span class=\"hljs-string\">''</span>)\n<span class=\"hljs-comment\">// No hay reemplazo para esto en la API</span>\n\n<span class=\"hljs-comment\">// Eliminado</span>\nwebview.setAttribute(<span class=\"hljs-string\">'guestinstance'</span>, instanceId)\n<span class=\"hljs-comment\">// No hay reemplazo para esto en la API</span>\n\n<span class=\"hljs-comment\">// Los eventos de tecldo ya no funcionan en la etiqueta de webview</span>\nwebview.onkeydown = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* handler */</span> }\nwebview.onkeyup = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* handler */</span> }\n</code></pre>\n<h3 id=\"url-de-cabecera-de-nodo\"><a href=\"#url-de-cabecera-de-nodo\">URL de cabecera de nodo</a></h3>\n<p>Este es el URL especificado como <code>disturl</code> en un archivo <code>.npmrc</code> o como el comando de linea <code>--dist-url</code> al construir los módulos nativos de nodo.</p>\n<p>Cambiar: <a href=\"https://atom.io/download/atom-shell\">https://atom.io/download/atom-shell</a></p>\n<p>Reemplazar con: <a href=\"https://atom.io/download/electron\">https://atom.io/download/electron</a></p>\n<h2 id=\"cambios-en-la-api20\"><a href=\"#cambios-en-la-api20\">Cambios en la API(2.0)</a></h2>\n<p>La siguiente lista incluye cambios efectuados en la API 2.0 de Electrón.</p>\n<h3 id=\"browserwindow-1\"><a href=\"#browserwindow-1\"><code>BrowserWindow</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\n<span class=\"hljs-keyword\">const</span> optionsA = { <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden-inset'</span> }\n<span class=\"hljs-keyword\">const</span> windowA = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsA)\n<span class=\"hljs-comment\">// Reemplazar con</span>\n<span class=\"hljs-keyword\">const</span> optionsB = { <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span> }\n<span class=\"hljs-keyword\">const</span> windowB = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsB)\n</code></pre>\n<h3 id=\"menu\"><a href=\"#menu\"><code>menu</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed</span>\nmenu.popup(browserWindow, <span class=\"hljs-number\">100</span>, <span class=\"hljs-number\">200</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Replaced with</span>\nmenu.popup(browserWindow, { <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">100</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">200</span>, <span class=\"hljs-attr\">positioningItem</span>: <span class=\"hljs-number\">2</span> })\n</code></pre>\n<h3 id=\"nativeimage-1\"><a href=\"#nativeimage-1\"><code>nativeImage</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\nnativeImage.toPng()\n<span class=\"hljs-comment\">// Reemplazar con</span>\nnativeImage.toPNG()\n\n<span class=\"hljs-comment\">// Obsoleto</span>\nnativeImage.toJpeg()\n<span class=\"hljs-comment\">// Reemplazar con</span>\nnativeImage.toJPEG()\n</code></pre>\n<h3 id=\"process-1\"><a href=\"#process-1\"><code>process</code></a></h3>\n<ul>\n<li><code>Versión de procesos de Electron</code> y <code>Versión de procesos de Chrome</code> Serán propiedades de solo lectura para la consistencia con otras propiedades de <code>process.versions</code> configuradas por Node.</li>\n</ul>\n<h3 id=\"webcontents-1\"><a href=\"#webcontents-1\"><code>webContents</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\nwebContents.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Reemplazar con</span>\nwebContents.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"webframe-1\"><a href=\"#webframe-1\"><code>webFrame</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\nwebFrame.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Reemplazar con</span>\nwebFrame.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"webview-1\"><a href=\"#webview-1\"><code>&#x3C;webview></code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Obsoleto</span>\nwebview.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Reemplazar con</span>\nwebview.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"duplicado-de-brazo-arm\"><a href=\"#duplicado-de-brazo-arm\">Duplicado de brazo ARM</a></h3>\n<p>Cada versión de Electrón incluye dos versiones de ARM idénticas con diferentes nombres de archivo, como: <code>electron-v1.7.3-linux-arm.zip</code> y <code>electron-v1.7.3-linux-armv7l.zip</code>. Se agregó el archivo con el prefijo <code>v7l</code> para aclarar a los usuarios qué versión de ARM soporta y desambiguar los futuros archivos de armv6l y arm64 que pueden ser producidos.</p>\n<p>The file <em>without the prefix</em> is still being published to avoid breaking any setups that may be consuming it. A partir de 2.0, el archivo sin prefijo ya no será publicado.</p>\n<p>Para más detalles, vea: <a href=\"https://github.com/electron/electron/pull/6986\">6986</a> y <a href=\"https://github.com/electron/electron/pull/7189\">7189</a>.</p>",
      "title": "Restaurar archivos borrados",
      "description": ""
    },
    "/docs/api/browser-view": {
      "locale": "es-ES",
      "slug": "browser-view",
      "href": "/docs/api/browser-view",
      "crowdinFileId": "256283",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-view.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"browserview\"><a href=\"#browserview\">BrowserView</a></h1>\n<p>Se puede utilizar un <code>BrowserView</code> para incrustar contenido web adicional dentro de un <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. Es como una ventana hija, excepto que su posición es relativa a la de su ventana propietaria. Se puede considerar como una alternativa al tag <code>webview</code>.</p>\n<h2 id=\"clase-browserview\"><a href=\"#clase-browserview\">Clase: BrowserView</a></h2>\n<blockquote>\n<p>Crear y controlar vistas.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<h3 id=\"ejemplo\"><a href=\"#ejemplo\">Ejemplo</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">/// In the main process.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserView, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-keyword\">const</span> view = <span class=\"hljs-keyword\">new</span> BrowserView()\nwin.setBrowserView(view)\nview.setBounds({ <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">0</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">0</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">300</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">300</span> })\nview.webContents.loadURL(<span class=\"hljs-string\">'https://electronjs.org'</span>)\n</code></pre>\n<h3 id=\"new-browserviewoptions-experimental\"><a href=\"#new-browserviewoptions-experimental\"><code>new BrowserView([options])</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>webPreferences</code> Object (opcional) - Vea <a href=\"/docs/api/browser-window\">BrowserWindow</a>.</li>\n</ul></li>\n</ul>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<p>Los objetos creados con <code>new BrowserView</code> tienen las siguientes propiedades:</p>\n<h4 id=\"viewwebcontents-experimental\"><a href=\"#viewwebcontents-experimental\"><code>view.webContents</code> <em>Experimental</em></a></h4>\n<p>Un objeto <a href=\"/docs/api/web-contents\"><code>WebContents</code></a>, que pertenece a esta vista.</p>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<p>Los objetos creados con <code>new BrowserView</code> tiene los siguientes métodos de instancia:</p>\n<h4 id=\"viewsetautoresizeoptions-experimental\"><a href=\"#viewsetautoresizeoptions-experimental\"><code>view.setAutoResize(options)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>width</code> Boolean (optional) - If <code>true</code>, the view's width will grow and shrink together with the window. <code>false</code> por defecto.</li>\n<li><code>height</code> Boolean (optional) - If <code>true</code>, the view's height will grow and shrink together with the window. <code>false</code> por defecto.</li>\n<li><code>horizontal</code> Boolean (optional) - If <code>true</code>, the view's x position and width will grow and shrink proportionally with the window. <code>false</code> por defecto.</li>\n<li><code>vertical</code> Boolean (optional) - If <code>true</code>, the view's y position and height will grow and shrink proportionally with the window. <code>false</code> por defecto.</li>\n</ul></li>\n</ul>\n<h4 id=\"viewsetboundsbounds-experimental\"><a href=\"#viewsetboundsbounds-experimental\"><code>view.setBounds(bounds)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Redimensiona y mueve la vista a los limites proporcionados en relación a la ventana.</p>\n<h4 id=\"viewgetbounds-experimental\"><a href=\"#viewgetbounds-experimental\"><code>view.getBounds()</code> <em>Experimental</em></a></h4>\n<p>Devuelve <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>Los límites <code>bounds</code> de esta instancia de BrowserView como un <code>Object</code>.</p>\n<h4 id=\"viewsetbackgroundcolorcolor-experimental\"><a href=\"#viewsetbackgroundcolorcolor-experimental\"><code>view.setBackgroundColor(color)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>color</code> String - Color in <code>#aarrggbb</code> or <code>#argb</code> form. The alpha channel is optional.</li>\n</ul>",
      "title": "BrowserView",
      "description": "Crear y controlar vistas."
    },
    "/docs/api/browser-window": {
      "locale": "es-ES",
      "slug": "browser-window",
      "href": "/docs/api/browser-window",
      "crowdinFileId": "256287",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-window.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"browserwindow\"><a href=\"#browserwindow\">BrowserWindow</a></h1>\n<blockquote>\n<p>Crea y controla las ventanas del navegador.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">/// In the main process.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-comment\">// Load a remote URL</span>\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\n<span class=\"hljs-comment\">// Or load a local HTML file</span>\nwin.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n</code></pre>\n<h2 id=\"ventana-sin-borde\"><a href=\"#ventana-sin-borde\">Ventana sin borde</a></h2>\n<p>Para crear una ventana sin usar chrome, o una vertana transparente de cualquier forma, puede usar la API <a href=\"/docs/api/frameless-window\">Frameless Window</a>.</p>\n<h2 id=\"mostrar-la-ventana-con-gracia\"><a href=\"#mostrar-la-ventana-con-gracia\">Mostrar la ventana con gracia</a></h2>\n<p>Cuando se carga una página directamente en la ventana, los usuarios pueden ver la página de forma incremental, lo cual no es una buena experiencia para aplicación nativa. Para hacer que la ventana muestre sin un flash visual, hay dos soluciones para diferente situaciones.</p>\n<h3 id=\"usando-el-evento-ready-to-show\"><a href=\"#usando-el-evento-ready-to-show\">Usando el evento <code>ready-to-show</code></a></h3>\n<p>Mientras se carga la página, se emitirá el evento <code>ready-to-show</code> cuando el proceso de renderizado haya procesado la página por primera vez si aún no se ha mostrado la ventana. Si se muestra la ventana despues de este evento, no tendrá fogonazos:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span> })\nwin.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => {\n  win.show()\n})\n</code></pre>\n<p>Este evento generalmente se emite después del evento <code>did-finish-load</code>, pero para páginas con muchos recursos remotos, puede ser emitido antes del evento <code>did-finish-load</code>.</p>\n<p>Por favor tenga en cuanta que usando este evento implica que el renderer será considerado \"visible\" y se pintara incluso si <code>show</code> es falso.  Este evento nunca se disparará si usa <code>paintWhenInitiallyHidden: false</code></p>\n<h3 id=\"estableciendo-la-propiedad-backgroundcolor\"><a href=\"#estableciendo-la-propiedad-backgroundcolor\">Estableciendo la propiedad <code>backgroundColor</code></a></h3>\n<p>Para una aplicación compleja, el evento <code>ready-to-show</code> puede emitirse muy tarde, haciendo que la aplicación parezca lenta. En este caso, se recomienda mostrar la ventana inmediatamente, y usar un color de fondo <code>backgroundColor</code> parecido al color de fondo de la aplicación:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#2e2c29'</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<p>Tenga en cuenta que incluso para aplicaciones que utilizan el evento <code>ready-to-show</code>, aún se recomienda establecer <code>backgroundColor</code> para que la aplicación parezca más nativa.</p>\n<h2 id=\"ventana-principal-y-ventana-secundaria\"><a href=\"#ventana-principal-y-ventana-secundaria\">Ventana principal y ventana secundaria</a></h2>\n<p>Al usar la opción <code>parent</code>, se pueden crean ventanas secundarias:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> top = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n<span class=\"hljs-keyword\">const</span> child = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">parent</span>: top })\nchild.show()\ntop.show()\n</code></pre>\n<p>La ventana <code>child</code> se mostrará siempre por encima de la ventana <code>top</code>.</p>\n<h2 id=\"ventanas-modales\"><a href=\"#ventanas-modales\">Ventanas modales</a></h2>\n<p>Una ventana modal es una ventana secundaria que deshabilita la ventana principal, para crear una ventana modal, hay que establecer ambas opciones <code>parent</code> y <code>modal</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> child = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">parent</span>: top, <span class=\"hljs-attr\">modal</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span> })\nchild.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\nchild.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => {\n  child.show()\n})\n</code></pre>\n<h2 id=\"la-visibilidad-de-la-página\"><a href=\"#la-visibilidad-de-la-página\">La visibilidad de la página</a></h2>\n<p>La <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API\">Page Visibility API</a> funciona de la siguiente manera:</p>\n<ul>\n<li>En todas las plataformas, el estado de visibilidad identifica si la ventana está oculta/minimizada o si no lo está.</li>\n<li>Además, en macOS, el estado de visibilidad también indica el estado de oclusión de la ventana. Si la ventana esta tapada, es decir, completamente cubierta por otra ventana, el estado de visibilidad será <code>hidden</code>. En otras plataformas, el estado de visibilidad será <code>hidden</code> solo si la ventana esta minimizada o explícitamente oculta con <code>win.hide()</code>.</li>\n<li>Si se crea un <code>BrowserWindow</code> con <code>show: false</code>, el estado de visibilidad inicial será <code>visible</code> a pesar de que la ventana esté oculta realmente.</li>\n<li>Si <code>backgroundThrottling</code> está deshabilitado, el estado de visibilidad permanecerá <code>visible</code> incluso si la ventana está minimizada, tapada o oculta.</li>\n</ul>\n<p>Se recomienda detener operaciones costosas cuando el estado de visibilidad está <code>hidden</code> con el fin de minimizar el consumo de energía.</p>\n<h2 id=\"notas-según-la-plataforma\"><a href=\"#notas-según-la-plataforma\">Notas según la plataforma</a></h2>\n<ul>\n<li>En macOS las ventanas modales se mostrarán como hojas adjuntas a la ventana principal.</li>\n<li>En macOS las ventanas secundarias mantendrán la posición relativa a la ventana principal cuando ésta se mueve, mientras que en Windows y Linux las ventanas secundarias no se moverán.</li>\n<li>En Linux el tipo de ventanas modales se cambiará a <code>dialog</code>.</li>\n<li>En Linux, muchos entornos de escritorio no admiten ocultar una ventana modal.</li>\n</ul>\n<h2 id=\"clase-browserwindow\"><a href=\"#clase-browserwindow\">Clase: BrowserWindow</a></h2>\n<blockquote>\n<p>Crea y controla las ventanas del navegador.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p><code>BrowserWindow</code> es un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p>Crea una nueva <code>BrowserWindow</code> con propiedades nativas como las establecidas por las <code>options</code>.</p>\n<h3 id=\"new-browserwindowoptions\"><a href=\"#new-browserwindowoptions\"><code>new BrowserWindow([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>width</code> Integer (opcional) - El ancho de la ventana en pixeles. Por defecto es <code>800</code>.</li>\n<li><code>height</code> Integer (opcional) - La altura de la ventana en pixeles. Por defecto es <code>600</code>.</li>\n<li><code>x</code> Integer (opcional) - (<strong>required</strong> si y es usado) Desplazamiento a la izquierda de la ventana de la pantalla. Por defecto es centrar en la ventana.</li>\n<li><code>y</code> Integer (opcional) - (<strong>required</strong> si x es usado) Desplazamiento superior de la ventana desde la pantalla. Por defecto es centrar en la ventana.</li>\n<li><code>useContentSize</code> Boolean (opcional) - <code>width</code> y <code>height</code> se utilizan como el tamaño de la página web. Esto significa que el tamaño actual de la ventana incluirá el tamaño del marco de la ventana y será un poco más grande. Por defecto es <code>false</code>.</li>\n<li><code>center</code> Boolean (opcional) - Muestra la ventana en el centro de la pantalla.</li>\n<li><code>minWidth</code> Integer (opcional) - Ancho mínimo de a ventana. Por defecto es <code>0</code>.</li>\n<li><code>minHeight</code> Integer (opcional) - Altura mínima de la ventana. Por defecto es <code>0</code>.</li>\n<li><code>maxWidth</code> Integer (opcional) - Ancho máximo de la ventana. Por defecto no hay limite.</li>\n<li><code>maxHeight</code> Integer (opcional) - Altura máxima de la ventana. Por defecto no hay limite.</li>\n<li><code>resizable</code> Boolean (opcional) - Si la ventana puede ser redimencionada. Por defecto es <code>true</code>.</li>\n<li><code>movable</code> Boolean (opcional) - Si la ventana puede ser movida. Esto no está implementado en Linux. Por defecto es <code>true</code>.</li>\n<li><code>minimizable</code> Boolean (opcional) - Si la ventana puede ser minimizada. Esto no está implementado en Linux. Por defecto es <code>true</code>.</li>\n<li><code>maximizable</code> Boolean (opcional) - Si la ventana puede ser maximizada. Esto no está implementado en Linux. Por defecto es <code>true</code>.</li>\n<li><code>closable</code> Boolean (opcional) - Si la ventana puede ser cerrada. Esto no está implementado en Linux. Por defecto es <code>true</code>.</li>\n<li><code>focusable</code> Boolean (opcional) - si la ventana se puede enfocar. Por defecto es <code>true</code>. En Windows, la configuración <code>focusable: false</code> también quiere decir que <code>skipTaskbar: true</code>. En Linux, la configuración <code>focusable: false</code> hace que la ventana deje de interactuar con wm, así la ventana siempre se mantendrá en la parte superior en todas las áreas de trabajo.</li>\n<li><code>alwaysOnTop</code> Boolean (opcional) - Si la ventana debería permanecer siempre por ensima de otras ventanas. Por defecto es <code>false</code>.</li>\n<li><code>fullscreen</code> Boolean(opcional) - si la ventana debería mostrarse en pantalla completa. Cuando se establece explícitamente <code>false</code> el botón de la pantalla completa estará oculta o deshabilitada en macOS. Por defecto es <code>false</code>.</li>\n<li><code>fullscreenable</code> Boolean (opcional) - si la ventana puede ponerse el modo pantalla completa. En macOS, también si el botón maximizar o acercarse debería alternar el modo pantalla completa o maximizar la ventana. Por defecto es <code>true</code>.</li>\n<li><code>simpleFullscreen</code> Boolean (opcional) - Usa pantalla completa pre-Lion en macOS. Por defecto es <code>false</code>.</li>\n<li><code>skipTaskbar</code> Boolean (opcional) - Si mostrar la ventana en la barra de tarea. Por defecto es <code>false</code>.</li>\n<li><code>kiosk</code> Boolean (opcional) - Si la ventana está en modo kiosk. Por defecto es <code>false</code>.</li>\n<li><code>title</code> String (opcional) - Titulo de la ventana por defecto. Por defecto es <code>\"Electron\"</code>. Si la etiqueta HTML <code>&#x3C;title></code> es definida en el archivo HTML cargado por <code>loadURL()</code>, esta propiedad será ignorada.</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (opcional) - El icono de la ventana. En Windows, se recomienda usar iconos <code>ICO</code> para obtener mejores efectos visuales. También se se puede dejar sin definir, de esta manera se utilizará el icono del ejecutable.</li>\n<li><code>show</code> Boolean (opcional) - Si la ventana debería ser mostrada cuando se crea. Por defecto es <code>true</code>.</li>\n<li><code>paintWhenInitiallyHidden</code> Boolean (opcional) - Si el renderer debería estar activo cuando <code>show</code> es <code>false</code> y recién ha sido creado.  Para que <code>document.visibilityState</code> funcione correctamente en la primera carga con <code>show: false</code> debería establecer esto a <code>false</code>.  Estableciendo esto a <code>false</code> causará que el evento <code>ready-to-show</code> no se dispare.  Por defecto es <code>true</code>.</li>\n<li><code>frame</code> Boolean (opcional) - Especifica <code>false</code> para crear un <a href=\"/docs/api/frameless-window\">Frameless Window</a>. Por defecto es <code>true</code>.</li>\n<li><code>parent</code> BrowserWindow (opcional) - Especifica la ventana padre. Por defecto es <code>null</code>.</li>\n<li><code>modal</code> Boolean (opcional) - Si es una ventana modal. Esto sólo funciona cuando la ventana es una ventana hija. Por defecto es <code>false</code>.</li>\n<li><code>acceptFirstMouse</code> Boolean (optional) - Whether clicking an inactive window will also click through to the web contents. Default is <code>false</code> on macOS. This option is not configurable on other platforms.</li>\n<li><code>disableAutoHideCursor</code> Boolean (opcional) - Si ocultar el cursor cuando se está escriniendo. Por defecto es <code>false</code>.</li>\n<li><code>autoHideMenuBar</code> Boolean (opcional) - Auto ocultar la barra de menú a menos que la tecla <code>Alt</code> este presionada. Por defecto es <code>false</code>.</li>\n<li><code>enableLargerThanScreen</code> Boolean (opcional) - Permite que la ventana se redimensione mayor que la pantalla. Solo relevante para macOS, ya que los otros sistemas operativos permiten ventanas más grandes que la pantalla por defecto. Por defecto es <code>false</code>.</li>\n<li><code>backgroundColor</code> String (opcional) - El color de fondo de la Ventana como un valor hexadecimal, como <code>#66CD00</code> o <code>#FFF</code> o <code>#80FFFFFF</code> (alfa en formato #AARRGGBB es soportado si <code>transparent</code> es establecido a <code>true</code>). Por defecto es <code>#FFF</code> (blanco).</li>\n<li><code>hasShadow</code> Boolean (opcional) - Si la ventana debería tener una sombra. Por defecto es <code>true</code>.</li>\n<li><code>opacity</code> Number (opcional) - Establece la opacidad inicial de la ventana, entre 0.0 (totalmente transparente) y 1.0 (totalmente opaco). Esto sólo está implementado en Windows y macOS.</li>\n<li><code>darkTheme</code> Boolean (opcional) - Fuerza el uso del tema obscuro en la ventana, solo funciona en algunos entornos de escritorio GTK+3. Por defecto es <code>false</code>.</li>\n<li><code>transparent</code> Boolean (opcional) - Hace la ventana <a href=\"/docs/api/frameless-window#transparent-window\">tranparente</a>. Por defecto es <code>false</code>. En Windows, no funciona a menos que la ventana sea sin marco.</li>\n<li><code>type</code> String (opcional) - El tipo de ventana, por defecto es una ventana normal. Vea más sobre esto a continuación.</li>\n<li><code>visualEffectState</code> String (opcional) - Especifica como la apariencia del material debe reflejar el estado de actividad de la ventana en macOS. Must be used with the <code>vibrancy</code> property. Los valores posibles son:<ul>\n<li><code>followWindow</code> - The backdrop should automatically appear active when the window is active, and inactive when it is not. Este es el valor predeterminado.</li>\n<li><code>active</code> - The backdrop should always appear active.</li>\n<li><code>inactive</code> - The backdrop should always appear inactive.</li>\n</ul></li>\n<li><code>titleBarStyle</code> String (optional) <em>macOS</em> <em>Windows</em> - The style of window title bar. Por defecto es <code>default</code>. Los valores posibles son:<ul>\n<li><code>default</code> - Results in the standard title bar for macOS or Windows respectively.</li>\n<li><code>hidden</code> - Results in a hidden title bar and a full size content window. On macOS, the window still has the standard window controls (“traffic lights”) in the top left. On Windows, when combined with <code>titleBarOverlay: true</code> it will activate the Window Controls Overlay (see <code>titleBarOverlay</code> for more information), otherwise no window controls will be shown.</li>\n<li><code>hiddenInset</code> - Only on macOS, results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge.</li>\n<li><code>customButtonsOnHover</code> - Only on macOS, results in a hidden title bar and a full size content window, the traffic light buttons will display when being hovered over in the top left of the window.  <strong>Note:</strong> Esta opción es experimental actualmente.</li>\n</ul></li>\n<li><code>trafficLightPosition</code> <a href=\"/docs/api/structures/point\">Point</a> (opcional) - Establece una posición para los botones del semáforo en ventanas sin marco.</li>\n<li><code>roundedCorners</code> Boolean (opcional) - Si la ventana sin marco debería tener o no esquinas redondeadas macOS. Por defecto es <code>true</code>.</li>\n<li><code>fullscreenWindowTitle</code> Boolean (opcional) <em>Obsoleto</em> - Muestra el título en la barra de título en el modo de pantalla completa en macOS para <code>hiddenInset</code> titleBarStyle. Por defecto es <code>false</code>.</li>\n<li><code>thickFrame</code> Boolean (opcional) - Utilice el estilo <code>WS_THICKFRAME</code> para ventanas sin marco en Windows, la cual agrega un marco de ventana estándar. Configurarlo en <code>false</code> eliminará la sombra de la ventana y las animaciones de la ventana. Por defecto es <code>true</code>.</li>\n<li><code>vibrancy</code> Cadena (opcional) - Añade un tipo de efecto de vibración a la ventana. Funciona solamente en macOS. Puede ser <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>titlebar</code>, <code>selection</code>, <code>menu</code>, <code>popover</code>, <code>sidebar</code>, <code>medium-light</code>, <code>ultra-dark</code>, <code>header</code>, <code>sheet</code>, <code>window</code>, <code>hud</code>, <code>fullscreen-ui</code>, <code>tooltip</code>, <code>content</code>, <code>under-window</code>, o <code>under-page</code>. Por favor tenga en cuenta que <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>medium-light</code>, and <code>ultra-dark</code> están obsoletas y han sido eliminadas en macOS Catalina (10.15).</li>\n<li><code>zoomToPageWidth</code> Boolean (optional) - Controls the behavior on macOS when option-clicking the green stoplight button on the toolbar or by clicking the Window > Zoom menu item. Si es <code>true</code>, la ventana crecerá al ancho recomendado de la página web cuando se haga zoom. <code>false</code> hará que haga zoom hasta el ancho de la pantalla. Esto también afectará el comportamiento cuando se llama directamente <code>maximize()</code>. Por defecto es <code>false</code>.</li>\n<li><code>tabbingIdentifier</code> String (opcional) - Crea una pestaña del nombre del grupo. Permite abrir la ventana como una pestaña nativa en macOC 10.12+. Las ventanas con el mismo identificador de pestaña se agruparán juntos. Esto también añade un nuevo botón de pestañas nativo a la barra de pestañas de la ventana y permite que la <code>app</code> y la ventana reciban el evento <code>new-window-for-tab</code>.</li>\n<li><code>webPreferences</code> Object (optional) - Settings of web page's features.<ul>\n<li><code>devTools</code> Boolean (opcional) - Si se habilita el DevTools. Si se configura a <code>false</code>, no puede utilizarse <code>BrowserWindow.webContents.openDevTools()</code> para abrir DevTools. Por defecto es <code>true</code>.</li>\n<li><code>nodeIntegration</code> Boolean (optional) - Whether node integration is enabled. Por defecto es <code>false</code>.</li>\n<li><code>nodeIntegrationInWorker</code> Boolean (opcional) - Si la integración de nodos está habilitada en los trabajadores de la web. Por defecto es <code>false</code>. Se pueden encontrar más detalles en <a href=\"/docs/tutorial/multithreading\">Multithreading</a>.</li>\n<li><code>nodeIntegrationInSubFrames</code> Boolean (opcional) - Opcion experimental para habilitar soporte Node.js en sub-frames como iframes y ventas hijos. Todos tus preloads cargarán por cada iframe, puedes usar <code>process.isMainFrame</code> para determinar si estás en el marco principal o no.</li>\n<li><code>preload</code> String (opcional) - Especifica un script que será cargado antes del otros scripts en la página. Este script siempre tendrá acceso al nodo APIs sin importar si la integración de nodos esté activada o no. El valor debería ser la ruta del archivo absoluto al script. Cuando la integración de nodos esta desactivada, la precarga del script puede reintroducir de vuelta al ámbito global los símbolos globales del Nodo. Ver ejemplo <a href=\"/docs/api/context-bridge#exposing-node-global-symbols\">aquí</a>.</li>\n<li><code>sandbox</code> Boolean (opcional) - Si se configura, protegerá al renderizador asociado a la ventana, haciéndolo compatible con el sandbox de Chromium OS-level, deshabilitando el motor Node.js. Esto no es lo mismo que la opción de <code>nodeIntegration</code> y las APIs disponibles para el script de precarga son más limitadas. Leer más sobre la opción <a href=\"/docs/tutorial/sandbox\">aquí</a>.</li>\n<li><code>session</code> <a href=\"/docs/api/session#class-session\">Session</a> (opcional) - Configura la sesión usada por la página. En lugar de pasar directamente el objeto de la sesión, se puede optar por utilizar la opción de <code>partition</code>, la cual acepta una cadena de partición. Cuando se proporcionen <code>session</code> y <code>partition</code>, se preferirá <code>session</code>. Default es la sesión por defecto.</li>\n<li><code>partition</code> Cadena (opcional) - Configura la sesión utilizada por la página según la cadena de partición de la sesión. Si la <code>partition</code> empieza con <code>persist:</code>, la página utilizará una sesión persistente disponible para todas las páginas en la partición con la misma <code>partition</code>. Si no está el prefijo <code>persist:</code>, la página usara una sesión de la memoria interna. Al asignar la misma <code>partition</code>, las páginas múltiples pueden compartir la misma sesión. Default es la sesión por defecto.</li>\n<li><code>zoomFactor</code> Number (optional) - The default zoom factor of the page, <code>3.0</code> represents <code>300%</code>. Por defecto es <code>1.0</code>.</li>\n<li><code>javascript</code> Boolean (optional) - Enables JavaScript support. Por defecto es <code>true</code>.</li>\n<li><code>webSecurity</code> Boolean (opcional) - Cuando es <code>false</code>, desactivará la política de same-origin (por lo general se utiliza cuando la gente prueba los sitios web), y configurará <code>allowRunningInsecureContent</code>a <code>true</code> en caso de que estas opciones no hayan sido configuradas por el usuario. Por defecto es <code>true</code>.</li>\n<li><code>allowRunningInsecureContent</code> Boolean (optional) - Allow an https page to run JavaScript, CSS or plugins from http URLs. Por defecto es <code>false</code>.</li>\n<li><code>images</code> Boolean (optional) - Enables image support. Por defecto es <code>true</code>.</li>\n<li><code>imageAnimationPolicy</code> String (opcional) - Especifica cómo correr la animaciones de la imagen (P.e. GIFs).  Puede ser <code>animate</code>, <code>animateOnce</code> o <code>noAnimation</code>.  Predeterminadamente, es <code>animate</code>.</li>\n<li><code>textAreasAreResizable</code> Boolean (optional) - Make TextArea elements resizable. Default is <code>true</code>.</li>\n<li><code>webgl</code> Boolean (optional) - Enables WebGL support. Por defecto es <code>true</code>.</li>\n<li><code>plugins</code> Boolean (optional) - Whether plugins should be enabled. Por defecto es <code>false</code>.</li>\n<li><code>experimentalFeatures</code> Boolean (optional) - Enables Chromium's experimental features. Por defecto es <code>false</code>.</li>\n<li><code>scrollBounce</code> Boolean (optional) - Enables scroll bounce (rubber banding) effect on macOS. Por defecto es <code>false</code>.</li>\n<li><code>enableBlinkFeatures</code> String (opcional) - Una lista de cadenas de características separadas por <code>,</code>, para habilitar como <code>CSSVariables,KeyboardEventKey</code>. La lista completa de cadenas distintivas soportadas pueden encontrarse en el archivo <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a>.</li>\n<li><code>disableblinkFeatures</code> String (opcional) - Una lista de cadenas distintivas separadas por <code>,</code>,como <code>CSSVariables,KeyboardEventKey</code> para deshabilitar. La lista completa de cadenas características soportadas puede ser encontrada en el archivo <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a>.</li>\n<li><code>defaultFontFamily</code> Object (optional) - Sets the default font for the font-family.<ul>\n<li><code>standard</code> String (opcional) - Por defecto es <code>Times New Roman</code>.</li>\n<li><code>serif</code> String (opcional) - Por defecto es <code>Times New Roman</code>.</li>\n<li><code>sansSerif</code> String (opcional) - Por defecto es <code>Arial</code>.</li>\n<li><code>monospace</code> String (opcional) - Por defecto es <code>Courier New</code>.</li>\n<li><code>cursive</code> String (opcional) - Por defecto es <code>Script</code>.</li>\n<li><code>fantasy</code> String (opcional) - Por defecto es <code>Impact</code>.</li>\n</ul></li>\n<li><code>defaultFontSize</code> Integer (opcional) - Por defecto es <code>16</code>.</li>\n<li><code>defaultMonospaceFontSize</code> Integer (opcional) - Por defecto es <code>13</code>.</li>\n<li><code>minimumFontSize</code> Integer (opcional) - Por defecto es <code>0</code>.</li>\n<li><code>defaultEncoding</code> String (opcional) - Por defecto es <code>ISO-8859-1</code>.</li>\n<li><code>backgroundThrottling</code> Boolean (opcional) - Para acelerar animaciones y temporizadores cuando la página esta al fondo. Esto también afecta a <a href=\"#page-visibility\">Page Visibility API</a>. Por defecto es <code>true</code>.</li>\n<li><code>offscreen</code> Boolean(optional) - Para habilitar el renderizado offscreen para el navegador de la ventana. Por defecto es <code>false</code>. Para más detalles, ver <a href=\"/docs/tutorial/offscreen-rendering\">offscreen rendering tutorial</a>.</li>\n<li><code>contextIsolation</code> Boolean(opcional) - Para ejecutar las APIs de Electron y el script especificado <code>preload</code> en un contexto JavaScript independiente. Por defecto es <code>true</code>. The context that the <code>preload</code> script runs in will only have access to its own dedicated <code>document</code> and <code>window</code> globals, as well as its own set of JavaScript builtins (<code>Array</code>, <code>Object</code>, <code>JSON</code>, etc.), which are all invisible to the loaded content. The Electron API will only be available in the <code>preload</code> script and not the loaded page. This option should be used when loading potentially untrusted remote content to ensure the loaded content cannot tamper with the <code>preload</code> script and any Electron APIs being used.  Esta opción utiliza la misa técnica usada por <a href=\"https://developer.chrome.com/extensions/content_scripts#execution-environment\">Chrome Content Scripts</a>.  You can access this context in the dev tools by selecting the 'Electron Isolated Context' entry in the combo box at the top of the Console tab.</li>\n<li><code>nativeWindowOpen</code> Boolean (opcional) - Si se usa el nativo <code>window.open()</code>. Por defecto es <code>true</code>. Las ventanas hijas siempre tienen la integración con node desabilidata a menos que <code>nodeIntegrationInSubFrames</code> es true.</li>\n<li><code>webviewTag</code> Boolean (opcional) - Si se habilita o no el <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code> tag</a>. Por defecto es <code>false</code>. <strong>Nota:</strong> El script <code>preload</code> configurado para el <code>&#x3C;webview></code>tendrá la integración de nodos habilitada cuando se ejecuta por lo que hay que asegurarse que el contenido remoto o posiblemente dañino no sea capaz de crear una etiqueta de <code>&#x3C;webview></code>con un script <code>preload</code> posiblemente malicioso. Puede utilizarse el evento <code>will-attach-webview</code> en <a href=\"/docs/api/web-contents\">webContents</a> para quitar el script <code>preload</code> y validar o alterar la configuración inicial de <code>&#x3C;webview></code>.</li>\n<li><code>additionalArguments</code> String<a href=\"/docs/api/optional\"></a> - A list of strings that will be appended to <code>process.argv</code> in the renderer process of this app.  Useful for passing small bits of data down to renderer process preload scripts.</li>\n<li><code>safeDialogs</code> Boolean (optional) - Whether to enable browser style consecutive dialog protection. Por defecto es <code>false</code>.</li>\n<li><code>safeDialogsMessage</code> String (opcional) - El mensaje a mostrar cuando la protección de diálogo consecutivo es lanzada. So no se define el mensaje por defecto sería utilizado, note que actualmente el mensaje por defecto esta en Inglés y no localizado.</li>\n<li><code>disableDialogs</code> Boolean (optional) - Whether to disable dialogs completely. Overrides <code>safeDialogs</code>. Por defecto es <code>false</code>.</li>\n<li><code>navigateOnDragDrop</code> Boolean (optional) - Whether dragging and dropping a file or link onto the page causes a navigation. Por defecto es <code>false</code>.</li>\n<li><code>autoplayPolicy</code> String (opcional) - Política de autoplay para aplicar al contenido en la ventana, puede ser <code>no-user-gesture-required</code>, <code>user-gesture-required</code>, <code>document-user-activation-required</code>. Por defecto a <code>no-user-gesture-required</code>.</li>\n<li><code>disableHtmlFullscreenWindowResize</code> Boolean (optional) - Whether to prevent the window from resizing when entering HTML Fullscreen. Default is <code>false</code>.</li>\n<li><code>accessibleTitle</code> String (optional) - An alternative title string provided only to accessibility tools such as screen readers. Esta cadena no es directamente visible para los usuarios.</li>\n<li><code>spellcheck</code> Boolean (optional) - Whether to enable the builtin spellchecker. Por defecto es <code>true</code>.</li>\n<li><code>enableWebSQL</code> Boolean (optional) - Whether to enable the <a href=\"https://www.w3.org/TR/webdatabase/\">WebSQL api</a>. Por defecto es <code>true</code>.</li>\n<li><code>v8CacheOptions</code> String (optional) - Enforces the v8 code caching policy used by blink. Accepted values are<ul>\n<li><code>none</code> - Disables code caching</li>\n<li><code>code</code> - Heuristic based code caching</li>\n<li><code>bypassHeatCheck</code> - Bypass code caching heuristics but with lazy compilation</li>\n<li><code>bypassHeatCheckAndEagerCompile</code> - Same as above except compilation is eager. Default policy is <code>code</code>.</li>\n</ul></li>\n<li><code>enablePreferredSizeMode</code> Boolean (optional) - Whether to enable preferred size mode. The preferred size is the minimum size needed to contain the layout of the document—without requiring scrolling. Enabling this will cause the <code>preferred-size-changed</code> event to be emitted on the <code>WebContents</code> when the preferred size changes. Por defecto es <code>false</code>.</li>\n</ul></li>\n<li><code>titleBarOverlay</code> Object | Boolean (opcional) -  Cuando se usa una ventana sin marco en conjunción con <code>win.setWindowButtonVisibility(true)</code> en macOS o usando <code>titleBarStyle</code> para que los controles de la  ventana estándar (\"traffic lights\" en macOS) estén visibles, esta propiedad activa el  Window Controls Overlay <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis\">JavaScript APIs</a> y <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables\">CSS Environment Variables</a>. Specifying <code>true</code> will result in an overlay with default system colors. Por defecto es <code>false</code>.<ul>\n<li><code>color</code> String (optional) <em>Windows</em> - The CSS color of the Window Controls Overlay when enabled. Default is the system color.</li>\n<li><code>symbolColor</code> String (optional) <em>Windows</em> - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Cuando se configura el tamaño máximo o mínimo de la ventana con <code>minWidth</code>/<code>maxWidth</code>/ <code>minHeight</code>/<code>maxHeight</code>, solo limita a los usuarios. No impide pasar de un tamaño que no sigue las restricciones de tamaño a<code>setBounds</code>/<code>setSize</code> o al constructor de <code>BrowserWindow</code>.</p>\n<p>Los posibles valores y comportamientos de la opción <code>type</code> son dependientes de la plataforma. Los valores posibles son:</p>\n<ul>\n<li>En linux, los tipos posibles son <code>desktop</code>, <code>dock</code>, <code>toolbar</code>, <code>splash</code>, <code>notification</code>.</li>\n<li>En macOS, los posibles tipos son <code>desktop</code>, <code>textured</code>.<ul>\n<li>El tipo <code>textured</code> añade una aspecto de tono metálico (<code>NSTexturedBackgroundWindowMask</code>).</li>\n<li>El tipo <code>desktop</code> coloca la ventana en el nivel de la ventana de fondo de escritorio (<code>kCGDesktopWindowLevel - 1</code>). Tenga en cuenta que la ventana de escritorio no recibirá enfoque alguno, ni eventos del ratón o del teclado, pero se puede utilizar <code>globalShortcut</code> para recibir input con moderación.</li>\n</ul></li>\n<li>En Windows, el tipo posible es <code>toolbar</code>.</li>\n</ul>\n<h3 id=\"eventos-de-instancia\"><a href=\"#eventos-de-instancia\">Eventos de Instancia</a></h3>\n<p>Los objetos creados con <code>new BrowserWindow</code> emiten los siguientes eventos:</p>\n<p><strong>Nota:</strong> Algunos eventos sólo están disponibles en sistemas operativos específicos y se etiquetan como tal.</p>\n<h4 id=\"evento-page-title-updated\"><a href=\"#evento-page-title-updated\">Evento: 'page-title-updated'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolen</li>\n</ul>\n<p>Aparece cuando el documento cambia el título. Llamar <code>event.preventDefault()</code> evitará que el título de la ventana nativa cambie. <code>explicitSet</code> es falso cuando el título se sintetiza a partir de la URL del archivo.</p>\n<h4 id=\"evento-close\"><a href=\"#evento-close\">Evento: \"close\"</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n</ul>\n<p>Aparece cuando la ventana se va a cerrar. Se emite antes de el evento del DOM <code>beforeunload</code> y <code>unload</code>. Llamar a <code>event.preventDefault()</code> cancelará el cierre.</p>\n<p>Generalmente se desea utilizar el controlador <code>beforeunload</code> para decidir si la ventana debería ser cerrada, el cual también será llamado cuando la ventada se vuelva a cargar. En Electron, devolver cualquier valor que no sea <code>undefined</code> cancelará el cierre. Por ejemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-built_in\">window</span>.onbeforeunload = <span class=\"hljs-function\">(<span class=\"hljs-params\">e</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'I do not want to be closed'</span>)\n\n  <span class=\"hljs-comment\">// Unlike usual browsers that a message box will be prompted to users, returning</span>\n  <span class=\"hljs-comment\">// a non-void value will silently cancel the close.</span>\n  <span class=\"hljs-comment\">// It is recommended to use the dialog API to let the user confirm closing the</span>\n  <span class=\"hljs-comment\">// application.</span>\n  e.returnValue = <span class=\"hljs-literal\">false</span> <span class=\"hljs-comment\">// equivalente a `return false` pero no es recomendado</span>\n}\n</code></pre>\n<p><em><strong>Nota</strong>: Hay una diferencia sutil entre el comportamiento de <code>window.onbeforeunload = handler</code> y <code>window.addEventListener('beforeunload', handler)</code>. Se recomienda siempre establecer el <code>event.returnValue</code> explícitamente, en lugar de devolver sólo un valor, ya que el primero funciona más consistentemente dentro de Electron.</em></p>\n<h4 id=\"evento-closed\"><a href=\"#evento-closed\">Evento: \"closed\"</a></h4>\n<p>Emitted when the window is closed. Después de haber recibido este evento, debe eliminar la referencia a la ventana y evitar volverla a usar.</p>\n<h4 id=\"evento-session-end-windows\"><a href=\"#evento-session-end-windows\">Evento: \"session-end\" <em>Windows</em></a></h4>\n<p>Aparece cuando la sesión de la ventana va a terminarse debido a un cierre forzoso o el reinicio de la máquina o el cierre de la sesión.</p>\n<h4 id=\"evento-unresponsive\"><a href=\"#evento-unresponsive\">Evento: \"unresponsive\"</a></h4>\n<p>Aparece cuando la página web deja de responder.</p>\n<h4 id=\"evento-responsive\"><a href=\"#evento-responsive\">Evento: \"responsive\"</a></h4>\n<p>Aparece cuando la página web que no responde vuelve a responder.</p>\n<h4 id=\"evento-blur\"><a href=\"#evento-blur\">Evento: \"blur\"</a></h4>\n<p>Aparece cuando la ventana pierde el enfoque.</p>\n<h4 id=\"evento-focus\"><a href=\"#evento-focus\">Evento: \"focus\"</a></h4>\n<p>Aparece cuando la ventana recupera el enfoque.</p>\n<h4 id=\"evento-show\"><a href=\"#evento-show\">Evento: \"show\"</a></h4>\n<p>Aparece cuando se muestra la ventana.</p>\n<h4 id=\"evento-hide\"><a href=\"#evento-hide\">Evento: \"hide\"</a></h4>\n<p>Aparece cuando se oculta la ventana.</p>\n<h4 id=\"evento-ready-to-show\"><a href=\"#evento-ready-to-show\">Evento: \"ready-to-show\"</a></h4>\n<p>Aparece cuando la página web ha sido renderizada (mientras no está siendo mostrada) y la ventana puede mostrarse sin un visual flash.</p>\n<p>Por favor tenga en cuanta que usando este evento implica que el renderer será considerado \"visible\" y se pintara incluso si <code>show</code> es falso.  Este evento nunca se disparará si usa <code>paintWhenInitiallyHidden: false</code></p>\n<h4 id=\"evento-maximize\"><a href=\"#evento-maximize\">Evento: \"maximize\"</a></h4>\n<p>Aparece cuando se maximiza la ventana.</p>\n<h4 id=\"evento-unmaximize\"><a href=\"#evento-unmaximize\">Evento: \"unmaximize\"</a></h4>\n<p>Aparece cuando la ventana sale de un estado maximizado.</p>\n<h4 id=\"evento-minimize\"><a href=\"#evento-minimize\">Evento: \"minimize\"</a></h4>\n<p>Aparece cuando se minimiza la ventana.</p>\n<h4 id=\"evento-restore\"><a href=\"#evento-restore\">Evento: \"restore\"</a></h4>\n<p>Aparece cuando se restaura la ventana de un estado minimizado.</p>\n<h4 id=\"event-will-resize-macos-windows\"><a href=\"#event-will-resize-macos-windows\">Event: 'will-resize' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>newBounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Tamaño de la ventana en que esta siendo redimensionada.</li>\n<li><code>details</code> Object<ul>\n<li><code>edge</code> (String) - El borde de la ventana siendo arrastrada para cambiar el tamaño. Puede ser <code>bottom</code>, <code>left</code>, <code>right</code>, <code>top-left</code>, <code>top-right</code>, <code>bottom-left</code> o <code>bottom-right</code>.</li>\n</ul></li>\n</ul>\n<p>Emitido antes de que la ventana sea redimensionada. Llamar a <code>event.preventDefault()</code> evitará que la ventana sea redimensionada.</p>\n<p>Tenga en cuenta que esto solo es emitido cuando la venta está siendo redimensionada de forma manual. Redimensionar la ventana con <code>setBounds</code>/<code>setSize</code> no emitirá este evento.</p>\n<p>Los posibles valores y comportamientos de la opción <code>edge</code> son dependientes de la plataforma. Los valores posibles son:</p>\n<ul>\n<li>En Windows, los posibles valores son <code>bottom</code>, <code>top</code>, <code>left</code>, <code>right</code>, <code>top-left</code>, <code>top-right</code>, <code>bottom-left</code>, <code>bottom-right</code>.</li>\n<li>En macOS, los posibles valores son <code>bottom</code> y <code>right</code>.<ul>\n<li>El valor <code>bottom</code> es usado para denotar un cambio de tamaño vertical.</li>\n<li>El valor <code>right</code> es usado para denotar un cambio de tamaño horizontal.</li>\n</ul></li>\n</ul>\n<h4 id=\"evento-resize\"><a href=\"#evento-resize\">Evento: \"resize\"</a></h4>\n<p>Emitido después que la ventana se haya redimensionada.</p>\n<h4 id=\"evento-resized-macos-windows\"><a href=\"#evento-resized-macos-windows\">Evento: 'resized' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Emitted once when the window has finished being resized.</p>\n<p>This is usually emitted when the window has been resized manually. On macOS, resizing the window with <code>setBounds</code>/<code>setSize</code> and setting the <code>animate</code> parameter to <code>true</code> will also emit this event once resizing has finished.</p>\n<h4 id=\"evento-will-move-macos-windows\"><a href=\"#evento-will-move-macos-windows\">Evento: 'will-move' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>newBounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Ubicación a la que se está moviendo la ventana.</li>\n</ul>\n<p>Emitted before the window is moved. On Windows, calling <code>event.preventDefault()</code> will prevent the window from being moved.</p>\n<p>Tenga en cuenta que esto solo es emitido cuando la venta está siendo redimensionada de forma manual. Redimensionar la ventana con <code>setBounds</code>/<code>setSize</code> no emitirá este evento.</p>\n<h4 id=\"evento-move\"><a href=\"#evento-move\">Evento: \"move\"</a></h4>\n<p>Aparece cuando la ventana se mueve a una nueva posición.</p>\n<h4 id=\"evento-moved-macos-windows\"><a href=\"#evento-moved-macos-windows\">Evento: 'moved' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Aparece solo una vez cuando la ventana se mueve a una nueva posición.</p>\n<p><strong>Note</strong>: En macOS este evento es un alias de <code>move</code>.</p>\n<h4 id=\"evento-enter-full-screen\"><a href=\"#evento-enter-full-screen\">Evento: \"enter-full-screen\"</a></h4>\n<p>Aparece cuando la ventana entra en un estado pantalla completa.</p>\n<h4 id=\"evento-leave-full-screen\"><a href=\"#evento-leave-full-screen\">Evento: \"leave-full-screen\"</a></h4>\n<p>Aparece cuando la ventana sale del estado pantalla completa.</p>\n<h4 id=\"evento-enter-html-full-screen\"><a href=\"#evento-enter-html-full-screen\">Evento: \"enter-html-full-screen\"</a></h4>\n<p>Aparece cuando la ventana entra en un estado pantalla completa activado por la API HTML.</p>\n<h4 id=\"evento-leave-html-full-screen\"><a href=\"#evento-leave-html-full-screen\">Evento: \"leave-html-full-screen\"</a></h4>\n<p>Aparece cuando la ventana sale de un estado pantalla completa activado por la API HTML.</p>\n<h4 id=\"evento-always-on-top-changed\"><a href=\"#evento-always-on-top-changed\">Evento: 'always-on-top-changed'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>isAlwaysOnTop</code> Boolean</li>\n</ul>\n<p>Emitido cuando la ventana es configurada o no configurada para mostrarse siempre en la parte superior de las otras ventanas.</p>\n<h4 id=\"evento-app-command-windows-linux\"><a href=\"#evento-app-command-windows-linux\">Evento: 'app-command' <em>Windows</em> <em>Linux</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>command</code> Cadena</li>\n</ul>\n<p>Aparece cuando se invoca un <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/ms646275(v=vs.85).aspx\">App Command</a>. Estos están generalmente relacionados a las teclas del teclado o a los comandos del navegador, así como el botón \"Back\" está en algunos ratones en Windows.</p>\n<p>Los comandos están en minuscula, los guiones bajos son remplazados por guiones, y el prefijo <code>APPCOMMAND_</code> se elimina. por ejemplo, <code>APPCOMMAND_BROWSER_BACKWARD</code> aparece como <code>browser-backward</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-comment\">// Navigate the window back when the user hits their mouse back button</span>\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'browser-backward'</span> &#x26;&#x26; win.webContents.canGoBack()) {\n    win.webContents.goBack()\n  }\n})\n</code></pre>\n<p>Los siguientes comandos de aplicación están explícitamente soportados en Linux:</p>\n<ul>\n<li><code>browser-backward</code></li>\n<li><code>browser-forward</code></li>\n</ul>\n<h4 id=\"evento-scroll-touch-beginmacos\"><a href=\"#evento-scroll-touch-beginmacos\">Evento: \"scroll-touch-begin\"<em>macOS</em></a></h4>\n<p>Aparece cuando la fase del evento de la rueda de desplazamiento ha empezado.</p>\n<h4 id=\"evento-scroll-touch-endmacos\"><a href=\"#evento-scroll-touch-endmacos\">Evento: \"scroll-touch-end\"<em>macOS</em></a></h4>\n<p>Aparece cuando la fase del evento de la rueda de desplazamiento ha concluido.</p>\n<h4 id=\"evento-scroll-touch-edgemacos\"><a href=\"#evento-scroll-touch-edgemacos\">Evento: \"scroll-touch-edge\"<em>macOS</em></a></h4>\n<p>Aparece cuando la fase del evento de la rueda desplazamiento ha alcanzado el borde del elemento.</p>\n<h4 id=\"evento-swipe-macos\"><a href=\"#evento-swipe-macos\">Evento: \"swipe\" <em>macOS</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>direction</code> String</li>\n</ul>\n<p>Emitted on 3-finger swipe. Possible directions are <code>up</code>, <code>right</code>, <code>down</code>, <code>left</code>.</p>\n<p>El método subyacente a este evento esta construido para manejar el viejo estilo de desplazamiento del trackpad de macOS, donde el contenido de la pantalla no se mueve con el manotazo. La mayoría de los trackpads de macOS ya no están configurados para permitir este tipo de movimiento,  así que para emitir correctamente la preferencia 'Desplazamiento entre paginas' en <code>System Preferences > Trackpad > More Gestures</code> debe establecer a 'Desplazar con dos o tres dedos'.</p>\n<h4 id=\"evento-rotate-gesture-macos\"><a href=\"#evento-rotate-gesture-macos\">Evento: 'rotate-gesture' <em>macOS</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>rotation</code> Float</li>\n</ul>\n<p>Emitido en el gesto de rotación del trackpad. Emitido continuamente hasta que el gesto de rotación se termine. El valor de <code>rotation</code> en cada emisión es el angulo en grado rotado desde la última emisión. El último evento emitido sobra un gesto de rotación siempre será el valor de <code>0</code>. Los valores de rotación en sentido contrario a las agujas del reloj son positivos, mientras que los del sentido de las agujas del reloj son Negativo.</p>\n<h4 id=\"evento-sheet-begin-macos\"><a href=\"#evento-sheet-begin-macos\">Evento: \"sheet-begin\" <em>macOS</em></a></h4>\n<p>Aparece cuando la ventana abre una hoja.</p>\n<h4 id=\"evento-sheet-end-macos\"><a href=\"#evento-sheet-end-macos\">Evento: \"sheet-end\" <em>macOS</em></a></h4>\n<p>Aparece cuando la ventana cierra una hoja.</p>\n<h4 id=\"evento-new-window-for-tab-macos\"><a href=\"#evento-new-window-for-tab-macos\">Evento: \"new-window-for-tab\" <em>macOS</em></a></h4>\n<p>Aparece cuando se hace clic al botón de nueva pestaña nativa.</p>\n<h4 id=\"evento-system-context-menu-windows\"><a href=\"#evento-system-context-menu-windows\">Evento: 'system-context-menu' <em>Windows</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a> - Las coordenadas de la pantalla del menú contextual que fue activado en</li>\n</ul>\n<p>Emitido cuando el menú contextual del sistema es activado en la ventana, esto normalmente solo es activado cuando el usuario hace click derecho en el área que no es del cliente de la ventana.  Esto es la barra de titulo de la ventana o cualquier área que haya declarado como <code>-webkit-app-region: drag</code> en una ventana sin marco.</p>\n<p>Llamando a <code>event.preventDefault()</code> evitara que el menú sea mostrado.</p>\n<h3 id=\"métodos-estáticos\"><a href=\"#métodos-estáticos\">Métodos Estáticos</a></h3>\n<p>La clase <code>BrowserWindow</code> tiene los siguientes métodos estáticos:</p>\n<h4 id=\"browserwindowgetallwindows\"><a href=\"#browserwindowgetallwindows\"><code>BrowserWindow.getAllWindows()</code></a></h4>\n<p>Devuelve <code>BrowserWindow[]</code>- Un arreglo de todas las ventanas abiertas del navegador.</p>\n<h4 id=\"browserwindowgetfocusedwindow\"><a href=\"#browserwindowgetfocusedwindow\"><code>BrowserWindow.getFocusedWindow()</code></a></h4>\n<p>Devuelve <code>BrowserWindow | null</code> - La ventana que es enfocada en esta aplicación, de lo contrario devuelve <code>null</code>.</p>\n<h4 id=\"browserwindowfromwebcontentswebcontents\"><a href=\"#browserwindowfromwebcontentswebcontents\"><code>BrowserWindow.fromWebContents(webContents)</code></a></h4>\n<ul>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Devuelve <code>BrowserWindow | null</code> - La ventana a que pertenece el <code>webContents</code> indicado o <code>null</code> si los contenidos no son propiedad de una ventana.</p>\n<h4 id=\"browserwindowfrombrowserviewbrowserview\"><a href=\"#browserwindowfrombrowserviewbrowserview\"><code>BrowserWindow.fromBrowserView(browserView)</code></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>Devuelve <code>BrowserWindow | null</code> - La ventana que posee el <code>browserView</code> dado. Si la vista dada no esta adjunta a ninguna ventana, devuelve <code>null</code>.</p>\n<h4 id=\"browserwindowfromidid\"><a href=\"#browserwindowfromidid\"><code>BrowserWindow.fromId(id)</code></a></h4>\n<ul>\n<li><code>id</code> Íntegro</li>\n</ul>\n<p>Devuelve <code>BrowserWindow | null</code> -La ventana con la <code>id</code> especificada.</p>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<p>Los objetos creados con <code>new BrowserWindow</code> tienen las siguientes propiedades:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">// In this example `win` is our instance</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<h4 id=\"winwebcontents-sololectura\"><a href=\"#winwebcontents-sololectura\"><code>win.webContents</code> <em>SoloLectura</em></a></h4>\n<p>Un objeto <code>WebContents</code> que esta ventana posse. Toda página web relacionada eventos y operaciones se realizarán a través de ella.</p>\n<p>Consulte la <a href=\"/docs/api/web-contents\">documentation <code>webContents</code></a> de sus métodos y eventos.</p>\n<h4 id=\"winid-sololectura\"><a href=\"#winid-sololectura\"><code>win.id</code> <em>SoloLectura</em></a></h4>\n<p>Una propiedad <code>Integer</code> representando el identificador único de la ventana. Cada ID es único entre todas las instancias <code>BrowserWindow</code> de toda la aplicación Electron.</p>\n<h4 id=\"winautohidemenubar\"><a href=\"#winautohidemenubar\"><code>win.autoHideMenuBar</code></a></h4>\n<p>Una propiedad <code>Boolean</code> que determina si la barra de menú de la ventana debe ocultarse automáticamente. Una vez activada, la barra de menú sólo se mostrará cuando los usuarios presionen la tecla <code>Alt</code>.</p>\n<p>Si el menu bar ya está visible, estableciendo esta propiedad a <code>true</code> no lo ocultará inmediatamente.</p>\n<h4 id=\"winsimplefullscreen\"><a href=\"#winsimplefullscreen\"><code>win.simpleFullScreen</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in simple (pre-Lion) fullscreen mode.</p>\n<h4 id=\"winfullscreen\"><a href=\"#winfullscreen\"><code>win.fullScreen</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in fullscreen mode.</p>\n<h4 id=\"winfocusable-windows-macos\"><a href=\"#winfocusable-windows-macos\"><code>win.focusable</code> <em>Windows</em> <em>macOS</em></a></h4>\n<p>Una propiedad <code>Boolean</code> que determina si la ventana es enfocable.</p>\n<h4 id=\"winvisibleonallworkspaces\"><a href=\"#winvisibleonallworkspaces\"><code>win.visibleOnAllWorkspaces</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is visible on all workspaces.</p>\n<p><strong>Note:</strong> Always returns false on Windows.</p>\n<h4 id=\"winshadow\"><a href=\"#winshadow\"><code>win.shadow</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window has a shadow.</p>\n<h4 id=\"winmenubarvisible-windows-linux\"><a href=\"#winmenubarvisible-windows-linux\"><code>win.menuBarVisible</code> <em>Windows</em> <em>Linux</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the menu bar should be visible.</p>\n<p><strong>Note:</strong> If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single <code>Alt</code> key.</p>\n<h4 id=\"winkiosk\"><a href=\"#winkiosk\"><code>win.kiosk</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in kiosk mode.</p>\n<h4 id=\"windocumentedited-macos\"><a href=\"#windocumentedited-macos\"><code>win.documentEdited</code> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that specifies whether the window’s document has been edited.</p>\n<p>The icon in title bar will become gray when set to <code>true</code>.</p>\n<h4 id=\"winrepresentedfilename-macos\"><a href=\"#winrepresentedfilename-macos\"><code>win.representedFilename</code> <em>macOS</em></a></h4>\n<p>A <code>String</code> property that determines the pathname of the file the window represents, and the icon of the file will show in window's title bar.</p>\n<h4 id=\"wintitle\"><a href=\"#wintitle\"><code>win.title</code></a></h4>\n<p>A <code>String</code> property that determines the title of the native window.</p>\n<p><strong>Note:</strong> The title of the web page can be different from the title of the native window.</p>\n<h4 id=\"winminimizable\"><a href=\"#winminimizable\"><code>win.minimizable</code></a></h4>\n<p>Una propiedad <code>Boolean</code> que determina si la ventana puede ser minimizada manualmente por el usuario.</p>\n<p>En Linux el setter no es operativo, a pesar de que el getter devuelve <code>true</code>.</p>\n<h4 id=\"winmaximizable\"><a href=\"#winmaximizable\"><code>win.maximizable</code></a></h4>\n<p>Una propiedad <code>Boolean</code> que determina si la ventana puede ser maximizada manualmente por el usuario.</p>\n<p>En Linux el setter no es operativo, a pesar de que el getter devuelve <code>true</code>.</p>\n<h4 id=\"winfullscreenable\"><a href=\"#winfullscreenable\"><code>win.fullScreenable</code></a></h4>\n<p>Una propiedad <code>Boolean</code> que determina si los botones de la ventana maximizar/ampliar alterna el modo de pantalla completa o maximiza la ventana.</p>\n<h4 id=\"winresizable\"><a href=\"#winresizable\"><code>win.resizable</code></a></h4>\n<p>Una propiedad <code>Boolean</code> que determina si la ventana puede ser redimencionada manualmente por el usuario.</p>\n<h4 id=\"winclosable\"><a href=\"#winclosable\"><code>win.closable</code></a></h4>\n<p>Una propiedad <code>Boolean</code> que determina si la ventana puede ser cerrada manualmente por el usuario.</p>\n<p>En Linux el setter no es operativo, a pesar de que el getter devuelve <code>true</code>.</p>\n<h4 id=\"winmovable\"><a href=\"#winmovable\"><code>win.movable</code></a></h4>\n<p>Una propiedad <code>Boolean</code> que determina si la ventana puede ser movida por el usuario.</p>\n<p>En Linux el setter no es operativo, a pesar de que el getter devuelve <code>true</code>.</p>\n<h4 id=\"winexcludedfromshownwindowsmenu-macos\"><a href=\"#winexcludedfromshownwindowsmenu-macos\"><code>win.excludedFromShownWindowsMenu</code> <em>macOS</em></a></h4>\n<p>Una propiedad <code>Boolean</code> que determina si la ventana es excluida o no del menu Windows de la aplicación. <code>false</code> por defecto.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-keyword\">const</span> template = [\n  {\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'windowmenu'</span>\n  }\n]\n\nwin.excludedFromShownWindowsMenu = <span class=\"hljs-literal\">true</span>\n\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\nMenu.setApplicationMenu(menu)\n</code></pre>\n<h4 id=\"winaccessibletitle\"><a href=\"#winaccessibletitle\"><code>win.accessibleTitle</code></a></h4>\n<p>A <code>String</code> property that defines an alternative title provided only to accessibility tools such as screen readers. Esta cadena no es directamente visible para los usuarios.</p>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<p>Los objetos creados con <code>new BrowserWindow</code> tienen los siguientes métodos de instancia:</p>\n<p><strong>Note:</strong> Algunos métodos solo están disponibles en sistemas operativos específicos y son etiquetados como tal.</p>\n<h4 id=\"windestroy\"><a href=\"#windestroy\"><code>win.destroy()</code></a></h4>\n<p>Al forzar el cierre de una ventana, el evento <code>unload</code> y <code>beforeunload</code> no se emitirá en la página web. El evento <code>close</code> tampoco se emitirá en la ventana, pero es seguro que el evento <code>closed</code> sí será emitido.</p>\n<h4 id=\"winclose\"><a href=\"#winclose\"><code>win.close()</code></a></h4>\n<p>Trate de cerrar la ventana. Esto tiene el mismo efecto que un usuario pulsando manualmente el botón cerrar de la ventana. The web page may cancel the close though. Ver el <a href=\"#event-close\">close event</a>.</p>\n<h4 id=\"winfocus\"><a href=\"#winfocus\"><code>win.focus()</code></a></h4>\n<p>Enfoca la ventana.</p>\n<h4 id=\"winblur\"><a href=\"#winblur\"><code>win.blur()</code></a></h4>\n<p>Elimina el enfoque de la ventana.</p>\n<h4 id=\"winisfocused\"><a href=\"#winisfocused\"><code>win.isFocused()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la ventana está centrada o no.</p>\n<h4 id=\"winisdestroyed\"><a href=\"#winisdestroyed\"><code>win.isDestroyed()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la ventana fue destruida o no.</p>\n<h4 id=\"winshow\"><a href=\"#winshow\"><code>win.show()</code></a></h4>\n<p>Muestra la ventana y la enfoca.</p>\n<h4 id=\"winshowinactive\"><a href=\"#winshowinactive\"><code>win.showInactive()</code></a></h4>\n<p>Muestra la ventana pero no la enfoca.</p>\n<h4 id=\"winhide\"><a href=\"#winhide\"><code>win.hide()</code></a></h4>\n<p>Oculta la ventana.</p>\n<h4 id=\"winisvisible\"><a href=\"#winisvisible\"><code>win.isVisible()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la ventana es visible o no al usuario.</p>\n<h4 id=\"winismodal\"><a href=\"#winismodal\"><code>win.isModal()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la ventana actual es una ventana modal o no.</p>\n<h4 id=\"winmaximize\"><a href=\"#winmaximize\"><code>win.maximize()</code></a></h4>\n<p>Maximiza la ventana. This will also show (but not focus) the window if it isn't being displayed already.</p>\n<h4 id=\"winunmaximize\"><a href=\"#winunmaximize\"><code>win.unmaximize()</code></a></h4>\n<p>Sale del estado maximizado de la ventana.</p>\n<h4 id=\"winismaximized\"><a href=\"#winismaximized\"><code>win.isMaximized()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la ventana está maximizada.</p>\n<h4 id=\"winminimize\"><a href=\"#winminimize\"><code>win.minimize()</code></a></h4>\n<p>Minimiza la ventana. On some platforms the minimized window will be shown in the Dock.</p>\n<h4 id=\"winrestore\"><a href=\"#winrestore\"><code>win.restore()</code></a></h4>\n<p>Restaura la ventana desde un estado minimizado a su estado previo.</p>\n<h4 id=\"winisminimized\"><a href=\"#winisminimized\"><code>win.isMinimized()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la ventana está minimizada o no.</p>\n<h4 id=\"winsetfullscreenflag\"><a href=\"#winsetfullscreenflag\"><code>win.setFullScreen(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Establece si la ventana debe estar o no en modo pantalla completa.</p>\n<h4 id=\"winisfullscreen\"><a href=\"#winisfullscreen\"><code>win.isFullScreen()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la ventana está o no en pantalla completa.</p>\n<h4 id=\"winsetsimplefullscreenflag-macos\"><a href=\"#winsetsimplefullscreenflag-macos\"><code>win.setSimpleFullScreen(flag)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Entra o sale del modo simple de pantalla completa.</p>\n<p>Simple fullscreen mode emulates the native fullscreen behavior found in versions of macOS prior to Lion (10.7).</p>\n<h4 id=\"winissimplefullscreen-macos\"><a href=\"#winissimplefullscreen-macos\"><code>win.isSimpleFullScreen()</code> <em>macOS</em></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la ventana está en modo simple de pantalla completa (pre-Lion).</p>\n<h4 id=\"winisnormal\"><a href=\"#winisnormal\"><code>win.isNormal()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la ventana esta en estado normal (no maximizada, no minimizada, no en el modo de pantalla completa).</p>\n<h4 id=\"winsetaspectratioaspectratio-extrasize\"><a href=\"#winsetaspectratioaspectratio-extrasize\"><code>win.setAspectRatio(aspectRatio[, extraSize])</code></a></h4>\n<ul>\n<li><code>aspectRatio</code> Flotador - La relación de aspecto para mantener parte de la vista de contenido.</li>\n<li><code>extraSize</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) <em>macOS</em> - The extra size not to be included while maintaining the aspect ratio.</li>\n</ul>\n<p>Esto hará que la ventana mantenga una relación de aspecto. El tamaño extra permite al desarrollador tener espacio especificado en píxeles, el cual no está incluido dentro de los cálculos de la relación de aspecto. Esta API ya toma en cuenta la diferencia entre el tamaño de la ventana y el tamaño del contenido.</p>\n<p>Considere una ventana normal con un reproductor de video HD y los controles asociados. Quizá hay 15 pixeles de controles en el borde izquierdo, 25 pixeles de control en el borde derecho y 50 pixeles de control bajo el reproductor. In order to maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within the player itself we would call this function with arguments of 16/9 and\n{ width: 40, height: 50 }. En el segundo argumento no importa donde están la anchura extra ni altura extra dentro de la vista del contenido, solo importa que existan. Suma cualquier áreas de ancho y alto adicionales que tengas dentro de la vista de contenido general.</p>\n<p>La relación de aspecto no se respeta cuando la ventana se redimensiona programáticamente con APIs como <code>win.setSize</code>.</p>\n<h4 id=\"winsetbackgroundcolorbackgroundcolor\"><a href=\"#winsetbackgroundcolorbackgroundcolor\"><code>win.setBackgroundColor(backgroundColor)</code></a></h4>\n<ul>\n<li><code>backgroundColor</code> String - Color de fondo de la ventana como un valor hexadecimal, como <code>#66CD00</code> o <code>#FFF</code> o <code>#80FFFFFF</code> (alpha es soportada si <code>transparent</code> es <code>true</code>). Por defecto es <code>#FFF</code> (blanco).</li>\n</ul>\n<p>Establece el color de fondo de la ventana. Ver <a href=\"#setting-backgroundcolor\">Setting <code>backgroundColor</code></a>.</p>\n<h4 id=\"winpreviewfilepath-displayname-macos\"><a href=\"#winpreviewfilepath-displayname-macos\"><code>win.previewFile(path[, displayName])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>path</code> Cadena - La ruta de acceso absoluta al archivo para vista previa con QuickLook. Esto es importante a medida que Quick Look utiliza el nombre del archivo y la extensión del archivo en la ruta para determinar el tipo de contenido del archivo que se va a abrir.</li>\n<li><code>displayName</code> Cadena (opcional) - El nombre del archivo a mostrar en la vista modal de Quick Look. Esto es puramente visual y no afecta el tipo de contenido del archivo. Por defecto es <code>path</code>.</li>\n</ul>\n<p>Utiliza <a href=\"https://en.wikipedia.org/wiki/Quick_Look\">Quick Look</a> para previsualizar un archivo de una ruta determinada.</p>\n<h4 id=\"winclosefilepreview-macos\"><a href=\"#winclosefilepreview-macos\"><code>win.closeFilePreview()</code> <em>macOS</em></a></h4>\n<p>Cierra el panel actual de <a href=\"https://en.wikipedia.org/wiki/Quick_Look\">Quick Look</a>.</p>\n<h4 id=\"winsetboundsbounds-animate\"><a href=\"#winsetboundsbounds-animate\"><code>win.setBounds(bounds[, animate])</code></a></h4>\n<ul>\n<li><code>bounds</code> Partial&#x3C;<a href=\"/docs/api/structures/rectangle\">Rectangle</a>></li>\n<li><code>animate</code> Boolean (opcional) <em>macOS</em></li>\n</ul>\n<p>Redimensiona y mueve la ventana a los límites proporcionados. Cualquier propiedad que no se proporcione tendrá sus valores actuales por defecto.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-comment\">// set all bounds properties</span>\nwin.setBounds({ <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">440</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">225</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-comment\">// set a single bounds property</span>\nwin.setBounds({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">100</span> })\n\n<span class=\"hljs-comment\">// { x: 440, y: 225, width: 100, height: 600 }</span>\n<span class=\"hljs-built_in\">console</span>.log(win.getBounds())\n</code></pre>\n<h4 id=\"wingetbounds\"><a href=\"#wingetbounds\"><code>win.getBounds()</code></a></h4>\n<p>Retorna <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - El <code>bounds</code> de la ventana como <code>Object</code>.</p>\n<h4 id=\"wingetbackgroundcolor\"><a href=\"#wingetbackgroundcolor\"><code>win.getBackgroundColor()</code></a></h4>\n<p>Returns <code>String</code> - Gets the background color of the window. Ver <a href=\"#setting-backgroundcolor\">Setting <code>backgroundColor</code></a>.</p>\n<h4 id=\"winsetcontentboundsbounds-animate\"><a href=\"#winsetcontentboundsbounds-animate\"><code>win.setContentBounds(bounds[, animate])</code></a></h4>\n<ul>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n<li><code>animate</code> Boolean (opcional) <em>macOS</em></li>\n</ul>\n<p>Redimensiona y mueve el área del cliente de la ventana (por ejemplo, la página web) hasta los límites proporcionados.</p>\n<h4 id=\"wingetcontentbounds\"><a href=\"#wingetcontentbounds\"><code>win.getContentBounds()</code></a></h4>\n<p>Retorna <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - El <code>bounds</code> del área del cliente de la ventana como <code>Object</code>.</p>\n<h4 id=\"wingetnormalbounds\"><a href=\"#wingetnormalbounds\"><code>win.getNormalBounds()</code></a></h4>\n<p>Devuelve <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - Contiene los limites del estado normal de la ventana</p>\n<p><strong>Note:</strong> si el estado actual de la ventana: maximizado, minimizado en el pantalla completa, esta función siempre devuelve la posición y tamaño de la ventana en estado normal. En estado normal, getBounds y getNormalBounds el mismo <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a>.</p>\n<h4 id=\"winsetenabledenable\"><a href=\"#winsetenabledenable\"><code>win.setEnabled(enable)</code></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Habilita o deshabilita la ventana.</p>\n<h4 id=\"winisenabled\"><a href=\"#winisenabled\"><code>win.isEnabled()</code></a></h4>\n<p>Devuelce <code>Boolean</code> -si la ventana está activada.</p>\n<h4 id=\"winsetsizewidth-height-animate\"><a href=\"#winsetsizewidth-height-animate\"><code>win.setSize(width, height[, animate])</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>alto</code> Integer</li>\n<li><code>animate</code> Boolean (opcional) <em>macOS</em></li>\n</ul>\n<p>Cambia el tamaño de la ventana a <code>width</code> y <code>height</code>. If <code>width</code> or <code>height</code> are below any set minimum size constraints the window will snap to its minimum size.</p>\n<h4 id=\"wingetsize\"><a href=\"#wingetsize\"><code>win.getSize()</code></a></h4>\n<p>Devuelve <code>Integer[]</code> - Contiene la anchura y altura de la ventana.</p>\n<h4 id=\"winsetcontentsizewidth-height-animate\"><a href=\"#winsetcontentsizewidth-height-animate\"><code>win.setContentSize(width, height[, animate])</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>alto</code> Integer</li>\n<li><code>animate</code> Boolean (opcional) <em>macOS</em></li>\n</ul>\n<p>Cambia el área del cliente de la ventana (por ejemplo, la página web) a la <code>width</code> y <code>height</code>.</p>\n<h4 id=\"wingetcontentsize\"><a href=\"#wingetcontentsize\"><code>win.getContentSize()</code></a></h4>\n<p>Devuelve <code>Integer[]</code> - Contiene la anchura y altura del área del cliente de la ventana.</p>\n<h4 id=\"winsetminimumsizewidth-height\"><a href=\"#winsetminimumsizewidth-height\"><code>win.setMinimumSize(width, height)</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>alto</code> Integer</li>\n</ul>\n<p>Establece el tamaño mínimo de la ventana a <code>width</code>y <code>height</code>.</p>\n<h4 id=\"wingetminimumsize\"><a href=\"#wingetminimumsize\"><code>win.getMinimumSize()</code></a></h4>\n<p>Devuelve <code>Integer[]</code> - Contiene la anchura y altura mínima de la ventana.</p>\n<h4 id=\"winsetmaximumsizewidth-height\"><a href=\"#winsetmaximumsizewidth-height\"><code>win.setMaximumSize(width, height)</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>alto</code> Integer</li>\n</ul>\n<p>Establece el tamaño máximo de la ventana a <code>width</code>y <code>height</code>.</p>\n<h4 id=\"wingetmaximumsize\"><a href=\"#wingetmaximumsize\"><code>win.getMaximumSize()</code></a></h4>\n<p>Devuelve <code>Integer[]</code> - Contiene la anchura y altura máxima de la ventana.</p>\n<h4 id=\"winsetresizableresizable\"><a href=\"#winsetresizableresizable\"><code>win.setResizable(resizable)</code></a></h4>\n<ul>\n<li><code>resizable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually resized by the user.</p>\n<h4 id=\"winisresizable\"><a href=\"#winisresizable\"><code>win.isResizable()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be manually resized by the user.</p>\n<h4 id=\"winsetmovablemovable-macos-windows\"><a href=\"#winsetmovablemovable-macos-windows\"><code>win.setMovable(movable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>movable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be moved by user. En Linux no hace nada.</p>\n<h4 id=\"winismovable-macos-windows\"><a href=\"#winismovable-macos-windows\"><code>win.isMovable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la ventana puede ser movida por el usuario.</p>\n<p>En Linux siempre devuelve <code>true</code>.</p>\n<h4 id=\"winsetminimizableminimizable-macos-windows\"><a href=\"#winsetminimizableminimizable-macos-windows\"><code>win.setMinimizable(minimizable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>minimizable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually minimized by user. En Linux no hace nada.</p>\n<h4 id=\"winisminimizable-macos-windows\"><a href=\"#winisminimizable-macos-windows\"><code>win.isMinimizable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be manually minimized by the user.</p>\n<p>En Linux siempre devuelve <code>true</code>.</p>\n<h4 id=\"winsetmaximizablemaximizable-macos-windows\"><a href=\"#winsetmaximizablemaximizable-macos-windows\"><code>win.setMaximizable(maximizable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>maximizable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually maximized by user. En Linux no hace nada.</p>\n<h4 id=\"winismaximizable-macos-windows\"><a href=\"#winismaximizable-macos-windows\"><code>win.isMaximizable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la ventana puede ser maximizada manualmente por el usuario.</p>\n<p>En Linux siempre devuelve <code>true</code>.</p>\n<h4 id=\"winsetfullscreenablefullscreenable\"><a href=\"#winsetfullscreenablefullscreenable\"><code>win.setFullScreenable(fullscreenable)</code></a></h4>\n<ul>\n<li><code>fullscreenable</code> Boolean</li>\n</ul>\n<p>Sets whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.</p>\n<h4 id=\"winisfullscreenable\"><a href=\"#winisfullscreenable\"><code>win.isFullScreenable()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.</p>\n<h4 id=\"winsetclosableclosable-macos-windows\"><a href=\"#winsetclosableclosable-macos-windows\"><code>win.setClosable(closable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>closable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually closed by user. En Linux no hace nada.</p>\n<h4 id=\"winisclosable-macos-windows\"><a href=\"#winisclosable-macos-windows\"><code>win.isClosable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la ventana puede ser o no cerrada manualmente por el usuario.</p>\n<p>En Linux siempre devuelve <code>true</code>.</p>\n<h4 id=\"winsetalwaysontopflag-level-relativelevel\"><a href=\"#winsetalwaysontopflag-level-relativelevel\"><code>win.setAlwaysOnTop(flag[, level][, relativeLevel])</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n<li><code>level</code> String (opcional) <em>macOS</em> <em>Windows</em> - Valores incluyen <code>normal</code>, <code>floating</code>, <code>torn-off-menu</code>, <code>modal-panel</code>, <code>main-menu</code>, <code>status</code>, <code>pop-up-menu</code>, <code>screen-saver</code>, y <del><code>dock</code></del> (Obsoleto). Por defecto es <code>floating</code> cuando <code>flag</code> es true. El <code>level</code> se restablece a <code>normal</code> cuando la bandera es false. Tenga en cuenta que desde <code>floating</code> a <code>status</code> incluido, la venta está colocada debajo del Dock en macOS y debajo de la barra de tarea en Windows. Desde <code>pop-up-menu</code> a un superior se muestra sobre el Dock en macOS y sobre la barra de tareas en Windows. Vea la <a href=\"https://developer.apple.com/documentation/appkit/nswindow/level\">macOS docs</a> para más detalles.</li>\n<li><code>relativeLevel</code> Integer (opcional) <em>macOS</em> - El número de capas más alto para configurar esta ventana con respecto al <code>level</code> determinado. Por defecto es <code>0</code>. Tenga en cuenta que Apple desalienta establecer niveles superiores a 1 sobre <code>screen-saver</code>.</li>\n</ul>\n<p>Sets whether the window should show always on top of other windows. Después de configurar esto, la ventana seguirá siendo una ventana normal, y no una ventana de herramientas que no puede enfocarse.</p>\n<h4 id=\"winisalwaysontop\"><a href=\"#winisalwaysontop\"><code>win.isAlwaysOnTop()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la ventana está siempre sobre las otras ventanas.</p>\n<h4 id=\"winmoveabovemediasourceid\"><a href=\"#winmoveabovemediasourceid\"><code>win.moveAbove(mediaSourceId)</code></a></h4>\n<ul>\n<li><code>mediaSourceId</code> String - Window id in the format of DesktopCapturerSource's id. Por ejemplo \"window:1869:0\".</li>\n</ul>\n<p>Moves window above the source window in the sense of z-order. If the <code>mediaSourceId</code> is not of type window or if the window does not exist then this method throws an error.</p>\n<h4 id=\"winmovetop\"><a href=\"#winmovetop\"><code>win.moveTop()</code></a></h4>\n<p>Mover ventana a la parte superior(z-order) independientemente del enfoque</p>\n<h4 id=\"wincenter\"><a href=\"#wincenter\"><code>win.center()</code></a></h4>\n<p>Mueve la ventana al centro de la pantalla.</p>\n<h4 id=\"winsetpositionx-y-animate\"><a href=\"#winsetpositionx-y-animate\"><code>win.setPosition(x, y[, animate])</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n<li><code>animate</code> Boolean (opcional) <em>macOS</em></li>\n</ul>\n<p>Mueve la ventana a <code>x</code> y <code>y</code>.</p>\n<h4 id=\"wingetposition\"><a href=\"#wingetposition\"><code>win.getPosition()</code></a></h4>\n<p>Devuelve <code>Integer[]</code> - Contiene la posición actual de la ventana.</p>\n<h4 id=\"winsettitletitle\"><a href=\"#winsettitletitle\"><code>win.setTitle(title)</code></a></h4>\n<ul>\n<li><code>title</code> String</li>\n</ul>\n<p>Cambia el título de la ventana nativa a <code>title</code>.</p>\n<h4 id=\"wingettitle\"><a href=\"#wingettitle\"><code>win.getTitle()</code></a></h4>\n<p>Devuelve <code>String</code> - El título de la ventana nativa.</p>\n<p><strong>Note:</strong> El título de la página web puede ser diferente del título de la ventana nativa.</p>\n<h4 id=\"winsetsheetoffsetoffsety-offsetx-macos\"><a href=\"#winsetsheetoffsetoffsety-offsetx-macos\"><code>win.setSheetOffset(offsetY[, offsetX])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>offsetY</code> Float</li>\n<li><code>offsetX</code> Float (opcional)</li>\n</ul>\n<p>Changes the attachment point for sheets on macOS. By default, sheets are attached just below the window frame, but you may want to display them beneath a HTML-rendered toolbar. Por ejemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-keyword\">const</span> toolbarRect = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'toolbar'</span>).getBoundingClientRect()\nwin.setSheetOffset(toolbarRect.height)\n</code></pre>\n<h4 id=\"winflashframeflag\"><a href=\"#winflashframeflag\"><code>win.flashFrame(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Empieza y deja de hacer parpadear la ventana para atraer la atención del usuario.</p>\n<h4 id=\"winsetskiptaskbarskip\"><a href=\"#winsetskiptaskbarskip\"><code>win.setSkipTaskbar(skip)</code></a></h4>\n<ul>\n<li><code>skip</code> Booleano</li>\n</ul>\n<p>Hace que la ventana no se muestre en la barra de tareas.</p>\n<h4 id=\"winsetkioskflag\"><a href=\"#winsetkioskflag\"><code>win.setKiosk(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Entra / sale del modo Kiosko.</p>\n<h4 id=\"winiskiosk\"><a href=\"#winiskiosk\"><code>win.isKiosk()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la ventana está o no en modo kiosco.</p>\n<h4 id=\"winistabletmode-windows\"><a href=\"#winistabletmode-windows\"><code>win.isTabletMode()</code> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in Windows 10 tablet mode.</p>\n<p>Since Windows 10 users can <a href=\"https://support.microsoft.com/en-us/help/17210/windows-10-use-your-pc-like-a-tablet\">use their PC as tablet</a>, under this mode apps can choose to optimize their UI for tablets, such as enlarging the titlebar and hiding titlebar buttons.</p>\n<p>This API returns whether the window is in tablet mode, and the <code>resize</code> event can be be used to listen to changes to tablet mode.</p>\n<h4 id=\"wingetmediasourceid\"><a href=\"#wingetmediasourceid\"><code>win.getMediaSourceId()</code></a></h4>\n<p>Returns <code>String</code> - Window id in the format of DesktopCapturerSource's id. Por ejemplo \"window:1324:0\".</p>\n<p>Más específicamente el formato es <code>window:id:other_id</code> donde <code>id</code> es <code>HWND</code> en Windows, <code>CGWindowID</code> (<code>uint64_t</code>) en macOS y <code>Window</code> (<code>unsigned long</code>) en Linux. <code>other_id</code> es usado para identificar contenidos webs (pestañas) así dentro de la misma ventana de nivel superior.</p>\n<h4 id=\"wingetnativewindowhandle\"><a href=\"#wingetnativewindowhandle\"><code>win.getNativeWindowHandle()</code></a></h4>\n<p>Devuelve <code>Buffer</code> - El controlador específico de la plataforma de la ventana.</p>\n<p>El tipo nativo del controlador en Windows es <code>HWND</code>, en macOS <code>NSView*</code> y en Linux <code>Window</code> (<code>unsigned long</code>).</p>\n<h4 id=\"winhookwindowmessagemessage-callback-windows\"><a href=\"#winhookwindowmessagemessage-callback-windows\"><code>win.hookWindowMessage(message, callback)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n<li><code>callback</code> Función<ul>\n<li><code>wParam</code> any - El <code>wParam</code> proveído al WndProc</li>\n<li><code>lParam</code> any - El <code>lParam</code> proveído al WndProc</li>\n</ul></li>\n</ul>\n<p>Engancha una ventana de mensaje. The <code>callback</code> is called when the message is received in the WndProc.</p>\n<h4 id=\"winiswindowmessagehookedmessage-windows\"><a href=\"#winiswindowmessagehookedmessage-windows\"><code>win.isWindowMessageHooked(message)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n</ul>\n<p>Devuelve <code>Boolean</code> - <code>true</code> o <code>false</code> dependiendo de si el mensaje esta anclado o no.</p>\n<h4 id=\"winunhookwindowmessagemessage-windows\"><a href=\"#winunhookwindowmessagemessage-windows\"><code>win.unhookWindowMessage(message)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n</ul>\n<p>Desancla el mensaje de la ventana.</p>\n<h4 id=\"winunhookallwindowmessages-windows\"><a href=\"#winunhookallwindowmessages-windows\"><code>win.unhookAllWindowMessages()</code> <em>Windows</em></a></h4>\n<p>Desancla todos los mensajes de la ventana.</p>\n<h4 id=\"winsetrepresentedfilenamefilename-macos\"><a href=\"#winsetrepresentedfilenamefilename-macos\"><code>win.setRepresentedFilename(filename)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>filename</code> Cadena</li>\n</ul>\n<p>Establece el nombre de la ruta del archivo que la ventana representa, y el icono del archivo se mostrará en la barra de título de la ventana.</p>\n<h4 id=\"wingetrepresentedfilename-macos\"><a href=\"#wingetrepresentedfilename-macos\"><code>win.getRepresentedFilename()</code> <em>macOS</em></a></h4>\n<p>Devuelve <code>String</code> - El nombre de la ruta del archivo que la ventana representa.</p>\n<h4 id=\"winsetdocumenteditededited-macos\"><a href=\"#winsetdocumenteditededited-macos\"><code>win.setDocumentEdited(edited)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>edited</code> Boolean</li>\n</ul>\n<p>Especifica si se ha editado el documento de la ventana y el icono en la barra de título se volverá gris cuando se establece en <code>true</code>.</p>\n<h4 id=\"winisdocumentedited-macos\"><a href=\"#winisdocumentedited-macos\"><code>win.isDocumentEdited()</code> <em>macOS</em></a></h4>\n<p>Devuelve <code>Boolean</code> - Si se ha editado el documento de la ventana.</p>\n<h4 id=\"winfocusonwebview\"><a href=\"#winfocusonwebview\"><code>win.focusOnWebView()</code></a></h4>\n<h4 id=\"winblurwebview\"><a href=\"#winblurwebview\"><code>win.blurWebView()</code></a></h4>\n<h4 id=\"wincapturepagerect\"><a href=\"#wincapturepagerect\"><code>win.capturePage([rect])</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (opcional) - Los límites para capturar</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;NativeImage></code> - Resuelve con el un <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Captura una foto instantánea de la página dentro de <code>rect</code>. Omitiendo <code>rect</code> capturará toda la página visible. Si la página no es visible, <code>rect</code> puede estar vacía.</p>\n<h4 id=\"winloadurlurl-options\"><a href=\"#winloadurlurl-options\"><code>win.loadURL(url[, options])</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (opcional) - Una URL de referencia HTTP.</li>\n<li><code>userAgent</code> Cadena (opcional) - Un agente de usuario originando el pedido.</li>\n<li><code>extraHeaders</code> Cadena (opcional) - Encabezados extras separados por \"\\n\"</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (opcional) - URL base (con separador de ruta final) para archivos a ser cargados por el data URL. Esto solo es necesario si la <code>url</code> especificada es una data URL y necesita cargar otros archivos.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code> - la promesa sera resolvida cuando la página haya finalizado de cargar (mira <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), y será rechazada si la pagina falla al cargar (mira <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Igual que <a href=\"/docs/api/web-contents#contentsloadurlurl-options\"><code>webContents.loadURL(url[, opciones])</code></a>.</p>\n<p>El <code>url</code> puede ser una dirección remota (por ejemplo <code>http://</code>) o una de un archivo locar HTML utilizando el protocolo <code>file://</code>.</p>\n<p>Para garantizar que los URLs del archivo estén adecuadamente formateados, se recomienda utilizar el método <a href=\"https://nodejs.org/api/url.html#url_url_format_urlobject\"><code>url.format</code></a> del Nodo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>).format({\n  <span class=\"hljs-attr\">protocol</span>: <span class=\"hljs-string\">'file'</span>,\n  <span class=\"hljs-attr\">slashes</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">pathname</span>: <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>).join(__dirname, <span class=\"hljs-string\">'index.html'</span>)\n})\n\nwin.loadURL(url)\n</code></pre>\n<p>Se puede cargar un URL utilizando la solicitud <code>POST</code> con los datos codificados de URL haciendo lo siguiente:</p>\n<pre><code class=\"hljs language-javascript\">win.loadURL(<span class=\"hljs-string\">'http://localhost:8000/post'</span>, {\n  <span class=\"hljs-attr\">postData</span>: [{\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'rawData'</span>,\n    <span class=\"hljs-attr\">bytes</span>: Buffer.from(<span class=\"hljs-string\">'hello=world'</span>)\n  }],\n  <span class=\"hljs-attr\">extraHeaders</span>: <span class=\"hljs-string\">'Content-Type: application/x-www-form-urlencoded'</span>\n})\n</code></pre>\n<h4 id=\"winloadfilefilepath-options\"><a href=\"#winloadfilefilepath-options\"><code>win.loadFile(filePath[, options])</code></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>query</code> Record&#x3C;String, String> (opcional) - Pasado a <code>url.format()</code>.</li>\n<li><code>search</code> String (opcional) - Pasado a <code>url.format()</code>.</li>\n<li><code>hash</code> String (opcional) - Pasado a <code>url.format()</code>.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code> - la promesa sera resolvida cuando la página haya finalizado de cargar (mira <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), y será rechazada si la pagina falla al cargar (mira <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Same as <code>webContents.loadFile</code>, <code>filePath</code> should be a path to an HTML file relative to the root of your application.  Ver la documentación <code>webContents</code> para más información.</p>\n<h4 id=\"winreload\"><a href=\"#winreload\"><code>win.reload()</code></a></h4>\n<p>Es igual a <code>webContents.reload</code>.</p>\n<h4 id=\"winsetmenumenu-linux-windows\"><a href=\"#winsetmenumenu-linux-windows\"><code>win.setMenu(menu)</code> <em>Linux</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Establece el <code>menu</code> como el menu bar de la ventana.</p>\n<h4 id=\"winremovemenu-linux-windows\"><a href=\"#winremovemenu-linux-windows\"><code>win.removeMenu()</code> <em>Linux</em> <em>Windows</em></a></h4>\n<p>Eliminar la barra de menú de la ventana.</p>\n<h4 id=\"winsetprogressbarprogress-options\"><a href=\"#winsetprogressbarprogress-options\"><code>win.setProgressBar(progress[, options])</code></a></h4>\n<ul>\n<li><code>progress</code> Double</li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>mode</code> String <em>Windows</em> - Mode for the progress bar. Puede ser <code>none</code>, <code>normal</code>, <code>indeterminate</code>, <code>error</code> o <code>paused</code>.</li>\n</ul></li>\n</ul>\n<p>Establece el valor del progreso en el progress bar. Rango valido es [0, 1.0].</p>\n<p>Elimina la barra de progreso cuando el progreso es &#x3C; 0; cambia a modo indeterminado cuando el progreso es >1.</p>\n<p>En la plataforma Linux, solo es compatible con el environment de escritorio Unity. Se necesita especificar el nombre del archivo <code>*.desktop</code> en el campo <code>desktopName</code> dentro de <code>package.json</code>. Por defecto, será asumido <code>{app.name}.desktop</code>.</p>\n<p>En Windows, se puede pasar de modo. Los valores aceptados son <code>none</code>, <code>normal</code>, <code>indeterminate</code>, <code>error</code>, y <code>paused</code>. Si se llama a<code>setProgressBar</code> sin establecer un modo (pero con un valor dentro del rango válido), se asumirá el modo <code>normal</code>.</p>\n<h4 id=\"winsetoverlayiconoverlay-description-windows\"><a href=\"#winsetoverlayiconoverlay-description-windows\"><code>win.setOverlayIcon(overlay, description)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>overlay</code> <a href=\"/docs/api/native-image\">NativeImage</a> | null - el icono a mostrar en la parte inferior derecha del icono de la barra de tareas. Si este parámetro es <code>null</code>, se borra la superposición</li>\n<li><code>description</code> Cadena- una descripción que se facilitará a los lectores de la pantalla Accessibility</li>\n</ul>\n<p>Establece una superposición de 16 x 16 píxeles sobre el icono actual de la barra de tareas. Generalmente se utiliza para transmitir algún tipo de estatus de la aplicación o para notificar pasivamente al usuario.</p>\n<h4 id=\"winsethasshadowhasshadow\"><a href=\"#winsethasshadowhasshadow\"><code>win.setHasShadow(hasShadow)</code></a></h4>\n<ul>\n<li><code>hasShadow</code> Boolean</li>\n</ul>\n<p>Establece si la ventana debe tener una sombra.</p>\n<h4 id=\"winhasshadow\"><a href=\"#winhasshadow\"><code>win.hasShadow()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la ventana tiene o no una sombra.</p>\n<h4 id=\"winsetopacityopacity-windows-macos\"><a href=\"#winsetopacityopacity-windows-macos\"><code>win.setOpacity(opacity)</code> <em>Windows</em> <em>macOS</em></a></h4>\n<ul>\n<li><code>opacity</code> Number- entre 0.0 (completamente transparente) y 1.0 (completamente opaco)</li>\n</ul>\n<p>Establece la opacidad de la ventana. En Linux no hace nada. Out of bound number values are clamped to the [0, 1] range.</p>\n<h4 id=\"wingetopacity\"><a href=\"#wingetopacity\"><code>win.getOpacity()</code></a></h4>\n<p>Devuelve <code>number</code> - entre 0.0 (completamente transparente) y 1.0 (totalmente opaco). En Linux, siempre devuelve 1.</p>\n<h4 id=\"winsetshaperects-windows-linux-experimental\"><a href=\"#winsetshaperects-windows-linux-experimental\"><code>win.setShape(rects)</code> <em>Windows</em> <em>Linux</em> <em>Experimental</em></a></h4>\n<ul>\n<li><code>rects</code> <a href=\"/docs/api/structures/rectangle\">Rectangle[]</a> - Sets a shape on the window. Passing an empty list reverts the window to being rectangular.</li>\n</ul>\n<p>Establecer una forma de ventana determina el área dentro de la ventana donde el sistema permite dibujar y interactuar con el usuario. Fuera de la región dada, no se dibujarán píxeles y no se registrarán eventos del ratón. Los eventos del ratón fuera de la región no será recibida por esa ventana, pero pasará a lo que esté detrás de la misma.</p>\n<h4 id=\"winsetthumbarbuttonsbuttons-windows\"><a href=\"#winsetthumbarbuttonsbuttons-windows\"><code>win.setThumbarButtons(buttons)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>buttons</code> <a href=\"/docs/api/structures/thumbar-button\">ThumbarButton[]</a></li>\n</ul>\n<p>Devuelve <code>Boolean</code> - Si los botones se añadieron o no exitosamente</p>\n<p>Añade la barra de herramientas de la vista previa con una configuración específica de los botones para la imagen previsualizada de una ventana en el plano del botón en la barra de tareas. Devuelve un objeto <code>Boolean</code> e indica si la previsualización se ha agregado con éxito.</p>\n<p>El número de botones en la barra de herramientas de la vista previa no debe ser mayor que 7 debido al limitado espacio. Una vez que se configura la barra de herramientas de la vista previa, la barra de tareas no puede ser eliminada debido a las limitaciones de la plataforma. Sin embargo, se puede llamar a la API con un arreglo vacío para limpiar los botones.</p>\n<p>Los <code>buttons</code> es un arreglo de objetos <code>Button</code>:</p>\n<ul>\n<li><code>Button</code> Object<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - El icono que muestra la barra de herramientas de la vista previa.</li>\n<li><code>click</code> Función</li>\n<li><code>tooltip</code> String (opcional): el texto de la información sobre el botón.</li>\n<li><code>flags</code> String<a href=\"/docs/api/opcional\"></a> - Controla los estados y comportamientos específicos del botón. Por defecto, es <code>['enabled']</code>.</li>\n</ul></li>\n</ul>\n<p>Los <code>flags</code> es una matriz que puede incluir siguientes <code>String</code>s:</p>\n<ul>\n<li><code>enabled</code> - El botón está activo y disponible para el usuario.</li>\n<li><code>disabled</code> - El botón está deshabilitado. Está presente, pero tiene un estado visual indicando que no responderá a la acción del usuario.</li>\n<li><code>dismissonclick</code> - Cuando se hace clic en el botón, la ventana de miniatura se cierra de inmediato.</li>\n<li><code>nobackground</code> - No dibuja un borde del botón, usa solo la imagen.</li>\n<li><code>hidden</code> - El botón no es mostrado al usuario.</li>\n<li><code>noninteractive</code> - El botón está habilitado pero no es interactivo; no se dibuja el estado del botón pulsado. Este valor está destinado a instancias donde el botón se utiliza en una notificación.</li>\n</ul>\n<h4 id=\"winsetthumbnailclipregion-windows\"><a href=\"#winsetthumbnailclipregion-windows\"><code>win.setThumbnailClip(region)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>region</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - la región de la ventana</li>\n</ul>\n<p>Establece la región de la ventana para mostrar como la vista previa de la imagen es mostrada cuando se pasa sobre la ventana en la barra de tareas. Puede restablecer la miniatura de la la ventana completa simplemente especificando una región vacía: <code>{ x: 0, y: 0, width: 0, height: 0 }</code>.</p>\n<h4 id=\"winsetthumbnailtooltiptooltip-windows\"><a href=\"#winsetthumbnailtooltiptooltip-windows\"><code>win.setThumbnailToolTip(toolTip)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>toolTip</code> String</li>\n</ul>\n<p>Configura la descripción emergente que se muestra cuando se pasa sobre la vista previa de la ventana en la barra de tareas.</p>\n<h4 id=\"winsetappdetailsoptions-windows\"><a href=\"#winsetappdetailsoptions-windows\"><code>win.setAppDetails(options)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>appId</code> String (opcional) - El <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391569(v=vs.85).aspx\">App User Model ID</a> de Windows. Tiene que estar configurado, de lo contrario las otras opciones no tendrán efecto.</li>\n<li><code>appIconPath</code> String (opcional) - El <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391573(v=vs.85).aspx\">Relaunch Icon</a> de Windows.</li>\n<li><code>appIconIndex</code> Integer (optional) - Index of the icon in <code>appIconPath</code>. Ignored when <code>appIconPath</code> is not set. Por defecto es <code>0</code>.</li>\n<li><code>relaunchCommand</code> String (opcional) - El <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391571(v=vs.85).aspx\">Relaunch Command</a> de Windows.</li>\n<li><code>relaunchDisplayName</code> String (opcional) - El <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391572(v=vs.85).aspx\">Relaunch Display Name</a> de Windows.</li>\n</ul></li>\n</ul>\n<p>Establece las propiedades para el botón de la barra de herramientas de la ventana.</p>\n<p><strong>Note:</strong> <code>relaunchCommand</code> y <code>relaunchDisplayName</code> siempre deben ser establecidos juntos. Si una de esas propiedades no está establecida, entonces ninguna será usada.</p>\n<h4 id=\"winshowdefinitionforselection-macos\"><a href=\"#winshowdefinitionforselection-macos\"><code>win.showDefinitionForSelection()</code> <em>macOS</em></a></h4>\n<p>Es igual a <code>webContents.showDefinitionForSelection()</code>.</p>\n<h4 id=\"winseticonicon-windows-linux\"><a href=\"#winseticonicon-windows-linux\"><code>win.setIcon(icon)</code> <em>Windows</em> <em>Linux</em></a></h4>\n<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String</li>\n</ul>\n<p>Cambia el icono de la ventana.</p>\n<h4 id=\"winsetwindowbuttonvisibilityvisible-macos\"><a href=\"#winsetwindowbuttonvisibilityvisible-macos\"><code>win.setWindowButtonVisibility(visible)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n</ul>\n<p>Establece si los botones de luz del tráfico de ventana deben estar visibles.</p>\n<h4 id=\"winsetautohidemenubarhide\"><a href=\"#winsetautohidemenubarhide\"><code>win.setAutoHideMenuBar(hide)</code></a></h4>\n<ul>\n<li><code>hide</code> Boolean</li>\n</ul>\n<p>Establece si el menu bar de la ventana debe ocultarse a si misma automáticamente o no. Once set the menu bar will only show when users press the single <code>Alt</code> key.</p>\n<p>If the menu bar is already visible, calling <code>setAutoHideMenuBar(true)</code> won't hide it immediately.</p>\n<h4 id=\"winismenubarautohide\"><a href=\"#winismenubarautohide\"><code>win.isMenuBarAutoHide()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la barra de menú se oculta o no automáticamente.</p>\n<h4 id=\"winsetmenubarvisibilityvisible-windows-linux\"><a href=\"#winsetmenubarvisibilityvisible-windows-linux\"><code>win.setMenuBarVisibility(visible)</code> <em>Windows</em> <em>Linux</em></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n</ul>\n<p>Establece si la barra de menú debe estar visible. If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single <code>Alt</code> key.</p>\n<h4 id=\"winismenubarvisible\"><a href=\"#winismenubarvisible\"><code>win.isMenuBarVisible()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la barra de menú es visible o no.</p>\n<h4 id=\"winsetvisibleonallworkspacesvisible-options\"><a href=\"#winsetvisibleonallworkspacesvisible-options\"><code>win.setVisibleOnAllWorkspaces(visible[, options])</code></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>visibleOnFullScreen</code> Boolean (opcional) <em>macOS</em> - Establece si la ventana debe ser visible encima de la ventanas de pantalla completas.</li>\n<li><code>skipTransformProcessType</code> Boolean (opcional) <em>macOS</em> - Llamando a setVisibleOnAllWorkspaces por defecto transformará el tipo de proceso entre UIElementApplication y ForegroundApplication para asegurar el comportamiento correcto. Sin embargo, esto ocultará la ventana y el dock por un tiempo corto cada vez que es llamado. Si su ventana ya es de tipo UIElementApplication, puede saltarse esta tranformación pasando true a skipTransformProcessType.</li>\n</ul></li>\n</ul>\n<p>Establece si la ventana debe ser visible o no en todos los espacios de trabajo.</p>\n<p><strong>Nota:</strong> Esta API no hace nada en Windows.</p>\n<h4 id=\"winisvisibleonallworkspaces\"><a href=\"#winisvisibleonallworkspaces\"><code>win.isVisibleOnAllWorkspaces()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la ventana es visible en todos los espacios de trabajo.</p>\n<p><strong>Nota:</strong> Esta API siempre devuelve false en Windows.</p>\n<h4 id=\"winsetignoremouseeventsignore-options\"><a href=\"#winsetignoremouseeventsignore-options\"><code>win.setIgnoreMouseEvents(ignore[, options])</code></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>forward</code> Boolean (opcional) <em>macOS</em> <em>Windows</em> - Si es true, enviá el mensaje de movimiento de mouse a Chromium, permitiendo eventos relacionados tal como <code>mouseleave</code>. Solo se usa cuando <code>ignore</code> es verdadero. Si <code>ignore</code> es falso, el reenvío está simpre desactivado independientemente de este valor.</li>\n</ul></li>\n</ul>\n<p>Hace que la ventana ignore todos los eventos del ratón.</p>\n<p>Todos los eventos del ratón ocurridos en esta ventana se pasarán a la ventana debajo de esta ventana, pero si esta ventana esta enfocada, todavía recibirá los eventos del teclado.</p>\n<h4 id=\"winsetcontentprotectionenable-macos-windows\"><a href=\"#winsetcontentprotectionenable-macos-windows\"><code>win.setContentProtection(enable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Evita que los contenidos de la ventana sean capturados por otras aplicaciones.</p>\n<p>On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows it calls SetWindowDisplayAffinity with <code>WDA_EXCLUDEFROMCAPTURE</code>. For Windows 10 version 2004 and up the window will be removed from capture entirely, older Windows versions behave as if <code>WDA_MONITOR</code> is applied capturing a black window.</p>\n<h4 id=\"winsetfocusablefocusable-macos-windows\"><a href=\"#winsetfocusablefocusable-macos-windows\"><code>win.setFocusable(focusable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>focusable</code> Boolean</li>\n</ul>\n<p>Cambia si se puede enfocar o no la ventana.</p>\n<p>En macOS no elimina el foco de la ventana.</p>\n<h4 id=\"winisfocusable-macos-windows\"><a href=\"#winisfocusable-macos-windows\"><code>win.isFocusable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Devuelve si la ventana puede ser enfocada.</p>\n<h4 id=\"winsetparentwindowparent\"><a href=\"#winsetparentwindowparent\"><code>win.setParentWindow(parent)</code></a></h4>\n<ul>\n<li><code>parent</code> BrowserWindow | null</li>\n</ul>\n<p>Establece <code>parent</code> como la ventana de la ventana principal actual. Al pasar <code>null</code> cambiará la ventana actual a una ventana de nivel superior.</p>\n<h4 id=\"wingetparentwindow\"><a href=\"#wingetparentwindow\"><code>win.getParentWindow()</code></a></h4>\n<p>Devuelve <code>BrowserWindow</code> - La ventana principal.</p>\n<h4 id=\"wingetchildwindows\"><a href=\"#wingetchildwindows\"><code>win.getChildWindows()</code></a></h4>\n<p>Devuelve <code>BrowserWindow[]</code> - Todas las ventanas secundarias.</p>\n<h4 id=\"winsetautohidecursorautohide-macos\"><a href=\"#winsetautohidecursorautohide-macos\"><code>win.setAutoHideCursor(autoHide)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>autoHide</code> Boolean</li>\n</ul>\n<p>Controla si se debe ocultar el cursor al escribir.</p>\n<h4 id=\"winselectprevioustab-macos\"><a href=\"#winselectprevioustab-macos\"><code>win.selectPreviousTab()</code> <em>macOS</em></a></h4>\n<p>Selecciona la pestaña previa cuando las pestañas nativas están activas y hay otras pestañas en la ventana.</p>\n<h4 id=\"winselectnexttab-macos\"><a href=\"#winselectnexttab-macos\"><code>win.selectNextTab()</code> <em>macOS</em></a></h4>\n<p>Selecciona la siguiente pestaña cuando las pestañas nativas están activas y hay otras pestañas en la ventana.</p>\n<h4 id=\"winmergeallwindows-macos\"><a href=\"#winmergeallwindows-macos\"><code>win.mergeAllWindows()</code> <em>macOS</em></a></h4>\n<p>Unifica todas las ventanas en una sola con múltiples pestañas cuando las pestañas nativas están activas y hay más de una ventana abierta.</p>\n<h4 id=\"winmovetabtonewwindow-macos\"><a href=\"#winmovetabtonewwindow-macos\"><code>win.moveTabToNewWindow()</code> <em>macOS</em></a></h4>\n<p>Mueve la pestaña actual a una nueva ventana si las pestañas nativas están activas y hay más de una pestaña en la ventana actual.</p>\n<h4 id=\"wintoggletabbar-macos\"><a href=\"#wintoggletabbar-macos\"><code>win.toggleTabBar()</code> <em>macOS</em></a></h4>\n<p>Conmuta la visibilidad de la barra de pestañas si las pestañas nativas están activas y hay solo una pestaña en la ventana actual.</p>\n<h4 id=\"winaddtabbedwindowbrowserwindow-macos\"><a href=\"#winaddtabbedwindowbrowserwindow-macos\"><code>win.addTabbedWindow(browserWindow)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>browserWindow</code> BrowserWindow</li>\n</ul>\n<p>Añade una ventana como pestaña de la ventana actual, después de la pestaña para la instancia de la ventana actual.</p>\n<h4 id=\"winsetvibrancytype-macos\"><a href=\"#winsetvibrancytype-macos\"><code>win.setVibrancy(type)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>type</code> String | null - Puede ser <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>titlebar</code>, <code>selection</code>, <code>menu</code>, <code>popover</code>, <code>sidebar</code>, <code>medium-light</code>, <code>ultra-dark</code>, <code>header</code>, <code>sheet</code>, <code>window</code>, <code>hud</code>, <code>fullscreen-ui</code>, <code>tooltip</code>, <code>content</code>, <code>under-window</code>, o <code>under-page</code>. Para más detalles, ver <a href=\"https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc\">macOS documentation</a>.</li>\n</ul>\n<p>Añade un efecto de vibración a la ventana del navegador. Passing <code>null</code> or an empty string will remove the vibrancy effect on the window.</p>\n<p>Note que <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>medium-light</code>, y <code>ultra-dark</code> han sido marcadas como obsoletas y serán eliminadas un un próxima versión de macOS.</p>\n<h4 id=\"winsettrafficlightpositionposition-macos\"><a href=\"#winsettrafficlightpositionposition-macos\"><code>win.setTrafficLightPosition(position)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Punto</a></li>\n</ul>\n<p>Establece una posición personalizada para los botones del semáforo en la ventana sin marco.</p>\n<h4 id=\"wingettrafficlightposition-macos\"><a href=\"#wingettrafficlightposition-macos\"><code>win.getTrafficLightPosition()</code> <em>macOS</em></a></h4>\n<p>Devuelve <code>Point</code> - La posición personalizada para los botones del semáforo en la ventana sin marco.</p>\n<h4 id=\"winsettouchbartouchbar-macos\"><a href=\"#winsettouchbartouchbar-macos\"><code>win.setTouchBar(touchBar)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>touchBar</code> TouchBar | null</li>\n</ul>\n<p>Configura el plano de la touchBar para la ventana actual. Espeficando <code>null</code> o <code>undefined</code> elimina la barra táctil. Este método solo es efectivo si la máquina tiene una barra táctil y si se está ejecutando en macOS 10.12.1+.</p>\n<p><strong>Nota:</strong> La API TouchBar API actualmente es experimental y puede cambiar o ser eliminada en futuras versiones de Electron.</p>\n<h4 id=\"winsetbrowserviewbrowserview-experimental\"><a href=\"#winsetbrowserviewbrowserview-experimental\"><code>win.setBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a> | null - Adjunta <code>browserView</code> a <code>win</code>. Si hay otros <code>BrowserView</code>s adjuntos, se eliminarán de esta ventana.</li>\n</ul>\n<h4 id=\"wingetbrowserview-experimental\"><a href=\"#wingetbrowserview-experimental\"><code>win.getBrowserView()</code> <em>Experimental</em></a></h4>\n<p>Devuelve <code>BrowserView | null</code> - El <code>BrowserView</code> adjunto a <code>win</code>. Devuelve <code>null</code> si uno no esta adjunto. Lanza un error si múltiples <code>BrowserView</code> son adjuntos.</p>\n<h4 id=\"winaddbrowserviewbrowserview-experimental\"><a href=\"#winaddbrowserviewbrowserview-experimental\"><code>win.addBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>API de reemplazo para setBrowserView soporta el trabajo con múltiples vistas de navegador.</p>\n<h4 id=\"winremovebrowserviewbrowserview-experimental\"><a href=\"#winremovebrowserviewbrowserview-experimental\"><code>win.removeBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<h4 id=\"winsettopbrowserviewbrowserview-experimental\"><a href=\"#winsettopbrowserviewbrowserview-experimental\"><code>win.setTopBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>Levanta un <code>browserView</code> sobre otro <code>BrowserView</code> adjunto a <code>win</code>. Lanza un error si <code>browserView</code> no está adjunto a <code>win</code>.</p>\n<h4 id=\"wingetbrowserviews-experimental\"><a href=\"#wingetbrowserviews-experimental\"><code>win.getBrowserViews()</code> <em>Experimental</em></a></h4>\n<p>Devuelve <code>BrowserView[]</code> - Un array de todos los BrowserViews que han sido adjuntados con <code>addBrowserView</code> or <code>setBrowserView</code>.</p>\n<p><strong>Nota:</strong> actualmente la API BrowserView es experimental y puede cambiar o ser eliminada en versiones futuras de Electron.</p>",
      "title": "BrowserWindow",
      "description": "Crea y controla las ventanas del navegador."
    },
    "/docs/api/browser-window-proxy": {
      "locale": "es-ES",
      "slug": "browser-window-proxy",
      "href": "/docs/api/browser-window-proxy",
      "crowdinFileId": "256285",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-window-proxy.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-browserwindowproxy\"><a href=\"#clase-browserwindowproxy\">Clase: BrowserWindowProxy</a></h2>\n<blockquote>\n<p>Manipula la ventana secundaria del navegador</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>El objeto <code>BrowserWindowProxy</code> es devuelto de <code>window.open</code> y proporciona una funcionalidad limitada con la ventana secundaria.</p>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<p>El objeto <code>BrowserWindowProxy</code> tiene los siguientes métodos de instancia:</p>\n<h4 id=\"winblur\"><a href=\"#winblur\"><code>win.blur()</code></a></h4>\n<p>Elimina el enfoque de la ventana secundaria.</p>\n<h4 id=\"winclose\"><a href=\"#winclose\"><code>win.close()</code></a></h4>\n<p>Cierra a la fuerza la ventana secundaria sin llamar a su evento de descarga.</p>\n<h4 id=\"winevalcode\"><a href=\"#winevalcode\"><code>win.eval(code)</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n</ul>\n<p>Evalúa el código en la ventana secundaria.</p>\n<h4 id=\"winfocus\"><a href=\"#winfocus\"><code>win.focus()</code></a></h4>\n<p>Enfoca la ventana secundaria (trae la ventana al frente).</p>\n<h4 id=\"winprint\"><a href=\"#winprint\"><code>win.print()</code></a></h4>\n<p>Invoca en cuadro de diálogo en la ventana secundaria.</p>\n<h4 id=\"winpostmessagemessage-targetorigin\"><a href=\"#winpostmessagemessage-targetorigin\"><code>win.postMessage(message, targetOrigin)</code></a></h4>\n<ul>\n<li><code>mensaje</code> cualquiera</li>\n<li><code>targetOrigin</code> String</li>\n</ul>\n<p>Envía un mensaje a la ventana secundaria con el origen específicado o <code>*</code> sin origen de preferencia.</p>\n<p>Además de estos métodos, la ventana secundaria implementa el objeto <code>window.opener</code> sin ninguna propiedad y un método único.</p>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<p>El objeto <code>BrowserWindowProxy</code> tiene las siguientes propiedades de instancia:</p>\n<h4 id=\"winclosed\"><a href=\"#winclosed\"><code>win.closed</code></a></h4>\n<p>Un <code>Boolean</code> que cambia a true cuando la ventana secundaria se cierra.</p>",
      "title": "Clase: BrowserWindowProxy",
      "description": "Manipula la ventana secundaria del navegador"
    },
    "/docs/development/build-instructions-gn": {
      "locale": "es-ES",
      "slug": "build-instructions-gn",
      "href": "/docs/development/build-instructions-gn",
      "crowdinFileId": "256131",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-gn.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"instrucciones-de-compilación\"><a href=\"#instrucciones-de-compilación\">Instrucciones de Compilación</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong>, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"pre-requisitos-de-la-plataforma\"><a href=\"#pre-requisitos-de-la-plataforma\">Pre-requisitos de la Plataforma</a></h2>\n<p>Comprueba los pre-requisitos de tu plataforma para la compilación antes de avanzar</p>\n<ul>\n<li><a href=\"/docs/development/build-instructions-macos#prerequisites\">macOS</a></li>\n<li><a href=\"/docs/development/build-instructions-linux#prerequisites\">Linux</a></li>\n<li><a href=\"/docs/development/build-instructions-windows#prerequisites\">Windows</a></li>\n</ul>\n<h2 id=\"herramientas-de-construcción\"><a href=\"#herramientas-de-construcción\">Herramientas de construcción</a></h2>\n<p><a href=\"https://github.com/electron/build-tools\">Electron's Build Tools</a> automate much of the setup for compiling Electron from source with different configurations and build targets. Si deseas configurar el entorno de forma manual, las instrucciones se enumeran a continuación.</p>\n<h2 id=\"pre-requisitos-de-gn\"><a href=\"#pre-requisitos-de-gn\">Pre-requisitos de GN</a></h2>\n<p>Necesitaras instalar <a href=\"https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up\"><code>depot_tools</code></a>, el conjunto de herramientas usadas para consumir Chromium y sus dependencias.</p>\n<p>Ademas, en Windows, tendrás que asignar la variable de ambiente <code> DEPOT_TOOLS_WIN_TOOLCHAIN=0</code>. Para hacerlo, abre <code>Panel de Control</code> → <code>Sistema y Seguridad</code> → <code>Sistema</code> → <code>Opciones de Configuración Avanzadas</code> y agrega a tu sistema la variable de ambiente <code> DEPOT_TOOLS_WIN_TOOLCHAIN</code> con el valor <code>0</code>.  Esto le indica a <code>depot_tools</code> que utilice tu version instalada de Visual Studio (por defecto, <code>depot_tools</code> intentará descargar una version interna de Google, a la cual solo empleados de Google tienen acceso).</p>\n<h3 id=\"configurar-el-cache-de-git\"><a href=\"#configurar-el-cache-de-git\">Configurar el cache de Git</a></h3>\n<p>Si planeas hacer checkout de Electron más de una vez (por ejemplo, para tener múltiples directorios paralelos verificados en diferentes ramas), el uso del cache git acelerará las llamadas posteriores a <code>gclient</code>. Para hacer esto, establezca una variable de entorno <code>GIT_CACHE_PATH</code>:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">export</span> GIT_CACHE_PATH=<span class=\"hljs-string\">\"<span class=\"hljs-variable\">${HOME}</span>/.git_cache\"</span>\n$ mkdir -p <span class=\"hljs-string\">\"<span class=\"hljs-variable\">${GIT_CACHE_PATH}</span>\"</span>\n<span class=\"hljs-comment\"># Esto usará alrededor de 16G.</span>\n</code></pre>\n<h2 id=\"obteniendo-el-código\"><a href=\"#obteniendo-el-código\">Obteniendo el código</a></h2>\n<pre><code class=\"hljs language-sh\">$ mkdir electron &#x26;&#x26; <span class=\"hljs-built_in\">cd</span> electron\n$ gclient config --name <span class=\"hljs-string\">\"src/electron\"</span> --unmanaged https://github.com/electron/electron\n$ gclient sync --with_branch_heads --with_tags\n<span class=\"hljs-comment\"># This will take a while, go get a coffee.</span>\n</code></pre>\n<blockquote>\n<p>En lugar de <code>https://github.com/electron/electron</code>, puedes usar tu propio fork aquí (algo como <code>https://github.com/&#x3C;username>/electron</code>).</p>\n</blockquote>\n<h3 id=\"una-nota-al-tirarempujar\"><a href=\"#una-nota-al-tirarempujar\">Una nota al tirar/empujar</a></h3>\n<p>Si usted tiene la intención de <code>git pull</code> or <code>git push</code> desde el repositorio oficial <code>electron</code> en el futuro, ahora necesita actualizar las URLs de la carpeta origin correspondiente.</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src/electron\n$ git remote remove origin\n$ git remote add origin https://github.com/electron/electron\n$ git checkout main\n$ git branch --<span class=\"hljs-built_in\">set</span>-upstream-to=origin/main\n$ <span class=\"hljs-built_in\">cd</span> -\n</code></pre>\n<p>📝 <code>gclient</code> funciona verificando las dependencias en un archivo llamado <code>DEPS</code> dentro de la carpeta <code>src/electron</code> (tales como Chromium o Node.js). Ejecutar <code>gclient sync -f</code> asegura que todas las dependencias requeridas para compilar Electron coninciden con ese archivo.</p>\n<p>Así que, para tirar, ejecutarías los siguientes comandos:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src/electron\n$ git pull\n$ gclient sync -f\n</code></pre>\n<h2 id=\"compilando\"><a href=\"#compilando\">Compilando</a></h2>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src\n$ <span class=\"hljs-built_in\">export</span> CHROMIUM_BUILDTOOLS_PATH=`<span class=\"hljs-built_in\">pwd</span>`/buildtools\n$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p>O en Windows (sin el argumento opcional):</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src\n$ <span class=\"hljs-built_in\">set</span> CHROMIUM_BUILDTOOLS_PATH=%<span class=\"hljs-built_in\">cd</span>%\\buildtools\n$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\")\"</span>\n</code></pre>\n<p>Esto generará un directorio de compilación <code>out/Testing</code> under <code>src/</code> con la configuración de compilación de pruebas. Usted puede reemplazar <code>Testing</code> con otro nombre, pero debería ser a subdirectorio de <code>out</code>. Además no deberías ejecutar <code>gn gen</code> de nuevo — si quieres cambiar los argumentos de compilación, puedes ejecutar <code>gn args out/Testing</code> para traer un editor.</p>\n<p>Para ver la lista de opciones de configuraciones disponible, ejecute <code>gn args out/Testing --list</code>.</p>\n<p><strong>Para generar la configuración de compilación de prueba de Electron:</strong></p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p><strong>Para generar la configuración de lanzamiento (alias \"non-component\" o \"static\") de Electron:</strong></p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Release --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/release.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p><strong>Para compilar, corra <code>ninja</code> con el <code>electron</code> target:</strong> Nota Bene: Esto también tomará un tiempo y probablemente calentará tu regazo.</p>\n<p>Para la configuración de depuración:</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Testing electron\n</code></pre>\n<p>Para la configuración de la lanzamiento:</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Release electron\n</code></pre>\n<p>This will build all of what was previously 'libchromiumcontent' (i.e. the <code>content/</code> directory of <code>chromium</code> and its dependencies, incl. WebKit and V8), so it will take a while.</p>\n<p>El ejecutable compilado estará en <code>./out/Testing</code>:</p>\n<pre><code class=\"hljs language-sh\">$ ./out/Testing/Electron.app/Contents/MacOS/Electron\n<span class=\"hljs-comment\"># or, on Windows</span>\n$ ./out/Testing/electron.exe\n<span class=\"hljs-comment\"># or, on Linux</span>\n$ ./out/Testing/electron\n</code></pre>\n<h3 id=\"embalaje\"><a href=\"#embalaje\">Embalaje</a></h3>\n<p>En linux, primero elimine la información de depuración y de símbolos:</p>\n<pre><code class=\"hljs language-sh\">electron/script/strip-binaries.py -d out/Release\n</code></pre>\n<p>Para empaquetar la aplicación compilada electron como un archivo zip distribuible:</p>\n<pre><code class=\"hljs language-sh\">ninja -C out/Release electron:electron_dist_zip\n</code></pre>\n<h3 id=\"compilación-cruzada\"><a href=\"#compilación-cruzada\">Compilación cruzada</a></h3>\n<p>Para compilar una plataforma que no sea la misma que la que estás construyendo, establece los argumentos GN <code>target_cpu</code> y <code>target_os</code>. Por ejemplo, para compilar un objetivo x86 de un host x64, especificar <code>target_cpu = \"x86\"</code> en <code>gn args</code>.</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing-x86 --args=<span class=\"hljs-string\">'... target_cpu = \"x86\"'</span>\n</code></pre>\n<p>No todas las combinaciones de origen y destino sea CPU/SO son compatibles con Chromium.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Host</th><th>Objetivo</th><th>Estado</th></tr></thead><tbody><tr><td>Windows x64</td><td>Windows arm64</td><td>Experimental</td></tr><tr><td>Windows x64</td><td>Windows x86</td><td>Automáticamente probado</td></tr><tr><td>Linux x64</td><td>Linux x86</td><td>Automáticamente probado</td></tr></tbody></table>\n<p>Si prueba otras combinaciones y las encuentra para funcionar, por favor actualice este documento :)</p>\n<p>See the GN reference for allowable values of <a href=\"https://gn.googlesource.com/gn/+/master/docs/reference.md#built_in-predefined-variables-target_os_the-desired-operating-system-for-the-build-possible-values\"><code>target_os</code></a> and <a href=\"https://gn.googlesource.com/gn/+/master/docs/reference.md#built_in-predefined-variables-target_cpu_the-desired-cpu-architecture-for-the-build-possible-values\"><code>target_cpu</code></a>.</p>\n<h4 id=\"windows-en-arm-experimental\"><a href=\"#windows-en-arm-experimental\">Windows en Arm (experimental)</a></h4>\n<p>Para compilar de forma cruzada para Windows en Arm, <a href=\"https://chromium.googlesource.com/chromium/src/+/refs/heads/master/docs/windows_build_instructions.md#Visual-Studio\">follow Chromium's guide</a> para obtener las dependencias necesarias, SDK y librerias, luego construir con <code>ELECTRON_BUILDING_WOA=1</code> en su entorno antes de ejecutar <code>gclient sync</code>.</p>\n<pre><code class=\"hljs language-bat\"><span class=\"hljs-built_in\">set</span> ELECTRON_BUILDING_WOA=<span class=\"hljs-number\">1</span>\ngclient sync -f --with_branch_heads --with_tags\n</code></pre>\n<p>O (si usa PowerShell):</p>\n<pre><code class=\"hljs language-powershell\"><span class=\"hljs-variable\">$env:ELECTRON_BUILDING_WOA</span>=<span class=\"hljs-number\">1</span>\ngclient sync -f --with_branch_heads --with_tags\n</code></pre>\n<p>Despues, corra <code>gn gen</code> como arriba con <code>target_cpu=\"arm64\"</code>.</p>\n<h2 id=\"verificación\"><a href=\"#verificación\">Verificación</a></h2>\n<p>Para ejecutar las pruebas, primero deberás compilar los módulos de prueba en la misma versión de node.js en la que se creó el proceso de compilación. Para generar cabeceras de compilación para los módulos a compilar, ejecute lo siguiente en el directorio <code>src/</code>.</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Testing third_party/electron_node:headers\n</code></pre>\n<p>Ahora puede ejecutar <a href=\"/docs/development/testing#unit-tests\">run the tests</a>.</p>\n<p>Si estás depurando algo, puede ser de gran ayuda pasarle algunas banderas adicionales a el binario de Electron:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span> -- \\\n  --<span class=\"hljs-built_in\">enable</span>-logging -g <span class=\"hljs-string\">'BrowserWindow module'</span>\n</code></pre>\n<h2 id=\"compartir-la-caché-git-entre-varias-máquinas\"><a href=\"#compartir-la-caché-git-entre-varias-máquinas\">Compartir la caché git entre varias máquinas</a></h2>\n<p>Es posible compartir este directorio con otras máquinas exportándolo como SMB share en Linux, pero solo un proceso/máquina puede usar la memoria caché a la vez. Los bloqueos creados por el script git-cache intentarán evitar esto, pero puede que no funcione perfectamente en una red.</p>\n<p>En Windows, SMBv2 tiene un caché de directorio que causará problemas con el script del git cache, por lo que es necesario desactivarlo configurando la clave de registro</p>\n<pre><code class=\"hljs language-sh\">HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\Lanmanworkstation\\Parameters\\DirectoryCacheLifetime\n</code></pre>\n<p>a cero. Para más información: <a href=\"https://stackoverflow.com/a/9935126\">https://stackoverflow.com/a/9935126</a></p>\n<p>Esto puede establecerse rápidamente en powershell (ejecutado como administrador):</p>\n<pre><code class=\"hljs language-powershell\"><span class=\"hljs-built_in\">New-ItemProperty</span> -Path <span class=\"hljs-string\">\"HKLM:\\System\\CurrentControlSet\\Services\\Lanmanworkstation\\Parameters\"</span> -Name DirectoryCacheLifetime -Value <span class=\"hljs-number\">0</span> -PropertyType DWORD -Force\n</code></pre>\n<h2 id=\"problemas\"><a href=\"#problemas\">Problemas</a></h2>\n<h3 id=\"gclient-sync-se-queja-sobre-rebase\"><a href=\"#gclient-sync-se-queja-sobre-rebase\">gclient sync se queja sobre rebase</a></h3>\n<p>Si <code>gclient sync</code> es interrumpido el arbol de git puede quedar en mal estado, lo que conduce a un mensaje críptico cuando se ejecuta <code>gclient sync</code> en el futuro:</p>\n<pre><code class=\"hljs language-plaintext\">2> Conflict while rebasing this branch.\n2> Fix the conflict and run gclient again.\n2> See man git-rebase for details.\n</code></pre>\n<p>Si no hay conflictos de git o rebases en <code>src/electron</code>, puede necesitar abortar un <code>git am</code> en <code>src</code>:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> ../\n$ git am --abort\n$ <span class=\"hljs-built_in\">cd</span> electron\n$ gclient sync -f\n</code></pre>\n<h3 id=\"se-me-está-pidiendo-un-nombre-de-usuariocontraseña-para-chromium-internalgooglesourcecom\"><a href=\"#se-me-está-pidiendo-un-nombre-de-usuariocontraseña-para-chromium-internalgooglesourcecom\">Se me está pidiendo un nombre de usuario/contraseña para chromium-internal.googlesource.com</a></h3>\n<p>Si ve un prompt para <code>Username for 'https://chrome-internal.googlesource.com':</code> cuando corre <code>gclient sync</code> en Windows, es probable que la variable de entorno <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> no esta establecida a 0. Abra <code>Control Panel</code> → <code>System and Security</code> → <code>System</code> → <code>Advanced system settings</code> y agregue un variable de sistema <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> con valor <code>0</code>.  Esto le indica a <code>depot_tools</code> que utilice tu version instalada de Visual Studio (por defecto, <code>depot_tools</code> intentará descargar una version interna de Google, a la cual solo empleados de Google tienen acceso).</p>",
      "title": "Instrucciones de Compilación",
      "description": "En lugar de https://github.com/electron/electron, puedes usar tu propio fork aquí (algo como https://github.com/<username>/electron)."
    },
    "/docs/development/build-instructions-linux": {
      "locale": "es-ES",
      "slug": "build-instructions-linux",
      "href": "/docs/development/build-instructions-linux",
      "crowdinFileId": "256133",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-linux.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"instrucciones-de-compilación-linux\"><a href=\"#instrucciones-de-compilación-linux\">Instrucciones de compilación (Linux)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on Linux, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>\n<p>At least 25GB disk space and 8GB RAM.</p>\n</li>\n<li>\n<p>Python 2.7.x. Some distributions like CentOS 6.x still use Python 2.6.x so you may need to check your Python version with <code>python -V</code>.</p>\n<p>Please also ensure that your system and Python version support at least TLS 1.2. For a quick test, run the following script:</p>\n<pre><code class=\"hljs language-sh\">$ npx @electron/check-python-tls\n</code></pre>\n<p>If the script returns that your configuration is using an outdated security protocol, use your system's package manager to update Python to the latest version in the 2.7.x branch. Alternatively, visit <a href=\"https://www.python.org/downloads/\">https://www.python.org/downloads/</a> for detailed instructions.</p>\n</li>\n<li>\n<p>Node.js. There are various ways to install Node. You can download source code from <a href=\"https://nodejs.org\">nodejs.org</a> and compile it. Doing so permits installing Node on your own home directory as a standard user. Or try repositories such as <a href=\"https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories\">NodeSource</a>.</p>\n</li>\n<li>\n<p><a href=\"https://clang.llvm.org/get_started.html\">clang</a> 3.4 or later.</p>\n</li>\n<li>\n<p>Development headers of GTK 3 and libnotify.</p>\n</li>\n</ul>\n<p>On Ubuntu, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install build-essential clang libdbus-1-dev libgtk-3-dev \\\n                       libnotify-dev libgnome-keyring-dev \\\n                       libasound2-dev libcap-dev libcups2-dev libxtst-dev \\\n                       libxss1 libnss3-dev gcc-multilib g++-multilib curl \\\n                       gperf bison python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On RHEL / CentOS, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo yum install clang dbus-devel gtk3-devel libnotify-devel \\\n                   libgnome-keyring-devel xorg-x11-server-utils libcap-devel \\\n                   cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \\\n                   nss-devel python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On Fedora, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo dnf install clang dbus-devel gtk3-devel libnotify-devel \\\n                   libgnome-keyring-devel xorg-x11-server-utils libcap-devel \\\n                   cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \\\n                   nss-devel python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On Arch Linux / Manjaro, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo pacman -Syu base-devel clang libdbus gtk2 libnotify \\\n                   libgnome-keyring alsa-lib libcap libcups libxtst \\\n                   libxss nss gcc-multilib curl gperf bison \\\n                   python2 python-dbusmock jdk8-openjdk\n</code></pre>\n<p>Other distributions may offer similar packages for installation via package managers such as pacman. Or one can compile from source code.</p>\n<h3 id=\"cross-compilation\"><a href=\"#cross-compilation\">Cross compilation</a></h3>\n<p>If you want to build for an <code>arm</code> target you should also install the following dependencies:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install libc6-dev-armhf-cross linux-libc-dev-armhf-cross \\\n                       g++-arm-linux-gnueabihf\n</code></pre>\n<p>Similarly for <code>arm64</code>, install the following:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install libc6-dev-arm64-cross linux-libc-dev-arm64-cross \\\n                       g++-aarch64-linux-gnu\n</code></pre>\n<p>And to cross-compile for <code>arm</code> or <code>ia32</code> targets, you should pass the <code>target_cpu</code> parameter to <code>gn gen</code>:</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">'import(...) target_cpu=\"arm\"'</span>\n</code></pre>\n<h2 id=\"compilando\"><a href=\"#compilando\">Compilando</a></h2>\n<p>See <a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a></p>\n<h2 id=\"problemas\"><a href=\"#problemas\">Problemas</a></h2>\n<h3 id=\"error-while-loading-shared-libraries-libtinfoso5\"><a href=\"#error-while-loading-shared-libraries-libtinfoso5\">Error While Loading Shared Libraries: libtinfo.so.5</a></h3>\n<p>Prebuilt <code>clang</code> will try to link to <code>libtinfo.so.5</code>. Depending on the host architecture, symlink to appropriate <code>libncurses</code>:</p>\n<pre><code class=\"hljs language-sh\">$ sudo ln -s /usr/lib/libncurses.so.5 /usr/lib/libtinfo.so.5\n</code></pre>\n<h2 id=\"advanced-topics\"><a href=\"#advanced-topics\">Advanced topics</a></h2>\n<p>The default building configuration is targeted for major desktop Linux distributions. To build for a specific distribution or device, the following information may help you.</p>\n<h3 id=\"using-system-clang-instead-of-downloaded-clang-binaries\"><a href=\"#using-system-clang-instead-of-downloaded-clang-binaries\">Using system <code>clang</code> instead of downloaded <code>clang</code> binaries</a></h3>\n<p>By default Electron is built with prebuilt <a href=\"https://clang.llvm.org/get_started.html\"><code>clang</code></a> binaries provided by the Chromium project. If for some reason you want to build with the <code>clang</code> installed in your system, you can specify the <code>clang_base_path</code> argument in the GN args.</p>\n<p>For example if you installed <code>clang</code> under <code>/usr/local/bin/clang</code>:</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">'import(\"//electron/build/args/testing.gn\") clang_base_path = \"/usr/local/bin\"'</span>\n</code></pre>\n<h3 id=\"using-compilers-other-than-clang\"><a href=\"#using-compilers-other-than-clang\">Using compilers other than <code>clang</code></a></h3>\n<p>Building Electron with compilers other than <code>clang</code> is not supported.</p>",
      "title": "Instrucciones de compilación (Linux)",
      "description": ""
    },
    "/docs/development/build-instructions-macos": {
      "locale": "es-ES",
      "slug": "build-instructions-macos",
      "href": "/docs/development/build-instructions-macos",
      "crowdinFileId": "256135",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-macos.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"instrucciones-de-compilación-macos\"><a href=\"#instrucciones-de-compilación-macos\">Instrucciones de compilación (macOS)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on macOS, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>macOS >= 10.11.6</li>\n<li><a href=\"https://developer.apple.com/technologies/tools/\">Xcode</a> >= 9.0.0</li>\n<li><a href=\"https://nodejs.org\">node.js</a> (externo)</li>\n<li>Python 2.7 con soporte para TLS 1.2</li>\n</ul>\n<h2 id=\"python\"><a href=\"#python\">Python</a></h2>\n<p>Please also ensure that your system and Python version support at least TLS 1.2. Esto depende tanto de la versión de macOS como la de Python. Para una prueba rápida, ejecuta:</p>\n<pre><code class=\"hljs language-sh\">$ npx @electron/check-python-tls\n</code></pre>\n<p>Si el script devuelve que tu configuración está usando un protocolo de seguridad obsoleto, puedes actualizar macOS a High Sierra o instalar una nueva versión de Python 2.7.x. Para actualizar Python, usa <a href=\"https://brew.sh/\">Homebrew</a>:</p>\n<pre><code class=\"hljs language-sh\">$ brew install python@2 &#x26;&#x26; brew link python@2 --force\n</code></pre>\n<p>Si está utilizando Python descargado por Homebrew, también debe instalar los siguientes módulos de Python:</p>\n<ul>\n<li><a href=\"https://pypi.org/project/pyobjc/#description\">pyobjc</a></li>\n</ul>\n<p>Usted puede usar <code>pip</code> para instalarlo:</p>\n<pre><code class=\"hljs language-sh\">$ pip install pyobjc\n</code></pre>\n<h2 id=\"sdk-macos\"><a href=\"#sdk-macos\">SDK macOS</a></h2>\n<p>Si simplemente estás desarrollando Electron y no planeas redistribuir tu compilación personalizada de Electron, puede omitir esta sección.</p>\n<p>Las compilaciones oficiales de Electron son construidas con <a href=\"https://download.developer.apple.com/Developer_Tools/Xcode_12.2/Xcode_12.2.xip\">Xcode 12.2</a> y el SDK 11.0 de macOS. Construir con un SDK más nuevo también funciona, pero las versiones actualmente usan el SDK 11.0.</p>\n<h2 id=\"construyendo-electron\"><a href=\"#construyendo-electron\">Construyendo Electron</a></h2>\n<p>Ver <a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a>.</p>",
      "title": "Instrucciones de compilación (macOS)",
      "description": ""
    },
    "/docs/development/build-instructions-windows": {
      "locale": "es-ES",
      "slug": "build-instructions-windows",
      "href": "/docs/development/build-instructions-windows",
      "crowdinFileId": "256137",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-windows.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"instrucciones-de-compilación-windows\"><a href=\"#instrucciones-de-compilación-windows\">Instrucciones de compilación (Windows)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on Windows, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>Windows 10 / Server 2012 R2 o superior</li>\n<li>Visual Studio 2017 15.7.2 o posterior - <a href=\"https://www.visualstudio.com/vs/\">descargue de manera gratuita de VS 2019 Community Edition</a><ul>\n<li>Vea <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md#visual-studio\">the Chromium build documentation</a> para mas detalles sobre cuales componentes de Visual Studio son requeridos.</li>\n<li>Si tu Visual Studio está instalado en un directorio diferente que el predeterminado, necesitarás establecer unas pocas variables de entorno para apuntar las toolchains a tu ruta de instalación.<ul>\n<li><code>vs2019_install = DRIVE:\\path\\to\\Microsoft Visual Studio\\2019\\Community</code>, sustituyendo <code>2019</code> y <code>Comunidad</code> por sus versiones instaladas y sustituyendo <code>DRIVE:</code> por la unidad en la que Visual Studio está activada. A menudo, esto será <code>C:</code>.</li>\n<li><code>WINDOWSSDKDIR = DRIVE:\\path\\to\\Windows Kits\\10</code>, replacing <code>DRIVE:</code> with the drive that Windows Kits is on. A menudo, esto será <code>C:</code>.</li>\n</ul></li>\n<li>También se necesita la <a href=\"https://pypi.org/project/pywin32/#files\">extensión de Python para Windows (pywin32)</a> para ejecutar el proceso de compilación.</li>\n</ul></li>\n<li><a href=\"https://nodejs.org/download/\">Node.js</a></li>\n<li><a href=\"https://git-scm.com\">Git</a></li>\n<li>Debugging Tools for Windows of Windows SDK 10.0.15063.468 if you plan on creating a full distribution since <code>symstore.exe</code> is used for creating a symbol store from <code>.pdb</code> files.<ul>\n<li>Diferentes versiones del SDK se pueden instalar juntas. To install the SDK, open Visual Studio Installer, select <code>Modify</code> → <code>Individual Components</code>, scroll down and select the appropriate Windows SDK to install. Otra opción sería mirar el <a href=\"https://developer.microsoft.com/en-us/windows/downloads/sdk-archive\">Windows SDK y el archivo emulador</a> y descargar la versión independiente del SDK respectivamente.</li>\n<li>Las herramientas de depuración de SDK también deben ser instaladas.<a href=\"https://crowdin.com/translate/electron/13/en-es#246828\">https://crowdin.com/translate/electron/13/en-es#246828</a> Si el SDK de Windows 10 fue instalado a través del instalador de Visual Studio, entonces se puede instalar yendo a: <code>Panel de Control</code> → <code>Programas </code> → <code>Programas y Características</code> → Seleccione \"Windows Software Development Kit\" → <code>Change</code> → <code>Change</code> → Check \"Debugging Tools For Windows\" → <code>Change</code>. O puede descargar el instalador independiente del SDK y usarlo para instalar el Debugging Tools.</li>\n</ul></li>\n</ul>\n<p>Si actualmente no tiene una instalación de Windows, <a href=\"https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/\">dev.microsoftedge.com</a> tiene versiones temporales de Windows que usted puede usar para construir Electron.</p>\n<p>Electron se construye casi completamente con script de comandos de linea y no puede ser generado con Visual Studio. Puede desarrollar Electron con cualquier editor pero el soporte para construir con Visual Studio vendrá en el futuro.</p>\n<p><strong>Nota:</strong> A pesar de que Visual Studio no es usado para construir, todavía se <strong>requiere</strong> debido a que necesitamos las herramientas que provee para construir.</p>\n<h2 id=\"exclude-source-tree-from-windows-security\"><a href=\"#exclude-source-tree-from-windows-security\">Exclude source tree from Windows Security</a></h2>\n<p>Windows Security doesn't like one of the files in the Chromium source code (see <a href=\"https://crbug.com/441184\">https://crbug.com/441184</a>), so it will constantly delete it, causing <code>gclient sync</code> issues. You can exclude the source tree from being monitored by Windows Security by <a href=\"https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26\">following these instructions</a>.</p>\n<h2 id=\"compilando\"><a href=\"#compilando\">Compilando</a></h2>\n<p>Ver <a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a></p>\n<h2 id=\"arquitectura-32bit\"><a href=\"#arquitectura-32bit\">Arquitectura 32bit</a></h2>\n<p>Para construir para 32bit, usted necesita pasar <code>target_cpu = \"x86\"</code> como un argumento GN. Usted puede construir para 32bit junto con el target de 64bit usando diferentes carpetas de salida para GN, por ejemplo: <code>out/Release-x86</code> con diferentes argumentos.</p>\n<pre><code class=\"hljs language-powershell\">$ gn gen out/Release-x86 --args=<span class=\"hljs-string\">\"import(\\\"</span>//electron/build/args/release.gn\\<span class=\"hljs-string\">\") target_cpu=\\\"</span>x86\\<span class=\"hljs-string\">\"\"</span>\n</code></pre>\n<p>El resto de los pasos son exactamente los mismos.</p>\n<h2 id=\"proyecto-de-visual-studio\"><a href=\"#proyecto-de-visual-studio\">Proyecto de Visual Studio</a></h2>\n<p>Para generar un project de Visual Studio, puede pasar el parametro <code>--ide=vs2017</code> a <code>gn gen</code>:</p>\n<pre><code class=\"hljs language-powershell\">$ gn gen out/Testing --ide=vs2017\n</code></pre>\n<h2 id=\"problemas\"><a href=\"#problemas\">Problemas</a></h2>\n<h3 id=\"comand-xxxx-not-found\"><a href=\"#comand-xxxx-not-found\">Comand xxxx not found</a></h3>\n<p>Si encuentra un error como <code>Comand xxxx not found</code>, intente usar la <code>Consola de Comandos de VS2015</code> para ejecutar los scripts de compilacion.</p>\n<h3 id=\"fatal-internal-compiler-error-c1001\"><a href=\"#fatal-internal-compiler-error-c1001\">Fatal internal compiler error: C1001</a></h3>\n<p>Asegúrese de que tiene instalada la última versión de Visual Studio.</p>\n<h3 id=\"lnk1181-cannot-open-input-file-kernel32lib\"><a href=\"#lnk1181-cannot-open-input-file-kernel32lib\">LNK1181: cannot open input file 'kernel32.lib'</a></h3>\n<p>Intente reinstalar Node.js 32bit.</p>\n<h3 id=\"error-enoent-estatus-cusersusernameappdataroamingnpm\"><a href=\"#error-enoent-estatus-cusersusernameappdataroamingnpm\">Error: ENOENT, estatus 'C:\\Users\\USERNAME\\AppData\\Roaming\\npm'</a></h3>\n<p>Creando ese directorio <a href=\"https://stackoverflow.com/a/25095327/102704\">should fix the problem</a>:</p>\n<pre><code class=\"hljs language-powershell\">$ mkdir ~\\AppData\\Roaming\\npm\n</code></pre>\n<h3 id=\"node-gyp-is-not-recognized-as-an-internal-or-external-command\"><a href=\"#node-gyp-is-not-recognized-as-an-internal-or-external-command\">node-gyp is not recognized as an internal or external command</a></h3>\n<p>Debe obtener este error si está usando Git Bash para la compilación, en cambio debería usar PowerShell o la ventana de comandos de VS2015.</p>\n<h3 id=\"no-se-puede-crear-el-directorio-en--nombre-demasiado-largo\"><a href=\"#no-se-puede-crear-el-directorio-en--nombre-demasiado-largo\">no se puede crear el directorio en '...': Nombre demasiado largo</a></h3>\n<p>node.js tiene algunos <a href=\"https://github.com/electron/node/tree/electron/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/read-pkg-up/node_modules/read-pkg/node_modules/load-json-file/node_modules/parse-json/node_modules/error-ex/node_modules/is-arrayish\">extremely long pathnames</a>, y por defecto git en windows no maneja correctamente los nombres de rutas largos(a pesar de que windows los soporta). Esto debería arreglarlo:</p>\n<pre><code class=\"hljs language-sh\">$ git config --system core.longpaths <span class=\"hljs-literal\">true</span>\n</code></pre>\n<h3 id=\"error-uso-del-identificador-no-declarado-defaultdelegatecheckmode\"><a href=\"#error-uso-del-identificador-no-declarado-defaultdelegatecheckmode\">error: uso del identificador no declarado 'DefaultDelegateCheckMode'</a></h3>\n<p>This can happen during build, when Debugging Tools for Windows has been installed with Windows Driver Kit. Uninstall Windows Driver Kit and install Debugging Tools with steps described above.</p>\n<h3 id=\"error-de-importación-no-existe-un-módulo-llamado-win32file\"><a href=\"#error-de-importación-no-existe-un-módulo-llamado-win32file\">Error de importación: No existe un módulo llamado win32file</a></h3>\n<p>Asegúrese de haber instalado <code>pywin32</code> con <code>pip install pywin32</code>.</p>\n<h3 id=\"los-scripts-de-compilacion-se-bloquean-haste-que-se-presione-una-tecla\"><a href=\"#los-scripts-de-compilacion-se-bloquean-haste-que-se-presione-una-tecla\">Los scripts de compilacion se bloquean haste que se presione una tecla</a></h3>\n<p>Este error es una \"característica\" del intérprete de comandos de Windows. Ocurre cuando se pulsa dentro de la ventana prompt con <code>QuickEdit</code> habilitado y está destinado a permitir seleccionar y copiar el texto de la salida fácilmente. Dado que cada click accidental pausará el proceso de compilación, puede que quiera desactivar esta característica en la propiedades del símbolo del sistema.</p>",
      "title": "Instrucciones de compilación (Windows)",
      "description": ""
    },
    "/docs/development/build-system-overview": {
      "locale": "es-ES",
      "slug": "build-system-overview",
      "href": "/docs/development/build-system-overview",
      "crowdinFileId": "256139",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-system-overview.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"resumen-de-compilación-de-sistemas\"><a href=\"#resumen-de-compilación-de-sistemas\">Resumen de compilación de sistemas</a></h1>\n<p>Electron usa <a href=\"https://gn.googlesource.com/gn\">gyp</a> para la generación de proyectos y <a href=\"https://ninja-build.org/\">ninja</a> para su compilación. Las configuraciones del Proyecto puede ser encontradas en los archivos <code>.gn</code> y <code>.gni</code>.</p>\n<h2 id=\"archivos-gn\"><a href=\"#archivos-gn\">Archivos GN</a></h2>\n<p>Los siguientes archivos <code>gn</code> contienen las reglas principales para la construcción de Electron:</p>\n<ul>\n<li><code>BUILD.gn</code> define como Electron mismo es construido e incluye la configuraciones predeterminadas para enlazar con Chromium.</li>\n<li><code>build/args/{debug,release,all}.gn</code> contiene los argumentos por defecto para la construcción de Electron.</li>\n</ul>\n<h2 id=\"compilación-de-componentes\"><a href=\"#compilación-de-componentes\">Compilación de componentes</a></h2>\n<p>Dado que Chromium es un proyecto bastante grande, la etapa final de enlace puede tomar bastantes minutos, lo que dificulta el desarrollo. Para resolver esto, Chromium introdujo la \"construcción de componentes\", que construye cada componente como una biblioteca compartida separada, lo que hace que el enlace sea muy rápido pero sacrificando el tamaño del archivo y rendimiento.</p>\n<p>Electron hereda esta opción de construcción de Chromium. En versiones <code>Debug</code> se enlazará al binario con una versión de biblioteca compartida de los componentes de Chromium para lograr un tiempo de enlace rápido; para versiones <code>Release</code>, el binario estará vinculado a las versiones estáticas de la biblioteca, de modo que podemos tener el mejor tamaño de binario posible y rendimiento.</p>\n<h2 id=\"verificación\"><a href=\"#verificación\">Verificación</a></h2>\n<p><strong>NB</strong> <em>esta sección está desactualizada y contiene información que ya no es relevante para el GN-built electron.</em></p>\n<p>Pruebe sus cambios conforme al estilo de codificación del proyecto usando:</p>\n<pre><code class=\"hljs language-sh\">$ npm run lint\n</code></pre>\n<p>Pruebe la funcionalidad usando:</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>Cada vez que realice cambios en el código fuente de Electron, deberá volver a ejecutar la compilación antes de las pruebas:</p>\n<pre><code class=\"hljs language-sh\">$ npm run build &#x26;&#x26; npm <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>Puede hacer que la prueba en suite corra más rápido al aislar la prueba específica o bloquear su trabajo actual en la característica <a href=\"https://mochajs.org/#exclusive-tests\">prueba exclusiva</a> de Mocha. Agregar <code>.only</code> a cualquier <code>describe</code> o <code>it</code> función llama:</p>\n<pre><code class=\"hljs language-js\">describe.only(<span class=\"hljs-string\">'alguna característica'</span>, () => {\n  <span class=\"hljs-comment\">// ... solo pruebas se ejecutarán en este bloque</span>\n})\n</code></pre>\n<p>Alternativamente, puede usar la opción de mocha <code>grep</code> de solo correr prueba que coincidan con un patrón regular de expresión:</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span> -- --grep child_process\n</code></pre>\n<p>Pruebas que incluyan módulos nativos (como por ejemplo <code>runas</code>) no pueden ser ejecutadas con el compilador de depuración (vea <a href=\"https://github.com/electron/electron/issues/2558\">#2558</a> para más detalles), pero estos trabajarán con el compilado lanzado.</p>\n<p>Para ejecutar las pruebas con el lanzamiento compila el uso:</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span> -- -R\n</code></pre>",
      "title": "Resumen de compilación de sistemas",
      "description": ""
    },
    "/docs/api/structures/certificate": {
      "locale": "es-ES",
      "slug": "certificate",
      "href": "/docs/api/structures/certificate",
      "crowdinFileId": "256415",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/certificate.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"certificate-object\"><a href=\"#certificate-object\">Certificate Object</a></h1>\n<ul>\n<li><code>data</code> String - PEM encoded data</li>\n<li><code>issuer</code> <a href=\"/docs/api/structures/certificate-principal\">CertificatePrincipal</a> - Issuer principal</li>\n<li><code>issuerName</code> String - Issuer's Common Name</li>\n<li><code>issuerCert</code> Certificate - Issuer certificate (if not self-signed)</li>\n<li><code>subject</code> <a href=\"/docs/api/structures/certificate-principal\">CertificatePrincipal</a> - Subject principal</li>\n<li><code>subjectName</code> String - Subject's Common Name</li>\n<li><code>serialNumber</code> String - Hex value represented string</li>\n<li><code>validStart</code> Number - Start date of the certificate being valid in seconds</li>\n<li><code>validExpiry</code> Number - End date of the certificate being valid in seconds</li>\n<li><code>fingerprint</code> String - Fingerprint of the certificate</li>\n</ul>",
      "title": "Certificate Object",
      "description": ""
    },
    "/docs/api/structures/certificate-principal": {
      "locale": "es-ES",
      "slug": "certificate-principal",
      "href": "/docs/api/structures/certificate-principal",
      "crowdinFileId": "256413",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/certificate-principal.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"certificateprincipal-object\"><a href=\"#certificateprincipal-object\">CertificatePrincipal Object</a></h1>\n<ul>\n<li><code>commonName</code> String - Common Name.</li>\n<li><code>organizations</code> String[] - Organization names.</li>\n<li><code>organizationUnits</code> String[] - Organization Unit names.</li>\n<li><code>locality</code> String - Locality.</li>\n<li><code>state</code> String - State or province.</li>\n<li><code>country</code> String - Country or region.</li>\n</ul>",
      "title": "CertificatePrincipal Object",
      "description": ""
    },
    "/docs/development/chromium-development": {
      "locale": "es-ES",
      "slug": "chromium-development",
      "href": "/docs/development/chromium-development",
      "crowdinFileId": "256141",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/chromium-development.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"desarrollo-de-chromium\"><a href=\"#desarrollo-de-chromium\">Desarrollo de Chromium</a></h1>\n<blockquote>\n<p>Una colección de recursos para aprender sobre Chromium y rastrear su desarrollo</p>\n</blockquote>\n<ul>\n<li><a href=\"https://twitter.com/ChromiumDev\">@ChromiumDev</a> en Twitter</li>\n<li><a href=\"https://twitter.com/googlechrome\">@googlechrome</a> en Twitter</li>\n<li><a href=\"https://blog.chromium.org\">Blog</a></li>\n<li><a href=\"https://cs.chromium.org/\">Búsqueda de Código</a></li>\n<li><a href=\"https://cs.chromium.org/chromium/src/\">Código Fuente</a></li>\n<li><a href=\"https://www.chromium.org/developers/calendar\">Calendario de desarrollo e Información de lanzamiento</a></li>\n<li><a href=\"https://www.chromium.org/developers/discussion-groups\">Grupos de discusión</a></li>\n</ul>\n<p>Ver también <a href=\"/docs/development/v8-development\">Desarrollo V8</a></p>",
      "title": "Desarrollo de Chromium",
      "description": "Una colección de recursos para aprender sobre Chromium y rastrear su desarrollo"
    },
    "/docs/development/clang-format": {
      "locale": "es-ES",
      "slug": "clang-format",
      "href": "/docs/development/clang-format",
      "crowdinFileId": "256143",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/clang-format.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"usar-clang-format-en-código-c\"><a href=\"#usar-clang-format-en-código-c\">Usar clang-format en código C++</a></h1>\n<p><a href=\"https://clang.llvm.org/docs/ClangFormat.html\"><code>clang-format</code></a> es una herramienta para formatear automáticamente el código C/C++/Objective-C, de modo que los desarrolladores no tengan que preocuparse por los problemas de estilo durante las revisiones del código.</p>\n<p>Se recomienda formatear su código C++ modificado antes de abrir solicitudes de extracción, lo que le ahorrará tiempo a usted y a los evaluadores.</p>\n<p>Puede instalar <code>clang-format</code> y <code>git-clang-format</code> a través de <code>npm install -g clang-format</code>.</p>\n<p>To automatically format a file according to Electron C++ code style, run <code>clang-format -i path/to/electron/file.cc</code>. It should work on macOS/Linux/Windows.</p>\n<p>El flujo de trabajo para formatear su código modificado:</p>\n<ol>\n<li>Haga cambios de códigos en el repositorio de Electron.</li>\n<li>Ejecute <code>git add your_changed_file.cc</code>.</li>\n<li>Ejecute <code>git-clang-format</code>, y probablemente verá modificaciones en <code>your_changed_file.cc</code>, estas modificaciones se generan a partir de <code>clang-format</code>.</li>\n<li>Ejecute <code>git agregue su_archivo_registrado.cc</code> y confirme su cambio.</li>\n<li>Ahora la rama está lista para abrirse como una solicitud de extracción.</li>\n</ol>\n<p>If you want to format the changed code on your latest git commit (HEAD), you can run <code>git-clang-format HEAD~1</code>. See <code>git-clang-format -h</code> for more details.</p>\n<h2 id=\"integración-del-editor\"><a href=\"#integración-del-editor\">Integración del Editor</a></h2>\n<p>You can also integrate <code>clang-format</code> directly into your favorite editors. For further guidance on setting up editor integration, see these pages:</p>\n<ul>\n<li><a href=\"https://atom.io/packages/clang-format\">Atom</a></li>\n<li><a href=\"https://clang.llvm.org/docs/ClangFormat.html#vim-integration\">Vim &#x26; Emacs</a></li>\n<li><a href=\"https://marketplace.visualstudio.com/items?itemName=xaver.clang-format\">Visual Studio Code</a></li>\n</ul>",
      "title": "Usar clang-format en código C++",
      "description": ""
    },
    "/docs/development/clang-tidy": {
      "locale": "es-ES",
      "slug": "clang-tidy",
      "href": "/docs/development/clang-tidy",
      "crowdinFileId": "256145",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/clang-tidy.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"usar-clang-tidy-en-el-código-de-c\"><a href=\"#usar-clang-tidy-en-el-código-de-c\">Usar Clang-Tidy en el código de C++</a></h1>\n<p><a href=\"https://clang.llvm.org/extra/clang-tidy/\"><code>clang-tidy</code></a> is a tool to automatically check C/C++/Objective-C code for style violations, programming errors, and best practices.</p>\n<p>Electron's <code>clang-tidy</code> integration is provided as a linter script which can be run with <code>npm run lint:clang-tidy</code>. While <code>clang-tidy</code> checks your on-disk files, you need to have built Electron so that it knows which compiler flags were used. There is one required option for the script <code>--output-dir</code>, which tells the script which build directory to pull the compilation information from. A typical usage would be: <code>npm run lint:clang-tidy --out-dir ../out/Testing</code></p>\n<p>With no filenames provided, all C/C++/Objective-C files will be checked. You can provide a list of files to be checked by passing the filenames after the options: <code>npm run lint:clang-tidy --out-dir ../out/Testing shell/browser/api/electron_api_app.cc</code></p>\n<p>While <code>clang-tidy</code> has a <a href=\"https://clang.llvm.org/extra/clang-tidy/checks/list.html\">long list</a> of possible checks, in Electron only a few are enabled by default. At the moment Electron doesn't have a <code>.clang-tidy</code> config, so <code>clang-tidy</code> will find the one from Chromium at <code>src/.clang-tidy</code> and use the checks which Chromium has enabled. You can change which checks are run by using the <code>--checks=</code> option. This is passed straight through to <code>clang-tidy</code>, so see its documentation for full details. Wildcards can be used, and checks can be disabled by prefixing a <code>-</code>. By default any checks listed are added to those in <code>.clang-tidy</code>, so if you'd like to limit the checks to specific ones you should first exclude all checks then add back what you want, like <code>--checks=-*,performance*</code>.</p>\n<p>Running <code>clang-tidy</code> is rather slow - internally it compiles each file and then runs the checks so it will always be some factor slower than compilation. While you can use parallel runs to speed it up using the <code>--jobs|-j</code> option, <code>clang-tidy</code> also uses a lot of memory during its checks, so it can easily run into out-of-memory errors. As such the default number of jobs is one.</p>",
      "title": "Usar Clang-Tidy en el código de C++",
      "description": ""
    },
    "/docs/api/client-request": {
      "locale": "es-ES",
      "slug": "client-request",
      "href": "/docs/api/client-request",
      "crowdinFileId": "256289",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/client-request.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-clientrequest\"><a href=\"#clase-clientrequest\">Clase: ClientRequest</a></h2>\n<blockquote>\n<p>Hace solicitudes HTTP/HTTPS.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>Peticiones del cliente</code> implementa la interfaz de <a href=\"https://nodejs.org/api/stream.html#stream_writable_streams\">corriente de escritura</a> y por lo tanto es un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">emitidor de eventos</a>.</p>\n<h3 id=\"new-clientrequestoptions\"><a href=\"#new-clientrequestoptions\"><code>new ClientRequest(options)</code></a></h3>\n<ul>\n<li><code>options</code> (Object | String) - Si <code>options</code> es un String, es interpretado como la URL de la solicitud. Si es un objeto, se espera que especifique completamente una solicitud HTTP a través de las siguientes propiedades:<ul>\n<li><code>method</code> String (opcional) - El método de la solicitud HTTP. Por defecto es el método GET.</li>\n<li><code>url</code> String (opcional) - La URL de la solicitud. Debe ser proporcionada de forma absoluta con el esquema del protocolo especificado como http o https.</li>\n<li><code>session</code> Session (opcional) - La instancia de <a href=\"/docs/api/session\"><code>Session</code></a> con la cual la solicitud esta asociada.</li>\n<li><code>partición</code> Cadena (opcional) - el nombre de la <a href=\"/docs/api/session\"><code>partición</code></a> en la cual está asociada la solicitud. Por defecto es la cadena vacía. The <code>session</code> option supersedes <code>partition</code>. De esta manera si una <code>sesión</code> está explícitamente especificada, <code>partición</code> es ignorada.</li>\n<li><code>credentials</code> String (opcional) - Puede ser <code>include</code> o <code>omit</code>. Whether to send <a href=\"https://fetch.spec.whatwg.org/#credentials\">credentials</a> with this request. If set to <code>include</code>, credentials from the session associated with the request will be used. If set to <code>omit</code>, credentials will not be sent with the request (and the <code>'login'</code> event will not be triggered in the event of a 401). This matches the behavior of the <a href=\"https://fetch.spec.whatwg.org/#concept-request-credentials-mode\">fetch</a> option of the same name. If this option is not specified, authentication data from the session will be sent, and cookies will not be sent (unless <code>useSessionCookies</code> is set).</li>\n<li><code>useSessionCookies</code> Boolean (opcional) - Si enviar cookies con esta solicitud desde la sesión poporcionada. If <code>credentials</code> is specified, this option has no effect. Por defecto es <code>false</code>.</li>\n<li><code>protocol</code> String (opcional) - Puede ser <code>http:</code> o <code>https:</code>. The protocol scheme in the form 'scheme:'. Por defecto 'http:'.</li>\n<li><code>host</code> Cadena (opcional) - El servidor central proporcionado como una concatenación de nombres de anfitrión y el número de puerto \"nombre del host:puerto\".</li>\n<li><code>nombre de anfitrión</code> Cadena (opcional) - el nombre del servidor central.</li>\n<li><code>Puerto</code> Entero (opcional) - el número de puerto listado en el servidor.</li>\n<li><code>ruta</code> Cadena (opcional) - La parte de la ruta de la solicitud URL.</li>\n<li><code>redirect</code> String (optional) - Can be <code>follow</code>, <code>error</code> or <code>manual</code>. The redirect mode for this request. When mode is <code>error</code>, any redirection will be aborted. When mode is <code>manual</code> the redirection will be cancelled unless <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> is invoked synchronously during the <a href=\"#event-redirect\"><code>redirect</code></a> event.  Por defecto es <code>seguir</code>.</li>\n<li><code>origin</code> String (optional) - The origin URL of the request.</li>\n</ul></li>\n</ul>\n<p><code>opcions</code> propiedades como <code>protocolo</code>, <code>central</code>, <code>nombre de anfitrión</code>, <code>puerto</code> y <code>ruta</code> siguen estrictamente al modo Node.js como es descrito en el módulo <a href=\"https://nodejs.org/api/url.html\">URL</a>.</p>\n<p>Por ejemplo, podemos haber creado la misma solicitud a 'github.com' como sigue:</p>\n<pre><code class=\"hljs language-JavaScript\"><span class=\"hljs-keyword\">const</span> request = net.request({\n  <span class=\"hljs-attr\">method</span>: <span class=\"hljs-string\">'GET'</span>,\n  <span class=\"hljs-attr\">protocol</span>: <span class=\"hljs-string\">'https:'</span>,\n  <span class=\"hljs-attr\">hostname</span>: <span class=\"hljs-string\">'github.com'</span>,\n  <span class=\"hljs-attr\">port</span>: <span class=\"hljs-number\">443</span>,\n  <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'/'</span>\n})\n</code></pre>\n<h3 id=\"eventos-de-instancia\"><a href=\"#eventos-de-instancia\">Eventos de Instancia</a></h3>\n<h4 id=\"evento-response\"><a href=\"#evento-response\">Evento: 'response'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>response</code> <a href=\"/docs/api/incoming-message\">IncomingMessage</a> - An object representing the HTTP response message.</li>\n</ul>\n<h4 id=\"eventologin\"><a href=\"#eventologin\">Evento:'login'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>authInfo</code> Object<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>anfitrión</code> Cadena</li>\n<li><code>puerto</code> Íntegro</li>\n<li><code>realm</code> Cadena</li>\n</ul></li>\n<li><code>callback</code> Función<ul>\n<li><code>username</code> String (opcional)</li>\n<li><code>password</code> String (opcional)</li>\n</ul></li>\n</ul>\n<p>Emitido cuando un proxy de autenticación requiere las credenciales del usuario.</p>\n<p>Se espera que la función <code>retrollamada</code> sea llamada de vuelta con las credenciales del usuario:</p>\n<ul>\n<li><code>username</code> String</li>\n<li><code>password</code> String</li>\n</ul>\n<pre><code class=\"hljs language-JavaScript\">request.on(<span class=\"hljs-string\">'login'</span>, (authInfo, callback) => {\n  callback(<span class=\"hljs-string\">'username'</span>, <span class=\"hljs-string\">'password'</span>)\n})\n</code></pre>\n<p>Proporcional credenciales vacías cancelará la solicitud y reportará un error de autenticación en el objeto de respuesta:</p>\n<pre><code class=\"hljs language-JavaScript\">request.on(<span class=\"hljs-string\">'response'</span>, (response) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`STATUS: <span class=\"hljs-subst\">${response.statusCode}</span>`</span>);\n  response.on(<span class=\"hljs-string\">'error'</span>, (error) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`ERROR: <span class=\"hljs-subst\">${<span class=\"hljs-built_in\">JSON</span>.stringify(error)}</span>`</span>)\n  })\n})\nrequest.on(<span class=\"hljs-string\">'login'</span>, (authInfo, callback) => {\n  callback()\n})\n</code></pre>\n<h4 id=\"evento-finish\"><a href=\"#evento-finish\">Evento: \"Finish\"</a></h4>\n<p>Emitido justo antes de que el último paquete de los datos de la <code>solicitud</code> haya sido escrito en el objeto <code>solicitud</code>.</p>\n<h4 id=\"evento-abort\"><a href=\"#evento-abort\">Evento: \"abort\"</a></h4>\n<p>Emitido cuando la <code>request</code> es abortada. El evento <code>abort</code> no será lanzado si la <code>request</code> ya está cerrada.</p>\n<h4 id=\"evento-error\"><a href=\"#evento-error\">Evento: \"error\"</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>error</code> Error - un objeto error proporciona cierta información sobre la falla.</li>\n</ul>\n<p>Emitido cuando el módulo <code>net</code> falla en emitir una solicitud de red. Típicamente cuando el objeto <code>solicitud</code> emite un evento <code>error</code>, un evento <code>cerrar</code> lo seguirá subsecuentemente y ningún objeto respuesta será proporcionado.</p>\n<h4 id=\"evento-close\"><a href=\"#evento-close\">Evento: \"close\"</a></h4>\n<p>Emitido cuando el último evento en la transacción solicitud-respuesta HTTP. El evento <code>cerrar</code> indica que ningún otro evento será emitido en los objetos <code>solicitud</code> o <code>respuesta</code>.</p>\n<h4 id=\"evento-redirect\"><a href=\"#evento-redirect\">Evento: \"redirect\"</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>Estatus de código</code> entero</li>\n<li><code>method</code> String</li>\n<li><code>Redirigir Url</code> Cadena</li>\n<li><code>responseHeaders</code> Record&#x3C;String, String[]></li>\n</ul>\n<p>Emitido cuando el servidor devuelve una respuesta redirect (por ejemplo 301 Moved Permanently). Llamar a <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> continuará con la redirección.  Si este evento es manejado, <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> debe ser llamado <strong>synchronously</strong>, de otra manera la solicitud será cancelada.</p>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<h4 id=\"requestchunkedencoding\"><a href=\"#requestchunkedencoding\"><code>request.chunkedEncoding</code></a></h4>\n<p>Un <code>Booleano</code> especificando cuando la solicitud usará el la codificación de transferencia del paquete HTTP o no. Por defecto es falso. La propiedad es de lectura y escritura, sin embargo puede ser configurada antes de la primera operación de escritura debido a que el encabezado HTTP no se ha puesto en el hilo. Tratar de configurar la propiedad <code>codificación empaquetada</code> después de la primera escritura arrojará un error.</p>\n<p>Utilizar codificación empaquetada es fuertemente recomendado si no necesita enviar una solicitud grande dado que lo datos serán transmitidos en paquetes pequeños en lugar de ser cargados internamente en la memoria de proceso de Electron.</p>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<h4 id=\"requestsetheadername-value\"><a href=\"#requestsetheadername-value\"><code>request.setHeader(name, value)</code></a></h4>\n<ul>\n<li><code>nombre</code> Cadena - Un nombre de encabezado HTTP extra.</li>\n<li><code>value</code> String - Un valor de cabecera HTTP extra.</li>\n</ul>\n<p>Añade otro encabezado HTTP. El nombre de la cabecera se emitirá tal cual sin convertirlas a minúscula. Será llamado solo antes de la primera escritura. Llamar a este método despues de la primera escritura arrojará un error. Si el valor pasado no es una <code>Cadena</code>, llamará a su método <code>toString()</code> para obtener el valor final.</p>\n<p>Ciertos encabezados están restringidos de ser definidos por aplicaciones. Estos encabezados se enlistan a continuación. Más información sobre encabezados restringidos puede ser encontrada en <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:services/network/public/cpp/header_util.cc;drc=1562cab3f1eda927938f8f4a5a91991fefde66d3;bpv=1;bpt=1;l=22\">Chromium's header utils</a>.</p>\n<ul>\n<li><code>Content-Length</code></li>\n<li><code>Host</code></li>\n<li><code>Trailer</code> or <code>Te</code></li>\n<li><code>Upgrade</code></li>\n<li><code>Cookie2</code></li>\n<li><code>Keep-Alive</code></li>\n<li><code>Transfer-Encoding</code></li>\n</ul>\n<p>Además, definir el encabezado <code>Connection</code> al valor <code>upgrade</code> también está dehabilitado.</p>\n<h4 id=\"requestgetheadername\"><a href=\"#requestgetheadername\"><code>request.getHeader(name)</code></a></h4>\n<ul>\n<li><code>nombre</code> Cadena - Especifica el nombre del encabezado extra.</li>\n</ul>\n<p>Devuelve <code>String</code> - El valor de un nombre de cabecera extra establecido anteriormente.</p>\n<h4 id=\"requestremoveheadername\"><a href=\"#requestremoveheadername\"><code>request.removeHeader(name)</code></a></h4>\n<ul>\n<li><code>nombre</code> Cadena - Especifica el nombre del encabezado extra.</li>\n</ul>\n<p>Elimina un nombre de cabecera establecido previamente. This method can be called only before first write. Trying to call it after the first write will throw an error.</p>\n<h4 id=\"requestwritechunk-encoding-callback\"><a href=\"#requestwritechunk-encoding-callback\"><code>request.write(chunk[, encoding][, callback])</code></a></h4>\n<ul>\n<li><code>chunk</code> (String | Buffer) - A chunk of the request body's data. If it is a string, it is converted into a Buffer using the specified encoding.</li>\n<li><code>encoding</code> String (optional) - Used to convert string chunks into Buffer objects. Defaults to 'utf-8'.</li>\n<li><code>retrollamada</code> función (opcional) - Llamado cuando se haya realizado la operación de escritura.</li>\n</ul>\n<p>La <code>retrollamada</code> es esencialmente una función sencilla introducida con el propósito de mantener similitudes con el API Node.js. Es llamada asincrónicamente en el siguiente tick después de que el contenido del <code>paquete</code> haya sido entregado a la capa de red de Chromium. A diferencia de la implementación de Node.js, no está garantizado que el contenido del <code>paquete</code> haya sido entregado en el hilo antes de que sea llamada <code>retrollamada</code>.</p>\n<p>Agrega un paquete de datos al cuerpo de la solicitud. La primera operación de escritura pudiese causar que el encabezado de la solicitud sea cambiado en el hilo. Después de la primera operación de escritura, no está permitido el añadir o remover un encabezado personalizado.</p>\n<h4 id=\"requestendchunk-encoding-callback\"><a href=\"#requestendchunk-encoding-callback\"><code>request.end([chunk][, encoding][, callback])</code></a></h4>\n<ul>\n<li><code>paquete</code> (Cadena | Almacenamiento) (opcional)</li>\n<li><code>codificación</code> Cadena (opcional)</li>\n<li><code>retrocallback</code> Funcion (opcional)</li>\n</ul>\n<p>Sends the last chunk of the request data. Subsequent write or end operations will not be allowed. The <code>finish</code> event is emitted just after the end operation.</p>\n<h4 id=\"requestabort\"><a href=\"#requestabort\"><code>request.abort()</code></a></h4>\n<p>Cancela una transacción HTTP en proceso. Si la solicitud ya emitió el evento de <code>cerrar</code>, la operación abortar no tendrá ningún efecto. De otra manera un evento en proceso emitirá los eventos <code>abortar</code> y <code>cerrar</code>. Adicionalmente, si hay algún objeto de respuesta activo, será emitido el evento <code>abortado</code>.</p>\n<h4 id=\"requestfollowredirect\"><a href=\"#requestfollowredirect\"><code>request.followRedirect()</code></a></h4>\n<p>Continues any pending redirection. Can only be called during a <code>'redirect'</code> event.</p>\n<h4 id=\"requestgetuploadprogress\"><a href=\"#requestgetuploadprogress\"><code>request.getUploadProgress()</code></a></h4>\n<p>Devuelve <code>Objeto</code>:</p>\n<ul>\n<li><code>active</code> Boolean - Whether the request is currently active. If this is false no other properties will be set</li>\n<li><code>started</code> Boolean - Whether the upload has started. If this is false both <code>current</code> and <code>total</code> will be set to 0.</li>\n<li><code>current</code> Integer - El número de bytes que se han subido hasta ahora</li>\n<li><code>total</code> Integer - El número de bytes que ha subido esta solicitud</li>\n</ul>\n<p>Puedes usar este método en conjunto con solicitudes <code>POST</code> para obtener el progreso de la carga de un archivo u otro dato de transferencia.</p>",
      "title": "Clase: ClientRequest",
      "description": "Hace solicitudes HTTP/HTTPS."
    },
    "/docs/api/clipboard": {
      "locale": "es-ES",
      "slug": "clipboard",
      "href": "/docs/api/clipboard",
      "crowdinFileId": "256291",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/clipboard.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"clipboard\"><a href=\"#clipboard\">clipboard</a></h1>\n<blockquote>\n<p>Realiza las operaciones de copiar y pegar en el portapapeles del sistema.</p>\n</blockquote>\n<p>Procesos: <a href=\"/docs/glossary#main-process\">principal</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>En Linux, también hay un portapapeles <code>selección</code>. Para manipularlo necesita pasar <code>selección</code> a cada método:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeText(<span class=\"hljs-string\">'Example String'</span>, <span class=\"hljs-string\">'selection'</span>)\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readText(<span class=\"hljs-string\">'selection'</span>))\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>portapapeles</code> tiene los siguientes métodos:</p>\n<p><strong>Nota:</strong> APIs experimentales son marcadas como tales y podría ser removidas en el futuro.</p>\n<h3 id=\"clipboardreadtexttype\"><a href=\"#clipboardreadtexttype\"><code>clipboard.readText([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (opcional) - Puede ser <code>selection</code> o <code>clipboard</code>; por defecto es 'clipboard'. <code>selection</code> solo está disponible en Linux.</li>\n</ul>\n<p>Devuelve <code>Cadena</code> - El contenido en el portapapeles como texto sin formato.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeText(<span class=\"hljs-string\">'hello i am a bit of text!'</span>)\n\n<span class=\"hljs-keyword\">const</span> text = clipboard.readText()\n<span class=\"hljs-built_in\">console</span>.log(text)\n<span class=\"hljs-comment\">// hello i am a bit of text!'</span>\n</code></pre>\n<h3 id=\"clipboardwritetexttexto-type\"><a href=\"#clipboardwritetexttexto-type\"><code>clipboard.writeText(texto[, type])</code></a></h3>\n<ul>\n<li><code>texto</code> Cadena</li>\n<li><code>type</code> String (opcional) - Puede ser <code>selection</code> o <code>clipboard</code>; por defecto es 'clipboard'. <code>selection</code> solo está disponible en Linux.</li>\n</ul>\n<p>Escribe el <code>texto</code> en el portapapeles como texto sin formato.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> text = <span class=\"hljs-string\">'hello i am a bit of text!'</span>\nclipboard.writeText(text)\n</code></pre>\n<h3 id=\"clipboardreadhtmltype\"><a href=\"#clipboardreadhtmltype\"><code>clipboard.readHTML([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (opcional) - Puede ser <code>selection</code> o <code>clipboard</code>; por defecto es 'clipboard'. <code>selection</code> solo está disponible en Linux.</li>\n</ul>\n<p>Devuelve <code>Cadena</code> - El contenido en el portapapeles como marca.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeHTML(<span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b>'</span>)\n<span class=\"hljs-keyword\">const</span> html = clipboard.readHTML()\n\n<span class=\"hljs-built_in\">console</span>.log(html)\n<span class=\"hljs-comment\">// &#x3C;meta charset='utf-8'>&#x3C;b>Hi&#x3C;/b></span>\n</code></pre>\n<h3 id=\"clipboardwritehtmlmarkup-type\"><a href=\"#clipboardwritehtmlmarkup-type\"><code>clipboard.writeHTML(markup[, type])</code></a></h3>\n<ul>\n<li><code>markup</code> Cadena</li>\n<li><code>type</code> String (opcional) - Puede ser <code>selection</code> o <code>clipboard</code>; por defecto es 'clipboard'. <code>selection</code> solo está disponible en Linux.</li>\n</ul>\n<p>Escribe <code>markup</code> en el portapapeles.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeHTML(<span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b'</span>)\n</code></pre>\n<h3 id=\"clipboardreadimagetype\"><a href=\"#clipboardreadimagetype\"><code>clipboard.readImage([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (opcional) - Puede ser <code>selection</code> o <code>clipboard</code>; por defecto es 'clipboard'. <code>selection</code> solo está disponible en Linux.</li>\n</ul>\n<p>Devuelve <a href=\"/docs/api/native-image\"><code>NativeImage</code></a> - El contenido de la imagen en el portapapeles.</p>\n<h3 id=\"clipboardwriteimageimage-type\"><a href=\"#clipboardwriteimageimage-type\"><code>clipboard.writeImage(image[, type])</code></a></h3>\n<ul>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a></li>\n<li><code>type</code> String (opcional) - Puede ser <code>selection</code> o <code>clipboard</code>; por defecto es 'clipboard'. <code>selection</code> solo está disponible en Linux.</li>\n</ul>\n<p>Escribe <code>image</code> en el portapapeles.</p>\n<h3 id=\"clipboardreadrtftype\"><a href=\"#clipboardreadrtftype\"><code>clipboard.readRTF([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (opcional) - Puede ser <code>selection</code> o <code>clipboard</code>; por defecto es 'clipboard'. <code>selection</code> solo está disponible en Linux.</li>\n</ul>\n<p>Devuelve <code>Cadena</code> - El contenido en el portapapeles como RTF.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeRTF(<span class=\"hljs-string\">'{\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}'</span>)\n\n<span class=\"hljs-keyword\">const</span> rtf = clipboard.readRTF()\n<span class=\"hljs-built_in\">console</span>.log(rtf)\n<span class=\"hljs-comment\">// {\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}</span>\n</code></pre>\n<h3 id=\"clipboardwritertftext-type\"><a href=\"#clipboardwritertftext-type\"><code>clipboard.writeRTF(text[, type])</code></a></h3>\n<ul>\n<li><code>texto</code> Cadena</li>\n<li><code>type</code> String (opcional) - Puede ser <code>selection</code> o <code>clipboard</code>; por defecto es 'clipboard'. <code>selection</code> solo está disponible en Linux.</li>\n</ul>\n<p>Escribe el <code>text</code> en el portapapeles en RTF.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> rtf = <span class=\"hljs-string\">'{\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}'</span>\nclipboard.writeRTF(rtf)\n</code></pre>\n<h3 id=\"clipboardreadbookmark-macos-windows\"><a href=\"#clipboardreadbookmark-macos-windows\"><code>clipboard.readBookmark()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Devuelve <code>Objeto</code>:</p>\n<ul>\n<li><code>title</code> String</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Devuelve un Objeto que contiene las claves <code>title</code> y <code>url</code> que representan el marcador en el portapapeles. Los valores <code>title</code> y <code>url</code> serán cadenas vacías cuando el marcador no está disponible.</p>\n<h3 id=\"clipboardwritebookmarktitle-url-type-macos-windows\"><a href=\"#clipboardwritebookmarktitle-url-type-macos-windows\"><code>clipboard.writeBookmark(title, url[, type])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>title</code> String</li>\n<li><code>url</code> String</li>\n<li><code>type</code> String (opcional) - Puede ser <code>selection</code> o <code>clipboard</code>; por defecto es 'clipboard'. <code>selection</code> solo está disponible en Linux.</li>\n</ul>\n<p>Escribe el <code>título</code> y la <code>url</code> en el portapapeles como un marcador.</p>\n<p><strong>Nota:</strong> La mayoría de las aplicaciones en Windows no soportan el pegado de marcadores dentro de ellas así que puedes usar <code>clipboard.write</code> para escribir tanto un marcador como un texto de respaldo en el portapapeles.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeBookmark({\n  <span class=\"hljs-attr\">text</span>: <span class=\"hljs-string\">'https://electronjs.org'</span>,\n  <span class=\"hljs-attr\">bookmark</span>: <span class=\"hljs-string\">'Electron Homepage'</span>\n})\n</code></pre>\n<h3 id=\"clipboardreadfindtext-macos\"><a href=\"#clipboardreadfindtext-macos\"><code>clipboard.readFindText()</code> <em>macOS</em></a></h3>\n<p>Devuelve <code>String</code> - El texto en el portapapeles de búsqueda, el cual es el portapapeles que contiene información sobre el estado actual del panel de búsqueda de la aplicación.</p>\n<p>Este método usa IPC síncrono cuando se llama desde el renderer process. El valor almacenado en el cache es re leído desde portapapeles de búsqueda cada vez que la aplicación se activa.</p>\n<h3 id=\"clipboardwritefindtexttext-macos\"><a href=\"#clipboardwritefindtexttext-macos\"><code>clipboard.writeFindText(text)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>texto</code> Cadena</li>\n</ul>\n<p>Escribe el <code>text</code> portapapeles de búsqueda ( portapapeles que contiene información sobre el estado actual del panel de búsqueda de la aplicación) como texto plano. Este método usa IPC síncrono cuando se llama desde el renderer process.</p>\n<h3 id=\"clipboardcleartype\"><a href=\"#clipboardcleartype\"><code>clipboard.clear([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (opcional) - Puede ser <code>selection</code> o <code>clipboard</code>; por defecto es 'clipboard'. <code>selection</code> solo está disponible en Linux.</li>\n</ul>\n<p>Borra el contenido del portapapeles.</p>\n<h3 id=\"clipboardavailableformatstype\"><a href=\"#clipboardavailableformatstype\"><code>clipboard.availableFormats([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (opcional) - Puede ser <code>selection</code> o <code>clipboard</code>; por defecto es 'clipboard'. <code>selection</code> solo está disponible en Linux.</li>\n</ul>\n<p>Devuelve <code>Cadena[] </code> - Una matriz de formatos admitidos para el portapapeles <code>type</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> formats = clipboard.availableFormats()\n<span class=\"hljs-built_in\">console</span>.log(formats)\n<span class=\"hljs-comment\">// [ 'text/plain', 'text/html' ]</span>\n</code></pre>\n<h3 id=\"clipboardhasformat-type-experimental\"><a href=\"#clipboardhasformat-type-experimental\"><code>clipboard.has(format[, type])</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>formato</code> Cadena</li>\n<li><code>type</code> String (opcional) - Puede ser <code>selection</code> o <code>clipboard</code>; por defecto es 'clipboard'. <code>selection</code> solo está disponible en Linux.</li>\n</ul>\n<p>Devuelve <code>Boolean</code>: si el portapapeles admite el <code>formato</code> especificado.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> hasFormat = clipboard.has(<span class=\"hljs-string\">'&#x3C;p>selection&#x3C;/p>'</span>)\n<span class=\"hljs-built_in\">console</span>.log(hasFormat)\n<span class=\"hljs-comment\">// 'true' or 'false'</span>\n</code></pre>\n<h3 id=\"clipboardreadformat-experimental\"><a href=\"#clipboardreadformat-experimental\"><code>clipboard.read(format)</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>formato</code> Cadena</li>\n</ul>\n<p>Devuelve <code>String</code> - Lee el tipo de <code>formato</code> del portapapeles.</p>\n<p><code>format</code> should contain valid ASCII characters and have <code>/</code> separator. <code>a/c</code>, <code>a/bc</code> are valid formats while <code>/abc</code>, <code>abc/</code>, <code>a/</code>, <code>/a</code>, <code>a</code> are not valid.</p>\n<h3 id=\"clipboardreadbufferformat-experimental\"><a href=\"#clipboardreadbufferformat-experimental\"><code>clipboard.readBuffer(format)</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>formato</code> Cadena</li>\n</ul>\n<p>Devuelve <code>Buffer</code> - Lee el <code>formato</code> del portapapeles.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> buffer = Buffer.from(<span class=\"hljs-string\">'this is binary'</span>, <span class=\"hljs-string\">'utf8'</span>)\nclipboard.writeBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>, buffer)\n\n<span class=\"hljs-keyword\">const</span> ret = clipboard.readBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>)\n\n<span class=\"hljs-built_in\">console</span>.log(buffer.equals(out))\n<span class=\"hljs-comment\">// true</span>\n</code></pre>\n<h3 id=\"clipboardwritebufferformat-buffer-type-experimental\"><a href=\"#clipboardwritebufferformat-buffer-type-experimental\"><code>clipboard.writeBuffer(format, buffer[, type])</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>formato</code> Cadena</li>\n<li><code>buffer</code> Buffer</li>\n<li><code>type</code> String (opcional) - Puede ser <code>selection</code> o <code>clipboard</code>; por defecto es 'clipboard'. <code>selection</code> solo está disponible en Linux.</li>\n</ul>\n<p>Escribe el <code>buffer</code> en el portapapeles como <code>formato</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> buffer = Buffer.from(<span class=\"hljs-string\">'writeBuffer'</span>, <span class=\"hljs-string\">'utf8'</span>)\nclipboard.writeBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>, buffer)\n</code></pre>\n<h3 id=\"clipboardwritedata-type\"><a href=\"#clipboardwritedata-type\"><code>clipboard.write(data[, type])</code></a></h3>\n<ul>\n<li><code>data</code> Object<ul>\n<li><code>text</code> Cadena (opcional)</li>\n<li><code>html</code> Cadena (opcional)</li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> (opcional)</li>\n<li><code>rtf</code> Cadena (opcional)</li>\n<li><code>bookmark</code> String (opcional) - El título de la URL en <code>text</code>.</li>\n</ul></li>\n<li><code>type</code> String (opcional) - Puede ser <code>selection</code> o <code>clipboard</code>; por defecto es 'clipboard'. <code>selection</code> solo está disponible en Linux.</li>\n</ul>\n<p>Escribe <code>datos</code> en el portapapeles.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.write({\n  <span class=\"hljs-attr\">text</span>: <span class=\"hljs-string\">'test'</span>,\n  <span class=\"hljs-attr\">html</span>: <span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b>'</span>,\n  <span class=\"hljs-attr\">rtf</span>: <span class=\"hljs-string\">'{\\\\rtf1\\\\utf8 text}'</span>,\n  <span class=\"hljs-attr\">bookmark</span>: <span class=\"hljs-string\">'a title'</span>\n})\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readText())\n<span class=\"hljs-comment\">// 'test'</span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readHTML())\n<span class=\"hljs-comment\">// &#x3C;meta charset='utf-8'>&#x3C;b>Hi&#x3C;/b></span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readRTF())\n<span class=\"hljs-comment\">// '{\\\\rtf1\\\\utf8 text}'</span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readBookmark())\n<span class=\"hljs-comment\">// { title: 'a title', url: 'test' }</span>\n</code></pre>",
      "title": "clipboard",
      "description": "Realiza las operaciones de copiar y pegar en el portapapeles del sistema."
    },
    "/docs/tutorial/code-signing": {
      "locale": "es-ES",
      "slug": "code-signing",
      "href": "/docs/tutorial/code-signing",
      "crowdinFileId": "256183",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/code-signing.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"firma-de-código\"><a href=\"#firma-de-código\">Firma de código</a></h1>\n<p>La firma de código es una tecnología de seguridad que utiliza para certificar que una aplicación fue creada por usted.</p>\n<p>En macOS el sistema puede detectar cualquier cambio en la aplicación, tanto si el cambio es introducido accidentalmente como por código malicioso.</p>\n<p>On Windows, the system assigns a trust level to your code signing certificate which if you don't have, or if your trust level is low, will cause security dialogs to appear when users start using your application.  Trust level builds over time so it's better to start code signing as early as possible.</p>\n<p>Si bien es posible distribuir aplicaciones sin firmar, no es recomendable. Both Windows and macOS will, by default, prevent either the download or the execution of unsigned applications. Starting with macOS Catalina (version 10.15), users have to go through multiple manual steps to open unsigned applications.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/gatekeeper.png\" alt=\"macOS Catalina Gatekeeper warning: The app cannot be opened because the\ndeveloper cannot be verified\"></p>\n<p>Como puedes ver, los usuarios tienen dos opciones: Mover la aplicación directamente a la papelera o cancelar la ejecución. Tú no quieres que tus usuarios vean ese diálogo.</p>\n<p>If you are building an Electron app that you intend to package and distribute, it should be code-signed.</p>\n<h1 id=\"signing--notarizing-macos-builds\"><a href=\"#signing--notarizing-macos-builds\">Signing &#x26; notarizing macOS builds</a></h1>\n<p>Properly preparing macOS applications for release requires two steps: First, the app needs to be code-signed. Then, the app needs to be uploaded to Apple for a process called \"notarization\", where automated systems will further verify that your app isn't doing anything to endanger its users.</p>\n<p>To start the process, ensure that you fulfill the requirements for signing and notarizing your app:</p>\n<ol>\n<li>Afiliate en el <a href=\"https://developer.apple.com/programs/\">Apple Developer Program</a> (requiere un pago anual)</li>\n<li>Download and install <a href=\"https://developer.apple.com/xcode\">Xcode</a> - this requires a computer running macOS</li>\n<li>Genera, descarga e instala <a href=\"https://github.com/electron/electron-osx-sign/wiki/1.-Getting-Started#certificates\">signing certificates</a></li>\n</ol>\n<p>Electron's ecosystem favors configuration and freedom, so there are multiple ways to get your application signed and notarized.</p>\n<h2 id=\"electron-forge\"><a href=\"#electron-forge\"><code>electron-forge</code></a></h2>\n<p>If you're using Electron's favorite build tool, getting your application signed and notarized requires a few additions to your configuration. <a href=\"https://electronforge.io\">Forge</a> is a collection of the official Electron tools, using <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>, <a href=\"https://github.com/electron-userland/electron-osx-sign\"><code>electron-osx-sign</code></a>, and <a href=\"https://github.com/electron/electron-notarize\"><code>electron-notarize</code></a> under the hood.</p>\n<p>Let's take a look at an example configuration with all required fields. Not all of them are required: the tools will be clever enough to automatically find a suitable <code>identity</code>, for instance, but we recommend that you are explicit.</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"my-app\"</span>,\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.0.1\"</span>,\n  <span class=\"hljs-attr\">\"config\"</span>: {\n    <span class=\"hljs-attr\">\"forge\"</span>: {\n      <span class=\"hljs-attr\">\"packagerConfig\"</span>: {\n        <span class=\"hljs-attr\">\"osxSign\"</span>: {\n          <span class=\"hljs-attr\">\"identity\"</span>: <span class=\"hljs-string\">\"Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)\"</span>,\n          <span class=\"hljs-attr\">\"hardened-runtime\"</span>: <span class=\"hljs-literal\">true</span>,\n          <span class=\"hljs-attr\">\"entitlements\"</span>: <span class=\"hljs-string\">\"entitlements.plist\"</span>,\n          <span class=\"hljs-attr\">\"entitlements-inherit\"</span>: <span class=\"hljs-string\">\"entitlements.plist\"</span>,\n          <span class=\"hljs-attr\">\"signature-flags\"</span>: <span class=\"hljs-string\">\"library\"</span>\n        },\n        <span class=\"hljs-attr\">\"osxNotarize\"</span>: {\n          <span class=\"hljs-attr\">\"appleId\"</span>: <span class=\"hljs-string\">\"felix@felix.fun\"</span>,\n          <span class=\"hljs-attr\">\"appleIdPassword\"</span>: <span class=\"hljs-string\">\"my-apple-id-password\"</span>,\n        }\n      }\n    }\n  }\n}\n</code></pre>\n<p>The <code>plist</code> file referenced here needs the following macOS-specific entitlements to assure the Apple security mechanisms that your app is doing these things without meaning any harm:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.allow-jit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.debugger<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>Note that up until Electron 12, the <code>com.apple.security.cs.allow-unsigned-executable-memory</code> entitlement was required as well. However, it should not be used anymore if it can be avoided.</p>\n<p>To see all of this in action, check out Electron Fiddle's source code, <a href=\"https://github.com/electron/fiddle/blob/master/forge.config.js\">especially its <code>electron-forge</code> configuration file</a>.</p>\n<p>If you plan to access the microphone or camera within your app using Electron's APIs, you'll also need to add the following entitlements:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.device.audio-input<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.device.camera<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>If these are not present in your app's entitlements when you invoke, for example:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> microphone = systemPreferences.askForMediaAccess(<span class=\"hljs-string\">'microphone'</span>)\n</code></pre>\n<p>Puede que tu aplicación falle. See the Resource Access section in <a href=\"https://developer.apple.com/documentation/security/hardened_runtime\">Hardened Runtime</a> for more information and entitlements you may need.</p>\n<h2 id=\"electron-builder\"><a href=\"#electron-builder\"><code>Electron-builder</code></a></h2>\n<p>Electron Builder viene con una solución personalizada para la firma de su aplicación. Usted puede encontar <a href=\"https://www.electron.build/code-signing\">its documentation here</a>.</p>\n<h2 id=\"electron-packager\"><a href=\"#electron-packager\"><code>electron-packager</code></a></h2>\n<p>If you're not using an integrated build pipeline like Forge or Builder, you are likely using <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>, which includes <a href=\"https://github.com/electron-userland/electron-osx-sign\"><code>electron-osx-sign</code></a> and <a href=\"https://github.com/electron/electron-notarize\"><code>electron-notarize</code></a>.</p>\n<p>If you're using Packager's API, you can pass <a href=\"https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html\">in configuration that both signs and notarizes your application</a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> packager = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-packager'</span>)\n\npackager({\n  <span class=\"hljs-attr\">dir</span>: <span class=\"hljs-string\">'/path/to/my/app'</span>,\n  <span class=\"hljs-attr\">osxSign</span>: {\n    <span class=\"hljs-attr\">identity</span>: <span class=\"hljs-string\">'Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)'</span>,\n    <span class=\"hljs-string\">'hardened-runtime'</span>: <span class=\"hljs-literal\">true</span>,\n    <span class=\"hljs-attr\">entitlements</span>: <span class=\"hljs-string\">'entitlements.plist'</span>,\n    <span class=\"hljs-string\">'entitlements-inherit'</span>: <span class=\"hljs-string\">'entitlements.plist'</span>,\n    <span class=\"hljs-string\">'signature-flags'</span>: <span class=\"hljs-string\">'library'</span>\n  },\n  <span class=\"hljs-attr\">osxNotarize</span>: {\n    <span class=\"hljs-attr\">appleId</span>: <span class=\"hljs-string\">'felix@felix.fun'</span>,\n    <span class=\"hljs-attr\">appleIdPassword</span>: <span class=\"hljs-string\">'my-apple-id-password'</span>\n  }\n})\n</code></pre>\n<p>The <code>plist</code> file referenced here needs the following macOS-specific entitlements to assure the Apple security mechanisms that your app is doing these things without meaning any harm:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.allow-jit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.debugger<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>Up until Electron 12, the <code>com.apple.security.cs.allow-unsigned-executable-memory</code> entitlement was required as well. However, it should not be used anymore if it can be avoided.</p>\n<h2 id=\"mac-app-store\"><a href=\"#mac-app-store\">Mac App Store</a></h2>\n<p>Ver la <a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store Guide</a>.</p>\n<h1 id=\"firmando-compilaciones-windows\"><a href=\"#firmando-compilaciones-windows\">Firmando compilaciones Windows</a></h1>\n<p>Antes de Firmar Compilaciones Windows, tu debes hacer lo siguiente:</p>\n<ol>\n<li>Obtener un certificado de firma de código de Windows Authenticode (requiere una cuota anual)</li>\n<li>Instale Visual Studio para obtener la utilizada para firmar (la gratis <a href=\"https://visualstudio.microsoft.com/vs/community/\">Community Edition</a> es suficiente)</li>\n</ol>\n<p>Usted puede obtener una certificado de firma de código desde muchos revendedores. Prices vary, so it may be worth your time to shop around. Entre los revendedores populares se incluyen:</p>\n<ul>\n<li><a href=\"https://www.digicert.com/code-signing/microsoft-authenticode.htm\">digicert</a></li>\n<li><a href=\"https://sectigo.com/ssl-certificates-tls/code-signing\">Sectigo</a></li>\n<li>Amongst others, please shop around to find one that suits your needs, Google is your friend 😄</li>\n</ul>\n<p>Hay una serie de herramientas para firmar su aplicación empaquetada:</p>\n<ul>\n<li><a href=\"https://github.com/electron/windows-installer\"><code>electron-winstaller</code></a> will generate an installer for windows and sign it for you</li>\n<li><a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a> can sign installers it generates through the Squirrel.Windows or MSI targets.</li>\n<li><a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> can sign some of its windows targets</li>\n</ul>\n<h2 id=\"windows-store\"><a href=\"#windows-store\">Windows Store</a></h2>\n<p>Ver la <a href=\"/docs/tutorial/windows-store-guide\">Windows Store Guide</a>.</p>",
      "title": "Firma de código",
      "description": ""
    },
    "/docs/development/coding-style": {
      "locale": "es-ES",
      "slug": "coding-style",
      "href": "/docs/development/coding-style",
      "crowdinFileId": "256147",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/coding-style.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"estilo-de-código\"><a href=\"#estilo-de-código\">Estilo de código</a></h1>\n<p>Estas son las pautas de estilo para la codificación en Electron.</p>\n<p>Para mostrar los problemas de estilo detectados por <code>cpplint</code> y <code>eslint</code>, puede ejecutar <code>npm run lint</code>.</p>\n<h2 id=\"código-general\"><a href=\"#código-general\">Código general</a></h2>\n<ul>\n<li>Termine los archivos con una nueva linea vacía.</li>\n<li>Coloque los requires en el siguiente orden:<ul>\n<li>Módulos incorporados en Node (tal como <code>path</code>)</li>\n<li>Módulos incorporados en Electron (tal como <code>ipc</code>, <code>app</code>)</li>\n<li>Módulos locales (usando rutas relativas)</li>\n</ul></li>\n<li>Coloque las propiedades de la case en el siguiente orden:<ul>\n<li>Métodos y propiedades de la clase (métodos que empiezan con un <code>@</code>)</li>\n<li>Instancia métodos y propiedades</li>\n</ul></li>\n<li>Evitar código dependiente de la plataforma:<ul>\n<li>Use <code>path.join()</code> para concatenar nombres de archivos.</li>\n<li>Use <code>os.tmpdir()</code> en lugar de <code>/tmp</code> cuando necesite referencias el directorio temporal.</li>\n</ul></li>\n<li>Using a plain <code>return</code> when returning explicitly at the end of a function.<ul>\n<li>No <code>return null</code>, <code>return undefined</code>, <code>null</code> o <code>undefined</code></li>\n</ul></li>\n</ul>\n<h2 id=\"c-y-python\"><a href=\"#c-y-python\">C++ y Python</a></h2>\n<p>Para C++ y Python, seguimos el <a href=\"https://chromium.googlesource.com/chromium/src/+/refs/heads/main/styleguide/styleguide.md\">estilo de código</a> de Chromium. Puede usar el formato <a href=\"/docs/development/clang-format\">clang-format</a> para el código C++ automáticamente. También hay un script <code>script/cpplint.py</code> para comprobar si todos los archivos se cumplen con los requisitos.</p>\n<p>La versión de Python que estamos utilizando actualmente es Python 2.7.</p>\n<p>El código de C ++ utiliza una gran cantidad de abstracciones y tipos de Chromium, por lo que se recomienda familiarizarse con ellos. Un buen lugar para empezar es el documento de Chromium <a href=\"https://www.chromium.org/developers/coding-style/important-abstractions-and-data-structures\">Important Abstractions and Data Structures</a>. El documento menciona algunos tipos especiales, tipos de ámbito (que liberan automáticamente su memoria cuando salen del ámbito), mecanismos de registro etc.</p>\n<h2 id=\"documentación\"><a href=\"#documentación\">Documentación</a></h2>\n<ul>\n<li>Escribe <a href=\"https://github.com/remarkjs/remark\">remark</a> estilo markdown.</li>\n</ul>\n<p>Puede ejecutar <code>npm run lint-docs</code> para asegurarse de que los cambios en su documentación tengan el formato correcto.</p>\n<h2 id=\"javascript\"><a href=\"#javascript\">JavaScript</a></h2>\n<ul>\n<li>Escribe el estilo JavaScript <a href=\"https://www.npmjs.com/package/standard\">estándar</a>.</li>\n<li>Los nombres de los archivos deben concatenarse con <code>-</code> en lugar de <code>_</code>, por ejemplo <code>file-name.js</code> en vez de <code>file_name.js</code>, porque en el módulo <a href=\"https://github.com/github/atom\">github/atom</a> los nombres están generalmente en la forma <code>module-name</code>. Esta regla solo aplica a archivos <code>.js</code>.</li>\n<li>Use la sintaxis ES6 / ES2015 más nueva cuando corresponda<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const\"><code>const</code></a> Para solicitudes y otras constantes.  Si el valor es un primitivo, use nombre en mayúsculas (por ejemplo, <code>const NUMBER_OF_RETRIES = 5</code>).</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let\"><code>let</code></a> para definir variables</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions\">Arrow functions</a> en lugar de <code>function () { }</code></li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals\">Template literals</a> en lugar de el uso de cadenas concatenadas <code>+</code></li>\n</ul></li>\n</ul>\n<h2 id=\"nombrar-cosas\"><a href=\"#nombrar-cosas\">Nombrar cosas</a></h2>\n<p>Las API de Electron utilizan el esquema de capitalización usado en Node.js:</p>\n<ul>\n<li>Cuando el módulo en sí es una clase similar a <code>BrowserWindow</code>, use <code>PascalCase</code>.</li>\n<li>Cuando el módulo es un conjunto de APIs, similar a <code>globalShortcut</code>, use <code>camelCase</code>.</li>\n<li>Cuando la API es una propiedad de objeto, y es lo suficientemente compleja para estar en un capítulo separado como <code>win.webContents</code>, utilice <code>mixedCase</code>.</li>\n<li>Para otras APIs que no sean módulos, utilice títulos naturales, similar a <code>&#x3C;webview> Tag</code> o <code>Process Object</code>.</li>\n</ul>\n<p>Cuando se crea una nueva API, se prefiere utilizar captadores y establecedores en lugar del estilo one-function de JQuery. Por ejemplo, se prefiere <code>.getText()</code> y <code>.setText(text)</code>, en lugar de <code>.text([text])</code>. Hay una <a href=\"https://github.com/electron/electron/issues/46\">discussion</a> sobre esto.</p>",
      "title": "Estilo de código",
      "description": ""
    },
    "/docs/api/command-line": {
      "locale": "es-ES",
      "slug": "command-line",
      "href": "/docs/api/command-line",
      "crowdinFileId": "256295",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/command-line.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-commandline\"><a href=\"#clase-commandline\">Clase: CommandLine</a></h2>\n<blockquote>\n<p>Manipula los argumentos de la línea de comandos para tu aplicación que Chromium lee</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>El siguiente ejemplo muestra como comprobar si la bandera <code>--disable-gpu</code> está activada.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.hasSwitch(<span class=\"hljs-string\">'disable-gpu'</span>)\n</code></pre>\n<p>Para más información sobre que tipos de banderas e interruptores puedes usar, revisa el documento <a href=\"/docs/api/command-line-switches\">Command Line Switches</a>.</p>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<h4 id=\"commandlineappendswitchswitch-value\"><a href=\"#commandlineappendswitchswitch-value\"><code>commandLine.appendSwitch(switch[, value])</code></a></h4>\n<ul>\n<li><code>switch</code> String - Un interruptor de la linea de comandos, sin el líder <code>--</code></li>\n<li><code>value</code> Cadena (opcional) - Un valor para el cambio dado</li>\n</ul>\n<p>Adjuntar un cambio (con <code>valor</code> opcional) al comando de de línea de Chromium.</p>\n<p><strong>Nota:</strong> Esto no afectará a <code>process.argv</code>. El uso previsto de esta función is controlar el comportamiento de Chromium.</p>\n<h4 id=\"commandlineappendargumentvalue\"><a href=\"#commandlineappendargumentvalue\"><code>commandLine.appendArgument(value)</code></a></h4>\n<ul>\n<li><code>valor</code> Cadena - El argumento a adjuntar a la línea de comando</li>\n</ul>\n<p>Agrega un argumento a la línea de comando de Chromium. El argumento será citado correctamente. Los interruptores precederán a los argumentos independientemente de orden agregado.</p>\n<p>Si estas añadiendo un argumento como <code>--switch=value</code>, considere usar en su lugar <code>appendSwitch('switch', 'value')</code>.</p>\n<p><strong>Nota:</strong> Esto no afectará a <code>process.argv</code>. El uso previsto de esta función is controlar el comportamiento de Chromium.</p>\n<h4 id=\"commandlinehasswitchswitch\"><a href=\"#commandlinehasswitchswitch\"><code>commandLine.hasSwitch(switch)</code></a></h4>\n<ul>\n<li><code>switch</code> Cadena - Un cambio en la línea de comando</li>\n</ul>\n<p>Devuelve <code>Boolean</code> - Si el interruptor de la línea de comando esta presente.</p>\n<h4 id=\"commandlinegetswitchvalueswitch\"><a href=\"#commandlinegetswitchvalueswitch\"><code>commandLine.getSwitchValue(switch)</code></a></h4>\n<ul>\n<li><code>switch</code> Cadena - Un cambio en la línea de comando</li>\n</ul>\n<p>Devuelve <code>String</code> - El valor del interruptor de la linea de comando.</p>\n<p><strong>Note:</strong> Cando el interruptor no esta presento o no tiene un valor, revuelve una cadena vacía.</p>",
      "title": "Clase: CommandLine",
      "description": "Manipula los argumentos de la línea de comandos para tu aplicación que Chromium lee"
    },
    "/docs/api/command-line-switches": {
      "locale": "es-ES",
      "slug": "command-line-switches",
      "href": "/docs/api/command-line-switches",
      "crowdinFileId": "256293",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/command-line-switches.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"cambios-de-línea-de-comandos-soportados\"><a href=\"#cambios-de-línea-de-comandos-soportados\">Cambios de línea de comandos soportados</a></h1>\n<blockquote>\n<p>Opciones de la linea de comandos soportados por Electron.</p>\n</blockquote>\n<p>Puedes usar <a href=\"/docs/api/command-line#commandlineappendswitchswitch-value\">app.commandLine.appendSwitch</a> para añadirlas en el código principal de tu app antes de que el evento <a href=\"/docs/api/app#event-ready\">ready</a> del modulo <a href=\"/docs/api/app\">app</a> es emitido:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'remote-debugging-port'</span>, <span class=\"hljs-string\">'8315'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'host-rules'</span>, <span class=\"hljs-string\">'MAP * 127.0.0.1'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Your code here</span>\n})\n</code></pre>\n<h2 id=\"banderas-de-la-cli-de-electron\"><a href=\"#banderas-de-la-cli-de-electron\">Banderas de la CLI de Electron</a></h2>\n<h3 id=\"--auth-server-whitelisturl\"><a href=\"#--auth-server-whitelisturl\">--auth-server-whitelist=<code>url</code></a></h3>\n<p>Una lista de servidores separadas por comas por los que la autentificación integrada esta habilitada.</p>\n<p>Por ejemplo:</p>\n<pre><code class=\"hljs language-sh\">--auth-server-whitelist=<span class=\"hljs-string\">'*example.com, *foobar.com, *baz'</span>\n</code></pre>\n<p>entonces cualquier <code>url</code> acabando con <code>example.com</code>, <code>foobar.com</code>, <code>baz</code> será considerada por la autentificación integrada. Sin el prefijo <code>*</code> la URL ha de coincidir exactamente.</p>\n<h3 id=\"--auth-negotiate-delegate-whitelisturl\"><a href=\"#--auth-negotiate-delegate-whitelisturl\">--auth-negotiate-delegate-whitelist=<code>url</code></a></h3>\n<p>A comma-separated list of servers for which delegation of user credentials is required. Sin el prefijo <code>*</code> la URL ha de coincidir exactamente.</p>\n<h3 id=\"--disable-ntlm-v2\"><a href=\"#--disable-ntlm-v2\">--disable-ntlm-v2</a></h3>\n<p>Disables NTLM v2 for posix platforms, no effect elsewhere.</p>\n<h3 id=\"--disable-http-cache\"><a href=\"#--disable-http-cache\">--disable-http-cache</a></h3>\n<p>Desactiva la cache de disco para las peticiones HTTP.</p>\n<h3 id=\"--disable-http2\"><a href=\"#--disable-http2\">--disable-http2</a></h3>\n<p>Desactiva los protocolos HTTP/2 y SPDY/3.</p>\n<h3 id=\"--disable-renderer-backgrounding\"><a href=\"#--disable-renderer-backgrounding\">--disable-renderer-backgrounding</a></h3>\n<p>Previene Chromium disminuir la prioridad de los procesos render de páginas invisibles.</p>\n<p>Esta opción es global a todos los procesos de render, si solamente quieres deshabilitar el ajuste en una ventana, puedes usar el truco de pasar <a href=\"https://github.com/atom/atom/pull/9485/files\">playing silent audio</a>.</p>\n<h3 id=\"--disk-cache-sizesize\"><a href=\"#--disk-cache-sizesize\">--disk-cache-size=<code>size</code></a></h3>\n<p>Fuerza el espacio máximo de disco a utilizar por la caché de disco, en bytes.</p>\n<h3 id=\"--enable-api-filtering-logging\"><a href=\"#--enable-api-filtering-logging\">--enable-api-filtering-logging</a></h3>\n<p>Habilita el caller stack logging para las siguientes APIs (eventos filtrados):</p>\n<ul>\n<li><code>desktopCapturer.getSources()</code> / <code>desktop-capturer-get-sources</code></li>\n</ul>\n<h3 id=\"--enable-loggingfile\"><a href=\"#--enable-loggingfile\">--enable-logging[=file]</a></h3>\n<p>Prints Chromium's logging to stderr (or a log file).</p>\n<p>The <code>ELECTRON_ENABLE_LOGGING</code> environment variable has the same effect as passing <code>--enable-logging</code>.</p>\n<p>Passing <code>--enable-logging</code> will result in logs being printed on stderr. Passing <code>--enable-logging=file</code> will result in logs being saved to the file specified by <code>--log-file=...</code>, or to <code>electron_debug.log</code> in the user-data directory if <code>--log-file</code> is not specified.</p>\n<blockquote>\n<p><strong>Note:</strong> On Windows, logs from child processes cannot be sent to stderr. Logging to a file is the most reliable way to collect logs on Windows.</p>\n</blockquote>\n<p>See also <code>--log-file</code>, <code>--log-level</code>, <code>--v</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--force-fieldtrialstrials\"><a href=\"#--force-fieldtrialstrials\">--force-fieldtrials=<code>trials</code></a></h3>\n<p>Las pruebas de campo se habilitan o deshabilitan por la fuerza.</p>\n<p>Por ejemplo: <code>WebRTC-Audio-Red-For-Opus/Enabled/</code></p>\n<h3 id=\"--host-rulesrules\"><a href=\"#--host-rulesrules\">--host-rules=<code>rules</code></a></h3>\n<p>Lista de <code>rules</code> separadas por coma que controlan como los nombres de host son mapeados.</p>\n<p>Por ejemplo:</p>\n<ul>\n<li><code>MAP * 127.0.0.1</code> Fuerza todos los nombres de host a ser mapeados a 127.0.0.1</li>\n<li><code>MAP *.google.com proxy</code> Fuerza todos los subdominios google.com a ser resueltos como \"proxy\".</li>\n<li><code>MAP test.com [::1]:77</code> Forces \"test.com\" to resolve to IPv6 loopback. Will also force the port of the resulting socket address to be 77.</li>\n<li><code>MAP * baz, EXCLUDE www.google.com</code> Mapeara todo a \"baz\", excepto para \"www.google.com\".</li>\n</ul>\n<p>Estos mapeados aplican al host punto final en una petición de red (la conexión TCP y el host se solventan en una conexión directa, <code>CONNECT</code> en una conexión HTTP proxy, y el host punto fila en una conexión proxy <code>SOCKS</code>).</p>\n<h3 id=\"--host-resolver-rulesrules\"><a href=\"#--host-resolver-rulesrules\">--host-resolver-rules=<code>rules</code></a></h3>\n<p>Como <code>--host-rules</code> pero estas <code>rules</code> solamente aplican a el host resolutor.</p>\n<h3 id=\"--ignore-certificate-errors\"><a href=\"#--ignore-certificate-errors\">--ignore-certificate-errors</a></h3>\n<p>Ignora los errores relacionados con el certificado.</p>\n<h3 id=\"--ignore-connections-limitdomains\"><a href=\"#--ignore-connections-limitdomains\">--ignore-connections-limit=<code>domains</code></a></h3>\n<p>Ignore el limite de conexión para la lista de <code>domains</code> separados por <code>,</code>.</p>\n<h3 id=\"--js-flagsflags\"><a href=\"#--js-flagsflags\">--js-flags=<code>flags</code></a></h3>\n<p>Specifies the flags passed to the Node.js engine. It has to be passed when starting Electron if you want to enable the <code>flags</code> in the main process.</p>\n<pre><code class=\"hljs language-sh\">$ electron --js-flags=<span class=\"hljs-string\">\"--harmony_proxies --harmony_collections\"</span> your-app\n</code></pre>\n<p>Vea la <a href=\"https://nodejs.org/api/cli.html\">Documentación de Node.js</a> o ejecute <code>node --help</code> en su terminal para una lista de las opciones disponibles. Adicionalmente, ejecute <code>node --v8-options</code> para ver una lista de opciones que se refieren específicamente al motor Node.js's V8 JavaScript.</p>\n<h3 id=\"--lang\"><a href=\"#--lang\">--lang</a></h3>\n<p>Establecer una configuración regional personalizada.</p>\n<h3 id=\"--log-filepath\"><a href=\"#--log-filepath\">--log-file=<code>path</code></a></h3>\n<p>If <code>--enable-logging</code> is specified, logs will be written to the given path. The parent directory must exist.</p>\n<p>Setting the <code>ELECTRON_LOG_FILE</code> environment variable is equivalent to passing this flag. If both are present, the command-line switch takes precedence.</p>\n<h3 id=\"--log-net-logpath\"><a href=\"#--log-net-logpath\">--log-net-log=<code>path</code></a></h3>\n<p>Habilita el registro de los eventos de red para ser salvados y escritos en la ruta <code>path</code>.</p>\n<h3 id=\"--log-leveln\"><a href=\"#--log-leveln\">--log-level=<code>N</code></a></h3>\n<p>Sets the verbosity of logging when used together with <code>--enable-logging</code>. <code>N</code> should be one of <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h?q=logging::LogSeverity&#x26;ss=chromium\">Chrome's LogSeverities</a>.</p>\n<p>Note that two complimentary logging mechanisms in Chromium -- <code>LOG()</code> and <code>VLOG()</code> -- are controlled by different switches. <code>--log-level</code> controls <code>LOG()</code> messages, while <code>--v</code> and <code>--vmodule</code> control <code>VLOG()</code> messages. So you may want to use a combination of these three switches depending on the granularity you want and what logging calls are made by the code you're trying to watch.</p>\n<p>See <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h\">Chromium Logging source</a> for more information on how <code>LOG()</code> and <code>VLOG()</code> interact. Loosely speaking, <code>VLOG()</code> can be thought of as sub-levels / per-module levels inside <code>LOG(INFO)</code> to control the firehose of <code>LOG(INFO)</code> data.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, <code>--v</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--no-proxy-server\"><a href=\"#--no-proxy-server\">--no-proxy-server</a></h3>\n<p>Don't use a proxy server and always make direct connections. Overrides any other proxy server flags that are passed.</p>\n<h3 id=\"--no-sandbox\"><a href=\"#--no-sandbox\">--no-sandbox</a></h3>\n<p>Disables the Chromium <a href=\"https://www.chromium.org/developers/design-documents/sandbox\">sandbox</a>. Forces renderer process and Chromium helper processes to run un-sandboxed. Solo debe usarse para pruebas.</p>\n<h3 id=\"--proxy-bypass-listhosts\"><a href=\"#--proxy-bypass-listhosts\">--proxy-bypass-list=<code>hosts</code></a></h3>\n<p>Instructs Electron to bypass the proxy server for the given semi-colon-separated list of hosts. This flag has an effect only if used in tandem with <code>--proxy-server</code>.</p>\n<p>Por ejemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'proxy-bypass-list'</span>, <span class=\"hljs-string\">'&#x3C;local>;*.google.com;*foo.com;1.2.3.4:5678'</span>)\n</code></pre>\n<p>Utilizará el servidor proxy para todos los host excepto para las direcciones locales (<code>localhost</code>, <code>127.0.0.1</code> etc.), subdominios <code>google.com</code>, hosts que contienen el sufijo <code>foo.com</code> y cualquiera en <code>1.2.3.4:5678</code>.</p>\n<h3 id=\"--proxy-pac-urlurl\"><a href=\"#--proxy-pac-urlurl\">--proxy-pac-url=<code>url</code></a></h3>\n<p>Usa el programa PAC en la <code>url</code> especificada.</p>\n<h3 id=\"--proxy-serveraddressport\"><a href=\"#--proxy-serveraddressport\">--proxy-server=<code>address:port</code></a></h3>\n<p>Usa un servidor proxy especifico, el cual sobrescribe la configuración del sistema. Esta opción solo afecta peticiones con protocolo HTTP, incluyendo peticiones HTTPS y WebSocket. También cabe destacar que no todos los servidores proxy aceptan peticiones HTTPS y WebSocket. La URL del proxy no soporta la autenticacón usuario y clave <a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=615947\">per Chromium issue</a>.</p>\n<h3 id=\"--remote-debugging-portport\"><a href=\"#--remote-debugging-portport\">--remote-debugging-port=<code>port</code></a></h3>\n<p>Habilita depuración remota sobre HTTP en el <code>port</code> especificado.</p>\n<h3 id=\"--vlog_level\"><a href=\"#--vlog_level\">--v=<code>log_level</code></a></h3>\n<p>Gives the default maximal active V-logging level; 0 is the default. Normally positive values are used for V-logging levels.</p>\n<p>Esta opción solo funciona cuando <code>--enable-logging</code> es también pasada.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--vmodulepattern\"><a href=\"#--vmodulepattern\">--vmodule=<code>pattern</code></a></h3>\n<p>Permite que el nivel máximo por module de V-logging sobrepase el valor dado por <code>--v</code>. P.e. <code>my_module=2,foo*=3</code> would change the logging level for all code in source files <code>my_module.*</code> and <code>foo*.*</code>.</p>\n<p>Cualquier patrón que contenga una barra hacia adelante o una barra hacia atras será probado contra el nombre de la ruta completa y no solo contra el módulo. P.e. <code>*/foo/bar/*=2</code> would change the logging level for all code in the source files under a <code>foo/bar</code> directory.</p>\n<p>Esta opción solo funciona cuando <code>--enable-logging</code> es también pasada.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, and <code>--v</code>.</p>\n<h3 id=\"--force_high_performance_gpu\"><a href=\"#--force_high_performance_gpu\">--force_high_performance_gpu</a></h3>\n<p>Force using discrete GPU when there are multiple GPUs available.</p>\n<h3 id=\"--force_low_power_gpu\"><a href=\"#--force_low_power_gpu\">--force_low_power_gpu</a></h3>\n<p>Force using integrated GPU when there are multiple GPUs available.</p>\n<h2 id=\"banderas-nodejs\"><a href=\"#banderas-nodejs\">Banderas Node.js</a></h2>\n<p>Electron soporta algunas de las <a href=\"https://nodejs.org/api/cli.html\">CLI flags</a> soportadas por Node.js.</p>\n<p><strong>Note:</strong> Passing unsupported command line switches to Electron when it is not running in <code>ELECTRON_RUN_AS_NODE</code> will have no effect.</p>\n<h3 id=\"--inspect-brkhostport\"><a href=\"#--inspect-brkhostport\">--inspect-brk[=[host:]port]</a></h3>\n<p>Activate inspector on host:port and break at start of user script. Default host:port is 127.0.0.1:9229.</p>\n<p>Aliased to <code>--debug-brk=[host:]port</code>.</p>\n<h3 id=\"--inspect-porthostport\"><a href=\"#--inspect-porthostport\">--inspect-port=[host:]port</a></h3>\n<p>Set the <code>host:port</code> to be used when the inspector is activated. Useful when activating the inspector by sending the SIGUSR1 signal. Default host is <code>127.0.0.1</code>.</p>\n<p>Aliased to <code>--debug-port=[host:]port</code>.</p>\n<h3 id=\"--inspecthostport\"><a href=\"#--inspecthostport\">--inspect[=[host:]port]</a></h3>\n<p>Activate inspector on <code>host:port</code>. Por defecto es <code>127.0.0.1:9229</code>.</p>\n<p>V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug and profile Electron instances. The tools attach to Electron instances via a TCP port and communicate using the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">Chrome DevTools Protocol</a>.</p>\n<p>Vea la guía de <a href=\"/docs/tutorial/debugging-main-process\">Debugging the Main Process</a> para más detalles.</p>\n<p>Aliased to <code>--debug[=[host:]port</code>.</p>\n<h3 id=\"--inspect-publish-uidstderrhttp\"><a href=\"#--inspect-publish-uidstderrhttp\">--inspect-publish-uid=stderr,http</a></h3>\n<p>Specify ways of the inspector web socket url exposure.</p>\n<p>By default inspector websocket url is available in stderr and under /json/list endpoint on <a href=\"http://host:port/json/list\">http://host:port/json/list</a>.</p>",
      "title": "Cambios de línea de comandos soportados",
      "description": "Opciones de la linea de comandos soportados por Electron."
    },
    "/docs/api/content-tracing": {
      "locale": "es-ES",
      "slug": "content-tracing",
      "href": "/docs/api/content-tracing",
      "crowdinFileId": "256297",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/content-tracing.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"contenttracing\"><a href=\"#contenttracing\">contentTracing</a></h1>\n<blockquote>\n<p>Recopile datos de rastreo del módulo de contenido de Chromium para encontrar cuellos de botella de rendimiento y operaciones lentas.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p>Este módulo no incluye una interfaz web. Para ver las huellas gravadas, use <a href=\"https://chromium.googlesource.com/catapult/+/HEAD/tracing/README.md\">trace viewer</a>, disponible en <code>chrome://tracing</code> en Chrome.</p>\n<p><strong>Note:</strong> You should not use this module until the <code>ready</code> event of the app module is emitted.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, contentTracing } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  (<span class=\"hljs-keyword\">async</span> () => {\n    <span class=\"hljs-keyword\">await</span> contentTracing.startRecording({\n      <span class=\"hljs-attr\">included_categories</span>: [<span class=\"hljs-string\">'*'</span>]\n    })\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Tracing started'</span>)\n    <span class=\"hljs-keyword\">await</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> setTimeout(resolve, <span class=\"hljs-number\">5000</span>))\n    <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> contentTracing.stopRecording()\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Tracing data recorded to '</span> + path)\n  })()\n})\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>contentTracing</code> tiene los siguientes métodos:</p>\n<h3 id=\"contenttracinggetcategories\"><a href=\"#contenttracinggetcategories\"><code>contentTracing.getCategories()</code></a></h3>\n<p>Devuelve <code>Promise&#x3C;String[]></code> - resuelve con un array de grupos de categorías una vez que todos los procesos hijos han confirmado la solicitud <code>getCategories</code></p>\n<p>Obtener un conjunto de grupos de categorías. La categoría de grupos puede cambiar a medida que se alcanza nuevas rutas de código. Ver también <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">lista de categorías de seguimiento integradas</a>.</p>\n<blockquote>\n<p><strong>NOTA:</strong> Electron añade una categoría de seguimiento no predeterminada llamada <code>\"electron\"</code>. Esta categoría se puede utilizar para capturar eventos de seguimiento específicos de Electron.</p>\n</blockquote>\n<h3 id=\"contenttracingstartrecordingoptions\"><a href=\"#contenttracingstartrecordingoptions\"><code>contentTracing.startRecording(options)</code></a></h3>\n<ul>\n<li><code>options</code> (<a href=\"/docs/api/structures/trace-config\">TraceConfig</a> | <a href=\"/docs/api/structures/trace-categories-and-options\">TraceCategoriesAndOptions</a>)</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code> - resuelto una vez que todos los procesos hijos han confirmado la solicitud <code>startRecording</code>.</p>\n<p>Iniciar la grabación en todos los procesos.</p>\n<p>La grabación se inicia de manera inmediata de forma local y asincrónica en los procesos secundarios tan pronto como reciben la solicitud de habilitación de grabación.</p>\n<p>Si una grabación ya está corriendo, la promesa será inmediatamente resulta, ya que sólo un operación de seguimiento puede estar en progrese a la vez.</p>\n<h3 id=\"contenttracingstoprecordingresultfilepath\"><a href=\"#contenttracingstoprecordingresultfilepath\"><code>contentTracing.stopRecording([resultFilePath])</code></a></h3>\n<ul>\n<li><code>resultFilePath</code> String (opcional)</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;String></code> - resuleve con una ruta al archivo que contiene los datos rastreados una vez que los procesos hijos han reconocido la solicitud <code>stopRecording</code></p>\n<p>Dejar de grabar en todos los procesos.</p>\n<p>Los procesos secundarios normalmente almacenan en caché los datos de rastreo y solo raramente limpian y envían datos de rastreo al proceso principal. Esto ayuda a minimizar la sobrecarga de tiempo de ejecución del rastreo ya que el envío de datos de rastreo a través de IPC puede ser una operación costosa. Por lo tanto, para finalizar un seguimiento, Chromium solicita de forma asíncrona a todos los procesos hijos que eliminen cualquier seguimiento de datos pendiente.</p>\n<p>Los datos de rastreo se escribirán dentro de <code>resultFilePath</code>. Si <code>resultFilePath</code> está vacío o no es proporcionado, los datos de rastreo serán escrito en un archivo temporal, y la ruta será retornada en el promise.</p>\n<h3 id=\"contenttracinggettracebufferusage\"><a href=\"#contenttracinggettracebufferusage\"><code>contentTracing.getTraceBufferUsage()</code></a></h3>\n<p>Devuelve <code>Promise&#x3C;Object></code> - Resuelve con un objeto conteniendo el <code>value</code> y <code>percentage</code> de máximo uso de trace buffer</p>\n<ul>\n<li><code>value</code> Número</li>\n<li><code>percentage</code> Número</li>\n</ul>\n<p>Obtener el uso máximo a través de procesos de trace buffer como un porcentaje del estado completo.</p>",
      "title": "contentTracing",
      "description": "Recopile datos de rastreo del módulo de contenido de Chromium para encontrar cuellos de botella de rendimiento y operaciones lentas."
    },
    "/docs/api/context-bridge": {
      "locale": "es-ES",
      "slug": "context-bridge",
      "href": "/docs/api/context-bridge",
      "crowdinFileId": "256299",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/context-bridge.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"contextbridge\"><a href=\"#contextbridge\">contextBridge</a></h1>\n<blockquote>\n<p>Cree un puente seguro, bidireccional y sincrónico a través de contextos aislados</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>A continuación se muestra un ejemplo de exponer una API a un renderer desde un script de precarga aislado:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Preload (Isolated World)</span>\n<span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(\n  <span class=\"hljs-string\">'electron'</span>,\n  {\n    <span class=\"hljs-attr\">doThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.send(<span class=\"hljs-string\">'do-a-thing'</span>)\n  }\n)\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Renderer (Main World)</span>\n\n<span class=\"hljs-built_in\">window</span>.electron.doThing()\n</code></pre>\n<h2 id=\"glosario\"><a href=\"#glosario\">Glosario</a></h2>\n<h3 id=\"main-world\"><a href=\"#main-world\">Main World</a></h3>\n<p>El \"Main World\" es el contexto de JavaScript que corre tu código renderer principal. Por defecto, la página que cargas en el tu renderer ejecuta código en este mundo.</p>\n<h3 id=\"mundo-aislado\"><a href=\"#mundo-aislado\">Mundo aislado</a></h3>\n<p>Cuando <code>contextIsolation</code> está activado en tu <code>webPreferences</code> (este es el comportamiento por defecto desde Electron 12.0.0), tus scripts <code>preload</code> corren en un \"Mundo aislado\".  Puede leer más sobre aislamiento del contexto y que afecta en los documentos <a href=\"/docs/tutorial/security#3-enable-context-isolation-for-remote-content\">security</a>.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>contextBridge</code> tiene los siguientes métodos:</p>\n<h3 id=\"contextbridgeexposeinmainworldapikey-api\"><a href=\"#contextbridgeexposeinmainworldapikey-api\"><code>contextBridge.exposeInMainWorld(apiKey, api)</code></a></h3>\n<ul>\n<li><code>apiKey</code> String - La clave para inyectar la API en la ventana <code>window</code>.  La API será accesible en <code>window[apiKey]</code>.</li>\n<li><code>api</code> any - Tu API más información sobre qué puede ser esta API y como funciona esta disponible a continuación.</li>\n</ul>\n<h2 id=\"uso\"><a href=\"#uso\">Uso</a></h2>\n<h3 id=\"api\"><a href=\"#api\">API</a></h3>\n<p>La <code>api</code> proveeida a <a href=\"#contextbridgeexposeinmainworldapikey-api\"><code>exposeInMainWorld</code></a> debe ser una <code>Function</code>, <code>String</code>, <code>Number</code>, <code>Array</code>, <code>Boolean</code>, o un objeto cuya llaves son strings y los valores son una <code>Function</code>, <code>String</code>, <code>Number</code>, <code>Array</code>, <code>Boolean</code>, u otro objeto anidado que cumpa con las mismas condiciones.</p>\n<p>Los valores <code>Function</code> se transfieren a otro contexto y todos los demás valores son <strong>copiados</strong> y <strong>congedados</strong>. Cualquier dato / primitivos enviado en la API se vuelve inmutable y las actualizaciones de una lado del puente no resulta en una actualización en el otro lado.</p>\n<p>A continuación se muestra un ejemplo de una API compleja:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(\n  <span class=\"hljs-string\">'electron'</span>,\n  {\n    <span class=\"hljs-attr\">doThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.send(<span class=\"hljs-string\">'do-a-thing'</span>),\n    <span class=\"hljs-attr\">myPromises</span>: [<span class=\"hljs-built_in\">Promise</span>.resolve(), <span class=\"hljs-built_in\">Promise</span>.reject(<span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'whoops'</span>))],\n    <span class=\"hljs-attr\">anAsyncFunction</span>: <span class=\"hljs-keyword\">async</span> () => <span class=\"hljs-number\">123</span>,\n    <span class=\"hljs-attr\">data</span>: {\n      <span class=\"hljs-attr\">myFlags</span>: [<span class=\"hljs-string\">'a'</span>, <span class=\"hljs-string\">'b'</span>, <span class=\"hljs-string\">'c'</span>],\n      <span class=\"hljs-attr\">bootTime</span>: <span class=\"hljs-number\">1234</span>\n    },\n    <span class=\"hljs-attr\">nestedAPI</span>: {\n      <span class=\"hljs-attr\">evenDeeper</span>: {\n        <span class=\"hljs-attr\">youCanDoThisAsMuchAsYouWant</span>: {\n          <span class=\"hljs-attr\">fn</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ({\n            <span class=\"hljs-attr\">returnData</span>: <span class=\"hljs-number\">123</span>\n          })\n        }\n      }\n    }\n  }\n)\n</code></pre>\n<h3 id=\"funciones-api\"><a href=\"#funciones-api\">Funciones API</a></h3>\n<p>Los valores de <code>Function</code> que enlazas a través de <code>contextBridge</code> son proxyados a través de Electron para asegurar que los contextos permanezcan aislados.  Esto da como resultado algunas limitaciones claves que hemos descrito a continuación.</p>\n<h4 id=\"parámetro--error--tipo-de-retorno-soportado\"><a href=\"#parámetro--error--tipo-de-retorno-soportado\">Parámetro / Error / Tipo de Retorno soportado</a></h4>\n<p>Dado que los parámetros, errores y valores de retorno son <strong>copiados</strong> cuando son enviados sobre el puente, solo hay ciertos tipos que pueden ser usados. En un nivel alto, si el tipo que desea usar se puede serializar y deserializar en el mismo objeto, funcionará.  A continuación, se incluye una tabla de soporte de tipo para que esté completa:</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Tipo</th><th>Complejidad</th><th>Soporte de parámetros</th><th>Valor de Retorno Soportado</th><th>Limitaciones</th></tr></thead><tbody><tr><td><code>String</code></td><td>Simple</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Number</code></td><td>Simple</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Boolean</code></td><td>Simple</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Object</code></td><td>Complejo</td><td>✅</td><td>✅</td><td>Las llaves deben ser soportadas usando solo los tipos \"Simple\" en esta tabla.  Los valores deben ser soportadas en esta tabla.  Las modificaciones del prototipo se eliminan.  Enviar clases personalizadas copiará valores pero no el prototipo.</td></tr><tr><td><code>Array</code></td><td>Complejo</td><td>✅</td><td>✅</td><td>Mismas limitaciones para el tipo <code>Object</code></td></tr><tr><td><code>Error</code></td><td>Complejo</td><td>✅</td><td>✅</td><td>Los errores que se lanzan también se copian, esto puede resultar en que el mensaje y el seguimiento de la pila del error cambien ligeramente debido a que se lanzan en un contexto diferente</td></tr><tr><td><code>Promise</code></td><td>Complejo</td><td>✅</td><td>✅</td><td>Las promesas solo se transfieren si son el valor de retorno o el parámetro exacto.  Las promesas anidadas en arrays o objetos serán eliminadas.</td></tr><tr><td><code>Function</code></td><td>Complejo</td><td>✅</td><td>✅</td><td>Las modificaciones del prototipo se eliminan.  Enviar clases o constructores no funcionará.</td></tr><tr><td><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Tipos Clonables</a></td><td>Simple</td><td>✅</td><td>✅</td><td>Veer el documento vinculado en tipos clonables</td></tr><tr><td><code>Elemento</code></td><td>Complejo</td><td>✅</td><td>✅</td><td>Las modificaciones del prototipo se eliminan.  Enviar elementos personalizados no funcionará.</td></tr><tr><td><code>Blob</code></td><td>Complejo</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Símbolo</code></td><td>N/A</td><td>❌</td><td>❌</td><td>Los Symbols no pueden ser copiados a través de contextos así que son eliminados</td></tr></tbody></table>\n<p>Si el tipo que te interesa no está en la tabla anterior, probablemente no esté soportado.</p>\n<h3 id=\"exponer-global-symbols-de-node\"><a href=\"#exponer-global-symbols-de-node\">Exponer Global Symbols de Node</a></h3>\n<p>El <code>contextBridge</code> puede ser utilizado por el script de precarga para dar acceso al renderizador a las APIs de Node. La tabla de tipos soportados descrita anteriormente aplica también a las APIs de Node que expongas a través de <code>contextBridge</code>. Tenga en cuenta que muchas APIs de Nodo conceden acceso a los recursos del sistema local. Se muy cauteloso sobre que APIs y globales expones a contenido remoto que no es de confianza.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> crypto = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'crypto'</span>)\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'nodeCrypto'</span>, {\n  sha256sum (data) {\n    <span class=\"hljs-keyword\">const</span> hash = crypto.createHash(<span class=\"hljs-string\">'sha256'</span>)\n    hash.update(data)\n    <span class=\"hljs-keyword\">return</span> hash.digest(<span class=\"hljs-string\">'hex'</span>)\n  }\n})\n</code></pre>",
      "title": "contextBridge",
      "description": "Cree un puente seguro, bidireccional y sincrónico a través de contextos aislados"
    },
    "/docs/tutorial/context-isolation": {
      "locale": "es-ES",
      "slug": "context-isolation",
      "href": "/docs/tutorial/context-isolation",
      "crowdinFileId": "256185",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/context-isolation.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"aislamiento-del-contexto\"><a href=\"#aislamiento-del-contexto\">Aislamiento del contexto</a></h1>\n<h2 id=\"¿qué-es\"><a href=\"#¿qué-es\">¿Qué es?</a></h2>\n<p>Context Isolation is a feature that ensures that both your <code>preload</code> scripts and Electron's internal logic run in a separate context to the website you load in a <a href=\"/docs/api/web-contents\"><code>webContents</code></a>.  This is important for security purposes as it helps prevent the website from accessing Electron internals or the powerful APIs your preload script has access to.</p>\n<p>This means that the <code>window</code> object that your preload script has access to is actually a <strong>different</strong> object than the website would have access to.  For example, if you set <code>window.hello = 'wave'</code> in your preload script and context isolation is enabled, <code>window.hello</code> will be undefined if the website tries to access it.</p>\n<p>Context isolation has been enabled by default since Electron 12, and it is a recommended security setting for <em>all applications</em>.</p>\n<h2 id=\"migración\"><a href=\"#migración\">Migración</a></h2>\n<blockquote>\n<p>Without context isolation, I used to provide APIs from my preload script using <code>window.X = apiObject</code>. Now what?</p>\n</blockquote>\n<h3 id=\"before-context-isolation-disabled\"><a href=\"#before-context-isolation-disabled\">Before: context isolation disabled</a></h3>\n<p>Exposing APIs from your preload script to a loaded website in the renderer process is a common use-case. With context isolation disabled, your preload script would share a common global <code>window</code> object with the renderer. You could then attach arbitrary properties to a preload script:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// preload with contextIsolation disabled</span>\n<span class=\"hljs-built_in\">window</span>.myAPI = {\n  <span class=\"hljs-attr\">doAThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {}\n}\n</code></pre>\n<p>The <code>doAThing()</code> function could then be used directly in the renderer process:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// use the exposed API in the renderer</span>\n<span class=\"hljs-built_in\">window</span>.myAPI.doAThing()\n</code></pre>\n<h3 id=\"after-context-isolation-enabled\"><a href=\"#after-context-isolation-enabled\">After: context isolation enabled</a></h3>\n<p>There is a dedicated module in Electron to help you do this in a painless way. The <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> module can be used to <strong>safely</strong> expose APIs from your preload script's isolated context to the context the website is running in. The API will also be accessible from the website on <code>window.myAPI</code> just like it was before.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// preload with contextIsolation enabled</span>\n<span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">doAThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {}\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// use the exposed API in the renderer</span>\n<span class=\"hljs-built_in\">window</span>.myAPI.doAThing()\n</code></pre>\n<p>Please read the <code>contextBridge</code> documentation linked above to fully understand its limitations. For instance, you can't send custom prototypes or symbols over the bridge.</p>\n<h2 id=\"security-considerations\"><a href=\"#security-considerations\">Security considerations</a></h2>\n<p>Just enabling <code>contextIsolation</code> and using <code>contextBridge</code> does not automatically mean that everything you do is safe. For instance, this code is <strong>unsafe</strong>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// ❌ Bad code</span>\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">send</span>: ipcRenderer.send\n})\n</code></pre>\n<p>It directly exposes a powerful API without any kind of argument filtering. This would allow any website to send arbitrary IPC messages, which you do not want to be possible. The correct way to expose IPC-based APIs would instead be to provide one method per IPC message.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// ✅ Good code</span>\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">loadPreferences</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'load-prefs'</span>)\n})\n</code></pre>\n<h2 id=\"uso-con-typescript\"><a href=\"#uso-con-typescript\">Uso con TypeScript</a></h2>\n<p>SI está construyendo su aplicación Electron con TypeScript, querrá añadir tipos a sus APIs expuestas sobre el puente del contexto. El objeto <code>window</code> del renderizador no tendrá los tipos correctos a menos que extienda los tipos con un <a href=\"https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html\">declaration file</a>.</p>\n<p>Por ejemplo, dado este script <code>preload.ts</code>:</p>\n<pre><code class=\"hljs language-typescript\">contextBridge.exposeInMainWorld(<span class=\"hljs-string\">'electronAPI'</span>, {\n  loadPreferences: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'load-prefs'</span>)\n})\n</code></pre>\n<p>Puede crear un archivo de declaración <code>renderer.d.ts</code> y aumentar globalmente la interfaz <code>Window</code>:</p>\n<pre><code class=\"hljs language-typescript\"><span class=\"hljs-keyword\">export</span> <span class=\"hljs-keyword\">interface</span> IElectronAPI {\n  loadPreferences: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-built_in\">Promise</span>&#x3C;<span class=\"hljs-built_in\">void</span>>,\n}\n\n<span class=\"hljs-keyword\">declare</span> global {\n  <span class=\"hljs-keyword\">interface</span> Window {\n    electronAPI: IElectronAPI\n  }\n}\n</code></pre>\n<p>Al hacerlo se asegurará que el compilador de TypeScript sepa sobre la propiedad <code>electronAPI</code> en su objeto global <code>window</code> al escribir scripts en su proceso renderizador:</p>\n<pre><code class=\"hljs language-typescript\"><span class=\"hljs-built_in\">window</span>.electronAPI.loadPreferences()\n</code></pre>",
      "title": "Aislamiento del contexto",
      "description": "Without context isolation, I used to provide APIs from my preload script using window.X = apiObject. Now what?"
    },
    "/docs/api/structures/cookie": {
      "locale": "es-ES",
      "slug": "cookie",
      "href": "/docs/api/structures/cookie",
      "crowdinFileId": "256417",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/cookie.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"cookie-object\"><a href=\"#cookie-object\">Cookie Object</a></h1>\n<ul>\n<li><code>name</code> String - The name of the cookie.</li>\n<li><code>value</code> String - The value of the cookie.</li>\n<li><code>domain</code> String (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains.</li>\n<li><code>hostOnly</code> Boolean (optional) - Whether the cookie is a host-only cookie; this will only be <code>true</code> if no domain was passed.</li>\n<li><code>path</code> String (optional) - The path of the cookie.</li>\n<li><code>secure</code> Boolean (optional) - Whether the cookie is marked as secure.</li>\n<li><code>httpOnly</code> Boolean (optional) - Whether the cookie is marked as HTTP only.</li>\n<li><code>session</code> Boolean (optional) - Whether the cookie is a session cookie or a persistent cookie with an expiration date.</li>\n<li><code>expirationDate</code> Double (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies.</li>\n<li><code>sameSite</code> String - The <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies\">Same Site</a> policy applied to this cookie.  Can be <code>unspecified</code>, <code>no_restriction</code>, <code>lax</code> or <code>strict</code>.</li>\n</ul>",
      "title": "Cookie Object",
      "description": ""
    },
    "/docs/api/cookies": {
      "locale": "es-ES",
      "slug": "cookies",
      "href": "/docs/api/cookies",
      "crowdinFileId": "256301",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/cookies.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-cookies\"><a href=\"#clase-cookies\">Clase: Cookies</a></h2>\n<blockquote>\n<p>Busca y modifica las cookies de la sesión.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Las instancias de la clase <code>Cookies</code> son accedidas utilizado la propiedad <code>cookies</code> de una <code>Session</code>.</p>\n<p>Por ejemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Query all cookies.</span>\nsession.defaultSession.cookies.get({})\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">cookies</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(cookies)\n  }).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">error</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(error)\n  })\n\n<span class=\"hljs-comment\">// Consulta todas las cookies asociadas con un url especifica.</span>\nsession.defaultSession.cookies.get({ <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'http://www.github.com'</span> })\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">cookies</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(cookies)\n  }).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">error</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(error)\n  })\n\n<span class=\"hljs-comment\">// Establece un cookie con los datos de la misma.</span>\n<span class=\"hljs-comment\">// puede sobrescriba cookies iguales si existen.</span>\n<span class=\"hljs-keyword\">const</span> cookie = { <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'http://www.github.com'</span>, <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'dummy_name'</span>, <span class=\"hljs-attr\">value</span>: <span class=\"hljs-string\">'dummy'</span> }\nsession.defaultSession.cookies.set(cookie)\n  .then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// success</span>\n  }, (error) => {\n    <span class=\"hljs-built_in\">console</span>.error(error)\n  })\n</code></pre>\n<h3 id=\"eventos-de-instancia\"><a href=\"#eventos-de-instancia\">Eventos de Instancia</a></h3>\n<p>Los siguientes eventos están disponibles en las instancias de <code>Cookies</code>:</p>\n<h4 id=\"evento-changed\"><a href=\"#evento-changed\">Evento: \"changed\"</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>cookie</code> <a href=\"/docs/api/structures/cookie\">Cookie</a> - La cookie que se ha cambiado.</li>\n<li><code>cause</code> String - La causa del cambio con uno de los siguientes valores:<ul>\n<li><code>explicit</code> - La cookie se cambió directamente por la acción de un consumidor.</li>\n<li><code>overwrite</code> - La cookie se eliminó automáticamente debido a una operación insertada que la sobreescribió.</li>\n<li><code>expired</code> - La cookie se eliminó automáticamente debido a que expiró.</li>\n<li><code>evicted</code> - La cookie fue desecha automáticamente durante la recolección de desechos.</li>\n<li><code>expired-overwrite</code> - La cookie fue sobreescrita con una fecha de vencimiento ya expirada.</li>\n</ul></li>\n<li><code>removed</code> Booleano - <code>true</code> si la cookie se eliminó, <code>false</code> si no lo hizo.</li>\n</ul>\n<p>Aparece cuando se cambia una cookie porque fue añadida, editada, eliminada o expirada.</p>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<p>Los siguientes métodos están disponibles en las instancias de <code>Cookies</code>:</p>\n<h4 id=\"cookiesgetfilter\"><a href=\"#cookiesgetfilter\"><code>cookies.get(filter)</code></a></h4>\n<ul>\n<li>Objeto <code>filter</code><ul>\n<li><code>url</code> String (opcional) - Recupera las cookies las cuales están asociadas con la <code>url</code>. Vacío implica recuperar las cookies de todas las URLs.</li>\n<li><code>name</code> Cadena (opcional) - Filtra las cookies por nombre.</li>\n<li><code>domain</code> Cadena (opcional) - Recupera las cookies de cuyos dominios coinciden o son subdominios de <code>domains</code>.</li>\n<li><code>path</code> Cadena (opcional) - Recupera las cookies de cuya ruta coincide con <code>path</code>.</li>\n<li><code>secure</code> Booleano (opcional) - Filtra las cookies por su propiedad Secure.</li>\n<li><code>session</code> Booleano (opcional) - Filtra las cookies fuera de la sesión o cookies persistentes.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Cookie[]></code> - Una promesa que resulve un array de objetos cookies.</p>\n<p>Envía una solicitud para obtener todas las cookies que coincidan con <code>filter</code>, y resuelve una promesa con la respuesta.</p>\n<h4 id=\"cookiessetdetails\"><a href=\"#cookiessetdetails\"><code>cookies.set(details)</code></a></h4>\n<ul>\n<li><code>details</code> Object<ul>\n<li><code>url</code> String - La URL con la que asociar la cookie. La promise será rechazada si la URL es invalida.</li>\n<li><code>name</code> String (opcional) - El nombre de la cookie. Vacío por defecto si se omite.</li>\n<li><code>value</code> String (opcional) - El valor de la cookie. Vacío por defecto si se omite.</li>\n<li><code>domain</code> String (optional) - El dominio de la cookie; este será normalizado por precediéndolo con un punto para que también sea valido para el uso de subdominios. Vacío por defecto si se omite.</li>\n<li><code>path</code> String (opcional) - La ruta de la cookie. Vacío por defecto si se omite.</li>\n<li><code>secure</code> Boolean (opcional) - Si la cookie debería ser marcado como Segura o no. Defaults to false unless <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite#samesitenone_requires_secure\">Same Site=None</a> attribute is used.</li>\n<li><code>httpOnly</code> Boolean (opcional) - Si la cookie debería ser marcada como sólo HTTP. Por defecto es falso.</li>\n<li><code>expirationDate</code> Doble (opcional) - La fecha de vencimiento de la cookie como el número de segundos desde la época UNIX. Si se omite, entonces la cookie cambia a una cookie de sesión y no se conservará entre sesiones.</li>\n<li><code>sameSite</code> String (opcional) - La política del <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies\">Mismo sitio</a> para aplicar a esta cookie.  Puede ser <code>unspecified</code>, <code>no_restriction</code>, <code>lax</code> o <code>strict</code>.  Por defecto es <code>no_restriction</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Una promesa que resuelve cuando la cookie ha sido establecida</p>\n<p>Establece una cookie con <code>detalles</code>.</p>\n<h4 id=\"cookiesremoveurl-name\"><a href=\"#cookiesremoveurl-name\"><code>cookies.remove(url, name)</code></a></h4>\n<ul>\n<li><code>url</code> Cadena - La URL asociada con la cookie.</li>\n<li><code>name</code> Cadena - El nombre de la cookie que será eliminada.</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code> - Una promesa que se resuelve cuando la cookie ha sido removida</p>\n<p>Elimina las cookies que coinciden con <code>url</code> y <code>name</code></p>\n<h4 id=\"cookiesflushstore\"><a href=\"#cookiesflushstore\"><code>cookies.flushStore()</code></a></h4>\n<p>Devuelve <code>Promise&#x3C;void></code> - Una promesa que se resuelve cuando el almacenamiento de la cookie ha sido borrado</p>\n<p>Escribe cualquier dato de cookies en el disco que no haya sido escrito.</p>",
      "title": "Clase: Cookies",
      "description": "Busca y modifica las cookies de la sesión."
    },
    "/docs/api/structures/cpu-usage": {
      "locale": "es-ES",
      "slug": "cpu-usage",
      "href": "/docs/api/structures/cpu-usage",
      "crowdinFileId": "256419",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/cpu-usage.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"cpuusage-object\"><a href=\"#cpuusage-object\">CPUUsage Object</a></h1>\n<ul>\n<li><code>percentCPUUsage</code> Number - Percentage of CPU used since the last call to getCPUUsage. First call returns 0.</li>\n<li><code>idleWakeupsPerSecond</code> Number - The number of average idle CPU wakeups per second since the last call to getCPUUsage. First call returns 0. Will always return 0 on Windows.</li>\n</ul>",
      "title": "CPUUsage Object",
      "description": ""
    },
    "/docs/api/structures/crash-report": {
      "locale": "es-ES",
      "slug": "crash-report",
      "href": "/docs/api/structures/crash-report",
      "crowdinFileId": "256421",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/crash-report.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"crashreport-object\"><a href=\"#crashreport-object\">CrashReport Object</a></h1>\n<ul>\n<li><code>date</code> Date</li>\n<li><code>id</code> Cadena</li>\n</ul>",
      "title": "CrashReport Object",
      "description": ""
    },
    "/docs/api/crash-reporter": {
      "locale": "es-ES",
      "slug": "crash-reporter",
      "href": "/docs/api/crash-reporter",
      "crowdinFileId": "256303",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/crash-reporter.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"crashreporter\"><a href=\"#crashreporter\">crashReporter</a></h1>\n<blockquote>\n<p>Envía los informes de fallos a un servidor remoto.</p>\n</blockquote>\n<p>Procesos: <a href=\"/docs/glossary#main-process\">principal</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>El siguiente es un ejemplo de como configurar Electron para que envié automáticamente reportes de error a un servidor remoto:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { crashReporter } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncrashReporter.start({ <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://your-domain.com/url-to-submit'</span> })\n</code></pre>\n<p>Para configurar un servidor que acepte y procese los informes de fallos, se pueden utilizar los siguientes proyectos:</p>\n<ul>\n<li><a href=\"https://github.com/mozilla/socorro\">socorro</a></li>\n<li><a href=\"https://github.com/electron/mini-breakpad-server\">mini-breakpad-server</a></li>\n</ul>\n<p>O utilice una solución alojada por terceros:</p>\n<ul>\n<li><a href=\"https://backtrace.io/electron/\">Backtrace</a></li>\n<li><a href=\"https://docs.sentry.io/clients/electron\">Sentry</a></li>\n<li><a href=\"https://www.bugsplat.com/docs/platforms/electron\">BugSplat</a></li>\n</ul>\n<p>Los reportes de errores son almacenados temporalmente antes de ser alzados en un directorio debajo del directorio de datos del usuario (llamado 'Crashpad' en Windows y Mac o 'Crash Reports' en Linux). Puedes sobrescribir este directorio llamando a <code>app.setPath('crashDumps', '/path/to/crashes')</code> antes de iniciar al crash reporter.</p>\n<p>En Windows y macOS, Electron usa <a href=\"https://chromium.googlesource.com/crashpad/crashpad/+/master/README.md\">crashpad</a> para monitorear y reportar fallos. En Linux, Electron usa <a href=\"https://chromium.googlesource.com/breakpad/breakpad/+/master/\">breakpad</a>. Este es un detalle de implementación impulsado por Chromium y puede cambiar en el futuro. En particular, crashpad es más nuevo y es probable que eventualmente reemplace a breakpad en todas las plataformas.</p>\n<h3 id=\"note-about-node-child-processes-on-linux\"><a href=\"#note-about-node-child-processes-on-linux\">Note about Node child processes on Linux</a></h3>\n<p>If you are using the Node.js <code>child_process</code> module and want to report crashes from those processes on Linux, there is an extra step you will need to take to properly initialize the crash reporter in the child process. This is not necessary on Mac or Windows, as those platforms use Crashpad, which automatically monitors child processes.</p>\n<p>Since <code>require('electron')</code> is not available in Node child processes, the following APIs are available on the <code>process</code> object in Node child processes. Note that, on Linux, each Node child process has its own separate instance of the breakpad crash reporter. This is dissimilar to renderer child processes, which have a \"stub\" breakpad reporter which returns information to the main process for reporting.</p>\n<h4 id=\"processcrashreporterstartoptions\"><a href=\"#processcrashreporterstartoptions\"><code>process.crashReporter.start(options)</code></a></h4>\n<p>See <a href=\"#crashreporterstartoptions\"><code>crashReporter.start()</code></a>.</p>\n<h4 id=\"processcrashreportergetparameters\"><a href=\"#processcrashreportergetparameters\"><code>process.crashReporter.getParameters()</code></a></h4>\n<p>See <a href=\"#crashreportergetparameters\"><code>crashReporter.getParameters()</code></a>.</p>\n<h4 id=\"processcrashreporteraddextraparameterkey-value\"><a href=\"#processcrashreporteraddextraparameterkey-value\"><code>process.crashReporter.addExtraParameter(key, value)</code></a></h4>\n<p>See <a href=\"#crashreporteraddextraparameterkey-value\"><code>crashReporter.addExtraParameter(key, value)</code></a>.</p>\n<h4 id=\"processcrashreporterremoveextraparameterkey\"><a href=\"#processcrashreporterremoveextraparameterkey\"><code>process.crashReporter.removeExtraParameter(key)</code></a></h4>\n<p>See <a href=\"#crashreporterremoveextraparameterkey\"><code>crashReporter.removeExtraParameter(key)</code></a>.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>crashReporter</code> tiene los siguientes métodos:</p>\n<h3 id=\"crashreporterstartoptions\"><a href=\"#crashreporterstartoptions\"><code>crashReporter.start(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>submitURL</code> String (opcional) - URL a la que serán enviados los reportes de fallos como POST. Requerido a menos que <code>uploadToServer</code> sea <code>false</code>.</li>\n<li><code>productName</code> String (opcional) - Por defecto <code>app.name</code>.</li>\n<li><code>companyName</code> String (optional) <em>Deprecated</em> - Deprecated alias for <code>{ globalExtra: { _companyName: ... } }</code>.</li>\n<li><code>uploadToServer</code> Boolean (octional) - Si los reportes de fallos deberían ser enviados a un servidor. Si es false, los reportes de fallos serán recolectados y almacenados en un directorio de fallas, pero no serán subidos. Por defecto es <code>true</code>.</li>\n<li><code>ignoreSystemCrashHandler</code> Boolean (opcional) - Si es true, los fallos generados en el main process no serán reenviados al gestor de gallos del sistema. Por defecto es <code>false</code>.</li>\n<li><code>rateLimit</code> Boolean (opcional) <em>macOS</em> <em>Windows</em> - Si es true, limita el numero de fallos subidos a 1/hora. Por defecto es <code>false</code>.</li>\n<li><code>compress</code> Boolean (opcional) - Si es true, los reportes de fallos serán comprimidos y subidos con <code>Content-Encoding: gzip</code>. Por defecto es <code>true</code>.</li>\n<li><code>extra</code> Record&#x3C;String, String> (opcional) - Extra string con anotaciónes clave/valor que serán enviados junto con los reportes de fallos en el main process. Sólo se admiten valores de cadena. Los fallos generados en los procesos hijos no contendrán estos parámetros extras, para reportes de fallos generados desde los procesos hijos, llame <a href=\"#crashreporteraddextraparameterkey-value\"><code>addExtraParameter</code></a> desde el proceso hijo.</li>\n<li><code>globalExtra</code> Record&#x3C;String, String> (opcional) - Extra string con anotaciónes clave/valor que serán enviados junto con los reportes de fallos generados en cualquier proceso. Estas anotaciones no pueden ser cambiadas una vez que el crash reporter ha sido iniciado. Si una clave esta presente en los parámetros global extra y en los parámetros extra process-specific, entonces el parámetro global tomará precedencia. Por defecto, <code>productName</code> y la versión de la aplicación son incluidas, así como la versión de Electron.</li>\n</ul></li>\n</ul>\n<p>Este método debe ser llamada antes de usar cualquier otra APIs <code>crashReporter</code>. Una vez inicializado de esta manera, el crashpad handler recopila los fallos desde todos los procesos creados posteriormente. El crash reporter no puede ser desactiva una vez iniciado.</p>\n<p>Este método debería ser llamado tan pronto como sea posible al iniciar la aplicación, preferentemente antes de <code>app.on('ready')</code>. Si el crash reporter no está iniciado al tiempo que un renderer process este creado, entonces ese renderer process no será monitoreado por el crash reporter.</p>\n<p><strong>Nota:</strong> Puedes probar el crash reporter generando un fallo usando <code>process.crash()</code>.</p>\n<p><strong>Nota:</strong> Si necesitas enviar parámetros <code>extra</code> adicionales/actualizados después de tu primera llamada <code>start</code> puedes llamar a <code>addExtraParameter</code>.</p>\n<p><strong>Nota:</strong> Los parámetros pasados en <code>extra</code>, <code>globalExtra</code> o establecidos con <code>addExtraParameter</code> tienen un limite en la longitud de la llaves y los valores. Los nombre de la llaves deben ser como máximo de 39 bytes de largo, y los valores no deben ser mayor que 127 bytes. Las llaves con nombres más largo que el máximo serán ignoradas de forma silenciosa. Los valores de las llaves más largo que la longitud máxima serán truncados.</p>\n<p><strong>Nota:</strong> Este método solo está disponible en el proceso principal.</p>\n<h3 id=\"crashreportergetlastcrashreport\"><a href=\"#crashreportergetlastcrashreport\"><code>crashReporter.getLastCrashReport()</code></a></h3>\n<p>Devuelve <a href=\"/docs/api/structures/crash-report\"><code>CrashReport</code></a> - La fecha y el ID del último reporte de error. Solo los reportes de fallos que han sido alzados serán retornados; incluso si un reporte de fallo esta presente en el disco este no sera retornado a menos que este alzado. En caso de que no haya reportes subidos, <code>null</code> es retornado.</p>\n<p><strong>Nota:</strong> Este método solo está disponible en el proceso principal.</p>\n<h3 id=\"crashreportergetuploadedreports\"><a href=\"#crashreportergetuploadedreports\"><code>crashReporter.getUploadedReports()</code></a></h3>\n<p>Devuelve <a href=\"/docs/api/structures/crash-report\"><code>CrashReport []</code></a>:</p>\n<p>Returns all uploaded crash reports. Each report contains the date and uploaded ID.</p>\n<p><strong>Nota:</strong> Este método solo está disponible en el proceso principal.</p>\n<h3 id=\"crashreportergetuploadtoserver\"><a href=\"#crashreportergetuploadtoserver\"><code>crashReporter.getUploadToServer()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether reports should be submitted to the server. Set through the <code>start</code> method or <code>setUploadToServer</code>.</p>\n<p><strong>Nota:</strong> Este método solo está disponible en el proceso principal.</p>\n<h3 id=\"crashreportersetuploadtoserveruploadtoserver\"><a href=\"#crashreportersetuploadtoserveruploadtoserver\"><code>crashReporter.setUploadToServer(uploadToServer)</code></a></h3>\n<ul>\n<li><code>uploadToServer</code> Boolean - Si los reportes deben enviarse o no al servidor.</li>\n</ul>\n<p>This would normally be controlled by user preferences. This has no effect if called before <code>start</code> is called.</p>\n<p><strong>Nota:</strong> Este método solo está disponible en el proceso principal.</p>\n<h3 id=\"crashreporteraddextraparameterkey-value\"><a href=\"#crashreporteraddextraparameterkey-value\"><code>crashReporter.addExtraParameter(key, value)</code></a></h3>\n<ul>\n<li><code>key</code> String - La clave del parámetro, debe tener menos de 39 bytes.</li>\n<li><code>key</code> String - La clave del parámetro, debe tener menos de 127 bytes.</li>\n</ul>\n<p>Establecer un parámetro adicional que se enviará con el informe de fallos. Los valores especificados aquí serán enviados, adicionalmente cualquier valor establecidos a través de la opción <code>extra</code> cuando fue llamado <code>start</code>.</p>\n<p>Los parámetros agregados de esta manera (o a través del parámetro <code>extra</code> al <code>crashReporter.start</code>) son específicos del proceso de llamada. Agregar parámetros extras en el main process no causarán que esos parámetros sean enviado junto con los fallos del renderer u otros procesos hijos. De manera similar, agregar parámetros extras en un renderer process no dará como resultado que esos parámetros sean enviados con los fallos que ocurren en otros renderer processes o en el main process.</p>\n<p><strong>Nota:</strong> Los parámetros tienen límites de longitud de llaves y valores. Los nombre de la llaves deben ser como máximo de 39 bytes de largo, y los valores no deben ser mayor que 127 bytes. Las llaves con nombres más largo que el máximo serán ignoradas de forma silenciosa. Los valores de las llaves más largo que la longitud máxima serán truncados.</p>\n<p><strong>Nota:</strong> En linux los valores que son más grandes que 127 bytes se dividirá en varias claves, cada una de 127 bytes de longitud.  E.g. <code>addExtraParameter('foo', 'a'.repeat(130))</code> will result in two chunked keys <code>foo__1</code> and <code>foo__2</code>, the first will contain the first 127 bytes and the second will contain the remaining 3 bytes.  En el backend de informes de fallos, debería unir las claves en este formato.</p>\n<h3 id=\"crashreporterremoveextraparameterkey\"><a href=\"#crashreporterremoveextraparameterkey\"><code>crashReporter.removeExtraParameter(key)</code></a></h3>\n<ul>\n<li><code>key</code> String - La clave del parámetro, debe tener menos de 39 bytes.</li>\n</ul>\n<p>Remove an extra parameter from the current set of parameters. Los fallos futuros no incluirán este parámetro.</p>\n<h3 id=\"crashreportergetparameters\"><a href=\"#crashreportergetparameters\"><code>crashReporter.getParameters()</code></a></h3>\n<p>Devuelve <code>Record&#x3C;String, String></code> - Los parámetros 'extra' actuales del reportador de errores.</p>\n<h2 id=\"carga-útil-del-informe-de-fallos\"><a href=\"#carga-útil-del-informe-de-fallos\">Carga útil del informe de fallos</a></h2>\n<p>El informador de fallos enviará la siguiente información al <code>submitURL</code> como un <code>multipart/form-data</code> <code>POST</code>:</p>\n<ul>\n<li><code>ver</code> Cadena- La versión de Electron.</li>\n<li><code>platform</code> Cadena - por ejemplo, \"win32\".</li>\n<li><code>process_type</code> Cadena - por ejemplo, \"renderizador\".</li>\n<li><code>guid</code> String - por ejemplo, \"5e1286fc-da97-479e-918b-6bfb0c3d1c72\".</li>\n<li><code>_version</code> Cadena - La versión en <code>package.json</code>.</li>\n<li><code>_productName</code> Cadena - El nombre del producto en el objeto <code>crashReporter</code> <code>options</code>.</li>\n<li><code>prod</code> String - Nombre del producto subyacente. En esta caso Electron.</li>\n<li><code>_companyName</code> Cadena - El nombre de la empresa en el objeto <code>crashReporter</code> <code>options</code>.</li>\n<li><code>upload_file_minidump</code> Archivo - El informe de fallos en el formato de <code>minidump</code>.</li>\n<li>Todas las propiedades de nivel uno del objeto <code>extra</code> en el objeto <code>crashReporter</code> <code>options</code>.</li>\n</ul>",
      "title": "crashReporter",
      "description": "Envía los informes de fallos a un servidor remoto."
    },
    "/docs/api/structures/custom-scheme": {
      "locale": "es-ES",
      "slug": "custom-scheme",
      "href": "/docs/api/structures/custom-scheme",
      "crowdinFileId": "256423",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/custom-scheme.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"customscheme-object\"><a href=\"#customscheme-object\">CustomScheme Object</a></h1>\n<ul>\n<li><code>scheme</code> String - Custom schemes to be registered with options.</li>\n<li><code>privileges</code> Object (optional)<ul>\n<li><code>standard</code> Boolean (optional) - Default false.</li>\n<li><code>secure</code> Boolean (optional) - Default false.</li>\n<li><code>bypassCSP</code> Boolean (optional) - Default false.</li>\n<li><code>allowServiceWorkers</code> Boolean (optional) - Default false.</li>\n<li><code>supportFetchAPI</code> Boolean (optional) - Default false.</li>\n<li><code>corsEnabled</code> Boolean (optional) - Default false.</li>\n<li><code>stream</code> Boolean (optional) - Default false.</li>\n</ul></li>\n</ul>",
      "title": "CustomScheme Object",
      "description": ""
    },
    "/docs/tutorial/dark-mode": {
      "locale": "es-ES",
      "slug": "dark-mode",
      "href": "/docs/tutorial/dark-mode",
      "crowdinFileId": "256187",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/dark-mode.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"modo-oscuro\"><a href=\"#modo-oscuro\">Modo oscuro</a></h1>\n<h2 id=\"descripción-general\"><a href=\"#descripción-general\">Descripción general</a></h2>\n<h3 id=\"actualizar-automáticamente-las-interfaces-nativas\"><a href=\"#actualizar-automáticamente-las-interfaces-nativas\">Actualizar automáticamente las interfaces nativas</a></h3>\n<p>\"Native interfaces\" include the file picker, window border, dialogs, context menus, and more - anything where the UI comes from your operating system and not from your app. The default behavior is to opt into this automatic theming from the OS.</p>\n<h3 id=\"automatically-update-your-own-interfaces\"><a href=\"#automatically-update-your-own-interfaces\">Automatically update your own interfaces</a></h3>\n<p>If your app has its own dark mode, you should toggle it on and off in sync with the system's dark mode setting. You can do this by using the [prefer-color-scheme] CSS media query.</p>\n<h3 id=\"manually-update-your-own-interfaces\"><a href=\"#manually-update-your-own-interfaces\">Manually update your own interfaces</a></h3>\n<p>Si quieres cambiar manualmente entre los modos light/dark, puedes hacerlo configurando el modo deseado en la propiedad <a href=\"/docs/api/native-theme#nativethemethemesource\">themeSource</a> del módulo <code>nativeTheme</code>. This property's value will be propagated to your Renderer process. Any CSS rules related to <code>prefers-color-scheme</code> will be updated accordingly.</p>\n<h2 id=\"configuraciones-macos\"><a href=\"#configuraciones-macos\">configuraciones macOS</a></h2>\n<p>En macOS 10.14 Mojave, Apple introdujo un nuevo modo oscuro <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/dark-mode/\">para todo el sistema</a> en sus ordenadores macOS. If your Electron app has a dark mode, you can make it follow the system-wide dark mode setting using <a href=\"/docs/api/native-theme\">the <code>nativeTheme</code> api</a>.</p>\n<p>In macOS 10.15 Catalina, Apple introduced a new \"automatic\" dark mode option for all macOS computers. In order for the <code>nativeTheme.shouldUseDarkColors</code> and <code>Tray</code> APIs to work correctly in this mode on Catalina, you need to use Electron <code>>=7.0.0</code>, or set <code>NSRequiresAquaSystemAppearance</code> to <code>false</code> in your <code>Info.plist</code> file for older versions. Both <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a> and <a href=\"https://www.electronforge.io/\">Electron Forge</a> have a <a href=\"https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html#darwindarkmodesupport\"><code>darwinDarkModeSupport</code> option</a> to automate the <code>Info.plist</code> changes during app build time.</p>\n<p>If you wish to opt-out while using Electron > 8.0.0, you must set the <code>NSRequiresAquaSystemAppearance</code> key in the <code>Info.plist</code> file to <code>true</code>. Please note that Electron 8.0.0 and above will not let you opt-out of this theming, due to the use of the macOS 10.14 SDK.</p>\n<h2 id=\"ejemplo\"><a href=\"#ejemplo\">Ejemplo</a></h2>\n<p>This example demonstrates an Electron application that derives its theme colors from the <code>nativeTheme</code>. Additionally, it provides theme toggle and reset controls using IPC channels.</p>\n<h3 id=\"how-does-this-work\"><a href=\"#how-does-this-work\">How does this work?</a></h3>\n<p>Starting with the <code>index.html</code> file:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"script-src 'self' 'unsafe-inline';\"</span> /></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/css\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"./styles.css\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">p</span>></span>Current theme source: <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">strong</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"theme-source\"</span>></span>System<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">strong</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">p</span>></span>\n\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"toggle-dark-mode\"</span>></span>Toggle Dark Mode<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">button</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"reset-to-system\"</span>></span>Reset to System Theme<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">button</span>></span>\n\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>And the <code>styles.css</code> file:</p>\n<pre><code class=\"hljs language-css\">@<span class=\"hljs-keyword\">media</span> (prefers-color-scheme: dark) {\n  <span class=\"hljs-selector-tag\">body</span> { <span class=\"hljs-attribute\">background</span>: <span class=\"hljs-number\">#333</span>; <span class=\"hljs-attribute\">color</span>: white; }\n}\n\n@<span class=\"hljs-keyword\">media</span> (prefers-color-scheme: light) {\n  <span class=\"hljs-selector-tag\">body</span> { <span class=\"hljs-attribute\">background</span>: <span class=\"hljs-number\">#ddd</span>; <span class=\"hljs-attribute\">color</span>: black; }\n}\n</code></pre>\n<p>The example renders an HTML page with a couple elements. The <code>&#x3C;strong id=\"theme-source\"></code> element shows which theme is currently selected, and the two <code>&#x3C;button></code> elements are the controls. The CSS file uses the <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> media query to set the <code>&#x3C;body></code> element background and text colors.</p>\n<p>The <code>preload.js</code> script adds a new API to the <code>window</code> object called <code>darkMode</code>. Esta API expone dos canales IPC al proceso renderizador, <code>'dark-mode:toggle'</code> y <code>'dark-mode:system'</code>. It also assigns two methods, <code>toggle</code> and <code>system</code>, which pass messages from the renderer to the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'darkMode'</span>, {\n  <span class=\"hljs-attr\">toggle</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'dark-mode:toggle'</span>),\n  <span class=\"hljs-attr\">system</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'dark-mode:system'</span>)\n})\n</code></pre>\n<p>Now the renderer process can communicate with the main process securely and perform the necessary mutations to the <code>nativeTheme</code> object.</p>\n<p>The <code>renderer.js</code> file is responsible for controlling the <code>&#x3C;button></code> functionality.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'toggle-dark-mode'</span>).addEventListener(<span class=\"hljs-string\">'click'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> isDarkMode = <span class=\"hljs-keyword\">await</span> <span class=\"hljs-built_in\">window</span>.darkMode.toggle()\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'theme-source'</span>).innerHTML = isDarkMode ? <span class=\"hljs-string\">'Dark'</span> : <span class=\"hljs-string\">'Light'</span>\n})\n\n<span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'reset-to-system'</span>).addEventListener(<span class=\"hljs-string\">'click'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> <span class=\"hljs-built_in\">window</span>.darkMode.system()\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'theme-source'</span>).innerHTML = <span class=\"hljs-string\">'System'</span>\n})\n</code></pre>\n<p>Using <code>addEventListener</code>, the <code>renderer.js</code> file adds <code>'click'</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\">event listeners</a> to each button element. Each event listener handler makes calls to the respective <code>window.darkMode</code> API methods.</p>\n<p>Finally, the <code>main.js</code> file represents the main process and contains the actual <code>nativeTheme</code> API.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, ipcMain, nativeTheme } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  ipcMain.handle(<span class=\"hljs-string\">'dark-mode:toggle'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (nativeTheme.shouldUseDarkColors) {\n      nativeTheme.themeSource = <span class=\"hljs-string\">'light'</span>\n    } <span class=\"hljs-keyword\">else</span> {\n      nativeTheme.themeSource = <span class=\"hljs-string\">'dark'</span>\n    }\n    <span class=\"hljs-keyword\">return</span> nativeTheme.shouldUseDarkColors\n  })\n\n  ipcMain.handle(<span class=\"hljs-string\">'dark-mode:system'</span>, () => {\n    nativeTheme.themeSource = <span class=\"hljs-string\">'system'</span>\n  })\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n      createWindow()\n    }\n  })\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n</code></pre>\n<p>The <code>ipcMain.handle</code> methods are how the main process responds to the click events from the buttons on the HTML page.</p>\n<p>The <code>'dark-mode:toggle'</code> IPC channel handler method checks the <code>shouldUseDarkColors</code> boolean property, sets the corresponding <code>themeSource</code>, and then returns the current <code>shouldUseDarkColors</code> property. Looking back on the renderer process event listener for this IPC channel, the return value from this handler is utilized to assign the correct text to the <code>&#x3C;strong id='theme-source'></code> element.</p>\n<p>The <code>'dark-mode:system'</code> IPC channel handler method assigns the string <code>'system'</code> to the <code>themeSource</code> and returns nothing. This also corresponds with the relative renderer process event listener as the method is awaited with no return value expected.</p>\n<p>Run the example using Electron Fiddle and then click the \"Toggle Dark Mode\" button; the app should start alternating between a light and dark background color.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/dark_mode.gif\" alt=\"Modo oscuro\"></p>",
      "title": "Modo oscuro",
      "description": ""
    },
    "/docs/development/debug-instructions-windows": {
      "locale": "es-ES",
      "slug": "debug-instructions-windows",
      "href": "/docs/development/debug-instructions-windows",
      "crowdinFileId": "256149",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debug-instructions-windows.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"depuración-en-windows\"><a href=\"#depuración-en-windows\">Depuración en Windows</a></h1>\n<p>Si usted tiene bloqueos o problemas en Electron que cree que no son causados ​​por la aplicación de JavaScript, sino por Electron, la depuración puede ser un poco difícil, especialmente para desarrolladores que no están acostumbrados a la depuración nativa/C++. Sin embargo, usando Visual Studio, el servidor de símbolos de Electron y el código fuente de Electron, puede habilitar la depuración paso a paso con puntos de ruptura dentro de código fuente de Electron.</p>\n<p><strong>Vea también</strong>: hay una gran cantidad de información sobre la depuración de Chromium, mucha de la cual también se aplica a Electron, en el sitio de desarrolladores de Chromium: <a href=\"https://www.chromium.org/developers/how-tos/debugging-on-windows\">Debugging Chromium on Windows</a>.</p>\n<h2 id=\"requisitos\"><a href=\"#requisitos\">Requisitos</a></h2>\n<ul>\n<li>\n<p><strong>Construir una depuración de Electron</strong>: la forma más fácil es usualmente que usted mismo lo construya, utilizando las herramientas y los requisitos previos enumerados en <a href=\"/docs/development/build-instructions-windows\">instrucciones de compilación para Windows</a>. Aunque puede adjuntar y depurar Electrón a medida que lo descarga directamente, encontrará que está muy optimizado, lo que dificulta considerablemente la depuración: el depurador no podrá mostrarle el contenido de todas las variables y la ruta de ejecución puede parecer extraña debido a las llamadas en línea, las llamadas de cola y otras optimizaciones del compilador.</p>\n</li>\n<li>\n<p><strong>Visual Studio con herramientas de C++</strong>: las ediciones de la comunidad gratuitas de Visual Studio 2013 y 2015 funcionan. Una vez instalado, <a href=\"/docs/development/setting-up-symbol-server\">configure Visual Studio to use Electron's Symbol server</a>. Le permitirá a Visual Studio obtener una mejor comprensión de lo que sucede dentro de Electron, haciendo que sea más fácil presentar las variables en un formato de lectura.</p>\n</li>\n<li>\n<p><strong>ProcMon</strong>: la <a href=\"https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx\">herramienta gratuita SysInternals</a> le permite inspeccionar los parámetros de los procesos, los manejadores de archivos y las operaciones de registro.</p>\n</li>\n</ul>\n<h2 id=\"a-y-depuración-electron\"><a href=\"#a-y-depuración-electron\">A y depuración Electron</a></h2>\n<p>Para iniciar una sesión de depuración, abra PowerShell/CMD y ejecute su versión de depuración de Electron, usando la aplicación para abrir como parámetro.</p>\n<pre><code class=\"hljs language-powershell\">$ ./out/Debug/electron.exe ~/my-electron-app/\n</code></pre>\n<h3 id=\"establecer-puntos-de-interrupción\"><a href=\"#establecer-puntos-de-interrupción\">Establecer puntos de interrupción</a></h3>\n<p>Luego, abre Visual Studio. Electron no está construido con Visual Studio y, por lo tanto, no contiene un archivo de proyecto - sin embargo, usted puede abrir los archivos de código fuente \"Como archivo\", lo que significa que Visual Studio los abrirá por sí mismo. Usted puede todavía establecer puntos de interrupción - Visual Studio automáticamente descifrará que el código fuente coincide con el código que se ejecuta en el proceso adjunto y se romperá en consecuencia.</p>\n<p>Relevant code files can be found in <code>./shell/</code>.</p>\n<h3 id=\"adjuntado\"><a href=\"#adjuntado\">Adjuntado</a></h3>\n<p>Usted puede conectar el depurador de Visual Studio a un proceso en ejecución en una computadora local o remota. Después de que se esté ejecutando el proceso, haga clic en Depurar / Adjuntar al proceso (o presione <code>CTRL+ALT+P</code>) para abrir el cuadro de diálogo \"Adjuntar al proceso\". Usted puede usar esta capacidad para depurar aplicaciones que se ejecutan en una computadora local o remota, depurará múltiples procesos simultáneamente.</p>\n<p>Si Electron se ejecuta con una cuenta de usuario diferente, seleccione <code>mostrar procesos de todos los usuarios</code> en la casilla. Tenga en cuenta que dependiendo de cuántos BrowserWindows su aplicación tenga abiertos, verá múltiples procesos. Una típica aplicación de una ventana dará como resultado que Visual Studio le presente dos entradas <code>Electron.exe</code>: una para el proceso principal y otra para el proceso renderizado. Dado que la lista solo le da nombres, actualmente no hay una forma confiable de descubrir cuál es cuál.</p>\n<h3 id=\"¿a-qué-proceso-debo-adjuntarme\"><a href=\"#¿a-qué-proceso-debo-adjuntarme\">¿A qué proceso debo adjuntarme?</a></h3>\n<p>Código ejecutado dentro del proceso principal (es decir, código encontrado en o eventualmente ejecutado por su archivo JavaScript principal) se ejecutara dentro del proceso principal, mientras que otro código se ejecutara dentro de su respectivo proceso renderer.</p>\n<p>Puede estar conectado a varios programas cuando se está depurando, pero solamente un programa está activo en el depurador en cualquier momento. Puedes configurar el programa activo en la barra de herramientas <code>Ubicación de depuración</code> o en la <code>ventana de procesos</code>.</p>\n<h2 id=\"usando-procmon-para-observar-un-proceso\"><a href=\"#usando-procmon-para-observar-un-proceso\">Usando ProcMon para Observar un Proceso</a></h2>\n<p>Mientras que Visual Studio es fantástico para inspeccionar rutas de código específicas, la fortaleza de ProcMon está realmente en observar todo lo que su aplicación está haciendo con el sistema operativo: captura los detalles de archivo, registro, red, proceso y perfil detallado de los procesos. Intenta registrar <strong>todos</strong> los eventos que se producen y puede ser bastante abrumador, pero si intenta comprender qué y cómo está trabajando su aplicación en el sistema operativo, puede ser un recurso valioso.</p>\n<p>Para obtener una introducción a las funciones de depuración básicas y avanzadas de ProcMon, consulte el video proveído por Microsoft <a href=\"https://channel9.msdn.com/shows/defrag-tools/defrag-tools-4-process-monitor\">this video tutorial</a>.</p>",
      "title": "Depuración en Windows",
      "description": ""
    },
    "/docs/api/debugger": {
      "locale": "es-ES",
      "slug": "debugger",
      "href": "/docs/api/debugger",
      "crowdinFileId": "256305",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/debugger.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-debugger\"><a href=\"#clase-debugger\">Clase: Debugger</a></h2>\n<blockquote>\n<p>Un transporte alternativo para el protocolo de depuración remoto de Chrome.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Las herramientas para desarrolladores de Chrome tiene un <a href=\"https://chromedevtools.github.io/devtools-protocol/\">special binding</a> disponible en JavaScript runtime que permite interactuar con las páginas y equiparlas.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-keyword\">try</span> {\n  win.webContents.debugger.attach(<span class=\"hljs-string\">'1.1'</span>)\n} <span class=\"hljs-keyword\">catch</span> (err) {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Debugger attach failed : '</span>, err)\n}\n\nwin.webContents.debugger.on(<span class=\"hljs-string\">'detach'</span>, (event, reason) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Debugger detached due to : '</span>, reason)\n})\n\nwin.webContents.debugger.on(<span class=\"hljs-string\">'message'</span>, (event, method, params) => {\n  <span class=\"hljs-keyword\">if</span> (method === <span class=\"hljs-string\">'Network.requestWillBeSent'</span>) {\n    <span class=\"hljs-keyword\">if</span> (params.request.url === <span class=\"hljs-string\">'https://www.github.com'</span>) {\n      win.webContents.debugger.detach()\n    }\n  }\n})\n\nwin.webContents.debugger.sendCommand(<span class=\"hljs-string\">'Network.enable'</span>)\n</code></pre>\n<h3 id=\"eventos-de-instancia\"><a href=\"#eventos-de-instancia\">Eventos de Instancia</a></h3>\n<h4 id=\"evento-detach\"><a href=\"#evento-detach\">Evento: 'detach'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>reason</code> Cadena - Razón para desasociar el depurador.</li>\n</ul>\n<p>Emitido cuando la sesión de depuración es terminada. Esto ocurre cuando <code>webContents</code> es cerrado o el devtools es invocado para el <code>webContents</code> adjunto.</p>\n<h4 id=\"evento-message\"><a href=\"#evento-message\">Evento: 'message'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>method</code> Cadena- Nombre del método.</li>\n<li><code>params</code> any - Event parameters defined by the 'parameters' attribute in the remote debugging protocol.</li>\n<li><code>sessionId</code> String - Unique identifier of attached debugging session, will match the value sent from <code>debugger.sendCommand</code>.</li>\n</ul>\n<p>Emitido cada vez que el objetivo de depuración emite un evento de instrumentación.</p>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<h4 id=\"debuggerattachprotocolversion\"><a href=\"#debuggerattachprotocolversion\"><code>debugger.attach([protocolVersion])</code></a></h4>\n<ul>\n<li><code>protocolVersion</code> Cadena (opcional) - Versión solicitada del protocolo de depuración.</li>\n</ul>\n<p>Adjunta el depurador al <code>webContents</code>.</p>\n<h4 id=\"debuggerisattached\"><a href=\"#debuggerisattached\"><code>debugger.isAttached()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si un depurador se adjunta o no a la <code>webContents</code>.</p>\n<h4 id=\"debuggerdetach\"><a href=\"#debuggerdetach\"><code>debugger.detach()</code></a></h4>\n<p>Desasocia el depurador de la <code>webContents</code>.</p>\n<h4 id=\"debuggersendcommandmethod-commandparams-sessionid\"><a href=\"#debuggersendcommandmethod-commandparams-sessionid\"><code>debugger.sendCommand(method[, commandParams, sessionId])</code></a></h4>\n<ul>\n<li><code>method</code> String - Method name, should be one of the methods defined by the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">remote debugging protocol</a>.</li>\n<li><code>commandParams</code> any (opcional) - Objeto JSON con parámetros de la solicitud.</li>\n<li><code>sessionId</code> String (optional) - send command to the target with associated debugging session id. The initial value can be obtained by sending <a href=\"https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-attachToTarget\">Target.attachToTarget</a> message.</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;any></code> - Una promesa que resuelve con la respuesta definida por el atributo 'returns' del comando de descripción en el protocolo de depuración remoto o es rechazada indicando el fallo del comando.</p>\n<p>Envía el comando al objetivo de la depuración.</p>",
      "title": "Clase: Debugger",
      "description": "Un transporte alternativo para el protocolo de depuración remoto de Chrome."
    },
    "/docs/development/debugging-instructions-macos": {
      "locale": "es-ES",
      "slug": "debugging-instructions-macos",
      "href": "/docs/development/debugging-instructions-macos",
      "crowdinFileId": "256153",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debugging-instructions-macos.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"depuración-en-macos\"><a href=\"#depuración-en-macos\">Depuración en macOS</a></h1>\n<p>Si usted tiene bloqueos o problemas en Electron que cree que no son causados ​​por la aplicación de JavaScript, sino por Electron, la depuración puede ser un poco difícil, especialmente para desarrolladores que no están acostumbrados a la depuración nativa/C++. Sin embargo, usando lldb y el código fuente de Electron, puede habilitar la depuración paso a paso con puntos de interrupción dentro del código fuente de Electron. También puede usar <a href=\"/docs/development/debugging-instructions-macos-xcode\">XCode for debugging</a> si prefiere una interfaz gráfica.</p>\n<h2 id=\"requisitos\"><a href=\"#requisitos\">Requisitos</a></h2>\n<ul>\n<li>\n<p><strong>Construcción de una depuración de Electron</strong>: La manera más fácil usualmente es construirlo usted mismo, usando las herramientas y prerrequisitos especificados en el <a href=\"/docs/development/build-instructions-macos\">Instrucciones de construcción para macOS</a>. Aunque puede adjuntar y depurar Electrón a medida que lo descarga directamente, encontrará que está muy optimizado, lo que dificulta considerablemente la depuración: el depurador no podrá mostrarle el contenido de todas las variables y la ruta de ejecución puede parecer extraña debido a las llamadas en línea, las llamadas de cola y otras optimizaciones del compilador.</p>\n</li>\n<li>\n<p><strong>Código X</strong>: adicional al código X, también instala las herramientas del comando de linea de este. Incluyen LLDB, el depurador predeterminado en Xcode en macOS. Admite depuración de C, Objective-C y C++ en el escritorio y los dispositivos y simuladores iOS.</p>\n</li>\n<li>\n<p><strong>.lldbinit</strong>: Crear o editar <code>~/.lldbinit</code> para permitir que el código de Chromium sea correctamente mapeado de fuentes.</p>\n<pre><code class=\"hljs language-plaintext\"># p. ej.: [' ~/electron/src/tools/lldb ']\nscript sys. Path [: 0] = ['&#x3C;... path/to/electron/src/tools/lldb>']\nscript import lldbinit\n</code></pre>\n</li>\n</ul>\n<h2 id=\"a-y-depuración-electron\"><a href=\"#a-y-depuración-electron\">A y depuración Electron</a></h2>\n<p>Para empezar una sesión de depuración, abra el terminal e inicie <code>lldb</code>, pasando al constructo de depuración de Electron como un parámetro.</p>\n<pre><code class=\"hljs language-sh\">$ lldb ./out/Testing/Electron.app\n(lldb) target create <span class=\"hljs-string\">\"./out/Testing/Electron.app\"</span>\nCurrent executable <span class=\"hljs-built_in\">set</span> to <span class=\"hljs-string\">'./out/Testing/Electron.app'</span> (x86_64).\n</code></pre>\n<h3 id=\"establecer-puntos-de-interrupción\"><a href=\"#establecer-puntos-de-interrupción\">Establecer puntos de interrupción</a></h3>\n<p>LLDB es una herramienta poderosa y soporta múltiples estrategias para la inspección de código. Para esta instrucción básica, asumamos que está llamando un comando para JavaScript que no se está comportando correctamente - así que a usted le gustaría separarlo en la contraparte de esos comandos en C++ dentro de la fuente Electron.</p>\n<p>Relevant code files can be found in <code>./shell/</code>.</p>\n<p>Asumamos que quiere depurar <code>app.setName()</code>, el cual está definido en <code>browser.cc</code> como <code>Browser::SetName()</code>. Configure un punto de separación usando el comando <code>breakpoint</code>, especificando el archivo y la linea que quiere separar:</p>\n<pre><code class=\"hljs language-sh\">(lldb) breakpoint <span class=\"hljs-built_in\">set</span> --file browser.cc --line 117\nBreakpoint 1: <span class=\"hljs-built_in\">where</span> = Electron Framework`atom::Browser::SetName(std::__1::basic_string&#x3C;char, std::__1::char_traits&#x3C;char>, std::__1::allocator&#x3C;char> > const&#x26;) + 20 at browser.cc:118, address = 0x000000000015fdb4\n</code></pre>\n<p>Luego, inicie Electron:</p>\n<pre><code class=\"hljs language-sh\">(lldb) run\n</code></pre>\n<p>La aplicación será pausada inmediatamente, mientras Electron configura el nombre de esta en el lanzador:</p>\n<pre><code class=\"hljs language-sh\">(lldb) run\nProcess 25244 launched: <span class=\"hljs-string\">'/Users/fr/Code/electron/out/Testing/Electron.app/Contents/MacOS/Electron'</span> (x86_64)\nProcess 25244 stopped\n* thread <span class=\"hljs-comment\">#1: tid = 0x839a4c, 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 20 at browser.cc:118, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1</span>\n    frame <span class=\"hljs-comment\">#0: 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 20 at browser.cc:118</span>\n   115  }\n   116\n   117  void Browser::SetName(const std::string&#x26; name) {\n-> 118    name_override_ = name;\n   119  }\n   120\n   121  int Browser::<span class=\"hljs-function\"><span class=\"hljs-title\">GetBadgeCount</span></span>() {\n(lldb)\n</code></pre>\n<p>Para mostrar los argumentos y las variables locales para la estructura actual, corra <code>variable de estructura</code> (o <code>fr v</code>), que le mostrará que la aplicación está siendo configurada con el nombre de \"Electron\".</p>\n<pre><code class=\"hljs language-sh\">(lldb) frame variable\n(atom::Browser *) this = 0x0000000108b14f20\n(const string &#x26;) name = <span class=\"hljs-string\">\"Electron\"</span>: {\n    [...]\n}\n</code></pre>\n<p>Para hacer un solo paso en el nivel de la fuente en el hilo seleccionado, ejecute <code>paso</code> (o <code>s</code>). Esto lo llevará dentro de <code>name_override_.empty()</code>. Para proceder y dar otro paso, corra <code>siguiente</code> (o <code>n</code>).</p>\n<pre><code class=\"hljs language-sh\">(lldb) step\nProcess 25244 stopped\n* thread <span class=\"hljs-comment\">#1: tid = 0x839a4c, 0x0000000100162dcc Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 44 at browser.cc:119, queue = 'com.apple.main-thread', stop reason = step in</span>\n    frame <span class=\"hljs-comment\">#0: 0x0000000100162dcc Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 44 at browser.cc:119</span>\n   116\n   117  void Browser::SetName(const std::string&#x26; name) {\n   118    name_override_ = name;\n-> 119  }\n   120\n   121  int Browser::<span class=\"hljs-function\"><span class=\"hljs-title\">GetBadgeCount</span></span>() {\n   122    <span class=\"hljs-built_in\">return</span> badge_count_;\n</code></pre>\n<p><strong>NOTA:</strong> Si no ves el código fuente cuando crees que deberías, es posible que no hayas añadido el archivo <code>~/.lldbinit</code> anterior.</p>\n<p>Para finalizar la depuración en este punto, corra <code>continuar proceso</code>. También puede continuar hasta cierta linea es tocada en este hilo (<code>hilo hasta 100</code>). Este comando correrá el hilo en la estructura actual hasta que alcance la linea 100 en este, o se detiene si deja la estructura en la que se encuentra.</p>\n<p>Ahora, si abre las herramientas para desarrolladores y llama <code>setName</code>, alcanzará de nuevo el punto de interrupción.</p>\n<h3 id=\"leer-más\"><a href=\"#leer-más\">Leer más</a></h3>\n<p>LLDB es una herramienta poderosa con una gran documentación. Para aprender más sobre esto, considera leer la documentación sobre la depuración de Apple, como <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-basics.html#//apple_ref/doc/uid/TP40012917-CH2-SW2\">LLDB Command Structure Reference</a> o la introducción de <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-terminal-workflow-tutorial.html\">Using LLDB as a Standalone Debugger</a>.</p>\n<p>You can also check out LLDB's fantastic <a href=\"https://lldb.llvm.org/tutorial.html\">manual and tutorial</a>, which will explain more complex debugging scenarios.</p>",
      "title": "Depuración en macOS",
      "description": ""
    },
    "/docs/development/debugging-instructions-macos-xcode": {
      "locale": "es-ES",
      "slug": "debugging-instructions-macos-xcode",
      "href": "/docs/development/debugging-instructions-macos-xcode",
      "crowdinFileId": "256151",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debugging-instructions-macos-xcode.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h2 id=\"depurar-con-xcode\"><a href=\"#depurar-con-xcode\">Depurar con XCode</a></h2>\n<h3 id=\"generar-proyecto-xcode-para-fuentes-de-depuración-no-puede-construir-código-desde-xcode\"><a href=\"#generar-proyecto-xcode-para-fuentes-de-depuración-no-puede-construir-código-desde-xcode\">Generar proyecto xcode para fuentes de depuración (no puede construir código desde xcode)</a></h3>\n<p>Ejecutar <code>gn gen</code> con el argumento --ide=xcode.</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --ide=xcode\n</code></pre>\n<p>Esto generará el electron.ninja.xcworkspace. Tendrás que abrir este espacio de trabajo para establecer puntos de interrupción e inspeccionar.</p>\n<p>Vea <code>gn help gen</code> para más información sobre la generación de proyectos IDE con GN.</p>\n<h3 id=\"depuración-y-puntos-de-interrupción\"><a href=\"#depuración-y-puntos-de-interrupción\">Depuración y puntos de interrupción</a></h3>\n<p>Inicia la aplicación Electron después de construir. You can now open the xcode workspace created above and attach to the Electron process through the Debug > Attach To Process > Electron debug menu. [Nota: Si usted quiere depurar el proceso renderizador, necesita adjuntar al Helper de Electron también.]</p>\n<p>Ahora puede establecer puntos de interrupción en cualquiera de los archivos indexados. Sin embargo, no podrás establecer puntos de interrupción directamente en la fuente Chromium. To set break points in the Chromium source, you can choose Debug > Breakpoints > Create Symbolic Breakpoint and set any function name as the symbol. Esto establecerá el punto de interrupción para todas las funciones con ese nombre, de todas las clases si hay más de una. También puedes hacer este paso de establecer puntos de interrupción antes de adjuntar el depurador, sin embargo, los puntos de interrupción reales para funciones simbólicas de punto de interrupción pueden no aparecer hasta que el depurador esté adjuntado a la aplicación.</p>",
      "title": "Depurar con XCode",
      "description": ""
    },
    "/docs/tutorial/debugging-main-process": {
      "locale": "es-ES",
      "slug": "debugging-main-process",
      "href": "/docs/tutorial/debugging-main-process",
      "crowdinFileId": "256189",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/debugging-main-process.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"depuración-del-proceso-principal\"><a href=\"#depuración-del-proceso-principal\">Depuración del proceso principal</a></h1>\n<p>DevTools en una ventana del navegador Electron solo puede depurar JavaScript ejecutado en esa ventana (es decir, las páginas web). Para depurar JavaScript que es ejecutado en el proceso principal, se necesita utilizar un depurador externo y ejecutar Electron con el switch <code>--inspect</code> o <code>--inspect-brk</code>.</p>\n<h2 id=\"conmutadores-de-línea-de-comando\"><a href=\"#conmutadores-de-línea-de-comando\">Conmutadores de línea de comando</a></h2>\n<p>Use uno de los siguientes interruptores de línea de comando para habilitar la depuración del proceso principal:</p>\n<h3 id=\"--inspectport\"><a href=\"#--inspectport\"><code>--inspect=[port]</code></a></h3>\n<p>Electron will listen for V8 inspector protocol messages on the specified <code>port</code>, an external debugger will need to connect on this port. The default <code>port</code> is <code>5858</code>.</p>\n<pre><code class=\"hljs language-shell\">electron --inspect=5858 your/app\n</code></pre>\n<h3 id=\"--inspect-brkport\"><a href=\"#--inspect-brkport\"><code>--inspect-brk=[port]</code></a></h3>\n<p>Como <code>--inspect</code> pero pausa la ejecución en la primera línea de JavaScript.</p>\n<h2 id=\"depuradores-externos\"><a href=\"#depuradores-externos\">Depuradores externos</a></h2>\n<p>Tendrá que usar un depurador que admita el protocolo de inspector V8.</p>\n<ul>\n<li>Conecta a Chrome visitando <code>chrome://inspect</code> y selecciona inspeccionar en la aplicación de Electron ejecutada allí presente.</li>\n<li><a href=\"/docs/tutorial/debugging-vscode\">Depurando en VSCode</a></li>\n</ul>",
      "title": "Depuración del proceso principal",
      "description": ""
    },
    "/docs/tutorial/debugging-vscode": {
      "locale": "es-ES",
      "slug": "debugging-vscode",
      "href": "/docs/tutorial/debugging-vscode",
      "crowdinFileId": "256191",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/debugging-vscode.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"depurando-en-vscode\"><a href=\"#depurando-en-vscode\">Depurando en VSCode</a></h1>\n<p>This guide goes over how to set up VSCode debugging for both your own Electron project as well as the native Electron codebase.</p>\n<h2 id=\"debugging-your-electron-app\"><a href=\"#debugging-your-electron-app\">Debugging your Electron app</a></h2>\n<h3 id=\"proceso-principal\"><a href=\"#proceso-principal\">Proceso principal</a></h3>\n<h4 id=\"1-open-an-electron-project-in-vscode\"><a href=\"#1-open-an-electron-project-in-vscode\">1. Open an Electron project in VSCode.</a></h4>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:electron/electron-quick-start.git\n$ code electron-quick-start\n</code></pre>\n<h4 id=\"2-añadir-un-archivo-vscodelaunchjson-con-la-siguiente-configuración\"><a href=\"#2-añadir-un-archivo-vscodelaunchjson-con-la-siguiente-configuración\">2. Añadir un archivo <code>.vscode/launch.json</code> con la siguiente configuración:</a></h4>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.2.0\"</span>,\n  <span class=\"hljs-attr\">\"configurations\"</span>: [\n    {\n      <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"Debug Main Process\"</span>,\n      <span class=\"hljs-attr\">\"type\"</span>: <span class=\"hljs-string\">\"node\"</span>,\n      <span class=\"hljs-attr\">\"request\"</span>: <span class=\"hljs-string\">\"launch\"</span>,\n      <span class=\"hljs-attr\">\"cwd\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      <span class=\"hljs-attr\">\"runtimeExecutable\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}/node_modules/.bin/electron\"</span>,\n      <span class=\"hljs-attr\">\"windows\"</span>: {\n        <span class=\"hljs-attr\">\"runtimeExecutable\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}/node_modules/.bin/electron.cmd\"</span>\n      },\n      <span class=\"hljs-attr\">\"args\"</span> : [<span class=\"hljs-string\">\".\"</span>],\n      <span class=\"hljs-attr\">\"outputCapture\"</span>: <span class=\"hljs-string\">\"std\"</span>\n    }\n  ]\n}\n</code></pre>\n<h4 id=\"3-depuración\"><a href=\"#3-depuración\">3. Depuración</a></h4>\n<p>Set some breakpoints in <code>main.js</code>, and start debugging in the <a href=\"https://code.visualstudio.com/docs/editor/debugging\">Debug View</a>. You should be able to hit the breakpoints.</p>\n<p>Aquí hay un proyecto preconfigurado que puede descargar y depurar directamente en VSCode: <a href=\"https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start\">https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start</a></p>\n<h2 id=\"depurando-el-código-base-de-electron\"><a href=\"#depurando-el-código-base-de-electron\">Depurando el código base de Electron</a></h2>\n<p>If you want to build Electron from source and modify the native Electron codebase, this section will help you in testing your modifications.</p>\n<p>For those unsure where to acquire this code or how to build it, <a href=\"https://github.com/electron/build-tools\">Electron's Build Tools</a> automates and explains most of this process. Si desea establecer el entorno manualmente, en su lugar puede utilizar estas <a href=\"/docs/development/build-instructions-gn\">build instructions</a>.</p>\n<h3 id=\"windows-c\"><a href=\"#windows-c\">Windows (C++)</a></h3>\n<h4 id=\"1-open-an-electron-project-in-vscode-1\"><a href=\"#1-open-an-electron-project-in-vscode-1\">1. Open an Electron project in VSCode.</a></h4>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:electron/electron-quick-start.git\n$ code electron-quick-start\n</code></pre>\n<h4 id=\"2-añadir-un-archivo-vscodelaunchjson-con-la-siguiente-configuración-1\"><a href=\"#2-añadir-un-archivo-vscodelaunchjson-con-la-siguiente-configuración-1\">2. Añadir un archivo <code>.vscode/launch.json</code> con la siguiente configuración:</a></h4>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.2.0\"</span>,\n  <span class=\"hljs-attr\">\"configurations\"</span>: [\n    {\n      <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"(Windows) Launch\"</span>,\n      <span class=\"hljs-attr\">\"type\"</span>: <span class=\"hljs-string\">\"cppvsdbg\"</span>,\n      <span class=\"hljs-attr\">\"request\"</span>: <span class=\"hljs-string\">\"launch\"</span>,\n      <span class=\"hljs-attr\">\"program\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\\\\out\\\\your-executable-location\\\\electron.exe\"</span>,\n      <span class=\"hljs-attr\">\"args\"</span>: [<span class=\"hljs-string\">\"your-electron-project-path\"</span>],\n      <span class=\"hljs-attr\">\"stopAtEntry\"</span>: <span class=\"hljs-literal\">false</span>,\n      <span class=\"hljs-attr\">\"cwd\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      <span class=\"hljs-attr\">\"environment\"</span>: [\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_ENABLE_LOGGING\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"true\"</span>},\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_ENABLE_STACK_DUMPING\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"true\"</span>},\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_RUN_AS_NODE\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"\"</span>},\n      ],\n      <span class=\"hljs-attr\">\"externalConsole\"</span>: <span class=\"hljs-literal\">false</span>,\n      <span class=\"hljs-attr\">\"sourceFileMap\"</span>: {\n          <span class=\"hljs-attr\">\"o:\\\\\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      },\n    },\n  ]\n}\n</code></pre>\n<p><strong>Configuration Notes</strong></p>\n<ul>\n<li><code>cppvsdbg</code> requires the <a href=\"https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools\">built-in C/C++ extension</a> be enabled.</li>\n<li><code>${workspaceFolder}</code> is the full path to Chromium's <code>src</code> directory.</li>\n<li><code>your-executable-location</code> will be one of the following depending on a few items:<ul>\n<li><code>Testing</code>: Si esta utilizando las configuraciones por defecto de <a href=\"https://github.com/electron/build-tools\">Electron's Build-Tools</a> o las instrucciones por defecto cuando <a href=\"/docs/development/build-instructions-gn#building\">building from source</a>.</li>\n<li><code>Release</code>: If you built a Release build rather than a Testing build.</li>\n<li><code>your-directory-name</code>: If you modified this during your build process from the default, this will be whatever you specified.</li>\n</ul></li>\n<li>The <code>args</code> array string <code>\"your-electron-project-path\"</code> should be the absolute path to either the directory or <code>main.js</code> file of the Electron project you are using for testing. In this example, it should be your path to <code>electron-quick-start</code>.</li>\n</ul>\n<h4 id=\"3-depuración-1\"><a href=\"#3-depuración-1\">3. Depuración</a></h4>\n<p>Set some breakpoints in the .cc files of your choosing in the native Electron C++ code, and start debugging in the <a href=\"https://code.visualstudio.com/docs/editor/debugging\">Debug View</a>.</p>",
      "title": "Depurando en VSCode",
      "description": ""
    },
    "/docs/api/desktop-capturer": {
      "locale": "es-ES",
      "slug": "desktop-capturer",
      "href": "/docs/api/desktop-capturer",
      "crowdinFileId": "256307",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/desktop-capturer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktopcapturer\"><a href=\"#desktopcapturer\">desktopCapturer</a></h1>\n<blockquote>\n<p>Access information about media sources that can be used to capture audio and video from the desktop using the <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> API.</p>\n</blockquote>\n<p>Procesos: <a href=\"/docs/glossary#main-process\">principal</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>En el siguiente ejemplo se muestra cómo capturar vídeo desde una ventana de escritorio cuyo título es <code>Electron</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// En el proceso de renderizado.</span>\n<span class=\"hljs-keyword\">const</span> { desktopCapturer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ndesktopCapturer.getSources({ <span class=\"hljs-attr\">types</span>: [<span class=\"hljs-string\">'window'</span>, <span class=\"hljs-string\">'screen'</span>] }).then(<span class=\"hljs-keyword\">async</span> sources => {\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> source <span class=\"hljs-keyword\">of</span> sources) {\n    <span class=\"hljs-keyword\">if</span> (source.name === <span class=\"hljs-string\">'Electron'</span>) {\n      <span class=\"hljs-keyword\">try</span> {\n        <span class=\"hljs-keyword\">const</span> stream = <span class=\"hljs-keyword\">await</span> navigator.mediaDevices.getUserMedia({\n          <span class=\"hljs-attr\">audio</span>: <span class=\"hljs-literal\">false</span>,\n          <span class=\"hljs-attr\">video</span>: {\n            <span class=\"hljs-attr\">mandatory</span>: {\n              <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>,\n              <span class=\"hljs-attr\">chromeMediaSourceId</span>: source.id,\n              <span class=\"hljs-attr\">minWidth</span>: <span class=\"hljs-number\">1280</span>,\n              <span class=\"hljs-attr\">maxWidth</span>: <span class=\"hljs-number\">1280</span>,\n              <span class=\"hljs-attr\">minHeight</span>: <span class=\"hljs-number\">720</span>,\n              <span class=\"hljs-attr\">maxHeight</span>: <span class=\"hljs-number\">720</span>\n            }\n          }\n        })\n        handleStream(stream)\n      } <span class=\"hljs-keyword\">catch</span> (e) {\n        handleError(e)\n      }\n      <span class=\"hljs-keyword\">return</span>\n    }\n  }\n})\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleStream</span> (<span class=\"hljs-params\">stream</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> video = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'video'</span>)\n  video.srcObject = stream\n  video.onloadedmetadata = <span class=\"hljs-function\">(<span class=\"hljs-params\">e</span>) =></span> video.play()\n}\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleError</span> (<span class=\"hljs-params\">e</span>) </span>{\n  <span class=\"hljs-built_in\">console</span>.log(e)\n}\n</code></pre>\n<p>To capture video from a source provided by <code>desktopCapturer</code> the constraints passed to <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> must include <code>chromeMediaSource: 'desktop'</code>, and <code>audio: false</code>.</p>\n<p>To capture both audio and video from the entire desktop the constraints passed to <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> must include <code>chromeMediaSource: 'desktop'</code>, for both <code>audio</code> and <code>video</code>, but should not include a <code>chromeMediaSourceId</code> constraint.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> constraints = {\n  <span class=\"hljs-attr\">audio</span>: {\n    <span class=\"hljs-attr\">mandatory</span>: {\n      <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>\n    }\n  },\n  <span class=\"hljs-attr\">video</span>: {\n    <span class=\"hljs-attr\">mandatory</span>: {\n      <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>\n    }\n  }\n}\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>desktopCapturer</code> tiene los siguientes métodos:</p>\n<h3 id=\"desktopcapturergetsourcesoptions\"><a href=\"#desktopcapturergetsourcesoptions\"><code>desktopCapturer.getSources(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>types</code> String[] - Un arreglo de cadenas que crea una lista de los tipos de fuentes de escritorio para ser capturadas. Los tipos disponibles son <code>screen</code> y <code>window</code>.</li>\n<li><code>thumbnailSize</code> <a href=\"/docs/api/structures/size\">Size</a> (opcional) - El tamaño de la miniatura de la fuente al cual deber ser escalado. Por defecto es <code>150</code> x <code>150</code>. Establecer ancho o alto a 0 cuando no necesitas las miniaturas. Esto guardara el tiempo de procesamiento requerido para capturar el contenido de cada ventana y pantalla.</li>\n<li><code>fetchWindowIcons</code> Boolean (opcional) - Establece a true para activar la obtención de los iconos de ventana. El valor por defecto es falso. Cuando es false la propiedad appIcon de las fuentes devuelve null. Mismo si una fuente tiene el tipo pantalla.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;DesktopCapturerSource[]></code> - Resuelve con un array de objetos <a href=\"/docs/api/structures/desktop-capturer-source\"><code>DesktopCapturerSource</code></a>, cada <code>DesktopCapturerSource</code> representa una pantalla o una ventana individual que puede ser capturada.</p>\n<p><strong>Note</strong> Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher, which can detected by <a href=\"/docs/api/system-preferences#systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><code>systemPreferences.getMediaAccessStatus</code></a>.</p>\n<h2 id=\"advertencias\"><a href=\"#advertencias\">Advertencias</a></h2>\n<p><code>navigator.mediaDevices.getUserMedia</code> no trabaja en macOS para captura de audio debido a una limitación fundamental porque las aplicaciones que quieren acceder al audio del sistema requieren un <a href=\"https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/KernelExtensions/KernelExtensions.html\">signed kernel extension</a>. Chromium, y por extensión Electron, no proporciona esto.</p>\n<p>Es posible eludir esta limitación capturando el audio del sistema con otra aplicación macOS como Soundflower y pasar esto a través de una dispositivo de entrada de audio virtual. Este dispositivo virtual puede ser consultado con <code>navigator.mediaDevices.getUserMedia</code>.</p>",
      "title": "desktopCapturer",
      "description": "Access information about media sources that can be used to capture audio and video from the desktop using the navigator.mediaDevices.getUserMedia API."
    },
    "/docs/api/structures/desktop-capturer-source": {
      "locale": "es-ES",
      "slug": "desktop-capturer-source",
      "href": "/docs/api/structures/desktop-capturer-source",
      "crowdinFileId": "256425",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/desktop-capturer-source.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktopcapturersource-object\"><a href=\"#desktopcapturersource-object\">DesktopCapturerSource Object</a></h1>\n<ul>\n<li><code>id</code> String - The identifier of a window or screen that can be used as a <code>chromeMediaSourceId</code> constraint when calling [<code>navigator.webkitGetUserMedia</code>]. The format of the identifier will be <code>window:XX:YY</code> or <code>screen:ZZ:0</code>. XX is the windowID/handle. YY is 1 for the current process, and 0 for all others. ZZ is a sequential number that represents the screen, and it does not equal to the index in the source's name.</li>\n<li><code>name</code> String - A screen source will be named either <code>Entire Screen</code> or <code>Screen &#x3C;index></code>, while the name of a window source will match the window title.</li>\n<li><code>thumbnail</code> <a href=\"/docs/api/native-image\">NativeImage</a> - A thumbnail image. <strong>Note:</strong> There is no guarantee that the size of the thumbnail is the same as the <code>thumbnailSize</code> specified in the <code>options</code> passed to <code>desktopCapturer.getSources</code>. The actual size depends on the scale of the screen or window.</li>\n<li><code>display_id</code> String - A unique identifier that will correspond to the <code>id</code> of the matching <a href=\"/docs/api/structures/display\">Display</a> returned by the <a href=\"/docs/api/screen\">Screen API</a>. On some platforms, this is equivalent to the <code>XX</code> portion of the <code>id</code> field above and on others it will differ. It will be an empty string if not available.</li>\n<li><code>appIcon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - An icon image of the application that owns the window or null if the source has a type screen. The size of the icon is not known in advance and depends on what the application provides.</li>\n</ul>",
      "title": "DesktopCapturerSource Object",
      "description": ""
    },
    "/docs/tutorial/devices": {
      "locale": "es-ES",
      "slug": "devices",
      "href": "/docs/tutorial/devices",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/devices.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"acceso-del-dispositivo\"><a href=\"#acceso-del-dispositivo\">Acceso del dispositivo</a></h1>\n<p>Al igual que los navegadores basados en Chromium, Electron proporciona acceso al dispositivo del hardware a través de las APIs web.  En la mayor parte estas APIs trabajan como lo hacen en un navegador, pero hay algunas diferencias que necesitan ser tomadas en cuenta.  La diferencia principal entre Electron y los navegadores es lo que ocurre cuando el acceso al dispositivo es solicitado.  En un navegador, a los usuarios se le presenta una ventana emergente donde ellos puede otorgar acceso a un dispositivo individual.  En Electron, se proporcionan APIs que un desarrollador puede utilizar para elegir automáticamente un dispositivo o para solicitar a los usuarios que elijan un dispositivo a través de una interfaz creada por el desarrollador.</p>\n<h2 id=\"api-web-bluetooth\"><a href=\"#api-web-bluetooth\">API Web Bluetooth</a></h2>\n<p>La <a href=\"https://web.dev/bluetooth/\">Web Bluetooth API</a> puede ser utilizada para comunicarse con dispositivos bluetooth. Para poder utilizar esta API en Electron, los desarrolladores necesitan manejar el <a href=\"/docs/api/web-contents#event-select-bluetooth-device\">evento <code>select-bluetooth-device</code> en el webContents</a> asociado con la solicitud del dispositivo.</p>\n<h3 id=\"ejemplo\"><a href=\"#ejemplo\">Ejemplo</a></h3>\n<p>Este ejemplo demuestra un aplicación Electron que automáticamente selecciona el primer dispositivo bluetooth disponible cuando el botón <code>Test Bluetooth</code> es pulsado.</p>\n<h2 id=\"api-webhid\"><a href=\"#api-webhid\">API WebHID</a></h2>\n<p>La <a href=\"https://web.dev/hid/\">WebHID API</a> puede ser usada para acceder a dispositivos HID tales como teclados y gamepads.  Electron proporciona varias APIs, para trabajar con la API WebHID:</p>\n<ul>\n<li>El <a href=\"/docs/api/session#event-select-hid-device\">evento <code>select-hid-device</code> en la Session</a> puede ser usado para seleccionar un dispositivo HID cuando se hace una llamada a <code>navigator.hid.requestDevice</code>.  Adicionalmente, los eventos <a href=\"/docs/api/session#event-hid-device-added\"><code>hid-device-added</code></a> y <a href=\"/docs/api/session#event-hid-device-removed\"><code>hid-device-removed</code></a> en la Session pueden ser utilizados para manejar dispositivos que se conectan o desconectan durante el proceso <code>navigator.hid.requestDevice</code>.</li>\n<li><a href=\"/docs/api/session#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a> puede ser utilizado para proveer permisos predeterminados a los dispositivos sin llamar primero para obtener permiso a dispositivo a través de <code>navigator.hid.requestDevice</code>.  Adicionalmente el comportamiento por defecto de Electron es almacenar el permiso de dispositivo concedido a través de la vida útil del correspondiente WebContents.  Si se necesita almacenamiento a más largo plazo, un desarrollado puede almacenar los permisos de dispositivos otorgados (pj cuando se maneja el evento <code>select-hid-device</code>) y luego leer desde ese almacenamiento con <code>setDevicePermissionHandler</code>.</li>\n<li><a href=\"/docs/api/session#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a> puede ser usado para desactivar el acceso a HID a orígenes específicos.</li>\n</ul>\n<h3 id=\"lista-de-bloqueados\"><a href=\"#lista-de-bloqueados\">Lista de bloqueados</a></h3>\n<p>Por defecto Electron emplea la misma <a href=\"https://github.com/WICG/webhid/blob/main/blocklist.txt\">blocklist</a> usada por Chromium.  Si desea anular este comportamiento, puede hacerlo estableciendo la bandera <code>disable-hid-blocklist</code>:</p>\n<pre><code class=\"hljs language-javascript\">app.commandLine.appendSwitch(<span class=\"hljs-string\">'disable-hid-blocklist'</span>)\n</code></pre>\n<h3 id=\"ejemplo-1\"><a href=\"#ejemplo-1\">Ejemplo</a></h3>\n<p>Este ejemplo demuestra una aplicación Electron que automáticamente selecciona dispositivos HID a través de <a href=\"/docs/api/session#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a> y a través del <a href=\"/docs/api/session#event-select-hid-device\">evento <code>select-hid-device</code> en la Session</a> cuando el botón <code>Test WebHID</code> es pulsado.</p>\n<h2 id=\"api-serial-web\"><a href=\"#api-serial-web\">API Serial Web</a></h2>\n<p>La <a href=\"https://web.dev/serial/\">Web Serial API</a> puede ser utilizada para acceder a dispositivos seriales que están conectados a través de la puerta serial, USB, or Bluetooth.  Para utilizar esta API en Electron, los desarrolladores necesitan manejar el <a href=\"/docs/api/session#event-select-serial-port\">evento <code>select-serial-port</code> en la Session</a> asociado con la solicitud de puerto serial.</p>\n<p>Hay varias APIs adicionales para trabajar con la API Web Serial:</p>\n<ul>\n<li>Los eventos <a href=\"/docs/api/session#event-serial-port-added\"><code>serial-port-added</code></a> y <a href=\"/docs/api/session#event-serial-port-removed\"><code>serial-port-removed</code></a> en la Session pueden ser usados para maenjar dispositivos que están conectados o desconectados durante el proceso <code>navigator.serial.requestPort</code>.</li>\n<li><a href=\"/docs/api/session#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a> puede ser usado para desactivar el acceso serial a orígenes específicos.</li>\n</ul>\n<h3 id=\"ejemplo-2\"><a href=\"#ejemplo-2\">Ejemplo</a></h3>\n<p>Este ejemplo demuestra una aplicación Electron que automáticamente selecciona el primer dispositivo serial Arduino Uno (si está conectado) a través del <a href=\"/docs/api/session#event-select-serial-port\">evento <code>select-serial-port</code> en la Session</a> cuando el botón <code>Test Web Serial</code> es pulsado.</p>",
      "title": "Acceso del dispositivo",
      "description": ""
    },
    "/docs/tutorial/devtools-extension": {
      "locale": "es-ES",
      "slug": "devtools-extension",
      "href": "/docs/tutorial/devtools-extension",
      "crowdinFileId": "256195",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/devtools-extension.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"extensión-de-herramientas-de-desarrollo\"><a href=\"#extensión-de-herramientas-de-desarrollo\">Extensión de herramientas de desarrollo</a></h1>\n<p>Electron soporta <a href=\"https://developer.chrome.com/extensions/devtools\">Chrome DevTools extensions</a>, las cuales pueden ser usadas para extender las funcionalidades de las herramientas de desarrollo de Chrome para depurar web frameworks populares.</p>\n<h2 id=\"cargando-una-extensión-devtools-con-herramientas\"><a href=\"#cargando-una-extensión-devtools-con-herramientas\">Cargando una extensión DevTools con herramientas</a></h2>\n<p>La forma más fácil de cargar una extensión DevTools es utilizar herramientas de terceros para automatizar el proceso por usted. <a href=\"https://github.com/MarshallOfSound/electron-devtools-installer\">electron-devtools-installer</a> es un popular paquete NPM que hace justamente eso.</p>\n<h2 id=\"cargando-una-extensión-devtools-manualmente\"><a href=\"#cargando-una-extensión-devtools-manualmente\">Cargando una extensión DevTools manualmente</a></h2>\n<p>Si no quiere usar el enfoque de herramientas, también puede hacer todas las operaciones necesarias a mano. Para cargar una extensión en Electron, necesitas descargarlo a través Chrome, localiza la ruta de su sistema de archivo y luego cárgalo dentro de tu <a href=\"/docs/api/session\">Session</a> llamando a la API [<code>ses.loadExtension</code>].</p>\n<p>Usando el <a href=\"https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi\">React Developer Tools</a> como un ejemplo:</p>\n<ol>\n<li>\n<p>Instala la extensión en Google Chrome.</p>\n</li>\n<li>\n<p>Acceder a <code>chrome://extensions</code>, e identificar el ID de la extensión, que es una cadena de texto como <code>fmkadmapgofadopljbjfkapdkoienihi</code>.</p>\n</li>\n<li>\n<p>Encuentra la ubicación del sistema de archivo usado por Chrome para alamacenar las extensiones:</p>\n<ul>\n<li>en Windows es <code>%LOCALAPPDATA%\\Google\\Chrome\\User Data\\Default\\Extensions</code>;</li>\n<li>en Linux pueden ser:<ul>\n<li><code>~/.config/google-chrome/Default/Extensions/</code></li>\n<li><code>~/.config/google-chrome-beta/Default/Extensions/</code></li>\n<li><code>~/.config/google-chrome-canary/Default/Extensions/</code></li>\n<li><code>~/.config/chromium/Default/Extensions/</code></li>\n</ul></li>\n<li>en macOS es <code>~/Library/Application Support/Google/Chrome/Default/Extensions</code>.</li>\n</ul>\n</li>\n<li>\n<p>Pasa la ubicación de la extensión a la API <a href=\"/docs/api/session#sesloadextensionpath-options\"><code>ses.loadExtension</code></a>. Para React Developer Tools <code>v4.9.0</code>, se ve algo como:</p>\n<pre><code class=\"hljs language-javascript\"> <span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n <span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n\n <span class=\"hljs-comment\">// on macOS</span>\n <span class=\"hljs-keyword\">const</span> reactDevToolsPath = path.join(\n   os.homedir(),\n   <span class=\"hljs-string\">'/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/4.9.0_0'</span>\n )\n\n app.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n   <span class=\"hljs-keyword\">await</span> session.defaultSession.loadExtension(reactDevToolsPath)\n })\n</code></pre>\n</li>\n</ol>\n<p><strong>Notas:</strong></p>\n<ul>\n<li><code>loadExtension</code> devuelve una Promise con un <a href=\"/docs/api/structures/extension\">Extension object</a>, que contiene metadatos sobre la extensión que fue cargada. Esta promise necesita resolver (p. ej. con una expresión <code>await</code>) antes de cargar una página. De lo contrario, no estará garantizada la carga de la extensión.</li>\n<li><code>loadExtension</code> no puede ser llamada antes de que el evento <code>ready</code> del módulo <code>app</code>sea emitido, ni puede ser llamado en sesiones en memoria (no persistente).</li>\n<li><code>loadExtension</code> debe ser llamado en cada arranque de tu aplicación si quieres que la extensión sea cargada.</li>\n</ul>\n<h3 id=\"eliminando-una-extensión-devtools\"><a href=\"#eliminando-una-extensión-devtools\">Eliminando una extensión DevTools</a></h3>\n<p>Puedes pasar la ID de la extensión a la API <a href=\"/docs/api/session#sesremoveextensionextensionid\"><code>ses.removeExtension</code></a> para eliminarla de tu Session. Las extensiones cargadas no son persistidas entre los lanzamientos de la aplicación.</p>\n<h2 id=\"soporte-de-extensión-devtools\"><a href=\"#soporte-de-extensión-devtools\">Soporte de extensión DevTools</a></h2>\n<p>Electron sólo soporta <a href=\"/docs/api/extensions\">un limitado conjunto de APIs de <code>chrome.*</code></a>, así que las extensiones usando APIs de <code>chrome.*</code> no soportadas bajo el capo puede que no funcione.</p>\n<p>Las siguientes extensiones Devtools han siso probadas para funcionar en Electron:</p>\n<ul>\n<li><a href=\"https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi\">Ember Inspector</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi\">React Developer Tools</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/backbone-debugger/bhljhndlimiafopmmhjlgfpnnchjjbhd\">Backbone Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/jquery-debugger/dbhhnnnpaeobfddmlalhnehgclcmjimi\">jQuery Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/angularjs-batarang/ighdmehidhipcmcojjgiloacoafjmpfk\">AngularJS Batarang</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd\">Vue.js devtools</a></li>\n<li><a href=\"https://cerebraljs.com/docs/introduction/devtools.html\">Cerebral Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd\">Redux DevTools Extension</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/mobx-developer-tools/pfgnfdagidkfgccljigdamigbcnndkod\">MobX Developer Tools</a></li>\n</ul>\n<h3 id=\"¿qué-debería-hacer-si-una-extensión-devtools-no-está-funcionando\"><a href=\"#¿qué-debería-hacer-si-una-extensión-devtools-no-está-funcionando\">¿Qué debería hacer si una extensión DevTools no está funcionando?</a></h3>\n<p>Primero, por favor asegúrese que la extensión todavía sigue siendo mantenida y es compatible con la última versión de Google Chrome. No podemos proveer soporte adicional para extensiones no soportadas.</p>\n<p>Si la extensión funciona en Chrome pero no en Electron, registra el error en el <a href=\"https://github.com/electron/electron/issues\">issue tracker</a> de Electron y describe que parte de la extensión no esta funcionando como se espera.</p>",
      "title": "Extensión de herramientas de desarrollo",
      "description": ""
    },
    "/docs/api/dialog": {
      "locale": "es-ES",
      "slug": "dialog",
      "href": "/docs/api/dialog",
      "crowdinFileId": "256309",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/dialog.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dialog\"><a href=\"#dialog\">dialog</a></h1>\n<blockquote>\n<p>Muestra diálogos nativos del sistema para abrir y guardar archivos, alertas, etc.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p>Un ejemplo de mostrar un dialogo para seleccionar múltiples archivos:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(dialog.showOpenDialog({ <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'multiSelections'</span>] }))\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>dialogo</code> tiene los siguientes métodos:</p>\n<h3 id=\"dialogshowopendialogsyncbrowserwindow-options\"><a href=\"#dialogshowopendialogsyncbrowserwindow-options\"><code>dialog.showOpenDialogSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code><a href=\"/docs/api/browser-window\">BrowserWindow</a>(opcional)</li>\n<li><code>options</code> Object<ul>\n<li><code>título</code> cadena (opcional)</li>\n<li><code>defaultPath</code> Cadena (optional)</li>\n<li><code>buttonLabel</code> cadena (optional) - Etiqueta predeterminada para el botón de confirmación, cuando esta se deja vacía la etiqueta predeterminada será usada.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (optional)</li>\n<li><code>properties</code> String[] (optional) - Contains which features the dialog should use. Los siguientes valores son soportados:<ul>\n<li><code>openFile</code> - Le permite a los archivos ser seleccionados.</li>\n<li><code>openDirectory</code> - Le permite a los directorios ser seleccionados.</li>\n<li><code>multiSelections</code> - Permite que varios caminos sean seleccionados.</li>\n<li><code>showHiddenFiles</code> - Muestra archivos ocultos en diálogo.</li>\n<li><code>createDirectory</code> <em>macOS</em>- Permite crear nuevos directorios a partir del diálogo.</li>\n<li><code>promptToCreate</code> <em>Windows</em> - Aviso para la creación si la ruta de fichero insertado en el diálogo no existe. Esto no crea realmente un archivo en el camino pero permite a caminos no existentes a regresar que deberían ser creados por la aplicación.</li>\n<li><code>noResolveAliases</code> <em>macOS</em> - Deshabilite la resolución automática de la ruta de alias (enlace simbólico). Los alias seleccionados ahora devolverán la ruta de alias en lugar de la ruta de destino.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Trata paquetes como carpetas <code>.app</code>, como un directorio en vez de como un fichero.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - No agregar el elemento que se esta abriendo a la lista de documentos recientes.</li>\n</ul></li>\n<li><code>message</code> Cadena (opcional) <em>macOS</em> - Mensaje a mostrar encima de las cajas de entrada.</li>\n<li><code>securityScopedBookmarks</code> Boolean (opcional) <em>macOS</em> <em>mas</em> - Crear <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">marcadores con ámbito de seguridad</a> cuando es empaquetado para la Mac App Store.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>String[] | undefined</code>, la ruta del archivo elegido por el usuario, si el diálogo es cancelado devuelve <code>undefined</code>.</p>\n<p>El argumento de <code>browserWindow</code> permite el diálogo a adjuntarse a una ventana parental, haciéndola una modalidad.</p>\n<p>The <code>filters</code> specifies an array of file types that can be displayed or selected when you want to limit the user to a specific type. Por ejemplo:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">filters</span>: [\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Images'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'jpg'</span>, <span class=\"hljs-string\">'png'</span>, <span class=\"hljs-string\">'gif'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Movies'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'mkv'</span>, <span class=\"hljs-string\">'avi'</span>, <span class=\"hljs-string\">'mp4'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Custom File Type'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'as'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'All Files'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'*'</span>] }\n  ]\n}\n</code></pre>\n<p>Los <code>extensions</code> arreglos deberían contener extensiones sin comodines o puntos (e.g. <code>'png'</code> es bueno, pero <code>'.png'</code> y <code>'*.png'</code> son malos). Para mostrar todos los archivos, usa el <code>'*'</code> comodín (ningún otro comodín es compatible).</p>\n<p><strong>Nota:</strong> En Windows y Linux, un diálogo abierto no puede ser un selector de archivo y un selector de directorio a la vez, así que si estableces <code>properties</code> a el <code>['openFile', 'openDirectory']</code> en estas plataformas, un selector de directorio.</p>\n<pre><code class=\"hljs language-js\">dialog.showOpenDialogSync(mainWindow, {\n  <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'openDirectory'</span>]\n})\n</code></pre>\n<h3 id=\"dialogshowopendialogbrowserwindow-options\"><a href=\"#dialogshowopendialogbrowserwindow-options\"><code>dialog.showOpenDialog([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code><a href=\"/docs/api/browser-window\">BrowserWindow</a>(opcional)</li>\n<li><code>options</code> Object<ul>\n<li><code>título</code> cadena (opcional)</li>\n<li><code>defaultPath</code> Cadena (optional)</li>\n<li><code>buttonLabel</code> cadena (optional) - Etiqueta predeterminada para el botón de confirmación, cuando esta se deja vacía la etiqueta predeterminada será usada.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (optional)</li>\n<li><code>properties</code> String[] (optional) - Contains which features the dialog should use. Los siguientes valores son soportados:<ul>\n<li><code>openFile</code> - Le permite a los archivos ser seleccionados.</li>\n<li><code>openDirectory</code> - Le permite a los directorios ser seleccionados.</li>\n<li><code>multiSelections</code> - Permite que varios caminos sean seleccionados.</li>\n<li><code>showHiddenFiles</code> - Muestra archivos ocultos en diálogo.</li>\n<li><code>createDirectory</code> <em>macOS</em>- Permite crear nuevos directorios a partir del diálogo.</li>\n<li><code>promptToCreate</code> <em>Windows</em> - Aviso para la creación si la ruta de fichero insertado en el diálogo no existe. Esto no crea realmente un archivo en el camino pero permite a caminos no existentes a regresar que deberían ser creados por la aplicación.</li>\n<li><code>noResolveAliases</code> <em>macOS</em> - Deshabilite la resolución automática de la ruta de alias (enlace simbólico). Los alias seleccionados ahora devolverán la ruta de alias en lugar de la ruta de destino.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Trata paquetes como carpetas <code>.app</code>, como un directorio en vez de como un fichero.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - No agregar el elemento que se esta abriendo a la lista de documentos recientes.</li>\n</ul></li>\n<li><code>message</code> Cadena (opcional) <em>macOS</em> - Mensaje a mostrar encima de las cajas de entrada.</li>\n<li><code>securityScopedBookmarks</code> Boolean (opcional) <em>macOS</em> <em>mas</em> - Crear <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">marcadores con ámbito de seguridad</a> cuando es empaquetado para la Mac App Store.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;Object></code> - Resuelve con un objeto conteniendo lo siguiente:</p>\n<ul>\n<li><code>canceled</code> Boolean - si el diálogo fue o no cancelado.</li>\n<li><code>filePaths</code> Cadena[] - Un arreglo del camino de archivos elegido por el usuario. Si es dialog es cancelado esto será un array vacío.</li>\n<li><code>bookmarks</code> String[] (optional) <em>macOS</em> <em>mas</em> - An array matching the <code>filePaths</code> array of base64 encoded strings which contains security scoped bookmark data. <code>securityScopedBookmarks</code> debe estar activado para ser poblado. (Para devolver valores, vea <a href=\"#bookmarks-array\">tabla aquí</a>.)</li>\n</ul>\n<p>El argumento de <code>browserWindow</code> permite el diálogo a adjuntarse a una ventana parental, haciéndola una modalidad.</p>\n<p>The <code>filters</code> specifies an array of file types that can be displayed or selected when you want to limit the user to a specific type. Por ejemplo:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">filters</span>: [\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Images'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'jpg'</span>, <span class=\"hljs-string\">'png'</span>, <span class=\"hljs-string\">'gif'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Movies'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'mkv'</span>, <span class=\"hljs-string\">'avi'</span>, <span class=\"hljs-string\">'mp4'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Custom File Type'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'as'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'All Files'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'*'</span>] }\n  ]\n}\n</code></pre>\n<p>Los <code>extensions</code> arreglos deberían contener extensiones sin comodines o puntos (e.g. <code>'png'</code> es bueno, pero <code>'.png'</code> y <code>'*.png'</code> son malos). Para mostrar todos los archivos, usa el <code>'*'</code> comodín (ningún otro comodín es compatible).</p>\n<p><strong>Nota:</strong> En Windows y Linux, un diálogo abierto no puede ser un selector de archivo y un selector de directorio a la vez, así que si estableces <code>properties</code> a el <code>['openFile', 'openDirectory']</code> en estas plataformas, un selector de directorio.</p>\n<pre><code class=\"hljs language-js\">dialog.showOpenDialog(mainWindow, {\n  <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'openDirectory'</span>]\n}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">result</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(result.canceled)\n  <span class=\"hljs-built_in\">console</span>.log(result.filePaths)\n}).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(err)\n})\n</code></pre>\n<h3 id=\"dialogshowsavedialogsyncbrowserwindow-options\"><a href=\"#dialogshowsavedialogsyncbrowserwindow-options\"><code>dialog.showSaveDialogSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code><a href=\"/docs/api/browser-window\">BrowserWindow</a>(opcional)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> Cadena (opcional) - Título del diálogo. No puede mostrarse en algunos entornos de escritorio de <em>Linux</em>.</li>\n<li><code>defaultPath</code> Cadena (opcional) - El camino de directorio absoluto, el camino de archivo absoluto o el nombre del archivo a usar por defecto.</li>\n<li><code>buttonLabel</code> cadena (optional) - Etiqueta predeterminada para el botón de confirmación, cuando esta se deja vacía la etiqueta predeterminada será usada.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (optional)</li>\n<li><code>message</code> Cadena (opcional) <em>macOS</em> - Mensaje a mostrar por encima de los campos de texto.</li>\n<li><code>nameFieldLabel</code> Cadena (opcional) <em>macOS</em> - Etiqueta personalizada para el texto mostrado en frente al nombre del archivo del campo de texto.</li>\n<li><code>showsTagField</code> Boolean (opcional) <em>macOS</em> - Muestra las etiquetas de las cajas de entrada, por defecto a <code>true</code>.</li>\n<li><code>properties</code> String[] (optional)<ul>\n<li><code>showHiddenFiles</code> - Muestra archivos ocultos en diálogo.</li>\n<li><code>createDirectory</code> <em>macOS</em>- Permite crear nuevos directorios a partir del diálogo.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Trata paquetes como carpetas <code>.app</code>, como un directorio en vez de como un fichero.</li>\n<li><code>showOverwriteConfirmation</code> <em>Linux</em> - Establece si al usuario será presentado un dialogo de confirmación si escribe el nombre de un archivo que ya existe.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - No añadir el elemento que se está guardando en la lista de documentos recientes.</li>\n</ul></li>\n<li><code>securityScopedBookmarks</code> Boolean (opcional) <em>macOS</em> <em>mas</em> - Crear un <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmark</a> es empaquetado para el Mac App Store. Si esta opción está activada y el fichero no existe todavía, se creará un fichero en blanco en la carpeta seleccionada.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>String | undefined</code>, la ruta del archivo elegido por el usuario; si el cuadro de dialogo es cancelado retorna <code>undefined</code>.</p>\n<p>El argumento de <code>browserWindow</code> permite el diálogo a adjuntarse a una ventana parental, haciéndola una modalidad.</p>\n<p>Los <code>filtros</code> especifican un arreglo de los tipos de archivos can pueden ser mostrados, ver <code>dialog.showOpenDialog</code> por un ejemplo.</p>\n<h3 id=\"dialogshowsavedialogbrowserwindow-options\"><a href=\"#dialogshowsavedialogbrowserwindow-options\"><code>dialog.showSaveDialog([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code><a href=\"/docs/api/browser-window\">BrowserWindow</a>(opcional)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> Cadena (opcional) - Título del diálogo. No puede mostrarse en algunos entornos de escritorio de <em>Linux</em>.</li>\n<li><code>defaultPath</code> Cadena (opcional) - El camino de directorio absoluto, el camino de archivo absoluto o el nombre del archivo a usar por defecto.</li>\n<li><code>buttonLabel</code> cadena (optional) - Etiqueta predeterminada para el botón de confirmación, cuando esta se deja vacía la etiqueta predeterminada será usada.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (optional)</li>\n<li><code>message</code> Cadena (opcional) <em>macOS</em> - Mensaje a mostrar por encima de los campos de texto.</li>\n<li><code>nameFieldLabel</code> Cadena (opcional) <em>macOS</em> - Etiqueta personalizada para el texto mostrado en frente al nombre del archivo del campo de texto.</li>\n<li><code>showsTagField</code> Boolean (opcional) <em>macOS</em> - Muestra las etiquetas input box, por defecto <code>true</code>.</li>\n<li><code>properties</code> String[] (optional)<ul>\n<li><code>showHiddenFiles</code> - Muestra archivos ocultos en diálogo.</li>\n<li><code>createDirectory</code> <em>macOS</em>- Permite crear nuevos directorios a partir del diálogo.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Trata paquetes como carpetas <code>.app</code>, como un directorio en vez de como un fichero.</li>\n<li><code>showOverwriteConfirmation</code> <em>Linux</em> - Establece si al usuario será presentado un dialogo de confirmación si escribe el nombre de un archivo que ya existe.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - No añadir el elemento que se está guardando en la lista de documentos recientes.</li>\n</ul></li>\n<li><code>securityScopedBookmarks</code> Boolean (opcional) <em>macOS</em> <em>mas</em> - Crear un <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmark</a> es empaquetado para el Mac App Store. Si esta opción está activada y el fichero no existe todavía, se creará un fichero en blanco en la carpeta seleccionada.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;Object></code> - Resuelve con un objeto conteniendo lo siguiente:</p>\n<ul>\n<li><code>canceled</code> Boolean - si el diálogo fue o no cancelado.</li>\n<li><code>filePath</code> String (opcional) - Si el dialog es cancelado, esto será <code>undefined</code>.</li>\n<li><code>bookmark</code> String (opcional) <em>macOS</em> <em>mas</em> - Cadena codificada en Base64 que contiene los datos del marcador con ámbito de seguridad para el archivo guardado. <code>securityScopedBookmarks</code> deben estar activados para estar presentes. (Para devolver valores, vea <a href=\"#bookmarks-array\">tabla aquí</a>.)</li>\n</ul>\n<p>El argumento de <code>browserWindow</code> permite el diálogo a adjuntarse a una ventana parental, haciéndola una modalidad.</p>\n<p>Los <code>filtros</code> especifican un arreglo de los tipos de archivos can pueden ser mostrados, ver <code>dialog.showOpenDialog</code> por un ejemplo.</p>\n<p><strong>Nota:</strong> En macOS, se recomienda usar la versión asincrona para evitar problemas cuando expanda y colapsa el diálogo.</p>\n<h3 id=\"dialogshowmessageboxsyncbrowserwindow-options\"><a href=\"#dialogshowmessageboxsyncbrowserwindow-options\"><code>dialog.showMessageBoxSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code><a href=\"/docs/api/browser-window\">BrowserWindow</a>(opcional)</li>\n<li><code>options</code> Object<ul>\n<li><code>message</code> Cadena - Contenido de la caja de mensaje.</li>\n<li><code>type</code> Cadena (opcional) - Puede ser <code>\"none\"</code>, <code>\"info\"</code>, <code>\"error\"</code>, <code>\"question\"</code> o <code>\"warning\"</code>. En Windows, <code>\"question\"</code> muestra el mismo icono que <code>\"info\"</code>, a menos que tu dispongas un icono usando la opción <code>\"icon\"</code>. En macOS, tanto <code>\"warning\"</code> como <code>\"error\"</code> muestran el mismo icono de peligro.</li>\n<li><code>buttons</code> String[] (optional) - Array of texts for buttons. En Windows, un array vacío resultará en un botón con al etiqueta \"OK\".</li>\n<li><code>defaultId</code> Íntegro (opcional) - El índice del botón en el arreglo de los botones, el cual será selecto por defecto cuando el mensaje de la caja se abra.</li>\n<li><code>title</code> Cadena (opcional) - Título del mensaje de la caja, algunas plataformas no se mostrarán.</li>\n<li><code>detail</code> Cadena (opcional) - Información extra del mensaje.</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (opcional)</li>\n<li><code>textWidth</code> Integer (opcional) <em>macOS</em> - Ancho personalizado del texto en el cuadro de mensaje.</li>\n<li><code>cancelId</code> Íntegro (opcional) - El índice el botón a ser usado a cancelar el diálogo, por vía la llave <code>Esc</code>. Por defecto, esto es asignado a el primer botón con \"cancelar\" o \"no\" como una etiqueta. Si no existen tales botones etiquetados y esta opción no esta configurada, <code>0</code> será usada como el valor de retorno.</li>\n<li><code>noLink</code> Boolean (opcional) - En Windows Electron se tratará de averiguar cuál de los <code>buttons</code> son botones comunes (como \"Cancelar\" o \"Sí\"), y muestra los otros como links de comandos en el diálogo. Esto puede hacer que el diálogo aparezca en el estilo de las aplicaciones modernas de Windows. Si no te gusta este comportamiento, puedes establecer <code>noLink</code> a <code>true</code>.</li>\n<li><code>normalizeAccessKeys</code> Boolean (opcional) - Normalizar el acceso al teclado a través de las plataformas. Por defecto es <code>false</code>. Permitir esto asume que <code>&#x26;</code> es usado en las etiquetas de los botones para el colocamiento de los atajos de acceso de las teclas del teclado y las etiquetas serán convertidas para que funcionen correctamente en cada plataforma, <code>&#x26;</code> personajes serán eliminados de macOS, convertidos a <code>_</code> en Linux, y dejado intacto en Windows. Por ejemplo, una etiqueta de botón de <code>Vie&#x26;w</code> será convertida a <code>Vie_w</code> en Linux y <code>View</code> en macOS y puede ser seleccionado vía <code>Alt-W</code> en Windows y Linux.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Integer</code> - el índice del botón pulsado.</p>\n<p>Muestra un cuadro de mensaje, bloqueará el proceso hasta que el cuadro de mensaje esté cerrado. Devuelve el indice del botón pulsado.</p>\n<p>El argumento de <code>browserWindow</code> permite el diálogo a adjuntarse a una ventana parental, haciéndola una modalidad. Si <code>browserWindow</code> no es mostrado no se le adjuntará el dialog. In such case it will be displayed as an independent window.</p>\n<h3 id=\"dialogshowmessageboxbrowserwindow-options\"><a href=\"#dialogshowmessageboxbrowserwindow-options\"><code>dialog.showMessageBox([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code><a href=\"/docs/api/browser-window\">BrowserWindow</a>(opcional)</li>\n<li><code>options</code> Object<ul>\n<li><code>message</code> Cadena - Contenido de la caja de mensaje.</li>\n<li><code>type</code> Cadena (opcional) - Puede ser <code>\"none\"</code>, <code>\"info\"</code>, <code>\"error\"</code>, <code>\"question\"</code> o <code>\"warning\"</code>. En Windows, <code>\"question\"</code> muestra el mismo icono que <code>\"info\"</code>, a menos que tu dispongas un icono usando la opción <code>\"icon\"</code>. En macOS, tanto <code>\"warning\"</code> como <code>\"error\"</code> muestran el mismo icono de peligro.</li>\n<li><code>buttons</code> String[] (optional) - Array of texts for buttons. En Windows, un array vacío resultará en un botón con al etiqueta \"OK\".</li>\n<li><code>defaultId</code> Íntegro (opcional) - El índice del botón en el arreglo de los botones, el cual será selecto por defecto cuando el mensaje de la caja se abra.</li>\n<li><code>signal</code> AbortSignal (opcional) - Pasar un instancia de <a href=\"https://nodejs.org/api/globals.html#globals_class_abortsignal\">AbortSignal</a> a opcionalmente cerrar el cuadro de mensaje, el cuadro de mensaje se comportará como si fuera cancelado por el usuario. En macOS, <code>signal</code> no funciona con los cuadros de mensajes que no tengan una ventana padre, dado que esos cuadros de mensajes se ejecutan de forma sincrónica debido a las limitaciones de la plataforma.</li>\n<li><code>title</code> Cadena (opcional) - Título del mensaje de la caja, algunas plataformas no se mostrarán.</li>\n<li><code>detail</code> Cadena (opcional) - Información extra del mensaje.</li>\n<li><code>checkboxLabel</code> String (opcional) - Si se proporciona, el cuadro de mensaje será incluido como un checkbox con la etiqueta dada.</li>\n<li><code>checkboxChecked</code> Boolean (opcional) - Estado inicial checked del checkbox. <code>false</code> por defecto.</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> (opcional)</li>\n<li><code>textWidth</code> Integer (opcional) <em>macOS</em> - Ancho personalizado del texto en el cuadro de mensaje.</li>\n<li><code>cancelId</code> Íntegro (opcional) - El índice el botón a ser usado a cancelar el diálogo, por vía la llave <code>Esc</code>. Por defecto, esto es asignado a el primer botón con \"cancelar\" o \"no\" como una etiqueta. Si no existen tales botones etiquetados y esta opción no esta configurada, <code>0</code> será usada como el valor de retorno.</li>\n<li><code>noLink</code> Boolean (opcional) - En Windows Electron se tratará de averiguar cuál de los <code>buttons</code> son botones comunes (como \"Cancelar\" o \"Sí\"), y muestra los otros como links de comandos en el diálogo. Esto puede hacer que el diálogo aparezca en el estilo de las aplicaciones modernas de Windows. Si no te gusta este comportamiento, puedes establecer <code>noLink</code> a <code>true</code>.</li>\n<li><code>normalizeAccessKeys</code> Boolean (opcional) - Normalizar el acceso al teclado a través de las plataformas. Por defecto es <code>false</code>. Permitir esto asume que <code>&#x26;</code> es usado en las etiquetas de los botones para el colocamiento de los atajos de acceso de las teclas del teclado y las etiquetas serán convertidas para que funcionen correctamente en cada plataforma, <code>&#x26;</code> personajes serán eliminados de macOS, convertidos a <code>_</code> en Linux, y dejado intacto en Windows. Por ejemplo, una etiqueta de botón de <code>Vie&#x26;w</code> será convertida a <code>Vie_w</code> en Linux y <code>View</code> en macOS y puede ser seleccionado vía <code>Alt-W</code> en Windows y Linux.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;Object></code> - resuelve con una promesa conteniendo lo siguiente:</p>\n<ul>\n<li><code>response</code> Number - El índice del botón pulsado.</li>\n<li><code>checkboxChecked</code> Boolean - El estado checked state del checkbox si <code>checkboxLabel</code> fue establecido. De lo contrario <code>false</code>.</li>\n</ul>\n<p>Shows a message box.</p>\n<p>El argumento de <code>browserWindow</code> permite el diálogo a adjuntarse a una ventana parental, haciéndola una modalidad.</p>\n<h3 id=\"dialogshowerrorboxtitle-content\"><a href=\"#dialogshowerrorboxtitle-content\"><code>dialog.showErrorBox(title, content)</code></a></h3>\n<ul>\n<li><code>title</code> Cadena - El título a mostrar en la caja de error.</li>\n<li><code>content</code> Cadena - El texto contiene a mostrar en la caja de error.</li>\n</ul>\n<p>Muestra un diálogo de modalidad que muestra un error de mensaje.</p>\n<p>Esta API puede ser llamada seguramente antes que el evento <code>ready</code> el módulo <code>app</code> emite, es usualmente usado a reportar errores en las etapas tempranas del inicio. Si llamado antes de la aplicación <code>ready</code> evento en Linux, el mensaje será emitido a stderr, y no aparecerá diálogo GUI.</p>\n<h3 id=\"dialogshowcertificatetrustdialogbrowserwindow-options-macos-windows\"><a href=\"#dialogshowcertificatetrustdialogbrowserwindow-options-macos-windows\"><code>dialog.showCertificateTrustDialog([browserWindow, ]options)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>browserWindow</code><a href=\"/docs/api/browser-window\">BrowserWindow</a>(opcional)</li>\n<li><code>options</code> Object<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> - El certificado a confiar/importar.</li>\n<li><code>message</code> Cadena - El mensaje a mostrar al usuario.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code> - resuelve cuando se muestra el diálogo de confianza del certificado.</p>\n<p>En macOS, esto muestra un diálogo modelo que muestra un mensaje e información certificada, y da al usuario la opción de confiar/importar el certificado. Si tú provees un argumento <code>browserWindow</code> el diálogo será adjuntado a la ventana parental, haciéndolo un modelo.</p>\n<p>En Windows, las opciones son más limitadas, debido a que el Win32 APIs usado:</p>\n<ul>\n<li>El argumento <code>message</code> no es usado, como el OS provee su propio diálogo de confirmación.</li>\n<li>El argumento <code>browserWindow</code> es ignorado ya que no es posible hacer este diálogo modelo de confirmación.</li>\n</ul>\n<h2 id=\"array-de-marcadores\"><a href=\"#array-de-marcadores\">Array de marcadores</a></h2>\n<p><code>showOpenDialog</code>, <code>showOpenDialogSync</code>, <code>showSaveDialog</code>, y <code>showSaveDialogSync</code> retornarán un array <code>bookmarks</code>.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Tipo de compilación</th><th>securityScopedBookmarks boolean</th><th align=\"center\">Tipo de Retorno</th><th>Valor de Retorno</th></tr></thead><tbody><tr><td>macOS mas</td><td>True</td><td align=\"center\">Éxito</td><td><code>['LONGBOOKMARKSTRING']</code></td></tr><tr><td>macOS mas</td><td>True</td><td align=\"center\">Error</td><td><code>['']</code> (array de cadena vacía)</td></tr><tr><td>macOS mas</td><td>False</td><td align=\"center\">NA</td><td><code>[]</code> (array vacío)</td></tr><tr><td>no mas</td><td>cualquiera</td><td align=\"center\">NA</td><td><code>[]</code> (array vacío)</td></tr></tbody></table>\n<h2 id=\"páginas\"><a href=\"#páginas\">Páginas</a></h2>\n<p>En macOS, los diálogos son presentados como hojas ancladas a una ventana si se indica una referencia de <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> en el parámetro <code>browserWindow</code>, o modales si no se indica ventana.</p>\n<p>Puedes llamar a <code>BrowserWindow.getCurrentWindow().setSheetOffset(offset)</code> para cambiar el offset del cuadro de la ventana en donde las páginas fueron adjuntadas.</p>",
      "title": "dialog",
      "description": "Muestra diálogos nativos del sistema para abrir y guardar archivos, alertas, etc."
    },
    "/docs/api/structures/display": {
      "locale": "es-ES",
      "slug": "display",
      "href": "/docs/api/structures/display",
      "crowdinFileId": "256427",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/display.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"display-object\"><a href=\"#display-object\">Display Object</a></h1>\n<ul>\n<li><code>id</code> Number - Unique identifier associated with the display.</li>\n<li><code>rotation</code> Number - Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.</li>\n<li><code>scaleFactor</code> Number - Output device's pixel scale factor.</li>\n<li><code>touchSupport</code> String - Can be <code>available</code>, <code>unavailable</code>, <code>unknown</code>.</li>\n<li><code>monochrome</code> Boolean - Whether or not the display is a monochrome display.</li>\n<li><code>accelerometerSupport</code> String - Can be <code>available</code>, <code>unavailable</code>, <code>unknown</code>.</li>\n<li><code>colorSpace</code> String -  represent a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions</li>\n<li><code>colorDepth</code> Number - The number of bits per pixel.</li>\n<li><code>depthPerComponent</code> Number - The number of bits per color component.</li>\n<li><code>displayFrequency</code> Number - The display refresh rate.</li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - the bounds of the display in DIP points.</li>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a></li>\n<li><code>workArea</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - the work area of the display in DIP points.</li>\n<li><code>workAreaSize</code> <a href=\"/docs/api/structures/size\">Size</a></li>\n<li><code>internal</code> Boolean - <code>true</code> for an internal display and <code>false</code> for an external display</li>\n</ul>\n<p>The <code>Display</code> object represents a physical display connected to the system. A fake <code>Display</code> may exist on a headless system, or a <code>Display</code> may correspond to a remote, virtual display.</p>",
      "title": "Display Object",
      "description": ""
    },
    "/docs/api/dock": {
      "locale": "es-ES",
      "slug": "dock",
      "href": "/docs/api/dock",
      "crowdinFileId": "256311",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/dock.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-dock\"><a href=\"#clase-dock\">Clase: Dock</a></h2>\n<blockquote>\n<p>Controla tu aplicación en el dock de macOS</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>El siguiente ejemplo muestra como rebotar tu ícono en el dock.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.dock.bounce()\n</code></pre>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<h4 id=\"dockbouncetype-macos\"><a href=\"#dockbouncetype-macos\"><code>dock.bounce([type])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>type</code> String (opcional) - Puede ser <code>critical</code> o <code>informational</code>. Por defecto es <code>informational</code></li>\n</ul>\n<p>Devuelve <code>Integer</code> - un ID que representa la solicitud.</p>\n<p>Cuando <code>critical</code> es pasado, el ícono del punto rebotará hasta que la aplicación se vuelva activa o la petición sea cancelada.</p>\n<p>Cuando <code>informational</code> es pasado, el icono del dock rebotará por un segundo. Sin embargo, la solicitud permanece activa hasta que la aplicación se vuelta activa o la solicitud sea cancelada.</p>\n<p><strong>Nota Bene:</strong> Este método solo puede ser usada mientras la aplicación no este enfocada; cuando la aplicación está enfocada retornará -1.</p>\n<h4 id=\"dockcancelbounceid-macos\"><a href=\"#dockcancelbounceid-macos\"><code>dock.cancelBounce(id)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>id</code> Íntegro</li>\n</ul>\n<p>Cancela el rebote de <code>id</code>.</p>\n<h4 id=\"dockdownloadfinishedfilepath-macos\"><a href=\"#dockdownloadfinishedfilepath-macos\"><code>dock.downloadFinished(filePath)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n</ul>\n<p>Rebota la apilación de descargas si el archivo de camino está dentro de la carpeta de descargas.</p>\n<h4 id=\"docksetbadgetext-macos\"><a href=\"#docksetbadgetext-macos\"><code>dock.setBadge(text)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>texto</code> Cadena</li>\n</ul>\n<p>Establece la cadena para ser mostrada en el área de insignia del punto.</p>\n<h4 id=\"dockgetbadge-macos\"><a href=\"#dockgetbadge-macos\"><code>dock.getBadge()</code> <em>macOS</em></a></h4>\n<p>Devuelve <code>String</code> - La insignia cadena del punto.</p>\n<h4 id=\"dockhide-macos\"><a href=\"#dockhide-macos\"><code>dock.hide()</code> <em>macOS</em></a></h4>\n<p>Esconde el icono del punto.</p>\n<h4 id=\"dockshow-macos\"><a href=\"#dockshow-macos\"><code>dock.show()</code> <em>macOS</em></a></h4>\n<p>Devuelve <code>Promise&#x3C;void></code> - Se resuelve cuando se muestra el icono del dock.</p>\n<h4 id=\"dockisvisible-macos\"><a href=\"#dockisvisible-macos\"><code>dock.isVisible()</code> <em>macOS</em></a></h4>\n<p>Devuelve <code>Boolean</code> - Si el icono del dock es visible.</p>\n<h4 id=\"docksetmenumenu-macos\"><a href=\"#docksetmenumenu-macos\"><code>dock.setMenu(menu)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>menu</code> <a href=\"/docs/api/menu\">Menu</a></li>\n</ul>\n<p>Establece el [dock menu][dock-menu] de la aplicación.</p>\n<h4 id=\"dockgetmenu-macos\"><a href=\"#dockgetmenu-macos\"><code>dock.getMenu()</code> <em>macOS</em></a></h4>\n<p>Devuelve <code>Menu | null</code> -El [dock menu][dock-menu] de la aplicación.</p>\n<h4 id=\"dockseticonimage-macos\"><a href=\"#dockseticonimage-macos\"><code>dock.setIcon(image)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>Establece la <code>image</code> asociada con el ícono del punto.</p>",
      "title": "Clase: Dock",
      "description": "Controla tu aplicación en el dock de macOS"
    },
    "/docs/api/download-item": {
      "locale": "es-ES",
      "slug": "download-item",
      "href": "/docs/api/download-item",
      "crowdinFileId": "256313",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/download-item.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-downloaditem\"><a href=\"#clase-downloaditem\">Clase: DownloadItem</a></h2>\n<blockquote>\n<p>Control de descargas de archivos desde fuentes remotas.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>DownloadItem</code> es un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a> que representa un ítem descargado en Electron. Se utiliza en el evento <code>will-download</code> de la clase <code>Session</code>, y permite a los usuarios controlar el elemento descargado.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">/// In the main process.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.session.on(<span class=\"hljs-string\">'will-download'</span>, (event, item, webContents) => {\n  <span class=\"hljs-comment\">// Set the save path, making Electron not to prompt a save dialog.</span>\n  item.setSavePath(<span class=\"hljs-string\">'/tmp/save.pdf'</span>)\n\n  item.on(<span class=\"hljs-string\">'updated'</span>, (event, state) => {\n    <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'interrupted'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download is interrupted but can be resumed'</span>)\n    } <span class=\"hljs-keyword\">else</span> <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'progressing'</span>) {\n      <span class=\"hljs-keyword\">if</span> (item.isPaused()) {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download is paused'</span>)\n      } <span class=\"hljs-keyword\">else</span> {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Received bytes: <span class=\"hljs-subst\">${item.getReceivedBytes()}</span>`</span>)\n      }\n    }\n  })\n  item.once(<span class=\"hljs-string\">'done'</span>, (event, state) => {\n    <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'completed'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download successfully'</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Download failed: <span class=\"hljs-subst\">${state}</span>`</span>)\n    }\n  })\n})\n</code></pre>\n<h3 id=\"eventos-de-instancia\"><a href=\"#eventos-de-instancia\">Eventos de Instancia</a></h3>\n<h4 id=\"evento-updated\"><a href=\"#evento-updated\">Evento: \"updated\"</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>state</code> String - Puede ser <code>en progresso</code> o <code>interrumpido</code>.</li>\n</ul>\n<p>Aparece cuando la descara ha sido actualizada y no está terminada.</p>\n<p>El <code>state</code> puede ser uno de los siguientes:</p>\n<ul>\n<li><code>progressing</code> - La descarga está en proceso.</li>\n<li><code>interrupted</code> - La descarga ha sido interrumpida y puede ser reanudada.</li>\n</ul>\n<h4 id=\"evento-done\"><a href=\"#evento-done\">Evento: \"done\"</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>state</code> String - Puede ser <code>completado</code>, <code>cancelado</code> o <code>interrumpido</code>.</li>\n</ul>\n<p>Emitido cuando la descarga está en un estado terminal. Esto incluye una descarga completa, una descarga cancelada (a través de <code>downloadItem.cancel()</code>), y descargas interrumpidas que no pueden ser reanudadas.</p>\n<p>El <code>state</code> puede ser uno de los siguientes:</p>\n<ul>\n<li><code>completed</code> - La descarga se ha completado con éxito.</li>\n<li><code>cancelled</code> - La descarga ha sido cancelada.</li>\n<li><code>interrupted</code> - La descarga ha sido interrumpida y no puede ser reanudada.</li>\n</ul>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<p>El objeto <code>downloadItem</code> tiene los siguientes métodos:</p>\n<h4 id=\"downloaditemsetsavepathpath\"><a href=\"#downloaditemsetsavepathpath\"><code>downloadItem.setSavePath(path)</code></a></h4>\n<ul>\n<li><code>path</code> Cadena - Configura la ruta del archivo de guardado del elemento descargado.</li>\n</ul>\n<p>La API solo está disponible en la función callback <code>will-download</code> de la sesión. If <code>path</code> doesn't exist, Electron will try to make the directory recursively. Si el usuario no establece una ruta para guardar a través de la API, Electron usará la rutina original para determinar la ruta para guardar; esto usualmente genera un cuadro de dialogo para guardar.</p>\n<h4 id=\"downloaditemgetsavepath\"><a href=\"#downloaditemgetsavepath\"><code>downloadItem.getSavePath()</code></a></h4>\n<p>Returns <code>String</code> - The save path of the download item. This will be either the path set via <code>downloadItem.setSavePath(path)</code> or the path selected from the shown save dialog.</p>\n<h4 id=\"downloaditemsetsavedialogoptionsoptions\"><a href=\"#downloaditemsetsavedialogoptionsoptions\"><code>downloadItem.setSaveDialogOptions(options)</code></a></h4>\n<ul>\n<li><code>options</code> SaveDialogOptions - Establece las opciones del diálogo de guardar archivos. Este objeto tiene la misma propiedad como el parámetro <code>options</code> de <a href=\"/docs/api/dialog\"><code>dialog.showSaveDialog()</code></a>.</li>\n</ul>\n<p>This API allows the user to set custom options for the save dialog that opens for the download item by default. La API solo está disponible en la función callback <code>will-download</code> de la sesión.</p>\n<h4 id=\"downloaditemgetsavedialogoptions\"><a href=\"#downloaditemgetsavedialogoptions\"><code>downloadItem.getSaveDialogOptions()</code></a></h4>\n<p>Devuelve <code>SaveDialogOptions</code> - Devuelve el objeto previamente establecido por <code>downloadItem.setSaveDialogOptions(options)</code>.</p>\n<h4 id=\"downloaditempause\"><a href=\"#downloaditempause\"><code>downloadItem.pause()</code></a></h4>\n<p>Pausa la descarga.</p>\n<h4 id=\"downloaditemispaused\"><a href=\"#downloaditemispaused\"><code>downloadItem.isPaused()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la ventana esta pausada o no.</p>\n<h4 id=\"downloaditemresume\"><a href=\"#downloaditemresume\"><code>downloadItem.resume()</code></a></h4>\n<p>Reanuda la descarga que ha sido pausada.</p>\n<p><strong>Note:</strong> To enable resumable downloads the server you are downloading from must support range requests and provide both <code>Last-Modified</code> and <code>ETag</code> header values. De lo contrario, <code>resume()</code> descartará los bytes recibidos anteriormente y reiniciará la descarga desde el principio.</p>\n<h4 id=\"downloaditemcanresume\"><a href=\"#downloaditemcanresume\"><code>downloadItem.canResume()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si se puede reanudar la descarga.</p>\n<h4 id=\"downloaditemcancel\"><a href=\"#downloaditemcancel\"><code>downloadItem.cancel()</code></a></h4>\n<p>Cancela la operación de la descarga.</p>\n<h4 id=\"downloaditemgeturl\"><a href=\"#downloaditemgeturl\"><code>downloadItem.getURL()</code></a></h4>\n<p>Devuelve <code>String</code> - La URL origen de donde el elemento se descarga.</p>\n<h4 id=\"downloaditemgetmimetype\"><a href=\"#downloaditemgetmimetype\"><code>downloadItem.getMimeType()</code></a></h4>\n<p>Devuelve <code>String</code> - El tipo de archivo.</p>\n<h4 id=\"downloaditemhasusergesture\"><a href=\"#downloaditemhasusergesture\"><code>downloadItem.hasUserGesture()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la descarga tiene o no gestos de usuario.</p>\n<h4 id=\"downloaditemgetfilename\"><a href=\"#downloaditemgetfilename\"><code>downloadItem.getFilename()</code></a></h4>\n<p>Devuelve <code>String</code> - El nombre de archivo del elemento descargado.</p>\n<p><strong>Note:</strong> The file name is not always the same as the actual one saved in local disk. Si el usuario cambia el nombre del archivo en el cuadro de diálogo de guardado de la descarga, el nombre actual del archivo guardado será diferente.</p>\n<h4 id=\"downloaditemgettotalbytes\"><a href=\"#downloaditemgettotalbytes\"><code>downloadItem.getTotalBytes()</code></a></h4>\n<p>Devuelve <code>Integer</code> - El tamaño total en bytes del elemento descargado.</p>\n<p>Si se desconoce el tamaño, devuelve 0.</p>\n<h4 id=\"downloaditemgetreceivedbytes\"><a href=\"#downloaditemgetreceivedbytes\"><code>downloadItem.getReceivedBytes()</code></a></h4>\n<p>Devuelve <code>Integer</code> - Los bytes recibidos del elemento descargado.</p>\n<h4 id=\"downloaditemgetcontentdisposition\"><a href=\"#downloaditemgetcontentdisposition\"><code>downloadItem.getContentDisposition()</code></a></h4>\n<p>Devuelve <code>String</code> - El campo Content-Disposition desde la cabecera de respuesta.</p>\n<h4 id=\"downloaditemgetstate\"><a href=\"#downloaditemgetstate\"><code>downloadItem.getState()</code></a></h4>\n<p>Returns <code>String</code> - The current state. Can be <code>progressing</code>, <code>completed</code>, <code>cancelled</code> or <code>interrupted</code>.</p>\n<p><strong>Note:</strong> The following methods are useful specifically to resume a <code>cancelled</code> item when session is restarted.</p>\n<h4 id=\"downloaditemgeturlchain\"><a href=\"#downloaditemgeturlchain\"><code>downloadItem.getURLChain()</code></a></h4>\n<p>Devuelve <code>String[]</code> - La cadena URL completa del elemento incluyendo cualquier redirección.</p>\n<h4 id=\"downloaditemgetlastmodifiedtime\"><a href=\"#downloaditemgetlastmodifiedtime\"><code>downloadItem.getLastModifiedTime()</code></a></h4>\n<p>Devuelve <code>String</code> - El valor de cabecera Last-Modified.</p>\n<h4 id=\"downloaditemgetetag\"><a href=\"#downloaditemgetetag\"><code>downloadItem.getETag()</code></a></h4>\n<p>Devuelve <code>String</code> - El valor de cabecera Etag.</p>\n<h4 id=\"downloaditemgetstarttime\"><a href=\"#downloaditemgetstarttime\"><code>downloadItem.getStartTime()</code></a></h4>\n<p>Devuelve <code>Double</code> - Número de segundos desde el UNIX epoch cuando se inició la descarga.</p>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<h4 id=\"downloaditemsavepath\"><a href=\"#downloaditemsavepath\"><code>downloadItem.savePath</code></a></h4>\n<p>Una propiedad <code>String</code> que determina la ruta del archivo de guardado del elemento de descarga.</p>\n<p>La propiedad solo esta disponible en la función callback <code>will-download</code> de la sesión. Si el usuario no establece la ruta de guardado a través de la propiedad, Electron usará la rutina original para determinar la ruta de guardado; esto suele generar un cuadro de diálogo para guardar.</p>",
      "title": "Clase: DownloadItem",
      "description": "Control de descargas de archivos desde fuentes remotas."
    },
    "/docs/tutorial/electron-timelines": {
      "locale": "es-ES",
      "slug": "electron-timelines",
      "href": "/docs/tutorial/electron-timelines",
      "crowdinFileId": "256197",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/electron-timelines.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"tiempos-de-lanzamientos-de-electron\"><a href=\"#tiempos-de-lanzamientos-de-electron\">Tiempos de lanzamientos de Electron</a></h1>\n<p>Notas especiales:</p>\n<ul>\n<li>Las fechas <code>-beta.1</code> y <code>stable</code> son nuestras fechas de lanzamiento sólidas.</li>\n<li>Nos esforzamos por liberar versiones beta semanalmente, sin embargo a menudo liberamos mas betas que las programadas.</li>\n<li>Todas las fechas son nuestras metas pero puede haber razones para ajustar el plazo de la versión estable, tales como errores de seguridad.</li>\n<li>Echa un vistazo a <a href=\"https://electronjs.org/blog/electron-5-0-timeline\">5.0.0 Timeline blog post</a> para información acerca de publicación de nuestras fechas de lanzamiento.</li>\n<li>Desde Electron 6.0, hemos estado apuntando a todas las demás versiones de Chromium y lanzando nuestra versión estable el mismo día que Chrome. You can reference Chromium's release schedule <a href=\"https://chromiumdash.appspot.com/schedule\">here</a>. See <a href=\"https://www.electronjs.org/blog/12-week-cadence\">Electron's new release cadence blog post</a> for more details on our release schedule.</li>\n<li>Electron 15.0 only will include a special Alpha release. Starting in Electron 16.0, we will release on an 8-week cadence. See <a href=\"https://www.electronjs.org/blog/8-week-cadence\">Electron's new 8-week cadence blog post</a> for more details.</li>\n</ul>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Electron</th><th>Alfa</th><th>Beta</th><th>Estable</th><th>Chrome</th><th>Nodo</th></tr></thead><tbody><tr><td>2.0.0</td><td>--</td><td>2018-Feb-21</td><td>2018-May-01</td><td>M61</td><td>v8.9</td></tr><tr><td>3.0.0</td><td>--</td><td>2018-Jun-21</td><td>2018-Sep-18</td><td>M66</td><td>v10.2</td></tr><tr><td>4.0.0</td><td>--</td><td>2018-Oct-11</td><td>2018-Dec-20</td><td>M69</td><td>v10.11</td></tr><tr><td>5.0.0</td><td>--</td><td>2019-Jan-22</td><td>2019-Apr-24</td><td>M73</td><td>v12.0</td></tr><tr><td>6.0.0</td><td>--</td><td>2019-May-01</td><td>2019-Jul-30</td><td>M76</td><td>v12.4</td></tr><tr><td>7.0.0</td><td>--</td><td>2019-Aug-01</td><td>2019-Oct-22</td><td>M78</td><td>v12.8</td></tr><tr><td>8.0.0</td><td>--</td><td>2019-Oct-24</td><td>2020-Feb-04</td><td>M80</td><td>v12.13</td></tr><tr><td>9.0.0</td><td>--</td><td>2020-Feb-06</td><td>2020-May-19</td><td>M83</td><td>v12.14</td></tr><tr><td>10.0.0</td><td>--</td><td>2020-May-21</td><td>2020-Aug-25</td><td>M85</td><td>v12.16</td></tr><tr><td>11.0.0</td><td>--</td><td>2020-Aug-27</td><td>2020-Nov-17</td><td>M87</td><td>v12.18</td></tr><tr><td>12.0.0</td><td>--</td><td>2020-Nov-19</td><td>2021-Mar-02</td><td>M89</td><td>v14.16</td></tr><tr><td>13.0.0</td><td>--</td><td>2021-Mar-04</td><td>2021-May-25</td><td>M91</td><td>v14.16</td></tr><tr><td>14.0.0</td><td>--</td><td>2021-May-27</td><td>2021-Aug-31</td><td>M93</td><td>v14.17</td></tr><tr><td>15.0.0</td><td>2021-Jul-20</td><td>2021-Sep-01</td><td>2021-Sep-21</td><td>M94</td><td>v16.5</td></tr><tr><td>16.0.0</td><td>--</td><td>23-Sept-2021</td><td>2021-Nov-16</td><td>M96</td><td>TBD</td></tr></tbody></table>",
      "title": "Tiempos de lanzamientos de Electron",
      "description": ""
    },
    "/docs/tutorial/electron-versioning": {
      "locale": "es-ES",
      "slug": "electron-versioning",
      "href": "/docs/tutorial/electron-versioning",
      "crowdinFileId": "256199",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/electron-versioning.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"versionado-de-electron\"><a href=\"#versionado-de-electron\">Versionado de Electron</a></h1>\n<blockquote>\n<p>Una mirada detallada en la política e implementación de las versiones.</p>\n</blockquote>\n<p>A partir de la versión 2.0.0, Electron sigue <a href=\"#semver\">SemVer</a>. The following command will install the most recent stable build of Electron:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron\n</code></pre>\n<p>Para actualizar un proyecto existente para que use la última versión estable:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron@latest\n</code></pre>\n<h2 id=\"versión-1x\"><a href=\"#versión-1x\">Versión 1.x</a></h2>\n<p>Las versiones <em>&#x3C; 2.0</em> de Electron no se ajustaban a las especificaciones de <a href=\"https://semver.org\">SemVer</a>: las versiones major correspondían a los cambios en la API del usuario final, las versiones minor correspondían a las versiones major de Chromium y las versiones patch correspondían a las nuevas características y correcciones de errores. Mientras que es conveniente para los desarrolladores combinar características, crea problemas para los desarrolladores de aplicaciones orientadas al cliente. Los ciclos de pruebas QA de aplicaciones importantes como Slack, Stride, Teams, Skype, VS Code, Atom, y Desktop pueden ser muy completos y la estabilidad es un resultado muy deseado. Hay un riesgo grande adoptando nuevas características mientras se está tratando de asimilar las soluciones de errores.</p>\n<p>Aquí hay un ejemplo de la estrategia 1.x:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-0.png\" alt=\"Versiones 1.x\"></p>\n<p>Una aplicación desarrollada con <code>1.8.1</code> no puede tener la solución de errores <code>1.8.3</code> sin asimilar las características <code>1.8.2</code>, o portando la solución y manteniendo un nueva línea de publicación.</p>\n<h2 id=\"versión-20-y-superiores\"><a href=\"#versión-20-y-superiores\">Versión 2.0 y superiores</a></h2>\n<p>There are several major changes from our 1.x strategy outlined below. Each change is intended to satisfy the needs and priorities of developers/maintainers and app developers.</p>\n<ol>\n<li>Uso estricto de SemVer</li>\n<li>Introducción de las etiquetas de semver-compliant <code>-beta</code></li>\n<li>Introducción a <a href=\"https://conventionalcommits.org/\">mensajes de compromiso convencionales</a></li>\n<li>Ramas estabilizadoras bien definidas</li>\n<li>La rama <code>master</code> no tiene versiones: solo las ramas de estabilización contienen información de las versiones</li>\n</ol>\n<p>Reseñamos en detalle cómo funcionan las ramas git, cómo funcionan las etiquetas de npm, qué es lo que los desarrolladores esperan ver, y como se pueden portar cambios a versiones anteriores.</p>\n<h1 id=\"semver\"><a href=\"#semver\">SemVer</a></h1>\n<p>Desde la versión 2.0 en adelante, Electron seguirá SemVer.</p>\n<p>A continuación una tabla que mapea explícitamente los tipos de cambios con sus correspondiente categoría de SemVer (p. e. Major, Minor, Patch).</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Incrementos de versiones major</th><th>Incrementos de version minor</th><th>Incrementos en la versión patch</th></tr></thead><tbody><tr><td>Cambios incompatibles con la API de Electron</td><td>Cambios compatibles de la API de Electron</td><td>Solución a fallos de Electron</td></tr><tr><td>Actualizaciones en la version major de Node.js</td><td>Actualizaciones en la version minor de Node.js</td><td>Actualizaciones en la version patch de Node.js</td></tr><tr><td>Actualización de versiones de Chromium</td><td></td><td>parches de chromium relacionados con soluciones de problemas</td></tr></tbody></table>\n<p>Note that most Chromium updates will be considered breaking. Fixes that can be backported will likely be cherry-picked as patches.</p>\n<h1 id=\"ramas-de-estabilización\"><a href=\"#ramas-de-estabilización\">Ramas de estabilización</a></h1>\n<p>Stabilization branches are branches that run parallel to master, taking in only cherry-picked commits that are related to security or stability. These branches are never merged back to master.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-1.png\" alt=\"Ramas de estabilización\"></p>\n<p>Desde Electron 8, las ramas de estabilización son siempre de las líneas de versión <strong>mayor</strong> y se nombran contra la siguiente plantilla <code>$MAJOR-x-y</code> p.e. <code>8-x-y</code>.  Antes de eso nosotros usabamos la lineas de version <strong>minor</strong> y las nombrabamos como <code>$MAJOR-$MINOR-x</code> p.e. <code>2-0-x</code></p>\n<p>Permitimos a varias ramas estabilizadoras existir simultaneamente e intentamos soportar por lo menos dos en paralelo todo el tiempo, los arreglos de seguridad por la puerta trasera son necesarios. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-2.png\" alt=\"Múltiples Ramas Estables\"></p>\n<p>Líneas antiguas no serán soportadas por GitHub, pero otros grupos pueden tomar la propiedad y estabilizar por la puerta trasera y hacer arreglos de seguridad por si mismos. Incitamos que no se haga esto, pero reconocemos que haría la vida de varios desarrolladores de aplicación más fácil.</p>\n<h1 id=\"publicaciones-beta-y-arreglo-de-problemas\"><a href=\"#publicaciones-beta-y-arreglo-de-problemas\">Publicaciones beta y arreglo de problemas</a></h1>\n<p>Los desarrolladores quieren saber cuáles publicaciones son <em>seguras</em>. Hasta características que parecen inocentes pueden introducir grandes regresiones en aplicaciones complejas. Al mismo tiempo, quedarse con una versión arreglada es peligroso porque está ignorando parches de seguridad y arreglos de errores que pudieron salir desde su versión. Nuestra meta es permitir que el siguiente rango semver estandar en <code>package.json</code> :</p>\n<ul>\n<li>Usar <code>~2.0.0</code> para admitir solo arreglo relacionados con la estabilidad o seguridad de su publicación <code>2.0.0</code>.</li>\n<li>Use <code>^2.0.0</code> para admitir características no frágiles y <em>razonablemente estables</em> que trabajen tanto en seguridad como en arreglo de errores.</li>\n</ul>\n<p>Lo que es importante del segundo punto es que las aplicaciones que usan <code>^</code> aún deben ser capaces de esperar cierto nivel de estabilidad. Para lograr esto, SemVer permite un <em>identificador de pre-lanzamiento</em> para indicar que una versión en particular no es <em>segura</em> o <em>estable</em>.</p>\n<p>Sin importar lo que elija, periódicamente tendrá que golpear su versión en su <code>package.json</code> como cambios que son un hecho en la vida útil de Chromium.</p>\n<p>El proceso es el siguiente:</p>\n<ol>\n<li>Todos los nuevos lanzamientos de la linea major y minor comienzan con una series de betas indicado por la etiqueta de pre-lanzamiento <code>beta.N</code> de SemVer, p.e. <code>2.0.0-beta.1</code>. Después de la primera beta, las versiones beta que la sigan deben cumplir con las siguientes condiciones:<ol>\n<li>El cambio es compatible con API hacia atrás (se permiten las deprecaciones)</li>\n<li>El riesgo de cumplir con nuestro cronograma de estabilidad debe ser bajo.</li>\n</ol></li>\n<li>Si es necesario hacer cambios permitidos una vez que la versión es beta, se aplican los cambios y la etiqueta prerelease is encrementado, Por ejemplo <code>2.0.0-beta.2</code>.</li>\n<li>Si una versión beta en particular es <em>generally regarded</em> como estable, será reenviado como una versión estable, cambiando sólo la información de la versión. p.e. <code>2.0.0</code>. Después le primera versión estable, todos los cambios deben ser compatibles con versiones anteriores, correcciones de error o de seguridad.</li>\n<li>Si correcciones futura de errores o parches de seguridad se hacen deben una vez que la versión sea estable, esas correcciones son aplicadas y la versión <em>patch</em> es incrementada, Por ejemplo <code>2.0.1</code>.</li>\n</ol>\n<p>Específicamente, lo anterior significa:</p>\n<ol>\n<li>Admitir cambios que no generen rompimiento en la API antes de la Semana 3 en el ciclo beta está bien, incluso si esos cambios tienen potencial de causar efectos secundarios moderados.</li>\n<li>Admitting feature-flagged changes, that do not otherwise alter existing code paths, at most points in the beta cycle is okay. Users can explicitly enable those flags in their apps.</li>\n<li>Admitting features of any sort after Week 3 in the beta cycle is 👎 without a very good reason.</li>\n</ol>\n<p>Por cada cambio mayor y menor, debería esperar ver algo como lo siguiente:</p>\n<pre><code class=\"hljs language-plaintext\">2.0.0-beta.1\n2.0.0-beta.2\n2.0.0-beta.3\n2.0.0\n2.0.1\n2.0.2\n</code></pre>\n<p>Un ejemplo del ciclo de vida en imágenes:</p>\n<ul>\n<li>A new release branch is created that includes the latest set of features. It is published as <code>2.0.0-beta.1</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-3.png\" alt=\"Nueva Rama de Lanzamiento\"></li>\n<li>A bug fix comes into master that can be backported to the release branch. The patch is applied, and a new beta is published as <code>2.0.0-beta.2</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-4.png\" alt=\"Corrección de errores y Backport a Beta\"></li>\n<li>El beta es considerado <em>generalmente estable</em> y es publicado de nuevo como no-beta con el nombre <code>2.0.0</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-5.png\" alt=\"Beta a Estable\"></li>\n<li>Later, a zero-day exploit is revealed and a fix is applied to master. We backport the fix to the <code>2-0-x</code> line and release <code>2.0.1</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-6.png\" alt=\"Backports de seguridad\"></li>\n</ul>\n<p>Algunos ejemplos de como varios rangos SemVer recogerán los nuevos lanzamientos:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-7.png\" alt=\"Semvers y lanzamientos\"></p>\n<h1 id=\"funciones-faltantes-alfas\"><a href=\"#funciones-faltantes-alfas\">Funciones faltantes: Alfas</a></h1>\n<p>Nuestra estrategia tiene algunas compensaciones, que por ahora sentimos que son apropiadas. Más importante que las nuevas características en la maestra pueden tomar un tiempo antes de alcanzar una linea de lanzamiento estable. Si quiere tratar nuevas características inmediatamente, tendrá que construir Electron usted mismo.</p>\n<p>Como consideración futura, podemos introducir uno o ambos de los siguientes:</p>\n<ul>\n<li>lanzamientos alpha que tiene perdida de estabilidad se vuelven beta; por ejemplo, le permitiría admitir nuevas características mientras un canal de estabilidad está en <em>alpha</em></li>\n</ul>\n<h1 id=\"señales-de-característica\"><a href=\"#señales-de-característica\">Señales de característica</a></h1>\n<p>Banderas de características son prácticas comunes en Chromium, y son bien establecidas en el ecosistema de diseño web. En el contexto de Electron, banderas de características o <strong>ramas suaves</strong> deben seguir las siguientes propiedades:</p>\n<ul>\n<li>está habilitado/deshabilitado en tiempo de ejecución o en tiempo de construcción, no soportamos el concepto de una bandera de característica alcance por solicitud</li>\n<li>segmenta completamente nuevos y viejos rutas de códigos; refactorizando viejo código para soportar nuevas características <em>viola</em> el contrato de las banderas de características</li>\n<li>las banderas de características eventualmente son removidas después de que la característica es lanzada</li>\n</ul>\n<h1 id=\"commits-semánticos\"><a href=\"#commits-semánticos\">Commits semánticos</a></h1>\n<p>Buscamos aumentar la claridad en todos los niveles del proceso de actualización y publicación. Comenzando con <code>2.0.0</code> necesitaremos retirar solicitudes adheridas a la especificación <a href=\"https://conventionalcommits.org/\">Conventional Commits</a>, la cual se puede resumir como:</p>\n<ul>\n<li>\n<p>Los commits que resultarían en una versión <strong>major</strong> de SemVer deben empezar sus cuerpos con <code>BREAKING CHANGE:</code>.</p>\n</li>\n<li>\n<p>Los commits que resultarían en una versión <strong>minor</strong> de SemVer debe empezar con <code>feat:</code>.</p>\n</li>\n<li>\n<p>Los commits que resultarían en una versión <strong>patch</strong> de SemVer deben empezar con <code>fix:</code>.</p>\n</li>\n<li>\n<p>We allow squashing of commits, provided that the squashed message adheres to the above message format.</p>\n</li>\n<li>\n<p>Es aceptable que algunos compromisos en una solicitud de pull no incluyan un prefijo semántico, siempre que el título de pull request contenga un mensaje semántico significativo.</p>\n</li>\n</ul>\n<h1 id=\"versioned-master\"><a href=\"#versioned-master\">Versioned <code>master</code></a></h1>\n<ul>\n<li>La rama <code>master</code> siempre contendrá la siguiente versión mayor <code>X.0.0-nightly.DATE</code> en su <code>package.json</code></li>\n<li>Las ramas de lanzamiento no se fusionan nuevamente con la rama maestra</li>\n<li>Las ramas de versión _do_contienen la versión correcta en su <code>package.json</code></li>\n<li>As soon as a release branch is cut for a major, master must be bumped to the next major.  I.e. <code>master</code> is always versioned as the next theoretical release branch</li>\n</ul>",
      "title": "Versionado de Electron",
      "description": "Una mirada detallada en la política e implementación de las versiones."
    },
    "/docs/development/electron-vs-nwjs": {
      "locale": "es-ES",
      "slug": "electron-vs-nwjs",
      "href": "/docs/development/electron-vs-nwjs",
      "crowdinFileId": "256155",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/electron-vs-nwjs.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"diferencias-técnicas-entre-electron-y-nwjs\"><a href=\"#diferencias-técnicas-entre-electron-y-nwjs\">Diferencias técnicas entre Electron y NW.js</a></h1>\n<p>Como <a href=\"https://nwjs.io/\">NW.js</a>, Electron provee una plataforma para escribir aplicaciones de escritorio con tecnologías web. Ambas plataformas permiten a los desarrolladores usar HTML, JavaScript y Node.js. En la superficie, parecen muy similares.</p>\n<p>Sin embargo, hay diferencias fundamentales ente los dos proyectos que hacen a Electron un producto completamente separado de NW.js.</p>\n<h2 id=\"1-entrada-de-la-aplicación\"><a href=\"#1-entrada-de-la-aplicación\">1) Entrada de la aplicación</a></h2>\n<p>En NW.js, el principal punto de entrada puede ser una pagina web HTML. En ese caso, NW.js abrirá el punto de entrada dado en una ventana del navegador.</p>\n<p>En Electron, el punto de entrada es siempre un script JavaScript. En lugar de proveer directamente un URL, creas manualmente una ventana del navegador y cargas un archivo HTML usando la API. También necesitas escuchar los eventos de la ventana para decidir cuándo cerrar de la aplicación.</p>\n<p>Electron trabaja más como el runtime de Node.js. Las APIs de Electron son de más bajo nivel, así que puedes usarlas para las pruevas del navegador en lugar de <a href=\"https://phantomjs.org/\">PhantomJS</a>.</p>\n<h2 id=\"2-integración-de-node\"><a href=\"#2-integración-de-node\">2) Integración de Node</a></h2>\n<p>En NW.js, la integración de Node en paginas web requiere parchear Chromium para trabajar, mientras en Electron nosotros elegimos una forma diferente de integrar le bucle <code>libuv</code> con el bucle de mensaje de cada plataforma para evitar parchear Chromium. Mira el código <a href=\"https://github.com/electron/electron/tree/main/lib/common\"><code>node_bindings</code></a> para ver cómo se hizo eso.</p>\n<h2 id=\"3-contextos-de-javascript\"><a href=\"#3-contextos-de-javascript\">3) Contextos de JavaScript</a></h2>\n<p>Si eres un usuario experimentado de NW. js, deberías estar familiarizado con el concepto de contexto de Node y el contexto Web. Estos conceptos fueron inventados debido a como NW.js fue implementado.</p>\n<p>Mediante el uso de la característica <a href=\"https://github.com/nodejs/node-v0.x-archive/commit/756b622\">multi-context</a> de Node, Electron no introduce un nuevo contexto JavaScript en las páginas web.</p>\n<p>Nota: NW.js ha apoyado de manera opcional multi-contexto desde la versión 0.13.</p>\n<h2 id=\"4-soporte-heredado\"><a href=\"#4-soporte-heredado\">4) Soporte Heredado</a></h2>\n<p>NW.js aún ofrece una \"versión antigua\" que soporta Windows XP. No recibe actualizaciones de seguridad.</p>\n<p>Dado que los fabricantes de hardware, Microsoft, Chromium y Node.js no han lanzado ni siquiera actualizaciones de seguridad críticas para ese sistema, tenemos que advertirte que usando Windows XP es salvajemente inseguro y francamente irresponsable.</p>\n<p>Sin embargo, entendemos que los requisitos fuera de nuestra imaginación más salvaje pueden existir, así que si estás buscando algo como Electron que corra en Windows Xp, la versión antigua de NW.js puede ser la adecuada para ti.</p>\n<h2 id=\"5-características\"><a href=\"#5-características\">5) Características</a></h2>\n<p>Hay numerosas diferencias en la cantidad de características soportadas. Electron tiene una comunidad más grande, con más aplicaciones en producción usándolo y <a href=\"https://www.npmjs.com/search?q=electron\">una mayor cantidad de módulos userland disponibles en npm</a>.</p>\n<p>Como ejemplo, Electron tiene soporte integrado para actualizaciones automáticas e incontables herramientas que facilitan la creación de instaladores. Como ejemplo a favor de NW.js, NW.js soporta más APIs de <code>Chrome.*</code> para el desarrollo de aplicaciones Chrome.</p>\n<p>Naturalmente, nosotros creemos que Electron es la mejor plataforma para aplicaciones de producción pulidas construidas con tecnologías web (como Visual Studio Code, Slack, o Facebook Messenger); sin embargo, queremos ser justos con nuestros amigos de las tecnología web. Si tienes necesidades de características que Electron no cumple, puede que quieras probar NW.js.</p>",
      "title": "Diferencias técnicas entre Electron y NW.js",
      "description": ""
    },
    "/docs/api/environment-variables": {
      "locale": "es-ES",
      "slug": "environment-variables",
      "href": "/docs/api/environment-variables",
      "crowdinFileId": "256315",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/environment-variables.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"variables-de-entorno\"><a href=\"#variables-de-entorno\">Variables de entorno</a></h1>\n<blockquote>\n<p>Configuración y comportamiento de la aplicación de control sin cambiar el código.</p>\n</blockquote>\n<p>Ciertos comportamientos de Electron están controlados por variables de entorno debido a que son inicializadas antes que las flags de la línea de comandos y que el código de la applicación.</p>\n<p>Ejemplo de shell POSIX:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">export</span> ELECTRON_ENABLE_LOGGING=<span class=\"hljs-literal\">true</span>\n$ electron\n</code></pre>\n<p>Ejemplo de la consola de Windows:</p>\n<pre><code class=\"hljs language-powershell\">> set ELECTRON_ENABLE_LOGGING=true\n> electron\n</code></pre>\n<h2 id=\"variables-de-producción\"><a href=\"#variables-de-producción\">Variables de producción</a></h2>\n<p>Las siguientes variables de entorno están diseñadas principalmente para usarse en los módulos de ejecución en las aplicaciones preconfiguradas de Electron.</p>\n<h3 id=\"node_options\"><a href=\"#node_options\"><code>NODE_OPTIONS</code></a></h3>\n<p>Electron incluye soporte para un subconjunto de <a href=\"https://nodejs.org/api/cli.html#cli_node_options_options\"><code>NODE_OPTIONS</code></a> de Node. La mayoría son soportadas con la excepción de aquellos que entran en conflicto con el uso de BoringSSL de Chromium.</p>\n<p>Ejemplo:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">export</span> NODE_OPTIONS=<span class=\"hljs-string\">\"--no-warnings --max-old-space-size=2048\"</span>\n</code></pre>\n<p>Las opciones no respaldadas son:</p>\n<pre><code class=\"hljs language-sh\">--use-bundled-ca\n--force-fips\n--<span class=\"hljs-built_in\">enable</span>-fips\n--openssl-config\n--use-openssl-ca\n</code></pre>\n<p><code>NODE_OPTIONS</code> están explícitamente deshabilitadas en las aplicaciones empaquetadas, excepto para lo siguiente:</p>\n<pre><code class=\"hljs language-sh\">--max-http-header-size\n--http-parser\n</code></pre>\n<h3 id=\"google_api_key\"><a href=\"#google_api_key\"><code>GOOGLE_API_KEY</code></a></h3>\n<p>El soporte de geolocalización en Electron requiere el uso del servicio web de Google Cloud Platform. Para habilitar esta función, adquiera una <a href=\"https://developers.google.com/maps/documentation/geolocation/get-api-key\">Google API key</a> y coloque el siguiente código en su archivo de proceso principal, antes de abrir cualquier ventana de buscador que vaya a realizar solicitudes de geolocalización:</p>\n<pre><code class=\"hljs language-javascript\">process.env.GOOGLE_API_KEY = <span class=\"hljs-string\">'TU_CLAVE_AQUI'</span>\n</code></pre>\n<p>Por defecto, una clave API de Google recientemente generada podría no tener permitido hacer solicitudes de geolocalización. Para habilitar el servicio web de geolocalización para su proyecto, habilítelo a través de la <a href=\"https://console.cloud.google.com/apis/library\">API library</a>.</p>\n<p>N.B. You will need to add a <a href=\"https://cloud.google.com/billing/docs/how-to/payment-methods#add_a_payment_method\">Billing Account</a> to the project associated to the API key for the geolocation webservice to work.</p>\n<h3 id=\"electron_no_asar\"><a href=\"#electron_no_asar\"><code>ELECTRON_NO_ASAR</code></a></h3>\n<p>Disables ASAR support. This variable is only supported in forked child processes and spawned child processes that set <code>ELECTRON_RUN_AS_NODE</code>.</p>\n<h3 id=\"electron_run_as_node\"><a href=\"#electron_run_as_node\"><code>ELECTRON_RUN_AS_NODE</code></a></h3>\n<p>Inicia el proceso como un proceso normal de Node.js.</p>\n<p>En este modo, podrás ser capaz de pasar <a href=\"https://nodejs.org/api/cli.html\">opciones cli</a> a Node.js como lo harías cuando corres el ejecutable normal de Node.js, con la excepción de las siguientes banderas:</p>\n<ul>\n<li>\"--openssl-config\"</li>\n<li>\"--use-bundled-ca\"</li>\n<li>\"--use-openssl-ca\",</li>\n<li>\"--force-fips\"</li>\n<li>\"--enable-fips\"</li>\n</ul>\n<p>These flags are disabled owing to the fact that Electron uses BoringSSL instead of OpenSSL when building Node.js' <code>crypto</code> module, and so will not work as designed.</p>\n<h3 id=\"electron_no_attach_console-windows\"><a href=\"#electron_no_attach_console-windows\"><code>ELECTRON_NO_ATTACH_CONSOLE</code> <em>Windows</em></a></h3>\n<p>No se adjunta a la sesión de la consola actual.</p>\n<h3 id=\"electron_force_window_menu_bar-linux\"><a href=\"#electron_force_window_menu_bar-linux\"><code>ELECTRON_FORCE_WINDOW_MENU_BAR</code> <em>Linux</em></a></h3>\n<p>No utilizar la barra de menú global en Linux.</p>\n<h3 id=\"electron_trash-linux\"><a href=\"#electron_trash-linux\"><code>ELECTRON_TRASH</code> <em>Linux</em></a></h3>\n<p>Set the trash implementation on Linux. Por defecto es <code>gio</code>.</p>\n<p>Opciones:</p>\n<ul>\n<li><code>gvfs-trash</code></li>\n<li><code>trash-cli</code></li>\n<li><code>kioclient5</code></li>\n<li><code>kioclient</code></li>\n</ul>\n<h2 id=\"variables-de-desarrollo\"><a href=\"#variables-de-desarrollo\">Variables de desarrollo</a></h2>\n<p>Las siguientes variables de entorno están principalmente diseñadas para propósitos de desarrollo y depuración.</p>\n<h3 id=\"electron_enable_logging\"><a href=\"#electron_enable_logging\"><code>ELECTRON_ENABLE_LOGGING</code></a></h3>\n<p>Prints Chromium's internal logging to the console.</p>\n<p>Setting this variable is the same as passing <code>--enable-logging</code> on the command line. For more info, see <code>--enable-logging</code> in <a href=\"/docs/api/command-line-switches#enable-loggingfile\">command-line switches</a>.</p>\n<h3 id=\"electron_log_file\"><a href=\"#electron_log_file\"><code>ELECTRON_LOG_FILE</code></a></h3>\n<p>Sets the file destination for Chromium's internal logging.</p>\n<p>Setting this variable is the same as passing <code>--log-file</code> on the command line. For more info, see <code>--log-file</code> in <a href=\"/docs/api/command-line-switches#log-filepath\">command-line switches</a>.</p>\n<h3 id=\"electron_debug_drag_regions\"><a href=\"#electron_debug_drag_regions\"><code>ELECTRON_DEBUG_DRAG_REGIONS</code></a></h3>\n<p>Agrega coloración a regiones arrastrables en <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a> en macOS - Las regiones que se pueden arrastrar se colorearán en verde y las regiones que no se pueden arrastrar se colorearán en rojo para facilitar la depuración.</p>\n<h3 id=\"electron_debug_notifications\"><a href=\"#electron_debug_notifications\"><code>ELECTRON_DEBUG_NOTIFICATIONS</code></a></h3>\n<p>Agrega registros adicionales al ciclos de vida <a href=\"/docs/api/notification\"><code>Notification</code></a> en macOS para ayudar a depurar. Se mostrará un registro adicional cuando se creen o activen nuevas notificaciones. They will also be displayed when common a tions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.</p>\n<p>Ejemplo de salida:</p>\n<pre><code class=\"hljs language-sh\">Notification created (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification displayed (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification activated (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification replied to (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\n</code></pre>\n<h3 id=\"electron_log_asar_reads\"><a href=\"#electron_log_asar_reads\"><code>ELECTRON_LOG_ASAR_READS</code></a></h3>\n<p>When Electron reads from an ASAR file, log the read offset and file path to the system <code>tmpdir</code>. The resulting file can be provided to the ASAR module to optimize file ordering.</p>\n<h3 id=\"electron_enable_stack_dumping\"><a href=\"#electron_enable_stack_dumping\"><code>ELECTRON_ENABLE_STACK_DUMPING</code></a></h3>\n<p>Imprime el rastro de la pila a la consola cuando Electron falla.</p>\n<p>Esta variable de entorno no funcionará si se inicia el <code>crashReporter</code>.</p>\n<h3 id=\"electron_default_error_mode-windows\"><a href=\"#electron_default_error_mode-windows\"><code>ELECTRON_DEFAULT_ERROR_MODE</code> <em>Windows</em></a></h3>\n<p>Muestra el cuadro de dialogo del fallo de Windows cuando falla Electron.</p>\n<p>Esta variable de entorno no funcionará si se inicia el <code>crashReporter</code>.</p>\n<h3 id=\"electron_override_dist_path\"><a href=\"#electron_override_dist_path\"><code>ELECTRON_OVERRIDE_DIST_PATH</code></a></h3>\n<p>Cuando corre desde el paquete <code>electron</code>, esta variable dice al comando <code>electron</code> para usar la instancia especificada del constructor de Electron en lugar de uno descargado por <code>npm install</code>. Uso:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">export</span> ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Testing\n</code></pre>\n<h2 id=\"establecido-por-electron\"><a href=\"#establecido-por-electron\">Establecido por Electron</a></h2>\n<p>Electron define algunas variables en su entorno en el momento de ejecución.</p>\n<h3 id=\"original_xdg_current_desktop\"><a href=\"#original_xdg_current_desktop\"><code>ORIGINAL_XDG_CURRENT_DESKTOP</code></a></h3>\n<p>Esta variable es establecida con al valor de <code>XDG_CURRENT_DESKTOP</code> con el que originalmente tu aplicación fue lanzada.  A veces, Electron modifica el valor de <code>XDG_CURRENT_DESKTOP</code> para afectar otra lógica dentro de Chromium, así que si quieres acceder al valor original <em>original</em> en su lugar deberías buscar esta variable de entorno.</p>",
      "title": "Variables de entorno",
      "description": "Configuración y comportamiento de la aplicación de control sin cambiar el código."
    },
    "/docs/api/structures/event": {
      "locale": "es-ES",
      "slug": "event",
      "href": "/docs/api/structures/event",
      "crowdinFileId": "256429",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"event-object-extends-globalevent\"><a href=\"#event-object-extends-globalevent\">Event Object extends <code>GlobalEvent</code></a></h1>\n<ul>\n<li><code>preventDefault</code> VoidFunction</li>\n</ul>",
      "title": "Event Object extends GlobalEvent",
      "description": ""
    },
    "/docs/experimental": {
      "locale": "es-ES",
      "slug": "experimental",
      "href": "/docs/experimental",
      "crowdinFileId": "256119",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/experimental.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"experimental-apis\"><a href=\"#experimental-apis\">Experimental APIs</a></h1>\n<p>Some of Electrons APIs are tagged with <code>_Experimental_</code> in the documentation. This tag indicates that the API may not be considered stable and the API may be removed or modified more frequently than other APIs with less warning.</p>\n<h2 id=\"conditions-for-an-api-to-be-tagged-as-experimental\"><a href=\"#conditions-for-an-api-to-be-tagged-as-experimental\">Conditions for an API to be tagged as Experimental</a></h2>\n<p>Anyone can request an API be tagged as experimental in a feature PR, disagreements on the experimental nature of a feature can be discussed in the API WG if they can't be resolved in the PR.</p>\n<h2 id=\"process-for-removing-the-experimental-tag\"><a href=\"#process-for-removing-the-experimental-tag\">Process for removing the Experimental tag</a></h2>\n<p>Once an API has been stable and in at least two major stable release lines it can be nominated to have its experimental tag removed.  This discussion should happen at an API WG meeting.  Things to consider when discussing / nominating:</p>\n<ul>\n<li>The above \"two major stables release lines\" condition must have been met</li>\n<li>During that time no major bugs / issues should have been caused by the adoption of this feature</li>\n<li>The API is stable enough and hasn't been heavily impacted by Chromium upgrades</li>\n<li>Is anyone using the API?</li>\n<li>Is the API fulfilling the original proposed usecases, does it have any gaps?</li>\n</ul>",
      "title": "Experimental APIs",
      "description": ""
    },
    "/docs/api/structures/extension": {
      "locale": "es-ES",
      "slug": "extension",
      "href": "/docs/api/structures/extension",
      "crowdinFileId": "256433",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/extension.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"extension-object\"><a href=\"#extension-object\">Extension Object</a></h1>\n<ul>\n<li><code>id</code> Cadena</li>\n<li><code>manifest</code> any - Copy of the <a href=\"https://developer.chrome.com/extensions/manifest\">extension's manifest data</a>.</li>\n<li><code>name</code> String</li>\n<li><code>path</code> String - The extension's file path.</li>\n<li><code>version</code> String</li>\n<li><code>url</code> String - The extension's <code>chrome-extension://</code> URL.</li>\n</ul>",
      "title": "Extension Object",
      "description": ""
    },
    "/docs/api/structures/extension-info": {
      "locale": "es-ES",
      "slug": "extension-info",
      "href": "/docs/api/structures/extension-info",
      "crowdinFileId": "256431",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/extension-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"extensioninfo-object\"><a href=\"#extensioninfo-object\">ExtensionInfo Object</a></h1>\n<ul>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>",
      "title": "ExtensionInfo Object",
      "description": ""
    },
    "/docs/api/extensions": {
      "locale": "es-ES",
      "slug": "extensions",
      "href": "/docs/api/extensions",
      "crowdinFileId": "256317",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/extensions.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"chrome-extension-support\"><a href=\"#chrome-extension-support\">Chrome Extension Support</a></h1>\n<p>Electron supports a subset of the <a href=\"https://developer.chrome.com/extensions/api_index\">Chrome Extensions API</a>, primarily to support DevTools extensions and Chromium-internal extensions, but it also happens to support some other extension capabilities.</p>\n<blockquote>\n<p><strong>Note:</strong> Electron does not support arbitrary Chrome extensions from the store, and it is a <strong>non-goal</strong> of the Electron project to be perfectly compatible with Chrome's implementation of Extensions.</p>\n</blockquote>\n<h2 id=\"cargar-extensiones\"><a href=\"#cargar-extensiones\">Cargar extensiones</a></h2>\n<p>Electron only supports loading unpacked extensions (i.e., <code>.crx</code> files do not work). Extensions are installed per-<code>session</code>. Para cargar una extensión, llame a <a href=\"/docs/api/session#sesloadextensionpath-options\"><code>ses.loadExtension</code></a>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession.loadExtension(<span class=\"hljs-string\">'path/to/unpacked/extension'</span>).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ id }</span>) =></span> {\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<p>Loaded extensions will not be automatically remembered across exits; if you do not call <code>loadExtension</code> when the app runs, the extension will not be loaded.</p>\n<p>Note that loading extensions is only supported in persistent sessions. Attempting to load an extension into an in-memory session will throw an error.</p>\n<p>See the <a href=\"/docs/api/session\"><code>session</code></a> documentation for more information about loading, unloading, and querying active extensions.</p>\n<h2 id=\"supported-extensions-apis\"><a href=\"#supported-extensions-apis\">Supported Extensions APIs</a></h2>\n<p>We support the following extensions APIs, with some caveats. Other APIs may additionally be supported, but support for any APIs not listed here is provisional and may be removed.</p>\n<h3 id=\"chromedevtoolsinspectedwindow\"><a href=\"#chromedevtoolsinspectedwindow\"><code>chrome.devtools.inspectedWindow</code></a></h3>\n<p>Todas las características de esta API son compatibles.</p>\n<h3 id=\"chromedevtoolsnetwork\"><a href=\"#chromedevtoolsnetwork\"><code>chrome.devtools.network</code></a></h3>\n<p>Todas las características de esta API son compatibles.</p>\n<h3 id=\"chromedevtoolspanels\"><a href=\"#chromedevtoolspanels\"><code>chrome.devtools.panels</code></a></h3>\n<p>Todas las características de esta API son compatibles.</p>\n<h3 id=\"chromeextension\"><a href=\"#chromeextension\"><code>chrome.extension</code></a></h3>\n<p>Se admiten las siguientes propiedades de <code>chrome.extension</code> :</p>\n<ul>\n<li><code>chrome.extension.lastError</code></li>\n</ul>\n<p>Los siguientes métodos de <code>chrome.extension</code> son soportados:</p>\n<ul>\n<li><code>chrome.extension.getURL</code></li>\n<li><code>chrome.extension.getBackgroundPage</code></li>\n</ul>\n<h3 id=\"chromeruntime\"><a href=\"#chromeruntime\"><code>chrome.runtime</code></a></h3>\n<p>Las siguientes propiedades de <code>chrome.runtime</code> son soportadas:</p>\n<ul>\n<li><code>chrome.runtime.lastError</code></li>\n<li><code>chrome.runtime.id</code></li>\n</ul>\n<p>Los siguientes métodos de <code>chrome.runtime</code> son soportados:</p>\n<ul>\n<li><code>chrome.runtime.getBackgroundPage</code></li>\n<li><code>chrome.runtime.getManifest</code></li>\n<li><code>chrome.runtime.getPlatformInfo</code></li>\n<li><code>chrome.runtime.getURL</code></li>\n<li><code>chrome.runtime.connect</code></li>\n<li><code>chrome.runtime.sendMessage</code></li>\n<li><code>chrome.runtime.reload</code></li>\n</ul>\n<p>Los siguientes eventos de <code>chrome.runtime</code> están soportados:</p>\n<ul>\n<li><code>chrome.runtime.onStartup</code></li>\n<li><code>chrome.runtime.onInstalled</code></li>\n<li><code>chrome.runtime.onSuspend</code></li>\n<li><code>chrome.runtime.onSuspendCanceled</code></li>\n<li><code>chrome.runtime.onConnect</code></li>\n<li><code>chrome.runtime.onMessage</code></li>\n</ul>\n<h3 id=\"chromestorage\"><a href=\"#chromestorage\"><code>chrome.storage</code></a></h3>\n<p>Solo <code>chrome.storage.local</code> está soportado; <code>chrome.storage.sync</code> y <code>chrome.storage.managed</code> no lo están.</p>\n<h3 id=\"chrometabs\"><a href=\"#chrometabs\"><code>chrome.tabs</code></a></h3>\n<p>Los siguientes métodos de <code>chrome.tabs</code> son soportados:</p>\n<ul>\n<li><code>chrome.tabs.sendMessage</code></li>\n<li><code>chrome.tabs.executeScript</code></li>\n</ul>\n<blockquote>\n<p><strong>Note:</strong> In Chrome, passing <code>-1</code> as a tab ID signifies the \"currently active tab\". Since Electron has no such concept, passing <code>-1</code> as a tab ID is not supported and will raise an error.</p>\n</blockquote>\n<h3 id=\"chromemanagement\"><a href=\"#chromemanagement\"><code>chrome.management</code></a></h3>\n<p>Los siguientes métodos de <code>chrome.management</code> son soportados:</p>\n<ul>\n<li><code>chrome.management.getAll</code></li>\n<li><code>chrome.management.get</code></li>\n<li><code>chrome.management.getSelf</code></li>\n<li><code>chrome.management.getPermissionWarningsById</code></li>\n<li><code>chrome.management.getPermissionWarningsByManifest</code></li>\n<li><code>chrome.management.onEnabled</code></li>\n<li><code>chrome.management.onDisabled</code></li>\n</ul>\n<h3 id=\"chromewebrequest\"><a href=\"#chromewebrequest\"><code>chrome.webRequest</code></a></h3>\n<p>Todas las características de esta API son compatibles.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Electron's <a href=\"/docs/api/web-request\"><code>webRequest</code></a> module takes precedence over <code>chrome.webRequest</code> if there are conflicting handlers.</p>\n</blockquote>",
      "title": "Chrome Extension Support",
      "description": "Note: Electron does not support arbitrary Chrome extensions from the store, and it is a non-goal of the Electron project to be perfectly compatible with Chrome's implementation of Extensions."
    },
    "/docs/faq": {
      "locale": "es-ES",
      "slug": "faq",
      "href": "/docs/faq",
      "crowdinFileId": "256121",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/faq.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"preguntas-más-frecuentes-sobre-electron\"><a href=\"#preguntas-más-frecuentes-sobre-electron\">Preguntas más frecuentes sobre Electron</a></h1>\n<h2 id=\"¿por-qué-tengo-problemas-al-instalar-electron\"><a href=\"#¿por-qué-tengo-problemas-al-instalar-electron\">¿Por qué tengo problemas al instalar Electron?</a></h2>\n<p>Cuando ejecutamos <code>npm install electron</code>, ocasionalmente algunos usuarios encuentran errores en la instalación.</p>\n<p>En casi todos los casos, estos errores son resultados de problemas en la red y no de problemas con el paquete npm de <code>electron</code>. Errores como <code>ELIFECYCLE</code>, <code>EAI_AGAIN</code>, <code>ECONNRESET</code> y <code>ETIMEDOUT</code> son indicadores de dichos problemas de red. La mejor solución es tratar de cambiar las redes, o esperar un poco e instalar de nuevo.</p>\n<p>También puede intentar descargar Electron directamente de <a href=\"https://github.com/electron/electron/releases\">electron/electron/releases</a> si la ruta de instalación <code>npm</code> está fallando.</p>\n<h2 id=\"¿cuando-se-actualizará-electron-a-la-más-reciente-versión-de-chrome\"><a href=\"#¿cuando-se-actualizará-electron-a-la-más-reciente-versión-de-chrome\">¿Cuando se actualizará Electron a la más reciente versión de Chrome?</a></h2>\n<p>La versión de Chrome de Electron es usualmente actualizada con una o dos semanas después de que una nueva versión estable de Chrome es publicada. Esta estimación no se garantiza y depende de la carga de trabajo que implica la actualización.</p>\n<p>Only the stable channel of Chrome is used. If an important fix is in beta or dev channel, we will back-port it.</p>\n<p>Para mas información, por favor lea la <a href=\"/docs/tutorial/security\">introducción de seguridad</a>.</p>\n<h2 id=\"¿cuándo-se-actualizará-electron-a-la-última-versión-de-nodejs\"><a href=\"#¿cuándo-se-actualizará-electron-a-la-última-versión-de-nodejs\">¿Cuándo se actualizará Electron a la última versión de Node.js?</a></h2>\n<p>Cuando una nueva versión de Node.js es publicada, usualmente esperamos aproximadamente un mes antes de actualizar la versión de Electron. Con esto evitamos afectarnos por bugs introducidos en la nueva versión de Node.js, lo cual sucede frecuentemente.</p>\n<p>Novedades de Node.js están generalmente presentadas por mejoras V8, puesto que el Electron está utilizando el V8 enviados por el navegador Chrome, JavaScript nuevo brillante característica de una nueva versión de Node.js es generalmente ya en Electron.</p>\n<h2 id=\"¿cómo-compartir-datos-entre-páginas-web\"><a href=\"#¿cómo-compartir-datos-entre-páginas-web\">¿Cómo compartir datos entre páginas web?</a></h2>\n<p>Para compartir datos entre páginas web (el proceso de renderizado) la manera más simple es usar el API de HTML5 el cual ya está disponible en navegadores. Buenos candidatos son <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Storage\">Storage API</a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage\"><code>localStorage</code></a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage\"><code>sessionStorage</code></a>, y <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API\">IndexedDB</a>.</p>\n<p>Alternatively, you can use the IPC primitives that are provided by Electron. To share data between the main and renderer processes, you can use the <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> and <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> modules. To communicate directly between web pages, you can send a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> from one to the other, possibly via the main process using <a href=\"/docs/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage()</code></a>. Subsequent communication over message ports is direct and does not detour through the main process.</p>\n<h2 id=\"la-ventanabandeja-de-la-aplicación-desaparece-después-de-unos-minutos\"><a href=\"#la-ventanabandeja-de-la-aplicación-desaparece-después-de-unos-minutos\">La ventana/bandeja de la aplicación desaparece después de unos minutos.</a></h2>\n<p>Esto sucede cuando la variable que es usada para almacenar la ventana/bandeja se limpia de la basura.</p>\n<p>Si encuentra este problema, los siguientes artículos pudiesen resultar útiles:</p>\n<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management\">Gestión de la Memoria</a></li>\n<li><a href=\"https://msdn.microsoft.com/library/bzt2dkta(v=vs.94).aspx\">Ámbito de la variable</a></li>\n</ul>\n<p>Si quiere una solución rápida, puede volver sus variables globales cambiando su código de este:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/icon.png'</span>)\n  tray.setTitle(<span class=\"hljs-string\">'hello world'</span>)\n})\n</code></pre>\n<p>a este:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> tray = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/icon.png'</span>)\n  tray.setTitle(<span class=\"hljs-string\">'hello world'</span>)\n})\n</code></pre>\n<h2 id=\"no-puedo-usar-jqueryrequirejsmeteorangularjs-en-electron\"><a href=\"#no-puedo-usar-jqueryrequirejsmeteorangularjs-en-electron\">No puedo usar jQuery/RequireJS/Meteor/AngularJS en Electron.</a></h2>\n<p>Debido a la integración de Node.js de Electron, hay algunos símbolos extras insertados en la DOM como <code>module</code>, <code>exports</code>, <code>require</code>. Esto causa problemas para algunas librerías dado que ellas quieren insertar símbolos con los mismos nombres.</p>\n<p>Para solucionar esto, puede desactivar la integración de Node en Electron:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">/// In the main process.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\nwin.show()\n</code></pre>\n<p>Pero si desea mantener la capacidad de utilizar Node.js y APIs de Electron, tienes que cambiar el nombre de los símbolos en la página antes de incluir otras bibliotecas:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-built_in\">window</span>.nodeRequire = <span class=\"hljs-built_in\">require</span>;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.require;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.exports;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.module;\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/javascript\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"jquery.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n</code></pre>\n<h2 id=\"requireelectronxxx-no-está-definido\"><a href=\"#requireelectronxxx-no-está-definido\"><code>require('electron').xxx</code> no está definido.</a></h2>\n<p>Cuando se utiliza el módulo de Electron puede encontrar un error como este:</p>\n<pre><code class=\"hljs language-sh\">> require(<span class=\"hljs-string\">'electron'</span>).webFrame.setZoomFactor(1.0)\nUncaught TypeError: Cannot <span class=\"hljs-built_in\">read</span> property <span class=\"hljs-string\">'setZoomLevel'</span> of undefined\n</code></pre>\n<p>It is very likely you are using the module in the wrong process. Por ejemplo <code>electron.app</code> puede ser utilizado en el proceso principal, mientras que <code>electron.webFrame</code> sólo está disponible en los procesos de renderizado.</p>\n<h2 id=\"la-fuente-se-ve-borrosa-¿qué-es-esto-y-qué-puedo-hacer\"><a href=\"#la-fuente-se-ve-borrosa-¿qué-es-esto-y-qué-puedo-hacer\">La fuente se ve borrosa, ¿qué es esto y qué puedo hacer?</a></h2>\n<p>If <a href=\"https://alienryderflex.com/sub_pixel/\">sub-pixel anti-aliasing</a> is deactivated, then fonts on LCD screens can look blurry. Ejemplo:</p>\n<p><img src=\"/docs/images/subpixel-rendering-screenshot.gif\" alt=\"subpixel rendering example\"></p>\n<p>El anti-aliasing de Sub-píxeles necesita un fondo no transparente de la capa que contenga los glifos de fuente. (Vea <a href=\"https://github.com/electron/electron/issues/6344#issuecomment-420371918\">this issue</a> para más información).</p>\n<p>To achieve this goal, set the background in the constructor for <a href=\"/docs/api/browser-window\">BrowserWindow</a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#fff'</span>\n})\n</code></pre>\n<p>El efecto es visible sólo en (algunos?) Pantallas LCD. Even if you don't see a difference, some of your users may. It is best to always set the background this way, unless you have reasons not to do so.</p>\n<p>Tenga en cuenta que sólo establecer el fondo en el CSS no tiene el efecto deseado.</p>",
      "title": "Preguntas más frecuentes sobre Electron",
      "description": ""
    },
    "/docs/api/structures/file-filter": {
      "locale": "es-ES",
      "slug": "file-filter",
      "href": "/docs/api/structures/file-filter",
      "crowdinFileId": "256435",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/file-filter.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"filefilter-object\"><a href=\"#filefilter-object\">FileFilter Object</a></h1>\n<ul>\n<li><code>name</code> String</li>\n<li><code>extensions</code> String[]</li>\n</ul>",
      "title": "FileFilter Object",
      "description": ""
    },
    "/docs/api/file-object": {
      "locale": "es-ES",
      "slug": "file-object",
      "href": "/docs/api/file-object",
      "crowdinFileId": "256319",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/file-object.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"archivo-objeto\"><a href=\"#archivo-objeto\"><code>Archivo</code> Objeto</a></h1>\n<blockquote>\n<p>Utiliza la API HTML5 <code>File</code> para trabajar de forma nativa con los archivos en filesystem.</p>\n</blockquote>\n<p>La interfaz del archivo de DOM proporciona abstracción alrededor de los archivos nativos para permitir a los usuarios trabajar sobre los archivos nativos directamente con la API del archivo HTML5. Electron tiene un atributo <code>path</code> adicional a la interfaz <code>File</code> el cual revela la ruta real del archivo en filesystem.</p>\n<p>Ejemplo para obtener una ruta real desde un archivo arrastrado dentro de la aplicación:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">div</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"holder\"</span>></span>\n  Drag your file here\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">div</span>></span>\n\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  <span class=\"hljs-built_in\">document</span>.addEventListener(<span class=\"hljs-string\">'drop'</span>, (e) => {\n    e.preventDefault();\n    e.stopPropagation();\n\n    <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> f <span class=\"hljs-keyword\">of</span> e.dataTransfer.files) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'File(s) you dragged here: '</span>, f.path)\n    }\n  });\n  <span class=\"hljs-built_in\">document</span>.addEventListener(<span class=\"hljs-string\">'dragover'</span>, (e) => {\n    e.preventDefault();\n    e.stopPropagation();\n  });\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>",
      "title": "Archivo Objeto",
      "description": "Utiliza la API HTML5 File para trabajar de forma nativa con los archivos en filesystem."
    },
    "/docs/api/structures/file-path-with-headers": {
      "locale": "es-ES",
      "slug": "file-path-with-headers",
      "href": "/docs/api/structures/file-path-with-headers",
      "crowdinFileId": "256437",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/file-path-with-headers.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"filepathwithheaders-object\"><a href=\"#filepathwithheaders-object\">FilePathWithHeaders Object</a></h1>\n<ul>\n<li><code>path</code> String - The path to the file to send.</li>\n<li><code>headers</code> Record&#x3C;string, string> (optional) - Additional headers to be sent.</li>\n</ul>",
      "title": "FilePathWithHeaders Object",
      "description": ""
    },
    "/docs/api/frameless-window": {
      "locale": "es-ES",
      "slug": "frameless-window",
      "href": "/docs/api/frameless-window",
      "crowdinFileId": "256321",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/frameless-window.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ventanas-sin-bordes\"><a href=\"#ventanas-sin-bordes\">Ventanas sin bordes</a></h1>\n<blockquote>\n<p>Abrir una ventana sin barras de herramientas, bordes u otro \"chrome\" gráfico.</p>\n</blockquote>\n<p>Una ventana sin bordes es una ventana que no tiene <a href=\"https://developer.mozilla.org/en-US/docs/Glossary/Chrome\">chrome</a>, ni las partes de la ventana, como barra de herramientas, que no forman parte de la página web. Estas son las opciones en la clase <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<h2 id=\"crear-una-ventana-sin-bordes\"><a href=\"#crear-una-ventana-sin-bordes\">Crear una ventana sin bordes</a></h2>\n<p>Para crear una ventana sin marco, necesitas establecer <code>frame</code> a <code>false</code> en las <code>options</code> de <a href=\"/docs/api/browser-window\">BrowserWindow</a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h3 id=\"alternatives\"><a href=\"#alternatives\">Alternatives</a></h3>\n<p>There's an alternative way to specify a chromeless window on macOS and Windows. Instead of setting <code>frame</code> to <code>false</code> which disables both the titlebar and window controls, you may want to have the title bar hidden and your content extend to the full window size, yet still preserve the window controls (\"traffic lights\" on macOS) for standard window actions. Puede hacerse especificando la opción <code>titleBarStyle</code>:</p>\n<h4 id=\"hidden\"><a href=\"#hidden\"><code>hidden</code></a></h4>\n<p>Results in a hidden title bar and a full size content window. On macOS, the title bar still has the standard window controls (“traffic lights”) in the top left.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span> })\nwin.show()\n</code></pre>\n<h3 id=\"alternativas-en-macos\"><a href=\"#alternativas-en-macos\">Alternativas en macOS</a></h3>\n<h4 id=\"hiddeninset\"><a href=\"#hiddeninset\"><code>hiddenInset</code></a></h4>\n<p>Es una barra de título oculta con un aspecto alternativo donde los botones de traffic light están ligeramente mas insertados desde el borde de la ventana.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span> })\nwin.show()\n</code></pre>\n<h4 id=\"custombuttonsonhover\"><a href=\"#custombuttonsonhover\"><code>customButtonsOnHover</code></a></h4>\n<p>Usa botones personalizados de cierre y miniaturiza que se muestran cuando se activa en la parte superior izquierda de la ventana. The fullscreen button is not available due to restrictions of frameless windows as they interface with Apple's macOS window masks. Estos botones personalizados evitaran problemas con los eventos de ratón que ocurren con los botones de la barra de herramientas estándar. Esta opción sólo es aplicable para ventanas sin marco.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'customButtonsOnHover'</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h2 id=\"windows-control-overlay\"><a href=\"#windows-control-overlay\">Windows Control Overlay</a></h2>\n<p>When using a frameless window in conjuction with <code>win.setWindowButtonVisibility(true)</code> on macOS, using one of the <code>titleBarStyle</code>s as described above so that the traffic lights are visible, or using <code>titleBarStyle: hidden</code> on Windows, you can access the Window Controls Overlay <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis\">JavaScript APIs</a> and <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables\">CSS Environment Variables</a> by setting the <code>titleBarOverlay</code> option to true. Specifying <code>true</code> will result in an overlay with default system colors.</p>\n<p>On Windows, you can also specify the color of the overlay and its symbols by setting <code>titleBarOverlay</code> to an object with the options <code>color</code> and <code>symbolColor</code>. If an option is not specified, the color will default to its system color for the window control buttons:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span>,\n  <span class=\"hljs-attr\">titleBarOverlay</span>: <span class=\"hljs-literal\">true</span>\n})\nwin.show()\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span>,\n  <span class=\"hljs-attr\">titleBarOverlay</span>: {\n    <span class=\"hljs-attr\">color</span>: <span class=\"hljs-string\">'#2f3241'</span>,\n    <span class=\"hljs-attr\">symbolColor</span>: <span class=\"hljs-string\">'#74b1be'</span>\n  }\n})\nwin.show()\n</code></pre>\n<h2 id=\"ventana-transparente\"><a href=\"#ventana-transparente\">Ventana transparente</a></h2>\n<p>Al configurar la opción <code>transparent</code> a <code>true</code>, se puede hacer transparente la ventana sin bordes:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">transparent</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h3 id=\"limitaciones\"><a href=\"#limitaciones\">Limitaciones</a></h3>\n<ul>\n<li>No se puede hacer clic a través del área transparente. Vamos a introducir una API para configurar la forma de la ventana para solucionar esto. Consulte <a href=\"https://github.com/electron/electron/issues/1335\">our issue</a> para mas detalles.</li>\n<li>Las ventanas transparentes no son redimencionables. Establecer <code>resizable</code> a <code>true</code> puede hacer que una ventana transparente deje de funcionar en algunas plataformas.</li>\n<li>El filtro <code>blur</code> solo aplica a la página web, por lo que no hay manera de aplicar el efecto blur al contenido debajo de la ventana (por ejemplo, otras aplicaciones abiertas en el sistema del usuario).</li>\n<li>La ventana no será transparente cuando DevTools este abierta.</li>\n<li>On Windows operating systems,<ul>\n<li>transparent windows will not work when DWM is disabled.</li>\n<li>transparent windows can not be maximized using the Windows system menu or by double clicking the title bar. The reasoning behind this can be seen on <a href=\"https://github.com/electron/electron/pull/28207\">this pull request</a>.</li>\n</ul></li>\n<li>En Linux, los usuarios tienen que poner <code>--enable-transparent-visuals --disable-gpu</code> en la línea de comandos para deshabilitar el GPU y permitir ARGB para hacer transparente la ventana, esto es causado por un bug ascendente donde <a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=369209\">el canal alfa no funciona en algunos controladores NVidia</a> en Linux.</li>\n<li>En Mac, la sombra nativa no se mostrará en una ventana transparente.</li>\n</ul>\n<h2 id=\"ventana-click-through\"><a href=\"#ventana-click-through\">Ventana Click-through</a></h2>\n<p>Para crear una ventana click-through, por ejemplo hacer que la ventana ignore todos los eventos del ratón, puedes llamar la API <a href=\"/docs/api/browser-window#winsetignoremouseeventsignore-options\">win.setIgnoreMouseEvents(ignore)</a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.setIgnoreMouseEvents(<span class=\"hljs-literal\">true</span>)\n</code></pre>\n<h3 id=\"reenviando\"><a href=\"#reenviando\">Reenviando</a></h3>\n<p>Ignorar los mensajes de movimiento del ratón hace la página agena al movimiento del ratón, lo que significa que los eventos no se emitirán. En los sistemas operativos Windows se puede usar un parámetro opcional para reenviar los mensajes de movimiento del ratón a la página web, permitiendo que eventos como <code>mouseleave</code> se emitan:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> el = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'clickThroughElement'</span>)\nel.addEventListener(<span class=\"hljs-string\">'mouseenter'</span>, () => {\n  ipcRenderer.send(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, <span class=\"hljs-literal\">true</span>, { <span class=\"hljs-attr\">forward</span>: <span class=\"hljs-literal\">true</span> })\n})\nel.addEventListener(<span class=\"hljs-string\">'mouseleave'</span>, () => {\n  ipcRenderer.send(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, <span class=\"hljs-literal\">false</span>)\n})\n\n<span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, (event, ...args) => {\n  BrowserWindow.fromWebContents(event.sender).setIgnoreMouseEvents(...args)\n})\n</code></pre>\n<p>Esto hace que la página web sea \"click-through\" cuando se situa el ratón sobre <code>el</code>, y vuelva a su estado normal cuando se abandona.</p>\n<h2 id=\"región-desplazable\"><a href=\"#región-desplazable\">Región desplazable</a></h2>\n<p>Por defecto, una ventana sin bordes no se puede desplazar. La aplicación necesita especificar <code>-webkit-app-region: drag</code> en CSS para indicarle a Electron cuales regiones son desplazables (como la barra de títulos estándar del sistema operativo). Las aplicaciones también pueden usar <code>-webkit-app-region: no-drag</code> para excluir el área no desplazable de las regiones desplazables. Tenga en cuenta que solo las formas rectangulares son soportadas.</p>\n<p>Nota: <code>-webkit-app-region: drag</code> es conocida por tener problemas mientras las herramientas del desarrollador están abiertas. Para mas información ver este <a href=\"https://github.com/electron/electron/issues/3647\">GitHub issue</a> incluida una solución.</p>\n<p>Para hacer que toda la ventana sea desplazable, puedes agregar <code>-webkit-app-region: drag</code> como el estilo de <code>body</code>:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"-webkit-app-region: drag\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n</code></pre>\n<p>Y tenga en cuenta que si se hace toda la ventana desplazable, se debe marcar los botones como no desplazable, de lo contrario sería imposible para los usuarios hacer clic sobre ellos:</p>\n<pre><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">button</span> {\n  <span class=\"hljs-attribute\">-webkit-app-region</span>: no-drag;\n}\n</code></pre>\n<p>Si sólo está configurando una barra de títulos personalizada como arrastrable, también necesita hacer todos los botones en la barra de título no arrastrable.</p>\n<h2 id=\"selección-de-texto\"><a href=\"#selección-de-texto\">Selección de texto</a></h2>\n<p>En una ventana sin marco el comportamiento de arrastrar puede causar conflicto con la selección de texto. Por ejemplo, cuando se arrastra la barra de título, accidentalmente se podría seleccionar el texto sobre la barra de título. Para evitar esto, es necesario deshabilitar la selección de texto dentro de un área desplazable como:</p>\n<pre><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.titlebar</span> {\n  <span class=\"hljs-attribute\">-webkit-user-select</span>: none;\n  <span class=\"hljs-attribute\">-webkit-app-region</span>: drag;\n}\n</code></pre>\n<h2 id=\"menú-de-contexto\"><a href=\"#menú-de-contexto\">Menú de contexto</a></h2>\n<p>En algunas plataformas, el área desplazable puede ser considerada como un borde que no forma parte del cliente, de esta manera cuando se haga clic sobre él, aparecerá un menú del sistema. Para que el menú de contexto se comporte correctamente en todas las plataformas, nunca debe usarse un menú de contexto personalizado en áreas desplazables.</p>",
      "title": "Ventanas sin bordes",
      "description": "Abrir una ventana sin barras de herramientas, bordes u otro \"chrome\" gráfico."
    },
    "/docs/tutorial/fuses": {
      "locale": "es-ES",
      "slug": "fuses",
      "href": "/docs/tutorial/fuses",
      "crowdinFileId": "256201",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/fuses.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-fuses\"><a href=\"#electron-fuses\">Electron Fuses</a></h1>\n<blockquote>\n<p>Alterna característica en tiempo de empaquetado</p>\n</blockquote>\n<h2 id=\"¿qué-son-los-fusibles\"><a href=\"#¿qué-son-los-fusibles\">¿Qué son los fusibles?</a></h2>\n<p>Para un subconjunto de funcionalidad de Electron tiene sentido deshabilitar ciertas características para una aplicación entera.  Por ejemplo, el 99% de las aplicaciones no hacen uso de <code>ELECTRON_RUN_AS_NODE</code>, estas aplicaciones quiere ser capaz de enviar un binario que sea incapaz de usar esa característica.  Además no queremos que los consumidores de Electron construyan Electron a partir de la fuente, ya que ese es un desafío técnico masivo y tiene un alto costo tanto en tiempo como en dinero.</p>\n<p>Los fusibles son la solución a este problema, en un alto nivel son \"bits mágicos\" en el binario de Electron que se pueden voltear cuando empaca su aplicación Electron para habilitar / deshabilitar ciertas características / restricciones.  Debido a que son volteados en tiempo de empaquetado antes de que el código firme la aplicación, el sistema operativo se hace responsable de asegurar que esos bits no son volteados de nuevo a través de la validación de firma de código a nivel de sistema operativo (Gatekeeper / App Locker).</p>\n<h2 id=\"¿cómo-voltear-los-fusibles\"><a href=\"#¿cómo-voltear-los-fusibles\">¿Cómo voltear los fusibles?</a></h2>\n<h3 id=\"la-forma-fácil\"><a href=\"#la-forma-fácil\">La forma fácil</a></h3>\n<p>Hemos hecho un módulo práctico <code>@electron/fuses</code> para hacer que voltear estos fusibles sea fácil.  Revisa el README del módulo para más detalles sobre uso y los casos de errores potenciales.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/fuses'</span>).flipFuses(\n  <span class=\"hljs-comment\">// Path to electron</span>\n  <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>),\n  <span class=\"hljs-comment\">// Fuses to flip</span>\n  {\n    <span class=\"hljs-attr\">runAsNode</span>: <span class=\"hljs-literal\">false</span>\n  }\n)\n</code></pre>\n<h3 id=\"la-forma-difícil\"><a href=\"#la-forma-difícil\">La forma difícil</a></h3>\n<h4 id=\"glosario-rápido\"><a href=\"#glosario-rápido\">Glosario Rápido</a></h4>\n<ul>\n<li><strong>Fuse Wire</strong>: Una secuencia de bytes en el binario de Electron usados para controlar los fusibles</li>\n<li><strong>Sentinel</strong>: Una secuencia estática conocida de bytes que puedes usar para localizar el cable del fusible</li>\n<li><strong>Fuse Schema</strong>: El formato / valores permitidos para el cable de fusible</li>\n</ul>\n<p>Para voltear los fusibles manualmente, es necesario editar el binario de Electron y modificar el cable del fusible para que sea la secuencia de bytes que represente el estado de los fusibles que desea.</p>\n<p>En algún lugar en el binario de Electron habrá una secuencia de bytes que se verán así:</p>\n<pre><code class=\"hljs language-plaintext\">| ...binary | sentinel_bytes | fuse_version | fuse_wire_length | fuse_wire | ...binary |\n</code></pre>\n<ul>\n<li><code>sentinel_bytes</code> siempre es esta cadena exacta <code>dL7pKGdnNz796PbbjQWNKmHXBZaB9tsX</code></li>\n<li><code>fuse_version</code> es un solo byte cuyo valor entero sin signo representa la versión del esquema de fusible</li>\n<li><code>fuse_wire_length</code> es un solo byte cuyo valor entero sin signo representa el numero de fusibles en el siguiente cable de fusible</li>\n<li><code>fuse_wire</code> es una secuencia de N bytes, cada byte representa un solo fusible y su estado.<ul>\n<li>\"0\" (0x30) indica que el fusible esta desactivado</li>\n<li>\"1\" (0x31) indica que el fusible esta activado</li>\n<li>\"r\" (0x72) indica que el fusible a sido eliminado y cambiar el byte 1 o 0 no tendrá efecto.</li>\n</ul></li>\n</ul>\n<p>Para voltear un fusible busque su posición en el cable del fusible y cámbielo a \"0\" o \"1\" dependiendo del estado que desee.</p>\n<p>Puede ver el esquema actual <a href=\"https://github.com/electron/electron/blob/main/build/fuses/fuses.json5\">aquí</a>.</p>",
      "title": "Electron Fuses",
      "description": "Alterna característica en tiempo de empaquetado"
    },
    "/docs/api/global-shortcut": {
      "locale": "es-ES",
      "slug": "global-shortcut",
      "href": "/docs/api/global-shortcut",
      "crowdinFileId": "256323",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/global-shortcut.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"globalshortcut\"><a href=\"#globalshortcut\">globalShortcut</a></h1>\n<blockquote>\n<p>Detecta los eventos del teclado cuando la aplicación no tiene el enfoque en el teclado.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p>El módulo <code>globalShortcut</code> puede registrar o quitar un atajo del teclado global con el sistema operativo para que se puedan personalizar las operaciones para varios atajos.</p>\n<p><strong>Nota:</strong> El atajo es global; funcionará incluso si la aplicación no tiene enfocado el teclado. This module cannot be used before the <code>ready</code> event of the app module is emitted.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Register a 'CommandOrControl+X' shortcut listener.</span>\n  <span class=\"hljs-keyword\">const</span> ret = globalShortcut.register(<span class=\"hljs-string\">'CommandOrControl+X'</span>, () => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'CommandOrControl+X is pressed'</span>)\n  })\n\n  <span class=\"hljs-keyword\">if</span> (!ret) {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'registration failed'</span>)\n  }\n\n  <span class=\"hljs-comment\">// Check whether a shortcut is registered.</span>\n  <span class=\"hljs-built_in\">console</span>.log(globalShortcut.isRegistered(<span class=\"hljs-string\">'CommandOrControl+X'</span>))\n})\n\napp.on(<span class=\"hljs-string\">'will-quit'</span>, () => {\n  <span class=\"hljs-comment\">// Unregister a shortcut.</span>\n  globalShortcut.unregister(<span class=\"hljs-string\">'CommandOrControl+X'</span>)\n\n  <span class=\"hljs-comment\">// Unregister all shortcuts.</span>\n  globalShortcut.unregisterAll()\n})\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>globalShortcut</code> tiene los siguientes métodos:</p>\n<h3 id=\"globalshortcutregisteraccelerator-callback\"><a href=\"#globalshortcutregisteraccelerator-callback\"><code>globalShortcut.register(accelerator, callback)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n<li><code>callback</code> Función</li>\n</ul>\n<p>Devuelve <code>Boolean</code> - Si el acceso fue registrado con éxito.</p>\n<p>Registra un atajo global del <code>acelerador</code>. El <code>callback</code> es llamado cuando el atajo registrado es presionado por el usuario.</p>\n<p>Cuando el acelerador ha sido tomado por otras aplicaciones, esta llamada fallará silenciosamente. Este comportamiento está diseñado por los sistemas operativos, debido a que no desean que las aplicaciones tengan conflictos por los atajos globales.</p>\n<p>Los siguientes aceleradores no serán registrados con correctamente en macOS 10.14 a menos que la aplicación haya sido autorizada como <a href=\"https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html\">trusted accessibility client</a>:</p>\n<ul>\n<li>\"Media Play/Pause\"</li>\n<li>\"Media Next Track\"</li>\n<li>\"Media Previous Track\"</li>\n<li>\"Media Stop\"</li>\n</ul>\n<h3 id=\"globalshortcutregisterallaccelerators-callback\"><a href=\"#globalshortcutregisterallaccelerators-callback\"><code>globalShortcut.registerAll(accelerators, callback)</code></a></h3>\n<ul>\n<li><code>accelerators</code> String[] - un array de <a href=\"/docs/api/accelerator\">Accelerator</a>s.</li>\n<li><code>callback</code> Función</li>\n</ul>\n<p>Registra un atajo global de todos los elementos <code>acelerador</code> en <code>aceleradores</code>. <code>callback</code> es llamado cuando el usuario presiona alguno de los atajos registrados.</p>\n<p>Cuando el acelerador ya ha sido tomado por otras aplicaciones, esta llamada fallará silenciosamente. Este comportamiento está diseñado por los sistemas operativos, debido a que no desean que las aplicaciones tengan conflictos por los atajos globales.</p>\n<p>Los siguientes aceleradores no serán registrados con correctamente en macOS 10.14 a menos que la aplicación haya sido autorizada como <a href=\"https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html\">trusted accessibility client</a>:</p>\n<ul>\n<li>\"Media Play/Pause\"</li>\n<li>\"Media Next Track\"</li>\n<li>\"Media Previous Track\"</li>\n<li>\"Media Stop\"</li>\n</ul>\n<h3 id=\"globalshortcutisregisteredaccelerator\"><a href=\"#globalshortcutisregisteredaccelerator\"><code>globalShortcut.isRegistered(accelerator)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n</ul>\n<p>Devuelve <code>Boolean</code> - Si esta aplicación tiene registrado <code>accelerator</code>.</p>\n<p>Cuando el acelerador ha sido tomado por otras aplicaciones, esta llamada aun devolverá <code>false</code>. Este comportamiento está diseñado por los sistemas operativos, debido a que no desean que las aplicaciones tengan conflictos por los atajos globales.</p>\n<h3 id=\"globalshortcutunregisteraccelerator\"><a href=\"#globalshortcutunregisteraccelerator\"><code>globalShortcut.unregister(accelerator)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n</ul>\n<p>Anula el registro del atajo del <code>accelerator</code>.</p>\n<h3 id=\"globalshortcutunregisterall\"><a href=\"#globalshortcutunregisterall\"><code>globalShortcut.unregisterAll()</code></a></h3>\n<p>Anula el registro todos los atajos globales.</p>",
      "title": "globalShortcut",
      "description": "Detecta los eventos del teclado cuando la aplicación no tiene el enfoque en el teclado."
    },
    "/docs/glossary": {
      "locale": "es-ES",
      "slug": "glossary",
      "href": "/docs/glossary",
      "crowdinFileId": "256123",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/glossary.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"glosario\"><a href=\"#glosario\">Glosario</a></h1>\n<p>Esta página define algunos términos que comúnmente se utilizan en el desarrollo de Electron.</p>\n<h3 id=\"asar\"><a href=\"#asar\">ASAR</a></h3>\n<p>ASAR significa formato de archivo de Shell de Atom. Un archivo de <a href=\"https://github.com/electron/asar\">asar</a> es un simple formato tipo <code>tar</code> que concatena archivos en un solo archivo. Electron puede leer archivos arbitrarios de él sin desempacar el archivo entero.</p>\n<p>El formato ASAR fue creado principalmente para mejorar el rendimiento en Windows cuando se cargan grandes cantidades de archivos pequeños (p.e. al cargar el árbol de dependencia JavaScript de tu aplicación desde <code>node_modules</code>).</p>\n<h3 id=\"firma-de-código\"><a href=\"#firma-de-código\">firma de código</a></h3>\n<p>La firma de código es un proceso donde un desarrollador de aplicación firma digitalmente su código para asegurarse que el código no haya sido manipulado después del empaquetado. Tanto Windows y macOS implementan su propia versión de la firma de código. Como desarrollar de aplicaciones de escritorio, es importante que firmes tu código si planeas distribuirlo al publico en general.</p>\n<p>Para más información, consulta el tutorial <a href=\"/docs/tutorial/code-signing\">Code Signing</a>.</p>\n<h3 id=\"aislamiento-del-contexto\"><a href=\"#aislamiento-del-contexto\">aislamiento del contexto</a></h3>\n<p>El aislamiento de contexto es una medida de seguridad en Electro que asegura que tu script de precarga no pueda filtrar las APIs privilegiadas de Electron o Node.js a los contenidos web en tu renderer process. Con el aislamiento de contexto activado, la única manera de exponer las APIs, desde tu scrip de precarga es a través de la API <code>contextBridge</code>.</p>\n<p>Para más información, consulta el tutorial <a href=\"/docs/tutorial/context-isolation\">Context Isolation</a>.</p>\n<p>Ver también: <a href=\"#preload-script\">preload script</a>, <a href=\"#renderer-process\">renderer process</a></p>\n<h3 id=\"crt\"><a href=\"#crt\">CRT</a></h3>\n<p>La biblioteca de Run-time C (CRT) es la parte de la biblioteca estándar de C++ que incorpora la biblioteca estándar de ISO C99. Las librerías de Visual C++ que implementan el apoyo CRT desarrollo de código nativo, y tanto código mixto nativo y como código administrado, y puro código administrado para el desarrollo .NET.</p>\n<h3 id=\"dmg\"><a href=\"#dmg\">DMG</a></h3>\n<p>Una imagen de disco de Apple es un formato de empaquetado utilizado por macOS. Los archivos DMG se utilizan comúnmente para la distribución de aplicaciones \"instaladores\".</p>\n<h3 id=\"ime\"><a href=\"#ime\">IME</a></h3>\n<p>Método de entrada del editor. Un programa que permite a los usuarios introducir caracteres y símbolos no encontrados en su teclado. Por ejemplo, esto permite a los usuarios de teclados de latín introducir caracteres chinos, japoneses, coreanos e indios.</p>\n<h3 id=\"idl\"><a href=\"#idl\">IDL</a></h3>\n<p>Lenguaje de descripción de interfaz. Escribe firmas de funciones y tipos de datos en un formato que se puede utilizar para generar interfaces en Java, C++, JavaScript, etc.</p>\n<h3 id=\"ipc\"><a href=\"#ipc\">IPC</a></h3>\n<p>IPC se refiere a la comunicación entre procesos. Electron utiliza IPC para enviar mensajes JSON serializados entre el proceso principal y los procesos renderizadores.</p>\n<p>véase también: <a href=\"#main-process\">proceso principal</a>, <a href=\"#renderer-process\">proceso de renderizado</a></p>\n<h3 id=\"proceso-principal\"><a href=\"#proceso-principal\">proceso principal</a></h3>\n<p>The main process, commonly a file named <code>main.js</code>, is the entry point to every Electron app. Controla la vida de la aplicación, de abierto a cerrado. También maneja elementos nativos como el menú, barra de menú, bandeja, etc. The main process is responsible for creating each new renderer process in the app. La API completa de Node está integrada.</p>\n<p>El archivo de proceso principal de cada aplicación se especifica en la propiedad <code>main</code> en <code>package.json</code>. Así es como <code>electron</code> sabe qué archivo ejecutar al inicio.</p>\n<p>En Chromium, este proceso se denomina \"proceso del navegador\". Se renombró en Electron para evitar confusiones con los procesos del renderizador (browser process).</p>\n<p>Véase también: <a href=\"#process\">proceso</a>, <a href=\"#renderer-process\">proceso de renderizado</a></p>\n<h3 id=\"mac\"><a href=\"#mac\">MAC</a></h3>\n<p>Acrónimo para la App Store de Apple. Para más detalles sobre el envío de su aplicación al MAS, consulte la <a href=\"/docs/tutorial/mac-app-store-submission-guide\">Guía de envíos de Mac App Store</a>.</p>\n<h3 id=\"mojo\"><a href=\"#mojo\">Mojo</a></h3>\n<p>Un sistema IPC para comunicarse dentro o entre procesos, y eso es importante porque Chrome está interesado en poder dividir su trabajo en procesos separados o no, dependiendo de las presiones de la memoria, etc.</p>\n<p>Ver <a href=\"https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md\">https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md</a></p>\n<p>Ver también: <a href=\"#ipc\">IPC</a></p>\n<h3 id=\"msi\"><a href=\"#msi\">MSI</a></h3>\n<p>En Windows, los paquetes MSI son usados por el servicio Windows Installer (también conocido como Microsoft Installer) para instalar y configurar aplicaciones.</p>\n<p>Puede encontrar más información en <a href=\"https://docs.microsoft.com/en-us/windows/win32/msi/windows-installer-portal\">Microsoft's documentation</a>.</p>\n<h3 id=\"módulos-nativos\"><a href=\"#módulos-nativos\">Módulos nativos</a></h3>\n<p>Los módulos nativos (también llamados <a href=\"https://nodejs.org/api/addons.html\">addons</a> en Node.js) son módulos escritos en C o C++ que pueden ser cargados en Node.js o Electron mediante la función require() y utilizarlos como si fueran un módulo ordinario de Node.js. Son usados principalmente para ofrecer una interfaz entre JavaScript corriendo en Node.js y las librerías C/C++.</p>\n<p>Nativo nodo módulos están soportados por el Electron, pero puesto que el Electron es muy probable que utilice una versión V8 del nodo binario instalada en su sistema, usted tiene que especificar manualmente la ubicación de cabeceras del Electron al compilar los módulos nativos.</p>\n<p>Para más información, lea el tutorial [Native Node Modules].</p>\n<h3 id=\"notarización\"><a href=\"#notarización\">notarización</a></h3>\n<p>La notarización es un proceso específico de macOS en el que un desarrollador puede enviar una aplicación firmada con código a los servidores de Apple para verificar la presencia de componentes maliciosos a través de un servicio automatizado.</p>\n<p>Ver también: <a href=\"#code-signing\">code signing</a></p>\n<h3 id=\"osr\"><a href=\"#osr\">OSR</a></h3>\n<p>OSR (representación fuera de pantalla) puede ser usado para cargar una página pesada en segundo plano y luego mostrarla después (será mucho más rápido). It allows you to render page without showing it on screen.</p>\n<p>Para más información, lea el tutorial <a href=\"/docs/tutorial/offscreen-rendering\">Offscreen Rendering</a>[osr].</p>\n<h3 id=\"script-de-precarga\"><a href=\"#script-de-precarga\">script de precarga</a></h3>\n<p>Los scripts de precarga contienen el código que se ejecuta en un proceso de renderizado antes de que su contenido web comience a cargar. Estos scripts se ejecutan dentro del contexto del renderizador, pero tienen más privilegios al tener acceso a las APIs de Node.js.</p>\n<p>Ver también: <a href=\"#renderer-process\">renderer process</a>, <a href=\"#context-isolation\">context isolation</a></p>\n<h3 id=\"process\"><a href=\"#process\">process</a></h3>\n<p>Un proceso es una instancia en un programa de computadora que está siendo ejecutado. Aplicaciones de Electron que hacen usan de la <a href=\"#main-process\">main</a> y uno o muchos procesos <a href=\"#renderer-process\">renderer</a> están ejecutando varios programas simultáneamente.</p>\n<p>En Node.js y Electron, cada proceso en ejecución tiene un objeto de <code>process</code>. Este objeto es un global que proporciona información sobre, y control sobre, el proceso actual. Como un global, siempre está disponible para aplicaciones sin utilizar require().</p>\n<p>Véase también: <a href=\"#main-process\">proceso principal</a>, <a href=\"#renderer-process\">proceso de renderizado</a></p>\n<h3 id=\"proceso-de-renderizado\"><a href=\"#proceso-de-renderizado\">proceso de renderizado</a></h3>\n<p>El renderer process es una ventana de navegador en tu aplicación. Unlike the main process, there can be multiple of these and each is run in a separate process. También pueden ocultarse.</p>\n<p>Véase también: <a href=\"#process\">proceso</a>, <a href=\"#main-process\">proceso principal</a></p>\n<h3 id=\"sandbox\"><a href=\"#sandbox\">sandbox</a></h3>\n<p>El sandbox es una característica de seguridad heredada de Chromium que restringe tus procesos de rederizados a u conjunto limitado de permisos.</p>\n<p>Para más información, lea el tutorial <a href=\"/docs/tutorial/sandbox\">Process Sandboxing</a>.</p>\n<p>Ver también: <a href=\"#process\">process</a></p>\n<h3 id=\"squirrel\"><a href=\"#squirrel\">Squirrel</a></h3>\n<p>Squirrel es un marco de código abierto que permite a aplicaciones de Electron actualizar automáticamente como se liberan nuevas versiones. Ver el <a href=\"/docs/api/auto-updater\">autoUpdater</a> API para información sobre cómo empezar con Squirrel.</p>\n<h3 id=\"entorno\"><a href=\"#entorno\">entorno</a></h3>\n<p>Este término que se originó en la comunidad Unix, donde \"userland\" o \"userspace\" se refiere a programas que se ejecutan afuera del kernel del sistema operativo. Más recientemente, el término se ha popularizado en la comunidad Node y npm para distinguir entre las características disponibles en el \"núcleo Node\" versus los paqutes publicados por el registro npm por la comunidad de \"usuarios\" mucho más grande.</p>\n<p>Como Node, Electron se centra en tener un pequeño conjunto de APIs que proporcionan a todas las primitivas necesarias para el desarrollo de aplicaciones de escritorio multiplataformas. Esta filosofía de diseño permite Electron a seguir siendo una herramienta flexible sin ser excesivamente prescriptivas sobre cómo deben utilizarse. Userland permite a los usuarios crear y compartir herramientas que proporcionen funcionalidad adicional además de lo que está disponible en el \"núcleo\".</p>\n<h3 id=\"v8\"><a href=\"#v8\">V8</a></h3>\n<p>V8 es el motor JavaScript de código abierto de Google. Está escrito en C++ y es usado en Google Chrome. V8 puede ejecutarse de independiente o puede incrustarse en cualquier aplicación de C++.</p>\n<p>Electrón forma V8 como parte de Chromium y luego apunta el Nodo ese V8 cuando lo está formando.</p>\n<p>Los números de versión V8's siempre se corresponden con los de Google Chrome. Chrome 59 incluye V8 5.9, Chrome 58 incluye V8 5.8, etc.</p>\n<ul>\n<li><a href=\"https://v8.dev/\">v8.dev</a></li>\n<li><a href=\"https://nodejs.org/api/v8.html\">nodejs.org/api/v8.html</a></li>\n<li><a href=\"/docs/development/v8-development\">docs/development/v8-development.md</a></li>\n</ul>\n<h3 id=\"webview\"><a href=\"#webview\">webview</a></h3>\n<p><code>webview</code> tags are used to embed 'guest' content (such as external web pages) in your Electron app. They are similar to <code>iframe</code>s, but differ in that each webview runs in a separate process. No tiene los mismos permisos que su página web y todas las interacciones entre tu aplicación y el contenido incluido serán asincrónicas. Esto mantiene a tu aplicación protegida de contenido incluido.</p>",
      "title": "Glosario",
      "description": ""
    },
    "/docs/development/goma": {
      "locale": "es-ES",
      "slug": "goma",
      "href": "/docs/development/goma",
      "crowdinFileId": "256157",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/goma.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"goma\"><a href=\"#goma\">Goma</a></h1>\n<blockquote>\n<p>Goma es un servicio de compilador distribuido para proyectos open-source tales como Chromium and Android.</p>\n</blockquote>\n<p>Electron tiene un despliegue de un Goma Backend personalizado que hacemos disponible para todos los Maintainers de Electron.  Ve la sección de <a href=\"#access\">Acceso</a> abajo para los detalles de autenticación.  También hay un <code>cache-only</code> Goma endpoint que se usará por defecto si tu no tienes credenciales.  Las solicitudes al cache-only Goma no afectarán a nuestro clúster, pero leerá de nuestra caché y debería resultar en tiempos de compilación significativamente más rápidos.</p>\n<h2 id=\"enabling-goma\"><a href=\"#enabling-goma\">Enabling Goma</a></h2>\n<p>Actualmente la única forma de usar Goma es usar nuestro <a href=\"https://github.com/electron/build-tools\">Build Tools</a>. Goma configuración es automáticamente incluida cuando instalas <code>build-tools</code>.</p>\n<p>Si eres un mantenedor y tienes acceso a nuestro cluster, por favor asegúrate de correr <code>e init</code> con <code>--goma=cluster</code> para configurar <code>build-tools</code> para utilizar Goma cluster.  Si tienes una configuración existente, puedes establecer <code>\"goma\": \"cluster\"</code> en tu archivo de configuración.</p>\n<h2 id=\"construyendo-con-goma\"><a href=\"#construyendo-con-goma\">Construyendo con Goma</a></h2>\n<p>Cuando estás usando Goma, puedes correr <code>ninja</code> con un valor sustancialmente alto de <code>j</code> que normalmente sería soportado por tu máquina.</p>\n<p>Por favor no establezca un valor mayor a <strong>200</strong> en Windows o Linux y <strong>50</strong> en macOS. Supervisamos el uso del sistema Goma, y los usuarios que abusan de él con concurrencia irrazonable serán desactivados.</p>\n<pre><code class=\"hljs language-bash\">ninja -C out/Testing electron -j 200\n</code></pre>\n<p>Si está usando <code>build-tools</code>, los valores apropiados de <code>-j</code> se usarán automáticamente.</p>\n<h2 id=\"monitoreando-goma\"><a href=\"#monitoreando-goma\">Monitoreando Goma</a></h2>\n<p>Si accedes a <a href=\"http://localhost:8088\">http://localhost:8088</a> en tu máquina local, puedes monitorear los trabajos de compilación como ellos fluyen a través del sistema de Goma.</p>\n<h2 id=\"acceso\"><a href=\"#acceso\">Acceso</a></h2>\n<p>Por razones de seguridad y costos, el acceso al cluster Goma de Electron actualmente está restringido a los Mantenedores de Electron.  Si quieres acceder, por favor dirigase a <code>#access-requests</code> en Slack y pregunte a <code>@goma-squad</code> por el acceso.  Por favor ten en cuenta que siendo un mantenedor no se concede <em>automáticamente</em> el acceso, y éste es determinado en caso por caso.</p>\n<h2 id=\"tiempo-de-actividad--soporte\"><a href=\"#tiempo-de-actividad--soporte\">Tiempo de actividad / Soporte</a></h2>\n<p>Hemos automatizado el monitoreo de nuestro clúster Goma y caché en <a href=\"https://status.notgoma.com\">https://status.notgoma.com</a></p>\n<p>No proporcionamos soporte para el uso de Goma cualquier propuesta planteada pidiendo ayuda / teniendo problemas <em>probablemente</em> se cerrarán sin mucha razón, no tenemos la capacidad para manejar ese tipo de soporte.</p>",
      "title": "Goma",
      "description": "Goma es un servicio de compilador distribuido para proyectos open-source tales como Chromium and Android."
    },
    "/docs/api/structures/gpu-feature-status": {
      "locale": "es-ES",
      "slug": "gpu-feature-status",
      "href": "/docs/api/structures/gpu-feature-status",
      "crowdinFileId": "256439",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/gpu-feature-status.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"gpufeaturestatus-object\"><a href=\"#gpufeaturestatus-object\">GPUFeatureStatus Object</a></h1>\n<ul>\n<li><code>2d_canvas</code> String - Canvas.</li>\n<li><code>flash_3d</code> String - Flash.</li>\n<li><code>flash_stage3d</code> String - Flash Stage3D.</li>\n<li><code>flash_stage3d_baseline</code> String - Flash Stage3D Baseline profile.</li>\n<li><code>gpu_compositing</code> String - Compositing.</li>\n<li><code>multiple_raster_threads</code> String - Multiple Raster Threads.</li>\n<li><code>native_gpu_memory_buffers</code> String - Native GpuMemoryBuffers.</li>\n<li><code>rasterization</code> String - Rasterization.</li>\n<li><code>video_decode</code> String - Video Decode.</li>\n<li><code>video_encode</code> String - Video Encode.</li>\n<li><code>vpx_decode</code> String - VPx Video Decode.</li>\n<li><code>webgl</code> String - WebGL.</li>\n<li><code>webgl2</code> String - WebGL2.</li>\n</ul>\n<p>Posibles valores:</p>\n<ul>\n<li><code>disabled_software</code> - Software only. Hardware acceleration disabled (yellow)</li>\n<li><code>disabled_off</code> - Disabled (red)</li>\n<li><code>disabled_off_ok</code> - Disabled (yellow)</li>\n<li><code>unavailable_software</code> - Software only, hardware acceleration unavailable (yellow)</li>\n<li><code>unavailable_off</code> - Unavailable (red)</li>\n<li><code>unavailable_off_ok</code> - Unavailable (yellow)</li>\n<li><code>enabled_readback</code> - Hardware accelerated but at reduced performance (yellow)</li>\n<li><code>enabled_force</code> - Hardware accelerated on all pages (green)</li>\n<li><code>enabled</code> - Hardware accelerated (green)</li>\n<li><code>enabled_on</code> - Enabled (green)</li>\n<li><code>enabled_force_on</code> - Force enabled (green)</li>\n</ul>",
      "title": "GPUFeatureStatus Object",
      "description": ""
    },
    "/docs/api/structures/hid-device": {
      "locale": "es-ES",
      "slug": "hid-device",
      "href": "/docs/api/structures/hid-device",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/hid-device.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"objecto-hiddevice\"><a href=\"#objecto-hiddevice\">Objecto HIDDevice</a></h1>\n<ul>\n<li><code>deviceId</code> String - Identificador unico para el dispositivo.</li>\n<li><code>name</code> String - Nombre del dispositivo.</li>\n<li><code>vendorId</code> Integer - El ID del proveedor USB.</li>\n<li><code>productId</code> Integer - El ID del producto USB.</li>\n<li><code>serialNumber</code> String (opcional) - El número de serie del dispositivo USB.</li>\n<li><code>guid</code> String (optional) - Identificador único para la interface del HID.  Un dispositivo puede tener múltiples interfaces HID.</li>\n</ul>",
      "title": "Objecto HIDDevice",
      "description": ""
    },
    "/docs/api/in-app-purchase": {
      "locale": "es-ES",
      "slug": "in-app-purchase",
      "href": "/docs/api/in-app-purchase",
      "crowdinFileId": "256325",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/in-app-purchase.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"compras-integradas\"><a href=\"#compras-integradas\">Compras integradas</a></h1>\n<blockquote>\n<p>Compras In-app en Mac App Store.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<h2 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h2>\n<p>El módulo <code>inAppPurchase</code> emite los siguientes eventos:</p>\n<h3 id=\"evento-transactions-updated\"><a href=\"#evento-transactions-updated\">Evento: 'transactions-updated'</a></h3>\n<p>Emitido cuando una o más transacciones han sido actualizadas.</p>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>transactions</code> Transaction[] - Un array de objetos <a href=\"/docs/api/structures/transaction\"><code>Transaction</code></a>.</li>\n</ul>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>inAppPurchase</code> tiene los siguientes métodos:</p>\n<h3 id=\"inapppurchasepurchaseproductproductid-quantity\"><a href=\"#inapppurchasepurchaseproductproductid-quantity\"><code>inAppPurchase.purchaseProduct(productID[, quantity])</code></a></h3>\n<ul>\n<li><code>productID</code> String - El identificador del producto a comprar. (El identificador de <code>com.example.app.product1</code> es <code>product1</code>).</li>\n<li><code>quantity</code> Integer (opcional) - El número de ítems que el usuario quiere comprar.</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;Boolean></code> - Devuelve <code>true</code> si el producto es valido y añadido a la cola de pago.</p>\n<p>Usted debería escuchar por el evento <code>transactions-updated</code> tan pronto como sea posible y sin dudas antes de llamar a <code>purchaseProduct</code>.</p>\n<h3 id=\"inapppurchasegetproductsproductids\"><a href=\"#inapppurchasegetproductsproductids\"><code>inAppPurchase.getProducts(productIDs)</code></a></h3>\n<ul>\n<li><code>productIDs</code> String[] - Los identificadores de los productos a obtener.</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;Product[]></code> - Resuelve con un array de objetos <a href=\"/docs/api/structures/product\"><code>Product</code></a>.</p>\n<p>Recupera las descripciones del producto.</p>\n<h3 id=\"inapppurchasecanmakepayments\"><a href=\"#inapppurchasecanmakepayments\"><code>inAppPurchase.canMakePayments()</code></a></h3>\n<p>Devuelve <code>Boolean</code> - si un usuario puede realizar un pago.</p>\n<h3 id=\"inapppurchaserestorecompletedtransactions\"><a href=\"#inapppurchaserestorecompletedtransactions\"><code>inAppPurchase.restoreCompletedTransactions()</code></a></h3>\n<p>Restaura las transacciones finalizadas. This method can be called either to install purchases on additional devices, or to restore purchases for an application that the user deleted and reinstalled.</p>\n<p><a href=\"https://developer.apple.com/documentation/storekit/skpaymentqueue?language=objc\">The payment queue</a> delivers a new transaction for each previously completed transaction that can be restored. Cada transacción incluye una copia de la transacción original.</p>\n<h3 id=\"inapppurchasegetreceipturl\"><a href=\"#inapppurchasegetreceipturl\"><code>inAppPurchase.getReceiptURL()</code></a></h3>\n<p>Devuelve <code>String</code> - la ruta para el recibo.</p>\n<h3 id=\"inapppurchasefinishalltransactions\"><a href=\"#inapppurchasefinishalltransactions\"><code>inAppPurchase.finishAllTransactions()</code></a></h3>\n<p>Completa todas las transacciones pendientes.</p>\n<h3 id=\"inapppurchasefinishtransactionbydatedate\"><a href=\"#inapppurchasefinishtransactionbydatedate\"><code>inAppPurchase.finishTransactionByDate(date)</code></a></h3>\n<ul>\n<li><code>date</code> String - La fecha en formato ISO de la transacción para terminar.</li>\n</ul>\n<p>Completa las pendientes transacciones correspondiendo al día.</p>",
      "title": "Compras integradas",
      "description": "Compras In-app en Mac App Store."
    },
    "/docs/tutorial/in-app-purchases": {
      "locale": "es-ES",
      "slug": "in-app-purchases",
      "href": "/docs/tutorial/in-app-purchases",
      "crowdinFileId": "256203",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/in-app-purchases.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"in-app-purchases-macos\"><a href=\"#in-app-purchases-macos\">In-App Purchases (macOS)</a></h1>\n<h2 id=\"preparando\"><a href=\"#preparando\">Preparando</a></h2>\n<h3 id=\"acuerdo-de-aplicaciones-de-pago\"><a href=\"#acuerdo-de-aplicaciones-de-pago\">Acuerdo de Aplicaciones de Pago</a></h3>\n<p>Si no lo has hecho todavia, tienes que firmar el Acuerdo de Aplicaciones de Pago y configurar tus dados bancarios y fiscales en iTunes Connect.</p>\n<p><a href=\"https://help.apple.com/itunes-connect/developer/#/devb6df5ee51\">Ayuda al desarrollador de iTunes Connect: Resumen de acuerdos, impuestos y bancos</a></p>\n<h3 id=\"crea-tus-compras-dentro-de-la-app\"><a href=\"#crea-tus-compras-dentro-de-la-app\">Crea tus compras dentro de la App</a></h3>\n<p>Después, debes configurar tus compras dentro de la App en iTunes Connect, e incluir detalles como nombre, precio, y un descriptivo que destaque las características y funcionalidades de tu compra dentro de la aplicación.</p>\n<p><a href=\"https://help.apple.com/itunes-connect/developer/#/devae49fb316\">Ayuda al desarrollador de iTunes Connect: Crear una compra dentro de la App</a></p>\n<h3 id=\"cambia-el-cfbundleidentifier\"><a href=\"#cambia-el-cfbundleidentifier\">Cambia el CFBundleIdentifier</a></h3>\n<p>Para testar las compras dentro de la App, tienes que cambiar el <code>CFBundleIdentifier</code> en <code>node_modules/electron/dist/Electron.app/Contents/Info.plist</code>. Tienes que reemplazar <code>com.github.electron</code> por el identificador del paquete de la aplicación que creaste en iTunes Connect.</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>CFBundleIdentifier<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>com.example.app<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n</code></pre>\n<h2 id=\"ejemplo-de-código\"><a href=\"#ejemplo-de-código\">Ejemplo de código</a></h2>\n<p>Aquí hay un ejemplo de como usar las compras dentro de la App en Electron. Tienes que reemplazar las IDs de los productos por los identificadores de los productos creados con iTunes Connect (el identificador de <code>com.example.app.product1</code> es <code>product1</code>). Nota que tienes que escuchar al evento <code>transactions-updated</code> tan pronto como sea posible en tu App.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { inAppPurchase } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> PRODUCT_IDS = [<span class=\"hljs-string\">'id1'</span>, <span class=\"hljs-string\">'id2'</span>]\n\n<span class=\"hljs-comment\">// Listen for transactions as soon as possible.</span>\ninAppPurchase.on(<span class=\"hljs-string\">'transactions-updated'</span>, (event, transactions) => {\n  <span class=\"hljs-keyword\">if</span> (!<span class=\"hljs-built_in\">Array</span>.isArray(transactions)) {\n    <span class=\"hljs-keyword\">return</span>\n  }\n\n  <span class=\"hljs-comment\">// Verifica cada transacción.</span>\n  transactions.forEach(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\">transaction</span>) </span>{\n    <span class=\"hljs-keyword\">const</span> payment = transaction.payment\n\n    <span class=\"hljs-keyword\">switch</span> (transaction.transactionState) {\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'purchasing'</span>:\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Purchasing <span class=\"hljs-subst\">${payment.productIdentifier}</span>...`</span>)\n        <span class=\"hljs-keyword\">break</span>\n\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'purchased'</span>: {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${payment.productIdentifier}</span> purchased.`</span>)\n\n        <span class=\"hljs-comment\">// Get the receipt url.</span>\n        <span class=\"hljs-keyword\">const</span> receiptURL = inAppPurchase.getReceiptURL()\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Receipt URL: <span class=\"hljs-subst\">${receiptURL}</span>`</span>)\n\n        <span class=\"hljs-comment\">// Submit the receipt file to the server and check if it is valid.</span>\n        <span class=\"hljs-comment\">// @see https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html</span>\n        <span class=\"hljs-comment\">// ...</span>\n        <span class=\"hljs-comment\">// Si el recibo es válido, el producto es comprado</span>\n        <span class=\"hljs-comment\">// ...</span>\n\n        <span class=\"hljs-comment\">// Acaba la transacción.</span>\n        inAppPurchase.finishTransactionByDate(transaction.transactionDate)\n\n        <span class=\"hljs-keyword\">break</span>\n      }\n\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'failed'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Failed to purchase <span class=\"hljs-subst\">${payment.productIdentifier}</span>.`</span>)\n\n        <span class=\"hljs-comment\">// Finish the transaction.</span>\n        inAppPurchase.finishTransactionByDate(transaction.transactionDate)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'restored'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The purchase of <span class=\"hljs-subst\">${payment.productIdentifier}</span> has been restored.`</span>)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'deferred'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The purchase of <span class=\"hljs-subst\">${payment.productIdentifier}</span> has been deferred.`</span>)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-attr\">default</span>:\n        <span class=\"hljs-keyword\">break</span>\n    }\n  })\n})\n\n<span class=\"hljs-comment\">// Verifica si el usuario tiene permitido realizar la compra.</span>\n<span class=\"hljs-keyword\">if</span> (!inAppPurchase.canMakePayments()) {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The user is not allowed to make in-app purchase.'</span>)\n}\n\n<span class=\"hljs-comment\">// Retrieve and display the product descriptions.</span>\ninAppPurchase.getProducts(PRODUCT_IDS).then(<span class=\"hljs-function\"><span class=\"hljs-params\">products</span> =></span> {\n  <span class=\"hljs-comment\">// Verificar los parámetros.</span>\n  <span class=\"hljs-keyword\">if</span> (!<span class=\"hljs-built_in\">Array</span>.isArray(products) || products.length &#x3C;= <span class=\"hljs-number\">0</span>) {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Unable to retrieve the product informations.'</span>)\n    <span class=\"hljs-keyword\">return</span>\n  }\n\n  <span class=\"hljs-comment\">// Display the name and price of each product.</span>\n  products.forEach(<span class=\"hljs-function\"><span class=\"hljs-params\">product</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`El precio de  <span class=\"hljs-subst\">${product.localizedTitle}</span> es <span class=\"hljs-subst\">${product.formattedPrice}</span>.`</span>)\n  })\n\n  <span class=\"hljs-comment\">// Pregunta al usuario cual producto el/ella quiere comprar.</span>\n  <span class=\"hljs-keyword\">const</span> selectedProduct = products[<span class=\"hljs-number\">0</span>]\n  <span class=\"hljs-keyword\">const</span> selectedQuantity = <span class=\"hljs-number\">1</span>\n\n  <span class=\"hljs-comment\">// Purchase the selected product.</span>\n  inAppPurchase.purchaseProduct(selectedProduct.productIdentifier, selectedQuantity).then(<span class=\"hljs-function\"><span class=\"hljs-params\">isProductValid</span> =></span> {\n    <span class=\"hljs-keyword\">if</span> (!isProductValid) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The product is not valid.'</span>)\n      <span class=\"hljs-keyword\">return</span>\n    }\n\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The payment has been added to the payment queue.'</span>)\n  })\n})\n</code></pre>",
      "title": "In-App Purchases (macOS)",
      "description": ""
    },
    "/docs/api/incoming-message": {
      "locale": "es-ES",
      "slug": "incoming-message",
      "href": "/docs/api/incoming-message",
      "crowdinFileId": "256327",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/incoming-message.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-incomingmessage\"><a href=\"#clase-incomingmessage\">Clase: IncomingMessage</a></h2>\n<blockquote>\n<p>Maneja las respuestas a las solicitudes HTTP/HTTPS.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>IncomingMessage</code> implementa la interfaz <a href=\"https://nodejs.org/api/stream.html#stream_readable_streams\">Readable Stream</a> y es por lo tanto un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h3 id=\"eventos-de-instancia\"><a href=\"#eventos-de-instancia\">Eventos de Instancia</a></h3>\n<h4 id=\"evento-data\"><a href=\"#evento-data\">Evento: \"data\"</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>chunk</code> Buffer - Un fragmento de la colección de datos de respuesta.</li>\n</ul>\n<p>El evento <code>data</code> es el método habitual de transferir datos de respuesta en código aplicativo.</p>\n<h4 id=\"evento-end\"><a href=\"#evento-end\">Evento: \"end\"</a></h4>\n<p>Indica que la respuesta del cuerpo ha finalizado. Debe colocarse antes del evento ' Data '.</p>\n<h4 id=\"evento-aborted\"><a href=\"#evento-aborted\">Evento: \"aborted\"</a></h4>\n<p>Aparece cuando una solicitud ha sido cancelada durante una transacción HTTP en curso.</p>\n<h4 id=\"evento-error\"><a href=\"#evento-error\">Evento: \"error\"</a></h4>\n<p>Devuelve:</p>\n<p><code>error</code> Error - Por lo general tiene tiene una cadena de error por la falla de la identificación de la causa raíz.</p>\n<p>Aparece cuando se detecta un error mientras se transmiten los eventos de datos de respuesta. Por ejemplo, si el servidor cierra el subyacente mientras que la respuesta todavía se está transfiriendo, un evento <code>data</code> aparecerá como objeto de respuesta y un evento <code>close</code> seguirá posteriormente al objeto de la solicitud.</p>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<p>Una instancia <code>IncomingMessage</code> tiene las siguientes propiedades legibles:</p>\n<h4 id=\"responsestatuscode\"><a href=\"#responsestatuscode\"><code>response.statusCode</code></a></h4>\n<p>Un <code>Integer</code> indicando el código de estatus de respuesta HTTP.</p>\n<h4 id=\"responsestatusmessage\"><a href=\"#responsestatusmessage\"><code>response.statusMessage</code></a></h4>\n<p>Una <code>String</code> representando el mensaje de estado HTTP.</p>\n<h4 id=\"responseheaders\"><a href=\"#responseheaders\"><code>response.headers</code></a></h4>\n<p>Un <code>Record&#x3C;string, string | string[]></code> que representa las cabeceras de la respuesta HTTP. El objeto <code>headers</code> tiene el siguiente formato:</p>\n<ul>\n<li>Todos los nombres de los encabezados son puestos en minúsculas.</li>\n<li>Duplicados de <code>age</code>, <code>authorization</code>, <code>content-length</code>, <code>content-type</code>, <code>etag</code>, <code>expires</code>, <code>from</code>, <code>host</code>, <code>if-modified-since</code>, <code>if-unmodified-since</code>, <code>last-modified</code>, <code>location</code>, <code>max-forwards</code>, <code>proxy-authorization</code>, <code>referer</code>, <code>retry-after</code>, <code>server</code>, o <code>user-agent</code> son descartados.</li>\n<li><code>set-cookie</code> siempre es un array. Los duplicados son agregados al array.</li>\n<li>Para los encabezados <code>cookie</code> duplicados, los valores se unen con '; '.</li>\n<li>Para todos los otros encabezados, los valores se unen con ', '.</li>\n</ul>\n<h4 id=\"responsehttpversion\"><a href=\"#responsehttpversion\"><code>response.httpVersion</code></a></h4>\n<p>Una <code>String</code> que indica el número de versión de protocolo HTTP. Los valores típicos son \"1.0\" o \"1.1\". Adicionalmente <code>httpVersionMajor</code> y <code>httpVersionMinor</code> son dos propiedades legibles de valores enteros que devuelven los números de la versión principal y secundaria de HTTP respectivamente.</p>\n<h4 id=\"responsehttpversionmajor\"><a href=\"#responsehttpversionmajor\"><code>response.httpVersionMajor</code></a></h4>\n<p>Un <code>Integer</code> que indica el número de la versión principal del protocolo HTTP.</p>\n<h4 id=\"responsehttpversionminor\"><a href=\"#responsehttpversionminor\"><code>response.httpVersionMinor</code></a></h4>\n<p>Un <code>Integer</code> que indica el número de la versión secundaria del protocolo HTTP.</p>",
      "title": "Clase: IncomingMessage",
      "description": "Maneja las respuestas a las solicitudes HTTP/HTTPS."
    },
    "/docs/api/structures/input-event": {
      "locale": "es-ES",
      "slug": "input-event",
      "href": "/docs/api/structures/input-event",
      "crowdinFileId": "256441",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"inputevent-object\"><a href=\"#inputevent-object\">InputEvent Object</a></h1>\n<ul>\n<li><code>modifiers</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of modifiers of the event, can be <code>shift</code>, <code>control</code>, <code>ctrl</code>, <code>alt</code>, <code>meta</code>, <code>command</code>, <code>cmd</code>, <code>isKeypad</code>, <code>isAutoRepeat</code>, <code>leftButtonDown</code>, <code>middleButtonDown</code>, <code>rightButtonDown</code>, <code>capsLock</code>, <code>numLock</code>, <code>left</code>, <code>right</code>.</li>\n</ul>",
      "title": "InputEvent Object",
      "description": ""
    },
    "/docs/tutorial/installation": {
      "locale": "es-ES",
      "slug": "installation",
      "href": "/docs/tutorial/installation",
      "crowdinFileId": "256205",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/installation.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"advanced-installation-instructions\"><a href=\"#advanced-installation-instructions\">Advanced Installation Instructions</a></h1>\n<p>To install prebuilt Electron binaries, use <a href=\"https://docs.npmjs.com\"><code>npm</code></a>. The preferred method is to install Electron as a development dependency in your app:</p>\n<pre><code class=\"hljs language-sh\">npm install electron --save-dev\n</code></pre>\n<p>Por favor, echa un vistazo a <a href=\"/docs/tutorial/electron-versioning\">Electron versioning doc</a> para información de como manejar version de Electron en tus apps.</p>\n<h2 id=\"running-electron-ad-hoc\"><a href=\"#running-electron-ad-hoc\">Running Electron ad-hoc</a></h2>\n<p>If you're in a pinch and would prefer to not use <code>npm install</code> in your local project, you can also run Electron ad-hoc using the <a href=\"https://docs.npmjs.com/cli/v7/commands/npx\"><code>npx</code></a> command runner bundled with <code>npm</code>:</p>\n<pre><code class=\"hljs language-sh\">npx electron .\n</code></pre>\n<p>The above command will run the current working directory with Electron. Note that any dependencies in your app will not be installed.</p>\n<h2 id=\"personalización\"><a href=\"#personalización\">Personalización</a></h2>\n<p>Si quieres cambiar la arquitectura que será descargada (e.g, <code>ia32</code> en una máquina <code>x64</code>), puedes usar el flag <code>--arch</code> con npm install o configurar la variable de entorno <code>npm_config_arch</code>:</p>\n<pre><code class=\"hljs language-shell\">npm install --arch=ia32 electron\n</code></pre>\n<p>Además de cambiar la arquitectura, también se puede especificar la plataforma (e.g., <code>win32</code>, <code>linux</code>, etc.) utilizando el flag <code>--platform</code>:</p>\n<pre><code class=\"hljs language-shell\">npm install --platform=win32 electron\n</code></pre>\n<h2 id=\"proxies\"><a href=\"#proxies\">Proxies</a></h2>\n<p>If you need to use an HTTP proxy, you need to set the <code>ELECTRON_GET_USE_PROXY</code> variable to any value, plus additional environment variables depending on your host system's Node version:</p>\n<ul>\n<li><a href=\"https://github.com/gajus/global-agent/blob/v2.1.5/README.md#environment-variables\">Node 10 o superior</a></li>\n<li><a href=\"https://github.com/np-maintain/global-tunnel/blob/v2.7.1/README.md#auto-config\">Anterior a Node 10</a></li>\n</ul>\n<h2 id=\"espejos-y-cachés-personalizados\"><a href=\"#espejos-y-cachés-personalizados\">Espejos y cachés personalizados</a></h2>\n<p>Durante la instalación, el módulo <code>electron</code> llamara a <a href=\"https://github.com/electron/get\"><code>electron-download</code></a> para descargar binarios precompilados de Electron para tu plataforma. Lo hará poniéndose en contacto con la página de descarga de versiones de GitHub (<code>https://github.com/electron/electron/releases/tag/v$VERSION</code>, donde <code>$VERSION</code> es la versión exacta de Electron).</p>\n<p>Si no puede acceder a GitHub o necesita proporcionar una compilación personalizada, puede hacerlo proporcionando un espejo o un directorio de caché existente.</p>\n<h4 id=\"espejo\"><a href=\"#espejo\">Espejo</a></h4>\n<p>Puede usar variables de entorno para anular la URL base, la ruta en la cual buscar binarios de Electron y el nombre del archivo binario. The URL used by <code>@electron/get</code> is composed as follows:</p>\n<pre><code class=\"hljs language-javascript\">url = ELECTRON_MIRROR + ELECTRON_CUSTOM_DIR + <span class=\"hljs-string\">'/'</span> + ELECTRON_CUSTOM_FILENAME\n</code></pre>\n<p>For instance, to use the China CDN mirror:</p>\n<pre><code class=\"hljs language-shell\">ELECTRON_MIRROR=\"https://cdn.npm.taobao.org/dist/electron/\"\n</code></pre>\n<p>By default, <code>ELECTRON_CUSTOM_DIR</code> is set to <code>v$VERSION</code>. To change the format, use the <code>{{ version }}</code> placeholder. For example, <code>version-{{ version }}</code> resolves to <code>version-5.0.0</code>, <code>{{ version }}</code> resolves to <code>5.0.0</code>, and <code>v{{ version }}</code> is equivalent to the default. As a more concrete example, to use the China non-CDN mirror:</p>\n<pre><code class=\"hljs language-shell\">ELECTRON_MIRROR=\"https://npm.taobao.org/mirrors/electron/\"\nELECTRON_CUSTOM_DIR=\"{{ version }}\"\n</code></pre>\n<p>The above configuration will download from URLs such as <code>https://npm.taobao.org/mirrors/electron/8.0.0/electron-v8.0.0-linux-x64.zip</code>.</p>\n<p>Si tu réplica sirve artefactos con diferentes sumas de verificación al del oficial de Electron, puede que tengas que establecer <code>ELECTRON_USE_REMOTE_CHECKSUMS=1</code> para forzar a Electron a usar el archivo <code>SHASUMS256.txt</code> para verificar la suma de verificación en lugar de la comprobación incrustada.</p>\n<h4 id=\"caché\"><a href=\"#caché\">Caché</a></h4>\n<p>Alternativamente, puede anular la memoria caché local. <code>@electron-get</code> almacenará en caché los archivos binarios descargados en un directorio local para no sobrecargar tu red. Puede usar esa carpeta de caché para proporcionar compilaciones personalizadas de Electron o para evitar hacer contacto con la red en absoluto.</p>\n<ul>\n<li>Linux: <code>$XDG_CACHE_HOME</code> or <code>~/.cache/electron/</code></li>\n<li>macOS: <code>~/Library/Caches/electron/</code></li>\n<li>Windows: <code>$LOCALAPPDATA/electron/Cache</code> or <code>~/AppData/Local/electron/Cache/</code></li>\n</ul>\n<p>En entornos que han estado usando versiones anteriores de Electron, también podrás encontrar la caché en <code>~/.electron</code>.</p>\n<p>También se puede anular la ubicación de almacenamiento en caché local al proporcionar una variable de entorno <code>electron_config_cache</code>.</p>\n<p>The cache contains the version's official zip file as well as a checksum, stored as a text file. A typical cache might look like this:</p>\n<pre><code class=\"hljs language-sh\">├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9electron-v1.7.9-darwin-x64.zip\n│   └── electron-v1.7.9-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1electron-v1.8.1-darwin-x64.zip\n│   └── electron-v1.8.1-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1electron-v1.8.2-beta.1-darwin-x64.zip\n│   └── electron-v1.8.2-beta.1-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2electron-v1.8.2-beta.2-darwin-x64.zip\n│   └── electron-v1.8.2-beta.2-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3electron-v1.8.2-beta.3-darwin-x64.zip\n│   └── electron-v1.8.2-beta.3-darwin-x64.zip\n└── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3SHASUMS256.txt\n    └── SHASUMS256.txt\n</code></pre>\n<h2 id=\"omitir-la-descarga-del-archivo-binario\"><a href=\"#omitir-la-descarga-del-archivo-binario\">Omitir la descarga del archivo binario</a></h2>\n<p>Bajo suyo, la API JavaScript de Electron se une a un binario que contiene sus implementaciones. Because this binary is crucial to the function of any Electron app, it is downloaded by default in the <code>postinstall</code> step every time you install <code>electron</code> from the npm registry.</p>\n<p>However, if you want to install your project's dependencies but don't need to use Electron functionality, you can set the <code>ELECTRON_SKIP_BINARY_DOWNLOAD</code> environment variable to prevent the binary from being downloaded. For instance, this feature can be useful in continuous integration environments when running unit tests that mock out the <code>electron</code> module.</p>\n<pre><code class=\"hljs language-sh\">ELECTRON_SKIP_BINARY_DOWNLOAD=1 npm install\n</code></pre>\n<h2 id=\"problemas\"><a href=\"#problemas\">Problemas</a></h2>\n<p>Cuando ejecutamos <code>npm install electron</code>, ocasionalmente algunos usuarios encuentran errores en la instalación.</p>\n<p>En casi todos los casos, estos errores son resultados de problemas en la red y no de problemas con el paquete npm de <code>electron</code>. Errores como <code>ELIFECYCLE</code>, <code>EAI_AGAIN</code>, <code>ECONNRESET</code> y <code>ETIMEDOUT</code> son indicadores de dichos problemas de red. La mejor solución es tratar de cambiar las redes, o esperar un poco e instalar de nuevo.</p>\n<p>You can also attempt to download Electron directly from <a href=\"https://github.com/electron/electron/releases\">electron/electron/releases</a> if installing via <code>npm</code> is failing.</p>\n<p>If installation fails with an <code>EACCESS</code> error you may need to <a href=\"https://docs.npmjs.com/getting-started/fixing-npm-permissions\">fix your npm permissions</a>.</p>\n<p>If the above error persists, the <a href=\"https://docs.npmjs.com/misc/config#unsafe-perm\">unsafe-perm</a> flag may need to be set to true:</p>\n<pre><code class=\"hljs language-sh\">sudo npm install electron --unsafe-perm=<span class=\"hljs-literal\">true</span>\n</code></pre>\n<p>En redes lentas, puede ser aconsejable utilizar la marca <code>--verbose</code> de manera que se muestre el progreso de la descarga:</p>\n<pre><code class=\"hljs language-sh\">npm install --verbose electron\n</code></pre>\n<p>Si necesita forzar que se vuelvan a descargar el recurso y el archivo SHASUM, fije la variable de entorno <code>force_no_cache</code> a <code>true</code>.</p>",
      "title": "Advanced Installation Instructions",
      "description": ""
    },
    "/docs/tutorial/introduction": {
      "locale": "es-ES",
      "slug": "introduction",
      "href": "/docs/tutorial/introduction",
      "crowdinFileId": "256207",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/introduction.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"introducción\"><a href=\"#introducción\">Introducción</a></h1>\n<p>Bienvenido a la documentacion de Electron! Si es esta es tu primera vez programando una aplicacion de Electron, lea esta sección de Introducción para familiarizarse con lo esencial. De lo contrario, sientase libre de explorar nuestra guias y documentaciones sobre nuestra API!</p>\n<h2 id=\"¿qué-es-electron\"><a href=\"#¿qué-es-electron\">¿Qué es Electron?</a></h2>\n<p>Electron es un framework para crear aplicaciones de escritorio usando JavaScript, HTML y CSS. Incrustando <a href=\"https://www.chromium.org/\">Chromium</a> y <a href=\"https://nodejs.org/\">Node.js</a> dentro del mismo, Electron le permite mantener una base de código JavaScript y crear aplicaciones multiplataforma que funcionan en Windows, macOS y Linux, - no requiere experiencia en desarrollo nativo.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<p>Estos documentos funcionan bajo el supuesto de que el lector está familiarizado con ambos Node.js y desarrollo web en general. Si necesita sentirse más cómodo con cualquiera de estas áreas, recomendamos los siguientes recursos:</p>\n<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web\">Comenzando con la Web (MDN)</a></li>\n<li><a href=\"https://nodejs.dev/learn\">Introducción a Node.js</a></li>\n</ul>\n<p>Además, tendrá un mejor momento para comprender cómo funciona Electron si obtiene familiarizado con el modelo de proceso de Chromium. Puede obtener una breve descripción general de Arquitectura de Chrome con el <a href=\"https://www.google.com/googlebooks/chrome/\"> cómic de Chrome </a>, que se lanzó junto Lanzamiento de Chrome en 2008. Aunque ha pasado más de una década desde entonces, el Los principios básicos introducidos en el cómic siguen siendo útiles para comprender a Electron.</p>\n<h2 id=\"ejecución-de-ejemplos-con-electron-fiddle\"><a href=\"#ejecución-de-ejemplos-con-electron-fiddle\">Ejecución de ejemplos con Electron Fiddle</a></h2>\n<p><a href=\"https://electronjs.org/fiddle\">Electron Fiddle</a> es una sandbox app escrita con Electron y apoyado por Mantenedores de Electron. Recomendamos encarecidamente instalarlo como herramienta de aprendizaje para Experimente con las API de Electron o para crear prototipos de funciones durante el desarrollo.</p>\n<p>Fiddle también se integra muy bien con nuestra documentación. Al navegar a través de ejemplos en nuestros tutoriales, verá con frecuencia un botón \"Abrir en Electron Fiddle\" debajo un bloque de código. Si tiene Fiddle instalado, este botón abrirá un link a <code>fiddle.electronjs.org</code> esto cargará automáticamente el ejemplo en Fiddle, no es necesario copiar y pegar.</p>\n<h2 id=\"obtener-ayuda\"><a href=\"#obtener-ayuda\">Obtener ayuda</a></h2>\n<p>¿Te quedas atascado en alguna parte? Aquí hay algunos enlaces a lugares para buscar:</p>\n<ul>\n<li>Si necesitas ayuda para desarrollar tu aplicación, nuestro <a href=\"https://discord.gg/electron\">servidor de Discord comunitario</a> es un gran lugar para obtener consejos de otros desarrolladores de aplicaciones de Electron.</li>\n<li>Si sospechas que tienes un error con el paquete <code>electron</code>. por favor revisa el <a href=\"https://github.com/electron/electron/issues\">GitHub issue tracker</a> para ver si algún problema existente coincide con tu problema. Si no, no dudes en rellenar nuestra plantilla de informe de errores y enviar un nuevo problema.</li>\n</ul>",
      "title": "Introducción",
      "description": ""
    },
    "/docs/api/structures/io-counters": {
      "locale": "es-ES",
      "slug": "io-counters",
      "href": "/docs/api/structures/io-counters",
      "crowdinFileId": "256443",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/io-counters.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"iocounters-object\"><a href=\"#iocounters-object\">IOCounters Object</a></h1>\n<ul>\n<li><code>readOperationCount</code> Number - The number of I/O read operations.</li>\n<li><code>writeOperationCount</code> Number - The number of I/O write operations.</li>\n<li><code>otherOperationCount</code> Number - Then number of I/O other operations.</li>\n<li><code>readTransferCount</code> Number - The number of I/O read transfers.</li>\n<li><code>writeTransferCount</code> Number - The number of I/O write transfers.</li>\n<li><code>otherTransferCount</code> Number - Then number of I/O other transfers.</li>\n</ul>",
      "title": "IOCounters Object",
      "description": ""
    },
    "/docs/api/ipc-main": {
      "locale": "es-ES",
      "slug": "ipc-main",
      "href": "/docs/api/ipc-main",
      "crowdinFileId": "256329",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/ipc-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmain\"><a href=\"#ipcmain\">ipcMain</a></h1>\n<blockquote>\n<p>Se comunica de forma asincrónica desde el proceso principal a los procesos de renderizado.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p>El módulo <code>ipcMain</code> es un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">Event Emitter</a>. Cuando se utiliza en el proceso principal, maneja mensajes asincrónicos y sincrónicos enviados desde el proceso de renderizado (página web). Los mensajes enviados desde el renderizador serán emitidos a este módulo.</p>\n<h2 id=\"enviando-mensajes\"><a href=\"#enviando-mensajes\">Enviando mensajes</a></h2>\n<p>También es posible enviar mensajes desde el proceso principal al proceso de renderizado, ver <a href=\"/docs/api/web-contents#contentssendchannel-args\">webContents.send</a> para más información.</p>\n<ul>\n<li>Cuando se envía un mensaje, el nombre del evento es el<code>channel</code>.</li>\n<li>Para responder a un mensaje sincrónico, es necesario establecer <code>event.returnValue</code>.</li>\n<li>Para enviar un mensaje asíncrono de vuelta al emisor, puede usar <code>event.reply(...)</code>.  Este método de ayuda automáticamente va a manejar los mensajes entrantes desde frames que no son el frame principal (ejemplo iframes) mientras que <code>event.sender.send(...)</code> siempre enviará al frame principal.</li>\n</ul>\n<p>Ejemplo de envío y manejo de mensajes entre el proceso de renderizado y el principal:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In main process.</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'asynchronous-message'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"ping\"</span>\n  event.reply(<span class=\"hljs-string\">'asynchronous-reply'</span>, <span class=\"hljs-string\">'pong'</span>)\n})\n\nipcMain.on(<span class=\"hljs-string\">'synchronous-message'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"ping\"</span>\n  event.returnValue = <span class=\"hljs-string\">'pong'</span>\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In renderer process (web page).</span>\n<span class=\"hljs-comment\">// NB. Electron APIs are only accessible from preload, unless contextIsolation is disabled.</span>\n<span class=\"hljs-comment\">// Vea https://www.electronjs.org/docs/tutorial/process-model#preload-scripts para más detalles.</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(ipcRenderer.sendSync(<span class=\"hljs-string\">'synchronous-message'</span>, <span class=\"hljs-string\">'ping'</span>)) <span class=\"hljs-comment\">// prints \"pong\"</span>\n\nipcRenderer.on(<span class=\"hljs-string\">'asynchronous-reply'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"pong\"</span>\n})\nipcRenderer.send(<span class=\"hljs-string\">'asynchronous-message'</span>, <span class=\"hljs-string\">'ping'</span>)\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>ipcMain</code> tiene el siguiente método para escuchar los eventos:</p>\n<h3 id=\"ipcmainonchannel-listener\"><a href=\"#ipcmainonchannel-listener\"><code>ipcMain.on(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>listener</code> Función<ul>\n<li><code>event</code> IpcMainEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Escucha al <code>channel</code>. Cuando llega un nuevo mensaje <code>listener</code> es llamado con <code>listener(event, args...)</code>.</p>\n<h3 id=\"ipcmainoncechannel-listener\"><a href=\"#ipcmainoncechannel-listener\"><code>ipcMain.once(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>listener</code> Función<ul>\n<li><code>event</code> IpcMainEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Adds a one time <code>listener</code> function for the event. This <code>listener</code> is invoked only the next time a message is sent to <code>channel</code>, after which it is removed.</p>\n<h3 id=\"ipcmainremovelistenerchannel-listener\"><a href=\"#ipcmainremovelistenerchannel-listener\"><code>ipcMain.removeListener(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>listener</code> Función<ul>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Elimina el <code>listener</code> especificado del arreglo listener para el <code>channel</code> especificado.</p>\n<h3 id=\"ipcmainremovealllistenerschannel\"><a href=\"#ipcmainremovealllistenerschannel\"><code>ipcMain.removeAllListeners([channel])</code></a></h3>\n<ul>\n<li><code>channel</code> Cadena (opcional)</li>\n</ul>\n<p>Elimina los oyentes del <code>channel</code> especificado.</p>\n<h3 id=\"ipcmainhandlechannel-listener\"><a href=\"#ipcmainhandlechannel-listener\"><code>ipcMain.handle(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>listener</code> Function&#x3C;Promise\\<void> | any><ul>\n<li><code>event</code> IpcMainInvokeEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></void></li>\n</ul>\n<p>Adds a handler for an <code>invoke</code>able IPC. This handler will be called whenever a renderer calls <code>ipcRenderer.invoke(channel, ...args)</code>.</p>\n<p>Si <code>listener</code> devuelve una Promise, el eventual resultado de la promise será devuelto como una respuesta al controlador remoto. De lo contrario, el valor de retorno del listener será usado como el valor de la respuesta.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\nipcMain.handle(<span class=\"hljs-string\">'my-invokable-ipc'</span>, <span class=\"hljs-keyword\">async</span> (event, ...args) => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> somePromise(...args)\n  <span class=\"hljs-keyword\">return</span> result\n})\n\n<span class=\"hljs-comment\">// Renderer process</span>\n<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> ipcRenderer.invoke(<span class=\"hljs-string\">'my-invokable-ipc'</span>, arg1, arg2)\n  <span class=\"hljs-comment\">// ...</span>\n}\n</code></pre>\n<p>El <code>event</code> que es pasado como primer argumento al handler es el mismo que es pasado a un event listener normal. Incluye información sobre cual WebContents es el origen de la solicitud invocada.</p>\n<p>Los errores lanzados a través de <code>handle</code> en el main process no son transparentes, ya que se serializan y solo la propiedad <code>message</code> del error original es proveído al renderer process. Por favor, consulte <a href=\"https://github.com/electron/electron/issues/24427\">#24427</a> para más detalles.</p>\n<h3 id=\"ipcmainhandleoncechannel-listener\"><a href=\"#ipcmainhandleoncechannel-listener\"><code>ipcMain.handleOnce(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>listener</code> Function&#x3C;Promise\\<void> | any><ul>\n<li><code>event</code> IpcMainInvokeEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></void></li>\n</ul>\n<p>Maneja un solo <code>invoke</code>able mensaje IPC, luego elimina el listener. See <code>ipcMain.handle(channel, listener)</code>.</p>\n<h3 id=\"ipcmainremovehandlerchannel\"><a href=\"#ipcmainremovehandlerchannel\"><code>ipcMain.removeHandler(channel)</code></a></h3>\n<ul>\n<li><code>channel</code> Cadena</li>\n</ul>\n<p>Elimina cualquier controlador para <code>channel</code>, si hay.</p>\n<h2 id=\"objeto-ipcmainevent\"><a href=\"#objeto-ipcmainevent\">Objeto IpcMainEvent</a></h2>\n<p>La documentación para el objeto <code>event</code> pasado a <code>callback</code> puede ser encontrada en la estructura de documentos de <a href=\"/docs/api/structures/ipc-main-event\"><code>ipc-main-event</code></a>.</p>\n<h2 id=\"objeto-ipcmaininvokeevent\"><a href=\"#objeto-ipcmaininvokeevent\">Objeto IpcMainInvokeEvent</a></h2>\n<p>La documentación para el objeto <code>event</code> pasado a <code>handle</code> callbacks puede ser encontrada en la estructura de documentos <a href=\"/docs/api/structures/ipc-main-invoke-event\"><code>ipc-main-invoke-event</code></a>.</p>",
      "title": "ipcMain",
      "description": "Se comunica de forma asincrónica desde el proceso principal a los procesos de renderizado."
    },
    "/docs/api/structures/ipc-main-event": {
      "locale": "es-ES",
      "slug": "ipc-main-event",
      "href": "/docs/api/structures/ipc-main-event",
      "crowdinFileId": "256445",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-main-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmainevent-object-extends-event\"><a href=\"#ipcmainevent-object-extends-event\">IpcMainEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>processId</code> Integer - The internal ID of the renderer process that sent this message</li>\n<li><code>frameId</code> Integer - The ID of the renderer frame that sent this message</li>\n<li><code>returnValue</code> any - Set this to the value to be returned in a synchronous message</li>\n<li><code>sender</code> WebContents - Returns the <code>webContents</code> that sent the message</li>\n<li><code>senderFrame</code> WebFrameMain <em>Readonly</em> - The frame that sent this message</li>\n<li><code>ports</code> MessagePortMain[] - A list of MessagePorts that were transferred with this message</li>\n<li><code>reply</code> Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling.  You should use this method to \"reply\" to the sent message in order to guarantee the reply will go to the correct process and frame.<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>",
      "title": "IpcMainEvent Object extends Event",
      "description": ""
    },
    "/docs/api/structures/ipc-main-invoke-event": {
      "locale": "es-ES",
      "slug": "ipc-main-invoke-event",
      "href": "/docs/api/structures/ipc-main-invoke-event",
      "crowdinFileId": "256447",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-main-invoke-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmaininvokeevent-object-extends-event\"><a href=\"#ipcmaininvokeevent-object-extends-event\">IpcMainInvokeEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>processId</code> Integer - The internal ID of the renderer process that sent this message</li>\n<li><code>frameId</code> Integer - The ID of the renderer frame that sent this message</li>\n<li><code>sender</code> WebContents - Returns the <code>webContents</code> that sent the message</li>\n<li><code>senderFrame</code> WebFrameMain <em>Readonly</em> - The frame that sent this message</li>\n</ul>",
      "title": "IpcMainInvokeEvent Object extends Event",
      "description": ""
    },
    "/docs/api/ipc-renderer": {
      "locale": "es-ES",
      "slug": "ipc-renderer",
      "href": "/docs/api/ipc-renderer",
      "crowdinFileId": "256331",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/ipc-renderer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcrenderer\"><a href=\"#ipcrenderer\">ipcRenderer</a></h1>\n<blockquote>\n<p>Comunica asincrónicamente desde un proceso de renderizado al proceso principal.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>El módulo <code>ipcRenderer</code> es un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>. Proporciona un par de métodos para enviar mensajes sincrónicos y asincrónicos desde el proceso de renderizado (página web) al proceso principal. También puede recibir respuestas del proceso principal.</p>\n<p>Ver <a href=\"/docs/api/ipc-main\">ipcMain</a> para ejemplos de códigos.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>ipcRenderer</code> tiene los siguientes métodos para escuchar los eventos y mensajes enviados:</p>\n<h3 id=\"ipcrendereronchannel-listener\"><a href=\"#ipcrendereronchannel-listener\"><code>ipcRenderer.on(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>listener</code> Función<ul>\n<li><code>event</code> IpcRendererEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Escucha al <code>channel</code>. Cuando llega un nuevo mensaje <code>listener</code> es llamado con <code>listener(event, args...)</code>.</p>\n<h3 id=\"ipcrendereroncechannel-listener\"><a href=\"#ipcrendereroncechannel-listener\"><code>ipcRenderer.once(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>listener</code> Función<ul>\n<li><code>event</code> IpcRendererEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Adds a one time <code>listener</code> function for the event. This <code>listener</code> is invoked only the next time a message is sent to <code>channel</code>, after which it is removed.</p>\n<h3 id=\"ipcrendererremovelistenerchannel-listener\"><a href=\"#ipcrendererremovelistenerchannel-listener\"><code>ipcRenderer.removeListener(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>listener</code> Función<ul>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Elimina el <code>listener</code> especificado del arreglo listener para el <code>channel</code> especificado.</p>\n<h3 id=\"ipcrendererremovealllistenerschannel\"><a href=\"#ipcrendererremovealllistenerschannel\"><code>ipcRenderer.removeAllListeners(channel)</code></a></h3>\n<ul>\n<li><code>channel</code> Cadena</li>\n</ul>\n<p>Elimina todos los oyentes, o aquellos del <code>channel</code> especificado.</p>\n<h3 id=\"ipcrenderersendchannel-args\"><a href=\"#ipcrenderersendchannel-args\"><code>ipcRenderer.send(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Envía un mensaje asíncrono al main process a través de <code>channel</code>, junto con los argumentos. Los argumentos serán serializados con el <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured CloneAlgorithm</a>, al igual que <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, así que las cadenas del prototipo no estarán incluidas. El envío de funciones, promesas, símbolos, WeakMaps o WeakSets lanzará una excepción.</p>\n<blockquote>\n<p><strong>NOTA</strong>: Enviar tipos de JavaScript no estándar tales como objetos DOM o objetos especiales de Electron lanzará una excepción.</p>\n<p>Dado que el proceso principal no tiene soporte para objetos DOM tales como  <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code>  y así sucesivamente, tales objetos no pueden ser enviados sobre el IPC de Eectron al proceso principal, ya que el proceso principal no tendría forma de decodificarlos. Intentar enviar tales objetos sobre el IPC resultará en un error.</p>\n</blockquote>\n<p>El main process maneja esto escuchando por <code>channel</code> con el módulo <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a>.</p>\n<p>If you need to transfer a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> to the main process, use <a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a>.</p>\n<p>If you want to receive a single response from the main process, like the result of a method call, consider using <a href=\"#ipcrendererinvokechannel-args\"><code>ipcRenderer.invoke</code></a>.</p>\n<h3 id=\"ipcrendererinvokechannel-args\"><a href=\"#ipcrendererinvokechannel-args\"><code>ipcRenderer.invoke(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;any></code> - Resuelve con la respuesta desde el main process.</p>\n<p>Envía un mensaje al main process a través de <code>channel</code> y espera un resultado asíncrono. Los argumentos serán serializados con el <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured CloneAlgorithm</a>, al igual que <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, así que las cadenas del prototipo no estarán incluidas. El envío de funciones, promesas, símbolos, WeakMaps o WeakSets lanzará una excepción.</p>\n<blockquote>\n<p><strong>NOTA</strong>: Enviar tipos de JavaScript no estándar tales como objetos DOM o objetos especiales de Electron lanzará una excepción.</p>\n<p>Dado que el proceso principal no tiene soporte para objetos DOM tales como  <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code>  y así sucesivamente, tales objetos no pueden ser enviados sobre el IPC de Eectron al proceso principal, ya que el proceso principal no tendría forma de decodificarlos. Intentar enviar tales objetos sobre el IPC resultará en un error.</p>\n</blockquote>\n<p>El main process debería escuchar por el <code>channel</code> con <a href=\"/docs/api/ipc-main#ipcmainhandlechannel-listener\"><code>ipcMain.handle()</code></a>.</p>\n<p>Por ejemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.invoke(<span class=\"hljs-string\">'some-name'</span>, someArgument).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">result</span>) =></span> {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// Main process</span>\nipcMain.handle(<span class=\"hljs-string\">'some-name'</span>, <span class=\"hljs-keyword\">async</span> (event, someArgument) => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> doSomeWork(someArgument)\n  <span class=\"hljs-keyword\">return</span> result\n})\n</code></pre>\n<p>If you need to transfer a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> to the main process, use <a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a>.</p>\n<p>If you do not need a response to the message, consider using <a href=\"#ipcrenderersendchannel-args\"><code>ipcRenderer.send</code></a>.</p>\n<h3 id=\"ipcrenderersendsyncchannel-args\"><a href=\"#ipcrenderersendsyncchannel-args\"><code>ipcRenderer.sendSync(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Devuelve <code>any</code> - El valor enviado de vuelta por el controlador <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a>.</p>\n<p>Envía un mensaje al main process a través de <code>channel</code> y expera un resultado sincrónicamente. Los argumentos serán serializados con el <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured CloneAlgorithm</a>, al igual que <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, así que las cadenas del prototipo no estarán incluidas. El envío de funciones, promesas, símbolos, WeakMaps o WeakSets lanzará una excepción.</p>\n<blockquote>\n<p><strong>NOTA</strong>: Enviar tipos de JavaScript no estándar tales como objetos DOM o objetos especiales de Electron lanzará una excepción.</p>\n<p>Dado que el proceso principal no tiene soporte para objetos DOM tales como  <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code>  y así sucesivamente, tales objetos no pueden ser enviados sobre el IPC de Eectron al proceso principal, ya que el proceso principal no tendría forma de decodificarlos. Intentar enviar tales objetos sobre el IPC resultará en un error.</p>\n</blockquote>\n<p>El processo principal lo controlo por escuchar <code>channel</code> con el módulo <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a>, y contesta configurando <code>event.returnValue</code>.</p>\n<blockquote>\n<p>⚠️ <strong>ADVERTENCIA</strong>: El envío de un mensaje síncrono bloqueará todo el proceso del renderizador hasta que se reciba la respuesta, así que use este método solo como último recurso. Es mucho mejor usar la versión asincróna <a href=\"/docs/api/ipc-renderer#ipcrendererinvokechannel-args\"><code>invoke()</code></a>.</p>\n</blockquote>\n<h3 id=\"ipcrendererpostmessagechannel-message-transfer\"><a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage(channel, message, [transfer])</code></a></h3>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>mensaje</code> cualquiera</li>\n<li><code>transfer</code> MessagePort<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Send a message to the main process, optionally transferring ownership of zero or more <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> objects.</p>\n<p>The transferred <code>MessagePort</code> objects will be available in the main process as <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> objects by accessing the <code>ports</code> property of the emitted event.</p>\n<p>Por ejemplo:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Renderer process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannel()\nipcRenderer.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Main process</span>\nipcMain.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<p>Para más información sobre el uso de <code>MessagePort</code> y <code>MessageChannel</code>, vea la <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\">Documentación MDN</a>.</p>\n<h3 id=\"ipcrenderersendtowebcontentsid-channel-args\"><a href=\"#ipcrenderersendtowebcontentsid-channel-args\"><code>ipcRenderer.sendTo(webContentsId, channel, ...args)</code></a></h3>\n<ul>\n<li><code>webContentsId</code> Number</li>\n<li><code>channel</code> Cadena</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Envía un mensaje a la ventana con <code>webContentsId</code> a través de <code>channel</code>.</p>\n<h3 id=\"ipcrenderersendtohostchannel-args\"><a href=\"#ipcrenderersendtohostchannel-args\"><code>ipcRenderer.sendToHost(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Es como <code>ipcRenderer.send</code> pero el evento se enviará al <code>&#x3C;webview></code>elemento en la página host en vez de el proceso principal.</p>\n<h2 id=\"objeto-de-evento\"><a href=\"#objeto-de-evento\">Objeto de evento</a></h2>\n<p>La documentación para el objeto <code>event</code> pasado a <code>callback</code> pude ser encontrada en la estructura de documentos de <a href=\"/docs/api/structures/ipc-renderer-event\"><code>ipc-renderer-event</code></a>.</p>",
      "title": "ipcRenderer",
      "description": "Comunica asincrónicamente desde un proceso de renderizado al proceso principal."
    },
    "/docs/api/structures/ipc-renderer-event": {
      "locale": "es-ES",
      "slug": "ipc-renderer-event",
      "href": "/docs/api/structures/ipc-renderer-event",
      "crowdinFileId": "256449",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-renderer-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcrendererevent-object-extends-event\"><a href=\"#ipcrendererevent-object-extends-event\">IpcRendererEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>sender</code> IpcRenderer - The <code>IpcRenderer</code> instance that emitted the event originally</li>\n<li><code>senderId</code> Integer - The <code>webContents.id</code> that sent the message, you can call <code>event.sender.sendTo(event.senderId, ...)</code> to reply to the message, see <a href=\"/docs/api/ipc-renderer#ipcrenderersendtowebcontentsid-channel-args\">ipcRenderer.sendTo</a> for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set <code>event.senderId</code> to <code>0</code>.</li>\n<li><code>ports</code> MessagePort[] - A list of MessagePorts that were transferred with this message</li>\n</ul>",
      "title": "IpcRendererEvent Object extends Event",
      "description": ""
    },
    "/docs/development/issues": {
      "locale": "es-ES",
      "slug": "issues",
      "href": "/docs/development/issues",
      "crowdinFileId": "256159",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/issues.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"problemas-en-electron\"><a href=\"#problemas-en-electron\">Problemas en Electron</a></h1>\n<ul>\n<li><a href=\"#how-to-contribute-to-issues\">Cómo contribuir a problemas</a></li>\n<li><a href=\"#asking-for-general-help\">Pedir ayuda general</a></li>\n<li><a href=\"#submitting-a-bug-report\">Presentar un informe de error</a></li>\n<li><a href=\"#triaging-a-bug-report\">Seguimiento de un Informe de Error</a></li>\n<li><a href=\"#resolving-a-bug-report\">Resolviendo un informe de error</a></li>\n</ul>\n<h2 id=\"cómo-contribuir-a-problemas\"><a href=\"#cómo-contribuir-a-problemas\">Cómo contribuir a problemas</a></h2>\n<p>Para cualquier problema, existen fundamentalmente tres maneras en las que un individuo puede contribuir:</p>\n<ol>\n<li>By opening the issue for discussion: If you believe that you have found a new bug in Electron, you should report it by creating a new issue in the <a href=\"https://github.com/electron/electron/issues\"><code>electron/electron</code> issue tracker</a>.</li>\n<li>Ayudando en el seguimiento del problema: Puedes hacerlo proporcionando detalles asistivos (un caso de prueba reproducible que demuestra el fallo) o proporcionando sugerencias para abordar el problema.</li>\n<li>Ayudando a resolver el problema: Esto se puede hacer demostrando que el problema no es un fallo o fue arreglado; Pero mas a menudo, abriendo un pull request que cambia el código fuente de <code>electron/electron</code> de una manera concreta y susceptible de revisión.</li>\n</ol>\n<h2 id=\"pedir-ayuda-general\"><a href=\"#pedir-ayuda-general\">Pedir ayuda general</a></h2>\n<p><a href=\"/docs/tutorial/support#finding-support\">\"Finding Support\"</a> tiene una lista de recursos para obtener ayuda de programación, reportar problemas de seguridad, contribuir y más. ¡Por favor, use el gestor de incidencias solo para errores!</p>\n<h2 id=\"presentar-un-informe-de-error\"><a href=\"#presentar-un-informe-de-error\">Presentar un informe de error</a></h2>\n<p>Para enviar un informe de error:</p>\n<p>Cuando abre una nueva incidencia en el <a href=\"https://github.com/electron/electron/issues/new/choose\"><code>electron/electron</code> issue tracker</a>, los usuarios se les presentará una plantilla que debe ser completada.</p>\n<p>If you believe that you have found a bug in Electron, please fill out the template to the best of your ability.</p>\n<p>Las dos informaciones mas importantes necesarias para evaluar el informe son, la descripción del error y un caso de prueba simple para recrearlo. Es más fácil resolver un problema si este se puede reproducir.</p>\n<p>Véase <a href=\"https://stackoverflow.com/help/mcve\">Como crear un Mínimo, Completo y Verificable ejemplo</a>.</p>\n<h2 id=\"seguimiento-de-un-informe-de-error\"><a href=\"#seguimiento-de-un-informe-de-error\">Seguimiento de un Informe de Error</a></h2>\n<p>Es común que los problemas abiertos se acompañen con un debate. Algunos contribuyentes pueden tener diferentes opiniones, incluyendo si se comporta como un fallo o una funcionalidad. La discusión es parte del proceso y debe mantenerse centrada, útil y profesional.</p>\n<p>Respuestas bruscas que no proveen contexto adiciona o detalles de apoyo, no son útiles o profesionales. Para muchos, tales respuestas son molestas y dañinas.</p>\n<p>Los contribuyentes están animados a resolver problemas de manera colaborativa y ayudarse mutuamente a progresar. Si encuentras un fallo que crees que es inválido o que contiene información errónea, explica <em>por qué</em> crees eso añadiendo contexto adicional y estando dispuesto a convencerse de que puedes estar equivocado. Al hacerlo, podemos a menudo alcanzar la solución correcta de manera rápida.</p>\n<h2 id=\"resolviendo-un-informe-de-error\"><a href=\"#resolviendo-un-informe-de-error\">Resolviendo un informe de error</a></h2>\n<p>La mayoría de los problemas son resueltos al abrir un pull request. El proceso para abrir y revisar un pull request es similar a abrir y seguir los problemas, pero conlleva una revisión necesaria y aprobar un workflow que asegure que los cambios propuestos tengan una mínima calidad y criterios funcionales del proyecto Electron.</p>",
      "title": "Problemas en Electron",
      "description": ""
    },
    "/docs/api/structures/jump-list-category": {
      "locale": "es-ES",
      "slug": "jump-list-category",
      "href": "/docs/api/structures/jump-list-category",
      "crowdinFileId": "256451",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/jump-list-category.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"jumplistcategory-object\"><a href=\"#jumplistcategory-object\">JumpListCategory Object</a></h1>\n<ul>\n<li><code>type</code> String (optional) - One of the following:<ul>\n<li><code>tasks</code> - Items in this category will be placed into the standard <code>Tasks</code> category. There can be only one such category, and it will always be displayed at the bottom of the Jump List.</li>\n<li><code>frequent</code> - Displays a list of files frequently opened by the app, the name of the category and its items are set by Windows.</li>\n<li><code>recent</code> - Displays a list of files recently opened by the app, the name of the category and its items are set by Windows. Items may be added to this category indirectly using <code>app.addRecentDocument(path)</code>.</li>\n<li><code>custom</code> - Displays tasks or file links, <code>name</code> must be set by the app.</li>\n</ul></li>\n<li><code>name</code> String (optional) - Must be set if <code>type</code> is <code>custom</code>, otherwise it should be omitted.</li>\n<li><code>items</code> JumpListItem<a href=\"/docs/api/structures/optional\"></a> - Array of <a href=\"/docs/api/structures/jump-list-item\"><code>JumpListItem</code></a> objects if <code>type</code> is <code>tasks</code> or <code>custom</code>, otherwise it should be omitted.</li>\n</ul>\n<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>\n<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>",
      "title": "JumpListCategory Object",
      "description": ""
    },
    "/docs/api/structures/jump-list-item": {
      "locale": "es-ES",
      "slug": "jump-list-item",
      "href": "/docs/api/structures/jump-list-item",
      "crowdinFileId": "256453",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/jump-list-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"jumplistitem-object\"><a href=\"#jumplistitem-object\">JumpListItem Object</a></h1>\n<ul>\n<li><code>type</code> String (optional) - One of the following:<ul>\n<li><code>task</code> - A task will launch an app with specific arguments.</li>\n<li><code>separator</code> - Can be used to separate items in the standard <code>Tasks</code> category.</li>\n<li><code>file</code> - A file link will open a file using the app that created the Jump List, for this to work the app must be registered as a handler for the file type (though it doesn't have to be the default handler).</li>\n</ul></li>\n<li><code>path</code> String (optional) - Path of the file to open, should only be set if <code>type</code> is <code>file</code>.</li>\n<li><code>program</code> String (optional) - Path of the program to execute, usually you should specify <code>process.execPath</code> which opens the current program. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>args</code> String (optional) - The command line arguments when <code>program</code> is executed. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>title</code> String (optional) - The text to be displayed for the item in the Jump List. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>description</code> String (optional) - Description of the task (displayed in a tooltip). Should only be set if <code>type</code> is <code>task</code>. Maximum length 260 characters.</li>\n<li><code>iconPath</code> String (optional) - The absolute path to an icon to be displayed in a Jump List, which can be an arbitrary resource file that contains an icon (e.g. <code>.ico</code>, <code>.exe</code>, <code>.dll</code>). You can usually specify <code>process.execPath</code> to show the program icon.</li>\n<li><code>iconIndex</code> Number (optional) - The index of the icon in the resource file. If a resource file contains multiple icons this value can be used to specify the zero-based index of the icon that should be displayed for this task. If a resource file contains only one icon, this property should be set to zero.</li>\n<li><code>workingDirectory</code> String (optional) - The working directory. Default is empty.</li>\n</ul>",
      "title": "JumpListItem Object",
      "description": ""
    },
    "/docs/api/structures/keyboard-event": {
      "locale": "es-ES",
      "slug": "keyboard-event",
      "href": "/docs/api/structures/keyboard-event",
      "crowdinFileId": "256455",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/keyboard-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"keyboardevent-object\"><a href=\"#keyboardevent-object\">KeyboardEvent Object</a></h1>\n<ul>\n<li><code>ctrlKey</code> Boolean (optional) - whether the Control key was used in an accelerator to trigger the Event</li>\n<li><code>metaKey</code> Boolean (optional) - whether a meta key was used in an accelerator to trigger the Event</li>\n<li><code>shiftKey</code> Boolean (optional) - whether a Shift key was used in an accelerator to trigger the Event</li>\n<li><code>altKey</code> Boolean (optional) - whether an Alt key was used in an accelerator to trigger the Event</li>\n<li><code>triggeredByAccelerator</code> Boolean (optional) - whether an accelerator was used to trigger the event as opposed to another user gesture like mouse click</li>\n</ul>",
      "title": "KeyboardEvent Object",
      "description": ""
    },
    "/docs/api/structures/keyboard-input-event": {
      "locale": "es-ES",
      "slug": "keyboard-input-event",
      "href": "/docs/api/structures/keyboard-input-event",
      "crowdinFileId": "256457",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/keyboard-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"keyboardinputevent-object-extends-inputevent\"><a href=\"#keyboardinputevent-object-extends-inputevent\">KeyboardInputEvent Object extends <code>InputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>keyDown</code>, <code>keyUp</code> or <code>char</code>.</li>\n<li><code>keyCode</code> String - The character that will be sent as the keyboard event. Should only use the valid key codes in <a href=\"/docs/api/accelerator\">Accelerator</a>.</li>\n</ul>",
      "title": "KeyboardInputEvent Object extends InputEvent",
      "description": ""
    },
    "/docs/tutorial/keyboard-shortcuts": {
      "locale": "es-ES",
      "slug": "keyboard-shortcuts",
      "href": "/docs/tutorial/keyboard-shortcuts",
      "crowdinFileId": "256209",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/keyboard-shortcuts.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"atajos-del-teclado\"><a href=\"#atajos-del-teclado\">Atajos del teclado</a></h1>\n<h2 id=\"descripción-general\"><a href=\"#descripción-general\">Descripción general</a></h2>\n<p>Esta característica le permite configurar atajos de teclado loca y global para tu aplicación Electron.</p>\n<h2 id=\"ejemplo\"><a href=\"#ejemplo\">Ejemplo</a></h2>\n<h3 id=\"accesos-directos-locales\"><a href=\"#accesos-directos-locales\">Accesos directos locales</a></h3>\n<p>Los atajos de teclado locales son activadas sólo cuando la aplicación está enfocada. Para configurar un atajo de teclado local, necesitas especificar una propiedad <a href=\"/docs/api/accelerator\"><code>accelerator</code></a> al crear un <a href=\"/docs/api/menu-item\">MenuItem</a> dentro de módulo <a href=\"/docs/api/menu\">Menu</a>.</p>\n<p>Comenzando con una aplicación funcionando desde <a href=\"/docs/tutorial/quick-start\">Guía de Inicio Rápido</a>, actualiza el archivo <code>main.js</code> con las siguiente lineas:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/local\"><span class=\"hljs-keyword\">const</span> { Menu, MenuItem } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> menu = <span class=\"hljs-keyword\">new</span> Menu()\nmenu.append(<span class=\"hljs-keyword\">new</span> MenuItem({\n  <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Electron'</span>,\n  <span class=\"hljs-attr\">submenu</span>: [{\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'help'</span>,\n    <span class=\"hljs-attr\">accelerator</span>: process.platform === <span class=\"hljs-string\">'darwin'</span> ? <span class=\"hljs-string\">'Alt+Cmd+I'</span> : <span class=\"hljs-string\">'Alt+Shift+I'</span>,\n    <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Electron rocks!'</span>) }\n  }]\n}))\n\nMenu.setApplicationMenu(menu)\n</code></pre>\n<blockquote>\n<p>NOTA: En el código anterior, puede ver que el acelerador difiere según el sistema operativo del usuario. Para MacOS, es  <code>Alt+Cmd+I</code>, mientras que para  Linux y   Windows, es <code>Alt+Shift+I</code>.</p>\n</blockquote>\n<p>Después de lanzar la aplicación Electron, deberías ver el menú de la aplicación junto con el el atajo local que acabas de definir:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/local-shortcut.png\" alt=\"Menú con un atajo local\"></p>\n<p>Si haces click en <code>Help</code> o presionas el acelerador definido y luego abres la terminal con la que corriste tu Aplicación, veras el mensaje que fue generado después de llamar al evento del <code>click</code>: \"Electron rocks!\".</p>\n<h3 id=\"accesos-directos-globales\"><a href=\"#accesos-directos-globales\">Accesos directos globales</a></h3>\n<p>Para configurar un atajo de teclado global, necesita usar el módulo <a href=\"/docs/api/global-shortcut\">globalShortcut</a> para detecta los eventos del teclado cuando la aplicación no tiene el focus del teclado.</p>\n<p>Comenzando con una aplicación funcionando desde <a href=\"/docs/tutorial/quick-start\">Guía de Inicio Rápido</a>, actualiza el archivo <code>main.js</code> con las siguiente lineas:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/global\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  globalShortcut.register(<span class=\"hljs-string\">'Alt+CommandOrControl+I'</span>, () => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Electron loves global shortcuts!'</span>)\n  })\n}).then(createWindow)\n</code></pre>\n<blockquote>\n<p>NOTA: En el código anterior, la combinación <code>CommandOrControl</code> usa <code>Command</code> en macOS y <code>Control</code> en Windows/Linux.</p>\n</blockquote>\n<p>Después de lanzar la aplicación Electron, si presionas la combinación de teclas definida y luego abres la terminar desde la que corriste tu aplicación de Electron, ¡verás como Electron ama los atajos de teclado globales!</p>\n<h3 id=\"accesos-directos-en-una-ventana-de-buscador\"><a href=\"#accesos-directos-en-una-ventana-de-buscador\">Accesos directos en una ventana de buscador</a></h3>\n<h4 id=\"usando-apis-web\"><a href=\"#usando-apis-web\">Usando APIs web</a></h4>\n<p>Si quieres manejar los atajos de teclado dentro de un <a href=\"/docs/api/browser-window\">BrowserWindow</a>, puedes escuchar por los <a href=\"https://developer.mozilla.org/en-US/docs/Web/Events\">Eventos DOM</a> <code>keyup</code> y <code>keydown</code> dentro del renderer process usando la <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\">API addEventListener()</a>.</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/web-apis\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleKeyPress</span>(<span class=\"hljs-params\">event</span>) </span>{\n  <span class=\"hljs-comment\">// You can put code here to handle the keypress.</span>\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">\"last-keypress\"</span>).innerText = event.key;\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`You pressed <span class=\"hljs-subst\">${event.key}</span>`</span>);\n}\n\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'keyup'</span>, handleKeyPress, <span class=\"hljs-literal\">true</span>);\n</code></pre>\n<blockquote>\n<p>Note:  the third parameter <code>true</code> indicates that the listener will always receive key presses before other listeners so they can't have <code>stopPropagation()</code> called on them.</p>\n</blockquote>\n<h4 id=\"interceptando-eventos-en-el-main-process\"><a href=\"#interceptando-eventos-en-el-main-process\">Interceptando eventos en el main process</a></h4>\n<p>El <a href=\"/docs/api/web-contents#event-before-input-event\"><code>Evento antes de la entrada</code></a> es emitido antes de enviar los eventos <code>flecha hacia arriba</code> y <code>flecha hacia abajo</code> en la página. Puede ser usado para capturar y manejar accesos directos personalizados que no son visibles en el menú.</p>\n<p>Comenzando con una aplicación funcionando desde <a href=\"/docs/tutorial/quick-start\">Guía de Inicio Rápido</a>, actualiza el archivo <code>main.js</code> con las siguiente lineas:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/interception-from-main\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n  win.webContents.on(<span class=\"hljs-string\">'before-input-event'</span>, (event, input) => {\n    <span class=\"hljs-keyword\">if</span> (input.control &#x26;&#x26; input.key.toLowerCase() === <span class=\"hljs-string\">'i'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Pressed Control+I'</span>)\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<p>Después de correr tu aplicación, abres la terminal con la que corriste tu aplicación y presionas la combinación de teclas <code>Ctrl+I</code>, veras como ese atajo del teclado fue satisfactoriamente interceptado.</p>\n<h4 id=\"usando-librerías-de-terceros\"><a href=\"#usando-librerías-de-terceros\">Usando librerías de terceros</a></h4>\n<p>Si no quiere hacer el análisis manual de los atajos hay librerías que hacen detección de teclas avanzadas, como <a href=\"https://github.com/ccampbell/mousetrap\">mousetrap</a>. A continuación se muestran ejemplos de uso de <code>mousetrap</code> corriendo en el Renderer process:</p>\n<pre><code class=\"hljs language-js\">Mousetrap.bind(<span class=\"hljs-string\">'4'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'4'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'?'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'show shortcuts!'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'esc'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'escape'</span>) }, <span class=\"hljs-string\">'keyup'</span>)\n\n<span class=\"hljs-comment\">// combinations</span>\nMousetrap.bind(<span class=\"hljs-string\">'command+shift+k'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'command shift k'</span>) })\n\n<span class=\"hljs-comment\">// map multiple combinations to the same callback</span>\nMousetrap.bind([<span class=\"hljs-string\">'command+k'</span>, <span class=\"hljs-string\">'ctrl+k'</span>], () => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'command k or control k'</span>)\n\n  <span class=\"hljs-comment\">// return false to prevent default behavior and stop event from bubbling</span>\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n\n<span class=\"hljs-comment\">// gmail style sequences</span>\nMousetrap.bind(<span class=\"hljs-string\">'g i'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'go to inbox'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'* a'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'select all'</span>) })\n\n<span class=\"hljs-comment\">// konami code!</span>\nMousetrap.bind(<span class=\"hljs-string\">'up up down down left right left right b a enter'</span>, () => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'konami code'</span>)\n})\n</code></pre>",
      "title": "Atajos del teclado",
      "description": "NOTA: En el código anterior, puede ver que el acelerador difiere según el sistema operativo del usuario. Para MacOS, es  Alt+Cmd+I, mientras que para  Linux y   Windows, es Alt+Shift+I."
    },
    "/docs/tutorial/launch-app-from-url-in-another-app": {
      "locale": "es-ES",
      "slug": "launch-app-from-url-in-another-app",
      "href": "/docs/tutorial/launch-app-from-url-in-another-app",
      "crowdinFileId": "256211",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/launch-app-from-url-in-another-app.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<hr>\n<p>title: Launching Your Electron App From a URL In Another App\ndescription: This guide will take you through the process of setting your electron app as the default handler for a specific protocol.\nslug: launch-app-from-url-in-another-app</p>\n<h2 id=\"hide_title-true\"><a href=\"#hide_title-true\">hide_title: true</a></h2>\n<h1 id=\"launching-your-electron-app-from-a-url-in-another-app\"><a href=\"#launching-your-electron-app-from-a-url-in-another-app\">Launching Your Electron App From A URL In Another App</a></h1>\n<h2 id=\"descripción-general\"><a href=\"#descripción-general\">Descripción general</a></h2>\n<!-- ✍ Update this section if you want to provide more details -->\n<p>This guide will take you through the process of setting your Electron app as the default handler for a specific <a href=\"https://www.electronjs.org/docs/api/protocol\">protocol</a>.</p>\n<p>By the end of this tutorial, we will have set our app to intercept and handle any clicked URLs that start with a specific protocol. In this guide, the protocol we will use will be \"<code>electron-fiddle://</code>\".</p>\n<h2 id=\"ejemplos\"><a href=\"#ejemplos\">Ejemplos</a></h2>\n<h3 id=\"main-process-mainjs\"><a href=\"#main-process-mainjs\">Main Process (main.js)</a></h3>\n<p>First, we will import the required modules from <code>electron</code>. These modules help control our application lifecycle and create a native browser window.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n</code></pre>\n<p>Next, we will proceed to register our application to handle all \"<code>electron-fiddle://</code>\" protocols.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">if</span> (process.defaultApp) {\n  <span class=\"hljs-keyword\">if</span> (process.argv.length >= <span class=\"hljs-number\">2</span>) {\n    app.setAsDefaultProtocolClient(<span class=\"hljs-string\">'electron-fiddle'</span>, process.execPath, [path.resolve(process.argv[<span class=\"hljs-number\">1</span>])])\n  }\n} <span class=\"hljs-keyword\">else</span> {\n  app.setAsDefaultProtocolClient(<span class=\"hljs-string\">'electron-fiddle'</span>)\n}\n</code></pre>\n<p>We will now define the function in charge of creating our browser window and load our application's <code>index.html</code> file.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> createWindow = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Create the browser window.</span>\n  mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  mainWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n</code></pre>\n<p>In this next step, we will create our  <code>BrowserWindow</code> and tell our application how to handle an event in which an external protocol is clicked.</p>\n<p>This code will be different in Windows compared to MacOS and Linux. This is due to Windows requiring additional code in order to open the contents of the protocol link within the same Electron instance. Lea más sobre esto <a href=\"https://www.electronjs.org/docs/api/app#apprequestsingleinstancelock\">aquí</a>.</p>\n<h4 id=\"código-de-windows\"><a href=\"#código-de-windows\">Código de Windows:</a></h4>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> gotTheLock = app.requestSingleInstanceLock()\n\n<span class=\"hljs-keyword\">if</span> (!gotTheLock) {\n  app.quit()\n} <span class=\"hljs-keyword\">else</span> {\n  app.on(<span class=\"hljs-string\">'second-instance'</span>, (event, commandLine, workingDirectory) => {\n    <span class=\"hljs-comment\">// Alguien trata de correr una segunda instancia, debemos enfocar nuestra ventana.</span>\n    <span class=\"hljs-keyword\">if</span> (mainWindow) {\n      <span class=\"hljs-keyword\">if</span> (mainWindow.isMinimized()) mainWindow.restore()\n      mainWindow.focus()\n    }\n  })\n\n  <span class=\"hljs-comment\">// Crear mainWindow, cargar el resto de la aplicación, etc...</span>\n  app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    createWindow()\n  })\n\n  <span class=\"hljs-comment\">// Handle the protocol. En este caso, elegimos mostrar una Caja de Error.</span>\n  app.on(<span class=\"hljs-string\">'open-url'</span>, (event, url) => {\n    dialog.showErrorBox(<span class=\"hljs-string\">'Welcome Back'</span>, <span class=\"hljs-string\">`You arrived from: <span class=\"hljs-subst\">${url}</span>`</span>)\n  })\n}\n</code></pre>\n<h4 id=\"código-macos-y-linux\"><a href=\"#código-macos-y-linux\">Código MacOS y Linux:</a></h4>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// This method will be called when Electron has finished</span>\n<span class=\"hljs-comment\">// initialization and is ready to create browser windows.</span>\n<span class=\"hljs-comment\">// Algunas APIs pueden solamente ser usadas despues de que este evento ocurra.</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n})\n\n<span class=\"hljs-comment\">// Handle the protocol. En este caso, elegimos mostrar una Caja de Error.</span>\napp.on(<span class=\"hljs-string\">'open-url'</span>, (event, url) => {\n  dialog.showErrorBox(<span class=\"hljs-string\">'Welcome Back'</span>, <span class=\"hljs-string\">`You arrived from: <span class=\"hljs-subst\">${url}</span>`</span>)\n})\n</code></pre>\n<p>Finally, we will add some additional code to handle when someone closes our application.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Quit when all windows are closed, except on macOS. There, it's common</span>\n<span class=\"hljs-comment\">// for applications and their menu bar to stay active until the user quits</span>\n<span class=\"hljs-comment\">// explicitly with Cmd + Q.</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h2 id=\"important-notes\"><a href=\"#important-notes\">Important notes</a></h2>\n<h3 id=\"embalaje\"><a href=\"#embalaje\">Embalaje</a></h3>\n<p>On macOS and Linux, this feature will only work when your app is packaged. It will not work when you're launching it in development from the command-line. When you package your app you'll need to make sure the macOS <code>Info.plist</code> and the Linux <code>.desktop</code> files for the app are updated to include the new protocol handler. Some of the Electron tools for bundling and distributing apps handle this for you.</p>\n<h4 id=\"electron-forge\"><a href=\"#electron-forge\"></a><a href=\"https://electronforge.io\">Electron Forge</a></h4>\n<p>If you're using Electron Forge, adjust <code>packagerConfig</code> for macOS support, and the configuration for the appropriate Linux makers for Linux support, in your <a href=\"https://www.electronforge.io/configuration\">Forge configuration</a> <em>(please note the following example only shows the bare minimum needed to add the configuration changes)</em>:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"config\"</span>: {\n    <span class=\"hljs-attr\">\"forge\"</span>: {\n      <span class=\"hljs-attr\">\"packagerConfig\"</span>: {\n        <span class=\"hljs-attr\">\"protocols\"</span>: [\n          {\n            <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"Electron Fiddle\"</span>,\n            <span class=\"hljs-attr\">\"schemes\"</span>: [<span class=\"hljs-string\">\"electron-fiddle\"</span>]\n          }\n        ]\n      },\n      <span class=\"hljs-attr\">\"makers\"</span>: [\n        {\n          <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"@electron-forge/maker-deb\"</span>,\n          <span class=\"hljs-attr\">\"config\"</span>: {\n            <span class=\"hljs-attr\">\"mimeType\"</span>: [<span class=\"hljs-string\">\"x-scheme-handler/electron-fiddle\"</span>]\n          }\n        }\n      ]\n    }\n  }\n}\n</code></pre>\n<h4 id=\"electron-packager\"><a href=\"#electron-packager\"></a><a href=\"https://github.com/electron/electron-packager\">Electron Packager</a></h4>\n<p>For macOS support:</p>\n<p>If you're using Electron Packager's API, adding support for protocol handlers is similar to how Electron Forge is handled, except <code>protocols</code> is part of the Packager options passed to the <code>packager</code> function.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> packager = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-packager'</span>)\n\npackager({\n  <span class=\"hljs-comment\">// ...other options...</span>\n  <span class=\"hljs-attr\">protocols</span>: [\n    {\n      <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Electron Fiddle'</span>,\n      <span class=\"hljs-attr\">schemes</span>: [<span class=\"hljs-string\">'electron-fiddle'</span>]\n    }\n  ]\n\n}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">paths</span> =></span> <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`SUCCESS: Created <span class=\"hljs-subst\">${paths.join(<span class=\"hljs-string\">', '</span>)}</span>`</span>))\n  .catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">`ERROR: <span class=\"hljs-subst\">${err.message}</span>`</span>))\n</code></pre>\n<p>If you're using Electron Packager's CLI, use the <code>--protocol</code> and <code>--protocol-name</code> flags. For example:</p>\n<pre><code class=\"hljs language-shell\">npx electron-packager . --protocol=electron-fiddle --protocol-name=\"Electron Fiddle\"\n</code></pre>\n<h2 id=\"conclusión\"><a href=\"#conclusión\">Conclusión</a></h2>\n<p>After you start your Electron app, you can enter in a URL in your browser that contains the custom protocol, for example <code>\"electron-fiddle://open\"</code> and observe that the application will respond and show an error dialog box.</p>\n<!--\n    Because Electron examples usually require multiple files (HTML, CSS, JS\n    for the main and renderer process, etc.), we use this custom code block\n    for Fiddle (https://www.electronjs.org/fiddle).\n    Please modify any of the files in the referenced folder to fit your\n    example.\n    The content in this codeblock will not be rendered in the website so you\n    can leave it empty.\n-->\n<!-- ✍ Explanation of the code below -->",
      "title": "Launching Your Electron App From A URL In Another App",
      "description": ""
    },
    "/docs/tutorial/linux-desktop-actions": {
      "locale": "es-ES",
      "slug": "linux-desktop-actions",
      "href": "/docs/tutorial/linux-desktop-actions",
      "crowdinFileId": "256213",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/linux-desktop-actions.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktop-launcher-actions-linux\"><a href=\"#desktop-launcher-actions-linux\">Desktop Launcher Actions (Linux)</a></h1>\n<h2 id=\"descripción-general\"><a href=\"#descripción-general\">Descripción general</a></h2>\n<p>En muchos entornos Linux, puede agregar entradas personalizadas al lanzador del sistema modificando el archivo <code>.desktop</code>. Para la documentación de Unity de Canonical, vea <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Agregar atajos al Lanzador</a>. Para obtener detalles sobre una implementación más genérica, vea la <a href=\"https://specifications.freedesktop.org/desktop-entry-spec/1.1/ar01s11.html\">freedesktop.org Especificación</a>.</p>\n<p><img src=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles?action=AttachFile&#x26;do=get&#x26;target=shortcuts.png\" alt=\"audaz\"></p>\n<blockquote>\n<p>NOTA: La captura de la pantalla anterior es un ejemplo de atajos de lanzador en el reproductor de audio Audacious</p>\n</blockquote>\n<p>Para crear un atajo, necesita proveer las propiedades <code>Name</code> y <code>Exec</code> para la entrada que quieres agregar al atajo del menú. Unity ejecutará el comando definido en el campo <code>Exec</code> después que el usuario pulse en el elemento del menú de acceso directo. Un ejemplo del archivo <code>.desktop</code> puede lucir de la siguiente manera:</p>\n<pre><code class=\"hljs language-plaintext\">Actions=PlayPause;Next;Previous\n\n[Desktop Action PlayPause]\nName=Play-Pause\nExec=audacious -t\nOnlyShowIn=Unity;\n\n[Desktop Action Next]\nName=Next\nExec=audacious -f\nOnlyShowIn=Unity;\n\n[Desktop Action Previous]\nName=Previous\nExec=audacious -r\nOnlyShowIn=Unity;\n</code></pre>\n<p>La forma preferida de Unity para instruir a su aplicación sobre qué hacer es usar parámetros. Puedes encontrarlos en tu aplicación en la variable global <code>process.argv</code>.</p>",
      "title": "Desktop Launcher Actions (Linux)",
      "description": "NOTA: La captura de la pantalla anterior es un ejemplo de atajos de lanzador en el reproductor de audio Audacious"
    },
    "/docs/tutorial/mac-app-store-submission-guide": {
      "locale": "es-ES",
      "slug": "mac-app-store-submission-guide",
      "href": "/docs/tutorial/mac-app-store-submission-guide",
      "crowdinFileId": "256215",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/mac-app-store-submission-guide.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"guía-de-publicación-en-la-mac-app-store\"><a href=\"#guía-de-publicación-en-la-mac-app-store\">Guía de publicación en la Mac App Store</a></h1>\n<p>This guide provides information on:</p>\n<ul>\n<li>How to sign Electron apps on macOS;</li>\n<li>How to submit Electron apps to Mac App Store (MAS);</li>\n<li>The limitations of the MAS build.</li>\n</ul>\n<h2 id=\"requisitos\"><a href=\"#requisitos\">Requisitos</a></h2>\n<p>To sign Electron apps, the following tools must be installed first:</p>\n<ul>\n<li>Xcode 11 or above.</li>\n<li>The <a href=\"https://github.com/electron/electron-osx-sign\">electron-osx-sign</a> npm module.</li>\n</ul>\n<p>You also have to register an Apple Developer account and join the <a href=\"https://developer.apple.com/support/compare-memberships/\">Apple Developer Program</a>.</p>\n<h2 id=\"sign-electron-apps\"><a href=\"#sign-electron-apps\">Sign Electron apps</a></h2>\n<p>Electron apps can be distributed through Mac App Store or outside it. Each way requires different ways of signing and testing. This guide focuses on distribution via Mac App Store, but will also mention other methods.</p>\n<p>The following steps describe how to get the certificates from Apple, how to sign Electron apps, and how to test them.</p>\n<h3 id=\"get-certificates\"><a href=\"#get-certificates\">Get certificates</a></h3>\n<p>The simplest way to get signing certificates is to use Xcode:</p>\n<ol>\n<li>Open Xcode and open \"Accounts\" preferences;</li>\n<li>Sign in with your Apple account;</li>\n<li>Select a team and click \"Manage Certificates\";</li>\n<li>In the lower-left corner of the signing certificates sheet, click the Add button (+), and add following certificates:<ul>\n<li>\"Apple Development\"</li>\n<li>\"Apple Distribution\"</li>\n</ul></li>\n</ol>\n<p>The \"Apple Development\" certificate is used to sign apps for development and testing, on machines that have been registered on Apple Developer website. The method of registration will be described in <a href=\"#prepare-provisioning-profile\">Prepare provisioning profile</a>.</p>\n<p>Apps signed with the \"Apple Development\" certificate cannot be submitted to Mac App Store. For that purpose, apps must be signed with the \"Apple Distribution\" certificate instead. But note that apps signed with the \"Apple Distribution\" certificate cannot run directly, they must be re-signed by Apple to be able to run, which will only be possible after being downloaded from the Mac App Store.</p>\n<h4 id=\"other-certificates\"><a href=\"#other-certificates\">Other certificates</a></h4>\n<p>You may notice that there are also other kinds of certificates.</p>\n<p>The \"Developer ID Application\" certificate is used to sign apps before distributing them outside the Mac App Store.</p>\n<p>The \"Developer ID Installer\" and \"Mac Installer Distribution\" certificates are used to sign the Mac Installer Package instead of the app itself. Most Electron apps do not use Mac Installer Package so they are generally not needed.</p>\n<p>The full list of certificate types can be found <a href=\"https://help.apple.com/xcode/mac/current/#/dev80c6204ec\">here</a>.</p>\n<p>Apps signed with \"Apple Development\" and \"Apple Distribution\" certificates can only run under <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandbox</a>, so they must use the MAS build of Electron. However, the \"Developer ID Application\" certificate does not have this restrictions, so apps signed with it can use either the normal build or the MAS build of Electron.</p>\n<h4 id=\"legacy-certificate-names\"><a href=\"#legacy-certificate-names\">Legacy certificate names</a></h4>\n<p>Apple has been changing the names of certificates during past years, you might encounter them when reading old documentations, and some utilities are still using one of the old names.</p>\n<ul>\n<li>The \"Apple Distribution\" certificate was also named as \"3rd Party Mac Developer Application\" and \"Mac App Distribution\".</li>\n<li>The \"Apple Development\" certificate was also named as \"Mac Developer\" and \"Development\".</li>\n</ul>\n<h3 id=\"prepare-provisioning-profile\"><a href=\"#prepare-provisioning-profile\">Prepare provisioning profile</a></h3>\n<p>If you want to test your app on your local machine before submitting your app to the Mac App Store, you have to sign the app with the \"Apple Development\" certificate with the provisioning profile embedded in the app bundle.</p>\n<p>To <a href=\"https://help.apple.com/developer-account/#/devf2eb157f8\">create a provisioning profile</a>, you can follow the below steps:</p>\n<ol>\n<li>Open the \"Certificates, Identifiers &#x26; Profiles\" page on the <a href=\"https://developer.apple.com/account\">Apple Developer</a> website.</li>\n<li>Add a new App ID for your app in the \"Identifiers\" page.</li>\n<li>Register your local machine in the \"Devices\" page. You can find your machine's \"Device ID\" in the \"Hardware\" page of the \"System Information\" app.</li>\n<li>Register a new Provisioning Profile in the \"Profiles\" page, and download it to <code>/path/to/yourapp.provisionprofile</code>.</li>\n</ol>\n<h3 id=\"enable-apples-app-sandbox\"><a href=\"#enable-apples-app-sandbox\">Enable Apple's App Sandbox</a></h3>\n<p>Apps submitted to the Mac App Store must run under Apple's <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandbox</a>, and only the MAS build of Electron can run with the App Sandbox. The standard darwin build of Electron will fail to launch when run under App Sandbox.</p>\n<p>When signing the app with <code>electron-osx-sign</code>, it will automatically add the necessary entitlements to your app's entitlements, but if you are using custom entitlements, you must ensure App Sandbox capacity is added:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<h4 id=\"extra-steps-without-electron-osx-sign\"><a href=\"#extra-steps-without-electron-osx-sign\">Extra steps without <code>electron-osx-sign</code></a></h4>\n<p>If you are signing your app without using <code>electron-osx-sign</code>, you must ensure the app bundle's entitlements have at least following keys:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.application-groups<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">array</span>></span>\n      <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>TEAM_ID.your.bundle.id<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n    <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">array</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>The <code>TEAM_ID</code> should be replaced with your Apple Developer account's Team ID, and the <code>your.bundle.id</code> should be replaced with the App ID of the app.</p>\n<p>And the following entitlements must be added to the binaries and helpers in the app's bundle:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.inherit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>And the app bundle's <code>Info.plist</code> must include <code>ElectronTeamID</code> key, which has your Apple Developer account's Team ID as its value:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n  ...\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>ElectronTeamID<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>TEAM_ID<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>When using <code>electron-osx-sign</code> the <code>ElectronTeamID</code> key will be added automatically by extracting the Team ID from the certificate's name. You may need to manually add this key if <code>electron-osx-sign</code> could not find the correct Team ID.</p>\n<h3 id=\"sign-apps-for-development\"><a href=\"#sign-apps-for-development\">Sign apps for development</a></h3>\n<p>To sign an app that can run on your development machine, you must sign it with the \"Apple Development\" certificate and pass the provisioning profile to <code>electron-osx-sign</code>.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Apple Development'</span> --provisioning-profile=/path/to/yourapp.provisionprofile\n</code></pre>\n<p>If you are signing without <code>electron-osx-sign</code>, you must place the provisioning profile to <code>YourApp.app/Contents/embedded.provisionprofile</code>.</p>\n<p>The signed app can only run on the machines that registered by the provisioning profile, and this is the only way to test the signed app before submitting to Mac App Store.</p>\n<h3 id=\"sign-apps-for-submitting-to-the-mac-app-store\"><a href=\"#sign-apps-for-submitting-to-the-mac-app-store\">Sign apps for submitting to the Mac App Store</a></h3>\n<p>To sign an app that will be submitted to Mac App Store, you must sign it with the \"Apple Distribution\" certificate. Note that apps signed with this certificate will not run anywhere, unless it is downloaded from Mac App Store.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Apple Distribution'</span>\n</code></pre>\n<h3 id=\"sign-apps-for-distribution-outside-the-mac-app-store\"><a href=\"#sign-apps-for-distribution-outside-the-mac-app-store\">Sign apps for distribution outside the Mac App Store</a></h3>\n<p>If you don't plan to submit the app to Mac App Store, you can sign it the \"Developer ID Application\" certificate. In this way there is no requirement on App Sandbox, and you should use the normal darwin build of Electron if you don't use App Sandbox.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Developer ID Application'</span> --no-gatekeeper-assess\n</code></pre>\n<p>By passing <code>--no-gatekeeper-assess</code>, the <code>electron-osx-sign</code> will skip the macOS GateKeeper check as your app usually has not been notarized yet by this step.</p>\n<!-- TODO(zcbenz): Add a chapter about App Notarization -->\n<p>This guide does not cover <a href=\"https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution\">App Notarization</a>, but you might want to do it otherwise Apple may prevent users from using your app outside Mac App Store.</p>\n<h2 id=\"submit-apps-to-the-mac-app-store\"><a href=\"#submit-apps-to-the-mac-app-store\">Submit Apps to the Mac App Store</a></h2>\n<p>After signing the app with the \"Apple Distribution\" certificate, you can continue to submit it to Mac App Store.</p>\n<p>However, this guide do not ensure your app will be approved by Apple; you still need to read Apple's <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/SubmittingYourApp/SubmittingYourApp.html\">Submitting Your App</a> guide on how to meet the Mac App Store requirements.</p>\n<h3 id=\"upload\"><a href=\"#upload\">Upload</a></h3>\n<p>The Application Loader should be used to upload the signed app to iTunes Connect for processing, making sure you have <a href=\"https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/CreatingiTunesConnectRecord.html\">created a record</a> before uploading.</p>\n<p>If you are seeing errors like private APIs uses, you should check if the app is using the MAS build of Electron.</p>\n<h3 id=\"submit-for-review\"><a href=\"#submit-for-review\">Submit for review</a></h3>\n<p>After uploading, you should <a href=\"https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html\">submit your app for review</a>.</p>\n<h2 id=\"limitaciones-de-la-estructura-del-mas\"><a href=\"#limitaciones-de-la-estructura-del-mas\">Limitaciones de la estructura del MAS</a></h2>\n<p>Con el fin de satisfacer todos los requerimientos de las aplicaciones en la caja de arena, los siguientes módulos han sido deshabilitados en la estructura del MAS:</p>\n<ul>\n<li><code>crashReporter</code></li>\n<li><code>autoUpdater</code></li>\n</ul>\n<p>y los siguientes comportamientos han sido cambiados:</p>\n<ul>\n<li>La captura de video puede no funcionar para algunos equipos.</li>\n<li>Algunas características de accesibilidad pudiesen no funcionar.</li>\n<li>Las aplicaciones no tendrán la señal de los cambios DNS.</li>\n</ul>\n<p>Igualmente, dado el uso de las aplicaciones en caja de arena, los recursos que pueden ser accesados por la aplicación son limitados; puede leer <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandboxing</a> para más información.</p>\n<h3 id=\"additional-entitlements\"><a href=\"#additional-entitlements\">Additional entitlements</a></h3>\n<p>Depending on which Electron APIs your app uses, you may need to add additional entitlements to your app's entitlements file. Otherwise, the App Sandbox may prevent you from using them.</p>\n<h4 id=\"network-access\"><a href=\"#network-access\">Network access</a></h4>\n<p>Habilitar conexiones de red salientes para permitir que su aplicación se conecte al servidor:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.network.client<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>Habilitar conexiones de red entrantes para permitir que su aplicación abra puertos de escucha:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.network.server<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>Vea la <a href=\"https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW9\">Documentación sobre la habilitación del acceso de red</a> para más detalles.</p>\n<h4 id=\"dialogshowopendialog\"><a href=\"#dialogshowopendialog\">dialog.showOpenDialog</a></h4>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.files.user-selected.read-only<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>Vea la <a href=\"https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6\">documentación sobre la habilitación del acceso del usuario a archivos seleccionados</a> para más información.</p>\n<h4 id=\"dialogshowsavedialog\"><a href=\"#dialogshowsavedialog\">dialog.showSaveDialog</a></h4>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.files.user-selected.read-write<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>Vea la <a href=\"https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6\">documentación sobre la habilitación del acceso del usuario a archivos seleccionados</a> para más información.</p>\n<h2 id=\"algoritmos-criptográficos-utilizados-por-electron\"><a href=\"#algoritmos-criptográficos-utilizados-por-electron\">Algoritmos criptográficos utilizados por Electron</a></h2>\n<p>Dependiendo de los países en los que estás lanzando tu aplicación, puedes ser necesario proporcionar información sobre los algoritmos criptográficos utilizados en tu software. Ver <a href=\"https://help.apple.com/app-store-connect/#/devc3f64248f\">encryption export compliance docs</a> para mas información.</p>\n<p>Electron usa los siguientes algoritmos criptográficos:</p>\n<ul>\n<li>AES - <a href=\"https://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf\">NIST SP 800-38A</a>, <a href=\"https://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf\">NIST SP 800-38D</a>, <a href=\"https://www.ietf.org/rfc/rfc3394.txt\">RFC 3394</a></li>\n<li>HMAC - <a href=\"https://csrc.nist.gov/publications/fips/fips198-1/FIPS-198-1_final.pdf\">FIPS 198-1</a></li>\n<li>ECDSA - ANS X9.62–2005</li>\n<li>ECDH - ANS X9.63–2001</li>\n<li>HKDF - <a href=\"https://csrc.nist.gov/publications/nistpubs/800-56C/SP-800-56C.pdf\">NIST SP 800-56C</a></li>\n<li>PBKDF2 - <a href=\"https://tools.ietf.org/html/rfc2898\">RFC 2898</a></li>\n<li>RSA - <a href=\"https://www.ietf.org/rfc/rfc3447\">RFC 3447</a></li>\n<li>SHA - <a href=\"https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf\">FIPS 180-4</a></li>\n<li>Blowfish - <a href=\"https://www.schneier.com/cryptography/blowfish/\">https://www.schneier.com/cryptography/blowfish/</a></li>\n<li>CAST - <a href=\"https://tools.ietf.org/html/rfc2144\">RFC 2144</a>, <a href=\"https://tools.ietf.org/html/rfc2612\">RFC 2612</a></li>\n<li>DES - <a href=\"https://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf\">FIPS 46-3</a></li>\n<li>DH - <a href=\"https://tools.ietf.org/html/rfc2631\">RFC 2631</a></li>\n<li>DSA - <a href=\"https://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+X9.30-1%3A1997\">ANSI X9.30</a></li>\n<li>EC - <a href=\"https://www.secg.org/sec1-v2.pdf\">SEC 1</a></li>\n<li>IDEA - \"On the Design and Security of Block Ciphers\" (En el diseño y la seguridad de las cifras cifradas) libro de X. Lai</li>\n<li>MD2 - <a href=\"https://tools.ietf.org/html/rfc1319\">RFC 1319</a></li>\n<li>MD4 - <a href=\"https://tools.ietf.org/html/rfc6150\">RFC 6150</a></li>\n<li>MD5 - <a href=\"https://tools.ietf.org/html/rfc1321\">RFC 1321</a></li>\n<li>MDC2 - <a href=\"https://wiki.openssl.org/index.php/Manual:Mdc2(3)\">ISO/IEC 10118-2</a></li>\n<li>RC2 - <a href=\"https://tools.ietf.org/html/rfc2268\">RFC 2268</a></li>\n<li>RC4 - <a href=\"https://tools.ietf.org/html/rfc4345\">RFC 4345</a></li>\n<li>RC5 - <a href=\"https://people.csail.mit.edu/rivest/Rivest-rc5rev.pdf\">https://people.csail.mit.edu/rivest/Rivest-rc5rev.pdf</a></li>\n<li>RIPEMD - <a href=\"https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2010118-3:2004\">ISO/IEC 10118-3</a></li>\n</ul>",
      "title": "Guía de publicación en la Mac App Store",
      "description": ""
    },
    "/docs/tutorial/macos-dock": {
      "locale": "es-ES",
      "slug": "macos-dock",
      "href": "/docs/tutorial/macos-dock",
      "crowdinFileId": "256217",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/macos-dock.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dock-macos\"><a href=\"#dock-macos\">Dock (macOS)</a></h1>\n<p>Electron tiene APIs para configurar el icono de la aplicación en el Dock de macOS. Solo existe una API macOS para crear menú de dock personalizado, pero Electron además usa el icono de app dock como el punto de entrada para características multiplataforma como <a href=\"/docs/tutorial/recent-documents\">recent documents</a> y <a href=\"/docs/tutorial/progress-bar\">application progress</a>.</p>\n<p>La base de acoplamiento personalizada se utiliza habitualmente para añadir accesos directos a las tareas para las que el usuario no desea abrir toda la ventana de la aplicación.</p>\n<p><strong>Menú Dock de Terminal.app:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5069962/6032658a-6e9c-11e4-9953-aa84006bdfff.png\" alt=\"Menu Dock\"></p>\n<p>To set your custom dock menu, you need to use the <a href=\"/docs/api/dock#docksetmenumenu-macos\"><code>app.dock.setMenu</code></a> API, which is only available on macOS.</p>\n<h2 id=\"ejemplo\"><a href=\"#ejemplo\">Ejemplo</a></h2>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/macos-dock-menu\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\n<span class=\"hljs-keyword\">const</span> dockMenu = Menu.buildFromTemplate([\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Window'</span>,\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'New Window'</span>) }\n  }, {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Window with Settings'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Basic'</span> },\n      { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Pro'</span> }\n    ]\n  },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Command...'</span> }\n])\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">if</span> (process.platform === <span class=\"hljs-string\">'darwin'</span>) {\n    app.dock.setMenu(dockMenu)\n  }\n}).then(createWindow)\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n\n</code></pre>\n<p>After launching the Electron application, right click the application icon. You should see the custom menu you just defined:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/macos-dock-menu.png\" alt=\"macOS dock menu\"></p>",
      "title": "Dock (macOS)",
      "description": ""
    },
    "/docs/api/structures/memory-info": {
      "locale": "es-ES",
      "slug": "memory-info",
      "href": "/docs/api/structures/memory-info",
      "crowdinFileId": "256459",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/memory-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"memoryinfo-object\"><a href=\"#memoryinfo-object\">MemoryInfo Object</a></h1>\n<ul>\n<li><code>workingSetSize</code> Integer - The amount of memory currently pinned to actual physical RAM.</li>\n<li><code>peakWorkingSetSize</code> Integer - The maximum amount of memory that has ever been pinned to actual physical RAM.</li>\n<li><code>privateBytes</code> Integer (optional) <em>Windows</em> - The amount of memory not shared by other processes, such as JS heap or HTML content.</li>\n</ul>\n<p>Note that all statistics are reported in Kilobytes.</p>",
      "title": "MemoryInfo Object",
      "description": ""
    },
    "/docs/api/structures/memory-usage-details": {
      "locale": "es-ES",
      "slug": "memory-usage-details",
      "href": "/docs/api/structures/memory-usage-details",
      "crowdinFileId": "256461",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/memory-usage-details.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"memoryusagedetails-object\"><a href=\"#memoryusagedetails-object\">MemoryUsageDetails Object</a></h1>\n<ul>\n<li><code>count</code> Number</li>\n<li><code>size</code> Number</li>\n<li><code>liveSize</code> Number</li>\n</ul>",
      "title": "MemoryUsageDetails Object",
      "description": ""
    },
    "/docs/api/menu": {
      "locale": "es-ES",
      "slug": "menu",
      "href": "/docs/api/menu",
      "crowdinFileId": "256335",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/menu.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"menu\"><a href=\"#menu\">Menu</a></h1>\n<h2 id=\"clase-menú\"><a href=\"#clase-menú\">Clase: Menú</a></h2>\n<blockquote>\n<p>Crea menús de aplicaciones nativas y menús contextuales.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<h3 id=\"new-menu\"><a href=\"#new-menu\"><code>new Menu()</code></a></h3>\n<p>Crea un nuevo menú.</p>\n<h3 id=\"métodos-estáticos\"><a href=\"#métodos-estáticos\">Métodos Estáticos</a></h3>\n<p>La clase <code>Menu</code> tiene los siguientes métodos estáticos:</p>\n<h4 id=\"menusetapplicationmenumenu\"><a href=\"#menusetapplicationmenumenu\"><code>Menu.setApplicationMenu(menu)</code></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Establece <code>menu</code> como el menú de la aplicación en macOS. En Windows y Linux el <code>menu</code> será establecido como el menú superior de la ventana.</p>\n<p>Además en Windows y Linux, puedes usar un <code>&#x26;</code> en el nombre del ítem de nivel superior para indicar que letra debe obtener un acelerador generado. Por ejemplo, usando <code>&#x26;File</code> para el menú resultaría en un acelerador generado <code>Alt-F</code> que abre el menú asociado. El carácter indicado en la etiqueta del botón entonces aparecerá subrayado, y el carácter <code>&#x26;</code> no se mostrará en la etiqueta del botón.</p>\n<p>Para poder saltar el carácter <code>&#x26;</code> en el nombre de un objeto, usa un <code>&#x26;</code> procedural. Por ejemplo, <code>&#x26;&#x26;Archivo</code> abrirá <code>&#x26;Archivo</code> en la etiqueta del botón.</p>\n<p>Passing <code>null</code> will suppress the default menu. On Windows and Linux, this has the additional effect of removing the menu bar from the window.</p>\n<p><strong>Note:</strong> El menú por defecto será creado automáticamente si la aplicación no establece uno. Esto contiene los ítems estándares como <code>File</code>, <code>Edit</code>, <code>View</code>, <code>Window</code> y <code>Help</code>.</p>\n<h4 id=\"menugetapplicationmenu\"><a href=\"#menugetapplicationmenu\"><code>Menu.getApplicationMenu()</code></a></h4>\n<p>Devuelve <code>Menu | null</code> - El menú de aplicación, si se creó, o <code>null</code> en caso contrario.</p>\n<p><strong>Nota:</strong> La instancia devuelta <code>Menu</code> no soporta adiciones dinámicas o la eliminación de elementos del menú. <a href=\"#instance-properties\">Instance properties</a> todavía puede ser modificada dinámicamente.</p>\n<h4 id=\"menusendactiontofirstresponderaction-macos\"><a href=\"#menusendactiontofirstresponderaction-macos\"><code>Menu.sendActionToFirstResponder(action)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>action</code> String</li>\n</ul>\n<p>Envía la <code>action</code> al primer respondedor de la aplicación. Esto es usado para emular los comportamientos del menú macOS por defecto. Normalmente usarías el <a href=\"/docs/api/menu-item#roles\"><code>rol</code></a> propiedad de un <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>.</p>\n<p>Consulte la <a href=\"https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW7\">macOS Cocoa Event Handling Guide</a> para más información sobre las acciones nativas de macOS.</p>\n<h4 id=\"menubuildfromtemplatetemplate\"><a href=\"#menubuildfromtemplatetemplate\"><code>Menu.buildFromTemplate(template)</code></a></h4>\n<ul>\n<li><code>plantilla</code> (MenuItemConstructorOptions | MenuItem)[]</li>\n</ul>\n<p>Devuelve <code>Menu</code></p>\n<p>Generally, the <code>template</code> is an array of <code>options</code> for constructing a <a href=\"/docs/api/menu-item\">MenuItem</a>. The usage can be referenced above.</p>\n<p>Usted puede además adjuntar otros campos al elemento del <code>template</code> y se convierten en propiedades de los items del menú construido.</p>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<p>El objeto<code>menu</code> tiene los siguientes métodos de instancia:</p>\n<h4 id=\"menupopupoptions\"><a href=\"#menupopupoptions\"><code>menu.popup([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (opcional) - Por defecto es la ventana seleccionada.</li>\n<li><code>x</code> Número (opcional) - Default es la posición actual del cursor. Debe ser declarado si <code>y</code> es declarado.</li>\n<li><code>y</code> Número (opcional) - Default es la posición actual del cursor. Debe ser declarado si <code>x</code> es declarado.</li>\n<li><code>positioningItem</code> Número (opcional) <em>macOS</em> - El índice del elemento del menú que debe ser posicionado debajo del cursor en las coordenadas específicas. El valor predeterminado es -1.</li>\n<li><code>callback</code> Function (opcional) - Llamada cuando se cierra el menu.</li>\n</ul></li>\n</ul>\n<p>Este menú aparece como un menú contextual en el <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<h4 id=\"menuclosepopupbrowserwindow\"><a href=\"#menuclosepopupbrowserwindow\"><code>menu.closePopup([browserWindow])</code></a></h4>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (opcional) - Por defecto es la ventana seleccionada.</li>\n</ul>\n<p>Cierra el menú de contexto en la <code>browserWindow</code>.</p>\n<h4 id=\"menuappendmenuitem\"><a href=\"#menuappendmenuitem\"><code>menu.append(menuItem)</code></a></h4>\n<ul>\n<li><code>menuItem</code> <a href=\"/docs/api/menu-item\">MenuItem</a></li>\n</ul>\n<p>Anexa el <code>menuItem</code> al menú.</p>\n<h4 id=\"menugetmenuitembyidid\"><a href=\"#menugetmenuitembyidid\"><code>menu.getMenuItemById(id)</code></a></h4>\n<ul>\n<li><code>id</code> Cadena</li>\n</ul>\n<p>Devuelve <code>MenuItem | null</code> el item con el <code>id</code> especificado</p>\n<h4 id=\"menuinsertpos-menuitem\"><a href=\"#menuinsertpos-menuitem\"><code>menu.insert(pos, menuItem)</code></a></h4>\n<ul>\n<li><code>pos</code> Entero</li>\n<li><code>menuItem</code> <a href=\"/docs/api/menu-item\">MenuItem</a></li>\n</ul>\n<p>Inserta el <code>menuItem</code> en la posición <code>pos</code> del menú.</p>\n<h3 id=\"eventos-de-instancia\"><a href=\"#eventos-de-instancia\">Eventos de Instancia</a></h3>\n<p>Objetos creados con <code>new Menu</code> o retornados por <code>Menu.buildFromTemplate</code> emiten los siguientes eventos:</p>\n<p><strong>Nota:</strong> Algunos eventos sólo están disponibles en sistemas operativos específicos y se etiquetan como tal.</p>\n<h4 id=\"evento-menu-will-show\"><a href=\"#evento-menu-will-show\">Evento: 'menu-will-show'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n</ul>\n<p>Emitido cuando se llama a <code>menu.popup()</code>.</p>\n<h4 id=\"evento-menu-will-close\"><a href=\"#evento-menu-will-close\">Evento: 'menu-will-close'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n</ul>\n<p>Se emite cuando una ventana emergente se cierra manualmente o con <code>menu.closePopup()</code>.</p>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<p>Los objetos <code>menu</code> también tienen las siguientes propiedades:</p>\n<h4 id=\"menuitems\"><a href=\"#menuitems\"><code>menu.items</code></a></h4>\n<p>Un arreglo <code>MenuItem[]</code> contiene los elementos del menú.</p>\n<p>Cada <code>Menu</code> se compone de múltiples <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a> y cada <code>MenuItem</code> tiene un submenú.</p>\n<h2 id=\"ejemplos\"><a href=\"#ejemplos\">Ejemplos</a></h2>\n<p>Un ejemplo de creación de una menú de la aplicación con el API simple template:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> isMac = process.platform === <span class=\"hljs-string\">'darwin'</span>\n\n<span class=\"hljs-keyword\">const</span> template = [\n  <span class=\"hljs-comment\">// { role: 'appMenu' }</span>\n  ...(isMac ? [{\n    <span class=\"hljs-attr\">label</span>: app.name,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'about'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'services'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'hide'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'hideOthers'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'unhide'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'quit'</span> }\n    ]\n  }] : []),\n  <span class=\"hljs-comment\">// { role: 'fileMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'File'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      isMac ? { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'close'</span> } : { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'quit'</span> }\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'editMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Editar'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'undo'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'redo'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'cut'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'copy'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'paste'</span> },\n      ...(isMac ? [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'pasteAndMatchStyle'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'delete'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'selectAll'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        {\n          <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Speech'</span>,\n          <span class=\"hljs-attr\">submenu</span>: [\n            { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'startSpeaking'</span> },\n            { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'stopSpeaking'</span> }\n          ]\n        }\n      ] : [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'delete'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'selectAll'</span> }\n      ])\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'viewMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'View'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'reload'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'forceReload'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'toggleDevTools'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'resetZoom'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoomIn'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoomOut'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'togglefullscreen'</span> }\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'windowMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Window'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'minimize'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoom'</span> },\n      ...(isMac ? [\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'front'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'window'</span> }\n      ] : [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'close'</span> }\n      ])\n    ]\n  },\n  {\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'help'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      {\n        <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Learn More'</span>,\n        <span class=\"hljs-attr\">click</span>: <span class=\"hljs-keyword\">async</span> () => {\n          <span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n          <span class=\"hljs-keyword\">await</span> shell.openExternal(<span class=\"hljs-string\">'https://electronjs.org'</span>)\n        }\n      }\n    ]\n  }\n]\n\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\nMenu.setApplicationMenu(menu)\n</code></pre>\n<h3 id=\"proceso-de-renderizado\"><a href=\"#proceso-de-renderizado\">Proceso de renderizado</a></h3>\n<p>Para crear menús iniciados por el renderer process, envía la información requerida al main process usando IPC y haz que main process muestre el menú en nombre del renderer.</p>\n<p>A continuación un ejemplo de mostrar un menú cuando el usuario pulsa el botón derecho en la página:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer</span>\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'contextmenu'</span>, (e) => {\n  e.preventDefault()\n  ipcRenderer.send(<span class=\"hljs-string\">'show-context-menu'</span>)\n})\n\nipcRenderer.on(<span class=\"hljs-string\">'context-menu-command'</span>, (e, command) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// main</span>\nipcMain.on(<span class=\"hljs-string\">'show-context-menu'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> template = [\n    {\n      <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Menu Item 1'</span>,\n      <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { event.sender.send(<span class=\"hljs-string\">'context-menu-command'</span>, <span class=\"hljs-string\">'menu-item-1'</span>) }\n    },\n    { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Menu Item 2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'checkbox'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> }\n  ]\n  <span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\n  menu.popup(BrowserWindow.fromWebContents(event.sender))\n})\n</code></pre>\n<h2 id=\"notas-sobre-el-menú-de-la-aplicación-en-macos\"><a href=\"#notas-sobre-el-menú-de-la-aplicación-en-macos\">Notas sobre el menú de la aplicación en macOS</a></h2>\n<p>macOS has a completely different style of application menu from Windows and Linux. Here are some notes on making your app's menu more native-like.</p>\n<h3 id=\"menús-estándar\"><a href=\"#menús-estándar\">Menús Estándar</a></h3>\n<p>En macOS hay muchos menúes estándares definidos por el sistema, como los menúes <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc\"><code>Services</code></a> y<code>Windows</code>. Para hacer que el menú sea un menú estándar, se debe configurar el <code>role</code> del menú a uno de los siguientes y Electron los reconocerá y convertirá en menús estándares:</p>\n<ul>\n<li><code>window</code></li>\n<li><code>help</code></li>\n<li><code>services</code></li>\n</ul>\n<h3 id=\"acciones-estándares-de-los-elementos-del-menú\"><a href=\"#acciones-estándares-de-los-elementos-del-menú\">Acciones estándares de los elementos del menú</a></h3>\n<p>macOS ha proporcionado acciones estándares para algunos elementos del menú, como <code>About xxx</code>, <code>Hide xxx</code>, y <code>Hide Others</code>. Para establecer la acción de un elemento de menú en una acción estándar, debe establecer el atributo <code>función</code> del elemento del menú.</p>\n<h3 id=\"nombre-del-menú-principal\"><a href=\"#nombre-del-menú-principal\">Nombre del menú principal</a></h3>\n<p>En macOS, la etiqueta del primer elemento del menú de la aplicación siempre es su nombre de aplicación, sin importar la etiqueta que establezca. Para cambiarlo, modifique el archivo <code>Info.plist</code> file del conjunto de la app. See <a href=\"https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html\">About Information Property List Files</a> for more information.</p>\n<h2 id=\"setting-menu-for-specific-browser-window-linux-windows\"><a href=\"#setting-menu-for-specific-browser-window-linux-windows\">Setting Menu for Specific Browser Window (<em>Linux</em> <em>Windows</em>)</a></h2>\n<p>El <a href=\"/docs/api/browser-window#winsetmenumenu-linux-windows\"><code>setMenu</code> method</a> de las ventanas del navegador pueden configurar el menú de ciertas ventanas del navegador.</p>\n<h2 id=\"la-posición-del-elemento-del-menú\"><a href=\"#la-posición-del-elemento-del-menú\">La posición del elemento del menú</a></h2>\n<p>Tú puedes hacer uso de <code>before</code>, <code>after</code>, <code>beforeGroupContaining</code>, <code>afterGroupContaining</code> y <code>id</code> para controlar como el elemento sera colocado cuando un menu sea construido con <code>Menu.buildFromTemplate</code>.</p>\n<ul>\n<li><code>before</code> - Inserta este ítem antes que el ítem con la etiqueta especificada. Si el ítem referenciado no existe se insertara al final del menú. Ademas implica que el ítem del menú en cuestión debe ser colocado en el mismo \"grupo\" como el ítem.</li>\n<li><code>after</code> - Inserta este ítem después del ítem con la etiqueta especificada. Si el ítem referenciado no existe se insertara al final del menú. Ademas implica que el ítem del menú en cuestión debe ser colocado en el mismo \"grupo\" como el ítem.</li>\n<li><code>beforeGroupContaining</code> - Proporciona una manera que un único menú contextual declare la ubicación de su grupo contenedor antes del grupo contenedor del ítem con la etiqueta especificada.</li>\n<li><code>beforeGroupContaining</code> - Proporciona una manera que un único menú contextual declare la ubicación de su grupo contenedor antes del grupo contenedor del ítem con la etiqueta especificada.</li>\n</ul>\n<p>Por defecto, los elementos se insertarán en el orden en que existen en la plantilla, a menos que se utilice una de las palabras clave de posicionamiento especificadas.</p>\n<h3 id=\"ejemplos-1\"><a href=\"#ejemplos-1\">Ejemplos</a></h3>\n<p>Plantilla:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'4'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'four'</span> }\n]\n</code></pre>\n<p>Menú:</p>\n<pre><code class=\"hljs language-sh\">- 1\n- 2\n- 3\n- 4\n</code></pre>\n<p>Plantilla:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span> },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span>, <span class=\"hljs-attr\">beforeGroupContaining</span>: [<span class=\"hljs-string\">'1'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'4'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'four'</span>, <span class=\"hljs-attr\">afterGroupContaining</span>: [<span class=\"hljs-string\">'2'</span>] },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span> }\n]\n</code></pre>\n<p>Menú:</p>\n<pre><code class=\"hljs language-sh\">- 3\n- 4\n- ---\n- 1\n- ---\n- 2\n</code></pre>\n<p>Plantilla:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span>, <span class=\"hljs-attr\">after</span>: [<span class=\"hljs-string\">'3'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span>, <span class=\"hljs-attr\">before</span>: [<span class=\"hljs-string\">'1'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span> }\n]\n</code></pre>\n<p>Menú:</p>\n<pre><code class=\"hljs language-sh\">- ---\n- 3\n- 2\n- 1\n</code></pre>",
      "title": "Menu",
      "description": "Crea menús de aplicaciones nativas y menús contextuales."
    },
    "/docs/api/menu-item": {
      "locale": "es-ES",
      "slug": "menu-item",
      "href": "/docs/api/menu-item",
      "crowdinFileId": "256333",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/menu-item.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-menuitem\"><a href=\"#clase-menuitem\">Clase: MenuItem</a></h2>\n<blockquote>\n<p>Agregue elementos a los menús y menús de contexto de la aplicación nativa.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p>Vea <a href=\"/docs/api/menu\"><code>Menú</code></a> para obtener ejemplos.</p>\n<h3 id=\"new-menuitemoptions\"><a href=\"#new-menuitemoptions\"><code>new MenuItem(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>click</code> Función (opcional) - Sera llamada con <code>click(menuItem, browserWindow, event)</code> cuando el elemento del menú sea clickeado.<ul>\n<li><code>menuItem</code> MenuItem</li>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | undefined - Esto no se definirá si no hay alguna ventana abierta.</li>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n</ul></li>\n<li><code>role</code> String (optional) - Can be <code>undo</code>, <code>redo</code>, <code>cut</code>, <code>copy</code>, <code>paste</code>, <code>pasteAndMatchStyle</code>, <code>delete</code>, <code>selectAll</code>, <code>reload</code>, <code>forceReload</code>, <code>toggleDevTools</code>, <code>resetZoom</code>, <code>zoomIn</code>, <code>zoomOut</code>, <code>toggleSpellChecker</code>, <code>togglefullscreen</code>, <code>window</code>, <code>minimize</code>, <code>close</code>, <code>help</code>, <code>about</code>, <code>services</code>, <code>hide</code>, <code>hideOthers</code>, <code>unhide</code>, <code>quit</code>, <code>startSpeaking</code>, <code>stopSpeaking</code>, <code>zoom</code>, <code>front</code>, <code>appMenu</code>, <code>fileMenu</code>, <code>editMenu</code>, <code>viewMenu</code>, <code>shareMenu</code>, <code>recentDocuments</code>, <code>toggleTabBar</code>, <code>selectNextTab</code>, <code>selectPreviousTab</code>, <code>mergeAllWindows</code>, <code>clearRecentDocuments</code>, <code>moveTabToNewWindow</code> or <code>windowMenu</code> - Define the action of the menu item, when specified the <code>click</code> property will be ignored. Ver <a href=\"#roles\">roles</a>.</li>\n<li><code>type</code> String (opcional) - Puede ser <code>normal</code>, <code>separador</code>, <code>submenu</code>, <code>checkbox</code> o <code>radio</code>.</li>\n<li><code>label</code> String (opcional)</li>\n<li><code>sublabel</code> String (opcional)</li>\n<li><code>toolTip</code> String (opcional) <em>macOS</em> - Texto flotante para es elemento del menú.</li>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a> (opcional)</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (opcional)</li>\n<li><code>enabled</code> Boolean (opcional) - Si es falso, el elemento de menú será gris y no se podrá hacer click en él.</li>\n<li><code>acceleratorWorksWhenHidden</code> Boolean (optional) <em>macOS</em> - default is <code>true</code>, and when <code>false</code> will prevent the accelerator from triggering the item if the item is not visible`.</li>\n<li><code>visible</code> Boolean (opcional) - Si es falso, el elemento del menú será totalmente invisible.</li>\n<li><code>checked</code> Boolean (opcional) - Solo debe especificarse para elementos del menú tipo <code>checkbox</code> o <code>radio</code>.</li>\n<li><code>registerAccelerator</code> Boolean (opcional) <em>Linux</em> <em>Windows</em> - Si es false, el acelerador no se registrará en el sistema, pero seguirá siendo visible. Defaults to true.</li>\n<li><code>sharingItem</code> SharingItem (opcional) <em>macOS</em> - el elemento que se compartirá cuando el <code>role</code> es <code>shareMenu</code>.</li>\n<li><code>submenu</code> (MenuItemConstructorOptions[] | <a href=\"/docs/api/menu\">Menu</a>) (opcional) - Debería especificarse para los items del tipo <code>submenu</code>. Si <code>submenu</code> es especificado, el <code>type: 'submenu'</code> puede ser omitido. Si el valor no es un <a href=\"/docs/api/menu\"><code>Menu</code></a> entonces automáticamente será convertido a uno usando <code>Menu.buildFromTemplate</code>.</li>\n<li><code>id</code> String (opcional) - único dentro de un solo menú. Si se define, puede ser usado como referencia a este elemento por el atributo posición.</li>\n<li><code>before</code> String<a href=\"/docs/api/opcional\"></a> - Inserta este ítem antes que el ítem con la etiqueta especificada. Si el ítem referenciado no existe el ítem sera insertado al final del menu. También implica que el ítem del menu en cuestión debería colocarse in el mismo “group” como el ítem.</li>\n<li><code>after</code> String<a href=\"/docs/api/opcional\"></a> - inserta este elemento después de el elemento con la etiqueta especificada. Si el ítem referenciado no existe se insertara al final del menú.</li>\n<li><code>beforeGroupContaining</code> String<a href=\"/docs/api/opcional\"></a> - Proporciona una manera para que un único menú contextual declare la ubicación de su grupo contenedor antes del grupo contenedor del artículo con la etiqueta especificada.</li>\n<li><code>afterGroupContaining</code> String<a href=\"/docs/api/opcional\"></a> - Proporciona una manera para que un único menú contextual declare la ubicación de su grupo contenedor después del grupo contenedor del artículo con la etiqueta especificada.</li>\n</ul></li>\n</ul>\n<p><strong>Note:</strong> <code>acceleratorWorksWhenHidden</code> es especificado como siendo macOS-solo porque los aceleradores siempre trabajan cuando los items son ocultados en Windows y Linux. La opción esta expuesta a los usuarios para darles a ellos la opción de apagarla, ya que esto es posible el el desarrollo nativo de macOS. Esta propiedad solo es usable en macOS High Sierra 10.13 o más recientes.</p>\n<h3 id=\"roles\"><a href=\"#roles\">Roles</a></h3>\n<p>Los roles le permiten a los elementos del menú tener comportamientos predeterminados.</p>\n<p>Es mejor especificar el <code>rol</code> para todos los elementos del menú de tal manera que coincidan con los roles estándar, en vez de tratar de implementar un comportamiento manualmente en una función <code>click</code>. El comportamiento incorporador <code>rol</code> dará la mejor experiencia nativa.</p>\n<p>Los valores de <code>etiqueta</code> y <code>acelerador</code> son opcionales mientras se usa un <code>rol</code> y por defecto se apropiarán valores de cada plataforma.</p>\n<p>Cada elemento del menu deve tener un <code>role</code>, <code>label</code>, o en el caso de un separador un <code>type</code>.</p>\n<p>La propiedad <code>role</code> puede tener los siguientes valores:</p>\n<ul>\n<li><code>deshacer</code></li>\n<li><code>about</code> - Lanza un panel de \"acerca de\" nativo (Cuadro de diálogo personalizado en ventana, cuando no se proporciona uno).</li>\n<li><code>rehacer</code></li>\n<li><code>cortar</code></li>\n<li><code>copiar</code></li>\n<li><code>pegar</code></li>\n<li><code>pasteAndMatchStyle</code></li>\n<li><code>selectAll</code></li>\n<li><code>eliminar</code></li>\n<li><code>minimize</code> - Minimize current window.</li>\n<li><code>close</code> - Close current window.</li>\n<li><code>quit</code> - Salir de la aplicación.</li>\n<li><code>reload</code> - Reload the current window.</li>\n<li><code>forceReload</code> - Recargar la ventana actual ignorando la caché.</li>\n<li><code>toggleDevTools</code> - Alternar herramientas de desarrollador en la ventana actual.</li>\n<li><code>togglefullscreen</code> - Alterna al modo de pantalla completa en la ventana actual.</li>\n<li><code>resetZoom</code> - Restablece el nivel de zoom de la página enfocada al tamaño original.</li>\n<li><code>zoomIn</code> - Zoom en la página enfocada en un 10%.</li>\n<li><code>zoomOut</code> - Aleja la página enfocada en un 10%.</li>\n<li><code>toggleSpellChecker</code> - Activar/desactivar el corrector ortográfico incorporado.</li>\n<li><code>fileMenu</code> - Todo el menú \"Archivo\" por defecto (Cerrar / Salir)</li>\n<li><code>editMenu</code> - Whole default \"Edit\" menu (Undo, Copy, etc.).</li>\n<li><code>viewMenu</code> - Todo el menú \"Vista\" por defecto (Recargar, Activar Herramientas del Desarrollador, etc.)</li>\n<li><code>windowMenu</code> - Todo el menú \"Ventana\" por defecto (Minimizar, Zoom, etc.).</li>\n</ul>\n<p>The following additional roles are available on <em>macOS</em>:</p>\n<ul>\n<li><code>appMenu</code> - Todo el menú \"App\" por defecto (Acerca de, Servicios, etc.)</li>\n<li><code>hide</code> - Map to the <code>hide</code> action.</li>\n<li><code>hideothers</code> - Enlace a la acción <code>hideOtherApplications</code>.</li>\n<li><code>unhide</code> - Map to the <code>unhideAllApplications</code> action.</li>\n<li><code>startspeaking</code> - Enlace a la acción <code>startSpeaking</code>.</li>\n<li><code>stopspeaking</code> - Enlace a la acción <code>stopSpeaking</code>.</li>\n<li><code>front</code> - Map to the <code>arrangeInFront</code> action.</li>\n<li><code>zoom</code> - Map to the <code>performZoom</code> action.</li>\n<li><code>toggletabbar</code> - Enlace a la acción <code>toggleTabBar</code>.</li>\n<li><code>selectnexttab</code> - Enlace a la acción <code>selectNextTab</code>.</li>\n<li><code>selectprevioustab</code> - Enlace a la acción <code>selectPreviousTab</code>.</li>\n<li><code>mergeallwindows</code> - Enlace a la acción <code>mergeAllWindows</code>.</li>\n<li><code>movetabtonewwindow</code> - Enlace a la acción <code>moveTabToNewWindow</code>.</li>\n<li><code>window</code> - El submenú es un menú \"Ventana\".</li>\n<li><code>help</code> - El submenú es un menú \"Ayuda\".</li>\n<li><code>services</code> - El sub menú es una menú <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc\">\"Services\"</a>. This is only intended for use in the Application Menu and is <em>not</em> the same as the \"Services\" submenu used in context menus in macOS apps, which is not implemented in Electron.</li>\n<li><code>recentDocuments</code> - El submenú es un menú \"Abrir reciente\".</li>\n<li><code>clearRecentDocuments</code> - Enlace a la acción <code>clearRecentDocuments</code>.</li>\n<li><code>shareMenu</code> - El submenú es <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/\">share menu</a>. La propiedad <code>sharingItem</code> debe establecerse para indicar el elemento a compartir.</li>\n</ul>\n<p>Al especificar un <code>role</code> en macOS, <code>label</code> y <code>accelerator</code> son las únicas opciones que afectarán el elemento del menú. Todas las demás opciones serán ignoradas. Los <code>role</code> en minúscula, por ejemplo, <code>toggledevtools</code>, todavía son soportados.</p>\n<p><strong>Nota Bene:</strong> Las propiedades <code>enabled</code> y <code>visibility</code> no están disponibles para los elementos de nivel superior del menú de la bandeja en macOS.</p>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<p>Las siguientes propiedades están disponibles en instancias del <code>menú de elementos</code>:</p>\n<h4 id=\"menuitemid\"><a href=\"#menuitemid\"><code>menuItem.id</code></a></h4>\n<p>Un <code>String</code> indicando la etiqueta visible del elemento, esta propiedad puede ser cambiada dinámicamente.</p>\n<h4 id=\"menuitemlabel\"><a href=\"#menuitemlabel\"><code>menuItem.label</code></a></h4>\n<p>Un <code>String</code> indicando la etiqueta visible del elemento.</p>\n<h4 id=\"menuitemclick\"><a href=\"#menuitemclick\"><code>menuItem.click</code></a></h4>\n<p>A <code>Function</code> that is fired when the MenuItem receives a click event. Puede ser llamado con <code>menuItem.click(event, focusedWindow, focusedWebContents)</code>.</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>focusedWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n<li><code>focusedWebContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<h4 id=\"menuitemsubmenu\"><a href=\"#menuitemsubmenu\"><code>menuItem.submenu</code></a></h4>\n<p>Un <code>Menú</code> (opcional) que contiene el submenú del menú elemento, si está presente.</p>\n<h4 id=\"menuitemtype\"><a href=\"#menuitemtype\"><code>menuItem.type</code></a></h4>\n<p>Un <code>String</code> indicando el tipo del elemento. Puede ser <code>normal</code>, <code>separator</code>, <code>submenu</code>, <code>checkbox</code> o <code>radio</code>.</p>\n<h4 id=\"menuitemrole\"><a href=\"#menuitemrole\"><code>menuItem.role</code></a></h4>\n<p>Una <code>String</code> (opcional) indicando el rol del elemento, si está establecido. Can be <code>undo</code>, <code>redo</code>, <code>cut</code>, <code>copy</code>, <code>paste</code>, <code>pasteAndMatchStyle</code>, <code>delete</code>, <code>selectAll</code>, <code>reload</code>, <code>forceReload</code>, <code>toggleDevTools</code>, <code>resetZoom</code>, <code>zoomIn</code>, <code>zoomOut</code>, <code>toggleSpellChecker</code>, <code>togglefullscreen</code>, <code>window</code>, <code>minimize</code>, <code>close</code>, <code>help</code>, <code>about</code>, <code>services</code>, <code>hide</code>, <code>hideOthers</code>, <code>unhide</code>, <code>quit</code>, <code>startSpeaking</code>, <code>stopSpeaking</code>, <code>zoom</code>, <code>front</code>, <code>appMenu</code>, <code>fileMenu</code>, <code>editMenu</code>, <code>viewMenu</code>, <code>shareMenu</code>, <code>recentDocuments</code>, <code>toggleTabBar</code>, <code>selectNextTab</code>, <code>selectPreviousTab</code>, <code>mergeAllWindows</code>, <code>clearRecentDocuments</code>, <code>moveTabToNewWindow</code> or <code>windowMenu</code></p>\n<h4 id=\"menuitemaccelerator\"><a href=\"#menuitemaccelerator\"><code>menuItem.accelerator</code></a></h4>\n<p>Un <code>Accelerator</code> (opcional) indicando el acelerador del elemento, si está establecido.</p>\n<h4 id=\"menuitemuseraccelerator-readonly-macos\"><a href=\"#menuitemuseraccelerator-readonly-macos\"><code>menuItem.userAccelerator</code> <em>Readonly</em> <em>macOS</em></a></h4>\n<p>Un <code>Accelerator | null</code> indicando el <a href=\"https://developer.apple.com/documentation/appkit/nsmenuitem/1514850-userkeyequivalent?language=objc\">user-assigned accelerator</a> del elemento para el menú del elemento.</p>\n<p><strong>Nota:</strong> Esta propiedad es solo inicializada después de que <code>MenuItem</code> a sido agregada al <code>Menu</code>. Ya sea a través de <code>Menu.buildFromTemplate</code> o a través de <code>Menu.append()/insert()</code>.  Accediendo antes de la inicialización solo devolverá <code>null</code>.</p>\n<h4 id=\"menuitemicon\"><a href=\"#menuitemicon\"><code>menuItem.icon</code></a></h4>\n<p>Una <code>NativeImage | String</code> (opcional) indicando el icono del elemento, si estuviera establecido.</p>\n<h4 id=\"menuitemsublabel\"><a href=\"#menuitemsublabel\"><code>menuItem.sublabel</code></a></h4>\n<p>Un <code>String</code> indicando la sub-etiqueta del elemento.</p>\n<h4 id=\"menuitemtooltip-macos\"><a href=\"#menuitemtooltip-macos\"><code>menuItem.toolTip</code> <em>macOS</em></a></h4>\n<p>Un <code>String</code> indicando el texto flotante del elemento.</p>\n<h4 id=\"menuitemenabled\"><a href=\"#menuitemenabled\"><code>menuItem.enabled</code></a></h4>\n<p>Un <code>booleano</code> indicando si el elementos está habilitado, esta propiedad puede ser cambiada dinámicamente.</p>\n<h4 id=\"menuitemvisible\"><a href=\"#menuitemvisible\"><code>menuItem.visible</code></a></h4>\n<p>Un <code>booleano</code> indicando si el elemento es visible, esta propiedad puede ser cambiada dinámicamente.</p>\n<h4 id=\"menuitemchecked\"><a href=\"#menuitemchecked\"><code>menuItem.checked</code></a></h4>\n<p>Un <code>Booleano</code> indicando si el elemento está verificado, esta propiedad puede ser cambiada dinámicamente.</p>\n<p>Un elemento del menú <code>checkbox</code> que cambiará la propiedad <code>verificado</code> en sí y no cuando se selecciona.</p>\n<p>Un elemento del menú <code>radio</code> que activará su propiedad <code>verificado</code> cuando se haga click en él, y que desactivará su propiedad para todos los elementos adyacentes en el mismo menú.</p>\n<p>Puede añadir la función <code>click</code> para comportamientos adicionales.</p>\n<h4 id=\"menuitemregisteraccelerator\"><a href=\"#menuitemregisteraccelerator\"><code>menuItem.registerAccelerator</code></a></h4>\n<p>Un <code>Boolean</code> que indica si el acelerador debe ser registrado con el sistema o solo mostrado.</p>\n<p>Esta propiedad puede ser cambiada dinámicamente.</p>\n<h4 id=\"menuitemsharingitem-macos\"><a href=\"#menuitemsharingitem-macos\"><code>menuItem.sharingItem</code> <em>macOS</em></a></h4>\n<p>Un <code>SharingItem</code> indicando el elemento a compartir cuando el <code>role</code> es <code>shareMenu</code>.</p>\n<p>Esta propiedad puede ser cambiada dinámicamente.</p>\n<h4 id=\"menuitemcommandid\"><a href=\"#menuitemcommandid\"><code>menuItem.commandId</code></a></h4>\n<p>Un <code>Number</code> indicando el id único secuencial de un elemento.</p>\n<h4 id=\"menuitemmenu\"><a href=\"#menuitemmenu\"><code>menuItem.menu</code></a></h4>\n<p>Un <code>Menu</code> del cual el elemento es parte.</p>",
      "title": "Clase: MenuItem",
      "description": "Agregue elementos a los menús y menús de contexto de la aplicación nativa."
    },
    "/docs/api/message-channel-main": {
      "locale": "es-ES",
      "slug": "message-channel-main",
      "href": "/docs/api/message-channel-main",
      "crowdinFileId": "256337",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/message-channel-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messagechannelmain\"><a href=\"#messagechannelmain\">MessageChannelMain</a></h1>\n<p><code>MessageChannelMain</code> is the main-process-side equivalent of the DOM <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\"><code>MessageChannel</code></a> object. Su función singular es crear un par de objetos <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> conectados.</p>\n<p>Ve la documentacion de <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> para mas información sobre el uso de channel messaging.</p>\n<h2 id=\"clase-messagechannelmain\"><a href=\"#clase-messagechannelmain\">Clase: MessageChannelMain</a></h2>\n<blockquote>\n<p>Interfaz para la mensajería de canales del proceso principal.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p>Ejemplo:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Proceso principal</span>\n<span class=\"hljs-keyword\">const</span> { MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nw.webContents.postMessage(<span class=\"hljs-string\">'port'</span>, <span class=\"hljs-literal\">null</span>, [port2])\nport1.postMessage({ <span class=\"hljs-attr\">some</span>: <span class=\"hljs-string\">'message'</span> })\n\n<span class=\"hljs-comment\">// Proceso de renderizado</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e) => {\n  <span class=\"hljs-comment\">// e.ports es una lista de puertos enviados junto con este mensaje</span>\n  e.ports[<span class=\"hljs-number\">0</span>].on(<span class=\"hljs-string\">'message'</span>, (messageEvent) => {\n    <span class=\"hljs-built_in\">console</span>.log(messageEvent.data)\n  })\n})\n</code></pre>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<h4 id=\"channelport1\"><a href=\"#channelport1\"><code>channel.port1</code></a></h4>\n<p>Una propiedad <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a>.</p>\n<h4 id=\"channelport2\"><a href=\"#channelport2\"><code>channel.port2</code></a></h4>\n<p>Una propiedad <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a>.</p>",
      "title": "MessageChannelMain",
      "description": "Interfaz para la mensajería de canales del proceso principal."
    },
    "/docs/api/message-port-main": {
      "locale": "es-ES",
      "slug": "message-port-main",
      "href": "/docs/api/message-port-main",
      "crowdinFileId": "256339",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/message-port-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"título-1-xpathh-1\"><a href=\"#título-1-xpathh-1\">Título 1 Xpath:/h 1</a></h1>\n<p><code>MessagePortMain</code> is the main-process-side equivalent of the DOM <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> object. It behaves similarly to the DOM version, with the exception that it uses the Node.js <code>EventEmitter</code> event system, instead of the DOM <code>EventTarget</code> system. This means you should use <code>port.on('message', ...)</code> to listen for events, instead of <code>port.onmessage = ...</code> or <code>port.addEventListener('message', ...)</code></p>\n<p>Ve la documentacion de <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> para mas información sobre el uso de channel messaging.</p>\n<p><code>MessagePortMain</code> is an [EventEmitter][event-emitter].</p>\n<h2 id=\"clase-messageportmain\"><a href=\"#clase-messageportmain\">Clase: MessagePortMain</a></h2>\n<blockquote>\n<p>Interfaz del puerto para la mensajería de canales del proceso principal.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<h4 id=\"portpostmessagemessage-transfer\"><a href=\"#portpostmessagemessage-transfer\"><code>port.postMessage(message, [transfer])</code></a></h4>\n<ul>\n<li><code>mensaje</code> cualquiera</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.</p>\n<h4 id=\"portstart\"><a href=\"#portstart\"><code>port.start()</code></a></h4>\n<p>Starts the sending of messages queued on the port. Messages will be queued until this method is called.</p>\n<h4 id=\"portclose\"><a href=\"#portclose\"><code>port.close()</code></a></h4>\n<p>Disconnects the port, so it is no longer active.</p>\n<h3 id=\"eventos-de-instancia\"><a href=\"#eventos-de-instancia\">Eventos de Instancia</a></h3>\n<h4 id=\"evento-message\"><a href=\"#evento-message\">Evento: 'message'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>messageEvent</code> Object<ul>\n<li><code>data</code> any</li>\n<li><code>ports</code> MessagePortMain[]</li>\n</ul></li>\n</ul>\n<p>Emitted when a MessagePortMain object receives a message.</p>\n<h4 id=\"evento-close\"><a href=\"#evento-close\">Evento: \"close\"</a></h4>\n<p>Emitted when the remote end of a MessagePortMain object becomes disconnected.</p>",
      "title": "Título 1 Xpath:/h 1",
      "description": "Interfaz del puerto para la mensajería de canales del proceso principal."
    },
    "/docs/tutorial/message-ports": {
      "locale": "es-ES",
      "slug": "message-ports",
      "href": "/docs/tutorial/message-ports",
      "crowdinFileId": "256219",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/message-ports.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messageports-en-electron\"><a href=\"#messageports-en-electron\">MessagePorts en Electron</a></h1>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a>s son características web que permite pasar mensajes entre diferentes contextos. Es como <code>window.postMessage</code>, pero en diferentes canales. El objetivo de este documente este describir como Electron extiende el modelo de mensajería del canal, y dar algunos ejemplos de como puedes usar MessagePorts en tu aplicación.</p>\n<p>Aquí un ejemplo muy breve de que es y como funciona un MessagePort:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer.js ///////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-comment\">// MessagePorts are created in pairs. A connected pair of message ports is</span>\n<span class=\"hljs-comment\">// called a channel.</span>\n<span class=\"hljs-keyword\">const</span> channel = <span class=\"hljs-keyword\">new</span> MessageChannel()\n\n<span class=\"hljs-comment\">// The only difference between port1 and port2 is in how you use them. Messages</span>\n<span class=\"hljs-comment\">// sent to port1 will be received by port2 and vice-versa.</span>\n<span class=\"hljs-keyword\">const</span> port1 = channel.port1\n<span class=\"hljs-keyword\">const</span> port2 = channel.port2\n\n<span class=\"hljs-comment\">// It's OK to send a message on the channel before the other end has registered</span>\n<span class=\"hljs-comment\">// a listener. Messages will be queued until a listener is registered.</span>\nport2.postMessage({ <span class=\"hljs-attr\">answer</span>: <span class=\"hljs-number\">42</span> })\n\n<span class=\"hljs-comment\">// Here we send the other end of the channel, port1, to the main process. It's</span>\n<span class=\"hljs-comment\">// also possible to send MessagePorts to other frames, or to Web Workers, etc.</span>\nipcRenderer.postMessage(<span class=\"hljs-string\">'port'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-comment\">// In the main process, we receive the port.</span>\nipcMain.on(<span class=\"hljs-string\">'port'</span>, (event) => {\n  <span class=\"hljs-comment\">// When we receive a MessagePort in the main process, it becomes a</span>\n  <span class=\"hljs-comment\">// MessagePortMain.</span>\n  <span class=\"hljs-keyword\">const</span> port = event.ports[<span class=\"hljs-number\">0</span>]\n\n  <span class=\"hljs-comment\">// MessagePortMain uses the Node.js-style events API, rather than the</span>\n  <span class=\"hljs-comment\">// web-style events API. So .on('message', ...) instead of .onmessage = ...</span>\n  port.on(<span class=\"hljs-string\">'message'</span>, (event) => {\n    <span class=\"hljs-comment\">// data is { answer: 42 }</span>\n    <span class=\"hljs-keyword\">const</span> data = event.data\n  })\n\n  <span class=\"hljs-comment\">// MessagePortMain queues messages until the .start() method has been called.</span>\n  port.start()\n})\n</code></pre>\n<p>La documentación de <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> es una gran manera para aprender más acerca de como funciona MessagePorts.</p>\n<h2 id=\"messageports-en-el-main-process\"><a href=\"#messageports-en-el-main-process\">MessagePorts en el main process</a></h2>\n<p>En el renderer, la clase <code>MessagePort</code> se comporta exactamente como lo hace en la web. El main process no es una página web, sin embargo no tiene un integración con Blink por lo tanto no tiene las clases <code>MessagePort</code> o <code>MessageChannel</code>. Para manejar e interactuar con MessagePorts en el main process, Electron agrega dos nuevas clases: <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> y <a href=\"/docs/api/message-channel-main\"><code>MessageChannelMain</code></a>. Estos se comportan se comportan de manera similar a las clases análogas en el renderer.</p>\n<p>Los objetos <code>MessagePort</code> pueden ser creados en el renderer o en el main process, y pasar de un lado a otro usando los métodos <a href=\"/docs/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a> y <a href=\"/docs/api/web-contents#contentspostmessagechannel-message-transfer\"><code>WebContents.postMessage</code></a>. Tenga en cuenta que los métodos usuales de IPC tales como <code>send</code> y <code>invoke</code> no pueden ser usados para transferir los <code>MessagePort</code>, sólo los métodos <code>postMessage</code> pueden transferir los <code>MessagePort</code>.</p>\n<p>Al pasar los <code>MessagePort</code> a través del main process, puedes conectar dos páginas que de otra forma no podrían comunicarse (p.ej. debido a restricciones del mismo origen).</p>\n<h2 id=\"extensión-evento-close\"><a href=\"#extensión-evento-close\">Extensión: evento <code>close</code></a></h2>\n<p>Electron agrega una característica a <code>MessagePort</code> que no esta presente en la web, para poder hacer a MessagePorts más útil. Ese es el evento <code>close</code>, el cual es emitido cuando el otro extremo del canal está cerrado. Los puertos también pueden ser cerrados implícitamente al ser recolectados por el colector de basura.</p>\n<p>En el renderer, puede usar el evento <code>close</code> ya sea asignando a <code>port.onclose</code> o llamando a <code>port.addEventListener('close', ...)</code>. En el main process, puedes escuchar por el evento <code>close</code> llamando a <code>port.on('close', ...)</code>.</p>\n<h2 id=\"ejemplo-de-casos-de-uso\"><a href=\"#ejemplo-de-casos-de-uso\">Ejemplo de casos de uso</a></h2>\n<h3 id=\"worker-process\"><a href=\"#worker-process\">Worker process</a></h3>\n<p>En este ejemplo, tu aplicación tiene un worker process implementado como una ventana oculta. Quieres que la página de la aplicación sea capaz de comunicarse directamente con el worker process, sin la sobrecarga del rendimiento de la retransmisión a través del main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow, app, ipcMain, MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-comment\">// The worker process is a hidden BrowserWindow, so that it will have access</span>\n  <span class=\"hljs-comment\">// to a full Blink context (including e.g. &#x3C;canvas>, audio, fetch(), etc.)</span>\n  <span class=\"hljs-keyword\">const</span> worker = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span> }\n  })\n  <span class=\"hljs-keyword\">await</span> worker.loadFile(<span class=\"hljs-string\">'worker.html'</span>)\n\n  <span class=\"hljs-comment\">// The main window will send work to the worker process and receive results</span>\n  <span class=\"hljs-comment\">// over a MessagePort.</span>\n  <span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span> }\n  })\n  mainWindow.loadFile(<span class=\"hljs-string\">'app.html'</span>)\n\n  <span class=\"hljs-comment\">// We can't use ipcMain.handle() here, because the reply needs to transfer a</span>\n  <span class=\"hljs-comment\">// MessagePort.</span>\n  ipcMain.on(<span class=\"hljs-string\">'request-worker-channel'</span>, (event) => {\n    <span class=\"hljs-comment\">// For security reasons, let's make sure only the frames we expect can</span>\n    <span class=\"hljs-comment\">// access the worker.</span>\n    <span class=\"hljs-keyword\">if</span> (event.senderFrame === mainWindow.webContents.mainFrame) {\n      <span class=\"hljs-comment\">// Create a new channel ...</span>\n      <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\n      <span class=\"hljs-comment\">// ... send one end to the worker ...</span>\n      worker.webContents.postMessage(<span class=\"hljs-string\">'new-client'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n      <span class=\"hljs-comment\">// ... and the other end to the main window.</span>\n      event.senderFrame.postMessage(<span class=\"hljs-string\">'provide-worker-channel'</span>, <span class=\"hljs-literal\">null</span>, [port2])\n      <span class=\"hljs-comment\">// Now the main window and the worker can communicate with each other</span>\n      <span class=\"hljs-comment\">// without going through the main process!</span>\n    }\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- worker.html ------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">doWork</span>(<span class=\"hljs-params\">input</span>) </span>{\n  <span class=\"hljs-comment\">// Something cpu-intensive.</span>\n  <span class=\"hljs-keyword\">return</span> input * <span class=\"hljs-number\">2</span>\n}\n\n<span class=\"hljs-comment\">// We might get multiple clients, for instance if there are multiple windows,</span>\n<span class=\"hljs-comment\">// or if the main window reloads.</span>\nipcRenderer.on(<span class=\"hljs-string\">'new-client'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n  port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    <span class=\"hljs-comment\">// The event data can be any serializable object (and the event could even</span>\n    <span class=\"hljs-comment\">// carry other MessagePorts with it!)</span>\n    <span class=\"hljs-keyword\">const</span> result = doWork(event.data)\n    port.postMessage(result)\n  }\n})\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- app.html ---------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// We request that the main process sends us a channel we can use to</span>\n<span class=\"hljs-comment\">// communicate with the worker.</span>\nipcRenderer.send(<span class=\"hljs-string\">'request-worker-channel'</span>)\n\nipcRenderer.once(<span class=\"hljs-string\">'provide-worker-channel'</span>, (event) => {\n  <span class=\"hljs-comment\">// Once we receive the reply, we can take the port...</span>\n  <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n  <span class=\"hljs-comment\">// ... register a handler to receive results ...</span>\n  port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'received result:'</span>, event.data)\n  }\n  <span class=\"hljs-comment\">// ... and start sending it work!</span>\n  port.postMessage(<span class=\"hljs-number\">21</span>)\n})\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h3 id=\"flujo-de-repuestas\"><a href=\"#flujo-de-repuestas\">Flujo de repuestas</a></h3>\n<p>Los métodos IPC incorporados de Electron sólo soportan dos modos: dispara-y-olvida (p. ej. <code>send</code>), o solicitud-respuesta (p. ej. <code>invoke</code>). Al usar MessageChannels, puedes implementar un \"flujo de respuesta\", donde una simple solicitud se responda con un flujo de datos.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer.js ///////////////////////////////////////////////////////////////</span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">makeStreamingRequest</span> (<span class=\"hljs-params\">element, callback</span>) </span>{\n  <span class=\"hljs-comment\">// MessageChannels are lightweight--it's cheap to create a new one for each</span>\n  <span class=\"hljs-comment\">// request.</span>\n  <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannel()\n\n  <span class=\"hljs-comment\">// We send one end of the port to the main process ...</span>\n  ipcRenderer.postMessage(\n    <span class=\"hljs-string\">'give-me-a-stream'</span>,\n    { element, <span class=\"hljs-attr\">count</span>: <span class=\"hljs-number\">10</span> },\n    [port2]\n  )\n\n  <span class=\"hljs-comment\">// ... and we hang on to the other end. The main process will send messages</span>\n  <span class=\"hljs-comment\">// to its end of the port, and close it when it's finished.</span>\n  port1.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    callback(event.data)\n  }\n  port1.onclose = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'stream ended'</span>)\n  }\n}\n\nmakeStreamingRequest(<span class=\"hljs-number\">42</span>, (data) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'got response data:'</span>, event.data)\n})\n<span class=\"hljs-comment\">// We will see \"got response data: 42\" 10 times.</span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n\nipcMain.on(<span class=\"hljs-string\">'give-me-a-stream'</span>, (event, msg) => {\n  <span class=\"hljs-comment\">// The renderer has sent us a MessagePort that it wants us to send our</span>\n  <span class=\"hljs-comment\">// response over.</span>\n  <span class=\"hljs-keyword\">const</span> [replyPort] = event.ports\n\n  <span class=\"hljs-comment\">// Here we send the messages synchronously, but we could just as easily store</span>\n  <span class=\"hljs-comment\">// the port somewhere and send messages asynchronously.</span>\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">let</span> i = <span class=\"hljs-number\">0</span>; i &#x3C; msg.count; i++) {\n    replyPort.postMessage(msg.element)\n  }\n\n  <span class=\"hljs-comment\">// We close the port when we're done to indicate to the other end that we</span>\n  <span class=\"hljs-comment\">// won't be sending any more messages. This isn't strictly necessary--if we</span>\n  <span class=\"hljs-comment\">// didn't explicitly close the port, it would eventually be garbage</span>\n  <span class=\"hljs-comment\">// collected, which would also trigger the 'close' event in the renderer.</span>\n  replyPort.close()\n})\n</code></pre>\n<h3 id=\"comunicarse-directamente-entre-el-proceso-principal-y-el-mundo-principal-de-una-página-aislada-del-contexto\"><a href=\"#comunicarse-directamente-entre-el-proceso-principal-y-el-mundo-principal-de-una-página-aislada-del-contexto\">Comunicarse directamente entre el proceso principal y el mundo principal de una página aislada del contexto</a></h3>\n<p>Cuando <a href=\"/docs/tutorial/context-isolation\">context isolation</a> está activado, los mensajes IPC desde el main process al renderer son entregados al mundo aislado, en lugar que al mundo principal. Algunas veces quieres entregar mensajes al mundo principal directamente, sin tener que recorrer el mundo aislado.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow, app, MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-comment\">// Create a BrowserWindow with contextIsolation enabled.</span>\n  <span class=\"hljs-keyword\">const</span> bw = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">contextIsolation</span>: <span class=\"hljs-literal\">true</span>,\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n  bw.loadURL(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-comment\">// We'll be sending one end of this channel to the main world of the</span>\n  <span class=\"hljs-comment\">// context-isolated page.</span>\n  <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\n\n  <span class=\"hljs-comment\">// It's OK to send a message on the channel before the other end has</span>\n  <span class=\"hljs-comment\">// registered a listener. Messages will be queued until a listener is</span>\n  <span class=\"hljs-comment\">// registered.</span>\n  port2.postMessage({ <span class=\"hljs-attr\">test</span>: <span class=\"hljs-number\">21</span> })\n\n  <span class=\"hljs-comment\">// We can also receive messages from the main world of the renderer.</span>\n  port2.on(<span class=\"hljs-string\">'message'</span>, (event) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'from renderer main world:'</span>, event.data)\n  })\n  port2.start()\n\n  <span class=\"hljs-comment\">// The preload script will receive this IPC message and transfer the port</span>\n  <span class=\"hljs-comment\">// over to the main world.</span>\n  bw.webContents.postMessage(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// preload.js ////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// We need to wait until the main world is ready to receive the message before</span>\n<span class=\"hljs-comment\">// sending the port. We create this promise in the preload so it's guaranteed</span>\n<span class=\"hljs-comment\">// to register the onload listener before the load event is fired.</span>\n<span class=\"hljs-keyword\">const</span> windowLoaded = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> {\n  <span class=\"hljs-built_in\">window</span>.onload = resolve\n})\n\nipcRenderer.on(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-keyword\">async</span> (event) => {\n  <span class=\"hljs-keyword\">await</span> windowLoaded\n  <span class=\"hljs-comment\">// We use regular window.postMessage to transfer the port from the isolated</span>\n  <span class=\"hljs-comment\">// world to the main world.</span>\n  <span class=\"hljs-built_in\">window</span>.postMessage(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-string\">'*'</span>, event.ports)\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- index.html -------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-built_in\">window</span>.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n  <span class=\"hljs-comment\">// event.source === window means the message is coming from the preload</span>\n  <span class=\"hljs-comment\">// script, as opposed to from an &#x3C;iframe> or other source.</span>\n  <span class=\"hljs-keyword\">if</span> (event.source === <span class=\"hljs-built_in\">window</span> &#x26;&#x26; event.data === <span class=\"hljs-string\">'main-world-port'</span>) {\n    <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n    <span class=\"hljs-comment\">// Once we have the port, we can communicate directly with the main</span>\n    <span class=\"hljs-comment\">// process.</span>\n    port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'from main process:'</span>, event.data)\n      port.postMessage(event.data * <span class=\"hljs-number\">2</span>)\n    }\n  }\n}\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>",
      "title": "MessagePorts en Electron",
      "description": ""
    },
    "/docs/api/structures/mime-typed-buffer": {
      "locale": "es-ES",
      "slug": "mime-typed-buffer",
      "href": "/docs/api/structures/mime-typed-buffer",
      "crowdinFileId": "256463",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mime-typed-buffer.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mimetypedbuffer-object\"><a href=\"#mimetypedbuffer-object\">MimeTypedBuffer Object</a></h1>\n<ul>\n<li><code>mimeType</code> String (optional) - MIME type of the buffer.</li>\n<li><code>charset</code> String (optional) - Charset of the buffer.</li>\n<li><code>data</code> Buffer - The actual Buffer content.</li>\n</ul>",
      "title": "MimeTypedBuffer Object",
      "description": ""
    },
    "/docs/api/structures/mouse-input-event": {
      "locale": "es-ES",
      "slug": "mouse-input-event",
      "href": "/docs/api/structures/mouse-input-event",
      "crowdinFileId": "256465",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mouse-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mouseinputevent-object-extends-inputevent\"><a href=\"#mouseinputevent-object-extends-inputevent\">MouseInputEvent Object extends <code>InputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>mouseDown</code>, <code>mouseUp</code>, <code>mouseEnter</code>, <code>mouseLeave</code>, <code>contextMenu</code>, <code>mouseWheel</code> or <code>mouseMove</code>.</li>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n<li><code>button</code> String (optional) - The button pressed, can be <code>left</code>, <code>middle</code>, <code>right</code>.</li>\n<li><code>globalX</code> Integer (optional)</li>\n<li><code>globalY</code> Integer (optional)</li>\n<li><code>movementX</code> Integer (optional)</li>\n<li><code>movementY</code> Integer (optional)</li>\n<li><code>clickCount</code> Integer (optional)</li>\n</ul>",
      "title": "MouseInputEvent Object extends InputEvent",
      "description": ""
    },
    "/docs/api/structures/mouse-wheel-input-event": {
      "locale": "es-ES",
      "slug": "mouse-wheel-input-event",
      "href": "/docs/api/structures/mouse-wheel-input-event",
      "crowdinFileId": "256467",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mouse-wheel-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mousewheelinputevent-object-extends-mouseinputevent\"><a href=\"#mousewheelinputevent-object-extends-mouseinputevent\">MouseWheelInputEvent Object extends <code>MouseInputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>mouseWheel</code>.</li>\n<li><code>deltaX</code> Integer (optional)</li>\n<li><code>deltaY</code> Integer (optional)</li>\n<li><code>wheelTicksX</code> Integer (optional)</li>\n<li><code>wheelTicksY</code> Integer (optional)</li>\n<li><code>accelerationRatioX</code> Integer (optional)</li>\n<li><code>accelerationRatioY</code> Integer (optional)</li>\n<li><code>hasPreciseScrollingDeltas</code> Boolean (optional)</li>\n<li><code>canScroll</code> Boolean (optional)</li>\n</ul>",
      "title": "MouseWheelInputEvent Object extends MouseInputEvent",
      "description": ""
    },
    "/docs/tutorial/multithreading": {
      "locale": "es-ES",
      "slug": "multithreading",
      "href": "/docs/tutorial/multithreading",
      "crowdinFileId": "256221",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/multithreading.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"multithreading\"><a href=\"#multithreading\">Multithreading</a></h1>\n<p>Con los <a href=\"https://developer.mozilla.org/en/docs/Web/API/Web_Workers_API/Using_web_workers\">Web Workers</a>, es posible ejecutar JavaScript en <em>threads</em> a nivel de Sistema Operativo.</p>\n<h2 id=\"multi-threaded-nodejs\"><a href=\"#multi-threaded-nodejs\"><em>Multi-threaded</em> Node.js</a></h2>\n<p>Es posible utilizar las características de Node.js en Electron's Web Workers. Para hacerlo, la opción <code>nodeIntegrationInWorker</code> debe configurarse a <code>true</code> en <code>webPreferences</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegrationInWorker</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<p>El <code>nodeIntegrationInWorker</code> puede ser utilizado independientemente de <code>nodeIntegration</code>, pero <code>sandbox</code> no debe ser configurado a <code>true</code>.</p>\n<h2 id=\"apis-disponibles\"><a href=\"#apis-disponibles\">APIs disponibles</a></h2>\n<p>Todos los módulos incorporados de Node.js son compatibles con Web Workers, y los archivos <code>asar</code> aún se pueden leer con la API de Node.js. Sin embargo, ninguno de los módulos incorporados de Electron puede utilizarse en un entorno multiproceso.</p>\n<h2 id=\"módulos-nativos-de-nodejs\"><a href=\"#módulos-nativos-de-nodejs\">Módulos nativos de Node.js</a></h2>\n<p>Cualquier módulo nativo Node.js se puede cargar directamente en Web Workers, pero se recomienda encarecidamente no hacerlo. La mayoría de los módulos nativos existentes se han escrito suponiendo un entorno de subproceso único, su uso en Web Workers dará lugar a bloqueos y daños en la memoria.</p>\n<p>Tenga en cuenta que incluso si un módulo nativo de Node.js es un subproceso seguro, aún asi todavia no es seguro cargarlo en una Web Worker porque la función <code>process.dlopen</code> no es un subproceso seguro.</p>\n<p>La única forma de cargar un módulo nativo de forma segura por ahora es asegurarse de que la aplicación no carga módulos nativos después de que Web Workers se inicie.</p>\n<pre><code class=\"hljs language-javascript\">process.dlopen = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Load native module is not safe'</span>)\n}\n<span class=\"hljs-keyword\">const</span> worker = <span class=\"hljs-keyword\">new</span> Worker(<span class=\"hljs-string\">'script.js'</span>)\n</code></pre>",
      "title": "Multithreading",
      "description": ""
    },
    "/docs/tutorial/native-file-drag-drop": {
      "locale": "es-ES",
      "slug": "native-file-drag-drop",
      "href": "/docs/tutorial/native-file-drag-drop",
      "crowdinFileId": "256223",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/native-file-drag-drop.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"función-nativa-de-arrastrar-y-soltar-archivo\"><a href=\"#función-nativa-de-arrastrar-y-soltar-archivo\">Función nativa de Arrastrar y Soltar archivo</a></h1>\n<h2 id=\"descripción-general\"><a href=\"#descripción-general\">Descripción general</a></h2>\n<p>Ciertos tipos de aplicaciones que manipulan archivos podrían querer soportar la función nativa de arrastrar &#x26; soltar archivos del sistema operativo. Arrastrar archivos dentro de un web content es común y soportado por muchos sitios web. Adicionalmente Electron soporta arrastre de archivos fuera del web content dentro del mundo del sistema.</p>\n<p>To implement this feature in your app, you need to call the <a href=\"/docs/api/web-contents#contentsstartdragitem\"><code>webContents.startDrag(item)</code></a> API in response to the <code>ondragstart</code> event.</p>\n<h2 id=\"ejemplo\"><a href=\"#ejemplo\">Ejemplo</a></h2>\n<p>An example demonstrating how you can create a file on the fly to be dragged out of the window.</p>\n<h3 id=\"preloadjs\"><a href=\"#preloadjs\">Preload.js</a></h3>\n<p>In <code>preload.js</code> use the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> to inject a method <code>window.electron.startDrag(...)</code> that will send an IPC message to the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'electron'</span>, {\n  <span class=\"hljs-attr\">startDrag</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">fileName</span>) =></span> {\n    ipcRenderer.send(<span class=\"hljs-string\">'ondragstart'</span>, path.join(process.cwd(), fileName))\n  }\n})\n</code></pre>\n<h3 id=\"indexhtml\"><a href=\"#indexhtml\">Index.html</a></h3>\n<p>Add a draggable element to <code>index.html</code>, and reference your renderer script:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">div</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"border:2px solid black;border-radius:3px;padding:5px;display:inline-block\"</span> <span class=\"hljs-attr\">draggable</span>=<span class=\"hljs-string\">\"true\"</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"drag\"</span>></span>Drag me<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">div</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h3 id=\"rendererjs\"><a href=\"#rendererjs\">Renderer.js</a></h3>\n<p>In <code>renderer.js</code> set up the renderer process to handle drag events by calling the method you added via the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> above.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'drag'</span>).ondragstart = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n  event.preventDefault()\n  <span class=\"hljs-built_in\">window</span>.electron.startDrag(<span class=\"hljs-string\">'drag-and-drop.md'</span>)\n}\n</code></pre>\n<h3 id=\"mainjs\"><a href=\"#mainjs\">Main.js</a></h3>\n<p>In the Main process (<code>main.js</code> file), expand the received event with a path to the file that is being dragged and an icon:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/drag-and-drop\"><span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nipcMain.on(<span class=\"hljs-string\">'ondragstart'</span>, (event, filePath) => {\n  event.sender.startDrag({\n    <span class=\"hljs-attr\">file</span>: filePath,\n    <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'/path/to/icon.png'</span>\n  })\n})\n</code></pre>\n<p>Después de lanzar la aplicación Electron, intente arrastrar y soltar el elemento desde el BrowserWindow a su escritorio. In this guide, the item is a Markdown file located in the root of the project:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/drag-and-drop.gif\" alt=\"Drag and drop\"></p>",
      "title": "Función nativa de Arrastrar y Soltar archivo",
      "description": ""
    },
    "/docs/api/native-image": {
      "locale": "es-ES",
      "slug": "native-image",
      "href": "/docs/api/native-image",
      "crowdinFileId": "256341",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/native-image.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nativeimage\"><a href=\"#nativeimage\">nativeImage</a></h1>\n<blockquote>\n<p>Crea iconos de bandeja, base y aplicación usando archivos PNG o JPG.</p>\n</blockquote>\n<p>Procesos: <a href=\"/docs/glossary#main-process\">principal</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>In Electron, for the APIs that take images, you can pass either file paths or <code>NativeImage</code> instances. Una imagen vacía será usada cuando se pase <code>null</code>.</p>\n<p>Por ejemplo, cuando se crea una bandeja o se configura un icono de la ventana, se puede pasar una ruta de archivo de imagen como un <code>String</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'/Users/somebody/images/window.png'</span> })\n<span class=\"hljs-built_in\">console</span>.log(appIcon, win)\n</code></pre>\n<p>O leer la imagen desde el portapapeles, lo cual devuelve un <code>NativeImage</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { clipboard, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> image = clipboard.readImage()\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(image)\n<span class=\"hljs-built_in\">console</span>.log(appIcon)\n</code></pre>\n<h2 id=\"formatos-soportados\"><a href=\"#formatos-soportados\">Formatos Soportados</a></h2>\n<p>Actualmente los formatos de imágenes <code>PNG</code> y <code>JPEG</code> están soportados. <code>PNG</code> es recomendado por su soporte de transparencia y compresión sin pérdida.</p>\n<p>En Windows, puedes leer iconos <code>ICO</code> desde rutas de archivos. For best visual quality, it is recommended to include at least the following sizes in the:</p>\n<ul>\n<li>Ícono pequeño<ul>\n<li>16x16 (100% DPI scale)</li>\n<li>20x20 (125% DPI scale)</li>\n<li>24x24 (150% DPI scale)</li>\n<li>32x32 (200% DPI scale)</li>\n</ul></li>\n<li>Ícono Grande<ul>\n<li>32x32 (100% DPI scale)</li>\n<li>40x40 (125% DPI scale)</li>\n<li>48x48 (150% DPI scale)</li>\n<li>64x64 (200% DPI scale)</li>\n<li>256x256</li>\n</ul></li>\n</ul>\n<p>Revise la sección <em>Size requirements</em> en <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dn742485(v=vs.85).aspx\">este artículo</a>.</p>\n<h2 id=\"imagen-de-alta-resolución\"><a href=\"#imagen-de-alta-resolución\">Imagen de alta resolución</a></h2>\n<p>En las plataformas compatibles con altos PPP como las pantallas Apple Retina, se puede anexar <code>@2x</code> luego del nombre del archivo base de la imagen para marcarlo como una imagen de alta resolución.</p>\n<p>Por ejemplo, si <code>icon.png</code> es una imagen normal que tiene resolución estándar, entonces <code>icon@2x.png</code> será tratado como una imagen de alta resolución que tiene densidad DPI.</p>\n<p>If you want to support displays with different DPI densities at the same time, you can put images with different sizes in the same folder and use the filename without DPI suffixes. Por ejemplo:</p>\n<pre><code class=\"hljs language-plaintext\">images/\n├── icon.png\n├── icon@2x.png\n└── icon@3x.png\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-built_in\">console</span>.log(appIcon)\n</code></pre>\n<p>Los siguientes sufijos para DPI son soportados:</p>\n<ul>\n<li><code>@1x</code></li>\n<li><code>@1.25x</code></li>\n<li><code>@1.33x</code></li>\n<li><code>@1.4x</code></li>\n<li><code>@1.5x</code></li>\n<li><code>@1.8x</code></li>\n<li><code>@2x</code></li>\n<li><code>@2.5x</code></li>\n<li><code>@3x</code></li>\n<li><code>@4x</code></li>\n<li><code>@5x</code></li>\n</ul>\n<h2 id=\"imagen-de-plantilla\"><a href=\"#imagen-de-plantilla\">Imagen de plantilla</a></h2>\n<p>Template images consist of black and an alpha channel. Las imágenes de plantilla no están destinadas a ser utilizadas como imágenes independientes y son generalmente mezcladas con otro contenido para crear la apariencia final deseada.</p>\n<p>El caso mas común es usar imágenes de plantillas para el icono de una barra de menú, así este se puede adaptar a ambas barras de menú clara y oscura.</p>\n<p><strong>Nota:</strong> La imagen de plantilla sólo es soportada en macOS.</p>\n<p>Para marcar una imagen como plantilla, su nombre de archivo debe terminar con la palabra <code>Template</code>. Por ejemplo:</p>\n<ul>\n<li><code>xxxTemplate.png</code></li>\n<li><code>xxxTemplate@2x.png</code></li>\n</ul>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>nativeImage</code> tiene los siguientes métodos, de los cuales todos devuelven una instancia de la clase <code>NativeImage</code>:</p>\n<h3 id=\"nativeimagecreateempty\"><a href=\"#nativeimagecreateempty\"><code>nativeImage.createEmpty()</code></a></h3>\n<p>Devuelve <code>NativeImage</code></p>\n<p>Crea una instancia vacía <code>NativeImage</code>.</p>\n<h3 id=\"nativeimagecreatethumbnailfrompathpath-maxsize-macos-windows\"><a href=\"#nativeimagecreatethumbnailfrompathpath-maxsize-macos-windows\"><code>nativeImage.createThumbnailFromPath(path, maxSize)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>path</code> String - path to a file that we intend to construct a thumbnail out of.</li>\n<li><code>maxSize</code> <a href=\"/docs/api/structures/size\">Size</a> - the maximum width and height (positive numbers) the thumbnail returned can be. The Windows implementation will ignore <code>maxSize.height</code> and scale the height according to <code>maxSize.width</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - fulfilled with the file's thumbnail preview image, which is a <a href=\"/docs/api/native-image\">NativeImage</a>.</p>\n<h3 id=\"nativeimagecreatefrompathpath\"><a href=\"#nativeimagecreatefrompathpath\"><code>nativeImage.createFromPath(path)</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Devuelve <code>NativeImage</code></p>\n<p>Crea una instancia <code>NativeImage</code> desde un archivo ubicado en <code>path</code>. Este método devuelve una imagen si la <code>path</code> no existe, o si no puede ser leída o si la imagen no es válida.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> nativeImage = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).nativeImage\n\n<span class=\"hljs-keyword\">const</span> image = nativeImage.createFromPath(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-built_in\">console</span>.log(image)\n</code></pre>\n<h3 id=\"nativeimagecreatefrombitmapbuffer-options\"><a href=\"#nativeimagecreatefrombitmapbuffer-options\"><code>nativeImage.createFromBitmap(buffer, options)</code></a></h3>\n<ul>\n<li><code>buffer</code> <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a></li>\n<li><code>options</code> Object<ul>\n<li><code>width</code> Integer</li>\n<li><code>alto</code> Integer</li>\n<li><code>scaleFactor</code> Doble (opcional) -Por defecto es 1.0.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>NativeImage</code></p>\n<p>Creates a new <code>NativeImage</code> instance from <code>buffer</code> that contains the raw bitmap pixel data returned by <code>toBitmap()</code>. The specific format is platform-dependent.</p>\n<h3 id=\"nativeimagecreatefrombufferbuffer-options\"><a href=\"#nativeimagecreatefrombufferbuffer-options\"><code>nativeImage.createFromBuffer(buffer[, options])</code></a></h3>\n<ul>\n<li><code>buffer</code> <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a></li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>width</code> Integer (opcional) - Requerido para búferes de bipmaps.</li>\n<li><code>height</code> Entero (opcional) - Necesario para los búferes de mapa de bits.</li>\n<li><code>scaleFactor</code> Doble (opcional) -Por defecto es 1.0.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>NativeImage</code></p>\n<p>Crea una nueva instancia <code>NativeImage</code> desde <code>buffer</code>. Tries to decode as PNG or JPEG first.</p>\n<h3 id=\"nativeimagecreatefromdataurldataurl\"><a href=\"#nativeimagecreatefromdataurldataurl\"><code>nativeImage.createFromDataURL(dataURL)</code></a></h3>\n<ul>\n<li><code>dataURL</code> Cadena</li>\n</ul>\n<p>Devuelve <code>NativeImage</code></p>\n<p>Crea una nueva instancia <code>NativeImage</code> desde <code>dataURL</code>.</p>\n<h3 id=\"nativeimagecreatefromnamedimageimagename-hslshift-macos\"><a href=\"#nativeimagecreatefromnamedimageimagename-hslshift-macos\"><code>nativeImage.createFromNamedImage(imageName[, hslShift])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>imageName</code> String</li>\n<li><code>hslShift</code> Number<a href=\"/docs/api/opcional\"></a></li>\n</ul>\n<p>Devuelve <code>NativeImage</code></p>\n<p>Crea una nueva instancia de <code>NativeImage</code> a partir de NSImage vinculada con el nombre especificado. Vea <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/system-icons/\"><code>System Icons</code></a> para una lista de posibles valores.</p>\n<p>El <code>hslShift</code> se aplica a la imagen con las siguientes reglas:</p>\n<ul>\n<li><code>hsl_shift[0]</code> (hue): El valor de hue absoluto para la imagen - 0 y 1 mapea a 0 y 360 en la rueda de color hue  (rojo).</li>\n<li><code>hsl_shift[1]</code> (saturation): A saturation shift for the image, with the following key values: 0 = remove all color. 0.5 = Dejar sin cambios. 1 = fully saturate the image.</li>\n<li><code>hsl_shift[2]</code> (luminosidad): Un cambio en la luminosidad para la imagen, con los siguientes valores  claves: 0 = elimina toda la luminosidad (hace que todos los pixeles sean negros). 0.5 = Dejar sin cambios. 1 = Luminosidad total (hace que todos los píxeles sean blancos).</li>\n</ul>\n<p>Esto significa que <code>[-1, 0, 1]</code> hará la imagen completamente blanca y <code>[-1, 1, 0]</code> la hará completamente negra.</p>\n<p>En algunos casos, el <code>NSImageName</code> no coincide con su cadena de representación; un ejemplo de esto es <code>NSFolderImageName</code>, cuya cadena de representación en realidad sería <code>NSFolder</code>. Por lo tanto, necesitar determinar la cadena de representación correcta para su imagen antes de pasarla. Esto puede hacer con lo siguiente:</p>\n<p><code>echo -e '#import &#x3C;Cocoa/Cocoa.h>\\nint main() { NSLog(@\"%@\", SYSTEM_IMAGE_NAME); }' | clang -otest -x objective-c -framework Cocoa - &#x26;&#x26; ./test</code></p>\n<p>donde <code>SYSTEM_IMAGE_NAME</code> debe ser reemplazado con cualquier valor de <a href=\"https://developer.apple.com/documentation/appkit/nsimagename?language=objc\">this list</a>.</p>\n<h2 id=\"clase-nativeimage\"><a href=\"#clase-nativeimage\">Clase: NativeImage</a></h2>\n<blockquote>\n<p>Envuelve nativamente imágenes como la bandeja, el muelle y los íconos de las aplicaciones.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<p>Los siguientes métodos están disponibles para las distancias de la clase <code>NativeImage</code>:</p>\n<h4 id=\"imagetopngoptions\"><a href=\"#imagetopngoptions\"><code>image.toPNG([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>scaleFactor</code> Doble (opcional) -Por defecto es 1.0.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Buffer</code> - Un <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> que contiene la información codificada de la imagen <code>PNG</code>.</p>\n<h4 id=\"imagetojpegquality\"><a href=\"#imagetojpegquality\"><code>image.toJPEG(quality)</code></a></h4>\n<ul>\n<li><code>quality</code> Integer - Entre 0 - 100.</li>\n</ul>\n<p>Devuelve <code>Buffer</code> - Un <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a>que contiene la información codificada de la imagen <code>JPEG</code>.</p>\n<h4 id=\"imagetobitmapoptions\"><a href=\"#imagetobitmapoptions\"><code>image.toBitmap([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>scaleFactor</code> Doble (opcional) -Por defecto es 1.0.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Buffer</code> - Un <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> que contiene una copia de la información sin procesar de pixeles del mapa de bits de la imagen.</p>\n<h4 id=\"imagetodataurloptions\"><a href=\"#imagetodataurloptions\"><code>image.toDataURL([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>scaleFactor</code> Doble (opcional) -Por defecto es 1.0.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>String</code> - El URL de información de la imagen.</p>\n<h4 id=\"imagegetbitmapoptions\"><a href=\"#imagegetbitmapoptions\"><code>image.getBitmap([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>scaleFactor</code> Doble (opcional) -Por defecto es 1.0.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Buffer</code> - Un <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> que contiene la información sin procesar de pixeles del mapa de bits de la imagen.</p>\n<p>La diferencia entre <code>getBitmap()</code> y <code>toBitmap()</code> es que <code>getBitmap()</code> no copia los datos bitmap, por lo que debe utilizar inmediatamente el Búfer devuelto en el ciclo del evento actual; de lo contrario, los datos podrían modificarse o destruirse.</p>\n<h4 id=\"imagegetnativehandle-macos\"><a href=\"#imagegetnativehandle-macos\"><code>image.getNativeHandle()</code> <em>macOS</em></a></h4>\n<p>Devuelve <code>Buffer</code> - Un <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> que almacena el puntero C en el controlador nativo subyacente de la imagen. En macOS, se devolverá un puntero a la instancia <code>NSImage</code>.</p>\n<p>Observe que el puntero devuelto es un puntero debil a la imagen nativa subyacente en lugar de una copia. Por lo tanto, <em>debe </em> asegurarse que la instancia asociada <code>nativeImage</code> se encuentre cerca.</p>\n<h4 id=\"imageisempty\"><a href=\"#imageisempty\"><code>image.isEmpty()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la imagen está vacía.</p>\n<h4 id=\"imagegetsizescalefactor\"><a href=\"#imagegetsizescalefactor\"><code>image.getSize([scaleFactor])</code></a></h4>\n<ul>\n<li><code>scaleFactor</code> Doble (opcional) -Por defecto es 1.0.</li>\n</ul>\n<p>Devuelve <a href=\"/docs/api/structures/size\"><code>Size</code></a>.</p>\n<p>If <code>scaleFactor</code> is passed, this will return the size corresponding to the image representation most closely matching the passed value.</p>\n<h4 id=\"imagesettemplateimageoption\"><a href=\"#imagesettemplateimageoption\"><code>image.setTemplateImage(option)</code></a></h4>\n<ul>\n<li><code>option</code> Booleano</li>\n</ul>\n<p>Marca la imagen como una imagen de plantilla.</p>\n<h4 id=\"imageistemplateimage\"><a href=\"#imageistemplateimage\"><code>image.isTemplateImage()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la imagen es una imagen de plantilla.</p>\n<h4 id=\"imagecroprect\"><a href=\"#imagecroprect\"><code>image.crop(rect)</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - El área de la imagen para ser recortada.</li>\n</ul>\n<p>Devuelve <code>NativeImage</code> - La imagen recortada.</p>\n<h4 id=\"imageresizeoptions\"><a href=\"#imageresizeoptions\"><code>image.resize(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>width</code> Integer (opcional) - Por defecto es el ancho de la imagen.</li>\n<li><code>height</code> Entero (opcional) - El valor predeterminado es la altura de la imagen.</li>\n<li><code>quality</code> String (opcional) - La calidad deseada para el cambio de tamaño de imagen. Los posibles valores soportados son <code>good</code>, <code>better</code>, o <code>best</code>. Por defecto es <code>best</code>. Estos valores expresan una compensación de calidad/velocidad deseada. Son traducidas dentro de un método de algoritmo específico que depende de las capacidades (CPU, GPU) de la plataforma subyacente. It is possible for all three methods to be mapped to the same algorithm on a given platform.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>NativeImage</code> - La imagen redimensionada.</p>\n<p>Si solo la <code>height</code> o la <code>width</code> son especificadas, entonces la relación de aspecto actual se conservará en la imagen redimensionada.</p>\n<h4 id=\"imagegetaspectratioscalefactor\"><a href=\"#imagegetaspectratioscalefactor\"><code>image.getAspectRatio([scaleFactor])</code></a></h4>\n<ul>\n<li><code>scaleFactor</code> Doble (opcional) -Por defecto es 1.0.</li>\n</ul>\n<p>Devuelve <code>Float</code> - La relación de aspecto de la imagen.</p>\n<p>If <code>scaleFactor</code> is passed, this will return the aspect ratio corresponding to the image representation most closely matching the passed value.</p>\n<h4 id=\"imagegetscalefactors\"><a href=\"#imagegetscalefactors\"><code>image.getScaleFactors()</code></a></h4>\n<p>Returns <code>Float[]</code> - An array of all scale factors corresponding to representations for a given nativeImage.</p>\n<h4 id=\"imageaddrepresentationoptions\"><a href=\"#imageaddrepresentationoptions\"><code>image.addRepresentation(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>scaleFactor</code> Double - El factor de escala para agregar a la representación de la imagen.</li>\n<li><code>width</code> Entero (opcional) - Por defecto es 0. Required if a bitmap buffer is specified as <code>buffer</code>.</li>\n<li><code>height</code> Entero (opcional) - Por defecto es 0. Required if a bitmap buffer is specified as <code>buffer</code>.</li>\n<li><code>buffer</code> Buffer (opcional) - El buffer que contiene los datos de la imagen sin procesar.</li>\n<li><code>dataURL</code> String (optional) - The data URL containing either a base 64 encoded PNG or JPEG image.</li>\n</ul></li>\n</ul>\n<p>Add an image representation for a specific scale factor. This can be used to explicitly add different scale factor representations to an image. This can be called on empty images.</p>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<h4 id=\"nativeimageismactemplateimage-macos\"><a href=\"#nativeimageismactemplateimage-macos\"><code>nativeImage.isMacTemplateImage</code> <em>macOS</em></a></h4>\n<p>Una propiedad <code>Boolean</code> que determina si la imagen es considerada una <a href=\"https://developer.apple.com/documentation/appkit/nsimage/1520017-template\">template image</a>.</p>\n<p>Ten en cuenta que esta propiedad solo tiene un efecto en macOS.</p>",
      "title": "nativeImage",
      "description": "Crea iconos de bandeja, base y aplicación usando archivos PNG o JPG."
    },
    "/docs/api/native-theme": {
      "locale": "es-ES",
      "slug": "native-theme",
      "href": "/docs/api/native-theme",
      "crowdinFileId": "256343",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/native-theme.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nativetheme\"><a href=\"#nativetheme\">nativeTheme</a></h1>\n<blockquote>\n<p>Lee y respondo a los cambios en el tema de color nativo de Chromium.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<h2 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h2>\n<p>El módulo nativo <code>nativeTheme</code> emite los siguientes eventos:</p>\n<h3 id=\"evento-updated\"><a href=\"#evento-updated\">Evento: \"updated\"</a></h3>\n<p>Emitido cuando algo en el NativeTheme subyacente ha cambiado. Esto normalmente significa que le valor de <code>shouldUseDarkColors</code>, <code>shouldUseHighContrastColors</code> o <code>shouldUseInvertedColorScheme</code> ha cambiado. Tendrás que comprobarlos para determinar cual ha cambiado.</p>\n<h2 id=\"propiedades\"><a href=\"#propiedades\">Propiedades</a></h2>\n<p>El módulo <code>nativeTheme</code> tiene las siguientes propiedades:</p>\n<h3 id=\"nativethemeshouldusedarkcolors-sololectura\"><a href=\"#nativethemeshouldusedarkcolors-sololectura\"><code>nativeTheme.shouldUseDarkColors</code> <em>SoloLectura</em></a></h3>\n<p>Un <code>Boolean</code> para si el OS / Chromium actualmente tiene un modo oscuro activado o está siendo instruido para mostrar una UI de estilo oscuro.  Si quieres modificar este valor debes utilizar <code>themeSource</code> acontinuación.</p>\n<h3 id=\"nativethemethemesource\"><a href=\"#nativethemethemesource\"><code>nativeTheme.themeSource</code></a></h3>\n<p>Una propiedad <code>String</code> que puede ser <code>system</code>, <code>light</code> o <code>dark</code>.  It is used to override and supersede the value that Chromium has chosen to use internally.</p>\n<p>Estableciendo esta propiedad a <code>system</code> eliminará la sobreescritura y todo será restablecido a los valores predeterminados del sistema operativo.  Por defecto <code>themeSource</code> es <code>system</code>.</p>\n<p>Estableciendo esta propiedad a <code>dark</code> tendrá los siguientes efectos:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code> será <code>true</code> cuando se accede</li>\n<li>Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the dark UI.</li>\n<li>Any UI the OS renders on macOS including menus, window frames, etc. will use the dark UI.</li>\n<li>La consulta CSS <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> coincidirá con el modo <code>dark</code>.</li>\n<li>El evento <code>updated</code> será emitido</li>\n</ul>\n<p>Estableciendo esta propiedad a <code>light</code> tendrá los siguientes efectos:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code> será <code>false</code> cuando se acceda</li>\n<li>Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the light UI.</li>\n<li>Any UI the OS renders on macOS including menus, window frames, etc. will use the light UI.</li>\n<li>La consulta CSS <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> coincidirá con el modo <code>light</code>.</li>\n<li>El evento <code>updated</code> será emitido</li>\n</ul>\n<p>El uso de esta propiedad debe alinearse con una máquina de estado clásica de \"modo oscuro\" en su aplicación, donde el usuario tiene tres opciones.</p>\n<ul>\n<li><code>Follow OS</code> --> <code>themeSource = 'system'</code></li>\n<li><code>Dark Mode</code> --> <code>themeSource = 'dark'</code></li>\n<li><code>Light Mode</code> --> <code>themeSource = 'light'</code></li>\n</ul>\n<p>Su aplicación debe usar siempre <code>shouldUseDarkColors</code> para determinar que CSS aplicar.</p>\n<h3 id=\"nativethemeshouldusehighcontrastcolors-macos-windows-sololectura\"><a href=\"#nativethemeshouldusehighcontrastcolors-macos-windows-sololectura\"><code>nativeTheme.shouldUseHighContrastColors</code> <em>macOS</em> <em>Windows</em> <em>SoloLectura</em></a></h3>\n<p>A <code>Boolean</code> for if the OS / Chromium currently has high-contrast mode enabled or is being instructed to show a high-contrast UI.</p>\n<h3 id=\"nativethemeshoulduseinvertedcolorscheme-macos-windows-sololectura\"><a href=\"#nativethemeshoulduseinvertedcolorscheme-macos-windows-sololectura\"><code>nativeTheme.shouldUseInvertedColorScheme</code> <em>macOS</em> <em>Windows</em> <em>SoloLectura</em></a></h3>\n<p>A <code>Boolean</code> for if the OS / Chromium currently has an inverted color scheme or is being instructed to use an inverted color scheme.</p>",
      "title": "nativeTheme",
      "description": "Lee y respondo a los cambios en el tema de color nativo de Chromium."
    },
    "/docs/api/net": {
      "locale": "es-ES",
      "slug": "net",
      "href": "/docs/api/net",
      "crowdinFileId": "256347",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/net.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"net\"><a href=\"#net\">net</a></h1>\n<blockquote>\n<p>Emitir solicitudes HTTP/HTTPS usando la biblioteca de red nativa de Chromium</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p>El módulo <code>net</code> es un lado del cliente API para tratar pedidos HTTP(S). Si es similar a los módulos <a href=\"https://nodejs.org/api/http.html\">HTTP</a> y <a href=\"https://nodejs.org/api/https.html\">HTTPS</a> de Node.js pero usa la biblioteca de la red nativa de Chromium en vez de las aplicaciones Node.js, ofreciendo un mejor soporte a los proxies de la web. It also supports checking network status.</p>\n<p>La siguiente es una lista no completa de por qué debería considerar usar el módulo <code>net</code> en vez de los módulos nativos Node.js:</p>\n<ul>\n<li>Gestión automática del sistema de configuración de proxy, soporte del protocolo wpad y el paquete de archivos de configuración del proxy.</li>\n<li>Túnel automático para peticiones HTTPS.</li>\n<li>Soportar los proxies de autentificación usando basic, digest, NTLM, Kerberos, o negociar esquemas de autentificación.</li>\n<li>Soporta proxies para monitoreo de tráfico: Fiddler como proxies usados para el acceso, el control y el monitoreo.</li>\n</ul>\n<p>Los componentes API (incluyendo clases, métodos, propiedades y nombres de eventos) son similares a esos usados en Node.js.</p>\n<p>Ejemplo de uso:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> { net } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n  <span class=\"hljs-keyword\">const</span> request = net.request(<span class=\"hljs-string\">'https://github.com'</span>)\n  request.on(<span class=\"hljs-string\">'response'</span>, (response) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`STATUS: <span class=\"hljs-subst\">${response.statusCode}</span>`</span>)\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`HEADERS: <span class=\"hljs-subst\">${<span class=\"hljs-built_in\">JSON</span>.stringify(response.headers)}</span>`</span>)\n    response.on(<span class=\"hljs-string\">'data'</span>, (chunk) => {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`BODY: <span class=\"hljs-subst\">${chunk}</span>`</span>)\n    })\n    response.on(<span class=\"hljs-string\">'end'</span>, () => {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'No more data in response.'</span>)\n    })\n  })\n  request.end()\n})\n</code></pre>\n<p>La API <code>net</code> puede ser utilizada solo después que la aplicación emita el evento <code>ready</code>. Intentar usar el módulo antes del evento <code>ready</code> lanzará un error.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>net</code> tiene los siguientes métodos:</p>\n<h3 id=\"netrequestoptions\"><a href=\"#netrequestoptions\"><code>net.request(options)</code></a></h3>\n<ul>\n<li><code>options</code> (ClientRequestConstructorOptions | String) - Las opciones del constructor de <code>ClientRequest</code>.</li>\n</ul>\n<p>Devuelve <a href=\"/docs/api/client-request\"><code>ClientRequest</code></a></p>\n<p>Crea una instancia <a href=\"/docs/api/client-request\"><code>ClientRequest</code></a> usando la <code>options</code> proveída la cual son directamente reenviadas al constructor <code>ClientRequest</code>. El método <code>net.request</code> será usado para emitir solicitudes HTTP tanto seguras como inseguras dependiendo de lo especificado en el esquema de protocolo en el objeto <code>options</code>.</p>\n<h3 id=\"netisonline\"><a href=\"#netisonline\"><code>net.isOnline()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether there is currently internet connection.</p>\n<p>A return value of <code>false</code> is a pretty strong indicator that the user won't be able to connect to remote sites. However, a return value of <code>true</code> is inconclusive; even if some link is up, it is uncertain whether a particular connection attempt to a particular remote site will be successful.</p>\n<h2 id=\"propiedades\"><a href=\"#propiedades\">Propiedades</a></h2>\n<h3 id=\"netonline-sololectura\"><a href=\"#netonline-sololectura\"><code>net.online</code> <em>SoloLectura</em></a></h3>\n<p>Una propiedad <code>Boolean</code>. Whether there is currently internet connection.</p>\n<p>A return value of <code>false</code> is a pretty strong indicator that the user won't be able to connect to remote sites. However, a return value of <code>true</code> is inconclusive; even if some link is up, it is uncertain whether a particular connection attempt to a particular remote site will be successful.</p>",
      "title": "net",
      "description": "Emitir solicitudes HTTP/HTTPS usando la biblioteca de red nativa de Chromium"
    },
    "/docs/api/net-log": {
      "locale": "es-ES",
      "slug": "net-log",
      "href": "/docs/api/net-log",
      "crowdinFileId": "256345",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/net-log.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"netlog\"><a href=\"#netlog\">netLog</a></h1>\n<blockquote>\n<p>Registrar eventos de red para una sesión.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { netLog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> netLog.startLogging(<span class=\"hljs-string\">'/path/to/net-log'</span>)\n  <span class=\"hljs-comment\">// After some network events</span>\n  <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> netLog.stopLogging()\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Net-logs written to'</span>, path)\n})\n</code></pre>\n<p>Vea <a href=\"/docs/api/command-line-switches#--log-net-logpath\"><code>--log-net-log</code></a> para registrar eventos a lo largo del ciclo de vida de la aplicación.</p>\n<p><strong>Nota:</strong> Todos los métodos salvo los especificados pueden ser usados solo después de que el evento <code>listo</code> del módulo de la <code>aplicación</code> sea emitido.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<h3 id=\"netlogstartloggingpath-options\"><a href=\"#netlogstartloggingpath-options\"><code>netLog.startLogging(path[, options])</code></a></h3>\n<ul>\n<li><code>path</code> String - Ruta de archivo para guardar los registros de red.</li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>captureMode</code> String (opcional) - Que tipos de datos deberían ser capturados. Por defecto, solo metadatos sobre las solicitudes serán capturados. Estableciendo esto a <code>includeSensitive</code> incluirá cookies y datos de autenticación. Estableciéndolo a <code>everything</code> incluirá todos los bytes transferidos en los sockets. Puede ser <code>default</code>, <code>includeSensitive</code> o <code>everything</code>.</li>\n<li><code>maxFileSize</code> Number (opcional) - Cunado el registro crece más allá de este tamaño el registro se detendrá automáticamente. Por defecto ilimitado.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code> - se resuelve cuando el net log ha comenzado a grabar.</p>\n<p>Comienza la agravación de eventos de red en <code>path</code>.</p>\n<h3 id=\"netlogstoplogging\"><a href=\"#netlogstoplogging\"><code>netLog.stopLogging()</code></a></h3>\n<p>Devuelve <code>Promise&#x3C;void></code> - se resuelve cuando el net log se ha descargado en el disco.</p>\n<p>Parar la grabación de eventos de red. Si no se llama, el registro de red automáticamente terminara cuando la aplicación se cierre.</p>\n<h2 id=\"propiedades\"><a href=\"#propiedades\">Propiedades</a></h2>\n<h3 id=\"netlogcurrentlylogging-sololectura\"><a href=\"#netlogcurrentlylogging-sololectura\"><code>netLog.currentlyLogging</code> <em>SoloLectura</em></a></h3>\n<p>Una propiedad <code>Boolean</code> que indica si los registros de red están siendo grabados actualmente.</p>",
      "title": "netLog",
      "description": "Registrar eventos de red para una sesión."
    },
    "/docs/api/structures/new-window-web-contents-event": {
      "locale": "es-ES",
      "slug": "new-window-web-contents-event",
      "href": "/docs/api/structures/new-window-web-contents-event",
      "crowdinFileId": "256469",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/new-window-web-contents-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"newwindowwebcontentsevent-object-extends-event\"><a href=\"#newwindowwebcontentsevent-object-extends-event\">NewWindowWebContentsEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>newGuest</code> BrowserWindow (optional)</li>\n</ul>",
      "title": "NewWindowWebContentsEvent Object extends Event",
      "description": ""
    },
    "/docs/api/notification": {
      "locale": "es-ES",
      "slug": "notification",
      "href": "/docs/api/notification",
      "crowdinFileId": "256349",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/notification.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"notification\"><a href=\"#notification\">Notification</a></h1>\n<blockquote>\n<p>Crea las notificaciones de escritorio del sistema operativo</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<h2 id=\"utilizando-el-proceso-de-renderizado\"><a href=\"#utilizando-el-proceso-de-renderizado\">Utilizando el proceso de renderizado</a></h2>\n<p>Si quieres mostrar notificaciones desde un proceso de renderizado se debe utilizar <a href=\"/docs/tutorial/notifications\">HTML5 Notification API</a></p>\n<h2 id=\"clase-notification\"><a href=\"#clase-notification\">Clase: Notification</a></h2>\n<blockquote>\n<p>Crea las notificaciones de escritorio del sistema operativo</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p><code>Notification</code> es un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p>Crea una nueva <code>Notification</code> con propiedades nativas como las configuradas por <code>options</code>.</p>\n<h3 id=\"métodos-estáticos\"><a href=\"#métodos-estáticos\">Métodos Estáticos</a></h3>\n<p>La clase <code>Notification</code> tiene los siguientes métodos estáticos:</p>\n<h4 id=\"notificationissupported\"><a href=\"#notificationissupported\"><code>Notification.isSupported()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si las notificaciones de escritorio son soportadas o no en el sistema actual</p>\n<h3 id=\"new-notificationoptions\"><a href=\"#new-notificationoptions\"><code>new Notification([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>title</code> String (opcional) - Un título para la notificación, el cual será mostrado en la parte superior de la ventana de notificación cuando sea mostrado.</li>\n<li><code>subtitle</code> String (opcional) <em>macOS</em> - Un subtítulo para la notificación, la cual aparecerá debajo del título.</li>\n<li><code>body</code> String (opcional) - El texto del cuerpo de la notificación, el cual será mostrado debajo del título o del subtítulo.</li>\n<li><code>silent</code> Boolean (opcional) - Si se emite o no un sonido de notificación del sistema operativo cuando aparece la notificación.</li>\n<li><code>icon</code> (String | <a href=\"/docs/api/native-image\">NativeImage</a>) (opcional) - Icono para usar en la notificación.</li>\n<li><code>hasReply</code> Boolean (opcional) <em>macOS</em> - Si se agrega o no una opción de respuesta insertada en la notificación.</li>\n<li><code>timeoutType</code> String (opcional) <em>Linux</em> <em>Windows</em> - La duración del tiempo de espera de la notificación. Puede ser 'default' o 'never'.</li>\n<li><code>replyPlaceholder</code> String (opcional) <em>macOS</em> - El marcador de posición para escribir en el campo insertado de entrada de respuesta.</li>\n<li><code>sound</code> String (opcional) <em>macOS</em> - El nombre del archivo de sonido que se reproduce cuando se muestra la notificación.</li>\n<li><code>urgency</code> String (opcional) <em>Linux</em> - El nivel de urgencia de la notificación. Puede ser 'normal', 'critical', o 'low'.</li>\n<li><code>actions</code> <a href=\"/docs/api/structures/notification-action\">NotificationAction[]</a> (opcional) <em>macOS</em> - Las acciones que se añaden a la notificación. Por favor lea las acciones disponibles y limitaciones en la documentación de <code>NotificationAction</code>.</li>\n<li><code>closeButtonText</code> String (opcional) <em>macOS</em> - Un título personalizado para el botón cerrar de una alerta. Una cadena vacía hará que se utilice el texto localizado predeterminado.</li>\n<li><code>toastXml</code> String (opcional) <em>Windows</em> - Una descripción personalizada de la notificación en Windows sustituyendo todas las propiedades anteriores. Ofrece una personalización completa del diseño y el comportamiento de la notificación.</li>\n</ul></li>\n</ul>\n<h3 id=\"eventos-de-instancia\"><a href=\"#eventos-de-instancia\">Eventos de Instancia</a></h3>\n<p>Los objetos creados con <code>new Notification</code> emite los siguientes eventos:</p>\n<p><strong>Nota:</strong> Algunos eventos sólo están disponibles en sistemas operativos específicos y se etiquetan como tal.</p>\n<h4 id=\"evento-show\"><a href=\"#evento-show\">Evento: \"show\"</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n</ul>\n<p>Se emite cuando la notificación se muestra al usuario. Tenga en cuenta que este puede emitirse tantas veces como se muestre la notificación a través del método <code>show()</code>.</p>\n<h4 id=\"evento-click\"><a href=\"#evento-click\">Evento: \"click\"</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n</ul>\n<p>Se emite cuando el usuario hace clic en la notificación.</p>\n<h4 id=\"evento-close\"><a href=\"#evento-close\">Evento: \"close\"</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n</ul>\n<p>Se emite cuando se cierra la notificación por medio de la intervención manual del usuario.</p>\n<p>No se garantiza que este evento se emita en todos los casos donde se cierre la notificación.</p>\n<h4 id=\"evento-reply-macos\"><a href=\"#evento-reply-macos\">Evento: \"reply\" <em>macOS</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>reply</code> String - La cadena que ingreso el usuario dentro del campo de respuesta insertado.</li>\n</ul>\n<p>Se emite cuando el usuario hace clic en el botón \"Reply\" en una notificación con <code>hasReply: true</code>.</p>\n<h4 id=\"evento-action-macos\"><a href=\"#evento-action-macos\">Evento: \"action\" <em>macOS</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>index</code> Númerp - El indice de la acción que fue activado.</li>\n</ul>\n<h4 id=\"evento-failed-windows\"><a href=\"#evento-failed-windows\">Evento: 'failed' <em>Windows</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>error</code> String - El error encontrado durante la ejecución del método <code>show()</code>.</li>\n</ul>\n<p>Se emite cuando un error ocurre mientras se esta creando y mostrando una notificación nativa.</p>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<p>Los objetos creados con <code>new Notification</code> tienen los siguientes métodos de instancia:</p>\n<h4 id=\"notificationshow\"><a href=\"#notificationshow\"><code>notification.show()</code></a></h4>\n<p>Muestra inmediatamente la notificación al usuario, por favor tenga en cuenta, esto quiere decir que a diferencia de la implementación de notificación de HTML5, iniciando una <code>new Notificación</code> no se mostrará inmediatamente al usuario, usted necesita llamar este método antes que el sistema operativo lo muestre.</p>\n<p>Si la notificación ha sido mostrada con anterioridad, este método descartará la notificación previa y creará una nueva con propiedades idénticas.</p>\n<h4 id=\"notificationclose\"><a href=\"#notificationclose\"><code>notification.close()</code></a></h4>\n<p>Descarta la notificación.</p>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<h4 id=\"notificationtitle\"><a href=\"#notificationtitle\"><code>notification.title</code></a></h4>\n<p>Una propiedad <code>String</code> que representa el título de la notificación.</p>\n<h4 id=\"notificationsubtitle\"><a href=\"#notificationsubtitle\"><code>notification.subtitle</code></a></h4>\n<p>Una propiedad <code>String</code> que representa el subtítulo de la notificación.</p>\n<h4 id=\"notificationbody\"><a href=\"#notificationbody\"><code>notification.body</code></a></h4>\n<p>Una propiedad <code>String</code> que representa el cuerpo de la notificación.</p>\n<h4 id=\"notificationreplyplaceholder\"><a href=\"#notificationreplyplaceholder\"><code>notification.replyPlaceholder</code></a></h4>\n<p>Una propiedad <code>String</code> que representa el marcador de respuesta de la notificación.</p>\n<h4 id=\"notificationsound\"><a href=\"#notificationsound\"><code>notification.sound</code></a></h4>\n<p>Una propiedad <code>String</code> que representa el sonido de la notificación.</p>\n<h4 id=\"notificationclosebuttontext\"><a href=\"#notificationclosebuttontext\"><code>notification.closeButtonText</code></a></h4>\n<p>Una propiedad <code>String</code> que representa el texto del botón cerrar en la notificación.</p>\n<h4 id=\"notificationsilent\"><a href=\"#notificationsilent\"><code>notification.silent</code></a></h4>\n<p>Una propiedad <code>Boolean</code> que representa si la notificación es silenciosa.</p>\n<h4 id=\"notificationhasreply\"><a href=\"#notificationhasreply\"><code>notification.hasReply</code></a></h4>\n<p>Una propiedad <code>Boolean</code> que representa si al notificación tiene a una acción de respuesta.</p>\n<h4 id=\"notificationurgency-linux\"><a href=\"#notificationurgency-linux\"><code>notification.urgency</code> <em>Linux</em></a></h4>\n<p>Un propiedad <code>String</code> que representa el nivel de prioridad de la notificación. Puede ser 'normal', 'critical', o 'low'.</p>\n<p>Por defecto es 'low' - vea <a href=\"https://developer.gnome.org/notification-spec/#urgency-levels\">NotifyUrgency</a> para más información.</p>\n<h4 id=\"notificationtimeouttype-linux-windows\"><a href=\"#notificationtimeouttype-linux-windows\"><code>notification.timeoutType</code> <em>Linux</em> <em>Windows</em></a></h4>\n<p>Una propiedad <code>String</code> que representa el tipo de tiempo de espera para la notificación. Puede ser 'default' o 'never'.</p>\n<p>Si <code>timeoutType</code> es especificado como 'never', la notificación nunca expirará. Se queda abierta hasta que se cierra por el llamado de la API o del usuario.</p>\n<h4 id=\"notificationactions\"><a href=\"#notificationactions\"><code>notification.actions</code></a></h4>\n<p>Una propiedad <a href=\"/docs/api/structures/notification-action\"><code>NotificationAction[]</code></a> que representa las acciones de la notificación.</p>\n<h4 id=\"notificationtoastxml-windows\"><a href=\"#notificationtoastxml-windows\"><code>notification.toastXml</code> <em>Windows</em></a></h4>\n<p>Una propiedad <code>String</code> que representa el Toast XML de la notificación.</p>\n<h3 id=\"reproducción-de-sonidos\"><a href=\"#reproducción-de-sonidos\">Reproducción de Sonidos</a></h3>\n<p>En macOS, se puede especificar el nombre del sonido que se desee reproducir cuando se muestre la notificación. Cualquier sonido por defecto (en Preferencias del sistema > Sonido) pueden ser usados en adición a los sonidos personalizados del sistema. Asegúrese de que el archivo de sonido sea copiado en el paquete de la aplicación (por ejemplo, <code>YourApp.app/Contents/Resources</code>), o uno de los siguientes direcciones:</p>\n<ul>\n<li><code>~/Library/Sounds</code></li>\n<li><code>/Library/Sounds</code></li>\n<li><code>/Network/Library/Sounds</code></li>\n<li><code>/System/Library/Sounds</code></li>\n</ul>\n<p>Ver la documentación <a href=\"https://developer.apple.com/documentation/appkit/nssound\"><code>NSSound</code></a> para más información.</p>",
      "title": "Notification",
      "description": "Crea las notificaciones de escritorio del sistema operativo"
    },
    "/docs/api/structures/notification-action": {
      "locale": "es-ES",
      "slug": "notification-action",
      "href": "/docs/api/structures/notification-action",
      "crowdinFileId": "256471",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/notification-action.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificationaction-object\"><a href=\"#notificationaction-object\">NotificationAction Object</a></h1>\n<ul>\n<li><code>type</code> String - The type of action, can be <code>button</code>.</li>\n<li><code>text</code> String (optional) - The label for the given action.</li>\n</ul>\n<h2 id=\"platform--action-support\"><a href=\"#platform--action-support\">Platform / Action Support</a></h2>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Action Type</th><th>Platform Support</th><th>Usage of <code>text</code></th><th>Default <code>text</code></th><th>Limitations</th></tr></thead><tbody><tr><td><code>button</code></td><td>macOS</td><td>Used as the label for the button</td><td>\"Show\" (or a localized string by system default if first of such <code>button</code>, otherwise empty)</td><td>Only the first one is used. If multiple are provided, those beyond the first will be listed as additional actions (displayed when mouse active over the action button). Any such action also is incompatible with <code>hasReply</code> and will be ignored if <code>hasReply</code> is <code>true</code>.</td></tr></tbody></table>\n<h3 id=\"button-support-on-macos\"><a href=\"#button-support-on-macos\">Button support on macOS</a></h3>\n<p>In order for extra notification buttons to work on macOS your app must meet the following criteria.</p>\n<ul>\n<li>App is signed</li>\n<li>App has it's <code>NSUserNotificationAlertStyle</code> set to <code>alert</code> in the <code>Info.plist</code>.</li>\n</ul>\n<p>If either of these requirements are not met the button won't appear.</p>",
      "title": "NotificationAction Object",
      "description": ""
    },
    "/docs/api/structures/notification-response": {
      "locale": "es-ES",
      "slug": "notification-response",
      "href": "/docs/api/structures/notification-response",
      "crowdinFileId": "256473",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/notification-response.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificationresponse-object\"><a href=\"#notificationresponse-object\">NotificationResponse Object</a></h1>\n<ul>\n<li><code>actionIdentifier</code> String - The identifier string of the action that the user selected.</li>\n<li><code>date</code> Number - The delivery date of the notification.</li>\n<li><code>identifier</code> String - The unique identifier for this notification request.</li>\n<li><code>userInfo</code> Record&#x3C;String, any> - A dictionary of custom information associated with the notification.</li>\n<li><code>userText</code> String (optional) - The text entered or chosen by the user.</li>\n</ul>",
      "title": "NotificationResponse Object",
      "description": ""
    },
    "/docs/tutorial/notifications": {
      "locale": "es-ES",
      "slug": "notifications",
      "href": "/docs/tutorial/notifications",
      "crowdinFileId": "256225",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/notifications.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificaciones\"><a href=\"#notificaciones\">Notificaciones</a></h1>\n<h2 id=\"descripción-general\"><a href=\"#descripción-general\">Descripción general</a></h2>\n<p>All three operating systems provide means for applications to send notifications to the user. The technique of showing notifications is different for the Main and Renderer processes.</p>\n<p>For the Renderer process, Electron conveniently allows developers to send notifications with the <a href=\"https://notifications.spec.whatwg.org/\">HTML5 Notification API</a>, using the currently running operating system's native notification APIs to display it.</p>\n<p>To show notifications in the Main process, you need to use the <a href=\"/docs/api/notification\">Notification</a> module.</p>\n<h2 id=\"ejemplo\"><a href=\"#ejemplo\">Ejemplo</a></h2>\n<h3 id=\"show-notifications-in-the-renderer-process\"><a href=\"#show-notifications-in-the-renderer-process\">Show notifications in the Renderer process</a></h3>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, add the following line to the <code>index.html</code> file before the closing <code>&#x3C;/body></code> tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<p>...y agregar el archivo <code>renderer.js</code>:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/notifications/renderer\"><span class=\"hljs-keyword\">const</span> NOTIFICATION_TITLE = <span class=\"hljs-string\">'Título'</span>\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_BODY = <span class=\"hljs-string\">'Notificación del proceso de renderizado. Haga clic para registrar en consola.'</span>\n<span class=\"hljs-keyword\">const</span> CLICK_MESSAGE = <span class=\"hljs-string\">'Notification cliced'</span>\n\n<span class=\"hljs-keyword\">new</span> Notification(NOTIFICATION_TITLE, { <span class=\"hljs-attr\">body</span>: NOTIFICATION_BODY })\n  .onclick = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-built_in\">console</span>.log(CLICK_MESSAGE)\n</code></pre>\n<p>After launching the Electron application, you should see the notification:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/notification-renderer.png\" alt=\"Notification in the Renderer process\"></p>\n<p>Additionally, if you click on the notification, the DOM will update to show \"Notification clicked!\".</p>\n<h3 id=\"show-notifications-in-the-main-process\"><a href=\"#show-notifications-in-the-main-process\">Show notifications in the Main process</a></h3>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/notifications/main\"><span class=\"hljs-keyword\">const</span> { Notification } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_TITLE = <span class=\"hljs-string\">'Basic Notification'</span>\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_BODY = <span class=\"hljs-string\">'Notification from the Main process'</span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">showNotification</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">new</span> Notification({ <span class=\"hljs-attr\">title</span>: NOTIFICATION_TITLE, <span class=\"hljs-attr\">body</span>: NOTIFICATION_BODY }).show()\n}\n\napp.whenReady().then(createWindow).then(showNotification)\n</code></pre>\n<p>After launching the Electron application, you should see the system notification:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/notification-main.png\" alt=\"Notification in the Main process\"></p>\n<h2 id=\"información-adiocional\"><a href=\"#información-adiocional\">Información adiocional</a></h2>\n<p>Si bien el código y la experiencia del usuario en los sistemas operativos son similares, existen diferencias sutiles.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<ul>\n<li>En Windows 10, se debe instalar un acceso directo a tu app en el menú de inicio con la <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">ID del modelo de usuario de la aplicación</a>. This can be overkill during development, so adding <code>node_modules\\electron\\dist\\electron.exe</code> to your Start Menu also does the trick. Navigate to the file in Explorer, right-click and 'Pin to Start Menu'. You will then need to add the line <code>app.setAppUserModelId(process.execPath)</code> to your main process to see notifications.</li>\n<li>En Windows 8.1 y Windows 8, un acceso directo para tu aplicación con un <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> debe ser instalado en el Start screen. Sin embargo, tenga en cuenta que no es necesario fijarlo a la pantalla de Inicio.</li>\n<li>En Windows 7, las notificaciones funcionan a través de una implementación personalizada que se asemeja visualmente a la nativa en los sistemas más nuevos.</li>\n</ul>\n<p>Electron intenta automatizar el trabajo en torno de la Application User Model ID. Cuando Electron es usado junto con el framework de instalación y actualización Squirrel <a href=\"https://github.com/electron/windows-installer/blob/master/README.md#handling-squirrel-events\">shortcuts will automatically be set correctly</a>. Además, Electron detectará que Squirrel fue usada y automáticamente llamará a <code>app.setAppUserModelId()</code> con el valor correcto. Durante el desarrollo, puede tener que llamar por ti mismo a <a href=\"/docs/api/app#appsetappusermodelidid-windows\"><code>app.setAppUserModelId()</code></a>.</p>\n<p>Además, en Windows 8, la longitud máxima para el cuerpo de la notificación es de 250 caracteres, y el equipo de Windows recomienda que las notificaciones se mantengan en 200 caracteres. Dicho eso, esa limitación se eliminó en Windows 10, y el equipo de Windows les pidió a los desarrolladores que fuesen razonables. Intentar enviar cantidades gigantescas de texto a la API (miles de caracteres) puede provocar inestabilidad.</p>\n<h4 id=\"notificaciones-avanzadas\"><a href=\"#notificaciones-avanzadas\">Notificaciones Avanzadas</a></h4>\n<p>Las versiones posteriores de Windows permiten notificaciones avanzadas, con plantillas personalizadas, imágenes y otros elementos flexibles. Para enviar esas notificaciones (ya sea desde el proceso principal o desde el procesador), use el módulo de usuario <a href=\"https://github.com/felixrieseberg/electron-windows-notifications\">electron-windows-notificaciones</a>, que usa complementos de nodo nativos para enviar <code>ToastNotification</code> y objetos <code>TileNotification</code>.</p>\n<p>While notifications including buttons work with <code>electron-windows-notifications</code>, handling replies requires the use of <a href=\"https://github.com/felixrieseberg/electron-windows-interactive-notifications\"><code>electron-windows-interactive-notifications</code></a>, which helps with registering the required COM components and calling your Electron app with the entered user data.</p>\n<h4 id=\"horas-silenciosas--modo-de-presentación\"><a href=\"#horas-silenciosas--modo-de-presentación\">Horas Silenciosas / Modo de Presentación</a></h4>\n<p>To detect whether or not you're allowed to send a notification, use the userland module <a href=\"https://github.com/felixrieseberg/electron-notification-state\">electron-notification-state</a>.</p>\n<p>This allows you to determine ahead of time whether or not Windows will silently throw the notification away.</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>Las notificaciones son directas en macOS, pero usted debe ser conciente de <a href=\"https://developer.apple.com/macos/human-interface-guidelines/system-capabilities/notifications/\">Apple's Human Interface guidelines regarding notifications</a>.</p>\n<p>Tenga en cuenta que las notificaciones están limitadas a 256 bytes de tamaño y se truncarán si supera ese límite.</p>\n<h4 id=\"no-molestar--estado-de-sesión\"><a href=\"#no-molestar--estado-de-sesión\">No molestar / Estado de Sesión</a></h4>\n<p>Para detectar si se le permite o no enviar una notificación, use el módulo de usuario <a href=\"https://github.com/felixrieseberg/electron-notification-state\">electron-notification-state</a>.</p>\n<p>Esto le permitirá detectar con anticipación si la notificación se mostrará o no.</p>\n<h3 id=\"linux\"><a href=\"#linux\">Linux</a></h3>\n<p>Las notificaciones se envían utilizando <code>libnotify</code> que puede mostrar notificaciones en cualquier entorno de escritorio que siga la <a href=\"https://developer.gnome.org/notification-spec/\">Especificación de Notificaciones de Escritorio</a>, incluidos Cinnamon, Enlightenment, Unity, GNOME, KDE.</p>",
      "title": "Notificaciones",
      "description": ""
    },
    "/docs/tutorial/offscreen-rendering": {
      "locale": "es-ES",
      "slug": "offscreen-rendering",
      "href": "/docs/tutorial/offscreen-rendering",
      "crowdinFileId": "256227",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/offscreen-rendering.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"representación-fuera-de-la-pantalla\"><a href=\"#representación-fuera-de-la-pantalla\">Representación fuera de la pantalla</a></h1>\n<h2 id=\"descripción-general\"><a href=\"#descripción-general\">Descripción general</a></h2>\n<p>Offscreen rendering te permite obtener el contenido de un <code>BrowserWindow</code> en un bitmap, así puede renderizarlo en cualquier lugar, por ejemplo, en una textura de una escena 3D. El offscreen rendering en Electron utiliza un enfoque similar al del proyecto <a href=\"https://bitbucket.org/chromiumembedded/cef\">Chromium Embedded Framework</a>.</p>\n<p><em>Notas</em>:</p>\n<ul>\n<li>Hay dos modos de rendering que puede ser usados (vea la sección de abajo) y solo la área sucia se pasa al evento <code>paint</code> para ser más eficiente.</li>\n<li>Usted puede parar/continuar el renderizado así como también ajustar la velocidad de frame.</li>\n<li>La tasa máxima de fotograma es 240 porque valores mayores solo traen pérdidas de rendimiento sin beneficios.</li>\n<li>Cuando nada esta sucediendo en un pagina web, no se generan frames.</li>\n<li>Un offscreen window siempre es creado como <a href=\"/docs/api/frameless-window\">Frameless Window</a>.</li>\n</ul>\n<h3 id=\"modos-de-renderizado\"><a href=\"#modos-de-renderizado\">Modos de renderizado</a></h3>\n<h4 id=\"gpu-acelerado\"><a href=\"#gpu-acelerado\">GPU acelerado</a></h4>\n<p>La renderización acelerada por GPU significa que la GPU se usa para la composición. Por eso, el frame ha de ser copiado desde la GPU lo cual requiere mas recursos, por lo tanto este modo es mas lento que el dispositivo de salida de Software. The benefit of this mode is that WebGL and 3D CSS animations are supported.</p>\n<h4 id=\"dispositivo-de-salida-de-software\"><a href=\"#dispositivo-de-salida-de-software\">Dispositivo de salida de software</a></h4>\n<p>Este modo usa un dispositivo de salida por Software para renderizar en la CPU, asi que la generación del frame es mucho más rápida. Como resultado, este modo es preferido sobre el GPU acelerado.</p>\n<p>Para habilitar este modo, la aceleración de la GPU ha de ser deshabilitada llamando a la API <a href=\"/docs/api/app#appdisablehardwareacceleration\"><code>app.disableHardwareAcceleration()</code></a>.</p>\n<h2 id=\"ejemplo\"><a href=\"#ejemplo\">Ejemplo</a></h2>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/offscreen-rendering\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\napp.disableHardwareAcceleration()\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">offscreen</span>: <span class=\"hljs-literal\">true</span> } })\n\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  win.webContents.on(<span class=\"hljs-string\">'paint'</span>, (event, dirty, image) => {\n    fs.writeFileSync(<span class=\"hljs-string\">'ex.png'</span>, image.toPNG())\n  })\n  win.webContents.setFrameRate(<span class=\"hljs-number\">60</span>)\n})\n</code></pre>\n<p>After launching the Electron application, navigate to your application's working folder, where you'll find the rendered image.</p>",
      "title": "Representación fuera de la pantalla",
      "description": ""
    },
    "/docs/tutorial/online-offline-events": {
      "locale": "es-ES",
      "slug": "online-offline-events",
      "href": "/docs/tutorial/online-offline-events",
      "crowdinFileId": "256229",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/online-offline-events.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"tarjeta-de-crédito\"><a href=\"#tarjeta-de-crédito\">Tarjeta de crédito</a></h1>\n<h2 id=\"descripción-general\"><a href=\"#descripción-general\">Descripción general</a></h2>\n<p>La detección de <a href=\"https://developer.mozilla.org/en-US/docs/Online_and_offline_events\">Evento en línea y fuera de líena </a> puede ser implementado en el Renderer process usando el atributo <a href=\"http://html5index.org/Offline%20-%20NavigatorOnLine.html\"><code>navigator.onLine</code></a>, parte de la API HTML5 estándar.</p>\n<p>El atributo <code>navigator.onLine</code> devuelve:</p>\n<ul>\n<li><code>false</code> si todas la solicitudes de red están garantizada para fallar (p.ej. cuando se desconecta de la red).</li>\n<li><code>true</code> en todo los otros casos.</li>\n</ul>\n<p>Since many cases return <code>true</code>, you should treat with care situations of getting false positives, as we cannot always assume that <code>true</code> value means that Electron can access the Internet. Por ejemplo, en casos cuando la computadora esta corriendo un programa de virtualización que tiene un adaptador Ethernet virtual en estado \"siempre conectado\". Por lo tanto, si quieres determinar el estado de la conexión a Internet de Electron, deberías desarrollar una manera adicional para comprobar esto.</p>\n<h2 id=\"ejemplo\"><a href=\"#ejemplo\">Ejemplo</a></h2>\n<p>Starting with an HTML file <code>index.html</code>, this example will demonstrate how the <code>navigator.onLine</code> API can be used to build a connection status indicator.</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"script-src 'self' 'unsafe-inline';\"</span> /></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Connection status: <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">strong</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">'status'</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">strong</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>In order to mutate the DOM, create a <code>renderer.js</code> file that adds event listeners to the <code>'online'</code> and <code>'offline'</code> <code>window</code> events. The event handler sets the content of the <code>&#x3C;strong id='status'></code> element depending on the result of <code>navigator.onLine</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">updateOnlineStatus</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'status'</span>).innerHTML = navigator.onLine ? <span class=\"hljs-string\">'online'</span> : <span class=\"hljs-string\">'offline'</span>\n}\n\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'online'</span>, updateOnlineStatus)\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'offline'</span>, updateOnlineStatus)\n\nupdateOnlineStatus()\n</code></pre>\n<p>Finally, create a <code>main.js</code> file for main process that creates the window.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> onlineStatusWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">400</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">100</span>\n  })\n\n  onlineStatusWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n      createWindow()\n    }\n  })\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n</code></pre>\n<p>After launching the Electron application, you should see the notification:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/connection-status.png\" alt=\"Connection status\"></p>\n<blockquote>\n<p>Note: If you need to communicate the connection status to the main process, use the <a href=\"/docs/api/ipc-renderer\">IPC renderer</a> API.</p>\n</blockquote>",
      "title": "Tarjeta de crédito",
      "description": "Note: If you need to communicate the connection status to the main process, use the IPC renderer API."
    },
    "/docs/development/patches": {
      "locale": "es-ES",
      "slug": "patches",
      "href": "/docs/development/patches",
      "crowdinFileId": "256161",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/patches.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"parches-en-electron\"><a href=\"#parches-en-electron\">Parches en Electron</a></h1>\n<p>Electron está construido sobre dos grandes proyectos principales: Chromium y Node.js. Cada uno de estos proyectos tienen también varias de sus propias dependencias. Hacemos todo lo posible para utilizar estas dependencias exactamente como están, pero a veces no podemos lograr nuestros objetivos sin parchear esas dependencias en upstream para que se ajusten a nuestros casos de uso.</p>\n<h2 id=\"justificación-del-parche\"><a href=\"#justificación-del-parche\">Justificación del parche</a></h2>\n<p>Cada parche en Electron es una carga de mantenimiento. Cuando el código original cambia, los parches pueden romperse, a veces incluso sin conflicto de parches o error de compilación. Es un esfuerzo continuo para mantener nuestro parche actualizado y efectivo. Así que nos esforzamos por mantener el número de parches como mínimo. Para ello, cada parche debe describir su razón de existencia en su mensaje de commit. Esa razón debe ser unas de las siguientes:</p>\n<ol>\n<li>El parche es temporal, y está pensado para ser (o ha sido) confirmado a upstream o de lo contrario eventualmente eliminado. Incluye un enlace a un upstream PR o review de código si está disponible o a un procedimiento para verificar si el parche aún es necesario en una fecha posterior.</li>\n<li>El parche permite que el código se compile en el entorno Electron, pero no se puede confirmar en upstream porque es específico de Electron (p.ej. parchear las referencias al <code>Profile</code> Chrome). Incluye razonamiento sobre por qué el cambio no se puede implementar sin un parche (por ejemplo, subclasificar o copiar el código).</li>\n<li>El parche realiza cambios específicos de Electron en la funcionalidad que son fundamentalmente incompatibles con el upstream.</li>\n</ol>\n<p>In general, all the upstream projects we work with are friendly folks and are often happy to accept refactorings that allow the code in question to be compatible with both Electron and the upstream project. (See e.g. <a href=\"https://chromium-review.googlesource.com/c/chromium/src/+/1637040\">this</a> change in Chromium, which allowed us to remove a patch that did the same thing, or <a href=\"https://github.com/nodejs/node/pull/22110\">this</a> change in Node, which was a no-op for Node but fixed a bug in Electron.) <strong>Deberíamos enfocarnos en los cambios siempre que podamos y evitar los parches de duración indefinida</strong>.</p>\n<h2 id=\"sistema-de-parches\"><a href=\"#sistema-de-parches\">Sistema de parches</a></h2>\n<p>If you find yourself in the unfortunate position of having to make a change which can only be made through patching an upstream project, you'll need to know how to manage patches in Electron.</p>\n<p>Todos los parches a los proyectos upstream en Electron están contenidos en el directorio <code>patches/</code>. Cada subdirectorio de <code>patches/</code> contiene varios archivos de parche, junto con un archivo <code>.patches</code> el cual lista el orden en el cual los parches deberían ser aplicados. Think of these files as making up a series of git commits that are applied on top of the upstream project after we check it out.</p>\n<pre><code class=\"hljs language-plaintext\">patches\n├── config.json   &#x3C;-- this describes which patchset directory is applied to what project\n├── chromium\n│   ├── .patches\n│   ├── accelerator.patch\n│   ├── add_contentgpuclient_precreatemessageloop_callback.patch\n│   ⋮\n├── node\n│   ├── .patches\n│   ├── add_openssl_is_boringssl_guard_to_oaep_hash_check.patch\n│   ├── build_add_gn_build_files.patch\n│   ⋮\n⋮\n\n</code></pre>\n<p>Para ayudar a manejar estos conjuntos de parches, proporcionamos dos herramientas: <code>git-import-patches</code> y <code>git-export-patches</code>. <code>git-import-patches</code> importa un conjunto de archivos de parche en un repositorio git aplicando cada parche en el orden correcto y creando un commit para cada parche. <code>git-export-patches</code> hace el reverso; exporta una serie de commits git en un repositorio a un conjunto de ficheros en un directorio y un arvhivo <code>.patches</code> adjunto.</p>\n<blockquote>\n<p>Nota al margen: la razón por la que usamos un archivo <code>.patches</code> para mantener el orden de los parches aplicados, en lugar de anteponer un número como <code>001-</code> a cada archivo, es porque reduce los conflictos relacionados al orden de parches. It prevents the situation where two PRs both add a patch at the end of the series with the same numbering and end up both getting merged resulting in a duplicate identifier, and it also reduces churn when a patch is added or deleted in the middle of the series.</p>\n</blockquote>\n<h3 id=\"uso\"><a href=\"#uso\">Uso</a></h3>\n<h4 id=\"agregar-un-nuevo-parche\"><a href=\"#agregar-un-nuevo-parche\">Agregar un nuevo parche</a></h4>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n$ vim some/code/file.cc\n$ git commit\n$ ../../electron/script/git-export-patches -o ../../electron/patches/node\n</code></pre>\n<blockquote>\n<p><strong>NOTA</strong>: <code>git-export-patches</code> ignora cualquier archivo sin confirmar, así que debes crear un commit si quieres que tus cambios sean exportados. La línea de asunto del mensaje de confirmación se utilizará para derivar el nombre del archivo del parche, y el cuerpo del mensaje de confirmación debe incluir la razón de la existencia del parche.</p>\n</blockquote>\n<p>La reexportación de parches ocasionalmente causará que cambien los shasums en parches no relacionados. Esto es generalmente inofensivo y puede ser ignorado (pero sigue adelante y agrega esos cambios a tu PR, esto evitará que aparezcan para otras personas).</p>\n<h4 id=\"editar-un-parche-existente\"><a href=\"#editar-un-parche-existente\">Editar un parche existente</a></h4>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/v8\n$ vim some/code/file.cc\n$ git <span class=\"hljs-built_in\">log</span>\n<span class=\"hljs-comment\"># Find the commit sha of the patch you want to edit.</span>\n$ git commit --fixup [COMMIT_SHA]\n$ git rebase --autosquash -i [COMMIT_SHA]^\n$ ../electron/script/git-export-patches -o ../electron/patches/v8\n</code></pre>\n<h4 id=\"eliminar-un-parche\"><a href=\"#eliminar-un-parche\">Eliminar un parche</a></h4>\n<pre><code class=\"hljs language-bash\">$ vim src/electron/patches/node/.patches\n<span class=\"hljs-comment\"># Delete the line with the name of the patch you want to remove</span>\n$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n$ git reset --hard refs/patches/upstream-head\n$ ../../electron/script/git-import-patches ../../electron/patches/node\n$ ../../electron/script/git-export-patches -o ../../electron/patches/node\n</code></pre>\n<p>Tenga en cuenta que <code>git-import-patches</code> marcará el commit que fue <code>HEAD</code> cundo este haya corrido como <code>refs/patches/upstream-head</code>. Esto te permite hacer un seguimiento de que commits son parches de Electron (aquellos que vienen después de <code>refs/patches/upstream-head</code>) y cuales commits están en upstream (aquellos antes <code>refs/patches/upstream-head</code>).</p>\n<h4 id=\"resolviendo-conflictos\"><a href=\"#resolviendo-conflictos\">Resolviendo conflictos</a></h4>\n<p>Cuando se actualiza una dependencia upstream, es posible que los parches fallen al aplicar limpiamente. A menudo, el conflicto puede ser resolvido automáticamente mediante git con un fusión de tres vías. Puedes indicar a <code>git-import-patches</code> que use el algoritmo de fusión de 3 vías pasando el argumento <code>-3</code>:</p>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n<span class=\"hljs-comment\"># If the patch application failed midway through, you can reset it with:</span>\n$ git am --abort\n<span class=\"hljs-comment\"># And then retry with 3-way merge:</span>\n$ ../../electron/script/git-import-patches -3 ../../electron/patches/node\n</code></pre>\n<p>Si <code>git-import-patches -3</code> encuentra un merge conflict que no puede resolver automáticamente, se pausará y te permitirá resolver el conflicto manualmente. Una vez que has resuelto el conflicto,<code>git add</code> los archivos resueltos y continua aplicando el resto de los parches ejecutando <code>git am --continue</code>.</p>",
      "title": "Parches en Electron",
      "description": "Nota al margen: la razón por la que usamos un archivo .patches para mantener el orden de los parches aplicados, en lugar de anteponer un número como 001- a cada archivo, es porque reduce los conflictos relacionados al orden de parches. It prevents the situation where two PRs both add a patch at the end of the series with the same numbering and end up both getting merged resulting in a duplicate identifier, and it also reduces churn when a patch is added or deleted in the middle of the series."
    },
    "/docs/tutorial/performance": {
      "locale": "es-ES",
      "slug": "performance",
      "href": "/docs/tutorial/performance",
      "crowdinFileId": "256231",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/performance.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"rendimiento\"><a href=\"#rendimiento\">Rendimiento</a></h1>\n<p>Los desarrolladores preguntan frecuentemente sobre estrategias para optimizar el rendimiento de aplicaciones de Electron. Los ingenieros de software, los consumidores y los desarrolladores de framework no siempre están de acuerdo en una sola definición de lo que significa \"rendimiento\". Este documento describe algunas de las formas favoritas de los desarrolladores de Electron para reducir el uso de recursos de memoria, CPU y disco asegurando a su vez que tu app sea responsiva a las entradas del usuario y complete operaciones tan rápidamente como sea posible. De hecho, queremos que todas las estrategias para asegurar el rendimiento mantengan un alto estándar para la seguridad de tu aplicación.</p>\n<p>Wisdom and information about how to build performant websites with JavaScript generally applies to Electron apps, too. To a certain extent, resources discussing how to build performant Node.js applications also apply, but be careful to understand that the term \"performance\" means different things for a Node.js backend than it does for an application running on a client.</p>\n<p>This list is provided for your convenience – and is, much like our <a href=\"/docs/tutorial/security\">security checklist</a> – not meant to exhaustive. It is probably possible to build a slow Electron app that follows all the steps outlined below. Electron is a powerful development platform that enables you, the developer, to do more or less whatever you want. All that freedom means that performance is largely your responsibility.</p>\n<h2 id=\"medida-medida-medida\"><a href=\"#medida-medida-medida\">Medida, Medida, Medida</a></h2>\n<p>The list below contains a number of steps that are fairly straightforward and easy to implement. However, building the most performant version of your app will require you to go beyond a number of steps. Instead, you will have to closely examine all the code running in your app by carefully profiling and measuring. Where are the bottlenecks? When the user clicks a button, what operations take up the brunt of the time? While the app is simply idling, which objects take up the most memory?</p>\n<p>Time and time again, we have seen that the most successful strategy for building a performant Electron app is to profile the running code, find the most resource-hungry piece of it, and to optimize it. Repeating this seemingly laborious process over and over again will dramatically increase your app's performance. Experience from working with major apps like Visual Studio Code or Slack has shown that this practice is by far the most reliable strategy to improve performance.</p>\n<p>To learn more about how to profile your app's code, familiarize yourself with the Chrome Developer Tools. For advanced analysis looking at multiple processes at once, consider the <a href=\"https://www.chromium.org/developers/how-tos/trace-event-profiling-tool\">Chrome Tracing</a> tool.</p>\n<h3 id=\"recommended-reading\"><a href=\"#recommended-reading\">Recommended Reading</a></h3>\n<ul>\n<li><a href=\"https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/\">Get Started With Analyzing Runtime Performance</a></li>\n<li><a href=\"https://www.youtube.com/watch?v=r0OeHRUCCb4\">Talk: \"Visual Studio Code - The First Second\"</a></li>\n</ul>\n<h2 id=\"lista-de-verificación\"><a href=\"#lista-de-verificación\">Lista de verificación</a></h2>\n<p>Chances are that your app could be a little leaner, faster, and generally less resource-hungry if you attempt these steps.</p>\n<ol>\n<li><a href=\"#1-carelessly-including-modules\">Descuidada incluyendo módulos</a></li>\n<li><a href=\"#2-loading-and-running-code-too-soon\">Cargando y ejecutando código demasiado pronto</a></li>\n<li><a href=\"#3-blocking-the-main-process\">Bloqueo del proceso principal</a></li>\n<li><a href=\"#4-blocking-the-renderer-process\">Bloqueo del proceso renderer</a></li>\n<li><a href=\"#5-unnecessary-polyfills\">Polifiltros innecesarios</a></li>\n<li><a href=\"#6-unnecessary-or-blocking-network-requests\">Solicitudes de red innecesarias o de bloqueo</a></li>\n<li><a href=\"#7-bundle-your-code\">Empaquete su código</a></li>\n</ol>\n<h2 id=\"1-carelessly-including-modules\"><a href=\"#1-carelessly-including-modules\">1) Carelessly including modules</a></h2>\n<p>Antes de agregar un módulo Node.js a su aplicación, examine dicho módulo. ¿Cuántas dependencias ese módulo incluye? ¿Qué tipo de recursos necesita para simplemente ejecutar la sentencia <code>require()</code>? Podría encontrar que el módulo con más descargas en el registro de paquetes NPM o la mayoría de estrellas en GitHub no es de hecho el más simple o el más pequeño disponible.</p>\n<h3 id=\"¿por-què\"><a href=\"#¿por-què\">¿Por què?</a></h3>\n<p>El razonamiento detrás de esta recomendación es mejor ilustrado con un ejemplo de mundo real. Durante los primeros días del Electron, la detección fiable de la conectividad de la red fue un problema, resultando en que muchas aplicaciones usaran un módulo que expone un simple método <code>isOnline()</code>.</p>\n<p>Ese módulo detectaba la conectividad de su red al intentar comunicarse con un número de endpoints conocidos. Para la lista de esos endpoints, dependía de un módulo diferente, que también contenía un lista conocida de puertos. Esta dependencia se basaba en un módulo que contenía información sobre los puertos, que venía en forma de un archivo JSON con más de 100.000 líneas de contenido. Siempre que el modulo era cargado (usualmente en una sentencia <code>require('module')</code>) este debía cargar todas sus dependencias y eventualmente parsear este archivo JSON. El análisis de miles de líneas JSON es una operación muy costosa. En una máquina lenta esto puede tomar segundos enteros de tiempo.</p>\n<p>En muchos contextos de servidor, el tiempo de inicio es prácticamente irrelevante. Un servidor Node.js que requiere información sobre todos los puertos es probable que sea \"más eficiente\" si carga toda la memoria requerida en la memoria cada vez que el servidor inicia con la ventaja de servir peticiones mas rápido. El módulo discutido en este ejemplo no es un \"mal\" módulo. Electron apps, however, should not be loading, parsing, and storing in memory information that it does not actually need.</p>\n<p>In short, a seemingly excellent module written primarily for Node.js servers running Linux might be bad news for your app's performance. In this particular example, the correct solution was to use no module at all, and to instead use connectivity checks included in later versions of Chromium.</p>\n<h3 id=\"¿còmo\"><a href=\"#¿còmo\">¿Còmo?</a></h3>\n<p>When considering a module, we recommend that you check:</p>\n<ol>\n<li>el tamaño de las dependencias incluidas</li>\n<li>los recursos requeridos para cargarlo (<code>require()</code>)</li>\n<li>the resources required to perform the action you're interested in</li>\n</ol>\n<p>Generating a CPU profile and a heap memory profile for loading a module can be done with a single command on the command line. In the example below, we're looking at the popular module <code>request</code>.</p>\n<pre><code class=\"hljs language-sh\">node --cpu-prof --heap-prof -e <span class=\"hljs-string\">\"require('request')\"</span>\n</code></pre>\n<p>Executing this command results in a <code>.cpuprofile</code> file and a <code>.heapprofile</code> file in the directory you executed it in. Both files can be analyzed using the Chrome Developer Tools, using the <code>Performance</code> and <code>Memory</code> tabs respectively.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/performance-cpu-prof.png\" alt=\"Perfil de rendimiento de la CPU\"></p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/performance-heap-prof.png\" alt=\"Performance Heap Memory Profile\"></p>\n<p>In this example, on the author's machine, we saw that loading <code>request</code> took almost half a second, whereas <code>node-fetch</code> took dramatically less memory and less than 50ms.</p>\n<h2 id=\"2-loading-and-running-code-too-soon\"><a href=\"#2-loading-and-running-code-too-soon\">2) Loading and running code too soon</a></h2>\n<p>If you have expensive setup operations, consider deferring those. Inspect all the work being executed right after the application starts. Instead of firing off all operations right away, consider staggering them in a sequence more closely aligned with the user's journey.</p>\n<p>In traditional Node.js development, we're used to putting all our <code>require()</code> statements at the top. If you're currently writing your Electron application using the same strategy <em>and</em> are using sizable modules that you do not immediately need, apply the same strategy and defer loading to a more opportune time.</p>\n<h3 id=\"¿por-què-1\"><a href=\"#¿por-què-1\">¿Por què?</a></h3>\n<p>Loading modules is a surprisingly expensive operation, especially on Windows. When your app starts, it should not make users wait for operations that are currently not necessary.</p>\n<p>This might seem obvious, but many applications tend to do a large amount of work immediately after the app has launched - like checking for updates, downloading content used in a later flow, or performing heavy disk I/O operations.</p>\n<p>Vamos a considerar Visual Studio Code como un ejemplo. When you open a file, it will immediately display the file to you without any code highlighting, prioritizing your ability to interact with the text. Once it has done that work, it will move on to code highlighting.</p>\n<h3 id=\"¿còmo-1\"><a href=\"#¿còmo-1\">¿Còmo?</a></h3>\n<p>Let's consider an example and assume that your application is parsing files in the fictitious <code>.foo</code> format. In order to do that, it relies on the equally fictitious <code>foo-parser</code> module. In traditional Node.js development, you might write code that eagerly loads dependencies:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> fooParser = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'foo-parser'</span>)\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">Parser</span> </span>{\n  <span class=\"hljs-keyword\">constructor</span> () {\n    <span class=\"hljs-keyword\">this</span>.files = fs.readdirSync(<span class=\"hljs-string\">'.'</span>)\n  }\n\n  getParsedFiles () {\n    <span class=\"hljs-keyword\">return</span> fooParser.parse(<span class=\"hljs-keyword\">this</span>.files)\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> parser = <span class=\"hljs-keyword\">new</span> Parser()\n\n<span class=\"hljs-built_in\">module</span>.exports = { parser }\n</code></pre>\n<p>In the above example, we're doing a lot of work that's being executed as soon as the file is loaded. Do we need to get parsed files right away? Could we do this work a little later, when <code>getParsedFiles()</code> is actually called?</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// \"fs\" is likely already being loaded, so the `require()` call is cheap</span>\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">Parser</span> </span>{\n  <span class=\"hljs-keyword\">async</span> getFiles () {\n    <span class=\"hljs-comment\">// Touch the disk as soon as `getFiles` is called, not sooner.</span>\n    <span class=\"hljs-comment\">// Also, ensure that we're not blocking other operations by using</span>\n    <span class=\"hljs-comment\">// the asynchronous version.</span>\n    <span class=\"hljs-keyword\">this</span>.files = <span class=\"hljs-keyword\">this</span>.files || <span class=\"hljs-keyword\">await</span> fs.readdir(<span class=\"hljs-string\">'.'</span>)\n\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-keyword\">this</span>.files\n  }\n\n  <span class=\"hljs-keyword\">async</span> getParsedFiles () {\n    <span class=\"hljs-comment\">// Our fictitious foo-parser is a big and expensive module to load, so</span>\n    <span class=\"hljs-comment\">// defer that work until we actually need to parse files.</span>\n    <span class=\"hljs-comment\">// Since `require()` comes with a module cache, the `require()` call</span>\n    <span class=\"hljs-comment\">// will only be expensive once - subsequent calls of `getParsedFiles()`</span>\n    <span class=\"hljs-comment\">// will be faster.</span>\n    <span class=\"hljs-keyword\">const</span> fooParser = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'foo-parser'</span>)\n    <span class=\"hljs-keyword\">const</span> files = <span class=\"hljs-keyword\">await</span> <span class=\"hljs-keyword\">this</span>.getFiles()\n\n    <span class=\"hljs-keyword\">return</span> fooParser.parse(files)\n  }\n}\n\n<span class=\"hljs-comment\">// This operation is now a lot cheaper than in our previous example</span>\n<span class=\"hljs-keyword\">const</span> parser = <span class=\"hljs-keyword\">new</span> Parser()\n\n<span class=\"hljs-built_in\">module</span>.exports = { parser }\n</code></pre>\n<p>In short, allocate resources \"just in time\" rather than allocating them all when your app starts.</p>\n<h2 id=\"3-blocking-the-main-process\"><a href=\"#3-blocking-the-main-process\">3) Blocking the main process</a></h2>\n<p>Electron's main process (sometimes called \"browser process\") is special: It is the parent process to all your app's other processes and the primary process the operating system interacts with. It handles windows, interactions, and the communication between various components inside your app. It also houses the UI thread.</p>\n<p>Under no circumstances should you block this process and the UI thread with long-running operations. Blocking the UI thread means that your entire app will freeze until the main process is ready to continue processing.</p>\n<h3 id=\"¿por-què-2\"><a href=\"#¿por-què-2\">¿Por què?</a></h3>\n<p>The main process and its UI thread are essentially the control tower for major operations inside your app. When the operating system tells your app about a mouse click, it'll go through the main process before it reaches your window. If your window is rendering a buttery-smooth animation, it'll need to talk to the GPU process about that – once again going through the main process.</p>\n<p>Electron and Chromium are careful to put heavy disk I/O and CPU-bound operations onto new threads to avoid blocking the UI thread. Deberías hacer lo mismo.</p>\n<h3 id=\"¿còmo-2\"><a href=\"#¿còmo-2\">¿Còmo?</a></h3>\n<p>Electron's powerful multi-process architecture stands ready to assist you with your long-running tasks, but also includes a small number of performance traps.</p>\n<p>1) Para tareas pesadas de la CPU, utilice <a href=\"https://nodejs.org/api/worker_threads.html\">worker threads</a>, considere moverlos a BrowserWindow, o (como último recurso) genere un proceso dedicado.</p>\n<p>2) Avoid using the synchronous IPC and the <code>remote</code> module as much as possible. While there are legitimate use cases, it is far too easy to unknowingly block the UI thread using the <code>remote</code> module.</p>\n<p>3) Avoid using blocking I/O operations in the main process. In short, whenever core Node.js modules (like <code>fs</code> or <code>child_process</code>) offer a synchronous or an asynchronous version, you should prefer the asynchronous and non-blocking variant.</p>\n<h2 id=\"4-blocking-the-renderer-process\"><a href=\"#4-blocking-the-renderer-process\">4) Blocking the renderer process</a></h2>\n<p>Dado que Electron se envía con una versión actual de Chrome, puede hacer uso de las últimas y mejores funciones que ofrece la plataforma web para aplazar o descargar operaciones pesadas de una manera que mantenga su aplicación fluida y receptiva.</p>\n<h3 id=\"¿por-què-3\"><a href=\"#¿por-què-3\">¿Por què?</a></h3>\n<p>Your app probably has a lot of JavaScript to run in the renderer process. The trick is to execute operations as quickly as possible without taking away resources needed to keep scrolling smooth, respond to user input, or animations at 60fps.</p>\n<p>Orchestrating the flow of operations in your renderer's code is particularly useful if users complain about your app sometimes \"stuttering\".</p>\n<h3 id=\"¿còmo-3\"><a href=\"#¿còmo-3\">¿Còmo?</a></h3>\n<p>Generally speaking, all advice for building performant web apps for modern browsers apply to Electron's renderers, too. Las dos herramientas principales a su disposición actualmente son  <code>requestIdleCallback()</code> para pequeñas operaciones y <code>Web Workers</code> para operaciones de ejecución prolongada.</p>\n<p><em><code>requestIdleCallback()</code></em> allows developers to queue up a function to be executed as soon as the process is entering an idle period. It enables you to perform low-priority or background work without impacting the user experience. Para más información sobre como usarlo, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\">revise su documentación en MDN</a>.</p>\n<p><em>Web Workers</em> son una herramienta poderosa para correr código en un hilo separado. Hay algunas advertencias a considerar - consulte la <a href=\"/docs/tutorial/multithreading\">documentación de multihilos</a> y la <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers\">documentación de MDN para trabajadores Web</a> de Electron. They're an ideal solution for any operation that requires a lot of CPU power for an extended period of time.</p>\n<h2 id=\"5-unnecessary-polyfills\"><a href=\"#5-unnecessary-polyfills\">5) Unnecessary polyfills</a></h2>\n<p>One of Electron's great benefits is that you know exactly which engine will parse your JavaScript, HTML, and CSS. If you're re-purposing code that was written for the web at large, make sure to not polyfill features included in Electron.</p>\n<h3 id=\"¿por-què-4\"><a href=\"#¿por-què-4\">¿Por què?</a></h3>\n<p>When building a web application for today's Internet, the oldest environments dictate what features you can and cannot use. Even though Electron supports well-performing CSS filters and animations, an older browser might not. Where you could use WebGL, your developers may have chosen a more resource-hungry solution to support older phones.</p>\n<p>When it comes to JavaScript, you may have included toolkit libraries like jQuery for DOM selectors or polyfills like the <code>regenerator-runtime</code> to support <code>async/await</code>.</p>\n<p>It is rare for a JavaScript-based polyfill to be faster than the equivalent native feature in Electron. Do not slow down your Electron app by shipping your own version of standard web platform features.</p>\n<h3 id=\"¿còmo-4\"><a href=\"#¿còmo-4\">¿Còmo?</a></h3>\n<p>Operate under the assumption that polyfills in current versions of Electron are unnecessary. If you have doubts, check <a href=\"https://caniuse.com/\">caniuse.com</a> and check if the <a href=\"/docs/api/process#processversionschrome-readonly\">version of Chromium used in your Electron version</a> supports the feature you desire.</p>\n<p>In addition, carefully examine the libraries you use. ¿Son realmente necesarias? <code>jQuery</code>, por ejemplo, fue un éxito tal que muchas de sus característica ahora son partes del <a href=\"http://youmightnotneedjquery.com/\">standard JavaScript feature set available</a>.</p>\n<p>If you're using a transpiler/compiler like TypeScript, examine its configuration and ensure that you're targeting the latest ECMAScript version supported by Electron.</p>\n<h2 id=\"6-unnecessary-or-blocking-network-requests\"><a href=\"#6-unnecessary-or-blocking-network-requests\">6) Unnecessary or blocking network requests</a></h2>\n<p>Avoid fetching rarely changing resources from the internet if they could easily be bundled with your application.</p>\n<h3 id=\"¿por-què-5\"><a href=\"#¿por-què-5\">¿Por què?</a></h3>\n<p>Many users of Electron start with an entirely web-based app that they're turning into a desktop application. As web developers, we are used to loading resources from a variety of content delivery networks. Now that you are shipping a proper desktop application, attempt to \"cut the cord\" where possible and avoid letting your users wait for resources that never change and could easily be included  in your app.</p>\n<p>A typical example is Google Fonts. Many developers make use of Google's impressive collection of free fonts, which comes with a content delivery network. The pitch is straightforward: Include a few lines of CSS and Google will take care of the rest.</p>\n<p>When building an Electron app, your users are better served if you download the fonts and include them in your app's bundle.</p>\n<h3 id=\"¿còmo-5\"><a href=\"#¿còmo-5\">¿Còmo?</a></h3>\n<p>In an ideal world, your application wouldn't need the network to operate at all. To get there, you must understand what resources your app is downloading - and how large those resources are.</p>\n<p>To do so, open up the developer tools. Navigate to the <code>Network</code> tab and check the <code>Disable cache</code> option. Then, reload your renderer. Unless your app prohibits such reloads, you can usually trigger a reload by hitting <code>Cmd + R</code> or <code>Ctrl + R</code> with the developer tools in focus.</p>\n<p>The tools will now meticulously record all network requests. In a first pass, take stock of all the resources being downloaded, focusing on the larger files first. Are any of them images, fonts, or media files that don't change and could be included with your bundle? If so, include them.</p>\n<p>As a next step, enable <code>Network Throttling</code>. Find the drop-down that currently reads <code>Online</code> and select a slower speed such as <code>Fast 3G</code>. Reload your renderer and see if there are any resources that your app is unnecessarily waiting for. In many cases, an app will wait for a network request to complete despite not actually needing the involved resource.</p>\n<p>As a tip, loading resources from the Internet that you might want to change without shipping an application update is a powerful strategy. Para un control avanzado sobre como los recursos se cargan, considere invertir en <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API\">Service Workers</a>.</p>\n<h2 id=\"7-bundle-your-code\"><a href=\"#7-bundle-your-code\">7) Bundle your code</a></h2>\n<p>As already pointed out in \"<a href=\"#2-loading-and-running-code-too-soon\">Loading and running code too soon</a>\", calling <code>require()</code> is an expensive operation. If you are able to do so, bundle your application's code into a single file.</p>\n<h3 id=\"¿por-què-6\"><a href=\"#¿por-què-6\">¿Por què?</a></h3>\n<p>Modern JavaScript development usually involves many files and modules. While that's perfectly fine for developing with Electron, we heavily recommend that you bundle all your code into one single file to ensure that the overhead included in calling <code>require()</code> is only paid once when your application loads.</p>\n<h3 id=\"¿còmo-6\"><a href=\"#¿còmo-6\">¿Còmo?</a></h3>\n<p>There are numerous JavaScript bundlers out there and we know better than to anger the community by recommending one tool over another. We do however recommend that you use a bundler that is able to handle Electron's unique environment that needs to handle both Node.js and browser environments.</p>\n<p>Al escribir este artículo, las opciones populares incluyen <a href=\"https://webpack.js.org/\">Webpack</a>, <a href=\"https://parceljs.org/\">Parcel</a> y <a href=\"https://rollupjs.org/\">rollup.js</a>.</p>",
      "title": "Rendimiento",
      "description": ""
    },
    "/docs/api/structures/point": {
      "locale": "es-ES",
      "slug": "point",
      "href": "/docs/api/structures/point",
      "crowdinFileId": "256475",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/point.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"point-object\"><a href=\"#point-object\">Point Object</a></h1>\n<ul>\n<li><code>x</code> Number</li>\n<li><code>y</code> Number</li>\n</ul>\n<p><strong>Note:</strong> Both <code>x</code> and <code>y</code> must be whole integers, when providing a point object as input to an Electron API we will automatically round your <code>x</code> and <code>y</code> values to the nearest whole integer.</p>",
      "title": "Point Object",
      "description": ""
    },
    "/docs/api/structures/post-body": {
      "locale": "es-ES",
      "slug": "post-body",
      "href": "/docs/api/structures/post-body",
      "crowdinFileId": "256477",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/post-body.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"postbody-object\"><a href=\"#postbody-object\">PostBody Object</a></h1>\n<ul>\n<li><code>data</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)[] - The post data to be sent to the new window.</li>\n<li><code>contentType</code> String - The <code>content-type</code> header used for the data. One of <code>application/x-www-form-urlencoded</code> or <code>multipart/form-data</code>. Corresponds to the <code>enctype</code> attribute of the submitted HTML form.</li>\n<li><code>boundary</code> String (optional) - The boundary used to separate multiple parts of the message. Only valid when <code>contentType</code> is <code>multipart/form-data</code>.</li>\n</ul>\n<p>Note that keys starting with <code>--</code> are not currently supported. For example, this will errantly submit as <code>multipart/form-data</code> when <code>nativeWindowOpen</code> is set to <code>false</code> in webPreferences:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">form</span>\n  <span class=\"hljs-attr\">target</span>=<span class=\"hljs-string\">\"_blank\"</span>\n  <span class=\"hljs-attr\">method</span>=<span class=\"hljs-string\">\"POST\"</span>\n  <span class=\"hljs-attr\">enctype</span>=<span class=\"hljs-string\">\"application/x-www-form-urlencoded\"</span>\n  <span class=\"hljs-attr\">action</span>=<span class=\"hljs-string\">\"https://postman-echo.com/post\"</span>\n></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">input</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text\"</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">\"--theKey\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">input</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"submit\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">form</span>></span>\n</code></pre>",
      "title": "PostBody Object",
      "description": ""
    },
    "/docs/api/power-monitor": {
      "locale": "es-ES",
      "slug": "power-monitor",
      "href": "/docs/api/power-monitor",
      "crowdinFileId": "256351",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/power-monitor.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"powermonitor\"><a href=\"#powermonitor\">powerMonitor</a></h1>\n<blockquote>\n<p>Monitorea los cambios de estado de energía.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<h2 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h2>\n<p>El módulo <code>powerMonitor</code> emite los siguientes eventos:</p>\n<h3 id=\"evento-suspend\"><a href=\"#evento-suspend\">Evento: \"suspend\"</a></h3>\n<p>Se emite cuando se suspende el sistema.</p>\n<h3 id=\"evento-resume\"><a href=\"#evento-resume\">Evento: \"resume\"</a></h3>\n<p>Se emite cuando se reanuda el sistema.</p>\n<h3 id=\"event-on-ac-macos-windows\"><a href=\"#event-on-ac-macos-windows\">Event: 'on-ac' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Se emite cuando el sistema se cambia a la corriente alterna.</p>\n<h3 id=\"event-on-battery-macos--windows\"><a href=\"#event-on-battery-macos--windows\">Event: 'on-battery' <em>macOS</em>  <em>Windows</em></a></h3>\n<p>Se emite cuando el sistema se cambia a la energía de batería.</p>\n<h3 id=\"evento-shutdown-linux-macos\"><a href=\"#evento-shutdown-linux-macos\">Evento: 'shutdown' <em>Linux</em> <em>macOS</em></a></h3>\n<p>Se emite cuando el sistema está a punto de reiniciarse o apagarse. Si el controlador de eventos invocó <code>e.preventDefault()</code>, Electron intentará retrasar el apagado del sistema para que la aplicación salga limpiamente. Si se llama a <code>e.preventDefault()</code>, la aplicación debe salir tan pronto como sea posible llamando a algo como <code>app.quit()</code>.</p>\n<h3 id=\"evento-lock-screen-macos-windows\"><a href=\"#evento-lock-screen-macos-windows\">Evento: 'lock-screen' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Emitido cuando el sistema está a punto de bloquear la pantalla.</p>\n<h3 id=\"evento-unlock-screen-macos-windows\"><a href=\"#evento-unlock-screen-macos-windows\">Evento: 'unlock-screen' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Emitido tan pronto como el sistema desbloquea la pantalla.</p>\n<h3 id=\"evento-user-did-become-active-macos\"><a href=\"#evento-user-did-become-active-macos\">Evento: 'user-did-become-active' <em>macOS</em></a></h3>\n<p>Emitted when a login session is activated. See <a href=\"https://developer.apple.com/documentation/appkit/nsworkspacesessiondidbecomeactivenotification?language=objc\">documentation</a> for more information.</p>\n<h3 id=\"evento-user-did-resign-active-macos\"><a href=\"#evento-user-did-resign-active-macos\">Evento: 'user-did-resign-active' <em>macOS</em></a></h3>\n<p>Emitted when a login session is deactivated. See <a href=\"https://developer.apple.com/documentation/appkit/nsworkspacesessiondidresignactivenotification?language=objc\">documentation</a> for more information.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El modulo <code>powerMonitor</code> tiene los siguientes métodos:</p>\n<h3 id=\"powermonitorgetsystemidlestateidlethreshold\"><a href=\"#powermonitorgetsystemidlestateidlethreshold\"><code>powerMonitor.getSystemIdleState(idleThreshold)</code></a></h3>\n<ul>\n<li><code>idleThreshold</code> Integer</li>\n</ul>\n<p>Returns <code>String</code> - The system's current state. Puede ser <code>active</code>, <code>idle</code>, <code>locked</code> o <code>unknown</code>.</p>\n<p>Calcule el estado de reposo del sistema. <code>idleThreshold</code> es la cantidad de tiempo (en segundos) antes de considerar inactivo.  <code>locked</code> is available on supported systems only.</p>\n<h3 id=\"powermonitorgetsystemidletime\"><a href=\"#powermonitorgetsystemidletime\"><code>powerMonitor.getSystemIdleTime()</code></a></h3>\n<p>Devuelve <code>Integer</code> - Tiempo inactivo en segundos</p>\n<p>Calcular tiempo inactivo del sistema en segundos.</p>\n<h3 id=\"powermonitorisonbatterypower\"><a href=\"#powermonitorisonbatterypower\"><code>powerMonitor.isOnBatteryPower()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the system is on battery power.</p>\n<p>To monitor for changes in this property, use the <code>on-battery</code> and <code>on-ac</code> events.</p>\n<h2 id=\"propiedades\"><a href=\"#propiedades\">Propiedades</a></h2>\n<h3 id=\"powermonitoronbatterypower\"><a href=\"#powermonitoronbatterypower\"><code>powerMonitor.onBatteryPower</code></a></h3>\n<p>Una propiedad <code>Boolean</code>. True if the system is on battery power.</p>\n<p>See <a href=\"#powermonitorisonbatterypower\"><code>powerMonitor.isOnBatteryPower()</code></a>.</p>",
      "title": "powerMonitor",
      "description": "Monitorea los cambios de estado de energía."
    },
    "/docs/api/power-save-blocker": {
      "locale": "es-ES",
      "slug": "power-save-blocker",
      "href": "/docs/api/power-save-blocker",
      "crowdinFileId": "256353",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/power-save-blocker.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"powersaveblocker\"><a href=\"#powersaveblocker\">powerSaveBlocker</a></h1>\n<blockquote>\n<p>Bloquea al sistema para evitar que entre en el modo de bajo consumo (suspensión).</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p>Por ejemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { powerSaveBlocker } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> id = powerSaveBlocker.start(<span class=\"hljs-string\">'prevent-display-sleep'</span>)\n<span class=\"hljs-built_in\">console</span>.log(powerSaveBlocker.isStarted(id))\n\npowerSaveBlocker.stop(id)\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>powerSaveBlocker</code> tiene los siguientes métodos:</p>\n<h3 id=\"powersaveblockerstarttype\"><a href=\"#powersaveblockerstarttype\"><code>powerSaveBlocker.start(type)</code></a></h3>\n<ul>\n<li><code>type</code> String - Power save blocker type.<ul>\n<li><code>prevent-app-suspension</code> - Evita que la aplicación sea suspendida. Mantiene el sistema activo pero permite apagar la pantalla. Ejemplo de casos de uso: descargar un archivo o reproducir audio.</li>\n<li><code>prevent-display-sleep</code> - Evita que la pantalla quede inactiva. Mantiene el sistema y la pantalla activos. Ejemplo de caso de uso: reproducción de video.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Integer</code> - El ID bloqueador que se asigna al bloqueador de energía.</p>\n<p>Inicia evitando que el sistema entre en modo de bajo consumo. Devuelve un entero que identifica el bloqueador de ahorro de energía.</p>\n<p><strong>Nota:</strong> <code>prevent-display-sleep</code> tiene mayor prioridad sobre <code>prevent-app-suspension</code>. Solo el tipo de mayor prioridad tiene efecto. En otras palabras, <code>prevent-display-sleep</code> tiene mayor prioridad sobre <code>prevent-app-suspension</code>.</p>\n<p>Por ejemplo, una API llamada A solicita a <code>prevent-app-suspension</code>, y otra llamada B solicita a <code>prevent-display-sleep</code>. Se utilizará <code>prevent-display-sleep</code> hasta que B detenga su solicitud. Luego de eso, se utilizará <code>prevent-app-suspension</code>.</p>\n<h3 id=\"powersaveblockerstopid\"><a href=\"#powersaveblockerstopid\"><code>powerSaveBlocker.stop(id)</code></a></h3>\n<ul>\n<li><code>id</code> Entero - El id de bloqueo de ahorro de energía devuelto por <code>powerSaveBlocker.start</code>.</li>\n</ul>\n<p>Detiene el bloqueador de ahorro de energía especificado.</p>\n<h3 id=\"powersaveblockerisstartedid\"><a href=\"#powersaveblockerisstartedid\"><code>powerSaveBlocker.isStarted(id)</code></a></h3>\n<ul>\n<li><code>id</code> Entero - El id de bloqueo de ahorro de energía devuelto por <code>powerSaveBlocker.start</code>.</li>\n</ul>\n<p>Devuelve <code>Boolean</code> - Si ha iniciado el <code>powerSaveBlocker</code> correspondiente.</p>",
      "title": "powerSaveBlocker",
      "description": "Bloquea al sistema para evitar que entre en el modo de bajo consumo (suspensión)."
    },
    "/docs/api/structures/printer-info": {
      "locale": "es-ES",
      "slug": "printer-info",
      "href": "/docs/api/structures/printer-info",
      "crowdinFileId": "256479",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/printer-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"printerinfo-object\"><a href=\"#printerinfo-object\">PrinterInfo Object</a></h1>\n<ul>\n<li><code>name</code> String - the name of the printer as understood by the OS.</li>\n<li><code>displayName</code> String - the name of the printer as shown in Print Preview.</li>\n<li><code>description</code> String - a longer description of the printer's type.</li>\n<li><code>status</code> Number - the current status of the printer.</li>\n<li><code>isDefault</code> Boolean - whether or not a given printer is set as the default printer on the OS.</li>\n<li><code>options</code> Object - an object containing a variable number of platform-specific printer information.</li>\n</ul>\n<p>The number represented by <code>status</code> means different things on different platforms: on Windows its potential values can be found <a href=\"https://docs.microsoft.com/en-us/windows/win32/printdocs/printer-info-2\">here</a>, and on Linux and macOS they can be found <a href=\"https://www.cups.org/doc/cupspm.html\">here</a>.</p>\n<h2 id=\"ejemplo\"><a href=\"#ejemplo\">Ejemplo</a></h2>\n<p>Below is an example of some of the additional options that may be set which may be different on each platform.</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Austin_4th_Floor_Printer___C02XK13BJHD4'</span>,\n  <span class=\"hljs-attr\">displayName</span>: <span class=\"hljs-string\">'Austin 4th Floor Printer @ C02XK13BJHD4'</span>,\n  <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'TOSHIBA ColorMFP'</span>,\n  <span class=\"hljs-attr\">status</span>: <span class=\"hljs-number\">3</span>,\n  <span class=\"hljs-attr\">isDefault</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">options</span>: {\n    <span class=\"hljs-attr\">copies</span>: <span class=\"hljs-string\">'1'</span>,\n    <span class=\"hljs-string\">'device-uri'</span>: <span class=\"hljs-string\">'dnssd://Austin%204th%20Floor%20Printer%20%40%20C02XK13BJHD4._ipps._tcp.local./?uuid=71687f1e-1147-3274-6674-22de61b110bd'</span>,\n    <span class=\"hljs-attr\">finishings</span>: <span class=\"hljs-string\">'3'</span>,\n    <span class=\"hljs-string\">'job-cancel-after'</span>: <span class=\"hljs-string\">'10800'</span>,\n    <span class=\"hljs-string\">'job-hold-until'</span>: <span class=\"hljs-string\">'no-hold'</span>,\n    <span class=\"hljs-string\">'job-priority'</span>: <span class=\"hljs-string\">'50'</span>,\n    <span class=\"hljs-string\">'job-sheets'</span>: <span class=\"hljs-string\">'none,none'</span>,\n    <span class=\"hljs-string\">'marker-change-time'</span>: <span class=\"hljs-string\">'0'</span>,\n    <span class=\"hljs-string\">'number-up'</span>: <span class=\"hljs-string\">'1'</span>,\n    <span class=\"hljs-string\">'printer-commands'</span>: <span class=\"hljs-string\">'ReportLevels,PrintSelfTestPage,com.toshiba.ColourProfiles.update,com.toshiba.EFiling.update,com.toshiba.EFiling.checkPassword'</span>,\n    <span class=\"hljs-string\">'printer-info'</span>: <span class=\"hljs-string\">'Austin 4th Floor Printer @ C02XK13BJHD4'</span>,\n    <span class=\"hljs-string\">'printer-is-accepting-jobs'</span>: <span class=\"hljs-string\">'true'</span>,\n    <span class=\"hljs-string\">'printer-is-shared'</span>: <span class=\"hljs-string\">'false'</span>,\n    <span class=\"hljs-string\">'printer-is-temporary'</span>: <span class=\"hljs-string\">'false'</span>,\n    <span class=\"hljs-string\">'printer-location'</span>: <span class=\"hljs-string\">''</span>,\n    <span class=\"hljs-string\">'printer-make-and-model'</span>: <span class=\"hljs-string\">'TOSHIBA ColorMFP'</span>,\n    <span class=\"hljs-string\">'printer-state'</span>: <span class=\"hljs-string\">'3'</span>,\n    <span class=\"hljs-string\">'printer-state-change-time'</span>: <span class=\"hljs-string\">'1573472937'</span>,\n    <span class=\"hljs-string\">'printer-state-reasons'</span>: <span class=\"hljs-string\">'offline-report,com.toshiba.snmp.failed'</span>,\n    <span class=\"hljs-string\">'printer-type'</span>: <span class=\"hljs-string\">'10531038'</span>,\n    <span class=\"hljs-string\">'printer-uri-supported'</span>: <span class=\"hljs-string\">'ipp://localhost/printers/Austin_4th_Floor_Printer___C02XK13BJHD4'</span>,\n    <span class=\"hljs-attr\">system_driverinfo</span>: <span class=\"hljs-string\">'T'</span>\n  }\n}\n</code></pre>",
      "title": "PrinterInfo Object",
      "description": ""
    },
    "/docs/api/process": {
      "locale": "es-ES",
      "slug": "process",
      "href": "/docs/api/process",
      "crowdinFileId": "256355",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/process.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"process\"><a href=\"#process\">process</a></h1>\n<blockquote>\n<p>Extensiones para el objeto process.</p>\n</blockquote>\n<p>Procesos: <a href=\"/docs/glossary#main-process\">principal</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>El objeto <code>process</code> de Electron es heredado del <a href=\"https://nodejs.org/api/process.html\">objeto <code>process</code> de Node.js</a>. Este agrega los siguientes eventos, propiedades y métodos:</p>\n<h2 id=\"sandbox\"><a href=\"#sandbox\">Sandbox</a></h2>\n<p>En el procesor renderer en sandbox el objeto <code>process</code> sólo contiene un subconjunto de las APIs:</p>\n<ul>\n<li><code>crash()</code></li>\n<li><code>hang()</code></li>\n<li><code>getCreationTime()</code></li>\n<li><code>getHeapStatistics()</code></li>\n<li><code>getBlinkMemoryInfo()</code></li>\n<li><code>getProcessMemoryInfo()</code></li>\n<li><code>getSystemMemoryInfo()</code></li>\n<li><code>getSystemVersion()</code></li>\n<li><code>getCPUUsage()</code></li>\n<li><code>getIOCounters()</code></li>\n<li><code>uptime()</code></li>\n<li><code>argv</code></li>\n<li><code>execPath</code></li>\n<li><code>env</code></li>\n<li><code>pid</code></li>\n<li><code>arch</code></li>\n<li><code>platform</code></li>\n<li><code>sandboxed</code></li>\n<li><code>contextIsolated</code></li>\n<li><code>type</code></li>\n<li><code>version</code></li>\n<li><code>versions</code></li>\n<li><code>mas</code></li>\n<li><code>windowsStore</code></li>\n<li><code>contextId</code></li>\n</ul>\n<h2 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h2>\n<h3 id=\"evento-loaded\"><a href=\"#evento-loaded\">Evento: 'loaded'</a></h3>\n<p>Emitido cuando Electron ha cargado su script de inicialización interno y está empezando a carga la página web o el script principal.</p>\n<h2 id=\"propiedades\"><a href=\"#propiedades\">Propiedades</a></h2>\n<h3 id=\"processdefaultapp-solo-lectura\"><a href=\"#processdefaultapp-solo-lectura\"><code>process.defaultApp</code> <em>Solo lectura</em></a></h3>\n<p>Un <code>Boolean</code>. When app is started by being passed as parameter to the default app, this property is <code>true</code> in the main process, otherwise it is <code>undefined</code>.</p>\n<h3 id=\"processismainframe-solo-lectura\"><a href=\"#processismainframe-solo-lectura\"><code>process.isMainFrame</code> <em>Solo lectura</em></a></h3>\n<p>Un <code>Boolean</code>, <code>true</code> cuando el contexto actual del renderer es \"main\" renderer frame. Si quieres el ID del frame actual deberías usar <code>webFrame.routingId</code>.</p>\n<h3 id=\"processmas-solo-lectura\"><a href=\"#processmas-solo-lectura\"><code>process.mas</code> <em>Solo lectura</em></a></h3>\n<p>Un <code>Boolean</code>. Para compilaciones de Mac App Store, esta propiedad es <code>true</code>, para otras compilaciones es <code>undefined</code>.</p>\n<h3 id=\"procesonoasar\"><a href=\"#procesonoasar\"><code>proceso.noAsar</code></a></h3>\n<p>Un <code>Boolean</code> que controla el soporte ASAR dentro de tu aplicación. Establecer esto a <code>true</code> desactivará el soporte para archivos <code>asar</code> en los módulos integrados de Node.</p>\n<h3 id=\"processnodeprecation\"><a href=\"#processnodeprecation\"><code>process.noDeprecation</code></a></h3>\n<p>Un <code>Boolean</code> que controla si las advertencias de deprecación se imprimen o no a <code>stderr</code>. Modificar esta propiedad a <code>true</code> silenciará las advertencias de depreciación. Esta propiedad es usada en lugar de la linea de comando <code>--no-deprecation</code>.</p>\n<h3 id=\"processresourcespath-solo-lectura\"><a href=\"#processresourcespath-solo-lectura\"><code>process.resourcesPath</code> <em>Solo lectura</em></a></h3>\n<p>Un <code>string</code> que representa la ruta de acceso al directorio de recursos.</p>\n<h3 id=\"processsandboxed-solo-lectura\"><a href=\"#processsandboxed-solo-lectura\"><code>process.sandboxed</code> <em>Solo lectura</em></a></h3>\n<p>Un <code>Boolean</code>. When the renderer process is sandboxed, this property is <code>true</code>, otherwise it is <code>undefined</code>.</p>\n<h3 id=\"processcontextisolated-sololectura\"><a href=\"#processcontextisolated-sololectura\"><code>process.contextIsolated</code> <em>SoloLectura</em></a></h3>\n<p>Un <code>Boolean</code> que indica si el renderer context acutal tiene el <code>contextIsolation</code> activado. Es <code>undefined</code> en el main process.</p>\n<h3 id=\"procesodesechodegradación\"><a href=\"#procesodesechodegradación\"><code>proceso.desechoDegradación</code></a></h3>\n<p>Un <code>Booleano</code> que controla si las advertencias de degradación son consideradas como excepción. Ajustando este como <code>verdad</code> se producirán errores por degradación. Esta propiedad es usada en vez de la linea de comando <code>--throw-deprecation</code>.</p>\n<h3 id=\"procesoubicardegradación\"><a href=\"#procesoubicardegradación\"><code>proceso.ubicarDegradación</code></a></h3>\n<p>Un <code>Booleano</code> que controla si las degradaciones son enviadas a <code>stderr</code> incluyen su proceso de ubicación. Ajustando este como <code>true</code> se enviarán ubicaciones de pila por degradaciones. Esta propiedad es en vez de la linea de comando <code>--trace-deprecation</code>.</p>\n<h3 id=\"procesoubicaradvertenciasdeprocesos\"><a href=\"#procesoubicaradvertenciasdeprocesos\"><code>proceso.ubicarAdvertenciasdeProcesos</code></a></h3>\n<p>Un <code>Booleano</code> que controla si las advertencias de procesos son enviadas a <code>stderr</code> incluyen su proceso de ubicación. Ajustando este como <code>verdad</code> se enviarán ubicaciones de pila para advertencias de procesos (incluyendo degradaciones). Esta propiedad es en vez de la línea de comando <code>--trace-warnings</code>.</p>\n<h3 id=\"processtype-solo-lectura\"><a href=\"#processtype-solo-lectura\"><code>process.type</code> <em>Solo lectura</em></a></h3>\n<p>Un <code>String</code> que representa el tipo de proceso actual, puede ser:</p>\n<ul>\n<li><code>browser</code> - El main process</li>\n<li><code>renderer</code> - Un renderer process</li>\n<li><code>worker</code> - En un web worker</li>\n</ul>\n<h3 id=\"processversionschrome-solo-lectura\"><a href=\"#processversionschrome-solo-lectura\"><code>process.versions.chrome</code> <em>Solo lectura</em></a></h3>\n<p>Una <code>cadena</code> representando la versión de cadena de Chrome.</p>\n<h3 id=\"processversionselectron-solo-lectura\"><a href=\"#processversionselectron-solo-lectura\"><code>process.versions.electron</code> <em>Solo lectura</em></a></h3>\n<p>Una <code>cadena</code> representando la versión de cadena de Electron.</p>\n<h3 id=\"processwindowsstore-solo-lectura\"><a href=\"#processwindowsstore-solo-lectura\"><code>process.windowsStore</code> <em>Solo lectura</em></a></h3>\n<p>Un <code>Boolean</code>. If the app is running as a Windows Store app (appx), this property is <code>true</code>, for otherwise it is <code>undefined</code>.</p>\n<h3 id=\"processcontextid-sololectura\"><a href=\"#processcontextid-sololectura\"><code>process.contextId</code> <em>SoloLectura</em></a></h3>\n<p>Un <code>String</code> (opcional) que representa un único global ID del contexto JavaScript actual. Cada frame tiene su propio contexto JavaScript. Cuando el contextIsolation está activado, el isolated world además tiene un contexto JavaScript separado. Esta propiedad solo está disponible en el renderer process.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El objeto <code>proceso</code> tiene los siguientes métodos:</p>\n<h3 id=\"procesocrash\"><a href=\"#procesocrash\"><code>proceso.crash()</code></a></h3>\n<p>Hace que el hilo principal del proceso actual se detenga.</p>\n<h3 id=\"processgetcreationtime\"><a href=\"#processgetcreationtime\"><code>process.getCreationTime()</code></a></h3>\n<p>Devuelve <code>Number | null</code> - El numero de mili-segundos desde la época o <code>null</code> si la información no esta disponible</p>\n<p>Indicates the creation time of the application. El tiempo es representado como número de milisegundos desde la época. Devuelve null si no es capaz de obtener el tiempo de creación del proceso.</p>\n<h3 id=\"processgetcpuusage\"><a href=\"#processgetcpuusage\"><code>process.getCPUUsage()</code></a></h3>\n<p>Devuelve <a href=\"/docs/api/structures/cpu-usage\"><code>CPUUsage</code></a></p>\n<h3 id=\"processgetiocounters-windows-linux\"><a href=\"#processgetiocounters-windows-linux\"><code>process.getIOCounters()</code> <em>Windows</em> <em>Linux</em></a></h3>\n<p>Devuelve <a href=\"/docs/api/structures/io-counters\"><code>IOCounters</code></a></p>\n<h3 id=\"processgetheapstatistics\"><a href=\"#processgetheapstatistics\"><code>process.getHeapStatistics()</code></a></h3>\n<p>Devuelve <code>Objeto</code>:</p>\n<ul>\n<li><code>totalHeapSize</code> Integer</li>\n<li><code>totalHeapSizeExecutable</code> Integer</li>\n<li><code>totalPhysicalSize</code> Integer</li>\n<li><code>totalAvailableSize</code> Integer</li>\n<li><code>usedHeapSize</code> Integer</li>\n<li><code>heapSizeLimit</code> Integer</li>\n<li><code>mallocedMemory</code> Integer</li>\n<li><code>peakMallocedMemory</code> Integer</li>\n<li><code>doesZapGarbage</code> Boolean</li>\n</ul>\n<p>Devuelve un objeto con estadísticas de la pila V8. Tome en cuenta que todas las estadísticas son reportadas en Kilobytes.</p>\n<h3 id=\"processgetblinkmemoryinfo\"><a href=\"#processgetblinkmemoryinfo\"><code>process.getBlinkMemoryInfo()</code></a></h3>\n<p>Devuelve <code>Objeto</code>:</p>\n<ul>\n<li><code>allocated</code> Integer - Tamaño de todos los objetos asignados en Kilobytes.</li>\n<li><code>marked</code> Integer - Tamaño de todos los objetos marcados en Kilobytes.</li>\n<li><code>total</code> Integer - Espacio total asignado en Kilobytes.</li>\n</ul>\n<p>Returns an object with Blink memory information. It can be useful for debugging rendering / DOM related memory issues. Note that all values are reported in Kilobytes.</p>\n<h3 id=\"processgetprocessmemoryinfo\"><a href=\"#processgetprocessmemoryinfo\"><code>process.getProcessMemoryInfo()</code></a></h3>\n<p>Devuelve <code>Promise&#x3C;ProcessMemoryInfo></code> - Resuelve con un <a href=\"/docs/api/structures/process-memory-info\">ProcessMemoryInfo</a></p>\n<p>Returns an object giving memory usage statistics about the current process. Note that all statistics are reported in Kilobytes. This api should be called after app ready.</p>\n<p>Chromium no provee el valor <code>residentSet</code> para macOS. Esto es porque macOS realiza compresión en memoria que no han sido utilizadas recientemente. Como resultado, el valor del tamaño del conjunto de residentes no es lo que uno esperaría. Memoria <code>private</code> es más representativo del uso real de la memoria de precompresión del proceso en macOS.</p>\n<h3 id=\"processgetsystemmemoryinfo\"><a href=\"#processgetsystemmemoryinfo\"><code>process.getSystemMemoryInfo()</code></a></h3>\n<p>Devuelve <code>Objeto</code>:</p>\n<ul>\n<li><code>total</code> Entero - La cantidad total de memoria física en kilobytes de la que dispone el sistema.</li>\n<li><code>libre</code> entero - La cantidad de memoria que no está siendo usada por aplicaciones o caché de disco.</li>\n<li><code>swapTotal</code> Integer <em>Windows</em> <em>Linux</em> - La cantidad total de memoria de swap en Kilobytes disponible para el sistema.</li>\n<li><code>swapFree</code> Integer <em>Windows</em> <em>Linux</em> - La cantidad libre de memoria de swap en Kilobytes disponible para el sistema.</li>\n</ul>\n<p>Returns an object giving memory usage statistics about the entire system. Note that all statistics are reported in Kilobytes.</p>\n<h3 id=\"processgetsystemversion\"><a href=\"#processgetsystemversion\"><code>process.getSystemVersion()</code></a></h3>\n<p>Devuelve <code>String</code> - La versión de sistema operativo del host.</p>\n<p>Ejemplo:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> version = process.getSystemVersion()\n<span class=\"hljs-built_in\">console</span>.log(version)\n<span class=\"hljs-comment\">// En macOS -> '10.13.6'</span>\n<span class=\"hljs-comment\">// En Windows -> '10.0.17763'</span>\n<span class=\"hljs-comment\">// En Linux -> '4.15.0-45-generic'</span>\n</code></pre>\n<p><strong>Note:</strong> Devuelve la versión actual del sistema en lugar de la versión del kernel en macOS deferente a <code>os.release()</code>.</p>\n<h3 id=\"processtakeheapsnapshotfilepath\"><a href=\"#processtakeheapsnapshotfilepath\"><code>process.takeHeapSnapshot(filePath)</code></a></h3>\n<ul>\n<li><code>filePath</code> String - Ruta al archivo de salida.</li>\n</ul>\n<p>Devuelve <code>Boolean</code> - Indica si la instantánea ha sido creada correctamente.</p>\n<p>Toma una instantánea de la pila V8 y la guarda en <code>filePath</code>.</p>\n<h3 id=\"processhang\"><a href=\"#processhang\"><code>process.hang()</code></a></h3>\n<p>Hace que el hilo principal del proceso actual se caiga.</p>\n<h3 id=\"processsetfdlimitmaxdescriptors-macos-linux\"><a href=\"#processsetfdlimitmaxdescriptors-macos-linux\"><code>process.setFdLimit(maxDescriptors)</code> <em>macOS</em> <em>Linux</em></a></h3>\n<ul>\n<li><code>maxDescriptors</code> Entero</li>\n</ul>\n<p>Ajusta el limite suave del descriptor del documento a <code>maxDescriptors</code> o el límite duro OS, cual sea menor para el proceso actual.</p>",
      "title": "process",
      "description": "Extensiones para el objeto process."
    },
    "/docs/api/structures/process-memory-info": {
      "locale": "es-ES",
      "slug": "process-memory-info",
      "href": "/docs/api/structures/process-memory-info",
      "crowdinFileId": "256481",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/process-memory-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"processmemoryinfo-object\"><a href=\"#processmemoryinfo-object\">ProcessMemoryInfo Object</a></h1>\n<ul>\n<li><code>residentSet</code> Integer <em>Linux</em> <em>Windows</em> - The amount of memory currently pinned to actual physical RAM in Kilobytes.</li>\n<li><code>private</code> Integer - The amount of memory not shared by other processes, such as JS heap or HTML content in Kilobytes.</li>\n<li><code>shared</code> Integer - The amount of memory shared between processes, typically memory consumed by the Electron code itself in Kilobytes.</li>\n</ul>",
      "title": "ProcessMemoryInfo Object",
      "description": ""
    },
    "/docs/api/structures/process-metric": {
      "locale": "es-ES",
      "slug": "process-metric",
      "href": "/docs/api/structures/process-metric",
      "crowdinFileId": "256483",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/process-metric.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"processmetric-object\"><a href=\"#processmetric-object\">ProcessMetric Object</a></h1>\n<ul>\n<li><code>pid</code> Integer - Process id of the process.</li>\n<li><code>type</code> String - Tipo de proceso. Uno de los siguiente valores:<ul>\n<li><code>Browser</code></li>\n<li><code>Tab</code></li>\n<li><code>Utility</code></li>\n<li><code>Zygote</code></li>\n<li><code>Sandbox helper</code></li>\n<li><code>GPU</code></li>\n<li><code>Pepper Plugin</code></li>\n<li><code>Pepper Plugin Broker</code></li>\n<li><code>Unknown</code></li>\n</ul></li>\n<li><code>serviceName</code> String (opcional) - El nombre no localizado del proceso.</li>\n<li><code>name</code> String (opcional) - El nombre del proceso. Examples for utility: <code>Audio Service</code>, <code>Content Decryption Module Service</code>, <code>Network Service</code>, <code>Video Capture</code>, etc.</li>\n<li><code>cpu</code> <a href=\"/docs/api/structures/cpu-usage\">CPUUsage</a> - CPU usage of the process.</li>\n<li><code>creationTime</code> Number - Creation time for this process. The time is represented as number of milliseconds since epoch. Since the <code>pid</code> can be reused after a process dies, it is useful to use both the <code>pid</code> and the <code>creationTime</code> to uniquely identify a process.</li>\n<li><code>memory</code> <a href=\"/docs/api/structures/memory-info\">MemoryInfo</a> - Memory information for the process.</li>\n<li><code>sandboxed</code> Boolean (optional) <em>macOS</em> <em>Windows</em> - Whether the process is sandboxed on OS level.</li>\n<li><code>integrityLevel</code> String (optional) <em>Windows</em> - One of the following values:<ul>\n<li><code>untrusted</code></li>\n<li><code>low</code></li>\n<li><code>medium</code></li>\n<li><code>high</code></li>\n<li><code>unknown</code></li>\n</ul></li>\n</ul>",
      "title": "ProcessMetric Object",
      "description": ""
    },
    "/docs/tutorial/process-model": {
      "locale": "es-ES",
      "slug": "process-model",
      "href": "/docs/tutorial/process-model",
      "crowdinFileId": "256233",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/process-model.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"modelo-de-proceso\"><a href=\"#modelo-de-proceso\">Modelo de proceso</a></h1>\n<p>Electron hereda su arquitectura multiprocesos de Chromium, lo que hace que la arquitectura del framework sea muy similar a la de un navegador web moderno. En esta guía, expondremos el conocimiento conceptual de Electron que aplicamos en el tutorial <a href=\"/docs/tutorial/quick-start\">quick-start-app</a>.</p>\n<h2 id=\"¿por-qué-no-un-proceso-único\"><a href=\"#¿por-qué-no-un-proceso-único\">¿Por qué no un proceso único?</a></h2>\n<p>Los navegadores web son aplicaciones increíblemente complejas. Aparte de su capacidad principal para mostrar el contenido Web, tienen muchas responsabilidades secundarias, como administrar múltiples ventanas (o pestañas) y cargar extensiones de terceros.</p>\n<p>En los comienzos, los navegadores usaban un solo proceso para todas estas funcionalidades. A pesar de que este patrón significaba menos sobrecarga para cada pestaña que estaba abierta, también significaba que un sitio web que se colgaba o dejaba de funcionar afectaba a todo el navegador.</p>\n<h2 id=\"el-modelo-multiproceso\"><a href=\"#el-modelo-multiproceso\">El modelo multiproceso</a></h2>\n<p>Para resolver este problema, el equipo de Chrome decidió que cada pestaña se renderizaría en su propio proceso, limitando el daño que código malicioso o con errores de una página web puede causar a la aplicación en su conjunto. Un único proceso de navegador controla estos procesos, así como el ciclo de vida de la aplicación en su conjunto. El siguiente diagrama de <a href=\"https://www.google.com/googlebooks/chrome/\">Chrome Comic</a> representa este modelo:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/chrome-processes.png\" alt=\"Chrome&#x27;s multi-process architecture\"></p>\n<p>Las aplicaciones que usan Electron están estructuradas de forma muy similar. Como programador de una App, controlas dos tipos de procesos: principal y renderizador. Estos son análogos al propio navegador de Chrome y a los procesos descritos anteriormente.</p>\n<h2 id=\"el-proceso-principal\"><a href=\"#el-proceso-principal\">El proceso principal</a></h2>\n<p>Each Electron app has a single main process, which acts as the application's entry point. The main process runs in a Node.js environment, meaning it has the ability to <code>require</code> modules and use all of Node.js APIs.</p>\n<h3 id=\"window-management\"><a href=\"#window-management\">Window management</a></h3>\n<p>The main process' primary purpose is to create and manage application windows with the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> module.</p>\n<p>Each instance of the <code>BrowserWindow</code> class creates an application window that loads a web page in a separate renderer process. You can interact with this web content from the main process using the window's <a href=\"/docs/api/web-contents\"><code>webContents</code></a> object.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> contents = win.webContents\n<span class=\"hljs-built_in\">console</span>.log(contents)\n</code></pre>\n<blockquote>\n<p>Note: A renderer process is also created for <a href=\"/docs/tutorial/web-embeds\">web embeds</a> such as the <code>BrowserView</code> module. The <code>webContents</code> object is also accessible for embedded web content.</p>\n</blockquote>\n<p>Because the <code>BrowserWindow</code> module is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\"><code>EventEmitter</code></a>, you can also add handlers for various user events (for example, minimizing or maximizing your window).</p>\n<p>When a <code>BrowserWindow</code> instance is destroyed, its corresponding renderer process gets terminated as well.</p>\n<h3 id=\"application-lifecycle\"><a href=\"#application-lifecycle\">Application lifecycle</a></h3>\n<p>The main process also controls your application's lifecycle through Electron's <a href=\"/docs/api/app\"><code>app</code></a> module. This module provides a large set of events and methods that you can use to add custom application behaviour (for instance, programatically quitting your application, modifying the application dock, or showing an About panel).</p>\n<p>As a practical example, the app shown in the <a href=\"/docs/tutorial/quick-start#manage-your-windows-lifecycle\">quick start guide</a> uses <code>app</code> APIs to create a more native application window experience.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// quitting the app when no windows are open on non-macOS platforms</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h3 id=\"apis-nativas\"><a href=\"#apis-nativas\">APIs nativas</a></h3>\n<p>To extend Electron's features beyond being a Chromium wrapper for web contents, the main process also adds custom APIs to interact with the user's operating system. Electron exposes various modules that control native desktop functionality, such as menus, dialogs, and tray icons.</p>\n<p>For a full list of Electron's main process modules, check out our API documentation.</p>\n<h2 id=\"the-renderer-process\"><a href=\"#the-renderer-process\">The renderer process</a></h2>\n<p>Each Electron app spawns a separate renderer process for each open <code>BrowserWindow</code> (and each web embed). As its name implies, a renderer is responsible for <em>rendering</em> web content. For all intents and purposes, code ran in renderer processes should behave according to web standards (insofar as Chromium does, at least).</p>\n<p>Therefore, all user interfaces and app functionality within a single browser window should be written with the same tools and paradigms that you use on the web.</p>\n<p>Although explaining every web spec is out of scope for this guide, the bare minimum to understand is:</p>\n<ul>\n<li>An HTML file is your entry point for the renderer process.</li>\n<li>UI styling is added through Cascading Style Sheets (CSS).</li>\n<li>Executable JavaScript code can be added through <code>&#x3C;script></code> elements.</li>\n</ul>\n<p>Moreover, this also means that the renderer has no direct access to <code>require</code> or other Node.js APIs. In order to directly include NPM modules in the renderer, you must use the same bundler toolchains (for example, <code>webpack</code> or <code>parcel</code>) that you use on the web.</p>\n<blockquote>\n<p>Note: Renderer processes can be spawned with a full Node.js environment for ease of development. Historically, this used to be the default, but this feature was disabled for security reasons.</p>\n</blockquote>\n<p>At this point, you might be wondering how your renderer process user interfaces can interact with Node.js and Electron's native desktop functionality if these features are only accessible from the main process. In fact, there is no direct way to import Electron's content scripts.</p>\n<h2 id=\"preload-scripts\"><a href=\"#preload-scripts\">Preload scripts</a></h2>\n<!-- Note: This guide doesn't take sandboxing into account, which might fundamentally \nchange the statements here. --> Los scripts de precarga contienen el código que se ejecuta en un proceso de renderizado antes de que su contenido web comience a cargar. Estos scripts se ejecutan dentro del contexto del renderizador, pero tienen más privilegios al poder acceder a las APIs de Node.js.\n<p>A preload script can be attached to the main process in the <code>BrowserWindow</code> constructor's <code>webPreferences</code> option.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">//...</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">preload</span>: <span class=\"hljs-string\">'path/to/preload.js'</span>\n  }\n})\n<span class=\"hljs-comment\">//...</span>\n</code></pre>\n<p>Because the preload script shares a global <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window\"><code>Window</code></a> interface with the renderers and can access Node.js APIs, it serves to enhance your renderer by exposing arbitrary APIs in the <code>window</code> global that your web contents can then consume.</p>\n<p>Although preload scripts share a <code>window</code> global with the renderer they're attached to, you cannot directly attach any variables from the preload script to <code>window</code> because of the <a href=\"/docs/tutorial/context-isolation\"><code>contextIsolation</code></a> default.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.myAPI = {\n  <span class=\"hljs-attr\">desktop</span>: <span class=\"hljs-literal\">true</span>\n}\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-built_in\">window</span>.myAPI)\n<span class=\"hljs-comment\">// => undefined</span>\n</code></pre>\n<p>Context Isolation means that preload scripts are isolated from the renderer's main world to avoid leaking any privileged APIs into your web content's code.</p>\n<p>Instead, use the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> module to accomplish this securely:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">desktop</span>: <span class=\"hljs-literal\">true</span>\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-built_in\">window</span>.myAPI)\n<span class=\"hljs-comment\">// => { desktop: true }</span>\n</code></pre>\n<p>This feature is incredibly useful for two main purposes:</p>\n<ul>\n<li>By exposing <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> helpers to the renderer, you can use inter-process communication (IPC) to trigger main process tasks from the renderer (and vice-versa).</li>\n<li>If you're developing an Electron wrapper for an existing web app hosted on a remote URL, you can add custom properties onto the renderer's <code>window</code> global that can be used for desktop-only logic on the web client's side.</li>\n</ul>",
      "title": "Modelo de proceso",
      "description": "Note: A renderer process is also created for web embeds such as the BrowserView module. The webContents object is also accessible for embedded web content."
    },
    "/docs/api/structures/product": {
      "locale": "es-ES",
      "slug": "product",
      "href": "/docs/api/structures/product",
      "crowdinFileId": "256485",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/product.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"product-object\"><a href=\"#product-object\">Product Object</a></h1>\n<ul>\n<li><code>productIdentifier</code> String - The string that identifies the product to the Apple App Store.</li>\n<li><code>localizedDescription</code> String - A description of the product.</li>\n<li><code>localizedTitle</code> String - The name of the product.</li>\n<li><code>contentVersion</code> String - A string that identifies the version of the content.</li>\n<li><code>contentLengths</code> Number[] - The total size of the content, in bytes.</li>\n<li><code>price</code> Number - The cost of the product in the local currency.</li>\n<li><code>formattedPrice</code> String - The locale formatted price of the product.</li>\n<li><code>currencyCode</code> String - 3 character code presenting a product's currency based on the ISO 4217 standard.</li>\n<li><code>isDownloadable</code> Boolean - A Boolean value that indicates whether the App Store has downloadable content for this product. <code>true</code> if at least one file has been associated with the product.</li>\n</ul>",
      "title": "Product Object",
      "description": ""
    },
    "/docs/tutorial/progress-bar": {
      "locale": "es-ES",
      "slug": "progress-bar",
      "href": "/docs/tutorial/progress-bar",
      "crowdinFileId": "256235",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/progress-bar.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"taskbar-progress-bar-windows--macos\"><a href=\"#taskbar-progress-bar-windows--macos\">Taskbar Progress Bar (Windows &#x26; macOS)</a></h1>\n<h2 id=\"descripción-general\"><a href=\"#descripción-general\">Descripción general</a></h2>\n<p>Un progress bar le permite a una ventana proveer información de progreso al usuario sin necesidad de cambiar a la propia ventana.</p>\n<p>En Windows puede usar un taskbar button para mostrar un progress bar.</p>\n<p>![Barra de Progreso de Windows][<a href=\"https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png%5C\">https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png\\</a>]</p>\n<p>En macOS, el progress bar será mostrado como parte del dock icon.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/macos-progress-bar.png\" alt=\"Barra de progreso de macOS\"></p>\n<p>En Linux, la interfaz gráfica Unity además tiene una característica similar que le permite especificar el progress bar en en el lanzador.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/linux-progress-bar.png\" alt=\"Barra de progreso de Linux\"></p>\n<blockquote>\n<p>NOTA: en Windows, cada ventana tiene su propio progress bar, mientras que en macOS y Linux(Unity)  puede haber un solo progress bar para la aplicación.</p>\n</blockquote>\n<hr>\n<p>Los tres casos son cubiertos por la misma API - el método <a href=\"/docs/api/browser-window#winsetprogressbarprogress-options\"><code>setProgressBar()</code></a> disponible en una instancia de <code>BrowserWindow</code>. Para indicar tu progreso, invoca este método con un número entre <code>0</code> y <code>1</code>. Por ejemplo, si tiene una tarea de larga ejecución que actualmente esta al 63% para completar, debería llamarlo como <code>setProgressBar(0.63)</code>.</p>\n<p>Setting the parameter to negative values (e.g. <code>-1</code>) will remove the progress bar. Setting it to a value greater than <code>1</code> will indicate an indeterminate progress bar in Windows or clamp to 100% in other operating systems. Una barra de progreso indeterminada permanece activa pero no muestra un porcentaje real, y se utiliza para situaciones cuando no sabe cuánto tardará una operación en completarse.</p>\n<p>Ver el <a href=\"/docs/api/browser-window#winsetprogressbarprogress-options\">API documentation for more options and modes</a>.</p>\n<h2 id=\"ejemplo\"><a href=\"#ejemplo\">Ejemplo</a></h2>\n<p>In this example, we add a progress bar to the main window that increments over time using Node.js timers.</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/progress-bar\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> progressInterval\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-keyword\">const</span> INCREMENT = <span class=\"hljs-number\">0.03</span>\n  <span class=\"hljs-keyword\">const</span> INTERVAL_DELAY = <span class=\"hljs-number\">100</span> <span class=\"hljs-comment\">// ms</span>\n\n  <span class=\"hljs-keyword\">let</span> c = <span class=\"hljs-number\">0</span>\n  progressInterval = setInterval(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// update progress bar to next value</span>\n    <span class=\"hljs-comment\">// values between 0 and 1 will show progress, >1 will show indeterminate or stick at 100%</span>\n    win.setProgressBar(c)\n\n    <span class=\"hljs-comment\">// increment or reset progress bar</span>\n    <span class=\"hljs-keyword\">if</span> (c &#x3C; <span class=\"hljs-number\">2</span>) c += INCREMENT\n    <span class=\"hljs-keyword\">else</span> c = <span class=\"hljs-number\">0</span>\n  }, INTERVAL_DELAY)\n}\n\napp.whenReady().then(createWindow)\n\n<span class=\"hljs-comment\">// before the app is terminated, clear both timers</span>\napp.on(<span class=\"hljs-string\">'before-quit'</span>, () => {\n  clearInterval(progressInterval)\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<p>Después de lanzar la aplicación Electron, el Dock (macOS) o la barra de tareas (Windows, Unity) deben mostrar una barra de progreso que comience en cero y progrese hasta el 100% hasta completarse. Luego debe mostrar indeterminado (Windows) o anclar a 100% (otros sistemas operativos) brevemente y luego bucle.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/dock-progress-bar.png\" alt=\"macOS dock progress bar\"></p>\n<p>Para macOS, el progress bar también será indicado para su aplicación cuando utilice <a href=\"https://support.apple.com/en-us/HT204100\">Mission Control</a>:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/mission-control-progress-bar.png\" alt=\"Barra de progreso de Control de Misión\"></p>",
      "title": "Taskbar Progress Bar (Windows & macOS)",
      "description": "NOTA: en Windows, cada ventana tiene su propio progress bar, mientras que en macOS y Linux(Unity)  puede haber un solo progress bar para la aplicación."
    },
    "/docs/api/protocol": {
      "locale": "es-ES",
      "slug": "protocol",
      "href": "/docs/api/protocol",
      "crowdinFileId": "256357",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/protocol.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocol\"><a href=\"#protocol\">protocol</a></h1>\n<blockquote>\n<p>Registrar un protocolo personalizado e interceptar las peticiones de protocolo existentes.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p>Un ejemplo de la implementación de un protocolo que tiene el mismo efecto que el protocolo <code>file://</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })\n})\n</code></pre>\n<p><strong>Nota:</strong> Todos los métodos salvo los especificados pueden ser usados solo después de que el evento <code>listo</code> del módulo de la <code>aplicación</code> sea emitido.</p>\n<h2 id=\"usando-protocol-con-una-partition-o-session-personalizada\"><a href=\"#usando-protocol-con-una-partition-o-session-personalizada\">Usando <code>protocol</code> con una <code>partition</code> o <code>session</code> personalizada</a></h2>\n<p>Un protocolo está registrado en un objeto <a href=\"/docs/api/session\"><code>session</code></a> específico de Electron. Si no especificas una sesión, entonces tu <code>protocol</code> será aplicado a la sesión por defecto que Electron. Sin embargo, si defines un <code>partition</code> o <code>session</code> en tu <code>webPreferences</code> del <code>browserWindow</code>, luego esa ventana usará una sesión diferente y tu protocolo personalizado no funcionará si solo usas <code>electron.protocol.XXX</code>.</p>\n<p>Para tener su protocolo personalizado trabajando con una sesión personalizada, necesitas registrarlo a esa sesión explícitamente.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session, app, protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> partition = <span class=\"hljs-string\">'persist:example'</span>\n  <span class=\"hljs-keyword\">const</span> ses = session.fromPartition(partition)\n\n  ses.protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })\n\n  mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { partition } })\n})\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>protocolo</code> tiene los siguientes métodos:</p>\n<h3 id=\"protocolregisterschemesasprivilegedcustomschemes\"><a href=\"#protocolregisterschemesasprivilegedcustomschemes\"><code>protocol.registerSchemesAsPrivileged(customSchemes)</code></a></h3>\n<ul>\n<li><code>customSchemes</code> <a href=\"/docs/api/structures/custom-scheme\">CustomScheme[]</a></li>\n</ul>\n<p><strong>Note:</strong> Este método solo puede ser usado antes de que el evento <code>ready</code> del modulo <code>app</code> sea emitido y solo puede ser llamado una vez.</p>\n<p>Registers the <code>scheme</code> as standard, secure, bypasses content security policy for resources, allows registering ServiceWorker, supports fetch API, and streaming video/audio. Specify a privilege with the value of <code>true</code> to enable the capability.</p>\n<p>Un ejemplo de registro de un esquema privilegiado, que elude la Política de Seguridad Contenido:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nprotocol.registerSchemesAsPrivileged([\n  { <span class=\"hljs-attr\">scheme</span>: <span class=\"hljs-string\">'foo'</span>, <span class=\"hljs-attr\">privileges</span>: { <span class=\"hljs-attr\">bypassCSP</span>: <span class=\"hljs-literal\">true</span> } }\n])\n</code></pre>\n<p>Un esquema estandar se adhiere a lo que el RFC3986 llama <a href=\"https://tools.ietf.org/html/rfc3986#section-3\">Sintaxis URI genérica</a>. Por ejemplo <code>http</code> y <code>https</code> son esquemas estándar, mientras <code>archivo</code> no lo es.</p>\n<p>Registrar un esquema como estándar, permite a recursos relativos y absolutos ser resueltos correctamente cuando son servidos. De otra manera el esquema se comportaría como el protocolo <code>archivo</code>, pero sin la habilidad de resolver URLs relativas.</p>\n<p>Por ejemplo cuando usted carga la siguiente carga con un protocolo personalizado sin registrar como un esquema estándar, esta imagen no será cargada debido a que un esquema que no es estandar puede no reconocer URLs relativas:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">img</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">'test.png'</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n</code></pre>\n<p>Registrar un esquema como estándar puede permitir el acceso a los archivos a través<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/LocalFileSystem\">API FileSystem</a>. De otra manera el renderizador arrojará un error de seguridad en el sistema.</p>\n<p>Por defecto las apis de web storage (localStorage, sessionStorage, webSQL, indexedDB, cookies) están deshabilitadas para esquemas no estándares. Así que en general, si quieres registrar un protocolo personalizado para reemplazar el protocolo <code>http</code>, tienes que registrarlo como un esquema estándar.</p>\n<p>Protocols that use streams (http and stream protocols) should set <code>stream: true</code>. The <code>&#x3C;video></code> and <code>&#x3C;audio></code> HTML elements expect protocols to buffer their responses by default. The <code>stream</code> flag configures those elements to correctly expect streaming responses.</p>\n<h3 id=\"protocolregisterfileprotocolscheme-handler\"><a href=\"#protocolregisterfileprotocolscheme-handler\"><code>protocol.registerFileProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Función<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Función<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registra un protocolo de <code>scheme</code> que enviará un archivo como repuesta. El <code>handler</code> será llamado con <code>request</code> y <code>callback</code> donde <code>request</code> es una solicitud entrante para el <code>scheme</code>.</p>\n<p>Para controlar la <code>solicitud</code>, la <code>retrollamada</code> debe ser llamada con la ruta al archivo o un objeto que tiene una propiedad <code>ruta</code>, ejemplo <code>callback(filePath)</code> o <code>callback({ path: filePath })</code>. El <code>filePath</code> debe ser una ruta absoluta.</p>\n<p>Por defecto el <code>scheme</code> es tratado como <code>http:</code>, que es analizado de forma diferente que los protocolos que siguen la \"generic URI syntax\" como <code>file:</code>.</p>\n<h3 id=\"protocolregisterbufferprotocolscheme-handler\"><a href=\"#protocolregisterbufferprotocolscheme-handler\"><code>protocol.registerBufferProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Función<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Función<ul>\n<li><code>response</code> (Buffer | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registra un protocolo de <code>esquema</code> que enviará un <code>Buffer</code> como respuesta.</p>\n<p>El uso es el mismo con <code>registerFileProtocol</code>, excepto que el <code>callback</code> debería ser llamado con un objeto <code>Buffer</code> o un objeto que tiene la propiedad <code>data</code>.</p>\n<p>Ejemplo:</p>\n<pre><code class=\"hljs language-javascript\">protocol.registerBufferProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback({ <span class=\"hljs-attr\">mimeType</span>: <span class=\"hljs-string\">'text/html'</span>, <span class=\"hljs-attr\">data</span>: Buffer.from(<span class=\"hljs-string\">'&#x3C;h5>Response&#x3C;/h5>'</span>) })\n})\n</code></pre>\n<h3 id=\"protocolregisterstringprotocolscheme-handler\"><a href=\"#protocolregisterstringprotocolscheme-handler\"><code>protocol.registerStringProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Función<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Función<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registra un protocolo de <code>esquema</code> que enviará una <code>cadena</code> como respuesta.</p>\n<p>El uso es el mismo con <code>registerFileProtocol</code>, excepto que el <code>callback</code> debería ser llamado con un objeto <code>String</code> o un objeto que tiene la propiedad <code>data</code>.</p>\n<h3 id=\"protocolregisterhttpprotocolscheme-handler\"><a href=\"#protocolregisterhttpprotocolscheme-handler\"><code>protocol.registerHttpProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Función<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Función<ul>\n<li><code>response</code> ProtocolResponse</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registra un protocolo de <code>esquema</code> que enviará una solicitud HTTP como respuesta.</p>\n<p>El uso es el mismo con <code>registerFileProtocol</code>, excepto que el <code>callback</code> debería ser llamado con un objeto que tiene la propiedad <code>url</code>.</p>\n<h3 id=\"protocolregisterstreamprotocolscheme-handler\"><a href=\"#protocolregisterstreamprotocolscheme-handler\"><code>protocol.registerStreamProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Función<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Función<ul>\n<li><code>response</code> (ReadableStream | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registra un protocolo de <code>scheme</code> que enviará un stream como respuesta.</p>\n<p>El uso es el mismo con <code>registerFileProtocol</code>, excepto que el <code>callback</code> debería ser llamado con un objeto <a href=\"https://nodejs.org/api/stream.html#stream_class_stream_readable\"><code>ReadableStream</code></a> o un objeto que tiene la propiedad <code>data</code>.</p>\n<p>Ejemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { PassThrough } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'stream'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createStream</span> (<span class=\"hljs-params\">text</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> rv = <span class=\"hljs-keyword\">new</span> PassThrough() <span class=\"hljs-comment\">// PassThrough is also a Readable stream</span>\n  rv.push(text)\n  rv.push(<span class=\"hljs-literal\">null</span>)\n  <span class=\"hljs-keyword\">return</span> rv\n}\n\nprotocol.registerStreamProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback({\n    <span class=\"hljs-attr\">statusCode</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">headers</span>: {\n      <span class=\"hljs-string\">'content-type'</span>: <span class=\"hljs-string\">'text/html'</span>\n    },\n    <span class=\"hljs-attr\">data</span>: createStream(<span class=\"hljs-string\">'&#x3C;h5>Response&#x3C;/h5>'</span>)\n  })\n})\n</code></pre>\n<p>Es posible pasar cualquier objeto que implementa la API readable stream (emite los eventos <code>data</code>/<code>end</code>/<code>error</code>). Por ejemplo, aquí está como puede devolver un archivo:</p>\n<pre><code class=\"hljs language-javascript\">protocol.registerStreamProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback(fs.createReadStream(<span class=\"hljs-string\">'index.html'</span>))\n})\n</code></pre>\n<h3 id=\"protocolunregisterprotocolscheme\"><a href=\"#protocolunregisterprotocolscheme\"><code>protocol.unregisterProtocol(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully unregistered</p>\n<p>Anula el registro del protocolo predeterminado de <code>esquema</code>.</p>\n<h3 id=\"protocolisprotocolregisteredscheme\"><a href=\"#protocolisprotocolregisteredscheme\"><code>protocol.isProtocolRegistered(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Devuelve <code>Boolean</code> - Si el <code>scheme</code> ya está registrado.</p>\n<h3 id=\"protocolinterceptfileprotocolscheme-handler\"><a href=\"#protocolinterceptfileprotocolscheme-handler\"><code>protocol.interceptFileProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Función<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Función<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepta el protocolo <code>esquema</code> y usa <code>controlador</code> como el controlador del nuevo protocolo lo cual enviará un archivo como respuesta.</p>\n<h3 id=\"protocolinterceptstringprotocolscheme-handler\"><a href=\"#protocolinterceptstringprotocolscheme-handler\"><code>protocol.interceptStringProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Función<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Función<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepta el protocolo <code>esquema</code> y usa <code>controlador</code> como el nuevo controlador de protocolo, lo cual envía una <code>Cadena</code> como respuesta.</p>\n<h3 id=\"protocolinterceptbufferprotocolscheme-handler\"><a href=\"#protocolinterceptbufferprotocolscheme-handler\"><code>protocol.interceptBufferProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Función<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Función<ul>\n<li><code>response</code> (Buffer | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepta el protocolo de <code>scheme</code> y usa el <code>handler</code> como el nuevo manejador del protocolo, el cual envía un <code>Buffer</code> como respuesta.</p>\n<h3 id=\"protocolintercepthttpprotocolscheme-handler\"><a href=\"#protocolintercepthttpprotocolscheme-handler\"><code>protocol.interceptHttpProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Función<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Función<ul>\n<li><code>response</code> <a href=\"/docs/api/structures/protocol-response\">Respuesta de Protocolo</a></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepta el protocolo <code>scheme</code> y utiliza el <code>handler</code> como el nuevo controlador del protocolo, el cual envía una nueva solicitud HTTP como respuesta.</p>\n<h3 id=\"protocolinterceptstreamprotocolscheme-handler\"><a href=\"#protocolinterceptstreamprotocolscheme-handler\"><code>protocol.interceptStreamProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Función<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Función<ul>\n<li><code>response</code> (ReadableStream | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Mismo que <code>protocol.registerStreamProtocol</code>, excepto que reemplaza un manejador de protocolo existente.</p>\n<h3 id=\"protocoluninterceptprotocolscheme\"><a href=\"#protocoluninterceptprotocolscheme\"><code>protocol.uninterceptProtocol(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully unintercepted</p>\n<p>Elimina el interceptor instalado para el <code>scheme</code> y restaura su controlador original.</p>\n<h3 id=\"protocolisprotocolinterceptedscheme\"><a href=\"#protocolisprotocolinterceptedscheme\"><code>protocol.isProtocolIntercepted(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Devuelve <code>Boolean</code> - Si el <code>scheme</code> ya está interceptado.</p>",
      "title": "protocol",
      "description": "Registrar un protocolo personalizado e interceptar las peticiones de protocolo existentes."
    },
    "/docs/api/structures/protocol-request": {
      "locale": "es-ES",
      "slug": "protocol-request",
      "href": "/docs/api/structures/protocol-request",
      "crowdinFileId": "256487",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-request.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolrequest-object\"><a href=\"#protocolrequest-object\">ProtocolRequest Object</a></h1>\n<ul>\n<li><code>url</code> String</li>\n<li><code>referrer</code> String</li>\n<li><code>method</code> String</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/upload-data\">UploadData[]</a> (optional)</li>\n<li><code>headers</code> Record&#x3C;String, String></li>\n</ul>",
      "title": "ProtocolRequest Object",
      "description": ""
    },
    "/docs/api/structures/protocol-response": {
      "locale": "es-ES",
      "slug": "protocol-response",
      "href": "/docs/api/structures/protocol-response",
      "crowdinFileId": "256491",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-response.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolresponse-object\"><a href=\"#protocolresponse-object\">ProtocolResponse Object</a></h1>\n<ul>\n<li><code>error</code> Integer (optional) - When assigned, the <code>request</code> will fail with the <code>error</code> number . For the available error numbers you can use, please see the <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">net error list</a>.</li>\n<li><code>statusCode</code> Number (optional) - The HTTP response code, default is 200.</li>\n<li><code>charset</code> String (optional) - The charset of response body, default is <code>\"utf-8\"</code>.</li>\n<li><code>mimeType</code> String (optional) - The MIME type of response body, default is <code>\"text/html\"</code>. Setting <code>mimeType</code> would implicitly set the <code>content-type</code> header in response, but if <code>content-type</code> is already set in <code>headers</code>, the <code>mimeType</code> would be ignored.</li>\n<li><code>headers</code> Record&#x3C;string, string | string[]> (optional) - An object containing the response headers. The keys must be String, and values must be either String or Array of String.</li>\n<li><code>data</code> (Buffer | String | ReadableStream) (optional) - The response body. When returning stream as response, this is a Node.js readable stream representing the response body. When returning <code>Buffer</code> as response, this is a <code>Buffer</code>. When returning <code>String</code> as response, this is a <code>String</code>. This is ignored for other types of responses.</li>\n<li><code>path</code> String (optional) - Path to the file which would be sent as response body. This is only used for file responses.</li>\n<li><code>url</code> String (optional) - Download the <code>url</code> and pipe the result as response body. This is only used for URL responses.</li>\n<li><code>referrer</code> String (optional) - The <code>referrer</code> URL. This is only used for file and URL responses.</li>\n<li><code>method</code> String (optional) - The HTTP <code>method</code>. This is only used for file and URL responses.</li>\n<li><code>session</code> Session (optional) - The session used for requesting URL, by default the HTTP request will reuse the current session. Setting <code>session</code> to <code>null</code> would use a random independent session. This is only used for URL responses.</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/protocol-response-upload-data\">ProtocolResponseUploadData</a> (optional) - The data used as upload data. This is only used for URL responses when <code>method</code> is <code>\"POST\"</code>.</li>\n</ul>",
      "title": "ProtocolResponse Object",
      "description": ""
    },
    "/docs/api/structures/protocol-response-upload-data": {
      "locale": "es-ES",
      "slug": "protocol-response-upload-data",
      "href": "/docs/api/structures/protocol-response-upload-data",
      "crowdinFileId": "256489",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-response-upload-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolresponseuploaddata-object\"><a href=\"#protocolresponseuploaddata-object\">ProtocolResponseUploadData Object</a></h1>\n<ul>\n<li><code>contentType</code> String - MIME type of the content.</li>\n<li><code>data</code> String | Buffer - Content to be sent.</li>\n</ul>",
      "title": "ProtocolResponseUploadData Object",
      "description": ""
    },
    "/docs/development/pull-requests": {
      "locale": "es-ES",
      "slug": "pull-requests",
      "href": "/docs/development/pull-requests",
      "crowdinFileId": "256163",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/pull-requests.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"pull-requests\"><a href=\"#pull-requests\">Pull Requests</a></h1>\n<ul>\n<li><a href=\"#setting-up-your-local-environment\">Configurando tu entorno local</a><ul>\n<li><a href=\"#step-1-fork\">Paso 1: Fork</a></li>\n<li><a href=\"#step-2-build\">Paso 2: Compilado</a></li>\n<li><a href=\"#step-3-branch\">Paso 3: Rama</a></li>\n</ul></li>\n<li><a href=\"#making-changes\">Haciendo Cambios</a><ul>\n<li><a href=\"#step-4-code\">Paso 4: Código</a></li>\n<li><a href=\"#step-5-commit\">Paso 5: Commit</a><ul>\n<li><a href=\"#commit-message-guidelines\">Directrices de mensaje commit</a></li>\n</ul></li>\n<li><a href=\"#step-6-rebase\">Paso 6: Reorganizar</a></li>\n<li><a href=\"#step-7-test\">Paso 7: Prueba</a></li>\n<li><a href=\"#step-8-push\">Paso 8: Push</a></li>\n<li><a href=\"#step-9-opening-the-pull-request\">Paso 9: Abriendo el Pull Request</a></li>\n<li><a href=\"#step-10-discuss-and-update\">Paso 10: Analizar y actualizar</a><ul>\n<li><a href=\"#approval-and-request-changes-workflow\">Aprobación y Solicitud de Cambios de Workflow</a></li>\n</ul></li>\n<li><a href=\"#step-11-landing\">Paso 11: Ejecutado</a></li>\n<li><a href=\"#continuous-integration-testing\">Prueba de Integración Continua</a></li>\n</ul></li>\n</ul>\n<h2 id=\"configurando-tu-entorno-local\"><a href=\"#configurando-tu-entorno-local\">Configurando tu entorno local</a></h2>\n<h3 id=\"paso-1-fork\"><a href=\"#paso-1-fork\">Paso 1: Fork</a></h3>\n<p>Haga Fork del proyecto <a href=\"https://github.com/electron/electron\">on GitHub</a> y clone su fork localmente.</p>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:username/electron.git\n$ <span class=\"hljs-built_in\">cd</span> electron\n$ git remote add upstream https://github.com/electron/electron.git\n$ git fetch upstream\n</code></pre>\n<h3 id=\"paso-2-compilado\"><a href=\"#paso-2-compilado\">Paso 2: Compilado</a></h3>\n<p>Pasos de compilado y dependencias difieren ligeramente dependiendo de su sistema operativo. Ver estas guías detalladas en compilacion local de Electron:</p>\n<ul>\n<li><a href=\"/docs/development/build-instructions-macos\">Compilando en macOS</a></li>\n<li><a href=\"/docs/development/build-instructions-linux\">Compilado en Linux</a></li>\n<li><a href=\"/docs/development/build-instructions-windows\">Compilado en Windows</a></li>\n</ul>\n<p>Una vez que has compilado el proyecto localmente, ¡Estas listo para empezar a hacer cambios!</p>\n<h3 id=\"paso-3-rama\"><a href=\"#paso-3-rama\">Paso 3: Rama</a></h3>\n<p>Para mantener tu entorno de desarrollo organizado, crea ramas locales para retener tu trabajo. Estos deben ser ramificados directamente de la rama <code>main</code>.</p>\n<pre><code class=\"hljs language-sh\">$ git checkout -b mi-rama -t upstream/main\n</code></pre>\n<h2 id=\"haciendo-cambios\"><a href=\"#haciendo-cambios\">Haciendo Cambios</a></h2>\n<h3 id=\"paso-4-código\"><a href=\"#paso-4-código\">Paso 4: Código</a></h3>\n<p>La mayoría de los pull requests abiertos contra el repositorio <code>electron/electron</code> incluyen cambios al código C/C++ ne la carpeta <code>shell/</code>, el código JavaScript en la carpeta <code>lib/</code>, la documentación en <code>docs/api/</code> o a los tests en la carpeta <code>spec/</code>.</p>\n<p>Por favor asegúrate de correr <code>npm run lint</code> de vez en cuando en cualquier cambio de código para asegurar que estos siguen el estilo de código del proyecto.</p>\n<p>Ver <a href=\"/docs/development/coding-style\">estilo de codificación</a> para mas información acerca de la mejor práctica cuando se esta modificando el código en diferentes partes del proyecto.</p>\n<h3 id=\"paso-5-commit\"><a href=\"#paso-5-commit\">Paso 5: Commit</a></h3>\n<p>Se le recomienda mantener sus cambios agrupados lógicamente dentro de commits individuales. Muchos contribuyentes encuentras mas fácil el revisar los cambios que son divididos entre multiples commits. No hay límite en el número de commits en un pull request.</p>\n<pre><code class=\"hljs language-sh\">$ git add my/changed/files\n$ git commit\n</code></pre>\n<p>Tenga en cuenta que multiples commits a menudo colisionan cuando son ejecutadas.</p>\n<h4 id=\"directrices-de-mensaje-commit\"><a href=\"#directrices-de-mensaje-commit\">Directrices de mensaje commit</a></h4>\n<p>Un buen mensaje de commit debe describir que ha cambiado y por qué. El proyecto Electron usa <a href=\"https://conventionalcommits.org/\">semantic commit messages</a> para racionalizar el proceso de lanzamiento.</p>\n<p>Antes de que una solicitud de pull pueda ser fusionada, <strong>debe</strong> tener un título de pull request con un prefijo semántico.</p>\n<p>Ejemplos de mensajes de confirmación con prefijos semánticos:</p>\n<ul>\n<li><code>fix: don't overwrite prevent_default if default wasn't prevented</code></li>\n<li><code>feat: add app.isPackaged() method</code></li>\n<li><code>docs: app.isDefaultProtocolClient is now available on Linux</code></li>\n</ul>\n<p>Prefijos usuales:</p>\n<ul>\n<li>fix: Una corrección de error</li>\n<li>feat: Una nueva característica</li>\n<li>docs: Cambios en la documentación</li>\n<li>test: Agrega pruebas faltantes o corrige las pruebas exixtentes</li>\n<li>build: Cambios que afectan el sistema de construccion</li>\n<li>ci: Cambios a nuestros archivos de configuración y scripts CI</li>\n<li>perf: Un cambio en el código que mejora el rendimiento</li>\n<li>refactor: Un cambio en el código que no corrige un error ni agrega una característica</li>\n<li>style: Cambios que no afectan el significado del código (linting)</li>\n</ul>\n<p>Otras cosas para tener en mente cuando se escribe un mensaje de commit:</p>\n<ol>\n<li>La primera linea debe:<ul>\n<li>contener una breve descripción del cambio (preferiblemente de 50 caracteres o menos, y no más de 72 caracteres)</li>\n<li>estar completamente en minúsculas con la excepción de nombres propios, acrónimos, y las palabras que refieren a un código, como nombres de función/variables</li>\n</ul></li>\n<li>Mantén la segunda linea vacía.</li>\n<li>Ajuste todas las otras linea en 72 columnas.</li>\n</ol>\n<h4 id=\"restaurar-archivos-borrados\"><a href=\"#restaurar-archivos-borrados\">Restaurar archivos borrados</a></h4>\n<p>Un commit que tiene el texto <code>BREAKING CHANGE:</code> al principio de su sección opcional de cuerpo o pie de página introduce un cambio de ruptura en el API (correlacionando con el Major en versionado semántico). Un cambio de ruptura puede ser parte de los commits de cualquier tipo. ejemplo, los tipos <code>fix:</code>, <code>feat:</code> &#x26; <code>chore:</code> serían válidos, ademas de cualquier otro tipo.</p>\n<p>Vea <a href=\"https://conventionalcommits.org\">conventionalcommits.org</a> para más detalles.</p>\n<h3 id=\"paso-6-reorganizar\"><a href=\"#paso-6-reorganizar\">Paso 6: Reorganizar</a></h3>\n<p>Una vez hayas asignado tus cambios, es una buena idea el usar <code>git rebase</code> (no <code>git merge</code>) para sincronizar tu trabajo con el repositorio principal.</p>\n<pre><code class=\"hljs language-sh\">$ git fetch upstream\n$ git rebase upstream/main\n</code></pre>\n<p>Esto asegura que tu rama de trabajo tiene los últimos cambios de la rama principal <code>electron/electron</code>.</p>\n<h3 id=\"paso-7-prueba\"><a href=\"#paso-7-prueba\">Paso 7: Prueba</a></h3>\n<p>Las características y reparaciones de un error deben siempre ser dadas con pruebas. Una <a href=\"/docs/development/testing\">guía de prueba</a> ha sido proporcionado para facilitar el proceso. Mirar otras pruebas para ver como deberían ser estructuradas también puede ayudar.</p>\n<p>Antes de enviar tus cambios en una pull request, siempre ejecute el paquete completo de pruebas. Para ejecutar las pruebas:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>Asegúrese de que el linter no reporta ningún inconveniente y que pasa todas pruebas. Por favor no envíe parches que fallan en cualquiera de las verificaciones.</p>\n<p>Si usted esta actualizando pruebas y quiere correr un simple especificación para probarlas:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span> -match=menu\n</code></pre>\n<p>Lo anterior solo podrá ejecutar módulos específicos coincidentes <code>menu</code>, el cual es útil para cualquiera que esta trabajando en pruebas que podrían de lo contrario estar al final de un ciclo de prueba.</p>\n<h3 id=\"paso-8-push\"><a href=\"#paso-8-push\">Paso 8: Push</a></h3>\n<p>Una vez que tus commits están listos -- ya pasadas las pruebas y el linting -- comienza el proceso de apertura de un pull request haciendo un push de tu rama de trabajo a tu fork en GitHub.</p>\n<pre><code class=\"hljs language-sh\">$ git push origin my-branch\n</code></pre>\n<h3 id=\"paso-9-abriendo-el-pull-request\"><a href=\"#paso-9-abriendo-el-pull-request\">Paso 9: Abriendo el Pull Request</a></h3>\n<p>Desde dentro de GitHub, abrir una nueva pull request te presentará con una plantilla que debe ser llenada:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"xml\"><span class=\"hljs-comment\">&#x3C;!--\nThank you for your pull request. Please provide a description above and review\nthe requirements below.\n\nBug fixes and new features should include tests and possibly benchmarks.\n\nContributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.md\n--></span></span>\n</code></pre>\n<h3 id=\"paso-10-analizar-y-actualizar\"><a href=\"#paso-10-analizar-y-actualizar\">Paso: 10: Analizar y actualizar</a></h3>\n<p>Probablemente recibirás críticas o peticiones de cambios a tu pull request. ¡Esta es una gran parte del proceso de envío así que no te desanimes! Algunos contribuyentes pueden inmediatamente desistir del pull request. Otros pueden tener comentarios o críticas detalladas. Esto es una parte necesaria del proceso con el fin de evaluar si los cambios son correctos y necesarios.</p>\n<p>Para realizar cambios a un pull request existente, realiza los cambios a tu rama loca, añade una nuevo commit con esos cambios, y haz a este nuevo commit un push hacia tu fork. GitHub actualizará automáticamente el pull request.</p>\n<pre><code class=\"hljs language-sh\">$ git add my/changed/files\n$ git commit\n$ git push origin my-branch\n</code></pre>\n<p>Existe un número de mecanismos mas avanzados para gestionar commits usando <code>git rebase</code> que puede ser usado, pero esta mas allá del alcance de esta guía.</p>\n<p>Siéntete libre de postear un comentario en el pull request para avisar a los críticos si estas esperando una respuesta en algo. Si encuentras palabras o acrónimos que parecen desconocidas, consulte este <a href=\"https://sites.google.com/a/chromium.org/dev/glossary\">glosario</a>.</p>\n<h4 id=\"aprobación-y-solicitud-de-cambios-de-workflow\"><a href=\"#aprobación-y-solicitud-de-cambios-de-workflow\">Aprobación y Solicitud de Cambios de Workflow</a></h4>\n<p>Todas las pull requests requieren de aprobación por parte de un <a href=\"https://github.com/electron/electron/blob/main/.github/CODEOWNERS\">Propietario de Códico</a> del área que modificaste para aterrizar. Cada vez que un mantenedor revisa un pull request ellos pueden solicitar cambios. Estos pueden ser pequeños, tales como corregir un error tipográfico o puede implicar cambios sustanciales. Se espera que sean útiles, pero puede que a veces no lo sean, especialmente si no incluyen sugerencias concretas sobre <em>cómo</em> cambiarlas.</p>\n<p>Trata de no estar desmotivado. Si tu sientes que una crítica es injusta, confórmate o busca la entrada de otro contribuyente del proyecto. A menudo ese tipo de comentarios son el resultado de un crítico que no toma el suficiente tiempo para revisar y no son mal intencionados. Estas dificultades a menudo pueden ser resueltas con un poco de paciencia. Dicho esto, se espera que los revisores ofrezcan una crítica útil.</p>\n<h3 id=\"paso-11-ejecutado\"><a href=\"#paso-11-ejecutado\">Paso 11: Ejecutado</a></h3>\n<p>Con el fin de ejecutar, un pull request necesita se revisado y aprobado por al menos un Propietario de Código Electron y tarjeta CI. Después de eso, si no hay objeciones de otro contribuyentes, el pull request puede ser combinado.</p>\n<p>¡Felicitaciones y gracias por tu contribución!</p>\n<h3 id=\"prueba-de-integración-continua\"><a href=\"#prueba-de-integración-continua\">Prueba de Integración Continua</a></h3>\n<p>Cada pull request se prueva en el sistema de Integracion Continua (CI) para confirmar que funciona en plataformas compatibles con Electron.</p>\n<p>Idealmente, el pull request pasara(\"ser verde\") en todas las plataformas de CI. Esto quiere decir que pasa todas las pruebas y no hay errores linting. Sin embargo, no es infrecuente para la infraestructura de CI el fallar en plataformas específicas o como son llamadas pruebas \"escamosas\" a fallar (\"be red\"). Cada falla de CI debe ser inspeccionada manualmente para determinar la causa.</p>\n<p>CI inicia automáticamente cuando abres una pull request, pero solo los mantenedores principales puede reiniciar una ejecución CI. Si crees que el CI está dando un falso negativo, pida a un mantenedor que reinicie las pruebas.</p>",
      "title": "Pull Requests",
      "description": ""
    },
    "/docs/tutorial/quick-start": {
      "locale": "es-ES",
      "slug": "quick-start",
      "href": "/docs/tutorial/quick-start",
      "crowdinFileId": "256237",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/quick-start.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"inicio-rápido\"><a href=\"#inicio-rápido\">Inicio Rápido</a></h1>\n<p>This guide will step you through the process of creating a barebones Hello World app in Electron, similar to <a href=\"https://github.com/electron/electron-quick-start\"><code>electron/electron-quick-start</code></a>.</p>\n<p>By the end of this tutorial, your app will open a browser window that displays a web page with information about which Chromium, Node.js, and Electron versions are running.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<p>To use Electron, you need to install <a href=\"https://nodejs.org/en/download/\">Node.js</a>. We recommend that you use the latest <code>LTS</code> version available.</p>\n<blockquote>\n<p>Please install Node.js using pre-built installers for your platform. You may encounter incompatibility issues with different development tools otherwise.</p>\n</blockquote>\n<p>To check that Node.js was installed correctly, type the following commands in your terminal client:</p>\n<pre><code class=\"hljs language-sh\">node -v\nnpm -v\n</code></pre>\n<p>The commands should print the versions of Node.js and npm accordingly.</p>\n<p><strong>Note:</strong> Since Electron embeds Node.js into its binary, the version of Node.js running your code is unrelated to the version running on your system.</p>\n<h2 id=\"create-your-application\"><a href=\"#create-your-application\">Create your application</a></h2>\n<h3 id=\"scaffold-the-project\"><a href=\"#scaffold-the-project\">Scaffold the project</a></h3>\n<p>Electron apps follow the same general structure as other Node.js projects. Start by creating a folder and initializing an npm package.</p>\n<pre><code class=\"hljs language-sh\">mkdir my-electron-app &#x26;&#x26; <span class=\"hljs-built_in\">cd</span> my-electron-app\nnpm init\n</code></pre>\n<p>The interactive <code>init</code> command will prompt you to set some fields in your config. There are a few rules to follow for the purposes of this tutorial:</p>\n<ul>\n<li><code>entry point</code> should be <code>main.js</code>.</li>\n<li><code>author</code> and <code>description</code> can be any value, but are necessary for <a href=\"#package-and-distribute-your-application\">app packaging</a>.</li>\n</ul>\n<p>Your <code>package.json</code> file should look something like this:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"my-electron-app\"</span>,\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"1.0.0\"</span>,\n  <span class=\"hljs-attr\">\"description\"</span>: <span class=\"hljs-string\">\"Hello World!\"</span>,\n  <span class=\"hljs-attr\">\"main\"</span>: <span class=\"hljs-string\">\"main.js\"</span>,\n  <span class=\"hljs-attr\">\"author\"</span>: <span class=\"hljs-string\">\"Jane Doe\"</span>,\n  <span class=\"hljs-attr\">\"license\"</span>: <span class=\"hljs-string\">\"MIT\"</span>\n}\n</code></pre>\n<p>Then, install the <code>electron</code> package into your app's <code>devDependencies</code>.</p>\n<pre><code class=\"hljs language-sh\">$ npm install --save-dev electron\n</code></pre>\n<blockquote>\n<p>Note: If you're encountering any issues with installing Electron, please refer to the <a href=\"/docs/tutorial/installation\">Advanced Installation</a> guide.</p>\n</blockquote>\n<p>Finally, you want to be able to execute Electron. In the <a href=\"https://docs.npmjs.com/cli/v7/using-npm/scripts\"><code>scripts</code></a> field of your <code>package.json</code> config, add a <code>start</code> command like so:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"scripts\"</span>: {\n    <span class=\"hljs-attr\">\"start\"</span>: <span class=\"hljs-string\">\"electron .\"</span>\n  }\n}\n</code></pre>\n<p>This <code>start</code> command will let you open your app in development mode.</p>\n<pre><code class=\"hljs language-sh\">npm start\n</code></pre>\n<blockquote>\n<p>Note: This script tells Electron to run on your project's root folder. At this stage, your app will immediately throw an error telling you that it cannot find an app to run.</p>\n</blockquote>\n<h3 id=\"run-the-main-process\"><a href=\"#run-the-main-process\">Run the main process</a></h3>\n<p>The entry point of any Electron application is its <code>main</code> script. This script controls the <strong>main process</strong>, which runs in a full Node.js environment and is responsible for controlling your app's lifecycle, displaying native interfaces, performing privileged operations, and managing renderer processes (more on that later).</p>\n<p>During execution, Electron will look for this script in the <a href=\"https://docs.npmjs.com/cli/v7/configuring-npm/package-json#main\"><code>main</code></a> field of the app's <code>package.json</code> config, which you should have configured during the <a href=\"#scaffold-the-project\">app scaffolding</a> step.</p>\n<p>To initialize the <code>main</code> script, create an empty file named <code>main.js</code> in the root folder of your project.</p>\n<blockquote>\n<p>Note: If you run the <code>start</code> script again at this point, your app will no longer throw any errors! However, it won't do anything yet because we haven't added any code into <code>main.js</code>.</p>\n</blockquote>\n<h3 id=\"create-a-web-page\"><a href=\"#create-a-web-page\">Create a web page</a></h3>\n<p>Before we can create a window for our application, we need to create the content that will be loaded into it. In Electron, each window displays web contents that can be loaded from either from a local HTML file or a remote URL.</p>\n<p>For this tutorial, you will be doing the former. Create an <code>index.html</code> file in the root folder of your project:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-comment\">&#x3C;!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"X-Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    We are using Node.js <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"node-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    Chromium <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"chrome-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    and Electron <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"electron-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>.\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<blockquote>\n<p>Note: Looking at this HTML document, you can observe that the version numbers are missing from the body text. We'll manually insert them later using JavaScript.</p>\n</blockquote>\n<h3 id=\"opening-your-web-page-in-a-browser-window\"><a href=\"#opening-your-web-page-in-a-browser-window\">Opening your web page in a browser window</a></h3>\n<p>Now that you have a web page, load it into an application window. To do so, you'll need two Electron modules:</p>\n<ul>\n<li>The <a href=\"/docs/api/app\"><code>app</code></a> module, which controls your application's event lifecycle.</li>\n<li>The <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> module, which creates and manages application windows.</li>\n</ul>\n<p>Because the main process runs Node.js, you can import these as <a href=\"https://nodejs.org/docs/latest/api/modules.html#modules_modules_commonjs_modules\">CommonJS</a> modules at the top of your file:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>Then, add a <code>createWindow()</code> function that loads <code>index.html</code> into a new <code>BrowserWindow</code> instance.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n</code></pre>\n<p>Next, call this <code>createWindow()</code> function to open your window.</p>\n<p>In Electron, browser windows can only be created after the <code>app</code> module's <a href=\"/docs/api/app#event-ready\"><code>ready</code></a> event is fired. You can wait for this event by using the <a href=\"/docs/api/app#appwhenready\"><code>app.whenReady()</code></a> API. Call <code>createWindow()</code> after <code>whenReady()</code> resolves its Promise.</p>\n<pre><code class=\"hljs language-js\">app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n})\n</code></pre>\n<blockquote>\n<p>Note: At this point, your Electron application should successfully open a window that displays your web page!</p>\n</blockquote>\n<h3 id=\"manage-your-windows-lifecycle\"><a href=\"#manage-your-windows-lifecycle\">Manage your window's lifecycle</a></h3>\n<p>Although you can now open a browser window, you'll need some additional boilerplate code to make it feel more native to each platform. Application windows behave differently on each OS, and Electron puts the responsibility on developers to implement these conventions in their app.</p>\n<p>In general, you can use the <code>process</code> global's <a href=\"https://nodejs.org/api/process.html#process_process_platform\"><code>platform</code></a> attribute to run code specifically for certain operating systems.</p>\n<h4 id=\"quit-the-app-when-all-windows-are-closed-windows--linux\"><a href=\"#quit-the-app-when-all-windows-are-closed-windows--linux\">Quit the app when all windows are closed (Windows &#x26; Linux)</a></h4>\n<p>On Windows and Linux, exiting all windows generally quits an application entirely.</p>\n<p>To implement this, listen for the <code>app</code> module's <a href=\"/docs/api/app#event-window-all-closed\"><code>'window-all-closed'</code></a> event, and call <a href=\"/docs/api/app#appquit\"><code>app.quit()</code></a> if the user is not on macOS (<code>darwin</code>).</p>\n<pre><code class=\"hljs language-js\">app.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h4 id=\"open-a-window-if-none-are-open-macos\"><a href=\"#open-a-window-if-none-are-open-macos\">Open a window if none are open (macOS)</a></h4>\n<p>Whereas Linux and Windows apps quit when they have no windows open, macOS apps generally continue running even without any windows open, and activating the app when no windows are available should open a new one.</p>\n<p>To implement this feature, listen for the <code>app</code> module's <a href=\"/docs/api/app#event-activate-macos\"><code>activate</code></a> event, and call your existing <code>createWindow()</code> method if no browser windows are open.</p>\n<p>Because windows cannot be created before the <code>ready</code> event, you should only listen for <code>activate</code> events after your app is initialized. Do this by attaching your event listener from within your existing <code>whenReady()</code> callback.</p>\n<pre><code class=\"hljs language-js\">app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) createWindow()\n  })\n})\n</code></pre>\n<blockquote>\n<p>Note: At this point, your window controls should be fully functional!</p>\n</blockquote>\n<h3 id=\"access-nodejs-from-the-renderer-with-a-preload-script\"><a href=\"#access-nodejs-from-the-renderer-with-a-preload-script\">Access Node.js from the renderer with a preload script</a></h3>\n<p>Now, the last thing to do is print out the version numbers for Electron and its dependencies onto your web page.</p>\n<p>Accessing this information is trivial to do in the main process through Node's global <code>process</code> object. However, you can't just edit the DOM from the main process because it has no access to the renderer's <code>document</code> context. They're in entirely different processes!</p>\n<blockquote>\n<p>Note: If you need a more in-depth look at Electron processes, see the <a href=\"/docs/tutorial/process-model\">Process Model</a> document.</p>\n</blockquote>\n<p>This is where attaching a <strong>preload</strong> script to your renderer comes in handy. A preload script runs before the renderer process is loaded, and has access to both renderer globals (e.g. <code>window</code> and <code>document</code>) and a Node.js environment.</p>\n<p>Create a new script named <code>preload.js</code> as such:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'DOMContentLoaded'</span>, () => {\n  <span class=\"hljs-keyword\">const</span> replaceText = <span class=\"hljs-function\">(<span class=\"hljs-params\">selector, text</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> element = <span class=\"hljs-built_in\">document</span>.getElementById(selector)\n    <span class=\"hljs-keyword\">if</span> (element) element.innerText = text\n  }\n\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> dependency <span class=\"hljs-keyword\">of</span> [<span class=\"hljs-string\">'chrome'</span>, <span class=\"hljs-string\">'node'</span>, <span class=\"hljs-string\">'electron'</span>]) {\n    replaceText(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${dependency}</span>-version`</span>, process.versions[dependency])\n  }\n})\n</code></pre>\n<p>The above code accesses the Node.js <code>process.versions</code> object and runs a basic <code>replaceText</code> helper function to insert the version numbers into the HTML document.</p>\n<p>To attach this script to your renderer process, pass in the path to your preload script to the <code>webPreferences.preload</code> option in your existing <code>BrowserWindow</code> constructor.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// include the Node.js 'path' module at the top of your file</span>\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-comment\">// modify your existing createWindow() function</span>\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n<span class=\"hljs-comment\">// ...</span>\n</code></pre>\n<p>There are two Node.js concepts that are used here:</p>\n<ul>\n<li>The <a href=\"https://nodejs.org/api/modules.html#modules_dirname\"><code>__dirname</code></a> string points to the path of the currently executing script (in this case, your project's root folder).</li>\n<li>The <a href=\"https://nodejs.org/api/path.html#path_path_join_paths\"><code>path.join</code></a> API joins multiple path segments together, creating a combined path string that works across all platforms.</li>\n</ul>\n<p>We use a path relative to the currently executing JavaScript file so that your relative path will work in both development and packaged mode.</p>\n<h3 id=\"bonus-add-functionality-to-your-web-contents\"><a href=\"#bonus-add-functionality-to-your-web-contents\">Bonus: Add functionality to your web contents</a></h3>\n<p>At this point, you might be wondering how to add more functionality to your application.</p>\n<p>For any interactions with your web contents, you want to add scripts to your renderer process. Because the renderer runs in a normal web environment, you can add a <code>&#x3C;script></code> tag right before your <code>index.html</code> file's closing <code>&#x3C;/body></code> tag to include any arbitrary scripts you want:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"./renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<p>The code contained in <code>renderer.js</code> can then use the same JavaScript APIs and tooling you use for typical front-end development, such as using <a href=\"https://webpack.js.org\"><code>webpack</code></a> to bundle and minify your code or <a href=\"https://reactjs.org\">React</a> to manage your user interfaces.</p>\n<h3 id=\"recap\"><a href=\"#recap\">Recap</a></h3>\n<p>After following the above steps, you should have a fully functional Electron application that looks like this:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/simplest-electron-app.png\" alt=\"Simplest Electron app\"></p>\n<!--TODO(erickzhao): Remove the individual code blocks for static website -->\n<p>The full code is available below:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\n\n<span class=\"hljs-comment\">// Modules to control application life and create native browser window</span>\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-comment\">// Create the browser window.</span>\n  <span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  <span class=\"hljs-comment\">// and load the index.html of the app.</span>\n  mainWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-comment\">// Open the DevTools.</span>\n  <span class=\"hljs-comment\">// mainWindow.webContents.openDevTools()</span>\n}\n\n<span class=\"hljs-comment\">// This method will be called when Electron has finished</span>\n<span class=\"hljs-comment\">// initialization and is ready to create browser windows.</span>\n<span class=\"hljs-comment\">// Algunas APIs pueden solamente ser usadas despues de que este evento ocurra.</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n    <span class=\"hljs-comment\">// On macOS it's common to re-create a window in the app when the</span>\n    <span class=\"hljs-comment\">// dock icon is clicked and there are no other windows open.</span>\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) createWindow()\n  })\n})\n\n<span class=\"hljs-comment\">// Quit when all windows are closed, except on macOS. There, it's common</span>\n<span class=\"hljs-comment\">// for applications and their menu bar to stay active until the user quits</span>\n<span class=\"hljs-comment\">// explicitly with Cmd + Q.</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n\n<span class=\"hljs-comment\">// In this file you can include the rest of your app's specific main process</span>\n<span class=\"hljs-comment\">// code. Tu también puedes ponerlos en archivos separados y requerirlos aquí.</span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// preload.js</span>\n\n<span class=\"hljs-comment\">// All of the Node.js APIs are available in the preload process.</span>\n<span class=\"hljs-comment\">// It has the same sandbox as a Chrome extension.</span>\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'DOMContentLoaded'</span>, () => {\n  <span class=\"hljs-keyword\">const</span> replaceText = <span class=\"hljs-function\">(<span class=\"hljs-params\">selector, text</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> element = <span class=\"hljs-built_in\">document</span>.getElementById(selector)\n    <span class=\"hljs-keyword\">if</span> (element) element.innerText = text\n  }\n\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> dependency <span class=\"hljs-keyword\">of</span> [<span class=\"hljs-string\">'chrome'</span>, <span class=\"hljs-string\">'node'</span>, <span class=\"hljs-string\">'electron'</span>]) {\n    replaceText(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${dependency}</span>-version`</span>, process.versions[dependency])\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!--index.html--></span>\n\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-comment\">&#x3C;!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"X-Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    We are using Node.js <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"node-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    Chromium <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"chrome-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    and Electron <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"electron-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>.\n\n    <span class=\"hljs-comment\">&#x3C;!-- You can also require other files to run in this process --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"./renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>To summarize all the steps we've done:</p>\n<ul>\n<li>\n<p>We bootstrapped a Node.js application and added Electron as a dependency.</p>\n</li>\n<li>\n<p>We created a <code>main.js</code> script that runs our main process, which controls our app\nand runs in a Node.js environment. In this script, we used Electron's <code>app</code> and\n<code>BrowserWindow</code> modules to create a browser window that displays web content\nin a separate process (the renderer).</p>\n</li>\n<li>\n<p>In order to access certain Node.js functionality in the renderer, we attached\na preload script to our <code>BrowserWindow</code> constructor.</p>\n</li>\n</ul>\n<h2 id=\"package-and-distribute-your-application\"><a href=\"#package-and-distribute-your-application\">Package and distribute your application</a></h2>\n<p>The fastest way to distribute your newly created app is using\n<a href=\"https://www.electronforge.io\">Electron Forge</a>.</p>\n<ol>\n<li>\n<p>Add Electron Forge as a development dependency of your app, and use its <code>import</code> command to set up\nForge's scaffolding:</p>\n<pre><code class=\"hljs language-routeros\">```sh npm2yarn\nnpm install --save-dev @electron-forge/cli\nnpx electron-forge import\n\n✔ Checking your<span class=\"hljs-built_in\"> system\n</span>✔ Initializing Git Repository\n✔ Writing modified package.json file\n✔ Installing dependencies\n✔ Writing modified package.json file\n✔ Fixing .gitignore\n\nWe have ATTEMPTED <span class=\"hljs-keyword\">to</span> convert your app <span class=\"hljs-keyword\">to</span> be <span class=\"hljs-keyword\">in</span> a format that electron-forge understands.\n\nThanks <span class=\"hljs-keyword\">for</span> using <span class=\"hljs-string\">\"electron-forge\"</span>!!!\n```\n</code></pre>\n</li>\n<li>\n<p>Create a distributable using Forge's <code>make</code> command:</p>\n<pre><code class=\"hljs language-sh\">npm run make\n\n> my-electron-app@1.0.0 make /my-electron-app\n> electron-forge make\n\n✔ Checking your system\n✔ Resolving Forge Config\nWe need to package your application before we can make it\n✔ Preparing to Package Application <span class=\"hljs-keyword\">for</span> arch: x64\n✔ Preparing native dependencies\n✔ Packaging Application\nMaking <span class=\"hljs-keyword\">for</span> the following targets: zip\n✔ Making <span class=\"hljs-keyword\">for</span> target: zip - On platform: darwin - For arch: x64\n</code></pre>\n<p>Electron Forge creates the <code>out</code> folder where your package will be located:</p>\n<pre><code class=\"hljs language-plain\">// Example for macOS\nout/\n├── out/make/zip/darwin/x64/my-electron-app-darwin-x64-1.0.0.zip\n├── ...\n└── out/my-electron-app-darwin-x64/my-electron-app.app/Contents/MacOS/my-electron-app\n</code></pre>\n</li>\n</ol>",
      "title": "Inicio Rápido",
      "description": "Please install Node.js using pre-built installers for your platform. You may encounter incompatibility issues with different development tools otherwise."
    },
    "/docs/README": {
      "locale": "es-ES",
      "slug": "README",
      "href": "/docs/README",
      "crowdinFileId": "256115",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/README.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"guías-oficiales\"><a href=\"#guías-oficiales\">Guías oficiales</a></h1>\n<p>Por favor, asegúrese de utilizar los documentos que correspondan con la versión de Electron que esta buscando. El número de versión debe estar incluido en la URL de la página. De no ser así, probablemente está utilizando la documentación de una rama de desarrollo, la cual puede contener cambios en la API que no sean compatibles con su versión de Electron. Para ver la documentación de las versiones pasadas desde GitHub usted puede <a href=\"https://github.com/electron/electron/tree/v1.4.0\">navegar usando las etiquetas</a> al abrir el cuadro de selección \"Switch branches/tags\" y seleccionar la versión que coincida con la suya.</p>\n<h2 id=\"preguntas-más-frecuentes\"><a href=\"#preguntas-más-frecuentes\">Preguntas más frecuentes</a></h2>\n<p>Hay preguntas que se hacen bastante a menudo. Comprueba esto antes de crear un tema:</p>\n<ul>\n<li><a href=\"/docs/faq\">Preguntas más frecuentes sobre Electron</a></li>\n</ul>\n<h2 id=\"guías-y-tutoriales\"><a href=\"#guías-y-tutoriales\">Guías y tutoriales</a></h2>\n<h3 id=\"empezar\"><a href=\"#empezar\">Empezar</a></h3>\n<ul>\n<li><a href=\"/docs/tutorial/introduction\">Introducción</a></li>\n<li><a href=\"/docs/tutorial/quick-start\">Inicio Rápido</a></li>\n<li><a href=\"/docs/tutorial/process-model\">Modelo de proceso</a></li>\n</ul>\n<h3 id=\"learning-the-basics\"><a href=\"#learning-the-basics\">Learning the basics</a></h3>\n<ul>\n<li>Agregar características a su aplicación<ul>\n<li><a href=\"/docs/tutorial/notifications\">Notificaciones</a></li>\n<li><a href=\"/docs/tutorial/recent-documents\">Documentos recientes</a></li>\n<li><a href=\"/docs/tutorial/progress-bar\">Progreso de la aplicación</a></li>\n<li><a href=\"/docs/tutorial/macos-dock\">Menú Dock personalizado</a></li>\n<li><a href=\"/docs/tutorial/windows-taskbar\">Barra de tareas de Windows personalizado</a></li>\n<li><a href=\"/docs/tutorial/linux-desktop-actions\">Acciones de escritorio Linux personalizado</a></li>\n<li><a href=\"/docs/tutorial/keyboard-shortcuts\">Atajos del teclado</a></li>\n<li><a href=\"/docs/tutorial/online-offline-events\">Offline/Online erkennung</a></li>\n<li><a href=\"/docs/tutorial/represented-file\">Archivo representado por macOS BrowserWindows</a></li>\n<li><a href=\"/docs/tutorial/native-file-drag-drop\">Función nativa de Arrastrar y Soltar archivo</a></li>\n<li><a href=\"/docs/tutorial/offscreen-rendering\">Representación fuera de la pantalla</a></li>\n<li><a href=\"/docs/tutorial/dark-mode\">Modo oscuro</a></li>\n<li><a href=\"/docs/tutorial/web-embeds\">Página web embebida en Electron</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis\">Plantillas y CLIs</a><ul>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#boilerplate-vs-cli\">Plantillas vs CLI</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-forge\">electron-forge</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-builder\">Electron-builder</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-react-boilerplate\">electron-react-boilerplate</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#other-tools-and-boilerplates\">Otras Herramientas y Boilerplates</a></li>\n</ul></li>\n</ul>\n<h3 id=\"pasos-avanzados\"><a href=\"#pasos-avanzados\">Pasos avanzados</a></h3>\n<ul>\n<li>Arquitectura de la aplicación<ul>\n<li><a href=\"/docs/tutorial/using-native-node-modules\">Uso de Módulos Nativos de Node.js</a></li>\n<li><a href=\"/docs/tutorial/performance\">Estrategias de rendimiento</a></li>\n<li><a href=\"/docs/tutorial/security\">Estrategias de seguridad</a></li>\n<li><a href=\"/docs/tutorial/sandbox\">Process Sandboxing</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/accessibility\">Accesibilidad</a><ul>\n<li><a href=\"/docs/tutorial/accessibility#manually-enabling-accessibility-features\">Manually Enabling Accessibility Features</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/application-debugging\">Pruebas y depuración</a><ul>\n<li><a href=\"/docs/tutorial/debugging-main-process\">Depuración del proceso principal</a></li>\n<li><a href=\"/docs/tutorial/debugging-vscode\">Depurando con Visual Studio Code</a></li>\n<li><a href=\"/docs/tutorial/using-selenium-and-webdriver\">Uso de Selenium y WebDriver</a></li>\n<li><a href=\"/docs/tutorial/testing-on-headless-ci\">Pruebas de sistemas de CI sin cabeceras (Travis, Jenkins)</a></li>\n<li><a href=\"/docs/tutorial/devtools-extension\">Extensión de herramientas de desarrollo</a></li>\n<li><a href=\"/docs/tutorial/automated-testing-with-a-custom-driver\">Automatizado con un controlador personalizado de prueba</a></li>\n<li><a href=\"/docs/tutorial/repl\">REPL</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/application-distribution\">Distribución</a><ul>\n<li><a href=\"/docs/tutorial/support#supported-platforms\">Plataformas soportadas</a></li>\n<li><a href=\"/docs/tutorial/code-signing\">Firma de código</a></li>\n<li><a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store</a></li>\n<li><a href=\"/docs/tutorial/windows-store-guide\">Windows Store</a></li>\n<li><a href=\"/docs/tutorial/snapcraft\">Snapcraft</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/updates\">Actualizaciones</a><ul>\n<li><a href=\"/docs/tutorial/updates#deploying-an-update-server\">Implementar un servidor de actualización</a></li>\n<li><a href=\"/docs/tutorial/updates#implementing-updates-in-your-app\">Implementación de actualizaciones en su aplicación</a></li>\n<li><a href=\"/docs/tutorial/updates#applying-updates\">Aplicar actualizaciones</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/support\">Obteniendo soporte</a></li>\n</ul>\n<h2 id=\"tutoriales-detallados\"><a href=\"#tutoriales-detallados\">Tutoriales detallados</a></h2>\n<p>Estos tutoriales individuales amplían los temas tratados en la guía anterior.</p>\n<ul>\n<li><a href=\"/docs/tutorial/installation\">Instalar Electron</a><ul>\n<li><a href=\"/docs/tutorial/installation#proxies\">Proxies</a></li>\n<li><a href=\"/docs/tutorial/installation#custom-mirrors-and-caches\">Espejos y cachés personalizados</a></li>\n<li><a href=\"/docs/tutorial/installation#troubleshooting\">Problemas</a></li>\n</ul></li>\n<li>Versiones Electron &#x26; Comentarios de desarrollador<ul>\n<li><a href=\"/docs/tutorial/electron-versioning\">Política de versiones</a></li>\n<li><a href=\"/docs/tutorial/electron-timelines\">Tiempos de Lanzamientos</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/testing-widevine-cdm\">Probando Widevine CDM</a></li>\n</ul>\n<hr>\n<ul>\n<li><a href=\"/docs/glossary\">Glosario de términos</a></li>\n</ul>\n<h2 id=\"referencia-de-la-api\"><a href=\"#referencia-de-la-api\">Referencia de la API</a></h2>\n<ul>\n<li><a href=\"/docs/api/synopsis\">Sinopsis</a></li>\n<li><a href=\"/docs/api/process\">Objeto de proceso</a></li>\n<li><a href=\"/docs/api/command-line-switches\">Cambios de línea de comandos soportados</a></li>\n<li><a href=\"/docs/api/environment-variables\">Variables de entorno</a></li>\n<li><a href=\"/docs/api/extensions\">Soporte de extensiones de Chrome</a></li>\n<li><a href=\"/docs/breaking-changes\">Rupturas de cambios de la API</a></li>\n</ul>\n<h3 id=\"elementos-de-dom-personalizados\"><a href=\"#elementos-de-dom-personalizados\">Elementos de DOM personalizados:</a></h3>\n<ul>\n<li><a href=\"/docs/api/file-object\"><code>Archivo</code> Objeto</a></li>\n<li><a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code> Etiqueta</a></li>\n<li><a href=\"/docs/api/window-open\">Función <code>window.open</code></a></li>\n<li><a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code> Objeto</a></li>\n</ul>\n<h3 id=\"módulos-para-el-proceso-principal\"><a href=\"#módulos-para-el-proceso-principal\">Módulos para el proceso principal:</a></h3>\n<ul>\n<li><a href=\"/docs/api/app\">app</a></li>\n<li><a href=\"/docs/api/auto-updater\">autoUpdater</a></li>\n<li><a href=\"/docs/api/browser-view\">BrowserView</a></li>\n<li><a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n<li><a href=\"/docs/api/content-tracing\">contentTracing</a></li>\n<li><a href=\"/docs/api/dialog\">dialog</a></li>\n<li><a href=\"/docs/api/global-shortcut\">globalShortcut</a></li>\n<li><a href=\"/docs/api/in-app-purchase\">Compras integradas</a></li>\n<li><a href=\"/docs/api/ipc-main\">ipcMain</a></li>\n<li><a href=\"/docs/api/menu\">Menu</a></li>\n<li><a href=\"/docs/api/menu-item\">MenuItem</a></li>\n<li><a href=\"/docs/api/message-channel-main\">MessageChannelMain</a></li>\n<li><a href=\"/docs/api/message-port-main\">Título 1 Xpath:/h 1</a></li>\n<li><a href=\"/docs/api/net\">net</a></li>\n<li><a href=\"/docs/api/net-log\">netLog</a></li>\n<li><a href=\"/docs/api/native-theme\">nativeTheme</a></li>\n<li><a href=\"/docs/api/notification\">Notification</a></li>\n<li><a href=\"/docs/api/power-monitor\">powerMonitor</a></li>\n<li><a href=\"/docs/api/power-save-blocker\">powerSaveBlocker</a></li>\n<li><a href=\"/docs/api/protocol\">protocol</a></li>\n<li><a href=\"/docs/api/screen\">screen</a></li>\n<li><a href=\"/docs/api/session\">session</a></li>\n<li><a href=\"/docs/api/share-menu\">ShareMenu</a></li>\n<li><a href=\"/docs/api/system-preferences\">systemPreferences</a></li>\n<li><a href=\"/docs/api/touch-bar\">Barra táctil</a></li>\n<li><a href=\"/docs/api/tray\">Tray</a></li>\n<li><a href=\"/docs/api/web-contents\">webContents</a></li>\n<li><a href=\"/docs/api/web-frame-main\">webFrameMain</a></li>\n</ul>\n<h3 id=\"módulos-para-el-proceso-de-renderizado-página-web\"><a href=\"#módulos-para-el-proceso-de-renderizado-página-web\">Módulos para el proceso de renderizado (Página Web):</a></h3>\n<ul>\n<li><a href=\"/docs/api/context-bridge\">contextBridge</a></li>\n<li><a href=\"/docs/api/ipc-renderer\">ipcRenderer</a></li>\n<li><a href=\"/docs/api/web-frame\">webFrame</a></li>\n</ul>\n<h3 id=\"módulos-para-ambos-procesos\"><a href=\"#módulos-para-ambos-procesos\">Módulos para ambos procesos:</a></h3>\n<ul>\n<li><a href=\"/docs/api/clipboard\">clipboard</a></li>\n<li><a href=\"/docs/api/crash-reporter\">crashReporter</a></li>\n<li><a href=\"/docs/api/desktop-capturer\">desktopCapturer</a></li>\n<li><a href=\"/docs/api/native-image\">nativeImage</a></li>\n<li><a href=\"/docs/api/shell\">shell</a></li>\n</ul>\n<h2 id=\"desarrollo\"><a href=\"#desarrollo\">Desarrollo</a></h2>\n<p>Ver <a href=\"/docs/development/README\">development/README.md</a></p>",
      "title": "Guías oficiales",
      "description": ""
    },
    "/docs/development/README": {
      "locale": "es-ES",
      "slug": "README",
      "href": "/docs/development/README",
      "crowdinFileId": "256127",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/README.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"desarrollando-electron\"><a href=\"#desarrollando-electron\">Desarrollando Electron</a></h1>\n<p>Estas guías están pensadas para gente que trabaja en el proyecto Electron. Para guías sobre el desarrollo de aplicaciones Electron, visita <a href=\"/docs/README#guides-and-tutorials\">/docs/README.md</a>.</p>\n<ul>\n<li><a href=\"https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md\">Código de conducta</a></li>\n<li><a href=\"https://github.com/electron/electron/blob/main/CONTRIBUTING.md\">Contribuyendo a Electron</a></li>\n<li><a href=\"/docs/development/issues\">Problemas</a></li>\n<li><a href=\"/docs/development/pull-requests\">Pull Requests</a></li>\n<li><a href=\"/docs/development/coding-style#documentation\">Documentación guía de estilos</a></li>\n<li><a href=\"/docs/development/source-code-directory-structure\">Estructura del directorio de código fuente</a></li>\n<li><a href=\"/docs/development/coding-style\">Estilo de código</a></li>\n<li><a href=\"/docs/development/clang-format\">Usar clang-format en código C++</a></li>\n<li><a href=\"/docs/development/clang-tidy\">Usar Clang-Tidy en el código de C++</a></li>\n<li><a href=\"/docs/development/build-system-overview\">Resumen de compilación de sistemas</a></li>\n<li><a href=\"/docs/development/build-instructions-macos\">Instrucciones de compilación (macOS)</a></li>\n<li><a href=\"/docs/development/build-instructions-windows\">Instrucciones de compilación (Windows)</a></li>\n<li><a href=\"/docs/development/build-instructions-linux\">Instrucciones de compilación (Linux)</a></li>\n<li><a href=\"/docs/development/chromium-development\">Desarrollo de Chromium</a></li>\n<li><a href=\"/docs/development/v8-development\">Desarrollo de V8</a></li>\n<li><a href=\"/docs/development/testing\">Pruebas</a></li>\n<li><a href=\"/docs/development/debug-instructions-windows\">Depuración en Windows</a></li>\n<li><a href=\"/docs/development/debugging-instructions-macos\">Depuración en macOS</a></li>\n<li><a href=\"/docs/development/setting-up-symbol-server\">Configuración del servidor de símbolos en el depurador</a></li>\n<li><a href=\"/docs/development/patches\">Parches</a></li>\n</ul>",
      "title": "Desarrollando Electron",
      "description": ""
    },
    "/docs/tutorial/recent-documents": {
      "locale": "es-ES",
      "slug": "recent-documents",
      "href": "/docs/tutorial/recent-documents",
      "crowdinFileId": "256239",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/recent-documents.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"documentos-recientes-windows--macos\"><a href=\"#documentos-recientes-windows--macos\">Documentos Recientes (Windows &#x26; macOS)</a></h1>\n<h2 id=\"descripción-general\"><a href=\"#descripción-general\">Descripción general</a></h2>\n<p>Windows y macOS proveen acceso a una lista de documentos recientes abierto por la aplicación a través de JumpList or dock menu, respectivamente.</p>\n<p><strong>JumpList:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/2289/23446924/11a27b98-fdfc-11e6-8485-cc3b1e86b80a.png\" alt=\"Archivos Recientes de JumpList\"></p>\n<p><strong>Menú de Aplicaciones:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5069610/2aa80758-6e97-11e4-8cfb-c1a414a10774.png\" alt=\"Menu macOS Dock\"></p>\n<h2 id=\"ejemplo\"><a href=\"#ejemplo\">Ejemplo</a></h2>\n<h3 id=\"managing-recent-documents\"><a href=\"#managing-recent-documents\">Managing recent documents</a></h3>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/recent-documents\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\n<span class=\"hljs-keyword\">const</span> fileName = <span class=\"hljs-string\">'recently-used.md'</span>\nfs.writeFile(fileName, <span class=\"hljs-string\">'Lorem Ipsum'</span>, () => {\n  app.addRecentDocument(path.join(__dirname, fileName))\n})\n\napp.whenReady().then(createWindow)\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  app.clearRecentDocuments()\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<h4 id=\"adding-a-recent-document\"><a href=\"#adding-a-recent-document\">Adding a recent document</a></h4>\n<p>To add a file to recent documents, use the <a href=\"/docs/api/app#appaddrecentdocumentpath-macos-windows\">app.addRecentDocument</a> API.</p>\n<p>After launching the Electron application, right click the application icon. In this guide, the item is a Markdown file located in the root of the project. You should see <code>recently-used.md</code> added to the list of recent files:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/recent-documents.png\" alt=\"Recent document\"></p>\n<h4 id=\"clearing-the-list-of-recent-documents\"><a href=\"#clearing-the-list-of-recent-documents\">Clearing the list of recent documents</a></h4>\n<p>To clear the list of recent documents, use the <a href=\"/docs/api/app#appclearrecentdocuments-macos-windows\">app.clearRecentDocuments</a> API. In this guide, the list of documents is cleared once all windows have been closed.</p>\n<h2 id=\"additional-information\"><a href=\"#additional-information\">Additional information</a></h2>\n<h3 id=\"notas-de-windows\"><a href=\"#notas-de-windows\">Notas de Windows</a></h3>\n<p>To use this feature on Windows, your application has to be registered as a handler of the file type of the document, otherwise the file won't appear in JumpList even after you have added it. You can find everything on registering your application in <a href=\"https://msdn.microsoft.com/en-us/library/cc144104(VS.85).aspx\">Application Registration</a>.</p>\n<p>Cuando un usuario hace clic en un archivo de JumpList, una nueva instancia de su aplicación se iniciará con la ruta del archivo agregado como un argumento de línea de comando.</p>\n<h3 id=\"notas-de-macos\"><a href=\"#notas-de-macos\">notas de macOS</a></h3>\n<h4 id=\"add-the-recent-documents-list-to-the-application-menu\"><a href=\"#add-the-recent-documents-list-to-the-application-menu\">Add the Recent Documents list to the application menu</a></h4>\n<p>You can add menu items to access and clear recent documents by adding the following code snippet to your menu template:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"submenu\"</span>:[\n    {\n      <span class=\"hljs-attr\">\"label\"</span>:<span class=\"hljs-string\">\"Open Recent\"</span>,\n      <span class=\"hljs-attr\">\"role\"</span>:<span class=\"hljs-string\">\"recentdocuments\"</span>,\n      <span class=\"hljs-attr\">\"submenu\"</span>:[\n        {\n          <span class=\"hljs-attr\">\"label\"</span>:<span class=\"hljs-string\">\"Clear Recent\"</span>,\n          <span class=\"hljs-attr\">\"role\"</span>:<span class=\"hljs-string\">\"clearrecentdocuments\"</span>\n        }\n      ]\n    }\n  ]\n}\n</code></pre>\n<p>Make sure the application menu is added after the <a href=\"/docs/api/app#event-ready\"><code>'ready'</code></a> event and not before, or the menu item will be disabled:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> template = [\n  <span class=\"hljs-comment\">// Menu template here</span>\n]\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  Menu.setApplicationMenu(menu)\n})\n</code></pre>\n<p><img src=\"https://user-images.githubusercontent.com/3168941/33003655-ea601c3a-cd70-11e7-97fa-7c062149cfb1.png\" alt=\"macOS Recent Documents menu item\"></p>\n<p>Cuando se solicita un archivo del menú de documentos recientes, el evento <code>archivo abierto</code> de <code>aplicación</code> se emitirá para él.</p>",
      "title": "Documentos Recientes (Windows & macOS)",
      "description": ""
    },
    "/docs/api/structures/rectangle": {
      "locale": "es-ES",
      "slug": "rectangle",
      "href": "/docs/api/structures/rectangle",
      "crowdinFileId": "256493",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/rectangle.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"rectangle-object\"><a href=\"#rectangle-object\">Rectangle Object</a></h1>\n<ul>\n<li><code>x</code> Number - The x coordinate of the origin of the rectangle (must be an integer).</li>\n<li><code>y</code> Number - The y coordinate of the origin of the rectangle (must be an integer).</li>\n<li><code>width</code> Number - The width of the rectangle (must be an integer).</li>\n<li><code>height</code> Number - The height of the rectangle (must be an integer).</li>\n</ul>",
      "title": "Rectangle Object",
      "description": ""
    },
    "/docs/api/structures/referrer": {
      "locale": "es-ES",
      "slug": "referrer",
      "href": "/docs/api/structures/referrer",
      "crowdinFileId": "256495",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/referrer.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"referrer-object\"><a href=\"#referrer-object\">Referrer Object</a></h1>\n<ul>\n<li><code>url</code> String - HTTP Referrer URL.</li>\n<li><code>policy</code> String - Can be <code>default</code>, <code>unsafe-url</code>, <code>no-referrer-when-downgrade</code>, <code>no-referrer</code>, <code>origin</code>, <code>strict-origin-when-cross-origin</code>, <code>same-origin</code> or <code>strict-origin</code>. See the <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy\">Referrer-Policy spec</a> for more details on the meaning of these values.</li>\n</ul>",
      "title": "Referrer Object",
      "description": ""
    },
    "/docs/tutorial/repl": {
      "locale": "es-ES",
      "slug": "repl",
      "href": "/docs/tutorial/repl",
      "crowdinFileId": "256241",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/repl.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"repl\"><a href=\"#repl\">REPL</a></h1>\n<p><a href=\"https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop\"> قراءة-تقييم-طباعة-حلقة </a> (REPL) هي بيئة برمجة كمبيوتر تفاعلية بسيطة تتطلب مستخدمًا واحدًا المدخلات (أي التعبيرات الفردية) ، وتقييمها ، وإرجاع النتيجة إلى المستخدم.</p>\n<h2 id=\"proceso-principal\"><a href=\"#proceso-principal\">Proceso principal</a></h2>\n<p>Electron expone el módulo <a href=\"https://nodejs.org/dist/latest/docs/api/repl.html\">Node.js <code>repl</code></a> a través de la bandera de CLI <code>--interactiva</code>. Assuming you have <code>electron</code> installed as a local project dependency, you should be able to access the REPL with the following command:</p>\n<pre><code class=\"hljs language-sh\">./node_modules/.bin/electron --interactive\n</code></pre>\n<p><strong>Nota:</strong> <code>electron --interactive</code> no está disponible para Windows (consulta <a href=\"https://github.com/electron/electron/pull/5776\">electron/electron#5776</a> para más detalles).</p>\n<h2 id=\"proceso-de-renderizado\"><a href=\"#proceso-de-renderizado\">Proceso de renderizado</a></h2>\n<p>You can use the DevTools Console tab to get a REPL for any renderer process. Para obtener más información, consulta la <a href=\"https://developer.chrome.com/docs/devtools/console/\">documentación de Chrome</a>.</p>",
      "title": "REPL",
      "description": ""
    },
    "/docs/tutorial/represented-file": {
      "locale": "es-ES",
      "slug": "represented-file",
      "href": "/docs/tutorial/represented-file",
      "crowdinFileId": "256243",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/represented-file.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"representing-files-in-a-browserwindow-macos\"><a href=\"#representing-files-in-a-browserwindow-macos\">Representing Files in a BrowserWindow (macOS)</a></h1>\n<h2 id=\"descripción-general\"><a href=\"#descripción-general\">Descripción general</a></h2>\n<p>En macOS, puede establecer un archivo representado para cualquier ventana en tu aplicación. El icono del archivo representado será mostrado en la barra de título, y cuando los usuarios <code>Command-Click</code> o <code>Control-Click</code> en una ventana emergente con una ruta al archivo será mostrada.</p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5082061/670a949a-6f14-11e4-987a-9aaa04b23c1d.png\" alt=\"Archivo representado\"></p>\n<blockquote>\n<p>NOTA: La captura de pantalla anterior es un ejemplo donde esta característica es usada para indicar el archivo abierto actualmente en el editor de texto Atom.</p>\n</blockquote>\n<p>También puede establecer el estado editado de una ventana para que el ícono del archivo pueda indicar si el documento en esta ventana ha sido modificado.</p>\n<p>Para configurar el archivo representado de la ventana, puede utilizarse las APIs <a href=\"/docs/api/browser-window#winsetrepresentedfilenamefilename-macos\">BrowserWindow.setRepresentedFilename</a> y <a href=\"/docs/api/browser-window#winsetdocumenteditededited-macos\">BrowserWindow.setDocumentEdited</a> APIs.</p>\n<h2 id=\"ejemplo\"><a href=\"#ejemplo\">Ejemplo</a></h2>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/represented-file\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>);\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.setRepresentedFilename(os.homedir())\n  win.setDocumentEdited(<span class=\"hljs-literal\">true</span>)\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<p>Después de lanzar la aplicación Electron, pulse en el título con la tecla <code>Command</code> o <code>Control</code> presionada. Deberías ver una ventana emergente con el archivo representado en la parte superior. En esta guía, este es el directorio principal del usuario actual:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/represented-file.png\" alt=\"Archivo representado\"></p>",
      "title": "Representing Files in a BrowserWindow (macOS)",
      "description": "NOTA: La captura de pantalla anterior es un ejemplo donde esta característica es usada para indicar el archivo abierto actualmente en el editor de texto Atom."
    },
    "/docs/api/safe-storage": {
      "locale": "es-ES",
      "slug": "safe-storage",
      "href": "/docs/api/safe-storage",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/safe-storage.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"safestorage\"><a href=\"#safestorage\">safeStorage</a></h1>\n<blockquote>\n<p>Allows access to simple encryption and decryption of strings for storage on the local machine.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p>This module protects data stored on disk from being accessed by other applications or users with full disk access.</p>\n<p>Note that on Mac, access to the system Keychain is required and these calls can block the current thread to collect user input. The same is true for Linux, if a password management tool is available.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>safeStorage</code> tiene los siguientes métodos:</p>\n<h3 id=\"safestorageisencryptionavailable\"><a href=\"#safestorageisencryptionavailable\"><code>safeStorage.isEncryptionAvailable()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether encryption is available.</p>\n<p>On Linux, returns true if the secret key is available. On MacOS, returns true if Keychain is available. On Windows, returns true with no other preconditions.</p>\n<h3 id=\"safestorageencryptstringplaintext\"><a href=\"#safestorageencryptstringplaintext\"><code>safeStorage.encryptString(plainText)</code></a></h3>\n<ul>\n<li><code>plainText</code> String</li>\n</ul>\n<p>Returns <code>Buffer</code> -  An array of bytes representing the encrypted string.</p>\n<p>This function will throw an error if encryption fails.</p>\n<h3 id=\"safestoragedecryptstringencrypted\"><a href=\"#safestoragedecryptstringencrypted\"><code>safeStorage.decryptString(encrypted)</code></a></h3>\n<ul>\n<li><code>encrypted</code> Buffer</li>\n</ul>\n<p>Returns <code>String</code> - the decrypted string. Decrypts the encrypted buffer obtained  with <code>safeStorage.encryptString</code> back into a string.</p>\n<p>This function will throw an error if decryption fails.</p>",
      "title": "safeStorage",
      "description": "Allows access to simple encryption and decryption of strings for storage on the local machine."
    },
    "/docs/tutorial/sandbox": {
      "locale": "es-ES",
      "slug": "sandbox",
      "href": "/docs/tutorial/sandbox",
      "crowdinFileId": "256245",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/sandbox.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"proceso-sandboxing\"><a href=\"#proceso-sandboxing\">Proceso Sandboxing</a></h1>\n<p>One key security feature in Chromium is that processes can be executed within a sandbox. The sandbox limits the harm that malicious code can cause by limiting access to most system resources — sandboxed processes can only freely use CPU cycles and memory. In order to perform operations requiring additional privilege, sandboxed processes use dedicated communication channels to delegate tasks to more privileged processes.</p>\n<p>In Chromium, sandboxing is applied to most processes other than the main process. This includes renderer processes, as well as utility processes such as the audio service, the GPU service and the network service.</p>\n<p>See Chromium's <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/design/sandbox.md\">Sandbox design document</a> for more information.</p>\n<h2 id=\"electrons-sandboxing-policies\"><a href=\"#electrons-sandboxing-policies\">Electron's sandboxing policies</a></h2>\n<p>Electron comes with a mixed sandbox environment, meaning sandboxed processes can run alongside privileged ones. By default, renderer processes are not sandboxed, but utility processes are. Note that as in Chromium, the main (browser) process is privileged and cannot be sandboxed.</p>\n<p>Historically, this mixed sandbox approach was established because having Node.js available in the renderer is an extremely powerful tool for app developers. Unfortunately, this feature is also an equally massive security vulnerability.</p>\n<p>Theoretically, unsandboxed renderers are not a problem for desktop applications that only display trusted code, but they make Electron less secure than Chromium for displaying untrusted web content. However, even purportedly trusted code may be dangerous — there are countless attack vectors that malicious actors can use, from cross-site scripting to content injection to man-in-the-middle attacks on remotely loaded websites, just to name a few. For this reason, we recommend enabling renderer sandboxing for the vast majority of cases under an abundance of caution.</p>\n<!--TODO: update this guide when #28466 is either solved or closed -->\n<p>Note that there is an active discussion in the issue tracker to enable renderer sandboxing by default. See <a href=\"https://github.com/electron/electron/issues/28466\">#28466</a>) for details.</p>\n<h2 id=\"sandbox-behaviour-in-electron\"><a href=\"#sandbox-behaviour-in-electron\">Sandbox behaviour in Electron</a></h2>\n<p>Sandboxed processes in Electron behave <em>mostly</em> in the same way as Chromium's do, but Electron has a few additional concepts to consider because it interfaces with Node.js.</p>\n<h3 id=\"renderer-processes\"><a href=\"#renderer-processes\">Renderer processes</a></h3>\n<p>When renderer processes in Electron are sandboxed, they behave in the same way as a regular Chrome renderer would. A sandboxed renderer won't have a Node.js environment initialized.</p>\n<!-- TODO(erickzhao): when we have a solid guide for IPC, link it here -->\n<p>Therefore, when the sandbox is enabled, renderer processes can only perform privileged tasks (such as interacting with the filesystem, making changes to the system, or spawning subprocesses) by delegating these tasks to the main process via inter-process communication (IPC).</p>\n<h3 id=\"preload-scripts\"><a href=\"#preload-scripts\">Preload scripts</a></h3>\n<p>In order to allow renderer processes to communicate with the main process, preload scripts attached to sandboxed renderers will still have a polyfilled subset of Node.js APIs available. A <code>require</code> function similar to Node's <code>require</code> module is exposed, but can only import a subset of Electron and Node's built-in modules:</p>\n<ul>\n<li><code>electron</code> (only renderer process modules)</li>\n<li><a href=\"https://nodejs.org/api/events.html\"><code>events</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html\"><code>contadores</code></a></li>\n<li><a href=\"https://nodejs.org/api/url.html\"><code>url</code></a></li>\n</ul>\n<p>In addition, the preload script also polyfills certain Node.js primitives as globals:</p>\n<ul>\n<li><a href=\"https://nodejs.org/api/Buffer.html\"><code>Buffer</code></a></li>\n<li><a href=\"/docs/api/process\"><code>process</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html#timers_clearimmediate_immediate\"><code>clearImmediate</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html#timers_setimmediate_callback_args\"><code>setImmediate</code></a></li>\n</ul>\n<p>Because the <code>require</code> function is a polyfill with limited functionality, you will not be able to use <a href=\"https://nodejs.org/api/modules.html#modules_modules_commonjs_modules\">CommonJS modules</a> to separate your preload script into multiple files. If you need to split your preload code, use a bundler such as <a href=\"https://webpack.js.org/\">webpack</a> or <a href=\"https://parceljs.org/\">Parcel</a>.</p>\n<p>Tenga en cuenta que debido a que el entorno presentado al script <code>preload</code> es sustancialmente más privilegiado que el de un renderizador con espacio de prueba, todavía es posible filtrar API privilegiadas a código no confiable ejecutándose en el proceso de renderizado a menos que <a href=\"/docs/tutorial/context-isolation\"><code>contextIsolation</code></a> esté habilitado.</p>\n<h2 id=\"configuring-the-sandbox\"><a href=\"#configuring-the-sandbox\">Configuring the sandbox</a></h2>\n<h3 id=\"enabling-the-sandbox-for-a-single-process\"><a href=\"#enabling-the-sandbox-for-a-single-process\">Enabling the sandbox for a single process</a></h3>\n<p>In Electron, renderer sandboxing can be enabled on a per-process basis with the <code>sandbox: true</code> preference in the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> constructor.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">sandbox</span>: <span class=\"hljs-literal\">true</span>\n    }\n  })\n  win.loadURL(<span class=\"hljs-string\">'https://google.com'</span>)\n})\n</code></pre>\n<h3 id=\"enabling-the-sandbox-globally\"><a href=\"#enabling-the-sandbox-globally\">Enabling the sandbox globally</a></h3>\n<p>If you want to force sandboxing for all renderers, you can also use the <a href=\"/docs/api/app#appenablesandbox\"><code>app.enableSandbox</code></a> API. Note that this API has to be called before the app's <code>ready</code> event.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\napp.enableSandbox()\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// no need to pass `sandbox: true` since `app.enableSandbox()` was called.</span>\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://google.com'</span>)\n})\n</code></pre>\n<h3 id=\"disabling-chromiums-sandbox-testing-only\"><a href=\"#disabling-chromiums-sandbox-testing-only\">Disabling Chromium's sandbox (testing only)</a></h3>\n<p>You can also disable Chromium's sandbox entirely with the <a href=\"/docs/api/command-line-switches#--no-sandbox\"><code>--no-sandbox</code></a> CLI flag, which will disable the sandbox for all processes (including utility processes). We highly recommend that you only use this flag for testing purposes, and <strong>never</strong> in production.</p>\n<p>Note that the <code>sandbox: true</code> option will still disable the renderer's Node.js environment.</p>\n<h2 id=\"a-note-on-rendering-untrusted-content\"><a href=\"#a-note-on-rendering-untrusted-content\">A note on rendering untrusted content</a></h2>\n<p>Rendering untrusted content in Electron is still somewhat uncharted territory, though some apps are finding success (e.g. <a href=\"https://github.com/beakerbrowser/beaker\">Beaker Browser</a>). Our goal is to get as close to Chrome as we can in terms of the security of sandboxed content, but ultimately we will always be behind due to a few fundamental issues:</p>\n<ol>\n<li>We do not have the dedicated resources or expertise that Chromium has to apply to the security of its product. We do our best to make use of what we have, to inherit everything we can from Chromium, and to respond quickly to security issues, but Electron cannot be as secure as Chromium without the resources that Chromium is able to dedicate.</li>\n<li>Some security features in Chrome (such as Safe Browsing and Certificate Transparency) require a centralized authority and dedicated servers, both of which run counter to the goals of the Electron project. As such, we disable those features in Electron, at the cost of the associated security they would otherwise bring.</li>\n<li>There is only one Chromium, whereas there are many thousands of apps built on Electron, all of which behave slightly differently. Accounting for those differences can yield a huge possibility space, and make it challenging to ensure the security of the platform in unusual use cases.</li>\n<li>We can't push security updates to users directly, so we rely on app vendors to upgrade the version of Electron underlying their app in order for security updates to reach users.</li>\n</ol>\n<p>While we make our best effort to backport Chromium security fixes to older versions of Electron, we do not make a guarantee that every fix will be backported. Your best chance at staying secure is to be on the latest stable version of Electron.</p>",
      "title": "Proceso Sandboxing",
      "description": ""
    },
    "/docs/api/screen": {
      "locale": "es-ES",
      "slug": "screen",
      "href": "/docs/api/screen",
      "crowdinFileId": "256361",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/screen.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"screen\"><a href=\"#screen\">screen</a></h1>\n<blockquote>\n<p>Recuperar información acerca del tamaño de la pantalla, posiciones del cursor, posiciones, etc.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p>Este módulo no puede ser usado hasta que el evento <code>ready</code> del módulo <code>app</code> es emitido.</p>\n<p><code>screen</code> es un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p><strong>Nota:</strong> En el renderer / DevTools, <code>window.screen</code> propiedad reservada DOM, así que escribir <code>let { screen } = require('electron')</code> no funcionará.</p>\n<p>Un ejemplo de crear una ventana que llene toda la pantalla:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/screen/fit-screen\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, screen } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> { width, height } = screen.getPrimaryDisplay().workAreaSize\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ width, height })\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>Otro ejemplo de crear una ventana el display externo es:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, screen } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> displays = screen.getAllDisplays()\n  <span class=\"hljs-keyword\">const</span> externalDisplay = displays.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">display</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> display.bounds.x !== <span class=\"hljs-number\">0</span> || display.bounds.y !== <span class=\"hljs-number\">0</span>\n  })\n\n  <span class=\"hljs-keyword\">if</span> (externalDisplay) {\n    win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n      <span class=\"hljs-attr\">x</span>: externalDisplay.bounds.x + <span class=\"hljs-number\">50</span>,\n      <span class=\"hljs-attr\">y</span>: externalDisplay.bounds.y + <span class=\"hljs-number\">50</span>\n    })\n    win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  }\n})\n</code></pre>\n<h2 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h2>\n<p>El módulo <code>screen</code> emite los siguientes eventos:</p>\n<h3 id=\"evento-display-added\"><a href=\"#evento-display-added\">Evento: 'display-added'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>newDisplay</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n</ul>\n<p>Emitido cuando <code>newDisplay</code> ha sido añadido.</p>\n<h3 id=\"evento-display-removed\"><a href=\"#evento-display-removed\">Evento: 'display-removed'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>oldDisplay</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n</ul>\n<p>Emitido cuando <code>oldDisplay</code> ha sido eliminado.</p>\n<h3 id=\"evento-display-metrics-changed\"><a href=\"#evento-display-metrics-changed\">Evento: 'display-metrics-changed'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>display</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n<li><code>changedMetrics</code> Cadena[]</li>\n</ul>\n<p>Emitido cuando o más métricos cambian en un <code>display</code>. El <code>changedMetrics</code> es un arreglo de cadenas que describen los cambios. Posibles cambios son <code>bounds</code>, <code>workArea</code>, <code>scaleFactor</code> y <code>rotation</code>.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>screen</code> tiene los siguientes métodos:</p>\n<h3 id=\"screengetcursorscreenpoint\"><a href=\"#screengetcursorscreenpoint\"><code>screen.getCursorScreenPoint()</code></a></h3>\n<p>Devuelve <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>La actual y absoluta posición del cursor del mouse.</p>\n<p><strong>Nota:</strong> El valor devuelto es un punto DIP, no una punto físico de la pantalla.</p>\n<h3 id=\"screengetprimarydisplay\"><a href=\"#screengetprimarydisplay\"><code>screen.getPrimaryDisplay()</code></a></h3>\n<p>Devuelve <a href=\"/docs/api/structures/display\"><code>Display</code></a> - La muestra primaria.</p>\n<h3 id=\"screengetalldisplays\"><a href=\"#screengetalldisplays\"><code>screen.getAllDisplays()</code></a></h3>\n<p>Devuelve <a href=\"/docs/api/structures/display\"><code>Display[]</code></a> - Un arreglo de muestras que son actualmente disponibles.</p>\n<h3 id=\"screengetdisplaynearestpointpoint\"><a href=\"#screengetdisplaynearestpointpoint\"><code>screen.getDisplayNearestPoint(point)</code></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Devuelve <a href=\"/docs/api/structures/display\"><code>Display</code></a> - La muestra más cerca del punto especificado.</p>\n<h3 id=\"screengetdisplaymatchingrect\"><a href=\"#screengetdisplaymatchingrect\"><code>screen.getDisplayMatching(rect)</code></a></h3>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Devuelve <a href=\"/docs/api/structures/display\"><code>Display</code></a> - La muestra que es más cercana intersecta a las bandas dadas.</p>\n<h3 id=\"screenscreentodippointpoint-windows\"><a href=\"#screenscreentodippointpoint-windows\"><code>screen.screenToDipPoint(point)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Devuelve <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>Convierte un punto físico en la pantalla a un punto DIP de la pantalla. La escala DPI se realiza en relación a la pantalla que contiene el punto físico.</p>\n<h3 id=\"screendiptoscreenpointpoint-windows\"><a href=\"#screendiptoscreenpointpoint-windows\"><code>screen.dipToScreenPoint(point)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Devuelve <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>Convierte un punto DIP de pantalla a un punto físico de la pantalla. La escala DPI se realiza en relación a la pantalla que contiene el punto DIP.</p>\n<h3 id=\"screenscreentodiprectwindow-rect-windows\"><a href=\"#screenscreentodiprectwindow-rect-windows\"><code>screen.screenToDipRect(window, rect)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | null</li>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Devuelve <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>Convierte una rect física de pantalla a una rect DIP de pantalla. La escala DPI se realiza en relación a la pantalla más cercana a <code>window</code>. Si <code>window</code> es nulo, el escalamiento se realizará a la pantalla mas cercana a <code>rect</code>.</p>\n<h3 id=\"screendiptoscreenrectwindow-rect-windows\"><a href=\"#screendiptoscreenrectwindow-rect-windows\"><code>screen.dipToScreenRect(window, rect)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | null</li>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Devuelve <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>Convierte una pantalla DIP rect a una rect física de pantalla. La escala DPI se realiza en relación a la pantalla más cercana a <code>window</code>. Si <code>window</code> es nulo, el escalamiento se realizará a la pantalla mas cercana a <code>rect</code>.</p>",
      "title": "screen",
      "description": "Recuperar información acerca del tamaño de la pantalla, posiciones del cursor, posiciones, etc."
    },
    "/docs/api/structures/scrubber-item": {
      "locale": "es-ES",
      "slug": "scrubber-item",
      "href": "/docs/api/structures/scrubber-item",
      "crowdinFileId": "256497",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/scrubber-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"scrubberitem-object\"><a href=\"#scrubberitem-object\">ScrubberItem Object</a></h1>\n<ul>\n<li><code>label</code> String (optional) - The text to appear in this item.</li>\n<li><code>icon</code> NativeImage (optional) - The image to appear in this item.</li>\n</ul>",
      "title": "ScrubberItem Object",
      "description": ""
    },
    "/docs/tutorial/security": {
      "locale": "es-ES",
      "slug": "security",
      "href": "/docs/tutorial/security",
      "crowdinFileId": "256247",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/security.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"seguridad-capacidades-nativas-y-su-responsabilidad\"><a href=\"#seguridad-capacidades-nativas-y-su-responsabilidad\">Seguridad, capacidades nativas y su responsabilidad</a></h1>\n<p>Como desarrolladores web, usualmente disfrutamos la seguridad fuerte de la red del buscador - los riesgos asociados con el código que escribimos son relativamente bajos. A nuestras páginas web se les concede poderes limitados en un sandbox, y confiamos en que nuestros usuarios disfrutan un buscador construido por un gran equipo de ingenieros que es capaz de responder rápidamente a recientes amenazas de seguridad descubiertas.</p>\n<p>Cuando se trabaje con Electron, es importante entender que Electron no es un navegador web. Te permite construir aplicaciones de escritorio llenas de utilidades con tecnologías web familiares, pero tu código tiene mucho más poder. JavaScript puede acceder a los archivos del sistema, actividades del usuario y más. Esto permite que construyas aplicaciones nativas de alta calidad, pero los riesgos inherentes de seguridad escalan con el poder adicional concedido a tu código.</p>\n<p>Con eso en mente, ten en cuenta que mostrar contenido arbitrario proveniente de fuentes poco confiables viene con un riesgo severo que Electron no está diseñado para manejar. De hecho, las aplicaciones de electron más populares (Atom, Slack, Visual Studio Code, etc) muestran contenido local primero (o confiable, asegurado contenido remoto sin integración nodal) - si tu aplicación ejecuta código de una fuente online es tu responsabilidad asegurar que el código no es malicioso.</p>\n<h2 id=\"reportando-problemas-de-seguridad\"><a href=\"#reportando-problemas-de-seguridad\">Reportando problemas de seguridad</a></h2>\n<p>Para información sobre cómo revelar las vulnerabilidad de Electrón dirigirse a <a href=\"https://github.com/electron/electron/tree/main/SECURITY.md\">SECURITY.md</a></p>\n<h2 id=\"actualizaciones-y-problemas-de-seguridad-chromium\"><a href=\"#actualizaciones-y-problemas-de-seguridad-chromium\">Actualizaciones y problemas de seguridad Chromium</a></h2>\n<p>Electron keeps up to date with alternating Chromium releases. For more information, see the <a href=\"https://electronjs.org/blog/12-week-cadence\">Electron Release Cadence blog post</a>.</p>\n<h2 id=\"la-seguridad-es-la-responsabilidad-de-todos\"><a href=\"#la-seguridad-es-la-responsabilidad-de-todos\">La seguridad es la responsabilidad de Todos</a></h2>\n<p>Es importante recordar que la seguridad de tu aplicación Electron es el resultado de la seguridad general de la base de framework (<em>Chromium</em>, <em>Node.js</em>), Electron mismo, todas las dependencias NPM y tu código. Por tanto, es tu responsabilidad seguir algunas importantes mejores prácticas:</p>\n<ul>\n<li>\n<p><strong>Mantenga su aplicación actualizada con la última versión liberada de Electron.</strong> Cuando libere su producto, también está compartiendo un conjunto compuesto de Electron, librerías compartidas de Chromium y Node.js. Vulnerabilidades afectando a estos componentes pueden impactar en la seguridad de su aplicación. Actualizando Electron a la última versión, asegura que las vulnerabilidades críticas (tales como <em>nodeIntegration bypasses</em>) ya estén reparadas y no puedan ser explotadas en su aplicación. Para más informacón, vea \"<a href=\"#16-use-a-current-version-of-electron\">Use a current version of Electron</a>\".</p>\n</li>\n<li>\n<p><strong>Evalue sus dependencias.</strong>Mientras NPM provee más de medio millón de paquetes reusables, es su responsabilidad la elección de librerías confiables de terceros. Si utiliza librerías desactualizadas afectadas por vulnerabilidades conocidas o basado en código escasamente mantenido, la seguridad de su aplicación puede estar en peligro.</p>\n</li>\n<li>\n<p><strong>Adopte prácticas de programación segura.</strong> La primera línea de defensa de su aplicación es su propio código. Vulnerabilidades usuales, tales como Cross-Site Scripting (XSS), tienen un alto impacto en la seguridad en las aplicaciones Electron así es altamente recomendable adoptar políticas confiables de buenas prácticas en el desarrollo de software y realizar pruebas de seguridad.</p>\n</li>\n</ul>\n<h2 id=\"aislamiento-para-contenido-no-confiable\"><a href=\"#aislamiento-para-contenido-no-confiable\">Aislamiento para contenido no confiable</a></h2>\n<p>Un problema de seguridad existe siempre que recibes código de un lugar no confiable (e.g. un servidor remoto) y lo ejecutas localmente. Como un ejemplo, considera una página web remota siendo mostrada dentro de un default <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. Si un atacante de algún modo se las arregla para cambiar dicho contenido (bien sea atacando la fuente directamente, o interviniendo entre su aplicación y el destino real), será capaz de ejecutar códigos nativos en la máquina del usuario.</p>\n<blockquote>\n<p>⚠️ bajo ninguna circunstancia deberías cargar y ejecutar código remoto con la integración Node.js activada. En vez de eso, usa solo archivos locales (empaquetados juntos con tu aplicación) para ejecutar el código Node.js. Para mostrar contenido remoto, use la etiqueta <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> o <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, asegúrese de deshabilitar el <code>nodeIntegration</code> y habilitar <code>contextIsolation</code>.</p>\n</blockquote>\n<h2 id=\"advertencias-de-seguridad-de-electron\"><a href=\"#advertencias-de-seguridad-de-electron\">Advertencias de seguridad de Electron</a></h2>\n<p>Desde Electron 2.0, los desarrolladores verán advertencias y recomendaciones impresas en la consola de desarrolladores. Estos solo se muestran cuando el nombre del binario es Electron, indicando que un desarrollador está mirando la consola.</p>\n<p>Usted puede activar o desactivar estas advertencias forzosamente configurando <code>ELECTRON_ENABLE_SECURITY_WARNINGS</code> o <code>ELECTRON_DISABLE_SECURITY_WARNINGS</code> ya sea en <code>process.env</code> o en el objeto <code>window</code>.</p>\n<h2 id=\"lista-recomendaciones-de-seguridad\"><a href=\"#lista-recomendaciones-de-seguridad\">Lista: Recomendaciones de Seguridad</a></h2>\n<p>Al menos debes seguir los siguientes pasos para mejorar la seguridad de su aplicación:</p>\n<ol>\n<li><a href=\"#1-only-load-secure-content\">Solo carga contenido seguro</a></li>\n<li><a href=\"#2-do-not-enable-nodejs-integration-for-remote-content\">Desactiva la integración Node.js en todas las renderizadores que muestran el contenido remoto</a></li>\n<li><a href=\"#3-enable-context-isolation-for-remote-content\">Permite el aislamiento de contexto en todos los renderizadores que muestran el contenido remoto</a></li>\n<li><a href=\"#4-enable-sandboxing\">Enable sandboxing</a></li>\n<li><a href=\"#5-handle-session-permission-requests-from-remote-content\">Usar <code>ses.setPermissionRequestHandler()</code> en todas las sesiones que cargan contenido remoto</a></li>\n<li><a href=\"#6-do-not-disable-websecurity\">No desactives <code>webSecurity</code></a></li>\n<li><a href=\"#7-define-a-content-security-policy\">Define un <code>Content-Security-Policy</code></a> y usa reglas estrictas (i.e. <code>script-src 'self'</code>)</li>\n<li><a href=\"#8-do-not-set-allowrunninginsecurecontent-to-true\">No establezca <code>allowRunningInsecureContent</code> a <code>true</code></a></li>\n<li><a href=\"#9-do-not-enable-experimental-features\">No active ajustes experimentales</a></li>\n<li><a href=\"#10-do-not-use-enableblinkfeatures\">No use <code>enableBlinkFeatures</code></a></li>\n<li><a href=\"#11-do-not-use-allowpopups\"><code>&#x3C;webview></code>: No use<code>allowpopups</code></a></li>\n<li><a href=\"#12-verify-webview-options-before-creation\"><code>&#x3C;webview></code>: Verificar opciones y parámetros</a></li>\n<li><a href=\"#13-disable-or-limit-navigation\">Deshabilitar o limitar navegación</a></li>\n<li><a href=\"#14-disable-or-limit-creation-of-new-windows\">Deshabilitar o limitar la generación de nuevas ventanas</a></li>\n<li><a href=\"#15-do-not-use-openexternal-with-untrusted-content\">No utilice <code>openExternal</code> con contenido no confiable</a></li>\n<li><a href=\"#16-use-a-current-version-of-electron\">Usar una versión actual de Electron</a></li>\n</ol>\n<p>Para automatizar la detección de configuraciones erróneas y de modelos inseguros, es posible usar <a href=\"https://github.com/doyensec/electronegativity\">electronegativity</a>. Para detalles adicionales sobre potenciales debilidades y errores en la implementación durante el desarrollo de aplicaciones usando Electron, consulte <a href=\"https://doyensec.com/resources/us-17-Carettoni-Electronegativity-A-Study-Of-Electron-Security-wp.pdf\">guía para desarrolladores y auditores</a></p>\n<h2 id=\"1-cargar-solo-contenido-seguro\"><a href=\"#1-cargar-solo-contenido-seguro\">1) Cargar solo contenido seguro</a></h2>\n<p>Cualquier recurso no incluido con tu aplicación debería ser cargado usando un protocolo de seguridad como <code>HTTPS</code>. En otras palabras, no uses protocolos inseguros como <code>HTTP</code>. De manera similar, recomendamos el uso de <code>WSS</code> antes de <code>WS</code>, <code>FTPS</code> antes de <code>FTP</code>, y así.</p>\n<h3 id=\"¿por-què\"><a href=\"#¿por-què\">¿Por què?</a></h3>\n<p><code>HTTPS</code> tiene tres beneficios principales:</p>\n<p>1) Autentica el servidor remoto, asegurando que tu aplicación conecte al  anfitrión correcto en vez de un falsificador. 2) Asegura integridad de data, afirmando que la data no fue modificada mientras estaba en  tránsito entre tu aplicación y el anfitrión. 3) Encripta el tráfico entre tu usuario y el anfitrión destinatario, haciéndolo  más difícil escuchar a escondidas las información establecida entre tu aplicación y el  anfitrión.</p>\n<h3 id=\"¿còmo\"><a href=\"#¿còmo\">¿Còmo?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\nbrowserWindow.loadURL(<span class=\"hljs-string\">'http://example.com'</span>)\n\n<span class=\"hljs-comment\">// Good</span>\nbrowserWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Bad --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">crossorigin</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://example.com/react.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"http://example.com/style.css\"</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Good --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">crossorigin</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://example.com/react.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"https://example.com/style.css\"</span>></span>\n</code></pre>\n<h2 id=\"2-no-habilitar-la-integración-nodejs-para-contenido-remote\"><a href=\"#2-no-habilitar-la-integración-nodejs-para-contenido-remote\">2) No habilitar la integración Node.js para contenido Remote</a></h2>\n<p><em>Esta recomendación es el comportamiento por defecto desde Electron 5.0.0.</em></p>\n<p>Es primordial que no active la integración Node.js en ningún renderizador (<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>, <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, o <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>) que carga contenido remote. La meta es limitar los poderes que concedes al contenido remoto, aunque lo hace dramáticamente más difícil para un atacante lastimar a tus usuarios, ellos deberían ganar la habilidad de ejecutar JavaScript en tu página web.</p>\n<p>Luego de esto, puedes conceder permisos adicionales para anfitriones específicos. For example, if you are opening a BrowserWindow pointed at <code>https://example.com/</code>, you can give that website exactly the abilities it needs, but no more.</p>\n<h3 id=\"¿por-què-1\"><a href=\"#¿por-què-1\">¿Por què?</a></h3>\n<p>Un ataque cross-site-scripting (XSS) es más peligroso si un atacante puede altar fuera del proceso de renderizado y ejecutar el código en la computadora del usuario. Ataques cross-site-scripting son muy comunes - y durante un problema, su poder es usualmente limitado a molestar a la página en dónde los están ejecutando. Desactivar la integración Node.js ayuda a prevenir un XSS de ser escalado en un llamado ataque de \"Ejecución de Código Remoto\".</p>\n<h3 id=\"¿còmo-1\"><a href=\"#¿còmo-1\">¿Còmo?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span>,\n    <span class=\"hljs-attr\">nodeIntegrationInWorker</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n\nmainWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">preload</span>: path.join(app.getAppPath(), <span class=\"hljs-string\">'preload.js'</span>)\n  }\n})\n\nmainWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Incorrecto --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">nodeIntegration</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Correcto --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>Cuando desactivas la integración Node.js, todavía puedes exponer APIs a tu página web que consume módulos Node.js o características. Guiones precargados continúan teniendo acceso a <code>require</code> y otras características de Node.js, permitiendo que los desarrolladores expongan un API personalizado para cargar contenido de manera remota.</p>\n<p>En el siguiente ejemplo de un guión pre cargado, la página web cargada más adelante tendrá acceso a el método <code>window.readConfig()</code>, pero ninguna característica de Node.js.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { readFileSync } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-built_in\">window</span>.readConfig = <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> data = readFileSync(<span class=\"hljs-string\">'./config.json'</span>)\n  <span class=\"hljs-keyword\">return</span> data\n}\n</code></pre>\n<h2 id=\"3-habilitar-el-aislamiento-del-contexto-para-contenido-remoto\"><a href=\"#3-habilitar-el-aislamiento-del-contexto-para-contenido-remoto\">3) Habilitar el aislamiento del contexto para Contenido Remoto</a></h2>\n<p>Context isolation es un ajuste de Electron que permite a los desarrolladores ejecutar códigos en guiones de pre carga y en APIs de Electron en un contexto dedicado de JavaScript. En práctica, eso significa que los objetos globales como <code>Array.prototype.push</code> o <code>JSON.parse</code> no puede ser modificado por guiones por guiones ejecutándose en el proceso de renderizado.</p>\n<p>Electron usa la misma tecnología que los <a href=\"https://developer.chrome.com/extensions/content_scripts#execution-environment\">Content Scripts</a> de Chromium para activar este comportamiento.</p>\n<p>Even when <code>nodeIntegration: false</code> is used, to truly enforce strong isolation and prevent the use of Node primitives <code>contextIsolation</code> <strong>must</strong> also be used.</p>\n<h3 id=\"why--how\"><a href=\"#why--how\">Why &#x26; How?</a></h3>\n<p>For more information on what <code>contextIsolation</code> is and how to enable it please see our dedicated <a href=\"/docs/tutorial/context-isolation\">Context Isolation</a> document.</p>\n<h2 id=\"4-enable-sandboxing\"><a href=\"#4-enable-sandboxing\">4) Enable Sandboxing</a></h2>\n<p><a href=\"/docs/tutorial/sandbox\">Sandboxing</a> is a Chromium feature that uses the operating system to significantly limit what renderer processes have access to. You should enable the sandbox in all renderers. Loading, reading or processing any untrusted content in an unsandboxed process, including the main process, is not advised.</p>\n<h3 id=\"¿còmo-2\"><a href=\"#¿còmo-2\">¿Còmo?</a></h3>\n<p>When creating a window, pass the <code>sandbox: true</code> option in <code>webPreferences</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">sandbox</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h2 id=\"5-gestionar-las-solicitudes-de-permiso-de-sesión-desde-el-contenido-remoto\"><a href=\"#5-gestionar-las-solicitudes-de-permiso-de-sesión-desde-el-contenido-remoto\">5) Gestionar las solicitudes de permiso de sesión desde el contenido remoto</a></h2>\n<p>Tu puedes haber visto pedidos de permiso mientras usas Chrome: Ellos avisan lo que sea que la página intente usar como una característica que el usuario tiene que aprobar manualmente (como notificaciones).</p>\n<p>La API está basada en los <a href=\"https://developer.chrome.com/extensions/permissions\">Chromium permissions API</a> e implementa el mismo tipo de permisos.</p>\n<h3 id=\"¿por-què-2\"><a href=\"#¿por-què-2\">¿Por què?</a></h3>\n<p>Por defecto, Electron aprobará automáticamente todos los pedidos de permiso a menos que el desarrollador haya configurado manualmente un comerciante personalizado. Aunque es un sólido ajuste automático, los desarrolladores conscientes de la seguridad pueden querer asumir lo contrario.</p>\n<h3 id=\"¿còmo-3\"><a href=\"#¿còmo-3\">¿Còmo?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession\n  .fromPartition(<span class=\"hljs-string\">'some-partition'</span>)\n  .setPermissionRequestHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, callback</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> url = webContents.getURL()\n\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'notifications'</span>) {\n      <span class=\"hljs-comment\">// Approves the permissions request</span>\n      callback(<span class=\"hljs-literal\">true</span>)\n    }\n\n    <span class=\"hljs-comment\">// Verify URL</span>\n    <span class=\"hljs-keyword\">if</span> (!url.startsWith(<span class=\"hljs-string\">'https://example.com/'</span>)) {\n      <span class=\"hljs-comment\">// Denies the permissions request</span>\n      <span class=\"hljs-keyword\">return</span> callback(<span class=\"hljs-literal\">false</span>)\n    }\n  })\n</code></pre>\n<h2 id=\"6-no-deshabilitar-websecurity\"><a href=\"#6-no-deshabilitar-websecurity\">6) No deshabilitar WebSecurity</a></h2>\n<p><em>La recomendación por defecto es Electrón</em></p>\n<p>Puede que haya adivinado que deshabilitando la propiedad <code>webSecurity</code> en un render process (<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>, <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, or <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>) desactiva características de seguridad cruciales.</p>\n<p>No deshabilite <code>webSecurity</code> en aplicaciones de producción.</p>\n<h3 id=\"¿por-què-3\"><a href=\"#¿por-què-3\">¿Por què?</a></h3>\n<p>Desactivar <code>webSecurity</code> deshabilitará la política de mismo-origen y establecer la propiedad <code>allowRunningInsecureContent</code> a <code>true</code>. En otras palabras, permite la ejecución de código inseguro desde diferentes dominios.</p>\n<h3 id=\"¿còmo-4\"><a href=\"#¿còmo-4\">¿Còmo?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">webSecurity</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Bad --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">disablewebsecurity</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Good --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<h2 id=\"7-definir-una-política-de-seguridad-de-contenido\"><a href=\"#7-definir-una-política-de-seguridad-de-contenido\">7) Definir una política de seguridad de contenido</a></h2>\n<p>Un Contenido de Política de Seguridad (CSP) es una capa adicional de protección contra los ataques cross-site-scripting attacks y ataques de inyecciones de data. Recomendamos que ellos estén activados por cualquier página web cargada dentro de Electron.</p>\n<h3 id=\"¿por-què-4\"><a href=\"#¿por-què-4\">¿Por què?</a></h3>\n<p>CSP permite que el servidor dando contenido pueda restringir y controlar los recursos que Electron puede cargar para esa página web dada. <code>https://example.com</code> debería estar permitido para guiones de pre carga de los orígenes que definiste mientras que los guiones de <code>https://evil.attacker.com</code> no debería tener permitido ejecutarse. Definir un CSP es una manera fácil de mejorar la seguridad de tus aplicaciones.</p>\n<p>El siguiente CSP permitirá que Electron ejecute guiones desde la página web actual y desde <code>apis.example.com</code>.</p>\n<pre><code class=\"hljs language-plaintext\">// Bad\nContent-Security-Policy: '*'\n\n// Good\nContent-Security-Policy: script-src 'self' https://apis.example.com\n</code></pre>\n<h3 id=\"encabezado-csp-http\"><a href=\"#encabezado-csp-http\">Encabezado CSP HTTP</a></h3>\n<p>Electron respeta el <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy\"><code>Content-Security-Policy</code> HTTP header</a> que puede ser establecido usando el manejador <a href=\"/docs/api/web-request#webrequestonheadersreceivedfilter-listener\"><code>webRequest.onHeadersReceived</code></a> de Electron:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession.defaultSession.webRequest.onHeadersReceived(<span class=\"hljs-function\">(<span class=\"hljs-params\">details, callback</span>) =></span> {\n  callback({\n    <span class=\"hljs-attr\">responseHeaders</span>: {\n      ...details.responseHeaders,\n      <span class=\"hljs-string\">'Content-Security-Policy'</span>: [<span class=\"hljs-string\">'default-src \\'none\\''</span>]\n    }\n  })\n})\n</code></pre>\n<h3 id=\"csp-meta-etiqueta\"><a href=\"#csp-meta-etiqueta\">CSP Meta Etiqueta</a></h3>\n<p>El mecanismo de entrega preferido de CSP es una cabecera HTTP, sin embargo no es posible usar este método al cargar un recurso usando el protocolo <code>file://</code>. Puede ser útil en algunos casos, como usar el protocolo <code>file://</code>, para establecer una política en un página directamente en el markup usando un tag <code>&#x3C;meta></code>:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'none'\"</span>></span>\n</code></pre>\n<h2 id=\"8-no-establecer-allowrunninginsecurecontent-a-true\"><a href=\"#8-no-establecer-allowrunninginsecurecontent-a-true\">8) No establecer <code>allowRunningInsecureContent</code> a <code>true</code></a></h2>\n<p><em>La recomendación por defecto es Electrón</em></p>\n<p>Por defecto, Electron no permitirá sitios webs cargados sobre <code>HTTPS</code> para cargar y ejecutar scripts, CSS, o plugins desde orígenes inseguros (<code>HTTP</code>). Establecer la propiedad <code>allowRunningInsecureContent</code> a <code>true</code> deshabilita esa protección.</p>\n<p>Descargar la inicial HTML de un sitio web mediante <code>HTTPS</code> e intentar descargar recursos subsecuentes mediante <code>HTTP</code> es también conocido como \"contenido mixto\".</p>\n<h3 id=\"¿por-què-5\"><a href=\"#¿por-què-5\">¿Por què?</a></h3>\n<p>Cargando contenido sobre <code>HTTPS</code> se asegura la autenticidad y la integridad de los recursos cargados mientras se cifra el trafico en si mismo. Ver la sección en <a href=\"#1-only-load-secure-content\">only displaying secure content</a> para más detalles.</p>\n<h3 id=\"¿còmo-5\"><a href=\"#¿còmo-5\">¿Còmo?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">allowRunningInsecureContent</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({})\n</code></pre>\n<h2 id=\"9-no-habilitar-características-experimentales\"><a href=\"#9-no-habilitar-características-experimentales\">9) No Habilitar características experimentales</a></h2>\n<p><em>La recomendación por defecto es Electrón</em></p>\n<p>Usuarios avanzados de Electron pueden habilitar las características experimentales de Chromium usando la propiedad <code>experimentalFeatures</code>.</p>\n<h3 id=\"¿por-què-6\"><a href=\"#¿por-què-6\">¿Por què?</a></h3>\n<p>Experimental features are, as the name suggests, experimental and have not been enabled for all Chromium users. Furthermore, their impact on Electron as a whole has likely not been tested.</p>\n<p>Casos de uso legítimo existen, pero excepto que usted sepa lo que está haciendo, usted no debería habilitar esta propiedad.</p>\n<h3 id=\"¿còmo-6\"><a href=\"#¿còmo-6\">¿Còmo?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">experimentalFeatures</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({})\n</code></pre>\n<h2 id=\"10-no-use-enableblinkfeatures\"><a href=\"#10-no-use-enableblinkfeatures\">10) No use <code>enableBlinkFeatures</code></a></h2>\n<p><em>La recomendación por defecto es Electrón</em></p>\n<p>Blink es el nombre del motor de renderizado detrás de Chromium. Como con la propiedad <code>experimentalFeatures</code>, la propiedad <code>enableBlinkFeatures</code> permite a los desarrolladores habilitar características que han sido deshabilitada por defecto.</p>\n<h3 id=\"¿por-què-7\"><a href=\"#¿por-què-7\">¿Por què?</a></h3>\n<p>En general, probablemente hay buenas razones si una función no fue habilitada por defecto. Casos de uso legítimo para habilitar funciones especificas existen. Como un desarrollador, usted debería saber exactamente por qué usted necesita habilitar una función, cuales son las ramificaciones, y como impacta las seguridad de su aplicación. Usted no debería habilitar funciones de forma especulativa bajo ninguna circunstancia.</p>\n<h3 id=\"¿còmo-7\"><a href=\"#¿còmo-7\">¿Còmo?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">enableBlinkFeatures</span>: <span class=\"hljs-string\">'ExecCommandInJavaScript'</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n</code></pre>\n<h2 id=\"11-no-use-allowpopups\"><a href=\"#11-no-use-allowpopups\">11) No use <code>allowpopups</code></a></h2>\n<p><em>La recomendación por defecto es Electrón</em></p>\n<p>Si estas usando <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>, puede que necesites las paginas y los scripts cargados en tu tag <code>&#x3C;webview></code> par abrir nuevas ventanas. El atributo <code>allowpopups</code> les permite crear nuevas <a href=\"/docs/api/browser-window\"><code>BrowserWindows</code></a> usando el método <code>window.open()</code>. tags <code>&#x3C;webview></code> de otra manera no se permite crear nuevas ventanas.</p>\n<h3 id=\"¿por-què-8\"><a href=\"#¿por-què-8\">¿Por què?</a></h3>\n<p>Si usted no necesita ventanas emergentes, le conviene no permitir la creación de nuevos <a href=\"/docs/api/browser-window\"><code>BrowserWindows</code></a> por defecto. Esto sigue el principio de acceso de mínimamente requerido: No permita que un sitio web cree nuevas ventanas excepto usted sepa que se necesita esa función.</p>\n<h3 id=\"¿còmo-8\"><a href=\"#¿còmo-8\">¿Còmo?</a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Bad --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">allowpopups</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Good --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<h2 id=\"12-verificar-las-opciones-de-webview-antes-de-la-creación\"><a href=\"#12-verificar-las-opciones-de-webview-antes-de-la-creación\">12) Verificar las opciones de WebView antes de la creación</a></h2>\n<p>Un WebView creado en un proceso de renderizado que no contenga integración habilitada de Node.js no será capaz de habilitar integración por sí mismo. Sin embargo, a WebView siempre creará un proco de renderizado independiente con su propio <code>webPreferences</code>.</p>\n<p>Es una buena ida controlar la creación de nuevas etiquetas <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> desde el proceso principal y verificar que su webPreferences no deshabilitan características de seguridad.</p>\n<h3 id=\"¿por-què-9\"><a href=\"#¿por-què-9\">¿Por què?</a></h3>\n<p>Puesto que <code>&#x3C;webview></code> vive en el DOM, ellos pueden ser creados por un script corriendo en tu sitio web incluso si la integración con Node.js está descativada.</p>\n<p>Electron habilita a desarrolladores a inhabilitar varias funciones de seguridad que controlan un proceso de renderizado. En la mayoría de los casos, los desarrolladores no necesitan desactivar ninguna de esas características - y por lo tanto no deberías permitir diferentes configuraciones para las etiquetas <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> recién creados.</p>\n<h3 id=\"¿còmo-9\"><a href=\"#¿còmo-9\">¿Còmo?</a></h3>\n<p>Antes que la etiqueta <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> sea adjuntada, Electron va a disparar el evento <code>will-attach-webview</code> en el <code>webContents</code> hosting. Use el evento para evitar la creación de <code>webViews</code> con posibles opciones inseguras.</p>\n<pre><code class=\"hljs language-js\">app.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.on(<span class=\"hljs-string\">'will-attach-webview'</span>, (event, webPreferences, params) => {\n    <span class=\"hljs-comment\">// Strip away preload scripts if unused or verify their location is legitimate</span>\n    <span class=\"hljs-keyword\">delete</span> webPreferences.preload\n    <span class=\"hljs-keyword\">delete</span> webPreferences.preloadURL\n\n    <span class=\"hljs-comment\">// Disable Node.js integration</span>\n    webPreferences.nodeIntegration = <span class=\"hljs-literal\">false</span>\n\n    <span class=\"hljs-comment\">// Verify URL being loaded</span>\n    <span class=\"hljs-keyword\">if</span> (!params.src.startsWith(<span class=\"hljs-string\">'https://example.com/'</span>)) {\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<p>Una vez más, esta lista simplemente minimiza el riesgo, no lo elimina. If your goal is to display a website, a browser will be a more secure option.</p>\n<h2 id=\"13-deshabilitar-o-limitar-la-navegación\"><a href=\"#13-deshabilitar-o-limitar-la-navegación\">13) Deshabilitar o limitar la navegación</a></h2>\n<p>Si tu aplicación no tiene la necesidad de navegar o sólo necesita navegar a páginas conocidas, es una buena idea limitar la navegación directamente a ese alcance conocido, inhabilitando cualquier otro tipo de navegación.</p>\n<h3 id=\"¿por-què-10\"><a href=\"#¿por-què-10\">¿Por què?</a></h3>\n<p>La navegación es un vector de ataque común. Si un atacante puede convencer a su aplicación para que navegue lejos de su página actual, posiblemente puede forzar a tu aplicación a abrir sitios web en Internet. Incluso si tu <code>webContents</code> están configurados para ser más seguros (como tener <code>nodeIntegration</code> deshabilitado o <code>contextIsolation</code> habilitado), conseguir que tu aplicación abra un sitio web aleatorio hará que el trabajo de explotar tu aplicación sea mucho mas fácil.</p>\n<p>Un patrón común de ataque es que el atacante convence a los usuarios de tu aplicación a interactuar con la aplicación de tal manera que navegue a una de las páginas del atacante. Esto usualmente se hace vía links, plugins u otro contenido generado por el usuario.</p>\n<h3 id=\"¿còmo-10\"><a href=\"#¿còmo-10\">¿Còmo?</a></h3>\n<p>Si tu aplicación no tiene necesidad de navegación, puedes llamar a <code>event.preventDefault()</code> en un manejador <a href=\"/docs/api/web-contents#event-will-navigate\"><code>will-navigate</code></a>. Si sabes a que páginas tu aplicación puede navegar, revisa la URL en el manejador de evento y solo deja que ocurra la navegación si coincide con las URL que estás esperando.</p>\n<p>Recomendamos que uses el parser para URLs de Node. Comparaciones simples de cadenas puede a veces engañar - una prueba <code>startsWith('https://example.com')</code> podría dejar pasar <code>https://example.com.attacker.com</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> URL = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>).URL\n\napp.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.on(<span class=\"hljs-string\">'will-navigate'</span>, (event, navigationUrl) => {\n    <span class=\"hljs-keyword\">const</span> parsedUrl = <span class=\"hljs-keyword\">new</span> URL(navigationUrl)\n\n    <span class=\"hljs-keyword\">if</span> (parsedUrl.origin !== <span class=\"hljs-string\">'https://example.com'</span>) {\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<h2 id=\"14-deshabilite-o-limite-la-creación-de-nuevas-ventasnas\"><a href=\"#14-deshabilite-o-limite-la-creación-de-nuevas-ventasnas\">14) Deshabilite o limite la creación de nuevas ventasnas</a></h2>\n<p>Si tienes un conjunto de ventanas conocido, es una buena idea limitar la creación de ventanas adicionales en tu aplicación.</p>\n<h3 id=\"¿por-què-11\"><a href=\"#¿por-què-11\">¿Por què?</a></h3>\n<p>Al igual que la navegación, la creación de nuevo <code>webContents</code> en un vector de ataque común. Los atacantes intentar convencer a tu aplicación a crear nuevas ventanas, frames u otros procesos renderer con más privilegios de lo que antes tenían; o con páginas abiertas que antes no pudieron abrir.</p>\n<p>Si no tienes la necesidad de crear ventanas adicionales de la que sabes que tendrás que crear, desactivando la creación te compra un poco de seguridad extra sin costo alguno. Este comúnmente el caso de las aplicaciones que abre un <code>BrowserWindow</code> y no necesita abrir un número arbitrario de ventanas adicionales en tiempo de ejecución.</p>\n<h3 id=\"¿còmo-11\"><a href=\"#¿còmo-11\">¿Còmo?</a></h3>\n<p><a href=\"/docs/api/web-contents\"><code>webContents</code></a> delegará a su <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\">controlado de venta abierta</a> antes de crear nuevas ventanas. The handler will receive, amongst other parameters, the <code>url</code> the window was requested to open and the options used to create it. We recommend that you register a handler to monitor the creation of windows, and deny any unexpected window creation.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n    <span class=\"hljs-comment\">// In this example, we'll ask the operating system</span>\n    <span class=\"hljs-comment\">// to open this event's url in the default browser.</span>\n    <span class=\"hljs-comment\">//</span>\n    <span class=\"hljs-comment\">// See the following item for considerations regarding what</span>\n    <span class=\"hljs-comment\">// URLs should be allowed through to shell.openExternal.</span>\n    <span class=\"hljs-keyword\">if</span> (isSafeForExternalOpen(url)) {\n      setImmediate(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n        shell.openExternal(url)\n      })\n    }\n\n    <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n  })\n})\n</code></pre>\n<h2 id=\"15-no-use-openexternal-con-contenido-no-confiable\"><a href=\"#15-no-use-openexternal-con-contenido-no-confiable\">15) No use <code>openExternal</code> con contenido no confiable</a></h2>\n<p>El <a href=\"/docs/api/shell#shellopenexternalurl-options\"><code>openExternal</code></a> de Shell permite abrir un protocolo URI dado con las utilidades nativas del escritorio. En macOS, a modo de ejemplo, esta función es similar a la utilidad de comando de terminal <code>open</code> y abrirá la aplicación especifica basado en la URI y en el tipo de archivo asociado.</p>\n<h3 id=\"¿por-què-12\"><a href=\"#¿por-què-12\">¿Por què?</a></h3>\n<p>El uso indebido de <a href=\"/docs/api/shell#shellopenexternalurl-options\"><code>openExternal</code></a> puede ser apalancado para comprometer el host del usuario. Cuando openExternal se usa con contenido no confiable, puede ser apalancado para ejecutar comandos arbitrarios.</p>\n<h3 id=\"¿còmo-12\"><a href=\"#¿còmo-12\">¿Còmo?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">//  Bad</span>\n<span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nshell.openExternal(USER_CONTROLLED_DATA_HERE)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">//  Good</span>\n<span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nshell.openExternal(<span class=\"hljs-string\">'https://example.com/index.html'</span>)\n</code></pre>\n<h2 id=\"16-utilizar-una-versión-actual-de-electron\"><a href=\"#16-utilizar-una-versión-actual-de-electron\">16) Utilizar una versión actual de Electron</a></h2>\n<p>You should strive for always using the latest available version of Electron. Whenever a new major version is released, you should attempt to update your app as quickly as possible.</p>\n<h3 id=\"¿por-què-13\"><a href=\"#¿por-què-13\">¿Por què?</a></h3>\n<p>Una aplicación construida con una versión anterior de Electron, Chromium y Node.js es un objetivo más fácil que una aplicación que está usando versiones más recientes de esos componentes. Generalmente hablando, los problemas de seguridad y exploits para viejas verciones de Chromium y Node.js están más ampliamente disponibles.</p>\n<p>Ambos Chomium y Node.js impresionantes son impresionantes hazañas de ingeniería construidas por miles de talentosos desarrolladores. Dada su popularidad, su seguridad es cuidadosamente probada y analizada por investigadores de seguridad igualmente calificados. Muchos de esos investigadores <a href=\"https://en.wikipedia.org/wiki/Responsible_disclosure\">disclose vulnerabilities responsibly</a>, lo que generalmente quiere decir que los investigadores darán a Chromium y Node.js algo de tiempo para solucionar los problemas antes de publicarlos. Tu aplicación será más segura si está ejecutando una versión reciente de Electron (y por tanto, Chromium y Node.js) para los cuales problemas de seguridad potenciales no son tan conocidos.</p>",
      "title": "Seguridad, capacidades nativas y su responsabilidad",
      "description": "⚠️ bajo ninguna circunstancia deberías cargar y ejecutar código remoto con la integración Node.js activada. En vez de eso, usa solo archivos locales (empaquetados juntos con tu aplicación) para ejecutar el código Node.js. Para mostrar contenido remoto, use la etiqueta <webview> o BrowserView, asegúrese de deshabilitar el nodeIntegration y habilitar contextIsolation."
    },
    "/docs/api/structures/segmented-control-segment": {
      "locale": "es-ES",
      "slug": "segmented-control-segment",
      "href": "/docs/api/structures/segmented-control-segment",
      "crowdinFileId": "256499",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/segmented-control-segment.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"segmentedcontrolsegment-object\"><a href=\"#segmentedcontrolsegment-object\">SegmentedControlSegment Object</a></h1>\n<ul>\n<li><code>label</code> String (optional) - The text to appear in this segment.</li>\n<li><code>icon</code> NativeImage (optional) - The image to appear in this segment.</li>\n<li><code>enabled</code> Boolean (optional) - Whether this segment is selectable. Default: true.</li>\n</ul>",
      "title": "SegmentedControlSegment Object",
      "description": ""
    },
    "/docs/api/structures/serial-port": {
      "locale": "es-ES",
      "slug": "serial-port",
      "href": "/docs/api/structures/serial-port",
      "crowdinFileId": "256501",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/serial-port.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"serialport-object\"><a href=\"#serialport-object\">SerialPort Object</a></h1>\n<ul>\n<li><code>portId</code> String - Unique identifier for the port.</li>\n<li><code>portName</code> String - Name of the port.</li>\n<li><code>displayName</code> String - A string suitable for display to the user for describing this device.</li>\n<li><code>vendorId</code> String - Optional USB vendor ID.</li>\n<li><code>productId</code> String - Optional USB product ID.</li>\n<li><code>serialNumber</code> String - The USB device serial number.</li>\n<li><code>usbDriverName</code> String (optional) - Represents a single serial port on macOS can be enumerated by multiple drivers.</li>\n<li><code>deviceInstanceId</code> String (optional) - A stable identifier on Windows that can be used for device permissions.</li>\n</ul>",
      "title": "SerialPort Object",
      "description": ""
    },
    "/docs/api/structures/service-worker-info": {
      "locale": "es-ES",
      "slug": "service-worker-info",
      "href": "/docs/api/structures/service-worker-info",
      "crowdinFileId": "256503",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/service-worker-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"serviceworkerinfo-object\"><a href=\"#serviceworkerinfo-object\">ServiceWorkerInfo Object</a></h1>\n<ul>\n<li><code>scriptUrl</code> String - The full URL to the script that this service worker runs</li>\n<li><code>scope</code> String - The base URL that this service worker is active for.</li>\n<li><code>renderProcessId</code> Number - The virtual ID of the process that this service worker is running in.  This is not an OS level PID.  This aligns with the ID set used for <code>webContents.getProcessId()</code>.</li>\n</ul>",
      "title": "ServiceWorkerInfo Object",
      "description": ""
    },
    "/docs/api/service-workers": {
      "locale": "es-ES",
      "slug": "service-workers",
      "href": "/docs/api/service-workers",
      "crowdinFileId": "256363",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/service-workers.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-serviceworkers\"><a href=\"#clase-serviceworkers\">Clase: ServiceWorkers</a></h2>\n<blockquote>\n<p>Query and receive events from a sessions active service workers.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Las instancias de la clase <code>ServiceWorkers</code> son accedidas utilizado la propiedad <code>serviceWorkers</code> de una <code>Session</code>.</p>\n<p>Por ejemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Get all service workers.</span>\n<span class=\"hljs-built_in\">console</span>.log(session.defaultSession.serviceWorkers.getAllRunning())\n\n<span class=\"hljs-comment\">// Handle logs and get service worker info</span>\nsession.defaultSession.serviceWorkers.on(<span class=\"hljs-string\">'console-message'</span>, (event, messageDetails) => {\n  <span class=\"hljs-built_in\">console</span>.log(\n    <span class=\"hljs-string\">'Got service worker message'</span>,\n    messageDetails,\n    <span class=\"hljs-string\">'from'</span>,\n    session.defaultSession.serviceWorkers.getFromVersionID(messageDetails.versionId)\n  )\n})\n</code></pre>\n<h3 id=\"eventos-de-instancia\"><a href=\"#eventos-de-instancia\">Eventos de Instancia</a></h3>\n<p>Los siguientes eventos están disponibles en instancias de <code>ServiceWorkers</code>:</p>\n<h4 id=\"evento-console-message\"><a href=\"#evento-console-message\">Evento: 'console-message'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>messageDetails</code> Object - Information about the console message<ul>\n<li><code>message</code> String - The actual console message</li>\n<li><code>versionId</code> Number - The version ID of the service worker that sent the log message</li>\n<li><code>source</code> String - The type of source for this message.  Can be <code>javascript</code>, <code>xml</code>, <code>network</code>, <code>console-api</code>, <code>storage</code>, <code>app-cache</code>, <code>rendering</code>, <code>security</code>, <code>deprecation</code>, <code>worker</code>, <code>violation</code>, <code>intervention</code>, <code>recommendation</code> or <code>other</code>.</li>\n<li><code>level</code> Number - The log level, from 0 to 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>sourceUrl</code> String - The URL the message came from</li>\n<li><code>lineNumber</code> Number - The line number of the source that triggered this console message</li>\n</ul></li>\n</ul>\n<p>Emitted when a service worker logs something to the console.</p>\n<h4 id=\"evento-registration-completed\"><a href=\"#evento-registration-completed\">Evento: 'registration-completed'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>details</code> Object - Información sobre el service worker registrado<ul>\n<li><code>scope</code> String - La URL base para la que un service worker está registrada</li>\n</ul></li>\n</ul>\n<p>Emitido cuando un service worker ha sido registrado. Puede ocurrir después de una llama a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\"><code>navigator.serviceWorker.register('/sw.js')</code></a> se resuelve con éxito o cuando una extensión de Chrome es cargada.</p>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<p>Lo siguientes métodos están disponibles en instancias de <code>ServiceWorkers</code>:</p>\n<h4 id=\"serviceworkersgetallrunning\"><a href=\"#serviceworkersgetallrunning\"><code>serviceWorkers.getAllRunning()</code></a></h4>\n<p>Returns <code>Record&#x3C;Number, ServiceWorkerInfo></code> - A <a href=\"/docs/api/structures/service-worker-info\">ServiceWorkerInfo</a> object where the keys are the service worker version ID and the values are the information about that service worker.</p>\n<h4 id=\"serviceworserviceworkersgetfromversionidversionid\"><a href=\"#serviceworserviceworkersgetfromversionidversionid\"><code>serviceWorserviceWorkers.getFromVersionID(versionId)</code></a></h4>\n<ul>\n<li><code>versionId</code> Number</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/service-worker-info\"><code>ServiceWorkerInfo</code></a> - Information about this service worker</p>\n<p>If the service worker does not exist or is not running this method will throw an exception.</p>",
      "title": "Clase: ServiceWorkers",
      "description": "Query and receive events from a sessions active service workers."
    },
    "/docs/api/session": {
      "locale": "es-ES",
      "slug": "session",
      "href": "/docs/api/session",
      "crowdinFileId": "256365",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/session.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"session\"><a href=\"#session\">session</a></h1>\n<blockquote>\n<p>Administra las sesiones del navegador, cookies, cache, configuración del proxy, etc.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p>El módulo <code>session</code> puede ser usado para crear nuevos objetos <code>session</code>.</p>\n<p>También puede acceder el <code>session</code> de las páginas existentes utilizando la propiedad <code>session</code> de <a href=\"/docs/api/web-contents\"><code>WebContents</code></a>, o desde el módulo <code>session</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> ses = win.webContents.session\n<span class=\"hljs-built_in\">console</span>.log(ses.getUserAgent())\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>session</code> tiene los siguientes métodos:</p>\n<h3 id=\"sessionfrompartitionpartition-options\"><a href=\"#sessionfrompartitionpartition-options\"><code>session.fromPartition(partition[, options])</code></a></h3>\n<ul>\n<li><code>partition</code> String</li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>cache</code> Boolean - En el caso de activar la memoria cache.</li>\n</ul></li>\n</ul>\n<p>Regresa <code>Session</code> - Una instancia de session de la cadena <code>partition</code>. Cuando hay una <code>Session</code> existente con la misma <code>partition</code>, se devolverá la misma; de otra manera, una nueva instancia <code>Session</code> será creada con <code>options</code>.</p>\n<p>Si la <code>partition</code> comienza con <code>persist:</code>, la página usará una sesión persistente disponible a todas las páginas en la aplicación con la misma <code>partition</code>. si no hay un prefijo <code>persist:</code>, la página usará una sesión en memoria. Si la <code>partition</code> está vacía entonces la sesión de la aplicación será usada por defecto.</p>\n<p>Al crear una <code>Session</code> con <code>options</code>, tiene que asegurar que la <code>Session</code> con la <code>partition</code> nunca ha sido usada antes. No hay manera de cambiar las <code>options</code> de un objeto <code>Session</code> existente.</p>\n<h2 id=\"propiedades\"><a href=\"#propiedades\">Propiedades</a></h2>\n<p>El módulo <code>session</code> tiene las siguientes propiedades:</p>\n<h3 id=\"sessiondefaultsession\"><a href=\"#sessiondefaultsession\"><code>session.defaultSession</code></a></h3>\n<p>Un objeto <code>Session</code>, es el objeto de session de la aplicación por defecto.</p>\n<h2 id=\"class-session\"><a href=\"#class-session\">Class: Session</a></h2>\n<blockquote>\n<p>Obtener y configurar las propiedades de una sesión.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Puede crear un objeto <code>Session</code> en el módulo <code>session</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> ses = session.fromPartition(<span class=\"hljs-string\">'persist:name'</span>)\n<span class=\"hljs-built_in\">console</span>.log(ses.getUserAgent())\n</code></pre>\n<h3 id=\"eventos-de-instancia\"><a href=\"#eventos-de-instancia\">Eventos de Instancia</a></h3>\n<p>Los siguientes eventos están disponibles en instancias de <code>Session</code>:</p>\n<h4 id=\"evento-will-download\"><a href=\"#evento-will-download\">Evento: 'will-download'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>item</code> <a href=\"/docs/api/download-item\">DownloadItem</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitido cuando Electron está por descargar un <code>elemento</code> en <code>Contenido web</code>.</p>\n<p>Llamando <code>event.preventDefault()</code> Se cancelará la descarga y el <code>elemento</code> no estará disponible para el siguiente tick del proceso.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nsession.defaultSession.on(<span class=\"hljs-string\">'will-download'</span>, (event, item, webContents) => {\n  event.preventDefault()\n  <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'got'</span>)(item.getURL()).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">response</span>) =></span> {\n    <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>).writeFileSync(<span class=\"hljs-string\">'/somewhere'</span>, response.body)\n  })\n})\n</code></pre>\n<h4 id=\"evento-extension-loaded\"><a href=\"#evento-extension-loaded\">Evento: 'extension-loaded'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Emitted after an extension is loaded. This occurs whenever an extension is added to the \"enabled\" set of extensions. Esto incluye:</p>\n<ul>\n<li>Extensions being loaded from <code>Session.loadExtension</code>.</li>\n<li>Extensions being reloaded:<ul>\n<li>from a crash.</li>\n<li>if the extension requested it (<a href=\"https://developer.chrome.com/extensions/runtime#method-reload\"><code>chrome.runtime.reload()</code></a>).</li>\n</ul></li>\n</ul>\n<h4 id=\"evento-extension-unloaded\"><a href=\"#evento-extension-unloaded\">Evento: 'extension-unloaded'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Emitted after an extension is unloaded. This occurs when <code>Session.removeExtension</code> is called.</p>\n<h4 id=\"evento-extension-ready\"><a href=\"#evento-extension-ready\">Evento: 'extension-ready'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Emitted after an extension is loaded and all necessary browser state is initialized to support the start of the extension's background page.</p>\n<h4 id=\"evento-preconnect\"><a href=\"#evento-preconnect\">Evento: 'preconnect'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>preconnectUrl</code> String - La URL que esta siendo solicitada para preconexión por el renderer.</li>\n<li><code>allowCredentials</code> Boolean - True si el renderer está solicitando que la conexión incluya las credenciales (vea el <a href=\"https://w3c.github.io/resource-hints/#preconnect\">especificación</a> para más detalles.)</li>\n</ul>\n<p>Emitido cuando un render process solicita preconexión a una URL, generalmente debido a <a href=\"https://w3c.github.io/resource-hints/\">resource hint</a>.</p>\n<h4 id=\"evento-spellcheck-dictionary-initialized\"><a href=\"#evento-spellcheck-dictionary-initialized\">Evento: 'spellcheck-dictionary-initialized'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>languageCode</code> String - El código de idioma del archivo de diccionario</li>\n</ul>\n<p>Emitted when a hunspell dictionary file has been successfully initialized. This occurs after the file has been downloaded.</p>\n<h4 id=\"evento-spellcheck-dictionary-download-begin\"><a href=\"#evento-spellcheck-dictionary-download-begin\">Evento: 'spellcheck-dictionary-download-begin'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>languageCode</code> String - El código de idioma del archivo de diccionario</li>\n</ul>\n<p>Emitido cuando un archivo de diccionario hunspell se comienza a descargar</p>\n<h4 id=\"evento-spellcheck-dictionary-download-success\"><a href=\"#evento-spellcheck-dictionary-download-success\">Evento: 'spellcheck-dictionary-download-success'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>languageCode</code> String - El código de idioma del archivo de diccionario</li>\n</ul>\n<p>Emitido cuando un archivo de diccionario hunspell se ha descargado correctamente</p>\n<h4 id=\"evento-spellcheck-dictionary-download-failure\"><a href=\"#evento-spellcheck-dictionary-download-failure\">Evento: 'spellcheck-dictionary-download-failure'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>languageCode</code> String - El código de idioma del archivo de diccionario</li>\n</ul>\n<p>Emitted when a hunspell dictionary file download fails.  For details on the failure you should collect a netlog and inspect the download request.</p>\n<h4 id=\"event-select-hid-device\"><a href=\"#event-select-hid-device\">Event: 'select-hid-device'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>details</code> Object<ul>\n<li><code>deviceList</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n<li><code>callback</code> Función<ul>\n<li><code>deviceId</code> String | null (opcional)</li>\n</ul></li>\n</ul>\n<p>Emitido cuando un dispositivo HID necesita ser seleccionado cuando se realizó una llamada a <code>navigator.hid.requestDevice</code>. <code>callback</code> debería ser llamada con el <code>deviceId</code> a ser seleccionado; al no pasar argumentos a <code>callback</code> se cancelará la solicitud.  Adicionalmente, los permisos en <code>navigator.hid</code> pueden ser administrados aún más usando <a href=\"#sessetpermissioncheckhandlerhandler\">ses.setPermissionCheckHandler(handler)</a> y <a href=\"#sessetdevicepermissionhandlerhandler\">ses.setDevicePermissionHandler(handler)`</a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.webContents.session.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin, details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-comment\">// Agregue la lógica aquí para determinar si el permiso debería ser dado para permitir la selección HID </span>\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  <span class=\"hljs-comment\">// Opcionalmente, recupere los dispositivos persistentes anteriormente de un almacén persistente </span>\n  <span class=\"hljs-keyword\">const</span> grantedDevices = fetchGrantedDevices()\n\n  win.webContents.session.setDevicePermissionHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(details.origin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; details.deviceType === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-keyword\">if</span> (details.device.vendorId === <span class=\"hljs-number\">123</span> &#x26;&#x26; details.device.productId === <span class=\"hljs-number\">345</span>) {\n        <span class=\"hljs-comment\">// Siempre permite este tipo de dispositivo (esto permite saltar la primera llamada a  `navigator.hid.requestDevice`)</span>\n        <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n      }\n\n      <span class=\"hljs-comment\">// Busque a través de la lista de dispositivos a los que anteriormente  se le han otorgado permiso</span>\n      <span class=\"hljs-keyword\">return</span> grantedDevices.some(<span class=\"hljs-function\">(<span class=\"hljs-params\">grantedDevice</span>) =></span> {\n        <span class=\"hljs-keyword\">return</span> grantedDevice.vendorId === details.device.vendorId &#x26;&#x26;\n              grantedDevice.productId === details.device.productId &#x26;&#x26;\n              grantedDevice.serialNumber &#x26;&#x26; grantedDevice.serialNumber === details.device.serialNumber\n      })\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  win.webContents.session.on(<span class=\"hljs-string\">'select-hid-device'</span>, (event, details, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedDevice = details.deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    callback(selectedPort?.deviceId)\n  })\n})\n</code></pre>\n<h4 id=\"evento-hid-device-added\"><a href=\"#evento-hid-device-added\">Evento: 'hid-device-added'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>details</code> Object<ul>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n</ul>\n<p>Emitido cuando un nuevo dispositivo HID está disponible. Por ejemplo, cuando un nuevo dispositivo USB se conecta.</p>\n<p>Este evento sólo se emitirá después de que <code>navigator.hid.requestDevice</code> haya sido llamado y <code>select-hid-device</code> haya sido disparado.</p>\n<h4 id=\"evento-hid-device-removed\"><a href=\"#evento-hid-device-removed\">Evento: 'hid-device-removed'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>details</code> Object<ul>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n</ul>\n<p>Emitido cuando un dispositivo HID ha sido eliminado.  For example, this event will fire when a USB device is unplugged.</p>\n<p>Este evento sólo se emitirá después de que <code>navigator.hid.requestDevice</code> haya sido llamado y <code>select-hid-device</code> haya sido disparado.</p>\n<h4 id=\"evento-select-serial-port\"><a href=\"#evento-select-serial-port\">Evento: 'select-serial-port'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>portList</code> <a href=\"/docs/api/structures/serial-port\">SerialPort[]</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>callback</code> Función<ul>\n<li><code>portId</code> String</li>\n</ul></li>\n</ul>\n<p>Emitted when a serial port needs to be selected when a call to <code>navigator.serial.requestPort</code> is made. <code>callback</code> should be called with <code>portId</code> to be selected, passing an empty string to <code>callback</code> will cancel the request.  Additionally, permissioning on <code>navigator.serial</code> can be managed by using <a href=\"#sessetpermissioncheckhandlerhandler\">ses.setPermissionCheckHandler(handler)</a> with the <code>serial</code> permission.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n  win.webContents.session.on(<span class=\"hljs-string\">'select-serial-port'</span>, (event, portList, webContents, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedPort = portList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    <span class=\"hljs-keyword\">if</span> (!selectedPort) {\n      callback(<span class=\"hljs-string\">''</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      callback(selectedPort.portId)\n    }\n  })\n})\n</code></pre>\n<h4 id=\"evento-serial-port-added\"><a href=\"#evento-serial-port-added\">Evento: 'serial-port-added'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>port</code> <a href=\"/docs/api/structures/serial-port\">SerialPort</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitted after <code>navigator.serial.requestPort</code> has been called and <code>select-serial-port</code> has fired if a new serial port becomes available.  For example, this event will fire when a new USB device is plugged in.</p>\n<h4 id=\"evento-serial-port-removed\"><a href=\"#evento-serial-port-removed\">Evento: 'serial-port-removed'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>port</code> <a href=\"/docs/api/structures/serial-port\">SerialPort</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitted after <code>navigator.serial.requestPort</code> has been called and <code>select-serial-port</code> has fired if a serial port has been removed.  For example, this event will fire when a USB device is unplugged.</p>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<p>Los siguientes métodos están disponibles para instancias de <code>Sesión</code>:</p>\n<h4 id=\"sesgetcachesize\"><a href=\"#sesgetcachesize\"><code>ses.getCacheSize()</code></a></h4>\n<p>Devuelve <code>Promise&#x3C;Integer></code> - El tamaño de cache de la sesión actual, en bytes.</p>\n<h4 id=\"sesclearcache\"><a href=\"#sesclearcache\"><code>ses.clearCache()</code></a></h4>\n<p>Devuelve <code>Promise&#x3C;void></code> - Se resuelve cuando la operación de limpieza de cache es completada.</p>\n<p>Borra la memoria caché del HTTP de la sesión.</p>\n<h4 id=\"sesclearstoragedataoptions\"><a href=\"#sesclearstoragedataoptions\"><code>ses.clearStorageData([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>origin</code> String (opcional) - Debe seguir la representación de <code>window.location.origin</code> <code>scheme://host:port</code>.</li>\n<li><code>storages</code> String<a href=\"/docs/api/opcional\"></a> - Los tipos de almacenamientos para limpiar, puede contener: <code>appcache</code>, <code>cookies</code>, <code>filesystem</code>, <code>indexdb</code>, <code>localstorage</code>, <code>shadercache</code>, <code>websql</code>, <code>serviceworkers</code>, <code>cachestorage</code>. If not specified, clear all storage types.</li>\n<li><code>quotas</code> String<a href=\"/docs/api/opcional\"></a> - El tipo de cuotas a limpiar, puede contener: <code>temporary</code>, <code>persistent</code>, <code>syncable</code>. If not specified, clear all quotas.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code> - Se resuelve cuando los datos del almacenamiento ha sido borrado.</p>\n<h4 id=\"sesflushstoragedata\"><a href=\"#sesflushstoragedata\"><code>ses.flushStorageData()</code></a></h4>\n<p>Escribe cualquier dato DOMStorage que no lo haya sido en disco.</p>\n<h4 id=\"sessetproxyconfig\"><a href=\"#sessetproxyconfig\"><code>ses.setProxy(config)</code></a></h4>\n<ul>\n<li><code>config</code> Object<ul>\n<li><code>mode</code> String (optional) - The proxy mode. Should be one of <code>direct</code>, <code>auto_detect</code>, <code>pac_script</code>, <code>fixed_servers</code> or <code>system</code>. If it's unspecified, it will be automatically determined based on other specified options.<ul>\n<li><code>direct</code> In direct mode all connections are created directly, without any proxy involved.</li>\n<li><code>auto_detect</code> In auto_detect mode the proxy configuration is determined by a PAC script that can be downloaded at <a href=\"http://wpad/wpad.dat\">http://wpad/wpad.dat</a>.</li>\n<li><code>pac_script</code> In pac_script mode the proxy configuration is determined by a PAC script that is retrieved from the URL specified in the <code>pacScript</code>. This is the default mode if <code>pacScript</code> is specified.</li>\n<li><code>fixed_servers</code> In fixed_servers mode the proxy configuration is specified in <code>proxyRules</code>. This is the default mode if <code>proxyRules</code> is specified.</li>\n<li><code>system</code> In system mode the proxy configuration is taken from the operating system. Note that the system mode is different from setting no proxy configuration. In the latter case, Electron falls back to the system settings only if no command-line options influence the proxy configuration.</li>\n</ul></li>\n<li><code>pacScript</code> String (opcional) - La URL asociada con el archivo PAC.</li>\n<li><code>proxyRules</code> String (opcional) - Reglas indicando cuales proxies usar.</li>\n<li><code>proxyBypassRules</code> String (opcional) - Reglas indicando que URLs deberían ser omitidas por la configuración del proxy.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code> - Se resuelve cuando el proceso de configuración del proxy está completo.</p>\n<p>Configurar proxy.</p>\n<p>When <code>mode</code> is unspecified, <code>pacScript</code> and <code>proxyRules</code> are provided together, the <code>proxyRules</code> option is ignored and <code>pacScript</code> configuration is applied.</p>\n<p>You may need <code>ses.closeAllConnections</code> to close currently in flight connections to prevent pooled sockets using previous proxy from being reused by future requests.</p>\n<p>Las <code>proxyRules</code> tienen las siguientes reglas abajo:</p>\n<pre><code class=\"hljs language-sh\">proxyRules = schemeProxies[<span class=\"hljs-string\">\";\"</span>&#x3C;schemeProxies>]\nschemeProxies = [&#x3C;urlScheme><span class=\"hljs-string\">\"=\"</span>]&#x3C;proxyURIList>\nurlScheme = <span class=\"hljs-string\">\"http\"</span> | <span class=\"hljs-string\">\"https\"</span> | <span class=\"hljs-string\">\"ftp\"</span> | <span class=\"hljs-string\">\"socks\"</span>\nproxyURIList = &#x3C;proxyURL>[<span class=\"hljs-string\">\",\"</span>&#x3C;proxyURIList>]\nproxyURL = [&#x3C;proxyScheme><span class=\"hljs-string\">\"://\"</span>]&#x3C;proxyHost>[<span class=\"hljs-string\">\":\"</span>&#x3C;proxyPort>]\n</code></pre>\n<p>Por ejemplo:</p>\n<ul>\n<li><code>http=foopy:80;ftp=foopy2</code> - Usa proxy HTTP <code>foopy:80</code> para URL <code>http://</code>, HTTP proxy <code>foopy2:80</code> para URL <code>ftp://</code>.</li>\n<li><code>foopy:80</code> - Usa Proxy HTTP <code>foopy:80</code> para todas las URLs.</li>\n<li><code>foopy:80,bar,direct://</code> - Usa proxy HTTP <code>foopy:80</code> para todas las URLs, no sobre <code>bar</code> si<code>foopy:80</code> no está disponible, y después de eso no usar ningún proxy.</li>\n<li><code>socks4://foopy</code> - Usa SOCKS v4 proxy <code>foopy:1080</code> para todas las URLs.</li>\n<li><code>http=foopy,socks5://bar.com</code> - Usa HTTP proxy <code>foopy</code> para las URLs http, y falla para el proxy SOCKS5 <code>bar.com</code> si <code>foopy</code> no está disponible.</li>\n<li><code>http=foopy,direct://</code> - Usa el proxy HTTP <code>foopy</code> para URLs http, y no usa el proxy si <code>foopy</code> no está disponible.</li>\n<li><code>http=foopy;socks=foopy2</code> - Usa el proxy HTTP <code>foopy</code> para URLs HTTP, y usa <code>socks4://foopy2</code> para el resto de URLs.</li>\n</ul>\n<p>El <code>proxyBypassRules</code> es una lista separada por comas de las reglasa que se describen a continuación:</p>\n<ul>\n<li>\n<p><code>[ URL_SCHEME \"://\" ] HOSTNAME_PATTERN [ \":\" &#x3C;port> ]</code></p>\n<p> Une todos los nombres que coinciden con el patrón HOSTNAME_PATTERN.</p>\n<p> Examples: \"foobar.com\", \"<em>foobar.com\", \"</em>.foobar.com\", \"<em>foobar.com:99\", \"<a href=\"https://x\">https://x</a>.</em>.y.com:99\"</p>\n</li>\n<li>\n<p><code>\".\" HOSTNAME_SUFFIX_PATTERN [ \":\" PORT ]</code></p>\n<p> Une sufijos de dominios particulares.</p>\n<p> Examples: \".google.com\", \".com\", \"<a href=\"http://.google.com\">http://.google.com</a>\"</p>\n</li>\n<li>\n<p><code>[ SCHEME \"://\" ] IP_LITERAL [ \":\" PORT ]</code></p>\n<p> Une URLs que son literales de dirección IP.</p>\n<p> Ejemplos: \"127.0.1\", \"[0:0::1]\", \"[::1]\", \"<a href=\"http://%5B::1%5D:99\">http://[::1]:99</a>\"</p>\n</li>\n<li>\n<p><code>IP_LITERAL \"/\" PREFIX_LENGTH_IN_BITS</code></p>\n<p> Match any URL that is to an IP literal that falls between the given range. IP range is specified using CIDR notation.</p>\n<p> Ejemplos: \"192.168.1.1/16\", \"fefe:13::abc/33\".</p>\n</li>\n<li>\n<p><code>&#x3C;local></code></p>\n<p> Match local addresses. The meaning of <code>&#x3C;local></code> is whether the host matches one of: \"127.0.0.1\", \"::1\", \"localhost\".</p>\n</li>\n</ul>\n<h4 id=\"sesresolveproxyurl\"><a href=\"#sesresolveproxyurl\"><code>ses.resolveProxy(url)</code></a></h4>\n<ul>\n<li><code>url</code> URL</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - Resolves with the proxy information for <code>url</code>.</p>\n<h4 id=\"sesforcereloadproxyconfig\"><a href=\"#sesforcereloadproxyconfig\"><code>ses.forceReloadProxyConfig()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the all internal states of proxy service is reset and the latest proxy configuration is reapplied if it's already available. The pac script will be fetched from <code>pacScript</code> again if the proxy mode is <code>pac_script</code>.</p>\n<h4 id=\"sessetdownloadpathpath\"><a href=\"#sessetdownloadpathpath\"><code>ses.setDownloadPath(path)</code></a></h4>\n<ul>\n<li><code>path</code> String - The download location.</li>\n</ul>\n<p>Sets download saving directory. By default, the download directory will be the <code>Downloads</code> under the respective app folder.</p>\n<h4 id=\"sesenablenetworkemulationoptions\"><a href=\"#sesenablenetworkemulationoptions\"><code>ses.enableNetworkEmulation(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>offline</code> Boolean (optional) - Whether to emulate network outage. Defaults to false.</li>\n<li><code>latency</code> Double (optional) - RTT in ms. Defaults to 0 which will disable latency throttling.</li>\n<li><code>downloadThroughput</code> Double (optional) - Download rate in Bps. Defaults to 0 which will disable download throttling.</li>\n<li><code>uploadThroughput</code> Double (optional) - Upload rate in Bps. Defaults to 0 which will disable upload throttling.</li>\n</ul></li>\n</ul>\n<p>Emula la red con la configuración dada por la <code>sesión</code>.</p>\n<pre><code class=\"hljs language-javascript\">Para emular la conexión GPRS con rendimiento de <span class=\"hljs-number\">50</span>kbps y latencia de <span class=\"hljs-number\">500</span>ms.\nwindow.webContents.session.enableNetworkEmulation({\n  <span class=\"hljs-attr\">latency</span>: <span class=\"hljs-number\">500</span>,\n  <span class=\"hljs-attr\">downloadThroughput</span>: <span class=\"hljs-number\">6400</span>,\n  <span class=\"hljs-attr\">uploadThroughput</span>: <span class=\"hljs-number\">6400</span>\n})\n\n<span class=\"hljs-comment\">// Para emular la caída de la red.</span>\n<span class=\"hljs-built_in\">window</span>.webContents.session.enableNetworkEmulation({ <span class=\"hljs-attr\">offline</span>: <span class=\"hljs-literal\">true</span> })\n</code></pre>\n<h4 id=\"sespreconnectoptions\"><a href=\"#sespreconnectoptions\"><code>ses.preconnect(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>url</code> String - URL for preconnect. Only the origin is relevant for opening the socket.</li>\n<li><code>numSockets</code> Number (optional) - number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.</li>\n</ul></li>\n</ul>\n<p>Preconecta el número dado de sockets a un origen.</p>\n<h4 id=\"sescloseallconnections\"><a href=\"#sescloseallconnections\"><code>ses.closeAllConnections()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when all connections are closed.</p>\n<p><strong>Note:</strong> It will terminate / fail all requests currently in flight.</p>\n<h4 id=\"sesdisablenetworkemulation\"><a href=\"#sesdisablenetworkemulation\"><code>ses.disableNetworkEmulation()</code></a></h4>\n<p>Disables any network emulation already active for the <code>session</code>. Resets to the original network configuration.</p>\n<h4 id=\"sessetcertificateverifyprocproc\"><a href=\"#sessetcertificateverifyprocproc\"><code>ses.setCertificateVerifyProc(proc)</code></a></h4>\n<ul>\n<li><code>proc</code> Function | null<ul>\n<li>Objeto <code>request</code><ul>\n<li><code>hostname</code> String</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">certificate</a></li>\n<li><code>validatedCertificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>verificationResult</code> String - Resultado de la verificación de chromium.</li>\n<li><code>errorCode</code> Integer - Código de error.</li>\n</ul></li>\n<li><code>callback</code> Función<ul>\n<li><code>verificationResult</code> Integer - Value can be one of certificate error codes from <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">here</a>. Apart from the certificate error codes, the following special codes can be used.<ul>\n<li><code>0</code> - Indica éxito y deshabilita la verificación Certificate Transparency.</li>\n<li><code>-2</code> - Indica falla.</li>\n<li><code>-3</code> - Usa el resultado de verificación de chromium.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Establece el certificado de verificar proc de la <code>sesión</code>, el <code>proc</code> será cancelada con <code>proc(request, callback)</code> cuando sea solicitado una verificación del certificado del servidor. Llamando <code>callback(0)</code> se acepta el certificado, llamando <code>callback(-2)</code> se rechaza.</p>\n<p>Llamando <code>setCertificateVerifyProc(null)</code> se reveritrá la verificación de certificado por defecto.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.webContents.session.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">request, callback</span>) =></span> {\n  <span class=\"hljs-keyword\">const</span> { hostname } = request\n  <span class=\"hljs-keyword\">if</span> (hostname === <span class=\"hljs-string\">'github.com'</span>) {\n    callback(<span class=\"hljs-number\">0</span>)\n  } <span class=\"hljs-keyword\">else</span> {\n    callback(<span class=\"hljs-number\">-2</span>)\n  }\n})\n</code></pre>\n<blockquote>\n<p><strong>NOTE:</strong> The result of this procedure is cached by the network service.</p>\n</blockquote>\n<h4 id=\"sessetpermissionrequesthandlerhandler\"><a href=\"#sessetpermissionrequesthandlerhandler\"><code>ses.setPermissionRequestHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Function | null<ul>\n<li><code>contenido web</code> <a href=\"/docs/api/web-contents\">contenido web</a> - contenido web solicitando el permiso.  Por favor, tenga en cuenta que si la solicitud viene de un subframe debe utilizar <code>requestUrl</code> para comprobar el origen de la solicitud.</li>\n<li><code>permission</code> String - The type of requested permission.<ul>\n<li><code>clipboard-read</code> - Request access to read from the clipboard.</li>\n<li><code>media</code> -  Request access to media devices such as camera, microphone and speakers.</li>\n<li><code>display-capture</code> - Solicita acceso para capturar la pantalla.</li>\n<li><code>mediaKeySystem</code> - Request access to DRM protected content.</li>\n<li><code>geolocation</code> - Request access to user's current location.</li>\n<li><code>notifications</code> - Request notification creation and the ability to display them in the user's system tray.</li>\n<li><code>midi</code> - Request MIDI access in the <code>webmidi</code> API.</li>\n<li><code>midiSysex</code> - Request the use of system exclusive messages in the <code>webmidi</code> API.</li>\n<li><code>pointerLock</code> - Request to directly interpret mouse movements as an input method. Pulse <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API\">aquí</a> para saber más.</li>\n<li><code>fullscreen</code> - Request for the app to enter fullscreen mode.</li>\n<li><code>openExternal</code> - Request to open links in external applications.</li>\n<li><code>unknown</code> - Una solicitud de premiso no reconocida</li>\n</ul></li>\n<li><code>callback</code> Función<ul>\n<li><code>permiso concedido</code> Booleano - Permiso o denegado de permiso.</li>\n</ul></li>\n<li><code>details</code> Object - Some properties are only available on certain permission types.<ul>\n<li><code>externalURL</code> String (opcional) - La url de la petición <code>openExternal</code>.</li>\n<li><code>mediaTypes</code> String<a href=\"/docs/api/opcional\"></a> - Los tipos de medios que son solicitados para acceso, los elementos pueden ser <code>video</code> o <code>audio</code></li>\n<li><code>requestingUrl</code> String - La ultima URL que el frame solicitante cargo</li>\n<li><code>isMainFrame</code> Boolean - Si el marco que realiza la solicitud es el marco principal</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Configurar el controlador que será usado para responder las peticiones de permisos para la <code>sesión</code>. Llamando <code>callback(true)</code> se permitirá el permiso y <code>callback(false)</code> se rechazará. Para limpiar el manejador, llamar a <code>setPermissionRequestHandler(null)</code>.  Por favor, tenga en cuenta que debe implementar también <code>setPermissionCheckHandler</code> para obtener el manejo completo de los permisos. La mayoría de las APIs web hacen una verificación de permiso y luego hacen una solicitud de permiso si la verificación es denegada.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nsession.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).setPermissionRequestHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, callback</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (webContents.getURL() === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notifications'</span>) {\n    <span class=\"hljs-keyword\">return</span> callback(<span class=\"hljs-literal\">false</span>) <span class=\"hljs-comment\">// denied.</span>\n  }\n\n  callback(<span class=\"hljs-literal\">true</span>)\n})\n</code></pre>\n<h4 id=\"sessetpermissioncheckhandlerhandler\"><a href=\"#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Función\\<boolean> | null<ul>\n<li><code>webContents</code> (<a href=\"/docs/api/web-contents\">WebContents</a> | null) - WebContents verificando el permiso.  Por favor, tenga en cuenta que si la solicitud viene de un subframe debe utilizar <code>requestUrl</code> para comprobar el origen de la solicitud.  Todos los sub frames de origen cruzado que realizan comprobaciones de permisos pasarán un webContents <code>null</code> a este controlador, mientras que otras comprobaciones de permisos, como <code>notifications</code> siempre pasarán <code>null</code>.  Debería usar <code>embeddingOrigin</code> y <code>requestingOrigin</code> para determinar que origen se encuentra en el marco propietario y en el marco solicitante respectivamente.</li>\n<li><code>permission</code> String - Type of permission check.  Los valores válidos son <code>midiSysex</code>, <code>notifications</code>, <code>geolocation</code>, <code>media</code>,<code>mediaKeySystem</code>,<code>midi</code>, <code>pointerLock</code>, <code>fullscreen</code>, <code>openExternal</code>, <code>hid</code>, o <code>serial</code>.</li>\n<li><code>requestingOrigin</code> String - La URL de origen para la comprobación de permisos</li>\n<li><code>details</code> Object - Some properties are only available on certain permission types.<ul>\n<li><code>embeddingOrigin</code> String (opcional) - El origen del marco que incrusta el marco que hizo la verificación de permisos.  Sólo se establece cross-origin submarcos haciendo comprobaciones de permisos.</li>\n<li><code>securityOrigin</code> String (opcional) - El origen de seguridad de la comprobación <code>media</code>.</li>\n<li><code>mediaType</code> String (opcional) - El tipo de acceso a los medios que se solicita puede ser <code>video</code>, <code>audio</code> o <code>unknown</code></li>\n<li><code>requestingUrl</code> String (opcional) - La última URL que representa el marco cargado.  Esto no es proveído para cross-origin submarcos haciendo comprobaciones de permiso.</li>\n<li><code>isMainFrame</code> Boolean - Si el marco que realiza la solicitud es el marco principal</li>\n</ul></li>\n</ul></boolean></li>\n</ul>\n<p>Establece el manejador que puede ser usado para responder a las comprobaciones para <code>session</code>. Retornando <code>true</code> permitirá el permiso y <code>false</code> lo rechará.  Por favor, tenga en cuenta que debe implementar también <code>setPermissionRequestHandler</code> para obtener el manejo completo de los permisos. La mayoría de las APIs web hacen una verificación de permiso y luego hacen una solicitud de permiso si la verificación es denegada. Para borrar el manejador, llame <code>setPermissionCheckHandler(null)</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>)\nsession.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(requestingOrigin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notifications'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span> <span class=\"hljs-comment\">// concedido</span>\n  }\n\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span> <span class=\"hljs-comment\">// denegado</span>\n})\n</code></pre>\n<h4 id=\"sessetdevicepermissionhandlerhandler\"><a href=\"#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Función\\<boolean> | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>deviceType</code> String - El tipo de dispositivo para el que se esta solicitando el permiso, puede ser <code>hid</code>.</li>\n<li><code>origin</code> String - La URL de origen de verificación del permiso del dispositivo.</li>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice</a> - El dispositivo para el que se está solicitando el permiso.</li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a> - WebFrameMain comprobando el permiso del dispositivo.</li>\n</ul></li>\n</ul></boolean></li>\n</ul>\n<p>Establece el manejador que puede ser usado para responder a las comprobaciones de permiso para la <code>session</code>. Devolver <code>true</code> permitirá que el dispositivo se permitido y <code>false</code> lo rechazará. Para borrar el manejador, llame a <code>setDevicePermissionHandler(null)</code>. Este manejador puede ser usado para proveer permisos por defecto a dispositivos sin solicitar primero el permiso a dispositivos (por ejemplo a través de <code>navigator.hid.requestDevice</code>).  Si este manejador no esta difinido, los permisos por defecto para el dispositivos serán otorgados a través de la selección de dispositivo (por ejemplo a través de <code>navigator.hid.requestDevice</code>). Adicionalmente, el comportamiento por defecto de Electron es almacenar los permisos otorgados a dispositivos a través de toda la vida del correspondiente WebContents.  Si se es necesario almacenarlo a más largo plazo, un desarrollador puede almacenar los permisos otorgados (por ejemplo, cuando se maneja el evento <code>select-hid-device</code>) y luego leerlo desde ese almacenamiento con <code>setDevicePermissionHandler</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.webContents.session.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin, details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-comment\">// Agregue la lógica aquí para determinar si el permiso debería ser dado para permitir la selección HID </span>\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  <span class=\"hljs-comment\">// Opcionalmente, recupere los dispositivos persistentes anteriormente de un almacén persistente </span>\n  <span class=\"hljs-keyword\">const</span> grantedDevices = fetchGrantedDevices()\n\n  win.webContents.session.setDevicePermissionHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(details.origin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; details.deviceType === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-keyword\">if</span> (details.device.vendorId === <span class=\"hljs-number\">123</span> &#x26;&#x26; details.device.productId === <span class=\"hljs-number\">345</span>) {\n        <span class=\"hljs-comment\">// Siempre permite este tipo de dispositivo (esto permite saltar la primera llamada a  `navigator.hid.requestDevice`)</span>\n        <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n      }\n\n      <span class=\"hljs-comment\">// Busque a través de la lista de dispositivos a los que anteriormente  se le han otorgado permiso</span>\n      <span class=\"hljs-keyword\">return</span> grantedDevices.some(<span class=\"hljs-function\">(<span class=\"hljs-params\">grantedDevice</span>) =></span> {\n        <span class=\"hljs-keyword\">return</span> grantedDevice.vendorId === details.device.vendorId &#x26;&#x26;\n              grantedDevice.productId === details.device.productId &#x26;&#x26;\n              grantedDevice.serialNumber &#x26;&#x26; grantedDevice.serialNumber === details.device.serialNumber\n      })\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  win.webContents.session.on(<span class=\"hljs-string\">'select-hid-device'</span>, (event, details, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedDevice = details.deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    callback(selectedPort?.deviceId)\n  })\n})\n</code></pre>\n<h4 id=\"sesclearhostresolvercache\"><a href=\"#sesclearhostresolvercache\"><code>ses.clearHostResolverCache()</code></a></h4>\n<p>Devuelve <code>Promise&#x3C;void></code> - Se resuelve cuando la operación es completada.</p>\n<p>Borra la caché de resolución de host.</p>\n<h4 id=\"sesallowntlmcredentialsfordomainsdomains\"><a href=\"#sesallowntlmcredentialsfordomainsdomains\"><code>ses.allowNTLMCredentialsForDomains(domains)</code></a></h4>\n<ul>\n<li><code>dominio</code> Cadena - Una lista separada por coma de servidores para los cuales la autenticación integrada está habilitada.</li>\n</ul>\n<p>Configura dinámicamente cada vez que se envíen credenciales para HTTP NTLM o negociaciones de autenticación.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">// consider any url ending with `example.com`, `foobar.com`, `baz`</span>\n<span class=\"hljs-comment\">// for integrated authentication.</span>\nsession.defaultSession.allowNTLMCredentialsForDomains(<span class=\"hljs-string\">'*example.com, *foobar.com, *baz'</span>)\n\n<span class=\"hljs-comment\">// consider all urls for integrated authentication.</span>\nsession.defaultSession.allowNTLMCredentialsForDomains(<span class=\"hljs-string\">'*'</span>)\n</code></pre>\n<h4 id=\"sessetuseragentuseragent-acceptlanguages\"><a href=\"#sessetuseragentuseragent-acceptlanguages\"><code>ses.setUserAgent(userAgent[, acceptLanguages])</code></a></h4>\n<ul>\n<li><code>userAgent</code> cadena</li>\n<li><code>lenguajes aceptados</code> Cadena (opcional)</li>\n</ul>\n<p>Reemplaza el <code>userAgent</code> y los <code>lenguajes aceptados</code> para esta sesión.</p>\n<p>Los <code>lenguajes aceptados</code> deben estar ordenados en una lista separada por coma de códigos de lenguaje, por ejemplo <code>\"en-US,fr,de,ko,zh-CN,ja\"</code>.</p>\n<p>Esto no afecta el <code>contenido web</code> existente, y cada <code>contenido web</code> puede usar <code>webContents.setUserAgent</code> para sobreescribir el agente de sesión de usuario.</p>\n<h4 id=\"sesispersistent\"><a href=\"#sesispersistent\"><code>ses.isPersistent()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la sesión es persistente o no. The default <code>webContents</code> session of a <code>BrowserWindow</code> is persistent. When creating a session from a partition, session prefixed with <code>persist:</code> will be persistent, while others will be temporary.</p>\n<h4 id=\"sesgetuseragent\"><a href=\"#sesgetuseragent\"><code>ses.getUserAgent()</code></a></h4>\n<p>Devuelve <code>Cadena</code> - El agente usuario para esta sesión.</p>\n<h4 id=\"sessetsslconfigconfig\"><a href=\"#sessetsslconfigconfig\"><code>ses.setSSLConfig(config)</code></a></h4>\n<ul>\n<li><code>config</code> Object<ul>\n<li><code>minVersion</code> String (opcional) - Puede ser <code>tls1</code>, <code>tls1.1</code>, <code>tls1.2</code> o <code>tls1.3</code>. The minimum SSL version to allow when connecting to remote servers. Por defecto a <code>tls1</code>.</li>\n<li><code>maxVersion</code> String (opcional) - Puede ser <code>tls1.2</code> o <code>tls1.3</code>. The maximum SSL version to allow when connecting to remote servers. Por defecto es <code>tls1.3</code>.</li>\n<li><code>disabledCipherSuites</code> Integer<a href=\"/docs/api/optional\"></a> - List of cipher suites which should be explicitly prevented from being used in addition to those disabled by the net built-in policy. Supported literal forms: 0xAABB, where AA is <code>cipher_suite[0]</code> and BB is <code>cipher_suite[1]</code>, as defined in RFC 2246, Section 7.4.1.2. Unrecognized but parsable cipher suites in this form will not return an error. Ex: To disable TLS_RSA_WITH_RC4_128_MD5, specify 0x0004, while to disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002. Note that TLSv1.3 ciphers cannot be disabled using this mechanism.</li>\n</ul></li>\n</ul>\n<p>Sets the SSL configuration for the session. All subsequent network requests will use the new configuration. Existing network connections (such as WebSocket connections) will not be terminated, but old sockets in the pool will not be reused for new connections.</p>\n<h4 id=\"sesgetblobdataidentifier\"><a href=\"#sesgetblobdataidentifier\"><code>ses.getBlobData(identifier)</code></a></h4>\n<ul>\n<li><code>identificador</code> Cadena - UUID válido.</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;Buffer></code> - Se resuelve con datos blob.</p>\n<h4 id=\"sesdownloadurlurl\"><a href=\"#sesdownloadurlurl\"><code>ses.downloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Inicia una descargar del recurso en <code>url</code>. La API generará un <a href=\"/docs/api/download-item\">DownloadItem</a> que puede ser accedido con el evento <a href=\"#event-will-download\">will-download</a>.</p>\n<p><strong>Note:</strong> Esto no realiza ninguna comprobación de seguridad relacionada con la pagina de origen a diferencia de <a href=\"/docs/api/web-contents#contentsdownloadurlurl\"><code>webContents.downloadURL</code></a>.</p>\n<h4 id=\"sescreateinterrupteddownloadoptions\"><a href=\"#sescreateinterrupteddownloadoptions\"><code>ses.createInterruptedDownload(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>ruta</code> Cadena - ruta de acceso absoluta de la descarga.</li>\n<li><code>Cadeba URL</code> Cadena[] - Cadena de URL completa para la descarga.</li>\n<li><code>mimeType</code> Cadena (opcional)</li>\n<li><code>offset</code> Entero - rango de inicio para la descarga.</li>\n<li><code>longitud</code> Entero - longitud total de la descarga.</li>\n<li><code>lastModified</code> String (opcional) - Último valor del encabezado modificado.</li>\n<li><code>eTag</code> String (opcional) - Valor ETag del encabezado.</li>\n<li><code>Tiempo de inicio</code> Doble (opcional) - Tiempo en que se inició la descarga en números de segundo desde epoch de UNIX.</li>\n</ul></li>\n</ul>\n<p>Permite <code>cancelar</code> o <code>interrumpir</code> descargas de una <code>Sesión</code> previa. La API generará un <a href=\"/docs/api/download-item\">elemento de descarga</a> que puede ser accesado con el evento <a href=\"#event-will-download\">se descargará</a>. El <a href=\"/docs/api/download-item\">Elemento de descarga</a> no tendrá ningún <code>contenido web</code> asociado con el y el estado inicial será <code>interrumpido</code>. La descarga empezará solo cuando la <code>reanudación</code> de la API sea llamada en el <a href=\"/docs/api/download-item\">elemento descargado</a>.</p>\n<h4 id=\"sesclearauthcache\"><a href=\"#sesclearauthcache\"><code>ses.clearAuthCache()</code></a></h4>\n<p>Devuelve <code>Promise&#x3C;void></code> - resuelve cuando se ha borrado el caché de autenticación HTTP de la sesión.</p>\n<h4 id=\"sessetpreloadspreloads\"><a href=\"#sessetpreloadspreloads\"><code>ses.setPreloads(preloads)</code></a></h4>\n<ul>\n<li><code>preloads</code> String[] - Un array de ruta absoluta para precargar scripts</li>\n</ul>\n<p>Agrega scripts que se ejecutarán en TODOS los contenidos web que están asociados con esta sesión justo antes de que se ejecuten los scripts de <code>preload</code> normales.</p>\n<h4 id=\"sesgetpreloads\"><a href=\"#sesgetpreloads\"><code>ses.getPreloads()</code></a></h4>\n<p>Devuelve un array de rutas <code>String[]</code> para precargar guiones que han sido registrado.</p>\n<h4 id=\"sessetspellcheckerenabledenable\"><a href=\"#sessetspellcheckerenabledenable\"><code>ses.setSpellCheckerEnabled(enable)</code></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Sets whether to enable the builtin spell checker.</p>\n<h4 id=\"sesisspellcheckerenabled\"><a href=\"#sesisspellcheckerenabled\"><code>ses.isSpellCheckerEnabled()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the builtin spell checker is enabled.</p>\n<h4 id=\"sessetspellcheckerlanguageslanguages\"><a href=\"#sessetspellcheckerlanguageslanguages\"><code>ses.setSpellCheckerLanguages(languages)</code></a></h4>\n<ul>\n<li><code>languages</code> String[] - Un array de códigos de idiomas para habilitar corrector ortográfico.</li>\n</ul>\n<p>El corrector ortográfico integrado no detecta automáticamente en que idioma un usuario esta escribiendo.  Para que el corrector ortográfico compruebe correctamente sus palabras, usted debe llamar a esta API con un array de códigos de idiomas.  Usted puede obtener la lista de los códigos de idiomas soportados con la propiedad <code>ses.availableSpellCheckerLanguages</code>.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and will detect your language automatically.  This API is a no-op on macOS.</p>\n<h4 id=\"sesgetspellcheckerlanguages\"><a href=\"#sesgetspellcheckerlanguages\"><code>ses.getSpellCheckerLanguages()</code></a></h4>\n<p>Devuelve <code>String[]</code> - Un array de códigos de idiomas para los que el corrector ortográfico esta habilitado.  Si esta lista está vacía, el corrector ortográfico volverá a usar <code>en-US</code>.  Por defecto al iniciar si esta lista de opción es una lista vacía Electron tratará de llenar esta opción con el locale actual del sistema operativo.  Este configuración es persistente entre reinicios.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and has its own list of languages.  This API is a no-op on macOS.</p>\n<h4 id=\"sessetspellcheckerdictionarydownloadurlurl\"><a href=\"#sessetspellcheckerdictionarydownloadurlurl\"><code>ses.setSpellCheckerDictionaryDownloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String - Una URL base para Electron desde donde descargar los diccionarios hunspell.</li>\n</ul>\n<p>Por defecto Electron descargará diccionarios hunspell desde la CDN de Chromium.  Si usted quiere sobrescribir este comportamiento puede usar esta API para apuntar el descargador de diccionarios a su propia versión alojada de diccionarios hunspell.  Nosotros publicamos un archivo <code>hunspell_dictionaries.zip</code> con cada versión el cual contiene los archivos que necesitas para alojar aquí, el servidor de archivos debe ser <strong>case insensitive</strong>, debe cargar cada archivo dos veces, una como tiene este archivo ZIP y otra con el nombre del archivo todo con minúsculas.</p>\n<p>Si los archivos presentes en <code>hunspell_dictionaries.zip</code> están disponible en <code>https://example.com/dictionaries/language-code.bdic</code> entonces entonces debería llamar esta api con <code>ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')</code>.  Por favor, tenga en cuenta la barra final.  La URL a los diccionarios esta formada como <code>${url}${filename}</code>.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and therefore we do not download any dictionary files.  This API is a no-op on macOS.</p>\n<h4 id=\"seslistwordsinspellcheckerdictionary\"><a href=\"#seslistwordsinspellcheckerdictionary\"><code>ses.listWordsInSpellCheckerDictionary()</code></a></h4>\n<p>Devuelve <code>Promise&#x3C;String[]></code> - Un array de todas las palabras en el diccionario personalizado de la aplicación. Resolves when the full dictionary is loaded from disk.</p>\n<h4 id=\"sesaddwordtospellcheckerdictionaryword\"><a href=\"#sesaddwordtospellcheckerdictionaryword\"><code>ses.addWordToSpellCheckerDictionary(word)</code></a></h4>\n<ul>\n<li><code>word</code> String - La palabra que desea agregar al diccionario</li>\n</ul>\n<p>Devuelve <code>Boolean</code> - Si la palabra fue correctamente escrita al diccionario personalizado. Esta API no funcionará en sesiones no persistentes (en-memoría).</p>\n<p><strong>Note:</strong> En macOS y Windows 10 esta palabra será escrita al diccionario personalizado del sistema operativo también</p>\n<h4 id=\"sesremovewordfromspellcheckerdictionaryword\"><a href=\"#sesremovewordfromspellcheckerdictionaryword\"><code>ses.removeWordFromSpellCheckerDictionary(word)</code></a></h4>\n<ul>\n<li><code>word</code> String - The word you want to remove from the dictionary</li>\n</ul>\n<p>Devuelve <code>Boolean</code> - Si la palabra fue eliminada con éxito del diccionario personalizado. Esta API no funcionará en sesiones no persistentes (en-memoría).</p>\n<p><strong>Note:</strong> On macOS and Windows 10 this word will be removed from the OS custom dictionary as well</p>\n<h4 id=\"sesloadextensionpath-options\"><a href=\"#sesloadextensionpath-options\"><code>ses.loadExtension(path[, options])</code></a></h4>\n<ul>\n<li><code>path</code> String - Path to a directory containing an unpacked Chrome extension</li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>allowFileAccess</code> Boolean - Si permitir que la extensión lea los archivos locales sobre el protocolo <code>file://</code> e inyecte scripts contenido dentro de las páginas <code>file://</code>. Esto es necesario por ejemplo para cargar las extensiones devtools en las URLs <code>file://</code>. Por defecto es falso.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;Extension></code> - se resuelve cuando la extensión está cargada.</p>\n<p>This method will raise an exception if the extension could not be loaded. If there are warnings when installing the extension (e.g. if the extension requests an API that Electron does not support) then they will be logged to the console.</p>\n<p>Note that Electron does not support the full range of Chrome extensions APIs. Vea el <a href=\"/docs/api/extensions#supported-extensions-apis\">APIs de extensiones soportadas</a> para más detalles sobre que es soportado.</p>\n<p>Note that in previous versions of Electron, extensions that were loaded would be remembered for future runs of the application. This is no longer the case: <code>loadExtension</code> must be called on every boot of your app if you want the extension to be loaded.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.on(<span class=\"hljs-string\">'ready'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> session.defaultSession.loadExtension(\n    path.join(__dirname, <span class=\"hljs-string\">'react-devtools'</span>),\n    <span class=\"hljs-comment\">// allowFileAccess is required to load the devtools extension on file:// URLs.</span>\n    { <span class=\"hljs-attr\">allowFileAccess</span>: <span class=\"hljs-literal\">true</span> }\n  )\n  <span class=\"hljs-comment\">// Note that in order to use the React DevTools extension, you'll need to</span>\n  <span class=\"hljs-comment\">// download and unzip a copy of the extension.</span>\n})\n</code></pre>\n<p>This API does not support loading packed (.crx) extensions.</p>\n<p><strong>Nota:</strong> Esta API no puede ser llamada antes de que el evento <code>ready</code> del módulo de <code>app</code> sea emitido.</p>\n<p><strong>Note:</strong> Loading extensions into in-memory (non-persistent) sessions is not supported and will throw an error.</p>\n<h4 id=\"sesremoveextensionextensionid\"><a href=\"#sesremoveextensionextensionid\"><code>ses.removeExtension(extensionId)</code></a></h4>\n<ul>\n<li><code>extensionId</code> String - ID of extension to remove</li>\n</ul>\n<p>Unloads an extension.</p>\n<p><strong>Nota:</strong> Esta API no puede ser llamada antes de que el evento <code>ready</code> del módulo de <code>app</code> sea emitido.</p>\n<h4 id=\"sesgetextensionextensionid\"><a href=\"#sesgetextensionextensionid\"><code>ses.getExtension(extensionId)</code></a></h4>\n<ul>\n<li><code>extensionId</code> String - ID of extension to query</li>\n</ul>\n<p>Devuelve <code>Extension</code> | <code>null</code> - La extensión cargada con el ID dado.</p>\n<p><strong>Nota:</strong> Esta API no puede ser llamada antes de que el evento <code>ready</code> del módulo de <code>app</code> sea emitido.</p>\n<h4 id=\"sesgetallextensions\"><a href=\"#sesgetallextensions\"><code>ses.getAllExtensions()</code></a></h4>\n<p>Devuelve <code>Extension[]</code> - Una lista de todas las extensiones cargadas.</p>\n<p><strong>Nota:</strong> Esta API no puede ser llamada antes de que el evento <code>ready</code> del módulo de <code>app</code> sea emitido.</p>\n<h4 id=\"sesgetstoragepath\"><a href=\"#sesgetstoragepath\"><code>ses.getStoragePath()</code></a></h4>\n<p>A <code>String | null</code> indicating the absolute file system path where data for this session is persisted on disk.  For in memory sessions this returns <code>null</code>.</p>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<p>Las siguientes propiedades están disponibles en instancias de <code>Sesión</code>:</p>\n<h4 id=\"sesavailablespellcheckerlanguages-readonly\"><a href=\"#sesavailablespellcheckerlanguages-readonly\"><code>ses.availableSpellCheckerLanguages</code> <em>Readonly</em></a></h4>\n<p>Un array <code>String[]</code> que consiste en todos los idiomas conocidos disponibles para el corrector ortográfico.  Proporcionar un código de lenguaje a la API <code>setSpellCheckerLanguages</code> que no este en este array resultará en un error.</p>\n<h4 id=\"sesspellcheckerenabled\"><a href=\"#sesspellcheckerenabled\"><code>ses.spellCheckerEnabled</code></a></h4>\n<p>A <code>Boolean</code> indicating whether builtin spell checker is enabled.</p>\n<h4 id=\"sesstoragepath-sololectura\"><a href=\"#sesstoragepath-sololectura\"><code>ses.storagePath</code> <em>SoloLectura</em></a></h4>\n<p>A <code>String | null</code> indicating the absolute file system path where data for this session is persisted on disk.  For in memory sessions this returns <code>null</code>.</p>\n<h4 id=\"sescookies-readonly\"><a href=\"#sescookies-readonly\"><code>ses.cookies</code> <em>Readonly</em></a></h4>\n<p>Un objeto <a href=\"/docs/api/cookies\"><code>Cookies</code></a> para esta sesión.</p>\n<h4 id=\"sesserviceworkers-sololectura\"><a href=\"#sesserviceworkers-sololectura\"><code>ses.serviceWorkers</code> <em>SoloLectura</em></a></h4>\n<p>Un objeto <a href=\"/docs/api/service-workers\"><code>ServiceWorkers</code></a> para esta sesión.</p>\n<h4 id=\"seswebrequest-readonly\"><a href=\"#seswebrequest-readonly\"><code>ses.webRequest</code> <em>Readonly</em></a></h4>\n<p>Un objeto <a href=\"/docs/api/web-request\"><code>WebRequest</code></a> para esta sesión.</p>\n<h4 id=\"sesprotocol-readonly\"><a href=\"#sesprotocol-readonly\"><code>ses.protocol</code> <em>Readonly</em></a></h4>\n<p>Un objeto <a href=\"/docs/api/protocol\"><code>Protocol</code></a> para esta sesión.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> protocol = session.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).protocol\n  <span class=\"hljs-keyword\">if</span> (!protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })) {\n    <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Failed to register protocol'</span>)\n  }\n})\n</code></pre>\n<h4 id=\"sesnetlog-readonly\"><a href=\"#sesnetlog-readonly\"><code>ses.netLog</code> <em>Readonly</em></a></h4>\n<p>Un objeto <a href=\"/docs/api/net-log\"><code>NetLog</code></a> para esta sesión.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> netLog = session.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).netLog\n  netLog.startLogging(<span class=\"hljs-string\">'/path/to/net-log'</span>)\n  <span class=\"hljs-comment\">// After some network events</span>\n  <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> netLog.stopLogging()\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Net-logs written to'</span>, path)\n})\n</code></pre>",
      "title": "session",
      "description": "Administra las sesiones del navegador, cookies, cache, configuración del proxy, etc."
    },
    "/docs/development/setting-up-symbol-server": {
      "locale": "es-ES",
      "slug": "setting-up-symbol-server",
      "href": "/docs/development/setting-up-symbol-server",
      "crowdinFileId": "256165",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/setting-up-symbol-server.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"configuración-del-servidor-de-símbolos-en-el-depurador\"><a href=\"#configuración-del-servidor-de-símbolos-en-el-depurador\">Configuración del servidor de símbolos en el depurador</a></h1>\n<p>Los símbolos de depuración le permiten tener mejores sesiones de depuración. Ellos tienen información acerca de las funciones contenidas en ejecutables y bibliotecas dinámicas y le proporciona información para obtener pilas de llamadas limpias. Un servidor de símbolos permite al depurador cargar los símbolos, binarios y fuentes correctas automáticamente sin obligar a los usuarios a descargar grandes archivos de depuración. El servidor funciona como <a href=\"https://support.microsoft.com/kb/311503\">Microsoft's symbol server</a> por lo que la documentación de allí puede ser útil.</p>\n<p>Tenga en cuenta que debido a que las compilaciones de Electron liberadas están muy optimizadas, la depuración no siempre es fácil. El depurador no podrá mostrarle el contenido de todas las variables y la ruta de ejecución puede parecer extraña debido a la alineación, las llamadas de cola y otras optimizaciones del compilador. La única solución es compilar una versión local no optimizada.</p>\n<p>El URL oficial del servidor de símbolos para Electron es <a href=\"https://symbols.electronjs.org\">https://symbols.electronjs.org</a>. No puede visitar esta URL directamente, debe agregarla a la ruta del símbolo de su herramienta de depuración. En los ejemplos a continuación, se usa un directorio de caché local para evitar obtener repetidamente el PDB desde el servidor. Reemplace <code>c:\\code\\symbols</code> con un directorio de cache apropiado en su máquina.</p>\n<h2 id=\"usando-el-servidor-de-símbolos-en-windbg\"><a href=\"#usando-el-servidor-de-símbolos-en-windbg\">Usando el servidor de símbolos en Windbg</a></h2>\n<p>La ruta del símbolo de Windbg se configura con un valor de cadena delimitado con caracteres de asterisco. Para utilizar solo el servidor de símbolos de Electron, añada la siguiente entrada a la ruta de símbolo (<strong>Nota:</strong> puede reemplazar <code>c:\\code\\symbols</code> con cualquier directorio de escritura en el computador, si se prefiere una ubicación distinta para los símbolos descargados):</p>\n<pre><code class=\"hljs language-powershell\">SRV*c:\\code\\symbols\\*https://symbols.electronjs.org\n</code></pre>\n<p>Configure esta cadena como <code>_NT_SYMBOL_PATH</code> en el entorno, utilizando los menús Windbg o escribiendo el comando <code>.sympath</code>. Si también desea obtener símbolos de el servidor de símbolos de Microsoft, debería enumerarlos primero:</p>\n<pre><code class=\"hljs language-powershell\">SRV*c:\\code\\symbols\\*https://msdl.microsoft.com/download/symbols;SRV*c:\\code\\symbols\\*https://symbols.electronjs.org\n</code></pre>\n<h2 id=\"usando-el-servidor-de-símbolos-en-visual-studio\"><a href=\"#usando-el-servidor-de-símbolos-en-visual-studio\">Usando el servidor de símbolos en Visual Studio</a></h2>\n<p><img src=\"https://mdn.mozillademos.org/files/733/symbol-server-vc8express-menu.jpg\" alt=\"Herramientas » Opciones\"> <img src=\"https://mdn.mozillademos.org/files/2497/2005_options.gif\" alt=\"Configuraciones de Simbolos\"></p>\n<h2 id=\"solución-de-problemas-los-símbolos-no-se-cargarán\"><a href=\"#solución-de-problemas-los-símbolos-no-se-cargarán\">Solución de problemas: los símbolos no se cargarán</a></h2>\n<p>Escriba los siguientes comandos en Windbg para imprimir por qué los símbolos no se están cargando:</p>\n<pre><code class=\"hljs language-powershell\">> !sym noisy\n> .reload /f electron.exe\n</code></pre>",
      "title": "Configuración del servidor de símbolos en el depurador",
      "description": ""
    },
    "/docs/api/share-menu": {
      "locale": "es-ES",
      "slug": "share-menu",
      "href": "/docs/api/share-menu",
      "crowdinFileId": "256367",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/share-menu.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharemenu\"><a href=\"#sharemenu\">ShareMenu</a></h1>\n<p>La clase <code>ShareMenu</code> crea <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/\">Share Menu</a> en macOS, que puede usarse para compartir información desde el contexto actual a las apps, cuentas de redes sociales y otros servicios.</p>\n<p>Para incluir el menú compartido como submenú de otros, por favor usa el rol <code>shareMenu</code> de <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>.</p>\n<h2 id=\"clase-sharemenu\"><a href=\"#clase-sharemenu\">Clase: ShareMenu</a></h2>\n<blockquote>\n<p>Create share menu on macOS.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<h3 id=\"new-sharemenusharingitem\"><a href=\"#new-sharemenusharingitem\"><code>new ShareMenu(sharingItem)</code></a></h3>\n<ul>\n<li><code>sharingItem</code> SharingItem - The item to share.</li>\n</ul>\n<p>Creates a new share menu.</p>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<p>El objeto <code>shareMenu</code> tiene los siguientes métodos de instancia:</p>\n<h4 id=\"sharemenupopupoptions\"><a href=\"#sharemenupopupoptions\"><code>shareMenu.popup([options])</code></a></h4>\n<ul>\n<li><code>options</code> PopupOptions (optional)<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (opcional) - Por defecto es la ventana seleccionada.</li>\n<li><code>x</code> Número (opcional) - Default es la posición actual del cursor. Debe ser declarado si <code>y</code> es declarado.</li>\n<li><code>y</code> Número (opcional) - Default es la posición actual del cursor. Debe ser declarado si <code>x</code> es declarado.</li>\n<li><code>positioningItem</code> Número (opcional) <em>macOS</em> - El índice del elemento del menú que debe ser posicionado debajo del cursor en las coordenadas específicas. El valor predeterminado es -1.</li>\n<li><code>callback</code> Function (opcional) - Llamada cuando se cierra el menu.</li>\n</ul></li>\n</ul>\n<p>Este menú aparece como un menú contextual en el <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<h4 id=\"sharemenuclosepopupbrowserwindow\"><a href=\"#sharemenuclosepopupbrowserwindow\"><code>shareMenu.closePopup([browserWindow])</code></a></h4>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (opcional) - Por defecto es la ventana seleccionada.</li>\n</ul>\n<p>Cierra el menú de contexto en la <code>browserWindow</code>.</p>",
      "title": "ShareMenu",
      "description": "Create share menu on macOS."
    },
    "/docs/api/structures/shared-worker-info": {
      "locale": "es-ES",
      "slug": "shared-worker-info",
      "href": "/docs/api/structures/shared-worker-info",
      "crowdinFileId": "256505",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/shared-worker-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharedworkerinfo-object\"><a href=\"#sharedworkerinfo-object\">SharedWorkerInfo Object</a></h1>\n<ul>\n<li><code>id</code> String - The unique id of the shared worker.</li>\n<li><code>url</code> String - The url of the shared worker.</li>\n</ul>",
      "title": "SharedWorkerInfo Object",
      "description": ""
    },
    "/docs/api/structures/sharing-item": {
      "locale": "es-ES",
      "slug": "sharing-item",
      "href": "/docs/api/structures/sharing-item",
      "crowdinFileId": "256507",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/sharing-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharingitem-object\"><a href=\"#sharingitem-object\">SharingItem Object</a></h1>\n<ul>\n<li><code>texts</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of text to share.</li>\n<li><code>filePaths</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of files to share.</li>\n<li><code>urls</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of URLs to share.</li>\n</ul>",
      "title": "SharingItem Object",
      "description": ""
    },
    "/docs/api/shell": {
      "locale": "es-ES",
      "slug": "shell",
      "href": "/docs/api/shell",
      "crowdinFileId": "256369",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/shell.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"shell\"><a href=\"#shell\">shell</a></h1>\n<blockquote>\n<p>Administra los archivos y los URLs utilizando las aplicaciones por defecto.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a> (non-sandboxed only)</p>\n<p>El módulo <code>shell</code> proporciona las funciones relacionadas con la integración de escritorio.</p>\n<p>Ejemplo de cómo abrir un URL en el navegador por defecto del usuario:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nshell.openExternal(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<p><strong>Note:</strong> While the <code>shell</code> module can be used in the renderer process, it will not function in a sandboxed renderer.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>El módulo <code>shell</code> tiene los siguientes métodos:</p>\n<h3 id=\"shellshowiteminfolderfullpath\"><a href=\"#shellshowiteminfolderfullpath\"><code>shell.showItemInFolder(fullPath)</code></a></h3>\n<ul>\n<li><code>fullPath</code> Cadena</li>\n</ul>\n<p>Muestra el archivo dado en un gestor de archivos. Si es posible, seleccione el archivo.</p>\n<h3 id=\"shellopenpathpath\"><a href=\"#shellopenpathpath\"><code>shell.openPath(path)</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - Resolves with a string containing the error message corresponding to the failure if a failure occurred, otherwise \"\".</p>\n<p>Abre el archivo determinado en el escritorio por defecto.</p>\n<h3 id=\"shellopenexternalurl-options\"><a href=\"#shellopenexternalurl-options\"><code>shell.openExternal(url[, options])</code></a></h3>\n<ul>\n<li><code>url</code> String - Máximo 2081 caracteres en windows.</li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>activate</code> Boolean (opcional) <em>macOs</em> - <code>true</code> para llevar la aplicación abierta al primer plano. El valor por defecto es <code>true</code>.</li>\n<li><code>workingDirectory</code> String (opcional) <em>Windows</em> - El directorio de trabajo.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code></p>\n<p>Abre el protocolo URL externo dado de manera predeterminada en el escritorio. (Por ejemplo, mailto: URLs en el agente de correo predeterminado del usuario).</p>\n<h3 id=\"shelltrashitempath\"><a href=\"#shelltrashitempath\"><code>shell.trashItem(path)</code></a></h3>\n<ul>\n<li><code>path</code> String - path to the item to be moved to the trash.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the operation has been completed. Rejects if there was an error while deleting the requested item.</p>\n<p>This moves a path to the OS-specific trash location (Trash on macOS, Recycle Bin on Windows, and a desktop-environment-specific location on Linux).</p>\n<h3 id=\"shellbeep\"><a href=\"#shellbeep\"><code>shell.beep()</code></a></h3>\n<p>Reproduce el sonido bip.</p>\n<h3 id=\"shellwriteshortcutlinkshortcutpath-operation-options-windows\"><a href=\"#shellwriteshortcutlinkshortcutpath-operation-options-windows\"><code>shell.writeShortcutLink(shortcutPath[, operation], options)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>shortcutPath</code> String</li>\n<li><code>operation</code> String (opcional) - El valor por defecto es <code>create</code>; puede ser uno de los siguientes:<ul>\n<li><code>create</code> - Crea un nuevo acceso directo, sobrescribiendo si es necesario.</li>\n<li><code>update</code> - Actualiza las propiedades especificadas solo en un acceso directo existente.</li>\n<li><code>replace</code> - Sobrescribe un acceso directo existente. Y falla si el acceso directo no existe.</li>\n</ul></li>\n<li><code>options</code> <a href=\"/docs/api/structures/shortcut-details\">ShortcutDetails</a></li>\n</ul>\n<p>Devuelve <code>Boolean</code> - Si el acceso directo fue creado con éxito.</p>\n<p>Crea o actualiza un enlace de acceso directo a <code>shortcutPath</code>.</p>\n<h3 id=\"shellreadshortcutlinkshortcutpath-windows\"><a href=\"#shellreadshortcutlinkshortcutpath-windows\"><code>shell.readShortcutLink(shortcutPath)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>shortcutPath</code> String</li>\n</ul>\n<p>Devuelve <a href=\"/docs/api/structures/shortcut-details\"><code>ShortcutDetails</code></a></p>\n<p>Resuelve el enlace de acceso directo a <code>shortcutPath</code>.</p>\n<p>Aparecerá una excepción cuando ocurre cualquier error.</p>",
      "title": "shell",
      "description": "Administra los archivos y los URLs utilizando las aplicaciones por defecto."
    },
    "/docs/api/structures/shortcut-details": {
      "locale": "es-ES",
      "slug": "shortcut-details",
      "href": "/docs/api/structures/shortcut-details",
      "crowdinFileId": "256509",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/shortcut-details.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"shortcutdetails-object\"><a href=\"#shortcutdetails-object\">ShortcutDetails Object</a></h1>\n<ul>\n<li><code>target</code> String - The target to launch from this shortcut.</li>\n<li><code>cwd</code> String (optional) - The working directory. Default is empty.</li>\n<li><code>args</code> String (optional) - The arguments to be applied to <code>target</code> when launching from this shortcut. Default is empty.</li>\n<li><code>description</code> String (optional) - The description of the shortcut. Default is empty.</li>\n<li><code>icon</code> String (optional) - The path to the icon, can be a DLL or EXE. <code>icon</code> and <code>iconIndex</code> have to be set together. Default is empty, which uses the target's icon.</li>\n<li><code>iconIndex</code> Number (optional) - The resource ID of icon when <code>icon</code> is a DLL or EXE. Default is 0.</li>\n<li><code>appUserModelId</code> String (optional) - The Application User Model ID. Default is empty.</li>\n<li><code>toastActivatorClsid</code> String (optional) - The Application Toast Activator CLSID. Needed for participating in Action Center.</li>\n</ul>",
      "title": "ShortcutDetails Object",
      "description": ""
    },
    "/docs/api/structures/size": {
      "locale": "es-ES",
      "slug": "size",
      "href": "/docs/api/structures/size",
      "crowdinFileId": "256511",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/size.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"size-object\"><a href=\"#size-object\">Size Object</a></h1>\n<ul>\n<li><code>width</code> Number</li>\n<li><code>height</code> Number</li>\n</ul>",
      "title": "Size Object",
      "description": ""
    },
    "/docs/tutorial/snapcraft": {
      "locale": "es-ES",
      "slug": "snapcraft",
      "href": "/docs/tutorial/snapcraft",
      "crowdinFileId": "256249",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/snapcraft.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"snapcraft-guide-linux\"><a href=\"#snapcraft-guide-linux\">Snapcraft Guide (Linux)</a></h1>\n<p>Esta guía provee información sobre cómo empacar you aplicación en Electron para cualquier ambiente en Snapcraft, incluyendo el Centro de Software de Ubuntu.</p>\n<h2 id=\"antecedentes-y-requerimientos\"><a href=\"#antecedentes-y-requerimientos\">Antecedentes y Requerimientos</a></h2>\n<p>Juntos con las amplia comunidad de Linux, Canonical busca arreglar algunos de los problemas comúnes de instalación de software con <a href=\"https://snapcraft.io/\"><code>snapcraft</code></a>. Snaps son paquetes contenerizados de software que incluyen dependencias requeridas, auto-actualizaciones, y funcionan en las mayores distribuciones de Linux sin modificaciones del sistema.</p>\n<p>Hay tres maneras de crear un archivo <code>.snap</code>:</p>\n<p>1) Usando <a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a> o  <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a>, ambas herramientas que vienen con soporte para <code>snap</code> incluido. Esta es la opción más fácil. 2) Usando <code>electron-installer-snap</code>, que toma el resultado de <code>electron-packager</code>. 3) Usando un paquete <code>.deb</code> ya creado.</p>\n<p>En algunos casos, deberás tener instalada la herramienta <code>Snapcraft</code>. Instructions to install <code>snapcraft</code> for your particular distribution are available <a href=\"https://snapcraft.io/docs/installing-snapcraft\">here</a>.</p>\n<h2 id=\"usando-electron-installer-snap\"><a href=\"#usando-electron-installer-snap\">Usando <code>electron-installer-snap</code></a></h2>\n<p>El módulo trabaja como <a href=\"https://github.com/electron/windows-installer\"><code>electron-winstaller</code></a> y módulos similares en este ámbito está limitado para construir paquetes snap. Puede instalarlo con:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron-installer-snap\n</code></pre>\n<h3 id=\"paso-1-empaqueta-tu-aplicación-electron\"><a href=\"#paso-1-empaqueta-tu-aplicación-electron\">Paso 1: Empaqueta tu aplicación Electron</a></h3>\n<p>Empaquetar la aplicación usando <a href=\"https://github.com/electron/electron-packager\">electron-packager</a> (o una herramienta similar). Asegúrese de eliminar los <code>node_modules</code> que no necesita en su aplicación final, ya que cualquier módulo que actualmente no necesite aumentará el tamaño de su aplicación.</p>\n<p>La salida debería verse más o menos de esta forma:</p>\n<pre><code class=\"hljs language-plaintext\">.\n└── dist\n    └── app-linux-x64\n        ├── LICENSE\n        ├── LICENSES.chromium.html\n        ├── content_shell.pak\n        ├── app\n        ├── icudtl.dat\n        ├── libgcrypt.so.11\n        ├── libnode.so\n        ├── locales\n        ├── resources\n        ├── v8_context_snapshot.bin\n        └── version\n</code></pre>\n<h3 id=\"paso-2-ejecutando-electron-installer-snap\"><a href=\"#paso-2-ejecutando-electron-installer-snap\">Paso 2: Ejecutando <code>electron-installer-snap</code></a></h3>\n<p>Desde una terminal que tenga <code>snapcraft</code> en su <code>PATH</code>, ejecute <code>electron-installer-snap</code> solo con el parámetro requerido <code>--src</code>, el cual es la ubicación de su aplicación empaquetada Electron que se creo en el primer paso.</p>\n<pre><code class=\"hljs language-sh\">npx electron-installer-snap --src=out/myappname-linux-x64\n</code></pre>\n<p>Si tiene un pipeline de construcción existente, puede usar <code>electron-installer-snap</code> programáticamente. Para más información, ver el <a href=\"https://docs.snapcraft.io/build-snaps/syntax\">Snapcraft API docs</a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> snap = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-installer-snap'</span>)\n\nsnap(options)\n  .then(<span class=\"hljs-function\"><span class=\"hljs-params\">snapPath</span> =></span> <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Created snap at <span class=\"hljs-subst\">${snapPath}</span>!`</span>))\n</code></pre>\n<h2 id=\"usar-snapcraft-con-electron-packager\"><a href=\"#usar-snapcraft-con-electron-packager\">Usar <code>snapcraft</code> con <code>electron-packager</code></a></h2>\n<h3 id=\"paso-1-crear-proyecto-de-snapcraft-de-ejemplo\"><a href=\"#paso-1-crear-proyecto-de-snapcraft-de-ejemplo\">Paso 1: Crear proyecto de Snapcraft de Ejemplo</a></h3>\n<p>Crea el directorio de tu proyecto y agrega lo siguiente al <code>snap/snapcraft.yaml</code>:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">electron-packager-hello-world</span>\n<span class=\"hljs-attr\">version:</span> <span class=\"hljs-string\">'0.1'</span>\n<span class=\"hljs-attr\">summary:</span> <span class=\"hljs-string\">Hello</span> <span class=\"hljs-string\">World</span> <span class=\"hljs-string\">Electron</span> <span class=\"hljs-string\">app</span>\n<span class=\"hljs-attr\">description:</span> <span class=\"hljs-string\">|\n  Simple Hello World Electron app as an example\n</span><span class=\"hljs-attr\">base:</span> <span class=\"hljs-string\">core18</span>\n<span class=\"hljs-attr\">confinement:</span> <span class=\"hljs-string\">strict</span>\n<span class=\"hljs-attr\">grade:</span> <span class=\"hljs-string\">stable</span>\n\n<span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">electron-packager-hello-world:</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">electron-quick-start/electron-quick-start</span> <span class=\"hljs-string\">--no-sandbox</span>\n    <span class=\"hljs-attr\">extensions:</span> <span class=\"hljs-string\">[gnome-3-34]</span>\n    <span class=\"hljs-attr\">plugs:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">browser-support</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">network</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">network-bind</span>\n    <span class=\"hljs-attr\">environment:</span>\n      <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n      <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n      <span class=\"hljs-attr\">TMPDIR:</span> <span class=\"hljs-string\">$XDG_RUNTIME_DIR</span>\n\n<span class=\"hljs-attr\">parts:</span>\n  <span class=\"hljs-attr\">electron-quick-start:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">nil</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">https://github.com/electron/electron-quick-start.git</span>\n    <span class=\"hljs-attr\">override-build:</span> <span class=\"hljs-string\">|\n        npm install electron electron-packager\n        npx electron-packager . --overwrite --platform=linux --output=release-build --prune=true\n        cp -rv ./electron-quick-start-linux-* $SNAPCRAFT_PART_INSTALL/electron-quick-start\n</span>    <span class=\"hljs-attr\">build-snaps:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">node/14/stable</span>\n    <span class=\"hljs-attr\">build-packages:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">unzip</span>\n    <span class=\"hljs-attr\">stage-packages:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnss3</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnspr4</span>\n</code></pre>\n<p>Si quiere aplicar este ejemplo a un proyecto existente:</p>\n<ul>\n<li>Reemplace <code>source: https://github.com/electron/electron-quick-start.git</code> con <code>source: .</code>.</li>\n<li>Reemplace todas las instancias de <code>electron-quick-start</code> con el nombre de su proyecto.</li>\n</ul>\n<h3 id=\"paso-2-construye-el-snap\"><a href=\"#paso-2-construye-el-snap\">Paso 2: Construye el snap</a></h3>\n<pre><code class=\"hljs language-sh\">$ snapcraft\n\n&#x3C;output snipped>\nSnapped electron-packager-hello-world_0.1_amd64.snap\n</code></pre>\n<h3 id=\"paso-3-instalar-el-snap\"><a href=\"#paso-3-instalar-el-snap\">Paso 3: Instalar el snap</a></h3>\n<pre><code class=\"hljs language-sh\">sudo snap install electron-packager-hello-world_0.1_amd64.snap --dangerous\n</code></pre>\n<h3 id=\"paso-4-ejecutar-el-snap\"><a href=\"#paso-4-ejecutar-el-snap\">Paso 4: Ejecutar el snap</a></h3>\n<pre><code class=\"hljs language-sh\">electron-packager-hello-world\n</code></pre>\n<h2 id=\"usando-un-paquete-de-debian-existente\"><a href=\"#usando-un-paquete-de-debian-existente\">Usando un paquete de Debian existente</a></h2>\n<p>Snapcraft es capaz de tomar un archivo <code>.deb</code> existente y convertirlo en un archivo <code>.snap</code>. La creación de un a snap es configurado usando un archivo <code>snapcraft.yaml</code> que describe las fuentes, dependencias, descripción y otros bloques de construcción.</p>\n<h3 id=\"paso-1-crear-un-paquete-debian\"><a href=\"#paso-1-crear-un-paquete-debian\">Paso 1: Crear un paquete Debian</a></h3>\n<p>Si aún no tienes listo un paquete <code>.deb</code>, usando <code>electron-installer-snap</code> podría ser una forma más fácil para crear el paquete instantáneo. However, multiple solutions for creating Debian packages exist, including <a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a>, <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> or <a href=\"https://github.com/unindented/electron-installer-debian\"><code>electron-installer-debian</code></a>.</p>\n<h3 id=\"paso-2-creando-un-snapcraftyaml\"><a href=\"#paso-2-creando-un-snapcraftyaml\">Paso 2: Creando un snapcraft.yaml</a></h3>\n<p>For more information on the available configuration options, see the <a href=\"https://docs.snapcraft.io/build-snaps/syntax\">documentation on the snapcraft syntax</a>. Veamos un ejemplo:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">myApp</span>\n<span class=\"hljs-attr\">version:</span> <span class=\"hljs-string\">'2.0.0'</span>\n<span class=\"hljs-attr\">summary:</span> <span class=\"hljs-string\">A</span> <span class=\"hljs-string\">little</span> <span class=\"hljs-string\">description</span> <span class=\"hljs-string\">for</span> <span class=\"hljs-string\">the</span> <span class=\"hljs-string\">app.</span>\n<span class=\"hljs-attr\">description:</span> <span class=\"hljs-string\">|\n You know what? This app is amazing! It does all the things\n for you. Some say it keeps you young, maybe even happy.\n</span>\n<span class=\"hljs-attr\">grade:</span> <span class=\"hljs-string\">stable</span>\n<span class=\"hljs-attr\">confinement:</span> <span class=\"hljs-string\">classic</span>\n\n<span class=\"hljs-attr\">parts:</span>\n  <span class=\"hljs-attr\">slack:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">dump</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">my-deb.deb</span>\n    <span class=\"hljs-attr\">source-type:</span> <span class=\"hljs-string\">deb</span>\n    <span class=\"hljs-attr\">after:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">desktop-gtk3</span>\n    <span class=\"hljs-attr\">stage-packages:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libasound2</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnotify4</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnspr4</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnss3</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libpcre3</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libpulse0</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libxss1</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libxtst6</span>\n  <span class=\"hljs-attr\">electron-launch:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">dump</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">files/</span>\n    <span class=\"hljs-attr\">prepare:</span> <span class=\"hljs-string\">|\n      chmod +x bin/electron-launch\n</span>\n<span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">myApp:</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">bin/electron-launch</span> <span class=\"hljs-string\">$SNAP/usr/lib/myApp/myApp</span>\n    <span class=\"hljs-attr\">desktop:</span> <span class=\"hljs-string\">usr/share/applications/myApp.desktop</span>\n    <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n    <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n    <span class=\"hljs-attr\">environment:</span>\n      <span class=\"hljs-attr\">TMPDIR:</span> <span class=\"hljs-string\">$XDG_RUNTIME_DIR</span>\n</code></pre>\n<p>As you can see, the <code>snapcraft.yaml</code> instructs the system to launch a file called <code>electron-launch</code>. In this example, it passes information on to the app's binary:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-meta\">#!/bin/sh\n</span>\n<span class=\"hljs-built_in\">exec</span> <span class=\"hljs-string\">\"<span class=\"hljs-variable\">$@</span>\"</span> --executed-from=<span class=\"hljs-string\">\"<span class=\"hljs-variable\">$(pwd)</span>\"</span> --pid=$$ > /dev/null 2>&#x26;1 &#x26;\n</code></pre>\n<p>Alternativamente, si esta construyendo su <code>snap</code> con aislamiento <code>strict</code>, puede usar el comando <code>desktop-launch</code>:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">myApp:</span>\n    <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n    <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">env</span> <span class=\"hljs-string\">TMPDIR=$XDG_RUNTIME_DIR</span> <span class=\"hljs-string\">PATH=/usr/local/bin:${PATH}</span> <span class=\"hljs-string\">${SNAP}/bin/desktop-launch</span> <span class=\"hljs-string\">$SNAP/myApp/desktop</span>\n    <span class=\"hljs-attr\">desktop:</span> <span class=\"hljs-string\">usr/share/applications/desktop.desktop</span>\n</code></pre>",
      "title": "Snapcraft Guide (Linux)",
      "description": ""
    },
    "/docs/development/source-code-directory-structure": {
      "locale": "es-ES",
      "slug": "source-code-directory-structure",
      "href": "/docs/development/source-code-directory-structure",
      "crowdinFileId": "256167",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/source-code-directory-structure.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"estructura-del-directorio-de-código-fuente\"><a href=\"#estructura-del-directorio-de-código-fuente\">Estructura del directorio de código fuente</a></h1>\n<p>El código fuente de Electron está separado en unas pocas partes, la mayoría siguiendo a Chromium en las convenciones de separación.</p>\n<p>Necesitará familiarizarse con la <a href=\"https://dev.chromium.org/developers/design-documents/multi-process-architecture\">arquitectura multiprocesos de Chromium</a> para entender mejor el código fuente.</p>\n<h2 id=\"estructura-del-código-fuente\"><a href=\"#estructura-del-código-fuente\">Estructura del código fuente</a></h2>\n<pre><code class=\"hljs language-diff\">Electron\n├── build/ - Archivos de configuración necesarios para compilar con GN.\n├── buildflags/ - Determina el conjunto de características que pueden ser compiladas condicionalmente.\n├── chromium_src/ - Código fuente copiado desde Chromium que no es parte de la capa de contenido.\n├── default_app/ - Una aplicación predeterminada se ejecuta cuando se inicia Electron sin proveer \n| una aplicación de consumo.\n├── docs/ - Documentación de Electron.\n|   ├── api/ - Documentación para modulos y APIs externas.\n|   ├── development/ - Documentación para ayudar en el desarrollo para y con Electron.\n|   ├── fiddles/ - Un conjunto de fragmento de codigo que pueden ejecutarse en Electron Fiddle.\n|   ├── images/ - Imágenes usadas en la documentación.\n|   └── tutorial/ - Documentos tutoriales para diversos aspectos de Electron.\n├── lib/ - Código fuente JavaScript/TypeScript.\n|   ├── browser/ - Código de inicialización del proceso principal.\n|   |   ├── api/ - API de implementación para los módulos del proceso principal.\n|   |   └── remote/ - Código relacionado con el modulo remote como es usado en el proceso principal.\n|   ├── common/ - Relacionado con la logica necesario por ambos procesos el main y el renderer.\n|   |   └── api/ - Implementación de API para módulos que pueden  \n|   |             ser usadas en ambos procesos main y renderer\n|   ├── isolated_renderer/ - Maneja la creación de procesos renderer isolados cuando\n|   |                        contextIsolation esta habilitado.\n|   ├── renderer/ - Código de inicialización del proceso renderer.\n|   |   ├── api/ - Implementación de la API para los módulos del proceso renderer.\n|   |   ├── extension/ - Código relacionado con el uso de las Extenciones de Chrome\n|   |   |                en el proceso renderer de Electron.\n|   |   ├── remote/ - Logic that handles use of the remote module in\n|   |   |             the main process.\n|   |   └── web-view/ - Lógica que maneja el uso de los webviews en el \n|   |                   proceso renderer.\n|   ├── sandboxed_renderer/ - Lógica que maneja la creación de procesos \n|   |   |                     renderer sandboxed.\n|   |   └── api/ - Implementación para procesos renderer sandboxed.\n|   └── worker/ - Lógica que maneja la correcta funcionalidad de Node.js\n|                 en los entornos Web Workers.\n├── patches/ - Parches aplicados encima de las dependencias core \n|   |          de Electron para manejar las diferencias ente nuestro casos de uso \n|   |          y la configuración por defecto.\n|   ├── boringssl/ - Parches aplicados a los forks de Google OpenSSL, BoringSSL.\n|   ├── chromium/ - Parches aplicados a Chromium.\n|   ├── node/ - Parches aplicados encima de Node.js.\n|   └── v8/ - Parches aplicados encima del motor V8 de Google.\n├── shell/ - Código fuente C++.\n|   ├── app/ - System entry code.\n|   ├── browser/ - The frontend including the main window, UI, and all of the\n|   |   |          main process things. This talks to the renderer to manage web\n|   |   |          pages.\n|   |   ├── ui/ - Implementation of UI stuff for different platforms.\n|   |   |   ├── cocoa/ - Cocoa specific source code.\n|   |   |   ├── win/ - Windows GUI specific source code.\n|   |   |   └── x/ - X11 specific source code.\n|   |   ├── api/ - The implementation of the main process APIs.\n|   |   ├── net/ - Network related code.\n|   |   ├── mac/ - Mac specific Objective-C source code.\n|   |   └── resources/ - Icons, platform-dependent files, etc.\n|   ├── renderer/ - Code that runs in renderer process.\n|   |   └── api/ - The implementation of renderer process APIs.\n|   └── common/ - Código que se usa por ambos procesos, main y el renderer, incluye algunos funciones útiles\n|       |         y código para integrar el bucle de mensaje de node dentro de bucle de mensaje de Chromium.\n|       └── api/ - La implementación de las APIs comunes y las bases de los módulos integrados de Electron.\n├── spec/ - Componentes de la suite de pruebas de Electron se ejecutan en el proceso de renderizado.\n├── spec-main/ - Componentes de la suite de pruebas de Electron se ejecutan en el proceso main.\n└── BUILD.gn - Building rules of Electron.\n</code></pre>\n<h2 id=\"estructura-de-otros-directorios\"><a href=\"#estructura-de-otros-directorios\">Estructura de otros directorios</a></h2>\n<ul>\n<li><strong>.circleci</strong> - Archivo de configuración para CI con CircleCI.</li>\n<li><strong>.github</strong> - Archivos de configuración específicos de GitHub, incluyendo plantillas de problemas y CODEOWNERS.</li>\n<li><strong>dist</strong> - Directorio temporal creado por el comando <code>script/create-dist.py</code> cuando se crea una distribución.</li>\n<li><strong>Nodos de módulo</strong> - Nodos de módulo de terceros usados para compilar.</li>\n<li><strong>npm</strong> - Lógica para la instalación de Electron via npm.</li>\n<li><strong>afuera</strong> - temporalmente afuera del directorio de <code>ninja</code>.</li>\n<li><strong>Código</strong> - Los códigos usados con propósitos de desarrollo como compilar, empacar, probar, etc.</li>\n</ul>\n<pre><code class=\"hljs language-diff\">script/ - El conjunto de todo los scripts que Electron ejecuta para una variedad de propósitos.\n├── codesign/ - Falsifica la firma de código para aplicaciones Electron; usado para pruebas.\n├── lib/ - Varios scripts de utilidad de python.\n└── release/ - Scripts que se ejecutan durante el proceso de lanzamiento de Electron.\n    ├── notes/ - Genera notas de lanzamiento para las nuevas versiones de Electron.\n    └── uploaders/ - Sube varios archivos relacionados con la nueva versión durante el lanzamiento.\n</code></pre>\n<ul>\n<li><strong>typings</strong> - Tipos de TypeScript para el código interno de Electron.</li>\n</ul>",
      "title": "Estructura del directorio de código fuente",
      "description": ""
    },
    "/docs/tutorial/spellchecker": {
      "locale": "es-ES",
      "slug": "spellchecker",
      "href": "/docs/tutorial/spellchecker",
      "crowdinFileId": "256251",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/spellchecker.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"spellchecker\"><a href=\"#spellchecker\">SpellChecker</a></h1>\n<p>Electron has built-in support for Chromium's spellchecker since Electron 8.  On Windows and Linux this is powered by Hunspell dictionaries, and on macOS it makes use of the native spellchecker APIs.</p>\n<h2 id=\"how-to-enable-the-spellchecker\"><a href=\"#how-to-enable-the-spellchecker\">How to enable the spellchecker?</a></h2>\n<p>For Electron 9 and higher the spellchecker is enabled by default.  For Electron 8 you need to enable it in <code>webPreferences</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> myWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">spellcheck</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h2 id=\"how-to-set-the-languages-the-spellchecker-uses\"><a href=\"#how-to-set-the-languages-the-spellchecker-uses\">How to set the languages the spellchecker uses?</a></h2>\n<p>On macOS as we use the native APIs there is no way to set the language that the spellchecker uses. By default on macOS the native spellchecker will automatically detect the language being used for you.</p>\n<p>For Windows and Linux there are a few Electron APIs you should use to set the languages for the spellchecker.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Sets the spellchecker to check English US and French</span>\nmyWindow.session.setSpellCheckerLanguages([<span class=\"hljs-string\">'en-US'</span>, <span class=\"hljs-string\">'fr'</span>])\n\n<span class=\"hljs-comment\">// An array of all available language codes</span>\n<span class=\"hljs-keyword\">const</span> possibleLanguages = myWindow.session.availableSpellCheckerLanguages\n</code></pre>\n<p>By default the spellchecker will enable the language matching the current OS locale.</p>\n<h2 id=\"how-do-i-put-the-results-of-the-spellchecker-in-my-context-menu\"><a href=\"#how-do-i-put-the-results-of-the-spellchecker-in-my-context-menu\">How do I put the results of the spellchecker in my context menu?</a></h2>\n<p>All the required information to generate a context menu is provided in the <a href=\"/docs/api/web-contents#event-context-menu\"><code>context-menu</code></a> event on each <code>webContents</code> instance.  A small example of how to make a context menu with this information is provided below.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { Menu, MenuItem } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nmyWindow.webContents.on(<span class=\"hljs-string\">'context-menu'</span>, (event, params) => {\n  <span class=\"hljs-keyword\">const</span> menu = <span class=\"hljs-keyword\">new</span> Menu()\n\n  <span class=\"hljs-comment\">// Add each spelling suggestion</span>\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> suggestion <span class=\"hljs-keyword\">of</span> params.dictionarySuggestions) {\n    menu.append(<span class=\"hljs-keyword\">new</span> MenuItem({\n      <span class=\"hljs-attr\">label</span>: suggestion,\n      <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> mainWindow.webContents.replaceMisspelling(suggestion)\n    }))\n  }\n\n  <span class=\"hljs-comment\">// Allow users to add the misspelled word to the dictionary</span>\n  <span class=\"hljs-keyword\">if</span> (params.misspelledWord) {\n    menu.append(\n      <span class=\"hljs-keyword\">new</span> MenuItem({\n        <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Add to dictionary'</span>,\n        <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> mainWindow.webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord)\n      })\n    )\n  }\n\n  menu.popup()\n})\n</code></pre>\n<h2 id=\"does-the-spellchecker-use-any-google-services\"><a href=\"#does-the-spellchecker-use-any-google-services\">Does the spellchecker use any Google services?</a></h2>\n<p>Although the spellchecker itself does not send any typings, words or user input to Google services the hunspell dictionary files are downloaded from a Google CDN by default.  If you want to avoid this you can provide an alternative URL to download the dictionaries from.</p>\n<pre><code class=\"hljs language-js\">myWindow.session.setSpellCheckerDictionaryDownloadURL(<span class=\"hljs-string\">'https://example.com/dictionaries/'</span>)\n</code></pre>\n<p>Revisa la documentación para <a href=\"/docs/api/session#sessetspellcheckerdictionarydownloadurlurl\"><code>session.setSpellCheckerDictionaryDownloadURL</code></a> para más información sobre dónde obtener los archivos de diccionario y como necesitas alojarlos.</p>",
      "title": "SpellChecker",
      "description": ""
    },
    "/docs/styleguide": {
      "locale": "es-ES",
      "slug": "styleguide",
      "href": "/docs/styleguide",
      "crowdinFileId": "256125",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/styleguide.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"guía-de-estilo-de-documentación-electron\"><a href=\"#guía-de-estilo-de-documentación-electron\">Guía de estilo de documentación Electron</a></h1>\n<p>Estas son las directrices para escribir documentación de Electron.</p>\n<h2 id=\"encabezados\"><a href=\"#encabezados\">Encabezados</a></h2>\n<ul>\n<li>Cada página debe tener un solo título de nivel <code>#</code> al principio.</li>\n<li>Los capítulos en la misma pagina deben tener títulos de nivel <code>##</code>.</li>\n<li>Los sub-capítulos necesitan incrementar el numero de <code>#</code> en el encabezado de acuerdo al su profundidad de anidamiento.</li>\n<li>El titulo de la pagina debe seguir el <a href=\"https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case\">Estilo APA</a>.</li>\n<li>Todos los capítulos deben seguir el <a href=\"https://apastyle.apa.org/style-grammar-guidelines/capitalization/sentence-case\">Estilo APA </a>.</li>\n</ul>\n<p>Usando <code>Quick Start</code> como ejemplo:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># Inicio rápido</span>\n\n...\n\n<span class=\"hljs-section\">## Proceso principal</span>\n\n...\n\n<span class=\"hljs-section\">## Proceso Renderer</span>\n\n...\n\n<span class=\"hljs-section\">## Ejecuta tu aplicación</span>\n\n...\n\n<span class=\"hljs-section\">### Ejecuta como una distribución</span>\n\n...\n\n<span class=\"hljs-section\">### Binario Electron descargado manualmente</span>\n\n...\n</code></pre>\n<p>Para referencias API, hay excepciones para esta regla.</p>\n<h2 id=\"reglas-de-markdown\"><a href=\"#reglas-de-markdown\">Reglas de Markdown</a></h2>\n<p>This repository uses the <a href=\"https://github.com/DavidAnson/markdownlint\"><code>markdownlint</code></a> package to enforce consistent Markdown styling. For the exact rules, see the <code>.markdownlint.json</code> file in the root folder.</p>\n<p>There are a few style guidelines that aren't covered by the linter rules:</p>\n<!--TODO(erickzhao): make sure this matches with the lint:markdownlint task-->\n<ul>\n<li>Usa <code>sh</code> en vez de <code>cmd</code> en code blocks (debido al resaltador de sintaxis).</li>\n<li>Keep line lengths between 80 and 100 characters if possible for readability purposes.</li>\n<li>No anidar listas de más de 2 niveles (debido al renderizador markdown).</li>\n<li>Todos los bloques de código <code>js</code> y <code>javascript</code> están analizados con <a href=\"https://www.npmjs.com/package/standard-markdown\">standard-markdown</a>.</li>\n<li>Para listas no ordenadas, use asteriscos en lugar de guiones.</li>\n</ul>\n<h2 id=\"escoger-palabras\"><a href=\"#escoger-palabras\">Escoger palabras</a></h2>\n<ul>\n<li>Utilice \"podrá\" en vez de \"podría\" al describir resultados.</li>\n<li>Prefiere \"en el ___ proceso\" sobre \"en\".</li>\n</ul>\n<h2 id=\"referencias-api\"><a href=\"#referencias-api\">Referencias API</a></h2>\n<p>Las siguientes reglas sólo se aplican a la documentación de APIs.</p>\n<h3 id=\"titulo-y-descripción\"><a href=\"#titulo-y-descripción\">Titulo y descripción</a></h3>\n<p>Each module's API doc must use the actual object name returned by <code>require('electron')</code> as its title (such as <code>BrowserWindow</code>, <code>autoUpdater</code>, and <code>session</code>).</p>\n<p>Directly under the page title, add a one-line description of the module as a markdown quote (beginning with <code>></code>).</p>\n<p>Using the <code>session</code> module as an example:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># session</span>\n\n<span class=\"hljs-quote\">> Administra sesiones de navegador, cookies, caché, configuración del proxy, etc.</span>\n</code></pre>\n<h3 id=\"métodos-del-módulo-y-eventos\"><a href=\"#métodos-del-módulo-y-eventos\">Métodos del módulo y eventos</a></h3>\n<p>Para módulos que no son clases, sus métodos y los eventos deben esar listados bajo los capítulos <code>## Métodos</code> y <code>## Eventos</code>.</p>\n<p>Usando <code>autoUpdater</code> como ejemplo:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># autoUpdater</span>\n\n<span class=\"hljs-section\">## Eventos</span>\n\n<span class=\"hljs-section\">### Evento: 'error'</span>\n\n<span class=\"hljs-section\">## Métodos</span>\n\n<span class=\"hljs-section\">### `autoUpdater.setFeedURL(url[, requestHeaders])`</span>\n</code></pre>\n<h3 id=\"clases\"><a href=\"#clases\">Clases</a></h3>\n<ul>\n<li>Las clases API o las clases que forman parte de los módulos también deben ser listadas bajo el capítulo <code>## clase: TheClassName</code>.</li>\n<li>Una página puede tener múltiples clases.</li>\n<li>Constructors must be listed with <code>###</code>-level headings.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static\">Static Methods</a> must be listed under a <code>### Static Methods</code> chapter.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Prototype_methods\">Instance Methods</a> must be listed under an <code>### Instance Methods</code> chapter.</li>\n<li>All methods that have a return value must start their description with \"Returns <code>[TYPE]</code> - [Return description]\"<ul>\n<li>If the method returns an <code>Object</code>, its structure can be specified using a colon followed by a newline then an unordered list of properties in the same style as function parameters.</li>\n</ul></li>\n<li>Los Eventos de Instancia deben aparecer listados bajo un capítulo de <code>### Eventos de Instancia</code>.</li>\n<li>Las Propiedades de Instancia deben ser listadas bajo un capitulo <code>### Instance Properties</code>.<ul>\n<li>Instance Properties must start with \"A [Property Type] ...\"</li>\n</ul></li>\n</ul>\n<p>Usando las clases <code>Session</code> y <code>Cookies</code> como ejemplo:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># session</span>\n\n<span class=\"hljs-section\">## Methods</span>\n\n<span class=\"hljs-section\">### session.fromPartition(partition)</span>\n\n<span class=\"hljs-section\">## Static Properties</span>\n\n<span class=\"hljs-section\">### session.defaultSession</span>\n\n<span class=\"hljs-section\">## Class: Session</span>\n\n<span class=\"hljs-section\">### Instance Events</span>\n\n<span class=\"hljs-section\">#### Event: 'will-download'</span>\n\n<span class=\"hljs-section\">### Instance Methods</span>\n\n<span class=\"hljs-section\">#### `ses.getCacheSize()`</span>\n\n<span class=\"hljs-section\">### Instance Properties</span>\n\n<span class=\"hljs-section\">#### `ses.cookies`</span>\n\n<span class=\"hljs-section\">## Class: Cookies</span>\n\n<span class=\"hljs-section\">### Instance Methods</span>\n\n<span class=\"hljs-section\">#### `cookies.get(filter, callback)`</span>\n</code></pre>\n<h3 id=\"methods-and-their-arguments\"><a href=\"#methods-and-their-arguments\">Methods and their arguments</a></h3>\n<p>El capítulo de métodos debe estar de la siguiente forma:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### `nombreDeObjeto.nombreDeMetodo(required[, opcional]))`</span>\n<span class=\"hljs-bullet\">\n* </span><span class=\"hljs-code\">`required`</span> String - Una descripción del parámetro.\n<span class=\"hljs-bullet\">* </span><span class=\"hljs-code\">`opcional`</span> Integer (opcional) - Otra descripción del parámetro.\n\n...\n</code></pre>\n<h4 id=\"heading-level\"><a href=\"#heading-level\">Heading level</a></h4>\n<p>The heading can be <code>###</code> or <code>####</code>-levels depending on whether the method belongs to a module or a class.</p>\n<h4 id=\"function-signature\"><a href=\"#function-signature\">Function signature</a></h4>\n<p>Para módulos, el <code>objectName</code> es el nombre del módulo. Para las clases debe ser el nombre de la instancia de la clase y no debe ser el mismo nombre del módulo.</p>\n<p>Por ejemplo, los métodos de la clase <code>Session</code> bajo el módulo <code>session</code> deben usar <code>ses</code> como el <code>objectName</code>.</p>\n<p>Optional arguments are notated by square brackets <code>[]</code> surrounding the optional argument as well as the comma required if this optional argument follows another argument:</p>\n<pre><code class=\"hljs language-markdown\">requerido[, opcional]\n</code></pre>\n<h4 id=\"argument-descriptions\"><a href=\"#argument-descriptions\">Argument descriptions</a></h4>\n<p>More detailed information on each of the arguments is noted in an unordered list below the method. The type of argument is notated by either JavaScript primitives (e.g. <code>String</code>, <code>Promise</code>, or <code>Object</code>), a custom API structure like Electron's <a href=\"/docs/api/structures/cookie\"><code>Cookie</code></a>, or the wildcard <code>any</code>.</p>\n<p>If the argument is of type <code>Array</code>, use <code>[]</code> shorthand with the type of value inside the array (for example,<code>any[]</code> or <code>String[]</code>).</p>\n<p>If the argument is of type <code>Promise</code>, parametrize the type with what the promise resolves to (for example, <code>Promise&#x3C;void></code> or <code>Promise&#x3C;String></code>).</p>\n<p>If an argument can be of multiple types, separate the types with <code>|</code>.</p>\n<p>La descripción para los argumentos de tipo <code>Function</code> deben dejar en claro cómo podrían ser llamados y la lista de tipos de parámetros que se le serán pasados.</p>\n<h4 id=\"platform-specific-functionality\"><a href=\"#platform-specific-functionality\">Platform-specific functionality</a></h4>\n<p>Si un argumento o un método es único para ciertas plataformas, esas plataformas son denotadas usando una lista con espacio delimitado y en cursiva siguiendo el tipo de data. Los valores pueden ser <code>macOS</code>, <code>Windows</code>, o <code>Linux</code>.</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-bullet\">* </span><span class=\"hljs-code\">`animate`</span> Booleano (opcional) <span class=\"hljs-emphasis\">_macOS_</span> <span class=\"hljs-emphasis\">_Windows_</span> - Anima la cosa.\n</code></pre>\n<h3 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h3>\n<p>El capítulo de eventos debe estar de la siguiente forma:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### Evento: 'wake-up'</span>\n\nDevuelve:\n<span class=\"hljs-bullet\">\n* </span><span class=\"hljs-code\">`time`</span> String\n\n...\n</code></pre>\n<p>The heading can be <code>###</code> or <code>####</code>-levels depending on whether the event belongs to a module or a class.</p>\n<p>Los argumentos de un evento siguen las mismas reglas que los métodos.</p>\n<h3 id=\"propiedades\"><a href=\"#propiedades\">Propiedades</a></h3>\n<p>El capítulo de propiedades debe estar de la siguiente forma:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### session.defaultSession</span>\n\n...\n</code></pre>\n<p>The heading can be <code>###</code> or <code>####</code>-levels depending on whether the property belongs to a module or a class.</p>\n<h2 id=\"documentation-translations\"><a href=\"#documentation-translations\">Documentation translations</a></h2>\n<p>Ver <a href=\"https://github.com/electron/i18n#readme\">electron/electron-i18n</a></p>",
      "title": "Guía de estilo de documentación Electron",
      "description": ""
    },
    "/docs/tutorial/support": {
      "locale": "es-ES",
      "slug": "support",
      "href": "/docs/tutorial/support",
      "crowdinFileId": "256253",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/support.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"soporte-de-electron\"><a href=\"#soporte-de-electron\">Soporte de Electron</a></h1>\n<h2 id=\"encontrar-soporte\"><a href=\"#encontrar-soporte\">Encontrar Soporte</a></h2>\n<p>Si tiene un problema de seguridad, consulte el <a href=\"https://github.com/electron/electron/tree/main/SECURITY.md\">documento de seguridad</a>.</p>\n<p>Si busca ayuda con la programación, respuestas a preguntas o conversaciones con otros desarrolladores que usan Electron, puede interactuar con la comunidad en estos lugares:</p>\n<ul>\n<li><a href=\"https://discord.com/invite/electron\"><code>Electron's Discord</code></a> tiene canales para:<ul>\n<li>Obtener ayuda</li>\n<li>Aplicaciones del ecosistema como <a href=\"https://github.com/electron-userland/electron-forge\">Electron Forge</a> y <a href=\"https://github.com/electron/fiddle\">Electron Fiddle</a></li>\n<li>Compartir ideas con otros programados de aplicaciones Electron</li>\n<li>Y más!</li>\n</ul></li>\n<li>Categoría <a href=\"https://discuss.atom.io/c/electron\"><code>electron</code></a> en los foros de Atom</li>\n<li><code>#electron</code> canal en <a href=\"https://discuss.atom.io/t/join-us-on-slack/16638?source_topic_id=25406\">Atom's Slack</a></li>\n<li><a href=\"https://telegram.me/electron_ru\"><code>electron-ru</code></a> <em>(Ruso)</em></li>\n<li><a href=\"https://electron-br.slack.com\"><code>electron-br</code></a> <em>(Portugués Brasileño)</em></li>\n<li><a href=\"https://electron-kr.github.io/electron-kr\"><code>electron-kr</code></a> <em>(Coreano)</em></li>\n<li><a href=\"https://electron-jp.slack.com\"><code>electron-jp</code></a> <em>(Japonés)</em></li>\n<li><a href=\"https://electron-tr.herokuapp.com\"><code>electron-tr</code></a> <em>(Turco)</em></li>\n<li><a href=\"https://electron-id.slack.com\"><code>electron-id</code></a> <em>(Indonesio)</em></li>\n<li><a href=\"https://electronpl.github.io\"><code>electron-pl</code></a> <em>(Polaco)</em></li>\n</ul>\n<p>Si desea contribuir a Electron, consulte el <a href=\"https://github.com/electron/electron/blob/main/CONTRIBUTING.md\">documento contribuyente</a>.</p>\n<p>Si has encontrado un error en una <a href=\"#supported-versions\">versión soportada</a> de Electron, infórmalo con el <a href=\"/docs/development/issues\">rastreador de problemas</a>.</p>\n<p><a href=\"https://github.com/sindresorhus/awesome-electron\">awesome-electron</a> es una lista mantenida por la comunidad de útiles ejemplos de aplicaciones, herramientas y recursos.</p>\n<h2 id=\"versiones-soportadas\"><a href=\"#versiones-soportadas\">Versiones Soportadas</a></h2>\n<p><em><strong>Note:</strong> Beginning in September 2021 with Electron 15, the Electron team will temporarily support the latest <strong>four</strong> stable major versions. This extended support is intended to help Electron developers transition to the <a href=\"https://electronjs.org/blog/8-week-cadence\">new eight week release cadence</a>, and will continue until May 2022, with the release of Electron 19. At that time, the Electron team will drop support back to the latest three stable major versions.</em></p>\n<p>Las últimas tres versiones <em>stable</em> son soportadas por el equipo Electron. Por ejemplo, si la última versión es 6.1.x, entonces la 5.0.x así como la series 4.2.x son soportadas.  Solo soportamos la última versión minor por cada versión estable.  Esto quiere decir que en el caso de una corrección de seguridad 6.1.x recibirá la corrección, pero no lanzaremos una nueva versión de 6.0.x.</p>\n<p>La última versión estable recibe unilateralmente todas las correcciones de <code>main</code>, y la versión anterior recibe la gran mayoría de esas correcciones como el tiempo y el ancho de banda lo permite. Las versiones más antiguas soportadas solamente van a recibir correcciones de seguridad directamente.</p>\n<p>Todas las versiones soportadas aceptarán peticiones de pull requests externas a backport correcciones previamente fusionadas en <code>main</code>, aunque esto puede ser caso por caso para algunas versiones mas antiguas. Todas las decisiones impugnadas entorno a la liberación de la versión de backports serán resueltas por el <a href=\"https://github.com/electron/governance/tree/main/wg-releases\">Releases Working Group</a> como un elemento de agenda en su reunión semanal la semana que se levanta el PR backport.</p>\n<p>Cuando una API es cambiada o eliminada de alguna manera eso rompe la funcionalidad existente, la funcionalidad anterior será mantenida por mínimo dos versiones principales cuando sea posible antes de eliminarla. For example, if a function takes three arguments, and that number is reduced to two in major version 10, the three-argument version would continue to work until, at minimum, major version 12. Past the minimum two-version threshold, we will attempt to support backwards compatibility beyond two versions until the maintainers feel the maintenance burden is too high to continue doing so.</p>\n<h3 id=\"versiones-soportadas-actualmente\"><a href=\"#versiones-soportadas-actualmente\">Versiones soportadas actualmente</a></h3>\n<ul>\n<li>15.x.y</li>\n<li>14.x.y</li>\n<li>13.x.y</li>\n<li>12</li>\n</ul>\n<h3 id=\"fin-de-vida\"><a href=\"#fin-de-vida\">Fin de vida</a></h3>\n<p>Cuando una rama de lanzamiento llega al final de su ciclo de soporte, la serie quedará obsoleta en NPM y se realizará una versión final de fin de soporte. Este lanzamiento agregará una advertencia para informar que una versión no soportada de Electron está en uso.</p>\n<p>Estos pasos son para ayudar a los desarrolladores de aplicaciones a saber cuándo una rama que están utilizando no recibe soporte, pero sin ser excesivamente intrusiva para los usuarios finales.</p>\n<p>Si una aplicación tiene circunstancias excepcionales y necesita permanecer en una serie de Electron no admitida, los desarrolladores pueden silenciar la advertencia de fin de soporte al omitir la versión final de <code>package.json</code> <code>devDependencies</code> de la aplicación. Por ejemplo, dado que la serie 1-6-x finalizó con una versión 1.6.18 de fin de soporte, los desarrolladores podrían optar por permanecer en la serie 1-6-x sin advertencias con un <code>devDependency</code> de <code>\"electron\": 1.6.0 - 1.6.17</code>.</p>\n<h2 id=\"plataformas-soportadas\"><a href=\"#plataformas-soportadas\">Plataformas soportadas</a></h2>\n<p>Las siguientes plataformas son apoyadas por Electron:</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>Only 64bit binaries are provided for macOS, and the minimum macOS version supported is macOS 10.11 (El Capitan).</p>\n<p>El soporte nativo para dispositivos Apple Silicon (<code>arm64</code>) fue agregado en Electron 11.0.0.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<p>Windows 7 y posteriores son soportados, sistemas operativos más viejos no lo son (y no funcionan).</p>\n<p>Ambos binarios <code>ia32</code> (<code>x86</code>) y <code>x64</code> (<code>amd64</code>) se proporcionan para Windows. <a href=\"/docs/tutorial/windows-arm\">Soporte nativo para Windows en dispositivos Arm (<code>arm64</code>) fue agregado a Electron 6.0.8.</a>. Running apps packaged with previous versions is possible using the ia32 binary.</p>\n<h3 id=\"linux\"><a href=\"#linux\">Linux</a></h3>\n<p>Los binarios preconstruido de Electron están construidos en Ubuntu 18.04.</p>\n<p>Si el compilado binario puede correr en una distribución depende de que la distribución incluye las librerías a las que está ligada Electron en la plataforma construida, así que solo hay garantía de que Ubuntu 18.04 trabaje, pero las siguientes plataformas también están verificadas para correr el precompilado binario de Electron:</p>\n<ul>\n<li>Ubuntu 14.04 y posteriores</li>\n<li>Fedora 24 y más nuevo</li>\n<li>Debian 8 y más nuevo</li>\n</ul>",
      "title": "Soporte de Electron",
      "description": ""
    },
    "/docs/api/synopsis": {
      "locale": "es-ES",
      "slug": "synopsis",
      "href": "/docs/api/synopsis",
      "crowdinFileId": "256371",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/synopsis.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"sinopsis\"><a href=\"#sinopsis\">Sinopsis</a></h1>\n<blockquote>\n<p>Como utilizar Node.js y los APIs de Electrón.</p>\n</blockquote>\n<p>Todos los <a href=\"https://nodejs.org/api/\">módulos incorporados de Node.js</a> está disponibles en Electrón y los nodos de terceros también son completamente compatibles (incluyendo a los <a href=\"/docs/tutorial/using-native-node-modules\"> módulos nativos</a>).</p>\n<p>Electrón además provee algunos módulos incorporados extra para desarrollar aplicaciones de escritorio nativas. Some modules are only available in the main process, some are only available in the renderer process (web page), and some can be used in either process type.</p>\n<p>La regla básica es: si un módulo es <a href=\"https://en.wikipedia.org/wiki/Graphical_user_interface\"> GUI</a> o relacionado a sistemas de bajo nivel, entonces solo puede estar disponible en el proceso principal. You need to be familiar with the concept of main process vs. renderer process scripts to be able to use those modules.</p>\n<p>El scrip del proceso principal es como un script normal de Node.js:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>El renderer process no es diferente a una página web normal, excepto por la habilidad extra de usar módulos node si <code>nodeIntegration</code> está activada:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  <span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n  <span class=\"hljs-built_in\">console</span>.log(fs.readFileSync(__filename, <span class=\"hljs-string\">'utf8'</span>))\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<h2 id=\"asignación-de-desestructuración\"><a href=\"#asignación-de-desestructuración\">Asignación de desestructuración</a></h2>\n<p>Respecto al 0.37, puedes usar <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment\"> asignación de desestruturación</a> para hacer más fácil el uso de los módulos incorporados.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>Si necesitas el módulo <code>electron</code> completo, puedes requerirlo y luego usar la desestructuración para acceder a los módulos individuales desde <code>electron</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> electron = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = electron\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>Este es equivalente al siguiente código:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> electron = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> app = electron.app\n<span class=\"hljs-keyword\">const</span> BrowserWindow = electron.BrowserWindow\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>",
      "title": "Sinopsis",
      "description": "Como utilizar Node.js y los APIs de Electrón."
    },
    "/docs/api/system-preferences": {
      "locale": "es-ES",
      "slug": "system-preferences",
      "href": "/docs/api/system-preferences",
      "crowdinFileId": "256373",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/system-preferences.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"systempreferences\"><a href=\"#systempreferences\">systemPreferences</a></h1>\n<blockquote>\n<p>Obtener las preferencias del sistema.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(systemPreferences.isDarkMode())\n</code></pre>\n<h2 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h2>\n<p>El objeto de los<code>sistemasdePreferencias</code>emiten los siguietes eventos:</p>\n<h3 id=\"evento-acento-color-cambio-windows\"><a href=\"#evento-acento-color-cambio-windows\">Evento: 'acento-color-cambio' <em>Windows</em></a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>nuevoColor</code> String - El nuevo color RGBA que el usuario asignó para ser su color de acento del sistema.</li>\n</ul>\n<h3 id=\"event-color-changed-windows\"><a href=\"#event-color-changed-windows\">Event: 'color-changed' <em>Windows</em></a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n</ul>\n<h3 id=\"evento-inverted-color-scheme-changed-windows-obsoleto\"><a href=\"#evento-inverted-color-scheme-changed-windows-obsoleto\">Evento: 'inverted-color-scheme-changed' <em>Windows</em> <em>Obsoleto</em></a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>invertedColorScheme</code> Boolean - <code>true</code> si un esquema de color invertido (un esquema de color de alto contraste con texto claro y fondos oscuros) se esta usando, de otra manera <code>false</code>.</li>\n</ul>\n<p><strong>Obsoleto:</strong> Debería usar el nuevo evento <a href=\"/docs/api/native-theme#event-updated\"><code>updated</code></a> en el módulo <code>nativeTheme</code>.</p>\n<h3 id=\"evento-high-contrast-color-scheme-changed-windows-obsoleto\"><a href=\"#evento-high-contrast-color-scheme-changed-windows-obsoleto\">Evento: 'high-contrast-color-scheme-changed' <em>Windows</em> <em>Obsoleto</em></a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>highContrastColorScheme</code> Boolean - <code>true</code> si un tema de alto contraste es esta empezando a usar, de otra manera <code>false</code>.</li>\n</ul>\n<p><strong>Obsoleto:</strong> Debería usar el nuevo evento <a href=\"/docs/api/native-theme#event-updated\"><code>updated</code></a> en el módulo <code>nativeTheme</code>.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<h3 id=\"systempreferencesisdarkmode-macos-windows-deprecated\"><a href=\"#systempreferencesisdarkmode-macos-windows-deprecated\"><code>systemPreferences.isDarkMode()</code> <em>macOS</em> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Devuelve <code>Boolean</code> - Aunque el sistema esté en modo oscuro.</p>\n<p><strong>Obsoleto:</strong> Debería usar la nueva API <a href=\"/docs/api/native-theme#nativethemeshouldusedarkcolors-readonly\"><code>nativeTheme.shouldUseDarkColors</code></a>.</p>\n<h3 id=\"systempreferencesisswipetrackingfromscrolleventsenabled-macos\"><a href=\"#systempreferencesisswipetrackingfromscrolleventsenabled-macos\"><code>systemPreferences.isSwipeTrackingFromScrollEventsEnabled()</code> <em>macOS</em></a></h3>\n<p>Devuelve <code>Boolean</code> - Aunque el ajuste de cambio entre páginas esté activado.</p>\n<h3 id=\"systempreferencespostnotificationevent-userinfo-macos\"><a href=\"#systempreferencespostnotificationevent-userinfo-macos\"><code>systemPreferences.postNotification(event, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>evento</code> Cadena</li>\n<li>Registro <code>userInfo</code>&#x3C;String, any></li>\n<li><code>deliverImmediately</code> Boolean (Opcional) - <code>true</code> para publicar inmediatamente incluso cuando la aplicación esta inactiva.</li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencespostlocalnotificationevent-userinfo-macos\"><a href=\"#systempreferencespostlocalnotificationevent-userinfo-macos\"><code>systemPreferences.postLocalNotification(event, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>evento</code> Cadena</li>\n<li>Registro <code>userInfo</code>&#x3C;String, any></li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencespostworkspacenotificationevent-userinfo-macos\"><a href=\"#systempreferencespostworkspacenotificationevent-userinfo-macos\"><code>systemPreferences.postWorkspaceNotification(event, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>evento</code> Cadena</li>\n<li>Registro <code>userInfo</code>&#x3C;String, any></li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencessubscribenotificationevent-callback-macos\"><a href=\"#systempreferencessubscribenotificationevent-callback-macos\"><code>systemPreferences.subscribeNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>evento</code> Cadena</li>\n<li><code>callback</code> Función<ul>\n<li><code>evento</code> Cadena</li>\n<li>Registro <code>userInfo</code>&#x3C;String, unknown></li>\n<li>String <code>object</code></li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Number</code> - El ID de la suscripción</p>\n<p>Subscriptores a notificaciones nativas de macOS, <code>callback</code> serán llamados con <code>callback(evento, userinfo)</code> cuando el <code>evento</code> correspondiente suceda. El <code>userInfo</code> es un Objeto que contiene el diccionario de la información de usuario enviado junto a las notificaciones. El <code>object</code> es el remitente de la notificación y solo soporta valores <code>NSString</code> por ahora.</p>\n<p>El <code>id</code> del subscriptor es devuelto, el cual puede ser usado para desuscribir el <code>evento</code>.</p>\n<p>Bajo de la capucha este API subscribe a <code>NSDistributedNotificationCenter</code>, valores de ejemplo de <code>evento</code> son:</p>\n<ul>\n<li><code>AppleInterfaceThemeChangedNotification</code></li>\n<li><code>AppleAquaColorVariantChanged</code></li>\n<li><code>AppleColorPreferencesChangedNotification</code></li>\n<li><code>AppleShowScrollBarsSettingChanged</code></li>\n</ul>\n<h3 id=\"systempreferencessubscribelocalnotificationevent-callback-macos\"><a href=\"#systempreferencessubscribelocalnotificationevent-callback-macos\"><code>systemPreferences.subscribeLocalNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>evento</code> Cadena</li>\n<li><code>callback</code> Función<ul>\n<li><code>evento</code> Cadena</li>\n<li>Registro <code>userInfo</code>&#x3C;String, unknown></li>\n<li>String <code>object</code></li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Number</code> - El ID de la suscripción</p>\n<p>Same as <code>subscribeNotification</code>, but uses <code>NSNotificationCenter</code> for local defaults. Esto es necesario para eventos como <code>NSUserDefaultsDidChangeNotification</code>.</p>\n<h3 id=\"systempreferencessubscribeworkspacenotificationevent-callback-macos\"><a href=\"#systempreferencessubscribeworkspacenotificationevent-callback-macos\"><code>systemPreferences.subscribeWorkspaceNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>evento</code> Cadena</li>\n<li><code>callback</code> Función<ul>\n<li><code>evento</code> Cadena</li>\n<li>Registro <code>userInfo</code>&#x3C;String, unknown></li>\n<li>String <code>object</code></li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Number</code> - El ID de la suscripción</p>\n<p>Igual que <code>subscribeNotification</code>, pero utiliza <code>NSWorkspace.sharedWorkspace.notificationCenter</code>. Esto es necesario para eventos como <code>NSWorkspaceDidActivateApplicationNotification</code>.</p>\n<h3 id=\"systempreferencesunsubscribenotificationid-macos\"><a href=\"#systempreferencesunsubscribenotificationid-macos\"><code>systemPreferences.unsubscribeNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Íntegro</li>\n</ul>\n<p>Remueve el subscriptor con el <code>id</code>.</p>\n<h3 id=\"systempreferencesunsubscribelocalnotificationid-macos\"><a href=\"#systempreferencesunsubscribelocalnotificationid-macos\"><code>systemPreferences.unsubscribeLocalNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Íntegro</li>\n</ul>\n<p>Al igual que <code>unsubscribeNotification</code>, pero remueveal subscritor de <code>NSNotificationCenter</code>.</p>\n<h3 id=\"systempreferencesunsubscribeworkspacenotificationid-macos\"><a href=\"#systempreferencesunsubscribeworkspacenotificationid-macos\"><code>systemPreferences.unsubscribeWorkspaceNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Íntegro</li>\n</ul>\n<p>Igual que <code>unsubscribeNotification</code>, pero remueve el subscriptor desde <code>NSWorkspace.sharedWorkspace.notificationCenter</code>.</p>\n<h3 id=\"systempreferencesregisterdefaultsdefaults-macos\"><a href=\"#systempreferencesregisterdefaultsdefaults-macos\"><code>systemPreferences.registerDefaults(defaults)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>defaults</code> Record&#x3C;String, String | Boolean | Number> - un diccionario de valores por de defectos del usuario (<code>key: value</code>)</li>\n</ul>\n<p>Agregue los valores predeterminados especificados a <code>NSUserDefaults</code> de su aplicación.</p>\n<h3 id=\"systempreferencesgetuserdefaulttype-extends-keyof-userdefaulttypeskey-type-macos\"><a href=\"#systempreferencesgetuserdefaulttype-extends-keyof-userdefaulttypeskey-type-macos\"><code>systemPreferences.getUserDefault&#x3C;Type extends keyof UserDefaultTypes>(key, type)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>llave</code> Cadena</li>\n<li><code>type</code> Type - Can be <code>string</code>, <code>boolean</code>, <code>integer</code>, <code>float</code>, <code>double</code>, <code>url</code>, <code>array</code> or <code>dictionary</code>.</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/user-default-types\"><code>UserDefaultTypes[Type]</code></a> - The value of <code>key</code> in <code>NSUserDefaults</code>.</p>\n<p>Algún <code>key</code> y <code>type</code>s populares:</p>\n<ul>\n<li><code>AppleInterfaceStyle</code>: <code>string</code></li>\n<li><code>AppleAquaColorVariant</code>: <code>integer</code></li>\n<li><code>AppleHighlightColor</code>: <code>string</code></li>\n<li><code>AppleShowScrollBars</code>: <code>string</code></li>\n<li><code>NSNavRecentPlaces</code>: <code>array</code></li>\n<li><code>NSPreferredWebServices</code>: <code>dictionary</code></li>\n<li><code>NSUserDictionaryReplacementItems</code>: <code>array</code></li>\n</ul>\n<h3 id=\"systempreferencessetuserdefaultkey-type-value-macos\"><a href=\"#systempreferencessetuserdefaultkey-type-value-macos\"><code>systemPreferences.setUserDefault(key, type, value)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>llave</code> Cadena</li>\n<li><code>type</code> String - Can be <code>string</code>, <code>boolean</code>, <code>integer</code>, <code>float</code>, <code>double</code>, <code>url</code>, <code>array</code> or <code>dictionary</code>.</li>\n<li><code>value</code> Cadena</li>\n</ul>\n<p>Establece el valor de <code>key</code> en <code>NSUserDefaults</code>.</p>\n<p>Note that <code>type</code> should match actual type of <code>value</code>. An exception is thrown if they don't.</p>\n<p>Algún <code>key</code> y <code>type</code>s populares:</p>\n<ul>\n<li><code>ApplePressAndHoldEnabled</code>: <code>boolean</code></li>\n</ul>\n<h3 id=\"systempreferencesremoveuserdefaultkey-macos\"><a href=\"#systempreferencesremoveuserdefaultkey-macos\"><code>systemPreferences.removeUserDefault(key)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>llave</code> Cadena</li>\n</ul>\n<p>Elimina el <code>key</code> en <code>NSUserDefaults</code>. This can be used to restore the default or global value of a <code>key</code> previously set with <code>setUserDefault</code>.</p>\n<h3 id=\"systempreferencesisaeroglassenabled-windows\"><a href=\"#systempreferencesisaeroglassenabled-windows\"><code>systemPreferences.isAeroGlassEnabled()</code> <em>Windows</em></a></h3>\n<p>Devuelve <code>Boolean</code> - <code>true</code> si <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/aa969540.aspx\">DWM composition</a> (Aero Glass) está habilitada, y <code>false</code> de lo contrario.</p>\n<p>Un ejemplo de usarlo para determinar si deberías crear una ventana transparente o no (las ventanas transparentes no funcionarán correctamente cuando la composición de DWM está deshabilitada):</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> browserOptions = { <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">1000</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">800</span> }\n\n<span class=\"hljs-comment\">// Make the window transparent only if the platform supports it.</span>\n<span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'win32'</span> || systemPreferences.isAeroGlassEnabled()) {\n  browserOptions.transparent = <span class=\"hljs-literal\">true</span>\n  browserOptions.frame = <span class=\"hljs-literal\">false</span>\n}\n\n<span class=\"hljs-comment\">// Create the window.</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow(browserOptions)\n\n<span class=\"hljs-comment\">// Navigate.</span>\n<span class=\"hljs-keyword\">if</span> (browserOptions.transparent) {\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/index.html`</span>)\n} <span class=\"hljs-keyword\">else</span> {\n  <span class=\"hljs-comment\">// No transparency, so we load a fallback that uses basic styles.</span>\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/fallback.html`</span>)\n}\n</code></pre>\n<h3 id=\"systempreferencesgetaccentcolor-windows-macos\"><a href=\"#systempreferencesgetaccentcolor-windows-macos\"><code>systemPreferences.getAccentColor()</code> <em>Windows</em> <em>macOS</em></a></h3>\n<p>Devuelve <code>Cadena</code> - El sistema actual de usuarios amplía el acento del color de preferencia en la forma hexadecimal de RGBA.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> color = systemPreferences.getAccentColor() <span class=\"hljs-comment\">// `\"aabbccdd\"`</span>\n<span class=\"hljs-keyword\">const</span> red = color.substr(<span class=\"hljs-number\">0</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"aa\"</span>\n<span class=\"hljs-keyword\">const</span> green = color.substr(<span class=\"hljs-number\">2</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"bb\"</span>\n<span class=\"hljs-keyword\">const</span> blue = color.substr(<span class=\"hljs-number\">4</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"cc\"</span>\n<span class=\"hljs-keyword\">const</span> alpha = color.substr(<span class=\"hljs-number\">6</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"dd\"</span>\n</code></pre>\n<p>Esta API solo esta disponible desde macOS 10.15 Mojave or posteriores.</p>\n<h3 id=\"systempreferencesgetcolorcolor-windows-macos\"><a href=\"#systempreferencesgetcolorcolor-windows-macos\"><code>systemPreferences.getColor(color)</code> <em>Windows</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>color</code> String - One of the following values:<ul>\n<li>On <strong>Windows</strong>:<ul>\n<li><code>3d-dark-shadow</code> - Sombra oscura para elementos de tres dimensiones mostrados.</li>\n<li><code>3d-face</code> - Color facial para elementos de tres dimensiones mostrados y para cuadro de fondos de las caja de diálogo.</li>\n<li><code>3d-highlight</code> - Resalta color para elementos de tres dimensiones mostrados.</li>\n<li><code>3d-light</code> - Color claro para elementos de tres dimensiones mostrados.</li>\n<li><code>3d-shadow</code> - Color oscuro para elementos de tres dimensiones mostrados.</li>\n<li><code>active-border</code> - Borde de ventana activo.</li>\n<li><code>active-caption</code> - Active window title bar. Specifies the left side color in the color gradient of an active window's title bar if the gradient effect is enabled.</li>\n<li><code>active-caption-gradient</code> - El color del lado derecho en el tono del color de un título de barra de una ventana activa.</li>\n<li><code>app-workspace</code> - Color de fondo de múltiples documentos de aplicaciones de interfase.</li>\n<li><code>button-text</code> - Texto en los botones de presión.</li>\n<li><code>caption-text</code> - Textos en subtítulos, tamaño de la caja y la barra de desplazamiento de la caja de flecha.</li>\n<li><code>desktop</code> - Color de fondo del escritorio.</li>\n<li><code>disabled-text</code> - Gris (desactivado) texto.</li>\n<li><code>highlight</code> - objeto(s) seleccionados en un control.</li>\n<li><code>highlight-text</code> - Texto de objeto(s) seleccionados en un control.</li>\n<li><code>hotlight</code> - Color para un hiperlink o un muy rastreado objeto.</li>\n<li><code>inactive-border</code> - Borde de ventana inactivo.</li>\n<li><code>inactive-caption</code> - Inactive window caption. Specifies the left side color in the color gradient of an inactive window's title bar if the gradient effect is enabled.</li>\n<li><code>inactive-caption-gradient</code> - Color del lado derecho en el tono de color de un título de barra de una ventana inactiva.</li>\n<li><code>inactive-caption-text</code> - Color del texto en un subtítulo inactivo.</li>\n<li><code>info-background</code> - Color de fondo para control de información de herramientas.</li>\n<li><code>info-text</code> - Color de texto para controles de información de herramientas.</li>\n<li><code>menu</code> - Fondo del menú.</li>\n<li><code>menu-highlight</code> - El color usado para resaltar los objetos del menú cuando el menú aparece como un menú plano.</li>\n<li><code>menubar</code> - El color de fondo para la barra del menú cuando los menús aparecen como menús planos.</li>\n<li><code>menu-text</code> - Textos en menús.</li>\n<li><code>scrollbar</code> - Desplazar la barra en el área gris.</li>\n<li><code>window</code> - Fondo de la ventana.</li>\n<li><code>window-frame</code> - Cuadro de ventana.</li>\n<li><code>window-text</code> - Texto en ventanas.</li>\n</ul></li>\n<li>On <strong>macOS</strong><ul>\n<li><code>alternate-selected-control-text</code> - Texto en una superficie selecciona, en una lista o en una tabla. <em>deprecated</em></li>\n<li><code>control-background</code> - El fondo de un elemento de interfaz grande, tal como un navegador o tablet.</li>\n<li><code>control</code> - La superficie de un control.</li>\n<li><code>control-text</code> - El texto de un control que no está deshabilitado.</li>\n<li><code>disabled-control-text</code> - El texto de un control que esta deshabilitado.</li>\n<li><code>find-highlight</code> - El color de un indicador de búsqueda.</li>\n<li><code>grid</code> - Las líneas de cuadrículas de un elemento de interfaz como una tabla.</li>\n<li><code>header-text</code> - El texto de una celda de cabecera en una tabla.</li>\n<li><code>highlight</code> - La fuente de luz virtual en la pantalla.</li>\n<li><code>keyboard-focus-indicator</code> - El anillo que aparece alrededor del control actualmente enfocado cuando se usa el teclado para la nevagación por la interface.</li>\n<li><code>label</code> - El texto de una etiqueta que contiene el contenido primario.</li>\n<li><code>link</code> - Un enlace a otro contenido.</li>\n<li><code>placeholder-text</code> -  Una cadena de marcador de posición en una vista de control o texto.</li>\n<li><code>quaternary-label</code> - El texto de una etiqueta de menor importancia que una etiqueta terciaria como el texto de la marca de agua.</li>\n<li><code>scrubber-textured-background</code> - El fonfo de un depurado en el Touch Bar.</li>\n<li><code>secondary-label</code> - El texto de una etiqueta de menor importancia que una etiqueta normal como el usado para representar un subtítulo o información adicional.</li>\n<li><code>selected-content-background</code> - El fondo para el contenido seleccionado en una ventana clave o en una vista.</li>\n<li><code>selected-control</code> - La superficie de un control seleccionado.</li>\n<li><code>selected-control-text</code> - El texto un control seleccionado.</li>\n<li><code>selected-menu-item-text</code> - El texto del menú seleccionado.</li>\n<li><code>selected-text-background</code> - El fondo de un texto seleccionado.</li>\n<li><code>selected-text</code> - Texto seleccionado.</li>\n<li><code>separator</code> - Un separado entre las diferentes secciones del contenido.</li>\n<li><code>shadow</code> - La sombra virtual proyectada por un objeto en la pantalla.</li>\n<li><code>tertiary-label</code> - El texto para una etiqueta de menor importancia que una etiqueta secundaria como una etiqueta que se usa para representar texto deshabilidato.</li>\n<li><code>text-background</code> - Texto de fondo.</li>\n<li><code>text</code> - Texto en un documento.</li>\n<li><code>under-page-background</code>  - El fondo detrás del contenido de un documento.</li>\n<li><code>unemphasized-selected-content-background</code> - El contenido seleccionado en una ventana o vista no-clave.</li>\n<li><code>unemphasized-selected-text-background</code> - Un fondo para el texto seleccionado en una ventana o vista no clave.</li>\n<li><code>unemphasized-selected-text-background</code> - Texto seleccionado en una ventana o vista no clave.</li>\n<li><code>window-background</code> - El fondo de una ventana.</li>\n<li><code>window-frame-text</code> - El texto en la area de la barra de título de la ventana.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Devuelve <code>String</code> - El color del sistema ajustando en la forma hexadecimal de RGB (<code>#ABCDEF</code>). Vea el <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx\">Windows docs</a> y el <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#dynamic-system-colors\">macOS docs</a> para más detalles.</p>\n<p>Los siguientes colores solo están disponibles en macOS 10.14: <code>find-highlight</code>, <code>selected-content-background</code>, <code>separator</code>, <code>unemphasized-selected-content-background</code>, <code>unemphasized-selected-text-background</code>, y <code>unemphasized-selected-text</code>.</p>\n<h3 id=\"systempreferencesgetsystemcolorcolor-macos\"><a href=\"#systempreferencesgetsystemcolorcolor-macos\"><code>systemPreferences.getSystemColor(color)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>color</code> String - One of the following values:<ul>\n<li><code>azul</code></li>\n<li><code>marrón</code></li>\n<li><code>gris</code></li>\n<li><code>verde</code></li>\n<li><code>naranja</code></li>\n<li><code>rosa</code></li>\n<li><code>púrpura</code></li>\n<li><code>rojo</code></li>\n<li><code>amarillo</code></li>\n</ul></li>\n</ul>\n<p>Devuelve <code>String</code> - El sistema de color estándar formateado como <code>#RRGGBBAA</code>.</p>\n<p>Devuelve uno de los varios colores estándar del sistema que se adaptan automáticamente a la vibración y los cambios en los ajustes de accesibilidad como \"Aumentar contraste\" y \"reducir transparencia\". Ver <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#system-colors\">Apple Documentation</a> para mas detalles.</p>\n<h3 id=\"systempreferencesisinvertedcolorscheme-windows-deprecated\"><a href=\"#systempreferencesisinvertedcolorscheme-windows-deprecated\"><code>systemPreferences.isInvertedColorScheme()</code> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Returns <code>Boolean</code> - <code>true</code> si un esquema de color invertido (un esquema de color de alto contraste con texto claro y fondo oscuro) está activo. De otra manera <code>false</code>.</p>\n<p><strong>Obsoleto:</strong> Debería usar la nueva API <a href=\"/docs/api/native-theme#nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly\"><code>nativeTheme.shouldUseInvertedColorScheme</code></a>.</p>\n<h3 id=\"systempreferencesishighcontrastcolorscheme-macos-windows-deprecated\"><a href=\"#systempreferencesishighcontrastcolorscheme-macos-windows-deprecated\"><code>systemPreferences.isHighContrastColorScheme()</code> <em>macOS</em> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Devuelve <code>Boolean</code> - <code>true</code> si un tema de alto contraste está activo, si no <code>false</code>.</p>\n<p><strong>Deprecated:</strong> Use la nueva API de <a href=\"/docs/api/native-theme#nativethemeshouldusehighcontrastcolors-macos-windows-readonly\"><code>nativeTheme.shouldUseHighContrastColors</code></a>.</p>\n<h3 id=\"systempreferencesgeteffectiveappearance-macos\"><a href=\"#systempreferencesgeteffectiveappearance-macos\"><code>systemPreferences.getEffectiveAppearance()</code> <em>macOS</em></a></h3>\n<p>Devuelve <code>String</code> - Puede ser <code>dark</code>, <code>light</code> o <code>unknown</code>.</p>\n<p>Obtiene confiración de la apariencia de macOS que está actulemente aplicada, mapea a <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc\">NSApplication.effectiveAppearance</a></p>\n<h3 id=\"systempreferencesgetapplevelappearance-macos-deprecated\"><a href=\"#systempreferencesgetapplevelappearance-macos-deprecated\"><code>systemPreferences.getAppLevelAppearance()</code> <em>macOS</em> <em>Deprecated</em></a></h3>\n<p>Devuelve<code>String</code> | <code>null</code> - Puede ser <code>dark</code>, <code>light</code> o <code>unknown</code>.</p>\n<p>Obtiene la configuración de apariencia de macOS que has declarado que desea para su aplicación, mapea a <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc\">NSApplication.appearance</a>. Puedes usar la API <code>setAppLevelAppearance</code> para establecer este valor.</p>\n<h3 id=\"systempreferencessetapplevelappearanceappearance-macos-deprecated\"><a href=\"#systempreferencessetapplevelappearanceappearance-macos-deprecated\"><code>systemPreferences.setAppLevelAppearance(appearance)</code> <em>macOS</em> <em>Deprecated</em></a></h3>\n<ul>\n<li><code>appearance</code> String | null - Puede ser <code>dark</code> o <code>light</code></li>\n</ul>\n<p>Establece la configuración por defecto para su aplicación, esto debe sobrescribir el valor predeterminado del sistema y sobrescribir el valor de <code>getEffectiveAppearance</code>.</p>\n<h3 id=\"systempreferencescanprompttouchid-macos\"><a href=\"#systempreferencescanprompttouchid-macos\"><code>systemPreferences.canPromptTouchID()</code> <em>macOS</em></a></h3>\n<p>Devuelve <code>Boolean</code> - si este dispositivo tiene la habilidad para usar Touch ID.</p>\n<p><strong>NOTE:</strong> Esta API retornará <code>false</code> en sistemas macOS mas viejos que Sierra 10.12.2.</p>\n<h3 id=\"systempreferencesprompttouchidreason-macos\"><a href=\"#systempreferencesprompttouchidreason-macos\"><code>systemPreferences.promptTouchID(reason)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>reason</code> String - La razón por la que estás pidiendo por la autenticación Touch ID</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code> - Se resuelve si el usuario se ha autenticado con éxito con Touch ID.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsystemPreferences.promptTouchID(<span class=\"hljs-string\">'To get consent for a Security-Gated Thing'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">success</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'You have successfully authenticated with Touch ID!'</span>)\n}).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(err)\n})\n</code></pre>\n<p>Esta API en si misma no va a proteger sus datos de usuario, más bien, es un mecanismo para permitirle hacerlo. Native apps will need to set <a href=\"https://developer.apple.com/documentation/security/secaccesscontrolcreateflags?language=objc\">Access Control Constants</a> like <a href=\"https://developer.apple.com/documentation/security/secaccesscontrolcreateflags/ksecaccesscontroluserpresence?language=objc\"><code>kSecAccessControlUserPresence</code></a> on their keychain entry so that reading it would auto-prompt for Touch ID biometric consent. Esto se podría hacer con <a href=\"https://github.com/atom/node-keytar\"><code>node-keytar</code></a>, de tal manera que se almacenaría una clave de cifrado con <code>node-keytar</code> u sólo se obtendría si <code>promptTouchID()</code> se resuelve.</p>\n<p><strong>NOTE:</strong> Esta API retornara una promesa rechazada en sistemas macOS más viejos que Sierra 10.12.2.</p>\n<h3 id=\"systempreferencesistrustedaccessibilityclientprompt-macos\"><a href=\"#systempreferencesistrustedaccessibilityclientprompt-macos\"><code>systemPreferences.isTrustedAccessibilityClient(prompt)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>prompt</code> Boolean - Si el usuario será informado o no vía prompt si el proceso actual no es confiable.</li>\n</ul>\n<p>Devuelve <code>Boolean</code> - <code>true</code> si el proceso actual es un cliente de accesibilidad de confianza y <code>false</code> si no lo es.</p>\n<h3 id=\"systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><a href=\"#systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><code>systemPreferences.getMediaAccessStatus(mediaType)</code> <em>Windows</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>mediaType</code> String - Puede ser <code>microphone</code>, <code>camera</code> o <code>screen</code>.</li>\n</ul>\n<p>Devuelve <code>String</code> - Puede ser <code>not-determined</code>, <code>granted</code>, <code>denied</code>, <code>restricted</code> o <code>unknown</code>.</p>\n<p>Este consentimiento de usuario no fue requerido en macOS 10.13 High Sierra o anteriores por lo tanto este método siempre devolverá <code>granted</code>. macOS 10.14 Mojave o superior requiere consentimiento para acceso a <code>microphone</code> y <code>camera</code>. macOS 10.15 Catalina o superior requiere consentimiento para acceso a <code>screen</code>.</p>\n<p>Windows 10 has a global setting controlling <code>microphone</code> and <code>camera</code> access for all win32 applications. It will always return <code>granted</code> for <code>screen</code> and for all media types on older versions of Windows.</p>\n<h3 id=\"systempreferencesaskformediaaccessmediatype-macos\"><a href=\"#systempreferencesaskformediaaccessmediatype-macos\"><code>systemPreferences.askForMediaAccess(mediaType)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>mediaType</code> String - el tipo de medio que se solicita; puede ser <code>microphone</code>, <code>camera</code>.</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;Boolean></code> - Una promesa que resuelve con <code>true</code> se fue concedido el consentimiento y <code>false</code> si fue denegado. Si un <code>mediaType</code> invalido es pasado, la promesa será rechazada. Si se negó una solicitud de acceso y después se cambia a través del panel de Preferencias del Sistema, se requerirá un reinicio de la aplicación para que los nuevos permisos surtan efecto. Si el acceso ya ha sido solicitado y denegado, <em>must</em> ser cambiado a través del panel de preferencias; una alerta no aparecerá y la promesa resolverá con el estado de acceso existente.</p>\n<p><strong>Important:</strong> Para poder aprovechar correctamente esta API, debes <a href=\"https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos?language=objc\">must set</a> las cadenas <code>NSMicrophoneUsageDescription</code> y <code>NSCameraUsageDescription</code> en el archivo <code>Info.plist</code> de tu aplicación. Los valores para estas claves se utilizarán para rellenar los diálogos de permisos para que el usuario sea informado correctamente sobre el propósito de la solicitud de permiso. Mira <a href=\"/docs/tutorial/application-distribution#macos\">Electron Application Distribution</a> para más información acerca de como establecer estos en el contexto de Electron.</p>\n<p>Este consentimiento de usuario no fue requerido hasta macOS 10.14 Mojave, por lo que este método siempre devolverá <code>true</code> si su sistema está ejecutando 10.13 High Sierra o inferior.</p>\n<h3 id=\"systempreferencesgetanimationsettings\"><a href=\"#systempreferencesgetanimationsettings\"><code>systemPreferences.getAnimationSettings()</code></a></h3>\n<p>Devuelve <code>Objeto</code>:</p>\n<ul>\n<li><code>shouldRenderRichAnimation</code> Boolean - Devuelve verdadero is animaciones ricas deben ser renderizadas. Se observa en el tipo de sesión (por ejemplo, escritorio remoto) y ajustes de accesibilidad para dar orientación a animaciones pesadas.</li>\n<li><code>scrollAnimationsEnabledBySystem</code> Boolean - Determina sobre una base por plataforma si las animaciones de desplazamiento (por ejemplo, producidas por la clave home/end) deben estar habilitadas.</li>\n<li><code>prefiere ReducdMotion</code> Boolean - Determina si el usuario desea un movimiento reducido basado en APIs de la plataforma.</li>\n</ul>\n<p>Devuelve un objeto con las configuraciones del sistema de animación.</p>\n<h2 id=\"propiedades\"><a href=\"#propiedades\">Propiedades</a></h2>\n<h3 id=\"systempreferencesapplevelappearance-macos\"><a href=\"#systempreferencesapplevelappearance-macos\"><code>systemPreferences.appLevelAppearance</code> <em>macOS</em></a></h3>\n<p>Una propiedad <code>String</code> que puede ser <code>dark</code>, <code>light</code> o <code>unknown</code>. Determina la configuración de apariencia de macOS para tu aplicación. Esto mapea a valores en <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc\">NSApplication.appearance</a>. Establecer esto sobrescribirá el valor por defecto de sistema así como el valor de <code>getEffectiveAppearance</code>.</p>\n<p>Posibles valores que se pueden configurar son <code>dark</code> y <code>light</code> y posibles valores de retorno son <code>dark</code>, <code>light</code> y <code>unknown</code>.</p>\n<p>Esta propiedad solo está disponible en macOS 10.14 Mojave o posteriores.</p>\n<h3 id=\"systempreferenceseffectiveappearance-macos-sololectura\"><a href=\"#systempreferenceseffectiveappearance-macos-sololectura\"><code>systemPreferences.effectiveAppearance</code> <em>macOS</em> <em>SoloLectura</em></a></h3>\n<p>Una propiedad <code>String</code> que puede ser <code>dark</code>, <code>light</code> o <code>unknown</code>.</p>\n<p>Devuelve la configuración de apariencia de macOS que esta aplicada actualmente a tu aplicación mapea a <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc\">NSApplication.effectiveAppearance</a></p>",
      "title": "systemPreferences",
      "description": "Obtener las preferencias del sistema."
    },
    "/docs/api/structures/task": {
      "locale": "es-ES",
      "slug": "task",
      "href": "/docs/api/structures/task",
      "crowdinFileId": "256513",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/task.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"task-object\"><a href=\"#task-object\">Task Object</a></h1>\n<ul>\n<li><code>program</code> String - Path of the program to execute, usually you should specify <code>process.execPath</code> which opens the current program.</li>\n<li><code>arguments</code> String - The command line arguments when <code>program</code> is executed.</li>\n<li><code>title</code> String - The string to be displayed in a JumpList.</li>\n<li><code>description</code> String - Description of this task.</li>\n<li><code>iconPath</code> String - The absolute path to an icon to be displayed in a JumpList, which can be an arbitrary resource file that contains an icon. You can usually specify <code>process.execPath</code> to show the icon of the program.</li>\n<li><code>iconIndex</code> Number - The icon index in the icon file. If an icon file consists of two or more icons, set this value to identify the icon. If an icon file consists of one icon, this value is 0.</li>\n<li><code>workingDirectory</code> String (optional) - The working directory. Default is empty.</li>\n</ul>",
      "title": "Task Object",
      "description": ""
    },
    "/docs/development/testing": {
      "locale": "es-ES",
      "slug": "testing",
      "href": "/docs/development/testing",
      "crowdinFileId": "256169",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/testing.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"pruebas\"><a href=\"#pruebas\">Pruebas</a></h1>\n<p>Nuestro objetivo es mantener la cobertura de código de electrón alto. Pedimos que todas la solicitudes de extracción requeridas no solo pasen todas las pruebas existentes, lo ideal seria añadir nuevas pruebas para cubrir los cambios en el código y nuevos escenarios. Asegurando que capturamos muchas rutas de código y casos de uso de Electrón es posible asegurar que todas las aplicaciones tengan menos errores.</p>\n<p>Este repositorio viene con reglas de borrado tanto para JavaScript como para C++ – así como pruebas de unidad e integración. Para aprender más sobre el estilo de código de Electron, por favor vea el documento <a href=\"/docs/development/coding-style\">coding-style</a>.</p>\n<h2 id=\"borrador\"><a href=\"#borrador\">Borrador</a></h2>\n<p>Asegúrese de que su JavaScript cumpla con la codificación de Electron estilo, run <code>npm run lint-js</code>, que se ejecutara <code>standard</code> contra ambos tanto el propio electrón, así como las pruebas unitarias. Si estás usando un editor con un sistema de plugin/addon, es posible que desees utilizar uno de los muchos <a href=\"https://standardjs.com/#are-there-text-editor-plugins\"> Complementos de StandardJS </a>, para estar informado de violaciones de estilo de codificación antes de comprometerlas.</p>\n<p>Para ejecutar <code>estándar</code> con parámetros, ejecute <code>npm run lint-js --</code> seguido de los argumentos que quieras pasar a <code>estándar</code>.</p>\n<p>Para garantizar que tu C ++ cumpla con el estilo de codificación de electrones, ejecuta <code>npm run lint-cpp</code>, que ejecuta un script <code>cpplint</code>. Le recomendamos que utilice el <code>Formato clang</code> y se prepare con <a href=\"/docs/development/clang-format\">un breve tutorial</a>.</p>\n<p>No hay mucho de Python en este repositorio, pero también se rige por las reglas de estilo de código. <code>npm run lint-py</code> comprobará todo el Python, usando <code>pylint</code> para hacerlo.</p>\n<h2 id=\"pruebas-unitarias\"><a href=\"#pruebas-unitarias\">Pruebas unitarias</a></h2>\n<p>Si no está usando <a href=\"https://github.com/electron/build-tools\">build-tools</a>, asegúrese de que el nombre que ha configurado para su compulación local de Electron is uno de <code>Testing</code>, <code>Release</code>, <code>Default</code>, <code>Debug</code>, o ha establecido <code>process.env.ELECTRON_OUT_DIR</code>. Sin estos conjuntos, Electron fallará al realizar algunos pasos previos a la prueba.</p>\n<p>Para ejecutar todas las pruebas de unidad, ejecute <code>npm run test</code>. Las pruebas de unidad son una aplicación de Electrón(¡sorpresa!) que puede encontrarse en la carpeta de <code>spec</code>. Tenga en cuenta que tiene su propio <code>package.json</code> y que sus dependencias por lo tanto no se definen en el nivel superior <code>package.json</code>.</p>\n<p>Para correr solo pruebas especificas que coincidan con un patrón, corra <code>npm run test -- -g=PATTERN</code>, reempleazando el <code>PATTERN</code> con una expresión regular que coinciden con los test que le gustaría correr. Como un ejemplo: Si solo quiere correr pruebas IPC, usted debería correr <code>npm run test -- -g ipc</code>.</p>\n<h3 id=\"probando-en-dispositivos-windows-10\"><a href=\"#probando-en-dispositivos-windows-10\">Probando en dispositivos Windows 10</a></h3>\n<h4 id=\"pasos-adicionales-para-ejecutar-prueba-unitaria\"><a href=\"#pasos-adicionales-para-ejecutar-prueba-unitaria\">Pasos adicionales para ejecutar prueba unitaria:</a></h4>\n<ol>\n<li>\n<p>Visual Studio 2019 debe estar instalado.</p>\n</li>\n<li>\n<p>Las cabeceras de Node han de estar compiladas para tu configuración.</p>\n<pre><code class=\"hljs language-powershell\">ninja -C out\\Testing third_party\\electron_node:headers\n</code></pre>\n</li>\n<li>\n<p>El electron.lib ha de ser copiada como node.lib.</p>\n<pre><code class=\"hljs language-powershell\">cd out\\Testing\nmkdir gen\\node_headers\\Release\ncopy electron.lib gen\\node_headers\\Release\\node.lib\n</code></pre>\n</li>\n</ol>\n<h4 id=\"fuentes-no-encontradas\"><a href=\"#fuentes-no-encontradas\">Fuentes no encontradas</a></h4>\n<p><a href=\"https://docs.microsoft.com/en-us/typography/fonts/windows_10_font_list\">Algunos dispositivos Windows 10</a> no se incluye la fuente Meiryo instalada, lo que puede causar que falle una prueba. Para instalar Meiryo:</p>\n<ol>\n<li>Presione la tecla Windows y busca <em>Administrar herramientas opcionales</em>.</li>\n<li>Haga clic en <em>Añadir una herramienta</em>.</li>\n<li>Seleccione <em>Fuentes suplementarias japonesas</em> y haga clic en <em>Instalar</em>.</li>\n</ol>\n<h4 id=\"medidas-de-píxeles\"><a href=\"#medidas-de-píxeles\">Medidas de píxeles</a></h4>\n<p>Algunas pruebas que dependen de medidas precisas a nivel de píxel pueden no funcionar correctamente en dispositivos con ajustes de pantalla Hi-DPI debido a errores de precisión de puntos flotantes. Para ejecutar correctamente estas pruebas, asegúrese de que el dispositivo está fijado para escalar el 100%.</p>\n<p>Para configurar el escalamiento de pantalla:</p>\n<ol>\n<li>Presione la tecla Windows y busca <em>Ajustes de pantalla</em>.</li>\n<li>Bajo <em>Escalar y disposición</em>, asegúrese de que el dispositivo está fijado al 100%.</li>\n</ol>",
      "title": "Pruebas",
      "description": ""
    },
    "/docs/tutorial/testing-on-headless-ci": {
      "locale": "es-ES",
      "slug": "testing-on-headless-ci",
      "href": "/docs/tutorial/testing-on-headless-ci",
      "crowdinFileId": "256255",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/testing-on-headless-ci.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"pruebas-de-sistemas-de-ci-sin-cabeceras-travis-ci-jenkins\"><a href=\"#pruebas-de-sistemas-de-ci-sin-cabeceras-travis-ci-jenkins\">Pruebas de sistemas de CI sin cabeceras (Travis CI, Jenkins)</a></h1>\n<p>Al estar basado en Chromium, Electron requiere un controlador para funcionar. Si chromium no puede encontrar un controlador de pantalla, Electron no se lanzará y por lo tanto no ejecuta ningunas de sus pruebas, independientemente de como usted las está corriendo. Probar aplicaciones basadas en Electron en Travis, Circle, Jenkins o sistemas similares requiere un poco de configuración. En esencia, necesitamos un controlador de pantalla virtual.</p>\n<h2 id=\"configurando-un-servidor-de-pantalla-virtual\"><a href=\"#configurando-un-servidor-de-pantalla-virtual\">Configurando un servidor de pantalla virtual</a></h2>\n<p>Primero, instala <a href=\"https://en.wikipedia.org/wiki/Xvfb\">Xvfb</a>. Es un framebuffer virtual, implementando el protocolo de servidor de pantalla X11 - realiza todas las operaciones gráficas en la memoria sin mostrar nada en el monitor, que es exactamente lo que necesitamos.</p>\n<p>Entonces, crea una pantalla virtual Xvfb y exporta una variable de entorno llamada DISPLAY que apunta a ella. Chromium en electron buscará automáticamente por <code>$DISPLAY</code>, así que su aplicación no requerirá más configuraciones. Este paso puede ser automatizado con Anaïs Betts' <a href=\"https://github.com/anaisbetts/xvfb-maybe\">xvfb-maybe</a>: prepara tus pruebas de comandos con <code>xvfb-maybe</code> y la pequeña herramienta automáticamente configurará Xvfb, si es requerido por el sistema actual. En Windows o macOS, no hará nada.</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-comment\">## En Windows o macOS, esto invoca electron-mocha</span>\n<span class=\"hljs-comment\">## En Linux, si estamos en un entorno sin cabeza, esto será equivalente</span>\n<span class=\"hljs-comment\">## a xvfb-run electron-mocha ./test/*.js</span>\nxvfb-maybe electron-mocha ./<span class=\"hljs-built_in\">test</span>/*.js\n</code></pre>\n<h3 id=\"travis-ci\"><a href=\"#travis-ci\">Travis CI</a></h3>\n<p>En Travis, su <code>. travis.yml</code> debería verse más o menos así:</p>\n<pre><code class=\"hljs language-yml\"><span class=\"hljs-attr\">addons:</span>\n  <span class=\"hljs-attr\">apt:</span>\n    <span class=\"hljs-attr\">packages:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">xvfb</span>\n\n<span class=\"hljs-attr\">install:</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">export</span> <span class=\"hljs-string\">DISPLAY=':99.0'</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">Xvfb</span> <span class=\"hljs-string\">:99</span> <span class=\"hljs-string\">-screen</span> <span class=\"hljs-number\">0</span> <span class=\"hljs-string\">1024x768x24</span> <span class=\"hljs-string\">></span> <span class=\"hljs-string\">/dev/null</span> <span class=\"hljs-number\">2</span><span class=\"hljs-string\">>&#x26;1</span> <span class=\"hljs-string\">&#x26;</span>\n</code></pre>\n<h3 id=\"jenkins\"><a href=\"#jenkins\">Jenkins</a></h3>\n<p>Para Jenkins, un <a href=\"https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin\">plugin de Xvfb está disponible</a>.</p>\n<h3 id=\"circle-ci\"><a href=\"#circle-ci\">Circle CI</a></h3>\n<p>Circle CI es impresionante y tiene xvfb y <code>$DISPLAY</code> <a href=\"https://circleci.com/docs/environment#browsers\">ya configurados, por lo que no es necesaria ninguna configuración adicional</a>.</p>\n<h3 id=\"appveyor\"><a href=\"#appveyor\">AppVeyor</a></h3>\n<p>AppVeyor corre en Windows, soportando Selenium, Chromium, electron y herramientas fuera de la caja similares - no se requiere configuración.</p>",
      "title": "Pruebas de sistemas de CI sin cabeceras (Travis CI, Jenkins)",
      "description": ""
    },
    "/docs/tutorial/testing-widevine-cdm": {
      "locale": "es-ES",
      "slug": "testing-widevine-cdm",
      "href": "/docs/tutorial/testing-widevine-cdm",
      "crowdinFileId": "256257",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/testing-widevine-cdm.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"probando-widevine-cdm\"><a href=\"#probando-widevine-cdm\">Probando Widevine CDM</a></h1>\n<p>En Electron usted puede usar la librería de Widevine CDM conectado con el navegador Chrome.</p>\n<p>Widevine Content Decryption Modules (CDMs) es la forma en que los servicios de streaming protegen el contenido utilizando vídeo HTML5 en los navegadores web sin depender de un plugin NPAPI como Flash o Silverlight. El soporte Widevine es un solución alternativa para los servicios de streaming que actualmente depende de Silverlight para la reproducción contenido de video protegidos por DRM. Esto permitirá a sitios web mostrar contenido de video protegidos con DRM en Firefox sin el uso de plugins NPAPI. El Widevine CDM corre en un sandbox open-source que proporciona mejor seguridad que los plugins NPAPI.</p>\n<h4 id=\"nota-sobre-vmp\"><a href=\"#nota-sobre-vmp\">Nota sobre VMP</a></h4>\n<p>A partir de <a href=\"https://electronjs.org/releases#1.8.1\"><code>Electron v1.8.0 (Chrome v59)</code></a>, los siguientes pasos pueden ser sólo algunos de los pasos necesarios para habilitar Widevine; cualquier aplicación en o después de esa versión que pretenda usar el Widevine CDM puede necesitar firmarse utilizando una licencia obtenida de <a href=\"https://www.widevine.com/\">Widevine</a> en sí mismo.</p>\n<p>Por <a href=\"https://www.widevine.com/\">Widevine</a>:</p>\n<blockquote>\n<p>Chrome 59 (y superiores) incluyen soporte para Verified Media Path (VMP). VMP  proporciona un método para verificar la autenticidad de una plataforma de dispositivos. Para las implementaciones de navegadores, esto proporcionará una señal adicional para determinar si una implementación basada en navegador es fiable y segura.</p>\n<p>La guía de integración del proxy ha sido actualizada con información acerca de VMP y como y cómo emitir licencias.</p>\n<p>Widevine recomienda que nuestras integraciones basadas en el navegador (vendedores y aplicaciones basadas en el navegador) añadan soporte para VMP.</p>\n</blockquote>\n<p>Para habilitar la reproducción de video con esta nueva restricción, ha sido creado <a href=\"https://castlabs.com/open-source/downstream/\">castLabs</a> un <a href=\"https://github.com/castlabs/electron-releases\">fork</a> que tiene implementado los cambios necesarios para habilitar Wedevine para ser reproducido en una aplicación Electron si uno ha obtenida las licencias necesarias desde widevine.</p>\n<h2 id=\"obtener-la-librería\"><a href=\"#obtener-la-librería\">Obtener la librería</a></h2>\n<p>Abre <code>chrome://components/</code> en el navegador Chrome, encuentra <code>Widevine Content Decryption Module</code> y asegúrese de que esté actualizado, luego puede encontrar los archivos de la biblioteca desde el directorio de la aplicación.</p>\n<h3 id=\"on-windows\"><a href=\"#on-windows\">On Windows</a></h3>\n<p>El archivo de la librería <code>widevinecdm.dll</code> estará en el directorio <code>Program Files(x86)/Google/Chrome/Application/VERSIÓN_DE_CHROME/WidevineCdm/_platform_specific/win_(x86|x64)/</code>.</p>\n<h3 id=\"en-macos\"><a href=\"#en-macos\">En macOS</a></h3>\n<p>El archivo de la librería <code>libwidevinecdm.dylib</code> estará en el directorio <code>/Applications/Google Chrome.app/Contents/Versions/VERSIÓN_DE_CHROME/Google Chrome Framework.framework/Versions/A/Libraries/WidevineCdm/_platform_specific/mac_(x86|x64)/</code>.</p>\n<p><strong>Nota:</strong> Asegúrese de que la versión de Chrome utilizada por Electron sea mayor o igual que el valor <code>min_chrome_version</code> del componente Widevine CDM de Chrome. El valor puede ser encontrado en <code>manifest.json</code> en el directorio <code>WidevineCdm</code>.</p>\n<h2 id=\"usando-la-librería\"><a href=\"#usando-la-librería\">Usando la librería</a></h2>\n<p>Después de obtener los archivos de la librería, usted debe pasar la ruta del archivo con el comando <code>--widevine-cdm-path</code> y la versión de la librería con <code>--widevine-cdm-version</code>. Los comandos deben ser pasados antes de que se emita el evento <code>ready</code> del módulo <code>app</code>.</p>\n<p>Código de ejemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Tienes que pasar el directorio que contiene la biblioteca de widevine aquí, es</span>\n<span class=\"hljs-comment\">// * `libwidevinecdm.dylib` en macOS,</span>\n<span class=\"hljs-comment\">// * `widevinecdm.dll` en Windows.</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'widevine-cdm-path'</span>, <span class=\"hljs-string\">'/path/to/widevine_library'</span>)\n<span class=\"hljs-comment\">// La versión del plugin puede ser obtenida desde la pagina `chrome://components` en Chrome.</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'widevine-cdm-version'</span>, <span class=\"hljs-string\">'1.4.8.866'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.show()\n})\n</code></pre>\n<h2 id=\"verificando-la-compatibilidad-de-widevine-cdm\"><a href=\"#verificando-la-compatibilidad-de-widevine-cdm\">Verificando la compatibilidad de Widevine CDM</a></h2>\n<p>Para verificar si Widevine funciona, puede usar los siguientes métodos:</p>\n<ul>\n<li>Abrir <a href=\"https://shaka-player-demo.appspot.com/\">https://shaka-player-demo.appspot.com/</a> y cargar un manifiesto que use <code>Widevine</code>.</li>\n<li>Abrir <a href=\"http://www.dash-player.com/demo/drm-test-area/\">http://www.dash-player.com/demo/drm-test-area/</a>, confirmar que la página diga <code>bitdash usa Widevine en su navegador</code>, luego reproducir el video.</li>\n</ul>",
      "title": "Probando Widevine CDM",
      "description": "Chrome 59 (y superiores) incluyen soporte para Verified Media Path (VMP). VMP  proporciona un método para verificar la autenticidad de una plataforma de dispositivos. Para las implementaciones de navegadores, esto proporcionará una señal adicional para determinar si una implementación basada en navegador es fiable y segura.\nLa guía de integración del proxy ha sido actualizada con información acerca de VMP y como y cómo emitir licencias.\nWidevine recomienda que nuestras integraciones basadas en el navegador (vendedores y aplicaciones basadas en el navegador) añadan soporte para VMP."
    },
    "/docs/api/structures/thumbar-button": {
      "locale": "es-ES",
      "slug": "thumbar-button",
      "href": "/docs/api/structures/thumbar-button",
      "crowdinFileId": "256515",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/thumbar-button.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"thumbarbutton-object\"><a href=\"#thumbarbutton-object\">ThumbarButton Object</a></h1>\n<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - The icon showing in thumbnail toolbar.</li>\n<li><code>click</code> Function</li>\n<li><code>tooltip</code> String (optional) - The text of the button's tooltip.</li>\n<li><code>flags</code> String<a href=\"/docs/api/structures/optional\"></a> - Control specific states and behaviors of the button. By default, it is <code>['enabled']</code>.</li>\n</ul>\n<p>The <code>flags</code> is an array that can include following <code>String</code>s:</p>\n<ul>\n<li><code>enabled</code> - The button is active and available to the user.</li>\n<li><code>disabled</code> - The button is disabled. It is present, but has a visual state indicating it will not respond to user action.</li>\n<li><code>dismissonclick</code> - When the button is clicked, the thumbnail window closes immediately.</li>\n<li><code>nobackground</code> - Do not draw a button border, use only the image.</li>\n<li><code>hidden</code> - The button is not shown to the user.</li>\n<li><code>noninteractive</code> - The button is enabled but not interactive; no pressed button state is drawn. This value is intended for instances where the button is used in a notification.</li>\n</ul>",
      "title": "ThumbarButton Object",
      "description": ""
    },
    "/docs/api/touch-bar": {
      "locale": "es-ES",
      "slug": "touch-bar",
      "href": "/docs/api/touch-bar",
      "crowdinFileId": "256395",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"barra-táctil\"><a href=\"#barra-táctil\">Barra táctil</a></h1>\n<h2 id=\"clase-touchbar\"><a href=\"#clase-touchbar\">Clase: TouchBar</a></h2>\n<blockquote>\n<p>Crea los diseños de la barra táctil para aplicaciones nativas de macOS</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<h3 id=\"new-touchbaroptions\"><a href=\"#new-touchbaroptions\"><code>new TouchBar(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>items</code> (<a href=\"/docs/api/touch-bar-button\">TouchBarButton</a> | <a href=\"/docs/api/touch-bar-color-picker\">TouchBarColorPicker</a> | <a href=\"/docs/api/touch-bar-group\">TouchBarGroup</a> | <a href=\"/docs/api/touch-bar-label\">TouchBarLabel</a> | <a href=\"/docs/api/touch-bar-popover\">TouchBarPopover</a> | <a href=\"/docs/api/touch-bar-scrubber\">TouchBarScrubber</a> | <a href=\"/docs/api/touch-bar-segmented-control\">TouchBarSegmentedControl</a> | <a href=\"/docs/api/touch-bar-slider\">TouchBarSlider</a> | <a href=\"/docs/api/touch-bar-spacer\">TouchBarSpacer</a>)<a href=\"/docs/api/opcional\"></a></li>\n<li><code>escapeItem</code> (<a href=\"/docs/api/touch-bar-button\">TouchBarButton</a> | <a href=\"/docs/api/touch-bar-color-picker\">TouchBarColorPicker</a> | <a href=\"/docs/api/touch-bar-group\">TouchBarGroup</a> | <a href=\"/docs/api/touch-bar-label\">TouchBarLabel</a> | <a href=\"/docs/api/touch-bar-popover\">TouchBarPopover</a> | <a href=\"/docs/api/touch-bar-scrubber\">TouchBarScrubber</a> | <a href=\"/docs/api/touch-bar-segmented-control\">TouchBarSegmentedControl</a> | <a href=\"/docs/api/touch-bar-slider\">TouchBarSlider</a> | <a href=\"/docs/api/touch-bar-spacer\">TouchBarSpacer</a> | null) (opcional)</li>\n</ul></li>\n</ul>\n<p>Crea una nueva barra táctil con los elementos especificados. Use <code>BrowserWindow.setTouchBar</code> para agregar la <code>TouchBar</code> a una ventana.</p>\n<p><strong>Nota:</strong> La API TouchBar API actualmente es experimental y puede cambiar o ser eliminada en futuras versiones de Electron.</p>\n<p><strong>Tip:</strong> If you don't have a MacBook with Touch Bar, you can use <a href=\"https://github.com/sindresorhus/touch-bar-simulator\">Touch Bar Simulator</a> to test Touch Bar usage in your app.</p>\n<h3 id=\"propiedades-estáticas\"><a href=\"#propiedades-estáticas\">Propiedades estáticas</a></h3>\n<h4 id=\"touchbarbutton\"><a href=\"#touchbarbutton\"><code>TouchBarButton</code></a></h4>\n<p>Un <a href=\"/docs/api/touch-bar-button\"><code>typeof TouchBarButton</code></a> referencia a la clase <code>TouchBarButton</code>.</p>\n<h4 id=\"touchbarcolorpicker\"><a href=\"#touchbarcolorpicker\"><code>TouchBarColorPicker</code></a></h4>\n<p>Un <a href=\"/docs/api/touch-bar-color-picker\"><code>typeof TouchBarColorPicker</code></a> referencia a la clase <code>TouchBarColorPicker</code>.</p>\n<h4 id=\"touchbargroup\"><a href=\"#touchbargroup\"><code>TouchBarGroup</code></a></h4>\n<p>Un <a href=\"/docs/api/touch-bar-group\"><code>typeof TouchBarGroup</code></a> referencia a la clase <code>TouchBarGroup</code>.</p>\n<h4 id=\"touchbarlabel\"><a href=\"#touchbarlabel\"><code>TouchBarLabel</code></a></h4>\n<p>Un <a href=\"/docs/api/touch-bar-label\"><code>typeof TouchBarLabel</code></a> referencia a la clase <code>TouchBarLabel</code>.</p>\n<h4 id=\"touchbarpopover\"><a href=\"#touchbarpopover\"><code>TouchBarPopover</code></a></h4>\n<p>Un <a href=\"/docs/api/touch-bar-popover\"><code>typeof TouchBarPopover</code></a> referencia a la clase <code>TouchBarPopover</code>.</p>\n<h4 id=\"touchbarscrubber\"><a href=\"#touchbarscrubber\"><code>TouchBarScrubber</code></a></h4>\n<p>Un <a href=\"/docs/api/touch-bar-scrubber\"><code>typeof TouchBarScrubber</code></a> referencia a la clase <code>TouchBarScrubber</code>.</p>\n<h4 id=\"touchbarsegmentedcontrol\"><a href=\"#touchbarsegmentedcontrol\"><code>TouchBarSegmentedControl</code></a></h4>\n<p>Un <a href=\"/docs/api/touch-bar-segmented-control\"><code>typeof TouchBarSegmentedControl</code></a> referencia a la clase <code>TouchBarSegmentedControl</code>.</p>\n<h4 id=\"touchbarslider\"><a href=\"#touchbarslider\"><code>TouchBarSlider</code></a></h4>\n<p>Un <a href=\"/docs/api/touch-bar-slider\"><code>typeof TouchBarSlider</code></a> referencia a la clase <code>TouchBarSlider</code>.</p>\n<h4 id=\"touchbarspacer\"><a href=\"#touchbarspacer\"><code>TouchBarSpacer</code></a></h4>\n<p>Un <a href=\"/docs/api/touch-bar-spacer\"><code>typeof TouchBarSpacer</code></a> referencia a la clase <code>TouchBarSpacer</code>.</p>\n<h4 id=\"touchbarotheritemsproxy\"><a href=\"#touchbarotheritemsproxy\"><code>TouchBarOtherItemsProxy</code></a></h4>\n<p>Un <a href=\"/docs/api/touch-bar-other-items-proxy\"><code>typeof TouchBarOtherItemsProxy</code></a> referencia a la clase <code>TouchBarOtherItemsProxy</code>.</p>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<p>Las siguientes propiedades están disponibles en instancias de <code>TouchBar</code>:</p>\n<h4 id=\"touchbarescapeitem\"><a href=\"#touchbarescapeitem\"><code>touchBar.escapeItem</code></a></h4>\n<p>Un <code>TouchBarItem</code> que reemplazará el botón \"esc\" en la barra táctil cuando se configure. Establecer a <code>null</code> restaura el botón \"esc\" por defecto. Cambiar este valor actualiza inmediatamente el elemento escape en la barra táctil.</p>\n<h2 id=\"ejemplos\"><a href=\"#ejemplos\">Ejemplos</a></h2>\n<p>A continuación hay un ejemplo de un juego simple de máquina tragaperras con un botón y algunas etiquetas.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, TouchBar } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> { TouchBarLabel, TouchBarButton, TouchBarSpacer } = TouchBar\n\n<span class=\"hljs-keyword\">let</span> spinning = <span class=\"hljs-literal\">false</span>\n\n<span class=\"hljs-comment\">// Reel labels</span>\n<span class=\"hljs-keyword\">const</span> reel1 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n<span class=\"hljs-keyword\">const</span> reel2 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n<span class=\"hljs-keyword\">const</span> reel3 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n\n<span class=\"hljs-comment\">// Spin result label</span>\n<span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n\n<span class=\"hljs-comment\">// Spin button</span>\n<span class=\"hljs-keyword\">const</span> spin = <span class=\"hljs-keyword\">new</span> TouchBarButton({\n  <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'🎰 Spin'</span>,\n  <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#7851A9'</span>,\n  <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// Ignore clicks if already spinning</span>\n    <span class=\"hljs-keyword\">if</span> (spinning) {\n      <span class=\"hljs-keyword\">return</span>\n    }\n\n    spinning = <span class=\"hljs-literal\">true</span>\n    result.label = <span class=\"hljs-string\">''</span>\n\n    <span class=\"hljs-keyword\">let</span> timeout = <span class=\"hljs-number\">10</span>\n    <span class=\"hljs-keyword\">const</span> spinLength = <span class=\"hljs-number\">4</span> * <span class=\"hljs-number\">1000</span> <span class=\"hljs-comment\">// 4 seconds</span>\n    <span class=\"hljs-keyword\">const</span> startTime = <span class=\"hljs-built_in\">Date</span>.now()\n\n    <span class=\"hljs-keyword\">const</span> spinReels = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      updateReels()\n\n      <span class=\"hljs-keyword\">if</span> ((<span class=\"hljs-built_in\">Date</span>.now() - startTime) >= spinLength) {\n        finishSpin()\n      } <span class=\"hljs-keyword\">else</span> {\n        <span class=\"hljs-comment\">// Slow down a bit on each spin</span>\n        timeout *= <span class=\"hljs-number\">1.1</span>\n        setTimeout(spinReels, timeout)\n      }\n    }\n\n    spinReels()\n  }\n})\n\n<span class=\"hljs-keyword\">const</span> getRandomValue = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> values = [<span class=\"hljs-string\">'🍒'</span>, <span class=\"hljs-string\">'💎'</span>, <span class=\"hljs-string\">'7️⃣'</span>, <span class=\"hljs-string\">'🍊'</span>, <span class=\"hljs-string\">'🔔'</span>, <span class=\"hljs-string\">'⭐'</span>, <span class=\"hljs-string\">'🍇'</span>, <span class=\"hljs-string\">'🍀'</span>]\n  <span class=\"hljs-keyword\">return</span> values[<span class=\"hljs-built_in\">Math</span>.floor(<span class=\"hljs-built_in\">Math</span>.random() * values.length)]\n}\n\n<span class=\"hljs-keyword\">const</span> updateReels = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  reel1.label = getRandomValue()\n  reel2.label = getRandomValue()\n  reel3.label = getRandomValue()\n}\n\n<span class=\"hljs-keyword\">const</span> finishSpin = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> uniqueValues = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Set</span>([reel1.label, reel2.label, reel3.label]).size\n  <span class=\"hljs-keyword\">if</span> (uniqueValues === <span class=\"hljs-number\">1</span>) {\n    <span class=\"hljs-comment\">// All 3 values are the same</span>\n    result.label = <span class=\"hljs-string\">'💰 Jackpot!'</span>\n    result.textColor = <span class=\"hljs-string\">'#FDFF00'</span>\n  } <span class=\"hljs-keyword\">else</span> <span class=\"hljs-keyword\">if</span> (uniqueValues === <span class=\"hljs-number\">2</span>) {\n    <span class=\"hljs-comment\">// 2 values are the same</span>\n    result.label = <span class=\"hljs-string\">'😍 Winner!'</span>\n    result.textColor = <span class=\"hljs-string\">'#FDFF00'</span>\n  } <span class=\"hljs-keyword\">else</span> {\n    <span class=\"hljs-comment\">// No values are the same</span>\n    result.label = <span class=\"hljs-string\">'🙁 Spin Again'</span>\n    result.textColor = <span class=\"hljs-literal\">null</span>\n  }\n  spinning = <span class=\"hljs-literal\">false</span>\n}\n\n<span class=\"hljs-keyword\">const</span> touchBar = <span class=\"hljs-keyword\">new</span> TouchBar({\n  <span class=\"hljs-attr\">items</span>: [\n    spin,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'large'</span> }),\n    reel1,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'small'</span> }),\n    reel2,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'small'</span> }),\n    reel3,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'large'</span> }),\n    result\n  ]\n})\n\n<span class=\"hljs-keyword\">let</span> <span class=\"hljs-built_in\">window</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-built_in\">window</span> = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span>,\n    <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span>,\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#000'</span>\n  })\n  <span class=\"hljs-built_in\">window</span>.loadURL(<span class=\"hljs-string\">'about:blank'</span>)\n  <span class=\"hljs-built_in\">window</span>.setTouchBar(touchBar)\n})\n</code></pre>\n<h3 id=\"ejecutar-el-ejemplo-anterior\"><a href=\"#ejecutar-el-ejemplo-anterior\">Ejecutar el ejemplo anterior</a></h3>\n<p>Para ejecutar el ejemplo anterior, se necesita (asumiendo que la terminal está abierta en el directorio en donde se desea ejecutar el ejemplo):</p>\n<ol>\n<li>Guardar el archivo anterior en la computadora como <code>touchbar.js</code></li>\n<li>Instalar Electron a través de <code>npm install electron</code></li>\n<li>Ejecutar el ejemplo dentro de Electron: <code>./node_modules/.bin/electron touchbar.js</code></li>\n</ol>\n<p>Entonces aparecerá una nueva ventana de Electron y la aplicación se ejecutará en la barra táctil (o en el emulador de la barra táctil).</p>",
      "title": "Barra táctil",
      "description": "Crea los diseños de la barra táctil para aplicaciones nativas de macOS"
    },
    "/docs/api/touch-bar-button": {
      "locale": "es-ES",
      "slug": "touch-bar-button",
      "href": "/docs/api/touch-bar-button",
      "crowdinFileId": "256375",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-button.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-touchbarbutton\"><a href=\"#clase-touchbarbutton\">Clase: TouchBarButton</a></h2>\n<blockquote>\n<p>Crea un botón en la barra táctil para aplicaciones macOS nativas</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarbuttonoptions\"><a href=\"#new-touchbarbuttonoptions\"><code>new TouchBarButton(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>Etiqueta</code> cadena (opcional) - Texto del fondo.</li>\n<li><code>accessibilityLabel</code> String (opcional) - Una breve descripción del botón para su uso por lectores de pantalla como VoiceOver.</li>\n<li><code>Color del fondo</code> Cadena (opcional) - Color del fondo en formato hex, ejemplo: <code>#ABCDEF</code>.</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String (opcional) - Icono del botón.</li>\n<li><code>posición del ícono</code> Cadena (opcional) - Puede ser <code>izquierda</code>, <code>derecha</code> o <code>superpuesto</code>. Por defecto es <code>overlay</code>.</li>\n<li><code>click</code> Función (opcional) - Función a llamar cuando se hace click en el fondo.</li>\n<li><code>enabled</code> Boolean (optional) - Whether the button is in an enabled state.  Por defecto es <code>true</code>.</li>\n</ul></li>\n</ul>\n<p>Al definir <code>accessibilityLabel</code>, asegúrese de que ha considerado las <a href=\"https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc\">mejores prácticas</a> de macOS.</p>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<p>Las siguientes propiedades están disponibles en las instancias de <code>TouchBarButton</code>:</p>\n<h4 id=\"touchbarbuttonaccessibilitylabel\"><a href=\"#touchbarbuttonaccessibilitylabel\"><code>touchBarButton.accessibilityLabel</code></a></h4>\n<p>A <code>String</code> representing the description of the button to be read by a screen reader. Will only be read by screen readers if no label is set.</p>\n<h4 id=\"touchbarbuttonlabel\"><a href=\"#touchbarbuttonlabel\"><code>touchBarButton.label</code></a></h4>\n<p>A <code>String</code> representing the button's current text. Changing this value immediately updates the button in the touch bar.</p>\n<h4 id=\"touchbarbuttonbackgroundcolor\"><a href=\"#touchbarbuttonbackgroundcolor\"><code>touchBarButton.backgroundColor</code></a></h4>\n<p>A <code>String</code> hex code representing the button's current background color. Changing this value immediately updates the button in the touch bar.</p>\n<h4 id=\"touchbarbuttonicon\"><a href=\"#touchbarbuttonicon\"><code>touchBarButton.icon</code></a></h4>\n<p>Un <code>NativeImage</code> que representa el icono del botón actual. Changing this value immediately updates the button in the touch bar.</p>\n<h4 id=\"touchbarbuttoniconposition\"><a href=\"#touchbarbuttoniconposition\"><code>touchBarButton.iconPosition</code></a></h4>\n<p>A <code>String</code> - Can be <code>left</code>, <code>right</code> or <code>overlay</code>.  Por defecto es <code>overlay</code>.</p>\n<h4 id=\"touchbarbuttonenabled\"><a href=\"#touchbarbuttonenabled\"><code>touchBarButton.enabled</code></a></h4>\n<p>A <code>Boolean</code> representing whether the button is in an enabled state.</p>",
      "title": "Clase: TouchBarButton",
      "description": "Crea un botón en la barra táctil para aplicaciones macOS nativas"
    },
    "/docs/api/touch-bar-color-picker": {
      "locale": "es-ES",
      "slug": "touch-bar-color-picker",
      "href": "/docs/api/touch-bar-color-picker",
      "crowdinFileId": "256377",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-color-picker.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-seleccionador-de-color-de-la-barra-táctil\"><a href=\"#clase-seleccionador-de-color-de-la-barra-táctil\">Clase: Seleccionador de color de la barra táctil</a></h2>\n<blockquote>\n<p>Crea un seleccionador de color en la barra táctil para aplicaciones nativas de macOS</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarcolorpickeroptions\"><a href=\"#new-touchbarcolorpickeroptions\"><code>new TouchBarColorPicker(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>Colores disponibles</code> Cadena<a href=\"/docs/api/opcional\"></a> - arreglo de códigos hexadecimales de los colores a aparecer como colores posibles a seleccionar.</li>\n<li><code>Color seleccionado</code> Cadena (opcional) - El código de color hexadecimal en el seleccionador, ejemplo <code>#ABCDEF</code>.</li>\n<li><code>change</code> Function (optional) - Function to call when a color is selected.<ul>\n<li><code>color</code> Cadena - El color que el usuario seleccionó de entre las opciones.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<p>Las siguientes propiedades están disponibles en instancias de <code>Seleccionador de color de la barra táctil</code>:</p>\n<h4 id=\"touchbarcolorpickeravailablecolors\"><a href=\"#touchbarcolorpickeravailablecolors\"><code>touchBarColorPicker.availableColors</code></a></h4>\n<p>Un <code>String[]</code> array que representa los colores disponibles del selector de color para seleccionar. Changing this value immediately updates the color picker in the touch bar.</p>\n<h4 id=\"touchbarcolorpickerselectedcolor\"><a href=\"#touchbarcolorpickerselectedcolor\"><code>touchBarColorPicker.selectedColor</code></a></h4>\n<p>A <code>String</code> hex code representing the color picker's currently selected color. Changing this value immediately updates the color picker in the touch bar.</p>",
      "title": "Clase: Seleccionador de color de la barra táctil",
      "description": "Crea un seleccionador de color en la barra táctil para aplicaciones nativas de macOS"
    },
    "/docs/api/touch-bar-group": {
      "locale": "es-ES",
      "slug": "touch-bar-group",
      "href": "/docs/api/touch-bar-group",
      "crowdinFileId": "256379",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-group.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-touchbargroup\"><a href=\"#clase-touchbargroup\">Clase: TouchBarGroup</a></h2>\n<blockquote>\n<p>Crea un grupo en la barra táctil para aplicaciones nativas de macOS</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbargroupoptions\"><a href=\"#new-touchbargroupoptions\"><code>new TouchBarGroup(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>items</code> <a href=\"/docs/api/touch-bar\">TouchBar</a> - Los elementos que se muestran como un grupo.</li>\n</ul></li>\n</ul>",
      "title": "Clase: TouchBarGroup",
      "description": "Crea un grupo en la barra táctil para aplicaciones nativas de macOS"
    },
    "/docs/api/touch-bar-label": {
      "locale": "es-ES",
      "slug": "touch-bar-label",
      "href": "/docs/api/touch-bar-label",
      "crowdinFileId": "256381",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-label.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-touchbarlabel\"><a href=\"#clase-touchbarlabel\">Clase: TouchBarLabel</a></h2>\n<blockquote>\n<p>Crea una etiqueta en la barra táctil para aplicaciones nativas a macOS</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarlabeloptions\"><a href=\"#new-touchbarlabeloptions\"><code>new TouchBarLabel(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>etiqueta</code> Cadena (opcional) - texto a mostrar.</li>\n<li><code>accessibilityLabel</code> String (opcional) - Una breve descripción del botón para su uso por lectores de pantalla como VoiceOver.</li>\n<li><code>Color del texto</code> cadena (opcional) - color del texto en hex, ejemplo <code>#ABCDEF</code>.</li>\n</ul></li>\n</ul>\n<p>Al definir <code>accessibilityLabel</code>, asegúrese de que ha considerado las <a href=\"https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc\">mejores prácticas</a> de macOS.</p>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<p>Las siguientes propiedades están disponibles en instancias de <code>etiqueta de barra táctil</code>:</p>\n<h4 id=\"touchbarlabellabel\"><a href=\"#touchbarlabellabel\"><code>touchBarLabel.label</code></a></h4>\n<p>Un <code>String</code> que representa el texto actual de la etiqueta. Changing this value immediately updates the label in the touch bar.</p>\n<h4 id=\"touchbarlabelaccessibilitylabel\"><a href=\"#touchbarlabelaccessibilitylabel\"><code>touchBarLabel.accessibilityLabel</code></a></h4>\n<p>Un <code>String</code> que representa la descripción de la etiqueta a ser leído por un lector de pantalla.</p>\n<h4 id=\"touchbarlabeltextcolor\"><a href=\"#touchbarlabeltextcolor\"><code>touchBarLabel.textColor</code></a></h4>\n<p>A <code>String</code> hex code representing the label's current text color. Changing this value immediately updates the label in the touch bar.</p>",
      "title": "Clase: TouchBarLabel",
      "description": "Crea una etiqueta en la barra táctil para aplicaciones nativas a macOS"
    },
    "/docs/api/touch-bar-other-items-proxy": {
      "locale": "es-ES",
      "slug": "touch-bar-other-items-proxy",
      "href": "/docs/api/touch-bar-other-items-proxy",
      "crowdinFileId": "256383",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-other-items-proxy.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-touchbarotheritemsproxy\"><a href=\"#clase-touchbarotheritemsproxy\">Clase: TouchBarOtherItemsProxy</a></h2>\n<blockquote>\n<p>Instantiates a special \"other items proxy\", which nests TouchBar elements inherited from Chromium at the space indicated by the proxy. By default, this proxy is added to each TouchBar at the end of the input. For more information, see the AppKit docs on <a href=\"https://developer.apple.com/documentation/appkit/nstouchbaritemidentifierotheritemsproxy\">NSTouchBarItemIdentifierOtherItemsProxy</a></p>\n<p>Nota: Sólo una instancia de esta clase puede ser agregada por TouchBar.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarotheritemsproxy\"><a href=\"#new-touchbarotheritemsproxy\"><code>new TouchBarOtherItemsProxy()</code></a></h3>",
      "title": "Clase: TouchBarOtherItemsProxy",
      "description": "Instantiates a special \"other items proxy\", which nests TouchBar elements inherited from Chromium at the space indicated by the proxy. By default, this proxy is added to each TouchBar at the end of the input. For more information, see the AppKit docs on NSTouchBarItemIdentifierOtherItemsProxy\nNota: Sólo una instancia de esta clase puede ser agregada por TouchBar."
    },
    "/docs/api/touch-bar-popover": {
      "locale": "es-ES",
      "slug": "touch-bar-popover",
      "href": "/docs/api/touch-bar-popover",
      "crowdinFileId": "256385",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-popover.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-touchbarpopover\"><a href=\"#clase-touchbarpopover\">Clase: TouchBarPopover</a></h2>\n<blockquote>\n<p>Crea una notificación en la barra táctil para aplicaciones nativas macOS</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarpopoveroptions\"><a href=\"#new-touchbarpopoveroptions\"><code>new TouchBarPopover(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>Etiqueta</code> Cadena (opcional) - tecto del botón en la notificación.</li>\n<li><code>ícono</code> <a href=\"/docs/api/native-image\">imagen nativa</a> (opcional) - ícono del botón de la notificación.</li>\n<li><code>items</code> <a href=\"/docs/api/touch-bar\">TouchBar</a> - Elementos a mostrar en el popover.</li>\n<li><code>showCloseButton</code> Boolean (opcional) - <code>true</code> para mostrar un botón cerrar en la izquierda de notificación, <code>false</code> para no mostrar. Por defecto es <code>true</code>.</li>\n</ul></li>\n</ul>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<p>Las siguiente propiedades están disponibles en instancias de <code>notificaciones de la barra táctil</code>:</p>\n<h4 id=\"touchbarpopoverlabel\"><a href=\"#touchbarpopoverlabel\"><code>touchBarPopover.label</code></a></h4>\n<p>Un <code>String</code> que representa el texto del botón actual de la ventana emergente. Changing this value immediately updates the popover in the touch bar.</p>\n<h4 id=\"touchbarpopovericon\"><a href=\"#touchbarpopovericon\"><code>touchBarPopover.icon</code></a></h4>\n<p>Un <code>NativeImage</code> que representa el icono del botón actual de la notificación. Changing this value immediately updates the popover in the touch bar.</p>",
      "title": "Clase: TouchBarPopover",
      "description": "Crea una notificación en la barra táctil para aplicaciones nativas macOS"
    },
    "/docs/api/touch-bar-scrubber": {
      "locale": "es-ES",
      "slug": "touch-bar-scrubber",
      "href": "/docs/api/touch-bar-scrubber",
      "crowdinFileId": "256387",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-scrubber.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-touchbarscrubber\"><a href=\"#clase-touchbarscrubber\">Clase: TouchBarScrubber</a></h2>\n<blockquote>\n<p>Crear un depurador (un selector de desplazamiento)</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarscrubberoptions\"><a href=\"#new-touchbarscrubberoptions\"><code>new TouchBarScrubber(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>elementos</code> <a href=\"/docs/api/structures/scrubber-item\">elemento a depurar[]</a> - Un arreglo de elementos a depurar.</li>\n<li><code>select</code> Function (optional) - Called when the user taps an item that was not the last tapped item.<ul>\n<li><code>seleccionar índice</code> Entero - El índice del elemento que el usuario seleccionó.</li>\n</ul></li>\n<li><code>highlight</code> Function (optional) - Called when the user taps any item.<ul>\n<li><code>índice destacado</code> Entero - El índice del elemento que el usuario tocó.</li>\n</ul></li>\n<li><code>selectedStyle</code> String (opcional) - Estilo de elemento seleccionado. Puede ser <code>background</code>, <code>outline</code> o <code>none</code>. Por defecto es <code>none</code>.</li>\n<li><code>overlayStyle</code> String (opcional) - Estilo de elemento de superposición seleccionado. Puede ser <code>background</code>, <code>outline</code> o <code>none</code>. Por defecto es <code>none</code>.</li>\n<li><code>showArrowButtons</code> Boolean (optional) - Whether to show arrow buttons. Defaults to <code>false</code> and is only shown if <code>items</code> is non-empty.</li>\n<li><code>mode</code> String (opcional) - Puede ser <code>fixed</code> o <code>free</code>. Por defecto es <code>free</code>.</li>\n<li><code>continuous</code> Boolean (opcional) - Por defecto a <code>true</code>.</li>\n</ul></li>\n</ul>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<p>Las siguientes propiedades está disponibles en instancias del <code>depurador de barra tactil</code>:</p>\n<h4 id=\"touchbarscrubberitems\"><a href=\"#touchbarscrubberitems\"><code>touchBarScrubber.items</code></a></h4>\n<p>Un array de <code>ScrubberItem[]</code> representando los elementos en este depurador. Actualiza este valor inmediatamente actualiza el control de la barra táctil. Mientras se actualicen las propiedades profundas dentro de este arreglo <strong>no se actualiza la barra táctil</strong>.</p>\n<h4 id=\"touchbarscrubberselectedstyle\"><a href=\"#touchbarscrubberselectedstyle\"><code>touchBarScrubber.selectedStyle</code></a></h4>\n<p>Una <code>Cadena</code> que representa el estilo que deben tener los elementos seleccionados por el depurador. Actualiza este valor inmediatamente actualiza el control de la barra táctil. Posibles valores:</p>\n<ul>\n<li><code>background</code> - Mapa a <code>[NSScrubberSelectionStyle roundedBackgroundStyle]</code>.</li>\n<li><code>outline</code> - Mapa a <code>[NSScrubberSelectionStyle outlineOverlayStyle]</code>.</li>\n<li><code>none</code> - Elimina todos los estilos.</li>\n</ul>\n<h4 id=\"touchbarscrubberoverlaystyle\"><a href=\"#touchbarscrubberoverlaystyle\"><code>touchBarScrubber.overlayStyle</code></a></h4>\n<p>Una <code>Cadena</code> que representa el estilo que deben tener los elementos seleccionados por el depurador. Este estilo es cubierto en la parte superior del elemento depurador en vez de posicionarse detrás de él. Actualizar este valor inmediatamente actualiza el control en la barra de herramientas. Posibles valores:</p>\n<ul>\n<li><code>background</code> - Mapa a <code>[NSScrubberSelectionStyle roundedBackgroundStyle]</code>.</li>\n<li><code>outline</code> - Mapa a <code>[NSScrubberSelectionStyle outlineOverlayStyle]</code>.</li>\n<li><code>none</code> - Elimina todos los estilos.</li>\n</ul>\n<h4 id=\"touchbarscrubbershowarrowbuttons\"><a href=\"#touchbarscrubbershowarrowbuttons\"><code>touchBarScrubber.showArrowButtons</code></a></h4>\n<p>A <code>Boolean</code> representing whether to show the left / right selection arrows in this scrubber. Actualizar este valor inmediatamente actualiza el control en el touch bar.</p>\n<h4 id=\"touchbarscrubbermode\"><a href=\"#touchbarscrubbermode\"><code>touchBarScrubber.mode</code></a></h4>\n<p>Un <code>String</code> que representa el modo de este depurador. Actualiza este valor inmediatamente actualiza el control de la barra táctil. Posibles valores:</p>\n<ul>\n<li><code>fijo</code> - Mapa a <code>NSScrubberModeFixed</code>.</li>\n<li><code>libre</code> - Mapa a <code>NSScrubberModeFree</code>.</li>\n</ul>\n<h4 id=\"touchbarscrubbercontinuous\"><a href=\"#touchbarscrubbercontinuous\"><code>touchBarScrubber.continuous</code></a></h4>\n<p>Un <code>Boolean</code> que representa si este depurador es continuo o no. Actualiza este valor inmediatamente actualiza el control de la barra táctil.</p>",
      "title": "Clase: TouchBarScrubber",
      "description": "Crear un depurador (un selector de desplazamiento)"
    },
    "/docs/api/touch-bar-segmented-control": {
      "locale": "es-ES",
      "slug": "touch-bar-segmented-control",
      "href": "/docs/api/touch-bar-segmented-control",
      "crowdinFileId": "256389",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-segmented-control.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-touchbarsegmentedcontrol\"><a href=\"#clase-touchbarsegmentedcontrol\">Clase: TouchBarSegmentedControl</a></h2>\n<blockquote>\n<p>Crea un control segmentado (un conjunto de botones) donde un botón tiene un estado seleccionado</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarsegmentedcontroloptions\"><a href=\"#new-touchbarsegmentedcontroloptions\"><code>new TouchBarSegmentedControl(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>segmentStyle</code> String (opcional) - Estilo de los segmentos:<ul>\n<li><code>automatic</code> - Predeterminado. La apariencia del control segmentado es determinada de forma automática basados en el tipo de ventana en el cual el control es mostrado y la posición dentro de la ventana. Se mapea a <code>NSSegmentStyleAutomatic</code>.</li>\n<li><code>rounded</code> - El control se muestra utilizando el estilo redondeado. Mapea a <code>NSSegmentStyleRounded</code>.</li>\n<li><code>textured-rounded</code> - El control se muestra utilizando el estilo de textura redondeado. Mapea a <code>NSSegmentStyleTexturedRounded</code>.</li>\n<li><code>round-rect</code> - Los controles se muestran utilizando el estilo rectángulo redondeado. Mapea a <code>NSSegmentStyleRoundRect</code>.</li>\n<li><code>textured-square</code> - El control se muestra utilizando el estilo de textura cuadrado. Mapea a <code>NSSegmentStyleTexturedSquare</code>.</li>\n<li><code>capsule</code> - El control se muestra utilizando el estilo de cápsula. Mapea a <code>NSSegmentStyleCapsule</code>.</li>\n<li><code>small-square</code> - El control se muestra utilizando el estilo de cuadrado pequeño. Mapea a <code>NSSegmentStyleSmallSquare</code>.</li>\n<li><code>separated</code> - Los segmentos en el control se muestran muy cerca del otro pero sin llegar a tocarse. Mapea a <code>NSSegmentStyleSeparated</code>.</li>\n</ul></li>\n<li><code>mode</code> String (opcional) - El modo de selección del control:<ul>\n<li><code>single</code> - Predeterminado. Un elemento seleccionado a la vez, seleccionando uno deselecciona el elemento seleccionado anteriormente. Mapea a <code>NSSegmentSwitchTrackingSelectOne</code>.</li>\n<li><code>multiple</code> - Elementos múltiples pueden ser seleccionados a la vez. Mapea a <code>NSSegmentSwitchTrackingSelectAny</code>.</li>\n<li><code>buttons</code> - Hace que los segmentos actúen como botones. Cada segmento puede ser presionado y liberado pero nunca ser marcado como activo. Mapea a <code>NSSegmentSwitchTrackingMomentary</code>.</li>\n</ul></li>\n<li><code>segments</code> <a href=\"/docs/api/structures/segmented-control-segment\">SegmentedControlSegment[]</a> - Un arreglo de elementos para colocar en este control.</li>\n<li><code>selectedIndex</code> Integer (opcional) - El índice del segmento actual seleccionado, se actualizará automáticamente con la interacción del usuario. Cuando el modo es <code>multiple</code> será el último elemento seleccionado.</li>\n<li><code>change</code> Function (optional) - Called when the user selects a new segment.<ul>\n<li><code>selectedIndex</code> Integer - El índice del elemento seleccionado por el usuario.</li>\n<li><code>isSelected</code> Boolean - Si el elemento es seleccionado o no como resultado de la selección del usuario.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<p>Las siguientes propiedades están disponibles en instancias de <code>TouchBarSegmentedControl</code>:</p>\n<h4 id=\"touchbarsegmentedcontrolsegmentstyle\"><a href=\"#touchbarsegmentedcontrolsegmentstyle\"><code>touchBarSegmentedControl.segmentStyle</code></a></h4>\n<p>Un <code>String</code> que representa el estilo del segmento actual de los controles. Actualizar este valor inmediatamente actualiza el control en la barra de herramientas.</p>\n<h4 id=\"touchbarsegmentedcontrolsegments\"><a href=\"#touchbarsegmentedcontrolsegments\"><code>touchBarSegmentedControl.segments</code></a></h4>\n<p>Un arreglo <code>SegmentedControlSegment[]</code> que representa los segmentos en este control. Actualiza este valor inmediatamente actualiza el control de la barra táctil. Mientras se actualicen las propiedades profundas dentro de este arreglo <strong>no se actualiza la barra táctil</strong>.</p>\n<h4 id=\"touchbarsegmentedcontrolselectedindex\"><a href=\"#touchbarsegmentedcontrolselectedindex\"><code>touchBarSegmentedControl.selectedIndex</code></a></h4>\n<p>Un <code>entero</code> que representa el segmento seleccionado actual. Cambiar este valor actualiza inmediatamente el control en la barra táctil. La interacción del usuario con la barra táctil actualizará este valor automáticamente.</p>\n<h4 id=\"touchbarsegmentedcontrolmode\"><a href=\"#touchbarsegmentedcontrolmode\"><code>touchBarSegmentedControl.mode</code></a></h4>\n<p>A <code>String</code> representing the current selection mode of the control.  Puede ser <code>single</code>, <code>multiple</code> o <code>buttons</code>.</p>",
      "title": "Clase: TouchBarSegmentedControl",
      "description": "Crea un control segmentado (un conjunto de botones) donde un botón tiene un estado seleccionado"
    },
    "/docs/api/touch-bar-slider": {
      "locale": "es-ES",
      "slug": "touch-bar-slider",
      "href": "/docs/api/touch-bar-slider",
      "crowdinFileId": "256391",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-slider.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-touchbarslider\"><a href=\"#clase-touchbarslider\">Clase: TouchBarSlider</a></h2>\n<blockquote>\n<p>Crea un control deslizante en la barra táctil para aplicaciones nativas de macOS</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarslideroptions\"><a href=\"#new-touchbarslideroptions\"><code>new TouchBarSlider(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>label</code> String (opcional) - Texto de etiqueta.</li>\n<li><code>value</code> Integer (opcional) - Valor seleccionado.</li>\n<li><code>minValue</code> Integer (opcional) - Valor mínimo.</li>\n<li><code>maxValue</code> Integer (opcional) - Valor máximo.</li>\n<li><code>change</code> Function (optional) - Function to call when the slider is changed.<ul>\n<li><code>newValue</code> Number - El valor que el usuario seleccionó en el control deslizante.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<p>Las siguientes propiedades está disponibles en instancias de <code>TouchBarSlider</code>:</p>\n<h4 id=\"touchbarsliderlabel\"><a href=\"#touchbarsliderlabel\"><code>touchBarSlider.label</code></a></h4>\n<p>Un <code>String</code> que representa el texto actual del deslizador. Changing this value immediately updates the slider in the touch bar.</p>\n<h4 id=\"touchbarslidervalue\"><a href=\"#touchbarslidervalue\"><code>touchBarSlider.value</code></a></h4>\n<p>Un <code>Number</code> que representa el valor actual del deslizador. Changing this value immediately updates the slider in the touch bar.</p>\n<h4 id=\"touchbarsliderminvalue\"><a href=\"#touchbarsliderminvalue\"><code>touchBarSlider.minValue</code></a></h4>\n<p>Un <code>Number</code> que representa el valor mínimo actual del deslizador. Cambiar este valor inmediatamente actualiza el deslizador en el touch bar.</p>\n<h4 id=\"touchbarslidermaxvalue\"><a href=\"#touchbarslidermaxvalue\"><code>touchBarSlider.maxValue</code></a></h4>\n<p>Un <code>Number</code> que representa el valor máximo actual del deslizador. Cambiar este valor inmediatamente actualiza el deslizador en el touch bar.</p>",
      "title": "Clase: TouchBarSlider",
      "description": "Crea un control deslizante en la barra táctil para aplicaciones nativas de macOS"
    },
    "/docs/api/touch-bar-spacer": {
      "locale": "es-ES",
      "slug": "touch-bar-spacer",
      "href": "/docs/api/touch-bar-spacer",
      "crowdinFileId": "256393",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-spacer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-touchbarspacer\"><a href=\"#clase-touchbarspacer\">Clase: TouchBarSpacer</a></h2>\n<blockquote>\n<p>Crea un espaciador entre dos elementos en la barra táctil para aplicaciones nativas de macOS</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarspaceroptions\"><a href=\"#new-touchbarspaceroptions\"><code>new TouchBarSpacer(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>size</code> String (optional) - Size of spacer, possible values are:<ul>\n<li><code>small</code> - Espacio pequeño entre los elementos. Mapea a <code>NSTouchBarItemIdentifierFixedSpaceSmall</code>. Este es el valor predeterminado.</li>\n<li><code>large</code> - Espacio grande entre los elementos. Mapea a <code>NSTouchBarItemIdentifierFixedSpaceLarge</code>.</li>\n<li><code>flexible</code> - Ocupa todo el espacio disponible. Mapea a <code>NSTouchBarItemIdentifierFlexibleSpace</code>.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<p>Las siguientes propiedades están disponibles en las instancias de <code>TouchBarSpacer</code>:</p>\n<h4 id=\"touchbarspacersize\"><a href=\"#touchbarspacersize\"><code>touchBarSpacer.size</code></a></h4>\n<p>A <code>String</code> representing the size of the spacer.  Puede ser <code>small</code>, <code>large</code> o <code>flexible</code>.</p>",
      "title": "Clase: TouchBarSpacer",
      "description": "Crea un espaciador entre dos elementos en la barra táctil para aplicaciones nativas de macOS"
    },
    "/docs/api/structures/trace-categories-and-options": {
      "locale": "es-ES",
      "slug": "trace-categories-and-options",
      "href": "/docs/api/structures/trace-categories-and-options",
      "crowdinFileId": "256517",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/trace-categories-and-options.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"tracecategoriesandoptions-object\"><a href=\"#tracecategoriesandoptions-object\">TraceCategoriesAndOptions Object</a></h1>\n<ul>\n<li><code>categoryFilter</code> String - A filter to control what category groups should be traced. A filter can have an optional '-' prefix to exclude category groups that contain a matching category. Having both included and excluded category patterns in the same list is not supported. Examples: <code>test_MyTest*</code>, <code>test_MyTest*,test_OtherStuff</code>, <code>-excluded_category1,-excluded_category2</code>.</li>\n<li><code>traceOptions</code> String - Controls what kind of tracing is enabled, it is a comma-delimited sequence of the following strings: <code>record-until-full</code>, <code>record-continuously</code>, <code>trace-to-console</code>, <code>enable-sampling</code>, <code>enable-systrace</code>, e.g. <code>'record-until-full,enable-sampling'</code>. The first 3 options are trace recording modes and hence mutually exclusive. If more than one trace recording modes appear in the <code>traceOptions</code> string, the last one takes precedence. If none of the trace recording modes are specified, recording mode is <code>record-until-full</code>. The trace option will first be reset to the default option (<code>record_mode</code> set to <code>record-until-full</code>, <code>enable_sampling</code> and <code>enable_systrace</code> set to <code>false</code>) before options parsed from <code>traceOptions</code> are applied on it.</li>\n</ul>",
      "title": "TraceCategoriesAndOptions Object",
      "description": ""
    },
    "/docs/api/structures/trace-config": {
      "locale": "es-ES",
      "slug": "trace-config",
      "href": "/docs/api/structures/trace-config",
      "crowdinFileId": "256519",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/trace-config.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"traceconfig-object\"><a href=\"#traceconfig-object\">TraceConfig Object</a></h1>\n<ul>\n<li><code>recording_mode</code> String (optional) - Can be <code>record-until-full</code>, <code>record-continuously</code>, <code>record-as-much-as-possible</code> or <code>trace-to-console</code>. Defaults to <code>record-until-full</code>.</li>\n<li><code>trace_buffer_size_in_kb</code> number (optional) - maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.</li>\n<li><code>trace_buffer_size_in_events</code> number (optional) - maximum size of the trace recording buffer in events.</li>\n<li><code>enable_argument_filter</code> boolean (optional) - if true, filter event data according to a specific list of events that have been manually vetted to not include any PII. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/services/tracing/public/cpp/trace_event_args_whitelist.cc\">the implementation in Chromium</a> for specifics.</li>\n<li><code>included_categories</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of tracing categories to include. Can include glob-like patterns using <code>*</code> at the end of the category name. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">tracing categories</a> for the list of categories.</li>\n<li><code>excluded_categories</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of tracing categories to exclude. Can include glob-like patterns using <code>*</code> at the end of the category name. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">tracing categories</a> for the list of categories.</li>\n<li><code>included_process_ids</code> number<a href=\"/docs/api/structures/optional\"></a> - a list of process IDs to include in the trace. If not specified, trace all processes.</li>\n<li><code>histogram_names</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of <a href=\"https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md\">histogram</a> names to report with the trace.</li>\n<li><code>memory_dump_config</code> Record&#x3C;String, any> (optional) - if the <code>disabled-by-default-memory-infra</code> category is enabled, this contains optional additional configuration for data collection. See the <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/memory-infra/memory_infra_startup_tracing.md#the-advanced-way\">Chromium memory-infra docs</a> for more information.</li>\n</ul>\n<p>An example TraceConfig that roughly matches what Chrome DevTools records:</p>\n<pre><code class=\"hljs language-js\">{\n  <span class=\"hljs-attr\">recording_mode</span>: <span class=\"hljs-string\">'record-until-full'</span>,\n  <span class=\"hljs-attr\">included_categories</span>: [\n    <span class=\"hljs-string\">'devtools.timeline'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline.frame'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline.stack'</span>,\n    <span class=\"hljs-string\">'v8.execute'</span>,\n    <span class=\"hljs-string\">'blink.console'</span>,\n    <span class=\"hljs-string\">'blink.user_timing'</span>,\n    <span class=\"hljs-string\">'latencyInfo'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-v8.cpu_profiler'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-v8.cpu_profiler.hires'</span>\n  ],\n  <span class=\"hljs-attr\">excluded_categories</span>: [<span class=\"hljs-string\">'*'</span>]\n}\n</code></pre>",
      "title": "TraceConfig Object",
      "description": ""
    },
    "/docs/api/structures/transaction": {
      "locale": "es-ES",
      "slug": "transaction",
      "href": "/docs/api/structures/transaction",
      "crowdinFileId": "256521",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/transaction.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"transaction-object\"><a href=\"#transaction-object\">Transaction Object</a></h1>\n<ul>\n<li><code>transactionIdentifier</code> String - A string that uniquely identifies a successful payment transaction.</li>\n<li><code>transactionDate</code> String - The date the transaction was added to the App Store’s payment queue.</li>\n<li><code>originalTransactionIdentifier</code> String - The identifier of the restored transaction by the App Store.</li>\n<li><code>transactionState</code> String - The transaction state, can be <code>purchasing</code>, <code>purchased</code>, <code>failed</code>, <code>restored</code> or <code>deferred</code>.</li>\n<li><code>errorCode</code> Integer - The error code if an error occurred while processing the transaction.</li>\n<li><code>errorMessage</code> String - The error message if an error occurred while processing the transaction.</li>\n<li><code>payment</code> Object<ul>\n<li><code>productIdentifier</code> String - The identifier of the purchased product.</li>\n<li><code>quantity</code> Integer  - The quantity purchased.</li>\n</ul></li>\n</ul>",
      "title": "Transaction Object",
      "description": ""
    },
    "/docs/api/tray": {
      "locale": "es-ES",
      "slug": "tray",
      "href": "/docs/api/tray",
      "crowdinFileId": "256397",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/tray.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"tray\"><a href=\"#tray\">Tray</a></h1>\n<h2 id=\"clase-tray\"><a href=\"#clase-tray\">Clase: Tray</a></h2>\n<blockquote>\n<p>Añadir los iconos y menús contextuales al área de notificación del sistema.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p><code>Tray</code> es un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> tray = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/my/icon'</span>)\n  <span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item3'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item4'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n  ])\n  tray.setToolTip(<span class=\"hljs-string\">'This is my application.'</span>)\n  tray.setContextMenu(contextMenu)\n})\n</code></pre>\n<p><strong>Limitaciones de la plataforma:</strong></p>\n<ul>\n<li>En Linux se utilizará el indicador de aplicación si es compatible, de lo contrario <code>GtkStatusIcon</code> se utilizará en su lugar.</li>\n<li>En distribuciones de Linux que sólo tienen soporte de indicador de aplicación, tienes que instalar <code>libappindicator1</code> para que funcione el icono.</li>\n<li>El indicador de aplicación sólo se muestra cuando tiene un menú contextual.</li>\n<li>Cuando se utiliza el indicador de aplicación en Linux, el evento <code>click</code> es ignorado.</li>\n<li>En Linux para que los cambios hechos a los <code>MenuItem</code> individuales hagan efecto, tienes que llamar otra vez a <code>setContextMenu</code>. Por ejemplo:</li>\n</ul>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> appIcon = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/my/icon'</span>)\n  <span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n  ])\n\n  <span class=\"hljs-comment\">// Make a change to the context menu</span>\n  contextMenu.items[<span class=\"hljs-number\">1</span>].checked = <span class=\"hljs-literal\">false</span>\n\n  <span class=\"hljs-comment\">// Call this again for Linux because we modified the context menu</span>\n  appIcon.setContextMenu(contextMenu)\n})\n</code></pre>\n<ul>\n<li>En Windows se recomienda utilizar los iconos <code>ICO</code> para obtener mejores efectos visuales.</li>\n</ul>\n<p>Si se quiere mantener los mismos comportamientos en todas las plataformas, no se debe confiar en el evento <code>click</code> y siempre hay que adjuntar el menú de contexto al icono de bandeja.</p>\n<h3 id=\"new-trayimage-guid\"><a href=\"#new-trayimage-guid\"><code>new Tray(image, [guid])</code></a></h3>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n<li><code>guid</code> String (opcional) <em>Windows</em> - Asigna un GUID al icono de la bandeja. If the executable is signed and the signature contains an organization in the subject line then the GUID is permanently associated with that signature. OS level settings like the position of the tray icon in the system tray will persist even if the path to the executable changes. If the executable is not code-signed then the GUID is permanently associated with the path to the executable. Changing the path to the executable will break the creation of the tray icon and a new GUID must be used. However, it is highly recommended to use the GUID parameter only in conjunction with code-signed executable. If an App defines multiple tray icons then each icon must use a separate GUID.</li>\n</ul>\n<p>Crea un nuevo icono de bandeja asociado con la <code>image</code>.</p>\n<h3 id=\"eventos-de-instancia\"><a href=\"#eventos-de-instancia\">Eventos de Instancia</a></h3>\n<p>El módulo <code>Tray</code> emite los siguientes eventos:</p>\n<h4 id=\"evento-click\"><a href=\"#evento-click\">Evento: \"click\"</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Los límites del icono de bandeja.</li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - La posición del evento.</li>\n</ul>\n<p>Emitido cuando se hace clic en el icono de bandeja.</p>\n<h4 id=\"evento-right-clickmacos-windows\"><a href=\"#evento-right-clickmacos-windows\">Evento: \"right-click\"<em>macOS</em> <em>Windows</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Los límites del icono de bandeja.</li>\n</ul>\n<p>Emitido cuando se hace clic derecho en el icono de bandeja.</p>\n<h4 id=\"evento-double-clickmacos-windows\"><a href=\"#evento-double-clickmacos-windows\">Evento: \"double-click\"<em>macOS</em> <em>Windows</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Los límites del icono de bandeja.</li>\n</ul>\n<p>Emitido cuando se hace doble clic en el icono de bandeja.</p>\n<h4 id=\"evento-balloon-show-windows\"><a href=\"#evento-balloon-show-windows\">Evento: 'balloon-show' <em>Windows</em></a></h4>\n<p>Emitido cuando se muestra el globo de bandeja.</p>\n<h4 id=\"evento-balloon-click-windows\"><a href=\"#evento-balloon-click-windows\">Evento: 'balloon-click' <em>Windows</em></a></h4>\n<p>Emitido cuando se hace clic en el globo de bandeja.</p>\n<h4 id=\"evento-balloon-closed-windows\"><a href=\"#evento-balloon-closed-windows\">Evento: 'balloon-closed' <em>Windows</em></a></h4>\n<p>Emitido cuando se cierra el globo de bandeja debido al tiempo de expiración o cuando el usuario lo cierra manualmente.</p>\n<h4 id=\"evento-drop-macos\"><a href=\"#evento-drop-macos\">Evento: 'drop' <em>macOS</em></a></h4>\n<p>Emitido cuando cualquier elemento arrastrado es dejado en el icono de bandeja.</p>\n<h4 id=\"evento-drop-files-macos\"><a href=\"#evento-drop-files-macos\">Evento: 'drop-files' <em>macOS</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>files</code> String[] - Las rutas de los archivos dejados en la bandeja.</li>\n</ul>\n<p>Emitido cuando los archivos arrastrados son dejados en el icono de la bandeja.</p>\n<h4 id=\"evento-drop-text-macos\"><a href=\"#evento-drop-text-macos\">Evento: 'drop-text' <em>macOS</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>text</code> Cadena - la cadena del texto dejado.</li>\n</ul>\n<p>Emitido cuando el texto arrastrado es arrojado en el icono de bandeja.</p>\n<h4 id=\"evento-drag-enter-macos\"><a href=\"#evento-drag-enter-macos\">Evento: 'drag-enter' <em>macOS</em></a></h4>\n<p>Emitido cuando una operación de arrastre entra al icono de bandeja.</p>\n<h4 id=\"evento-drag-leave-macos\"><a href=\"#evento-drag-leave-macos\">Evento: 'drag-leave' <em>macOS</em></a></h4>\n<p>Emitido cuando una operación de arrastre sale del icono de bandeja.</p>\n<h4 id=\"evento-drag-end-macos\"><a href=\"#evento-drag-end-macos\">Evento: 'drag-end' <em>macOS</em></a></h4>\n<p>Emitido cuando termina una operación de arrastre en la bandeja o termina en otra ubicación.</p>\n<h4 id=\"evento-mouse-up-macos\"><a href=\"#evento-mouse-up-macos\">Evento: 'mouse-up' <em>macOS</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - La posición del evento.</li>\n</ul>\n<p>Emitted when the mouse is released from clicking the tray icon.</p>\n<p>Note: This will not be emitted if you have set a context menu for your Tray using <code>tray.setContextMenu</code>, as a result of macOS-level constraints.</p>\n<h4 id=\"evento-mouse-down-macos\"><a href=\"#evento-mouse-down-macos\">Evento: 'mouse-down' <em>macOS</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - La posición del evento.</li>\n</ul>\n<p>Emitted when the mouse clicks the tray icon.</p>\n<h4 id=\"evento-mouse-enter-macos\"><a href=\"#evento-mouse-enter-macos\">Evento: 'mouse-enter' <em>macOS</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - La posición del evento.</li>\n</ul>\n<p>Emitido cuando el ratón entra en el icono de la bandeja.</p>\n<h4 id=\"evento-mouse-leave-macos\"><a href=\"#evento-mouse-leave-macos\">Evento: 'mouse-leave' <em>macOS</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - La posición del evento.</li>\n</ul>\n<p>Emitido cuando el ratón sale del icono de la bandeja.</p>\n<h4 id=\"evento-mouse-move-macos-windows\"><a href=\"#evento-mouse-move-macos-windows\">Evento: 'mouse-move' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - La posición del evento.</li>\n</ul>\n<p>Se emite cuando el ratón se mueve sobre el icono de la bandeja del sistema.</p>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<p>La clase <code>Tray</code> tiene los siguientes métodos:</p>\n<h4 id=\"traydestroy\"><a href=\"#traydestroy\"><code>tray.destroy()</code></a></h4>\n<p>Destruye inmediatamente el icono de la bandeja.</p>\n<h4 id=\"traysetimageimage\"><a href=\"#traysetimageimage\"><code>tray.setImage(image)</code></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>Configura la <code>image</code> asociada con este icono de bandeja.</p>\n<h4 id=\"traysetpressedimageimage-macos\"><a href=\"#traysetpressedimageimage-macos\"><code>tray.setPressedImage(image)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>En macOS, configura la <code>image</code> asociada con este icono de bandeja cuando se presiona.</p>\n<h4 id=\"traysettooltiptooltip\"><a href=\"#traysettooltiptooltip\"><code>tray.setToolTip(toolTip)</code></a></h4>\n<ul>\n<li><code>toolTip</code> String</li>\n</ul>\n<p>Configura la activación de texto para este icono de bandeja.</p>\n<h4 id=\"traysettitletitle-options-macos\"><a href=\"#traysettitletitle-options-macos\"><code>tray.setTitle(title[, options])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>title</code> String</li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>fontType</code> String (optional) - The font family variant to display, can be <code>monospaced</code> or <code>monospacedDigit</code>. <code>monospaced</code> is available in macOS 10.15+ and <code>monospacedDigit</code> is available in macOS 10.11+.  When left blank, the title uses the default system font.</li>\n</ul></li>\n</ul>\n<p>Establece el título mostrado al lado de la bandeja de icono en la barra de estado (Soporta colores ANSI).</p>\n<h4 id=\"traygettitle-macos\"><a href=\"#traygettitle-macos\"><code>tray.getTitle()</code> <em>macOS</em></a></h4>\n<p>Devuelve <code>String</code> - el título mostrado junto al icono de la bandeja en la barra de estado</p>\n<h4 id=\"traysetignoredoubleclickeventsignore-macos\"><a href=\"#traysetignoredoubleclickeventsignore-macos\"><code>tray.setIgnoreDoubleClickEvents(ignore)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n</ul>\n<p>Sets the option to ignore double click events. Ignoring these events allows you to detect every individual click of the tray icon.</p>\n<p>Este valor se establece en falso por defecto.</p>\n<h4 id=\"traygetignoredoubleclickevents-macos\"><a href=\"#traygetignoredoubleclickevents-macos\"><code>tray.getIgnoreDoubleClickEvents()</code> <em>macOS</em></a></h4>\n<p>Devuelve <code>Boolean</code> - Si los eventos de doble click serán ignorados.</p>\n<h4 id=\"traydisplayballoonoptions-windows\"><a href=\"#traydisplayballoonoptions-windows\"><code>tray.displayBalloon(options)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (opcional) - Icono a usar cuando <code>iconType</code> es <code>custom</code>.</li>\n<li><code>iconType</code> String (optional) - Can be <code>none</code>, <code>info</code>, <code>warning</code>, <code>error</code> or <code>custom</code>. Predeterminadamente, es <code>custom</code>.</li>\n<li><code>title</code> String</li>\n<li><code>content</code> String</li>\n<li><code>largeIcon</code> Boolean (opcional) - La versión grande del icono debe ser usada. Por defecto es <code>true</code>. Mapea a <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_large_icon-0x00000020\"><code>NIIF_LARGE_ICON</code></a>.</li>\n<li><code>noSound</code> Boolean (opcional) - No reproducir el sonido asociado. Por defecto es <code>false</code>. Mapea a <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_nosound-0x00000010\"><code>NIIF_NOSOUND</code></a>.</li>\n<li><code>respectQuietTime</code> Boolean (opcional) - No mostrar el globo de notificación si el usuario actual esta en \"tiempo de silencio\". Por defecto es <code>false</code>. Mapea a <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_respect_quiet_time-0x00000080\"><code>NIIF_RESPECT_QUIET_TIME</code></a>.</li>\n</ul></li>\n</ul>\n<p>Muestra un globo de la bandeja.</p>\n<h4 id=\"trayremoveballoon-windows\"><a href=\"#trayremoveballoon-windows\"><code>tray.removeBalloon()</code> <em>Windows</em></a></h4>\n<p>Elimina un globo de la bandeja.</p>\n<h4 id=\"trayfocus-windows\"><a href=\"#trayfocus-windows\"><code>tray.focus()</code> <em>Windows</em></a></h4>\n<p>Devuelve el foco al área de notificación de la barra de tarea. Los iconos del área de notificación deben usar este mensaje cuando hayan completado su operación UI. Por ejemplo, si el icono muestra un menú de acceso directo, pero el usuario presiona ESC para cancelarlo, use <code>tray.focus()</code> para devolver el focus a la área de notificación.</p>\n<h4 id=\"traypopupcontextmenumenu-position-macos-windows\"><a href=\"#traypopupcontextmenumenu-position-macos-windows\"><code>tray.popUpContextMenu([menu, position])</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>menu</code> Menu (opcional)</li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> (optional) - La posición del elemento emergente.</li>\n</ul>\n<p>Pops up the context menu of the tray icon. When <code>menu</code> is passed, the <code>menu</code> will be shown instead of the tray icon's context menu.</p>\n<p>La <code>position</code> solo está disponible en Windows, y por defecto es (0, 0).</p>\n<h4 id=\"trayclosecontextmenu-macos-windows\"><a href=\"#trayclosecontextmenu-macos-windows\"><code>tray.closeContextMenu()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Closes an open context menu, as set by <code>tray.setContextMenu()</code>.</p>\n<h4 id=\"traysetcontextmenumenu\"><a href=\"#traysetcontextmenumenu\"><code>tray.setContextMenu(menu)</code></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Configura el menú de contexto para este icono.</p>\n<h4 id=\"traygetbounds-macos-windows\"><a href=\"#traygetbounds-macos-windows\"><code>tray.getBounds()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Devuelve <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>Los <code>bounds</code> de este icono de la bandeja como <code>Object</code>.</p>\n<h4 id=\"trayisdestroyed\"><a href=\"#trayisdestroyed\"><code>tray.isDestroyed()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si el icono de la bandeja es destruido o no.</p>",
      "title": "Tray",
      "description": "Añadir los iconos y menús contextuales al área de notificación del sistema."
    },
    "/docs/tutorial/tray": {
      "locale": "es-ES",
      "slug": "tray",
      "href": "/docs/tutorial/tray",
      "crowdinFileId": "256259",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/tray.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<hr>\n<p>title: Tray\ndescription: This guide will take you through the process of creating a Tray icon with its own context menu to the system's notification area.\nslug: tray</p>\n<h2 id=\"hide_title-true\"><a href=\"#hide_title-true\">hide_title: true</a></h2>\n<h1 id=\"tray\"><a href=\"#tray\">Tray</a></h1>\n<h2 id=\"descripción-general\"><a href=\"#descripción-general\">Descripción general</a></h2>\n<!-- ✍ Update this section if you want to provide more details -->\n<p>Esta guía le llevará a través del proceso de creación de un icono de <a href=\"https://www.electronjs.org/docs/api/tray\">bandeja</a> con su propio menú contextual en el área de notificación del sistema.</p>\n<p>En MacOS y Ubuntu, la bandeja se ubicará en la parte superior esquina derecha de tu pantalla, adyacente a tu batería y a los íconos WiFi. En Windows, la bandeja se ubicará normalmente en la esquina inferior derecha.</p>\n<h2 id=\"ejemplo\"><a href=\"#ejemplo\">Ejemplo</a></h2>\n<h3 id=\"mainjs\"><a href=\"#mainjs\">main.js</a></h3>\n<p>First we must import <code>app</code>, <code>Tray</code>, <code>Menu</code>, <code>nativeImage</code> from <code>electron</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, Tray, Menu, nativeImage } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>A continuación crearemos nuestra bandeja. To do this, we will use a <a href=\"https://www.electronjs.org/docs/api/native-image\"><code>NativeImage</code></a> icon, which can be created through any one of these <a href=\"https://www.electronjs.org/docs/api/native-image#methods\">methods</a>. Note that we wrap our Tray creation code within an <a href=\"https://www.electronjs.org/docs/api/app#appwhenready\"><code>app.whenReady</code></a> as we will need to wait for our electron app to finish initializing.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">let</span> tray\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> icon = nativeImage.createFromPath(<span class=\"hljs-string\">'path/to/asset. ng'</span>)\n  bandeja = <span class=\"hljs-keyword\">new</span> Tray(icon)\n\n  <span class=\"hljs-comment\">// Nota: su código contextMenu, Tooltip y Title ¡irá aquí!</span>\n})\n</code></pre>\n<p>¡Genial! Ahora podemos empezar a adjuntar un menú contextual a nuestra bandeja, así:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item3'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item4'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n])\n\ntray.setContextMenu(contextMenu)\n</code></pre>\n<p>El código anterior creará 4 elementos de tipo radio separados en el menú contextual. Para leer más sobre la construcción de menús nativos, haz clic en <a href=\"https://www.electronjs.org/docs/api/menu#menubuildfromtemplatetemplate\">aquí</a>.</p>\n<p>Por último, démosle a nuestra bandeja una información sobre herramientas y un título.</p>\n<pre><code class=\"hljs language-js\">tray.setToolTip(<span class=\"hljs-string\">'Esta es mi aplicación'</span>)\ntray.setTitle(<span class=\"hljs-string\">'Este es mi título'</span>)\n</code></pre>\n<h2 id=\"conclusión\"><a href=\"#conclusión\">Conclusión</a></h2>\n<p>Después de iniciar la aplicación Electron, deberías ver la bandeja residiendo en la parte superior o inferior derecha de la pantalla, dependiendo de tu sistema operativo.\n<code>fiddle docs/fiddles/native-ui/tray</code></p>",
      "title": "Tray",
      "description": ""
    },
    "/docs/tutorial/updates": {
      "locale": "es-ES",
      "slug": "updates",
      "href": "/docs/tutorial/updates",
      "crowdinFileId": "256261",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/updates.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"actualización-de-aplicaciones\"><a href=\"#actualización-de-aplicaciones\">Actualización de aplicaciones</a></h1>\n<p>Hay muchas manera de actualizar la aplicación Electron. La manera más fácil y apoyada oficialmente es aprovechar el marco de trabajo incorporado <a href=\"https://github.com/Squirrel\">Squirrel</a> y el módulo <a href=\"/docs/api/auto-updater\">autoUpdater</a> de Electron.</p>\n<h2 id=\"usando-updateelectronjsorg\"><a href=\"#usando-updateelectronjsorg\">Usando <code>update.electronjs.org</code></a></h2>\n<p>El equipo de Electron mantiene <a href=\"https://github.com/electron/update.electronjs.org\">update.electronjs.org</a>, un webservice gratis y open-source que las aplicaciones Electron puede usar para auto-actualizarse. El servicio está diseñado para aplicaciones de Electron que cumplen con los siguientes criterios:</p>\n<ul>\n<li>Aplicaciones que se ejecuten en macOS o Windows</li>\n<li>La Aplicación tiene un repositorio público en GitHub</li>\n<li>Todas las compilaciones se publicarán en GitHub</li>\n<li>Todas las compilaciones tienen verificación de código</li>\n</ul>\n<p>La forma más fácil de usar este servicio es instalando <a href=\"https://github.com/electron/update-electron-app\">update-electron-app</a>, un módulo de Node.js preconfigurado para usarse con update.electronjs.org.</p>\n<p>Instala el módulo:</p>\n<pre><code class=\"hljs language-sh\">npm install update-electron-app\n</code></pre>\n<p>Invoque el actualizador de archivos de los principales procesos de su aplicacion Electrón:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'update-electron-app'</span>)()\n</code></pre>\n<p>De manera predeterminada, este módulo verificará si existen actualizaciones en el inicio de la aplicación y luego cada diez minutos. Cuando se encuentra una actualización, esta se descargará automáticamente en segundo plano. Cuando se completa la descarga, se muestra un cuadro de diálogo que le permite al usuario reiniciar su aplicación.</p>\n<p>Si necesita personalizar su configuración, puede <a href=\"https://github.com/electron/update-electron-app\">usar la opción de <code>update-electron-app</code></a> o <a href=\"https://github.com/electron/update.electronjs.org\">usar el servicio de actualización directo</a>.</p>\n<h2 id=\"implementar-un-servidor-de-actualización\"><a href=\"#implementar-un-servidor-de-actualización\">Implementar un servidor de actualización</a></h2>\n<p>Si está desarrollando una aplicación privada de Electrón, o si no está publicando lanzamientos en GitHub, tal vez pueda considerar poseer su propio servidor de actualizaciones.</p>\n<p>Dependiendo de sus necesidades, puede escoger una de esta:</p>\n<ul>\n<li><a href=\"https://github.com/vercel/hazel\">Hazel</a> – Update server for private or open-source apps which can be deployed for free on <a href=\"https://vercel.com\">Vercel</a>. Es tomado de los <a href=\"https://help.github.com/articles/creating-releases/\">Lanzamientos de GitHub</a> y aprovecha al maximo el poder de las CDN's de GitHub.</li>\n<li><a href=\"https://github.com/GitbookIO/nuts\">Nuts</a> – También usa los <a href=\"https://help.github.com/articles/creating-releases/\">Lanzamientos de GitHub</a>, pero almacena la aplicación, actualiza en el Disco Duro y también soporta repositorios privados.</li>\n<li><a href=\"https://github.com/ArekSredzki/electron-release-server\">electron-release-server</a> – proporciona un panel para administrar los lanzamientos y no es necesarios que los lanzamientos se originen desde GitHub.</li>\n<li><a href=\"https://github.com/atlassian/nucleus\">Nucleus</a> – Un servidor de actualizaciones completo para aplicaciones de Electrón y es mantenido gracias a Atlassian. Soporta múltiples aplicaciones y canales, y utiliza un almacén de archivos estáticos para minimizar el coste del servidor.</li>\n</ul>\n<h2 id=\"implementación-de-actualizaciones-en-su-aplicación\"><a href=\"#implementación-de-actualizaciones-en-su-aplicación\">Implementación de actualizaciones en su aplicación</a></h2>\n<p>Una vez que haya implementado su servidor de actualización, continúe con la importación de los módulos requeridos en su código. El siguiente código podría variar en diferentes servidores de software, pero funciona como está descrito cuando se utiliza <a href=\"https://github.com/vercel/hazel\">Hazel</a>.</p>\n<p><strong>Importantante:</strong> por favor asegurate de que el siguiente código solo se ejecutara en su paquete de aplicaciones, y no en desarrollo. Puedes usar <a href=\"https://github.com/sindresorhus/electron-is-dev\">electron-is-dev</a> para chequear el tipo de ambiente.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, autoUpdater, dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>A continuación, construya la URL de uno de los servidores de actualizaciones, de la siguiente manera: <a href=\"/docs/api/auto-updater\">autoUpdater</a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> server = <span class=\"hljs-string\">'https://your-deployment-url.com'</span>\n<span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-string\">`<span class=\"hljs-subst\">${server}</span>/update/<span class=\"hljs-subst\">${process.platform}</span>/<span class=\"hljs-subst\">${app.getVersion()}</span>`</span>\n\nautoUpdater.setFeedURL({ url })\n</code></pre>\n<p>As the final step, check for updates. The example below will check every minute:</p>\n<pre><code class=\"hljs language-javascript\">setInterval(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  autoUpdater.checkForUpdates()\n}, <span class=\"hljs-number\">60000</span>)\n</code></pre>\n<p>Una vez que su aplicacion es <a href=\"/docs/tutorial/application-distribution\">empaquetada</a>, usted recibirá una actualización para cada nuevo <a href=\"https://help.github.com/articles/creating-releases/\">Lanzamiento de GitHub</a> que usted publique.</p>\n<h2 id=\"aplicar-actualizaciones\"><a href=\"#aplicar-actualizaciones\">Aplicar actualizaciones</a></h2>\n<p>Ahora que ha configurado el mecanismo de actualización básico para su aplicación, debe asegurarse de que el usuario reciba una notificación cuando haya una actualización. Esto se puede lograr utilzando la API de autoUpdater <a href=\"/docs/api/auto-updater#events\">events</a>:</p>\n<pre><code class=\"hljs language-javascript\">autoUpdater.on(<span class=\"hljs-string\">'update-downloaded'</span>, (event, releaseNotes, releaseName) => {\n  <span class=\"hljs-keyword\">const</span> dialogOpts = {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'info'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Restart'</span>, <span class=\"hljs-string\">'Later'</span>],\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Application Update'</span>,\n    <span class=\"hljs-attr\">message</span>: process.platform === <span class=\"hljs-string\">'win32'</span> ? releaseNotes : releaseName,\n    <span class=\"hljs-attr\">detail</span>: <span class=\"hljs-string\">'A new version has been downloaded. Restart the application to apply the updates.'</span>\n  }\n\n  dialog.showMessageBox(dialogOpts).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">returnValue</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (returnValue.response === <span class=\"hljs-number\">0</span>) autoUpdater.quitAndInstall()\n  })\n})\n</code></pre>\n<p>Also make sure that errors are <a href=\"/docs/api/auto-updater#event-error\">being handled</a>. Here's an example for logging them to <code>stderr</code>:</p>\n<pre><code class=\"hljs language-javascript\">autoUpdater.on(<span class=\"hljs-string\">'error'</span>, message => {\n  <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'There was a problem updating the application'</span>)\n  <span class=\"hljs-built_in\">console</span>.error(message)\n})\n</code></pre>\n<h2 id=\"administrando-actualizaciones-manualmente\"><a href=\"#administrando-actualizaciones-manualmente\">Administrando actualizaciones manualmente</a></h2>\n<p>Because the requests made by Auto Update aren't under your direct control, you may find situations that are difficult to handle (such as if the update server is behind authentication). The <code>url</code> field does support files, which means that with some effort, you can sidestep the server-communication aspect of the process. <a href=\"https://github.com/electron/electron/issues/5020#issuecomment-477636990\">Here's an example of how this could work</a>.</p>",
      "title": "Actualización de aplicaciones",
      "description": ""
    },
    "/docs/api/structures/upload-data": {
      "locale": "es-ES",
      "slug": "upload-data",
      "href": "/docs/api/structures/upload-data",
      "crowdinFileId": "256523",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploaddata-object\"><a href=\"#uploaddata-object\">UploadData Object</a></h1>\n<ul>\n<li><code>bytes</code> Buffer - Content being sent.</li>\n<li><code>file</code> String (optional) - Path of file being uploaded.</li>\n<li><code>blobUUID</code> String (optional) - UUID of blob data. Use <a href=\"/docs/api/session#sesgetblobdataidentifier\">ses.getBlobData</a> method to retrieve the data.</li>\n</ul>",
      "title": "UploadData Object",
      "description": ""
    },
    "/docs/api/structures/upload-file": {
      "locale": "es-ES",
      "slug": "upload-file",
      "href": "/docs/api/structures/upload-file",
      "crowdinFileId": "256525",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-file.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploadfile-object\"><a href=\"#uploadfile-object\">UploadFile Object</a></h1>\n<ul>\n<li><code>type</code> 'file' - <code>file</code>.</li>\n<li><code>filePath</code> String - Path of file to be uploaded.</li>\n<li><code>offset</code> Integer - Defaults to <code>0</code>.</li>\n<li><code>length</code> Integer - Number of bytes to read from <code>offset</code>. Defaults to <code>0</code>.</li>\n<li><code>modificationTime</code> Double - Last Modification time in number of seconds since the UNIX epoch.</li>\n</ul>",
      "title": "UploadFile Object",
      "description": ""
    },
    "/docs/api/structures/upload-raw-data": {
      "locale": "es-ES",
      "slug": "upload-raw-data",
      "href": "/docs/api/structures/upload-raw-data",
      "crowdinFileId": "256527",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-raw-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploadrawdata-object\"><a href=\"#uploadrawdata-object\">UploadRawData Object</a></h1>\n<ul>\n<li><code>type</code> 'rawData' - <code>rawData</code>.</li>\n<li><code>bytes</code> Buffer - Data to be uploaded.</li>\n</ul>",
      "title": "UploadRawData Object",
      "description": ""
    },
    "/docs/api/structures/user-default-types": {
      "locale": "es-ES",
      "slug": "user-default-types",
      "href": "/docs/api/structures/user-default-types",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/user-default-types.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"userdefaulttypes-object\"><a href=\"#userdefaulttypes-object\">UserDefaultTypes Object</a></h1>\n<ul>\n<li><code>string</code> String</li>\n<li><code>boolean</code> Boolean</li>\n<li><code>integer</code> Number</li>\n<li><code>float</code> Number</li>\n<li><code>double</code> Number</li>\n<li><code>url</code> String</li>\n<li><code>array</code> Arreglo\\<unknown></unknown></li>\n<li><code>dictionary</code> Record\\&#x3C;string, unknown></li>\n</ul>\n<p>This type is a helper alias, no object will never exist of this type.</p>",
      "title": "UserDefaultTypes Object",
      "description": ""
    },
    "/docs/tutorial/using-native-node-modules": {
      "locale": "es-ES",
      "slug": "using-native-node-modules",
      "href": "/docs/tutorial/using-native-node-modules",
      "crowdinFileId": "256263",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-native-node-modules.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"native-node-modules\"><a href=\"#native-node-modules\">Native Node Modules</a></h1>\n<p>Los módulos nativos de Node.js están soportados por Electron, pero dado que Electron tiene una diferente <a href=\"https://en.wikipedia.org/wiki/Application_binary_interface\">interfaz binaria de aplicación (ABI)</a> de un binario Node.js dado (debido a diferencias tales como usar BoringSSL de Chromium en lugar de OpenSSL), los módulos nativos que use necesitarán ser recompilados para Electron. De lo contrario, obtendrá la siguiente clase de error cuando intente ejecutar su aplicación:</p>\n<pre><code class=\"hljs language-sh\">Error: The module <span class=\"hljs-string\">'/path/to/native/module.node'</span>\nwas compiled against a different Node.js version using\nNODE_MODULE_VERSION <span class=\"hljs-variable\">$XYZ</span>. This version of Node.js requires\nNODE_MODULE_VERSION <span class=\"hljs-variable\">$ABC</span>. Please try re-compiling or re-installing\nthe module (<span class=\"hljs-keyword\">for</span> instance, using `npm rebuild` or `npm install`).\n</code></pre>\n<h2 id=\"¿cómo-instalar-módulos-nativos\"><a href=\"#¿cómo-instalar-módulos-nativos\">¿Cómo instalar módulos nativos?</a></h2>\n<p>Hay varias formas diferentes de instalar los módulos nativos:</p>\n<h3 id=\"instalación-de-módulos-y-reconstrucción-para-electron\"><a href=\"#instalación-de-módulos-y-reconstrucción-para-electron\">Instalación de módulos y reconstrucción para Electron</a></h3>\n<p>Puedes instalar los módulos como otro proyecto Node, luego reconstruir el modulo para Electron con el paquete <a href=\"https://github.com/electron/electron-rebuild\"><code>electron-rebuild</code></a>. Este módulo puede determinar automáticamente la versión de Electron y manejar los pasos manuales de descargar las cabeceras y reconstruir los módulos nativos para tu app. Si está usando <a href=\"https://electronforge.io/\">Electron Forge</a>, esta herramienta se utiliza automáticamente tanto en desarrollo como al hacer distribuibles.</p>\n<p>Por ejemplo, para instalar la herramienta independiente <code>electron-rebuild</code> y recompilar los módulos con este a través de la linea de comando:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron-rebuild\n\n<span class=\"hljs-comment\"># Every time you run \"npm install\", run this:</span>\n./node_modules/.bin/electron-rebuild\n\n<span class=\"hljs-comment\"># If you have trouble on Windows, try:</span>\n.\\node_modules\\.bin\\electron-rebuild.cmd\n</code></pre>\n<p>Para más información sobre el uso y la integración con otras herramientas como <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a>, consulte el README del proyecto.</p>\n<h3 id=\"usando-npm\"><a href=\"#usando-npm\">Usando <code>npm</code></a></h3>\n<p>Al establecer algunas variables del entorno, puede usar <code>npm</code> para instalar módulos directamente.</p>\n<p>Por ejemplo, para instalar todas las dependencias para Electron:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-comment\"># Electron's version.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_target=1.2.3\n<span class=\"hljs-comment\"># The architecture of Electron, see https://electronjs.org/docs/tutorial/support#supported-platforms</span>\n<span class=\"hljs-comment\"># for supported architectures.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_arch=x64\n<span class=\"hljs-built_in\">export</span> npm_config_target_arch=x64\n<span class=\"hljs-comment\"># Download headers for Electron.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_disturl=https://electronjs.org/headers\n<span class=\"hljs-comment\"># Tell node-pre-gyp that we are building for Electron.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_runtime=electron\n<span class=\"hljs-comment\"># Tell node-pre-gyp to build module from source code.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_build_from_source=<span class=\"hljs-literal\">true</span>\n<span class=\"hljs-comment\"># Install all dependencies, and store cache to ~/.electron-gyp.</span>\nHOME=~/.electron-gyp npm install\n</code></pre>\n<h3 id=\"construcción-manual-para-electron\"><a href=\"#construcción-manual-para-electron\">Construcción manual para Electron</a></h3>\n<p>Si usted es un desarrollador que está desarrollando un módulo nativo y desea probarlo con Electron, es posible que desee reconstruir el módulo para Electron manualmente. Puedes usar <code>node-gyp</code> directamente para construir para Electron:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">cd</span> /path-to-module/\nHOME=~/.electron-gyp node-gyp rebuild --target=1.2.3 --arch=x64 --dist-url=https://electronjs.org/headers\n</code></pre>\n<ul>\n<li><code>HOME=~/.electron-gyp</code> cambie para encontrar las cabeceras de desarrollo.</li>\n<li><code>--target=1.2.3</code> es la versión de Electron.</li>\n<li><code>--dist-url=...</code> especifique de donde descargar las cabeceras.</li>\n<li><code>--arch=x64</code> dice que el modulo es construido para un sistema de 64-bit.</li>\n</ul>\n<h3 id=\"construcción-manual-para-una-compilación-personalizada-de-electron\"><a href=\"#construcción-manual-para-una-compilación-personalizada-de-electron\">Construcción manual para una compilación personalizada de Electron</a></h3>\n<p>Para compilar Módulos Nativos de Node contra una compilación personalizada de Electron que no coincide con una version pública, indique a <code>npm</code> que use la versión de Node que ha incluido en su versión personalizada.</p>\n<pre><code class=\"hljs language-sh\">npm rebuild --nodedir=/path/to/src/out/Default/gen/node_headers\n</code></pre>\n<h2 id=\"problemas\"><a href=\"#problemas\">Problemas</a></h2>\n<p>Si ha instalado un módulo nativo y este no funciona, necesitas verificar las siguientes cosas:</p>\n<ul>\n<li>En caso de duda, ejecute <code>electron-rebuild</code> primero.</li>\n<li>Asegúrese de que el módulo nativo es compatible con la plataforma de destino y la arquitectura para su aplicación Electron.</li>\n<li>Asegúrese de que <code>win_delay_load_hook</code> no esta configurado como <code>false</code> en el módulo <code>binding.gyp</code>.</li>\n<li>Después de actualizar Electron, generalmente necesita reconstruir los módulos.</li>\n</ul>\n<h3 id=\"una-nota-acerca-de-win_delay_load_hook\"><a href=\"#una-nota-acerca-de-win_delay_load_hook\">Una nota acerca de <code>win_delay_load_hook</code></a></h3>\n<p>En Windows, por defecto <code>node-gyp</code> enlaza los módulos nativos contra <code>node.dll</code>. Sin embargo, en Electron 4.x y superiores, los symbols que necesitan los módulos nativos son exportados por <code>electron.exe</code>, y no ahí <code>node.dll</code>. Para poder cargar módulos nativos en Windows, <code>node-gyp</code> instala un <a href=\"https://msdn.microsoft.com/en-us/library/z9h1h6ty.aspx\">delay_load_hook</a> que es lanzado cuando el módulo nativo es cargado, y redirige las referencias de <code>node.dll</code> para usar el ejecutable de carga en lugar de buscar por <code>node.dll</code> en la ruta de la libreria (el cual no daría nada). Como tal, en Electron 4.x y superiores <code>'win_delay_load_hook': 'true'</code> es necesario para cargar módulos nativos.</p>\n<p>Si se obtiene un error como <code>Módulo no se auto-registró</code>, o <code>El procedimiento especificado no se pudo encontrar</code>, puede significar que el módulo que está intentando usar no incluyó correctamente el delay-load hook.  Si el módulo esta construido con node-gyp, asegurese de que la variable <code>win_delay_load_hook</code> esta configurada a <code>true</code> en el archivo <code>binding.gyp</code>, y que no esta siendo sobrescrita en ningún lado.  Si el módulo esta siendo construido con otro sistema, necesitarás asegurarte que construye con un delay-load hook instalado en el archivo <code>.node</code> principal. Su invocación <code>link.exe</code> debe parecerce a esto:</p>\n<pre><code class=\"hljs language-plaintext\"> link.exe /OUT:\"foo.node\" \"...\\node.lib\" delayimp.lib /DELAYLOAD:node.exe /DLL\n     \"my_addon.obj\" \"win_delay_load_hook.obj\"\n</code></pre>\n<p>En particular, es importante que:</p>\n<ul>\n<li>you link against <code>node.lib</code> from <em>Electron</em> and not Node. If you link against the wrong <code>node.lib</code> you will get load-time errors when you require the module in Electron.</li>\n<li>incluyas la bandera <code>/DELAYLOAD:node.exe</code>. Si el enlace a <code>node.exe</code> no se retrasa, el delay-load hook no tendra la oportunidad de disparar y el símbolo a node no será resulto correctamente.</li>\n<li><code>win_delay_load_hook.obj</code> is linked directly into the final DLL. If the hook is set up in a dependent DLL, it won't fire at the right time.</li>\n</ul>\n<p>Mire <a href=\"https://github.com/nodejs/node-gyp/blob/e2401e1395bef1d3c8acec268b42dc5fb71c4a38/src/win_delay_load_hook.cc\"><code>node-gyp</code></a> para un ejemplo de delay-load si estas implementando el tuyo propio.</p>\n<h2 id=\"módulos-que-dependen-de-prebuild\"><a href=\"#módulos-que-dependen-de-prebuild\">Módulos que dependen de <code>prebuild</code></a></h2>\n<p><a href=\"https://github.com/prebuild/prebuild\"><code>prebuild</code></a> proporciona una forma de publicar módulos nativos de Node con binarios precompilados para multiples versiones de Node y Electron.</p>\n<p>Si el módulo <code>prebuild</code>-powered provee binarios para el uso en Electron, asegúrate de omitir <code>--build-from-source</code> y la variable de entorno <code>npm_config_build_from_source</code> para aprovechar el máximo de los binarios preconstruidos.</p>\n<h2 id=\"módulos-que-dependen-de-node-pre-gyp\"><a href=\"#módulos-que-dependen-de-node-pre-gyp\">Módulos que dependen de <code>node-pre-gyp</code></a></h2>\n<p>La herramienta <a href=\"https://github.com/mapbox/node-pre-gyp\"><code>node-pre-gyp</code></a> proporciona una forma de implementar módulos de nodo nativos con binarios precompilados, y muchos módulos populares lo están usando.</p>\n<p>Algunas veces esos módulos funcionan bien bajo Electron, pero cuando no hay disponibles binarios específico para Electron necesitarás construirlos desde el código fuente. Por esto, es recomendable usar <code>electron-rebuild</code> para estos módulos.</p>\n<p>Si estás siguiendo la forma de <code>npm</code> de instalar módulos, necesitarás pasar <code>--build-from-source</code> a <code>npm</code>, o establecer la variable de entorno <code>npm_config_build_from_source</code>.</p>",
      "title": "Native Node Modules",
      "description": ""
    },
    "/docs/tutorial/using-pepper-flash-plugin": {
      "locale": "es-ES",
      "slug": "using-pepper-flash-plugin",
      "href": "/docs/tutorial/using-pepper-flash-plugin",
      "crowdinFileId": "256265",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-pepper-flash-plugin.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"pepper-flash-plugin\"><a href=\"#pepper-flash-plugin\">Pepper Flash Plugin</a></h1>\n<p>Electron no longer supports the Pepper Flash plugin, as Chrome has removed support.</p>\n<p>See <a href=\"https://www.chromium.org/flash-roadmap\">Chromium's Flash Roadmap</a> for more details.</p>",
      "title": "Pepper Flash Plugin",
      "description": ""
    },
    "/docs/tutorial/using-selenium-and-webdriver": {
      "locale": "es-ES",
      "slug": "using-selenium-and-webdriver",
      "href": "/docs/tutorial/using-selenium-and-webdriver",
      "crowdinFileId": "256267",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-selenium-and-webdriver.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"selenium-and-webdriver\"><a href=\"#selenium-and-webdriver\">Selenium and WebDriver</a></h1>\n<p>Para <a href=\"https://sites.google.com/a/chromium.org/chromedriver/\">ChromeDriver - WebDriver para Chrome</a>:</p>\n<blockquote>\n<p>WebDriver es una herramienta de código abierto para pruebas automatizadas de aplicaciones web en varios navegadores. Provee la capacidad de navegar por páginas web, sistema de usuarios, ejecución de JavaScript, y más. ChromeDriver es un servidor independiente que implementa el protocolo de cable de WebDriver para Chromium. Ha sido desarrollado por miembros de los equipos de Chromium y WebDriver.</p>\n</blockquote>\n<h2 id=\"configurando-spectron\"><a href=\"#configurando-spectron\">Configurando Spectron</a></h2>\n<p><a href=\"https://electronjs.org/spectron\">Spectron</a> es el sistema de pruebas de Electron, apoyado oficialmente por ChromeDriver. Se construyó sobre <a href=\"https://webdriver.io/\">WebdriverIO</a> y tiene ayudantes para acceder a la API de Electron en su prueba y paquetes ChromeDriver.</p>\n<pre><code class=\"hljs language-sh\">$ npm install --save-dev spectron\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// A simple test to verify a visible window is opened with a title</span>\n<span class=\"hljs-keyword\">const</span> Application = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spectron'</span>).Application\n<span class=\"hljs-keyword\">const</span> assert = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'assert'</span>)\n\n<span class=\"hljs-keyword\">const</span> myApp = <span class=\"hljs-keyword\">new</span> Application({\n  <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'/Applications/MyApp.app/Contents/MacOS/MyApp'</span>\n})\n\n<span class=\"hljs-keyword\">const</span> verifyWindowIsVisibleWithTitle = <span class=\"hljs-keyword\">async</span> (app) => {\n  <span class=\"hljs-keyword\">await</span> app.start()\n  <span class=\"hljs-keyword\">try</span> {\n    <span class=\"hljs-comment\">// Check if the window is visible</span>\n    <span class=\"hljs-keyword\">const</span> isVisible = <span class=\"hljs-keyword\">await</span> app.browserWindow.isVisible()\n    <span class=\"hljs-comment\">// Verify the window is visible</span>\n    assert.strictEqual(isVisible, <span class=\"hljs-literal\">true</span>)\n    <span class=\"hljs-comment\">// Get the window's title</span>\n    <span class=\"hljs-keyword\">const</span> title = <span class=\"hljs-keyword\">await</span> app.client.getTitle()\n    <span class=\"hljs-comment\">// Verify the window's title</span>\n    assert.strictEqual(title, <span class=\"hljs-string\">'My App'</span>)\n  } <span class=\"hljs-keyword\">catch</span> (error) {\n    <span class=\"hljs-comment\">// Log any failures</span>\n    <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Test failed'</span>, error.message)\n  }\n  <span class=\"hljs-comment\">// Stop the application</span>\n  <span class=\"hljs-keyword\">await</span> app.stop()\n}\n\nverifyWindowIsVisibleWithTitle(myApp)\n</code></pre>\n<h2 id=\"configurar-con-webdriverjs\"><a href=\"#configurar-con-webdriverjs\">Configurar con WebDriverJs</a></h2>\n<p><a href=\"https://www.selenium.dev/selenium/docs/api/javascript/index.html\">WebDriverJs</a> provides a Node package for testing with web driver, we will use it as an example.</p>\n<h3 id=\"1-start-chromedriver\"><a href=\"#1-start-chromedriver\">1. Start ChromeDriver</a></h3>\n<p>Primero usted necesita descargar el <code>chromedriver</code> binario, y ejecutarlo:</p>\n<pre><code class=\"hljs language-sh\">$ npm install electron-chromedriver\n$ ./node_modules/.bin/chromedriver\nIniciar ChromeDriver (v2.10.291558) en puerto 9515\nSolo conexiones locales permitidas.\n</code></pre>\n<p>Recuerde el puerto número <code>9515</code>, que usaremos más adelante</p>\n<h3 id=\"2-install-webdriverjs\"><a href=\"#2-install-webdriverjs\">2. Install WebDriverJS</a></h3>\n<pre><code class=\"hljs language-sh\">$ npm install selenium-webdriver\n</code></pre>\n<h3 id=\"3-connect-to-chromedriver\"><a href=\"#3-connect-to-chromedriver\">3. Connect to ChromeDriver</a></h3>\n<p>El uso de <code>selenium-webdriver</code> con Electron es el mismo con upstream, excepto que usted tiene que especificar manualmente como conectar chrome driver y donde se encuentra el binario de Electron:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webdriver = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'selenium-webdriver'</span>)\n\n<span class=\"hljs-keyword\">const</span> driver = <span class=\"hljs-keyword\">new</span> webdriver.Builder()\n  <span class=\"hljs-comment\">// The \"9515\" is the port opened by chrome driver.</span>\n  .usingServer(<span class=\"hljs-string\">'http://localhost:9515'</span>)\n  .withCapabilities({\n    <span class=\"hljs-string\">'goog:chromeOptions'</span>: {\n      <span class=\"hljs-comment\">// Here is the path to your Electron binary.</span>\n      <span class=\"hljs-attr\">binary</span>: <span class=\"hljs-string\">'/Path-to-Your-App.app/Contents/MacOS/Electron'</span>\n    }\n  })\n  .forBrowser(<span class=\"hljs-string\">'chrome'</span>) <span class=\"hljs-comment\">// note: use .forBrowser('electron') for selenium-webdriver &#x3C;= 3.6.0</span>\n  .build()\n\ndriver.get(<span class=\"hljs-string\">'http://www.google.com'</span>)\ndriver.findElement(webdriver.By.name(<span class=\"hljs-string\">'q'</span>)).sendKeys(<span class=\"hljs-string\">'webdriver'</span>)\ndriver.findElement(webdriver.By.name(<span class=\"hljs-string\">'btnG'</span>)).click()\ndriver.wait(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">return</span> driver.getTitle().then(<span class=\"hljs-function\">(<span class=\"hljs-params\">title</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> title === <span class=\"hljs-string\">'webdriver - Google Search'</span>\n  })\n}, <span class=\"hljs-number\">1000</span>)\n\ndriver.quit()\n</code></pre>\n<h2 id=\"configurar-con-webdriverio\"><a href=\"#configurar-con-webdriverio\">Configurar con WebDriverIO</a></h2>\n<p><a href=\"https://webdriver.io/\">WebdriverIO</a> provides a Node package for testing with web driver.</p>\n<h3 id=\"1-start-chromedriver-1\"><a href=\"#1-start-chromedriver-1\">1. Start ChromeDriver</a></h3>\n<p>Primero usted necesita descargar el <code>chromedriver</code> binario, y ejecutarlo:</p>\n<pre><code class=\"hljs language-sh\">$ npm install electron-chromedriver\n$ ./node_modules/.bin/chromedriver --url-base=wd/hub --port=9515\nStarting ChromeDriver (v2.10.291558) on port 9515\nOnly <span class=\"hljs-built_in\">local</span> connections are allowed.\n</code></pre>\n<p>Recuerde el puerto número <code>9515</code>, que usaremos más adelante</p>\n<h3 id=\"2-install-webdriverio\"><a href=\"#2-install-webdriverio\">2. Install WebdriverIO</a></h3>\n<pre><code class=\"hljs language-sh\">$ npm install webdriverio\n</code></pre>\n<h3 id=\"3-connect-to-chrome-driver\"><a href=\"#3-connect-to-chrome-driver\">3. Connect to chrome driver</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webdriverio = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'webdriverio'</span>)\n<span class=\"hljs-keyword\">const</span> options = {\n  <span class=\"hljs-attr\">host</span>: <span class=\"hljs-string\">'localhost'</span>, <span class=\"hljs-comment\">// Use localhost as chrome driver server</span>\n  <span class=\"hljs-attr\">port</span>: <span class=\"hljs-number\">9515</span>, <span class=\"hljs-comment\">// \"9515\" is the port opened by chrome driver.</span>\n  <span class=\"hljs-attr\">desiredCapabilities</span>: {\n    <span class=\"hljs-attr\">browserName</span>: <span class=\"hljs-string\">'chrome'</span>,\n    <span class=\"hljs-string\">'goog:chromeOptions'</span>: {\n      <span class=\"hljs-attr\">binary</span>: <span class=\"hljs-string\">'/Path-to-Your-App/electron'</span>, <span class=\"hljs-comment\">// Path to your Electron binary.</span>\n      <span class=\"hljs-attr\">args</span>: [<span class=\"hljs-comment\">/* cli arguments */</span>] <span class=\"hljs-comment\">// Optional, perhaps 'app=' + /path/to/your/app/</span>\n    }\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> client = webdriverio.remote(options)\n\nclient\n  .init()\n  .url(<span class=\"hljs-string\">'http://google.com'</span>)\n  .setValue(<span class=\"hljs-string\">'#q'</span>, <span class=\"hljs-string\">'webdriverio'</span>)\n  .click(<span class=\"hljs-string\">'#btnG'</span>)\n  .getTitle().then(<span class=\"hljs-function\">(<span class=\"hljs-params\">title</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Title was: '</span> + title)\n  })\n  .end()\n</code></pre>\n<h2 id=\"flujo-de-trabajo\"><a href=\"#flujo-de-trabajo\">Flujo de trabajo</a></h2>\n<p>Para probar su aplicación sin reconstruir Electron, <a href=\"/docs/tutorial/application-distribution\">place</a> el fuente de su aplicación en el directorio de recursos de Electron.</p>\n<p>Alternatively, pass an argument to run with your Electron binary that points to your app's folder. This eliminates the need to copy-paste your app into Electron's resource directory.</p>",
      "title": "Selenium and WebDriver",
      "description": "WebDriver es una herramienta de código abierto para pruebas automatizadas de aplicaciones web en varios navegadores. Provee la capacidad de navegar por páginas web, sistema de usuarios, ejecución de JavaScript, y más. ChromeDriver es un servidor independiente que implementa el protocolo de cable de WebDriver para Chromium. Ha sido desarrollado por miembros de los equipos de Chromium y WebDriver."
    },
    "/docs/development/v8-development": {
      "locale": "es-ES",
      "slug": "v8-development",
      "href": "/docs/development/v8-development",
      "crowdinFileId": "256171",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/v8-development.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"desarrollo-de-v8\"><a href=\"#desarrollo-de-v8\">Desarrollo de V8</a></h1>\n<blockquote>\n<p>Una colección de recursos para aprender y usar V8</p>\n</blockquote>\n<ul>\n<li><a href=\"https://v8.dev/docs/trace\">Seguimiento de V8</a></li>\n<li><a href=\"https://v8.dev/docs/profile\">V8 Profiler</a> - Las combinaciones del generador de perfiles son útiles para perfilar: <code>--prof</code>, <code>--trace-ic</code>, <code>--trace-opt</code>, <code>--trace-deopt</code>, <code>--print-bytecode</code>, <code>--print-opt-code</code></li>\n<li><a href=\"https://docs.google.com/document/d/11T2CRex9hXxoJwbYqVQ32yIPMh0uouUZLdyrtmMoL44/edit?ts=56f27d9d#heading=h.6jz9dj3bnr8t\">Diseño de intérprete V8</a></li>\n<li><a href=\"https://v8.dev/docs/turbofan\">Optimizando el compilador</a></li>\n<li><a href=\"https://v8.dev/docs/gdb-jit\">Depuración de V8 GDB</a></li>\n</ul>\n<p>Vea también <a href=\"/docs/development/chromium-development\">Chromium Development</a></p>",
      "title": "Desarrollo de V8",
      "description": "Una colección de recursos para aprender y usar V8"
    },
    "/docs/api/web-contents": {
      "locale": "es-ES",
      "slug": "web-contents",
      "href": "/docs/api/web-contents",
      "crowdinFileId": "256399",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-contents.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webcontents\"><a href=\"#webcontents\">webContents</a></h1>\n<blockquote>\n<p>Procesamiento y control de páginas webs.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p><code>webContents</code> es un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>. Es responsable de renderizar y controlar una página web y es una propiedad del objeto <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. Un ejemplo de acceso al objeto <code>webContents</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> contents = win.webContents\n<span class=\"hljs-built_in\">console</span>.log(contents)\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>Se pueden acceder a estos métodos desde el módulo <code>webContents</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(webContents)\n</code></pre>\n<h3 id=\"webcontentsgetallwebcontents\"><a href=\"#webcontentsgetallwebcontents\"><code>webContents.getAllWebContents()</code></a></h3>\n<p>Volver <code>WebContents[]</code> a la matriz de todo el caso <code>WebContents</code>. Esto incluirá contenido web para todos los windows, páginas web, devtools abiertos y extensión de páginas de origen devtools.</p>\n<h3 id=\"webcontentsgetfocusedwebcontents\"><a href=\"#webcontentsgetfocusedwebcontents\"><code>webContents.getFocusedWebContents()</code></a></h3>\n<p>Volver <code>WebContents</code> - El contenido web que se centra en esta aplicación, de lo contrario regresa <code>null</code>.</p>\n<h3 id=\"webcontentsfromidid\"><a href=\"#webcontentsfromidid\"><code>webContents.fromId(id)</code></a></h3>\n<ul>\n<li><code>id</code> Íntegro</li>\n</ul>\n<p>Devuelve <code>WebContents</code> | undefined - Una instancia de WebContents con el ID dado, o <code>undefined</code> si no hay WebContents asociados con ID dado.</p>\n<h3 id=\"webcontentsfromdevtoolstargetidtargetid\"><a href=\"#webcontentsfromdevtoolstargetidtargetid\"><code>webContents.fromDevToolsTargetId(targetId)</code></a></h3>\n<ul>\n<li><code>targetId</code> String - The Chrome DevTools Protocol <a href=\"https://chromedevtools.github.io/devtools-protocol/tot/Target/#type-TargetID\">TargetID</a> associated with the WebContents instance.</li>\n</ul>\n<p>Returns <code>WebContents</code> | undefined - A WebContents instance with the given TargetID, or <code>undefined</code> if there is no WebContents associated with the given TargetID.</p>\n<p>When communicating with the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">Chrome DevTools Protocol</a>, it can be useful to lookup a WebContents instance based on its assigned TargetID.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">lookupTargetId</span> (<span class=\"hljs-params\">browserWindow</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> wc = browserWindow.webContents\n  <span class=\"hljs-keyword\">await</span> wc.debugger.attach(<span class=\"hljs-string\">'1.3'</span>)\n  <span class=\"hljs-keyword\">const</span> { targetInfo } = <span class=\"hljs-keyword\">await</span> wc.debugger.sendCommand(<span class=\"hljs-string\">'Target.getTargetInfo'</span>)\n  <span class=\"hljs-keyword\">const</span> { targetId } = targetInfo\n  <span class=\"hljs-keyword\">const</span> targetWebContents = <span class=\"hljs-keyword\">await</span> webContents.fromDevToolsTargetId(targetId)\n}\n</code></pre>\n<h2 id=\"clase-webcontents\"><a href=\"#clase-webcontents\">Clase: WebContents</a></h2>\n<blockquote>\n<p>Renderice y controle el contenido de una instancia de BrowserWindow.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"eventos-de-instancia\"><a href=\"#eventos-de-instancia\">Eventos de Instancia</a></h3>\n<h4 id=\"evento-did-finish-load\"><a href=\"#evento-did-finish-load\">Evento: 'did-finish-load'</a></h4>\n<p>Emite cuando la navegación está hecha, i.e.</p>\n<h4 id=\"evento-did-fail-load\"><a href=\"#evento-did-fail-load\">Evento: 'did-fail-load'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>EsElFramePrincipal</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Este evento es como <code>did-finish-load</code> pero emitido cuando falló la carga. La lista completa de los códigos de error y su significado está disponible <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">aquí</a>.</p>\n<h4 id=\"evento-did-fail-provisional-load\"><a href=\"#evento-did-fail-provisional-load\">Evento: 'did-fail-provisional-load'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>EsElFramePrincipal</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Este evento es como <code>did-fail-load</code> pero emitido cuando la carga fue cancelada (p. e. fue invocado <code>window.stop()</code>).</p>\n<h4 id=\"evento-did-frame-finish-load\"><a href=\"#evento-did-frame-finish-load\">Evento: 'did-frame-finish-load'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>EsElFramePrincipal</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emite cuando un frame ha terminado la navegación.</p>\n<h4 id=\"evento-did-start-loading\"><a href=\"#evento-did-start-loading\">Evento: 'did-start-loading'</a></h4>\n<p>Corresponde a los puntos en el tiempo cuando el girador de la pestaña comenzó a girar.</p>\n<h4 id=\"evento-did-stop-loading\"><a href=\"#evento-did-stop-loading\">Evento: 'did-stop-loading'</a></h4>\n<p>Corresponde a los puntos en tiempo cuando el girador del tabulador terminó de girar.</p>\n<h4 id=\"evento-dom-ready\"><a href=\"#evento-dom-ready\">Evento: 'dom-ready'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n</ul>\n<p>Emitido cuando el documento el el nivel superior está cargado.</p>\n<h4 id=\"evento-page-title-updated\"><a href=\"#evento-page-title-updated\">Evento: 'page-title-updated'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolen</li>\n</ul>\n<p>Disparado cuando el título de la página se configura durante la navegación. <code>explicitSet</code> es false cuando el título es sincronizado desde el archivo url.</p>\n<h4 id=\"evento-page-favicon-updated\"><a href=\"#evento-page-favicon-updated\">Evento: 'page-favicon-updated'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>favicons</code> Cadena[] - Arreglo para URLs.</li>\n</ul>\n<p>Emite cuando la página recibe urls de favicon.</p>\n<h4 id=\"evento-new-window-deprecated\"><a href=\"#evento-new-window-deprecated\">Evento: 'new-window' <em>Deprecated</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code> NewWindowWebContentsEvent</li>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String</li>\n<li><code>disposition</code> String - Puede ser <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> and <code>other</code>.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - Las opciones que serán usadas para crear la nueva <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</li>\n<li><code>additionalFeatures</code> String[] - Las características no estándar (características no manejadas por Chromium o Electron) pasadas a <code>window.open()</code>. Deprecated, and will now always be the empty array <code>[]</code>.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - El remitente que será pasado a la nueva ventana. Puede resultar o no en la cabecera <code>Referer</code> siendo enviado, dependiendo de la política de referencia.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (opcional) - Los datos que serán enviados a la nueva ventana, junto con las cabeceras apropiadas que se establecerán. Si no hay datos para enviar, el valor será <code>null</code>. Solo se define cuando la ventana está siendo creada por un formulario que establece <code>target=_blank</code>.</li>\n</ul>\n<p>Obsoleto a favor de <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>.</p>\n<p>Emitido cuando la página solicita abrir una nueva ventana para una <code>url</code>. Puede ser requerido por <code>window.open</code> o un link externo como <code>&#x3C;a target='_blank'></code>.</p>\n<p>Por defecto se creará un nuevo <code>BrowserWindow</code> para la <code>dirección url</code>.</p>\n<p>Ejecutar <code>event.preventDefault()</code> evitará que Electron cree automáticamente un nuevo <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. Si se llama a <code>event.preventDefault()</code> y se crea manualmente un nuevo <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> entonces se debe activar <code>event.newGuest</code> para referenciar a la nueva instancia de <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>, no hacerlo puede causar un comportamiento inesperado. Por ejemplo:</p>\n<pre><code class=\"hljs language-javascript\">myBrowserWindow.webContents.on(<span class=\"hljs-string\">'new-window'</span>, (event, url, frameName, disposition, options, additionalFeatures, referrer, postBody) => {\n  event.preventDefault()\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webContents</span>: options.webContents, <span class=\"hljs-comment\">// use existing webContents if provided</span>\n    <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span>\n  })\n  win.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => win.show())\n  <span class=\"hljs-keyword\">if</span> (!options.webContents) {\n    <span class=\"hljs-keyword\">const</span> loadOptions = {\n      <span class=\"hljs-attr\">httpReferrer</span>: referrer\n    }\n    <span class=\"hljs-keyword\">if</span> (postBody != <span class=\"hljs-literal\">null</span>) {\n      <span class=\"hljs-keyword\">const</span> { data, contentType, boundary } = postBody\n      loadOptions.postData = postBody.data\n      loadOptions.extraHeaders = <span class=\"hljs-string\">`content-type: <span class=\"hljs-subst\">${contentType}</span>; boundary=<span class=\"hljs-subst\">${boundary}</span>`</span>\n    }\n\n    win.loadURL(url, loadOptions) <span class=\"hljs-comment\">// existing webContents will be navigated automatically</span>\n  }\n  event.newGuest = win\n})\n</code></pre>\n<h4 id=\"evento-did-create-window\"><a href=\"#evento-did-create-window\">Evento: 'did-create-window'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>window</code> Navegador Windows</li>\n<li><code>details</code> Object<ul>\n<li><code>url</code> String - URL de la ventana creada.</li>\n<li><code>frameName</code> String - Nombre dado a la ventana creada en la llamada <code>window.open()</code>.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - Las opciones utilizadas para crear el BrowserWindow. They are merged in increasing precedence: parsed options from the <code>features</code> string from <code>window.open()</code>, security-related webPreferences inherited from the parent, and options given by <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>. Las opciones no reconocidas no están filtradas.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - El remitente que será pasado a la nueva ventana. Puede resultar o no en la cabecera <code>Referer</code> siendo enviado, dependiendo de la política de referencia.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that will be sent to the new window, along with the appropriate headers that will be set. Si no hay datos para enviar, el valor será <code>null</code>. Only defined when the window is being created by a form that set <code>target=_blank</code>.</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> and <code>other</code>.</li>\n</ul></li>\n</ul>\n<p>Emitted <em>after</em> successful creation of a window via <code>window.open</code> in the renderer. No emitido si la creación de la ventana es cancelada desde <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>.</p>\n<p>See <a href=\"/docs/api/window-open\"><code>window.open()</code></a> for more details and how to use this in conjunction with <code>webContents.setWindowOpenHandler</code>.</p>\n<h4 id=\"evento-will-navigate\"><a href=\"#evento-will-navigate\">Evento: 'will-navigate'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitido cuando un usuario o l página quiere empezar la navegación. Puede ocurrir cuando el objeto <code>window.location</code> se cambia o un usuario hace clic en un enlace en la página.</p>\n<p>Este evento no se emitirá cuando la navegación es iniciada con programación con APIs como <code>webContents.loadURL</code> y <code>webContents.back</code>.</p>\n<p>It is also not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<p>Llamando <code>event.preventDefault()</code> evitará la navegación.</p>\n<h4 id=\"evento-did-start-navigation\"><a href=\"#evento-did-start-navigation\">Evento: 'did-start-navigation'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>EsElFramePrincipal</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitido cuando cualquier frame (incluyendo el principal) comienza la navegación. <code>isInPlace</code> will be <code>true</code> for in-page navigations.</p>\n<h4 id=\"evento-will-redirect\"><a href=\"#evento-will-redirect\">Evento: 'will-redirect'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>EsElFramePrincipal</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted as a server side redirect occurs during navigation.  For example a 302 redirect.</p>\n<p>Este evento sera emitido después de <code>did-start-navigation</code> y siempre antes del evento <code>did-redirect-navigation</code> para la misma navegación.</p>\n<p>Llamar a <code>event.preventDefault()</code> evitará la navegación (no solo la redirección).</p>\n<h4 id=\"evento-did-redirect-navigation\"><a href=\"#evento-did-redirect-navigation\">Evento: 'did-redirect-navigation'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>EsElFramePrincipal</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted after a server side redirect occurs during navigation.  For example a 302 redirect.</p>\n<p>Este evento no puede ser prevenir. Si quieres prevenir redirecciones deber ver el evento <code>will-redirect</code> arriba.</p>\n<h4 id=\"evento-did-navigate\"><a href=\"#evento-did-navigate\">Evento: 'did-navigate'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 para navegaciones no HTTP</li>\n<li><code>httpStatusText</code> String - vacío para navegaciones no HTTP</li>\n</ul>\n<p>Emitido cuando se realizo un navegación del frame principal.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h4 id=\"evento-did-frame-navigate\"><a href=\"#evento-did-frame-navigate\">Evento: 'did-frame-navigate'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 para navegaciones no HTTP</li>\n<li><code>httpStatusText</code> String - vacío para navegaciones no HTTP</li>\n<li><code>EsElFramePrincipal</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitido cuando se ha realizado un navegación de algun frame.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h4 id=\"evento-did-navigate-in-page\"><a href=\"#evento-did-navigate-in-page\">Evento: 'did-navigate-in-page'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>url</code> String</li>\n<li><code>EsElFramePrincipal</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitido cuando se produjo una navegación en la página en cualquier frame.</p>\n<p>Cuando una navegación dentro de la página sucede, el URL de la página cambia, pero no causa una navegación fuera de la página. Ejemplos de ésto ocurriendo son cuando los links son clickeados o cuando el evento DOM <code>hashchange</code> es activado.</p>\n<h4 id=\"evento-will-prevent-unload\"><a href=\"#evento-will-prevent-unload\">Evento: 'will-prevent-unload'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n</ul>\n<p>Emite cuando un controlador de eventos <code>beforeunload</code> está tratando de cancelar una descarga de la página.</p>\n<p>Llamando a <code>event.preventDefault()</code> ignorará el controlador de eventos <code>beforeunload</code> y permite que la página sea descargada.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.webContents.on(<span class=\"hljs-string\">'will-prevent-unload'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> choice = dialog.showMessageBoxSync(win, {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'question'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Leave'</span>, <span class=\"hljs-string\">'Stay'</span>],\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Do you want to leave this site?'</span>,\n    <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'Changes you made may not be saved.'</span>,\n    <span class=\"hljs-attr\">defaultId</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">cancelId</span>: <span class=\"hljs-number\">1</span>\n  })\n  <span class=\"hljs-keyword\">const</span> leave = (choice === <span class=\"hljs-number\">0</span>)\n  <span class=\"hljs-keyword\">if</span> (leave) {\n    event.preventDefault()\n  }\n})\n</code></pre>\n<p><strong>Note:</strong> This will be emitted for <code>BrowserViews</code> but will <em>not</em> be respected - this is because we have chosen not to tie the <code>BrowserView</code> lifecycle to its owning BrowserWindow should one exist per the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event\">specification</a>.</p>\n<h4 id=\"evento-crashed-obsoleto\"><a href=\"#evento-crashed-obsoleto\">Evento: 'crashed' <em>Obsoleto</em></a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>killed</code> Booleano</li>\n</ul>\n<p>Emitido cuando el proceso se crashea o es terminado.</p>\n<p><strong>Obsoleto:</strong> Este evento es reemplazado por el evento <code>render-process-gone</code> el cual contiene más información acerca de porque desapareció el renderer process. No siempre se debe a que haya dejado de funcionar.  El booleano <code>killed</code> puede ser reemplazado al comprobar que <code>reason === 'killed'</code> cuando se cambie a ese evento.</p>\n<h4 id=\"evento-render-process-gone\"><a href=\"#evento-render-process-gone\">Evento: 'render-process-gone'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>details</code> Object<ul>\n<li><code>reason</code> String - La razón por la que finalizo el proceso.  Posibles valores:<ul>\n<li><code>clean-exit</code> -El proceso ha finalizado con un exit code de cero</li>\n<li><code>abnormal-exit</code> - El proceso a finalizado con un exit code distinto de cero</li>\n<li><code>killed</code> - El proceso a enviado un SIGTERM o se a finalizado externamente</li>\n<li><code>crashed</code> - El proceso crasheo</li>\n<li><code>oom</code> - El proceso se quedo sin memoria</li>\n<li><code>launch-failed</code> - El proceso nunca se ha ejecutado correctamente</li>\n<li><code>integrity-failure</code> - las verificaciones de integridad de código de Windows fallaron</li>\n</ul></li>\n<li><code>exitCode</code> Integer - El código de salida del proceso, a menos que <code>reason</code> sea <code>launch-failed</code>, en cuyo caso <code>exitCode</code> será un código de error de ejecución especifico de la plataforma.</li>\n</ul></li>\n</ul>\n<p>Emitido cuando el renderer process desaparece inesperadamente.  Esto se debe comúnmente porque se crasheo o cerro.</p>\n<h4 id=\"evento-unresponsive\"><a href=\"#evento-unresponsive\">Evento: \"unresponsive\"</a></h4>\n<p>Aparece cuando la página web deja de responder.</p>\n<h4 id=\"evento-responsive\"><a href=\"#evento-responsive\">Evento: \"responsive\"</a></h4>\n<p>Aparece cuando la página web que no responde vuelve a responder.</p>\n<h4 id=\"evento-plugin-crashed\"><a href=\"#evento-plugin-crashed\">Evento: 'plugin-crashed'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>name</code> String</li>\n<li><code>version</code> Cadena</li>\n</ul>\n<p>Emitido cuando el proceso de enchufe se ha caído.</p>\n<h4 id=\"evento-destroyed\"><a href=\"#evento-destroyed\">Evento: 'destroyed'</a></h4>\n<p>Emitido cuando <code>webContents</code> es destruido.</p>\n<h4 id=\"evento-before-input-event\"><a href=\"#evento-before-input-event\">Evento: 'before-input-event'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>input</code> Object - Input properties.<ul>\n<li><code>type</code> String - Either <code>keyUp</code> or <code>keyDown</code>.</li>\n<li><code>key</code> String - Es igual a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.key</a>.</li>\n<li><code>code</code> String - Es igual a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.code</a>.</li>\n<li><code>isAutoRepeat</code> Boolean - Es igual a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.repeat</a>.</li>\n<li><code>isComposing</code> Boolean - Equivalente a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.isComposing</a>.</li>\n<li><code>shift</code> Boolean - Es igual a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.shiftKey</a>.</li>\n<li><code>control</code> Boolean - Es igual a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.controlKey</a>.</li>\n<li><code>alt</code> Boolean - Es igual a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.altKey</a>.</li>\n<li><code>meta</code> Boolean - Es igual a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.metaKey</a>.</li>\n<li><code>location</code> Number - Equivalente a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.location</a>.</li>\n<li><code>modifiers</code> String[] - Ver <a href=\"/docs/api/structures/input-event\">InputEvent.modifiers</a>.</li>\n</ul></li>\n</ul>\n<p>Emitido antes de enviar los eventos <code>keydown</code> y <code>keyup</code> en la página. Llamando a <code>event.preventDefault</code> evitará la página <code>keydown</code>/ eventos <code>keyup</code> y los accesos rápidos al menú.</p>\n<p>To only prevent the menu shortcuts, use <a href=\"#contentssetignoremenushortcutsignore\"><code>setIgnoreMenuShortcuts</code></a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\nwin.webContents.on(<span class=\"hljs-string\">'before-input-event'</span>, (event, input) => {\n  <span class=\"hljs-comment\">// For example, only enable application menu keyboard shortcuts when</span>\n  <span class=\"hljs-comment\">// Ctrl/Cmd are down.</span>\n  win.webContents.setIgnoreMenuShortcuts(!input.control &#x26;&#x26; !input.meta)\n})\n</code></pre>\n<h4 id=\"evento-enter-html-full-screen\"><a href=\"#evento-enter-html-full-screen\">Evento: \"enter-html-full-screen\"</a></h4>\n<p>Aparece cuando la ventana entra en un estado pantalla completa activado por la API HTML.</p>\n<h4 id=\"evento-leave-html-full-screen\"><a href=\"#evento-leave-html-full-screen\">Evento: \"leave-html-full-screen\"</a></h4>\n<p>Aparece cuando la ventana sale de un estado pantalla completa activado por la API HTML.</p>\n<h4 id=\"evento-zoom-changed\"><a href=\"#evento-zoom-changed\">Evento: 'zoom-changed'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>zoomDirection</code> String - Puede ser <code>in</code> o <code>out</code>.</li>\n</ul>\n<p>Emitido cuando es usuario esta solicitando cambiar el nivel del zoom usando la rueda del ratón.</p>\n<h4 id=\"evento-devtools-opened\"><a href=\"#evento-devtools-opened\">Evento: 'devtools-opened'</a></h4>\n<p>Emitido cuando DevTools es abierto.</p>\n<h4 id=\"evento-devtools-closed\"><a href=\"#evento-devtools-closed\">Evento: 'devtools-closed'</a></h4>\n<p>Emitido cuando Devtools es cerrado.</p>\n<h4 id=\"evento-devtools-focused\"><a href=\"#evento-devtools-focused\">Evento: 'devtools-focused'</a></h4>\n<p>Emitido cuando DevTools es centrado o abierto.</p>\n<h4 id=\"evento-certificate-error\"><a href=\"#evento-certificate-error\">Evento: 'certificate-error'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>url</code> String</li>\n<li><code>error</code> String - The error code.</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">certificate</a></li>\n<li><code>callback</code> Función<ul>\n<li><code>isTrusted</code> Boolean - Indicates whether the certificate can be considered trusted.</li>\n</ul></li>\n<li><code>EsElFramePrincipal</code> Boolean</li>\n</ul>\n<p>Emitido cuando no se pudo verificar el <code>certificate</code> for <code>url</code>.</p>\n<p>El uso es el mismo con <a href=\"/docs/api/app#event-certificate-error\">the <code>certificate-error</code> evento de <code>app</code></a>.</p>\n<h4 id=\"evento-select-client-certificate\"><a href=\"#evento-select-client-certificate\">Evento: 'select-client-certificate'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>url</code> URL</li>\n<li><code>certificateList</code><a href=\"/docs/api/structures/certificate\">Certificate[]</a></li>\n<li><code>callback</code> Función<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> - Must be a certificate from the given list.</li>\n</ul></li>\n</ul>\n<p>Emitido cuando el certificado de un cliente es requerido.</p>\n<p>El uso es el mismo con <a href=\"/docs/api/app#event-select-client-certificate\">the <code>select-client-certificate</code> evento de <code>app</code></a>.</p>\n<h4 id=\"eventologin\"><a href=\"#eventologin\">Evento:'login'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>authenticationResponseDetails</code> Object<ul>\n<li><code>url</code> URL</li>\n</ul></li>\n<li><code>authInfo</code> Object<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>anfitrión</code> Cadena</li>\n<li><code>puerto</code> Íntegro</li>\n<li><code>realm</code> Cadena</li>\n</ul></li>\n<li><code>callback</code> Función<ul>\n<li><code>username</code> String (opcional)</li>\n<li><code>password</code> String (opcional)</li>\n</ul></li>\n</ul>\n<p>Emitido cuando <code>webContents</code> quiere hacer una autenticación básica.</p>\n<p>El uso es lo mismo que con el evento <a href=\"/docs/api/app#event-login\">the <code>login</code> de la <code>app</code></a>.</p>\n<h4 id=\"evento-found-in-page\"><a href=\"#evento-found-in-page\">Evento: 'found-in-page'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>result</code> Object<ul>\n<li><code>requestId</code> Íntegro</li>\n<li><code>activeMatchOrdinal</code> Integer - Posición de la coincidencia activa.</li>\n<li><code>matches</code> Integer - Número de coincidencias.</li>\n<li><code>selectionArea</code> Rectangle - Coordenadas de la primera región de coincidencia.</li>\n<li><code>finalUpdate</code> Boolean</li>\n</ul></li>\n</ul>\n<p>Emitido cuando un resultado está disponible para la petición de [<code>webContents.findInPage</code>].</p>\n<h4 id=\"evento-media-started-playing\"><a href=\"#evento-media-started-playing\">Evento: 'media-started-playing'</a></h4>\n<p>Emitido cuando la media empieza a reproducirse.</p>\n<h4 id=\"evento-media-paused\"><a href=\"#evento-media-paused\">Evento: 'media-paused'</a></h4>\n<p>Emitido cuando la media es pausada o ha terminado de reproducirse.</p>\n<h4 id=\"evento-did-change-theme-color\"><a href=\"#evento-did-change-theme-color\">Evento: 'did-change-theme-color'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>color</code> (String | null) - Theme color is in format of '#rrggbb'. It is <code>null</code> when no theme color is set.</li>\n</ul>\n<p>Emitted when a page's theme color changes. This is usually due to encountering a meta tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">'theme-color'</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">'#ff0000'</span>></span>\n</code></pre>\n<h4 id=\"evento-update-target-url\"><a href=\"#evento-update-target-url\">Evento: 'update-target-url'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitido cuando el mouse se mueve sobre un link o el teclado se mueve el concentrado a un link.</p>\n<h4 id=\"evento-cursor-changed\"><a href=\"#evento-cursor-changed\">Evento: 'cursor-changed'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>type</code> String</li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> (opcional)</li>\n<li><code>scale</code> Float (optional) - scaling factor for the custom cursor.</li>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) - the size of the <code>image</code>.</li>\n<li><code>hotspot</code> <a href=\"/docs/api/structures/point\">Point</a> (optional) - coordinates of the custom cursor's hotspot.</li>\n</ul>\n<p>Emitido cuando el tipo del cursor cambia. El parámetro <code>type</code> puede ser <code>default</code>, <code>crosshair</code>, <code>pointer</code>, <code>text</code>, <code>wait</code>, <code>help</code>, <code>e-resize</code>, <code>n-resize</code>, <code>ne-resize</code>, <code>nw-resize</code>, <code>s-resize</code>, <code>se-resize</code>, <code>sw-resize</code>, <code>w-resize</code>, <code>ns-resize</code>, <code>ew-resize</code>, <code>nesw-resize</code>, <code>nwse-resize</code>, <code>col-resize</code>, <code>row-resize</code>, <code>m-panning</code>, <code>e-panning</code>, <code>n-panning</code>, <code>ne-panning</code>, <code>nw-panning</code>, <code>s-panning</code>, <code>se-panning</code>, <code>sw-panning</code>, <code>w-panning</code>, <code>move</code>, <code>vertical-text</code>, <code>cell</code>, <code>context-menu</code>, <code>alias</code>, <code>progress</code>, <code>nodrop</code>, <code>copy</code>, <code>none</code>, <code>not-allowed</code>, <code>zoom-in</code>, <code>zoom-out</code>, <code>grab</code>, <code>grabbing</code> o <code>custom</code>.</p>\n<p>Si el parámetro <code>type</code> es <code>custom</code>, el parámetro de la <code>image</code> mantendrá la imagen del cursor personalizado en un <a href=\"/docs/api/native-image\"><code>NativeImage</code></a>, <code>scale</code> y <code>size</code>, <code>hotpost</code> mantendrá información adicional sobre el cursor personalizado.</p>\n<h4 id=\"evento-context-menu\"><a href=\"#evento-context-menu\">Evento: 'context-menu'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>params</code> Object<ul>\n<li><code>x</code> Integer - x coordinate.</li>\n<li><code>y</code> Integer - y coordinate.</li>\n<li><code>frame</code> WebFrameMain - Frame desde el cual se invocó el menú contextual.</li>\n<li><code>linkURL</code> String - URL del enlace que incluye el nodo del menú contextual que fue invocado.</li>\n<li><code>linkText</code> String - Text associated with the link. May be an empty string if the contents of the link are an image.</li>\n<li><code>pageURL</code> String - URL de la parte superior del nivel de la página que se invocó en el menú del contexto.</li>\n<li><code>framseURL</code> String - URL de la parte inferior del marco que se invocó en el menú del contexto.</li>\n<li><code>srcURL</code> String - Source URL for the element that the context menu was invoked on. Elements with source URLs are images, audio and video.</li>\n<li><code>mediaTipo</code> String - Tipo de nodo que el menú del contexto fue invocado. Puede ser <code>none</code>, <code>image</code>, <code>audio</code>, <code>video</code>, <code>canvas</code>, <code>file</code> o <code>plugin</code>.</li>\n<li><code>&#x3C;0>tieneImagenContenido</code> Boolean - si el menú del contexto fue invocado en una imagen la cual tiene contenido no vacío.</li>\n<li><code>esEditable</code> Boolean - Si el contexto es editable.</li>\n<li><code>selectrionText</code> String. Texto de la selección la cual el menú del contexto fue invocado.</li>\n<li><code>titleText</code> String - Ttexto del título de la selección en la que se invocó el menú contextual.</li>\n<li><code>altText</code> String - Texto alternativo de la selección en la que se invocó el menú contextual.</li>\n<li><code>suggestedFilename</code> String - Nombre de archivo sugerido para ser usado cuando se guarde el archivo a través de la opción 'Guarde Enlace Como' del menú contextual.</li>\n<li><code>selectionRect</code> <a href=\"/docs/api/structures/rectangle\">Rectángulo</a> - Rectángulo que representa las coordenadas en el espacio del documento de la selección.</li>\n<li><code>SelectionStartOffset</code> Number - Posición inicial del texto de selección.</li>\n<li><code>referrerPolicy</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - La política de referencia del frame en el cual el menú es invocado.</li>\n<li><code>misspelledWord</code> String - La palabra mal escrita bajo el cursor, si cualquiera.</li>\n<li><code>dictionarySuggestions</code> String[] - Un array de palabras sugeridas para mostrar al usuario para remplazar el <code>misspelledWord</code>.  Solo disponible si hay una palabra mal escrita y el corrector está habilitado.</li>\n<li><code>frameCharset</code> String - La codificación de carácteres de la estructura la cual el menú fue invocado.</li>\n<li><code>inputFieldType</code> Cadena - Si se invoca el menú de contexto en un campo de entrada, el tipo de ese campo. Los valores posibles son <code>none</code>, <code>plainText</code>, <code>password</code>, <code>other</code>.</li>\n<li><code>spellcheckEnabled</code> Boolean - Si el contexto es editable, si el corrector ortográfico está habilitado o no.</li>\n<li><code>menuSourceType</code> String - Input source that invoked the context menu. Puede ser <code>none</code>, <code>mouse</code>, <code>keyboard</code>, <code>touch</code>, <code>touchMenu</code>, <code>longPress</code>, <code>longTap</code>, <code>touchHandle</code>, <code>stylus</code>, <code>adjustSelection</code>, o <code>adjustSelectionReset</code>.</li>\n<li><code>mediaFlags</code> Object - The flags for the media element the context menu was invoked on.<ul>\n<li><code>enError</code> Boolean - Si el elemento multimedia se ha dañado.</li>\n<li><code>estáPausado</code> Boolean - Si el elemento multimedia está pausado.</li>\n<li><code>estáSilenciado</code> Boolean - Si el elemento multimedia está silenciado.</li>\n<li><code>tieneAudio</code> Boolean - Si el elemento multimedia tiene audio.</li>\n<li><code>estáLooping</code> Boolean - Si el elemento multimedia está enredado.</li>\n<li><code>esControlVisible</code> Boolean - Si los controles del elemento multimedia son visibles.</li>\n<li><code>puedeToggleControles</code> Boolean - Si los controles de los elementos multimedia son toggleable.</li>\n<li><code>canPrint</code> Boolean - Si el elemento multimedia puede ser impreso.</li>\n<li><code>canSave</code> Boolean - Si el elemento multimedia puede ser descargado o no.</li>\n<li><code>canShowPictureInPicture</code> Boolean - Si el elemento multimedia puede ser mostrado en picture-in-picture.</li>\n<li><code>isShowingPictureInPicture</code> Boolean - Si el elemento multimedia está siendo actualmente mostrado en picture-in-picture.</li>\n<li><code>puedeRotar</code> Boolean - Si el elemento multimedia puede ser rotado.</li>\n<li><code>canLoop</code> Boolean - Si el elemento multimedia puede hacer un loop.</li>\n</ul></li>\n<li><code>editFlags</code> Object - These flags indicate whether the renderer believes it is able to perform the corresponding action.<ul>\n<li><code>canUndo</code> Boolean - Si cree que el procesador puede deshacer.</li>\n<li><code>canRedo</code> Boolean - Si cree que el procesador pueda rehacer.</li>\n<li><code>canCut</code> Boolean - Si cree que el procesador puede cortar.</li>\n<li><code>canCopy</code> Boolean - Si cree que el procesador puede copiar.</li>\n<li><code>canPaste</code> Boolean - Si cree que el procesador puede pegar.</li>\n<li><code>canDelete</code> Boolean - Si cree que el procesador puede borrar.</li>\n<li><code>canSelectAll</code> Boolean - Si cree que el procesador puede seleccionar todo.</li>\n<li><code>canEditRichly</code> Boolean - Si el renderer cree que puede editar texto de forma enriquecedora.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Emitido cuando hay un nuevo menú de contexto que debe ser manejado.</p>\n<h4 id=\"evento-select-bluetooth-device\"><a href=\"#evento-select-bluetooth-device\">Evento: 'select-bluetooth-device'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>devices</code> <a href=\"/docs/api/structures/bluetooth-device\">BluetoothDevice[]</a></li>\n<li><code>callback</code> Función<ul>\n<li><code>deviceId</code> String</li>\n</ul></li>\n</ul>\n<p>Emite cuando el dispositivo bluetooth necesita ser seleccionado en la llamada <code>navigator.bluetooth.requestDevice</code>. Para usar <code>navigator.bluetooth</code> api <code>webBluetooth</code> debe ser activada. Si no se llama <code>event.preventDefault</code> el primer dispositivo disponible será seleccionado. <code>callback</code> puede ser llamado con <code>deviceId</code> ser seleccionado,.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'enable-experimental-web-platform-features'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.webContents.on(<span class=\"hljs-string\">'select-bluetooth-device'</span>, (event, deviceList, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> result = deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.deviceName === <span class=\"hljs-string\">'test'</span>\n    })\n    <span class=\"hljs-keyword\">if</span> (!result) {\n      callback(<span class=\"hljs-string\">''</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      callback(result.deviceId)\n    }\n  })\n})\n</code></pre>\n<h4 id=\"evento-paint\"><a href=\"#evento-paint\">Evento: 'paint'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>dirtyRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> - La información de la imagen de todo el fotograma.</li>\n</ul>\n<p>Emitted when a new frame is generated. Only the dirty area is passed in the buffer.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">offscreen</span>: <span class=\"hljs-literal\">true</span> } })\nwin.webContents.on(<span class=\"hljs-string\">'paint'</span>, (event, dirty, image) => {\n  <span class=\"hljs-comment\">// updateBitmap(dirty, image.getBitmap())</span>\n})\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n</code></pre>\n<h4 id=\"evento-devtools-reload-page\"><a href=\"#evento-devtools-reload-page\">Evento: 'devtools-reload-page'</a></h4>\n<p>Emitido cuando la ventana devtools instruya la webContents para recargar</p>\n<h4 id=\"evento-will-attach-webview\"><a href=\"#evento-will-attach-webview\">Evento: 'will-attach-webview'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>webPreferences</code> WebPreferences - The web preferences that will be used by the guest page. This object can be modified to adjust the preferences for the guest page.</li>\n<li><code>params</code> Record&#x3C;string, string> - The other <code>&#x3C;webview></code> parameters such as the <code>src</code> URL. This object can be modified to adjust the parameters of the guest page.</li>\n</ul>\n<p>Emitted when a <code>&#x3C;webview></code>'s web contents is being attached to this web contents. Calling <code>event.preventDefault()</code> will destroy the guest page.</p>\n<p>Este evento puede utilizarse para configurar <code>webPreferences</code> para la <code>webContents</code> de un <code>&#x3C;webview></code>antes de que se carga y proporciona la capacidad de configuración que no se puede establecer a través de atributos <code>&#x3C;webview></code>.</p>\n<p><strong>Nota:</strong> La opción específica de <code>preload</code> aparecerá como <code>preloadURL</code> (no <code>preload</code>) en el objeto <code>webPreferences</code> emitido con este evento.</p>\n<h4 id=\"event-did-attach-webview\"><a href=\"#event-did-attach-webview\">Event: 'did-attach-webview'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>webContents</code> WebContents - El contenido de la página web invitada que será usado por <code>&#x3C;webview></code>.</li>\n</ul>\n<p>Emitido cuando se ha adjuntado un <code>&#x3C;webview></code> a este contenido web.</p>\n<h4 id=\"evento-console-message\"><a href=\"#evento-console-message\">Evento: 'console-message'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>level</code> Entero - El nivel de registro, desde 0 hasta 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>message</code> String - The actual console message</li>\n<li><code>line</code> Entero - El número de línea de la fuente que activó este mensaje de consola</li>\n<li><code>sourceId</code> Cadena</li>\n</ul>\n<p>Emitido cuando la ventana asociada registra un mensaje de consola.</p>\n<h4 id=\"evento-error-preload\"><a href=\"#evento-error-preload\">Evento: 'error-preload'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>preloadPath</code> String</li>\n<li><code>error</code> Error</li>\n</ul>\n<p>Emitido cuando el script de preload <code>preloadPath</code>lanza una excepción no manejada <code>error</code>.</p>\n<h4 id=\"evento-ipc-message\"><a href=\"#evento-ipc-message\">Evento: 'ipc-message'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>channel</code> Cadena</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Emitido cuando el proceso de renderizado enviá un mensaje asíncrono a través de <code>ipcRenderer.send()</code>.</p>\n<h4 id=\"evento-ipc-message-sync\"><a href=\"#evento-ipc-message-sync\">Evento: 'ipc-message-sync'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>channel</code> Cadena</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Emitido cuando el proceso de renderizado envía un mensaje sincronídico a través de <code>ipcRenderer.sendSync()</code>.</p>\n<h4 id=\"event-desktop-capturer-get-sources\"><a href=\"#event-desktop-capturer-get-sources\">Event: 'desktop-capturer-get-sources'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n</ul>\n<p>Emitted when <code>desktopCapturer.getSources()</code> is called in the renderer process. Llamando a <code>event.preventDefault()</code> hará que devuelva fuentes vacías.</p>\n<h4 id=\"evento-preferred-size-changed\"><a href=\"#evento-preferred-size-changed\">Evento: 'preferred-size-changed'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>preferredSize</code> <a href=\"/docs/api/structures/size\">Size</a> - The minimum size needed to contain the layout of the document—without requiring scrolling.</li>\n</ul>\n<p>Emitted when the <code>WebContents</code> preferred size has changed.</p>\n<p>This event will only be emitted when <code>enablePreferredSizeMode</code> is set to <code>true</code> in <code>webPreferences</code>.</p>\n<h4 id=\"evento-frame-created\"><a href=\"#evento-frame-created\">Evento: 'frame-created'</a></h4>\n<p>Devuelve:</p>\n<ul>\n<li><code>event</code></li>\n<li><code>details</code> Object<ul>\n<li><code>frame</code> WebFrameMain</li>\n</ul></li>\n</ul>\n<p>Emitido cuando el <a href=\"/docs/api/web-contents#contentsmainframe-readonly\">mainFrame</a>, un <code>&#x3C;iframe></code>, o un anidado <code>&#x3C;iframe></code> es cargado dentro de la página.</p>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<h4 id=\"contentsloadurlurl-options\"><a href=\"#contentsloadurlurl-options\"><code>contents.loadURL(url[, options])</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (opcional) - Una url HTTP Referencia.</li>\n<li><code>userAgent</code> Cadena (opcional) - Un agente de usuario originando el pedido.</li>\n<li><code>extraHeaders</code> String (optional) - Extra headers separated by \"\\n\".</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (opcional) - Url base (con separadores de ruta arrastrables) para archivos que se cargan por el url de datos. Esto es necesario únicamente si el <code>url</code> especificado es un url de datos y necesita cargar otros archivos.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code> - la promesa se resolverá cuando la página ha finalizado de cargar (mira <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), y rechaza si la página falla al cargar (mira<a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>). Un manejador de rechazo noop ya esta adjunto, el cual evita errores de rechazo no controlados.</p>\n<p>Carga el <code>url</code> en la ventana. El <code>url</code> debe contener el prefijo de protocolo. Por ejemplo <code>http://</code> o <code>file://</code>. Si la carga debe omitir el caché http entonces hay que utilizar el encabezado <code>pragma</code> para lograrlo.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> options = { <span class=\"hljs-attr\">extraHeaders</span>: <span class=\"hljs-string\">'pragma: no-cache\\n'</span> }\nwebContents.loadURL(<span class=\"hljs-string\">'https://github.com'</span>, options)\n</code></pre>\n<h4 id=\"contentsloadfilefilepath-options\"><a href=\"#contentsloadfilefilepath-options\"><code>contents.loadFile(filePath[, options])</code></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>query</code> Record&#x3C;String, String> (opcional) - Pasado a <code>url.format()</code>.</li>\n<li><code>search</code> String (opcional) - Pasado a <code>url.format()</code>.</li>\n<li><code>hash</code> String (opcional) - Pasado a <code>url.format()</code>.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code> - la promesa sera resolvida cuando la página haya finalizado de cargar (mira <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), y será rechazada si la pagina falla al cargar (mira <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Loads the given file in the window, <code>filePath</code> should be a path to an HTML file relative to the root of your application.  For instance an app structure like this:</p>\n<pre><code class=\"hljs language-sh\">| root\n| - package.json\n| - src\n|   - main.js\n|   - index.html\n</code></pre>\n<p>Requeriría un código como este</p>\n<pre><code class=\"hljs language-js\">win.loadFile(<span class=\"hljs-string\">'src/index.html'</span>)\n</code></pre>\n<h4 id=\"contentsdownloadurlurl\"><a href=\"#contentsdownloadurlurl\"><code>contents.downloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Inicia una descarga del recurso en <code>url</code> sin navegar. The <code>will-download</code> event of <code>session</code> will be triggered.</p>\n<h4 id=\"contentsgeturl\"><a href=\"#contentsgeturl\"><code>contents.getURL()</code></a></h4>\n<p>Devuelve <code>String</code> - El URL de la página web actual.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> currentURL = win.webContents.getURL()\n  <span class=\"hljs-built_in\">console</span>.log(currentURL)\n})\n</code></pre>\n<h4 id=\"contentsgettitle\"><a href=\"#contentsgettitle\"><code>contents.getTitle()</code></a></h4>\n<p>Devuelve <code>String</code> - El título de la página web actual.</p>\n<h4 id=\"contentsisdestroyed\"><a href=\"#contentsisdestroyed\"><code>contents.isDestroyed()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la página web fue destruida o no.</p>\n<h4 id=\"contentsfocus\"><a href=\"#contentsfocus\"><code>contents.focus()</code></a></h4>\n<p>Enfoca la página web.</p>\n<h4 id=\"contentsisfocused\"><a href=\"#contentsisfocused\"><code>contents.isFocused()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si se enfocó o no la página web.</p>\n<h4 id=\"contentsisloading\"><a href=\"#contentsisloading\"><code>contents.isLoading()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si todavía la página web está cargando recursos.</p>\n<h4 id=\"contentsisloadingmainframe\"><a href=\"#contentsisloadingmainframe\"><code>contents.isLoadingMainFrame()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si el marco principal (y no sólo iframes o frames dentro de él) todavía está cargando.</p>\n<h4 id=\"contentsiswaitingforresponse\"><a href=\"#contentsiswaitingforresponse\"><code>contents.isWaitingForResponse()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si la página web espera una primera respuesta desde el recurso principal de la página.</p>\n<h4 id=\"contentsstop\"><a href=\"#contentsstop\"><code>contents.stop()</code></a></h4>\n<p>Detiene cualquier navegación pendiente.</p>\n<h4 id=\"contentsreload\"><a href=\"#contentsreload\"><code>contents.reload()</code></a></h4>\n<p>Recarga la página web actual.</p>\n<h4 id=\"contentsreloadignoringcache\"><a href=\"#contentsreloadignoringcache\"><code>contents.reloadIgnoringCache()</code></a></h4>\n<p>Recarga la página actual e ignora el caché.</p>\n<h4 id=\"contentscangoback\"><a href=\"#contentscangoback\"><code>contents.canGoBack()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si el navegador puede volver a la página web anterior.</p>\n<h4 id=\"contentscangoforward\"><a href=\"#contentscangoforward\"><code>contents.canGoForward()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si el navegador puede avanzar a la siguiente página web.</p>\n<h4 id=\"contentscangotooffsetoffset\"><a href=\"#contentscangotooffsetoffset\"><code>contents.canGoToOffset(offset)</code></a></h4>\n<ul>\n<li><code>offset</code> Íntegro</li>\n</ul>\n<p>Devuelve <code>Boolean</code> - Si la página web puede ir a <code>offset</code>.</p>\n<h4 id=\"contentsclearhistory\"><a href=\"#contentsclearhistory\"><code>contents.clearHistory()</code></a></h4>\n<p>Borra el historial de navegación.</p>\n<h4 id=\"contentsgoback\"><a href=\"#contentsgoback\"><code>contents.goBack()</code></a></h4>\n<p>Hace que el navegador regrese a una página web.</p>\n<h4 id=\"contentsgoforward\"><a href=\"#contentsgoforward\"><code>contents.goForward()</code></a></h4>\n<p>Hace que el navegador avance a una página web.</p>\n<h4 id=\"contentsgotoindexindex\"><a href=\"#contentsgotoindexindex\"><code>contents.goToIndex(index)</code></a></h4>\n<ul>\n<li><code>index</code> Íntegro</li>\n</ul>\n<p>Navega al índice de página web absoluta especificado.</p>\n<h4 id=\"contentsgotooffsetoffset\"><a href=\"#contentsgotooffsetoffset\"><code>contents.goToOffset(offset)</code></a></h4>\n<ul>\n<li><code>offset</code> Íntegro</li>\n</ul>\n<p>Navega hacia el offset especificado desde \"la entrada actual\".</p>\n<h4 id=\"contentsiscrashed\"><a href=\"#contentsiscrashed\"><code>contents.isCrashed()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si el proceso de renderizado ha fallado.</p>\n<h4 id=\"contentsforcefullycrashrenderer\"><a href=\"#contentsforcefullycrashrenderer\"><code>contents.forcefullyCrashRenderer()</code></a></h4>\n<p>Forzosamente termina el renderer process que actualmente aloja este <code>webContents</code>. Esto hará que sea emitido el evento <code>render-process-gone</code> con el <code>reason=killed || reason=crashed</code>. Tenga en cuenta que algunos webContents comparten el renderer process y por lo tanto llamar a este método puede causar que se bloque el proceso también para otros wevContents.</p>\n<p>Llamar a <code>reload()</code> inmediatamente después de llamar a este método forzará que la recarga ocurra en un nuevo proceso. Esto debería ser usado cuando el proceso es inestable o inutilizable, por ejemplo parar recuperar del evento <code>unresponsive</code>.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'unresponsive'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> { response } = <span class=\"hljs-keyword\">await</span> dialog.showMessageBox({\n    <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'App X has become unresponsive'</span>,\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Do you want to try forcefully reloading the app?'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'OK'</span>, <span class=\"hljs-string\">'Cancel'</span>],\n    <span class=\"hljs-attr\">cancelId</span>: <span class=\"hljs-number\">1</span>\n  })\n  <span class=\"hljs-keyword\">if</span> (response === <span class=\"hljs-number\">0</span>) {\n    contents.forcefullyCrashRenderer()\n    contents.reload()\n  }\n})\n</code></pre>\n<h4 id=\"contentssetuseragentuseragent\"><a href=\"#contentssetuseragentuseragent\"><code>contents.setUserAgent(userAgent)</code></a></h4>\n<ul>\n<li><code>userAgent</code> cadena</li>\n</ul>\n<p>Anula el agente usuario para esta página web.</p>\n<h4 id=\"contentsgetuseragent\"><a href=\"#contentsgetuseragent\"><code>contents.getUserAgent()</code></a></h4>\n<p>Devuelve <code>String</code> - El agente usuario para esta página web.</p>\n<h4 id=\"contentsinsertcsscss-options\"><a href=\"#contentsinsertcsscss-options\"><code>contents.insertCSS(css[, options])</code></a></h4>\n<ul>\n<li><code>css</code> Cadena</li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>cssOrigin</code> String (optional) - Can be either 'user' or 'author'; Specifying 'user' enables you to prevent websites from overriding the CSS you insert. Default is 'author'.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;String></code> - Una promesa que resuelve con una llave para el CSS insertado que puede ser utilizado más tarde para eliminar el CSS a través <code>contents.removeInsertedCSS(key)</code>.</p>\n<p>Inyecta CSS en la página web actual y devuelve un identificador único para la hoja de estilo insertada.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n  contents.insertCSS(<span class=\"hljs-string\">'html, body { background-color: #f00; }'</span>)\n})\n</code></pre>\n<h4 id=\"contentsremoveinsertedcsskey\"><a href=\"#contentsremoveinsertedcsskey\"><code>contents.removeInsertedCSS(key)</code></a></h4>\n<ul>\n<li><code>llave</code> Cadena</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code> - Resuelve si la eliminación fue exitosa.</p>\n<p>Elimina el CSS insertado desde la página web actual. La hoja de estilos se identifica por su clave, el cual es devuelto desde <code>contents.insertCSS(css)</code>.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'did-finish-load'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> key = <span class=\"hljs-keyword\">await</span> contents.insertCSS(<span class=\"hljs-string\">'html, body { background-color: #f00; }'</span>)\n  contents.removeInsertedCSS(key)\n})\n</code></pre>\n<h4 id=\"contentsexecutejavascriptcode-usergesture\"><a href=\"#contentsexecutejavascriptcode-usergesture\"><code>contents.executeJavaScript(code[, userGesture])</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (opcional) - Predeterminado es <code>falso</code>.</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;any></code> - Una promesa que resuelve con el resultado de la ejecución del código o es rechazada si el resultado del código es una promesa rechazada.</p>\n<p>Evalúa el <code>código</code> en la página.</p>\n<p>En la ventana del navegador, algunas API HTML como <code>requestFullScreen</code> solo pueden invocarse con un gesto del usuario. Establecer <code>userGesture</code> a <code>true</code> eliminará esta limitación.</p>\n<p>La ejecución de código se suspenderá hasta que la pagina pare de cargarse.</p>\n<pre><code class=\"hljs language-js\">contents.executeJavaScript(<span class=\"hljs-string\">'fetch(\"https://jsonplaceholder.typicode.com/users/1\").then(resp => resp.json())'</span>, <span class=\"hljs-literal\">true</span>)\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">result</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(result) <span class=\"hljs-comment\">// Will be the JSON object from the fetch call</span>\n  })\n</code></pre>\n<h4 id=\"contentsexecutejavascriptinisolatedworldworldid-scripts-usergesture\"><a href=\"#contentsexecutejavascriptinisolatedworldworldid-scripts-usergesture\"><code>contents.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture])</code></a></h4>\n<ul>\n<li><code>worldId</code> Integer - El ID de la palabra para correr javascript en, <code>0</code> es el mundo por defecto, <code>999</code> es el mundo usado por la característica <code>contextIsolation</code> de Electron.  Aquí puede suministrar cualquier entero.</li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/web-source\">WebSource[]</a></li>\n<li><code>userGesture</code> Boolean (opcional) - Predeterminado es <code>falso</code>.</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;any></code> - Una promesa que resuelve con el resultado de la ejecución del código o es rechazada si el resultado del código es una promesa rechazada.</p>\n<p>Funciona como <code>executeJavaScript</code> pero evaluá <code>scripts</code> en un contexto aislado.</p>\n<h4 id=\"contentssetignoremenushortcutsignore\"><a href=\"#contentssetignoremenushortcutsignore\"><code>contents.setIgnoreMenuShortcuts(ignore)</code></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n</ul>\n<p>Ignora los accesos directos del menú de la aplicación mientras se enfoca los contenidos de la web.</p>\n<h4 id=\"contentssetwindowopenhandlerhandler\"><a href=\"#contentssetwindowopenhandlerhandler\"><code>contents.setWindowOpenHandler(handler)</code></a></h4>\n<ul>\n<li>\n<p><code>handler</code> Función&#x3C;{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}></p>\n<ul>\n<li><code>details</code> Object<ul>\n<li><code>url</code> String - La versión <em>resuelta</em> de la URL pasada a <code>window.open()</code>. por ejemplo una ventana con <code>window.open('foo')</code> producirá algo como <code>https://the-origin/the/current/path/foo</code>.</li>\n<li><code>frameName</code> String - Nombre de la ventana proporcionado en <code>window.open()</code></li>\n<li><code>features</code> String - Lista separada por coma de la características de ventana proporcionada a <code>window.open()</code>.</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> or <code>other</code>.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - El remitente que será pasado a la nueva ventana. Puede resultar o no en la cabecera <code>Referer</code> siendo enviado, dependiendo de la política de referencia.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (opcional) - Los datos que serán enviados a la nueva ventana, junto con las cabeceras apropiadas que se establecerán. Si no hay datos para enviar, el valor será <code>null</code>. Solo se define cuando la ventana está siendo creada por un formulario que establece <code>target=_blank</code>.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}</code> - <code>deny</code> cancela la creación de la nueva ventana. <code>allow</code> permitirá la que se cree la nueva ventana. Especificando <code>overrideBrowserWindowOptions</code> permite la personalización de la ventana creada. Devolver un valor no reconocido como un null, undefined o un objeto sin una 'action' reconocida resultará en un error de consola tiene el mismo efecto que devolver <code>{action: 'deny'}</code>.</p>\n</li>\n</ul>\n<p>Llamado antes de crear una ventana un solicitud de nueva ventana es solicitada por el renderer, p.e. por <code>window.open()</code>, un enlace con <code>target=\"_blank\"</code>, shift+pulsando en un enlace, o enviando un formulario con <code>&#x3C;form target=\"_blank\"></code>. Ver <a href=\"/docs/api/window-open\"><code>window.open()</code></a> Para más detalles y como usar esto en conjunción con <code>did-create-window</code>.</p>\n<h4 id=\"contentssetaudiomutedmuted\"><a href=\"#contentssetaudiomutedmuted\"><code>contents.setAudioMuted(muted)</code></a></h4>\n<ul>\n<li><code>muted</code> Boolean</li>\n</ul>\n<p>Silencia el audio la página web actual.</p>\n<h4 id=\"contentsisaudiomuted\"><a href=\"#contentsisaudiomuted\"><code>contents.isAudioMuted()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si esta página ha sido silenciada.</p>\n<h4 id=\"contentsiscurrentlyaudible\"><a href=\"#contentsiscurrentlyaudible\"><code>contents.isCurrentlyAudible()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si el audio se esta reproduciendo actualmente.</p>\n<h4 id=\"contentssetzoomfactorfactor\"><a href=\"#contentssetzoomfactorfactor\"><code>contents.setZoomFactor(factor)</code></a></h4>\n<ul>\n<li><code>factor</code> Double - Factor de zoom; por defecto es 1.0.</li>\n</ul>\n<p>Cambia el nivel de zoom al nivel especificado. Factor de zoom es porcentaje de zoom dividido entre 100, así que 300% = 3.0.</p>\n<p>El factor debe ser mayor que 0.0.</p>\n<h4 id=\"contentsgetzoomfactor\"><a href=\"#contentsgetzoomfactor\"><code>contents.getZoomFactor()</code></a></h4>\n<p>Devuelve <code>Number</code> - el factor de zoom actual.</p>\n<h4 id=\"contentssetzoomlevellevel\"><a href=\"#contentssetzoomlevellevel\"><code>contents.setZoomLevel(level)</code></a></h4>\n<ul>\n<li><code>nivel</code> Número - Nivel de Zoom.</li>\n</ul>\n<p>Cambia el nivel de zoom al nivel especificado. El tamaño original es 0 y cada incremento por encima o por debajo representa un zoom del 20% mayor o menor a los límites predeterminados de 300% y 50% del tamaño original, respectivamente. La fórmula para esto es <code>scale := 1.2 ^ level</code>.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h4 id=\"contentsgetzoomlevel\"><a href=\"#contentsgetzoomlevel\"><code>contents.getZoomLevel()</code></a></h4>\n<p>Devuelve <code>Number</code> - el nivel de zoom actual.</p>\n<h4 id=\"contentssetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#contentssetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>contents.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h4>\n<ul>\n<li><code>minimumLevel</code> Número</li>\n<li><code>maximumLevel</code> Número</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code></p>\n<p>Establecer el nivel de máximo y mínimo pizca de zoom.</p>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom is disabled by default in Electron. To re-enable it, call:</p>\n<pre><code class=\"hljs language-js\">contents.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">3</span>)\n</code></pre>\n</blockquote>\n<h4 id=\"contentsundo\"><a href=\"#contentsundo\"><code>contents.undo()</code></a></h4>\n<p>Ejecuta el comando de edición <code>undo</code> en la página web.</p>\n<h4 id=\"contentsredo\"><a href=\"#contentsredo\"><code>contents.redo()</code></a></h4>\n<p>Ejecuta el comando de edición <code>redo</code> en la página web.</p>\n<h4 id=\"contentscut\"><a href=\"#contentscut\"><code>contents.cut()</code></a></h4>\n<p>Ejecuta el comando de edición <code>cut</code> en la página web.</p>\n<h4 id=\"contentscopy\"><a href=\"#contentscopy\"><code>contents.copy()</code></a></h4>\n<p>Ejecuta el comando de edición <code>copy</code> en la página web.</p>\n<h4 id=\"contentscopyimageatx-y\"><a href=\"#contentscopyimageatx-y\"><code>contents.copyImageAt(x, y)</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Copia la imagen en la posición determinada al portapapeles.</p>\n<h4 id=\"contentspaste\"><a href=\"#contentspaste\"><code>contents.paste()</code></a></h4>\n<p>Ejecuta el comando de edición <code>paste</code> en la página web.</p>\n<h4 id=\"contentspasteandmatchstyle\"><a href=\"#contentspasteandmatchstyle\"><code>contents.pasteAndMatchStyle()</code></a></h4>\n<p>Ejecuta el comando de edición <code>pasteAndMatchStyle</code> en la página web.</p>\n<h4 id=\"contentsdelete\"><a href=\"#contentsdelete\"><code>contents.delete()</code></a></h4>\n<p>Ejecuta el comando de edición <code>delete</code> en la página web.</p>\n<h4 id=\"contentsselectall\"><a href=\"#contentsselectall\"><code>contents.selectAll()</code></a></h4>\n<p>Ejecuta el comando de edición <code>selectAll</code> en la página web.</p>\n<h4 id=\"contentsunselect\"><a href=\"#contentsunselect\"><code>contents.unselect()</code></a></h4>\n<p>Ejecuta el comando de edición <code>unselect</code> en la página web.</p>\n<h4 id=\"contentsreplacetext\"><a href=\"#contentsreplacetext\"><code>contents.replace(text)</code></a></h4>\n<ul>\n<li><code>texto</code> Cadena</li>\n</ul>\n<p>Ejecuta el comando de edición <code>replace</code> en la página web.</p>\n<h4 id=\"contentsreplacemisspellingtext\"><a href=\"#contentsreplacemisspellingtext\"><code>contents.replaceMisspelling(text)</code></a></h4>\n<ul>\n<li><code>texto</code> Cadena</li>\n</ul>\n<p>Ejecuta el comando de edición <code>replaceMisspelling</code> en página web.</p>\n<h4 id=\"contentsinserttexttext\"><a href=\"#contentsinserttexttext\"><code>contents.insertText(text)</code></a></h4>\n<ul>\n<li><code>texto</code> Cadena</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code></p>\n<p>Inserta <code>texto</code> en el elemento enfocado.</p>\n<h4 id=\"contentsfindinpagetext-options\"><a href=\"#contentsfindinpagetext-options\"><code>contents.findInPage(text[, options])</code></a></h4>\n<ul>\n<li><code>text</code> String - El contenido para ser buscado, no debe quedar en blanco.</li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>forward</code> Boolean (opcional) - Ya sea para buscar hacia adelante o hacia atrás, el valor predeterminado es <code>true</code>.</li>\n<li><code>findNext</code> Boolean (optional) - Whether to begin a new text finding session with this request. Should be <code>true</code> for initial requests, and <code>false</code> for follow-up requests. Por defecto es <code>false</code>.</li>\n<li><code>matchCase</code> Boolean (opcional) - Si la busqueda debe ser sensible a mayúsculas, por defecto es <code>false</code>.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Integer</code> - El id de la solicitud usado para la solicitud.</p>\n<p>Empieza una solicitud para encontrar todas las coincidencias para el <code>text</code> en la página web. El resultado de la solicitud puede ser obtenida suscribiendote al evento <a href=\"/docs/api/web-contents#event-found-in-page\"><code>found-in-page</code></a>.</p>\n<h4 id=\"contentsstopfindinpageaction\"><a href=\"#contentsstopfindinpageaction\"><code>contents.stopFindInPage(action)</code></a></h4>\n<ul>\n<li><code>action</code> String - Specifies the action to take place when ending [<code>webContents.findInPage</code>] request.<ul>\n<li><code>clearSelection</code> - Borrar la selección.</li>\n<li><code>keepSelection</code> - Traduce la selección en una selección normal.</li>\n<li><code>activateSelection</code> - Enfoca y hace clic en el nodo de selección.</li>\n</ul></li>\n</ul>\n<p>Detiene cualquier solicitud <code>findInPage</code> para el <code>webContents</code> con la <code>action</code> proporcionada.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nwebContents.on(<span class=\"hljs-string\">'found-in-page'</span>, (event, result) => {\n  <span class=\"hljs-keyword\">if</span> (result.finalUpdate) webContents.stopFindInPage(<span class=\"hljs-string\">'clearSelection'</span>)\n})\n\n<span class=\"hljs-keyword\">const</span> requestId = webContents.findInPage(<span class=\"hljs-string\">'api'</span>)\n<span class=\"hljs-built_in\">console</span>.log(requestId)\n</code></pre>\n<h4 id=\"contentscapturepagerect\"><a href=\"#contentscapturepagerect\"><code>contents.capturePage([rect])</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (opcional) - El área de la página para ser capturada.</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;NativeImage></code> - Resuelve con el un <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Captura una foto instantánea de la página dentro de <code>rect</code>. Omitiendo <code>rect</code> capturará toda la página visible.</p>\n<h4 id=\"contentsisbeingcaptured\"><a href=\"#contentsisbeingcaptured\"><code>contents.isBeingCaptured()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si esta página está siendo capturada. Devuelve true cuando el recuento de capturadores es mas grande que 0.</p>\n<h4 id=\"contentsincrementcapturercountsize-stayhidden-stayawake\"><a href=\"#contentsincrementcapturercountsize-stayhidden-stayawake\"><code>contents.incrementCapturerCount([size, stayHidden, stayAwake])</code></a></h4>\n<ul>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Tamaño</a> (opcional) - El tamaño preferido para el capturador.</li>\n<li><code>stayHidden</code> Boolean (opcional) - Mantiene la página oculta en lugar de visible.</li>\n<li><code>stayAwake</code> Boolean (optional) -  Keep the system awake instead of allowing it to sleep.</li>\n</ul>\n<p>Incrementa el contador de captura en uno. La página es considerada visible cuando su ventana de navegador está oculta y el recuento del capturador no es cero. Si le gustaría que la página permanezca oculta, debería asegurarse que <code>stayHidden</code> está establecido a true.</p>\n<p>Esto también afecta a la API de visibilidad de la página.</p>\n<h4 id=\"contentsdecrementcapturercountstayhidden-stayawake\"><a href=\"#contentsdecrementcapturercountstayhidden-stayawake\"><code>contents.decrementCapturerCount([stayHidden, stayAwake])</code></a></h4>\n<ul>\n<li><code>stayHidden</code> Boolean (opcional) - Mantiene la página en estado oculto en lugar de visible.</li>\n<li><code>stayAwake</code> Boolean (optional) -  Keep the system awake instead of allowing it to sleep.</li>\n</ul>\n<p>Disminuye el recuento del capturador en uno. La página se establecerá en el estado oculto u ocluido cuando la ventana del navegador esté oculta u ocluida y el recuento del capturador llegue a cero. Si quiere disminuir el contador del caputador en su lugar debería establecer <code>stayHidden</code> a true.</p>\n<h4 id=\"contentsgetprinters\"><a href=\"#contentsgetprinters\"><code>contents.getPrinters()</code></a></h4>\n<p>Obtiene la lista de impresora del sistema.</p>\n<p>Devuelve <a href=\"/docs/api/structures/printer-info\"><code>PrinterInfo[]</code></a></p>\n<h4 id=\"contentsprintoptions-callback\"><a href=\"#contentsprintoptions-callback\"><code>contents.print([options], [callback])</code></a></h4>\n<ul>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>silent</code> Boolean (optional) - Don't ask user for print settings. Por defecto es <code>false</code>.</li>\n<li><code>printBackground</code> Boolean (optional) - Prints the background color and image of the web page. Por defecto es <code>false</code>.</li>\n<li><code>deviceName</code> String (optional) - Set the printer device name to use. Must be the system-defined name and not the 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.</li>\n<li><code>color</code> Boolean (optional) - Set whether the printed web page will be in color or grayscale. Por defecto es <code>true</code>.</li>\n<li><code>margins</code> Object (opcional)<ul>\n<li><code>marginType</code> String (opcional) - Puede ser <code>default</code>, <code>none</code>, <code>printableArea</code>, o <code>custom</code>. Si <code>custom</code> es elegido, además necesitar especificar <code>top</code>, <code>bottom</code>, <code>left</code>, y <code>right</code>.</li>\n<li><code>top</code> Number (opcional) - El margen superior de la página web impresa, en píxeles.</li>\n<li><code>bottom</code> Number (opcional) - El margen inferior de la página web impresa, en píxeles.</li>\n<li><code>left</code> Number (opcional) - El margen izquierdo de la página web impresa, en píxeles.</li>\n<li><code>right</code> Number (opcional) - El margen derecho de la página web impresa, en píxeles.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - Whether the web page should be printed in landscape mode. Por defecto es <code>false</code>.</li>\n<li><code>scaleFactor</code> Number (opcional) - El factor de escalado de la página web.</li>\n<li><code>pagesPerSheet</code> Number (opcional) - El número de páginas a imprimir por hoja de página.</li>\n<li><code>collate</code> Boolean (opcional) - Si la página web debe ser intercalada.</li>\n<li><code>copies</code> Number (opcional) - El número de copias de la página web a imprimir.</li>\n<li><code>pageRanges</code> Object<a href=\"/docs/api/optional\"></a> - The page range to print. On macOS, only one range is honored.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Índice de la última página a imprimir (inclusive) (0-based).</li>\n</ul></li>\n<li><code>duplexMode</code> String (optional) - Set the duplex mode of the printed web page. Puede ser <code>simplex</code>, <code>shortEdge</code>, o <code>longEdge</code>.</li>\n<li><code>dpi</code> Record&#x3C;string, number> (opcional)<ul>\n<li><code>horizontal</code> Number (opcional) - El dpi horizontal.</li>\n<li><code>vertical</code> Number (opcional) - El dpi vertical.</li>\n</ul></li>\n<li><code>header</code> String (opcional) - Cadena a ser impresa como cabecera de la página.</li>\n<li><code>footer</code> String (opcional) - Cadena a ser impresa como pie de página.</li>\n<li><code>pageSize</code> String | Tamaño (opcional) - Especifique el tamaño de página del documento impreso. Puede ser <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> o un objeto que contenga <code>height</code>.</li>\n</ul></li>\n<li><code>retrocallback</code> Funcion (opcional)<ul>\n<li><code>success</code> Boolean - Indica el éxito de la llamada impresa.</li>\n<li><code>failureReason</code> String - Descripción del error llamada de nuevo si la impresión falla.</li>\n</ul></li>\n</ul>\n<p>Cuando es pasado un <code>pageSize</code> personalizado, Chromium intenta validar los valores mínimos específicos de la plataforma para <code>width_microns</code> y <code>height_microns</code>. Ambos anchura y altura deben ser mínimamente 353 microns, pero puede ser más grande en algunos sistemas operativos.</p>\n<p>Imprime la página web de la ventana. Cuando <code>silent</code> está establecido a <code>true</code>, Electron tomará la impresora predeterminada del sistema si <code>deviceName</code> está vacío y las configuraciones por defecto para imprimir.</p>\n<p>Utilizar el estilo CCS <code>page-break-before: always;</code> para imprimir a la fuerza una página nueva.</p>\n<p>Ejemplo de uso:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> options = {\n  <span class=\"hljs-attr\">silent</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">deviceName</span>: <span class=\"hljs-string\">'My-Printer'</span>,\n  <span class=\"hljs-attr\">pageRanges</span>: [{\n    <span class=\"hljs-attr\">from</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">to</span>: <span class=\"hljs-number\">1</span>\n  }]\n}\nwin.webContents.print(options, (success, errorType) => {\n  <span class=\"hljs-keyword\">if</span> (!success) <span class=\"hljs-built_in\">console</span>.log(errorType)\n})\n</code></pre>\n<h4 id=\"contentsprinttopdfoptions\"><a href=\"#contentsprinttopdfoptions\"><code>contents.printToPDF(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>headerFooter</code> Record&#x3C;string, string> (opcional) - el encabezado y el pie de página para el PDF.<ul>\n<li><code>title</code> String - El título para el encabezado PDF.</li>\n<li><code>url</code> String - la url para el pie de página PDF.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (opcional) - <code>true</code> for landscape, <code>false</code> para portrait.</li>\n<li><code>marginsType</code> Integer (optional) - Specifies the type of margins to use. Uses 0 for default margin, 1 for no margin, and 2 for minimum margin.</li>\n<li><code>scaleFactor</code> Number (opcional) - El factor de escalado de la página web. Puede variar entre 0 to 100.</li>\n<li><code>pageRanges</code> Record&#x3C;string, number> (optional) - The page range to print.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Índice de la última página a imprimir (inclusive) (0-based).</li>\n</ul></li>\n<li><code>pageSize</code> String | Size (opcional) - Especifica el tamaño de la página del PDF generado. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code> and <code>width</code> in microns.</li>\n<li><code>printBackground</code> Boolean (octional) - Si se va a imprimir los fondos CSS.</li>\n<li><code>printSelectionOnly</code> Boolean (opcional) - Se va a imprimir solo la selección.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Buffer></code> - Se resuelve cuando los datos PDF son generados.</p>\n<p>Imprime la página web de la ventana como PDF con la configuración personalizada de impresión previa de Chromium.</p>\n<p>El <code>landscape</code> se ignorará si <code>@page</code> CSS at-rule es utilizado en la página web.</p>\n<p>Por defecto, una <code>options</code> en blanco se considerará como:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">marginsType</span>: <span class=\"hljs-number\">0</span>,\n  <span class=\"hljs-attr\">printBackground</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">printSelectionOnly</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">landscape</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">pageSize</span>: <span class=\"hljs-string\">'A4'</span>,\n  <span class=\"hljs-attr\">scaleFactor</span>: <span class=\"hljs-number\">100</span>\n}\n</code></pre>\n<p>Utilizar el estilo CCS <code>page-break-before: always;</code> para imprimir a la fuerza una página nueva.</p>\n<p>Un ejemplo de <code>webContents.printToPDF</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n<span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\nwin.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n  <span class=\"hljs-comment\">// Use default printing options</span>\n  win.webContents.printToPDF({}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">data</span> =></span> {\n    <span class=\"hljs-keyword\">const</span> pdfPath = path.join(os.homedir(), <span class=\"hljs-string\">'Desktop'</span>, <span class=\"hljs-string\">'temp.pdf'</span>)\n    fs.writeFile(pdfPath, data, (error) => {\n      <span class=\"hljs-keyword\">if</span> (error) <span class=\"hljs-keyword\">throw</span> error\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Wrote PDF successfully to <span class=\"hljs-subst\">${pdfPath}</span>`</span>)\n    })\n  }).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">error</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Failed to write PDF to <span class=\"hljs-subst\">${pdfPath}</span>: `</span>, error)\n  })\n})\n</code></pre>\n<h4 id=\"contentsaddworkspacepath\"><a href=\"#contentsaddworkspacepath\"><code>contents.addWorkSpace(path)</code></a></h4>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Agrega la ruta especificada al workspace de DevTools. Debe ser usado después de la creación de DevTools:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.on(<span class=\"hljs-string\">'devtools-opened'</span>, () => {\n  win.webContents.addWorkSpace(__dirname)\n})\n</code></pre>\n<h4 id=\"contentsremoveworkspacepath\"><a href=\"#contentsremoveworkspacepath\"><code>contents.removeWorkSpace(path)</code></a></h4>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Elimina la ruta especificada del espacio de trabajo de DevTools.</p>\n<h4 id=\"contentssetdevtoolswebcontentsdevtoolswebcontents\"><a href=\"#contentssetdevtoolswebcontentsdevtoolswebcontents\"><code>contents.setDevToolsWebContents(devToolsWebContents)</code></a></h4>\n<ul>\n<li><code>devToolsWebContents</code> WebContents</li>\n</ul>\n<p>Usa el <code>devToolsWebContents</code> como objetivo <code>WebContents</code> para mostrar devtools.</p>\n<p>El <code>devToolsWebContents</code> no debe tener ninguna ninguna navegación, y este no debería ser usado para otros propósitos después de la llamada.</p>\n<p>Por defecto Electron maneja el devtools creando un <code>WebContents</code> interno con un vista nativa, de lo cual los desarrolladores tienen un control muy limitado. Con el método <code>setDevToolsWebContents</code>, los desarrolladores pueden usar algún <code>WebContents</code> para mostrar el devtools en él, incluyendo la etiqueta <code>BrowserWindow</code>, <code>BrowserView</code> y <code>&#x3C;webview></code>.</p>\n<p>Tenga en cuenta que cerrando el devtools no se destruye el <code>devToolsWebContents</code>, es responsabilidad del que llamo destruir el <code>devToolsWebContents</code>.</p>\n<p>Un ejemplo de mostrar devtools en una etiqueta <code>&#x3C;webview></code>:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">style</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/css\"</span>></span><span class=\"css\">\n    * { <span class=\"hljs-attribute\">margin</span>: <span class=\"hljs-number\">0</span>; }\n    <span class=\"hljs-selector-id\">#browser</span> { <span class=\"hljs-attribute\">height</span>: <span class=\"hljs-number\">70%</span>; }\n    <span class=\"hljs-selector-id\">#devtools</span> { <span class=\"hljs-attribute\">height</span>: <span class=\"hljs-number\">30%</span>; }\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">style</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"browser\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"devtools\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"about:blank\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n    <span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n    <span class=\"hljs-keyword\">const</span> emittedOnce = <span class=\"hljs-function\">(<span class=\"hljs-params\">element, eventName</span>) =></span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> {\n      element.addEventListener(eventName, event => resolve(event), { <span class=\"hljs-attr\">once</span>: <span class=\"hljs-literal\">true</span> })\n    })\n    <span class=\"hljs-keyword\">const</span> browserView = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'browser'</span>)\n    <span class=\"hljs-keyword\">const</span> devtoolsView = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'devtools'</span>)\n    <span class=\"hljs-keyword\">const</span> browserReady = emittedOnce(browserView, <span class=\"hljs-string\">'dom-ready'</span>)\n    <span class=\"hljs-keyword\">const</span> devtoolsReady = emittedOnce(devtoolsView, <span class=\"hljs-string\">'dom-ready'</span>)\n    <span class=\"hljs-built_in\">Promise</span>.all([browserReady, devtoolsReady]).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      <span class=\"hljs-keyword\">const</span> targetId = browserView.getWebContentsId()\n      <span class=\"hljs-keyword\">const</span> devtoolsId = devtoolsView.getWebContentsId()\n      ipcRenderer.send(<span class=\"hljs-string\">'open-devtools'</span>, targetId, devtoolsId)\n    })\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain, webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'open-devtools'</span>, (event, targetContentsId, devtoolsContentsId) => {\n  <span class=\"hljs-keyword\">const</span> target = webContents.fromId(targetContentsId)\n  <span class=\"hljs-keyword\">const</span> devtools = webContents.fromId(devtoolsContentsId)\n  target.setDevToolsWebContents(devtools)\n  target.openDevTools()\n})\n</code></pre>\n<p>Un ejemplo de mostrar devtools en un <code>BrowserWindow</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n<span class=\"hljs-keyword\">let</span> devtools = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  devtools = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  win.webContents.setDevToolsWebContents(devtools.webContents)\n  win.webContents.openDevTools({ <span class=\"hljs-attr\">mode</span>: <span class=\"hljs-string\">'detach'</span> })\n})\n</code></pre>\n<h4 id=\"contentsopendevtoolsoptions\"><a href=\"#contentsopendevtoolsoptions\"><code>contents.openDevTools([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>mode</code> String - Abre las herramientas del desarrollador con el estado de dock especificado, puede ser <code>right</code>, <code>bottom</code>, <code>undocked</code>, <code>detach</code>. Por defecto se utiliza el último estado de dock. En el modo <code>undocked</code> es posible acoplarse de nuevo. En el modo <code>detach</code> no se puede.</li>\n<li><code>activate</code> Boolean (optional) - Whether to bring the opened devtools window to the foreground. El valor por defecto es <code>true</code>.</li>\n</ul></li>\n</ul>\n<p>Abre las herramientas del desarrolador.</p>\n<p>Cuando <code>contents</code> es un tag <code>&#x3C;webview></code>, el <code>mode</code> debería ser <code>detach</code> por defecto, explícitamente pasando un <code>mode</code> vacío puede forzar el uso del último estado del dock.</p>\n<h4 id=\"contentsclosedevtools\"><a href=\"#contentsclosedevtools\"><code>contents.closeDevTools()</code></a></h4>\n<p>Cierra las devtools.</p>\n<h4 id=\"contentsisdevtoolsopened\"><a href=\"#contentsisdevtoolsopened\"><code>contents.isDevToolsOpened()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si se abren las herramientas del desarrollador.</p>\n<h4 id=\"contentsisdevtoolsfocused\"><a href=\"#contentsisdevtoolsfocused\"><code>contents.isDevToolsFocused()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si se enfoca la vista de las herramientas del desarrollador .</p>\n<h4 id=\"contentstoggledevtools\"><a href=\"#contentstoggledevtools\"><code>contents.toggleDevTools()</code></a></h4>\n<p>Alterna las herramientas de desarrollador.</p>\n<h4 id=\"contentsinspectelementx-y\"><a href=\"#contentsinspectelementx-y\"><code>contents.inspectElement(x, y)</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Empieza a inspeccionar elementos en la posición (<code>x</code>, <code>y</code>).</p>\n<h4 id=\"contentsinspectsharedworker\"><a href=\"#contentsinspectsharedworker\"><code>contents.inspectSharedWorker()</code></a></h4>\n<p>Abre las herramientas de desarrollador para el contexto de los trabajadores compartidos.</p>\n<h4 id=\"contentsinspectsharedworkerbyidworkerid\"><a href=\"#contentsinspectsharedworkerbyidworkerid\"><code>contents.inspectSharedWorkerById(workerId)</code></a></h4>\n<ul>\n<li>Cadena <code>workerId</code></li>\n</ul>\n<p>Inspecciona el worker compartido basado en su ID.</p>\n<h4 id=\"contentsgetallsharedworkers\"><a href=\"#contentsgetallsharedworkers\"><code>contents.getAllSharedWorkers()</code></a></h4>\n<p>Devuelve <a href=\"/docs/api/structures/shared-worker-info\"><code>SharedWorkerInfo[]</code></a> - Información acerca de todos los Workers Compartidos.</p>\n<h4 id=\"contentsinspectserviceworker\"><a href=\"#contentsinspectserviceworker\"><code>contents.inspectServiceWorker()</code></a></h4>\n<p>Abre las herramientas de desarrollador para el contexto del trabajador de servicio.</p>\n<h4 id=\"contentssendchannel-args\"><a href=\"#contentssendchannel-args\"><code>contents.send(channel, ...args)</code></a></h4>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Envía un mensaje asíncrono al render process a través de <code>channel</code>, junto con los argumentos. Los argumentos serán serializados con el <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured CloneAlgorithm</a>, al igual que <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>postMessage</code></a>, así que las cadenas del prototipo no estarán incluidas. El envío de funciones, promesas, símbolos, WeakMaps o WeakSets lanzará una excepción.</p>\n<blockquote>\n<p><strong>NOTA</strong>: Enviar tipos de JavaScript no estándar tales como objetos DOM o objetos especiales de Electron lanzará una excepción.</p>\n</blockquote>\n<p>El proceso de renderizado puede manejar el mensaje escuchando el <code>canal</code> con el módulo <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a>.</p>\n<p>Un ejemplo de envío de mensajes desde el proceso principal al proceso de renderizado:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">/// In the main process.</span>\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/index.html`</span>)\n  win.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n    win.webContents.send(<span class=\"hljs-string\">'ping'</span>, <span class=\"hljs-string\">'whoooooooh!'</span>)\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- index.html --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n    <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).ipcRenderer.on(<span class=\"hljs-string\">'ping'</span>, (event, message) => {\n      <span class=\"hljs-built_in\">console</span>.log(message) <span class=\"hljs-comment\">// Prints 'whoooooooh!'</span>\n    })\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<h4 id=\"contentssendtoframeframeid-channel-args\"><a href=\"#contentssendtoframeframeid-channel-args\"><code>contents.sendToFrame(frameId, channel, ...args)</code></a></h4>\n<ul>\n<li><code>frameId</code> Integer | [number, number] - the ID of the frame to send to, or a pair of <code>[processId, frameId]</code> if the frame is in a different process to the main frame.</li>\n<li><code>channel</code> Cadena</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Envía un mensaje asíncrono al frame especifico en un renderer process a través de <code>channel</code>, junto con los argumentos. Los argumentos serán serializados con el <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured CloneAlgorithm</a>, al igual que <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>postMessage</code></a>, así que las cadenas del prototipo no estarán incluidas. El envío de funciones, promesas, símbolos, WeakMaps o WeakSets lanzará una excepción.</p>\n<blockquote>\n<p><strong>NOTA</strong>: Enviar tipos de JavaScript no estándar tales como objetos DOM o objetos especiales de Electron lanzará una excepción.</p>\n</blockquote>\n<p>El proceso de renderizado puede manejar el mensaje escuchando el <code>canal</code> con el módulo <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a>.</p>\n<p>Si quieres obtener el <code>frameId</code> de un renderer context dado deberías usar el valor <code>webFrame.routingId</code>.  P.e.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// In a renderer process</span>\n<span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'My frameId is:'</span>, <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).webFrame.routingId)\n</code></pre>\n<p>También puede leer el <code>frameId</code> de todos los mensajes IPC entrantes en el proceso principal.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// In the main process</span>\nipcMain.on(<span class=\"hljs-string\">'ping'</span>, (event) => {\n  <span class=\"hljs-built_in\">console</span>.info(<span class=\"hljs-string\">'Message came from frameId:'</span>, event.frameId)\n})\n</code></pre>\n<h4 id=\"contentspostmessagechannel-message-transfer\"><a href=\"#contentspostmessagechannel-message-transfer\"><code>contents.postMessage(channel, message, [transfer])</code></a></h4>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>mensaje</code> cualquiera</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Envía un mensaje al renderer process, transfiriendo opcionalmente la propiedad de cero o más objetos [<code>MessagePortMain</code>][].</p>\n<p>Los objetos <code>MessagePortMain</code> transferidos estarán disponible en el renderer process accediendo a la propiedad <code>ports</code> del evento emitido. Cuando llegan al renderer, serán objetos DOM <code>MessagePort</code> nativos.</p>\n<p>Por ejemplo:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nwebContents.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<h4 id=\"contentsenabledeviceemulationparameters\"><a href=\"#contentsenabledeviceemulationparameters\"><code>contents.enableDeviceEmulation(parameters)</code></a></h4>\n<ul>\n<li>Objeto <code>parameters</code><ul>\n<li><code>screenPosition</code> String - Specify the screen type to emulate (default: <code>desktop</code>):<ul>\n<li><code>desktop</code> - El tipo de la pantalla de escritorio.</li>\n<li><code>mobile</code> - El tipo de la pantalla móvil.</li>\n</ul></li>\n<li><code>screenSize</code> <a href=\"/docs/api/structures/size\">Size</a> - Configura el tamaño de la pantalla emulada (screenPosition == mobile).</li>\n<li><code>viewPosition</code> <a href=\"/docs/api/structures/point\">Point</a> - Posiciona la vista sobre la pantalla (screenPosition == mobile) (por defecto: <code>{ x: 0, y: 0 }</code>).</li>\n<li><code>deviceScaleFactor</code> Integer - Configura el factor escala del dispositivo (si es cero regresa por defecto al factor de escala original del dispositivo) (por defecto: <code>0</code>).</li>\n<li><code>viewSize</code> <a href=\"/docs/api/structures/size\">Size</a> - Configura el tamaño de la vista emulada (en blanco significa que no hay anulación)</li>\n<li><code>scale</code> Float - Escala de la vista emulada dentro del espacio disponible (no dentro del modo vista) (por defecto: <code>1</code>).</li>\n</ul></li>\n</ul>\n<p>Habilita la emulación del dispositivo con los parámetros predeterminados.</p>\n<h4 id=\"contentsdisabledeviceemulation\"><a href=\"#contentsdisabledeviceemulation\"><code>contents.disableDeviceEmulation()</code></a></h4>\n<p>Deshabilita la emulación del dispositivo habilitado por <code>webContents.enableDeviceEmulation</code>.</p>\n<h4 id=\"contentssendinputeventinputevent\"><a href=\"#contentssendinputeventinputevent\"><code>contents.sendInputEvent(inputEvent)</code></a></h4>\n<ul>\n<li><code>inputEvent</code> <a href=\"/docs/api/structures/mouse-input-event\">MouseInputEvent</a> | <a href=\"/docs/api/structures/mouse-wheel-input-event\">MouseWheelInputEvent</a> | <a href=\"/docs/api/structures/keyboard-input-event\">KeyboardInputEvent</a></li>\n</ul>\n<p>Envía un input <code>event</code> a la página. <strong>Nota:</strong> El <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> que contiene los contenidos necesita estar enfocado para que <code>sendInputEvent()</code> trabaje.</p>\n<h4 id=\"contentsbeginframesubscriptiononlydirty-callback\"><a href=\"#contentsbeginframesubscriptiononlydirty-callback\"><code>contents.beginFrameSubscription([onlyDirty ,]callback)</code></a></h4>\n<ul>\n<li><code>onlyDirty</code> Boolean (opcional) - Por defecto es <code>false</code>.</li>\n<li><code>callback</code> Función<ul>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a></li>\n<li><code>dirtyRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul></li>\n</ul>\n<p>Empezar suscripción para eventos de presentación y capturas de fotogramas, la <code>callback</code> sera llamada con <code>callback(image, dirtyRect)</code> cuando hay un evento de presentación.</p>\n<p>La <code>image</code> es una instancia de <a href=\"/docs/api/native-image\">NativeImage</a> que almacena el fotograma capturado.</p>\n<p>El <code>dirtyRect</code> es un objeto con propiedades <code>x, y, width, height</code> que describe cual parte de la página fue pintada de nuevo. Si <code>onlyDirty</code> está configurado a <code>true</code>, <code>image</code> solo contendrá el área repintada. <code>onlyDirty</code> por defecto en <code>false</code>.</p>\n<h4 id=\"contentsendframesubscription\"><a href=\"#contentsendframesubscription\"><code>contents.endFrameSubscription()</code></a></h4>\n<p>Finalizar suscripción para eventos de presentación de marcos.</p>\n<h4 id=\"contentsstartdragitem\"><a href=\"#contentsstartdragitem\"><code>contents.startDrag(item)</code></a></h4>\n<ul>\n<li>Objeto <code>item</code><ul>\n<li><code>file</code> String - La ruta al archivo que está siendo arrastrado.</li>\n<li><code>files</code> String<a href=\"/docs/api/opcional\"></a> - Las rutas a los archivos que están siendo arrastrados. (<code>files</code> anulará el campo <code>file</code>)</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String - La imagen no debe estar vacía en on macOS.</li>\n</ul></li>\n</ul>\n<p>Configura el <code>item</code> como un elemento arrastrable para la operación drag-drop actual. El <code>file</code> es la ruta absoluta del archivo que se va a arrastrar, y <code>icon</code> es la imagen que se muestra debajo del cursor cuando se arrastra.</p>\n<h4 id=\"contentssavepagefullpath-savetype\"><a href=\"#contentssavepagefullpath-savetype\"><code>contents.savePage(fullPath, saveType)</code></a></h4>\n<ul>\n<li><code>fullPath</code> String - La ruta completa del archivo.</li>\n<li><code>saveType</code> String - Specify the save type.<ul>\n<li><code>HTMLOnly</code> - Guarda solamente el HTML de la página.</li>\n<li><code>HTMLComplete</code> - Guarda una página html completa.</li>\n<li><code>MHTML</code> - Guarda una página html completa como MHTML.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code> - resuelve si la pagina se guardo.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\nwin.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  win.webContents.savePage(<span class=\"hljs-string\">'/tmp/test.html'</span>, <span class=\"hljs-string\">'HTMLComplete'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Page was saved successfully.'</span>)\n  }).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(err)\n  })\n})\n</code></pre>\n<h4 id=\"contentsshowdefinitionforselection-macos\"><a href=\"#contentsshowdefinitionforselection-macos\"><code>contents.showDefinitionForSelection()</code> <em>macOS</em></a></h4>\n<p>Muestra un diccionario que busca la palabra seleccionada en la página.</p>\n<h4 id=\"contentsisoffscreen\"><a href=\"#contentsisoffscreen\"><code>contents.isOffscreen()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Indica si <em>offscreen rendering</em> está habilitado o no.</p>\n<h4 id=\"contentsstartpainting\"><a href=\"#contentsstartpainting\"><code>contents.startPainting()</code></a></h4>\n<p>Si <em>offscreen rendering</em> está habilitado y no pinta, comienza a pintar.</p>\n<h4 id=\"contentsstoppainting\"><a href=\"#contentsstoppainting\"><code>contents.stopPainting()</code></a></h4>\n<p>Si <em>offscreen rendering</em> está habilitado y pinta, deja de pintar.</p>\n<h4 id=\"contentsispainting\"><a href=\"#contentsispainting\"><code>contents.isPainting()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - Si <em>offscreen rendering</em> está habilitado devuelve lo que esté pintando en ese momento.</p>\n<h4 id=\"contentssetframeratefps\"><a href=\"#contentssetframeratefps\"><code>contents.setFrameRate(fps)</code></a></h4>\n<ul>\n<li><code>fps</code> Integer</li>\n</ul>\n<p>Si <em>offscreen rendering</em> está activada establece el radio del frame al número especificado. Sólo se aceptan valores entre 1 y 240.</p>\n<h4 id=\"contentsgetframerate\"><a href=\"#contentsgetframerate\"><code>contents.getFrameRate()</code></a></h4>\n<p>Devuelve <code>Integer</code> - Si <em>offscreen rendering</em> esta habilitado devuelve el indice de fotogramas en ese momento.</p>\n<h4 id=\"contentsinvalidate\"><a href=\"#contentsinvalidate\"><code>contents.invalidate()</code></a></h4>\n<p>Programa un repintado completo de la ventana en la que se encuentra este contenido web.</p>\n<p>Si <em>offscreen rendering</em> está habilitado invalida el fotograma y genera uno nuevo a través del evento <code>'paint'</code>.</p>\n<h4 id=\"contentsgetwebrtciphandlingpolicy\"><a href=\"#contentsgetwebrtciphandlingpolicy\"><code>contents.getWebRTCIPHandlingPolicy()</code></a></h4>\n<p>Devuelve <code>String</code> - Devuelve el WebRTC IP Handling Policy.</p>\n<h4 id=\"contentssetwebrtciphandlingpolicypolicy\"><a href=\"#contentssetwebrtciphandlingpolicypolicy\"><code>contents.setWebRTCIPHandlingPolicy(policy)</code></a></h4>\n<ul>\n<li><code>policy</code> String - Specify the WebRTC IP Handling Policy.<ul>\n<li><code>default</code> - Revela los IPs locales y publicos del usuario. Este es el comportamiento por defecto. Cuando se usa esta política, WebRTC tiene el derecho de enumerar todas las interfaces y vincularlas para descubrir interfaces públicas.</li>\n<li><code>default_public_interface_only</code> - Revela el IP público del usuario pero no revela el IP local del usuario. Cuando se usa esta política, WebRTC solo debe usar la ruta predeterminada utilizada por http. Esto no expone ninguna dirección local.</li>\n<li><code>default_public_and_private_interfaces</code> - Revela los IPs público y local del usuario. Cuando se usa esta política, WebRTC solo debe usar la ruta predeterminada utilizada por http. Esto también expone la dirección privada predeterminada asociada. La ruta predeterminada es la ruta elegida por el SO en un punto final multitarjeta.</li>\n<li><code>disable_non_proxied_udp</code> - Does not expose public or local IPs. When this policy is used, WebRTC should only use TCP to contact peers or servers unless the proxy server supports UDP.</li>\n</ul></li>\n</ul>\n<p>La configuración de política de manejo WebRTC IP, le permite controlar cuales IPs son expuestas a través de WebRTC. Vea <a href=\"https://browserleaks.com/webrtc\">BrowserLeaks</a> para más detalles.</p>\n<h4 id=\"contentsgetosprocessid\"><a href=\"#contentsgetosprocessid\"><code>contents.getOSProcessId()</code></a></h4>\n<p>Devuelve <code>Integer</code> - El <code>pid</code> del sistema operativo, del proceso de renderizado asociado.</p>\n<h4 id=\"contentsgetprocessid\"><a href=\"#contentsgetprocessid\"><code>contents.getProcessId()</code></a></h4>\n<p>Devuelve <code>Integer</code> - El <code>pid</code> interno de Chromium del renderizador asociado. Puede ser comparado con el <code>frameProcessId</code> pasado por los eventos de navegación específicos del frame (e.g. <code>did-frame-navigate</code>)</p>\n<h4 id=\"contentstakeheapsnapshotfilepath\"><a href=\"#contentstakeheapsnapshotfilepath\"><code>contents.takeHeapSnapshot(filePath)</code></a></h4>\n<ul>\n<li><code>filePath</code> String - Ruta al archivo de salida.</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code> - Indica si la instantánea se ha creado correctamente.</p>\n<p>Toma una instantánea de la pila V8 y la guarda en <code>filePath</code>.</p>\n<h4 id=\"contentsgetbackgroundthrottling\"><a href=\"#contentsgetbackgroundthrottling\"><code>contents.getBackgroundThrottling()</code></a></h4>\n<p>Devuelve <code>Boolean</code> - si este contenido web acelerará o no animaciones y temporizadores cuando la página se haga de fondo. Esto también afecta a la API de visibilidad de la página.</p>\n<h4 id=\"contentssetbackgroundthrottlingallowed\"><a href=\"#contentssetbackgroundthrottlingallowed\"><code>contents.setBackgroundThrottling(allowed)</code></a></h4>\n<ul>\n<li><code>allowed</code> Boolean</li>\n</ul>\n<p>Controla si este WebContents acelerará o no las animaciones y los temporizadores cuando la página pasa a segundo plano. Esto también afecta a la API de visibilidad de la página.</p>\n<h4 id=\"contentsgettype\"><a href=\"#contentsgettype\"><code>contents.getType()</code></a></h4>\n<p>Devuelve <code>String</code> - el tipo de webContent. Puede ser <code>backgroundPage</code>, <code>window</code>, <code>browserView</code>, <code>remote</code>, <code>webview</code> o <code>offscreen</code>.</p>\n<h4 id=\"contentssetimageanimationpolicypolicy\"><a href=\"#contentssetimageanimationpolicypolicy\"><code>contents.setImageAnimationPolicy(policy)</code></a></h4>\n<ul>\n<li><code>policy</code> String - Puede ser <code>animate</code>, <code>animateOnce</code> o <code>noAnimation</code>.</li>\n</ul>\n<p>Establece la política de animación de imágenes para este webContents.  La política solo afecta a imágenes <em>new</em>, las imágenes que se está animando actualmente no son afectadas. Esta es una limitación conocida en Chromium, puede forzar que la animación de la imagen sea recalculada con <code>img.src = img.src</code> lo cual no dará como resultado tráfico de red pero actualizará la política de la animación.</p>\n<p>Esto corresponde a la característica de accesibilidad <a href=\"https://developer.chrome.com/docs/extensions/reference/accessibilityFeatures/#property-animationPolicy\">animationPolicy</a> en Chromium.</p>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<h4 id=\"contentsaudiomuted\"><a href=\"#contentsaudiomuted\"><code>contents.audioMuted</code></a></h4>\n<p>Una propiedad <code>Boolean</code> que determina si la página está silenciada.</p>\n<h4 id=\"contentsuseragent\"><a href=\"#contentsuseragent\"><code>contents.userAgent</code></a></h4>\n<p>Una propiedad <code>String</code> que determina el user agent para esta página web.</p>\n<h4 id=\"contentszoomlevel\"><a href=\"#contentszoomlevel\"><code>contents.zoomLevel</code></a></h4>\n<p>Una propiedad <code>Number</code> que determina el nivel de zoom de este contenido web.</p>\n<p>El tamaño original es 0 y cada incremento por encima o por debajo representa un zoom del 20% mayor o menor a los límites predeterminados de 300% y 50% del tamaño original, respectivamente. La formula para esto es <code>scale := 1.2 ^ level</code>.</p>\n<h4 id=\"contentszoomfactor\"><a href=\"#contentszoomfactor\"><code>contents.zoomFactor</code></a></h4>\n<p>Una propiedad <code>Number</code> que determina el facto del zoom para este contenido web.</p>\n<p>El factor de zoom es el porcentaje de zoom dividido entre 100, por lo que 300% = 3.0.</p>\n<h4 id=\"contentsframerate\"><a href=\"#contentsframerate\"><code>contents.frameRate</code></a></h4>\n<p>Una propiedad <code>Integer</code> que establece el ratio del frame del contenido web al número especificado. Sólo se aceptan valores entre 1 y 240.</p>\n<p>Solo aplicable si <em>offscreen rendering</em> está habilitado.</p>\n<h4 id=\"contentsid-sololectura\"><a href=\"#contentsid-sololectura\"><code>contents.id</code> <em>SoloLectura</em></a></h4>\n<p>Un <code>Integer</code> representando el ID único de este WebContents. Cada ID es único entre todas las instancias <code>WebContents</code> de toda la aplicación Electron.</p>\n<h4 id=\"contentssession-sololectura\"><a href=\"#contentssession-sololectura\"><code>contents.session</code> <em>SoloLectura</em></a></h4>\n<p>Un <a href=\"/docs/api/session\"><code>Session</code></a> usado por este webContents.</p>\n<h4 id=\"contentshostwebcontents-sololectura\"><a href=\"#contentshostwebcontents-sololectura\"><code>contents.hostWebContents</code> <em>SoloLectura</em></a></h4>\n<p>Un instancia de <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> que podría poseer este <code>WebContents</code>.</p>\n<h4 id=\"contentsdevtoolswebcontents-sololectura\"><a href=\"#contentsdevtoolswebcontents-sololectura\"><code>contents.devToolsWebContents</code> <em>SoloLectura</em></a></h4>\n<p>Una propiedad <code>WebContents | null</code> que representa el <code>WebContents</code> de la DevTools asociada con el <code>WebContents</code> dado.</p>\n<p><strong>Note:</strong> Los usuario nunca deberían almacenar este objeto porque puede convertirse en <code>null</code> cuando el DevTools ha sido cerrado.</p>\n<h4 id=\"contentsdebugger-sololectura\"><a href=\"#contentsdebugger-sololectura\"><code>contents.debugger</code> <em>SoloLectura</em></a></h4>\n<p>Una instancia <a href=\"/docs/api/debugger\"><code>Debugger</code></a> para este webContents.</p>\n<h4 id=\"contentsbackgroundthrottling\"><a href=\"#contentsbackgroundthrottling\"><code>contents.backgroundThrottling</code></a></h4>\n<p>Una propiedad <code>Boolean</code> que determina si este WebContents acelera o no las animaciones y los temporizadores cuando la página pasa a segundo plano. Esto también afecta a la API de visibilidad de la página.</p>\n<h4 id=\"contentsmainframe-sololectura\"><a href=\"#contentsmainframe-sololectura\"><code>contents.mainFrame</code> <em>SoloLectura</em></a></h4>\n<p>A <a href=\"/docs/api/web-frame-main\"><code>WebFrameMain</code></a> property that represents the top frame of the page's frame hierarchy.</p>",
      "title": "webContents",
      "description": "Procesamiento y control de páginas webs."
    },
    "/docs/tutorial/web-embeds": {
      "locale": "es-ES",
      "slug": "web-embeds",
      "href": "/docs/tutorial/web-embeds",
      "crowdinFileId": "256269",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/web-embeds.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"web-embeds\"><a href=\"#web-embeds\">Web Embeds</a></h1>\n<h2 id=\"descripción-general\"><a href=\"#descripción-general\">Descripción general</a></h2>\n<p>Si quiere incrustar contenido web (de terceros) en un <code>BrowserWindow</code> de Electron, hay tres opciones disponible para usted: <code>&#x3C;iframe></code> tags, <code>&#x3C;webview></code> tags, y <code>BrowserViews</code>. Cada una ofrece una funcionalidad ligeramente diferente y es útil en diferentes situaciones. To help you choose between these, this guide explains the differences and capabilities of each option.</p>\n<h3 id=\"iframes\"><a href=\"#iframes\">Iframes</a></h3>\n<p>Iframes en Electron se comportan como iframes en los navegadores regulares. An <code>&#x3C;iframe></code> element in your page can show external web pages, provided that their <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP\">Content Security Policy</a> allows it. To limit the number of capabilities of a site in an <code>&#x3C;iframe></code> tag, it is recommended to use the <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox\"><code>sandbox</code> attribute</a> and only allow the capabilities you want to support.</p>\n<h3 id=\"webviews\"><a href=\"#webviews\">WebViews</a></h3>\n<blockquote>\n<p>Nota importante: <a href=\"/docs/api/webview-tag#warning\">no se recomienda el uso de WebViews</a>, ya que esta etiqueta genera cambios dramáticos en la arquitectura que podrían afectar a la estabilidad de tu aplicación. Considere cambiar a alternativas, como <code>iframe</code> y  <code>BrowserView</code> de Electron, o una  arquitectura que evite el contenido incrustado por diseño.</p>\n</blockquote>\n<p><a href=\"/docs/api/webview-tag\">WebViews</a> son basados en las WebViews de Chromium y no están soportados explícitamente por Electron. No garantizamos que la API WebView permanezca disponible en versiones futuro de Electron. Para usar <code>&#x3C;webview></code> etiquetas, necesitaras establecer <code>webviewTag</code> a <code>true</code> en el <code>webPreferences</code> de tu <code>BrowserWindow</code>.</p>\n<p>WebView es un elemento personalizado (<code>&#x3C;webview></code>) que sólo funcionara dentro de Electron. Están implementadas como un \"iframe fuera de proceso\". Esto quiere decir que toda la comunicación con el <code>&#x3C;webview></code> se hace de forma asíncrona usando IPC. The <code>&#x3C;webview></code> element has many custom methods and events, similar to <code>webContents</code>, that provide you with greater control over the content.</p>\n<p>Compared to an <code>&#x3C;iframe></code>, <code>&#x3C;webview></code> tends to be slightly slower but offers much greater control in loading and communicating with the third-party content and handling various events.</p>\n<h3 id=\"browserviews\"><a href=\"#browserviews\">BrowserViews</a></h3>\n<p><a href=\"/docs/api/browser-view\">BrowserViews</a> are not a part of the DOM - instead, they are created in and controlled by your Main process. Son simplemente otra capa de contenido web sobre su ventana existente. Esto quiere decir que están completamente separados de tu propio contenido <code>BrowserWindow</code> y su posición no es controlada por el DOM o CSS. En su lugar, es controlado estableciendo limites en el Main process.</p>\n<p><code>BrowserViews</code> ofrece el mayor control sobre sus contenidos, ya que implementan el <code>webContents</code> de forma similar a como <code>BrowserWindow</code> lo hace. Sin embargo, como <code>BrowserViews</code> no son parte de tu DOM, sino que están superpuestos sobre ellos, tendrá que administrar su posición manualmente.</p>",
      "title": "Web Embeds",
      "description": "Nota importante: no se recomienda el uso de WebViews, ya que esta etiqueta genera cambios dramáticos en la arquitectura que podrían afectar a la estabilidad de tu aplicación. Considere cambiar a alternativas, como iframe y  BrowserView de Electron, o una  arquitectura que evite el contenido incrustado por diseño."
    },
    "/docs/api/web-frame": {
      "locale": "es-ES",
      "slug": "web-frame",
      "href": "/docs/api/web-frame",
      "crowdinFileId": "256403",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-frame.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webframe\"><a href=\"#webframe\">webFrame</a></h1>\n<blockquote>\n<p>Personalizar el renderizado de la página web actual.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p><code>webFrame</code> exportación del mudulo Electron es una instancia de la clase <code>WebFrame</code> que representa el frame superior del actual <code>BrowserWindow</code>. Sub-frames pueden ser recuperados a través de propiedades y métodos determinados (ejemplo <code>webFrame.firstChild</code>).</p>\n<p>Un ejemplo de zoom de la página actual al 200%.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nwebFrame.setZoomFactor(<span class=\"hljs-number\">2</span>)\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>La clase <code>WebFrame</code> tiene los siguientes métodos de instancia:</p>\n<h3 id=\"webframesetzoomfactorfactor\"><a href=\"#webframesetzoomfactorfactor\"><code>webFrame.setZoomFactor(factor)</code></a></h3>\n<ul>\n<li><code>factor</code> Double - Factor de zoom; por defecto es 1.0.</li>\n</ul>\n<p>Cambia el nivel de zoom al nivel especificado. Factor de zoom es porcentaje de zoom dividido entre 100, así que 300% = 3.0.</p>\n<p>El factor debe ser mayor que 0.0.</p>\n<h3 id=\"webframegetzoomfactor\"><a href=\"#webframegetzoomfactor\"><code>webFrame.getZoomFactor()</code></a></h3>\n<p>Devuelve <code>Número</code> - El factor de zoom actual.</p>\n<h3 id=\"webframesetzoomlevellevel\"><a href=\"#webframesetzoomlevellevel\"><code>webFrame.setZoomLevel(level)</code></a></h3>\n<ul>\n<li><code>nivel</code> Número - Nivel de Zoom.</li>\n</ul>\n<p>Cambia el nivel de zoom al nivel especificado. El tamaño original es 0 y cada incremento por encima o por debajo representa un zoom del 20% mayor o menor a los límites predeterminados de 300% y 50% del tamaño original, respectivamente.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h3 id=\"webframegetzoomlevel\"><a href=\"#webframegetzoomlevel\"><code>webFrame.getZoomLevel()</code></a></h3>\n<p>Devuelve <code>Número</code> - El nivel de zoom actual.</p>\n<h3 id=\"webframesetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#webframesetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>webFrame.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h3>\n<ul>\n<li><code>minimumLevel</code> Número</li>\n<li><code>maximumLevel</code> Número</li>\n</ul>\n<p>Establecer el nivel de máximo y mínimo pizca de zoom.</p>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom is disabled by default in Electron. To re-enable it, call:</p>\n<pre><code class=\"hljs language-js\">webFrame.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">3</span>)\n</code></pre>\n</blockquote>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom shortcuts are controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem roles in the application Menu. Para desactivar los atajos manualmente, <a href=\"/docs/api/menu#examples\">defina el menú</a> y omita los roles de zoom de la definición.</p>\n</blockquote>\n<h3 id=\"webframesetspellcheckproviderlanguage-provider\"><a href=\"#webframesetspellcheckproviderlanguage-provider\"><code>webFrame.setSpellCheckProvider(language, provider)</code></a></h3>\n<ul>\n<li><code>idioma</code> Cadena</li>\n<li>Objeto <code>provider</code><ul>\n<li><code>spellCheck</code> Función<ul>\n<li><code>words</code> String[]</li>\n<li><code>callback</code> Función<ul>\n<li><code>misspeltWords</code> String[]</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Establece un proveedor para la corrección ortográfica en campos de entrada y áreas de texto.</p>\n<p>Si quiere utilizar este método debe deshabilitar el corrector ortográfico incorporado cuando construya la ventana.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">spellcheck</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\n</code></pre>\n<p>El <code>provider</code> debe ser un objeto que tiene un método <code>spellCheck</code> que acepte un array de palabras individuales para revisión ortográfica. La función <code>spellCheck</code> corre cronológicamente y llama a la función <code>callback</code> con un array de palabras mal escritas cuando se completa.</p>\n<p>Un ejemplo de uso de <a href=\"https://github.com/atom/node-spellchecker\">node-spellchecker</a> como proveedor:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> spellChecker = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spellchecker'</span>)\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, {\n  spellCheck (words, callback) {\n    setTimeout(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      <span class=\"hljs-keyword\">const</span> spellchecker = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spellchecker'</span>)\n      <span class=\"hljs-keyword\">const</span> misspelled = words.filter(<span class=\"hljs-function\"><span class=\"hljs-params\">x</span> =></span> spellchecker.isMisspelled(x))\n      callback(misspelled)\n    }, <span class=\"hljs-number\">0</span>)\n  }\n})\n</code></pre>\n<h3 id=\"webframeinsertcsscss\"><a href=\"#webframeinsertcsscss\"><code>webFrame.insertCSS(css)</code></a></h3>\n<ul>\n<li><code>css</code> String - CSS codigo de origen.</li>\n</ul>\n<p>Devuelve <code>String</code> - Una llave para el CSS insertado que puede ser utilizado más tarde para eliminar el CSS a través de <code>webFrame.removeInsertedCSS(key)</code>.</p>\n<p>Inyecta CSS en la página web actual y devuelve un identificador único para la hoja de estilo insertada.</p>\n<h3 id=\"webframeremoveinsertedcsskey\"><a href=\"#webframeremoveinsertedcsskey\"><code>webFrame.removeInsertedCSS(key)</code></a></h3>\n<ul>\n<li><code>llave</code> Cadena</li>\n</ul>\n<p>Elimina el CSS insertado desde la página web actual. La hoja de estilos se identifica por su clave, el cual es devuelto desde <code>webFrame.insertCSS(css)</code>.</p>\n<h3 id=\"webframeinserttexttexto\"><a href=\"#webframeinserttexttexto\"><code>webFrame.insertText(texto)</code></a></h3>\n<ul>\n<li><code>texto</code> Cadena</li>\n</ul>\n<p>Inserta <code>texto</code> en el elemento enfocado.</p>\n<h3 id=\"webframeexecutejavascriptcode-usergesture-callback\"><a href=\"#webframeexecutejavascriptcode-usergesture-callback\"><code>webFrame.executeJavaScript(code[, userGesture, callback])</code></a></h3>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (opcional) - Predeterminado es <code>falso</code>.</li>\n<li><code>callback</code> Function (optional) - Called after script has been executed. Unless the frame is suspended (e.g. showing a modal alert), execution will be synchronous and the callback will be invoked before the method returns. For compatibility with an older version of this method, the error parameter is second.<ul>\n<li><code>resultado</code> Cualquiera</li>\n<li><code>error</code> Error</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if execution throws or results in a rejected promise.</p>\n<p>Evalúa el <code>código</code> en la página.</p>\n<p>En la ventana del navegador, algunas API HTML como <code>requestFullScreen</code> solo pueden invocarse con un gesto del usuario. Establecer <code>userGesture</code> a <code>true</code> eliminará esta limitación.</p>\n<h3 id=\"webframeexecutejavascriptinisolatedworldworldid-scripts-usergesture-callback\"><a href=\"#webframeexecutejavascriptinisolatedworldworldid-scripts-usergesture-callback\"><code>webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture, callback])</code></a></h3>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default main world (where content runs), <code>999</code> is the world used by Electron's <code>contextIsolation</code> feature. Accepts values in the range 1..536870911.</li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/web-source\">WebSource[]</a></li>\n<li><code>userGesture</code> Boolean (opcional) - Predeterminado es <code>falso</code>.</li>\n<li><code>callback</code> Function (optional) - Called after script has been executed. Unless the frame is suspended (e.g. showing a modal alert), execution will be synchronous and the callback will be invoked before the method returns.  For compatibility with an older version of this method, the error parameter is second.<ul>\n<li><code>resultado</code> Cualquiera</li>\n<li><code>error</code> Error</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if execution could not start.</p>\n<p>Funciona como <code>executeJavaScript</code> pero evaluá <code>scripts</code> en un contexto aislado.</p>\n<p>Note that when the execution of script fails, the returned promise will not reject and the <code>result</code> would be <code>undefined</code>. This is because Chromium does not dispatch errors of isolated worlds to foreign worlds.</p>\n<h3 id=\"webframesetisolatedworldinfoworldid-info\"><a href=\"#webframesetisolatedworldinfoworldid-info\"><code>webFrame.setIsolatedWorldInfo(worldId, info)</code></a></h3>\n<ul>\n<li><code>worldId</code> Integer - El ID de la palabra para correr javascript en, <code>0</code> es el mundo por defecto, <code>999</code> es el mundo usado por la característica de Electron <code>contextIsolation</code>. Las extenciones de Chrome reservan el rango de IDs en <code>[1 &#x3C;&#x3C; 20, 1 &#x3C;&#x3C; 29)</code>. Aquí puede suministrar cualquier entero.</li>\n<li>Objeto <code>info</code><ul>\n<li><code>securityOrigin</code> String (opcional) - Origen de seguridad para el mundo aislado.</li>\n<li><code>csp</code> String (opcional) - Política de Seguridad de Contenido para el mundo aislado.</li>\n<li><code>name</code> String (optional) - Name for isolated world. Useful in devtools.</li>\n</ul></li>\n</ul>\n<p>Set the security origin, content security policy and name of the isolated world. Note: If the <code>csp</code> is specified, then the <code>securityOrigin</code> also has to be specified.</p>\n<h3 id=\"webframegetresourceusage\"><a href=\"#webframegetresourceusage\"><code>webFrame.getResourceUsage()</code></a></h3>\n<p>Devuelve <code>Objeto</code>:</p>\n<ul>\n<li><code>images</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>cssStyleSheets</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>xslStyleSheets</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>fonts</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>other</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n</ul>\n<p>Devuelve un objeto que describe la información de uso de las cachés de memoria interna de Blink.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(webFrame.getResourceUsage())\n</code></pre>\n<p>Esto generará:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">images</span>: {\n    <span class=\"hljs-attr\">count</span>: <span class=\"hljs-number\">22</span>,\n    <span class=\"hljs-attr\">size</span>: <span class=\"hljs-number\">2549</span>,\n    <span class=\"hljs-attr\">liveSize</span>: <span class=\"hljs-number\">2542</span>\n  },\n  <span class=\"hljs-attr\">cssStyleSheets</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> },\n  <span class=\"hljs-attr\">xslStyleSheets</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> },\n  <span class=\"hljs-attr\">fonts</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> },\n  <span class=\"hljs-attr\">other</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> }\n}\n</code></pre>\n<h3 id=\"webframeclearcache\"><a href=\"#webframeclearcache\"><code>webFrame.clearCache()</code></a></h3>\n<p>Intenta liberar memoria que ya no se usa (como las imágenes de una navegación anterior).</p>\n<p>Tenga en cuenta que llamar ciegamente este método probablemente haga que Electron sea más lento, ya que tendrá que volver a llenar estos cachés vacíos, solo debe llamarlo si ha ocurrido un evento en su aplicación que le haga pensar que su página está usando menos memoria (es decir, ha navegado desde una página muy pesada a una casi vacía, y tiene la intención de permanecer allí).</p>\n<h3 id=\"webframegetframeforselectorselector\"><a href=\"#webframegetframeforselectorselector\"><code>webFrame.getFrameForSelector(selector)</code></a></h3>\n<ul>\n<li><code>selector</code> String - selector CSS para un elemento frame.</li>\n</ul>\n<p>Devuelve <code>WebFrame</code> - El elemento de frame en <code>webFrame's</code> documento seleccionado por <code>selector</code>, <code>null</code> sería devuelto si <code>selector</code> no selecciona un frame o si el frame no está en el proceso actual de renderizado.</p>\n<h3 id=\"webframefindframebynamename\"><a href=\"#webframefindframebynamename\"><code>webFrame.findFrameByName(name)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n</ul>\n<p>Deveulve <code>WebFrame</code> - Un hijo de <code>webFrame</code> con el <code>name</code> suministrado, <code>null</code> sería retornado is no hay tal frame o si el frame no está en el proceso renderer actual.</p>\n<h3 id=\"webframefindframebyroutingidroutingid\"><a href=\"#webframefindframebyroutingidroutingid\"><code>webFrame.findFrameByRoutingId(routingId)</code></a></h3>\n<ul>\n<li><code>routingId</code> Integer - Un <code>Integer</code> representando el id único del frame en el proceso renderer actual. Las IDs de rutas se pueden recuperar de <code>WebFrame</code> instancias (<code>webFrame.routingId</code>) y también son pasados por el frame <code>WebContents</code> específicos eventos de navegación (por ejemplo, <code>did-frame-navigate</code>)</li>\n</ul>\n<p>Devuelve <code>WebFrame</code> - que tiene el <code>routingId</code> proporcionado, <code>null</code> si no se encuentra.</p>\n<h3 id=\"webframeiswordmisspelledword\"><a href=\"#webframeiswordmisspelledword\"><code>webFrame.isWordMisspelled(word)</code></a></h3>\n<ul>\n<li><code>word</code> String - The word to be spellchecked.</li>\n</ul>\n<p>Returns <code>Boolean</code> - True if the word is misspelled according to the built in spellchecker, false otherwise. If no dictionary is loaded, always return false.</p>\n<h3 id=\"webframegetwordsuggestionsword\"><a href=\"#webframegetwordsuggestionsword\"><code>webFrame.getWordSuggestions(word)</code></a></h3>\n<ul>\n<li><code>word</code> String - The misspelled word.</li>\n</ul>\n<p>Returns <code>String[]</code> - A list of suggested words for a given word. If the word is spelled correctly, the result will be empty.</p>\n<h2 id=\"propiedades\"><a href=\"#propiedades\">Propiedades</a></h2>\n<h3 id=\"webframetop-readonly\"><a href=\"#webframetop-readonly\"><code>webFrame.top</code> <em>Readonly</em></a></h3>\n<p>Un <code>WebFrame | null</code> que representa el frame superior en la jerarquía de frames al cual pertenece el <code>webFrame</code>, la propiedad debe ser <code>null</code> si el frame superior no está en el renderer process actual.</p>\n<h3 id=\"webframeopener-readonly\"><a href=\"#webframeopener-readonly\"><code>webFrame.opener</code> <em>Readonly</em></a></h3>\n<p>Un <code>WebFrame</code> representa el frame <code>webFrame</code> que abrió, la propiedad debería ser <code>null</code> si no hay abridores o si el abridor no está en el proceso renderer actual.</p>\n<h3 id=\"webframeparent-readonly\"><a href=\"#webframeparent-readonly\"><code>webFrame.parent</code> <em>Readonly</em></a></h3>\n<p>Un <code>WebFrame | null</code> que representa el frame padre de <code>webFrame</code>, la propiedad debería ser <code>null</code> si <code>webFrame</code> es superior o el padre no está en renderer process actual.</p>\n<h3 id=\"webframefirstchild-readonly\"><a href=\"#webframefirstchild-readonly\"><code>webFrame.firstChild</code> <em>Readonly</em></a></h3>\n<p>Un <code>WebFrame | null</code> que representa al primer frame hijo de <code>webFrame</code>, la propiedad debería ser <code>null</code> si <code>webFrame</code> no tiene hijos o el primer hijo no esta en el renderer process actual.</p>\n<h3 id=\"webframenextsibling-readonly\"><a href=\"#webframenextsibling-readonly\"><code>webFrame.nextSibling</code> <em>Readonly</em></a></h3>\n<p>Un <code>WebFrame | null</code> que representa el siguiente frame hermano, la propiedad debería ser <code>null</code> si <code>webFrame</code> es el último frame en su padre o si el siguiente hermano no está en el renderer process actual.</p>\n<h3 id=\"webframeroutingid-readonly\"><a href=\"#webframeroutingid-readonly\"><code>webFrame.routingId</code> <em>Readonly</em></a></h3>\n<p>An <code>Integer</code> representing the unique frame id in the current renderer process. Distinct WebFrame instances that refer to the same underlying frame will have the same <code>routingId</code>.</p>",
      "title": "webFrame",
      "description": "Personalizar el renderizado de la página web actual."
    },
    "/docs/api/web-frame-main": {
      "locale": "es-ES",
      "slug": "web-frame-main",
      "href": "/docs/api/web-frame-main",
      "crowdinFileId": "256401",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-frame-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webframemain\"><a href=\"#webframemain\">webFrameMain</a></h1>\n<blockquote>\n<p>Control web pages and iframes.</p>\n</blockquote>\n<p>Proceso: <a href=\"/docs/glossary#main-process\">principal</a>&#x3C;/0></p>\n<p>The <code>webFrameMain</code> module can be used to lookup frames across existing <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> instances. Navigation events are the common use case.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, webFrameMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://twitter.com'</span>)\n\nwin.webContents.on(\n  <span class=\"hljs-string\">'did-frame-navigate'</span>,\n  (event, url, isMainFrame, frameProcessId, frameRoutingId) => {\n    <span class=\"hljs-keyword\">const</span> frame = webFrameMain.fromId(frameProcessId, frameRoutingId)\n    <span class=\"hljs-keyword\">if</span> (frame) {\n      <span class=\"hljs-keyword\">const</span> code = <span class=\"hljs-string\">'document.body.innerHTML = document.body.innerHTML.replaceAll(\"heck\", \"h*ck\")'</span>\n      frame.executeJavaScript(code)\n    }\n  }\n)\n</code></pre>\n<p>También puedes acceder a los frames de una página existente usando la propiedad <code>mainFrame</code> de <a href=\"/docs/api/web-contents\"><code>WebContents</code></a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">main</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  <span class=\"hljs-keyword\">await</span> win.loadURL(<span class=\"hljs-string\">'https://reddit.com'</span>)\n\n  <span class=\"hljs-keyword\">const</span> youtubeEmbeds = win.webContents.mainFrame.frames.filter(<span class=\"hljs-function\">(<span class=\"hljs-params\">frame</span>) =></span> {\n    <span class=\"hljs-keyword\">try</span> {\n      <span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-keyword\">new</span> URL(frame.url)\n      <span class=\"hljs-keyword\">return</span> url.host === <span class=\"hljs-string\">'www.youtube.com'</span>\n    } <span class=\"hljs-keyword\">catch</span> {\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n    }\n  })\n\n  <span class=\"hljs-built_in\">console</span>.log(youtubeEmbeds)\n}\n\nmain()\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>These methods can be accessed from the <code>webFrameMain</code> module:</p>\n<h3 id=\"webframemainfromidprocessid-routingid\"><a href=\"#webframemainfromidprocessid-routingid\"><code>webFrameMain.fromId(processId, routingId)</code></a></h3>\n<ul>\n<li><code>processId</code> Integer - Un <code>Integer</code> representando el ID interno del proceso que posee el frame.</li>\n<li><code>routingId</code> Integer - Un <code>Integer</code> representando el ID único del frame en el renderer process actual. Routing IDs can be retrieved from <code>WebFrameMain</code> instances (<code>frame.routingId</code>) and are also passed by frame specific <code>WebContents</code> navigation events (e.g. <code>did-frame-navigate</code>).</li>\n</ul>\n<p>Returns <code>WebFrameMain | undefined</code> - A frame with the given process and routing IDs, or <code>undefined</code> if there is no WebFrameMain associated with the given IDs.</p>\n<h2 id=\"clase-webframemain\"><a href=\"#clase-webframemain\">Clase: WebFrameMain</a></h2>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"eventos-de-instancia\"><a href=\"#eventos-de-instancia\">Eventos de Instancia</a></h3>\n<h4 id=\"evento-dom-ready\"><a href=\"#evento-dom-ready\">Evento: 'dom-ready'</a></h4>\n<p>Emitido cuando es documento está cargado.</p>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<h4 id=\"frameexecutejavascriptcode-usergesture\"><a href=\"#frameexecutejavascriptcode-usergesture\"><code>frame.executeJavaScript(code[, userGesture])</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (opcional) - Predeterminado es <code>falso</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;unknown></code> - A promise that resolves with the result of the executed code or is rejected if execution throws or results in a rejected promise.</p>\n<p>Evalúa el <code>código</code> en la página.</p>\n<p>En la ventana del navegador, algunas API HTML como <code>requestFullScreen</code> solo pueden invocarse con un gesto del usuario. Establecer <code>userGesture</code> a <code>true</code> eliminará esta limitación.</p>\n<h4 id=\"framereload\"><a href=\"#framereload\"><code>frame.reload()</code></a></h4>\n<p>Devuelve <code>boolean</code> - Si la recarga fue iniciada correctamente. Solo resulta en <code>false</code> cuando el frame no tiene historial.</p>\n<h4 id=\"framesendchannel-args\"><a href=\"#framesendchannel-args\"><code>frame.send(channel, ...args)</code></a></h4>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Envía un mensaje asíncrono al render process a través de <code>channel</code>, junto con los argumentos. Los argumentos serán serializados con la [Structured Clone Algorithm][SCA], al igual que [<code>postMessage</code>][], así que las cadenas de prototipos no serán incluidas. El envío de funciones, promesas, símbolos, WeakMaps o WeakSets lanzará una excepción.</p>\n<p>El proceso de renderizado puede manejar el mensaje escuchando el <code>canal</code> con el módulo <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a>.</p>\n<h4 id=\"framepostmessagechannel-message-transfer\"><a href=\"#framepostmessagechannel-message-transfer\"><code>frame.postMessage(channel, message, [transfer])</code></a></h4>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>mensaje</code> cualquiera</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Envía un mensaje al renderer process, transfiriendo opcionalmente la propiedad de cero o más objetos [<code>MessagePortMain</code>][].</p>\n<p>Los objetos <code>MessagePortMain</code> transferidos estarán disponible en el renderer process accediendo a la propiedad <code>ports</code> del evento emitido. Cuando llegan al renderer, serán objetos DOM <code>MessagePort</code> nativos.</p>\n<p>Por ejemplo:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nwebContents.mainFrame.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<h3 id=\"propiedades-de-la-instancia\"><a href=\"#propiedades-de-la-instancia\">Propiedades de la instancia</a></h3>\n<h4 id=\"frameurl-readonly\"><a href=\"#frameurl-readonly\"><code>frame.url</code> <em>Readonly</em></a></h4>\n<p>Un <code>string</code> representando la URL actual del frame.</p>\n<h4 id=\"frametop-readonly\"><a href=\"#frametop-readonly\"><code>frame.top</code> <em>Readonly</em></a></h4>\n<p>Un <code>WebFrameMain | null</code> representando el frame superior en la jerarquía a la que pertenece el <code>frame</code>.</p>\n<h4 id=\"frameparent-readonly\"><a href=\"#frameparent-readonly\"><code>frame.parent</code> <em>Readonly</em></a></h4>\n<p>Un <code>WebFrameMain | null</code> representando al frame padre de <code>frame</code>, la propiedad debería ser <code>null</code> si el <code>frame</code> es el frame superior en la jerarquía de frame.</p>\n<h4 id=\"frameframes-readonly\"><a href=\"#frameframes-readonly\"><code>frame.frames</code> <em>Readonly</em></a></h4>\n<p>Una colección <code>WebFrameMain[]</code> que contiene los descendientes directos del <code>frame</code>.</p>\n<h4 id=\"frameframesinsubtree-readonly\"><a href=\"#frameframesinsubtree-readonly\"><code>frame.framesInSubtree</code> <em>Readonly</em></a></h4>\n<p>Una colección <code>WebFrameMain[]</code> que contiene cada frame en el subárbol de <code>frame</code> incluyendo el mismo. Esto puede resultar útil al atravesar todos los frames.</p>\n<h4 id=\"frameframetreenodeid-readonly\"><a href=\"#frameframetreenodeid-readonly\"><code>frame.frameTreeNodeId</code> <em>Readonly</em></a></h4>\n<p>Un <code>Integer</code> que representa el id de la instancia FrameTreeNode del frame. Este id es global del navegador y unicamente identifica a un frame que aloja contenido. El identificador se fija en la creación del frame y permanece constante por durante el ciclo de vida del frame. Cuando el frame es eliminado, el id no se vuelve a utilizar.</p>\n<h4 id=\"framename-readonly\"><a href=\"#framename-readonly\"><code>frame.name</code> <em>Readonly</em></a></h4>\n<p>Un <code>String</code> que representa el nombre del frame.</p>\n<h4 id=\"frameosprocessid-readonly\"><a href=\"#frameosprocessid-readonly\"><code>frame.osProcessId</code> <em>Readonly</em></a></h4>\n<p>Un <code>Integer</code> que representa el <code>pid</code> del proceso del sistema operativo al cual pertenece este frame.</p>\n<h4 id=\"frameprocessid-readonly\"><a href=\"#frameprocessid-readonly\"><code>frame.processId</code> <em>Readonly</em></a></h4>\n<p>Un <code>Integer</code> que representa el <code>pid</code> del proceso interno de Chromium al cual pertenece este frame. Esto no es el mismo que el process ID del sistema operativo; para leer eso use <code>frame.osProcessId</code>.</p>\n<h4 id=\"frameroutingid-readonly\"><a href=\"#frameroutingid-readonly\"><code>frame.routingId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the unique frame id in the current renderer process. Las instancias distintas de <code>WebFrameMain</code> que se refieren al mimo frame subyacente tendrán el mismo <code>routingId</code>.</p>\n<h4 id=\"framevisibilitystate-sololectura\"><a href=\"#framevisibilitystate-sololectura\"><code>frame.visibilityState</code> <em>SoloLectura</em></a></h4>\n<p>Un <code>string</code> que representa el <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState\">visibility state</a> del frame.</p>\n<p>Ver también como la <a href=\"/docs/api/browser-window#page-visibility\">Page Visibility API</a> es afectada por otras APIs de Electron.</p>",
      "title": "webFrameMain",
      "description": "Control web pages and iframes."
    },
    "/docs/api/web-request": {
      "locale": "es-ES",
      "slug": "web-request",
      "href": "/docs/api/web-request",
      "crowdinFileId": "256405",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-request.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"clase-webrequest\"><a href=\"#clase-webrequest\">Clase: WebRequest</a></h2>\n<blockquote>\n<p>Interceptar y modificar el contenido de una solicitud en varias etapas de su ciclo de vida.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Instancias de la clase <code>WebRequest</code> son accesibles usando la propiedad <code>webRequest</code> de una <code>Session</code>.</p>\n<p>Los métodos de <code>WebRequest</code> aceptan un <code>filter</code> opcional y un <code>listener</code>. El <code>listener</code> será cancelado con <code>listener(details)</code> cuando el evento de API haya pasado. El objeto <code>details</code> describe la solicitud.</p>\n<p>⚠️ Only the last attached <code>listener</code> will be used. Passing <code>null</code> as <code>listener</code> will unsubscribe from the event.</p>\n<p>El objeto <code>filter</code> tiene una propiedad <code>urls</code> que es un arreglo de patrones URL que serán usados para filtrar las solicitudes que no coincidan con los patrones de URL. Si el <code>filtro</code> es omitido todas las solicitudes serán atendidas.</p>\n<p>Para ciertos eventos el <code>listener</code> es pasado con una <code>callback</code>, Que debe ser llamada con un objeto <code>response</code> cuando el <code>listener</code> haya hecho su trabajo.</p>\n<p>Un ejemplo de añadir encabezados <code>User-Agent</code> a las solicitudes:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Modify the user agent for all requests to the following urls.</span>\n<span class=\"hljs-keyword\">const</span> filter = {\n  <span class=\"hljs-attr\">urls</span>: [<span class=\"hljs-string\">'https://*.github.com/*'</span>, <span class=\"hljs-string\">'*://electron.github.io'</span>]\n}\n\nsession.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback) => {\n  details.requestHeaders[<span class=\"hljs-string\">'User-Agent'</span>] = <span class=\"hljs-string\">'MyAgent'</span>\n  callback({ <span class=\"hljs-attr\">requestHeaders</span>: details.requestHeaders })\n})\n</code></pre>\n<h3 id=\"métodos-de-instancia\"><a href=\"#métodos-de-instancia\">Métodos de Instancia</a></h3>\n<p>Lo siguientes métodos están disponibles en instancias de <code>WebRequest</code>:</p>\n<h4 id=\"webrequestonbeforerequestfilter-listener\"><a href=\"#webrequestonbeforerequestfilter-listener\"><code>webRequest.onBeforeRequest([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (opcional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Íntegro</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Entero (opcional)</li>\n<li><code>webContents</code> WebContents (opcional)</li>\n<li><code>frame</code> WebFrameMain (opcional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>fecha y hora</code> Doble</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/upload-data\">UploadData[]</a></li>\n</ul></li>\n<li><code>callback</code> Función<ul>\n<li><code>response</code> Object<ul>\n<li><code>cancelar</code> Booleano (opcional)</li>\n<li><code>Redireccionar URL</code> Cadena (opcional) - La solicitud original está prevenida de ser enviada o completada y en vez de eso es redireccionada a una URL dada.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>El <code>oyente</code> Será cancelado con <code>listener(details)</code> cuando la redirección del servidor esté por ocurrir.</p>\n<p>Los <code>buttons</code> es un arreglo de objetos <code>Button</code>.</p>\n<p>The <code>callback</code> has to be called with an <code>response</code> object.</p>\n<p>Algunos ejemplos de <code>urls</code> válidas:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-string\">'http://foo:1234/'</span>\n<span class=\"hljs-string\">'http://foo.com/'</span>\n<span class=\"hljs-string\">'http://foo:1234/bar'</span>\n<span class=\"hljs-string\">'*://*/*'</span>\n<span class=\"hljs-string\">'*://example.com/*'</span>\n<span class=\"hljs-string\">'*://example.com/foo/*'</span>\n<span class=\"hljs-string\">'http://*.foo:1234/'</span>\n<span class=\"hljs-string\">'file://foo:1234/bar'</span>\n<span class=\"hljs-string\">'http://foo:*/'</span>\n<span class=\"hljs-string\">'*://www.foo.com/'</span>\n</code></pre>\n<h4 id=\"webrequestonbeforesendheadersfilter-listener\"><a href=\"#webrequestonbeforesendheadersfilter-listener\"><code>webRequest.onBeforeSendHeaders([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (opcional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Íntegro</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Entero (opcional)</li>\n<li><code>webContents</code> WebContents (opcional)</li>\n<li><code>frame</code> WebFrameMain (opcional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>fecha y hora</code> Doble</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string></li>\n</ul></li>\n<li><code>callback</code> Función<ul>\n<li><code>beforeSendResponse</code> Object<ul>\n<li><code>cancelar</code> Booleano (opcional)</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string | string[]> (opcional) -Cuando es proveído, la solicitud será hecha con esas cabeceras.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>El <code>oyente</code> se llamará con <code>listener(details, callback)</code> Antes de enviar la solicitud HTTP, una vez que los encabezados de las solicitudes estén disponibles. Esto puede ocurrir después de que se realiza una conexión TCP al servidor, pero antes de que se envíe cualquier información http.</p>\n<p>El <code>callback</code> ha de ser llamado con un objeto <code>response</code>.</p>\n<h4 id=\"webrequestonsendheadersfilter-listener\"><a href=\"#webrequestonsendheadersfilter-listener\"><code>webRequest.onSendHeaders([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (opcional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Íntegro</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Entero (opcional)</li>\n<li><code>webContents</code> WebContents (opcional)</li>\n<li><code>frame</code> WebFrameMain (opcional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>fecha y hora</code> Doble</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>El<code>oyente</code> Será llamado con <code>listener(details)</code> justo antes que una solicitud vaya a ser enviada al servidor, modificaciones de previas respuestas <code>onBeforeSendHeaders</code> son visibles en el momento que este oyente esté en funcionamiento.</p>\n<h4 id=\"webrequestonheadersreceivedfilter-listener\"><a href=\"#webrequestonheadersreceivedfilter-listener\"><code>webRequest.onHeadersReceived([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (opcional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Íntegro</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Entero (opcional)</li>\n<li><code>webContents</code> WebContents (opcional)</li>\n<li><code>frame</code> WebFrameMain (opcional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>fecha y hora</code> Doble</li>\n<li><code>linea de estatus</code> Cadena</li>\n<li><code>Estatus de código</code> entero</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (opcional)</li>\n</ul></li>\n<li><code>callback</code> Función<ul>\n<li><code>headersReceivedResponse</code> Object<ul>\n<li><code>cancelar</code> Booleano (opcional)</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string | string[]> (opcional) - Cuando es proveído, el servidor se asume que ha respondido con estas cabeceras.</li>\n<li><code>Linea de estatus</code> Cadena (opcional) - Se proveerá al reemplazar el <code>encabezado de respuesta</code> para cambiar el estatus del encabezado, de otra manera el estatus original del encabezado de respuesta será usado.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>El <code>oyente</code> será cancelado con <code>listener(details, callback)</code> cuando la respuesta HTTP de los encabezados de de una solicitud hayan sido recibidos.</p>\n<p>El <code>callback</code> ha de ser llamado con un objeto <code>response</code>.</p>\n<h4 id=\"webrequestonresponsestartedfilter-listener\"><a href=\"#webrequestonresponsestartedfilter-listener\"><code>webRequest.onResponseStarted([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (opcional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Íntegro</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Entero (opcional)</li>\n<li><code>webContents</code> WebContents (opcional)</li>\n<li><code>frame</code> WebFrameMain (opcional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>fecha y hora</code> Doble</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (opcional)</li>\n<li><code>Desde Cache</code> Booleano - Indica cuando al respuesta fue obtenida desde la memoria caché.</li>\n<li><code>Estatus de código</code> entero</li>\n<li><code>linea de estatus</code> Cadena</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>El <code>oyente</code> será cancelado con <code>listener(details)</code> cuando se reciba el primer byte del cuerpo de la respuesta. Para las solicitudes HTTP, esto significa que la línea de estado y los encabezados de respuesta están disponibles.</p>\n<h4 id=\"webrequestonbeforeredirectfilter-listener\"><a href=\"#webrequestonbeforeredirectfilter-listener\"><code>webRequest.onBeforeRedirect([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (opcional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Íntegro</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Entero (opcional)</li>\n<li><code>webContents</code> WebContents (opcional)</li>\n<li><code>frame</code> WebFrameMain (opcional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>fecha y hora</code> Doble</li>\n<li><code>redirectURL</code> String</li>\n<li><code>Estatus de código</code> entero</li>\n<li><code>linea de estatus</code> Cadena</li>\n<li><code>ip</code> Cadena (opcional) - La dirección IP del servidor al cual fue enviada en realidad la solicitud.</li>\n<li><code>Desde cache</code> Booleano</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (opcional)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>El <code>oyente</code> Será cancelado con <code>listener(details)</code> cuando la redirección del servidor esté por ocurrir.</p>\n<h4 id=\"webrequestoncompletedfilter-listener\"><a href=\"#webrequestoncompletedfilter-listener\"><code>webRequest.onCompleted([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (opcional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Íntegro</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Entero (opcional)</li>\n<li><code>webContents</code> WebContents (opcional)</li>\n<li><code>frame</code> WebFrameMain (opcional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>fecha y hora</code> Doble</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (opcional)</li>\n<li><code>Desde cache</code> Booleano</li>\n<li><code>Estatus de código</code> entero</li>\n<li><code>linea de estatus</code> Cadena</li>\n<li><code>error</code> String</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>El <code>listener</code> será llamado con <code>listener(details)</code> cuando una petición es completada.</p>\n<h4 id=\"webrequestonerroroccurredfilter-listener\"><a href=\"#webrequestonerroroccurredfilter-listener\"><code>webRequest.onErrorOccurred([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (opcional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Íntegro</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Entero (opcional)</li>\n<li><code>webContents</code> WebContents (opcional)</li>\n<li><code>frame</code> WebFrameMain (opcional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>fecha y hora</code> Doble</li>\n<li><code>Desde cache</code> Booleano</li>\n<li><code>error</code> Cadena - la descripción del error.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>El <code>oyente</code> será cancelado con <code>listener(details)</code> cuando ocurra un error.</p>",
      "title": "Clase: WebRequest",
      "description": "Interceptar y modificar el contenido de una solicitud en varias etapas de su ciclo de vida."
    },
    "/docs/api/structures/web-request-filter": {
      "locale": "es-ES",
      "slug": "web-request-filter",
      "href": "/docs/api/structures/web-request-filter",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/web-request-filter.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"webrequestfilter-object\"><a href=\"#webrequestfilter-object\">WebRequestFilter Object</a></h1>\n<ul>\n<li><code>urls</code> String[] - Array of URL patterns that will be used to filter out the requests that do not match the URL patterns.</li>\n</ul>",
      "title": "WebRequestFilter Object",
      "description": ""
    },
    "/docs/api/structures/web-source": {
      "locale": "es-ES",
      "slug": "web-source",
      "href": "/docs/api/structures/web-source",
      "crowdinFileId": "256529",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/web-source.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"websource-object\"><a href=\"#websource-object\">WebSource Object</a></h1>\n<ul>\n<li><code>code</code> String</li>\n<li><code>url</code> String (optional)</li>\n<li><code>startLine</code> Integer (optional) - Default is 1.</li>\n</ul>",
      "title": "WebSource Object",
      "description": ""
    },
    "/docs/api/webview-tag": {
      "locale": "es-ES",
      "slug": "webview-tag",
      "href": "/docs/api/webview-tag",
      "crowdinFileId": "256407",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/webview-tag.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webview-etiqueta\"><a href=\"#webview-etiqueta\"><code>&#x3C;webview></code> Etiqueta</a></h1>\n<h2 id=\"advertencia\"><a href=\"#advertencia\">Advertencia</a></h2>\n<p>La etiqueta <code>webview</code> de Electron está basada en <a href=\"https://developer.chrome.com/docs/extensions/reference/webviewTag/\">Chromium's <code>webview</code></a>, el cual está experimentado cambios de arquitectura dramáticos. Esto impacta la estabilidad de <code>webviews</code>, incluyendo el renderizado, navegación y el enrutamiento de evento. We currently recommend to not use the <code>webview</code> tag and to consider alternatives, like <code>iframe</code>, <a href=\"/docs/api/browser-view\">Electron's <code>BrowserView</code></a>, or an architecture that avoids embedded content altogether.</p>\n<h2 id=\"activando\"><a href=\"#activando\">Activando</a></h2>\n<p>By default the <code>webview</code> tag is disabled in Electron >= 5.  Usted necesita habilitar la etiqueta estableciendo la opción <code>webviewTag</code> de webPreferences cuando se construye su <code>BrowserWindow</code>. Para más información vea el <a href=\"/docs/api/browser-window\">BrowserWindow constructor docs</a>.</p>\n<h2 id=\"descripción-general\"><a href=\"#descripción-general\">Descripción general</a></h2>\n<blockquote>\n<p>Mostrar contenido externo de la web en un cuadro aislado y procesado.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Use the <code>webview</code> tag to embed 'guest' content (such as web pages) in your Electron app. The guest content is contained within the <code>webview</code> container. Una página incrustada dentro de los controles de tu aplicación como el contenido de invitado es dispuesto y renderizado.</p>\n<p>Unlike an <code>iframe</code>, the <code>webview</code> runs in a separate process than your app. It doesn't have the same permissions as your web page and all interactions between your app and embedded content will be asynchronous. Esto mantiene a tu aplicación a salvo del contenido incrustado. <strong>Note:</strong> Muchos de los métodos en la vista web de la página anfitriona requieren una llamada sincrónica al proceso principal.</p>\n<h2 id=\"ejemplo\"><a href=\"#ejemplo\">Ejemplo</a></h2>\n<p>Para incrustar una página web en tu aplicación, añade la etiqueta <code>webview</code> a la página de embebido de tu aplicación (esta es la página de la aplicación que mostrará el contenido del invitado). En su manera más sencilla, la etiqueta <code>webview</code> incluye el <code>src</code> de la página web y los estilos css que controlan la apariencia de el contenedor <code>webview</code>:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"foo\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"display:inline-flex; width:640px; height:480px\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>Si tú quieres controlar el contenido de invitado de cualquier manera, puedes escribir JavaScript que escucha los eventos <code>webview</code> y responde a esos eventos usando los métodos <code>webview</code>. Aquí tenemos un código de muestra con dos detectores de eventos: uno que escucha para que la página web empiece a cargar, la otra para que la página web deje de cargar y muestre un mensaje que indique \"cargando...\" durante el tiempo de carga:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  onload = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\n    <span class=\"hljs-keyword\">const</span> indicator = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'.indicator'</span>)\n\n    <span class=\"hljs-keyword\">const</span> loadstart = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      indicator.innerText = <span class=\"hljs-string\">'loading...'</span>\n    }\n\n    <span class=\"hljs-keyword\">const</span> loadstop = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      indicator.innerText = <span class=\"hljs-string\">''</span>\n    }\n\n    webview.addEventListener(<span class=\"hljs-string\">'did-start-loading'</span>, loadstart)\n    webview.addEventListener(<span class=\"hljs-string\">'did-stop-loading'</span>, loadstop)\n  }\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h2 id=\"implementación-interna\"><a href=\"#implementación-interna\">Implementación interna</a></h2>\n<p>Bajo la capa <code>webview</code> es implementado con <a href=\"https://www.chromium.org/developers/design-documents/oop-iframes\">Out-of-Process iframes (OOPIFs)</a>. La etiqueta <code>webview</code> es esencialmente un elemento personalizado usando shadow DOM para envolver un elemento <code>iframe</code> dentro de el.</p>\n<p>Entonces el comportamiento de <code>webview</code> es muy similar a <code>iframe</code> cross-domain, como ejemplos:</p>\n<ul>\n<li>Cuando se pulsa dentro de un <code>webview</code>, el foco de la página se moverá desde el incrustador a <code>webview</code>.</li>\n<li>Usted puede no agregar escuchadores de eventos de teclado, mouse y scroll a <code>webview</code>.</li>\n<li>Todas las reacciones entre el frame embebedor y el <code>webview</code> son asíncronas.</li>\n</ul>\n<h2 id=\"notas-de-estilo-css\"><a href=\"#notas-de-estilo-css\">Notas de Estilo CSS</a></h2>\n<p>Por favor tenga en cuenta que las etiquetas de estilos de <code>webview</code> usa internamente <code>display:flex;</code> para asegurar que el elemento <code>iframe</code> hijo rellena el alto y el ancho por completo de su <code>webview</code> contenedor cuando es usado con el layouts tradicionales y flexbox. Por favor no sobrescrita la propiedad CSS por defecto <code>display:flex;</code> a menos que se especifique <code>display:inline-flex;</code> para layout inline.</p>\n<h2 id=\"atributos-de-etiqueta\"><a href=\"#atributos-de-etiqueta\">Atributos de Etiqueta</a></h2>\n<p>La etiqueta de <code>webview</code> tiene los siguientes atributos:</p>\n<h3 id=\"src\"><a href=\"#src\"><code>src</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> representing the visible URL. Writing to this attribute initiates top-level navigation.</p>\n<p>Asignarle a <code>src</code> su propio valor reiniciará la página actual.</p>\n<p>El atributo <code>src</code> puede aceptar data de URL, como <code>data:text/plain,Hello, world!</code>.</p>\n<h3 id=\"nodeintegration\"><a href=\"#nodeintegration\"><code>nodeintegration</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://www.google.com/\"</span> <span class=\"hljs-attr\">nodeintegration</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>Un <code>Boolean</code>. Cuando este atributo esté presente, la página de invitado en <code>webview</code> tendrá integración de nodo y puede usar nodos APIs como <code>require</code> y <code>process</code> para acceder a bajos niveles de recursos de sistemas. La integración de nodo está desactivada por defecto en la página de invitado.</p>\n<h3 id=\"nodeintegrationinsubframes\"><a href=\"#nodeintegrationinsubframes\"><code>nodeintegrationinsubframes</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://www.google.com/\"</span> <span class=\"hljs-attr\">nodeintegrationinsubframes</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>Un <code>Boolean</code> para habilitar la opción experimental soporte NodeJS en sub frames tal como iframes dentro de <code>webview</code>. Todas sus precargas se cargarán por cada iframe, pude usar <code>process.isMainFrame</code> para determinar si estás en el frame principal o no. Esta opción está deshailitada por defecto en la pagina de invitado.</p>\n<h3 id=\"plugins\"><a href=\"#plugins\"><code>plugins</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">plugins</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>Un <code>Boolean</code>. When this attribute is present the guest page in <code>webview</code> will be able to use browser plugins. Plugins are disabled by default.</p>\n<h3 id=\"preload\"><a href=\"#preload\"><code>preload</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- from a file --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">preload</span>=<span class=\"hljs-string\">\"./test.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n<span class=\"hljs-comment\">&#x3C;!-- or if you want to load from an asar archive --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">preload</span>=<span class=\"hljs-string\">\"./app.asar/test.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>Un <code>String</code> que especifica un script que será cargada antes que se ejecuten otros scripts en la página de invitado. The protocol of script's URL must be <code>file:</code> (even when using <code>asar:</code> archives) because it will be loaded by Node's <code>require</code> under the hood, which treats <code>asar:</code> archives as virtual directories.</p>\n<p>Cuando la página de invitado no tiene integración de nodo, este guión todavía tendrá acceso a todos los nodos APIs, pero los objetos globales inyectados por Nodo serán eliminados luego de que el guión haya finalizado de ejecutarse.</p>\n<p><strong>Nota:</strong> Esta opción aparecerá como <code>preloadURL</code> (no <code>preload</code>) en el <code>webPreferences</code> especificado al evento <code>will-attach-webview</code>.</p>\n<h3 id=\"httpreferrer\"><a href=\"#httpreferrer\"><code>httpreferrer</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">httpreferrer</span>=<span class=\"hljs-string\">\"http://cheng.guru\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>Un <code>String</code> que establece la URL de referencia para la página de invitado.</p>\n<h3 id=\"useragent\"><a href=\"#useragent\"><code>useragent</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">useragent</span>=<span class=\"hljs-string\">\"Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the user agent for the guest page before the page is navigated to. Once the page is loaded, use the <code>setUserAgent</code> method to change the user agent.</p>\n<h3 id=\"disablewebsecurity\"><a href=\"#disablewebsecurity\"><code>disablewebsecurity</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">disablewebsecurity</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>Un <code>Boolean</code>. When this attribute is present the guest page will have web security disabled. Web security is enabled by default.</p>\n<h3 id=\"partition\"><a href=\"#partition\"><code>partition</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span> <span class=\"hljs-attr\">partition</span>=<span class=\"hljs-string\">\"persist:github\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://electronjs.org\"</span> <span class=\"hljs-attr\">partition</span>=<span class=\"hljs-string\">\"electron\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>Un <code>String</code> que representa la sesión utilizada por la página. Si <code>partition</code> empieza con <code>persist:</code>, la página usará una sesión persistente disponible para todas las páginas en la aplicación con la misma <code>partition</code>. si no hay un prefijo <code>persist:</code>, la página usará una sesión en memoria. Al asignar la misma <code>partition</code>, las páginas múltiples pueden compartir la misma sesión. Si la <code>partition</code> no se establece entonces la sesión por defecto de la aplicación será usada.</p>\n<p>This value can only be modified before the first navigation, since the session of an active renderer process cannot change. Subsequent attempts to modify the value will fail with a DOM exception.</p>\n<h3 id=\"allowpopups\"><a href=\"#allowpopups\"><code>allowpopups</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">allowpopups</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>Un <code>Boolean</code>. When this attribute is present the guest page will be allowed to open new windows. Popups are disabled by default.</p>\n<h3 id=\"webpreferences\"><a href=\"#webpreferences\"><code>webpreferences</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span> <span class=\"hljs-attr\">webpreferences</span>=<span class=\"hljs-string\">\"allowRunningInsecureContent, javascript=no\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>Un <code>String</code> el cual es una lista de cadenas separada por coma que especifica las web preferences a ser establecidas en el webview. La lista completa de cuerdas preferenciales soportadas puede ser encontradas en <a href=\"/docs/api/browser-window#new-browserwindowoptions\">BrowserWindow</a>.</p>\n<p>La cuerda sigue el mismo formato que las cuerdas que aparecen en <code>window.open</code>. Un nombre por sí mismo es dado a <code>true</code> por valores booleanos. Una preferencia puede ser establecida por otro valor incluyendo un <code>=</code>, seguido por el valor. Valores especiales como <code>yes</code> y <code>1</code> son interpretados como <code>true</code>, mientras que <code>no</code> y <code>0</code> son interpretados como <code>false</code>.</p>\n<h3 id=\"enableblinkfeatures\"><a href=\"#enableblinkfeatures\"><code>enableblinkfeatures</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">enableblinkfeatures</span>=<span class=\"hljs-string\">\"PreciseMemoryInfo, CSSVariables\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>Un <code>String</code> que es una lista de cadenas que especifica las funciones de parpadeo que se habilitarán separadas por <code>,</code>. La lista completa de cadenas características soportadas puede ser encontrada en el archivo <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a>.</p>\n<h3 id=\"disableblinkfeatures\"><a href=\"#disableblinkfeatures\"><code>disableblinkfeatures</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">disableblinkfeatures</span>=<span class=\"hljs-string\">\"PreciseMemoryInfo, CSSVariables\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>Un <code>String</code> que es una lista de cadenas que especifica las funciones de parpadeo a ser desactivadas separadas por <code>,</code>. La lista completa de cadenas características soportadas puede ser encontrada en el archivo <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a>.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>La etiqueta de <code>webview</code> tiene los siguientes métodos:</p>\n<p><strong>Nota:</strong> El elemento webview debe ser cargado antes de usar los métodos.</p>\n<p><strong>Ejemplo</strong></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'dom-ready'</span>, () => {\n  webview.openDevTools()\n})\n</code></pre>\n<h3 id=\"webviewloadurlurl-options\"><a href=\"#webviewloadurlurl-options\"><code>&#x3C;webview>.loadURL(url[, options])</code></a></h3>\n<ul>\n<li><code>url</code> URL</li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (opcional) - Una url HTTP Referencia.</li>\n<li><code>userAgent</code> Cadena (opcional) - Un agente de usuario originando el pedido.</li>\n<li><code>extraHeaders</code> Cadena (opcional) - Encabezados extras separados por \"\\n\"</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (opcional) - Url base (con separadores de ruta arrastrables) para archivos que se cargan por el url de datos. Esto es necesario únicamente si el <code>url</code> especificado es un url de datos y necesita cargar otros archivos.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code> - La promesa se resolverá cuando la pagina ha finalizado de cargar (ver <a href=\"/docs/api/webview-tag#event-did-finish-load\"><code>did-finish-load</code></a>), y rechaza si la página falla al cargar (ver <a href=\"/docs/api/webview-tag#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Carga el <code>url</code> en el webview, el <code>url</code> debe contener el prefijo protocolo, e.g. el <code>http://</code> or <code>file://</code>.</p>\n<h3 id=\"webviewdownloadurlurl\"><a href=\"#webviewdownloadurlurl\"><code>&#x3C;webview>.downloadURL(url)</code></a></h3>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Inicia una descarga del recurso en <code>url</code> sin navegar.</p>\n<h3 id=\"webviewgeturl\"><a href=\"#webviewgeturl\"><code>&#x3C;webview>.getURL()</code></a></h3>\n<p>Devuelve <code>String</code> - El URL de la página de invitado.</p>\n<h3 id=\"webviewgettitle\"><a href=\"#webviewgettitle\"><code>&#x3C;webview>.getTitle()</code></a></h3>\n<p>Devuelve <code>Cadena</code> - El título de la página de invitado.</p>\n<h3 id=\"webviewisloading\"><a href=\"#webviewisloading\"><code>&#x3C;webview>.isLoading()</code></a></h3>\n<p>Devuelve <code>Boolean</code> - Aunque la página de invitado esté cargando recursos.</p>\n<h3 id=\"webviewisloadingmainframe\"><a href=\"#webviewisloadingmainframe\"><code>&#x3C;webview>.isLoadingMainFrame()</code></a></h3>\n<p>Devuelve <code>Boolean</code> - Si el marco principal (y no sólo iframes o frames dentro de él) todavía está cargando.</p>\n<h3 id=\"webviewiswaitingforresponse\"><a href=\"#webviewiswaitingforresponse\"><code>&#x3C;webview>.isWaitingForResponse()</code></a></h3>\n<p>Devuelve <code>Boolean</code> - Aunque la página de invitado esté esperando por una primera respuesta de el principal recurso de la página.</p>\n<h3 id=\"webviewstop\"><a href=\"#webviewstop\"><code>&#x3C;webview>.stop()</code></a></h3>\n<p>Detiene cualquier navegación pendiente.</p>\n<h3 id=\"webviewreload\"><a href=\"#webviewreload\"><code>&#x3C;webview>.reload()</code></a></h3>\n<p>Recarga la página de invitado.</p>\n<h3 id=\"webviewreloadignoringcache\"><a href=\"#webviewreloadignoringcache\"><code>&#x3C;webview>.reloadIgnoringCache()</code></a></h3>\n<p>Recarga la página de invitado e ignora el caché.</p>\n<h3 id=\"webviewcangoback\"><a href=\"#webviewcangoback\"><code>&#x3C;webview>.canGoBack()</code></a></h3>\n<p>Devuelve <code>Boolean</code> - Aunque la página de invitado pueda retroceder.</p>\n<h3 id=\"webviewcangoforward\"><a href=\"#webviewcangoforward\"><code>&#x3C;webview>.canGoForward()</code></a></h3>\n<p>Devuelve <code>Boolean</code> - Aunque la página de invitado úeda ir hacia adelante.</p>\n<h3 id=\"webviewcangotooffsetoffset\"><a href=\"#webviewcangotooffsetoffset\"><code>&#x3C;webview>.canGoToOffset(offset)</code></a></h3>\n<ul>\n<li><code>offset</code> Íntegro</li>\n</ul>\n<p>Devuelve <code>Boolean</code> - Aunque la página de invitado pueda ir a <code>offset</code>.</p>\n<h3 id=\"webviewclearhistory\"><a href=\"#webviewclearhistory\"><code>&#x3C;webview>.clearHistory()</code></a></h3>\n<p>Borra el historial de navegación.</p>\n<h3 id=\"webviewgoback\"><a href=\"#webviewgoback\"><code>&#x3C;webview>.goBack()</code></a></h3>\n<p>Hace que la página de invitado vaya hacia atrás.</p>\n<h3 id=\"webviewgoforward\"><a href=\"#webviewgoforward\"><code>&#x3C;webview>.goForward()</code></a></h3>\n<p>Hace que la página de invitado vaya hacia adelante.</p>\n<h3 id=\"webviewgotoindexindex\"><a href=\"#webviewgotoindexindex\"><code>&#x3C;webview>.goToIndex(index)</code></a></h3>\n<ul>\n<li><code>index</code> Íntegro</li>\n</ul>\n<p>Navega a el índice absoluto específico.</p>\n<h3 id=\"webviewgotooffsetoffset\"><a href=\"#webviewgotooffsetoffset\"><code>&#x3C;webview>.goToOffset(offset)</code></a></h3>\n<ul>\n<li><code>offset</code> Íntegro</li>\n</ul>\n<p>Navega hacia el offset especificado desde \"la entrada actual\".</p>\n<h3 id=\"webviewiscrashed\"><a href=\"#webviewiscrashed\"><code>&#x3C;webview>.isCrashed()</code></a></h3>\n<p>Devuelve <code>Boolean</code> - Si el proceso de renderizado ha fallado.</p>\n<h3 id=\"webviewsetuseragentuseragent\"><a href=\"#webviewsetuseragentuseragent\"><code>&#x3C;webview>.setUserAgent(userAgent)</code></a></h3>\n<ul>\n<li><code>userAgent</code> cadena</li>\n</ul>\n<p>Anula el agente usuario para la página de invitado.</p>\n<h3 id=\"webviewgetuseragent\"><a href=\"#webviewgetuseragent\"><code>&#x3C;webview>.getUserAgent()</code></a></h3>\n<p>Devuelve <code>String</code> - El agente usuario para la página de invitado.</p>\n<h3 id=\"webviewinsertcsscss\"><a href=\"#webviewinsertcsscss\"><code>&#x3C;webview>.insertCSS(css)</code></a></h3>\n<ul>\n<li><code>css</code> Cadena</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;String></code> - Una promesa que resuelve con una llave para el CSS insertado que puede ser utilizado más tarde para eliminar el CSS a través <code>&#x3C;webview>contents.removeInsertedCSS(key)</code>.</p>\n<p>Inyecta CSS en la página web actual y devuelve un identificador único para la hoja de estilo insertada.</p>\n<h3 id=\"webviewremoveinsertedcsskey\"><a href=\"#webviewremoveinsertedcsskey\"><code>&#x3C;webview>.removeInsertedCSS(key)</code></a></h3>\n<ul>\n<li><code>llave</code> Cadena</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code> - Resuelve si la eliminación fue exitosa.</p>\n<p>Elimina el CSS insertado desde la página web actual. La hoja de estilos se identifica por su clave, el cual es devuelto desde <code>&#x3C;webview>.insertCSS(css)</code>.</p>\n<h3 id=\"webviewexecutejavascriptcode-usergesture\"><a href=\"#webviewexecutejavascriptcode-usergesture\"><code>&#x3C;webview>.executeJavaScript(code[, userGesture])</code></a></h3>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (opcional) - Por defecto <code>false</code>.</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;any></code> - Una promesa que resuelve con el resultado de la ejecución del código o es rechazada si el resultado del código es una promesa rechazada.</p>\n<p>Evalúa el <code>código</code> en la página. Si <code>userGesture</code> está establecido, creará el contexto de gesto del usuario en la página. APIs de HTML como <code>requestFullScreen</code>, los cuales requieren acciones de usuario, puede tomar ventaja de esta opción para automatización.</p>\n<h3 id=\"webviewopendevtools\"><a href=\"#webviewopendevtools\"><code>&#x3C;webview>.openDevTools()</code></a></h3>\n<p>Abre una ventana de DevTools para la página de invitado.</p>\n<h3 id=\"webviewclosedevtools\"><a href=\"#webviewclosedevtools\"><code>&#x3C;webview>.closeDevTools()</code></a></h3>\n<p>Cierra la ventana de DevTools para la página de invitado.</p>\n<h3 id=\"webviewisdevtoolsopened\"><a href=\"#webviewisdevtoolsopened\"><code>&#x3C;webview>.isDevToolsOpened()</code></a></h3>\n<p>Devuelve <code>Boolean</code> - Aunque la página de invitado tenga una ventana de DevTools unida.</p>\n<h3 id=\"webviewisdevtoolsfocused\"><a href=\"#webviewisdevtoolsfocused\"><code>&#x3C;webview>.isDevToolsFocused()</code></a></h3>\n<p>Devuelve <code>Boolean</code> - Aunque la ventana de DevTools de la página de invitado esté centrada.</p>\n<h3 id=\"webviewinspectelementx-y\"><a href=\"#webviewinspectelementx-y\"><code>&#x3C;webview>.inspectElement(x, y)</code></a></h3>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Empieza inspeccionado elementos en posición (<code>x</code>, <code>y</code>) de la página de invitado.</p>\n<h3 id=\"webviewinspectsharedworker\"><a href=\"#webviewinspectsharedworker\"><code>&#x3C;webview>.inspectSharedWorker()</code></a></h3>\n<p>Abre el DevTools para el contexto de trabajadores compartidos presentes en la página de invitado.</p>\n<h3 id=\"webviewinspectserviceworker\"><a href=\"#webviewinspectserviceworker\"><code>&#x3C;webview>.inspectServiceWorker()</code></a></h3>\n<p>Abre el DevTools para el contexto del trabajador de servicio presente en la página de invitado.</p>\n<h3 id=\"webviewsetaudiomutedmuted\"><a href=\"#webviewsetaudiomutedmuted\"><code>&#x3C;webview>.setAudioMuted(muted)</code></a></h3>\n<ul>\n<li><code>muted</code> Boolean</li>\n</ul>\n<p>Establece la página de invitado silenciada.</p>\n<h3 id=\"webviewisaudiomuted\"><a href=\"#webviewisaudiomuted\"><code>&#x3C;webview>.isAudioMuted()</code></a></h3>\n<p>Devuelve <code>Boolean</code> - Aunque a página de invitado haya sido silenciada.</p>\n<h3 id=\"webviewiscurrentlyaudible\"><a href=\"#webviewiscurrentlyaudible\"><code>&#x3C;webview>.isCurrentlyAudible()</code></a></h3>\n<p>Devuelve <code>Boolean</code> - Si el audio se esta reproduciendo actualmente.</p>\n<h3 id=\"webviewundo\"><a href=\"#webviewundo\"><code>&#x3C;webview>.undo()</code></a></h3>\n<p>Ejecuta el comando de edición <code>undo</code> en página.</p>\n<h3 id=\"webviewredo\"><a href=\"#webviewredo\"><code>&#x3C;webview>.redo()</code></a></h3>\n<p>Ejecuta el comando de edición <code>redo</code> en página.</p>\n<h3 id=\"webviewcut\"><a href=\"#webviewcut\"><code>&#x3C;webview>.cut()</code></a></h3>\n<p>Ejecuta comando de edición <code>cut</code> en página.</p>\n<h3 id=\"webviewcopy\"><a href=\"#webviewcopy\"><code>&#x3C;webview>.copy()</code></a></h3>\n<p>Ejecuta comando de edición <code>copy</code> en página.</p>\n<h3 id=\"webviewpaste\"><a href=\"#webviewpaste\"><code>&#x3C;webview>.paste()</code></a></h3>\n<p>Ejecuta el comando de edición <code>paste</code> en la página.</p>\n<h3 id=\"webviewpasteandmatchstyle\"><a href=\"#webviewpasteandmatchstyle\"><code>&#x3C;webview>.pasteAndMatchStyle()</code></a></h3>\n<p>Ejecuta el comando de edición <code>pasteAndMatchStyle</code> en la página.</p>\n<h3 id=\"webviewdelete\"><a href=\"#webviewdelete\"><code>&#x3C;webview>.delete()</code></a></h3>\n<p>Ejecuta el comando de edición <code>delete</code> en página.</p>\n<h3 id=\"webviewselectall\"><a href=\"#webviewselectall\"><code>&#x3C;webview>.selectAll()</code></a></h3>\n<p>Ejecuta el comando de edición <code>selectAll</code> en página.</p>\n<h3 id=\"webviewunselect\"><a href=\"#webviewunselect\"><code>&#x3C;webview>.unselect()</code></a></h3>\n<p>Ejecuta el comando de edición <code>unselect</code> en página.</p>\n<h3 id=\"webviewreplacetext\"><a href=\"#webviewreplacetext\"><code>&#x3C;webview>.replace(text)</code></a></h3>\n<ul>\n<li><code>texto</code> Cadena</li>\n</ul>\n<p>Ejecuta el comando de edición <code>replace</code> en página.</p>\n<h3 id=\"webviewreplacemisspellingtext\"><a href=\"#webviewreplacemisspellingtext\"><code>&#x3C;webview>.replaceMisspelling(text)</code></a></h3>\n<ul>\n<li><code>texto</code> Cadena</li>\n</ul>\n<p>Ejecuta el comando de edición <code>replaceMisspelling</code> en página.</p>\n<h3 id=\"webviewinserttexttext\"><a href=\"#webviewinserttexttext\"><code>&#x3C;webview>.insertText(text)</code></a></h3>\n<ul>\n<li><code>texto</code> Cadena</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code></p>\n<p>Inserta <code>texto</code> en el elemento enfocado.</p>\n<h3 id=\"webviewfindinpagetext-options\"><a href=\"#webviewfindinpagetext-options\"><code>&#x3C;webview>.findInPage(text[, options])</code></a></h3>\n<ul>\n<li><code>text</code> String - El contenido para ser buscado, no debe quedar en blanco.</li>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>forward</code> Boolean (opcional) - Ya sea para buscar hacia adelante o hacia atrás, el valor predeterminado es <code>true</code>.</li>\n<li><code>findNext</code> Boolean (optional) - Whether to begin a new text finding session with this request. Should be <code>true</code> for initial requests, and <code>false</code> for follow-up requests. Por defecto es <code>false</code>.</li>\n<li><code>matchCase</code> Boolean (opcional) - Si la busqueda debe ser sensible a mayúsculas, por defecto es <code>false</code>.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Integer</code> - El id de la solicitud usado para la solicitud.</p>\n<p>Empieza una solicitud para encontrar todas las coincidencias para el <code>text</code> en la página web. El resultado de la petición puede ser obtenido por suscripción al evento <a href=\"/docs/api/webview-tag#event-found-in-page\"><code>found-in-page</code></a>.</p>\n<h3 id=\"webviewstopfindinpageaction\"><a href=\"#webviewstopfindinpageaction\"><code>&#x3C;webview>.stopFindInPage(action)</code></a></h3>\n<ul>\n<li><code>action</code> String - Specifies the action to take place when ending <a href=\"#webviewfindinpagetext-options\"><code>&#x3C;webview>.findInPage</code></a> request.<ul>\n<li><code>clearSelection</code> - Borrar la selección.</li>\n<li><code>keepSelection</code> - Traduce la selección en una selección normal.</li>\n<li><code>activateSelection</code> - Enfoca y hace clic en el nodo de selección.</li>\n</ul></li>\n</ul>\n<p>Detiene cualquier solicitud <code>findInPage</code> para el <code>webview</code> con la <code>action</code> dada.</p>\n<h3 id=\"webviewprintoptions\"><a href=\"#webviewprintoptions\"><code>&#x3C;webview>.print([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (opcional)<ul>\n<li><code>silent</code> Boolean (optional) - Don't ask user for print settings. Por defecto es <code>false</code>.</li>\n<li><code>printBackground</code> Boolean (optional) - Prints the background color and image of the web page. Por defecto es <code>false</code>.</li>\n<li><code>deviceName</code> String (optional) - Set the printer device name to use. Must be the system-defined name and not the 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.</li>\n<li><code>color</code> Boolean (optional) - Set whether the printed web page will be in color or grayscale. Por defecto es <code>true</code>.</li>\n<li><code>margins</code> Object (opcional)<ul>\n<li><code>marginType</code> String (opcional) - Puede ser <code>default</code>, <code>none</code>, <code>printableArea</code>, o <code>custom</code>. Si <code>custom</code> es elegido, además necesitar especificar <code>top</code>, <code>bottom</code>, <code>left</code>, y <code>right</code>.</li>\n<li><code>top</code> Number (opcional) - El margen superior de la página web impresa, en píxeles.</li>\n<li><code>bottom</code> Number (opcional) - El margen inferior de la página web impresa, en píxeles.</li>\n<li><code>left</code> Number (opcional) - El margen izquierdo de la página web impresa, en píxeles.</li>\n<li><code>right</code> Number (opcional) - El margen derecho de la página web impresa, en píxeles.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - Whether the web page should be printed in landscape mode. Por defecto es <code>false</code>.</li>\n<li><code>scaleFactor</code> Number (opcional) - El factor de escalado de la página web.</li>\n<li><code>pagesPerSheet</code> Number (opcional) - El número de páginas a imprimir por hoja de página.</li>\n<li><code>collate</code> Boolean (opcional) - Si la página web debe ser intercalada.</li>\n<li><code>copies</code> Number (opcional) - El número de copias de la página web a imprimir.</li>\n<li><code>pageRanges</code> Object<a href=\"/docs/api/optional\"></a> - The page range to print.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Índice de la última página a imprimir (inclusive) (0-based).</li>\n</ul></li>\n<li><code>duplexMode</code> String (optional) - Set the duplex mode of the printed web page. Puede ser <code>simplex</code>, <code>shortEdge</code>, o <code>longEdge</code>.</li>\n<li><code>dpi</code> Record&#x3C;string, number> (opcional)<ul>\n<li><code>horizontal</code> Number (opcional) - El dpi horizontal.</li>\n<li><code>vertical</code> Number (opcional) - El dpi vertical.</li>\n</ul></li>\n<li><code>header</code> String (opcional) - Cadena a ser impresa como cabecera de la página.</li>\n<li><code>footer</code> String (opcional) - Cadena a ser impresa como pie de página.</li>\n<li><code>pageSize</code> String | Tamaño (opcional) - Especifique el tamaño de página del documento impreso. Puede ser <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> o un objeto que contenga <code>height</code>.</li>\n</ul></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code></p>\n<p>Imprime la página web de <code>webview</code>. Igual que <code>webContents.print([options])</code>.</p>\n<h3 id=\"webviewprinttopdfopciones\"><a href=\"#webviewprinttopdfopciones\"><code>&#x3C;webview>.printToPDF(opciones)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>headerFooter</code> Record&#x3C;string, string> (opcional) - el encabezado y el pie de página para el PDF.<ul>\n<li><code>title</code> String - El título para el encabezado PDF.</li>\n<li><code>url</code> String - la url para el pie de página PDF.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (opcional) - <code>true</code> for landscape, <code>false</code> para portrait.</li>\n<li><code>marginsType</code> Integer (optional) - Specifies the type of margins to use. Uses 0 for default margin, 1 for no margin, and 2 for minimum margin. y <code>width</code> en micrones.</li>\n<li><code>scaleFactor</code> Number (opcional) - El factor de escalado de la página web. Puede variar entre 0 to 100.</li>\n<li><code>pageRanges</code> Record&#x3C;string, number> (optional) - The page range to print. On macOS, only the first range is honored.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Índice de la última página a imprimir (inclusive) (0-based).</li>\n</ul></li>\n<li><code>pageSize</code> String | Size (opcional) - Especifica el tamaño de la página del PDF generado. Puede ser <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> o un objeto que contenga <code>height</code></li>\n<li><code>printBackground</code> Boolean (octional) - Si se va a imprimir los fondos CSS.</li>\n<li><code>printSelectionOnly</code> Boolean (opcional) - Se va a imprimir solo la selección.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Uint8Array></code> - Se resuelve cuando los datos PDF son generados.</p>\n<p>Imprime la página web de <code>webview</code> como PDF, Igual como <code>webContents.printToPDF(options)</code>.</p>\n<h3 id=\"webviewcapturepagerect\"><a href=\"#webviewcapturepagerect\"><code>&#x3C;webview>.capturePage([rect])</code></a></h3>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (opcional) - El área de la página para ser capturada.</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;NativeImage></code> - Resuelve con el un <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Captura una foto instantánea de la página dentro de <code>rect</code>. Omitiendo <code>rect</code> capturará toda la página visible.</p>\n<h3 id=\"webviewsendchannel-args\"><a href=\"#webviewsendchannel-args\"><code>&#x3C;webview>.send(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> Cadena</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code></p>\n<p>Envía un mensaje asincrónico al proceso de renderizado a través de <code>channel</code>. También se puede enviar argumentos arbitrarios. El proceso renderizador puede manejar el mensaje escuchando el evento <code>channel</code> con el módulo <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a>.</p>\n<p>Ver <a href=\"/docs/api/web-contents#contentssendchannel-args\">webContents.send</a> para ejemplos.</p>\n<h3 id=\"webviewsendtoframeframeid-channel-args\"><a href=\"#webviewsendtoframeframeid-channel-args\"><code>&#x3C;webview>.sendToFrame(frameId, channel, ...args)</code></a></h3>\n<ul>\n<li><code>frameId</code> [number, number] - <code>[processId, frameId]</code></li>\n<li><code>channel</code> Cadena</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code></p>\n<p>Envía un mensaje asincrónico al proceso de renderizado a través de <code>channel</code>. También se puede enviar argumentos arbitrarios. El proceso renderizador puede manejar el mensaje escuchando el evento <code>channel</code> con el módulo <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a>.</p>\n<p>Vea <a href=\"/docs/api/web-contents#contentssendtoframeframeid-channel-args\">webContents.sendToFrame</a> para ejemplos.</p>\n<h3 id=\"webviewsendinputeventevent\"><a href=\"#webviewsendinputeventevent\"><code>&#x3C;webview>.sendInputEvent(event)</code></a></h3>\n<ul>\n<li><code>event</code>  <a href=\"/docs/api/structures/mouse-input-event\">MouseInputEvent</a> | <a href=\"/docs/api/structures/mouse-wheel-input-event\">MouseWheelInputEvent</a> | <a href=\"/docs/api/structures/keyboard-input-event\">KeyboardInputEvent</a></li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code></p>\n<p>Envía un input <code>event</code> a la página.</p>\n<p>Ver <a href=\"/docs/api/web-contents#contentssendinputeventinputevent\">webContents.sendInputEvent</a> para una descripción detallada del objeto <code>event</code>.</p>\n<h3 id=\"webviewsetzoomfactorfactor\"><a href=\"#webviewsetzoomfactorfactor\"><code>&#x3C;webview>.setZoomFactor(factor)</code></a></h3>\n<ul>\n<li><code>factor</code> Number - Zoom factor.</li>\n</ul>\n<p>Cambia el nivel de zoom al nivel especificado. Factor de zoom es porcentaje de zoom dividido entre 100, así que 300% = 3.0.</p>\n<h3 id=\"webviewsetzoomlevellevel\"><a href=\"#webviewsetzoomlevellevel\"><code>&#x3C;webview>.setZoomLevel(level)</code></a></h3>\n<ul>\n<li><code>nivel</code> Número - Nivel de Zoom.</li>\n</ul>\n<p>Cambia el nivel de zoom al nivel especificado. El tamaño original es 0 y cada incremento por encima o por debajo representa un zoom del 20% mayor o menor a los límites predeterminados de 300% y 50% del tamaño original, respectivamente. La fórmula para esto es <code>scale := 1.2 ^ level</code>.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h3 id=\"webviewgetzoomfactor\"><a href=\"#webviewgetzoomfactor\"><code>&#x3C;webview>.getZoomFactor()</code></a></h3>\n<p>Devuelve <code>Number</code> - el factor de zoom actual.</p>\n<h3 id=\"webviewgetzoomlevel\"><a href=\"#webviewgetzoomlevel\"><code>&#x3C;webview>.getZoomLevel()</code></a></h3>\n<p>Devuelve <code>Number</code> - el nivel de zoom actual.</p>\n<h3 id=\"webviewsetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#webviewsetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>&#x3C;webview>.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h3>\n<ul>\n<li><code>minimumLevel</code> Número</li>\n<li><code>maximumLevel</code> Número</li>\n</ul>\n<p>Devuelve <code>Promise&#x3C;void></code></p>\n<p>Establecer el nivel de máximo y mínimo pizca de zoom.</p>\n<h3 id=\"webviewshowdefinitionforselection-macos\"><a href=\"#webviewshowdefinitionforselection-macos\"><code>&#x3C;webview>.showDefinitionForSelection()</code> <em>macOS</em></a></h3>\n<p>Muestra un diccionario que busca la palabra seleccionada en la página.</p>\n<h3 id=\"webviewgetwebcontentsid\"><a href=\"#webviewgetwebcontentsid\"><code>&#x3C;webview>.getWebContentsId()</code></a></h3>\n<p>Devuelve <code>Number</code> - El ID de WebContents de este <code>webview</code>.</p>\n<h2 id=\"eventos-dom\"><a href=\"#eventos-dom\">Eventos DOM</a></h2>\n<p>Los siguientes eventos DOM están disponibles en la etiqueta <code>webview</code>:</p>\n<h3 id=\"evento-load-commit\"><a href=\"#evento-load-commit\">Evento: 'load-commit'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>EsElFramePrincipal</code> Boolean</li>\n</ul>\n<p>Fired when a load has committed. This includes navigation within the current document as well as subframe document-level loads, but does not include asynchronous resource loads.</p>\n<h3 id=\"evento-did-finish-load\"><a href=\"#evento-did-finish-load\">Evento: 'did-finish-load'</a></h3>\n<p>Disparado cuando la navegación es terminada, i.e. el girador del tabulador dejará de girar, y el evento <code>onload</code> es discapacitado.</p>\n<h3 id=\"evento-did-fail-load\"><a href=\"#evento-did-fail-load\">Evento: 'did-fail-load'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>EsElFramePrincipal</code> Boolean</li>\n</ul>\n<p>Este evento es como <code>did-finish-load</code>,pero disparado cuando la carga falla o es cancelada, e.g. <code>window.stop()</code> es involucrada.</p>\n<h3 id=\"evento-did-frame-finish-load\"><a href=\"#evento-did-frame-finish-load\">Evento: 'did-frame-finish-load'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>EsElFramePrincipal</code> Boolean</li>\n</ul>\n<p>Disparado cuando un frame ha terminado la navegación.</p>\n<h3 id=\"evento-did-start-loading\"><a href=\"#evento-did-start-loading\">Evento: 'did-start-loading'</a></h3>\n<p>Corresponde a los puntos en tiempo cuando el girador del tabulador empieza a girar.</p>\n<h3 id=\"evento-did-stop-loading\"><a href=\"#evento-did-stop-loading\">Evento: 'did-stop-loading'</a></h3>\n<p>Corresponde a los puntos en tiempo cuando el girador del tabulador termina de girar.</p>\n<h3 id=\"event-did-attach\"><a href=\"#event-did-attach\">Event: 'did-attach'</a></h3>\n<p>Fired when attached to the embedder web contents.</p>\n<h3 id=\"evento-dom-ready\"><a href=\"#evento-dom-ready\">Evento: 'dom-ready'</a></h3>\n<p>Disparado cuando el documento en el frame dado es cargado.</p>\n<h3 id=\"evento-page-title-updated\"><a href=\"#evento-page-title-updated\">Evento: 'page-title-updated'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolen</li>\n</ul>\n<p>Disparado cuando el título de la página se configura durante la navegación. <code>explicitSet</code> es false cuando el título es sincronizado desde el archivo url.</p>\n<h3 id=\"evento-page-favicon-updated\"><a href=\"#evento-page-favicon-updated\">Evento: 'page-favicon-updated'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>favicons</code> Cadena[] - Arreglo para URLs.</li>\n</ul>\n<p>Disparado cuando la página recibe urls de favicon.</p>\n<h3 id=\"evento-enter-html-full-screen\"><a href=\"#evento-enter-html-full-screen\">Evento: \"enter-html-full-screen\"</a></h3>\n<p>Disparado cuando la página entra en pantalla entera i¿y es activado por HTML API.</p>\n<h3 id=\"evento-leave-html-full-screen\"><a href=\"#evento-leave-html-full-screen\">Evento: \"leave-html-full-screen\"</a></h3>\n<p>Disparado cuando la página deja la pantalla completa activada por HTML API.</p>\n<h3 id=\"evento-console-message\"><a href=\"#evento-console-message\">Evento: 'console-message'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>level</code> Entero - El nivel de registro, desde 0 hasta 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>message</code> String - The actual console message</li>\n<li><code>line</code> Entero - El número de línea de la fuente que activó este mensaje de consola</li>\n<li><code>sourceId</code> Cadena</li>\n</ul>\n<p>Disparado cuando la ventana invitada entra un mensaje de consola.</p>\n<p>El siguiente código ejemplo sigue con todos los mensajes guardados a la consola embebedora sin preocupación por el nivel de guardado u otras propiedades.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'console-message'</span>, (e) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Guest page logged a message:'</span>, e.message)\n})\n</code></pre>\n<h3 id=\"evento-found-in-page\"><a href=\"#evento-found-in-page\">Evento: 'found-in-page'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>result</code> Object<ul>\n<li><code>requestId</code> Íntegro</li>\n<li><code>activeMatchOrdinal</code> Integer - Posición de la coincidencia activa.</li>\n<li><code>matches</code> Integer - Número de coincidencias.</li>\n<li><code>selectionArea</code> Rectangle - Coordenadas de la primera región de coincidencia.</li>\n<li><code>finalUpdate</code> Boolean</li>\n</ul></li>\n</ul>\n<p>Disparado cuando un resultado es disponible en la solicitud <a href=\"#webviewfindinpagetext-options\"><code>webview.findInPage</code></a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'found-in-page'</span>, (e) => {\n  webview.stopFindInPage(<span class=\"hljs-string\">'keepSelection'</span>)\n})\n\n<span class=\"hljs-keyword\">const</span> requestId = webview.findInPage(<span class=\"hljs-string\">'test'</span>)\n<span class=\"hljs-built_in\">console</span>.log(requestId)\n</code></pre>\n<h3 id=\"evento-new-window\"><a href=\"#evento-new-window\">Evento: 'new-window'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String</li>\n<li><code>disposition</code> String - Puede ser <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> and <code>other</code>.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - Las opciones que deberían ser usadas para crear el nuevo <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</li>\n</ul>\n<p>Disparado cuando la página de invitado intenta abrir una nueva ventana de buscador.</p>\n<p>El siguiente código ejemplo abre el nuevo url en el buscador por defecto del sistema.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\n\nwebview.addEventListener(<span class=\"hljs-string\">'new-window'</span>, <span class=\"hljs-keyword\">async</span> (e) => {\n  <span class=\"hljs-keyword\">const</span> protocol = (<span class=\"hljs-keyword\">new</span> URL(e.url)).protocol\n  <span class=\"hljs-keyword\">if</span> (protocol === <span class=\"hljs-string\">'http:'</span> || protocol === <span class=\"hljs-string\">'https:'</span>) {\n    <span class=\"hljs-keyword\">await</span> shell.openExternal(e.url)\n  }\n})\n</code></pre>\n<h3 id=\"evento-will-navigate\"><a href=\"#evento-will-navigate\">Evento: 'will-navigate'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitido cuando un usuario o l página quiere empezar la navegación. Puede ocurrir cuando el objeto <code>window.location</code> se cambia o un usuario hace clic en un enlace en la página.</p>\n<p>Este evento no se emitirá cuando la navegación es iniciada con programación con APIs como <code>&#x3C;webview>.loadURL</code> y <code>&#x3C;webview>.back</code>.</p>\n<p>It is also not emitted during in-page navigation, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<p>Llamar a <code>event.preventDefault()</code>, <strong>NO</strong> tiene ningún efecto.</p>\n<h3 id=\"evento-did-start-navigation\"><a href=\"#evento-did-start-navigation\">Evento: 'did-start-navigation'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>EsElFramePrincipal</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitido cuando cualquier frame (incluyendo el principal) comienza la navegación. <code>isInPlace</code> will be <code>true</code> for in-page navigations.</p>\n<h3 id=\"evento-did-redirect-navigation\"><a href=\"#evento-did-redirect-navigation\">Evento: 'did-redirect-navigation'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>EsElFramePrincipal</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted after a server side redirect occurs during navigation. For example a 302 redirect.</p>\n<h3 id=\"evento-did-navigate\"><a href=\"#evento-did-navigate\">Evento: 'did-navigate'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitido cuando la navegación es finalizada.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h3 id=\"evento-did-frame-navigate\"><a href=\"#evento-did-frame-navigate\">Evento: 'did-frame-navigate'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 para navegaciones no HTTP</li>\n<li><code>httpStatusText</code> String - vacío para navegaciones no HTTP</li>\n<li><code>EsElFramePrincipal</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitido cuando se ha realizado un navegación de algun frame.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h3 id=\"evento-did-navigate-in-page\"><a href=\"#evento-did-navigate-in-page\">Evento: 'did-navigate-in-page'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>EsElFramePrincipal</code> Boolean</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitido cuando una navegación dentro de la página sucede.</p>\n<p>Cuando una navegación dentro de la página sucede, el URL de la página cambia, pero no causa una navegación fuera de la página. Ejemplos de ésto ocurriendo son cuando los links son clickeados o cuando el evento DOM <code>hashchange</code> es activado.</p>\n<h3 id=\"evento-close\"><a href=\"#evento-close\">Evento: \"close\"</a></h3>\n<p>Disparado cuando la página de invitado intenta cerrarse.</p>\n<p>El siguiente código ejemplo navega el <code>webview</code> a <code>about:blank</code> cuando el invitado intenta cerrase.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'close'</span>, () => {\n  webview.src = <span class=\"hljs-string\">'about:blank'</span>\n})\n</code></pre>\n<h3 id=\"evento-ipc-message\"><a href=\"#evento-ipc-message\">Evento: 'ipc-message'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>frameId</code> [number, number] - par de <code>[processId, frameId]</code>.</li>\n<li><code>channel</code> Cadena</li>\n<li><code>args</code> any[]</li>\n</ul>\n<p>Disparado cuando la página de invitado ha enviado un mensaje asincrónico a la página de embebido.</p>\n<p>Con el método <code>sendToHost</code> y el evento <code>ipc-message</code> puedes comunicarte entre la página de invitado y la página del integrador:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In embedder page.</span>\n<span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'ipc-message'</span>, (event) => {\n  <span class=\"hljs-built_in\">console</span>.log(event.channel)\n  <span class=\"hljs-comment\">// Prints \"pong\"</span>\n})\nwebview.send(<span class=\"hljs-string\">'ping'</span>)\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In guest page.</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcRenderer.on(<span class=\"hljs-string\">'ping'</span>, () => {\n  ipcRenderer.sendToHost(<span class=\"hljs-string\">'pong'</span>)\n})\n</code></pre>\n<h3 id=\"evento-crashed\"><a href=\"#evento-crashed\">Evento: 'crashed'</a></h3>\n<p>Disparado cuando el proceso de renderizado se cierra.</p>\n<h3 id=\"evento-plugin-crashed\"><a href=\"#evento-plugin-crashed\">Evento: 'plugin-crashed'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>name</code> String</li>\n<li><code>version</code> Cadena</li>\n</ul>\n<p>Disparado cuando el proceso de plugin se cae.</p>\n<h3 id=\"evento-destroyed\"><a href=\"#evento-destroyed\">Evento: 'destroyed'</a></h3>\n<p>Disparado cuando el WebContents es destrozado.</p>\n<h3 id=\"evento-media-started-playing\"><a href=\"#evento-media-started-playing\">Evento: 'media-started-playing'</a></h3>\n<p>Emitido cuando la media empieza a reproducirse.</p>\n<h3 id=\"evento-media-paused\"><a href=\"#evento-media-paused\">Evento: 'media-paused'</a></h3>\n<p>Emitido cuando la media es pausada o ha terminado de reproducirse.</p>\n<h3 id=\"evento-did-change-theme-color\"><a href=\"#evento-did-change-theme-color\">Evento: 'did-change-theme-color'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>themeColor</code> Cadena</li>\n</ul>\n<p>Emitted when a page's theme color changes. This is usually due to encountering a meta tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">'theme-color'</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">'#ff0000'</span>></span>\n</code></pre>\n<h3 id=\"evento-update-target-url\"><a href=\"#evento-update-target-url\">Evento: 'update-target-url'</a></h3>\n<p>Devuelve:</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitido cuando el mouse se mueve sobre un link o el teclado se mueve el concentrado a un link.</p>\n<h3 id=\"evento-devtools-opened\"><a href=\"#evento-devtools-opened\">Evento: 'devtools-opened'</a></h3>\n<p>Emitido cuando DevTools es abierto.</p>\n<h3 id=\"evento-devtools-closed\"><a href=\"#evento-devtools-closed\">Evento: 'devtools-closed'</a></h3>\n<p>Emitido cuando Devtools es cerrado.</p>\n<h3 id=\"evento-devtools-focused\"><a href=\"#evento-devtools-focused\">Evento: 'devtools-focused'</a></h3>\n<p>Emitido cuando DevTools es centrado o abierto.</p>",
      "title": "<webview> Etiqueta",
      "description": "Mostrar contenido externo de la web en un cuadro aislado y procesado."
    },
    "/docs/api/window-open": {
      "locale": "es-ES",
      "slug": "window-open",
      "href": "/docs/api/window-open",
      "crowdinFileId": "256409",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/window-open.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"abrir-ventanas-desde-el-renderer\"><a href=\"#abrir-ventanas-desde-el-renderer\">Abrir ventanas desde el renderer</a></h1>\n<p>There are several ways to control how windows are created from trusted or untrusted content within a renderer. Windows can be created from the renderer in two ways:</p>\n<ul>\n<li>clicking on links or submitting forms adorned with <code>target=_blank</code></li>\n<li>JavaScript calling <code>window.open()</code></li>\n</ul>\n<p>Para contenido del mismo origen, la nueva ventana es creada dentro del mismo proceso, permitiendo al padres acceder a la ventana hija derectamente. Esto puede ser muy útil para las sub ventanas de la aplicación que actúan como paneles de preferencia o similares, ya que el padre puede renderizar directamente a la sub ventana, como si fuera un <code>div</code> en el padre. Este es el mismo comportamiento que en el navegador.</p>\n<p>Cuando <code>nativeWindowOpen</code> se establece a false, <code>window.open</code> en cambio resulta en la creación de una <a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code></a>, un envoltorio ligero alrededor de <code>BrowserWindow</code>.</p>\n<p>Electron pairs this native Chrome <code>Window</code> with a BrowserWindow under the hood. You can take advantage of all the customization available when creating a BrowserWindow in the main process by using <code>webContents.setWindowOpenHandler()</code> for renderer-created windows.</p>\n<p>BrowserWindow constructor options are set by, in increasing precedence order: parsed options from the <code>features</code> string from <code>window.open()</code>, security-related webPreferences inherited from the parent, and options given by <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>. Note that <code>webContents.setWindowOpenHandler</code> has final say and full privilege because it is invoked in the main process.</p>\n<h3 id=\"windowopenurl-framename-features\"><a href=\"#windowopenurl-framename-features\"><code>window.open(url[, frameName][, features])</code></a></h3>\n<ul>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String (opcional)</li>\n<li><code>features</code> String (opcional)</li>\n</ul>\n<p>Returns <a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code></a> | <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window\"><code>Window</code></a></p>\n<p><code>features</code> is a comma-separated key-value list, following the standard format of the browser. Electron will parse <code>BrowserWindowConstructorOptions</code> out of this list where possible, for convenience. For full control and better ergonomics, consider using <code>webContents.setWindowOpenHandler</code> to customize the BrowserWindow creation.</p>\n<p>A subset of <code>WebPreferences</code> can be set directly, unnested, from the features string: <code>zoomFactor</code>, <code>nodeIntegration</code>, <code>preload</code>, <code>javascript</code>, <code>contextIsolation</code>, and <code>webviewTag</code>.</p>\n<p>Por ejemplo:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">'https://github.com'</span>, <span class=\"hljs-string\">'_blank'</span>, <span class=\"hljs-string\">'top=500,left=200,frame=false,nodeIntegration=no'</span>)\n</code></pre>\n<p><strong>Notas:</strong></p>\n<ul>\n<li>La integración de nodo siempre estará deshabilitada en la <code>window</code> abierta si está deshabilitada en la ventana principal.</li>\n<li>El aislamiento de contexto siempre estará habilitado en la <code>window</code> abierta si está habilitado en la ventana principal.</li>\n<li>JavaScript siempre estará deshabilitado en la <code>window</code> abierta si está deshabilitado en la ventana principal.</li>\n<li>Las características no estándares (que no son manejadas por Chromium o Electron) dadas en <code>features</code> serán pasadas a cualquier manejador de evento registrado <code>did-create-window</code> de <code>webContents</code> en el argumento <code>options</code>.</li>\n<li><code>frameName</code> follows the specification of <code>windowName</code> located in the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters\">native documentation</a>.</li>\n</ul>\n<p>To customize or cancel the creation of the window, you can optionally set an override handler with <code>webContents.setWindowOpenHandler()</code> from the main process. Devolver <code>{ action: 'deny' }</code> cancela la ventana. Devolver <code>{action: 'allow', overrideBrowserWindowOptions: { ... } }</code> permitará abrir la ventana y configurar el <code>BrowserWindowConstructorOptions</code> que se usará al crear la ventana. Tenga en cuenta que esto es más poderoso que pasar opciones a través de la cadena de características, ya que el renderizador tiene privilegios más limitados para decidir las preferencias de seguridad que el proceso principal.</p>\n<h3 id=\"ejemplo-de-window-nativo\"><a href=\"#ejemplo-de-window-nativo\">Ejemplo de <code>Window</code> nativo</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// main.js</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-comment\">// En este ejemplo, solo ventanas con la url `about:blank` serán creadas.</span>\n<span class=\"hljs-comment\">// All other urls will be blocked.</span>\nmainWindow.webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (url === <span class=\"hljs-string\">'about:blank'</span>) {\n    <span class=\"hljs-keyword\">return</span> {\n      <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span>,\n      <span class=\"hljs-attr\">overrideBrowserWindowOptions</span>: {\n        <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span>,\n        <span class=\"hljs-attr\">fullscreenable</span>: <span class=\"hljs-literal\">false</span>,\n        <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'black'</span>,\n        <span class=\"hljs-attr\">webPreferences</span>: {\n          <span class=\"hljs-attr\">preload</span>: <span class=\"hljs-string\">'my-child-window-preload-script.js'</span>\n        }\n      }\n    }\n  }\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// renderer process (mainWindow)</span>\n<span class=\"hljs-keyword\">const</span> childWindow = <span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">''</span>, <span class=\"hljs-string\">'modal'</span>)\nchildWindow.document.write(<span class=\"hljs-string\">'&#x3C;h1>Hello&#x3C;/h1>'</span>)\n</code></pre>\n<h3 id=\"ejemplo-de-browserwindowproxy\"><a href=\"#ejemplo-de-browserwindowproxy\">Ejemplo de <code>BrowserWindowProxy</code></a></h3>\n<pre><code class=\"hljs language-javascript\">\n<span class=\"hljs-comment\">// main.js</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nativeWindowOpen</span>: <span class=\"hljs-literal\">false</span> }\n})\n\nmainWindow.webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (url.startsWith(<span class=\"hljs-string\">'https://github.com/'</span>)) {\n    <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span> }\n  }\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n\nmainWindow.webContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (childWindow) => {\n  <span class=\"hljs-comment\">// Por ejemplo...</span>\n  childWindow.webContents.on(<span class=\"hljs-string\">'will-navigate'</span>, (e) => {\n    e.preventDefault()\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// renderer.js</span>\n<span class=\"hljs-keyword\">const</span> windowProxy = <span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">'https://github.com/'</span>, <span class=\"hljs-literal\">null</span>, <span class=\"hljs-string\">'minimizable=false'</span>)\nwindowProxy.postMessage(<span class=\"hljs-string\">'hi'</span>, <span class=\"hljs-string\">'*'</span>)\n</code></pre>",
      "title": "Abrir ventanas desde el renderer",
      "description": ""
    },
    "/docs/tutorial/windows-arm": {
      "locale": "es-ES",
      "slug": "windows-arm",
      "href": "/docs/tutorial/windows-arm",
      "crowdinFileId": "256271",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-arm.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"windows-on-arm\"><a href=\"#windows-on-arm\">Windows on ARM</a></h1>\n<p>If your app runs with Electron 6.0.8 or later, you can now build it for Windows 10 on Arm. Esto aumenta considerablemente el rendimiento, pero necesitará recopilar cualquier módulo nativo usado en tu app. It may also require small fixups to your build and packaging scripts.</p>\n<h2 id=\"running-a-basic-app\"><a href=\"#running-a-basic-app\">Running a basic app</a></h2>\n<p>If your app doesn't use any native modules, then it's really easy to create an Arm version of your app.</p>\n<ol>\n<li>Make sure that your app's <code>node_modules</code> directory is empty.</li>\n<li>Using a <em>Command Prompt</em>, run <code>set npm_config_arch=arm64</code> before running <code>npm install</code>/<code>yarn install</code> as usual.</li>\n<li><a href=\"/docs/tutorial/quick-start#prerequisites\">If you have Electron installed as a development dependency</a>, npm will download and unpack the arm64 version. You can then package and distribute your app as normal.</li>\n</ol>\n<h2 id=\"general-considerations\"><a href=\"#general-considerations\">General considerations</a></h2>\n<h3 id=\"architecture-specific-code\"><a href=\"#architecture-specific-code\">Architecture-specific code</a></h3>\n<p>Lots of Windows-specific code contains if... else logic that selects between either the x64 or x86 architectures.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">if</span> (process.arch === <span class=\"hljs-string\">'x64'</span>) {\n  <span class=\"hljs-comment\">// Do 64-bit thing...</span>\n} <span class=\"hljs-keyword\">else</span> {\n  <span class=\"hljs-comment\">// Do 32-bit thing...</span>\n}\n</code></pre>\n<p>If you want to target arm64, logic like this will typically select the wrong architecture, so carefully check your application and build scripts for conditions like this. In custom build and packaging scripts, you should always check the value of <code>npm_config_arch</code> in the environment, rather than relying on the current process arch.</p>\n<h3 id=\"native-modules\"><a href=\"#native-modules\">Native modules</a></h3>\n<p>If you use native modules, you must make sure that they compile against v142 of the MSVC compiler (provided in Visual Studio 2017). You must also check that any pre-built <code>.dll</code> or <code>.lib</code> files provided or referenced by the native module are available for Windows on Arm.</p>\n<h3 id=\"probar-tu-app\"><a href=\"#probar-tu-app\">Probar tu app</a></h3>\n<p>To test your app, use a Windows on Arm device running Windows 10 (version 1903 or later). Make sure that you copy your application over to the target device - Chromium's sandbox will not work correctly when loading your application assets from a network location.</p>\n<h2 id=\"development-prerequisites\"><a href=\"#development-prerequisites\">Development prerequisites</a></h2>\n<h3 id=\"nodejsnode-gyp\"><a href=\"#nodejsnode-gyp\">Node.js/node-gyp</a></h3>\n<p><a href=\"https://nodejs.org/en/\">Node.js v12.9.0 or later is recommended.</a> If updating to a new version of Node is  undesirable, you can instead <a href=\"https://github.com/nodejs/node-gyp/wiki/Updating-npm&#x27;s-bundled-node-gyp\">update npm's copy of node-gyp manually</a> to version 5.0.2 or later, which contains the required changes to compile native modules for Arm.</p>\n<h3 id=\"visual-studio-2017\"><a href=\"#visual-studio-2017\">Visual Studio 2017</a></h3>\n<p>Visual Studio 2017 (any edition) is required for cross-compiling native modules. You can download Visual Studio Community 2017 via Microsoft's <a href=\"https://visualstudio.microsoft.com/dev-essentials/\">Visual Studio Dev Essentials program</a>. After installation, you can add the Arm-specific components by running the following from a <em>Command Prompt</em>:</p>\n<pre><code class=\"hljs language-powershell\">vs_installer.exe ^\n--add Microsoft.VisualStudio.Workload.NativeDesktop ^\n--add Microsoft.VisualStudio.Component.VC.ATLMFC ^\n--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ^\n--add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ^\n--includeRecommended\n</code></pre>\n<h4 id=\"creating-a-cross-compilation-command-prompt\"><a href=\"#creating-a-cross-compilation-command-prompt\">Creating a cross-compilation command prompt</a></h4>\n<p>Setting <code>npm_config_arch=arm64</code> in the environment creates the correct arm64 <code>.obj</code> files, but the standard <em>Developer Command Prompt for VS 2017</em> will use the x64 linker. To fix this:</p>\n<ol>\n<li>Duplicate the <em>x64_x86 Cross Tools Command Prompt for VS 2017</em> shortcut (e.g. by locating it in the start menu, right clicking, selecting <em>Open File Location</em>, copying and pasting) to somewhere convenient.</li>\n<li>Right click the new shortcut and choose <em>Properties</em>.</li>\n<li>Change the <em>Target</em> field to read <code>vcvarsamd64_arm64.bat</code> at the end instead of <code>vcvarsamd64_x86.bat</code>.</li>\n</ol>\n<p>If done successfully, the command prompt should print something similar to this on startup:</p>\n<pre><code class=\"hljs language-bat\">**********************************************************************\n** Visual Studio <span class=\"hljs-number\">2017</span> Developer Command Prompt v15.<span class=\"hljs-number\">9</span>.<span class=\"hljs-number\">15</span>\n** Copyright (c) <span class=\"hljs-number\">2017</span> Microsoft Corporation\n**********************************************************************\n[vcvarsall.bat] Environment initialized <span class=\"hljs-keyword\">for</span>: 'x64_arm64'\n</code></pre>\n<p>If you want to develop your application directly on a Windows on Arm device, substitute <code>vcvarsx86_arm64.bat</code> in <em>Target</em> so that cross-compilation can happen with the device's x86 emulation.</p>\n<h3 id=\"linking-against-the-correct-nodelib\"><a href=\"#linking-against-the-correct-nodelib\">Linking against the correct <code>node.lib</code></a></h3>\n<p>By default, <code>node-gyp</code> unpacks Electron's node headers and downloads the x86 and x64 versions of <code>node.lib</code> into <code>%APPDATA%\\..\\Local\\node-gyp\\Cache</code>, but it does not download the arm64 version (<a href=\"https://github.com/nodejs/node-gyp/pull/1875\">a fix for this is in development</a>.) To fix this:</p>\n<ol>\n<li>Download the arm64 <code>node.lib</code> from <a href=\"https://electronjs.org/headers/v6.0.9/win-arm64/node.lib\">https://electronjs.org/headers/v6.0.9/win-arm64/node.lib</a></li>\n<li>Move it to <code>%APPDATA%\\..\\Local\\node-gyp\\Cache\\6.0.9\\arm64\\node.lib</code></li>\n</ol>\n<p>Substitute <code>6.0.9</code> for the version you're using.</p>\n<h2 id=\"cross-compiling-native-modules\"><a href=\"#cross-compiling-native-modules\">Cross-compiling native modules</a></h2>\n<p>After completing all of the above, open your cross-compilation command prompt and run <code>set npm_config_arch=arm64</code>. Then use <code>npm install</code> to build your project as normal. As with cross-compiling x86 modules, you may need to remove <code>node_modules</code> to force recompilation of native modules if they were previously compiled for another architecture.</p>\n<h2 id=\"debugging-native-modules\"><a href=\"#debugging-native-modules\">Debugging native modules</a></h2>\n<p>Debugging native modules can be done with Visual Studio 2017 (running on your development machine) and corresponding <a href=\"https://docs.microsoft.com/en-us/visualstudio/debugger/remote-debugging-cpp?view=vs-2019\">Visual Studio Remote Debugger</a> running on the target device. To debug:</p>\n<ol>\n<li>Launch your app <code>.exe</code> on the target device via the <em>Command Prompt</em> (passing <code>--inspect-brk</code> to pause it before any native modules are loaded).</li>\n<li>Launch Visual Studio 2017 on your development machine.</li>\n<li>Connect to the target device by selecting <em>Debug > Attach to Process...</em> and enter the device's IP address and the port number displayed by the Visual Studio Remote Debugger tool.</li>\n<li>Click <em>Refresh</em> and select the <a href=\"/docs/development/debug-instructions-windows\">appropriate Electron process to attach</a>.</li>\n<li>You may need to make sure that any symbols for native modules in your app are loaded correctly. To configure this, head to <em>Debug > Options...</em> in Visual Studio 2017, and add the folders containing your <code>.pdb</code> symbols under <em>Debugging > Symbols</em>.</li>\n<li>Once attached, set any appropriate breakpoints and resume JavaScript execution using Chrome's <a href=\"/docs/tutorial/debugging-main-process\">remote tools for Node</a>.</li>\n</ol>\n<h2 id=\"getting-additional-help\"><a href=\"#getting-additional-help\">Getting additional help</a></h2>\n<p>If you encounter a problem with this documentation, or if your app works when compiled for x86 but not for arm64, please <a href=\"/docs/development/issues\">file an issue</a> with \"Windows on Arm\" in the title.</p>",
      "title": "Windows on ARM",
      "description": ""
    },
    "/docs/tutorial/windows-store-guide": {
      "locale": "es-ES",
      "slug": "windows-store-guide",
      "href": "/docs/tutorial/windows-store-guide",
      "crowdinFileId": "256273",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-store-guide.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"guía-de-windows-store\"><a href=\"#guía-de-windows-store\">Guía de Windows Store</a></h1>\n<p>Con Windows 10, el buen ejecutable anterior win32 obtuvo un nuevo hermano: La Plataforma Universal de Windows. El nuevo formato <code>.appx</code> no solo permite un nuevo número de nuevas y poderosas API como Cortana o Notificaciones Push, pero a través de la Tienda Windows, también simplifica la instalación y la actualización.</p>\n<p>Microsoft <a href=\"https://github.com/catalystcode/electron-windows-store\">desarrolló una herramienta que compila las aplicaciones Electron como <code>.appx</code> paquetes</a>, permitiendo a los desarrolladores usar algunas de las buenas cosas encontradas en la nueva aplicación modelo. Esta guía explica cómo usarla - y cuáles son las capacidades y limitaciones de un paquete de Electron AppX.</p>\n<h2 id=\"antecedentes-y-requerimientos\"><a href=\"#antecedentes-y-requerimientos\">Antecedentes y Requerimientos</a></h2>\n<p>Windows 10 \"Actualización Aniversario\" puede ejecutar los binarios win32 <code>.exe</code> con su lanzamiento junto a un sistema de archivos y registro virtualizados. Ambos se crean durante la compilación mediante la ejecución de la aplicación y el instalador dentro de un Contenedor de Windows, lo que permite a Windows identificar exactamente qué modificaciones en el sistema operativo se realizan durante la instalación. Emparejar el ejecutable con un sistema de archivos virtual y un registro virtual permite que Windows habilite la instalación y desinstalación con un solo clic.</p>\n<p>Además, el exe es lanzado dentro del modelo de appx, lo que significa que puede usar muchas de las API disponibles para la Plataforma Universal de Windows. Para obtener aún más capacidades, una aplicación de Electron puede emparejarse con una tarea de fondo UWP invisible lanzada junto con el <code>exe</code> - un tipo de lanzamiento similar a un sidekick para ejecutar tareas en segundo plano, recibir notificaciones push, o comunicarse con otras aplicaciones UWP.</p>\n<p>Para compilar cualquier aplicación Electron existente, asegúrese de tener los siguientes requisitos:</p>\n<ul>\n<li>Windows 10 con la Actualización Aniversario (lanzada el 2 de agosto de 2016)</li>\n<li>El SDK de Windows 10, <a href=\"https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk\">descargable aquí</a></li>\n<li>Al menos Node 4 (para verificar, ejecutar <code>node -v</code>)</li>\n</ul>\n<p>Luego, vaya e instale la CLI <code>electron-windows-store</code>:</p>\n<pre><code class=\"hljs language-sh\">npm install -g electron-windows-store\n</code></pre>\n<h2 id=\"paso-1-empaqueta-tu-aplicación-electron\"><a href=\"#paso-1-empaqueta-tu-aplicación-electron\">Paso 1: Empaqueta tu aplicación Electron</a></h2>\n<p>Empaquetar la aplicación usando <a href=\"https://github.com/electron/electron-packager\">electron-packager</a> (o una herramienta similar). Asegúrese de eliminar los <code>node_modules</code> que no necesita en su aplicación final, ya que cualquier módulo que realmente no necesite, aumentará el tamaño de su aplicación.</p>\n<p>La salida debería verse más o menos de esta forma:</p>\n<pre><code class=\"hljs language-plaintext\">├── Ghost.exe\n├── LICENSE\n├── content_resources_200_percent.pak\n├── content_shell.pak\n├── d3dcompiler_47.dll\n├── ffmpeg.dll\n├── icudtl.dat\n├── libEGL.dll\n├── libGLESv2.dll\n├── locales\n│   ├── am.pak\n│   ├── ar.pak\n│   ├── [...]\n├── node.dll\n├── resources\n│   └── app.asar\n├── v8_context_snapshot.bin\n├── squirrel.exe\n└── ui_resources_200_percent.pak\n</code></pre>\n<h2 id=\"paso-2-ejecutando-electron-windows-store\"><a href=\"#paso-2-ejecutando-electron-windows-store\">Paso 2: Ejecutando electron-windows-store</a></h2>\n<p>Desde un PowerShell elevado (ejecútelo como \"Administrador\"), ejecute <code>electron-windows-store</code> con los parámetros requeridos, pasando los directorios de entrada y salida, el nombre y la versión de la aplicación y la confirmación de que <code>node_modules</code> debe ser aplanado.</p>\n<pre><code class=\"hljs language-powershell\">electron-windows-store `\n    --input-directory C:\\myelectronapp `\n    --output-directory C:\\output\\myelectronapp `\n    --package-version <span class=\"hljs-number\">1.0</span>.<span class=\"hljs-number\">0.0</span> `\n    --package-name myelectronapp\n</code></pre>\n<p>Una vez ejecutada, la herramienta comienza a funcionar: acepta su aplicación Electron como entrada, aplanando los <code>node_modules</code>. Luego, archiva su aplicación como <code>app.zip</code>. Utilizando un instalador y un contenedor de Windows, la herramienta crea un paquete AppX \"expandido\", incluido el Manifiesto de Aplicación de Windows (<code>AppXManifest.xml</code>), así como el sistema de archivos virtual y el registro virtual dentro de su carpeta de salida.</p>\n<p>Una vez que se crean los archivos de AppX expandidos, la herramienta usa el Empaquetador de Aplicaciones de Windows (<code>MakeAppx.exe</code>) para crear un paquete de AppX de un solo archivo a partir de esos archivos en el disco. Finalmente, la herramienta se puede usar para crear un certificado de confianza en su computadora para firmar el nuevo paquete AppX. Con el paquete AppX firmado, la CLI también puede instalar automáticamente el paquete en su máquina.</p>\n<h2 id=\"paso-3-usando-el-paquete-appx\"><a href=\"#paso-3-usando-el-paquete-appx\">Paso 3: Usando el Paquete AppX</a></h2>\n<p>Para ejecutar su paquete, sus usuarios necesitarán Windows 10 con la llamada \"Actualización Aniversario\". Se pueden encontrar detalles sobre cómo actualizar Windows <a href=\"https://blogs.windows.com/windowsexperience/2016/08/02/how-to-get-the-windows-10-anniversary-update\">aquí</a>.</p>\n<p>En oposición a las aplicaciones UWP tradicionales, las aplicaciones empaquetadas actualmente necesitan someterse a un proceso de verificación manual, para lo cual puede aplicar <a href=\"https://developer.microsoft.com/en-us/windows/projects/campaigns/desktop-bridge\">aquí</a>. Mientras tanto, todos los usuarios podrán instalar sus paquetes haciendo doble clic en él, podría no ser necesario volver a enviar el paquete a la tienda, si lo que esta buscando es un metodo de instalacion mas sencillo. En entornos administrados (generalmente empresas), se puede usar el <code>Add-AppxPackage</code> <a href=\"https://technet.microsoft.com/en-us/library/hh856048.aspx\">PowerShell Cmdlet se puede utilizar para instalarlo de forma automática</a>.</p>\n<p>Otra limitación importante es que el paquete AppX compilado todavía contiene un ejecutable Win32 - y por lo tanto, no se ejecutará en Xbox, HoloLens o teléfonos.</p>\n<h2 id=\"opcional-añadir-características-uwp-usando-un-backgroundtask\"><a href=\"#opcional-añadir-características-uwp-usando-un-backgroundtask\">Opcional: Añadir características UWP usando un BackgroundTask</a></h2>\n<p>Puede asociar su aplicación Electron con una tarea de fondo UWP invisible que haga uso completo de las características de Windows 10, como notificaciones push, integración Cortana o Live Tiles.</p>\n<p>Para comprobar cómo una aplicación de Electron que es utilizada por una tarea en segundo plano envía notificaciones Toast y Lives Tiles, <a href=\"https://github.com/felixrieseberg/electron-uwp-background\">dale una mirada al ejemplo proporcionado por Microsoft</a>.</p>\n<h2 id=\"opcional-convertir-utilizando-la-virtualización-de-contenedores\"><a href=\"#opcional-convertir-utilizando-la-virtualización-de-contenedores\">Opcional: Convertir utilizando la Virtualización de Contenedores</a></h2>\n<p>Para generar el paquete AppX, la CLI <code>electron-windows-store</code> usa una plantilla que debería funcionar para la mayoría de las aplicaciones Electron. Sin embargo, si está utilizando un instalador personalizado o experimenta algún problema con el paquete generado, puede intentar crear un paquete mediante la compilación con un contenedor de Windows: en este modo, la CLI instalará y ejecutará su aplicación en un contenedor en blanco de Windows para determinar qué modificaciones está haciendo exactamente su aplicación al sistema operativo.</p>\n<p>Antes de ejecutar la CLI por primera vez, deberá configurar el \"Windows Desktop App Converter\". Esto llevará algunos minutos, pero no te preocupes, solo tienes que hacerlo esta vez. Descarga y Desktop App Converter desde <a href=\"https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-run-desktop-app-converter\">aquí</a>. Recibirá dos archivos: <code>DesktopAppConverter.zip</code> y <code>BaseImage-14316.wim</code>.</p>\n<ol>\n<li>Descomprima <code>DesktopAppConverter.zip</code>. Desde un PowerShell elevado (abierto con \"ejecutar como administrador\", asegúrese de que la política de ejecución de su sistema nos permita ejecutar todo lo que pretendemos ejecutar llamando a <code>Set-ExecutionPolicy bypass</code>.</li>\n<li>A continuación, ejecute la instalación del Desktop App Converter, pasando la ubicación de la imagen base de Windows (descargada como <code>BaseImage-14316.wim</code>), llamando a <code>.\\DesktopAppConverter.ps1 -Setup -BaseImage.\\BaseImage-14316.wim</code>.</li>\n<li>Si ejecuta el comando anterior para reiniciar, reinicie su máquina y vuelva a ejecutar el comando anterior luego de un reinicio exitoso.</li>\n</ol>\n<p>Una vez que la instalación haya tenido éxito, puede pasar a la compilación de su aplicación Electron.</p>",
      "title": "Guía de Windows Store",
      "description": ""
    },
    "/docs/tutorial/windows-taskbar": {
      "locale": "es-ES",
      "slug": "windows-taskbar",
      "href": "/docs/tutorial/windows-taskbar",
      "crowdinFileId": "256275",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-taskbar.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"taskbar-customization-windows\"><a href=\"#taskbar-customization-windows\">Taskbar Customization (Windows)</a></h1>\n<h2 id=\"descripción-general\"><a href=\"#descripción-general\">Descripción general</a></h2>\n<p>Electron tiene APIs para configurar el icono de la aplicación en la barra de tareas de Windows. This API supports both Windows-only features like <a href=\"#jumplist\">creation of a <code>JumpList</code></a>, <a href=\"#thumbnail-toolbars\">custom thumbnails and toolbars</a>, <a href=\"#icon-overlays-in-taskbar\">icon overlays</a>, and the so-called <a href=\"#flash-frame\">\"Flash Frame\" effect</a>, and cross-platform features like <a href=\"/docs/tutorial/recent-documents\">recent documents</a> and <a href=\"/docs/tutorial/progress-bar\">application progress</a>.</p>\n<h2 id=\"jumplist\"><a href=\"#jumplist\">JumpList</a></h2>\n<p>Windows permite a las aplicaciones definir un menú contextual personalizado que aparece cuando los usuarios hacen clic con el botón derecho en el ícono de las aplicaciones en la barra de tareas. Ese menú contextual se llama <code>JumpList</code>. Especificas acciones personalizadas en la categoría <code>Tasks</code> de JumpList, como se menciona en <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#tasks\">MSDN</a>:</p>\n<blockquote>\n<p>Las aplicaciones definen tareas basadas tanto en las características del programa como en las cosas claves que se espera que haga un usuario con ellas. Las tareas deben estar libres de contexto, en que la aplicación no necesita ejecutarse para que funcione. También deberían ser las acciones estadísticamente más comunes que un usuario normal llevaría a cabo en una aplicación, como redactar un mensaje de correo electrónico o abrir el calendario en un programa de correo, crear un nuevo documento en un procesador de texto, iniciar una aplicación en un determinado modo, o ejecuta uno de sus subcomandos. Una aplicación no debe saturar el menú con características avanzadas que los usuarios estándar no necesitarán o acciones únicas como el registro. No utilice tareas para artículos promocionales como actualizaciones u ofertas especiales.</p>\n<p>Se recomienda encarecidamente que la lista de tareas sea estática. Debería permanecer igual independientemente del estatus o estado de la aplicación. Si bien es posible variar la lista de forma dinámicamente, debe considerar que esto podría confundir al usuario que no espera que esa parte de la lista de destinos cambie.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420539.png\" alt=\"IE\"></p>\n<blockquote>\n<p>NOTA: La captura anterior es un ejemplo de tareas generales de Internet Explorer</p>\n</blockquote>\n<p>A diferencia del dock menú en macOS el cual es un menú real, user tasks en Windows funcionan como atajos de aplicación. Por ejemplo, cuando un usuario pulsa en un task, el programa será ejecutado con argumentos especificados.</p>\n<p>Para establecer las tareas de usuario en tu aplicación, puedes usar la API <a href=\"/docs/api/app#appsetusertaskstasks-windows\">app.setUserTasks</a>.</p>\n<h4 id=\"ejemplos\"><a href=\"#ejemplos\">Ejemplos</a></h4>\n<h5 id=\"establecer-tareas-de-usuario\"><a href=\"#establecer-tareas-de-usuario\">Establecer tareas de usuario</a></h5>\n<p>Comenzando con una aplicación funcionando desde <a href=\"/docs/tutorial/quick-start\">Guía de Inicio Rápido</a>, actualiza el archivo <code>main.js</code> con las siguiente lineas:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setUserTasks([\n  {\n    <span class=\"hljs-attr\">program</span>: process.execPath,\n    <span class=\"hljs-attr\">arguments</span>: <span class=\"hljs-string\">'--new-window'</span>,\n    <span class=\"hljs-attr\">iconPath</span>: process.execPath,\n    <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'New Window'</span>,\n    <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Create a new window'</span>\n  }\n])\n</code></pre>\n<h5 id=\"limpiar-la-lista-de-tareas\"><a href=\"#limpiar-la-lista-de-tareas\">Limpiar la lista de tareas</a></h5>\n<p>Para limpiar tu lista de tareas, necesitas llamar a <code>app.setUserTasks</code> con un array vacío en el archivo <code>main.js</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setUserTasks([])\n</code></pre>\n<blockquote>\n<p>NOTE: The user tasks will still be displayed even after closing your application, so the icon and program path specified for a task should exist until your application is uninstalled.</p>\n</blockquote>\n<h3 id=\"barra-de-tareas-de-thumbnail\"><a href=\"#barra-de-tareas-de-thumbnail\">Barra de tareas de Thumbnail</a></h3>\n<p>En Windows puedes añadir una miniatura a la barra de tareas con botones específicos a un layout de barra de tareas de una ventana de aplicacion. Provee a los usuarios con una manera de acceder a un comando de ventana en particular sin restaurar o activar la ventana.</p>\n<p>Como se cita desde <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#thumbnail-toolbars\">MSDN</a>:</p>\n<blockquote>\n<p>Esta barra de herramientas es la barra de tareas estándar de control común. Tiene un máximo de siete botones. Cada botón de identificación, imagen, descripción y estado está definido en una estructura, la cual es pasada a la barra de tareas. La aplicación puede mostrar, habilitar, deshabilitar u ocultar botones de la barra de herramientas si es requerido por su estado actual.</p>\n<p>Por ejemplo, el reproductor de Windows ofrece regularmente controles de transporte como play, pausa, silenciar y detener.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420540.png\" alt=\"intérprete\"></p>\n<blockquote>\n<p>NOTA: La captura de pantalla anterior es un ejemplo de thumbnail toolbar del Media Player de  Windows</p>\n</blockquote>\n<p>Para establecer la miniatura de la barra de tareas en tu aplicación, tienes que usar <a href=\"/docs/api/browser-window#winsetthumbarbuttonsbuttons-windows\">BrowserWindow.setThumbarButtons</a></p>\n<h4 id=\"ejemplos-1\"><a href=\"#ejemplos-1\">Ejemplos</a></h4>\n<h5 id=\"establecer-thumbnail-toolbar\"><a href=\"#establecer-thumbnail-toolbar\">Establecer thumbnail toolbar</a></h5>\n<p>Comenzando con una aplicación funcionando desde <a href=\"/docs/tutorial/quick-start\">Guía de Inicio Rápido</a>, actualiza el archivo <code>main.js</code> con las siguiente lineas:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.setThumbarButtons([\n  {\n    <span class=\"hljs-attr\">tooltip</span>: <span class=\"hljs-string\">'button1'</span>,\n    <span class=\"hljs-attr\">icon</span>: path.join(__dirname, <span class=\"hljs-string\">'button1.png'</span>),\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'button1 clicked'</span>) }\n  }, {\n    <span class=\"hljs-attr\">tooltip</span>: <span class=\"hljs-string\">'button2'</span>,\n    <span class=\"hljs-attr\">icon</span>: path.join(__dirname, <span class=\"hljs-string\">'button2.png'</span>),\n    <span class=\"hljs-attr\">flags</span>: [<span class=\"hljs-string\">'enabled'</span>, <span class=\"hljs-string\">'dismissonclick'</span>],\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'button2 clicked.'</span>) }\n  }\n])\n</code></pre>\n<h5 id=\"limpiar-thumbnail-toolbar\"><a href=\"#limpiar-thumbnail-toolbar\">Limpiar thumbnail toolbar</a></h5>\n<p>Para borrar los botones de thumbnail toolbar, necesitas llamar <code>BrowserWindow.setThumbarButtons</code> con un array vacío en el archivo <code>main.js</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.setThumbarButtons([])\n</code></pre>\n<h3 id=\"encubrimiento-de-íconos-en-la-barra-de-tareas\"><a href=\"#encubrimiento-de-íconos-en-la-barra-de-tareas\">Encubrimiento de íconos en la barra de tareas</a></h3>\n<p>En Windows, un botón de la barra de tareas puede usar una pequeña superposición para mostrar el estado de la aplicación.</p>\n<p>Como se cita desde <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#icon-overlays\">MSDN</a>:</p>\n<blockquote>\n<p>El encubrimiento de íconos sirve como una notificación contextual del estatus, y tiene la intención de negar la necesidad de separar el ícono de la notificación del estatus del ícono para comunicar la información al usuario. Por ejemplo, el nuevo estatus de correos en Microsoft Outlook, actualmente se muestra en el área de notificaciones, ahora puede ser indicado a través de un encubrimiento en el botón de la barra de tareas. De nuevo, debes decidir durante su ciclo de desarrollo cual método es el mejor para su aplicación. El encubrimiento de íconos tiene la intención de dar información importante, estatus de larga duración o notificaciones así como estado de la red o de mensajería, o nuevos correos. El usuario no debe ser presentado con cambios constantes en el encubrimiento o animaciones.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420441.png\" alt=\"Overlay on taskbar button\"></p>\n<blockquote>\n<p>NOTA: La captura de pantalla anterior es un ejemplo de superposición en un botón de la barra de tareas</p>\n</blockquote>\n<p>To set the overlay icon for a window, you need to use the <a href=\"/docs/api/browser-window#winsetoverlayiconoverlay-description-windows\">BrowserWindow.setOverlayIcon</a> API.</p>\n<h4 id=\"ejemplo\"><a href=\"#ejemplo\">Ejemplo</a></h4>\n<p>Comenzando con una aplicación funcionando desde <a href=\"/docs/tutorial/quick-start\">Guía de Inicio Rápido</a>, actualiza el archivo <code>main.js</code> con las siguiente lineas:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.setOverlayIcon(<span class=\"hljs-string\">'path/to/overlay.png'</span>, <span class=\"hljs-string\">'Description for overlay'</span>)\n</code></pre>\n<h3 id=\"flash-frame\"><a href=\"#flash-frame\">Flash Frame</a></h3>\n<p>En Windows, puedes resaltar el botón de la barra de tareas para obtener la atención del usuario. Esto es similar al rebote del ícono en el dock de macOS.</p>\n<p>Como se cita desde <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-flashwindow#remarks\">MSDN</a>:</p>\n<blockquote>\n<p>Por lo general, una ventana está iluminada para informar al usuario que la ventana requiere atención pero este no está concentrado en el teclado en el momento.</p>\n</blockquote>\n<p>To flash the BrowserWindow taskbar button, you need to use the <a href=\"/docs/api/browser-window#winflashframeflag\">BrowserWindow.flashFrame</a> API.</p>\n<h4 id=\"ejemplo-1\"><a href=\"#ejemplo-1\">Ejemplo</a></h4>\n<p>Comenzando con una aplicación funcionando desde <a href=\"/docs/tutorial/quick-start\">Guía de Inicio Rápido</a>, actualiza el archivo <code>main.js</code> con las siguiente lineas:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.once(<span class=\"hljs-string\">'focus'</span>, () => win.flashFrame(<span class=\"hljs-literal\">false</span>))\nwin.flashFrame(<span class=\"hljs-literal\">true</span>)\n</code></pre>\n<blockquote>\n<p>NOTA: No olvides llamar a <code>win.flashFrame(false)</code> para desactivar el destello. En el ejemplo anterior,  es llamado cuando la ventana entra en foco, pero puede que uses un temporizador o algún otro evento para desactivarlo.</p>\n</blockquote>",
      "title": "Taskbar Customization (Windows)",
      "description": "Las aplicaciones definen tareas basadas tanto en las características del programa como en las cosas claves que se espera que haga un usuario con ellas. Las tareas deben estar libres de contexto, en que la aplicación no necesita ejecutarse para que funcione. También deberían ser las acciones estadísticamente más comunes que un usuario normal llevaría a cabo en una aplicación, como redactar un mensaje de correo electrónico o abrir el calendario en un programa de correo, crear un nuevo documento en un procesador de texto, iniciar una aplicación en un determinado modo, o ejecuta uno de sus subcomandos. Una aplicación no debe saturar el menú con características avanzadas que los usuarios estándar no necesitarán o acciones únicas como el registro. No utilice tareas para artículos promocionales como actualizaciones u ofertas especiales.\nSe recomienda encarecidamente que la lista de tareas sea estática. Debería permanecer igual independientemente del estatus o estado de la aplicación. Si bien es posible variar la lista de forma dinámicamente, debe considerar que esto podría confundir al usuario que no espera que esa parte de la lista de destinos cambie."
    }
  },
  "zh-CN": {
    "/docs/api/accelerator": {
      "locale": "zh-CN",
      "slug": "accelerator",
      "href": "/docs/api/accelerator",
      "crowdinFileId": "256277",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/accelerator.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"快捷键\"><a href=\"#快捷键\">快捷键</a></h1>\n<blockquote>\n<p>定义键盘快捷键。</p>\n</blockquote>\n<p>快捷键可以包含多个功能键和一个键码的字符串，由符号<code>+</code>结合，用来定义你应用中的键盘快捷键</p>\n<p>示例</p>\n<ul>\n<li><code>CommandOrControl+A</code></li>\n<li><code>CommandOrControl+Shift+Z</code></li>\n</ul>\n<p>快捷方式使用 <a href=\"/docs/api/global-shortcut#globalshortcutregisteraccelerator-callback\"><code>register</code></a> 方法在 <a href=\"/docs/api/global-shortcut\"><code>globalShortcut</code></a> 模块中注册, 即:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Register a 'CommandOrControl+Y' shortcut listener.</span>\n  globalShortcut.register(<span class=\"hljs-string\">'CommandOrControl+Y'</span>, () => {\n    <span class=\"hljs-comment\">// Do stuff when Y and either Command/Control is pressed.</span>\n  })\n})\n</code></pre>\n<h2 id=\"跨平台提醒\"><a href=\"#跨平台提醒\">跨平台提醒</a></h2>\n<p>在 Linux 和 Windows 上, <code>Command</code> 键没有任何效果, 所以使用 <code>CommandOrControl</code>表述, macOS 是 <code>Command</code> ，在 Linux 和 Windows 上是<code>Control</code>。</p>\n<p>使用 <code>Alt</code>按键替代 <code>Option</code>按键。 使用 Alt 键代替Option. <code>Option</code> 键只在 macOS 系统上存在, 而 <code>Alt</code> 键在任何系统上都有效.</p>\n<p><code>Super</code> (或 <code>Meta</code>) 键对应Windows 和 Linux 系统上的 <code>Windows</code> 键，但在 macOS 里为 <code>Cmd</code> 键.</p>\n<h2 id=\"可用的功能键\"><a href=\"#可用的功能键\">可用的功能键</a></h2>\n<ul>\n<li><code>Command</code> (缩写为<code>Cmd</code>)</li>\n<li><code>Control</code> (缩写为<code>Ctrl</code>)</li>\n<li><code>CommandOrControl</code> (缩写为 <code>CmdOrCtrl</code>)</li>\n<li><code>Alt</code></li>\n<li><code>Option</code></li>\n<li><code>AltGr</code></li>\n<li><code>Shift</code></li>\n<li><code>Super</code></li>\n<li><code>元数据</code></li>\n</ul>\n<h2 id=\"可用的普通按键\"><a href=\"#可用的普通按键\">可用的普通按键</a></h2>\n<ul>\n<li><code>0</code> 到 <code>9</code></li>\n<li><code>A</code> 到 <code>Z</code></li>\n<li><code>F1</code> 到 <code>F24</code></li>\n<li>Punctuation like <code>~</code>, <code>!</code>, <code>@</code>, <code>#</code>, <code>$</code>, etc.</li>\n<li><code>Plus</code></li>\n<li><code>Space</code></li>\n<li><code>Tab</code></li>\n<li><code>大写锁定（Capslock）</code></li>\n<li><code>数字锁定（Numlock）</code></li>\n<li><code>滚动锁定</code></li>\n<li><code>Backspace</code></li>\n<li><code>删除</code></li>\n<li><code>Insert</code></li>\n<li><code>Return</code> (等同于 <code>Enter</code>)</li>\n<li><code>Up</code>, <code>Down</code>, <code>Left</code> and <code>Right</code></li>\n<li><code>Home</code> 和 <code>End</code></li>\n<li><code>PageUp</code> 和 <code>PageDown</code></li>\n<li><code>Escape</code> (缩写为 <code>Esc</code>)</li>\n<li><code>VolumeUp</code>, <code>VolumeDown</code> 和 <code>VolumeMute</code></li>\n<li><code>MediaNextTrack</code>、<code>MediaPreviousTrack</code>、<code>MediaStop</code> 和 <code>MediaPlayPause</code></li>\n<li><code>PrintScreen</code></li>\n<li>小键盘按键<ul>\n<li><code>num1</code>-<code>num9</code> -数字1-数字9</li>\n<li><code>numdec</code> - 小数点</li>\n<li><code>numadd</code> - 加号</li>\n<li><code>numsub</code> - 减号</li>\n<li><code>nummult</code> - 乘号</li>\n<li><code>numdiv</code> - 除号</li>\n</ul></li>\n</ul>",
      "title": "快捷键",
      "description": "定义键盘快捷键。"
    },
    "/docs/tutorial/accessibility": {
      "locale": "zh-CN",
      "slug": "accessibility",
      "href": "/docs/tutorial/accessibility",
      "crowdinFileId": "256173",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/accessibility.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"辅助功能\"><a href=\"#辅助功能\">辅助功能</a></h1>\n<p>为程序制作辅助功能是很重要的。在这里，我们很高兴地向你们介绍<a href=\"https://electronjs.org/devtron\">Devtron</a>和<a href=\"https://electronjs.org/spectron\">Spectron</a>。这两个新功能有机会使开发者们让他们的应用程序更加可用。</p>\n<hr>\n<p>Electron 应用中有关辅助功能的开发和网站是相似的，因为两者最终使用的都是HTML. 然而, 对于Electron应用, 你不能使用在线的辅助功能审查者, 因为你的应用没有一个URL可以提供给审查者.</p>\n<p>这些功能将会提供一些审查工具给你的Electron 应用。 您可以选择使用 Spectron 将审查添加到你的测试环境中，或在开发者工具（DevTools）中使用Devtron。 详见各工具的文档.</p>\n<h2 id=\"spectron\"><a href=\"#spectron\">Spectron</a></h2>\n<p>In the testing framework Spectron, you can now audit each window and <code>&#x3C;webview></code> tag in your application. 例如：</p>\n<pre><code class=\"hljs language-javascript\">app.client.auditAccessibility().then(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\">audit</span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (audit.failed) {\n    <span class=\"hljs-built_in\">console</span>.error(audit.message)\n  }\n})\n</code></pre>\n<p>你可以从这里<a href=\"https://github.com/electron/spectron#accessibility-testing\">Spectron文档</a>阅读到更多有关于这个功能的信息。</p>\n<h2 id=\"devtron\"><a href=\"#devtron\">Devtron</a></h2>\n<p>In Devtron, there is an accessibility tab which will allow you to audit a page in your app, sort and filter the results.</p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/1305617/17156618/9f9bcd72-533f-11e6-880d-389115f40a2a.png\" alt=\"devtron 截图\"></p>\n<p>这两种工具都使用了Google 为 Chrome 所构建的 <a href=\"https://github.com/GoogleChrome/accessibility-developer-tools\"> 辅助功能开发工具 </a> 库。 您可以在 <a href=\"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules\"> repository's wiki </a> 上了解到更加详细的辅助功能审核规则。</p>\n<p>如果你知道其他适用于Electron的辅助功能开发工具, 请通过pull request添加到本文档中.</p>\n<h2 id=\"manually-enabling-accessibility-features\"><a href=\"#manually-enabling-accessibility-features\">Manually enabling accessibility features</a></h2>\n<p>当辅助技术存在时，Electron 应用程序将自动启用辅助功能（例如 Windows 上的 <a href=\"https://www.freedomscientific.com/products/software/jaws/\">JAWS</a> 或 macOS 上的 <a href=\"https://help.apple.com/voiceover/mac/10.15/\">VoiceOver</a>）。 有关详细信息, 请参阅 Chrome 的 <a href=\"https://www.chromium.org/developers/design-documents/accessibility#TOC-How-Chrome-detects-the-presence-of-Assistive-Technology\"> 辅助功能文档 </a>。</p>\n<p>You can also manually toggle these features either within your Electron application or by setting flags in third-party native software.</p>\n<h3 id=\"使用-electron-的-api\"><a href=\"#使用-electron-的-api\">使用 Electron 的 API</a></h3>\n<p>通过使用 <a href=\"/docs/api/app#appsetaccessibilitysupportenabledenabled-macos-windows\"><code>app.setAccessibilitySupportEnabled(enabled)</code></a> API，您可以在应用程序首选项中的手动向用户暴露Chrome的访问树。 请注意，用户的系统辅助工具优先于此设置并将覆盖它。</p>\n<h3 id=\"在第三方软件内\"><a href=\"#在第三方软件内\">在第三方软件内</a></h3>\n<h4 id=\"macos\"><a href=\"#macos\">macOS</a></h4>\n<p>On macOS, third-party assistive technology can toggle accessibility features inside Electron applications by setting the <code>AXManualAccessibility</code> attribute programmatically:</p>\n<pre><code class=\"hljs language-objc\"><span class=\"hljs-built_in\">CFStringRef</span> kAXManualAccessibility = <span class=\"hljs-built_in\">CFSTR</span>(<span class=\"hljs-string\">\"AXManualAccessibility\"</span>);\n\n+ (<span class=\"hljs-keyword\">void</span>)enableAccessibility:(<span class=\"hljs-built_in\">BOOL</span>)enable inElectronApplication:(<span class=\"hljs-built_in\">NSRunningApplication</span> *)app\n{\n    AXUIElementRef appRef = AXUIElementCreateApplication(app.processIdentifier);\n    <span class=\"hljs-keyword\">if</span> (appRef == <span class=\"hljs-literal\">nil</span>)\n        <span class=\"hljs-keyword\">return</span>;\n\n    <span class=\"hljs-built_in\">CFBooleanRef</span> value = enable ? kCFBooleanTrue : kCFBooleanFalse;\n    AXUIElementSetAttributeValue(appRef, kAXManualAccessibility, value);\n    <span class=\"hljs-built_in\">CFRelease</span>(appRef);\n}\n</code></pre>",
      "title": "辅助功能",
      "description": ""
    },
    "/docs/api/app": {
      "locale": "zh-CN",
      "slug": "app",
      "href": "/docs/api/app",
      "crowdinFileId": "256279",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/app.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"app\"><a href=\"#app\">app</a></h1>\n<blockquote>\n<p>控制应用程序的事件生命周期。</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p>下面的这个例子将会展示如何在最后一个窗口被关闭时退出应用：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  app.quit()\n})\n</code></pre>\n<h2 id=\"事件\"><a href=\"#事件\">事件</a></h2>\n<p><code>app</code> 对象会发出以下事件:</p>\n<h3 id=\"事件-will-finish-launching\"><a href=\"#事件-will-finish-launching\">事件: 'will-finish-launching'</a></h3>\n<p>当应用程序完成基础的启动的时候被触发。 在 Windows 和 Linux 中, <code>will-finish-launching</code> 事件与 <code>ready</code> 事件是相同的; 在 macOS 中，这个事件相当于 <code>NSApplication</code> 中的 <code>applicationWillFinishLaunching</code> 提示。 通常会在这里为 <code>open-file</code> 和 <code>open-url</code> 设置监听器，并启动崩溃报告和自动更新。</p>\n<p>绝大部分情况下，你必须在<code>ready</code>事件句柄中处理所有事务。</p>\n<h3 id=\"事件-ready\"><a href=\"#事件-ready\">事件: 'ready'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>launchInfo</code> Record&#x3C;string, any> | <a href=\"/docs/api/structures/notification-response\">NotificationResponse</a> <em>macOS</em></li>\n</ul>\n<p>当 Electron 完成初始化时，发出一次。 在 macOS 上，如果从通知中心启动， <code>launchInfo</code> 内含有用于打开应用程序的 <code>NSUserNotification</code> 或来自 <a href=\"/docs/api/structures/notification-response\"><code>UNNotificationResponse</code></a> 的 <code>userInfo</code> 信息。 你也可以通过调用 <code>app.isReady()</code> 来检查该事件是否已被触发，以及通过 <code>app.whenReady()</code> 得到一个当Electron已初始化后fulfill 的 Promise。</p>\n<h3 id=\"事件-window-all-closed\"><a href=\"#事件-window-all-closed\">事件: 'window-all-closed'</a></h3>\n<p>当所有的窗口都被关闭时触发。</p>\n<p>如果你没有监听此事件并且所有窗口都关闭了，默认的行为是控制退出程序；但如果你监听了此事件，你可以控制是否退出程序。 如果用户按下了 <code>Cmd + Q</code>，或者开发者调用了 <code>app.quit()</code>，Electron 会首先关闭所有的窗口然后触发 <code>will-quit</code> 事件，在这种情况下 <code>window-all-closed</code> 事件不会被触发。</p>\n<h3 id=\"事件：before-quit\"><a href=\"#事件：before-quit\">事件：'before-quit'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>在程序关闭窗口前发信号。 调用 <code>event.preventDefault()</code> 将阻止终止应用程序的默认行为。</p>\n<p><strong>注意：</strong> 如果由 <code>autoUpdater.quitAndInstal()</code> 退出应用程序 ，那么在所有窗口触发 <code>close</code> <em>之后</em> 才会触发 <code>before-quit</code> 并关闭所有窗口。</p>\n<p><strong>注:</strong>在 Windows 系统中，如果应用程序因系统关机/重启或用户注销而关闭，那么这个事件不会被触发。</p>\n<h3 id=\"事件-will-quit\"><a href=\"#事件-will-quit\">事件: 'will-quit'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>当所有窗口被关闭后触发，同时应用程序将退出。 调用 <code>event.preventDefault()</code> 将阻止终止应用程序的默认行为。</p>\n<p>关于 <code> window-all-closed</code> 和 <code>will-quit</code> 事件之间的差异, 请参见 <code>window-all-closed </code> 事件的说明。</p>\n<p><strong>注:</strong>在 Windows 系统中，如果应用程序因系统关机/重启或用户注销而关闭，那么这个事件不会被触发。</p>\n<h3 id=\"事件-quit\"><a href=\"#事件-quit\">事件: 'quit'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>exitCode</code> Integer</li>\n</ul>\n<p>在应用程序退出时发出。</p>\n<p><strong>注:</strong>在 Windows 系统中，如果应用程序因系统关机/重启或用户注销而关闭，那么这个事件不会被触发。</p>\n<h3 id=\"事件-open-file-macos\"><a href=\"#事件-open-file-macos\">事件: 'open-file' <em>macOS</em></a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>path</code> String</li>\n</ul>\n<p>当用户想要在应用中打开一个文件时发出。 <code>open-file</code> 事件通常在应用已经打开，并且系统要再次使用该应用打开文件时发出。 <code>open-file</code>也会在一个文件被拖到 dock 并且还没有运行的时候发出。 请确认在应用启动的时候(甚至在 <code>ready</code> 事件发出前) 就对 <code>open-file</code> 事件进行监听。</p>\n<p>如果你想处理这个事件，你应该调用 <code>event.preventDefault()</code> 。</p>\n<p>在 Windows 系统中，你需要解析 <code>process.argv</code> (在主进程中) 来获取文件路径</p>\n<h3 id=\"事件-open-url-macos\"><a href=\"#事件-open-url-macos\">事件: 'open-url' <em>macOS</em></a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n</ul>\n<p>当用户想要在应用中打开一个 URL 时发出。 你的应用程序的 <code>Info. plist</code> 文件必须在 <code>CFBundleURLTypes</code> 这个key中定义 url scheme, 并将 <code>NSPrincipalClass</code> 设置为 <code>AtomApplication</code>。</p>\n<p>如果你想处理这个事件，你应该调用 <code>event.preventDefault()</code> 。</p>\n<h3 id=\"事件-activate-macos\"><a href=\"#事件-activate-macos\">事件: 'activate' <em>macOS</em></a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>hasVisibleWindows</code> Boolean</li>\n</ul>\n<p>当应用被激活时发出。 各种操作都可以触发此事件, 例如首次启动应用程序、尝试在应用程序已运行时或单击应用程序的坞站或任务栏图标时重新激活它。</p>\n<h3 id=\"事件-did-groupe-active-macos\"><a href=\"#事件-did-groupe-active-macos\">事件: 'did-groupe-active' <em>macOS</em></a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>当应用被激活时发出。 与 <code>activate</code> 事件的不同是应用，程序激活时都会触发 <code>did-become-active</code> ，而不仅仅在 Dock 图标被点击或应用程序被重新启动的时候。</p>\n<h3 id=\"事件-continue-activity-macos\"><a href=\"#事件-continue-activity-macos\">事件: 'continue-activity' <em>macOS</em></a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code>String-标识活动的字符串。 映射到 <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity. activityType</code></a>。</li>\n<li><code>userInfo</code> unknown - 包含另一个设备上activity存储的应用特定状态。</li>\n<li><code>details</code> Object<ul>\n<li><code>webpageURL</code> String (optional) - A string identifying the URL of the webpage accessed by the activity on another device, if available.</li>\n</ul></li>\n</ul>\n<p>当来自不同设备的活动通过 <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> 想要恢复时触发。 如果你想处理这个事件，你应该调用 <code>event.preventDefault()</code> 。</p>\n<p>只有具有支持相应的活动类型并且相同的开发团队 ID 作为启动程序时，用户行为才会进行。 所支持活动类型已在应用的 <code>Info.plist</code> 中的 <code>NSUserActivityTypes</code> 里明确定义。</p>\n<h3 id=\"事件-will-continue-activity-macos\"><a href=\"#事件-will-continue-activity-macos\">事件: 'will-continue-activity' <em>macOS</em></a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code>String-标识活动的字符串。 映射到 <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity. activityType</code></a>。</li>\n</ul>\n<p>当来自不同设备的活动通过 <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> 恢复之前触发。 如果你想处理这个事件，你应该调用 <code>event.preventDefault()</code> 。</p>\n<h3 id=\"事件-continue-activity-error-macos\"><a href=\"#事件-continue-activity-error-macos\">事件: 'continue-activity-error' <em>macOS</em></a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code>String-标识活动的字符串。 映射到 <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity. activityType</code></a>。</li>\n<li><code>error</code> String - 详细的错误信息</li>\n</ul>\n<p>当来自不同设备的活动通过 <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> 恢复失败时触发。</p>\n<h3 id=\"事件-activity-was-continued-macos\"><a href=\"#事件-activity-was-continued-macos\">事件: 'activity-was-continued' <em>macOS</em></a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code>String-标识活动的字符串。 映射到 <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity. activityType</code></a>。</li>\n<li><code>userInfo</code> unknown - 包含activity存储的应用特定状态。</li>\n</ul>\n<p>当来自不同设备的活动通过 <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> 成功恢复后触发。</p>\n<h3 id=\"事件-update-activity-state-macos\"><a href=\"#事件-update-activity-state-macos\">事件: 'update-activity-state' <em>macOS</em></a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code>String-标识活动的字符串。 映射到 <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity. activityType</code></a>。</li>\n<li><code>userInfo</code> unknown - 包含activity存储的应用特定状态。</li>\n</ul>\n<p>当 <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> 即将通过另一个设备恢复时触发。 如果需要更新要传输的状态，你应该立即调用 <code>event.preventDefault()</code>, 构造新的 <code>userInfo</code> 字典，并及时调用 <code>app.updateCurrentActiviy()</code>。 否则，操作会失败，并且触发 <code>continue-activity-error</code></p>\n<h3 id=\"事件-new-window-for-tab-macos\"><a href=\"#事件-new-window-for-tab-macos\">事件: 'new-window-for-tab' <em>macOS</em></a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>当用户点击原生的macOS新标签按钮时触发。 只有在当前 <code>BrowserWindow</code> 有 <code>tabbingIdentifier</code> 时，新建tab按钮才可见。</p>\n<h3 id=\"事件-browser-window-blur\"><a href=\"#事件-browser-window-blur\">事件: 'browser-window-blur'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>在 <a href=\"/docs/api/browser-window\"> browserWindow </a> 失去焦点时发出。</p>\n<h3 id=\"事件-browser-window-focus\"><a href=\"#事件-browser-window-focus\">事件: 'browser-window-focus'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>在 <a href=\"/docs/api/browser-window\"> browserWindow </a> 获得焦点时发出。</p>\n<h3 id=\"事件-browser-window-created\"><a href=\"#事件-browser-window-created\">事件: 'browser-window-created'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>在创建新的 <a href=\"/docs/api/browser-window\"> browserWindow </a> 时发出。</p>\n<h3 id=\"事件-web-contents-created\"><a href=\"#事件-web-contents-created\">事件: 'web-contents-created'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>在创建新的 <a href=\"/docs/api/web-contents\"> webContents </a> 时发出。</p>\n<h3 id=\"事件-certificate-error\"><a href=\"#事件-certificate-error\">事件: 'certificate-error'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>url</code> String</li>\n<li><code>error</code> String - 错误码</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">证书</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>isTrusted</code>Boolean-是否将证书视为可信的</li>\n</ul></li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>当对 <code>url</code> 的 <code>certificate</code> 证书验证失败的时候发出。如果需要信任这个证书，你需要阻止默认行为 <code>event.preventDefault()</code> 并且调用 <code>callback(true)</code>。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'certificate-error'</span>, (event, webContents, url, error, certificate, callback) => {\n  <span class=\"hljs-keyword\">if</span> (url === <span class=\"hljs-string\">'https://github.com'</span>) {\n    <span class=\"hljs-comment\">// Verification logic.</span>\n    event.preventDefault()\n    callback(<span class=\"hljs-literal\">true</span>)\n  } <span class=\"hljs-keyword\">else</span> {\n    callback(<span class=\"hljs-literal\">false</span>)\n  }\n})\n</code></pre>\n<h3 id=\"事件-select-client-certificate\"><a href=\"#事件-select-client-certificate\">事件: 'select-client-certificate'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>url</code> URL</li>\n<li><code>certificateList</code> <a href=\"/docs/api/structures/certificate\">证书[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">证书</a> (可选)</li>\n</ul></li>\n</ul>\n<p>当一个客户证书被请求的时候发出。</p>\n<p><code>url</code> 指的是请求客户端认证的网页地址，调用 <code>callback</code> 时需要传入一个证书列表中的证书。 需要通过调用 <code>event.preventDefault()</code> 来防止应用自动使用第一个证书进行验证。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'select-client-certificate'</span>, (event, webContents, url, list, callback) => {\n  event.preventDefault()\n  callback(list[<span class=\"hljs-number\">0</span>])\n})\n</code></pre>\n<h3 id=\"事件-login\"><a href=\"#事件-login\">事件: \"login\"</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>authenticationResponseDetails</code> Object<ul>\n<li><code>url</code> URL</li>\n</ul></li>\n<li><code>authInfo</code> Object<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (可选)</li>\n<li><code>password</code> String (可选)</li>\n</ul></li>\n</ul>\n<p>当 <code>webContents</code> 要进行基本身份验证时触发。</p>\n<p>默认行为是取消所有身份验证。 默认行为是取消所有的验证行为，如果需要重写这个行为，你需要用 <code>event.preventDefault()</code> 来阻止默认行为，并且使用 <code>callback(username, password)</code> 来验证。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'login'</span>, (event, webContents, details, authInfo, callback) => {\n  event.preventDefault()\n  callback(<span class=\"hljs-string\">'username'</span>, <span class=\"hljs-string\">'secret'</span>)\n})\n</code></pre>\n<p>当 <code>callback</code> 在缺少用户名和密码的时候被调用，身份验证请求将被取消，同时将返回身份验证错误到页面。</p>\n<h3 id=\"事件-gpu-info-update\"><a href=\"#事件-gpu-info-update\">事件: 'gpu-info-update'</a></h3>\n<p>每当有 GPU 信息更新时触发。</p>\n<h3 id=\"事件-gpu-process-crashed-已废弃\"><a href=\"#事件-gpu-process-crashed-已废弃\">事件: 'gpu-process-crashed' <em>已废弃</em></a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>当gpu进程崩溃或关闭（杀死）时触发</p>\n<p><strong>已废弃：</strong>这个事件被包含更多子进程退出信息原因的<code>child-process-gone</code>事件取代了。 并不总是因为崩溃而触发。 当你换用child-process-gone事件时，原事件的 <code>killed</code> 布尔值可以被 <code>reason === 'killed'</code> 取代。</p>\n<h3 id=\"事件-renderer-process-crashed-已废弃\"><a href=\"#事件-renderer-process-crashed-已废弃\">事件: 'renderer-process-crashed' <em>已废弃</em></a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>当渲染器进程<code>webContents</code>崩溃或关闭（杀死）时触发。</p>\n<p><strong>已废弃：</strong> 此事件被包含更多关于渲染过程为何消失的信息的 <code>render-process-gone</code> 事件替代了 并不总是因为崩溃而触发。  当你换用child-process-gone事件时，原事件的 <code>killed</code> 布尔值可以被 <code>reason === 'killed'</code> 取代。</p>\n<h3 id=\"事件-render-process-gone\"><a href=\"#事件-render-process-gone\">事件: 'render-process-gone'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>details</code> Object<ul>\n<li><code>reason</code> String - 渲染进程消失的原因。  可选值：<ul>\n<li><code>clean-exit</code> - 以零为退出代码退出的进程</li>\n<li><code>abnormal-exit</code> - 以非零退出代码退出的进程</li>\n<li><code>killed</code> - 进程发送一个SIGTERM，否则是被外部杀死的。</li>\n<li><code>crashed</code> - 进程崩溃</li>\n<li><code>oom</code> - 进程内存不足</li>\n<li><code>launch-failed</code> - 进程从未成功启动</li>\n<li><code>integrity-failure</code> - 窗口代码完整性检查失败</li>\n</ul></li>\n<li><code>exitCode</code> Integer - 进程的退出代码，除非在 <code>reason</code> 是 <code>launch-failed</code> 的情况下， <code>exitCode</code> 将是一个平台特定的启动失败错误代码。</li>\n</ul></li>\n</ul>\n<p>渲染器进程意外消失时触发。  这种情况通常因为进程崩溃或被杀死。</p>\n<h3 id=\"事件-child-process-gone\"><a href=\"#事件-child-process-gone\">事件: 'child-process-gone'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>type</code> String - 进程类型。 以下值之一：<ul>\n<li><code>Utility</code></li>\n<li><code>Zygote</code></li>\n<li><code>Sandbox helper</code></li>\n<li><code>GPU</code></li>\n<li><code>Pepper Plugin</code></li>\n<li><code>Pepper Plugin Broker</code></li>\n<li><code>Unknown</code></li>\n</ul></li>\n<li><code>reason</code> String - 子进程消失的原因。 可选值：<ul>\n<li><code>clean-exit</code> - 以零为退出代码退出的进程</li>\n<li><code>abnormal-exit</code> - 以非零退出代码退出的进程</li>\n<li><code>killed</code> - 进程发送一个SIGTERM，否则是被外部杀死的。</li>\n<li><code>crashed</code> - 进程崩溃</li>\n<li><code>oom</code> - 进程内存不足</li>\n<li><code>launch-failed</code> - 进程从未成功启动</li>\n<li><code>integrity-failure</code> - 窗口代码完整性检查失败</li>\n</ul></li>\n<li><code>exitCode</code> Number - 进程的退出代码 (例如，在posix上，来自waitpid的状态；在Windows上则来自 GetExitCodeProcess)。</li>\n<li><code>serviceName</code> String (可选) - 进程的非本地化名称。</li>\n<li><code>name</code> String (可选) - 进程的名称。 功能性示例： <code>Audio Service</code>, <code>Content Decryption Module Service</code>, <code>Network Service</code>, <code>Video Capture</code>, 等等。</li>\n</ul></li>\n</ul>\n<p>子进程意外消失时触发。 这种情况通常因为进程崩溃或被杀死。 子进程不包括渲染器进程。</p>\n<h3 id=\"事件-accessibility-support-changed--macos---windows\"><a href=\"#事件-accessibility-support-changed--macos---windows\">事件: \"accessibility-support-changed\" <em> macOS </em> <em> Windows </em></a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>accessibilitySupportEnabled</code>当启用了 Chrome 的辅助功能时为 <code>true</code>, 其他情况为 <code>false</code>。</li>\n</ul>\n<p>当 Chrome 的辅助功能状态改变时触发。 当启用或禁用辅助技术时将触发此事件，例如屏幕阅读器 。 查看更多详情 <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">https://www.chromium.org/developers/design-documents/accessibility</a></p>\n<h3 id=\"事件session-created\"><a href=\"#事件session-created\">事件:'session-created'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>session</code> <a href=\"/docs/api/session\">Session</a></li>\n</ul>\n<p>当 Electron创建了一个新的 <code>session</code>后被触发.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'session-created'</span>, (session) => {\n  <span class=\"hljs-built_in\">console</span>.log(session)\n})\n</code></pre>\n<h3 id=\"事件-second-instance\"><a href=\"#事件-second-instance\">事件: 'second-instance'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>argv</code> String[] - 第二个实例的命令行参数数组</li>\n<li><code>workingDirectory</code> String - 第二个实例的工作目录</li>\n</ul>\n<p>当第二个实例被执行并且调用 <code>app.requestSingleInstanceLock()</code> 时，这个事件将在你的应用程序的首个实例中触发</p>\n<p><code>argv</code> 是第二个实例的命令行参数的数组, <code>workingDirectory</code> 是这个实例当前工作目录。 通常, 应用程序会激活窗口并且取消最小化来响应。</p>\n<p><strong>注意：</strong> 如果第二个实例是由不同于第一个实例的用户启动的。 <code>argv</code> 数组不包含参数。</p>\n<p>保证在 <code>app</code> 的 <code>ready</code> 事件发出后发出此事件。</p>\n<p><strong>注意：</strong> 额外命令行参数可能由 Chromium 添加， ，例如 <code>--original-process-start-time</code>。</p>\n<h3 id=\"事件-desktop-capturer-get-sources\"><a href=\"#事件-desktop-capturer-get-sources\">事件: 'desktop-capturer-get-sources'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>在 <code>webContents</code> 的渲染器进程中调用 <code>desktopCapturer.getSources()</code> 时触发。 调用 <code>event.preventDefault()</code> 将使它返回空的sources。</p>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>app</code> 对象具有以下方法:</p>\n<p><strong> 注意: </strong>某些方法仅在特定的操作系统上可用, 这些方法会被标记出来。</p>\n<h3 id=\"appquit\"><a href=\"#appquit\"><code>app.quit()</code></a></h3>\n<p>尝试关闭所有窗口 将首先发出 <code>before-quit</code> 事件。 如果所有窗口都已成功关闭, 则将发出 <code> will-quit</code> 事件, 并且默认情况下应用程序将终止。</p>\n<p>此方法会确保执行所有<code>beforeunload</code> 和 <code>unload</code>事件处理程序。 可以在退出窗口之前的<code>beforeunload</code>事件处理程序中返回<code>false</code>取消退出。</p>\n<h3 id=\"appexitexitcode\"><a href=\"#appexitexitcode\"><code>app.exit([exitCode])</code></a></h3>\n<ul>\n<li><code>exitCode</code> Integer (可选)</li>\n</ul>\n<p>使用 <code>exitCode</code> 立即退出。 <code>exitCode</code> 默认为0。</p>\n<p>所有窗口都将立即被关闭，而不询问用户，而且 <code>before-quit</code> 和 <code>will-quit</code> 事件也不会被触发。</p>\n<h3 id=\"apprelaunchoptions\"><a href=\"#apprelaunchoptions\"><code>app.relaunch([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (可选)<ul>\n<li><code>args</code> String<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a></li>\n<li><code>execPath</code> String (可选)</li>\n</ul></li>\n</ul>\n<p>从当前实例退出，重启应用。</p>\n<p>默认情况下，新的实例将会使用和当前实例相同的工作目录以及命令行参数。 当设置了 <code>args</code> 参数时， <code>args</code> 将作为命令行参数传递。 当设置了 <code>execPath</code> ，<code>execPath</code> 将被执行以重新启动，而不是当前的应用程序。</p>\n<p>请注意, 此方法在执行时不会退出当前的应用程序, 你需要在调用 <code>app.relaunch</code> 方法后再执行 <code> app. quit</code> 或者 <code>app.exit</code> 来让应用重启。</p>\n<p>当 <code>app.relaunch</code> 被多次调用时,多个实例将在当前实例退出后启动。</p>\n<p>立即重启当前实例并向新的实例添加新的命令行参数的示例：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.relaunch({ <span class=\"hljs-attr\">args</span>: process.argv.slice(<span class=\"hljs-number\">1</span>).concat([<span class=\"hljs-string\">'--relaunch'</span>]) })\napp.exit(<span class=\"hljs-number\">0</span>)\n</code></pre>\n<h3 id=\"appisready\"><a href=\"#appisready\"><code>app.isReady()</code></a></h3>\n<p>返回 <code>Boolean</code> 类型 - 如果 Electron 已经完成初始化，则返回 <code>true</code>, 其他情况为 <code>false</code> 另见 <code>app.whenReady()</code>。</p>\n<h3 id=\"appwhenready\"><a href=\"#appwhenready\"><code>app.whenReady()</code></a></h3>\n<p>返回 <code>Promise&#x26;lt;void&#x26;gt;</code> - 当Electron 初始化完成。 可用作检查 <code>app.isReady()</code> 的方便选择，假如应用程序尚未就绪，则订阅<code>ready</code>事件。</p>\n<h3 id=\"appfocusoptions\"><a href=\"#appfocusoptions\"><code>app.focus([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (可选)<ul>\n<li><code>steal</code> Boolean <em>macOS</em> - 使接收器成为激活的应用程序，即使另一个应用程序当前处于激活状态。</li>\n</ul></li>\n</ul>\n<p>在 Linux 上，使第一个可见窗口获得焦点。 在 macOS上，将应用程序变成激活的app。 在 Windows上，使应用程序的第一个窗口获得焦点。</p>\n<p>你应该尽可能少地使用 <code>steal</code> 选项。</p>\n<h3 id=\"apphide-macos\"><a href=\"#apphide-macos\"><code>app.hide()</code> <em>macOS</em></a></h3>\n<p>隐藏所有的应用窗口，不是最小化.</p>\n<h3 id=\"appshow-macos\"><a href=\"#appshow-macos\"><code>app.show()</code> <em>macOS</em></a></h3>\n<p>显示隐藏后的应用程序窗口。 不会使它们自动获得焦点。</p>\n<h3 id=\"appsetapplogspathpath\"><a href=\"#appsetapplogspathpath\"><code>app.setAppLogsPath([path])</code></a></h3>\n<ul>\n<li><code>path</code> String (可选) - 日志存放的自定义路径。 必须是绝对路径。</li>\n</ul>\n<p>设置或创建一个您的应用程序日志目录，然后可以通过 <code>app.getPath()</code> 或 <code>app.setPath(pathName, newPath)</code> 进行操作。</p>\n<p>调用 <code>app.setAppLogsPath()</code> 却没有指定 <code>path</code> 参数将导致此目录在 <em>macOS</em> 下被设置为 <code>~/Library/Logs/YourAppName</code>；在 <em>Linux</em> 和<em>Windows</em> 下将被设置到 <code>userData</code> 目录中。</p>\n<h3 id=\"appgetapppath\"><a href=\"#appgetapppath\"><code>app.getAppPath()</code></a></h3>\n<p>返回 <code>String</code> 类型 - 当前应用程序所在目录</p>\n<h3 id=\"appgetpathname\"><a href=\"#appgetpathname\"><code>app.getPath(name)</code></a></h3>\n<ul>\n<li><code>name</code> String - 你可以通过这些名称请求下列路径：<ul>\n<li><code>home</code> 用户的 home 文件夹（主目录）</li>\n<li><code>appData</code> 每个用户的应用程序数据目录，默认情况下指向：<ul>\n<li><code>%APPDATA%</code> Windows 中</li>\n<li><code>$XDG_CONFIG_HOME</code> or <code>~/.config</code> Linux 中</li>\n<li><code>~/Library/Application Support</code> macOS 中</li>\n</ul></li>\n<li><code>userData</code> 储存你应用程序设置文件的文件夹，默认是 <code>appData</code> 文件夹附加应用的名称</li>\n<li><code>缓存</code></li>\n<li><code>temp</code> 临时文件夹</li>\n<li><code>exe</code>当前的可执行文件</li>\n<li><code>module</code> The <code>libchromiumcontent</code> 库</li>\n<li><code>desktop</code> 当前用户的桌面文件夹</li>\n<li><code>documents</code> 用户文档目录的路径</li>\n<li><code>downloads</code> 用户下载目录的路径</li>\n<li><code>music</code> 用户音乐目录的路径</li>\n<li><code>pictures</code> 用户图片目录的路径</li>\n<li><code>videos</code> 用户视频目录的路径</li>\n<li><code>recent</code> 用户最近文件的目录 (仅限 Windows)。</li>\n<li><code>logs</code>应用程序的日志文件夹</li>\n<li><code>crashDumps</code> 崩溃转储文件存储的目录。</li>\n</ul></li>\n</ul>\n<p>返回 <code>String</code> - 一个与 <code>name</code>相关的特殊目录或文件的路径。 失败会抛出一个<code>Error</code>。</p>\n<p>如果 <code>app.getPath('logs')</code> 被调用前没有先调用 <code>app.setAppLogsPath()</code> ，将创建一个相当于调用 <code>app.setAppLogsPath()</code> 却没有 <code>path</code> 参数的默认日志目录。</p>\n<h3 id=\"appgetfileiconpath-options\"><a href=\"#appgetfileiconpath-options\"><code>app.getFileIcon(path[, options])</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>size</code> String<ul>\n<li><code>small</code> - 16x16</li>\n<li><code>normal</code> - 32x32</li>\n<li><code>large</code> - <em>Linux</em>上是 48x48, <em>Windows</em> 上是 32x32, <em>macOS</em> 中无效</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>返回 <code>Promise&#x3C;NativeImage></code> - 完成后返回当前应用的图标, 类型是 <a href=\"/docs/api/native-image\">NativeImage</a>.</p>\n<p>读取文件的关联图标。</p>\n<p>在 <em>Windows</em> 上, 会有两种图标：</p>\n<ul>\n<li>与某些文件扩展名相关联的图标, 比如 <code>. mp3 </code> ，<code>. png </code> 等。</li>\n<li>文件本身就带图标，像是 <code>.exe</code>, <code>.dll</code>, <code>.ico</code></li>\n</ul>\n<p>在 <em>Linux</em> 和 <em>macOS</em> 系统中，图标取决于和应用程序绑定的 文件 mime 类型</p>\n<h3 id=\"appsetpathname-path\"><a href=\"#appsetpathname-path\"><code>app.setPath(name, path)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n<li><code>path</code> String</li>\n</ul>\n<p>重写 <code>name</code> 的路径为 <code>path</code>，一个特定的文件夹或者文件。 如果路径指向一个不存在的目录，则抛出一个 <code>Error</code>。 在这种情况下，目录应该以 <code>fs.mkdirSync</code> 或类似的方式创建。</p>\n<p><code>name</code> 参数只能使用 <code>app.getPath</code> 定义过的 name</p>\n<p>默认情况下, 网页的 cookie 和缓存将存储在 <code>userData</code> 目录下。 如果要更改这个位置, 你需要在 <code>app</code> 模块中的 <code> ready</code> 事件被触发之前重写 <code>userData</code> 的路径。</p>\n<h3 id=\"appgetversion\"><a href=\"#appgetversion\"><code>app.getVersion()</code></a></h3>\n<p>返回 <code>String</code>-加载的应用程序的版本。 如果应用程序的 <code>package. json</code> 文件中找不到版本号, 则返回当前包或者可执行文件的版本。</p>\n<h3 id=\"appgetname\"><a href=\"#appgetname\"><code>app.getName()</code></a></h3>\n<p>返回 <code>String</code>-当前应用程序的名称, 它是应用程序的 <code>package. json</code> 文件中的名称。</p>\n<p>根据 npm 的命名规则, 通常 <code>package.json</code> 中的 <code>name</code> 字段是一个短的小写字符串。 通常还应该指定一个 <code>productName</code> 字段, 是首字母大写的完整名称，用于表示应用程序的名称。Electron 会优先使用这个字段作为应用名。</p>\n<h3 id=\"appsetnamename\"><a href=\"#appsetnamename\"><code>app.setName(name)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n</ul>\n<p>设置当前应用程序的名字</p>\n<p><strong>注意：</strong> 此函数会覆盖Electron内部使用的名称；它不会影响操作系统使用的名称。</p>\n<h3 id=\"appgetlocale\"><a href=\"#appgetlocale\"><code>app.getLocale()</code></a></h3>\n<p>返回 <code>String</code> - 当前应用程序区域，使用Chromium的 <code>l10n_util</code> 库获取。 可能的返回值记录在<a href=\"https://source.chromium.org/chromium/chromium/src/+/master:ui/base/l10n/l10n_util.cc\">这里</a>。</p>\n<p>To set the locale, you'll want to use a command line switch at app startup, which may be found <a href=\"/docs/api/command-line-switches\">here</a>.</p>\n<p><strong> 注意: </strong>分发打包的应用程序时, 你必须指定 <code>locales</code> 文件夹。</p>\n<p><strong>注意：</strong> 在 Windows 上，你必须得等 <code>ready</code> 事件触发之后，才能调用该方法</p>\n<h3 id=\"appgetlocalecountrycode\"><a href=\"#appgetlocalecountrycode\"><code>app.getLocaleCountryCode()</code></a></h3>\n<p>返回 <code>String</code> - 用户操作系统区域设置的双字母 <a href=\"https://www.iso.org/iso-3166-country-codes.html\">ISO 3166</a> 国家代码。 该值取自本地操作系统 API。</p>\n<p><strong>注意：</strong> 当无法检测本地国家代码时，它返回空字符串。</p>\n<h3 id=\"appaddrecentdocumentpath-macos-windows\"><a href=\"#appaddrecentdocumentpath-macos-windows\"><code>app.addRecentDocument(path)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>将此 <code>path</code> 添加到最近打开的文件列表中</p>\n<p>此列表由操作系统管理。 在Windows上，您可以从任务栏访问此列表，在macOS上，您可以从dock菜单访问。</p>\n<h3 id=\"appclearrecentdocuments-macos-windows\"><a href=\"#appclearrecentdocuments-macos-windows\"><code>app.clearRecentDocuments()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>清空最近打开的文档列表</p>\n<h3 id=\"appsetasdefaultprotocolclientprotocol-path-args\"><a href=\"#appsetasdefaultprotocolclientprotocol-path-args\"><code>app.setAsDefaultProtocolClient(protocol[, path, args])</code></a></h3>\n<ul>\n<li><code>protocol</code> String - 协议的名称, 不包含 <code>://</code>。 例如，如果你希望应用处理 <code>electron://</code> 链接，请以<code>electron</code> 为参数调用此方法。</li>\n<li><code>path</code> String (可选) <em>Windows</em> - Electron可执行文件路径。 默认为 <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a> <em>Windows</em> - 传递给可执行文件的参数。 默认为空数组。</li>\n</ul>\n<p>返回 <code>Boolean</code>-是否成功调用。</p>\n<p>将当前可执行文件的设置为协议(也就是 URI scheme) 的默认处理程序。 该方法允许你将应用更深入地集成到操作系统中。 一旦注册了，所有 <code>your-protocol://</code> 开头的链接将使用当前可执行文件打开。 整个链接，包括协议部分，将作为参数传递给你的应用程序。</p>\n<p><strong> 注意: </strong>在 macOS 上，您只能注册已添加到应用程序的 <code>info.plist</code> 中的协议，这个列表在运行时不能修改。 然而，你可以在构建时通过 <a href=\"https://www.electronforge.io/\">Electron Forge</a>, <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a>, 或通过文本编辑器编辑<code>info.plist</code>文件的方式修改。 有关详细信息，请参阅 <a href=\"https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102207-TPXREF115\">Apple's documentation</a></p>\n<p><strong>注意：</strong> 在 Windows Store 环境下(当打包为 <code>appx</code>)，此 API 对所有调用都返回 <code>true</code>，但它设置的注册表项将无法通过其他应用程序访问。  为了注册你的 Windows Store 应用程序作为默认的协议处理程序，你必须 <a href=\"https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol\">在你的清单中声明协议</a>。</p>\n<p>API 在内部使用 Windows 注册表和 <code>LSSetDefaultHandlerForURLScheme</code>。</p>\n<h3 id=\"appremoveasdefaultprotocolclientprotocol-path-args-macos-windows\"><a href=\"#appremoveasdefaultprotocolclientprotocol-path-args-macos-windows\"><code>app.removeAsDefaultProtocolClient(protocol[, path, args])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>protocol</code> String - 协议的名称, 不包含 <code>://</code>。</li>\n<li><code>path</code>String (可选) <em> Windows </em>-默认为 <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a> <em>Windows</em> - 默认为空数组</li>\n</ul>\n<p>返回 <code>Boolean</code>-是否成功调用。</p>\n<p>此方法检查当前可执行程序是否是协议(也就是URI scheme) 的默认处理程序。 如果是，则会将应用移除默认处理器。</p>\n<h3 id=\"appisdefaultprotocolclientprotocol-path-args\"><a href=\"#appisdefaultprotocolclientprotocol-path-args\"><code>app.isDefaultProtocolClient(protocol[, path, args])</code></a></h3>\n<ul>\n<li><code>protocol</code> String - 协议的名称, 不包含 <code>://</code>。</li>\n<li><code>path</code>String (可选) <em> Windows </em>-默认为 <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a> <em>Windows</em> - 默认为空数组</li>\n</ul>\n<p>返回 <code>Boolean</code> - 当前可执行程序是否是协议(也就是URI scheme) 的默认处理程序。</p>\n<p><strong> 注意: </strong>在macOS上, 您可以使用此方法检查应用程序是否已注册为协议的默认协议处理程序。 同时可以通过查看 <code>~/Library/Preferences/com.apple.LaunchServices.plist</code> 来确认。 有关详细信息，请参阅 <a href=\"https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme\">Apple's documentation</a></p>\n<p>API 在内部使用 Windows 注册表和 <code>LSCopyDefaultHandlerForURLScheme</code>。</p>\n<h3 id=\"appgetapplicationnameforprotocolurl\"><a href=\"#appgetapplicationnameforprotocolurl\"><code>app.getApplicationNameForProtocol(url)</code></a></h3>\n<ul>\n<li><code>url</code> String - 要检查的协议名称的 URL。 不同于家族中的其他方法，该方法接收至少包含 <code>://</code> (例如：<code>https://</code>)的完整URL。</li>\n</ul>\n<p>返回 <code>String</code> - 处理协议的应用程序名称，或如果没有处理程序的空 字符串。 例如，如果Electron 是这个URL的默认 处理程序，那么在 Windows 和 Mac 上，这个返回值可以是 <code>Electron</code>。 然而，不要依赖于无法保证保持不变的精确格式。 Linux 上期望不同格式，可能带有 <code>.desktop</code> 后缀。</p>\n<p>此方法返回URL协议(也就是URI scheme) 的默认处理器的应用程序名称。</p>\n<h3 id=\"appgetapplicationinfoforprotocolurl-macos-windows\"><a href=\"#appgetapplicationinfoforprotocolurl-macos-windows\"><code>app.getApplicationInfoForProtocol(url)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>url</code> String - 要检查的协议名称的 URL。 不同于家族中的其他方法，该方法接收至少包含 <code>://</code> (例如：<code>https://</code>)的完整URL。</li>\n</ul>\n<p>返回 <code>Promise&#x3C;Object></code> - resolve包含以下内容的object：</p>\n<ul>\n<li><code>icon</code> NativeImage - 处理协议的应用程序的显示图标。</li>\n<li><code>path</code> String - 处理协议的应用程序的安装路径。</li>\n<li><code>name</code> String - 处理协议的应用程序的显示名称。</li>\n</ul>\n<p>此方法返回包含应用程序名称，图标和默认协议处理器路径(也就是URI scheme) 的Promise。</p>\n<h3 id=\"appsetusertaskstasks-windows\"><a href=\"#appsetusertaskstasks-windows\"><code>app.setUserTasks(tasks)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>tasks</code> <a href=\"/docs/api/structures/task\">Task[]</a> - 由 <code>Task</code> 对象组成的数组</li>\n</ul>\n<p>Windows上添加 <code>tasks</code> 到 Jump List的 <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks\">Tasks</a> 类别。</p>\n<p><code>tasks</code> 是 <a href=\"/docs/api/structures/task\"><code>Task</code></a> 对象组成的数组</p>\n<p>返回 <code>Boolean</code>-是否成功调用。</p>\n<p><strong> 注意: </strong>如果您想自定义跳转列表, 请使用 <code>aapp.setJumpList(categories)</code> 来代替。</p>\n<h3 id=\"appgetjumplistsettings-windows\"><a href=\"#appgetjumplistsettings-windows\"><code>app.getJumpListSettings()</code> <em>Windows</em></a></h3>\n<p>返回 <code>Object</code>:</p>\n<ul>\n<li><code>minItems</code> Integer - 将在跳转列表中显示项目的最小数量(有关此值的更详细描述，请参阅 <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx\">MSDN docs</a>).</li>\n<li><code>removedItems</code> <a href=\"/docs/api/structures/jump-list-item\">JumpListItem[]</a> - 用户已明确从Jump List自定义类别中删除的项对应的 <code>JumpListItem</code> 对象数组。 这些项目不能在 <strong>next</strong> 调用 <code>app.setJumpList()</code> 时重新添加到跳转列表中, Windows不会显示任何包含已删除项目的自定义类别.</li>\n</ul>\n<h3 id=\"appsetjumplistcategories-windows\"><a href=\"#appsetjumplistcategories-windows\"><code>app.setJumpList(categories)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>categories</code> <a href=\"/docs/api/structures/jump-list-category\">JumpListCategory[]</a> | <code>null</code> - <code>JumpListCategory</code> 对象数组。</li>\n</ul>\n<p>设置或删除应用程序的自定义跳转列表，并返回以下字符串之一：</p>\n<ul>\n<li><code>ok</code> - 没有出现错误</li>\n<li><code>error</code> - 发生一个或多个错误，启用运行日志记录找出可能的原因。</li>\n<li><code>invalidSeparatorError</code> - 已尝试在跳转列表中向自定义类别添加分隔符。 分隔符只允许在标准 <code>Tasks</code> 类别下出现。</li>\n<li><code>fileTypeRegistrationError</code> -尝试向自定义跳转列表添加一个文件链接，但是该应用未注册处理该应用类型</li>\n<li><code>customCategoryAccessDeniedError</code> - 由于用户隐私或策略组设置，自定义类别无法添加到跳转列表。</li>\n</ul>\n<p>如果 <code>categories</code> 的值为 <code>null</code>， 之前设定的自定义跳转列表(如果存在) 将被替换为标准的应用跳转列表(由windows生成)</p>\n<p><strong>注意：</strong> 如果一个 <code>JumpListCategory</code> 对象既没有设置 <code>type</code> 属性，也没有设置 <code>name</code> 属性，则假设其 <code>type</code> 是 <code>tasks</code>。 如果设置了 <code>name</code> 属性, 但省略了 <code>type</code> 属性, 则假定 <code>type</code> 为 <code> custom</code>。</p>\n<p><strong>注意:</strong> 用户可以从自定义类别中移除项目， <strong>after</strong> 调用 <code>app.setJumpList(categories)</code> 方法之前， Windows不允许删除的项目添加回自定义类别。 尝试提前将删除的项目重新添加 到自定义类别中，将导致整个自定义类别被隐藏。 删除的项目可以使用 <code>app.getJumpListSettings()</code> 获取。</p>\n<p><strong>注意：</strong> 跳列表项目 <code>description</code> 属性的最大长度为 260 个字符。 超过这个限制，当前项将不会被添加到跳转列表，也不会被展示。</p>\n<p>下面是创建自定义跳转列表的一个非常简单的示例:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setJumpList([\n  {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'custom'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Recent Projects'</span>,\n    <span class=\"hljs-attr\">items</span>: [\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'file'</span>, <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'C:\\\\Projects\\\\project1.proj'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'file'</span>, <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'C:\\\\Projects\\\\project2.proj'</span> }\n    ]\n  },\n  { <span class=\"hljs-comment\">// has a name so `type` is assumed to be \"custom\"</span>\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Tools'</span>,\n    <span class=\"hljs-attr\">items</span>: [\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Tool A'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--run-tool-a'</span>,\n        <span class=\"hljs-attr\">icon</span>: process.execPath,\n        <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Runs Tool A'</span>\n      },\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Tool B'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--run-tool-b'</span>,\n        <span class=\"hljs-attr\">icon</span>: process.execPath,\n        <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Runs Tool B'</span>\n      }\n    ]\n  },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'frequent'</span> },\n  { <span class=\"hljs-comment\">// has no name and no type so `type` is assumed to be \"tasks\"</span>\n    <span class=\"hljs-attr\">items</span>: [\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'New Project'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--new-project'</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Create a new project.'</span>\n      },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Recover Project'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--recover-project'</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Recover Project'</span>\n      }\n    ]\n  }\n])\n</code></pre>\n<h3 id=\"apprequestsingleinstancelock\"><a href=\"#apprequestsingleinstancelock\"><code>app.requestSingleInstanceLock()</code></a></h3>\n<p>返回 <code>Boolean</code></p>\n<p>此方法的返回值表示你的应用程序实例是否成功取得了锁。  如果它取得锁失败，你可以假设另一个应用实例已经取得了锁并且仍旧在运行，并立即退出。</p>\n<p>I.e. 如果当前进程是应用程序的主要实例，则此方法返回<code>true</code>，同时你的应用会继续运行。  如果当它返回 <code>false</code>如果你的程序没有取得锁，它应该立刻退出，并且将参数发送给那个已经取到锁的进程。</p>\n<p>在 macOS 上, 当用户尝试在 Finder 中打开您的应用程序的第二个实例时, 系统会通过发出 <code>open-file</code> 和 <code>open-url</code> 事件来自动强制执行单个实例,。 但是当用户在命令行中启动应用程序时, 系统的单实例机制将被绕过, 您必须手动调用此方法来确保单实例。</p>\n<p>在第二个实例启动时激活主实例窗口的示例:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> myWindow = <span class=\"hljs-literal\">null</span>\n\n<span class=\"hljs-keyword\">const</span> gotTheLock = app.requestSingleInstanceLock()\n\n<span class=\"hljs-keyword\">if</span> (!gotTheLock) {\n  app.quit()\n} <span class=\"hljs-keyword\">else</span> {\n  app.on(<span class=\"hljs-string\">'second-instance'</span>, (event, commandLine, workingDirectory) => {\n    <span class=\"hljs-comment\">// 当运行第二个实例时,将会聚焦到myWindow这个窗口</span>\n    <span class=\"hljs-keyword\">if</span> (myWindow) {\n      <span class=\"hljs-keyword\">if</span> (myWindow.isMinimized()) myWindow.restore()\n      myWindow.focus()\n    }\n  })\n\n  <span class=\"hljs-comment\">// 创建 myWindow, 加载应用的其余部分, etc...</span>\n  app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    myWindow = createWindow()\n  })\n}\n</code></pre>\n<h3 id=\"apphassingleinstancelock\"><a href=\"#apphassingleinstancelock\"><code>app.hasSingleInstanceLock()</code></a></h3>\n<p>返回 <code>Boolean</code></p>\n<p>此方法返回你的应用实例当前是否持有单例锁。  你可以通过 <code>app.requestSingleInstanceLock()</code>请求锁，并且通过 <code>app.releaseSingleInstanceLock()</code> 释放锁。</p>\n<h3 id=\"appreleasesingleinstancelock\"><a href=\"#appreleasesingleinstancelock\"><code>app.releaseSingleInstanceLock()</code></a></h3>\n<p>释放所有由 <code>requestSingleInstanceLock</code> 创建的锁。 该方法将允许应用程序的多个实例再次并行运行。</p>\n<h3 id=\"appsetuseractivitytype-userinfo-webpageurl-macos\"><a href=\"#appsetuseractivitytype-userinfo-webpageurl-macos\"><code>app.setUserActivity(type, userInfo[, webpageURL])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>type</code> String - 活动的唯一标识。 映射到 <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity. activityType</code></a>。</li>\n<li><code>userInfo</code> any - 存储供其他设备使用的特定应用状态。</li>\n<li><code>webpageURL</code> String (可选) - 如果在返回的设备上没有安装合适的应用，要在浏览器中加载的网页。 协议必须是 <code>http</code> 或 <code>https</code>。</li>\n</ul>\n<p>创建一个 <code>NSUserActivity</code> 并将其设置为当前活动。 该活动之后可以<a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a>到另一个设备。</p>\n<h3 id=\"appgetcurrentactivitytype-macos\"><a href=\"#appgetcurrentactivitytype-macos\"><code>app.getCurrentActivityType()</code> <em>macOS</em></a></h3>\n<p>返回 <code>String</code> - 正在运行的 activity 的类型</p>\n<h3 id=\"appinvalidatecurrentactivity-macos\"><a href=\"#appinvalidatecurrentactivity-macos\"><code>app.invalidateCurrentActivity()</code> <em>macOS</em></a></h3>\n<p>使当前的<a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a>用户活动无效。</p>\n<h3 id=\"appresigncurrentactivity-macos\"><a href=\"#appresigncurrentactivity-macos\"><code>app.resignCurrentActivity()</code> <em>macOS</em></a></h3>\n<p>将当前 <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> 用户活动标记为非活动，但不使其失效。</p>\n<h3 id=\"appupdatecurrentactivitytype-userinfo-macos\"><a href=\"#appupdatecurrentactivitytype-userinfo-macos\"><code>app.updateCurrentActivity(type, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>type</code> String - 活动的唯一标识。 映射到 <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity. activityType</code></a>。</li>\n<li><code>userInfo</code> any - 存储供其他设备使用的特定应用状态。</li>\n</ul>\n<p>当其类型与 <code>type</code> 匹配时更新当前活动, 将项目从 <code>用户信息</code> 合并到其当前 <code>用户信息</code> 字典中。</p>\n<h3 id=\"appsetappusermodelidid-windows\"><a href=\"#appsetappusermodelidid-windows\"><code>app.setAppUserModelId(id)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>id</code> String</li>\n</ul>\n<p>改变当前应用的 <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> 为 <code>id</code>.</p>\n<h3 id=\"appsetactivationpolicypolicy-macos\"><a href=\"#appsetactivationpolicypolicy-macos\"><code>app.setActivationPolicy(policy)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>policy</code> String - 可以是'regular', 'accessory', 或 'prohibited'。</li>\n</ul>\n<p>为给定应用设置激活策略。</p>\n<p>激活策略类型：</p>\n<ul>\n<li>'regulatory ' - 应用程序以普通应用出现在 Dock 中，可能有一个用户界面。</li>\n<li>'accessory' - 应用程序不会出现在 Dock 中，没有菜单栏， 但它可能会被程序或在点击其某个窗口时激活。</li>\n<li>'prohibited' - 应用程序不会出现在 Dock 中，可能无法创建窗口或被激活。</li>\n</ul>\n<h3 id=\"appimportcertificateoptions-callback-linux\"><a href=\"#appimportcertificateoptions-callback-linux\"><code>app.importCertificate(options, callback)</code> <em>Linux</em></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>certificate</code> String - pkcs12 文件的路径</li>\n<li><code>password</code> String - 证书的密码</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>result</code> Integer - 导入结果</li>\n</ul></li>\n</ul>\n<p>将 pkcs12 格式的证书导入到平台证书库。 使用导入操作的 <code>callback</code> 调用返回 <code>result</code> ，值 <code>0</code> 表示成功，而任何其他值表示失败，根据Chromium <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">net_error_list</a> 。</p>\n<h3 id=\"appconfigurehostresolveroptions\"><a href=\"#appconfigurehostresolveroptions\"><code>app.configureHostResolver(options)</code></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<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>\n<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>\n<li><code>secureDnsServers</code> String[] (optional) - A list of DNS-over-HTTP server templates. See <a href=\"https://datatracker.ietf.org/doc/html/rfc8484#section-3\">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://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&#x26;ss=chromium%2Fchromium%2Fsrc\">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>\n<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. 默认值为 true。</li>\n</ul></li>\n</ul>\n<p>Configures host resolution (DNS and DNS-over-HTTPS). By default, the following resolvers will be used, in order:</p>\n<ol>\n<li>DNS-over-HTTPS, if the <a href=\"https://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&#x26;ss=chromium%2Fchromium%2Fsrc\">DNS provider supports it</a>, then</li>\n<li>the built-in resolver (enabled on macOS only by default), then</li>\n<li>the system's resolver (e.g. <code>getaddrinfo</code>).</li>\n</ol>\n<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>\n<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>\n<pre><code class=\"hljs language-js\">app.configureHostResolver({\n  <span class=\"hljs-attr\">secureDnsMode</span>: <span class=\"hljs-string\">'secure'</span>,\n  <span class=\"hljs-attr\">secureDnsServers</span>: [\n    <span class=\"hljs-string\">'https://cloudflare-dns.com/dns-query'</span>\n  ]\n})\n</code></pre>\n<p>此 API 必须在 <code>ready</code> 事件触发后调用</p>\n<h3 id=\"appdisablehardwareacceleration\"><a href=\"#appdisablehardwareacceleration\"><code>app.disableHardwareAcceleration()</code></a></h3>\n<p>禁用当前应用程序的硬件加速。</p>\n<p>这个方法只能在应用程序准备就绪（ready）之前调用。</p>\n<h3 id=\"appdisabledomainblockingfor3dapis\"><a href=\"#appdisabledomainblockingfor3dapis\"><code>app.disableDomainBlockingFor3DAPIs()</code></a></h3>\n<p>默认情况下, 如果 GPU 进程频繁崩溃, Chromium 会禁用 3D API (例如 WebGL) 直到在每个域的基础上重新启动。 这个函数会禁用该行为。</p>\n<p>这个方法只能在应用程序准备就绪（ready）之前调用。</p>\n<h3 id=\"appgetappmetrics\"><a href=\"#appgetappmetrics\"><code>app.getAppMetrics()</code></a></h3>\n<p>返回 <a href=\"/docs/api/structures/process-metric\"><code>ProcessMetric[]</code></a>: 包含所有与应用相关的进程的内存和CPU的使用统计的 <code>ProcessMetric</code> 对象的数组。</p>\n<h3 id=\"appgetgpufeaturestatus\"><a href=\"#appgetgpufeaturestatus\"><code>app.getGPUFeatureStatus()</code></a></h3>\n<p>返回 <a href=\"/docs/api/structures/gpu-feature-status\"><code>GPUFeatureStatus</code></a>-来自 <code> chrome://gpu/</code> 的图形功能状态。</p>\n<p><strong>注意：</strong> 此信息仅在 <code>gpu-info-update</code> 事件触发后才可用。</p>\n<h3 id=\"appgetgpuinfoinfotype\"><a href=\"#appgetgpuinfoinfotype\"><code>app.getGPUInfo(infoType)</code></a></h3>\n<ul>\n<li><code>infoType</code> String - 可以是 <code>basic</code> 或 <code>complete</code>。</li>\n</ul>\n<p>返回 <code> Promise&#x3C;unknown></code></p>\n<p>对于<code>infoType</code>等于<code>complete</code>： Promise 将包含所有GPU信息的<code>Object</code>正如 <a href=\"https://chromium.googlesource.com/chromium/src/+/4178e190e9da409b055e5dff469911ec6f6b716f/gpu/config/gpu_info.cc\"> chromium's GPUInfo object</a>。 这包括 <code>chrome://gpu</code> 页面上显示的版本和驱动程序信息。</p>\n<p>对于<code>infoType</code>等于<code>basic</code>： Promise 至少包含当请求<code>complete</code>时的属性<code>Object</code>。 下面是一个基础响应示例：</p>\n<pre><code class=\"hljs language-js\">{\n  <span class=\"hljs-attr\">auxAttributes</span>:\n   {\n     <span class=\"hljs-attr\">amdSwitchable</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">canSupportThreadedTextureMailbox</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">directComposition</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">directRendering</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">glResetNotificationStrategy</span>: <span class=\"hljs-number\">0</span>,\n     <span class=\"hljs-attr\">inProcessGpu</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">initializationTime</span>: <span class=\"hljs-number\">0</span>,\n     <span class=\"hljs-attr\">jpegDecodeAcceleratorSupported</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">optimus</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">passthroughCmdDecoder</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">sandboxed</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">softwareRendering</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">supportsOverlays</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">videoDecodeAcceleratorFlags</span>: <span class=\"hljs-number\">0</span>\n   },\n  <span class=\"hljs-attr\">gpuDevice</span>:\n   [{ <span class=\"hljs-attr\">active</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">deviceId</span>: <span class=\"hljs-number\">26657</span>, <span class=\"hljs-attr\">vendorId</span>: <span class=\"hljs-number\">4098</span> },\n     { <span class=\"hljs-attr\">active</span>: <span class=\"hljs-literal\">false</span>, <span class=\"hljs-attr\">deviceId</span>: <span class=\"hljs-number\">3366</span>, <span class=\"hljs-attr\">vendorId</span>: <span class=\"hljs-number\">32902</span> }],\n  <span class=\"hljs-attr\">machineModelName</span>: <span class=\"hljs-string\">'MacBookPro'</span>,\n  <span class=\"hljs-attr\">machineModelVersion</span>: <span class=\"hljs-string\">'11.5'</span>\n}\n</code></pre>\n<p>如果只需要基本信息，如<code>vendorId</code>或<code>driverId</code>，则应优先使用<code>basic</code>。</p>\n<h3 id=\"appsetbadgecountcount-linux-macos\"><a href=\"#appsetbadgecountcount-linux-macos\"><code>app.setBadgeCount([count])</code> <em>Linux</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>count</code> Integer (可选) - 如果传入值，则将角标设置为所传入值，否则，在 macOS 上显示一个普通的白点(例如：通知数量未知)。 在 Linux 上，如果没有传入值，角标将不会显示。</li>\n</ul>\n<p>返回 <code>Boolean</code>-是否成功调用。</p>\n<p>为当前应用设置计数器角标。 将计数设置为 <code>0</code> 将隐藏角标。</p>\n<p>在 macOS 上，它会在dock 图标上显示。 在 Linux 上，它只适用于 Unity 启动器。</p>\n<p><strong>注意：</strong> Unity 启动器需要一个 <code>.desktop</code> 文件才能工作。 欲了解更多信息， 请阅读 <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Unity integration 文档</a>。</p>\n<h3 id=\"appgetbadgecount-linux-macos\"><a href=\"#appgetbadgecount-linux-macos\"><code>app.getBadgeCount()</code> <em>Linux</em> <em>macOS</em></a></h3>\n<p>Returns <code>Integer</code> - 获取计数器提醒(badge) 中显示的当前值</p>\n<h3 id=\"appisunityrunning-linux\"><a href=\"#appisunityrunning-linux\"><code>app.isUnityRunning()</code> <em>Linux</em></a></h3>\n<p>Returns <code>Boolean</code> - 当前桌面环境是否为 Unity 启动器</p>\n<h3 id=\"appgetloginitemsettingsoptions-macos-windows\"><a href=\"#appgetloginitemsettingsoptions-macos-windows\"><code>app.getLoginItemSettings([options])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>options</code> Object (可选)<ul>\n<li><code>path</code> String (可选) <em>Windows</em> - 要比较的可执行路径。 默认为 <code>process.execPath</code>。</li>\n<li><code>args</code> String<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a> <em>Windows</em> - 要比较的命令行参数。 默认为空数组。</li>\n</ul></li>\n</ul>\n<p>如果你为 <code>app. setLoginItemSettings</code> 提供<code>path</code> 和 <code>args</code> 选项，那么你需要在这里为 <code>openAtLogin</code> 设置相同的参数已确保正确的设置。</p>\n<p>返回 <code>Object</code>:</p>\n<ul>\n<li><code>openAtLogin</code> Boolean - <code>true</code> 如果应用程序设置为在登录时打开, 则为 &#x3C;0>true&#x3C;/0></li>\n<li><code>openAsHidden</code> Boolean <em>macOS</em> - 当应用程序设置为在登录时隐藏打开为<code>true</code>。 此设置在 <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS 构建</a> 上不可用。</li>\n<li><code>wasOpenedAtLogin</code> Boolean <em>macOS</em> - 当应用程序在登录时自动运行为<code>true</code>。 此设置在 <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS 构建</a> 上不可用。</li>\n<li><code>wasOpenedAsHidden</code> Boolean <em>macOS</em> - 当应用程序作为一个隐藏的登录项运行时为 <code>true</code> 。 这表示应用程序在启动时不应打开任何窗口。 此设置在 <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS 构建</a> 上不可用。</li>\n<li><code>restoreState</code> Boolean <em>macOS</em> - <code>true</code> 如果应用程序作为登录项打开， 应该还原上一个会话状态。 这表示程序应该还原上次关闭时打开的窗口。 此设置在 <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS 构建</a> 上不可用。</li>\n<li><code>executableWillLaunchAtLogin</code> Boolean <em>Windows</em> - <code>true</code> 应用程序被设置为在登录时打开，并且其启动项未停用。 该属性与 <code>openAtLogin</code> 不同，因为它忽略了 <code>args</code> 选项，如果给定的可执行程序在登录时启动并带有 <strong>任意</strong> 参数，此属性将为true。</li>\n<li><code>launchItems</code> Object[] <em>Windows</em><ul>\n<li><code>name</code> String <em>Windows</em> - 注册表项的名称值。</li>\n<li><code>path</code> String <em>Windows</em> - 与注册表条目相对应的应用可执行程序。</li>\n<li><code>args</code> String[] <em>Windows</em> - 传递到可执行文件的命令行参数。</li>\n<li><code>scope</code> String <em>Windows</em> - <code>user</code> 或 <code>machine</code>之一。 指示注册表条目是否处于 <code>HKEY_CURRENT USER</code> 或 <code>HKEY_LOCAL_MACHINE</code>下。</li>\n<li><code>enabled</code> Boolean <em>Windows</em> - <code>true</code> 如果应用注册表项已获得启动批准，此时在任务管理器和 Windows 设置中显示为 <code>enabled</code> 。</li>\n</ul></li>\n</ul>\n<h3 id=\"appsetloginitemsettingssettings-macos-windows\"><a href=\"#appsetloginitemsettingssettings-macos-windows\"><code>app.setLoginItemSettings(settings)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>settings</code> Object<ul>\n<li><code>openAtLogin</code> Boolean (可选) - <code>true</code> 登录时打开应用程序， <code>false</code> 将应用从登录启动项中删除。 默认值为 <code>false</code>.</li>\n<li><code>openAsHidden</code> Boolean (可选) <em>macOS</em> - <code>true</code> 以隐藏方式打开应用程序。 默认为<code>false</code>。 用户可以从系统首选项中编辑此设置, 以便在打开应用程序时检查 <code>app.getLoginItemSettings().wasOpenedAsHidden</code> 以了解当前值。 此设置在 <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS 构建</a> 上不可用。</li>\n<li><code>path</code> String (可选) <em>Windows</em> - 登录时运行的可执行文件。 默认为 <code>process.execPath</code>。</li>\n<li><code>args</code> String<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a> <em>Windows</em> - 传递给可执行文件的控制台参数。 默认为空数组。 注意用引号包裹路径。</li>\n<li><code>enabled</code> Boolean (可选) <em>Windows</em> - <code>true</code> 将更改已启用的启动注册表项，并在任务管理器和 Windows 设置中 <code>启用 / 禁用</code> 应用程序。 默认值为 <code>true</code>。</li>\n<li><code>name</code> String (可选) <em>Windows</em> - 要写入注册表的值名称。 默认为应用的 AppUserModelId()。 设置应用程序的登录项设置。</li>\n</ul></li>\n</ul>\n<p>如果需要在 Windows 上使用<a href=\"https://github.com/Squirrel/Squirrel.Windows\">Squirrel</a>的 <code>autoUpdater</code> ，你需要将启动路径设置为 Update.exe，并传递指定应用程序名称的参数。 例如：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> appFolder = path.dirname(process.execPath)\n<span class=\"hljs-keyword\">const</span> updateExe = path.resolve(appFolder, <span class=\"hljs-string\">'..'</span>, <span class=\"hljs-string\">'Update.exe'</span>)\n<span class=\"hljs-keyword\">const</span> exeName = path.basename(process.execPath)\n\napp.setLoginItemSettings({\n  <span class=\"hljs-attr\">openAtLogin</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">path</span>: updateExe,\n  <span class=\"hljs-attr\">args</span>: [\n    <span class=\"hljs-string\">'--processStart'</span>, <span class=\"hljs-string\">`\"<span class=\"hljs-subst\">${exeName}</span>\"`</span>,\n    <span class=\"hljs-string\">'--process-start-args'</span>, <span class=\"hljs-string\">`\"--hidden\"`</span>\n  ]\n})\n</code></pre>\n<h3 id=\"appisaccessibilitysupportenabled-macos-windows\"><a href=\"#appisaccessibilitysupportenabled-macos-windows\"><code>app.isAccessibilitySupportEnabled()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Returns <code>Boolean</code> - 如果开启了Chrome的辅助功能, 则返回 <code>true</code>，其他情况返<code>false</code>。 如果使用了辅助技术（例如屏幕阅读），该 API 将返回 <code>true</code>。 查看更多细节，请查阅 <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">https://www.chromium.org/developers/design-documents/accessibility</a></p>\n<h3 id=\"appsetaccessibilitysupportenabledenabled-macos-windows\"><a href=\"#appsetaccessibilitysupportenabledenabled-macos-windows\"><code>app.setAccessibilitySupportEnabled(enabled)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>enable</code> 逻辑值 - 启用或禁用<a href=\"https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree\">访问权限树</a>视图。</li>\n</ul>\n<p>手动启用 Chrome 的辅助功能的支持, 允许在应用程序中设置是否开启辅助功能。 在<a href=\"https://www.chromium.org/developers/design-documents/accessibility\">Chromium's accessibility docs</a>查看更多的细节 默认为禁用</p>\n<p>此 API 必须在 <code>ready</code> 事件触发后调用</p>\n<p><strong>注意：</strong> 渲染访问权限树可能会严重影响您应用的性能。 默认情况下不应启用该功能。</p>\n<h3 id=\"appshowaboutpanel\"><a href=\"#appshowaboutpanel\"><code>app.showAboutPanel()</code></a></h3>\n<p>显示应用程序的\"关于\"面板选项。 这些选项可以被 <code>app.setAboutPanelOptions(可选)</code> 所覆盖。</p>\n<h3 id=\"appsetaboutpaneloptionsoptions\"><a href=\"#appsetaboutpaneloptionsoptions\"><code>app.setAboutPanelOptions(options)</code></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>applicationName</code> String (可选) - 应用程序的名字</li>\n<li><code>applicationVersion</code> String (可选) - 应用程序版本</li>\n<li><code>copyright</code> String (可选) - 版权信息</li>\n<li><code>version</code> String (可选) <em>macOS</em> - 应用程序版本号</li>\n<li><code>credits</code> String (可选) <em>macOS</em> <em>Windows</em> - 信用信息。</li>\n<li><code>authors</code> String<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a> <em>Linux</em> - 应用程序作者列表。</li>\n<li><code>website</code> String (可选) <em>Linux</em> - 应用程序的网站。</li>\n<li><code>iconPath</code> String (可选) <em>Linux</em> <em>Windows</em> - 以JPEG 或 PNG 文件格式为应用程序图标路径。 在 Linux 上，将显示为 64x64 像素，同时保留纵横比。</li>\n</ul></li>\n</ul>\n<p>设置 \"关于\" 面板选项。 这将覆盖应用程序在 macOS 上的 <code>.plist</code> 文件中定义的值。 详细信息请查阅 <a href=\"https://developer.apple.com/reference/appkit/nsapplication/1428479-orderfrontstandardaboutpanelwith?language=objc\"> Apple 文档 </a>。 在 Linux 上，没有默认值，所以必须设置值才能显示。</p>\n<p>如果您没有设置 <code>credits</code> 但仍希望在应用中显示它们，AppKit 将在 NSBundle 类的main方法返回的捆绑包中按顺序查找名为\"Credits.html\", \"Credits.rtf\"和\"Credits.rtfd\"的文件。 先找到的文件将被使用，如果未找到，则信息区域将留空。 有关更多信息，请参阅 Apple <a href=\"https://developer.apple.com/documentation/appkit/nsaboutpaneloptioncredits?language=objc\">文档</a> 。</p>\n<h3 id=\"appisemojipanelsupported\"><a href=\"#appisemojipanelsupported\"><code>app.isEmojiPanelSupported()</code></a></h3>\n<p>返回 <code>布尔值</code> - 当前操作系统版本是否允许使用本机emoji选取器。</p>\n<h3 id=\"appshowemojipanel-macos-windows\"><a href=\"#appshowemojipanel-macos-windows\"><code>app.showEmojiPanel()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>打开系统自身的emjio选取器。</p>\n<h3 id=\"appstartaccessingsecurityscopedresourcebookmarkdata-macos\"><a href=\"#appstartaccessingsecurityscopedresourcebookmarkdata-macos\"><code>app.startAccessingSecurityScopedResource(bookmarkData)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>bookmarkData</code> String - base64 编码的安全作用域的书签数据(bookmark data) ，通过 <code>dialog.showOpenDialog</code> 或者 <code>dialog.showSaveDialog</code> 方法获取。</li>\n</ul>\n<p>返回 <code>Function</code> - 该函数 <strong>必须</strong> 在你完成访问安全作用域文件后调用一次。 如果你忘记停止访问书签，<a href=\"https://developer.apple.com/reference/foundation/nsurl/1417051-startaccessingsecurityscopedreso?language=objc\">内核资源将会泄漏</a>，并且你的应用将失去完全到达沙盒之外的能力，直到应用重启。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">//开始读取文件</span>\n<span class=\"hljs-keyword\">const</span> stopAcessingSecurityScopedResource = app。 tartAccessingSecurityScopedResource(数据)\n<span class=\"hljs-comment\">// 您现在可以在 sandbox:party_popper 之外访问文件🎉</span>\n\n<span class=\"hljs-comment\">// 记住在文件完成后停止访问</span>\nstopAccessingSecurityScopedResource()\n</code></pre>\n<p>开始访问安全范围内的资源。 通过这个方法，Electron 应用被打包为可到达Mac App Store沙箱之外访问用户选择的文件。 关于系统工作原理，请查阅<a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">Apple's documentation</a></p>\n<h3 id=\"appenablesandbox\"><a href=\"#appenablesandbox\"><code>app.enableSandbox()</code></a></h3>\n<p>在应用程序上启用完全沙盒模式。 这意味着所有渲染器都将以沙盒的方式运行，无论 WebPreence 中 <code>sandbox</code> 标志的值是什么。</p>\n<p>这个方法只能在应用程序准备就绪（ready）之前调用。</p>\n<h3 id=\"appisinapplicationsfolder-macos\"><a href=\"#appisinapplicationsfolder-macos\"><code>app.isInApplicationsFolder()</code> <em>macOS</em></a></h3>\n<p>返回 <code>Boolean</code> - 应用程序当前是否从系统应用程序文件夹运行。 与 <code>app.moveToApplicationsFolder()</code>一起使用</p>\n<h3 id=\"appmovetoapplicationsfolderoptions-macos\"><a href=\"#appmovetoapplicationsfolderoptions-macos\"><code>app.moveToApplicationsFolder([options])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>options</code> Object (可选)<ul>\n<li><code>conflictHandler</code> Function<boolean> (可选) - 处理移动失败的潜在冲突。<ul>\n<li><code>conflictType</code> String - 处理器遇到移动冲突的类型； 可以是 <code>exists</code> 或 <code>existsAndRunning</code>, <code>exists</code> 意味着应用程序目录中存在相同名称的应用， <code>existsAndRunning</code> 表示存在并且正在运行。</li>\n</ul></boolean></li>\n</ul></li>\n</ul>\n<p>返回 <code>Boolean</code> - 移动是否成功。 请注意，如果移动成功，您的应用程序将退出并重新启动。</p>\n<p>默认情况下不会显示确认对话框。 如果您希望允许用户确认操作，您可以使用<a href=\"/docs/api/dialog\"><code>dialog</code></a> API 进行确认。</p>\n<p><strong>注意：</strong>如果并非是用户造成操作失败，这个方法会抛出错误。 例如，如果用户取消了授权会话，这个方法将返回false。 如果无法执行复制操作, 则此方法将抛出错误。 错误中的信息应该是翔实的，并告诉你到底是哪里出了问题。</p>\n<p>默认情况下，如果应用程序目录中存在与被移动的应用同名的应用，并且 <em>未</em> 运行，则已有应用将被丢弃，被移动的应用将顶替其位置。 如果它 <em>正在</em> 运行，预先存在的运行应用程序将承担焦点，以前活动的应用程序将退出自己。 此行为可以通过提供可选的冲突处理器来更改，处理器返回的 boolean 将决定移动冲突是否通过默认行为得到解决。  即：返回 <code>false</code> 将确保不采取进一步行动，返回 <code>true</code> 将导致默认行为同时方法继续执行。</p>\n<p>例如：</p>\n<pre><code class=\"hljs language-js\">app.moveToApplicationsFolder({\n  <span class=\"hljs-attr\">conflictHandler</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">conflictType</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (conflictType === <span class=\"hljs-string\">'exists'</span>) {\n      <span class=\"hljs-keyword\">return</span> dialog.showMessageBoxSync({\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'question'</span>,\n        <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Halt Move'</span>, <span class=\"hljs-string\">'Continue Move'</span>],\n        <span class=\"hljs-attr\">defaultId</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'An app of this name already exists'</span>\n      }) === <span class=\"hljs-number\">1</span>\n    }\n  }\n})\n</code></pre>\n<p>这意味着，如果应用已经存在于用户目录中，如果用户选择 '继续移动'，则该功能将继续其默认行为，现有应用将被丢弃，当前应用将移动到其位置。</p>\n<h3 id=\"appissecurekeyboardentryenabled-macos\"><a href=\"#appissecurekeyboardentryenabled-macos\"><code>app.isSecureKeyboardEntryEnabled()</code> <em>macOS</em></a></h3>\n<p>返回 <code>Boolean</code> - 是否启用 <code>Secure Keyboard Entry</code> 。</p>\n<p>默认情况下，此 API 将返回 <code>false</code>。</p>\n<h3 id=\"appsetsecurekeyboardentryenabledenabled-macos\"><a href=\"#appsetsecurekeyboardentryenabledenabled-macos\"><code>app.setSecureKeyboardEntryEnabled(enabled)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>enabled</code> Boolean - 启用或禁用 <code>Secure Keyboard Entry</code></li>\n</ul>\n<p>在应用中启用 <code>Secure Keyboard Entry</code> 。</p>\n<p>通过使用此 API，可以防止密码和其他敏感信息等重要信息被其他进程截获。</p>\n<p>有关更多详细信息，请参阅<a href=\"https://developer.apple.com/library/archive/technotes/tn2150/_index.html\"> apple 文档 </a>。</p>\n<p><strong>注意：</strong> 仅在需要时启用 <code>Secure Keyboard Entry</code> ，并在不再需要时禁用。</p>\n<h2 id=\"属性\"><a href=\"#属性\">属性</a></h2>\n<h3 id=\"appaccessibilitysupportenabled-macos-windows\"><a href=\"#appaccessibilitysupportenabled-macos-windows\"><code>app.accessibilitySupportEnabled</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p><code>Boolean</code>属性 - 如果开启了Chrome的辅助功能，则返回 <code>true</code>，否则返回<code>false</code>。 如果使用了辅助功能（例如屏幕阅读），该 API 将返回 <code>true</code>。 手动将此属性设置为 <code>true</code> 可启用 Chrome 的辅助功能支持，允许开发人员在应用程序设置中向用户开放无障碍切换。</p>\n<p>有关详细信息，请参阅<a href=\"https://www.chromium.org/developers/design-documents/accessibility\"> chromium 的无障碍文档 </a>。 默认为禁用</p>\n<p>此 API 必须在 <code>ready</code> 事件触发后调用</p>\n<p><strong>注意：</strong> 渲染访问权限树可能会严重影响您应用的性能。 默认情况下不应启用该功能。</p>\n<h3 id=\"appapplicationmenu\"><a href=\"#appapplicationmenu\"><code>app.applicationMenu</code></a></h3>\n<p><code>Menu | null</code> 属性，如果设置 <a href=\"/docs/api/menu\"><code>Menu</code></a> ，则返回，否则返回 <code>null</code> 。 用户可以传递 <a href=\"/docs/api/menu\">Menu</a> 来给此属性赋值。</p>\n<h3 id=\"appbadgecount-linux-macos\"><a href=\"#appbadgecount-linux-macos\"><code>app.badgeCount</code> <em>Linux</em> <em>macOS</em></a></h3>\n<p>返回当前应用角标计数的 <code>Integer</code> 属性。 将计数设置为 <code>0</code> 将隐藏角标。</p>\n<p>在 macOS 上，为该属性设置任何非零整数，会显示在dock 图标上。 在 Linux 上，这个属性只适用于 Unity 启动器。</p>\n<p><strong>注意：</strong> Unity 启动器需要一个 <code>.desktop</code> 文件才能工作。 欲了解更多信息， 请阅读 <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Unity integration 文档</a>。</p>\n<p><strong>注意：</strong> 在 macOS 上，为了使该属性生效，您需要确保您的应用程序具有显示通知的权限。</p>\n<h3 id=\"appcommandline-只读\"><a href=\"#appcommandline-只读\"><code>app.commandLine</code> <em>只读</em></a></h3>\n<p><a href=\"/docs/api/command-line\"><code>CommandLine</code></a> 对象，允许您读取和操作 Chromium 使用的命令行参数。</p>\n<h3 id=\"appdock-macos-只读\"><a href=\"#appdock-macos-只读\"><code>app.dock</code> <em>macOS</em> <em>只读</em></a></h3>\n<p><a href=\"/docs/api/dock\"><code>Dock</code></a> <code>| undefined</code> 对象，允许您在 macOS 上的用户dock中对应用图标进行操作。</p>\n<h3 id=\"appispackaged-只读\"><a href=\"#appispackaged-只读\"><code>app.isPackaged</code> <em>只读</em></a></h3>\n<p>返回一个<code>Boolean</code>值，如果应用已经打包，返回<code>true</code> ，否则返回<code>false</code> 。 对于大多数应用程序，此属性可用于区分开发和生产环境。</p>\n<h3 id=\"appname\"><a href=\"#appname\"><code>app.name</code></a></h3>\n<p><code>String</code> 属性，指明当前应用程序的名称，即应用程序 <code>package.json</code> 文件中的名称。</p>\n<p>根据 npm 的命名规则, 通常 <code>package.json</code> 中的 <code>name</code> 字段是一个短的小写字符串。 通常还应该指定一个 <code>productName</code> 字段, 是首字母大写的完整名称，用于表示应用程序的名称。Electron 会优先使用这个字段作为应用名。</p>\n<h3 id=\"appuseragentfallback\"><a href=\"#appuseragentfallback\"><code>app.userAgentFallback</code></a></h3>\n<p><code>String</code> Electron 用于全局回退的用户代理字符串。</p>\n<p>当用户代理在<code>webContents</code> 或 <code>session</code> 级别没有被设置时，将使用此用户代理。  有助于确保您的整个应用程序具有相同的用户代理。  在应用初始化中尽早设置为自定义值，以确保使用的是您覆盖的值。</p>\n<h3 id=\"apprunningunderrosettatranslation-macos-readonly-deprecated\"><a href=\"#apprunningunderrosettatranslation-macos-readonly-deprecated\"><code>app.runningUnderRosettaTranslation</code> <em>macOS</em> <em>Readonly</em> <em>Deprecated</em></a></h3>\n<p><code>Boolean</code> ，为 <code>true</code> 表明该应用程序目前正在运行在<a href=\"https://en.wikipedia.org/wiki/Rosetta_(software)\">转译环境</a>下。</p>\n<p>您可以使用此属性来提示用户下载应用程序的 arm64 版本，当用户错误地在转译环境下运行 x64 版本。</p>\n<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>\n<h3 id=\"apprunningunderarm64translation-readonly-macos-windows\"><a href=\"#apprunningunderarm64translation-readonly-macos-windows\"><code>app.runningUnderARM64Translation</code> <em>Readonly</em> <em>macOS</em> <em>Windows</em></a></h3>\n<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://en.wikipedia.org/wiki/Rosetta_(software)\">Rosetta Translator Environment</a> or Windows <a href=\"https://en.wikipedia.org/wiki/Windows_on_Windows\">WOW</a>).</p>\n<p>您可以使用此属性来提示用户下载应用程序的 arm64 版本，当用户错误地在转译环境下运行 x64 版本。</p>",
      "title": "app",
      "description": "控制应用程序的事件生命周期。"
    },
    "/docs/tutorial/application-debugging": {
      "locale": "zh-CN",
      "slug": "application-debugging",
      "href": "/docs/tutorial/application-debugging",
      "crowdinFileId": "256175",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/application-debugging.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"调试应用\"><a href=\"#调试应用\">调试应用</a></h1>\n<p>无论何时，您的Electron应用程序没有按照您设想的方式运行，一组调试工具也许可以帮助您找到代码的错误，性能瓶颈，或者优化的机会。</p>\n<h2 id=\"渲染进程\"><a href=\"#渲染进程\">渲染进程</a></h2>\n<p>最广泛使用来调试指定渲染进程的工具是Chromium的开发者工具集。 它可以获取到所有的渲染进程，包括<code>BrowserWindow</code>的实例，<code>BrowserView</code>以及<code>WebView</code>。 您可以通过编程的方式在BrowserWindow的<code>webContents</code>中调用<code>openDevTool()</code>API来打开它们：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.openDevTools()\n</code></pre>\n<p>谷歌为他们的开发者工具提供了<a href=\"https://developer.chrome.com/devtools\">杰出的文档</a>。 我们建议您熟悉它们，它们对于任何Electron开发者来说通常都是工具包中最强大的工具之一。</p>\n<h2 id=\"主进程\"><a href=\"#主进程\">主进程</a></h2>\n<p>调试主进程有点棘手, 因为您不能简单地打开开发者工具来调试它们。 多亏了谷歌和Node.js的紧密合作，Chromium开发者工具可以<a href=\"https://nodejs.org/en/docs/inspector/\">被用来调试Electron的主进程</a>，否则你也许会遇到许多怪事就像<code>require</code>不能再控制台中显示。</p>\n<p>如果想获取更多信息，可以看<a href=\"/docs/tutorial/debugging-main-process\">调试主进程的文档</a></p>\n<h2 id=\"v8-crashes\"><a href=\"#v8-crashes\">V8 Crashes</a></h2>\n<p>如果V8环境崩溃的话, DevTools 将显示以下信息</p>\n<p><code>DevTools was disconnected from the page. Once page is reloaded, DevTools will automatically reconnect.</code></p>\n<p>Chromium日志可以通过<code>ELECTRON_ENABLE_LOGGING</code>环境变量启用。 有关更多信息，请参见<a href=\"/docs/api/environment-variables#electron_enable_logging\">环境变量文档</a>。</p>\n<p>或者，可以传递命令行参数<code>--enable-logging</code>。 更多信息请查看<a href=\"/docs/api/command-line-switches#--enable-loggingfile\">命令行开关文档</a></p>",
      "title": "调试应用",
      "description": ""
    },
    "/docs/tutorial/application-distribution": {
      "locale": "zh-CN",
      "slug": "application-distribution",
      "href": "/docs/tutorial/application-distribution",
      "crowdinFileId": "256177",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/application-distribution.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"应用部署\"><a href=\"#应用部署\">应用部署</a></h1>\n<h2 id=\"概览\"><a href=\"#概览\">概览</a></h2>\n<p>To distribute your app with Electron, you need to package and rebrand it. 为此，您可以使用专用工具或手动方法。</p>\n<h2 id=\"专用工具\"><a href=\"#专用工具\">专用工具</a></h2>\n<p>您可以使用以下工具来分发您的应用程序：</p>\n<ul>\n<li><a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a></li>\n<li><a href=\"https://github.com/electron-userland/electron-builder\">electron-builder</a></li>\n<li><a href=\"https://github.com/electron/electron-packager\">electron-packager</a></li>\n</ul>\n<p>这些工具将自动进行所有的步骤，例如，打包您的应用程序，重组可执行文件，并设置正确的图标。</p>\n<p>您可以查看 <a href=\"/docs/tutorial/quick-start#package-and-distribute-your-application\">快速上手指南</a> 中如何用 <code>electron-forge</code> 打包您的应用程序的例子。</p>\n<h2 id=\"手动发布\"><a href=\"#手动发布\">手动发布</a></h2>\n<h3 id=\"with-prebuilt-binaries\"><a href=\"#with-prebuilt-binaries\">With prebuilt binaries</a></h3>\n<p>To distribute your app manually, you need to download Electron's <a href=\"https://github.com/electron/electron/releases\">prebuilt binaries</a>. 接下来，你存放应用程序的文件夹需要叫做 <code>app</code> 并且需要放在 Electron 的 资源文件夹Resources下，如下面的示例所示。</p>\n<blockquote>\n<p><em>NOTE:</em> the location of Electron's prebuilt binaries is indicated with <code>electron/</code> in the examples below.</p>\n</blockquote>\n<p><em>在 macOS 中:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/Electron.app/Contents/Resources/app/\n├── package.json\n├── main.js\n└── index.html\n</code></pre>\n<p><em>在 Windows 和 Linux 中:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/resources/app\n├── package.json\n├── main.js\n└── index.html\n</code></pre>\n<p>Then execute <code>Electron.app</code> on macOS, <code>electron</code> on Linux, or <code>electron.exe</code> on Windows, and Electron will start as your app. The <code>electron</code> directory will then be your distribution to deliver to users.</p>\n<h3 id=\"with-an-app-source-code-archive\"><a href=\"#with-an-app-source-code-archive\">With an app source code archive</a></h3>\n<p>Instead of from shipping your app by copying all of its source files, you can package your app into an <a href=\"https://github.com/electron/asar\">asar</a> archive to improve the performance of reading files on platforms like Windows, if you are not already using a bundler such as Parcel or Webpack.</p>\n<p>为了使用一个 <code>asar</code> 档案文件代替 <code>app</code> 文件夹，你需要修改这个档案文件的名字为 <code>app.asar</code> ， 然后将其放到 Electron 的资源文件夹下，然后 Electron 就会试图读取这个档案文件并从中启动。 如下所示：</p>\n<p><em>在 macOS 中:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/Electron.app/Contents/Resources/\n└── app.asar\n</code></pre>\n<p><em>在 Windows 和 Linux 中:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/resources/\n└── app.asar\n</code></pre>\n<p>You can find more details on how to use <code>asar</code> in the <a href=\"https://github.com/electron/asar\"><code>electron/asar</code> repository</a>.</p>\n<h3 id=\"rebranding-with-downloaded-binaries\"><a href=\"#rebranding-with-downloaded-binaries\">Rebranding with downloaded binaries</a></h3>\n<p>将您的应用程序捆绑到Electron后，您可能需要在把应用分发给用户前将Electron进行重新定制</p>\n<h4 id=\"macos\"><a href=\"#macos\">macOS</a></h4>\n<p>你可以将 <code>Electron.app</code> 重命名为任意你喜欢的名字，然后你也需要将一些文件中的 <code>CFBundleDisplayName</code>， <code>CFBundleIdentifier</code> 以及 <code>CFBundleName</code> 字段一并修改掉。 这些文件如下：</p>\n<ul>\n<li><code>Electron.app/Contents/Info.plist</code></li>\n<li><code>Electron.app/Contents/Frameworks/Electron Helper.app/Contents/Info.plist</code></li>\n</ul>\n<p>你也可以重命名帮助程序以避免它在系统活动监视器中显示为<code>Electron Helper</code>， 但是请确保你已经修改了帮助应用的可执行文件的名字。</p>\n<p>一个重命名后的应用程序的结构可能是这样的</p>\n<pre><code class=\"hljs language-plaintext\">MyApp.app/Contents\n├── Info.plist\n├── MacOS/\n│   └── MyApp\n└── Frameworks/\n    └── MyApp Helper.app\n        ├── Info.plist\n        └── MacOS/\n            └── MyApp Helper\n</code></pre>\n<h4 id=\"windows\"><a href=\"#windows\">Windows</a></h4>\n<p>你可以将 <code>electron.exe</code> 重命名为任何你喜欢的名字，然后可以使用像 <a href=\"https://github.com/electron/rcedit\">rcedit</a> 那样的工具编辑它的 icon 和其他信息。</p>\n<h4 id=\"linux\"><a href=\"#linux\">Linux</a></h4>\n<p>你可以将 <code>electron</code> 重命名为任意你喜欢的名字。</p>\n<h3 id=\"rebranding-by-rebuilding-electron-from-source\"><a href=\"#rebranding-by-rebuilding-electron-from-source\">Rebranding by rebuilding Electron from source</a></h3>\n<p>你也可以通过改变产品名称后从源码构建来重塑Electron的形象。 你只需要在 <code>args.gn</code> 文件中将构建参数设置为对应产品的名称(<code>electron_product_name = \"YourProductName\"</code>)，并进行重新构建。</p>",
      "title": "应用部署",
      "description": "NOTE: the location of Electron's prebuilt binaries is indicated with electron/ in the examples below."
    },
    "/docs/api/auto-updater": {
      "locale": "zh-CN",
      "slug": "auto-updater",
      "href": "/docs/api/auto-updater",
      "crowdinFileId": "256281",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/auto-updater.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"autoupdater\"><a href=\"#autoupdater\">autoUpdater</a></h1>\n<blockquote>\n<p>使应用程序能够自动更新</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p><strong>请参阅：在应用程序中如何实现更新的详细指南。</strong></p>\n<p><code>autoUpdater</code>是一个<a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h2 id=\"跨平台提醒\"><a href=\"#跨平台提醒\">跨平台提醒</a></h2>\n<p>目前只支持 macOS 和 Windows 版本。 在 Linux 上没有内置的自动更新程序，因此建议使用发行版包管理器来更新您的应用程序。</p>\n<p>此外，每个平台都有一些细微的差别:</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>在macOS上, <code>autoUpdater</code>模块建立在 <a href=\"https://github.com/Squirrel/Squirrel.Mac\">Squirrel.Mac</a>上,这意味着你不需要任何特殊的设置来使它工作。 对于服务器端要求, 你可以阅读 <a href=\"https://github.com/Squirrel/Squirrel.Mac#server-support\">Server Support</a>. 注意<a href=\"https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW35\">App Transport Security</a> (ATS) 适用于所有请求作为更新过程的一部分。&#x3C;/0> 如需禁用ATS的应用程序可以在其应用程序的plist中添加 <code>NSAllowsArbitraryLoads</code>属性。</p>\n<p><strong>注意：</strong> 在 macOS 上，您的应用程序必须得到签名后方可自动更新。 这是 <code>Squirrel.Mac</code> 的要求。</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<p>在 Windows 上, 你必须将应用程序安装在用户的计算机上才能使用<code>autoUpdater</code>, 所以推荐使用 <a href=\"https://github.com/electron/windows-installer\">electron-winstaller</a>, <a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a> 或者 <a href=\"https://github.com/electron/grunt-electron-installer\">grunt-electron-installer</a> 模块来生成Windows安装程序。</p>\n<p>当使用 <a href=\"https://github.com/electron/windows-installer\">electron-winstaller</a> 或 <a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a> 时，请确保不要在<a href=\"https://github.com/electron/windows-installer#handling-squirrel-events\">第一次运行</a>你的应用程序时进行更新操作(也可查看这个 <a href=\"https://github.com/electron/electron/issues/7155\">issue获取更多信息</a>)。 还建议使用 <a href=\"https://github.com/mongodb-js/electron-squirrel-startup\">electron-squirrel-startup</a> 来创建应用程序的桌面快捷方式。</p>\n<p>使用Squirrel生成的安装程序将以 <code>com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE</code> 的格式创建一个带有 <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> 的快捷图标，例子是 <code>com.squirrel.slack.Slack</code> 和 <code>com.squirrel.code.Code</code>。 你应该在自己的应用中使用 <code>app.setAppUserModelId</code> API 方法设置相同的 API和ID，不然 Windows 将不能正确地把你的应用固定在任务栏上。</p>\n<p>Like Squirrel.Mac, Windows can host updates on S3 or any other static file host. 你可以阅读 <a href=\"https://github.com/Squirrel/Squirrel.Windows\">Squirrel.Windows</a>的文档来获得更多关于 Squirrel.Windows 是如何工作的信息。</p>\n<h2 id=\"事件\"><a href=\"#事件\">事件</a></h2>\n<p><code>autoUpdater</code> 对象会触发以下的事件:</p>\n<h3 id=\"event-error\"><a href=\"#event-error\">Event: 'error'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>error</code> Error</li>\n</ul>\n<p>当更新发生错误的时候触发。</p>\n<h3 id=\"event-checking-for-update\"><a href=\"#event-checking-for-update\">Event: 'checking-for-update'</a></h3>\n<p>当开始检查更新的时候触发。</p>\n<h3 id=\"event-update-available\"><a href=\"#event-update-available\">Event: 'update-available'</a></h3>\n<p>当有可用更新的时候触发。 更新将自动下载。</p>\n<h3 id=\"event-update-not-available\"><a href=\"#event-update-not-available\">Event: 'update-not-available'</a></h3>\n<p>当没有可用更新的时候触发。</p>\n<h3 id=\"event-update-downloaded\"><a href=\"#event-update-downloaded\">Event: 'update-downloaded'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>releaseNotes</code> String</li>\n<li><code>releaseName</code> String</li>\n<li><code>releaseDate</code> Date</li>\n<li><code>updateURL</code> String</li>\n</ul>\n<p>在更新下载完成的时候触发。</p>\n<p>在 Windows 上只有 <code>releaseName</code> 是有效的。</p>\n<p><strong>注意：</strong> 此事件并不一定需要处理。 成功下载的更新仍将在应用程序下次启动时应用。</p>\n<h3 id=\"event--before-quit-for-update\"><a href=\"#event--before-quit-for-update\">Event:  'before-quit-for-update'</a></h3>\n<p>此事件是在用户调用<code>quitAndInstall()</code>之后发出的。</p>\n<p>当此API被调用时，会在所有窗口关闭之前发出 <code>before-quit</code> 事件。 因此，如果您希望在关闭窗口进程退出之前执行操作，则应该侦听此事件，以及侦听 <code>before-quit</code>。</p>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>autoUpdater</code> 对象具有以下方法:</p>\n<h3 id=\"autoupdatersetfeedurl选项\"><a href=\"#autoupdatersetfeedurl选项\"><code>autoUpdater.setFeedURL(选项)</code></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>url</code> String</li>\n<li><code>headers</code> Record&#x3C;String, String> (可选) <em>macOS</em> - HTTP 请求头。</li>\n<li><code>serverType</code> String(可选) <em>macOS</em> - 可以是<code>json</code> 或者 <code>default</code>,查看 <a href=\"https://github.com/Squirrel/Squirrel.Mac\">Squirrel.Mac</a> 的README文件获取更多详细信息。</li>\n</ul></li>\n</ul>\n<p>设置检查更新的 <code>url</code>，并且初始化自动更新。</p>\n<h3 id=\"autoupdatergetfeedurl\"><a href=\"#autoupdatergetfeedurl\"><code>autoUpdater.getFeedURL()</code></a></h3>\n<p>返回 <code>String</code> - 获取当前更新的 Feed 链接.</p>\n<h3 id=\"autoupdatercheckforupdates\"><a href=\"#autoupdatercheckforupdates\"><code>autoUpdater.checkForUpdates()</code></a></h3>\n<p>询问服务器是否有更新。 在使用此 API 之前，您必须调用<code>setFeedURL</code> 。</p>\n<p><strong>Note:</strong> If an update is available it will be downloaded automatically. Calling <code>autoUpdater.checkForUpdates()</code> twice will download the update two times.</p>\n<h3 id=\"autoupdaterquitandinstall\"><a href=\"#autoupdaterquitandinstall\"><code>autoUpdater.quitAndInstall()</code></a></h3>\n<p>重启应用并在下载后安装更新。 它只应在发出 <code>update-downloaded</code> 后方可被调用。</p>\n<p>在此机制下，调用 <code>autoUpdater.quitAndInstall()</code> 将首先关闭所有应用程序窗口，并且在所有窗口都关闭之后自动调用 <code>app.quit()</code></p>\n<p><strong>注意:</strong> 严格来讲，执行一次自动更新不一定要调用此方法。因为下载更新文件成功之后，下次应用启动的时候会强制更新。</p>",
      "title": "autoUpdater",
      "description": "使应用程序能够自动更新"
    },
    "/docs/tutorial/automated-testing-with-a-custom-driver": {
      "locale": "zh-CN",
      "slug": "automated-testing-with-a-custom-driver",
      "href": "/docs/tutorial/automated-testing-with-a-custom-driver",
      "crowdinFileId": "256179",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/automated-testing-with-a-custom-driver.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"使用自定义驱动程序进行自动化测试\"><a href=\"#使用自定义驱动程序进行自动化测试\">使用自定义驱动程序进行自动化测试</a></h1>\n<p>为Electron应用编写自动测试, 你需要一种 \"驱动\" 应用程序的方法。 <a href=\"https://electronjs.org/spectron\">Spectron</a> is a commonly-used solution which lets you emulate user actions via <a href=\"https://webdriver.io/\">WebDriver</a>. 当然，也可以使用node的内建IPC STDIO来编写自己的自定义驱动。 自定义驱动的优势在于，它往往比Spectron需要更少的开销，并允许你向测试套件公开自定义方法。</p>\n<p>我们将用 Node.js 的 <a href=\"https://nodejs.org/api/child_process.html\">child_process</a> API 来创建一个自定义驱动。 测试套件将生成 Electron 子进程，然后建立一个简单的消息传递协议。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> childProcess = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'child_process'</span>)\n<span class=\"hljs-keyword\">const</span> electronPath = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// spawn the process</span>\n<span class=\"hljs-keyword\">const</span> env = { <span class=\"hljs-comment\">/* ... */</span> }\n<span class=\"hljs-keyword\">const</span> stdio = [<span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'ipc'</span>]\n<span class=\"hljs-keyword\">const</span> appProcess = childProcess.spawn(electronPath, [<span class=\"hljs-string\">'./app'</span>], { stdio, env })\n\n<span class=\"hljs-comment\">// listen for IPC messages from the app</span>\nappProcess.on(<span class=\"hljs-string\">'message'</span>, (msg) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// 向应用发送IPC消息</span>\nappProcess.send({ <span class=\"hljs-attr\">my</span>: <span class=\"hljs-string\">'message'</span> })\n</code></pre>\n<p>在 Electron 应用程序中，您可以侦听消息或者使用 Node.js 的 <a href=\"https://nodejs.org/api/process.html\">process</a> API 发送回复：</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 从测试套件进程侦听IPC消息</span>\nprocess.on(<span class=\"hljs-string\">'message'</span>, (msg) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// 向测试套件进程发送IPC消息</span>\nprocess.send({ <span class=\"hljs-attr\">my</span>: <span class=\"hljs-string\">'message'</span> })\n</code></pre>\n<p>现在，我们可以使用<code>appProcess</code> 对象从测试套件到Electron应用进行通讯。</p>\n<p>为了方便起见，你可能需要封装<code>appProcess</code>到一个驱动对象，以便提供更多高级函数。 下面是一个如何这样做的示例：</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">TestDriver</span> </span>{\n  <span class=\"hljs-keyword\">constructor</span> ({ path, args, env }) {\n    <span class=\"hljs-keyword\">this</span>.rpcCalls = []\n\n    <span class=\"hljs-comment\">// start child process</span>\n    env.APP_TEST_DRIVER = <span class=\"hljs-number\">1</span> <span class=\"hljs-comment\">// let the app know it should listen for messages</span>\n    <span class=\"hljs-keyword\">this</span>.process = childProcess.spawn(path, args, { <span class=\"hljs-attr\">stdio</span>: [<span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'ipc'</span>], env })\n\n    <span class=\"hljs-comment\">// handle rpc responses</span>\n    <span class=\"hljs-keyword\">this</span>.process.on(<span class=\"hljs-string\">'message'</span>, (message) => {\n      <span class=\"hljs-comment\">// pop the handler</span>\n      <span class=\"hljs-keyword\">const</span> rpcCall = <span class=\"hljs-keyword\">this</span>.rpcCalls[message.msgId]\n      <span class=\"hljs-keyword\">if</span> (!rpcCall) <span class=\"hljs-keyword\">return</span>\n      <span class=\"hljs-keyword\">this</span>.rpcCalls[message.msgId] = <span class=\"hljs-literal\">null</span>\n      <span class=\"hljs-comment\">// reject/resolve</span>\n      <span class=\"hljs-keyword\">if</span> (message.reject) rpcCall.reject(message.reject)\n      <span class=\"hljs-keyword\">else</span> rpcCall.resolve(message.resolve)\n    })\n\n    <span class=\"hljs-comment\">// wait for ready</span>\n    <span class=\"hljs-keyword\">this</span>.isReady = <span class=\"hljs-keyword\">this</span>.rpc(<span class=\"hljs-string\">'isReady'</span>).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">err</span>) =></span> {\n      <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Application failed to start'</span>, err)\n      <span class=\"hljs-keyword\">this</span>.stop()\n      process.exit(<span class=\"hljs-number\">1</span>)\n    })\n  }\n\n  <span class=\"hljs-comment\">// simple RPC call</span>\n  <span class=\"hljs-comment\">// to use: driver.rpc('method', 1, 2, 3).then(...)</span>\n  <span class=\"hljs-keyword\">async</span> rpc (cmd, ...args) {\n    <span class=\"hljs-comment\">// send rpc request</span>\n    <span class=\"hljs-keyword\">const</span> msgId = <span class=\"hljs-keyword\">this</span>.rpcCalls.length\n    <span class=\"hljs-keyword\">this</span>.process.send({ msgId, cmd, args })\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\">(<span class=\"hljs-params\">resolve, reject</span>) =></span> <span class=\"hljs-keyword\">this</span>.rpcCalls.push({ resolve, reject }))\n  }\n\n  stop () {\n    <span class=\"hljs-keyword\">this</span>.process.kill()\n  }\n}\n</code></pre>\n<p>在应用中, 你需要为 RPC 回调编写一个简单的处理程序:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">if</span> (process.env.APP_TEST_DRIVER) {\n  process.on(<span class=\"hljs-string\">'message'</span>, onMessage)\n}\n\n<span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">onMessage</span> (<span class=\"hljs-params\">{ msgId, cmd, args }</span>) </span>{\n  <span class=\"hljs-keyword\">let</span> method = METHODS[cmd]\n  <span class=\"hljs-keyword\">if</span> (!method) method = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Invalid method: '</span> + cmd)\n  <span class=\"hljs-keyword\">try</span> {\n    <span class=\"hljs-keyword\">const</span> resolve = <span class=\"hljs-keyword\">await</span> method(...args)\n    process.send({ msgId, resolve })\n  } <span class=\"hljs-keyword\">catch</span> (err) {\n    <span class=\"hljs-keyword\">const</span> reject = {\n      <span class=\"hljs-attr\">message</span>: err.message,\n      <span class=\"hljs-attr\">stack</span>: err.stack,\n      <span class=\"hljs-attr\">name</span>: err.name\n    }\n    process.send({ msgId, reject })\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> METHODS = {\n  isReady () {\n    <span class=\"hljs-comment\">// do any setup needed</span>\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-comment\">// define your RPC-able methods here</span>\n}\n</code></pre>\n<p>然后, 在测试套件中, 可以按如下方式使用测试驱动程序:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> test = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'ava'</span>)\n<span class=\"hljs-keyword\">const</span> electronPath = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> app = <span class=\"hljs-keyword\">new</span> TestDriver({\n  <span class=\"hljs-attr\">path</span>: electronPath,\n  <span class=\"hljs-attr\">args</span>: [<span class=\"hljs-string\">'./app'</span>],\n  <span class=\"hljs-attr\">env</span>: {\n    <span class=\"hljs-attr\">NODE_ENV</span>: <span class=\"hljs-string\">'test'</span>\n  }\n})\ntest.before(<span class=\"hljs-keyword\">async</span> t => {\n  <span class=\"hljs-keyword\">await</span> app.isReady\n})\ntest.after.always(<span class=\"hljs-string\">'cleanup'</span>, <span class=\"hljs-keyword\">async</span> t => {\n  <span class=\"hljs-keyword\">await</span> app.stop()\n})\n</code></pre>",
      "title": "使用自定义驱动程序进行自动化测试",
      "description": ""
    },
    "/docs/development/azure-vm-setup": {
      "locale": "zh-CN",
      "slug": "azure-vm-setup",
      "href": "/docs/development/azure-vm-setup",
      "crowdinFileId": "256129",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/azure-vm-setup.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"更新-appveyor-azure-镜像\"><a href=\"#更新-appveyor-azure-镜像\">更新 Appveyor Azure 镜像</a></h1>\n<p>Windows 上的 Electron CI 使用 AppVeyor, 后者则使用 Azure VM 镜像运行。  有时，由于 Chromium 要求发生变化，这些 VM 镜像需要更新。  为了更新，您将需要 <a href=\"https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6\">PowerShell</a> 和 <a href=\"https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-1.8.0&#x26;viewFallbackFrom=azurermps-6.13.0\">Azure PowerShell 模块</a>。</p>\n<p>Occasionally we need to update these images owing to changes in Chromium or other miscellaneous build requirement changes.</p>\n<p>Example Use Case:\n* 我们需要安装<code>VS15.9</code>或者我们已安装好<code>VS15.7</code>；然后可能会请求我们去更新Azure镜像</p>\n<ol>\n<li>\n<p>Identify the image you wish to modify.</p>\n<ul>\n<li>在 <a href=\"https://github.com/electron/electron/blob/main/appveyor.yml\">appveyor.yml</a>文件中，镜像通过该文件来识别 <em>镜像</em> 配置。<ul>\n<li><em>“images”</em>该命名被对应用来定义云构建，例如：<a href=\"https://windows-ci.electronjs.org/build-clouds/8\">libcc-20 cloud</a></li>\n</ul></li>\n<li>找到你希望去修改构建在云端的镜像并且注意镜像的 <strong>VHD Blob Path</strong>（标签），它是对应键值对的值<ul>\n<li>You will need this URI path to copy into a new image.</li>\n</ul></li>\n<li>同时需要的的存储账号名，在AppVeyor中被标记为 <strong>Disk Storage Account Name</strong></li>\n</ul>\n</li>\n<li>\n<p>Get the Azure storage account key</p>\n<ul>\n<li>Log into Azure using credentials stored in LastPass (under Azure Enterprise) and then find the storage account corresponding to the name found in AppVeyor.<ul>\n<li>Example, for <code>appveyorlibccbuilds</code> <strong>Disk Storage Account Name</strong> you'd look for <code>appveyorlibccbuilds</code> in the list of storage accounts @ Home &#x3C; Storage Accounts<ul>\n<li>Click into it and look for <code>Access Keys</code>, and then you can use any of the keys present in the list.</li>\n</ul></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Get the full virtual machine image URI from Azure</p>\n<ul>\n<li>Navigate to Home &#x3C; Storage Accounts &#x3C; <code>$ACCT_NAME</code> &#x3C; Blobs &#x3C; Images<ul>\n<li>In the following list, look for the VHD path name you got from Appveyor and then click on it.<ul>\n<li>Copy the whole URL from the top of the subsequent window.</li>\n</ul></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Copy the image using the <a href=\"https://github.com/appveyor/ci/blob/master/scripts/enterprise/copy-master-image-azure.ps1\">Copy Master Image PowerShell script</a>.</p>\n<ul>\n<li>It is essential to copy the VM because if you spin up a VM against an image that image cannot at the same time be used by AppVeyor.</li>\n<li>Use the storage account name, key, and URI obtained from Azure to run this script.<ul>\n<li>See Step 3 for URI &#x26; when prompted, press enter to use same storage account as destination.</li>\n<li>Use default destination container name <code>(images)</code></li>\n<li>Also, when naming the copy, use a name that indicates what the new image will contain (if that has changed) and date stamp.<ul>\n<li>Ex. <code>libcc-20core-vs2017-15.9-2019-04-15.vhd</code></li>\n</ul></li>\n</ul></li>\n<li>Go into Azure and get the URI for the newly created image as described in a previous step</li>\n</ul>\n</li>\n<li>\n<p>Spin up a new VM using the <a href=\"https://github.com/appveyor/ci/blob/master/scripts/enterprise/create_master_vm_from_vhd.ps1\">Create Master VM from VHD PowerShell</a>.</p>\n<ul>\n<li>From PowerShell, execute <code>ps1</code> file with <code>./create_master_vm_from_vhd.ps1</code></li>\n<li>You will need the credential information available in the AppVeyor build cloud definition.<ul>\n<li>这包括：<ul>\n<li>客户端 ID</li>\n<li>Client Secret</li>\n<li>Tenant ID</li>\n<li>Subscription ID</li>\n<li>Resource Group</li>\n<li>Virtual Network</li>\n</ul></li>\n</ul></li>\n<li>You will also need to specify<ul>\n<li>Master VM name - just a unique name to identify the temporary VM</li>\n<li>Master VM size - use <code>Standard_F32s_v2</code></li>\n<li>Master VHD URI - use URI obtained @ end of previous step</li>\n<li>Location use <code>East US</code></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Log back into Azure and find the VM you just created in Home &#x3C; Virtual Machines &#x3C; <code>$YOUR_NEW_VM</code></p>\n<ul>\n<li>You can download a RDP (Remote Desktop) file to access the VM.</li>\n</ul>\n</li>\n<li>\n<p>Using Microsoft Remote Desktop, click <code>Connect</code> to connect to the VM.</p>\n<ul>\n<li>Credentials for logging into the VM are found in LastPass under the <code>AppVeyor Enterprise master VM</code> credentials.</li>\n</ul>\n</li>\n<li>\n<p>Modify the VM as required.</p>\n</li>\n<li>\n<p>Shut down the VM and then delete it in Azure.</p>\n</li>\n<li>\n<p>Add the new image to the Appveyor Cloud settings or modify an existing image to point to the new VHD.</p>\n</li>\n</ol>",
      "title": "更新 Appveyor Azure 镜像",
      "description": ""
    },
    "/docs/api/structures/bluetooth-device": {
      "locale": "zh-CN",
      "slug": "bluetooth-device",
      "href": "/docs/api/structures/bluetooth-device",
      "crowdinFileId": "256411",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/bluetooth-device.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"bluetoothdevice-object\"><a href=\"#bluetoothdevice-object\">BluetoothDevice Object</a></h1>\n<ul>\n<li><code>deviceName</code> String</li>\n<li><code>deviceId</code> String</li>\n</ul>",
      "title": "BluetoothDevice Object",
      "description": ""
    },
    "/docs/tutorial/boilerplates-and-clis": {
      "locale": "zh-CN",
      "slug": "boilerplates-and-clis",
      "href": "/docs/tutorial/boilerplates-and-clis",
      "crowdinFileId": "256181",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/boilerplates-and-clis.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"模板和命令行界面\"><a href=\"#模板和命令行界面\">模板和命令行界面</a></h1>\n<p>Electron 的开发并不那么死板. 也就是说, 开发, 编译, 打包, 与发布 Electron 应用程序的方法中, 没有一个是可以称为 \"唯一标准\" 的方法. Electron 的编译和运行时相关额外功能通常可以在 <a href=\"https://www.npmjs.com/search?q=electron\">npm</a> 的独立安装包中找到, 这样开发者就可以根据自己的需求同时编译应用和 build pipeline.</p>\n<p>得益于高度的模块化和扩展性，所有的开发团队，无论大小都可以在整个开发周期中无往不利、所向披靡。 与此同时，对于大多数开发者来说如果能有一款社区驱动的boilerplates或者命令行 工具，无疑会使应用的编译、打包、分发更加简单。</p>\n<h2 id=\"模板与命令行界面\"><a href=\"#模板与命令行界面\">模板与命令行界面</a></h2>\n<p>一个模板就像是一张空白的画布，你可以以它为基础来搭建你的应用。 通常来说，你可以从一个代码仓库克隆一个模板，然后修改成你心仪的样子。</p>\n<p>命令行工具则是在整个开发和分发过程中从另一方面给你提供帮助。 他们更有用，但同时也对代码结构和构建项目有着硬性的要求。 <em>特别是对于初学者来说，命令行工具十分有用。</em></p>\n<h2 id=\"electron-forge\"><a href=\"#electron-forge\">electron-forge</a></h2>\n<p>Electron Forge 是一个用来构建现代化Electron应用的完善的工具。 Electron Forge将多个现有的（ 且有稳定维护的 ）Electron构建工具整合为一个简单易用的工具包，所有人都可以用它来快速地搭建Electron开发环境。</p>\n<p>Forge 始于一个使用了 Webpack 作为打包器的 <a href=\"https://electronforge.io/templates\">a ready-to-use template</a> 模板项目。 该项目包含有一个 typescript 配置的示例，并预置了两个便于定制化的配置文件。 Forge 的一些核心模块来自于上层的 Electron 社区（比如<a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>），因而 Electron 主要维护人员（比如说 Slack）提交的 Electron 更新也会使 Forge 的用户受益。</p>\n<p>关于Forge的更多信息，请查阅<a href=\"https://electronforge.io/\">electronforge.io</a>。</p>\n<h2 id=\"electron-builder\"><a href=\"#electron-builder\">electron-builder</a></h2>\n<p>Electron Builder 是一个完备的Electron应用打包和分发解决方案，它致力于软件开发的集成体验。 <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> 出于简化的目的添加了一个依赖项，可以在内部管理所有更多的要求。</p>\n<p><code>electron-builder</code> 会将Electron维护者使用的模块和功能(例如: auto-updater) 替换为自定义的. Electron Builder打包的应用内组件的集成度会更高，同时与主流的Electron应用共同点也就更少了。</p>\n<p>关于Electron Builder的更多信息，请查阅<a href=\"https://github.com/electron-userland/electron-builder\">代码仓库</a>。</p>\n<h2 id=\"electron-react-boilerplate\"><a href=\"#electron-react-boilerplate\">electron-react-boilerplate</a></h2>\n<p>如果你不希望任何工具，而想要简单地从一个模板开始构建，CT Lin的 <a href=\"https://github.com/chentsulin/electron-react-boilerplate\"><code>electron-react-boilerplate</code></a> 可能值得一看。 它在社区中很受欢迎，并在内部使用了 <code>electron-builder</code>。</p>\n<h2 id=\"其它工具和模板\"><a href=\"#其它工具和模板\">其它工具和模板</a></h2>\n<p><a href=\"https://github.com/sindresorhus/awesome-electron#boilerplates\">\"Awesome Electron\" 列表</a>涵盖了众多可供选择的工具和模板。 如果您发现列表的长度令人畏惧，请不要忘记，您也可以在开发过程中逐渐添加工具。</p>",
      "title": "模板和命令行界面",
      "description": ""
    },
    "/docs/breaking-changes": {
      "locale": "zh-CN",
      "slug": "breaking-changes",
      "href": "/docs/breaking-changes",
      "crowdinFileId": "256117",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/breaking-changes.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"重大更改\"><a href=\"#重大更改\">重大更改</a></h1>\n<p>这里将记录重大更改,并在可能的情况下向JS代码添加弃用警告,在这更改之前至少会有<a href=\"/docs/tutorial/electron-versioning#semver\">一个重要版本</a>.</p>\n<h3 id=\"重大更改的类型\"><a href=\"#重大更改的类型\">重大更改的类型</a></h3>\n<p>本文档使用以下约定对重大更改进行分类：</p>\n<ul>\n<li><strong>API 更改：</strong>已更改的 API 会以某种方式使未更新的代码必定抛出异常。</li>\n<li><strong>行为改变：</strong>Electron 的行为已经改变，但并不一定抛出相应的异常。</li>\n<li><strong>默认值更改：</strong>依赖于默认值的代码的行为可能被破坏，但不保证会抛出相应的异常。 您可以通过显式指定该值的方式恢复旧的默认行为。</li>\n<li><strong>已废弃：</strong>该 API 已标记为废弃。 该 API 依旧可正常运作，但会抛出已废弃警告，并在将来会移除。</li>\n<li><strong>已移除：</strong>该 API 或功能已移除，Electron团队不再对此提供支持。</li>\n</ul>\n<h2 id=\"计划重写的-api-140\"><a href=\"#计划重写的-api-140\">计划重写的 API (14.0)</a></h2>\n<h3 id=\"removed-remote-module\"><a href=\"#removed-remote-module\">Removed: <code>remote</code> module</a></h3>\n<p>The <code>remote</code> module was deprecated in Electron 12, and will be removed in Electron 14. 由<a href=\"https://github.com/electron/remote\"><code>@electronic/remote</code></a> 模块替代。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 12:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 替换为：</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote'</span>)\n\n<span class=\"hljs-comment\">// 在主进程中：</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote/main'</span>).initialize()\n</code></pre>\n<h3 id=\"已移除：-appallowrendererprocessreuse\"><a href=\"#已移除：-appallowrendererprocessreuse\">已移除： <code>app.allowRendererProcessReuse</code></a></h3>\n<p>The <code>app.allowRendererProcessReuse</code> property will be removed as part of our plan to more closely align with Chromium's process model for security, performance and maintainability.</p>\n<p>For more detailed information see <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"removed-browser-window-affinity\"><a href=\"#removed-browser-window-affinity\">Removed: Browser Window Affinity</a></h3>\n<p>The <code>affinity</code> option when constructing a new <code>BrowserWindow</code> will be removed as part of our plan to more closely align with Chromium's process model for security, performance and maintainability.</p>\n<p>For more detailed information see <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"api-更改：-windowopen\"><a href=\"#api-更改：-windowopen\">API 更改： <code>window.open()</code></a></h3>\n<p>可选参数 <code>frameName</code> 将不再设置窗口的标题。 该功能现在遵循 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters\">原生文档</a> 中的约束，由名为 <code>windowName</code> 的参数控制。</p>\n<p>若您之前使用了该参数用于设置窗口标题，您可以转而使用 <a href=\"/docs/api/browser-window#winsettitletitle\">win.setTitle(title)</a>。</p>\n<h3 id=\"已移除：-worldsafeexecutejavascript\"><a href=\"#已移除：-worldsafeexecutejavascript\">已移除： <code>worldSafeExecuteJavaScript</code></a></h3>\n<p>在 Electron 14, <code>worldSafeExecuteJavaScript</code> 将被移除。  除此之外没有其他方式，请保证您的代码中包含该属性。  Electron 12中默认启用该属性。\n12.</p>\n<p>若您使用了 <code>webFrame.executeJavaScript</code> 或 <code>webFrame.executeJavaScriptInIsolatedWorld</code>，这个改动会对您造成影响。 您需要保证 <a href=\"/docs/api/context-bridge#parameter--error--return-type-support\">Context Bridge API</a> 支持这些方法的返回值，因为这些方法使用相同的值传递语义。</p>\n<h3 id=\"默认更改：-nativewindowopen-默认为-true\"><a href=\"#默认更改：-nativewindowopen-默认为-true\">默认更改： <code>nativeWindowOpen</code> 默认为 <code>true</code></a></h3>\n<p>Prior to Electron 14, <code>window.open</code> was by default shimmed to use <code>BrowserWindowProxy</code>. This meant that <code>window.open('about:blank')</code> did not work to open synchronously scriptable child windows, among other incompatibilities. <code>nativeWindowOpen</code> is no longer experimental, and is now the default.</p>\n<p>See the documentation for <a href=\"/docs/api/window-open\">window.open in Electron</a> for more details.</p>\n<h3 id=\"removed-browserwindowconstructoroptions-inheriting-from-parent-windows\"><a href=\"#removed-browserwindowconstructoroptions-inheriting-from-parent-windows\">Removed: BrowserWindowConstructorOptions inheriting from parent windows</a></h3>\n<p>Prior to Electron 14, windows opened with <code>window.open</code> would inherit BrowserWindow constructor options such as <code>transparent</code> and <code>resizable</code> from their parent window. Beginning with Electron 14, this behavior is removed, and windows will not inherit any BrowserWindow constructor options from their parents.</p>\n<p>Instead, explicitly set options for the new window with <code>setWindowOpenHandler</code>:</p>\n<pre><code class=\"hljs language-js\">webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n  <span class=\"hljs-keyword\">return</span> {\n    <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span>,\n    <span class=\"hljs-attr\">overrideBrowserWindowOptions</span>: {\n      <span class=\"hljs-comment\">// ...</span>\n    }\n  }\n})\n</code></pre>\n<h3 id=\"已移除：-additionalfeatures\"><a href=\"#已移除：-additionalfeatures\">已移除： <code>additionalFeatures</code></a></h3>\n<p>The deprecated <code>additionalFeatures</code> property in the <code>new-window</code> and <code>did-create-window</code> events of WebContents has been removed. Since <code>new-window</code> uses positional arguments, the argument is still present, but will always be the empty array <code>[]</code>. (Though note, the <code>new-window</code> event itself is deprecated, and is replaced by <code>setWindowOpenHandler</code>.) Bare keys in window features will now present as keys with the value <code>true</code> in the options object.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 14</span>\n<span class=\"hljs-comment\">// Triggered by window.open('...', '', 'my-key')</span>\nwebContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (<span class=\"hljs-built_in\">window</span>, details) => {\n  <span class=\"hljs-keyword\">if</span> (details.additionalFeatures.includes(<span class=\"hljs-string\">'my-key'</span>)) {\n    <span class=\"hljs-comment\">// ...</span>\n  }\n})\n\n<span class=\"hljs-comment\">// Replace with</span>\nwebContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (<span class=\"hljs-built_in\">window</span>, details) => {\n  <span class=\"hljs-keyword\">if</span> (details.options[<span class=\"hljs-string\">'my-key'</span>]) {\n    <span class=\"hljs-comment\">// ...</span>\n  }\n})\n</code></pre>\n<h2 id=\"计划重写的-api-130\"><a href=\"#计划重写的-api-130\">计划重写的 API (13.0)</a></h2>\n<h3 id=\"api-更改：-sessionsetpermissioncheckhandlerhandler\"><a href=\"#api-更改：-sessionsetpermissioncheckhandlerhandler\">API 更改： <code>session.setPermissionCheckHandler(handler)</code></a></h3>\n<p><code>handler</code> 方法的第一个参数曾是 <code>webContents</code>，但现在可以为 <code>null</code>。  为正确响应权限检查，您需要使用<code>requestingOrigin</code>、<code>embeddingOrigin</code> 和 <code>securityOrigin</code> 这些属性。  因为 <code>webContents</code> 现在可能为 <code>null</code>，您不应当依赖此参数。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 旧代码</span>\nsession.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (webContents.getURL().startsWith(<span class=\"hljs-string\">'https://google.com/'</span>) &#x26;&#x26; permission === <span class=\"hljs-string\">'notification'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n\n<span class=\"hljs-comment\">// 变更为</span>\nsession.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(requestingOrigin).hostname === <span class=\"hljs-string\">'google.com'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notification'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n</code></pre>\n<h3 id=\"已移除：-shellmoveitemtotrash\"><a href=\"#已移除：-shellmoveitemtotrash\">已移除： <code>shell.moveItemToTrash()</code></a></h3>\n<p>已废弃的同步方法 <code>shell.moveItemToTrash()</code> 已移除。 作为替代，您应当使用异步的 <code>shell.trashItem()</code>。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 在 Electron 13 移除</span>\nshell.moveItemToTrash(path)\n<span class=\"hljs-comment\">// 替换为</span>\nshell.trashItem(path).then(<span class=\"hljs-comment\">/* ... */</span>)\n</code></pre>\n<h3 id=\"已移除：-browserwindow-扩展-api\"><a href=\"#已移除：-browserwindow-扩展-api\">已移除： <code>BrowserWindow</code> 扩展 API</a></h3>\n<p>移除已弃用的扩展 API：</p>\n<ul>\n<li><code>BrowserWindow.addExtension(path)</code></li>\n<li><code>BrowserWindow.addDevToolsExtension(path)</code></li>\n<li><code>BrowserWindow.removeExtension(name)</code></li>\n<li><code>BrowserWindow.removeDevToolsExtension(name)</code></li>\n<li><code>BrowserWindow.getExtensions()</code></li>\n<li><code>BrowserWindow.getDevToolsExtensions()</code></li>\n</ul>\n<p>改为使用 session API：</p>\n<ul>\n<li><code>ses.loadExtension(path)</code></li>\n<li><code>ses.removeExtension(extension_id)</code></li>\n<li><code>ses.getAllExtensions()</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 在 Electron 13 移除</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// 替换为</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 在 Electron 13 移除</span>\nBrowserWindow.removeExtension(name)\nBrowserWindow.removeDevToolsExtension(name)\n<span class=\"hljs-comment\">// 替换为</span>\nsession.defaultSession.removeExtension(extension_id)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 在 Electron 13 移除</span>\nBrowserWindow.getExtensions()\nBrowserWindow.getDevToolsExtensions()\n<span class=\"hljs-comment\">// 替换为</span>\nsession.defaultSession.getAllExtensions()\n</code></pre>\n<h3 id=\"已移除：-systempreferences-中的方法\"><a href=\"#已移除：-systempreferences-中的方法\">已移除： <code>systemPreferences</code> 中的方法</a></h3>\n<p><code>systemPreferences</code> 方法已经被废弃：</p>\n<ul>\n<li><code>systemPreferences.isDarkMode()</code></li>\n<li><code>systemPreferences.isInvertedColorScheme()</code></li>\n<li><code>systemPreferences.isHighContrastColorScheme()</code></li>\n</ul>\n<p>使用 <code>nativeTheme</code> 属性作为替代：</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code></li>\n<li><code>nativeTheme.shouldUseInvertedColorScheme</code></li>\n<li><code>nativeTheme.shouldUseHighContrastColors</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 在 Electron 13 移除</span>\nsystemPreferences.isDarkMode()\n<span class=\"hljs-comment\">// 替换为</span>\nnativeTheme.shouldUseDarkColors\n\n<span class=\"hljs-comment\">// 在 Electron 13 移除</span>\nsystemPreferences.isInvertedColorScheme()\n<span class=\"hljs-comment\">// 替换为</span>\nnativeTheme.shouldUseInvertedColorScheme\n\n<span class=\"hljs-comment\">// 在 Electron 13 移除</span>\nsystemPreferences.isHighContrastColorScheme()\n<span class=\"hljs-comment\">// 替换为</span>\nnativeTheme.shouldUseHighContrastColors\n</code></pre>\n<h3 id=\"已废弃-webcontents-new-window-事件\"><a href=\"#已废弃-webcontents-new-window-事件\">已废弃: WebContents <code>new-window</code> 事件</a></h3>\n<p>WebContents 中的 <code>new-window</code> 事件已经被废弃。 已弃用：<a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler()</code></a>。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 在 Electron 13 废弃</span>\nwebContents.on(<span class=\"hljs-string\">'new-window'</span>, (event) => {\n  event.preventDefault()\n})\n\n<span class=\"hljs-comment\">// 替换为</span>\nwebContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n</code></pre>\n<h2 id=\"计划重写的-api-120\"><a href=\"#计划重写的-api-120\">计划重写的 API (12.0)</a></h2>\n<h3 id=\"已移除：pepper-flash-支持\"><a href=\"#已移除：pepper-flash-支持\">已移除：Pepper Flash 支持</a></h3>\n<p>Chromium 已经取消了对Flash的支持，因此我们必须效仿。 更多详细信息，请参阅 Chromium 的 <a href=\"https://www.chromium.org/flash-roadmap\"> Flash Roadmap</a></p>\n<h3 id=\"默认更改：-worldsafeexecutejavascript-默认为-true\"><a href=\"#默认更改：-worldsafeexecutejavascript-默认为-true\">默认更改： <code>worldSafeExecuteJavaScript</code> 默认为 <code>true</code></a></h3>\n<p>在 Electron 12, <code>worldSafeExecuteJavaScript</code> 将默认启用。  要恢复 上一个行为， <code>worldSafeExecuteJavaScript: false</code> 必须在 Web 首选项中指定。 请注意，设置此选项为 <code>false</code> 是<strong>不安全</strong>的。</p>\n<p>此选项将在 Electron 14 中删除，所以请迁移您的代码以支持默认 值。</p>\n<h3 id=\"默认更改：-contextisolation-默认为-true\"><a href=\"#默认更改：-contextisolation-默认为-true\">默认更改： <code>contextIsolation</code> 默认为 <code>true</code></a></h3>\n<p>在 Electron 12, <code>contextIsolation</code> 将默认启用。  要恢复 上一个行为， <code>contextIsolation: false</code> 必须在 Web 首选项中指定。</p>\n<p>我们 <a href=\"/docs/tutorial/security#3-enable-context-isolation-for-remote-content\">建议启用contextIsolation</a> ，以保证您的应用程序的安全性。</p>\n<p>Another implication is that <code>require()</code> cannot be used in the renderer process unless <code>nodeIntegration</code> is <code>true</code> and <code>contextIsolation</code> is <code>false</code>.</p>\n<p>更多信息请参阅：<a href=\"https://github.com/electron/electron/issues/23506\">https://github.com/electron/electron/issues/23506</a></p>\n<h3 id=\"已移除：-crashreportergetcrashesdirectory\"><a href=\"#已移除：-crashreportergetcrashesdirectory\">已移除： <code>crashReporter.getCrashesDirectory()</code></a></h3>\n<p><code>crashReporter.getCrashesDirectory</code> 方法已被删除。 这个方法 应该被 <code>app.getPath('crashDumps')</code>替换。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 在 Electron 12 移除</span>\ncrashReporter.getCrashesDirectory()\n<span class=\"hljs-comment\">// 替换为</span>\napp.getPath(<span class=\"hljs-string\">'crashDumps'</span>)\n</code></pre>\n<h3 id=\"removed-crashreporter-methods-in-the-renderer-process\"><a href=\"#removed-crashreporter-methods-in-the-renderer-process\">Removed: <code>crashReporter</code> methods in the renderer process</a></h3>\n<p><code>crashReporter</code> 方法在渲染进程中不再能使用：</p>\n<ul>\n<li><code>crashReporter.start</code></li>\n<li><code>crashReporter.getLastCrashReport</code></li>\n<li><code>crashReporter.getUploadedReports</code></li>\n<li><code>crashReporter.getUploadToServer</code></li>\n<li><code>crashReporter.setUploadToServer</code></li>\n<li><code>crashReporter.getCrashesDirectory</code></li>\n</ul>\n<p>它们只应从主要进程中调用。</p>\n<p>更多详细信息请访问 <a href=\"https://github.com/electron/electron/pull/23265\">#23265</a></p>\n<h3 id=\"default-changed-crashreporterstart-compress-true-\"><a href=\"#default-changed-crashreporterstart-compress-true-\">Default Changed: <code>crashReporter.start({ compress: true })</code></a></h3>\n<p>The default value of the <code>compress</code> option to <code>crashReporter.start</code> has changed from <code>false</code> to <code>true</code>. This means that crash dumps will be uploaded to the crash ingestion server with the <code>Content-Encoding: gzip</code> header, and the body will be compressed.</p>\n<p>If your crash ingestion server does not support compressed payloads, you can turn off compression by specifying <code>{ compress: false }</code> in the crash reporter options.</p>\n<h3 id=\"已废弃：-remote-模块\"><a href=\"#已废弃：-remote-模块\">已废弃： <code>remote</code> 模块</a></h3>\n<p><code>remote</code> 模块在 Electron 12 废弃，并将在 Electron 14 被移除 由<a href=\"https://github.com/electron/remote\"><code>@electronic/remote</code></a> 模块替代。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 12:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 替换为：</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote'</span>)\n\n<span class=\"hljs-comment\">// 在主进程中：</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote/main'</span>).initialize()\n</code></pre>\n<h3 id=\"已废弃：shellmoveitemtotrash\"><a href=\"#已废弃：shellmoveitemtotrash\">已废弃：<code>shell.moveItemToTrash()</code></a></h3>\n<p>The synchronous <code>shell.moveItemToTrash()</code> has been replaced by the new, asynchronous <code>shell.trashItem()</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 在 Electron 12 废弃</span>\nshell.moveItemToTrash(path)\n<span class=\"hljs-comment\">// 替换为</span>\nshell.trashItem(path).then(<span class=\"hljs-comment\">/* ... */</span>)\n</code></pre>\n<h2 id=\"计划重写的-api-110\"><a href=\"#计划重写的-api-110\">计划重写的 API (11.0)</a></h2>\n<h3 id=\"removed-browserviewdestroy-fromid-fromwebcontents-getallviews-and-id-property-of-browserview\"><a href=\"#removed-browserviewdestroy-fromid-fromwebcontents-getallviews-and-id-property-of-browserview\">Removed: <code>BrowserView.{destroy, fromId, fromWebContents, getAllViews}</code> and <code>id</code> property of <code>BrowserView</code></a></h3>\n<p>The experimental APIs <code>BrowserView.{destroy, fromId, fromWebContents, getAllViews}</code> have now been removed. Additionally, the <code>id</code> property of <code>BrowserView</code> has also been removed.</p>\n<p>For more detailed information, see <a href=\"https://github.com/electron/electron/pull/23578\">#23578</a>.</p>\n<h2 id=\"计划重写的-api-100\"><a href=\"#计划重写的-api-100\">计划重写的 API (10.0)</a></h2>\n<h3 id=\"deprecated-companyname-argument-to-crashreporterstart\"><a href=\"#deprecated-companyname-argument-to-crashreporterstart\">Deprecated: <code>companyName</code> argument to <code>crashReporter.start()</code></a></h3>\n<p>The <code>companyName</code> argument to <code>crashReporter.start()</code>, which was previously required, is now optional, and further, is deprecated. To get the same behavior in a non-deprecated way, you can pass a <code>companyName</code> value in <code>globalExtra</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 10</span>\ncrashReporter.start({ <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Umbrella Corporation'</span> })\n<span class=\"hljs-comment\">// Replace with</span>\ncrashReporter.start({ <span class=\"hljs-attr\">globalExtra</span>: { <span class=\"hljs-attr\">_companyName</span>: <span class=\"hljs-string\">'Umbrella Corporation'</span> } })\n</code></pre>\n<h3 id=\"已废弃：crashreportergetcrashesdirectory\"><a href=\"#已废弃：crashreportergetcrashesdirectory\">已废弃：<code>crashReporter.getCrashesDirectory()</code></a></h3>\n<p>The <code>crashReporter.getCrashesDirectory</code> method has been deprecated. 这个方法 应该被 <code>app.getPath('crashDumps')</code>替换。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 10</span>\ncrashReporter.getCrashesDirectory()\n<span class=\"hljs-comment\">// Replace with</span>\napp.getPath(<span class=\"hljs-string\">'crashDumps'</span>)\n</code></pre>\n<h3 id=\"已废弃：渲染进程中的-crashreporter-方法\"><a href=\"#已废弃：渲染进程中的-crashreporter-方法\">已废弃：渲染进程中的 <code>crashReporter</code> 方法</a></h3>\n<p>Calling the following <code>crashReporter</code> methods from the renderer process is deprecated:</p>\n<ul>\n<li><code>crashReporter.start</code></li>\n<li><code>crashReporter.getLastCrashReport</code></li>\n<li><code>crashReporter.getUploadedReports</code></li>\n<li><code>crashReporter.getUploadToServer</code></li>\n<li><code>crashReporter.setUploadToServer</code></li>\n<li><code>crashReporter.getCrashesDirectory</code></li>\n</ul>\n<p>The only non-deprecated methods remaining in the <code>crashReporter</code> module in the renderer are <code>addExtraParameter</code>, <code>removeExtraParameter</code> and <code>getParameters</code>.</p>\n<p>当从主要进程调用时，上述所有方法均未被弃用。</p>\n<p>更多详细信息请访问 <a href=\"https://github.com/electron/electron/pull/23265\">#23265</a></p>\n<h3 id=\"已废弃：crashreporterstart-compress-false-\"><a href=\"#已废弃：crashreporterstart-compress-false-\">已废弃：<code>crashReporter.start({ compress: false })</code></a></h3>\n<p>Setting <code>{ compress: false }</code> in <code>crashReporter.start</code> is deprecated. Nearly all crash ingestion servers support gzip compression. 此选项将在未来版本的 Electron 中删除。</p>\n<h3 id=\"默认更改：-enableremotemodule-默认为-false\"><a href=\"#默认更改：-enableremotemodule-默认为-false\">默认更改： <code>enableRemoteModule</code> 默认为 <code>false</code></a></h3>\n<p>In Electron 9, using the remote module without explicitly enabling it via the <code>enableRemoteModule</code> WebPreferences option began emitting a warning. In Electron 10, the remote module is now disabled by default. To use the remote module, <code>enableRemoteModule: true</code> must be specified in WebPreferences:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> w = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">enableRemoteModule</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<p>We <a href=\"https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31\">recommend moving away from the remote module</a>.</p>\n<h3 id=\"protocolunregisterprotocol\"><a href=\"#protocolunregisterprotocol\"><code>protocol.unregisterProtocol</code></a></h3>\n<h3 id=\"protocoluninterceptprotocol\"><a href=\"#protocoluninterceptprotocol\"><code>protocol.uninterceptProtocol</code></a></h3>\n<p>这些 APIs 现在是同步的，不再需要可选的回调。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Deprecated</span>\nprotocol.unregisterProtocol(scheme, () => { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nprotocol.unregisterProtocol(scheme)\n</code></pre>\n<h3 id=\"protocolregisterfileprotocol\"><a href=\"#protocolregisterfileprotocol\"><code>protocol.registerFileProtocol</code></a></h3>\n<h3 id=\"protocolregisterbufferprotocol\"><a href=\"#protocolregisterbufferprotocol\"><code>protocol.registerBufferProtocol</code></a></h3>\n<h3 id=\"protocolregisterstringprotocol\"><a href=\"#protocolregisterstringprotocol\"><code>protocol.registerStringProtocol</code></a></h3>\n<h3 id=\"protocolregisterhttpprotocol\"><a href=\"#protocolregisterhttpprotocol\"><code>protocol.registerHttpProtocol</code></a></h3>\n<h3 id=\"protocolregisterstreamprotocol\"><a href=\"#protocolregisterstreamprotocol\"><code>protocol.registerStreamProtocol</code></a></h3>\n<h3 id=\"protocolinterceptfileprotocol\"><a href=\"#protocolinterceptfileprotocol\"><code>protocol.interceptFileProtocol</code></a></h3>\n<h3 id=\"protocolinterceptstringprotocol\"><a href=\"#protocolinterceptstringprotocol\"><code>protocol.interceptStringProtocol</code></a></h3>\n<h3 id=\"protocolinterceptbufferprotocol\"><a href=\"#protocolinterceptbufferprotocol\"><code>protocol.interceptBufferProtocol</code></a></h3>\n<h3 id=\"protocolintercepthttpprotocol\"><a href=\"#protocolintercepthttpprotocol\"><code>protocol.interceptHttpProtocol</code></a></h3>\n<h3 id=\"protocolinterceptstreamprotocol\"><a href=\"#protocolinterceptstreamprotocol\"><code>protocol.interceptStreamProtocol</code></a></h3>\n<p>这些 APIs 现在是同步的，不再需要可选的回调。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// 已废弃</span>\nprotocol.registerFileProtocol(scheme, handler, () => { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// 替换为</span>\nprotocol.registerFileProtocol(scheme, handler)\n</code></pre>\n<p>The registered or intercepted protocol does not have effect on current page until navigation happens.</p>\n<h3 id=\"protocolisprotocolhandled\"><a href=\"#protocolisprotocolhandled\"><code>protocol.isProtocolHandled</code></a></h3>\n<p>This API is deprecated and users should use <code>protocol.isProtocolRegistered</code> and <code>protocol.isProtocolIntercepted</code> instead.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Deprecated</span>\nprotocol.isProtocolHandled(scheme).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> isRegistered = protocol.isProtocolRegistered(scheme)\n<span class=\"hljs-keyword\">const</span> isIntercepted = protocol.isProtocolIntercepted(scheme)\n</code></pre>\n<h2 id=\"计划重写的-api-90\"><a href=\"#计划重写的-api-90\">计划重写的 API (9.0)</a></h2>\n<h3 id=\"default-changed-loading-non-context-aware-native-modules-in-the-renderer-process-is-disabled-by-default\"><a href=\"#default-changed-loading-non-context-aware-native-modules-in-the-renderer-process-is-disabled-by-default\">Default Changed: Loading non-context-aware native modules in the renderer process is disabled by default</a></h3>\n<p>As of Electron 9 we do not allow loading of non-context-aware native modules in the renderer process.  This is to improve security, performance and maintainability of Electron as a project.</p>\n<p>If this impacts you, you can temporarily set <code>app.allowRendererProcessReuse</code> to <code>false</code> to revert to the old behavior.  This flag will only be an option until Electron 11 so you should plan to update your native modules to be context aware.</p>\n<p>For more detailed information see <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"已废弃：-browserwindow-扩展-api\"><a href=\"#已废弃：-browserwindow-扩展-api\">已废弃： <code>BrowserWindow</code> 扩展 API</a></h3>\n<p>以下扩展 APIs 已废弃:</p>\n<ul>\n<li><code>BrowserWindow.addExtension(path)</code></li>\n<li><code>BrowserWindow.addDevToolsExtension(path)</code></li>\n<li><code>BrowserWindow.removeExtension(name)</code></li>\n<li><code>BrowserWindow.removeDevToolsExtension(name)</code></li>\n<li><code>BrowserWindow.getExtensions()</code></li>\n<li><code>BrowserWindow.getDevToolsExtensions()</code></li>\n</ul>\n<p>改为使用 session API：</p>\n<ul>\n<li><code>ses.loadExtension(path)</code></li>\n<li><code>ses.removeExtension(extension_id)</code></li>\n<li><code>ses.getAllExtensions()</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 在 Electron 9 废弃</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// 替换为</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 在 Electron 9 废弃</span>\nBrowserWindow.removeExtension(name)\nBrowserWindow.removeDevToolsExtension(name)\n<span class=\"hljs-comment\">// 替换为</span>\nsession.defaultSession.removeExtension(extension_id)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 在 Electron 9 废弃</span>\nBrowserWindow.getExtensions()\nBrowserWindow.getDevToolsExtensions()\n<span class=\"hljs-comment\">// 替换为</span>\nsession.defaultSession.getAllExtensions()\n</code></pre>\n<h3 id=\"已移除：-webviewgetwebcontents\"><a href=\"#已移除：-webviewgetwebcontents\">已移除： <code>&#x3C;webview>.getWebContents()</code></a></h3>\n<p>此API在 Electron 8.0中被废弃，现已删除。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 在 Electron 9.0 移除</span>\nwebview.getWebContents()\n<span class=\"hljs-comment\">// 替换为</span>\n<span class=\"hljs-keyword\">const</span> { remote } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nremote.webContents.fromId(webview.getWebContentsId())\n</code></pre>\n<h3 id=\"已移除：-webframesetlayoutzoomlevellimits\"><a href=\"#已移除：-webframesetlayoutzoomlevellimits\">已移除： <code>webFrame.setLayoutZoomLevelLimits()</code></a></h3>\n<p>Chromium has removed support for changing the layout zoom level limits, and it is beyond Electron's capacity to maintain it. 函数在 Electron 8.x 废弃，并将在 Electron 9.x 被移除。 The layout zoom level limits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined <a href=\"https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11\">here</a>.</p>\n<h3 id=\"behavior-changed-sending-non-js-objects-over-ipc-now-throws-an-exception\"><a href=\"#behavior-changed-sending-non-js-objects-over-ipc-now-throws-an-exception\">Behavior Changed: Sending non-JS objects over IPC now throws an exception</a></h3>\n<p>In Electron 8.0, IPC was changed to use the Structured Clone Algorithm, bringing significant performance improvements. To help ease the transition, the old IPC serialization algorithm was kept and used for some objects that aren't serializable with Structured Clone. In particular, DOM objects (e.g. <code>Element</code>, <code>Location</code> and <code>DOMMatrix</code>), Node.js objects backed by C++ classes (e.g. <code>process.env</code>, some members of <code>Stream</code>), and Electron objects backed by C++ classes (e.g. <code>WebContents</code>, <code>BrowserWindow</code> and <code>WebFrame</code>) are not serializable with Structured Clone. Whenever the old algorithm was invoked, a deprecation warning was printed.</p>\n<p>In Electron 9.0, the old serialization algorithm has been removed, and sending such non-serializable objects will now throw an \"object could not be cloned\" error.</p>\n<h3 id=\"api-changed-shellopenitem-is-now-shellopenpath\"><a href=\"#api-changed-shellopenitem-is-now-shellopenpath\">API Changed: <code>shell.openItem</code> is now <code>shell.openPath</code></a></h3>\n<p>The <code>shell.openItem</code> API has been replaced with an asynchronous <code>shell.openPath</code> API. You can see the original API proposal and reasoning <a href=\"https://github.com/electron/governance/blob/main/wg-api/spec-documents/shell-openitem.md\">here</a>.</p>\n<h2 id=\"计划重写的-api-80\"><a href=\"#计划重写的-api-80\">计划重写的 API (8.0)</a></h2>\n<h3 id=\"behavior-changed-values-sent-over-ipc-are-now-serialized-with-structured-clone-algorithm\"><a href=\"#behavior-changed-values-sent-over-ipc-are-now-serialized-with-structured-clone-algorithm\">Behavior Changed: Values sent over IPC are now serialized with Structured Clone Algorithm</a></h3>\n<p>The algorithm used to serialize objects sent over IPC (through <code>ipcRenderer.send</code>, <code>ipcRenderer.sendSync</code>, <code>WebContents.send</code> and related methods) has been switched from a custom algorithm to V8's built-in <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, the same algorithm used to serialize messages for <code>postMessage</code>. This brings about a 2x performance improvement for large messages, but also brings some breaking changes in behavior.</p>\n<ul>\n<li>Sending Functions, Promises, WeakMaps, WeakSets, or objects containing any such values, over IPC will now throw an exception, instead of silently converting the functions to <code>undefined</code>.</li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Previously:</span>\nipcRenderer.send(<span class=\"hljs-string\">'channel'</span>, { <span class=\"hljs-attr\">value</span>: <span class=\"hljs-number\">3</span>, <span class=\"hljs-attr\">someFunction</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {} })\n<span class=\"hljs-comment\">// => results in { value: 3 } arriving in the main process</span>\n\n<span class=\"hljs-comment\">// From Electron 8:</span>\nipcRenderer.send(<span class=\"hljs-string\">'channel'</span>, { <span class=\"hljs-attr\">value</span>: <span class=\"hljs-number\">3</span>, <span class=\"hljs-attr\">someFunction</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {} })\n<span class=\"hljs-comment\">// => throws Error(\"() => {} could not be cloned.\")</span>\n</code></pre>\n<ul>\n<li><code>NaN</code>, <code>Infinity</code> and <code>-Infinity</code> will now be correctly serialized, instead of being converted to <code>null</code>.</li>\n<li>Objects containing cyclic references will now be correctly serialized, instead of being converted to <code>null</code>.</li>\n<li><code>Set</code>, <code>Map</code>, <code>Error</code> and <code>RegExp</code> values will be correctly serialized, instead of being converted to <code>{}</code>.</li>\n<li><code>BigInt</code> values will be correctly serialized, instead of being converted to <code>null</code>.</li>\n<li>Sparse arrays will be serialized as such, instead of being converted to dense arrays with <code>null</code>s.</li>\n<li><code>Date</code> objects will be transferred as <code>Date</code> objects, instead of being converted to their ISO string representation.</li>\n<li>Typed Arrays (such as <code>Uint8Array</code>, <code>Uint16Array</code>, <code>Uint32Array</code> and so on) will be transferred as such, instead of being converted to Node.js <code>Buffer</code>.</li>\n<li>Node.js <code>Buffer</code> objects will be transferred as <code>Uint8Array</code>s. You can convert a <code>Uint8Array</code> back to a Node.js <code>Buffer</code> by wrapping the underlying <code>ArrayBuffer</code>:</li>\n</ul>\n<pre><code class=\"hljs language-js\">Buffer.from(value.buffer, value.byteOffset, value.byteLength)\n</code></pre>\n<p>Sending any objects that aren't native JS types, such as DOM objects (e.g. <code>Element</code>, <code>Location</code>, <code>DOMMatrix</code>), Node.js objects (e.g. <code>process.env</code>, <code>Stream</code>), or Electron objects (e.g. <code>WebContents</code>, <code>BrowserWindow</code>, <code>WebFrame</code>) is deprecated. In Electron 8, these objects will be serialized as before with a DeprecationWarning message, but starting in Electron 9, sending these kinds of objects will throw a 'could not be cloned' error.</p>\n<h3 id=\"已废弃：-webviewgetwebcontents\"><a href=\"#已废弃：-webviewgetwebcontents\">已废弃： <code>&#x3C;webview>.getWebContents()</code></a></h3>\n<p>This API is implemented using the <code>remote</code> module, which has both performance and security implications. Therefore its usage should be explicit.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebview.getWebContents()\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> { remote } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nremote.webContents.fromId(webview.getWebContentsId())\n</code></pre>\n<p>However, it is recommended to avoid using the <code>remote</code> module altogether.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain, webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> getGuestForWebContents = <span class=\"hljs-function\">(<span class=\"hljs-params\">webContentsId, contents</span>) =></span> {\n  <span class=\"hljs-keyword\">const</span> guest = webContents.fromId(webContentsId)\n  <span class=\"hljs-keyword\">if</span> (!guest) {\n    <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">`Invalid webContentsId: <span class=\"hljs-subst\">${webContentsId}</span>`</span>)\n  }\n  <span class=\"hljs-keyword\">if</span> (guest.hostWebContents !== contents) {\n    <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Access denied to webContents'</span>)\n  }\n  <span class=\"hljs-keyword\">return</span> guest\n}\n\nipcMain.handle(<span class=\"hljs-string\">'openDevTools'</span>, (event, webContentsId) => {\n  <span class=\"hljs-keyword\">const</span> guest = getGuestForWebContents(webContentsId, event.sender)\n  guest.openDevTools()\n})\n\n<span class=\"hljs-comment\">// renderer</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nipcRenderer.invoke(<span class=\"hljs-string\">'openDevTools'</span>, webview.getWebContentsId())\n</code></pre>\n<h3 id=\"deprecated-webframesetlayoutzoomlevellimits\"><a href=\"#deprecated-webframesetlayoutzoomlevellimits\">Deprecated: <code>webFrame.setLayoutZoomLevelLimits()</code></a></h3>\n<p>Chromium has removed support for changing the layout zoom level limits, and it is beyond Electron's capacity to maintain it. The function will emit a warning in Electron 8.x, and cease to exist in Electron 9.x. The layout zoom level limits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined <a href=\"https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11\">here</a>.</p>\n<h3 id=\"deprecated-events-in-systempreferences\"><a href=\"#deprecated-events-in-systempreferences\">Deprecated events in <code>systemPreferences</code></a></h3>\n<p>The following <code>systemPreferences</code> events have been deprecated:</p>\n<ul>\n<li><code>inverted-color-scheme-changed</code></li>\n<li><code>high-contrast-color-scheme-changed</code></li>\n</ul>\n<p>Use the new <code>updated</code> event on the <code>nativeTheme</code> module instead.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.on(<span class=\"hljs-string\">'inverted-color-scheme-changed'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\nsystemPreferences.on(<span class=\"hljs-string\">'high-contrast-color-scheme-changed'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\n\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.on(<span class=\"hljs-string\">'updated'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\n</code></pre>\n<h3 id=\"已废弃：systempreferences-中的方法\"><a href=\"#已废弃：systempreferences-中的方法\">已废弃：<code>systemPreferences</code> 中的方法</a></h3>\n<p><code>systemPreferences</code> 方法已经被废弃：</p>\n<ul>\n<li><code>systemPreferences.isDarkMode()</code></li>\n<li><code>systemPreferences.isInvertedColorScheme()</code></li>\n<li><code>systemPreferences.isHighContrastColorScheme()</code></li>\n</ul>\n<p>使用 <code>nativeTheme</code> 属性作为替代：</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code></li>\n<li><code>nativeTheme.shouldUseInvertedColorScheme</code></li>\n<li><code>nativeTheme.shouldUseHighContrastColors</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 已废弃</span>\nsystemPreferences.isDarkMode()\n<span class=\"hljs-comment\">// 替换为</span>\nnativeTheme.shouldUseDarkColors\n\n<span class=\"hljs-comment\">// 已废弃</span>\nsystemPreferences.isInvertedColorScheme()\n<span class=\"hljs-comment\">// 替换为</span>\nnativeTheme.shouldUseInvertedColorScheme\n\n<span class=\"hljs-comment\">// 已废弃</span>\nsystemPreferences.isHighContrastColorScheme()\n<span class=\"hljs-comment\">// 替换为</span>\nnativeTheme.shouldUseHighContrastColors\n</code></pre>\n<h2 id=\"planned-breaking-api-changes-70\"><a href=\"#planned-breaking-api-changes-70\">Planned Breaking API Changes (7.0)</a></h2>\n<h3 id=\"deprecated-atomio-node-headers-url\"><a href=\"#deprecated-atomio-node-headers-url\">Deprecated: Atom.io Node Headers URL</a></h3>\n<p>这是在构建原生 node 模块时在 <code>.npmrc</code> 文件中指定为 <code>disturl</code> 的 url 或是 <code>--dist-url</code> 命令行标志.  Both will be supported for the foreseeable future but it is recommended that you switch.</p>\n<p>Deprecated: <a href=\"https://atom.io/download/electron\">https://atom.io/download/electron</a></p>\n<p>Replace with: <a href=\"https://electronjs.org/headers\">https://electronjs.org/headers</a></p>\n<h3 id=\"api-changed-sessionclearauthcache-no-longer-accepts-options\"><a href=\"#api-changed-sessionclearauthcache-no-longer-accepts-options\">API Changed: <code>session.clearAuthCache()</code> no longer accepts options</a></h3>\n<p>The <code>session.clearAuthCache</code> API no longer accepts options for what to clear, and instead unconditionally clears the whole cache.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nsession.clearAuthCache({ <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'password'</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nsession.clearAuthCache()\n</code></pre>\n<h3 id=\"api-changed-powermonitorquerysystemidlestate-is-now-powermonitorgetsystemidlestate\"><a href=\"#api-changed-powermonitorquerysystemidlestate-is-now-powermonitorgetsystemidlestate\">API Changed: <code>powerMonitor.querySystemIdleState</code> is now <code>powerMonitor.getSystemIdleState</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\npowerMonitor.querySystemIdleState(threshold, callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleState = powerMonitor.getSystemIdleState(threshold)\n</code></pre>\n<h3 id=\"api-changed-powermonitorquerysystemidletime-is-now-powermonitorgetsystemidletime\"><a href=\"#api-changed-powermonitorquerysystemidletime-is-now-powermonitorgetsystemidletime\">API Changed: <code>powerMonitor.querySystemIdleTime</code> is now <code>powerMonitor.getSystemIdleTime</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\npowerMonitor.querySystemIdleTime(callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleTime = powerMonitor.getSystemIdleTime()\n</code></pre>\n<h3 id=\"api-changed-webframesetisolatedworldinfo-replaces-separate-methods\"><a href=\"#api-changed-webframesetisolatedworldinfo-replaces-separate-methods\">API Changed: <code>webFrame.setIsolatedWorldInfo</code> replaces separate methods</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\nwebFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)\nwebFrame.setIsolatedWorldHumanReadableName(worldId, name)\nwebFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)\n<span class=\"hljs-comment\">// Replace with</span>\nwebFrame.setIsolatedWorldInfo(\n  worldId,\n  {\n    <span class=\"hljs-attr\">securityOrigin</span>: <span class=\"hljs-string\">'some_origin'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'human_readable_name'</span>,\n    <span class=\"hljs-attr\">csp</span>: <span class=\"hljs-string\">'content_security_policy'</span>\n  })\n</code></pre>\n<h3 id=\"removed-marked-property-on-getblinkmemoryinfo\"><a href=\"#removed-marked-property-on-getblinkmemoryinfo\">Removed: <code>marked</code> property on <code>getBlinkMemoryInfo</code></a></h3>\n<p>This property was removed in Chromium 77, and as such is no longer available.</p>\n<h3 id=\"behavior-changed-webkitdirectory-attribute-for-input-typefile-now-lists-directory-contents\"><a href=\"#behavior-changed-webkitdirectory-attribute-for-input-typefile-now-lists-directory-contents\">Behavior Changed: <code>webkitdirectory</code> attribute for <code>&#x3C;input type=\"file\"/></code> now lists directory contents</a></h3>\n<p>The <code>webkitdirectory</code> property on HTML file inputs allows them to select folders. Previous versions of Electron had an incorrect implementation where the <code>event.target.files</code> of the input returned a <code>FileList</code> that returned one <code>File</code> corresponding to the selected folder.</p>\n<p>As of Electron 7, that <code>FileList</code> is now list of all files contained within the folder, similarly to Chrome, Firefox, and Edge (<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory\">link to MDN docs</a>).</p>\n<p>As an illustration, take a folder with this structure:</p>\n<pre><code class=\"hljs language-console\">folder\n├── file1\n├── file2\n└── file3\n</code></pre>\n<p>In Electron &#x3C;=6, this would return a <code>FileList</code> with a <code>File</code> object for:</p>\n<pre><code class=\"hljs language-console\">path/to/folder\n</code></pre>\n<p>In Electron 7, this now returns a <code>FileList</code> with a <code>File</code> object for:</p>\n<pre><code class=\"hljs language-console\">/path/to/folder/file3\n/path/to/folder/file2\n/path/to/folder/file1\n</code></pre>\n<p>Note that <code>webkitdirectory</code> no longer exposes the path to the selected folder. If you require the path to the selected folder rather than the folder contents, see the <code>dialog.showOpenDialog</code> API (<a href=\"/docs/api/dialog#dialogshowopendialogbrowserwindow-options\">link</a>).</p>\n<h3 id=\"api-changed-callback-based-versions-of-promisified-apis\"><a href=\"#api-changed-callback-based-versions-of-promisified-apis\">API Changed: Callback-based versions of promisified APIs</a></h3>\n<p>Electron 5 and Electron 6 introduced Promise-based versions of existing asynchronous APIs and deprecated their older, callback-based counterparts. In Electron 7, all deprecated callback-based APIs are now removed.</p>\n<p>These functions now only return Promises:</p>\n<ul>\n<li><code>app.getFileIcon()</code> <a href=\"https://github.com/electron/electron/pull/15742\">#15742</a></li>\n<li><code>app.dock.show()</code> <a href=\"https://github.com/electron/electron/pull/16904\">#16904</a></li>\n<li><code>contentTracing.getCategories()</code> <a href=\"https://github.com/electron/electron/pull/16583\">#16583</a></li>\n<li><code>contentTracking.getTraceBufferUs()</code> <a href=\"https://github.com/electron/electron/pull/16600\">#16600</a></li>\n<li><code>contentTracing.startRecording()</code> <a href=\"https://github.com/electron/electron/pull/16584\">#16584</a></li>\n<li><code>contentTracing.stopRecording()</code> <a href=\"https://github.com/electron/electron/pull/16584\">#16584</a></li>\n<li><code>contents.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>cookies.flushStore()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.get()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.remove()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.set()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>debugger.sendCommand()</code> <a href=\"https://github.com/electron/electron/pull/16861\">#16861</a></li>\n<li><code>dialog.showCertificateTrustDialog()</code> <a href=\"https://github.com/electron/electron/pull/17181\">#17181</a></li>\n<li><code>inAppPurchase.getProducts()</code> <a href=\"https://github.com/electron/electron/pull/17355\">#17355</a></li>\n<li><code>inAppPurchase.purchaseProduct()</code><a href=\"https://github.com/electron/electron/pull/17355\">#17355</a></li>\n<li><code>netLog.stopLogging()</code> <a href=\"https://github.com/electron/electron/pull/16862\">#16862</a></li>\n<li><code>session.clearAuthCache()</code> <a href=\"https://github.com/electron/electron/pull/17259\">#17259</a></li>\n<li><code>session.clearCache()</code>  <a href=\"https://github.com/electron/electron/pull/17185\">#17185</a></li>\n<li><code>session.clearHostResolverCache()</code> <a href=\"https://github.com/electron/electron/pull/17229\">#17229</a></li>\n<li><code>session.clearStorageData()</code> <a href=\"https://github.com/electron/electron/pull/17249\">#17249</a></li>\n<li><code>session.getBlobData()</code> <a href=\"https://github.com/electron/electron/pull/17303\">#17303</a></li>\n<li><code>session.getCacheSize()</code>  <a href=\"https://github.com/electron/electron/pull/17185\">#17185</a></li>\n<li><code>session.getCacheSize()</code> <a href=\"https://github.com/electron/electron/pull/17222\">#17185</a></li>\n<li><code>session.setProxy()</code>  <a href=\"https://github.com/electron/electron/pull/17222\">#17222</a></li>\n<li><code>shell.openExternal()</code> <a href=\"https://github.com/electron/electron/pull/16176\">#16176</a></li>\n<li><code>webContents.loadFile()</code> <a href=\"https://github.com/electron/electron/pull/15855\">#15855</a></li>\n<li><code>webContents.loadURL()</code> <a href=\"https://github.com/electron/electron/pull/15855\">#15855</a></li>\n<li><code>webContents.hasServiceWorker()</code> <a href=\"https://github.com/electron/electron/pull/16535\">#16535</a></li>\n<li><code>webContents.printToPDF()</code> <a href=\"https://github.com/electron/electron/pull/16795\">#16795</a></li>\n<li><code>webContents.savePage()</code> <a href=\"https://github.com/electron/electron/pull/16742\">#16742</a></li>\n<li><code>webFrame.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>webFrame.executeJavaScriptInIsolatedWorld()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>webviewTag.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>win.capturePage()</code> <a href=\"https://github.com/electron/electron/pull/15743\">#15743</a></li>\n</ul>\n<p>这些功能现在有两种形式，即同步和基于Promise的异步：</p>\n<ul>\n<li><code>dialog.showMessageBox()</code>/<code>dialog.showMessageBoxSync()</code> <a href=\"https://github.com/electron/electron/pull/17298\">#17298</a></li>\n<li><code>dialog.showOpenDialog()</code>/<code>dialog.showOpenDialogSync()</code> <a href=\"https://github.com/electron/electron/pull/16973\">#16973</a></li>\n<li><code>dialog.showSaveDialog()</code>/<code>dialog.showSaveDialogSync()</code> <a href=\"https://github.com/electron/electron/pull/17054\">#17054</a></li>\n</ul>\n<h2 id=\"planned-breaking-api-changes-60\"><a href=\"#planned-breaking-api-changes-60\">Planned Breaking API Changes (6.0)</a></h2>\n<h3 id=\"api-changed-winsetmenunull-is-now-winremovemenu\"><a href=\"#api-changed-winsetmenunull-is-now-winremovemenu\">API Changed: <code>win.setMenu(null)</code> is now <code>win.removeMenu()</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 不推荐</span>\nwin.setMenu(<span class=\"hljs-literal\">null</span>)\n<span class=\"hljs-comment\">// 替换为</span>\nwin.removeMenu()\n</code></pre>\n<h3 id=\"api-changed-electronscreen-in-the-renderer-process-should-be-accessed-via-remote\"><a href=\"#api-changed-electronscreen-in-the-renderer-process-should-be-accessed-via-remote\">API Changed: <code>electron.screen</code> in the renderer process should be accessed via <code>remote</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 不推荐</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).screen\n<span class=\"hljs-comment\">// 替换为</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.screen\n</code></pre>\n<h3 id=\"api-changed-requireing-node-builtins-in-sandboxed-renderers-no-longer-implicitly-loads-the-remote-version\"><a href=\"#api-changed-requireing-node-builtins-in-sandboxed-renderers-no-longer-implicitly-loads-the-remote-version\">API Changed: <code>require()</code>ing node builtins in sandboxed renderers no longer implicitly loads the <code>remote</code> version</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 不推荐</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'child_process'</span>)\n<span class=\"hljs-comment\">// 替换为</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'child_process'</span>)\n\n<span class=\"hljs-comment\">// 不推荐</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-comment\">// 替换为</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-comment\">// 不推荐</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n<span class=\"hljs-comment\">// 替换为</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'os'</span>)\n\n<span class=\"hljs-comment\">// 不推荐</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n<span class=\"hljs-comment\">// 替换为</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'path'</span>)\n</code></pre>\n<h3 id=\"deprecated-powermonitorquerysystemidlestate-replaced-with-powermonitorgetsystemidlestate\"><a href=\"#deprecated-powermonitorquerysystemidlestate-replaced-with-powermonitorgetsystemidlestate\">Deprecated: <code>powerMonitor.querySystemIdleState</code> replaced with <code>powerMonitor.getSystemIdleState</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\npowerMonitor.querySystemIdleState(threshold, callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleState = powerMonitor.getSystemIdleState(threshold)\n</code></pre>\n<h3 id=\"deprecated-powermonitorquerysystemidletime-replaced-with-powermonitorgetsystemidletime\"><a href=\"#deprecated-powermonitorquerysystemidletime-replaced-with-powermonitorgetsystemidletime\">Deprecated: <code>powerMonitor.querySystemIdleTime</code> replaced with <code>powerMonitor.getSystemIdleTime</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\npowerMonitor.querySystemIdleTime(callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleTime = powerMonitor.getSystemIdleTime()\n</code></pre>\n<h3 id=\"deprecated-appenablemixedsandbox-is-no-longer-needed\"><a href=\"#deprecated-appenablemixedsandbox-is-no-longer-needed\">Deprecated: <code>app.enableMixedSandbox()</code> is no longer needed</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\napp.enableMixedSandbox()\n</code></pre>\n<p>混合沙盒模式已默认启用。</p>\n<h3 id=\"deprecated-traysethighlightmode\"><a href=\"#deprecated-traysethighlightmode\">Deprecated: <code>Tray.setHighlightMode</code></a></h3>\n<p>Under macOS Catalina our former Tray implementation breaks. Apple's native substitute doesn't support changing the highlighting behavior.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\ntray.setHighlightMode(mode)\n<span class=\"hljs-comment\">// API will be removed in v7.0 without replacement.</span>\n</code></pre>\n<h2 id=\"planned-breaking-api-changes-50\"><a href=\"#planned-breaking-api-changes-50\">Planned Breaking API Changes (5.0)</a></h2>\n<h3 id=\"default-changed-nodeintegration-and-webviewtag-default-to-false-contextisolation-defaults-to-true\"><a href=\"#default-changed-nodeintegration-and-webviewtag-default-to-false-contextisolation-defaults-to-true\">Default Changed: <code>nodeIntegration</code> and <code>webviewTag</code> default to false, <code>contextIsolation</code> defaults to true</a></h3>\n<p>不推荐使用以下 <code>webPreferences</code> 选项默认值，以支持下面列出的新默认值。</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>属性</th><th>不推荐使用的默认值</th><th>新的默认值</th></tr></thead><tbody><tr><td><code>contextIsolation</code></td><td><code>false</code></td><td><code>true</code></td></tr><tr><td><code>nodeIntegration</code></td><td><code>true</code></td><td><code>false</code></td></tr><tr><td><code>webviewTag</code></td><td><code>nodeIntegration</code> 未设置过则是 <code>true</code></td><td><code>false</code></td></tr></tbody></table>\n<p>如下: Re-enabling the webviewTag</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> w = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">webviewTag</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h3 id=\"behavior-changed-nodeintegration-in-child-windows-opened-via-nativewindowopen\"><a href=\"#behavior-changed-nodeintegration-in-child-windows-opened-via-nativewindowopen\">Behavior Changed: <code>nodeIntegration</code> in child windows opened via <code>nativeWindowOpen</code></a></h3>\n<p>Child windows opened with the <code>nativeWindowOpen</code> option will always have Node.js integration disabled, unless <code>nodeIntegrationInSubFrames</code> is <code>true</code>.</p>\n<h3 id=\"api-changed-registering-privileged-schemes-must-now-be-done-before-app-ready\"><a href=\"#api-changed-registering-privileged-schemes-must-now-be-done-before-app-ready\">API Changed: Registering privileged schemes must now be done before app ready</a></h3>\n<p>Renderer process APIs <code>webFrame.registerURLSchemeAsPrivileged</code> and <code>webFrame.registerURLSchemeAsBypassingCSP</code> as well as browser process API <code>protocol.registerStandardSchemes</code> have been removed. 新的 API <code>protocol.registerSchemeasviliged</code> 已被添加，并用于注册具有必要权限的自定义 scheme。 自定义 scheme 需要在 app 触发 ready 事件之前注册。</p>\n<h3 id=\"deprecated-webframesetisolatedworld-replaced-with-webframesetisolatedworldinfo\"><a href=\"#deprecated-webframesetisolatedworld-replaced-with-webframesetisolatedworldinfo\">Deprecated: <code>webFrame.setIsolatedWorld*</code> replaced with <code>webFrame.setIsolatedWorldInfo</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 弃用</span>\nwebFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)\nwebFrame.setIsolatedWorldHumanReadableName(worldId, name)\nwebFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)\n<span class=\"hljs-comment\">// 替换为</span>\nwebFrame.setIsolatedWorldInfo(\n  worldId,\n  {\n    <span class=\"hljs-attr\">securityOrigin</span>: <span class=\"hljs-string\">'some_origin'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'human_readable_name'</span>,\n    <span class=\"hljs-attr\">csp</span>: <span class=\"hljs-string\">'content_security_policy'</span>\n  })\n</code></pre>\n<h3 id=\"api-changed-webframesetspellcheckprovider-now-takes-an-asynchronous-callback\"><a href=\"#api-changed-webframesetspellcheckprovider-now-takes-an-asynchronous-callback\">API Changed: <code>webFrame.setSpellCheckProvider</code> now takes an asynchronous callback</a></h3>\n<p>The <code>spellCheck</code> callback is now asynchronous, and <code>autoCorrectWord</code> parameter has been removed.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, <span class=\"hljs-literal\">true</span>, {\n  <span class=\"hljs-attr\">spellCheck</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">text</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> !spellchecker.isMisspelled(text)\n  }\n})\n<span class=\"hljs-comment\">// Replace with</span>\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, {\n  <span class=\"hljs-attr\">spellCheck</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">words, callback</span>) =></span> {\n    callback(words.filter(<span class=\"hljs-function\"><span class=\"hljs-params\">text</span> =></span> spellchecker.isMisspelled(text)))\n  }\n})\n</code></pre>\n<h3 id=\"api-changed-webcontentsgetzoomlevel-and-webcontentsgetzoomfactor-are-now-synchronous\"><a href=\"#api-changed-webcontentsgetzoomlevel-and-webcontentsgetzoomfactor-are-now-synchronous\">API Changed: <code>webContents.getZoomLevel</code> and <code>webContents.getZoomFactor</code> are now synchronous</a></h3>\n<p><code>webContents.getZoomLevel</code> and <code>webContents.getZoomFactor</code> no longer take callback parameters, instead directly returning their number values.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebContents.getZoomLevel(<span class=\"hljs-function\">(<span class=\"hljs-params\">level</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(level)\n})\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> level = webContents.getZoomLevel()\n<span class=\"hljs-built_in\">console</span>.log(level)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebContents.getZoomFactor(<span class=\"hljs-function\">(<span class=\"hljs-params\">factor</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(factor)\n})\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> factor = webContents.getZoomFactor()\n<span class=\"hljs-built_in\">console</span>.log(factor)\n</code></pre>\n<h2 id=\"计划重写的-api-40\"><a href=\"#计划重写的-api-40\">计划重写的 API (4.0)</a></h2>\n<p>以下列表包含了Electron4.0中重大的API更新</p>\n<h3 id=\"appmakesingleinstance\"><a href=\"#appmakesingleinstance\"><code>app.makeSingleInstance</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 已废弃</span>\napp.makeSingleInstance(<span class=\"hljs-function\">(<span class=\"hljs-params\">argv, cwd</span>) =></span> {\n  <span class=\"hljs-comment\">/* ... */</span>\n})\n<span class=\"hljs-comment\">// 替换为</span>\napp.requestSingleInstanceLock()\napp.on(<span class=\"hljs-string\">'second-instance'</span>, (event, argv, cwd) => {\n  <span class=\"hljs-comment\">/* ... */</span>\n})\n</code></pre>\n<h3 id=\"appreleasesingleinstance\"><a href=\"#appreleasesingleinstance\"><code>app.releaseSingleInstance</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 废弃</span>\napp.releaseSingleInstance()\n<span class=\"hljs-comment\">// 替换为</span>\napp.releaseSingleInstanceLock()\n</code></pre>\n<h3 id=\"appgetgpuinfo\"><a href=\"#appgetgpuinfo\"><code>app.getGPUInfo</code></a></h3>\n<pre><code class=\"hljs language-js\">app.getGPUInfo(<span class=\"hljs-string\">'complete'</span>)\n<span class=\"hljs-comment\">// 现在的行为将与macOS下的`basic`设置一样</span>\napp.getGPUInfo(<span class=\"hljs-string\">'basic'</span>)\n</code></pre>\n<h3 id=\"win_delay_load_hook\"><a href=\"#win_delay_load_hook\"><code>win_delay_load_hook</code></a></h3>\n<p>在为 Windows 构建本机模块时，将使 <code>win_delay_load_hook</code> 变量值 位于 <code>binding.gyp</code> 模块，必须为 true (这是默认值)。 如果这个钩子 不存在，那么本机模块将无法在 Windows 上加载，并出现错误 消息如 <code>无法找到模块</code>。 查看 <a href=\"/docs/tutorial/using-native-node-modules\">原生模块指南</a> 以获取更多信息.</p>\n<h2 id=\"重大的api更新-30\"><a href=\"#重大的api更新-30\">重大的API更新 (3.0)</a></h2>\n<p>以下包含了Electron 3.0中重大的API更新</p>\n<h3 id=\"app\"><a href=\"#app\"><code>app</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 弃用</span>\napp.getAppMemoryInfo()\n<span class=\"hljs-comment\">// 替换为</span>\napp.getAppMetrics()\n\n<span class=\"hljs-comment\">// 弃用</span>\n<span class=\"hljs-keyword\">const</span> metrics = app.getAppMetrics()\n<span class=\"hljs-keyword\">const</span> { memory } = metrics[<span class=\"hljs-number\">0</span>] <span class=\"hljs-comment\">// 弃用的属性</span>\n</code></pre>\n<h3 id=\"browserwindow\"><a href=\"#browserwindow\"><code>BrowserWindow</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 已废弃</span>\n<span class=\"hljs-keyword\">const</span> optionsA = { <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">blinkFeatures</span>: <span class=\"hljs-string\">''</span> } }\n<span class=\"hljs-keyword\">const</span> windowA = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsA)\n<span class=\"hljs-comment\">// 替换为</span>\n<span class=\"hljs-keyword\">const</span> optionsB = { <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">enableBlinkFeatures</span>: <span class=\"hljs-string\">''</span> } }\n<span class=\"hljs-keyword\">const</span> windowB = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsB)\n\n<span class=\"hljs-comment\">// 已废弃</span>\n<span class=\"hljs-built_in\">window</span>.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'media-play_pause'</span>) {\n    <span class=\"hljs-comment\">// do something</span>\n  }\n})\n<span class=\"hljs-comment\">// 替换为</span>\n<span class=\"hljs-built_in\">window</span>.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'media-play-pause'</span>) {\n    <span class=\"hljs-comment\">// do something</span>\n  }\n})\n</code></pre>\n<h3 id=\"clipboard\"><a href=\"#clipboard\"><code>clipboard</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 过时的</span>\nclipboard.readRtf()\n<span class=\"hljs-comment\">// 替换为</span>\nclipboard.readRTF()\n\n<span class=\"hljs-comment\">// 过时的</span>\nclipboard.writeRtf()\n<span class=\"hljs-comment\">// 替换为</span>\nclipboard.writeRTF()\n\n<span class=\"hljs-comment\">// 过时的</span>\nclipboard.readHtml()\n<span class=\"hljs-comment\">// 替换为</span>\nclipboard.readHTML()\n\n<span class=\"hljs-comment\">// 过时的</span>\nclipboard.writeHtml()\n<span class=\"hljs-comment\">//替换为</span>\nclipboard.writeHTML()\n</code></pre>\n<h3 id=\"crashreporter\"><a href=\"#crashreporter\"><code>crashReporter</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 过时的</span>\ncrashReporter.start({\n  <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Crashly'</span>,\n  <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://crash.server.com'</span>,\n  <span class=\"hljs-attr\">autoSubmit</span>: <span class=\"hljs-literal\">true</span>\n})\n<span class=\"hljs-comment\">// 替换为</span>\ncrashReporter.start({\n  <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Crashly'</span>,\n  <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://crash.server.com'</span>,\n  <span class=\"hljs-attr\">uploadToServer</span>: <span class=\"hljs-literal\">true</span>\n})\n</code></pre>\n<h3 id=\"nativeimage\"><a href=\"#nativeimage\"><code>nativeImage</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 弃用</span>\nnativeImage.createFromBuffer(buffer, <span class=\"hljs-number\">1.0</span>)\n<span class=\"hljs-comment\">// 替换为</span>\nnativeImage.createFromBuffer(buffer, {\n  <span class=\"hljs-attr\">scaleFactor</span>: <span class=\"hljs-number\">1.0</span>\n})\n</code></pre>\n<h3 id=\"process\"><a href=\"#process\"><code>process</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 弃用</span>\n<span class=\"hljs-keyword\">const</span> info = process.getProcessMemoryInfo()\n</code></pre>\n<h3 id=\"screen\"><a href=\"#screen\"><code>screen</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 弃用</span>\nscreen.getMenuBarHeight()\n<span class=\"hljs-comment\">// 替换为</span>\nscreen.getPrimaryDisplay().workArea\n</code></pre>\n<h3 id=\"session\"><a href=\"#session\"><code>session</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 弃用</span>\nses.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">hostname, certificate, callback</span>) =></span> {\n  callback(<span class=\"hljs-literal\">true</span>)\n})\n<span class=\"hljs-comment\">// 替换为</span>\nses.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">request, callback</span>) =></span> {\n  callback(<span class=\"hljs-number\">0</span>)\n})\n</code></pre>\n<h3 id=\"tray\"><a href=\"#tray\"><code>Tray</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 过时的</span>\ntray.setHighlightMode(<span class=\"hljs-literal\">true</span>)\n<span class=\"hljs-comment\">// 替换为</span>\ntray.setHighlightMode(<span class=\"hljs-string\">'on'</span>)\n\n<span class=\"hljs-comment\">// 过时的</span>\ntray.setHighlightMode(<span class=\"hljs-literal\">false</span>)\n<span class=\"hljs-comment\">// 替换为</span>\ntray.setHighlightMode(<span class=\"hljs-string\">'off'</span>)\n</code></pre>\n<h3 id=\"webcontents\"><a href=\"#webcontents\"><code>webContents</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 弃用</span>\nwebContents.openDevTools({ <span class=\"hljs-attr\">detach</span>: <span class=\"hljs-literal\">true</span> })\n<span class=\"hljs-comment\">// 替换为</span>\nwebContents.openDevTools({ <span class=\"hljs-attr\">mode</span>: <span class=\"hljs-string\">'detach'</span> })\n\n<span class=\"hljs-comment\">// 移除</span>\nwebContents.setSize(options)\n<span class=\"hljs-comment\">// 没有该API的替代</span>\n</code></pre>\n<h3 id=\"webframe\"><a href=\"#webframe\"><code>webFrame</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 弃用</span>\nwebFrame.registerURLSchemeAsSecure(<span class=\"hljs-string\">'app'</span>)\n<span class=\"hljs-comment\">// 替换为</span>\nprotocol.registerStandardSchemes([<span class=\"hljs-string\">'app'</span>], { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n\n<span class=\"hljs-comment\">// 弃用</span>\nwebFrame.registerURLSchemeAsPrivileged(<span class=\"hljs-string\">'app'</span>, { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n<span class=\"hljs-comment\">// 替换为</span>\nprotocol.registerStandardSchemes([<span class=\"hljs-string\">'app'</span>], { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n</code></pre>\n<h3 id=\"webview\"><a href=\"#webview\"><code>&#x3C;webview></code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 移除</span>\nwebview.setAttribute(<span class=\"hljs-string\">'disableguestresize'</span>, <span class=\"hljs-string\">''</span>)\n<span class=\"hljs-comment\">// 没有该API的替代</span>\n\n<span class=\"hljs-comment\">// 移除</span>\nwebview.setAttribute(<span class=\"hljs-string\">'guestinstance'</span>, instanceId)\n<span class=\"hljs-comment\">// 没有该API的替代</span>\n\n<span class=\"hljs-comment\">// 键盘监听器在webview标签中不再起效</span>\nwebview.onkeydown = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* handler */</span> }\nwebview.onkeyup = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* handler */</span> }\n</code></pre>\n<h3 id=\"node-headers-url\"><a href=\"#node-headers-url\">Node Headers URL</a></h3>\n<p>这是在构建原生 node 模块时在 <code>.npmrc</code> 文件中指定为 <code>disturl</code> 的 url 或是 <code>--dist-url</code> 命令行标志.</p>\n<p>过时的: <a href=\"https://atom.io/download/atom-shell\">https://atom.io/download/atom-shell</a></p>\n<p>替换为: <a href=\"https://atom.io/download/electron\">https://atom.io/download/electron</a></p>\n<h2 id=\"重大的api更新-20\"><a href=\"#重大的api更新-20\">重大的API更新 (2.0)</a></h2>\n<p>以下包含了Electron 2.0中重大的API更新</p>\n<h3 id=\"browserwindow-1\"><a href=\"#browserwindow-1\"><code>BrowserWindow</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 已废弃</span>\n<span class=\"hljs-keyword\">const</span> optionsA = { <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden-inset'</span> }\n<span class=\"hljs-keyword\">const</span> windowA = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsA)\n<span class=\"hljs-comment\">// 替换为</span>\n<span class=\"hljs-keyword\">const</span> optionsB = { <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span> }\n<span class=\"hljs-keyword\">const</span> windowB = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsB)\n</code></pre>\n<h3 id=\"menu\"><a href=\"#menu\"><code>menu</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 移除</span>\nmenu.popup(browserWindow, <span class=\"hljs-number\">100</span>, <span class=\"hljs-number\">200</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// 替换为</span>\nmenu.popup(browserWindow, { <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">100</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">200</span>, <span class=\"hljs-attr\">positioningItem</span>: <span class=\"hljs-number\">2</span> })\n</code></pre>\n<h3 id=\"nativeimage-1\"><a href=\"#nativeimage-1\"><code>nativeImage</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 移除</span>\nnativeImage.toPng()\n<span class=\"hljs-comment\">// 替换为</span>\nnativeImage.toPNG()\n\n<span class=\"hljs-comment\">// 移除</span>\nnativeImage.toJpeg()\n<span class=\"hljs-comment\">// 替换为</span>\nnativeImage.toJPEG()\n</code></pre>\n<h3 id=\"process-1\"><a href=\"#process-1\"><code>process</code></a></h3>\n<ul>\n<li><code>process.versions.electron</code> 和 <code>process.version.chrome</code> 将成为只读属性, 以便与其他 <code>process.versions</code> 属性由Node设置。</li>\n</ul>\n<h3 id=\"webcontents-1\"><a href=\"#webcontents-1\"><code>webContents</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 移除</span>\nwebContents.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// 替换为</span>\nwebContents.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"webframe-1\"><a href=\"#webframe-1\"><code>webFrame</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 移除</span>\nwebFrame.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// 替换为</span>\nwebFrame.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"webview-1\"><a href=\"#webview-1\"><code>&#x3C;webview></code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 移除</span>\nwebview.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// 替换为</span>\nwebview.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"重复的-arm-资源\"><a href=\"#重复的-arm-资源\">重复的 ARM 资源</a></h3>\n<p>每个 Electron 发布版本包含两个相同的ARM版本，文件名略有不同，如<code>electron-v1.7.3-linux-arm.zip</code> 和 <code>electron-v1.7.3-linux-armv7l.zip</code> 添加包含<code>v7l</code>前缀的资源向用户明确其支持的ARM版本，并消除由未来armv6l 和 arm64 资源可能产生的歧义。</p>\n<p>The file <em>without the prefix</em> is still being published to avoid breaking any setups that may be consuming it. Starting at 2.0, the unprefixed file will no longer be published.</p>\n<p>更多详细情况，查看 <a href=\"https://github.com/electron/electron/pull/6986\">6986</a> 和 <a href=\"https://github.com/electron/electron/pull/7189\">7189</a>。</p>",
      "title": "重大更改",
      "description": ""
    },
    "/docs/api/browser-view": {
      "locale": "zh-CN",
      "slug": "browser-view",
      "href": "/docs/api/browser-view",
      "crowdinFileId": "256283",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-view.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"browserview\"><a href=\"#browserview\">BrowserView</a></h1>\n<p><code>BrowserView</code> 被用来让 <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> 嵌入更多的 web 内容。 它就像一个子窗口，除了它的位置是相对于父窗口。 这意味着可以替代<code>webview</code>标签.</p>\n<h2 id=\"类-browserview\"><a href=\"#类-browserview\">类: BrowserView</a></h2>\n<blockquote>\n<p>创建和控制视图</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<h3 id=\"示例\"><a href=\"#示例\">示例</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// 在主进程中.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserView, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-keyword\">const</span> view = <span class=\"hljs-keyword\">new</span> BrowserView()\nwin.setBrowserView(view)\nview.setBounds({ <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">0</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">0</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">300</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">300</span> })\nview.webContents.loadURL(<span class=\"hljs-string\">'https://electronjs.org'</span>)\n</code></pre>\n<h3 id=\"new-browserview可选-实验功能\"><a href=\"#new-browserview可选-实验功能\"><code>new BrowserView([可选])</code> <em>实验功能</em></a></h3>\n<ul>\n<li><code>options</code> Object (可选)<ul>\n<li><code>webPreferences</code> Object (可选) - 详情请看 <a href=\"/docs/api/browser-window\">BrowserWindow</a>.</li>\n</ul></li>\n</ul>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<p>使用 <code>new BrowserView</code> 创建的对象具有以下属性:</p>\n<h4 id=\"viewwebcontents-实验功能\"><a href=\"#viewwebcontents-实验功能\"><code>view.webContents</code> <em>实验功能</em></a></h4>\n<p>视图的<a href=\"/docs/api/web-contents\"><code>WebContents</code></a> 对象</p>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<p>使用 <code>new BrowserView</code>创建的对象具有以下实例方法:</p>\n<h4 id=\"viewsetautoresizeoptions-实验功能\"><a href=\"#viewsetautoresizeoptions-实验功能\"><code>view.setAutoResize(options)</code> <em>实验功能</em></a></h4>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>width</code> Boolean（可选） - 如果为<code>true</code>，视图宽度跟随窗口变化。 默认值为 <code>false</code></li>\n<li><code>height</code> Boolean(可选) - 如果 <code>true</code>，视图的高度将增长和缩小 与窗口。 默认值为 <code>false</code></li>\n<li><code>horizontal</code> Boolean (可选) - 如果为 <code>true</code>，视图的x轴和宽度将随着窗口的大小变化等比例缩放。 默认值为 <code>false</code></li>\n<li><code>vertical</code> Boolean(可选)  - 如果 <code>true</code>，视图的y位置和高度将增长 和收缩比例与窗口。 默认值为 <code>false</code></li>\n</ul></li>\n</ul>\n<h4 id=\"viewsetboundsbounds-实验功能\"><a href=\"#viewsetboundsbounds-实验功能\"><code>view.setBounds(bounds)</code> <em>实验功能</em></a></h4>\n<ul>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>调整视图的大小，并将它移动到窗口边界</p>\n<h4 id=\"viewgetbounds-实验功能\"><a href=\"#viewgetbounds-实验功能\"><code>view.getBounds()</code> <em>实验功能</em></a></h4>\n<p>返回 <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>此BrowserView实例的 <code>bounds</code> 为 <code>Object</code>。</p>\n<h4 id=\"viewsetbackgroundcolorcolor-实验功能\"><a href=\"#viewsetbackgroundcolorcolor-实验功能\"><code>view.setBackgroundColor(color)</code> <em>实验功能</em></a></h4>\n<ul>\n<li><code>color</code> String - Color in <code>#aarrggbb</code> or <code>#argb</code> form. Alpha 通道是 可选的。</li>\n</ul>",
      "title": "BrowserView",
      "description": "创建和控制视图"
    },
    "/docs/api/browser-window": {
      "locale": "zh-CN",
      "slug": "browser-window",
      "href": "/docs/api/browser-window",
      "crowdinFileId": "256287",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-window.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"browserwindow\"><a href=\"#browserwindow\">BrowserWindow</a></h1>\n<blockquote>\n<p>创建并控制浏览器窗口。</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// 在主进程中.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-comment\">// Load a remote URL</span>\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\n<span class=\"hljs-comment\">// Or load a local HTML file</span>\nwin.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n</code></pre>\n<h2 id=\"frameless-window\"><a href=\"#frameless-window\">Frameless window</a></h2>\n<p>如果想创建一个无边框或者任意形状的透明窗口，你可以使用<a href=\"/docs/api/frameless-window\">Frameless Window</a> 的API</p>\n<h2 id=\"showing-the-window-gracefully\"><a href=\"#showing-the-window-gracefully\">Showing the window gracefully</a></h2>\n<p>When loading a page in the window directly, users may see the page load incrementally, which is not a good experience for a native app. To make the window display without a visual flash, there are two solutions for different situations.</p>\n<h3 id=\"using-the-ready-to-show-event\"><a href=\"#using-the-ready-to-show-event\">Using the <code>ready-to-show</code> event</a></h3>\n<p>在加载页面时，渲染进程第一次完成绘制时，如果窗口还没有被显示，渲染进程会发出 <code>ready-to-show</code> 事件 。 在此事件后显示窗口将没有视觉闪烁：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span> })\nwin.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => {\n  win.show()\n})\n</code></pre>\n<p>这个事件通常在 <code>did-finish-load</code> 事件之后发出，但是页面有许多远程资源时，它可能会在 <code>did-finish-load</code>之前发出事件。</p>\n<p>请注意，使用此事件意味着渲染器会被认为是\"可见的\"并绘制，即使 <code>show</code> 是false。  如果您使用 <code>paintWhenInitiallyHidden: false</code>，此事件将永远不会被触发。</p>\n<h3 id=\"setting-the-backgroundcolor-property\"><a href=\"#setting-the-backgroundcolor-property\">Setting the <code>backgroundColor</code> property</a></h3>\n<p>对于一个复杂的应用，<code>ready-to-show</code> 可能发出的太晚，会让应用感觉缓慢。 在这种情况下，建议立刻显示窗口，并使用接近应用程序背景的 <code>backgroundColor</code></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#2e2c29'</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<p>请注意，即使是使用 <code>ready-to-show</code> 事件的应用程序，仍建议使用设置 <code>backgroundColor</code> 使应用程序感觉更原生。</p>\n<h2 id=\"父子窗口\"><a href=\"#父子窗口\">父子窗口</a></h2>\n<p>通过使用 <code>parent</code> 选项，你可以创建子窗口：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> top = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n<span class=\"hljs-keyword\">const</span> child = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">parent</span>: top })\nchild.show()\ntop.show()\n</code></pre>\n<p><code>child</code> 窗口将总是显示在 <code>top</code> 窗口的顶部.</p>\n<h2 id=\"模态窗口\"><a href=\"#模态窗口\">模态窗口</a></h2>\n<p>模态窗口是禁用父窗口的子窗口，创建模态窗口必须设置 <code>parent</code> 和 <code>modal</code> 选项：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> child = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">parent</span>: top, <span class=\"hljs-attr\">modal</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span> })\nchild.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\nchild.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => {\n  child.show()\n})\n</code></pre>\n<h2 id=\"页面可见性\"><a href=\"#页面可见性\">页面可见性</a></h2>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API\"> 页面可见性 API </a> 的工作方式如下:</p>\n<ul>\n<li>在所有平台上, 可见性状态与窗口是否隐藏/最小化相关。</li>\n<li>此外, 在 macOS 上, 可见性状态还会跟踪窗口的遮挡状态。 如果窗口被另一个窗口完全遮挡了，可见性状态为<code>hidden</code>. 在其他平台上，可见性状态只有在使用 <code>win.hide()</code>使窗口最小化或者隐藏时才为 <code>hidden</code></li>\n<li>如果创建<code>BrowserWindow</code> 时带有 <code>show: false</code>的参数, 最初的可见性状态将为<code>visible</code> 尽管窗口实际上是隐藏的。</li>\n<li>如果<code>backgroundThrottling</code>被禁用，可见性状态将保持为<code>visible</code> 即使窗口被最小化、遮挡或隐藏。</li>\n</ul>\n<p>推荐您在可见性状态为 <code>hidden</code> 时暂停消耗资源的操作以便减少电力消耗。</p>\n<h2 id=\"平台相关的提示\"><a href=\"#平台相关的提示\">平台相关的提示</a></h2>\n<ul>\n<li>在 macOS 上，modal 窗口将显示为附加到父窗口的工作表。</li>\n<li>在 macOS 上，子窗口将保持与父窗口的相对位置。而在 Windows 和 Linux 中，当父窗口移动时子窗口不会移动。</li>\n<li>在Linux上，模态窗口的类型将更改为 <code>dialog</code>.</li>\n<li>在Linux上，许多桌面环境不支持隐藏模态窗口。</li>\n</ul>\n<h2 id=\"class-browserwindow\"><a href=\"#class-browserwindow\">Class: BrowserWindow</a></h2>\n<blockquote>\n<p>创建并控制浏览器窗口。</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p><code>BrowserWindow</code>是一个<a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p>通过 <code>options</code> 可以创建一个具有原生属性的 <code>BrowserWindow</code> 。</p>\n<h3 id=\"new-browserwindowoptions\"><a href=\"#new-browserwindowoptions\"><code>new BrowserWindow([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (可选)<ul>\n<li><code>width</code> 整数型 (可选) - 窗口的宽度（以像素为单位）。 默认值为 <code>800</code>。</li>\n<li><code>height</code> 整数型 (可选) - 窗口的高度（以像素为单位）。 默认值为 <code>600</code>。</li>\n<li><code>x</code> Interger (可选) - (<strong>必选</strong> 如果使用了y) 窗口相对于屏幕左侧的偏移量。 默认值为将窗口居中。</li>\n<li><code>y</code> Integer (可选) - (<strong>必选</strong> 如果使用了x) 窗口相对于屏幕顶端的偏移量。 默认值为将窗口居中。</li>\n<li><code>useContentSize</code> Boolean (可选) - <code>width</code> 和 <code>height</code> 将设置为 web 页面的尺寸(译注: 不包含边框), 这意味着窗口的实际尺寸将包括窗口边框的大小，稍微会大一点。 默认值为 <code>false</code>.</li>\n<li><code>center</code> Boolean (可选) - 窗口是否在屏幕居中.</li>\n<li>整型（可选）-窗口的最小宽度。默认为0 默认值为 <code>0</code>.</li>\n<li><code>minHeight</code> Integer(可选) - 窗口的最小高度。 默认值为 <code>0</code>.</li>\n<li><code>maxWidth </code>Integer(可选)-窗口的最大宽度。 默认值不限</li>\n<li><code>maxHeight </code>Integer (可选) - 窗口的最大高度。 默认值不限</li>\n<li><code>resizable</code> Boolean (可选) - 窗口大小是否可调整。 默认值为 <code>true</code>。</li>\n<li><code>movable</code> Boolean (可选) - 窗口是否可以移动. 该属性在Linux上未实现。 默认值为 <code>true</code>。</li>\n<li><code>minimizable</code> Boolean (可选) - 窗口是否可最小化。 该属性在Linux上未实现。 默认值为 <code>true</code>。</li>\n<li><code>maximizable</code> Boolean (可选) - 窗口是否可最大化。 该属性在Linux上未实现。 默认值为 <code>true</code>。</li>\n<li><code>closable</code> Boolean (可选) - 窗口是否可关闭。 该属性在Linux上未实现。 默认值为 <code>true</code>。</li>\n<li><code>focusable</code> Boolean (可选) - 窗口是否可以聚焦. 默认值为 <code>true</code>。 在 Windows 中设置 <code>focusable: false</code> 也意味着设置了<code>skipTaskbar: true</code>. 在 Linux 中设置 <code>focusable: false</code> 时窗口停止与 wm 交互, 并且窗口将始终置顶。</li>\n<li><code>alwaysOnTop</code> Boolean (可选) - 窗口是否永远在别的窗口的上面。 默认值为 <code>false</code>.</li>\n<li><code>fullscreen</code> Boolean (可选) - 窗口是否全屏. 当明确设置为 <code>false</code> 时，在 macOS 上全屏的按钮将被隐藏或禁用. 默认值为 <code>false</code>.</li>\n<li><code>fullscreenable</code> Boolean (可选) - 窗口是否可以进入全屏状态. 在 macOS上, 最大化/缩放按钮是否可用 默认值为 <code>true</code>。</li>\n<li><code>simpleFullscreen</code> Boolean (可选) - 在 macOS 上使用 pre-Lion 全屏。 默认值为 <code>false</code>.</li>\n<li><code>skipTaskbar</code> Boolean (可选) - 是否在任务栏中显示窗口。 默认值为 <code>false</code>。</li>\n<li><code>kiosk</code> Boolean (可选) - 窗口是否进入kiosk模式。 默认值为 <code>false</code>.</li>\n<li><code>title</code>String(可选) - 默认窗口标题 默认为<code>\"Electron\"</code>。 如果由<code>loadURL()</code>加载的HTML文件中含有标签<code>&#x3C;title></code>，此属性将被忽略。</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (可选) - 窗口的图标. 在 Windows 上推荐使用 <code>ICO</code> 图标来获得最佳的视觉效果, 默认使用可执行文件的图标.</li>\n<li><code>show</code> Boolean (可选) - 窗口是否在创建时显示。 默认值为 <code>true</code>。</li>\n<li><code>paintWhenInitiallyHidden</code>Boolean(可选) - 当<code>show</code>为<code>false</code>并且渲染器刚刚被创建时，它是否应激活。  为了让<code>document.visibilityState</code> 在<code>show: false</code>的情况下第一次加载时正确地工作，你应该把这个设置成<code>false</code>.  设置为 <code>false</code> 将会导致<code>ready-to-show</code> 事件不触发。  默认值为 <code>true</code>。</li>\n<li><code>frame</code> Boolean (可选) - 设置为 <code>false</code> 时可以创建一个<a href=\"/docs/api/frameless-window\">无边框窗口</a>。 默认值为 <code>true</code>。</li>\n<li><code>parent</code> BrowserWindow (可选) - 指定父窗口 默认值为 <code>null</code>.</li>\n<li><code>momodalable</code> Boolean (可选) - 当前是否为模态窗口。 只有当窗口是子窗口时才起作用。 默认值为 <code>false</code>.</li>\n<li><code>acceptFirstMouse</code> Boolean (optional) - Whether clicking an inactive window will also click through to the web contents. Default is <code>false</code> on macOS. This option is not configurable on other platforms.</li>\n<li><code>disableAutoHideCursor</code> Boolean (可选) - 是否在打字时隐藏光标。 默认值为 <code>false</code>.</li>\n<li><code>autoHideMenuBar</code> Boolean (可选) - 自动隐藏菜单栏，除非按了<code>Alt</code>键。 默认值为 <code>false</code>.</li>\n<li><code>enableLargerThanScreen</code> Boolean (可选) - 是否允许改变窗口的大小使之大于屏幕的尺寸. 仅适用于 macOS，因为其它操作系统默认允许 大于屏幕的窗口。 默认值为 <code>false</code>.</li>\n<li><code>backgroundColor</code> String(可选) - 窗口的背景颜色为十六进制值，例如<code>#66CD00</code>, <code>#FFF</code>, <code>#80FFFFFF</code> (设置<code>transparent</code>为<code>true</code>方可支持alpha属性，格式为#AARRGGBB)。 默认值为 <code>#FFF</code>（白色）。</li>\n<li><code>hasShadow</code> Boolean (可选) - 窗口是否有阴影. 默认值为 <code>true</code>。</li>\n<li><code>opacity</code> Number (可选)-设置窗口初始的不透明度, 介于 0.0 (完全透明) 和 1.0 (完全不透明) 之间。 目前仅支持Windows 和 macos</li>\n<li><code>darkTheme</code> Boolean (optional) - 强制窗口使用深色主题，只在部分GTK+3桌面环境下有效。 默认值为 <code>false</code>.</li>\n<li><code>transparent</code> Boolean (可选) - 使窗口 <a href=\"/docs/api/frameless-window#transparent-window\">透明</a>。 默认值为 <code>false</code>. 在Windows上，仅在无边框窗口下起作用。</li>\n<li><code>type</code> String (可选) - 窗口的类型, 默认为普通窗口. 更多信息见下文</li>\n<li><code>visualEffectState</code> String (optional) - 指定material外观应如何反映macOS上的窗口活动状态。 必须与 <code>vibrancy</code> 属性一起使用。 可能的值有<ul>\n<li><code>followWindow</code> - 当窗口处于激活状态时，后台应自动显示为激活状态，当窗口处于非激活状态时，后台应自动显示为非激活状态。 默认为该值。</li>\n<li><code>active</code> - 后台应一直显示为激活状态。</li>\n<li><code>inactive</code> - 后台应一直显示为非激活状态。</li>\n</ul></li>\n<li><code>titleBarStyle</code> String (optional) <em>macOS</em> <em>Windows</em> - The style of window title bar. 默认值为 <code>default</code>. 可能的值有<ul>\n<li><code>default</code> - Results in the standard title bar for macOS or Windows respectively.</li>\n<li><code>hidden</code> - Results in a hidden title bar and a full size content window. On macOS, the window still has the standard window controls (“traffic lights”) in the top left. On Windows, when combined with <code>titleBarOverlay: true</code> it will activate the Window Controls Overlay (see <code>titleBarOverlay</code> for more information), otherwise no window controls will be shown.</li>\n<li><code>hiddenInset</code> - Only on macOS, results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge.</li>\n<li><code>customButtonsOnHover</code> - Only on macOS, results in a hidden title bar and a full size content window, the traffic light buttons will display when being hovered over in the top left of the window.  <strong> 注意: </strong>此选项目前是实验性的。</li>\n</ul></li>\n<li><code>trafficLightPosition</code> <a href=\"/docs/api/structures/point\">Point</a> (可选的) - 设置控制按钮在无边框窗口中的位置。</li>\n<li><code>roundedCorners</code> Boolean (可选) - 无框窗口是否应该在 macOS 上 圆角。 默认值为 <code>true</code>。</li>\n<li><code>fullscreenWindowTitle</code> Boolean (可选) <em>已弃用</em> - macOS全屏模式下，在标题栏展示标题，需要 titleBarStyle 设置 <code>hiddenInset</code> 属性。 默认值为 <code>false</code>.</li>\n<li><code>thickFrame</code> Boolean(可选)-对 Windows 上的无框窗口使用<code>WS_THICKFRAME</code> 样式，会增加标准窗口框架。 设置为 <code>false</code> 时将移除窗口的阴影和动画. 默认值为 <code>true</code>。</li>\n<li><code>vibrancy</code> String (可选) - 窗口是否使用 vibrancy 动态效果, 仅 macOS 中有效. 可选值为 <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>titlebar</code>, <code>selection</code>, <code>menu</code>, <code>popover</code>, <code>sidebar</code>, <code>medium-light</code>, <code>ultra-dark</code>, <code>header</code>, <code>sheet</code>, <code>window</code>, <code>hud</code>, <code>fullscreen-ui</code>, <code>tooltip</code>, <code>content</code>, <code>under-window</code> 或 <code>under-page</code>。 请注意： <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>medium-light</code>, and <code>ultra-dark</code> 已被弃用，并将在即将推出的 macOS Catalina (10.15版本) 中被移除。</li>\n<li><code>zoomToPageWidth</code> Boolean (可选) - 控制 macOS 上，当选择性单击工具栏上的绿色stoplight按钮或单击 Window > Zoom menu item时的行为。 如果为 <code>true</code>, 窗口将放大到网页的本身宽度, <code>false</code> 将使其缩放到屏幕的宽度。 这也会影响直接调用 <code>maximize()</code> 时的行为。 默认值为 <code>false</code>.</li>\n<li><code>tabbingIdentifier</code> String (可选) - 选项组卡的名称，在macOS 10.12+上可使窗口在原生选项卡中打开. 具有相同标识符的窗口将被组合在一起。 这还会在窗口的标签栏中添加一个原生的新选项卡按钮, 并允许 <code>app</code> 和窗口接收 <code> new-window-for-tab</code> 事件。</li>\n<li><code>webPreferences</code> Object (可选) - 网页功能设置。<ul>\n<li><code>devTools</code> Boolean (可选) - 是否开启 DevTools. 如果设置为 <code>false</code>, 则无法使用 <code>BrowserWindow.webContents.openDevTools ()</code> 打开 DevTools。 默认值为 <code>true</code>。</li>\n<li><code>nodeIntegration</code> Boolean (可选) - 是否启用Node integration. 默认值为 <code>false</code>.</li>\n<li><code>nodeIntegrationInWorker</code> Boolean (可选) - 是否在Web工作器中启用了Node集成. 默认值为 <code>false</code>. 更多内容参见 <a href=\"/docs/tutorial/multithreading\">多线程</a>.</li>\n<li><code>nodeIntegrationInSubFrames</code> Boolean (可选项)(实验性)，是否允许在子页面(iframe)或子窗口(child window)中集成Node.js； 预先加载的脚本会被注入到每一个iframe，你可以用 <code>process.isMainFrame</code> 来判断当前是否处于主框架（main frame）中。</li>\n<li><code>preload</code> String (可选) -在页面运行其他脚本之前预先加载指定的脚本 无论页面是否集成Node, 此脚本都可以访问所有Node API 脚本路径为文件的绝对路径。 当 node integration 关闭时, 预加载的脚本将从全局范围重新引入node的全局引用标志 <a href=\"/docs/api/context-bridge#exposing-node-global-symbols\">参考示例</a>.</li>\n<li><code>sandbox</code> Boolean (可选)-如果设置该参数, 沙箱的渲染器将与窗口关联, 使它与Chromium OS-level 的沙箱兼容, 并禁用 Node. js 引擎。 它与 <code>nodeIntegration</code> 的选项不同，且预加载脚本的 API 也有限制. <a href=\"/docs/tutorial/sandbox\">更多详情</a>.</li>\n<li><code>session</code> <a href=\"/docs/api/session#class-session\">Session</a> (可选) - 设置页面的 session 而不是直接忽略 Session 对象, 也可用 <code>partition</code> 选项来代替，它接受一个 partition 字符串. 同时设置了<code>session</code> 和 <code>partition</code>时, <code>session</code> 的优先级更高. 默认使用默认的 session.</li>\n<li><code>partition</code> String (optional) - 通过 session 的 partition 字符串来设置界面session. 如果 <code>partition</code> 以 <code>persist:</code>开头, 该页面将使用持续的 session，并在所有页面生效，且使用同一个<code>partition</code>. 如果没有 <code>persist:</code> 前缀, 页面将使用 in-memory session. 通过分配相同的 <code>partition</code>, 多个页可以共享同一会话。 默认使用默认的 session.</li>\n<li><code>zoomFactor</code> Number (可选) - 页面的默认缩放系数, <code>3.0</code> 表示 <code>300%</code>。 默认值为 <code>1.0</code>.</li>\n<li><code>javascript</code> Boolean (可选) - 是否启用 JavaScript 支持。 默认值为 <code>true</code>。</li>\n<li><code>webSecurity</code> Boolean (可选) - 当设置为 <code>false</code>, 它将禁用同源策略 (通常用来测试网站), 如果此选项不是由开发者设置的，还会把 <code>allowRunningInsecureContent</code>设置为 <code>true</code>. 默认值为 <code>true</code>。</li>\n<li><code>allowRunningInsecureContent</code> Boolean (可选) - 允许一个 https 页面运行来自http url的JavaScript, CSS 或 plugins。 默认值为 <code>false</code>.</li>\n<li><code>images</code> Boolean (可选) - 允许加载图片。 默认值为 <code>true</code>。</li>\n<li><code>imageAnimationPolicy</code> String (optional) - Specifies how to run image animations (E.g. GIFs).  Can be <code>animate</code>, <code>animateOnce</code> or <code>noAnimation</code>.  默认值为 <code>animate</code>.</li>\n<li><code>textAreasAreResizable</code> Boolean (可选) - 允许调整 TextArea 元素大小。 默认值为 <code>true</code>。</li>\n<li><code>webgl</code> Boolean (可选) - 启用 WebGL 支持。 默认值为 <code>true</code>。</li>\n<li><code>plugins</code> Boolean (可选) - 是否应该启用插件。 默认值为 <code>false</code>.</li>\n<li><code>experimentalFeatures</code> Boolean (可选) - 启用 Chromium 的实验功能。 默认值为 <code>false</code>.</li>\n<li><code>scrollBounce</code> Boolean (可选) - 在 macOS 启用弹力动画 (橡皮筋) 效果。 默认值为 <code>false</code>.</li>\n<li><code>enableBlinkFeatures</code>String(可选) - 以<code>逗号</code>分隔的需要启用的特性列表，譬如<code>CSSVariables,KeyboardEventKey</code> 在 <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a>文件中查看被支持的所有特性.</li>\n<li><code>disableBlinkFeatures</code> String (可选) - 以 <code>,</code>分隔的禁用特性列表, 如 <code>CSSVariables,KeyboardEventKey</code>. 在<a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> 文件中查看被支持的所有特性.</li>\n<li><code>defaultFontFamily</code> Object (可选) - 为font-family设置默认字体。<ul>\n<li><code>standard</code> String (可选) - 默认值为 <code>Times New Roman</code>.</li>\n<li><code>serif</code> String (可选) - 默认值为 <code>Times New Roman</code>.</li>\n<li><code>sansSerif</code> String (可选) - 默认值为 <code>Arial</code>.</li>\n<li><code>monospace</code> String (可选) - 默认值为 <code>Courier New</code>.</li>\n<li><code>cursive</code> String (可选) - 默认值为 <code>Script</code>.</li>\n<li><code>fantasy</code> String (可选) - 默认值为 <code>Impact</code>.</li>\n</ul></li>\n<li><code>defaultFontSize</code> Integer (可选) - 默认值为 <code>16</code>.</li>\n<li><code>defaultMonospaceFontSize</code> Integer (可选) - 默认值为 <code>13</code>.</li>\n<li><code>minimumFontSize</code> Integer (可选) - 默认值为 <code>0</code>.</li>\n<li><code>defaultEncoding</code> String (可选) - 默认值为 <code>ISO-8859-1</code>.</li>\n<li><code>backgroundThrottling</code>Boolean (可选)-是否在页面成为背景时限制动画和计时器。 这也会影响到 <a href=\"#page-visibility\">Page Visibility API</a>. 默认值为 <code>true</code>。</li>\n<li><code>offscreen</code> Boolean (optional) - 是否绘制和渲染可视区域外的窗口. 默认值为 <code>false</code>. 更多详情, 请参见 <a href=\"/docs/tutorial/offscreen-rendering\"> offscreen rendering tutorial </a>。</li>\n<li><code>contextIsolation</code> Boolean (可选) - 是否在独立 JavaScript 环境中运行 Electron API和指定的<code>preload</code> 脚本. 默认为 <code>true</code>。 <code>预加载</code>脚本所运行的上下文环境只能访问其自身专用的<code>文档</code>和全局<code>窗口</code>，其自身一系列内置的JavaScript (<code>Array</code>, <code>Object</code>, <code>JSON</code>, 等等) 也是如此，这些对于已加载的内容都是不可见的。 Electron API 将只在<code>预加载</code>脚本中可用，在已加载页面中不可用。 这个选项应被用于加载可能不被信任的远程内容时来确保加载的内容无法篡改<code>预加载</code>脚本和任何正在使用的Electron api。  该选项使用的是与<a href=\"https://developer.chrome.com/extensions/content_scripts#execution-environment\">Chrome内容脚本</a>相同的技术。  你可以在开发者工具Console选项卡内顶部组合框中选择 'Electron Isolated Context'条目来访问这个上下文。</li>\n<li><code>nativeWindowOpen</code> Boolean (可选) - 是否使用原生的<code>window.open()</code>. 默认值为 <code>true</code>。 除了 <code>nodeIntegrationInSubFrames</code> 为true时，其它情况下node integration将永远禁用。</li>\n<li><code>webviewTag</code> Boolean (可选) - 是否启用 <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code> tag</a>标签. 默认值为 <code>false</code>. <strong> 注意: </strong>为 <code>&#x3C; webview></code> 配置的 <code>preload</code> 脚本在执行时将启用节点集成, 因此应确保远程或不受信任的内容无法创建恶意的 <code>preload</code> 脚本 。 可以使用 <a href=\"/docs/api/web-contents\"> webContents </a> 上的 <code>will-attach-webview</code> 事件对 <code>preload</code> 脚本进行剥离, 并验证或更改 <code>&#x3C;webview></code> 的初始设置。</li>\n<li><code>additionalArguments</code> String<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a> - 一个将被附加到当前应用程序的渲染器进程中<code>process.argv</code>的字符串列表 。  可用于将少量的数据传递到渲染器进程预加载脚本中。</li>\n<li><code>safeDialogs</code> Boolean (可选) - 是否启用浏览器样式的持续对话框保护。 默认值为 <code>false</code>.</li>\n<li><code>safeDialogsMessage</code> String (可选) - 当持续对话框保护被触发时显示的消息。 如果没有定义，那么将使用缺省的消息。注意：当前缺省消息是英文，并没有本地化。</li>\n<li><code>disableDialogs</code> Boolean (可选) - 是否完全禁用对话框。 覆盖 <code>safeDialogs</code>。 默认值为 <code>false</code>.</li>\n<li><code>navigateOnDragDrop</code> Boolean (可选) - 将文件或链接拖放到页面上时是否触发页面跳转。 默认值为 <code>false</code>.</li>\n<li><code>autoplayPolicy</code> String (可选) - 窗口中内容要使用的自动播放策略，值可以是 <code>no-user-gesture-required</code>, <code>user-gesture-required</code>, <code>document-user-activation-required</code>。 默认为 <code>no-user-gesture-required</code>。</li>\n<li><code>disableHtmlFullscreenWindowResize</code> Boolean (可选) - 是否阻止窗口在进入 HTML 全屏时调整大小。 默认值为 <code>false</code>.</li>\n<li><code>accessibleTitle</code> String (可选) - 仅提供给如屏幕读取器等辅助工具的替代标题字符串。 此字符串不直接对用户可见。</li>\n<li><code>spellcheck</code> Boolean (可选) - 是否启用内置拼写检查器。 默认值为 <code>true</code>。</li>\n<li><code>enableWebSQL</code> Boolean (可选) - 是否启用 <a href=\"https://www.w3.org/TR/webdatabase/\">WebSQL api</a>。 默认值为 <code>true</code>。</li>\n<li><code>v8CacheOptions</code> String (可选) - 强制 blink 使用 v8 代码缓存策略。 可接受的值为：<ul>\n<li><code>none</code> - 禁用代码缓存</li>\n<li><code>code</code> - 基于启发式代码缓存</li>\n<li><code>bypassHeatCheck</code> - 绕过启发式代码缓存，但使用懒编译。</li>\n<li><code>bypassHeatCheckAndEagerCompile</code> - 与上面相同，除了编译是及时的。 默认策略是 <code>code</code>。</li>\n</ul></li>\n<li><code>enablePreferredSizeMode</code> Boolean (可选) - 是否启用首选大小模式。 首选大小是包含文档布局所需的最小大小--无需滚动。 启用该属性将导致在首选大小发生变化时，在<code>WebContents</code> 上触发 <code>preferred-size-changed</code> 事件。 默认值为 <code>false</code>.</li>\n</ul></li>\n<li><code>titleBarOverlay</code> Object | Boolean (optional) -  When using a frameless window in conjuction with <code>win.setWindowButtonVisibility(true)</code> on macOS or using a <code>titleBarStyle</code> so that the standard window controls (\"traffic lights\" on macOS) are visible, this property enables the Window Controls Overlay <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis\">JavaScript APIs</a> and <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables\">CSS Environment Variables</a>. Specifying <code>true</code> will result in an overlay with default system colors. 默认值为 <code>false</code>.<ul>\n<li><code>color</code> String (optional) <em>Windows</em> - The CSS color of the Window Controls Overlay when enabled. Default is the system color.</li>\n<li><code>symbolColor</code> String (optional) <em>Windows</em> - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>当使用 <code>minWidth</code>/<code>maxWidth</code>/<code>minHeight</code>/<code>maxHeight</code> 设置最小或最大窗口大小时, 它只限制用户。 它不会阻止您将不符合大小限制的值传递给 <code>setBounds</code>/<code>setSize</code> 或 <code>BrowserWindow</code> 的构造函数。</p>\n<p><code>type</code> 选项的候选值和行为与平台相关。 可能的值有</p>\n<ul>\n<li>在 Linux 上, 可能的类型有 <code>desktop</code>、<code>dock</code>、<code>toolbar</code>、<code>splash</code>、<code>notification</code>。</li>\n<li>在 macOS 上，可能的类型是 <code>desktop</code>, <code>textured</code>。<ul>\n<li><code>textured</code> 类型增加金属色泽的外观 (<code>NSTexturedBackgroundWindowMask</code>).</li>\n<li><code>desktop</code> 类型将窗口置于桌面背景级别 (<code>kCGDesktopWindowLevel - 1</code>). 注意，桌面窗口不会接收焦点、键盘或鼠标事件，但您可以使用&#x3C; 0> globalShortcut &#x3C; /0 >接收快捷键的消息</li>\n</ul></li>\n<li>在 Windows 上, 可能的类型为 <code>toolbar</code>.</li>\n</ul>\n<h3 id=\"实例事件\"><a href=\"#实例事件\">实例事件</a></h3>\n<p>使用 <code>new BrowserWindow </code> 创建的对象具有以下属性:</p>\n<p><strong> 注意: </strong>某些事件仅在特定的操作系统上可用, 这些方法会被标记出来。</p>\n<h4 id=\"事件：-page-title-updated\"><a href=\"#事件：-page-title-updated\">事件： 'page-title-updated'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>文档更改标题时触发，调用<code>event.preventDefault()</code>将阻止更改标题 当标题合成自文件 URL 中时， <code>explicitSet</code> 的值为false。</p>\n<h4 id=\"事件：-close\"><a href=\"#事件：-close\">事件： 'close'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>在窗口要关闭的时候触发。 它在DOM 的<code>beforeunload</code> 和 <code>unload</code> 事件之前触发. 调用<code>event.preventDefault()</code>将阻止这个操作。</p>\n<p>通常你想通过 <code>beforeunload</code>处理器来决定是否关闭窗口，但是它也会在窗口重载的时候触发. 在 Electron 里，返回除 <code>undefined</code>之外的任何值都将取消关闭. 例如：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-built_in\">window</span>.onbeforeunload = <span class=\"hljs-function\">(<span class=\"hljs-params\">e</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'I do not want to be closed'</span>)\n\n  <span class=\"hljs-comment\">// 与通常的浏览器不同,会提示给用户一个消息框,</span>\n  <span class=\"hljs-comment\">//返回非空值将默认取消关闭</span>\n  <span class=\"hljs-comment\">//建议使用对话框 API 让用户确认关闭应用程序.</span>\n  e.returnValue = <span class=\"hljs-literal\">false</span> <span class=\"hljs-comment\">// 相当于 `return false` ，但是不推荐使用</span>\n}\n</code></pre>\n<p><em><strong>注意</strong>: <code>window.onbeforeunload = handler</code> 和 <code>window.addEventListener('beforeunload', handler)</code> 的行为有细微的区别。 推荐总是显式地设置 <code>event.returnValue</code>, 而不是仅仅返回一个值, 因为前者在Electron中作用得更为一致.</em></p>\n<h4 id=\"事件：-closed\"><a href=\"#事件：-closed\">事件： 'closed'</a></h4>\n<p>在窗口关闭时触发 当你接收到这个事件的时候, 你应当移除相应窗口的引用对象，避免再次使用它.</p>\n<h4 id=\"事件-session-end-windows\"><a href=\"#事件-session-end-windows\">事件: 'session-end' <em>Windows</em></a></h4>\n<p>因为强制关机或机器重启或会话注销而导致窗口会话结束时触发</p>\n<h4 id=\"事件-unresponsive\"><a href=\"#事件-unresponsive\">事件: 'unresponsive'</a></h4>\n<p>网页变得未响应时触发</p>\n<h4 id=\"事件-responsive\"><a href=\"#事件-responsive\">事件: 'responsive'</a></h4>\n<p>未响应的页面变成响应时触发</p>\n<h4 id=\"事件-blur\"><a href=\"#事件-blur\">事件: 'blur'</a></h4>\n<p>当窗口失去焦点时触发</p>\n<h4 id=\"事件-focus\"><a href=\"#事件-focus\">事件: 'focus'</a></h4>\n<p>当窗口获得焦点时触发</p>\n<h4 id=\"事件-show\"><a href=\"#事件-show\">事件: 'show'</a></h4>\n<p>当窗口显示时触发</p>\n<h4 id=\"事件-hide\"><a href=\"#事件-hide\">事件: 'hide'</a></h4>\n<p>当窗口隐藏时触发</p>\n<h4 id=\"事件-ready-to-show\"><a href=\"#事件-ready-to-show\">事件: 'ready-to-show'</a></h4>\n<p>当页面已经渲染完成(但是还没有显示) 并且窗口可以被现实时触发</p>\n<p>请注意，使用此事件意味着渲染器会被认为是\"可见的\"并绘制，即使 <code>show</code> 是false。  如果您使用 <code>paintWhenInitiallyHidden: false</code>，此事件将永远不会被触发。</p>\n<h4 id=\"事件-maximize\"><a href=\"#事件-maximize\">事件: 'maximize'</a></h4>\n<p>窗口最大化时触发</p>\n<h4 id=\"事件-unmaximize\"><a href=\"#事件-unmaximize\">事件: 'unmaximize'</a></h4>\n<p>当窗口从最大化状态退出时触发</p>\n<h4 id=\"事件-minimize\"><a href=\"#事件-minimize\">事件: 'minimize'</a></h4>\n<p>窗口最小化时触发</p>\n<h4 id=\"事件-restore\"><a href=\"#事件-restore\">事件: 'restore'</a></h4>\n<p>当窗口从最小化状态恢复时触发</p>\n<h4 id=\"事件-will-resize-macos-windows\"><a href=\"#事件-will-resize-macos-windows\">事件: 'will-resize' <em>macOS</em> <em>Windows</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newBounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - 将要调整到的窗口尺寸。</li>\n<li><code>details</code> Object<ul>\n<li><code>edge</code> (String) - The edge of the window being dragged for resizing. Can be <code>bottom</code>, <code>left</code>, <code>right</code>, <code>top-left</code>, <code>top-right</code>, <code>bottom-left</code> or <code>bottom-right</code>.</li>\n</ul></li>\n</ul>\n<p>调整窗口大小前触发。 调用 <code>event.preventDefault()</code> 将阻止窗口大小调整。</p>\n<p>请注意，该事件仅在手动调整窗口大小时触发。 通过 <code>setBounds</code>/<code>setSize</code> 调整窗口大小不会触发此事件。</p>\n<p>The possible values and behaviors of the <code>edge</code> option are platform dependent. 可能的值有</p>\n<ul>\n<li>On Windows, possible values are <code>bottom</code>, <code>top</code>, <code>left</code>, <code>right</code>, <code>top-left</code>, <code>top-right</code>, <code>bottom-left</code>, <code>bottom-right</code>.</li>\n<li>On macOS, possible values are <code>bottom</code> and <code>right</code>.<ul>\n<li>The value <code>bottom</code> is used to denote vertical resizing.</li>\n<li>The value <code>right</code> is used to denote horizontal resizing.</li>\n</ul></li>\n</ul>\n<h4 id=\"事件-resize\"><a href=\"#事件-resize\">事件: 'resize'</a></h4>\n<p>调整窗口大小后触发。</p>\n<h4 id=\"事件：resized-macos-windows\"><a href=\"#事件：resized-macos-windows\">事件：'resized' <em>macOS</em> <em>Windows</em></a></h4>\n<p>当窗口完成调整大小后触发一次。</p>\n<p>这通常在手动调整窗口大小后触发。 在 macOS 系统上，使用<code>setBounds</code>/<code>setSize</code>调整窗口大小并将<code>animate</code>参数设置为<code>true</code>也会在调整大小完成后触发此事件。</p>\n<h4 id=\"事件-will-move-macos-windows\"><a href=\"#事件-will-move-macos-windows\">事件: 'will-move' <em>macOS</em> <em>Windows</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newBounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - 窗口将要被移动到的位置。</li>\n</ul>\n<p>窗口移动前触发。 在Windows上，调用 <code>event.preventDefault()</code> 将阻止窗口移动。</p>\n<p>请注意，该事件仅在手动调整窗口大小时触发。 通过 <code>setBounds</code>/<code>setSize</code> 调整窗口大小不会触发此事件。</p>\n<h4 id=\"事件-move\"><a href=\"#事件-move\">事件: 'move'</a></h4>\n<p>窗口移动到新位置时触发</p>\n<h4 id=\"事件-moved-macos-windows\"><a href=\"#事件-moved-macos-windows\">事件: 'moved' <em>macOS</em> <em>Windows</em></a></h4>\n<p>当窗口移动到新位置时触发一次</p>\n<p><strong>注意</strong>: 在 macOS 上，此事件是<code>move</code>的别名。</p>\n<h4 id=\"事件-enter-full-screen\"><a href=\"#事件-enter-full-screen\">事件: 'enter-full-screen'</a></h4>\n<p>窗口进入全屏状态时触发</p>\n<h4 id=\"事件-leave-full-screen\"><a href=\"#事件-leave-full-screen\">事件: 'leave-full-screen'</a></h4>\n<p>窗口离开全屏状态时触发</p>\n<h4 id=\"事件-enter-html-full-screen\"><a href=\"#事件-enter-html-full-screen\">事件: 'enter-html-full-screen'</a></h4>\n<p>窗口进入由HTML API 触发的全屏状态时触发</p>\n<h4 id=\"事件-leave-html-full-screen\"><a href=\"#事件-leave-html-full-screen\">事件: 'leave-html-full-screen'</a></h4>\n<p>窗口离开由HTML API触发的全屏状态时触发</p>\n<h4 id=\"事件-always-on-top-changed\"><a href=\"#事件-always-on-top-changed\">事件: 'always-on-top-changed'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>isAlwaysOnTop</code> Boolean</li>\n</ul>\n<p>设置或取消设置窗口总是在其他窗口的顶部显示时触发。</p>\n<h4 id=\"事件：-app-command-windows__linux\"><a href=\"#事件：-app-command-windows__linux\">事件： 'app-command' <em>Windows__Linux</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>command</code> String</li>\n</ul>\n<p>请求一个<a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/ms646275(v=vs.85).aspx\">应用程序命令</a>时触发. 典型的是键盘上的媒体键或浏览器命令, 以及在Windows上的一些鼠标中内置的“后退”按钮。</p>\n<p>命令是小写的，下划线替换为连字符，以及<code>APPCOMMAND_</code> 前缀将被删除。 例如 <code>APPCOMMAND_BROWSER_BACKWARD</code>将被<code>browser-backward</code>触发.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-comment\">// 当用户鼠标单击返回按钮时将自动返回上一个窗口</span>\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'browser-backward'</span> &#x26;&#x26; win.webContents.canGoBack()) {\n    win.webContents.goBack()\n  }\n})\n</code></pre>\n<p>以下应用命令在 Linux 上有明确地支持：</p>\n<ul>\n<li><code>browser-backward</code></li>\n<li><code>browser-forward</code></li>\n</ul>\n<h4 id=\"事件-scroll-touch-begin-macos\"><a href=\"#事件-scroll-touch-begin-macos\">事件: 'scroll-touch-begin' <em>macOS</em></a></h4>\n<p>滚轮事件阶段开始时触发</p>\n<h4 id=\"事件-scroll-touch-end-macos\"><a href=\"#事件-scroll-touch-end-macos\">事件: 'scroll-touch-end' <em>macOS</em></a></h4>\n<p>滚轮事件阶段结束时触发</p>\n<h4 id=\"事件-scroll-touch-edge-macos\"><a href=\"#事件-scroll-touch-edge-macos\">事件: 'scroll-touch-edge' <em>macOS</em></a></h4>\n<p>滚轮事件阶段到达元素边缘时触发</p>\n<h4 id=\"事件-swipe-macos\"><a href=\"#事件-swipe-macos\">事件: 'swipe' <em>macOS</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>direction</code> String</li>\n</ul>\n<p>三指滑动时触发。 可能的方向是 <code>up</code>, <code>right</code>, <code>down</code>, <code>left</code>。</p>\n<p>此事件的基本方法是用来处理旧的macOS风格的触摸板滑动，屏幕内容不会随着滑动而移动。 大多数macOS触摸板都不再允许配置这样的滑动，因此为了正确地触发该事件，需将<code>System Preferences > Trackpad > More Gestures</code>中'Swipe between pages'首选项设置为'Swipe with two or three fingers'。</p>\n<h4 id=\"事件-rotate-gesture-macos\"><a href=\"#事件-rotate-gesture-macos\">事件: 'rotate-gesture' <em>macOS</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>rotation</code> Float</li>\n</ul>\n<p>在触控板旋转手势上触发。 持续触发直到旋转手势结束。 每次触发的 <code>rotation</code> 值是自上次触发以来旋转的角度。 旋转手势最后一次触发的事件值永远是<code>0</code>。 逆时针旋转值为正值，顺时针旋转值为负值。</p>\n<h4 id=\"事件-sheet-begin-macos\"><a href=\"#事件-sheet-begin-macos\">事件: 'sheet-begin' <em>macOS</em></a></h4>\n<p>窗口打开sheet(工作表) 时触发</p>\n<h4 id=\"事件-sheet-end-macos\"><a href=\"#事件-sheet-end-macos\">事件: 'sheet-end' <em>macOS</em></a></h4>\n<p>窗口关闭sheet(工作表) 时触发</p>\n<h4 id=\"事件-new-window-for-tab-macos\"><a href=\"#事件-new-window-for-tab-macos\">事件: 'new-window-for-tab' <em>macOS</em></a></h4>\n<p>当点击了系统的新标签按钮时触发</p>\n<h4 id=\"事件-system-context-menu-windows\"><a href=\"#事件-system-context-menu-windows\">事件: 'system-context-menu' <em>Windows</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a> - 上下文菜单触发时的屏幕坐标。</li>\n</ul>\n<p>当系统上下文菜单在窗口上触发时发出， 通常只在用户右键点击你窗口的非客户端区域时触发。  非客户端区域指的是窗口标题栏或无边框窗口中被你声明为 <code>-webkit-app-region: drag</code> 的任意区域。</p>\n<p>调用 <code>event.preventDefault()</code> 将阻止菜单显示。</p>\n<h3 id=\"静态方法\"><a href=\"#静态方法\">静态方法</a></h3>\n<p><code>BrowserWindow</code> 类有以下方法:</p>\n<h4 id=\"browserwindowgetallwindows\"><a href=\"#browserwindowgetallwindows\"><code>BrowserWindow.getAllWindows()</code></a></h4>\n<p>返回 <code>BrowserWindow[]</code> - 所有打开的窗口的数组</p>\n<h4 id=\"browserwindowgetfocusedwindow\"><a href=\"#browserwindowgetfocusedwindow\"><code>BrowserWindow.getFocusedWindow()</code></a></h4>\n<p>返回 <code>BrowserWindow | null</code> - 此应用程序中当前获得焦点的窗口，如果无就返回 <code>null</code>.</p>\n<h4 id=\"browserwindowfromwebcontentswebcontents\"><a href=\"#browserwindowfromwebcontentswebcontents\"><code>BrowserWindow.fromWebContents(webContents)</code></a></h4>\n<ul>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>返回 <code>BrowserWindow | null</code> - 返回拥有给定 <code>webContents</code>的窗口，否则如果内容不属于一个窗口，返回<code>null</code>。</p>\n<h4 id=\"browserwindowfrombrowserviewbrowserview\"><a href=\"#browserwindowfrombrowserviewbrowserview\"><code>BrowserWindow.fromBrowserView(browserView)</code></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>返回 <code>BrowserWindow | null</code> - 拥有给定 <code>browserView</code> 的窗口。 如果给定的视图没有附加到任何窗口，返回 <code>null</code>。</p>\n<h4 id=\"browserwindowfromidid\"><a href=\"#browserwindowfromidid\"><code>BrowserWindow.fromId(id)</code></a></h4>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>返回 <code>BrowserWindow | null</code> - 带有给定 <code>id</code> 的窗口。</p>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<p>使用 <code>new BrowserWindow </code> 创建的对象具有以下属性:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">// 本例中 `win` 是我们的实例</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<h4 id=\"winwebcontents-只读\"><a href=\"#winwebcontents-只读\"><code>win.webContents</code> <em>只读</em></a></h4>\n<p>此窗口拥有的 <code>WebContents</code> 对象。 所有与网页相关的事件和操作都将通过它完成。</p>\n<p>有关它的方法和事件, 请参见 <a href=\"/docs/api/web-contents\"><code>webContents</code> documentation</a></p>\n<h4 id=\"winid-只读\"><a href=\"#winid-只读\"><code>win.id</code> <em>只读</em></a></h4>\n<p>一个 <code>Integer</code> 属性代表了窗口的唯一ID。 每个ID在整个Electron应用程序的所有 <code>BrowserWindow</code> 实例中都是唯一的。</p>\n<h4 id=\"winautohidemenubar\"><a href=\"#winautohidemenubar\"><code>win.autoHideMenuBar</code></a></h4>\n<p>一个 <code>Boolean</code> 属性决定窗口菜单栏是否自动隐藏。 一旦设置，菜单栏将只在用户单击 <code>Alt</code> 键时显示。</p>\n<p>如果菜单栏已经可见，将该属性设置为 <code>true</code> 将不会使其立刻隐藏。</p>\n<h4 id=\"winsimplefullscreen\"><a href=\"#winsimplefullscreen\"><code>win.simpleFullScreen</code></a></h4>\n<p>一个 <code>Boolean</code> 属性，用于决定窗口是否处于简单(pre-Lion) 全屏模式。</p>\n<h4 id=\"winfullscreen\"><a href=\"#winfullscreen\"><code>win.fullScreen</code></a></h4>\n<p>一个 <code>Boolean</code> 属性，用于决定窗口是否处于全屏模式。</p>\n<h4 id=\"winfocusable-windows-macos\"><a href=\"#winfocusable-windows-macos\"><code>win.focusable</code> <em>Windows</em> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is focusable.</p>\n<h4 id=\"winvisibleonallworkspaces\"><a href=\"#winvisibleonallworkspaces\"><code>win.visibleOnAllWorkspaces</code></a></h4>\n<p>一个 <code>Boolean</code> 属性，用于决定窗口是否在所有工作区中可见。</p>\n<p><strong>注意：</strong> 在 Windows 上始终返回 false。</p>\n<h4 id=\"winshadow\"><a href=\"#winshadow\"><code>win.shadow</code></a></h4>\n<p>一个 <code>Boolean</code> 属性，用于决定窗口是否显示阴影。</p>\n<h4 id=\"winmenubarvisible-windows-linux\"><a href=\"#winmenubarvisible-windows-linux\"><code>win.menuBarVisible</code> <em>Windows</em> <em>Linux</em></a></h4>\n<p>一个 <code>Boolean</code> 属性，用于决定菜单栏是否可见。</p>\n<p><strong>注意：</strong> 如果菜单栏自动隐藏，用户仍然可以通过单击 <code>Alt</code> 键来唤出菜单栏。</p>\n<h4 id=\"winkiosk\"><a href=\"#winkiosk\"><code>win.kiosk</code></a></h4>\n<p>一个 <code>Boolean</code> 属性，用于决定窗口是否处于kiosk模式。</p>\n<h4 id=\"windocumentedited-macos\"><a href=\"#windocumentedited-macos\"><code>win.documentEdited</code> <em>macOS</em></a></h4>\n<p>一个 <code>Boolean</code> 属性指明窗口文档是否已被编辑。</p>\n<p>当设置为 <code>true</code> 时，标题栏的图标将变灰。</p>\n<h4 id=\"winrepresentedfilename-macos\"><a href=\"#winrepresentedfilename-macos\"><code>win.representedFilename</code> <em>macOS</em></a></h4>\n<p>一个 <code>String</code> 属性，用于确定窗口代表的文件的路径名，文件的图标将显示在窗口的标题栏中。</p>\n<h4 id=\"wintitle\"><a href=\"#wintitle\"><code>win.title</code></a></h4>\n<p>一个 <code>String</code> 属性，用于确定原生窗口的标题。</p>\n<p><strong>注意：</strong> 网页的标题可以与原生窗口的标题不同。</p>\n<h4 id=\"winminimizable\"><a href=\"#winminimizable\"><code>win.minimizable</code></a></h4>\n<p>一个 <code>Boolean</code> 属性，用于决定窗口是否可被用户手动最小化。</p>\n<p>在 Linux 上，setter 不会进行任何操作，尽管 getter 返回的是 <code>true</code>。</p>\n<h4 id=\"winmaximizable\"><a href=\"#winmaximizable\"><code>win.maximizable</code></a></h4>\n<p>一个 <code>Boolean</code> 属性，用于决定窗口是否可被用户手动最大化。</p>\n<p>在 Linux 上，setter 不会进行任何操作，尽管 getter 返回的是 <code>true</code>。</p>\n<h4 id=\"winfullscreenable\"><a href=\"#winfullscreenable\"><code>win.fullScreenable</code></a></h4>\n<p>一个 <code>Boolean</code> 属性，决定最大化/缩放窗口按钮是切换全屏模式还是最大化窗口。</p>\n<h4 id=\"winresizable\"><a href=\"#winresizable\"><code>win.resizable</code></a></h4>\n<p>一个 <code>Boolean</code> 属性，用于决定窗口是否可被用户手动调整大小。</p>\n<h4 id=\"winclosable\"><a href=\"#winclosable\"><code>win.closable</code></a></h4>\n<p>一个 <code>Boolean</code> 属性，用于决定窗口是否可被用户手动关闭。</p>\n<p>在 Linux 上，setter 不会进行任何操作，尽管 getter 返回的是 <code>true</code>。</p>\n<h4 id=\"winmovable\"><a href=\"#winmovable\"><code>win.movable</code></a></h4>\n<p>一个 <code>Boolean</code> 属性，用于决定窗口是否可被用户移动。</p>\n<p>在 Linux 上，setter 不会进行任何操作，尽管 getter 返回的是 <code>true</code>。</p>\n<h4 id=\"winexcludedfromshownwindowsmenu-macos\"><a href=\"#winexcludedfromshownwindowsmenu-macos\"><code>win.excludedFromShownWindowsMenu</code> <em>macOS</em></a></h4>\n<p>一个 <code>Boolean</code> 属性，用于决定窗口是否从应用程序的 Windows 菜单排除。 默认值为 <code>false</code></p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-keyword\">const</span> template = [\n  {\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'windowmenu'</span>\n  }\n]\n\nwin.excludedFromShownWindowsMenu = <span class=\"hljs-literal\">true</span>\n\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\nMenu.setApplicationMenu(menu)\n</code></pre>\n<h4 id=\"winaccessibletitle\"><a href=\"#winaccessibletitle\"><code>win.accessibleTitle</code></a></h4>\n<p>一个 <code>String</code> 属性，定义一个仅为如屏幕阅读器等辅助工具提供的替代标题 。 此字符串不直接对用户可见。</p>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<p>使用 <code>new BrowserWindow </code>创建的对象具有以下实例方法:</p>\n<p><strong> 注意: </strong>某些方法仅在特定的操作系统上可用, 这些方法会被标记出来。</p>\n<h4 id=\"windestroy\"><a href=\"#windestroy\"><code>win.destroy()</code></a></h4>\n<p>强制关闭窗口, 除了<code>closed</code>之外，<code>close</code>，<code>unload</code> 和 <code>beforeunload</code> 都不会被触发</p>\n<h4 id=\"winclose\"><a href=\"#winclose\"><code>win.close()</code></a></h4>\n<p>尝试关闭窗口。 该方法与用户手动单击窗口的关闭按钮效果相同。 但网页可能会取消这个关闭操作。 查看 <a href=\"#event-close\">关闭事件</a>。</p>\n<h4 id=\"winfocus\"><a href=\"#winfocus\"><code>win.focus()</code></a></h4>\n<p>聚焦于窗口</p>\n<h4 id=\"winblur\"><a href=\"#winblur\"><code>win.blur()</code></a></h4>\n<p>取消窗口的聚焦</p>\n<h4 id=\"winisfocused\"><a href=\"#winisfocused\"><code>win.isFocused()</code></a></h4>\n<p>返回 <code>Boolean</code> - 判断窗口是否聚焦</p>\n<h4 id=\"winisdestroyed\"><a href=\"#winisdestroyed\"><code>win.isDestroyed()</code></a></h4>\n<p>返回 <code>Boolean</code> -判断窗口是否被销毁</p>\n<h4 id=\"winshow\"><a href=\"#winshow\"><code>win.show()</code></a></h4>\n<p>显示并聚焦于窗口</p>\n<h4 id=\"winshowinactive\"><a href=\"#winshowinactive\"><code>win.showInactive()</code></a></h4>\n<p>显示但不聚焦于窗口</p>\n<h4 id=\"winhide\"><a href=\"#winhide\"><code>win.hide()</code></a></h4>\n<p>隐藏窗口</p>\n<h4 id=\"winisvisible\"><a href=\"#winisvisible\"><code>win.isVisible()</code></a></h4>\n<p>返回 <code>Boolean</code> - 判断窗口是否可见</p>\n<h4 id=\"winismodal\"><a href=\"#winismodal\"><code>win.isModal()</code></a></h4>\n<p>返回 <code>Boolean</code> - 判断是否为模态窗口</p>\n<h4 id=\"winmaximize\"><a href=\"#winmaximize\"><code>win.maximize()</code></a></h4>\n<p>最大化窗口。 如果窗口尚未显示，该方法也会将其显示 (但不会聚焦)。</p>\n<h4 id=\"winunmaximize\"><a href=\"#winunmaximize\"><code>win.unmaximize()</code></a></h4>\n<p>取消窗口最大化</p>\n<h4 id=\"winismaximized\"><a href=\"#winismaximized\"><code>win.isMaximized()</code></a></h4>\n<p>返回 <code>Boolean</code> - 判断窗口是否最大化</p>\n<h4 id=\"winminimize\"><a href=\"#winminimize\"><code>win.minimize()</code></a></h4>\n<p>最小化窗口。 在某些平台上, 最小化的窗口将显示在Dock中。</p>\n<h4 id=\"winrestore\"><a href=\"#winrestore\"><code>win.restore()</code></a></h4>\n<p>将窗口从最小化状态恢复到以前的状态。</p>\n<h4 id=\"winisminimized\"><a href=\"#winisminimized\"><code>win.isMinimized()</code></a></h4>\n<p>返回 <code>Boolean</code> -判断窗口是否最小化</p>\n<h4 id=\"winsetfullscreenflag\"><a href=\"#winsetfullscreenflag\"><code>win.setFullScreen(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>设置窗口是否应处于全屏模式。</p>\n<h4 id=\"winisfullscreen\"><a href=\"#winisfullscreen\"><code>win.isFullScreen()</code></a></h4>\n<p>返回 <code>Boolean</code> - 窗口当前是否已全屏</p>\n<h4 id=\"winsetsimplefullscreenflag-macos\"><a href=\"#winsetsimplefullscreenflag-macos\"><code>win.setSimpleFullScreen(flag)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>进入或离开简单的全屏模式。</p>\n<p>简单全屏模式模拟了 Lion (10.7) 之前的macOS版本中的原生全屏行为。</p>\n<h4 id=\"winissimplefullscreen-macos\"><a href=\"#winissimplefullscreen-macos\"><code>win.isSimpleFullScreen()</code> <em>macOS</em></a></h4>\n<p>返回 <code>Boolean</code> - 窗口是否为简单全屏模式(pre-Lion)。</p>\n<h4 id=\"winisnormal\"><a href=\"#winisnormal\"><code>win.isNormal()</code></a></h4>\n<p>返回 <code>Boolean</code> - 窗口是否处于正常状态（未最大化，未最小化，不在全屏模式下）。</p>\n<h4 id=\"winsetaspectratioaspectratio-extrasize\"><a href=\"#winsetaspectratioaspectratio-extrasize\"><code>win.setAspectRatio(aspectRatio[, extraSize])</code></a></h4>\n<ul>\n<li><code>aspectRatio</code> Float- 为内容视图保持的宽高比.</li>\n<li><code>extraSize</code> <a href=\"/docs/api/structures/size\">Size</a> (可选) <em>macOS</em> - 保持宽高比时不包括的额外大小。</li>\n</ul>\n<p>这将使窗口保持长宽比。 额外的大小允许开发人员有空间 (以像素为单位), 不包括在纵横比计算中。 此 API 已经考虑了窗口大小和内容大小之间的差异。</p>\n<p>想象一个使用高清视频播放器和相关控件的普通窗口。 假假如左边缘有15px, 右边缘有25px, 在播放器下面有50px. 为了保持播放器本身16:9 的长宽比 (标准的HD长宽比为1920x1080)， 我们可以使用 16/9 和 { width: 40, height: 50 } 的参数调用这个函数。 第二个参数不管网页中的额外的宽度和高度在什么位置, 只要它们存在就行. 在全部内部窗口中，加上任何额外的宽度和高度 。</p>\n<p>The aspect ratio is not respected when window is resized programmatically with APIs like <code>win.setSize</code>.</p>\n<h4 id=\"winsetbackgroundcolorbackgroundcolor\"><a href=\"#winsetbackgroundcolorbackgroundcolor\"><code>win.setBackgroundColor(backgroundColor)</code></a></h4>\n<ul>\n<li><code>backgroundColor</code> String - 十六进制的窗口背景色，如 <code>#66CD00</code>、<code>#FFF</code>和<code>#80FFFFFF</code>。 (如果<code>transparent</code>是<code>true</code>的话，也支持alpha 通道。) 默认值为 <code>#FFF</code>（白色）。</li>\n</ul>\n<p>设置窗口的背景颜色。 请参阅 <a href=\"#setting-backgroundcolor\">设置<code>背景颜色</code></a>。</p>\n<h4 id=\"winpreviewfilepath-displayname-macos\"><a href=\"#winpreviewfilepath-displayname-macos\"><code>win.previewFile(path[, displayName])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>path</code> String -要用 QuickLook 预览的文件的绝对路径。 这一点很重要，因为Quick Look 使用了路径上的文件名和文件扩展名 来决定要打开的文件的内容类型。</li>\n<li><code>displayName</code> String (可选) - 在Quick Look 模态视图中显示的文件的名称。 这完全是视觉的，不会影响文件的内容类型。 默认值为 <code>path</code>.</li>\n</ul>\n<p>使用 <a href=\"https://en.wikipedia.org/wiki/Quick_Look\">Quick Look</a>来预览路径中的文件.</p>\n<h4 id=\"winclosefilepreview-macos\"><a href=\"#winclosefilepreview-macos\"><code>win.closeFilePreview()</code> <em>macOS</em></a></h4>\n<p>关闭当前打开的 <a href=\"https://en.wikipedia.org/wiki/Quick_Look\">Quick Look</a> 面板.</p>\n<h4 id=\"winsetboundsbounds-animate\"><a href=\"#winsetboundsbounds-animate\"><code>win.setBounds(bounds[, animate])</code></a></h4>\n<ul>\n<li><code>bounds</code> Partial&#x3C;<a href=\"/docs/api/structures/rectangle\">Rectangle</a>></li>\n<li><code>animate</code> Boolean (可选) <em>macOS</em></li>\n</ul>\n<p>重置窗口，并且移动窗口到指定的位置. 任何未提供的属性将默认为其当前值。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-comment\">// 设置所有 bounds 边界属性</span>\nwin.setBounds({ <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">440</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">225</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-comment\">// 设置单一 bounds 边界属性</span>\nwin.setBounds({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">100</span> })\n\n<span class=\"hljs-comment\">// { x: 440, y: 225, width: 100, height: 600 }</span>\n<span class=\"hljs-built_in\">console</span>.log(win.getBounds())\n</code></pre>\n<h4 id=\"wingetbounds\"><a href=\"#wingetbounds\"><code>win.getBounds()</code></a></h4>\n<p>返回 <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - 窗口的 <code>bounds</code> 作为 <code>Object</code>。</p>\n<h4 id=\"wingetbackgroundcolor\"><a href=\"#wingetbackgroundcolor\"><code>win.getBackgroundColor()</code></a></h4>\n<p>返回 <code>String</code> - 获取窗口的背景颜色。 请参阅 <a href=\"#setting-backgroundcolor\">设置<code>背景颜色</code></a>。</p>\n<h4 id=\"winsetcontentboundsbounds-animate\"><a href=\"#winsetcontentboundsbounds-animate\"><code>win.setContentBounds(bounds[, animate])</code></a></h4>\n<ul>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n<li><code>animate</code> Boolean (可选) <em>macOS</em></li>\n</ul>\n<p>调整窗口的工作区 (如网页) 的大小并将其移动到所提供的边界。</p>\n<h4 id=\"wingetcontentbounds\"><a href=\"#wingetcontentbounds\"><code>win.getContentBounds()</code></a></h4>\n<p>返回 <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - 窗口客户端区域的 <code>bounds</code> <code>对象</code>。</p>\n<h4 id=\"wingetnormalbounds\"><a href=\"#wingetnormalbounds\"><code>win.getNormalBounds()</code></a></h4>\n<p>返回 <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - 包含正常状态下的窗口大小。</p>\n<p><strong>注意：</strong>无论当前的窗口状态为：最大化、最小化或者全屏，这个方法都将得到窗口在正常显示状态下的位置信息以及大小信息。 在正常状态下，getBounds 与 getNormalBounds 得到的边界信息 <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> 是一致的。</p>\n<h4 id=\"winsetenabledenable\"><a href=\"#winsetenabledenable\"><code>win.setEnabled(enable)</code></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>禁用或者启用窗口。</p>\n<h4 id=\"winisenabled\"><a href=\"#winisenabled\"><code>win.isEnabled()</code></a></h4>\n<p>返回 <code>Boolean</code> - 窗口是否启用。</p>\n<h4 id=\"winsetsizewidth-height-animate\"><a href=\"#winsetsizewidth-height-animate\"><code>win.setSize(width, height[, animate])</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>animate</code> Boolean (可选) <em>macOS</em></li>\n</ul>\n<p>调整窗口的<code>width</code>和 <code>height</code>. 如果 <code>width</code> 或 <code>height</code> 低于任何设定的最小尺寸约束，窗口将对齐到约束的最小尺寸。</p>\n<h4 id=\"wingetsize\"><a href=\"#wingetsize\"><code>win.getSize()</code></a></h4>\n<p>返回 <code>Integer []</code>-包含窗口的宽度和高度。</p>\n<h4 id=\"winsetcontentsizewidth-height-animate\"><a href=\"#winsetcontentsizewidth-height-animate\"><code>win.setContentSize(width, height[, animate])</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>animate</code> Boolean (可选) <em>macOS</em></li>\n</ul>\n<p>将窗口的工作区 (如网页) 的大小调整为 <code>width</code> 和 <code>height</code>。</p>\n<h4 id=\"wingetcontentsize\"><a href=\"#wingetcontentsize\"><code>win.getContentSize()</code></a></h4>\n<p>返回 <code>Integer []</code>-包含窗口的宽度和高度。</p>\n<h4 id=\"winsetminimumsizewidth-height\"><a href=\"#winsetminimumsizewidth-height\"><code>win.setMinimumSize(width, height)</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n</ul>\n<p>设置窗口最小化的 <code>width</code> 和<code>height</code>.</p>\n<h4 id=\"wingetminimumsize\"><a href=\"#wingetminimumsize\"><code>win.getMinimumSize()</code></a></h4>\n<p>返回 <code>Integer []</code>-包含窗口最小化的宽度和高度。</p>\n<h4 id=\"winsetmaximumsizewidth-height\"><a href=\"#winsetmaximumsizewidth-height\"><code>win.setMaximumSize(width, height)</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n</ul>\n<p>设置窗口最大化的 <code>width</code> 和 <code>height</code>.</p>\n<h4 id=\"wingetmaximumsize\"><a href=\"#wingetmaximumsize\"><code>win.getMaximumSize()</code></a></h4>\n<p>返回 <code>Integer []</code>-包含窗口最大化的宽度和高度。</p>\n<h4 id=\"winsetresizableresizable\"><a href=\"#winsetresizableresizable\"><code>win.setResizable(resizable)</code></a></h4>\n<ul>\n<li><code>resizable</code> Boolean</li>\n</ul>\n<p>设置用户是否可以手动调整窗口大小。</p>\n<h4 id=\"winisresizable\"><a href=\"#winisresizable\"><code>win.isResizable()</code></a></h4>\n<p>返回 <code>Boolean</code> - 用户是否可以手动调整窗口大小。</p>\n<h4 id=\"winsetmovablemovable-macos-windows\"><a href=\"#winsetmovablemovable-macos-windows\"><code>win.setMovable(movable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>movable</code> Boolean</li>\n</ul>\n<p>设置用户是否可以移动窗口。 在Linux上不起作用。</p>\n<h4 id=\"winismovable-macos-windows\"><a href=\"#winismovable-macos-windows\"><code>win.isMovable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>返回 <code>Boolean</code> - 窗口是否可以被用户拖动</p>\n<p>在 Linux 上总是返回 <code>true</code>。</p>\n<h4 id=\"winsetminimizableminimizable-macos-windows\"><a href=\"#winsetminimizableminimizable-macos-windows\"><code>win.setMinimizable(minimizable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>minimizable</code> Boolean</li>\n</ul>\n<p>设置用户是否可以手动将窗口最小化。 在Linux上不起作用。</p>\n<h4 id=\"winisminimizable-macos-windows\"><a href=\"#winisminimizable-macos-windows\"><code>win.isMinimizable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>返回 <code>Boolean</code> - 用户是否可以手动最小化窗口。</p>\n<p>在 Linux 上总是返回 <code>true</code>。</p>\n<h4 id=\"winsetmaximizablemaximizable-macos-windows\"><a href=\"#winsetmaximizablemaximizable-macos-windows\"><code>win.setMaximizable(maximizable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>maximizable</code> Boolean</li>\n</ul>\n<p>设置用户是否可以手动最大化窗口。 在Linux上不起作用。</p>\n<h4 id=\"winismaximizable-macos-windows\"><a href=\"#winismaximizable-macos-windows\"><code>win.isMaximizable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>返回 <code>Boolean</code> - 窗口是否可以最大化.</p>\n<p>在 Linux 上总是返回 <code>true</code>。</p>\n<h4 id=\"winsetfullscreenablefullscreenable\"><a href=\"#winsetfullscreenablefullscreenable\"><code>win.setFullScreenable(fullscreenable)</code></a></h4>\n<ul>\n<li><code>fullscreenable</code> Boolean</li>\n</ul>\n<p>设置最大化/缩放窗口按钮是切换全屏模式还是最大化窗口。</p>\n<h4 id=\"winisfullscreenable\"><a href=\"#winisfullscreenable\"><code>win.isFullScreenable()</code></a></h4>\n<p>返回 <code>Boolean</code> - 最大化/缩放窗口按钮是切换全屏模式还是最大化窗口。</p>\n<h4 id=\"winsetclosableclosable-macos-windows\"><a href=\"#winsetclosableclosable-macos-windows\"><code>win.setClosable(closable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>closable</code> Boolean</li>\n</ul>\n<p>设置用户是否可以手动关闭窗口。 在Linux上不起作用。</p>\n<h4 id=\"winisclosable-macos-windows\"><a href=\"#winisclosable-macos-windows\"><code>win.isClosable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>返回 <code>Boolean</code> - 窗口是否可以被用户关闭.</p>\n<p>在 Linux 上总是返回 <code>true</code>。</p>\n<h4 id=\"winsetalwaysontopflag-level-relativelevel\"><a href=\"#winsetalwaysontopflag-level-relativelevel\"><code>win.setAlwaysOnTop(flag[, level][, relativeLevel])</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n<li><code>level</code> String (可选) <em>macOS</em> <em>Windows</em> - 值包括 <code>normal</code>, <code>floating</code>, <code>torn-off-menu</code>, <code>modal-panel</code>, <code>main-menu</code>, <code>status</code>, <code>pop-up-menu</code>, <code>screen-saver</code>和 <del><code>dock</code></del>(已弃用)。 当 <code>flag</code> 属性为true时，默认值为 <code>floating</code> 。 当flag为false时，<code>level</code> 会重置为 <code>normal</code>。 请注意，包括从 <code>floating</code> 到 <code>status</code> ，窗口会被置于 macOS 上的 Dock 下方和 Windows 上的任务栏下方。 从 <code>pop-up-menu</code> 到更高级别，窗口显示在 macOS 上的Dock上方和 Windows 上的任务栏上方。 更多信息，请查阅 <a href=\"https://developer.apple.com/documentation/appkit/nswindow/level\">macOS 文档</a>。</li>\n<li><code>relativeLevel</code> Integer (可选) <em>macOS</em> - 设置此窗口相对于给定 <code>级别</code>的层数。. 默认值为<code>0</code>. 请注意, Apple 不鼓励在 <code>屏幕保护程序</code> 之上设置高于1的级别。</li>\n</ul>\n<p>设置窗口是否应始终显示在其他窗口的前面。 设置后，窗口仍然是一个正常窗口，而不是一个无法获取焦点的工具框窗口。</p>\n<h4 id=\"winisalwaysontop\"><a href=\"#winisalwaysontop\"><code>win.isAlwaysOnTop()</code></a></h4>\n<p>返回 <code>Boolean</code> - 当前窗口是否始终在其它窗口之前.</p>\n<h4 id=\"winmoveabovemediasourceid\"><a href=\"#winmoveabovemediasourceid\"><code>win.moveAbove(mediaSourceId)</code></a></h4>\n<ul>\n<li><code>mediaSourceId</code> String - DesktopCapturerSource格式的窗口 id 。 例如 \"window:1869:0\"。</li>\n</ul>\n<p>将窗口按z轴顺序移动到源窗口前面。 如果 <code>mediaSourceId</code> 不是window类型，或者如果窗口不存在，则此方法会抛出一个错误。</p>\n<h4 id=\"winmovetop\"><a href=\"#winmovetop\"><code>win.moveTop()</code></a></h4>\n<p>无论焦点如何, 将窗口移至顶端(z轴上的顺序).</p>\n<h4 id=\"wincenter\"><a href=\"#wincenter\"><code>win.center()</code></a></h4>\n<p>将窗口移动到屏幕中央。</p>\n<h4 id=\"winsetpositionx-y-animate\"><a href=\"#winsetpositionx-y-animate\"><code>win.setPosition(x, y[, animate])</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n<li><code>animate</code> Boolean (可选) <em>macOS</em></li>\n</ul>\n<p>将窗口移动到 <code>x</code> 和 <code>y</code>。</p>\n<h4 id=\"wingetposition\"><a href=\"#wingetposition\"><code>win.getPosition()</code></a></h4>\n<p>返回 <code>Integer[]</code> - 返回一个包含当前窗口位置的数组.</p>\n<h4 id=\"winsettitletitle\"><a href=\"#winsettitletitle\"><code>win.setTitle(title)</code></a></h4>\n<ul>\n<li><code>title</code> String</li>\n</ul>\n<p>将原生窗口的标题更改为 <code>title</code>。</p>\n<h4 id=\"wingettitle\"><a href=\"#wingettitle\"><code>win.getTitle()</code></a></h4>\n<p>返回 <code>String</code>-原生窗口的标题。</p>\n<p><strong>注意：</strong> 网页的标题可以与原生窗口的标题不同。</p>\n<h4 id=\"winsetsheetoffsetoffsety-offsetx-macos\"><a href=\"#winsetsheetoffsetoffsety-offsetx-macos\"><code>win.setSheetOffset(offsetY[, offsetX])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>offsetY</code> Float</li>\n<li><code>offsetX</code> Float (可选)</li>\n</ul>\n<p>改变macOS上sheet组件的附着点。 默认情况下，sheet贴在窗口边框正下方，但你可能需要在 HTML 渲染工具栏下方显示它们。 例如：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-keyword\">const</span> toolbarRect = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'toolbar'</span>).getBoundingClientRect()\nwin.setSheetOffset(toolbarRect.height)\n</code></pre>\n<h4 id=\"winflashframeflag\"><a href=\"#winflashframeflag\"><code>win.flashFrame(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>启动或停止闪烁窗口, 以吸引用户的注意。</p>\n<h4 id=\"winsetskiptaskbarskip\"><a href=\"#winsetskiptaskbarskip\"><code>win.setSkipTaskbar(skip)</code></a></h4>\n<ul>\n<li><code>skip</code> Boolean</li>\n</ul>\n<p>使窗口不显示在任务栏中。</p>\n<h4 id=\"winsetkioskflag\"><a href=\"#winsetkioskflag\"><code>win.setKiosk(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>进入或离开 kiosk 模式。</p>\n<h4 id=\"winiskiosk\"><a href=\"#winiskiosk\"><code>win.isKiosk()</code></a></h4>\n<p>返回 <code>Boolean</code> - 判断窗口是否处于kiosk模式.</p>\n<h4 id=\"winistabletmode-windows\"><a href=\"#winistabletmode-windows\"><code>win.isTabletMode()</code> <em>Windows</em></a></h4>\n<p>返回 <code>Boolean</code> - 无论当前窗口是否处在 Windows 10 平板模式</p>\n<p>因为 Windows 10 用户可以 <a href=\"https://support.microsoft.com/en-us/help/17210/windows-10-use-your-pc-like-a-tablet\">将他们的 PC 作为平板电脑来使用</a>，在此模式下，应用可以选择为平板电脑的界面做出优化，如扩展标题栏和隐藏标题栏按钮。</p>\n<p>此 API 返回 窗口是否在平板电脑模式下，并且 <code>调整大小</code> 事件可以用于监听对平板模式的更改。</p>\n<h4 id=\"wingetmediasourceid\"><a href=\"#wingetmediasourceid\"><code>win.getMediaSourceId()</code></a></h4>\n<p>返回 <code>String</code> - DesktopCapturerSource的id格式的窗口 id 。 例如 \"window:1324:0\"。</p>\n<p>更确切地说，格式是 <code>window:id:other_id</code>。在Windows上 <code>id</code> 是 <code>HWND</code> 类型；在macOS上是 <code>CGWindowID</code> (<code>uint64_t</code>)；在Linux上是 <code>Window</code> (<code>unsigned long</code>)。 <code>other_id</code> 用于识别同一顶层窗口内的Web 内容 (选项卡)。</p>\n<h4 id=\"wingetnativewindowhandle\"><a href=\"#wingetnativewindowhandle\"><code>win.getNativeWindowHandle()</code></a></h4>\n<p>返回 <code>Buffer</code> - 窗口的平台特定句柄</p>\n<p>Windows上句柄类型为 <code>HWND</code>，macOS 上为 <code>NSView*</code>，Linux 上为<code>Window</code> (<code>unsigned long</code>)</p>\n<h4 id=\"winhookwindowmessagemessage-callback-windows\"><a href=\"#winhookwindowmessagemessage-callback-windows\"><code>win.hookWindowMessage(message, callback)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n<li><code>callback</code> Function<ul>\n<li><code>wParam</code> any - 提供给 WndProc的 <code>wParam</code> 值。</li>\n<li><code>lParam</code> any - 提供给 WndProc的 <code>lParam</code> 值。</li>\n</ul></li>\n</ul>\n<p>钩住窗口消息。 当消息到达 WndProc 时调用<code>callback</code> 。</p>\n<h4 id=\"winiswindowmessagehookedmessage-windows\"><a href=\"#winiswindowmessagehookedmessage-windows\"><code>win.isWindowMessageHooked(message)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n</ul>\n<p>返回 <code>Boolean</code> - <code>true</code> 或<code>false</code> ，具体取决于是否钩挂了消息.</p>\n<h4 id=\"winunhookwindowmessagemessage-windows\"><a href=\"#winunhookwindowmessagemessage-windows\"><code>win.unhookWindowMessage(message)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n</ul>\n<p>取消窗口信息的钩子。</p>\n<h4 id=\"winunhookallwindowmessages-windows\"><a href=\"#winunhookallwindowmessages-windows\"><code>win.unhookAllWindowMessages()</code> <em>Windows</em></a></h4>\n<p>取消所有窗口信息的钩子。</p>\n<h4 id=\"winsetrepresentedfilenamefilename-macos\"><a href=\"#winsetrepresentedfilenamefilename-macos\"><code>win.setRepresentedFilename(filename)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>filename</code> String</li>\n</ul>\n<p>设置窗口所代表的文件的路径名，并且将这个文件的图标放在窗口标题栏上。</p>\n<h4 id=\"wingetrepresentedfilename-macos\"><a href=\"#wingetrepresentedfilename-macos\"><code>win.getRepresentedFilename()</code> <em>macOS</em></a></h4>\n<p>返回 <code>String</code> - 获取窗口当前文件路径.</p>\n<h4 id=\"winsetdocumenteditededited-macos\"><a href=\"#winsetdocumenteditededited-macos\"><code>win.setDocumentEdited(edited)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>edited</code> Boolean</li>\n</ul>\n<p>明确指出窗口文档是否可以编辑, 如果设置为<code>true</code>则将标题栏的图标变成灰色.</p>\n<h4 id=\"winisdocumentedited-macos\"><a href=\"#winisdocumentedited-macos\"><code>win.isDocumentEdited()</code> <em>macOS</em></a></h4>\n<p>返回 <code>Boolean</code> - 判断当前窗口文档是否可编辑.</p>\n<h4 id=\"winfocusonwebview\"><a href=\"#winfocusonwebview\"><code>win.focusOnWebView()</code></a></h4>\n<h4 id=\"winblurwebview\"><a href=\"#winblurwebview\"><code>win.blurWebView()</code></a></h4>\n<h4 id=\"wincapturepagerect\"><a href=\"#wincapturepagerect\"><code>win.capturePage([rect])</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (可选) - 捕获的区域</li>\n</ul>\n<p>返回 <code>Promise&#x3C;NativeImage></code> - 完成后返回一个<a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>在 <code>rect</code>内捕获页面的快照。 省略 <code>rect</code> 将捕获整个可见页面。 如果页面不可见， <code>rect</code> 可能是空的。</p>\n<h4 id=\"winloadurlurl-options\"><a href=\"#winloadurlurl-options\"><code>win.loadURL(url[, options])</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (可选) - HTTP 引用 url。</li>\n<li><code>userAgent</code> String (可选) - 发起请求的 userAgent.</li>\n<li><code>extraHeaders</code> String (可选) - 用 \"\\n\" 分割的额外标题</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a></li>\n<li><code>baseURLForDataURL</code> String (可选) - 要由数据URL加载的文件基本URL(末尾带有路径分隔符)。 仅当指定的<code>url</code>是数据url并且需要加载其他文件时，才需要此选项。</li>\n</ul></li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code> - 当页面完成加载后 promise 将会resolve (见 <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>)，如果页面加载失败，则 reject (见 <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>)。</p>\n<p>与 <a href=\"/docs/api/web-contents#contentsloadurlurl-options\"><code>webContents.loadURL(url[, options])</code></a> 相同。</p>\n<p><code>url</code> 可以是远程地址 (例如 <code>http://</code>),也可以是 <code>file://</code> 协议的本地HTML文件的路径.</p>\n<p>为了确保文件网址格式正确, 建议使用Node的 <a href=\"https://nodejs.org/api/url.html#url_url_format_urlobject\"><code>url.format</code></a> 方法:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>).format({\n  <span class=\"hljs-attr\">protocol</span>: <span class=\"hljs-string\">'file'</span>,\n  <span class=\"hljs-attr\">slashes</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">pathname</span>: <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>).join(__dirname, <span class=\"hljs-string\">'index.html'</span>)\n})\n\nwin.loadURL(url)\n</code></pre>\n<p>您可以通过执行以下操作, 使用带有网址编码数据的 <code>POST</code>请求​​加载网址:</p>\n<pre><code class=\"hljs language-javascript\">win.loadURL(<span class=\"hljs-string\">'http://localhost:8000/post'</span>, {\n  <span class=\"hljs-attr\">postData</span>: [{\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'rawData'</span>,\n    <span class=\"hljs-attr\">bytes</span>: Buffer.from(<span class=\"hljs-string\">'hello=world'</span>)\n  }],\n  <span class=\"hljs-attr\">extraHeaders</span>: <span class=\"hljs-string\">'Content-Type: application/x-www-form-urlencoded'</span>\n})\n</code></pre>\n<h4 id=\"winloadfilefilepath-options\"><a href=\"#winloadfilefilepath-options\"><code>win.loadFile(filePath[, options])</code></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>query</code> Record&#x3C;String, String> (可选) - 传递给 <code>url.format()</code>.</li>\n<li><code>search</code> String (可选) - 传递给 <code>url.format()</code>.</li>\n<li><code>hash</code> String (可选) - 传递给 <code>url.format()</code>.</li>\n</ul></li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code> - 当页面完成加载后 promise 将会resolve (见 <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>)，如果页面加载失败，则 reject (见 <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>)。</p>\n<p>与 <code>webContents.loadFile</code>相同， <code>filePath</code> 应该是一个与你的应用程序的根路径相关的HTML文件路径。  有关更多信息，请参阅<code>webContents</code> 文档。</p>\n<h4 id=\"winreload\"><a href=\"#winreload\"><code>win.reload()</code></a></h4>\n<p>与 <code>webContents.reload</code> 相同.</p>\n<h4 id=\"winsetmenumenu-linux-windows\"><a href=\"#winsetmenumenu-linux-windows\"><code>win.setMenu(menu)</code> <em>Linux</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>将 <code>menu</code> 设置为窗口的菜单栏。</p>\n<h4 id=\"winremovemenu-linux-windows\"><a href=\"#winremovemenu-linux-windows\"><code>win.removeMenu()</code> <em>Linux</em> <em>Windows</em></a></h4>\n<p>删除窗口的菜单栏。</p>\n<h4 id=\"winsetprogressbarprogress-options\"><a href=\"#winsetprogressbarprogress-options\"><code>win.setProgressBar(progress[, options])</code></a></h4>\n<ul>\n<li><code>progress</code> Double</li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>mode</code> String <em>Windows</em> - 进度条的状态。 可以是 <code>none</code>， <code>normal</code>， <code>indeterminate</code>， <code>error</code> 或 <code>paused</code>。</li>\n</ul></li>\n</ul>\n<p>设置进度条的进度值。 有效范围为 [0, 1.0]。</p>\n<p>当进度小于0时不显示进度; 当进度大于0时显示结果不确定.</p>\n<p>在 Linux 平台上，只支持 Unity 桌面模式, 你需要在 <code>package.json</code> 中为 <code>desktopName</code> 指定 <code>*.desktop</code> 的文件名. 默认情况下，将取 <code>{app.name}.desktop</code>。</p>\n<p>在 Windows 上, 可以传递模式。 可以接受的值为<code>none</code>, <code>normal</code>, <code>indeterminate</code>, <code>error</code>和 <code>paused</code>. 如果没有设置模式 (但值在有效范围内) 的情况下调用 <code>setProgressBar</code>, 默认值为<code>normal</code>。</p>\n<h4 id=\"winsetoverlayiconoverlay-description-windows\"><a href=\"#winsetoverlayiconoverlay-description-windows\"><code>win.setOverlayIcon(overlay, description)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>overlay</code> <a href=\"/docs/api/native-image\">NativeImage</a> | null - 右下角任务栏的显示图标。 如果此参数是 <code>null</code>，覆盖层层会被清除。</li>\n<li><code>description</code> String -提供给屏幕阅读器的描述文字</li>\n</ul>\n<p>在当前任务栏图标上设置一个 16 x 16 像素的图标, 通常用于传达某种应用程序状态或被动地通知用户。</p>\n<h4 id=\"winsethasshadowhasshadow\"><a href=\"#winsethasshadowhasshadow\"><code>win.setHasShadow(hasShadow)</code></a></h4>\n<ul>\n<li><code>hasShadow</code> Boolean</li>\n</ul>\n<p>设置窗口是否有阴影。</p>\n<h4 id=\"winhasshadow\"><a href=\"#winhasshadow\"><code>win.hasShadow()</code></a></h4>\n<p>返回 <code>Boolean</code> - 判断窗口是否有阴影.</p>\n<h4 id=\"winsetopacityopacity-windows-macos\"><a href=\"#winsetopacityopacity-windows-macos\"><code>win.setOpacity(opacity)</code> <em>Windows</em> <em>macOS</em></a></h4>\n<ul>\n<li><code>opacity</code> Number - 介于0.0 ( 完全透明 ) 和1.0 ( 完全不透明 ) 之间</li>\n</ul>\n<p>设置窗口的不透明度。 在Linux上不起作用。 超出界限的数值被限制在[0, 1] 范围内。</p>\n<h4 id=\"wingetopacity\"><a href=\"#wingetopacity\"><code>win.getOpacity()</code></a></h4>\n<p>返回 <code>Number</code> - 介于0.0 (完全透明) 和1.0 (完全不透明) 之间。 在Linux上，始终返回1。</p>\n<h4 id=\"winsetshaperects-windows-linux-实验性\"><a href=\"#winsetshaperects-windows-linux-实验性\"><code>win.setShape(rects)</code> <em>Windows</em> <em>Linux</em> <em>实验性</em></a></h4>\n<ul>\n<li><code>rects</code> <a href=\"/docs/api/structures/rectangle\">Rectangle[]</a> - 在窗口上设置形状。 通过传入空列表将窗口恢复为矩形。</li>\n</ul>\n<p>对窗口形状的设置决定了窗口内系统允许绘制与用户交互的区域. 在给定的区域外, 没有像素会被绘制, 且没有鼠标事件会被登记. 在该区域外的鼠标事件将不会被该窗口接收, 而是落至该窗口后方的任意窗口.</p>\n<h4 id=\"winsetthumbarbuttonsbuttons-windows\"><a href=\"#winsetthumbarbuttonsbuttons-windows\"><code>win.setThumbarButtons(buttons)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>buttons</code> <a href=\"/docs/api/structures/thumbar-button\">ThumbarButton[]</a></li>\n</ul>\n<p>返回 <code>Boolean</code> - 按钮是否成功添加</p>\n<p>将指定的一组按钮添加到菜单栏的缩图工具栏上。 返回一个 <code>Boolean</code> 对象表示是否成功地添加了缩略图.</p>\n<p>由于空间有限, 缩图工具栏中的按钮数量不要超过7个。 一旦设置了缩略图工具栏，则无法删除。 但你可以通过调用 API 传递一个空数组来清除按钮.</p>\n<p><code>buttons</code> 是一个 <code>Button</code> 对象的数组:</p>\n<ul>\n<li><code>Button</code> Object<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - 在缩图工具栏上显示的图标.</li>\n<li><code>click</code> Function</li>\n<li><code>tooltip</code> String (可选) - 按钮的提示文本.</li>\n<li><code>flags</code> String<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a> - 控制按钮的特定状态和行为。 默认情况下，值为 <code>['enabled']</code>。</li>\n</ul></li>\n</ul>\n<p><code>flags</code> 属性是一个数组，包含以下<code>String</code>类型的值:</p>\n<ul>\n<li><code>enabled</code> - 该按钮处于活动状态并可供用户使用.</li>\n<li><code>disabled</code> - 按钮已禁用。 会以一种视觉状态表示它不会响应用户操作的形式显示。</li>\n<li><code>dismissonclick</code> - 当按钮被点击时，缩略图窗口立即关闭。</li>\n<li><code>nobackground</code> - 仅仅使用图像而不绘制边框。</li>\n<li><code>hidden</code> - 该按钮对用户不可见。</li>\n<li><code>noninteractive</code> - 按钮已启用，但不交互；不绘制按钮按下的状态。 此值用于在通知中使用按钮的实例。</li>\n</ul>\n<h4 id=\"winsetthumbnailclipregion-windows\"><a href=\"#winsetthumbnailclipregion-windows\"><code>win.setThumbnailClip(region)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>region</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> 窗口的区域</li>\n</ul>\n<p>将窗口的区域设置为在任务栏中悬停在窗口上方时显示的缩略图图像。 通过指定空区域：<code>{ x: 0, y: 0, width: 0, height: 0 }</code>，可以重置整个窗口的缩略图。</p>\n<h4 id=\"winsetthumbnailtooltiptooltip-windows\"><a href=\"#winsetthumbnailtooltiptooltip-windows\"><code>win.setThumbnailToolTip(toolTip)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>toolTip</code> String</li>\n</ul>\n<p>设置在任务栏中悬停在窗口缩略图上时显示的工具提示。</p>\n<h4 id=\"winsetappdetailsoptions-windows\"><a href=\"#winsetappdetailsoptions-windows\"><code>win.setAppDetails(options)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>appId</code> String (可选) - 窗口的 <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391569(v=vs.85).aspx\">App User Model ID</a>. 该项必须设置, 否则其他选项将没有效果.</li>\n<li><code>appIconPath</code> String (可选) -窗口的 <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391573(v=vs.85).aspx\">Relaunch Icon</a>.</li>\n<li><code>appIconIndex</code> Integer (可选) - <code>appIconPath</code>中的图标索引。 未设置 <code>appIconPath</code> 时忽略。 默认值为 <code>0</code>.</li>\n<li><code>relaunchCommand</code> String (可选) - 窗口的 <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391571(v=vs.85).aspx\">重新启动命令</a>.</li>\n<li><code>relaunchDisplayName</code> String (可选) - 窗口的<a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391572(v=vs.85).aspx\">重新启动显示名称</a>.</li>\n</ul></li>\n</ul>\n<p>设置窗口任务栏按钮的属性。</p>\n<p><strong>注意：</strong>必须始终同时设置 <code>relaunchCommand</code> 和 <code>relaunchDisplayName</code>。 如果其中一个属性没有设置，那么这两个属性都不会使用。</p>\n<h4 id=\"winshowdefinitionforselection-macos\"><a href=\"#winshowdefinitionforselection-macos\"><code>win.showDefinitionForSelection()</code> <em>macOS</em></a></h4>\n<p>和 <code>webContents.showDefinitionForSelection()</code> 相同.</p>\n<h4 id=\"winseticonicon-windows-linux\"><a href=\"#winseticonicon-windows-linux\"><code>win.setIcon(icon)</code> <em>Windows</em> <em>Linux</em></a></h4>\n<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String</li>\n</ul>\n<p>设置窗口图标</p>\n<h4 id=\"winsetwindowbuttonvisibilityvisible-macos\"><a href=\"#winsetwindowbuttonvisibilityvisible-macos\"><code>win.setWindowButtonVisibility(visible)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n</ul>\n<p>设置是否窗口交通灯需要显示。</p>\n<h4 id=\"winsetautohidemenubarhide\"><a href=\"#winsetautohidemenubarhide\"><code>win.setAutoHideMenuBar(hide)</code></a></h4>\n<ul>\n<li><code>hide</code> Boolean</li>\n</ul>\n<p>设置窗口菜单栏是否自动隐藏。 一旦设置，菜单栏将只在用户单击 <code>Alt</code> 键时显示。</p>\n<p>如果菜单栏已经可见, 调用 <code>setAutoHideMenuBar(true)</code>时不会立刻隐藏。</p>\n<h4 id=\"winismenubarautohide\"><a href=\"#winismenubarautohide\"><code>win.isMenuBarAutoHide()</code></a></h4>\n<p>返回 <code>Boolean</code> - 判断窗口的菜单栏是否自动隐藏.</p>\n<h4 id=\"winsetmenubarvisibilityvisible-windows-linux\"><a href=\"#winsetmenubarvisibilityvisible-windows-linux\"><code>win.setMenuBarVisibility(visible)</code> <em>Windows</em> <em>Linux</em></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n</ul>\n<p>设置菜单栏是否可见。 如果菜单栏自动隐藏，用户仍然可以通过单击 <code>Alt</code> 键来唤出菜单栏。</p>\n<h4 id=\"winismenubarvisible\"><a href=\"#winismenubarvisible\"><code>win.isMenuBarVisible()</code></a></h4>\n<p>返回 <code>Boolean</code> - 判断窗口的菜单栏是否可见.</p>\n<h4 id=\"winsetvisibleonallworkspacesvisible-options\"><a href=\"#winsetvisibleonallworkspacesvisible-options\"><code>win.setVisibleOnAllWorkspaces(visible[, options])</code></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>visibleOnFullScreen</code> Boolean (可选) <em>macOS</em> - 设置当前窗口是否可以在全屏窗口之上显示。</li>\n<li><code>skipTransformProcessType</code> Boolean (可选) <em>macOS</em> - 调用 setVisibleOnAllWorkspaces ，默认转换流程类型于 UIElementApplication 和 ForegroundApplication 之间，用来保障正常响应。 然而，当方法被调用时将短暂的隐藏窗口和图标。 如果你的窗口已经是 UIElementApplication 类似，你可以绕过这次转换通过传递 true 参数给TransformProcessType。</li>\n</ul></li>\n</ul>\n<p>设置窗口是否在所有工作空间上可见</p>\n<p><strong>注意:</strong> 该 API 在 Windows 上无效.</p>\n<h4 id=\"winisvisibleonallworkspaces\"><a href=\"#winisvisibleonallworkspaces\"><code>win.isVisibleOnAllWorkspaces()</code></a></h4>\n<p>返回 <code>Boolean</code> - 判断窗口是否在所有工作空间上可见.</p>\n<p><strong>注意:</strong> 该 API 在 Windows 上始终返回 false.</p>\n<h4 id=\"winsetignoremouseeventsignore-options\"><a href=\"#winsetignoremouseeventsignore-options\"><code>win.setIgnoreMouseEvents(ignore[, options])</code></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>forward</code> Boolean (可选) <em>macOS</em> <em>Windows</em> - 如果为 true, 传递鼠标移动消息给 Chromium，鼠标相关事件将可用，如 <code>mouseleave</code>。 仅当<code> ignore &#x3C;/ 0>为 true 时才被使用。 如果 &#x3C;code>ignore</code> 为 false, 转发始终是禁用的，不管这个值是什么。</li>\n</ul></li>\n</ul>\n<p>忽略窗口内的所有鼠标事件</p>\n<p>在此窗口中发生的所有鼠标事件将被传递到此窗口下面的窗口, 但如果此窗口具有焦点, 它仍然会接收键盘事件</p>\n<h4 id=\"winsetcontentprotectionenable-macos-windows\"><a href=\"#winsetcontentprotectionenable-macos-windows\"><code>win.setContentProtection(enable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>防止窗口内容被其他应用捕获</p>\n<p>在 macOS 上，它将 NSWindow 的 sharingType 设置为 NSWindowSharingNone。 在 Windows 上，它以参数为 <code>WDA_EXCLUDEFROMCAPTURE</code> 调用 SetWindowDisplayAffinity 。 对于 Windows 10 2004以上版，本窗口将完全从抓取中移除，在低版本 Windows 上其行为就像是 <code>WDA_MONITOR</code> 捕捉了黑色窗口。</p>\n<h4 id=\"winsetfocusablefocusable-macos-windows\"><a href=\"#winsetfocusablefocusable-macos-windows\"><code>win.setFocusable(focusable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>focusable</code> Boolean</li>\n</ul>\n<p>设置窗口是否可聚焦</p>\n<p>在 macOS 上，该方法不会从窗口中移除焦点。</p>\n<h4 id=\"winisfocusable-macos-windows\"><a href=\"#winisfocusable-macos-windows\"><code>win.isFocusable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns whether the window can be focused.</p>\n<h4 id=\"winsetparentwindowparent\"><a href=\"#winsetparentwindowparent\"><code>win.setParentWindow(parent)</code></a></h4>\n<ul>\n<li><code>parent</code> BrowserWindow | null</li>\n</ul>\n<p>设置 <code>parent</code> 为当前窗口的父窗口. 为<code>null</code>时表示将当前窗口转为顶级窗口</p>\n<h4 id=\"wingetparentwindow\"><a href=\"#wingetparentwindow\"><code>win.getParentWindow()</code></a></h4>\n<p>返回 <code>BrowserWindow</code> - 父窗口.</p>\n<h4 id=\"wingetchildwindows\"><a href=\"#wingetchildwindows\"><code>win.getChildWindows()</code></a></h4>\n<p>返回 <code>BrowserWindow[]</code> - 首页的子窗口.</p>\n<h4 id=\"winsetautohidecursorautohide-macos\"><a href=\"#winsetautohidecursorautohide-macos\"><code>win.setAutoHideCursor(autoHide)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>autoHide</code> Boolean</li>\n</ul>\n<p>设置输入时是否隐藏光标</p>\n<h4 id=\"winselectprevioustab-macos\"><a href=\"#winselectprevioustab-macos\"><code>win.selectPreviousTab()</code> <em>macOS</em></a></h4>\n<p>当启用本地选项卡，并且窗口中有另一个标签时，选择上一个选项卡。</p>\n<h4 id=\"winselectnexttab-macos\"><a href=\"#winselectnexttab-macos\"><code>win.selectNextTab()</code> <em>macOS</em></a></h4>\n<p>当启用本地选项卡，并且窗口中有另一个标签时，选择下一个选项卡。</p>\n<h4 id=\"winmergeallwindows-macos\"><a href=\"#winmergeallwindows-macos\"><code>win.mergeAllWindows()</code> <em>macOS</em></a></h4>\n<p>当启用本地选项卡并且存在多个打开窗口时，将所有窗口合并到一个带有多个选项卡的窗口中。</p>\n<h4 id=\"winmovetabtonewwindow-macos\"><a href=\"#winmovetabtonewwindow-macos\"><code>win.moveTabToNewWindow()</code> <em>macOS</em></a></h4>\n<p>如果启用了本机选项卡并且当前窗口中有多个选项卡，则将当前选项卡移动到新窗口中。</p>\n<h4 id=\"wintoggletabbar-macos\"><a href=\"#wintoggletabbar-macos\"><code>win.toggleTabBar()</code> <em>macOS</em></a></h4>\n<p>如果启用了本机选项卡并且当前窗口中只有一个选项卡，则切换选项卡栏是否可见。</p>\n<h4 id=\"winaddtabbedwindowbrowserwindow-macos\"><a href=\"#winaddtabbedwindowbrowserwindow-macos\"><code>win.addTabbedWindow(browserWindow)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>browserWindow</code> BrowserWindow</li>\n</ul>\n<p>在该窗口中添加一个窗口作为选项卡，位于窗口实例的选项卡之后。</p>\n<h4 id=\"winsetvibrancytype-macos\"><a href=\"#winsetvibrancytype-macos\"><code>win.setVibrancy(type)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>type</code> String | null - 可以是 <code>appearance-based</code>，<code>light</code>，<code>dark</code>，<code>titlebar</code>，<code>selection</code>，<code>menu</code>，<code>popover</code>，<code>sidebar</code>，<code>medium-light</code>，<code>ultra-dark</code>，<code>header</code>，<code>sheet</code>，<code>window</code>，<code>hud</code>，<code>fullscreen-ui</code>，<code>tooltip</code>，<code>content</code>，<code>under-window</code> 或 <code>under-page</code>。 更多详细信息，请查阅 <a href=\"https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc\">macOS documentation</a></li>\n</ul>\n<p>在浏览器窗口中添加一个动态特效。 传递 <code>null</code> 或空字符串将会移除窗口上的动态效果。</p>\n<p>请注意， <code>appearance-based</code>，<code>light</code>，<code>dark</code>，<code>medium-light</code> 和 <code>ultra-dark</code> 已被弃用，并将在即将推出的 macOS 版本中被移除。</p>\n<h4 id=\"winsettrafficlightpositionposition-macos\"><a href=\"#winsettrafficlightpositionposition-macos\"><code>win.setTrafficLightPosition(position)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>在无框窗口中设置自定义控制按钮的位置。</p>\n<h4 id=\"wingettrafficlightposition-macos\"><a href=\"#wingettrafficlightposition-macos\"><code>win.getTrafficLightPosition()</code> <em>macOS</em></a></h4>\n<p>返回 <code>Point</code> - 在无框窗口中自定义控制按钮的位置。</p>\n<h4 id=\"winsettouchbartouchbar-macos\"><a href=\"#winsettouchbartouchbar-macos\"><code>win.setTouchBar(touchBar)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>touchBar</code> TouchBar | null</li>\n</ul>\n<p>设置窗口的触摸条布局 设置为 <code>null</code> 或<code>undefined</code>将清除触摸条. 此方法只有在macOS 10.12.1+且设备支持触摸条TouchBar时可用.</p>\n<p><strong>注意:</strong> TouchBar API目前为实验性质，可能会更改或删除。</p>\n<h4 id=\"winsetbrowserviewbrowserview-实验\"><a href=\"#winsetbrowserviewbrowserview-实验\"><code>win.setBrowserView(browserView)</code> <em>实验</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a> | null - 将 <code>browserView</code> 附加到 <code>win</code>。 如果已经附加了其他 <code>BrowserView</code>，那么它们将会被从此窗口中移除。</li>\n</ul>\n<h4 id=\"wingetbrowserview-实验功能\"><a href=\"#wingetbrowserview-实验功能\"><code>win.getBrowserView()</code> <em>实验功能</em></a></h4>\n<p>返回 <code>BrowserView | null</code> - 附加到 <code>win</code> 的 <code>BrowserView</code> 。 如果未附加，则返回 <code>null</code>。 如果附加了多个 <code>BrowserView</code>，则抛出错误。</p>\n<h4 id=\"winaddbrowserviewbrowserview-实验功能\"><a href=\"#winaddbrowserviewbrowserview-实验功能\"><code>win.addBrowserView(browserView)</code> <em>实验功能</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>替代 setBrowserView 的API，支持多个browserView一起使用。</p>\n<h4 id=\"winremovebrowserviewbrowserview-实验功能\"><a href=\"#winremovebrowserviewbrowserview-实验功能\"><code>win.removeBrowserView(browserView)</code> <em>实验功能</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<h4 id=\"winsettopbrowserviewbrowserview-实验功能\"><a href=\"#winsettopbrowserviewbrowserview-实验功能\"><code>win.setTopBrowserView(browserView)</code> <em>实验功能</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>提高 <code>browserView</code> 于其它附加到 <code>win</code> 的 <code>BrowserView</code> 之上 。 如果 <code>browserView</code> 未附加到 <code>win</code>，则抛出错误。</p>\n<h4 id=\"wingetbrowserviews-实验功能\"><a href=\"#wingetbrowserviews-实验功能\"><code>win.getBrowserViews()</code> <em>实验功能</em></a></h4>\n<p>返回 <code>BrowserView[]</code> - 所有通过 <code>addBrowserView</code> 或 <code>setBrowserView</code> 附加的BrowserView数组。</p>\n<p><strong>注意:</strong> BrowserView 的 API目前为实验性质，可能会更改或删除。</p>",
      "title": "BrowserWindow",
      "description": "创建并控制浏览器窗口。"
    },
    "/docs/api/browser-window-proxy": {
      "locale": "zh-CN",
      "slug": "browser-window-proxy",
      "href": "/docs/api/browser-window-proxy",
      "crowdinFileId": "256285",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-window-proxy.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类-browserwindowproxy\"><a href=\"#类-browserwindowproxy\">类: BrowserWindowProxy</a></h2>\n<blockquote>\n<p>操纵子浏览器窗口</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>使用 <code>window.open</code> 创建一个新窗口时会返回一个 <code>BrowserWindowProxy</code>对象，并提供一个有限功能的子窗口.</p>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<p><code>BrowserWindowProxy</code> 对象具有以下实例方法:</p>\n<h4 id=\"winblur\"><a href=\"#winblur\"><code>win.blur()</code></a></h4>\n<p>将焦点从子窗口中移除.</p>\n<h4 id=\"winclose\"><a href=\"#winclose\"><code>win.close()</code></a></h4>\n<p>不调用卸载事件，便关闭了子窗口。</p>\n<h4 id=\"winevalcode\"><a href=\"#winevalcode\"><code>win.eval(code)</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n</ul>\n<p>Eval子窗口中的代码</p>\n<h4 id=\"winfocus\"><a href=\"#winfocus\"><code>win.focus()</code></a></h4>\n<p>聚焦子窗口(即窗口置顶)</p>\n<h4 id=\"winprint\"><a href=\"#winprint\"><code>win.print()</code></a></h4>\n<p>调用子窗口上的打印对话框</p>\n<h4 id=\"winpostmessagemessage-targetorigin\"><a href=\"#winpostmessagemessage-targetorigin\"><code>win.postMessage(message, targetOrigin)</code></a></h4>\n<ul>\n<li><code>message</code> any</li>\n<li><code>targetOrigin</code> String</li>\n</ul>\n<p>调通过指定位置或用<code>*</code>来代替不明位置，向子窗口发送信息</p>\n<p>除了这些方法,子窗口还可以无特性和使用单一方法来实现 <code>window.opener</code> 对象.</p>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<p><code>BrowserWindowProxy</code> 对象具有以下实例属性:</p>\n<h4 id=\"winclosed\"><a href=\"#winclosed\"><code>win.closed</code></a></h4>\n<p>在子窗口关闭后设置为 true 的 <code>Boolean</code>。</p>",
      "title": "类: BrowserWindowProxy",
      "description": "操纵子浏览器窗口"
    },
    "/docs/development/build-instructions-gn": {
      "locale": "zh-CN",
      "slug": "build-instructions-gn",
      "href": "/docs/development/build-instructions-gn",
      "crowdinFileId": "256131",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-gn.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"构建说明\"><a href=\"#构建说明\">构建说明</a></h1>\n<p>按照下面的步骤构建 <strong>Electron</strong>，来生成自定义的 Electron 二进制文件。 为了将您的应用代码与预构建的 Electron 二进制文件打包并发布，请参阅 <a href=\"/docs/tutorial/application-distribution\">应用程序发布</a> 指南。</p>\n<h2 id=\"平台要求\"><a href=\"#平台要求\">平台要求</a></h2>\n<p>各个平台所对应的构建要求如下：</p>\n<ul>\n<li><a href=\"/docs/development/build-instructions-macos#prerequisites\">macOS</a></li>\n<li><a href=\"/docs/development/build-instructions-linux#prerequisites\">Linux</a></li>\n<li><a href=\"/docs/development/build-instructions-windows#prerequisites\">Windows</a></li>\n</ul>\n<h2 id=\"构建工具\"><a href=\"#构建工具\">构建工具</a></h2>\n<p><a href=\"https://github.com/electron/build-tools\">Electron的构建工具</a> 自动化了很多配置不同的从源代码编译Electron的设置和构建目标。 如果您希望手动设置环境，则说明如下。</p>\n<h2 id=\"前置知识\"><a href=\"#前置知识\">前置知识</a></h2>\n<p>此外，你还需要安装<a href=\"https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up\"><code>depot_tools</code></a>，这是一个用于获取Chromium，及其相关依赖工具。</p>\n<p>另外，如果使用Windows系统, 你需要设置环境变量<code>DEPOT_TOOLS_WIN_TOOLCHAIN=0</code>。 依次打开 <code>Control Panel</code> → <code>System and Security</code> → <code>System</code> → <code>Advanced system settings</code> ，然后添加系统变量 <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> ，并设置默认值为 <code>0</code>.  这将促使<code>depot_tools</code> 使用本地已安装的Visual Studio(默认状态下，<code>depot_tools</code>将会下载一个只有谷歌内部员工有权限使用的内部版本)。</p>\n<h3 id=\"设置-git-缓存\"><a href=\"#设置-git-缓存\">设置 git 缓存</a></h3>\n<p>如果您想 checkout 多份 Electron 源码 (例如多个并行目录 checkout 到不同的分支)， 推荐使用 git 缓存来加速后续对 <code>gclient</code>的调用。 为此，设置 <code>GIT_CACHE_PATH</code> 环境变量：</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">export</span> GIT_CACHE_PATH=<span class=\"hljs-string\">\"<span class=\"hljs-variable\">${HOME}</span>/.git_cache\"</span>\n$ mkdir -p <span class=\"hljs-string\">\"<span class=\"hljs-variable\">${GIT_CACHE_PATH}</span>\"</span>\n<span class=\"hljs-comment\"># 这将使用大约16G</span>\n</code></pre>\n<h2 id=\"获取代码\"><a href=\"#获取代码\">获取代码</a></h2>\n<pre><code class=\"hljs language-sh\">$ mkdir electron &#x26;&#x26; <span class=\"hljs-built_in\">cd</span> electron\n$ gclient config --name <span class=\"hljs-string\">\"src/electron\"</span> --unmanaged https://github.com/electron/electron\n$ gclient sync --with_branch_heads --with_tags\n<span class=\"hljs-comment\"># 这将需要一段时间，喝杯咖啡休息一下。</span>\n</code></pre>\n<blockquote>\n<p>除了使用 <code>https://github.com/electron/electron</code>， 你也可以使用你自己的 fork  (形如 <code>https://github.com/&#x3C;username>/electron</code>)。</p>\n</blockquote>\n<h3 id=\"拉推的注意事项\"><a href=\"#拉推的注意事项\">拉/推的注意事项</a></h3>\n<p>如果您将来打算从 <code>electron</code> 官方地址进行 <code>git pull</code> 或 <code>git push</code>，那么您需要更新相应文件夹的源 URL。</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src/electron\n$ git remote remove origin\n$ git remote add origin https://github.com/electron/electron\n$ git checkout main\n$ git branch --<span class=\"hljs-built_in\">set</span>-upstream-to=origin/main\n$ <span class=\"hljs-built_in\">cd</span> -\n</code></pre>\n<p>📝 <code>gclient</code> 会检查 <code>src/electron</code> 目录下的 <code>DEPS</code> 文件，从中获取依赖信息 (就像 Chromium 或 Node.js 那样)。 运行 <code>gclient sync -f</code> 确保所有用来构建 Electron 的依赖都符合该文件的描述。</p>\n<p>因此，为了拉取，您将运行以下命令：</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src/electron\n$ git pull\n$ gclient sync -f\n</code></pre>\n<h2 id=\"构建\"><a href=\"#构建\">构建</a></h2>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src\n$ <span class=\"hljs-built_in\">export</span> CHROMIUM_BUILDTOOLS_PATH=`<span class=\"hljs-built_in\">pwd</span>`/buildtools\n$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p>若在 Windows 上 (没有可选参数)：</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src\n$ <span class=\"hljs-built_in\">set</span> CHROMIUM_BUILDTOOLS_PATH=%<span class=\"hljs-built_in\">cd</span>%\\buildtools\n$ gn out/testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\")\n</span></code></pre>\n<p>这将在<code>src/</code>下的<code>out/Testing</code>内生成一个有测试生成配置的文件夹 您可以用另一个名称 替换 <code>Testing</code> ，但它应该是 <code>out</code> 的子目录。 Also you shouldn't have to run <code>gn gen</code> again—if you want to change the build arguments, you can run <code>gn args out/Testing</code> to bring up an editor.</p>\n<p>要查看可用的构建配置选项的列表，运行 <code>gn args out/Testing--list</code>。</p>\n<p><strong>用于生成测试Electron的构建配置：</strong></p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p><strong>For generating Release (aka \"non-component\" or \"static\") build config of Electron:</strong></p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Release --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/release.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p><strong>To build, run <code>ninja</code> with the <code>electron</code> target:</strong> Nota Bene: This will also take a while and probably heat up your lap.</p>\n<p>测试配置：</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Testing electron\n</code></pre>\n<p>发布配置：</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Release electron\n</code></pre>\n<p>This will build all of what was previously 'libchromiumcontent' (i.e. the <code>content/</code> directory of <code>chromium</code> and its dependencies, incl. WebKit and V8), so it will take a while.</p>\n<p>构建需要在<code>./out/Testing</code>文件下执行：</p>\n<pre><code class=\"hljs language-sh\">$ ./out/Testing/Electron.app/Contents/MacOS/Electron\n<span class=\"hljs-comment\"># or, on Windows</span>\n$ ./out/Testing/electron.exe\n<span class=\"hljs-comment\"># or, on Linux</span>\n$ ./out/Testing/electron\n</code></pre>\n<h3 id=\"打包\"><a href=\"#打包\">打包</a></h3>\n<p>On linux, first strip the debugging and symbol information:</p>\n<pre><code class=\"hljs language-sh\">electron/script/strip-binaries.py -d out/Release\n</code></pre>\n<p>To package the electron build as a distributable zip file:</p>\n<pre><code class=\"hljs language-sh\">ninja -C out/Release electron:electron_dist_zip\n</code></pre>\n<h3 id=\"交叉编译\"><a href=\"#交叉编译\">交叉编译</a></h3>\n<p>To compile for a platform that isn't the same as the one you're building on, set the <code>target_cpu</code> and <code>target_os</code> GN arguments. For example, to compile an x86 target from an x64 host, specify <code>target_cpu = \"x86\"</code> in <code>gn args</code>.</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing-x86 --args=<span class=\"hljs-string\">'... target_cpu = \"x86\"'</span>\n</code></pre>\n<p>Not all combinations of source and target CPU/OS are supported by Chromium.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Host</th><th>目标</th><th>状态</th></tr></thead><tbody><tr><td>Windows x64</td><td>Windows arm64</td><td>实验性功能</td></tr><tr><td>Windows x64</td><td>Windows x86</td><td>Automatically tested</td></tr><tr><td>Linux x64</td><td>Linux x86</td><td>Automatically tested</td></tr></tbody></table>\n<p>If you test other combinations and find them to work, please update this document :)</p>\n<p>有关 <a href=\"https://gn.googlesource.com/gn/+/master/docs/reference.md#built_in-predefined-variables-target_os_the-desired-operating-system-for-the-build-possible-values\"><code>target_os</code></a> 和 <a href=\"https://gn.googlesource.com/gn/+/master/docs/reference.md#built_in-predefined-variables-target_cpu_the-desired-cpu-architecture-for-the-build-possible-values\"><code>target_cpu</code></a> 的有效值，请查看参考 GN。</p>\n<h4 id=\"windows-on-arm-experimental\"><a href=\"#windows-on-arm-experimental\">Windows on Arm (experimental)</a></h4>\n<p>To cross-compile for Windows on Arm, <a href=\"https://chromium.googlesource.com/chromium/src/+/refs/heads/master/docs/windows_build_instructions.md#Visual-Studio\">follow Chromium's guide</a> to get the necessary dependencies, SDK and libraries, then build with <code>ELECTRON_BUILDING_WOA=1</code> in your environment before running <code>gclient sync</code>.</p>\n<pre><code class=\"hljs language-bat\"><span class=\"hljs-built_in\">set</span> ELECTRON_BUILDING_WOA=<span class=\"hljs-number\">1</span>\ngclient sync -f --with_branch_heads --with_tags\n</code></pre>\n<p>Or (if using PowerShell):</p>\n<pre><code class=\"hljs language-powershell\"><span class=\"hljs-variable\">$env:ELECTRON_BUILDING_WOA</span>=<span class=\"hljs-number\">1</span>\ngclient sync -f --with_branch_heads --with_tags\n</code></pre>\n<p>Next, run <code>gn gen</code> as above with <code>target_cpu=\"arm64\"</code>.</p>\n<h2 id=\"测试\"><a href=\"#测试\">测试</a></h2>\n<p>To run the tests, you'll first need to build the test modules against the same version of Node.js that was built as part of the build process. To generate build headers for the modules to compile against, run the following under <code>src/</code> directory.</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Testing third_party/electron_node:headers\n</code></pre>\n<p>You can now <a href=\"/docs/development/testing#unit-tests\">run the tests</a>.</p>\n<p>可以通过增加其它标记来调试程序，例如：</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span> -- \\\n  --<span class=\"hljs-built_in\">enable</span>-logging -g <span class=\"hljs-string\">'BrowserWindow module'</span>\n</code></pre>\n<h2 id=\"在多个计算机之间共享-git-缓存\"><a href=\"#在多个计算机之间共享-git-缓存\">在多个计算机之间共享 git 缓存</a></h2>\n<p>可以将gclient git 缓存与其他机器共享，导出为 SMB 在linux上共享。 但每次只能有一个进程或机器可以使用缓存。 The locks created by git-cache script will try to prevent this, but it may not work perfectly in a network.</p>\n<p>On Windows, SMBv2 has a directory cache that will cause problems with the git cache script, so it is necessary to disable it by setting the registry key</p>\n<pre><code class=\"hljs language-sh\">HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\Lanmanworkstation\\Parameters\\DirectoryCacheLifetime\n</code></pre>\n<p>to 0. 更多信息：<a href=\"https://stackoverflow.com/a/9935126\">https://stackoverflow.com/a/9935126</a></p>\n<p>This can be set quickly in powershell (ran as administrator):</p>\n<pre><code class=\"hljs language-powershell\"><span class=\"hljs-built_in\">New-ItemProperty</span> -Path <span class=\"hljs-string\">\"HKLM:\\System\\CurrentControlSet\\Services\\Lanmanworkstation\\Parameters\"</span> -Name DirectoryCacheLifetime -Value <span class=\"hljs-number\">0</span> -PropertyType DWORD -Force\n</code></pre>\n<h2 id=\"故障排查\"><a href=\"#故障排查\">故障排查</a></h2>\n<h3 id=\"gclient-sync-complains-about-rebase\"><a href=\"#gclient-sync-complains-about-rebase\">gclient sync complains about rebase</a></h3>\n<p>If <code>gclient sync</code> is interrupted the git tree may be left in a bad state, leading to a cryptic message when running <code>gclient sync</code> in the future:</p>\n<pre><code class=\"hljs language-plaintext\">2> Conflict while rebasing this branch.\n2> Fix the conflict and run gclient again.\n2> See man git-rebase for details.\n</code></pre>\n<p>If there are no git conflicts or rebases in <code>src/electron</code>, you may need to abort a <code>git am</code> in <code>src</code>:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> ../\n$ git am --abort\n$ <span class=\"hljs-built_in\">cd</span> electron\n$ gclient sync -f\n</code></pre>\n<h3 id=\"im-being-asked-for-a-usernamepassword-for-chromium-internalgooglesourcecom\"><a href=\"#im-being-asked-for-a-usernamepassword-for-chromium-internalgooglesourcecom\">I'm being asked for a username/password for chromium-internal.googlesource.com</a></h3>\n<p>If you see a prompt for <code>Username for 'https://chrome-internal.googlesource.com':</code> when running <code>gclient sync</code> on Windows, it's probably because the <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> environment variable is not set to 0. Open <code>Control Panel</code> → <code>System and Security</code> → <code>System</code> → <code>Advanced system settings</code> and add a system variable <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> with value <code>0</code>.  这将促使<code>depot_tools</code> 使用本地已安装的Visual Studio(默认状态下，<code>depot_tools</code>将会下载一个只有谷歌内部员工有权限使用的内部版本)。</p>",
      "title": "构建说明",
      "description": "除了使用 https://github.com/electron/electron， 你也可以使用你自己的 fork  (形如 https://github.com/<username>/electron)。"
    },
    "/docs/development/build-instructions-linux": {
      "locale": "zh-CN",
      "slug": "build-instructions-linux",
      "href": "/docs/development/build-instructions-linux",
      "crowdinFileId": "256133",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-linux.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"构建步骤（linux）\"><a href=\"#构建步骤（linux）\">构建步骤（Linux）</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on Linux, for the purposes of creating custom Electron binaries. 为了将您的应用代码与预构建的 Electron 二进制文件打包并发布，请参阅 <a href=\"/docs/tutorial/application-distribution\">应用程序发布</a> 指南。</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>\n<p>At least 25GB disk space and 8GB RAM.</p>\n</li>\n<li>\n<p>Python 2.7.x. Some distributions like CentOS 6.x still use Python 2.6.x so you may need to check your Python version with <code>python -V</code>.</p>\n<p>Please also ensure that your system and Python version support at least TLS 1.2. For a quick test, run the following script:</p>\n<pre><code class=\"hljs language-sh\">$ npx @electron/check-python-tls\n</code></pre>\n<p>If the script returns that your configuration is using an outdated security protocol, use your system's package manager to update Python to the latest version in the 2.7.x branch. Alternatively, visit <a href=\"https://www.python.org/downloads/\">https://www.python.org/downloads/</a> for detailed instructions.</p>\n</li>\n<li>\n<p>Node.js. There are various ways to install Node. You can download source code from <a href=\"https://nodejs.org\">nodejs.org</a> and compile it. Doing so permits installing Node on your own home directory as a standard user. Or try repositories such as <a href=\"https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories\">NodeSource</a>.</p>\n</li>\n<li>\n<p><a href=\"https://clang.llvm.org/get_started.html\">clang</a> 3.4 or later.</p>\n</li>\n<li>\n<p>Development headers of GTK 3 and libnotify.</p>\n</li>\n</ul>\n<p>On Ubuntu, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install build-essential clang libdbus-1-dev libgtk-3-dev \\\n                       libnotify-dev libgnome-keyring-dev \\\n                       libasound2-dev libcap-dev libcups2-dev libxtst-dev \\\n                       libxss1 libnss3-dev gcc-multilib g++-multilib curl \\\n                       gperf bison python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On RHEL / CentOS, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo yum install clang dbus-devel gtk3-devel libnotify-devel \\\n                   libgnome-keyring-devel xorg-x11-server-utils libcap-devel \\\n                   cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \\\n                   nss-devel python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On Fedora, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo dnf install clang dbus-devel gtk3-devel libnotify-devel \\\n                   libgnome-keyring-devel xorg-x11-server-utils libcap-devel \\\n                   cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \\\n                   nss-devel python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On Arch Linux / Manjaro, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo pacman -Syu base-devel clang libdbus gtk2 libnotify \\\n                   libgnome-keyring alsa-lib libcap libcups libxtst \\\n                   libxss nss gcc-multilib curl gperf bison \\\n                   python2 python-dbusmock jdk8-openjdk\n</code></pre>\n<p>Other distributions may offer similar packages for installation via package managers such as pacman. Or one can compile from source code.</p>\n<h3 id=\"cross-compilation\"><a href=\"#cross-compilation\">Cross compilation</a></h3>\n<p>If you want to build for an <code>arm</code> target you should also install the following dependencies:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install libc6-dev-armhf-cross linux-libc-dev-armhf-cross \\\n                       g++-arm-linux-gnueabihf\n</code></pre>\n<p>Similarly for <code>arm64</code>, install the following:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install libc6-dev-arm64-cross linux-libc-dev-arm64-cross \\\n                       g++-aarch64-linux-gnu\n</code></pre>\n<p>And to cross-compile for <code>arm</code> or <code>ia32</code> targets, you should pass the <code>target_cpu</code> parameter to <code>gn gen</code>:</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">'import(...) target_cpu=\"arm\"'</span>\n</code></pre>\n<h2 id=\"构建\"><a href=\"#构建\">构建</a></h2>\n<p>See <a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a></p>\n<h2 id=\"故障排查\"><a href=\"#故障排查\">故障排查</a></h2>\n<h3 id=\"error-while-loading-shared-libraries-libtinfoso5\"><a href=\"#error-while-loading-shared-libraries-libtinfoso5\">Error While Loading Shared Libraries: libtinfo.so.5</a></h3>\n<p>Prebuilt <code>clang</code> will try to link to <code>libtinfo.so.5</code>. Depending on the host architecture, symlink to appropriate <code>libncurses</code>:</p>\n<pre><code class=\"hljs language-sh\">$ sudo ln -s /usr/lib/libncurses.so.5 /usr/lib/libtinfo.so.5\n</code></pre>\n<h2 id=\"advanced-topics\"><a href=\"#advanced-topics\">Advanced topics</a></h2>\n<p>The default building configuration is targeted for major desktop Linux distributions. To build for a specific distribution or device, the following information may help you.</p>\n<h3 id=\"using-system-clang-instead-of-downloaded-clang-binaries\"><a href=\"#using-system-clang-instead-of-downloaded-clang-binaries\">Using system <code>clang</code> instead of downloaded <code>clang</code> binaries</a></h3>\n<p>By default Electron is built with prebuilt <a href=\"https://clang.llvm.org/get_started.html\"><code>clang</code></a> binaries provided by the Chromium project. If for some reason you want to build with the <code>clang</code> installed in your system, you can specify the <code>clang_base_path</code> argument in the GN args.</p>\n<p>For example if you installed <code>clang</code> under <code>/usr/local/bin/clang</code>:</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">'import(\"//electron/build/args/testing.gn\") clang_base_path = \"/usr/local/bin\"'</span>\n</code></pre>\n<h3 id=\"using-compilers-other-than-clang\"><a href=\"#using-compilers-other-than-clang\">Using compilers other than <code>clang</code></a></h3>\n<p>Building Electron with compilers other than <code>clang</code> is not supported.</p>",
      "title": "构建步骤（Linux）",
      "description": ""
    },
    "/docs/development/build-instructions-macos": {
      "locale": "zh-CN",
      "slug": "build-instructions-macos",
      "href": "/docs/development/build-instructions-macos",
      "crowdinFileId": "256135",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-macos.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"构建步骤（macos）\"><a href=\"#构建步骤（macos）\">构建步骤（macOS）</a></h1>\n<p>请按照下面的指南在macOS下构建 <strong>Electron 本身</strong>，以此创建自定义 Electron 二进制文件。 为了将您的应用代码与预构建的 Electron 二进制文件打包并发布，请参阅 <a href=\"/docs/tutorial/application-distribution\">应用程序发布</a> 指南。</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>macOS >= 10.11.6</li>\n<li><a href=\"https://developer.apple.com/technologies/tools/\">Xcode</a> >= 9.0.0</li>\n<li><a href=\"https://nodejs.org\">node.js</a> (外部)</li>\n<li>包含TLS 1.2支持的Python2.7</li>\n</ul>\n<h2 id=\"python\"><a href=\"#python\">Python</a></h2>\n<p>Please also ensure that your system and Python version support at least TLS 1.2. 这取决于您的 macOS 和 Python 的版本。 对于快速测试，请运行：</p>\n<pre><code class=\"hljs language-sh\">$ npx @electron/check-python-tls\n</code></pre>\n<p>如果以上命令的结果显示您正在使用过期的安全协议，您可以把macOS系统更新至High Sierra版，或者安装一个新的2.7.x版的Python。 您可以使用<a href=\"https://brew.sh/\">Homebrew</a>来更新Python版本：</p>\n<pre><code class=\"hljs language-sh\">$ brew install python@2 &#x26;&#x26; brew link python@2 --force\n</code></pre>\n<p>如果你已经在使用Homebrew来管理Python，那你也需要安装以下Python模块：</p>\n<ul>\n<li><a href=\"https://pypi.org/project/pyobjc/#description\">pyobjc</a></li>\n</ul>\n<p>您可以使用 <code>pip</code> 安装它：</p>\n<pre><code class=\"hljs language-sh\">$ pip install pyobjc\n</code></pre>\n<h2 id=\"macos-sdk\"><a href=\"#macos-sdk\">macOS SDK</a></h2>\n<p>如果你已经在开发Electron项目，而且没有重新分发Electron构建文件的计划，那你可以忽略下面内容。</p>\n<p>官方 Electron 构建于<a href=\"https://download.developer.apple.com/Developer_Tools/Xcode_12.2/Xcode_12.2.xip\">Xcode 12.2.1</a>, 和 MacOS 11.0 SDK. 可以使用新的SDK来构建，但是当前使用的Release版本是 11.0 SDK</p>\n<h2 id=\"构建electron\"><a href=\"#构建electron\">构建Electron</a></h2>\n<p>参照<a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a></p>",
      "title": "构建步骤（macOS）",
      "description": ""
    },
    "/docs/development/build-instructions-windows": {
      "locale": "zh-CN",
      "slug": "build-instructions-windows",
      "href": "/docs/development/build-instructions-windows",
      "crowdinFileId": "256137",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-windows.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"构建步骤（windows）\"><a href=\"#构建步骤（windows）\">构建步骤（Windows）</a></h1>\n<p>按照下面的指南在Windows下构建 <strong>Electron 本身</strong>，以此创建自定义 Electron 二进制文件。 为了将您的应用代码与预构建的 Electron 二进制文件打包并发布，请参阅 <a href=\"/docs/tutorial/application-distribution\">应用程序发布</a> 指南。</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>Windows 10 / Server 2012 R2 或更高版本</li>\n<li>Visual Studio 2017 15.7.2 或更高版本 - <a href=\"https://www.visualstudio.com/vs/\">免费下载 VS 2019 社区版</a><ul>\n<li>请参阅<a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md#visual-studio\">Chromium构建文档</a>，以了解有哪些Visual Studio 组件需要安装等详细信息。</li>\n<li>如果您的 Visual Studio 安装在非默认目录中， 您需要 设置几个环境变量来将工具链指向您的安装路径。<ul>\n<li><code>vs2019_install = DRIVE:\\path\\to\\Microsoft Visual Studio\\2019\\Community</code>，用您当前已安装版本替换<code>2019</code>和<code>Community</code>以及用您当前安装Visual Studio的驱动器号替换<code>DRIVE:</code> 一般情况下将会是<code>C:</code>。</li>\n<li><code>WINDOWSSDKDIR = DRIVE:\\path\\to\\Windows Kits\\10</code>, replacing <code>DRIVE:</code> with the drive that Windows Kits is on. 一般情况下将会是<code>C:</code>。</li>\n</ul></li>\n<li><a href=\"https://pypi.org/project/pywin32/#files\">Python for Windows (pywin32) 扩展</a>对于构建流程也是必需的。</li>\n</ul></li>\n<li><a href=\"https://nodejs.org/download/\">Node.js</a></li>\n<li><a href=\"https://git-scm.com\">Git</a></li>\n<li>Debugging Tools for Windows of Windows SDK 10.0.15063.468 if you plan on creating a full distribution since <code>symstore.exe</code> is used for creating a symbol store from <code>.pdb</code> files.<ul>\n<li>不同版本的SDK可以同时安装 To install the SDK, open Visual Studio Installer, select <code>Modify</code> → <code>Individual Components</code>, scroll down and select the appropriate Windows SDK to install. 另一个选择是查看 <a href=\"https://developer.microsoft.com/en-us/windows/downloads/sdk-archive\">windows SDK 和仿真器存档</a> 并分别下载 SDK 的独立版本。</li>\n<li>还必须安装 SDK 调试工具。 如果已安装了 Windows 10 SDK 通过 Visual Studio 安装程序，然后可以用以下方式安装它们： <code>控制面板</code>→<code>程序</code>→<code>程序和功能</code>→选择“Windows 软件开发工具包”→ <code>更改</code>→<code>更改</code>→选中“Windows 调试工具”→<code>更改</code>。 或者，您可以下载独立的 SDK 安装程序，并且使用它安装调试工具。</li>\n</ul></li>\n</ul>\n<p>如果您当前没有安装 Windows， <a href=\"https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/\">dev.microsoftedge.com</a> 上有时间限制的 Windows 版本，你可以用来构建 Electron。</p>\n<p>构建 Electron 完全由命令行脚本完成，无法通过 Visual Studio 完成。 您可以使用任何编辑器开发 Electron，但将来将会使用 Visual Studio 构建支持。</p>\n<p><strong>注意:</strong> 即使 Visual Studio 不用于构建，但是仍然<strong>需要</strong>，因为我们需要它提供的构建工具链。</p>\n<h2 id=\"从windows-security排除source-tree\"><a href=\"#从windows-security排除source-tree\">从Windows Security排除source tree</a></h2>\n<p>Windows Security 不支持Chromium 源码中部分代码，详情(see <a href=\"https://crbug.com/441184\">https://crbug.com/441184</a>). 此行为将会导致windows系统会删除Chromium里的危险文件从而导致 <code>gclient sync</code> Bug. 通过<a href=\"https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26\">following these instructions</a>你可以在Windows Security中排除这一行为。</p>\n<h2 id=\"构建\"><a href=\"#构建\">构建</a></h2>\n<p>参照<a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a></p>\n<h2 id=\"32-位构建\"><a href=\"#32-位构建\">32 位构建</a></h2>\n<p>为了构建 32bit 版本，您需要通过 <code>target_cpu = “x86\"</code> 作为 GN 参数。 可以使用不同的 GN 输出目录（例如， <code>out/Release-x86</code>） 和不同的参数，在 64 位目标旁边构建 32 位目标。</p>\n<pre><code class=\"hljs language-powershell\">$ gn gen out/Release-x86 --args=<span class=\"hljs-string\">\"import(\\\"</span>//electron/build/args/release.gn\\<span class=\"hljs-string\">\") target_cpu=\\\"</span>x86\\<span class=\"hljs-string\">\"\"</span>\n</code></pre>\n<p>其他构建步骤完全一样。</p>\n<h2 id=\"visual-studio-项目\"><a href=\"#visual-studio-项目\">Visual Studio 项目</a></h2>\n<p>要生成 Visual Studio 项目，可以传递 <code>--ide=vs2017</code> 参数 给 <code>gn gen</code>：</p>\n<pre><code class=\"hljs language-powershell\">$ gn gen out/Testing --ide=vs2017\n</code></pre>\n<h2 id=\"故障排查\"><a href=\"#故障排查\">故障排查</a></h2>\n<h3 id=\"command-xxxx-not-found\"><a href=\"#command-xxxx-not-found\">Command xxxx not found</a></h3>\n<p>如果你遇到了一个错误，类似 <code>Command xxxx not found</code>, 可以尝试使用 <code>VS2015 Command Prompt</code> 控制台来执行构建脚本.</p>\n<h3 id=\"fatal-internal-compiler-error-c1001\"><a href=\"#fatal-internal-compiler-error-c1001\">Fatal internal compiler error: C1001</a></h3>\n<p>确保你已经安装了 Visual Studio 的最新安装包.</p>\n<h3 id=\"lnk1181-cannot-open-input-file-kernel32lib\"><a href=\"#lnk1181-cannot-open-input-file-kernel32lib\">LNK1181: cannot open input file 'kernel32.lib'</a></h3>\n<p>重新安装 32位的 Node.js.</p>\n<h3 id=\"error-enoent-stat-cusersusernameappdataroamingnpm\"><a href=\"#error-enoent-stat-cusersusernameappdataroamingnpm\">Error: ENOENT, stat 'C:\\Users\\USERNAME\\AppData\\Roaming\\npm'</a></h3>\n<p>创建那个目录 <a href=\"https://stackoverflow.com/a/25095327/102704\">应该可以解决问题</a>:</p>\n<pre><code class=\"hljs language-powershell\">$ mkdir ~\\AppData\\Roaming\\npm\n</code></pre>\n<h3 id=\"node-gyp-is-not-recognized-as-an-internal-or-external-command\"><a href=\"#node-gyp-is-not-recognized-as-an-internal-or-external-command\">node-gyp is not recognized as an internal or external command</a></h3>\n<p>如果你使用 Git Bash 来构建，或许会遇到这个错误，可以使用 PowerShell 或 VS2015 Command Prompt 来代替.</p>\n<h3 id=\"无法在处创建目录：文件名太长\"><a href=\"#无法在处创建目录：文件名太长\">无法在“…”处创建目录：文件名太长</a></h3>\n<p>node.js 有一些 <a href=\"https://github.com/electron/node/tree/electron/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/read-pkg-up/node_modules/read-pkg/node_modules/load-json-file/node_modules/parse-json/node_modules/error-ex/node_modules/is-arrayish\">极长的路径名</a>，默认情况下，windows 上的 git 不能正确处理长路径名（即使 windows 支持它们）。 这应该可以修复它：</p>\n<pre><code class=\"hljs language-sh\">$ git config --system core.longpaths <span class=\"hljs-literal\">true</span>\n</code></pre>\n<h3 id=\"错误：使用未声明的标识符defaultdelegatecheckmode\"><a href=\"#错误：使用未声明的标识符defaultdelegatecheckmode\">错误：使用未声明的标识符“DefaultDelegateCheckMode”</a></h3>\n<p>This can happen during build, when Debugging Tools for Windows has been installed with Windows Driver Kit. Uninstall Windows Driver Kit and install Debugging Tools with steps described above.</p>\n<h3 id=\"导入错误：没有名为-win32file-的模块\"><a href=\"#导入错误：没有名为-win32file-的模块\">导入错误：没有名为 win32file 的模块</a></h3>\n<p>确保已使用 <code>pip install pywin32</code> 安装了 <code>pywin32</code>。</p>\n<h3 id=\"构建脚本挂起-直到某个按键按下才有响应\"><a href=\"#构建脚本挂起-直到某个按键按下才有响应\">构建脚本挂起, 直到某个按键按下才有响应</a></h3>\n<p>这个bug 是 Windows 命令提示符的一个\"功能\" It happens when clicking inside the prompt window with <code>QuickEdit</code> enabled and is intended to allow selecting and copying output text easily. 由于每次意外点击都会暂停构建过程，您可能需要在命令的属性中禁用此 功能。</p>",
      "title": "构建步骤（Windows）",
      "description": ""
    },
    "/docs/development/build-system-overview": {
      "locale": "zh-CN",
      "slug": "build-system-overview",
      "href": "/docs/development/build-system-overview",
      "crowdinFileId": "256139",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-system-overview.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"构建系统概览\"><a href=\"#构建系统概览\">构建系统概览</a></h1>\n<p>Electron 使用 <a href=\"https://gn.googlesource.com/gn\">GN</a> 生成项目，并用 <a href=\"https://ninja-build.org/\">Ninja</a> 完成构建。 项目配置位于 <code>.gn</code> 和 <code>.gni</code> 文件中。</p>\n<h2 id=\"gn-文件\"><a href=\"#gn-文件\">GN 文件</a></h2>\n<p>The following <code>gn</code> files contain the main rules for building Electron:</p>\n<ul>\n<li><code>BUILD.gn</code> 指明了如何构建 Electron，还包括与 Chromium 相关的默认配置。</li>\n<li><code>build/args/{debug,release,all}.gn</code> 包含 Electron 的默认构建参数。</li>\n</ul>\n<h2 id=\"分块构建\"><a href=\"#分块构建\">分块构建</a></h2>\n<p>由于 Chromium 项目及其庞大，最终的链接阶段往往需要数分钟，加大了开发难度。 为此，Chromium 采用了“分块构建”方式，将每个模块作为单独的动态库构建，虽然影响了文件大小和性能，但加快了链接速度，</p>\n<p>Electron 也继承了 Chromium 这一构建方式。 在 <code>Debug</code> 模式下构建时，程序将与 Chromium 的动态库链接，以加快链接速度；而 <code>Release</code> 模式下程序则会与静态库链接，以优化程序大小和性能。</p>\n<h2 id=\"测试\"><a href=\"#测试\">测试</a></h2>\n<p><strong>注意：</strong>_此内容已经过时，部分信息对于使用 GN 构建的 Electron 已不再适用。</p><p></p>\n<p>使用以下方式测试你的修改符合项目编码风格：</p>\n<pre><code class=\"hljs language-sh\">$ npm run lint\n</code></pre>\n<p>测试功能使用：</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>每当您更改Electron源代码时，都需要在测试之前重新运行构建：</p>\n<pre><code class=\"hljs language-sh\">$ npm run build &#x26;&#x26; npm <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>你可以通过分离特定的测试来让测试套件运行速度更快或阻止你目前正在使用摩卡的 <a href=\"https://mochajs.org/#exclusive-tests\">独占性测试</a>功能. 追加 <code>.only</code> 到任何 <code>describe</code> 或 <code>it</code> 函数调用：</p>\n<pre><code class=\"hljs language-js\">describe.only(<span class=\"hljs-string\">'some feature'</span>, () => {\n  <span class=\"hljs-comment\">// ... only tests in this block will be run</span>\n})\n</code></pre>\n<p>或者，您可以使用 mocha 的 <code>grep</code> 选项来只运行与给定正则表达式模式匹配的测试</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span> -- --grep child_process\n</code></pre>\n<p>包含本地模块(例如<code>runas</code>)的测试无法在调试版本中执行 (查看 <a href=\"https://github.com/electron/electron/issues/2558\">#2558</a> 获取详情), 但它们将与发行版本一起使用。</p>\n<p>要使用发行构建来运行测试：</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span> -- -R\n</code></pre>",
      "title": "构建系统概览",
      "description": ""
    },
    "/docs/api/structures/certificate": {
      "locale": "zh-CN",
      "slug": "certificate",
      "href": "/docs/api/structures/certificate",
      "crowdinFileId": "256415",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/certificate.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"certificate-object\"><a href=\"#certificate-object\">Certificate Object</a></h1>\n<ul>\n<li><code>data</code> String - PEM encoded data</li>\n<li><code>issuer</code> <a href=\"/docs/api/structures/certificate-principal\">CertificatePrincipal</a> - Issuer principal</li>\n<li><code>issuerName</code> String - Issuer's Common Name</li>\n<li><code>issuerCert</code> Certificate - Issuer certificate (if not self-signed)</li>\n<li><code>subject</code> <a href=\"/docs/api/structures/certificate-principal\">CertificatePrincipal</a> - Subject principal</li>\n<li><code>subjectName</code> String - Subject's Common Name</li>\n<li><code>serialNumber</code> String - Hex value represented string</li>\n<li><code>validStart</code> Number - Start date of the certificate being valid in seconds</li>\n<li><code>validExpiry</code> Number - End date of the certificate being valid in seconds</li>\n<li><code>fingerprint</code> String - Fingerprint of the certificate</li>\n</ul>",
      "title": "Certificate Object",
      "description": ""
    },
    "/docs/api/structures/certificate-principal": {
      "locale": "zh-CN",
      "slug": "certificate-principal",
      "href": "/docs/api/structures/certificate-principal",
      "crowdinFileId": "256413",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/certificate-principal.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"certificateprincipal-object\"><a href=\"#certificateprincipal-object\">CertificatePrincipal Object</a></h1>\n<ul>\n<li><code>commonName</code> String - Common Name.</li>\n<li><code>organizations</code> String[] - Organization names.</li>\n<li><code>organizationUnits</code> String[] - Organization Unit names.</li>\n<li><code>locality</code> String - Locality.</li>\n<li><code>state</code> String - State or province.</li>\n<li><code>country</code> String - Country or region.</li>\n</ul>",
      "title": "CertificatePrincipal Object",
      "description": ""
    },
    "/docs/development/chromium-development": {
      "locale": "zh-CN",
      "slug": "chromium-development",
      "href": "/docs/development/chromium-development",
      "crowdinFileId": "256141",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/chromium-development.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"chromium-开发\"><a href=\"#chromium-开发\">Chromium 开发</a></h1>\n<blockquote>\n<p>学习以及了解 Chromium 开发进展的相关资源</p>\n</blockquote>\n<ul>\n<li>Twitter 账户 <a href=\"https://twitter.com/ChromiumDev\">@ChromiumDev</a></li>\n<li>Twitter 账户 <a href=\"https://twitter.com/googlechrome\">@googlechrome</a></li>\n<li><a href=\"https://blog.chromium.org\">博客</a></li>\n<li><a href=\"https://cs.chromium.org/\">代码搜索</a></li>\n<li><a href=\"https://cs.chromium.org/chromium/src/\">源代码</a></li>\n<li><a href=\"https://www.chromium.org/developers/calendar\">开发日历和版本信息</a></li>\n<li><a href=\"https://www.chromium.org/developers/discussion-groups\">讨论组</a></li>\n</ul>\n<p>参阅 <a href=\"/docs/development/v8-development\">V8 开发</a></p>",
      "title": "Chromium 开发",
      "description": "学习以及了解 Chromium 开发进展的相关资源"
    },
    "/docs/development/clang-format": {
      "locale": "zh-CN",
      "slug": "clang-format",
      "href": "/docs/development/clang-format",
      "crowdinFileId": "256143",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/clang-format.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"在-c-代码中使用-clang-format-工具\"><a href=\"#在-c-代码中使用-clang-format-工具\">在 C++ 代码中使用 clang-format 工具</a></h1>\n<p><a href=\"https://clang.llvm.org/docs/ClangFormat.html\"><code>clang-format</code></a>是一个自动格式化 C/C++/Objective-C 代码的工具, 可以让开发人员不需要担心代码审查期间的样式问题.</p>\n<p>强烈建议在发起请求之前格式化已更改的 C++ 代码，这将节省您和审阅者的时间.</p>\n<p>你可以通过 <code>npm install -g clang-format</code> 安装 <code>clang-format</code> 和 <code>git-clang-format</code>.</p>\n<p>To automatically format a file according to Electron C++ code style, run <code>clang-format -i path/to/electron/file.cc</code>. It should work on macOS/Linux/Windows.</p>\n<p>格式化已更改代码的工作流:</p>\n<ol>\n<li>在 Electron 存储库中更改代码.</li>\n<li>运行 <code>git add your_changed_file.cc</code>.</li>\n<li>运行 <code>git-clang-format</code>, 然后你将可能会看到修改后的 <code>your_changed_file.cc</code>, 这些修改是从 <code>clang-format</code> 生成的.</li>\n<li>运行 <code>git add your_changed_file.cc</code>, 并提交你的修改.</li>\n<li>现在准备好的分支推送请求已经被打开.</li>\n</ol>\n<p>If you want to format the changed code on your latest git commit (HEAD), you can run <code>git-clang-format HEAD~1</code>. See <code>git-clang-format -h</code> for more details.</p>\n<h2 id=\"编辑器集成\"><a href=\"#编辑器集成\">编辑器集成</a></h2>\n<p>You can also integrate <code>clang-format</code> directly into your favorite editors. For further guidance on setting up editor integration, see these pages:</p>\n<ul>\n<li><a href=\"https://atom.io/packages/clang-format\">Atom</a></li>\n<li><a href=\"https://clang.llvm.org/docs/ClangFormat.html#vim-integration\">Vim &#x26; Emacs</a></li>\n<li><a href=\"https://marketplace.visualstudio.com/items?itemName=xaver.clang-format\">Visual Studio Code</a></li>\n</ul>",
      "title": "在 C++ 代码中使用 clang-format 工具",
      "description": ""
    },
    "/docs/development/clang-tidy": {
      "locale": "zh-CN",
      "slug": "clang-tidy",
      "href": "/docs/development/clang-tidy",
      "crowdinFileId": "256145",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/clang-tidy.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"在-c-代码中使用clang-tidy\"><a href=\"#在-c-代码中使用clang-tidy\">在 C++ 代码中使用clang-tidy</a></h1>\n<p><a href=\"https://clang.llvm.org/extra/clang-tidy/\"><code>叮当</code></a> 是自动检查 C/C++/Objective-C 代码的样式冲突、编程 错误和最佳实践的工具。</p>\n<p>Electron's <code>clang-tidy</code> integration is provided as a linter script which can be run with <code>npm run lint:clang-tidy</code>. While <code>clang-tidy</code> checks your on-disk files, you need to have built Electron so that it knows which compiler flags were used. There is one required option for the script <code>--output-dir</code>, which tells the script which build directory to pull the compilation information from. A typical usage would be: <code>npm run lint:clang-tidy --out-dir ../out/Testing</code></p>\n<p>With no filenames provided, all C/C++/Objective-C files will be checked. 您可以提供要检查的文件列表，在 选项后通过文件名： <code>npm 运行行：clang-tidy --out-dir 。 /out/测试shell/browser/api/electron_api_app.cc</code></p>\n<p>While <code>clang-tidy</code> has a <a href=\"https://clang.llvm.org/extra/clang-tidy/checks/list.html\">long list</a> of possible checks, in Electron only a few are enabled by default. At the moment Electron doesn't have a <code>.clang-tidy</code> config, so <code>clang-tidy</code> will find the one from Chromium at <code>src/.clang-tidy</code> and use the checks which Chromium has enabled. You can change which checks are run by using the <code>--checks=</code> option. This is passed straight through to <code>clang-tidy</code>, so see its documentation for full details. Wildcards can be used, and checks can be disabled by prefixing a <code>-</code>. By default any checks listed are added to those in <code>.clang-tidy</code>, so if you'd like to limit the checks to specific ones you should first exclude all checks then add back what you want, like <code>--checks=-*,performance*</code>.</p>\n<p>Running <code>clang-tidy</code> is rather slow - internally it compiles each file and then runs the checks so it will always be some factor slower than compilation. While you can use parallel runs to speed it up using the <code>--jobs|-j</code> option, <code>clang-tidy</code> also uses a lot of memory during its checks, so it can easily run into out-of-memory errors. As such the default number of jobs is one.</p>",
      "title": "在 C++ 代码中使用clang-tidy",
      "description": ""
    },
    "/docs/api/client-request": {
      "locale": "zh-CN",
      "slug": "client-request",
      "href": "/docs/api/client-request",
      "crowdinFileId": "256289",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/client-request.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类-clientrequest\"><a href=\"#类-clientrequest\">类: ClientRequest</a></h2>\n<blockquote>\n<p>发起HTTP/HTTPS请求.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>ClientRequest</code>实现了<a href=\"https://nodejs.org/api/stream.html#stream_writable_streams\">Writable Stream</a>接口, 因此是一个<a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>类型.</p>\n<h3 id=\"new-clientrequestoptions\"><a href=\"#new-clientrequestoptions\"><code>new ClientRequest(options)</code></a></h3>\n<ul>\n<li><code>options</code> (Object | String) - 如果 <code>options</code> 是字符串，则将其解释为请求 URL。 如果是对象，它应该通过以下属性完全指定HTTP请求：<ul>\n<li><code>method</code> String (可选) - HTTP 请求方法。 默认为GET方法。</li>\n<li><code>url</code> String (可选) - 请求URL。 必须以绝对路径形式提供，并将协议指定为http或https。</li>\n<li><code>session</code> Object (可选) - 与请求相关联的<a href=\"/docs/api/session\"><code>Session</code></a>实例.</li>\n<li><code>partition</code> String (可选) - 与请求相关联的<a href=\"/docs/api/session\"><code>partition</code></a>名称. 默认为空字符串. <code>session</code> 选项取代了 <code>partition</code>。 因此, 如果<code>session</code>是显式指定的, 则<code>partition</code>将被忽略.</li>\n<li><code>credentials</code> String (可选) - 可以是 <code>include</code> 或 <code>omit</code>。 是否随此请求发送 <a href=\"https://fetch.spec.whatwg.org/#credentials\">凭据</a>。 如果设置为 <code>include</code>，将使用与请求相关的会话凭据。 如果设置为 <code>omit</code>，则不会随请求发送凭据(并且不会在 401响应的事件中触发 <code>'login'</code> 事件)。 这与同名的 <a href=\"https://fetch.spec.whatwg.org/#concept-request-credentials-mode\">fetch</a> 选项的行为相同。 如果未指定此选项，则会发送来自会话的身份验证数据，同时不发送cookie(除非 设置了<code>useSessionCookies</code>)。</li>\n<li><code>useSessionCookies</code> Boolean (可选) - 是否从提供的会话与请求一起发送cookie。 如果指定了 <code>credentials</code> ，则此选项没有效果。 默认值为 <code>false</code>.</li>\n<li><code>protocol</code> String (可选) - 可以是 <code>http:</code> 或 <code>https:</code>。 协议方案的形式为“scheme:”。 默认为 'http:'。</li>\n<li><code>host</code> String (可选) - 作为连接提供的服务器主机,主机名和端口号'hostname:port'.</li>\n<li><code>hostname</code> String (可选) - 服务器主机名.</li>\n<li><code>port</code> Integer (可选) - 服务器侦听的端口号.</li>\n<li><code>path</code> String (可选) - 请求URL的路径部分.</li>\n<li><code>redirect</code> String (可选) - 可以是 <code>follow</code>， <code>error</code> 或 <code>manual</code>。 当前请求的重定向模式。 当模式为 <code>error</code> 时，任何重定向都会被中止。 当模式为 <code>manual</code> 时，重定向会被取消，除非 <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> 在<a href=\"#event-redirect\"><code>redirect</code></a> 事件期间同步调用。  默认值为 <code>follow</code>.</li>\n<li><code>origin</code> String (可选) - 请求的源 URL。</li>\n</ul></li>\n</ul>\n<p><code>options</code> 属性，如 <code>protocol</code>, <code>host</code>, <code>hostname</code>, <code>port</code> 和 <code>path</code>，在 <a href=\"https://nodejs.org/api/url.html\">URL</a> 模块中会严格遵循 Node.js 的模式</p>\n<p>例如,我们可以创建与github.com相同的请求如下:</p>\n<pre><code class=\"hljs language-JavaScript\"><span class=\"hljs-keyword\">const</span> request = net.request({\n  <span class=\"hljs-attr\">method</span>: <span class=\"hljs-string\">'GET'</span>,\n  <span class=\"hljs-attr\">protocol</span>: <span class=\"hljs-string\">'https:'</span>,\n  <span class=\"hljs-attr\">hostname</span>: <span class=\"hljs-string\">'github.com'</span>,\n  <span class=\"hljs-attr\">port</span>: <span class=\"hljs-number\">443</span>,\n  <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'/'</span>\n})\n</code></pre>\n<h3 id=\"实例事件\"><a href=\"#实例事件\">实例事件</a></h3>\n<h4 id=\"事件-response\"><a href=\"#事件-response\">事件: 'response'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>response</code> <a href=\"/docs/api/incoming-message\">收到的消息</a> - 表示HTTP响应消息的对象。</li>\n</ul>\n<h4 id=\"事件-login\"><a href=\"#事件-login\">事件: \"login\"</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>authInfo</code> Object<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (可选)</li>\n<li><code>password</code> String (可选)</li>\n</ul></li>\n</ul>\n<p>当身份验证代理请求用户认证时触发</p>\n<p>用户证书会调用 <code>callback</code>方法:</p>\n<ul>\n<li><code>username</code> String</li>\n<li><code>password</code> String</li>\n</ul>\n<pre><code class=\"hljs language-JavaScript\">request.on(<span class=\"hljs-string\">'login'</span>, (authInfo, callback) => {\n  callback(<span class=\"hljs-string\">'username'</span>, <span class=\"hljs-string\">'password'</span>)\n})\n</code></pre>\n<p>提供空的凭证将取消请求，并在响应对象上报告一个身份验证错误:</p>\n<pre><code class=\"hljs language-JavaScript\">request.on(<span class=\"hljs-string\">'response'</span>, (response) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`STATUS: <span class=\"hljs-subst\">${response.statusCode}</span>`</span>);\n  response.on(<span class=\"hljs-string\">'error'</span>, (error) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`ERROR: <span class=\"hljs-subst\">${<span class=\"hljs-built_in\">JSON</span>.stringify(error)}</span>`</span>)\n  })\n})\nrequest.on(<span class=\"hljs-string\">'login'</span>, (authInfo, callback) => {\n  callback()\n})\n</code></pre>\n<h4 id=\"事件：finish\"><a href=\"#事件：finish\">事件：'finish'</a></h4>\n<p>在 <code>request</code> 最终的 chunk 数据后写入 <code>request</code> 后触发</p>\n<h4 id=\"事件-abort\"><a href=\"#事件-abort\">事件: 'abort'</a></h4>\n<p>在 <code>request</code> 被中止时触发。 如果 <code>request</code> 已经关闭， <code>abort</code> 事件将不会被触发。</p>\n<h4 id=\"event-error\"><a href=\"#event-error\">Event: 'error'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>error</code> Error -提供失败信息的错误对象。</li>\n</ul>\n<p>当 <code>net</code>网络模块没有发出网络请求时会触发。 通常情况下，当 <code>request</code>请求对象发出一个 <code>error</code>错误事件时，一个 <code>close</code>关闭事件会随之发生，并且不会提供响应对象。</p>\n<h4 id=\"事件：-close\"><a href=\"#事件：-close\">事件： 'close'</a></h4>\n<p>作为HTTP 的 request-response 中的最后一个事件发出。 <code>close</code>事件表明，在<code>request</code>或<code>response</code> 对象中不会发出更多的事件。</p>\n<h4 id=\"事件-redirect\"><a href=\"#事件-redirect\">事件: 'redirect'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>statusCode</code> Integer</li>\n<li><code>method</code> String</li>\n<li><code>redirectUrl</code> String</li>\n<li><code>responseHeaders</code> Record&#x3C;String, String[]></li>\n</ul>\n<p>当服务器返回重定向响应时触发(例如，301 页面永久性移走)。 调用 <a href=\"#requestfollowredirect\"><code>request.followRirect</code></a> 将继续重定向。  如果该事件被处理，<a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> 必须<strong>同步</strong>调用，否则请求将被取消。</p>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<h4 id=\"requestchunkedencoding\"><a href=\"#requestchunkedencoding\"><code>request.chunkedEncoding</code></a></h4>\n<p>一个<code>Boolean</code>类型的值，指定请求是否将使用 HTTP 分块传输编码。 默认值为 false. 该属性是可读写的, 但它只能在第一次写入操作之前设置，因为还没有写入 HTTP 头。 在第一写入后如果设置<code>chunkedEncoding</code>属性将引发错误。</p>\n<p>如果 request 的 body 是一个大的数据时，强烈建议使用块编码。因为数据将以小块的方式进行传输, 而不是在 Electron 进程内存中内部缓冲。</p>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<h4 id=\"requestsetheadername-value\"><a href=\"#requestsetheadername-value\"><code>request.setHeader(name, value)</code></a></h4>\n<ul>\n<li><code>name</code> String - 额外的 HTTP 头名称.</li>\n<li><code>value</code> String - 额外的 HTTP 头部值。</li>\n</ul>\n<p>添加一个额外的 HTTP 头。 头名称将按原样发布，不会转为小写。 它只能在第一次写入之前调用。 在第一次写入后调用此方法将引发错误。 如果传递的值不是 <code>String</code>, 则会调用 <code>toString ()</code> 方法来获取最终值。</p>\n<p>某些头部受应用程序设置的限制。 这些头部如下所列。 有关受限头部的更多信息，可以在 <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:services/network/public/cpp/header_util.cc;drc=1562cab3f1eda927938f8f4a5a91991fefde66d3;bpv=1;bpt=1;l=22\">Chromium的头部工具</a> 中找到。</p>\n<ul>\n<li><code>Content-Length</code></li>\n<li><code>Host</code></li>\n<li><code>Trailer</code> 或 <code>Te</code></li>\n<li><code>Upgrade</code></li>\n<li><code>Cookie2</code></li>\n<li><code>Keep-Alive</code></li>\n<li><code>Transfer-Encoding</code></li>\n</ul>\n<p>此外，也不允许将 <code>Connection</code> 头部设置为 <code>upgrade</code>。</p>\n<h4 id=\"requestgetheadername\"><a href=\"#requestgetheadername\"><code>request.getHeader(name)</code></a></h4>\n<ul>\n<li><code>name</code> String - 指定一个额外的头名称.</li>\n</ul>\n<p>返回 <code>String</code> - 以前设置的额外头部名称的值。</p>\n<h4 id=\"requestremoveheadername\"><a href=\"#requestremoveheadername\"><code>request.removeHeader(name)</code></a></h4>\n<ul>\n<li><code>name</code> String - 指定一个额外的头名称.</li>\n</ul>\n<p>移除先前设置的额外头部名称。 此方法只能在首次写入前调用。 尝试在第一次写入后调用将抛出一个错误。</p>\n<h4 id=\"requestwritechunk-encoding-callback\"><a href=\"#requestwritechunk-encoding-callback\"><code>request.write(chunk[, encoding][, callback])</code></a></h4>\n<ul>\n<li><code>chunk</code> (String | Buffer) - 请求主体的数据块。 如果是字符串，则使用指定的编码将其转换为Buffer。</li>\n<li><code>encoding</code> String (可选) - 用于将字符串块转换为Buffer对象。 默认为“utf-8”。</li>\n<li><code>callback</code> Function (可选)-在写操作结束后调用。</li>\n</ul>\n<p><code>callback</code> 实质上是为了保持与 Node.js API 的相似性而引入的虚拟函数。 在将 <code>chunk</code> 内容传递到 Chromium 网络层之后, 在下一个 tick 中异步调用。 与 Node.js 实现相反, 不保证 <code>chunk</code> 内容在调用 <code>callback</code> 之前已经被刷新。</p>\n<p>向请求正文中添加一个数据块。 第一次写操作可能导致在线路上发出请求头。 在第一次写入操作后, 不允许添加或删除自定义标头。</p>\n<h4 id=\"requestendchunk-encoding-callback\"><a href=\"#requestendchunk-encoding-callback\"><code>request.end([chunk][, encoding][, callback])</code></a></h4>\n<ul>\n<li><code>chunk</code> (String | Buffer) (可选)</li>\n<li><code>encoding</code> String (可选)</li>\n<li><code>callback</code> Function (可选)</li>\n</ul>\n<p>发送请求数据的剩下部分。 不允许进行后续的写入或结束操作。 <code>finish</code> 事件在结束操作后发出。</p>\n<h4 id=\"requestabort\"><a href=\"#requestabort\"><code>request.abort()</code></a></h4>\n<p>取消正在进行的 HTTP 事务。 如果请求已发出 <code>close</code> 事件, 则中止操作将不起作用。 否则正在进行的事件将发出 <code>abort</code> 和 <code>close</code> 事件。 此外, 如果有一个正在进行的响应对象, 它将发出 <code>aborted</code> 事件。</p>\n<h4 id=\"requestfollowredirect\"><a href=\"#requestfollowredirect\"><code>request.followRedirect()</code></a></h4>\n<p>继续任何待处理的重定向。 只能在 <code>'redirect'</code> 事件期间调用。</p>\n<h4 id=\"requestgetuploadprogress\"><a href=\"#requestgetuploadprogress\"><code>request.getUploadProgress()</code></a></h4>\n<p>返回 <code>Object</code>:</p>\n<ul>\n<li><code>active</code> Boolean - 请求当前是否处于活动状态。 如果为 false，将不会设置其他属性。</li>\n<li><code>started</code> Boolean - 上传是否已经开始。 如果值为false，<code>current</code> 和 <code>total</code> 将被设置为 0。</li>\n<li><code>current</code> Integer - 到目前为止已上传的字节数</li>\n<li><code>total</code> Integer - 本次请求总共要上传的字节数</li>\n</ul>\n<p>您可以使用此方法获取使用 <code>POST</code> 请求的文件上传或其他数据传输的进度</p>",
      "title": "类: ClientRequest",
      "description": "发起HTTP/HTTPS请求."
    },
    "/docs/api/clipboard": {
      "locale": "zh-CN",
      "slug": "clipboard",
      "href": "/docs/api/clipboard",
      "crowdinFileId": "256291",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/clipboard.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"clipboard\"><a href=\"#clipboard\">clipboard</a></h1>\n<blockquote>\n<p>在系统剪贴板上执行复制和粘贴操作。</p>\n</blockquote>\n<p>进程： <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>在 Linux 上，还有一个 <code>selection</code> 粘贴板 。 想要操作该剪切板，你需要为每个函数传递 <code>selection</code> 参数。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeText(<span class=\"hljs-string\">'Example String'</span>, <span class=\"hljs-string\">'selection'</span>)\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readText(<span class=\"hljs-string\">'selection'</span>))\n</code></pre>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>clipboard</code> 对象具有以下方法:</p>\n<p><strong> 注意: </strong>被标记为实验性的 api 将来可能被删除。</p>\n<h3 id=\"clipboardreadtexttype\"><a href=\"#clipboardreadtexttype\"><code>clipboard.readText([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) -可以是 <code>selection</code> 或 <code>clipboard</code>; 默认为 'clipboard'. <code>selection</code> 仅在 Linux 中可用。</li>\n</ul>\n<p>返回 <code>String</code>- 剪贴板中的纯文本内容。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeText(<span class=\"hljs-string\">'hello i am a bit of text!'</span>)\n\n<span class=\"hljs-keyword\">const</span> text = clipboard.readText()\n<span class=\"hljs-built_in\">console</span>.log(text)\n<span class=\"hljs-comment\">// hello i am a bit of text!'</span>\n</code></pre>\n<h3 id=\"clipboardwritetexttext-type\"><a href=\"#clipboardwritetexttext-type\"><code>clipboard.writeText(text[, type])</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n<li><code>type</code> String (optional) -可以是 <code>selection</code> 或 <code>clipboard</code>; 默认为 'clipboard'. <code>selection</code> 仅在 Linux 中可用。</li>\n</ul>\n<p>将 <code>text</code> 作为纯文本写入剪贴板。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> text = <span class=\"hljs-string\">'hello i am a bit of text!'</span>\nclipboard.writeText(text)\n</code></pre>\n<h3 id=\"clipboardreadhtmltype\"><a href=\"#clipboardreadhtmltype\"><code>clipboard.readHTML([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) -可以是 <code>selection</code> 或 <code>clipboard</code>; 默认为 'clipboard'. <code>selection</code> 仅在 Linux 中可用。</li>\n</ul>\n<p>返回 <code>String</code>- 剪贴板中的HTML内容。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeHTML(<span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b>'</span>)\n<span class=\"hljs-keyword\">const</span> html = clipboard.readHTML()\n\n<span class=\"hljs-built_in\">console</span>.log(html)\n<span class=\"hljs-comment\">// &#x3C;meta charset='utf-8'>&#x3C;b>Hi&#x3C;/b></span>\n</code></pre>\n<h3 id=\"clipboardwritehtmlmarkup-type\"><a href=\"#clipboardwritehtmlmarkup-type\"><code>clipboard.writeHTML(markup[, type])</code></a></h3>\n<ul>\n<li><code>markup</code> String</li>\n<li><code>type</code> String (optional) -可以是 <code>selection</code> 或 <code>clipboard</code>; 默认为 'clipboard'. <code>selection</code> 仅在 Linux 中可用。</li>\n</ul>\n<p>将 <code>markup</code> 写入剪贴板。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeHTML(<span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b'</span>)\n</code></pre>\n<h3 id=\"clipboardreadimagetype\"><a href=\"#clipboardreadimagetype\"><code>clipboard.readImage([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) -可以是 <code>selection</code> 或 <code>clipboard</code>; 默认为 'clipboard'. <code>selection</code> 仅在 Linux 中可用。</li>\n</ul>\n<p>返回 <a href=\"/docs/api/native-image\"><code>NativeImage</code></a>- 剪贴板中的图像内容。</p>\n<h3 id=\"clipboardwriteimageimage-type\"><a href=\"#clipboardwriteimageimage-type\"><code>clipboard.writeImage(image[, type])</code></a></h3>\n<ul>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a></li>\n<li><code>type</code> String (optional) -可以是 <code>selection</code> 或 <code>clipboard</code>; 默认为 'clipboard'. <code>selection</code> 仅在 Linux 中可用。</li>\n</ul>\n<p>将 <code>image</code> 写入剪贴板。</p>\n<h3 id=\"clipboardreadrtftype\"><a href=\"#clipboardreadrtftype\"><code>clipboard.readRTF([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) -可以是 <code>selection</code> 或 <code>clipboard</code>; 默认为 'clipboard'. <code>selection</code> 仅在 Linux 中可用。</li>\n</ul>\n<p>返回 <code>String</code>- 剪贴板中的RTF内容。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeRTF(<span class=\"hljs-string\">'{\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}'</span>)\n\n<span class=\"hljs-keyword\">const</span> rtf = clipboard.readRTF()\n<span class=\"hljs-built_in\">console</span>.log(rtf)\n<span class=\"hljs-comment\">// {\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}</span>\n</code></pre>\n<h3 id=\"clipboardwritertftext-type\"><a href=\"#clipboardwritertftext-type\"><code>clipboard.writeRTF(text[, type])</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n<li><code>type</code> String (optional) -可以是 <code>selection</code> 或 <code>clipboard</code>; 默认为 'clipboard'. <code>selection</code> 仅在 Linux 中可用。</li>\n</ul>\n<p>向剪贴板中写入 RTF 格式的 <code>text</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> rtf = <span class=\"hljs-string\">'{\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}'</span>\nclipboard.writeRTF(rtf)\n</code></pre>\n<h3 id=\"clipboardreadbookmark-macos-windows\"><a href=\"#clipboardreadbookmark-macos-windows\"><code>clipboard.readBookmark()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>返回 <code>Object</code>:</p>\n<ul>\n<li><code>title</code> String</li>\n<li><code>url</code> String</li>\n</ul>\n<p>返回一个对象, 其中包含表示剪贴板中书签 <code>title</code> 和 <code>url</code> 。 当书签不可用时, <code>title</code> 和 <code>url</code> 值将为空字符串。</p>\n<h3 id=\"clipboardwritebookmarktitle-url-type-macos-windows\"><a href=\"#clipboardwritebookmarktitle-url-type-macos-windows\"><code>clipboard.writeBookmark(title, url[, type])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>title</code> String</li>\n<li><code>url</code> String</li>\n<li><code>type</code> String (optional) -可以是 <code>selection</code> 或 <code>clipboard</code>; 默认为 'clipboard'. <code>selection</code> 仅在 Linux 中可用。</li>\n</ul>\n<p>将书签的 <code>title</code> 和 <code>url</code> 写入剪贴板。</p>\n<p><strong>注意</strong>：Windows上的大多数应用程序不支持粘贴书签，因此你可以使用 <code>clipboard.write</code> 将书签和后备文本写入剪贴板。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeBookmark({\n  <span class=\"hljs-attr\">text</span>: <span class=\"hljs-string\">'https://electronjs.org'</span>,\n  <span class=\"hljs-attr\">bookmark</span>: <span class=\"hljs-string\">'Electron Homepage'</span>\n})\n</code></pre>\n<h3 id=\"clipboardreadfindtext-macos\"><a href=\"#clipboardreadfindtext-macos\"><code>clipboard.readFindText()</code> <em>macOS</em></a></h3>\n<p>返回 <code>String</code> - \"查找粘贴板\"上的文本，这是保存有关活动应用程序查找面板当前状态信息的粘贴板。</p>\n<p>此方法从渲染进程调用时使用同步 IPC。 每当激活应用程序时, 都会从查找粘贴板中重新读取缓存值。</p>\n<h3 id=\"clipboardwritefindtexttext-macos\"><a href=\"#clipboardwritefindtexttext-macos\"><code>clipboard.writeFindText(text)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>将 <code>text</code> 作为纯文本写入查找粘贴板(粘贴板上有关于当前应用程序查找面板状态的信息)。 此方法从渲染进程调用时使用同步 IPC。</p>\n<h3 id=\"clipboardcleartype\"><a href=\"#clipboardcleartype\"><code>clipboard.clear([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) -可以是 <code>selection</code> 或 <code>clipboard</code>; 默认为 'clipboard'. <code>selection</code> 仅在 Linux 中可用。</li>\n</ul>\n<p>清除剪贴板内容。</p>\n<h3 id=\"clipboardavailableformatstype\"><a href=\"#clipboardavailableformatstype\"><code>clipboard.availableFormats([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) -可以是 <code>selection</code> 或 <code>clipboard</code>; 默认为 'clipboard'. <code>selection</code> 仅在 Linux 中可用。</li>\n</ul>\n<p>返回 <code>String []</code>- 剪贴板 <code>type</code> 所支持的格式的数组。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> formats = clipboard.availableFormats()\n<span class=\"hljs-built_in\">console</span>.log(formats)\n<span class=\"hljs-comment\">// [ 'text/plain', 'text/html' ]</span>\n</code></pre>\n<h3 id=\"clipboardhasformat-type-实验功能\"><a href=\"#clipboardhasformat-type-实验功能\"><code>clipboard.has(format[, type])</code> <em>实验功能</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n<li><code>type</code> String (optional) -可以是 <code>selection</code> 或 <code>clipboard</code>; 默认为 'clipboard'. <code>selection</code> 仅在 Linux 中可用。</li>\n</ul>\n<p>返回 <code>Boolean</code>, 剪贴板是否支持指定的 <code>format</code>。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> hasFormat = clipboard.has(<span class=\"hljs-string\">'&#x3C;p>selection&#x3C;/p>'</span>)\n<span class=\"hljs-built_in\">console</span>.log(hasFormat)\n<span class=\"hljs-comment\">// 'true' or 'false'</span>\n</code></pre>\n<h3 id=\"clipboardreadformat-实验功能\"><a href=\"#clipboardreadformat-实验功能\"><code>clipboard.read(format)</code> <em>实验功能</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n</ul>\n<p>返回 <code>String</code>- 从剪贴板中读取 <code>format</code> 类型的内容。</p>\n<p><code>format</code> should contain valid ASCII characters and have <code>/</code> separator. <code>a/c</code>, <code>a/bc</code> are valid formats while <code>/abc</code>, <code>abc/</code>, <code>a/</code>, <code>/a</code>, <code>a</code> are not valid.</p>\n<h3 id=\"clipboardreadbufferformat-实验功能\"><a href=\"#clipboardreadbufferformat-实验功能\"><code>clipboard.readBuffer(format)</code> <em>实验功能</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n</ul>\n<p>返回 <code>Buffer</code>- 从剪贴板中读取 <code>format</code> 类型的内容。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> buffer = Buffer.from(<span class=\"hljs-string\">'this is binary'</span>, <span class=\"hljs-string\">'utf8'</span>)\nclipboard.writeBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>, buffer)\n\n<span class=\"hljs-keyword\">const</span> ret = clipboard.readBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>)\n\n<span class=\"hljs-built_in\">console</span>.log(buffer.equals(out))\n<span class=\"hljs-comment\">// true</span>\n</code></pre>\n<h3 id=\"clipboardwritebufferformat-buffer-type-实验功能\"><a href=\"#clipboardwritebufferformat-buffer-type-实验功能\"><code>clipboard.writeBuffer(format, buffer[, type])</code> <em>实验功能</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n<li><code>buffer</code> Buffer</li>\n<li><code>type</code> String (optional) -可以是 <code>selection</code> 或 <code>clipboard</code>; 默认为 'clipboard'. <code>selection</code> 仅在 Linux 中可用。</li>\n</ul>\n<p>将 <code>buffer </code> 作为 <code>format</code> 类型写入剪贴板。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> buffer = Buffer.from(<span class=\"hljs-string\">'writeBuffer'</span>, <span class=\"hljs-string\">'utf8'</span>)\nclipboard.writeBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>, buffer)\n</code></pre>\n<h3 id=\"clipboardwritedata-type\"><a href=\"#clipboardwritedata-type\"><code>clipboard.write(data[, type])</code></a></h3>\n<ul>\n<li><code>data</code> Object<ul>\n<li><code>text</code> String（可选）</li>\n<li><code>html</code> String（可选）</li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> (可选)</li>\n<li><code>rtf</code> String (可选)</li>\n<li><code>bookmark</code> String (可选)- URL 的标题 <code>text</code>。</li>\n</ul></li>\n<li><code>type</code> String (optional) -可以是 <code>selection</code> 或 <code>clipboard</code>; 默认为 'clipboard'. <code>selection</code> 仅在 Linux 中可用。</li>\n</ul>\n<p>将 <code>data</code> 写入剪贴板。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.write({\n  <span class=\"hljs-attr\">text</span>: <span class=\"hljs-string\">'test'</span>,\n  <span class=\"hljs-attr\">html</span>: <span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b>'</span>,\n  <span class=\"hljs-attr\">rtf</span>: <span class=\"hljs-string\">'{\\\\rtf1\\\\utf8 text}'</span>,\n  <span class=\"hljs-attr\">bookmark</span>: <span class=\"hljs-string\">'a title'</span>\n})\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readText())\n<span class=\"hljs-comment\">// 'test'</span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readHTML())\n<span class=\"hljs-comment\">// &#x3C;meta charset='utf-8'>&#x3C;b>Hi&#x3C;/b></span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readRTF())\n<span class=\"hljs-comment\">// '{\\\\rtf1\\\\utf8 text}'</span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readBookmark())\n<span class=\"hljs-comment\">// { title: 'a title', url: 'test' }</span>\n</code></pre>",
      "title": "clipboard",
      "description": "在系统剪贴板上执行复制和粘贴操作。"
    },
    "/docs/tutorial/code-signing": {
      "locale": "zh-CN",
      "slug": "code-signing",
      "href": "/docs/tutorial/code-signing",
      "crowdinFileId": "256183",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/code-signing.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"代码签名\"><a href=\"#代码签名\">代码签名</a></h1>\n<p>代码签名是一种用来证明应用是由你创建的一种安全技术。</p>\n<p>macOS 系统能通过代码签名检测对app的任何修改，包括意外修改和来自恶意代码的修改。</p>\n<p>On Windows, the system assigns a trust level to your code signing certificate which if you don't have, or if your trust level is low, will cause security dialogs to appear when users start using your application.  信任级别随着时间的推移构建，因此最好尽早开始代码签名。</p>\n<p>即使开发者可以发布一个未签名的应用程序，但是我们并不建议这样做。 Both Windows and macOS will, by default, prevent either the download or the execution of unsigned applications. Starting with macOS Catalina (version 10.15), users have to go through multiple manual steps to open unsigned applications.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/gatekeeper.png\" alt=\"macOS Catalina Gatekeeper 警告：无法打开应用程序，因为开发者无法验证\"></p>\n<p>如你所见，用户有两个选择：直接删除应用或者取消运行。 你不会想让用户看见该对话框。</p>\n<p>如果你正在开发一款Electron应用，并打算将其打包发布，那你就应该为其添加代码签名。</p>\n<h1 id=\"签名--认证-macos-版本\"><a href=\"#签名--认证-macos-版本\">签名 &#x26; 认证 macOS 版本</a></h1>\n<p>正确准备 macOS 应用程序的发布需要两个步骤：首先，应用程序需要签名。 然后，应用程序需要上传到苹果，然后才能进行名为“公证”的过程， 自动化系统将会进一步验证您的应用没有做任何事情来危及其用户。</p>\n<p>To start the process, ensure that you fulfill the requirements for signing and notarizing your app:</p>\n<ol>\n<li>加入 <a href=\"https://developer.apple.com/programs/\">Apple Developer Program</a>(需要缴纳年费)</li>\n<li>下载并安装 <a href=\"https://developer.apple.com/xcode\">Xcode</a> - 这需要一台运行 macOS 的计算机。</li>\n<li>生成，下载，然后安装<a href=\"https://github.com/electron/electron-osx-sign/wiki/1.-Getting-Started#certificates\">签名证书（signing certificates）</a></li>\n</ol>\n<p>Electron 的生态系统有利于配置和自由，所以有多种方法让您的应用程序签名和公证。</p>\n<h2 id=\"electron-forge\"><a href=\"#electron-forge\"><code>electron-forge</code></a></h2>\n<p>If you're using Electron's favorite build tool, getting your application signed and notarized requires a few additions to your configuration. <a href=\"https://electronforge.io\">Forge</a> 是官方的 Electron 工具的 集合，在hood下使用 <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a> <a href=\"https://github.com/electron-userland/electron-osx-sign\"><code>electron-osx-sign</code></a> <a href=\"https://github.com/electron/electron-notarize\"><code>electron-notarize</code></a> 。</p>\n<p>Let's take a look at an example configuration with all required fields. 并不是所有都是必需的：工具非常聪明足以自动找到合适的 <code>identity</code>, 例如，但我们建议你明白无误。</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"my-app\"</span>,\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.0.1\"</span>,\n  <span class=\"hljs-attr\">\"config\"</span>: {\n    <span class=\"hljs-attr\">\"forge\"</span>: {\n      <span class=\"hljs-attr\">\"packagerConfig\"</span>: {\n        <span class=\"hljs-attr\">\"osxSign\"</span>: {\n          <span class=\"hljs-attr\">\"identity\"</span>: <span class=\"hljs-string\">\"Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)\"</span>,\n          <span class=\"hljs-attr\">\"hardened-runtime\"</span>: <span class=\"hljs-literal\">true</span>,\n          <span class=\"hljs-attr\">\"entitlements\"</span>: <span class=\"hljs-string\">\"entitlements.plist\"</span>,\n          <span class=\"hljs-attr\">\"entitlements-inherit\"</span>: <span class=\"hljs-string\">\"entitlements.plist\"</span>,\n          <span class=\"hljs-attr\">\"signature-flags\"</span>: <span class=\"hljs-string\">\"library\"</span>\n        },\n        <span class=\"hljs-attr\">\"osxNotarize\"</span>: {\n          <span class=\"hljs-attr\">\"appleId\"</span>: <span class=\"hljs-string\">\"felix@felix.fun\"</span>,\n          <span class=\"hljs-attr\">\"appleIdPassword\"</span>: <span class=\"hljs-string\">\"my-apple-id-password\"</span>,\n        }\n      }\n    }\n  }\n}\n</code></pre>\n<p>此处引用的 <code>plist</code> 文件需要以下的 macOS 特定权限来保证您的应用正在做这些事情的苹果安全机制并不意味着任何伤害：</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.allow-jit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.debugger<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>Note that up until Electron 12, the <code>com.apple.security.cs.allow-unsigned-executable-memory</code> entitlement was required as well. However, it should not be used anymore if it can be avoided.</p>\n<p>要查看所有这些都在操作中，请查看 Electron Fiddle 的源代码，<a href=\"https://github.com/electron/fiddle/blob/master/forge.config.js\">尤其是其 <code>electron-forge</code> 配置文件</a>。</p>\n<p>如果您打算在应用中使用 Electron 的 API 访问麦克风或摄像头，您还需要添加以下权限：</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.device.audio-input<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.device.camera<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>If these are not present in your app's entitlements when you invoke, for example:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> microphone = systemPreferences.askForMediaAccess(<span class=\"hljs-string\">'microphone'</span>)\n</code></pre>\n<p>Your app may crash. 在 <a href=\"https://developer.apple.com/documentation/security/hardened_runtime\">Hardened Runtime</a> 中查看资源访问部分以获取更多信息和您可能需要的权限。</p>\n<h2 id=\"electron-builder\"><a href=\"#electron-builder\"><code>electron-builder</code></a></h2>\n<p>Electron Builder comes with a custom solution for signing your application. 你可以在这里找到 <a href=\"https://www.electron.build/code-signing\">它的文档</a></p>\n<h2 id=\"electron-packager\"><a href=\"#electron-packager\"><code>electron-packager</code></a></h2>\n<p>If you're not using an integrated build pipeline like Forge or Builder, you are likely using <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>, which includes <a href=\"https://github.com/electron-userland/electron-osx-sign\"><code>electron-osx-sign</code></a> and <a href=\"https://github.com/electron/electron-notarize\"><code>electron-notarize</code></a>.</p>\n<p>如果您正在使用Packager的 API，您可以通过配置 <a href=\"https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html\">来签名并对您的应用程序进行公证</a></p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> packager = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-packager'</span>)\n\npackager({\n  <span class=\"hljs-attr\">dir</span>: <span class=\"hljs-string\">'/path/to/my/app'</span>,\n  <span class=\"hljs-attr\">osxSign</span>: {\n    <span class=\"hljs-attr\">identity</span>: <span class=\"hljs-string\">'Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)'</span>,\n    <span class=\"hljs-string\">'hardened-runtime'</span>: <span class=\"hljs-literal\">true</span>,\n    <span class=\"hljs-attr\">entitlements</span>: <span class=\"hljs-string\">'entitlements.plist'</span>,\n    <span class=\"hljs-string\">'entitlements-inherit'</span>: <span class=\"hljs-string\">'entitlements.plist'</span>,\n    <span class=\"hljs-string\">'signature-flags'</span>: <span class=\"hljs-string\">'library'</span>\n  },\n  <span class=\"hljs-attr\">osxNotarize</span>: {\n    <span class=\"hljs-attr\">appleId</span>: <span class=\"hljs-string\">'felix@felix.fun'</span>,\n    <span class=\"hljs-attr\">appleIdPassword</span>: <span class=\"hljs-string\">'my-apple-id-password'</span>\n  }\n})\n</code></pre>\n<p>此处引用的 <code>plist</code> 文件需要以下的 macOS 特定权限来保证您的应用正在做这些事情的苹果安全机制并不意味着任何伤害：</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.allow-jit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.debugger<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>Up until Electron 12, the <code>com.apple.security.cs.allow-unsigned-executable-memory</code> entitlement was required as well. However, it should not be used anymore if it can be avoided.</p>\n<h2 id=\"mac-应用程序商店\"><a href=\"#mac-应用程序商店\">Mac 应用程序商店</a></h2>\n<p>See the <a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store Guide</a>.</p>\n<h1 id=\"签署windows应用程序\"><a href=\"#签署windows应用程序\">签署windows应用程序</a></h1>\n<p>在签署Windows应用程序前，你需要完成以下事项：</p>\n<ol>\n<li>Get a Windows Authenticode code signing certificate (requires an annual fee)</li>\n<li>安装 Visual Studio 以获取签名工具 (免费 <a href=\"https://visualstudio.microsoft.com/vs/community/\">社区版</a> 已足够)</li>\n</ol>\n<p>You can get a code signing certificate from a lot of resellers. 价格各异，所以值得你花点时间去货比三家。 Popular resellers include:</p>\n<ul>\n<li><a href=\"https://www.digicert.com/code-signing/microsoft-authenticode.htm\">digicert</a></li>\n<li><a href=\"https://sectigo.com/ssl-certificates-tls/code-signing\">Sectigo</a></li>\n<li>除其他外，请货比三家后选择适合你的那一款，Google 是您的朋友😄：</li>\n</ul>\n<p>你可以运用许多方式来签署你的应用：</p>\n<ul>\n<li><a href=\"https://github.com/electron/windows-installer\"><code>electron-winstaller</code></a> will generate an installer for windows and sign it for you</li>\n<li><a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a> can sign installers it generates through the Squirrel.Windows or MSI targets.</li>\n<li><a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> can sign some of its windows targets</li>\n</ul>\n<h2 id=\"windows-应用商店\"><a href=\"#windows-应用商店\">Windows 应用商店</a></h2>\n<p>See the <a href=\"/docs/tutorial/windows-store-guide\">Windows Store Guide</a>.</p>",
      "title": "代码签名",
      "description": ""
    },
    "/docs/development/coding-style": {
      "locale": "zh-CN",
      "slug": "coding-style",
      "href": "/docs/development/coding-style",
      "crowdinFileId": "256147",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/coding-style.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"编码风格\"><a href=\"#编码风格\">编码风格</a></h1>\n<p>这些是 Electron 编码风格指南。</p>\n<p>您可以运行 <code>npm run lint</code> 来显示 <code>cpplint</code> 和<code>eslint</code> 检测到的任何样式问题。</p>\n<h2 id=\"通用代码\"><a href=\"#通用代码\">通用代码</a></h2>\n<ul>\n<li>用换行符结束文件。</li>\n<li>按照如下顺序排列 node 模块的 require 代码<ul>\n<li>内置Node模块（如 <code>path</code>）</li>\n<li>内置Electron模块（如 <code>ipc</code>、<code>app</code>）</li>\n<li>本地模块（使用相对路径）</li>\n</ul></li>\n<li>按照如下顺序排列类的属性<ul>\n<li>Class methods and properties (methods starting with a <code>@</code>)</li>\n<li>Instance methods and properties</li>\n</ul></li>\n<li>避免与平台相关的代码：<ul>\n<li>使用 <code>path.join()</code> 来组织文件路径。</li>\n<li>请使用<code>os.tmpdir()</code>而不是<code>/tmp</code>来引用临时目录。</li>\n</ul></li>\n<li>Using a plain <code>return</code> when returning explicitly at the end of a function.<ul>\n<li>不是<code>return null</code>，<code>return undefined</code>，<code>null</code>或<code>undefined</code></li>\n</ul></li>\n</ul>\n<h2 id=\"c---和-python\"><a href=\"#c---和-python\">C + + 和 Python</a></h2>\n<p>对于 C++ 和 Python, 我们遵循 Chromium 的<a href=\"https://chromium.googlesource.com/chromium/src/+/refs/heads/main/styleguide/styleguide.md\">编码风格</a>. 你可以使用 <a href=\"/docs/development/clang-format\">clang-format</a> 来自动格式化 C++ 代码. 你可以使用 <code>script/cpplint.py</code> 来检验文件是否符合要求。</p>\n<p>我们现在使用的 Python 版本是 Python 2.7。</p>\n<p>C++ 代码使用了大量 Chromium 的抽象和类型，因此建议您熟悉它们。 一个起步的好地方是 Chromium 的 <a href=\"https://www.chromium.org/developers/coding-style/important-abstractions-and-data-structures\">重要的抽象概念和数据库结构</a> 文档. 该文档提到一些特殊类型，范围类型(超出范围时自动释放其内存), 记录机制等。</p>\n<h2 id=\"文档\"><a href=\"#文档\">文档</a></h2>\n<ul>\n<li>使用<a href=\"https://github.com/remarkjs/remark\">remark</a> Markdown样式.</li>\n</ul>\n<p>你可以运行 <code>npm run lint-docs</code> 来保证你修改的文档格式正确。</p>\n<h2 id=\"javascript\"><a href=\"#javascript\">JavaScript</a></h2>\n<ul>\n<li>书写 <a href=\"https://www.npmjs.com/package/standard\">标准</a> JavaScript 样式</li>\n<li>文件名应使用 <code>-</code> 连接而不是 <code>_</code>, 例如. <code>file-name.js</code> 而不是 <code>file_name.js</code>, 因为在 <a href=\"https://github.com/github/atom\">github/atom</a>中模块名通常是 <code>module-name</code> 形式. 此规则仅适用于 <code>.js</code> 文件。</li>\n<li>酌情使用更新的 ES6 / ES2015 语法<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const\"><code>const</code></a> 用于需要的和其他的常数.  If the value is a primitive, use uppercase naming (eg <code>const NUMBER_OF_RETRIES = 5</code>).</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let\"><code>let</code></a> 用于定义变量</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions\">Arrow functions</a> 代替 <code>function () { }</code></li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals\">Template literals</a> 而不是使用字符串连接符 <code>+</code></li>\n</ul></li>\n</ul>\n<h2 id=\"命名相关\"><a href=\"#命名相关\">命名相关</a></h2>\n<p>Electron API 使用与 Node.js 相同的大小写方案：</p>\n<ul>\n<li>当模块本身是class时, 比如 <code>BrowserWindow</code>, 使用 <code>CamelCase</code>.</li>\n<li>当模块是一组 API 时, 比如 <code>globalShortcut</code>时，使用 <code>mixedCase</code>。</li>\n<li>当 API 是对象的属性时, 并且它复杂到足以成为一个单独的块, 比如 <code>win.webContents</code>, 使用 <code>mixedCase</code>.</li>\n<li>对于其他非模块API, 使用自然标题, 比如 <code>&#x3C;webview> Tag</code> 或 <code>Process Object</code>.</li>\n</ul>\n<p>当创建新的 API 时， 最好使用 getter 和 setter 而不是 jQuery 的一次性函数。 举个例子, <code>.getText()</code> 和 <code>.setText(text)</code> 优于 <code>.text([text])</code>. 这是一些相关的 <a href=\"https://github.com/electron/electron/issues/46\">讨论</a></p>",
      "title": "编码风格",
      "description": ""
    },
    "/docs/api/command-line": {
      "locale": "zh-CN",
      "slug": "command-line",
      "href": "/docs/api/command-line",
      "crowdinFileId": "256295",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/command-line.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类-commandline\"><a href=\"#类-commandline\">类: CommandLine</a></h2>\n<blockquote>\n<p>操作Chromium读取的应用程序的命令行参数</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>下面的例子展示了如何检查<code>—disable-gpu</code>标志是否设置。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.hasSwitch(<span class=\"hljs-string\">'disable-gpu'</span>)\n</code></pre>\n<p>关于你可以使用哪些参数，请查阅<a href=\"/docs/api/command-line-switches\">命令行参数</a>文档。</p>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<h4 id=\"commandlineappendswitchswitch-value\"><a href=\"#commandlineappendswitchswitch-value\"><code>commandLine.appendSwitch(switch[, value])</code></a></h4>\n<ul>\n<li><code>switch</code> String - 命令行开关，不包含前边的-- <code>--</code></li>\n<li><code>value</code> String (optional) - 给开关设置的值</li>\n</ul>\n<p>通过可选的参数 <code>value</code> 给 Chromium 中添加一个命令行开关。</p>\n<p><strong> 注意: </strong>该方法不会影响 <code>process. argv</code> 该功能是为控制Chromium行为设计的。</p>\n<h4 id=\"commandlineappendargumentvalue\"><a href=\"#commandlineappendargumentvalue\"><code>commandLine.appendArgument(value)</code></a></h4>\n<ul>\n<li><code>value</code>String - 要追加到命令行的参数</li>\n</ul>\n<p>在Chromium的命令行中附加一个参数。 参数会被正确引用。 无论附加顺序如何，切换将在参数之前进行。</p>\n<p>如果你正在追加一个参数，如<code>--switch=value</code>, 请考虑使用<code>appendSwitch('switch', 'value')</code></p>\n<p><strong> 注意: </strong>该方法不会影响 <code>process. argv</code> 该功能是为控制Chromium行为设计的。</p>\n<h4 id=\"commandlinehasswitchswitch\"><a href=\"#commandlinehasswitchswitch\"><code>commandLine.hasSwitch(switch)</code></a></h4>\n<ul>\n<li><code>switch</code> String - 命令行开关</li>\n</ul>\n<p>返回<code>Boolean</code> - 命令行开关是否打开。</p>\n<h4 id=\"commandlinegetswitchvalueswitch\"><a href=\"#commandlinegetswitchvalueswitch\"><code>commandLine.getSwitchValue(switch)</code></a></h4>\n<ul>\n<li><code>switch</code> String - 命令行开关</li>\n</ul>\n<p>返回 <code>String</code> - 命令行开关值。</p>\n<p><strong>注意：</strong> 当开关不存在或没有值时，它返回空字符串。</p>",
      "title": "类: CommandLine",
      "description": "操作Chromium读取的应用程序的命令行参数"
    },
    "/docs/api/command-line-switches": {
      "locale": "zh-CN",
      "slug": "command-line-switches",
      "href": "/docs/api/command-line-switches",
      "crowdinFileId": "256293",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/command-line-switches.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"支持的命令行开关\"><a href=\"#支持的命令行开关\">支持的命令行开关</a></h1>\n<blockquote>\n<p>Electron支持的命令行开关.</p>\n</blockquote>\n<p>您可以在<a href=\"/docs/api/app\">app</a> 模块的<a href=\"/docs/api/app#event-ready\">ready</a>事件生效之前，使用<a href=\"/docs/api/command-line#commandlineappendswitchswitch-value\">app.commandLine.appendSwitch</a>将它们附加到您的应用程序的主要脚本中：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'remote-debugging-port'</span>, <span class=\"hljs-string\">'8315'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'host-rules'</span>, <span class=\"hljs-string\">'MAP * 127.0.0.1'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// 在这里写入你的代码</span>\n})\n</code></pre>\n<h2 id=\"electron-cli-标志\"><a href=\"#electron-cli-标志\">Electron CLI 标志</a></h2>\n<h3 id=\"--auth-server-whitelisturl\"><a href=\"#--auth-server-whitelisturl\">--auth-server-whitelist=<code>url</code></a></h3>\n<p>启用了集成身份验证的以逗号分隔的服务器列表。</p>\n<p>例如：</p>\n<pre><code class=\"hljs language-sh\">--auth-server-whitelist=<span class=\"hljs-string\">'*example.com, *foobar.com, *baz'</span>\n</code></pre>\n<p>则任何以<code>example.com</code>, <code>foobar.com</code>, <code>baz</code>结尾的<code>url</code>, 都需要考虑集成验证. 没有 <code>*</code> 前缀的 URL 必须完全匹配。</p>\n<h3 id=\"--auth-negotiate-delegate-whitelisturl\"><a href=\"#--auth-negotiate-delegate-whitelisturl\">--auth-negotiate-delegate-whitelist=<code>url</code></a></h3>\n<p>需要授权用户凭据的以逗号分隔的服务器列表。 没有 <code>*</code> 前缀的 URL 必须完全匹配。</p>\n<h3 id=\"--disable-ntlm-v2\"><a href=\"#--disable-ntlm-v2\">--disable-ntlm-v2</a></h3>\n<p>禁用NTLM v2的posix平台，对别处没有影响。</p>\n<h3 id=\"--disable-http-cache\"><a href=\"#--disable-http-cache\">--disable-http-cache</a></h3>\n<p>禁用HTTP请求的磁盘缓存.</p>\n<h3 id=\"--disable-http2\"><a href=\"#--disable-http2\">--disable-http2</a></h3>\n<p>禁用HTTP/2和SPDY/3.1协议.</p>\n<h3 id=\"--disable-renderer-backgrounding\"><a href=\"#--disable-renderer-backgrounding\">--disable-renderer-backgrounding</a></h3>\n<p>防止Chromium降低不可见的页面渲染进程的优先级.</p>\n<p>这个标识是全局的, 影响所有渲染进程. 如果你只想禁用一个窗口的节流保护，你可以采取<a href=\"https://github.com/atom/atom/pull/9485/files\">playing silent audio</a>.</p>\n<h3 id=\"--disk-cache-sizesize\"><a href=\"#--disk-cache-sizesize\">--disk-cache-size=<code>size</code></a></h3>\n<p>强制磁盘缓存使用的最大磁盘空间（以字节为单位）。</p>\n<h3 id=\"--enable-api-filtering-logging\"><a href=\"#--enable-api-filtering-logging\">--enable-api-filtering-logging</a></h3>\n<p>开启以下API 的调用堆栈日志记录(过滤事件)：</p>\n<ul>\n<li><code>desktopCapturer.getSources()</code> / <code>desktop-capturer-get-sources</code></li>\n</ul>\n<h3 id=\"--enable-loggingfile\"><a href=\"#--enable-loggingfile\">--enable-logging[=file]</a></h3>\n<p>Prints Chromium's logging to stderr (or a log file).</p>\n<p>The <code>ELECTRON_ENABLE_LOGGING</code> environment variable has the same effect as passing <code>--enable-logging</code>.</p>\n<p>Passing <code>--enable-logging</code> will result in logs being printed on stderr. Passing <code>--enable-logging=file</code> will result in logs being saved to the file specified by <code>--log-file=...</code>, or to <code>electron_debug.log</code> in the user-data directory if <code>--log-file</code> is not specified.</p>\n<blockquote>\n<p><strong>Note:</strong> On Windows, logs from child processes cannot be sent to stderr. Logging to a file is the most reliable way to collect logs on Windows.</p>\n</blockquote>\n<p>See also <code>--log-file</code>, <code>--log-level</code>, <code>--v</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--force-fieldtrialstrials\"><a href=\"#--force-fieldtrialstrials\">--force-fieldtrials=<code>trials</code></a></h3>\n<p>试用特性将强制启用或禁用。</p>\n<p>例如： <code>WebRTC-Audio-Red-For-Opus/Enabled/</code></p>\n<h3 id=\"--host-rulesrules\"><a href=\"#--host-rulesrules\">--host-rules=<code>rules</code></a></h3>\n<p>以逗号分隔的<code>rules</code>列表，用于控制主机名的映射方式</p>\n<p>例如：</p>\n<ul>\n<li><code>MAP * 127.0.0.1</code> 强制将所有主机名映射到127.0.0.1</li>\n<li><code>MAP *.google.com proxy</code> 强制所有google.com子域名解析到\"proxy\".</li>\n<li><code>MAP test.com [::1]:77</code> 强制将 \"test.com\" 解析到 IPv6 环回接口。 也会强制目标套接字地址的端口为77。</li>\n<li><code>MAP * baz, EXCLUDE www.google.com</code> 把所有地址重新映射到“baz”, 除了\"www.google.com\".</li>\n</ul>\n<p>这些映射适用于网络请求中的端点主机. 网络请求包括TCP连接和直连的主机解析器, 以及HTTP代理连接中的<code>CONNECT</code>方式, 以及在<code>SOCKS</code>代理连接中的端点主机.</p>\n<h3 id=\"--host-resolver-rulesrules\"><a href=\"#--host-resolver-rulesrules\">--host-resolver-rules=<code>rules</code></a></h3>\n<p>与<code>--host-rules</code>类似, 但是这些<code>rules</code>仅适用于主机解析器.</p>\n<h3 id=\"--ignore-certificate-errors\"><a href=\"#--ignore-certificate-errors\">--ignore-certificate-errors</a></h3>\n<p>忽略证书相关的错误.</p>\n<h3 id=\"--ignore-connections-limitdomains\"><a href=\"#--ignore-connections-limitdomains\">--ignore-connections-limit=<code>domains</code></a></h3>\n<p>忽略由<code>,</code>分割的<code>domains</code>列表的连接限制.</p>\n<h3 id=\"--js-flagsflags\"><a href=\"#--js-flagsflags\">--js-flags=<code>flags</code></a></h3>\n<p>指定传递到 Node.js 引擎的flags。 如果您想在主进程中启用 <code>flags</code> ，则必须在一开始运行Electron的时候就传递。</p>\n<pre><code class=\"hljs language-sh\">$ electron --js-flags=<span class=\"hljs-string\">\"--harmony_proxies --harmony_collections\"</span> your-app\n</code></pre>\n<p>查看<a href=\"https://nodejs.org/api/cli.html\">Node.js 文档</a>或者在终端中运行<code>node --help</code>命令查看可用的flags列表。 此外，还可以运行<code>node --v8-options</code>来查看与Node.js的V8 JavaScript引擎特定相关的flags列表。</p>\n<h3 id=\"--lang\"><a href=\"#--lang\">--lang</a></h3>\n<p>设置系统语言环境</p>\n<h3 id=\"--log-filepath\"><a href=\"#--log-filepath\">--log-file=<code>path</code></a></h3>\n<p>If <code>--enable-logging</code> is specified, logs will be written to the given path. The parent directory must exist.</p>\n<p>Setting the <code>ELECTRON_LOG_FILE</code> environment variable is equivalent to passing this flag. If both are present, the command-line switch takes precedence.</p>\n<h3 id=\"--log-net-logpath\"><a href=\"#--log-net-logpath\">--log-net-log=<code>path</code></a></h3>\n<p>启用需要保存的网络日志事件并将其写入<code>path</code>路径下.</p>\n<h3 id=\"--log-leveln\"><a href=\"#--log-leveln\">--log-level=<code>N</code></a></h3>\n<p>Sets the verbosity of logging when used together with <code>--enable-logging</code>. <code>N</code> should be one of <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h?q=logging::LogSeverity&#x26;ss=chromium\">Chrome's LogSeverities</a>.</p>\n<p>Note that two complimentary logging mechanisms in Chromium -- <code>LOG()</code> and <code>VLOG()</code> -- are controlled by different switches. <code>--log-level</code> controls <code>LOG()</code> messages, while <code>--v</code> and <code>--vmodule</code> control <code>VLOG()</code> messages. So you may want to use a combination of these three switches depending on the granularity you want and what logging calls are made by the code you're trying to watch.</p>\n<p>See <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h\">Chromium Logging source</a> for more information on how <code>LOG()</code> and <code>VLOG()</code> interact. Loosely speaking, <code>VLOG()</code> can be thought of as sub-levels / per-module levels inside <code>LOG(INFO)</code> to control the firehose of <code>LOG(INFO)</code> data.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, <code>--v</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--no-proxy-server\"><a href=\"#--no-proxy-server\">--no-proxy-server</a></h3>\n<p>不使用代理服务器，并始终保持直连。 会覆盖其他代理服务器标记。</p>\n<h3 id=\"--no-sandbox\"><a href=\"#--no-sandbox\">--no-sandbox</a></h3>\n<p>禁用 Chromium <a href=\"https://www.chromium.org/developers/design-documents/sandbox\">沙箱</a>。 强制渲染器进程和Chromium助手进程以非沙盒化运行。 应该只在测试时使用。</p>\n<h3 id=\"--proxy-bypass-listhosts\"><a href=\"#--proxy-bypass-listhosts\">--proxy-bypass-list=<code>hosts</code></a></h3>\n<p>指示Electron绕过使用; 分号; 分割的给定的主机列表中的代理服务器。 这个标志只有在与<code>--proxy-server</code> 同时使用时才具有效果。</p>\n<p>例如：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'proxy-bypass-list'</span>, <span class=\"hljs-string\">'&#x3C;local>;*.google.com;*foo.com;1.2.3.4:5678'</span>)\n</code></pre>\n<p>上面的代码, 除了本地地址(<code>localhost</code>,<code>127.0.0.1</code>等等.), <code>google.com</code>子域名, 包含<code>foo.com</code>后缀的主机地址, 以及任何在<code>1.2.3.4:5678</code>上的地址以外的所有主机都将使用代理服务器.</p>\n<h3 id=\"--proxy-pac-urlurl\"><a href=\"#--proxy-pac-urlurl\">--proxy-pac-url=<code>url</code></a></h3>\n<p>在指定<code>url</code>中使用PAC脚本.</p>\n<h3 id=\"--proxy-serveraddressport\"><a href=\"#--proxy-serveraddressport\">--proxy-server=<code>address:port</code></a></h3>\n<p>使用指定的覆盖系统设置的代理服务器. 这个开关只影响HTTP协议请求, 包括HTTPS和WebSocket请求. 值得注意的是并不是所有的代理服务器都支持HTTPS和WebSocket请求. 代理 URL 不支持用户名和密码认证方式 <a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=615947\">Chromium 的问题</a>。</p>\n<h3 id=\"--remote-debugging-portport\"><a href=\"#--remote-debugging-portport\">--remote-debugging-port=<code>port</code></a></h3>\n<p>在指定<code>端口</code>开启HTTP远程调试.</p>\n<h3 id=\"--vlog_level\"><a href=\"#--vlog_level\">--v=<code>log_level</code></a></h3>\n<p>指定默认的最大活跃V-logging级别；默认值为0。 通常 V-logging 级别为正数。</p>\n<p>这个开关只有在<code>--enable-logging</code>也被传递时才起效.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--vmodulepattern\"><a href=\"#--vmodulepattern\">--vmodule=<code>pattern</code></a></h3>\n<p>给定每个模块最大的V-logging等级, 覆盖<code>--v</code>设定的值. 如下: <code>my_module=2,foo*=3</code> 会更改所有代码在源文件 <code>my_module.*</code> 和 <code>foo*.*</code> 中的日志级别。</p>\n<p>任何包含正斜杠或反斜杠的模式都将针对 整个路径名进行测试，而不仅仅是模块。 如下: <code>*/foo/bar/*=2</code> 会更改<code>foo/bar</code> 目录下源文件中所有代码的日志级别。</p>\n<p>这个开关只有在<code>--enable-logging</code>也被传递时才起效.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, and <code>--v</code>.</p>\n<h3 id=\"--force_high_performance_gpu\"><a href=\"#--force_high_performance_gpu\">--force_high_performance_gpu</a></h3>\n<p>当有多个GPU可用时，强制使用独立显卡。</p>\n<h3 id=\"--force_low_power_gpu\"><a href=\"#--force_low_power_gpu\">--force_low_power_gpu</a></h3>\n<p>当有多个GPU可用时，强制使用集成显卡。</p>\n<h2 id=\"nodejs-flags\"><a href=\"#nodejs-flags\">Node.js Flags</a></h2>\n<p>Electron 支持一些 Node.js 支持的 <a href=\"https://nodejs.org/api/cli.html\">CLI flags</a>。</p>\n<p><strong>注意：</strong> 当Electron 不是以 <code>ELECTRON_RUN_AS_NODE</code>运行时，传递不支持的命令行参数到Electron 不会起作用。</p>\n<h3 id=\"--inspect-brkhostport\"><a href=\"#--inspect-brkhostport\">--inspect-brk[=[host:]port]</a></h3>\n<p>在 主机:端口 上激活检查器并在用户脚本开始运行后中断。 默认 主机:端口 为127.0.0.1:9229。</p>\n<p>是 <code>--debug-brk=[host:]port</code>的别名</p>\n<h3 id=\"--inspect-porthostport\"><a href=\"#--inspect-porthostport\">--inspect-port=[host:]port</a></h3>\n<p>当检查器被激活时要使用的 <code>主机:端口</code>。 常用于通过发送 SIGUSR1 信号激活检查器时。 默认主机是 <code>127.0.0.1</code>。</p>\n<p>是 <code>--debug-port=[host:]port</code>的别名</p>\n<h3 id=\"--inspecthostport\"><a href=\"#--inspecthostport\">--inspect[=[host:]port]</a></h3>\n<p>在 <code>主机:端口</code> 上激活检查器。 默认是 <code>127.0.0.1:9229</code>。</p>\n<p>集成V8 检查器允许Chrome 开发者工具和 IDE 这些工具调试和修改 Electron 实例。 这些工具通过 TCP 端口连接到 Electron 实例，并使用 <a href=\"https://chromedevtools.github.io/devtools-protocol/\">Chrome 开发者工具协议</a>进行通信。</p>\n<p>调试相关的标识, 更多详细信息请查看 <a href=\"/docs/tutorial/debugging-main-process\">Debugging the Main Process</a>指南。</p>\n<p>是 <code>--debug[host:]port</code>的别名</p>\n<h3 id=\"--inspect-publish-uidstderrhttp\"><a href=\"#--inspect-publish-uidstderrhttp\">--inspect-publish-uid=stderr,http</a></h3>\n<p>指定检查器的 web 套接字url 公开方式。</p>\n<p>默认情况下，websocket url在 stderr 中和在 <a href=\"http://host:port/json/list\">http://host:port/json/list</a> 的 /json/list 端点下都是可用的。</p>",
      "title": "支持的命令行开关",
      "description": "Electron支持的命令行开关."
    },
    "/docs/api/content-tracing": {
      "locale": "zh-CN",
      "slug": "content-tracing",
      "href": "/docs/api/content-tracing",
      "crowdinFileId": "256297",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/content-tracing.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"contenttracing\"><a href=\"#contenttracing\">contentTracing</a></h1>\n<blockquote>\n<p>从Chromium收集追踪数据以找到性能瓶颈和慢操作。</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p>此模块不包括 Web 界面。 若要查看记录的轨迹，请使用<a href=\"https://chromium.googlesource.com/catapult/+/HEAD/tracing/README.md\">跟踪查看器</a>，在Chrome上可以访问 <code>chrome://tracking</code> 。</p>\n<p><strong>注意：</strong>在应用程序模块的 <code>ready </code> 事件触发之前，您不应该使用此模块。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, contentTracing } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  (<span class=\"hljs-keyword\">async</span> () => {\n    <span class=\"hljs-keyword\">await</span> contentTracing.startRecording({\n      <span class=\"hljs-attr\">included_categories</span>: [<span class=\"hljs-string\">'*'</span>]\n    })\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Tracing started'</span>)\n    <span class=\"hljs-keyword\">await</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> setTimeout(resolve, <span class=\"hljs-number\">5000</span>))\n    <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> contentTracing.stopRecording()\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Tracing data recorded to '</span> + path)\n  })()\n})\n</code></pre>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>contentTracing</code>模块包含以下方法：</p>\n<h3 id=\"contenttracinggetcategories\"><a href=\"#contenttracinggetcategories\"><code>contentTracing.getCategories()</code></a></h3>\n<p>返回 <code>Promise&#x3C;String[]></code> - 一旦所有子进程都确认了 <code>getCategories</code> 请求，会 resolve 一个类别组的数组</p>\n<p>获取一组类别组。 当到达新的代码路径时，类别组可能会更改。 另请参阅<a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">内置跟踪类别列表</a>。</p>\n<blockquote>\n<p><strong>注意：</strong> Electron 添加了一个名为 <code>\"electron\"</code> 的非默认追踪类别。 此类别可以用于捕捉Electron特定的追踪事件。</p>\n</blockquote>\n<h3 id=\"contenttracingstartrecordingoptions\"><a href=\"#contenttracingstartrecordingoptions\"><code>contentTracing.startRecording(options)</code></a></h3>\n<ul>\n<li><code>options</code> (<a href=\"/docs/api/structures/trace-config\">TraceConfig</a> | <a href=\"/docs/api/structures/trace-categories-and-options\">TraceCategoriesAndOptions</a>)</li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code> - 当所有子进程都确认了 <code>startRecording</code> 请求后 resolve.</p>\n<p>在所有进程上开始记录</p>\n<p>一旦收到EnableRecording请求，记录立即在本地开始进行，并在子进程上异步执行。</p>\n<p>如果一个记录已经运行了，promise将立即resolve，因为一次只能进行一个跟踪操作。</p>\n<h3 id=\"contenttracingstoprecordingresultfilepath\"><a href=\"#contenttracingstoprecordingresultfilepath\"><code>contentTracing.stopRecording([resultFilePath])</code></a></h3>\n<ul>\n<li><code>resultFilePath</code> String (可选)</li>\n</ul>\n<p>返回 <code>Promise&#x3C;String></code> - 一旦所有子进程都确认了 <code>stopRecording</code> 请求，会 resolve 一个包含了追踪数据的文件路径</p>\n<p>停止所有进程记录。</p>\n<p>子进程通常缓存跟踪数据，并且很少清空和发送跟踪数据回到主进程。 这有助于最小化运行时间开销，因为通过IPC发送跟踪数据可能是一个开销巨大的操作。 因此，为了结束跟踪，Chromium异步地要求所有子进程刷新所有挂起的跟踪数据。</p>\n<p>追踪数据将被写入 <code>resultFilePath</code>。 如果 <code>resultFilePath</code> 是空的或未提供，追踪数据将被写入临时文件，并且路径将在promise中返回。</p>\n<h3 id=\"contenttracinggettracebufferusage\"><a href=\"#contenttracinggettracebufferusage\"><code>contentTracing.getTraceBufferUsage()</code></a></h3>\n<p>返回 <code>Promise&#x3C;Object></code> - resolve一个包含了追踪缓冲器的 <code>value</code> 和 <code>percentage</code> 最大使用量的对象</p>\n<ul>\n<li><code>value</code> Number</li>\n<li><code>percentage</code> Number</li>\n</ul>\n<p>获取追踪缓冲区在进程间的最大使用量（占全部状态的百分比）。</p>",
      "title": "contentTracing",
      "description": "从Chromium收集追踪数据以找到性能瓶颈和慢操作。"
    },
    "/docs/api/context-bridge": {
      "locale": "zh-CN",
      "slug": "context-bridge",
      "href": "/docs/api/context-bridge",
      "crowdinFileId": "256299",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/context-bridge.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"contextbridge\"><a href=\"#contextbridge\">contextBridge</a></h1>\n<blockquote>\n<p>在隔离的上下文中创建一个安全的、双向的、同步的桥梁。</p>\n</blockquote>\n<p>进程: <a href=\"/docs/glossary#renderer-process\"> Renderer</a></p>\n<p>如下，是一个从隔离的预加载脚本将 API 暴露给渲染器的示例：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Preload (Isolated World)</span>\n<span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(\n  <span class=\"hljs-string\">'electron'</span>,\n  {\n    <span class=\"hljs-attr\">doThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.send(<span class=\"hljs-string\">'do-a-thing'</span>)\n  }\n)\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Renderer (Main World)</span>\n\n<span class=\"hljs-built_in\">window</span>.electron.doThing()\n</code></pre>\n<h2 id=\"词汇表\"><a href=\"#词汇表\">词汇表</a></h2>\n<h3 id=\"main-world\"><a href=\"#main-world\">Main World</a></h3>\n<p>\"Main World\"是主渲染器代码运行的 JavaScript 上下文。 默认情况下，你在渲染器中加载的页面在此环境中执行代码。</p>\n<h3 id=\"isolated-world\"><a href=\"#isolated-world\">Isolated World</a></h3>\n<p>当你在<code>webPreferences</code>属性中启用<code>contextIsolation</code> (Electron 12.0.0 及以上版本默认启用)，你的<code>预加载</code>脚本将运行在一个“被隔离的环境”中。  您可以在<a href=\"/docs/tutorial/security#3-enable-context-isolation-for-remote-content\">Security</a> 文档中阅读更多关于上下文隔离及其影响的信息。</p>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>contextBridge</code>模块有以下方法:</p>\n<h3 id=\"contextbridgeexposeinmainworldapikey-api\"><a href=\"#contextbridgeexposeinmainworldapikey-api\"><code>contextBridge.exposeInMainWorld(apiKey, api)</code></a></h3>\n<ul>\n<li><code>apiKey</code> String - 将 API 注入到 <code>窗口</code> 的键。  API 将可通过 <code>window[apiKey]</code> 访问。</li>\n<li><code>api</code> any - 你的 API可以是什么样的以及它是如何工作的相关信息如下。</li>\n</ul>\n<h2 id=\"用法\"><a href=\"#用法\">用法</a></h2>\n<h3 id=\"应用开发接口（api）\"><a href=\"#应用开发接口（api）\">应用开发接口（API）</a></h3>\n<p>提供给 <a href=\"#contextbridgeexposeinmainworldapikey-api\"><code>exposeInMainWorld</code></a> 的 <code>api</code> 必须是一个 <code>Function</code>， <code>String</code>， <code>Number</code>， <code>Array</code>， <code>Boolean</code>；或一个键为字符串，值为一个 <code>Function</code>， <code>String</code>， <code>Number</code>， <code>Array</code>， <code>Boolean</code>的对象；或其他符合相同条件的嵌套对象。</p>\n<p><code>Function</code> 类型的值被代理到其他上下文中，所有其他类型的值都会被 <strong>复制</strong> 并 <strong>冻结</strong>。 在 API 中发送的任何数据 /原始数据将不可改变，在桥接器其中一侧的更新不会导致另一侧的更新。</p>\n<p>复杂 API 的示例如下：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(\n  <span class=\"hljs-string\">'electron'</span>,\n  {\n    <span class=\"hljs-attr\">doThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.send(<span class=\"hljs-string\">'do-a-thing'</span>),\n    <span class=\"hljs-attr\">myPromises</span>: [<span class=\"hljs-built_in\">Promise</span>.resolve(), <span class=\"hljs-built_in\">Promise</span>.reject(<span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'whoops'</span>))],\n    <span class=\"hljs-attr\">anAsyncFunction</span>: <span class=\"hljs-keyword\">async</span> () => <span class=\"hljs-number\">123</span>,\n    <span class=\"hljs-attr\">data</span>: {\n      <span class=\"hljs-attr\">myFlags</span>: [<span class=\"hljs-string\">'a'</span>, <span class=\"hljs-string\">'b'</span>, <span class=\"hljs-string\">'c'</span>],\n      <span class=\"hljs-attr\">bootTime</span>: <span class=\"hljs-number\">1234</span>\n    },\n    <span class=\"hljs-attr\">nestedAPI</span>: {\n      <span class=\"hljs-attr\">evenDeeper</span>: {\n        <span class=\"hljs-attr\">youCanDoThisAsMuchAsYouWant</span>: {\n          <span class=\"hljs-attr\">fn</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ({\n            <span class=\"hljs-attr\">returnData</span>: <span class=\"hljs-number\">123</span>\n          })\n        }\n      }\n    }\n  }\n)\n</code></pre>\n<h3 id=\"api-functions\"><a href=\"#api-functions\">API Functions</a></h3>\n<p>你通过 <code>contextBridge</code> 绑定的 <code>Function</code> 值会被 Electron 代理，以确保保持上下文隔离。  这导致了我们在下面概述的一些键的限制。</p>\n<h4 id=\"参数--错误--返回类型支持\"><a href=\"#参数--错误--返回类型支持\">参数 / 错误 / 返回类型支持</a></h4>\n<p>因为当参数、错误和返回值在桥接器上发送时会被 <strong>复制</strong> ，所以只有某些类型可以使用。 从上层来看，如果你想要使用的类型可以序列化并反序列化为同一个对象，这个类型可以使用。  为确保完整性，下面列出了一份类型支持表：</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>类型</th><th>复杂度</th><th>有入参</th><th>有返回值</th><th>局限性</th></tr></thead><tbody><tr><td><code>String</code></td><td>简单</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Number</code></td><td>简单</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Boolean</code></td><td>简单</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Object</code></td><td>复杂</td><td>✅</td><td>✅</td><td>键仅支持使用此表中的“简单”的类型。  值必须在此表中支持的值。  修改prototype将被丢弃。  发送自定义类将复制值，但不会包含prototype。</td></tr><tr><td><code>Array</code></td><td>复杂</td><td>✅</td><td>✅</td><td>与 <code>Object</code> 类型相同的限制</td></tr><tr><td><code>Error</code></td><td>复杂</td><td>✅</td><td>✅</td><td>所抛出的错误也会被复制，这可能导致消息和堆栈跟踪的错误略有变化，由于在不同的上下文中抛出</td></tr><tr><td><code>Promise</code></td><td>复杂</td><td>✅</td><td>✅</td><td>只有当 promise 是返回值或确切参数时，它们才会被代理。  嵌套在数组或对象中的Promise将被丢弃。</td></tr><tr><td><code>Function</code></td><td>复杂</td><td>✅</td><td>✅</td><td>修改prototype将被丢弃。  发送类或构造函数将不起作用。</td></tr><tr><td><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Cloneable Types</a></td><td>简单</td><td>✅</td><td>✅</td><td>点击链接查看可克隆类型的文档</td></tr><tr><td><code>Element</code></td><td>复杂</td><td>✅</td><td>✅</td><td>修改prototype将被丢弃。  发送自定义元素将不生效。</td></tr><tr><td><code>Blob</code></td><td>复杂</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Symbol</code></td><td>N/A</td><td>❌</td><td>❌</td><td>Symbol不能跨上下文复制，因此会丢弃它们</td></tr></tbody></table>\n<p>如果您关心的类型不在上表中，可能是因为不支持该类型。</p>\n<h3 id=\"暴露node-global-symbols\"><a href=\"#暴露node-global-symbols\">暴露Node Global Symbols</a></h3>\n<p><code>contextBridge</code> 可以被预加载脚本用来让您的渲染器访问Node API。 上面所述的支持类型表也适用于您通过 <code>contextBridge</code>暴露的Node API。 请注意许多Node的API授权访问本地系统资源。 请非常谨慎地暴露全局变量和api给不受信任的远程内容。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> crypto = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'crypto'</span>)\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'nodeCrypto'</span>, {\n  sha256sum (data) {\n    <span class=\"hljs-keyword\">const</span> hash = crypto.createHash(<span class=\"hljs-string\">'sha256'</span>)\n    hash.update(data)\n    <span class=\"hljs-keyword\">return</span> hash.digest(<span class=\"hljs-string\">'hex'</span>)\n  }\n})\n</code></pre>",
      "title": "contextBridge",
      "description": "在隔离的上下文中创建一个安全的、双向的、同步的桥梁。"
    },
    "/docs/tutorial/context-isolation": {
      "locale": "zh-CN",
      "slug": "context-isolation",
      "href": "/docs/tutorial/context-isolation",
      "crowdinFileId": "256185",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/context-isolation.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"上下文隔离\"><a href=\"#上下文隔离\">上下文隔离</a></h1>\n<h2 id=\"上下文隔离是什么？\"><a href=\"#上下文隔离是什么？\">上下文隔离是什么？</a></h2>\n<p>上下文隔离功能将确保您的 <code>预加载</code>脚本 和 Electron的内部逻辑 运行在所加载的 <a href=\"/docs/api/web-contents\"><code>webcontent</code></a>网页 之外的另一个独立的上下文环境里。  这对安全性很重要，因为它有助于阻止网站访问 Electron 的内部组件 和 您的预加载脚本可访问的高等级权限的API 。</p>\n<p>这意味着，实际上，您的预加载脚本访问的 <code>window</code> 对象<strong>并不是</strong>网站所能访问的对象。  For example, if you set <code>window.hello = 'wave'</code> in your preload script and context isolation is enabled, <code>window.hello</code> will be undefined if the website tries to access it.</p>\n<p>Context isolation has been enabled by default since Electron 12, and it is a recommended security setting for <em>all applications</em>.</p>\n<h2 id=\"迁移\"><a href=\"#迁移\">迁移</a></h2>\n<blockquote>\n<p>Without context isolation, I used to provide APIs from my preload script using <code>window.X = apiObject</code>. Now what?</p>\n</blockquote>\n<h3 id=\"before-context-isolation-disabled\"><a href=\"#before-context-isolation-disabled\">Before: context isolation disabled</a></h3>\n<p>Exposing APIs from your preload script to a loaded website in the renderer process is a common use-case. With context isolation disabled, your preload script would share a common global <code>window</code> object with the renderer. You could then attach arbitrary properties to a preload script:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// preload with contextIsolation disabled</span>\n<span class=\"hljs-built_in\">window</span>.myAPI = {\n  <span class=\"hljs-attr\">doAThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {}\n}\n</code></pre>\n<p>The <code>doAThing()</code> function could then be used directly in the renderer process:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// use the exposed API in the renderer</span>\n<span class=\"hljs-built_in\">window</span>.myAPI.doAThing()\n</code></pre>\n<h3 id=\"after-context-isolation-enabled\"><a href=\"#after-context-isolation-enabled\">After: context isolation enabled</a></h3>\n<p>There is a dedicated module in Electron to help you do this in a painless way. The <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> module can be used to <strong>safely</strong> expose APIs from your preload script's isolated context to the context the website is running in. API 还可以像以前一样，从 <code>window.myAPI</code> 网站上访问。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// preload with contextIsolation enabled</span>\n<span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">doAThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {}\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// use the exposed API in the renderer</span>\n<span class=\"hljs-built_in\">window</span>.myAPI.doAThing()\n</code></pre>\n<p>Please read the <code>contextBridge</code> documentation linked above to fully understand its limitations. For instance, you can't send custom prototypes or symbols over the bridge.</p>\n<h2 id=\"security-considerations\"><a href=\"#security-considerations\">Security considerations</a></h2>\n<p>单单开启和使用 <code>contextIsolation</code> 并不直接意味着您所做的一切都是安全的。 For instance, this code is <strong>unsafe</strong>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// ❌ Bad code</span>\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">send</span>: ipcRenderer.send\n})\n</code></pre>\n<p>它直接暴露了一个没有任何参数过滤的高等级权限 API 。 This would allow any website to send arbitrary IPC messages, which you do not want to be possible. 相反，暴露进程间通信相关 API 的正确方法是为每一种通信消息提供一种实现方法。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// ✅ Good code</span>\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">loadPreferences</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'load-prefs'</span>)\n})\n</code></pre>\n<h2 id=\"usage-with-typescript\"><a href=\"#usage-with-typescript\">Usage with TypeScript</a></h2>\n<p>If you're building your Electron app with TypeScript, you'll want to add types to your APIs exposed over the context bridge. The renderer's <code>window</code> object won't have the correct typings unless you extend the types with a <a href=\"https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html\">declaration file</a>.</p>\n<p>For example, given this <code>preload.ts</code> script:</p>\n<pre><code class=\"hljs language-typescript\">contextBridge.exposeInMainWorld(<span class=\"hljs-string\">'electronAPI'</span>, {\n  loadPreferences: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'load-prefs'</span>)\n})\n</code></pre>\n<p>You can create a <code>renderer.d.ts</code> declaration file and globally augment the <code>Window</code> interface:</p>\n<pre><code class=\"hljs language-typescript\"><span class=\"hljs-keyword\">export</span> <span class=\"hljs-keyword\">interface</span> IElectronAPI {\n  loadPreferences: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-built_in\">Promise</span>&#x3C;<span class=\"hljs-built_in\">void</span>>,\n}\n\n<span class=\"hljs-keyword\">declare</span> global {\n  <span class=\"hljs-keyword\">interface</span> Window {\n    electronAPI: IElectronAPI\n  }\n}\n</code></pre>\n<p>Doing so will ensure that the TypeScript compiler will know about the <code>electronAPI</code> property on your global <code>window</code> object when writing scripts in your renderer process:</p>\n<pre><code class=\"hljs language-typescript\"><span class=\"hljs-built_in\">window</span>.electronAPI.loadPreferences()\n</code></pre>",
      "title": "上下文隔离",
      "description": "Without context isolation, I used to provide APIs from my preload script using window.X = apiObject. Now what?"
    },
    "/docs/api/structures/cookie": {
      "locale": "zh-CN",
      "slug": "cookie",
      "href": "/docs/api/structures/cookie",
      "crowdinFileId": "256417",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/cookie.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"cookie-object\"><a href=\"#cookie-object\">Cookie Object</a></h1>\n<ul>\n<li><code>name</code> String - The name of the cookie.</li>\n<li><code>value</code> String - The value of the cookie.</li>\n<li><code>domain</code> String (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains.</li>\n<li><code>hostOnly</code> Boolean (optional) - Whether the cookie is a host-only cookie; this will only be <code>true</code> if no domain was passed.</li>\n<li><code>path</code> String (optional) - The path of the cookie.</li>\n<li><code>secure</code> Boolean (optional) - Whether the cookie is marked as secure.</li>\n<li><code>httpOnly</code> Boolean (optional) - Whether the cookie is marked as HTTP only.</li>\n<li><code>session</code> Boolean (optional) - Whether the cookie is a session cookie or a persistent cookie with an expiration date.</li>\n<li><code>expirationDate</code> Double (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies.</li>\n<li><code>sameSite</code> String - The <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies\">Same Site</a> policy applied to this cookie.  Can be <code>unspecified</code>, <code>no_restriction</code>, <code>lax</code> or <code>strict</code>.</li>\n</ul>",
      "title": "Cookie Object",
      "description": ""
    },
    "/docs/api/cookies": {
      "locale": "zh-CN",
      "slug": "cookies",
      "href": "/docs/api/cookies",
      "crowdinFileId": "256301",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/cookies.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类：cookies\"><a href=\"#类：cookies\">类：Cookies</a></h2>\n<blockquote>\n<p>查询和修改一个会话的cookies</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>通过<code>Session</code>的<code>cookies</code>属性来访问<code>Cookies</code>的实例</p>\n<p>例如：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// 查询所有 cookies。</span>\nsession.defaultSession.cookies.get({})\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">cookies</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(cookies)\n  }).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">error</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(error)\n  })\n\n<span class=\"hljs-comment\">// 查询所有与设置的 URL 相关的所有 cookies.</span>\nsession.defaultSession.cookies.get({ <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'http://www.github.com'</span> })\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">cookies</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(cookies)\n  }).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">error</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(error)\n  })\n\n<span class=\"hljs-comment\">// 设置一个 cookie，使用设置的名称；</span>\n<span class=\"hljs-comment\">// 如果存在，则会覆盖原先 cookie.</span>\n<span class=\"hljs-keyword\">const</span> cookie = { <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'http://www.github.com'</span>, <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'dummy_name'</span>, <span class=\"hljs-attr\">value</span>: <span class=\"hljs-string\">'dummy'</span> }\nsession.defaultSession.cookies.set(cookie)\n  .then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// success</span>\n  }, (error) => {\n    <span class=\"hljs-built_in\">console</span>.error(error)\n  })\n</code></pre>\n<h3 id=\"实例事件\"><a href=\"#实例事件\">实例事件</a></h3>\n<p>以下事件会在<code>Cookies</code>实例触发。</p>\n<h4 id=\"event-changed\"><a href=\"#event-changed\">Event: 'changed'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>cookie</code> <a href=\"/docs/api/structures/cookie\">Cookie</a> - 变更后的 cookie 值。</li>\n<li><code>cause</code> String - 导致更改的原因，为以下值之一：<ul>\n<li><code>explicit</code> - cookie 是由消费者的操作直接更改的。</li>\n<li><code>overwrite</code> - 一个覆盖原值的插入操作导致的 cookie 被自动删除。</li>\n<li><code>expired</code> - cookie 在过期时自动删除。</li>\n<li><code>evicted</code> - 在GC（垃圾回收机制）过程中被回收。</li>\n<li><code>expired-overwrite</code> - 一个已过期的时间覆写了原cookie 的过期时间。</li>\n</ul></li>\n<li><code>removed</code> Boolean - <code>true </code>表示cookie 已被删掉, 否则为<code> false</code>.</li>\n</ul>\n<p>该事件在cookie 被添加、修改、删除或过期时触发。</p>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<p>以下方法可以在<code>Cookies</code>实例调用。</p>\n<h4 id=\"cookiesgetfilter\"><a href=\"#cookiesgetfilter\"><code>cookies.get(filter)</code></a></h4>\n<ul>\n<li><code>filter</code> Object<ul>\n<li><code>url</code> String (可选) - 检索与 <code>url</code> 相关的 cookie。 空意味着检索所有 URL 的 cookie 。</li>\n<li><code>name</code>String (可选) - 按名称筛选 cookie。</li>\n<li><code>domain</code> String (optional) - 检索与域名或者 <code>domain</code> 子域名匹配的cookie。</li>\n<li><code>path</code>String (可选) - 检索路径与 <code>path</code> 匹配的 cookie。</li>\n<li><code>secure</code>Boolean (可选) - 通过其Secure 属性筛选 cookie。</li>\n<li><code>session</code>Boolean (可选) - 筛选出session 内可用或持久性 cookie。</li>\n</ul></li>\n</ul>\n<p>返回 <code>Promise&#x3C;Cookie[]></code> - 一个会解析成数组或者 cookie 对象的 promise。</p>\n<p>发送请求以获取匹配 <code>filter</code> 的所有 cookie，并通过响应来解决承诺问题。</p>\n<h4 id=\"cookiessetdetails\"><a href=\"#cookiessetdetails\"><code>cookies.set(details)</code></a></h4>\n<ul>\n<li><code>details</code> Object<ul>\n<li><code>url</code> String - 与 cookie 关联的 url。 如果URL无效，promise将返回reject。</li>\n<li><code>name</code> String (可选) - cookie 的名称。 如果省略则默认为空。</li>\n<li><code>value</code> String (可选) - cookie 的值。 如果省略则默认为空。</li>\n<li><code>domain</code> String (可选) - cookie所在域名，通常使用点号开头，以使其对子域名可用。 如果省略则默认为空。</li>\n<li><code>path</code> String (可选) - cookie 的路径。 如果省略则默认为空。</li>\n<li><code>secure</code> Boolean (可选) - cookie 是否应该标记为Secure。 Defaults to false unless <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite#samesitenone_requires_secure\">Same Site=None</a> attribute is used.</li>\n<li><code>httpOnly</code> Boolean (可选) - cookie 是否应该标记为 HTTP only。 默认值为 false.</li>\n<li><code>expirationDate</code>Double (可选) - cookie 的到期日期，类型为时间戳，单位为秒。 如果省略, 则 cookie 将成为会话 cookie, 并且不会在会话之间保留。</li>\n<li><code>sameSite</code> String (可选) - 要应用于此 cookie 的 <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies\">Same Site</a> 策略。  可以被设置为<code>unspecified</code>，<code>no_restriction</code>，<code>lax</code>或者<code>strict</code>  默认值为 <code>no_restriction</code>.</li>\n</ul></li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code> - cookie 设置时解析的一个 promise。</p>\n<p>用 <code>details</code> 去设置一个 cookie。</p>\n<h4 id=\"cookiesremoveurl-name\"><a href=\"#cookiesremoveurl-name\"><code>cookies.remove(url, name)</code></a></h4>\n<ul>\n<li><code>url</code>String - 与 cookie 关联的 URL。</li>\n<li><code>name</code>String - cookie 名称。</li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code> - cookie 移除时解析的的一个 promise。</p>\n<p>移除与<code>url</code> 和 <code>name</code>匹配的 cookie。</p>\n<h4 id=\"cookiesflushstore\"><a href=\"#cookiesflushstore\"><code>cookies.flushStore()</code></a></h4>\n<p>返回 <code>Promise&#x3C;void></code> - 一个在 cookie 写入时解析的 promise。</p>\n<p>写入所有未写入磁盘的 cookie。</p>",
      "title": "类：Cookies",
      "description": "查询和修改一个会话的cookies"
    },
    "/docs/api/structures/cpu-usage": {
      "locale": "zh-CN",
      "slug": "cpu-usage",
      "href": "/docs/api/structures/cpu-usage",
      "crowdinFileId": "256419",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/cpu-usage.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"cpuusage-object\"><a href=\"#cpuusage-object\">CPUUsage Object</a></h1>\n<ul>\n<li><code>percentCPUUsage</code> Number - Percentage of CPU used since the last call to getCPUUsage. First call returns 0.</li>\n<li><code>idleWakeupsPerSecond</code> Number - The number of average idle CPU wakeups per second since the last call to getCPUUsage. First call returns 0. Will always return 0 on Windows.</li>\n</ul>",
      "title": "CPUUsage Object",
      "description": ""
    },
    "/docs/api/structures/crash-report": {
      "locale": "zh-CN",
      "slug": "crash-report",
      "href": "/docs/api/structures/crash-report",
      "crowdinFileId": "256421",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/crash-report.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"crashreport-object\"><a href=\"#crashreport-object\">CrashReport Object</a></h1>\n<ul>\n<li><code>date</code> Date</li>\n<li><code>id</code> String</li>\n</ul>",
      "title": "CrashReport Object",
      "description": ""
    },
    "/docs/api/crash-reporter": {
      "locale": "zh-CN",
      "slug": "crash-reporter",
      "href": "/docs/api/crash-reporter",
      "crowdinFileId": "256303",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/crash-reporter.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"crashreporter\"><a href=\"#crashreporter\">crashReporter</a></h1>\n<blockquote>\n<p>将崩溃日志提交给远程服务器</p>\n</blockquote>\n<p>进程： <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>以下是一个设置Electron自动提交崩溃日志到远程服务器的示例：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { crashReporter } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncrashReporter.start({ <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://your-domain.com/url-to-submit'</span> })\n</code></pre>\n<p>构建一个用于接受和处理崩溃日志的服务，你需要以下工程</p>\n<ul>\n<li><a href=\"https://github.com/mozilla/socorro\">socorro</a></li>\n<li><a href=\"https://github.com/electron/mini-breakpad-server\">mini-breakpad-server</a></li>\n</ul>\n<p>或者使用第三方托管的解决办法：</p>\n<ul>\n<li><a href=\"https://backtrace.io/electron/\">Backtrace</a></li>\n<li><a href=\"https://docs.sentry.io/clients/electron\">Sentry</a></li>\n<li><a href=\"https://www.bugsplat.com/docs/platforms/electron\">BugSplat</a></li>\n</ul>\n<p>崩溃报告在上传之前会临时存储在应用程序的用户数据目录下 (在Windows和Mac上称为“Crashpad”，在Linux上称为“Crash reports”)。 在启动崩溃报告器之前，你可以通过调用 <code>app.setPath('crashDumps', '/path/to/crashes')</code> 来覆盖该目录。</p>\n<p>在 Windows 和 macOS 上，Electron 使用 <a href=\"https://chromium.googlesource.com/crashpad/crashpad/+/master/README.md\">crashpad</a> 来监视和报告崩溃情况。 在 Linux上，Electron 使用<a href=\"https://chromium.googlesource.com/breakpad/breakpad/+/master/\">breakpad</a>。 这个实现细节是由Chromium驱动的，将来可能会发生变化。 尤其，crashpad是新出的，可能最终会取代所有平台的breakpad。</p>\n<h3 id=\"关于linux上的node子进程的说明\"><a href=\"#关于linux上的node子进程的说明\">关于Linux上的Node子进程的说明</a></h3>\n<p>如果你在Linux上使用的是Node.js的 <code>child_process</code> 模块，并且想要在这些进程中报告崩溃信息，那么需要采取额外的步骤来在子进程中正确初始化崩溃报告器。 在 Mac 或 Windows 上就没有这个问题，因为这两个平台使用的Crashpad会自动监视子进程。</p>\n<p>由于Node的子进程中无法使用 <code>require('electron')</code> ，那么在Node的子进程中的 <code>process</code> 对象中的以下 API 是可用的。 请注意，在Linux上，每个Node子进程的 breakpad 崩溃报告器都有自己独立的实例。 这与渲染器子进程不同，其具有\"存根\" breakpad 报告器，将信息返回到主进程进行报告。</p>\n<h4 id=\"processcrashreporterstartoptions\"><a href=\"#processcrashreporterstartoptions\"><code>process.crashReporter.start(options)</code></a></h4>\n<p>见 <a href=\"#crashreporterstartoptions\"><code>crashReporter.start()</code></a>。</p>\n<h4 id=\"processcrashreportergetparameters\"><a href=\"#processcrashreportergetparameters\"><code>process.crashReporter.getParameters()</code></a></h4>\n<p>见 <a href=\"#crashreportergetparameters\"><code>crashReporter.getParameters()</code></a>。</p>\n<h4 id=\"processcrashreporteraddextraparameterkey-value\"><a href=\"#processcrashreporteraddextraparameterkey-value\"><code>process.crashReporter.addExtraParameter(key, value)</code></a></h4>\n<p>见 <a href=\"#crashreporteraddextraparameterkey-value\"><code>crashReporter.addExtraParameter(key, value)</code></a>。</p>\n<h4 id=\"processcrashreporterremoveextraparameterkey\"><a href=\"#processcrashreporterremoveextraparameterkey\"><code>process.crashReporter.removeExtraParameter(key)</code></a></h4>\n<p>见 <a href=\"#crashreporterremoveextraparameterkey\"><code>crashReporter.removeExtraParameter(key)</code></a>。</p>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>crashReporter</code> 模块具有以下方法:</p>\n<h3 id=\"crashreporterstartoptions\"><a href=\"#crashreporterstartoptions\"><code>crashReporter.start(options)</code></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>submitURL</code> String (可选) - 崩溃报告将以POST的方式发送给这个URL。 必填 除非<code>uploadToServer</code>是<code>false</code></li>\n<li><code>productName</code> String (可选) - 默认为 <code>app.name</code>.</li>\n<li><code>companyName</code> String (可选) <em>已废弃</em> - 已废弃别名为<code>{ globalExtra: { _companyName: ... } }</code>。</li>\n<li><code>uploadToServer</code> Boolean (可选) - 是否将崩溃报告发送给服务器。 如果为 false，崩溃报告将被收集并存储在崩溃目录中，但不会上传。 默认值为 <code>true</code>。</li>\n<li><code>ignoreSystemCrashHandler</code> Boolean (可选) - 如果为true，在主进程中生成的崩溃将不会转发给系统崩溃处理器。 默认值为 <code>false</code>.</li>\n<li><code>rateLimit</code> Boolean (可选) <em>macOS</em> <em>Windows</em> - 如果为true，将上传的崩溃次数限制到 1次/小时。 默认值为 <code>false</code>.</li>\n<li><code>compress</code> Boolean (可选) - 如果为true，崩溃报告将压缩并上传，使用带有 <code>Content-Encoding: gzip</code> 的头部。 默认值为 <code>true</code>。</li>\n<li><code>extra</code> Record&#x3C;String, String> (可选) - 将随主进程生成的崩溃报告一起发送的额外字符串键/值注解。 只支持string值。 在子进程中产生的崩溃将不会在子进程生成的崩溃报告中包含这些额外的参数。 在子进程中调用 <a href=\"#crashreporteraddextraparameterkey-value\"><code>addExtrameter</code></a> 。</li>\n<li><code>globalExtra</code> Record&#x3C;String, String> (可选) - 会与任意进程产生的崩溃报告一起发送的额外字符串键/值注解。 一旦崩溃报告器启动，这些注解就无法更改。 如果一个键在global extra参数和进程特定的额外参数中出现，那么全局的那个将优先使用。 默认情况下，会包括 <code>productName</code> 和应用程序版本，也就是Electron版本。</li>\n</ul></li>\n</ul>\n<p>该方法必须在使用其他 <code>崩溃报告器</code> 的API之前调用。 一旦以这种方式初始化，crashpad处理器就会从所有随后创建的进程中收集崩溃信息。 崩溃报告器一旦启动就无法禁用了。</p>\n<p>该方法应尽早地在app启动后调用，最好在 <code>app.on('ready')</code> 之前。 如果崩溃报告器没有在渲染器进程创建前初始化，那么渲染器进程将不会被崩溃报告器监视。</p>\n<p><strong>注意：</strong> 您可以通过使用<code>process.crash()</code>生成一个崩溃来测试崩溃报告器。</p>\n<p><strong> 注意: </strong>，如果您在第一次调用 <code>start</code> 后需要发送 附加的/更新的 <code>extra</code> 参数，你可以调用 <code>addExtraParameter</code>。</p>\n<p><strong>注意：</strong> 通过 <code>extra</code>, <code>globalExtra</code>传递，或通过<code>addExtrameter</code>设置的参数对键和值的长度有限制。 键名最长是 39 字节，值不能超过 127 字节。 超过最大长度的键名将被直接忽略。 超过最大长度的键值将被截断。</p>\n<p><strong>注意：</strong> 此方法仅在主进程中可用。</p>\n<h3 id=\"crashreportergetlastcrashreport\"><a href=\"#crashreportergetlastcrashreport\"><code>crashReporter.getLastCrashReport()</code></a></h3>\n<p>返回 <a href=\"/docs/api/structures/crash-report\"><code>CrashReport</code></a> - 上次崩溃报告的日期和 ID。 只有已上传的崩溃报告会被返回；在磁盘上存在崩溃报告，除非上传了，否则不会返回。 如果没有上传的报告，则返回<code>null</code></p>\n<p><strong>注意：</strong> 此方法仅在主进程中可用。</p>\n<h3 id=\"crashreportergetuploadedreports\"><a href=\"#crashreportergetuploadedreports\"><code>crashReporter.getUploadedReports()</code></a></h3>\n<p>返回 <a href=\"/docs/api/structures/crash-report\"><code>CrashReport[]</code></a>:</p>\n<p>返回所有已上传的崩溃报告。 每个报告包含日期以及上传ID。</p>\n<p><strong>注意：</strong> 此方法仅在主进程中可用。</p>\n<h3 id=\"crashreportergetuploadtoserver\"><a href=\"#crashreportergetuploadtoserver\"><code>crashReporter.getUploadToServer()</code></a></h3>\n<p>返回 <code>Boolean</code> - 是否应向服务器提交报告。 通过<code>start</code> 方法或 <code>setUploadToServer</code>设置。</p>\n<p><strong>注意：</strong> 此方法仅在主进程中可用。</p>\n<h3 id=\"crashreportersetuploadtoserveruploadtoserver\"><a href=\"#crashreportersetuploadtoserveruploadtoserver\"><code>crashReporter.setUploadToServer(uploadToServer)</code></a></h3>\n<ul>\n<li><code>uploadToServer</code> Boolean - 是否将报告提交到服务器。</li>\n</ul>\n<p>通常由用户首选项控制。 如果在 <code>start</code> 被调用前调用，该方法将不起作用。</p>\n<p><strong>注意：</strong> 此方法仅在主进程中可用。</p>\n<h3 id=\"crashreporteraddextraparameterkey-value\"><a href=\"#crashreporteraddextraparameterkey-value\"><code>crashReporter.addExtraParameter(key, value)</code></a></h3>\n<ul>\n<li><code>key</code> String - 参数键，长度必须小于39个字节。</li>\n<li><code>value</code> String - 参数值，长度必须小于127个字节。</li>\n</ul>\n<p>设置一个在发送崩溃报告时将额外包含的参数。 当调用 <code>start</code> 时, 在这里指定的值会和所有通过 <code>extra</code> 选项设置的值一起发送。</p>\n<p>以这种方式添加的参数 (或通过 <code>extra</code> 参数到<code>crashReporter.start</code>)是特定于调用进程的。 在主进程中添加extra参数，这些参数将不会与渲染器或其它子进程的崩溃报告一起发送。 同样，在渲染器进程中添加的extra参数不会与其它渲染器进程或主进程中发生的崩溃一起发送。</p>\n<p><strong>注意：</strong> 参数对键和值的长度有限制。 键名最长是 39 字节，值不能超过 20320 字节。 超过最大长度的键名将被直接忽略。 超过最大长度的键值将被截断。</p>\n<p><strong>注意：</strong> 在linux上，超过 127 字节的值将被分割成多个键，每个长度为127个字节。  如下: <code>addExtraParameter('foo', 'a'.repeat(130))</code>将产生两个分块的键， <code>foo__1</code> 和 <code>foo__2</code>，第一个将包含前127字节，第二个将包含剩余的3字节。  在你的崩溃报告后端，你应该以这种格式将键合在一起。</p>\n<h3 id=\"crashreporterremoveextraparameterkey\"><a href=\"#crashreporterremoveextraparameterkey\"><code>crashReporter.removeExtraParameter(key)</code></a></h3>\n<ul>\n<li><code>key</code> String - 参数键，长度必须小于39个字节。</li>\n</ul>\n<p>从当前的参数集中删除一个额外的参数。 未来的崩溃中将不包含此参数。</p>\n<h3 id=\"crashreportergetparameters\"><a href=\"#crashreportergetparameters\"><code>crashReporter.getParameters()</code></a></h3>\n<p>返回 <code>Record&#x3C;String, String></code> - 崩溃报告器当前的“extra”参数。</p>\n<h2 id=\"崩溃报告内容\"><a href=\"#崩溃报告内容\">崩溃报告内容</a></h2>\n<p>崩溃报告将发送下面 <code>multipart/form-data</code> <code>POST</code> 型的数据给 <code>submitURL</code>:</p>\n<ul>\n<li><code>ver</code> String - Electron 的版本.</li>\n<li><code>platform</code> String - 例如 'win32'.</li>\n<li><code>process_type</code> String - 例如 'renderer'.</li>\n<li><code>guid</code> String - 例如 '5e1286fc-da97-479e-918b-6bfb0c3d1c72'.</li>\n<li><code>_version</code> String - <code>package.json</code> 里的版本号.</li>\n<li><code>_productName</code> String - <code>crashReporter</code> <code>options</code> 对象中的产品名字</li>\n<li><code>prod</code> String - 基础产品的名称。 在这种情况下是Electron。</li>\n<li><code>_companyName</code> String - <code>crashReporter</code> <code>options</code> 对象中的公司名称</li>\n<li><code>upload_file_minidump</code> File - <code>minidump</code> 格式的崩溃报告</li>\n<li>All level one properties of the <code>extra</code> object in the <code>crashReporter</code> <code>options</code> object.</li>\n</ul>",
      "title": "crashReporter",
      "description": "将崩溃日志提交给远程服务器"
    },
    "/docs/api/structures/custom-scheme": {
      "locale": "zh-CN",
      "slug": "custom-scheme",
      "href": "/docs/api/structures/custom-scheme",
      "crowdinFileId": "256423",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/custom-scheme.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"customscheme-object\"><a href=\"#customscheme-object\">CustomScheme Object</a></h1>\n<ul>\n<li><code>scheme</code> String - Custom schemes to be registered with options.</li>\n<li><code>privileges</code> Object (optional)<ul>\n<li><code>standard</code> Boolean (optional) - Default false.</li>\n<li><code>secure</code> Boolean (optional) - Default false.</li>\n<li><code>bypassCSP</code> Boolean (optional) - Default false.</li>\n<li><code>allowServiceWorkers</code> Boolean (optional) - Default false.</li>\n<li><code>supportFetchAPI</code> Boolean (optional) - Default false.</li>\n<li><code>corsEnabled</code> Boolean (optional) - Default false.</li>\n<li><code>stream</code> Boolean (optional) - Default false.</li>\n</ul></li>\n</ul>",
      "title": "CustomScheme Object",
      "description": ""
    },
    "/docs/tutorial/dark-mode": {
      "locale": "zh-CN",
      "slug": "dark-mode",
      "href": "/docs/tutorial/dark-mode",
      "crowdinFileId": "256187",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/dark-mode.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dark-mode\"><a href=\"#dark-mode\">Dark Mode</a></h1>\n<h2 id=\"概览\"><a href=\"#概览\">概览</a></h2>\n<h3 id=\"自动更新原生界面\"><a href=\"#自动更新原生界面\">自动更新原生界面</a></h3>\n<p>\"本地界面\"包括文件选择器、窗口边框、对话框、上下文 菜单等 - 任何UI来自操作系统而非应用的界面。 默认行为是从操作系统选择自动主题。</p>\n<h3 id=\"自动更新您自己的界面\"><a href=\"#自动更新您自己的界面\">自动更新您自己的界面</a></h3>\n<p>如果您的应用有自己的黑暗模式，您应该在与系统黑暗模式设置同步时切换。 您可以通过使用[prefer-color-scheme] CSS 媒体查询来做到这一点。</p>\n<h3 id=\"手动更新您自己的界面\"><a href=\"#手动更新您自己的界面\">手动更新您自己的界面</a></h3>\n<p>If you want to manually switch between light/dark modes, you can do this by setting the desired mode in the <a href=\"/docs/api/native-theme#nativethemethemesource\">themeSource</a> property of the <code>nativeTheme</code> module. This property's value will be propagated to your Renderer process. Any CSS rules related to <code>prefers-color-scheme</code> will be updated accordingly.</p>\n<h2 id=\"macos-设置\"><a href=\"#macos-设置\">macOS 设置</a></h2>\n<p>在 macOS 10.14 Mojave中， Apple 为所有 macOS 电脑引入了一个全新的 <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/dark-mode/\">系统级黑暗模式</a>。 如果您的 Electron 应用具有深色模式，您可以 使用\"本机 api\" <a href=\"/docs/api/native-theme\">应用 <code>应用</code></a>。</p>\n<p>In macOS 10.15 Catalina, Apple introduced a new \"automatic\" dark mode option for all macOS computers. 为了让API <code>isDarkMode</code> 和 <code>Tray</code> 在这个模式中正常工作，你需要在 <code>Info.plist</code> 文件里把 <code>NSRequiresAquaSystemAppearance</code> 设置为 <code>false</code> ，或者使用 <code>>=7.0.0</code> 的Electron。 Both <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a> and <a href=\"https://www.electronforge.io/\">Electron Forge</a> have a <a href=\"https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html#darwindarkmodesupport\"><code>darwinDarkModeSupport</code> option</a> to automate the <code>Info.plist</code> changes during app build time.</p>\n<p>If you wish to opt-out while using Electron > 8.0.0, you must set the <code>NSRequiresAquaSystemAppearance</code> key in the <code>Info.plist</code> file to <code>true</code>. Please note that Electron 8.0.0 and above will not let you opt-out of this theming, due to the use of the macOS 10.14 SDK.</p>\n<h2 id=\"示例\"><a href=\"#示例\">示例</a></h2>\n<p>此示例演示了Electron 应用程序从<code>nativeTheme</code>中获取主题颜色。 此外，它还使用 IPC 通道提供主题切换和重置控制。</p>\n<h3 id=\"它是如何工作的呢？\"><a href=\"#它是如何工作的呢？\">它是如何工作的呢？</a></h3>\n<p>从 <code>index.html</code> 文件开始：</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"script-src 'self' 'unsafe-inline';\"</span> /></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/css\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"./styles.css\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">p</span>></span>Current theme source: <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">strong</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"theme-source\"</span>></span>System<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">strong</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">p</span>></span>\n\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"toggle-dark-mode\"</span>></span>Toggle Dark Mode<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">button</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"reset-to-system\"</span>></span>Reset to System Theme<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">button</span>></span>\n\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>以及 <code>styles.css</code> 文件：</p>\n<pre><code class=\"hljs language-css\">@<span class=\"hljs-keyword\">media</span> (prefers-color-scheme: dark) {\n  <span class=\"hljs-selector-tag\">body</span> { <span class=\"hljs-attribute\">background</span>: <span class=\"hljs-number\">#333</span>; <span class=\"hljs-attribute\">color</span>: white; }\n}\n\n@<span class=\"hljs-keyword\">media</span> (prefers-color-scheme: light) {\n  <span class=\"hljs-selector-tag\">body</span> { <span class=\"hljs-attribute\">background</span>: <span class=\"hljs-number\">#ddd</span>; <span class=\"hljs-attribute\">color</span>: black; }\n}\n</code></pre>\n<p>该示例渲染一个包含几个元素的 HTML 页面。 <code>&#x3C;strong id=\"theme-source\"></code> 元素显示当前选中的主题，两个 <code>&#x3C;button></code> 元素是 控件。 CSS 文件使用 <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> 媒体查询 设置 <code>&#x3C;body></code> 元素背景和文本颜色。</p>\n<p><code>preload.js</code> 脚本在 <code>window</code>对象中添加了一个新的 API叫做 <code>深色模式</code>。 此 API 暴露两个IPC 通道到渲染器进程，分别为 <code>'dark-mode:toggle'</code> 和 <code>'dark-mode:system'</code>。 它还分配了两个方法， <code>toggle</code> 和 <code>system</code>，它们将渲染器中的信息传递到 主进程。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'darkMode'</span>, {\n  <span class=\"hljs-attr\">toggle</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'dark-mode:toggle'</span>),\n  <span class=\"hljs-attr\">system</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'dark-mode:system'</span>)\n})\n</code></pre>\n<p>现在，渲染器进程可以安全地与主进程通信，并对<code>nativeTheme</code> 对象执行必要的变更。</p>\n<p><code>renderer.js</code> 文件负责控制 <code>&#x3C;button></code> 功能。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'toggle-dark-mode'</span>).addEventListener(<span class=\"hljs-string\">'click'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> isDarkMode = <span class=\"hljs-keyword\">await</span> <span class=\"hljs-built_in\">window</span>.darkMode.toggle()\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'theme-source'</span>).innerHTML = isDarkMode ? <span class=\"hljs-string\">'Dark'</span> : <span class=\"hljs-string\">'Light'</span>\n})\n\n<span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'reset-to-system'</span>).addEventListener(<span class=\"hljs-string\">'click'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> <span class=\"hljs-built_in\">window</span>.darkMode.system()\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'theme-source'</span>).innerHTML = <span class=\"hljs-string\">'System'</span>\n})\n</code></pre>\n<p>使用 <code>addEventListener</code>， <code>renderer.js</code> 文件将<code>'click'</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\">事件监听器</a>添加到每个按钮元素上。 每个事件监听处理器都会调用到相关的 <code>window.darkmode</code> API 方法。</p>\n<p>最后， <code>main.js</code> 文件代表了主进程并包含实际的 <code>nativeTheme</code> API。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, ipcMain, nativeTheme } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  ipcMain.handle(<span class=\"hljs-string\">'dark-mode:toggle'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (nativeTheme.shouldUseDarkColors) {\n      nativeTheme.themeSource = <span class=\"hljs-string\">'light'</span>\n    } <span class=\"hljs-keyword\">else</span> {\n      nativeTheme.themeSource = <span class=\"hljs-string\">'dark'</span>\n    }\n    <span class=\"hljs-keyword\">return</span> nativeTheme.shouldUseDarkColors\n  })\n\n  ipcMain.handle(<span class=\"hljs-string\">'dark-mode:system'</span>, () => {\n    nativeTheme.themeSource = <span class=\"hljs-string\">'system'</span>\n  })\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n      createWindow()\n    }\n  })\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n</code></pre>\n<p><code>ipcMain.handle</code> 方法表明主进程如何响应来自 HTML 页面上 按钮的点击事件。</p>\n<p><code>'dark-mode:toggle'</code> IPC 通道处理器方法检查 <code>shouldUseDarkColors</code> boolean属性 设置对应的 <code>themeSource</code>, 然后返回当前的 <code>shouldUseDarkColors</code> 属性。 回顾此 IPC 通道的渲染器进程事件监听器，此处理器的返回值为 <code>&#x3C;strong id='theme-source'></code> 元素指定正确的文本。</p>\n<p><code>'dark-mode:system'</code> IPC 通道处理器方法将字符串 <code>'system'</code> 赋值到 <code>themeSource</code> 同时无返回值。 这也对应于相应的渲染器进程事件监听器，因为方法正在等待，且不需要返回值。</p>\n<p>使用Electron Fiddle运行示例，然后点击“切换深色模式”按钮； 应用程序应该开始在亮色和黑色背景颜色之间交替。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/dark_mode.gif\" alt=\"Dark Mode\"></p>",
      "title": "Dark Mode",
      "description": ""
    },
    "/docs/development/debug-instructions-windows": {
      "locale": "zh-CN",
      "slug": "debug-instructions-windows",
      "href": "/docs/development/debug-instructions-windows",
      "crowdinFileId": "256149",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debug-instructions-windows.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"在-windows-中调试\"><a href=\"#在-windows-中调试\">在 Windows 中调试</a></h1>\n<p>如果你在 Electron 中遇到问题或者引起崩溃，你认为它不是由你的JavaScript应用程序引起的，而是由 Electron 本身引起的。调试可能有点棘手，特别是对于不习惯 native/C++ 调试的开发人员。 However, using Visual Studio, Electron's hosted Symbol Server, and the Electron source code, you can enable step-through debugging with breakpoints inside Electron's source code.</p>\n<p><strong>See also</strong>: There's a wealth of information on debugging Chromium, much of which also applies to Electron, on the Chromium developers site: <a href=\"https://www.chromium.org/developers/how-tos/debugging-on-windows\">Debugging Chromium on Windows</a>.</p>\n<h2 id=\"要求\"><a href=\"#要求\">要求</a></h2>\n<ul>\n<li>\n<p><strong>Electron 的调试版本</strong>: 最简单的方法是自己构建它，使用 <a href=\"/docs/development/build-instructions-windows\">Windows 的构建说明</a>中列出的工具和先决条件要求。 While you can attach to and debug Electron as you can download it directly, you will find that it is heavily optimized, making debugging substantially more difficult: The debugger will not be able to show you the content of all variables and the execution path can seem strange because of inlining, tail calls, and other compiler optimizations.</p>\n</li>\n<li>\n<p><strong>Visual Studio 与 C++ 工具</strong>: Visual Studio 2013 和 Visual Studio 2015 的免费社区版本都可以使用。 Once installed, <a href=\"/docs/development/setting-up-symbol-server\">configure Visual Studio to use Electron's Symbol server</a>. 它将使 Visual Studio 能够更好地理解 Electron 中发生的事情，从而更容易以人类可读的格式呈现变量。</p>\n</li>\n<li>\n<p><strong>ProcMon</strong>: <a href=\"https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx\">免费的 SysInternals 工具</a>允许您检查进程参数，文件句柄和注册表操作。</p>\n</li>\n</ul>\n<h2 id=\"附加并调试-electron\"><a href=\"#附加并调试-electron\">附加并调试 Electron</a></h2>\n<p>要启动调试会话，请打开 PowerShell/CMD 并执行 Electron 的调试版本，使用应用程序作为参数打开。</p>\n<pre><code class=\"hljs language-powershell\">$ ./out/Testing/electron.exe ~/my-electron-app/\n</code></pre>\n<h3 id=\"设置断点\"><a href=\"#设置断点\">设置断点</a></h3>\n<p>然后，打开 Visual Studio。 Electron 不是使用 Visual Studio 构建的，因此不包含项目文件 - 但是您可以打开源代码文件 \"As File\"，这意味着 Visual Studio 将自己打开它们。 您仍然可以设置断点 - Visual Studio 将自动确定源代码与附加过程中运行的代码相匹配，并相应地中断。</p>\n<p>Relevant code files can be found in <code>./shell/</code>.</p>\n<h3 id=\"附加\"><a href=\"#附加\">附加</a></h3>\n<p>您可以将 Visual Studio 调试器附加到本地或远程计算机上正在运行的进程。 进程运行后，单击 调试 / 附加 到进程(或按下 <code>CTRL+ALT+P</code>) 打开“附加到进程”对话框。 您可以使用此功能调试在本地或远程计算机上运行的应用程序，同时调试多个进程。</p>\n<p>如果Electron在不同的用户帐户下运行，请选中 <code>显示所有用户的进程</code> 复选框。 请注意，根据您的应用程序打开的浏览器窗口数量，您将看到多个进程。 典型的单窗口应用程序将导致 Visual Studio 向您提供两个 <code>Electron.exe</code> 条目 - 一个用于主进程，一个用于渲染器进程。 因为列表只给你的名字，目前没有可靠的方法来弄清楚哪个是。</p>\n<h3 id=\"我应该附加哪个进程\"><a href=\"#我应该附加哪个进程\">我应该附加哪个进程?</a></h3>\n<p>Code executed within the main process (that is, code found in or eventually run by your main JavaScript file) will run inside the main process, while other code will execute inside its respective renderer process.</p>\n<p>您可以在调试时附加到多个程序，但在任何时候只有一个程序在调试器中处于活动状态。 您可以在 <code>调试位置</code> 工具栏或 <code>进程窗口</code> 中设置活动程序。</p>\n<h2 id=\"使用-procmon-观察进程\"><a href=\"#使用-procmon-观察进程\">使用 ProcMon 观察进程</a></h2>\n<p>虽然 Visual Studio 非常适合检查特定的代码路径，但 ProcMon 的优势在于它可以监视应用程序对操作系统的所有操作 - 捕获进程的文件，注册表，网络，进程和分析详细信息。 它试图记录发生的 <strong>所有</strong> 事件，并且可能是相当压倒性的，而且果你想了解你的应用程序对操作系统做什么和如何做，它则是一个很有价值的资源。</p>\n<p>有关 ProcMon 的基本和高级调试功能的介绍，请查看Microsoft提供的 <a href=\"https://channel9.msdn.com/shows/defrag-tools/defrag-tools-4-process-monitor\">视频教程</a>.</p>",
      "title": "在 Windows 中调试",
      "description": ""
    },
    "/docs/api/debugger": {
      "locale": "zh-CN",
      "slug": "debugger",
      "href": "/docs/api/debugger",
      "crowdinFileId": "256305",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/debugger.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类-debugger\"><a href=\"#类-debugger\">类: Debugger</a></h2>\n<blockquote>\n<p>备用的 Chrome 远程调试接口。</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Chrome Developer Tools 在 JavaScript 运行时提供了一个 <a href=\"https://chromedevtools.github.io/devtools-protocol/\"> special binding </a>, 允许与页面进行交互和检测。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-keyword\">try</span> {\n  win.webContents.debugger.attach(<span class=\"hljs-string\">'1.1'</span>)\n} <span class=\"hljs-keyword\">catch</span> (err) {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Debugger attach failed : '</span>, err)\n}\n\nwin.webContents.debugger.on(<span class=\"hljs-string\">'detach'</span>, (event, reason) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Debugger detached due to : '</span>, reason)\n})\n\nwin.webContents.debugger.on(<span class=\"hljs-string\">'message'</span>, (event, method, params) => {\n  <span class=\"hljs-keyword\">if</span> (method === <span class=\"hljs-string\">'Network.requestWillBeSent'</span>) {\n    <span class=\"hljs-keyword\">if</span> (params.request.url === <span class=\"hljs-string\">'https://www.github.com'</span>) {\n      win.webContents.debugger.detach()\n    }\n  }\n})\n\nwin.webContents.debugger.sendCommand(<span class=\"hljs-string\">'Network.enable'</span>)\n</code></pre>\n<h3 id=\"实例事件\"><a href=\"#实例事件\">实例事件</a></h3>\n<h4 id=\"event-detach\"><a href=\"#event-detach\">Event: 'detach'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>reason</code> String - 分离调试器的原因</li>\n</ul>\n<p>调试会话终止时激活 发生在对应的<code>webContents</code> 关闭或者调用 devtools 时,。</p>\n<h4 id=\"event-message\"><a href=\"#event-message\">Event: 'message'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>method</code> String - 方法名.</li>\n<li><code>params</code> any - 远程调试协议中的 parameters 属性定义的事件参数。</li>\n<li><code>sessionId</code> String - 附加调试会话的唯一标识符， 与从 <code>debugger.sendCommand</code> 中发送的值相同。</li>\n</ul>\n<p>当正在调试的目标发出条件检测事件时触发。</p>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<h4 id=\"debuggerattachprotocolversion\"><a href=\"#debuggerattachprotocolversion\"><code>debugger.attach([protocolVersion])</code></a></h4>\n<ul>\n<li><code>protocolVersion</code> String (optional) - 需要调试的协议的版本</li>\n</ul>\n<p>添加调试器到 <code>webContents</code> 。</p>\n<h4 id=\"debuggerisattached\"><a href=\"#debuggerisattached\"><code>debugger.isAttached()</code></a></h4>\n<p>Returns <code>Boolean</code> - 表示调试器是否成功添加到 <code>webContents</code> 。</p>\n<h4 id=\"debuggerdetach\"><a href=\"#debuggerdetach\"><code>debugger.detach()</code></a></h4>\n<p>从 <code>webContents</code> 里分离调试器.</p>\n<h4 id=\"debuggersendcommandmethod-commandparams-sessionid\"><a href=\"#debuggersendcommandmethod-commandparams-sessionid\"><code>debugger.sendCommand(method[, commandParams, sessionId])</code></a></h4>\n<ul>\n<li><code>method</code> String - 方法名称，应该是 <a href=\"https://chromedevtools.github.io/devtools-protocol/\">远程调试协议</a>中定义的方法之一。</li>\n<li><code>commandParams</code> any (可选) - 具有请求参数的 JSON 对象。</li>\n<li><code>sessionId</code> String (可选) - 发送带有调试会话id的命令给目标。 初始值可以通过发送 <a href=\"https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-attachToTarget\">Target.attachToTarget</a> 消息来获得。</li>\n</ul>\n<p>返回 <code>Promise&#x3C;any></code> - 一个 promise，远程调试协议中的命令描述的“returns”属性定义的响应，或者显示命令失败的错误消息。</p>\n<p>向调试目标发送给定的命令。</p>",
      "title": "类: Debugger",
      "description": "备用的 Chrome 远程调试接口。"
    },
    "/docs/development/debugging-instructions-macos": {
      "locale": "zh-CN",
      "slug": "debugging-instructions-macos",
      "href": "/docs/development/debugging-instructions-macos",
      "crowdinFileId": "256153",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debugging-instructions-macos.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"在-macos-中调试\"><a href=\"#在-macos-中调试\">在 macOS 中调试</a></h1>\n<p>如果你在 Electron 中遇到问题或者引起崩溃，你认为它不是由你的JavaScript应用程序引起的，而是由 Electron 本身引起的。调试可能有点棘手，特别是对于不习惯 native/C++ 调试的开发人员。 然而，使用 lldb 和 Electron 源代码，可以在 Electron 的源代码中使用断点启用逐步调试。 如果您希望用图形界面的开发工具，也可以使用<a href=\"/docs/development/debugging-instructions-macos-xcode\">XCode for debugging</a>。</p>\n<h2 id=\"要求\"><a href=\"#要求\">要求</a></h2>\n<ul>\n<li>\n<p><strong>Electron 的调试版本</strong>: 最简单的方法是自己构建它，使用 <a href=\"/docs/development/build-instructions-macos\">macOS 的构建说明</a> 中列出的工具和先决条件要求。 While you can attach to and debug Electron as you can download it directly, you will find that it is heavily optimized, making debugging substantially more difficult: The debugger will not be able to show you the content of all variables and the execution path can seem strange because of inlining, tail calls, and other compiler optimizations.</p>\n</li>\n<li>\n<p><strong>Xcode</strong>: 除了 Xcode，还安装 Xcode 命令行工具. They include LLDB, the default debugger in Xcode on macOS. It supports debugging C, Objective-C and C++ on the desktop and iOS devices and simulator.</p>\n</li>\n<li>\n<p><strong>.lldbinit</strong>: Create or edit <code>~/.lldbinit</code> to allow Chromium code to be properly source-mapped.</p>\n<pre><code class=\"hljs language-plaintext\"># e.g: ['~/electron/src/tools/lldb']\nscript sys.path[:0] = ['&#x3C;...path/to/electron/src/tools/lldb>']\nscript import lldbinit\n</code></pre>\n</li>\n</ul>\n<h2 id=\"附加并调试-electron\"><a href=\"#附加并调试-electron\">附加并调试 Electron</a></h2>\n<p>To start a debugging session, open up Terminal and start <code>lldb</code>, passing a non-release build of Electron as a parameter.</p>\n<pre><code class=\"hljs language-sh\">$ lldb ./out/Testing/Electron.app\n(lldb) target create <span class=\"hljs-string\">\"./out/Testing/Electron.app\"</span>\nCurrent executable <span class=\"hljs-built_in\">set</span> to <span class=\"hljs-string\">'./out/Testing/Electron.app'</span> (x86_64).\n</code></pre>\n<h3 id=\"设置断点\"><a href=\"#设置断点\">设置断点</a></h3>\n<p>LLDB是一个强大的工具，支持进行多种策略的代码检查。 在这做一个基本的介绍，让我们假设你从 JavaScript 调用一个不正常的命令 - 所以你想打断该命令的 C++ 对应的 Electron 源。</p>\n<p>Relevant code files can be found in <code>./shell/</code>.</p>\n<p>让我们假设你想调试 <code>app.setName()</code>, 在 <code>browser.cc</code> 中定义为 <code>Browser::SetName()</code>. 使用 <code>breakpoint</code> 命令进行断点，指定文件和断点位置:</p>\n<pre><code class=\"hljs language-sh\">(lldb) breakpoint <span class=\"hljs-built_in\">set</span> --file browser.cc --line 117\nBreakpoint 1: <span class=\"hljs-built_in\">where</span> = Electron Framework`atom::Browser::SetName(std::__1::basic_string&#x3C;char, std::__1::char_traits&#x3C;char>, std::__1::allocator&#x3C;char> > const&#x26;) + 20 at browser.cc:118, address = 0x000000000015fdb4\n</code></pre>\n<p>然后, 启动 Electron:</p>\n<pre><code class=\"hljs language-sh\">(lldb) run\n</code></pre>\n<p>应用程式会立即暂停，因为 Electron 会在启动时设定应用程序名称:</p>\n<pre><code class=\"hljs language-sh\">(lldb) run\nProcess 25244 launched: <span class=\"hljs-string\">'/Users/fr/Code/electron/out/Testing/Electron.app/Contents/MacOS/Electron'</span> (x86_64)\nProcess 25244 stopped\n* thread <span class=\"hljs-comment\">#1: tid = 0x839a4c, 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 20 at browser.cc:118, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1</span>\n    frame <span class=\"hljs-comment\">#0: 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 20 at browser.cc:118</span>\n   115  }\n   116\n   117  void Browser::SetName(const std::string&#x26; name) {\n-> 118    name_override_ = name;\n   119  }\n   120\n   121  int Browser::<span class=\"hljs-function\"><span class=\"hljs-title\">GetBadgeCount</span></span>() {\n(lldb)\n</code></pre>\n<p>显示当前帧的参数和局部变量, 运行 <code>frame variable</code> (或 <code>fr v</code>), 这将显示你的应用程序当前设置名称为 “Electron”.</p>\n<pre><code class=\"hljs language-sh\">(lldb) frame variable\n(atom::Browser *) this = 0x0000000108b14f20\n(const string &#x26;) name = <span class=\"hljs-string\">\"Electron\"</span>: {\n    [...]\n}\n</code></pre>\n<p>在当前选择的线程中执行源级单步执行, 执行 <code>step</code> (或 <code>s</code>). 这将带你进入 <code>name_override_.empty()</code>。 继续前进，步过，运行 <code>next</code> (或 <code>n</code>).</p>\n<pre><code class=\"hljs language-sh\">(lldb) step\nProcess 25244 stopped\n* thread <span class=\"hljs-comment\">#1: tid = 0x839a4c, 0x0000000100162dcc Electron Framework`atom::Browser::SetName(</span>\n    this=0x0000000108b14f20, name=<span class=\"hljs-string\">\"Electron\"</span>\n) + 44 at browser.cc:119, queue = <span class=\"hljs-string\">'com.apple.main-thread'</span>, stop reason = step <span class=\"hljs-keyword\">in</span>\n    frame <span class=\"hljs-comment\">#0: 0x0000000100162dcc Electron Framework`atom::Browser::SetName(</span>\n    this=0x0000000108b14f20, name=<span class=\"hljs-string\">\"Electron\"</span>\n) + 44 at browser.cc:119\n   116\n   117  void Browser::SetName(const std::string&#x26; name) {\n   118    name_override_ = name;\n-> 119  }\n   120\n   121  int Browser::<span class=\"hljs-function\"><span class=\"hljs-title\">GetBadgeCount</span></span>() {\n   122    <span class=\"hljs-built_in\">return</span> badge_count_;\n</code></pre>\n<p><strong>NOTE:</strong> If you don't see source code when you think you should, you may not have added the <code>~/.lldbinit</code> file above.</p>\n<p>要完成此时的调试，运行 <code>process continue</code>。 你也可以继续，直到这个线程中的某一行被命中(<code>线程直到100</code>)。 此命令将在当前帧中运行线程，直到它到达此帧中的行100，或者如果它离开当前帧，则停止。</p>\n<p>现在，如果你打开 Electron 的开发工具并调用 <code>setName</code>，你将再次命中断点。</p>\n<h3 id=\"进一步阅读\"><a href=\"#进一步阅读\">进一步阅读</a></h3>\n<p>LLDB是一个强大的工具，有一个庞大的文档。 To learn more about it, consider Apple's debugging documentation, for instance the <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-basics.html#//apple_ref/doc/uid/TP40012917-CH2-SW2\">LLDB Command Structure Reference</a> or the introduction to <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-terminal-workflow-tutorial.html\">Using LLDB as a Standalone Debugger</a>.</p>\n<p>You can also check out LLDB's fantastic <a href=\"https://lldb.llvm.org/tutorial.html\">manual and tutorial</a>, which will explain more complex debugging scenarios.</p>",
      "title": "在 macOS 中调试",
      "description": ""
    },
    "/docs/development/debugging-instructions-macos-xcode": {
      "locale": "zh-CN",
      "slug": "debugging-instructions-macos-xcode",
      "href": "/docs/development/debugging-instructions-macos-xcode",
      "crowdinFileId": "256151",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debugging-instructions-macos-xcode.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h2 id=\"使用-xcode-调试\"><a href=\"#使用-xcode-调试\">使用 XCode 调试</a></h2>\n<h3 id=\"为调试源代码生成xcode项目（无法从xcode构建代码）\"><a href=\"#为调试源代码生成xcode项目（无法从xcode构建代码）\">为调试源代码生成Xcode项目（无法从Xcode构建代码）</a></h3>\n<p>运行 <code>gn gen</code> 并带上 --ide=xcode 参数</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --ide=xcode\n</code></pre>\n<p>这会生成 electron.ninja.xcworkspace。 您需要打开这个工作区来设置断点和检查。</p>\n<p>See <code>gn help gen</code> for more information on generating IDE projects with GN.</p>\n<h3 id=\"调试与断点\"><a href=\"#调试与断点\">调试与断点</a></h3>\n<p>Launch Electron app after build. You can now open the xcode workspace created above and attach to the Electron process through the Debug > Attach To Process > Electron debug menu. [Note: If you want to debug the renderer process, you need to attach to the Electron Helper as well.]</p>\n<p>You can now set breakpoints in any of the indexed files. However, you will not be able to set breakpoints directly in the Chromium source. To set break points in the Chromium source, you can choose Debug > Breakpoints > Create Symbolic Breakpoint and set any function name as the symbol. This will set the breakpoint for all functions with that name, from all the classes if there are more than one. You can also do this step of setting break points prior to attaching the debugger, however, actual breakpoints for symbolic breakpoint functions may not show up until the debugger is attached to the app.</p>",
      "title": "使用 XCode 调试",
      "description": ""
    },
    "/docs/tutorial/debugging-main-process": {
      "locale": "zh-CN",
      "slug": "debugging-main-process",
      "href": "/docs/tutorial/debugging-main-process",
      "crowdinFileId": "256189",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/debugging-main-process.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"调试主进程\"><a href=\"#调试主进程\">调试主进程</a></h1>\n<p>Electron 浏览器窗口中的 DevTools 只能调试 在该窗口中执行的 JavaScript (即 web 页面) 。 为了提供一个可以调试主进程的方法，Electron 提供了 <code>--inspect</code> 和 <code>--inspect-brk</code> 开关。</p>\n<h2 id=\"命令行开关\"><a href=\"#命令行开关\">命令行开关</a></h2>\n<p>使用如下的命令行开关来调试 Electron 的主进程：</p>\n<h3 id=\"--inspectport\"><a href=\"#--inspectport\"><code>--inspect=[port]</code></a></h3>\n<p>Electron will listen for V8 inspector protocol messages on the specified <code>port</code>, an external debugger will need to connect on this port. The default <code>port</code> is <code>5858</code>.</p>\n<pre><code class=\"hljs language-shell\">electron --inspect=5858 your/app\n</code></pre>\n<h3 id=\"--inspect-brkport\"><a href=\"#--inspect-brkport\"><code>--inspect-brk=[port]</code></a></h3>\n<p>和<code>--inspector</code> 一样，但是会在JavaScript 脚本的第一行暂停运行。</p>\n<h2 id=\"外部调试器\"><a href=\"#外部调试器\">外部调试器</a></h2>\n<p>你需要使用一个支持 V8 调试协议的调试器</p>\n<ul>\n<li>通过访问 <code>chrome://inspect</code> 来连接 Chrome 并在那里选择需要检查的Electron 应用程序。</li>\n<li><a href=\"/docs/tutorial/debugging-vscode\">使用 VsCode调试</a></li>\n</ul>",
      "title": "调试主进程",
      "description": ""
    },
    "/docs/tutorial/debugging-vscode": {
      "locale": "zh-CN",
      "slug": "debugging-vscode",
      "href": "/docs/tutorial/debugging-vscode",
      "crowdinFileId": "256191",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/debugging-vscode.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"使用-vscode调试\"><a href=\"#使用-vscode调试\">使用 VsCode调试</a></h1>\n<p>本指南将介绍如何使用 VSCode debugging 为您自己的 Electron 项目和 native Electron 代码库（Electron codebase）调试。</p>\n<h2 id=\"调试您的-electron-应用\"><a href=\"#调试您的-electron-应用\">调试您的 Electron 应用</a></h2>\n<h3 id=\"主进程\"><a href=\"#主进程\">主进程</a></h3>\n<h4 id=\"1-open-an-electron-project-in-vscode\"><a href=\"#1-open-an-electron-project-in-vscode\">1. Open an Electron project in VSCode.</a></h4>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:electron/electron-quick-start.git\n$ code electron-quick-start\n</code></pre>\n<h4 id=\"2-添加文件-vscodelaunchjson，内容为\"><a href=\"#2-添加文件-vscodelaunchjson，内容为\">2. 添加文件 <code>.vscode/launch.json</code>，内容为</a></h4>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.2.0\"</span>,\n  <span class=\"hljs-attr\">\"configurations\"</span>: [\n    {\n      <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"Debug Main Process\"</span>,\n      <span class=\"hljs-attr\">\"type\"</span>: <span class=\"hljs-string\">\"node\"</span>,\n      <span class=\"hljs-attr\">\"request\"</span>: <span class=\"hljs-string\">\"launch\"</span>,\n      <span class=\"hljs-attr\">\"cwd\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      <span class=\"hljs-attr\">\"runtimeExecutable\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}/node_modules/.bin/electron\"</span>,\n      <span class=\"hljs-attr\">\"windows\"</span>: {\n        <span class=\"hljs-attr\">\"runtimeExecutable\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}/node_modules/.bin/electron.cmd\"</span>\n      },\n      <span class=\"hljs-attr\">\"args\"</span> : [<span class=\"hljs-string\">\".\"</span>]\n    }\n  ]\n}\n</code></pre>\n<h4 id=\"3-debugging\"><a href=\"#3-debugging\">3. Debugging</a></h4>\n<p>在 <code>main.js</code> 中设置一些断点，并在 <a href=\"https://code.visualstudio.com/docs/editor/debugging\">调试视图</a> 中开始调试. 您应该能够点击断点。</p>\n<p>这是一个预先配置好了的项目，你可以下载并直接在 VSCode 中调试：<a href=\"https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start\">https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start</a></p>\n<h2 id=\"调试-electron-代码库（electron-codebase）\"><a href=\"#调试-electron-代码库（electron-codebase）\">调试 Electron 代码库（Electron codebase）</a></h2>\n<p>如果您想从源代码构建 Electron 并修改 native Electron 代码库，本节将帮助您测试您的修改。</p>\n<p>对于那些不确定在哪里获得代码或如何构建它， <a href=\"https://github.com/electron/build-tools\">Electron 的构建工具</a> 自动化并解释此过程的大部分。 如果你想手动设置环境，你可以使用这些 <a href=\"/docs/development/build-instructions-gn\">构建指令</a>。</p>\n<h3 id=\"windows-c\"><a href=\"#windows-c\">Windows (C++)</a></h3>\n<h4 id=\"1-open-an-electron-project-in-vscode-1\"><a href=\"#1-open-an-electron-project-in-vscode-1\">1. Open an Electron project in VSCode.</a></h4>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:electron/electron-quick-start.git\n$ code electron-quick-start\n</code></pre>\n<h4 id=\"2-添加文件-vscodelaunchjson，内容为-1\"><a href=\"#2-添加文件-vscodelaunchjson，内容为-1\">2. 添加文件 <code>.vscode/launch.json</code>，内容为</a></h4>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.2.0\"</span>,\n  <span class=\"hljs-attr\">\"configurations\"</span>: [\n    {\n      <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"(Windows) Launch\"</span>,\n      <span class=\"hljs-attr\">\"type\"</span>: <span class=\"hljs-string\">\"cppvsdbg\"</span>,\n      <span class=\"hljs-attr\">\"request\"</span>: <span class=\"hljs-string\">\"launch\"</span>,\n      <span class=\"hljs-attr\">\"program\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\\\\out\\\\your-executable-location\\\\electron.exe\"</span>,\n      <span class=\"hljs-attr\">\"args\"</span>: [<span class=\"hljs-string\">\"your-electron-project-path\"</span>],\n      <span class=\"hljs-attr\">\"stopAtEntry\"</span>: <span class=\"hljs-literal\">false</span>,\n      <span class=\"hljs-attr\">\"cwd\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      <span class=\"hljs-attr\">\"environment\"</span>: [\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_ENABLE_LOGGING\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"true\"</span>},\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_ENABLE_STACK_DUMPING\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"true\"</span>},\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_RUN_AS_NODE\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"\"</span>},\n      ],\n      <span class=\"hljs-attr\">\"externalConsole\"</span>: <span class=\"hljs-literal\">false</span>,\n      <span class=\"hljs-attr\">\"sourceFileMap\"</span>: {\n          <span class=\"hljs-attr\">\"o:\\\\\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      },\n    },\n  ]\n}\n</code></pre>\n<p><strong>配置说明</strong></p>\n<ul>\n<li><code>cppvsdbg</code> 需要启用 <a href=\"https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools\">内置的 C/C++ 扩展</a>。</li>\n<li><code>${workspaceFolder}</code> 是 Chromium 的 <code>源</code> 的完整路径。</li>\n<li><code>your-executable-location</code> 将是以下几项之一：<ul>\n<li><code>Testing</code>：如果您使用的是默认的 <a href=\"https://github.com/electron/build-tools\">Electron 构建工具</a> 设置，或默认的 <a href=\"/docs/development/build-instructions-gn#building\">从源端构建</a> 的设置。</li>\n<li><code>Release</code>：如果你构建了一个发布版本，而不是测试版本。</li>\n<li><code>your-directory-name</code>：如果你在构建过程中修改， 这将是你指定的。</li>\n</ul></li>\n<li><code>args</code> 数组字符串 <code>\"your electron-project-path\"</code> 应为您正在用于测试的 Electron 项目或 <code>main.js</code> 的绝对路径。 在本示例中，它应该是您的 <code>electron-quick-start</code> 的路径。</li>\n</ul>\n<h4 id=\"3-debugging-1\"><a href=\"#3-debugging-1\">3. Debugging</a></h4>\n<p>在你选择的原始 Electron C++ 代码中的 .cc 文件中设置一些断点，并在 <a href=\"https://code.visualstudio.com/docs/editor/debugging\">Debug View</a> 中开始调试。</p>",
      "title": "使用 VsCode调试",
      "description": ""
    },
    "/docs/api/desktop-capturer": {
      "locale": "zh-CN",
      "slug": "desktop-capturer",
      "href": "/docs/api/desktop-capturer",
      "crowdinFileId": "256307",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/desktop-capturer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktopcapturer\"><a href=\"#desktopcapturer\">desktopCapturer</a></h1>\n<blockquote>\n<p>访问关于使用<a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> API 获取的可以用来从桌面捕获音频和视频的媒体源的信息。</p>\n</blockquote>\n<p>进程： <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>下面的示例演示如何从标题为 <code>Electron</code> 的桌面窗口捕获视频:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In the renderer process.</span>\n<span class=\"hljs-keyword\">const</span> { desktopCapturer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ndesktopCapturer.getSources({ <span class=\"hljs-attr\">types</span>: [<span class=\"hljs-string\">'window'</span>, <span class=\"hljs-string\">'screen'</span>] }).then(<span class=\"hljs-keyword\">async</span> sources => {\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> source <span class=\"hljs-keyword\">of</span> sources) {\n    <span class=\"hljs-keyword\">if</span> (source.name === <span class=\"hljs-string\">'Electron'</span>) {\n      <span class=\"hljs-keyword\">try</span> {\n        <span class=\"hljs-keyword\">const</span> stream = <span class=\"hljs-keyword\">await</span> navigator.mediaDevices.getUserMedia({\n          <span class=\"hljs-attr\">audio</span>: <span class=\"hljs-literal\">false</span>,\n          <span class=\"hljs-attr\">video</span>: {\n            <span class=\"hljs-attr\">mandatory</span>: {\n              <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>,\n              <span class=\"hljs-attr\">chromeMediaSourceId</span>: source.id,\n              <span class=\"hljs-attr\">minWidth</span>: <span class=\"hljs-number\">1280</span>,\n              <span class=\"hljs-attr\">maxWidth</span>: <span class=\"hljs-number\">1280</span>,\n              <span class=\"hljs-attr\">minHeight</span>: <span class=\"hljs-number\">720</span>,\n              <span class=\"hljs-attr\">maxHeight</span>: <span class=\"hljs-number\">720</span>\n            }\n          }\n        })\n        handleStream(stream)\n      } <span class=\"hljs-keyword\">catch</span> (e) {\n        handleError(e)\n      }\n      <span class=\"hljs-keyword\">return</span>\n    }\n  }\n})\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleStream</span> (<span class=\"hljs-params\">stream</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> video = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'video'</span>)\n  video.srcObject = stream\n  video.onloadedmetadata = <span class=\"hljs-function\">(<span class=\"hljs-params\">e</span>) =></span> video.play()\n}\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleError</span> (<span class=\"hljs-params\">e</span>) </span>{\n  <span class=\"hljs-built_in\">console</span>.log(e)\n}\n</code></pre>\n<p>为了从<code>desktopCapturer</code>提供的源捕获视频，传递给 <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> 的约束条件需包括 <code>chromeMediaSource: 'desktop'</code> 和 <code>audio: false</code>。</p>\n<p>为了同时捕获整个桌面的音视频，传递给 <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> 的约束条件需包括 <code>chromeMediaSource: 'desktop'</code>，<code>audio</code> 和 <code>视频</code>，但不应该包括 <code>chromeMediaSourceId</code> 约束。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> constraints = {\n  <span class=\"hljs-attr\">audio</span>: {\n    <span class=\"hljs-attr\">mandatory</span>: {\n      <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>\n    }\n  },\n  <span class=\"hljs-attr\">video</span>: {\n    <span class=\"hljs-attr\">mandatory</span>: {\n      <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>\n    }\n  }\n}\n</code></pre>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>desktopCapturer</code> 模块有以下方法:</p>\n<h3 id=\"desktopcapturergetsourcesoptions\"><a href=\"#desktopcapturergetsourcesoptions\"><code>desktopCapturer.getSources(options)</code></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code> 类型</code>String[]-列出要捕获的桌面源类型的字符串数组, 可用类型为 <code>screen</code> 和 <code>window</code>。</li>\n<li><code>thumbnailSize</code><a href=\"/docs/api/structures/size\">Size</a>(可选) - 媒体源缩略图应缩放到的尺寸大小。 默认是 <code>150</code> x <code>150</code>。 当您不需要缩略图时，设置宽度或高度为0。 这将节省用于获取每个窗口和屏幕内容时的处理时间。</li>\n<li><code>fetchWindowIcons</code> Boolean (可选) - 设置为true以便启用获取窗口图标。 默认值为false。 当值为false时，源的appIcon属性返回null。 如果一个源是屏幕类型也是如此。</li>\n</ul></li>\n</ul>\n<p>返回 <code>Promise&#x3C;DesktopCapturerSource[]></code> - resolve 一个<a href=\"/docs/api/structures/desktop-capturer-source\"><code>DesktopCapturerSource</code></a> 对象类型的数组，每个 <code>DesktopCapturerSource</code> 代表一个屏幕或一个可以被捕获的独立窗口。</p>\n<p><strong>注意</strong> 在macOS 10.15 Catalina 或更高版本上捕获屏幕内容需要用户同意，可通过 <a href=\"/docs/api/system-preferences#systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><code>systemPreferences.getMediaAccessStatus</code></a> 检测是否授权。</p>\n<h2 id=\"注意事项\"><a href=\"#注意事项\">注意事项</a></h2>\n<p>由于存在基本限制，因此<code>navigator.mediaDevices.getUserMedia</code> 无法在macOS上进行音频捕获，因此要访问系统音频的应用程序需要一个<a href=\"https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/KernelExtensions/KernelExtensions.html\">签名内核拓展</a>. Chromium以及Electron扩展不提供这个。</p>\n<p>通过使用另一个MacOS应用程序（如Soundflower）捕获系统音频并将其通过虚拟音频输入设备来规避此限制是可能的。 然后可以用 <code>navigator.mediaDevices.getUserMedia</code>查询该虚拟设备。</p>",
      "title": "desktopCapturer",
      "description": "访问关于使用navigator.mediaDevices.getUserMedia API 获取的可以用来从桌面捕获音频和视频的媒体源的信息。"
    },
    "/docs/api/structures/desktop-capturer-source": {
      "locale": "zh-CN",
      "slug": "desktop-capturer-source",
      "href": "/docs/api/structures/desktop-capturer-source",
      "crowdinFileId": "256425",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/desktop-capturer-source.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktopcapturersource-object\"><a href=\"#desktopcapturersource-object\">DesktopCapturerSource Object</a></h1>\n<ul>\n<li><code>id</code> String - The identifier of a window or screen that can be used as a <code>chromeMediaSourceId</code> constraint when calling [<code>navigator.webkitGetUserMedia</code>]. The format of the identifier will be <code>window:XX:YY</code> or <code>screen:ZZ:0</code>. XX is the windowID/handle. YY is 1 for the current process, and 0 for all others. ZZ is a sequential number that represents the screen, and it does not equal to the index in the source's name.</li>\n<li><code>name</code> String - A screen source will be named either <code>Entire Screen</code> or <code>Screen &#x3C;index></code>, while the name of a window source will match the window title.</li>\n<li><code>thumbnail</code> <a href=\"/docs/api/native-image\">NativeImage</a> - A thumbnail image. <strong>Note:</strong> There is no guarantee that the size of the thumbnail is the same as the <code>thumbnailSize</code> specified in the <code>options</code> passed to <code>desktopCapturer.getSources</code>. The actual size depends on the scale of the screen or window.</li>\n<li><code>display_id</code> String - A unique identifier that will correspond to the <code>id</code> of the matching <a href=\"/docs/api/structures/display\">Display</a> returned by the <a href=\"/docs/api/screen\">Screen API</a>. On some platforms, this is equivalent to the <code>XX</code> portion of the <code>id</code> field above and on others it will differ. It will be an empty string if not available.</li>\n<li><code>appIcon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - An icon image of the application that owns the window or null if the source has a type screen. The size of the icon is not known in advance and depends on what the application provides.</li>\n</ul>",
      "title": "DesktopCapturerSource Object",
      "description": ""
    },
    "/docs/tutorial/devices": {
      "locale": "zh-CN",
      "slug": "devices",
      "href": "/docs/tutorial/devices",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/devices.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"device-access\"><a href=\"#device-access\">Device Access</a></h1>\n<p>Like Chromium based browsers, Electron provides access to device hardware through web APIs.  For the most part these APIs work like they do in a browser, but there are some differences that need to be taken into account.  The primary difference between Electron and browsers is what happens when device access is requested.  In a browser, users are presented with a popup where they can grant access to an individual device.  In Electron APIs are provided which can be used by a developer to either automatically pick a device or prompt users to pick a device via a developer created interface.</p>\n<h2 id=\"web-bluetooth-api\"><a href=\"#web-bluetooth-api\">Web Bluetooth API</a></h2>\n<p>The <a href=\"https://web.dev/bluetooth/\">Web Bluetooth API</a> can be used to communicate with bluetooth devices. In order to use this API in Electron, developers will need to handle the <a href=\"/docs/api/web-contents#event-select-bluetooth-device\"><code>select-bluetooth-device</code> event on the webContents</a> associated with the device request.</p>\n<h3 id=\"示例\"><a href=\"#示例\">示例</a></h3>\n<p>This example demonstrates an Electron application that automatically selects the first available bluetooth device when the <code>Test Bluetooth</code> button is clicked.</p>\n<h2 id=\"webhid-api\"><a href=\"#webhid-api\">WebHID API</a></h2>\n<p>The <a href=\"https://web.dev/hid/\">WebHID API</a> can be used to access HID devices such as keyboards and gamepads.  Electron provides several APIs for working with the WebHID API:</p>\n<ul>\n<li>The <a href=\"/docs/api/session#event-select-hid-device\"><code>select-hid-device</code> event on the Session</a> can be used to select a HID device when a call to <code>navigator.hid.requestDevice</code> is made.  Additionally the <a href=\"/docs/api/session#event-hid-device-added\"><code>hid-device-added</code></a> and <a href=\"/docs/api/session#event-hid-device-removed\"><code>hid-device-removed</code></a> events on the Session can be used to handle devices being plugged in or unplugged during the <code>navigator.hid.requestDevice</code> process.</li>\n<li><a href=\"/docs/api/session#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a> can be used to provide default permissioning to devices without first calling for permission to devices via <code>navigator.hid.requestDevice</code>.  Additionally, the default behavior of Electron is to store granted device permision through the lifetime of the corresponding WebContents.  If longer term storage is needed, a developer can store granted device permissions (eg when handling the <code>select-hid-device</code> event) and then read from that storage with <code>setDevicePermissionHandler</code>.</li>\n<li><a href=\"/docs/api/session#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a> can be used to disable HID access for specific origins.</li>\n</ul>\n<h3 id=\"blocklist\"><a href=\"#blocklist\">Blocklist</a></h3>\n<p>By default Electron employs the same <a href=\"https://github.com/WICG/webhid/blob/main/blocklist.txt\">blocklist</a> used by Chromium.  If you wish to override this behavior, you can do so by setting the <code>disable-hid-blocklist</code> flag:</p>\n<pre><code class=\"hljs language-javascript\">app.commandLine.appendSwitch(<span class=\"hljs-string\">'disable-hid-blocklist'</span>)\n</code></pre>\n<h3 id=\"示例-1\"><a href=\"#示例-1\">示例</a></h3>\n<p>This example demonstrates an Electron application that automatically selects HID devices through <a href=\"/docs/api/session#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a> and through <a href=\"/docs/api/session#event-select-hid-device\"><code>select-hid-device</code> event on the Session</a> when the <code>Test WebHID</code> button is clicked.</p>\n<h2 id=\"web-serial-api\"><a href=\"#web-serial-api\">Web Serial API</a></h2>\n<p>The <a href=\"https://web.dev/serial/\">Web Serial API</a> can be used to access serial devices that are connected via serial port, USB, or Bluetooth.  In order to use this API in Electron, developers will need to handle the <a href=\"/docs/api/session#event-select-serial-port\"><code>select-serial-port</code> event on the Session</a> associated with the serial port request.</p>\n<p>There are several additional APIs for working with the Web Serial API:</p>\n<ul>\n<li>The <a href=\"/docs/api/session#event-serial-port-added\"><code>serial-port-added</code></a> and <a href=\"/docs/api/session#event-serial-port-removed\"><code>serial-port-removed</code></a> events on the Session can be used to handle devices being plugged in or unplugged during the <code>navigator.serial.requestPort</code> process.</li>\n<li><a href=\"/docs/api/session#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a> can be used to disable serial access for specific origins.</li>\n</ul>\n<h3 id=\"示例-2\"><a href=\"#示例-2\">示例</a></h3>\n<p>This example demonstrates an Electron application that automatically selects the first available Arduino Uno serial device (if connected) through <a href=\"/docs/api/session#event-select-serial-port\"><code>select-serial-port</code> event on the Session</a> when the <code>Test Web Serial</code> button is clicked.</p>",
      "title": "Device Access",
      "description": ""
    },
    "/docs/tutorial/devtools-extension": {
      "locale": "zh-CN",
      "slug": "devtools-extension",
      "href": "/docs/tutorial/devtools-extension",
      "crowdinFileId": "256195",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/devtools-extension.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"开发者工具扩展\"><a href=\"#开发者工具扩展\">开发者工具扩展</a></h1>\n<p>Electron supports <a href=\"https://developer.chrome.com/extensions/devtools\">Chrome DevTools extensions</a>, which can be used to extend the ability of Chrome's developer tools for debugging popular web frameworks.</p>\n<h2 id=\"使用工具加载-devtools-扩展\"><a href=\"#使用工具加载-devtools-扩展\">使用工具加载 DevTools 扩展</a></h2>\n<p>加载 DevTools 扩展的最简单方法是使用第三方工具，来为您实现自动化过程。 <a href=\"https://github.com/MarshallOfSound/electron-devtools-installer\">electron-devtools-installer</a> 是一个受欢迎的 NPM 包。</p>\n<h2 id=\"手动加载-devtools-扩展\"><a href=\"#手动加载-devtools-扩展\">手动加载 DevTools 扩展</a></h2>\n<p>如果你不想使用工具加载，你也可以手动完成所有必需的操作。 要在 Electron 中加载扩展，您需要在 Chrome 下载它，找到其文件系统路径，然后通过调用[<code>ses.loadExtension</code>] API 将其加载到您的 <a href=\"/docs/api/session\">Session</a> 中。</p>\n<p>下面以<a href=\"https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi\">React Developer Tools</a>为例：</p>\n<ol>\n<li>\n<p>在 Google Chrome 中安装扩展。</p>\n</li>\n<li>\n<p>打开<code>chrome://extensions</code>，找到扩展程序的ID，像 <code>fmkadmapgofadopljbjfkapdkoienihi</code> 一样的 hash 字符串。</p>\n</li>\n<li>\n<p>找到 Chrome 扩展程序的存放目录：</p>\n<ul>\n<li>在Ｗindows 下为 <code>%LOCALAPPDATA%\\Google\\Chrome\\User Data\\Default\\Extensions</code>;</li>\n<li>在 Linux下为：<ul>\n<li><code>~/.config/google-chrome/Default/Extensions/</code></li>\n<li><code>~/.config/google-chrome-beta/Default/Extensions/</code></li>\n<li><code>~/.config/google-chrome-canary/Default/Extensions/</code></li>\n<li><code>~/.config/chromium/Default/Extensions/</code></li>\n</ul></li>\n<li>在 macOS下为<code>~/Library/Application Support/Google/Chrome/Default/Extensions</code>。</li>\n</ul>\n</li>\n<li>\n<p>将扩展的位置传递给 <a href=\"/docs/api/session#sesloadextensionpath-options\"><code>ses.loadExtension</code></a> API。 对于 React Developer Tools <code>v4.9.0</code>, 它看起来像：</p>\n<pre><code class=\"hljs language-javascript\"> <span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n <span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n\n <span class=\"hljs-comment\">// on macOS</span>\n <span class=\"hljs-keyword\">const</span> reactDevToolsPath = path.join(\n   os.homedir(),\n   <span class=\"hljs-string\">'/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/4.9.0_0'</span>\n )\n\n app.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n   <span class=\"hljs-keyword\">await</span> session.defaultSession.loadExtension(reactDevToolsPath)\n })\n</code></pre>\n</li>\n</ol>\n<p><strong>说明：</strong></p>\n<ul>\n<li><code>loadExtension</code> 返回一个包含 <a href=\"/docs/api/structures/extension\">扩展对象</a> 的 Promise，其中包含加载的扩展有关的元数据。 在加载页面前，此 Promise 需要被 resolve（例如使用 <code>await</code> 表达式）。 否则将无法保证扩展被加载。</li>\n<li><code>loadExtension</code> 无法在 <code>app</code> 模块 <code>ready</code> 之前调用，也不能被内存(非持久) 会话调用。</li>\n<li>如果您希望加载扩展，则必须在应用的每次启动时调用<code>loadExtension</code> 。</li>\n</ul>\n<h3 id=\"删除-devtools-扩展\"><a href=\"#删除-devtools-扩展\">删除 DevTools 扩展</a></h3>\n<p>您可以将扩展的 ID 传递给 <a href=\"/docs/api/session#sesremoveextensionextensionid\"><code>ses.removeExtension</code></a> API，以将其从您的 Session 中删除。 每次应用重新启动，扩展不会持续。</p>\n<h2 id=\"devtools-扩展支持\"><a href=\"#devtools-扩展支持\">DevTools 扩展支持</a></h2>\n<p>Electron 仅支持 <a href=\"/docs/api/extensions\">有限的 <code>chrome.*</code> APIs </a>，所以使用不支持的 <code>chrome.*</code> 扩展的 APIs 可能无法工作。</p>\n<p>以下 DevTools 扩展程序已经通过测试，可以在 Electron 中正常工作：</p>\n<ul>\n<li><a href=\"https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi\">Ember Inspector</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi\">React Developer Tools</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/backbone-debugger/bhljhndlimiafopmmhjlgfpnnchjjbhd\">Backbone Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/jquery-debugger/dbhhnnnpaeobfddmlalhnehgclcmjimi\">jQuery Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/angularjs-batarang/ighdmehidhipcmcojjgiloacoafjmpfk\">AngularJS Batarang</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd\">Vue.js devtools</a></li>\n<li><a href=\"https://cerebraljs.com/docs/introduction/devtools.html\">Cerebral Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd\">Redux DevTools Extension</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/mobx-developer-tools/pfgnfdagidkfgccljigdamigbcnndkod\">MobX Developer Tools</a></li>\n</ul>\n<h3 id=\"如果-devtools-扩展不工作，我该怎么办？\"><a href=\"#如果-devtools-扩展不工作，我该怎么办？\">如果 DevTools 扩展不工作，我该怎么办？</a></h3>\n<p>首先，请确保扩展仍在维护中，并与最新版本的 Google Chrome 兼容。 我们不能为不受支持的扩展提供额外支持。</p>\n<p>如果扩展可以在 Chrome 上运行，但不能在 Electron 上运行， 在 Electron 的 <a href=\"https://github.com/electron/electron/issues\">issue Tracker</a> 中提交一个错误，并描述扩展的哪个部分不能按预期工作。</p>",
      "title": "开发者工具扩展",
      "description": ""
    },
    "/docs/api/dialog": {
      "locale": "zh-CN",
      "slug": "dialog",
      "href": "/docs/api/dialog",
      "crowdinFileId": "256309",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/dialog.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dialog\"><a href=\"#dialog\">dialog</a></h1>\n<blockquote>\n<p>显示用于打开和保存文件、警报等的本机系统对话框。</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p>下面是一个选择多个文件的对话框示例：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(dialog.showOpenDialog({ <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'multiSelections'</span>] }))\n</code></pre>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>dialog</code> 模块具有以下方法:</p>\n<h3 id=\"dialogshowopendialogsyncbrowserwindow-options\"><a href=\"#dialogshowopendialogsyncbrowserwindow-options\"><code>dialog.showOpenDialogSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (可选)</li>\n<li><code>选项</code> 对象<ul>\n<li><code>title</code> String (可选) - 对话框窗口的标题</li>\n<li><code>defaultPath</code> String (可选) - 对话框的默认展示路径</li>\n<li><code>buttonLabel</code> String (可选) - 「确认」按钮的自定义标签, 当为空时, 将使用默认标签。</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (可选)</li>\n<li><code>properties</code> String[] (可选) - 包含对话框相关属性。 支持以下属性值:<ul>\n<li><code>openFile</code> - 允许选择文件</li>\n<li><code>openDirectory</code> - 允许选择文件夹</li>\n<li><code>multiSelections</code>-允许多选。</li>\n<li><code>showHiddenFiles</code>-显示对话框中的隐藏文件。</li>\n<li><code>createDirectory</code> <em>macOS</em> -允许你通过对话框的形式创建新的目录。</li>\n<li><code>promptToCreate</code> <em>Windows</em>-如果输入的文件路径在对话框中不存在, 则提示创建。 这并不是真的在路径上创建一个文件，而是允许返回一些不存在的地址交由应用程序去创建。</li>\n<li><code>noResolveAliases</code> <em>macOS</em>-禁用自动的别名路径(符号链接) 解析。 所选别名现在将会返回别名路径而非其目标路径。</li>\n<li><code>treatPackageAsDirectory</code><em> macOS </em>-将包 (如 <code>.app </code> 文件夹) 视为目录而不是文件。</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - 不要将正在打开的项目添加到最近的文档列表中。</li>\n</ul></li>\n<li><code>message</code> String (可选) <em> macOS </em>-显示在输入框上方的消息。</li>\n<li><code>securityScopedBookmarks</code> Boolean (可选) <em>macOS</em> <em>mas</em> - 在打包提交到Mac App Store时创建 <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmarks</a></li>\n</ul></li>\n</ul>\n<p>返回 <code>String[] | undefined</code>, 用户选择的文件路径，如果对话框被取消了 ，则返回<code>undefined</code>。</p>\n<p><code>browserWindow</code> 参数允许该对话框将自身附加到父窗口, 作为父窗口的模态框。</p>\n<p><code>filters</code> 指定一个文件类型数组，用于规定用户可见或可选的特定类型范围。 例如：</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">filters</span>: [\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Images'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'jpg'</span>, <span class=\"hljs-string\">'png'</span>, <span class=\"hljs-string\">'gif'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Movies'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'mkv'</span>, <span class=\"hljs-string\">'avi'</span>, <span class=\"hljs-string\">'mp4'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Custom File Type'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'as'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'All Files'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'*'</span>] }\n  ]\n}\n</code></pre>\n<p><code>extensions</code> 数组应为没有通配符或点的扩展名 (例如, <code>\"png\"</code> 是正确的, 而 <code>\".png\"</code> 和 <code> *. png \"</code> 就是错误的)。 若要显示所有文件, 请使用 <code>\"*\"</code> 通配符 (不支持其他通配符)。</p>\n<p><strong> 注意: </strong>在 Windows 和 Linux 上, 打开对话框不能同时是文件选择器和目录选择器, 因此如果在这些平台上将 <code>properties</code> 设置为<code>[\"openFile\"、\"openDirectory\"]</code>, 则将显示为目录选择器。</p>\n<pre><code class=\"hljs language-js\">dialog.showOpenDialogSync(mainWindow, {\n  <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'openDirectory'</span>]\n})\n</code></pre>\n<h3 id=\"dialogshowopendialogbrowserwindow-options\"><a href=\"#dialogshowopendialogbrowserwindow-options\"><code>dialog.showOpenDialog([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (可选)</li>\n<li><code>选项</code> 对象<ul>\n<li><code>title</code> String (可选) - 对话框窗口的标题</li>\n<li><code>defaultPath</code> String (可选) - 对话框的默认展示路径</li>\n<li><code>buttonLabel</code> String (可选) - 「确认」按钮的自定义标签, 当为空时, 将使用默认标签。</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (可选)</li>\n<li><code>properties</code> String[] (可选) - 包含对话框相关属性。 支持以下属性值:<ul>\n<li><code>openFile</code> - 允许选择文件</li>\n<li><code>openDirectory</code> - 允许选择文件夹</li>\n<li><code>multiSelections</code>-允许多选。</li>\n<li><code>showHiddenFiles</code>-显示对话框中的隐藏文件。</li>\n<li><code>createDirectory</code> <em>macOS</em> -允许你通过对话框的形式创建新的目录。</li>\n<li><code>promptToCreate</code> <em>Windows</em>-如果输入的文件路径在对话框中不存在, 则提示创建。 这并不是真的在路径上创建一个文件，而是允许返回一些不存在的地址交由应用程序去创建。</li>\n<li><code>noResolveAliases</code> <em>macOS</em>-禁用自动的别名路径(符号链接) 解析。 所选别名现在将会返回别名路径而非其目标路径。</li>\n<li><code>treatPackageAsDirectory</code><em> macOS </em>-将包 (如 <code>.app </code> 文件夹) 视为目录而不是文件。</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - 不要将正在打开的项目添加到最近的文档列表中。</li>\n</ul></li>\n<li><code>message</code> String (可选) <em> macOS </em>-显示在输入框上方的消息。</li>\n<li><code>securityScopedBookmarks</code> Boolean (可选) <em>macOS</em> <em>mas</em> - 在打包提交到Mac App Store时创建 <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmarks</a></li>\n</ul></li>\n</ul>\n<p>返回 <code>Promise&#x3C;Object></code> - resolve包含以下内容的object：</p>\n<ul>\n<li><code>canceled</code> Boolean - 对话框是否被取消。</li>\n<li><code>filePaths</code> String[] - 用户选择的文件路径的数组. 如果对话框被取消，这将是一个空的数组。</li>\n<li><code>bookmarks</code> String[] (optional) <em>macOS</em> <em>mas</em> - 一个数组， <code>filePaths</code> 数组，base64编码字符串包含安全范围书签数据。 <code>securityScopedBookmarks</code> 必须启用才能捕获数据。 (返回值见 <a href=\"#bookmarks-array\">这里的表格</a>。)</li>\n</ul>\n<p><code>browserWindow</code> 参数允许该对话框将自身附加到父窗口, 作为父窗口的模态框。</p>\n<p><code>filters</code> 指定一个文件类型数组，用于规定用户可见或可选的特定类型范围。 例如：</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">filters</span>: [\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Images'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'jpg'</span>, <span class=\"hljs-string\">'png'</span>, <span class=\"hljs-string\">'gif'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Movies'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'mkv'</span>, <span class=\"hljs-string\">'avi'</span>, <span class=\"hljs-string\">'mp4'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Custom File Type'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'as'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'All Files'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'*'</span>] }\n  ]\n}\n</code></pre>\n<p><code>extensions</code> 数组应为没有通配符或点的扩展名 (例如, <code>\"png\"</code> 是正确的, 而 <code>\".png\"</code> 和 <code> *. png \"</code> 就是错误的)。 若要显示所有文件, 请使用 <code>\"*\"</code> 通配符 (不支持其他通配符)。</p>\n<p><strong> 注意: </strong>在 Windows 和 Linux 上, 打开对话框不能同时是文件选择器和目录选择器, 因此如果在这些平台上将 <code>properties</code> 设置为<code>[\"openFile\"、\"openDirectory\"]</code>, 则将显示为目录选择器。</p>\n<pre><code class=\"hljs language-js\">dialog.showOpenDialog(mainWindow, {\n  <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'openDirectory'</span>]\n}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">result</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(result.canceled)\n  <span class=\"hljs-built_in\">console</span>.log(result.filePaths)\n}).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(err)\n})\n</code></pre>\n<h3 id=\"dialogshowsavedialogsyncbrowserwindow-options\"><a href=\"#dialogshowsavedialogsyncbrowserwindow-options\"><code>dialog.showSaveDialogSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (可选)</li>\n<li><code>选项</code> 对象<ul>\n<li><code>title</code> String (可选) - 对话框标题。 无法在一些 <em>Linux</em> 桌面环境中显示。</li>\n<li><code>defaultPath</code> String (可选) - 默认情况下使用的绝对目录路径、绝对文件路径或文件名。</li>\n<li><code>buttonLabel</code> String (可选) - 「确认」按钮的自定义标签, 当为空时, 将使用默认标签。</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (可选)</li>\n<li><code>message</code> String (可选) <em> macOS </em>-显示在对话框上的消息。</li>\n<li><code>nameFieldLabel</code> String (可选) <em> macOS </em> - 文件名输入框对应的自定义标签名。</li>\n<li><code>showsTagField</code> Boolean (可选) <em> macOS </em>-显示标记输入框, 默认为 <code>true</code>。</li>\n<li><code>properties</code> String[] (可选)<ul>\n<li><code>showHiddenFiles</code>-显示对话框中的隐藏文件。</li>\n<li><code>createDirectory</code> <em>macOS</em> -允许你通过对话框的形式创建新的目录。</li>\n<li><code>treatPackageAsDirectory</code><em> macOS </em>-将包 (如 <code>.app </code> 文件夹) 视为目录而不是文件。</li>\n<li><code>showOverwriteConfirmation</code> <em>Linux</em> - 设置如果用户输入了已存在的文件名，是否会向用户显示确认对话框。</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - 不要将正在保存的项目添加到最近的文档列表中。</li>\n</ul></li>\n<li><code>securityScopedBookmarks</code> Boolean (可选) <em>macOS</em> <em>mas</em> - 在打包提交到Mac App Store时创建 <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmarks</a> 当该选项被启用且文件尚不存在时，那么在选定的路径下将创建一个空文件。</li>\n</ul></li>\n</ul>\n<p>返回 <code>String | undefined</code>, 用户选择的文件路径，如果对话框被取消了 ，则返回<code>undefined</code>。</p>\n<p><code>browserWindow</code> 参数允许该对话框将自身附加到父窗口, 作为父窗口的模态框。</p>\n<p><code>filters</code> 可以指定可显示文件的数组类型，详见 <code>dialog.showOpenDialog</code> 事例</p>\n<h3 id=\"dialogshowsavedialogbrowserwindow-options\"><a href=\"#dialogshowsavedialogbrowserwindow-options\"><code>dialog.showSaveDialog([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (可选)</li>\n<li><code>选项</code> 对象<ul>\n<li><code>title</code> String (可选) - 对话框标题。 无法在一些 <em>Linux</em> 桌面环境中显示。</li>\n<li><code>defaultPath</code> String (可选) - 默认情况下使用的绝对目录路径、绝对文件路径或文件名。</li>\n<li><code>buttonLabel</code> String (可选) - 「确认」按钮的自定义标签, 当为空时, 将使用默认标签。</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (可选)</li>\n<li><code>message</code> String (可选) <em> macOS </em>-显示在对话框上的消息。</li>\n<li><code>nameFieldLabel</code> String (可选) <em> macOS </em> - 文件名输入框对应的自定义标签名。</li>\n<li><code>showsTagField</code> Boolean (可选) <em>macOS</em> - 显示标签输入框，默认为 <code>true</code>。</li>\n<li><code>properties</code> String[] (可选)<ul>\n<li><code>showHiddenFiles</code>-显示对话框中的隐藏文件。</li>\n<li><code>createDirectory</code> <em>macOS</em> -允许你通过对话框的形式创建新的目录。</li>\n<li><code>treatPackageAsDirectory</code><em> macOS </em>-将包 (如 <code>.app </code> 文件夹) 视为目录而不是文件。</li>\n<li><code>showOverwriteConfirmation</code> <em>Linux</em> - 设置如果用户输入了已存在的文件名，是否会向用户显示确认对话框。</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - 不要将正在保存的项目添加到最近的文档列表中。</li>\n</ul></li>\n<li><code>securityScopedBookmarks</code> Boolean (可选) <em>macOS</em> <em>mas</em> - 在打包提交到Mac App Store时创建 <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmarks</a> 当该选项被启用且文件尚不存在时，那么在选定的路径下将创建一个空文件。</li>\n</ul></li>\n</ul>\n<p>返回 <code>Promise&#x3C;Object></code> - resolve包含以下内容的object：</p>\n<ul>\n<li><code>canceled</code> Boolean - 对话框是否被取消。</li>\n<li><code>filePath</code> String (可选) - 如果对话框被取消，该值为 <code>undefined</code>。</li>\n<li><code>bookmark</code> String(optional) <em>macOS</em> <em>mas</em> - 包含了安全作用域的书签数据 Base64 编码的字符串来保存文件。 <code>securityScopedBookmarks</code> 必须启用才有效。 (返回值见 <a href=\"#bookmarks-array\">这里的表格</a>。)</li>\n</ul>\n<p><code>browserWindow</code> 参数允许该对话框将自身附加到父窗口, 作为父窗口的模态框。</p>\n<p><code>filters</code> 可以指定可显示文件的数组类型，详见 <code>dialog.showOpenDialog</code> 事例</p>\n<p><strong>注意：</strong> 在macOS上，建议使用异步版本，以避免展开和折叠对话框时出现问题。</p>\n<h3 id=\"dialogshowmessageboxsyncbrowserwindow-options\"><a href=\"#dialogshowmessageboxsyncbrowserwindow-options\"><code>dialog.showMessageBoxSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (可选)</li>\n<li><code>选项</code> 对象<ul>\n<li><code>message</code> String - message box 的内容.</li>\n<li><code>type</code> String (可选) - 可以为 <code>\"none\"</code>, <code>\"info\"</code>, <code>\"error\"</code>, <code>\"question\"</code> 或者 <code>\"warning\"</code>. 在 Windows 上, <code>\"question\"</code> 与<code>\"info\"</code>显示相同的图标, 除非你使用了 <code>\"icon\"</code> 选项设置图标。 在 macOS 上, <code>\"warning\"</code> 和 <code>\"error\"</code> 显示相同的警告图标</li>\n<li><code>buttons</code> String[]  (可选) - 按钮文本数组。 在 Windows上，一个空数组将导致按钮被标为“OK”。</li>\n<li><code>defaultId</code> Integer (可选) - 在 message box 对话框打开的时候，设置默认选中的按钮，值为在 buttons 数组中的索引.</li>\n<li><code>title</code> String (可选) - message box 的标题，一些平台不显示.</li>\n<li><code>detail</code> String (可选) - 额外信息.</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (可选)</li>\n<li><code>textWidth</code> Integer (optional) <em>macOS</em> - Custom width of the text in the message box.</li>\n<li><code>cancelId</code> Integer (可选) - 用于取消对话框的按钮的索引，例如 <code>Esc</code> 键. 默认情况下，它被分配给第一个按钮，文字为 “cancel” 或 “no”。 如果不存在这个标签的按钮，同时该选项又未设置，返回值为<code>0</code>。</li>\n<li><code>noLink</code> Boolean (可选) - 在Windows上，应用将尝试找出哪个 <code>buttons</code> 是常用按钮(例如 \"Cancel\" 或 \"Yes\")，然后在对话框中以链接命令的方式展现其它的按钮。 这可以使对话框以现代Windows应用程序的风格显示。 如果你不喜欢这个行为, 你可以设置 <code>noLink</code> 为 <code>true</code>.</li>\n<li><code>normalizeAccessKeys</code> Boolean (可选) -规范跨平台的键盘访问键。 默认值为 <code>false</code>. 用 <code>&#x26;</code> 连接和转换键盘访问键, 以便它们在每个平台上正常工作.<code>&#x26;</code> 字符会在macOS上被删除，在 Linux 上会被转换为 <code>_</code>，在 Windows 上保持不变。 例如 <code>Vie&#x26;w</code> 的按钮标签在 Linux 上会被转换为 <code>Vie_w</code>，在 macOS 转换为 <code>View</code> 并且可以被选择。而Windows和Linux上表示 <code>Alt-W</code> 。</li>\n</ul></li>\n</ul>\n<p>返回 <code>Integer</code> - 点击的按钮的索引。</p>\n<p>显示一个消息框，它将阻塞进程直到消息框关闭。 它返回点击的按钮的索引。</p>\n<p><code>browserWindow</code> 参数允许该对话框将自身附加到父窗口, 作为父窗口的模态框。 如果 <code>浏览器窗口</code> 没有显示，则对话框不会附属于它。 在这种情况想，它将作为一个独立的窗口显示。</p>\n<h3 id=\"dialogshowmessageboxbrowserwindow-options\"><a href=\"#dialogshowmessageboxbrowserwindow-options\"><code>dialog.showMessageBox([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (可选)</li>\n<li><code>选项</code> 对象<ul>\n<li><code>message</code> String - message box 的内容.</li>\n<li><code>type</code> String (可选) - 可以为 <code>\"none\"</code>, <code>\"info\"</code>, <code>\"error\"</code>, <code>\"question\"</code> 或者 <code>\"warning\"</code>. 在 Windows 上, <code>\"question\"</code> 与<code>\"info\"</code>显示相同的图标, 除非你使用了 <code>\"icon\"</code> 选项设置图标。 在 macOS 上, <code>\"warning\"</code> 和 <code>\"error\"</code> 显示相同的警告图标</li>\n<li><code>buttons</code> String[]  (可选) - 按钮文本数组。 在 Windows上，一个空数组将导致按钮被标为“OK”。</li>\n<li><code>defaultId</code> Integer (可选) - 在 message box 对话框打开的时候，设置默认选中的按钮，值为在 buttons 数组中的索引.</li>\n<li><code>signal</code> AbortSignal (optional) - Pass an instance of <a href=\"https://nodejs.org/api/globals.html#globals_class_abortsignal\">AbortSignal</a> to optionally close the message box, the message box will behave as if it was cancelled by the user. On macOS, <code>signal</code> does not work with message boxes that do not have a parent window, since those message boxes run synchronously due to platform limitations.</li>\n<li><code>title</code> String (可选) - message box 的标题，一些平台不显示.</li>\n<li><code>detail</code> String (可选) - 额外信息.</li>\n<li><code>checkboxLabel</code> String (可选) - 如果使用了，消息框将包含带有给定标签的复选框。</li>\n<li><code>checkboxChecked</code> Boolean (可选) - checkbox 的初始值。 默认值为 <code>false</code></li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> (可选)</li>\n<li><code>textWidth</code> Integer (optional) <em>macOS</em> - Custom width of the text in the message box.</li>\n<li><code>cancelId</code> Integer (可选) - 用于取消对话框的按钮的索引，例如 <code>Esc</code> 键. 默认情况下，它被分配给第一个按钮，文字为 “cancel” 或 “no”。 如果不存在这个标签的按钮，同时该选项又未设置，返回值为<code>0</code>。</li>\n<li><code>noLink</code> Boolean (可选) - 在Windows上，应用将尝试找出哪个 <code>buttons</code> 是常用按钮(例如 \"Cancel\" 或 \"Yes\")，然后在对话框中以链接命令的方式展现其它的按钮。 这可以使对话框以现代Windows应用程序的风格显示。 如果你不喜欢这个行为, 你可以设置 <code>noLink</code> 为 <code>true</code>.</li>\n<li><code>normalizeAccessKeys</code> Boolean (可选) -规范跨平台的键盘访问键。 默认值为 <code>false</code>. 用 <code>&#x26;</code> 连接和转换键盘访问键, 以便它们在每个平台上正常工作.<code>&#x26;</code> 字符会在macOS上被删除，在 Linux 上会被转换为 <code>_</code>，在 Windows 上保持不变。 例如 <code>Vie&#x26;w</code> 的按钮标签在 Linux 上会被转换为 <code>Vie_w</code>，在 macOS 转换为 <code>View</code> 并且可以被选择。而Windows和Linux上表示 <code>Alt-W</code> 。</li>\n</ul></li>\n</ul>\n<p>返回 <code>Promise&#x3C;Object></code> - resolve包含以下属性的promise：</p>\n<ul>\n<li><code>response</code> Number - 点击的按钮的索引。</li>\n<li><code>checkboxChecked</code> Boolean - 如果设置了 <code>checkboxLabel</code>，返回复选框是否被选中的状态。 否则，返回 <code>false</code>。</li>\n</ul>\n<p>显示一个消息框</p>\n<p><code>browserWindow</code> 参数允许该对话框将自身附加到父窗口, 作为父窗口的模态框。</p>\n<h3 id=\"dialogshowerrorboxtitle-content\"><a href=\"#dialogshowerrorboxtitle-content\"><code>dialog.showErrorBox(title, content)</code></a></h3>\n<ul>\n<li><code>title</code> String - 显示在错误框中的标题.</li>\n<li><code>content</code> String - 显示在错误框中的文本内容.</li>\n</ul>\n<p>显示一个显示错误消息的模态对话框。</p>\n<p>这个API可以在 <code>app</code> 模块触发 <code>ready</code> 事件之前被安全地调用，它通常用在启动时报告错误。 在 Linux 上, <code>ready</code> 事件之前调用这个API, 消息将被发送到stderr, 并且不会出现GUI对话框。</p>\n<h3 id=\"dialogshowcertificatetrustdialogbrowserwindow-options-macos-windows\"><a href=\"#dialogshowcertificatetrustdialogbrowserwindow-options-macos-windows\"><code>dialog.showCertificateTrustDialog([browserWindow, ]options)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (可选)</li>\n<li><code>选项</code> 对象<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> - 信任/导入的证书</li>\n<li><code>message</code> String - 要向用户显示的消息</li>\n</ul></li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code> - 当显示信任证书对话框时resolve。</p>\n<p>在macOS中, 将弹出一个用于展示消息与证书信息并向用户提供信任/导入证书的选项的模态对话框。 如果提供 <code>browserWindow</code> 参数, 则该对话框将附加到父窗口, 使其成模态框。</p>\n<p>在Windows中, 受限于Win32 API，可选项变得更为有限:</p>\n<ul>\n<li><code>message</code> 参数无效，因为操作系统提供了自身的确认对话框。</li>\n<li><code>browserWindow</code> 参数被忽略，因此无法成为模态对话框。</li>\n</ul>\n<h2 id=\"bookmarks-数组\"><a href=\"#bookmarks-数组\">Bookmarks 数组</a></h2>\n<p><code>showOpenDialog</code>、 <code>showOpenDialogSync</code>、 <code>showSaveDialog</code>和 <code>showSaveDialogSync</code> 将返回一个 <code>bookmarks</code> 数组。</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>构建类型</th><th>securityScopedBookmarks boolean</th><th align=\"center\">返回类型</th><th>返回值</th></tr></thead><tbody><tr><td>macOS mas</td><td>True</td><td align=\"center\">成功</td><td><code>['LONGBOOKMARKSTRING']</code></td></tr><tr><td>macOS mas</td><td>True</td><td align=\"center\">Error</td><td><code>['']</code> (空字符串数组)</td></tr><tr><td>macOS mas</td><td>False</td><td align=\"center\">NA</td><td><code>[]</code> (空数组)</td></tr><tr><td>non mas</td><td>any</td><td align=\"center\">NA</td><td><code>[]</code> (空数组)</td></tr></tbody></table>\n<h2 id=\"工作表\"><a href=\"#工作表\">工作表</a></h2>\n<p>在<a href=\"/docs/api/browser-window\"><code>MaCOS</code></a>中，如果在&#x3C;0>browserWindow&#x3C;/0>的参数中提供&#x3C;0>BrowerWindow&#x3C;/0>这一参数，或者在非&#x3C;0>browserWindow&#x3C;/0>中未提供&#x3C;0>modals&#x3C;/0>参数，则将对附加到&#x3C;0>window&#x3C;/0>中的&#x3C;0>sheet&#x3C;/0>的形式呈现。</p>\n<p>您可以调用 <code>BrowserWindow.getCurrentWindow().setSheetOffset(offset)</code> 来更改附加工作表的窗口框架的偏移量。</p>",
      "title": "dialog",
      "description": "显示用于打开和保存文件、警报等的本机系统对话框。"
    },
    "/docs/api/structures/display": {
      "locale": "zh-CN",
      "slug": "display",
      "href": "/docs/api/structures/display",
      "crowdinFileId": "256427",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/display.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"display-object\"><a href=\"#display-object\">Display Object</a></h1>\n<ul>\n<li><code>id</code> Number - Unique identifier associated with the display.</li>\n<li><code>rotation</code> Number - Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.</li>\n<li><code>scaleFactor</code> Number - Output device's pixel scale factor.</li>\n<li><code>touchSupport</code> String - Can be <code>available</code>, <code>unavailable</code>, <code>unknown</code>.</li>\n<li><code>monochrome</code> Boolean - Whether or not the display is a monochrome display.</li>\n<li><code>accelerometerSupport</code> String - Can be <code>available</code>, <code>unavailable</code>, <code>unknown</code>.</li>\n<li><code>colorSpace</code> String -  represent a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions</li>\n<li><code>colorDepth</code> Number - The number of bits per pixel.</li>\n<li><code>depthPerComponent</code> Number - The number of bits per color component.</li>\n<li><code>displayFrequency</code> Number - The display refresh rate.</li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - the bounds of the display in DIP points.</li>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a></li>\n<li><code>workArea</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - the work area of the display in DIP points.</li>\n<li><code>workAreaSize</code> <a href=\"/docs/api/structures/size\">Size</a></li>\n<li><code>internal</code> Boolean - <code>true</code> for an internal display and <code>false</code> for an external display</li>\n</ul>\n<p>The <code>Display</code> object represents a physical display connected to the system. A fake <code>Display</code> may exist on a headless system, or a <code>Display</code> may correspond to a remote, virtual display.</p>",
      "title": "Display Object",
      "description": ""
    },
    "/docs/api/dock": {
      "locale": "zh-CN",
      "slug": "dock",
      "href": "/docs/api/dock",
      "crowdinFileId": "256311",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/dock.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类-dock\"><a href=\"#类-dock\">类: Dock</a></h2>\n<blockquote>\n<p>在 macOS dock中控制您的应用</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>下面的例子展示了如何在dock上使你的图标弹跳。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.dock.bounce()\n</code></pre>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<h4 id=\"dockbouncetype-macos\"><a href=\"#dockbouncetype-macos\"><code>dock.bounce([type])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>type</code> String (可选) - 可以是 <code>critical</code> 或 <code>informational</code>。 默认值为<code>informational</code></li>\n</ul>\n<p>返回 <code>Integer</code> - 代表请求的 ID。</p>\n<p>当传入的是 <code>critical</code> 时, dock 中的应用将会开始弹跳, 直到这个应用被激活或者这个请求被取消。</p>\n<p>当传递了 <code>informational</code> 时，dock图标将弹跳一秒钟。 然而，该请求仍然有效，直到应用程序激活或请求被取消。</p>\n<p><strong>注意：</strong> 此方法只能在应用未获得焦点时使用；当应用获得焦点，该方法将返回 -1。</p>\n<h4 id=\"dockcancelbounceid-macos\"><a href=\"#dockcancelbounceid-macos\"><code>dock.cancelBounce(id)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>取消这个 <code>id</code> 对应的请求。</p>\n<h4 id=\"dockdownloadfinishedfilepath-macos\"><a href=\"#dockdownloadfinishedfilepath-macos\"><code>dock.downloadFinished(filePath)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n</ul>\n<p>如果 filePath 位于 Downloads 文件夹中，则弹出下载队列。</p>\n<h4 id=\"docksetbadgetext-macos\"><a href=\"#docksetbadgetext-macos\"><code>dock.setBadge(text)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>设置应用在 dock 中显示的字符串。</p>\n<h4 id=\"dockgetbadge-macos\"><a href=\"#dockgetbadge-macos\"><code>dock.getBadge()</code> <em>macOS</em></a></h4>\n<p>返回 <code>String</code> - 应用在 dock 中显示的字符串。</p>\n<h4 id=\"dockhide-macos\"><a href=\"#dockhide-macos\"><code>dock.hide()</code> <em>macOS</em></a></h4>\n<p>隐藏 dock 中的图标。</p>\n<h4 id=\"dockshow-macos\"><a href=\"#dockshow-macos\"><code>dock.show()</code> <em>macOS</em></a></h4>\n<p>返回 <code>Promise&#x3C;void></code> - 当dock图标显示时resolve。</p>\n<h4 id=\"dockisvisible-macos\"><a href=\"#dockisvisible-macos\"><code>dock.isVisible()</code> <em>macOS</em></a></h4>\n<p>返回 <code>Boolean</code> - dock图标是否可见.</p>\n<h4 id=\"docksetmenumenu-macos\"><a href=\"#docksetmenumenu-macos\"><code>dock.setMenu(menu)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>menu</code> <a href=\"/docs/api/menu\">Menu</a></li>\n</ul>\n<p>设置应用程序的 [dock 菜单][dock-menu]。</p>\n<h4 id=\"dockgetmenu-macos\"><a href=\"#dockgetmenu-macos\"><code>dock.getMenu()</code> <em>macOS</em></a></h4>\n<p>返回 <code>Menu | null</code> - 应用程序的[dock 菜单][dock-menu]。</p>\n<h4 id=\"dockseticonimage-macos\"><a href=\"#dockseticonimage-macos\"><code>dock.setIcon(image)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>设置<code>image</code>作为应用在 dock 中显示的图标</p>",
      "title": "类: Dock",
      "description": "在 macOS dock中控制您的应用"
    },
    "/docs/api/download-item": {
      "locale": "zh-CN",
      "slug": "download-item",
      "href": "/docs/api/download-item",
      "crowdinFileId": "256313",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/download-item.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类：downloaditem\"><a href=\"#类：downloaditem\">类：downloadItem</a></h2>\n<blockquote>\n<p>控制来自于远程资源的文件下载。</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>DownloadItem</code> 是一个 <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a> 事件触发器，在Electron中代表一个下载项。 它用于<code>will-download</code>事件以及<code>Session</code>类，并且允许用户控制下载项目。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// 在主进程中.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.session.on(<span class=\"hljs-string\">'will-download'</span>, (event, item, webContents) => {\n  <span class=\"hljs-comment\">// 无需对话框提示， 直接将文件保存到路径</span>\n  item.setSavePath(<span class=\"hljs-string\">'/tmp/save.pdf'</span>)\n\n  item.on(<span class=\"hljs-string\">'updated'</span>, (event, state) => {\n    <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'interrupted'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download is interrupted but can be resumed'</span>)\n    } <span class=\"hljs-keyword\">else</span> <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'progressing'</span>) {\n      <span class=\"hljs-keyword\">if</span> (item.isPaused()) {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download is paused'</span>)\n      } <span class=\"hljs-keyword\">else</span> {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Received bytes: <span class=\"hljs-subst\">${item.getReceivedBytes()}</span>`</span>)\n      }\n    }\n  })\n  item.once(<span class=\"hljs-string\">'done'</span>, (event, state) => {\n    <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'completed'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download successfully'</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Download failed: <span class=\"hljs-subst\">${state}</span>`</span>)\n    }\n  })\n})\n</code></pre>\n<h3 id=\"实例事件\"><a href=\"#实例事件\">实例事件</a></h3>\n<h4 id=\"事件名-updated\"><a href=\"#事件名-updated\">事件名: 'updated'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>state</code> String - 可以是 <code>progressing</code> 或 <code>interrupted</code>.</li>\n</ul>\n<p>当下载正在执行但还没完成的时候发出。</p>\n<p>状态可以是以下之一：</p>\n<ul>\n<li><code>progressing</code> - 下载正在进行中</li>\n<li><code>interrupted</code> - 下载已经中断，可以恢复</li>\n</ul>\n<h4 id=\"事件名-done\"><a href=\"#事件名-done\">事件名: 'done'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>state</code> String - 可以是 <code>completed</code>, <code>cancelled</code> 或 <code>interrupted</code>.</li>\n</ul>\n<p>当下载处于终止态时触发。 包括下载完成，取消下载 (通过 <code>downloadItem.cancel()</code>)，以及无法恢复的中断下载。</p>\n<p>状态可以是以下之一：</p>\n<ul>\n<li><code>completed</code> - 下载成功完成</li>\n<li><code>cancelled</code> - 下载已被取消</li>\n<li><code>interrupted</code> - 下载已经中断，无法恢复</li>\n</ul>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<p><code>downloadItem</code> 对象具有以下方法：</p>\n<h4 id=\"downloaditemsetsavepathpath\"><a href=\"#downloaditemsetsavepathpath\"><code>downloadItem.setSavePath(path)</code></a></h4>\n<ul>\n<li><code>path</code> String - 设置下载项目的保存文件路径。</li>\n</ul>\n<p>该API仅能在<code>will-download</code> 方法的回调中使用。 如果 <code>path</code> 不存在，Electron 将尝试递归创建目录。 如果用户没有通过这个API设置保存路径，Electron 将使用默认方式决定保存路径；通常弹出保存对话框。</p>\n<h4 id=\"downloaditemgetsavepath\"><a href=\"#downloaditemgetsavepath\"><code>downloadItem.getSavePath()</code></a></h4>\n<p>返回<code>String</code> - 下载项的保存路径。 该值为通过 <code>downloadItem.setSavePath(path)</code> 设置的路径或通过显示的保存对话框选择的路径。</p>\n<h4 id=\"downloaditemsetsavedialogoptionsoptions\"><a href=\"#downloaditemsetsavedialogoptionsoptions\"><code>downloadItem.setSaveDialogOptions(options)</code></a></h4>\n<ul>\n<li><code>options</code> SaveDialogOptions - 设置保存文件对话框选项。 这个对象与 <a href=\"/docs/api/dialog\"><code>dialog.showSaveDialog()</code></a> 的 <code>options</code> 参数有相同属性。</li>\n</ul>\n<p>此 API 允许用户为下载项默认打开的保存对话框设置自定义选项。 该API仅能在<code>will-download</code> 方法的回调中使用。</p>\n<h4 id=\"downloaditemgetsavedialogoptions\"><a href=\"#downloaditemgetsavedialogoptions\"><code>downloadItem.getSaveDialogOptions()</code></a></h4>\n<p>返回 <code>SaveDialogOptions</code> - 返回之前通过 <code>downloadItem.setSaveDialogOptions(options)</code> 设置的对象。</p>\n<h4 id=\"downloaditempause\"><a href=\"#downloaditempause\"><code>downloadItem.pause()</code></a></h4>\n<p>暂停下载。</p>\n<h4 id=\"downloaditemispaused\"><a href=\"#downloaditemispaused\"><code>downloadItem.isPaused()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the download is paused.</p>\n<h4 id=\"downloaditemresume\"><a href=\"#downloaditemresume\"><code>downloadItem.resume()</code></a></h4>\n<p>Resumes the download that has been paused.</p>\n<p><strong>注意：</strong> 为了支持断点续传，必须要从支持范围请求的服务器下载，并且提供<code>Last-Modified</code> 和 <code>ETag</code>的头部值。 否则，<code>resume()</code> 将关闭以前接收到的字节并从头开始重新开始下载。</p>\n<h4 id=\"downloaditemcanresume\"><a href=\"#downloaditemcanresume\"><code>downloadItem.canResume()</code></a></h4>\n<p>返回<code>Boolean</code> - 下载是否可以恢复。</p>\n<h4 id=\"downloaditemcancel\"><a href=\"#downloaditemcancel\"><code>downloadItem.cancel()</code></a></h4>\n<p>取消下载操作。</p>\n<h4 id=\"downloaditemgeturl\"><a href=\"#downloaditemgeturl\"><code>downloadItem.getURL()</code></a></h4>\n<p>返回<code>String</code> - 下载项的源URL。</p>\n<h4 id=\"downloaditemgetmimetype\"><a href=\"#downloaditemgetmimetype\"><code>downloadItem.getMimeType()</code></a></h4>\n<p>返回<code>String</code> - MIME类型的文件。</p>\n<h4 id=\"downloaditemhasusergesture\"><a href=\"#downloaditemhasusergesture\"><code>downloadItem.hasUserGesture()</code></a></h4>\n<p>返回<code>Boolean</code>  - 下载是否具有用户手势。</p>\n<h4 id=\"downloaditemgetfilename\"><a href=\"#downloaditemgetfilename\"><code>downloadItem.getFilename()</code></a></h4>\n<p>返回<code>String</code> - 下载项目的文件名。</p>\n<p><strong>注意：</strong> 文件名并不总是和实际保存到本地磁盘中的文件名相同。 如果用户在提示的下载保存对话框中更改文件名称，保存的文件的实际名称将会不同。</p>\n<h4 id=\"downloaditemgettotalbytes\"><a href=\"#downloaditemgettotalbytes\"><code>downloadItem.getTotalBytes()</code></a></h4>\n<p>返回<code>Integer</code>  - 下载项目的总大小（以字节为单位）。</p>\n<p>如果大小未知，则返回0。</p>\n<h4 id=\"downloaditemgetreceivedbytes\"><a href=\"#downloaditemgetreceivedbytes\"><code>downloadItem.getReceivedBytes()</code></a></h4>\n<p>返回<code>Integer</code> - 下载项目的接收字节。</p>\n<h4 id=\"downloaditemgetcontentdisposition\"><a href=\"#downloaditemgetcontentdisposition\"><code>downloadItem.getContentDisposition()</code></a></h4>\n<p>返回<code>String</code>  - 响应头中的Content-Disposition字段。</p>\n<h4 id=\"downloaditemgetstate\"><a href=\"#downloaditemgetstate\"><code>downloadItem.getState()</code></a></h4>\n<p>返回 <code>String</code> - 当前状态。 可以是 <code>progressing</code>、 <code>completed</code>、 <code>cancelled</code> 或 <code>interrupted</code>。</p>\n<p><strong>注意：</strong> 以下方法尤其对于当会话重启后恢复 <code>取消了的</code> 项目非常有用。</p>\n<h4 id=\"downloaditemgeturlchain\"><a href=\"#downloaditemgeturlchain\"><code>downloadItem.getURLChain()</code></a></h4>\n<p>返回 <code>String[]</code> - 项目的完整URL链，包括任何重定向。</p>\n<h4 id=\"downloaditemgetlastmodifiedtime\"><a href=\"#downloaditemgetlastmodifiedtime\"><code>downloadItem.getLastModifiedTime()</code></a></h4>\n<p>返回String - Last-Modified的值。</p>\n<h4 id=\"downloaditemgetetag\"><a href=\"#downloaditemgetetag\"><code>downloadItem.getETag()</code></a></h4>\n<p>返回String - ETag的值。</p>\n<h4 id=\"downloaditemgetstarttime\"><a href=\"#downloaditemgetstarttime\"><code>downloadItem.getStartTime()</code></a></h4>\n<p>返回<code>Double</code>  - 自下载开始时的UNIX纪元以来的秒数。</p>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<h4 id=\"downloaditemsavepath\"><a href=\"#downloaditemsavepath\"><code>downloadItem.savePath</code></a></h4>\n<p>一个 <code>String</code> 属性，决定了下载项的保存文件路径。</p>\n<p>该属性仅在会话的 <code>will-download</code> 回调函数中可用。 如果用户未通过属性设置保存路径，Electron将使用默认方式决定保存路径；通常为弹出保存对话框。</p>",
      "title": "类：downloadItem",
      "description": "控制来自于远程资源的文件下载。"
    },
    "/docs/tutorial/electron-timelines": {
      "locale": "zh-CN",
      "slug": "electron-timelines",
      "href": "/docs/tutorial/electron-timelines",
      "crowdinFileId": "256197",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/electron-timelines.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-发布时间线\"><a href=\"#electron-发布时间线\">Electron 发布时间线</a></h1>\n<p>Special notes:</p>\n<ul>\n<li><code>-beta.1</code>和<code>稳定版</code>日期是我们的具体的发布日期。</li>\n<li>这些是我们排定的测试版发布日程，但我们往往比预定的发布更多测试版本。</li>\n<li>我们致力于在这些日期发布版本，但可能因为诸如安全漏洞之类的理由调整这些排定的最后期限。</li>\n<li>查看 <a href=\"https://electronjs.org/blog/electron-5-0-timeline\"> 5.0.0 版本时间线博客文章</a> 以了解我们有关发布日期的信息。</li>\n<li>从 Electron 6.0 以来，我们一直在针对每一个版本的 Chromium ，并且在同一天与 Chrome 稳定版一样放出我们的稳定版本。 您可以在<a href=\"https://chromiumdash.appspot.com/schedule\">这里</a>参考 Chromium 的发布计划。 See <a href=\"https://www.electronjs.org/blog/12-week-cadence\">Electron's new release cadence blog post</a> for more details on our release schedule.</li>\n<li>Electron 15.0 only will include a special Alpha release. Starting in Electron 16.0, we will release on an 8-week cadence. See <a href=\"https://www.electronjs.org/blog/8-week-cadence\">Electron's new 8-week cadence blog post</a> for more details.</li>\n</ul>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Electron</th><th>Alpha</th><th>测试版</th><th>Stable</th><th>Chrome</th><th>Node</th></tr></thead><tbody><tr><td>2.0.0</td><td>--</td><td>2018-Feb-21</td><td>2018-May-01</td><td>M61</td><td>v8.9</td></tr><tr><td>3.0.0</td><td>--</td><td>2018-Jun-21</td><td>2018-Sep-18</td><td>M66</td><td>v10.2</td></tr><tr><td>4.0.0</td><td>--</td><td>2018-Oct-11</td><td>2018-Dec-20</td><td>M69</td><td>v10.11</td></tr><tr><td>5.0.0</td><td>--</td><td>2019-Jan-22</td><td>2019-Apr-24</td><td>M73</td><td>v12.0</td></tr><tr><td>6.0.0</td><td>--</td><td>2019-May-01</td><td>2019-Jul-30</td><td>M76</td><td>v12.4</td></tr><tr><td>7.0.0</td><td>--</td><td>2019-Aug-01</td><td>2019-Oct-22</td><td>M78</td><td>v12.8</td></tr><tr><td>8.0.0</td><td>--</td><td>2019-Oct-24</td><td>2020-Feb-04</td><td>M80</td><td>v12.13</td></tr><tr><td>9.0.0</td><td>--</td><td>2020-Feb-06</td><td>2020-May-19</td><td>M83</td><td>v12.14</td></tr><tr><td>10.0.0</td><td>--</td><td>2020-May-21</td><td>2020-Aug-25</td><td>M85</td><td>v12.16</td></tr><tr><td>11.0.0</td><td>--</td><td>2020-Aug-27</td><td>2020-Nov-17</td><td>M87</td><td>v12.18</td></tr><tr><td>12.0.0</td><td>--</td><td>2020-Nov-19</td><td>2021-Mar-02</td><td>M89</td><td>v14.16</td></tr><tr><td>13.0.0</td><td>--</td><td>2021-Mar-04</td><td>2021-May-25</td><td>M91</td><td>v14.16</td></tr><tr><td>14.0.0</td><td>--</td><td>2021-May-27</td><td>2021-Aug-31</td><td>M93</td><td>v14.17</td></tr><tr><td>15.0.0</td><td>2021-Jul-20</td><td>2021-Sep-01</td><td>2021-Sep-21</td><td>M94</td><td>v16.5</td></tr><tr><td>16.0.0</td><td>--</td><td>2021-Sep-23</td><td>2021-Nov-16</td><td>M96</td><td>待定</td></tr></tbody></table>",
      "title": "Electron 发布时间线",
      "description": ""
    },
    "/docs/tutorial/electron-versioning": {
      "locale": "zh-CN",
      "slug": "electron-versioning",
      "href": "/docs/tutorial/electron-versioning",
      "crowdinFileId": "256199",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/electron-versioning.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-版本管理\"><a href=\"#electron-版本管理\">Electron 版本管理</a></h1>\n<blockquote>\n<p>详细查看我们的版本控制策略和实现。</p>\n</blockquote>\n<p>自 2.0.0 版本起，Electron 遵循 <a href=\"#semver\">SemVer</a>。 以下命令将安装最新稳定版的 Electron：</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron\n</code></pre>\n<p>现有项目更新到最新的稳定版本:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron@latest\n</code></pre>\n<h2 id=\"版本1x\"><a href=\"#版本1x\">版本1.x</a></h2>\n<p><em>小于 2.0 </em> 的 Electron 版本编号并不遵循 <a href=\"https://semver.org\">SemVer</a> 规范: major 版本对应最终用户 API 的变更, minor 版本更新对应 Chromium 的主版本更新, patch 版本更新会带来新功能和 bug 修复。 虽然方便开发人员合并功能，但却为面向客户端应用程序的开发人员带来了麻烦。 像Slack，Stride，Teams，Skype，VS Code，Atom和Desktop等主要应用程序的QA测试周期可能很长，稳定性是一个非常理想的结果。 尝试吸收错误修复时，采用新功能的风险很高。</p>\n<p>以下是 1.x 策略的一个例子：</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-0.png\" alt=\"1.x 版本\"></p>\n<p>使用 <code>1.8.1</code>开发的应用程序无法吸收 <code>1.8.2 </code> 的功能，或者通过反向移植修复和维护新的发行版，无法采用 <code>1.8.3</code>错误修复。</p>\n<h2 id=\"版本-20-和之后版本\"><a href=\"#版本-20-和之后版本\">版本 2.0 和之后版本</a></h2>\n<p>There are several major changes from our 1.x strategy outlined below. Each change is intended to satisfy the needs and priorities of developers/maintainers and app developers.</p>\n<ol>\n<li>严格使用 SemVer</li>\n<li>引入符合 semver 的 <code>-beta</code> 标签</li>\n<li>引入<a href=\"https://conventionalcommits.org/\">常规提交消息</a></li>\n<li>明确定义的稳定分支</li>\n<li><code>master</code>分支没有版本信息，只有稳定分支会包含版本信息。</li>\n</ol>\n<p>我们将详细介绍 git 分支是如何工作的，npm 标记是如何工作的，开发人员应该看到什么，以及如何能够支持更改。</p>\n<h1 id=\"semver\"><a href=\"#semver\">SemVer</a></h1>\n<p>从 2.0 开始，Electron 将遵循 SemVer。</p>\n<p>下面是一个表格，明确地将变化的类型映射到它们对应的 SemVer 类别 (例如Major，Minor，Patch)。</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Major 版本增量</th><th>Minor 版本增量</th><th>Patch 版本增量</th></tr></thead><tbody><tr><td>Electron 突破性 API 变更</td><td>Electron 无突破性 API 变更</td><td>Electron bug fixes</td></tr><tr><td>Node.js 重大版本更新</td><td>Node.js 次要版本更新</td><td>Node.js patch 版本更新</td></tr><tr><td>Chromium 版本更新</td><td></td><td>修复相关的 chromium 补丁</td></tr></tbody></table>\n<p>请注意，大多数 Chromium 更新都将被认为是破坏性的。 Fixes that can be backported will likely be cherry-picked as patches.</p>\n<h1 id=\"稳定分支\"><a href=\"#稳定分支\">稳定分支</a></h1>\n<p>稳定分支是与主控并行运行的分支，仅接受与安全性或稳定性有关的最优提交。 这些分支永远不会合并回 master 分支.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-1.png\" alt=\"稳定分支\"></p>\n<p>自 Electron 8 以来，稳定分支始终为 <strong>marjar</strong> 版本，并且根据以下模板 <code>$MAJOR-x-y</code> 例如： <code>8-x-y</code>。  在此之前，我们使用 <strong>minor</strong> 版本行，并将它们命名为 <code>$MAJOR-$MINOR-x</code> 例如： <code>2-0-x</code></p>\n<p>我们允许同时存在多个稳定分支，并且打算在任何时候至少支持两个并行支持安全修复。 <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-2.png\" alt=\"多个稳定分支\"></p>\n<p>GitHub不支持旧线路，但是其他分组可以自行获取所有权和返回稳定性和安全修复。 我们不鼓励这样做，但是认识到它使得许多应用程序开发人员的生活更轻松。</p>\n<h1 id=\"测试版和bug修复\"><a href=\"#测试版和bug修复\">测试版和Bug修复</a></h1>\n<p>开发人员想知道哪个版本可以 <em>安全</em> 使用。 即使是简单的功能也会使应用程序变得复杂。 同时，锁定到一个固定的版本是很危险的，因为你忽略了自你的版本以来可能出现的安全补丁和错误修复。 我们的目标是在 <code>package.json </code> 中允许以下标准的 semver 范围:</p>\n<ul>\n<li>使用 <code>~ 2.0. 0</code> 只接受您的 <code>2.0.0</code> 版本的稳定性或安全性相关的修复程序。</li>\n<li>使用 <code>^ 2.0. 0</code> 可允许不破坏性的 <em> 合理稳定 </em> 功能以及安全性和 bug 修复。</li>\n</ul>\n<p>第二点重要的是使用 <code>^</code> 的应用程序仍然能够期望合理的稳定性水平。 为了达到这个目的，SemVer允许使用一个 <em>pre-release 标识</em> 来表示一个特定的版本还不够 <em>安全</em> 或 <em>稳定</em>。</p>\n<p>无论你选择什么，你将定期不得不在 <code>package.json</code> 中打破版本，因为突破性变更是 Chromium 的一个常态。</p>\n<p>过程如下:</p>\n<ol>\n<li>All new major and minor releases lines begin with a beta series indicated by SemVer prerelease tags of <code>beta.N</code>, e.g. <code>2.0.0-beta.1</code>. After the first beta, subsequent beta releases must meet all of the following conditions:<ol>\n<li>更改是落后的 API 兼容 (允许废弃)</li>\n<li>实现我们稳定的时间表的危险必须是低的。</li>\n</ol></li>\n<li>如果允许更改需要在释放测试版之后进行，则使用并增加预放标签，例如<code>2.0.0-beta.2</code>。</li>\n<li>如果特定的beta版本<em>通常被认为</em>是稳定的，那么它将作为稳定版本被重新发布，只改变版本信息。例如.0。 例如 <code>2.0.0-beta.1</code>. 在第一个稳定之后，所有的变化都必须落后兼容的 bug 或安全修复。</li>\n<li>如果未来错误修复或安全补丁一旦发布稳定，它们将被应用，并且 <em>补丁</em> 版本被增量 ，例如 <code>2.0.1</code>。</li>\n</ol>\n<p>特别地，上述步骤意味着：</p>\n<ol>\n<li>在测试周期的第 3 周前允许非破坏性的 API 更改，即使这些变化有可能造成适度的副影响。</li>\n<li>Admitting feature-flagged changes, that do not otherwise alter existing code paths, at most points in the beta cycle is okay. Users can explicitly enable those flags in their apps.</li>\n<li>Admitting features of any sort after Week 3 in the beta cycle is 👎 without a very good reason.</li>\n</ol>\n<p>对于每个主要和次要的颠覆，你都应该像以下示例一样进行操作：</p>\n<pre><code class=\"hljs language-plaintext\">2.0.0-beta.1\n2.0.0-beta.2\n2.0.0-beta.3\n2.0.0\n2.0.1\n2.0.2\n</code></pre>\n<p>图片中的生命周期示例:</p>\n<ul>\n<li>A new release branch is created that includes the latest set of features. 它会被发布为 <code>2.0.0-beta.1</code>。 <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-3.png\" alt=\"新发行版\"></li>\n<li>A bug fix comes into master that can be backported to the release branch. The patch is applied, and a new beta is published as <code>2.0.0-beta.2</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-4.png\" alt=\"修复的 bug 移植至测试版\"></li>\n<li>测试版被认为是 <em> 一般稳定 </em> 的, 它在 <code>2.0.0</code> 下作为非 beta 版本再次被发布。 <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-5.png\" alt=\"测试版至稳定版\"></li>\n<li>之后有个 0day 漏洞被发现，然后对 master 采取了修复措施。 We backport the fix to the <code>2-0-x</code> line and release <code>2.0.1</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-6.png\" alt=\"安全移植\"></li>\n</ul>\n<p>几个不同的 SemVer 范围将如何接收新版本的示例:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-7.png\" alt=\"Semvers 和发行版\"></p>\n<h1 id=\"缺失的特性-alpha版本\"><a href=\"#缺失的特性-alpha版本\">缺失的特性: alpha版本</a></h1>\n<p>我们的战略有几次权衡，我们现在认为这是适当的。 最重要的是, 新的主分支特性可能需要一段时间才能作为稳定版发布。 如果你想立即尝试一个新的特性, 你必须自己编译Electron 。</p>\n<p>作为未来的考虑, 我们可以介绍以下一种或两种情况:</p>\n<ul>\n<li>具有松散稳定性限制的 alpha 释放版; 例如, 当稳定通道在 <em> alpha </em> 中时, 允许接纳新特性</li>\n</ul>\n<h1 id=\"功能标志\"><a href=\"#功能标志\">功能标志</a></h1>\n<p>功能标志是 Chromium 的一种常见的做法, 在网络开发生态系统中得到了很好的确立。 在 Electron 环境中, 功能标志或 <strong> 软分支 </strong> 必须具有以下属性:</p>\n<ul>\n<li>是在运行时或生成时启用/禁用的。我们不支持请求作用域功能标志的概念</li>\n<li>它完全细分新的和旧的代码路径; 重构旧代码以允许新功能 <em> 违反 </em> 功能标志内容</li>\n<li>在合并功能后, 功能标志最终将被删除</li>\n</ul>\n<h1 id=\"提交语义\"><a href=\"#提交语义\">提交语义</a></h1>\n<p>我们力求在更新和发布过程的各个层面提高清晰度。 从 <code>2.0.0</code> 开始, 我们将要求遵循 <a href=\"https://conventionalcommits.org/\"> 常规提交 </a> 规范的拉请求, 可以概括如下:</p>\n<ul>\n<li>\n<p>会导致 SemVer <strong>major</strong> 版本改变的提交必须以<code>BREAKING CHANGE:</code>开头。</p>\n</li>\n<li>\n<p>会导致 SemVer <strong>minor</strong> 版本改变的提交必须以 <code>feat:</code> 开头。</p>\n</li>\n<li>\n<p>会导致 SemVer <strong> patch </strong> 版本改变的提交必须以 <code> fix:</code> 开头。</p>\n</li>\n<li>\n<p>我们允许合并提交，只要合并提交的消息符合上述消息格式。</p>\n</li>\n<li>\n<p>只要pull request里包含有意义的总结性的版本语义消息，即使它其中的某些提交消息不包含版本语义前缀也是可以接受的</p>\n</li>\n</ul>\n<h1 id=\"打了版本的-主分支\"><a href=\"#打了版本的-主分支\">打了版本的 <code>主分支</code></a></h1>\n<ul>\n<li>The <code>master</code> 分支将始终在其 <code>package.json</code> 中包含 <code>0.0.0-dev</code>.</li>\n<li>Release 分支永远不会合并回 master 分支</li>\n<li>发布分支 <em>在</em> 其<code>package.json </code> 中包含正确的版本</li>\n<li>As soon as a release branch is cut for a major, master must be bumped to the next major.  I.e. <code>master</code> is always versioned as the next theoretical release branch</li>\n</ul>",
      "title": "Electron 版本管理",
      "description": "详细查看我们的版本控制策略和实现。"
    },
    "/docs/development/electron-vs-nwjs": {
      "locale": "zh-CN",
      "slug": "electron-vs-nwjs",
      "href": "/docs/development/electron-vs-nwjs",
      "crowdinFileId": "256155",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/electron-vs-nwjs.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"electron-和-nwjs-之间的技术差异-类似于nwjs，electron提供了一个使用web技术开发桌面应用程序的平台。它们都可以让开发者很便利地使用html、javascript以及nodejs进行开发。表面上，它们俩非常相似。、-然而，两个项目间依旧存在着一些本质的差异，这使得electron是一个完全独立且不同于nwjs的项目。-1）应用程序的入口-nwjs中，应用程序的主入口是一个html网页。nwjs将会使用一个浏览器窗口打开给定的入口点（html网页）。-在electron中，入口点是一个javascript脚本文件。我们需要通过javascript代码手动创建一个浏览器窗口并加载一个html文件，而不是直接提供一个url的方法。当然我们也可以去监听窗口的事件来决定什么时候退出应用程序。-electron的工作机制更像是nodejs的运行时。而且electron的api实际上更为底层，所以我们可以使用它进行相应的浏览器测试并替代phantomjs。-2）node集成-在nwjs中，在web页面中集成node需要通过给chromium打补丁的方式才能运行。而electron采取了通过在集成libuv-loop不同的操作系统平台（windows、linux、macos）的消息循环来避免魔改chromium。-3）javascript上下文\"><a href=\"#electron-和-nwjs-之间的技术差异-类似于nwjs，electron提供了一个使用web技术开发桌面应用程序的平台。它们都可以让开发者很便利地使用html、javascript以及nodejs进行开发。表面上，它们俩非常相似。、-然而，两个项目间依旧存在着一些本质的差异，这使得electron是一个完全独立且不同于nwjs的项目。-1）应用程序的入口-nwjs中，应用程序的主入口是一个html网页。nwjs将会使用一个浏览器窗口打开给定的入口点（html网页）。-在electron中，入口点是一个javascript脚本文件。我们需要通过javascript代码手动创建一个浏览器窗口并加载一个html文件，而不是直接提供一个url的方法。当然我们也可以去监听窗口的事件来决定什么时候退出应用程序。-electron的工作机制更像是nodejs的运行时。而且electron的api实际上更为底层，所以我们可以使用它进行相应的浏览器测试并替代phantomjs。-2）node集成-在nwjs中，在web页面中集成node需要通过给chromium打补丁的方式才能运行。而electron采取了通过在集成libuv-loop不同的操作系统平台（windows、linux、macos）的消息循环来避免魔改chromium。-3）javascript上下文\">Electron 和 NW.js 之间的技术差异 类似于NW.js，Electron提供了一个使用Web技术开发桌面应用程序的平台。它们都可以让开发者很便利地使用HTML、JavaScript以及Node.js进行开发。表面上，它们俩非常相似。、 然而，两个项目间依旧存在着一些本质的差异，这使得Electron是一个完全独立且不同于NW.js的项目。 1）应用程序的入口 NW.js中，应用程序的主入口是一个HTML网页。NW.js将会使用一个浏览器窗口打开给定的入口点（HTML网页）。 在Electron中，入口点是一个Javascript脚本文件。我们需要通过Javascript代码手动创建一个浏览器窗口并加载一个HTML文件，而不是直接提供一个URL的方法。当然我们也可以去监听窗口的事件来决定什么时候退出应用程序。 Electron的工作机制更像是Node.js的运行时。而且Electron的API实际上更为底层，所以我们可以使用它进行相应的浏览器测试并替代PhantomJS。 2）Node集成 在NW.js中，在Web页面中集成Node需要通过给Chromium打补丁的方式才能运行。而Electron采取了通过在集成libuv loop——不同的操作系统平台（Windows、Linux、MacOS）的消息循环来避免魔改Chromium。 3）Javascript上下文</a></h1>\n<p>类似于 NW.js，Electron 提供了一个使用 Web 技术开发桌面应用程序的平台。 两个平台都允许开发者使用 HTML、JavaScript 和 Node.js。 表面上，它们似乎非常相似。</p>\n<p>但是这两个项目也有本质上的区别，使得 Electron 和 NW.js 成为两个相互独立的产品。</p>\n<h2 id=\"1-应用程序的入口\"><a href=\"#1-应用程序的入口\">1) 应用程序的入口</a></h2>\n<p>在 NW.js 中，应用程序的主入口是一个 HTML 网页。 在这种情况下，NW.js 得在浏览器窗口中打开给定的入口点。</p>\n<p>在 Electron 中，入口点是一个 JavaScript 脚本。 我们需要通过 Javascript 代码手动创建一个浏览器窗口并加载一个 HTML 文件，而不是直接提供一个 URL 的方法。 你还可以监听窗口事件，决定何时让应用退出。</p>\n<p>Electron 的工作方式更像 Node.js 运行时。 而且 Electron 的 API 实际上更为底层，所以我们可以使用它进行相应的浏览器测试并替代 PhantomJS。</p>\n<h2 id=\"2-node-集成\"><a href=\"#2-node-集成\">2) Node 集成</a></h2>\n<p>在 NW.js 中，网页中的 Node 集成需要通过给 Chromium 打补丁来实现。但在 Electron 中，我们选择了另一种方式：通过各个平台的消息循环与 libuv 的循环集成，避免了直接在 Chromium 上做改动。 你可以查看 <a href=\"https://github.com/electron/electron/tree/main/lib/common\"><code>node_bindings</code></a> 来了解这是如何完成的。</p>\n<h2 id=\"3-javascript-上下文\"><a href=\"#3-javascript-上下文\">3) Javascript 上下文</a></h2>\n<p>如果你是一个经验丰富的 NW.js 用户，你应该熟悉节点上下文和网页上下文的概念。 这些概念是由于 NW.js 的实现方式而发明的。</p>\n<p>通过使用 Node 的 <a href=\"https://github.com/nodejs/node-v0.x-archive/commit/756b622\">multi-context</a>（多上下文）特性，Electron 不需要在网页中引入新的 Javascript 上下文。</p>\n<p>注意：从 0.13 开始，NW.js 也支持使用多上下文。</p>\n<h2 id=\"4-旧版支持\"><a href=\"#4-旧版支持\">4) 旧版支持</a></h2>\n<p>NW.js 仍然提供一个支持 Windows XP 的 \"传统版本\"， 它没有收到安全更新。</p>\n<p>鉴于硬件制造商、微软、Chromium 和 Node.js 甚至没有为该系统发布关键的安全更新，我们不得不警告你，使用 Windows XP 是非常不安全的，是彻头彻尾的不负责任。</p>\n<p>然而，我们明白，可能存在超出我们想象的要求存在，因此，如果你正在寻找像 Electron 那样在 Windows XP 上运行的东西，NW.js 的传统版本可能是适合你的。</p>\n<h2 id=\"5-功能\"><a href=\"#5-功能\">5) 功能</a></h2>\n<p>在支持的功能数量上有许多差异。 Electron有一个更大的社区，有更多的生产应用在使用它，并且<a href=\"https://www.npmjs.com/search?q=electron\">有大量的用户端模块在 npm 上可用</a>。</p>\n<p>例如，Electron 内置了对自动更新的支持和无数的工具，使安装程序更加容易创建。 一个有利于 NW.js 的例子，NW.js 支持更多的 <code>Chrome.*</code> API，用于开发 Chrome 应用程序。</p>\n<p>当然，我们相信 Electron 是用 Web 技术构建生产应用程序更好的平台（如 Visual Studio Code、Slack 或 Facebook Messenger）；但是，我们希望公平对待同样用 Web 技术的朋友。 如果你有 Electron 不能满足的功能需求，你可能需要尝试 NW.js。</p>",
      "title": "Electron 和 NW.js 之间的技术差异 类似于NW.js，Electron提供了一个使用Web技术开发桌面应用程序的平台。它们都可以让开发者很便利地使用HTML、JavaScript以及Node.js进行开发。表面上，它们俩非常相似。、 然而，两个项目间依旧存在着一些本质的差异，这使得Electron是一个完全独立且不同于NW.js的项目。 1）应用程序的入口 NW.js中，应用程序的主入口是一个HTML网页。NW.js将会使用一个浏览器窗口打开给定的入口点（HTML网页）。 在Electron中，入口点是一个Javascript脚本文件。我们需要通过Javascript代码手动创建一个浏览器窗口并加载一个HTML文件，而不是直接提供一个URL的方法。当然我们也可以去监听窗口的事件来决定什么时候退出应用程序。 Electron的工作机制更像是Node.js的运行时。而且Electron的API实际上更为底层，所以我们可以使用它进行相应的浏览器测试并替代PhantomJS。 2）Node集成 在NW.js中，在Web页面中集成Node需要通过给Chromium打补丁的方式才能运行。而Electron采取了通过在集成libuv loop——不同的操作系统平台（Windows、Linux、MacOS）的消息循环来避免魔改Chromium。 3）Javascript上下文",
      "description": ""
    },
    "/docs/api/environment-variables": {
      "locale": "zh-CN",
      "slug": "environment-variables",
      "href": "/docs/api/environment-variables",
      "crowdinFileId": "256315",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/environment-variables.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"环境变量\"><a href=\"#环境变量\">环境变量</a></h1>\n<blockquote>\n<p>在不更改代码的情况下控制应用程序配置和行为。</p>\n</blockquote>\n<p>Electron的某些行为受环境变量的控制, 因为它们比命令行标志和应用程序的代码更早初始化。</p>\n<p>POSIX shell示例:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">export</span> ELECTRON_ENABLE_LOGGING=<span class=\"hljs-literal\">true</span>\n$ electron\n</code></pre>\n<p>Windows 控制台示例:</p>\n<pre><code class=\"hljs language-powershell\">> set ELECTRON_ENABLE_LOGGING=true\n> electron\n</code></pre>\n<h2 id=\"生产环境相关变量\"><a href=\"#生产环境相关变量\">生产环境相关变量</a></h2>\n<p>以下环境变量主要用于在打包后的Electron应用运行时使用。</p>\n<h3 id=\"node_options\"><a href=\"#node_options\"><code>NODE_OPTIONS</code></a></h3>\n<p>Electron 包括对 Node 的 <a href=\"https://nodejs.org/api/cli.html#cli_node_options_options\"><code>NODE_OPTIONS</code></a> 的子集的支持。 除与 Chromium 使用 BoringSSL 相抵触的情况外，大多数都得到了支持。</p>\n<p>示例：</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">export</span> NODE_OPTIONS=<span class=\"hljs-string\">\"--no-warnings --max-old-space-size=2048\"</span>\n</code></pre>\n<p>不支持的选项是：</p>\n<pre><code class=\"hljs language-sh\">--use-bundled-ca\n--force-fips\n--<span class=\"hljs-built_in\">enable</span>-fips\n--openssl-config\n--use-openssl-ca\n</code></pre>\n<p><code>NODE_OPTIONS</code> 在打包应用程序中明确禁止使用，以下情况除外:</p>\n<pre><code class=\"hljs language-sh\">--max-http-header-size\n--http-parser\n</code></pre>\n<h3 id=\"google_api_key\"><a href=\"#google_api_key\"><code>GOOGLE_API_KEY</code></a></h3>\n<p>Electron中的地理定位支持需要使用Google云平台的地理定位网络服务。 为了启用此功能，需获取一个 <a href=\"https://developers.google.com/maps/documentation/geolocation/get-api-key\">Google API 密钥</a> 并将以下代码放入你的主进程文件， 在打开任何 浏览器窗口之前将生成地理位置请求：</p>\n<pre><code class=\"hljs language-javascript\">process.env.GOOGLE_API_KEY = <span class=\"hljs-string\">'YOUR_KEY_HERE'</span>\n</code></pre>\n<p>默认情况下, 可能不允许新生成的 Google API key进行地理编码请求。 要为你的项目启用地理定位网络服务，请通过 <a href=\"https://console.cloud.google.com/apis/library\">API 库</a> 启用它。</p>\n<p>注： 你需要在与 API 密钥相关的项目中添加一个<a href=\"https://cloud.google.com/billing/docs/how-to/payment-methods#add_a_payment_method\">计费帐户</a>，以便地理定位网络服务工作。</p>\n<h3 id=\"electron_no_asar\"><a href=\"#electron_no_asar\"><code>ELECTRON_NO_ASAR</code></a></h3>\n<p>禁用 ASAR 支持。 该变量只在设置 <code>ELECTRON_RUN_AS_NODE</code> 的派生子进程和衍生子进程中受支持。</p>\n<h3 id=\"electron_run_as_node\"><a href=\"#electron_run_as_node\"><code>ELECTRON_RUN_AS_NODE</code></a></h3>\n<p>当做普通Node.js进程启动。</p>\n<p>在当前模式下，当运行普通可执行Node.js文件时，你可以将 <a href=\"https://nodejs.org/api/cli.html\">cli 选项</a> 传递给Node.js，但下列标志除外：</p>\n<ul>\n<li>\"--openssl-config\"</li>\n<li>\"--use-bundled-ca\"</li>\n<li>\"--use-openssl-ca\",</li>\n<li>\"--force-fips\"</li>\n<li>\"--enable-fips\"</li>\n</ul>\n<p>由于Electron 在构建 Node.js 的 <code>crypto</code> 模块时使用 BoringSSL 而不是 OpenSSL，因此这些标志被禁用。所以不会像设计的那样工作。</p>\n<h3 id=\"electron_no_attach_console-windows\"><a href=\"#electron_no_attach_console-windows\"><code>ELECTRON_NO_ATTACH_CONSOLE</code> <em>Windows</em></a></h3>\n<p>不附加到当前控制台会话。</p>\n<h3 id=\"electron_force_window_menu_bar-linux\"><a href=\"#electron_force_window_menu_bar-linux\"><code>ELECTRON_FORCE_WINDOW_MENU_BAR</code><em> Linux </em></a></h3>\n<p>不使用 Linux 的全局菜单栏。</p>\n<h3 id=\"electron_trash-linux\"><a href=\"#electron_trash-linux\"><code>ELECTRON_TRASH</code> <em>Linux</em></a></h3>\n<p>在 Linux 上设置垃圾回收实现。 默认值为 <code>gio</code>.</p>\n<p>选项:</p>\n<ul>\n<li><code>gvfs-trash</code></li>\n<li><code>trash-cli</code></li>\n<li><code>kioclient5</code></li>\n<li><code>kioclient</code></li>\n</ul>\n<h2 id=\"开发环境相关变量\"><a href=\"#开发环境相关变量\">开发环境相关变量</a></h2>\n<p>以下环境变量主要用于开发和调试目的。</p>\n<h3 id=\"electron_enable_logging\"><a href=\"#electron_enable_logging\"><code>ELECTRON_ENABLE_LOGGING</code></a></h3>\n<p>Prints Chromium's internal logging to the console.</p>\n<p>Setting this variable is the same as passing <code>--enable-logging</code> on the command line. For more info, see <code>--enable-logging</code> in <a href=\"/docs/api/command-line-switches#enable-loggingfile\">command-line switches</a>.</p>\n<h3 id=\"electron_log_file\"><a href=\"#electron_log_file\"><code>ELECTRON_LOG_FILE</code></a></h3>\n<p>Sets the file destination for Chromium's internal logging.</p>\n<p>Setting this variable is the same as passing <code>--log-file</code> on the command line. For more info, see <code>--log-file</code> in <a href=\"/docs/api/command-line-switches#log-filepath\">command-line switches</a>.</p>\n<h3 id=\"electron_debug_drag_regions\"><a href=\"#electron_debug_drag_regions\"><code>ELECTRON_DEBUG_DRAG_REGIONS</code></a></h3>\n<p>在 macOS 的 <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>上添加可拖动区域的颜色 - 可拖动区域将着绿色， 不可拖动区域将着红色以帮助调试。</p>\n<h3 id=\"electron_debug_notifications\"><a href=\"#electron_debug_notifications\"><code>ELECTRON_DEBUG_NOTIFICATIONS</code></a></h3>\n<p>在 macOS 上添加额外日志到 <a href=\"/docs/api/notification\"><code>通知</code></a> 生命周期以帮助调试。 当创建或激活新通知时，将显示额外日志。 They will also be displayed when common a tions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.</p>\n<p>示例输出：</p>\n<pre><code class=\"hljs language-sh\">Notification created (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification displayed (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification activated (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification replied to (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\n</code></pre>\n<h3 id=\"electron_log_asar_reads\"><a href=\"#electron_log_asar_reads\"><code>ELECTRON_LOG_ASAR_READS</code></a></h3>\n<p>当 Electron 从 ASAR 文件读取时，记录读取 offset 偏移和文件路径到系统 <code>tmpdir</code> 临时目录。 生成的文件可以提供给ASAR 模块以优化文件排序。</p>\n<h3 id=\"electron_enable_stack_dumping\"><a href=\"#electron_enable_stack_dumping\"><code>ELECTRON_ENABLE_STACK_DUMPING</code></a></h3>\n<p>当Electron崩溃时, 将跟踪堆栈输出到控制台。</p>\n<p>如果 <code>crashReporter</code>已经启动了, 则此环境变量将不起作用。</p>\n<h3 id=\"electron_default_error_mode-windows\"><a href=\"#electron_default_error_mode-windows\"><code>ELECTRON_DEFAULT_ERROR_MODE</code><em> Windows </em></a></h3>\n<p>当Electron崩溃时显示 Windows 的崩溃对话框。</p>\n<p>如果 <code>crashReporter</code>已经启动了, 则此环境变量将不起作用。</p>\n<h3 id=\"electron_override_dist_path\"><a href=\"#electron_override_dist_path\"><code>ELECTRON_OVERRIDE_DIST_PATH</code></a></h3>\n<p>当 <code>electron</code> 包运行时，该变量告知 <code>electron</code> 命令使用指定Electron的构建代替由 <code>npm install</code> 下载的构建。 用法：</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">export</span> ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Testing\n</code></pre>\n<h2 id=\"通过-electron-设置\"><a href=\"#通过-electron-设置\">通过 Electron 设置</a></h2>\n<p>在Electron运行时设置一些环境变量</p>\n<h3 id=\"original_xdg_current_desktop\"><a href=\"#original_xdg_current_desktop\"><code>ORIGINAL_XDG_CURRENT_DESKTOP</code></a></h3>\n<p>此变量设置为你的应用程序最初启动的 <code>XDG_CURRENT_DESKTOP</code> 值。  Electron 有时修改 <code>XDG_CURRENT_DESKTOP</code> 的值以影响Chromium 中的其他逻辑，所以如果您想访问 <em>原始的</em> 值 您应该重新查看此环境变量。</p>",
      "title": "环境变量",
      "description": "在不更改代码的情况下控制应用程序配置和行为。"
    },
    "/docs/api/structures/event": {
      "locale": "zh-CN",
      "slug": "event",
      "href": "/docs/api/structures/event",
      "crowdinFileId": "256429",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"event-object-extends-globalevent\"><a href=\"#event-object-extends-globalevent\">Event Object extends <code>GlobalEvent</code></a></h1>\n<ul>\n<li><code>preventDefault</code> VoidFunction</li>\n</ul>",
      "title": "Event Object extends GlobalEvent",
      "description": ""
    },
    "/docs/experimental": {
      "locale": "zh-CN",
      "slug": "experimental",
      "href": "/docs/experimental",
      "crowdinFileId": "256119",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/experimental.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"experimental-apis\"><a href=\"#experimental-apis\">Experimental APIs</a></h1>\n<p>Some of Electrons APIs are tagged with <code>_Experimental_</code> in the documentation. This tag indicates that the API may not be considered stable and the API may be removed or modified more frequently than other APIs with less warning.</p>\n<h2 id=\"conditions-for-an-api-to-be-tagged-as-experimental\"><a href=\"#conditions-for-an-api-to-be-tagged-as-experimental\">Conditions for an API to be tagged as Experimental</a></h2>\n<p>Anyone can request an API be tagged as experimental in a feature PR, disagreements on the experimental nature of a feature can be discussed in the API WG if they can't be resolved in the PR.</p>\n<h2 id=\"process-for-removing-the-experimental-tag\"><a href=\"#process-for-removing-the-experimental-tag\">Process for removing the Experimental tag</a></h2>\n<p>Once an API has been stable and in at least two major stable release lines it can be nominated to have its experimental tag removed.  This discussion should happen at an API WG meeting.  Things to consider when discussing / nominating:</p>\n<ul>\n<li>The above \"two major stables release lines\" condition must have been met</li>\n<li>During that time no major bugs / issues should have been caused by the adoption of this feature</li>\n<li>The API is stable enough and hasn't been heavily impacted by Chromium upgrades</li>\n<li>Is anyone using the API?</li>\n<li>Is the API fulfilling the original proposed usecases, does it have any gaps?</li>\n</ul>",
      "title": "Experimental APIs",
      "description": ""
    },
    "/docs/api/structures/extension": {
      "locale": "zh-CN",
      "slug": "extension",
      "href": "/docs/api/structures/extension",
      "crowdinFileId": "256433",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/extension.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"extension-object\"><a href=\"#extension-object\">Extension Object</a></h1>\n<ul>\n<li><code>id</code> String</li>\n<li><code>manifest</code> any - Copy of the <a href=\"https://developer.chrome.com/extensions/manifest\">extension's manifest data</a>.</li>\n<li><code>name</code> String</li>\n<li><code>path</code> String - The extension's file path.</li>\n<li><code>version</code> String</li>\n<li><code>url</code> String - The extension's <code>chrome-extension://</code> URL.</li>\n</ul>",
      "title": "Extension Object",
      "description": ""
    },
    "/docs/api/structures/extension-info": {
      "locale": "zh-CN",
      "slug": "extension-info",
      "href": "/docs/api/structures/extension-info",
      "crowdinFileId": "256431",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/extension-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"extensioninfo-object\"><a href=\"#extensioninfo-object\">ExtensionInfo Object</a></h1>\n<ul>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>",
      "title": "ExtensionInfo Object",
      "description": ""
    },
    "/docs/api/extensions": {
      "locale": "zh-CN",
      "slug": "extensions",
      "href": "/docs/api/extensions",
      "crowdinFileId": "256317",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/extensions.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"chrome-扩展支持\"><a href=\"#chrome-扩展支持\">Chrome 扩展支持</a></h1>\n<p>Electron 支持 <a href=\"https://developer.chrome.com/extensions/api_index\">Chrome 扩展API</a>的子集， 主要是支持 DevTools 扩展和 Chromium-internal 扩展，但它同时也支持一些其他扩展能。</p>\n<blockquote>\n<p><strong>注意</strong>：Electron 不支持商店中的任意 Chrome 扩展，Electron 项目的目标<strong>不是</strong>与 Chrome 的扩展实现完全兼容。</p>\n</blockquote>\n<h2 id=\"加载扩展\"><a href=\"#加载扩展\">加载扩展</a></h2>\n<p>Electron 只支持加载未打包的扩展 (即不能使用 <code>.crx</code> 文件)。 插件会被安装到每一个<code>会话</code>。 要加载扩展，请调用 <a href=\"/docs/api/session#sesloadextensionpath-options\"><code>ses.loadextension</code></a>：</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession.loadExtension(<span class=\"hljs-string\">'path/to/unpacked/extension'</span>).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ id }</span>) =></span> {\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<p>加载的扩展将不会被自动记住；如果在应用程序运行时未调用 <code>loadExtension</code>，则不会加载扩展。</p>\n<p>注意，仅能在持久 session 中加载扩展。 尝试将扩展加载到内存 session 中会出现错误。</p>\n<p>有关加载、卸载和查询活动扩展的更多信息，请查阅 <a href=\"/docs/api/session\"><code>session</code></a> 文档。</p>\n<h2 id=\"支持的扩展-api\"><a href=\"#支持的扩展-api\">支持的扩展 API</a></h2>\n<p>我们支持以下扩展 API，并需要注意一些警告。 其他API可能会得到额外支持，但对此处未列出的任何API的支持都是临时的，可能会被删除。</p>\n<h3 id=\"chromedevtoolsinspectedwindow\"><a href=\"#chromedevtoolsinspectedwindow\"><code>chrome.devtools.inspectedWindow</code></a></h3>\n<p>支持这些 API 的所有功能。</p>\n<h3 id=\"chromedevtoolsnetwork\"><a href=\"#chromedevtoolsnetwork\"><code>chrome.devtools.network</code></a></h3>\n<p>支持这些 API 的所有功能。</p>\n<h3 id=\"chromedevtoolspanels\"><a href=\"#chromedevtoolspanels\"><code>chrome.devtools.panels</code></a></h3>\n<p>支持这些 API 的所有功能。</p>\n<h3 id=\"chromeextension\"><a href=\"#chromeextension\"><code>chrome.extension</code></a></h3>\n<p>支持 <code>chrome.extension</code> 的以下属性：</p>\n<ul>\n<li><code>chrome.extension.lastError</code></li>\n</ul>\n<p>支持 <code>chrome.extension</code> 的以下方法：</p>\n<ul>\n<li><code>chrome.extension.getURL</code></li>\n<li><code>chrome.extension.getBackgroundPage</code></li>\n</ul>\n<h3 id=\"chromeruntime\"><a href=\"#chromeruntime\"><code>chrome.runtime</code></a></h3>\n<p>支持 <code>chrome.runtime</code> 的以下属性：</p>\n<ul>\n<li><code>chrome.runtime.lastError</code></li>\n<li><code>chrome.runtime.id</code></li>\n</ul>\n<p>支持 <code>chrome.runtime</code> 的以下方法：</p>\n<ul>\n<li><code>chrome.runtime.getBackgroundPage</code></li>\n<li><code>chrome.runtime.getManifest</code></li>\n<li><code>chrome.runtime.getPlatformInfo</code></li>\n<li><code>chrome.runtime.getURL</code></li>\n<li><code>chrome.runtime.connect</code></li>\n<li><code>chrome.runtime.sendMessage</code></li>\n<li><code>chrome.runtime.reload</code></li>\n</ul>\n<p>支持 <code>chrome.runtime</code> 的以下事件：</p>\n<ul>\n<li><code>chrome.runtime.onStartup</code></li>\n<li><code>chrome.runtime.onInstalled</code></li>\n<li><code>chrome.runtime.onSuspend</code></li>\n<li><code>chrome.runtime.onSuspendCanceled</code></li>\n<li><code>chrome.runtime.onConnect</code></li>\n<li><code>chrome.runtime.onMessage</code></li>\n</ul>\n<h3 id=\"chromestorage\"><a href=\"#chromestorage\"><code>chrome.storage</code></a></h3>\n<p>仅支持 <code>chrome.storage.local</code> ； <code>chrome.storage.sync</code> 和 <code>chrome.storage.manage.manage</code> 不支持。</p>\n<h3 id=\"chrometabs\"><a href=\"#chrometabs\"><code>chrome.tabs</code></a></h3>\n<p>支持 <code>chrome.tab</code> 的以下方法：</p>\n<ul>\n<li><code>chrome.tabs.sendMessage</code></li>\n<li><code>chrome.tabs.executeScript</code></li>\n</ul>\n<blockquote>\n<p><strong>注意：</strong> 在 Chrome 中，通过 <code>-1</code> 作为标签ID表示“当前活动的标签”。 因为 Electron 没有这样的概念，通过 <code>-1</code> 作为选项卡ID不支持而且会报错。</p>\n</blockquote>\n<h3 id=\"chromemanagement\"><a href=\"#chromemanagement\"><code>chrome.management</code></a></h3>\n<p>支持 <code>chrome.management</code> 的以下方法：</p>\n<ul>\n<li><code>chrome.management.getAll</code></li>\n<li><code>chrome.management.get</code></li>\n<li><code>chrome.management.getSelf</code></li>\n<li><code>chrome.management.getPermissionWarningsById</code></li>\n<li><code>chrome.management.getPermissionWarningsByManifest</code></li>\n<li><code>chrome.management.onEnabled</code></li>\n<li><code>chrome.management.onDisabled</code></li>\n</ul>\n<h3 id=\"chromewebrequest\"><a href=\"#chromewebrequest\"><code>chrome.webRequest</code></a></h3>\n<p>支持这些 API 的所有功能。</p>\n<blockquote>\n<p><strong>注意：</strong> 如果有冲突需要处理，Electron 的 <a href=\"/docs/api/web-request\"><code>webRequest</code></a> 模块将优先于 <code>chrome.web</code> 。</p>\n</blockquote>",
      "title": "Chrome 扩展支持",
      "description": "注意：Electron 不支持商店中的任意 Chrome 扩展，Electron 项目的目标不是与 Chrome 的扩展实现完全兼容。"
    },
    "/docs/faq": {
      "locale": "zh-CN",
      "slug": "faq",
      "href": "/docs/faq",
      "crowdinFileId": "256121",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/faq.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-常见问题-faq\"><a href=\"#electron-常见问题-faq\">Electron 常见问题 (FAQ)</a></h1>\n<h2 id=\"为什么我在安装-electron-的时候遇到了问题？\"><a href=\"#为什么我在安装-electron-的时候遇到了问题？\">为什么我在安装 Electron 的时候遇到了问题？</a></h2>\n<p>在运行 <code>npm install electron</code> 时，有些用户会偶尔遇到安装问题。</p>\n<p>在大多数情况下，这些错误都是由网络问题导致，而不是因为 <code>electron</code> npm 包的问题。 如 <code>ELIFECYCLE</code>、<code>EAI_AGAIN</code>、<code>ECONNRESET</code> 和 <code>ETIMEDOUT</code> 等错误都是此类网络问题的标志。 最佳的解决方法是尝试切换网络，或是稍后再尝试安装。</p>\n<p>如果通过 <code>npm</code> 安装失败，您可以尝试直接从 <a href=\"https://github.com/electron/electron/releases\">electron/electron/releases</a> 直接下载 Electron。</p>\n<h2 id=\"electron-会在什么时候升级到最新版本的-chrome？\"><a href=\"#electron-会在什么时候升级到最新版本的-chrome？\">Electron 会在什么时候升级到最新版本的 Chrome？</a></h2>\n<p>通常来说，在稳定版的 Chrome 发布后一到两周内，我们会更新 Electron 内的 Chrome 版本。 这个只是个估计且不能保证，取决于与升级所涉及的工作量。</p>\n<p>我们只使用稳定的 Chrome 频道。 如果一个重要的修复在 beta 或 dev 通道中，我们将返回端口。</p>\n<p>更多信息，请看<a href=\"/docs/tutorial/security\">安全介绍</a></p>\n<h2 id=\"electron-会在什么时候升级到最新版本的-nodejs？\"><a href=\"#electron-会在什么时候升级到最新版本的-nodejs？\">Electron 会在什么时候升级到最新版本的 Node.js？</a></h2>\n<p>我们通常会在最新版的 Node.js 发布后一个月左右将 Electron 更新到这个版本的 Node.js。 我们通过这种方式来避免新版本的 Node.js 带来的 bug（这种 bug 太常见了）。</p>\n<p>Node.js 的新特性通常是由新版本的 V8 带来的。由于 Electron 使用的是 Chrome 浏览器中附带的 V8 引擎，所以 Electron 内往往已经有了部分新版本 Node.js 才有的崭新特性。</p>\n<h2 id=\"如何在两个网页间共享数据？\"><a href=\"#如何在两个网页间共享数据？\">如何在两个网页间共享数据？</a></h2>\n<p>在两个网页（渲染进程）间共享数据最简单的方法是使用浏览器中已经实现的 HTML5 API。 其中比较好的方案是 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Storage\">Storage API</a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage\"><code>localStorage</code></a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage\"><code>sessionStorage</code></a>, and <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API\">IndexedDB</a>.</p>\n<p>或者，您可以使用 Electron 提供的原始版 IPC 。 To share data between the main and renderer processes, you can use the <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> and <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> modules. To communicate directly between web pages, you can send a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> from one to the other, possibly via the main process using <a href=\"/docs/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage()</code></a>. Subsequent communication over message ports is direct and does not detour through the main process.</p>\n<h2 id=\"几分钟后我应用的-tray-消失了。\"><a href=\"#几分钟后我应用的-tray-消失了。\">几分钟后我应用的 Tray 消失了。</a></h2>\n<p>当用来存储 Tray 的变量被垃圾回收时，就会发生这种情况。</p>\n<p>你可以参考以下两篇文章来了解为什么会遇到这个问题：</p>\n<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management\">内存管理</a></li>\n<li><a href=\"https://msdn.microsoft.com/library/bzt2dkta(v=vs.94).aspx\">变量作用域</a></li>\n</ul>\n<p>如果你只是要一个快速的修复方案，你可以用下面的方式改变变量的作用域，防止这个变量被垃圾回收。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/icon.png'</span>)\n  tray.setTitle(<span class=\"hljs-string\">'hello world'</span>)\n})\n</code></pre>\n<p>改为</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> tray = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/icon.png'</span>)\n  tray.setTitle(<span class=\"hljs-string\">'hello world'</span>)\n})\n</code></pre>\n<h2 id=\"我在-electron-中无法使用-jquery、requirejs、meteor、angularjs。\"><a href=\"#我在-electron-中无法使用-jquery、requirejs、meteor、angularjs。\">我在 Electron 中无法使用 jQuery、RequireJS、Meteor、AngularJS。</a></h2>\n<p>因为 Electron 在运行环境中引入了 Node.js，所以在 DOM 中有一些额外的变量，比如 <code>module</code>、<code>exports</code> 和<code> require</code>。 这导致 了许多库不能正常运行，因为它们也需要将同名的变量加入运行环境中。</p>\n<p>我们可以通过禁用 Node.js 来解决这个问题，在Electron里用如下的方式：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// 在主进程中.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\nwin.show()\n</code></pre>\n<p>假如你依然需要使用 Node.js 和 Electron 提供的 API，你需要在引入那些库之前将这些变量重命名，比如：</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-built_in\">window</span>.nodeRequire = <span class=\"hljs-built_in\">require</span>;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.require;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.exports;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.module;\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/javascript\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"jquery.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n</code></pre>\n<h2 id=\"requireelectronxxx-未定义。\"><a href=\"#requireelectronxxx-未定义。\"><code>require('electron').xxx</code> 未定义。</a></h2>\n<p>在使用 Electron 的提供的模块时，你可能会遇到和以下类似的错误：</p>\n<pre><code class=\"hljs language-sh\">> require(<span class=\"hljs-string\">'electron'</span>).webFrame.setZoomFactor(1.0)\nUncaught TypeError: Cannot <span class=\"hljs-built_in\">read</span> property <span class=\"hljs-string\">'setZoomLevel'</span> of undefined\n</code></pre>\n<p>很可能是你在过程中使用了错误的模块。 比如，<code>electron.app</code> 只能在主进程中使用, 然而 <code>electron.webFrame</code> 只能在渲染进程中使用。</p>\n<h2 id=\"文字看起来很模糊，这是什么原因造成的？怎么解决这个问题呢？\"><a href=\"#文字看起来很模糊，这是什么原因造成的？怎么解决这个问题呢？\">文字看起来很模糊，这是什么原因造成的？怎么解决这个问题呢？</a></h2>\n<p>如果 <a href=\"https://alienryderflex.com/sub_pixel/\">sub-pixel anti-aliasing</a>已被禁用，那么 LCD 屏幕上的字体可能会看起来模糊。 示例：</p>\n<p><img src=\"/docs/images/subpixel-rendering-screenshot.gif\" alt=\"subpixel rendering example\"></p>\n<p>子像素反锯齿需要一个包含字体光图的图层的非透明背景。 （详情请参阅<a href=\"https://github.com/electron/electron/issues/6344#issuecomment-420371918\">这个问题</a>）</p>\n<p>To achieve this goal, set the background in the constructor for <a href=\"/docs/api/browser-window\">BrowserWindow</a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#fff'</span>\n})\n</code></pre>\n<p>效果仅可见于（一些） LCD 屏幕。 Even if you don't see a difference, some of your users may. It is best to always set the background this way, unless you have reasons not to do so.</p>\n<p>注意到，仅设置 CSS 背景并不具有预期的效果。</p>",
      "title": "Electron 常见问题 (FAQ)",
      "description": ""
    },
    "/docs/api/structures/file-filter": {
      "locale": "zh-CN",
      "slug": "file-filter",
      "href": "/docs/api/structures/file-filter",
      "crowdinFileId": "256435",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/file-filter.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"filefilter-object\"><a href=\"#filefilter-object\">FileFilter Object</a></h1>\n<ul>\n<li><code>name</code> String</li>\n<li><code>extensions</code> String[]</li>\n</ul>",
      "title": "FileFilter Object",
      "description": ""
    },
    "/docs/api/file-object": {
      "locale": "zh-CN",
      "slug": "file-object",
      "href": "/docs/api/file-object",
      "crowdinFileId": "256319",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/file-object.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"file-对象\"><a href=\"#file-对象\"><code>File</code> 对象</a></h1>\n<blockquote>\n<p>在文件系统中，使用HTML5 <code>File</code> 原生API操作文件</p>\n</blockquote>\n<p>DOM的文件接口提供了关于原生文件的抽象，以便用户可以直接使用HTML5文件API处理原生文件。 Electron已经向 <code>文件</code> 接口添加了一个 <code>path</code> 属性, 在文件系统上暴露出文件的真实路径</p>\n<p>示例：获取拖拽到app上的文件的真实路径</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">div</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"holder\"</span>></span>\n  Drag your file here\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">div</span>></span>\n\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  <span class=\"hljs-built_in\">document</span>.addEventListener(<span class=\"hljs-string\">'drop'</span>, (e) => {\n    e.preventDefault();\n    e.stopPropagation();\n\n    <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> f <span class=\"hljs-keyword\">of</span> e.dataTransfer.files) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'File(s) you dragged here: '</span>, f.path)\n    }\n  });\n  <span class=\"hljs-built_in\">document</span>.addEventListener(<span class=\"hljs-string\">'dragover'</span>, (e) => {\n    e.preventDefault();\n    e.stopPropagation();\n  });\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>",
      "title": "File 对象",
      "description": "在文件系统中，使用HTML5 File 原生API操作文件"
    },
    "/docs/api/structures/file-path-with-headers": {
      "locale": "zh-CN",
      "slug": "file-path-with-headers",
      "href": "/docs/api/structures/file-path-with-headers",
      "crowdinFileId": "256437",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/file-path-with-headers.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"filepathwithheaders-object\"><a href=\"#filepathwithheaders-object\">FilePathWithHeaders Object</a></h1>\n<ul>\n<li><code>path</code> String - The path to the file to send.</li>\n<li><code>headers</code> Record&#x3C;string, string> (optional) - Additional headers to be sent.</li>\n</ul>",
      "title": "FilePathWithHeaders Object",
      "description": ""
    },
    "/docs/api/frameless-window": {
      "locale": "zh-CN",
      "slug": "frameless-window",
      "href": "/docs/api/frameless-window",
      "crowdinFileId": "256321",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/frameless-window.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"无边框窗口\"><a href=\"#无边框窗口\">无边框窗口</a></h1>\n<blockquote>\n<p>打开一个无工具栏、边框、和其它图形化外壳的窗口。</p>\n</blockquote>\n<p>无边框窗口是不带<a href=\"https://developer.mozilla.org/en-US/docs/Glossary/Chrome\">外壳</a>（包括窗口边框、工具栏等），只含有网页内容的窗口。 这些是 <a href=\"/docs/api/browser-window\"><code> BrowserWindow</code></a> 类上的选项。</p>\n<h2 id=\"创建无边框窗口\"><a href=\"#创建无边框窗口\">创建无边框窗口</a></h2>\n<p>要创建无边框窗口，只需在 <a href=\"/docs/api/browser-window\"> BrowserWindow </a> 的 <code>options</code> 中将 <code>frame</code> 设置为 <code>false</code>：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h3 id=\"alternatives\"><a href=\"#alternatives\">Alternatives</a></h3>\n<p>There's an alternative way to specify a chromeless window on macOS and Windows. Instead of setting <code>frame</code> to <code>false</code> which disables both the titlebar and window controls, you may want to have the title bar hidden and your content extend to the full window size, yet still preserve the window controls (\"traffic lights\" on macOS) for standard window actions. 你可以通过指定 <code>titleBarStyle</code> 选项来完成此操作：</p>\n<h4 id=\"hidden\"><a href=\"#hidden\"><code>hidden</code></a></h4>\n<p>Results in a hidden title bar and a full size content window. On macOS, the title bar still has the standard window controls (“traffic lights”) in the top left.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span> })\nwin.show()\n</code></pre>\n<h3 id=\"macos-上的其他方案\"><a href=\"#macos-上的其他方案\">macOS 上的其他方案</a></h3>\n<h4 id=\"hiddeninset\"><a href=\"#hiddeninset\"><code>hiddenInset</code></a></h4>\n<p>返回一个另一种隐藏了标题栏的窗口，其中控制按钮到窗口边框的距离更大。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span> })\nwin.show()\n</code></pre>\n<h4 id=\"custombuttonsonhover\"><a href=\"#custombuttonsonhover\"><code>customButtonsOnHover</code></a></h4>\n<p>使用自定义的关闭、缩小和全屏按钮，这些按钮会在划过窗口的左上角时显示。 由于无框窗口与苹果 macOS 窗口界面的限制，全屏按钮不可用。 这些自定义的按钮能防止, 与发生于标准的窗口工具栏按钮处的鼠标事件相关的问题. 这个选项只适用于无框窗口。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'customButtonsOnHover'</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h2 id=\"windows-control-overlay\"><a href=\"#windows-control-overlay\">Windows Control Overlay</a></h2>\n<p>When using a frameless window in conjuction with <code>win.setWindowButtonVisibility(true)</code> on macOS, using one of the <code>titleBarStyle</code>s as described above so that the traffic lights are visible, or using <code>titleBarStyle: hidden</code> on Windows, you can access the Window Controls Overlay <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis\">JavaScript APIs</a> and <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables\">CSS Environment Variables</a> by setting the <code>titleBarOverlay</code> option to true. Specifying <code>true</code> will result in an overlay with default system colors.</p>\n<p>On Windows, you can also specify the color of the overlay and its symbols by setting <code>titleBarOverlay</code> to an object with the options <code>color</code> and <code>symbolColor</code>. If an option is not specified, the color will default to its system color for the window control buttons:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span>,\n  <span class=\"hljs-attr\">titleBarOverlay</span>: <span class=\"hljs-literal\">true</span>\n})\nwin.show()\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span>,\n  <span class=\"hljs-attr\">titleBarOverlay</span>: {\n    <span class=\"hljs-attr\">color</span>: <span class=\"hljs-string\">'#2f3241'</span>,\n    <span class=\"hljs-attr\">symbolColor</span>: <span class=\"hljs-string\">'#74b1be'</span>\n  }\n})\nwin.show()\n</code></pre>\n<h2 id=\"透明窗口\"><a href=\"#透明窗口\">透明窗口</a></h2>\n<p>通过将 <code>transparent</code> 选项设置为 <code>true</code>, 还可以使无框窗口透明:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">transparent</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h3 id=\"局限性\"><a href=\"#局限性\">局限性</a></h3>\n<ul>\n<li>你不能点击穿透透明区域。 我们将引入一个 API 来设置窗口形状以解决此问题, 请参阅 <a href=\"https://github.com/electron/electron/issues/1335\"> our issue </a> 以了解详细信息。</li>\n<li>透明窗口不可调整大小。 在某些平台上，将 <code>resizable</code> 设置为 <code>true</code> 可能会使透明窗口停止工作。</li>\n<li><code>blur </code> 筛选器仅适用于网页, 因此无法对位于透明窗口下方的内容应用模糊效果 (例如在用户系统上打开的其他应用程序) 。</li>\n<li>当打开开发者工具时，窗口将不透明。</li>\n<li>在 Windows 操作系统中，<ul>\n<li>当DWM禁用时，透明窗口将失效。</li>\n<li>透明窗口不能通过Windows系统菜单或双击标题栏实现最大化。 其背后的原因可以看<a href=\"https://github.com/electron/electron/pull/28207\">这个pull request</a>。</li>\n</ul></li>\n<li>在 linux 上, 用户必须在命令行中设置 <code>--enable-transparent-visuals --disable-gpu </code> 来禁用GPU, 启用 ARGB，用以实现窗体透明。 这是由一个上游的 bug 导致的, 即 <a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=369209\"> 在Linux机上，透明度通道（alpha channel ）在一些英伟达的驱动（NVidia drivers）中无法运行</a>。</li>\n<li>在 Mac 上, 透明窗口无法显示原生窗口的阴影。</li>\n</ul>\n<h2 id=\"点击穿透窗口\"><a href=\"#点击穿透窗口\">点击穿透窗口</a></h2>\n<p>要创建一个点击穿透窗口，也就是使窗口忽略所有鼠标事件，可以调用 <a href=\"/docs/api/browser-window#winsetignoremouseeventsignore-options\"> win.setIgnoreMouseEvents(ignore) </a> API：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.setIgnoreMouseEvents(<span class=\"hljs-literal\">true</span>)\n</code></pre>\n<h3 id=\"转发\"><a href=\"#转发\">转发</a></h3>\n<p>忽略鼠标消息会使网页无视鼠标移动，这意味着鼠标移动事件不会被发出。 在 Windows 操作系统上，可以使用可选参数将鼠标移动消息转发到网页，从而允许发出诸如 <code>mouseleave</code> 之类的事件：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> el = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'clickThroughElement'</span>)\nel.addEventListener(<span class=\"hljs-string\">'mouseenter'</span>, () => {\n  ipcRenderer.send(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, <span class=\"hljs-literal\">true</span>, { <span class=\"hljs-attr\">forward</span>: <span class=\"hljs-literal\">true</span> })\n})\nel.addEventListener(<span class=\"hljs-string\">'mouseleave'</span>, () => {\n  ipcRenderer.send(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, <span class=\"hljs-literal\">false</span>)\n})\n\n<span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, (event, ...args) => {\n  BrowserWindow.fromWebContents(event.sender).setIgnoreMouseEvents(...args)\n})\n</code></pre>\n<p>这将使网页在 <code>el</code> 上点击时穿透，在它外面时恢复正常。</p>\n<h2 id=\"可拖拽区\"><a href=\"#可拖拽区\">可拖拽区</a></h2>\n<p>默认情况下, 无边框窗口是不可拖拽的。 应用程序需要在 CSS 中指定 <code>-webkit-app-region: drag</code> 来告诉 Electron 哪些区域是可拖拽的（如操作系统的标准标题栏），在可拖拽区域内部使用 <code>-webkit-app-region: no-drag</code> 则可以将其中部分区域排除。 请注意, 当前只支持矩形形状。</p>\n<p>注意: <code>-webkit-app-region: drag </code> 在开发人员工具打开时会出现问题。 查看更多信息 (包括变通方法), 请参见此 <a href=\"https://github.com/electron/electron/issues/3647\"> GitHub 问题 </a>。</p>\n<p>要使整个窗口可拖拽, 您可以添加 <code>-webkit-app-region: drag</code> 作为 <code>body</code> 的样式:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"-webkit-app-region: drag\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n</code></pre>\n<p>请注意，如果您使整个窗口都可拖拽，则必须将其中的按钮标记为不可拖拽，否则用户将无法点击它们：</p>\n<pre><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">button</span> {\n  <span class=\"hljs-attribute\">-webkit-app-region</span>: no-drag;\n}\n</code></pre>\n<p>如果只将自定义标题栏设置为可拖拽，还需要使标题栏中的所有按钮都不可拖拽。</p>\n<h2 id=\"文本选择\"><a href=\"#文本选择\">文本选择</a></h2>\n<p>在无框窗口中, 拖动行为可能与选择文本冲突。 例如, 当您拖动标题栏时, 您可能会意外地选择标题栏上的文本。 为防止此操作, 您需要在可区域中禁用文本选择, 如下所选:</p>\n<pre><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.titlebar</span> {\n  <span class=\"hljs-attribute\">-webkit-user-select</span>: none;\n  <span class=\"hljs-attribute\">-webkit-app-region</span>: drag;\n}\n</code></pre>\n<h2 id=\"右键菜单\"><a href=\"#右键菜单\">右键菜单</a></h2>\n<p>在某些平台上，可拖拽区域不被视为窗口的实际内容，而是作为窗口边框处理，因此在右键单击时会弹出系统菜单。 要使上下文菜单在所有平台上都正确运行, 您永远也不要在可拖拽区域上使用自定义上下文菜单。</p>",
      "title": "无边框窗口",
      "description": "打开一个无工具栏、边框、和其它图形化外壳的窗口。"
    },
    "/docs/tutorial/fuses": {
      "locale": "zh-CN",
      "slug": "fuses",
      "href": "/docs/tutorial/fuses",
      "crowdinFileId": "256201",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/fuses.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-fuses\"><a href=\"#electron-fuses\">Electron Fuses</a></h1>\n<blockquote>\n<p>Package time feature toggles</p>\n</blockquote>\n<h2 id=\"what-are-fuses\"><a href=\"#what-are-fuses\">What are fuses?</a></h2>\n<p>For a subset of Electron functionality it makes sense to disable certain features for an entire application.  For example, 99% of apps don't make use of <code>ELECTRON_RUN_AS_NODE</code>, these applications want to be able to ship a binary that is incapable of using that feature.  We also don't want Electron consumers building Electron from source as that is both a massive technical challenge and has a high cost of both time and money.</p>\n<p>Fuses are the solution to this problem, at a high level they are \"magic bits\" in the Electron binary that can be flipped when packaging your Electron app to enable / disable certain features / restrictions.  Because they are flipped at package time before you code sign your app the OS becomes responsible for ensuring those bits aren't flipped back via OS level code signing validation (Gatekeeper / App Locker).</p>\n<h2 id=\"how-do-i-flip-the-fuses\"><a href=\"#how-do-i-flip-the-fuses\">How do I flip the fuses?</a></h2>\n<h3 id=\"the-easy-way\"><a href=\"#the-easy-way\">The easy way</a></h3>\n<p>We've made a handy module <code>@electron/fuses</code> to make flipping these fuses easy.  Check out the README of that module for more details on usage and potential error cases.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/fuses'</span>).flipFuses(\n  <span class=\"hljs-comment\">// Path to electron</span>\n  <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>),\n  <span class=\"hljs-comment\">// Fuses to flip</span>\n  {\n    <span class=\"hljs-attr\">runAsNode</span>: <span class=\"hljs-literal\">false</span>\n  }\n)\n</code></pre>\n<h3 id=\"the-hard-way\"><a href=\"#the-hard-way\">The hard way</a></h3>\n<h4 id=\"quick-glossary\"><a href=\"#quick-glossary\">Quick Glossary</a></h4>\n<ul>\n<li><strong>Fuse Wire</strong>: A sequence of bytes in the Electron binary used to control the fuses</li>\n<li><strong>Sentinel</strong>: A static known sequence of bytes you can use to locate the fuse wire</li>\n<li><strong>Fuse Schema</strong>: The format / allowed values for the fuse wire</li>\n</ul>\n<p>Manually flipping fuses requires editing the Electron binary and modifying the fuse wire to be the sequence of bytes that represent the state of the fuses you want.</p>\n<p>Somewhere in the Electron binary there will be a sequence of bytes that look like this:</p>\n<pre><code class=\"hljs language-plaintext\">| ...binary | sentinel_bytes | fuse_version | fuse_wire_length | fuse_wire | ...binary |\n</code></pre>\n<ul>\n<li><code>sentinel_bytes</code> is always this exact string <code>dL7pKGdnNz796PbbjQWNKmHXBZaB9tsX</code></li>\n<li><code>fuse_version</code> is a single byte whose unsigned integer value represents the version of the fuse schema</li>\n<li><code>fuse_wire_length</code> is a single byte whose unsigned integer value represents the number of fuses in the following fuse wire</li>\n<li><code>fuse_wire</code> is a sequence of N bytes, each byte represents a single fuse and its state.<ul>\n<li>\"0\" (0x30) indicates the fuse is disabled</li>\n<li>\"1\" (0x31) indicates the fuse is enabled</li>\n<li>\"r\" (0x72) indicates the fuse has been removed and changing the byte to either 1 or 0 will have no effect.</li>\n</ul></li>\n</ul>\n<p>To flip a fuse you find its position in the fuse wire and change it to \"0\" or \"1\" depending on the state you'd like.</p>\n<p>您可以在 <a href=\"https://github.com/electron/electron/blob/main/build/fuses/fuses.json5\">这里</a>查看当前schema。</p>",
      "title": "Electron Fuses",
      "description": "Package time feature toggles"
    },
    "/docs/api/global-shortcut": {
      "locale": "zh-CN",
      "slug": "global-shortcut",
      "href": "/docs/api/global-shortcut",
      "crowdinFileId": "256323",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/global-shortcut.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"globalshortcut\"><a href=\"#globalshortcut\">globalShortcut</a></h1>\n<blockquote>\n<p>在应用程序没有键盘焦点时，监听键盘事件。</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p><code>globalShortcut</code> 模块可以在操作系统中注册/注销全局快捷键, 以便可以为操作定制各种快捷键。</p>\n<p><strong> 注意: </strong>快捷方式是全局的; 即使应用程序没有键盘焦点, 它也仍然在持续监听键盘事件。 在 app 模块的 <code>ready</code> 事件就绪之前，这个模块不能使用。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Register a 'CommandOrControl+X' shortcut listener.</span>\n  <span class=\"hljs-keyword\">const</span> ret = globalShortcut.register(<span class=\"hljs-string\">'CommandOrControl+X'</span>, () => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'CommandOrControl+X is pressed'</span>)\n  })\n\n  <span class=\"hljs-keyword\">if</span> (!ret) {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'registration failed'</span>)\n  }\n\n  <span class=\"hljs-comment\">// 检查快捷键是否注册成功</span>\n  <span class=\"hljs-built_in\">console</span>.log(globalShortcut.isRegistered(<span class=\"hljs-string\">'CommandOrControl+X'</span>))\n})\n\napp.on(<span class=\"hljs-string\">'will-quit'</span>, () => {\n  <span class=\"hljs-comment\">// 注销快捷键</span>\n  globalShortcut.unregister(<span class=\"hljs-string\">'CommandOrControl+X'</span>)\n\n  <span class=\"hljs-comment\">// 注销所有快捷键</span>\n  globalShortcut.unregisterAll()\n})\n</code></pre>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>globalShortcut</code> 模块具有以下方法:</p>\n<h3 id=\"globalshortcutregisteraccelerator-callback\"><a href=\"#globalshortcutregisteraccelerator-callback\"><code>globalShortcut.register(accelerator, callback)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n<li><code>callback</code> Function</li>\n</ul>\n<p>返回<code>Boolean</code> - 快捷键注册是否成功</p>\n<p>注册 <code>accelerator</code> 的全局快捷键。 当用户按下注册快捷键时， <code>callback</code> 会被调用。</p>\n<p>如果指定的快捷键已经被其他应用程序注册掉, 调用会默默失败。 该特性由操作系统定义，因为操作系统不希望多个程序的全局快捷键互相冲突。</p>\n<p>在 macOS 10.14 Mojave 下面，如果 app 没有被授权为<a href=\"https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html\">可信任使用的客户端</a>，那么下列快捷键会注册失败：</p>\n<ul>\n<li>\"Media Play/Pause\"</li>\n<li>\"Media Next Track\"</li>\n<li>\"Media Previous Track\"</li>\n<li>\"Media Stop\"</li>\n</ul>\n<h3 id=\"globalshortcutregisterallaccelerators-callback\"><a href=\"#globalshortcutregisterallaccelerators-callback\"><code>globalShortcut.registerAll(accelerators, callback)</code></a></h3>\n<ul>\n<li><code>accelerators</code> String[] - an array of <a href=\"/docs/api/accelerator\">Accelerator</a>s.</li>\n<li><code>callback</code> Function</li>\n</ul>\n<p>Registers a global shortcut of all <code>accelerator</code> items in <code>accelerators</code>. 当用户按下注册快捷键时， <code>callback</code> 会被调用。</p>\n<p>如果定义的快捷键已经被其他应用占用，这个调用会失效。 该特性由操作系统定义，因为操作系统不希望多个程序的全局快捷键互相冲突。</p>\n<p>在 macOS 10.14 Mojave 下面，如果 app 没有被授权为<a href=\"https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html\">可信任使用的客户端</a>，那么下列快捷键会注册失败：</p>\n<ul>\n<li>\"Media Play/Pause\"</li>\n<li>\"Media Next Track\"</li>\n<li>\"Media Previous Track\"</li>\n<li>\"Media Stop\"</li>\n</ul>\n<h3 id=\"globalshortcutisregisteredaccelerator\"><a href=\"#globalshortcutisregisteredaccelerator\"><code>globalShortcut.isRegistered(accelerator)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n</ul>\n<p>返回 <code>Boolean</code> - 表示 <code>accelerator</code> 全局快捷键是否注册成功</p>\n<p>当快捷键已经被其他应用程序注册时, 此调用依然将返回 <code>false</code>。 该特性由操作系统定义，因为操作系统不希望多个程序的全局快捷键互相冲突。</p>\n<h3 id=\"globalshortcutunregisteraccelerator\"><a href=\"#globalshortcutunregisteraccelerator\"><code>globalShortcut.unregister(accelerator)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n</ul>\n<p>注销 <code>accelerator</code> 的全局快捷键。</p>\n<h3 id=\"globalshortcutunregisterall\"><a href=\"#globalshortcutunregisterall\"><code>globalShortcut.unregisterAll()</code></a></h3>\n<p>注销所有的全局快捷键（清空该应用程序的所有全局快捷键）。</p>",
      "title": "globalShortcut",
      "description": "在应用程序没有键盘焦点时，监听键盘事件。"
    },
    "/docs/glossary": {
      "locale": "zh-CN",
      "slug": "glossary",
      "href": "/docs/glossary",
      "crowdinFileId": "256123",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/glossary.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"词汇表\"><a href=\"#词汇表\">词汇表</a></h1>\n<p>这篇文档解释了一些经常在 Electron 开发中使用的专业术语。</p>\n<h3 id=\"asar\"><a href=\"#asar\">ASAR</a></h3>\n<p>ASAR 表示 Atom Shell Archive Format。 一个 <a href=\"https://github.com/electron/asar\">asar</a> 档案就是一个简单的 <code>tar</code> 文件 - 比如将那些有关联的文件放至一个单独的文件格式中。 Electron 能够任意读取其中的文件并且不需要解压整个文件。</p>\n<p>The ASAR format was created primarily to improve performance on Windows when reading large quantities of small files (e.g. when loading your app's JavaScript dependency tree from <code>node_modules</code>).</p>\n<h3 id=\"code-signing\"><a href=\"#code-signing\">code signing</a></h3>\n<p>Code signing is a process where an app developer digitally signs their code to ensure that it hasn't been tampered with after packaging. Both Windows and macOS implement their own version of code signing. As a desktop app developer, it's important that you sign your code if you plan on distributing it to the general public.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/code-signing\">Code Signing</a> tutorial.</p>\n<h3 id=\"context-isolation\"><a href=\"#context-isolation\">context isolation</a></h3>\n<p>Context isolation is a security measure in Electron that ensures that your preload script cannot leak privileged Electron or Node.js APIs to the web contents in your renderer process. With context isolation enabled, the only way to expose APIs from your preload script is through the <code>contextBridge</code> API.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/context-isolation\">Context Isolation</a> tutorial.</p>\n<p>See also: <a href=\"#preload-script\">preload script</a>, <a href=\"#renderer-process\">renderer process</a></p>\n<h3 id=\"crt\"><a href=\"#crt\">CRT</a></h3>\n<p>The C Runtime Library (CRT) is the part of the C++ Standard Library that incorporates the ISO C99 standard library. 实现了 CRT 的 Visual c++ 库支持本机代码开发, 以及混合的本机和托管代码, 以及用于. NET 开发的纯托管代码。</p>\n<h3 id=\"dmg\"><a href=\"#dmg\">DMG</a></h3>\n<p>是指在 macOS 上使用的苹果系统的磁盘镜像打包格式。 DMG 文件通常被用来分发应用的 \"installers\"。</p>\n<h3 id=\"ime\"><a href=\"#ime\">IME</a></h3>\n<p>输入法编辑器. 是一个允许用户输入在键盘上找不到的字符和符号的程序。 例如，使用户可以用拉丁语键盘输入中文，日文，韩文和印度文字。</p>\n<h3 id=\"idl\"><a href=\"#idl\">IDL</a></h3>\n<p>接口描述语言（Interface Description Language）。 Write function signatures and data types in a format that can be used to generate interfaces in Java, C++, JavaScript, etc.</p>\n<h3 id=\"ipc\"><a href=\"#ipc\">IPC</a></h3>\n<p>IPC stands for inter-process communication. Electron uses IPC to send serialized JSON messages between the main and renderer processes.</p>\n<p>参见： <a href=\"#main-process\">main process</a>, <a href=\"#renderer-process\">renderer process</a></p>\n<h3 id=\"main-process\"><a href=\"#main-process\">main process</a></h3>\n<p>主进程，通常是指 <code>main.js</code> 文件，是每个 Electron 应用的入口文件。 控制着整个应用的生命周期，从打开到关闭。 它也管理着系统原生元素比如菜单，菜单栏，Dock 栏，托盘等。 主进程负责创建 APP 的每一个渲染进程。 包含了全功能的 Node API。</p>\n<p>应用的主进程定义在 <code>package.json</code> 中的 <code>main</code> 属性中。 当您运行 <code>electron .</code> 时 Electron 便会知道需要运行哪个文件。</p>\n<p>在Chromium中，此进程被称为“浏览器进程”。 Electron 中这样称呼是为了不与渲染进程混淆。</p>\n<p>参见: <a href=\"#process\">process</a>, <a href=\"#renderer-process\">renderer process</a></p>\n<h3 id=\"mas\"><a href=\"#mas\">MAS</a></h3>\n<p>这是苹果 Mac App Store 的缩写。 有关如何提交您的应用到 MAS 上，请参见 <a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store Submission Guide</a>。</p>\n<h3 id=\"mojo\"><a href=\"#mojo\">Mojo</a></h3>\n<p>An IPC system for communicating intra- or inter-process, and that's important because Chrome is keen on being able to split its work into separate processes or not, depending on memory pressures etc.</p>\n<p>可参考<a href=\"https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md\">https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md</a></p>\n<p>See also: <a href=\"#ipc\">IPC</a></p>\n<h3 id=\"msi\"><a href=\"#msi\">MSI</a></h3>\n<p>On Windows, MSI packages are used by the Windows Installer (also known as Microsoft Installer) service to install and configure applications.</p>\n<p>More information can be found in <a href=\"https://docs.microsoft.com/en-us/windows/win32/msi/windows-installer-portal\">Microsoft's documentation</a>.</p>\n<h3 id=\"native-modules\"><a href=\"#native-modules\">native modules</a></h3>\n<p>原生模块（在 Node.js 中也称为 <a href=\"https://nodejs.org/api/addons.html\">addon</a>）是用C/C++写成的，可以在 Node.js 中加载，或通过 require() 函数在 Electron 中引入的模块。这些模块用起来与普通的Node.js模块并无二致。 它主要用于桥接在 JavaScript 上运行 Node.js 和 C/C++ 的库。</p>\n<p>Electron 支持原生的 Node 模块，但是 Electron 非常可能使用了和你系统中安装的Node所不一样的 V8 版本，所以在构建原生模块的时候你需要手动指定 Electron 所使用的头文件的位置。</p>\n<p>For more information, read the [Native Node Modules] tutorial.</p>\n<h3 id=\"notarization\"><a href=\"#notarization\">notarization</a></h3>\n<p>Notarization is a macOS-specific process where a developer can send a code-signed app to Apple servers to get verified for malicious components through an automated service.</p>\n<p>See also: <a href=\"#code-signing\">code signing</a></p>\n<h3 id=\"osr\"><a href=\"#osr\">OSR</a></h3>\n<p>OSR (offscreen rendering) can be used for loading heavy page in background and then displaying it after (it will be much faster). 这使您不必将页面显示到屏幕上也可以渲染它。</p>\n<p>For more information, read the <a href=\"/docs/tutorial/offscreen-rendering\">Offscreen Rendering</a>[osr] tutorial.</p>\n<h3 id=\"preload-script\"><a href=\"#preload-script\">preload script</a></h3>\n<p>Preload scripts contain code that executes in a renderer process before its web contents begin loading. These scripts run within the renderer context, but are granted more privileges by having access to Node.js APIs.</p>\n<p>See also: <a href=\"#renderer-process\">renderer process</a>, <a href=\"#context-isolation\">context isolation</a></p>\n<h3 id=\"process\"><a href=\"#process\">process</a></h3>\n<p>一个进程是计算机程序执行中的一个实例。 Electron 应用同时使用了<a href=\"#main-process\">main</a> 进程和一个或者多个 <a href=\"#renderer-process\">renderer</a> 进程来运行多个程序。</p>\n<p>在 Node.js 和 Electron 里面，每个运行的进程包含一个 <code>process</code> 对象。 这个对象作为一个全局的提供当前进程的相关信息和操作方法。 作为一个全局变量，它在应用内能够不用 require() 来随时取到。</p>\n<p>参见： <a href=\"#main-process\">main process</a>, <a href=\"#renderer-process\">renderer process</a></p>\n<h3 id=\"renderer-process\"><a href=\"#renderer-process\">renderer process</a></h3>\n<p>渲染进程是应用中的浏览器窗口。 与主进程不同，渲染进程可能同时存在多个，同时，每一个渲染进程都运行与独立的进程中。 渲染进程也可以隐藏。</p>\n<p>参见： <a href=\"#process\">process</a>, <a href=\"#main-process\">main process</a></p>\n<h3 id=\"sandbox\"><a href=\"#sandbox\">sandbox</a></h3>\n<p>The sandbox is a security feature inherited from Chromium that restricts your renderer processes to a limited set of permissions.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/sandbox\">Process Sandboxing</a> tutorial.</p>\n<p>See also: <a href=\"#process\">process</a></p>\n<h3 id=\"squirrel\"><a href=\"#squirrel\">Squirrel</a></h3>\n<p>Squirrel 是一个开源框架, 能够让 Electron 应用程序自动更新到最新发布的版本. 详见 <a href=\"/docs/api/auto-updater\">autoUpdater</a> API 了解如何开始使用 Squirrel。</p>\n<h3 id=\"userland\"><a href=\"#userland\">userland</a></h3>\n<p>\"userland\" 或者 \"userspace\" 术语起源于 Unix 社区，当程序运行在操作系统内核之外。 最近这个术语被推广到 Node 和 npm 社区，用于区分 \"Node 内核\"功能与在 npm 上注册的\"用户\" 们所发布的包的功能。</p>\n<p>就像 Node ，Electron 致力于使用较小的API集来支持开发跨平台应用所必需的原语。 这个设计理念让 Electron 能够保持灵活而不被过多的规定有关于如何应该被使用。 Userland 让用户能够创造和分享一些工具来提额外的功能在这个能够使用的 \"core（核心）\"之上。</p>\n<h3 id=\"v8\"><a href=\"#v8\">V8</a></h3>\n<p>V8 是谷歌开源的 JavaScript 引擎。 它是用 C++ 编写的，用于谷歌的 Chrome 浏览器。 V8 可以单独运行，也可以嵌入任何 C++ 应用程序。</p>\n<p>Electron将 V8 作为Chromium的一个部分进行构建，然后在构建Node时也指向那个 V8</p>\n<p>V8 的版本号与谷歌 Chrome 的版本号对应。 Chrome 59 的 V8 版本是 5.9，Chrome 58 的V8 版本是 5.8，以此类推。</p>\n<ul>\n<li><a href=\"https://v8.dev/\">v8.dev</a></li>\n<li><a href=\"https://nodejs.org/api/v8.html\">nodejs.org/api/v8.html</a></li>\n<li><a href=\"/docs/development/v8-development\">docs/development/v8-development.md</a></li>\n</ul>\n<h3 id=\"webview\"><a href=\"#webview\">webview</a></h3>\n<p><code>webview</code> 标签页用于在您的 Electron 应用中嵌入“访客”内容（例如外部网页）。 其功能与 <code>iframe</code> 类似，但 webview 运行于独立的进程中。 作为页面它拥有不一样的权限并且所有的嵌入的内容和你应用之间的交互都将是异步的。 这将保证你的应用对于嵌入的内容的安全性。</p>",
      "title": "词汇表",
      "description": ""
    },
    "/docs/development/goma": {
      "locale": "zh-CN",
      "slug": "goma",
      "href": "/docs/development/goma",
      "crowdinFileId": "256157",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/goma.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"goma\"><a href=\"#goma\">Goma</a></h1>\n<blockquote>\n<p>Goma是一款很多开源项目都在使用的分布式编译服务，例如Chromium和Android。</p>\n</blockquote>\n<p>Electron has a deployment of a custom Goma Backend that we make available to all Electron Maintainers.  See the <a href=\"#access\">Access</a> section below for details on authentication.  There is also a <code>cache-only</code> Goma endpoint that will be used by default if you do not have credentials.  Requests to the cache-only Goma will not hit our cluster, but will read from our cache and should result in significantly faster build times.</p>\n<h2 id=\"enabling-goma\"><a href=\"#enabling-goma\">Enabling Goma</a></h2>\n<p>Currently the only supported way to use Goma is to use our <a href=\"https://github.com/electron/build-tools\">Build Tools</a>. Goma configuration is automatically included when you set up <code>build-tools</code>.</p>\n<p>If you are a maintainer and have access to our cluster, please ensure that you run <code>e init</code> with <code>--goma=cluster</code> in order to configure <code>build-tools</code> to use the Goma cluster.  If you have an existing config, you can just set <code>\"goma\": \"cluster\"</code> in your config file.</p>\n<h2 id=\"building-with-goma\"><a href=\"#building-with-goma\">Building with Goma</a></h2>\n<p>When you are using Goma you can run <code>ninja</code> with a substantially higher <code>j</code> value than would normally be supported by your machine.</p>\n<p>Please do not set a value higher than <strong>200</strong> on Windows or Linux and <strong>50</strong> on macOS. We monitor Goma system usage, and users found to be abusing it with unreasonable concurrency will be de-activated.</p>\n<pre><code class=\"hljs language-bash\">ninja -C out/Testing electron -j 200\n</code></pre>\n<p>If you're using <code>build-tools</code>, appropriate <code>-j</code> values will automatically be used for you.</p>\n<h2 id=\"monitoring-goma\"><a href=\"#monitoring-goma\">Monitoring Goma</a></h2>\n<p>If you access <a href=\"http://localhost:8088\">http://localhost:8088</a> on your local machine you can monitor compile jobs as they flow through the goma system.</p>\n<h2 id=\"访问\"><a href=\"#访问\">访问</a></h2>\n<p>For security and cost reasons, access to Electron's Goma cluster is currently restricted to Electron Maintainers.  If you want access please head to <code>#access-requests</code> in Slack and ping <code>@goma-squad</code> to ask for access.  Please be aware that being a maintainer does not <em>automatically</em> grant access and access is determined on a case by case basis.</p>\n<h2 id=\"uptime--support\"><a href=\"#uptime--support\">Uptime / Support</a></h2>\n<p>We have automated monitoring of our Goma cluster and cache at <a href=\"https://status.notgoma.com\">https://status.notgoma.com</a></p>\n<p>We do not provide support for usage of Goma and any issues raised asking for help / having issues will <em>probably</em> be closed without much reason, we do not have the capacity to handle that kind of support.</p>",
      "title": "Goma",
      "description": "Goma是一款很多开源项目都在使用的分布式编译服务，例如Chromium和Android。"
    },
    "/docs/api/structures/gpu-feature-status": {
      "locale": "zh-CN",
      "slug": "gpu-feature-status",
      "href": "/docs/api/structures/gpu-feature-status",
      "crowdinFileId": "256439",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/gpu-feature-status.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"gpufeaturestatus-object\"><a href=\"#gpufeaturestatus-object\">GPUFeatureStatus Object</a></h1>\n<ul>\n<li><code>2d_canvas</code> String - Canvas.</li>\n<li><code>flash_3d</code> String - Flash.</li>\n<li><code>flash_stage3d</code> String - Flash Stage3D.</li>\n<li><code>flash_stage3d_baseline</code> String - Flash Stage3D Baseline profile.</li>\n<li><code>gpu_compositing</code> String - Compositing.</li>\n<li><code>multiple_raster_threads</code> String - Multiple Raster Threads.</li>\n<li><code>native_gpu_memory_buffers</code> String - Native GpuMemoryBuffers.</li>\n<li><code>rasterization</code> String - Rasterization.</li>\n<li><code>video_decode</code> String - Video Decode.</li>\n<li><code>video_encode</code> String - Video Encode.</li>\n<li><code>vpx_decode</code> String - VPx Video Decode.</li>\n<li><code>webgl</code> String - WebGL.</li>\n<li><code>webgl2</code> String - WebGL2.</li>\n</ul>\n<p>可选值：</p>\n<ul>\n<li><code>disabled_software</code> - Software only. Hardware acceleration disabled (yellow)</li>\n<li><code>disabled_off</code> - Disabled (red)</li>\n<li><code>disabled_off_ok</code> - Disabled (yellow)</li>\n<li><code>unavailable_software</code> - Software only, hardware acceleration unavailable (yellow)</li>\n<li><code>unavailable_off</code> - Unavailable (red)</li>\n<li><code>unavailable_off_ok</code> - Unavailable (yellow)</li>\n<li><code>enabled_readback</code> - Hardware accelerated but at reduced performance (yellow)</li>\n<li><code>enabled_force</code> - Hardware accelerated on all pages (green)</li>\n<li><code>enabled</code> - Hardware accelerated (green)</li>\n<li><code>enabled_on</code> - Enabled (green)</li>\n<li><code>enabled_force_on</code> - Force enabled (green)</li>\n</ul>",
      "title": "GPUFeatureStatus Object",
      "description": ""
    },
    "/docs/api/structures/hid-device": {
      "locale": "zh-CN",
      "slug": "hid-device",
      "href": "/docs/api/structures/hid-device",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/hid-device.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"hiddevice-object\"><a href=\"#hiddevice-object\">HIDDevice Object</a></h1>\n<ul>\n<li><code>deviceId</code> String - Unique identifier for the device.</li>\n<li><code>name</code> String - Name of the device.</li>\n<li><code>vendorId</code> Integer - The USB vendor ID.</li>\n<li><code>productId</code> Integer - The USB product ID.</li>\n<li><code>serialNumber</code> String (optional) - The USB device serial number.</li>\n<li><code>guid</code> String (optional) - Unique identifier for the HID interface.  A device may have multiple HID interfaces.</li>\n</ul>",
      "title": "HIDDevice Object",
      "description": ""
    },
    "/docs/api/in-app-purchase": {
      "locale": "zh-CN",
      "slug": "in-app-purchase",
      "href": "/docs/api/in-app-purchase",
      "crowdinFileId": "256325",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/in-app-purchase.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"inapppurchase\"><a href=\"#inapppurchase\">inAppPurchase</a></h1>\n<blockquote>\n<p>Mac App Store中的应用内购买</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<h2 id=\"事件\"><a href=\"#事件\">事件</a></h2>\n<p><code>inAppPurchase</code> 模块触发以下事件:</p>\n<h3 id=\"事件：transactions-updated\"><a href=\"#事件：transactions-updated\">事件：'transactions-updated'</a></h3>\n<p>一个或多个 transactions 更新时会触发这一事件。</p>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>transactions</code> Transaction[] - Array of <a href=\"/docs/api/structures/transaction\"><code>Transaction</code></a> objects.</li>\n</ul>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>inAppPurchase</code> 模块包含以下方法：</p>\n<h3 id=\"inapppurchasepurchaseproductproductid-quantity\"><a href=\"#inapppurchasepurchaseproductproductid-quantity\"><code>inAppPurchase.purchaseProduct(productID[, quantity])</code></a></h3>\n<ul>\n<li><code>productID</code> String - 预付款商品的ID (<code>com.example.app.product1</code> 的ID是 <code>product1</code>).</li>\n<li><code>quantity</code> Integer (可选) - 用户所要购买的商品数量.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Boolean></code> - Returns <code>true</code> if the product is valid and added to the payment queue.</p>\n<p>在调用<code>purchaseProduct</code>之前，你应该尽可能快的监听<code>transactions-updated</code>事件</p>\n<h3 id=\"inapppurchasegetproductsproductids\"><a href=\"#inapppurchasegetproductsproductids\"><code>inAppPurchase.getProducts(productIDs)</code></a></h3>\n<ul>\n<li><code>productIDs</code> String[] - 预购商品ID</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Product[]></code> - Resolves with an array of <a href=\"/docs/api/structures/product\"><code>Product</code></a> objects.</p>\n<p>检索商品的描述</p>\n<h3 id=\"inapppurchasecanmakepayments\"><a href=\"#inapppurchasecanmakepayments\"><code>inAppPurchase.canMakePayments()</code></a></h3>\n<p>Returns <code>Boolean</code> - whether a user can make a payment.</p>\n<h3 id=\"inapppurchaserestorecompletedtransactions\"><a href=\"#inapppurchaserestorecompletedtransactions\"><code>inAppPurchase.restoreCompletedTransactions()</code></a></h3>\n<p>Restores finished transactions. This method can be called either to install purchases on additional devices, or to restore purchases for an application that the user deleted and reinstalled.</p>\n<p><a href=\"https://developer.apple.com/documentation/storekit/skpaymentqueue?language=objc\">The payment queue</a> delivers a new transaction for each previously completed transaction that can be restored. Each transaction includes a copy of the original transaction.</p>\n<h3 id=\"inapppurchasegetreceipturl\"><a href=\"#inapppurchasegetreceipturl\"><code>inAppPurchase.getReceiptURL()</code></a></h3>\n<p>Returns <code>String</code> - the path to the receipt.</p>\n<h3 id=\"inapppurchasefinishalltransactions\"><a href=\"#inapppurchasefinishalltransactions\"><code>inAppPurchase.finishAllTransactions()</code></a></h3>\n<p>完成所有待处理的交易</p>\n<h3 id=\"inapppurchasefinishtransactionbydatedate\"><a href=\"#inapppurchasefinishtransactionbydatedate\"><code>inAppPurchase.finishTransactionByDate(date)</code></a></h3>\n<ul>\n<li><code>date</code> String - 待完成交易的ISO标准日期格式</li>\n</ul>\n<p>完成与日期对应的待处理事务</p>",
      "title": "inAppPurchase",
      "description": "Mac App Store中的应用内购买"
    },
    "/docs/tutorial/in-app-purchases": {
      "locale": "zh-CN",
      "slug": "in-app-purchases",
      "href": "/docs/tutorial/in-app-purchases",
      "crowdinFileId": "256203",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/in-app-purchases.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"in-app-purchases-macos\"><a href=\"#in-app-purchases-macos\">In-App Purchases (macOS)</a></h1>\n<h2 id=\"准备工作\"><a href=\"#准备工作\">准备工作</a></h2>\n<h3 id=\"付费应用协议\"><a href=\"#付费应用协议\">付费应用协议</a></h3>\n<p>如果你还没有，你需要在 iTunes Connect 签署付费应用协议, 并设置您的银行和税务信息。</p>\n<p><a href=\"https://help.apple.com/itunes-connect/developer/#/devb6df5ee51\">iTunes Connect 开发人员帮助: 协议、税务和银行概述</a></p>\n<h3 id=\"创建您的应用内购买\"><a href=\"#创建您的应用内购买\">创建您的应用内购买</a></h3>\n<p>然后，您需要在iTunes Connect中配置您的应用内购买，并包含名称，定价和说明等详细信息，以突出显示您的应用内购买的功能。</p>\n<p><a href=\"https://help.apple.com/itunes-connect/developer/#/devae49fb316\">iTunes Connect开发人员帮助：创建应用程序内购买</a></p>\n<h3 id=\"变更-cfbundleidentifier\"><a href=\"#变更-cfbundleidentifier\">变更 CFBundleIdentifier</a></h3>\n<p>若要在Electron开发阶段对应用内购买功能进行测试，您必须在<code>node_modules/electron/dist/Electron.app/Contents/Info.plist</code>路径下修改<code>CFBundleIdentifier</code>。 您必须使用通过ITunes Connect创建的应用的bundle indentifier来替换掉<code>com.github.electron</code>。</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>CFBundleIdentifier<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>com.example.app<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n</code></pre>\n<h2 id=\"代码示例\"><a href=\"#代码示例\">代码示例</a></h2>\n<p>通过下面的例子来了解如何在Electron中使用应用内购买功能。 您必须使用通过ITunes Connect创建的产品的唯一标识 （ID）来替换掉下面示例中的PRODUCT_IDS。( <code>com.example.app.product1</code> 的ID是 <code>product1</code>)。 请注意，您必须尽可能早的在你的应用中监听<code>transactions-updated</code>事件。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { inAppPurchase } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> PRODUCT_IDS = [<span class=\"hljs-string\">'id1'</span>, <span class=\"hljs-string\">'id2'</span>]\n\n<span class=\"hljs-comment\">// Listen for transactions as soon as possible.</span>\ninAppPurchase.on(<span class=\"hljs-string\">'transactions-updated'</span>, (event, transactions) => {\n  <span class=\"hljs-keyword\">if</span> (!<span class=\"hljs-built_in\">Array</span>.isArray(transactions)) {\n    <span class=\"hljs-keyword\">return</span>\n  }\n\n  <span class=\"hljs-comment\">// 检查每一笔交易.</span>\n  transactions.forEach(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\">transaction</span>) </span>{\n    <span class=\"hljs-keyword\">const</span> payment = transaction.payment\n\n    <span class=\"hljs-keyword\">switch</span> (transaction.transactionState) {\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'purchasing'</span>:\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Purchasing <span class=\"hljs-subst\">${payment.productIdentifier}</span>...`</span>)\n        <span class=\"hljs-keyword\">break</span>\n\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'purchased'</span>: {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${payment.productIdentifier}</span> purchased.`</span>)\n\n        <span class=\"hljs-comment\">// Get the receipt url.</span>\n        <span class=\"hljs-keyword\">const</span> receiptURL = inAppPurchase.getReceiptURL()\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Receipt URL: <span class=\"hljs-subst\">${receiptURL}</span>`</span>)\n\n        <span class=\"hljs-comment\">// Submit the receipt file to the server and check if it is valid.</span>\n        <span class=\"hljs-comment\">// @see https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html</span>\n        <span class=\"hljs-comment\">// ...</span>\n        <span class=\"hljs-comment\">// 如果收据通过校验，说明产品已经被购买了</span>\n        <span class=\"hljs-comment\">// ...</span>\n\n        <span class=\"hljs-comment\">// 交易完成.</span>\n        inAppPurchase.finishTransactionByDate(transaction.transactionDate)\n\n        <span class=\"hljs-keyword\">break</span>\n      }\n\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'failed'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Failed to purchase <span class=\"hljs-subst\">${payment.productIdentifier}</span>.`</span>)\n\n        <span class=\"hljs-comment\">// Finish the transaction.</span>\n        inAppPurchase.finishTransactionByDate(transaction.transactionDate)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'restored'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The purchase of <span class=\"hljs-subst\">${payment.productIdentifier}</span> has been restored.`</span>)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'deferred'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The purchase of <span class=\"hljs-subst\">${payment.productIdentifier}</span> has been deferred.`</span>)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-attr\">default</span>:\n        <span class=\"hljs-keyword\">break</span>\n    }\n  })\n})\n\n<span class=\"hljs-comment\">// 检查用户是否允许当前app启用应用内购买功能.</span>\n<span class=\"hljs-keyword\">if</span> (!inAppPurchase.canMakePayments()) {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The user is not allowed to make in-app purchase.'</span>)\n}\n\n<span class=\"hljs-comment\">// Retrieve and display the product descriptions.</span>\ninAppPurchase.getProducts(PRODUCT_IDS).then(<span class=\"hljs-function\"><span class=\"hljs-params\">products</span> =></span> {\n  <span class=\"hljs-comment\">// 检查参数.</span>\n  <span class=\"hljs-keyword\">if</span> (!<span class=\"hljs-built_in\">Array</span>.isArray(products) || products.length &#x3C;= <span class=\"hljs-number\">0</span>) {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Unable to retrieve the product informations.'</span>)\n    <span class=\"hljs-keyword\">return</span>\n  }\n\n  <span class=\"hljs-comment\">// Display the name and price of each product.</span>\n  products.forEach(<span class=\"hljs-function\"><span class=\"hljs-params\">product</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The price of <span class=\"hljs-subst\">${product.localizedTitle}</span> is <span class=\"hljs-subst\">${product.formattedPrice}</span>.`</span>)\n  })\n\n  <span class=\"hljs-comment\">// 询问用户需要购买哪个产品.</span>\n  <span class=\"hljs-keyword\">const</span> selectedProduct = products[<span class=\"hljs-number\">0</span>]\n  <span class=\"hljs-keyword\">const</span> selectedQuantity = <span class=\"hljs-number\">1</span>\n\n  <span class=\"hljs-comment\">// Purchase the selected product.</span>\n  inAppPurchase.purchaseProduct(selectedProduct.productIdentifier, selectedQuantity).then(<span class=\"hljs-function\"><span class=\"hljs-params\">isProductValid</span> =></span> {\n    <span class=\"hljs-keyword\">if</span> (!isProductValid) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The product is not valid.'</span>)\n      <span class=\"hljs-keyword\">return</span>\n    }\n\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The payment has been added to the payment queue.'</span>)\n  })\n})\n</code></pre>",
      "title": "In-App Purchases (macOS)",
      "description": ""
    },
    "/docs/api/incoming-message": {
      "locale": "zh-CN",
      "slug": "incoming-message",
      "href": "/docs/api/incoming-message",
      "crowdinFileId": "256327",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/incoming-message.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类：incomingmessage\"><a href=\"#类：incomingmessage\">类：IncomingMessage</a></h2>\n<blockquote>\n<p>处理 HTTP/HTTPS 请求的响应。</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>ClientRequest</code>实现了<a href=\"https://nodejs.org/api/stream.html#stream_readable_streams\">Readable Stream</a>接口, 因此是一个<a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>类型.</p>\n<h3 id=\"实例事件\"><a href=\"#实例事件\">实例事件</a></h3>\n<h4 id=\"event-data\"><a href=\"#event-data\">Event: 'data'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>chunk</code> 缓冲区: 响应体数据块。</li>\n</ul>\n<p><code>data</code>事件是将响应数据转换为应用程序代码的常用方法。</p>\n<h4 id=\"event-end\"><a href=\"#event-end\">Event: 'end'</a></h4>\n<p>指示响应正文已结束。 必须在 'data' 事件之前放置。</p>\n<h4 id=\"event-aborted\"><a href=\"#event-aborted\">Event: 'aborted'</a></h4>\n<p>正在进行的 HTTP 事务被取消后触发。</p>\n<h4 id=\"event-error\"><a href=\"#event-error\">Event: 'error'</a></h4>\n<p>返回:</p>\n<p><code>error</code> 通常保存一个错误字符串，识别失败的根本原因。</p>\n<p>当流响应数据事件遇到错误时发出。 例如, 如果服务器在响应仍在流时关闭基础, 则会在响应对象上发出一个 <code>error</code> 事件, 随后将在请求对象上执行 <code>close</code> 事件。</p>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<p><code>IncomingMessage</code> 实例具有以下可读属性:</p>\n<h4 id=\"responsestatuscode\"><a href=\"#responsestatuscode\"><code>response.statusCode</code></a></h4>\n<p>一个指示 HTTP 响应状态代码的 <code>Integer</code>。</p>\n<h4 id=\"responsestatusmessage\"><a href=\"#responsestatusmessage\"><code>response.statusMessage</code></a></h4>\n<p>表示HTTP状态消息的<code>string</code>。</p>\n<h4 id=\"responseheaders\"><a href=\"#responseheaders\"><code>response.headers</code></a></h4>\n<p>A <code>Record&#x3C;string, string | string[]></code> 代表HTTP响应头。 <code>headers</code>对象格式如下：</p>\n<ul>\n<li>所有的头文件名是小写的。</li>\n<li>以下 header 名均不可重复定义： <br> <code>age</code>, <code>authorization</code>, <br> <code>content-length</code>, <code>content-type</code>, <br> <code>etag</code>, <code>expires</code>, <br> <code>from</code>, <br> <code>host</code>, <br> <code>if-modified-since</code>, <code>if-unmodified-since</code>, <br> <code>last-modified</code>, <code>location</code>, <br> <code>max-forwards</code>, <br> <code>proxy-authorization</code>, <br> <code>referer</code>,<code>retry-after</code>, <br> <code>server</code>, <br> <code>user-agent</code></li>\n<li><code>set-cookie</code> 永远是一个数组。 重复项被添加到数组内。</li>\n<li>对于重复的 <code>cookie</code> 头，对应的值会用 '; ' 连接</li>\n<li>所有其他 header 的值通过 ',' 连接</li>\n</ul>\n<h4 id=\"responsehttpversion\"><a href=\"#responsehttpversion\"><code>response.httpVersion</code></a></h4>\n<p>表示HTTP协议版本号的 <code>String</code> 。 一般是“1”或“1.1”。 此外 <code>httpVersionMajor</code> 和<code>httpVersionMinor</code> 两整数值可读属性，分别返回HTTP的主要和次要版本号</p>\n<h4 id=\"responsehttpversionmajor\"><a href=\"#responsehttpversionmajor\"><code>response.httpVersionMajor</code></a></h4>\n<p>表示HTTP协议主要版本号的 <code>整数</code>。</p>\n<h4 id=\"responsehttpversionminor\"><a href=\"#responsehttpversionminor\"><code>response.httpVersionMinor</code></a></h4>\n<p>表示http协议次要版本号的<code>整数</code>。</p>",
      "title": "类：IncomingMessage",
      "description": "处理 HTTP/HTTPS 请求的响应。"
    },
    "/docs/api/structures/input-event": {
      "locale": "zh-CN",
      "slug": "input-event",
      "href": "/docs/api/structures/input-event",
      "crowdinFileId": "256441",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"inputevent-object\"><a href=\"#inputevent-object\">InputEvent Object</a></h1>\n<ul>\n<li><code>modifiers</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of modifiers of the event, can be <code>shift</code>, <code>control</code>, <code>ctrl</code>, <code>alt</code>, <code>meta</code>, <code>command</code>, <code>cmd</code>, <code>isKeypad</code>, <code>isAutoRepeat</code>, <code>leftButtonDown</code>, <code>middleButtonDown</code>, <code>rightButtonDown</code>, <code>capsLock</code>, <code>numLock</code>, <code>left</code>, <code>right</code>.</li>\n</ul>",
      "title": "InputEvent Object",
      "description": ""
    },
    "/docs/tutorial/installation": {
      "locale": "zh-CN",
      "slug": "installation",
      "href": "/docs/tutorial/installation",
      "crowdinFileId": "256205",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/installation.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"advanced-installation-instructions\"><a href=\"#advanced-installation-instructions\">Advanced Installation Instructions</a></h1>\n<p>要安装预编译的 Electron 二进制文件，请使用 <a href=\"https://docs.npmjs.com\"><code>npm</code></a>。 首选方法是在你的应用程序中安装 Electron 作为开发依赖：</p>\n<pre><code class=\"hljs language-sh\">npm install electron --save-dev\n</code></pre>\n<p>查看<a href=\"/docs/tutorial/electron-versioning\">versioning doc</a>获取如何在你的应用中管理Electron的相关信息。</p>\n<h2 id=\"运行-electron-ad-hoc\"><a href=\"#运行-electron-ad-hoc\">运行 Electron ad-hoc</a></h2>\n<p>如果你不想在本地工程上使用 <code>npm install</code> 同时又没用其它选择时，你也可以使用 <code>npm</code> 捆绑的 <a href=\"https://docs.npmjs.com/cli/v7/commands/npx\"><code>npx</code></a> 命令来运行 Electron ad-hoc：</p>\n<pre><code class=\"hljs language-sh\">npx electron .\n</code></pre>\n<p>上面的命令会在当前工作目录下运行Electron。 需要注意的是，你的应用中的任何依赖将不会被安装。</p>\n<h2 id=\"自定义\"><a href=\"#自定义\">自定义</a></h2>\n<p>如果想修改下载安装的位版本(例如, 在<code>x64</code>机器上安装<code>ia32</code>位版本), 你可以使用npm install中的<code>--arch</code>标记，或者设置<code>npm_config_arch</code> 环境变量:</p>\n<pre><code class=\"hljs language-shell\">npm install --arch=ia32 electron\n</code></pre>\n<p>此外, 您还可以使用 <code>--platform</code> 来指定开发平台 (例如, <code>win32</code>、<code>linux</code> 等):</p>\n<pre><code class=\"hljs language-shell\">npm install --platform=win32 electron\n</code></pre>\n<h2 id=\"代理\"><a href=\"#代理\">代理</a></h2>\n<p>如果您需要使用 HTTP 代理，您需要设置 <code>ELECTRON_GET_USE_PROXY</code> 变量为 任何值。 附加额外的环境变量，取决于您的主机系统Node版本：</p>\n<ul>\n<li><a href=\"https://github.com/gajus/global-agent/blob/v2.1.5/README.md#environment-variables\">Node10及以上</a></li>\n<li><a href=\"https://github.com/np-maintain/global-tunnel/blob/v2.7.1/README.md#auto-config\">Node10前</a></li>\n</ul>\n<h2 id=\"自定义镜像和缓存\"><a href=\"#自定义镜像和缓存\">自定义镜像和缓存</a></h2>\n<p>在安装过程中，<code>electron</code> 模块会通过 <a href=\"https://github.com/electron/get\"><code>electron-download</code></a> 为您的平台下载 Electron 的预编译二进制文件。 这将通过访问 GitHub 的发布下载页面来完成 (<code>https://github.com/electron/electron/releases/tag/v$VERSION</code>, 这里的 <code>$VERSION</code> 是 Electron 的确切版本).</p>\n<p>如果您无法访问GitHub，或者您需要提供自定义构建，则可以通过提供镜像或现有的缓存目录来实现。</p>\n<h4 id=\"镜像\"><a href=\"#镜像\">镜像</a></h4>\n<p>您可以使用环境变量来覆盖基本 URL，查找 Electron 二进制文件的路径以及二进制文件名。 <code>electron/get</code> 使用的网址组成如下：</p>\n<pre><code class=\"hljs language-javascript\">url = ELECTRON_MIRROR + ELECTRON_CUSTOM_DIR + <span class=\"hljs-string\">'/'</span> + ELECTRON_CUSTOM_FILENAME\n</code></pre>\n<p>例如，使用一个中国的镜像：</p>\n<pre><code class=\"hljs language-shell\">ELECTRON_MIRROR=\"https://cdn.npm.taobao.org/dist/electron/\"\n</code></pre>\n<p>默认情况下，<code>ELECTRON_CUSTTOM_DIR</code>被设置为 <code>v$VERSION</code>。 要更改格式，请使用 <code>{{ version }}</code> 占位符。 例如，<code>version-{{ version }}</code> 被解析为 <code>version-5.0.0</code>, <code>{{ version }}</code> 被解析为 <code>5.0.0</code>， <code>v{{ version }}</code> 与默认值等价。 更具体的例子，使用中国非CDN镜像：</p>\n<pre><code class=\"hljs language-shell\">ELECTRON_MIRROR=\"https://npm.taobao.org/mirrors/electron/\"\nELECTRON_CUSTOM_DIR=\"{{ version }}\"\n</code></pre>\n<p>上述配置将从URL下载，例如<code>https://npm.taobao.org/mirrors/electron-v8.0.0-linux-x64.zip</code></p>\n<p>If your mirror serves artifacts with different checksums to the official Electron release you may have to set <code>ELECTRON_USE_REMOTE_CHECKSUMS=1</code> to force Electron to use the remote <code>SHASUMS256.txt</code> file to verify the checksum instead of the embedded checksums.</p>\n<h4 id=\"缓存\"><a href=\"#缓存\">缓存</a></h4>\n<p>或者，您可以覆盖本地缓存。 <code>electron-download</code> 会将下载的二进制文件缓存在本地目录中，不会增加网络负担。 您可以使用该缓存文件夹来提供 Electron 的定制版本，或者避免进行网络连接。</p>\n<ul>\n<li>Linux: <code>$XDG_CACHE_HOME</code> or <code>~/.cache/electron/</code></li>\n<li>macOS: <code>~/Library/Caches/electron/</code></li>\n<li>Windows: <code>$LOCALAPPDATA/electron/Cache</code> or <code>~/AppData/Local/electron/Cache/</code></li>\n</ul>\n<p>在使用旧版本 Electron 的环境中，您也可以在<code>~/.electron</code>中找到缓存。</p>\n<p>您也可以通过提供一个 <code>electron_config_cache</code> 环境变量来覆盖本地缓存位置。</p>\n<p>缓存中包含了以文本文件形式存储的带有校验和的版本官方zip文件。 典型的缓存可能看起来像这样：</p>\n<pre><code class=\"hljs language-sh\">├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9electron-v1.7.9-darwin-x64.zip\n│   └── electron-v1.7.9-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1electron-v1.8.1-darwin-x64.zip\n│   └── electron-v1.8.1-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1electron-v1.8.2-beta.1-darwin-x64.zip\n│   └── electron-v1.8.2-beta.1-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2electron-v1.8.2-beta.2-darwin-x64.zip\n│   └── electron-v1.8.2-beta.2-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3electron-v1.8.2-beta.3-darwin-x64.zip\n│   └── electron-v1.8.2-beta.3-darwin-x64.zip\n└── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3SHASUMS256.txt\n    └── SHASUMS256.txt\n</code></pre>\n<h2 id=\"跳过二进制包下载\"><a href=\"#跳过二进制包下载\">跳过二进制包下载</a></h2>\n<p>Under the hood, Electron's JavaScript API binds to a binary that contains its implementations. Because this binary is crucial to the function of any Electron app, it is downloaded by default in the <code>postinstall</code> step every time you install <code>electron</code> from the npm registry.</p>\n<p>However, if you want to install your project's dependencies but don't need to use Electron functionality, you can set the <code>ELECTRON_SKIP_BINARY_DOWNLOAD</code> environment variable to prevent the binary from being downloaded. For instance, this feature can be useful in continuous integration environments when running unit tests that mock out the <code>electron</code> module.</p>\n<pre><code class=\"hljs language-sh\">ELECRON_SKIP_BINARY_DOWNOAD=1 npm install\n</code></pre>\n<h2 id=\"故障排查\"><a href=\"#故障排查\">故障排查</a></h2>\n<p>在运行 <code>npm install electron</code> 时，有些用户会偶尔遇到安装问题。</p>\n<p>在大多数情况下，这些错误都是由网络问题导致，而不是因为 <code>electron</code> npm 包的问题。 如 <code>ELIFECYCLE</code>、<code>EAI_AGAIN</code>、<code>ECONNRESET</code> 和 <code>ETIMEDOUT</code> 等错误都是此类网络问题的标志。 最佳的解决方法是尝试切换网络，或是稍后再尝试安装。</p>\n<p>You can also attempt to download Electron directly from <a href=\"https://github.com/electron/electron/releases\">electron/electron/releases</a> if installing via <code>npm</code> is failing.</p>\n<p>如果安装失败并报错<code>EACCESS</code>，您可能需要<a href=\"https://docs.npmjs.com/getting-started/fixing-npm-permissions\">修复npm权限</a>。</p>\n<p>如果上述报错持续出现，<a href=\"https://docs.npmjs.com/misc/config#unsafe-perm\">unsafe-perm</a> 标志可能需要被设置为 true:</p>\n<pre><code class=\"hljs language-sh\">sudo npm install electron --unsafe-perm=<span class=\"hljs-literal\">true</span>\n</code></pre>\n<p>在较慢的网络上, 最好使用 <code>--verbose </code> 标志来显示下载进度:</p>\n<pre><code class=\"hljs language-sh\">npm install --verbose electron\n</code></pre>\n<p>如果需要强制重新下载文件, 并且 SHASUM 文件将 <code>force_no_cache</code> 环境变量设置为 <code>true</code>。</p>",
      "title": "Advanced Installation Instructions",
      "description": ""
    },
    "/docs/tutorial/introduction": {
      "locale": "zh-CN",
      "slug": "introduction",
      "href": "/docs/tutorial/introduction",
      "crowdinFileId": "256207",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/introduction.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"简介\"><a href=\"#简介\">简介</a></h1>\n<p>欢迎来到electron文档中心。 如果你第一次开发electron应用，可以阅读入门部分了解开发基础， 此外，你也可以直接浏览API文档</p>\n<h2 id=\"electron是什么？\"><a href=\"#electron是什么？\">Electron是什么？</a></h2>\n<p>Electron是一个使用 JavaScript、HTML 和 CSS 构建桌面应用程序的框架。 嵌入 <a href=\"https://www.chromium.org/\">Chromium</a> 和 <a href=\"https://nodejs.org/\">Node.js</a> 到 二进制的 Electron 允许您保持一个 JavaScript 代码代码库并创建 在Windows上运行的跨平台应用 macOS和Linux——不需要本地开发 经验。</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<p>熟悉该文档之前，需要你有Node.js和web开发经验。 如果您需要了解这两个方面的开发知识，我们推荐您使用以下学习资源：</p>\n<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web\">来自Mozilla开发社区(Mozilla Developer Network)的web入门教程</a></li>\n<li><a href=\"https://nodejs.dev/learn\">NodeJS官方入门指南</a></li>\n</ul>\n<p>此外，如果您熟悉Chromium进程模型，您将更好了解 Electron 的工作原理。 You can get a brief overview of Chrome architecture with the <a href=\"https://www.google.com/googlebooks/chrome/\">Chrome comic</a>, which was released alongside Chrome's launch back in 2008. 尽管Chrome发布十多年了，【Chrome comic】漫画中介绍的核心原理仍然有助于理解Electron。</p>\n<h2 id=\"electron-fiddle运行实例\"><a href=\"#electron-fiddle运行实例\">Electron Fiddle运行实例</a></h2>\n<p><a href=\"https://electronjs.org/fiddle\">Electron Fiddle</a>是由Electron开发并由其维护者支持的沙盒程序。 我们强烈建议将其作为一个学习工具来安装，以便在开发过程中对Electron的api进行实验或对特性进行原型化。</p>\n<p>Fiddle 已经完美的集成到我们的帮助文档之中。 当你浏览我们tutorial中的例子的时候，你会发现有个\"Open In Electron Fiddler\" 按钮在代码示例中。 如果你已经安装了Fiddle, “Open In Electron Fiddle\" 按钮回打开一个<code>fiddle.electronjs.org</code>链接并加载示例。</p>\n<h2 id=\"寻求帮助\"><a href=\"#寻求帮助\">寻求帮助</a></h2>\n<p>还是有疑问？ 请参考一下例子</p>\n<ul>\n<li>开发过程中如果你需要帮助，我们的 <a href=\"https://discord.gg/electron\">community Discord server</a>将是绝佳讨论的地方。</li>\n<li>如果在开发过程中遇到 <code>electron</code> package里的疑难杂症，你可以去 <a href=\"https://github.com/electron/electron/issues\">GitHub issue tracker</a> 查看是否有人已经遇到相同的问题。 如果你很幸运的找到bug，欢迎提交issue到github。</li>\n</ul>",
      "title": "简介",
      "description": ""
    },
    "/docs/api/structures/io-counters": {
      "locale": "zh-CN",
      "slug": "io-counters",
      "href": "/docs/api/structures/io-counters",
      "crowdinFileId": "256443",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/io-counters.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"iocounters-object\"><a href=\"#iocounters-object\">IOCounters Object</a></h1>\n<ul>\n<li><code>readOperationCount</code> Number - The number of I/O read operations.</li>\n<li><code>writeOperationCount</code> Number - The number of I/O write operations.</li>\n<li><code>otherOperationCount</code> Number - Then number of I/O other operations.</li>\n<li><code>readTransferCount</code> Number - The number of I/O read transfers.</li>\n<li><code>writeTransferCount</code> Number - The number of I/O write transfers.</li>\n<li><code>otherTransferCount</code> Number - Then number of I/O other transfers.</li>\n</ul>",
      "title": "IOCounters Object",
      "description": ""
    },
    "/docs/api/ipc-main": {
      "locale": "zh-CN",
      "slug": "ipc-main",
      "href": "/docs/api/ipc-main",
      "crowdinFileId": "256329",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/ipc-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmain\"><a href=\"#ipcmain\">ipcMain</a></h1>\n<blockquote>\n<p>从主进程到渲染进程的异步通信。</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p><code>ipcRenderer</code> 是一个 <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a> 的实例。 当在主进程中使用时，它处理从渲染器进程（网页）发送出来的异步和同步信息。 从渲染器进程发送的消息将被发送到该模块。</p>\n<h2 id=\"发送消息\"><a href=\"#发送消息\">发送消息</a></h2>\n<p>也可以从主进程向渲染进程发送消息，查阅<a href=\"/docs/api/web-contents#contentssendchannel-args\">ebContents.send</a>获取更多信息。</p>\n<ul>\n<li>发送消息时，事件名称为<code>channel </code>。</li>\n<li>回复同步信息时，需要设置<code>event.returnValue</code>。</li>\n<li>可以使用<code>event.reply(...)</code>将异步消息发送回发送者。  此方法将自动处理从非主 frame 发送的消息(比如： iframes)。相应的发送方法是: <code>event.sender.send(...)</code> 它将总是把消息发送到主 frame</li>\n</ul>\n<p>下面是在渲染和主进程之间发送和处理消息的一个例子：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// 在主进程中.</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'asynchronous-message'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"ping\"</span>\n  event.reply(<span class=\"hljs-string\">'asynchronous-reply'</span>, <span class=\"hljs-string\">'pong'</span>)\n})\n\nipcMain.on(<span class=\"hljs-string\">'synchronous-message'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"ping\"</span>\n  event.returnValue = <span class=\"hljs-string\">'pong'</span>\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">//在渲染器进程 (网页) 中。</span>\n<span class=\"hljs-comment\">// NB. Electron APIs are only accessible from preload, unless contextIsolation is disabled.</span>\n<span class=\"hljs-comment\">// See https://www.electronjs.org/docs/tutorial/process-model#preload-scripts for more details.</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(ipcRenderer.sendSync(<span class=\"hljs-string\">'synchronous-message'</span>, <span class=\"hljs-string\">'ping'</span>)) <span class=\"hljs-comment\">// prints \"pong\"</span>\n\nipcRenderer.on(<span class=\"hljs-string\">'asynchronous-reply'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"pong\"</span>\n})\nipcRenderer.send(<span class=\"hljs-string\">'asynchronous-message'</span>, <span class=\"hljs-string\">'ping'</span>)\n</code></pre>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p>IpcMain模块有以下方法来侦听事件：</p>\n<h3 id=\"ipcmainonchannel-listener\"><a href=\"#ipcmainonchannel-listener\"><code>ipcMain.on(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>event</code> IpcMainEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>监听 channel, 当新消息到达，将通过 listener(event, args...) 调用 listener。</p>\n<h3 id=\"ipcmainoncechannel-listener\"><a href=\"#ipcmainoncechannel-listener\"><code>ipcMain.once(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>event</code> IpcMainEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>添加一次性 <code>listener</code> 函数。 这个 <code>listener</code> 只会在 <code>channel</code>下一次收到消息的时候被调用，之后这个监听器会被移除。</p>\n<h3 id=\"ipcmainremovelistenerchannel-listener\"><a href=\"#ipcmainremovelistenerchannel-listener\"><code>ipcMain.removeListener(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>为特定的 channel 从监听队列中删除特定的 listener 监听者.</p>\n<h3 id=\"ipcmainremovealllistenerschannel\"><a href=\"#ipcmainremovealllistenerschannel\"><code>ipcMain.removeAllListeners([channel])</code></a></h3>\n<ul>\n<li><code>channel</code> String (optional)</li>\n</ul>\n<p>移除所有指定 channel 的监听器； 若未指定 channel，则移除所有监听器。</p>\n<h3 id=\"ipcmainhandlechannel-listener\"><a href=\"#ipcmainhandlechannel-listener\"><code>ipcMain.handle(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function&#x3C;Promise\\<void> | any><ul>\n<li><code>event</code> IpcMainInvokeEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></void></li>\n</ul>\n<p>为一个 <code>invokeable</code>的IPC 添加一个handler。 每当一个渲染进程调用 <code>ipcRenderer.invoke(channel, ...args)</code> 时这个处理器就会被调用。</p>\n<p>如果 <code>listener</code> 返回一个 Promise，那么 Promise 的最终结果就是远程调用的返回值。 否则， 监听器的返回值将被用来作为应答值。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 主进程</span>\nipcMain.handle(<span class=\"hljs-string\">'my-invokable-ipc'</span>, <span class=\"hljs-keyword\">async</span> (event, ...args) => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> somePromise(...args)\n  <span class=\"hljs-keyword\">return</span> result\n})\n\n<span class=\"hljs-comment\">// 渲染进程</span>\n<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> ipcRenderer.invoke(<span class=\"hljs-string\">'my-invokable-ipc'</span>, arg1, arg2)\n  <span class=\"hljs-comment\">// ...</span>\n}\n</code></pre>\n<p>传递给处理器的第一个参数的 <code>event</code> 与传递给常规事件侦听器的相同。 里面包含了哪些 WebContents 是调用请求的来源</p>\n<p>通过<code>handle</code>在主线程抛出的异常并不易读，那是因为他们已经被序列化了。只有原始错误中的 <code>message</code> 属性可提供给渲染进程。 详情请参阅 <a href=\"https://github.com/electron/electron/issues/24427\">#24427</a></p>\n<h3 id=\"ipcmainhandleoncechannel-listener\"><a href=\"#ipcmainhandleoncechannel-listener\"><code>ipcMain.handleOnce(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function&#x3C;Promise\\<void> | any><ul>\n<li><code>event</code> IpcMainInvokeEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></void></li>\n</ul>\n<p>处理单个 <code>invoke</code>able 可触发的 IPC 消息，然后移除侦听器。 详见 <code>ipcMain.handle(channel, listener)</code></p>\n<h3 id=\"ipcmainremovehandlerchannel\"><a href=\"#ipcmainremovehandlerchannel\"><code>ipcMain.removeHandler(channel)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n</ul>\n<p>移除 <code>channel</code>的所有处理程序，若存在。</p>\n<h2 id=\"ipcmainevent-object\"><a href=\"#ipcmainevent-object\">IpcMainEvent object</a></h2>\n<p><code>callback</code> 的参数 <code>event</code> 对象文档可以在 <a href=\"/docs/api/structures/ipc-main-event\"><code>ipc-main-event</code></a> 一节找到。</p>\n<h2 id=\"ipcmaininvokeevent-object\"><a href=\"#ipcmaininvokeevent-object\">IpcMainInvokeEvent object</a></h2>\n<p><code>handle</code>回调参数<code>event</code>对象文档可以在<a href=\"/docs/api/structures/ipc-main-invoke-event\"><code>ipc-main-invoke-event</code></a>一节找到</p>",
      "title": "ipcMain",
      "description": "从主进程到渲染进程的异步通信。"
    },
    "/docs/api/structures/ipc-main-event": {
      "locale": "zh-CN",
      "slug": "ipc-main-event",
      "href": "/docs/api/structures/ipc-main-event",
      "crowdinFileId": "256445",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-main-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmainevent-object-extends-event\"><a href=\"#ipcmainevent-object-extends-event\">IpcMainEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>processId</code> Integer - The internal ID of the renderer process that sent this message</li>\n<li><code>frameId</code> Integer - The ID of the renderer frame that sent this message</li>\n<li><code>returnValue</code> any - Set this to the value to be returned in a synchronous message</li>\n<li><code>sender</code> WebContents - Returns the <code>webContents</code> that sent the message</li>\n<li><code>senderFrame</code> WebFrameMain <em>Readonly</em> - The frame that sent this message</li>\n<li><code>ports</code> MessagePortMain[] - A list of MessagePorts that were transferred with this message</li>\n<li><code>reply</code> Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling.  You should use this method to \"reply\" to the sent message in order to guarantee the reply will go to the correct process and frame.<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>",
      "title": "IpcMainEvent Object extends Event",
      "description": ""
    },
    "/docs/api/structures/ipc-main-invoke-event": {
      "locale": "zh-CN",
      "slug": "ipc-main-invoke-event",
      "href": "/docs/api/structures/ipc-main-invoke-event",
      "crowdinFileId": "256447",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-main-invoke-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmaininvokeevent-object-extends-event\"><a href=\"#ipcmaininvokeevent-object-extends-event\">IpcMainInvokeEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>processId</code> Integer - The internal ID of the renderer process that sent this message</li>\n<li><code>frameId</code> Integer - The ID of the renderer frame that sent this message</li>\n<li><code>sender</code> WebContents - Returns the <code>webContents</code> that sent the message</li>\n<li><code>senderFrame</code> WebFrameMain <em>Readonly</em> - The frame that sent this message</li>\n</ul>",
      "title": "IpcMainInvokeEvent Object extends Event",
      "description": ""
    },
    "/docs/api/ipc-renderer": {
      "locale": "zh-CN",
      "slug": "ipc-renderer",
      "href": "/docs/api/ipc-renderer",
      "crowdinFileId": "256331",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/ipc-renderer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcrenderer\"><a href=\"#ipcrenderer\">ipcRenderer</a></h1>\n<blockquote>\n<p>从渲染器进程到主进程的异步通信。</p>\n</blockquote>\n<p>进程: <a href=\"/docs/glossary#renderer-process\"> Renderer</a></p>\n<p><code>ipcRenderer</code> 是一个 <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a> 的实例。 你可以使用它提供的一些方法从渲染进程 (web 页面) 发送同步或异步的消息到主进程。 也可以接收主进程回复的消息。</p>\n<p>请从 <a href=\"/docs/api/ipc-main\">ipcMain</a> 查看代码示例。</p>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>ipcRenderer</code> 模块使用以下方法来监听事件和发送消息。</p>\n<h3 id=\"ipcrendereronchannel-listener\"><a href=\"#ipcrendereronchannel-listener\"><code>ipcRenderer.on(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>event</code> IpcRendererEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>监听 channel, 当新消息到达，将通过 listener(event, args...) 调用 listener。</p>\n<h3 id=\"ipcrendereroncechannel-listener\"><a href=\"#ipcrendereroncechannel-listener\"><code>ipcRenderer.once(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>event</code> IpcRendererEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>添加一次性 <code>listener</code> 函数。 这个 <code>listener</code> 只会在 <code>channel</code>下一次收到消息的时候被调用，之后这个监听器会被移除。</p>\n<h3 id=\"ipcrendererremovelistenerchannel-listener\"><a href=\"#ipcrendererremovelistenerchannel-listener\"><code>ipcRenderer.removeListener(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>为特定的 channel 从监听队列中删除特定的 listener 监听者.</p>\n<h3 id=\"ipcrendererremovealllistenerschannel\"><a href=\"#ipcrendererremovealllistenerschannel\"><code>ipcRenderer.removeAllListeners(channel)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n</ul>\n<p>移除所有的监听器，当指定 <code>channel</code> 时只移除与其相关的所有监听器。</p>\n<h3 id=\"ipcrenderersendchannel-args\"><a href=\"#ipcrenderersendchannel-args\"><code>ipcRenderer.send(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>通过<code>channel</code>向主进程发送异步消息，可以发送任意参数。 Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over Electron's IPC to the main process, as the main process would have no way to decode them. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>The main process handles it by listening for <code>channel</code> with the <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> module.</p>\n<p>If you need to transfer a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> to the main process, use <a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a>.</p>\n<p>If you want to receive a single response from the main process, like the result of a method call, consider using <a href=\"#ipcrendererinvokechannel-args\"><code>ipcRenderer.invoke</code></a>.</p>\n<h3 id=\"ipcrendererinvokechannel-args\"><a href=\"#ipcrendererinvokechannel-args\"><code>ipcRenderer.invoke(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - Resolves with the response from the main process.</p>\n<p>Send a message to the main process via <code>channel</code> and expect a result asynchronously. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over Electron's IPC to the main process, as the main process would have no way to decode them. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>The main process should listen for <code>channel</code> with <a href=\"/docs/api/ipc-main#ipcmainhandlechannel-listener\"><code>ipcMain.handle()</code></a>.</p>\n<p>例如：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.invoke(<span class=\"hljs-string\">'some-name'</span>, someArgument).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">result</span>) =></span> {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// Main process</span>\nipcMain.handle(<span class=\"hljs-string\">'some-name'</span>, <span class=\"hljs-keyword\">async</span> (event, someArgument) => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> doSomeWork(someArgument)\n  <span class=\"hljs-keyword\">return</span> result\n})\n</code></pre>\n<p>If you need to transfer a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> to the main process, use <a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a>.</p>\n<p>如果你不需要回复此消息，请考虑使用 <a href=\"#ipcrenderersendchannel-args\"><code>ipcRender.sent</code></a>。</p>\n<h3 id=\"ipcrenderersendsyncchannel-args\"><a href=\"#ipcrenderersendsyncchannel-args\"><code>ipcRenderer.sendSync(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>返回 <code>any</code> - 由 <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> 处理程序发送过来的值。</p>\n<p>Send a message to the main process via <code>channel</code> and expect a result synchronously. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over Electron's IPC to the main process, as the main process would have no way to decode them. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>主进程可以使用 <code>ipcMain</code> 监听 <a href=\"/docs/api/ipc-main\">channel</a>来接收这些消息，并通过 <code>event.returnValue </code>设置回复消息。</p>\n<blockquote>\n<p>⚠️ <strong>WARNING</strong>: Sending a synchronous message will block the whole renderer process until the reply is received, so use this method only as a last resort. It's much better to use the asynchronous version, <a href=\"/docs/api/ipc-renderer#ipcrendererinvokechannel-args\"><code>invoke()</code></a>.</p>\n</blockquote>\n<h3 id=\"ipcrendererpostmessagechannel-message-transfer\"><a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage(channel, message, [transfer])</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePort<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Send a message to the main process, optionally transferring ownership of zero or more <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> objects.</p>\n<p>The transferred <code>MessagePort</code> objects will be available in the main process as <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> objects by accessing the <code>ports</code> property of the emitted event.</p>\n<p>例如：</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Renderer process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannel()\nipcRenderer.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Main process</span>\nipcMain.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<p>For more information on using <code>MessagePort</code> and <code>MessageChannel</code>, see the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\">MDN documentation</a>.</p>\n<h3 id=\"ipcrenderersendtowebcontentsid-channel-args\"><a href=\"#ipcrenderersendtowebcontentsid-channel-args\"><code>ipcRenderer.sendTo(webContentsId, channel, ...args)</code></a></h3>\n<ul>\n<li><code>webContentsId</code> Number</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>通过 <code>channel</code> 发送消息到带有 <code>webContentsId</code> 的窗口.</p>\n<h3 id=\"ipcrenderersendtohostchannel-args\"><a href=\"#ipcrenderersendtohostchannel-args\"><code>ipcRenderer.sendToHost(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>就像 <code>ipcRenderer.send</code>，不同的是消息会被发送到 host 页面上的 <code>&#x3C;webview></code> 元素，而不是主进程。</p>\n<h2 id=\"事件对象\"><a href=\"#事件对象\">事件对象</a></h2>\n<p>The documentation for the <code>event</code> object passed to the <code>callback</code> can be found in the <a href=\"/docs/api/structures/ipc-renderer-event\"><code>ipc-renderer-event</code></a> structure docs.</p>",
      "title": "ipcRenderer",
      "description": "从渲染器进程到主进程的异步通信。"
    },
    "/docs/api/structures/ipc-renderer-event": {
      "locale": "zh-CN",
      "slug": "ipc-renderer-event",
      "href": "/docs/api/structures/ipc-renderer-event",
      "crowdinFileId": "256449",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-renderer-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcrendererevent-object-extends-event\"><a href=\"#ipcrendererevent-object-extends-event\">IpcRendererEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>sender</code> IpcRenderer - The <code>IpcRenderer</code> instance that emitted the event originally</li>\n<li><code>senderId</code> Integer - The <code>webContents.id</code> that sent the message, you can call <code>event.sender.sendTo(event.senderId, ...)</code> to reply to the message, see <a href=\"/docs/api/ipc-renderer#ipcrenderersendtowebcontentsid-channel-args\">ipcRenderer.sendTo</a> for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set <code>event.senderId</code> to <code>0</code>.</li>\n<li><code>ports</code> MessagePort[] - A list of MessagePorts that were transferred with this message</li>\n</ul>",
      "title": "IpcRendererEvent Object extends Event",
      "description": ""
    },
    "/docs/development/issues": {
      "locale": "zh-CN",
      "slug": "issues",
      "href": "/docs/development/issues",
      "crowdinFileId": "256159",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/issues.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"electron中的问题\"><a href=\"#electron中的问题\">Electron中的问题</a></h1>\n<ul>\n<li><a href=\"#how-to-contribute-to-issues\">Issue でコントリビュートする方法</a></li>\n<li><a href=\"#asking-for-general-help\">Https://crowdin.com/translate/electron/156/en-vi#12327</a></li>\n<li><a href=\"#submitting-a-bug-report\">提交漏洞报告</a></li>\n<li><a href=\"#triaging-a-bug-report\">鉴定漏洞报告</a></li>\n<li><a href=\"#resolving-a-bug-report\">解决漏洞报告</a></li>\n</ul>\n<h2 id=\"issue-でコントリビュートする方法\"><a href=\"#issue-でコントリビュートする方法\">Issue でコントリビュートする方法</a></h2>\n<p>对于任何问题，个人可以通过三种方式贡献：</p>\n<ol>\n<li>By opening the issue for discussion: If you believe that you have found a new bug in Electron, you should report it by creating a new issue in the <a href=\"https://github.com/electron/electron/issues\"><code>electron/electron</code> issue tracker</a>.</li>\n<li>通过帮助鉴定问题：您可以通过提供辅助信息（一种可以让漏洞被发现的情况）或提出解决问题的建议。</li>\n<li>通过帮助解决问题：这可以通过演示问题不是一个bug或已修复来完成；但更通常，打开一个通过一个具体和可审查的方式改变<code>electron/electron</code>中的源代码的拉取请求。</li>\n</ol>\n<h2 id=\"httpscrowdincomtranslateelectron156en-vi12327\"><a href=\"#httpscrowdincomtranslateelectron156en-vi12327\"></a><a href=\"Https://crowdin.com/translate/electron/156/en-vi#12327\">Https://crowdin.com/translate/electron/156/en-vi#12327</a></h2>\n<p><a href=\"/docs/tutorial/support#finding-support\">\"Finding Support\"</a> has a list of resources for getting programming help, reporting security issues, contributing, and more. 请仅对漏洞使用问题追踪器！</p>\n<h2 id=\"提交漏洞报告\"><a href=\"#提交漏洞报告\">提交漏洞报告</a></h2>\n<p>To submit a bug report:</p>\n<p>When opening a new issue in the <a href=\"https://github.com/electron/electron/issues/new/choose\"><code>electron/electron</code> issue tracker</a>, users will be presented with a template that should be filled in.</p>\n<p>如果你确信自己发现了Electron的bug，请尽可能详细的填写一份表单。</p>\n<p>要评估报告需要的两个最重要的部分是漏洞的描述和重现它的简单测试样例。 It is easier to fix a bug if it can be reproduced.</p>\n<p>参见 <a href=\"https://stackoverflow.com/help/mcve\">如何创建一个最小的，完整的和可验证的例子</a>。</p>\n<h2 id=\"鉴定漏洞报告\"><a href=\"#鉴定漏洞报告\">鉴定漏洞报告</a></h2>\n<p>提出问题经常会出现讨论。 贡献者会有不同的观点，包括提出的情况是一个漏洞还是一个功能。 这些讨论是解决问题的一部分，并且应该保持专注、有用、专业。</p>\n<p>没有任何内容和详细信息的简单回复是无用的而且不专业的。 在很多情况下，这些恢复是烦人而且不友好的。</p>\n<p>我们鼓励贡献者共同解决问题并互相帮助取得进展。 If you encounter an issue that you feel is invalid, or which contains incorrect information, explain <em>why</em> you feel that way with additional supporting context, and be willing to be convinced that you may be wrong. 通过这样做，我们可以更快地得到正确的结果。</p>\n<h2 id=\"解决漏洞报告\"><a href=\"#解决漏洞报告\">解决漏洞报告</a></h2>\n<p>大部分的问题是通过打开拉取请求解决的。 The process for opening and reviewing a pull request is similar to that of opening and triaging issues, but carries with it a necessary review and approval workflow that ensures that the proposed changes meet the minimal quality and functional guidelines of the Electron project.</p>",
      "title": "Electron中的问题",
      "description": ""
    },
    "/docs/api/structures/jump-list-category": {
      "locale": "zh-CN",
      "slug": "jump-list-category",
      "href": "/docs/api/structures/jump-list-category",
      "crowdinFileId": "256451",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/jump-list-category.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"jumplistcategory-object\"><a href=\"#jumplistcategory-object\">JumpListCategory Object</a></h1>\n<ul>\n<li><code>type</code> String (optional) - One of the following:<ul>\n<li><code>tasks</code> - Items in this category will be placed into the standard <code>Tasks</code> category. There can be only one such category, and it will always be displayed at the bottom of the Jump List.</li>\n<li><code>frequent</code> - Displays a list of files frequently opened by the app, the name of the category and its items are set by Windows.</li>\n<li><code>recent</code> - Displays a list of files recently opened by the app, the name of the category and its items are set by Windows. Items may be added to this category indirectly using <code>app.addRecentDocument(path)</code>.</li>\n<li><code>custom</code> - Displays tasks or file links, <code>name</code> must be set by the app.</li>\n</ul></li>\n<li><code>name</code> String (optional) - Must be set if <code>type</code> is <code>custom</code>, otherwise it should be omitted.</li>\n<li><code>items</code> JumpListItem<a href=\"/docs/api/structures/optional\"></a> - Array of <a href=\"/docs/api/structures/jump-list-item\"><code>JumpListItem</code></a> objects if <code>type</code> is <code>tasks</code> or <code>custom</code>, otherwise it should be omitted.</li>\n</ul>\n<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>\n<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>",
      "title": "JumpListCategory Object",
      "description": ""
    },
    "/docs/api/structures/jump-list-item": {
      "locale": "zh-CN",
      "slug": "jump-list-item",
      "href": "/docs/api/structures/jump-list-item",
      "crowdinFileId": "256453",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/jump-list-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"jumplistitem-object\"><a href=\"#jumplistitem-object\">JumpListItem Object</a></h1>\n<ul>\n<li><code>type</code> String (optional) - One of the following:<ul>\n<li><code>task</code> - A task will launch an app with specific arguments.</li>\n<li><code>separator</code> - Can be used to separate items in the standard <code>Tasks</code> category.</li>\n<li><code>file</code> - A file link will open a file using the app that created the Jump List, for this to work the app must be registered as a handler for the file type (though it doesn't have to be the default handler).</li>\n</ul></li>\n<li><code>path</code> String (optional) - Path of the file to open, should only be set if <code>type</code> is <code>file</code>.</li>\n<li><code>program</code> String (optional) - Path of the program to execute, usually you should specify <code>process.execPath</code> which opens the current program. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>args</code> String (optional) - The command line arguments when <code>program</code> is executed. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>title</code> String (optional) - The text to be displayed for the item in the Jump List. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>description</code> String (optional) - Description of the task (displayed in a tooltip). Should only be set if <code>type</code> is <code>task</code>. Maximum length 260 characters.</li>\n<li><code>iconPath</code> String (optional) - The absolute path to an icon to be displayed in a Jump List, which can be an arbitrary resource file that contains an icon (e.g. <code>.ico</code>, <code>.exe</code>, <code>.dll</code>). You can usually specify <code>process.execPath</code> to show the program icon.</li>\n<li><code>iconIndex</code> Number (optional) - The index of the icon in the resource file. If a resource file contains multiple icons this value can be used to specify the zero-based index of the icon that should be displayed for this task. If a resource file contains only one icon, this property should be set to zero.</li>\n<li><code>workingDirectory</code> String (optional) - The working directory. Default is empty.</li>\n</ul>",
      "title": "JumpListItem Object",
      "description": ""
    },
    "/docs/api/structures/keyboard-event": {
      "locale": "zh-CN",
      "slug": "keyboard-event",
      "href": "/docs/api/structures/keyboard-event",
      "crowdinFileId": "256455",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/keyboard-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"keyboardevent-object\"><a href=\"#keyboardevent-object\">KeyboardEvent Object</a></h1>\n<ul>\n<li><code>ctrlKey</code> Boolean (optional) - whether the Control key was used in an accelerator to trigger the Event</li>\n<li><code>metaKey</code> Boolean (optional) - whether a meta key was used in an accelerator to trigger the Event</li>\n<li><code>shiftKey</code> Boolean (optional) - whether a Shift key was used in an accelerator to trigger the Event</li>\n<li><code>altKey</code> Boolean (optional) - whether an Alt key was used in an accelerator to trigger the Event</li>\n<li><code>triggeredByAccelerator</code> Boolean (optional) - whether an accelerator was used to trigger the event as opposed to another user gesture like mouse click</li>\n</ul>",
      "title": "KeyboardEvent Object",
      "description": ""
    },
    "/docs/api/structures/keyboard-input-event": {
      "locale": "zh-CN",
      "slug": "keyboard-input-event",
      "href": "/docs/api/structures/keyboard-input-event",
      "crowdinFileId": "256457",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/keyboard-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"keyboardinputevent-object-extends-inputevent\"><a href=\"#keyboardinputevent-object-extends-inputevent\">KeyboardInputEvent Object extends <code>InputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>keyDown</code>, <code>keyUp</code> or <code>char</code>.</li>\n<li><code>keyCode</code> String - The character that will be sent as the keyboard event. Should only use the valid key codes in <a href=\"/docs/api/accelerator\">Accelerator</a>.</li>\n</ul>",
      "title": "KeyboardInputEvent Object extends InputEvent",
      "description": ""
    },
    "/docs/tutorial/keyboard-shortcuts": {
      "locale": "zh-CN",
      "slug": "keyboard-shortcuts",
      "href": "/docs/tutorial/keyboard-shortcuts",
      "crowdinFileId": "256209",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/keyboard-shortcuts.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"键盘快捷键\"><a href=\"#键盘快捷键\">键盘快捷键</a></h1>\n<h2 id=\"概览\"><a href=\"#概览\">概览</a></h2>\n<p>该功能允许你为 Electron 应用程序配置应用和全局键盘快捷键。</p>\n<h2 id=\"示例\"><a href=\"#示例\">示例</a></h2>\n<h3 id=\"本地快捷键\"><a href=\"#本地快捷键\">本地快捷键</a></h3>\n<p>应用键盘快捷键仅在应用程序被聚焦时触发。 为了配置本地快捷键，你需要在创建<a href=\"/docs/api/menu\">Menu</a>模块中的<a href=\"/docs/api/menu-item\">MenuItem</a>时指定`accelerator&#x3C;0>属性。</p><p></p>\n<p spaces-before=\"0\">从 <a href=\"quick-start.md\">Quick Start Guide</a> 中的应用开始，将以下内容更新到 <code>main.js`。</code></p><code> \n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/local\"><span class=\"hljs-keyword\">const</span> { Menu, MenuItem } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> menu = <span class=\"hljs-keyword\">new</span> Menu()\nmenu.append(<span class=\"hljs-keyword\">new</span> MenuItem({\n  <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Electron'</span>,\n  <span class=\"hljs-attr\">submenu</span>: [{\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'help'</span>,\n    <span class=\"hljs-attr\">accelerator</span>: process.platform === <span class=\"hljs-string\">'darwin'</span> ? <span class=\"hljs-string\">'Alt+Cmd+I'</span> : <span class=\"hljs-string\">'Alt+Shift+I'</span>,\n    <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Electron rocks!'</span>) }\n  }]\n}))\n\nMenu.setApplicationMenu(menu)\n</code></pre>\n<blockquote>\n<p>注意：在上面的代码中，您可以看到基于用户的操作系统的 accelerator  差异。 对于MacOS，是 <code>Alt+Cmd+I</code>，而对于Linux 和 Windows，则是 <code>Alt+Shift+I</code>.</p>\n</blockquote>\n<p>启动 Electron 应用程序后，你应该看到应用程序菜单以及您刚刚定义的本地快捷方式：</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/local-shortcut.png\" alt=\"Menu with a local shortcut\"></p>\n<p>If you click <code>Help</code> or press the defined accelerator and then open the terminal that you ran your Electron application from, you will see the message that was generated after triggering the <code>click</code> event: \"Electron rocks!\".</p>\n<h3 id=\"全局快捷键\"><a href=\"#全局快捷键\">全局快捷键</a></h3>\n<p>要配置全局键盘快捷键， 您需要使用 <a href=\"/docs/api/global-shortcut\">globalShortcon</a> 模块来检测键盘事件，即使应用程序没有获得键盘焦点。</p>\n<p>从 <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a> 中的应用开始，将以下内容更新到 <code>main.js</code>。</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/global\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  globalShortcut.register(<span class=\"hljs-string\">'Alt+CommandOrControl+I'</span>, () => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Electron loves global shortcuts!'</span>)\n  })\n}).then(createWindow)\n</code></pre>\n<blockquote>\n<p>NOTE: In the code above, the <code>CommandOrControl</code> combination uses <code>Command</code> on macOS and <code>Control</code> on Windows/Linux.</p>\n</blockquote>\n<p>After launching the Electron application, if you press the defined key combination then open the terminal that you ran your Electron application from, you will see that Electron loves global shortcuts!</p>\n<h3 id=\"在浏览器窗口内的快捷方式\"><a href=\"#在浏览器窗口内的快捷方式\">在浏览器窗口内的快捷方式</a></h3>\n<h4 id=\"使用-web-apis\"><a href=\"#使用-web-apis\">使用 web APIs</a></h4>\n<p>如果您想要在 <a href=\"/docs/api/browser-window\">BrowserWindow</a> 中处理键盘快捷键，你可以在渲染进程中使用 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\">addEventListener() API</a>来监听 <code>kepup</code> 和 <code>keydown</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/Events\">DOM事件</a>。</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/web-apis\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleKeyPress</span>(<span class=\"hljs-params\">event</span>) </span>{\n  <span class=\"hljs-comment\">// 你可以把处理按键按下事件的代码放在这里。</span>\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">\"last-keypress\"</span>).innerText = event.key;\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`你按下了 <span class=\"hljs-subst\">${event.key}</span>`</span>);\n}\n\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'keyup'</span>, handleKeyPress, <span class=\"hljs-literal\">true</span>);\n</code></pre>\n<blockquote>\n<p>注意：第三个参数 <code>true</code> 表明了当前监听器会持续在其它监听器之前接收按键按下事件，因此无法在其它监听器中调用 <code>stopPropagation()</code>。</p>\n</blockquote>\n<h4 id=\"拦截主进程中的事件\"><a href=\"#拦截主进程中的事件\">拦截主进程中的事件</a></h4>\n<p>在调度页面中的<code>keydown</code>和<code>keyup</code>事件之前，会发出<a href=\"/docs/api/web-contents#event-before-input-event\"><code>before-input-event</code></a>事件。 它可以用于捕获和处理在菜单中不可见的自定义快捷方式。</p>\n<p>从 <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a> 中的应用开始，将以下内容更新到 <code>main.js</code>。</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/interception-from-main\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n  win.webContents.on(<span class=\"hljs-string\">'before-input-event'</span>, (event, input) => {\n    <span class=\"hljs-keyword\">if</span> (input.control &#x26;&#x26; input.key.toLowerCase() === <span class=\"hljs-string\">'i'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Pressed Control+I'</span>)\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<p>在运行Electron应用程序之后，如果你打开你运行Electron应用的终端并按下 <code>Ctrl+I</code> 组合键，你会发现刚才按下的组合键被成功拦截了。</p>\n<h4 id=\"使用第三方库\"><a href=\"#使用第三方库\">使用第三方库</a></h4>\n<p>如果您不想手动进行快捷键解析，可以使用一些库来进行高级的按键检测。例如 <a href=\"https://github.com/ccampbell/mousetrap\">mousetrap</a>. 以下是在渲染进程中 <code>mousetrap</code> 的使用示例：</p>\n<pre><code class=\"hljs language-js\">Mousetrap.bind(<span class=\"hljs-string\">'4'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'4'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'?'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'show shortcuts!'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'esc'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'escape'</span>) }, <span class=\"hljs-string\">'keyup'</span>)\n\n<span class=\"hljs-comment\">// combinations</span>\nMousetrap.bind(<span class=\"hljs-string\">'command+shift+k'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'command shift k'</span>) })\n\n<span class=\"hljs-comment\">// map multiple combinations to the same callback</span>\nMousetrap.bind([<span class=\"hljs-string\">'command+k'</span>, <span class=\"hljs-string\">'ctrl+k'</span>], () => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'command k or control k'</span>)\n\n  <span class=\"hljs-comment\">// return false to prevent default behavior and stop event from bubbling</span>\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n\n<span class=\"hljs-comment\">// gmail style sequences</span>\nMousetrap.bind(<span class=\"hljs-string\">'g i'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'go to inbox'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'* a'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'select all'</span>) })\n\n<span class=\"hljs-comment\">// konami code!</span>\nMousetrap.bind(<span class=\"hljs-string\">'up up down down left right left right b a enter'</span>, () => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'konami code'</span>)\n})\n</code></pre></code>",
      "title": "键盘快捷键",
      "description": "注意：在上面的代码中，您可以看到基于用户的操作系统的 accelerator  差异。 对于MacOS，是 Alt+Cmd+I，而对于Linux 和 Windows，则是 Alt+Shift+I."
    },
    "/docs/tutorial/launch-app-from-url-in-another-app": {
      "locale": "zh-CN",
      "slug": "launch-app-from-url-in-another-app",
      "href": "/docs/tutorial/launch-app-from-url-in-another-app",
      "crowdinFileId": "256211",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/launch-app-from-url-in-another-app.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<hr>\n<p>title: Launching Your Electron App From a URL In Another App\ndescription: 本指南将会指导您配置 Electron 应用为特定协议的默认处理器。\nslug: 从其他应用中的URL启动应用</p>\n<h2 id=\"hide_title-true\"><a href=\"#hide_title-true\">hide_title: true</a></h2>\n<h1 id=\"从其他应用中的-url-启动您的应用\"><a href=\"#从其他应用中的-url-启动您的应用\">从其他应用中的 URL 启动您的应用</a></h1>\n<h2 id=\"概览\"><a href=\"#概览\">概览</a></h2>\n<!-- ✍ Update this section if you want to provide more details -->\n<p>This guide will take you through the process of setting your Electron app as the default handler for a specific <a href=\"https://www.electronjs.org/docs/api/protocol\">protocol</a>.</p>\n<p>通过此教程，您会掌握如何设置您的应用以拦截并处理任意特定协议的URL的点击事件。 在本指南中，我们假定这个协议名为“<code>electron-fiddle://</code>”。</p>\n<h2 id=\"示例\"><a href=\"#示例\">示例</a></h2>\n<h3 id=\"主进程（mainjs）\"><a href=\"#主进程（mainjs）\">主进程（main.js）</a></h3>\n<p>First, we will import the required modules from <code>electron</code>. These modules help control our application lifecycle and create a native browser window.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n</code></pre>\n<p>其次，我们将应用注册为“<code>electron-fiddle://</code>”协议的处理器。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">if</span> (process.defaultApp) {\n  <span class=\"hljs-keyword\">if</span> (process.argv.length >= <span class=\"hljs-number\">2</span>) {\n    app.setAsDefaultProtocolClient(<span class=\"hljs-string\">'electron-fiddle'</span>, process.execPath, [path.resolve(process.argv[<span class=\"hljs-number\">1</span>])])\n  }\n} <span class=\"hljs-keyword\">else</span> {\n  app.setAsDefaultProtocolClient(<span class=\"hljs-string\">'electron-fiddle'</span>)\n}\n</code></pre>\n<p>现在我们定义负责创建浏览器窗口的函数，并加载应用的 <code>index.html</code> 文件。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> createWindow = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Create the browser window.</span>\n  mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  mainWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n</code></pre>\n<p>紧接着，我们将创建 <code>BrowserWindow</code> 并在应用中定义如何处理此外部协议被点击的事件。</p>\n<p>This code will be different in Windows compared to MacOS and Linux. This is due to Windows requiring additional code in order to open the contents of the protocol link within the same Electron instance. 请点击 <a href=\"https://www.electronjs.org/docs/api/app#apprequestsingleinstancelock\">此处</a> 了解更多</p>\n<h4 id=\"windows-下代码：\"><a href=\"#windows-下代码：\">Windows 下代码：</a></h4>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> gotTheLock = app.requestSingleInstanceLock()\n\n<span class=\"hljs-keyword\">if</span> (!gotTheLock) {\n  app.quit()\n} <span class=\"hljs-keyword\">else</span> {\n  app.on(<span class=\"hljs-string\">'second-instance'</span>, (event, commandLine, workingDirectory) => {\n    <span class=\"hljs-comment\">// 用户正在尝试运行第二个实例，我们需要让焦点指向我们的窗口</span>\n    <span class=\"hljs-keyword\">if</span> (mainWindow) {\n      <span class=\"hljs-keyword\">if</span> (mainWindow.isMinimized()) mainWindow.restore()\n      mainWindow.focus()\n    }\n  })\n\n  <span class=\"hljs-comment\">// 创建 mainWindow，加载其他资源，等等……</span>\n  app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    createWindow()\n  })\n\n  <span class=\"hljs-comment\">// Handle the protocol. 在本例中，我们选择显示一个错误提示对话框。</span>\n  app.on(<span class=\"hljs-string\">'open-url'</span>, (event, url) => {\n    dialog.showErrorBox(<span class=\"hljs-string\">'欢迎回来'</span>, <span class=\"hljs-string\">`导向自: <span class=\"hljs-subst\">${url}</span>`</span>)\n  })\n}\n</code></pre>\n<h4 id=\"macos-与-linux-下代码：\"><a href=\"#macos-与-linux-下代码：\">MacOS 与 Linux 下代码：</a></h4>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Electron 在完成初始化，并准备创建浏览器窗口时，</span>\n<span class=\"hljs-comment\">// 会调用这个方法。</span>\n<span class=\"hljs-comment\">// 部分 API 在 ready 事件触发后才能使用。</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n})\n\n<span class=\"hljs-comment\">// Handle the protocol. 在本例中，我们选择显示一个错误提示对话框。</span>\napp.on(<span class=\"hljs-string\">'open-url'</span>, (event, url) => {\n  dialog.showErrorBox(<span class=\"hljs-string\">'欢迎回来'</span>, <span class=\"hljs-string\">`导向自: <span class=\"hljs-subst\">${url}</span>`</span>)\n})\n</code></pre>\n<p>Finally, we will add some additional code to handle when someone closes our application.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// 在除 MacOS 的其他平台上，当所有窗口关闭后，退出当前应用。 There, it's common</span>\n<span class=\"hljs-comment\">// for applications and their menu bar to stay active until the user quits</span>\n<span class=\"hljs-comment\">// explicitly with Cmd + Q.</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h2 id=\"important-notes\"><a href=\"#important-notes\">Important notes</a></h2>\n<h3 id=\"打包\"><a href=\"#打包\">打包</a></h3>\n<p>On macOS and Linux, this feature will only work when your app is packaged. It will not work when you're launching it in development from the command-line. When you package your app you'll need to make sure the macOS <code>Info.plist</code> and the Linux <code>.desktop</code> files for the app are updated to include the new protocol handler. Some of the Electron tools for bundling and distributing apps handle this for you.</p>\n<h4 id=\"electron-forge\"><a href=\"#electron-forge\"></a><a href=\"https://electronforge.io\">Electron Forge</a></h4>\n<p>If you're using Electron Forge, adjust <code>packagerConfig</code> for macOS support, and the configuration for the appropriate Linux makers for Linux support, in your <a href=\"https://www.electronforge.io/configuration\">Forge configuration</a> <em>(please note the following example only shows the bare minimum needed to add the configuration changes)</em>:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"config\"</span>: {\n    <span class=\"hljs-attr\">\"forge\"</span>: {\n      <span class=\"hljs-attr\">\"packagerConfig\"</span>: {\n        <span class=\"hljs-attr\">\"protocols\"</span>: [\n          {\n            <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"Electron Fiddle\"</span>,\n            <span class=\"hljs-attr\">\"schemes\"</span>: [<span class=\"hljs-string\">\"electron-fiddle\"</span>]\n          }\n        ]\n      },\n      <span class=\"hljs-attr\">\"makers\"</span>: [\n        {\n          <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"@electron-forge/maker-deb\"</span>,\n          <span class=\"hljs-attr\">\"config\"</span>: {\n            <span class=\"hljs-attr\">\"mimeType\"</span>: [<span class=\"hljs-string\">\"x-scheme-handler/electron-fiddle\"</span>]\n          }\n        }\n      ]\n    }\n  }\n}\n</code></pre>\n<h4 id=\"electron-packager\"><a href=\"#electron-packager\"></a><a href=\"https://github.com/electron/electron-packager\">Electron Packager</a></h4>\n<p>For macOS support:</p>\n<p>If you're using Electron Packager's API, adding support for protocol handlers is similar to how Electron Forge is handled, except <code>protocols</code> is part of the Packager options passed to the <code>packager</code> function.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> packager = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-packager'</span>)\n\npackager({\n  <span class=\"hljs-comment\">// ...other options...</span>\n  <span class=\"hljs-attr\">protocols</span>: [\n    {\n      <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Electron Fiddle'</span>,\n      <span class=\"hljs-attr\">schemes</span>: [<span class=\"hljs-string\">'electron-fiddle'</span>]\n    }\n  ]\n\n}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">paths</span> =></span> <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`SUCCESS: Created <span class=\"hljs-subst\">${paths.join(<span class=\"hljs-string\">', '</span>)}</span>`</span>))\n  .catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">`ERROR: <span class=\"hljs-subst\">${err.message}</span>`</span>))\n</code></pre>\n<p>If you're using Electron Packager's CLI, use the <code>--protocol</code> and <code>--protocol-name</code> flags. For example:</p>\n<pre><code class=\"hljs language-shell\">npx electron-packager . --protocol=electron-fiddle --protocol-name=\"Electron Fiddle\"\n</code></pre>\n<h2 id=\"结论\"><a href=\"#结论\">结论</a></h2>\n<p>After you start your Electron app, you can enter in a URL in your browser that contains the custom protocol, for example <code>\"electron-fiddle://open\"</code> and observe that the application will respond and show an error dialog box.</p>\n<!--\n    Because Electron examples usually require multiple files (HTML, CSS, JS\n    for the main and renderer process, etc.), we use this custom code block\n    for Fiddle (https://www.electronjs.org/fiddle).\n    Please modify any of the files in the referenced folder to fit your\n    example.\n    The content in this codeblock will not be rendered in the website so you\n    can leave it empty.\n-->\n<!-- ✍ Explanation of the code below -->",
      "title": "从其他应用中的 URL 启动您的应用",
      "description": ""
    },
    "/docs/tutorial/linux-desktop-actions": {
      "locale": "zh-CN",
      "slug": "linux-desktop-actions",
      "href": "/docs/tutorial/linux-desktop-actions",
      "crowdinFileId": "256213",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/linux-desktop-actions.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktop-launcher-actions-linux\"><a href=\"#desktop-launcher-actions-linux\">Desktop Launcher Actions (Linux)</a></h1>\n<h2 id=\"概览\"><a href=\"#概览\">概览</a></h2>\n<p>On many Linux environments, you can add custom entries to the system launcher by modifying the <code>.desktop</code> file. 关于 Canonical 的 Unity 启动器文档， 参考 <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Adding Shortcuts to a Launcher</a>。 详细的参考信息请见 <a href=\"https://specifications.freedesktop.org/desktop-entry-spec/1.1/ar01s11.html\">freedesktop.org Specification</a>。</p>\n<p><img src=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles?action=AttachFile&#x26;do=get&#x26;target=shortcuts.png\" alt=\"audacious\"></p>\n<blockquote>\n<p>注：上面的截图是 Audacious 音频播放器中启动器快捷方式的一个例子</p>\n</blockquote>\n<p>若要创建快捷方式，你需要为添加到快捷菜单的条目提供 <code>Name</code> 和 <code>Exec</code> 属性。 Unity 将在用户点击快捷菜单项后执行 <code>Exec</code> 字段定义的命令。 <code>.desktop</code> 文件的示例如下：</p>\n<pre><code class=\"hljs language-plaintext\">Actions=PlayPause;Next;Previous\n\n[Desktop Action PlayPause]\nName=Play-Pause\nExec=audacious -t\n\n\n[Desktop Action Next]\nName=Next\nExec=audacious -f\n\n\n[Desktop Action Previous]\nName=Previous\nExec=audacious -r\n</code></pre>\n<p>Unity 推荐应用程序操作的首选方式是使用参数。 您可以在应用的全局变量 <code>process.argv</code> 中找到它们。</p>",
      "title": "Desktop Launcher Actions (Linux)",
      "description": "注：上面的截图是 Audacious 音频播放器中启动器快捷方式的一个例子"
    },
    "/docs/tutorial/mac-app-store-submission-guide": {
      "locale": "zh-CN",
      "slug": "mac-app-store-submission-guide",
      "href": "/docs/tutorial/mac-app-store-submission-guide",
      "crowdinFileId": "256215",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/mac-app-store-submission-guide.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"mac-app-store-应用程序提交指南\"><a href=\"#mac-app-store-应用程序提交指南\">Mac App Store 应用程序提交指南</a></h1>\n<p>本指南提供以下相关资讯：</p>\n<ul>\n<li>如何在 macOS 上为 Electron 应用签名；</li>\n<li>如何在 Mac App Store (MAS) 上提交 Electron 应用；</li>\n<li>对于 MAS 构建版本的局限性。</li>\n</ul>\n<h2 id=\"要求\"><a href=\"#要求\">要求</a></h2>\n<p>要为 Electron 应用签名，则必须首先安装下列应用：</p>\n<ul>\n<li>Xcode 11 或更高版本。</li>\n<li><a href=\"https://github.com/electron/electron-osx-sign\">electron-osx-sign</a> npm 模块.</li>\n</ul>\n<p>您还必须注册一个苹果开发者帐户，并加入 <a href=\"https://developer.apple.com/support/compare-memberships/\">苹果开发者计划</a>。</p>\n<h2 id=\"为-electron-应用签名\"><a href=\"#为-electron-应用签名\">为 Electron 应用签名</a></h2>\n<p>Electron应用可以通过 Mac 应用商店或其外部进行发布。 每种方式都需要不同的签名和测试方法。 本指南侧重于通过 Mac 应用商店进行发布，也会提及其他方法。</p>\n<p>以下步骤描述了如何从 Apple 获得证书，如何对Electron应用程序进行签名以及如何测试它们。</p>\n<h3 id=\"获取证书\"><a href=\"#获取证书\">获取证书</a></h3>\n<p>获得签名证书的最简单方法是使用 Xcode：</p>\n<ol>\n<li>打开Xcode并打开“帐户”首选项；</li>\n<li>使用您的 Apple 帐户登录;</li>\n<li>选择一个团队并单击\"管理证书\";</li>\n<li>在签名证书表的左下角，单击添加按钮 (+)，并添加以下证书：<ul>\n<li>\"Apple Development\"</li>\n<li>\"Apple Distribution\"</li>\n</ul></li>\n</ol>\n<p>“Apple Development”证书用于在Apple Developer网站上注册的计算机上签署用于开发和测试的应用程序。 注册方法会在<a href=\"#prepare-provisioning-profile\">准备配置文件</a>中描述。</p>\n<p>带有\"Apple Development\"证书签名的应用无法提交到Mac 应用商店。 为此，应用程序必须使用\"Apple Distribution\"证书进行签名。 但请注意，使用\"Apple Distribution\"证书签名的应用程序不能直接运行，它们必须由 Apple 重新签名才能运行，也就是只有从 Mac 应用商店下载后才能运行。</p>\n<h4 id=\"其它证书\"><a href=\"#其它证书\">其它证书</a></h4>\n<p>您可以注意到还有其他类型的证书。</p>\n<p>\"Developer ID Application\"证书用于将应用发布到Mac 应用商店以外的地方之前签名。</p>\n<p>\"Deceloper ID Installer\"和\"Mac Installer Distribution\"证书用于签署 Mac 安装程序包，而不是应用程序本身。 大多数Electron应用不使用Mac Installer Package，因此通常不需要它们。</p>\n<p>完整的证书类型列表可以在<a href=\"https://help.apple.com/xcode/mac/current/#/dev80c6204ec\">这里</a>找到。</p>\n<p>使用 \"Apple Development\" 和 \"Apple Distribution\" 证书签名的应用程序只能在 <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandbox</a>下运行， 所以他们必须使用Electron 的 MAS 构建。 然而，“Developer ID Application”证书没有这个限制，因此，用其签名的应用既可以使用普通构建也可以使用 Electron 的 MAS 构建。</p>\n<h4 id=\"传统证书名称\"><a href=\"#传统证书名称\">传统证书名称</a></h4>\n<p>Apple在过去几年中一直在更改证书的名称，您可能会在阅读旧文档时遇到这些证书，并且一些工具仍然在使用旧名称。</p>\n<ul>\n<li>“Apple Distribution”证书也叫做“3rd Party Mac Developer Application”和“Mac App Distribution”。</li>\n<li>“Apple Development”证书也叫做“Mac Developer”和“Development”。</li>\n</ul>\n<h3 id=\"准备配置配置文件\"><a href=\"#准备配置配置文件\">准备配置配置文件</a></h3>\n<p>如果您想在将应用提交给Mac App Store之前在本地机器上测试您的应用， 您必须使用\"Apple Development\"证书签名该应用，并在程序包中嵌入配置文件。</p>\n<p>要 <a href=\"https://help.apple.com/developer-account/#/devf2eb157f8\">创建一个配置文件</a>，您可以按照以下步骤：</p>\n<ol>\n<li>在 <a href=\"https://developer.apple.com/account\">Apple Developer</a> 网站上打开\"证书、标识符 &#x26; 配置文件\"页面。</li>\n<li>在“标识符”页面为您的应用添加一个新的App ID。</li>\n<li>在\"设备\"页面中注册本地计算机。 您可以在\"系统信息\"应用的\"硬件\"页面中找到机器的\"设备 ID\"。</li>\n<li>在“Profiles”页面注册一个新的配置文件，然后下载到 <code>/path/to/yourapp.provisionfile</code>。</li>\n</ol>\n<h3 id=\"启用apple的应用沙箱\"><a href=\"#启用apple的应用沙箱\">启用Apple的应用沙箱</a></h3>\n<p>提交到 Mac App Store 的应用程序必须在 Apple <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandbox</a>下运行， 并且只有Electron的 MAS 构建可以使用App Sandbox 运行。 在 App Sandbox 下运行时，Electron 的标准 darwin 构建将无法启动。</p>\n<p>使用 <code>electron-osx-signe</code>签名时，它将会自动将必要的权限添加到您应用的所需权利中， 但如果您正在使用自定义所需权利，您必须确保App Sandbox capacity已经添加：</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<h4 id=\"不使用-electron-osx-sign的额外步骤\"><a href=\"#不使用-electron-osx-sign的额外步骤\">不使用 <code>electron-osx-sign</code>的额外步骤</a></h4>\n<p>如果您的应用没有使用 <code>electron-osx-signe</code> 进行签名，您必须确保应用包的权限至少有以下键：</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.application-groups<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">array</span>></span>\n      <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>TEAM_ID.your.bundle.id<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n    <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">array</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p><code>TEAM_ID</code> 应替换为 Apple 开发者帐户的Team ID，<code>your.bundle.id</code> 应替换为应用的App ID。</p>\n<p>以下权限必须添加到应用程序包的二进制程序和助手中：</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.inherit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>应用程序包的 <code>Info.plist</code> 必须包含 <code>ElectronTeamID</code> 键，其值为你的 Apple 开发者团队ID：</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n  ...\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>ElectronTeamID<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>TEAM_ID<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>当使用 <code>electron-osx-signing</code> 时， <code>ElectronTeamID</code> 键将通过从证书名称提取团队 ID 自动添加。 如果<code>electron-osx-sign</code>找不到正确的团队 ID，则可能需要你手动添加此键 。</p>\n<h3 id=\"sign-apps-for-development\"><a href=\"#sign-apps-for-development\">Sign apps for development</a></h3>\n<p>To sign an app that can run on your development machine, you must sign it with the \"Apple Development\" certificate and pass the provisioning profile to <code>electron-osx-sign</code>.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Apple Development'</span> --provisioning-profile=/path/to/yourapp.provisionprofile\n</code></pre>\n<p>If you are signing without <code>electron-osx-sign</code>, you must place the provisioning profile to <code>YourApp.app/Contents/embedded.provisionprofile</code>.</p>\n<p>The signed app can only run on the machines that registered by the provisioning profile, and this is the only way to test the signed app before submitting to Mac App Store.</p>\n<h3 id=\"sign-apps-for-submitting-to-the-mac-app-store\"><a href=\"#sign-apps-for-submitting-to-the-mac-app-store\">Sign apps for submitting to the Mac App Store</a></h3>\n<p>To sign an app that will be submitted to Mac App Store, you must sign it with the \"Apple Distribution\" certificate. Note that apps signed with this certificate will not run anywhere, unless it is downloaded from Mac App Store.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Apple Distribution'</span>\n</code></pre>\n<h3 id=\"sign-apps-for-distribution-outside-the-mac-app-store\"><a href=\"#sign-apps-for-distribution-outside-the-mac-app-store\">Sign apps for distribution outside the Mac App Store</a></h3>\n<p>If you don't plan to submit the app to Mac App Store, you can sign it the \"Developer ID Application\" certificate. In this way there is no requirement on App Sandbox, and you should use the normal darwin build of Electron if you don't use App Sandbox.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Developer ID Application'</span> --no-gatekeeper-assess\n</code></pre>\n<p>By passing <code>--no-gatekeeper-assess</code>, the <code>electron-osx-sign</code> will skip the macOS GateKeeper check as your app usually has not been notarized yet by this step.</p>\n<!-- TODO(zcbenz): Add a chapter about App Notarization -->\n<p>This guide does not cover <a href=\"https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution\">App Notarization</a>, but you might want to do it otherwise Apple may prevent users from using your app outside Mac App Store.</p>\n<h2 id=\"submit-apps-to-the-mac-app-store\"><a href=\"#submit-apps-to-the-mac-app-store\">Submit Apps to the Mac App Store</a></h2>\n<p>After signing the app with the \"Apple Distribution\" certificate, you can continue to submit it to Mac App Store.</p>\n<p>However, this guide do not ensure your app will be approved by Apple; you still need to read Apple's <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/SubmittingYourApp/SubmittingYourApp.html\">Submitting Your App</a> guide on how to meet the Mac App Store requirements.</p>\n<h3 id=\"upload\"><a href=\"#upload\">Upload</a></h3>\n<p>The Application Loader should be used to upload the signed app to iTunes Connect for processing, making sure you have <a href=\"https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/CreatingiTunesConnectRecord.html\">created a record</a> before uploading.</p>\n<p>If you are seeing errors like private APIs uses, you should check if the app is using the MAS build of Electron.</p>\n<h3 id=\"submit-for-review\"><a href=\"#submit-for-review\">Submit for review</a></h3>\n<p>After uploading, you should <a href=\"https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html\">submit your app for review</a>.</p>\n<h2 id=\"mas-构建限制\"><a href=\"#mas-构建限制\">MAS 构建限制</a></h2>\n<p>为了让你的应用满足沙箱的所有条件，在 MAS 构建的时候，下面的模块已被禁用：</p>\n<ul>\n<li><code>crashReporter</code></li>\n<li><code>autoUpdater</code></li>\n</ul>\n<p>并且下面的行为也改变了:</p>\n<ul>\n<li>一些视频采集功能无效。</li>\n<li>某些辅助功能无法访问。</li>\n<li>应用无法检测 DNS 变化。</li>\n</ul>\n<p>此外，由于应用沙盒的使用，应用程序可以访问的资源受到严格限制；您可以阅读 <a href=\"https://developer.apple.com/app-sandboxing/\">应用沙盒</a> ，了解更多信息。</p>\n<h3 id=\"additional-entitlements\"><a href=\"#additional-entitlements\">Additional entitlements</a></h3>\n<p>Depending on which Electron APIs your app uses, you may need to add additional entitlements to your app's entitlements file. Otherwise, the App Sandbox may prevent you from using them.</p>\n<h4 id=\"network-access\"><a href=\"#network-access\">Network access</a></h4>\n<p>启用传出的网络连接，允许你的应用程序连接到服务器：</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.network.client<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>启用传入的网络连接，让你的应用程序打开网络 socket 监听：</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.network.server<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>有关更多 详细信息，请参阅<a href=\"https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW9\">启用网络访问文档</a>。</p>\n<h4 id=\"dialogshowopendialog\"><a href=\"#dialogshowopendialog\">dialog.showOpenDialog</a></h4>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.files.user-selected.read-only<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>有关更多详细信息，请参阅<a href=\"https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6\">\"启用访问用户选择的文件\"文档</a>。</p>\n<h4 id=\"dialogshowsavedialog\"><a href=\"#dialogshowsavedialog\">dialog.showSaveDialog</a></h4>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.files.user-selected.read-write<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>有关更多详细信息，请参阅<a href=\"https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6\">\"启用访问用户选择的文件\"文档</a>。</p>\n<h2 id=\"electron-使用的加密算法\"><a href=\"#electron-使用的加密算法\">Electron 使用的加密算法</a></h2>\n<p>根据你发布应用所在的国家或地区，你可能需要提供您软件使用的加密算法的信息。 更多信息，请参阅<a href=\"https://help.apple.com/app-store-connect/#/devc3f64248f\"> 加密导出合规性文档 </a>。</p>\n<p>Electron 使用下列加密算法：</p>\n<ul>\n<li>AES - <a href=\"https://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf\">NIST SP 800-38A</a>, <a href=\"https://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf\">NIST SP 800-38D</a>, <a href=\"https://www.ietf.org/rfc/rfc3394.txt\">RFC 3394</a></li>\n<li>HMAC - <a href=\"https://csrc.nist.gov/publications/fips/fips198-1/FIPS-198-1_final.pdf\">FIPS 198-1</a></li>\n<li>ECDSA - ANS X9.62–2005</li>\n<li>ECDH - ANS X9.63–2001</li>\n<li>HKDF - <a href=\"https://csrc.nist.gov/publications/nistpubs/800-56C/SP-800-56C.pdf\">NIST SP 800-56C</a></li>\n<li>PBKDF2 - <a href=\"https://tools.ietf.org/html/rfc2898\">RFC 2898</a></li>\n<li>RSA - <a href=\"https://www.ietf.org/rfc/rfc3447\">RFC 3447</a></li>\n<li>SHA - <a href=\"https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf\">FIPS 180-4</a></li>\n<li>Blowfish - <a href=\"https://www.schneier.com/cryptography/blowfish/\">https://www.schneier.com/cryptography/blowfish/</a></li>\n<li>CAST - <a href=\"https://tools.ietf.org/html/rfc2144\">RFC 2144</a>, <a href=\"https://tools.ietf.org/html/rfc2612\">RFC 2612</a></li>\n<li>DES - <a href=\"https://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf\">FIPS 46-3</a></li>\n<li>DH - <a href=\"https://tools.ietf.org/html/rfc2631\">RFC 2631</a></li>\n<li>DSA - <a href=\"https://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+X9.30-1%3A1997\">ANSI X9.30</a></li>\n<li>EC - <a href=\"https://www.secg.org/sec1-v2.pdf\">SEC 1</a></li>\n<li>IDEA - \"On the Design and Security of Block Ciphers\" book by X. Lai</li>\n<li>MD2 - <a href=\"https://tools.ietf.org/html/rfc1319\">RFC 1319</a></li>\n<li>MD4 - <a href=\"https://tools.ietf.org/html/rfc6150\">RFC 6150</a></li>\n<li>MD5 - <a href=\"https://tools.ietf.org/html/rfc1321\">RFC 1321</a></li>\n<li>MDC2 - <a href=\"https://wiki.openssl.org/index.php/Manual:Mdc2(3)\">ISO/IEC 10118-2</a></li>\n<li>RC2 - <a href=\"https://tools.ietf.org/html/rfc2268\">RFC 2268</a></li>\n<li>RC4 - <a href=\"https://tools.ietf.org/html/rfc4345\">RFC 4345</a></li>\n<li>RC5 - <a href=\"https://people.csail.mit.edu/rivest/Rivest-rc5rev.pdf\">https://people.csail.mit.edu/rivest/Rivest-rc5rev.pdf</a></li>\n<li>RIPEMD - <a href=\"https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2010118-3:2004\">ISO/IEC 10118-3</a></li>\n</ul>",
      "title": "Mac App Store 应用程序提交指南",
      "description": ""
    },
    "/docs/tutorial/macos-dock": {
      "locale": "zh-CN",
      "slug": "macos-dock",
      "href": "/docs/tutorial/macos-dock",
      "crowdinFileId": "256217",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/macos-dock.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dock-macos\"><a href=\"#dock-macos\">Dock (macOS)</a></h1>\n<p>Electron有API来配置macOS Dock中的应用程序图标。 A macOS-only API exists to create a custom dock menu, but Electron also uses the app dock icon as the entry point for cross-platform features like <a href=\"/docs/tutorial/recent-documents\">recent documents</a> and <a href=\"/docs/tutorial/progress-bar\">application progress</a>.</p>\n<p>一个自定义的Dock项也普遍用于为那些用户不愿意为之打开整个应用窗口的任务添加快捷方式。</p>\n<p><strong>Terminal.app 的 Dock 菜单:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5069962/6032658a-6e9c-11e4-9953-aa84006bdfff.png\" alt=\"Dock Menu\"></p>\n<p>要设置您的自定义 dock 菜单，您需要使用 <a href=\"/docs/api/dock#docksetmenumenu-macos\"><code>app.dock.setmenu</code></a> API，它仅在 macOS 上可用。</p>\n<h2 id=\"示例\"><a href=\"#示例\">示例</a></h2>\n<p>从 <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a> 中的应用开始，将以下内容更新到 <code>main.js</code>。</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/macos-dock-menu\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\n<span class=\"hljs-keyword\">const</span> dockMenu = Menu.buildFromTemplate([\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Window'</span>,\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'New Window'</span>) }\n  }, {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Window with Settings'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Basic'</span> },\n      { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Pro'</span> }\n    ]\n  },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Command...'</span> }\n])\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">if</span> (process.platform === <span class=\"hljs-string\">'darwin'</span>) {\n    app.dock.setMenu(dockMenu)\n  }\n}).then(createWindow)\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n\n</code></pre>\n<p>After launching the Electron application, right click the application icon. 您应该可以看到您刚刚设置的自定义菜单：</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/macos-dock-menu.png\" alt=\"macOS dock 菜单\"></p>",
      "title": "Dock (macOS)",
      "description": ""
    },
    "/docs/api/structures/memory-info": {
      "locale": "zh-CN",
      "slug": "memory-info",
      "href": "/docs/api/structures/memory-info",
      "crowdinFileId": "256459",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/memory-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"memoryinfo-object\"><a href=\"#memoryinfo-object\">MemoryInfo Object</a></h1>\n<ul>\n<li><code>workingSetSize</code> Integer - The amount of memory currently pinned to actual physical RAM.</li>\n<li><code>peakWorkingSetSize</code> Integer - The maximum amount of memory that has ever been pinned to actual physical RAM.</li>\n<li><code>privateBytes</code> Integer (optional) <em>Windows</em> - The amount of memory not shared by other processes, such as JS heap or HTML content.</li>\n</ul>\n<p>Note that all statistics are reported in Kilobytes.</p>",
      "title": "MemoryInfo Object",
      "description": ""
    },
    "/docs/api/structures/memory-usage-details": {
      "locale": "zh-CN",
      "slug": "memory-usage-details",
      "href": "/docs/api/structures/memory-usage-details",
      "crowdinFileId": "256461",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/memory-usage-details.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"memoryusagedetails-object\"><a href=\"#memoryusagedetails-object\">MemoryUsageDetails Object</a></h1>\n<ul>\n<li><code>count</code> Number</li>\n<li><code>size</code> Number</li>\n<li><code>liveSize</code> Number</li>\n</ul>",
      "title": "MemoryUsageDetails Object",
      "description": ""
    },
    "/docs/api/menu": {
      "locale": "zh-CN",
      "slug": "menu",
      "href": "/docs/api/menu",
      "crowdinFileId": "256335",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/menu.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"menu\"><a href=\"#menu\">Menu</a></h1>\n<h2 id=\"菜单\"><a href=\"#菜单\">菜单</a></h2>\n<blockquote>\n<p>创建原生应用菜单和上下文菜单。</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<h3 id=\"new-menu\"><a href=\"#new-menu\"><code>new Menu()</code></a></h3>\n<p>创建新菜单。</p>\n<h3 id=\"静态方法\"><a href=\"#静态方法\">静态方法</a></h3>\n<p><code>Menu</code>类有以下方法:</p>\n<h4 id=\"menusetapplicationmenumenu\"><a href=\"#menusetapplicationmenumenu\"><code>Menu.setApplicationMenu(menu)</code></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>在macOS上将 <code>menu</code>设置成应用内菜单 在windows和Linux上，<code>menu</code> 将会被设置成窗口顶部菜单</p>\n<p>在Windows和Linux中，可以在菜单的顶层标签的某个字母前添加<code>&#x26;</code>以绑定快捷键。 例如，使用<code>&#x26;File</code>后可以使用<code>Alt-F</code>呼出File的子选项。 按钮标签中指定的字符会出现下划线， <code>&#x26;</code> 字符不会显示在按钮标签上。</p>\n<p>要转义并在项名中显示 <code>&#x26;</code> 字符, 可以添加字符 <code>&#x26;</code>. 比如, <code>&#x26;&#x26;File</code> 将在按钮标签上出现 <code>&#x26;File</code></p>\n<p>传递 <code>null</code> 值可以禁用默认菜单。 在 Windows 和 Linux 上，使用此方法移除窗口上的菜单栏可能会有额外的效果。</p>\n<p><strong>注释:</strong>如果应用没有设置菜单的话，系统会生成一个默认菜单。 默认生成的菜单中包含了一些初始选项，例如 <code>文件</code>,<code>编辑</code>, <code>视图</code>,<code>窗口</code>,<code>帮助</code>。</p>\n<h4 id=\"menugetapplicationmenu\"><a href=\"#menugetapplicationmenu\"><code>Menu.getApplicationMenu()</code></a></h4>\n<p>返回 <code>Menu | null</code> - 如果有设置, 则返回应用程序菜单， 如果没设置，则返回 <code>null</code>。</p>\n<p><strong>注释:</strong>返回的 <code>Menu</code>实例不支持动态添加或删除菜单项， 但仍然可以动态修改 <a href=\"#instance-properties\"> 实例属性 </a>。</p>\n<h4 id=\"menusendactiontofirstresponderaction-macos\"><a href=\"#menusendactiontofirstresponderaction-macos\"><code>Menu.sendActionToFirstResponder(action)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>action</code> String</li>\n</ul>\n<p>将 <code>action</code> 发送到应用程序的第一个响应方。 这用于模拟默认的 macOS 菜单行为。 通常你可以使用<a href=\"/docs/api/menu-item#roles\"><code>MenuItem</code></a>的<a href=\"/docs/api/menu-item\"><code>role</code></a>属性</p>\n<p>有关 macOS 的本地操作的详细信息, 请参阅 <a href=\"https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW7\"> macOS Cocoa Event Handling Guide </a>。</p>\n<h4 id=\"menubuildfromtemplatetemplate\"><a href=\"#menubuildfromtemplatetemplate\"><code>Menu.buildFromTemplate(template)</code></a></h4>\n<ul>\n<li><code>template</code> (MenuItemConstructorOptions | MenuItem)[]</li>\n</ul>\n<p>返回 <code>Menu</code></p>\n<p>一般来说， <code>template</code>是一个<code>options</code>类型的数组，用于构建<a href=\"/docs/api/menu-item\">MenuItem</a>。 使用方法可参考前文。</p>\n<p>您还可以将其他字段附加到<code>template</code>，它们将成为菜单项的属性。</p>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<p><code>menu</code> 对象具有以下实例方法:</p>\n<h4 id=\"menupopupoptions\"><a href=\"#menupopupoptions\"><code>menu.popup([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (可选)<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (可选) - 默认为选中窗口.</li>\n<li><code>x</code> Number (可选) - 默认为当前鼠标的位置。 如果指定了<code>y</code>，则该选项必选。</li>\n<li><code>y</code> Number (可选) - 默认为当前鼠标的位置。 如果指定了<code>x</code>，则该选项必选。</li>\n<li><code>positioningItem</code> Number (可选) <em>macOS</em> - 在指定鼠标光标下定位的菜单项的索引。 默认值为 -1。</li>\n<li><code>callback</code> Function (optional) - 会在菜单关闭后被调用.</li>\n</ul></li>\n</ul>\n<p>弹出此菜单作为上下文菜单在 <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>。</p>\n<h4 id=\"menuclosepopupbrowserwindow\"><a href=\"#menuclosepopupbrowserwindow\"><code>menu.closePopup([browserWindow])</code></a></h4>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (可选) - 默认为选中窗口.</li>\n</ul>\n<p>关闭 <code>browserWindow</code> 中的上下文菜单。</p>\n<h4 id=\"menuappendmenuitem\"><a href=\"#menuappendmenuitem\"><code>menu.append(menuItem)</code></a></h4>\n<ul>\n<li><code>menuItem</code> <a href=\"/docs/api/menu-item\">菜单项</a></li>\n</ul>\n<p>将 <code>menuItem</code> 追加到菜单。</p>\n<h4 id=\"menugetmenuitembyidid\"><a href=\"#menugetmenuitembyidid\"><code>menu.getMenuItemById(id)</code></a></h4>\n<ul>\n<li><code>id</code> String</li>\n</ul>\n<p>返回具有指定<code>id</code>项的<code>MenuItem | null</code></p>\n<h4 id=\"menuinsertpos-menuitem\"><a href=\"#menuinsertpos-menuitem\"><code>menu.insert(pos, menuItem)</code></a></h4>\n<ul>\n<li><code>pos</code> Integer</li>\n<li><code>menuItem</code> <a href=\"/docs/api/menu-item\">菜单项</a></li>\n</ul>\n<p>将 <code>menuItem</code> 插入菜单的 <code>pos</code> 位置。</p>\n<h3 id=\"实例事件\"><a href=\"#实例事件\">实例事件</a></h3>\n<p>使用 <code>new Menu</code> 创建对象或通过 <code>Menu.buildFromTemplate</code>返回对象均会触发下列事件：</p>\n<p><strong> 注意: </strong>某些事件仅在特定的操作系统上可用, 这些方法会被标记出来。</p>\n<h4 id=\"事件-menu-will-show\"><a href=\"#事件-menu-will-show\">事件: 'menu-will-show'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>调用<code>menu.popup()</code>事件时触发该事件。</p>\n<h4 id=\"事件-menu-will-close\"><a href=\"#事件-menu-will-close\">事件: 'menu-will-close'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>手动关闭弹出，或使用 <code>menu.closePopup()</code>方法关闭弹出时，触发该事件。</p>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<p><code>menu</code> 对象还具有以下属性:</p>\n<h4 id=\"menuitems\"><a href=\"#menuitems\"><code>menu.items</code></a></h4>\n<p>包含菜单项的 <code>MenuItem []</code> 数组。</p>\n<p>每个 <code>菜单</code> 由多个 <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>  组成, 每个 <code>MenuItem</code>可以有子菜单。</p>\n<h2 id=\"示例\"><a href=\"#示例\">示例</a></h2>\n<p>使用简单模板API创建 application menu 的示例代码：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> isMac = process.platform === <span class=\"hljs-string\">'darwin'</span>\n\n<span class=\"hljs-keyword\">const</span> template = [\n  <span class=\"hljs-comment\">// { role: 'appMenu' }</span>\n  ...(isMac ? [{\n    <span class=\"hljs-attr\">label</span>: app.name,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'about'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'services'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'hide'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'hideOthers'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'unhide'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'quit'</span> }\n    ]\n  }] : []),\n  <span class=\"hljs-comment\">// { role: 'fileMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'File'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      isMac ? { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'close'</span> } : { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'quit'</span> }\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'editMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Edit'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'undo'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'redo'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'cut'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'copy'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'paste'</span> },\n      ...(isMac ? [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'pasteAndMatchStyle'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'delete'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'selectAll'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        {\n          <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Speech'</span>,\n          <span class=\"hljs-attr\">submenu</span>: [\n            { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'startSpeaking'</span> },\n            { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'stopSpeaking'</span> }\n          ]\n        }\n      ] : [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'delete'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'selectAll'</span> }\n      ])\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'viewMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'View'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'reload'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'forceReload'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'toggleDevTools'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'resetZoom'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoomIn'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoomOut'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'togglefullscreen'</span> }\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'windowMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Window'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'minimize'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoom'</span> },\n      ...(isMac ? [\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'front'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'window'</span> }\n      ] : [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'close'</span> }\n      ])\n    ]\n  },\n  {\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'help'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      {\n        <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Learn More'</span>,\n        <span class=\"hljs-attr\">click</span>: <span class=\"hljs-keyword\">async</span> () => {\n          <span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n          <span class=\"hljs-keyword\">await</span> shell.openExternal(<span class=\"hljs-string\">'https://electronjs.org'</span>)\n        }\n      }\n    ]\n  }\n]\n\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\nMenu.setApplicationMenu(menu)\n</code></pre>\n<h3 id=\"渲染进程\"><a href=\"#渲染进程\">渲染进程</a></h3>\n<p>要创建由渲染器启动的菜单，请通过 IPC 发送所需的信息到主过程，并让主过程代替渲染器显示菜单。</p>\n<p>以下是用户右键单击页面时显示菜单的示例：</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer</span>\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'contextmenu'</span>, (e) => {\n  e.preventDefault()\n  ipcRenderer.send(<span class=\"hljs-string\">'show-context-menu'</span>)\n})\n\nipcRenderer.on(<span class=\"hljs-string\">'context-menu-command'</span>, (e, command) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// main</span>\nipcMain.on(<span class=\"hljs-string\">'show-context-menu'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> template = [\n    {\n      <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Menu Item 1'</span>,\n      <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { event.sender.send(<span class=\"hljs-string\">'context-menu-command'</span>, <span class=\"hljs-string\">'menu-item-1'</span>) }\n    },\n    { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Menu Item 2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'checkbox'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> }\n  ]\n  <span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\n  menu.popup(BrowserWindow.fromWebContents(event.sender))\n})\n</code></pre>\n<h2 id=\"macos中应用菜单注意事项\"><a href=\"#macos中应用菜单注意事项\">MacOS中应用菜单注意事项</a></h2>\n<p>macOS 相比于 Windows 和 Linux 有着完全不同的应用程序菜单。 以下是一些有关使应用菜单更像原生应用菜单的注意事项。</p>\n<h3 id=\"标准菜单\"><a href=\"#标准菜单\">标准菜单</a></h3>\n<p>MacOS有一些系统预定义的菜单，像是<a href=\"https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc\"><code>Services</code></a> and <code>Windows</code>。 让你的菜单更像MacOS标准菜单，只需设置菜单<code>role</code>值为如下示之一，Electron便会自动认出并设置成标准菜单，：</p>\n<ul>\n<li><code>window</code></li>\n<li><code>help</code></li>\n<li><code>services</code></li>\n</ul>\n<h3 id=\"标准菜单项操作\"><a href=\"#标准菜单项操作\">标准菜单项操作</a></h3>\n<p>macOS 已经为某些菜单项提供了标准操作, 如 <code>about xxx</code>、<code>Hide xxx</code> 和 <code>Hide Others</code>。 若要将菜单项的操作设置为标准操作, 应设置菜单项的 <code> role</code> 属性。</p>\n<h3 id=\"主菜单的名称\"><a href=\"#主菜单的名称\">主菜单的名称</a></h3>\n<p>在 macOS 中应用程序菜单的第一个项目的标签总是你的应用程序的名字, 无论你设置什么标签。 如要更改它, 请修改应用程序包的 <code>Info. plist</code> 文件。 详情参阅：<a href=\"https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html\">About Information Property List Files</a></p>\n<h2 id=\"设置特定浏览器窗口的菜单--linux---windows-\"><a href=\"#设置特定浏览器窗口的菜单--linux---windows-\">设置特定浏览器窗口的菜单 (<em> Linux </em> <em> Windows </em>)</a></h2>\n<p>浏览器窗口的 <a href=\"/docs/api/browser-window#winsetmenumenu-linux-windows\"> <code>setMenu</code> 方法 </a> 可以设置特定浏览器窗口的菜单。</p>\n<h2 id=\"菜单项位置\"><a href=\"#菜单项位置\">菜单项位置</a></h2>\n<p>你可以使用 <code>before</code>, <code>after</code>, <code>beforeGroupContaining</code>, <code>afterGroupContaining</code> 和 <code>id</code> 来控制由 <code>Menu.buildFromTemplate</code> 生成的菜单项的位置.</p>\n<ul>\n<li><code>before</code> - 在指定的标签之前插入菜单项。 如果引用值不存在，那么该菜单项会插在这个菜单的尾部。 这还意味着，菜单项应该被放置在与引用项相同的组中。</li>\n<li><code>after</code> - 在指定的标签之后插入菜单项。 如果引用值不存在，那么该菜单项会插在这个菜单的尾部。 这还意味着，菜单项应该被放置在与引用项相同的组中。</li>\n<li><code>beforeGroupContaining</code> - 为单个上下文菜单提供一种方法，用于在具有指定标签项的包含组之前声明其包含组的位置</li>\n<li><code>afterGroupContaining</code> - 为单个上下文菜单提供一种方法，用于在具有指定标签项的包含组之后声明其包含组的位置</li>\n</ul>\n<p>默认情况下，除非有位置相关的属性，所有的菜单项会按照模板中的顺序排放。</p>\n<h3 id=\"示例-1\"><a href=\"#示例-1\">示例</a></h3>\n<p>模板：</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'4'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'four'</span> }\n]\n</code></pre>\n<p>菜单:</p>\n<pre><code class=\"hljs language-sh\">- 1\n- 2\n- 3\n- 4\n</code></pre>\n<p>模板：</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span> },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span>, <span class=\"hljs-attr\">beforeGroupContaining</span>: [<span class=\"hljs-string\">'1'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'4'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'four'</span>, <span class=\"hljs-attr\">afterGroupContaining</span>: [<span class=\"hljs-string\">'2'</span>] },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span> }\n]\n</code></pre>\n<p>菜单:</p>\n<pre><code class=\"hljs language-sh\">- 3\n- 4\n- ---\n- 1\n- ---\n- 2\n</code></pre>\n<p>模板：</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span>, <span class=\"hljs-attr\">after</span>: [<span class=\"hljs-string\">'3'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span>, <span class=\"hljs-attr\">before</span>: [<span class=\"hljs-string\">'1'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span> }\n]\n</code></pre>\n<p>菜单:</p>\n<pre><code class=\"hljs language-sh\">- ---\n- 3\n- 2\n- 1\n</code></pre>",
      "title": "Menu",
      "description": "创建原生应用菜单和上下文菜单。"
    },
    "/docs/api/menu-item": {
      "locale": "zh-CN",
      "slug": "menu-item",
      "href": "/docs/api/menu-item",
      "crowdinFileId": "256333",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/menu-item.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"菜单项\"><a href=\"#菜单项\">菜单项</a></h2>\n<blockquote>\n<p>添加菜单项到应用程序菜单和上下文菜单中</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p>有关示例, 请参见 <a href=\"/docs/api/menu\"><code>Menu</code></a>。</p>\n<h3 id=\"new-menuitemoptions\"><a href=\"#new-menuitemoptions\"><code>new MenuItem(options)</code></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>click</code> 函数(可选) - 单击菜单项时，将用 <code>click(menuItem, browserWindow, event)</code> 调用。<ul>\n<li><code>menuItem</code> MenuItem</li>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> |未定义 - 如果没有打开窗口，则无法定义此定义。</li>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n</ul></li>\n<li><code>role</code> String (optional) - Can be <code>undo</code>, <code>redo</code>, <code>cut</code>, <code>copy</code>, <code>paste</code>, <code>pasteAndMatchStyle</code>, <code>delete</code>, <code>selectAll</code>, <code>reload</code>, <code>forceReload</code>, <code>toggleDevTools</code>, <code>resetZoom</code>, <code>zoomIn</code>, <code>zoomOut</code>, <code>toggleSpellChecker</code>, <code>togglefullscreen</code>, <code>window</code>, <code>minimize</code>, <code>close</code>, <code>help</code>, <code>about</code>, <code>services</code>, <code>hide</code>, <code>hideOthers</code>, <code>unhide</code>, <code>quit</code>, <code>startSpeaking</code>, <code>stopSpeaking</code>, <code>zoom</code>, <code>front</code>, <code>appMenu</code>, <code>fileMenu</code>, <code>editMenu</code>, <code>viewMenu</code>, <code>shareMenu</code>, <code>recentDocuments</code>, <code>toggleTabBar</code>, <code>selectNextTab</code>, <code>selectPreviousTab</code>, <code>mergeAllWindows</code>, <code>clearRecentDocuments</code>, <code>moveTabToNewWindow</code> or <code>windowMenu</code> - Define the action of the menu item, when specified the <code>click</code> property will be ignored. 参见 <a href=\"#roles\">roles</a></li>\n<li><code>type</code>String (可选)-可以是 <code>normal</code>、<code>separator</code>、<code>submenu</code>、<code>checkbox</code> 或 <code>radio</code>。</li>\n<li><code>label</code> String (可选)</li>\n<li><code>sublabel</code> String (可选)</li>\n<li><code>toolTip</code> String (可选) <em>macOS</em> - 此菜单的悬停文本提示</li>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a> (可选)</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (可选)</li>\n<li><code>enabled</code> Boolean (可选) - 如果为 false，该菜单项将会置灰且不可点击。</li>\n<li><code>acceleratorWorksWhenHidden</code> Boolean (可选) <em>macOS</em> - 默认为 <code>true</code>, 当为 <code>false</code> 时将阻止隐藏按钮通过快捷键触发。</li>\n<li><code>visible</code>Boolean (可选)-如果为 false, 该菜单项将完全隐藏。</li>\n<li><code>checked</code>Boolean (可选)-只应为 <code>checkbox</code> 或 <code>radio</code> 类型菜单项指定。</li>\n<li><code>registerAccelerator</code> Boolean (可选) <em>Linux</em> <em>Windows</em> - 若为 false, 则快捷键将不会被注册到系统内，但还是会显示出来。 默认值为 true。</li>\n<li><code>sharingItem</code> SharingItem (可选) <em>macOS</em> - 当 <code>role</code> 为 <code>shareMenu</code>时指定要分享的项</li>\n<li><code>submenu</code> (MenuItemConstructorOptions[] | <a href=\"/docs/api/menu\">Menu</a>) (可选) - 应该是固定类型菜单<code>submenu</code> 如果指定 <code>submenu</code> ，可以省略 <code>type: 'submenu'</code> 如果该值不属于<a href=\"/docs/api/menu\"><code>Menu</code></a>，它将被函数<code>Menu.buildFromTemplate</code>自动转换。</li>\n<li><code>id</code> String (可选) - 单个菜单内唯一。 若定义，则可以通过 position 位置属性找到此选项</li>\n<li><code>before</code> String<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a> - 在指定标签项前插入此项 如果引用值不存在，那么该菜单项会插在这个菜单的尾部。 这还意味着，菜单项应该被放置在与引用项相同的组中。</li>\n<li><code>after</code> String<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a> - 在指定的标签之后插入菜单项。 如果引用值不存在，那么该菜单项会插在这个菜单的尾部。</li>\n<li><code>beforeGroupContaining</code> String<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a> - 为单个上下文菜单提供一种方法，用于在具有指定标签的项的包含组之前声明其包含组的位置。</li>\n<li><code>afterGroupContaining</code> String<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a> - 为单个上下文菜单提供一种方法，用于在具有指定标签的项的包含组之后声明其包含组的位置。</li>\n</ul></li>\n</ul>\n<p><strong>注意:</strong> <code>acceleratorWorksWhenHidden</code> 这个选项只有 macOS 生效，因为在 Windows 和 Linux 系统下快捷键即使在隐藏情况下也会生效。 该选项让用户可以选择关闭，因为这是本地 macOS 开发中的可能。 此属性只能在macOS High Sierra 10.13或以上中使用。</p>\n<h3 id=\"角色\"><a href=\"#角色\">角色</a></h3>\n<p>可以通过角色来为menu添加预定义行为。</p>\n<p>最好给任何一个菜单指定 <code>role</code>去匹配一个标准角色, 而不是尝试在 <code>click</code> 函数中手动实现该行为。 内置的 <code>role</code> 行为将提供最佳的原生体验。</p>\n<p>使用 <code>role</code> 时, <code>label</code> 和 <code>accelerator</code> 值是可选的, 并为每个平台，将默认为适当值。</p>\n<p>每个菜单项必须有一个 <code>role</code>, <code>label</code>, 或者一个分隔符一个 <code>type</code></p>\n<p><code>role </code> 属性可以具有以下值:</p>\n<ul>\n<li><code>undo - 撤销。</code></li>\n<li><code>about</code> - 触发原生信息面板 (在 Window 中自定义消息盒子, 本身不提供).</li>\n<li><code>redo</code></li>\n<li><code>cut - 剪切。</code></li>\n<li><code>copy - 复制。</code></li>\n<li><code>paste - 粘贴。</code></li>\n<li><code>pasteAndMatchStyle</code></li>\n<li><code>selectAll - 全选。</code></li>\n<li><code>delete -删除</code></li>\n<li><code>minimize</code> - 最小化当前窗口。</li>\n<li><code>close</code> - 关闭当前窗口</li>\n<li><code>quit</code> - 退出程序</li>\n<li><code>reload</code> - 重新加载当前窗口。</li>\n<li><code>forcereload</code> - 忽略缓存，重新加载当前窗口。</li>\n<li><code>toggledevtools</code> - 在当前窗口中隐藏/显示开发者工具。</li>\n<li><code>togglefullscreen</code> - 将当前窗口切换至全屏模式。</li>\n<li><code>resetzoom</code> - 将主页的缩放级别重置为初始大小.</li>\n<li><code>zoomin</code> - 主页面放大 10%.</li>\n<li><code>zoomout</code> -主页面缩小 10%.</li>\n<li><code>toggleSpellChecker</code> - 启用/禁用内置拼写检查器。</li>\n<li><code>fileMenu</code> - 默认的“文件”菜单（关闭/退出）</li>\n<li><code>editMenu</code>-默认的 \"编辑\" 菜单 (包括撤消、复制等)</li>\n<li><code>viewMenu</code> - 默认的“视图”菜单（包括重新加载、开发者工具等）</li>\n<li><code>windowMenu</code> - 默认的“窗口”菜单（包括最小化、缩放等）</li>\n</ul>\n<p>以下其他角色可在 <em>macOS</em> 上找到：</p>\n<ul>\n<li><code>appMenu</code> - 整个默认\"App\" menu (About, Services, 等)</li>\n<li><code>hide</code>-映射到 <code>hide</code> 操作.</li>\n<li><code>hideOthers</code>-映射到 <code>hideOtherApplications</code> 操作.</li>\n<li><code>unhide</code> - 映射到 <code>unhideAllApplications</code> 动作</li>\n<li><code>startSpeaking</code>-映射到 <code>startSpeaking</code> 操作.</li>\n<li><code>stopSpeaking</code>-映射到 <code>stopSpeaking</code> 操作.</li>\n<li><code>front</code> - 映射到 <code>arrangeInFront</code> 动作</li>\n<li><code>zoom</code> - 映射到 <code>performZoom</code> 动作</li>\n<li><code>toggleTabBar</code>-映射到 <code>toggleTabBar</code> 操作.</li>\n<li><code>selectNextTab</code> - 映射到 <code>selectNextTab</code> 操作.</li>\n<li><code>selectPreviousTab</code> - 映射到 <code>selectPreviousTab</code> 操作.</li>\n<li><code>mergeAllWindows</code> - 映射到 <code>mergeAllWindows</code> 操作.</li>\n<li><code>moveTabToNewWindow</code> - 映射到 <code>moveTabToNewWindow</code> 操作.</li>\n<li><code>window</code> - 这个子菜单是\"Window\" 菜单.</li>\n<li><code>help</code>-这个子菜单是 \"Help\" 菜单.</li>\n<li><code>services</code> - 子菜单是 <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc\">\"Services\"</a> 菜单。 此选项仅应用于 Application Menu 而且 <em>不同于</em>在 macOS app 中上下文菜单中的 \"Services\" 子菜单，因为它不是由 Electron 实现的</li>\n<li><code>recentDocuments</code>-这个子菜单是 \"Open Recent\" 菜单.</li>\n<li><code>clearRecentDocuments</code> -映射到 <code>clearRecentDocuments</code> 操作.</li>\n<li><code>shareMenu</code> - <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/\">share menu</a>的子菜单。 <code>sharingItem</code> 属性必须被设置， 用于指向被分享的项</li>\n</ul>\n<p>在 macOS 上指定 <code>role</code> 时, <code>label</code> 和 <code>accelerator</code> 是影响菜单项的唯一选项。 所有其它选项都将被忽略。 不过，仍然支持小写的<code>role</code>，如<code>toggledevtools</code>。</p>\n<p><strong>注意:</strong> 对于托盘上的顶级菜单项不可用的 <code>enabled</code> 和 <code>visibility</code> 属性</p>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<p>以下为 <code>MenuItem</code> 实例的可用属性:</p>\n<h4 id=\"menuitemid\"><a href=\"#menuitemid\"><code>menuItem.id</code></a></h4>\n<p><code>String</code> 指定了该选项唯一的id，此属性可被动态更改。</p>\n<h4 id=\"menuitemlabel\"><a href=\"#menuitemlabel\"><code>menuItem.label</code></a></h4>\n<p>一个表示菜单项标签的 <code>String</code></p>\n<h4 id=\"menuitemclick\"><a href=\"#menuitemclick\"><code>menuItem.click</code></a></h4>\n<p>MenuItem接收到点击事件后自动触发的方法 <code>Function</code> 。 调用方法为 <code>menuItem.click(event, focusedWindow, focusedWebContents)</code>.</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>focusedWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n<li><code>focusedWebContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<h4 id=\"menuitemsubmenu\"><a href=\"#menuitemsubmenu\"><code>menuItem.submenu</code></a></h4>\n<p>A <code>Menu</code> (可选) 指定子菜单</p>\n<h4 id=\"menuitemtype\"><a href=\"#menuitemtype\"><code>menuItem.type</code></a></h4>\n<p><code>String</code> 表示菜单项的类型 可以是 <code>normal</code>, <code>separator</code>, <code>submenu</code>, <code>checkbox</code> 或 <code>radio</code>.</p>\n<h4 id=\"menuitemrole\"><a href=\"#menuitemrole\"><code>menuItem.role</code></a></h4>\n<p><code>String</code>（可选） 指出菜单项的角色 Can be <code>undo</code>, <code>redo</code>, <code>cut</code>, <code>copy</code>, <code>paste</code>, <code>pasteAndMatchStyle</code>, <code>delete</code>, <code>selectAll</code>, <code>reload</code>, <code>forceReload</code>, <code>toggleDevTools</code>, <code>resetZoom</code>, <code>zoomIn</code>, <code>zoomOut</code>, <code>toggleSpellChecker</code>, <code>togglefullscreen</code>, <code>window</code>, <code>minimize</code>, <code>close</code>, <code>help</code>, <code>about</code>, <code>services</code>, <code>hide</code>, <code>hideOthers</code>, <code>unhide</code>, <code>quit</code>, <code>startSpeaking</code>, <code>stopSpeaking</code>, <code>zoom</code>, <code>front</code>, <code>appMenu</code>, <code>fileMenu</code>, <code>editMenu</code>, <code>viewMenu</code>, <code>shareMenu</code>, <code>recentDocuments</code>, <code>toggleTabBar</code>, <code>selectNextTab</code>, <code>selectPreviousTab</code>, <code>mergeAllWindows</code>, <code>clearRecentDocuments</code>, <code>moveTabToNewWindow</code> or <code>windowMenu</code></p>\n<h4 id=\"menuitemaccelerator\"><a href=\"#menuitemaccelerator\"><code>menuItem.accelerator</code></a></h4>\n<p>An <code>Accelerator</code> (optional) indicating the item's accelerator, if set.</p>\n<h4 id=\"menuitemuseraccelerator-readonly-macos\"><a href=\"#menuitemuseraccelerator-readonly-macos\"><code>menuItem.userAccelerator</code> <em>Readonly</em> <em>macOS</em></a></h4>\n<p>An <code>Accelerator | null</code> indicating the item's <a href=\"https://developer.apple.com/documentation/appkit/nsmenuitem/1514850-userkeyequivalent?language=objc\">user-assigned accelerator</a> for the menu item.</p>\n<p><strong>Note:</strong> This property is only initialized after the <code>MenuItem</code> has been added to a <code>Menu</code>. Either via <code>Menu.buildFromTemplate</code> or via <code>Menu.append()/insert()</code>.  Accessing before initialization will just return <code>null</code>.</p>\n<h4 id=\"menuitemicon\"><a href=\"#menuitemicon\"><code>menuItem.icon</code></a></h4>\n<p><code>NativeImage | String</code> (可选) 若设置， 则从对应的值中找选项图标</p>\n<h4 id=\"menuitemsublabel\"><a href=\"#menuitemsublabel\"><code>menuItem.sublabel</code></a></h4>\n<p><code>String</code> 表明选项的子标签</p>\n<h4 id=\"menuitemtooltip-macos\"><a href=\"#menuitemtooltip-macos\"><code>menuItem.toolTip</code> <em>macOS</em></a></h4>\n<p><code>String</code> 选项的悬停文本内容</p>\n<h4 id=\"menuitemenabled\"><a href=\"#menuitemenabled\"><code>menuItem.enabled</code></a></h4>\n<p>一个 <code>Boolean</code> 类型的值, 指示是否启用该项, 该属性可以动态改变</p>\n<h4 id=\"menuitemvisible\"><a href=\"#menuitemvisible\"><code>menuItem.visible</code></a></h4>\n<p>一个 <code>Boolean</code> 类型的值, 指示该项是否可见, 该属性可以动态改变。</p>\n<h4 id=\"menuitemchecked\"><a href=\"#menuitemchecked\"><code>menuItem.checked</code></a></h4>\n<p>一个 <code>Boolean</code> 类型的值, 指示是否选中该项, 该属性可以动态改变。</p>\n<p><code>checkbox</code> 菜单项将在选中时切换 <code>checked</code> 的开关属性。</p>\n<p><code>单选菜单项</code> 将返回单击时<code>checked</code>属性, 并将关闭同一菜单中所有相邻项的属性。</p>\n<p>你可以为其他行为添加<code>click</code>函数。</p>\n<h4 id=\"menuitemregisteraccelerator\"><a href=\"#menuitemregisteraccelerator\"><code>menuItem.registerAccelerator</code></a></h4>\n<p>通过 <code>Boolean</code>表明快捷键跟随系统注册还是仅仅展示出来</p>\n<p>此属性可以动态更改。</p>\n<h4 id=\"menuitemsharingitem-macos\"><a href=\"#menuitemsharingitem-macos\"><code>menuItem.sharingItem</code> <em>macOS</em></a></h4>\n<p><code>SharingItem</code> 表示了当 <code>role</code> 是 <code>shareMenu</code> 时要分享的项。</p>\n<p>此属性可以动态更改。</p>\n<h4 id=\"menuitemcommandid\"><a href=\"#menuitemcommandid\"><code>menuItem.commandId</code></a></h4>\n<p>表示项目顺序唯一 Id 的 <code>Number</code></p>\n<h4 id=\"menuitemmenu\"><a href=\"#menuitemmenu\"><code>menuItem.menu</code></a></h4>\n<p>多个选项组成一个 <code>Menu</code></p>",
      "title": "菜单项",
      "description": "添加菜单项到应用程序菜单和上下文菜单中"
    },
    "/docs/api/message-channel-main": {
      "locale": "zh-CN",
      "slug": "message-channel-main",
      "href": "/docs/api/message-channel-main",
      "crowdinFileId": "256337",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/message-channel-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messagechannelmain\"><a href=\"#messagechannelmain\">MessageChannelMain</a></h1>\n<p><code>MessageChannelMain</code> is the main-process-side equivalent of the DOM <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\"><code>MessageChannel</code></a> object. Its singular function is to create a pair of connected <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> objects.</p>\n<p>See the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> documentation for more information on using channel messaging.</p>\n<h2 id=\"class-messagechannelmain\"><a href=\"#class-messagechannelmain\">Class: MessageChannelMain</a></h2>\n<blockquote>\n<p>主进程中用于通道消息传递的通道接口。</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p>示例：</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 主进程</span>\n<span class=\"hljs-keyword\">const</span> { MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nw.webContents.postMessage(<span class=\"hljs-string\">'port'</span>, <span class=\"hljs-literal\">null</span>, [port2])\nport1.postMessage({ <span class=\"hljs-attr\">some</span>: <span class=\"hljs-string\">'message'</span> })\n\n<span class=\"hljs-comment\">// 渲染器进程</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e) => {\n  <span class=\"hljs-comment\">// e.ports is a list of ports sent along with this message</span>\n  e.ports[<span class=\"hljs-number\">0</span>].on(<span class=\"hljs-string\">'message'</span>, (messageEvent) => {\n    <span class=\"hljs-built_in\">console</span>.log(messageEvent.data)\n  })\n})\n</code></pre>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<h4 id=\"channelport1\"><a href=\"#channelport1\"><code>channel.port1</code></a></h4>\n<p>A <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> property.</p>\n<h4 id=\"channelport2\"><a href=\"#channelport2\"><code>channel.port2</code></a></h4>\n<p>A <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> property.</p>",
      "title": "MessageChannelMain",
      "description": "主进程中用于通道消息传递的通道接口。"
    },
    "/docs/api/message-port-main": {
      "locale": "zh-CN",
      "slug": "message-port-main",
      "href": "/docs/api/message-port-main",
      "crowdinFileId": "256339",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/message-port-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messageportmain\"><a href=\"#messageportmain\">MessagePortMain</a></h1>\n<p><code>MessagePortMain</code> 是 DOM <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> 对象的主进程等价对象。 它的行为类似于DOM版本，不同的是它使用 Node.js <code>EventEmitter</code> 事件系统，而不是 DOM <code>EventTarget</code> 系统。 这意味着你应该用 <code>port.on('message', ...)</code> 来监听事件, 来代替 <code>port.onmessage = ...</code> 或 <code>port.addEventListener('message', ...)</code></p>\n<p>关于 channel 消息的使用文档详见 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a></p>\n<p><code>MessagePortMain</code> 是一个 [EventEmitter][event-emitter].</p>\n<h2 id=\"class-messageportmain\"><a href=\"#class-messageportmain\">Class: MessagePortMain</a></h2>\n<blockquote>\n<p>主进程中用于通道消息传递的端口接口。</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<h4 id=\"portpostmessagemessage-transfer\"><a href=\"#portpostmessagemessage-transfer\"><code>port.postMessage(message, [transfer])</code></a></h4>\n<ul>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a></li>\n</ul>\n<p>从端口发送消息，并可选地将对象的所有权转移到其他浏览上下文。</p>\n<h4 id=\"portstart\"><a href=\"#portstart\"><code>port.start()</code></a></h4>\n<p>开始发送在端口上排队的消息。 消息将先缓存到队列, 直到此方法被调用。</p>\n<h4 id=\"portclose\"><a href=\"#portclose\"><code>port.close()</code></a></h4>\n<p>断开端口连接</p>\n<h3 id=\"实例事件\"><a href=\"#实例事件\">实例事件</a></h3>\n<h4 id=\"event-message\"><a href=\"#event-message\">Event: 'message'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>messageEvent</code> Object<ul>\n<li><code>data</code> any</li>\n<li><code>ports</code> MessagePortMain[]</li>\n</ul></li>\n</ul>\n<p>MessagePortMain 对象收到消息时触发此事件</p>\n<h4 id=\"事件：-close\"><a href=\"#事件：-close\">事件： 'close'</a></h4>\n<p>当MessagePortMain 对象的远程端断开连接时触发此事件</p>",
      "title": "MessagePortMain",
      "description": "主进程中用于通道消息传递的端口接口。"
    },
    "/docs/tutorial/message-ports": {
      "locale": "zh-CN",
      "slug": "message-ports",
      "href": "/docs/tutorial/message-ports",
      "crowdinFileId": "256219",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/message-ports.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messageports-in-electron\"><a href=\"#messageports-in-electron\">MessagePorts in Electron</a></h1>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a>s are a web feature that allow passing messages between different contexts. It's like <code>window.postMessage</code>, but on different channels. The goal of this document is to describe how Electron extends the Channel Messaging model, and to give some examples of how you might use MessagePorts in your app.</p>\n<p>Here is a very brief example of what a MessagePort is and how it works:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer.js ///////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-comment\">// MessagePorts are created in pairs. A connected pair of message ports is</span>\n<span class=\"hljs-comment\">// called a channel.</span>\n<span class=\"hljs-keyword\">const</span> channel = <span class=\"hljs-keyword\">new</span> MessageChannel()\n\n<span class=\"hljs-comment\">// The only difference between port1 and port2 is in how you use them. Messages</span>\n<span class=\"hljs-comment\">// sent to port1 will be received by port2 and vice-versa.</span>\n<span class=\"hljs-keyword\">const</span> port1 = channel.port1\n<span class=\"hljs-keyword\">const</span> port2 = channel.port2\n\n<span class=\"hljs-comment\">// It's OK to send a message on the channel before the other end has registered</span>\n<span class=\"hljs-comment\">// a listener. Messages will be queued until a listener is registered.</span>\nport2.postMessage({ <span class=\"hljs-attr\">answer</span>: <span class=\"hljs-number\">42</span> })\n\n<span class=\"hljs-comment\">// Here we send the other end of the channel, port1, to the main process. It's</span>\n<span class=\"hljs-comment\">// also possible to send MessagePorts to other frames, or to Web Workers, etc.</span>\nipcRenderer.postMessage(<span class=\"hljs-string\">'port'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-comment\">// In the main process, we receive the port.</span>\nipcMain.on(<span class=\"hljs-string\">'port'</span>, (event) => {\n  <span class=\"hljs-comment\">// When we receive a MessagePort in the main process, it becomes a</span>\n  <span class=\"hljs-comment\">// MessagePortMain.</span>\n  <span class=\"hljs-keyword\">const</span> port = event.ports[<span class=\"hljs-number\">0</span>]\n\n  <span class=\"hljs-comment\">// MessagePortMain uses the Node.js-style events API, rather than the</span>\n  <span class=\"hljs-comment\">// web-style events API. So .on('message', ...) instead of .onmessage = ...</span>\n  port.on(<span class=\"hljs-string\">'message'</span>, (event) => {\n    <span class=\"hljs-comment\">// data is { answer: 42 }</span>\n    <span class=\"hljs-keyword\">const</span> data = event.data\n  })\n\n  <span class=\"hljs-comment\">// MessagePortMain queues messages until the .start() method has been called.</span>\n  port.start()\n})\n</code></pre>\n<p>The <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> documentation is a great way to learn more about how MessagePorts work.</p>\n<h2 id=\"messageports-in-the-main-process\"><a href=\"#messageports-in-the-main-process\">MessagePorts in the main process</a></h2>\n<p>In the renderer, the <code>MessagePort</code> class behaves exactly as it does on the web. The main process is not a web page, though—it has no Blink integration—and so it does not have the <code>MessagePort</code> or <code>MessageChannel</code> classes. In order to handle and interact with MessagePorts in the main process, Electron adds two new classes: <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> and <a href=\"/docs/api/message-channel-main\"><code>MessageChannelMain</code></a>. These behave similarly to the analogous classes in the renderer.</p>\n<p><code>MessagePort</code> objects can be created in either the renderer or the main process, and passed back and forth using the <a href=\"/docs/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a> and <a href=\"/docs/api/web-contents#contentspostmessagechannel-message-transfer\"><code>WebContents.postMessage</code></a> methods. Note that the usual IPC methods like <code>send</code> and <code>invoke</code> cannot be used to transfer <code>MessagePort</code>s, only the <code>postMessage</code> methods can transfer <code>MessagePort</code>s.</p>\n<p>By passing <code>MessagePort</code>s via the main process, you can connect two pages that might not otherwise be able to communicate (e.g. due to same-origin restrictions).</p>\n<h2 id=\"extension-close-event\"><a href=\"#extension-close-event\">Extension: <code>close</code> event</a></h2>\n<p>Electron adds one feature to <code>MessagePort</code> that isn't present on the web, in order to make MessagePorts more useful. That is the <code>close</code> event, which is emitted when the other end of the channel is closed. Ports can also be implicitly closed by being garbage-collected.</p>\n<p>In the renderer, you can listen for the <code>close</code> event either by assigning to <code>port.onclose</code> or by calling <code>port.addEventListener('close', ...)</code>. In the main process, you can listen for the <code>close</code> event by calling <code>port.on('close', ...)</code>.</p>\n<h2 id=\"example-use-cases\"><a href=\"#example-use-cases\">Example use cases</a></h2>\n<h3 id=\"worker-process\"><a href=\"#worker-process\">Worker process</a></h3>\n<p>In this example, your app has a worker process implemented as a hidden window. You want the app page to be able to communicate directly with the worker process, without the performance overhead of relaying via the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow, app, ipcMain, MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-comment\">// The worker process is a hidden BrowserWindow, so that it will have access</span>\n  <span class=\"hljs-comment\">// to a full Blink context (including e.g. &#x3C;canvas>, audio, fetch(), etc.)</span>\n  <span class=\"hljs-keyword\">const</span> worker = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span> }\n  })\n  <span class=\"hljs-keyword\">await</span> worker.loadFile(<span class=\"hljs-string\">'worker.html'</span>)\n\n  <span class=\"hljs-comment\">// The main window will send work to the worker process and receive results</span>\n  <span class=\"hljs-comment\">// over a MessagePort.</span>\n  <span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span> }\n  })\n  mainWindow.loadFile(<span class=\"hljs-string\">'app.html'</span>)\n\n  <span class=\"hljs-comment\">// We can't use ipcMain.handle() here, because the reply needs to transfer a</span>\n  <span class=\"hljs-comment\">// MessagePort.</span>\n  ipcMain.on(<span class=\"hljs-string\">'request-worker-channel'</span>, (event) => {\n    <span class=\"hljs-comment\">// For security reasons, let's make sure only the frames we expect can</span>\n    <span class=\"hljs-comment\">// access the worker.</span>\n    <span class=\"hljs-keyword\">if</span> (event.senderFrame === mainWindow.webContents.mainFrame) {\n      <span class=\"hljs-comment\">// Create a new channel ...</span>\n      <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\n      <span class=\"hljs-comment\">// ... send one end to the worker ...</span>\n      worker.webContents.postMessage(<span class=\"hljs-string\">'new-client'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n      <span class=\"hljs-comment\">// ... and the other end to the main window.</span>\n      event.senderFrame.postMessage(<span class=\"hljs-string\">'provide-worker-channel'</span>, <span class=\"hljs-literal\">null</span>, [port2])\n      <span class=\"hljs-comment\">// Now the main window and the worker can communicate with each other</span>\n      <span class=\"hljs-comment\">// without going through the main process!</span>\n    }\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- worker.html ------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">doWork</span>(<span class=\"hljs-params\">input</span>) </span>{\n  <span class=\"hljs-comment\">// Something cpu-intensive.</span>\n  <span class=\"hljs-keyword\">return</span> input * <span class=\"hljs-number\">2</span>\n}\n\n<span class=\"hljs-comment\">// We might get multiple clients, for instance if there are multiple windows,</span>\n<span class=\"hljs-comment\">// or if the main window reloads.</span>\nipcRenderer.on(<span class=\"hljs-string\">'new-client'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n  port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    <span class=\"hljs-comment\">// The event data can be any serializable object (and the event could even</span>\n    <span class=\"hljs-comment\">// carry other MessagePorts with it!)</span>\n    <span class=\"hljs-keyword\">const</span> result = doWork(event.data)\n    port.postMessage(result)\n  }\n})\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- app.html ---------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// We request that the main process sends us a channel we can use to</span>\n<span class=\"hljs-comment\">// communicate with the worker.</span>\nipcRenderer.send(<span class=\"hljs-string\">'request-worker-channel'</span>)\n\nipcRenderer.once(<span class=\"hljs-string\">'provide-worker-channel'</span>, (event) => {\n  <span class=\"hljs-comment\">// Once we receive the reply, we can take the port...</span>\n  <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n  <span class=\"hljs-comment\">// ... register a handler to receive results ...</span>\n  port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'received result:'</span>, event.data)\n  }\n  <span class=\"hljs-comment\">// ... and start sending it work!</span>\n  port.postMessage(<span class=\"hljs-number\">21</span>)\n})\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h3 id=\"reply-streams\"><a href=\"#reply-streams\">Reply streams</a></h3>\n<p>Electron's built-in IPC methods only support two modes: fire-and-forget (e.g. <code>send</code>), or request-response (e.g. <code>invoke</code>). Using MessageChannels, you can implement a \"response stream\", where a single request responds with a stream of data.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer.js ///////////////////////////////////////////////////////////////</span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">makeStreamingRequest</span> (<span class=\"hljs-params\">element, callback</span>) </span>{\n  <span class=\"hljs-comment\">// MessageChannels are lightweight--it's cheap to create a new one for each</span>\n  <span class=\"hljs-comment\">// request.</span>\n  <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannel()\n\n  <span class=\"hljs-comment\">// We send one end of the port to the main process ...</span>\n  ipcRenderer.postMessage(\n    <span class=\"hljs-string\">'give-me-a-stream'</span>,\n    { element, <span class=\"hljs-attr\">count</span>: <span class=\"hljs-number\">10</span> },\n    [port2]\n  )\n\n  <span class=\"hljs-comment\">// ... and we hang on to the other end. The main process will send messages</span>\n  <span class=\"hljs-comment\">// to its end of the port, and close it when it's finished.</span>\n  port1.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    callback(event.data)\n  }\n  port1.onclose = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'stream ended'</span>)\n  }\n}\n\nmakeStreamingRequest(<span class=\"hljs-number\">42</span>, (data) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'got response data:'</span>, event.data)\n})\n<span class=\"hljs-comment\">// We will see \"got response data: 42\" 10 times.</span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n\nipcMain.on(<span class=\"hljs-string\">'give-me-a-stream'</span>, (event, msg) => {\n  <span class=\"hljs-comment\">// The renderer has sent us a MessagePort that it wants us to send our</span>\n  <span class=\"hljs-comment\">// response over.</span>\n  <span class=\"hljs-keyword\">const</span> [replyPort] = event.ports\n\n  <span class=\"hljs-comment\">// Here we send the messages synchronously, but we could just as easily store</span>\n  <span class=\"hljs-comment\">// the port somewhere and send messages asynchronously.</span>\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">let</span> i = <span class=\"hljs-number\">0</span>; i &#x3C; msg.count; i++) {\n    replyPort.postMessage(msg.element)\n  }\n\n  <span class=\"hljs-comment\">// We close the port when we're done to indicate to the other end that we</span>\n  <span class=\"hljs-comment\">// won't be sending any more messages. This isn't strictly necessary--if we</span>\n  <span class=\"hljs-comment\">// didn't explicitly close the port, it would eventually be garbage</span>\n  <span class=\"hljs-comment\">// collected, which would also trigger the 'close' event in the renderer.</span>\n  replyPort.close()\n})\n</code></pre>\n<h3 id=\"communicating-directly-between-the-main-process-and-the-main-world-of-a-context-isolated-page\"><a href=\"#communicating-directly-between-the-main-process-and-the-main-world-of-a-context-isolated-page\">Communicating directly between the main process and the main world of a context-isolated page</a></h3>\n<p>When <a href=\"/docs/tutorial/context-isolation\">context isolation</a> is enabled, IPC messages from the main process to the renderer are delivered to the isolated world, rather than to the main world. Sometimes you want to deliver messages to the main world directly, without having to step through the isolated world.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow, app, MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-comment\">// Create a BrowserWindow with contextIsolation enabled.</span>\n  <span class=\"hljs-keyword\">const</span> bw = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">contextIsolation</span>: <span class=\"hljs-literal\">true</span>,\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n  bw.loadURL(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-comment\">// We'll be sending one end of this channel to the main world of the</span>\n  <span class=\"hljs-comment\">// context-isolated page.</span>\n  <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\n\n  <span class=\"hljs-comment\">// It's OK to send a message on the channel before the other end has</span>\n  <span class=\"hljs-comment\">// registered a listener. Messages will be queued until a listener is</span>\n  <span class=\"hljs-comment\">// registered.</span>\n  port2.postMessage({ <span class=\"hljs-attr\">test</span>: <span class=\"hljs-number\">21</span> })\n\n  <span class=\"hljs-comment\">// We can also receive messages from the main world of the renderer.</span>\n  port2.on(<span class=\"hljs-string\">'message'</span>, (event) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'from renderer main world:'</span>, event.data)\n  })\n  port2.start()\n\n  <span class=\"hljs-comment\">// The preload script will receive this IPC message and transfer the port</span>\n  <span class=\"hljs-comment\">// over to the main world.</span>\n  bw.webContents.postMessage(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// preload.js ////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// We need to wait until the main world is ready to receive the message before</span>\n<span class=\"hljs-comment\">// sending the port. We create this promise in the preload so it's guaranteed</span>\n<span class=\"hljs-comment\">// to register the onload listener before the load event is fired.</span>\n<span class=\"hljs-keyword\">const</span> windowLoaded = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> {\n  <span class=\"hljs-built_in\">window</span>.onload = resolve\n})\n\nipcRenderer.on(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-keyword\">async</span> (event) => {\n  <span class=\"hljs-keyword\">await</span> windowLoaded\n  <span class=\"hljs-comment\">// We use regular window.postMessage to transfer the port from the isolated</span>\n  <span class=\"hljs-comment\">// world to the main world.</span>\n  <span class=\"hljs-built_in\">window</span>.postMessage(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-string\">'*'</span>, event.ports)\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- index.html -------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-built_in\">window</span>.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n  <span class=\"hljs-comment\">// event.source === window means the message is coming from the preload</span>\n  <span class=\"hljs-comment\">// script, as opposed to from an &#x3C;iframe> or other source.</span>\n  <span class=\"hljs-keyword\">if</span> (event.source === <span class=\"hljs-built_in\">window</span> &#x26;&#x26; event.data === <span class=\"hljs-string\">'main-world-port'</span>) {\n    <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n    <span class=\"hljs-comment\">// Once we have the port, we can communicate directly with the main</span>\n    <span class=\"hljs-comment\">// process.</span>\n    port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'from main process:'</span>, event.data)\n      port.postMessage(event.data * <span class=\"hljs-number\">2</span>)\n    }\n  }\n}\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>",
      "title": "MessagePorts in Electron",
      "description": ""
    },
    "/docs/api/structures/mime-typed-buffer": {
      "locale": "zh-CN",
      "slug": "mime-typed-buffer",
      "href": "/docs/api/structures/mime-typed-buffer",
      "crowdinFileId": "256463",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mime-typed-buffer.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mimetypedbuffer-object\"><a href=\"#mimetypedbuffer-object\">MimeTypedBuffer Object</a></h1>\n<ul>\n<li><code>mimeType</code> String (optional) - MIME type of the buffer.</li>\n<li><code>charset</code> String (optional) - Charset of the buffer.</li>\n<li><code>data</code> Buffer - The actual Buffer content.</li>\n</ul>",
      "title": "MimeTypedBuffer Object",
      "description": ""
    },
    "/docs/api/structures/mouse-input-event": {
      "locale": "zh-CN",
      "slug": "mouse-input-event",
      "href": "/docs/api/structures/mouse-input-event",
      "crowdinFileId": "256465",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mouse-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mouseinputevent-object-extends-inputevent\"><a href=\"#mouseinputevent-object-extends-inputevent\">MouseInputEvent Object extends <code>InputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>mouseDown</code>, <code>mouseUp</code>, <code>mouseEnter</code>, <code>mouseLeave</code>, <code>contextMenu</code>, <code>mouseWheel</code> or <code>mouseMove</code>.</li>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n<li><code>button</code> String (optional) - The button pressed, can be <code>left</code>, <code>middle</code>, <code>right</code>.</li>\n<li><code>globalX</code> Integer (optional)</li>\n<li><code>globalY</code> Integer (optional)</li>\n<li><code>movementX</code> Integer (optional)</li>\n<li><code>movementY</code> Integer (optional)</li>\n<li><code>clickCount</code> Integer (optional)</li>\n</ul>",
      "title": "MouseInputEvent Object extends InputEvent",
      "description": ""
    },
    "/docs/api/structures/mouse-wheel-input-event": {
      "locale": "zh-CN",
      "slug": "mouse-wheel-input-event",
      "href": "/docs/api/structures/mouse-wheel-input-event",
      "crowdinFileId": "256467",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mouse-wheel-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mousewheelinputevent-object-extends-mouseinputevent\"><a href=\"#mousewheelinputevent-object-extends-mouseinputevent\">MouseWheelInputEvent Object extends <code>MouseInputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>mouseWheel</code>.</li>\n<li><code>deltaX</code> Integer (optional)</li>\n<li><code>deltaY</code> Integer (optional)</li>\n<li><code>wheelTicksX</code> Integer (optional)</li>\n<li><code>wheelTicksY</code> Integer (optional)</li>\n<li><code>accelerationRatioX</code> Integer (optional)</li>\n<li><code>accelerationRatioY</code> Integer (optional)</li>\n<li><code>hasPreciseScrollingDeltas</code> Boolean (optional)</li>\n<li><code>canScroll</code> Boolean (optional)</li>\n</ul>",
      "title": "MouseWheelInputEvent Object extends MouseInputEvent",
      "description": ""
    },
    "/docs/tutorial/multithreading": {
      "locale": "zh-CN",
      "slug": "multithreading",
      "href": "/docs/tutorial/multithreading",
      "crowdinFileId": "256221",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/multithreading.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"多线程\"><a href=\"#多线程\">多线程</a></h1>\n<p>通过<a href=\"https://developer.mozilla.org/en/docs/Web/API/Web_Workers_API/Using_web_workers\">Web Workers</a>，可以实现用操作系统级别的线程来跑JavaScript</p>\n<h2 id=\"多线程的nodejs\"><a href=\"#多线程的nodejs\">多线程的Node.js</a></h2>\n<p>可以在Electron的Web Workers里使用Node.js的特性。要用的话，需把<code>webPreferences</code>中的<code>nodeIntegrationInWorker</code>选项设置为<code>true</code></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegrationInWorker</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<p><code>nodeIntegrationInWorker</code> 可以独立于<code>nodeIntegration</code>使用，但<code>sandbox</code>必须不能设置为<code>true</code></p>\n<h2 id=\"可用的api\"><a href=\"#可用的api\">可用的API</a></h2>\n<p>Web Workers支持Node.js的所有内置模块，而且<code>asar</code>档案也仍通过Node.js的API来读取。 不过所有的Electron内置模块不可以用在多线程环境中。</p>\n<h2 id=\"原生nodejs模块\"><a href=\"#原生nodejs模块\">原生Node.js模块</a></h2>\n<p>在Web Workers里可以直接加载任何原生Node.js模块，但不推荐这样做。 大多数现存的原生模块是在假设单线程环境的情况下编写的，如果把它们用在Web Workers里会导致崩溃和内存损坏。</p>\n<p>请注意, 即使原生Node.js模块如果考虑到了线程安全问题， 但在 Web Worker中加载它仍然不安全, 因为 <code>process.dlopen</code> 函数并没有考虑线程安全。</p>\n<p>现在安全顺利地加载原生模块的唯一办法，就是确保在Web Workers启动后app不加载原生模块。</p>\n<pre><code class=\"hljs language-javascript\">process.dlopen = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Load native module is not safe'</span>)\n}\n<span class=\"hljs-keyword\">const</span> worker = <span class=\"hljs-keyword\">new</span> Worker(<span class=\"hljs-string\">'script.js'</span>)\n</code></pre>",
      "title": "多线程",
      "description": ""
    },
    "/docs/tutorial/native-file-drag-drop": {
      "locale": "zh-CN",
      "slug": "native-file-drag-drop",
      "href": "/docs/tutorial/native-file-drag-drop",
      "crowdinFileId": "256223",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/native-file-drag-drop.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"原生文件拖--放\"><a href=\"#原生文件拖--放\">原生文件拖 &#x26; 放</a></h1>\n<h2 id=\"概览\"><a href=\"#概览\">概览</a></h2>\n<p>作为桌面程序，当然希望能够实现操作系统的 drag &#x26; drop 功能。 很多网站已经支持拖拽文件， Electron 当然也支持</p>\n<p>要在您的应用中实现此功能，您需要调用 <a href=\"/docs/api/web-contents#contentsstartdragitem\"><code>webContent.startDrag(item)</code></a> API 响应 <code>ondragstart</code> 事件。</p>\n<h2 id=\"示例\"><a href=\"#示例\">示例</a></h2>\n<p>一个演示如何动态创建要从窗口中拖出的文件的示例。</p>\n<h3 id=\"preloadjs\"><a href=\"#preloadjs\">Preload.js</a></h3>\n<p>在 <code>preload.js</code> 中使用 <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> 注入方法 <code>window.electron.startDrag(...)</code> 将向主进程发送IPC消息。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'electron'</span>, {\n  <span class=\"hljs-attr\">startDrag</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">fileName</span>) =></span> {\n    ipcRenderer.send(<span class=\"hljs-string\">'ondragstart'</span>, path.join(process.cwd(), fileName))\n  }\n})\n</code></pre>\n<h3 id=\"indexhtml\"><a href=\"#indexhtml\">Index.html</a></h3>\n<p>添加一个可拖动元素到 <code>index.html</code>, 并引用你的渲染器脚本：</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">div</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"border:2px solid black;border-radius:3px;padding:5px;display:inline-block\"</span> <span class=\"hljs-attr\">draggable</span>=<span class=\"hljs-string\">\"true\"</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"drag\"</span>></span>拖动我<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">div</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h3 id=\"rendererjs\"><a href=\"#rendererjs\">Renderer.js</a></h3>\n<p>在 <code>renderer.js</code> 通过调用通过上述 <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> 添加的方法来设置渲染器进程处理拖动事件。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'drag'</span>).ondragstart = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n  event.preventDefault()\n  <span class=\"hljs-built_in\">window</span>.electron.startDrag(<span class=\"hljs-string\">'drag-and-drop.md'</span>)\n}\n</code></pre>\n<h3 id=\"mainjs\"><a href=\"#mainjs\">Main.js</a></h3>\n<p>在主进程中(<code>main.js</code> 文件)，将收到的事件带上文件路径和图标扩展到正在拖动的文件：</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/drag-and-drop\"><span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nipcMain.on(<span class=\"hljs-string\">'ondragstart'</span>, (event, filePath) => {\n  event.sender.startDrag({\n    <span class=\"hljs-attr\">file</span>: filePath,\n    <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'/path/to/icon.png'</span>\n  })\n})\n</code></pre>\n<p>启动 Electron 应用程序后，尝试将该项从 BrowserWindow 拖放到桌面上。 在本指南中，本项是位于项目根目录下的 Markdown 文件：</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/drag-and-drop.gif\" alt=\"拖放\"></p>",
      "title": "原生文件拖 & 放",
      "description": ""
    },
    "/docs/api/native-image": {
      "locale": "zh-CN",
      "slug": "native-image",
      "href": "/docs/api/native-image",
      "crowdinFileId": "256341",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/native-image.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nativeimage\"><a href=\"#nativeimage\">nativeImage</a></h1>\n<blockquote>\n<p>使用 PNG 或 JPG 文件创建托盘、dock和应用程序图标。</p>\n</blockquote>\n<p>进程： <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>在 Electron 内, 那些需要图片的 API 可以传递两种参数, 一种是文件路径, 一种是 <code>NativeImage</code> 实例对象。 空的图片对象将被 <code>null</code> 参数替代</p>\n<p>例如, 创建托盘或设置窗口图标时, 你可以传递 <code>String</code> 格式的图片路径</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'/Users/somebody/images/window.png'</span> })\n<span class=\"hljs-built_in\">console</span>.log(appIcon, win)\n</code></pre>\n<p>或者从粘贴板读取图片，将返回 <code>NativeImage</code> 对象：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { clipboard, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> image = clipboard.readImage()\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(image)\n<span class=\"hljs-built_in\">console</span>.log(appIcon)\n</code></pre>\n<h2 id=\"支持的格式\"><a href=\"#支持的格式\">支持的格式</a></h2>\n<p>当前只支持 <code>PNG</code> 和 <code>JPEG</code> 格式， 推荐使用 <code>PNG</code> ，因为这种格式支持透明和无损压缩</p>\n<p>在 Windows 平台下, 你同样可以从文件路径中加载<code>ICO</code> 格式的 icons 对象。 为了达到最佳观看效果，推荐至少包含以下大小的图片尺寸：</p>\n<ul>\n<li>小图标<ul>\n<li>16x16 (100% DPI scale)</li>\n<li>20x20 (125% DPI scale)</li>\n<li>24x24 (150% DPI scale)</li>\n<li>32x32 (200% DPI scale)</li>\n</ul></li>\n<li>大图标<ul>\n<li>32x32 (100% DPI scale)</li>\n<li>40x40 (125% DPI scale)</li>\n<li>48x48 (150% DPI scale)</li>\n<li>64x64 (200% DPI scale)</li>\n<li>256x256</li>\n</ul></li>\n</ul>\n<p>在<a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dn742485(v=vs.85).aspx\">这篇文章</a>中查看 <em>尺寸说明</em> 的章节</p>\n<h2 id=\"高分辨率\"><a href=\"#高分辨率\">高分辨率</a></h2>\n<p>在具有高 DPI 支持的平台 (如 Apple 视网膜显示器) 上, 可以在图像的基本文件名之后追加 <code>@ 2x</code> 以将其标记为高分辨率图像。</p>\n<p>比如， 如果 <code>icon.png</code> 是一个普通的标准分辨率的图片，而 <code>icon@2x.png</code> 将被视为具有两倍DPI密度的高分辨率图像</p>\n<p>如果您想同时支持不同的DPI密度显示，您可以将不同大小的图像放置在同一文件夹中，并使用文件名而不需要DPI 后缀。 例如：</p>\n<pre><code class=\"hljs language-plaintext\">images/\n├── icon.png\n├── icon@2x.png\n└── icon@3x.png\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-built_in\">console</span>.log(appIcon)\n</code></pre>\n<p>还支持以下DPI的后缀：</p>\n<ul>\n<li><code>@1x</code></li>\n<li><code>@1.25x</code></li>\n<li><code>@1.33x</code></li>\n<li><code>@1.4x</code></li>\n<li><code>@1.5x</code></li>\n<li><code>@1.8x</code></li>\n<li><code>@2x</code></li>\n<li><code>@2.5x</code></li>\n<li><code>@3x</code></li>\n<li><code>@4x</code></li>\n<li><code>@5x</code></li>\n</ul>\n<h2 id=\"模板图片\"><a href=\"#模板图片\">模板图片</a></h2>\n<p>模板图像由黑色和透明通道组成。 模板图片不是单独使用的, 它通常与其他内容混合以创建期望的最终效果</p>\n<p>最常见的情况是使用模板图像作为菜单栏图标，因此它可以适应浅色和深色菜单栏。</p>\n<p><strong> 注意: </strong>仅在 macOS 上支持Template image。</p>\n<p>要将图像标记为模板图像，其文件名应以 <code>Template</code> 一词结尾。 例如：</p>\n<ul>\n<li><code>xxxTemplate.png</code></li>\n<li><code>xxxTemplate@2x.png</code></li>\n</ul>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>nativeImage</code> 模块具有以下方法, 它们都返回 <code>nativeImage</code> 类的实例:</p>\n<h3 id=\"nativeimagecreateempty\"><a href=\"#nativeimagecreateempty\"><code>nativeImage.createEmpty()</code></a></h3>\n<p>返回 <code>NativeImage</code></p>\n<p>创建一个空的 <code>NativeImage</code> 实例。</p>\n<h3 id=\"nativeimagecreatethumbnailfrompathpath-maxsize-macos-windows\"><a href=\"#nativeimagecreatethumbnailfrompathpath-maxsize-macos-windows\"><code>nativeImage.createThumbnailFromPath(path, maxSize)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>path</code> String - 打算用来构建缩略图的文件路径</li>\n<li><code>maxSize</code> <a href=\"/docs/api/structures/size\">Size</a> - 返回缩略图的最大宽度和高度(正数)。 在 Windows 平台下将忽略 <code>maxSize.height</code> 并根据 <code>maxSize.width</code> 缩放高度</li>\n</ul>\n<p>返回 <code>Promise&#x3C;NativeImage></code> - 文件的缩略图预览图像，包含类型是 <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<h3 id=\"nativeimagecreatefrompathpath\"><a href=\"#nativeimagecreatefrompathpath\"><code>nativeImage.createFromPath(path)</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>返回 <code>NativeImage</code></p>\n<p>从位于 <code>path</code> 的文件创建新的 <code>NativeImage</code> 实例。 如果 <code>path</code> 不存在，，无法读取或不是有效图像，方法将返回空图像, 。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> nativeImage = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).nativeImage\n\n<span class=\"hljs-keyword\">const</span> image = nativeImage.createFromPath(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-built_in\">console</span>.log(image)\n</code></pre>\n<h3 id=\"nativeimagecreatefrombitmapbuffer-options\"><a href=\"#nativeimagecreatefrombitmapbuffer-options\"><code>nativeImage.createFromBitmap(buffer, options)</code></a></h3>\n<ul>\n<li><code>buffer</code> <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a></li>\n<li><code>选项</code> 对象<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>scaleFactor</code> Double (可选) - 默认1.0</li>\n</ul></li>\n</ul>\n<p>返回 <code>NativeImage</code></p>\n<p>从 <code>buffer</code> 中创建一个新的 <code>NativeImage</code> 实例，其中包含由 <code>toBitmap()</code>返回的原始位图 像素数据。 具体格式取决于平台。</p>\n<h3 id=\"nativeimagecreatefrombufferbuffer-options\"><a href=\"#nativeimagecreatefrombufferbuffer-options\"><code>nativeImage.createFromBuffer(buffer[, options])</code></a></h3>\n<ul>\n<li><code>buffer</code> <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a></li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>width</code> Integer (可选) - 位图缓冲器所必需</li>\n<li><code>height</code> Integer (可选) - 位图缓冲器所必需</li>\n<li><code>scaleFactor</code> Double (可选) - 默认1.0</li>\n</ul></li>\n</ul>\n<p>返回 <code>NativeImage</code></p>\n<p>从 <code>buffer </code> 创建新的 <code>NativeImage</code> 实例。 尝试先解码为 PNG 或 JPEG</p>\n<h3 id=\"nativeimagecreatefromdataurldataurl\"><a href=\"#nativeimagecreatefromdataurldataurl\"><code>nativeImage.createFromDataURL(dataURL)</code></a></h3>\n<ul>\n<li><code>dataURL</code> String</li>\n</ul>\n<p>返回 <code>NativeImage</code></p>\n<p>从 <code>dataURL</code> 创建新的 <code>NativeImage</code> 实例。</p>\n<h3 id=\"nativeimagecreatefromnamedimageimagename-hslshift-macos\"><a href=\"#nativeimagecreatefromnamedimageimagename-hslshift-macos\"><code>nativeImage.createFromNamedImage(imageName[, hslShift])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>imageName</code> String</li>\n<li><code>hslShift</code> Number<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a></li>\n</ul>\n<p>返回 <code>NativeImage</code></p>\n<p>从映射到给定图像名称的 NSImage 创建一个 <code>NativeImage</code> 实例。 可用值列表详见 <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/system-icons/\"><code>System Icons</code></a></p>\n<p>使用以下规则将<code>hslShift</code>应用于图像:</p>\n<ul>\n<li><code>hsl_shift[0]</code> (色调): 图像的绝对色调值，0 和1 映射到 0和360，在色环上 (红色)。</li>\n<li><code>hsl_shift[1]</code> (饱和度): 图像的饱和度调值， 以下关键值： 0 = 删除所有颜色。 0.5 = 保持不变。 1 = 图像完全饱和</li>\n<li><code>hsl_shift[2]</code> (亮度): 图像的亮度调值, 可以为下列值: 0 = 移除所有亮度 (所有像素点设置为黑色). 0.5 = 保持不变。 1 = 全亮 (所有像素点设置为白色)。</li>\n</ul>\n<p>这意味着 <code>[-1, 0, 1]</code> 将使图像完全变白，<code>[-1, 1, 0]</code>将使图像完全变黑.</p>\n<p>在某些情况下， <code>NSImageName</code> 与其字符串表示并不匹配：其中一个例子是 <code>NSFolderImageName</code>，它的字符串表示实际上将是 <code>NSFolder</code>。 因此，您需要在传递图像之前确定正确的字符串表示方式。 可以像下面这样做：</p>\n<p><code>echo -e '#import &#x3C;Cocoa/Cocoa.h>\\nint main() { NSLog(@\"%@\", SYSTEM_IMAGE_NAME); }' | clang -otest -x objective-c -framework Cocoa - &#x26;&#x26; ./test</code></p>\n<p>其中 <code>SYSTEM_IMAGE_NAME</code> 应替换为 <a href=\"https://developer.apple.com/documentation/appkit/nsimagename?language=objc\">this list</a>里面的值</p>\n<h2 id=\"类-nativeimage\"><a href=\"#类-nativeimage\">类: NativeImage</a></h2>\n<blockquote>\n<p>本机图像，如托盘、dock栏和应用图标。</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<p>以下方法可用于 <code>NativeImage</code> 类的实例:</p>\n<h4 id=\"imagetopngoptions\"><a href=\"#imagetopngoptions\"><code>image.toPNG([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (可选)<ul>\n<li><code>scaleFactor</code> Double (可选) - 默认1.0</li>\n</ul></li>\n</ul>\n<p>返回 <code>Buffer</code>-一个包含图像 <code>PNG</code> 编码数据的 <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\"> Buffer </a>。</p>\n<h4 id=\"imagetojpegquality\"><a href=\"#imagetojpegquality\"><code>image.toJPEG(quality)</code></a></h4>\n<ul>\n<li><code>quality</code> Integer - 在 0 - 100 之间</li>\n</ul>\n<p>返回 <code>Buffer</code>-一个包含图像 <code>JPEG</code> 编码数据的 <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\"> Buffer </a>。</p>\n<h4 id=\"imagetobitmapoptions\"><a href=\"#imagetobitmapoptions\"><code>image.toBitmap([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (可选)<ul>\n<li><code>scaleFactor</code> Double (可选) - 默认1.0</li>\n</ul></li>\n</ul>\n<p>返回 <code>Buffer</code>-一个包含图像的原始位图像素数据副本的 <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\"> Buffer </a>。</p>\n<h4 id=\"imagetodataurloptions\"><a href=\"#imagetodataurloptions\"><code>image.toDataURL([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (可选)<ul>\n<li><code>scaleFactor</code> Double (可选) - 默认1.0</li>\n</ul></li>\n</ul>\n<p>返回 <code>String</code>-图像的数据 URL。</p>\n<h4 id=\"imagegetbitmapoptions\"><a href=\"#imagegetbitmapoptions\"><code>image.getBitmap([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (可选)<ul>\n<li><code>scaleFactor</code> Double (可选) - 默认1.0</li>\n</ul></li>\n</ul>\n<p>返回 <code>Buffer</code>-一个包含图像原始位图像素数据的 <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\"> Buffer </a>。</p>\n<p><code>getBitmap()</code> 和 <code>toBitmap() 的不同之处在于，&#x3C;code>getBitmap()</code> 不会拷贝位图数据，所以你必须在返回 Buffer 后立刻使用它，否则数据可能会被更改或销毁</p>\n<h4 id=\"imagegetnativehandle-macos\"><a href=\"#imagegetnativehandle-macos\"><code>image.getNativeHandle()</code> <em>macOS</em></a></h4>\n<p>返回 <code>Buffer</code>-一个 <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\"> Buffer </a>, 它将 C 指针存储在图像的基础本机句柄上。 在 macOS 上, 将返回指向 <code>NSImage</code> 实例的指针。</p>\n<p>请注意, 返回的指针是指向基础本机映像而不是副本的弱指针, 因此 <em> 必须 </em> 确保关联的 <code>nativeImage</code> 实例保留在周围。</p>\n<h4 id=\"imageisempty\"><a href=\"#imageisempty\"><code>image.isEmpty()</code></a></h4>\n<p>返回 <code>Boolean</code>-图像是否为空。</p>\n<h4 id=\"imagegetsizescalefactor\"><a href=\"#imagegetsizescalefactor\"><code>image.getSize([scaleFactor])</code></a></h4>\n<ul>\n<li><code>scaleFactor</code> Double (可选) - 默认1.0</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/size\"><code>Size</code></a>.</p>\n<p>如果传递了 <code>scaleFactor</code> ，将返回与图像表示最接近的传递值对应的大小。</p>\n<h4 id=\"imagesettemplateimageoption\"><a href=\"#imagesettemplateimageoption\"><code>image.setTemplateImage(option)</code></a></h4>\n<ul>\n<li><code>option</code> Boolean</li>\n</ul>\n<p>将图像标记为模板图像。</p>\n<h4 id=\"imageistemplateimage\"><a href=\"#imageistemplateimage\"><code>image.isTemplateImage()</code></a></h4>\n<p>返回 <code>Boolean</code>-图像是否为模板图像。</p>\n<h4 id=\"imagecroprect\"><a href=\"#imagecroprect\"><code>image.crop(rect)</code></a></h4>\n<ul>\n<li><code>rect</code><a href=\"/docs/api/structures/rectangle\"> Rectangle </a>-要裁剪的图像区域.</li>\n</ul>\n<p>返回 <code>NativeImage</code>-裁剪的图像。</p>\n<h4 id=\"imageresizeoptions\"><a href=\"#imageresizeoptions\"><code>image.resize(options)</code></a></h4>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>width</code> Integer (可选) - 默认值为图片宽度</li>\n<li><code>height</code> Integer (可选) - 默认值为图片高度.</li>\n<li><code>quality</code> String (optional) 所要设置的图片质量。 可能的值为 <code>good</code>、<code>better</code> 或 <code>best</code>。 默认值为<code>best</code>. 这些值表示期望的 质量/速度 的权衡。 他们被转换为某个特定算法, 取决于基础平台的能力 (CPU, GPU)。 这三种方法都可以在指定的平台上映射到相同的算法。</li>\n</ul></li>\n</ul>\n<p>返回 <code>NativeImage</code>-裁剪的图像。</p>\n<p>如果只指定<code>height</code>或<code>width</code>，那么当前的长宽比将保留在缩放图像中。</p>\n<h4 id=\"imagegetaspectratioscalefactor\"><a href=\"#imagegetaspectratioscalefactor\"><code>image.getAspectRatio([scaleFactor])</code></a></h4>\n<ul>\n<li><code>scaleFactor</code> Double (可选) - 默认1.0</li>\n</ul>\n<p>返回 <code>Float</code> - 图像的长宽比.</p>\n<p>如果传递了 <code>scaleFactor</code> ，将返回与图像表示最接近的传递值对应的大小。</p>\n<h4 id=\"imagegetscalefactors\"><a href=\"#imagegetscalefactors\"><code>image.getScaleFactors()</code></a></h4>\n<p>Returns <code>Float[]</code> - 给定 nativeImage 的表示相对应的所有比例因子的数组</p>\n<h4 id=\"imageaddrepresentationoptions\"><a href=\"#imageaddrepresentationoptions\"><code>image.addRepresentation(options)</code></a></h4>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>scaleFactor</code> Double - 要添加图像的缩放系数</li>\n<li><code>width</code> Integer (可选) - 默认值为 0. 如果将位图缓冲区指定为<code>buffer</code>, 则为必填项</li>\n<li><code>height</code> Integer (可选) - 默认值为 0. 如果将位图缓冲区指定为<code>buffer</code>, 则为必填项</li>\n<li><code>buffer</code> Buffer (可选) - 包含原始图像数据的缓冲区.</li>\n<li><code>dataURL</code> String (可选) - data URL 可以为 base 64 编码的 PNG 或 JPEG 图像.</li>\n</ul></li>\n</ul>\n<p>为特定比例因子添加图像表示。 这可以用于在图像中明确添加不同的比例因子表示。 这种可以调用在空图像上。</p>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<h4 id=\"nativeimageismactemplateimage-macos\"><a href=\"#nativeimageismactemplateimage-macos\"><code>nativeImage.isMacTemplateImage</code> <em>macOS</em></a></h4>\n<p><code>Boolean</code> 属性，用于决定图像是否被认为是一个 <a href=\"https://developer.apple.com/documentation/appkit/nsimage/1520017-template\">template image</a>.</p>\n<p>请注意，此属性仅对 macOS 有影响。</p>",
      "title": "nativeImage",
      "description": "使用 PNG 或 JPG 文件创建托盘、dock和应用程序图标。"
    },
    "/docs/api/native-theme": {
      "locale": "zh-CN",
      "slug": "native-theme",
      "href": "/docs/api/native-theme",
      "crowdinFileId": "256343",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/native-theme.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nativetheme\"><a href=\"#nativetheme\">nativeTheme</a></h1>\n<blockquote>\n<p>读取并响应Chromium本地色彩主题中的变化。</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<h2 id=\"事件\"><a href=\"#事件\">事件</a></h2>\n<p><code>nativeTheme</code>模块包括以下事件：</p>\n<h3 id=\"事件名-updated\"><a href=\"#事件名-updated\">事件名: 'updated'</a></h3>\n<p>当以下NativeTheme属性发生变化时会触发此事件： <code>shouldUseDarkColors</code>, <code>shouldUseHighContrastColors</code>或<code>shouldUseInvertedColorScheme</code> 。 你需要自己检查到底是哪个属性发生了变化。</p>\n<h2 id=\"属性\"><a href=\"#属性\">属性</a></h2>\n<p><code>nativeTheme</code> 模块具备以下属性：</p>\n<h3 id=\"nativethemeshouldusedarkcolors-只读\"><a href=\"#nativethemeshouldusedarkcolors-只读\"><code>nativeTheme.shouldUseDarkColors</code> <em>只读</em></a></h3>\n<p>此属性的值为一个 <code>Boolean</code> 类型的值，代表着当前OS / Chromium是否正处于dark模式。或者应用程序是否正被建议使用dark模式的皮肤  如果你希望修改此属性的值，你应该使用下面的 <code>themeSource</code>属性</p>\n<h3 id=\"nativethemethemesource\"><a href=\"#nativethemethemesource\"><code>nativeTheme.themeSource</code></a></h3>\n<p>一个类型为<code>String</code>的属性，此属性可能的值为：<code>system</code>, <code>light</code> or <code>dark</code>.  It is used to override and supersede the value that Chromium has chosen to use internally.</p>\n<p>Setting this property to <code>system</code> will remove the override and everything will be reset to the OS default.  By default <code>themeSource</code> is <code>system</code>.</p>\n<p>Settings this property to <code>dark</code> will have the following effects:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code> will be <code>true</code> when accessed</li>\n<li>Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the dark UI.</li>\n<li>Any UI the OS renders on macOS including menus, window frames, etc. will use the dark UI.</li>\n<li>The <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> CSS query will match <code>dark</code> mode.</li>\n<li>The <code>updated</code> event will be emitted</li>\n</ul>\n<p>Settings this property to <code>light</code> will have the following effects:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code> will be <code>false</code> when accessed</li>\n<li>Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the light UI.</li>\n<li>Any UI the OS renders on macOS including menus, window frames, etc. will use the light UI.</li>\n<li>The <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> CSS query will match <code>light</code> mode.</li>\n<li>The <code>updated</code> event will be emitted</li>\n</ul>\n<p>The usage of this property should align with a classic \"dark mode\" state machine in your application where the user has three options.</p>\n<ul>\n<li><code>Follow OS</code> --> <code>themeSource = 'system'</code></li>\n<li><code>Dark Mode</code> --> <code>themeSource = 'dark'</code></li>\n<li><code>Light Mode</code> --> <code>themeSource = 'light'</code></li>\n</ul>\n<p>Your application should then always use <code>shouldUseDarkColors</code> to determine what CSS to apply.</p>\n<h3 id=\"nativethemeshouldusehighcontrastcolors-macos-windows-readonly\"><a href=\"#nativethemeshouldusehighcontrastcolors-macos-windows-readonly\"><code>nativeTheme.shouldUseHighContrastColors</code> <em>macOS</em> <em>Windows</em> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> for if the OS / Chromium currently has high-contrast mode enabled or is being instructed to show a high-contrast UI.</p>\n<h3 id=\"nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly\"><a href=\"#nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly\"><code>nativeTheme.shouldUseInvertedColorScheme</code> <em>macOS</em> <em>Windows</em> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> for if the OS / Chromium currently has an inverted color scheme or is being instructed to use an inverted color scheme.</p>",
      "title": "nativeTheme",
      "description": "读取并响应Chromium本地色彩主题中的变化。"
    },
    "/docs/api/net": {
      "locale": "zh-CN",
      "slug": "net",
      "href": "/docs/api/net",
      "crowdinFileId": "256347",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/net.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"net\"><a href=\"#net\">net</a></h1>\n<blockquote>\n<p>使用Chromium的原生网络库发出HTTP / HTTPS请求</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p><code>net</code> 模块是一个发送 HTTP(S) 请求的客户端API。 它类似于Node.js的<a href=\"https://nodejs.org/api/http.html\">HTTP</a> 和 <a href=\"https://nodejs.org/api/https.html\">HTTPS</a> 模块 ，但它使用的是Chromium原生网络库来替代Node.js的实现，提供更好的网络代理支持。 它还支持检查网络状态。</p>\n<p>下面是一个非详尽的列表, 用于说明为什么使用 <code>net</code> 模块而不是原生Node. js 模块:</p>\n<ul>\n<li>系统代理配置的自动管理, 支持 wpad 协议和代理 pac 配置文件。</li>\n<li>HTTPS 请求的自动隧道。</li>\n<li>支持使用basic、digest、NTLM、Kerberos 或协商身份验证方案对代理进行身份验证。</li>\n<li>支持传输监控代理: 类似于Fiddler代理，用于访问控制和监视。</li>\n</ul>\n<p>The API components (including classes, methods, properties and event names) are similar to those used in Node.js.</p>\n<p>Example usage:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> { net } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n  <span class=\"hljs-keyword\">const</span> request = net.request(<span class=\"hljs-string\">'https://github.com'</span>)\n  request.on(<span class=\"hljs-string\">'response'</span>, (response) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`STATUS: <span class=\"hljs-subst\">${response.statusCode}</span>`</span>)\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`HEADERS: <span class=\"hljs-subst\">${<span class=\"hljs-built_in\">JSON</span>.stringify(response.headers)}</span>`</span>)\n    response.on(<span class=\"hljs-string\">'data'</span>, (chunk) => {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`BODY: <span class=\"hljs-subst\">${chunk}</span>`</span>)\n    })\n    response.on(<span class=\"hljs-string\">'end'</span>, () => {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'No more data in response.'</span>)\n    })\n  })\n  request.end()\n})\n</code></pre>\n<p>The <code>net</code> API can be used only after the application emits the <code>ready</code> event. Trying to use the module before the <code>ready</code> event will throw an error.</p>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>net</code> 模块具有以下方法:</p>\n<h3 id=\"netrequestoptions\"><a href=\"#netrequestoptions\"><code>net.request(options)</code></a></h3>\n<ul>\n<li><code>options</code> (ClientRequestConstructorOptions | String) - The <code>ClientRequest</code> constructor options.</li>\n</ul>\n<p>返回 <a href=\"/docs/api/client-request\"><code>ClientRequest</code></a></p>\n<p>使用 <code>options</code> 创建 <a href=\"/docs/api/client-request\"><code>ClientRequest</code></a> 实例, 这些选项直接转发到 <code>ClientRequest</code> 的构造函数。 <code>net.request</code> 方法将根据 <code>options</code> 对象中的指定协议方案, 去发送安全和不安全的 HTTP 请求（ both secure and insecure HTTP requests）。</p>\n<h3 id=\"netisonline\"><a href=\"#netisonline\"><code>net.isOnline()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether there is currently internet connection.</p>\n<p>A return value of <code>false</code> is a pretty strong indicator that the user won't be able to connect to remote sites. However, a return value of <code>true</code> is inconclusive; even if some link is up, it is uncertain whether a particular connection attempt to a particular remote site will be successful.</p>\n<h2 id=\"属性\"><a href=\"#属性\">属性</a></h2>\n<h3 id=\"netonline-只读\"><a href=\"#netonline-只读\"><code>net.online</code> <em>只读</em></a></h3>\n<p>A <code>Boolean</code> property. Whether there is currently internet connection.</p>\n<p>A return value of <code>false</code> is a pretty strong indicator that the user won't be able to connect to remote sites. However, a return value of <code>true</code> is inconclusive; even if some link is up, it is uncertain whether a particular connection attempt to a particular remote site will be successful.</p>",
      "title": "net",
      "description": "使用Chromium的原生网络库发出HTTP / HTTPS请求"
    },
    "/docs/api/net-log": {
      "locale": "zh-CN",
      "slug": "net-log",
      "href": "/docs/api/net-log",
      "crowdinFileId": "256345",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/net-log.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"netlog\"><a href=\"#netlog\">netLog</a></h1>\n<blockquote>\n<p>Logging network events for a session.</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { netLog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> netLog.startLogging(<span class=\"hljs-string\">'/path/to/net-log'</span>)\n  <span class=\"hljs-comment\">// After some network events</span>\n  <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> netLog.stopLogging()\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Net-logs written to'</span>, path)\n})\n</code></pre>\n<p>查看 <a href=\"/docs/api/command-line-switches#--log-net-logpath\"><code>--log-net-log</code></a> 记录应用生命周期的网络事件。</p>\n<p><strong> 注意: </strong>除了指定的方法, 其他方法只能在 <code>app</code> 模块的 <code>ready</code> 事件被触发后使用。</p>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<h3 id=\"netlogstartloggingpath-options\"><a href=\"#netlogstartloggingpath-options\"><code>netLog.startLogging(path[, options])</code></a></h3>\n<ul>\n<li><code>path</code> String - 记录网络日志的文件路径。</li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>captureMode</code> String (optional) - What kinds of data should be captured. By default, only metadata about requests will be captured. Setting this to <code>includeSensitive</code> will include cookies and authentication data. Setting it to <code>everything</code> will include all bytes transferred on sockets. Can be <code>default</code>, <code>includeSensitive</code> or <code>everything</code>.</li>\n<li><code>maxFileSize</code> Number (optional) - When the log grows beyond this size, logging will automatically stop. Defaults to unlimited.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the net log has begun recording.</p>\n<p>开始记录网络事件日志到 <code>path</code>。</p>\n<h3 id=\"netlogstoplogging\"><a href=\"#netlogstoplogging\"><code>netLog.stopLogging()</code></a></h3>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the net log has been flushed to disk.</p>\n<p>停止网络事件日志的记录。 如果未被调用，net 记录将自动结束当 app 退出的时候。</p>\n<h2 id=\"属性\"><a href=\"#属性\">属性</a></h2>\n<h3 id=\"netlogcurrentlylogging-只读\"><a href=\"#netlogcurrentlylogging-只读\"><code>netLog.currentlyLogging</code> <em>只读</em></a></h3>\n<p>A <code>Boolean</code> property that indicates whether network logs are currently being recorded.</p>",
      "title": "netLog",
      "description": "Logging network events for a session."
    },
    "/docs/api/structures/new-window-web-contents-event": {
      "locale": "zh-CN",
      "slug": "new-window-web-contents-event",
      "href": "/docs/api/structures/new-window-web-contents-event",
      "crowdinFileId": "256469",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/new-window-web-contents-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"newwindowwebcontentsevent-object-extends-event\"><a href=\"#newwindowwebcontentsevent-object-extends-event\">NewWindowWebContentsEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>newGuest</code> BrowserWindow (optional)</li>\n</ul>",
      "title": "NewWindowWebContentsEvent Object extends Event",
      "description": ""
    },
    "/docs/api/notification": {
      "locale": "zh-CN",
      "slug": "notification",
      "href": "/docs/api/notification",
      "crowdinFileId": "256349",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/notification.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"通知\"><a href=\"#通知\">通知</a></h1>\n<blockquote>\n<p>创建OS(操作系统)桌面通知</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<h2 id=\"在渲染进程中使用\"><a href=\"#在渲染进程中使用\">在渲染进程中使用</a></h2>\n<p>如果要显示来自渲染进程的通知, 你应该使用 <a href=\"/docs/tutorial/notifications\"> HTML5 Notification API </a></p>\n<h2 id=\"类-notification\"><a href=\"#类-notification\">类: Notification</a></h2>\n<blockquote>\n<p>创建OS(操作系统)桌面通知</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p><code>Notification</code>是一个<a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p>通过 <code>options</code> 来设置的一个新的原生 <code>Notification</code>。</p>\n<h3 id=\"静态方法\"><a href=\"#静态方法\">静态方法</a></h3>\n<p><code>Notification</code> 类有以下静态方法：</p>\n<h4 id=\"notificationissupported\"><a href=\"#notificationissupported\"><code>Notification.isSupported()</code></a></h4>\n<p>Returns <code>Boolean</code>-当前系统是否支持桌面通知</p>\n<h3 id=\"new-notificationoptions\"><a href=\"#new-notificationoptions\"><code>new Notification([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (可选)<ul>\n<li><code>title</code> String (optional) - A title for the notification, which will be shown at the top of the notification window when it is shown.</li>\n<li><code>subtitle</code>String (可选) 通知的副标题, 显示在标题下面。<em> macOS </em></li>\n<li><code>body</code> String (optional) - The body text of the notification, which will be displayed below the title or subtitle.</li>\n<li><code>silent</code>Boolean (可选) 在显示通知时是否发出系统提示音。</li>\n<li><code> icon</code>(String | <a href=\"/docs/api/native-image\"> NativeImage </a>) (可选) 用于在该通知上显示的图标。</li>\n<li><code>hasReply</code>Boolean (可选) 是否在通知中添加一个答复选项。 <em> macOS </em></li>\n<li><code>timeoutType</code> String (optional) <em>Linux</em> <em>Windows</em> - The timeout duration of the notification. Can be 'default' or 'never'.</li>\n<li><code>replyPlaceholder</code>String (可选) 答复输入框中的占位符。<em> macOS </em></li>\n<li><code>sound </code>String (可选) 显示通知时播放的声音文件的名称。<em> macOS </em></li>\n<li><code>urgency</code> String (optional) <em>Linux</em> - The urgency level of the notification. Can be 'normal', 'critical', or 'low'.</li>\n<li><code>actions</code> <a href=\"/docs/api/structures/notification-action\">NotificationAction[]</a> (可选) <em>macOS</em> - 要添加到通知中的操作 请阅读 <code>NotificationAction</code>文档来了解可用的操作和限制。</li>\n<li><code>closeButtonText</code> String (optional) <em>macOS</em> - A custom title for the close button of an alert. An empty string will cause the default localized text to be used.</li>\n<li><code>toastXml</code> String (optional) <em>Windows</em> - A custom description of the Notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification.</li>\n</ul></li>\n</ul>\n<h3 id=\"实例事件\"><a href=\"#实例事件\">实例事件</a></h3>\n<p>用 <code>new Notification</code> 创建的对象触发以下事件：</p>\n<p><strong> 注意: </strong>某些事件仅在特定的操作系统上可用, 这些方法会被标记出来。</p>\n<h4 id=\"事件-show\"><a href=\"#事件-show\">事件: 'show'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>当通知向用户显示时触发, 请注意, 这可能会多次触发, 因为「通知」可以通过 <code>show()</code> 方法多次显示。</p>\n<h4 id=\"事件-click\"><a href=\"#事件-click\">事件: 'click'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>在用户单击通知时触发。</p>\n<h4 id=\"事件：-close\"><a href=\"#事件：-close\">事件： 'close'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>当用户手动关闭通知时触发</p>\n<p>当通知关闭后，这个事件不能保证在所有情况下都会触发。</p>\n<h4 id=\"事件-reply-macos\"><a href=\"#事件-reply-macos\">事件: 'reply' <em>macOS</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>reply</code>String-用户在内联答复字段中输入的字符串.</li>\n</ul>\n<p>当用户单击 <code>hasReply: true</code> 的通知上的 \"Reply\" 按钮时触发。</p>\n<h4 id=\"事件-action-macos\"><a href=\"#事件-action-macos\">事件: 'action' <em>macOS</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>index</code> Number - 已激活的操作的索引.</li>\n</ul>\n<h4 id=\"event-failed-windows\"><a href=\"#event-failed-windows\">Event: 'failed' <em>Windows</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>error</code> String - The error encountered during execution of the <code>show()</code> method.</li>\n</ul>\n<p>Emitted when an error is encountered while creating and showing the native notification.</p>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<p>用<code>new Notification</code> 创建的对象有以下实例方法：</p>\n<h4 id=\"notificationshow\"><a href=\"#notificationshow\"><code>notification.show()</code></a></h4>\n<p>即时向用户展示 notification ，请注意这意味着与HTML5的 Notification 的实现不同，实例化一个<code>new Notification</code> 不会立刻向用户展示， 你需要在系统将要显示它之前调用这个方法</p>\n<p>如果以前已显示通知, 则此方法将忽略以前显示的通知，并创建具有相同属性的新通知</p>\n<h4 id=\"notificationclose\"><a href=\"#notificationclose\"><code>notification.close()</code></a></h4>\n<p>忽略这条通知</p>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<h4 id=\"notificationtitle\"><a href=\"#notificationtitle\"><code>notification.title</code></a></h4>\n<p>A <code>String</code> property representing the title of the notification.</p>\n<h4 id=\"notificationsubtitle\"><a href=\"#notificationsubtitle\"><code>notification.subtitle</code></a></h4>\n<p>A <code>String</code> property representing the subtitle of the notification.</p>\n<h4 id=\"notificationbody\"><a href=\"#notificationbody\"><code>notification.body</code></a></h4>\n<p>A <code>String</code> property representing the body of the notification.</p>\n<h4 id=\"notificationreplyplaceholder\"><a href=\"#notificationreplyplaceholder\"><code>notification.replyPlaceholder</code></a></h4>\n<p>A <code>String</code> property representing the reply placeholder of the notification.</p>\n<h4 id=\"notificationsound\"><a href=\"#notificationsound\"><code>notification.sound</code></a></h4>\n<p>A <code>String</code> property representing the sound of the notification.</p>\n<h4 id=\"notificationclosebuttontext\"><a href=\"#notificationclosebuttontext\"><code>notification.closeButtonText</code></a></h4>\n<p>A <code>String</code> property representing the close button text of the notification.</p>\n<h4 id=\"notificationsilent\"><a href=\"#notificationsilent\"><code>notification.silent</code></a></h4>\n<p>A <code>Boolean</code> property representing whether the notification is silent.</p>\n<h4 id=\"notificationhasreply\"><a href=\"#notificationhasreply\"><code>notification.hasReply</code></a></h4>\n<p>A <code>Boolean</code> property representing whether the notification has a reply action.</p>\n<h4 id=\"notificationurgency-linux\"><a href=\"#notificationurgency-linux\"><code>notification.urgency</code> <em>Linux</em></a></h4>\n<p>A <code>String</code> property representing the urgency level of the notification. Can be 'normal', 'critical', or 'low'.</p>\n<p>Default is 'low' - see <a href=\"https://developer.gnome.org/notification-spec/#urgency-levels\">NotifyUrgency</a> for more information.</p>\n<h4 id=\"notificationtimeouttype-linux-windows\"><a href=\"#notificationtimeouttype-linux-windows\"><code>notification.timeoutType</code> <em>Linux</em> <em>Windows</em></a></h4>\n<p>A <code>String</code> property representing the type of timeout duration for the notification. Can be 'default' or 'never'.</p>\n<p>If <code>timeoutType</code> is set to 'never', the notification never expires. It stays open until closed by the calling API or the user.</p>\n<h4 id=\"notificationactions\"><a href=\"#notificationactions\"><code>notification.actions</code></a></h4>\n<p>A <a href=\"/docs/api/structures/notification-action\"><code>NotificationAction[]</code></a> property representing the actions of the notification.</p>\n<h4 id=\"notificationtoastxml-windows\"><a href=\"#notificationtoastxml-windows\"><code>notification.toastXml</code> <em>Windows</em></a></h4>\n<p>A <code>String</code> property representing the custom Toast XML of the notification.</p>\n<h3 id=\"播放声音\"><a href=\"#播放声音\">播放声音</a></h3>\n<p>在 macOS 上, 您可以指定在显示通知时要播放的声音的名称。 Any of the default sounds (under System Preferences > Sound) can be used, in addition to custom sound files. 请确保声音文件是在应用程序包(例如, <code> YourApp.app/Contents/Resources</code>) 内存在副本, 或者是下列位置之一:</p>\n<ul>\n<li><code>~/Library/Sounds</code></li>\n<li><code>/Library/Sounds</code></li>\n<li><code>/Network/Library/Sounds</code></li>\n<li><code>/System/Library/Sounds</code></li>\n</ul>\n<p>有关详细信息, 请参见 <a href=\"https://developer.apple.com/documentation/appkit/nssound\"><code>NSSound</code></a> 文档。</p>",
      "title": "通知",
      "description": "创建OS(操作系统)桌面通知"
    },
    "/docs/api/structures/notification-action": {
      "locale": "zh-CN",
      "slug": "notification-action",
      "href": "/docs/api/structures/notification-action",
      "crowdinFileId": "256471",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/notification-action.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificationaction-object\"><a href=\"#notificationaction-object\">NotificationAction Object</a></h1>\n<ul>\n<li><code>type</code> String - The type of action, can be <code>button</code>.</li>\n<li><code>text</code> String (optional) - The label for the given action.</li>\n</ul>\n<h2 id=\"platform--action-support\"><a href=\"#platform--action-support\">Platform / Action Support</a></h2>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Action Type</th><th>Platform Support</th><th>Usage of <code>text</code></th><th>Default <code>text</code></th><th>Limitations</th></tr></thead><tbody><tr><td><code>button</code></td><td>macOS</td><td>Used as the label for the button</td><td>\"Show\" (or a localized string by system default if first of such <code>button</code>, otherwise empty)</td><td>Only the first one is used. If multiple are provided, those beyond the first will be listed as additional actions (displayed when mouse active over the action button). Any such action also is incompatible with <code>hasReply</code> and will be ignored if <code>hasReply</code> is <code>true</code>.</td></tr></tbody></table>\n<h3 id=\"button-support-on-macos\"><a href=\"#button-support-on-macos\">Button support on macOS</a></h3>\n<p>In order for extra notification buttons to work on macOS your app must meet the following criteria.</p>\n<ul>\n<li>App is signed</li>\n<li>App has it's <code>NSUserNotificationAlertStyle</code> set to <code>alert</code> in the <code>Info.plist</code>.</li>\n</ul>\n<p>If either of these requirements are not met the button won't appear.</p>",
      "title": "NotificationAction Object",
      "description": ""
    },
    "/docs/api/structures/notification-response": {
      "locale": "zh-CN",
      "slug": "notification-response",
      "href": "/docs/api/structures/notification-response",
      "crowdinFileId": "256473",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/notification-response.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificationresponse-object\"><a href=\"#notificationresponse-object\">NotificationResponse Object</a></h1>\n<ul>\n<li><code>actionIdentifier</code> String - The identifier string of the action that the user selected.</li>\n<li><code>date</code> Number - The delivery date of the notification.</li>\n<li><code>identifier</code> String - The unique identifier for this notification request.</li>\n<li><code>userInfo</code> Record&#x3C;String, any> - A dictionary of custom information associated with the notification.</li>\n<li><code>userText</code> String (optional) - The text entered or chosen by the user.</li>\n</ul>",
      "title": "NotificationResponse Object",
      "description": ""
    },
    "/docs/tutorial/notifications": {
      "locale": "zh-CN",
      "slug": "notifications",
      "href": "/docs/tutorial/notifications",
      "crowdinFileId": "256225",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/notifications.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"通知（notifications）\"><a href=\"#通知（notifications）\">通知（Notifications）</a></h1>\n<h2 id=\"概览\"><a href=\"#概览\">概览</a></h2>\n<p>这三个操作系统都为应用程序向用户发送通知提供了手段。 在主进程和渲染进程中，显示通知的技术不同的。</p>\n<p>对于渲染进程，Electron 方便地允许开发者使用 <a href=\"https://notifications.spec.whatwg.org/\">HTML5 通知 API</a> 发送通知，然后使用当前运行中的系统的原生通知 API 来进行显示。</p>\n<p>要在主进程中显示通知，您需要使用 <a href=\"/docs/api/notification\">Notification</a> 模块。</p>\n<h2 id=\"示例\"><a href=\"#示例\">示例</a></h2>\n<h3 id=\"在渲染进程中显示通知\"><a href=\"#在渲染进程中显示通知\">在渲染进程中显示通知</a></h3>\n<p>从 <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a> 示例的应用程序开始，将以下行添加到 <code>index.html</code> 文件：</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<p>并添加 <code>renderer.js</code> 文件：</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/notifications/renderer\"><span class=\"hljs-keyword\">const</span> NOTIFICATION_TITLE = <span class=\"hljs-string\">'Title'</span>\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_BODY = <span class=\"hljs-string\">'Notification from the Renderer process. Click to log to console.'</span>\n<span class=\"hljs-keyword\">const</span> CLICK_MESSAGE = <span class=\"hljs-string\">'Notification clicked'</span>\n\n<span class=\"hljs-keyword\">new</span> Notification(NOTIFICATION_TITLE, { <span class=\"hljs-attr\">body</span>: NOTIFICATION_BODY }).onclick = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-built_in\">console</span>.log(CLICK_MESSAGE)\n</code></pre>\n<p>启动 Electron 应用程序后，您应该能看到通知：</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/notification-renderer.png\" alt=\"渲染进程中的通知\"></p>\n<p>此外，如果您点击通知，DOM将更新以显示“Notification clicked!”</p>\n<h3 id=\"show-notifications-in-the-main-process\"><a href=\"#show-notifications-in-the-main-process\">Show notifications in the Main process</a></h3>\n<p>从 <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a> 中的应用开始，将以下内容更新到 <code>main.js</code>。</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/notifications/main\"><span class=\"hljs-keyword\">const</span> { Notification } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_TITLE = <span class=\"hljs-string\">'Basic Notification'</span>\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_BODY = <span class=\"hljs-string\">'Notification from the Main process'</span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">showNotification</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">new</span> Notification({ <span class=\"hljs-attr\">title</span>: NOTIFICATION_TITLE, <span class=\"hljs-attr\">body</span>: NOTIFICATION_BODY }).show()\n}\n\napp.whenReady().then(createWindow).then(showNotification)\n</code></pre>\n<p>启动 Electron 应用程序后，您应该能看到系统通知：</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/notification-main.png\" alt=\"主进程中的通知\"></p>\n<h2 id=\"additional-information\"><a href=\"#additional-information\">Additional information</a></h2>\n<p>虽然操作系统的代码和用户体验相似，但依然存在微妙的差异。</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<ul>\n<li>在 Windows 10 上，您的应用程序的快捷方式必须安装到启动菜单中，包含一个 <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a>. This can be overkill during development, so adding <code>node_modules\\electron\\dist\\electron.exe</code> to your Start Menu also does the trick. Navigate to the file in Explorer, right-click and 'Pin to Start Menu'. 然后您需要添加 <code>app.setAppUserModelId(process.execPath)</code> 到主进程才能看到通知。</li>\n<li>在 Windows 8.1 和 Windows 8 上，带有 <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\"> 应用程序用户模型ID（Application User Model ID）</a> 的应用程序快捷方式必须被添加到开始屏幕上。 但是请注意，它不需要被固定到开始屏幕。</li>\n<li>在 Windows 7 上, 通知通过视觉上类似于较新系统原生的一个自定义的实现来工作。</li>\n</ul>\n<p>Electron尝试将应用程序用户模型 ID 的相关工作自动化。 Electron在和安装和更新框架 Squirrel 协同使用的时候，<a href=\"https://github.com/electron/windows-installer/blob/master/README.md#handling-squirrel-events\">快捷方式将被自动正确的配置好</a>。 更棒的是，Electron 会自动检测 Squirrel 的存在，并且使用正确的值来自动调用<code>app.setAppUserModelId()</code>。 在开发的过程中, 你可能需要自己调用<a href=\"/docs/api/app#appsetappusermodelidid-windows\"><code>app.setAppUserModelld()</code></a></p>\n<p>此外，在Windows 8中，通知正文的最大长度为250个字符，Windows团队建议将通知保留为200个字符。 然而，Windows 10中已经删除了这个限制，但是Windows团队要求开发人员合理使用。 尝试将大量文本发送到API(数千个字符) 可能会导致不稳定。</p>\n<h4 id=\"高级通知\"><a href=\"#高级通知\">高级通知</a></h4>\n<p>Windows 的更高版本允许高级通知，自定义模板，图像和其他灵活元素。 要发送这些通知(来自主进程或渲染器进程)，请使用用户区模块 <a href=\"https://github.com/felixrieseberg/electron-windows-notifications\">electron-windows-notifications</a> 来用原生节点附件发送 <code>ToastNotification</code> 和 <code>TileNotification</code> 对象。</p>\n<p>当包括按钮在内的通知使用 <code>electron-windows-notifications</code> 时，处理回复需要使用 <a href=\"https://github.com/felixrieseberg/electron-windows-interactive-notifications\"><code>electron-windows-interactive-notifications</code></a> 帮助注册所需的 COM 组件并调用您的 Electron 应用程序和输入的用户数据。</p>\n<h4 id=\"免打扰模式--演示模式\"><a href=\"#免打扰模式--演示模式\">免打扰模式 / 演示模式</a></h4>\n<p>如果要检测是否允许发送通知，请使用 <a href=\"https://github.com/felixrieseberg/electron-notification-state\">electron-notification-state</a> 模块。</p>\n<p>这样，您可以提前确定 Windows 是否会将通知忽略。</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>MacOS上的通知是最直接的，但你应该注意<a href=\"https://developer.apple.com/macos/human-interface-guidelines/system-capabilities/notifications/\">苹果关于通知的人机接口指南（Apple's Human Interface guidelines regarding notifications）</a>.</p>\n<p>请注意，通知的大小限制为256个字节，如果超过该限制，则会被截断。</p>\n<h4 id=\"勿扰--会话状态\"><a href=\"#勿扰--会话状态\">勿扰 / 会话状态</a></h4>\n<p>要检测是否允许发送通知，请使用用户区模块 <a href=\"https://github.com/felixrieseberg/electron-notification-state\">electron-notification-state</a>。</p>\n<p>这样可以提前检测是否显示通知。</p>\n<h3 id=\"linux\"><a href=\"#linux\">Linux</a></h3>\n<p>通知是通过<code>libnotify</code>发送的，libnotify可以在任何实现了<a href=\"https://developer.gnome.org/notification-spec/\">桌面通知规范（Desktop Notifications Specification）</a>的桌面环境中发送通知，包括Cinnamon、Enlightenment、Unity、GNOME、KDE</p>",
      "title": "通知（Notifications）",
      "description": ""
    },
    "/docs/tutorial/offscreen-rendering": {
      "locale": "zh-CN",
      "slug": "offscreen-rendering",
      "href": "/docs/tutorial/offscreen-rendering",
      "crowdinFileId": "256227",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/offscreen-rendering.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"离屏渲染\"><a href=\"#离屏渲染\">离屏渲染</a></h1>\n<h2 id=\"概览\"><a href=\"#概览\">概览</a></h2>\n<p>离屏渲染允许你以位图的方式来获取 <code>BrowserWindow</code> 中的内容，所以它可以在任何地方被渲染，例如在3D场景中的纹理。 Electron中的离屏渲染使用与 <a href=\"https://bitbucket.org/chromiumembedded/cef\">Chromium Embedded Framework</a> 项目类似的方法。</p>\n<p><em>注意</em>：</p>\n<ul>\n<li>有两种渲染模式可以使用（见下），只有未渲染区域传递到 <code>绘图</code> 事件才能提高效率。</li>\n<li>您可以停止/继续渲染并设置帧速率。</li>\n<li>最高帧速率为 240，因为更高的值只会带来性能上的损失而没有任何收益。</li>\n<li>当网页上没有发生任何情况时，不会生成帧。</li>\n<li>屏幕窗口始终创建为 <a href=\"/docs/api/frameless-window\">无边框窗口</a>.</li>\n</ul>\n<h3 id=\"渲染模式\"><a href=\"#渲染模式\">渲染模式</a></h3>\n<h4 id=\"gpu加速\"><a href=\"#gpu加速\">GPU加速</a></h4>\n<p>GPU加速渲染意味着使用GPU用于合成。 这也就意味着帧必须从GPU拷贝过来，从而需求更多的资源，因此这会比软件输出设备更慢。 这种模式的优点是支持WebGL和3D CSS动画.</p>\n<h4 id=\"软件输出设备\"><a href=\"#软件输出设备\">软件输出设备</a></h4>\n<p>此模式使用软件输出设备在 CPU 中渲染，因此帧 生成的速度要快得多。 因此，此模式优先于 GPU 加速模式。</p>\n<p>要启用此模式，必须通过调用 <a href=\"/docs/api/app#appdisablehardwareacceleration\"><code>app.disableHardwareAcceleration()</code></a> API 来禁用GPU加速。</p>\n<h2 id=\"示例\"><a href=\"#示例\">示例</a></h2>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/offscreen-rendering\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\napp.disableHardwareAcceleration()\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">offscreen</span>: <span class=\"hljs-literal\">true</span> } })\n\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  win.webContents.on(<span class=\"hljs-string\">'paint'</span>, (event, dirty, image) => {\n    fs.writeFileSync(<span class=\"hljs-string\">'ex.png'</span>, image.toPNG())\n  })\n  win.webContents.setFrameRate(<span class=\"hljs-number\">60</span>)\n})\n</code></pre>\n<p>在运行Electron应用后，进入你的应用的工作目录，你会在里面找到渲染的图片。</p>",
      "title": "离屏渲染",
      "description": ""
    },
    "/docs/tutorial/online-offline-events": {
      "locale": "zh-CN",
      "slug": "online-offline-events",
      "href": "/docs/tutorial/online-offline-events",
      "crowdinFileId": "256229",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/online-offline-events.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"在线离线事件探测\"><a href=\"#在线离线事件探测\">在线/离线事件探测</a></h1>\n<h2 id=\"概览\"><a href=\"#概览\">概览</a></h2>\n<p>在渲染进程中，<a href=\"https://developer.mozilla.org/en-US/docs/Online_and_offline_events\">在线/离线事件</a> 的探测，是通过标准 HTML5 API 中 <a href=\"http://html5index.org/Offline%20-%20NavigatorOnLine.html\"><code>navigator.onLine</code></a> 属性来实现的。</p>\n<p><code>navigator.onLine</code> 属性返回值：</p>\n<ul>\n<li><code>false</code>：如果所有网络请求都失败(例如，断开网络)。</li>\n<li><code>true</code>: 在其他情况下都返回 true</li>\n</ul>\n<p>由于许多情况都会返回 <code>true</code>，你应该小心对待误报的情况， 因为我们不能总是假设 <code>true</code> 值意味着 Electron 可以访问互联网。 例如，当计算机运行的虚拟化软件时，虚拟以太网适配器处于 \"always connected\" 状态。 因此，如果您想要确定 Electron 的互联网访问状态，您应该为此检查进行额外的开发。</p>\n<h2 id=\"示例\"><a href=\"#示例\">示例</a></h2>\n<p>从HTML文件 <code>index.html</code> 开始，这个例子会演示 <code>navigator.onLine</code> API 是如何被用来构建一个连接状态指示器的。</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"script-src 'self' 'unsafe-inline';\"</span> /></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Connection status: <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">strong</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">'status'</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">strong</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>为了操作DOM，创建一个 <code>renderer.js</code> 文件，添加事件监听器到 <code>'online'</code> 和 <code>'offline'</code> <code>窗口</code> 中. 事件处理器设置基于 <code>navigator.onLine</code> 的结果到 <code>&#x3C;strong id='status'></code> element 的内容中。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">updateOnlineStatus</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'status'</span>).innerHTML = navigator.onLine ? <span class=\"hljs-string\">'online'</span> : <span class=\"hljs-string\">'offline'</span>\n}\n\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'online'</span>, updateOnlineStatus)\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'offline'</span>, updateOnlineStatus)\n\nupdateOnlineStatus()\n</code></pre>\n<p>最后，创建一个 <code>main.js</code> 文件用来给主进程创建窗口。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> onlineStatusWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">400</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">100</span>\n  })\n\n  onlineStatusWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n      createWindow()\n    }\n  })\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n</code></pre>\n<p>启动 Electron 应用程序后，您应该能看到通知：</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/connection-status.png\" alt=\"连接状态\"></p>\n<blockquote>\n<p>注意：如果你需要将连接状态发送给主流程，请使用 <a href=\"/docs/api/ipc-renderer\">IPC 渲染器</a> API。</p>\n</blockquote>",
      "title": "在线/离线事件探测",
      "description": "注意：如果你需要将连接状态发送给主流程，请使用 IPC 渲染器 API。"
    },
    "/docs/development/patches": {
      "locale": "zh-CN",
      "slug": "patches",
      "href": "/docs/development/patches",
      "crowdinFileId": "256161",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/patches.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"patches-in-electron\"><a href=\"#patches-in-electron\">Patches in Electron</a></h1>\n<p>Electron是基于两个主要的上游项目：Chromium和Node.js Each of these projects has several of their own dependencies, too. We try our best to use these dependencies exactly as they are but sometimes we can't achieve our goals without patching those upstream dependencies to fit our use cases.</p>\n<h2 id=\"patch-justification\"><a href=\"#patch-justification\">Patch justification</a></h2>\n<p>Every patch in Electron is a maintenance burden. When upstream code changes, patches can break—sometimes without even a patch conflict or a compilation error. It's an ongoing effort to keep our patch set up-to-date and effective. So we strive to keep our patch count at a minimum. To that end, every patch must describe its reason for existence in its commit message. That reason must be one of the following:</p>\n<ol>\n<li>The patch is temporary, and is intended to be (or has been) committed upstream or otherwise eventually removed. Include a link to an upstream PR or code review if available, or a procedure for verifying whether the patch is still needed at a later date.</li>\n<li>The patch allows the code to compile in the Electron environment, but cannot be upstreamed because it's Electron-specific (e.g. patching out references to Chrome's <code>Profile</code>). Include reasoning about why the change cannot be implemented without a patch (e.g. by subclassing or copying the code).</li>\n<li>The patch makes Electron-specific changes in functionality which are fundamentally incompatible with upstream.</li>\n</ol>\n<p>In general, all the upstream projects we work with are friendly folks and are often happy to accept refactorings that allow the code in question to be compatible with both Electron and the upstream project. (See e.g. <a href=\"https://chromium-review.googlesource.com/c/chromium/src/+/1637040\">this</a> change in Chromium, which allowed us to remove a patch that did the same thing, or <a href=\"https://github.com/nodejs/node/pull/22110\">this</a> change in Node, which was a no-op for Node but fixed a bug in Electron.) <strong>We should aim to upstream changes whenever we can, and avoid indefinite-lifetime patches</strong>.</p>\n<h2 id=\"patch-system\"><a href=\"#patch-system\">Patch system</a></h2>\n<p>If you find yourself in the unfortunate position of having to make a change which can only be made through patching an upstream project, you'll need to know how to manage patches in Electron.</p>\n<p>All patches to upstream projects in Electron are contained in the <code>patches/</code> directory. Each subdirectory of <code>patches/</code> contains several patch files, along with a <code>.patches</code> file which lists the order in which the patches should be applied. Think of these files as making up a series of git commits that are applied on top of the upstream project after we check it out.</p>\n<pre><code class=\"hljs language-plaintext\">patches\n├── config.json   &#x3C;-- this describes which patchset directory is applied to what project\n├── chromium\n│   ├── .patches\n│   ├── accelerator.patch\n│   ├── add_contentgpuclient_precreatemessageloop_callback.patch\n│   ⋮\n├── node\n│   ├── .patches\n│   ├── add_openssl_is_boringssl_guard_to_oaep_hash_check.patch\n│   ├── build_add_gn_build_files.patch\n│   ⋮\n⋮\n</code></pre>\n<p>To help manage these patch sets, we provide two tools: <code>git-import-patches</code> and <code>git-export-patches</code>. <code>git-import-patches</code> imports a set of patch files into a git repository by applying each patch in the correct order and creating a commit for each one. <code>git-export-patches</code> does the reverse; it exports a series of git commits in a repository into a set of files in a directory and an accompanying <code>.patches</code> file.</p>\n<blockquote>\n<p>Side note: the reason we use a <code>.patches</code> file to maintain the order of applied patches, rather than prepending a number like <code>001-</code> to each file, is because it reduces conflicts related to patch ordering. It prevents the situation where two PRs both add a patch at the end of the series with the same numbering and end up both getting merged resulting in a duplicate identifier, and it also reduces churn when a patch is added or deleted in the middle of the series.</p>\n</blockquote>\n<h3 id=\"用法\"><a href=\"#用法\">用法</a></h3>\n<h4 id=\"adding-a-new-patch\"><a href=\"#adding-a-new-patch\">Adding a new patch</a></h4>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n$ vim some/code/file.cc\n$ git commit\n$ ../../electron/script/git-export-patches -o ../../electron/patches/node\n</code></pre>\n<blockquote>\n<p><strong>NOTE</strong>: <code>git-export-patches</code> ignores any uncommitted files, so you must create a commit if you want your changes to be exported. The subject line of the commit message will be used to derive the patch file name, and the body of the commit message should include the reason for the patch's existence.</p>\n</blockquote>\n<p>Re-exporting patches will sometimes cause shasums in unrelated patches to change. This is generally harmless and can be ignored (but go ahead and add those changes to your PR, it'll stop them from showing up for other people).</p>\n<h4 id=\"editing-an-existing-patch\"><a href=\"#editing-an-existing-patch\">Editing an existing patch</a></h4>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/v8\n$ vim some/code/file.cc\n$ git <span class=\"hljs-built_in\">log</span>\n<span class=\"hljs-comment\"># Find the commit sha of the patch you want to edit.</span>\n$ git commit --fixup [COMMIT_SHA]\n$ git rebase --autosquash -i [COMMIT_SHA]^\n$ ../electron/script/git-export-patches -o ../electron/patches/v8\n</code></pre>\n<h4 id=\"removing-a-patch\"><a href=\"#removing-a-patch\">Removing a patch</a></h4>\n<pre><code class=\"hljs language-bash\">$ vim src/electron/patches/node/.patches\n<span class=\"hljs-comment\"># Delete the line with the name of the patch you want to remove</span>\n$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n$ git reset --hard refs/patches/upstream-head\n$ ../../electron/script/git-import-patches ../../electron/patches/node\n$ ../../electron/script/git-export-patches -o ../../electron/patches/node\n</code></pre>\n<p>Note that <code>git-import-patches</code> will mark the commit that was <code>HEAD</code> when it was run as <code>refs/patches/upstream-head</code>. This lets you keep track of which commits are from Electron patches (those that come after <code>refs/patches/upstream-head</code>) and which commits are in upstream (those before <code>refs/patches/upstream-head</code>).</p>\n<h4 id=\"解决冲突\"><a href=\"#解决冲突\">解决冲突</a></h4>\n<p>When updating an upstream dependency, patches may fail to apply cleanly. Often, the conflict can be resolved automatically by git with a 3-way merge. You can instruct <code>git-import-patches</code> to use the 3-way merge algorithm by passing the <code>-3</code> argument:</p>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n<span class=\"hljs-comment\"># If the patch application failed midway through, you can reset it with:</span>\n$ git am --abort\n<span class=\"hljs-comment\"># And then retry with 3-way merge:</span>\n$ ../../electron/script/git-import-patches -3 ../../electron/patches/node\n</code></pre>\n<p>If <code>git-import-patches -3</code> encounters a merge conflict that it can't resolve automatically, it will pause and allow you to resolve the conflict manually. Once you have resolved the conflict, <code>git add</code> the resolved files and continue to apply the rest of the patches by running <code>git am --continue</code>.</p>",
      "title": "Patches in Electron",
      "description": "Side note: the reason we use a .patches file to maintain the order of applied patches, rather than prepending a number like 001- to each file, is because it reduces conflicts related to patch ordering. It prevents the situation where two PRs both add a patch at the end of the series with the same numbering and end up both getting merged resulting in a duplicate identifier, and it also reduces churn when a patch is added or deleted in the middle of the series."
    },
    "/docs/tutorial/performance": {
      "locale": "zh-CN",
      "slug": "performance",
      "href": "/docs/tutorial/performance",
      "crowdinFileId": "256231",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/performance.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"性能\"><a href=\"#性能\">性能</a></h1>\n<p>开发者经常询问优化 Electron 应用程序性能的策略。 软件工程师、用户和框架开发者并不总是就“性能”的含义达成单一定义。 此文档概述了Electron 维护者最喜欢的减少内存使用、 CPU 负载以及磁盘资源使用的方式。以确保您的应用程序能够响应用户输入并尽快完成操作。 此外，我们希望所有的性能策略都能保持您应用的高标准安全。</p>\n<p>关于如何使用 JavaScript构建高性能网站的技巧和方法通常也适用于Electron 应用程序。 在某种程度上，讨论如何构建高性能 Node.js 应用的方法同样也适用。但是小心理解“性能”一词的含义对于 Node.js 后端和客户端程序并不相同。</p>\n<p>文中的列表提供了一些方便，同时也需要注意，它和我们的<a href=\"/docs/tutorial/security\">安全性检查列表</a>类似，并不详尽。 即使你参照了下面提到的所有步骤，依然有可能构建出来一个性能低的Electron应用。 Electron是一个强大的开发平台，可以让开发人员按照自己所想，做更多的或更少的事情。 而这种自由的代价就是开发者需要承担大部分性能上的责任。</p>\n<h2 id=\"再三权衡\"><a href=\"#再三权衡\">再三权衡</a></h2>\n<p>以下列举了一些直截了当、易于实现的方式。 但是，如果你想构建性能最优秀的应用，仅仅这些是不够的。 你需要仔细检查应用中运行的所有代码，认真地进行分析和衡量。 瓶颈在哪里？ 当用户点击按钮时，哪些操作的执行占用了最多的时间？ 当应用程序被挂起时，哪些对象占用了最多的内存？</p>\n<p>通过多次的尝试，我们发现，构建高性能的Electron应用程序，最成功的策略是分析正在运行的代码，查找其中最耗资源的部分，然后对其进行优化。 一遍又一遍地重复这个“搬砖”的过程，将极大地提高应用程序的性能。 在大型应用程序（例如Visual Studio Code、Slack）中的实践经验证明了这是目前最可靠的性能提升策略。</p>\n<p>要了解更多关于如何分析应用程序代码的信息，请熟悉Chrome开发者工具。 若要高级分析查看多个进程，请使用 <a href=\"https://www.chromium.org/developers/how-tos/trace-event-profiling-tool\">Chrome Tracing</a> 工具。</p>\n<h3 id=\"推荐阅读\"><a href=\"#推荐阅读\">推荐阅读</a></h3>\n<ul>\n<li><a href=\"https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/\">从分析运行时性能开始</a></li>\n<li><a href=\"https://www.youtube.com/watch?v=r0OeHRUCCb4\">谈：“Visual Studio Code - 第一个一秒”</a></li>\n</ul>\n<h2 id=\"检查列表\"><a href=\"#检查列表\">检查列表</a></h2>\n<p>如果你尝试这些步骤，你的应用可能会略微简洁、快速，而且一般来说会更少出现资源不足的情况。</p>\n<ol>\n<li><a href=\"#1-carelessly-including-modules\">谨慎地加载模块</a></li>\n<li><a href=\"#2-loading-and-running-code-too-soon\">过早的加载和执行代码</a></li>\n<li><a href=\"#3-blocking-the-main-process\">阻塞主进程</a></li>\n<li><a href=\"#4-blocking-the-renderer-process\">阻塞渲染进程</a></li>\n<li><a href=\"#5-unnecessary-polyfills\">不必要的polyfills</a></li>\n<li><a href=\"#6-unnecessary-or-blocking-network-requests\">不必要的或者阻塞的网络请求</a></li>\n<li><a href=\"#7-bundle-your-code\">打包你的代码</a></li>\n</ol>\n<h2 id=\"1-谨慎地加载模块\"><a href=\"#1-谨慎地加载模块\">1) 谨慎地加载模块</a></h2>\n<p>在向你的应用程序添加一个 Node.js 模块之前，请检查这个模块。 这个模块包含了多少依赖？ 简单的一个a <code>require()</code>声明中包含了什么种类的资源？ 你可能发现NPM包注册的最多的或者Github上Star最多的模块实际上并不是最简单或者最小可用的模块。</p>\n<h3 id=\"为什么？\"><a href=\"#为什么？\">为什么？</a></h3>\n<p>这一建议背后的理由最好用一个真实的例子来说明。 在Electron最开始的那些日子，可靠的检查网络连接是一个问题，导致很多应用公开的使用了一个简单的<code>isOnline()</code>方法。</p>\n<p>该模块通过尝试访问多个众所周知的端点，检测到您的网络连接。 至于这些资源的列表，它取决于一个完全不同的模块，这个模块也包含一个众所周知的端口。 这个依赖本身又依赖一个包含超过 100 000行端口信息的JSON文件的模块。 每当模块加载时(通常用 <code>require('module')</code>)，它会加载所有依赖关系并最终读取并解析此 JSON 文件。 解析几千行的JSON是一个非常繁重的操作。 在性能差的机器上，它会占用整整几秒的时间。</p>\n<p>在许多服务器环境中，启动时间几乎无关紧要。 一个Node.js 服务器要求所有端口的信息可能实际上是“性能更好” 如果服务器在启动时将所有需要的信息加载到内存，这样就能更快地为响应请求。 此示例中讨论的模块不是一个“坏”模块。 然而，Electron 应用不应该将实际上不需要的信息加载、解析和存储在内存中。</p>\n<p>简而言之，一个主要为运行在Linux系统上的Node.js 服务器编写的模块，虽然看起来很好，但是对你的应用性能来说可能是个坏消息。 在这个特殊的示例中，正确的解决方案是根本不需要加载模块， 而是使用了一 个包含在以后版本的 Chromium 中的连接性检查。</p>\n<h3 id=\"怎么做？\"><a href=\"#怎么做？\">怎么做？</a></h3>\n<p>当考虑一个模块时，我们建议你做以下检查：</p>\n<ol>\n<li>包含的依赖项的大小</li>\n<li>需要加载的(<code>require()</code>) 资源</li>\n<li>你所加载的资源能够执行你关心的操作</li>\n</ol>\n<p>可以使用命令行上的单个命令生成用于加载模块的 CPU 配置文件和堆内存配置文件 在下面的示例中，我们看一下受欢迎的模块 <code>request</code>。</p>\n<pre><code class=\"hljs language-sh\">node --cpu-prof --heap-prof -e <span class=\"hljs-string\">\"require('request')\"</span>\n</code></pre>\n<p>执行此命令将在您执行的目录下生成一个<code>.cpuprofile</code>和一个<code>.heapprofile</code> 文件。 这两个文件都可以使用 Chrome 开发者工具进行分析，分别使用 <code>Performance</code> 和 <code>Memory</code> 标签 进行分析。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/performance-cpu-prof.png\" alt=\"Performance CPU Profile\"></p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/performance-heap-prof.png\" alt=\"Performance Heap Memory Profile\"></p>\n<p>在这个例子里，我们看到在作者的机器上加载<code>request</code> 大概用了半秒钟，其中 <code>node-fetch</code>明显占用了极少的内存并且加载用时少于 50ms。</p>\n<h2 id=\"2-过早的加载和执行代码\"><a href=\"#2-过早的加载和执行代码\">2) 过早的加载和执行代码</a></h2>\n<p>如果你有非常繁重的初始化操作，请考虑推迟进行。 程序启动立刻查看应用执行的全部工作。 考虑按照用户操作的顺序将它们错开执行，而不是立刻执行所有的操作。</p>\n<p>在传统的Node.js开发中，我们习惯将所有的<code>require()</code>语句放在代码顶部。 如果你目前正在使用相同的策略<em>and</em>并且使用你不需要立即加载的大型模块编写你的 Electron 应用程序，使用相同的策略并推迟到更适当的时机加载。</p>\n<h3 id=\"为什么？-1\"><a href=\"#为什么？-1\">为什么？</a></h3>\n<p>加载模块是令人吃惊的繁重的操作，尤其是在Windows上。 当你的应用开始，不应该让用户等待当时不需要的操作。</p>\n<p>这似乎是显而易见的， 但许多应用程序在程序启动后可能会马上完成大量的 工作 - 如检查更新，正在下载稍后流程中使用的内容，或执行大型的磁盘I/O 操作。</p>\n<p>让我们把Visual Studio 代码作为一个例子。 当你打开一个文件，它会立刻展示没有高亮任何代码的内容，优先实现和文本交互的功能。 一旦它完成了这项工作，它将继续让代码高亮。</p>\n<h3 id=\"怎么做？-1\"><a href=\"#怎么做？-1\">怎么做？</a></h3>\n<p>让我们考虑一个示例，并假定您的应用程序正在以架空的<code>.foo</code>形式解析文件 。 为了做到这一点，它依赖同样架空的<code>foo-parserver</code> 模块。 在传统的 Node.js 开发中，你可以写代码热加载依赖：</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> fooParser = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'foo-parser'</span>)\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">Parser</span> </span>{\n  <span class=\"hljs-keyword\">constructor</span> () {\n    <span class=\"hljs-keyword\">this</span>.files = fs.readdirSync(<span class=\"hljs-string\">'.'</span>)\n  }\n\n  getParsedFiles () {\n    <span class=\"hljs-keyword\">return</span> fooParser.parse(<span class=\"hljs-keyword\">this</span>.files)\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> parser = <span class=\"hljs-keyword\">new</span> Parser()\n\n<span class=\"hljs-built_in\">module</span>.exports = { parser }\n</code></pre>\n<p>在上面的例子中，我们做了很多工作，一旦文件加载，我们就会立即执行。 我们需要立即获取解析的文件吗？ 或许我们可以晚一点再做这件事，当<code>getParsedFiles()</code> 真正的执行到的时候？</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// \"fs\" is likely already being loaded, so the `require()` call is cheap</span>\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">Parser</span> </span>{\n  <span class=\"hljs-keyword\">async</span> getFiles () {\n    <span class=\"hljs-comment\">// Touch the disk as soon as `getFiles` is called, not sooner.</span>\n    <span class=\"hljs-comment\">// Also, ensure that we're not blocking other operations by using</span>\n    <span class=\"hljs-comment\">// the asynchronous version.</span>\n    <span class=\"hljs-keyword\">this</span>.files = <span class=\"hljs-keyword\">this</span>.files || <span class=\"hljs-keyword\">await</span> fs.readdir(<span class=\"hljs-string\">'.'</span>)\n\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-keyword\">this</span>.files\n  }\n\n  <span class=\"hljs-keyword\">async</span> getParsedFiles () {\n    <span class=\"hljs-comment\">// Our fictitious foo-parser is a big and expensive module to load, so</span>\n    <span class=\"hljs-comment\">// defer that work until we actually need to parse files.</span>\n    <span class=\"hljs-comment\">// Since `require()` comes with a module cache, the `require()` call</span>\n    <span class=\"hljs-comment\">// will only be expensive once - subsequent calls of `getParsedFiles()`</span>\n    <span class=\"hljs-comment\">// will be faster.</span>\n    <span class=\"hljs-keyword\">const</span> fooParser = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'foo-parser'</span>)\n    <span class=\"hljs-keyword\">const</span> files = <span class=\"hljs-keyword\">await</span> <span class=\"hljs-keyword\">this</span>.getFiles()\n\n    <span class=\"hljs-keyword\">return</span> fooParser.parse(files)\n  }\n}\n\n<span class=\"hljs-comment\">// This operation is now a lot cheaper than in our previous example</span>\n<span class=\"hljs-keyword\">const</span> parser = <span class=\"hljs-keyword\">new</span> Parser()\n\n<span class=\"hljs-built_in\">module</span>.exports = { parser }\n</code></pre>\n<p>简而言之，只有当需要的时候才分配资源，而不是在你的应用启动时分配所有。</p>\n<h2 id=\"3-阻塞主进程\"><a href=\"#3-阻塞主进程\">3) 阻塞主进程</a></h2>\n<p>Electron的主要进程(有时称为“浏览器进程”) 非常特殊：它是与你应用的所有其他进程的父进程，也是和操作系统交互的关键进程。 It handles windows, interactions, and the communication between various components inside your app. It also houses the UI thread.</p>\n<p>在任何情况下你都不应阻塞此进程或者运行时间长的用户界面线程。 阻塞UI线程意味着您的整个应用程序将冻结直到主进程准备好继续处理。</p>\n<h3 id=\"为什么？-2\"><a href=\"#为什么？-2\">为什么？</a></h3>\n<p>The main process and its UI thread are essentially the control tower for major operations inside your app. When the operating system tells your app about a mouse click, it'll go through the main process before it reaches your window. 如果您的窗口呈现黄色平滑动画， 它需要和 GPU 进程进行通信——再次穿越主进程。</p>\n<p>Electron 和 Chromium 谨慎地将大型的磁盘I/O 和 CPU绑定的操作放入新线程，以避免阻塞UI 线程。 你也应该这样做。</p>\n<h3 id=\"怎么做？-2\"><a href=\"#怎么做？-2\">怎么做？</a></h3>\n<p>Electron强大的多进程架构随时准备帮助你完成你的长期任务，但其中也包含少量性能陷阱。</p>\n<p>1) 对于需要长期占用CPU繁重任务，使用 <a href=\"https://nodejs.org/api/worker_threads.html\">worker threads</a>， 考虑将它们移动到 BrowserWindow, 或 (作为最后手段) 生成一个专用进程。</p>\n<p>2) 尽可能避免使用同步IPC 和 <code>remote</code> 模块。 虽然有合法的使用案例，但使用<code>remote</code>模块的时候非常容易不知情地阻塞 UI线程。</p>\n<p>3) Avoid using blocking I/O operations in the main process. 简而言之，每当Node.js的核心模块 (如<code>fs</code> 或 <code>child_process</code>) 提供一个同步版本或 异步版本，你更应该使用异步和非阻塞式的变量。</p>\n<h2 id=\"4-阻塞渲染进程\"><a href=\"#4-阻塞渲染进程\">4) 阻塞渲染进程</a></h2>\n<p>自从 Electron 使用了当前版本的 Chrome，你可以使用Web 平台提供的最新和最优秀的功能来推迟或卸载繁重的操作，以使你的应用保持流畅和迅速的反应。</p>\n<h3 id=\"为什么？-3\"><a href=\"#为什么？-3\">为什么？</a></h3>\n<p>你的应用可能有很多JavaScript在渲染过程中运行。 有个技巧是尽快执行操作，而不占用保持滚动平滑、响应用户输入或60帧/秒动画所需的资源。</p>\n<p>如果有用户抱怨你的应用“口吃”的时候在渲染的代码中编排操作流就显得尤其重要。</p>\n<h3 id=\"怎么做？-3\"><a href=\"#怎么做？-3\">怎么做？</a></h3>\n<p>一般来说，所有用于构建现代浏览器的性能网络应用程序的建议，对于Electron 的渲染器也同样适用。 现在处理你的应用的主要两个方法是对于小的操作使用<code>requestIdleCallback()</code> 而长时间运行的操作使用 <code>Web Workers</code>。</p>\n<p><em><code>requestIdleCallback()</code></em>允许开发者将函数排队为在进程进入空闲期后立刻执行。 它使你能够在不影响用户体验的情况下执行低优先级或后台执行的工作。 想要了解如何使用它的更多信息，<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\">请查看MDN上的文档</a>。</p>\n<p><em>Web Workers</em>是在单独线程上运行代码的一个好方式。 有一些注意事项需要考虑 - 请查阅 Electron 的 <a href=\"/docs/tutorial/multithreading\">多线程文档</a> 和 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers\">MDN 的 Web Workers文档</a>。 对于长时间并且大量使用CPU的操作来说它们是一个理想的解析器。</p>\n<h2 id=\"5-不必要的polyfills\"><a href=\"#5-不必要的polyfills\">5) 不必要的polyfills</a></h2>\n<p>Electron的一大好处是，你准确地知道哪个引擎将解析你的 JavaScript, HTML和CSS。 如果你重新设计的代码是为整个网页编写的，请确保不会polyfill包含在Electron 中的特性。</p>\n<h3 id=\"为什么？-4\"><a href=\"#为什么？-4\">为什么？</a></h3>\n<p>现在互联网构建网页应用程序时，最老的环境决定了你能够和不能使用的功能。 尽管Electron支持性能良好的 CSS 选择器和动画，但是较早的浏览器可能不支持。 在你可以使用WebGL的场合，你的开发者可能选择了一个资源更加匮乏的解决方案来支持旧机器。</p>\n<p>当它遇到JavaScript时， 你可能已经包含了工具包库，如DOM选择器 jQuery 或是 如<code>regenerator-runtime</code>支持<code>async/await</code> 的polyfills。</p>\n<p>基于 JavaScript 的polyfill速度比Electron 中的原生特征要快一些。 不要通过发布你自己的网络平台标准来减慢你的 Electron 应用速度。</p>\n<h3 id=\"怎么做？-4\"><a href=\"#怎么做？-4\">怎么做？</a></h3>\n<p>假定当前版本的 Electron不需要使用polyfills。 如果你有所疑虑，检查 <a href=\"https://caniuse.com/\">caniuse.com</a> 以确认 是否<a href=\"/docs/api/process#processversionschrome-readonly\">在你的Electron版本中使用的Chromium版本</a> 已经支持了你需要的特性.</p>\n<p>此外，仔细检查您使用的三方库。 它们是否真的必要？ 例如，<code>jQuery</code>非常成功，它的许多功能现在都是 <a href=\"http://youmightnotneedjquery.com/\">标准JavaScript功能设置的 的一部分</a>。</p>\n<p>如果您正在使用 TypeScript 这样的编译器，检查它的配置并确保你的目标是Electron 支持的最新 ECMAScript 版本。</p>\n<h2 id=\"6-不必要或阻塞的网络请求\"><a href=\"#6-不必要或阻塞的网络请求\">6) 不必要或阻塞的网络请求</a></h2>\n<p>避免从互联网中获取几乎不变化的资源，如果它可以轻松地与你的应用程序捆绑起来。</p>\n<h3 id=\"为什么？-5\"><a href=\"#为什么？-5\">为什么？</a></h3>\n<p>许多开始使用基于Web的应用程序的Electron用户后来都使用了桌面应用。 作为网页开发者，我们习惯了从各种内容交付网站加载资源。 Now that you are shipping a proper desktop application, attempt to \"cut the cord\" where possible and avoid letting your users wait for resources that never change and could easily be included  in your app.</p>\n<p>一个典型的例子是谷歌字体。 许多开发者使用谷歌令人印象深刻的免费字体集，这些字体通过内容交付网络获取。 方法显而易见：包括几行CSS 和谷歌将处理其余部分。</p>\n<p>构建Electron应用程序时，如果你下载字体并将其包含在应用包中，你的用户将会得到更好的服务。</p>\n<h3 id=\"怎么做？-5\"><a href=\"#怎么做？-5\">怎么做？</a></h3>\n<p>在理想情况下，你的应用程序不需要网络就可以运行。 要达到这个目标，你必须了解你的应用正在下载哪些资源以及这些资源的大小。</p>\n<p>要做到这一点，请打开开发者工具。 导航到 <code>Network</code> 选项卡，然后检查 <code>Disable cache</code> 选项。 然后重新加载你的页面。 除非你的应用禁止重新加载， 你通常可以在使用开发者工具时点击<code>Cmd + R</code> 或<code>Ctrl + R</code>触发重新加载。</p>\n<p>开发者工具将仔细记录所有网络请求。 第一步，评估正在下载的所有资源，首先侧重于较大的文件。 其中是否有任何图像、字体或媒体文件不会改变并且可以包含在你的包中？ 如果可以，把它们打包。</p>\n<p>下一步，启用 <code>Network Throttling</code>。 查找当前读取<code>Online</code>的下拉列表，并选择较慢的速度，例如<code>Fast 3G</code>。 重新加载你的页面并查看你的应用程序是否有等待任何不必要的资源。 在大多数情况下，尽管实际上不需要相关的资源，应用还是会等待网络请求完成。</p>\n<p>作为一个提示, 从互联网上加载你可能想要更改的而不发送应用程序更新是一个强有力的策略。 为了进一步控制如何加载资源，请考虑使用<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API\">Service Worker</a>。</p>\n<h2 id=\"7-打包你的代码\"><a href=\"#7-打包你的代码\">7) 打包你的代码</a></h2>\n<p>正如中已经指出的那样，\"<a href=\"#2-loading-and-running-code-too-soon\">加载和运行代码太早</a>\", 调用 <code>require()</code> 是一项繁重的操作。 如果你能够这样做，将你的应用程序的代码打包到单个文件中。</p>\n<h3 id=\"为什么？-6\"><a href=\"#为什么？-6\">为什么？</a></h3>\n<p>现代JavaScript开发通常涉及许多文件和模块。 对于使用Electron开发的人来说这是非常好的事情，我们强烈建议你将你的代码打包到单个文件中以确保调用<code>require()</code> 时只在你的应用加载花费一次开销。</p>\n<h3 id=\"怎么做？-6\"><a href=\"#怎么做？-6\">怎么做？</a></h3>\n<p>有许多JavaScript打包的方法可供使用，我们知道我们最好不要通过推荐一种工具来导致社区不满。 然而，我们的确建议您使用一个能够处理Electron独特的环境的打包程序，它需要处理Node.js 和浏览器两种环境。</p>\n<p>在撰写这篇文章时，受欢迎的选择包括<a href=\"https://webpack.js.org/\">Webpack</a>, <a href=\"https://parceljs.org/\">Parcel</a>和<a href=\"https://rollupjs.org/\">rollup.js</a>。</p>",
      "title": "性能",
      "description": ""
    },
    "/docs/api/structures/point": {
      "locale": "zh-CN",
      "slug": "point",
      "href": "/docs/api/structures/point",
      "crowdinFileId": "256475",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/point.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"point-object\"><a href=\"#point-object\">Point Object</a></h1>\n<ul>\n<li><code>x</code> Number</li>\n<li><code>y</code> Number</li>\n</ul>\n<p><strong>Note:</strong> Both <code>x</code> and <code>y</code> must be whole integers, when providing a point object as input to an Electron API we will automatically round your <code>x</code> and <code>y</code> values to the nearest whole integer.</p>",
      "title": "Point Object",
      "description": ""
    },
    "/docs/api/structures/post-body": {
      "locale": "zh-CN",
      "slug": "post-body",
      "href": "/docs/api/structures/post-body",
      "crowdinFileId": "256477",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/post-body.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"postbody-object\"><a href=\"#postbody-object\">PostBody Object</a></h1>\n<ul>\n<li><code>data</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)[] - The post data to be sent to the new window.</li>\n<li><code>contentType</code> String - The <code>content-type</code> header used for the data. One of <code>application/x-www-form-urlencoded</code> or <code>multipart/form-data</code>. Corresponds to the <code>enctype</code> attribute of the submitted HTML form.</li>\n<li><code>boundary</code> String (optional) - The boundary used to separate multiple parts of the message. Only valid when <code>contentType</code> is <code>multipart/form-data</code>.</li>\n</ul>\n<p>Note that keys starting with <code>--</code> are not currently supported. For example, this will errantly submit as <code>multipart/form-data</code> when <code>nativeWindowOpen</code> is set to <code>false</code> in webPreferences:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">form</span>\n  <span class=\"hljs-attr\">target</span>=<span class=\"hljs-string\">\"_blank\"</span>\n  <span class=\"hljs-attr\">method</span>=<span class=\"hljs-string\">\"POST\"</span>\n  <span class=\"hljs-attr\">enctype</span>=<span class=\"hljs-string\">\"application/x-www-form-urlencoded\"</span>\n  <span class=\"hljs-attr\">action</span>=<span class=\"hljs-string\">\"https://postman-echo.com/post\"</span>\n></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">input</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text\"</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">\"--theKey\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">input</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"submit\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">form</span>></span>\n</code></pre>",
      "title": "PostBody Object",
      "description": ""
    },
    "/docs/api/power-monitor": {
      "locale": "zh-CN",
      "slug": "power-monitor",
      "href": "/docs/api/power-monitor",
      "crowdinFileId": "256351",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/power-monitor.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"powermonitor\"><a href=\"#powermonitor\">powerMonitor</a></h1>\n<blockquote>\n<p>监视电源状态的改变。</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<h2 id=\"事件\"><a href=\"#事件\">事件</a></h2>\n<p><code>powerMonitor</code> 模块触发以下事件:</p>\n<h3 id=\"event-suspend\"><a href=\"#event-suspend\">Event: 'suspend'</a></h3>\n<p>在系统挂起时触发。</p>\n<h3 id=\"event-resume\"><a href=\"#event-resume\">Event: 'resume'</a></h3>\n<p>在系统恢复时触发。</p>\n<h3 id=\"event-on-ac-macos-windows\"><a href=\"#event-on-ac-macos-windows\">Event: 'on-ac' <em>macOS</em> <em>Windows</em></a></h3>\n<p>当系统变为交流电源时触发。</p>\n<h3 id=\"event-on-battery-macos--windows\"><a href=\"#event-on-battery-macos--windows\">Event: 'on-battery' <em>macOS</em>  <em>Windows</em></a></h3>\n<p>当系统更改为电池电量时触发。</p>\n<h3 id=\"event-shutdown-linux-macos\"><a href=\"#event-shutdown-linux-macos\">Event: 'shutdown' <em>Linux</em> <em>macOS</em></a></h3>\n<p>当系统即将重启或关机时触发。 如果事件调用<code>e.preventDefault()</code>, Electron 将会尝试延迟系统关机，以便 app 完全退出。 如果<code>e.preventDefault()</code>被调用，在调用类似 <code>app.quit()</code> 后，app 会很快地退出。</p>\n<h3 id=\"event-lock-screen-macos-windows\"><a href=\"#event-lock-screen-macos-windows\">Event: 'lock-screen' <em>macOS</em> <em>Windows</em></a></h3>\n<p>当系统即将锁定屏幕时触发。</p>\n<h3 id=\"event-unlock-screen-macos-windows\"><a href=\"#event-unlock-screen-macos-windows\">Event: 'unlock-screen' <em>macOS</em> <em>Windows</em></a></h3>\n<p>当系统屏幕解锁，立即触发。</p>\n<h3 id=\"事件-user-did-groupe-active-macos\"><a href=\"#事件-user-did-groupe-active-macos\">事件: 'user-did-groupe-active' <em>macOS</em></a></h3>\n<p>当应用被激活时发出。 更多信息请访问 <a href=\"https://developer.apple.com/documentation/appkit/nsworkspacesessiondidbecomeactivenotification?language=objc\">文档</a>。</p>\n<h3 id=\"事件-user-did-resign-active-macos\"><a href=\"#事件-user-did-resign-active-macos\">事件: 'user-did-resign-active' <em>macOS</em></a></h3>\n<p>当应用被激活时发出。 更多信息请访问 <a href=\"https://developer.apple.com/documentation/appkit/nsworkspacesessiondidresignactivenotification?language=objc\">文档</a>。</p>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>电源监视器</code> 模块具有以下方法：</p>\n<h3 id=\"powermonitorgetsystemidlestateidlethreshold\"><a href=\"#powermonitorgetsystemidlestateidlethreshold\"><code>powerMonitor.getSystemIdleState(idleThreshold)</code></a></h3>\n<ul>\n<li><code>idleThreshold</code> Integer</li>\n</ul>\n<p>Returns <code>String</code> - 系统当前状态。 可以被设置为<code>active</code>，<code>idle</code>，<code>locked</code>或者<code>unknown</code></p>\n<p>计算系统空闲状态。 <code>idleThreshold</code> 是闲置之前 (秒内) 的时间量。  <code>locked</code> 仅在支持的系统上可用。</p>\n<h3 id=\"powermonitorgetsystemidletime\"><a href=\"#powermonitorgetsystemidletime\"><code>powerMonitor.getSystemIdleTime()</code></a></h3>\n<p>Returns <code>Integer</code> - 几秒钟内的空闲时间</p>\n<p>计算系统空闲时间以秒为单位。</p>\n<h3 id=\"powermonitorisonbatterypower\"><a href=\"#powermonitorisonbatterypower\"><code>powerMonitor.isOnBatteryPower()</code></a></h3>\n<p>返回<code>Boolean</code>，表示系统是否使用电池电源。</p>\n<p>要监视此属性的变化，请使用 <code>on-battery</code> 和 <code>on-ac&#x3C;</code> 事件。</p>\n<h2 id=\"属性\"><a href=\"#属性\">属性</a></h2>\n<h3 id=\"powermonitoronbatterypower\"><a href=\"#powermonitoronbatterypower\"><code>powerMonitor.onBatteryPower</code></a></h3>\n<p><code>Boolean</code> 属性。 如果系统处于电池电源状态，则为 true。</p>\n<p>参见 <a href=\"#powermonitorisonbatterypower\"><code>powerMonitor.isOnBatteryPower()</code></a>。</p>",
      "title": "powerMonitor",
      "description": "监视电源状态的改变。"
    },
    "/docs/api/power-save-blocker": {
      "locale": "zh-CN",
      "slug": "power-save-blocker",
      "href": "/docs/api/power-save-blocker",
      "crowdinFileId": "256353",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/power-save-blocker.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"powersaveblocker\"><a href=\"#powersaveblocker\">powerSaveBlocker</a></h1>\n<blockquote>\n<p>阻止系统进入低功耗 (休眠) 模式。</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p>例如：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { powerSaveBlocker } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> id = powerSaveBlocker.start(<span class=\"hljs-string\">'prevent-display-sleep'</span>)\n<span class=\"hljs-built_in\">console</span>.log(powerSaveBlocker.isStarted(id))\n\npowerSaveBlocker.stop(id)\n</code></pre>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>powerSaveBlocker</code> 模块具有以下方法:</p>\n<h3 id=\"powersaveblockerstarttype\"><a href=\"#powersaveblockerstarttype\"><code>powerSaveBlocker.start(type)</code></a></h3>\n<ul>\n<li><code>type</code> String - Power save blocker type.<ul>\n<li><code>prevent-app-suspension</code> - Prevent the application from being suspended. Keeps system active but allows screen to be turned off. Example use cases: downloading a file or playing audio.</li>\n<li><code>prevent-display-sleep</code> - Prevent the display from going to sleep. Keeps system and screen active. Example use case: playing video.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code>-指派给此电源拦截器的 id.</p>\n<p>Starts preventing the system from entering lower-power mode. Returns an integer identifying the power save blocker.</p>\n<p><strong> 注意: </strong><code>prevent-display-sleep </code> 比 <code>prevent-app-suspension</code> 具有更高的优先级。 只有最高优先类型才能生效。 换言之, <code>prevent-display-sleep</code> 始终优先于 <code>prevent-app-suspension</code>。</p>\n<p>例如, 一个 API 调用A的类型是 <code>prevent-app-suspension</code>, 另一个调用B的类型是 <code>prevent-display-sleep</code>。 <code>prevent-display-sleep</code> 一直生效，直到 B 停止请求， 之后，<code>prevent-app-suspension</code>才生效。</p>\n<h3 id=\"powersaveblockerstopid\"><a href=\"#powersaveblockerstopid\"><code>powerSaveBlocker.stop(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer 由<code>powerSaveBlocker.start </code> 返回的拦截器 id。</li>\n</ul>\n<p>停止指定的省电拦截器。</p>\n<h3 id=\"powersaveblockerisstartedid\"><a href=\"#powersaveblockerisstartedid\"><code>powerSaveBlocker.isStarted(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer 由<code>powerSaveBlocker.start </code> 返回的拦截器 id。</li>\n</ul>\n<p>Returns <code>Boolean</code>指定的<code>powerSaveBlocker</code>是否已启动。</p>",
      "title": "powerSaveBlocker",
      "description": "阻止系统进入低功耗 (休眠) 模式。"
    },
    "/docs/api/structures/printer-info": {
      "locale": "zh-CN",
      "slug": "printer-info",
      "href": "/docs/api/structures/printer-info",
      "crowdinFileId": "256479",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/printer-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"printerinfo-object\"><a href=\"#printerinfo-object\">PrinterInfo Object</a></h1>\n<ul>\n<li><code>name</code> String - the name of the printer as understood by the OS.</li>\n<li><code>displayName</code> String - the name of the printer as shown in Print Preview.</li>\n<li><code>description</code> String - a longer description of the printer's type.</li>\n<li><code>status</code> Number - the current status of the printer.</li>\n<li><code>isDefault</code> Boolean - whether or not a given printer is set as the default printer on the OS.</li>\n<li><code>options</code> Object - an object containing a variable number of platform-specific printer information.</li>\n</ul>\n<p>The number represented by <code>status</code> means different things on different platforms: on Windows its potential values can be found <a href=\"https://docs.microsoft.com/en-us/windows/win32/printdocs/printer-info-2\">here</a>, and on Linux and macOS they can be found <a href=\"https://www.cups.org/doc/cupspm.html\">here</a>.</p>\n<h2 id=\"示例\"><a href=\"#示例\">示例</a></h2>\n<p>Below is an example of some of the additional options that may be set which may be different on each platform.</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Austin_4th_Floor_Printer___C02XK13BJHD4'</span>,\n  <span class=\"hljs-attr\">displayName</span>: <span class=\"hljs-string\">'Austin 4th Floor Printer @ C02XK13BJHD4'</span>,\n  <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'TOSHIBA ColorMFP'</span>,\n  <span class=\"hljs-attr\">status</span>: <span class=\"hljs-number\">3</span>,\n  <span class=\"hljs-attr\">isDefault</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">options</span>: {\n    <span class=\"hljs-attr\">copies</span>: <span class=\"hljs-string\">'1'</span>,\n    <span class=\"hljs-string\">'device-uri'</span>: <span class=\"hljs-string\">'dnssd://Austin%204th%20Floor%20Printer%20%40%20C02XK13BJHD4._ipps._tcp.local./?uuid=71687f1e-1147-3274-6674-22de61b110bd'</span>,\n    <span class=\"hljs-attr\">finishings</span>: <span class=\"hljs-string\">'3'</span>,\n    <span class=\"hljs-string\">'job-cancel-after'</span>: <span class=\"hljs-string\">'10800'</span>,\n    <span class=\"hljs-string\">'job-hold-until'</span>: <span class=\"hljs-string\">'no-hold'</span>,\n    <span class=\"hljs-string\">'job-priority'</span>: <span class=\"hljs-string\">'50'</span>,\n    <span class=\"hljs-string\">'job-sheets'</span>: <span class=\"hljs-string\">'none,none'</span>,\n    <span class=\"hljs-string\">'marker-change-time'</span>: <span class=\"hljs-string\">'0'</span>,\n    <span class=\"hljs-string\">'number-up'</span>: <span class=\"hljs-string\">'1'</span>,\n    <span class=\"hljs-string\">'printer-commands'</span>: <span class=\"hljs-string\">'ReportLevels,PrintSelfTestPage,com.toshiba.ColourProfiles.update,com.toshiba.EFiling.update,com.toshiba.EFiling.checkPassword'</span>,\n    <span class=\"hljs-string\">'printer-info'</span>: <span class=\"hljs-string\">'Austin 4th Floor Printer @ C02XK13BJHD4'</span>,\n    <span class=\"hljs-string\">'printer-is-accepting-jobs'</span>: <span class=\"hljs-string\">'true'</span>,\n    <span class=\"hljs-string\">'printer-is-shared'</span>: <span class=\"hljs-string\">'false'</span>,\n    <span class=\"hljs-string\">'printer-is-temporary'</span>: <span class=\"hljs-string\">'false'</span>,\n    <span class=\"hljs-string\">'printer-location'</span>: <span class=\"hljs-string\">''</span>,\n    <span class=\"hljs-string\">'printer-make-and-model'</span>: <span class=\"hljs-string\">'TOSHIBA ColorMFP'</span>,\n    <span class=\"hljs-string\">'printer-state'</span>: <span class=\"hljs-string\">'3'</span>,\n    <span class=\"hljs-string\">'printer-state-change-time'</span>: <span class=\"hljs-string\">'1573472937'</span>,\n    <span class=\"hljs-string\">'printer-state-reasons'</span>: <span class=\"hljs-string\">'offline-report,com.toshiba.snmp.failed'</span>,\n    <span class=\"hljs-string\">'printer-type'</span>: <span class=\"hljs-string\">'10531038'</span>,\n    <span class=\"hljs-string\">'printer-uri-supported'</span>: <span class=\"hljs-string\">'ipp://localhost/printers/Austin_4th_Floor_Printer___C02XK13BJHD4'</span>,\n    <span class=\"hljs-attr\">system_driverinfo</span>: <span class=\"hljs-string\">'T'</span>\n  }\n}\n</code></pre>",
      "title": "PrinterInfo Object",
      "description": ""
    },
    "/docs/api/process": {
      "locale": "zh-CN",
      "slug": "process",
      "href": "/docs/api/process",
      "crowdinFileId": "256355",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/process.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"process\"><a href=\"#process\">process</a></h1>\n<blockquote>\n<p>处理对象的扩展</p>\n</blockquote>\n<p>进程： <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>Electron's <code>process</code> 对象继承 <a href=\"https://nodejs.org/api/process.html\">Node.js <code>process</code> object</a>。 它新增了以下事件、属性和方法</p>\n<h2 id=\"sandbox\"><a href=\"#sandbox\">Sandbox</a></h2>\n<p>在沙盒化的渲染进程中， <code>process</code> 对象只包含了API的一个子集:</p>\n<ul>\n<li><code>crash()</code></li>\n<li><code>hang()</code></li>\n<li><code>getCreationTime()</code></li>\n<li><code>getHeapStatistics()</code></li>\n<li><code>getBlinkMemoryInfo()</code></li>\n<li><code>getProcessMemoryInfo()</code></li>\n<li><code>getSystemMemoryInfo()</code></li>\n<li><code>getSystemVersion()</code></li>\n<li><code>getCPUUsage()</code></li>\n<li><code>getIOCounters()</code></li>\n<li><code>uptime()</code></li>\n<li><code>argv</code></li>\n<li><code>execPath</code></li>\n<li><code>env</code></li>\n<li><code>pid</code></li>\n<li><code>arch</code></li>\n<li><code>platform</code></li>\n<li><code>沙盒化</code></li>\n<li><code>contextIsolated</code></li>\n<li><code>type</code></li>\n<li><code>version</code></li>\n<li><code>versions</code></li>\n<li><code>mas</code></li>\n<li><code>windowsStore</code></li>\n<li><code>contextId</code></li>\n</ul>\n<h2 id=\"事件\"><a href=\"#事件\">事件</a></h2>\n<h3 id=\"事件-loaded\"><a href=\"#事件-loaded\">事件: 'loaded'</a></h3>\n<p>当Electron加载了它的内部初始化脚本并且是正要开始加载网页或主脚本时触发。</p>\n<h2 id=\"属性\"><a href=\"#属性\">属性</a></h2>\n<h3 id=\"processdefaultapp-只读\"><a href=\"#processdefaultapp-只读\"><code>process.defaultApp</code> <em>只读</em></a></h3>\n<p>一个 <code>Boolean</code>。 当应用程序启动时被作为参数传递给默认应用，这个属性在主进程中是<code>true</code>，否则是<code>undefined</code>。</p>\n<h3 id=\"processismainframe-只读\"><a href=\"#processismainframe-只读\"><code>process.isMainFrame</code> <em>只读</em></a></h3>\n<p><code>Boolean</code>，若当前渲染器上下文是 渲染器\"主\"框架时为<code>true</code>。 如果你想得到当前框架的ID，你应该使用 <code>webFrame.routingId</code>。</p>\n<h3 id=\"processmas-只读\"><a href=\"#processmas-只读\"><code>process.mas</code> <em>只读</em></a></h3>\n<p>一个 <code>Boolean</code>。 为Mac App Store 构建，该属性是 <code>true</code>，为其他构建则为<code>undefined</code>。</p>\n<h3 id=\"processnoasar\"><a href=\"#processnoasar\"><code>process.noAsar</code></a></h3>\n<p><code>Boolean</code> 控制您应用程序内的 ASAR 支持。 设置为 <code>true</code>将会禁用Node内置模块中对 <code>asar</code> 的支持。</p>\n<h3 id=\"processnodeprecation\"><a href=\"#processnodeprecation\"><code>process.noDeprecation</code></a></h3>\n<p><code>Boolean</code> 类型，用于控制弃用警告是否被打印到<code>stderr</code>。 将其设置为<code>true</code>将会禁用弃用警告。 使用此属性代替 <code>-no-deprecation </code> 命令行标志。</p>\n<h3 id=\"processresourcespath-只读\"><a href=\"#processresourcespath-只读\"><code>process.resourcesPath</code> <em>只读</em></a></h3>\n<p><code>String</code> 类型， 表示资源目录的路径。</p>\n<h3 id=\"processsandboxed-只读\"><a href=\"#processsandboxed-只读\"><code>process.sandboxed</code> <em>只读</em></a></h3>\n<p>一个 <code>Boolean</code>。 当渲染器进程被沙盒化时，该属性是 <code>true</code>，否则是 <code>undefined</code>。</p>\n<h3 id=\"processcontextisolated-只读\"><a href=\"#processcontextisolated-只读\"><code>process.contextIsolated</code> <em>只读</em></a></h3>\n<p>一个<code>Boolean</code>类型的值指明当前渲染上下文是否启用了<code>contextIsolation</code>。 这在主进程中是<code>undefined</code>的。</p>\n<h3 id=\"processthrowdeprecation\"><a href=\"#processthrowdeprecation\"><code>process.throwDeprecation</code></a></h3>\n<p><code>Boolean</code>类型，用于控制是否将弃用警告当做例外。 设置它为 <code>true</code> 时会抛出错误。 使用此属性代替 <code>--throw-deprecation </code> 命令行标志。</p>\n<h3 id=\"processtracedeprecation\"><a href=\"#processtracedeprecation\"><code>process.traceDeprecation</code></a></h3>\n<p><code>Boolean</code>类型，用于控制打印到 <code>stderr</code> 的弃用中是否包含其堆栈跟踪。 将此设置为 <code>true</code> 将会打印对弃用的堆栈跟踪。 此属性代替 <code>--trace-deprecation</code> 命令行标志。</p>\n<h3 id=\"processtraceprocesswarnings\"><a href=\"#processtraceprocesswarnings\"><code>process.traceProcessWarnings</code></a></h3>\n<p>一个 <code>Boolean</code>, 用于控制是否将进程的警告打印到包含堆栈跟踪的 <code>stderr</code>中 。 将此设置为 <code>true</code> 将打印对进程警告的堆栈跟踪（包括弃用）。 此属性代替 <code>--trace-warnings</code> 命令行标志。</p>\n<h3 id=\"processtype-只读\"><a href=\"#processtype-只读\"><code>process.type</code> <em>只读</em></a></h3>\n<p><code>String</code> 代表当前进程的类型，可以是：</p>\n<ul>\n<li><code>browser</code> - The main process</li>\n<li><code>renderer</code> - A renderer process</li>\n<li><code>worker</code> - In a web worker</li>\n</ul>\n<h3 id=\"processversionschrome-只读\"><a href=\"#processversionschrome-只读\"><code>process.versions.chrome</code> <em>只读</em></a></h3>\n<p><code>string</code>，一个表示 Chrome 版本的字符串。</p>\n<h3 id=\"processversionselectron-只读\"><a href=\"#processversionselectron-只读\"><code>process.versions.electron</code> <em>只读</em></a></h3>\n<p><code>string</code>，一个表示 Electron 版本的字符串。</p>\n<h3 id=\"processwindowsstore-只读\"><a href=\"#processwindowsstore-只读\"><code>process.windowsStore</code> <em>只读</em></a></h3>\n<p>一个 <code>Boolean</code>。 如果应用以 Windows 商店应用(appx) 运行，该属性为<code>true</code>，否则为 <code>undefined</code>。</p>\n<h3 id=\"processcontextid-只读\"><a href=\"#processcontextid-只读\"><code>process.contextId</code> <em>只读</em></a></h3>\n<p>一个<code>字符串</code> (可选) 代表当前JavaScript 上下文中的全局唯一ID。 每个对话框都有自己的 JavaScript 上下文。 当上下文隔离被启用，被隔离的环境中也有单独的JavaScript上下文。 该属性仅在渲染进程中可用。</p>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>process</code> 对象具有以下方法:</p>\n<h3 id=\"processcrash\"><a href=\"#processcrash\"><code>process.crash()</code></a></h3>\n<p>导致当前进程崩溃的主线程。</p>\n<h3 id=\"processgetcreationtime\"><a href=\"#processgetcreationtime\"><code>process.getCreationTime()</code></a></h3>\n<p>返回 <code>Number | null</code> -从纪元开始的毫秒数，如果信息不可用则返回<code>null</code></p>\n<p>指示应用程序的创建时间。 新时代（1970-01-01 00:00:00 UTC）以来的毫秒数表示的时间。 如果无法获得进程创建时间，则返回为空。</p>\n<h3 id=\"processgetcpuusage\"><a href=\"#processgetcpuusage\"><code>process.getCPUUsage()</code></a></h3>\n<p>返回 <a href=\"/docs/api/structures/cpu-usage\"><code>CPUUsage</code></a></p>\n<h3 id=\"processgetiocounters-windows-linux\"><a href=\"#processgetiocounters-windows-linux\"><code>process.getIOCounters()</code> <em>Windows</em> <em>Linux</em></a></h3>\n<p>返回 <a href=\"/docs/api/structures/io-counters\"><code>IOCounters</code></a></p>\n<h3 id=\"processgetheapstatistics\"><a href=\"#processgetheapstatistics\"><code>process.getHeapStatistics()</code></a></h3>\n<p>返回 <code>Object</code>:</p>\n<ul>\n<li><code>totalHeapSize</code> Integer</li>\n<li><code>totalHeapSizeExecutable</code> Integer</li>\n<li><code>totalPhysicalSize</code> Integer</li>\n<li><code>totalAvailableSize</code> Integer</li>\n<li><code>usedHeapSize</code> Integer</li>\n<li><code>heapSizeLimit</code> Integer</li>\n<li><code>mallocedMemory</code> Integer</li>\n<li><code>peakMallocedMemory</code> Integer</li>\n<li><code>doesZapGarbage</code> Boolean</li>\n</ul>\n<p>返回包含 V8 堆统计的对象。 备注：所有数据值以KB为单位</p>\n<h3 id=\"processgetblinkmemoryinfo\"><a href=\"#processgetblinkmemoryinfo\"><code>process.getBlinkMemoryInfo()</code></a></h3>\n<p>返回 <code>Object</code>:</p>\n<ul>\n<li><code>allocated</code> Integer - Size of all allocated objects in Kilobytes.</li>\n<li><code>marked</code> Integer - Size of all marked objects in Kilobytes.</li>\n<li><code>total</code> Integer - Total allocated space in Kilobytes.</li>\n</ul>\n<p>返回带有Blink内存信息的对象。 可以用于调试渲染/DOM相关内存问题。 请注意，所有值都以KB为单位</p>\n<h3 id=\"processgetprocessmemoryinfo\"><a href=\"#processgetprocessmemoryinfo\"><code>process.getProcessMemoryInfo()</code></a></h3>\n<p>返回 <code>Promise&#x3C;ProcessMemoryInfo></code> - Promise成功返回 <a href=\"/docs/api/structures/process-memory-info\">PrecessMemoryInfo</a></p>\n<p>返回一个对象，提供当前进程的内存使用统计。 请注意，所有统计值都以KB为单位 这个api应该在应用程序准备就绪后被调用。</p>\n<p>Chromium 没有为macOS提供 <code>residentSet</code> 值。 因为macOS对最近未使用过的页面进行内存压缩。 结果是原始设置大小的值不是我们所期望的。 <code>私有</code> 内存更能代表在 macOS 上进程的实际预压缩内存的使用情况。</p>\n<h3 id=\"processgetsystemmemoryinfo\"><a href=\"#processgetsystemmemoryinfo\"><code>process.getSystemMemoryInfo()</code></a></h3>\n<p>返回 <code>Object</code>:</p>\n<ul>\n<li><code>total</code> Integer - 系统可用的物理内存总量(Kb)。</li>\n<li><code>free</code> Integer - 应用程序或磁盘缓存未使用的内存总量。</li>\n<li><code>swapTotal</code> Integer <em>Windows</em> <em>Linux</em> - 系统交换内存容量（单位：千字节）。</li>\n<li><code>swapFree</code> Integer <em>Windows</em> <em>Linux</em> - 系统可用交换内存大小（单位：千字节）。</li>\n</ul>\n<p>返回一个对象，提供整个系统的内存使用统计。 请注意，所有统计值都以KB为单位</p>\n<h3 id=\"processgetsystemversion\"><a href=\"#processgetsystemversion\"><code>process.getSystemVersion()</code></a></h3>\n<p>返回 <code>String</code> - 主机操作系统的版本。</p>\n<p>示例：</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> version = process.getSystemVersion()\n<span class=\"hljs-built_in\">console</span>.log(version)\n<span class=\"hljs-comment\">// On macOS -> '10.13.6'</span>\n<span class=\"hljs-comment\">// On Windows -> '10.0.17763'</span>\n<span class=\"hljs-comment\">// On Linux -> '4.15.0-45-generic'</span>\n</code></pre>\n<p><strong>注意：</strong> 它返回实际操作系统版本，而不是在 macOS 上的内核版本，不同于 <code>os.release()</code>。</p>\n<h3 id=\"processtakeheapsnapshotfilepath\"><a href=\"#processtakeheapsnapshotfilepath\"><code>process.takeHeapSnapshot(filePath)</code></a></h3>\n<ul>\n<li><code>filePath</code> String - Path to the output file.</li>\n</ul>\n<p>返回 <code>Boolean</code> - 指明快捷方式是否被成功创建。</p>\n<p>Takes a V8 heap snapshot and saves it to <code>filePath</code>.</p>\n<h3 id=\"processhang\"><a href=\"#processhang\"><code>process.hang()</code></a></h3>\n<p>导致当前进程挂起的主线程。</p>\n<h3 id=\"processsetfdlimitmaxdescriptors-macos-linux\"><a href=\"#processsetfdlimitmaxdescriptors-macos-linux\"><code>process.setFdLimit(maxDescriptors)</code> <em>macOS</em> <em>Linux</em></a></h3>\n<ul>\n<li><code>maxDescriptors</code> Integer</li>\n</ul>\n<p>将文件描述符的软限制设置为 <code>maxDescriptors</code> 或 OS 硬限制, 其中以当前进程较低的值为准。</p>",
      "title": "process",
      "description": "处理对象的扩展"
    },
    "/docs/api/structures/process-memory-info": {
      "locale": "zh-CN",
      "slug": "process-memory-info",
      "href": "/docs/api/structures/process-memory-info",
      "crowdinFileId": "256481",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/process-memory-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"processmemoryinfo-object\"><a href=\"#processmemoryinfo-object\">ProcessMemoryInfo Object</a></h1>\n<ul>\n<li><code>residentSet</code> Integer <em>Linux</em> <em>Windows</em> - The amount of memory currently pinned to actual physical RAM in Kilobytes.</li>\n<li><code>private</code> Integer - The amount of memory not shared by other processes, such as JS heap or HTML content in Kilobytes.</li>\n<li><code>shared</code> Integer - The amount of memory shared between processes, typically memory consumed by the Electron code itself in Kilobytes.</li>\n</ul>",
      "title": "ProcessMemoryInfo Object",
      "description": ""
    },
    "/docs/api/structures/process-metric": {
      "locale": "zh-CN",
      "slug": "process-metric",
      "href": "/docs/api/structures/process-metric",
      "crowdinFileId": "256483",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/process-metric.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"processmetric-object\"><a href=\"#processmetric-object\">ProcessMetric Object</a></h1>\n<ul>\n<li><code>pid</code> Integer - Process id of the process.</li>\n<li><code>type</code> String - 进程类型。 以下值之一：<ul>\n<li><code>Browser</code></li>\n<li><code>Tab</code></li>\n<li><code>Utility</code></li>\n<li><code>Zygote</code></li>\n<li><code>Sandbox helper</code></li>\n<li><code>GPU</code></li>\n<li><code>Pepper Plugin</code></li>\n<li><code>Pepper Plugin Broker</code></li>\n<li><code>Unknown</code></li>\n</ul></li>\n<li><code>serviceName</code> String (可选) - 进程的非本地化名称。</li>\n<li><code>name</code> String (可选) - 进程的名称。 功能性示例： <code>Audio Service</code>, <code>Content Decryption Module Service</code>, <code>Network Service</code>, <code>Video Capture</code>, 等等。</li>\n<li><code>cpu</code> <a href=\"/docs/api/structures/cpu-usage\">CPUUsage</a> - CPU usage of the process.</li>\n<li><code>creationTime</code> Number - Creation time for this process. The time is represented as number of milliseconds since epoch. Since the <code>pid</code> can be reused after a process dies, it is useful to use both the <code>pid</code> and the <code>creationTime</code> to uniquely identify a process.</li>\n<li><code>memory</code> <a href=\"/docs/api/structures/memory-info\">MemoryInfo</a> - Memory information for the process.</li>\n<li><code>sandboxed</code> Boolean (optional) <em>macOS</em> <em>Windows</em> - Whether the process is sandboxed on OS level.</li>\n<li><code>integrityLevel</code> String (optional) <em>Windows</em> - One of the following values:<ul>\n<li><code>untrusted</code></li>\n<li><code>low</code></li>\n<li><code>medium</code></li>\n<li><code>high</code></li>\n<li><code>unknown</code></li>\n</ul></li>\n</ul>",
      "title": "ProcessMetric Object",
      "description": ""
    },
    "/docs/tutorial/process-model": {
      "locale": "zh-CN",
      "slug": "process-model",
      "href": "/docs/tutorial/process-model",
      "crowdinFileId": "256233",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/process-model.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"流程模型\"><a href=\"#流程模型\">流程模型</a></h1>\n<p>Electron 继承了来自 Chromium 的多进程架构，这使得此框架在架构上非常相似于一个现代的网页浏览器。 在本指南中，我们将会阐述那些我们运用于 最小的 <a href=\"/docs/tutorial/quick-start\">快速启动应用</a> 中的关于 Electron 的概念性知识。</p>\n<h2 id=\"为什么不是一个单一的进程？\"><a href=\"#为什么不是一个单一的进程？\">为什么不是一个单一的进程？</a></h2>\n<p>网页浏览器是个极其复杂的应用程序。 除了显示网页内容的主要能力之外，他们还有许多次要的职责，例如：管理众多窗口 ( 或 标签页 ) 和加载第三方扩展。</p>\n<p>在早期，浏览器通常使用单个进程来处理所有这些功能。 虽然这种模式意味着您打开每个标签页的开销较少，但也同时意味着一个网站的崩溃或无响应会影响到整个浏览器。</p>\n<h2 id=\"多进程模型\"><a href=\"#多进程模型\">多进程模型</a></h2>\n<p>为了解决这个问题，Chrome 团队决定让每个标签页在自己的进程中渲染， 从而限制了一个网页上的有误或恶意代码可能导致的对整个应用程序造成的伤害。 然后用单个浏览器进程控制这些標籤頁进程，以及整个应用程序的生命周期。 下方来自 <a href=\"https://www.google.com/googlebooks/chrome/\">Chrome 漫画</a> 的图表可视化了此模型：</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/chrome-processes.png\" alt=\"Chrome的多进程架构\"></p>\n<p>Electron 应用程序的结构非常相似。 作为应用开发者，您控制着两种类型的进程：主进程和渲染器。 这些类似于上面概述的 Chrome 自己的浏览器和其渲染器进程。</p>\n<h2 id=\"主进程\"><a href=\"#主进程\">主进程</a></h2>\n<p>每个 Electron 应用都有一个单一的主进程，作为应用程序的入口点。 主进程在 Node.js 环境中运行，这意味着它具有 <code>require</code> 模块和使用所有 Node.js API 的能力。</p>\n<h3 id=\"窗口管理\"><a href=\"#窗口管理\">窗口管理</a></h3>\n<p>主进程的主要目的是使用 <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> 模块创建和管理应用程序窗口。</p>\n<p><code>BrowserWindow</code> 类的每个实例创建一个应用程序窗口，且在单独的渲染器进程中加载一个网页。 您可从主进程用 window 的 <a href=\"/docs/api/web-contents\"><code>webContent</code></a> 对象与网页内容进行交互。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> contents = win.webContents\n<span class=\"hljs-built_in\">console</span>.log(contents)\n</code></pre>\n<blockquote>\n<p>注意：渲染器进程也是为 <a href=\"/docs/tutorial/web-embeds\">web embeds</a> 而被创建的，例如 <code>BrowserView</code> 模块。 嵌入式网页内容也可访问 <code>webContents</code> 对象。</p>\n</blockquote>\n<p>由于 <code>BrowserWindow</code> 模块是一个 <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\"><code>EventEmitter</code></a>， 所以您也可以为各种用户事件 ( 例如，最小化 或 最大化您的窗口 ) 添加处理程序。</p>\n<p>当一个 <code>BrowserWindow</code> 实例被销毁时，与其相应的渲染器进程也会被终止。</p>\n<h3 id=\"应用程序生命周期\"><a href=\"#应用程序生命周期\">应用程序生命周期</a></h3>\n<p>主进程还能通过 Electron 的 <a href=\"/docs/api/app\"><code>app</code></a> 模块来控制您应用程序的生命周期。 该模块提供了一整套的事件和方法，可以使你添加自定义的应用程序行为 ( 例如：以编程方式退出您的应用程序、修改程序坞或显示关于面板 ) 。</p>\n<p>这是一个实际的例子，这个app来源于<a href=\"/docs/tutorial/quick-start#manage-your-windows-lifecycle\">快速入门指南</a>，用 <code>app</code> API 创建了一个更原生的应用程序窗口体验。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// quitting the app when no windows are open on non-macOS platforms</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h3 id=\"原生-api\"><a href=\"#原生-api\">原生 API</a></h3>\n<p>为了使 Electron 的功能不仅仅限于对网页内容的封装，主进程也添加了自定义的 API 来与用户的作业系统进行交互。 Electron 有着多种控制原生桌面功能的模块，例如菜单、对话框以及托盘图标。</p>\n<p>关于 Electron 主进程模块的完整列表，请参阅我们的 API 文档。</p>\n<h2 id=\"渲染器进程\"><a href=\"#渲染器进程\">渲染器进程</a></h2>\n<p>每个 Electron 应用都会为每个打开的 <code>BrowserWindow</code> ( 与每个网页嵌入 ) 生成一个单独的渲染器进程。 洽如其名，渲染器负责 <em>渲染</em> 网页内容。 所以实际上，运行于渲染器进程中的代码是须遵照网页标准的 (至少就目前使用的 Chromium 而言是如此) 。</p>\n<p>因此，一个浏览器窗口中的所有的用户界面和应用功能，都应与您在网页开发上使用相同的工具和规范来进行攥写。</p>\n<p>虽然解释每一个网页规范超出了本指南的范围，但您最起码要知道的是：</p>\n<ul>\n<li>以一个 HTML 文件作为渲染器进程的入口点。</li>\n<li>使用层叠样式表 (Cascading Style Sheets, CSS) 对 UI 添加样式。</li>\n<li>通过 <code>&#x3C;script></code> 元素可添加可执行的 JavaScript 代码。</li>\n</ul>\n<p>此外，这也意味着渲染器无权直接访问 <code>require</code> 或其他 Node.js API。 为了在渲染器中直接包含 NPM 模块，您必须使用与在 web 开发時相同的打包工具 (例如 <code>webpack</code> 或 <code>parcel</code>)</p>\n<blockquote>\n<p>注意：渲染器进程可以生成一个完整的 Node.js 环境以便于开发。 在过去这是默认的，但如今此功能考虑到安全问题已经被禁用。</p>\n</blockquote>\n<p>此刻，您也许会好奇，您在渲染器进程中的用户介面该如何与 Node.js 和 Electron 的原生桌面功能进行交互，如果这些功能都仅适用于主进程的话。 而事实上，确实没有直接导入 Electron 內容脚本的方法。</p>\n<h2 id=\"预加载脚本\"><a href=\"#预加载脚本\">预加载脚本</a></h2>\n<!-- Note: This guide doesn't take sandboxing into account, which might fundamentally \nchange the statements here. --> 预加载（preload）脚本包含了那些执行于渲染器进程中，且先于网页内容开始加载的代码 。 These scripts run within the renderer context, but are granted more privileges by having access to Node.js APIs.\n<p>预加载脚本可以在 <code>BrowserWindow</code> 构造方法中的 <code>webPreferences</code> 选项里被附加到主进程。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">//...</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">preload</span>: <span class=\"hljs-string\">'path/to/preload.js'</span>\n  }\n})\n<span class=\"hljs-comment\">//...</span>\n</code></pre>\n<p>由于预加载脚本与渲染器共享同一个全局 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window\"><code>Window</code></a> 接口，并且可以访问 Node.js API，因此它通过在 <code>window</code> 全局中暴露任意您的网络内容可以随后使用的 API 来增强渲染器。</p>\n<p>虽然预加载脚本与其所附加的渲染器在全局共享着一个 <code>window</code> 变数，但您并不能从中直接附加任何变数到 <code>window</code> 之中，因为 <a href=\"/docs/tutorial/context-isolation\"><code>contextIsolation</code></a> 是默认的。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.myAPI = {\n  <span class=\"hljs-attr\">desktop</span>: <span class=\"hljs-literal\">true</span>\n}\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-built_in\">window</span>.myAPI)\n<span class=\"hljs-comment\">// => undefined</span>\n</code></pre>\n<p>语境隔离（Context Isolation）意味着预加载脚本与渲染器的主要运行环境是隔离开来的，以避免泄漏任何具特权的 API 到您的网页内容代码中。</p>\n<p>取而代之，我们將使用 <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> 模块来安全地实现交互：</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">desktop</span>: <span class=\"hljs-literal\">true</span>\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-built_in\">window</span>.myAPI)\n<span class=\"hljs-comment\">// => { desktop: true }</span>\n</code></pre>\n<p>此功能对两个主要目的來說非常有用：</p>\n<ul>\n<li>通过暴露 <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> 帮手模块于渲染器中，您可以使用 进程间通讯 ( inter-process communication, IPC ) 来从渲染器触发主进程任务 ( 反之亦然 ) 。</li>\n<li>如果您正在为远程 URL 上托管的现有 web 应用开发 Electron 封裝，则您可在渲染器的 <code>window</code> 全局变量上添加自定义的属性，好在 web 客户端用上仅适用于桌面应用的设计逻辑 。</li>\n</ul>",
      "title": "流程模型",
      "description": "注意：渲染器进程也是为 web embeds 而被创建的，例如 BrowserView 模块。 嵌入式网页内容也可访问 webContents 对象。"
    },
    "/docs/api/structures/product": {
      "locale": "zh-CN",
      "slug": "product",
      "href": "/docs/api/structures/product",
      "crowdinFileId": "256485",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/product.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"product-object\"><a href=\"#product-object\">Product Object</a></h1>\n<ul>\n<li><code>productIdentifier</code> String - The string that identifies the product to the Apple App Store.</li>\n<li><code>localizedDescription</code> String - A description of the product.</li>\n<li><code>localizedTitle</code> String - The name of the product.</li>\n<li><code>contentVersion</code> String - A string that identifies the version of the content.</li>\n<li><code>contentLengths</code> Number[] - The total size of the content, in bytes.</li>\n<li><code>price</code> Number - The cost of the product in the local currency.</li>\n<li><code>formattedPrice</code> String - The locale formatted price of the product.</li>\n<li><code>currencyCode</code> String - 3 character code presenting a product's currency based on the ISO 4217 standard.</li>\n<li><code>isDownloadable</code> Boolean - A Boolean value that indicates whether the App Store has downloadable content for this product. <code>true</code> if at least one file has been associated with the product.</li>\n</ul>",
      "title": "Product Object",
      "description": ""
    },
    "/docs/tutorial/progress-bar": {
      "locale": "zh-CN",
      "slug": "progress-bar",
      "href": "/docs/tutorial/progress-bar",
      "crowdinFileId": "256235",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/progress-bar.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"taskbar-progress-bar-windows--macos\"><a href=\"#taskbar-progress-bar-windows--macos\">Taskbar Progress Bar (Windows &#x26; macOS)</a></h1>\n<h2 id=\"概览\"><a href=\"#概览\">概览</a></h2>\n<p>进度条使窗口能够向用户提供其进度信息，而无需被切换到前台。</p>\n<p>在Windows环境下，进度条被显示在任务栏按钮上。</p>\n<p>![Windows Progress Bar][<a href=\"https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png%5C\">https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png\\</a>]</p>\n<p>在MacOS环境下，进度条将被显示在dock栏图标上</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/macos-progress-bar.png\" alt=\"macOS 进度条\"></p>\n<p>在Linux系统中，Unity桌面也有相似的特性，能在Launcher上显示进度条。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/linux-progress-bar.png\" alt=\"Linux 进度条\"></p>\n<blockquote>\n<p>注意：在 Windows 上，每个窗口都可以有自己的进度条，而在 macOS 和 Linux（unity桌面）上，同一个应用程序只能有一个进度条。</p>\n</blockquote>\n<hr>\n<p>这三种环境中的进度条功能由同一个API实现：<code>BrowserWindow</code>实例下的<a href=\"/docs/api/browser-window#winsetprogressbarprogress-options\"><code>setProgressBar()</code></a>方法。 此方法以介于 <code>0</code> 和 <code>1</code> 之间的小数表示进度。 例如，如果有一个耗时很长的任务，它当前的进度是63%，那么你可以用<code>setProgressBar(0.63)</code>来显示这一进度。</p>\n<p>将参数设置为负值 (例如， <code>-1</code>) 将删除progress bar。 设定值大于 <code>1</code> 在 Windows 中将表示一个不确定的进度条 ，或在其他操作系统中显示为 100%。 一个不确定的progress bar 仍然处于活动状态，但不显示实际百分比， 并且用于当 您不知道一个操作需要多长时间才能完成的情况。</p>\n<p>参见 <a href=\"/docs/api/browser-window#winsetprogressbarprogress-options\">API documentation for more options and modes</a>。</p>\n<h2 id=\"示例\"><a href=\"#示例\">示例</a></h2>\n<p>在此示例中，我们将进度栏添加到main window中，该窗口会使用node.js的计时器实现随着时间的推移而进度增长。</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/progress-bar\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> progressInterval\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-keyword\">const</span> INCREMENT = <span class=\"hljs-number\">0.03</span>\n  <span class=\"hljs-keyword\">const</span> INTERVAL_DELAY = <span class=\"hljs-number\">100</span> <span class=\"hljs-comment\">// ms</span>\n\n  <span class=\"hljs-keyword\">let</span> c = <span class=\"hljs-number\">0</span>\n  progressInterval = setInterval(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// update progress bar to next value</span>\n    <span class=\"hljs-comment\">// values between 0 and 1 will show progress, >1 will show indeterminate or stick at 100%</span>\n    win.setProgressBar(c)\n\n    <span class=\"hljs-comment\">// increment or reset progress bar</span>\n    <span class=\"hljs-keyword\">if</span> (c &#x3C; <span class=\"hljs-number\">2</span>) c += INCREMENT\n    <span class=\"hljs-keyword\">else</span> c = <span class=\"hljs-number\">0</span>\n  }, INTERVAL_DELAY)\n}\n\napp.whenReady().then(createWindow)\n\n<span class=\"hljs-comment\">// before the app is terminated, clear both timers</span>\napp.on(<span class=\"hljs-string\">'before-quit'</span>, () => {\n  clearInterval(progressInterval)\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<p>启动 Electron 应用程序后，Dock (macOS) 或 taskbar (Windows, Unity) 应该显示一个进度条, 从零开始, 到100%到完成。 应该显示不确定的 (Windows) 或短暂的固定到100% (其他操作系统) 并然后循环。</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/dock-progress-bar.png\" alt=\"macOS dock 进度条\"></p>\n<p>对于macOS，当使用 <a href=\"https://support.apple.com/en-us/HT204100\">Mission Control</a> 时，应用程序也会显示进度条</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/mission-control-progress-bar.png\" alt=\"macOS Mission Control 进度条\"></p>",
      "title": "Taskbar Progress Bar (Windows & macOS)",
      "description": "注意：在 Windows 上，每个窗口都可以有自己的进度条，而在 macOS 和 Linux（unity桌面）上，同一个应用程序只能有一个进度条。"
    },
    "/docs/api/protocol": {
      "locale": "zh-CN",
      "slug": "protocol",
      "href": "/docs/api/protocol",
      "crowdinFileId": "256357",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/protocol.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocol\"><a href=\"#protocol\">protocol</a></h1>\n<blockquote>\n<p>注册自定义协议并拦截基于现有协议的请求。</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p>实现与 <code> file://</code> 协议具有相同效果的协议的示例:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })\n})\n</code></pre>\n<p><strong> 注意: </strong>除了指定的方法, 其他方法只能在 <code>app</code> 模块的 <code>ready</code> 事件被触发后使用。</p>\n<h2 id=\"using-protocol-with-a-custom-partition-or-session\"><a href=\"#using-protocol-with-a-custom-partition-or-session\">Using <code>protocol</code> with a custom <code>partition</code> or <code>session</code></a></h2>\n<p>A protocol is registered to a specific Electron <a href=\"/docs/api/session\"><code>session</code></a> object. If you don't specify a session, then your <code>protocol</code> will be applied to the default session that Electron uses. However, if you define a <code>partition</code> or <code>session</code> on your <code>browserWindow</code>'s <code>webPreferences</code>, then that window will use a different session and your custom protocol will not work if you just use <code>electron.protocol.XXX</code>.</p>\n<p>To have your custom protocol work in combination with a custom session, you need to register it to that session explicitly.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session, app, protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> partition = <span class=\"hljs-string\">'persist:example'</span>\n  <span class=\"hljs-keyword\">const</span> ses = session.fromPartition(partition)\n\n  ses.protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })\n\n  mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { partition } })\n})\n</code></pre>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>protocol</code> 模块具有以下方法：</p>\n<h3 id=\"protocolregisterschemesasprivilegedcustomschemes\"><a href=\"#protocolregisterschemesasprivilegedcustomschemes\"><code>protocol.registerSchemesAsPrivileged(customSchemes)</code></a></h3>\n<ul>\n<li><code>customSchemes</code> <a href=\"/docs/api/structures/custom-scheme\">CustomScheme[]</a></li>\n</ul>\n<p><strong>注意.</strong> 此方法只能在 <code>app</code> 的 <code>ready</code> 事件触发前调用，且只能调用一次</p>\n<p>Registers the <code>scheme</code> as standard, secure, bypasses content security policy for resources, allows registering ServiceWorker, supports fetch API, and streaming video/audio. Specify a privilege with the value of <code>true</code> to enable the capability.</p>\n<p>An example of registering a privileged scheme, that bypasses Content Security Policy:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nprotocol.registerSchemesAsPrivileged([\n  { <span class=\"hljs-attr\">scheme</span>: <span class=\"hljs-string\">'foo'</span>, <span class=\"hljs-attr\">privileges</span>: { <span class=\"hljs-attr\">bypassCSP</span>: <span class=\"hljs-literal\">true</span> } }\n])\n</code></pre>\n<p>标准scheme遵循 RFC 3986 所设定的 <a href=\"https://tools.ietf.org/html/rfc3986#section-3\">URI泛型语法 </a>。 例如, <code>http</code> 和 <code>https</code> 是标准协议, 而 <code>file</code> 不是。</p>\n<p>Registering a scheme as standard allows relative and absolute resources to be resolved correctly when served. 否则, 该协议将表现为 <code>file</code> 协议, 而且，这种文件协议将不能解析相对路径。</p>\n<p>例如, 当您使用自定义协议加载以下内容时，如果你不将其注册为标准scheme, 图片将不会被加载, 因为非标准scheme无法识别相对 路径:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">img</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">'test.png'</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n</code></pre>\n<p>注册一个scheme作为标准scheme将允许其通过<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/LocalFileSystem\">FileSystem 接口</a>访问文件。 否则, 渲染器将会因为该scheme，而抛出一个安全性错误。</p>\n<p>By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB, cookies) are disabled for non standard schemes. So in general if you want to register a custom protocol to replace the <code>http</code> protocol, you have to register it as a standard scheme.</p>\n<p>Protocols that use streams (http and stream protocols) should set <code>stream: true</code>. The <code>&#x3C;video></code> and <code>&#x3C;audio></code> HTML elements expect protocols to buffer their responses by default. The <code>stream</code> flag configures those elements to correctly expect streaming responses.</p>\n<h3 id=\"protocolregisterfileprotocolscheme-handler\"><a href=\"#protocolregisterfileprotocolscheme-handler\"><code>protocol.registerFileProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> 函数<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send a file as the response. The <code>handler</code> will be called with <code>request</code> and <code>callback</code> where <code>request</code> is an incoming request for the <code>scheme</code>.</p>\n<p>要处理 <code>request</code>, 应当使用文件的路径或具有 <code>path</code> 属性的对象来调用 <code>callback</code>。例如:<code>callback(filePath)</code>或 <code>callback({ path: filePath })</code>. The <code>filePath</code> must be an absolute path.</p>\n<p>By default the <code>scheme</code> is treated like <code>http:</code>, which is parsed differently from protocols that follow the \"generic URI syntax\" like <code>file:</code>.</p>\n<h3 id=\"protocolregisterbufferprotocolscheme-handler\"><a href=\"#protocolregisterbufferprotocolscheme-handler\"><code>protocol.registerBufferProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> 函数<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (Buffer | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>注册一个 <code>scheme</code> 协议, 将 <code>Buffer</code>作为响应发送</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code> should be called with either a <code>Buffer</code> object or an object that has the <code>data</code> property.</p>\n<p>示例：</p>\n<pre><code class=\"hljs language-javascript\">protocol.registerBufferProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback({ <span class=\"hljs-attr\">mimeType</span>: <span class=\"hljs-string\">'text/html'</span>, <span class=\"hljs-attr\">data</span>: Buffer.from(<span class=\"hljs-string\">'&#x3C;h5>Response&#x3C;/h5>'</span>) })\n})\n</code></pre>\n<h3 id=\"protocolregisterstringprotocolscheme-handler\"><a href=\"#protocolregisterstringprotocolscheme-handler\"><code>protocol.registerStringProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> 函数<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>注册一个 <code>scheme</code> 协议, 将 <code>String</code> 作为响应发送</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code> should be called with either a <code>String</code> or an object that has the <code>data</code> property.</p>\n<h3 id=\"protocolregisterhttpprotocolscheme-handler\"><a href=\"#protocolregisterhttpprotocolscheme-handler\"><code>protocol.registerHttpProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> 函数<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> ProtocolResponse</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>注册一个 <code>scheme</code> 协议, 将 HTTP 请求作为响应发送</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code> should be called with an object that has the <code>url</code> property.</p>\n<h3 id=\"protocolregisterstreamprotocolscheme-handler\"><a href=\"#protocolregisterstreamprotocolscheme-handler\"><code>protocol.registerStreamProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> 函数<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (ReadableStream | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send a stream as a response.</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code> should be called with either a <a href=\"https://nodejs.org/api/stream.html#stream_class_stream_readable\"><code>ReadableStream</code></a> object or an object that has the <code>data</code> property.</p>\n<p>示例：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { PassThrough } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'stream'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createStream</span> (<span class=\"hljs-params\">text</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> rv = <span class=\"hljs-keyword\">new</span> PassThrough() <span class=\"hljs-comment\">// PassThrough is also a Readable stream</span>\n  rv.push(text)\n  rv.push(<span class=\"hljs-literal\">null</span>)\n  <span class=\"hljs-keyword\">return</span> rv\n}\n\nprotocol.registerStreamProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback({\n    <span class=\"hljs-attr\">statusCode</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">headers</span>: {\n      <span class=\"hljs-string\">'content-type'</span>: <span class=\"hljs-string\">'text/html'</span>\n    },\n    <span class=\"hljs-attr\">data</span>: createStream(<span class=\"hljs-string\">'&#x3C;h5>Response&#x3C;/h5>'</span>)\n  })\n})\n</code></pre>\n<p>It is possible to pass any object that implements the readable stream API (emits <code>data</code>/<code>end</code>/<code>error</code> events). For example, here's how a file could be returned:</p>\n<pre><code class=\"hljs language-javascript\">protocol.registerStreamProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback(fs.createReadStream(<span class=\"hljs-string\">'index.html'</span>))\n})\n</code></pre>\n<h3 id=\"protocolunregisterprotocolscheme\"><a href=\"#protocolunregisterprotocolscheme\"><code>protocol.unregisterProtocol(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully unregistered</p>\n<p>取消对自定义<code>scheme</code>的注册</p>\n<h3 id=\"protocolisprotocolregisteredscheme\"><a href=\"#protocolisprotocolregisteredscheme\"><code>protocol.isProtocolRegistered(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether <code>scheme</code> is already registered.</p>\n<h3 id=\"protocolinterceptfileprotocolscheme-handler\"><a href=\"#protocolinterceptfileprotocolscheme-handler\"><code>protocol.interceptFileProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> 函数<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>终止 <code>scheme</code> 协议, 并将 <code>handler</code> 作为该protocol新的处理方式，即返回一个file。</p>\n<h3 id=\"protocolinterceptstringprotocolscheme-handler\"><a href=\"#protocolinterceptstringprotocolscheme-handler\"><code>protocol.interceptStringProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> 函数<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>终止 <code>scheme</code> 协议, 并将 <code>handler</code> 作为该protocol新的处理方式，即返回一个<code>String</code>。</p>\n<h3 id=\"protocolinterceptbufferprotocolscheme-handler\"><a href=\"#protocolinterceptbufferprotocolscheme-handler\"><code>protocol.interceptBufferProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> 函数<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (Buffer | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>终止 <code>scheme</code> 协议, 并将 <code>handler</code> 作为该protocol新的处理方式，即返回一个<code>Buffer</code>。</p>\n<h3 id=\"protocolintercepthttpprotocolscheme-handler\"><a href=\"#protocolintercepthttpprotocolscheme-handler\"><code>protocol.interceptHttpProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> 函数<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>终止 <code>scheme</code> 协议, 并将 <code>handler</code> 作为该protocol新的处理方式，即返回一个新 HTTP 请求。</p>\n<h3 id=\"protocolinterceptstreamprotocolscheme-handler\"><a href=\"#protocolinterceptstreamprotocolscheme-handler\"><code>protocol.interceptStreamProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> 函数<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (ReadableStream | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>它与 <code>registerStreamProtocol</code>方法相同, 不过它是用来替换现有的protocol处理方式。</p>\n<h3 id=\"protocoluninterceptprotocolscheme\"><a href=\"#protocoluninterceptprotocolscheme\"><code>protocol.uninterceptProtocol(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully unintercepted</p>\n<p>移除为 <code>scheme</code> 安装的拦截器，并还原其原始处理方式。</p>\n<h3 id=\"protocolisprotocolinterceptedscheme\"><a href=\"#protocolisprotocolinterceptedscheme\"><code>protocol.isProtocolIntercepted(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether <code>scheme</code> is already intercepted.</p>",
      "title": "protocol",
      "description": "注册自定义协议并拦截基于现有协议的请求。"
    },
    "/docs/api/structures/protocol-request": {
      "locale": "zh-CN",
      "slug": "protocol-request",
      "href": "/docs/api/structures/protocol-request",
      "crowdinFileId": "256487",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-request.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolrequest-object\"><a href=\"#protocolrequest-object\">ProtocolRequest Object</a></h1>\n<ul>\n<li><code>url</code> String</li>\n<li><code>referrer</code> String</li>\n<li><code>method</code> String</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/upload-data\">UploadData[]</a> (optional)</li>\n<li><code>headers</code> Record&#x3C;String, String></li>\n</ul>",
      "title": "ProtocolRequest Object",
      "description": ""
    },
    "/docs/api/structures/protocol-response": {
      "locale": "zh-CN",
      "slug": "protocol-response",
      "href": "/docs/api/structures/protocol-response",
      "crowdinFileId": "256491",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-response.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolresponse-object\"><a href=\"#protocolresponse-object\">ProtocolResponse Object</a></h1>\n<ul>\n<li><code>error</code> Integer (optional) - When assigned, the <code>request</code> will fail with the <code>error</code> number . For the available error numbers you can use, please see the <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">net error list</a>.</li>\n<li><code>statusCode</code> Number (optional) - The HTTP response code, default is 200.</li>\n<li><code>charset</code> String (optional) - The charset of response body, default is <code>\"utf-8\"</code>.</li>\n<li><code>mimeType</code> String (optional) - The MIME type of response body, default is <code>\"text/html\"</code>. Setting <code>mimeType</code> would implicitly set the <code>content-type</code> header in response, but if <code>content-type</code> is already set in <code>headers</code>, the <code>mimeType</code> would be ignored.</li>\n<li><code>headers</code> Record&#x3C;string, string | string[]> (optional) - An object containing the response headers. The keys must be String, and values must be either String or Array of String.</li>\n<li><code>data</code> (Buffer | String | ReadableStream) (optional) - The response body. When returning stream as response, this is a Node.js readable stream representing the response body. When returning <code>Buffer</code> as response, this is a <code>Buffer</code>. When returning <code>String</code> as response, this is a <code>String</code>. This is ignored for other types of responses.</li>\n<li><code>path</code> String (optional) - Path to the file which would be sent as response body. This is only used for file responses.</li>\n<li><code>url</code> String (optional) - Download the <code>url</code> and pipe the result as response body. This is only used for URL responses.</li>\n<li><code>referrer</code> String (optional) - The <code>referrer</code> URL. This is only used for file and URL responses.</li>\n<li><code>method</code> String (optional) - The HTTP <code>method</code>. This is only used for file and URL responses.</li>\n<li><code>session</code> Session (optional) - The session used for requesting URL, by default the HTTP request will reuse the current session. Setting <code>session</code> to <code>null</code> would use a random independent session. This is only used for URL responses.</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/protocol-response-upload-data\">ProtocolResponseUploadData</a> (optional) - The data used as upload data. This is only used for URL responses when <code>method</code> is <code>\"POST\"</code>.</li>\n</ul>",
      "title": "ProtocolResponse Object",
      "description": ""
    },
    "/docs/api/structures/protocol-response-upload-data": {
      "locale": "zh-CN",
      "slug": "protocol-response-upload-data",
      "href": "/docs/api/structures/protocol-response-upload-data",
      "crowdinFileId": "256489",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-response-upload-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolresponseuploaddata-object\"><a href=\"#protocolresponseuploaddata-object\">ProtocolResponseUploadData Object</a></h1>\n<ul>\n<li><code>contentType</code> String - MIME type of the content.</li>\n<li><code>data</code> String | Buffer - Content to be sent.</li>\n</ul>",
      "title": "ProtocolResponseUploadData Object",
      "description": ""
    },
    "/docs/development/pull-requests": {
      "locale": "zh-CN",
      "slug": "pull-requests",
      "href": "/docs/development/pull-requests",
      "crowdinFileId": "256163",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/pull-requests.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"合并请求\"><a href=\"#合并请求\">合并请求</a></h1>\n<ul>\n<li><a href=\"#setting-up-your-local-environment\">设置您的本地环境</a><ul>\n<li><a href=\"#step-1-fork\">步骤1: 复制</a></li>\n<li><a href=\"#step-2-build\">步骤2: 构建</a></li>\n<li><a href=\"#step-3-branch\">步骤3: 分支</a></li>\n</ul></li>\n<li><a href=\"#making-changes\">进行更改</a><ul>\n<li><a href=\"#step-4-code\">步骤4: 编写代码</a></li>\n<li><a href=\"#step-5-commit\">步骤5: 提交更改</a><ul>\n<li><a href=\"#commit-message-guidelines\">提交代码说明的指导</a></li>\n</ul></li>\n<li><a href=\"#step-6-rebase\">步骤6：变基</a></li>\n<li><a href=\"#step-7-test\">步骤7: 测试</a></li>\n<li><a href=\"#step-8-push\">步骤8: 推送代码</a></li>\n<li><a href=\"#step-9-opening-the-pull-request\">步骤9: 新建一个合并代码请求</a></li>\n<li><a href=\"#step-10-discuss-and-update\">步骤10: 讨论和更新</a><ul>\n<li><a href=\"#approval-and-request-changes-workflow\">批准和请求更改工作流程</a></li>\n</ul></li>\n<li><a href=\"#step-11-landing\">步骤11: 执行合并</a></li>\n<li><a href=\"#continuous-integration-testing\">持续集成测试</a></li>\n</ul></li>\n</ul>\n<h2 id=\"设置您的本地环境\"><a href=\"#设置您的本地环境\">设置您的本地环境</a></h2>\n<h3 id=\"步骤1-复制\"><a href=\"#步骤1-复制\">步骤1: 复制</a></h3>\n<p>在 <a href=\"https://github.com/electron/electron\">GitHub</a> 上复制项目到你的账号并把项目克隆到本地。</p>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:username/electron.git\n$ <span class=\"hljs-built_in\">cd</span> electron\n$ git remote add upstream https://github.com/electron/electron.git\n$ git fetch upstream\n</code></pre>\n<h3 id=\"步骤2-构建\"><a href=\"#步骤2-构建\">步骤2: 构建</a></h3>\n<p>根据您的操作系统, 项目构建步骤和依赖项稍有不同。 请参阅这些关于构建 Electron 项目的详细指南:</p>\n<ul>\n<li><a href=\"/docs/development/build-instructions-macos\">在 macOS 上构建</a></li>\n<li><a href=\"/docs/development/build-instructions-linux\">在 Linux 上构建</a></li>\n<li><a href=\"/docs/development/build-instructions-windows\">在 Windows 上构建</a></li>\n</ul>\n<p>一旦您在本地构建了项目, 就可以开始进行更改了!</p>\n<h3 id=\"步骤3-分支\"><a href=\"#步骤3-分支\">步骤3: 分支</a></h3>\n<p>为了保持您的开发环境的组织, 创建本地分支来保存您的工作。 These should be branched directly off of the <code>main</code> branch.</p>\n<pre><code class=\"hljs language-sh\">$ git checkout -b my-branch -t upstream/main\n</code></pre>\n<h2 id=\"进行更改\"><a href=\"#进行更改\">进行更改</a></h2>\n<h3 id=\"步骤4-编写代码\"><a href=\"#步骤4-编写代码\">步骤4: 编写代码</a></h3>\n<p>Most pull requests opened against the <code>electron/electron</code> repository include changes to either the C/C++ code in the <code>shell/</code> folder, the JavaScript code in the <code>lib/</code> folder, the documentation in <code>docs/api/</code> or tests in the <code>spec/</code> folder.</p>\n<p>请确保都运行 <code>npm run lint</code> 在任何代码更改后, 以确保它们遵循项目的代码样式。</p>\n<p>在项目的不同部分修改代码时, 有关最佳实践的更多信息, 请参见 <a href=\"/docs/development/coding-style\"> 编码样式 </a>。</p>\n<h3 id=\"步骤5-提交更改\"><a href=\"#步骤5-提交更改\">步骤5: 提交更改</a></h3>\n<p>建议将更改按逻辑分组在每个独立提交中。 其他贡献者可以从拆分多个提交中更容易的检查代码的改变。 合并请求没有限制提交的数量。</p>\n<pre><code class=\"hljs language-sh\">$ git add my/changed/files\n$ git commit\n</code></pre>\n<p>请注意, 在最后执行合并代码时多个提交通常会被合并。</p>\n<h4 id=\"提交代码说明的指导\"><a href=\"#提交代码说明的指导\">提交代码说明的指导</a></h4>\n<p>好的提交说明应描述更改的内容和原因。 Electron项目使用<a href=\"https://conventionalcommits.org/\">语义化提交信息</a>以精简发布过程。</p>\n<p>Before a pull request can be merged, it <strong>must</strong> have a pull request title with a semantic prefix.</p>\n<p>带有语义化前缀的提交信息的样例：</p>\n<ul>\n<li><code>fix: don't overwrite prevent_default if default wasn't prevented</code></li>\n<li><code>feat: add app.isPackaged() method</code></li>\n<li><code>docs: app.isDefaultProtocolClient 现在在Linux可用</code></li>\n</ul>\n<p>常见前缀：</p>\n<ul>\n<li>fix: A bug fix</li>\n<li>feat: A new feature</li>\n<li>docs: Documentation changes</li>\n<li>测试：添加缺失测试或纠正现有测试</li>\n<li>build: Changes that affect the build system</li>\n<li>ci: Changes to our CI configuration files and scripts</li>\n<li>perf: A code change that improves performance</li>\n<li>refactor: A code change that neither fixes a bug nor adds a feature</li>\n<li>style: Changes that do not affect the meaning of the code (linting)</li>\n</ul>\n<p>其他在写提交信息时需要留意的事情：</p>\n<ol>\n<li>第一行应该:<ul>\n<li>contain a short description of the change (preferably 50 characters or less, and no more than 72 characters)</li>\n<li>完全使用小写, 除了适当的名词, 缩写, 和引用代码的单词, 如函数/变量名</li>\n</ul></li>\n<li>将第二行留空。</li>\n<li>每行文字在72列处换行。</li>\n</ol>\n<h4 id=\"重大更改\"><a href=\"#重大更改\">重大更改</a></h4>\n<p>A commit that has the text <code>BREAKING CHANGE:</code> at the beginning of its optional body or footer section introduces a breaking API change (correlating with Major in semantic versioning). 一个重大更改可以是任何类型提交的一部分。 e.g., a <code>fix:</code>, <code>feat:</code> &#x26; <code>chore:</code> types would all be valid, in addition to any other type.</p>\n<p>参阅 <a href=\"https://conventionalcommits.org\">conventionalcommits.org</a> 以获得更多细节。</p>\n<h3 id=\"步骤6：变基\"><a href=\"#步骤6：变基\">步骤6：变基</a></h3>\n<p>提交更改后, 最好使用 <code>git rebase</code> (而不是 <code>git merge</code>) 将您的工作与主代码库同步。</p>\n<pre><code class=\"hljs language-sh\">$ git fetch upstream\n$ git rebase upstream/main\n</code></pre>\n<p>This ensures that your working branch has the latest changes from <code>electron/electron</code> main.</p>\n<h3 id=\"步骤7-测试\"><a href=\"#步骤7-测试\">步骤7: 测试</a></h3>\n<p>Bug 修复和功能应始终与测试一起进行。 提供了 <a href=\"/docs/development/testing\"> 测试指南 </a> 使流程更容易。 看其他测试, 看看它们应该如何结构化也会有帮助。</p>\n<p>当提交您的改变到合并代码请求前, 请始终运行完整的测试套件。 运行测试:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>请确保 linter 不报告任何问题, 并且所有测试都通过。 请不要提交失败的修补程序或检查。</p>\n<p>If you are updating tests and want to run a single spec to check it:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span> -match=menu\n</code></pre>\n<p>上述操作只运行与 <code>menu</code> 匹配的规范模块, 这对于那些在测试周期的末尾进行测试的任何人都很有用。</p>\n<h3 id=\"步骤8-推送代码\"><a href=\"#步骤8-推送代码\">步骤8: 推送代码</a></h3>\n<p>一旦您的提交准备就绪--通过测试和 linting--将您的工作分支推送到您在 GitHub 上复制的分支, 然后开始开启合并代码请求的过程。</p>\n<pre><code class=\"hljs language-sh\">$ git push origin my-branch\n</code></pre>\n<h3 id=\"步骤9-新建一个合并代码请求\"><a href=\"#步骤9-新建一个合并代码请求\">步骤9: 新建一个合并代码请求</a></h3>\n<p>从 GitHub 中, 开启一个新的合并代码请求将为您呈现一个模板，这应填写如下:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"xml\"><span class=\"hljs-comment\">&#x3C;!--\nThank you for your pull request. Please provide a description above and review\nthe requirements below.\n\nBug fixes and new features should include tests and possibly benchmarks.\n\nContributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.md\n--></span></span>\n</code></pre>\n<h3 id=\"步骤10-讨论和更新\"><a href=\"#步骤10-讨论和更新\">步骤10: 讨论和更新</a></h3>\n<p>您可能会得到反馈或请求更改您的请求。 这是提交过程的重要部分, 所以不要气馁! 有些贡献者可能会立刻签署请求。 其他人可能有详细的评论或反馈。 这是过程的必要部分, 以便评估更改是否正确和必要。</p>\n<p>要更改现有的请求, 请对本地分支进行更改, 添加新的提交, 并将这些更改推送到您的分支。 GitHub 将自动更新请求。</p>\n<pre><code class=\"hljs language-sh\">$ git add my/changed/files\n$ git commit\n$ git push origin my-branch\n</code></pre>\n<p>一些更高级的方法比如使用 <code>git rebase</code> 来管理提交是很有效的, 但这超出本指南的范围。</p>\n<p>如果您正在等待某事的答案, 请随时添加评论 ping 向审阅者。 如果您遇到的单词或缩略词似乎不熟悉, 请参阅此 <a href=\"https://sites.google.com/a/chromium.org/dev/glossary\"> 词汇表 </a>。</p>\n<h4 id=\"批准和请求更改工作流程\"><a href=\"#批准和请求更改工作流程\">批准和请求更改工作流程</a></h4>\n<p>All pull requests require approval from a <a href=\"https://github.com/electron/electron/blob/main/.github/CODEOWNERS\">Code Owner</a> of the area you modified in order to land. Whenever a maintainer reviews a pull request they may request changes. These may be small, such as fixing a typo, or may involve substantive changes. Such requests are intended to be helpful, but at times may come across as abrupt or unhelpful, especially if they do not include concrete suggestions on <em>how</em> to change them.</p>\n<p>尽量不要气馁。 如果你觉得审查是不公平的, 那么说或者寻求另一个项目参与者的投入。 通常, 这种评论是由于审阅者没有足够的时间来审查和无意的。 这样的困难往往可以用一点耐心来解决。 That said, reviewers should be expected to provide helpful feedback.</p>\n<h3 id=\"步骤11-执行合并\"><a href=\"#步骤11-执行合并\">步骤11: 执行合并</a></h3>\n<p>为了合并代码, 代码合并请求要求必须由至少一个 Electron 代码所有者审查和批准并且通过 CI。 之后, 如果没有其他参与者的异议, 请求可以合并。</p>\n<p>恭喜您, 感谢您的贡献!</p>\n<h3 id=\"持续集成测试\"><a href=\"#持续集成测试\">持续集成测试</a></h3>\n<p>每个请求都在连续集成 (CI) 系统上进行测试, 以确认它在 Electron 支持的平台上工作。</p>\n<p>理想情况下, 代码合并请求将在 CI 的所有平台上通过测试 (\"变成绿色\")。 这意味着所有测试都通过, 并且没有 linting 错误。 然而，CI 自身的基础设施在特定的平台上或者在\"不可靠\"的测试下会失败(\"变红\") 的情况并不少见。 必须手动检查每个 CI 故障以确定原因。</p>\n<p>CI starts automatically when you open a pull request, but only core maintainers can restart a CI run. If you believe CI is giving a false negative, ask a maintainer to restart the tests.</p>",
      "title": "合并请求",
      "description": ""
    },
    "/docs/tutorial/quick-start": {
      "locale": "zh-CN",
      "slug": "quick-start",
      "href": "/docs/tutorial/quick-start",
      "crowdinFileId": "256237",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/quick-start.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"快速入门\"><a href=\"#快速入门\">快速入门</a></h1>\n<p>本指南将会通过使用Electron创建一个极简的 Hello World 应用一步步的带你了解，该应用与<a href=\"https://github.com/electron/electron-quick-start\"><code>electron/electron-quick-start</code></a>类似。</p>\n<p>通过这个教程，你的app将会打开一个浏览器窗口，来展示包含当前正在运行的 Chromium, Node.js与 Electronweb等版本信息的web界面</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<p>在使用Electron进行开发之前，您需要安装 <a href=\"https://nodejs.org/en/download/\">Node.js</a>。 我们建议您使用最新的LTS版本。</p>\n<blockquote>\n<p>请使用为你平台预构建的 Node.js 安装器来进行安装， 否则，您可能会遇到与不同开发工具不兼容的问题。</p>\n</blockquote>\n<p>要检查 Node.js 是否正确安装，请在您的终端输入以下命令：</p>\n<pre><code class=\"hljs language-sh\">node -v\nnpm -v\n</code></pre>\n<p>这两个命令应输出了 Node.js 和 npm 的版本信息。</p>\n<p><strong>注意</strong> 因为 Electron 将 Node.js 嵌入到其二进制文件中，你应用运行时的 Node.js 版本与你系统中运行的 Node.js 版本无关。</p>\n<h2 id=\"创建你的应用程序\"><a href=\"#创建你的应用程序\">创建你的应用程序</a></h2>\n<h3 id=\"使用脚手架创建\"><a href=\"#使用脚手架创建\">使用脚手架创建</a></h3>\n<p>Electron 应用程序遵循与其他 Node.js 项目相同的结构。 首先创建一个文件夹并初始化 npm 包。</p>\n<pre><code class=\"hljs language-sh\">mkdir my-electron-app &#x26;&#x26; <span class=\"hljs-built_in\">cd</span> my-electron-app\nnpm init\n</code></pre>\n<p><code>init</code>初始化命令会提示您在项目初始化配置中设置一些值 为本教程的目的，有几条规则需要遵循：</p>\n<ul>\n<li><code>entry point</code> 应为 <code>main.js</code>.</li>\n<li><code>author</code> 与 <code>description</code> 可为任意值，但对于<a href=\"#package-and-distribute-your-application\">应用打包</a>是必填项。</li>\n</ul>\n<p>你的 <code>package.json</code> 文件应该像这样：</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"my-electron-app\"</span>,\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"1.0.0\"</span>,\n  <span class=\"hljs-attr\">\"description\"</span>: <span class=\"hljs-string\">\"Hello World!\"</span>,\n  <span class=\"hljs-attr\">\"main\"</span>: <span class=\"hljs-string\">\"main.js\"</span>,\n  <span class=\"hljs-attr\">\"author\"</span>: <span class=\"hljs-string\">\"Jane Doe\"</span>,\n  <span class=\"hljs-attr\">\"license\"</span>: <span class=\"hljs-string\">\"MIT\"</span>\n}\n</code></pre>\n<p>然后，将 <code>electron</code> 包安装到应用的开发依赖中。</p>\n<pre><code class=\"hljs language-sh\">$ npm install --save-dev electron\n</code></pre>\n<blockquote>\n<p>注意：如果您在安装 Electron 时遇到任何问题，请 参见 <a href=\"/docs/tutorial/installation\">高级安装</a> 指南。</p>\n</blockquote>\n<p>最后，您希望能够执行 Electron 如下所示，在您的 <a href=\"https://docs.npmjs.com/cli/v7/using-npm/scripts\"><code>package.json</code></a>配置文件中的<code>scripts</code>字段下增加一条<code>start</code>命令：</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"scripts\"</span>: {\n    <span class=\"hljs-attr\">\"start\"</span>: <span class=\"hljs-string\">\"electron .\"</span>\n  }\n}\n</code></pre>\n<p><code>start</code>命令能让您在开发模式下打开您的应用</p>\n<pre><code class=\"hljs language-sh\">npm start\n</code></pre>\n<blockquote>\n<p>注意：此脚本将告诉 Electron 在您项目根目录运行 此时，您的应用将立即抛出一个错误提示您它无法找到要运行的应用</p>\n</blockquote>\n<h3 id=\"运行主进程\"><a href=\"#运行主进程\">运行主进程</a></h3>\n<p>任何 Electron 应用程序的入口都是 <code>main</code> 文件。 这个文件控制了<strong>主进程</strong>，它运行在一个完整的Node.js环境中，负责控制您应用的生命周期，显示原生界面，执行特殊操作并管理渲染器进程(稍后详细介绍)。</p>\n<p>执行期间，Electron 将依据应用中 <code>package.json</code>配置下<a href=\"https://docs.npmjs.com/cli/v7/configuring-npm/package-json#main\"><code>main</code></a>字段中配置的值查找此文件，您应该已在<a href=\"#scaffold-the-project\">应用脚手架</a>步骤中配置。</p>\n<p>要初始化这个<code>main</code>文件，需要在您项目的根目录下创建一个名为<code>main.js</code>的空文件。</p>\n<blockquote>\n<p>注意：如果您此时再次运行<code>start</code>命令，您的应用将不再抛出任何错误！ 然而，它不会做任何事因为我们还没有在<code>main.js</code>中添加任何代码。</p>\n</blockquote>\n<h3 id=\"创建页面\"><a href=\"#创建页面\">创建页面</a></h3>\n<p>在可以为我们的应用创建窗口前，我们需要先创建加载进该窗口的内容。 在 Electron 中，每个窗口中无论是本地的HTML文件还是远程URL都可以被加载显示。</p>\n<p>此教程中，您将采用本地HTML的方式。 在您的项目根目录下创建一个名为<code>index.html</code>的文件：</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-comment\">&#x3C;!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"X-Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    We are using Node.js <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"node-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    Chromium <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"chrome-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    and Electron <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"electron-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>.\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<blockquote>\n<p>注意：在这个HTML文本中，您会发现主体文本中丢失了版本编号。 稍后我们将使用 JavaScript 动态插入它们。</p>\n</blockquote>\n<h3 id=\"在窗口中打开您的页面\"><a href=\"#在窗口中打开您的页面\">在窗口中打开您的页面</a></h3>\n<p>现在您有了一个页面，将它加载进应用窗口中。 要做到这一点，你需要 两个Electron模块：</p>\n<ul>\n<li><a href=\"/docs/api/app\"><code>app</code></a> 模块，它控制应用程序的事件生命周期。</li>\n<li><a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> 模块，它创建和管理应用程序 窗口。</li>\n</ul>\n<p>因为主进程运行着Node.js，您可以在文件头部将他们导入作为<a href=\"https://nodejs.org/docs/latest/api/modules.html#modules_modules_commonjs_modules\">公共JS</a>模块：</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>然后，添加一个<code>createWindow()</code>方法来将<code>index.html</code>加载进一个新的<code>BrowserWindow</code>实例。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n</code></pre>\n<p>接着，调用<code>createWindow()</code>函数来打开您的窗口。</p>\n<p>在 Electron 中，只有在 <code>app</code> 模块的 <a href=\"/docs/api/app#event-ready\"><code>ready</code></a> 事件被激发后才能创建浏览器窗口。 您可以通过使用 <a href=\"/docs/api/app#appwhenready\"><code>app.whenReady()</code></a> API来监听此事件。 在<code>whenReady()</code>成功后调用<code>createWindow()</code>。</p>\n<pre><code class=\"hljs language-js\">app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n})\n</code></pre>\n<blockquote>\n<p>注意：此时，您的电子应用程序应当成功 打开显示您页面的窗口！</p>\n</blockquote>\n<h3 id=\"管理窗口的生命周期\"><a href=\"#管理窗口的生命周期\">管理窗口的生命周期</a></h3>\n<p>虽然你现在可以打开一个浏览器窗口，但你还需要一些额外的模板代码使其看起来更像是各平台原生的。 应用程序窗口在每个OS下有不同的行为，Electron将在app中实现这些约定的责任交给开发者们。</p>\n<p>一般而言，你可以使用 <code>进程</code> 全局的 <a href=\"https://nodejs.org/api/process.html#process_process_platform\"><code>platform</code></a> 属性来专门为某些操作系统运行代码。</p>\n<h4 id=\"关闭所有窗口时退出应用-windows--linux\"><a href=\"#关闭所有窗口时退出应用-windows--linux\">关闭所有窗口时退出应用 (Windows &#x26; Linux)</a></h4>\n<p>在Windows和Linux上，关闭所有窗口通常会完全退出一个应用程序。</p>\n<p>To implement this, listen for the <code>app</code> module's <a href=\"/docs/api/app#event-window-all-closed\"><code>'window-all-closed'</code></a> event, and call <a href=\"/docs/api/app#appquit\"><code>app.quit()</code></a> if the user is not on macOS (<code>darwin</code>).</p>\n<pre><code class=\"hljs language-js\">app.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h4 id=\"如果没有窗口打开则打开一个窗口-macos\"><a href=\"#如果没有窗口打开则打开一个窗口-macos\">如果没有窗口打开则打开一个窗口 (macOS)</a></h4>\n<p>当 Linux 和 Windows 应用在没有窗口打开时退出了，macOS 应用通常即使在没有打开任何窗口的情况下也继续运行，并且在没有窗口可用的情况下激活应用时会打开新的窗口。</p>\n<p>To implement this feature, listen for the <code>app</code> module's <a href=\"/docs/api/app#event-activate-macos\"><code>activate</code></a> event, and call your existing <code>createWindow()</code> method if no browser windows are open.</p>\n<p>因为窗口无法在 <code>ready</code> 事件前创建，你应当在你的应用初始化后仅监听 <code>activate</code> 事件。 通过在您现有的 <code>whenReady()</code> 回调中附上您的事件监听器来完成这个操作。</p>\n<pre><code class=\"hljs language-js\">app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) createWindow()\n  })\n})\n</code></pre>\n<blockquote>\n<p>注意：此时，您的窗口控件应功能齐全！</p>\n</blockquote>\n<h3 id=\"通过预加载脚本从渲染器访问nodejs。\"><a href=\"#通过预加载脚本从渲染器访问nodejs。\">通过预加载脚本从渲染器访问Node.js。</a></h3>\n<p>现在，最后要做的是输出Electron的版本号和它的依赖项到你的web页面上。</p>\n<p>在主进程通过Node的全局 <code>process</code> 对象访问这个信息是微不足道的。 然而，你不能直接在主进程中编辑DOM，因为它无法访问渲染器 <code>文档</code> 上下文。 它们存在于完全不同的进程！</p>\n<blockquote>\n<p>Note: If you need a more in-depth look at Electron processes, see the <a href=\"/docs/tutorial/process-model\">Process Model</a> document.</p>\n</blockquote>\n<p>这是将 <strong>预加载</strong> 脚本连接到渲染器时派上用场的地方。 预加载脚本在渲染器进程加载之前加载，并有权访问两个 渲染器全局 (例如 <code>window</code> 和 <code>document</code>) 和 Node.js 环境。</p>\n<p>创建一个名为 <code>preload.js</code> 的新脚本如下：</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'DOMContentLoaded'</span>, () => {\n  <span class=\"hljs-keyword\">const</span> replaceText = <span class=\"hljs-function\">(<span class=\"hljs-params\">selector, text</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> element = <span class=\"hljs-built_in\">document</span>.getElementById(selector)\n    <span class=\"hljs-keyword\">if</span> (element) element.innerText = text\n  }\n\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> dependency <span class=\"hljs-keyword\">of</span> [<span class=\"hljs-string\">'chrome'</span>, <span class=\"hljs-string\">'node'</span>, <span class=\"hljs-string\">'electron'</span>]) {\n    replaceText(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${dependency}</span>-version`</span>, process.versions[dependency])\n  }\n})\n</code></pre>\n<p>上面的代码访问 Node.js <code>process.versions</code> 对象，并运行一个基本的 <code>replaceText</code> 辅助函数将版本号插入到 HTML 文档中。</p>\n<p>要将此脚本附加到渲染器流程，请在你现有的 <code>BrowserWindow</code> 构造器中将路径中的预加载脚本传入 <code>webPreferences.preload</code> 选项。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 在文件头部引入 Node.js 中的 path 模块</span>\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-comment\">// 修改现有的 createWindow() 函数</span>\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n<span class=\"hljs-comment\">// ...</span>\n</code></pre>\n<p>这里使用了两个Node.js概念：</p>\n<ul>\n<li>The <a href=\"https://nodejs.org/api/modules.html#modules_dirname\"><code>__dirname</code></a> string points to the path of the currently executing script (in this case, your project's root folder).</li>\n<li>The <a href=\"https://nodejs.org/api/path.html#path_path_join_paths\"><code>path.join</code></a> API joins multiple path segments together, creating a combined path string that works across all platforms.</li>\n</ul>\n<p>我们使用一个相对当前正在执行JavaScript文件的路径，这样您的相对路径将在开发模式和打包模式中都将有效。</p>\n<h3 id=\"额外：将功能添加到您的网页内容\"><a href=\"#额外：将功能添加到您的网页内容\">额外：将功能添加到您的网页内容</a></h3>\n<p>此刻，您可能想知道如何为您的应用程序添加更多功能。</p>\n<p>对于与您的网页内容的任何交互，您想要将脚本添加到您的渲染器进程中。 由于渲染器运行在正常的 Web 环境中，因此您可以在 <code>index.html</code> 文件关闭 <code>&#x3C;/body></code> 标签之前添加一个 <code>&#x3C;script></code> 标签，来包括您想要的任意脚本：</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"./renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<p>The code contained in <code>renderer.js</code> can then use the same JavaScript APIs and tooling you use for typical front-end development, such as using <a href=\"https://webpack.js.org\"><code>webpack</code></a> to bundle and minify your code or <a href=\"https://reactjs.org\">React</a> to manage your user interfaces.</p>\n<h3 id=\"回顾\"><a href=\"#回顾\">回顾</a></h3>\n<p>完成上述步骤后，您应该有一个功能齐全的Electron程序，如下所示：</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/simplest-electron-app.png\" alt=\"最简的 Electron 应用程序\"></p>\n<!--TODO(erickzhao): Remove the individual code blocks for static website -->\n<p>完整代码如下：</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\n\n<span class=\"hljs-comment\">// Modules to control application life and create native browser window</span>\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-comment\">// Create the browser window.</span>\n  <span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  <span class=\"hljs-comment\">// and load the index.html of the app.</span>\n  mainWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-comment\">// Open the DevTools.</span>\n  <span class=\"hljs-comment\">// mainWindow.webContents.openDevTools()</span>\n}\n\n<span class=\"hljs-comment\">// This method will be called when Electron has finished</span>\n<span class=\"hljs-comment\">// initialization and is ready to create browser windows.</span>\n<span class=\"hljs-comment\">// 部分 API 在 ready 事件触发后才能使用。</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n    <span class=\"hljs-comment\">// On macOS it's common to re-create a window in the app when the</span>\n    <span class=\"hljs-comment\">// dock icon is clicked and there are no other windows open.</span>\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) createWindow()\n  })\n})\n\n<span class=\"hljs-comment\">// Quit when all windows are closed, except on macOS. There, it's common</span>\n<span class=\"hljs-comment\">// for applications and their menu bar to stay active until the user quits</span>\n<span class=\"hljs-comment\">// explicitly with Cmd + Q.</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n\n<span class=\"hljs-comment\">// In this file you can include the rest of your app's specific main process</span>\n<span class=\"hljs-comment\">// code. 也可以拆分成几个文件，然后用 require 导入。</span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// preload.js</span>\n\n<span class=\"hljs-comment\">// All of the Node.js APIs are available in the preload process.</span>\n<span class=\"hljs-comment\">// 它拥有与Chrome扩展一样的沙盒。</span>\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'DOMContentLoaded'</span>, () => {\n  <span class=\"hljs-keyword\">const</span> replaceText = <span class=\"hljs-function\">(<span class=\"hljs-params\">selector, text</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> element = <span class=\"hljs-built_in\">document</span>.getElementById(selector)\n    <span class=\"hljs-keyword\">if</span> (element) element.innerText = text\n  }\n\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> dependency <span class=\"hljs-keyword\">of</span> [<span class=\"hljs-string\">'chrome'</span>, <span class=\"hljs-string\">'node'</span>, <span class=\"hljs-string\">'electron'</span>]) {\n    replaceText(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${dependency}</span>-version`</span>, process.versions[dependency])\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!--index.html--></span>\n\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-comment\">&#x3C;!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"X-Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    We are using Node.js <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"node-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    Chromium <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"chrome-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    and Electron <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"electron-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>.\n\n    <span class=\"hljs-comment\">&#x3C;!-- You can also require other files to run in this process --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"./renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>总结我们所做的所有步骤：</p>\n<p>*我们启动了一个Node.js程序，并将Electron添加为依赖。</p>\n<ul>\n<li>\n<p>We created a <code>main.js</code> script that runs our main process, which controls our app\nand runs in a Node.js environment. 在此脚本中， 我们使用 Electron 的 <code>app</code> 和  <code>BrowserWindow</code> 模块来创建一个浏览器窗口，在一个单独的进程(渲染器)中显示网页内容。</p>\n</li>\n<li>\n<p>为了访问渲染器中的Node.js的某些功能，我们在 <code>BrowserWindow</code> 的构造函数上附加了一个预加载脚本。</p>\n</li>\n</ul>\n<h2 id=\"打包并分发您的应用程序\"><a href=\"#打包并分发您的应用程序\">打包并分发您的应用程序</a></h2>\n<p>最快捷的打包方式是使用 <a href=\"https://www.electronforge.io\">Electron Forge</a>。</p>\n<ol>\n<li>\n<p>将 Electron Forge 添加到您应用的开发依赖中，并使用其\"import\"命令设置 Forge 的脚手架：</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev @electron-forge/cli\nnpx electron-forge import\n\n✔ Checking your system\n✔ Initializing Git Repository\n✔ Writing modified package.json file\n✔ Installing dependencies\n✔ Writing modified package.json file\n✔ Fixing .gitignore\n\nWe have ATTEMPTED to convert your app to be <span class=\"hljs-keyword\">in</span> a format that electron-forge understands.\n\nThanks <span class=\"hljs-keyword\">for</span> using <span class=\"hljs-string\">\"electron-forge\"</span>!!!\n</code></pre>\n</li>\n<li>\n<p>使用 Forge 的 <code>make</code> 命令来创建可分发的应用程序：</p>\n<pre><code class=\"hljs language-sh\">npm run make\n\n> my-electron-app@1.0.0 make /my-electron-app\n> electron-forge make\n\n✔ Checking your system\n✔ Resolving Forge Config\nWe need to package your application before we can make it\n✔ Preparing to Package Application <span class=\"hljs-keyword\">for</span> arch: x64\n✔ Preparing native dependencies\n✔ Packaging Application\nMaking <span class=\"hljs-keyword\">for</span> the following targets: zip\n✔ Making <span class=\"hljs-keyword\">for</span> target: zip - On platform: darwin - For arch: x64\n</code></pre>\n<p>Electron Forge creates the <code>out</code> folder where your package will be located:</p>\n<pre><code class=\"hljs language-plain\">// Example for macOS\nout/\n├── out/make/zip/darwin/x64/my-electron-app-darwin-x64-1.0.0.zip\n├── ...\n└── out/my-electron-app-darwin-x64/my-electron-app.app/Contents/MacOS/my-electron-app\n</code></pre>\n</li>\n</ol>",
      "title": "快速入门",
      "description": "请使用为你平台预构建的 Node.js 安装器来进行安装， 否则，您可能会遇到与不同开发工具不兼容的问题。"
    },
    "/docs/README": {
      "locale": "zh-CN",
      "slug": "README",
      "href": "/docs/README",
      "crowdinFileId": "256115",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/README.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"官方指南\"><a href=\"#官方指南\">官方指南</a></h1>\n<p>请确认你所使用的文档与你的 Electron 版本匹配。 版本号应该是页面URL的一部分。 如果没有，你可能正在使用开发版本分支里的文档，这个分支可能包含了一些与你的 Electron 版本不兼容的 API。 如果想要访问旧版本的文档，你可以<a href=\"https://github.com/electron/electron/tree/v1.4.0\">浏览标签</a>： 通过在 GitHub 中打开下拉菜单“Switch branches/tags”中选择与你的版本匹配的分支。</p>\n<h2 id=\"常见问题-faq\"><a href=\"#常见问题-faq\">常见问题 (FAQ)</a></h2>\n<p>有些问题经常被问到。 在新建问题之前请先查看：</p>\n<ul>\n<li><a href=\"/docs/faq\">Electron 常见问题 (FAQ)</a></li>\n</ul>\n<h2 id=\"指南和教程\"><a href=\"#指南和教程\">指南和教程</a></h2>\n<h3 id=\"入门指南\"><a href=\"#入门指南\">入门指南</a></h3>\n<ul>\n<li><a href=\"/docs/tutorial/introduction\">简介</a></li>\n<li><a href=\"/docs/tutorial/quick-start\">快速入门</a></li>\n<li><a href=\"/docs/tutorial/process-model\">流程模型</a></li>\n</ul>\n<h3 id=\"learning-the-basics\"><a href=\"#learning-the-basics\">Learning the basics</a></h3>\n<ul>\n<li>为你的应用添加功能<ul>\n<li><a href=\"/docs/tutorial/notifications\">通知（Notifications）</a></li>\n<li><a href=\"/docs/tutorial/recent-documents\">最近的文件</a></li>\n<li><a href=\"/docs/tutorial/progress-bar\">应用程序进程</a></li>\n<li><a href=\"/docs/tutorial/macos-dock\">自定义 Dock 菜单</a></li>\n<li><a href=\"/docs/tutorial/windows-taskbar\">自定义 Windows 任务栏</a></li>\n<li><a href=\"/docs/tutorial/linux-desktop-actions\">自定义 Linux 桌面动作</a></li>\n<li><a href=\"/docs/tutorial/keyboard-shortcuts\">键盘快捷键</a></li>\n<li><a href=\"/docs/tutorial/online-offline-events\">离线/在线 侦测</a></li>\n<li><a href=\"/docs/tutorial/represented-file\">针对 macOS 系统 BrowserWindows 的展示文件</a></li>\n<li><a href=\"/docs/tutorial/native-file-drag-drop\">原生文件拖 &#x26; 放</a></li>\n<li><a href=\"/docs/tutorial/offscreen-rendering\">离屏渲染</a></li>\n<li><a href=\"/docs/tutorial/dark-mode\">Dark Mode</a></li>\n<li><a href=\"/docs/tutorial/web-embeds\">语言</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis\">模板和命令行界面</a><ul>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#boilerplate-vs-cli\">模板与命令行界面</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-forge\">electron-forge</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-builder\">electron-builder</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-react-boilerplate\">electron-react-boilerplate</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#other-tools-and-boilerplates\">其它工具和模板</a></li>\n</ul></li>\n</ul>\n<h3 id=\"advanced-steps\"><a href=\"#advanced-steps\">Advanced steps</a></h3>\n<ul>\n<li>应用架构<ul>\n<li><a href=\"/docs/tutorial/using-native-node-modules\">使用原生 Node.js 模块</a></li>\n<li><a href=\"/docs/tutorial/performance\">性能策略</a></li>\n<li><a href=\"/docs/tutorial/security\">Security Strategies</a></li>\n<li><a href=\"/docs/tutorial/sandbox\">进程沙盒化</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/accessibility\">辅助功能</a><ul>\n<li><a href=\"/docs/tutorial/accessibility#manually-enabling-accessibility-features\">Manually Enabling Accessibility Features</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/application-debugging\">测试和调试</a><ul>\n<li><a href=\"/docs/tutorial/debugging-main-process\">调试主进程</a></li>\n<li><a href=\"/docs/tutorial/debugging-vscode\">使用Visual Studio Code调试</a></li>\n<li><a href=\"/docs/tutorial/using-selenium-and-webdriver\">使用 Selenium 和 WebDriver</a></li>\n<li><a href=\"/docs/tutorial/testing-on-headless-ci\">使用自动化持续集成系统 (CI) 进行测试 (Travis, Jenkins)</a></li>\n<li><a href=\"/docs/tutorial/devtools-extension\">开发者工具扩展</a></li>\n<li><a href=\"/docs/tutorial/automated-testing-with-a-custom-driver\">使用自定义驱动程序进行自动化测试</a></li>\n<li><a href=\"/docs/tutorial/repl\">交互式解释器 (REPL)</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/application-distribution\">分发</a><ul>\n<li><a href=\"/docs/tutorial/support#supported-platforms\">支持平台</a></li>\n<li><a href=\"/docs/tutorial/code-signing\">代码签名</a></li>\n<li><a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac 应用程序商店</a></li>\n<li><a href=\"/docs/tutorial/windows-store-guide\">Windows 应用商店</a></li>\n<li><a href=\"/docs/tutorial/snapcraft\">Snapcraft</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/updates\">更新</a><ul>\n<li><a href=\"/docs/tutorial/updates#deploying-an-update-server\">部署更新服务器</a></li>\n<li><a href=\"/docs/tutorial/updates#implementing-updates-in-your-app\">在你的应用中实施更新</a></li>\n<li><a href=\"/docs/tutorial/updates#applying-updates\">应用更新</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/support\">获得支持</a></li>\n</ul>\n<h2 id=\"详细教程\"><a href=\"#详细教程\">详细教程</a></h2>\n<p>这些独立教程扩展了上面指南中所讨论的主题。</p>\n<ul>\n<li><a href=\"/docs/tutorial/installation\">安装 Electron</a><ul>\n<li><a href=\"/docs/tutorial/installation#proxies\">代理</a></li>\n<li><a href=\"/docs/tutorial/installation#custom-mirrors-and-caches\">自定义镜像和缓存</a></li>\n<li><a href=\"/docs/tutorial/installation#troubleshooting\">故障排查</a></li>\n</ul></li>\n<li>Electron发布 &#x26; 开发者反馈<ul>\n<li><a href=\"/docs/tutorial/electron-versioning\">版本规则</a></li>\n<li><a href=\"/docs/tutorial/electron-timelines\">发布时间线</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/testing-widevine-cdm\">测试 Widevine CDM</a></li>\n</ul>\n<hr>\n<ul>\n<li><a href=\"/docs/glossary\">术语表</a></li>\n</ul>\n<h2 id=\"api-参考\"><a href=\"#api-参考\">API 参考</a></h2>\n<ul>\n<li><a href=\"/docs/api/synopsis\">简介</a></li>\n<li><a href=\"/docs/api/process\">进程对象</a></li>\n<li><a href=\"/docs/api/command-line-switches\">支持的命令行开关</a></li>\n<li><a href=\"/docs/api/environment-variables\">环境变量</a></li>\n<li><a href=\"/docs/api/extensions\">Chrome 扩展支持</a></li>\n<li><a href=\"/docs/breaking-changes\">重要的API变更</a></li>\n</ul>\n<h3 id=\"自定义-dom-元素\"><a href=\"#自定义-dom-元素\">自定义 DOM 元素:</a></h3>\n<ul>\n<li><a href=\"/docs/api/file-object\"><code>File</code> 对象</a></li>\n<li><a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code>标签</a></li>\n<li><a href=\"/docs/api/window-open\"><code>window.open</code> 函数</a></li>\n<li><a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProProxy</code> 对象</a></li>\n</ul>\n<h3 id=\"主进程可用的模块\"><a href=\"#主进程可用的模块\">主进程可用的模块:</a></h3>\n<ul>\n<li><a href=\"/docs/api/app\">app</a></li>\n<li><a href=\"/docs/api/auto-updater\">autoUpdater</a></li>\n<li><a href=\"/docs/api/browser-view\">BrowserView</a></li>\n<li><a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n<li><a href=\"/docs/api/content-tracing\">contentTracing</a></li>\n<li><a href=\"/docs/api/dialog\">dialog</a></li>\n<li><a href=\"/docs/api/global-shortcut\">globalShortcut</a></li>\n<li><a href=\"/docs/api/in-app-purchase\">inAppPurchase</a></li>\n<li><a href=\"/docs/api/ipc-main\">ipcMain</a></li>\n<li><a href=\"/docs/api/menu\">Menu</a></li>\n<li><a href=\"/docs/api/menu-item\">MenuItem</a></li>\n<li><a href=\"/docs/api/message-channel-main\">MessageChannelMain</a></li>\n<li><a href=\"/docs/api/message-port-main\">MessagePortMain</a></li>\n<li><a href=\"/docs/api/net\">net</a></li>\n<li><a href=\"/docs/api/net-log\">netLog</a></li>\n<li><a href=\"/docs/api/native-theme\">nativeTheme</a></li>\n<li><a href=\"/docs/api/notification\">通知</a></li>\n<li><a href=\"/docs/api/power-monitor\">powerMonitor</a></li>\n<li><a href=\"/docs/api/power-save-blocker\">powerSaveBlocker</a></li>\n<li><a href=\"/docs/api/protocol\">protocol</a></li>\n<li><a href=\"/docs/api/screen\">screen</a></li>\n<li><a href=\"/docs/api/session\">session</a></li>\n<li><a href=\"/docs/api/share-menu\">ShareMenu</a></li>\n<li><a href=\"/docs/api/system-preferences\">systemPreferences</a></li>\n<li><a href=\"/docs/api/touch-bar\">触控板</a></li>\n<li><a href=\"/docs/api/tray\">Tray</a></li>\n<li><a href=\"/docs/api/web-contents\">webContents</a></li>\n<li><a href=\"/docs/api/web-frame-main\">webFrameMain</a></li>\n</ul>\n<h3 id=\"渲染进程（网页）可用的模块\"><a href=\"#渲染进程（网页）可用的模块\">渲染进程（网页）可用的模块:</a></h3>\n<ul>\n<li><a href=\"/docs/api/context-bridge\">contextBridge</a></li>\n<li><a href=\"/docs/api/ipc-renderer\">ipcRenderer</a></li>\n<li><a href=\"/docs/api/web-frame\">webFrame</a></li>\n</ul>\n<h3 id=\"两种进程都可用的模块\"><a href=\"#两种进程都可用的模块\">两种进程都可用的模块:</a></h3>\n<ul>\n<li><a href=\"/docs/api/clipboard\">clipboard</a></li>\n<li><a href=\"/docs/api/crash-reporter\">crashReporter</a></li>\n<li><a href=\"/docs/api/desktop-capturer\">desktopCapturer</a></li>\n<li><a href=\"/docs/api/native-image\">nativeImage</a></li>\n<li><a href=\"/docs/api/shell\">shell</a></li>\n</ul>\n<h2 id=\"开发\"><a href=\"#开发\">开发</a></h2>\n<p>请查看<a href=\"/docs/development/README\">development/README.md</a></p>",
      "title": "官方指南",
      "description": ""
    },
    "/docs/development/README": {
      "locale": "zh-CN",
      "slug": "README",
      "href": "/docs/development/README",
      "crowdinFileId": "256127",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/README.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"对-electron-进行开发\"><a href=\"#对-electron-进行开发\">对 Electron 进行开发</a></h1>\n<p>这些指南是为希望修改 Electron 自身的人准备的。 有关使用 Electron 来开发应用程序的指南，请参见<a href=\"/docs/README#guides-and-tutorials\">/docs/README.md</a>。</p>\n<ul>\n<li><a href=\"https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md\">行为准则</a></li>\n<li><a href=\"https://github.com/electron/electron/blob/main/CONTRIBUTING.md\">贡献到 Electron</a></li>\n<li><a href=\"/docs/development/issues\">问题</a></li>\n<li><a href=\"/docs/development/pull-requests\">合并请求</a></li>\n<li><a href=\"/docs/development/coding-style#documentation\">文档风格指南</a></li>\n<li><a href=\"/docs/development/source-code-directory-structure\">源码目录结构</a></li>\n<li><a href=\"/docs/development/coding-style\">编码风格</a></li>\n<li><a href=\"/docs/development/clang-format\">在 C++ 代码中使用 clang-format 工具</a></li>\n<li><a href=\"/docs/development/clang-tidy\">在 C++ 代码中使用clang-tidy</a></li>\n<li><a href=\"/docs/development/build-system-overview\">构建系统概览</a></li>\n<li><a href=\"/docs/development/build-instructions-macos\">构建步骤（macOS）</a></li>\n<li><a href=\"/docs/development/build-instructions-windows\">构建步骤（Windows）</a></li>\n<li><a href=\"/docs/development/build-instructions-linux\">构建步骤（Linux）</a></li>\n<li><a href=\"/docs/development/chromium-development\">Chromium 开发</a></li>\n<li><a href=\"/docs/development/v8-development\">V8 开发</a></li>\n<li><a href=\"/docs/development/testing\">测试</a></li>\n<li><a href=\"/docs/development/debug-instructions-windows\">在 Windows 中调试</a></li>\n<li><a href=\"/docs/development/debugging-instructions-macos\">在 macOS 中调试</a></li>\n<li><a href=\"/docs/development/setting-up-symbol-server\">在调试器中设置 Symbol 服务器</a></li>\n<li><a href=\"/docs/development/patches\">补丁</a></li>\n</ul>",
      "title": "对 Electron 进行开发",
      "description": ""
    },
    "/docs/tutorial/recent-documents": {
      "locale": "zh-CN",
      "slug": "recent-documents",
      "href": "/docs/tutorial/recent-documents",
      "crowdinFileId": "256239",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/recent-documents.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"最近文档-windows--macos\"><a href=\"#最近文档-windows--macos\">最近文档 (Windows &#x26; macOS)</a></h1>\n<h2 id=\"概览\"><a href=\"#概览\">概览</a></h2>\n<p>Windows 和 macOS 分别通过打开跳转列表和dock菜单使应用程序能够快速的访问最近打开的文档列表。</p>\n<p><strong>JumpList:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/2289/23446924/11a27b98-fdfc-11e6-8485-cc3b1e86b80a.png\" alt=\"跳转列表最近的文件\"></p>\n<p><strong>应用 dock 菜单</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5069610/2aa80758-6e97-11e4-8cfb-c1a414a10774.png\" alt=\"macOS Dock 菜单\"></p>\n<h2 id=\"示例\"><a href=\"#示例\">示例</a></h2>\n<h3 id=\"管理最近的文档\"><a href=\"#管理最近的文档\">管理最近的文档</a></h3>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/recent-documents\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\n<span class=\"hljs-keyword\">const</span> fileName = <span class=\"hljs-string\">'recently-used.md'</span>\nfs.writeFile(fileName, <span class=\"hljs-string\">'Lorem Ipsum'</span>, () => {\n  app.addRecentDocument(path.join(__dirname, fileName))\n})\n</code></pre>\n<h4 id=\"添加最近的文档\"><a href=\"#添加最近的文档\">添加最近的文档</a></h4>\n<p>若要增加一个文件到最近文件列表，你可以使用<a href=\"/docs/api/app#appaddrecentdocumentpath-macos-windows\">app.addRecentDocument</a> API.</p>\n<p>After launching the Electron application, right click the application icon. 在本指南中，本项是位于项目根目录下的 Markdown 文件： 您应该可以看到添加到最近文件列表中的 <code>recently-used.md</code> ：</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/recent-documents.png\" alt=\"最近的文档\"></p>\n<h4 id=\"清除最近文档列表\"><a href=\"#清除最近文档列表\">清除最近文档列表</a></h4>\n<p>若要清空最近文件列表，你可以使用<a href=\"/docs/api/app#appclearrecentdocuments-macos-windows\">app.clearRecentDocuments</a> API. 在此指南中，一旦所有窗口都关闭，文件列表就会被清除。</p>\n<h2 id=\"additional-information\"><a href=\"#additional-information\">Additional information</a></h2>\n<h3 id=\"windows-注意事项\"><a href=\"#windows-注意事项\">Windows 注意事项</a></h3>\n<p>若要在 Windows 上使用此功能，您的应用程序必须注册为这类文件的处理程序。 否则，文件将不会在跳转列表中出现。 你可以在 <a href=\"https://msdn.microsoft.com/en-us/library/cc144104(VS.85).aspx\">Application Registration</a> 里找到所有关于注册事宜的说明。</p>\n<p>当用户点击“跳转列表”上的一个文件时，系统会启动一个新的应用程序的实例 ，而文件的路径将作为一个命令行参数被传入这个实例。</p>\n<h3 id=\"macos-注意事项\"><a href=\"#macos-注意事项\">macOS 注意事项</a></h3>\n<h4 id=\"将最近文档列表添加到应用程序菜单\"><a href=\"#将最近文档列表添加到应用程序菜单\">将\"最近文档列表\"添加到应用程序菜单</a></h4>\n<p>您可以添加菜单项以访问和清除最近的文档，方法是在菜单模板中添加以下代码片段：</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"submenu\"</span>:[\n    {\n      <span class=\"hljs-attr\">\"label\"</span>:<span class=\"hljs-string\">\"Open Recent\"</span>,\n      <span class=\"hljs-attr\">\"role\"</span>:<span class=\"hljs-string\">\"recentdocuments\"</span>,\n      <span class=\"hljs-attr\">\"submenu\"</span>:[\n        {\n          <span class=\"hljs-attr\">\"label\"</span>:<span class=\"hljs-string\">\"Clear Recent\"</span>,\n          <span class=\"hljs-attr\">\"role\"</span>:<span class=\"hljs-string\">\"clearrecentdocuments\"</span>\n        }\n      ]\n    }\n  ]\n}\n</code></pre>\n<p>请确保在 <a href=\"/docs/api/app#event-ready\"><code>'ready'</code></a>事件后添加应用菜单而不是之前，否则菜单项将被禁用：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> template = [\n  <span class=\"hljs-comment\">// 这里是菜单模版</span>\n]\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  Menu.setApplicationMenu(menu)\n})\n</code></pre>\n<p><img src=\"https://user-images.githubusercontent.com/3168941/33003655-ea601c3a-cd70-11e7-97fa-7c062149cfb1.png\" alt=\"macOS 最近文档菜单项\"></p>\n<p>从 \"最近文档\" 菜单中请求文件时, 将为其发出 <code>app</code> 模块的 <code>open-file</code> 事件。</p>",
      "title": "最近文档 (Windows & macOS)",
      "description": ""
    },
    "/docs/api/structures/rectangle": {
      "locale": "zh-CN",
      "slug": "rectangle",
      "href": "/docs/api/structures/rectangle",
      "crowdinFileId": "256493",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/rectangle.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"rectangle-object\"><a href=\"#rectangle-object\">Rectangle Object</a></h1>\n<ul>\n<li><code>x</code> Number - The x coordinate of the origin of the rectangle (must be an integer).</li>\n<li><code>y</code> Number - The y coordinate of the origin of the rectangle (must be an integer).</li>\n<li><code>width</code> Number - The width of the rectangle (must be an integer).</li>\n<li><code>height</code> Number - The height of the rectangle (must be an integer).</li>\n</ul>",
      "title": "Rectangle Object",
      "description": ""
    },
    "/docs/api/structures/referrer": {
      "locale": "zh-CN",
      "slug": "referrer",
      "href": "/docs/api/structures/referrer",
      "crowdinFileId": "256495",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/referrer.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"referrer-object\"><a href=\"#referrer-object\">Referrer Object</a></h1>\n<ul>\n<li><code>url</code> String - HTTP Referrer URL.</li>\n<li><code>policy</code> String - Can be <code>default</code>, <code>unsafe-url</code>, <code>no-referrer-when-downgrade</code>, <code>no-referrer</code>, <code>origin</code>, <code>strict-origin-when-cross-origin</code>, <code>same-origin</code> or <code>strict-origin</code>. See the <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy\">Referrer-Policy spec</a> for more details on the meaning of these values.</li>\n</ul>",
      "title": "Referrer Object",
      "description": ""
    },
    "/docs/tutorial/repl": {
      "locale": "zh-CN",
      "slug": "repl",
      "href": "/docs/tutorial/repl",
      "crowdinFileId": "256241",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/repl.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"交互式解释器-repl\"><a href=\"#交互式解释器-repl\">交互式解释器 (REPL)</a></h1>\n<p><a href=\"https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop\">读取(Read)-运算(Eval)-输出(Print)-循环(Loop)</a> (REPL) 是一个简单的, 交互式的计算机编程环境，它采用单个用户输入(即单个表达式)，运算并返回结果给用户。</p>\n<h2 id=\"主进程\"><a href=\"#主进程\">主进程</a></h2>\n<p>Electron 通过 <code>--interactive</code> 命令行参数将 <a href=\"https://nodejs.org/dist/latest/docs/api/repl.html\">Node.js <code>repl</code> 模块</a>暴露出去。 假设你已将 <code>electron</code> 安装为本地项目依赖，则应能够使用下面的命令访问 REPL：</p>\n<pre><code class=\"hljs language-sh\">./node_modules/.bin/electron --interactive\n</code></pre>\n<p><strong>注意：</strong> <code>electron --interactive</code> 在 Windows 上不可用(详情请参阅<a href=\"https://github.com/electron/electron/pull/5776\">electron/electron#5776</a>)。</p>\n<h2 id=\"渲染器进程\"><a href=\"#渲染器进程\">渲染器进程</a></h2>\n<p>你可以使用开发者工具Console选项卡获取任意渲染器进程的REPL。 要了解更多，请阅读 <a href=\"https://developer.chrome.com/docs/devtools/console/\">Chrome 文档</a>。</p>",
      "title": "交互式解释器 (REPL)",
      "description": ""
    },
    "/docs/tutorial/represented-file": {
      "locale": "zh-CN",
      "slug": "represented-file",
      "href": "/docs/tutorial/represented-file",
      "crowdinFileId": "256243",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/represented-file.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"representing-files-in-a-browserwindow-macos\"><a href=\"#representing-files-in-a-browserwindow-macos\">Representing Files in a BrowserWindow (macOS)</a></h1>\n<h2 id=\"概览\"><a href=\"#概览\">概览</a></h2>\n<p>在 macOS 上，您可以为应用程序中的任何窗口设置一个代表文件。 代表文件的图标将显示在标题栏中，当用户 <code>Command-单击</code> 或 <code>Control-单击</code>，一个带有文件路径的弹出窗口将会显示。</p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5082061/670a949a-6f14-11e4-987a-9aaa04b23c1d.png\" alt=\"展示文件（Represented File）\"></p>\n<blockquote>\n<p>注意：上面的屏幕截图是一个示例，其中此功能用于指示 Atom 文本编辑器中当前打开的文件。</p>\n</blockquote>\n<p>您还可以设置窗口的编辑状态，以便文件图标可以指示该窗口中的文档是否已修改。</p>\n<p>要设置窗口的代表文件，您可以使用 <a href=\"/docs/api/browser-window#winsetrepresentedfilenamefilename-macos\">BrowserWindow.setRepresentedFilename</a> 和 <a href=\"/docs/api/browser-window#winsetdocumenteditededited-macos\">BrowserWindow.setDocumentEdited</a> API。</p>\n<h2 id=\"示例\"><a href=\"#示例\">示例</a></h2>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/represented-file\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>);\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.setRepresentedFilename(os.homedir())\n  win.setDocumentEdited(<span class=\"hljs-literal\">true</span>)\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<p>启动 Electron 应用程序后，在按下 <code>Command</code> 或 <code>Control</code> 键时单击标题。 You should see a popup with the represented file at the top. In this guide, this is the current user's home directory:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/represented-file.png\" alt=\"Represented file\"></p>",
      "title": "Representing Files in a BrowserWindow (macOS)",
      "description": "注意：上面的屏幕截图是一个示例，其中此功能用于指示 Atom 文本编辑器中当前打开的文件。"
    },
    "/docs/api/safe-storage": {
      "locale": "zh-CN",
      "slug": "safe-storage",
      "href": "/docs/api/safe-storage",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/safe-storage.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"safestorage\"><a href=\"#safestorage\">safeStorage</a></h1>\n<blockquote>\n<p>Allows access to simple encryption and decryption of strings for storage on the local machine.</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p>This module protects data stored on disk from being accessed by other applications or users with full disk access.</p>\n<p>Note that on Mac, access to the system Keychain is required and these calls can block the current thread to collect user input. The same is true for Linux, if a password management tool is available.</p>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>safeStorage</code> 模块包含以下方法：</p>\n<h3 id=\"safestorageisencryptionavailable\"><a href=\"#safestorageisencryptionavailable\"><code>safeStorage.isEncryptionAvailable()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether encryption is available.</p>\n<p>On Linux, returns true if the secret key is available. On MacOS, returns true if Keychain is available. On Windows, returns true with no other preconditions.</p>\n<h3 id=\"safestorageencryptstringplaintext\"><a href=\"#safestorageencryptstringplaintext\"><code>safeStorage.encryptString(plainText)</code></a></h3>\n<ul>\n<li><code>plainText</code> String</li>\n</ul>\n<p>Returns <code>Buffer</code> -  An array of bytes representing the encrypted string.</p>\n<p>This function will throw an error if encryption fails.</p>\n<h3 id=\"safestoragedecryptstringencrypted\"><a href=\"#safestoragedecryptstringencrypted\"><code>safeStorage.decryptString(encrypted)</code></a></h3>\n<ul>\n<li><code>encrypted</code> Buffer</li>\n</ul>\n<p>Returns <code>String</code> - the decrypted string. Decrypts the encrypted buffer obtained  with <code>safeStorage.encryptString</code> back into a string.</p>\n<p>This function will throw an error if decryption fails.</p>",
      "title": "safeStorage",
      "description": "Allows access to simple encryption and decryption of strings for storage on the local machine."
    },
    "/docs/tutorial/sandbox": {
      "locale": "zh-CN",
      "slug": "sandbox",
      "href": "/docs/tutorial/sandbox",
      "crowdinFileId": "256245",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/sandbox.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"进程沙盒化\"><a href=\"#进程沙盒化\">进程沙盒化</a></h1>\n<p>Chromium的一个关键安全特性是，进程可以在沙盒中执行。 沙盒通过限制对大多数系统资源的访问来减少恶意代码可能造成的伤害 — 沙盒化的进程只能自由使用CPU周期和内存。 为了执行需要额外权限的操作，沙盒处的进程通过专用通信渠道将任务下放给更大权限的进程。</p>\n<p>在Chromium中，沙盒化应用于主进程以外的大多数进程。 其中包括渲染器进程，以及功能性进程，如音频服务、GPU 服务和网络服务。</p>\n<p>查阅Chromium的 <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/design/sandbox.md\">沙箱设计文档</a> 了解更多信息。</p>\n<h2 id=\"electron沙盒化策略\"><a href=\"#electron沙盒化策略\">Electron沙盒化策略</a></h2>\n<p>Electron带有一个混合的沙盒环境，意味着沙盒化进程可以和有权限的进程一起运行。 默认情况下，渲染器进程未被沙盒化，但功能性进程是被沙盒化的。 注意，就像在Chromium中一样，主 (浏览器) 进程是有特权的且无法被沙盒化。</p>\n<p>从历史上看，这种混合沙盒方法之所以成立，是因为在渲染器中提供Node.js对于应用开发人员来说是一个非常强大的工具。 不幸的是，这一特性同时也是一个巨大的安全漏洞。</p>\n<p>从理论上讲，对于只显示可信代码的桌面应用程序来说，未沙盒化的渲染器不是问题，但它们使 Electron 在显示不受信任的 Web 内容时的安全性低于 Chromium。 然而，即使据称可信的代码也可能是危险的 — 在远程加载的网站上有无数恶意行为者可以使用的攻击途径。稍微举几个例子：从跨站脚本到内容注入再到中间人攻击。 因此，我们建议在大多数非常谨慎的情况下启用渲染器沙盒化。</p>\n<!--TODO: update this guide when #28466 is either solved or closed -->\n<p>Note that there is an active discussion in the issue tracker to enable renderer sandboxing by default. See <a href=\"https://github.com/electron/electron/issues/28466\">#28466</a>) for details.</p>\n<h2 id=\"electron-中的沙盒行为\"><a href=\"#electron-中的沙盒行为\">Electron 中的沙盒行为</a></h2>\n<p>在 Electron 中沙盒进程 <em>大部分地</em> 表现都与 Chromium 差不多， 但因为介面是 Node.js 的关系 Electron 有一些额外的概念需要考虑。</p>\n<h3 id=\"渲染器进程\"><a href=\"#渲染器进程\">渲染器进程</a></h3>\n<p>当 Electron 中的渲染器进程被沙盒化时，它们的行为与常规 Chrome 渲染器一样。 一个沙盒化的渲染器不会有一个 Node.js 环境。</p>\n<!-- TODO(erickzhao): when we have a solid guide for IPC, link it here -->\n<p>因此，在沙盒中，渲染器进程只能透过 进程间通讯 ( inter-process communication, IPC ) 委派任务给主进程的方式， 来执行需权限的任务 ( 例如：操作档案系统，改变作业系统 或 生成子进程 ) 。</p>\n<h3 id=\"预加载脚本\"><a href=\"#预加载脚本\">预加载脚本</a></h3>\n<p>In order to allow renderer processes to communicate with the main process, preload scripts attached to sandboxed renderers will still have a polyfilled subset of Node.js APIs available. A <code>require</code> function similar to Node's <code>require</code> module is exposed, but can only import a subset of Electron and Node's built-in modules:</p>\n<ul>\n<li><code>electron</code> (only renderer process modules)</li>\n<li><a href=\"https://nodejs.org/api/events.html\"><code>事件</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html\"><code>timers</code></a></li>\n<li><a href=\"https://nodejs.org/api/url.html\"><code>url</code></a></li>\n</ul>\n<p>In addition, the preload script also polyfills certain Node.js primitives as globals:</p>\n<ul>\n<li><a href=\"https://nodejs.org/api/Buffer.html\"><code>Buffer</code></a></li>\n<li><a href=\"/docs/api/process\"><code>process</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html#timers_clearimmediate_immediate\"><code>clearImmediate</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html#timers_setimmediate_callback_args\"><code>setImmediate</code></a></li>\n</ul>\n<p>Because the <code>require</code> function is a polyfill with limited functionality, you will not be able to use <a href=\"https://nodejs.org/api/modules.html#modules_modules_commonjs_modules\">CommonJS modules</a> to separate your preload script into multiple files. If you need to split your preload code, use a bundler such as <a href=\"https://webpack.js.org/\">webpack</a> or <a href=\"https://parceljs.org/\">Parcel</a>.</p>\n<p>Note that because the environment presented to the <code>preload</code> script is substantially more privileged than that of a sandboxed renderer, it is still possible to leak privileged APIs to untrusted code running in the renderer process unless <a href=\"/docs/tutorial/context-isolation\"><code>contextIsolation</code></a> is enabled.</p>\n<h2 id=\"配置沙盒\"><a href=\"#配置沙盒\">配置沙盒</a></h2>\n<h3 id=\"enabling-the-sandbox-for-a-single-process\"><a href=\"#enabling-the-sandbox-for-a-single-process\">Enabling the sandbox for a single process</a></h3>\n<p>In Electron, renderer sandboxing can be enabled on a per-process basis with the <code>sandbox: true</code> preference in the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> constructor.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">sandbox</span>: <span class=\"hljs-literal\">true</span>\n    }\n  })\n  win.loadURL(<span class=\"hljs-string\">'https://google.com'</span>)\n})\n</code></pre>\n<h3 id=\"全局启用沙盒\"><a href=\"#全局启用沙盒\">全局启用沙盒</a></h3>\n<p>If you want to force sandboxing for all renderers, you can also use the <a href=\"/docs/api/app#appenablesandbox\"><code>app.enableSandbox</code></a> API. Note that this API has to be called before the app's <code>ready</code> event.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\napp.enableSandbox()\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// no need to pass `sandbox: true` since `app.enableSandbox()` was called.</span>\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://google.com'</span>)\n})\n</code></pre>\n<h3 id=\"禁用-chromium-的沙盒（仅测试）\"><a href=\"#禁用-chromium-的沙盒（仅测试）\">禁用 Chromium 的沙盒（仅测试）</a></h3>\n<p>You can also disable Chromium's sandbox entirely with the <a href=\"/docs/api/command-line-switches#--no-sandbox\"><code>--no-sandbox</code></a> CLI flag, which will disable the sandbox for all processes (including utility processes). We highly recommend that you only use this flag for testing purposes, and <strong>never</strong> in production.</p>\n<p>Note that the <code>sandbox: true</code> option will still disable the renderer's Node.js environment.</p>\n<h2 id=\"a-note-on-rendering-untrusted-content\"><a href=\"#a-note-on-rendering-untrusted-content\">A note on rendering untrusted content</a></h2>\n<p>Rendering untrusted content in Electron is still somewhat uncharted territory, though some apps are finding success (e.g. <a href=\"https://github.com/beakerbrowser/beaker\">Beaker Browser</a>). Our goal is to get as close to Chrome as we can in terms of the security of sandboxed content, but ultimately we will always be behind due to a few fundamental issues:</p>\n<ol>\n<li>We do not have the dedicated resources or expertise that Chromium has to apply to the security of its product. We do our best to make use of what we have, to inherit everything we can from Chromium, and to respond quickly to security issues, but Electron cannot be as secure as Chromium without the resources that Chromium is able to dedicate.</li>\n<li>Some security features in Chrome (such as Safe Browsing and Certificate Transparency) require a centralized authority and dedicated servers, both of which run counter to the goals of the Electron project. As such, we disable those features in Electron, at the cost of the associated security they would otherwise bring.</li>\n<li>There is only one Chromium, whereas there are many thousands of apps built on Electron, all of which behave slightly differently. Accounting for those differences can yield a huge possibility space, and make it challenging to ensure the security of the platform in unusual use cases.</li>\n<li>We can't push security updates to users directly, so we rely on app vendors to upgrade the version of Electron underlying their app in order for security updates to reach users.</li>\n</ol>\n<p>While we make our best effort to backport Chromium security fixes to older versions of Electron, we do not make a guarantee that every fix will be backported. Your best chance at staying secure is to be on the latest stable version of Electron.</p>",
      "title": "进程沙盒化",
      "description": ""
    },
    "/docs/api/screen": {
      "locale": "zh-CN",
      "slug": "screen",
      "href": "/docs/api/screen",
      "crowdinFileId": "256361",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/screen.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"screen\"><a href=\"#screen\">screen</a></h1>\n<blockquote>\n<p>检索有关屏幕大小、显示器、光标位置等的信息。</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p>在 <code>app</code> 模块 <code>emitted ready </code> 事件之前，您不能使用此模块。</p>\n<p><code>screen</code>是一个<a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p><strong>Note:</strong> In the renderer / DevTools, <code>window.screen</code> is a reserved DOM property, so writing <code>let { screen } = require('electron')</code> will not work.</p>\n<p>创建填充整个屏幕的窗口的示例:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/screen/fit-screen\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, screen } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> { width, height } = screen.getPrimaryDisplay().workAreaSize\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ width, height })\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>另一个在外部显示器中创建窗口的例子</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, screen } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> displays = screen.getAllDisplays()\n  <span class=\"hljs-keyword\">const</span> externalDisplay = displays.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">display</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> display.bounds.x !== <span class=\"hljs-number\">0</span> || display.bounds.y !== <span class=\"hljs-number\">0</span>\n  })\n\n  <span class=\"hljs-keyword\">if</span> (externalDisplay) {\n    win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n      <span class=\"hljs-attr\">x</span>: externalDisplay.bounds.x + <span class=\"hljs-number\">50</span>,\n      <span class=\"hljs-attr\">y</span>: externalDisplay.bounds.y + <span class=\"hljs-number\">50</span>\n    })\n    win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  }\n})\n</code></pre>\n<h2 id=\"事件\"><a href=\"#事件\">事件</a></h2>\n<p><code>screen</code>模块触发以下事件:</p>\n<h3 id=\"event-display-added\"><a href=\"#event-display-added\">Event: 'display-added'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newDisplay</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n</ul>\n<p>当新的窗口<code>newDisplay</code>被添加的时候触发。</p>\n<h3 id=\"event-display-removed\"><a href=\"#event-display-removed\">Event: 'display-removed'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>oldDisplay</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n</ul>\n<p>当旧的窗口<code>oldDisplay</code>被移除的时候触发。</p>\n<h3 id=\"event-display-metrics-changed\"><a href=\"#event-display-metrics-changed\">Event: 'display-metrics-changed'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>display</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n<li><code>changedMetrics</code> String[]</li>\n</ul>\n<p>当<code>display</code>中的一个或多个值发生改变时发出。 <code>changedMetrics</code>是描述更改信息的字符串数组。 可能改变的值有<code>bounds</code>, <code>workArea</code>, <code>scaleFactor</code> 和 <code>rotation</code>.</p>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>screen</code>模块有以下方法:</p>\n<h3 id=\"screengetcursorscreenpoint\"><a href=\"#screengetcursorscreenpoint\"><code>screen.getCursorScreenPoint()</code></a></h3>\n<p>返回 <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>当前鼠标的绝对位置。</p>\n<p><strong>Note:</strong> The return value is a DIP point, not a screen physical point.</p>\n<h3 id=\"screengetprimarydisplay\"><a href=\"#screengetprimarydisplay\"><code>screen.getPrimaryDisplay()</code></a></h3>\n<p>返回主窗口<a href=\"/docs/api/structures/display\"><code>Display</code></a></p>\n<h3 id=\"screengetalldisplays\"><a href=\"#screengetalldisplays\"><code>screen.getAllDisplays()</code></a></h3>\n<p>返回一个窗口数组<a href=\"/docs/api/structures/display\"><code>Display[]</code></a>，表示当前可用的窗口。</p>\n<h3 id=\"screengetdisplaynearestpointpoint\"><a href=\"#screengetdisplaynearestpointpoint\"><code>screen.getDisplayNearestPoint(point)</code></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>返回离指定点最近的一个窗口<a href=\"/docs/api/structures/display\"><code>Display</code></a></p>\n<h3 id=\"screengetdisplaymatchingrect\"><a href=\"#screengetdisplaymatchingrect\"><code>screen.getDisplayMatching(rect)</code></a></h3>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>返回离指定的图形最密切相交一个窗口<a href=\"/docs/api/structures/display\"><code>Display</code></a></p>\n<h3 id=\"screenscreentodippointpoint-windows\"><a href=\"#screenscreentodippointpoint-windows\"><code>screen.screenToDipPoint(point)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>返回 <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>Converts a screen physical point to a screen DIP point. The DPI scale is performed relative to the display containing the physical point.</p>\n<h3 id=\"screendiptoscreenpointpoint-windows\"><a href=\"#screendiptoscreenpointpoint-windows\"><code>screen.dipToScreenPoint(point)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>返回 <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>Converts a screen DIP point to a screen physical point. The DPI scale is performed relative to the display containing the DIP point.</p>\n<h3 id=\"screenscreentodiprectwindow-rect-windows\"><a href=\"#screenscreentodiprectwindow-rect-windows\"><code>screen.screenToDipRect(window, rect)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | null</li>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>返回 <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>Converts a screen physical rect to a screen DIP rect. The DPI scale is performed relative to the display nearest to <code>window</code>. If <code>window</code> is null, scaling will be performed to the display nearest to <code>rect</code>.</p>\n<h3 id=\"screendiptoscreenrectwindow-rect-windows\"><a href=\"#screendiptoscreenrectwindow-rect-windows\"><code>screen.dipToScreenRect(window, rect)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | null</li>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>返回 <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>Converts a screen DIP rect to a screen physical rect. The DPI scale is performed relative to the display nearest to <code>window</code>. If <code>window</code> is null, scaling will be performed to the display nearest to <code>rect</code>.</p>",
      "title": "screen",
      "description": "检索有关屏幕大小、显示器、光标位置等的信息。"
    },
    "/docs/api/structures/scrubber-item": {
      "locale": "zh-CN",
      "slug": "scrubber-item",
      "href": "/docs/api/structures/scrubber-item",
      "crowdinFileId": "256497",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/scrubber-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"scrubberitem-object\"><a href=\"#scrubberitem-object\">ScrubberItem Object</a></h1>\n<ul>\n<li><code>label</code> String (optional) - The text to appear in this item.</li>\n<li><code>icon</code> NativeImage (optional) - The image to appear in this item.</li>\n</ul>",
      "title": "ScrubberItem Object",
      "description": ""
    },
    "/docs/tutorial/security": {
      "locale": "zh-CN",
      "slug": "security",
      "href": "/docs/tutorial/security",
      "crowdinFileId": "256247",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/security.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"安全性，原生能力和你的责任\"><a href=\"#安全性，原生能力和你的责任\">安全性，原生能力和你的责任</a></h1>\n<p>Web开发人员通畅享有浏览器强大的网络安全特性，而自己的代码风险相对较小。 我们的网站在沙盒中被赋予了有限的权力，我们相信我们的用户享受到的是一个由大型工程师团队打造的浏览器，它能够快速应对新发现的安全威胁。</p>\n<p>当使用 Electron 时，很重要的一点是要理解 Electron 不是一个 Web 浏览器。 它允许您使用熟悉的 Web 技术构建功能丰富的桌面应用程序，但是您的代码具有更强大的功能。 JavaScript 可以访问文件系统，用户 shell 等。 这允许您构建更高质量的本机应用程序，但是内在的安全风险会随着授予您的代码的额外权力而增加。</p>\n<p>考虑到这一点，请注意，展示任意来自不受信任源的内容都将会带来严重的安全风险，而这种风险Electron也没打算处理。 事实上，最流行的 Electron 应用程序(Atom，Slack，Visual Studio Code 等) 主要显示本地内容(即使有远程内容也是无 Node 的、受信任的、安全的内容) - 如果您的应用程序要运行在线的源代码，那么您需要确保源代码不是恶意的。</p>\n<h2 id=\"报告安全问题\"><a href=\"#报告安全问题\">报告安全问题</a></h2>\n<p>有关如何正确上报 Electron 漏洞的信息，参阅 <a href=\"https://github.com/electron/electron/tree/main/SECURITY.md\">SECURITY.md</a></p>\n<h2 id=\"chromium-安全问题和升级\"><a href=\"#chromium-安全问题和升级\">Chromium 安全问题和升级</a></h2>\n<p>Electron keeps up to date with alternating Chromium releases. 欲了解更多信息，请查看 <a href=\"https://electronjs.org/blog/12-week-cadence\">Electron Release Cadence blog post</a>。</p>\n<h2 id=\"安全是所有人的共同责任\"><a href=\"#安全是所有人的共同责任\">安全是所有人的共同责任</a></h2>\n<p>需要牢记的是，你的 Electron 程序安全性除了依赖于整个框架基础（<em>Chromium</em>、<em>Node.js</em>）、Electron 本身和所有相关 NPM 库的安全性，还依赖于你自己的代码安全性。 因此，你有责任遵循下列安全守则：</p>\n<ul>\n<li>\n<p><strong>使用最新版的 Electron 框架搭建你的程序。</strong>你最终发行的产品中会包含 Electron、Chromium 共享库和 Node.js 的组件。 这些组件存在的安全问题也可能影响你的程序安全性。 你可以通过更新Electron到最新版本来确保像是<em>nodeIntegration绕过攻击</em>一类的严重漏洞已经被修复因而不会影响到你的程序。 请参阅“<a href=\"#16-use-a-current-version-of-electron\">使用当前版本的Electron</a>”以获取更多信息。</p>\n</li>\n<li>\n<p><strong>评估你的依赖项目</strong>NPM提供了五百万可重用的软件包，而你应当承担起选择可信任的第三方库。 如果你使用了受已知漏洞的过时的库，或是依赖于维护的很糟糕的代码，你的程序安全就可能面临威胁。</p>\n</li>\n<li>\n<p><strong>遵循安全编码实践</strong>你的代码是你的程序安全的第一道防线。 一般的网络漏洞，例如跨站脚本攻击(Cross-Site Scripting, XSS)，对Electron将造成更大的影响，因此非常建议你遵循安全软件开发最佳实践并进行安全性测试。</p>\n</li>\n</ul>\n<h2 id=\"隔离不信任的内容\"><a href=\"#隔离不信任的内容\">隔离不信任的内容</a></h2>\n<p>每当你从不被信任的来源(如一个远程服务器)获取代码并在本地执行，其中就存在安全性问题。 例如在默认的 <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>中显示一个远程网站. 如果攻击者以某种方式设法改变所述内容 (通过直接攻击源或者通过在应用和实际目的地之间进行攻击) ，他们将能够在用户的机器上执行本地代码。</p>\n<blockquote>\n<p>⚠️无论如何，在启用Node.js集成的情况下，你都不该加载并执行远程代码。 相反，只使用本地文件（和您的应用打包在一起）来执行Node.js代码 如果你想要显示远程内容，请使用 <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> Tag或者 <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>，并确保禁用 <code>nodeIntegration</code> 并启用 <code>contextIsolation</code></p>\n</blockquote>\n<h2 id=\"electron-安全警告\"><a href=\"#electron-安全警告\">Electron 安全警告</a></h2>\n<p>从Electron 2.0版本开始，开发者将会在开发者控制台看到打印的警告和建议。 这些警告仅在可执行文件名为 Electron 时才会为开发者显示。</p>\n<p>你可以通过在<code>process.env</code> 或 <code>window</code>对象上配置<code>ELECTRON_ENABLE_SECURITY_WARNINGS</code> 或<code>ELECTRON_DISABLE_SECURITY_WARNINGS</code>来强制开启或关闭这些警告。</p>\n<h2 id=\"清单：安全建议\"><a href=\"#清单：安全建议\">清单：安全建议</a></h2>\n<p>为加强程序安全性，你至少应当遵循下列规则：</p>\n<ol>\n<li><a href=\"#1-only-load-secure-content\">只加载安全的内容</a></li>\n<li><a href=\"#2-do-not-enable-nodejs-integration-for-remote-content\">禁止在所有渲染器中使用Node.js集成显示远程内容</a></li>\n<li><a href=\"#3-enable-context-isolation-for-remote-content\">在所有显示远程内容的渲染器中启用上下文隔离。</a></li>\n<li><a href=\"#4-enable-sandboxing\">Enable sandboxing</a></li>\n<li><a href=\"#5-handle-session-permission-requests-from-remote-content\">在所有加载远程内容的会话中使用 <code>ses.setPermissionRequestHandler()</code>.</a></li>\n<li><a href=\"#6-do-not-disable-websecurity\">不要禁用 <code>webSecurity</code></a></li>\n<li><a href=\"#7-define-a-content-security-policy\">定义一个<code>Content-Security-Policy</code></a>并设置限制规则(如：<code>script-src 'self'</code>)</li>\n<li><a href=\"#8-do-not-set-allowrunninginsecurecontent-to-true\">不要设置 <code>allowRunningInsecureContent</code> 为 true.</a></li>\n<li><a href=\"#9-do-not-enable-experimental-features\">不要开启实验性功能</a></li>\n<li><a href=\"#10-do-not-use-enableblinkfeatures\">不要使用<code>enableBlinkFeatures</code></a></li>\n<li><a href=\"#11-do-not-use-allowpopups\"><code>&#x3C;webview></code>：不要使用 <code>allowpopups </code></a></li>\n<li><a href=\"#12-verify-webview-options-before-creation\"><code>&#x3C;webview></code>：验证选项与参数</a></li>\n<li><a href=\"#13-disable-or-limit-navigation\">禁用或限制网页跳转</a></li>\n<li><a href=\"#14-disable-or-limit-creation-of-new-windows\">禁用或限制新窗口创建</a></li>\n<li><a href=\"#15-do-not-use-openexternal-with-untrusted-content\">不要对不可信的内容使用 <code>openExternal</code></a></li>\n<li><a href=\"#16-use-a-current-version-of-electron\">使用当前版本的 Electron</a></li>\n</ol>\n<p>如果你想要自动检测错误的配置或是不安全的模式，可以使用<a href=\"https://github.com/doyensec/electronegativity\">electronegativity</a> 关于在使用Electron进行应用程序开发中的潜在薄弱点或者bug，您可以参考<a href=\"https://doyensec.com/resources/us-17-Carettoni-Electronegativity-A-Study-Of-Electron-Security-wp.pdf\">开发者与审核人员指南</a></p>\n<h2 id=\"1-仅加载安全内容\"><a href=\"#1-仅加载安全内容\">1) 仅加载安全内容</a></h2>\n<p>任何不属于你的应用的资源都应该使用像<code>HTTPS</code>这样的安全协议来加载。 换言之， 不要使用不安全的协议 （如 <code>HTTP</code>）。 同理，我们建议使用<code>WSS</code>，避免使用<code>WS</code>，建议使用<code>FTPS</code> ，避免使用<code>FTP</code>，等等诸如此类的协议。</p>\n<h3 id=\"为什么？\"><a href=\"#为什么？\">为什么？</a></h3>\n<p><code>HTTPS</code> 有三个主要好处：</p>\n<p>1) 它对远程服务器进行身份验证, 确保您的应用程序连接到正确的主机而不是模仿器。 2) 确保数据完整性, 断言数据在应用程序和主机之间传输时未被修改。 3) 它对用户和目标主机之间的通信进行加密, 从而更难窃听应用程序和主机之间发送的信息。</p>\n<h3 id=\"怎么做？\"><a href=\"#怎么做？\">怎么做？</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 不推荐</span>\nbrowserWindow.loadURL (<span class=\"hljs-string\">'http://example.com'</span>)\n<span class=\"hljs-comment\">// 推荐 </span>\nbrowserWindow.loadURL (<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- 不推荐 --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">crossorigin</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://example.com/react.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"http://example.com/style.css\"</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- 推荐 --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">crossorigin</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://example.com/react.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"https://example.com/style.css\"</span>></span>\n</code></pre>\n<h2 id=\"2-不要为远程内容启用-nodejs-集成\"><a href=\"#2-不要为远程内容启用-nodejs-集成\">2) 不要为远程内容启用 Node.js 集成</a></h2>\n<p><em>This recommendation is the default behavior in Electron since 5.0.0.</em></p>\n<p>加载远程内容时，不论使用的是哪一种渲染器（<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>，<a href=\"/docs/api/browser-view\"><code>BrowserView</code></a> 或者 <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>），最重要的就是绝对不要启用 Node.js 集成。 其目的是限制您授予远程内容的权限, 从而使攻击者在您的网站上执行 JavaScript 时更难伤害您的用户。</p>\n<p>在此之后，你可以为指定的主机授予附加权限。 举例来说，如果你正在打开一个指向 <code>https://example.com/</code> 的 BrowserWindow，那么你可以给他刚刚好足够的权限，但是绝对不要超出这个范围。</p>\n<h3 id=\"为什么？-1\"><a href=\"#为什么？-1\">为什么？</a></h3>\n<p>如果攻击者跳过渲染进程并在用户电脑上执行恶意代码，那么这种跨站脚本(XSS) 攻击的危害是非常大的。 跨站脚本攻击很常见，通常情况下，威力仅限于执行代码的网站。 禁用Node.js集成有助于防止XSS攻击升级为“远程代码执行” (RCE) 攻击。</p>\n<h3 id=\"怎么做？-1\"><a href=\"#怎么做？-1\">怎么做？</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 不推荐</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span>,\n    <span class=\"hljs-attr\">nodeIntegrationInWorker</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n\nmainWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 推荐</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">preload</span>: path.join(app.getAppPath(), <span class=\"hljs-string\">'preload.js'</span>)\n  }\n})\n\nmainWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- 不推荐 --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">nodeIntegration</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- 推荐 --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>当禁用Node.js集成时，你依然可以暴露API给你的站点以使用Node.js的模块功能或特性。 预加载脚本依然可以使用<code>require</code>等Node.js特性， 以使开发者可以暴露自定义API给远程加载内容。</p>\n<p>在下面的预加载脚本例子中，后加载的网站内容可以使用<code>window.readConfig()</code>方法，但不能使用Node.js特性。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { readFileSync } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-built_in\">window</span>.readConfig = <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> data = readFileSync(<span class=\"hljs-string\">'./config.json'</span>)\n  <span class=\"hljs-keyword\">return</span> data\n}\n</code></pre>\n<h2 id=\"3-为远程内容开启上下文隔离\"><a href=\"#3-为远程内容开启上下文隔离\">3) 为远程内容开启上下文隔离</a></h2>\n<p>上下文隔离是Electron的一个特性，它允许开发者在预加载脚本里运行代码，里面包含Electron API和专用的JavaScript上下文。 实际上，这意味全局对象如 <code>Array.prototype.push</code> 或 <code>JSON.parse</code>等无法被渲染进程里的运行脚本修改。</p>\n<p>Electron使用了和Chromium相同的<a href=\"https://developer.chrome.com/extensions/content_scripts#execution-environment\">Content Scripts</a>技术来开启这个行为。</p>\n<p>即便使用了 <code>nodeIntegration: false</code>, 要实现真正的强隔离并且防止使用 Node.js 的功能， <code>contextIsolation</code> 也 <strong>必须</strong> 开启.</p>\n<h3 id=\"为什么\"><a href=\"#为什么\">为什么?</a></h3>\n<p>For more information on what <code>contextIsolation</code> is and how to enable it please see our dedicated <a href=\"/docs/tutorial/context-isolation\">Context Isolation</a> document.</p>\n<h2 id=\"4-enable-sandboxing\"><a href=\"#4-enable-sandboxing\">4) Enable Sandboxing</a></h2>\n<p><a href=\"/docs/tutorial/sandbox\">Sandboxing</a> is a Chromium feature that uses the operating system to significantly limit what renderer processes have access to. You should enable the sandbox in all renderers. Loading, reading or processing any untrusted content in an unsandboxed process, including the main process, is not advised.</p>\n<h3 id=\"怎么做？-2\"><a href=\"#怎么做？-2\">怎么做？</a></h3>\n<p>When creating a window, pass the <code>sandbox: true</code> option in <code>webPreferences</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">sandbox</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h2 id=\"5-处理来自远程内容的会话许可请求\"><a href=\"#5-处理来自远程内容的会话许可请求\">5) 处理来自远程内容的会话许可请求</a></h2>\n<p>当你使用Chromes时，也许见过这种许可请求：每当网站尝试使用某个特性时，就会弹出让用户手动确认(如网站通知)</p>\n<p>此API基于<a href=\"https://developer.chrome.com/extensions/permissions\">Chromium permissions API</a>，并已实现对应的许可类型。</p>\n<h3 id=\"为什么？-2\"><a href=\"#为什么？-2\">为什么？</a></h3>\n<p>默认情况下，Electron将自动批准所有的许可请求，除非开发者手动配置一个自定义处理函数。 尽管默认如此，有安全意识的开发者可能希望默认反着来。</p>\n<h3 id=\"怎么做？-3\"><a href=\"#怎么做？-3\">怎么做？</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession\n  .fromPartition(<span class=\"hljs-string\">'some-partition'</span>)\n  .setPermissionRequestHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, callback</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> url = webContents.getURL()\n\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'notifications'</span>) {\n      <span class=\"hljs-comment\">// 通过许可请求</span>\n      callback(<span class=\"hljs-literal\">true</span>)\n    }\n\n    <span class=\"hljs-comment\">// Verify URL</span>\n    <span class=\"hljs-keyword\">if</span> (!url.startsWith(<span class=\"hljs-string\">'https://example.com/'</span>)) {\n      <span class=\"hljs-comment\">// 拒绝许可请求</span>\n      <span class=\"hljs-keyword\">return</span> callback(<span class=\"hljs-literal\">false</span>)\n    }\n  })\n</code></pre>\n<h2 id=\"6-不要禁用websecurity\"><a href=\"#6-不要禁用websecurity\">6) 不要禁用WebSecurity</a></h2>\n<p><em>Electron的默认值即是建议值。</em></p>\n<p>在渲染进程（<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>、<a href=\"/docs/api/browser-view\"><code>BrowserView</code></a> 和 <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>）中禁用 <code>webSecurity</code> 将导致至关重要的安全性功能被关闭。</p>\n<p>不要在生产环境中禁用<code>webSecurity</code>。</p>\n<h3 id=\"为什么？-3\"><a href=\"#为什么？-3\">为什么？</a></h3>\n<p>禁用 <code>webSecurity</code> 将会禁止同源策略并且将 <code>allowRunningInsecureContent</code> 属性置 <code>true</code>。 换句话说，这将使得来自其他站点的非安全代码被执行。</p>\n<h3 id=\"怎么做？-4\"><a href=\"#怎么做？-4\">怎么做？</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 不推荐</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">webSecurity</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 推荐</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- 不推荐 --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">disablewebsecurity</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- 推荐 --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<h2 id=\"7-定义一个内容安全策略\"><a href=\"#7-定义一个内容安全策略\">7) 定义一个内容安全策略</a></h2>\n<p>内容安全策略(CSP) 是应对跨站脚本攻击和数据注入攻击的又一层保护措施。 我们建议任何载入到Electron的站点都要开启。</p>\n<h3 id=\"为什么？-4\"><a href=\"#为什么？-4\">为什么？</a></h3>\n<p>CSP允许Electron通过服务端内容对指定页面的资源加载进行约束与控制。 如果你定义<code>https://example.com</code>这个源，所属这个源的脚本都允许被加载，反之<code>https://evil.attacker.com</code>不会被允许加载运行。 对于提升你的应用安全性，设置CSP是个很方便的办法。</p>\n<p>下面的CSP设置使得Electron只能执行自身站点和来自<code>apis.example.com</code>的脚本。</p>\n<pre><code class=\"hljs language-plaintext\">// 不推荐\nContent-Security-Policy: '*'\n\n// 推荐\nContent-Security-Policy: script-src 'self' https://apis.example.com\n</code></pre>\n<h3 id=\"csp-http头\"><a href=\"#csp-http头\">CSP HTTP头</a></h3>\n<p>Electron 会处理 <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy\"><code>Content-Security-Policy</code> HTTP 标头</a>，它可以在 <a href=\"/docs/api/web-request#webrequestonheadersreceivedfilter-listener\"><code>webRequest.onHeadersReceived</code></a> 中进行设置：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession.defaultSession.webRequest.onHeadersReceived(<span class=\"hljs-function\">(<span class=\"hljs-params\">details, callback</span>) =></span> {\n  callback({\n    <span class=\"hljs-attr\">responseHeaders</span>: {\n      ...details.responseHeaders,\n      <span class=\"hljs-string\">'Content-Security-Policy'</span>: [<span class=\"hljs-string\">'default-src \\'none\\''</span>]\n    }\n  })\n})\n</code></pre>\n<h3 id=\"csp元标签\"><a href=\"#csp元标签\">CSP元标签</a></h3>\n<p>CSP的首选传递机制是HTTP报头，但是在使用<code>file://</code>协议加载资源时，不可能使用此方法。 在某些用例下, 例如使用<code>file://</code>协议时, 在页面的<code>&#x3C;meta></code>的标签中设置CSP是非常有用的.</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'none'\"</span>></span>\n</code></pre>\n<h2 id=\"8-不要设置allowrunninginsecurecontent为true\"><a href=\"#8-不要设置allowrunninginsecurecontent为true\">8) 不要设置<code>allowRunningInsecureContent</code>为<code>true</code></a></h2>\n<p><em>Electron的默认值即是建议值。</em></p>\n<p>默认情况下，Electron不允许网站在<code>HTTPS</code>中加载或执行非安全源(<code>HTTP</code>) 中的脚本代码、CSS或插件。 将<code>allowRunningInsecureContent</code>属性设为<code>true</code>将禁用这种保护。</p>\n<p>当网站的初始内容通过<code>HTTPS</code>加载并尝试在子请求中加载<code>HTTP</code>的资源时，这被称为\"混合内容\"。</p>\n<h3 id=\"为什么？-5\"><a href=\"#为什么？-5\">为什么？</a></h3>\n<p>通过<code>HTTPS</code>加载会将该资源进行加密传输，以保证其真实性和完整性。 参看<a href=\"#1-only-load-secure-content\">只显示安全内容</a>这节以获得更多信息。</p>\n<h3 id=\"怎么做？-5\"><a href=\"#怎么做？-5\">怎么做？</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 不推荐</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">allowRunningInsecureContent</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 推荐</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({})\n</code></pre>\n<h2 id=\"9-不要开启实验室特性\"><a href=\"#9-不要开启实验室特性\">9) 不要开启实验室特性</a></h2>\n<p><em>Electron的默认值即是建议值。</em></p>\n<p>Electron 的熟练用户可以通过 <code> experimentalFeatures</code> 属性来启用 Chromium 实验性功能。</p>\n<h3 id=\"为什么？-6\"><a href=\"#为什么？-6\">为什么？</a></h3>\n<p>如名称所示，实验性功能是实验性的，尚未对所有 Chromium 用户启用。 此外，它们对整个 Electron 的影响很可能没有经过测试。</p>\n<p>尽管存在合理的使用场景，但是除非你知道你自己在干什么，否则你不应该开启这个属性。</p>\n<h3 id=\"怎么做？-6\"><a href=\"#怎么做？-6\">怎么做？</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 不推荐</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">experimentalFeatures</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 推荐</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({})\n</code></pre>\n<h2 id=\"10-不要使用enableblinkfeatures\"><a href=\"#10-不要使用enableblinkfeatures\">10) 不要使用<code>enableBlinkFeatures</code></a></h2>\n<p><em>Electron的默认值即是建议值。</em></p>\n<p>Blink是Chromium里的渲染引擎名称。 就像<code>experimentalFeatures</code>一样，<code>enableBlinkFeatures</code>属性将使开发者启用被默认禁用的特性。</p>\n<h3 id=\"为什么？-7\"><a href=\"#为什么？-7\">为什么？</a></h3>\n<p>通常来说，某个特性默认不被开启肯定有其合理的原因。 针对特定特性的合理使用场景是存在的。 作为开发者，你应该非常明白你为何要开启它，有什么后果，以及对你应用安全性的影响。 在任何情况下都不应该推测性的开启特性。</p>\n<h3 id=\"怎么做？-7\"><a href=\"#怎么做？-7\">怎么做？</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 不推荐</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">enableBlinkFeatures</span>: <span class=\"hljs-string\">'ExecCommandInJavaScript'</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// 推荐</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n</code></pre>\n<h2 id=\"11-不要使用allowpopups\"><a href=\"#11-不要使用allowpopups\">11) 不要使用<code>allowpopups</code></a></h2>\n<p><em>Electron的默认值即是建议值。</em></p>\n<p>如果您正在使用 <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> ，您可能需要页面和脚本加载进您的 <code>&#x3C;webview></code> 标签以打开新窗口。 开启<code>allowpopups</code>属性将使得<a href=\"/docs/api/browser-window\"><code>BrowserWindows</code></a>可以通过<code>window.open()</code>方法创建。 否则， <code>&#x3C;webview></code> 标签内不允许创建新窗口。</p>\n<h3 id=\"为什么？-8\"><a href=\"#为什么？-8\">为什么？</a></h3>\n<p>如果你不需要弹窗，最好使用默认值以关闭新<a href=\"/docs/api/browser-window\"><code>BrowserWindows</code></a>的创建。 以下是最低的权限要求原则：若非必要，不要再网站中创建新窗口。</p>\n<h3 id=\"怎么做？-8\"><a href=\"#怎么做？-8\">怎么做？</a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- 不推荐 --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">allowpopups</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- 推荐 --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<h2 id=\"12-创建webview前确认其选项\"><a href=\"#12-创建webview前确认其选项\">12) 创建WebView前确认其选项</a></h2>\n<p>通过渲染进程创建的WebView是不开启Node.js集成的，且也不能由自身开启。 但是，WebView可以通过其<code>webPreferences</code>属性创建一个独立的渲染进程。</p>\n<p>通过控制主进程中创建新的<a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>，并确认其webPreferences没有禁用安全相关特性是个不错的办法。</p>\n<h3 id=\"为什么？-9\"><a href=\"#为什么？-9\">为什么？</a></h3>\n<p>由于 <code>&#x3C;webview></code> 存在在DOM中，因此即使Node继承被禁用，它也可以通过运行在您的 网站上的脚本创建它们。</p>\n<p>Electron 可以让开发者关闭各种控制渲染进程的安全特性。 通常情况下，开发者并不需要关闭他们中的任何一种 - 因此你不应该允许创建不同配置的<a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>标签</p>\n<h3 id=\"怎么做？-9\"><a href=\"#怎么做？-9\">怎么做？</a></h3>\n<p>在 <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>标签生效前，Electron将产生一个<code>will-attach-webview</code>事件到<code>webContents</code>中。 利用这个事件来阻止可能含有不安全选项的 <code>webViews</code> 创建。</p>\n<pre><code class=\"hljs language-js\">app.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.on(<span class=\"hljs-string\">'will-attach-webview'</span>, (event, webPreferences, params) => {\n    <span class=\"hljs-comment\">// Strip away preload scripts if unused or verify their location is legitimate</span>\n    <span class=\"hljs-keyword\">delete</span> webPreferences.preload\n    <span class=\"hljs-keyword\">delete</span> webPreferences.preloadURL\n\n    <span class=\"hljs-comment\">// Disable Node.js integration</span>\n    webPreferences.nodeIntegration = <span class=\"hljs-literal\">false</span>\n\n    <span class=\"hljs-comment\">// Verify URL being loaded</span>\n    <span class=\"hljs-keyword\">if</span> (!params.src.startsWith(<span class=\"hljs-string\">'https://example.com/'</span>)) {\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<p>不过，这个清单只是将风险降低到最低限度，但没有将其消除。 如果您的目标是展示一个网站，浏览器将是一个更安全的选择。</p>\n<h2 id=\"13-disable-or-limit-navigation\"><a href=\"#13-disable-or-limit-navigation\">13) Disable or limit navigation</a></h2>\n<p>If your app has no need to navigate or only needs to navigate to known pages, it is a good idea to limit navigation outright to that known scope, disallowing any other kinds of navigation.</p>\n<h3 id=\"为什么？-10\"><a href=\"#为什么？-10\">为什么？</a></h3>\n<p>Navigation is a common attack vector. If an attacker can convince your app to navigate away from its current page, they can possibly force your app to open web sites on the Internet. Even if your <code>webContents</code> are configured to be more secure (like having <code>nodeIntegration</code> disabled or <code>contextIsolation</code> enabled), getting your app to open a random web site will make the work of exploiting your app a lot easier.</p>\n<p>A common attack pattern is that the attacker convinces your app's users to interact with the app in such a way that it navigates to one of the attacker's pages. This is usually done via links, plugins, or other user-generated content.</p>\n<h3 id=\"怎么做？-10\"><a href=\"#怎么做？-10\">怎么做？</a></h3>\n<p>如果您的应用不需要导航，您可以在 <a href=\"/docs/api/web-contents#event-will-navigate\"><code>will-navigate</code></a> 处理器中调用 <code>event.preventDefault()</code>。 If you know which pages your app might navigate to, check the URL in the event handler and only let navigation occur if it matches the URLs you're expecting.</p>\n<p>We recommend that you use Node's parser for URLs. 简单的字符串比较有时会出错 - <code>startsWith('https://example.com')</code>测试会让<code>https://example.com.attacker.com</code>通过.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> URL = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>).URL\n\napp.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.on(<span class=\"hljs-string\">'will-navigate'</span>, (event, navigationUrl) => {\n    <span class=\"hljs-keyword\">const</span> parsedUrl = <span class=\"hljs-keyword\">new</span> URL(navigationUrl)\n\n    <span class=\"hljs-keyword\">if</span> (parsedUrl.origin !== <span class=\"hljs-string\">'https://example.com'</span>) {\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<h2 id=\"14-禁用或限制新窗口的创建\"><a href=\"#14-禁用或限制新窗口的创建\">14) 禁用或限制新窗口的创建</a></h2>\n<p>If you have a known set of windows, it's a good idea to limit the creation of additional windows in your app.</p>\n<h3 id=\"为什么？-11\"><a href=\"#为什么？-11\">为什么？</a></h3>\n<p>Much like navigation, the creation of new <code>webContents</code> is a common attack vector. Attackers attempt to convince your app to create new windows, frames, or other renderer processes with more privileges than they had before; or with pages opened that they couldn't open before.</p>\n<p>If you have no need to create windows in addition to the ones you know you'll need to create, disabling the creation buys you a little bit of extra security at no cost. This is commonly the case for apps that open one <code>BrowserWindow</code> and do not need to open an arbitrary number of additional windows at runtime.</p>\n<h3 id=\"怎么做？-11\"><a href=\"#怎么做？-11\">怎么做？</a></h3>\n<p><a href=\"/docs/api/web-contents\"><code>webContents</code></a>将会在新窗口创建前传递给 <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\">打开窗口的处理函数</a>。 The handler will receive, amongst other parameters, the <code>url</code> the window was requested to open and the options used to create it. We recommend that you register a handler to monitor the creation of windows, and deny any unexpected window creation.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n    <span class=\"hljs-comment\">// In this example, we'll ask the operating system</span>\n    <span class=\"hljs-comment\">// to open this event's url in the default browser.</span>\n    <span class=\"hljs-comment\">//</span>\n    <span class=\"hljs-comment\">// See the following item for considerations regarding what</span>\n    <span class=\"hljs-comment\">// URLs should be allowed through to shell.openExternal.</span>\n    <span class=\"hljs-keyword\">if</span> (isSafeForExternalOpen(url)) {\n      setImmediate(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n        shell.openExternal(url)\n      })\n    }\n\n    <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n  })\n})\n</code></pre>\n<h2 id=\"15-不要使用-openexternal-打开含有不可信任内容\"><a href=\"#15-不要使用-openexternal-打开含有不可信任内容\">15) 不要使用 <code>openExternal</code> 打开含有不可信任内容</a></h2>\n<p>Shell 的 <a href=\"/docs/api/shell#shellopenexternalurl-options\"><code>openExternal</code></a> 允许使用桌面的原生工具打开指定的协议 URI。 例如，在 macOS 上，此功能与 <code>open</code> 终端命令实用程序类似，将基于 URI 和文件类型关联打开特定的应用程序。</p>\n<h3 id=\"为什么？-12\"><a href=\"#为什么？-12\">为什么？</a></h3>\n<p>错误使用 <a href=\"/docs/api/shell#shellopenexternalurl-options\"><code>openExternal</code></a> 会危害用户的主机 当 openExternal 使用内容不受信任时，它可以用来执行任意命令。</p>\n<h3 id=\"怎么做？-12\"><a href=\"#怎么做？-12\">怎么做？</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">//  Bad</span>\n<span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nshell.openExternal(USER_CONTROLLED_DATA_HERE)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">//  Good</span>\n<span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nshell.openExternal(<span class=\"hljs-string\">'https://example.com/index.html'</span>)\n</code></pre>\n<h2 id=\"16-使用当前版本的-electron\"><a href=\"#16-使用当前版本的-electron\">16) 使用当前版本的 Electron</a></h2>\n<p>你应该尽可能使用最新版本的 Electron。 每当发布新的主要版本时，你应该尝试尽快更新您的应用。</p>\n<h3 id=\"为什么？-13\"><a href=\"#为什么？-13\">为什么？</a></h3>\n<p>一个使用 Electron、Chromium 和 Node.js 的旧版本构建的应用程序比使用这些组件的最新版本的应用程序更容易成为目标。 Generally speaking, security issues and exploits for older versions of Chromium and Node.js are more widely available.</p>\n<p>Chromium 和 Node.js 都是数千名有才华的开发者建造的令人印象深刻的工程。 鉴于他们受欢迎的程度，他们的安全性都经过专业的安全研究人员仔细的测试和分析。 其中许多研究人员<a href=\"https://en.wikipedia.org/wiki/Responsible_disclosure\">负责任地披露漏洞</a>，这通常意味着研究人员会给 Chromium 和 Node.js 一些时间来修复问题，然后再发布它们。 如果你的应用程序运行的是 Electron 的最新版本 (包括 Chromium 和 Node.js)，你的应用程序将更加安全，因为潜在的安全问题并不广为人知。</p>",
      "title": "安全性，原生能力和你的责任",
      "description": "⚠️无论如何，在启用Node.js集成的情况下，你都不该加载并执行远程代码。 相反，只使用本地文件（和您的应用打包在一起）来执行Node.js代码 如果你想要显示远程内容，请使用 <webview> Tag或者 BrowserView，并确保禁用 nodeIntegration 并启用 contextIsolation"
    },
    "/docs/api/structures/segmented-control-segment": {
      "locale": "zh-CN",
      "slug": "segmented-control-segment",
      "href": "/docs/api/structures/segmented-control-segment",
      "crowdinFileId": "256499",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/segmented-control-segment.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"segmentedcontrolsegment-object\"><a href=\"#segmentedcontrolsegment-object\">SegmentedControlSegment Object</a></h1>\n<ul>\n<li><code>label</code> String (optional) - The text to appear in this segment.</li>\n<li><code>icon</code> NativeImage (optional) - The image to appear in this segment.</li>\n<li><code>enabled</code> Boolean (optional) - Whether this segment is selectable. Default: true.</li>\n</ul>",
      "title": "SegmentedControlSegment Object",
      "description": ""
    },
    "/docs/api/structures/serial-port": {
      "locale": "zh-CN",
      "slug": "serial-port",
      "href": "/docs/api/structures/serial-port",
      "crowdinFileId": "256501",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/serial-port.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"serialport-object\"><a href=\"#serialport-object\">SerialPort Object</a></h1>\n<ul>\n<li><code>portId</code> String - Unique identifier for the port.</li>\n<li><code>portName</code> String - Name of the port.</li>\n<li><code>displayName</code> String - A string suitable for display to the user for describing this device.</li>\n<li><code>vendorId</code> String - Optional USB vendor ID.</li>\n<li><code>productId</code> String - Optional USB product ID.</li>\n<li><code>serialNumber</code> String - The USB device serial number.</li>\n<li><code>usbDriverName</code> String (optional) - Represents a single serial port on macOS can be enumerated by multiple drivers.</li>\n<li><code>deviceInstanceId</code> String (optional) - A stable identifier on Windows that can be used for device permissions.</li>\n</ul>",
      "title": "SerialPort Object",
      "description": ""
    },
    "/docs/api/structures/service-worker-info": {
      "locale": "zh-CN",
      "slug": "service-worker-info",
      "href": "/docs/api/structures/service-worker-info",
      "crowdinFileId": "256503",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/service-worker-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"serviceworkerinfo-object\"><a href=\"#serviceworkerinfo-object\">ServiceWorkerInfo Object</a></h1>\n<ul>\n<li><code>scriptUrl</code> String - The full URL to the script that this service worker runs</li>\n<li><code>scope</code> String - The base URL that this service worker is active for.</li>\n<li><code>renderProcessId</code> Number - The virtual ID of the process that this service worker is running in.  This is not an OS level PID.  This aligns with the ID set used for <code>webContents.getProcessId()</code>.</li>\n</ul>",
      "title": "ServiceWorkerInfo Object",
      "description": ""
    },
    "/docs/api/service-workers": {
      "locale": "zh-CN",
      "slug": "service-workers",
      "href": "/docs/api/service-workers",
      "crowdinFileId": "256363",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/service-workers.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-serviceworkers\"><a href=\"#class-serviceworkers\">Class: ServiceWorkers</a></h2>\n<blockquote>\n<p>从活跃的 service worker 会话中查询和接收事件</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>通过<code>Session</code>的<code>serviceWorkers</code>属性来访问<code>ServiceWorkers</code>的实例</p>\n<p>例如：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Get all service workers.</span>\n<span class=\"hljs-built_in\">console</span>.log(session.defaultSession.serviceWorkers.getAllRunning())\n\n<span class=\"hljs-comment\">// Handle logs and get service worker info</span>\nsession.defaultSession.serviceWorkers.on(<span class=\"hljs-string\">'console-message'</span>, (event, messageDetails) => {\n  <span class=\"hljs-built_in\">console</span>.log(\n    <span class=\"hljs-string\">'Got service worker message'</span>,\n    messageDetails,\n    <span class=\"hljs-string\">'from'</span>,\n    session.defaultSession.serviceWorkers.getFromVersionID(messageDetails.versionId)\n  )\n})\n</code></pre>\n<h3 id=\"实例事件\"><a href=\"#实例事件\">实例事件</a></h3>\n<p><code>ServiceWorkers</code>实例中有下列事件：</p>\n<h4 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>messageDetails</code> Object - 有关控制台消息的信息<ul>\n<li><code>message</code> String - 实际控制台消息</li>\n<li><code>versionId</code> Number - 发送消息日志的 service worker 的版本 ID</li>\n<li><code>source</code> String - 消息源的类型  可以是 <code>javascript</code>, <code>xml</code>, <code>network</code>, <code>console-api</code>, <code>storage</code>, <code>app-cache</code>, <code>rendering</code>, <code>security</code>, <code>deprecation</code>, <code>worker</code>, <code>violation</code>, <code>intervention</code>, <code>recommendation</code> 或 <code>other</code>.</li>\n<li><code>level</code> Number - 日志等级，从 0 到 3 。 按顺序匹配 <code>verbose</code>, <code>info</code>, <code>warning</code> 和 <code>error</code>.</li>\n<li><code>sourceUrl</code> String - 消息来源的URL</li>\n<li><code>lineNumber</code> Number - 触发当前控制台消息的源代码行数</li>\n</ul></li>\n</ul>\n<p>当一个service worker记录日志到控制台的时候将自动触发此事件</p>\n<h4 id=\"event-registration-completed\"><a href=\"#event-registration-completed\">Event: 'registration-completed'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object - 有关 service worker 注册的信息<ul>\n<li><code>scope</code> String - 当前 service worker 所注册在的URL</li>\n</ul></li>\n</ul>\n<p>当一个service worker已经被注册完成的时候触发此事件。 注册完成分两种情况， 一个是调用<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\"><code>navigator.serviceWorker.register('/sw.js')</code></a>方法成功，另一个是当Chrome的扩展加载结束。</p>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<p>在<code>ServiceWorkers</code>实例对象中，有以下方法:</p>\n<h4 id=\"serviceworkersgetallrunning\"><a href=\"#serviceworkersgetallrunning\"><code>serviceWorkers.getAllRunning()</code></a></h4>\n<p>返回 <code>Record&#x3C;Number, ServiceWorkerInfo></code> ， 一个 <a href=\"/docs/api/structures/service-worker-info\">ServiceWorkerInfo</a> 对象， 其中键是 service worker 的版本 ID ，值是 service worker 的信息。</p>\n<h4 id=\"serviceworkersgetfromversionidversionid\"><a href=\"#serviceworkersgetfromversionidversionid\"><code>serviceWorkers.getFromVersionID(versionId)</code></a></h4>\n<ul>\n<li><code>versionId</code> Number</li>\n</ul>\n<p>返回 <a href=\"/docs/api/structures/service-worker-info\"><code>ServiceWorkerInfo</code></a> - service worker的相关信息</p>\n<p>如果 service worker 不存在或者停止运行，此方法将抛出异常。</p>",
      "title": "ServiceWorkers",
      "description": "从活跃的 service worker 会话中查询和接收事件"
    },
    "/docs/api/session": {
      "locale": "zh-CN",
      "slug": "session",
      "href": "/docs/api/session",
      "crowdinFileId": "256365",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/session.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"session\"><a href=\"#session\">session</a></h1>\n<blockquote>\n<p>管理浏览器会话、cookie、缓存、代理设置等。</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p><code>session</code> 模块可用于创建新的 <code>session</code> 对象。</p>\n<p>您还可以通过使用 <code>WebContents</code> 的 <code>session</code> 属性或从 <code>session</code> 模块访问现有页面的 &#x3C;0>session&#x3C;/0>。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> ses = win.webContents.session\n<span class=\"hljs-built_in\">console</span>.log(ses.getUserAgent())\n</code></pre>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>session</code> 模块具有以下方法:</p>\n<h3 id=\"sessionfrompartitionpartition-options\"><a href=\"#sessionfrompartitionpartition-options\"><code>session.fromPartition(partition[, options])</code></a></h3>\n<ul>\n<li><code>partition</code> String</li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>cache</code> Boolean - 是否可以使用缓存.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Session</code> - 根据<code>partition</code>字符串产生的session实例。 当这里已存在一个<code>Session</code>具有相同的<code>partition</code>, 它将被返回; 否则一个新的<code>Session</code>实例将根据<code>options</code>被创建。</p>\n<p>如果 <code>partition</code> 以 <code>persist:</code>开头, 该页面将使用持续的 session，并在所有页面生效，且使用同一个<code>partition</code>. 如果没有 <code>persist:</code> 前缀, 页面将使用 in-memory session. 如果没有设置<code>partition</code>，app 将返回默认的session。</p>\n<p>要根据<code>options</code>创建<code>Session</code>，你需要确保<code>Session</code>的<code>partition</code>在之前从未被使用。 没有办法修改一个已存在的<code>Session</code>对象的<code>options</code>。</p>\n<h2 id=\"属性\"><a href=\"#属性\">属性</a></h2>\n<p><code>session</code> 模块具有以下方法:</p>\n<h3 id=\"sessiondefaultsession\"><a href=\"#sessiondefaultsession\"><code>session.defaultSession</code></a></h3>\n<p>一个<code>Session</code>对象，该应用程序的默认session对象。</p>\n<h2 id=\"类-session\"><a href=\"#类-session\">类: Session</a></h2>\n<blockquote>\n<p>获取和设置Session的属性。</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>你可以创建一个 <code>Session</code>对象在<code>session</code>模块中。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> ses = session.fromPartition(<span class=\"hljs-string\">'persist:name'</span>)\n<span class=\"hljs-built_in\">console</span>.log(ses.getUserAgent())\n</code></pre>\n<h3 id=\"实例事件\"><a href=\"#实例事件\">实例事件</a></h3>\n<p>以下事件会在<code>Session</code>实例触发。</p>\n<h4 id=\"instance-events\"><a href=\"#instance-events\">Instance Events</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>item</code> <a href=\"/docs/api/download-item\">DownloadItem</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>当 Electron 刚要在<code>webContents</code>中下载<code>item</code>的时候触发。</p>\n<p>调用<code>event.preventDefault()</code>方法，将会停止下载，并且在进程的next tick中，<code>item</code>将不再可用。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nsession.defaultSession.on(<span class=\"hljs-string\">'will-download'</span>, (event, item, webContents) => {\n  event.preventDefault()\n  <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'got'</span>)(item.getURL()).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">response</span>) =></span> {\n    <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>).writeFileSync(<span class=\"hljs-string\">'/somewhere'</span>, response.body)\n  })\n})\n</code></pre>\n<h4 id=\"event-extension-loaded\"><a href=\"#event-extension-loaded\">Event: 'extension-loaded'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">扩展插件</a></li>\n</ul>\n<p>在扩展插件加载完成后触发。 当一个扩展插件被添加到 \"enabled\" 的扩展插件集合内部时， 将自动触发 这包括：</p>\n<ul>\n<li>扩展插件正在从 <code>Session.loadExtension</code> 中被加载</li>\n<li>扩展插件正在被重新加载：<ul>\n<li>由于崩溃</li>\n<li>扩展插件被请求重新载入 (<a href=\"https://developer.chrome.com/extensions/runtime#method-reload\"><code>chrome.runtime.reload()</code></a>).</li>\n</ul></li>\n</ul>\n<h4 id=\"event-extension-unloaded\"><a href=\"#event-extension-unloaded\">Event: 'extension-unloaded'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">扩展插件</a></li>\n</ul>\n<p>当一个扩展插件被卸载后触发。 当 <code>Session.removeExtension</code> 被调用时也会触发。</p>\n<h4 id=\"event-extension-ready\"><a href=\"#event-extension-ready\">Event: 'extension-ready'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">扩展插件</a></li>\n</ul>\n<p>当一个扩展插件加载完成，同时所有必要的浏览器状态也初始化完毕，允许启动插件背景页面时， 将触发此事件。</p>\n<h4 id=\"event-preconnect\"><a href=\"#event-preconnect\">Event: 'preconnect'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preconnectUrl</code> String - 渲染器为预连接请求的 URL</li>\n<li><code>allowCredentials</code> Boolean - True 代表着渲染器在请求一个包含 credentials 信息的链接 (详见<a href=\"https://w3c.github.io/resource-hints/#preconnect\">spec</a>)</li>\n</ul>\n<p>当渲染进程已经预链接到 URL 后将触发此事件, 通常用于 <a href=\"https://w3c.github.io/resource-hints/\">资源加载</a> 提醒</p>\n<h4 id=\"event-spellcheck-dictionary-initialized\"><a href=\"#event-spellcheck-dictionary-initialized\">Event: 'spellcheck-dictionary-initialized'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - 字典文件的语言代码</li>\n</ul>\n<p>当一个hunspell字典初始化成功时触发。 这个事件在文件被下载之后触发。</p>\n<h4 id=\"event-spellcheck-dictionary-download-begin\"><a href=\"#event-spellcheck-dictionary-download-begin\">Event: 'spellcheck-dictionary-download-begin'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - 字典文件的语言代码</li>\n</ul>\n<p>当 hunspell 字典文件开始下载时触发</p>\n<h4 id=\"event-spellcheck-dictionary-download-success\"><a href=\"#event-spellcheck-dictionary-download-success\">Event: 'spellcheck-dictionary-download-success'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - 字典文件的语言代码</li>\n</ul>\n<p>当 hunspell 字典文件下载成功触发</p>\n<h4 id=\"event-spellcheck-dictionary-download-failure\"><a href=\"#event-spellcheck-dictionary-download-failure\">Event: 'spellcheck-dictionary-download-failure'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - 字典文件的语言代码</li>\n</ul>\n<p>当hunspell字典下载失败时触发。  如果需要详细信息，你应当查看网络日志并且检查下载请求。</p>\n<h4 id=\"event-select-hid-device\"><a href=\"#event-select-hid-device\">Event: 'select-hid-device'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>deviceList</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>deviceId</code> String | null (optional)</li>\n</ul></li>\n</ul>\n<p>Emitted when a HID device needs to be selected when a call to <code>navigator.hid.requestDevice</code> is made. <code>callback</code> should be called with <code>deviceId</code> to be selected; passing no arguments to <code>callback</code> will cancel the request.  Additionally, permissioning on <code>navigator.hid</code> can be further managed by using <a href=\"#sessetpermissioncheckhandlerhandler\">ses.setPermissionCheckHandler(handler)</a> and <a href=\"#sessetdevicepermissionhandlerhandler\">ses.setDevicePermissionHandler(handler)`</a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.webContents.session.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin, details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-comment\">// Add logic here to determine if permission should be given to allow HID selection</span>\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  <span class=\"hljs-comment\">// Optionally, retrieve previously persisted devices from a persistent store</span>\n  <span class=\"hljs-keyword\">const</span> grantedDevices = fetchGrantedDevices()\n\n  win.webContents.session.setDevicePermissionHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(details.origin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; details.deviceType === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-keyword\">if</span> (details.device.vendorId === <span class=\"hljs-number\">123</span> &#x26;&#x26; details.device.productId === <span class=\"hljs-number\">345</span>) {\n        <span class=\"hljs-comment\">// Always allow this type of device (this allows skipping the call to `navigator.hid.requestDevice` first)</span>\n        <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n      }\n\n      <span class=\"hljs-comment\">// Search through the list of devices that have previously been granted permission</span>\n      <span class=\"hljs-keyword\">return</span> grantedDevices.some(<span class=\"hljs-function\">(<span class=\"hljs-params\">grantedDevice</span>) =></span> {\n        <span class=\"hljs-keyword\">return</span> grantedDevice.vendorId === details.device.vendorId &#x26;&#x26;\n              grantedDevice.productId === details.device.productId &#x26;&#x26;\n              grantedDevice.serialNumber &#x26;&#x26; grantedDevice.serialNumber === details.device.serialNumber\n      })\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  win.webContents.session.on(<span class=\"hljs-string\">'select-hid-device'</span>, (event, details, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedDevice = details.deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    callback(selectedPort?.deviceId)\n  })\n})\n</code></pre>\n<h4 id=\"event-hid-device-added\"><a href=\"#event-hid-device-added\">Event: 'hid-device-added'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n</ul>\n<p>Emitted when a new HID device becomes available. For example, when a new USB device is plugged in.</p>\n<p>This event will only be emitted after <code>navigator.hid.requestDevice</code> has been called and <code>select-hid-device</code> has fired.</p>\n<h4 id=\"event-hid-device-removed\"><a href=\"#event-hid-device-removed\">Event: 'hid-device-removed'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n</ul>\n<p>Emitted when a HID device has been removed.  比如， 当一个USB设备被移除时。</p>\n<p>This event will only be emitted after <code>navigator.hid.requestDevice</code> has been called and <code>select-hid-device</code> has fired.</p>\n<h4 id=\"event-select-serial-port\"><a href=\"#event-select-serial-port\">Event: 'select-serial-port'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>portList</code> <a href=\"/docs/api/structures/serial-port\">SerialPort[]</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>portId</code> String</li>\n</ul></li>\n</ul>\n<p>调用 <code>navigator.serial.requestPort</code> 并选择一系列端口时触发此事件。 <code>callback</code> 方法将在<code>portId</code> 被选中后调用, 给<code>callback</code> 方法一个空字符串参数将取消请求。  此外， <code>navigator.serial</code> 的许可权可以通过使用 <a href=\"#sessetpermissioncheckhandlerhandler\">ses.setPermissionCheckHandler(handler)</a> 来设置 <code>serial</code> 权限。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n  win.webContents.session.on(<span class=\"hljs-string\">'select-serial-port'</span>, (event, portList, webContents, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedPort = portList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    <span class=\"hljs-keyword\">if</span> (!selectedPort) {\n      callback(<span class=\"hljs-string\">''</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      callback(selectedPort.portId)\n    }\n  })\n})\n</code></pre>\n<h4 id=\"event-serial-port-added\"><a href=\"#event-serial-port-added\">Event: 'serial-port-added'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>port</code> <a href=\"/docs/api/structures/serial-port\">SerialPort</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>当 <code>navigator.serial.requestPort</code> 已经被调用时触发此事件，同时 如果新的串行端口可用则 <code>select-serial-port</code> 事件也将触发。  比如，当一个新的USB设备插入时将触发此事件。</p>\n<h4 id=\"event-serial-port-removed\"><a href=\"#event-serial-port-removed\">Event: 'serial-port-removed'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>port</code> <a href=\"/docs/api/structures/serial-port\">SerialPort</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>当 <code>navigator.serial.requestPort</code> 已经被调用时触发，同时如果串行端口已经被删除则触发 <code>select-serial-port</code> 事件。  比如， 当一个USB设备被移除时。</p>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<p>在<code>Session</code>实例对象中，有以下方法:</p>\n<h4 id=\"sesgetcachesize\"><a href=\"#sesgetcachesize\"><code>ses.getCacheSize()</code></a></h4>\n<p>Returns <code>Promise&#x3C;Integer></code> - 当前 session 会话缓存大小，用 byte 字节作为单位。</p>\n<h4 id=\"sesclearcache\"><a href=\"#sesclearcache\"><code>ses.clearCache()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - 当缓存清除操作完成时可获取</p>\n<p>清除session的HTTP缓存。</p>\n<h4 id=\"sesclearstoragedataoptions\"><a href=\"#sesclearstoragedataoptions\"><code>ses.clearStorageData([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (可选)<ul>\n<li><code>origin</code> String - (可选项) 这个值应该按照 <code>window.location.origin</code> 的形式: <code>协议://主机名:端口</code>方式设置。</li>\n<li><code>storages</code> String<a href=\"/docs/api/%E5%8F%AF%E9%80%89%E9%A1%B9\"></a> - 要清除的存储类型，包含: <code>appcache</code>, <code>cookies</code>, <code>filesystem</code>, <code>indexdb</code>, <code>localstorage</code>, <code>shadercache</code>, <code>websql</code>, <code>serviceworkers</code>, <code>cachestorage</code>. 如果没有指定storages，将会清除所有的storages类型</li>\n<li><code>quotas</code> String[] - (可选项) 要清除的配额类型, 包含: <code>temporary</code>, <code>persistent</code>, <code>syncable</code>。 如果没有指定，将会清除所有的quotas。</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - 当存储的数据已经被清理时可获得</p>\n<h4 id=\"sesflushstoragedata\"><a href=\"#sesflushstoragedata\"><code>ses.flushStorageData()</code></a></h4>\n<p>写入任何未写入DOMStorage数据到磁盘.</p>\n<h4 id=\"sessetproxyconfig\"><a href=\"#sessetproxyconfig\"><code>ses.setProxy(config)</code></a></h4>\n<ul>\n<li><code>config</code> Object<ul>\n<li><code>mode</code> String (可选) - 代理模式。 可以是其中之一： <code>direct</code>, <code>auto_detect</code>, <code>pac_script</code>, <code>fixed_servers</code> 或 <code>system</code>。 如未指定，则根据其他选项自动判断<ul>\n<li><code>direct</code> 在直接模式下，所有连接都是直接创建的，无需任何代理。</li>\n<li><code>auto_detect</code> 在auto_detect模式下，代理配置由 PAC 脚本决定，该脚本 可在 <a href=\"http://wpad/wpad.dat\">http://wpad/wpad.dat</a> 下载。</li>\n<li><code>pac_script</code> In pac_script mode the proxy configuration is determined by a PAC script that is retrieved from the URL specified in the <code>pacScript</code>. This is the default mode if <code>pacScript</code> is specified.</li>\n<li><code>fixed_servers</code> In fixed_servers mode the proxy configuration is specified in <code>proxyRules</code>. This is the default mode if <code>proxyRules</code> is specified.</li>\n<li><code>system</code> In system mode the proxy configuration is taken from the operating system. Note that the system mode is different from setting no proxy configuration. In the latter case, Electron falls back to the system settings only if no command-line options influence the proxy configuration.</li>\n</ul></li>\n<li><code>pacScript</code> String (optional) - The URL associated with the PAC file.</li>\n<li><code>proxyRules</code> String (optional) - Rules indicating which proxies to use.</li>\n<li><code>proxyBypassRules</code> String (optional) - Rules indicating which URLs should bypass the proxy settings.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the proxy setting process is complete.</p>\n<p>代理设置</p>\n<p>When <code>mode</code> is unspecified, <code>pacScript</code> and <code>proxyRules</code> are provided together, the <code>proxyRules</code> option is ignored and <code>pacScript</code> configuration is applied.</p>\n<p>You may need <code>ses.closeAllConnections</code> to close currently in flight connections to prevent pooled sockets using previous proxy from being reused by future requests.</p>\n<p><code>proxyRules</code> 要遵循以下规则:</p>\n<pre><code class=\"hljs language-sh\">proxyRules = schemeProxies[<span class=\"hljs-string\">\";\"</span>&#x3C;schemeProxies>]\nschemeProxies = [&#x3C;urlScheme><span class=\"hljs-string\">\"=\"</span>]&#x3C;proxyURIList>\nurlScheme = <span class=\"hljs-string\">\"http\"</span> | <span class=\"hljs-string\">\"https\"</span> | <span class=\"hljs-string\">\"ftp\"</span> | <span class=\"hljs-string\">\"socks\"</span>\nproxyURIList = &#x3C;proxyURL>[<span class=\"hljs-string\">\",\"</span>&#x3C;proxyURIList>]\nproxyURL = [&#x3C;proxyScheme><span class=\"hljs-string\">\"://\"</span>]&#x3C;proxyHost>[<span class=\"hljs-string\">\":\"</span>&#x3C;proxyPort>]\n</code></pre>\n<p>例如：</p>\n<ul>\n<li><code>http=foopy:80;ftp=foopy2</code> - Use HTTP proxy <code>foopy:80</code> for <code>http://</code> URLs, and HTTP proxy <code>foopy2:80</code> for <code>ftp://</code> URLs.</li>\n<li><code>foopy:80</code> - Use HTTP proxy <code>foopy:80</code> for all URLs.</li>\n<li><code>foopy:80,bar,direct://</code> - Use HTTP proxy <code>foopy:80</code> for all URLs, failing over to <code>bar</code> if <code>foopy:80</code> is unavailable, and after that using no proxy.</li>\n<li><code>socks4://foopy</code> - Use SOCKS v4 proxy <code>foopy:1080</code> for all URLs.</li>\n<li><code>http=foopy,socks5://bar.com</code> - Use HTTP proxy <code>foopy</code> for http URLs, and fail over to the SOCKS5 proxy <code>bar.com</code> if <code>foopy</code> is unavailable.</li>\n<li><code>http=foopy,direct://</code> - Use HTTP proxy <code>foopy</code> for http URLs, and use no proxy if <code>foopy</code> is unavailable.</li>\n<li><code>http=foopy;socks=foopy2</code> - 对于http URL，用<code>foopy</code>作为HTTP协议代理，而其它所有URL则用<code> socks4://foopy2</code> 协议。</li>\n</ul>\n<p><code>proxyBypassRules</code>是一个用逗号分隔的规则列表, 如下所述:</p>\n<ul>\n<li>\n<p><code>[ URL_SCHEME \"://\" ] HOSTNAME_PATTERN [ \":\" &#x3C;port> ]</code></p>\n<p> 与 HOSTNAME_PATTERN 模式匹配的所有主机名。</p>\n<p> 例如: \"foobar.com\", \"<em>foobar.com\", \"</em>.foobar.com\", \"<em>foobar.com:99\", \"<a href=\"https://x\">https://x</a>.</em>.y.com:99\"</p>\n</li>\n<li>\n<p><code>\".\" HOSTNAME_SUFFIX_PATTERN [ \":\" PORT ]</code></p>\n<p> 匹配特定域名后缀。</p>\n<p> 例如： \".google.com\", \".com\", \"<a href=\"http://.google.com\">http://.google.com</a>\"</p>\n</li>\n<li>\n<p><code>[ SCHEME \"://\" ] IP_LITERAL [ \":\" PORT ]</code></p>\n<p> 匹配 IP 地址文本的 url。</p>\n<p> 例如: \"127.0.1\", \"[0:0::1]\", \"[::1]\", \"<a href=\"http://%5B::1%5D:99\">http://[::1]:99</a>\"</p>\n</li>\n<li>\n<p><code>IP_LITERAL \"/\" PREFIX_LENGTH_IN_BITS</code></p>\n<p> 匹配任何在给定IP范围内失败的URL。 IP范围使用指定的CIDR。</p>\n<p> 例如: \"192.168.1.1/16\", \"fefe:13::abc/33\".</p>\n</li>\n<li>\n<p><code>&#x3C;local></code></p>\n<p> 匹配本地地址。 The meaning of <code>&#x3C;local></code> is whether the host matches one of: \"127.0.0.1\", \"::1\", \"localhost\".</p>\n</li>\n</ul>\n<h4 id=\"sesresolveproxyurl\"><a href=\"#sesresolveproxyurl\"><code>ses.resolveProxy(url)</code></a></h4>\n<ul>\n<li><code>url</code> URL</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - Resolves with the proxy information for <code>url</code>.</p>\n<h4 id=\"sesforcereloadproxyconfig\"><a href=\"#sesforcereloadproxyconfig\"><code>ses.forceReloadProxyConfig()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the all internal states of proxy service is reset and the latest proxy configuration is reapplied if it's already available. The pac script will be fetched from <code>pacScript</code> again if the proxy mode is <code>pac_script</code>.</p>\n<h4 id=\"sessetdownloadpathpath\"><a href=\"#sessetdownloadpathpath\"><code>ses.setDownloadPath(path)</code></a></h4>\n<ul>\n<li><code>path</code> String - The download location.</li>\n</ul>\n<p>Sets download saving directory. By default, the download directory will be the <code>Downloads</code> under the respective app folder.</p>\n<h4 id=\"sesenablenetworkemulationoptions\"><a href=\"#sesenablenetworkemulationoptions\"><code>ses.enableNetworkEmulation(options)</code></a></h4>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>offline</code> Boolean (optional) - Whether to emulate network outage. Defaults to false.</li>\n<li><code>latency</code> Double (optional) - RTT in ms. Defaults to 0 which will disable latency throttling.</li>\n<li><code>downloadThroughput</code> Double (optional) - Download rate in Bps. Defaults to 0 which will disable download throttling.</li>\n<li><code>uploadThroughput</code> Double (optional) - Upload rate in Bps. Defaults to 0 which will disable upload throttling.</li>\n</ul></li>\n</ul>\n<p>通过指定的配置为 <code>session</code> 模拟网络。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// To emulate a GPRS connection with 50kbps throughput and 500 ms latency.</span>\n<span class=\"hljs-built_in\">window</span>.webContents.session.enableNetworkEmulation({\n  <span class=\"hljs-attr\">latency</span>: <span class=\"hljs-number\">500</span>,\n  <span class=\"hljs-attr\">downloadThroughput</span>: <span class=\"hljs-number\">6400</span>,\n  <span class=\"hljs-attr\">uploadThroughput</span>: <span class=\"hljs-number\">6400</span>\n})\n\n<span class=\"hljs-comment\">// To emulate a network outage.</span>\n<span class=\"hljs-built_in\">window</span>.webContents.session.enableNetworkEmulation({ <span class=\"hljs-attr\">offline</span>: <span class=\"hljs-literal\">true</span> })\n</code></pre>\n<h4 id=\"sespreconnectoptions\"><a href=\"#sespreconnectoptions\"><code>ses.preconnect(options)</code></a></h4>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>url</code> String - URL for preconnect. Only the origin is relevant for opening the socket.</li>\n<li><code>numSockets</code> Number (optional) - number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.</li>\n</ul></li>\n</ul>\n<p>Preconnects the given number of sockets to an origin.</p>\n<h4 id=\"sescloseallconnections\"><a href=\"#sescloseallconnections\"><code>ses.closeAllConnections()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when all connections are closed.</p>\n<p><strong>Note:</strong> It will terminate / fail all requests currently in flight.</p>\n<h4 id=\"sesdisablenetworkemulation\"><a href=\"#sesdisablenetworkemulation\"><code>ses.disableNetworkEmulation()</code></a></h4>\n<p>Disables any network emulation already active for the <code>session</code>. Resets to the original network configuration.</p>\n<h4 id=\"sessetcertificateverifyprocproc\"><a href=\"#sessetcertificateverifyprocproc\"><code>ses.setCertificateVerifyProc(proc)</code></a></h4>\n<ul>\n<li><code>proc</code> Function | null<ul>\n<li><code>request</code> Object<ul>\n<li><code>hostname</code> String</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">证书</a></li>\n<li><code>validatedCertificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>verificationResult</code> String - chromium证书验证结果</li>\n<li><code>errorCode</code> Integer - 错误代码</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>verificationResult</code> Integer - Value can be one of certificate error codes from <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">here</a>. Apart from the certificate error codes, the following special codes can be used.<ul>\n<li><code>-0</code> - 表示成功并禁用证书透明度验证</li>\n<li><code>-2</code> - 表示失败</li>\n<li><code>-3</code> - 使用chromium的验证结果</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>每当一个服务器证书请求验证，<code>proc</code> 将被这样 <code>proc(request, callback)</code> 调用，为 <code>session</code> 设置证书验证过程。 回调函数 <code>callback(0)</code> 接受证书，<code>callback(-2)</code> 驳回证书。</p>\n<p>调用 <code> setCertificateVerifyProc（null）</code>将恢复为默认证书验证过程。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.webContents.session.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">request, callback</span>) =></span> {\n  <span class=\"hljs-keyword\">const</span> { hostname } = request\n  <span class=\"hljs-keyword\">if</span> (hostname === <span class=\"hljs-string\">'github.com'</span>) {\n    callback(<span class=\"hljs-number\">0</span>)\n  } <span class=\"hljs-keyword\">else</span> {\n    callback(<span class=\"hljs-number\">-2</span>)\n  }\n})\n</code></pre>\n<blockquote>\n<p><strong>NOTE:</strong> The result of this procedure is cached by the network service.</p>\n</blockquote>\n<h4 id=\"sessetpermissionrequesthandlerhandler\"><a href=\"#sessetpermissionrequesthandlerhandler\"><code>ses.setPermissionRequestHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Function | null<ul>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a> - 请求权限的WebContents。  Please note that if the request comes from a subframe you should use <code>requestingUrl</code> to check the request origin.</li>\n<li><code>permission</code> String - The type of requested permission.<ul>\n<li><code>clipboard-read</code> - Request access to read from the clipboard.</li>\n<li><code>media</code> -  Request access to media devices such as camera, microphone and speakers.</li>\n<li><code>display-capture</code> - Request access to capture the screen.</li>\n<li><code>mediaKeySystem</code> - Request access to DRM protected content.</li>\n<li><code>geolocation</code> - Request access to user's current location.</li>\n<li><code>notifications</code> - Request notification creation and the ability to display them in the user's system tray.</li>\n<li><code>midi</code> - Request MIDI access in the <code>webmidi</code> API.</li>\n<li><code>midiSysex</code> - Request the use of system exclusive messages in the <code>webmidi</code> API.</li>\n<li><code>pointerLock</code> - Request to directly interpret mouse movements as an input method. Click <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API\">here</a> to know more.</li>\n<li><code>fullscreen</code> - Request for the app to enter fullscreen mode.</li>\n<li><code>openExternal</code> - Request to open links in external applications.</li>\n<li><code>unknown</code> - An unrecognized permission request</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>permissionGranted</code> Boolean - 允许或拒绝该权限.</li>\n</ul></li>\n<li><code>details</code> Object - Some properties are only available on certain permission types.<ul>\n<li><code>externalURL</code> String (optional) - The url of the <code>openExternal</code> request.</li>\n<li><code>mediaTypes</code> String<a href=\"/docs/api/optional\"></a> - The types of media access being requested, elements can be <code>video</code> or <code>audio</code></li>\n<li><code>requestingUrl</code> String - The last URL the requesting frame loaded</li>\n<li><code>isMainFrame</code> Boolean - Whether the frame making the request is the main frame</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>设置可用于响应 <code>session</code> 的权限请求的处理程序。 调用 <code> callback(true)</code> 将允许该权限, 调用 <code> callback(false)</code> 将拒绝它。 若要清除处理程序, 请调用 <code>setPermissionRequestHandler (null)</code>。  Please note that you must also implement <code>setPermissionCheckHandler</code> to get complete permission handling. Most web APIs do a permission check and then make a permission request if the check is denied.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nsession.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).setPermissionRequestHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, callback</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (webContents.getURL() === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notifications'</span>) {\n    <span class=\"hljs-keyword\">return</span> callback(<span class=\"hljs-literal\">false</span>) <span class=\"hljs-comment\">// denied.</span>\n  }\n\n  callback(<span class=\"hljs-literal\">true</span>)\n})\n</code></pre>\n<h4 id=\"sessetpermissioncheckhandlerhandler\"><a href=\"#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> 函数\\<boolean> | null<ul>\n<li><code>webContents</code> (<a href=\"/docs/api/web-contents\">WebContents</a> | null) - WebContents checking the permission.  Please note that if the request comes from a subframe you should use <code>requestingUrl</code> to check the request origin.  所有进行权限检查的跨源子帧将传递一个 <code>null</code> 的 webContents 对象给此处理程序，而某些其他权限检查（如 <code>notifications</code> 检查）将始终传递一个 <code>null</code>。  You should use <code>embeddingOrigin</code> and <code>requestingOrigin</code> to determine what origin the owning frame and the requesting frame are on respectively.</li>\n<li><code>permission</code> String - Type of permission check.  Valid values are <code>midiSysex</code>, <code>notifications</code>, <code>geolocation</code>, <code>media</code>,<code>mediaKeySystem</code>,<code>midi</code>, <code>pointerLock</code>, <code>fullscreen</code>, <code>openExternal</code>, <code>hid</code>, or <code>serial</code>.</li>\n<li><code>requestingOrigin</code> String - The origin URL of the permission check</li>\n<li><code>details</code> Object - Some properties are only available on certain permission types.<ul>\n<li><code>embeddingOrigin</code> String (optional) - The origin of the frame embedding the frame that made the permission check.  Only set for cross-origin sub frames making permission checks.</li>\n<li><code>securityOrigin</code> String (optional) - The security origin of the <code>media</code> check.</li>\n<li><code>mediaType</code> String (optional) - The type of media access being requested, can be <code>video</code>, <code>audio</code> or <code>unknown</code></li>\n<li><code>requestingUrl</code> String (optional) - The last URL the requesting frame loaded.  This is not provided for cross-origin sub frames making permission checks.</li>\n<li><code>isMainFrame</code> Boolean - Whether the frame making the request is the main frame</li>\n</ul></li>\n</ul></boolean></li>\n</ul>\n<p>Sets the handler which can be used to respond to permission checks for the <code>session</code>. Returning <code>true</code> will allow the permission and <code>false</code> will reject it.  Please note that you must also implement <code>setPermissionRequestHandler</code> to get complete permission handling. Most web APIs do a permission check and then make a permission request if the check is denied. To clear the handler, call <code>setPermissionCheckHandler(null)</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>)\nsession.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(requestingOrigin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notifications'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span> <span class=\"hljs-comment\">// granted</span>\n  }\n\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span> <span class=\"hljs-comment\">// denied</span>\n})\n</code></pre>\n<h4 id=\"sessetdevicepermissionhandlerhandler\"><a href=\"#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> 函数\\<boolean> | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>deviceType</code> String - The type of device that permission is being requested on, can be <code>hid</code>.</li>\n<li><code>origin</code> String - The origin URL of the device permission check.</li>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice</a> - the device that permission is being requested for.</li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a> - WebFrameMain checking the device permission.</li>\n</ul></li>\n</ul></boolean></li>\n</ul>\n<p>Sets the handler which can be used to respond to device permission checks for the <code>session</code>. Returning <code>true</code> will allow the device to be permitted and <code>false</code> will reject it. To clear the handler, call <code>setDevicePermissionHandler(null)</code>. This handler can be used to provide default permissioning to devices without first calling for permission to devices (eg via <code>navigator.hid.requestDevice</code>).  If this handler is not defined, the default device permissions as granted through device selection (eg via <code>navigator.hid.requestDevice</code>) will be used. Additionally, the default behavior of Electron is to store granted device permision through the lifetime of the corresponding WebContents.  If longer term storage is needed, a developer can store granted device permissions (eg when handling the <code>select-hid-device</code> event) and then read from that storage with <code>setDevicePermissionHandler</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.webContents.session.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin, details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-comment\">// Add logic here to determine if permission should be given to allow HID selection</span>\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  <span class=\"hljs-comment\">// Optionally, retrieve previously persisted devices from a persistent store</span>\n  <span class=\"hljs-keyword\">const</span> grantedDevices = fetchGrantedDevices()\n\n  win.webContents.session.setDevicePermissionHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(details.origin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; details.deviceType === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-keyword\">if</span> (details.device.vendorId === <span class=\"hljs-number\">123</span> &#x26;&#x26; details.device.productId === <span class=\"hljs-number\">345</span>) {\n        <span class=\"hljs-comment\">// Always allow this type of device (this allows skipping the call to `navigator.hid.requestDevice` first)</span>\n        <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n      }\n\n      <span class=\"hljs-comment\">// Search through the list of devices that have previously been granted permission</span>\n      <span class=\"hljs-keyword\">return</span> grantedDevices.some(<span class=\"hljs-function\">(<span class=\"hljs-params\">grantedDevice</span>) =></span> {\n        <span class=\"hljs-keyword\">return</span> grantedDevice.vendorId === details.device.vendorId &#x26;&#x26;\n              grantedDevice.productId === details.device.productId &#x26;&#x26;\n              grantedDevice.serialNumber &#x26;&#x26; grantedDevice.serialNumber === details.device.serialNumber\n      })\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  win.webContents.session.on(<span class=\"hljs-string\">'select-hid-device'</span>, (event, details, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedDevice = details.deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    callback(selectedPort?.deviceId)\n  })\n})\n</code></pre>\n<h4 id=\"sesclearhostresolvercache\"><a href=\"#sesclearhostresolvercache\"><code>ses.clearHostResolverCache()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the operation is complete.</p>\n<p>清除主机解析程序的缓存。</p>\n<h4 id=\"sesallowntlmcredentialsfordomainsdomains\"><a href=\"#sesallowntlmcredentialsfordomainsdomains\"><code>ses.allowNTLMCredentialsForDomains(domains)</code></a></h4>\n<ul>\n<li><code>domains</code> String - 一个逗号分隔的服务器列表, 用于收集已经启用身份验证的服务器。</li>\n</ul>\n<p>动态设置是否始终为 HTTP NTLM 发送凭据或协商身份验证。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">// 以 \"example.com\"、\"foobar.com\"、\"baz\" 结尾的 url 用于身份验证。</span>\nsession.defaultSession.allowNTLMCredentialsForDomains(<span class=\"hljs-string\">'*example.com, *foobar.com, *baz'</span>)\n\n<span class=\"hljs-comment\">// 所有的 url 都可以用作身份验证</span>\nsession.defaultSession.allowNTLMCredentialsForDomains(<span class=\"hljs-string\">'*'</span>)\n</code></pre>\n<h4 id=\"sessetuseragentuseragent-acceptlanguages\"><a href=\"#sessetuseragentuseragent-acceptlanguages\"><code>ses.setUserAgent(userAgent[, acceptLanguages])</code></a></h4>\n<ul>\n<li><code>userAgent</code> String</li>\n<li><code>acceptLanguages</code> String (可选)</li>\n</ul>\n<p>覆盖当前会话的 <code>userAgent</code> 和 <code>acceptLanguages</code>.</p>\n<p><code>acceptLanguages</code> 必须是用逗号分隔的语言代码列表，例如 <code>\"en-US,fr,de,ko,zh-CN,ja\"</code>.</p>\n<p>这不会影响现有的<code>WebContents</code>, 并且每个<code>WebContents</code>都可以使用 <code>webContents.setUserAgent</code>重写会话范围的user agent。</p>\n<h4 id=\"sesispersistent\"><a href=\"#sesispersistent\"><code>ses.isPersistent()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether or not this session is a persistent one. The default <code>webContents</code> session of a <code>BrowserWindow</code> is persistent. When creating a session from a partition, session prefixed with <code>persist:</code> will be persistent, while others will be temporary.</p>\n<h4 id=\"sesgetuseragent\"><a href=\"#sesgetuseragent\"><code>ses.getUserAgent()</code></a></h4>\n<p>返回 <code>String</code> - 当前会话的 user agent.</p>\n<h4 id=\"sessetsslconfigconfig\"><a href=\"#sessetsslconfigconfig\"><code>ses.setSSLConfig(config)</code></a></h4>\n<ul>\n<li><code>config</code> Object<ul>\n<li><code>minVersion</code> String (可选) - 值可以是 <code>tls1</code>， <code>tls1.1</code>， <code>tls1.2</code> 或 <code>tls1.3</code>。 The minimum SSL version to allow when connecting to remote servers. 默认为<code>tls1</code>。</li>\n<li><code>maxVersion</code> String (可选) - 可以是 <code>tls1.2</code> 或 <code>tls1.3</code>。 The maximum SSL version to allow when connecting to remote servers. 默认值为 <code>tls1.3</code>。</li>\n<li><code>disabledCipherSuites</code> Integer<a href=\"/docs/api/optional\"></a> - List of cipher suites which should be explicitly prevented from being used in addition to those disabled by the net built-in policy. Supported literal forms: 0xAABB, where AA is <code>cipher_suite[0]</code> and BB is <code>cipher_suite[1]</code>, as defined in RFC 2246, Section 7.4.1.2. Unrecognized but parsable cipher suites in this form will not return an error. Ex: To disable TLS_RSA_WITH_RC4_128_MD5, specify 0x0004, while to disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002. Note that TLSv1.3 ciphers cannot be disabled using this mechanism.</li>\n</ul></li>\n</ul>\n<p>Sets the SSL configuration for the session. All subsequent network requests will use the new configuration. Existing network connections (such as WebSocket connections) will not be terminated, but old sockets in the pool will not be reused for new connections.</p>\n<h4 id=\"sesgetblobdataidentifier\"><a href=\"#sesgetblobdataidentifier\"><code>ses.getBlobData(identifier)</code></a></h4>\n<ul>\n<li><code>identifier</code> String - 有效的 UUID.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Buffer></code> - resolves with blob data.</p>\n<h4 id=\"sesdownloadurlurl\"><a href=\"#sesdownloadurlurl\"><code>ses.downloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code>. The API will generate a <a href=\"/docs/api/download-item\">DownloadItem</a> that can be accessed with the <a href=\"#event-will-download\">will-download</a> event.</p>\n<p><strong>Note:</strong> This does not perform any security checks that relate to a page's origin, unlike <a href=\"/docs/api/web-contents#contentsdownloadurlurl\"><code>webContents.downloadURL</code></a>.</p>\n<h4 id=\"sescreateinterrupteddownloadoptions\"><a href=\"#sescreateinterrupteddownloadoptions\"><code>ses.createInterruptedDownload(options)</code></a></h4>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>path</code> String - 下载的绝对路径.</li>\n<li><code>urlChain</code> String[] - 完整的 url 下载地址.</li>\n<li><code>mimeType</code> String (可选)</li>\n<li><code>offset</code> Integer - 下载的开始范围.</li>\n<li><code>length</code> Integer - 下载的总长度。</li>\n<li><code>lastModified</code> String (optional) - Last-Modified header value.</li>\n<li><code>eTag</code> String (optional) - ETag header value.</li>\n<li><code>startTime</code> Double (optional) - 下载的时间是从 UNIX 时代以来的秒数开始的。</li>\n</ul></li>\n</ul>\n<p>允许从上一个 <code>Session</code> 恢复 <code>cancelled</code> 或 <code>interrupted</code> 下载。 该 API 将生成一个 <a href=\"/docs/api/download-item\"> DownloadItem </a>, 可使用 <a href=\"#event-will-download\"> will-download </a> 事件进行访问。 <a href=\"/docs/api/download-item\"> DownloadItem </a> 将不具有与之关联的任何 <code>WebContents</code>, 并且初始状态将为 <code>interrupted</code>。 只有在 <a href=\"/docs/api/download-item\"> DownloadItem </a> 上调用 <code>resume</code> API 时, 才会启动下载。</p>\n<h4 id=\"sesclearauthcache\"><a href=\"#sesclearauthcache\"><code>ses.clearAuthCache()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the session’s HTTP authentication cache has been cleared.</p>\n<h4 id=\"sessetpreloadspreloads\"><a href=\"#sessetpreloadspreloads\"><code>ses.setPreloads(preloads)</code></a></h4>\n<ul>\n<li><code>preloads</code> String[] - 数组，该数组由所有需要进行预加载的脚本的绝对路径组成。</li>\n</ul>\n<p>Adds scripts that will be executed on ALL web contents that are associated with this session just before normal <code>preload</code> scripts run.</p>\n<h4 id=\"sesgetpreloads\"><a href=\"#sesgetpreloads\"><code>ses.getPreloads()</code></a></h4>\n<p>返回 <code>String[]</code> 返回一个数组，这个数组由已经注册过的预加载脚本的路径组成。</p>\n<h4 id=\"sessetspellcheckerenabledenable\"><a href=\"#sessetspellcheckerenabledenable\"><code>ses.setSpellCheckerEnabled(enable)</code></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Sets whether to enable the builtin spell checker.</p>\n<h4 id=\"sesisspellcheckerenabled\"><a href=\"#sesisspellcheckerenabled\"><code>ses.isSpellCheckerEnabled()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the builtin spell checker is enabled.</p>\n<h4 id=\"sessetspellcheckerlanguageslanguages\"><a href=\"#sessetspellcheckerlanguageslanguages\"><code>ses.setSpellCheckerLanguages(languages)</code></a></h4>\n<ul>\n<li><code>languages</code> String[] - An array of language codes to enable the spellchecker for.</li>\n</ul>\n<p>The built in spellchecker does not automatically detect what language a user is typing in.  In order for the spell checker to correctly check their words you must call this API with an array of language codes.  You can get the list of supported language codes with the <code>ses.availableSpellCheckerLanguages</code> property.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and will detect your language automatically.  This API is a no-op on macOS.</p>\n<h4 id=\"sesgetspellcheckerlanguages\"><a href=\"#sesgetspellcheckerlanguages\"><code>ses.getSpellCheckerLanguages()</code></a></h4>\n<p>Returns <code>String[]</code> - An array of language codes the spellchecker is enabled for.  If this list is empty the spellchecker will fallback to using <code>en-US</code>.  By default on launch if this setting is an empty list Electron will try to populate this setting with the current OS locale.  This setting is persisted across restarts.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and has its own list of languages.  This API is a no-op on macOS.</p>\n<h4 id=\"sessetspellcheckerdictionarydownloadurlurl\"><a href=\"#sessetspellcheckerdictionarydownloadurlurl\"><code>ses.setSpellCheckerDictionaryDownloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String - A base URL for Electron to download hunspell dictionaries from.</li>\n</ul>\n<p>By default Electron will download hunspell dictionaries from the Chromium CDN.  If you want to override this behavior you can use this API to point the dictionary downloader at your own hosted version of the hunspell dictionaries.  We publish a <code>hunspell_dictionaries.zip</code> file with each release which contains the files you need to host here, the file server must be <strong>case insensitive</strong> you must upload each file twice, once with the case it has in the ZIP file and once with the filename as all lower case.</p>\n<p>If the files present in <code>hunspell_dictionaries.zip</code> are available at <code>https://example.com/dictionaries/language-code.bdic</code> then you should call this api with <code>ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')</code>.  Please note the trailing slash.  The URL to the dictionaries is formed as <code>${url}${filename}</code>.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and therefore we do not download any dictionary files.  This API is a no-op on macOS.</p>\n<h4 id=\"seslistwordsinspellcheckerdictionary\"><a href=\"#seslistwordsinspellcheckerdictionary\"><code>ses.listWordsInSpellCheckerDictionary()</code></a></h4>\n<p>Returns <code>Promise&#x3C;String[]></code> - An array of all words in app's custom dictionary. Resolves when the full dictionary is loaded from disk.</p>\n<h4 id=\"sesaddwordtospellcheckerdictionaryword\"><a href=\"#sesaddwordtospellcheckerdictionaryword\"><code>ses.addWordToSpellCheckerDictionary(word)</code></a></h4>\n<ul>\n<li><code>word</code> String - The word you want to add to the dictionary</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the word was successfully written to the custom dictionary. This API will not work on non-persistent (in-memory) sessions.</p>\n<p><strong>Note:</strong> On macOS and Windows 10 this word will be written to the OS custom dictionary as well</p>\n<h4 id=\"sesremovewordfromspellcheckerdictionaryword\"><a href=\"#sesremovewordfromspellcheckerdictionaryword\"><code>ses.removeWordFromSpellCheckerDictionary(word)</code></a></h4>\n<ul>\n<li><code>word</code> String - The word you want to remove from the dictionary</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the word was successfully removed from the custom dictionary. This API will not work on non-persistent (in-memory) sessions.</p>\n<p><strong>Note:</strong> On macOS and Windows 10 this word will be removed from the OS custom dictionary as well</p>\n<h4 id=\"sesloadextensionpath-options\"><a href=\"#sesloadextensionpath-options\"><code>ses.loadExtension(path[, options])</code></a></h4>\n<ul>\n<li><code>path</code> String - Path to a directory containing an unpacked Chrome extension</li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>allowFileAccess</code> Boolean - Whether to allow the extension to read local files over <code>file://</code> protocol and inject content scripts into <code>file://</code> pages. This is required e.g. for loading devtools extensions on <code>file://</code> URLs. 默认值为 false.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Extension></code> - resolves when the extension is loaded.</p>\n<p>This method will raise an exception if the extension could not be loaded. If there are warnings when installing the extension (e.g. if the extension requests an API that Electron does not support) then they will be logged to the console.</p>\n<p>Note that Electron does not support the full range of Chrome extensions APIs. See <a href=\"/docs/api/extensions#supported-extensions-apis\">Supported Extensions APIs</a> for more details on what is supported.</p>\n<p>Note that in previous versions of Electron, extensions that were loaded would be remembered for future runs of the application. This is no longer the case: <code>loadExtension</code> must be called on every boot of your app if you want the extension to be loaded.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.on(<span class=\"hljs-string\">'ready'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> session.defaultSession.loadExtension(\n    path.join(__dirname, <span class=\"hljs-string\">'react-devtools'</span>),\n    <span class=\"hljs-comment\">// allowFileAccess is required to load the devtools extension on file:// URLs.</span>\n    { <span class=\"hljs-attr\">allowFileAccess</span>: <span class=\"hljs-literal\">true</span> }\n  )\n  <span class=\"hljs-comment\">// Note that in order to use the React DevTools extension, you'll need to</span>\n  <span class=\"hljs-comment\">// download and unzip a copy of the extension.</span>\n})\n</code></pre>\n<p>This API does not support loading packed (.crx) extensions.</p>\n<p><strong>注意:</strong> 该 API 不能在 <code>app</code> 模块的 <code>ready</code> 事件之前调用.</p>\n<p><strong>Note:</strong> Loading extensions into in-memory (non-persistent) sessions is not supported and will throw an error.</p>\n<h4 id=\"sesremoveextensionextensionid\"><a href=\"#sesremoveextensionextensionid\"><code>ses.removeExtension(extensionId)</code></a></h4>\n<ul>\n<li><code>extensionId</code> String - ID of extension to remove</li>\n</ul>\n<p>Unloads an extension.</p>\n<p><strong>注意:</strong> 该 API 不能在 <code>app</code> 模块的 <code>ready</code> 事件之前调用.</p>\n<h4 id=\"sesgetextensionextensionid\"><a href=\"#sesgetextensionextensionid\"><code>ses.getExtension(extensionId)</code></a></h4>\n<ul>\n<li><code>extensionId</code> String - ID of extension to query</li>\n</ul>\n<p>Returns <code>Extension</code> | <code>null</code> - The loaded extension with the given ID.</p>\n<p><strong>注意:</strong> 该 API 不能在 <code>app</code> 模块的 <code>ready</code> 事件之前调用.</p>\n<h4 id=\"sesgetallextensions\"><a href=\"#sesgetallextensions\"><code>ses.getAllExtensions()</code></a></h4>\n<p>Returns <code>Extension[]</code> - A list of all loaded extensions.</p>\n<p><strong>注意:</strong> 该 API 不能在 <code>app</code> 模块的 <code>ready</code> 事件之前调用.</p>\n<h4 id=\"sesgetstoragepath\"><a href=\"#sesgetstoragepath\"><code>ses.getStoragePath()</code></a></h4>\n<p>A <code>String | null</code> indicating the absolute file system path where data for this session is persisted on disk.  For in memory sessions this returns <code>null</code>.</p>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<p>以下属性在<code>Session</code>实例上可用：</p>\n<h4 id=\"sesavailablespellcheckerlanguages-只读\"><a href=\"#sesavailablespellcheckerlanguages-只读\"><code>ses.availableSpellCheckerLanguages</code> <em>只读</em></a></h4>\n<p>A <code>String[]</code> array which consists of all the known available spell checker languages.  Providing a language code to the <code>setSpellCheckerLanguages</code> API that isn't in this array will result in an error.</p>\n<h4 id=\"sesspellcheckerenabled\"><a href=\"#sesspellcheckerenabled\"><code>ses.spellCheckerEnabled</code></a></h4>\n<p>A <code>Boolean</code> indicating whether builtin spell checker is enabled.</p>\n<h4 id=\"sesstoragepath-只读\"><a href=\"#sesstoragepath-只读\"><code>ses.storagePath</code> <em>只读</em></a></h4>\n<p>A <code>String | null</code> indicating the absolute file system path where data for this session is persisted on disk.  For in memory sessions this returns <code>null</code>.</p>\n<h4 id=\"sescookies-只读\"><a href=\"#sescookies-只读\"><code>ses.cookies</code> <em>只读</em></a></h4>\n<p>A <a href=\"/docs/api/cookies\"><code>Cookies</code></a> object for this session.</p>\n<h4 id=\"sesserviceworkers-只读\"><a href=\"#sesserviceworkers-只读\"><code>ses.serviceWorkers</code> <em>只读</em></a></h4>\n<p>A <a href=\"/docs/api/service-workers\"><code>ServiceWorkers</code></a> object for this session.</p>\n<h4 id=\"seswebrequest-只读\"><a href=\"#seswebrequest-只读\"><code>ses.webRequest</code> <em>只读</em></a></h4>\n<p>A <a href=\"/docs/api/web-request\"><code>WebRequest</code></a> object for this session.</p>\n<h4 id=\"sesprotocol-只读\"><a href=\"#sesprotocol-只读\"><code>ses.protocol</code> <em>只读</em></a></h4>\n<p>Session中使用<a href=\"/docs/api/protocol\"><code>Protocol</code></a>对象</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> protocol = session.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).protocol\n  <span class=\"hljs-keyword\">if</span> (!protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })) {\n    <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Failed to register protocol'</span>)\n  }\n})\n</code></pre>\n<h4 id=\"sesnetlog-只读\"><a href=\"#sesnetlog-只读\"><code>ses.netLog</code> <em>只读</em></a></h4>\n<p>A <a href=\"/docs/api/net-log\"><code>NetLog</code></a> object for this session.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> netLog = session.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).netLog\n  netLog.startLogging(<span class=\"hljs-string\">'/path/to/net-log'</span>)\n  <span class=\"hljs-comment\">// After some network events</span>\n  <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> netLog.stopLogging()\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Net-logs written to'</span>, path)\n})\n</code></pre>",
      "title": "session",
      "description": "管理浏览器会话、cookie、缓存、代理设置等。"
    },
    "/docs/development/setting-up-symbol-server": {
      "locale": "zh-CN",
      "slug": "setting-up-symbol-server",
      "href": "/docs/development/setting-up-symbol-server",
      "crowdinFileId": "256165",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/setting-up-symbol-server.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"在调试器中设置-symbol-服务器\"><a href=\"#在调试器中设置-symbol-服务器\">在调试器中设置 Symbol 服务器</a></h1>\n<p>调试 symbols 让你能更好的调试 sessions. 它们有可执行的动态库的函数信息，并且提供信息来获得干净的调用堆栈. 一个 Symbol 服务器允许调试器自动加载正确的 symbols, 二进制文件 和 资源文件，不用再去强制用户下载巨大的调试文件. 服务器函数类似 <a href=\"https://support.microsoft.com/kb/311503\">Microsoft's symbol server</a>，所以这些文档是可以使用的。</p>\n<p>注意，因为公众版本的 Electron 构建是最优化的，调试不一定一直简单. 调试器将不会给显示出所有变量内容，并且因为内联，尾调用，和其它编译器优化，执行路径会看起来很怪异. 唯一的解决办法是搭建一个不优化的本地构建.</p>\n<p>Electron 使用的官方 symbol 服务器地址为 <a href=\"https://symbols.electronjs.org\">https://symbols.electronjs.org</a>. 你不能直接访问这个路径，必须将其添加到你的调试工具的 symbol 路径上. 在下面的例子中，使用了一个本地缓存目录来避免重复从服务器获取 PDB. 在你的电脑上使用一个恰当的缓存目录来代替 <code>c:\\code\\symbols</code>.</p>\n<h2 id=\"在-windbg-中使用-symbol-服务器\"><a href=\"#在-windbg-中使用-symbol-服务器\">在 Windbg 中使用 Symbol 服务器</a></h2>\n<p>Windbg symbol 路径被配制为一个限制带星号字符的字符串. 要只使用 Electron 的 symbol 服务器, 将下列记录添加到你的 symbol 路径 (<strong>注意:</strong> 如果你愿意使用一个不同的地点来下载 symbols，你可以在你的电脑中使用任何可写的目录来代替 <code>c:\\code\\symbols</code>):</p>\n<pre><code class=\"hljs language-powershell\">SRV*c:\\code\\symbols\\*https://symbols.electronjs.org\n</code></pre>\n<p>使用 Windbg 菜单或通过输入 <code>.sympath</code> 命令，在环境中设置一个 <code>_NT_SYMBOL_PATH</code> 字符串. 如果你也想从微软的 symbol 服务器获得 symbols ，你应当首先将它们先列出来:</p>\n<pre><code class=\"hljs language-powershell\">SRV*c:\\code\\symbols\\*https://msdl.microsoft.com/download/symbols;SRV*c:\\code\\symbols\\*https://symbols.electronjs.org\n</code></pre>\n<h2 id=\"在-visual-studio-中使用-symbol-服务器\"><a href=\"#在-visual-studio-中使用-symbol-服务器\">在 Visual Studio 中使用 symbol 服务器</a></h2>\n<p><img src=\"https://mdn.mozillademos.org/files/733/symbol-server-vc8express-menu.jpg\" alt=\"Tools -> Options\"> <img src=\"https://mdn.mozillademos.org/files/2497/2005_options.gif\" alt=\"Symbols Settings\"></p>\n<h2 id=\"故障排除：symbol-未加载\"><a href=\"#故障排除：symbol-未加载\">故障排除：symbol 未加载</a></h2>\n<p>在 Windbg 中输入下列命令，来打印出为什么 symbols 没有加载:</p>\n<pre><code class=\"hljs language-powershell\">> !sym noisy\n> .reload /f electron.exe\n</code></pre>",
      "title": "在调试器中设置 Symbol 服务器",
      "description": ""
    },
    "/docs/api/share-menu": {
      "locale": "zh-CN",
      "slug": "share-menu",
      "href": "/docs/api/share-menu",
      "crowdinFileId": "256367",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/share-menu.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharemenu\"><a href=\"#sharemenu\">ShareMenu</a></h1>\n<p><code>ShareMenu</code> 类用于创建macOS的<a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/\">Share Menu</a>专用菜单 ，这可以将当前消息分享给其他应用、社交媒体账号等。</p>\n<p>若要将共享菜单放在其他菜单下，使用<a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>当中的<code>shareMenu</code> 。</p>\n<h2 id=\"class-sharemenu\"><a href=\"#class-sharemenu\">Class: ShareMenu</a></h2>\n<blockquote>\n<p>Create share menu on macOS.</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<h3 id=\"new-sharemenusharingitem\"><a href=\"#new-sharemenusharingitem\"><code>new ShareMenu(sharingItem)</code></a></h3>\n<ul>\n<li><code>sharingItem</code> SharingItem - The item to share.</li>\n</ul>\n<p>Creates a new share menu.</p>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<p><code> shareMenu</code> 对象具有以下实例方法:</p>\n<h4 id=\"sharemenupopupoptions\"><a href=\"#sharemenupopupoptions\"><code>shareMenu.popup([options])</code></a></h4>\n<ul>\n<li><code>options</code> PopupOptions (optional)<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (可选) - 默认为选中窗口.</li>\n<li><code>x</code> Number (可选) - 默认为当前鼠标的位置。 如果指定了<code>y</code>，则该选项必选。</li>\n<li><code>y</code> Number (可选) - 默认为当前鼠标的位置。 如果指定了<code>x</code>，则该选项必选。</li>\n<li><code>positioningItem</code> Number (optional) <em>macOS</em> - The index of the menu item to be positioned under the mouse cursor at the specified coordinates. 默认值为 -1。</li>\n<li><code>callback</code> Function (optional) - 会在菜单关闭后被调用.</li>\n</ul></li>\n</ul>\n<p>将此菜单作为 browserWindow <a> 中的上下文菜单弹出。</a></p><a> <p></p>\n<h4 spaces-before=\"0\">\n  <code>shareMenu.closePopup([browserWindow])</code>\n</h4>\n</a><ul><a>\n  </a><li><a>\n    <code>browserWindow</code> </a><a href=\"browser-window.md\">BrowserWindow</a> (可选) - 默认为选中窗口.\n  </li>\n</ul>\n<p spaces-before=\"0\">\n  关闭 <code> browserWindow </code> 中的上下文菜单。\n</p>",
      "title": "ShareMenu",
      "description": "Create share menu on macOS."
    },
    "/docs/api/structures/shared-worker-info": {
      "locale": "zh-CN",
      "slug": "shared-worker-info",
      "href": "/docs/api/structures/shared-worker-info",
      "crowdinFileId": "256505",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/shared-worker-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharedworkerinfo-object\"><a href=\"#sharedworkerinfo-object\">SharedWorkerInfo Object</a></h1>\n<ul>\n<li><code>id</code> String - The unique id of the shared worker.</li>\n<li><code>url</code> String - The url of the shared worker.</li>\n</ul>",
      "title": "SharedWorkerInfo Object",
      "description": ""
    },
    "/docs/api/structures/sharing-item": {
      "locale": "zh-CN",
      "slug": "sharing-item",
      "href": "/docs/api/structures/sharing-item",
      "crowdinFileId": "256507",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/sharing-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharingitem-object\"><a href=\"#sharingitem-object\">SharingItem Object</a></h1>\n<ul>\n<li><code>texts</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of text to share.</li>\n<li><code>filePaths</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of files to share.</li>\n<li><code>urls</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of URLs to share.</li>\n</ul>",
      "title": "SharingItem Object",
      "description": ""
    },
    "/docs/api/shell": {
      "locale": "zh-CN",
      "slug": "shell",
      "href": "/docs/api/shell",
      "crowdinFileId": "256369",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/shell.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"shell\"><a href=\"#shell\">shell</a></h1>\n<blockquote>\n<p>使用默认应用程序管理文件和 url。</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a> (non-sandboxed only)</p>\n<p><code>shell</code> 模块提供与桌面集成相关的功能。</p>\n<p>在用户的默认浏览器中打开 URL 的示例:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nshell.openExternal(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<p><strong>Note:</strong> While the <code>shell</code> module can be used in the renderer process, it will not function in a sandboxed renderer.</p>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>shell</code> 模块具有以下方法:</p>\n<h3 id=\"shellshowiteminfolderfullpath\"><a href=\"#shellshowiteminfolderfullpath\"><code>shell.showItemInFolder(fullPath)</code></a></h3>\n<ul>\n<li><code>fullPath</code> String</li>\n</ul>\n<p>Show the given file in a file manager. If possible, select the file.</p>\n<h3 id=\"shellopenpathpath\"><a href=\"#shellopenpathpath\"><code>shell.openPath(path)</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - Resolves with a string containing the error message corresponding to the failure if a failure occurred, otherwise \"\".</p>\n<p>以桌面的默认方式打开给定的文件。</p>\n<h3 id=\"shellopenexternalurl-options\"><a href=\"#shellopenexternalurl-options\"><code>shell.openExternal(url[, options])</code></a></h3>\n<ul>\n<li><code>url</code> String - Max 2081 characters on windows.</li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>activate</code> Boolean (optional) <em>macOS</em> - <code>true</code> to bring the opened application to the foreground. 默认值为 <code>true</code>。</li>\n<li><code>workingDirectory</code>字符串 (可选的) <em>Windows</em> - 工作目录</li>\n</ul></li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code></p>\n<p>Open the given external protocol URL in the desktop's default manner. (For example, mailto: URLs in the user's default mail agent).</p>\n<h3 id=\"shelltrashitempath\"><a href=\"#shelltrashitempath\"><code>shell.trashItem(path)</code></a></h3>\n<ul>\n<li><code>path</code> String - path to the item to be moved to the trash.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the operation has been completed. Rejects if there was an error while deleting the requested item.</p>\n<p>This moves a path to the OS-specific trash location (Trash on macOS, Recycle Bin on Windows, and a desktop-environment-specific location on Linux).</p>\n<h3 id=\"shellbeep\"><a href=\"#shellbeep\"><code>shell.beep()</code></a></h3>\n<p>播放哔哔的声音.</p>\n<h3 id=\"shellwriteshortcutlinkshortcutpath-operation-options-windows\"><a href=\"#shellwriteshortcutlinkshortcutpath-operation-options-windows\"><code>shell.writeShortcutLink(shortcutPath[, operation], options)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>shortcutPath</code> String</li>\n<li><code>operation</code> String (optional) - Default is <code>create</code>, can be one of following:<ul>\n<li><code>create</code> - 创建一个新的快捷方式, 如有必要可以覆盖。</li>\n<li><code>update</code> - 仅更新现有快捷方式上的指定属性。</li>\n<li><code>replace</code> - 覆盖现有快捷方式, 如果快捷方式不存在将会失败。</li>\n</ul></li>\n<li><code>options</code> <a href=\"/docs/api/structures/shortcut-details\">ShortcutDetails</a></li>\n</ul>\n<p>返回 <code>Boolean</code> - 快捷方式是否被成功创建。</p>\n<p>在<code>shortcutPath</code>位置创建或更新一个快捷连接</p>\n<h3 id=\"shellreadshortcutlinkshortcutpath-windows\"><a href=\"#shellreadshortcutlinkshortcutpath-windows\"><code>shell.readShortcutLink(shortcutPath)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>shortcutPath</code> String</li>\n</ul>\n<p>返回 <a href=\"/docs/api/structures/shortcut-details\"><code>ShortcutDetails</code></a></p>\n<p>解析<code>shortcutPath</code>中的快捷链接。</p>\n<p>发生任何错误时将引发异常。</p>",
      "title": "shell",
      "description": "使用默认应用程序管理文件和 url。"
    },
    "/docs/api/structures/shortcut-details": {
      "locale": "zh-CN",
      "slug": "shortcut-details",
      "href": "/docs/api/structures/shortcut-details",
      "crowdinFileId": "256509",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/shortcut-details.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"shortcutdetails-object\"><a href=\"#shortcutdetails-object\">ShortcutDetails Object</a></h1>\n<ul>\n<li><code>target</code> String - The target to launch from this shortcut.</li>\n<li><code>cwd</code> String (optional) - The working directory. Default is empty.</li>\n<li><code>args</code> String (optional) - The arguments to be applied to <code>target</code> when launching from this shortcut. Default is empty.</li>\n<li><code>description</code> String (optional) - The description of the shortcut. Default is empty.</li>\n<li><code>icon</code> String (optional) - The path to the icon, can be a DLL or EXE. <code>icon</code> and <code>iconIndex</code> have to be set together. Default is empty, which uses the target's icon.</li>\n<li><code>iconIndex</code> Number (optional) - The resource ID of icon when <code>icon</code> is a DLL or EXE. Default is 0.</li>\n<li><code>appUserModelId</code> String (optional) - The Application User Model ID. Default is empty.</li>\n<li><code>toastActivatorClsid</code> String (optional) - The Application Toast Activator CLSID. Needed for participating in Action Center.</li>\n</ul>",
      "title": "ShortcutDetails Object",
      "description": ""
    },
    "/docs/api/structures/size": {
      "locale": "zh-CN",
      "slug": "size",
      "href": "/docs/api/structures/size",
      "crowdinFileId": "256511",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/size.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"size-object\"><a href=\"#size-object\">Size Object</a></h1>\n<ul>\n<li><code>width</code> Number</li>\n<li><code>height</code> Number</li>\n</ul>",
      "title": "Size Object",
      "description": ""
    },
    "/docs/tutorial/snapcraft": {
      "locale": "zh-CN",
      "slug": "snapcraft",
      "href": "/docs/tutorial/snapcraft",
      "crowdinFileId": "256249",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/snapcraft.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"snapcraft-guide-linux\"><a href=\"#snapcraft-guide-linux\">Snapcraft Guide (Linux)</a></h1>\n<p>本指南提供了有关如何包装你的 Electron 应用程序的任何 Snapcraft 环境, 包括 Ubuntu 软件中心的信息。</p>\n<h2 id=\"背景和要求\"><a href=\"#背景和要求\">背景和要求</a></h2>\n<p>与更广泛的 Linux 社区一起, 规范旨在解决 <a href=\"https://snapcraft.io/\"><code>snapcraft</code></a> 项目中的许多常见的软件安装问题。 Snaps 是容器化的软件包, 包括所需的依赖项、自动更新和对所有主要 Linux 发行版的工作, 而无需进行系统修改。</p>\n<p>创建 <code>.snap</code> 文件有三种方法:</p>\n<p>1) 使用 <a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a> 或 <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a>, 与 <code>snap</code> 支持的两个工具都不在该框中。 这是最简单的选择。 2) 使用 <code>electron-installer-snap</code>, 它采用 <code>electron-packager</code> 的输出。 3) 使用已经创建的 <code>.deb</code> 包。</p>\n<p>在某些情况下，您需要安装 <code>snapcraft</code> 工具。 安装特定发行版的 <code>snapcraft</code> 的指南<a href=\"https://snapcraft.io/docs/installing-snapcraft\">在这里</a>能看到。</p>\n<h2 id=\"使用-electron-installer-snap\"><a href=\"#使用-electron-installer-snap\">使用 <code>electron-installer-snap</code></a></h2>\n<p>该模块的工作原理与<a href=\"https://github.com/electron/windows-installer\"><code>electron-winstaller</code></a>类似 因为它的范围仅限于构建捕捉包。 你可以这样安装:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron-installer-snap\n</code></pre>\n<h3 id=\"步骤-1-打包你的-electron-应用程序\"><a href=\"#步骤-1-打包你的-electron-应用程序\">步骤 1: 打包你的 Electron 应用程序</a></h3>\n<p>打包应用程序使用 <a href=\"https://github.com/electron/electron-packager\">electron-packager</a> (或类似工具)。 Make sure to remove <code>node_modules</code> that you don't need in your final application, since any module you don't actually need will increase your application's size.</p>\n<p>结构输出应该看起来大致像这样:</p>\n<pre><code class=\"hljs language-plaintext\">.\n└── dist\n    └── app-linux-x64\n        ├── LICENSE\n        ├── LICENSES.chromium.html\n        ├── content_shell.pak\n        ├── app\n        ├── icudtl.dat\n        ├── libgcrypt.so.11\n        ├── libnode.so\n        ├── locales\n        ├── resources\n        ├── v8_context_snapshot.bin\n        └── version\n</code></pre>\n<h3 id=\"步骤-2-运行-electron-installer-snap\"><a href=\"#步骤-2-运行-electron-installer-snap\">步骤 2: 运行 <code>electron-installer-snap</code></a></h3>\n<p>From a terminal that has <code>snapcraft</code> in its <code>PATH</code>, run <code>electron-installer-snap</code> with the only required parameter <code>--src</code>, which is the location of your packaged Electron application created in the first step.</p>\n<pre><code class=\"hljs language-sh\">npx electron-installer-snap --src=out/myappname-linux-x64\n</code></pre>\n<p>If you have an existing build pipeline, you can use <code>electron-installer-snap</code> programmatically. For more information, see the <a href=\"https://docs.snapcraft.io/build-snaps/syntax\">Snapcraft API docs</a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> snap = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-installer-snap'</span>)\n\nsnap(options)\n  .then(<span class=\"hljs-function\"><span class=\"hljs-params\">snapPath</span> =></span> <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Created snap at <span class=\"hljs-subst\">${snapPath}</span>!`</span>))\n</code></pre>\n<h2 id=\"using-snapcraft-with-electron-packager\"><a href=\"#using-snapcraft-with-electron-packager\">Using <code>snapcraft</code> with <code>electron-packager</code></a></h2>\n<h3 id=\"第-1-步：创建示例-snapcraft-项目\"><a href=\"#第-1-步：创建示例-snapcraft-项目\">第 1 步：创建示例 Snapcraft 项目</a></h3>\n<p>创建你的项目目录并将以下内容添加到 <code>snap/snapcraft.yaml</code>：</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">electron-packager-hello-world</span>\n<span class=\"hljs-attr\">version:</span> <span class=\"hljs-string\">'0.1'</span>\n<span class=\"hljs-attr\">summary:</span> <span class=\"hljs-string\">Hello</span> <span class=\"hljs-string\">World</span> <span class=\"hljs-string\">Electron</span> <span class=\"hljs-string\">app</span>\n<span class=\"hljs-attr\">description:</span> <span class=\"hljs-string\">|\n  Simple Hello World Electron app as an example\n</span><span class=\"hljs-attr\">base:</span> <span class=\"hljs-string\">core18</span>\n<span class=\"hljs-attr\">confinement:</span> <span class=\"hljs-string\">strict</span>\n<span class=\"hljs-attr\">grade:</span> <span class=\"hljs-string\">stable</span>\n\n<span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">electron-packager-hello-world:</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">electron-quick-start/electron-quick-start</span> <span class=\"hljs-string\">--no-sandbox</span>\n    <span class=\"hljs-attr\">extensions:</span> <span class=\"hljs-string\">[gnome-3-34]</span>\n    <span class=\"hljs-attr\">plugs:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">browser-support</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">network</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">network-bind</span>\n    <span class=\"hljs-attr\">environment:</span>\n      <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n      <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n      <span class=\"hljs-attr\">TMPDIR:</span> <span class=\"hljs-string\">$XDG_RUNTIME_DIR</span>\n\n<span class=\"hljs-attr\">parts:</span>\n  <span class=\"hljs-attr\">electron-quick-start:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">nil</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">https://github.com/electron/electron-quick-start.git</span>\n    <span class=\"hljs-attr\">override-build:</span> <span class=\"hljs-string\">|\n        npm install electron electron-packager\n        npx electron-packager . --overwrite --platform=linux --output=release-build --prune=true\n        cp -rv ./electron-quick-start-linux-* $SNAPCRAFT_PART_INSTALL/electron-quick-start\n</span>    <span class=\"hljs-attr\">build-snaps:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">node/14/stable</span>\n    <span class=\"hljs-attr\">build-packages:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">unzip</span>\n    <span class=\"hljs-attr\">stage-packages:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnss3</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnspr4</span>\n</code></pre>\n<p>如果要将此示例应用于现有项目：</p>\n<ul>\n<li>替代 <code>source: https://github.com/electron/electron-quick-start.git&#x3C;/0 > 为 &#x3C;code>source: ..</code>.</li>\n<li>替代所有的 <code>electron-quick-start</code> 为你的项目名称。</li>\n</ul>\n<h3 id=\"第-2-步：构建-snap\"><a href=\"#第-2-步：构建-snap\">第 2 步：构建 snap</a></h3>\n<pre><code class=\"hljs language-sh\">$ snapcraft\n\n&#x3C;output snipped>\nSnapped electron-packager-hello-world_0.1_amd64.snap\n</code></pre>\n<h3 id=\"第-3-步：安装-snap\"><a href=\"#第-3-步：安装-snap\">第 3 步：安装 snap</a></h3>\n<pre><code class=\"hljs language-sh\">sudo snap install electron-packager-hello-world_0.1_amd64.snap --dangerous\n</code></pre>\n<h3 id=\"第-4-步：运行-snap\"><a href=\"#第-4-步：运行-snap\">第 4 步：运行 snap</a></h3>\n<pre><code class=\"hljs language-sh\">electron-packager-hello-world\n</code></pre>\n<h2 id=\"使用一个现有的-debian-包\"><a href=\"#使用一个现有的-debian-包\">使用一个现有的 Debian 包</a></h2>\n<p>Snapcraft is capable of taking an existing <code>.deb</code> file and turning it into a <code>.snap</code> file. The creation of a snap is configured using a <code>snapcraft.yaml</code> file that describes the sources, dependencies, description, and other core building blocks.</p>\n<h3 id=\"步骤-1-创建一个-debian-包\"><a href=\"#步骤-1-创建一个-debian-包\">步骤 1: 创建一个 Debian 包</a></h3>\n<p>If you do not already have a <code>.deb</code> package, using <code>electron-installer-snap</code> might be an easier path to create snap packages. However, multiple solutions for creating Debian packages exist, including <a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a>, <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> or <a href=\"https://github.com/unindented/electron-installer-debian\"><code>electron-installer-debian</code></a>.</p>\n<h3 id=\"步骤-2-创建一个-snapcraftyaml\"><a href=\"#步骤-2-创建一个-snapcraftyaml\">步骤 2: 创建一个 snapcraft.yaml</a></h3>\n<p>For more information on the available configuration options, see the <a href=\"https://docs.snapcraft.io/build-snaps/syntax\">documentation on the snapcraft syntax</a>. Let's look at an example:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">myApp</span>\n<span class=\"hljs-attr\">version:</span> <span class=\"hljs-string\">'2.0.0'</span>\n<span class=\"hljs-attr\">summary:</span> <span class=\"hljs-string\">A</span> <span class=\"hljs-string\">little</span> <span class=\"hljs-string\">description</span> <span class=\"hljs-string\">for</span> <span class=\"hljs-string\">the</span> <span class=\"hljs-string\">app.</span>\n<span class=\"hljs-attr\">description:</span> <span class=\"hljs-string\">|\n You know what? This app is amazing! It does all the things\n for you. Some say it keeps you young, maybe even happy.\n</span>\n<span class=\"hljs-attr\">grade:</span> <span class=\"hljs-string\">stable</span>\n<span class=\"hljs-attr\">confinement:</span> <span class=\"hljs-string\">classic</span>\n\n<span class=\"hljs-attr\">parts:</span>\n  <span class=\"hljs-attr\">slack:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">dump</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">my-deb.deb</span>\n    <span class=\"hljs-attr\">source-type:</span> <span class=\"hljs-string\">deb</span>\n    <span class=\"hljs-attr\">after:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">desktop-gtk3</span>\n    <span class=\"hljs-attr\">stage-packages:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libasound2</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnotify4</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnspr4</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnss3</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libpcre3</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libpulse0</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libxss1</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libxtst6</span>\n  <span class=\"hljs-attr\">electron-launch:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">dump</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">files/</span>\n    <span class=\"hljs-attr\">prepare:</span> <span class=\"hljs-string\">|\n      chmod +x bin/electron-launch\n</span>\n<span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">myApp:</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">bin/electron-launch</span> <span class=\"hljs-string\">$SNAP/usr/lib/myApp/myApp</span>\n    <span class=\"hljs-attr\">desktop:</span> <span class=\"hljs-string\">usr/share/applications/myApp.desktop</span>\n    <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n    <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n    <span class=\"hljs-attr\">environment:</span>\n      <span class=\"hljs-attr\">TMPDIR:</span> <span class=\"hljs-string\">$XDG_RUNTIME_DIR</span>\n</code></pre>\n<p>As you can see, the <code>snapcraft.yaml</code> instructs the system to launch a file called <code>electron-launch</code>. In this example, it passes information on to the app's binary:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-meta\">#!/bin/sh\n</span>\n<span class=\"hljs-built_in\">exec</span> <span class=\"hljs-string\">\"<span class=\"hljs-variable\">$@</span>\"</span> --executed-from=<span class=\"hljs-string\">\"<span class=\"hljs-variable\">$(pwd)</span>\"</span> --pid=$$ > /dev/null 2>&#x26;1 &#x26;\n</code></pre>\n<p>Alternatively, if you're building your <code>snap</code> with <code>strict</code> confinement, you can use the <code>desktop-launch</code> command:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">myApp:</span>\n    <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n    <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">env</span> <span class=\"hljs-string\">TMPDIR=$XDG_RUNTIME_DIR</span> <span class=\"hljs-string\">PATH=/usr/local/bin:${PATH}</span> <span class=\"hljs-string\">${SNAP}/bin/desktop-launch</span> <span class=\"hljs-string\">$SNAP/myApp/desktop</span>\n    <span class=\"hljs-attr\">desktop:</span> <span class=\"hljs-string\">usr/share/applications/desktop.desktop</span>\n</code></pre>",
      "title": "Snapcraft Guide (Linux)",
      "description": ""
    },
    "/docs/development/source-code-directory-structure": {
      "locale": "zh-CN",
      "slug": "source-code-directory-structure",
      "href": "/docs/development/source-code-directory-structure",
      "crowdinFileId": "256167",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/source-code-directory-structure.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"源码目录结构\"><a href=\"#源码目录结构\">源码目录结构</a></h1>\n<p>Electron 的源代码主要依据 Chromium 的拆分约定被拆成了许多部分。</p>\n<p>为了更好地理解源代码，您可能需要了解一下 <a href=\"https://dev.chromium.org/developers/design-documents/multi-process-architecture\">Chromium 的多进程架构</a>。</p>\n<h2 id=\"源代码的目录结构\"><a href=\"#源代码的目录结构\">源代码的目录结构</a></h2>\n<pre><code class=\"hljs language-diff\">Electron\n├── build/ - Build configuration files needed to build with GN.\n├── buildflags/ - Determines the set of features that can be conditionally built.\n├── chromium_src/ - Source code copied from Chromium that isn't part of the content layer.\n├── default_app/ - A default app run when Electron is started without\n|                  providing a consumer app.\n├── docs/ - Electron's documentation.\n|   ├── api/ - Documentation for Electron's externally-facing modules and APIs.\n|   ├── development/ - Documentation to aid in developing for and with Electron.\n|   ├── fiddles/ - A set of code snippets one can run in Electron Fiddle.\n|   ├── images/ - Images used in documentation.\n|   └── tutorial/ - Tutorial documents for various aspects of Electron.\n├── lib/ - JavaScript/TypeScript source code.\n|   ├── browser/ - Main process initialization code.\n|   |   ├── api/ - API implementation for main process modules.\n|   |   └── remote/ - Code related to the remote module as it is\n|   |                 used in the main process.\n|   ├── common/ - Relating to logic needed by both main and renderer processes.\n|   |   └── api/ - API implementation for modules that can be used in\n|   |              both the main and renderer processes\n|   ├── isolated_renderer/ - Handles creation of isolated renderer processes when\n|   |                        contextIsolation is enabled.\n|   ├── renderer/ - Renderer process initialization code.\n|   |   ├── api/ - API implementation for renderer process modules.\n|   |   ├── extension/ - Code related to use of Chrome Extensions\n|   |   |                in Electron's renderer process.\n|   |   ├── remote/ - Logic that handles use of the remote module in\n|   |   |             the main process.\n|   |   └── web-view/ - Logic that handles the use of webviews in the\n|   |                   renderer process.\n|   ├── sandboxed_renderer/ - Logic that handles creation of sandboxed renderer\n|   |   |                     processes.\n|   |   └── api/ - API implementation for sandboxed renderer processes.\n|   └── worker/ - Logic that handles proper functionality of Node.js\n|                 environments in Web Workers.\n├── patches/ - Patches applied on top of Electron's core dependencies\n|   |          in order to handle differences between our use cases and\n|   |          default functionality.\n|   ├── boringssl/ - Patches applied to Google's fork of OpenSSL, BoringSSL.\n|   ├── chromium/ - Patches applied to Chromium.\n|   ├── node/ - Patches applied on top of Node.js.\n|   └── v8/ - Patches applied on top of Google's V8 engine.\n├── shell/ - C++ source code.\n|   ├── app/ - 系统入口代码.\n|   ├── browser/ - 包含了主窗口、UI 和所有主进程相关的东西.\n|   |   |          它会告诉渲染进程如何管理页面.\n|   |   ├── ui/ - 不同平台上 UI 部分的实现.\n|   |   |   ├── cocoa/ - Cocoa 部分的源代码.\n|   |   |   ├── win/ - Windows GUI 部分的源代码.\n|   |   |   └── x/ - X11 部分的源代码.\n|   |   ├── api/ - 主进程 API 的实现.\n|   |   ├── net/ - 网络相关的代码.\n|   |   ├── mac/ - 与 Mac 有关的 Objective-C 代码.\n|   |   └── resources/ - Icons, platform-dependent files, etc.\n|   ├── renderer/ - Code that runs in renderer process.\n|   |   └── api/ - 渲染进程 API 的实现.\n|   └── common/ - 同时被主进程和渲染进程用到的代码,\n|       |         包括了一些用来将 node 的消息循环整合到 Chromium 的\n|       |         消息循环中时用到的工具函数和代码.\n|       └── api/ - 同时被主进程和渲染进程使用到的 API 的实现,\n|                  并且是 Electron 内置模块的基础.\n├── spec/ - Components of Electron's test suite run in the renderer process.\n├── spec-main/ - Components of Electron's test suite run in the main process.\n└── BUILD.gn - Electron 的构建规则.\n</code></pre>\n<h2 id=\"其它目录的结构\"><a href=\"#其它目录的结构\">其它目录的结构</a></h2>\n<ul>\n<li><strong>.cloeci</strong> - CircleCI 的 CI 配置文件。</li>\n<li><strong>.github</strong> - GitHub专用配置文件，包括 issue 模板和 CODEOWNERS。</li>\n<li><strong>dist</strong> - 由脚本 <code>script/create-dist.py</code> 创建的临时发布目录.</li>\n<li><strong>node_modules</strong> - 在构建中用到的第三方 node 模块.</li>\n<li><strong>npm</strong> - 通过 npm 安装 Electron 的逻辑。</li>\n<li><strong>out</strong> - <code>ninja</code> 的临时输出目录.</li>\n<li><strong>script</strong> - 用于诸如构建、打包、测试等开发用途的脚本等.</li>\n</ul>\n<pre><code class=\"hljs language-diff\">script/ - The set of all scripts Electron runs for a variety of purposes.\n├── codesign/ - Fakes codesigning for Electron apps; used for testing.\n├── lib/ - Miscellaneous python utility scripts.\n└── release/ - Scripts run during Electron's release process.\n    ├── notes/ - Generates release notes for new Electron versions.\n    └── uploaders/ - Uploads various release-related files during release.\n</code></pre>\n<ul>\n<li><strong>typings</strong> - Electron的内部代码的 TypeScript typings。</li>\n</ul>",
      "title": "源码目录结构",
      "description": ""
    },
    "/docs/tutorial/spellchecker": {
      "locale": "zh-CN",
      "slug": "spellchecker",
      "href": "/docs/tutorial/spellchecker",
      "crowdinFileId": "256251",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/spellchecker.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"拼写检查器\"><a href=\"#拼写检查器\">拼写检查器</a></h1>\n<p>自 Electron 8 以来已内置支持 Chromium 拼写检查器。  On Windows and Linux this is powered by Hunspell dictionaries, and on macOS it makes use of the native spellchecker APIs.</p>\n<h2 id=\"how-to-enable-the-spellchecker\"><a href=\"#how-to-enable-the-spellchecker\">How to enable the spellchecker?</a></h2>\n<p>对于 Electron 9 及以上，默认启用拼写检查器。  For Electron 8 you need to enable it in <code>webPreferences</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> myWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">spellcheck</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h2 id=\"how-to-set-the-languages-the-spellchecker-uses\"><a href=\"#how-to-set-the-languages-the-spellchecker-uses\">How to set the languages the spellchecker uses?</a></h2>\n<p>On macOS as we use the native APIs there is no way to set the language that the spellchecker uses. 默认情况下，macOS 本机拼写检查器会自动检测您使用的语言。</p>\n<p>对于 Windows 和 Linux，你应该使用一些 Electron API 来设置拼写检查器的语言。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Sets the spellchecker to check English US and French</span>\nmyWindow.session.setSpellCheckerLanguages([<span class=\"hljs-string\">'en-US'</span>, <span class=\"hljs-string\">'fr'</span>])\n\n<span class=\"hljs-comment\">// An array of all available language codes</span>\n<span class=\"hljs-keyword\">const</span> possibleLanguages = myWindow.session.availableSpellCheckerLanguages\n</code></pre>\n<p>By default the spellchecker will enable the language matching the current OS locale.</p>\n<h2 id=\"how-do-i-put-the-results-of-the-spellchecker-in-my-context-menu\"><a href=\"#how-do-i-put-the-results-of-the-spellchecker-in-my-context-menu\">How do I put the results of the spellchecker in my context menu?</a></h2>\n<p>All the required information to generate a context menu is provided in the <a href=\"/docs/api/web-contents#event-context-menu\"><code>context-menu</code></a> event on each <code>webContents</code> instance.  下面提供了一个小的示例，如何用此信息制作上下文菜单。</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { Menu, MenuItem } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nmyWindow.webContents.on(<span class=\"hljs-string\">'context-menu'</span>, (event, params) => {\n  <span class=\"hljs-keyword\">const</span> menu = <span class=\"hljs-keyword\">new</span> Menu()\n\n  <span class=\"hljs-comment\">// Add each spelling suggestion</span>\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> suggestion <span class=\"hljs-keyword\">of</span> params.dictionarySuggestions) {\n    menu.append(<span class=\"hljs-keyword\">new</span> MenuItem({\n      <span class=\"hljs-attr\">label</span>: suggestion,\n      <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> mainWindow.webContents.replaceMisspelling(suggestion)\n    }))\n  }\n\n  <span class=\"hljs-comment\">// Allow users to add the misspelled word to the dictionary</span>\n  <span class=\"hljs-keyword\">if</span> (params.misspelledWord) {\n    menu.append(\n      <span class=\"hljs-keyword\">new</span> MenuItem({\n        <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Add to dictionary'</span>,\n        <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> mainWindow.webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord)\n      })\n    )\n  }\n\n  menu.popup()\n})\n</code></pre>\n<h2 id=\"does-the-spellchecker-use-any-google-services\"><a href=\"#does-the-spellchecker-use-any-google-services\">Does the spellchecker use any Google services?</a></h2>\n<p>虽然拼写检查器本身没有发送任何输入， 单词或用户输入到谷歌服务中，hunspell 字典文件默认从谷歌 CDN 下载。  如果你想要避免这种情况，你可以提供一个替代 URL 来下载字典。</p>\n<pre><code class=\"hljs language-js\">myWindow.session.setSpellCheckerDictionaryDownloadURL(<span class=\"hljs-string\">'https://example.com/dictionaries/'</span>)\n</code></pre>\n<p>Check out the docs for <a href=\"/docs/api/session#sessetspellcheckerdictionarydownloadurlurl\"><code>session.setSpellCheckerDictionaryDownloadURL</code></a> for more information on where to get the dictionary files from and how you need to host them.</p>",
      "title": "拼写检查器",
      "description": ""
    },
    "/docs/styleguide": {
      "locale": "zh-CN",
      "slug": "styleguide",
      "href": "/docs/styleguide",
      "crowdinFileId": "256125",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/styleguide.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-文档风格指南\"><a href=\"#electron-文档风格指南\">Electron 文档风格指南</a></h1>\n<p>这里是一些编写 Electron 文档的指南。</p>\n<h2 id=\"标题\"><a href=\"#标题\">标题</a></h2>\n<ul>\n<li>每个页面顶部必须有一个 <code>#</code> 级标题。</li>\n<li>同一页面中的各章节必须有 <code>##</code> 级标题。</li>\n<li>各小节需要根据其嵌套层级在头部增加 <code>#</code> 的数量。</li>\n<li>页面标题必须按照 <a href=\"https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case\">APA 标题大小写</a>。</li>\n<li>所有章节都必须遵循 <a href=\"https://apastyle.apa.org/style-grammar-guidelines/capitalization/sentence-case\">APA语句大小写</a>。</li>\n</ul>\n<p>举一个<code>Quick Start</code>的例子:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># 快速入门</span>\n\n...\n\n<span class=\"hljs-section\">## 主进程</span>\n\n<span class=\"hljs-section\">## 渲染进程</span>\n\n...\n\n<span class=\"hljs-section\">## 运行应用程序</span>\n\n...\n\n<span class=\"hljs-section\">### 作为分发版本运行</span>\n\n...\n\n<span class=\"hljs-section\">### 手动下载二进制格式的 Electron</span>\n\n...\n</code></pre>\n<p>对于 API 参考, 可以例外于这些规则.</p>\n<h2 id=\"markdown-规则\"><a href=\"#markdown-规则\">Markdown 规则</a></h2>\n<p>这个仓库使用 <a href=\"https://github.com/DavidAnson/markdownlint\"><code>markdownline</code></a> 软件包来实行前后一致的 Markdown 风格。 有关确切规则，请参阅根文件夹中的 <code>.markdownlint.json</code> 文件。</p>\n<p>有几个样式准则不在 linter 规则范围之内：</p>\n<!--TODO(erickzhao): make sure this matches with the lint:markdownlint task-->\n<ul>\n<li>在代码块中使用<code>bash</code>而不是<code>cmd</code>（由于语法高亮问题）.</li>\n<li>为了可读性，如果可能，保持一行长度在80到100个字符之间。</li>\n<li>列表嵌套不超出2级 (由于 Markdown 渲染问题).</li>\n<li>所有的<code> js</code> 和<code>javascript</code>代码块均被标记为<a href=\"https://www.npmjs.com/package/standard-markdown\"> standard-markdown</a>.</li>\n<li>对于无序列表，请使用星号而不是破折号.</li>\n</ul>\n<h2 id=\"用词选择\"><a href=\"#用词选择\">用词选择</a></h2>\n<ul>\n<li>在描述结果时，使用 “will” 而不是 “would”。</li>\n<li>首选 \"in the ___ process\" 而不是 \"on\".</li>\n</ul>\n<h2 id=\"api-参考\"><a href=\"#api-参考\">API 参考</a></h2>\n<p>以下规则仅适用于 API 的文档。</p>\n<h3 id=\"标题和描述\"><a href=\"#标题和描述\">标题和描述</a></h3>\n<p>每个模块的API文档必须使用由 <code>require('electron')</code> 返回的实际对象名称作为标题。(例如<code> BrowserWindow``autoUpdater</code> 和 <code>session</code>)。</p>\n<p>直接在页面标题下方，添加一行模块描述作为Markdown 引用(以 <code>></code> 开头)。</p>\n<p>以使用 <code>session</code> 模块作为例子:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># session</span>\n\n<span class=\"hljs-quote\">> Manage browser sessions, cookies, cache, proxy settings, etc.</span>\n</code></pre>\n<h3 id=\"模块方法和事件\"><a href=\"#模块方法和事件\">模块方法和事件</a></h3>\n<p>对于非类的模块，它们的方法和事件必须在 <code>## Methods</code> 和 <code>## Events </code>章节中列出</p>\n<p>举一个 <code>autoUpdater</code> 的例子:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># autoUpdater</span>\n\n<span class=\"hljs-section\">## Events</span>\n\n<span class=\"hljs-section\">### Event: 'error'</span>\n\n<span class=\"hljs-section\">## Methods</span>\n\n<span class=\"hljs-section\">### `autoUpdater.setFeedURL(url[, requestHeaders])`</span>\n</code></pre>\n<h3 id=\"类\"><a href=\"#类\">类</a></h3>\n<ul>\n<li>API 类或作为模块一部分的类必须在 <code>## Class: TheClassName</code> 章节中列出.</li>\n<li>一个页面可以有多个类.</li>\n<li>构造函数必须用 <code>###</code> 级标题列出。</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static\">静态方法</a> 必须在 <code>### Static Methods</code> 章节中列出。</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Prototype_methods\">实例方法</a> 必须在 <code>### Instance Methods</code> 章节中列出。</li>\n<li>所有具有返回值的方法都必须以“Returns <code>[TYPE]</code> - [Return description]”开始<ul>\n<li>如果该方法返回一个 <code>Object</code>，其结构可以使用冒号后跟换行符的方式，然后使用与函数参数相同样式的无序属性列表。</li>\n</ul></li>\n<li>实例事件必须在 <code>### Instance Events</code> 章节中列出.</li>\n<li>实例属性必须在 <code>### Instance Properties</code> 章节中列出。<ul>\n<li>实例属性必须以 \"[属性类型] ...\" 开头。</li>\n</ul></li>\n</ul>\n<p>这里用 <code>Session</code> 和 <code>Cookies</code> 类作为例子:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># session</span>\n\n<span class=\"hljs-section\">## Methods</span>\n\n<span class=\"hljs-section\">### session.fromPartition(partition)</span>\n\n<span class=\"hljs-section\">## Static Properties</span>\n\n<span class=\"hljs-section\">### session.defaultSession</span>\n\n<span class=\"hljs-section\">## Class: Session</span>\n\n<span class=\"hljs-section\">### Instance Events</span>\n\n<span class=\"hljs-section\">#### Event: 'will-download'</span>\n\n<span class=\"hljs-section\">### Instance Methods</span>\n\n<span class=\"hljs-section\">#### `ses.getCacheSize()`</span>\n\n<span class=\"hljs-section\">### Instance Properties</span>\n\n<span class=\"hljs-section\">#### `ses.cookies`</span>\n\n<span class=\"hljs-section\">## Class: Cookies</span>\n\n<span class=\"hljs-section\">### Instance Methods</span>\n\n<span class=\"hljs-section\">#### `cookies.get(filter, callback)`</span>\n</code></pre>\n<h3 id=\"方法及其参数\"><a href=\"#方法及其参数\">方法及其参数</a></h3>\n<p>方法章节必须采用以下形式：</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### `objectName.methodName(required[, optional]))`</span>\n<span class=\"hljs-bullet\">\n* </span><span class=\"hljs-code\">`required`</span> String - A parameter description.\n<span class=\"hljs-bullet\">* </span><span class=\"hljs-code\">`optional`</span> Integer (optional) - Another parameter description.\n\n...\n</code></pre>\n<h4 id=\"标题级别\"><a href=\"#标题级别\">标题级别</a></h4>\n<p>标题可以是 <code>###</code> 级别或 <code>####</code> 级别，具体取决于该方法是属于模块还是类。</p>\n<h4 id=\"函数签名\"><a href=\"#函数签名\">函数签名</a></h4>\n<p>对于模块， <code>objectName</code> 是模块的名称。 对于类，它必须是类实例的名称，而且不能与模块名称相同。</p>\n<p>例如，<code>session</code> 模块下的 <code>Session</code> 类的方法必须使用 <code>ses</code> 作为 <code>objectName</code> 。</p>\n<p>可选参数使用方括号 <code>[]</code> 表示，并且多个参数之间以逗号分隔：</p>\n<pre><code class=\"hljs language-markdown\">required[, optional]\n</code></pre>\n<h4 id=\"参数描述\"><a href=\"#参数描述\">参数描述</a></h4>\n<p>关于每个参数的更详细信息将在方法下面的无序列表中列出。 参数类型是由 JavaScript 原始类型(例如: <code>String</code>, <code>Promise</code>, 或 <code>Object</code>)；自定义 API 结构，像Electron的 <a href=\"/docs/api/structures/cookie\"><code>Cookie</code></a>；或通配符 <code>any</code> 注明。</p>\n<p>如果参数是 <code>Array</code> 类型，请使用带有数组内值类型的 <code>[]</code> 缩写 (例如，<code>any[]</code> 或 <code>String[]</code>)。</p>\n<p>如果参数类型为 <code>Promise</code>, 则将promise resolve时的类型作为参数(例如 <code>Promise&#x3C;void></code> 或 <code>Promise&#x3C;String></code>)。</p>\n<p>如果参数可以是多种类型，则将类型通过 <code>|</code>分开。</p>\n<p><code>Function</code> 类型参数的描述应该清楚描述它是如何被调用的，并列出将被传递给它的参数的类型.</p>\n<h4 id=\"平台特定功能\"><a href=\"#平台特定功能\">平台特定功能</a></h4>\n<p>如果参数或方法对某些平台是唯一的，那么这些平台将使用数据类型后面的空格分隔的斜体列表来表示。 值可以是 <code>macOS</code>，<code>Windows</code> 或 <code>Linux</code>.</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-bullet\">* </span><span class=\"hljs-code\">`animate`</span> Boolean (optional) <span class=\"hljs-emphasis\">_macOS_</span> <span class=\"hljs-emphasis\">_Windows_</span> - 进行动画处理的事情.\n</code></pre>\n<h3 id=\"事件\"><a href=\"#事件\">事件</a></h3>\n<p>事件章节必须采用以下形式:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### Event: 'wake-up'</span>\n\nReturns:\n<span class=\"hljs-bullet\">\n* </span><span class=\"hljs-code\">`time`</span> String\n\n...\n</code></pre>\n<p>标题可以是 <code>###</code> 级别或 <code>####</code> 级别，具体取决于该事件是属于模块还是类。</p>\n<p>事件的参数遵循与方法相同的规则.</p>\n<h3 id=\"属性\"><a href=\"#属性\">属性</a></h3>\n<p>属性章节必须采用以下形式:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### session.defaultSession</span>\n\n...\n</code></pre>\n<p>标题可以是 <code>###</code> 级别或 <code>####</code> 级别，具体取决于该属性属于模块还是类。</p>\n<h2 id=\"文档翻译\"><a href=\"#文档翻译\">文档翻译</a></h2>\n<p>请参见 <a href=\"https://github.com/electron/i18n#readme\"> electron/i18n </a></p>",
      "title": "Electron 文档风格指南",
      "description": ""
    },
    "/docs/tutorial/support": {
      "locale": "zh-CN",
      "slug": "support",
      "href": "/docs/tutorial/support",
      "crowdinFileId": "256253",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/support.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron技术支持\"><a href=\"#electron技术支持\">Electron技术支持</a></h1>\n<h2 id=\"寻找技术支持\"><a href=\"#寻找技术支持\">寻找技术支持</a></h2>\n<p>如果您有安全方面的问题，请参阅 <a href=\"https://github.com/electron/electron/tree/main/SECURITY.md\">安全文档</a></p>\n<p>如果你想获得编程方面的帮助、问题的答案亦或是想要加入Electron的开发者大家庭，您可以参考以下链接：</p>\n<ul>\n<li><a href=\"https://discord.com/invite/electron\"><code>Electron's Discord</code></a> has channels for:<ul>\n<li>寻求帮助</li>\n<li>Ecosystem apps like <a href=\"https://github.com/electron-userland/electron-forge\">Electron Forge</a> and <a href=\"https://github.com/electron/fiddle\">Electron Fiddle</a></li>\n<li>Sharing ideas with other Electron app developers</li>\n<li>以及更多！</li>\n</ul></li>\n<li><a href=\"https://discuss.atom.io/c/electron\"><code>electron</code></a> 各种 Atom 论坛</li>\n<li><code>#electron</code> <a href=\"https://discuss.atom.io/t/join-us-on-slack/16638?source_topic_id=25406\">Atom's Slack</a>上的频道</li>\n<li><a href=\"https://telegram.me/electron_ru\"><code>electron-ru</code></a> <em>(俄语版)</em></li>\n<li><a href=\"https://electron-br.slack.com\"><code>electron-br</code></a> <em>(巴西葡语版)</em></li>\n<li><a href=\"https://electron-kr.github.io/electron-kr\"><code>electron-kr</code></a> <em>(韩语版)</em></li>\n<li><a href=\"https://electron-jp.slack.com\"><code>electron-jp</code></a> <em>(日语版)</em></li>\n<li><a href=\"https://electron-tr.herokuapp.com\"><code>electron-tr</code></a> <em>(土耳其语版)</em></li>\n<li><a href=\"https://electron-id.slack.com\"><code>electron-id</code></a> <em>(印尼语版)</em></li>\n<li><a href=\"https://electronpl.github.io\"><code>electron-pl</code></a> <em>(波兰语版)</em></li>\n</ul>\n<p>如果你有意为加入Electron的开发，可参阅<a href=\"https://github.com/electron/electron/blob/main/CONTRIBUTING.md\">贡献文档</a></p>\n<p>如果你在Electron的<a href=\"#supported-versions\">支持版</a>中发现漏洞，请在<a href=\"/docs/development/issues\">问题追踪</a>中提交你发现的漏洞。</p>\n<p><a href=\"https://github.com/sindresorhus/awesome-electron\">awesome-electron</a>是一个社区维护的示例程序列表。</p>\n<h2 id=\"支持版\"><a href=\"#支持版\">支持版</a></h2>\n<p><em><strong>Note:</strong> Beginning in September 2021 with Electron 15, the Electron team will temporarily support the latest <strong>four</strong> stable major versions. This extended support is intended to help Electron developers transition to the <a href=\"https://electronjs.org/blog/8-week-cadence\">new eight week release cadence</a>, and will continue until May 2022, with the release of Electron 19. At that time, the Electron team will drop support back to the latest three stable major versions.</em></p>\n<p>最新的 3 个<em>稳定的</em>的版本受 Electron 团队支持。 例如，如果最新版本是 6.1.x，则包括 5.0.x和 4.2.x系列的同样会被支持  We only support the latest minor release for each stable release series.  This means that in the case of a security fix 6.1.x will receive the fix, but we will not release a new version of 6.0.x.</p>\n<p>The latest stable release unilaterally receives all fixes from <code>main</code>, and the version prior to that receives the vast majority of those fixes as time and bandwidth warrants. The oldest supported release line will receive only security fixes directly.</p>\n<p>All supported release lines will accept external pull requests to backport fixes previously merged to <code>main</code>, though this may be on a case-by-case basis for some older supported lines. All contested decisions around release line backports will be resolved by the <a href=\"https://github.com/electron/governance/tree/main/wg-releases\">Releases Working Group</a> as an agenda item at their weekly meeting the week the backport PR is raised.</p>\n<p>当一个API的改动或移除会导致某个现有功能被破坏时，这个现有功能在被移除之前，仍然会在至少两个主要版本号内得到尽可能的支持。 比如，某个函数需要三个参数，而在主要版本10中，它被修改为需要两个参数，那么这个函数的三参数版本仍然会被支持，至少持续到主要版本12。 经过两个主要版本后，我们仍会尝试支持后向兼容，直到维护成本高得难以承受而无法继续支持。</p>\n<h3 id=\"当前支持的版本\"><a href=\"#当前支持的版本\">当前支持的版本</a></h3>\n<ul>\n<li>15.x.y</li>\n<li>14.x.y</li>\n<li>13.x.y</li>\n<li>12</li>\n</ul>\n<h3 id=\"服务终止\"><a href=\"#服务终止\">服务终止</a></h3>\n<p>当一个发行分支达到了其支持周期的末尾，该序列将会在NPM中弃用，且会发布一个最终的“结束支持”版本。 这个版本将会添加一个警告以通知正在使用一个不受支持的Electron版本。</p>\n<p>这些步骤是用于帮助应用开发者了解他们使用的分支不受支持，而不会过分打扰最终用户。</p>\n<p>如果一个应用有特殊情况并需要保持使用一个不受支持的Electron版本，开发者可以通过忽略来自应用的<code>package.json</code> <code>devDependencies</code>的最终版本以关闭结束支持警告。 For example, since the 1-6-x series ended with an end-of-support 1.6.18 release, developers could choose to stay in the 1-6-x series without warnings with <code>devDependency</code> of <code>\"electron\": 1.6.0 - 1.6.17</code>.</p>\n<h2 id=\"支持平台\"><a href=\"#支持平台\">支持平台</a></h2>\n<p>目前 Electron 支持以下平台：</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>对 macOS 仅提供64位版本，并且只支持 macOS 10.11 (El Capitan) 以及更高版本。</p>\n<p>Electron 11.0.0 已原生支持 Apple Silicon (<code>arm64</code>) 设备。</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<p>仅支持 Windows 7 或更高版本, 旧版操作系统已不再支持(并且无法运行).</p>\n<p>为Windows系统提供<code>ia32</code> (<code>x86</code>) 和 <code>x64</code> (<code>amd64</code>) 两种二进制版本。 <a href=\"/docs/tutorial/windows-arm\">Electron 6.0.8 已原生支持 Windows on Arm (<code>arm64</code>) 设备。</a> Running apps packaged with previous versions is possible using the ia32 binary.</p>\n<h3 id=\"linux\"><a href=\"#linux\">Linux</a></h3>\n<p>在 Ubuntu 18.04 上预构建的二进制文件。</p>\n<p>预编译版本是否能够正常运行，取决于其中是否包含了编译平台的链接库。所以只有 Ubuntu 18.04 是可以保证能正常运行的，并且以下平台也被证实可以正常运行 Electron 的预编译版本：</p>\n<ul>\n<li>Ubuntu 14.04 或更高版本</li>\n<li>Fedora 24 或更高版本</li>\n<li>Debian 8 或更高版本</li>\n</ul>",
      "title": "Electron技术支持",
      "description": ""
    },
    "/docs/api/synopsis": {
      "locale": "zh-CN",
      "slug": "synopsis",
      "href": "/docs/api/synopsis",
      "crowdinFileId": "256371",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/synopsis.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"简介\"><a href=\"#简介\">简介</a></h1>\n<blockquote>\n<p>如何使用 Node.js 和 Electron APIs</p>\n</blockquote>\n<p>Node. js 的所有 <a href=\"https://nodejs.org/api/\"> 内置模块 </a> 都在Electron中可用， 第三方 node 模块中也完全支持 (包括 <a href=\"/docs/tutorial/using-native-node-modules\"> 原生模块 </a>)。</p>\n<p>Electron 还为开发原生桌面应用程序提供了一些额外的内置模块。 某些模块仅在主进程中可用, 有些仅在渲染进程 (web 页) 中可用, 而有些在这两个进程中都可以使用。</p>\n<p>基本规则是: 如果一个模块是 <a href=\"https://en.wikipedia.org/wiki/Graphical_user_interface\"> GUI </a> 或底层系统相关的, 那么它应该只在主进程中可用。 You need to be familiar with the concept of main process vs. renderer process scripts to be able to use those modules.</p>\n<p>主进程脚本就像一个普通的Node.js脚本：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>如果 <code>nodeIntegration</code> 被启用，那么渲染进程除了额外能够使用node模块的能力外，与普通网页没有什么区别</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  <span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n  <span class=\"hljs-built_in\">console</span>.log(fs.readFileSync(__filename, <span class=\"hljs-string\">'utf8'</span>))\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<h2 id=\"解构赋值\"><a href=\"#解构赋值\">解构赋值</a></h2>\n<p>从0.37开始，可以使用 <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment\">destructuring assignment</a> (es6解构赋值)来使内置模块更容易使用。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>如果您需要整个 <code>electron</code> 模块, 则可以<code>require</code>它, 然后使用解构（destructuring）从 &#x3C;0> electron &#x3C;0> 访问各个模块。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> electron = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = electron\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>这等效于以下代码:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> electron = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> app = electron.app\n<span class=\"hljs-keyword\">const</span> BrowserWindow = electron.BrowserWindow\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>",
      "title": "简介",
      "description": "如何使用 Node.js 和 Electron APIs"
    },
    "/docs/api/system-preferences": {
      "locale": "zh-CN",
      "slug": "system-preferences",
      "href": "/docs/api/system-preferences",
      "crowdinFileId": "256373",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/system-preferences.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"systempreferences\"><a href=\"#systempreferences\">systemPreferences</a></h1>\n<blockquote>\n<p>获取system preferences.</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(systemPreferences.isDarkMode())\n</code></pre>\n<h2 id=\"事件\"><a href=\"#事件\">事件</a></h2>\n<p><code>systemPreferences</code> 对象触发以下事件:</p>\n<h3 id=\"event-accent-color-changed-windows\"><a href=\"#event-accent-color-changed-windows\">Event: 'accent-color-changed' <em>Windows</em></a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newColor</code> String - 用户指定的新 RGBA 颜色作为系统偏好颜色.</li>\n</ul>\n<h3 id=\"event-color-changed-windows\"><a href=\"#event-color-changed-windows\">Event: 'color-changed' <em>Windows</em></a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<h3 id=\"event-inverted-color-scheme-changed-windows-deprecated\"><a href=\"#event-inverted-color-scheme-changed-windows-deprecated\">Event: 'inverted-color-scheme-changed' <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>invertedColorScheme</code> Boolean - <code>true</code> if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is being used, <code>false</code> otherwise.</li>\n</ul>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#event-updated\"><code>updated</code></a> event on the <code>nativeTheme</code> module.</p>\n<h3 id=\"event-high-contrast-color-scheme-changed-windows-deprecated\"><a href=\"#event-high-contrast-color-scheme-changed-windows-deprecated\">Event: 'high-contrast-color-scheme-changed' <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>highContrastColorScheme</code> Boolean - <code>true</code> if a high contrast theme is being used, <code>false</code> otherwise.</li>\n</ul>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#event-updated\"><code>updated</code></a> event on the <code>nativeTheme</code> module.</p>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<h3 id=\"systempreferencesisdarkmode-macos-windows-deprecated\"><a href=\"#systempreferencesisdarkmode-macos-windows-deprecated\"><code>systemPreferences.isDarkMode()</code> <em>macOS</em> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>返回<code>Boolean</code>，表示系统是否处于Dark模式</p>\n<p><strong>已废弃：</strong> 请使用新的 <a href=\"/docs/api/native-theme#nativethemeshouldusedarkcolors-readonly\"><code>nativeTheme.shouldUseDarkColors</code></a> API。</p>\n<h3 id=\"systempreferencesisswipetrackingfromscrolleventsenabled-macos\"><a href=\"#systempreferencesisswipetrackingfromscrolleventsenabled-macos\"><code>systemPreferences.isSwipeTrackingFromScrollEventsEnabled()</code> <em>macOS</em></a></h3>\n<p>返回值 <code>Boolean</code> - 是否在页面设置之间进行滑动。</p>\n<h3 id=\"systempreferencespostnotificationevent-userinfo-deliverimmediately-macos\"><a href=\"#systempreferencespostnotificationevent-userinfo-deliverimmediately-macos\"><code>systemPreferences.postNotification(event, userInfo[, deliverImmediately])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n<li><code>deliverImmediately</code> Boolean (optional) - <code>true</code> to post notifications immediately even when the subscribing app is inactive.</li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencespostlocalnotificationevent-userinfo-macos\"><a href=\"#systempreferencespostlocalnotificationevent-userinfo-macos\"><code>systemPreferences.postLocalNotification(event, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencespostworkspacenotificationevent-userinfo-macos\"><a href=\"#systempreferencespostworkspacenotificationevent-userinfo-macos\"><code>systemPreferences.postWorkspaceNotification(event, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencessubscribenotificationevent-callback-macos\"><a href=\"#systempreferencessubscribenotificationevent-callback-macos\"><code>systemPreferences.subscribeNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> String</li>\n</ul></li>\n</ul>\n<p>返回 <code>Number</code> - 此订阅的 ID</p>\n<p>订阅macOS的原生通知，当通信的 <code>event&#x3C;/ 0>发生时，将调用 &#x3C;code>callback(event, userInfo)</code> 。 <code>userInfo</code>是一个Object，它包含随通知一起发送的用户信息字典。 The <code>object</code> is the sender of the notification, and only supports <code>NSString</code> values for now.</p>\n<p>返回订阅的 <code>id</code>, 可用于取消该订阅的 <code>event</code>.</p>\n<p>在这个API下订阅<code>NSDistributedNotificationCenter</code>， <code>event</code> 的示例值为：</p>\n<ul>\n<li><code>AppleInterfaceThemeChangedNotification</code></li>\n<li><code>AppleAquaColorVariantChanged</code></li>\n<li><code>AppleColorPreferencesChangedNotification</code></li>\n<li><code>AppleShowScrollBarsSettingChanged</code></li>\n</ul>\n<h3 id=\"systempreferencessubscribelocalnotificationevent-callback-macos\"><a href=\"#systempreferencessubscribelocalnotificationevent-callback-macos\"><code>systemPreferences.subscribeLocalNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> String</li>\n</ul></li>\n</ul>\n<p>返回 <code>Number</code> - 此订阅的 ID</p>\n<p>Same as <code>subscribeNotification</code>, but uses <code>NSNotificationCenter</code> for local defaults. 这对事件 <code>NSUserDefaultsDidChangeNotification</code> 是必需的。</p>\n<h3 id=\"systempreferencessubscribeworkspacenotificationevent-callback-macos\"><a href=\"#systempreferencessubscribeworkspacenotificationevent-callback-macos\"><code>systemPreferences.subscribeWorkspaceNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> String</li>\n</ul></li>\n</ul>\n<p>返回 <code>Number</code> - 此订阅的 ID</p>\n<p>与 <code>subscribeNotification</code>一样, 但使用<code>NSWorkspace.sharedWorkspace.notificationCenter</code>。 这对事件 <code>NSWorkspaceDidActivateApplicationNotification</code> 是必需的。</p>\n<h3 id=\"systempreferencesunsubscribenotificationid-macos\"><a href=\"#systempreferencesunsubscribenotificationid-macos\"><code>systemPreferences.unsubscribeNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>使用 <code>id</code> 删除订阅。</p>\n<h3 id=\"systempreferencesunsubscribelocalnotificationid-macos\"><a href=\"#systempreferencesunsubscribelocalnotificationid-macos\"><code>systemPreferences.unsubscribeLocalNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>与<code>unsubscribeNotification</code>相同，但将订户从<code>NSNotificationCenter</code>中删除。</p>\n<h3 id=\"systempreferencesunsubscribeworkspacenotificationid-macos\"><a href=\"#systempreferencesunsubscribeworkspacenotificationid-macos\"><code>systemPreferences.unsubscribeWorkspaceNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>与 <code>unsubscribeNotification</code> 一样，但是它从 <code>NSWorkspace.sharedWorkspace.notificationCenter</code> 中移除订阅者。</p>\n<h3 id=\"systempreferencesregisterdefaultsdefaults-macos\"><a href=\"#systempreferencesregisterdefaultsdefaults-macos\"><code>systemPreferences.registerDefaults(defaults)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>defaults</code> Record&#x3C;String, String | Boolean | Number> - a dictionary of (<code>key: value</code>) user defaults</li>\n</ul>\n<p>在应用的<code>NSUserDefaults</code>配置项中添加其它默认设置。</p>\n<h3 id=\"systempreferencesgetuserdefaulttype-extends-keyof-userdefaulttypeskey-type-macos\"><a href=\"#systempreferencesgetuserdefaulttype-extends-keyof-userdefaulttypeskey-type-macos\"><code>systemPreferences.getUserDefault&#x3C;Type extends keyof UserDefaultTypes>(key, type)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n<li><code>type</code> Type - Can be <code>string</code>, <code>boolean</code>, <code>integer</code>, <code>float</code>, <code>double</code>, <code>url</code>, <code>array</code> or <code>dictionary</code>.</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/user-default-types\"><code>UserDefaultTypes[Type]</code></a> - The value of <code>key</code> in <code>NSUserDefaults</code>.</p>\n<p>常用的 <code>key</code> 和 <code>type</code> 的类型为:</p>\n<ul>\n<li><code>AppleInterfaceStyle</code>: <code>string</code></li>\n<li><code>AppleAquaColorVariant</code>: <code>integer</code></li>\n<li><code>AppleHighlightColor</code>: <code>string</code></li>\n<li><code>AppleShowScrollBars</code>: <code>string</code></li>\n<li><code>NSNavRecentPlaces</code>: <code>array</code></li>\n<li><code>NSPreferredWebServices</code>: <code>dictionary</code></li>\n<li><code>NSUserDictionaryReplacementItems</code>: <code>array</code></li>\n</ul>\n<h3 id=\"systempreferencessetuserdefaultkey-type-value-macos\"><a href=\"#systempreferencessetuserdefaultkey-type-value-macos\"><code>systemPreferences.setUserDefault(key, type, value)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n<li><code>type</code> String - Can be <code>string</code>, <code>boolean</code>, <code>integer</code>, <code>float</code>, <code>double</code>, <code>url</code>, <code>array</code> or <code>dictionary</code>.</li>\n<li><code>value</code> String</li>\n</ul>\n<p>设置 <code>NSUserDefaults</code> 中 <code>key</code> 的值.</p>\n<p>请注意， <code>type</code> 应匹配实际类型的 <code>value</code>。 如果他们没有，就会抛出一个异常。</p>\n<p>常用的 <code>key</code> 和 <code>type</code> 的类型为:</p>\n<ul>\n<li><code>ApplePressAndHoldEnabled</code>: <code>boolean</code></li>\n</ul>\n<h3 id=\"systempreferencesremoveuserdefaultkey-macos\"><a href=\"#systempreferencesremoveuserdefaultkey-macos\"><code>systemPreferences.removeUserDefault(key)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>删除 <code>NSUserDefaults</code>中的 <code>key</code> 。 可以用来恢复默认值或之前用 <code>setUserDefault</code> 为一个 <code>key</code> 设置的全局变量。</p>\n<h3 id=\"systempreferencesisaeroglassenabled-windows\"><a href=\"#systempreferencesisaeroglassenabled-windows\"><code>systemPreferences.isAeroGlassEnabled()</code> <em>Windows</em></a></h3>\n<p>返回 <code>Boolean</code> - <code>true</code> 如果启用了 <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/aa969540.aspx\">DWM composition</a> (Aero Glass), 否则为 <code>false</code>.</p>\n<p>使用它来确定是否应创建透明窗口的示例 (当禁用 DWM 组合时, 透明窗口无法正常工作):</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> browserOptions = { <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">1000</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">800</span> }\n\n<span class=\"hljs-comment\">// Make the window transparent only if the platform supports it.</span>\n<span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'win32'</span> || systemPreferences.isAeroGlassEnabled()) {\n  browserOptions.transparent = <span class=\"hljs-literal\">true</span>\n  browserOptions.frame = <span class=\"hljs-literal\">false</span>\n}\n\n<span class=\"hljs-comment\">// Create the window.</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow(browserOptions)\n\n<span class=\"hljs-comment\">// Navigate.</span>\n<span class=\"hljs-keyword\">if</span> (browserOptions.transparent) {\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/index.html`</span>)\n} <span class=\"hljs-keyword\">else</span> {\n  <span class=\"hljs-comment\">// No transparency, so we load a fallback that uses basic styles.</span>\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/fallback.html`</span>)\n}\n</code></pre>\n<h3 id=\"systempreferencesgetaccentcolor-windows-macos\"><a href=\"#systempreferencesgetaccentcolor-windows-macos\"><code>systemPreferences.getAccentColor()</code> <em>Windows</em> <em>macOS</em></a></h3>\n<p>返回 <code>String</code> - 用户当前系统偏好颜色，RGBA 十六进制形式.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> color = systemPreferences.getAccentColor() <span class=\"hljs-comment\">// `\"aabbccdd\"`</span>\n<span class=\"hljs-keyword\">const</span> red = color.substr(<span class=\"hljs-number\">0</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"aa\"</span>\n<span class=\"hljs-keyword\">const</span> green = color.substr(<span class=\"hljs-number\">2</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"bb\"</span>\n<span class=\"hljs-keyword\">const</span> blue = color.substr(<span class=\"hljs-number\">4</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"cc\"</span>\n<span class=\"hljs-keyword\">const</span> alpha = color.substr(<span class=\"hljs-number\">6</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"dd\"</span>\n</code></pre>\n<p>此 API 仅在 macOS 10.14 Mojave 或更高版本上可用。</p>\n<h3 id=\"systempreferencesgetcolorcolor-windows-macos\"><a href=\"#systempreferencesgetcolorcolor-windows-macos\"><code>systemPreferences.getColor(color)</code> <em>Windows</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>color</code> String - One of the following values:<ul>\n<li>On <strong>Windows</strong>:<ul>\n<li><code>3d-dark-shadow</code> - 三维显示元素的暗阴影。</li>\n<li><code>3d-face</code> - 面向三维显示元素和对话框背景的颜色。</li>\n<li><code>3d-highlight</code> - 三维显示元素的高亮色.</li>\n<li><code>3d-light</code> - 三维显示元素的亮色.</li>\n<li><code>3d-shadow</code> - 三维显示元素的阴影颜色.</li>\n<li><code>active-border</code> - 活动窗口边框。</li>\n<li><code>active-caption</code> - Active window title bar. Specifies the left side color in the color gradient of an active window's title bar if the gradient effect is enabled.</li>\n<li><code>active-caption-gradient</code> - 活动窗口标题栏的颜色渐变中的右侧颜色。</li>\n<li><code>app-workspace</code> - 多文档界面 (MDI) 应用程序的背景颜色。</li>\n<li><code>button-text</code> - 按钮上的文本。</li>\n<li><code>caption-text</code> - 标题，大小框和滚动条箭头框中的文本。</li>\n<li><code>desktop</code> - 桌面的背景色。</li>\n<li><code>disabled-text</code> - 灰色 (禁用的) 文字.</li>\n<li><code>highlight</code> - 在控件中选择的项目。</li>\n<li><code>highlight-text</code> - 在控件中选择的项目文本。</li>\n<li><code>hotlight</code> - 超链接或热追踪项目的颜色。</li>\n<li><code>inactive-border</code> - 非活动窗口边框。</li>\n<li><code>inactive-caption</code> - Inactive window caption. Specifies the left side color in the color gradient of an inactive window's title bar if the gradient effect is enabled.</li>\n<li><code>inactive-caption-gradient</code> - 非活动窗口标题栏的颜色渐变中的右侧颜色。</li>\n<li><code>inactive-caption-text</code> - 非活动标题中的文字颜色。</li>\n<li><code>info-background</code> - 工具提示控件的背景颜色。</li>\n<li><code>info-text</code> - 工具提示控件的文本颜色。</li>\n<li><code>menu</code> - 菜单的背景色.</li>\n<li><code>menu-highlight</code> - 当菜单显示为平面菜单时用于突出显示菜单项的颜色。</li>\n<li><code>menubar</code> - 菜单显示为平面菜单时菜单栏的背景颜色。</li>\n<li><code>menu-text</code> - 菜单的文字.</li>\n<li><code>scrollbar</code> - 滚动条的灰色区域.</li>\n<li><code>window</code> - 窗口的背景色.</li>\n<li><code>window-frame</code> - 窗口框.</li>\n<li><code>window-text</code> - 窗口的文字。</li>\n</ul></li>\n<li>On <strong>macOS</strong><ul>\n<li><code>alternate-selected-control-text</code> - The text on a selected surface in a list or table. <em>已废弃</em></li>\n<li><code>control-background</code> - The background of a large interface element, such as a browser or table.</li>\n<li><code>control</code> - The surface of a control.</li>\n<li><code>control-text</code> -The text of a control that isn’t disabled.</li>\n<li><code>disabled-control-text</code> - The text of a control that’s disabled.</li>\n<li><code>find-highlight</code> - The color of a find indicator.</li>\n<li><code>grid</code> - The gridlines of an interface element such as a table.</li>\n<li><code>header-text</code> - The text of a header cell in a table.</li>\n<li><code>highlight</code> - The virtual light source onscreen.</li>\n<li><code>keyboard-focus-indicator</code> - The ring that appears around the currently focused control when using the keyboard for interface navigation.</li>\n<li><code>label</code> - The text of a label containing primary content.</li>\n<li><code>link</code> - A link to other content.</li>\n<li><code>placeholder-text</code> -  A placeholder string in a control or text view.</li>\n<li><code>quaternary-label</code> - The text of a label of lesser importance than a tertiary label such as watermark text.</li>\n<li><code>scrubber-textured-background</code> - The background of a scrubber in the Touch Bar.</li>\n<li><code>secondary-label</code> - The text of a label of lesser importance than a normal label such as a label used to represent a subheading or additional information.</li>\n<li><code>selected-content-background</code> - The background for selected content in a key window or view.</li>\n<li><code>selected-control</code> - The surface of a selected control.</li>\n<li><code>selected-control-text</code> - The text of a selected control.</li>\n<li><code>selected-menu-item-text</code> - The text of a selected menu.</li>\n<li><code>selected-text-background</code> - The background of selected text.</li>\n<li><code>selected-text</code> - Selected text.</li>\n<li><code>separator</code> - A separator between different sections of content.</li>\n<li><code>shadow</code> - The virtual shadow cast by a raised object onscreen.</li>\n<li><code>tertiary-label</code> - The text of a label of lesser importance than a secondary label such as a label used to represent disabled text.</li>\n<li><code>text-background</code> - Text background.</li>\n<li><code>text</code> -  The text in a document.</li>\n<li><code>under-page-background</code> -  The background behind a document's content.</li>\n<li><code>unemphasized-selected-content-background</code> - The selected content in a non-key window or view.</li>\n<li><code>unemphasized-selected-text-background</code> - A background for selected text in a non-key window or view.</li>\n<li><code>unemphasized-selected-text</code> - Selected text in a non-key window or view.</li>\n<li><code>window-background</code> - The background of a window.</li>\n<li><code>window-frame-text</code> - The text in the window's titlebar area.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>返回 <code>String</code> -系统颜色设置为RGB十六进制格式 (<code>#ABCDEF</code>). 更多详细信息请参阅 <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx\">Windows docs</a> 和 <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#dynamic-system-colors\">macOS 文档</a>。</p>\n<p>以下颜色仅在 macOS 10.14 上可用：<code>find-hightlight</code>, <code>selected-content-background</code>, <code>separator</code>, <code>unemphasized-selected-content-background</code>, <code>unemphasized-selected-text-background</code>, 和 <code>unemphasized-selected-text</code></p>\n<h3 id=\"systempreferencesgetsystemcolorcolor-macos\"><a href=\"#systempreferencesgetsystemcolorcolor-macos\"><code>systemPreferences.getSystemColor(color)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>color</code> String - One of the following values:<ul>\n<li><code>blue</code></li>\n<li><code>brown</code></li>\n<li><code>gray</code></li>\n<li><code>green</code></li>\n<li><code>orange</code></li>\n<li><code>pink</code></li>\n<li><code>purple</code></li>\n<li><code>red</code></li>\n<li><code>yellow</code></li>\n</ul></li>\n</ul>\n<p>返回 <code>String</code> - 标准系统颜色，格式为 <code>#RRGGBBAA</code>。</p>\n<p>返回几个标准系统颜色之一，这些颜色可自动适应鲜艳度的变化并更改辅助功能设置，如\"增加对比度\"和\"降低透明度\"。 有关更多详细信息，请参阅<a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#system-colors\"> apple 文档 </a>。</p>\n<h3 id=\"systempreferencesisinvertedcolorscheme-windows-deprecated\"><a href=\"#systempreferencesisinvertedcolorscheme-windows-deprecated\"><code>systemPreferences.isInvertedColorScheme()</code> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>返回 <code>Boolean</code> - 如果使用反转颜色方案(亮文字暗背景的高对比度主题) 则为<code>true</code>，否则为<code>false</code>。</p>\n<p><strong>已废弃：</strong> 请使用新的 <a href=\"/docs/api/native-theme#nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly\"><code>nativeTheme.shouldUseInvertedColorScheme</code></a> API。</p>\n<h3 id=\"systempreferencesishighcontrastcolorscheme-macos-windows-deprecated\"><a href=\"#systempreferencesishighcontrastcolorscheme-macos-windows-deprecated\"><code>systemPreferences.isHighContrastColorScheme()</code> <em>macOS</em> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>返回 <code>Boolean</code> - 如果启用了高对比度主题为<code>true</code>，否则为<code>false</code>。</p>\n<p><strong>已废弃：</strong> 请使用新的 <a href=\"/docs/api/native-theme#nativethemeshouldusehighcontrastcolors-macos-windows-readonly\"><code>nativeTheme.shouldUseHighContrastColors</code></a> API。</p>\n<h3 id=\"systempreferencesgeteffectiveappearance-macos\"><a href=\"#systempreferencesgeteffectiveappearance-macos\"><code>systemPreferences.getEffectiveAppearance()</code> <em>macOS</em></a></h3>\n<p>返回 <code>String</code> - 其值可能是 <code>dark</code>、<code>light</code> 或 <code>unknown</code>.</p>\n<p>获取当前应用到你的程序上的 macOS 设置项，会映射到 <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc\">NSApplication.effectiveAppearance</a></p>\n<h3 id=\"systempreferencesgetapplevelappearance-macos-deprecated\"><a href=\"#systempreferencesgetapplevelappearance-macos-deprecated\"><code>systemPreferences.getAppLevelAppearance()</code> <em>macOS</em> <em>Deprecated</em></a></h3>\n<p>返回 <code>String</code> | <code>null</code> - 其值可能为 <code>dark</code>、<code>light</code> 或 <code>unknown</code>。</p>\n<p>获取您在macOS上为您的应用程序设置的外观，映射到<a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc\">NSApplication.appearance</a>。 您可以使用 <code>setAppLevelAppearance</code> API 来设置此值。</p>\n<h3 id=\"systempreferencessetapplevelappearanceappearance-macos-deprecated\"><a href=\"#systempreferencessetapplevelappearanceappearance-macos-deprecated\"><code>systemPreferences.setAppLevelAppearance(appearance)</code> <em>macOS</em> <em>Deprecated</em></a></h3>\n<ul>\n<li><code>appearance</code> String | null - 可以是 <code>dark</code> 或 <code>light</code></li>\n</ul>\n<p>设定您的应用程序的外观设置，这应该覆盖系统默认值以及覆盖 <code>getEffectiveAppearance</code> 的值。</p>\n<h3 id=\"systempreferencescanprompttouchid-macos\"><a href=\"#systempreferencescanprompttouchid-macos\"><code>systemPreferences.canPromptTouchID()</code> <em>macOS</em></a></h3>\n<p>返回 <code>Boolean</code> - 此设备是否有能力使用 Touch ID。</p>\n<p><strong>注意：</strong>在 macOS 系统的版本低于 Sierra 10.12.2时，此 API 将返回 <code>false</code> 。</p>\n<h3 id=\"systempreferencesprompttouchidreason-macos\"><a href=\"#systempreferencesprompttouchidreason-macos\"><code>systemPreferences.promptTouchID(reason)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>reason</code> String - The reason you are asking for Touch ID authentication</li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code> - resolve如果用户已成功通过Touch ID授权。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsystemPreferences.promptTouchID(<span class=\"hljs-string\">'To get consent for a Security-Gated Thing'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">success</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'You have successfully authenticated with Touch ID!'</span>)\n}).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(err)\n})\n</code></pre>\n<p>此 API 本身不会保护您的用户数据；相反，这是一个机制，让你这样做。 原生应用需要在其密钥链入口设置 <a href=\"https://developer.apple.com/documentation/security/secaccesscontrolcreateflags?language=objc\">访问控制常量</a> ，如 <a href=\"https://developer.apple.com/documentation/security/secaccesscontrolcreateflags/ksecaccesscontroluserpresence?language=objc\"><code>kSecAccessControlUserPresence</code></a> ，当应用读取到后将自动提示 Touch ID 生物识别许可。 该操作可以通过 <a href=\"https://github.com/atom/node-keytar\"><code>node-keytar</code></a>完成，这样，应用就会用 <code>node-keytar</code> 存储加密密钥，并且只有在 <code>promptTouchID()</code> resolve时才能取出。</p>\n<p><strong>注意：</strong>在 macOS 系统的版本低于 Sierra 10.12.2时，此 API 返回的Promise将reject 。</p>\n<h3 id=\"systempreferencesistrustedaccessibilityclientprompt-macos\"><a href=\"#systempreferencesistrustedaccessibilityclientprompt-macos\"><code>systemPreferences.isTrustedAccessibilityClient(prompt)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>prompt</code> Boolean - whether or not the user will be informed via prompt if the current process is untrusted.</li>\n</ul>\n<p>返回 <code>Boolean</code> - 如果当前进程是受信任的无障碍客户端，则为<code>true</code>，否则为 <code>false</code> 。</p>\n<h3 id=\"systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><a href=\"#systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><code>systemPreferences.getMediaAccessStatus(mediaType)</code> <em>Windows</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>mediaType</code> String - 可以是 <code>microphone</code>, <code>camera</code> 或 <code>screen</code>.</li>\n</ul>\n<p>返回 <code>String</code> - 值可以是 <code>not-determined</code>， <code>granted</code>， <code>denied</code>， <code>restricted</code> 或 <code>unknown</code>。</p>\n<p>在 macOS 10.13 High Sierra 或更低版本上不需要用户授权，因此此方法总是返回 <code>granted</code>。 macOS 10.14 Mojave 或更高版本需要授权访问 <code>麦克风</code> 和 <code>摄像头</code>。 macOS 10.15 Catalina 或更高版本需要授权访问 <code>屏幕</code>。</p>\n<p>Windows 10的全局设置控制了所有win32 应用程序对 <code>麦克风</code> 和 <code>摄像头</code>的访问权限。 It will always return <code>granted</code> for <code>screen</code> and for all media types on older versions of Windows.</p>\n<h3 id=\"systempreferencesaskformediaaccessmediatype-macos\"><a href=\"#systempreferencesaskformediaaccessmediatype-macos\"><code>systemPreferences.askForMediaAccess(mediaType)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>mediaType</code> String - the type of media being requested; can be <code>microphone</code>, <code>camera</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Boolean></code> - A promise that resolves with <code>true</code> if consent was granted and <code>false</code> if it was denied. If an invalid <code>mediaType</code> is passed, the promise will be rejected. If an access request was denied and later is changed through the System Preferences pane, a restart of the app will be required for the new permissions to take effect. If access has already been requested and denied, it <em>must</em> be changed through the preference pane; an alert will not pop up and the promise will resolve with the existing access status.</p>\n<p><strong>Important:</strong> In order to properly leverage this API, you <a href=\"https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos?language=objc\">must set</a> the <code>NSMicrophoneUsageDescription</code> and <code>NSCameraUsageDescription</code> strings in your app's <code>Info.plist</code> file. The values for these keys will be used to populate the permission dialogs so that the user will be properly informed as to the purpose of the permission request. See <a href=\"/docs/tutorial/application-distribution#macos\">Electron Application Distribution</a> for more information about how to set these in the context of Electron.</p>\n<p>This user consent was not required until macOS 10.14 Mojave, so this method will always return <code>true</code> if your system is running 10.13 High Sierra or lower.</p>\n<h3 id=\"systempreferencesgetanimationsettings\"><a href=\"#systempreferencesgetanimationsettings\"><code>systemPreferences.getAnimationSettings()</code></a></h3>\n<p>返回 <code>Object</code>:</p>\n<ul>\n<li><code>shouldRenderRichAnimation</code> Boolean - Returns true if rich animations should be rendered. Looks at session type (e.g. remote desktop) and accessibility settings to give guidance for heavy animations.</li>\n<li><code>scrollAnimationsEnabledBySystem</code> Boolean - Determines on a per-platform basis whether scroll animations (e.g. produced by home/end key) should be enabled.</li>\n<li><code>prefersReducedMotion</code> Boolean - Determines whether the user desires reduced motion based on platform APIs.</li>\n</ul>\n<p>Returns an object with system animation settings.</p>\n<h2 id=\"属性\"><a href=\"#属性\">属性</a></h2>\n<h3 id=\"systempreferencesapplevelappearance-macos\"><a href=\"#systempreferencesapplevelappearance-macos\"><code>systemPreferences.appLevelAppearance</code> <em>macOS</em></a></h3>\n<p>一个类型为<code>String</code>的属性，此属性可能的值为：<code>dark</code>, <code>light</code> or <code>unknown</code>. It determines the macOS appearance setting for your application. This maps to values in: <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc\">NSApplication.appearance</a>. Setting this will override the system default as well as the value of <code>getEffectiveAppearance</code>.</p>\n<p>Possible values that can be set are <code>dark</code> and <code>light</code>, and possible return values are <code>dark</code>, <code>light</code>, and <code>unknown</code>.</p>\n<p>This property is only available on macOS 10.14 Mojave or newer.</p>\n<h3 id=\"systempreferenceseffectiveappearance-macos-只读\"><a href=\"#systempreferenceseffectiveappearance-macos-只读\"><code>systemPreferences.effectiveAppearance</code> <em>macOS</em> <em>只读</em></a></h3>\n<p>一个类型为<code>String</code>的属性，此属性可能的值为：<code>dark</code>, <code>light</code> or <code>unknown</code>.</p>\n<p>Returns the macOS appearance setting that is currently applied to your application, maps to <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc\">NSApplication.effectiveAppearance</a></p>",
      "title": "systemPreferences",
      "description": "获取system preferences."
    },
    "/docs/api/structures/task": {
      "locale": "zh-CN",
      "slug": "task",
      "href": "/docs/api/structures/task",
      "crowdinFileId": "256513",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/task.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"task-object\"><a href=\"#task-object\">Task Object</a></h1>\n<ul>\n<li><code>program</code> String - Path of the program to execute, usually you should specify <code>process.execPath</code> which opens the current program.</li>\n<li><code>arguments</code> String - The command line arguments when <code>program</code> is executed.</li>\n<li><code>title</code> String - The string to be displayed in a JumpList.</li>\n<li><code>description</code> String - Description of this task.</li>\n<li><code>iconPath</code> String - The absolute path to an icon to be displayed in a JumpList, which can be an arbitrary resource file that contains an icon. You can usually specify <code>process.execPath</code> to show the icon of the program.</li>\n<li><code>iconIndex</code> Number - The icon index in the icon file. If an icon file consists of two or more icons, set this value to identify the icon. If an icon file consists of one icon, this value is 0.</li>\n<li><code>workingDirectory</code> String (optional) - The working directory. Default is empty.</li>\n</ul>",
      "title": "Task Object",
      "description": ""
    },
    "/docs/development/testing": {
      "locale": "zh-CN",
      "slug": "testing",
      "href": "/docs/development/testing",
      "crowdinFileId": "256169",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/testing.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"测试\"><a href=\"#测试\">测试</a></h1>\n<p>我们的目的是保持 Electron 代码的高覆盖率。 我们要求所有的pull request不仅要通过所有现有的测试，还要增加新的测试来覆盖变更的代码和新的场景。 我们要尽可能多地覆盖Electron应用中的代码路径和用例，以确保我们发布的应用程序都能拥有更少的bug。</p>\n<p>这个仓库为 JavaScript 和 C ++ 提供了linting 规则 - 以及单元和集成测试。 通过 <a href=\"/docs/development/coding-style\">coding-style</a>文档来学习更多的Electron's编码风格</p>\n<h2 id=\"提示\"><a href=\"#提示\">提示</a></h2>\n<p>为确保您的JavaScript符合Electron编码风格，请执行<code>npm run lint-js</code>，它将针对Electron本身以及单元测试运行<code>standard</code>测试。 如果您正在使用带有插件/插件系统的编辑器，那么可以使用<a href=\"https://standardjs.com/#are-there-text-editor-plugins\">StandardJS addons</a>之类的插件在你提交代码前来检查编码规范。</p>\n<p>若要用参数运行<code>standard</code>测试，首先执行<code>npm run lint-js --</code> 然后输入要传递给<code>standard</code>测试的参数。</p>\n<p>要确保您的C ++代码符合Electron编码风格，请执行<code>npm run lint-cpp</code>，它将会执行<code>cpplint</code>脚本。 我们建议您使用<code>clang-format</code>并准备<a href=\"/docs/development/clang-format\">一个简短的教程</a>。</p>\n<p>There is not a lot of Python in this repository, but it too is governed by coding style rules. <code>npm run lint-py</code> will check all Python, using <code>pylint</code> to do so.</p>\n<h2 id=\"单元测试\"><a href=\"#单元测试\">单元测试</a></h2>\n<p>If you are not using <a href=\"https://github.com/electron/build-tools\">build-tools</a>, ensure that that name you have configured for your local build of Electron is one of <code>Testing</code>, <code>Release</code>, <code>Default</code>, <code>Debug</code>, or you have set <code>process.env.ELECTRON_OUT_DIR</code>. Without these set, Electron will fail to perform some pre-testing steps.</p>\n<p>要运行所有单元测试，请执行 <code>npm run test</code>。 单元测试其实也是一个Electron应用！你可以在<code>spec</code> 文件夹中找到它。 请注意，单元测试也有自己的 <code>package.json</code>，因此它的依赖没有在最顶层的<code>package.json</code>中定义。</p>\n<p>若要通过匹配模式运行单个测试，可以执行 <code>npm run test -- -g=PATTERN</code>，把<code>PATTERN</code> 替换为匹配某个测试的正则表达式。 例：如果想运行IPC测试，你可以执行<code>npm run test -- -g ipc</code>。</p>\n<h3 id=\"在windows10上测试\"><a href=\"#在windows10上测试\">在Windows10上测试</a></h3>\n<h4 id=\"extra-steps-to-run-the-unit-test\"><a href=\"#extra-steps-to-run-the-unit-test\">Extra steps to run the unit test:</a></h4>\n<ol>\n<li>\n<p>Visual Studio 2019 must be installed.</p>\n</li>\n<li>\n<p>Node headers have to be compiled for your configuration.</p>\n<pre><code class=\"hljs language-powershell\">ninja -C out\\Testing third_party\\electron_node:headers\n</code></pre>\n</li>\n<li>\n<p>The electron.lib has to be copied as node.lib.</p>\n<pre><code class=\"hljs language-powershell\">cd out\\Testing\nmkdir gen\\node_headers\\Release\ncopy electron.lib gen\\node_headers\\Release\\node.lib\n</code></pre>\n</li>\n</ol>\n<h4 id=\"missing-fonts\"><a href=\"#missing-fonts\">Missing fonts</a></h4>\n<p><a href=\"https://docs.microsoft.com/en-us/typography/fonts/windows_10_font_list\">一些 Windows 10 设备</a>上没有默认安装Meriryo字体，这会导致字体回退测试的失败。 要安装Meiryo字体：</p>\n<ol>\n<li>按下Windows key并搜索 <em>管理可选功能</em>。</li>\n<li>单击<em>添加功能</em></li>\n<li>选择<em>Japanese Supplemental Fonts</em>并单击 <em>安装</em></li>\n</ol>\n<h4 id=\"pixel-measurements\"><a href=\"#pixel-measurements\">Pixel measurements</a></h4>\n<p>由于浮点数精度误差，某些依赖于精确像素测量的测试可能无法正常在Hi-DPI屏幕的设备上工作。 为了使这些测试能正常运行，请确保设备的缩放比为100%。</p>\n<p>要配置缩放比：</p>\n<ol>\n<li>按下Windows key并搜索<em>显示设置</em>.</li>\n<li>在<em>Scale and layout</em>下，确保缩放比为100%。</li>\n</ol>",
      "title": "测试",
      "description": ""
    },
    "/docs/tutorial/testing-on-headless-ci": {
      "locale": "zh-CN",
      "slug": "testing-on-headless-ci",
      "href": "/docs/tutorial/testing-on-headless-ci",
      "crowdinFileId": "256255",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/testing-on-headless-ci.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"headless-ci-systems-测试-travis-ci-jenkins\"><a href=\"#headless-ci-systems-测试-travis-ci-jenkins\">Headless CI Systems 测试 (Travis CI, Jenkins)</a></h1>\n<p>Electron 基于 Chromium，所以需要一个显示驱动使其运转。 如果 Chromium 无法找到一个显示驱动， Electron 会启动失败，因此无论你如何去运行它，Electron 不会执行你的任何测试。 在 Travis，Circle， Jenkins 或者类似的系统上测试基于Electron的应用时，需要进行一些配置。 本质上，我们需要使用一个 虚拟的显示驱动。</p>\n<h2 id=\"配置虚拟显示服务器\"><a href=\"#配置虚拟显示服务器\">配置虚拟显示服务器</a></h2>\n<p>首先安装 <a href=\"https://en.wikipedia.org/wiki/Xvfb\">Xvfb</a>. 这是一个虚拟的帧缓冲，实现了X11显示服务协议，所有的图形操作都在内存中表现，而不需要显示在 任何屏幕输出设备上。这正是我们所需要的。</p>\n<p>然后创建一个虚拟屏幕实例(Xvfb), 并导出 DISPLAY 变量, 该变量存储虚拟屏幕的引用. Electron 中的 Chromium 会自动的去寻找 <code>$DISPLAY</code>，所以你的应用不需要再去进行配置 这一步可以通过 Paul Betts 的 <a href=\"https://github.com/anaisbetts/xvfb-maybe\">xvfb-maybe</a> 实现自动化：如果系统需要，在<code>xvfb-maybe</code>前加上你的测试命令 然后这个小工具会自动的设置 xvfb。 在 Windows 或 macOS ，它不会执行任何东西。</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-comment\">## 在 Windows 或者 macOS，这只是调用 electron-mocha</span>\n<span class=\"hljs-comment\">## 在 Linux， 如果我们在一个 headless 环境，这将是等同于</span>\n<span class=\"hljs-comment\">## 执行 xvfb-run electron-mocha ./test/*.js</span>\nxvfb-maybe electron-mocha ./<span class=\"hljs-built_in\">test</span>/*.js\n</code></pre>\n<h3 id=\"travis-ci\"><a href=\"#travis-ci\">Travis CI</a></h3>\n<p>在 Travis 上, 你的 <code>.travis.yml</code> 应该和下面的代码相似:</p>\n<pre><code class=\"hljs language-yml\"><span class=\"hljs-attr\">addons:</span>\n  <span class=\"hljs-attr\">apt:</span>\n    <span class=\"hljs-attr\">packages:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">xvfb</span>\n\n<span class=\"hljs-attr\">install:</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">export</span> <span class=\"hljs-string\">DISPLAY=':99.0'</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">Xvfb</span> <span class=\"hljs-string\">:99</span> <span class=\"hljs-string\">-screen</span> <span class=\"hljs-number\">0</span> <span class=\"hljs-string\">1024x768x24</span> <span class=\"hljs-string\">></span> <span class=\"hljs-string\">/dev/null</span> <span class=\"hljs-number\">2</span><span class=\"hljs-string\">>&#x26;1</span> <span class=\"hljs-string\">&#x26;</span>\n</code></pre>\n<h3 id=\"jenkins\"><a href=\"#jenkins\">Jenkins</a></h3>\n<p>Jenkins下, 有一个<a href=\"https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin\">可用的 Xvfb 插件</a>。</p>\n<h3 id=\"circle-ci\"><a href=\"#circle-ci\">Circle CI</a></h3>\n<p>Circle CI is awesome and has Xvfb and <code>$DISPLAY</code> <a href=\"https://circleci.com/docs/environment#browsers\">already set up, so no further configuration is required</a>.</p>\n<h3 id=\"appveyor\"><a href=\"#appveyor\">AppVeyor</a></h3>\n<p>AppVeyor 运行于 Windows 上，支持 Selenium，Chromium，Electron 以及一些类似的工具，开箱即用，无需配置</p>",
      "title": "Headless CI Systems 测试 (Travis CI, Jenkins)",
      "description": ""
    },
    "/docs/tutorial/testing-widevine-cdm": {
      "locale": "zh-CN",
      "slug": "testing-widevine-cdm",
      "href": "/docs/tutorial/testing-widevine-cdm",
      "crowdinFileId": "256257",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/testing-widevine-cdm.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"测试-widevine-cdm\"><a href=\"#测试-widevine-cdm\">测试 Widevine CDM</a></h1>\n<p>在 Electron 中，你可以使用 Widevine CDM 库装载 Chrome 浏览器。</p>\n<p>Widevine Content Decryption Modules (CDMs) are how streaming services protect content using HTML5 video to web browsers without relying on an NPAPI plugin like Flash or Silverlight. Widevine support is an alternative solution for streaming services that currently rely on Silverlight for playback of DRM-protected video content. It will allow websites to show DRM-protected video content in Firefox without the use of NPAPI plugins. The Widevine CDM runs in an open-source CDM sandbox providing better user security than NPAPI plugins.</p>\n<h4 id=\"note-on-vmp\"><a href=\"#note-on-vmp\">Note on VMP</a></h4>\n<p>As of <a href=\"https://electronjs.org/releases#1.8.1\"><code>Electron v1.8.0 (Chrome v59)</code></a>, the below steps are may only be some of the necessary steps to enable Widevine; any app on or after that version intending to use the Widevine CDM may need to be signed using a license obtained from <a href=\"https://www.widevine.com/\">Widevine</a> itself.</p>\n<p>Per <a href=\"https://www.widevine.com/\">Widevine</a>:</p>\n<blockquote>\n<p>Chrome 59 (and later) includes support for Verified Media Path (VMP). VMP provides a method to verify the authenticity of a device platform. For browser deployments, this will provide an additional signal to determine if a browser-based implementation is reliable and secure.</p>\n<p>The proxy integration guide has been updated with information about VMP and how to issue licenses.</p>\n<p>Widevine recommends our browser-based integrations (vendors and browser-based applications) add support for VMP.</p>\n</blockquote>\n<p>To enable video playback with this new restriction, <a href=\"https://castlabs.com/open-source/downstream/\">castLabs</a> has created a <a href=\"https://github.com/castlabs/electron-releases\">fork</a> that has implemented the necessary changes to enable Widevine to be played in an Electron application if one has obtained the necessary licenses from widevine.</p>\n<h2 id=\"getting-the-library\"><a href=\"#getting-the-library\">Getting the library</a></h2>\n<p>Open <code>chrome://components/</code> in Chrome browser, find <code>Widevine Content Decryption Module</code> and make sure it is up to date, then you can find the library files from the application directory.</p>\n<h3 id=\"on-windows\"><a href=\"#on-windows\">On Windows</a></h3>\n<p>The library file <code>widevinecdm.dll</code> will be under <code>Program Files(x86)/Google/Chrome/Application/CHROME_VERSION/WidevineCdm/_platform_specific/win_(x86|x64)/</code> directory.</p>\n<h3 id=\"在-macos-中\"><a href=\"#在-macos-中\">在 macOS 中</a></h3>\n<p>The library file <code>libwidevinecdm.dylib</code> will be under <code>/Applications/Google Chrome.app/Contents/Versions/CHROME_VERSION/Google Chrome Framework.framework/Versions/A/Libraries/WidevineCdm/_platform_specific/mac_(x86|x64)/</code> directory.</p>\n<p><strong>Note:</strong> Make sure that chrome version used by Electron is greater than or equal to the <code>min_chrome_version</code> value of Chrome's widevine cdm component. The value can be found in <code>manifest.json</code> under <code>WidevineCdm</code> directory.</p>\n<h2 id=\"using-the-library\"><a href=\"#using-the-library\">Using the library</a></h2>\n<p>After getting the library files, you should pass the path to the file with <code>--widevine-cdm-path</code> command line switch, and the library's version with <code>--widevine-cdm-version</code> switch. The command line switches have to be passed before the <code>ready</code> event of <code>app</code> module gets emitted.</p>\n<p>示例代码：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// You have to pass the directory that contains widevine library here, it is</span>\n<span class=\"hljs-comment\">// * `libwidevinecdm.dylib` on macOS,</span>\n<span class=\"hljs-comment\">// * `widevinecdm.dll` on Windows.</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'widevine-cdm-path'</span>, <span class=\"hljs-string\">'/path/to/widevine_library'</span>)\n<span class=\"hljs-comment\">// The version of plugin can be got from `chrome://components` page in Chrome.</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'widevine-cdm-version'</span>, <span class=\"hljs-string\">'1.4.8.866'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.show()\n})\n</code></pre>\n<h2 id=\"verifying-widevine-cdm-support\"><a href=\"#verifying-widevine-cdm-support\">Verifying Widevine CDM support</a></h2>\n<p>To verify whether widevine works, you can use following ways:</p>\n<ul>\n<li>打开 <a href=\"https://shaka-player-demo.appspot.com/\">https://shaka-player-demo.appspot.com/</a> 加载一个使用 <code>Widevine</code> 的 manifest。</li>\n<li>打开 <a href=\"http://www.dash-player.com/demo/drm-test-area/%EF%BC%8C%E6%A3%80%E6%9F%A5%E6%98%AF%E5%90%A6%E7%95%8C%E9%9D%A2%E8%BE%93%E5%87%BA\">http://www.dash-player.com/demo/drm-test-area/，检查是否界面输出</a> <code>bitdash uses Widevine in your browser</code>，然后播放 video。</li>\n</ul>",
      "title": "测试 Widevine CDM",
      "description": "Chrome 59 (and later) includes support for Verified Media Path (VMP). VMP provides a method to verify the authenticity of a device platform. For browser deployments, this will provide an additional signal to determine if a browser-based implementation is reliable and secure.\nThe proxy integration guide has been updated with information about VMP and how to issue licenses.\nWidevine recommends our browser-based integrations (vendors and browser-based applications) add support for VMP."
    },
    "/docs/api/structures/thumbar-button": {
      "locale": "zh-CN",
      "slug": "thumbar-button",
      "href": "/docs/api/structures/thumbar-button",
      "crowdinFileId": "256515",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/thumbar-button.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"thumbarbutton-object\"><a href=\"#thumbarbutton-object\">ThumbarButton Object</a></h1>\n<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - The icon showing in thumbnail toolbar.</li>\n<li><code>click</code> Function</li>\n<li><code>tooltip</code> String (optional) - The text of the button's tooltip.</li>\n<li><code>flags</code> String<a href=\"/docs/api/structures/optional\"></a> - Control specific states and behaviors of the button. By default, it is <code>['enabled']</code>.</li>\n</ul>\n<p>The <code>flags</code> is an array that can include following <code>String</code>s:</p>\n<ul>\n<li><code>enabled</code> - The button is active and available to the user.</li>\n<li><code>disabled</code> - The button is disabled. It is present, but has a visual state indicating it will not respond to user action.</li>\n<li><code>dismissonclick</code> - When the button is clicked, the thumbnail window closes immediately.</li>\n<li><code>nobackground</code> - Do not draw a button border, use only the image.</li>\n<li><code>hidden</code> - The button is not shown to the user.</li>\n<li><code>noninteractive</code> - The button is enabled but not interactive; no pressed button state is drawn. This value is intended for instances where the button is used in a notification.</li>\n</ul>",
      "title": "ThumbarButton Object",
      "description": ""
    },
    "/docs/api/touch-bar": {
      "locale": "zh-CN",
      "slug": "touch-bar",
      "href": "/docs/api/touch-bar",
      "crowdinFileId": "256395",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"触控板\"><a href=\"#触控板\">触控板</a></h1>\n<h2 id=\"类-touchbar\"><a href=\"#类-touchbar\">类: TouchBar</a></h2>\n<blockquote>\n<p>为原生macOS应用创建TouchBar布局</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<h3 id=\"new-touchbaroptions\"><a href=\"#new-touchbaroptions\"><code>new TouchBar(options)</code></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>items</code> (<a href=\"/docs/api/touch-bar-button\">TouchBarButton</a> | <a href=\"/docs/api/touch-bar-color-picker\">TouchBarColorPicker</a> | <a href=\"/docs/api/touch-bar-group\">TouchBarGroup</a> | <a href=\"/docs/api/touch-bar-label\">TouchBarLabel</a> | <a href=\"/docs/api/touch-bar-popover\">TouchBarPopover</a> | <a href=\"/docs/api/touch-bar-scrubber\">TouchBarScrubber</a> | <a href=\"/docs/api/touch-bar-segmented-control\">TouchBarSegmentedControl</a> | <a href=\"/docs/api/touch-bar-slider\">TouchBarSlider</a> | <a href=\"/docs/api/touch-bar-spacer\">TouchBarSpacer</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>escapeItem</code> (<a href=\"/docs/api/touch-bar-button\">TouchBarButton</a> | <a href=\"/docs/api/touch-bar-color-picker\">TouchBarColorPicker</a> | <a href=\"/docs/api/touch-bar-group\">TouchBarGroup</a> | <a href=\"/docs/api/touch-bar-label\">TouchBarLabel</a> | <a href=\"/docs/api/touch-bar-popover\">TouchBarPopover</a> | <a href=\"/docs/api/touch-bar-scrubber\">TouchBarScrubber</a> | <a href=\"/docs/api/touch-bar-segmented-control\">TouchBarSegmentedControl</a> | <a href=\"/docs/api/touch-bar-slider\">TouchBarSlider</a> | <a href=\"/docs/api/touch-bar-spacer\">TouchBarSpacer</a> | null) (可选的)</li>\n</ul></li>\n</ul>\n<p>Creates a new touch bar with the specified items. Use <code>BrowserWindow.setTouchBar</code> to add the <code>TouchBar</code> to a window.</p>\n<p><strong>注意:</strong> TouchBar API目前为实验性质，可能会更改或删除。</p>\n<p><strong>Tip:</strong> If you don't have a MacBook with Touch Bar, you can use <a href=\"https://github.com/sindresorhus/touch-bar-simulator\">Touch Bar Simulator</a> to test Touch Bar usage in your app.</p>\n<h3 id=\"static-properties\"><a href=\"#static-properties\">Static Properties</a></h3>\n<h4 id=\"touchbarbutton\"><a href=\"#touchbarbutton\"><code>TouchBarButton</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-button\"><code>typeof TouchBarButton</code></a> reference to the <code>TouchBarButton</code> class.</p>\n<h4 id=\"touchbarcolorpicker\"><a href=\"#touchbarcolorpicker\"><code>TouchBarColorPicker</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-color-picker\"><code>typeof TouchBarColorPicker</code></a> reference to the <code>TouchBarColorPicker</code> class.</p>\n<h4 id=\"touchbargroup\"><a href=\"#touchbargroup\"><code>TouchBarGroup</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-group\"><code>typeof TouchBarGroup</code></a> reference to the <code>TouchBarGroup</code> class.</p>\n<h4 id=\"touchbarlabel\"><a href=\"#touchbarlabel\"><code>TouchBarLabel</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-label\"><code>typeof TouchBarLabel</code></a> reference to the <code>TouchBarLabel</code> class.</p>\n<h4 id=\"touchbarpopover\"><a href=\"#touchbarpopover\"><code>TouchBarPopover</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-popover\"><code>typeof TouchBarPopover</code></a> reference to the <code>TouchBarPopover</code> class.</p>\n<h4 id=\"touchbarscrubber\"><a href=\"#touchbarscrubber\"><code>TouchBarScrubber</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-scrubber\"><code>typeof TouchBarScrubber</code></a> reference to the <code>TouchBarScrubber</code> class.</p>\n<h4 id=\"touchbarsegmentedcontrol\"><a href=\"#touchbarsegmentedcontrol\"><code>TouchBarSegmentedControl</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-segmented-control\"><code>typeof TouchBarSegmentedControl</code></a> reference to the <code>TouchBarSegmentedControl</code> class.</p>\n<h4 id=\"touchbarslider\"><a href=\"#touchbarslider\"><code>TouchBarSlider</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-slider\"><code>typeof TouchBarSlider</code></a> reference to the <code>TouchBarSlider</code> class.</p>\n<h4 id=\"touchbarspacer\"><a href=\"#touchbarspacer\"><code>TouchBarSpacer</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-spacer\"><code>typeof TouchBarSpacer</code></a> reference to the <code>TouchBarSpacer</code> class.</p>\n<h4 id=\"touchbarotheritemsproxy\"><a href=\"#touchbarotheritemsproxy\"><code>TouchBarOtherItemsProxy</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-other-items-proxy\"><code>typeof TouchBarOtherItemsProxy</code></a> reference to the <code>TouchBarOtherItemsProxy</code> class.</p>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<p>在<code>TouchBar</code>的实例中有以下属性可用：</p>\n<h4 id=\"touchbarescapeitem\"><a href=\"#touchbarescapeitem\"><code>touchBar.escapeItem</code></a></h4>\n<p><code>TouchBarItem</code>设置的内容将替换掉Touch bar中的“esc”按钮 将该项设为<code>null</code>以使用默认的\"esc\"按钮 修改这个值将立即更新Touch bar中的返回按钮</p>\n<h2 id=\"示例\"><a href=\"#示例\">示例</a></h2>\n<p>下面是一个带有一个按钮和若干文本的简易Touch bar老虎机游戏示例</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, TouchBar } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> { TouchBarLabel, TouchBarButton, TouchBarSpacer } = TouchBar\n\n<span class=\"hljs-keyword\">let</span> spinning = <span class=\"hljs-literal\">false</span>\n\n<span class=\"hljs-comment\">// Reel labels</span>\n<span class=\"hljs-keyword\">const</span> reel1 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n<span class=\"hljs-keyword\">const</span> reel2 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n<span class=\"hljs-keyword\">const</span> reel3 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n\n<span class=\"hljs-comment\">// Spin result label</span>\n<span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n\n<span class=\"hljs-comment\">// Spin button</span>\n<span class=\"hljs-keyword\">const</span> spin = <span class=\"hljs-keyword\">new</span> TouchBarButton({\n  <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'🎰 Spin'</span>,\n  <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#7851A9'</span>,\n  <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// Ignore clicks if already spinning</span>\n    <span class=\"hljs-keyword\">if</span> (spinning) {\n      <span class=\"hljs-keyword\">return</span>\n    }\n\n    spinning = <span class=\"hljs-literal\">true</span>\n    result.label = <span class=\"hljs-string\">''</span>\n\n    <span class=\"hljs-keyword\">let</span> timeout = <span class=\"hljs-number\">10</span>\n    <span class=\"hljs-keyword\">const</span> spinLength = <span class=\"hljs-number\">4</span> * <span class=\"hljs-number\">1000</span> <span class=\"hljs-comment\">// 4 seconds</span>\n    <span class=\"hljs-keyword\">const</span> startTime = <span class=\"hljs-built_in\">Date</span>.now()\n\n    <span class=\"hljs-keyword\">const</span> spinReels = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      updateReels()\n\n      <span class=\"hljs-keyword\">if</span> ((<span class=\"hljs-built_in\">Date</span>.now() - startTime) >= spinLength) {\n        finishSpin()\n      } <span class=\"hljs-keyword\">else</span> {\n        <span class=\"hljs-comment\">// Slow down a bit on each spin</span>\n        timeout *= <span class=\"hljs-number\">1.1</span>\n        setTimeout(spinReels, timeout)\n      }\n    }\n\n    spinReels()\n  }\n})\n\n<span class=\"hljs-keyword\">const</span> getRandomValue = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> values = [<span class=\"hljs-string\">'🍒'</span>, <span class=\"hljs-string\">'💎'</span>, <span class=\"hljs-string\">'7️⃣'</span>, <span class=\"hljs-string\">'🍊'</span>, <span class=\"hljs-string\">'🔔'</span>, <span class=\"hljs-string\">'⭐'</span>, <span class=\"hljs-string\">'🍇'</span>, <span class=\"hljs-string\">'🍀'</span>]\n  <span class=\"hljs-keyword\">return</span> values[<span class=\"hljs-built_in\">Math</span>.floor(<span class=\"hljs-built_in\">Math</span>.random() * values.length)]\n}\n\n<span class=\"hljs-keyword\">const</span> updateReels = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  reel1.label = getRandomValue()\n  reel2.label = getRandomValue()\n  reel3.label = getRandomValue()\n}\n\n<span class=\"hljs-keyword\">const</span> finishSpin = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> uniqueValues = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Set</span>([reel1.label, reel2.label, reel3.label]).size\n  <span class=\"hljs-keyword\">if</span> (uniqueValues === <span class=\"hljs-number\">1</span>) {\n    <span class=\"hljs-comment\">// All 3 values are the same</span>\n    result.label = <span class=\"hljs-string\">'💰 Jackpot!'</span>\n    result.textColor = <span class=\"hljs-string\">'#FDFF00'</span>\n  } <span class=\"hljs-keyword\">else</span> <span class=\"hljs-keyword\">if</span> (uniqueValues === <span class=\"hljs-number\">2</span>) {\n    <span class=\"hljs-comment\">// 2 values are the same</span>\n    result.label = <span class=\"hljs-string\">'😍 Winner!'</span>\n    result.textColor = <span class=\"hljs-string\">'#FDFF00'</span>\n  } <span class=\"hljs-keyword\">else</span> {\n    <span class=\"hljs-comment\">// No values are the same</span>\n    result.label = <span class=\"hljs-string\">'🙁 Spin Again'</span>\n    result.textColor = <span class=\"hljs-literal\">null</span>\n  }\n  spinning = <span class=\"hljs-literal\">false</span>\n}\n\n<span class=\"hljs-keyword\">const</span> touchBar = <span class=\"hljs-keyword\">new</span> TouchBar({\n  <span class=\"hljs-attr\">items</span>: [\n    spin,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'large'</span> }),\n    reel1,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'small'</span> }),\n    reel2,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'small'</span> }),\n    reel3,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'large'</span> }),\n    result\n  ]\n})\n\n<span class=\"hljs-keyword\">let</span> <span class=\"hljs-built_in\">window</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-built_in\">window</span> = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span>,\n    <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span>,\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#000'</span>\n  })\n  <span class=\"hljs-built_in\">window</span>.loadURL(<span class=\"hljs-string\">'about:blank'</span>)\n  <span class=\"hljs-built_in\">window</span>.setTouchBar(touchBar)\n})\n</code></pre>\n<h3 id=\"运行以上示例\"><a href=\"#运行以上示例\">运行以上示例</a></h3>\n<p>要运行上面的示例，您需要 (假设您已经在将要运行该示例的目录中打开了一个终端)：</p>\n<ol>\n<li>将上述文件保存到您的电脑上，并命名为 <code>touchbar.js</code></li>\n<li>通过 <code>npm install electron</code> 来安装 Electron</li>\n<li>在 Electron 中运行示例：<code>./node_modules/.bin/electron touchbar.js</code></li>\n</ol>\n<p>接下来这个应用会在你的Touch bar (或者Touch bar模拟器) 上运行，你将能看到一个Electron窗口</p>",
      "title": "触控板",
      "description": "为原生macOS应用创建TouchBar布局"
    },
    "/docs/api/touch-bar-button": {
      "locale": "zh-CN",
      "slug": "touch-bar-button",
      "href": "/docs/api/touch-bar-button",
      "crowdinFileId": "256375",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-button.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类-touchbarbutton\"><a href=\"#类-touchbarbutton\">类: TouchBarButton</a></h2>\n<blockquote>\n<p>为mac os应用在touch bar中创建一个按钮组件</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarbuttonoptions\"><a href=\"#new-touchbarbuttonoptions\"><code>new TouchBarButton(options)</code></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>label</code>String (可选) 按钮文本。</li>\n<li><code>accessibilityLabel</code> String (optional) - A short description of the button for use by screenreaders like VoiceOver.</li>\n<li><code>backgroundColor</code>String (可选) - 按钮背景颜色以十六进制格式，例如 <code>#ABCDEF</code>。</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String (optional) - Button icon.</li>\n<li><code>iconPosition</code>String (可选) - 可以是 <code>left</code>、<code> right</code> 或 <code>overlay</code>。 默认值为 <code>overlay</code>。</li>\n<li><code>click</code>function (可选) - 单击按钮时调用的函数。</li>\n<li><code>enabled</code> Boolean (optional) - Whether the button is in an enabled state.  默认值为 <code>true</code>。</li>\n</ul></li>\n</ul>\n<p>When defining <code>accessibilityLabel</code>, ensure you have considered macOS <a href=\"https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc\">best practices</a>.</p>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<p>下面的这些是<code>TouchBarButton</code>中的属性：</p>\n<h4 id=\"touchbarbuttonaccessibilitylabel\"><a href=\"#touchbarbuttonaccessibilitylabel\"><code>touchBarButton.accessibilityLabel</code></a></h4>\n<p>A <code>String</code> representing the description of the button to be read by a screen reader. Will only be read by screen readers if no label is set.</p>\n<h4 id=\"touchbarbuttonlabel\"><a href=\"#touchbarbuttonlabel\"><code>touchBarButton.label</code></a></h4>\n<p>A <code>String</code> representing the button's current text. Changing this value immediately updates the button in the touch bar.</p>\n<h4 id=\"touchbarbuttonbackgroundcolor\"><a href=\"#touchbarbuttonbackgroundcolor\"><code>touchBarButton.backgroundColor</code></a></h4>\n<p>A <code>String</code> hex code representing the button's current background color. Changing this value immediately updates the button in the touch bar.</p>\n<h4 id=\"touchbarbuttonicon\"><a href=\"#touchbarbuttonicon\"><code>touchBarButton.icon</code></a></h4>\n<p>A <code>NativeImage</code> representing the button's current icon. Changing this value immediately updates the button in the touch bar.</p>\n<h4 id=\"touchbarbuttoniconposition\"><a href=\"#touchbarbuttoniconposition\"><code>touchBarButton.iconPosition</code></a></h4>\n<p>A <code>String</code> - Can be <code>left</code>, <code>right</code> or <code>overlay</code>.  默认值为 <code>overlay</code>。</p>\n<h4 id=\"touchbarbuttonenabled\"><a href=\"#touchbarbuttonenabled\"><code>touchBarButton.enabled</code></a></h4>\n<p>A <code>Boolean</code> representing whether the button is in an enabled state.</p>",
      "title": "类: TouchBarButton",
      "description": "为mac os应用在touch bar中创建一个按钮组件"
    },
    "/docs/api/touch-bar-color-picker": {
      "locale": "zh-CN",
      "slug": "touch-bar-color-picker",
      "href": "/docs/api/touch-bar-color-picker",
      "crowdinFileId": "256377",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-color-picker.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类-touchbarcolorpicker\"><a href=\"#类-touchbarcolorpicker\">类: TouchBarColorPicker</a></h2>\n<blockquote>\n<p>在macOS 应用程序中，为触控栏创建拾色器</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarcolorpickeroptions\"><a href=\"#new-touchbarcolorpickeroptions\"><code>new TouchBarColorPicker(options)</code></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>availableColors</code> String<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a> - 由可选的十六进位色值组成的字符串数组.</li>\n<li><code>backgroundColor</code>String (可选) - 拾色器选中的颜色十六进位色值，例如 <code>#ABCDEF</code>。</li>\n<li><code>change</code> Function (optional) - Function to call when a color is selected.<ul>\n<li><code>color</code> String - 用户从拾色器中选取的颜色.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<p>以下为<code>TouchBarColorPicker</code> 实例的可用属性:</p>\n<h4 id=\"touchbarcolorpickeravailablecolors\"><a href=\"#touchbarcolorpickeravailablecolors\"><code>touchBarColorPicker.availableColors</code></a></h4>\n<p>A <code>String[]</code> array representing the color picker's available colors to select. Changing this value immediately updates the color picker in the touch bar.</p>\n<h4 id=\"touchbarcolorpickerselectedcolor\"><a href=\"#touchbarcolorpickerselectedcolor\"><code>touchBarColorPicker.selectedColor</code></a></h4>\n<p>A <code>String</code> hex code representing the color picker's currently selected color. Changing this value immediately updates the color picker in the touch bar.</p>",
      "title": "类: TouchBarColorPicker",
      "description": "在macOS 应用程序中，为触控栏创建拾色器"
    },
    "/docs/api/touch-bar-group": {
      "locale": "zh-CN",
      "slug": "touch-bar-group",
      "href": "/docs/api/touch-bar-group",
      "crowdinFileId": "256379",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-group.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类-touchbargroup\"><a href=\"#类-touchbargroup\">类: TouchBarGroup</a></h2>\n<blockquote>\n<p>为本地mac os创建一个触控条组</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbargroupoptions\"><a href=\"#new-touchbargroupoptions\"><code>new TouchBarGroup(options)</code></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>items</code> <a href=\"/docs/api/touch-bar\">TouchBar</a> - 以分组的方式显示元素.</li>\n</ul></li>\n</ul>",
      "title": "类: TouchBarGroup",
      "description": "为本地mac os创建一个触控条组"
    },
    "/docs/api/touch-bar-label": {
      "locale": "zh-CN",
      "slug": "touch-bar-label",
      "href": "/docs/api/touch-bar-label",
      "crowdinFileId": "256381",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-label.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类-touchbarlabel\"><a href=\"#类-touchbarlabel\">类: TouchBarLabel</a></h2>\n<blockquote>\n<p>在原生macOS应用程序的触摸栏中创建一个标签</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarlabeloptions\"><a href=\"#new-touchbarlabeloptions\"><code>new TouchBarLabel(options)</code></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>label</code> String (可选) - 显示的文本.</li>\n<li><code>accessibilityLabel</code> String (optional) - A short description of the button for use by screenreaders like VoiceOver.</li>\n<li><code>textColor</code> String（可选） - 文本的十六进制颜色，例如#ABCDEF。</li>\n</ul></li>\n</ul>\n<p>When defining <code>accessibilityLabel</code>, ensure you have considered macOS <a href=\"https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc\">best practices</a>.</p>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<p>以下属性可用于 <code>TouchBarLabel</code>:</p>\n<h4 id=\"touchbarlabellabel\"><a href=\"#touchbarlabellabel\"><code>touchBarLabel.label</code></a></h4>\n<p>A <code>String</code> representing the label's current text. Changing this value immediately updates the label in the touch bar.</p>\n<h4 id=\"touchbarlabelaccessibilitylabel\"><a href=\"#touchbarlabelaccessibilitylabel\"><code>touchBarLabel.accessibilityLabel</code></a></h4>\n<p>A <code>String</code> representing the description of the label to be read by a screen reader.</p>\n<h4 id=\"touchbarlabeltextcolor\"><a href=\"#touchbarlabeltextcolor\"><code>touchBarLabel.textColor</code></a></h4>\n<p>A <code>String</code> hex code representing the label's current text color. Changing this value immediately updates the label in the touch bar.</p>",
      "title": "类: TouchBarLabel",
      "description": "在原生macOS应用程序的触摸栏中创建一个标签"
    },
    "/docs/api/touch-bar-other-items-proxy": {
      "locale": "zh-CN",
      "slug": "touch-bar-other-items-proxy",
      "href": "/docs/api/touch-bar-other-items-proxy",
      "crowdinFileId": "256383",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-other-items-proxy.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarotheritemsproxy\"><a href=\"#class-touchbarotheritemsproxy\">Class: TouchBarOtherItemsProxy</a></h2>\n<blockquote>\n<p>Instantiates a special \"other items proxy\", which nests TouchBar elements inherited from Chromium at the space indicated by the proxy. By default, this proxy is added to each TouchBar at the end of the input. For more information, see the AppKit docs on <a href=\"https://developer.apple.com/documentation/appkit/nstouchbaritemidentifierotheritemsproxy\">NSTouchBarItemIdentifierOtherItemsProxy</a></p>\n<p>Note: Only one instance of this class can be added per TouchBar.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarotheritemsproxy\"><a href=\"#new-touchbarotheritemsproxy\"><code>new TouchBarOtherItemsProxy()</code></a></h3>",
      "title": "TouchBarOtherItemsProxy",
      "description": "Instantiates a special \"other items proxy\", which nests TouchBar elements inherited from Chromium at the space indicated by the proxy. By default, this proxy is added to each TouchBar at the end of the input. For more information, see the AppKit docs on NSTouchBarItemIdentifierOtherItemsProxy\nNote: Only one instance of this class can be added per TouchBar."
    },
    "/docs/api/touch-bar-popover": {
      "locale": "zh-CN",
      "slug": "touch-bar-popover",
      "href": "/docs/api/touch-bar-popover",
      "crowdinFileId": "256385",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-popover.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类-touchbarpopover\"><a href=\"#类-touchbarpopover\">类: TouchBarPopover</a></h2>\n<blockquote>\n<p>为macOS原生应用在触摸栏中创建一个弹出控件</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarpopoveroptions\"><a href=\"#new-touchbarpopoveroptions\"><code>new TouchBarPopover(options)</code></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>label</code>String (可选) 弹出按钮文本。</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (可选) - 弹出按钮图标。</li>\n<li><code>items</code> <a href=\"/docs/api/touch-bar\">TouchBar</a> - Items to display in the popover.</li>\n<li><code>showCloseButton</code> Boolean (optional) - <code>true</code> to display a close button on the left of the popover, <code>false</code> to not show it. 默认值为 <code>true</code>。</li>\n</ul></li>\n</ul>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<p>以下为 <code>TouchBarPopover</code> 实例的可用属性:</p>\n<h4 id=\"touchbarpopoverlabel\"><a href=\"#touchbarpopoverlabel\"><code>touchBarPopover.label</code></a></h4>\n<p>A <code>String</code> representing the popover's current button text. Changing this value immediately updates the popover in the touch bar.</p>\n<h4 id=\"touchbarpopovericon\"><a href=\"#touchbarpopovericon\"><code>touchBarPopover.icon</code></a></h4>\n<p>A <code>NativeImage</code> representing the popover's current button icon. Changing this value immediately updates the popover in the touch bar.</p>",
      "title": "类: TouchBarPopover",
      "description": "为macOS原生应用在触摸栏中创建一个弹出控件"
    },
    "/docs/api/touch-bar-scrubber": {
      "locale": "zh-CN",
      "slug": "touch-bar-scrubber",
      "href": "/docs/api/touch-bar-scrubber",
      "crowdinFileId": "256387",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-scrubber.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类-touchbarscrubber\"><a href=\"#类-touchbarscrubber\">类: TouchBarScrubber</a></h2>\n<blockquote>\n<p>创建一个scrubber (可滚动的选择程序)</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarscrubberoptions\"><a href=\"#new-touchbarscrubberoptions\"><code>new TouchBarScrubber(options)</code></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>items</code> <a href=\"/docs/api/structures/scrubber-item\">ScrubberItem[]</a> 一个数组，表示 scrubber 里的项目。</li>\n<li><code>select</code> Function (optional) - Called when the user taps an item that was not the last tapped item.<ul>\n<li><code>selectedIndex</code> Integer - 用户选中项排序。</li>\n</ul></li>\n<li><code>highlight</code> Function (optional) - Called when the user taps any item.<ul>\n<li>highlightedIndex Integer - 用户选中项排序.</li>\n</ul></li>\n<li><code>selectedStyle</code> String (optional) - Selected item style. Can be <code>background</code>, <code>outline</code> or <code>none</code>. 默认值为：<code>none</code>。</li>\n<li><code>overlayStyle</code> String (optional) - Selected overlay item style. Can be <code>background</code>, <code>outline</code> or <code>none</code>. 默认值为：<code>none</code>。</li>\n<li><code>showArrowButtons</code> Boolean (可选) - 是否在任务栏中显示窗口。 默认为 <code>false</code> 并且只在 <code>items</code> 是非空的情况下才显示。</li>\n<li><code>mode</code> String (可选) - 可以是 <code>fixed</code> 或 <code>free</code>。 默认值为<code>free</code>.</li>\n<li><code>continuous</code> Boolean (optional) - Defaults to <code>true</code>.</li>\n</ul></li>\n</ul>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<p>以下为 <code>TouchBarScrubber</code> 实例的可用属性:</p>\n<h4 id=\"touchbarscrubberitems\"><a href=\"#touchbarscrubberitems\"><code>touchBarScrubber.items</code></a></h4>\n<p>一个Scrubberitem[] 数组代表Scrubber里的所有物品。 改变这个值会立刻刷新touch bar内的控件。 然而改变数组某元素内的嵌套属性<strong>不会刷新touch bar</strong>。</p>\n<h4 id=\"touchbarscrubberselectedstyle\"><a href=\"#touchbarscrubberselectedstyle\"><code>touchBarScrubber.selectedStyle</code></a></h4>\n<p>一个<code>String</code>，用来表示在scrubber内被选择的组件应有的样式。 改变这个值会立刻刷新touch bar内的控件。 可选值：</p>\n<ul>\n<li><code>background</code> - 映射为<code>[NSScrubberSelectionStyle roundedBackgroundStyle]</code></li>\n<li><code>outline</code> - 映射为<code>[NSScrubberSelectionStyle outlineOverlayStyle]</code></li>\n<li><code>none</code> - Removes all styles.</li>\n</ul>\n<h4 id=\"touchbarscrubberoverlaystyle\"><a href=\"#touchbarscrubberoverlaystyle\"><code>touchBarScrubber.overlayStyle</code></a></h4>\n<p>一个<code>String</code>，用来表示在scrubber内被选择的组件应有的样式。 该样式将会覆盖在scrubber组件之上而非其后。 改变这个值会立刻刷新touch bar的控件。 可选值：</p>\n<ul>\n<li><code>background</code> - 映射为<code>[NSScrubberSelectionStyle roundedBackgroundStyle]</code></li>\n<li><code>outline</code> - 映射为<code>[NSScrubberSelectionStyle outlineOverlayStyle]</code></li>\n<li><code>none</code> - Removes all styles.</li>\n</ul>\n<h4 id=\"touchbarscrubbershowarrowbuttons\"><a href=\"#touchbarscrubbershowarrowbuttons\"><code>touchBarScrubber.showArrowButtons</code></a></h4>\n<p>A <code>Boolean</code> representing whether to show the left / right selection arrows in this scrubber. Updating this value immediately updates the control in the touch bar.</p>\n<h4 id=\"touchbarscrubbermode\"><a href=\"#touchbarscrubbermode\"><code>touchBarScrubber.mode</code></a></h4>\n<p>A <code>String</code> representing the mode of this scrubber. 改变这个值会立刻刷新touch bar内的控件。 可选值：</p>\n<ul>\n<li><code>fixed</code> - 映射到<code>NSScrubberModeFixed</code></li>\n<li><code>free</code> - 映射到<code>NSScrubberModeFree</code>.</li>\n</ul>\n<h4 id=\"touchbarscrubbercontinuous\"><a href=\"#touchbarscrubbercontinuous\"><code>touchBarScrubber.continuous</code></a></h4>\n<p>A <code>Boolean</code> representing whether this scrubber is continuous or not. 改变这个值会立刻刷新touch bar内的控件。</p>",
      "title": "类: TouchBarScrubber",
      "description": "创建一个scrubber (可滚动的选择程序)"
    },
    "/docs/api/touch-bar-segmented-control": {
      "locale": "zh-CN",
      "slug": "touch-bar-segmented-control",
      "href": "/docs/api/touch-bar-segmented-control",
      "crowdinFileId": "256389",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-segmented-control.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类-touchbarsegmentedcontrol\"><a href=\"#类-touchbarsegmentedcontrol\">类: TouchBarSegmentedControl</a></h2>\n<blockquote>\n<p>创建一个分段控件（按钮组），其中一个按钮具有选定状态</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarsegmentedcontroloptions\"><a href=\"#new-touchbarsegmentedcontroloptions\"><code>new TouchBarSegmentedControl(options)</code></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>segmentStyle</code> String (optional) - Style of the segments:<ul>\n<li><code>automatic</code> - Default. The appearance of the segmented control is automatically determined based on the type of window in which the control is displayed and the position within the window. Maps to <code>NSSegmentStyleAutomatic</code>.</li>\n<li><code>rounded</code> - 控件的呈现使用圆形风格。 Maps to <code>NSSegmentStyleRounded</code>.</li>\n<li><code>textured-rounded</code> - 控件的呈现使用纹理圆形风格。 Maps to <code>NSSegmentStyleTexturedRounded</code>.</li>\n<li><code>round-rect</code> - 以圆角矩形样式显示控件。 Maps to <code>NSSegmentStyleRoundRect</code>.</li>\n<li><code>round-rect</code> - 以带纹理的矩形样式显示控件。 Maps to <code>NSSegmentStyleTexturedSquare</code>.</li>\n<li><code>capsule</code> - 以胶囊样式的风格显示控件 Maps to <code>NSSegmentStyleCapsule</code>.</li>\n<li><code>small-square</code> - 以小尺寸的矩形样式显示控件 Maps to <code>NSSegmentStyleSmallSquare</code>.</li>\n<li>表示控件的当前段样式。更新此值会立即更新触摸栏中的控件。 Maps to <code>NSSegmentStyleSeparated</code>.</li>\n</ul></li>\n<li><code>mode</code> String (optional) - The selection mode of the control:<ul>\n<li><code>single</code> - Default. One item selected at a time, selecting one deselects the previously selected item. Maps to <code>NSSegmentSwitchTrackingSelectOne</code>.</li>\n<li><code>multiple</code> - 可以选多个项。 Maps to <code>NSSegmentSwitchTrackingSelectAny</code>.</li>\n<li><code>buttons</code> - 将段作为按钮使用, 每一段都可以被按下和释放但是不会被标记为激活状态 Maps to <code>NSSegmentSwitchTrackingMomentary</code>.</li>\n</ul></li>\n<li><code>segments</code> <a href=\"/docs/api/structures/segmented-control-segment\">SegmentedControlSegment[]</a> - 被放到控件中的段的集合</li>\n<li><code>selectedIndex</code> Integer (optional) - 当前选中的段的下标, 这个值会在用户交互时自动更改 When the mode is <code>multiple</code> it will be the last selected item.</li>\n<li><code>change</code> Function (optional) - Called when the user selects a new segment.<ul>\n<li><code>selectedIndex</code> Integer - 用户选中的段的下标。</li>\n<li><code>isSelected</code> Boolean - 当前段的选中状态</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<p>以下为 <code>TouchBarSegmentedControl</code> 实例的可用属性:</p>\n<h4 id=\"touchbarsegmentedcontrolsegmentstyle\"><a href=\"#touchbarsegmentedcontrolsegmentstyle\"><code>touchBarSegmentedControl.segmentStyle</code></a></h4>\n<p>A <code>String</code> representing the controls current segment style. Updating this value immediately updates the control in the touch bar.</p>\n<h4 id=\"touchbarsegmentedcontrolsegments\"><a href=\"#touchbarsegmentedcontrolsegments\"><code>touchBarSegmentedControl.segments</code></a></h4>\n<p><code>SegmentedControlSegment[]</code>类型表示的控件中段的集合 改变这个值会立刻刷新touch bar内的控件。 然而改变数组某元素内的嵌套属性<strong>不会刷新touch bar</strong>。</p>\n<h4 id=\"touchbarsegmentedcontrolselectedindex\"><a href=\"#touchbarsegmentedcontrolselectedindex\"><code>touchBarSegmentedControl.selectedIndex</code></a></h4>\n<p><code>Integer</code>类型表示的当前选中段 改变这个值会立即触发更新当前段 用户对触摸条的操作会自动更新这个值</p>\n<h4 id=\"touchbarsegmentedcontrolmode\"><a href=\"#touchbarsegmentedcontrolmode\"><code>touchBarSegmentedControl.mode</code></a></h4>\n<p>A <code>String</code> representing the current selection mode of the control.  Can be <code>single</code>, <code>multiple</code> or <code>buttons</code>.</p>",
      "title": "类: TouchBarSegmentedControl",
      "description": "创建一个分段控件（按钮组），其中一个按钮具有选定状态"
    },
    "/docs/api/touch-bar-slider": {
      "locale": "zh-CN",
      "slug": "touch-bar-slider",
      "href": "/docs/api/touch-bar-slider",
      "crowdinFileId": "256391",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-slider.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类-touchbarslider\"><a href=\"#类-touchbarslider\">类: TouchBarSlider</a></h2>\n<blockquote>\n<p>为本机 macOS 应用程序在触摸栏中创建滑块</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarslideroptions\"><a href=\"#new-touchbarslideroptions\"><code>new TouchBarSlider(options)</code></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>label</code> String (可选) - 标签文本.</li>\n<li><code>value</code> Integer (可选) - 选中值.</li>\n<li><code>minValue</code> Integer (可选) - 最小值.</li>\n<li><code>maxValue</code> Integer (可选) - 最大值.</li>\n<li><code>change</code> Function (optional) - Function to call when the slider is changed.<ul>\n<li><code>newValue</code> Number - 用户选中的值.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<p>以下为 <code>TouchBarSlider</code> 实例的可用属性:</p>\n<h4 id=\"touchbarsliderlabel\"><a href=\"#touchbarsliderlabel\"><code>touchBarSlider.label</code></a></h4>\n<p>A <code>String</code> representing the slider's current text. Changing this value immediately updates the slider in the touch bar.</p>\n<h4 id=\"touchbarslidervalue\"><a href=\"#touchbarslidervalue\"><code>touchBarSlider.value</code></a></h4>\n<p>A <code>Number</code> representing the slider's current value. Changing this value immediately updates the slider in the touch bar.</p>\n<h4 id=\"touchbarsliderminvalue\"><a href=\"#touchbarsliderminvalue\"><code>touchBarSlider.minValue</code></a></h4>\n<p>A <code>Number</code> representing the slider's current minimum value. Changing this value immediately updates the slider in the touch bar.</p>\n<h4 id=\"touchbarslidermaxvalue\"><a href=\"#touchbarslidermaxvalue\"><code>touchBarSlider.maxValue</code></a></h4>\n<p>A <code>Number</code> representing the slider's current maximum value. Changing this value immediately updates the slider in the touch bar.</p>",
      "title": "类: TouchBarSlider",
      "description": "为本机 macOS 应用程序在触摸栏中创建滑块"
    },
    "/docs/api/touch-bar-spacer": {
      "locale": "zh-CN",
      "slug": "touch-bar-spacer",
      "href": "/docs/api/touch-bar-spacer",
      "crowdinFileId": "256393",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-spacer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类-touchbarspacer\"><a href=\"#类-touchbarspacer\">类: TouchBarSpacer</a></h2>\n<blockquote>\n<p>在mac os应用中，为touch bar中的相邻项之间留白</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarspaceroptions\"><a href=\"#new-touchbarspaceroptions\"><code>new TouchBarSpacer(options)</code></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>size</code> String (optional) - Size of spacer, possible values are:<ul>\n<li><code>small</code>-项之间的留较小间距。 Maps to <code>NSTouchBarItemIdentifierFixedSpaceSmall</code>. 默认为该值。</li>\n<li><code>large</code>-项之间的留较大间距。 Maps to <code>NSTouchBarItemIdentifierFixedSpaceLarge</code>.</li>\n<li><code>flexible</code>-补齐所有可用空间。 Maps to <code>NSTouchBarItemIdentifierFlexibleSpace</code>.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<p>以下属性可用于 <code>TouchBarSpacer</code>:</p>\n<h4 id=\"touchbarspacersize\"><a href=\"#touchbarspacersize\"><code>touchBarSpacer.size</code></a></h4>\n<p>A <code>String</code> representing the size of the spacer.  Can be <code>small</code>, <code>large</code> or <code>flexible</code>.</p>",
      "title": "类: TouchBarSpacer",
      "description": "在mac os应用中，为touch bar中的相邻项之间留白"
    },
    "/docs/api/structures/trace-categories-and-options": {
      "locale": "zh-CN",
      "slug": "trace-categories-and-options",
      "href": "/docs/api/structures/trace-categories-and-options",
      "crowdinFileId": "256517",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/trace-categories-and-options.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"tracecategoriesandoptions-object\"><a href=\"#tracecategoriesandoptions-object\">TraceCategoriesAndOptions Object</a></h1>\n<ul>\n<li><code>categoryFilter</code> String - A filter to control what category groups should be traced. A filter can have an optional '-' prefix to exclude category groups that contain a matching category. Having both included and excluded category patterns in the same list is not supported. Examples: <code>test_MyTest*</code>, <code>test_MyTest*,test_OtherStuff</code>, <code>-excluded_category1,-excluded_category2</code>.</li>\n<li><code>traceOptions</code> String - Controls what kind of tracing is enabled, it is a comma-delimited sequence of the following strings: <code>record-until-full</code>, <code>record-continuously</code>, <code>trace-to-console</code>, <code>enable-sampling</code>, <code>enable-systrace</code>, e.g. <code>'record-until-full,enable-sampling'</code>. The first 3 options are trace recording modes and hence mutually exclusive. If more than one trace recording modes appear in the <code>traceOptions</code> string, the last one takes precedence. If none of the trace recording modes are specified, recording mode is <code>record-until-full</code>. The trace option will first be reset to the default option (<code>record_mode</code> set to <code>record-until-full</code>, <code>enable_sampling</code> and <code>enable_systrace</code> set to <code>false</code>) before options parsed from <code>traceOptions</code> are applied on it.</li>\n</ul>",
      "title": "TraceCategoriesAndOptions Object",
      "description": ""
    },
    "/docs/api/structures/trace-config": {
      "locale": "zh-CN",
      "slug": "trace-config",
      "href": "/docs/api/structures/trace-config",
      "crowdinFileId": "256519",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/trace-config.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"traceconfig-object\"><a href=\"#traceconfig-object\">TraceConfig Object</a></h1>\n<ul>\n<li><code>recording_mode</code> String (optional) - Can be <code>record-until-full</code>, <code>record-continuously</code>, <code>record-as-much-as-possible</code> or <code>trace-to-console</code>. Defaults to <code>record-until-full</code>.</li>\n<li><code>trace_buffer_size_in_kb</code> number (optional) - maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.</li>\n<li><code>trace_buffer_size_in_events</code> number (optional) - maximum size of the trace recording buffer in events.</li>\n<li><code>enable_argument_filter</code> boolean (optional) - if true, filter event data according to a specific list of events that have been manually vetted to not include any PII. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/services/tracing/public/cpp/trace_event_args_whitelist.cc\">the implementation in Chromium</a> for specifics.</li>\n<li><code>included_categories</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of tracing categories to include. Can include glob-like patterns using <code>*</code> at the end of the category name. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">tracing categories</a> for the list of categories.</li>\n<li><code>excluded_categories</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of tracing categories to exclude. Can include glob-like patterns using <code>*</code> at the end of the category name. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">tracing categories</a> for the list of categories.</li>\n<li><code>included_process_ids</code> number<a href=\"/docs/api/structures/optional\"></a> - a list of process IDs to include in the trace. If not specified, trace all processes.</li>\n<li><code>histogram_names</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of <a href=\"https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md\">histogram</a> names to report with the trace.</li>\n<li><code>memory_dump_config</code> Record&#x3C;String, any> (optional) - if the <code>disabled-by-default-memory-infra</code> category is enabled, this contains optional additional configuration for data collection. See the <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/memory-infra/memory_infra_startup_tracing.md#the-advanced-way\">Chromium memory-infra docs</a> for more information.</li>\n</ul>\n<p>An example TraceConfig that roughly matches what Chrome DevTools records:</p>\n<pre><code class=\"hljs language-js\">{\n  <span class=\"hljs-attr\">recording_mode</span>: <span class=\"hljs-string\">'record-until-full'</span>,\n  <span class=\"hljs-attr\">included_categories</span>: [\n    <span class=\"hljs-string\">'devtools.timeline'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline.frame'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline.stack'</span>,\n    <span class=\"hljs-string\">'v8.execute'</span>,\n    <span class=\"hljs-string\">'blink.console'</span>,\n    <span class=\"hljs-string\">'blink.user_timing'</span>,\n    <span class=\"hljs-string\">'latencyInfo'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-v8.cpu_profiler'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-v8.cpu_profiler.hires'</span>\n  ],\n  <span class=\"hljs-attr\">excluded_categories</span>: [<span class=\"hljs-string\">'*'</span>]\n}\n</code></pre>",
      "title": "TraceConfig Object",
      "description": ""
    },
    "/docs/api/structures/transaction": {
      "locale": "zh-CN",
      "slug": "transaction",
      "href": "/docs/api/structures/transaction",
      "crowdinFileId": "256521",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/transaction.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"transaction-object\"><a href=\"#transaction-object\">Transaction Object</a></h1>\n<ul>\n<li><code>transactionIdentifier</code> String - A string that uniquely identifies a successful payment transaction.</li>\n<li><code>transactionDate</code> String - The date the transaction was added to the App Store’s payment queue.</li>\n<li><code>originalTransactionIdentifier</code> String - The identifier of the restored transaction by the App Store.</li>\n<li><code>transactionState</code> String - The transaction state, can be <code>purchasing</code>, <code>purchased</code>, <code>failed</code>, <code>restored</code> or <code>deferred</code>.</li>\n<li><code>errorCode</code> Integer - The error code if an error occurred while processing the transaction.</li>\n<li><code>errorMessage</code> String - The error message if an error occurred while processing the transaction.</li>\n<li><code>payment</code> Object<ul>\n<li><code>productIdentifier</code> String - The identifier of the purchased product.</li>\n<li><code>quantity</code> Integer  - The quantity purchased.</li>\n</ul></li>\n</ul>",
      "title": "Transaction Object",
      "description": ""
    },
    "/docs/api/tray": {
      "locale": "zh-CN",
      "slug": "tray",
      "href": "/docs/api/tray",
      "crowdinFileId": "256397",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/tray.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"tray\"><a href=\"#tray\">Tray</a></h1>\n<h2 id=\"系统托盘\"><a href=\"#系统托盘\">系统托盘</a></h2>\n<blockquote>\n<p>添加图标和上下文菜单到系统通知区</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p><code>Tray</code>是一个<a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> tray = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/my/icon'</span>)\n  <span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item3'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item4'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n  ])\n  tray.setToolTip(<span class=\"hljs-string\">'This is my application.'</span>)\n  tray.setContextMenu(contextMenu)\n})\n</code></pre>\n<p><strong>平台限制：</strong></p>\n<ul>\n<li>在Linux上，如果支持，就使用应用程序指示器，否则将使用<code>GtkStatusIcon</code>。</li>\n<li>在仅支持应用程序指标的Linux发行版中，必须安装<code>libappindicator1</code>才能使任务栏图标正常工作。</li>\n<li>应用程序指标只有当它有一个上下文菜单时才会显示。</li>\n<li>当在Linux上使用应用程序指标时，它的 <code>click</code>事件将被忽略</li>\n<li>On Linux in order for changes made to individual <code>MenuItem</code>s to take effect, you have to call <code>setContextMenu</code> again. 例如：</li>\n</ul>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> appIcon = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/my/icon'</span>)\n  <span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n  ])\n\n  <span class=\"hljs-comment\">// Make a change to the context menu</span>\n  contextMenu.items[<span class=\"hljs-number\">1</span>].checked = <span class=\"hljs-literal\">false</span>\n\n  <span class=\"hljs-comment\">// Call this again for Linux because we modified the context menu</span>\n  appIcon.setContextMenu(contextMenu)\n})\n</code></pre>\n<ul>\n<li>在 Windows 上, 建议使用 <code>ICO</code> 图标来获得最佳视觉效果。</li>\n</ul>\n<p>如果要在所有平台上保持完全相同的行为, 则不应依赖 <code>click</code> 事件, 并且始终将上下文菜单附加到任务栏图标。</p>\n<h3 id=\"new-trayimage-guid\"><a href=\"#new-trayimage-guid\"><code>new Tray(image, [guid])</code></a></h3>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n<li><code>guid</code> String (optional) <em>Windows</em> - Assigns a GUID to the tray icon. If the executable is signed and the signature contains an organization in the subject line then the GUID is permanently associated with that signature. OS level settings like the position of the tray icon in the system tray will persist even if the path to the executable changes. If the executable is not code-signed then the GUID is permanently associated with the path to the executable. Changing the path to the executable will break the creation of the tray icon and a new GUID must be used. However, it is highly recommended to use the GUID parameter only in conjunction with code-signed executable. If an App defines multiple tray icons then each icon must use a separate GUID.</li>\n</ul>\n<p>创建与<code>image</code>关联的新任务栏图标。</p>\n<h3 id=\"实例事件\"><a href=\"#实例事件\">实例事件</a></h3>\n<p><code>Tray</code> 对象会发出以下事件:</p>\n<h4 id=\"事件-click\"><a href=\"#事件-click\">事件: 'click'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - 系统托盘图标的边界。</li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - 事件的位置信息。</li>\n</ul>\n<p>当该图标被点击时触发。</p>\n<h4 id=\"event-right-click-macos-windows\"><a href=\"#event-right-click-macos-windows\">Event: 'right-click' <em>macOS</em> <em>Windows</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - 系统托盘图标的边界。</li>\n</ul>\n<p>当该图标被右击时触发。</p>\n<h4 id=\"event-double-click-macos-windows\"><a href=\"#event-double-click-macos-windows\">Event: 'double-click' <em>macOS</em> <em>Windows</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - 系统托盘图标的边界。</li>\n</ul>\n<p>当该图标被双击时触发。</p>\n<h4 id=\"event-balloon-show-windows\"><a href=\"#event-balloon-show-windows\">Event: 'balloon-show' <em>Windows</em></a></h4>\n<p>当系统托盘图标气泡显示时，触发该事件。</p>\n<h4 id=\"event-balloon-click-windows\"><a href=\"#event-balloon-click-windows\">Event: 'balloon-click' <em>Windows</em></a></h4>\n<p>当系统托盘气泡被点击时，触发该事件。</p>\n<h4 id=\"event-balloon-closed-windows\"><a href=\"#event-balloon-closed-windows\">Event: 'balloon-closed' <em>Windows</em></a></h4>\n<p>当系统托盘气泡因为超时被关闭或者用户手动关闭时，触发该事件。</p>\n<h4 id=\"event-drop-macos\"><a href=\"#event-drop-macos\">Event: 'drop' <em>macOS</em></a></h4>\n<p>当有任何拖动项拖到该任务栏图标上时，触发该事件。</p>\n<h4 id=\"event-drop-files-macos\"><a href=\"#event-drop-files-macos\">Event: 'drop-files' <em>macOS</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>files</code> String[] - 拖至任务栏图标上的文件的路径。</li>\n</ul>\n<p>当有任何文件被拖到该任务栏图标上时，触发该事件。</p>\n<h4 id=\"event-drop-text-macos\"><a href=\"#event-drop-text-macos\">Event: 'drop-text' <em>macOS</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>text</code> String - 拖至任务栏图标上的文字内容。</li>\n</ul>\n<p>当有任何文字被拖到该任务栏图标上时，触发该事件。</p>\n<h4 id=\"event-drag-enter-macos\"><a href=\"#event-drag-enter-macos\">Event: 'drag-enter' <em>macOS</em></a></h4>\n<p>当有任何拖动操作进入（拖动未结束）该任务栏图标时，触发该事件。</p>\n<h4 id=\"event-drag-leave-macos\"><a href=\"#event-drag-leave-macos\">Event: 'drag-leave' <em>macOS</em></a></h4>\n<p>当有任何拖动操作离开该任务栏图标时，触发该事件。</p>\n<h4 id=\"event-drag-end-macos\"><a href=\"#event-drag-end-macos\">Event: 'drag-end' <em>macOS</em></a></h4>\n<p>当有任何拖动操作在托盘或其他地方结束时，触发该事件。</p>\n<h4 id=\"event-mouse-up-macos\"><a href=\"#event-mouse-up-macos\">Event: 'mouse-up' <em>macOS</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - 事件的位置信息。</li>\n</ul>\n<p>Emitted when the mouse is released from clicking the tray icon.</p>\n<p>Note: This will not be emitted if you have set a context menu for your Tray using <code>tray.setContextMenu</code>, as a result of macOS-level constraints.</p>\n<h4 id=\"event-mouse-down-macos\"><a href=\"#event-mouse-down-macos\">Event: 'mouse-down' <em>macOS</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - 事件的位置信息。</li>\n</ul>\n<p>Emitted when the mouse clicks the tray icon.</p>\n<h4 id=\"event-mouse-enter-macos\"><a href=\"#event-mouse-enter-macos\">Event: 'mouse-enter' <em>macOS</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - 事件的位置信息。</li>\n</ul>\n<p>当鼠标进入该任务栏图标时，触发该事件。</p>\n<h4 id=\"event-mouse-leave-macos\"><a href=\"#event-mouse-leave-macos\">Event: 'mouse-leave' <em>macOS</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - 事件的位置信息。</li>\n</ul>\n<p>当鼠标离开该任务栏图标时，触发该事件。</p>\n<h4 id=\"event-mouse-move-macos-windows\"><a href=\"#event-mouse-move-macos-windows\">Event: 'mouse-move' <em>macOS</em> <em>Windows</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - 事件的位置信息。</li>\n</ul>\n<p>当鼠标在该任务栏图标上移动时，触发该事件。</p>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<p><code>Tray</code> 类拥有以下方法:</p>\n<h4 id=\"traydestroy\"><a href=\"#traydestroy\"><code>tray.destroy()</code></a></h4>\n<p>立即销毁该任务栏图标</p>\n<h4 id=\"traysetimageimage\"><a href=\"#traysetimageimage\"><code>tray.setImage(image)</code></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>设置<code>image</code>作为托盘中显示的图标</p>\n<h4 id=\"traysetpressedimageimage-macos\"><a href=\"#traysetpressedimageimage-macos\"><code>tray.setPressedImage(image)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>在 macOS 中，设置<code>image</code>作为托盘图标被按下时显示的图标</p>\n<h4 id=\"traysettooltiptooltip\"><a href=\"#traysettooltiptooltip\"><code>tray.setToolTip(toolTip)</code></a></h4>\n<ul>\n<li><code>toolTip</code> String</li>\n</ul>\n<p>设置鼠标指针在托盘图标上悬停时显示的文本</p>\n<h4 id=\"traysettitletitle-options-macos\"><a href=\"#traysettitletitle-options-macos\"><code>tray.setTitle(title[, options])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>title</code> String</li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>fontType</code> String (optional) - The font family variant to display, can be <code>monospaced</code> or <code>monospacedDigit</code>. <code>monospaced</code> is available in macOS 10.15+ and <code>monospacedDigit</code> is available in macOS 10.11+.  When left blank, the title uses the default system font.</li>\n</ul></li>\n</ul>\n<p>Sets the title displayed next to the tray icon in the status bar (Support ANSI colors).</p>\n<h4 id=\"traygettitle-macos\"><a href=\"#traygettitle-macos\"><code>tray.getTitle()</code> <em>macOS</em></a></h4>\n<p>Returns <code>String</code> - the title displayed next to the tray icon in the status bar</p>\n<h4 id=\"traysetignoredoubleclickeventsignore-macos\"><a href=\"#traysetignoredoubleclickeventsignore-macos\"><code>tray.setIgnoreDoubleClickEvents(ignore)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n</ul>\n<p>Sets the option to ignore double click events. Ignoring these events allows you to detect every individual click of the tray icon.</p>\n<p>This value is set to false by default.</p>\n<h4 id=\"traygetignoredoubleclickevents-macos\"><a href=\"#traygetignoredoubleclickevents-macos\"><code>tray.getIgnoreDoubleClickEvents()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether double click events will be ignored.</p>\n<h4 id=\"traydisplayballoonoptions-windows\"><a href=\"#traydisplayballoonoptions-windows\"><code>tray.displayBalloon(options)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (optional) - Icon to use when <code>iconType</code> is <code>custom</code>.</li>\n<li><code>iconType</code> String (optional) - Can be <code>none</code>, <code>info</code>, <code>warning</code>, <code>error</code> or <code>custom</code>. 默认值为 <code>custom</code>.</li>\n<li><code>title</code> String</li>\n<li><code>content</code> String</li>\n<li><code>largeIcon</code> Boolean (optional) - The large version of the icon should be used. 默认值为 <code>true</code>。 Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_large_icon-0x00000020\"><code>NIIF_LARGE_ICON</code></a>.</li>\n<li><code>noSound</code> Boolean (optional) - Do not play the associated sound. 默认值为 <code>false</code>. Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_nosound-0x00000010\"><code>NIIF_NOSOUND</code></a>.</li>\n<li><code>respectQuietTime</code> Boolean (optional) - Do not display the balloon notification if the current user is in \"quiet time\". 默认值为 <code>false</code>. Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_respect_quiet_time-0x00000080\"><code>NIIF_RESPECT_QUIET_TIME</code></a>.</li>\n</ul></li>\n</ul>\n<p>显示一个托盘气球通知.</p>\n<h4 id=\"trayremoveballoon-windows\"><a href=\"#trayremoveballoon-windows\"><code>tray.removeBalloon()</code> <em>Windows</em></a></h4>\n<p>Removes a tray balloon.</p>\n<h4 id=\"trayfocus-windows\"><a href=\"#trayfocus-windows\"><code>tray.focus()</code> <em>Windows</em></a></h4>\n<p>Returns focus to the taskbar notification area. Notification area icons should use this message when they have completed their UI operation. For example, if the icon displays a shortcut menu, but the user presses ESC to cancel it, use <code>tray.focus()</code> to return focus to the notification area.</p>\n<h4 id=\"traypopupcontextmenumenu-position-macos-windows\"><a href=\"#traypopupcontextmenumenu-position-macos-windows\"><code>tray.popUpContextMenu([menu, position])</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>menu</code> Menu (可选)</li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> (可选) - 菜单弹出的位置.</li>\n</ul>\n<p>Pops up the context menu of the tray icon. When <code>menu</code> is passed, the <code>menu</code> will be shown instead of the tray icon's context menu.</p>\n<p>参数 <code>position</code> 只在 Windows 上可用， 并拥有默认值 (0, 0)。</p>\n<h4 id=\"trayclosecontextmenu-macos-windows\"><a href=\"#trayclosecontextmenu-macos-windows\"><code>tray.closeContextMenu()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Closes an open context menu, as set by <code>tray.setContextMenu()</code>.</p>\n<h4 id=\"traysetcontextmenumenu\"><a href=\"#traysetcontextmenumenu\"><code>tray.setContextMenu(menu)</code></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>设置这个图标的内容菜单</p>\n<h4 id=\"traygetbounds-macos-windows\"><a href=\"#traygetbounds-macos-windows\"><code>tray.getBounds()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>返回 <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>以<code>Object</code>类型返回托盘图标的<code>bounds</code></p>\n<h4 id=\"trayisdestroyed\"><a href=\"#trayisdestroyed\"><code>tray.isDestroyed()</code></a></h4>\n<p>返回 <code>Boolean</code> -判断托盘图标是否被销毁</p>",
      "title": "Tray",
      "description": "添加图标和上下文菜单到系统通知区"
    },
    "/docs/tutorial/tray": {
      "locale": "zh-CN",
      "slug": "tray",
      "href": "/docs/tutorial/tray",
      "crowdinFileId": "256259",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/tray.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<hr>\n<p>title: Tray\ndescription: This guide will take you through the process of creating a Tray icon with its own context menu to the system's notification area.\nslug: tray</p>\n<h2 id=\"hide_title-true\"><a href=\"#hide_title-true\">hide_title: true</a></h2>\n<h1 id=\"tray\"><a href=\"#tray\">Tray</a></h1>\n<h2 id=\"概览\"><a href=\"#概览\">概览</a></h2>\n<!-- ✍ Update this section if you want to provide more details -->\n<p>This guide will take you through the process of creating a <a href=\"https://www.electronjs.org/docs/api/tray\">Tray</a> icon with its own context menu to the system's notification area.</p>\n<p>On MacOS and Ubuntu, the Tray will be located on the top right corner of your screen, adjacent to your battery and wifi icons. On Windows, the Tray will usually be located in the bottom right corner.</p>\n<h2 id=\"示例\"><a href=\"#示例\">示例</a></h2>\n<h3 id=\"mainjs\"><a href=\"#mainjs\">main.js</a></h3>\n<p>First we must import <code>app</code>, <code>Tray</code>, <code>Menu</code>, <code>nativeImage</code> from <code>electron</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, Tray, Menu, nativeImage } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>Next we will create our Tray. To do this, we will use a <a href=\"https://www.electronjs.org/docs/api/native-image\"><code>NativeImage</code></a> icon, which can be created through any one of these <a href=\"https://www.electronjs.org/docs/api/native-image#methods\">methods</a>. Note that we wrap our Tray creation code within an <a href=\"https://www.electronjs.org/docs/api/app#appwhenready\"><code>app.whenReady</code></a> as we will need to wait for our electron app to finish initializing.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">let</span> tray\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> icon = nativeImage.createFromPath(<span class=\"hljs-string\">'path/to/asset.png'</span>)\n  tray = <span class=\"hljs-keyword\">new</span> Tray(icon)\n\n  <span class=\"hljs-comment\">// note: your contextMenu, Tooltip and Title code will go here!</span>\n})\n</code></pre>\n<p>太好了！ Now we can start attaching a context menu to our Tray, like so:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item3'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item4'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n])\n\ntray.setContextMenu(contextMenu)\n</code></pre>\n<p>The code above will create 4 separate radio-type items in the context menu. To read more about constructing native menus, click <a href=\"https://www.electronjs.org/docs/api/menu#menubuildfromtemplatetemplate\">here</a>.</p>\n<p>Finally, let's give our tray a tooltip and a title.</p>\n<pre><code class=\"hljs language-js\">tray.setToolTip(<span class=\"hljs-string\">'This is my application'</span>)\ntray.setTitle(<span class=\"hljs-string\">'This is my title'</span>)\n</code></pre>\n<h2 id=\"结论\"><a href=\"#结论\">结论</a></h2>\n<p>After you start your electron app, you should see the Tray residing in either the top or bottom right of your screen, depending on your operating system.\n<code>fiddle docs/fiddles/native-ui/tray</code></p>",
      "title": "Tray",
      "description": ""
    },
    "/docs/tutorial/updates": {
      "locale": "zh-CN",
      "slug": "updates",
      "href": "/docs/tutorial/updates",
      "crowdinFileId": "256261",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/updates.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"更新应用程序\"><a href=\"#更新应用程序\">更新应用程序</a></h1>\n<p>有多种方法可以更新Electron应用. 最简单并且获得官方支持的方法是利用内置的<a href=\"https://github.com/Squirrel\">Squirrel</a>框架和Electron的<a href=\"/docs/api/auto-updater\">autoUpdater</a>模块。</p>\n<h2 id=\"使用-updateelectronjsorg\"><a href=\"#使用-updateelectronjsorg\">使用 <code>update.electronjs.org</code></a></h2>\n<p>Electron 团队维护 <a href=\"https://github.com/electron/update.electronjs.org\">update.electronjs.org</a>，一个免费开源的网络服务，可以让 Electron 应用使用自动更新。 这个服务是设计给那些满足以下标准的 Electron 应用：</p>\n<ul>\n<li>应用运行在 macOS 或者 Windows</li>\n<li>应用有公开的 GitHub 仓库</li>\n<li>编译的版本发布在 GitHub Releases</li>\n<li>编译的版本已代码签名</li>\n</ul>\n<p>使用这个服务最简单的方法是安装 <a href=\"https://github.com/electron/update-electron-app\">update-electron-app</a>，一个预配置好的 Node.js 模块来使用 update.electronjs.org。</p>\n<p>安装模块</p>\n<pre><code class=\"hljs language-sh\">npm install update-electron-app\n</code></pre>\n<p>从你的应用的 main process 文件调用这个更新：</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'update-electron-app'</span>)()\n</code></pre>\n<p>默认情况下，这个模块会在应用启动的时候检查更新，然后每隔十分钟再检查一次。 当发现了一个更新，它会自动在后台下载。 当下载完成后，会显示一个对话框以允许用户重启应用。</p>\n<p>如果你需要定制化你的配置，你可以 <a href=\"https://github.com/electron/update-electron-app\">将配置设置传递给 <code>update-electron-app</code></a> 或者 <a href=\"https://github.com/electron/update.electronjs.org\">直接使用更新服务</a>。</p>\n<h2 id=\"部署更新服务器\"><a href=\"#部署更新服务器\">部署更新服务器</a></h2>\n<p>如果你开发的是一个私有的 Electron 应用程序，或者你没有在 GitHub Releases 中公开发布，你可能需要运行自己的更新服务器。</p>\n<p>根据你的需要，你可以从下方选择：</p>\n<ul>\n<li><a href=\"https://github.com/vercel/hazel\">Hazel</a> – Update server for private or open-source apps which can be deployed for free on <a href=\"https://vercel.com\">Vercel</a>. 它从<a href=\"https://help.github.com/articles/creating-releases/\">GitHub Releases</a>中拉取更新文件，并且利用 GitHub CDN 的强大性能。</li>\n<li><a href=\"https://github.com/GitbookIO/nuts\">Nuts</a>－同样使用<a href=\"https://help.github.com/articles/creating-releases/\">GitHub Releases</a>, 但得在磁盘上缓存应用程序更新并支持私有存储库.</li>\n<li><a href=\"https://github.com/ArekSredzki/electron-release-server\">electron-release-server</a> – 提供一个用于处理发布的仪表板，并且不需要在GitHub上发布发布。</li>\n<li><a href=\"https://github.com/atlassian/nucleus\">Nucleus</a> – 一个由Atlassian维护的 Electron 应用程序的完整更新服务器。 支持多种应用程序和渠道; 使用静态文件存储来降低服务器成本.</li>\n</ul>\n<h2 id=\"在你的应用中实施更新\"><a href=\"#在你的应用中实施更新\">在你的应用中实施更新</a></h2>\n<p>一旦你部署了更新服务器, 继续导入你所需要的代码模块. 下列代码可能因不同的服务器软件而变化，但它的工作原理就像使用<a href=\"https://github.com/vercel/hazel\">Hazel</a>所描述的那样。</p>\n<p><strong>重要:</strong> 请确保下面的代码只在打包的应用程序, 而不是开发中. 你可以使用<a href=\"https://github.com/sindresorhus/electron-is-dev\">electron-is-dev</a>检查当前环境.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, autoUpdater, dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>下一步, 构建更新服务器的URL并且通知<a href=\"/docs/api/auto-updater\">autoUpdater</a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> server = <span class=\"hljs-string\">'https://your-deployment-url.com'</span>\n<span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-string\">`<span class=\"hljs-subst\">${server}</span>/update/<span class=\"hljs-subst\">${process.platform}</span>/<span class=\"hljs-subst\">${app.getVersion()}</span>`</span>\n\nautoUpdater.setFeedURL({ url })\n</code></pre>\n<p>As the final step, check for updates. The example below will check every minute:</p>\n<pre><code class=\"hljs language-javascript\">setInterval(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  autoUpdater.checkForUpdates()\n}, <span class=\"hljs-number\">60000</span>)\n</code></pre>\n<p>应用程序被<a href=\"/docs/tutorial/application-distribution\">packaged</a>后, 它将接收你每次发布在<a href=\"https://help.github.com/articles/creating-releases/\">GitHub Release</a>上的的更新。</p>\n<h2 id=\"应用更新\"><a href=\"#应用更新\">应用更新</a></h2>\n<p>现在您已经为应用程序配置了基本的更新机制, 您需要确保在更新时通知用户. 这可以使用autoUpdater API <a href=\"/docs/api/auto-updater#events\">events</a>来实现:</p>\n<pre><code class=\"hljs language-javascript\">autoUpdater.on(<span class=\"hljs-string\">'update-downloaded'</span>, (event, releaseNotes, releaseName) => {\n  <span class=\"hljs-keyword\">const</span> dialogOpts = {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'info'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Restart'</span>, <span class=\"hljs-string\">'Later'</span>],\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Application Update'</span>,\n    <span class=\"hljs-attr\">message</span>: process.platform === <span class=\"hljs-string\">'win32'</span> ? releaseNotes : releaseName,\n    <span class=\"hljs-attr\">detail</span>: <span class=\"hljs-string\">'A new version has been downloaded. Restart the application to apply the updates.'</span>\n  }\n\n  dialog.showMessageBox(dialogOpts).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">returnValue</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (returnValue.response === <span class=\"hljs-number\">0</span>) autoUpdater.quitAndInstall()\n  })\n})\n</code></pre>\n<p>Also make sure that errors are <a href=\"/docs/api/auto-updater#event-error\">being handled</a>. 下面是将错误日志输出到<code>标准输出</code>的例子。</p>\n<pre><code class=\"hljs language-javascript\">autoUpdater.on(<span class=\"hljs-string\">'error'</span>, message => {\n  <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'There was a problem updating the application'</span>)\n  <span class=\"hljs-built_in\">console</span>.error(message)\n})\n</code></pre>\n<h2 id=\"handling-updates-manually\"><a href=\"#handling-updates-manually\">Handling Updates Manually</a></h2>\n<p>Because the requests made by Auto Update aren't under your direct control, you may find situations that are difficult to handle (such as if the update server is behind authentication). The <code>url</code> field does support files, which means that with some effort, you can sidestep the server-communication aspect of the process. <a href=\"https://github.com/electron/electron/issues/5020#issuecomment-477636990\">Here's an example of how this could work</a>.</p>",
      "title": "更新应用程序",
      "description": ""
    },
    "/docs/api/structures/upload-data": {
      "locale": "zh-CN",
      "slug": "upload-data",
      "href": "/docs/api/structures/upload-data",
      "crowdinFileId": "256523",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploaddata-object\"><a href=\"#uploaddata-object\">UploadData Object</a></h1>\n<ul>\n<li><code>bytes</code> Buffer - Content being sent.</li>\n<li><code>file</code> String (optional) - Path of file being uploaded.</li>\n<li><code>blobUUID</code> String (optional) - UUID of blob data. Use <a href=\"/docs/api/session#sesgetblobdataidentifier\">ses.getBlobData</a> method to retrieve the data.</li>\n</ul>",
      "title": "UploadData Object",
      "description": ""
    },
    "/docs/api/structures/upload-file": {
      "locale": "zh-CN",
      "slug": "upload-file",
      "href": "/docs/api/structures/upload-file",
      "crowdinFileId": "256525",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-file.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploadfile-object\"><a href=\"#uploadfile-object\">UploadFile Object</a></h1>\n<ul>\n<li><code>type</code> 'file' - <code>file</code>.</li>\n<li><code>filePath</code> String - Path of file to be uploaded.</li>\n<li><code>offset</code> Integer - Defaults to <code>0</code>.</li>\n<li><code>length</code> Integer - Number of bytes to read from <code>offset</code>. Defaults to <code>0</code>.</li>\n<li><code>modificationTime</code> Double - Last Modification time in number of seconds since the UNIX epoch.</li>\n</ul>",
      "title": "UploadFile Object",
      "description": ""
    },
    "/docs/api/structures/upload-raw-data": {
      "locale": "zh-CN",
      "slug": "upload-raw-data",
      "href": "/docs/api/structures/upload-raw-data",
      "crowdinFileId": "256527",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-raw-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploadrawdata-object\"><a href=\"#uploadrawdata-object\">UploadRawData Object</a></h1>\n<ul>\n<li><code>type</code> 'rawData' - <code>rawData</code>.</li>\n<li><code>bytes</code> Buffer - Data to be uploaded.</li>\n</ul>",
      "title": "UploadRawData Object",
      "description": ""
    },
    "/docs/api/structures/user-default-types": {
      "locale": "zh-CN",
      "slug": "user-default-types",
      "href": "/docs/api/structures/user-default-types",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/user-default-types.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"userdefaulttypes-object\"><a href=\"#userdefaulttypes-object\">UserDefaultTypes Object</a></h1>\n<ul>\n<li><code>string</code> String</li>\n<li><code>boolean</code> Boolean</li>\n<li><code>integer</code> Number</li>\n<li><code>float</code> Number</li>\n<li><code>double</code> Number</li>\n<li><code>url</code> String</li>\n<li><code>array</code> Array\\<unknown></unknown></li>\n<li><code>dictionary</code> Record\\&#x3C;string, unknown></li>\n</ul>\n<p>This type is a helper alias, no object will never exist of this type.</p>",
      "title": "UserDefaultTypes Object",
      "description": ""
    },
    "/docs/tutorial/using-native-node-modules": {
      "locale": "zh-CN",
      "slug": "using-native-node-modules",
      "href": "/docs/tutorial/using-native-node-modules",
      "crowdinFileId": "256263",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-native-node-modules.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"native-node-modules\"><a href=\"#native-node-modules\">Native Node Modules</a></h1>\n<p>原生Node.js模块由Electron支持，但由于Electron具有与给定Node.js不同的 <a href=\"https://en.wikipedia.org/wiki/Application_binary_interface\">应用二进制接口 (ABI)</a>(由于使用Chromium的 BoringSL 而不是 OpenSSL 等 差异)，您使用的原生 模块需要为Electron重新编译。 否则，当您尝试运行您的应用程序时， 将会遇到以下的错误：</p>\n<pre><code class=\"hljs language-sh\">Error: The module <span class=\"hljs-string\">'/path/to/native/module.node'</span>\nwas compiled against a different Node.js version using\nNODE_MODULE_VERSION <span class=\"hljs-variable\">$XYZ</span>. This version of Node.js requires\nNODE_MODULE_VERSION <span class=\"hljs-variable\">$ABC</span>. Please try re-compiling or re-installing\nthe module (<span class=\"hljs-keyword\">for</span> instance, using `npm rebuild` or `npm install`).\n</code></pre>\n<h2 id=\"如何安装原生模块\"><a href=\"#如何安装原生模块\">如何安装原生模块</a></h2>\n<p>有多种不同的方法来安装原生模块：</p>\n<h3 id=\"为-electron-安装并重新编译模块\"><a href=\"#为-electron-安装并重新编译模块\">为 Electron 安装并重新编译模块</a></h3>\n<p>您可以像其他 Node 项目一样安装模块，然后用 <a href=\"https://github.com/electron/electron-rebuild\"><code>electron-rebuild</code></a> 包重建这些模块以适配 Electron 。 这个包可以自动识别当前 Electron 版本，为你的应用自动完成下载 headers、重新编译原生模块等步骤。 如果您正在使用 <a href=\"https://electronforge.io/\">Electron Forge</a>，这个工具将在开发模式和发布时自动使用。</p>\n<p>For example, to install the standalone <code>electron-rebuild</code> tool and then rebuild modules with it via the command line:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron-rebuild\n\n<span class=\"hljs-comment\"># Every time you run \"npm install\", run this:</span>\n./node_modules/.bin/electron-rebuild\n\n<span class=\"hljs-comment\"># If you have trouble on Windows, try:</span>\n.\\node_modules\\.bin\\electron-rebuild.cmd\n</code></pre>\n<p>For more information on usage and integration with other tools such as <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a>, consult the project's README.</p>\n<h3 id=\"通过-npm-安装\"><a href=\"#通过-npm-安装\">通过 <code>npm</code> 安装</a></h3>\n<p>只要设置一些系统环境变量，你就可以通过 <code>npm</code> 直接安装原生模块。</p>\n<p>例如，要安装所有Electron的依赖：</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-comment\"># Electron 的版本。</span>\n<span class=\"hljs-built_in\">export</span> npm_config_target=1.2.3\n<span class=\"hljs-comment\"># Electron的目标架构, 可用的架构列表请参见</span>\n<span class=\"hljs-comment\"># https://electronjs.org/docs/tutorial/support#supported-platforms</span>\n<span class=\"hljs-built_in\">export</span> npm_config_arch=x64\n<span class=\"hljs-built_in\">export</span> npm_config_target_arch=x64\n<span class=\"hljs-comment\"># 下载 Electron 的 headers。</span>\n<span class=\"hljs-built_in\">export</span> npm_config_disturl=https://electronjs.org/headers\n<span class=\"hljs-comment\"># 告诉 node-pre-gyp 我们是在为 Electron 生成模块。</span>\n<span class=\"hljs-built_in\">export</span> npm_config_runtime=electron\n<span class=\"hljs-comment\"># 告诉 node-pre-gyp 从源代码构建模块。</span>\n<span class=\"hljs-built_in\">export</span> npm_config_build_from_source=<span class=\"hljs-literal\">true</span>\n<span class=\"hljs-comment\"># 安装所有依赖，并缓存到 ~/.electron-gyp。</span>\nHOME=~/.electron-gyp npm install\n</code></pre>\n<h3 id=\"为-electron-手动编译\"><a href=\"#为-electron-手动编译\">为 Electron 手动编译</a></h3>\n<p>如果你是一个原生模块的开发人员，想在 Electron 中进行测试， 你可能要手动编译 Electron 模块。 你可以 使用 <code>node-gyp</code> 直接编译：</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">cd</span> /path-to-module/\nHOME=~/.electron-gyp node-gyp rebuild --target=1.2.3 --arch=x64 --dist-url=https://electronjs.org/headers\n</code></pre>\n<ul>\n<li><code>HOME=~/.electron-gyp</code> 设置去哪找头文件</li>\n<li><code>--target=1.2.3</code> 设置了 Electron 的版本。</li>\n<li><code>--dist-url=...</code>设置了 Electron 的 headers 的下载地址。</li>\n<li><code>--arch=x64</code> 设置了该模块为适配64位操作系统而编译。</li>\n</ul>\n<h3 id=\"为electron的自定义编译手动编译\"><a href=\"#为electron的自定义编译手动编译\">为Electron的自定义编译手动编译</a></h3>\n<p>如果是为一个与公共发行版不匹配的Electron自定义版本编译原生Node模块，需要让<code>npm</code>使用你的Electron自定义版本所对应的Node版本。</p>\n<pre><code class=\"hljs language-sh\">npm rebuild --nodedir=/path/to/src/out/Default/gen/node_headers\n</code></pre>\n<h2 id=\"故障排查\"><a href=\"#故障排查\">故障排查</a></h2>\n<p>如果您安装了本机模块并发现它无法正常工作，则需要检查以下内容：</p>\n<ul>\n<li>当有疑问时，请先执行 <code>electron-rebuild</code>。</li>\n<li>确保原生模块与Electron应用程序的目标平台和体系结构兼容。</li>\n<li>确保在该模块的<code>binding.gyp</code>中<code>win_delay_load_hook</code>没有被设置为<code>false</code>。</li>\n<li>如果升级了 Electron，你通常需要重新编译这些模块。</li>\n</ul>\n<h3 id=\"关于win_delay_load_hook的说明\"><a href=\"#关于win_delay_load_hook的说明\">关于<code>win_delay_load_hook</code>的说明</a></h3>\n<p>在Windows上，默认情况下，<code>node-gyp</code>将原生模块与<code>node.dll</code>链接。 然而，在Electron 4.x和更高的版本中，原生模块需要的symbols由<code>electron.exe</code>导出，并且没有<code>node.dll</code>。 In order to load native modules on Windows, <code>node-gyp</code> installs a <a href=\"https://msdn.microsoft.com/en-us/library/z9h1h6ty.aspx\">delay-load hook</a> that triggers when the native module is loaded, and redirects the <code>node.dll</code> reference to use the loading executable instead of looking for <code>node.dll</code> in the library search path (which would turn up nothing). As such, on Electron 4.x and higher, <code>'win_delay_load_hook': 'true'</code> is required to load native modules.</p>\n<p>If you get an error like <code>Module did not self-register</code>, or <code>The specified procedure could not be found</code>, it may mean that the module you're trying to use did not correctly include the delay-load hook.  If the module is built with node-gyp, ensure that the <code>win_delay_load_hook</code> variable is set to <code>true</code> in the <code>binding.gyp</code> file, and isn't getting overridden anywhere.  If the module is built with another system, you'll need to ensure that you build with a delay-load hook installed in the main <code>.node</code> file. Your <code>link.exe</code> invocation should look like this:</p>\n<pre><code class=\"hljs language-plaintext\"> link.exe /OUT:\"foo.node\" \"...\\node.lib\" delayimp.lib /DELAYLOAD:node.exe /DLL\n     \"my_addon.obj\" \"win_delay_load_hook.obj\"\n</code></pre>\n<p>In particular, it's important that:</p>\n<ul>\n<li>you link against <code>node.lib</code> from <em>Electron</em> and not Node. If you link against the wrong <code>node.lib</code> you will get load-time errors when you require the module in Electron.</li>\n<li>you include the flag <code>/DELAYLOAD:node.exe</code>. If the <code>node.exe</code> link is not delayed, then the delay-load hook won't get a chance to fire and the node symbols won't be correctly resolved.</li>\n<li><code>win_delay_load_hook.obj</code> is linked directly into the final DLL. If the hook is set up in a dependent DLL, it won't fire at the right time.</li>\n</ul>\n<p>See <a href=\"https://github.com/nodejs/node-gyp/blob/e2401e1395bef1d3c8acec268b42dc5fb71c4a38/src/win_delay_load_hook.cc\"><code>node-gyp</code></a> for an example delay-load hook if you're implementing your own.</p>\n<h2 id=\"依赖于-prebuild-的模块\"><a href=\"#依赖于-prebuild-的模块\">依赖于 <code>prebuild</code> 的模块</a></h2>\n<p><a href=\"https://github.com/prebuild/prebuild\"><code>prebuild</code></a> provides a way to publish native Node modules with prebuilt binaries for multiple versions of Node and Electron.</p>\n<p>If the <code>prebuild</code>-powered module provide binaries for the usage in Electron, make sure to omit <code>--build-from-source</code> and the <code>npm_config_build_from_source</code> environment variable in order to take full advantage of the prebuilt binaries.</p>\n<h2 id=\"依赖于-node-pre-gyp-的模块\"><a href=\"#依赖于-node-pre-gyp-的模块\">依赖于 <code>node-pre-gyp</code> 的模块</a></h2>\n<p><a href=\"https://github.com/mapbox/node-pre-gyp\"><code>node-pre-gyp</code> 工具</a> 提供一种部署原生 Node 预编译二进制模块的方法， 许多流行的模块都是使用它。</p>\n<p>Sometimes those modules work fine under Electron, but when there are no Electron-specific binaries available, you'll need to build from source. Because of this, it is recommended to use <code>electron-rebuild</code> for these modules.</p>\n<p>If you are following the <code>npm</code> way of installing modules, you'll need to pass <code>--build-from-source</code> to <code>npm</code>, or set the <code>npm_config_build_from_source</code> environment variable.</p>",
      "title": "Native Node Modules",
      "description": ""
    },
    "/docs/tutorial/using-pepper-flash-plugin": {
      "locale": "zh-CN",
      "slug": "using-pepper-flash-plugin",
      "href": "/docs/tutorial/using-pepper-flash-plugin",
      "crowdinFileId": "256265",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-pepper-flash-plugin.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"pepper-flash-plugin\"><a href=\"#pepper-flash-plugin\">Pepper Flash Plugin</a></h1>\n<p>Electron 不再支持 Pepper Flash 插件，因为 Chrome 已经移除了支持。</p>\n<p>更多详细信息，请参阅 <a href=\"https://www.chromium.org/flash-roadmap\">Chromium's Flash Roadmap</a></p>",
      "title": "Pepper Flash Plugin",
      "description": ""
    },
    "/docs/tutorial/using-selenium-and-webdriver": {
      "locale": "zh-CN",
      "slug": "using-selenium-and-webdriver",
      "href": "/docs/tutorial/using-selenium-and-webdriver",
      "crowdinFileId": "256267",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-selenium-and-webdriver.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"selenium-and-webdriver\"><a href=\"#selenium-and-webdriver\">Selenium and WebDriver</a></h1>\n<p>引自 <a href=\"https://sites.google.com/a/chromium.org/chromedriver/\">ChromeDriver - WebDriver for Chrome</a>:</p>\n<blockquote>\n<p>WebDriver 是一款开源的支持多浏览器的自动化测试工具。 它提供了操作网页、用户输入、JavaScript 执行等能力。 ChromeDriver 是一个实现了 WebDriver 与 Chromium 联接协议的独立服务。 它也是由开发了 Chromium 和 WebDriver 的团队开发的。</p>\n</blockquote>\n<h2 id=\"配置-spectron\"><a href=\"#配置-spectron\">配置 Spectron</a></h2>\n<p><a href=\"https://electronjs.org/spectron\">Spectron</a> 是 Electron 官方支持的 ChromeDriver 测试框架。 它是建立在 <a href=\"https://webdriver.io/\">WebdriverIO</a> 的顶层，并且 帮助你在测试中访问 Electron API 和绑定 ChromeDriver。</p>\n<pre><code class=\"hljs language-sh\">$ npm install --save-dev spectron\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// 一个简单的验证测试和一个带标题的可视窗口</span>\n<span class=\"hljs-keyword\">const</span> Application = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spectron'</span>).Application\n<span class=\"hljs-keyword\">const</span> assert = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'assert'</span>)\n\n<span class=\"hljs-keyword\">const</span> myApp = <span class=\"hljs-keyword\">new</span> Application({\n  <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'/Applications/MyApp.app/Contents/MacOS/MyApp'</span>\n})\n\n<span class=\"hljs-keyword\">const</span> verifyWindowIsVisibleWithTitle = <span class=\"hljs-keyword\">async</span> (app) => {\n  <span class=\"hljs-keyword\">await</span> app.start()\n  <span class=\"hljs-keyword\">try</span> {\n    <span class=\"hljs-comment\">// 检查窗口是否可见</span>\n    <span class=\"hljs-keyword\">const</span> isVisible = <span class=\"hljs-keyword\">await</span> app.browserWindow.isVisible()\n    <span class=\"hljs-comment\">// 验证窗口是否可见</span>\n    assert.strictEqual(isVisible, <span class=\"hljs-literal\">true</span>)\n    <span class=\"hljs-comment\">// 获取窗口标题</span>\n    <span class=\"hljs-keyword\">const</span> title = <span class=\"hljs-keyword\">await</span> app.client.getTitle()\n    <span class=\"hljs-comment\">// 验证窗口标题</span>\n    assert.strictEqual(title, <span class=\"hljs-string\">'My App'</span>)\n  } <span class=\"hljs-keyword\">catch</span> (error) {\n    <span class=\"hljs-comment\">// 记录任何故障</span>\n    <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Test failed'</span>, error.message)\n  }\n  <span class=\"hljs-comment\">// 停止应用</span>\n  <span class=\"hljs-keyword\">await</span> app.stop()\n}\n\nverifyWindowIsVisibleWithTitle(myApp)\n</code></pre>\n<h2 id=\"通过-webdriverjs-配置\"><a href=\"#通过-webdriverjs-配置\">通过 WebDriverJs 配置</a></h2>\n<p><a href=\"https://www.selenium.dev/selenium/docs/api/javascript/index.html\">WebDriverJs</a> 是一个可以配合 WebDriver 做测试的 node 模块，我们会用它来做个演示。</p>\n<h3 id=\"1-start-chromedriver\"><a href=\"#1-start-chromedriver\">1. Start ChromeDriver</a></h3>\n<p>首先，你要下载 <code>chromedriver</code>，然后运行以下命令：</p>\n<pre><code class=\"hljs language-sh\">$ npm install electron-chromedriver\n$ ./node_modules/.bin/chromedriver\nStarting ChromeDriver (v2.10.291558) on port 9515\nOnly <span class=\"hljs-built_in\">local</span> connections are allowed.\n</code></pre>\n<p>记住 <code>9515</code> 这个端口号，我们后面会用到</p>\n<h3 id=\"2-安装-webdriverjs\"><a href=\"#2-安装-webdriverjs\">2. 安装 WebDriverJS</a></h3>\n<pre><code class=\"hljs language-sh\">$ npm install selenium-webdriver\n</code></pre>\n<h3 id=\"3-connect-to-chromedriver\"><a href=\"#3-connect-to-chromedriver\">3. Connect to ChromeDriver</a></h3>\n<p>在 Electron 下使用 <code>selenium-webdriver</code> 和其平时的用法并没有大的差异，只是你需要手动设置连接 ChromeDriver，以及 Electron 的路径：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webdriver = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'selenium-webdriver'</span>)\n\n<span class=\"hljs-keyword\">const</span> driver = <span class=\"hljs-keyword\">new</span> webdriver.Builder()\n  <span class=\"hljs-comment\">// \"9515\" 是ChromeDriver使用的端口</span>\n  .usingServer(<span class=\"hljs-string\">'http://localhost:9515'</span>)\n  .withCapabilities({\n    <span class=\"hljs-string\">'goog:chromeOptions'</span>: {\n      <span class=\"hljs-comment\">// 这里填您的Electron二进制文件路径。</span>\n      <span class=\"hljs-attr\">binary</span>: <span class=\"hljs-string\">'/Path-to-Your-App.app/Contents/MacOS/Electron'</span>\n    }\n  })\n  .forBrowser(<span class=\"hljs-string\">'chrome'</span>) <span class=\"hljs-comment\">// 注意: 使用 .forBrowser('electron') for selenium-webdriver &#x3C;= 3.6.0</span>\n  .build()\n\ndriver.get(<span class=\"hljs-string\">'http://www.google.com'</span>)\ndriver.findElement(webdriver.By.name(<span class=\"hljs-string\">'q'</span>)).sendKeys(<span class=\"hljs-string\">'webdriver'</span>)\ndriver.findElement(webdriver.By.name(<span class=\"hljs-string\">'btnG'</span>)).click()\ndriver.wait(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">return</span> driver.getTitle().then(<span class=\"hljs-function\">(<span class=\"hljs-params\">title</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> title === <span class=\"hljs-string\">'webdriver - Google Search'</span>\n  })\n}, <span class=\"hljs-number\">1000</span>)\n\ndriver.quit()\n</code></pre>\n<h2 id=\"通过-webdriverio-配置\"><a href=\"#通过-webdriverio-配置\">通过 WebdriverIO 配置</a></h2>\n<p><a href=\"https://webdriver.io/\">WebdriverIO</a> 也是一个配合 WebDriver 用来测试的 node 模块.</p>\n<h3 id=\"1-start-chromedriver-1\"><a href=\"#1-start-chromedriver-1\">1. Start ChromeDriver</a></h3>\n<p>首先，你要下载 <code>chromedriver</code>，然后运行以下命令：</p>\n<pre><code class=\"hljs language-sh\">$ npm install electron-chromedriver\n$ ./node_modules/.bin/chromedriver --url-base=wd/hub --port=9515\nStarting ChromeDriver (v2.10.291558) on port 9515\nOnly <span class=\"hljs-built_in\">local</span> connections are allowed.\n</code></pre>\n<p>记住 <code>9515</code> 这个端口号，我们后面会用到</p>\n<h3 id=\"2-install-webdriverio\"><a href=\"#2-install-webdriverio\">2. Install WebdriverIO</a></h3>\n<pre><code class=\"hljs language-sh\">$ npm install webdriverio\n</code></pre>\n<h3 id=\"3-连接到-chrome-驱动\"><a href=\"#3-连接到-chrome-驱动\">3. 连接到 chrome 驱动</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webdriverio = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'webdriverio'</span>)\n<span class=\"hljs-keyword\">const</span> options = {\n  <span class=\"hljs-attr\">host</span>: <span class=\"hljs-string\">'localhost'</span>, <span class=\"hljs-comment\">// Use localhost as chrome driver server</span>\n  <span class=\"hljs-attr\">port</span>: <span class=\"hljs-number\">9515</span>, <span class=\"hljs-comment\">// \"9515\" is the port opened by chrome driver.</span>\n  <span class=\"hljs-attr\">desiredCapabilities</span>: {\n    <span class=\"hljs-attr\">browserName</span>: <span class=\"hljs-string\">'chrome'</span>,\n    <span class=\"hljs-string\">'goog:chromeOptions'</span>: {\n      <span class=\"hljs-attr\">binary</span>: <span class=\"hljs-string\">'/Path-to-Your-App/electron'</span>, <span class=\"hljs-comment\">// Path to your Electron binary.</span>\n      <span class=\"hljs-attr\">args</span>: [<span class=\"hljs-comment\">/* cli arguments */</span>] <span class=\"hljs-comment\">// Optional, perhaps 'app=' + /path/to/your/app/</span>\n    }\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> client = webdriverio.remote(options)\n\nclient\n  .init()\n  .url(<span class=\"hljs-string\">'http://google.com'</span>)\n  .setValue(<span class=\"hljs-string\">'#q'</span>, <span class=\"hljs-string\">'webdriverio'</span>)\n  .click(<span class=\"hljs-string\">'#btnG'</span>)\n  .getTitle().then(<span class=\"hljs-function\">(<span class=\"hljs-params\">title</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Title was: '</span> + title)\n  })\n  .end()\n</code></pre>\n<h2 id=\"工作流\"><a href=\"#工作流\">工作流</a></h2>\n<p>无需重新编译 Electron，只要把 app 的源码<a href=\"/docs/tutorial/application-distribution\">放到</a> Electron的资源目录 里就可直接开始测试了。</p>\n<p>Alternatively, pass an argument to run with your Electron binary that points to your app's folder. 这就消除了将您的应用复制粘贴到 Electron 资源目录的必要性。</p>",
      "title": "Selenium and WebDriver",
      "description": "WebDriver 是一款开源的支持多浏览器的自动化测试工具。 它提供了操作网页、用户输入、JavaScript 执行等能力。 ChromeDriver 是一个实现了 WebDriver 与 Chromium 联接协议的独立服务。 它也是由开发了 Chromium 和 WebDriver 的团队开发的。"
    },
    "/docs/development/v8-development": {
      "locale": "zh-CN",
      "slug": "v8-development",
      "href": "/docs/development/v8-development",
      "crowdinFileId": "256171",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/v8-development.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"v8-开发\"><a href=\"#v8-开发\">V8 开发</a></h1>\n<blockquote>\n<p>学习和使用 v8 引擎的资源集合</p>\n</blockquote>\n<ul>\n<li><a href=\"https://v8.dev/docs/trace\">V8 Tracing</a></li>\n<li><a href=\"https://v8.dev/docs/profile\">V8 Profiler</a> - 对分析有用的分析器组合: <code>--prof</code>, <code>--trace-ic</code>, <code>--trace-opt</code>, <code>--trace-deopt</code>, <code>--print-bytecode</code>, <code>--print-opt-code</code></li>\n<li><a href=\"https://docs.google.com/document/d/11T2CRex9hXxoJwbYqVQ32yIPMh0uouUZLdyrtmMoL44/edit?ts=56f27d9d#heading=h.6jz9dj3bnr8t\">V8 解释器设计</a></li>\n<li><a href=\"https://v8.dev/docs/turbofan\">编译器优化</a></li>\n<li><a href=\"https://v8.dev/docs/gdb-jit\">V8 GDB 调试</a></li>\n</ul>\n<p>查看 <a href=\"/docs/development/chromium-development\">Chromium Development</a></p>",
      "title": "V8 开发",
      "description": "学习和使用 v8 引擎的资源集合"
    },
    "/docs/api/web-contents": {
      "locale": "zh-CN",
      "slug": "web-contents",
      "href": "/docs/api/web-contents",
      "crowdinFileId": "256399",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-contents.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webcontents\"><a href=\"#webcontents\">webContents</a></h1>\n<blockquote>\n<p>渲染以及控制 web 页面</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p><code>webContents</code>是一个<a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>. 负责渲染和控制网页, 是 <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> 对象的一个属性。 这是一个访问 <code>webContents</code> 对象的例子:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> contents = win.webContents\n<span class=\"hljs-built_in\">console</span>.log(contents)\n</code></pre>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p>通过<code>webContents</code>模块可以访问以下方法：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(webContents)\n</code></pre>\n<h3 id=\"webcontentsgetallwebcontents\"><a href=\"#webcontentsgetallwebcontents\"><code>webContents.getAllWebContents()</code></a></h3>\n<p>返回 <code>WebContents[]</code> - 所有 <code>WebContents</code> 实例的数组。 包含所有Windows，webviews，opened devtools 和 devtools 扩展背景页的 web 内容</p>\n<h3 id=\"webcontentsgetfocusedwebcontents\"><a href=\"#webcontentsgetfocusedwebcontents\"><code>webContents.getFocusedWebContents()</code></a></h3>\n<p>Returns <code>WebContents</code> - 此 app 中焦点的 web 内容，否则返回 <code>null</code>。</p>\n<h3 id=\"webcontentsfromidid\"><a href=\"#webcontentsfromidid\"><code>webContents.fromId(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Returns <code>WebContents</code> | undefined - A WebContents instance with the given ID, or <code>undefined</code> if there is no WebContents associated with the given ID.</p>\n<h3 id=\"webcontentsfromdevtoolstargetidtargetid\"><a href=\"#webcontentsfromdevtoolstargetidtargetid\"><code>webContents.fromDevToolsTargetId(targetId)</code></a></h3>\n<ul>\n<li><code>targetId</code> String - The Chrome DevTools Protocol <a href=\"https://chromedevtools.github.io/devtools-protocol/tot/Target/#type-TargetID\">TargetID</a> associated with the WebContents instance.</li>\n</ul>\n<p>Returns <code>WebContents</code> | undefined - A WebContents instance with the given TargetID, or <code>undefined</code> if there is no WebContents associated with the given TargetID.</p>\n<p>When communicating with the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">Chrome DevTools Protocol</a>, it can be useful to lookup a WebContents instance based on its assigned TargetID.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">lookupTargetId</span> (<span class=\"hljs-params\">browserWindow</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> wc = browserWindow.webContents\n  <span class=\"hljs-keyword\">await</span> wc.debugger.attach(<span class=\"hljs-string\">'1.3'</span>)\n  <span class=\"hljs-keyword\">const</span> { targetInfo } = <span class=\"hljs-keyword\">await</span> wc.debugger.sendCommand(<span class=\"hljs-string\">'Target.getTargetInfo'</span>)\n  <span class=\"hljs-keyword\">const</span> { targetId } = targetInfo\n  <span class=\"hljs-keyword\">const</span> targetWebContents = <span class=\"hljs-keyword\">await</span> webContents.fromDevToolsTargetId(targetId)\n}\n</code></pre>\n<h2 id=\"类-webcontents\"><a href=\"#类-webcontents\">类: WebContents</a></h2>\n<blockquote>\n<p>渲染和控制 BrowserWindow 实例的内容。</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"实例事件\"><a href=\"#实例事件\">实例事件</a></h3>\n<h4 id=\"event-did-finish-load\"><a href=\"#event-did-finish-load\">Event: 'did-finish-load'</a></h4>\n<p>导航完成时触发，即选项卡的旋转器将停止旋转，并指派<code>onload</code>事件后。</p>\n<h4 id=\"event-did-fail-load\"><a href=\"#event-did-fail-load\">Event: 'did-fail-load'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>这个事件类似于 <code>did-finish-load</code> ，只不过是在加载失败之后触发。 完整的错误码列表以及含义，<a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">请看这</a></p>\n<h4 id=\"event-did-fail-provisional-load\"><a href=\"#event-did-fail-provisional-load\">Event: 'did-fail-provisional-load'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>这个事件类似于 <code>did-finish-load</code>，只不过是在加载失败或取消加载之后触发，例如调用 <code>window.stop()</code> 。</p>\n<h4 id=\"event-did-frame-finish-load\"><a href=\"#event-did-frame-finish-load\">Event: 'did-frame-finish-load'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>当框架完成导航（navigation）时触发</p>\n<h4 id=\"event-did-start-loading\"><a href=\"#event-did-start-loading\">Event: 'did-start-loading'</a></h4>\n<p>当tab中的旋转指针（spinner）开始旋转时，就会触发该事件。</p>\n<h4 id=\"event-did-stop-loading\"><a href=\"#event-did-stop-loading\">Event: 'did-stop-loading'</a></h4>\n<p>当tab中的旋转指针（spinner）结束旋转时，就会触发该事件。</p>\n<h4 id=\"事件-dom-ready\"><a href=\"#事件-dom-ready\">事件: 'dom-ready'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the document in the top-level frame is loaded.</p>\n<h4 id=\"事件：-page-title-updated\"><a href=\"#事件：-page-title-updated\">事件： 'page-title-updated'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>Fired when page title is set during navigation. <code>explicitSet</code> is false when title is synthesized from file url.</p>\n<h4 id=\"事件-page-favicon-updated\"><a href=\"#事件-page-favicon-updated\">事件: 'page-favicon-updated'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>favicons</code> String[] - 由连接组成的数组。</li>\n</ul>\n<p>当页面获取到favicon的连接时，触发该事件。</p>\n<h4 id=\"event-new-window-deprecated\"><a href=\"#event-new-window-deprecated\">Event: 'new-window' <em>Deprecated</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> NewWindowWebContentsEvent</li>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String</li>\n<li><code>disposition</code> String - 可以被设置为 <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> 及 <code>other</code>.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - 用于创建新的 <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</li>\n<li><code>additionalFeatures</code> String[] - 非标准功能(非标准功能是指这些功能不是由Chromium或Electron处理的功能)，这些功能默认指向<code>window.open()</code>. Deprecated, and will now always be the empty array <code>[]</code>.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer that will be passed to the new window. May or may not result in the <code>Referer</code> header being sent, depending on the referrer policy.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that will be sent to the new window, along with the appropriate headers that will be set. If no post data is to be sent, the value will be <code>null</code>. Only defined when the window is being created by a form that set <code>target=_blank</code>.</li>\n</ul>\n<p>已弃用：<a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>。</p>\n<p>Emitted when the page requests to open a new window for a <code>url</code>. It could be requested by <code>window.open</code> or an external link like <code>&#x3C;a target='_blank'></code>.</p>\n<p>默认情况下, 将为 <code>url</code> 创建新的 <code>BrowserWindow</code>。</p>\n<p>调用<code>event.preventDefault()</code>事件，可以阻止Electron自动创建新的<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>实例。 调用<code>event.preventDefault()</code> 事件后，你还可以手动创建新的<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>实例，不过接下来你必须用<code>event.newGuest</code>方法来引用<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>实例，如果你不这样做，则可能会产生异常。 例如：</p>\n<pre><code class=\"hljs language-javascript\">myBrowserWindow.webContents.on(<span class=\"hljs-string\">'new-window'</span>, (event, url, frameName, disposition, options, additionalFeatures, referrer, postBody) => {\n  event.preventDefault()\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webContents</span>: options.webContents, <span class=\"hljs-comment\">// use existing webContents if provided</span>\n    <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span>\n  })\n  win.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => win.show())\n  <span class=\"hljs-keyword\">if</span> (!options.webContents) {\n    <span class=\"hljs-keyword\">const</span> loadOptions = {\n      <span class=\"hljs-attr\">httpReferrer</span>: referrer\n    }\n    <span class=\"hljs-keyword\">if</span> (postBody != <span class=\"hljs-literal\">null</span>) {\n      <span class=\"hljs-keyword\">const</span> { data, contentType, boundary } = postBody\n      loadOptions.postData = postBody.data\n      loadOptions.extraHeaders = <span class=\"hljs-string\">`content-type: <span class=\"hljs-subst\">${contentType}</span>; boundary=<span class=\"hljs-subst\">${boundary}</span>`</span>\n    }\n\n    win.loadURL(url, loadOptions) <span class=\"hljs-comment\">// existing webContents will be navigated automatically</span>\n  }\n  event.newGuest = win\n})\n</code></pre>\n<h4 id=\"event-did-create-window\"><a href=\"#event-did-create-window\">Event: 'did-create-window'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>window</code> BrowserWindow</li>\n<li><code>details</code> Object<ul>\n<li><code>url</code> String - URL for the created window.</li>\n<li><code>frameName</code> String - Name given to the created window in the <code>window.open()</code> call.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - The options used to create the BrowserWindow. They are merged in increasing precedence: parsed options from the <code>features</code> string from <code>window.open()</code>, security-related webPreferences inherited from the parent, and options given by <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>. Unrecognized options are not filtered out.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer that will be passed to the new window. May or may not result in the <code>Referer</code> header being sent, depending on the referrer policy.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that will be sent to the new window, along with the appropriate headers that will be set. If no post data is to be sent, the value will be <code>null</code>. Only defined when the window is being created by a form that set <code>target=_blank</code>.</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> and <code>other</code>.</li>\n</ul></li>\n</ul>\n<p>Emitted <em>after</em> successful creation of a window via <code>window.open</code> in the renderer. Not emitted if the creation of the window is canceled from <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>.</p>\n<p>See <a href=\"/docs/api/window-open\"><code>window.open()</code></a> for more details and how to use this in conjunction with <code>webContents.setWindowOpenHandler</code>.</p>\n<h4 id=\"event-will-navigate\"><a href=\"#event-will-navigate\">Event: 'will-navigate'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when a user or the page wants to start navigation. It can happen when the <code>window.location</code> object is changed or a user clicks a link in the page.</p>\n<p>This event will not emit when the navigation is started programmatically with APIs like <code>webContents.loadURL</code> and <code>webContents.back</code>.</p>\n<p>It is also not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<p>调用<code>event.preventDefault()</code>将阻止导航。</p>\n<h4 id=\"event-did-start-navigation\"><a href=\"#event-did-start-navigation\">Event: 'did-start-navigation'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame (including main) starts navigating. <code>isInPlace</code> will be <code>true</code> for in-page navigations.</p>\n<h4 id=\"event-will-redirect\"><a href=\"#event-will-redirect\">Event: 'will-redirect'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted as a server side redirect occurs during navigation.  For example a 302 redirect.</p>\n<p>This event will be emitted after <code>did-start-navigation</code> and always before the <code>did-redirect-navigation</code> event for the same navigation.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent the navigation (not just the redirect).</p>\n<h4 id=\"event-did-redirect-navigation\"><a href=\"#event-did-redirect-navigation\">Event: 'did-redirect-navigation'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted after a server side redirect occurs during navigation.  For example a 302 redirect.</p>\n<p>This event cannot be prevented, if you want to prevent redirects you should checkout out the <code>will-redirect</code> event above.</p>\n<h4 id=\"event-did-navigate\"><a href=\"#event-did-navigate\">Event: 'did-navigate'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - empty for non HTTP navigations</li>\n</ul>\n<p>Emitted when a main frame navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h4 id=\"event-did-frame-navigate\"><a href=\"#event-did-frame-navigate\">Event: 'did-frame-navigate'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - empty for non HTTP navigations,</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h4 id=\"event-did-navigate-in-page\"><a href=\"#event-did-navigate-in-page\">Event: 'did-navigate-in-page'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when an in-page navigation happened in any frame.</p>\n<p>当发生页内导航时，虽然页面地址发生变化，但它并没有导航到其它页面。 例如，点击锚点链接，或者DOM的 <code>hashchange</code>事件被触发时，都会触发该事件。</p>\n<h4 id=\"event-will-prevent-unload\"><a href=\"#event-will-prevent-unload\">Event: 'will-prevent-unload'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when a <code>beforeunload</code> event handler is attempting to cancel a page unload.</p>\n<p>Calling <code>event.preventDefault()</code> will ignore the <code>beforeunload</code> event handler and allow the page to be unloaded.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.webContents.on(<span class=\"hljs-string\">'will-prevent-unload'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> choice = dialog.showMessageBoxSync(win, {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'question'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Leave'</span>, <span class=\"hljs-string\">'Stay'</span>],\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Do you want to leave this site?'</span>,\n    <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'Changes you made may not be saved.'</span>,\n    <span class=\"hljs-attr\">defaultId</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">cancelId</span>: <span class=\"hljs-number\">1</span>\n  })\n  <span class=\"hljs-keyword\">const</span> leave = (choice === <span class=\"hljs-number\">0</span>)\n  <span class=\"hljs-keyword\">if</span> (leave) {\n    event.preventDefault()\n  }\n})\n</code></pre>\n<p><strong>Note:</strong> This will be emitted for <code>BrowserViews</code> but will <em>not</em> be respected - this is because we have chosen not to tie the <code>BrowserView</code> lifecycle to its owning BrowserWindow should one exist per the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event\">specification</a>.</p>\n<h4 id=\"event-crashed-deprecated\"><a href=\"#event-crashed-deprecated\">Event: 'crashed' <em>Deprecated</em></a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>当渲染进程崩溃或被结束时触发</p>\n<p><strong>已废弃：</strong> 此事件被包含更多关于渲染过程为何消失的信息的 <code>render-process-gone</code> 事件替代了 并不总是因为崩溃而触发。  当你换用child-process-gone事件时，原事件的 <code>killed</code> 布尔值可以被 <code>reason === 'killed'</code> 取代。</p>\n<h4 id=\"事件-render-process-gone\"><a href=\"#事件-render-process-gone\">事件: 'render-process-gone'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>reason</code> String - 渲染进程消失的原因。  可选值：<ul>\n<li><code>clean-exit</code> - 以零为退出代码退出的进程</li>\n<li><code>abnormal-exit</code> - 以非零退出代码退出的进程</li>\n<li><code>killed</code> - 进程发送一个SIGTERM，否则是被外部杀死的。</li>\n<li><code>crashed</code> - 进程崩溃</li>\n<li><code>oom</code> - 进程内存不足</li>\n<li><code>launch-failed</code> - 进程从未成功启动</li>\n<li><code>integrity-failure</code> - 窗口代码完整性检查失败</li>\n</ul></li>\n<li><code>exitCode</code> Integer - 进程的退出代码，除非在 <code>reason</code> 是 <code>launch-failed</code> 的情况下， <code>exitCode</code> 将是一个平台特定的启动失败错误代码。</li>\n</ul></li>\n</ul>\n<p>渲染器进程意外消失时触发。  这种情况通常因为进程崩溃或被杀死。</p>\n<h4 id=\"事件-unresponsive\"><a href=\"#事件-unresponsive\">事件: 'unresponsive'</a></h4>\n<p>网页变得未响应时触发</p>\n<h4 id=\"事件-responsive\"><a href=\"#事件-responsive\">事件: 'responsive'</a></h4>\n<p>未响应的页面变成响应时触发</p>\n<h4 id=\"event-plugin-crashed\"><a href=\"#event-plugin-crashed\">Event: 'plugin-crashed'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>\n<p>当有插件进程崩溃时触发</p>\n<h4 id=\"event-destroyed\"><a href=\"#event-destroyed\">Event: 'destroyed'</a></h4>\n<p>当<code>webContents</code>被销毁时，触发该事件。</p>\n<h4 id=\"event-before-input-event\"><a href=\"#event-before-input-event\">Event: 'before-input-event'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>input</code> Object - Input properties.<ul>\n<li><code>type</code> String - 可以是 <code>keyUp</code> ，或者 <code>keyDown</code>.</li>\n<li><code>key</code> String - 等同于 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.key</a>.</li>\n<li><code>code</code> String - 等同于 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent. code </a>.</li>\n<li><code>isAutoRepeat</code> String - 等同于 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent. repeat </a>.</li>\n<li><code>isComposing</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.isComposing</a>.</li>\n<li><code>shift</code> String - 等同于 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.shiftKey </a>.</li>\n<li><code>control</code> String - 等同于 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent. controlKey </a>.</li>\n<li><code>alt</code> String - 等同于 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent. altKey </a>.</li>\n<li><code>meta</code> String - 等同于 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent. metaKey </a>.</li>\n<li><code>location</code> Number - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.location</a>.</li>\n<li><code>modifiers</code> String[] - See <a href=\"/docs/api/structures/input-event\">InputEvent.modifiers</a>.</li>\n</ul></li>\n</ul>\n<p>Emitted before dispatching the <code>keydown</code> and <code>keyup</code> events in the page. Calling <code>event.preventDefault</code> will prevent the page <code>keydown</code>/<code>keyup</code> events and the menu shortcuts.</p>\n<p>To only prevent the menu shortcuts, use <a href=\"#contentssetignoremenushortcutsignore\"><code>setIgnoreMenuShortcuts</code></a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\nwin.webContents.on(<span class=\"hljs-string\">'before-input-event'</span>, (event, input) => {\n  <span class=\"hljs-comment\">// For example, only enable application menu keyboard shortcuts when</span>\n  <span class=\"hljs-comment\">// Ctrl/Cmd are down.</span>\n  win.webContents.setIgnoreMenuShortcuts(!input.control &#x26;&#x26; !input.meta)\n})\n</code></pre>\n<h4 id=\"事件-enter-html-full-screen\"><a href=\"#事件-enter-html-full-screen\">事件: 'enter-html-full-screen'</a></h4>\n<p>窗口进入由HTML API 触发的全屏状态时触发</p>\n<h4 id=\"事件-leave-html-full-screen\"><a href=\"#事件-leave-html-full-screen\">事件: 'leave-html-full-screen'</a></h4>\n<p>窗口离开由HTML API触发的全屏状态时触发</p>\n<h4 id=\"event-zoom-changed\"><a href=\"#event-zoom-changed\">Event: 'zoom-changed'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>zoomDirection</code> String - Can be <code>in</code> or <code>out</code>.</li>\n</ul>\n<p>Emitted when the user is requesting to change the zoom level using the mouse wheel.</p>\n<h4 id=\"event-devtools-opened\"><a href=\"#event-devtools-opened\">Event: 'devtools-opened'</a></h4>\n<p>当开发者工具被打开时，触发该事件。</p>\n<h4 id=\"event-devtools-closed\"><a href=\"#event-devtools-closed\">Event: 'devtools-closed'</a></h4>\n<p>当开发者工具被关闭时，触发该事件。</p>\n<h4 id=\"event-devtools-focused\"><a href=\"#event-devtools-focused\">Event: 'devtools-focused'</a></h4>\n<p>当开发者工具被选中/打开时，触发该事件。</p>\n<h4 id=\"事件-certificate-error\"><a href=\"#事件-certificate-error\">事件: 'certificate-error'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>error</code> String - The error code.</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">证书</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>isTrusted</code> Boolean - 用于显示证书是否可信。</li>\n</ul></li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p><code>证书</code>的<code>链接</code>验证失败时，触发该事件。</p>\n<p>使用方式与<a href=\"/docs/api/app#event-certificate-error\"><code>app</code>的<code>certificate-error</code></a>的事件相同。</p>\n<h4 id=\"事件-select-client-certificate\"><a href=\"#事件-select-client-certificate\">事件: 'select-client-certificate'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> URL</li>\n<li><code>certificateList</code> <a href=\"/docs/api/structures/certificate\">证书[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> - Must be a certificate from the given list.</li>\n</ul></li>\n</ul>\n<p>当一个客户证书被请求的时候发出。</p>\n<p>使用方式与<a href=\"/docs/api/app#event-select-client-certificate\"><code>app</code>的<code>select-client-certificate</code></a>的事件相同。</p>\n<h4 id=\"事件-login\"><a href=\"#事件-login\">事件: \"login\"</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>authenticationResponseDetails</code> Object<ul>\n<li><code>url</code> URL</li>\n</ul></li>\n<li><code>authInfo</code> Object<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (可选)</li>\n<li><code>password</code> String (可选)</li>\n</ul></li>\n</ul>\n<p>当 <code>webContents</code> 要进行基本身份验证时触发。</p>\n<p>使用方式与<a href=\"/docs/api/app#event-login\"><code>app</code>的<code>login</code></a>的事件相同。</p>\n<h4 id=\"event-found-in-page\"><a href=\"#event-found-in-page\">Event: 'found-in-page'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>result</code> Object<ul>\n<li><code>requestId</code> Integer</li>\n<li><code>activeMatchOrdinal</code> Integer - 当前匹配位置。</li>\n<li><code>matches</code> Integer - 符合匹配条件的元素个数。</li>\n<li><code>selectionArea</code> Rectangle - Coordinates of first match region.</li>\n<li><code>finalUpdate</code> Boolean</li>\n</ul></li>\n</ul>\n<p>如果调用[<code>webContents.findInPage</code>]有返回时，会触发这一事件。</p>\n<h4 id=\"event-media-started-playing\"><a href=\"#event-media-started-playing\">Event: 'media-started-playing'</a></h4>\n<p>多媒体开始播放时，触发该事件。</p>\n<h4 id=\"event-media-paused\"><a href=\"#event-media-paused\">Event: 'media-paused'</a></h4>\n<p>当媒体文件暂停或播放完成的时候触发</p>\n<h4 id=\"event-did-change-theme-color\"><a href=\"#event-did-change-theme-color\">Event: 'did-change-theme-color'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>color</code> (String | null) - Theme color is in format of '#rrggbb'. It is <code>null</code> when no theme color is set.</li>\n</ul>\n<p>Emitted when a page's theme color changes. This is usually due to encountering a meta tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">'theme-color'</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">'#ff0000'</span>></span>\n</code></pre>\n<h4 id=\"event-update-target-url\"><a href=\"#event-update-target-url\">Event: 'update-target-url'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n</ul>\n<p>当鼠标滑到，或者键盘切换到a连接时，触发该事件。</p>\n<h4 id=\"event-cursor-changed\"><a href=\"#event-cursor-changed\">Event: 'cursor-changed'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String</li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> (可选)</li>\n<li><code>scale</code> Float (optional) - scaling factor for the custom cursor.</li>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a> (可选) - <code>image</code>大小。</li>\n<li><code>hotspot</code> <a href=\"/docs/api/structures/point\">Point</a> (optional) - coordinates of the custom cursor's hotspot.</li>\n</ul>\n<p>当鼠标指针改变的时候触发。 Type参数值包含：<code>default</code>, <code>crosshair</code>, <code>pointer</code>, <code>text</code>, <code>wait</code>, <code>help</code>, <code>e-resize</code>, <code>n-resize</code>, <code>ne-resize</code>, <code>nw-resize</code>, <code>s-resize</code>, <code>se-resize</code>, <code>sw-resize</code>, <code>w-resize</code>, <code>ns-resize</code>, <code>ew-resize</code>, <code>nesw-resize</code>, <code>nwse-resize</code>, <code>col-resize</code>, <code>row-resize</code>, <code>m-panning</code>, <code>e-panning</code>, <code>n-panning</code>, <code>ne-panning</code>, <code>nw-panning</code>, <code>s-panning</code>, <code>se-panning</code>, <code>sw-panning</code>, <code>w-panning</code>, <code>move</code>, <code>vertical-text</code>, <code>cell</code>, <code>context-menu</code>, <code>alias</code>, <code>progress</code>, <code>nodrop</code>, <code>copy</code>, <code>none</code>, <code>not-allowed</code>, <code>zoom-in</code>, <code>zoom-out</code>, <code>grab</code>, <code>grabbing</code> 或 <code>custom</code>.</p>\n<p>If the <code>type</code> parameter is <code>custom</code>, the <code>image</code> parameter will hold the custom cursor image in a <a href=\"/docs/api/native-image\"><code>NativeImage</code></a>, and <code>scale</code>, <code>size</code> and <code>hotspot</code> will hold additional information about the custom cursor.</p>\n<h4 id=\"event-context-menu\"><a href=\"#event-context-menu\">Event: 'context-menu'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>params</code> Object<ul>\n<li><code>x</code> Integer - x 坐标。</li>\n<li><code>y</code> Integer - y 坐标。</li>\n<li><code>frame</code> WebFrameMain - Frame from which the context menu was invoked.</li>\n<li><code>linkURL</code> String - URL of the link that encloses the node the context menu was invoked on.</li>\n<li><code>linkText</code> String - Text associated with the link. May be an empty string if the contents of the link are an image.</li>\n<li><code>pageURL</code> String - URL of the top level page that the context menu was invoked on.</li>\n<li><code>frameURL</code> String - URL of the subframe that the context menu was invoked on.</li>\n<li><code>srcURL</code> String - Source URL for the element that the context menu was invoked on. Elements with source URLs are images, audio and video.</li>\n<li><code>mediaType</code> String - Type of the node the context menu was invoked on. Can be <code>none</code>, <code>image</code>, <code>audio</code>, <code>video</code>, <code>canvas</code>, <code>file</code> or <code>plugin</code>.</li>\n<li><code>hasImageContents</code> Boolean - Whether the context menu was invoked on an image which has non-empty contents.</li>\n<li><code>isEditable</code> Boolean - Whether the context is editable.</li>\n<li><code>selectionText</code> String - Text of the selection that the context menu was invoked on.</li>\n<li><code>titleText</code> String - Title text of the selection that the context menu was invoked on.</li>\n<li><code>altText</code> String - Alt text of the selection that the context menu was invoked on.</li>\n<li><code>suggestedFilename</code> String - Suggested filename to be used when saving file through 'Save Link As' option of context menu.</li>\n<li><code>selectionRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Rect representing the coordinates in the document space of the selection.</li>\n<li><code>selectionStartOffset</code> Number - Start position of the selection text.</li>\n<li><code>referrerPolicy</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer policy of the frame on which the menu is invoked.</li>\n<li><code>misspelledWord</code> String - The misspelled word under the cursor, if any.</li>\n<li><code>dictionarySuggestions</code> String[] - An array of suggested words to show the user to replace the <code>misspelledWord</code>.  Only available if there is a misspelled word and spellchecker is enabled.</li>\n<li><code>frameCharset</code> String - The character encoding of the frame on which the menu was invoked.</li>\n<li><code>inputFieldType</code> String - If the context menu was invoked on an input field, the type of that field. Possible values are <code>none</code>, <code>plainText</code>, <code>password</code>, <code>other</code>.</li>\n<li><code>spellcheckEnabled</code> Boolean - If the context is editable, whether or not spellchecking is enabled.</li>\n<li><code>menuSourceType</code> String - Input source that invoked the context menu. 可以是 <code>none</code>、<code>mouse</code>、<code>keyboard</code>、<code>touch</code>、<code>touchMenu</code>、<code>longPress</code>、<code>longTap</code>、<code>touchHandle</code>、<code>stylus</code>、<code>adjustSelection</code> 或 <code>adjustSelectionReset</code>。</li>\n<li><code>mediaFlags</code> Object - The flags for the media element the context menu was invoked on.<ul>\n<li><code>inError</code> Boolean - Whether the media element has crashed.</li>\n<li><code>isPaused</code> Boolean - Whether the media element is paused.</li>\n<li><code>isMuted</code> Boolean - Whether the media element is muted.</li>\n<li><code>hasAudio</code> Boolean - Whether the media element has audio.</li>\n<li><code>isLooping</code> Boolean - Whether the media element is looping.</li>\n<li><code>isControlsVisible</code> Boolean - Whether the media element's controls are visible.</li>\n<li><code>canToggleControls</code> Boolean - Whether the media element's controls are toggleable.</li>\n<li><code>canPrint</code> Boolean - Whether the media element can be printed.</li>\n<li><code>canSave</code> Boolean - Whether or not the media element can be downloaded.</li>\n<li><code>canShowPictureInPicture</code> Boolean - Whether the media element can show picture-in-picture.</li>\n<li><code>isShowingPictureInPicture</code> Boolean - Whether the media element is currently showing picture-in-picture.</li>\n<li><code>canRotate</code> Boolean - Whether the media element can be rotated.</li>\n<li><code>canLoop</code> Boolean - Whether the media element can be looped.</li>\n</ul></li>\n<li><code>editFlags</code> Object - These flags indicate whether the renderer believes it is able to perform the corresponding action.<ul>\n<li><code>canUndo</code> Boolean - Whether the renderer believes it can undo.</li>\n<li><code>canRedo</code> Boolean - Whether the renderer believes it can redo.</li>\n<li><code>canCut</code> Boolean - Whether the renderer believes it can cut.</li>\n<li><code>canCopy</code> Boolean - Whether the renderer believes it can copy.</li>\n<li><code>canPaste</code> Boolean - Whether the renderer believes it can paste.</li>\n<li><code>canDelete</code> Boolean - Whether the renderer believes it can delete.</li>\n<li><code>canSelectAll</code> Boolean - Whether the renderer believes it can select all.</li>\n<li><code>canEditRichly</code> Boolean - Whether the renderer believes it can edit text richly.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Emitted when there is a new context menu that needs to be handled.</p>\n<h4 id=\"事件-select-bluetooth-device\"><a href=\"#事件-select-bluetooth-device\">事件: 'select-bluetooth-device'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>devices</code> <a href=\"/docs/api/structures/bluetooth-device\">BluetoothDevice[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>deviceId</code> String 设备Id</li>\n</ul></li>\n</ul>\n<p>Emitted when bluetooth device needs to be selected on call to <code>navigator.bluetooth.requestDevice</code>. To use <code>navigator.bluetooth</code> api <code>webBluetooth</code> should be enabled. If <code>event.preventDefault</code> is not called, first available device will be selected. <code>callback</code> should be called with <code>deviceId</code> to be selected, passing empty string to <code>callback</code> will cancel the request.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'enable-experimental-web-platform-features'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.webContents.on(<span class=\"hljs-string\">'select-bluetooth-device'</span>, (event, deviceList, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> result = deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.deviceName === <span class=\"hljs-string\">'test'</span>\n    })\n    <span class=\"hljs-keyword\">if</span> (!result) {\n      callback(<span class=\"hljs-string\">''</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      callback(result.deviceId)\n    }\n  })\n})\n</code></pre>\n<h4 id=\"event-paint\"><a href=\"#event-paint\">Event: 'paint'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>dirtyRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> - The image data of the whole frame.</li>\n</ul>\n<p>Emitted when a new frame is generated. Only the dirty area is passed in the buffer.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">offscreen</span>: <span class=\"hljs-literal\">true</span> } })\nwin.webContents.on(<span class=\"hljs-string\">'paint'</span>, (event, dirty, image) => {\n  <span class=\"hljs-comment\">// updateBitmap(dirty, image.getBitmap())</span>\n})\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n</code></pre>\n<h4 id=\"event-devtools-reload-page\"><a href=\"#event-devtools-reload-page\">Event: 'devtools-reload-page'</a></h4>\n<p>当在开发者工具中命令webContents重新加载时，触发该事件。</p>\n<h4 id=\"event-will-attach-webview\"><a href=\"#event-will-attach-webview\">Event: 'will-attach-webview'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webPreferences</code> WebPreferences - The web preferences that will be used by the guest page. This object can be modified to adjust the preferences for the guest page.</li>\n<li><code>params</code> Record&#x3C;string, string> - The other <code>&#x3C;webview></code> parameters such as the <code>src</code> URL. This object can be modified to adjust the parameters of the guest page.</li>\n</ul>\n<p>Emitted when a <code>&#x3C;webview></code>'s web contents is being attached to this web contents. Calling <code>event.preventDefault()</code> will destroy the guest page.</p>\n<p>This event can be used to configure <code>webPreferences</code> for the <code>webContents</code> of a <code>&#x3C;webview></code> before it's loaded, and provides the ability to set settings that can't be set via <code>&#x3C;webview></code> attributes.</p>\n<p><strong>Note:</strong> The specified <code>preload</code> script option will appear as <code>preloadURL</code> (not <code>preload</code>) in the <code>webPreferences</code> object emitted with this event.</p>\n<h4 id=\"event-did-attach-webview\"><a href=\"#event-did-attach-webview\">Event: 'did-attach-webview'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> WebContents - The guest web contents that is used by the <code>&#x3C;webview></code>.</li>\n</ul>\n<p>当<code>&#x3C;webview></code>被挂载到页面内容中时，触发该事件。</p>\n<h4 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>level</code> Integer - The log level, from 0 to 3. 按顺序匹配 <code>verbose</code>, <code>info</code>, <code>warning</code> 和 <code>error</code>.</li>\n<li><code>message</code> String - 实际控制台消息</li>\n<li><code>line</code> Integer - The line number of the source that triggered this console message</li>\n<li><code>sourceId</code> String</li>\n</ul>\n<p>Emitted when the associated window logs a console message.</p>\n<h4 id=\"event-preload-error\"><a href=\"#event-preload-error\">Event: 'preload-error'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preloadPath</code> String</li>\n<li><code>error</code> Error</li>\n</ul>\n<p>Emitted when the preload script <code>preloadPath</code> throws an unhandled exception <code>error</code>.</p>\n<h4 id=\"event-ipc-message\"><a href=\"#event-ipc-message\">Event: 'ipc-message'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Emitted when the renderer process sends an asynchronous message via <code>ipcRenderer.send()</code>.</p>\n<h4 id=\"event-ipc-message-sync\"><a href=\"#event-ipc-message-sync\">Event: 'ipc-message-sync'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Emitted when the renderer process sends a synchronous message via <code>ipcRenderer.sendSync()</code>.</p>\n<h4 id=\"事件-desktop-capturer-get-sources\"><a href=\"#事件-desktop-capturer-get-sources\">事件: 'desktop-capturer-get-sources'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when <code>desktopCapturer.getSources()</code> is called in the renderer process. 调用 <code>event.preventDefault()</code> 将使它返回空的sources。</p>\n<h4 id=\"event-preferred-size-changed\"><a href=\"#event-preferred-size-changed\">Event: 'preferred-size-changed'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preferredSize</code> <a href=\"/docs/api/structures/size\">Size</a> - The minimum size needed to contain the layout of the document—without requiring scrolling.</li>\n</ul>\n<p>Emitted when the <code>WebContents</code> preferred size has changed.</p>\n<p>This event will only be emitted when <code>enablePreferredSizeMode</code> is set to <code>true</code> in <code>webPreferences</code>.</p>\n<h4 id=\"event-frame-created\"><a href=\"#event-frame-created\">Event: 'frame-created'</a></h4>\n<p>返回:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object<ul>\n<li><code>frame</code> WebFrameMain</li>\n</ul></li>\n</ul>\n<p>Emitted when the <a href=\"/docs/api/web-contents#contentsmainframe-readonly\">mainFrame</a>, an <code>&#x3C;iframe></code>, or a nested <code>&#x3C;iframe></code> is loaded within the page.</p>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<h4 id=\"contentsloadurlurl-options\"><a href=\"#contentsloadurlurl-options\"><code>contents.loadURL(url[, options])</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (可选) - 一个 HTTP Referrer url。</li>\n<li><code>userAgent</code> String (可选) - 发起请求的 userAgent.</li>\n<li><code>extraHeaders</code> String (optional) - Extra headers separated by \"\\n\".</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a></li>\n<li><code>baseURLForDataURL</code> String (可选) - 要加载的数据文件的根 url(带有路径分隔符). 只有当指定的 <code>url</code>是一个数据 url 并需要加载其他文件时，才需要这样做。</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - the promise will resolve when the page has finished loading (see <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects if the page fails to load (see <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>). A noop rejection handler is already attached, which avoids unhandled rejection errors.</p>\n<p>Loads the <code>url</code> in the window. The <code>url</code> must contain the protocol prefix, e.g. the <code>http://</code> or <code>file://</code>. If the load should bypass http cache then use the <code>pragma</code> header to achieve it.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> options = { <span class=\"hljs-attr\">extraHeaders</span>: <span class=\"hljs-string\">'pragma: no-cache\\n'</span> }\nwebContents.loadURL(<span class=\"hljs-string\">'https://github.com'</span>, options)\n</code></pre>\n<h4 id=\"contentsloadfilefilepath-options\"><a href=\"#contentsloadfilefilepath-options\"><code>contents.loadFile(filePath[, options])</code></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>query</code> Record&#x3C;String, String> (可选) - 传递给 <code>url.format()</code>.</li>\n<li><code>search</code> String (可选) - 传递给 <code>url.format()</code>.</li>\n<li><code>hash</code> String (可选) - 传递给 <code>url.format()</code>.</li>\n</ul></li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code> - 当页面完成加载后 promise 将会resolve (见 <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>)，如果页面加载失败，则 reject (见 <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>)。</p>\n<p>Loads the given file in the window, <code>filePath</code> should be a path to an HTML file relative to the root of your application.  For instance an app structure like this:</p>\n<pre><code class=\"hljs language-sh\">| root\n| - package.json\n| - src\n|   - main.js\n|   - index.html\n</code></pre>\n<p>需要运行以下代码：</p>\n<pre><code class=\"hljs language-js\">win.loadFile(<span class=\"hljs-string\">'src/index.html'</span>)\n</code></pre>\n<h4 id=\"contentsdownloadurlurl\"><a href=\"#contentsdownloadurlurl\"><code>contents.downloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code> without navigating. The <code>will-download</code> event of <code>session</code> will be triggered.</p>\n<h4 id=\"contentsgeturl\"><a href=\"#contentsgeturl\"><code>contents.getURL()</code></a></h4>\n<p>Returns <code>String</code> - 当前页面的URL.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> currentURL = win.webContents.getURL()\n  <span class=\"hljs-built_in\">console</span>.log(currentURL)\n})\n</code></pre>\n<h4 id=\"contentsgettitle\"><a href=\"#contentsgettitle\"><code>contents.getTitle()</code></a></h4>\n<p>返回 <code>String</code> - 当前页面的标题.</p>\n<h4 id=\"contentsisdestroyed\"><a href=\"#contentsisdestroyed\"><code>contents.isDestroyed()</code></a></h4>\n<p>返回 <code>Boolean</code> -判断页面是否被销毁</p>\n<h4 id=\"contentsfocus\"><a href=\"#contentsfocus\"><code>contents.focus()</code></a></h4>\n<p>页面聚焦</p>\n<h4 id=\"contentsisfocused\"><a href=\"#contentsisfocused\"><code>contents.isFocused()</code></a></h4>\n<p>返回 <code>Boolean</code> - 判断页面是否聚焦</p>\n<h4 id=\"contentsisloading\"><a href=\"#contentsisloading\"><code>contents.isLoading()</code></a></h4>\n<p>返回 <code>Boolean</code> - 判断页面是否正在加载资源</p>\n<h4 id=\"contentsisloadingmainframe\"><a href=\"#contentsisloadingmainframe\"><code>contents.isLoadingMainFrame()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the main frame (and not just iframes or frames within it) is still loading.</p>\n<h4 id=\"contentsiswaitingforresponse\"><a href=\"#contentsiswaitingforresponse\"><code>contents.isWaitingForResponse()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the web page is waiting for a first-response from the main resource of the page.</p>\n<h4 id=\"contentsstop\"><a href=\"#contentsstop\"><code>contents.stop()</code></a></h4>\n<p>Stops any pending navigation.</p>\n<h4 id=\"contentsreload\"><a href=\"#contentsreload\"><code>contents.reload()</code></a></h4>\n<p>刷新当前页面</p>\n<h4 id=\"contentsreloadignoringcache\"><a href=\"#contentsreloadignoringcache\"><code>contents.reloadIgnoringCache()</code></a></h4>\n<p>忽略缓存强制刷新页面</p>\n<h4 id=\"contentscangoback\"><a href=\"#contentscangoback\"><code>contents.canGoBack()</code></a></h4>\n<p>返回<code>Boolean</code>，是否可以返回到上一个页面</p>\n<h4 id=\"contentscangoforward\"><a href=\"#contentscangoforward\"><code>contents.canGoForward()</code></a></h4>\n<p>返回<code>Boolean</code> ，是否可以进入下一个页面</p>\n<h4 id=\"contentscangotooffsetoffset\"><a href=\"#contentscangotooffsetoffset\"><code>contents.canGoToOffset(offset)</code></a></h4>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the web page can go to <code>offset</code>.</p>\n<h4 id=\"contentsclearhistory\"><a href=\"#contentsclearhistory\"><code>contents.clearHistory()</code></a></h4>\n<p>清除定位历史。</p>\n<h4 id=\"contentsgoback\"><a href=\"#contentsgoback\"><code>contents.goBack()</code></a></h4>\n<p>使浏览器回退到上一个页面。</p>\n<h4 id=\"contentsgoforward\"><a href=\"#contentsgoforward\"><code>contents.goForward()</code></a></h4>\n<p>使浏览器前进到下一个页面。</p>\n<h4 id=\"contentsgotoindexindex\"><a href=\"#contentsgotoindexindex\"><code>contents.goToIndex(index)</code></a></h4>\n<ul>\n<li><code>index</code> Integer</li>\n</ul>\n<p>Navigates browser to the specified absolute web page index.</p>\n<h4 id=\"contentsgotooffsetoffset\"><a href=\"#contentsgotooffsetoffset\"><code>contents.goToOffset(offset)</code></a></h4>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>定位到相对于“当前入口”的指定的偏移。</p>\n<h4 id=\"contentsiscrashed\"><a href=\"#contentsiscrashed\"><code>contents.isCrashed()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the renderer process has crashed.</p>\n<h4 id=\"contentsforcefullycrashrenderer\"><a href=\"#contentsforcefullycrashrenderer\"><code>contents.forcefullyCrashRenderer()</code></a></h4>\n<p>Forcefully terminates the renderer process that is currently hosting this <code>webContents</code>. This will cause the <code>render-process-gone</code> event to be emitted with the <code>reason=killed || reason=crashed</code>. Please note that some webContents share renderer processes and therefore calling this method may also crash the host process for other webContents as well.</p>\n<p>Calling <code>reload()</code> immediately after calling this method will force the reload to occur in a new process. This should be used when this process is unstable or unusable, for instance in order to recover from the <code>unresponsive</code> event.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'unresponsive'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> { response } = <span class=\"hljs-keyword\">await</span> dialog.showMessageBox({\n    <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'App X has become unresponsive'</span>,\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Do you want to try forcefully reloading the app?'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'OK'</span>, <span class=\"hljs-string\">'Cancel'</span>],\n    <span class=\"hljs-attr\">cancelId</span>: <span class=\"hljs-number\">1</span>\n  })\n  <span class=\"hljs-keyword\">if</span> (response === <span class=\"hljs-number\">0</span>) {\n    contents.forcefullyCrashRenderer()\n    contents.reload()\n  }\n})\n</code></pre>\n<h4 id=\"contentssetuseragentuseragent\"><a href=\"#contentssetuseragentuseragent\"><code>contents.setUserAgent(userAgent)</code></a></h4>\n<ul>\n<li><code>userAgent</code> String</li>\n</ul>\n<p>重写该页面的user agent</p>\n<h4 id=\"contentsgetuseragent\"><a href=\"#contentsgetuseragent\"><code>contents.getUserAgent()</code></a></h4>\n<p>返回 <code>String</code> - 当前页面的user agent.</p>\n<h4 id=\"contentsinsertcsscss-options\"><a href=\"#contentsinsertcsscss-options\"><code>contents.insertCSS(css[, options])</code></a></h4>\n<ul>\n<li><code>css</code> String</li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>cssOrigin</code> String (optional) - Can be either 'user' or 'author'; Specifying 'user' enables you to prevent websites from overriding the CSS you insert. Default is 'author'.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - A promise that resolves with a key for the inserted CSS that can later be used to remove the CSS via <code>contents.removeInsertedCSS(key)</code>.</p>\n<p>Injects CSS into the current web page and returns a unique key for the inserted stylesheet.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n  contents.insertCSS(<span class=\"hljs-string\">'html, body { background-color: #f00; }'</span>)\n})\n</code></pre>\n<h4 id=\"contentsremoveinsertedcsskey\"><a href=\"#contentsremoveinsertedcsskey\"><code>contents.removeInsertedCSS(key)</code></a></h4>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves if the removal was successful.</p>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from <code>contents.insertCSS(css)</code>.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'did-finish-load'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> key = <span class=\"hljs-keyword\">await</span> contents.insertCSS(<span class=\"hljs-string\">'html, body { background-color: #f00; }'</span>)\n  contents.removeInsertedCSS(key)\n})\n</code></pre>\n<h4 id=\"contentsexecutejavascriptcode-usergesture\"><a href=\"#contentsexecutejavascriptcode-usergesture\"><code>contents.executeJavaScript(code[, userGesture])</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if the result of the code is a rejected promise.</p>\n<p>在页面中执行 <code>code</code>。</p>\n<p>在浏览器窗口中，一些HTML API（如<code>requestFullScreen</code>）只能是 由来自用户的手势调用。 将 <code>userGesture</code> 设置为 <code>true</code> 将删除此限制。</p>\n<p>Code execution will be suspended until web page stop loading.</p>\n<pre><code class=\"hljs language-js\">contents.executeJavaScript(<span class=\"hljs-string\">'fetch(\"https://jsonplaceholder.typicode.com/users/1\").then(resp => resp.json())'</span>, <span class=\"hljs-literal\">true</span>)\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">result</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(result) <span class=\"hljs-comment\">// Will be the JSON object from the fetch call</span>\n  })\n</code></pre>\n<h4 id=\"contentsexecutejavascriptinisolatedworldworldid-scripts-usergesture\"><a href=\"#contentsexecutejavascriptinisolatedworldworldid-scripts-usergesture\"><code>contents.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture])</code></a></h4>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default world, <code>999</code> is the world used by Electron's <code>contextIsolation</code> feature.  You can provide any integer here.</li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/web-source\">WebSource[]</a></li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if the result of the code is a rejected promise.</p>\n<p>Works like <code>executeJavaScript</code> but evaluates <code>scripts</code> in an isolated context.</p>\n<h4 id=\"contentssetignoremenushortcutsignore\"><a href=\"#contentssetignoremenushortcutsignore\"><code>contents.setIgnoreMenuShortcuts(ignore)</code></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n</ul>\n<p>Ignore application menu shortcuts while this web contents is focused.</p>\n<h4 id=\"contentssetwindowopenhandlerhandler\"><a href=\"#contentssetwindowopenhandlerhandler\"><code>contents.setWindowOpenHandler(handler)</code></a></h4>\n<ul>\n<li>\n<p><code>handler</code> 函数&#x3C;{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}></p>\n<ul>\n<li><code>details</code> Object<ul>\n<li><code>url</code> String - The <em>resolved</em> version of the URL passed to <code>window.open()</code>. e.g. opening a window with <code>window.open('foo')</code> will yield something like <code>https://the-origin/the/current/path/foo</code>.</li>\n<li><code>frameName</code> String - Name of the window provided in <code>window.open()</code></li>\n<li><code>features</code> String - Comma separated list of window features provided to <code>window.open()</code>.</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> or <code>other</code>.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer that will be passed to the new window. May or may not result in the <code>Referer</code> header being sent, depending on the referrer policy.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that will be sent to the new window, along with the appropriate headers that will be set. If no post data is to be sent, the value will be <code>null</code>. Only defined when the window is being created by a form that set <code>target=_blank</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}</code> - <code>deny</code> cancels the creation of the new window. <code>allow</code> will allow the new window to be created. Specifying <code>overrideBrowserWindowOptions</code> allows customization of the created window. Returning an unrecognized value such as a null, undefined, or an object without a recognized 'action' value will result in a console error and have the same effect as returning <code>{action: 'deny'}</code>.</p>\n</li>\n</ul>\n<p>Called before creating a window a new window is requested by the renderer, e.g. by <code>window.open()</code>, a link with <code>target=\"_blank\"</code>, shift+clicking on a link, or submitting a form with <code>&#x3C;form target=\"_blank\"></code>. See <a href=\"/docs/api/window-open\"><code>window.open()</code></a> for more details and how to use this in conjunction with <code>did-create-window</code>.</p>\n<h4 id=\"contentssetaudiomutedmuted\"><a href=\"#contentssetaudiomutedmuted\"><code>contents.setAudioMuted(muted)</code></a></h4>\n<ul>\n<li><code>muted</code> Boolean</li>\n</ul>\n<p>使当前页面音频静音</p>\n<h4 id=\"contentsisaudiomuted\"><a href=\"#contentsisaudiomuted\"><code>contents.isAudioMuted()</code></a></h4>\n<p>返回 <code>Boolean</code> -判断页面是否被静音</p>\n<h4 id=\"contentsiscurrentlyaudible\"><a href=\"#contentsiscurrentlyaudible\"><code>contents.isCurrentlyAudible()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether audio is currently playing.</p>\n<h4 id=\"contentssetzoomfactorfactor\"><a href=\"#contentssetzoomfactorfactor\"><code>contents.setZoomFactor(factor)</code></a></h4>\n<ul>\n<li><code>factor</code> Double - Zoom factor; default is 1.0.</li>\n</ul>\n<p>Changes the zoom factor to the specified factor. Zoom factor is zoom percent divided by 100, so 300% = 3.0.</p>\n<p>The factor must be greater than 0.0.</p>\n<h4 id=\"contentsgetzoomfactor\"><a href=\"#contentsgetzoomfactor\"><code>contents.getZoomFactor()</code></a></h4>\n<p>Returns <code>Number</code> - the current zoom factor.</p>\n<h4 id=\"contentssetzoomlevellevel\"><a href=\"#contentssetzoomlevellevel\"><code>contents.setZoomLevel(level)</code></a></h4>\n<ul>\n<li><code>level</code> Number - 缩放等级。</li>\n</ul>\n<p>更改缩放等级。 The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. The formula for this is <code>scale := 1.2 ^ level</code>.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h4 id=\"contentsgetzoomlevel\"><a href=\"#contentsgetzoomlevel\"><code>contents.getZoomLevel()</code></a></h4>\n<p>Returns <code>Number</code> - the current zoom level.</p>\n<h4 id=\"contentssetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#contentssetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>contents.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h4>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code></p>\n<p>设置最大和最小缩放级别。</p>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom is disabled by default in Electron. To re-enable it, call:</p>\n<pre><code class=\"hljs language-js\">contents.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">3</span>)\n</code></pre>\n</blockquote>\n<h4 id=\"contentsundo\"><a href=\"#contentsundo\"><code>contents.undo()</code></a></h4>\n<p>在页面中执行<code>undo</code>编辑命令。</p>\n<h4 id=\"contentsredo\"><a href=\"#contentsredo\"><code>contents.redo()</code></a></h4>\n<p>在页面中执行<code>redo</code>编辑命令。</p>\n<h4 id=\"contentscut\"><a href=\"#contentscut\"><code>contents.cut()</code></a></h4>\n<p>在页面中执行<code>cut</code>编辑命令。</p>\n<h4 id=\"contentscopy\"><a href=\"#contentscopy\"><code>contents.copy()</code></a></h4>\n<p>在页面中执行<code>copy</code>编辑命令。</p>\n<h4 id=\"contentscopyimageatx-y\"><a href=\"#contentscopyimageatx-y\"><code>contents.copyImageAt(x, y)</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Copy the image at the given position to the clipboard.</p>\n<h4 id=\"contentspaste\"><a href=\"#contentspaste\"><code>contents.paste()</code></a></h4>\n<p>在页面中执行<code>paste</code>编辑命令。</p>\n<h4 id=\"contentspasteandmatchstyle\"><a href=\"#contentspasteandmatchstyle\"><code>contents.pasteAndMatchStyle()</code></a></h4>\n<p>在页面中执行<code>pasteAndMatchStyle</code>编辑命令。</p>\n<h4 id=\"contentsdelete\"><a href=\"#contentsdelete\"><code>contents.delete()</code></a></h4>\n<p>在页面中执行<code>delete</code>编辑命令。</p>\n<h4 id=\"contentsselectall\"><a href=\"#contentsselectall\"><code>contents.selectAll()</code></a></h4>\n<p>在页面中执行<code>selectAll</code>编辑命令。</p>\n<h4 id=\"contentsunselect\"><a href=\"#contentsunselect\"><code>contents.unselect()</code></a></h4>\n<p>在页面中执行<code>unselect</code>编辑命令。</p>\n<h4 id=\"contentsreplacetext\"><a href=\"#contentsreplacetext\"><code>contents.replace(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>在页面中执行<code>replace</code>编辑命令。</p>\n<h4 id=\"contentsreplacemisspellingtext\"><a href=\"#contentsreplacemisspellingtext\"><code>contents.replaceMisspelling(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>在页面中执行<code>replaceMisspelling</code>编辑命令。</p>\n<h4 id=\"contentsinserttexttext\"><a href=\"#contentsinserttexttext\"><code>contents.insertText(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code></p>\n<p>插入<code>text</code> 到焦点元素</p>\n<h4 id=\"contentsfindinpagetext-options\"><a href=\"#contentsfindinpagetext-options\"><code>contents.findInPage(text[, options])</code></a></h4>\n<ul>\n<li><code>text</code> String - 要搜索的内容，必须非空。</li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>forward</code> Boolean (可选) -向前或向后搜索，默认为 <code>true</code>。</li>\n<li><code>findNext</code> Boolean (可选) - 是否使用此请求开始一个新的文本查找会话。 对于初始请求应该为 <code>true</code> ，对后续请求为 <code>false</code> 。 默认值为 <code>false</code>.</li>\n<li><code>matchCase</code> Boolean (optional) - Whether search should be case-sensitive, defaults to <code>false</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code> - The request id used for the request.</p>\n<p>Starts a request to find all matches for the <code>text</code> in the web page. The result of the request can be obtained by subscribing to <a href=\"/docs/api/web-contents#event-found-in-page\"><code>found-in-page</code></a> event.</p>\n<h4 id=\"contentsstopfindinpageaction\"><a href=\"#contentsstopfindinpageaction\"><code>contents.stopFindInPage(action)</code></a></h4>\n<ul>\n<li><code>action</code> String - Specifies the action to take place when ending [<code>webContents.findInPage</code>] request.<ul>\n<li><code>clearSelection</code> - Clear the selection.</li>\n<li><code>keepSelection</code> - Translate the selection into a normal selection.</li>\n<li><code>activateSelection</code> - Focus and click the selection node.</li>\n</ul></li>\n</ul>\n<p>Stops any <code>findInPage</code> request for the <code>webContents</code> with the provided <code>action</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nwebContents.on(<span class=\"hljs-string\">'found-in-page'</span>, (event, result) => {\n  <span class=\"hljs-keyword\">if</span> (result.finalUpdate) webContents.stopFindInPage(<span class=\"hljs-string\">'clearSelection'</span>)\n})\n\n<span class=\"hljs-keyword\">const</span> requestId = webContents.findInPage(<span class=\"hljs-string\">'api'</span>)\n<span class=\"hljs-built_in\">console</span>.log(requestId)\n</code></pre>\n<h4 id=\"contentscapturepagerect\"><a href=\"#contentscapturepagerect\"><code>contents.capturePage([rect])</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (optional) - The area of the page to be captured.</li>\n</ul>\n<p>返回 <code>Promise&#x3C;NativeImage></code> - 完成后返回一个<a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>在 <code>rect</code>内捕获页面的快照。 省略 <code>rect</code> 将捕获整个可见页面。</p>\n<h4 id=\"contentsisbeingcaptured\"><a href=\"#contentsisbeingcaptured\"><code>contents.isBeingCaptured()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether this page is being captured. It returns true when the capturer count is large then 0.</p>\n<h4 id=\"contentsincrementcapturercountsize-stayhidden-stayawake\"><a href=\"#contentsincrementcapturercountsize-stayhidden-stayawake\"><code>contents.incrementCapturerCount([size, stayHidden, stayAwake])</code></a></h4>\n<ul>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) - The preferred size for the capturer.</li>\n<li><code>stayHidden</code> Boolean (optional) -  Keep the page hidden instead of visible.</li>\n<li><code>stayAwake</code> Boolean (optional) -  Keep the system awake instead of allowing it to sleep.</li>\n</ul>\n<p>Increase the capturer count by one. The page is considered visible when its browser window is hidden and the capturer count is non-zero. If you would like the page to stay hidden, you should ensure that <code>stayHidden</code> is set to true.</p>\n<p>This also affects the Page Visibility API.</p>\n<h4 id=\"contentsdecrementcapturercountstayhidden-stayawake\"><a href=\"#contentsdecrementcapturercountstayhidden-stayawake\"><code>contents.decrementCapturerCount([stayHidden, stayAwake])</code></a></h4>\n<ul>\n<li><code>stayHidden</code> Boolean (optional) -  Keep the page in hidden state instead of visible.</li>\n<li><code>stayAwake</code> Boolean (optional) -  Keep the system awake instead of allowing it to sleep.</li>\n</ul>\n<p>Decrease the capturer count by one. The page will be set to hidden or occluded state when its browser window is hidden or occluded and the capturer count reaches zero. If you want to decrease the hidden capturer count instead you should set <code>stayHidden</code> to true.</p>\n<h4 id=\"contentsgetprinters\"><a href=\"#contentsgetprinters\"><code>contents.getPrinters()</code></a></h4>\n<p>获取系统打印机列表</p>\n<p>返回 <a href=\"/docs/api/structures/printer-info\"><code>PrinterInfo[]</code></a></p>\n<h4 id=\"contentsprintoptions-callback\"><a href=\"#contentsprintoptions-callback\"><code>contents.print([options], [callback])</code></a></h4>\n<ul>\n<li><code>options</code> Object (可选)<ul>\n<li><code>silent</code> Boolean (optional) - Don't ask user for print settings. 默认值为 <code>false</code>.</li>\n<li><code>printBackground</code> Boolean (optional) - Prints the background color and image of the web page. 默认值为 <code>false</code>.</li>\n<li><code>deviceName</code> String (optional) - Set the printer device name to use. Must be the system-defined name and not the 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.</li>\n<li><code>color</code> Boolean (optional) - Set whether the printed web page will be in color or grayscale. 默认值为 <code>true</code>。</li>\n<li><code>margins</code> Object (可选)<ul>\n<li><code>marginType</code> String (optional) - Can be <code>default</code>, <code>none</code>, <code>printableArea</code>, or <code>custom</code>. If <code>custom</code> is chosen, you will also need to specify <code>top</code>, <code>bottom</code>, <code>left</code>, and <code>right</code>.</li>\n<li><code>top</code> Number (optional) - The top margin of the printed web page, in pixels.</li>\n<li><code>bottom</code> Number (optional) - The bottom margin of the printed web page, in pixels.</li>\n<li><code>left</code> Number (optional) - The left margin of the printed web page, in pixels.</li>\n<li><code>right</code> Number (optional) - The right margin of the printed web page, in pixels.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - Whether the web page should be printed in landscape mode. 默认值为 <code>false</code>.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page.</li>\n<li><code>pagesPerSheet</code> Number (optional) - The number of pages to print per page sheet.</li>\n<li><code>collate</code> Boolean (optional) - Whether the web page should be collated.</li>\n<li><code>copies</code> Number (optional) - The number of copies of the web page to print.</li>\n<li><code>pageRanges</code> Object<a href=\"/docs/api/optional\"></a> - The page range to print. On macOS, only one range is honored.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>duplexMode</code> String (optional) - Set the duplex mode of the printed web page. 可以是 <code>simplex</code>、<code>shortEdge</code> 或 <code>longEdge</code>。</li>\n<li><code>dpi</code> Record&#x3C;string, number> (optional)<ul>\n<li><code>horizontal</code> Number (optional) - The horizontal dpi.</li>\n<li><code>vertical</code> Number (optional) - The vertical dpi.</li>\n</ul></li>\n<li><code>header</code> String (optional) - String to be printed as page header.</li>\n<li><code>footer</code> String (optional) - String to be printed as page footer.</li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the printed document. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code>.</li>\n</ul></li>\n<li><code>callback</code> Function (可选)<ul>\n<li><code>success</code> Boolean - Indicates success of the print call.</li>\n<li><code>failureReason</code> String - Error description called back if the print fails.</li>\n</ul></li>\n</ul>\n<p>When a custom <code>pageSize</code> is passed, Chromium attempts to validate platform specific minimum values for <code>width_microns</code> and <code>height_microns</code>. Width and height must both be minimum 353 microns but may be higher on some operating systems.</p>\n<p>Prints window's web page. When <code>silent</code> is set to <code>true</code>, Electron will pick the system's default printer if <code>deviceName</code> is empty and the default settings for printing.</p>\n<p>Use <code>page-break-before: always;</code> CSS style to force to print to a new page.</p>\n<p>示例：</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> options = {\n  <span class=\"hljs-attr\">silent</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">deviceName</span>: <span class=\"hljs-string\">'My-Printer'</span>,\n  <span class=\"hljs-attr\">pageRanges</span>: [{\n    <span class=\"hljs-attr\">from</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">to</span>: <span class=\"hljs-number\">1</span>\n  }]\n}\nwin.webContents.print(options, (success, errorType) => {\n  <span class=\"hljs-keyword\">if</span> (!success) <span class=\"hljs-built_in\">console</span>.log(errorType)\n})\n</code></pre>\n<h4 id=\"contentsprinttopdfoptions\"><a href=\"#contentsprinttopdfoptions\"><code>contents.printToPDF(options)</code></a></h4>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>headerFooter</code> Record&#x3C;string, string> (optional) - the header and footer for the PDF.<ul>\n<li><code>title</code> String - The title for the PDF header.</li>\n<li><code>url</code> String - the url for the PDF footer.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - <code>true</code> for landscape, <code>false</code> for portrait.</li>\n<li><code>marginsType</code> Integer (optional) - Specifies the type of margins to use. Uses 0 for default margin, 1 for no margin, and 2 for minimum margin.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page. Can range from 0 to 100.</li>\n<li><code>pageRanges</code> Record&#x3C;string, number> (optional) - The page range to print.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the generated PDF. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code> and <code>width</code> in microns.</li>\n<li><code>printBackground</code> Boolean (optional) - Whether to print CSS backgrounds.</li>\n<li><code>printSelectionOnly</code> Boolean (optional) - Whether to print selection only.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Buffer></code> - Resolves with the generated PDF data.</p>\n<p>Prints window's web page as PDF with Chromium's preview printing custom settings.</p>\n<p>The <code>landscape</code> will be ignored if <code>@page</code> CSS at-rule is used in the web page.</p>\n<p>By default, an empty <code>options</code> will be regarded as:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">marginsType</span>: <span class=\"hljs-number\">0</span>,\n  <span class=\"hljs-attr\">printBackground</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">printSelectionOnly</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">landscape</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">pageSize</span>: <span class=\"hljs-string\">'A4'</span>,\n  <span class=\"hljs-attr\">scaleFactor</span>: <span class=\"hljs-number\">100</span>\n}\n</code></pre>\n<p>Use <code>page-break-before: always;</code> CSS style to force to print to a new page.</p>\n<p>An example of <code>webContents.printToPDF</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n<span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\nwin.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n  <span class=\"hljs-comment\">// Use default printing options</span>\n  win.webContents.printToPDF({}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">data</span> =></span> {\n    <span class=\"hljs-keyword\">const</span> pdfPath = path.join(os.homedir(), <span class=\"hljs-string\">'Desktop'</span>, <span class=\"hljs-string\">'temp.pdf'</span>)\n    fs.writeFile(pdfPath, data, (error) => {\n      <span class=\"hljs-keyword\">if</span> (error) <span class=\"hljs-keyword\">throw</span> error\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Wrote PDF successfully to <span class=\"hljs-subst\">${pdfPath}</span>`</span>)\n    })\n  }).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">error</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Failed to write PDF to <span class=\"hljs-subst\">${pdfPath}</span>: `</span>, error)\n  })\n})\n</code></pre>\n<h4 id=\"contentsaddworkspacepath\"><a href=\"#contentsaddworkspacepath\"><code>contents.addWorkSpace(path)</code></a></h4>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Adds the specified path to DevTools workspace. Must be used after DevTools creation:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.on(<span class=\"hljs-string\">'devtools-opened'</span>, () => {\n  win.webContents.addWorkSpace(__dirname)\n})\n</code></pre>\n<h4 id=\"contentsremoveworkspacepath\"><a href=\"#contentsremoveworkspacepath\"><code>contents.removeWorkSpace(path)</code></a></h4>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Removes the specified path from DevTools workspace.</p>\n<h4 id=\"contentssetdevtoolswebcontentsdevtoolswebcontents\"><a href=\"#contentssetdevtoolswebcontentsdevtoolswebcontents\"><code>contents.setDevToolsWebContents(devToolsWebContents)</code></a></h4>\n<ul>\n<li><code>devToolsWebContents</code> WebContents</li>\n</ul>\n<p>Uses the <code>devToolsWebContents</code> as the target <code>WebContents</code> to show devtools.</p>\n<p>The <code>devToolsWebContents</code> must not have done any navigation, and it should not be used for other purposes after the call.</p>\n<p>By default Electron manages the devtools by creating an internal <code>WebContents</code> with native view, which developers have very limited control of. With the <code>setDevToolsWebContents</code> method, developers can use any <code>WebContents</code> to show the devtools in it, including <code>BrowserWindow</code>, <code>BrowserView</code> and <code>&#x3C;webview></code> tag.</p>\n<p>Note that closing the devtools does not destroy the <code>devToolsWebContents</code>, it is caller's responsibility to destroy <code>devToolsWebContents</code>.</p>\n<p>An example of showing devtools in a <code>&#x3C;webview></code> tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">style</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/css\"</span>></span><span class=\"css\">\n    * { <span class=\"hljs-attribute\">margin</span>: <span class=\"hljs-number\">0</span>; }\n    <span class=\"hljs-selector-id\">#browser</span> { <span class=\"hljs-attribute\">height</span>: <span class=\"hljs-number\">70%</span>; }\n    <span class=\"hljs-selector-id\">#devtools</span> { <span class=\"hljs-attribute\">height</span>: <span class=\"hljs-number\">30%</span>; }\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">style</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"browser\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"devtools\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"about:blank\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n    <span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n    <span class=\"hljs-keyword\">const</span> emittedOnce = <span class=\"hljs-function\">(<span class=\"hljs-params\">element, eventName</span>) =></span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> {\n      element.addEventListener(eventName, event => resolve(event), { <span class=\"hljs-attr\">once</span>: <span class=\"hljs-literal\">true</span> })\n    })\n    <span class=\"hljs-keyword\">const</span> browserView = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'browser'</span>)\n    <span class=\"hljs-keyword\">const</span> devtoolsView = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'devtools'</span>)\n    <span class=\"hljs-keyword\">const</span> browserReady = emittedOnce(browserView, <span class=\"hljs-string\">'dom-ready'</span>)\n    <span class=\"hljs-keyword\">const</span> devtoolsReady = emittedOnce(devtoolsView, <span class=\"hljs-string\">'dom-ready'</span>)\n    <span class=\"hljs-built_in\">Promise</span>.all([browserReady, devtoolsReady]).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      <span class=\"hljs-keyword\">const</span> targetId = browserView.getWebContentsId()\n      <span class=\"hljs-keyword\">const</span> devtoolsId = devtoolsView.getWebContentsId()\n      ipcRenderer.send(<span class=\"hljs-string\">'open-devtools'</span>, targetId, devtoolsId)\n    })\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain, webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'open-devtools'</span>, (event, targetContentsId, devtoolsContentsId) => {\n  <span class=\"hljs-keyword\">const</span> target = webContents.fromId(targetContentsId)\n  <span class=\"hljs-keyword\">const</span> devtools = webContents.fromId(devtoolsContentsId)\n  target.setDevToolsWebContents(devtools)\n  target.openDevTools()\n})\n</code></pre>\n<p>An example of showing devtools in a <code>BrowserWindow</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n<span class=\"hljs-keyword\">let</span> devtools = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  devtools = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  win.webContents.setDevToolsWebContents(devtools.webContents)\n  win.webContents.openDevTools({ <span class=\"hljs-attr\">mode</span>: <span class=\"hljs-string\">'detach'</span> })\n})\n</code></pre>\n<h4 id=\"contentsopendevtoolsoptions\"><a href=\"#contentsopendevtoolsoptions\"><code>contents.openDevTools([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (可选)<ul>\n<li><code>mode</code> String - Opens the devtools with specified dock state, can be <code>right</code>, <code>bottom</code>, <code>undocked</code>, <code>detach</code>. Defaults to last used dock state. In <code>undocked</code> mode it's possible to dock back. In <code>detach</code> mode it's not.</li>\n<li><code>activate</code> Boolean (optional) - Whether to bring the opened devtools window to the foreground. 默认值为 <code>true</code>。</li>\n</ul></li>\n</ul>\n<p>Opens the devtools.</p>\n<p>When <code>contents</code> is a <code>&#x3C;webview></code> tag, the <code>mode</code> would be <code>detach</code> by default, explicitly passing an empty <code>mode</code> can force using last used dock state.</p>\n<h4 id=\"contentsclosedevtools\"><a href=\"#contentsclosedevtools\"><code>contents.closeDevTools()</code></a></h4>\n<p>关闭开发者工具。</p>\n<h4 id=\"contentsisdevtoolsopened\"><a href=\"#contentsisdevtoolsopened\"><code>contents.isDevToolsOpened()</code></a></h4>\n<p>返回<code>Boolean</code> - 开发者工具是否处于开启状态。</p>\n<h4 id=\"contentsisdevtoolsfocused\"><a href=\"#contentsisdevtoolsfocused\"><code>contents.isDevToolsFocused()</code></a></h4>\n<p>返回<code>Boolean</code> - 开发者工具是否处于当前执行状态。</p>\n<h4 id=\"contentstoggledevtools\"><a href=\"#contentstoggledevtools\"><code>contents.toggleDevTools()</code></a></h4>\n<p>切换开发工具</p>\n<h4 id=\"contentsinspectelementx-y\"><a href=\"#contentsinspectelementx-y\"><code>contents.inspectElement(x, y)</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>开始检查位于(<code>x</code>, <code>y</code>) 的元素。</p>\n<h4 id=\"contentsinspectsharedworker\"><a href=\"#contentsinspectsharedworker\"><code>contents.inspectSharedWorker()</code></a></h4>\n<p>Opens the developer tools for the shared worker context.</p>\n<h4 id=\"contentsinspectsharedworkerbyidworkerid\"><a href=\"#contentsinspectsharedworkerbyidworkerid\"><code>contents.inspectSharedWorkerById(workerId)</code></a></h4>\n<ul>\n<li><code>workerId</code> String</li>\n</ul>\n<p>Inspects the shared worker based on its ID.</p>\n<h4 id=\"contentsgetallsharedworkers\"><a href=\"#contentsgetallsharedworkers\"><code>contents.getAllSharedWorkers()</code></a></h4>\n<p>Returns <a href=\"/docs/api/structures/shared-worker-info\"><code>SharedWorkerInfo[]</code></a> - Information about all Shared Workers.</p>\n<h4 id=\"contentsinspectserviceworker\"><a href=\"#contentsinspectserviceworker\"><code>contents.inspectServiceWorker()</code></a></h4>\n<p>Opens the developer tools for the service worker context.</p>\n<h4 id=\"contentssendchannel-args\"><a href=\"#contentssendchannel-args\"><code>contents.send(channel, ...args)</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to the renderer process via <code>channel</code>, along with arguments. 参数将使用 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>进行序列化，就像 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>postMessage</code></a>,因此原型链将不会包含在内。 发送 Functions, Promises, Symbols, WeakMaps, 或 WeakSets 将抛出异常</p>\n<blockquote>\n<p><strong>NOTE</strong>: Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n</blockquote>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>An example of sending messages from the main process to the renderer process:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// 在主进程中.</span>\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/index.html`</span>)\n  win.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n    win.webContents.send(<span class=\"hljs-string\">'ping'</span>, <span class=\"hljs-string\">'whoooooooh!'</span>)\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- index.html --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n    <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).ipcRenderer.on(<span class=\"hljs-string\">'ping'</span>, (event, message) => {\n      <span class=\"hljs-built_in\">console</span>.log(message) <span class=\"hljs-comment\">// Prints 'whoooooooh!'</span>\n    })\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<h4 id=\"contentssendtoframeframeid-channel-args\"><a href=\"#contentssendtoframeframeid-channel-args\"><code>contents.sendToFrame(frameId, channel, ...args)</code></a></h4>\n<ul>\n<li><code>frameId</code> Integer | [number, number] - the ID of the frame to send to, or a pair of <code>[processId, frameId]</code> if the frame is in a different process to the main frame.</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to a specific frame in a renderer process via <code>channel</code>, along with arguments. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>注意：</strong> 发送非标准的 JavaScript 类型，如DOM 对象或特殊Electron 对象将会抛出异常。</p>\n</blockquote>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>If you want to get the <code>frameId</code> of a given renderer context you should use the <code>webFrame.routingId</code> value.  如下:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// In a renderer process</span>\n<span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'My frameId is:'</span>, <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).webFrame.routingId)\n</code></pre>\n<p>You can also read <code>frameId</code> from all incoming IPC messages in the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// In the main process</span>\nipcMain.on(<span class=\"hljs-string\">'ping'</span>, (event) => {\n  <span class=\"hljs-built_in\">console</span>.info(<span class=\"hljs-string\">'Message came from frameId:'</span>, event.frameId)\n})\n</code></pre>\n<h4 id=\"contentspostmessagechannel-message-transfer\"><a href=\"#contentspostmessagechannel-message-transfer\"><code>contents.postMessage(channel, message, [transfer])</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a></li>\n</ul>\n<p>Send a message to the renderer process, optionally transferring ownership of zero or more [<code>MessagePortMain</code>][] objects.</p>\n<p>The transferred <code>MessagePortMain</code> objects will be available in the renderer process by accessing the <code>ports</code> property of the emitted event. When they arrive in the renderer, they will be native DOM <code>MessagePort</code> objects.</p>\n<p>例如：</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nwebContents.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<h4 id=\"contentsenabledeviceemulationparameters\"><a href=\"#contentsenabledeviceemulationparameters\"><code>contents.enableDeviceEmulation(parameters)</code></a></h4>\n<ul>\n<li><code>parameters</code> Object<ul>\n<li><code>screenPosition</code> String - Specify the screen type to emulate (default: <code>desktop</code>):<ul>\n<li><code>desktop</code> - Desktop screen type.</li>\n<li><code>mobile</code> - Mobile screen type.</li>\n</ul></li>\n<li><code>screenSize</code> <a href=\"/docs/api/structures/size\">Size</a> - Set the emulated screen size (screenPosition == mobile).</li>\n<li><code>viewPosition</code> <a href=\"/docs/api/structures/point\">Point</a> - Position the view on the screen (screenPosition == mobile) (default: <code>{ x: 0, y: 0 }</code>).</li>\n<li><code>deviceScaleFactor</code> Integer - Set the device scale factor (if zero defaults to original device scale factor) (default: <code>0</code>).</li>\n<li><code>viewSize</code> <a href=\"/docs/api/structures/size\">Size</a> - Set the emulated view size (empty means no override)</li>\n<li><code>scale</code> Float - Scale of emulated view inside available space (not in fit to view mode) (default: <code>1</code>).</li>\n</ul></li>\n</ul>\n<p>允许设备模拟给定参数。</p>\n<h4 id=\"contentsdisabledeviceemulation\"><a href=\"#contentsdisabledeviceemulation\"><code>contents.disableDeviceEmulation()</code></a></h4>\n<p>禁止<code>webContents.enableDeviceEmulation</code>允许的模拟设备</p>\n<h4 id=\"contentssendinputeventinputevent\"><a href=\"#contentssendinputeventinputevent\"><code>contents.sendInputEvent(inputEvent)</code></a></h4>\n<ul>\n<li><code>inputEvent</code> <a href=\"/docs/api/structures/mouse-input-event\">MouseInputEvent</a> | <a href=\"/docs/api/structures/mouse-wheel-input-event\">MouseWheelInputEvent</a> | <a href=\"/docs/api/structures/keyboard-input-event\">KeyboardInputEvent</a></li>\n</ul>\n<p>Sends an input <code>event</code> to the page. <strong>Note:</strong> The <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> containing the contents needs to be focused for <code>sendInputEvent()</code> to work.</p>\n<h4 id=\"contentsbeginframesubscriptiononlydirty-callback\"><a href=\"#contentsbeginframesubscriptiononlydirty-callback\"><code>contents.beginFrameSubscription([onlyDirty ,]callback)</code></a></h4>\n<ul>\n<li><code>onlyDirty</code> Boolean (可选) - 默认值为 <code>false</code>.</li>\n<li><code>callback</code> Function<ul>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a></li>\n<li><code>dirtyRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul></li>\n</ul>\n<p>Begin subscribing for presentation events and captured frames, the <code>callback</code> will be called with <code>callback(image, dirtyRect)</code> when there is a presentation event.</p>\n<p>The <code>image</code> is an instance of <a href=\"/docs/api/native-image\">NativeImage</a> that stores the captured frame.</p>\n<p>The <code>dirtyRect</code> is an object with <code>x, y, width, height</code> properties that describes which part of the page was repainted. If <code>onlyDirty</code> is set to <code>true</code>, <code>image</code> will only contain the repainted area. <code>onlyDirty</code> defaults to <code>false</code>.</p>\n<h4 id=\"contentsendframesubscription\"><a href=\"#contentsendframesubscription\"><code>contents.endFrameSubscription()</code></a></h4>\n<p>End subscribing for frame presentation events.</p>\n<h4 id=\"contentsstartdragitem\"><a href=\"#contentsstartdragitem\"><code>contents.startDrag(item)</code></a></h4>\n<ul>\n<li><code>item</code> Object<ul>\n<li><code>file</code> String - The path to the file being dragged.</li>\n<li><code>files</code> String<a href=\"/docs/api/optional\"></a> - The paths to the files being dragged. (<code>files</code> will override <code>file</code> field)</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String - The image must be non-empty on macOS.</li>\n</ul></li>\n</ul>\n<p>Sets the <code>item</code> as dragging item for current drag-drop operation, <code>file</code> is the absolute path of the file to be dragged, and <code>icon</code> is the image showing under the cursor when dragging.</p>\n<h4 id=\"contentssavepagefullpath-savetype\"><a href=\"#contentssavepagefullpath-savetype\"><code>contents.savePage(fullPath, saveType)</code></a></h4>\n<ul>\n<li><code>fullPath</code> String - The full file path.</li>\n<li><code>saveType</code> String - Specify the save type.<ul>\n<li><code>HTMLOnly</code> - Save only the HTML of the page.</li>\n<li><code>HTMLComplete</code> - Save complete-html page.</li>\n<li><code>MHTML</code> - Save complete-html page as MHTML.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves if the page is saved.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\nwin.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  win.webContents.savePage(<span class=\"hljs-string\">'/tmp/test.html'</span>, <span class=\"hljs-string\">'HTMLComplete'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Page was saved successfully.'</span>)\n  }).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(err)\n  })\n})\n</code></pre>\n<h4 id=\"contentsshowdefinitionforselection-macos\"><a href=\"#contentsshowdefinitionforselection-macos\"><code>contents.showDefinitionForSelection()</code> <em>macOS</em></a></h4>\n<p>Shows pop-up dictionary that searches the selected word on the page.</p>\n<h4 id=\"contentsisoffscreen\"><a href=\"#contentsisoffscreen\"><code>contents.isOffscreen()</code></a></h4>\n<p>Returns <code>Boolean</code> - Indicates whether <em>offscreen rendering</em> is enabled.</p>\n<h4 id=\"contentsstartpainting\"><a href=\"#contentsstartpainting\"><code>contents.startPainting()</code></a></h4>\n<p>If <em>offscreen rendering</em> is enabled and not painting, start painting.</p>\n<h4 id=\"contentsstoppainting\"><a href=\"#contentsstoppainting\"><code>contents.stopPainting()</code></a></h4>\n<p>If <em>offscreen rendering</em> is enabled and painting, stop painting.</p>\n<h4 id=\"contentsispainting\"><a href=\"#contentsispainting\"><code>contents.isPainting()</code></a></h4>\n<p>Returns <code>Boolean</code> - If <em>offscreen rendering</em> is enabled returns whether it is currently painting.</p>\n<h4 id=\"contentssetframeratefps\"><a href=\"#contentssetframeratefps\"><code>contents.setFrameRate(fps)</code></a></h4>\n<ul>\n<li><code>fps</code> Integer</li>\n</ul>\n<p>If <em>offscreen rendering</em> is enabled sets the frame rate to the specified number. Only values between 1 and 240 are accepted.</p>\n<h4 id=\"contentsgetframerate\"><a href=\"#contentsgetframerate\"><code>contents.getFrameRate()</code></a></h4>\n<p>Returns <code>Integer</code> - If <em>offscreen rendering</em> is enabled returns the current frame rate.</p>\n<h4 id=\"contentsinvalidate\"><a href=\"#contentsinvalidate\"><code>contents.invalidate()</code></a></h4>\n<p>Schedules a full repaint of the window this web contents is in.</p>\n<p>If <em>offscreen rendering</em> is enabled invalidates the frame and generates a new one through the <code>'paint'</code> event.</p>\n<h4 id=\"contentsgetwebrtciphandlingpolicy\"><a href=\"#contentsgetwebrtciphandlingpolicy\"><code>contents.getWebRTCIPHandlingPolicy()</code></a></h4>\n<p>Returns <code>String</code> - Returns the WebRTC IP Handling Policy.</p>\n<h4 id=\"contentssetwebrtciphandlingpolicypolicy\"><a href=\"#contentssetwebrtciphandlingpolicypolicy\"><code>contents.setWebRTCIPHandlingPolicy(policy)</code></a></h4>\n<ul>\n<li><code>policy</code> String - Specify the WebRTC IP Handling Policy.<ul>\n<li><code>default</code> - Exposes user's public and local IPs. This is the default behavior. When this policy is used, WebRTC has the right to enumerate all interfaces and bind them to discover public interfaces.</li>\n<li><code>default_public_interface_only</code> - Exposes user's public IP, but does not expose user's local IP. When this policy is used, WebRTC should only use the default route used by http. This doesn't expose any local addresses.</li>\n<li><code>default_public_and_private_interfaces</code> - Exposes user's public and local IPs. When this policy is used, WebRTC should only use the default route used by http. This also exposes the associated default private address. Default route is the route chosen by the OS on a multi-homed endpoint.</li>\n<li><code>disable_non_proxied_udp</code> - Does not expose public or local IPs. When this policy is used, WebRTC should only use TCP to contact peers or servers unless the proxy server supports UDP.</li>\n</ul></li>\n</ul>\n<p>Setting the WebRTC IP handling policy allows you to control which IPs are exposed via WebRTC. See <a href=\"https://browserleaks.com/webrtc\">BrowserLeaks</a> for more details.</p>\n<h4 id=\"contentsgetosprocessid\"><a href=\"#contentsgetosprocessid\"><code>contents.getOSProcessId()</code></a></h4>\n<p>Returns <code>Integer</code> - The operating system <code>pid</code> of the associated renderer process.</p>\n<h4 id=\"contentsgetprocessid\"><a href=\"#contentsgetprocessid\"><code>contents.getProcessId()</code></a></h4>\n<p>Returns <code>Integer</code> - The Chromium internal <code>pid</code> of the associated renderer. Can be compared to the <code>frameProcessId</code> passed by frame specific navigation events (e.g. <code>did-frame-navigate</code>)</p>\n<h4 id=\"contentstakeheapsnapshotfilepath\"><a href=\"#contentstakeheapsnapshotfilepath\"><code>contents.takeHeapSnapshot(filePath)</code></a></h4>\n<ul>\n<li><code>filePath</code> String - 输出文件路径</li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code> - 指明快捷方式是否被成功创建。</p>\n<p>获取V8堆快照并保存到 <code>filePath</code></p>\n<h4 id=\"contentsgetbackgroundthrottling\"><a href=\"#contentsgetbackgroundthrottling\"><code>contents.getBackgroundThrottling()</code></a></h4>\n<p>Returns <code>Boolean</code> - whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentssetbackgroundthrottlingallowed\"><a href=\"#contentssetbackgroundthrottlingallowed\"><code>contents.setBackgroundThrottling(allowed)</code></a></h4>\n<ul>\n<li><code>allowed</code> Boolean</li>\n</ul>\n<p>Controls whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentsgettype\"><a href=\"#contentsgettype\"><code>contents.getType()</code></a></h4>\n<p>Returns <code>String</code> - the type of the webContent. Can be <code>backgroundPage</code>, <code>window</code>, <code>browserView</code>, <code>remote</code>, <code>webview</code> or <code>offscreen</code>.</p>\n<h4 id=\"contentssetimageanimationpolicypolicy\"><a href=\"#contentssetimageanimationpolicypolicy\"><code>contents.setImageAnimationPolicy(policy)</code></a></h4>\n<ul>\n<li><code>policy</code> String - 可以是 <code>animate</code>, <code>animateOnce</code> 或 <code>noAnimation</code>.</li>\n</ul>\n<p>Sets the image animation policy for this webContents.  The policy only affects <em>new</em> images, existing images that are currently being animated are unaffected. This is a known limitation in Chromium, you can force image animation to be recalculated with <code>img.src = img.src</code> which will result in no network traffic but will update the animation policy.</p>\n<p>This corresponds to the <a href=\"https://developer.chrome.com/docs/extensions/reference/accessibilityFeatures/#property-animationPolicy\">animationPolicy</a> accessibility feature in Chromium.</p>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<h4 id=\"contentsaudiomuted\"><a href=\"#contentsaudiomuted\"><code>contents.audioMuted</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether this page is muted.</p>\n<h4 id=\"contentsuseragent\"><a href=\"#contentsuseragent\"><code>contents.userAgent</code></a></h4>\n<p>A <code>String</code> property that determines the user agent for this web page.</p>\n<h4 id=\"contentszoomlevel\"><a href=\"#contentszoomlevel\"><code>contents.zoomLevel</code></a></h4>\n<p>A <code>Number</code> property that determines the zoom level for this web contents.</p>\n<p>The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. The formula for this is <code>scale := 1.2 ^ level</code>.</p>\n<h4 id=\"contentszoomfactor\"><a href=\"#contentszoomfactor\"><code>contents.zoomFactor</code></a></h4>\n<p>A <code>Number</code> property that determines the zoom factor for this web contents.</p>\n<p>The zoom factor is the zoom percent divided by 100, so 300% = 3.0.</p>\n<h4 id=\"contentsframerate\"><a href=\"#contentsframerate\"><code>contents.frameRate</code></a></h4>\n<p>An <code>Integer</code> property that sets the frame rate of the web contents to the specified number. Only values between 1 and 240 are accepted.</p>\n<p>Only applicable if <em>offscreen rendering</em> is enabled.</p>\n<h4 id=\"contentsid-只读\"><a href=\"#contentsid-只读\"><code>contents.id</code> <em>只读</em></a></h4>\n<p><code>Integer</code>类型，代表WebContents的唯一标识（unique ID）。 每个ID在整个Electron应用程序的所有 <code>WebContents</code> 实例中都是唯一的。</p>\n<h4 id=\"contentssession-只读\"><a href=\"#contentssession-只读\"><code>contents.session</code> <em>只读</em></a></h4>\n<p>A <a href=\"/docs/api/session\"><code>Session</code></a> used by this webContents.</p>\n<h4 id=\"contentshostwebcontents-只读\"><a href=\"#contentshostwebcontents-只读\"><code>contents.hostWebContents</code> <em>只读</em></a></h4>\n<p>A <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> instance that might own this <code>WebContents</code>.</p>\n<h4 id=\"contentsdevtoolswebcontents-只读\"><a href=\"#contentsdevtoolswebcontents-只读\"><code>contents.devToolsWebContents</code> <em>只读</em></a></h4>\n<p>A <code>WebContents | null</code> property that represents the of DevTools <code>WebContents</code> associated with a given <code>WebContents</code>.</p>\n<p><strong>Note:</strong> Users should never store this object because it may become <code>null</code> when the DevTools has been closed.</p>\n<h4 id=\"contentsdebugger-只读\"><a href=\"#contentsdebugger-只读\"><code>contents.debugger</code> <em>只读</em></a></h4>\n<p>A <a href=\"/docs/api/debugger\"><code>Debugger</code></a> instance for this webContents.</p>\n<h4 id=\"contentsbackgroundthrottling\"><a href=\"#contentsbackgroundthrottling\"><code>contents.backgroundThrottling</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentsmainframe-只读\"><a href=\"#contentsmainframe-只读\"><code>contents.mainFrame</code> <em>只读</em></a></h4>\n<p>A <a href=\"/docs/api/web-frame-main\"><code>WebFrameMain</code></a> property that represents the top frame of the page's frame hierarchy.</p>",
      "title": "webContents",
      "description": "渲染以及控制 web 页面"
    },
    "/docs/tutorial/web-embeds": {
      "locale": "zh-CN",
      "slug": "web-embeds",
      "href": "/docs/tutorial/web-embeds",
      "crowdinFileId": "256269",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/web-embeds.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"web-embeds\"><a href=\"#web-embeds\">Web Embeds</a></h1>\n<h2 id=\"概览\"><a href=\"#概览\">概览</a></h2>\n<p>有三种方式可以让你在Electron的<code>BrowserWindow</code>里集成（第三方）web内容，<code>&#x3C;iframe></code> 和, <code>&#x3C;webview></code> 和 <code>BrowserViews</code> 每个功能都略有不同，适用于不同的情况。 为了帮助您在这些选择之间进行选择，本指南将解释他们之间的差异和功能。</p>\n<h3 id=\"iframes\"><a href=\"#iframes\">Iframes</a></h3>\n<p>Iframe 在 Electron 中的行为与普通浏览器中类似。 在宿主页面的 <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP\">Content Security Policy</a> 允许范围内，一个 <code>&#x3C;iframe></code> 元素能在页面上显示外部网页。 要限制 <code>&#x3C;iframe></code> 标签中站点的功能数量，建议 使用 <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox\"><code>sandbox</code> 属性</a> 并且只允许您想要支持的功能。</p>\n<h3 id=\"webview\"><a href=\"#webview\">WebView</a></h3>\n<blockquote>\n<p>重要提示： <a href=\"/docs/api/webview-tag#warning\">我们不建议您使用 WebView</a>，因为这个标签会发生剧烈的结构变化，可能会影响您应用程序的稳定性。 考虑切换到其他选择，如 <code>iframe</code> 和Electron的 <code>BrowserView</code>，或避免嵌入式内容 设计的架构。</p>\n</blockquote>\n<p><a href=\"/docs/api/webview-tag\">WebViews</a>基于 Chromium 的 WebView，不被 Electron 明确支持。 我们不能保证WebView API 在未来版本的 Electron 中仍然可用。 这就是为什么如果您想要使用<code>&#x3C;webview></code>标签，您需要在<code>BrowserWindow</code> 的 <code>webPreferences</code> 中设置 <code>webviewTag</code> 为 <code>true</code>。</p>\n<p>WebView是一个自定义元素 (<code>&#x3C;webview></code>)，仅在 Electron 内工作。 它们以 \"进程外 iframe\" 实现。 这意味着所有与 <code>&#x3C;webview></code> 的通信都是异步使用 IPC 进行的。 <code>&#x3C;webview></code>元素有许多自定义方法和事件，类似于<code>webContents</code>，使您能够更多地控制内容。</p>\n<p>与 <code>&#x3C;iframe></code>，<code>&#x3C;webview></code> 相比往往稍慢，但在加载和与第三方内容通信以及处理各种事件方面提供了更大的控制。</p>\n<h3 id=\"browserview\"><a href=\"#browserview\">BrowserView</a></h3>\n<p><a href=\"/docs/api/browser-view\">BrowserViews</a> 不是 DOM 的一部分，而是由主进程创建和控制。 它们只是现有窗口之上的另一层 Web 内容。 这意味着它们与您自己的 <code>BrowserWindow</code> 内容完全分离，并且它们的位置不受 DOM 或 CSS 的控制，而是通过在主进程中设置边界来控制其位置。 相反，它通过在主进程中设置界面来控制 。</p>\n<p>BrowserViews 提供对其内容的最大控制，因为它们实现 <code>webContents</code> 的方式与 <code>BrowserWindow</code> 实现内容的方式类似。 但是，由于 <code>BrowserViews</code> 不是 DOM 的一部分，而是覆盖在它们之上，因此您必须手动管理它们的位置。</p>",
      "title": "Web Embeds",
      "description": "重要提示： 我们不建议您使用 WebView，因为这个标签会发生剧烈的结构变化，可能会影响您应用程序的稳定性。 考虑切换到其他选择，如 iframe 和Electron的 BrowserView，或避免嵌入式内容 设计的架构。"
    },
    "/docs/api/web-frame": {
      "locale": "zh-CN",
      "slug": "web-frame",
      "href": "/docs/api/web-frame",
      "crowdinFileId": "256403",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-frame.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webframe\"><a href=\"#webframe\">webFrame</a></h1>\n<blockquote>\n<p>自定义渲染当前网页</p>\n</blockquote>\n<p>进程: <a href=\"/docs/glossary#renderer-process\"> Renderer</a></p>\n<p><code>webFrame</code> export of the Electron module is an instance of the <code>WebFrame</code> class representing the top frame of the current <code>BrowserWindow</code>. Sub-frames can be retrieved by certain properties and methods (e.g. <code>webFrame.firstChild</code>).</p>\n<p>将当前页缩放到200% 的示例。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nwebFrame.setZoomFactor(<span class=\"hljs-number\">2</span>)\n</code></pre>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p>The <code>WebFrame</code> class has the following instance methods:</p>\n<h3 id=\"webframesetzoomfactorfactor\"><a href=\"#webframesetzoomfactorfactor\"><code>webFrame.setZoomFactor(factor)</code></a></h3>\n<ul>\n<li><code>factor</code> Double - Zoom factor; default is 1.0.</li>\n</ul>\n<p>Changes the zoom factor to the specified factor. Zoom factor is zoom percent divided by 100, so 300% = 3.0.</p>\n<p>The factor must be greater than 0.0.</p>\n<h3 id=\"webframegetzoomfactor\"><a href=\"#webframegetzoomfactor\"><code>webFrame.getZoomFactor()</code></a></h3>\n<p>Returns <code>Number</code> - 当前的缩放比例。</p>\n<h3 id=\"webframesetzoomlevellevel\"><a href=\"#webframesetzoomlevellevel\"><code>webFrame.setZoomLevel(level)</code></a></h3>\n<ul>\n<li><code>level</code> Number - 缩放等级。</li>\n</ul>\n<p>更改缩放等级。 The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h3 id=\"webframegetzoomlevel\"><a href=\"#webframegetzoomlevel\"><code>webFrame.getZoomLevel()</code></a></h3>\n<p>Returns <code>Number</code> - The current zoom level.</p>\n<h3 id=\"webframesetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#webframesetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>webFrame.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h3>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>设置最大和最小缩放级别。</p>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom is disabled by default in Electron. To re-enable it, call:</p>\n<pre><code class=\"hljs language-js\">webFrame.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">3</span>)\n</code></pre>\n</blockquote>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom shortcuts are controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem roles in the application Menu. To disable shortcuts, manually <a href=\"/docs/api/menu#examples\">define the Menu</a> and omit zoom roles from the definition.</p>\n</blockquote>\n<h3 id=\"webframesetspellcheckproviderlanguage-provider\"><a href=\"#webframesetspellcheckproviderlanguage-provider\"><code>webFrame.setSpellCheckProvider(language, provider)</code></a></h3>\n<ul>\n<li><code>language</code> String</li>\n<li><code>provider</code> Object<ul>\n<li><code>spellCheck</code> 函数<ul>\n<li><code>words</code> String[]</li>\n<li><code>callback</code> Function<ul>\n<li><code>misspeltWords</code> String[]</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Sets a provider for spell checking in input fields and text areas.</p>\n<p>If you want to use this method you must disable the builtin spellchecker when you construct the window.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">spellcheck</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\n</code></pre>\n<p>The <code>provider</code> must be an object that has a <code>spellCheck</code> method that accepts an array of individual words for spellchecking. The <code>spellCheck</code> function runs asynchronously and calls the <code>callback</code> function with an array of misspelt words when complete.</p>\n<p>An example of using <a href=\"https://github.com/atom/node-spellchecker\">node-spellchecker</a> as provider:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> spellChecker = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spellchecker'</span>)\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, {\n  spellCheck (words, callback) {\n    setTimeout(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      <span class=\"hljs-keyword\">const</span> spellchecker = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spellchecker'</span>)\n      <span class=\"hljs-keyword\">const</span> misspelled = words.filter(<span class=\"hljs-function\"><span class=\"hljs-params\">x</span> =></span> spellchecker.isMisspelled(x))\n      callback(misspelled)\n    }, <span class=\"hljs-number\">0</span>)\n  }\n})\n</code></pre>\n<h3 id=\"webframeinsertcsscss\"><a href=\"#webframeinsertcsscss\"><code>webFrame.insertCSS(css)</code></a></h3>\n<ul>\n<li><code>css</code> String - CSS source code.</li>\n</ul>\n<p>Returns <code>String</code> - A key for the inserted CSS that can later be used to remove the CSS via <code>webFrame.removeInsertedCSS(key)</code>.</p>\n<p>Injects CSS into the current web page and returns a unique key for the inserted stylesheet.</p>\n<h3 id=\"webframeremoveinsertedcsskey\"><a href=\"#webframeremoveinsertedcsskey\"><code>webFrame.removeInsertedCSS(key)</code></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from <code>webFrame.insertCSS(css)</code>.</p>\n<h3 id=\"webframeinserttexttext\"><a href=\"#webframeinserttexttext\"><code>webFrame.insertText(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>插入<code>text</code> 到焦点元素</p>\n<h3 id=\"webframeexecutejavascriptcode-usergesture-callback\"><a href=\"#webframeexecutejavascriptcode-usergesture-callback\"><code>webFrame.executeJavaScript(code[, userGesture, callback])</code></a></h3>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n<li><code>callback</code> Function (optional) - Called after script has been executed. Unless the frame is suspended (e.g. showing a modal alert), execution will be synchronous and the callback will be invoked before the method returns. For compatibility with an older version of this method, the error parameter is second.<ul>\n<li><code>result</code> Any</li>\n<li><code>error</code> Error</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if execution throws or results in a rejected promise.</p>\n<p>在页面中执行 <code>code</code>。</p>\n<p>在浏览器窗口中，一些HTML API（如<code>requestFullScreen</code>）只能是 由来自用户的手势调用。 将 <code>userGesture</code> 设置为 <code>true</code> 将删除此限制。</p>\n<h3 id=\"webframeexecutejavascriptinisolatedworldworldid-scripts-usergesture-callback\"><a href=\"#webframeexecutejavascriptinisolatedworldworldid-scripts-usergesture-callback\"><code>webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture, callback])</code></a></h3>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default main world (where content runs), <code>999</code> is the world used by Electron's <code>contextIsolation</code> feature. Accepts values in the range 1..536870911.</li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/web-source\">WebSource[]</a></li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n<li><code>callback</code> Function (optional) - Called after script has been executed. Unless the frame is suspended (e.g. showing a modal alert), execution will be synchronous and the callback will be invoked before the method returns.  For compatibility with an older version of this method, the error parameter is second.<ul>\n<li><code>result</code> Any</li>\n<li><code>error</code> Error</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if execution could not start.</p>\n<p>Works like <code>executeJavaScript</code> but evaluates <code>scripts</code> in an isolated context.</p>\n<p>Note that when the execution of script fails, the returned promise will not reject and the <code>result</code> would be <code>undefined</code>. This is because Chromium does not dispatch errors of isolated worlds to foreign worlds.</p>\n<h3 id=\"webframesetisolatedworldinfoworldid-info\"><a href=\"#webframesetisolatedworldinfoworldid-info\"><code>webFrame.setIsolatedWorldInfo(worldId, info)</code></a></h3>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default world, <code>999</code> is the world used by Electrons <code>contextIsolation</code> feature. Chrome extensions reserve the range of IDs in <code>[1 &#x3C;&#x3C; 20, 1 &#x3C;&#x3C; 29)</code>. You can provide any integer here.</li>\n<li><code>info</code> Object<ul>\n<li><code>securityOrigin</code> String (optional) - Security origin for the isolated world.</li>\n<li><code>csp</code> String (optional) - Content Security Policy for the isolated world.</li>\n<li><code>name</code> String (optional) - Name for isolated world. Useful in devtools.</li>\n</ul></li>\n</ul>\n<p>Set the security origin, content security policy and name of the isolated world. Note: If the <code>csp</code> is specified, then the <code>securityOrigin</code> also has to be specified.</p>\n<h3 id=\"webframegetresourceusage\"><a href=\"#webframegetresourceusage\"><code>webFrame.getResourceUsage()</code></a></h3>\n<p>返回 <code>Object</code>:</p>\n<ul>\n<li><code>images</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>cssStyleSheets</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>xslStyleSheets</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>fonts</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>other</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n</ul>\n<p>Returns an object describing usage information of Blink's internal memory caches.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(webFrame.getResourceUsage())\n</code></pre>\n<p>This will generate:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">images</span>: {\n    <span class=\"hljs-attr\">count</span>: <span class=\"hljs-number\">22</span>,\n    <span class=\"hljs-attr\">size</span>: <span class=\"hljs-number\">2549</span>,\n    <span class=\"hljs-attr\">liveSize</span>: <span class=\"hljs-number\">2542</span>\n  },\n  <span class=\"hljs-attr\">cssStyleSheets</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> },\n  <span class=\"hljs-attr\">xslStyleSheets</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> },\n  <span class=\"hljs-attr\">fonts</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> },\n  <span class=\"hljs-attr\">other</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> }\n}\n</code></pre>\n<h3 id=\"webframeclearcache\"><a href=\"#webframeclearcache\"><code>webFrame.clearCache()</code></a></h3>\n<p>尝试释放不再使用的内存 (如以前导航中的图像)。</p>\n<p>请注意, 盲目调用此方法可能使Electron较慢, 因为它将不得不重新填充这些清空的缓存。你应该只在这种情况下调用它, 就是当你的应用程序发生的一个事件, 使你认为你的网页实际只使用了较少的内存 (例如你从一个超级重页跳转到一个基本为空的页面, 并打算留在那)。</p>\n<h3 id=\"webframegetframeforselectorselector\"><a href=\"#webframegetframeforselectorselector\"><code>webFrame.getFrameForSelector(selector)</code></a></h3>\n<ul>\n<li><code>selector</code> String - CSS selector for a frame element.</li>\n</ul>\n<p>Returns <code>WebFrame</code> - The frame element in <code>webFrame's</code> document selected by <code>selector</code>, <code>null</code> would be returned if <code>selector</code> does not select a frame or if the frame is not in the current renderer process.</p>\n<h3 id=\"webframefindframebynamename\"><a href=\"#webframefindframebynamename\"><code>webFrame.findFrameByName(name)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n</ul>\n<p>Returns <code>WebFrame</code> - A child of <code>webFrame</code> with the supplied <code>name</code>, <code>null</code> would be returned if there's no such frame or if the frame is not in the current renderer process.</p>\n<h3 id=\"webframefindframebyroutingidroutingid\"><a href=\"#webframefindframebyroutingidroutingid\"><code>webFrame.findFrameByRoutingId(routingId)</code></a></h3>\n<ul>\n<li><code>routingId</code> Integer - An <code>Integer</code> representing the unique frame id in the current renderer process. Routing IDs can be retrieved from <code>WebFrame</code> instances (<code>webFrame.routingId</code>) and are also passed by frame specific <code>WebContents</code> navigation events (e.g. <code>did-frame-navigate</code>)</li>\n</ul>\n<p>Returns <code>WebFrame</code> - that has the supplied <code>routingId</code>, <code>null</code> if not found.</p>\n<h3 id=\"webframeiswordmisspelledword\"><a href=\"#webframeiswordmisspelledword\"><code>webFrame.isWordMisspelled(word)</code></a></h3>\n<ul>\n<li><code>word</code> String - The word to be spellchecked.</li>\n</ul>\n<p>Returns <code>Boolean</code> - True if the word is misspelled according to the built in spellchecker, false otherwise. If no dictionary is loaded, always return false.</p>\n<h3 id=\"webframegetwordsuggestionsword\"><a href=\"#webframegetwordsuggestionsword\"><code>webFrame.getWordSuggestions(word)</code></a></h3>\n<ul>\n<li><code>word</code> String - The misspelled word.</li>\n</ul>\n<p>Returns <code>String[]</code> - A list of suggested words for a given word. If the word is spelled correctly, the result will be empty.</p>\n<h2 id=\"属性\"><a href=\"#属性\">属性</a></h2>\n<h3 id=\"webframetop-只读\"><a href=\"#webframetop-只读\"><code>webFrame.top</code> <em>只读</em></a></h3>\n<p>A <code>WebFrame | null</code> representing top frame in frame hierarchy to which <code>webFrame</code> belongs, the property would be <code>null</code> if top frame is not in the current renderer process.</p>\n<h3 id=\"webframeopener-只读\"><a href=\"#webframeopener-只读\"><code>webFrame.opener</code> <em>只读</em></a></h3>\n<p>A <code>WebFrame | null</code> representing the frame which opened <code>webFrame</code>, the property would be <code>null</code> if there's no opener or opener is not in the current renderer process.</p>\n<h3 id=\"webframeparent-只读\"><a href=\"#webframeparent-只读\"><code>webFrame.parent</code> <em>只读</em></a></h3>\n<p>A <code>WebFrame | null</code> representing parent frame of <code>webFrame</code>, the property would be <code>null</code> if <code>webFrame</code> is top or parent is not in the current renderer process.</p>\n<h3 id=\"webframefirstchild-只读\"><a href=\"#webframefirstchild-只读\"><code>webFrame.firstChild</code> <em>只读</em></a></h3>\n<p>A <code>WebFrame | null</code> representing the first child frame of <code>webFrame</code>, the property would be <code>null</code> if <code>webFrame</code> has no children or if first child is not in the current renderer process.</p>\n<h3 id=\"webframenextsibling-只读\"><a href=\"#webframenextsibling-只读\"><code>webFrame.nextSibling</code> <em>只读</em></a></h3>\n<p>A <code>WebFrame | null</code> representing next sibling frame, the property would be <code>null</code> if <code>webFrame</code> is the last frame in its parent or if the next sibling is not in the current renderer process.</p>\n<h3 id=\"webframeroutingid-只读\"><a href=\"#webframeroutingid-只读\"><code>webFrame.routingId</code> <em>只读</em></a></h3>\n<p>An <code>Integer</code> representing the unique frame id in the current renderer process. Distinct WebFrame instances that refer to the same underlying frame will have the same <code>routingId</code>.</p>",
      "title": "webFrame",
      "description": "自定义渲染当前网页"
    },
    "/docs/api/web-frame-main": {
      "locale": "zh-CN",
      "slug": "web-frame-main",
      "href": "/docs/api/web-frame-main",
      "crowdinFileId": "256401",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-frame-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webframemain\"><a href=\"#webframemain\">webFrameMain</a></h1>\n<blockquote>\n<p>控制页面和内联框架(iframes)。</p>\n</blockquote>\n<p>进程：<a href=\"/docs/glossary#main-process\">主进程</a></p>\n<p><code>webFramework</code> 模块可以用来查找现有的 <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> 实例。 通常在导航事件中使用。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, webFrameMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://twitter.com'</span>)\n\nwin.webContents.on(\n  <span class=\"hljs-string\">'did-frame-navigate'</span>,\n  (event, url, isMainFrame, frameProcessId, frameRoutingId) => {\n    <span class=\"hljs-keyword\">const</span> frame = webFrameMain.fromId(frameProcessId, frameRoutingId)\n    <span class=\"hljs-keyword\">if</span> (frame) {\n      <span class=\"hljs-keyword\">const</span> code = <span class=\"hljs-string\">'document.body.innerHTML = document.body.innerHTML.replaceAll(\"heck\", \"h*ck\")'</span>\n      frame.executeJavaScript(code)\n    }\n  }\n)\n</code></pre>\n<p>您还可以通过使用 <a href=\"/docs/api/web-contents\"><code>WebContents</code></a>的 <code>mainFrame</code> 属性 访问现有页面的框架。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">main</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  <span class=\"hljs-keyword\">await</span> win.loadURL(<span class=\"hljs-string\">'https://reddit.com'</span>)\n\n  <span class=\"hljs-keyword\">const</span> youtubeEmbeds = win.webContents.mainFrame.frames.filter(<span class=\"hljs-function\">(<span class=\"hljs-params\">frame</span>) =></span> {\n    <span class=\"hljs-keyword\">try</span> {\n      <span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-keyword\">new</span> URL(frame.url)\n      <span class=\"hljs-keyword\">return</span> url.host === <span class=\"hljs-string\">'www.youtube.com'</span>\n    } <span class=\"hljs-keyword\">catch</span> {\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n    }\n  })\n\n  <span class=\"hljs-built_in\">console</span>.log(youtubeEmbeds)\n}\n\nmain()\n</code></pre>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p>通过<code>webFrameMain</code>模块可以访问以下方法：</p>\n<h3 id=\"webframemainfromidprocessid-routingid\"><a href=\"#webframemainfromidprocessid-routingid\"><code>webFrameMain.fromId(processId, routingId)</code></a></h3>\n<ul>\n<li><code>processId</code> Integer - 表示拥有此框架的进程的内部 ID。</li>\n<li><code>routingId</code> Integer - 表示当前渲染器进程中唯一框架的 ID 。 Routing IDs can be retrieved from <code>WebFrameMain</code> instances (<code>frame.routingId</code>) and are also passed by frame specific <code>WebContents</code> navigation events (e.g. <code>did-frame-navigate</code>).</li>\n</ul>\n<p>Returns <code>WebFrameMain | undefined</code> - A frame with the given process and routing IDs, or <code>undefined</code> if there is no WebFrameMain associated with the given IDs.</p>\n<h2 id=\"class-webframemain\"><a href=\"#class-webframemain\">Class: WebFrameMain</a></h2>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"实例事件\"><a href=\"#实例事件\">实例事件</a></h3>\n<h4 id=\"事件-dom-ready\"><a href=\"#事件-dom-ready\">事件: 'dom-ready'</a></h4>\n<p>Emitted when the document is loaded.</p>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<h4 id=\"frameexecutejavascriptcode-usergesture\"><a href=\"#frameexecutejavascriptcode-usergesture\"><code>frame.executeJavaScript(code[, userGesture])</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;unknown></code> - A promise that resolves with the result of the executed code or is rejected if execution throws or results in a rejected promise.</p>\n<p>在页面中执行 <code>code</code>。</p>\n<p>在浏览器窗口中，一些HTML API（如<code>requestFullScreen</code>）只能是 由来自用户的手势调用。 将 <code>userGesture</code> 设置为 <code>true</code> 将删除此限制。</p>\n<h4 id=\"framereload\"><a href=\"#framereload\"><code>frame.reload()</code></a></h4>\n<p>Returns <code>boolean</code> - Whether the reload was initiated successfully. Only results in <code>false</code> when the frame has no history.</p>\n<h4 id=\"framesendchannel-args\"><a href=\"#framesendchannel-args\"><code>frame.send(channel, ...args)</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to the renderer process via <code>channel</code>, along with arguments. Arguments will be serialized with the [Structured Clone Algorithm][SCA], just like [<code>postMessage</code>][], so prototype chains will not be included. 发送 Functions, Promises, Symbols, WeakMaps, 或 WeakSets 将抛出异常</p>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<h4 id=\"framepostmessagechannel-message-transfer\"><a href=\"#framepostmessagechannel-message-transfer\"><code>frame.postMessage(channel, message, [transfer])</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a></li>\n</ul>\n<p>Send a message to the renderer process, optionally transferring ownership of zero or more [<code>MessagePortMain</code>][] objects.</p>\n<p>The transferred <code>MessagePortMain</code> objects will be available in the renderer process by accessing the <code>ports</code> property of the emitted event. When they arrive in the renderer, they will be native DOM <code>MessagePort</code> objects.</p>\n<p>例如：</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nwebContents.mainFrame.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<h3 id=\"实例属性\"><a href=\"#实例属性\">实例属性</a></h3>\n<h4 id=\"frameurl-readonly\"><a href=\"#frameurl-readonly\"><code>frame.url</code> <em>Readonly</em></a></h4>\n<p>A <code>string</code> representing the current URL of the frame.</p>\n<h4 id=\"frametop-readonly\"><a href=\"#frametop-readonly\"><code>frame.top</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain | null</code> representing top frame in the frame hierarchy to which <code>frame</code> belongs.</p>\n<h4 id=\"frameparent-readonly\"><a href=\"#frameparent-readonly\"><code>frame.parent</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain | null</code> representing parent frame of <code>frame</code>, the property would be <code>null</code> if <code>frame</code> is the top frame in the frame hierarchy.</p>\n<h4 id=\"frameframes-readonly\"><a href=\"#frameframes-readonly\"><code>frame.frames</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain[]</code> collection containing the direct descendents of <code>frame</code>.</p>\n<h4 id=\"frameframesinsubtree-readonly\"><a href=\"#frameframesinsubtree-readonly\"><code>frame.framesInSubtree</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain[]</code> collection containing every frame in the subtree of <code>frame</code>, including itself. This can be useful when traversing through all frames.</p>\n<h4 id=\"frameframetreenodeid-readonly\"><a href=\"#frameframetreenodeid-readonly\"><code>frame.frameTreeNodeId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the id of the frame's internal FrameTreeNode instance. This id is browser-global and uniquely identifies a frame that hosts content. The identifier is fixed at the creation of the frame and stays constant for the lifetime of the frame. When the frame is removed, the id is not used again.</p>\n<h4 id=\"framename-readonly\"><a href=\"#framename-readonly\"><code>frame.name</code> <em>Readonly</em></a></h4>\n<p>A <code>String</code> representing the frame name.</p>\n<h4 id=\"frameosprocessid-readonly\"><a href=\"#frameosprocessid-readonly\"><code>frame.osProcessId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the operating system <code>pid</code> of the process which owns this frame.</p>\n<h4 id=\"frameprocessid-readonly\"><a href=\"#frameprocessid-readonly\"><code>frame.processId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the Chromium internal <code>pid</code> of the process which owns this frame. This is not the same as the OS process ID; to read that use <code>frame.osProcessId</code>.</p>\n<h4 id=\"frameroutingid-readonly\"><a href=\"#frameroutingid-readonly\"><code>frame.routingId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the unique frame id in the current renderer process. Distinct <code>WebFrameMain</code> instances that refer to the same underlying frame will have the same <code>routingId</code>.</p>\n<h4 id=\"framevisibilitystate-只读\"><a href=\"#framevisibilitystate-只读\"><code>frame.visibilityState</code> <em>只读</em></a></h4>\n<p>A <code>string</code> representing the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState\">visibility state</a> of the frame.</p>\n<p>See also how the <a href=\"/docs/api/browser-window#page-visibility\">Page Visibility API</a> is affected by other Electron APIs.</p>",
      "title": "webFrameMain",
      "description": "控制页面和内联框架(iframes)。"
    },
    "/docs/api/web-request": {
      "locale": "zh-CN",
      "slug": "web-request",
      "href": "/docs/api/web-request",
      "crowdinFileId": "256405",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-request.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"类：webrequest\"><a href=\"#类：webrequest\">类：WebRequest</a></h2>\n<blockquote>\n<p>在一个请求生命周期的不同阶段，截取和修改其内容。</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>使用 <code>Session</code> 的 <code>WebRequest</code> 属性访问 <code>WebRequest</code> 类的实例。</p>\n<p><code>WebRequest</code> 下的所有方法接收 <code>filter </code> 和 <code>listener</code> 两个参数。 当 API 中有事件被触发时, <code>listener(details)</code> 会被调用， <code>details</code> 中包含了请求的详细信息。</p>\n<p>⚠️ Only the last attached <code>listener</code> will be used. Passing <code>null</code> as <code>listener</code> will unsubscribe from the event.</p>\n<p><code>filter</code> 对象具有一个 <code>url</code> 属性, 它是一个 url 模式数组, 用于筛选出与 url 模式不匹配的请求。 如果省略 <code>filter</code>, 则所有请求都将匹配。</p>\n<p>对于某些事件, <code>listener</code> 是通过 <code> callback</code> 传递的, 当 <code>listener </code> 完成其工作时, 应使用 <code>response</code> 对象进行调用。</p>\n<p>为 requests 添加 <code>User-Agent</code> 头的示例：</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Modify the user agent for all requests to the following urls.</span>\n<span class=\"hljs-keyword\">const</span> filter = {\n  <span class=\"hljs-attr\">urls</span>: [<span class=\"hljs-string\">'https://*.github.com/*'</span>, <span class=\"hljs-string\">'*://electron.github.io'</span>]\n}\n\nsession.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback) => {\n  details.requestHeaders[<span class=\"hljs-string\">'User-Agent'</span>] = <span class=\"hljs-string\">'MyAgent'</span>\n  callback({ <span class=\"hljs-attr\">requestHeaders</span>: details.requestHeaders })\n})\n</code></pre>\n<h3 id=\"实例方法\"><a href=\"#实例方法\">实例方法</a></h3>\n<p>以下事件会在<code>Session</code>实例触发。</p>\n<h4 id=\"webrequestonbeforerequestfilter-listener\"><a href=\"#webrequestonbeforerequestfilter-listener\"><code>webRequest.onBeforeRequest([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (可选)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/upload-data\">UploadData[]</a></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> Object<ul>\n<li><code>cancel</code> Boolean (可选)</li>\n<li><code>redirectURL</code> String (可选) - 原始请求被阻止发送或完成，而不是重定向到给定的URL。</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>当请求即将发生时，调用<code>listener(details, callback)</code>。</p>\n<p><code>uploadData</code> 是<code>UploadData</code>对象的一个数组。</p>\n<p>必须使用 <code>response</code> 对象调用<code>callback</code>。</p>\n<p>Some examples of valid <code>urls</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-string\">'http://foo:1234/'</span>\n<span class=\"hljs-string\">'http://foo.com/'</span>\n<span class=\"hljs-string\">'http://foo:1234/bar'</span>\n<span class=\"hljs-string\">'*://*/*'</span>\n<span class=\"hljs-string\">'*://example.com/*'</span>\n<span class=\"hljs-string\">'*://example.com/foo/*'</span>\n<span class=\"hljs-string\">'http://*.foo:1234/'</span>\n<span class=\"hljs-string\">'file://foo:1234/bar'</span>\n<span class=\"hljs-string\">'http://foo:*/'</span>\n<span class=\"hljs-string\">'*://www.foo.com/'</span>\n</code></pre>\n<h4 id=\"webrequestonbeforesendheadersfilter-listener\"><a href=\"#webrequestonbeforesendheadersfilter-listener\"><code>webRequest.onBeforeSendHeaders([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (可选)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>beforeSendResponse</code> Object<ul>\n<li><code>cancel</code> Boolean (可选)</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string | string[]> (optional) - When provided, request will be made with these headers.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>一旦请求头可用，在发送 HTTP 请求之前，<code>listener</code> 将以 <code>listener(details, callback)</code> 的形式被调用。 这可能发生在对服务器进行 TCP 连接之后，但在发送任何HTTP数据之前。</p>\n<p>The <code>callback</code> has to be called with a <code>response</code> object.</p>\n<h4 id=\"webrequestonsendheadersfilter-listener\"><a href=\"#webrequestonsendheadersfilter-listener\"><code>webRequest.onSendHeaders([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (可选)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>在请求发送到服务器之前，<code>listener</code>将以<code>listener(details)</code>的形式被调用，在该侦听器被出发前，上一个对 <code>onBeforeSendHeaders</code> 响应的修改是可见的。</p>\n<h4 id=\"webrequestonheadersreceivedfilter-listener\"><a href=\"#webrequestonheadersreceivedfilter-listener\"><code>webRequest.onHeadersReceived([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (可选)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>statusLine</code> String</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>headersReceivedResponse</code> Object<ul>\n<li><code>cancel</code> Boolean (可选)</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string | string[]> (optional) - When provided, the server is assumed to have responded with these headers.</li>\n<li><code>statusLine</code> String (optional) - Should be provided when overriding <code>responseHeaders</code> to change header status otherwise original response header's status will be used.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>当HTTP请求接收到报头后，会通过调用 <code>listener(details, callback)</code>方法来触发<code>listener</code>。</p>\n<p>The <code>callback</code> has to be called with a <code>response</code> object.</p>\n<h4 id=\"webrequestonresponsestartedfilter-listener\"><a href=\"#webrequestonresponsestartedfilter-listener\"><code>webRequest.onResponseStarted([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (可选)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n<li><code>fromCache</code> Boolean - 表明响应是取自硬盘缓存。</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>当收到响应体的第一个字节时， 将以 <code>listener(details)</code> 的形式来调用 <code> listener</code>。 对于 HTTP 请求而言，这意味着此时 HTTP 状态行和回应头已经可以读取了。</p>\n<h4 id=\"webrequestonbeforeredirectfilter-listener\"><a href=\"#webrequestonbeforeredirectfilter-listener\"><code>webRequest.onBeforeRedirect([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (可选)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>redirectURL</code> String</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n<li><code>ip</code> String (可选) - 请求实际发送到的服务器 IP 地址。</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>当服务器的初始重定向即将发生时，将以 <code>listener(details)</code>的方式调用<code>listener</code>。</p>\n<h4 id=\"webrequestoncompletedfilter-listener\"><a href=\"#webrequestoncompletedfilter-listener\"><code>webRequest.onCompleted([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (可选)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n<li><code>error</code> String</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>当请求完成时，将以 <code>listener(details)</code>的方式调用<code>listener</code>。</p>\n<h4 id=\"webrequestonerroroccurredfilter-listener\"><a href=\"#webrequestonerroroccurredfilter-listener\"><code>webRequest.onErrorOccurred([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Object<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (可选)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>error</code> String - 错误描述.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>当发生错误时，将以 <code>listener(details)</code>的方式调用<code>listener</code>。</p>",
      "title": "类：WebRequest",
      "description": "在一个请求生命周期的不同阶段，截取和修改其内容。"
    },
    "/docs/api/structures/web-request-filter": {
      "locale": "zh-CN",
      "slug": "web-request-filter",
      "href": "/docs/api/structures/web-request-filter",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/web-request-filter.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"webrequestfilter-object\"><a href=\"#webrequestfilter-object\">WebRequestFilter Object</a></h1>\n<ul>\n<li><code>urls</code> String[] - Array of URL patterns that will be used to filter out the requests that do not match the URL patterns.</li>\n</ul>",
      "title": "WebRequestFilter Object",
      "description": ""
    },
    "/docs/api/structures/web-source": {
      "locale": "zh-CN",
      "slug": "web-source",
      "href": "/docs/api/structures/web-source",
      "crowdinFileId": "256529",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/web-source.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"websource-object\"><a href=\"#websource-object\">WebSource Object</a></h1>\n<ul>\n<li><code>code</code> String</li>\n<li><code>url</code> String (optional)</li>\n<li><code>startLine</code> Integer (optional) - Default is 1.</li>\n</ul>",
      "title": "WebSource Object",
      "description": ""
    },
    "/docs/api/webview-tag": {
      "locale": "zh-CN",
      "slug": "webview-tag",
      "href": "/docs/api/webview-tag",
      "crowdinFileId": "256407",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/webview-tag.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webview标签\"><a href=\"#webview标签\"><code>&#x3C;webview></code>标签</a></h1>\n<h2 id=\"警告\"><a href=\"#警告\">警告</a></h2>\n<p>Electron的 <code>webview</code> 标签基于 <a href=\"https://developer.chrome.com/docs/extensions/reference/webviewTag/\">Chromium <code>webview</code> </a>，后者正在经历巨大的架构变化。 这将影响 <code>webview</code> 的稳定性，包括呈现、导航和事件路由。 我们目前建议不使用 <code>webview</code> 标签，并考虑其他替代方案，如 <code>iframe</code> ，<a href=\"/docs/api/browser-view\">Electron的 <code>BrowserView</code></a> 或完全避免嵌入内容的架构。</p>\n<h2 id=\"启用\"><a href=\"#启用\">启用</a></h2>\n<p>默认情况下，Electron >= 5禁用 <code>webview</code> 标签。  在构造 <code>BrowserWindow</code> 时，需要通过设置 <code>webviewTag</code> webPreferences选项来启用标签。 更多信息请参看 <a href=\"/docs/api/browser-window\">BrowserWindows 的构造器文档</a>。</p>\n<h2 id=\"概览\"><a href=\"#概览\">概览</a></h2>\n<blockquote>\n<p>在一个独立的 frame 和进程里显示外部 web 内容。</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>使用 <code>webview</code> 标签将'guest'内容 (例如网页) 嵌入到您的 Electron 应用中。 Guest 内容包含在 <code>webview</code> 容器内。 应用中的嵌入页面可以控制外来内容的布局和重绘。</p>\n<p>与 <code>iframe</code>不同， <code>webview</code> 独立于您的应用程序运行。 它拥有和你的页面不一样的权限并且所嵌入的内容和你应用之间的交互都将是异步的。 这将保证你的应用对于嵌入的内容的安全性。 <strong> 注意: </strong>从宿主页上调用 webview 的方法大多数都需要对主进程进行同步调用。</p>\n<h2 id=\"示例\"><a href=\"#示例\">示例</a></h2>\n<p>若要在应用程序中嵌入网页, 请将 <code>webview</code> 标签添加到应用程序的被嵌入页面中 (这是将显示外来内容的应用程序页)。 在最简单的例子中, <code>webview</code> 标签包括网页的 <code>src</code> 和控制 <code>webview</code> 容器外观的 css 样式:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"foo\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"display:inline-flex; width:640px; height:480px\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>如果要以任何方式控制外来内容, 则可以写用于侦听 <code>webview</code> 事件的 JavaScript, 并使用 <code>webview</code> 方法响应这些事件。 下面是包含两个事件侦听器的示例代码: 一个侦听网页开始加载, 另一个用于网页停止加载, 并在加载时显示 \"loading...\" 消息:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  onload = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\n    <span class=\"hljs-keyword\">const</span> indicator = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'.indicator'</span>)\n\n    <span class=\"hljs-keyword\">const</span> loadstart = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      indicator.innerText = <span class=\"hljs-string\">'loading...'</span>\n    }\n\n    <span class=\"hljs-keyword\">const</span> loadstop = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      indicator.innerText = <span class=\"hljs-string\">''</span>\n    }\n\n    webview.addEventListener(<span class=\"hljs-string\">'did-start-loading'</span>, loadstart)\n    webview.addEventListener(<span class=\"hljs-string\">'did-stop-loading'</span>, loadstop)\n  }\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h2 id=\"内部实现\"><a href=\"#内部实现\">内部实现</a></h2>\n<p>在内部  <code>webview</code> 与 <a href=\"https://www.chromium.org/developers/design-documents/oop-iframes\">过程外 iframes（OOPIF）</a>一起实施。 <code>webview</code> 标签本质上是一个自定义元素，使用 shadow DOM 将 <code>iframe</code> 元素包裹在里面。</p>\n<p>因此， <code>webview</code> 的行为与跨域 <code>iframe</code> 非常相似，例如：</p>\n<ul>\n<li>在 <code>webview</code> 中单击时，页面焦点将从嵌入器移动到 <code>webview</code>。</li>\n<li>您无法将键盘、鼠标和滚动事件侦听器添加到 <code>webview</code>。</li>\n<li>嵌入器框架和 <code>webview</code> 之间的所有反应都是异步的。</li>\n</ul>\n<h2 id=\"css-样式说明\"><a href=\"#css-样式说明\">CSS 样式说明</a></h2>\n<p>请注意，<code>webview</code> 标签的样式使用 <code>display:flex;</code> 来确保 <code>iframe</code>在传统和 flex 布局一起使用的情况下填充其 <code>webview</code> 容器的全部高度和宽度。 除非指定内联布局的 <code>display:inline-flex;</code> ，否则请不要 覆盖默认 <code>display:flex;</code> CSS属性。</p>\n<h2 id=\"标签属性\"><a href=\"#标签属性\">标签属性</a></h2>\n<p><code>webview</code> 标签具有以下属性：</p>\n<h3 id=\"src\"><a href=\"#src\"><code>src</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>表示可见网址的 <code>String</code> 。 Writing to this attribute initiates top-level navigation.</p>\n<p>更改 <code>src</code> 的值将重新加载当前页面。</p>\n<p><code>src</code> 属性还可以接受数据 URL, 如 <code>data:text/plain, Hello, world!</code>。</p>\n<h3 id=\"nodeintegration\"><a href=\"#nodeintegration\"><code>nodeintegration</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://www.google.com/\"</span> <span class=\"hljs-attr\">nodeintegration</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>一个 <code>Boolean</code>。 当有此属性时, <code>webview</code> 中的访客页（guest page）将具有Node集成, 并且可以使用像 <code>require</code> 和 <code>process</code> 这样的node APIs 去访问低层系统资源。 Node 集成在访客页中默认是禁用的。</p>\n<h3 id=\"nodeintegrationinsubframes\"><a href=\"#nodeintegrationinsubframes\"><code>nodeintegrationinsubframes</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://www.google.com/\"</span> <span class=\"hljs-attr\">nodeintegrationinsubframes</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code> for the experimental option for enabling NodeJS support in sub-frames such as iframes inside the <code>webview</code>. All your preloads will load for every iframe, you can use <code>process.isMainFrame</code> to determine if you are in the main frame or not. Node 集成在访客页中默认是禁用的。</p>\n<h3 id=\"plugins\"><a href=\"#plugins\"><code>plugins</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">plugins</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>一个 <code>Boolean</code>。 When this attribute is present the guest page in <code>webview</code> will be able to use browser plugins. Plugins are disabled by default.</p>\n<h3 id=\"preload\"><a href=\"#preload\"><code>preload</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- from a file --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">preload</span>=<span class=\"hljs-string\">\"./test.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n<span class=\"hljs-comment\">&#x3C;!-- or if you want to load from an asar archive --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">preload</span>=<span class=\"hljs-string\">\"./app.asar/test.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that specifies a script that will be loaded before other scripts run in the guest page. The protocol of script's URL must be <code>file:</code> (even when using <code>asar:</code> archives) because it will be loaded by Node's <code>require</code> under the hood, which treats <code>asar:</code> archives as virtual directories.</p>\n<p>当访客页没有 node integration ，这个脚本仍然有能力去访问所有的 Node APIs, 但是当这个脚本执行执行完成之后，通过Node 注入的全局对象（global objects）将会被删除。</p>\n<p><strong>Note:</strong> This option will appear as <code>preloadURL</code> (not <code>preload</code>) in the <code>webPreferences</code> specified to the <code>will-attach-webview</code> event.</p>\n<h3 id=\"httpreferrer\"><a href=\"#httpreferrer\"><code>httpreferrer</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">httpreferrer</span>=<span class=\"hljs-string\">\"http://cheng.guru\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the referrer URL for the guest page.</p>\n<h3 id=\"useragent\"><a href=\"#useragent\"><code>useragent</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">useragent</span>=<span class=\"hljs-string\">\"Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the user agent for the guest page before the page is navigated to. Once the page is loaded, use the <code>setUserAgent</code> method to change the user agent.</p>\n<h3 id=\"disablewebsecurity\"><a href=\"#disablewebsecurity\"><code>disablewebsecurity</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">disablewebsecurity</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>一个 <code>Boolean</code>。 When this attribute is present the guest page will have web security disabled. Web security is enabled by default.</p>\n<h3 id=\"partition\"><a href=\"#partition\"><code>partition</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span> <span class=\"hljs-attr\">partition</span>=<span class=\"hljs-string\">\"persist:github\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://electronjs.org\"</span> <span class=\"hljs-attr\">partition</span>=<span class=\"hljs-string\">\"electron\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the session used by the page. 如果 <code>partition</code> 以 <code>persist:</code>开头, 该页面将使用持续的 session，并在所有页面生效，且使用同一个<code>partition</code>. 如果没有 <code>persist:</code> 前缀, 页面将使用 in-memory session. 通过分配相同的 <code>partition</code>, 多个页可以共享同一会话。 如果没有设置<code>partition</code>，app 将会使用默认的session。</p>\n<p>This value can only be modified before the first navigation, since the session of an active renderer process cannot change. Subsequent attempts to modify the value will fail with a DOM exception.</p>\n<h3 id=\"allowpopups\"><a href=\"#allowpopups\"><code>allowpopups</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">allowpopups</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>一个 <code>Boolean</code>。 When this attribute is present the guest page will be allowed to open new windows. Popups are disabled by default.</p>\n<h3 id=\"webpreferences\"><a href=\"#webpreferences\"><code>webpreferences</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span> <span class=\"hljs-attr\">webpreferences</span>=<span class=\"hljs-string\">\"allowRunningInsecureContent, javascript=no\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p><code>String</code> 是一个由逗号分割的字符串列表，其中指定了要设置在 webview 上的 Web 首选项。 支持的首选项字符串的完整列表，请查看 <a href=\"/docs/api/browser-window#new-browserwindowoptions\">BrowserWindow</a>。</p>\n<p>该字符串的格式与 <code>window.open</code> 中的功能字符串( the features string )相同。 只有自己名字的将被赋予 <code>true</code> 布尔值。 可以通过 <code>=</code> 来赋予其他值。 <code>yes</code> 和 <code>1</code> 会被解析成 <code>true</code>，而 <code>no</code> 和 <code>0</code> 解析为 <code>false</code>。</p>\n<h3 id=\"enableblinkfeatures\"><a href=\"#enableblinkfeatures\"><code>enableblinkfeatures</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">enableblinkfeatures</span>=<span class=\"hljs-string\">\"PreciseMemoryInfo, CSSVariables\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> which is a list of strings which specifies the blink features to be enabled separated by <code>,</code>. The full list of supported feature strings can be found in the <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> file.</p>\n<h3 id=\"disableblinkfeatures\"><a href=\"#disableblinkfeatures\"><code>disableblinkfeatures</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">disableblinkfeatures</span>=<span class=\"hljs-string\">\"PreciseMemoryInfo, CSSVariables\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> which is a list of strings which specifies the blink features to be disabled separated by <code>,</code>. The full list of supported feature strings can be found in the <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> file.</p>\n<h2 id=\"方法\"><a href=\"#方法\">方法</a></h2>\n<p><code>webview</code> 标签具有以下方法：</p>\n<p><strong> 注意: </strong>使用方法之前 &#x3C;0>webview&#x3C;/0> 元素必须已被加载。</p>\n<p><strong>示例</strong></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'dom-ready'</span>, () => {\n  webview.openDevTools()\n})\n</code></pre>\n<h3 id=\"webviewloadurlurl-options\"><a href=\"#webviewloadurlurl-options\"><code>&#x3C;webview>.loadURL(url[, options])</code></a></h3>\n<ul>\n<li><code>url</code> URL</li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (可选) - 一个 HTTP Referrer url。</li>\n<li><code>userAgent</code> String (可选) - 发起请求的 userAgent.</li>\n<li><code>extraHeaders</code> String (可选) - 用 \"\\n\" 分割的额外标题</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/%E5%8F%AF%E9%80%89\"></a></li>\n<li><code>baseURLForDataURL</code> String (可选) - 要加载的数据文件的根 url(带有路径分隔符). 只有当指定的 <code>url</code>是一个数据 url 并需要加载其他文件时，才需要这样做。</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - The promise will resolve when the page has finished loading (see <a href=\"/docs/api/webview-tag#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects if the page fails to load (see <a href=\"/docs/api/webview-tag#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p><code>webview</code> 中加载目标 url，url 地址必须包含协议前缀，例如：<code>http://</code> 或 <code>file://</code>。</p>\n<h3 id=\"webviewdownloadurlurl\"><a href=\"#webviewdownloadurlurl\"><code>&#x3C;webview>.downloadURL(url)</code></a></h3>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code> without navigating.</p>\n<h3 id=\"webviewgeturl\"><a href=\"#webviewgeturl\"><code>&#x3C;webview>.getURL()</code></a></h3>\n<p>返回 <code>String</code> - 访客页的URL。</p>\n<h3 id=\"webviewgettitle\"><a href=\"#webviewgettitle\"><code>&#x3C;webview>.getTitle()</code></a></h3>\n<p>返回 <code>String</code> - 访客页的标题。</p>\n<h3 id=\"webviewisloading\"><a href=\"#webviewisloading\"><code>&#x3C;webview>.isLoading()</code></a></h3>\n<p>返回 <code>Boolean</code> - 访客页是否仍然在加载资源。</p>\n<h3 id=\"webviewisloadingmainframe\"><a href=\"#webviewisloadingmainframe\"><code>&#x3C;webview>.isLoadingMainFrame()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the main frame (and not just iframes or frames within it) is still loading.</p>\n<h3 id=\"webviewiswaitingforresponse\"><a href=\"#webviewiswaitingforresponse\"><code>&#x3C;webview>.isWaitingForResponse()</code></a></h3>\n<p>返回 <code>Boolean</code> - 访客页面是否正在等待页面主资源的第一响应。</p>\n<h3 id=\"webviewstop\"><a href=\"#webviewstop\"><code>&#x3C;webview>.stop()</code></a></h3>\n<p>Stops any pending navigation.</p>\n<h3 id=\"webviewreload\"><a href=\"#webviewreload\"><code>&#x3C;webview>.reload()</code></a></h3>\n<p>刷新访客页。</p>\n<h3 id=\"webviewreloadignoringcache\"><a href=\"#webviewreloadignoringcache\"><code>&#x3C;webview>.reloadIgnoringCache()</code></a></h3>\n<p>刷新访客页并忽略缓存。</p>\n<h3 id=\"webviewcangoback\"><a href=\"#webviewcangoback\"><code>&#x3C;webview>.canGoBack()</code></a></h3>\n<p>返回 <code>Boolean</code> - 访客页能否后退。</p>\n<h3 id=\"webviewcangoforward\"><a href=\"#webviewcangoforward\"><code>&#x3C;webview>.canGoForward()</code></a></h3>\n<p>返回 <code>Boolean</code> - 访客页能否前进。</p>\n<h3 id=\"webviewcangotooffsetoffset\"><a href=\"#webviewcangotooffsetoffset\"><code>&#x3C;webview>.canGoToOffset(offset)</code></a></h3>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>返回 <code>Boolean</code> - 访客页能否前进到 <code>offset</code>。</p>\n<h3 id=\"webviewclearhistory\"><a href=\"#webviewclearhistory\"><code>&#x3C;webview>.clearHistory()</code></a></h3>\n<p>清除定位历史。</p>\n<h3 id=\"webviewgoback\"><a href=\"#webviewgoback\"><code>&#x3C;webview>.goBack()</code></a></h3>\n<p>使访客页后退。</p>\n<h3 id=\"webviewgoforward\"><a href=\"#webviewgoforward\"><code>&#x3C;webview>.goForward()</code></a></h3>\n<p>使访客页前进。</p>\n<h3 id=\"webviewgotoindexindex\"><a href=\"#webviewgotoindexindex\"><code>&#x3C;webview>.goToIndex(index)</code></a></h3>\n<ul>\n<li><code>index</code> Integer</li>\n</ul>\n<p>定位到指定的绝对索引。</p>\n<h3 id=\"webviewgotooffsetoffset\"><a href=\"#webviewgotooffsetoffset\"><code>&#x3C;webview>.goToOffset(offset)</code></a></h3>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>定位到相对于“当前入口”的指定的偏移。</p>\n<h3 id=\"webviewiscrashed\"><a href=\"#webviewiscrashed\"><code>&#x3C;webview>.isCrashed()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the renderer process has crashed.</p>\n<h3 id=\"webviewsetuseragentuseragent\"><a href=\"#webviewsetuseragentuseragent\"><code>&#x3C;webview>.setUserAgent(userAgent)</code></a></h3>\n<ul>\n<li><code>userAgent</code> String</li>\n</ul>\n<p>覆盖访客页的用户代理。</p>\n<h3 id=\"webviewgetuseragent\"><a href=\"#webviewgetuseragent\"><code>&#x3C;webview>.getUserAgent()</code></a></h3>\n<p>返回 <code>String</code> - 访客页的用户代理。</p>\n<h3 id=\"webviewinsertcsscss\"><a href=\"#webviewinsertcsscss\"><code>&#x3C;webview>.insertCSS(css)</code></a></h3>\n<ul>\n<li><code>css</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - A promise that resolves with a key for the inserted CSS that can later be used to remove the CSS via <code>&#x3C;webview>.removeInsertedCSS(key)</code>.</p>\n<p>Injects CSS into the current web page and returns a unique key for the inserted stylesheet.</p>\n<h3 id=\"webviewremoveinsertedcsskey\"><a href=\"#webviewremoveinsertedcsskey\"><code>&#x3C;webview>.removeInsertedCSS(key)</code></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves if the removal was successful.</p>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from <code>&#x3C;webview>.insertCSS(css)</code>.</p>\n<h3 id=\"webviewexecutejavascriptcode-usergesture\"><a href=\"#webviewexecutejavascriptcode-usergesture\"><code>&#x3C;webview>.executeJavaScript(code[, userGesture])</code></a></h3>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (可选) - 默认为 <code>false</code>。</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if the result of the code is a rejected promise.</p>\n<p>在页面中执行 <code>code</code>。 如果设置了<code>userGesture</code>，它将在页面中创建用户手势上下文。 像 <code>requestFullScreen</code> 这样的需要用户操作的HTML API可以利用这个选项来实现自动化。</p>\n<h3 id=\"webviewopendevtools\"><a href=\"#webviewopendevtools\"><code>&#x3C;webview>.openDevTools()</code></a></h3>\n<p>打开 guest 页面的 DevTools 窗口。</p>\n<h3 id=\"webviewclosedevtools\"><a href=\"#webviewclosedevtools\"><code>&#x3C;webview>.closeDevTools()</code></a></h3>\n<p>关闭 guest 页面的 DevTools 窗口。</p>\n<h3 id=\"webviewisdevtoolsopened\"><a href=\"#webviewisdevtoolsopened\"><code>&#x3C;webview>.isDevToolsOpened()</code></a></h3>\n<p>返回 <code>Boolean</code> - guest 页面是否打开了 Devtools。</p>\n<h3 id=\"webviewisdevtoolsfocused\"><a href=\"#webviewisdevtoolsfocused\"><code>&#x3C;webview>.isDevToolsFocused()</code></a></h3>\n<p>返回 <code>Boolean</code> - guest 页面的 DevTools 窗口是否聚焦。</p>\n<h3 id=\"webviewinspectelementx-y\"><a href=\"#webviewinspectelementx-y\"><code>&#x3C;webview>.inspectElement(x, y)</code></a></h3>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Starts inspecting element at position (<code>x</code>, <code>y</code>) of guest page.</p>\n<h3 id=\"webviewinspectsharedworker\"><a href=\"#webviewinspectsharedworker\"><code>&#x3C;webview>.inspectSharedWorker()</code></a></h3>\n<p>Opens the DevTools for the shared worker context present in the guest page.</p>\n<h3 id=\"webviewinspectserviceworker\"><a href=\"#webviewinspectserviceworker\"><code>&#x3C;webview>.inspectServiceWorker()</code></a></h3>\n<p>Opens the DevTools for the service worker context present in the guest page.</p>\n<h3 id=\"webviewsetaudiomutedmuted\"><a href=\"#webviewsetaudiomutedmuted\"><code>&#x3C;webview>.setAudioMuted(muted)</code></a></h3>\n<ul>\n<li><code>muted</code> Boolean</li>\n</ul>\n<p>设置访客页是否静音。</p>\n<h3 id=\"webviewisaudiomuted\"><a href=\"#webviewisaudiomuted\"><code>&#x3C;webview>.isAudioMuted()</code></a></h3>\n<p>返回 <code>Boolean</code> - 访客页是否被静音。</p>\n<h3 id=\"webviewiscurrentlyaudible\"><a href=\"#webviewiscurrentlyaudible\"><code>&#x3C;webview>.isCurrentlyAudible()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether audio is currently playing.</p>\n<h3 id=\"webviewundo\"><a href=\"#webviewundo\"><code>&#x3C;webview>.undo()</code></a></h3>\n<p>在页面中执行编辑命令 <code>undo</code>。</p>\n<h3 id=\"webviewredo\"><a href=\"#webviewredo\"><code>&#x3C;webview>.redo()</code></a></h3>\n<p>在页面中执行编辑命令 <code>redo</code>。</p>\n<h3 id=\"webviewcut\"><a href=\"#webviewcut\"><code>&#x3C;webview>.cut()</code></a></h3>\n<p>在页面中执行编辑命令 <code>cut</code>。</p>\n<h3 id=\"webviewcopy\"><a href=\"#webviewcopy\"><code>&#x3C;webview>.copy()</code></a></h3>\n<p>在页面中执行编辑命令 <code>copy</code>。</p>\n<h3 id=\"webviewpaste\"><a href=\"#webviewpaste\"><code>&#x3C;webview>.paste()</code></a></h3>\n<p>在页面中执行编辑命令 <code>paste</code>。</p>\n<h3 id=\"webviewpasteandmatchstyle\"><a href=\"#webviewpasteandmatchstyle\"><code>&#x3C;webview>.pasteAndMatchStyle()</code></a></h3>\n<p>在页面中执行编辑命令 <code>pasteAndMatchStyle</code>。</p>\n<h3 id=\"webviewdelete\"><a href=\"#webviewdelete\"><code>&#x3C;webview>.delete()</code></a></h3>\n<p>在页面中执行编辑命令 <code>delete</code>。</p>\n<h3 id=\"webviewselectall\"><a href=\"#webviewselectall\"><code>&#x3C;webview>.selectAll()</code></a></h3>\n<p>在页面中执行编辑命令 <code>selectAll</code>。</p>\n<h3 id=\"webviewunselect\"><a href=\"#webviewunselect\"><code>&#x3C;webview>.unselect()</code></a></h3>\n<p>在页面中执行编辑命令 <code>unselect</code>。</p>\n<h3 id=\"webviewreplacetext\"><a href=\"#webviewreplacetext\"><code>&#x3C;webview>.replace(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>在页面中执行编辑命令 <code>replace</code>。</p>\n<h3 id=\"webviewreplacemisspellingtext\"><a href=\"#webviewreplacemisspellingtext\"><code>&#x3C;webview>.replaceMisspelling(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>在页面中执行编辑命令 <code>replaceMisspelling</code>。</p>\n<h3 id=\"webviewinserttexttext\"><a href=\"#webviewinserttexttext\"><code>&#x3C;webview>.insertText(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code></p>\n<p>插入<code>text</code> 到焦点元素</p>\n<h3 id=\"webviewfindinpagetext-options\"><a href=\"#webviewfindinpagetext-options\"><code>&#x3C;webview>.findInPage(text[, options])</code></a></h3>\n<ul>\n<li><code>text</code> String - 要搜索的内容，必须非空。</li>\n<li><code>options</code> Object (可选)<ul>\n<li><code>forward</code> Boolean (可选) -向前或向后搜索，默认为 <code>true</code>。</li>\n<li><code>findNext</code> Boolean (可选) - 是否使用此请求开始一个新的文本查找会话。 对于初始请求应该为 <code>true</code> ，对后续请求为 <code>false</code> 。 默认值为 <code>false</code>.</li>\n<li><code>matchCase</code> Boolean (optional) - Whether search should be case-sensitive, defaults to <code>false</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code> - The request id used for the request.</p>\n<p>Starts a request to find all matches for the <code>text</code> in the web page. The result of the request can be obtained by subscribing to <a href=\"/docs/api/webview-tag#event-found-in-page\"><code>found-in-page</code></a> event.</p>\n<h3 id=\"webviewstopfindinpageaction\"><a href=\"#webviewstopfindinpageaction\"><code>&#x3C;webview>.stopFindInPage(action)</code></a></h3>\n<ul>\n<li><code>action</code> String - Specifies the action to take place when ending <a href=\"#webviewfindinpagetext-options\"><code>&#x3C;webview>.findInPage</code></a> request.<ul>\n<li><code>clearSelection</code> - Clear the selection.</li>\n<li><code>keepSelection</code> - Translate the selection into a normal selection.</li>\n<li><code>activateSelection</code> - Focus and click the selection node.</li>\n</ul></li>\n</ul>\n<p>Stops any <code>findInPage</code> request for the <code>webview</code> with the provided <code>action</code>.</p>\n<h3 id=\"webviewprintoptions\"><a href=\"#webviewprintoptions\"><code>&#x3C;webview>.print([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (可选)<ul>\n<li><code>silent</code> Boolean (optional) - Don't ask user for print settings. 默认值为 <code>false</code>.</li>\n<li><code>printBackground</code> Boolean (optional) - Prints the background color and image of the web page. 默认值为 <code>false</code>.</li>\n<li><code>deviceName</code> String (optional) - Set the printer device name to use. Must be the system-defined name and not the 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.</li>\n<li><code>color</code> Boolean (optional) - Set whether the printed web page will be in color or grayscale. 默认值为 <code>true</code>。</li>\n<li><code>margins</code> Object (可选)<ul>\n<li><code>marginType</code> String (optional) - Can be <code>default</code>, <code>none</code>, <code>printableArea</code>, or <code>custom</code>. If <code>custom</code> is chosen, you will also need to specify <code>top</code>, <code>bottom</code>, <code>left</code>, and <code>right</code>.</li>\n<li><code>top</code> Number (optional) - The top margin of the printed web page, in pixels.</li>\n<li><code>bottom</code> Number (optional) - The bottom margin of the printed web page, in pixels.</li>\n<li><code>left</code> Number (optional) - The left margin of the printed web page, in pixels.</li>\n<li><code>right</code> Number (optional) - The right margin of the printed web page, in pixels.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - Whether the web page should be printed in landscape mode. 默认值为 <code>false</code>.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page.</li>\n<li><code>pagesPerSheet</code> Number (optional) - The number of pages to print per page sheet.</li>\n<li><code>collate</code> Boolean (optional) - Whether the web page should be collated.</li>\n<li><code>copies</code> Number (optional) - The number of copies of the web page to print.</li>\n<li><code>pageRanges</code> Object<a href=\"/docs/api/optional\"></a> - The page range to print.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>duplexMode</code> String (optional) - Set the duplex mode of the printed web page. 可以是 <code>simplex</code>、<code>shortEdge</code> 或 <code>longEdge</code>。</li>\n<li><code>dpi</code> Record&#x3C;string, number> (optional)<ul>\n<li><code>horizontal</code> Number (optional) - The horizontal dpi.</li>\n<li><code>vertical</code> Number (optional) - The vertical dpi.</li>\n</ul></li>\n<li><code>header</code> String (optional) - String to be printed as page header.</li>\n<li><code>footer</code> String (optional) - String to be printed as page footer.</li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the printed document. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code>.</li>\n</ul></li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code></p>\n<p>Prints <code>webview</code>'s web page. 与 <code>webContents.print([options])</code> 相同.</p>\n<h3 id=\"webviewprinttopdfoptions\"><a href=\"#webviewprinttopdfoptions\"><code>&#x3C;webview>.printToPDF(options)</code></a></h3>\n<ul>\n<li><code>选项</code> 对象<ul>\n<li><code>headerFooter</code> Record&#x3C;string, string> (optional) - the header and footer for the PDF.<ul>\n<li><code>title</code> String - The title for the PDF header.</li>\n<li><code>url</code> String - the url for the PDF footer.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - <code>true</code> for landscape, <code>false</code> for portrait.</li>\n<li><code>marginsType</code> Integer (optional) - Specifies the type of margins to use. Uses 0 for default margin, 1 for no margin, and 2 for minimum margin. and <code>width</code> in microns.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page. Can range from 0 to 100.</li>\n<li><code>pageRanges</code> Record&#x3C;string, number> (optional) - The page range to print. 在macOS上，只有数组的第一个值被信任。<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the generated PDF. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code></li>\n<li><code>printBackground</code> Boolean (optional) - Whether to print CSS backgrounds.</li>\n<li><code>printSelectionOnly</code> Boolean (optional) - Whether to print selection only.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Uint8Array></code> - Resolves with the generated PDF data.</p>\n<p>Prints <code>webview</code>'s web page as PDF, Same as <code>webContents.printToPDF(options)</code>.</p>\n<h3 id=\"webviewcapturepagerect\"><a href=\"#webviewcapturepagerect\"><code>&#x3C;webview>.capturePage([rect])</code></a></h3>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (optional) - The area of the page to be captured.</li>\n</ul>\n<p>返回 <code>Promise&#x3C;NativeImage></code> - 完成后返回一个<a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>在 <code>rect</code>内捕获页面的快照。 省略 <code>rect</code> 将捕获整个可见页面。</p>\n<h3 id=\"webviewsendchannel-args\"><a href=\"#webviewsendchannel-args\"><code>&#x3C;webview>.send(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code></p>\n<p>通过<code>channel</code>向渲染器进程发送异步消息，可以发送任意参数。 The renderer process can handle the message by listening to the <code>channel</code> event with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>示例请进传送门： <a href=\"/docs/api/web-contents#contentssendchannel-args\">webContents.send</a></p>\n<h3 id=\"webviewsendtoframeframeid-channel-args\"><a href=\"#webviewsendtoframeframeid-channel-args\"><code>&#x3C;webview>.sendToFrame(frameId, channel, ...args)</code></a></h3>\n<ul>\n<li><code>frameId</code> [number, number] - <code>[processId, frameId]</code></li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code></p>\n<p>通过<code>channel</code>向渲染器进程发送异步消息，可以发送任意参数。 The renderer process can handle the message by listening to the <code>channel</code> event with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>See <a href=\"/docs/api/web-contents#contentssendtoframeframeid-channel-args\">webContents.sendToFrame</a> for examples.</p>\n<h3 id=\"webviewsendinputeventevent\"><a href=\"#webviewsendinputeventevent\"><code>&#x3C;webview>.sendInputEvent(event)</code></a></h3>\n<ul>\n<li><code>event</code>  <a href=\"/docs/api/structures/mouse-input-event\">MouseInputEvent</a> | <a href=\"/docs/api/structures/mouse-wheel-input-event\">MouseWheelInputEvent</a> | <a href=\"/docs/api/structures/keyboard-input-event\">KeyboardInputEvent</a></li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code></p>\n<p>Sends an input <code>event</code> to the page.</p>\n<p>See <a href=\"/docs/api/web-contents#contentssendinputeventinputevent\">webContents.sendInputEvent</a> for detailed description of <code>event</code> object.</p>\n<h3 id=\"webviewsetzoomfactorfactor\"><a href=\"#webviewsetzoomfactorfactor\"><code>&#x3C;webview>.setZoomFactor(factor)</code></a></h3>\n<ul>\n<li><code>factor</code> Number - 缩放比例</li>\n</ul>\n<p>Changes the zoom factor to the specified factor. Zoom factor is zoom percent divided by 100, so 300% = 3.0.</p>\n<h3 id=\"webviewsetzoomlevellevel\"><a href=\"#webviewsetzoomlevellevel\"><code>&#x3C;webview>.setZoomLevel(level)</code></a></h3>\n<ul>\n<li><code>level</code> Number - 缩放等级。</li>\n</ul>\n<p>更改缩放等级。 The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. The formula for this is <code>scale := 1.2 ^ level</code>.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h3 id=\"webviewgetzoomfactor\"><a href=\"#webviewgetzoomfactor\"><code>&#x3C;webview>.getZoomFactor()</code></a></h3>\n<p>Returns <code>Number</code> - the current zoom factor.</p>\n<h3 id=\"webviewgetzoomlevel\"><a href=\"#webviewgetzoomlevel\"><code>&#x3C;webview>.getZoomLevel()</code></a></h3>\n<p>Returns <code>Number</code> - the current zoom level.</p>\n<h3 id=\"webviewsetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#webviewsetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>&#x3C;webview>.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h3>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>返回 <code>Promise&#x3C;void></code></p>\n<p>设置最大和最小缩放级别。</p>\n<h3 id=\"webviewshowdefinitionforselection-macos\"><a href=\"#webviewshowdefinitionforselection-macos\"><code>&#x3C;webview>.showDefinitionForSelection()</code> <em>macOS</em></a></h3>\n<p>Shows pop-up dictionary that searches the selected word on the page.</p>\n<h3 id=\"webviewgetwebcontentsid\"><a href=\"#webviewgetwebcontentsid\"><code>&#x3C;webview>.getWebContentsId()</code></a></h3>\n<p>Returns <code>Number</code> - The WebContents ID of this <code>webview</code>.</p>\n<h2 id=\"dom-events\"><a href=\"#dom-events\">DOM Events</a></h2>\n<p><code>webview</code> 标签具有以下有效的 DOM 事件：</p>\n<h3 id=\"event-load-commit\"><a href=\"#event-load-commit\">Event: 'load-commit'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Fired when a load has committed. This includes navigation within the current document as well as subframe document-level loads, but does not include asynchronous resource loads.</p>\n<h3 id=\"event-did-finish-load\"><a href=\"#event-did-finish-load\">Event: 'did-finish-load'</a></h3>\n<p>导航完成时触发，即选项卡的旋转器将停止旋转，并指派<code>onload</code>事件后。（译者：网页加载的过程中，并不是所有的浏览器都是转圈圈，而且浏览器版本不同，加载效果也有可能不一样。其中 ie 和 chrome 是转圈圈，safari 是进度条，firefox是一个小点左右来回移动--20180103）</p>\n<h3 id=\"event-did-fail-load\"><a href=\"#event-did-fail-load\">Event: 'did-fail-load'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>这个事件类似于 <code>did-finish-load</code>, 不过是在加载失败或取消后触发，例如调用了 <code>window.stop()</code></p>\n<h3 id=\"event-did-frame-finish-load\"><a href=\"#event-did-frame-finish-load\">Event: 'did-frame-finish-load'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Fired when a frame has done navigation.</p>\n<h3 id=\"event-did-start-loading\"><a href=\"#event-did-start-loading\">Event: 'did-start-loading'</a></h3>\n<p>Corresponds to the points in time when the spinner of the tab starts spinning.</p>\n<h3 id=\"event-did-stop-loading\"><a href=\"#event-did-stop-loading\">Event: 'did-stop-loading'</a></h3>\n<p>Corresponds to the points in time when the spinner of the tab stops spinning.</p>\n<h3 id=\"event-did-attach\"><a href=\"#event-did-attach\">Event: 'did-attach'</a></h3>\n<p>Fired when attached to the embedder web contents.</p>\n<h3 id=\"事件-dom-ready\"><a href=\"#事件-dom-ready\">事件: 'dom-ready'</a></h3>\n<p>Fired when document in the given frame is loaded.</p>\n<h3 id=\"事件：-page-title-updated\"><a href=\"#事件：-page-title-updated\">事件： 'page-title-updated'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>Fired when page title is set during navigation. <code>explicitSet</code> is false when title is synthesized from file url.</p>\n<h3 id=\"事件-page-favicon-updated\"><a href=\"#事件-page-favicon-updated\">事件: 'page-favicon-updated'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>favicons</code> String[] - 由连接组成的数组。</li>\n</ul>\n<p>Fired when page receives favicon urls.</p>\n<h3 id=\"事件-enter-html-full-screen\"><a href=\"#事件-enter-html-full-screen\">事件: 'enter-html-full-screen'</a></h3>\n<p>Fired when page enters fullscreen triggered by HTML API.</p>\n<h3 id=\"事件-leave-html-full-screen\"><a href=\"#事件-leave-html-full-screen\">事件: 'leave-html-full-screen'</a></h3>\n<p>Fired when page leaves fullscreen triggered by HTML API.</p>\n<h3 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>level</code> Integer - The log level, from 0 to 3. 按顺序匹配 <code>verbose</code>, <code>info</code>, <code>warning</code> 和 <code>error</code>.</li>\n<li><code>message</code> String - 实际控制台消息</li>\n<li><code>line</code> Integer - The line number of the source that triggered this console message</li>\n<li><code>sourceId</code> String</li>\n</ul>\n<p>Fired when the guest window logs a console message.</p>\n<p>The following example code forwards all log messages to the embedder's console without regard for log level or other properties.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'console-message'</span>, (e) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Guest page logged a message:'</span>, e.message)\n})\n</code></pre>\n<h3 id=\"event-found-in-page\"><a href=\"#event-found-in-page\">Event: 'found-in-page'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>result</code> Object<ul>\n<li><code>requestId</code> Integer</li>\n<li><code>activeMatchOrdinal</code> Integer - 当前匹配位置。</li>\n<li><code>matches</code> Integer - 符合匹配条件的元素个数。</li>\n<li><code>selectionArea</code> Rectangle - Coordinates of first match region.</li>\n<li><code>finalUpdate</code> Boolean</li>\n</ul></li>\n</ul>\n<p>Fired when a result is available for <a href=\"#webviewfindinpagetext-options\"><code>webview.findInPage</code></a> request.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'found-in-page'</span>, (e) => {\n  webview.stopFindInPage(<span class=\"hljs-string\">'keepSelection'</span>)\n})\n\n<span class=\"hljs-keyword\">const</span> requestId = webview.findInPage(<span class=\"hljs-string\">'test'</span>)\n<span class=\"hljs-built_in\">console</span>.log(requestId)\n</code></pre>\n<h3 id=\"event-new-window\"><a href=\"#event-new-window\">Event: 'new-window'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String</li>\n<li><code>disposition</code> String - 可以被设置为 <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> 及 <code>other</code>.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - The options which should be used for creating the new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</li>\n</ul>\n<p>Fired when the guest page attempts to open a new browser window.</p>\n<p>The following example code opens the new url in system's default browser.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\n\nwebview.addEventListener(<span class=\"hljs-string\">'new-window'</span>, <span class=\"hljs-keyword\">async</span> (e) => {\n  <span class=\"hljs-keyword\">const</span> protocol = (<span class=\"hljs-keyword\">new</span> URL(e.url)).protocol\n  <span class=\"hljs-keyword\">if</span> (protocol === <span class=\"hljs-string\">'http:'</span> || protocol === <span class=\"hljs-string\">'https:'</span>) {\n    <span class=\"hljs-keyword\">await</span> shell.openExternal(e.url)\n  }\n})\n</code></pre>\n<h3 id=\"event-will-navigate\"><a href=\"#event-will-navigate\">Event: 'will-navigate'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when a user or the page wants to start navigation. It can happen when the <code>window.location</code> object is changed or a user clicks a link in the page.</p>\n<p>This event will not emit when the navigation is started programmatically with APIs like <code>&#x3C;webview>.loadURL</code> and <code>&#x3C;webview>.back</code>.</p>\n<p>It is also not emitted during in-page navigation, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<p>Calling <code>event.preventDefault()</code> does <strong>NOT</strong> have any effect.</p>\n<h3 id=\"event-did-start-navigation\"><a href=\"#event-did-start-navigation\">Event: 'did-start-navigation'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame (including main) starts navigating. <code>isInPlace</code> will be <code>true</code> for in-page navigations.</p>\n<h3 id=\"event-did-redirect-navigation\"><a href=\"#event-did-redirect-navigation\">Event: 'did-redirect-navigation'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted after a server side redirect occurs during navigation. For example a 302 redirect.</p>\n<h3 id=\"event-did-navigate\"><a href=\"#event-did-navigate\">Event: 'did-navigate'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when a navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h3 id=\"event-did-frame-navigate\"><a href=\"#event-did-frame-navigate\">Event: 'did-frame-navigate'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - empty for non HTTP navigations,</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h3 id=\"event-did-navigate-in-page\"><a href=\"#event-did-navigate-in-page\">Event: 'did-navigate-in-page'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>url</code> String</li>\n</ul>\n<p>当发生页内导航时，触发该事件。</p>\n<p>当发生页内导航时，虽然页面地址发生变化，但它并没有导航到其它页面。 例如，点击锚点链接，或者DOM的 <code>hashchange</code>事件被触发时，都会触发该事件。</p>\n<h3 id=\"事件：-close\"><a href=\"#事件：-close\">事件： 'close'</a></h3>\n<p>Fired when the guest page attempts to close itself.</p>\n<p>The following example code navigates the <code>webview</code> to <code>about:blank</code> when the guest attempts to close itself.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'close'</span>, () => {\n  webview.src = <span class=\"hljs-string\">'about:blank'</span>\n})\n</code></pre>\n<h3 id=\"event-ipc-message\"><a href=\"#event-ipc-message\">Event: 'ipc-message'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>frameId</code> [number, number] - pair of <code>[processId, frameId]</code>.</li>\n<li><code>channel</code> String</li>\n<li><code>args</code> any[]</li>\n</ul>\n<p>Fired when the guest page has sent an asynchronous message to embedder page.</p>\n<p>With <code>sendToHost</code> method and <code>ipc-message</code> event you can communicate between guest page and embedder page:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In embedder page.</span>\n<span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'ipc-message'</span>, (event) => {\n  <span class=\"hljs-built_in\">console</span>.log(event.channel)\n  <span class=\"hljs-comment\">// Prints \"pong\"</span>\n})\nwebview.send(<span class=\"hljs-string\">'ping'</span>)\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In guest page.</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcRenderer.on(<span class=\"hljs-string\">'ping'</span>, () => {\n  ipcRenderer.sendToHost(<span class=\"hljs-string\">'pong'</span>)\n})\n</code></pre>\n<h3 id=\"event-crashed\"><a href=\"#event-crashed\">Event: 'crashed'</a></h3>\n<p>Fired when the renderer process is crashed.</p>\n<h3 id=\"event-plugin-crashed\"><a href=\"#event-plugin-crashed\">Event: 'plugin-crashed'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>\n<p>Fired when a plugin process is crashed.</p>\n<h3 id=\"event-destroyed\"><a href=\"#event-destroyed\">Event: 'destroyed'</a></h3>\n<p>Fired when the WebContents is destroyed.</p>\n<h3 id=\"event-media-started-playing\"><a href=\"#event-media-started-playing\">Event: 'media-started-playing'</a></h3>\n<p>多媒体开始播放时，触发该事件。</p>\n<h3 id=\"event-media-paused\"><a href=\"#event-media-paused\">Event: 'media-paused'</a></h3>\n<p>当媒体文件暂停或播放完成的时候触发</p>\n<h3 id=\"event-did-change-theme-color\"><a href=\"#event-did-change-theme-color\">Event: 'did-change-theme-color'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>themeColor</code> String</li>\n</ul>\n<p>Emitted when a page's theme color changes. This is usually due to encountering a meta tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">'theme-color'</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">'#ff0000'</span>></span>\n</code></pre>\n<h3 id=\"event-update-target-url\"><a href=\"#event-update-target-url\">Event: 'update-target-url'</a></h3>\n<p>返回:</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>当鼠标滑到，或者键盘切换到a连接时，触发该事件。</p>\n<h3 id=\"event-devtools-opened\"><a href=\"#event-devtools-opened\">Event: 'devtools-opened'</a></h3>\n<p>当开发者工具被打开时，触发该事件。</p>\n<h3 id=\"event-devtools-closed\"><a href=\"#event-devtools-closed\">Event: 'devtools-closed'</a></h3>\n<p>当开发者工具被关闭时，触发该事件。</p>\n<h3 id=\"event-devtools-focused\"><a href=\"#event-devtools-focused\">Event: 'devtools-focused'</a></h3>\n<p>当开发者工具被选中/打开时，触发该事件。</p>",
      "title": "<webview>标签",
      "description": "在一个独立的 frame 和进程里显示外部 web 内容。"
    },
    "/docs/api/window-open": {
      "locale": "zh-CN",
      "slug": "window-open",
      "href": "/docs/api/window-open",
      "crowdinFileId": "256409",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/window-open.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"从渲染进程打开窗口\"><a href=\"#从渲染进程打开窗口\">从渲染进程打开窗口</a></h1>\n<p>有几种方法可以控制从信任或在渲染器内创建窗口的方式。 可以通过两种方式从渲染进程创建窗口：</p>\n<ul>\n<li>如果属性中包含 <code>target=_blank</code>，单击链接或提交表格即可创建</li>\n<li>在 JavaScript 中调用 <code>window.open()</code></li>\n</ul>\n<p>For same-origin content, the new window is created within the same process, enabling the parent to access the child window directly. This can be very useful for app sub-windows that act as preference panels, or similar, as the parent can render to the sub-window directly, as if it were a <code>div</code> in the parent. This is the same behavior as in the browser.</p>\n<p>When <code>nativeWindowOpen</code> is set to false, <code>window.open</code> instead results in the creation of a <a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code></a>, a light wrapper around <code>BrowserWindow</code>.</p>\n<p>Electron pairs this native Chrome <code>Window</code> with a BrowserWindow under the hood. You can take advantage of all the customization available when creating a BrowserWindow in the main process by using <code>webContents.setWindowOpenHandler()</code> for renderer-created windows.</p>\n<p>BrowserWindow constructor options are set by, in increasing precedence order: parsed options from the <code>features</code> string from <code>window.open()</code>, security-related webPreferences inherited from the parent, and options given by <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>. Note that <code>webContents.setWindowOpenHandler</code> has final say and full privilege because it is invoked in the main process.</p>\n<h3 id=\"windowopenurl-framename-features\"><a href=\"#windowopenurl-framename-features\"><code>window.open(url[, frameName][, features])</code></a></h3>\n<ul>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String（可选）</li>\n<li><code>features</code> String（可选）</li>\n</ul>\n<p>Returns <a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code></a> | <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window\"><code>Window</code></a></p>\n<p><code>features</code> is a comma-separated key-value list, following the standard format of the browser. Electron will parse <code>BrowserWindowConstructorOptions</code> out of this list where possible, for convenience. For full control and better ergonomics, consider using <code>webContents.setWindowOpenHandler</code> to customize the BrowserWindow creation.</p>\n<p>A subset of <code>WebPreferences</code> can be set directly, unnested, from the features string: <code>zoomFactor</code>, <code>nodeIntegration</code>, <code>preload</code>, <code>javascript</code>, <code>contextIsolation</code>, and <code>webviewTag</code>.</p>\n<p>例如：</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">'https://github.com'</span>, <span class=\"hljs-string\">'_blank'</span>, <span class=\"hljs-string\">'top=500,left=200,frame=false,nodeIntegration=no'</span>)\n</code></pre>\n<p><strong>说明：</strong></p>\n<ul>\n<li>如果在父窗口中禁用了 Node integration, 则在打开的 <code>window </code> 中将始终被禁用。</li>\n<li>如果在父窗口中启用了上下文隔离, 则在打开的 <code>window</code> 中将始终被启用。</li>\n<li>父窗口禁用 Javascript，打开的 <code>window</code> 中将被始终禁用</li>\n<li>Non-standard features (that are not handled by Chromium or Electron) given in <code>features</code> will be passed to any registered <code>webContents</code>'s <code>did-create-window</code> event handler in the <code>options</code> argument.</li>\n<li><code>frameName</code> follows the specification of <code>windowName</code> located in the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters\">native documentation</a>.</li>\n</ul>\n<p>To customize or cancel the creation of the window, you can optionally set an override handler with <code>webContents.setWindowOpenHandler()</code> from the main process. Returning <code>{ action: 'deny' }</code> cancels the window. Returning <code>{ action: 'allow', overrideBrowserWindowOptions: { ... } }</code> will allow opening the window and setting the <code>BrowserWindowConstructorOptions</code> to be used when creating the window. Note that this is more powerful than passing options through the feature string, as the renderer has more limited privileges in deciding security preferences than the main process.</p>\n<h3 id=\"native-window-example\"><a href=\"#native-window-example\">Native <code>Window</code> example</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// main.js</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-comment\">// In this example, only windows with the `about:blank` url will be created.</span>\n<span class=\"hljs-comment\">// All other urls will be blocked.</span>\nmainWindow.webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (url === <span class=\"hljs-string\">'about:blank'</span>) {\n    <span class=\"hljs-keyword\">return</span> {\n      <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span>,\n      <span class=\"hljs-attr\">overrideBrowserWindowOptions</span>: {\n        <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span>,\n        <span class=\"hljs-attr\">fullscreenable</span>: <span class=\"hljs-literal\">false</span>,\n        <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'black'</span>,\n        <span class=\"hljs-attr\">webPreferences</span>: {\n          <span class=\"hljs-attr\">preload</span>: <span class=\"hljs-string\">'my-child-window-preload-script.js'</span>\n        }\n      }\n    }\n  }\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// renderer process (mainWindow)</span>\n<span class=\"hljs-keyword\">const</span> childWindow = <span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">''</span>, <span class=\"hljs-string\">'modal'</span>)\nchildWindow.document.write(<span class=\"hljs-string\">'&#x3C;h1>Hello&#x3C;/h1>'</span>)\n</code></pre>\n<h3 id=\"browserwindowproxy-example\"><a href=\"#browserwindowproxy-example\"><code>BrowserWindowProxy</code> example</a></h3>\n<pre><code class=\"hljs language-javascript\">\n<span class=\"hljs-comment\">// main.js</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nativeWindowOpen</span>: <span class=\"hljs-literal\">false</span> }\n})\n\nmainWindow.webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (url.startsWith(<span class=\"hljs-string\">'https://github.com/'</span>)) {\n    <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span> }\n  }\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n\nmainWindow.webContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (childWindow) => {\n  <span class=\"hljs-comment\">// For example...</span>\n  childWindow.webContents.on(<span class=\"hljs-string\">'will-navigate'</span>, (e) => {\n    e.preventDefault()\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// renderer.js</span>\n<span class=\"hljs-keyword\">const</span> windowProxy = <span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">'https://github.com/'</span>, <span class=\"hljs-literal\">null</span>, <span class=\"hljs-string\">'minimizable=false'</span>)\nwindowProxy.postMessage(<span class=\"hljs-string\">'hi'</span>, <span class=\"hljs-string\">'*'</span>)\n</code></pre>",
      "title": "从渲染进程打开窗口",
      "description": ""
    },
    "/docs/tutorial/windows-arm": {
      "locale": "zh-CN",
      "slug": "windows-arm",
      "href": "/docs/tutorial/windows-arm",
      "crowdinFileId": "256271",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-arm.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"windows-on-arm\"><a href=\"#windows-on-arm\">Windows on ARM</a></h1>\n<p>如果您的应用使用Electron 6.0.8及之后的版本，您现在可以在基于ARM的Windows10上构建它。 This considerably improves performance, but requires recompilation of any native modules used in your app. It may also require small fixups to your build and packaging scripts.</p>\n<h2 id=\"running-a-basic-app\"><a href=\"#running-a-basic-app\">Running a basic app</a></h2>\n<p>If your app doesn't use any native modules, then it's really easy to create an Arm version of your app.</p>\n<ol>\n<li>Make sure that your app's <code>node_modules</code> directory is empty.</li>\n<li>Using a <em>Command Prompt</em>, run <code>set npm_config_arch=arm64</code> before running <code>npm install</code>/<code>yarn install</code> as usual.</li>\n<li><a href=\"/docs/tutorial/quick-start#prerequisites\">If you have Electron installed as a development dependency</a>, npm will download and unpack the arm64 version. You can then package and distribute your app as normal.</li>\n</ol>\n<h2 id=\"general-considerations\"><a href=\"#general-considerations\">General considerations</a></h2>\n<h3 id=\"architecture-specific-code\"><a href=\"#architecture-specific-code\">Architecture-specific code</a></h3>\n<p>Lots of Windows-specific code contains if... else logic that selects between either the x64 or x86 architectures.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">if</span> (process.arch === <span class=\"hljs-string\">'x64'</span>) {\n  <span class=\"hljs-comment\">// Do 64-bit thing...</span>\n} <span class=\"hljs-keyword\">else</span> {\n  <span class=\"hljs-comment\">// Do 32-bit thing...</span>\n}\n</code></pre>\n<p>If you want to target arm64, logic like this will typically select the wrong architecture, so carefully check your application and build scripts for conditions like this. In custom build and packaging scripts, you should always check the value of <code>npm_config_arch</code> in the environment, rather than relying on the current process arch.</p>\n<h3 id=\"native-modules\"><a href=\"#native-modules\">Native modules</a></h3>\n<p>If you use native modules, you must make sure that they compile against v142 of the MSVC compiler (provided in Visual Studio 2017). 您还必须检查 native module 提供或引用的 <code>.dll</code> 或 <code>.lib</code> 文件是否可用于 Arm 上的 Windows。</p>\n<h3 id=\"测试应用程序\"><a href=\"#测试应用程序\">测试应用程序</a></h3>\n<p>To test your app, use a Windows on Arm device running Windows 10 (version 1903 or later). Make sure that you copy your application over to the target device - Chromium's sandbox will not work correctly when loading your application assets from a network location.</p>\n<h2 id=\"development-prerequisites\"><a href=\"#development-prerequisites\">Development prerequisites</a></h2>\n<h3 id=\"nodejsnode-gyp\"><a href=\"#nodejsnode-gyp\">Node.js/node-gyp</a></h3>\n<p><a href=\"https://nodejs.org/en/\">Node.js v12.9.0 or later is recommended.</a> If updating to a new version of Node is  undesirable, you can instead <a href=\"https://github.com/nodejs/node-gyp/wiki/Updating-npm&#x27;s-bundled-node-gyp\">update npm's copy of node-gyp manually</a> to version 5.0.2 or later, which contains the required changes to compile native modules for Arm.</p>\n<h3 id=\"visual-studio-2017\"><a href=\"#visual-studio-2017\">Visual Studio 2017</a></h3>\n<p>Visual Studio 2017 (any edition) is required for cross-compiling native modules. You can download Visual Studio Community 2017 via Microsoft's <a href=\"https://visualstudio.microsoft.com/dev-essentials/\">Visual Studio Dev Essentials program</a>. After installation, you can add the Arm-specific components by running the following from a <em>Command Prompt</em>:</p>\n<pre><code class=\"hljs language-powershell\">vs_installer.exe ^\n--add Microsoft.VisualStudio.Workload.NativeDesktop ^\n--add Microsoft.VisualStudio.Component.VC.ATLMFC ^\n--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ^\n--add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ^\n--includeRecommended\n</code></pre>\n<h4 id=\"creating-a-cross-compilation-command-prompt\"><a href=\"#creating-a-cross-compilation-command-prompt\">Creating a cross-compilation command prompt</a></h4>\n<p>Setting <code>npm_config_arch=arm64</code> in the environment creates the correct arm64 <code>.obj</code> files, but the standard <em>Developer Command Prompt for VS 2017</em> will use the x64 linker. To fix this:</p>\n<ol>\n<li>Duplicate the <em>x64_x86 Cross Tools Command Prompt for VS 2017</em> shortcut (e.g. by locating it in the start menu, right clicking, selecting <em>Open File Location</em>, copying and pasting) to somewhere convenient.</li>\n<li>Right click the new shortcut and choose <em>Properties</em>.</li>\n<li>Change the <em>Target</em> field to read <code>vcvarsamd64_arm64.bat</code> at the end instead of <code>vcvarsamd64_x86.bat</code>.</li>\n</ol>\n<p>If done successfully, the command prompt should print something similar to this on startup:</p>\n<pre><code class=\"hljs language-bat\">**********************************************************************\n** Visual Studio <span class=\"hljs-number\">2017</span> Developer Command Prompt v15.<span class=\"hljs-number\">9</span>.<span class=\"hljs-number\">15</span>\n** Copyright (c) <span class=\"hljs-number\">2017</span> Microsoft Corporation\n**********************************************************************\n[vcvarsall.bat] Environment initialized <span class=\"hljs-keyword\">for</span>: 'x64_arm64'\n</code></pre>\n<p>If you want to develop your application directly on a Windows on Arm device, substitute <code>vcvarsx86_arm64.bat</code> in <em>Target</em> so that cross-compilation can happen with the device's x86 emulation.</p>\n<h3 id=\"linking-against-the-correct-nodelib\"><a href=\"#linking-against-the-correct-nodelib\">Linking against the correct <code>node.lib</code></a></h3>\n<p>By default, <code>node-gyp</code> unpacks Electron's node headers and downloads the x86 and x64 versions of <code>node.lib</code> into <code>%APPDATA%\\..\\Local\\node-gyp\\Cache</code>, but it does not download the arm64 version (<a href=\"https://github.com/nodejs/node-gyp/pull/1875\">a fix for this is in development</a>.) To fix this:</p>\n<ol>\n<li>Download the arm64 <code>node.lib</code> from <a href=\"https://electronjs.org/headers/v6.0.9/win-arm64/node.lib\">https://electronjs.org/headers/v6.0.9/win-arm64/node.lib</a></li>\n<li>Move it to <code>%APPDATA%\\..\\Local\\node-gyp\\Cache\\6.0.9\\arm64\\node.lib</code></li>\n</ol>\n<p>Substitute <code>6.0.9</code> for the version you're using.</p>\n<h2 id=\"cross-compiling-native-modules\"><a href=\"#cross-compiling-native-modules\">Cross-compiling native modules</a></h2>\n<p>After completing all of the above, open your cross-compilation command prompt and run <code>set npm_config_arch=arm64</code>. Then use <code>npm install</code> to build your project as normal. As with cross-compiling x86 modules, you may need to remove <code>node_modules</code> to force recompilation of native modules if they were previously compiled for another architecture.</p>\n<h2 id=\"debugging-native-modules\"><a href=\"#debugging-native-modules\">Debugging native modules</a></h2>\n<p>Debugging native modules can be done with Visual Studio 2017 (running on your development machine) and corresponding <a href=\"https://docs.microsoft.com/en-us/visualstudio/debugger/remote-debugging-cpp?view=vs-2019\">Visual Studio Remote Debugger</a> running on the target device. To debug:</p>\n<ol>\n<li>在目标设备上通过<em>命令提示符</em>启动 <code>.exe</code> 应用(传递 <code>--inspect-brk</code> 参数可以在加载任何 native modules 之前暂停应用)。</li>\n<li>Launch Visual Studio 2017 on your development machine.</li>\n<li>通过选择 <em>调试 > </em> 访问并输入设备的 IP 地址和 Visual Studio 远程调试器工具显示的端口号，连接到目标设备。</li>\n<li>Click <em>Refresh</em> and select the <a href=\"/docs/development/debug-instructions-windows\">appropriate Electron process to attach</a>.</li>\n<li>You may need to make sure that any symbols for native modules in your app are loaded correctly. 要配置此内容，请进入 Visual Studio 2017<em>Debug > Options...</em>，and add the folders containing your <code>.pdb</code> symbols under <em>Debugging > Symbols</em>.</li>\n<li>Once attached, set any appropriate breakpoints and resume JavaScript execution using Chrome's <a href=\"/docs/tutorial/debugging-main-process\">remote tools for Node</a>.</li>\n</ol>\n<h2 id=\"getting-additional-help\"><a href=\"#getting-additional-help\">Getting additional help</a></h2>\n<p>If you encounter a problem with this documentation, or if your app works when compiled for x86 but not for arm64, please <a href=\"/docs/development/issues\">file an issue</a> with \"Windows on Arm\" in the title.</p>",
      "title": "Windows on ARM",
      "description": ""
    },
    "/docs/tutorial/windows-store-guide": {
      "locale": "zh-CN",
      "slug": "windows-store-guide",
      "href": "/docs/tutorial/windows-store-guide",
      "crowdinFileId": "256273",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-store-guide.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"windows-商店指南\"><a href=\"#windows-商店指南\">Windows 商店指南</a></h1>\n<p>在 Windows 10 中，一些不错的旧 win32 程序迎来了一个新朋友：通用 Windows 平台。 新的 <code>.appx</code> 格式不仅启用了许多新的强大的 API，如 Cortana 或推送通知，而且通过 Windows 应用商店，也同时简化了安装和更新。</p>\n<p>Microsoft <a href=\"https://github.com/catalystcode/electron-windows-store\">开发了一个工具，将 Electron 应用程序编译为 <code>.appx</code> 软件包</a>，使开发人员能够使用新应用程序模型中的一些好东西。 本指南解释了如何使用它 - 以及 Electron AppX 包的功能和限制。</p>\n<h2 id=\"背景和要求\"><a href=\"#背景和要求\">背景和要求</a></h2>\n<p>Windows 10 的 \"周年更新\" 能够运行 win32 <code>.exe</code> 程序并且它们的虚拟化文件系统和注册表跟随一起启动。 两者都是通过在 Windows 容器中运行应用程序和安装器编译后创建的，允许 Windows 在安装过程中正确识别操作系统进行了哪些修改。 将可执行文件和虚拟文件系统与虚拟注册表配对, 允许 Windows 启用一键安装和卸载。</p>\n<p>此外，exe 在 appx 模型内启动 - 这意味着它可以使用通用 Windows 平台可用的许多 API。 为了获得更多的功能，Electron 应用程序可以与一个看不见的 UWP 后台任务配合使用，它与 <code>exe</code> 一起启动，作为后台运行任务的接收器，接收推送通知或与其他 UWP 应用程序通信 。</p>\n<p>要编译任何现有的 Electron 应用程序，请确保满足以下要求:</p>\n<ul>\n<li>Windows 10及周年更新 (2016年8月2日发布的)</li>\n<li>Windows 10 SDK, <a href=\"https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk\">这里下载</a></li>\n<li>最新的 Node 4 (运行 <code>node -v</code> 来确认)</li>\n</ul>\n<p>然后, 安装 <code>electron-windows-store</code> CLI:</p>\n<pre><code class=\"hljs language-sh\">npm install -g electron-windows-store\n</code></pre>\n<h2 id=\"步骤-1-打包你的-electron-应用程序\"><a href=\"#步骤-1-打包你的-electron-应用程序\">步骤 1: 打包你的 Electron 应用程序</a></h2>\n<p>打包应用程序使用 <a href=\"https://github.com/electron/electron-packager\">electron-packager</a> (或类似工具). 确保在最终的应用程序中删除不需要的 <code>node_modules</code>, 因为这些你不需要模块只会额外增加你的应用程序的大小.</p>\n<p>结构输出应该看起来大致像这样:</p>\n<pre><code class=\"hljs language-plaintext\">├── Ghost.exe\n├── LICENSE\n├── content_resources_200_percent.pak\n├── content_shell.pak\n├── d3dcompiler_47.dll\n├── ffmpeg.dll\n├── icudtl.dat\n├── libEGL.dll\n├── libGLESv2.dll\n├── locales\n│   ├── am.pak\n│   ├── ar.pak\n│   ├── [...]\n├── node.dll\n├── resources\n│   └── app.asar\n├── v8_context_snapshot.bin\n├── squirrel.exe\n└── ui_resources_200_percent.pak\n</code></pre>\n<h2 id=\"步骤-2-运行-electron-windows-store\"><a href=\"#步骤-2-运行-electron-windows-store\">步骤 2: 运行 electron-windows-store</a></h2>\n<p>从提权的 PowerShell(用管理员身份运行它) 中, 以所需的参数运行 <code>electron-windows-store</code>，传递输入和输出目录，应用程序的名称和版本，以及确认 <code>node_modules</code> 应该是扁平的。</p>\n<pre><code class=\"hljs language-powershell\">electron-windows-store `\n    --input-directory C:\\myelectronapp `\n    --output-directory C:\\output\\myelectronapp `\n    --package-version <span class=\"hljs-number\">1.0</span>.<span class=\"hljs-number\">0.0</span> `\n    --package-name myelectronapp\n</code></pre>\n<p>一旦执行，工具就开始工作：它接受您的 Electron 应用程序作为输入，展平 <code>node_modules</code>。 然后，它将应用程序归档为 <code>app.zip</code>。 使用安装程序和 Windows 容器，该工具创建一个“扩展的” AppX 包 - 包括 Windows 应用程序清单 (<code>AppXManifest.xml</code>)以及虚拟文件系统和输出文件夹中的虚拟注册表。</p>\n<p>当创建扩展的 AppX 文件后，该工具使用 Windows App Packager(<code>MakeAppx.exe</code>)将磁盘上的这些文件创建为单文件 AppX 包。 最后，该工具可用于在计算机上创建可信证书，以签署新的 AppX 包。 使用签名的 AppX 软件包，CLI也可以自动在您的计算机上安装软件包。</p>\n<h2 id=\"步骤-3-使用-appx-包\"><a href=\"#步骤-3-使用-appx-包\">步骤 3: 使用 AppX 包</a></h2>\n<p>为了运行您的软件包，您的用户将需要将 Windows 10 安装“周年纪念更新” - 有关如何更新Windows的详细信息可以在<a href=\"https://blogs.windows.com/windowsexperience/2016/08/02/how-to-get-the-windows-10-anniversary-update\">这里</a>找到</p>\n<p>与传统的UWP应用程序不同，打包应用程序目前需要进行手动验证过程，您可以在<a href=\"https://developer.microsoft.com/en-us/windows/projects/campaigns/desktop-bridge\">这里</a>申请. 在此期间，所有用户都能够通过双击安装包来安装您的程序，所以如果您只是寻找一个更简单的安装方法，可能不需要提交到商店。 在受管理的环境中(通常是企业), <code>Add-AppxPackage</code> <a href=\"https://technet.microsoft.com/en-us/library/hh856048.aspx\">PowerShell Cmdlet 可用于以自动方式安装它</a>。</p>\n<p>另一个重要的限制是编译的 AppX 包仍然包含一个 win32 可执行文件，因此不会在 Xbox，HoloLens 或 Phones 中运行。</p>\n<h2 id=\"可选-使用-backgroundtask-添加-uwp-功能\"><a href=\"#可选-使用-backgroundtask-添加-uwp-功能\">可选: 使用 BackgroundTask 添加 UWP 功能</a></h2>\n<p>您可以将 Electron 应用程序与不可见的 UWP 后台任务配对，以充分利用 Windows 10 功能，如推送通知，Cortana 集成或活动磁贴。</p>\n<p>如何使用 Electron 应用程序通过后台任务发送 Toast 通知和活动磁贴, 请<a href=\"https://github.com/felixrieseberg/electron-uwp-background\">查看微软提供的案例</a>.</p>\n<h2 id=\"可选-使用容器虚拟化进行转换\"><a href=\"#可选-使用容器虚拟化进行转换\">可选: 使用容器虚拟化进行转换</a></h2>\n<p>要生成 AppX 包，<code>electron-windows-store</code> CLI 使用的模板应该适用于大多数 Electron 应用程序。 但是，如果您使用自定义安装程序，或者您遇到生成的包的任何问题，您可以尝试使用 Windows 容器编译创建包 - 在该模式下，CLI 将在空 Windows 容器中安装和运行应用程序，以确定应用程序正在对操作系统进行哪些修改。</p>\n<p>在第一次运行 CLI 之前，您必须安装 “Windows Desktop App Converter” 。 这将需要几分钟，但不要担心 - 你只需要这样做一次。 从<a href=\"https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-run-desktop-app-converter\">这里</a>下载 Desktop App Converter 您将得到两个文件： <code>DesktopAppConverter.zip</code> 和 <code>BaseImage-14316.wim</code>.</p>\n<ol>\n<li>解压 <code>DesktopAppConverter.zip</code>. 打开提权的 PowerShell (用\"以管理员权限运行\"打开, 确保您的系统执行策略允许我们通过调用 <code>Set-ExecutionPolicy bypass</code> 来运行我们想要运行的一切).</li>\n<li>然后, 通过调用 <code>.\\DesktopAppConverter.ps1 -Setup -BaseImage .\\BaseImage-14316.wim</code>, 运行 Desktop App Converter 安装，并传递 Windows 基本映像的位置 (下载的 <code>BaseImage-14316.wim</code>).</li>\n<li>如果运行以上命令提示您重新启动，请重新启动计算机，并在成功重新启动后再次运行上述命令。</li>\n</ol>\n<p>当安装成功后，您可以继续编译你的 Electron 应用程序。</p>",
      "title": "Windows 商店指南",
      "description": ""
    },
    "/docs/tutorial/windows-taskbar": {
      "locale": "zh-CN",
      "slug": "windows-taskbar",
      "href": "/docs/tutorial/windows-taskbar",
      "crowdinFileId": "256275",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-taskbar.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"taskbar-customization-windows\"><a href=\"#taskbar-customization-windows\">Taskbar Customization (Windows)</a></h1>\n<h2 id=\"概览\"><a href=\"#概览\">概览</a></h2>\n<p>Electron有API来配置Windows任务栏中的应用程序图标。 此API 支持windows 专用的功能有： <a href=\"#jumplist\">创建 <code>JumpList</code></a>, <a href=\"#thumbnail-toolbars\">自定义缩略图和工具栏</a>, <a href=\"#icon-overlays-in-taskbar\">图标覆盖</a>, 和 <a href=\"#flash-frame\">\"Flash Frame\" 效果</a>, 和跨平台的功能 有：<a href=\"/docs/tutorial/recent-documents\">最近打开的文档</a> 和 <a href=\"/docs/tutorial/progress-bar\">应用程序进度</a>.</p>\n<h2 id=\"弹出列表\"><a href=\"#弹出列表\">弹出列表</a></h2>\n<p>Windows 允许应用程序自定义一个菜单栏，当用户右键单击任务栏中的应用图标及可显示该列表。 该上下文菜单被成为 <code>弹出列表</code>. You specify custom actions in the <code>Tasks</code> category of JumpList, as quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#tasks\">MSDN</a>:</p>\n<blockquote>\n<p>应用程序的“任务”列表的制定是基于程序的功能，用户能用它做一些快捷操作。 任务应当是与上下文无关的，因为它不需要程序运行就可以工作。 而且据统计，它们应该是用户在这个应用上使用最多的操作，例如: 撰写一封邮件或者在邮件程序里打开日历，word处理程序新建一个文档，以某一种模式启动应用程序，或者是启动应用程序的某些子命令。 一个应用程序不应当定义一些用户不需要的高级功能的或者只会使用一次的操作的菜单，以防止将菜单弄得杂乱无章，例如注册。 不要将“任务”功能用于广告操作，例如升级应用或者推广特价产品等等。</p>\n<p>强烈推荐“任务”列表内容是静态的。 不管什么情形，也不管应用程序是什么状态，它都应该是保持不变的。 尽管这个列表是动态可变的，你应该注意，那些没想过这个列表会变的用户会被这个行为搞糊涂。</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420539.png\" alt=\"IE\"></p>\n<blockquote>\n<p>注：上面的屏幕截图是 IE 浏览器的任务栏示例</p>\n</blockquote>\n<p>MacOS里的docker menu是菜单项，然而windows里的user tasks只是一个快捷方式。 举个栗子，当用户点击task的时候，程序将会执行特定的参数。</p>\n<p>你可以方便在你的application里用<a href=\"/docs/api/app#appsetusertaskstasks-windows\">app.setUserTasks</a> API 去设置user task。</p>\n<h4 id=\"示例\"><a href=\"#示例\">示例</a></h4>\n<h5 id=\"set-user-tasks\"><a href=\"#set-user-tasks\">Set user tasks</a></h5>\n<p>从 <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a> 中的应用开始，将以下内容更新到 <code>main.js</code>。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setUserTasks([\n  {\n    <span class=\"hljs-attr\">program</span>: process.execPath,\n    <span class=\"hljs-attr\">arguments</span>: <span class=\"hljs-string\">'--new-window'</span>,\n    <span class=\"hljs-attr\">iconPath</span>: process.execPath,\n    <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'New Window'</span>,\n    <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Create a new window'</span>\n  }\n])\n</code></pre>\n<h5 id=\"clear-tasks-list\"><a href=\"#clear-tasks-list\">Clear tasks list</a></h5>\n<p>To clear your tasks list, you need to call <code>app.setUserTasks</code> with an empty array in the <code>main.js</code> file.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setUserTasks([])\n</code></pre>\n<blockquote>\n<p>注意：即使你的应用关闭，用户任务仍然会被显示，因此在你的应用被卸载之前，任务的图标和程序的路径必须是存在的。</p>\n</blockquote>\n<h3 id=\"缩略图工具栏\"><a href=\"#缩略图工具栏\">缩略图工具栏</a></h3>\n<p>在 Windows，你可以在任务栏上添加一个按钮来当作应用的缩略图工具栏。 它为用户提供了一种访问特定窗口命令的方式, 而无需还原或激活该窗口。</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#thumbnail-toolbars\">MSDN</a>:</p>\n<blockquote>\n<p>此工具栏只是常见的标准工具栏控件。 它最多拥有七个按钮。 每个按钮的 ID、图像、工具提示和状态都定义在结构中, 然后传递给任务栏。 应用程序可以根据其当前状态的要求, 显示、启用、禁用或隐藏缩略图工具栏中的按钮。</p>\n<p>例如, Windows 媒体播放机可能提供标准的媒体传输控制, 如播放、暂停、静音和停止。</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420540.png\" alt=\"player\"></p>\n<blockquote>\n<p>注：上面的屏幕截图是 Windows 媒体播放器的缩略图工具栏示例</p>\n</blockquote>\n<p>To set thumbnail toolbar in your application, you need to use <a href=\"/docs/api/browser-window#winsetthumbarbuttonsbuttons-windows\">BrowserWindow.setThumbarButtons</a></p>\n<h4 id=\"示例-1\"><a href=\"#示例-1\">示例</a></h4>\n<h5 id=\"设置缩略图工具栏\"><a href=\"#设置缩略图工具栏\">设置缩略图工具栏</a></h5>\n<p>从 <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a> 中的应用开始，将以下内容更新到 <code>main.js</code>。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.setThumbarButtons([\n  {\n    <span class=\"hljs-attr\">tooltip</span>: <span class=\"hljs-string\">'button1'</span>,\n    <span class=\"hljs-attr\">icon</span>: path.join(__dirname, <span class=\"hljs-string\">'button1.png'</span>),\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'button1 clicked'</span>) }\n  }, {\n    <span class=\"hljs-attr\">tooltip</span>: <span class=\"hljs-string\">'button2'</span>,\n    <span class=\"hljs-attr\">icon</span>: path.join(__dirname, <span class=\"hljs-string\">'button2.png'</span>),\n    <span class=\"hljs-attr\">flags</span>: [<span class=\"hljs-string\">'enabled'</span>, <span class=\"hljs-string\">'dismissonclick'</span>],\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'button2 clicked.'</span>) }\n  }\n])\n</code></pre>\n<h5 id=\"clear-thumbnail-toolbar\"><a href=\"#clear-thumbnail-toolbar\">Clear thumbnail toolbar</a></h5>\n<p>要清除缩略图工具栏按钮，您需要在 <code>main.js</code> 文件调用 <code>BrowserWindow.setThumbaritons</code> 函数设置为空数组。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.setThumbarButtons([])\n</code></pre>\n<h3 id=\"任务栏中的图标叠加\"><a href=\"#任务栏中的图标叠加\">任务栏中的图标叠加</a></h3>\n<p>在 Windows，任务栏按钮可以使用小型叠加层显示应用程序状态。</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#icon-overlays\">MSDN</a>:</p>\n<blockquote>\n<p>图标叠加作为状态的上下文通知, 旨在否定需要一个单独的通知区域状态图标来将该信息传达给用户。 例如, 当前在通知区域中显示的 Microsoft Outlook 中的新邮件状态现在可以通过任务栏按钮上的叠加来表示。 同样, 您必须在开发周期中决定哪个方法最适合您的应用程序。 叠加图标用于提供重要的、长期的状态或通知, 如网络状态、messenger 状态或新邮件。 不应向用户显示不断变化的叠加或动画。</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420441.png\" alt=\"Overlay on taskbar button\"></p>\n<blockquote>\n<p>注：上面的屏幕截图是任务栏按钮叠加的示例</p>\n</blockquote>\n<p>To set the overlay icon for a window, you need to use the <a href=\"/docs/api/browser-window#winsetoverlayiconoverlay-description-windows\">BrowserWindow.setOverlayIcon</a> API.</p>\n<h4 id=\"示例-2\"><a href=\"#示例-2\">示例</a></h4>\n<p>从 <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a> 中的应用开始，将以下内容更新到 <code>main.js</code>。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.setOverlayIcon(<span class=\"hljs-string\">'path/to/overlay.png'</span>, <span class=\"hljs-string\">'Description for overlay'</span>)\n</code></pre>\n<h3 id=\"闪烁框\"><a href=\"#闪烁框\">闪烁框</a></h3>\n<p>在Windows上，你可以突出显示任务栏按钮以获得用户的关注。 这与在 macOS 上 dock 弹跳图标相似。</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-flashwindow#remarks\">MSDN</a>:</p>\n<blockquote>\n<p>通常, 会闪现一个窗口, 通知用户该窗口需要注意, 但是该窗口当前没有键盘焦点。</p>\n</blockquote>\n<p>To flash the BrowserWindow taskbar button, you need to use the <a href=\"/docs/api/browser-window#winflashframeflag\">BrowserWindow.flashFrame</a> API.</p>\n<h4 id=\"示例-3\"><a href=\"#示例-3\">示例</a></h4>\n<p>从 <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a> 中的应用开始，将以下内容更新到 <code>main.js</code>。</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.once(<span class=\"hljs-string\">'focus'</span>, () => win.flashFrame(<span class=\"hljs-literal\">false</span>))\nwin.flashFrame(<span class=\"hljs-literal\">true</span>)\n</code></pre>\n<blockquote>\n<p>注意：别忘了调用 <code>win.flashFramework(false)</code> 来关闭闪烁。 在上面的示例中, 当窗口进入焦点时会调用它, 但您可能会使用超时或其他一些事件来禁用它。</p>\n</blockquote>",
      "title": "Taskbar Customization (Windows)",
      "description": "应用程序的“任务”列表的制定是基于程序的功能，用户能用它做一些快捷操作。 任务应当是与上下文无关的，因为它不需要程序运行就可以工作。 而且据统计，它们应该是用户在这个应用上使用最多的操作，例如: 撰写一封邮件或者在邮件程序里打开日历，word处理程序新建一个文档，以某一种模式启动应用程序，或者是启动应用程序的某些子命令。 一个应用程序不应当定义一些用户不需要的高级功能的或者只会使用一次的操作的菜单，以防止将菜单弄得杂乱无章，例如注册。 不要将“任务”功能用于广告操作，例如升级应用或者推广特价产品等等。\n强烈推荐“任务”列表内容是静态的。 不管什么情形，也不管应用程序是什么状态，它都应该是保持不变的。 尽管这个列表是动态可变的，你应该注意，那些没想过这个列表会变的用户会被这个行为搞糊涂。"
    }
  },
  "fr-FR": {
    "/docs/api/accelerator": {
      "locale": "fr-FR",
      "slug": "accelerator",
      "href": "/docs/api/accelerator",
      "crowdinFileId": "256277",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/accelerator.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"accélération\"><a href=\"#accélération\">Accélération</a></h1>\n<blockquote>\n<p>Définit des raccourcis clavier.</p>\n</blockquote>\n<p>Les accélérations sont des chaînes de caractères pouvant contenir plusieurs modificateurs et touches, combinés avec le caractère <code>+</code>. Ils sont utilisés pour définir des raccourcis clavier dans votre application.</p>\n<p>Exemples:</p>\n<ul>\n<li><code>CommandOrControl+A</code></li>\n<li><code>CommandOrControl+Shift+Z</code></li>\n</ul>\n<p>Les raccourcis sont enregistrés avec le module <a href=\"/docs/api/global-shortcut\"><code>globalShortcut</code></a> en utilisant la méthode <a href=\"/docs/api/global-shortcut#globalshortcutregisteraccelerator-callback\"><code>register</code></a>, c.-à-d.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Register a 'CommandOrControl+Y' shortcut listener.</span>\n  globalShortcut.register(<span class=\"hljs-string\">'CommandOrControl+Y'</span>, () => {\n    <span class=\"hljs-comment\">// Lance le code ici quand les touches Y et Command/Control sont pressés en même temps.</span>\n  })\n})\n</code></pre>\n<h2 id=\"remarques\"><a href=\"#remarques\">Remarques</a></h2>\n<p>Sur Linux et Windows, la touche <code>Command</code> n'a aucun effet, donc utilisez <code>CommandOrControl</code> qui représente <code>Command</code> sur macOS et <code>Control</code> sur Linux et Windows pour définir certaines accélérations.</p>\n<p>Utilisez <code>Alt</code> au lieu de <code>Option</code>. Utilisez Alt au lieu de Option. La touche <code>Option</code> n’existe que sur macOS, tandis que la touche <code>Alt</code> est disponible sur toutes les plateformes.</p>\n<p>The <code>Super</code> (or <code>Meta</code>) key is mapped to the <code>Windows</code> key on Windows and Linux and <code>Cmd</code> on macOS.</p>\n<h2 id=\"modificateurs-disponibles\"><a href=\"#modificateurs-disponibles\">Modificateurs disponibles</a></h2>\n<ul>\n<li><code>Command</code> (ou <code>Cmd</code> pour faire court)</li>\n<li><code>Control</code> (ou <code>Ctrl</code> pour faire court)</li>\n<li><code>CommandOrControl</code> (ou <code>CmdOrCtrl</code> pour faire court)</li>\n<li><code>Alt</code></li>\n<li><code>Option</code></li>\n<li><code>AltGr</code></li>\n<li><code>Shift</code></li>\n<li><code>Super</code></li>\n<li><code>Meta</code></li>\n</ul>\n<h2 id=\"touches-disponibles\"><a href=\"#touches-disponibles\">Touches disponibles</a></h2>\n<ul>\n<li><code>0</code> à <code>9</code></li>\n<li><code>A</code> à <code>Z</code></li>\n<li><code>F1</code> à <code>F24</code></li>\n<li>Signes de ponctuation comme <code>~</code>, <code>!</code>, <code>@</code>, <code>#</code>, <code>$</code>, etc.</li>\n<li><code>Plus</code></li>\n<li><code>Space</code></li>\n<li><code>Tab</code></li>\n<li><code>Capslock</code></li>\n<li><code>Numlock</code></li>\n<li><code>Défilement</code></li>\n<li><code>Backspace</code></li>\n<li><code>Delete</code></li>\n<li><code>Insert</code></li>\n<li><code>Return</code> (ou <code>Enter</code> comme alias)</li>\n<li><code>Up</code>, <code>Down</code>, <code>Left</code> et <code>Right</code></li>\n<li><code>Home</code> et <code>End</code></li>\n<li><code>PageUp</code> et <code>PageDown</code></li>\n<li><code>Escape</code> (ou <code>Esc</code> pour faire court)</li>\n<li><code>VolumeUp</code>, <code>VolumeDown</code> et <code>VolumeMute</code></li>\n<li><code>MediaNextTrack</code>, <code>MediaPreviousTrack</code>, <code>MediaStop</code> et <code>MediaPlayPause</code></li>\n<li><code>PrintScreen</code></li>\n<li>NumPad Keys<ul>\n<li><code>num0</code> - <code>num9</code></li>\n<li><code>numdec</code> - clé décimale</li>\n<li><code>numadd</code> - numpad <code>+</code> key</li>\n<li><code>numsub</code> - numpad <code>-</code> key</li>\n<li><code>nummult</code> - numpad <code>*</code> key</li>\n<li><code>numdiv</code> - numpad <code>÷</code> key</li>\n</ul></li>\n</ul>",
      "title": "Accélération",
      "description": "Définit des raccourcis clavier."
    },
    "/docs/tutorial/accessibility": {
      "locale": "fr-FR",
      "slug": "accessibility",
      "href": "/docs/tutorial/accessibility",
      "crowdinFileId": "256173",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/accessibility.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"accessibilité\"><a href=\"#accessibilité\">Accessibilité</a></h1>\n<p>Réaliser des applications accessibles est important et nous sommes heureux de fournir une fonctionnalité à <a href=\"https://electronjs.org/devtron\"></a> Devtron et <a href=\"https://electronjs.org/spectron\"></a> Spectron qui donne aux développeurs la possibilité d'améliorer leurs applications pour tout le monde.</p>\n<hr>\n<p>L'accessibilité de développement avec l'application Electron est similaire à la création d'un site web, car les deux fonctionnent avec de L'HTML . Avec les applications Electron, cependant, vous ne pouvez pas utiliser de ressources en ligne afin de mesurer l'accessibilité de votre application, parce qu'elle ne possède pas d'URL sur laquelle ces outils pourraient pointer.</p>\n<p>These features bring those auditing tools to your Electron app. You can choose to add audits to your tests with Spectron or use them within DevTools with Devtron. Continuez pour lire une brève introduction de ces outils.</p>\n<h2 id=\"spectron\"><a href=\"#spectron\">Spectron</a></h2>\n<p>In the testing framework Spectron, you can now audit each window and <code>&#x3C;webview></code> tag in your application. Par exemple :</p>\n<pre><code class=\"hljs language-javascript\">app.client.auditAccessibility().then(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\">audit</span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (audit.failed) {\n    <span class=\"hljs-built_in\">console</span>.error(audit.message)\n  }\n})\n</code></pre>\n<p>Vous pouvez en savoir plus sur cette fonctionnalité dans la <a href=\"https://github.com/electron/spectron#accessibility-testing\">documentation de Spectron</a>.</p>\n<h2 id=\"devtron\"><a href=\"#devtron\">Devtron</a></h2>\n<p>In Devtron, there is an accessibility tab which will allow you to audit a page in your app, sort and filter the results.</p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/1305617/17156618/9f9bcd72-533f-11e6-880d-389115f40a2a.png\" alt=\"capture d’écran devtron\"></p>\n<p>Ces deux outils utilisent la bibliothèque <a href=\"https://github.com/GoogleChrome/accessibility-developer-tools\">Outils d'accessibilité pour les développeurs</a> faite par Google pour Chrome. Vous pouvez en apprendre d'avantage sur les règles sur l’audit de l'accessibilité que cette bibliothèque utilise sur ce <a href=\"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules\">wiki du répertoire git</a>.</p>\n<p>Si vous connaissez d'autres outils d'accessibilité pour Electron, ajoutez les à cette documentation avec une pull request.</p>\n<h2 id=\"manually-enabling-accessibility-features\"><a href=\"#manually-enabling-accessibility-features\">Manually enabling accessibility features</a></h2>\n<p>Electron applications will automatically enable accessibility features in the presence of assistive technology (e.g. <a href=\"https://www.freedomscientific.com/products/software/jaws/\">JAWS</a> on Windows or <a href=\"https://help.apple.com/voiceover/mac/10.15/\">VoiceOver</a> on macOS). Consultez la <a href=\"https://www.chromium.org/developers/design-documents/accessibility#TOC-How-Chrome-detects-the-presence-of-Assistive-Technology\">documentation d’accessibilité</a> de Chrome pour plus de détails.</p>\n<p>You can also manually toggle these features either within your Electron application or by setting flags in third-party native software.</p>\n<h3 id=\"using-electrons-api\"><a href=\"#using-electrons-api\">Using Electron's API</a></h3>\n<p>By using the <a href=\"/docs/api/app#appsetaccessibilitysupportenabledenabled-macos-windows\"><code>app.setAccessibilitySupportEnabled(enabled)</code></a> API, you can manually expose Chrome's accessibility tree to users in the application preferences. Note that the user's system assistive utilities have priority over this setting and will override it.</p>\n<h3 id=\"within-third-party-software\"><a href=\"#within-third-party-software\">Within third-party software</a></h3>\n<h4 id=\"macos\"><a href=\"#macos\">macOS</a></h4>\n<p>On macOS, third-party assistive technology can toggle accessibility features inside Electron applications by setting the <code>AXManualAccessibility</code> attribute programmatically:</p>\n<pre><code class=\"hljs language-objc\"><span class=\"hljs-built_in\">CFStringRef</span> kAXManualAccessibility = <span class=\"hljs-built_in\">CFSTR</span>(<span class=\"hljs-string\">\"AXManualAccessibility\"</span>);\n\n+ (<span class=\"hljs-keyword\">void</span>)enableAccessibility:(<span class=\"hljs-built_in\">BOOL</span>)enable inElectronApplication:(<span class=\"hljs-built_in\">NSRunningApplication</span> *)app\n{\n    AXUIElementRef appRef = AXUIElementCreateApplication(app.processIdentifier);\n    <span class=\"hljs-keyword\">if</span> (appRef == <span class=\"hljs-literal\">nil</span>)\n        <span class=\"hljs-keyword\">return</span>;\n\n    <span class=\"hljs-built_in\">CFBooleanRef</span> value = enable ? kCFBooleanTrue : kCFBooleanFalse;\n    AXUIElementSetAttributeValue(appRef, kAXManualAccessibility, value);\n    <span class=\"hljs-built_in\">CFRelease</span>(appRef);\n}\n</code></pre>",
      "title": "Accessibilité",
      "description": ""
    },
    "/docs/api/app": {
      "locale": "fr-FR",
      "slug": "app",
      "href": "/docs/api/app",
      "crowdinFileId": "256279",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/app.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"app\"><a href=\"#app\">app</a></h1>\n<blockquote>\n<p>Contrôle le cycle de vie des événements de votre application.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>L’exemple suivant montre comment quitter l’application lorsque la dernière fenêtre est fermée :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  app.quit()\n})\n</code></pre>\n<h2 id=\"événements\"><a href=\"#événements\">Événements</a></h2>\n<p>L'objet <code>app</code> émet les événements suivants :</p>\n<h3 id=\"événement--will-finish-launching\"><a href=\"#événement--will-finish-launching\">Événement : 'will-finish-launching'</a></h3>\n<p>Émis lorsque l'application a terminé son démarrage de base. Sur Windows et Linux, l'événement <code>will-finish-launching</code> est le même que l'événement <code>ready</code>. Sur macOS, cet événement représente la notification <code>applicationWillFinishLaunching</code> de <code>NSApplication</code>. Vous allez habituellement mettre en place des listeners pour les événements <code>open-file</code> et <code>open-url</code> ici, et lancer le reporteur d'incident et la mise à jour automatique.</p>\n<p>Dans la plupart des cas, vous devriez pouvoir tout faire dans l'évènement <code>ready</code>.</p>\n<h3 id=\"événement--ready\"><a href=\"#événement--ready\">Événement : 'ready'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>launchInfo</code> Record&#x3C;string, any> | <a href=\"/docs/api/structures/notification-response\">NotificationResponse</a> <em>macOS</em></li>\n</ul>\n<p>Émis lorsqu'Electron a terminé l’initialisation. Sur macOS, <code>launchInfo</code> contient le <code>userInfo</code> de la <code>NSUserNotification</code> ou les informations de <a href=\"/docs/api/structures/notification-response\"><code>UNNotificationResponse</code></a> qui ont été utilisés pour ouvrir l'application , si elle a été lancée à partir du centre de notification. Vous pouvez également appeler <code>app.isReady()</code> pour vérifier si cet événement a déjà été émis et <code>app.whenReady()</code> pour obtenir une Promesse qui sera résolue Electron sera initialisé.</p>\n<h3 id=\"événement--window-all-closed\"><a href=\"#événement--window-all-closed\">Événement : 'window-all-closed'</a></h3>\n<p>Émis lorsque toutes les fenêtres ont été fermées.</p>\n<p>Si vous n'être pas abonné à cet événement et que toutes les fenêtres sont fermées, le comportement par défaut consiste à quitter l'application. Toutefois, si vous vous abonnez, vous pouvez contrôler le fait que l'application se ferme ou non. Si l'utilisateur appuie sur <code>Cmd + Q</code>, ou le développeur appelle <code>app.quit()</code>, Electron essaie d'abord de fermer toutes les fenêtres et puis émet l'événement <code>will-quit</code> et dans ce cas, l'événement <code>window-all-closed</code> ne sera pas émis.</p>\n<h3 id=\"événement--before-quit\"><a href=\"#événement--before-quit\">Événement : 'before-quit'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Émis avant que l'application ne commence à fermer ses fenêtres. Appeler <code>event.preventDefault()</code> empêchera le comportement par défaut, qui est de terminer l'application.</p>\n<p><strong>Remarque :</strong> Si l'application a été quittée par <code>autoUpdater.quitAndInstall()</code>, puis <code>before-quit</code> est émise <em>après</em> émettant un événement <code>close</code> sur toutes les fenêtres et les fermant.</p>\n<p><strong>Note:</strong> Sous Windows, cet événement ne sera pas émit si l'application est fermée à cause d'un extinction du système/re-démarrage ou une déconnexion de l'utilisateur.</p>\n<h3 id=\"événement--will-quit\"><a href=\"#événement--will-quit\">Événement : 'will-quit'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Émis lorsque toutes les fenêtres ont été fermées et que l'application va se fermer. Appeler <code>event.preventDefault()</code> empêchera le comportement par défaut, qui est de terminer l'application.</p>\n<p>Consultez la description de l’événement <code>window-all-closed</code> pour voir les différences entre les événements <code>will-quit</code> et <code>window-all-closed</code>.</p>\n<p><strong>Note:</strong> Sous Windows, cet événement ne sera pas émit si l'application est fermée à cause d'un extinction du système/re-démarrage ou une déconnexion de l'utilisateur.</p>\n<h3 id=\"événement--quit\"><a href=\"#événement--quit\">Événement : 'quit'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>exitCode</code> Integer</li>\n</ul>\n<p>Émis lorsque l'application se quitte.</p>\n<p><strong>Note:</strong> Sous Windows, cet événement ne sera pas émit si l'application est fermée à cause d'un extinction du système/re-démarrage ou une déconnexion de l'utilisateur.</p>\n<h3 id=\"événement--open-file-macos\"><a href=\"#événement--open-file-macos\">Événement : 'open-file' <em>macOS</em></a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>path</code> String</li>\n</ul>\n<p>Émis lorsque l’utilisateur souhaite ouvrir un fichier avec l’application. L’événement <code>open-file</code> est habituellement émis lorsque l’application est déjà ouvert et le système d’exploitation souhaite réutiliser l’application pour ouvrir le fichier. <code>open-file</code> est également émis lorsqu’un fichier est déposé sur le dock et l’application n’est pas encore en cours d’exécution. Assurez-vous d’écouter l’événement <code>open-file</code> très tôt dans le démarrage votre l’application pour gérer ce cas (même avant que l’événement <code>ready</code> soit émis).</p>\n<p>Vous devrez appeler <code>event.preventDefault()</code> si vous souhaitez gérer cet événement.</p>\n<p>Sur Windows, vous devrez analyser <code>process.argv</code> (dans le main process) pour obtenir le chemin d'accès.</p>\n<h3 id=\"événement--open-url-macos\"><a href=\"#événement--open-url-macos\">Événement : 'open-url' <em>macOS</em></a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Émis lorsque l’utilisateur souhaite ouvrir une URL avec l’application. Le fichier de votre application <code>Info.plist</code> doit définir le schéma d'URL dans la touche <code>CFBundleURLTypes</code> et définir <code>NSPrincipalClass</code> à <code>AtomApplication</code>.</p>\n<p>Vous devrez appeler <code>event.preventDefault()</code> si vous souhaitez gérer cet événement.</p>\n<h3 id=\"événement--activate-macos\"><a href=\"#événement--activate-macos\">Événement : 'activate' <em>macOS</em></a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>hasVisibleWindows</code> Boolean</li>\n</ul>\n<p>Émis lorsque l'application est activée. Différentes actions peuvent déclencher cet événement, comme le lancement de l’application pour la première fois, essayer de relancer l’application lorsqu’elle est déjà en cours d’exécution, ou en cliquant sur l'icône du dock de l’application ou de l’icône de la barre des tâches.</p>\n<h3 id=\"événement--did-become-active-macos\"><a href=\"#événement--did-become-active-macos\">Événement : 'did-become-active' <em>macOS</em></a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Émis lorsque l'application est activée. Contrairement à l'événement <code>activate</code>, l'événement <code>did-become-active</code> est émit à chaque fois que l'application devient active, et pas seulement sur l'icône du Dock de l'application ou quand l'application est relancée.</p>\n<h3 id=\"événement--continue-activity-macos\"><a href=\"#événement--continue-activity-macos\">Événement : 'continue-activity' <em>macOS</em></a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - Une chaîne de caractère identifiant l'activité. Mappé sur <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> inconnu - Contient l'état spécifique de l'application stocké par l'activité sur un autre appareil.</li>\n<li>Objet <code>details</code><ul>\n<li><code>webpageURL</code> String (optional) - A string identifying the URL of the webpage accessed by the activity on another device, if available.</li>\n</ul></li>\n</ul>\n<p>Émis au cours de la <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">procédure de transfert</a> quand une activité depuis un périphérique différent veut reprendre. Vous devrez appeler <code>event.preventDefault()</code> si vous souhaitez gérer cet événement.</p>\n<p>Une activité d'utilisateur peut être poursuivie seulement dans une application qui a le même identifiant d'équipe développeur que l'application d'origine de la source d'activité et qui prend en charge le type d'activité. La prise en charge d’activité types est spécifiée dans le <code>Info.plist</code> de l'application sous la clé <code>NSUserActivityType</code>.</p>\n<h3 id=\"événement-wil-continue-activity-macos\"><a href=\"#événement-wil-continue-activity-macos\">Événement: 'wil-continue-activity' <em>macOS</em></a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - Une chaîne de caractère identifiant l'activité. Mappé sur <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n</ul>\n<p>Émis au cours de la <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">procédure de transfert</a> quand une activité depuis un périphérique différent veut reprendre. Vous devrez appeler <code>event.preventDefault()</code> si vous souhaitez gérer cet événement.</p>\n<h3 id=\"événement--continue-activity-error-macos\"><a href=\"#événement--continue-activity-error-macos\">Événement : 'continue-activity-error' <em>macOS</em></a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - Une chaîne de caractère identifiant l'activité. Mappé sur <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>error</code> String - Une chaîne de caractères avec la description localisée de l'erreur.</li>\n</ul>\n<p>Émis au cours de la <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">procédure de transfert</a> quand une activité depuis un périphérique différent n'arrive pas à reprendre.</p>\n<h3 id=\"événement--activity-was-continued-macos\"><a href=\"#événement--activity-was-continued-macos\">Événement : 'activity-was-continued' <em>macOS</em></a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - Une chaîne de caractère identifiant l'activité. Mappé sur <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> inconnu - Contient l'état spécifique de l'application stocké par l'activité.</li>\n</ul>\n<p>Émis au cours de la <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">procédure de transfert</a>après qu'une activité depuis un périphérique différent a bien repris.</p>\n<h3 id=\"événement--update-activity-state-macos\"><a href=\"#événement--update-activity-state-macos\">Événement : 'update-activity-state' <em>macOS</em></a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - Une chaîne de caractère identifiant l'activité. Mappé sur <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> inconnu - Contient l'état spécifique de l'application stocké par l'activité.</li>\n</ul>\n<p>Émis lorsque la <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">procédure de transfert</a> va être repris par un autre appareil. Si vous avez besoin de mettre à jour l'état à transférer, vous devez appeler <code>event.preventDefault()</code> immédiatement, construire un nouveau dictionnaire <code>userInfo</code> et appeler <code>app.updateCurrentActivity()</code> en suivant. Sinon, l'opération échouera et <code>continue-activity-error</code> sera appelée.</p>\n<h3 id=\"événement--new-window-for-tab-macos\"><a href=\"#événement--new-window-for-tab-macos\">Événement : 'new-window-for-tab' <em>macOS</em></a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Émis lorsque l'utilisateur clique sur le bouton natif de nouvel onglet de macOS. Le bouton de nouvel onglet n'est visible que si la <code>BrowserWindow actuelle</code> possède un <code>tabbingIdentifier</code></p>\n<h3 id=\"événement--browser-window-blur\"><a href=\"#événement--browser-window-blur\">Événement : 'browser-window-blur'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Émis lorsqu'un <a href=\"/docs/api/browser-window\">browserWindow</a> perd le focus.</p>\n<h3 id=\"événement--browser-window-focus\"><a href=\"#événement--browser-window-focus\">Événement : 'browser-window-focus'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Émis lorsqu'un <a href=\"/docs/api/browser-window\">browserWindow</a> gagne le focus.</p>\n<h3 id=\"événement--browser-window-created\"><a href=\"#événement--browser-window-created\">Événement : 'browser-window-created'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Émis lorsqu'un nouveau <a href=\"/docs/api/browser-window\">browserWindow</a> est créé.</p>\n<h3 id=\"événement--web-contents-created\"><a href=\"#événement--web-contents-created\">Événement : 'web-contents-created'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Émis lorsqu'un nouveau <a href=\"/docs/api/web-contents\">webContents</a> est créé.</p>\n<h3 id=\"événement-certificate-error\"><a href=\"#événement-certificate-error\">Événement 'certificate-error'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>url</code> String</li>\n<li><code>error</code> String - Le code d'erreur</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>isTrusted</code> Boolean - Détermine si le certificat doit être considéré comme digne de confiance</li>\n</ul></li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Émis lorsque la vérification du <code>certificate</code> pour l'<code>url</code> a échouée. Pour approuver le certificat, vous devez empêcher le comportement par défaut avec <code>event.preventDefault()</code> et appeler <code>callback(true)</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'certificate-error'</span>, (event, webContents, url, error, certificate, callback) => {\n  <span class=\"hljs-keyword\">if</span> (url === <span class=\"hljs-string\">'https://github.com'</span>) {\n    <span class=\"hljs-comment\">// Logique de vérification.</span>\n    event.preventDefault()\n    callback(<span class=\"hljs-literal\">true</span>)\n  } <span class=\"hljs-keyword\">else</span> {\n    callback(<span class=\"hljs-literal\">false</span>)\n  }\n})\n</code></pre>\n<h3 id=\"événement--select-client-certificate\"><a href=\"#événement--select-client-certificate\">Événement : 'select-client-certificate'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>url</code> URL</li>\n<li><code>certificateList</code> <a href=\"/docs/api/structures/certificate\">Certificate[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> (facultatif)</li>\n</ul></li>\n</ul>\n<p>Émis lorsqu'un certificat client est demandé.</p>\n<p>L' <code>url</code> correspondant à l’entrée de navigation demande le certificat client et le <code>callback</code> peut être appelée avec une entrée filtrée dans la liste. L’utilisation de <code>event.preventDefault()</code> empêche l’application d’utiliser le premier certificat du store.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'select-client-certificate'</span>, (event, webContents, url, list, callback) => {\n  event.preventDefault()\n  callback(list[<span class=\"hljs-number\">0</span>])\n})\n</code></pre>\n<h3 id=\"événement--login\"><a href=\"#événement--login\">Événement : 'login'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li>Objet <code>authenticationResponseDetails</code><ul>\n<li><code>url</code> URL</li>\n</ul></li>\n<li>Objet <code>authInfo</code><ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>nom d'utilisateur</code> String (facultatif)</li>\n<li><code>mot de passe</code> String (facultatif)</li>\n</ul></li>\n</ul>\n<p>Émis lorsque <code>webContents</code> veut faire une authentification normale.</p>\n<p>Le comportement par défaut est d'annuler toutes les authentifications. Pour remplacer cela vous devez empêcher le comportement par défaut avec <code>event.preventDefault()</code> et appeler <code>callback(username, password)</code> avec les identifiants.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'login'</span>, (event, webContents, details, authInfo, callback) => {\n  event.preventDefault()\n  callback(<span class=\"hljs-string\">'username'</span>, <span class=\"hljs-string\">'secret'</span>)\n})\n</code></pre>\n<p>Si <code>callback</code> est appelé sans nom d'utilisateur ou mot de passe, la demande d'authentification sera annulée et l'erreur d'authentification sera renvoyée à la page .</p>\n<h3 id=\"événement--gpu-info-update\"><a href=\"#événement--gpu-info-update\">Événement : 'gpu-info-update'</a></h3>\n<p>Émis chaque fois qu'il y a une mise à jour d'informations GPU.</p>\n<h3 id=\"événement--gpu-process-crashed-deprecated\"><a href=\"#événement--gpu-process-crashed-deprecated\">Événement : 'gpu-process-crashed' <em>Deprecated</em></a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>Émis lorsque le processus GPU plante ou est tué.</p>\n<p><strong>Deprecated:</strong> Cet événement est remplacé par l'événement <code>child-process-gone</code> qui contient plus d'informations à propos de la raison du plantage du processus enfant. Ceci n'est pas toujours causé par un plantage. Le booléen <code>killed</code> peut être remplacé par la vérification de <code>reason === 'killed'</code> lorsque vous passez à l'utilisation de cet événement.</p>\n<h3 id=\"événement--renderer-process-crashed-deprecated\"><a href=\"#événement--renderer-process-crashed-deprecated\">Événement : 'renderer-process-crashed' <em>Deprecated</em></a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>Émis lorsque le processus de rendu de <code>webContents</code> plante ou est tué.</p>\n<p><strong>Deprecated:</strong> Cet événement est remplacé par l'événement <code>render-process-gone</code> qui contient plus d'informations à propos de la raison du plantage du processus enfant. Ceci n'est pas toujours causé par un plantage.  Le booléen <code>killed</code> peut être remplacé par la vérification de <code>reason === 'killed'</code> lorsque vous passez à l'utilisation de cet événement.</p>\n<h3 id=\"événement--render-process-gone\"><a href=\"#événement--render-process-gone\">Événement : 'render-process-gone'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li>Objet <code>details</code><ul>\n<li><code>reason</code> String - La raison pour laquelle le processus de rendu a disparu.  Valeurs possibles :<ul>\n<li>`` de sortie propre - Processus s'est terminé avec le code de sortie zéro</li>\n<li><code>anormal-exit</code> - Le Processus s'est terminé avec un code de sortie différent de zéro</li>\n<li><code>killed</code> - Le processus a reçu un SIGTERM ou a été tué autrement de l'extérieur</li>\n<li><code>crashed</code> - Processus s'est planté</li>\n<li><code>oom</code> - Le processus est tombé à cours de mémoire</li>\n<li><code>launch-failed</code> - Le processus ne s'est pas lancé avec succès</li>\n<li><code>integrity-failure</code> - Les vérifications d'intégrité du code Windows ont échouées</li>\n</ul></li>\n<li><code>exitCode</code> Integer - Le code de sortie du proces, sauf si <code>reason</code> est <code>launch-failed</code>, dans ce cas là <code>exitCode</code> sera specifique per plateforme.</li>\n</ul></li>\n</ul>\n<p>Émis lorsque le processus de rendu plante de manière inattendue.  C'est normalement dans les cas où il s'est planté ou qu'il a été tué.</p>\n<h3 id=\"événement--child-process-gone\"><a href=\"#événement--child-process-gone\">Événement : 'child-process-gone'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>Objet <code>details</code><ul>\n<li><code>type</code> String - Type de processus. Une des valeurs suivantes:<ul>\n<li><code>Utility</code></li>\n<li><code>Zygote</code></li>\n<li><code>Sandbox helper</code></li>\n<li><code>GPU</code></li>\n<li><code>Pepper Plugin</code></li>\n<li><code>Pepper Plugin Broker</code></li>\n<li><code>Unknown</code></li>\n</ul></li>\n<li><code>reason</code> String - La raison pour laquelle le processus enfant s'est terminé. Valeurs possibles :<ul>\n<li>`` de sortie propre - Processus s'est terminé avec le code de sortie zéro</li>\n<li><code>anormal-exit</code> - Le Processus s'est terminé avec un code de sortie différent de zéro</li>\n<li><code>killed</code> - Le processus a reçu un SIGTERM ou a été tué autrement de l'extérieur</li>\n<li><code>crashed</code> - Processus s'est planté</li>\n<li><code>oom</code> - Le processus est tombé à cours de mémoire</li>\n<li><code>launch-failed</code> - Le processus ne s'est pas lancé avec succès</li>\n<li><code>integrity-failure</code> - Les vérifications d'intégrité du code Windows ont échouées</li>\n</ul></li>\n<li><code>exitCode</code> Number - Le code de sortie du processus (cad: l'état de waitpid sur posix, de GetExitCodeProcess sur Windows).</li>\n<li><code>serviceName</code> String (optional) - The non-localized name of the process.</li>\n<li><code>name</code> String (facultatif) - Le nom du processus. Examples for utility: <code>Audio Service</code>, <code>Content Decryption Module Service</code>, <code>Network Service</code>, <code>Video Capture</code>, etc.</li>\n</ul></li>\n</ul>\n<p>Émis lorsque le processus enfant plante de manière inattendue. C'est normalement dans les cas où il s'est planté ou qu'il a été tué. Cela n'inclut pas le processus de rendu.</p>\n<h3 id=\"événement--accessibility-support-changed-macos-windows\"><a href=\"#événement--accessibility-support-changed-macos-windows\">Événement : 'accessibility-support-changed' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>accessibilitySupportEnabled</code> Boolean - <code>true</code> quand le support de l'accessibilité de Chrome est activé, sinon <code>false</code>.</li>\n</ul>\n<p>Émis lorsque le support de l’accessibilité du Chrome change. Cet événement se déclenche lorsque les technologies d’assistance, tels que les lecteurs d’écran sont activés ou désactivés. Voir <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">https://www.chromium.org/developers/design-documents/accessibility</a> pour plus de détails.</p>\n<h3 id=\"évènement--session-created\"><a href=\"#évènement--session-created\">Évènement : 'session-created'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>session</code> <a href=\"/docs/api/session\">Session</a></li>\n</ul>\n<p>Émis lorsque Electron vient de créer une nouvelle <code>session</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'session-created'</span>, (session) => {\n  <span class=\"hljs-built_in\">console</span>.log(session)\n})\n</code></pre>\n<h3 id=\"évènement--second-instance\"><a href=\"#évènement--second-instance\">Évènement : 'second-instance'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>argv</code> String[] - un tableau d’arguments de la deuxième instance de la ligne de commande</li>\n<li><code>workingDirectory</code> String - Le répertoire de travail de la deuxième instance</li>\n</ul>\n<p>Cet événement sera émis dans l'instance principale de votre application quand une seconde instance a été exécutée et appelle <code>app.requestSingleInstanceLock()</code>.</p>\n<p><code>argv</code> est un tableau des arguments de la ligne de commande de la seconde instance, et <code>workingDirectory</code> est son répertoire de travail actuel. Les applications répondent habituellement à cela en faisant de leur fenêtre principale, une fenêtre centrée et non réduite au minimum.</p>\n<p><strong>Note:</strong> Si la seconde instance a été lancée par un utilisateur différent du premier, le tableau <code>argv</code> ne va pas inclure les arguments.</p>\n<p>Cet évènement est garanti d'être émis après que l'évènement <code>ready</code> de <code>app</code> soit émis.</p>\n<p><strong>Remarque :</strong> Des arguments supplémentaires en ligne de commande peuvent être ajoutés par Chromium, tels que <code>--original-process-start-time</code>.</p>\n<h3 id=\"événement--desktop-capturer-get-sources\"><a href=\"#événement--desktop-capturer-get-sources\">Événement : 'desktop-capturer-get-sources'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Émis lors de l'appel à <code>desktopCapturer.getSources()</code> dans le processus de rendu de <code>webContents</code>. L' Appel à <code>event.preventDefault()</code> lui fera retourner des sources vides.</p>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>L'objet <code>app</code> dispose des méthodes suivantes :</p>\n<p><strong>Remarque :</strong> Certaines méthodes sont seulement disponibles sur des systèmes d'exploitation spécifiques et sont étiquetés comme tels.</p>\n<h3 id=\"appquit\"><a href=\"#appquit\"><code>app.quit()</code></a></h3>\n<p>Essayez de fermer toutes les fenêtres. L’événement <code>before-quit</code> sera émis d’abord. Si toutes les fenêtres sont fermées avec succès, l’événement <code>will-quit</code> sera émis et éteindra l’application.</p>\n<p>Cette méthode garantit que tous les écouteurs d’événements de <code>beforeunload</code> et <code>unload</code> seront correctement exécutées. Il est possible qu’une fenêtre annule la fermeture en retournant <code>false</code> dans l'écouteur d’événement <code>beforeunload</code>.</p>\n<h3 id=\"appexitexitcode\"><a href=\"#appexitexitcode\"><code>app.exit([exitCode])</code></a></h3>\n<ul>\n<li><code>exitCode</code> Integer (facultatif)</li>\n</ul>\n<p>Sort immédiatement avec <code>exitCode</code>. <code>exitCode</code> est par défaut à 0.</p>\n<p>Toutes les fenêtres seront fermées immédiatement sans demander à l'utilisateur, et les événements <code>before-quit</code> et <code>will-quit</code> ne seront pas émis.</p>\n<h3 id=\"apprelaunchoptions\"><a href=\"#apprelaunchoptions\"><code>app.relaunch([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>args</code> String[] - (facultatif)</li>\n<li><code>execPath</code> String (facultatif)</li>\n</ul></li>\n</ul>\n<p>Relance l’application lorsque l’instance en cours se termine.</p>\n<p>Par défaut, la nouvelle instance utilisera le même répertoire de travail et les mêmes arguments de la ligne de commande avec l'instance actuelle. Si <code>args</code> est spécifié, <code>args</code> sera passé comme argument de ligne de commande à la place. Lorsque <code>execPath</code> est spécifié, <code>execPath</code> sera exécuté pour redémarrer à la de l’application actuelle.</p>\n<p>Notez bien que cette méthode ne ferme pas l'application, vous devez appeler <code>app.quit</code> ou <code>app.exit</code> après avoir appelé <code>app.relaunch</code> pour faire redémarrer votre application.</p>\n<p>Quand <code>app.relaunch</code> est appelé plusieurs fois, plusieurs instances vont être appelées après que l'instance actuelle soit fermée.</p>\n<p>Voici un exemple qui redémarre une nouvelle instance immédiatement en ajoutant un nouvel argument de ligne de commande à la nouvelle instance :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>) app.relaunch({ <span class=\"hljs-attr\">args</span>: process.argv.slice(<span class=\"hljs-number\">1</span>).concat([<span class=\"hljs-string\">'--relaunch'</span>]) }) app.exit(<span class=\"hljs-number\">0</span>)\n</code></pre>\n<h3 id=\"appisready\"><a href=\"#appisready\"><code>app.isReady()</code></a></h3>\n<p>Retourne <code>Boolean</code> - <code>true</code> si Electron a fini de s'initialiser, <code>false</code> sinon. Voir également <code>app.whenReady()</code>.</p>\n<h3 id=\"appwhenready\"><a href=\"#appwhenready\"><code>app.whenReady()</code></a></h3>\n<p>Returns <code>Promise&#x26;lt;void&#x26;gt;</code> - Remplie quand Electron est initialisé. Peut astucieusement remplacer la vérification de <code>app.isReady()</code> et l'abonnement à l'événement <code>ready</code> si l'application n'est pas encore prête.</p>\n<h3 id=\"appfocusoptions\"><a href=\"#appfocusoptions\"><code>app.focus([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>steal</code> Boolean <em>macOS</em> - Destiner l'action à l'application active même si il s'agit d'une autre application.</li>\n</ul></li>\n</ul>\n<p>Sous Linux, donne le focus à la première fenêtre visible. Sur macOS, fait de l'application l'application active. Sous Windows, donne le focus à la première fenêtre de l'application.</p>\n<p>Il vaut mieux utiliser l'option <code>steal</code> aussi parcimonieusement que possible.</p>\n<h3 id=\"apphide-macos\"><a href=\"#apphide-macos\"><code>app.hide()</code> <em>macOS</em></a></h3>\n<p>Masque toutes les fenêtres d’application sans les minimiser.</p>\n<h3 id=\"appshow-macos\"><a href=\"#appshow-macos\"><code>app.show()</code> <em>macOS</em></a></h3>\n<p>Affiche les fenêtres de l'application après qu'elles aient été occultées. Ne leur pas automatiquement le focus. .</p>\n<h3 id=\"chemin-appsetapplogspathpath\"><a href=\"#chemin-appsetapplogspathpath\"><code>chemin app.setAppLogsPath([path])</code></a></h3>\n<ul>\n<li><code>path</code> String (facultatif) - Un chemin personnalisé pour vos logs. Doit être absolu.</li>\n</ul>\n<p>Définit ou crée un répertoire qui peut être manipulé par <code>app.getPath()</code> ou <code>app.setPath(pathName, newPath)</code>.</p>\n<p>Appeler <code>app. etAppLogsPath()</code> sans paramètre <code>path</code> fera que ce répertoire sera réglé sur <code>~/Library/Logs/YourAppName</code> sur <em>macOS</em>, et dans le répertoire <code>userData</code> sur <em>Linux</em> et <em>Windows</em>.</p>\n<h3 id=\"appgetapppath\"><a href=\"#appgetapppath\"><code>app.getAppPath()</code></a></h3>\n<p>Retourne <code>String</code> - Répertoire courant de l'application.</p>\n<h3 id=\"appgetpathname\"><a href=\"#appgetpathname\"><code>app.getPath(name)</code></a></h3>\n<ul>\n<li><code>name</code> String - Nom pour lequel vous pouvez demander le chemin nom:<ul>\n<li><code>home</code> Répertoire d'accueil de l'utilisateur.</li>\n<li><code>appData</code> Répertoire de données par utilisateur de l'application, pointant par défaut sur:<ul>\n<li><code>%APPDATA%</code> sur Windows</li>\n<li><code>$XDG_CONFIG_HOME</code> ou <code>~/.config</code> sur Linux</li>\n<li><code>~/Library/Application Support</code> sur macOS</li>\n</ul></li>\n<li><code>userData</code> Le dossier pour stocker les fichiers de configuration de votre application, qui par défaut est le dossier <code>appData</code> avec le nom de votre application.</li>\n<li><code>cache</code></li>\n<li><code>temp</code> Dossier temporaire.</li>\n<li><code>exe</code> Le fichier exécutable actuel.</li>\n<li><code>module</code> La bibliothèque de <code>libchromiumcontent</code>.</li>\n<li><code>desktop</code> Le dossier du Bureau de l’utilisateur actuel.</li>\n<li><code>documents</code> Dossier \"Mes Documents\" d'un utilisateur.</li>\n<li><code>downloads</code> Dossier pour les téléchargements de l’utilisateur.</li>\n<li><code>music</code> Dossier de musique de l’utilisateur.</li>\n<li><code>pictures</code> Dossier des images de l’utilisateur.</li>\n<li><code>videos</code> Dossier des vidéos de l’utilisateur.</li>\n<li><code>recent</code> Dossier des fichiers récents de l'utilisateur (Windows seulement).</li>\n<li><code>logs</code> Répertoire du dossier de log de votre application.</li>\n<li><code>crashDumps</code> Dossier où les rapports d'incidents sont stockés.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>String</code> - Un chemin vers le répertoire spécial ou le fichier associé à <code>nom</code>. En cas d'échec, une <code>Error</code> sera levée.</p>\n<p>Si <code>app.getPath('logs')</code> est appelé sans que <code>app.setAppLogsPath()</code> soit appelé en premier, un répertoire de logs par défaut sera créé équivalent à un appel <code>app.setAppLogsPath()</code> sans paramètre <code>path</code>.</p>\n<h3 id=\"appgetfileiconpath-options\"><a href=\"#appgetfileiconpath-options\"><code>app.getFileIcon(path[, options])</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>size</code> String<ul>\n<li><code>small</code> - 16x16</li>\n<li><code>normal</code> - 32x32</li>\n<li><code>large</code> - 48x48 sur <em>Linux</em>, 32x32 sur <em>Windows</em>, non pris en charge sur <em>macOS</em>.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Retourne <code>Promise&#x3C;NativeImage></code> - rempli avec l'icône de l'application, qui est une <a href=\"/docs/api/native-image\">NativeImage</a>.</p>\n<p>Récupère une icône associée à un chemin.</p>\n<p>Sous <em>Windows</em>, il y a 2 sortes d’icônes :</p>\n<ul>\n<li>Icônes associées à certaines extensions de fichier, comme <code>.mp3</code>, <code>.png</code>, etc.</li>\n<li>Icônes à l’intérieur du fichier lui-même, comme les <code>.exe</code>, <code>.dll</code>, <code>.ico</code>.</li>\n</ul>\n<p>Sur <em>Linux</em> et <em>macOS</em>, les icônes dépendent de l'application associée au type Mime de fichier.</p>\n<h3 id=\"appsetpathname-path\"><a href=\"#appsetpathname-path\"><code>app.setPath(name, path)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n<li><code>path</code> String</li>\n</ul>\n<p>Remplace le chemin <code>path</code> par un répertoire spécial ou un fichier associé à <code>name</code>. Si le chemin spécifie un répertoire qui n'existe pas, une <code>Erreur</code> est levée. Dans ce cas, le répertoire doit être créé avec <code>fs.mkdirSync</code> ou similaire.</p>\n<p>Vous pouvez remplacer uniquement les chemins d’un <code>name</code> défini dans <code>app.getPath</code>.</p>\n<p>Par défaut, les cookies et la cache des pages web seront stockés dans le répertoire <code>userData</code>. Si vous voulez changer cet emplacement, vous devez remplacer le chemin <code>userData</code> avant que l'événement <code>ready</code> du module <code>app</code> soit émis.</p>\n<h3 id=\"appgetversion\"><a href=\"#appgetversion\"><code>app.getVersion()</code></a></h3>\n<p>Retourne <code>String</code> - La version de l'application chargée. Si aucune version n'est trouvée dans le fichier <code>package.json</code> de l'application, la version du bundle courant ou de l'exécutable est renvoyée.</p>\n<h3 id=\"appgetname\"><a href=\"#appgetname\"><code>app.getName()</code></a></h3>\n<p>Retourne <code>String</code> - Le nom de l'application, qui est écrit dans le fichier <code>package.json</code> .</p>\n<p>Habituellement, le champ <code>name</code> de <code>package.json</code> est un nom court en minuscule, selon la spécification des modules npm. Vous devriez dans la plupart des cas renseigner également un champ <code>productName</code>, qui contient le nom complet et capitalisé de votre application, et qui sera préféré à <code>name</code> par Electron.</p>\n<h3 id=\"appsetnamename\"><a href=\"#appsetnamename\"><code>app.setName(name)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n</ul>\n<p>Remplace le nom de l'application actuelle.</p>\n<p><strong>Note:</strong> Cette fonction remplace le nom utilisé en interne par Electron; elle n'affecte pas le nom que l'OS utilise.</p>\n<h3 id=\"appgetlocale\"><a href=\"#appgetlocale\"><code>app.getLocale()</code></a></h3>\n<p>Renvoie <code>String</code> - Les paramètres régionaux actuels de l'application, récupérés à l'aide de la librairie <code>l10n_util</code> de Chromium. Les valeurs de retour possibles sont documentées <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:ui/base/l10n/l10n_util.cc\">ici</a>.</p>\n<p>To set the locale, you'll want to use a command line switch at app startup, which may be found <a href=\"/docs/api/command-line-switches\">here</a>.</p>\n<p><strong>Remarque :</strong> À la distribution de votre application empaquetée, vous devrez également inclure le dossier <code>locales</code>.</p>\n<p><strong>Remarque :</strong> Sous Windows, vous devez l'appeler après que les événements <code>prêts</code> soient émis.</p>\n<h3 id=\"appgetlocalecountrycode\"><a href=\"#appgetlocalecountrycode\"><code>app.getLocaleCountryCode()</code></a></h3>\n<p>Retourne <code>String</code> - Les deux lettres de la locale du système d'exploitation de l'utilisateur selon le codage <a href=\"https://www.iso.org/iso-3166-country-codes.html\">ISO 3166</a> . La valeur est tirée des API natives d'OS.</p>\n<p><strong>Note:</strong> Quand il est impossible de détecter le code du pays de la localisation, il renvoie une chaîne vide.</p>\n<h3 id=\"appaddrecentdocumentpath-macos-windows\"><a href=\"#appaddrecentdocumentpath-macos-windows\"><code>app.addRecentDocument(path)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Ajoute le <code>path</code> à la liste des documents récents.</p>\n<p>Cette liste est gérée par l'OS. Cette liste est gérée par l'Os. Sous Windows, vous pouvez scruter la liste à partir de la barre des tâches et sur macOS à partir du menu du dock.</p>\n<h3 id=\"appclearrecentdocuments-macos-windows\"><a href=\"#appclearrecentdocuments-macos-windows\"><code>app.clearRecentDocuments()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Efface la liste des documents récents.</p>\n<h3 id=\"appsetasdefaultprotocolclientprotocol-path-args\"><a href=\"#appsetasdefaultprotocolclientprotocol-path-args\"><code>app.setAsDefaultProtocolClient(protocol[, path, args])</code></a></h3>\n<ul>\n<li><code>protocol</code> String - Le nom de votre protocole, sans le préfixe <code>://</code>. Par exemple, si vous souhaitez que votre application gère les liens <code>electron://</code>, appelez cette méthode avec <code>electron</code> comme paramètre.</li>\n<li><code>path</code> String (facultatif) <em>Windows</em> -Chemin vers l'exécutable d'Electron. Par défaut <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/facultatif\"></a> <em>Windows</em> - Arguments transmis à l'exécutable. Par défaut, un tableau vide</li>\n</ul>\n<p>Returns <code>Boolean</code> - Si l'appel a réussi.</p>\n<p>Définit l'exécutable courant comme gestionnaire par défaut pour un protocole (alias le schéma URI). Il vous permet d'intégrer votre application plus profondément dans le système d'exploitation. Une fois enregistré, tous les liens avec <code>votre-protocole://</code> seront ouverts avec l'exécutable courant. L'ensemble du lien, y compris le protocole, sera transmis à votre application comme paramètre.</p>\n<p><strong>Remarque:</strong> Sur macOS, vous ne pouvez enregistrer que les protocoles qui ont été ajoutés à votre application <code>info.plist</code>, qui ne peut pas être modifié au moment de l'exécution. Cependant, vous pouvez changer le fichier pendant la construction via <a href=\"https://www.electronforge.io/\">Electron Forge</a>, <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a>, ou en modifiant <code>info.plist</code> avec un éditeur de texte. Veuillez vous référer à la <a href=\"https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102207-TPXREF115\">documentation d'Apple</a> pour plus de détails.</p>\n<p><strong>Remarque :</strong> Dans un environnement Windows Store (lorsque empaqueté en tant qu'<code>appx</code>) cette API retournera <code>true</code> pour tous les appels, mais la clé de registre qu'elle définit ne sera pas accessible par d'autres applications.  Afin d'enregistrer votre application Windows Store comme gestionnaire de protocole par défaut, vous devez <a href=\"https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol\">déclarer le protocole dans votre manifest</a>.</p>\n<p>L'API utilise le registre Windows et <code>LSSetDefaultHandlerForURLScheme</code> en interne.</p>\n<h3 id=\"appremoveasdefaultprotocolclientprotocol-path-args-macos-windows\"><a href=\"#appremoveasdefaultprotocolclientprotocol-path-args-macos-windows\"><code>app.removeAsDefaultProtocolClient(protocol[, path, args])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>protocol</code> String - Le nom de votre protocole, sans le préfixe <code>://</code>.</li>\n<li><code>path</code> String (facultatif) <em>Windows</em> - <code>process.execPath</code> par défaut</li>\n<li><code>args</code> String<a href=\"/docs/api/facultatif\"></a> <em>Windows</em> - Un tableau vide par défaut</li>\n</ul>\n<p>Returns <code>Boolean</code> - Si l'appel a réussi.</p>\n<p>Cette méthode vérifie si l'exécutable courant est le gestionnaire par défaut pour un protocole (aka le schéma URI). Si c'est le cas, cela supprimera l'application comme gestionnaire par défaut.</p>\n<h3 id=\"appisdefaultprotocolclientprotocol-path-args\"><a href=\"#appisdefaultprotocolclientprotocol-path-args\"><code>app.isDefaultProtocolClient(protocol[, path, args])</code></a></h3>\n<ul>\n<li><code>protocol</code> String - Le nom de votre protocole, sans le préfixe <code>://</code>.</li>\n<li><code>path</code> String (facultatif) <em>Windows</em> - <code>process.execPath</code> par défaut</li>\n<li><code>args</code> String<a href=\"/docs/api/facultatif\"></a> <em>Windows</em> - Un tableau vide par défaut</li>\n</ul>\n<p>Retourne <code>Boolean</code> - Si l'exécutable actuel et le gestionnaire par défaut d'un protocole (schéma URI).</p>\n<p><strong>Remarque:</strong> Sur macOS, vous pouvez utiliser cette méthode pour vérifier si l'application a bien été enregistré comme gestionnaire de protocole par défaut pour un protocole. Vous pouvez également confirmer cela en vérifiant <code>~/Library/Preferences/com.apple.LaunchServices.plist</code> sur votre machine macOS. Veuillez vous référer à la <a href=\"https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme\">documentation d'Apple</a> pour plus de détails.</p>\n<p>L'API utilise le registre Windows et <code>LSCopyDefaultHandlerForURLScheme</code> en interne.</p>\n<h3 id=\"appgetapplicationnameforprotocolurl\"><a href=\"#appgetapplicationnameforprotocolurl\"><code>app.getApplicationNameForProtocol(url)</code></a></h3>\n<ul>\n<li><code>url</code> String - une URL avec le nom du protocole à vérifier. Contrairement aux autre méthodes de cette famille, celle-ci accepte un URL en entier, y compris <code>://</code> au minimum (par exemple : <code>https://</code>).</li>\n</ul>\n<p>Retourne <code>String</code> - Nom de l'application qui gère le protocole, ou un &#x3C;0>String&#x3C;/0> vide s'il n'y a pas de gestionnaire. Par exemple, si Electron est le gestionnaire par défaut de l'URL, il pourrait s'agit de <code>Electron</code> sur Windows et Mac. Par contre, ne vous fiez pas au format précis qui ne garantit pas de ne pas changer. Attendez-vous à un format différent sur Linux, probablement avec un préfixe <code>.desktop</code>.</p>\n<p>Cette méthode retourne le nom de l'application du gestionnaire par défaut pour le protocole d'une URL (schéma d'URI).</p>\n<h3 id=\"appgetapplicationinfoforprotocolurl-macos-windows\"><a href=\"#appgetapplicationinfoforprotocolurl-macos-windows\"><code>app.getApplicationInfoForProtocol(url)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>url</code> String - une URL avec le nom du protocole à vérifier. Contrairement aux autre méthodes de cette famille, celle-ci accepte un URL en entier, y compris <code>://</code> au minimum (par exemple : <code>https://</code>).</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;Object></code> - Résoudre avec un objet contenant les éléments suivants :</p>\n<ul>\n<li><code>icon</code> NativeImage - l’icône d’affichage de l’application qui gère le protocole.</li>\n<li><code>path</code> String - chemin d’installation de l’application qui gère le protocole.</li>\n<li><code>name</code> String - nom complet de l’application qui gère le protocole.</li>\n</ul>\n<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>\n<h3 id=\"appsetusertaskstasks-windows\"><a href=\"#appsetusertaskstasks-windows\"><code>app.setUserTasks(tasks)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>tasks</code> <a href=\"/docs/api/structures/task\">Task[]</a> - Tableau d'objets <code>Task</code></li>\n</ul>\n<p>Ajoute <code>tâches</code> à la catégorie <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks\">Tâches</a> de la liste de sauts sur Windows.</p>\n<p><code>tasks</code> est un tableau d’objets <a href=\"/docs/api/structures/task\"><code>Task</code></a>.</p>\n<p>Returns <code>Boolean</code> - Si l'appel a réussi.</p>\n<p><strong>Remarque :</strong> Si vous souhaitez personnaliser encore plus la JumpList, utilisez <code>app.setJumpList(categories)</code> à la place.</p>\n<h3 id=\"appgetjumplistsettings-windows\"><a href=\"#appgetjumplistsettings-windows\"><code>app.getJumpListSettings()</code> <em>Windows</em></a></h3>\n<p>Retourne <code>Object</code>:</p>\n<ul>\n<li><code>minItems</code> Integer - Le nombre minimum d'éléments qui seront affichés dans la JumpList (pour une description plus détaillée de cette valeur, voir les <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx\">documentations MSDN</a>).</li>\n<li><code>removedItems</code> <a href=\"/docs/api/structures/jump-list-item\">JumpListItem[]</a> - Tableau des objets <code>JumpListItem</code> qui correspondent aux éléments que l'utilisateur a explicitement retirés des catégories personnalisées dans la liste de saut de . Ces éléments ne doivent pas être ajoutés de nouveau à la JumpList dans l'appel <strong>suivant</strong> à <code>app.setJumpList()</code>, Windows n'affichera aucune catégorie personnalisée qui contient les éléments supprimés.</li>\n</ul>\n<h3 id=\"appsetjumplistcategories-windows\"><a href=\"#appsetjumplistcategories-windows\"><code>app.setJumpList(categories)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>catégories</code> <a href=\"/docs/api/structures/jump-list-category\">JumpListCategory[]</a> | <code>null</code> - Tableau d'objets <code>JumpListCategory</code>.</li>\n</ul>\n<p>Définit ou supprime une JumpList personnalisée pour l'application et renvoie l'une des chaînes de caractères suivantes :</p>\n<ul>\n<li><code>ok</code> - Tout s'est bien passé.</li>\n<li><code>error</code> - Une ou plusieurs erreurs se sont produites, activez la journalisation de la durée d'exécution pour déterminer la cause probable.</li>\n<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>\n<li><code>fileTypeRegistrationError</code> - Tentative d'ajout d'un lien de fichier dans la JumpList pour un type de fichier que l'application n'est pas enregistrée pour gérer.</li>\n<li><code>customCategoryAccessDeniedError</code> - Les catégories personnalisées ne peuvent pas être ajoutées à la JumpList en raison de la confidentialité de l'utilisateur ou des paramètres de politique de groupe.</li>\n</ul>\n<p>Si <code>cetagories</code> est <code>null</code>, la JumpList personnalisée précédemment définie (si existante) sera remplacée par la JumpList standard de l'application (gérée par Windows).</p>\n<p><strong>Remarque :</strong> Si un objet <code>JumpListCategory</code> n'a ni de <code>type</code> ni de propriété <code>name</code> définie le <code>type</code> est donc supposé être <code>tasks</code>. Si la propriété <code>name</code> est définie mais que le <code>type</code> est omis, alors le <code>type</code> est assumé être <code>custom</code>.</p>\n<p><strong>Remarque :</strong> Les utilisateurs peuvent supprimer des éléments des catégories personnalisées, et Windows n'autorisera pas l'ajout d'un élément supprimé dans une catégorie personnalisée avant le <strong>prochain</strong> appel réussi à <code>app.setJumpList(categories)</code>. Toute tentative de réajouter un élément supprimé à une catégorie personnalisée plus tôt, cela entraînera l'omission de toute la catégorie personnalisée dans la JumpList. La liste des éléments supprimés peut être obtenue à l'aide de <code>app.getJumpListSettings()</code>.</p>\n<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>\n<p>Voici un exemple très simple de la création d'une JumpList personnalisé :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setJumpList([\n  {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'custom'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Recent Projects'</span>,\n    <span class=\"hljs-attr\">items</span>: [\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'file'</span>, <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'C:\\\\Projects\\\\project1.proj'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'file'</span>, <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'C:\\\\Projects\\\\project2.proj'</span> }\n    ]\n  },\n  { <span class=\"hljs-comment\">// has a name so `type` is assumed to be \"custom\"</span>\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Tools'</span>,\n    <span class=\"hljs-attr\">items</span>: [\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Tool A'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--run-tool-a'</span>,\n        <span class=\"hljs-attr\">icon</span>: process.execPath,\n        <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Runs Tool A'</span>\n      },\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Tool B'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--run-tool-b'</span>,\n        <span class=\"hljs-attr\">icon</span>: process.execPath,\n        <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Runs Tool B'</span>\n      }\n    ]\n  },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'frequent'</span> },\n  { <span class=\"hljs-comment\">// has no name and no type so `type` is assumed to be \"tasks\"</span>\n    <span class=\"hljs-attr\">items</span>: [\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'New Project'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--new-project'</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Create a new project.'</span>\n      },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Recover Project'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--recover-project'</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Recover Project'</span>\n      }\n    ]\n  }\n])\n</code></pre>\n<h3 id=\"apprequest-singleinstancelock\"><a href=\"#apprequest-singleinstancelock\"><code>app.request SingleInstanceLock()</code></a></h3>\n<p>Retourne <code>Boolean</code></p>\n<p>La valeur renvoyée par cette méthode indique si cette instance de votre application a obtenu le verrou ou non.  S'il n'a pas réussi à obtenir le verrou vous pouvez supposer qu'une autre instance de votre application est déjà en cours d'exécution avec le verrou et quitter immédiatement.</p>\n<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.  Elle renvoie <code>false</code> si votre process devrait quitter immédiatement, puisqu'il a envoyé ses paramètres à une instance qui possède déjà le verrou.</p>\n<p>Sur macOS, le système impose automatiquement une instance unique lorsque les utilisateurs essaient d'ouvrir une seconde instance de votre application dans Finder, et les événements <code>open-file</code> et <code>open-url</code> seront émis pour cela. Cependant, lorsque les utilisateurs démarrent votre application en ligne de commande , le mécanisme d'instance unique du système sera contourné, et vous devez utiliser cette méthode pour assurer une seule instance.</p>\n<p>Un exemple d'activation de la fenêtre de l'instance primaire lorsqu'une seconde instance démarre :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> myWindow = <span class=\"hljs-literal\">null</span>\n\n<span class=\"hljs-keyword\">const</span> gotTheLock = app.requestSingleInstanceLock()\n\n<span class=\"hljs-keyword\">if</span> (!gotTheLock) {\n  app.quit()\n} <span class=\"hljs-keyword\">else</span> {\n  app.on(<span class=\"hljs-string\">'second-instance'</span>, (event, commandLine, workingDirectory) => {\n    <span class=\"hljs-comment\">// Quelqu'un a tenté d'exécuter une seconde instance. Nous devrions focus la fenêtre.</span>\n    <span class=\"hljs-keyword\">if</span> (myWindow) {\n      <span class=\"hljs-keyword\">if</span> (myWindow.isMinimized()) myWindow.restore()\n      myWindow.focus()\n    }\n  })\n\n  <span class=\"hljs-comment\">// Créer myWindow, charger le reste de l'app, etc...</span>\n  app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    myWindow = createWindow()\n  })\n}\n</code></pre>\n<h3 id=\"apphassingleinstancelock\"><a href=\"#apphassingleinstancelock\"><code>app.hasSingleInstanceLock()</code></a></h3>\n<p>Retourne <code>Boolean</code></p>\n<p>Cette méthode retourne un booléen indiquant si cette instance de votre application détient actuellement le verrou d'instance unique.  Vous pouvez demander le verrou avec <code>app.requestSingleInstanceLock()</code> et le débloquer avec <code>app.releaseSingleInstanceLock()</code></p>\n<h3 id=\"appreleasesingleinstancelock\"><a href=\"#appreleasesingleinstancelock\"><code>app.releaseSingleInstanceLock()</code></a></h3>\n<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>\n<h3 id=\"appsetuseractivitytype-userinfo-webpageurl-macos\"><a href=\"#appsetuseractivitytype-userinfo-webpageurl-macos\"><code>app.setUserActivity(type, userInfo[, webpageURL])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>type</code> String - Identifie de façon unique l'activité. Mappé sur <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> n'importe quel - état spécifique à l'application à stocker pour utilisation par un autre appareil.</li>\n<li><code>webpageURL</code> String (optional) - The webpage to load in a browser if no suitable app is installed on the resuming device. Le schéma doit être <code>http</code> ou <code>https</code>.</li>\n</ul>\n<p>Créée un <code>NSUserActivity</code> et le défini en tant qu'activité courante. Après cela, l'activité devient éligible à la fonction <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> sur l'autre périphérique.</p>\n<h3 id=\"appgetcurrentactivitytype-macos\"><a href=\"#appgetcurrentactivitytype-macos\"><code>app.getCurrentActivityType()</code> <em>macOS</em></a></h3>\n<p>Retourne <code>String</code> - le type de l’activité en cours d’exécution.</p>\n<h3 id=\"appinvalidatecurrentactivity-macos\"><a href=\"#appinvalidatecurrentactivity-macos\"><code>app.invalidateCurrentActivity()</code> <em>macOS</em></a></h3>\n<p>Invalide l'activité <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> courante de l'utilisateur.</p>\n<h3 id=\"appresigncurrentactivity-macos\"><a href=\"#appresigncurrentactivity-macos\"><code>app.resignCurrentActivity()</code> <em>macOS</em></a></h3>\n<p>Marque l'activité actuelle de l'utilisateur <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> comme inactive sans l'invalider.</p>\n<h3 id=\"appupdatecurrentactivitytype-userinfo-macos\"><a href=\"#appupdatecurrentactivitytype-userinfo-macos\"><code>app.updateCurrentActivity(type, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>type</code> String - Identifie de façon unique l'activité. Mappé sur <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> n'importe quel - état spécifique à l'application à stocker pour utilisation par un autre appareil.</li>\n</ul>\n<p>Modifie l'activité en cours si son type correspond à <code>type</code>, en fusionnant les entrées de <code>userInfo</code> dans son dictionnaire <code>userInfo</code> courant.</p>\n<h3 id=\"appsetappusermodelidid-windows\"><a href=\"#appsetappusermodelidid-windows\"><code>app.setAppUserModelId(id)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>id</code> String</li>\n</ul>\n<p>Change le <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> à <code>id</code>.</p>\n<h3 id=\"appsetactivationpolicypolicy-macos\"><a href=\"#appsetactivationpolicypolicy-macos\"><code>app.setActivationPolicy(policy)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>policy</code> String - Can be 'regular', 'accessory', or 'prohibited'.</li>\n</ul>\n<p>Sets the activation policy for a given app.</p>\n<p>Activation policy types:</p>\n<ul>\n<li>'regular' - The application is an ordinary app that appears in the Dock and may have a user interface.</li>\n<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>\n<li>'prohibited' - The application doesn’t appear in the Dock and may not create windows or be activated.</li>\n</ul>\n<h3 id=\"appimportcertificateoptions-callback-linux\"><a href=\"#appimportcertificateoptions-callback-linux\"><code>app.importCertificate(options, callback)</code> <em>Linux</em></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>certificate</code> String - Chemin pour le fichier pkcs12.</li>\n<li><code>password</code> String - La Passphrase pour le certificat.</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>result</code> Integer - Résultat de l'importation.</li>\n</ul></li>\n</ul>\n<p>Importe le certificat au format pkcs12 dans l'entrepôt de certificats de la plateforme. <code>callback</code> est appelé avec le retour <code>result</code> de l'opération d'import, une valeur <code>0</code> indique un succès alors que toute autre valeur signale un problème, telle que décrite par la <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">net_error_list</a> de Chromium.</p>\n<h3 id=\"appconfigurehostresolveroptions\"><a href=\"#appconfigurehostresolveroptions\"><code>app.configureHostResolver(options)</code></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<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>\n<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>\n<li><code>secureDnsServers</code> String[] (optional) - A list of DNS-over-HTTP server templates. See <a href=\"https://datatracker.ietf.org/doc/html/rfc8484#section-3\">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://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&#x26;ss=chromium%2Fchromium%2Fsrc\">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>\n<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>\n</ul></li>\n</ul>\n<p>Configures host resolution (DNS and DNS-over-HTTPS). By default, the following resolvers will be used, in order:</p>\n<ol>\n<li>DNS-over-HTTPS, if the <a href=\"https://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&#x26;ss=chromium%2Fchromium%2Fsrc\">DNS provider supports it</a>, then</li>\n<li>the built-in resolver (enabled on macOS only by default), then</li>\n<li>the system's resolver (e.g. <code>getaddrinfo</code>).</li>\n</ol>\n<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>\n<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>\n<pre><code class=\"hljs language-js\">app.configureHostResolver({\n  <span class=\"hljs-attr\">secureDnsMode</span>: <span class=\"hljs-string\">'secure'</span>,\n  <span class=\"hljs-attr\">secureDnsServers</span>: [\n    <span class=\"hljs-string\">'https://cloudflare-dns.com/dns-query'</span>\n  ]\n})\n</code></pre>\n<p>Cette API doit être appelée après l'émission de l'événement <code>ready</code> .</p>\n<h3 id=\"appdisablehardwareacceleration\"><a href=\"#appdisablehardwareacceleration\"><code>app.disableHardwareAcceleration()</code></a></h3>\n<p>Désactive l'accélération matérielle pour l'application courante.</p>\n<p>Cette méthode peut seulement être appelée avant que app soit prêt.</p>\n<h3 id=\"appdisabledomainblockingfor3dapis\"><a href=\"#appdisabledomainblockingfor3dapis\"><code>app.disableDomainBlockingFor3DAPIs()</code></a></h3>\n<p>By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain basis if the GPU processes crashes too frequently. Cette fonction désactive ce comportement.</p>\n<p>Cette méthode peut seulement être appelée avant que app soit prêt.</p>\n<h3 id=\"appgetappmetrics\"><a href=\"#appgetappmetrics\"><code>app.getAppMetrics()</code></a></h3>\n<p>Retourne <a href=\"/docs/api/structures/process-metric\"><code>ProcessMetric[]</code></a> : Tableau d'objets <code>ProcessMetric</code> correspondant aux statistiques d'utilisation de la mémoire et du processeur de tous les processus associés à l'application.</p>\n<h3 id=\"appgetgpufeaturestatus\"><a href=\"#appgetgpufeaturestatus\"><code>app.getGPUFeatureStatus()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/gpu-feature-status\"><code>GPUFeatureStatus</code></a> - L'état des fonctions graphiques de <code>chrome://gpu/</code>.</p>\n<p><strong>Remarque :</strong> Cette information n'est utilisable qu'après l'émission de l'événement <code>gpu-info-update</code>.</p>\n<h3 id=\"appgetgpuinfoinfotype\"><a href=\"#appgetgpuinfoinfotype\"><code>app.getGPUInfo(infoType)</code></a></h3>\n<ul>\n<li><code>infoType</code> String - Peut être <code>basique</code> ou <code>complete</code>.</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;unknown></code></p>\n<p>Si <code>infoType</code> vaut <code>complete</code> : La Promise est remplie avec <code>Object</code> contenant toutes les informations sur le GPU, comme pour <a href=\"https://chromium.googlesource.com/chromium/src/+/4178e190e9da409b055e5dff469911ec6f6b716f/gpu/config/gpu_info.cc\">l'objet GPUInfo de Chromium</a>. Cela inclut les informations de version et driver montrées sur la page <code>chrome://gpu</code>.</p>\n<p>Si <code>infoType</code> vaut <code>basic</code> : La Promise est remplie avec <code>Object</code> contenant moins d'attributs que si l'on utilise <code>complete</code>. Voilà un exemple de réponse basique :</p>\n<pre><code class=\"hljs language-js\">{\n  <span class=\"hljs-attr\">auxAttributes</span>:\n   {\n     <span class=\"hljs-attr\">amdSwitchable</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">canSupportThreadedTextureMailbox</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">directComposition</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">directRendering</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">glResetNotificationStrategy</span>: <span class=\"hljs-number\">0</span>,\n     <span class=\"hljs-attr\">inProcessGpu</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">initializationTime</span>: <span class=\"hljs-number\">0</span>,\n     <span class=\"hljs-attr\">jpegDecodeAcceleratorSupported</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">optimus</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">passthroughCmdDecoder</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">sandboxed</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">softwareRendering</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">supportsOverlays</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">videoDecodeAcceleratorFlags</span>: <span class=\"hljs-number\">0</span>\n   },\n  <span class=\"hljs-attr\">gpuDevice</span>:\n   [{ <span class=\"hljs-attr\">active</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">deviceId</span>: <span class=\"hljs-number\">26657</span>, <span class=\"hljs-attr\">vendorId</span>: <span class=\"hljs-number\">4098</span> },\n     { <span class=\"hljs-attr\">active</span>: <span class=\"hljs-literal\">false</span>, <span class=\"hljs-attr\">deviceId</span>: <span class=\"hljs-number\">3366</span>, <span class=\"hljs-attr\">vendorId</span>: <span class=\"hljs-number\">32902</span> }],\n  <span class=\"hljs-attr\">machineModelName</span>: <span class=\"hljs-string\">'MacBookPro'</span>,\n  <span class=\"hljs-attr\">machineModelVersion</span>: <span class=\"hljs-string\">'11.5'</span>\n}\n</code></pre>\n<p><code>basic</code> devrait être priorisé si vous n'avez besoin que d'informations basiques telles que <code>vendorId</code> ou <code>driverId</code>.</p>\n<h3 id=\"appsetbadgecountcount-linux-macos\"><a href=\"#appsetbadgecountcount-linux-macos\"><code>app.setBadgeCount([count])</code> <em>Linux</em> <em>macOS</em></a></h3>\n<ul>\n<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). Sous Linux, si aucune valeur n'est fournie, le badge ne s'affichera pas.</li>\n</ul>\n<p>Returns <code>Boolean</code> - Si l'appel a réussi.</p>\n<p>Sets the counter badge for current app. Setting the count to <code>0</code> will hide the badge.</p>\n<p>Sur macOS, il s'affiche sur l'icône du dock. Sous Linux, il ne fonctionne que pour le lanceur Unity.</p>\n<p><strong>Remarque :</strong> Le lanceur Unity nécessite un fichier <code>.desktop</code> pour fonctionner. Pour plus d’informations, lisez la <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">documentation d’intégration Unity</a>.</p>\n<h3 id=\"appgetbadgecount-linux-macos\"><a href=\"#appgetbadgecount-linux-macos\"><code>app.getBadgeCount()</code> <em>Linux</em> <em>macOS</em></a></h3>\n<p>Retourne <code>Integer</code> - La valeur actuelle affichée sur le badge du compteur.</p>\n<h3 id=\"appisunityrunning-linux\"><a href=\"#appisunityrunning-linux\"><code>app.isUnityRunning()</code> <em>Linux</em></a></h3>\n<p>Retourne <code>Boolean</code> - Si l'environnement de bureau actuel est Unity launcher.</p>\n<h3 id=\"appgetloginitemsettingsoptions-macos-windows\"><a href=\"#appgetloginitemsettingsoptions-macos-windows\"><code>app.getLoginItemSettings([options])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>path</code> String (optional) <em>Windows</em> - The executable path to compare against. Defaults to <code>process.execPath</code>.</li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - The command-line arguments to compare against. Defaults to an empty array.</li>\n</ul></li>\n</ul>\n<p>Si vous avez fourni des options <code>path</code> et <code>args</code> à <code>app.setLoginItemSettings</code>, vous devez passer les mêmes arguments ici pour que <code>openAtLogin</code> soit défini correctement.</p>\n<p>Retourne <code>Object</code>:</p>\n<ul>\n<li><code>openAtLogin</code> Boolean - <code>true</code> si l'application est configurée pour démarrer à l'ouverture de session.</li>\n<li><code>openAsHidden</code> Boolean <em>macOS</em> - <code>true</code> if the app is set to open as hidden at login. Ce paramètre n'est pas disponible sur les <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>wasOpenedAtLogin</code> Boolean <em>macOS</em> - <code>true</code> if the app was opened at login automatically. Ce paramètre n'est pas disponible sur les <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>wasOpenedAsHidden</code> Boolean <em>macOS</em> - <code>true</code> if the app was opened as a hidden login item. Cela indique que l'application ne devrait pas ouvrir la moindre fenêtre au démarrage. Ce paramètre n'est pas disponible sur les <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>restoreState</code> Boolean <em>macOS</em> - <code>true</code> if the app was opened as a login item that should restore the state from the previous session. Cela indique que l'application devrait restaurer les fenêtres qui étaient ouvertes lorsque celle-ci a été précédemment fermée. Ce paramètre n'est pas disponible sur les <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>executableWillLaunchAtLogin</code> Boolean <em>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>\n<li><code>launchItems</code> Object[] <em>Windows</em><ul>\n<li><code>name</code> String <em>Windows</em> - name value of a registry entry.</li>\n<li><code>path</code> String <em>Windows</em> - The executable to an app that corresponds to a registry entry.</li>\n<li><code>args</code> String[] <em>Windows</em> - the command-line arguments to pass to the executable.</li>\n<li><code>scope</code> String <em>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>\n<li><code>enabled</code> Boolean <em>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>\n</ul></li>\n</ul>\n<h3 id=\"appsetloginitemsettingssettings-macos-windows\"><a href=\"#appsetloginitemsettingssettings-macos-windows\"><code>app.setLoginItemSettings(settings)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>settings</code> Object<ul>\n<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. Par défaut, <code>faux</code>.</li>\n<li><code>openAsHidden</code> Boolean (optional) <em>macOS</em> - <code>true</code> to open the app as hidden. <code>false</code> par défaut. L'utilisateur peut éditer ce paramètre depuis les Préférences Système, alors <code>app.getLoginItemSettings().wasOpenedAsHidden</code> va être vérifié lorsque l'app sera ouverte pour connaître la valeur actuelle. Ce paramètre n'est pas disponible sur les <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>path</code> String (optional) <em>Windows</em> - The executable to launch at login. Defaults to <code>process.execPath</code>.</li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - The command-line arguments to pass to the executable. Defaults to an empty array. Take care to wrap paths in quotes.</li>\n<li><code>enabled</code> Boolean (optional) <em>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. Par défaut, <code>true</code>.</li>\n<li><code>name</code> String (optional) <em>Windows</em> - value name to write into registry. Defaults to the app's AppUserModelId(). Configurer les paramètres de l'application lors de l'ouverture de session.</li>\n</ul></li>\n</ul>\n<p>Pour fonctionner avec <code>autoUpdater</code> d'Electron sur Windows, qui utilise <a href=\"https://github.com/Squirrel/Squirrel.Windows\">Squirrel</a>, vous aurez besoin de configurer le chemin de démarrage de Update.exe et de lui passer les arguments qui définissent le nom de votre application. Par exemple :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> appFolder = path.dirname(process.execPath)\n<span class=\"hljs-keyword\">const</span> updateExe = path.resolve(appFolder, <span class=\"hljs-string\">'..'</span>, <span class=\"hljs-string\">'Update.exe'</span>)\n<span class=\"hljs-keyword\">const</span> exeName = path.basename(process.execPath)\n\napp.setLoginItemSettings({\n  <span class=\"hljs-attr\">openAtLogin</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">path</span>: updateExe,\n  <span class=\"hljs-attr\">args</span>: [\n    <span class=\"hljs-string\">'--processStart'</span>, <span class=\"hljs-string\">`\"<span class=\"hljs-subst\">${exeName}</span>\"`</span>,\n    <span class=\"hljs-string\">'--process-start-args'</span>, <span class=\"hljs-string\">`\"--hidden\"`</span>\n  ]\n})\n</code></pre>\n<h3 id=\"appisaccessibilitysupportenabled-macos-windows\"><a href=\"#appisaccessibilitysupportenabled-macos-windows\"><code>app.isAccessibilitySupportEnabled()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Retourne <code>Boolean</code> - <code>true</code> si le support des fonctionnalités d'accessibilité de Chrome est activé, <code>false</code> sinon. Cette API retournera <code>true</code> si les technologies d'assistance, comme les lecteurs d'écran, sont détectées. Voir <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">https://www.chromium.org/developers/design-documents/accessibility</a> pour de plus amples informations.</p>\n<h3 id=\"appsetaccessibilitysupportenabledenabled-macos-windows\"><a href=\"#appsetaccessibilitysupportenabledenabled-macos-windows\"><code>app.setAccessibilitySupportEnabled(enabled)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>enabled</code> Boolean - Active ou désactive le rendu de <a href=\"https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree\">l'arbre d'accessibilité</a></li>\n</ul>\n<p>Active manuellement le support de l'accessibilité de Chrome, permettant de mettre à disposition des utilisateurs les commutateurs d'accessibilité dans les paramètres de l'application. Consultez les <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">documents d'accessibilité de Chromium</a> pour plus de détails. Désactivé par défaut.</p>\n<p>Cette API doit être appelée après l'émission de l'événement <code>ready</code> .</p>\n<p><strong>Note:</strong> Rendering accessibility tree can significantly affect the performance of your app. Il ne doit pas être activé par défaut.</p>\n<h3 id=\"appshowaboutpanel\"><a href=\"#appshowaboutpanel\"><code>app.showAboutPanel()</code></a></h3>\n<p>Show the app's about panel options. These options can be overridden with <code>app.setAboutPanelOptions(options)</code>.</p>\n<h3 id=\"appsetaboutpaneloptionsoptions\"><a href=\"#appsetaboutpaneloptionsoptions\"><code>app.setAboutPanelOptions(options)</code></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>applicationName</code> String (optional) - Nom de l'application.</li>\n<li><code>applicationVersion</code> String (optional) - Version de l'application.</li>\n<li><code>copyright</code> String (optional) - Information copyright.</li>\n<li><code>version</code> String (optional) <em>macOS</em> - The app's build version number.</li>\n<li><code>credits</code> String (optional) <em>macOS</em> <em>Windows</em> - Credit information.</li>\n<li><code>authors</code> String<a href=\"/docs/api/optional\"></a> <em>Linux</em> - List of app authors.</li>\n<li><code>website</code> String (optional) <em>Linux</em> - The app's website.</li>\n<li><code>iconPath</code> String (optional) <em>Linux</em> <em>Windows</em> - Path to the app's icon in a JPEG or PNG file format. Sous Linux, sera affiché en 64x64 pixels tout en conservant le ratio.</li>\n</ul></li>\n</ul>\n<p>Configure les options de la fenêtre À propos de. This will override the values defined in the app's <code>.plist</code> file on macOS. Voir <a href=\"https://developer.apple.com/reference/appkit/nsapplication/1428479-orderfrontstandardaboutpanelwith?language=objc\">la documentation Apple</a> pour de plus amples informations. Sous Linux, les valeurs doivent être définies pour être affichées ; il n'y a pas de valeurs par défaut.</p>\n<p>Si vous ne définissez pas <code>credits</code> mais vous souhaitez quand même les afficher dans votre app, AppKit cherchera un fichier nommé \"Credits.html\", \"Credits.rtf\", et \"Credits.rtfd\", dans cet ordre, dans le bundle retourné par la méthode la classe main de NSBundle. Le premier fichier trouvé est utilisé, et si aucun n'est trouvé, la zone info est laissée vide. Consultez la <a href=\"https://developer.apple.com/documentation/appkit/nsaboutpaneloptioncredits?language=objc\">documentation</a> Apple pour plus d'informations.</p>\n<h3 id=\"appisemojipanelsupported\"><a href=\"#appisemojipanelsupported\"><code>app.isEmojiPanelSupported()</code></a></h3>\n<p>Retourne <code>Boolean</code> - que la version actuelle de l'OS autorise ou non les sélecteurs natifs d'émojis.</p>\n<h3 id=\"appshowemojipanel-macos-windows\"><a href=\"#appshowemojipanel-macos-windows\"><code>app.showEmojiPanel()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Montrer le sélecteur d'émoji natif de la plateforme.</p>\n<h3 id=\"appstartaccessingsecurityscopedresourcebookmarkdata-mas\"><a href=\"#appstartaccessingsecurityscopedresourcebookmarkdata-mas\"><code>app.startAccessingSecurityScopedResource(bookmarkData)</code> <em>mas</em></a></h3>\n<ul>\n<li><code>bookmarkData</code> String - Les données de marque-page encodées en base64 renvoyées par les méthodes <code>dialog.showOpenDialog</code> où <code>dialog.showSaveDialog</code>.</li>\n</ul>\n<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://developer.apple.com/reference/foundation/nsurl/1417051-startaccessingsecurityscopedreso?language=objc\">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>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Commence à accéder au fichier.</span>\n<span class=\"hljs-keyword\">const</span> stopAccessingSecurityScopedResource = app.startAccessingSecurityScopedResource(data)\n<span class=\"hljs-comment\">// You can now access the file outside of the sandbox 🎉</span>\n\n<span class=\"hljs-comment\">// Remember to stop accessing the file once you've finished with it.</span>\nstopAccessingSecurityScopedResource()\n</code></pre>\n<p>Commencez à accéder à une ressource périmée de sécurité. Avec cette méthode, les applications Electron qui sont empaquetées pour le Mac App Store peuvent atteindre en dehors de leur sandbox pour accéder aux fichiers choisis par l'utilisateur. Voir la documentation de <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">Apple</a> pour une description du fonctionnement de ce système.</p>\n<h3 id=\"appenablesandbox\"><a href=\"#appenablesandbox\"><code>app.enableSandbox()</code></a></h3>\n<p>Active le mode \"full sandbox\" dans l'application. This means that all renderers will be launched sandboxed, regardless of the value of the <code>sandbox</code> flag in WebPreferences.</p>\n<p>Cette méthode peut seulement être appelée avant que app soit prêt.</p>\n<h3 id=\"appisinapplicationsfolder-macos\"><a href=\"#appisinapplicationsfolder-macos\"><code>app.isInApplicationsFolder()</code> <em>macOS</em></a></h3>\n<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>\n<h3 id=\"appmovetoapplicationsfolderoptions-macos\"><a href=\"#appmovetoapplicationsfolderoptions-macos\"><code>app.moveToApplicationsFolder([options])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>conflictHandler</code> Function\\<boolean> (optional) - A handler for potential conflict in move failure.<ul>\n<li><code>conflictType</code> String - Le type de conflit de déplacement rencontré par le gestionnaire ; peut être <code>exists</code> ou <code>existsAndRunning</code>, où <code>existe</code> signifie qu'une application du même nom est présente dans le répertoire Applications et <code>existsAndRunning</code> signifie à la fois qu'elle existe et qu'elle est actuellement en cours d'exécution.</li>\n</ul></boolean></li>\n</ul></li>\n</ul>\n<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>\n<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=\"/docs/api/dialog\"><code>dialog</code></a> API.</p>\n<p><strong>NOTE:</strong> This method throws errors if anything other than the user causes the move to fail. Par exemple, si l'utilisateur annule la boîte de dialogue d'autorisation, cette méthode renvoie false. Si nous ne réussissons pas à effectuer la copie, alors cette méthode lancera une erreur. The message in the error should be informative and tell you exactly what went wrong.</p>\n<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. Ce comportement peut être modifié en fournissant le gestionnaire de conflits facultatif, où le booléen retourné par le gestionnaire détermine si le conflit de déplacement est résolu avec le comportement par défaut.  c'est-à-dire que retourner <code>false</code> ne garantira aucune action supplémentaire, retourner <code>true</code> entraînera le comportement par défaut et la méthode continuera.</p>\n<p>Par exemple :</p>\n<pre><code class=\"hljs language-js\">app.moveToApplicationsFolder({\n  <span class=\"hljs-attr\">ConftHandler</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">conflictType</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (conflictType === <span class=\"hljs-string\">'exiss'</span>) {\n      dialogue de retour. howMessageBoxSync({\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'question'</span>,\n        <span class=\"hljs-attr\">boutons</span>: [<span class=\"hljs-string\">'Halter le déplacement'</span>, <span class=\"hljs-string\">'Continuer le déplacement'</span>],\n        <span class=\"hljs-attr\">defaultId</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">message</span> : <span class=\"hljs-string\">'Une application de ce nom existe déjà'</span>\n      }) === <span class=\"hljs-number\">1</span>\n    }\n  }\n})\n</code></pre>\n<p>Cela signifierait que si une application existe déjà dans le répertoire de l'utilisateur, si l'utilisateur choisit de \"Continuer le déplacement\", alors la fonction continuera avec son comportement par défaut et l'application existante sera mise à la corbeille et l'application active sera déplacée à sa place.</p>\n<h3 id=\"appissecurekeyboardentryenabled-macos\"><a href=\"#appissecurekeyboardentryenabled-macos\"><code>app.isSecureKeyboardEntryEnabled()</code> <em>macOS</em></a></h3>\n<p>Returns <code>Boolean</code> - whether <code>Secure Keyboard Entry</code> is enabled.</p>\n<p>Par défaut cette API retournera <code>false</code>.</p>\n<h3 id=\"appsetsecurekeyboardentryenabledenabled-macos\"><a href=\"#appsetsecurekeyboardentryenabledenabled-macos\"><code>app.setSecureKeyboardEntryEnabled(enabled)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>enabled</code> Boolean - Enable or disable <code>Secure Keyboard Entry</code></li>\n</ul>\n<p>Set the <code>Secure Keyboard Entry</code> is enabled in your application.</p>\n<p>By using this API, important information such as password and other sensitive information can be prevented from being intercepted by other processes.</p>\n<p>See <a href=\"https://developer.apple.com/library/archive/technotes/tn2150/_index.html\">Apple's documentation</a> for more details.</p>\n<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>\n<h2 id=\"propriétés\"><a href=\"#propriétés\">Propriétés</a></h2>\n<h3 id=\"appaccessibilitysupportenabled-macos-windows\"><a href=\"#appaccessibilitysupportenabled-macos-windows\"><code>app.accessibilitySupportEnabled</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Une propriété <code>Booléen</code> qui est <code>vraie</code> si le support d'accessibilité de Chrome est activé, <code>faux</code> sinon. Cette propriété sera <code>true</code> si l'utilisation de technologies d'assistance, telles que les lecteurs d'écran, a été détectée. Définir cette propriété à <code>true</code> active manuellement la prise en charge de l'accessibilité de Chrome, permettant aux développeurs d'exposer le basculement d'accessibilité aux utilisateurs dans les paramètres de l'application.</p>\n<p>See <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">Chromium's accessibility docs</a> for more details. Désactivé par défaut.</p>\n<p>Cette API doit être appelée après l'émission de l'événement <code>ready</code> .</p>\n<p><strong>Note:</strong> Rendering accessibility tree can significantly affect the performance of your app. Il ne doit pas être activé par défaut.</p>\n<h3 id=\"appapplicationmenu\"><a href=\"#appapplicationmenu\"><code>app.applicationMenu</code></a></h3>\n<p>Une propriété <code>Menu | null</code> qui renvoie <a href=\"/docs/api/menu\"><code>Menu</code></a> si on a été défini et <code>null</code> autrement. Les utilisateurs peuvent passer un <a href=\"/docs/api/menu\">Menu</a> pour définir cette propriété.</p>\n<h3 id=\"appbadgecount-linux-macos\"><a href=\"#appbadgecount-linux-macos\"><code>app.badgeCount</code> <em>Linux</em> <em>macOS</em></a></h3>\n<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>\n<p>On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher.</p>\n<p><strong>Remarque :</strong> Le lanceur Unity nécessite un fichier <code>.desktop</code> pour fonctionner. Pour plus d’informations, lisez la <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">documentation d’intégration Unity</a>.</p>\n<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>\n<h3 id=\"appcommandline-readonly\"><a href=\"#appcommandline-readonly\"><code>app.commandLine</code> <em>Readonly</em></a></h3>\n<p>Un objet <a href=\"/docs/api/command-line\"><code>CommandLine</code></a> qui vous permet de lire et de manipuler les arguments de ligne de commande que Chromium utilise.</p>\n<h3 id=\"appdock-macos-readonly\"><a href=\"#appdock-macos-readonly\"><code>app.dock</code> <em>macOS</em> <em>Readonly</em></a></h3>\n<p>A <a href=\"/docs/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>\n<h3 id=\"appispackaged-readonly\"><a href=\"#appispackaged-readonly\"><code>app.isPackaged</code> <em>Readonly</em></a></h3>\n<p>Une propriété <code>Boolean</code> qui renvoie <code>true</code> si l'application est packagée, <code>false</code> sinon. Pour de nombreuses applications, cette propriété peut être utilisée pour distinguer les environnements de développement et de production.</p>\n<h3 id=\"nom-de-lapplication\"><a href=\"#nom-de-lapplication\"><code>nom de l'application</code></a></h3>\n<p>Une propriété <code>String</code> qui indique le nom de l'application courante, qui est le nom dans le fichier <code>package.json</code> de l'application.</p>\n<p>Habituellement, le champ <code>name</code> de <code>package.json</code> est un nom court en minuscule, selon la spécification des modules npm. Vous devriez dans la plupart des cas renseigner également un champ <code>productName</code>, qui contient le nom complet et capitalisé de votre application, et qui sera préféré à <code>name</code> par Electron.</p>\n<h3 id=\"format0-appuseragentfallback\"><a href=\"#format0-appuseragentfallback\"><code>format@@0 app.userAgentFallback</code></a></h3>\n<p>Une <code>String</code> qui est la chaîne d'agent utilisateur que Electron utilisera comme solution de repli global.</p>\n<p>C'est l'agent utilisateur qui sera utilisé quand aucun agent utilisateur n'est défini au niveau <code>webContents</code> ou <code>session</code>.  Il est utile pour s'assurer que l'ensemble de votre application a le même agent utilisateur.  Définissez une valeur personnalisée dès que possible dans l'initialisation de votre application pour vous assurer que votre valeur remplacée est utilisée.</p>\n<h3 id=\"apprunningunderrosettatranslation-macos-readonly-deprecated\"><a href=\"#apprunningunderrosettatranslation-macos-readonly-deprecated\"><code>app.runningUnderRosettaTranslation</code> <em>macOS</em> <em>Readonly</em> <em>Deprecated</em></a></h3>\n<p>A <code>Boolean</code> which when <code>true</code> indicates that the app is currently running under the <a href=\"https://en.wikipedia.org/wiki/Rosetta_(software)\">Rosetta Translator Environment</a>.</p>\n<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>\n<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>\n<h3 id=\"apprunningunderarm64translation-readonly-macos-windows\"><a href=\"#apprunningunderarm64translation-readonly-macos-windows\"><code>app.runningUnderARM64Translation</code> <em>Readonly</em> <em>macOS</em> <em>Windows</em></a></h3>\n<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://en.wikipedia.org/wiki/Rosetta_(software)\">Rosetta Translator Environment</a> or Windows <a href=\"https://en.wikipedia.org/wiki/Windows_on_Windows\">WOW</a>).</p>\n<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>",
      "title": "app",
      "description": "Contrôle le cycle de vie des événements de votre application."
    },
    "/docs/tutorial/application-debugging": {
      "locale": "fr-FR",
      "slug": "application-debugging",
      "href": "/docs/tutorial/application-debugging",
      "crowdinFileId": "256175",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/application-debugging.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"débogage-de-lapplication\"><a href=\"#débogage-de-lapplication\">Débogage de l’application</a></h1>\n<p>Chaque fois que votre application Electron ne se comporte pas comme vous le souhaitez, un panel d'outils de débogage peut vous aider à trouver des erreurs de code, des goulots d’étranglement ou possibilités d’optimisation.</p>\n<h2 id=\"processus-de-rendu-renderer-process\"><a href=\"#processus-de-rendu-renderer-process\">Processus de rendu (renderer process)</a></h2>\n<p>L’outil le plus complet pour déboguer les processus individuels de rendu est le Chromium Developer Toolset. Il est disponible pour tous les processus de rendu, y compris les instances de <code>BrowserWindow</code>, <code>BrowserView</code> et <code>WebView</code>. Vous pouvez les ouvrir en appelant l'API <code>openDevTools()</code> sur le <code>webContents</code> de l’instance :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.openDevTools()\n</code></pre>\n<p>Google offre <a href=\"https://developer.chrome.com/devtools\">une excellente documentation pour leurs outils de développement</a>. Nous vous recommandons que vous vous familiariser avec eux - ils sont généralement un des utilitaires plus puissants dans le panel d’outil à disposition des développeur Electron.</p>\n<h2 id=\"processus-principal\"><a href=\"#processus-principal\">Processus principal</a></h2>\n<p>Déboguer le processus principal est un peu plus compliqué, car vous ne pouvez pas ouvrir les outils de développement. Le Chromium Developer Tool peut <a href=\"https://nodejs.org/en/docs/inspector/\">être utilisé pour déboguer le processus principal d'Electron</a> grâce à une collaboration plus étroite entre Google / Chrome et Node.js, mais vous risquez de rencontrer des étrangetés comme <code>require</code> n’étant pas présent dans la console.</p>\n<p>Pour plus d'informations, voir la <a href=\"/docs/tutorial/debugging-main-process\">documentation sur le Débogage du processus principal</a>.</p>\n<h2 id=\"v8-crashes\"><a href=\"#v8-crashes\">V8 Crashes</a></h2>\n<p>If the V8 context crashes, the DevTools will display this message.</p>\n<p><code>DevTools was disconnected from the page. Once page is reloaded, DevTools will automatically reconnect.</code></p>\n<p>Chromium logs can be enabled via the <code>ELECTRON_ENABLE_LOGGING</code> environment variable. For more information, see the <a href=\"/docs/api/environment-variables#electron_enable_logging\">environment variables documentation</a>.</p>\n<p>Alternatively, the command line argument <code>--enable-logging</code> can be passed. Plus d'informations sont disponibles dans la <a href=\"/docs/api/command-line-switches#--enable-loggingfile\">documentation des commutateurs de ligne de commande</a>.</p>",
      "title": "Débogage de l’application",
      "description": ""
    },
    "/docs/tutorial/application-distribution": {
      "locale": "fr-FR",
      "slug": "application-distribution",
      "href": "/docs/tutorial/application-distribution",
      "crowdinFileId": "256177",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/application-distribution.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"distribution-de-lapplication\"><a href=\"#distribution-de-lapplication\">Distribution de l'Application</a></h1>\n<h2 id=\"vue-densemble\"><a href=\"#vue-densemble\">Vue d'ensemble</a></h2>\n<p>Pour distribuer votre application avec Electron, vous devez l’empaqueter et la rebaptiser. Pour ce faire, vous pouvez utiliser des outils spécialisés ou une approche manuelle.</p>\n<h2 id=\"avec-des-outils\"><a href=\"#avec-des-outils\">Avec des Outils</a></h2>\n<p>Vous pouvez utiliser les outils suivants pour distribuer votre application :</p>\n<ul>\n<li><a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a></li>\n<li><a href=\"https://github.com/electron-userland/electron-builder\">electron-builder</a></li>\n<li><a href=\"https://github.com/electron/electron-packager\">electron-packager</a></li>\n</ul>\n<p>Ces outils se chargeront des différentes opérations nécessaires à l'obtention d'une application Electron distribuable telles que l'empaquetage, le renommage de l'exécutable et l'initialisation des icones.</p>\n<p>Vous pouvez consulter un exemple de la façon d’empaquetage d'une application avec <code>electron-forge</code> dans le guide <a href=\"/docs/tutorial/quick-start#package-and-distribute-your-application\">de démarrage rapide</a>.</p>\n<h2 id=\"répartition-manuelle\"><a href=\"#répartition-manuelle\">Répartition manuelle</a></h2>\n<h3 id=\"avec-des-binaires-précompilés\"><a href=\"#avec-des-binaires-précompilés\">Avec des binaires précompilés</a></h3>\n<p>To distribute your app manually, you need to download Electron's <a href=\"https://github.com/electron/electron/releases\">prebuilt binaries</a>. Ensuite, le dossier qui contient votre application devrait être nommé <code>app</code> et placé dans le répertoire de ressources d'Electron, comme illustré dans les exemples suivants.</p>\n<blockquote>\n<p><em>NOTE:</em> the location of Electron's prebuilt binaries is indicated with <code>electron/</code> in the examples below.</p>\n</blockquote>\n<p><em>Sur macOS :</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/Electron.app/Contents/Resources/app/\n├── package.json\n├── main.js\n└── index.html\n</code></pre>\n<p><em>Sur Windows et Linux :</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/resources/app\n├── package.json\n├── main.js\n└── index.html\n</code></pre>\n<p>Exécutez ensuite <code>Electron.app</code> sous macOS, <code>electron</code> sous Linux ou <code>electron.exe</code> sous Windows, et Electron démarrera en tant qu'application. The <code>electron</code> directory will then be your distribution to deliver to users.</p>\n<h3 id=\"with-an-app-source-code-archive\"><a href=\"#with-an-app-source-code-archive\">With an app source code archive</a></h3>\n<p>Instead of from shipping your app by copying all of its source files, you can package your app into an <a href=\"https://github.com/electron/asar\">asar</a> archive to improve the performance of reading files on platforms like Windows, if you are not already using a bundler such as Parcel or Webpack.</p>\n<p>Pour utiliser une archive <code>asar</code> au lieu du dossier <code>app</code>, vous devez renommer l'archive en <code>app.asar</code> et la placer dans le dossier ressources d'Electron comme ci-dessous. Ainsi, Electron va essayer de lire l'archive et de se lancer à partir de celle-ci.</p>\n<p><em>Sur macOS :</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/Electron.app/Contents/Resources/\n└── app.asar\n</code></pre>\n<p><em>Sur Windows et Linux :</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/resources/\n└── app.asar\n</code></pre>\n<p>You can find more details on how to use <code>asar</code> in the <a href=\"https://github.com/electron/asar\"><code>electron/asar</code> repository</a>.</p>\n<h3 id=\"rebranding-with-downloaded-binaries\"><a href=\"#rebranding-with-downloaded-binaries\">Rebranding with downloaded binaries</a></h3>\n<p>Après avoir empaqueté votre application dans Electron, vous voudrez renommer votre application avant de la distribuer aux utilisateurs.</p>\n<h4 id=\"macos\"><a href=\"#macos\">macOS</a></h4>\n<p>Vous pouvez renommer <code>Electron.app</code> en n'importe quel nom qui vous plaît, et vous devrez aussi renommer les champs <code>CFBundleDisplayName</code>, <code>CFBundleIdentifier</code> and <code>CFBundleName</code> dans les fichiers suivants :</p>\n<ul>\n<li><code>Electron.app/Contents/Info.plist</code></li>\n<li><code>Electron.app/Contents/Frameworks/Electron Helper.app/Contents/Info.plist</code></li>\n</ul>\n<p>Vous pouvez aussi renommer l'application d'aide pour éviter d'afficher <code>Electron Helper</code> dans le moniteur d'activité, mais assurez vous d'avoir renommé le nom du fichier exécutable de l'application d'aide.</p>\n<p>La structure d'une application renommée serait comme :</p>\n<pre><code class=\"hljs language-plaintext\">MyApp.app/Contents\n├── Info.plist\n├── MacOS/\n│   └── MyApp\n└── Frameworks/\n    └── MyApp Helper.app\n        ├── Info.plist\n        └── MacOS/\n            └── MyApp Helper\n</code></pre>\n<h4 id=\"windows\"><a href=\"#windows\">Windows</a></h4>\n<p>Vous pouvez renommer <code>electron.exe</code> en n'importe quel nom qui vous plaît, et modifier son icône et d'autres informations avec des outils tels que <a href=\"https://github.com/electron/rcedit\">rcedit</a>.</p>\n<h4 id=\"linux\"><a href=\"#linux\">Linux</a></h4>\n<p>Vous pouvez renommer l'exécutable <code>electron</code> par ce que vous voulez.</p>\n<h3 id=\"rebranding-by-rebuilding-electron-from-source\"><a href=\"#rebranding-by-rebuilding-electron-from-source\">Rebranding by rebuilding Electron from source</a></h3>\n<p>Il est aussi possible de renommer Electron par le nom du produit et le compiler depuis le code source. Pour faire cela, vous devez définir les arguments de compilation correspondant au nom du produit (<code>electron_product_name = \"LeNomDeVotreProduit\"</code>) dans le fichier <code>args.gn</code> et recompiler.</p>",
      "title": "Distribution de l'Application",
      "description": "NOTE: the location of Electron's prebuilt binaries is indicated with electron/ in the examples below."
    },
    "/docs/api/auto-updater": {
      "locale": "fr-FR",
      "slug": "auto-updater",
      "href": "/docs/api/auto-updater",
      "crowdinFileId": "256281",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/auto-updater.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"autoupdater\"><a href=\"#autoupdater\">autoUpdater</a></h1>\n<blockquote>\n<p>Permet aux application de se mettre à jour automatiquement d'elles-mêmes.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><strong>Voir aussi : <a href=\"/docs/tutorial/updates\">Un guide détaillé à propos de l’implémentation des mises à jour dans votre application</a>.</strong></p>\n<p><code>autoUpdater</code> est un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h2 id=\"avertissement-sur-les-plateformes\"><a href=\"#avertissement-sur-les-plateformes\">Avertissement sur les plateformes</a></h2>\n<p>Pour le moment, seuls macOS et Windows sont supportés. Il n'y a aucune prise en charge de l'auto-update sur Linux, il est donc recommandé d'utiliser le gestionnaire de paquets de votre distribution afin de mettre à jour votre application.</p>\n<p>En outre, il y a quelques différences subtiles sur chaque plateforme :</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>Sur macOS, le module <code>autoUpdater</code> repose sur <a href=\"https://github.com/Squirrel/Squirrel.Mac\">Squirrel.Mac</a>, ce qui signifie que vous n'avez pas besoin d'une installation spécifique pour le faire fonctionner. Pour les besoins du côté serveur, vous pouvez lire <a href=\"https://github.com/Squirrel/Squirrel.Mac#server-support\">Le support du serveur</a>. Notez que l'<a href=\"https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW35\">App Transport Securité</a> (ATS) s'applique à toutes les demandes formulées dans le cadre du processus de mise à jour. Les applications qui ont besoin de désactiver l'ATS peut ajouter la clé <code>NSAllowsArbitraryLoads</code> à leur fichier plist.</p>\n<p><strong>Note:</strong> Votre application doit-être signée pour les mises à jour automatiques sur macOS. C'est un pré-requis de <code>Squirrel.Mac</code>.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<p>Sur Windows, vous devrez installer votre application sur la machine d'un utilisateur avant de pouvoir utiliser <code>autoUpdater</code>. Il est donc recommandé d'utiliser <a href=\"https://github.com/electron/windows-installer\">electron-winstaller</a>, <a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a> ou le package <a href=\"https://github.com/electron/grunt-electron-installer\">grunt-electron-installer</a> pour générer un installateur Windows.</p>\n<p>Lorsque vous utilisez <a href=\"https://github.com/electron/windows-installer\">electron-winstaller</a> ou <a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a>, assurez-vous de ne pas essayer de mettre à jour votre application <a href=\"https://github.com/electron/windows-installer#handling-squirrel-events\">à sa première exécution</a> (voir aussi <a href=\"https://github.com/electron/electron/issues/7155\">ce problème pour plus d'information</a>). Il est également recommandé d'utiliser <a href=\"https://github.com/mongodb-js/electron-squirrel-startup\">electron-squirrel-startup</a> pour avoir les raccourcis bureau pour votre application.</p>\n<p>The installer generated with Squirrel will create a shortcut icon with an <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> in the format of <code>com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE</code>, examples are <code>com.squirrel.slack.Slack</code> and <code>com.squirrel.code.Code</code>. Vous devez utiliser le même ID pour votre application qu'avec l'API <code>app.setAppUserModelId</code>, sinon Windows ne sera pas en mesure d'épingler correctement votre application dans la barre des tâches.</p>\n<p>Comme Squirrel.Mac, Windows peut héberger des mises à jour sur S3 ou tout autre hôte de fichiers statiques. You can read the documents of <a href=\"https://github.com/Squirrel/Squirrel.Windows\">Squirrel.Windows</a> to get more details about how Squirrel.Windows works.</p>\n<h2 id=\"événements\"><a href=\"#événements\">Événements</a></h2>\n<p>L'objet <code>autoUpdater</code> émet les événements suivants :</p>\n<h3 id=\"événement--error\"><a href=\"#événement--error\">Événement : 'error'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>error</code> Error</li>\n</ul>\n<p>Émis lorsqu’il y a une erreur pendant la mise à jour.</p>\n<h3 id=\"événement--checking-for-update\"><a href=\"#événement--checking-for-update\">Événement : 'checking-for-update'</a></h3>\n<p>Émis lors de la vérification du commencement d'une mise à jour.</p>\n<h3 id=\"événement--update-available\"><a href=\"#événement--update-available\">Événement : 'update-available'</a></h3>\n<p>Émis lorsqu'une mise à jour est disponible. La mise à jour est téléchargée automatiquement.</p>\n<h3 id=\"événement--update-not-available\"><a href=\"#événement--update-not-available\">Événement : 'update-not-available'</a></h3>\n<p>Émis quand il n’y a aucune mise à jour disponible.</p>\n<h3 id=\"événement--update-downloaded\"><a href=\"#événement--update-downloaded\">Événement : 'update-downloaded'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>releaseNotes</code> String</li>\n<li><code>releaseName</code> String</li>\n<li><code>releaseDate</code> Date</li>\n<li><code>updateURL</code> String</li>\n</ul>\n<p>Émis lorsqu'une mise à jour a été téléchargée.</p>\n<p>Sur Windows, seulement <code>releaseName</code> est disponible.</p>\n<p><strong>Note:</strong> It is not strictly necessary to handle this event. A successfully downloaded update will still be applied the next time the application starts.</p>\n<h3 id=\"événement--before-quit-for-update\"><a href=\"#événement--before-quit-for-update\">Événement : 'before-quit-for-update'</a></h3>\n<p>Cet événement est émis après qu'un utilisateur appelle <code>quitAndInstall()</code>.</p>\n<p>Quand cette API est appelée, l'événement <code>before-quit</code> n'est pas émis avant que toutes les fenêtres soient fermées. Ainsi vous devriez écouter cet évènement si vous voulez effectuer des actions avant que les fenêtres soient fermées et qu'un processus est entrain d'être arrêté, est écouter aussi <code>before-quit</code>.</p>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>L'objet <code>autoUpdater</code> dispose des méthodes suivantes :</p>\n<h3 id=\"autoupdatersetfeedurloptions\"><a href=\"#autoupdatersetfeedurloptions\"><code>autoUpdater.setFeedURL(options)</code></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>url</code> String</li>\n<li><code>headers</code> Record&#x3C;String, String> (optional) <em>macOS</em> - HTTP request headers.</li>\n<li><code>serverType</code> String (optional) <em>macOS</em> - Can be <code>json</code> or <code>default</code>, see the <a href=\"https://github.com/Squirrel/Squirrel.Mac\">Squirrel.Mac</a> README for more information.</li>\n</ul></li>\n</ul>\n<p>Définit l'<code>url</code> et initialise l'auto updater.</p>\n<h3 id=\"autoupdatergetfeedurl\"><a href=\"#autoupdatergetfeedurl\"><code>autoUpdater.getFeedURL()</code></a></h3>\n<p>Retourne <code>String</code> - L'URL de flux des mises à jour.</p>\n<h3 id=\"autoupdatercheckforupdates\"><a href=\"#autoupdatercheckforupdates\"><code>autoUpdater.checkForUpdates()</code></a></h3>\n<p>Demande au serveur s'il y a une mise à jour. You must call <code>setFeedURL</code> before using this API.</p>\n<p><strong>Note:</strong> If an update is available it will be downloaded automatically. Calling <code>autoUpdater.checkForUpdates()</code> twice will download the update two times.</p>\n<h3 id=\"autoupdaterquitandinstall\"><a href=\"#autoupdaterquitandinstall\"><code>autoUpdater.quitAndInstall()</code></a></h3>\n<p>Redémarre l'application et installe la mise à jour après son téléchargement. It should only be called after <code>update-downloaded</code> has been emitted.</p>\n<p>Derrière l'appel de <code>autoUpdater.quitAndInstall()</code> fermera toutes les applications windows en premier, appellera automatiquement <code>app.quit()</code> après que toutes les fenêtres aient été fermées.</p>\n<p><strong>Note:</strong> It is not strictly necessary to call this function to apply an update, as a successfully downloaded update will always be applied the next time the application starts.</p>",
      "title": "autoUpdater",
      "description": "Permet aux application de se mettre à jour automatiquement d'elles-mêmes."
    },
    "/docs/tutorial/automated-testing-with-a-custom-driver": {
      "locale": "fr-FR",
      "slug": "automated-testing-with-a-custom-driver",
      "href": "/docs/tutorial/automated-testing-with-a-custom-driver",
      "crowdinFileId": "256179",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/automated-testing-with-a-custom-driver.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"test-automatisé-avec-un-driver-personalisé\"><a href=\"#test-automatisé-avec-un-driver-personalisé\">Test automatisé avec un driver personalisé</a></h1>\n<p>Afin d'écrire des tests automatisés pour votre application Electron, vous aurez besoin d'un moyen de \"piloter\" votre application. <a href=\"https://electronjs.org/spectron\">Spectron</a> est une solution usuelle, qui vous laisse émuler des actions utilisateur avec <a href=\"https://webdriver.io/\">WebDriver</a>. Toutefois, il est également possible d'écrire votre propre driver personnalisé avec l'IPC-over-STDIO intégré à node.js. L'avantage d'un driver personnalisé est qu'il demande moins de ressources que Spectron, et qu'il vous laisse éprouver des méthodes personnalisées à votre suite de tests.</p>\n<p>To create a custom driver, we'll use Node.js' <a href=\"https://nodejs.org/api/child_process.html\">child_process</a> API. La suite de tests fera apparaître le processus Electron, puis établira un protocole de messagerie basique :</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> childProcess = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'child_process'</span>)\n<span class=\"hljs-keyword\">const</span> electronPath = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// spawn the process</span>\n<span class=\"hljs-keyword\">const</span> env = { <span class=\"hljs-comment\">/* ... */</span> }\n<span class=\"hljs-keyword\">const</span> stdio = [<span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'ipc'</span>]\n<span class=\"hljs-keyword\">const</span> appProcess = childProcess.spawn(electronPath, [<span class=\"hljs-string\">'./app'</span>], { stdio, env })\n\n<span class=\"hljs-comment\">// listen for IPC messages from the app</span>\nappProcess.on(<span class=\"hljs-string\">'message'</span>, (msg) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// send an IPC message to the app</span>\nappProcess.send({ <span class=\"hljs-attr\">my</span>: <span class=\"hljs-string\">'message'</span> })\n</code></pre>\n<p>From within the Electron app, you can listen for messages and send replies using the Node.js <a href=\"https://nodejs.org/api/process.html\">process</a> API:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// listen for IPC messages from the test suite</span>\nprocess.on(<span class=\"hljs-string\">'message'</span>, (msg) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// send an IPC message to the test suite</span>\nprocess.send({ <span class=\"hljs-attr\">my</span>: <span class=\"hljs-string\">'message'</span> })\n</code></pre>\n<p>We can now communicate from the test suite to the Electron app using the <code>appProcess</code> object.</p>\n<p>For convenience, you may want to wrap <code>appProcess</code> in a driver object that provides more high-level functions. Here is an example of how you can do this:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">TestDriver</span> </span>{\n  <span class=\"hljs-keyword\">constructor</span> ({ path, args, env }) {\n    <span class=\"hljs-keyword\">this</span>.rpcCalls = []\n\n    <span class=\"hljs-comment\">// start child process</span>\n    env.APP_TEST_DRIVER = <span class=\"hljs-number\">1</span> <span class=\"hljs-comment\">// let the app know it should listen for messages</span>\n    <span class=\"hljs-keyword\">this</span>.process = childProcess.spawn(path, args, { <span class=\"hljs-attr\">stdio</span>: [<span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'ipc'</span>], env })\n\n    <span class=\"hljs-comment\">// handle rpc responses</span>\n    <span class=\"hljs-keyword\">this</span>.process.on(<span class=\"hljs-string\">'message'</span>, (message) => {\n      <span class=\"hljs-comment\">// pop the handler</span>\n      <span class=\"hljs-keyword\">const</span> rpcCall = <span class=\"hljs-keyword\">this</span>.rpcCalls[message.msgId]\n      <span class=\"hljs-keyword\">if</span> (!rpcCall) <span class=\"hljs-keyword\">return</span>\n      <span class=\"hljs-keyword\">this</span>.rpcCalls[message.msgId] = <span class=\"hljs-literal\">null</span>\n      <span class=\"hljs-comment\">// reject/resolve</span>\n      <span class=\"hljs-keyword\">if</span> (message.reject) rpcCall.reject(message.reject)\n      <span class=\"hljs-keyword\">else</span> rpcCall.resolve(message.resolve)\n    })\n\n    <span class=\"hljs-comment\">// wait for ready</span>\n    <span class=\"hljs-keyword\">this</span>.isReady = <span class=\"hljs-keyword\">this</span>.rpc(<span class=\"hljs-string\">'isReady'</span>).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">err</span>) =></span> {\n      <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Application failed to start'</span>, err)\n      <span class=\"hljs-keyword\">this</span>.stop()\n      process.exit(<span class=\"hljs-number\">1</span>)\n    })\n  }\n\n  <span class=\"hljs-comment\">// simple RPC call</span>\n  <span class=\"hljs-comment\">// to use: driver.rpc('method', 1, 2, 3).then(...)</span>\n  <span class=\"hljs-keyword\">async</span> rpc (cmd, ...args) {\n    <span class=\"hljs-comment\">// send rpc request</span>\n    <span class=\"hljs-keyword\">const</span> msgId = <span class=\"hljs-keyword\">this</span>.rpcCalls.length\n    <span class=\"hljs-keyword\">this</span>.process.send({ msgId, cmd, args })\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\">(<span class=\"hljs-params\">resolve, reject</span>) =></span> <span class=\"hljs-keyword\">this</span>.rpcCalls.push({ resolve, reject }))\n  }\n\n  stop () {\n    <span class=\"hljs-keyword\">this</span>.process.kill()\n  }\n}\n</code></pre>\n<p>In the app, you'd need to write a simple handler for the RPC calls:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">if</span> (process.env.APP_TEST_DRIVER) {\n  process.on(<span class=\"hljs-string\">'message'</span>, onMessage)\n}\n\n<span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">onMessage</span> (<span class=\"hljs-params\">{ msgId, cmd, args }</span>) </span>{\n  <span class=\"hljs-keyword\">let</span> method = METHODS[cmd]\n  <span class=\"hljs-keyword\">if</span> (!method) method = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Invalid method: '</span> + cmd)\n  <span class=\"hljs-keyword\">try</span> {\n    <span class=\"hljs-keyword\">const</span> resolve = <span class=\"hljs-keyword\">await</span> method(...args)\n    process.send({ msgId, resolve })\n  } <span class=\"hljs-keyword\">catch</span> (err) {\n    <span class=\"hljs-keyword\">const</span> reject = {\n      <span class=\"hljs-attr\">message</span>: err.message,\n      <span class=\"hljs-attr\">stack</span>: err.stack,\n      <span class=\"hljs-attr\">name</span>: err.name\n    }\n    process.send({ msgId, reject })\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> METHODS = {\n  isReady () {\n    <span class=\"hljs-comment\">// do any setup needed</span>\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-comment\">// define your RPC-able methods here</span>\n}\n</code></pre>\n<p>Then, in your test suite, you can use your test-driver as follows:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> test = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'ava'</span>)\n<span class=\"hljs-keyword\">const</span> electronPath = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> app = <span class=\"hljs-keyword\">new</span> TestDriver({\n  <span class=\"hljs-attr\">path</span>: electronPath,\n  <span class=\"hljs-attr\">args</span>: [<span class=\"hljs-string\">'./app'</span>],\n  <span class=\"hljs-attr\">env</span>: {\n    <span class=\"hljs-attr\">NODE_ENV</span>: <span class=\"hljs-string\">'test'</span>\n  }\n})\ntest.before(<span class=\"hljs-keyword\">async</span> t => {\n  <span class=\"hljs-keyword\">await</span> app.isReady\n})\ntest.after.always(<span class=\"hljs-string\">'cleanup'</span>, <span class=\"hljs-keyword\">async</span> t => {\n  <span class=\"hljs-keyword\">await</span> app.stop()\n})\n</code></pre>",
      "title": "Test automatisé avec un driver personalisé",
      "description": ""
    },
    "/docs/development/azure-vm-setup": {
      "locale": "fr-FR",
      "slug": "azure-vm-setup",
      "href": "/docs/development/azure-vm-setup",
      "crowdinFileId": "256129",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/azure-vm-setup.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"updating-an-appveyor-azure-image\"><a href=\"#updating-an-appveyor-azure-image\">Updating an Appveyor Azure Image</a></h1>\n<p>Electron CI on Windows uses AppVeyor, which in turn uses Azure VM images to run.  Occasionally, these VM images need to be updated due to changes in Chromium requirements.  In order to update you will need <a href=\"https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6\">PowerShell</a> and the <a href=\"https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-1.8.0&#x26;viewFallbackFrom=azurermps-6.13.0\">Azure PowerShell module</a>.</p>\n<p>Occasionally we need to update these images owing to changes in Chromium or other miscellaneous build requirement changes.</p>\n<p>Exemple de cas d'utilisation :\n* We need <code>VS15.9</code> and we have <code>VS15.7</code> installed; this would require us to update an Azure image.</p>\n<ol>\n<li>\n<p>Identifiez l'image que vous souhaitez modifier.</p>\n<ul>\n<li>Dans <a href=\"https://github.com/electron/electron/blob/main/appveyor.yml\">appveyor.yml</a>, l'image est identifiée par la propriété <em>image</em>.<ul>\n<li>The names used correspond to the <em>\"images\"</em> defined for a build cloud, eg the <a href=\"https://windows-ci.electronjs.org/build-clouds/8\">libcc-20 cloud</a>.</li>\n</ul></li>\n<li>Find the image you wish to modify in the build cloud and make note of the <strong>VHD Blob Path</strong> for that image, which is the value for that corresponding key.<ul>\n<li>You will need this URI path to copy into a new image.</li>\n</ul></li>\n<li>You will also need the storage account name which is labeled in AppVeyor as the <strong>Disk Storage Account Name</strong></li>\n</ul>\n</li>\n<li>\n<p>Get the Azure storage account key</p>\n<ul>\n<li>Log into Azure using credentials stored in LastPass (under Azure Enterprise) and then find the storage account corresponding to the name found in AppVeyor.<ul>\n<li>Exemple, pour <code>appveyorlibccbuilds</code> <strong>Disk Storage Account Name</strong> you'd look for <code>appveyorlibccbuilds</code> in the list of storage accounts @ Home &#x3C; Storage Accounts<ul>\n<li>Click into it and look for <code>Access Keys</code>, and then you can use any of the keys present in the list.</li>\n</ul></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Obtenir l'URI complet de l'image de la machine virtuelle à partir d'Azure</p>\n<ul>\n<li>Accédez aux &#x3C; de stockage &#x3C; <code>$ACCT_NAME</code> &#x3C; Blobs &#x3C; Images<ul>\n<li>In the following list, look for the VHD path name you got from Appveyor and then click on it.<ul>\n<li>Copiez l'URL entière depuis le haut de la fenêtre suivante.</li>\n</ul></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Copy the image using the <a href=\"https://github.com/appveyor/ci/blob/master/scripts/enterprise/copy-master-image-azure.ps1\">Copy Master Image PowerShell script</a>.</p>\n<ul>\n<li>It is essential to copy the VM because if you spin up a VM against an image that image cannot at the same time be used by AppVeyor.</li>\n<li>Use the storage account name, key, and URI obtained from Azure to run this script.<ul>\n<li>See Step 3 for URI &#x26; when prompted, press enter to use same storage account as destination.</li>\n<li>Utiliser le nom du conteneur de destination par défaut <code>(images)</code></li>\n<li>En outre, lorsque vous nommez la copie, utilisez un nom qui indique ce que la nouvelle image contiendra (si cela a changé) et un horodatage.<ul>\n<li>Ex. <code>libcc-20core-vs2017-15.9-2019-04-15.vhd</code></li>\n</ul></li>\n</ul></li>\n<li>Go into Azure and get the URI for the newly created image as described in a previous step</li>\n</ul>\n</li>\n<li>\n<p>Spin up a new VM using the <a href=\"https://github.com/appveyor/ci/blob/master/scripts/enterprise/create_master_vm_from_vhd.ps1\">Create Master VM from VHD PowerShell</a>.</p>\n<ul>\n<li>Depuis PowerShell, exécutez le fichier <code>ps1</code> avec <code>./create_master_vm_from_vhd.ps1</code></li>\n<li>You will need the credential information available in the AppVeyor build cloud definition.<ul>\n<li>Ceci comprend :<ul>\n<li>Client ID</li>\n<li>Client Secret</li>\n<li>Tenant ID</li>\n<li>Subscription ID</li>\n<li>Resource Group</li>\n<li>Virtual Network</li>\n</ul></li>\n</ul></li>\n<li>Vous devrez également préciser<ul>\n<li>Master VM name - just a unique name to identify the temporary VM</li>\n<li>Master VM size - use <code>Standard_F32s_v2</code></li>\n<li>Master VHD URI - use URI obtained @ end of previous step</li>\n<li>Location use <code>East US</code></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Reconnectez-vous à Azure et trouvez la VM que vous venez de créer dans Home &#x3C; Virtual Machines &#x3C; <code>$YOUR_NEW_VM</code></p>\n<ul>\n<li>You can download a RDP (Remote Desktop) file to access the VM.</li>\n</ul>\n</li>\n<li>\n<p>Using Microsoft Remote Desktop, click <code>Connect</code> to connect to the VM.</p>\n<ul>\n<li>Credentials for logging into the VM are found in LastPass under the <code>AppVeyor Enterprise master VM</code> credentials.</li>\n</ul>\n</li>\n<li>\n<p>Modifier la VM si nécessaire.</p>\n</li>\n<li>\n<p>Shut down the VM and then delete it in Azure.</p>\n</li>\n<li>\n<p>Add the new image to the Appveyor Cloud settings or modify an existing image to point to the new VHD.</p>\n</li>\n</ol>",
      "title": "Updating an Appveyor Azure Image",
      "description": ""
    },
    "/docs/api/structures/bluetooth-device": {
      "locale": "fr-FR",
      "slug": "bluetooth-device",
      "href": "/docs/api/structures/bluetooth-device",
      "crowdinFileId": "256411",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/bluetooth-device.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"bluetoothdevice-object\"><a href=\"#bluetoothdevice-object\">BluetoothDevice Object</a></h1>\n<ul>\n<li><code>deviceName</code> String</li>\n<li><code>deviceId</code> String</li>\n</ul>",
      "title": "BluetoothDevice Object",
      "description": ""
    },
    "/docs/tutorial/boilerplates-and-clis": {
      "locale": "fr-FR",
      "slug": "boilerplates-and-clis",
      "href": "/docs/tutorial/boilerplates-and-clis",
      "crowdinFileId": "256181",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/boilerplates-and-clis.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"les-boilerplates-et-clis\"><a href=\"#les-boilerplates-et-clis\">Les Boilerplates et CLIs</a></h1>\n<p>Le développement avec Electron est sans parti pris - il n'y a pas \"un unique chemin\" pour développer, construire, packager, ou sortir une application Electron. Des fonctionnalités supplémentaires pour Electron, à la fois pour la construction et l'exécution, peuvent généralement être trouvées sur <a href=\"https://www.npmjs.com/search?q=electron\">npm</a> dans des paquets individuels, permettant aux développeurs de construire l'application et de construire le pipeline dont ils ont besoin.</p>\n<p>Ce niveau de modularité et d'extensibilité garantit que tous les développeurs travaillant avec Electron, que ce soit dans de grandes ou de petites équipes, ne sont jamais limités dans ce qu'ils peuvent ou ne peuvent pas faire pendant leur cycle de vie de développement. Cependant, pour de nombreux développeurs, l'un des boilerplates communautaires ou un outil en ligne de commande peut rendre la compilation, le paquetage et la publication d'une application extrêmement faciles.</p>\n<h2 id=\"boilerplate-vs-cli\"><a href=\"#boilerplate-vs-cli\">Boilerplate vs CLI</a></h2>\n<p>Un \"Boilerplate\" n'est qu'un point de départ - une toile, pour ainsi dire - à partir de laquelle vous construisez votre application. Ils se présentent généralement sous la forme d'un dossier que vous pouvez cloner et personnaliser.</p>\n<p>Un outil en ligne de commande quant à lui est à vos côtés durant tout le processus de développement et de déploiement. Ils sont plus assistants et utiles mais imposent une ligne de conduite sur la manière dont votre code doit être structuré et construit. <em>Pour les débutants utiliser un outil en ligne de commande peut-être utile</em>.</p>\n<h2 id=\"electron-forge\"><a href=\"#electron-forge\">electron-forge</a></h2>\n<p>Un \"outil complet pour construire des applications Electron modernes\". Electron Forge unifie l'actuel outil de build (déjà bien maintenu) pour le développement sous Electron en un paquet afin que chacun puisse se lancer rapidement dans le développement sous Electron.</p>\n<p>Forge est livré avec <a href=\"https://electronforge.io/templates\">un template prêt à l'usage</a>, reposant sur Webpack. Il comprend un exemple de configuration typescript et offre deux fichiers de configuration pour permettre une customisation aisée. It uses the same core modules used by the greater Electron community (like <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>) – changes made by Electron maintainers (like Slack) benefit Forge's users, too.</p>\n<p>Vous pouvez trouver plus d'information et de documentation sur <a href=\"https://electronforge.io/\">electronforge.io</a>.</p>\n<h2 id=\"electron-builder\"><a href=\"#electron-builder\">electron-builder</a></h2>\n<p>Une «solution complète pour emballer et construire une application Electron prête à être distribuée» qui se concentre sur une expérience intégrée. électron-builder ajoute une dépendance unique axée sur la simplicité et gère toutes les autres exigences en interne.</p>\n<p>electron-builder remplace les fonctionnalités et modules utilisés par les mainteneurs Electron (tels que la mise à jour automatique) par des modules personnalisés. Ils sont généralement plus intégrés, mais auront moins de points communs avec les applications Electron populaires comme Atom, Visual Studio Code ou Slack.</p>\n<p>Vous pouvez trouver plus d'information et de documentation <a href=\"https://github.com/electron-userland/electron-builder\">ici</a>.</p>\n<h2 id=\"electron-react-boilerplate\"><a href=\"#electron-react-boilerplate\">electron-react-boilerplate</a></h2>\n<p>Si vous ne voulez pas d'outils, mais seulement un passe-partout solide à partir duquel construire, CT Lin's <a href=\"https://github.com/chentsulin/electron-react-boilerplate\"><code>electron-react-boilerplate</code></a> pourrait valoir un coup d'œil. Il est assez populaire dans la communauté et utilise <code>electron-builder</code> en interne.</p>\n<h2 id=\"autres-outils-et-boilerplates\"><a href=\"#autres-outils-et-boilerplates\">Autres outils et boilerplates</a></h2>\n<p>La liste <a href=\"https://github.com/sindresorhus/awesome-electron#boilerplates\"> \"Awesome Electron\" </a> contient plus d'outils et de passe-partout. Si vous trouvez la longueur de la liste intimidante, n'oubliez pas que l'ajout d'outils au fur et à mesure est également une approche valable.</p>",
      "title": "Les Boilerplates et CLIs",
      "description": ""
    },
    "/docs/breaking-changes": {
      "locale": "fr-FR",
      "slug": "breaking-changes",
      "href": "/docs/breaking-changes",
      "crowdinFileId": "256117",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/breaking-changes.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"changements-de-rupture\"><a href=\"#changements-de-rupture\">Changements de rupture</a></h1>\n<p>Les changements cassants seront documentés ici, et des avertissements de dépréciations ajoutés au code JS quand possible, au moins <a href=\"/docs/tutorial/electron-versioning#semver\">une version majeur</a> avant que le changement soit fait.</p>\n<h3 id=\"types-de-modifications-majeures\"><a href=\"#types-de-modifications-majeures\">Types de modifications majeures</a></h3>\n<p>Ce document utilise la convention suivante pour catégoriser les modifications majeures :</p>\n<ul>\n<li><strong>API modifiée :</strong> Une API a été modifiée avec la garantie que du code non modifié déclenchera une exception.</li>\n<li><strong>Comportement modifié :</strong> Le comportement d'Electron a changé, mais pas de telle manière qu'une exception soit nécessairement déclenchée.</li>\n<li><strong>Valeur par défaut modifiée :</strong> Le code dépendant de l'ancienne valeur par défaut peut ne plus fonctionner, sans nécessairement déclencher une exception. Le comportement d'origine peut être restauré en spécifiant explicitement la valeur.</li>\n<li><strong>Déprécié :</strong> une API a été marquée comme étant dépréciée. L'API continuera à fonctionner, mais émettra une alerte de dépréciation, et sera supprimée dans une prochaine version.</li>\n<li><strong>Supprimé:</strong> Une API ou une fonctionnalité a été supprimée et n'est plus prise en charge par Electron.</li>\n</ul>\n<h2 id=\"changements-majeurs-prévus-de-lapi-140\"><a href=\"#changements-majeurs-prévus-de-lapi-140\">Changements majeurs prévus de l'API (14.0)</a></h2>\n<h3 id=\"removed-remote-module\"><a href=\"#removed-remote-module\">Removed: <code>remote</code> module</a></h3>\n<p>Le module <code>remote</code> a été déprécié dans Electron 12, et sera supprimé dans Electron 14. Il est remplacé par le module <a href=\"https://github.com/electron/remote\"><code>@electron/remote</code></a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié dans Electron 12 :</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote\n</code></pre>\n<pre><code class=\"hljs language-js\">Remplacer par :\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote'</span>)\n\n<span class=\"hljs-comment\">// Dans le processus principal:</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote/main'</span>).initialize()\n</code></pre>\n<h3 id=\"supprimé--appallowrendererprocessreuse\"><a href=\"#supprimé--appallowrendererprocessreuse\">Supprimé : <code>app.allowRendererProcessReuse</code></a></h3>\n<p>La propriété <code>app.allowRendererProcessReuse</code> sera supprimée dans le cadre de notre plan visant à être le plus étroitement alignées sur le modèle de processus de Chromium en matière de sécurité, de performance et de maintenabilité.</p>\n<p>Pour des informations plus détaillées, voir <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"suppression--browser-window-affinity\"><a href=\"#suppression--browser-window-affinity\">Suppression : Browser Window Affinity</a></h3>\n<p>L'option <code>affinity</code> lors de l'instanciation d'une nouvelle <code>BrowserWindow</code> sera supprimée dans le cadre de notre plan d'alignement sur le modèle de processus de Chromium à des fins de sécurité, performances et maintenabilité.</p>\n<p>Pour des informations plus détaillées, voir <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"api-modifiée--windowopen\"><a href=\"#api-modifiée--windowopen\">API modifiée : <code>window.open()</code></a></h3>\n<p>Le paramètre optionnel <code>frameName</code> ne définira plus le titre de la fenêtre. Ceci conformément à la spécification décrite par la <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters\">documentation native</a> sous le paramètre correspondant <code>windowName</code>.</p>\n<p>Si vous utilisiez ce paramètre pour définir le titre d'une fenêtre, vous devez utiliser à la place: <a href=\"/docs/api/browser-window#winsettitletitle\">win.setTitle(title)</a>.</p>\n<h3 id=\"supprimé--worldsafeexecutejavascript\"><a href=\"#supprimé--worldsafeexecutejavascript\">Supprimé : <code>worldSafeExecuteJavaScript</code></a></h3>\n<p>Dans Electron 14, <code>worldSafeExecuteJavaScript</code> sera supprimé.  Il n'y a pas d'alternative, s'il vous plaît assurez-vous que votre code fonctionne avec cette propriété activée.  Il a été activé par défaut depuis Electron\n12.</p>\n<p>Vous serez affecté par ce changement si vous utilisez <code>webFrame.executeJavaScript</code> ou <code>webFrame.executeJavaScriptInIsolatedWorld</code>. Changements de rupture.</p>\n<h3 id=\"valeur-par-défaut-modifié--nativewindowopenest-par-défaut-à-true\"><a href=\"#valeur-par-défaut-modifié--nativewindowopenest-par-défaut-à-true\">Valeur par défaut modifié : <code>nativeWindowOpen</code>est par défaut à <code>true</code></a></h3>\n<p>Prior to Electron 14, <code>window.open</code> was by default shimmed to use <code>BrowserWindowProxy</code>. This meant that <code>window.open('about:blank')</code> did not work to open synchronously scriptable child windows, among other incompatibilities. <code>nativeWindowOpen</code> is no longer experimental, and is now the default.</p>\n<p>See the documentation for <a href=\"/docs/api/window-open\">window.open in Electron</a> for more details.</p>\n<h3 id=\"removed-browserwindowconstructoroptions-inheriting-from-parent-windows\"><a href=\"#removed-browserwindowconstructoroptions-inheriting-from-parent-windows\">Removed: BrowserWindowConstructorOptions inheriting from parent windows</a></h3>\n<p>Prior to Electron 14, windows opened with <code>window.open</code> would inherit BrowserWindow constructor options such as <code>transparent</code> and <code>resizable</code> from their parent window. À partir d'Electron 14, ce comportement est supprimé et les fenêtres n'hériteront d'aucune option du constructeur BrowserWindow de leurs parents.</p>\n<p>Instead, explicitly set options for the new window with <code>setWindowOpenHandler</code>:</p>\n<pre><code class=\"hljs language-js\">webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n  <span class=\"hljs-keyword\">return</span> {\n    <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span>,\n    <span class=\"hljs-attr\">overrideBrowserWindowOptions</span>: {\n      <span class=\"hljs-comment\">// ...</span>\n    }\n  }\n})\n</code></pre>\n<h3 id=\"supprimé--additionalfeatures\"><a href=\"#supprimé--additionalfeatures\">Supprimé : <code>additionalFeatures</code></a></h3>\n<p>The deprecated <code>additionalFeatures</code> property in the <code>new-window</code> and <code>did-create-window</code> events of WebContents has been removed. Since <code>new-window</code> uses positional arguments, the argument is still present, but will always be the empty array <code>[]</code>. (Notez toutefois que l’événement <code>new-window</code> lui-même est déprécié et remplacé par <code>setWindowOpenHandler</code>.) Bare keys in window features will now present as keys with the value <code>true</code> in the options object.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 14</span>\n<span class=\"hljs-comment\">// Triggered by window.open('...', '', 'my-key')</span>\nwebContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (<span class=\"hljs-built_in\">window</span>, details) => {\n  <span class=\"hljs-keyword\">if</span> (details.additionalFeatures.includes(<span class=\"hljs-string\">'my-key'</span>)) {\n    <span class=\"hljs-comment\">// ...</span>\n  }\n})\n\n<span class=\"hljs-comment\">// Replace with</span>\nwebContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (<span class=\"hljs-built_in\">window</span>, details) => {\n  <span class=\"hljs-keyword\">if</span> (details.options[<span class=\"hljs-string\">'my-key'</span>]) {\n    <span class=\"hljs-comment\">// ...</span>\n  }\n})\n</code></pre>\n<h2 id=\"changements-majeurs-prévus-de-lapi-130\"><a href=\"#changements-majeurs-prévus-de-lapi-130\">Changements majeurs prévus de l'API (13.0)</a></h2>\n<h3 id=\"api-modifiée--sessionsetpermissioncheckhandlerhandler\"><a href=\"#api-modifiée--sessionsetpermissioncheckhandlerhandler\">API modifiée : <code>session.setPermissionCheckHandler(handler)</code></a></h3>\n<p>Le premier paramètre <code>handler</code> des méthodes était auparavant toujours un <code>webContents</code>, il peut maintenant parfois être <code>null</code>.  Vous devez utiliser les propriétés <code>requestingOrigin</code>, <code>embeddingOrigin</code> et <code>securityOrigin</code> pour répondre correctement à la vérification des permissions.  Comme le <code>webContents</code> peut être désormais <code>null</code> , on ne peut plus s'y fier.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Ancien code:</span>\nsession.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (webContents.getURL().startsWith(<span class=\"hljs-string\">'https://google.com/'</span>) &#x26;&#x26; permission === <span class=\"hljs-string\">'notification'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n\n<span class=\"hljs-comment\">// A remplacer par:</span>\nsession.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(requestingOrigin).hostname === <span class=\"hljs-string\">'google.com'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notification'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n</code></pre>\n<h3 id=\"supprimé--shellmoveitemtotrash\"><a href=\"#supprimé--shellmoveitemtotrash\">Supprimé : <code>shell.moveItemToTrash()</code></a></h3>\n<p>L’API <code>shell.moveItemToTrash()</code> synchrone qui était dépréciée a été supprimée. Utilisez shell.trashItem() <code>asynchrone</code> à la place.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Supprimé dans Electron 13</span>\nshell.moveItemToTrash(path)\n<span class=\"hljs-comment\">// Remplacer par</span>\nshell.trashItem(path).then(<span class=\"hljs-comment\">/* ... */</span>)\n</code></pre>\n<h3 id=\"removed-browserwindow-extension-apis\"><a href=\"#removed-browserwindow-extension-apis\">Removed: <code>BrowserWindow</code> extension APIs</a></h3>\n<p>Les API d'extension obsolètes ont été supprimées :</p>\n<ul>\n<li><code>BrowserWindow.addExtension(path)</code></li>\n<li><code>BrowserWindow.addDevToolsExtension(path)</code></li>\n<li><code>BrowserWindow.removeExtension(name)</code></li>\n<li><code>BrowserWindow.removeDevToolsExtension(name)</code></li>\n<li><code>BrowserWindow.getExtensions()</code></li>\n<li><code>BrowserWindow.getDevToolsExtensions()</code></li>\n</ul>\n<p>Utilisez plutôt les API de session :</p>\n<ul>\n<li><code>ses.loadExtension(path)</code></li>\n<li><code>ses.removeExtension(extension_id)</code></li>\n<li><code>ses.getAllExtensions()</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Supprimé dans Electron 13</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// Remplacer par</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\">Supprimé dans Electron <span class=\"hljs-number\">13</span>\nBrowserWindow.removeExtension(name)\nBrowserWindow.removeDevToolsExtension(name)\n<span class=\"hljs-comment\">// Remplacer par</span>\nsession.defaultSession.removeExtension(extension_id)\n</code></pre>\n<pre><code class=\"hljs language-js\">Supprimé dans Electron <span class=\"hljs-number\">13</span>\nBrowserWindow.getExtensions()\nBrowserWindow.getDevToolsExtensions()\n<span class=\"hljs-comment\">// Remplacer par</span>\nsession.defaultSession.getAllExtensions()\n</code></pre>\n<h3 id=\"méthodes-supprimées-dans-systempreferences\"><a href=\"#méthodes-supprimées-dans-systempreferences\">Méthodes supprimées dans <code>systemPreferences</code></a></h3>\n<p>Les méthodes suivantes de <code>systemPreferences</code> ont été dépréciées :</p>\n<ul>\n<li><code>systemPreferences.isDarkMode()</code></li>\n<li><code>systemPreferences.isInvertedColorScheme()</code></li>\n<li><code>systemPreferences.isHighContrastColorScheme()</code></li>\n</ul>\n<p>Veuillez utiliser à la place les propriétés de <code>nativeTheme</code> suivantes :</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code></li>\n<li><code>nativeTheme.shouldUseInvertedColorScheme</code></li>\n<li><code>nativeTheme.shouldUseHighContrastColors</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Supprimée dans Electron 13</span>\nsystemPreferences.isDarkMode()\n<span class=\"hljs-comment\">// Remplacée par</span>\nnativeTheme.shouldUseDarkColors\n\n<span class=\"hljs-comment\">// Supprimée dans Electron 13</span>\nsystemPreferences.isInvertedColorScheme()\n<span class=\"hljs-comment\">// Remplacée par</span>\nnativeTheme.shouldUseInvertedColorScheme\n\n<span class=\"hljs-comment\">// Supprimée dans Electron 13</span>\nsystemPreferences.isHighContrastColorScheme()\n<span class=\"hljs-comment\">// Remplacée par</span>\nnativeTheme.shouldUseHighContrastColors\n</code></pre>\n<h3 id=\"obsolète--événement-webcontents-new-window\"><a href=\"#obsolète--événement-webcontents-new-window\">Obsolète : événement WebContents <code>new-window</code></a></h3>\n<p>L'événement <code>new-window</code> de WebContents est déprécié. Il est remplacé par <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler()</code></a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié dans  Electron 13</span>\nwebContents.on(<span class=\"hljs-string\">'new-window'</span>, (event) => {\n  event.preventDefault()\n})\n\n<span class=\"hljs-comment\">// Remplacer par</span>\nwebContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n</code></pre>\n<h2 id=\"changements-majeurs-prévus-de-lapi-120\"><a href=\"#changements-majeurs-prévus-de-lapi-120\">Changements majeurs prévus de l'API (12.0)</a></h2>\n<h3 id=\"supprimé-support-de-pepper-flash\"><a href=\"#supprimé-support-de-pepper-flash\">Supprimé: Support de Pepper Flash</a></h3>\n<p>Chromium a supprimé la prise en charge de Flash, nous devons donc emboîter le pas. Consultez la <a href=\"https://www.chromium.org/flash-roadmap\"> feuille de route Flash</a> de Chromium pour plus de détails.</p>\n<h3 id=\"changements-de-rupturetrue\"><a href=\"#changements-de-rupturetrue\">Changements de rupture<code>true</code></a></h3>\n<p>Dans Electron 12, <code>worldSafeExecuteJavaScript</code> sera activé par défaut.  Restaurer le comportement précédent, <code>worldSafeExecuteJavaScript: false</code> doit être spécifié dans WebPreferences. Veuillez noter que définir cette option sur <code>false</code> est <strong>non sécurisé</strong>.</p>\n<p>Cette option sera supprimée dans Electron 14, veuillez donc migrer votre code pour prendre en charge la valeur par défaut.</p>\n<h3 id=\"valeur-par-défaut-modifié--contextisolationest-par-défaut-à-true\"><a href=\"#valeur-par-défaut-modifié--contextisolationest-par-défaut-à-true\">Valeur par défaut modifié : <code>contextIsolation</code>est par défaut à <code>true</code></a></h3>\n<p>Dans Electron 12, <code>contextIsolation</code> sera activé par défaut.  Restaurer le comportement précédent, <code>contextIsolation: false</code> doit être spécifié dans WebPreferences.</p>\n<p>Nous <a href=\"/docs/tutorial/security#3-enable-context-isolation-for-remote-content\">recommandons que contextIsolation soit activé</a> pour la sécurité de votre application.</p>\n<p>En conséquence <code>require()</code> ne peut pas être utilisé dans le processus de rendu à sauf si <code>nodeIntegration</code> est à <code>true</code> et <code>contextIsolation</code> à <code>false</code>.</p>\n<p>Pour plus de détails, voir : <a href=\"https://github.com/electron/electron/issues/23506\">https://github.com/electron/electron/issues/23506</a></p>\n<h3 id=\"supprimé--crashreportergetcrashesdirectory\"><a href=\"#supprimé--crashreportergetcrashesdirectory\">Supprimé : <code>crashReporter.getCrashesDirectory()</code></a></h3>\n<p>La méthode <code>crashReporter.getCrashesDirectory</code> a été supprimée. Usage Devrait être remplacé par <code>app.getPath('crashDumps')</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Supprimé dans Electron 12</span>\ncrashReporter.getCrashesDirectory()\n<span class=\"hljs-comment\">// Remplacé par</span>\napp.getPath(<span class=\"hljs-string\">'crashDumps'</span>)\n</code></pre>\n<h3 id=\"supprimé--méthodes-crashreporter-dans-le-processus-de-rendu\"><a href=\"#supprimé--méthodes-crashreporter-dans-le-processus-de-rendu\">Supprimé : méthodes <code>crashReporter</code> dans le processus de rendu</a></h3>\n<p>Les méthodes <code>crashReporter</code> suivantes ne sont plus disponibles dans le processus de rendu :</p>\n<ul>\n<li><code>crashReporter.start</code></li>\n<li><code>crashReporter.getLastCrashReport</code></li>\n<li><code>crashReporter.getUploadedReports</code></li>\n<li><code>crashReporter.getUploadToServer</code></li>\n<li><code>crashReporter.setUploadToServer</code></li>\n<li><code>crashReporter.getCrashesDirectory</code></li>\n</ul>\n<p>Ils ne doivent être appelés qu'à partir du processus principal.</p>\n<p>Voir <a href=\"https://github.com/electron/electron/pull/23265\">#23265</a> pour plus de détails.</p>\n<h3 id=\"valeur-par-défaut-modifiée--crashreporterstart-compress-true-\"><a href=\"#valeur-par-défaut-modifiée--crashreporterstart-compress-true-\">Valeur par défaut modifiée : <code>crashReporter.start({ compress: true })</code></a></h3>\n<p>La valeur par défaut de l'option <code>compress</code> en <code>crashReporter.start</code> a changé de <code>false</code> à <code>true</code>. Cela signifie que les rapports de plantage seront envoyés au serveur d'ingestion de plantage avec l'en-tête <code>Content-Encoding: gzip</code> et le corps sera compressé.</p>\n<p>Si votre serveur d'ingestion de plantage ne supporte pas les payloads compressées, vous pouvez désactiver la compression en spécifiant <code>{ compress: false }</code> dans les options du rapporteur de plantage.</p>\n<h3 id=\"déprécié--moduleremote\"><a href=\"#déprécié--moduleremote\">Déprécié : module<code>remote</code></a></h3>\n<p>Le module <code>remote</code> est déprécié dans Electron 12, et sera supprimé dans Electron 14. Il est remplacé par le module <a href=\"https://github.com/electron/remote\"><code>@electron/remote</code></a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié dans Electron 12 :</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote\n</code></pre>\n<pre><code class=\"hljs language-js\">Remplacer par :\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote'</span>)\n\n<span class=\"hljs-comment\">// Dans le processus principal:</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote/main'</span>).initialize()\n</code></pre>\n<h3 id=\"déprécié--shellmoveitemtotrash\"><a href=\"#déprécié--shellmoveitemtotrash\">Déprécié : <code>shell.moveItemToTrash()</code></a></h3>\n<p>La méthode synchrone <code>shell.moveItemToTrash() </code> a été remplacée par une asynchrone <code>shell.trashItem() </code>.</p>\n<pre><code class=\"hljs language-js\">Déprécié dans Electron <span class=\"hljs-number\">12</span>\nshell.moveItemToTrash(path)\n<span class=\"hljs-comment\">// Remplacer par</span>\nshell.trashItem(path).then(<span class=\"hljs-comment\">/* ... */</span>)\n</code></pre>\n<h2 id=\"changements-majeurs-prévus-de-lapi-110\"><a href=\"#changements-majeurs-prévus-de-lapi-110\">Changements majeurs prévus de l'API (11.0)</a></h2>\n<h3 id=\"supprimés-browserviewdestroy-fromid-fromwebcontents-getallviews-et-id-propriété-de-browserview\"><a href=\"#supprimés-browserviewdestroy-fromid-fromwebcontents-getallviews-et-id-propriété-de-browserview\">Supprimés: <code>BrowserView.{destroy, fromId, fromWebContents, getAllViews}</code> et <code>id</code> propriété de <code>BrowserView</code></a></h3>\n<p>Les API expérimentales <code>BrowserView.{destroy, fromId, fromWebContents, getAllViews}</code> ont maintenant été supprimées. De plus, la propriété <code>id</code> de <code>BrowserView</code> a également été supprimée.</p>\n<p>Pour des informations plus détaillées, voir <a href=\"https://github.com/electron/electron/pull/23578\">#23578</a>.</p>\n<h2 id=\"changements-majeurs-prévus-de-lapi-100\"><a href=\"#changements-majeurs-prévus-de-lapi-100\">Changements majeurs prévus de l'API (10.0)</a></h2>\n<h3 id=\"déprécié--largument-companyname-de-crashreporterstart\"><a href=\"#déprécié--largument-companyname-de-crashreporterstart\">Déprécié : l'argument <code>companyName</code> de <code>crashReporter.start()</code></a></h3>\n<p>L'argument <code>companyName</code> de <code>crashReporter.start()</code>, qui était auparavant requis, est maintenant optionnel et de plus déprécié. Pour obtenir le même comportement de manière non dépréciée, vous pouvez passer une valeur <code>companyName</code> dans <code>globalExtra</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié dans Electron 10</span>\ncrashReporter.start({ <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Umbrella Corporation'</span> })\n<span class=\"hljs-comment\">// Remplacé par</span>\ncrashReporter.start({ <span class=\"hljs-attr\">globalExtra</span>: { <span class=\"hljs-attr\">_companyName</span>: <span class=\"hljs-string\">'Umbrella Corporation'</span> }})\n</code></pre>\n<h3 id=\"déprécié--crashreportergetcrashesdirectory\"><a href=\"#déprécié--crashreportergetcrashesdirectory\">Déprécié : <code>crashReporter.getCrashesDirectory()</code></a></h3>\n<p>La méthode <code>crashReporter.getCrashesDirectory</code> a été dépréciée. Usage Devrait être remplacé par <code>app.getPath('crashDumps')</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié dans Electron 10</span>\ncrashReporter.getCrashesDirectory()\n<span class=\"hljs-comment\">// Remplacé par</span>\napp.getPath(<span class=\"hljs-string\">'crashDumps'</span>)\n</code></pre>\n<h3 id=\"déprécié--méthodes-crashreporter-dans-le-processus-de-rendu\"><a href=\"#déprécié--méthodes-crashreporter-dans-le-processus-de-rendu\">Déprécié : méthodes <code>crashReporter</code> dans le processus de rendu</a></h3>\n<p>L'appel des méthodes <code>crashReporter</code> suivantes à partir du processus de rendu est déprécié :</p>\n<ul>\n<li><code>crashReporter.start</code></li>\n<li><code>crashReporter.getLastCrashReport</code></li>\n<li><code>crashReporter.getUploadedReports</code></li>\n<li><code>crashReporter.getUploadToServer</code></li>\n<li><code>crashReporter.setUploadToServer</code></li>\n<li><code>crashReporter.getCrashesDirectory</code></li>\n</ul>\n<p>Les seules méthodes non obsolètes restantes dans le module <code>crashReporter</code> du renderer sont <code>addExtraParameter</code>, <code>removeExtraParameter</code> et <code>getParameters</code>.</p>\n<p>Toutes les méthodes ci-dessus restent non dépréciées lorsqu'elles sont appelées à partir du processus principal.</p>\n<p>Voir <a href=\"https://github.com/electron/electron/pull/23265\">#23265</a> pour plus de détails.</p>\n<h3 id=\"déprécié--crashreporterstart-compress-false-\"><a href=\"#déprécié--crashreporterstart-compress-false-\">Déprécié : <code>crashReporter.start({ compress: false })</code></a></h3>\n<p>La configuration <code>{ compress: false }</code> dans <code>crashReporter.start</code> est obsolète. Presque tous les serveurs d'ingestion de plantages supportent la compression gzip. Cette option sera supprimée dans une future version d’Electron.</p>\n<h3 id=\"valeur-par-défaut-modifié--enableremotemoduleest-par-défaut-à-false\"><a href=\"#valeur-par-défaut-modifié--enableremotemoduleest-par-défaut-à-false\">Valeur par défaut modifié : <code>enableRemoteModule</code>est par défaut à <code>false</code></a></h3>\n<p>Dans Electron 9, l'utilisation du module remote sans l'activer explicitement via l'option <code>enableRemoteModule</code> de WebPreferences émet dès maintenant un avertissement. Avec Electron 10, le module remote est dès maintenant désactivé par défaut. Pour utiliser le module remote, on doit spécifier <code>enableRemoteModule : true</code> dans les WebPreferences:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> w = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">enableRemoteModule</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<p>Nous vous recommandons d'éviter d'utiliser le module <a href=\"https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31\">distant</a>.</p>\n<h3 id=\"protocolunregisterprotocol\"><a href=\"#protocolunregisterprotocol\"><code>protocol.unregisterProtocol</code></a></h3>\n<h3 id=\"protocoluninterceptprotocol\"><a href=\"#protocoluninterceptprotocol\"><code>protocol.uninterceptProtocol</code></a></h3>\n<p>Les API sont désormais synchrones donc la callback qui était facultative n'est plus nécessaire.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Déprécié</span>\nprotocol.unregisterProtocol(scheme, () => { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Remplacer par</span>\nprotocol.unregisterProtocol(scheme)\n</code></pre>\n<h3 id=\"protocolregisterfileprotocol\"><a href=\"#protocolregisterfileprotocol\"><code>protocol.registerFileProtocol</code></a></h3>\n<h3 id=\"protocolregisterbufferprotocol\"><a href=\"#protocolregisterbufferprotocol\"><code>protocol.registerBufferProtocol</code></a></h3>\n<h3 id=\"protocolregisterstringprotocol\"><a href=\"#protocolregisterstringprotocol\"><code>protocol.registerStringProtocol</code></a></h3>\n<h3 id=\"protocolregisterhttpprotocol\"><a href=\"#protocolregisterhttpprotocol\"><code>protocol.registerHttpProtocol</code></a></h3>\n<h3 id=\"protocolregisterstreamprotocol\"><a href=\"#protocolregisterstreamprotocol\"><code>protocol.registerStreamProtocol</code></a></h3>\n<h3 id=\"protocolinterceptfileprotocol\"><a href=\"#protocolinterceptfileprotocol\"><code>protocol.interceptFileProtocol</code></a></h3>\n<h3 id=\"protocolinterceptstringprotocol\"><a href=\"#protocolinterceptstringprotocol\"><code>protocol.interceptStringProtocol</code></a></h3>\n<h3 id=\"protocolinterceptbufferprotocol\"><a href=\"#protocolinterceptbufferprotocol\"><code>protocol.interceptBufferProtocol</code></a></h3>\n<h3 id=\"protocolintercepthttpprotocol\"><a href=\"#protocolintercepthttpprotocol\"><code>protocol.interceptHttpProtocol</code></a></h3>\n<h3 id=\"protocolinterceptstreamprotocol\"><a href=\"#protocolinterceptstreamprotocol\"><code>protocol.interceptStreamProtocol</code></a></h3>\n<p>Les API sont désormais synchrones donc la callback qui était facultative n'est plus nécessaire.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Déprécié</span>\nprotocol.registerFileProtocol(scheme, handler, () => { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Remplacer par</span>\nprotocol.registerFileProtocol(scheme, handler)\n</code></pre>\n<p>Le protocole enregistré ou intercepté n'a pas d'effet sur la page actuelle tant que la navigation n'a pas eu lieu.</p>\n<h3 id=\"protocolisprotocolhandled\"><a href=\"#protocolisprotocolhandled\"><code>protocol.isProtocolHandled</code></a></h3>\n<p>Cette API est dépréciée et les utilisateurs doivent utiliser à la place <code>protocol.isProtocolRegistered</code> et <code>protocol.isProtocolIntercepted</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Déprécié</span>\nprotocol.isProtocolHandled(scheme).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Remplacer par</span>\n<span class=\"hljs-keyword\">const</span> isRegistered = protocol.isProtocolRegistered(scheme)\n<span class=\"hljs-keyword\">const</span> isIntercepted = protocol.isProtocolIntercepted(scheme)\n</code></pre>\n<h2 id=\"changements-majeurs-prévus-de-lapi-90\"><a href=\"#changements-majeurs-prévus-de-lapi-90\">Changements majeurs prévus de l'API (9.0)</a></h2>\n<h3 id=\"fonctionnement-par-défaut-modifié--le-chargement-des-modules-natifs-non-contextuels-dans-le-processus-de-rendu-est-désactivé-par-défaut\"><a href=\"#fonctionnement-par-défaut-modifié--le-chargement-des-modules-natifs-non-contextuels-dans-le-processus-de-rendu-est-désactivé-par-défaut\">Fonctionnement par défaut modifié : le chargement des modules natifs non contextuels dans le processus de rendu est désactivé par défaut</a></h3>\n<p>À partir d’Electron 9, nous n’autorisons plus le chargement de modules natifs insensibles au contexte dans le processus de rendu.  Ceci est pour améliorer la sécurité, les performances et la maintenabilité d'Electron en tant que projet.</p>\n<p>Si cela vous affecte, vous pouvez définir temporairement <code>app.allowRendererProcessReuse</code> pour <code>faux</code> pour revenir à l’ancien comportement.  Ce drapeau ne sera une option que jusqu'à Electron 11 donc vous devriez planifier de mettre à jour vos modules natifs pour être sensible au contexte.</p>\n<p>Pour des informations plus détaillées, voir <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"déprécié--api-dextension-browserwindow\"><a href=\"#déprécié--api-dextension-browserwindow\">Déprécié : API d'extension <code>BrowserWindow</code></a></h3>\n<p>Les API d'extension suivantes sont obsolètes :</p>\n<ul>\n<li><code>BrowserWindow.addExtension(path)</code></li>\n<li><code>BrowserWindow.addDevToolsExtension(path)</code></li>\n<li><code>BrowserWindow.removeExtension(name)</code></li>\n<li><code>BrowserWindow.removeDevToolsExtension(name)</code></li>\n<li><code>BrowserWindow.getExtensions()</code></li>\n<li><code>BrowserWindow.getDevToolsExtensions()</code></li>\n</ul>\n<p>Utilisez plutôt les API de session :</p>\n<ul>\n<li><code>ses.loadExtension(path)</code></li>\n<li><code>ses.removeExtension(extension_id)</code></li>\n<li><code>ses.getAllExtensions()</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié dans Electron 9</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// Remplacer par</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié dans Electron 9</span>\nBrowserWindow.removeExtension(name)\nBrowserWindow.removeDevToolsExtension(name)\n<span class=\"hljs-comment\">// Remplacer par</span>\nsession.defaultSession.removeExtension(extension_id)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié dans Electron 9</span>\nBrowserWindow.getExtensions()\nBrowserWindow.getDevToolsExtensions()\n<span class=\"hljs-comment\">// Remplacé par</span>\nsession.defaultSession.getAllExtensions()\n</code></pre>\n<h3 id=\"supprimé-webviewgetwebcontents\"><a href=\"#supprimé-webviewgetwebcontents\">Supprimé: <code>&#x3C;webview>.getWebContents()</code></a></h3>\n<p>Cette API, qui a été dépréciée dans Electron 8.0, est désormais supprimée.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Supprimé dans Electron 9.0</span>\nwebview.getWebContents()\n<span class=\"hljs-comment\">// Remplacé par</span>\n<span class=\"hljs-keyword\">const</span> { remote } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nremote.webContents.fromId(webview.getWebContentsId())\n</code></pre>\n<h3 id=\"supprimé-webframesetlayoutzoomlevellimits\"><a href=\"#supprimé-webframesetlayoutzoomlevellimits\">Supprimé: <code>webFrame.setLayoutZoomLevelLimits()</code></a></h3>\n<p>Chrome a supprimé la prise en charge pour modifier les limites de niveau de zoom de mise en page et il n'est plus possible pour Electron de le maintenir. La fonction a été dépréciée dans Electron 8.x, et supprimée dans Electron 9.x. Les limites de niveau de zoom de mise en page sont maintenant fixées à un minimum de 0. 5 et un maximum de 5.0, tel que défini <a href=\"https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11\">ici</a>.</p>\n<h3 id=\"comportement-modifié--lenvoi-dobjets-non-js-au-travers-d-ipc-déclenche-maintenant-une-exception\"><a href=\"#comportement-modifié--lenvoi-dobjets-non-js-au-travers-d-ipc-déclenche-maintenant-une-exception\">Comportement modifié : l’envoi d’objets non-JS au travers d' IPC déclenche maintenant une exception</a></h3>\n<p>Dans Electron 8.0, l'IPC a été modifié pour utiliser l'algorithme Structured Clone , apportant des améliorations significatives des performances. Pour aider à faciliter la transition, l'ancien algorithme de sérialisation IPC a été conservé et utilisé pour certains objets qui ne sont pas sérialisables avec Structured Clone. In particular, DOM objects (e.g. <code>Element</code>, <code>Location</code> and <code>DOMMatrix</code>), Node.js objects backed by C++ classes (e.g. <code>process.env</code>, some members of <code>Stream</code>), and Electron objects backed by C++ classes (e.g. <code>WebContents</code>, <code>BrowserWindow</code> and <code>WebFrame</code>) are not serializable with Structured Clone. Chaque fois que l'ancien algorithme était invoqué, un un avertissement de dépréciation a été imprimé.</p>\n<p>In Electron 9.0, the old serialization algorithm has been removed, and sending such non-serializable objects will now throw an \"object could not be cloned\" error.</p>\n<h3 id=\"api-modifiée--shellopenitem-est-désormais-shellopenpath\"><a href=\"#api-modifiée--shellopenitem-est-désormais-shellopenpath\">API modifiée : <code>shell.openItem</code> est désormais <code>shell.openPath</code></a></h3>\n<p>L'API <code>shell.openItem</code> a été remplacée par une API <code>shell.openPath</code> asynchrone. Vous pouvez voir la proposition initiale de l'API et le raisonnement <a href=\"https://github.com/electron/governance/blob/main/wg-api/spec-documents/shell-openitem.md\">ici</a>.</p>\n<h2 id=\"changements-majeurs-prévus-de-lapi-80\"><a href=\"#changements-majeurs-prévus-de-lapi-80\">Changements majeurs prévus de l'API (8.0)</a></h2>\n<h3 id=\"comportement-modifié--les-valeurs-envoyées-par-ipc-sont-maintenant-sérialisées-avec-lalgorithme-de-clonage-structuré\"><a href=\"#comportement-modifié--les-valeurs-envoyées-par-ipc-sont-maintenant-sérialisées-avec-lalgorithme-de-clonage-structuré\">Comportement modifié : les valeurs envoyées par IPC sont maintenant sérialisées avec l'algorithme de clonage structuré</a></h3>\n<p>L'algorithme utilisé pour sérialiser les objets envoyés par IPC (via <code>ipcRenderer.send</code>, <code>ipcRenderer.sendSync</code>, <code>WebContents. les méthodes de fin</code> et associées) est passé d'un algorithme personnalisé à l'algorithme intégré de V8 <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a> qui est déja utilisé pour sérialiser les messages dans <code>postMessage</code>. Cela entraîne une amélioration dans un rapport 2 des performances en ce qui concerne les messages de grande taille, mais apporte également quelques changements de rupture dans le comportement.</p>\n<ul>\n<li>Sending Functions, Promises, WeakMaps, WeakSets, or objects containing any such values, over IPC will now throw an exception, instead of silently converting the functions to <code>undefined</code>.</li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Previously:</span>\nipcRenderer.send(<span class=\"hljs-string\">'channel'</span>, { <span class=\"hljs-attr\">value</span>: <span class=\"hljs-number\">3</span>, <span class=\"hljs-attr\">someFunction</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {} })\n<span class=\"hljs-comment\">// => results in { value: 3 } arriving in the main process</span>\n\n<span class=\"hljs-comment\">// From Electron 8:</span>\nipcRenderer.send(<span class=\"hljs-string\">'channel'</span>, { <span class=\"hljs-attr\">value</span>: <span class=\"hljs-number\">3</span>, <span class=\"hljs-attr\">someFunction</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {} })\n<span class=\"hljs-comment\">// => throws Error(\"() => {} could not be cloned.\")</span>\n</code></pre>\n<ul>\n<li><code>NaN</code>, <code>Infinity</code> et <code>-Infinity</code> seront désormais correctement sérialisés à la place d'être converti en <code>null</code>.</li>\n<li>Les objets contenant des références cycliques seront désormais correctement sérialisés, au lieu d'être converti en <code>null</code>.</li>\n<li>Les valeurs <code>Set</code>, <code>Map</code>, <code>Error</code> et <code>RegExp</code> seront correctement sérialisées, au lieu d'être converti en <code>{}</code>.</li>\n<li>Les valeurs <code>BigInt</code> seront correctement sérialisées, au lieu d'être converties en <code>null</code>.</li>\n<li>Sparse arrays will be serialized as such, instead of being converted to dense arrays with <code>null</code>s.</li>\n<li><code>Date</code> objects will be transferred as <code>Date</code> objects, instead of being converted to their ISO string representation.</li>\n<li>Typed Arrays (such as <code>Uint8Array</code>, <code>Uint16Array</code>, <code>Uint32Array</code> and so on) will be transferred as such, instead of being converted to Node.js <code>Buffer</code>.</li>\n<li>Node.js <code>Buffer</code> objects will be transferred as <code>Uint8Array</code>s. You can convert a <code>Uint8Array</code> back to a Node.js <code>Buffer</code> by wrapping the underlying <code>ArrayBuffer</code>:</li>\n</ul>\n<pre><code class=\"hljs language-js\">Buffer.from(value.buffer, value.byteOffset, value.byteLength)\n</code></pre>\n<p>Sending any objects that aren't native JS types, such as DOM objects (e.g. <code>Element</code>, <code>Location</code>, <code>DOMMatrix</code>), Node.js objects (e.g. <code>process.env</code>, <code>Stream</code>), or Electron objects (e.g. <code>WebContents</code>, <code>BrowserWindow</code>, <code>WebFrame</code>) is deprecated. In Electron 8, these objects will be serialized as before with a DeprecationWarning message, but starting in Electron 9, sending these kinds of objects will throw a 'could not be cloned' error.</p>\n<h3 id=\"déprécié--webviewgetwebcontents\"><a href=\"#déprécié--webviewgetwebcontents\">Déprécié : <code>&#x3C;webview>.getWebContents()</code></a></h3>\n<p>Cette API est implémentée à l'aide du module <code>remote</code>, qui a à la fois des performances et les implications en matière de sécurité. Par conséquent, son utilisation doit être explicite.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié</span>\nwebview.getWebContents()\n<span class=\"hljs-comment\">// Remplacé par</span>\n<span class=\"hljs-keyword\">const</span> { remote } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nremote.webContents.fromId(webview.getWebContentsId())\n</code></pre>\n<p>Cependant, il est recommandé d'éviter d'utiliser le module <code>remote</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain, webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> getGuestForWebContents = <span class=\"hljs-function\">(<span class=\"hljs-params\">webContentsId, contents</span>) =></span> {\n  <span class=\"hljs-keyword\">const</span> guest = webContents. romId(webContentsId)\n  si (! uest) {\n    <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">`Invalid webContentsId: <span class=\"hljs-subst\">${webContentsId}</span>`</span>)\n  }\n  <span class=\"hljs-keyword\">if</span> (invité. ostWebContents ! = contents) {\n    <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Accès refusé à webContents'</span>)\n  }\n  <span class=\"hljs-keyword\">return</span> guest\n}\n\nipcMain. handle(<span class=\"hljs-string\">'openDevTools'</span>, (event, webContentsId) => {\n  <span class=\"hljs-keyword\">const</span> guest = getGuestForWebContents(webContentsId, event.sender)\n  invité. penDevTools()\n})\n\n<span class=\"hljs-comment\">// moteur de rendu</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nipcRenderer.invoke(<span class=\"hljs-string\">'openDevTools'</span>, webview.getWebContentsId())\n</code></pre>\n<h3 id=\"déprécié--webframesetlayoutzoomlevellimits\"><a href=\"#déprécié--webframesetlayoutzoomlevellimits\">Déprécié : <code>webFrame.setLayoutZoomLevelLimits()</code></a></h3>\n<p>Chrome a supprimé la prise en charge pour modifier les limites de niveau de zoom de mise en page et il n'est plus possible pour Electron de le maintenir. La fonction émettra un avertissement dans Electron 8.x, et cessent d'exister dans Electron 9.x. The layout zoom level limits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined <a href=\"https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11\">here</a>.</p>\n<h3 id=\"événements-obsolètes-dans-systempreferences\"><a href=\"#événements-obsolètes-dans-systempreferences\">Événements obsolètes dans <code>systemPreferences</code></a></h3>\n<p>Les événements <code>systemPreferences</code> suivants ont été dépréciés :</p>\n<ul>\n<li><code>inverted-color-scheme-changed</code></li>\n<li><code>high-contrast-color-scheme-changed</code></li>\n</ul>\n<p>Utilisez à la place le nouvel événement <code>updated</code> sur le module <code>nativeTheme</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprécié</span>\nsystemPreferences.on(<span class=\"hljs-string\">'inverted-color-scheme-changed'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\nsystemPreferences.on(<span class=\"hljs-string\">'high-contrast-color-scheme-changed'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\n\n<span class=\"hljs-comment\">// Replacer avec</span>\nnativmeTheme.on(<span class=\"hljs-string\">'updated'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\n</code></pre>\n<h3 id=\"méthodes-obsolètes-dans-systempreferences\"><a href=\"#méthodes-obsolètes-dans-systempreferences\">Méthodes obsolètes dans <code>systemPreferences</code></a></h3>\n<p>Les méthodes suivantes de <code>systemPreferences</code> ont été dépréciées :</p>\n<ul>\n<li><code>systemPreferences.isDarkMode()</code></li>\n<li><code>systemPreferences.isInvertedColorScheme()</code></li>\n<li><code>systemPreferences.isHighContrastColorScheme()</code></li>\n</ul>\n<p>Veuillez utiliser à la place les propriétés de <code>nativeTheme</code> suivantes :</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code></li>\n<li><code>nativeTheme.shouldUseInvertedColorScheme</code></li>\n<li><code>nativeTheme.shouldUseHighContrastColors</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Depreciée</span>\nsystemPreferences.isDarkMode()\n<span class=\"hljs-comment\">// Remplacer par</span>\nnativeTheme.shouldUseDarkColors\n\n<span class=\"hljs-comment\">// Depreciée</span>\nsystemPreferences.isInvertedColorScheme()\n<span class=\"hljs-comment\">// Remplacer par</span>\nnativeTheme.shouldUseInvertedColorScheme\n\n<span class=\"hljs-comment\">// Depreciée</span>\nsystemPreferences.isHighContrastColorScheme()\n<span class=\"hljs-comment\">// Remplacer par</span>\nnativeTheme.shouldUseHighContrastColors\n</code></pre>\n<h2 id=\"planned-breaking-api-changes-70\"><a href=\"#planned-breaking-api-changes-70\">Planned Breaking API Changes (7.0)</a></h2>\n<h3 id=\"deprecated-atomio-node-headers-url\"><a href=\"#deprecated-atomio-node-headers-url\">Deprecated: Atom.io Node Headers URL</a></h3>\n<p>Il s’agit de l’URL spécifiée comme <code>disturl</code> dans un fichier <code>.npmrc</code> ou le flag <code>--dist-url</code> en ligne de commande lors de la compilation des modules natifs de Node.  Both will be supported for the foreseeable future but it is recommended that you switch.</p>\n<p>Déprécié : <a href=\"https://atom.io/download/electron\">https://atom.io/download/electron</a></p>\n<p>Remplacer par : <a href=\"https://electronjs.org/headers\">https://electronjs.org/headers</a></p>\n<h3 id=\"api-modifiée--sessionclearauthcache-naccepte-plus-les-options\"><a href=\"#api-modifiée--sessionclearauthcache-naccepte-plus-les-options\">API modifiée : <code>session.clearAuthCache()</code> n'accepte plus les options</a></h3>\n<p>The <code>session.clearAuthCache</code> API no longer accepts options for what to clear, and instead unconditionally clears the whole cache.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié</span>\nsession.clearAuthCache({ <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'password'</span> })\n<span class=\"hljs-comment\">// Remplacer par</span>\nsession.clearAuthCache()\n</code></pre>\n<h3 id=\"api-modifiée--powermonitorquerysystemidlestate-est-désormais-powermonitorgetsystemidlestate\"><a href=\"#api-modifiée--powermonitorquerysystemidlestate-est-désormais-powermonitorgetsystemidlestate\">API modifiée : <code>powerMonitor.querySystemIdleState</code> est désormais <code>powerMonitor.getSystemIdleState</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\npowerMonitor.querySystemIdleState(threshold, callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleState = powerMonitor.getSystemIdleState(threshold)\n</code></pre>\n<h3 id=\"api-modifiée--powermonitorquerysystemidletime-est-désormais-powermonitorgetsystemidletime\"><a href=\"#api-modifiée--powermonitorquerysystemidletime-est-désormais-powermonitorgetsystemidletime\">API modifiée : <code>powerMonitor.querySystemIdleTime</code> est désormais <code>powerMonitor.getSystemIdleTime</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\npowerMonitor.querySystemIdleTime(callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleTime = powerMonitor.getSystemIdleTime()\n</code></pre>\n<h3 id=\"api-changed-webframesetisolatedworldinfo-replaces-separate-methods\"><a href=\"#api-changed-webframesetisolatedworldinfo-replaces-separate-methods\">API Changed: <code>webFrame.setIsolatedWorldInfo</code> replaces separate methods</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Supprimé dans Electron 7.0</span>\nwebFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)\nwebFrame.setIsolatedWorldHumanReadableName(worldId, name)\nwebFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)\n<span class=\"hljs-comment\">// Remplacer par</span>\nwebFrame.setIsolatedWorldInfo(\n  worldId,\n  {\n    <span class=\"hljs-attr\">securityOrigin</span>: <span class=\"hljs-string\">'some_origin'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'human_readable_name'</span>,\n    <span class=\"hljs-attr\">csp</span>: <span class=\"hljs-string\">'content_security_policy'</span>\n  })\n</code></pre>\n<h3 id=\"removed-marked-property-on-getblinkmemoryinfo\"><a href=\"#removed-marked-property-on-getblinkmemoryinfo\">Removed: <code>marked</code> property on <code>getBlinkMemoryInfo</code></a></h3>\n<p>Cette propriété a été supprimée dans Chromium 77 et n'est donc plus disponible.</p>\n<h3 id=\"behavior-changed-webkitdirectory-attribute-for-input-typefile-now-lists-directory-contents\"><a href=\"#behavior-changed-webkitdirectory-attribute-for-input-typefile-now-lists-directory-contents\">Behavior Changed: <code>webkitdirectory</code> attribute for <code>&#x3C;input type=\"file\"/></code> now lists directory contents</a></h3>\n<p>The <code>webkitdirectory</code> property on HTML file inputs allows them to select folders. Dans les versions précédentes d'Electron l'implémentation était incorrecte et la propriété <code>event.target.files</code> de l'input retournait une <code>FileList</code> qui retournait un objet <code>File</code> correspondant au dossier sélectionné.</p>\n<p>As of Electron 7, that <code>FileList</code> is now list of all files contained within the folder, similarly to Chrome, Firefox, and Edge (<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory\">link to MDN docs</a>).</p>\n<p>En guise d'illustration, considérez un dossier avec cette structure :</p>\n<pre><code class=\"hljs language-console\">dossier\n├── fichier1\n├── fichier2\n└── fichier3\n</code></pre>\n<p>Dans Electron &#x3C; 6, cela renverrait une<code> FileList</code> avec un objet<code>File</code>pour :</p>\n<pre><code class=\"hljs language-console\">chemin/vers/dossier\n</code></pre>\n<p>Dans Electron 7, cela renvoie maintenant une<code> FileList</code> avec un objet<code>File</code>pour :</p>\n<pre><code class=\"hljs language-console\">/chemin/vers/dossier/fichier3\n/chemin/vers/dossier/fichier2\n/chemin/vers/dossier/fichier1\n</code></pre>\n<p>Note that <code>webkitdirectory</code> no longer exposes the path to the selected folder. If you require the path to the selected folder rather than the folder contents, see the <code>dialog.showOpenDialog</code> API (<a href=\"/docs/api/dialog#dialogshowopendialogbrowserwindow-options\">link</a>).</p>\n<h3 id=\"api-changed-callback-based-versions-of-promisified-apis\"><a href=\"#api-changed-callback-based-versions-of-promisified-apis\">API Changed: Callback-based versions of promisified APIs</a></h3>\n<p>Electron 5 et Electron 6 ont introduit des versions des API asynchrones existantes basées sur les promise et déprécié leurs homologues basées sur les callback. Dans Electron 7, toutes les APIs obsolètes basées sur les callback sont maintenant supprimées.</p>\n<p>Les fonctions suivantes ne retournent plus que des promesses :</p>\n<ul>\n<li><code>app.getFileIcon()</code> <a href=\"https://github.com/electron/electron/pull/15742\">#15742</a></li>\n<li><code>app.dock.show()</code> <a href=\"https://github.com/electron/electron/pull/16904\">#16904</a></li>\n<li><code>contentTracing.getCategories()</code> <a href=\"https://github.com/electron/electron/pull/16583\">#16583</a></li>\n<li><code>contentTracing.getTraceBufferUsage()</code> <a href=\"https://github.com/electron/electron/pull/16600\">#16600</a></li>\n<li><code>contentTracing.startRecording()</code> <a href=\"https://github.com/electron/electron/pull/16584\">#16584</a></li>\n<li><code>contentTracing.stopRecording()</code> <a href=\"https://github.com/electron/electron/pull/16584\">#16584</a></li>\n<li><code>contents.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>cookies.flushStore()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.get()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.remove()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.set()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>debugger.sendCommand()</code> <a href=\"https://github.com/electron/electron/pull/16861\">#16861</a></li>\n<li><code>dialog.showCertificateTrustDialog()</code> <a href=\"https://github.com/electron/electron/pull/17181\">#17181</a></li>\n<li><code>inAppPurchase.getProducts()</code> <a href=\"https://github.com/electron/electron/pull/17355\">#17355</a></li>\n<li><code>inAppPurchase.purchaseProduct()</code><a href=\"https://github.com/electron/electron/pull/17355\">#17355</a></li>\n<li><code>netLog.stopLogging()</code> <a href=\"https://github.com/electron/electron/pull/16862\">#16862</a></li>\n<li><code>session.clearAuthCache()</code> <a href=\"https://github.com/electron/electron/pull/17259\">#17259</a></li>\n<li><code>session.clearCache()</code>  <a href=\"https://github.com/electron/electron/pull/17185\">#17185</a></li>\n<li><code>session.clearHostResolverCache()</code> <a href=\"https://github.com/electron/electron/pull/17229\">#17229</a></li>\n<li><code>session.clearStorageData()</code> <a href=\"https://github.com/electron/electron/pull/17249\">#17249</a></li>\n<li><code>session.getBlobData()</code> <a href=\"https://github.com/electron/electron/pull/17303\">#17303</a></li>\n<li><code>session.getCacheSize()</code>  <a href=\"https://github.com/electron/electron/pull/17185\">#17185</a></li>\n<li><code>session.getCacheSize()</code> <a href=\"https://github.com/electron/electron/pull/17222\">#17185</a></li>\n<li><code>session.setProxy()</code>  <a href=\"https://github.com/electron/electron/pull/17222\">#17222</a></li>\n<li><code>shell.openExternal()</code> <a href=\"https://github.com/electron/electron/pull/16176\">#16176</a></li>\n<li><code>()</code> <a href=\"https://github.com/electron/electron/pull/15855\">#15855</a></li>\n<li><code>()</code> <a href=\"https://github.com/electron/electron/pull/15855\">#15855</a></li>\n<li><code>webContents.hasServiceWorker()</code> <a href=\"https://github.com/electron/electron/pull/16535\">#16535</a></li>\n<li><code>webContents.printToPDF()</code> <a href=\"https://github.com/electron/electron/pull/16795\">#16795</a></li>\n<li><code>webContents.savePage()</code> <a href=\"https://github.com/electron/electron/pull/16742\">#16742</a></li>\n<li><code>webFrame.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>webFrame.executeJavaScriptInIsolatedWorld()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>webviewTag.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>win.capturePage()</code> <a href=\"https://github.com/electron/electron/pull/15743\">#15743</a></li>\n</ul>\n<p>Ces fonctions ont maintenant deux formes, synchrone et asynchrone basées sur Promise :</p>\n<ul>\n<li><code>dialog.showMessageBox()</code>/<code>dialog.showMessageBoxSync()</code> <a href=\"https://github.com/electron/electron/pull/17298\">#17298</a></li>\n<li><code>dialog.showOpenDialog()</code>/<code>dialog.showOpenDialogSync()</code> <a href=\"https://github.com/electron/electron/pull/16973\">#16973</a></li>\n<li><code>dialog.showSaveDialog()</code>/<code>dialog.showSaveDialogSync()</code> <a href=\"https://github.com/electron/electron/pull/17054\">#17054</a></li>\n</ul>\n<h2 id=\"changements-api-non-rétro-compatible-prévus-60\"><a href=\"#changements-api-non-rétro-compatible-prévus-60\">Changements API non rétro-compatible prévus (6.0)</a></h2>\n<h3 id=\"api-modifiée--winsetmenunull-est-désormais-winremovemenu\"><a href=\"#api-modifiée--winsetmenunull-est-désormais-winremovemenu\">API modifiée : <code>win.setMenu(null)</code> est désormais <code>win.removeMenu()</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié</span>\nwin.setMenu(<span class=\"hljs-literal\">null</span>)\n<span class=\"hljs-comment\">// Remplacé par</span>\nwin.removeMenu()\n</code></pre>\n<h3 id=\"api-modifiée--electronscreen-dans-le-processus-de-rendu-doit-être-accédé-via-remote\"><a href=\"#api-modifiée--electronscreen-dans-le-processus-de-rendu-doit-être-accédé-via-remote\">API modifiée : <code>electron.screen</code> dans le processus de rendu doit être accédé via <code>remote</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).screen\n<span class=\"hljs-comment\">// Remplacé par</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.screen\n</code></pre>\n<h3 id=\"api-changed-requireing-node-builtins-in-sandboxed-renderers-no-longer-implicitly-loads-the-remote-version\"><a href=\"#api-changed-requireing-node-builtins-in-sandboxed-renderers-no-longer-implicitly-loads-the-remote-version\">API Changed: <code>require()</code>ing node builtins in sandboxed renderers no longer implicitly loads the <code>remote</code> version</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'child_process'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'child_process'</span>)\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'os'</span>)\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'path'</span>)\n</code></pre>\n<h3 id=\"déprécié--powermonitorquerysystemidlestate-remplacé-par-powermonitorgetsystemidlestate\"><a href=\"#déprécié--powermonitorquerysystemidlestate-remplacé-par-powermonitorgetsystemidlestate\">Déprécié : <code>powerMonitor.querySystemIdleState</code> remplacé par <code>powerMonitor.getSystemIdleState</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\npowerMonitor.querySystemIdleState(threshold, callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleState = powerMonitor.getSystemIdleState(threshold)\n</code></pre>\n<h3 id=\"déprécié--powermonitorquerysystemidletime-remplacé-par-powermonitorgetsystemidletime\"><a href=\"#déprécié--powermonitorquerysystemidletime-remplacé-par-powermonitorgetsystemidletime\">Déprécié : <code>powerMonitor.querySystemIdleTime</code> remplacé par <code>powerMonitor.getSystemIdleTime</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\npowerMonitor.querySystemIdleTime(callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleTime = powerMonitor.getSystemIdleTime()\n</code></pre>\n<h3 id=\"déprécié--appenablemixedsandbox-nest-plus-nécessaire\"><a href=\"#déprécié--appenablemixedsandbox-nest-plus-nécessaire\">Déprécié : <code>app.enableMixedSandbox()</code> n'est plus nécessaire</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié</span>\napp.enableMixedSandbox()\n</code></pre>\n<p>Le mode bac à sable mixte est désormais activé par défaut.</p>\n<h3 id=\"déprécié--traysethighlightmode\"><a href=\"#déprécié--traysethighlightmode\">Déprécié : <code>Tray.setHighlightMode</code></a></h3>\n<p>Sous macOS Catalina, notre ancienne implémentation de Tray est interrompue. Le substitut natif d'Apple ne prend pas en charge la modification du comportement de mise en évidence.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié</span>\ntray.setHighlightMode(mode)\n<span class=\"hljs-comment\">// L'API sera supprimée dans la v7.0 sans remplacement.</span>\n</code></pre>\n<h2 id=\"changements-majeurs-prévus-de-lapi-50\"><a href=\"#changements-majeurs-prévus-de-lapi-50\">Changements majeurs prévus de l'API (5.0)</a></h2>\n<h3 id=\"default-changed-nodeintegration-and-webviewtag-default-to-false-contextisolation-defaults-to-true\"><a href=\"#default-changed-nodeintegration-and-webviewtag-default-to-false-contextisolation-defaults-to-true\">Default Changed: <code>nodeIntegration</code> and <code>webviewTag</code> default to false, <code>contextIsolation</code> defaults to true</a></h3>\n<p>Les options suivantes de <code>webPreferences</code> seront dépréciées en faveur de nouvelles valeurs par défaut listées ci-dessous.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Propriétés</th><th>Valeur par défaut dépréciée</th><th>Nouvelle valeur par défaut</th></tr></thead><tbody><tr><td><code>contextIsolation</code></td><td><code>false</code></td><td><code>true</code></td></tr><tr><td><code>nodeIntegration</code></td><td><code>true</code></td><td><code>false</code></td></tr><tr><td><code>webviewTag</code></td><td><code>nodeIntegration</code> si mis sinon <code>true</code></td><td><code>false</code></td></tr></tbody></table>\n<p>Exemple : Re-enabling the webviewTag</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> w = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">webviewTag</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h3 id=\"comportement-modifié--nodeintegration-dans-les-fenêtres-enfants-ouvertes-via-nativewindowopen\"><a href=\"#comportement-modifié--nodeintegration-dans-les-fenêtres-enfants-ouvertes-via-nativewindowopen\">Comportement modifié : <code>nodeIntegration</code> dans les fenêtres enfants ouvertes via <code>nativeWindowOpen</code></a></h3>\n<p>Les fenêtres enfants ouvertes avec l'option <code>nativeWindowOpen</code> auront toujours Node.js integration désactivée, sauf si <code>nodeIntegrationInSubFrames</code> est à <code>true</code>.</p>\n<h3 id=\"api-changed-registering-privileged-schemes-must-now-be-done-before-app-ready\"><a href=\"#api-changed-registering-privileged-schemes-must-now-be-done-before-app-ready\">API Changed: Registering privileged schemes must now be done before app ready</a></h3>\n<p>Renderer process APIs <code>webFrame.registerURLSchemeAsPrivileged</code> and <code>webFrame.registerURLSchemeAsBypassingCSP</code> as well as browser process API <code>protocol.registerStandardSchemes</code> have been removed. A new API, <code>protocol.registerSchemesAsPrivileged</code> has been added and should be used for registering custom schemes with the required privileges. Les schémas personnalisés doivent être enregistrés avant que l'application soit prête.</p>\n<h3 id=\"déprécié--webframesetisolatedworld-remplacé-par-webframesetisolatedworldinfo\"><a href=\"#déprécié--webframesetisolatedworld-remplacé-par-webframesetisolatedworldinfo\">Déprécié : <code>webFrame.setIsolatedWorld*</code> remplacé par <code>webFrame.setIsolatedWorldInfo</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)\nwebFrame.setIsolatedWorldHumanReadableName(worldId, name)\nwebFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)\n<span class=\"hljs-comment\">// Replace with</span>\nwebFrame.setIsolatedWorldInfo(\n  worldId,\n  {\n    <span class=\"hljs-attr\">securityOrigin</span>: <span class=\"hljs-string\">'some_origin'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'human_readable_name'</span>,\n    <span class=\"hljs-attr\">csp</span>: <span class=\"hljs-string\">'content_security_policy'</span>\n  })\n</code></pre>\n<h3 id=\"api-modifiée--webframesetspellcheckprovider-prend-désormais-un-rappel-asynchrone\"><a href=\"#api-modifiée--webframesetspellcheckprovider-prend-désormais-un-rappel-asynchrone\">API modifiée : <code>webFrame.setSpellCheckProvider</code> prend désormais un rappel asynchrone</a></h3>\n<p>Le rappel <code>spellCheck</code> est désormais asynchrone et le paramètre <code>autoCorrectWord</code> a été supprimé.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, <span class=\"hljs-literal\">true</span>, {\n  <span class=\"hljs-attr\">spellCheck</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">text</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> !spellchecker.isMisspelled(text)\n  }\n})\n<span class=\"hljs-comment\">// Replace with</span>\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, {\n  <span class=\"hljs-attr\">spellCheck</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">words, callback</span>) =></span> {\n    callback(words.filter(<span class=\"hljs-function\"><span class=\"hljs-params\">text</span> =></span> spellchecker.isMisspelled(text)))\n  }\n})\n</code></pre>\n<h3 id=\"api-modifiée--webcontentsgetzoomlevel-et-webcontentsgetzoomfactor-sont-désormais-synchrones\"><a href=\"#api-modifiée--webcontentsgetzoomlevel-et-webcontentsgetzoomfactor-sont-désormais-synchrones\">API modifiée : <code>webContents.getZoomLevel</code> et <code>webContents.getZoomFactor</code> sont désormais synchrones</a></h3>\n<p><code>webContents.getZoomLevel</code> et <code>webContents.getZoomFactor</code> n'ont plus de callback en paramètre et retournent directement leurs valeur numérique.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié:</span>\nwebContents.getZoomLevel(<span class=\"hljs-function\">(<span class=\"hljs-params\">level</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(level)\n})\n<span class=\"hljs-comment\">// Remplacer par</span>\n<span class=\"hljs-keyword\">const</span> level = webContents.getZoomLevel()\n<span class=\"hljs-built_in\">console</span>.log(level)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié:</span>\nwebContents.getZoomLevel(<span class=\"hljs-function\">(<span class=\"hljs-params\">level</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(factor)\n})\n<span class=\"hljs-comment\">// Remplacer par</span>\n<span class=\"hljs-keyword\">const</span> level = webContents.getZoomLevel()\n<span class=\"hljs-built_in\">console</span>.log(factor)\n</code></pre>\n<h2 id=\"changements-majeurs-prévus-de-lapi-40\"><a href=\"#changements-majeurs-prévus-de-lapi-40\">Changements majeurs prévus de l'API (4.0)</a></h2>\n<p>The following list includes the breaking API changes made in Electron 4.0.</p>\n<h3 id=\"appmakesingleinstance\"><a href=\"#appmakesingleinstance\"><code>app.makeSingleInstance</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\napp.makeSingleInstance(<span class=\"hljs-function\">(<span class=\"hljs-params\">argv, cwd</span>) =></span> {\n  <span class=\"hljs-comment\">/* ... */</span>\n})\n<span class=\"hljs-comment\">// Replace with</span>\napp.requestSingleInstanceLock()\napp.on(<span class=\"hljs-string\">'second-instance'</span>, (event, argv, cwd) => {\n  <span class=\"hljs-comment\">/* ... */</span>\n})\n</code></pre>\n<h3 id=\"appreleasesingleinstance\"><a href=\"#appreleasesingleinstance\"><code>app.releaseSingleInstance</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié</span>\napp.releaseSingleInstance()\n<span class=\"hljs-comment\">// Remplacé par</span>\napp.releaseSingleInstanceLock()\n</code></pre>\n<h3 id=\"appgetgpuinfo\"><a href=\"#appgetgpuinfo\"><code>app.getGPUInfo</code></a></h3>\n<pre><code class=\"hljs language-js\">app.getGPUInfo(<span class=\"hljs-string\">'complete'</span>)\n<span class=\"hljs-comment\">// Now behaves the same with `basic` on macOS</span>\napp.getGPUInfo(<span class=\"hljs-string\">'basic'</span>)\n</code></pre>\n<h3 id=\"win_delay_load_hook\"><a href=\"#win_delay_load_hook\"><code>win_delay_load_hook</code></a></h3>\n<p>Quand vous compilez des modules natifs sous Windows, la variable <code>win_delay_load_hook</code> dans le fichier <code>binding.gyp</code> doit être mise à vrai (qui l'est par défaut). Si cet accroche n'est pas présente, l'exécution du module natif échouera sur Windows, avec un message d'erreur comme <code>Cannot find module</code>. Voir le <a href=\"/docs/tutorial/using-native-node-modules\">Guide des modules natifs</a> pour plus d'informations.</p>\n<h2 id=\"changements-majeurs-prévus-de-lapi-30\"><a href=\"#changements-majeurs-prévus-de-lapi-30\">Changements majeurs prévus de l'API (3.0)</a></h2>\n<p>La liste suivante inclut les changements majeurs pour Electron 3.0.</p>\n<h3 id=\"app\"><a href=\"#app\"><code>app</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\napp.getAppMemoryInfo()\n<span class=\"hljs-comment\">// Replace with</span>\napp.getAppMetrics()\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-keyword\">const</span> metrics = app.getAppMetrics()\n<span class=\"hljs-keyword\">const</span> { memory } = metrics[<span class=\"hljs-number\">0</span>] <span class=\"hljs-comment\">// Deprecated property</span>\n</code></pre>\n<h3 id=\"browserwindow\"><a href=\"#browserwindow\"><code>BrowserWindow</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié</span>\n<span class=\"hljs-keyword\">const</span> optionsA = { <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">blinkFeatures</span>: <span class=\"hljs-string\">''</span> } }\n<span class=\"hljs-keyword\">const</span> windowA = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsA)\n<span class=\"hljs-comment\">// Remplacer par</span>\n<span class=\"hljs-keyword\">const</span> optionsB = { <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">enableBlinkFeatures</span>: <span class=\"hljs-string\">''</span> } }\n<span class=\"hljs-keyword\">const</span> windowB = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsB)\n\n<span class=\"hljs-comment\">// Déprécié</span>\n<span class=\"hljs-built_in\">window</span>.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'media-play_pause'</span>) {\n    <span class=\"hljs-comment\">// fait quelque chose</span>\n  }\n})\n<span class=\"hljs-comment\">// Remplacer par</span>\n<span class=\"hljs-built_in\">window</span>.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'media-play-pause'</span>) {\n    <span class=\"hljs-comment\">// fait quelque chose</span>\n  }\n})\n</code></pre>\n<h3 id=\"clipboard\"><a href=\"#clipboard\"><code>clipboard</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié</span>\nclipboard.readRtf()\n<span class=\"hljs-comment\">// Remplacé par</span>\nclipboard.readRTF()\n\n<span class=\"hljs-comment\">// Déprécié</span>\nclipboard.writeRtf()\n<span class=\"hljs-comment\">// Remplacé par</span>\nclipboard.writeRTF()\n\n<span class=\"hljs-comment\">// Déprécié</span>\nclipboard.readHtml()\n<span class=\"hljs-comment\">// Remplacé par</span>\nclipboard.readHTML()\n\n<span class=\"hljs-comment\">// Déprécié</span>\nclipboard.writeHtml()\n<span class=\"hljs-comment\">// Remplacé par</span>\nclipboard.writeHTML()\n</code></pre>\n<h3 id=\"crashreporter\"><a href=\"#crashreporter\"><code>crashReporter</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié</span>\ncrashReporter.start({\n  <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Crashly'</span>,\n  <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://crash.server.com'</span>,\n  <span class=\"hljs-attr\">autoSubmit</span>: <span class=\"hljs-literal\">true</span>\n})\n<span class=\"hljs-comment\">// Remplacé par</span>\ncrashReporter.start({\n  <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Crashly'</span>,\n  <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://crash.server.com'</span>,\n  <span class=\"hljs-attr\">uploadToServer</span>: <span class=\"hljs-literal\">true</span>\n})\n</code></pre>\n<h3 id=\"nativeimage\"><a href=\"#nativeimage\"><code>nativeImage</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié</span>\nnativeImage.createFromBuffer(buffer, <span class=\"hljs-number\">1.0</span>)\n<span class=\"hljs-comment\">// Remplacé par</span>\nnativeImage.createFromBuffer(buffer, {\n  <span class=\"hljs-attr\">scaleFactor</span>: <span class=\"hljs-number\">1.0</span>\n})\n</code></pre>\n<h3 id=\"processus-process\"><a href=\"#processus-process\"><code>processus (process)</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié</span>\n<span class=\"hljs-keyword\">const</span> info = process.getProcessMemoryInfo()\n</code></pre>\n<h3 id=\"screen\"><a href=\"#screen\"><code>screen</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié</span>\nscreen.getMenuBarHeight()\n<span class=\"hljs-comment\">// Remplacé par</span>\nscreen.getPrimaryDisplay().workArea\n</code></pre>\n<h3 id=\"session\"><a href=\"#session\"><code>session</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nses.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">hostname, certificate, callback</span>) =></span> {\n  callback(<span class=\"hljs-literal\">true</span>)\n})\n<span class=\"hljs-comment\">// Replace with</span>\nses.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">request, callback</span>) =></span> {\n  callback(<span class=\"hljs-number\">0</span>)\n})\n</code></pre>\n<h3 id=\"tray\"><a href=\"#tray\"><code>Tray</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié</span>\ntray.setHighlightMode(<span class=\"hljs-literal\">true</span>)\n<span class=\"hljs-comment\">// Remplacé par</span>\ntray.setHighlightMode(<span class=\"hljs-string\">'on'</span>)\n\n<span class=\"hljs-comment\">// Déprécié</span>\ntray.setHighlightMode(<span class=\"hljs-literal\">false</span>)\n<span class=\"hljs-comment\">// Remplacé par</span>\ntray.setHighlightMode(<span class=\"hljs-string\">'off'</span>)\n</code></pre>\n<h3 id=\"webcontents\"><a href=\"#webcontents\"><code>webContents</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié</span>\nwebContents.openDevTools({ <span class=\"hljs-attr\">detach</span>: <span class=\"hljs-literal\">true</span> })\n<span class=\"hljs-comment\">// Remplacé par</span>\nwebContents.openDevTools({ <span class=\"hljs-attr\">mode</span>: <span class=\"hljs-string\">'detach'</span> })\n\n<span class=\"hljs-comment\">// Supprimé</span>\nwebContents.setSize(options)\n<span class=\"hljs-comment\">// Il n'y a pas de remplacement prévu</span>\n</code></pre>\n<h3 id=\"webframe\"><a href=\"#webframe\"><code>webFrame</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.registerURLSchemeAsSecure(<span class=\"hljs-string\">'app'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\nprotocol.registerStandardSchemes([<span class=\"hljs-string\">'app'</span>], { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n\n<span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.registerURLSchemeAsPrivileged(<span class=\"hljs-string\">'app'</span>, { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nprotocol.registerStandardSchemes([<span class=\"hljs-string\">'app'</span>], { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n</code></pre>\n<h3 id=\"webview\"><a href=\"#webview\"><code>&#x3C;webview></code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Supprimé</span>\nwebview.setAttribute(<span class=\"hljs-string\">'disableguestresize'</span>, <span class=\"hljs-string\">''</span>)\n<span class=\"hljs-comment\">// There is no replacement for this API</span>\n\n<span class=\"hljs-comment\">// Supprimé</span>\nwebview.setAttribute(<span class=\"hljs-string\">'guestinstance'</span>, instanceId)\n<span class=\"hljs-comment\">// There is no replacement for this API</span>\n\n<span class=\"hljs-comment\">// Les écouteurs d'événements ne marchent plus sur les tags webview</span>\nwebview.onkeydown = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* handler */</span> }\nwebview.onkeyup = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* handler */</span> }\n</code></pre>\n<h3 id=\"node-headers-url\"><a href=\"#node-headers-url\">Node Headers URL</a></h3>\n<p>Il s’agit de l’URL spécifiée comme <code>disturl</code> dans un fichier <code>.npmrc</code> ou le flag <code>--dist-url</code> en ligne de commande lors de la compilation des modules natifs de Node.</p>\n<p>Déprécié : <a href=\"https://atom.io/download/atom-shell\">https://atom.io/download/atom-shell</a></p>\n<p>Remplacé par : <a href=\"https://atom.io/download/electron\">https://atom.io/download/electron</a></p>\n<h2 id=\"changements-majeurs-prévus-de-lapi-20\"><a href=\"#changements-majeurs-prévus-de-lapi-20\">Changements majeurs prévus de l'API (2.0)</a></h2>\n<p>La liste suivant inclut les changements majeurs faits dans Electron 2.0.</p>\n<h3 id=\"browserwindow-1\"><a href=\"#browserwindow-1\"><code>BrowserWindow</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Déprécié</span>\n<span class=\"hljs-keyword\">const</span> optionsA = { <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden-inset'</span> }\n<span class=\"hljs-keyword\">const</span> windowA = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsA)\n<span class=\"hljs-comment\">// Remplacer par</span>\n<span class=\"hljs-keyword\">const</span> optionsB = { <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span> }\n<span class=\"hljs-keyword\">const</span> windowB = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsB)\n</code></pre>\n<h3 id=\"menu\"><a href=\"#menu\"><code>menu</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Supprimé</span>\nmenu.popup(browserWindow, <span class=\"hljs-number\">100</span>, <span class=\"hljs-number\">200</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Remplacé par</span>\nmenu.popup(browserWindow, { <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">100</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">200</span>, <span class=\"hljs-attr\">positioningItem</span>: <span class=\"hljs-number\">2</span> })\n</code></pre>\n<h3 id=\"nativeimage-1\"><a href=\"#nativeimage-1\"><code>nativeImage</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Supprimé</span>\nnativeImage.toPng()\n<span class=\"hljs-comment\">// Remplacé par</span>\nnativeImage.toPNG()\n\n<span class=\"hljs-comment\">// Supprimé</span>\nnativeImage.toJpeg()\n<span class=\"hljs-comment\">// Remplacé par</span>\nnativeImage.toJPEG()\n</code></pre>\n<h3 id=\"processus-process-1\"><a href=\"#processus-process-1\"><code>processus (process)</code></a></h3>\n<ul>\n<li><code>process.versions.electron</code> et <code>process.version.chrome</code> seront mis en lecture seule par souci de cohérence avec la propriété <code>process.versions</code> définie par Node.</li>\n</ul>\n<h3 id=\"webcontents-1\"><a href=\"#webcontents-1\"><code>webContents</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Supprimé</span>\nwebContents.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Remplacé par</span>\nwebContents.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"webframe-1\"><a href=\"#webframe-1\"><code>webFrame</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Supprimé</span>\nwebFrame.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Remplacé par</span>\nwebFrame.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"webview-1\"><a href=\"#webview-1\"><code>&#x3C;webview></code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Supprimé</span>\nwebview.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Remplacé par</span>\nwebview.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"versions-arm-dupliquées\"><a href=\"#versions-arm-dupliquées\">Versions ARM dupliquées</a></h3>\n<p>Chaque version d'Electron contient deux versions ARM identiques avec des noms légèrement différents, comme <code>electron-v1.7.3-linux-arm.zip</code> et <code>electron-v1.7.3-linux-armv7l.zip</code>. Celui avec le préfixe <code>v7l</code> a été ajouté pour clarifier aux utilisateurs quelle version ARM elle supporte, et supprimer les ambiguïtés des prochains paquets armv6l et arm64 qui pourraient être produites.</p>\n<p>The file <em>without the prefix</em> is still being published to avoid breaking any setups that may be consuming it. À partir de la 2.0, le fichier sans préfixe ne sera plus publié.</p>\n<p>Pour plus de détails, voir <a href=\"https://github.com/electron/electron/pull/6986\">6986</a> et <a href=\"https://github.com/electron/electron/pull/7189\">7189</a>.</p>",
      "title": "Changements de rupture",
      "description": ""
    },
    "/docs/api/browser-view": {
      "locale": "fr-FR",
      "slug": "browser-view",
      "href": "/docs/api/browser-view",
      "crowdinFileId": "256283",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-view.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"browserview\"><a href=\"#browserview\">BrowserView</a></h1>\n<p>Un <code>BrowserView</code> peut être utilisé pour intégrer des contenus web supplémentaires dans un <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. C'est comme une fenêtre enfant, sauf qu'il est positionné par rapport à sa fenêtre propriétaire. Il se veut être une alternative à la balise <code>webview</code>.</p>\n<h2 id=\"classe--browserview\"><a href=\"#classe--browserview\">Classe : BrowserView</a></h2>\n<blockquote>\n<p>Créer et contrôle les fenêtres.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h3 id=\"example\"><a href=\"#example\">Example</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Dans le processus main.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserView, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-keyword\">const</span> view = <span class=\"hljs-keyword\">new</span> BrowserView()\nwin.setBrowserView(view)\nview.setBounds({ <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">0</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">0</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">300</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">300</span> })\nview.webContents.loadURL(<span class=\"hljs-string\">'https://electronjs.org'</span>)\n</code></pre>\n<h3 id=\"new-browserviewoptions-experimental\"><a href=\"#new-browserviewoptions-experimental\"><code>new BrowserView([options])</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>webPreferences</code> Object (facultatif) - Voir <a href=\"/docs/api/browser-window\">BrowserWindow</a>.</li>\n</ul></li>\n</ul>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<p>Les objets créés avec <code>new BrowserView</code> ont les propriétés suivantes :</p>\n<h4 id=\"viewwebcontents-experimental\"><a href=\"#viewwebcontents-experimental\"><code>view.webContents</code> <em>Experimental</em></a></h4>\n<p>Un objet <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> appartient à cette vue.</p>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<p>Les objets créés avec <code>new BrowserView</code> ont les méthodes d’instance suivant :</p>\n<h4 id=\"viewsetautoresizeoptions-experimental\"><a href=\"#viewsetautoresizeoptions-experimental\"><code>view.setAutoResize(options)</code> <em>Experimental</em></a></h4>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>width</code> Boolean (optional) - If <code>true</code>, the view's width will grow and shrink together with the window. <code>false</code> by default.</li>\n<li><code>height</code> Boolean (optional) - If <code>true</code>, the view's height will grow and shrink together with the window. <code>false</code> by default.</li>\n<li><code>horizontal</code> Boolean (optional) - If <code>true</code>, the view's x position and width will grow and shrink proportionally with the window. <code>false</code> by default.</li>\n<li><code>vertical</code> Boolean (optional) - If <code>true</code>, the view's y position and height will grow and shrink proportionally with the window. <code>false</code> by default.</li>\n</ul></li>\n</ul>\n<h4 id=\"viewsetboundsbounds-experimental\"><a href=\"#viewsetboundsbounds-experimental\"><code>view.setBounds(bounds)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Redimensionne et déplace la vue vers les limites fournies par rapport à la fenêtre.</p>\n<h4 id=\"viewgetbounds-expérimental\"><a href=\"#viewgetbounds-expérimental\"><code>view.getBounds()</code> <em>Expérimental</em></a></h4>\n<p>Retourne <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>Les <code>limites</code> de cette instance BrowserView comme <code>Object</code>.</p>\n<h4 id=\"viewsetbackgroundcolorcolor-experimental\"><a href=\"#viewsetbackgroundcolorcolor-experimental\"><code>view.setBackgroundColor(color)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>color</code> String - Color in <code>#aarrggbb</code> or <code>#argb</code> form. The alpha channel is optional.</li>\n</ul>",
      "title": "BrowserView",
      "description": "Créer et contrôle les fenêtres."
    },
    "/docs/api/browser-window": {
      "locale": "fr-FR",
      "slug": "browser-window",
      "href": "/docs/api/browser-window",
      "crowdinFileId": "256287",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-window.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"browserwindow\"><a href=\"#browserwindow\">BrowserWindow</a></h1>\n<blockquote>\n<p>Créer et gérer des fenêtres navigateur.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Dans le processus main.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-comment\">// Load a remote URL</span>\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\n<span class=\"hljs-comment\">// Or load a local HTML file</span>\nwin.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n</code></pre>\n<h2 id=\"fenêtre-sans-bords-frameless-window\"><a href=\"#fenêtre-sans-bords-frameless-window\">Fenêtre sans bords (Frameless window)</a></h2>\n<p>Pour créer une fenêtre sans chrome, ou une fenêtre transparente de forme arbitraire, vous pouvez utiliser l'API <a href=\"/docs/api/frameless-window\">Frameless Window</a>.</p>\n<h2 id=\"showing-the-window-gracefully\"><a href=\"#showing-the-window-gracefully\">Showing the window gracefully</a></h2>\n<p>When loading a page in the window directly, users may see the page load incrementally, which is not a good experience for a native app. To make the window display without a visual flash, there are two solutions for different situations.</p>\n<h3 id=\"using-the-ready-to-show-event\"><a href=\"#using-the-ready-to-show-event\">Using the <code>ready-to-show</code> event</a></h3>\n<p>Pendant le chargement de la page, l'événement <code>ready-to-show</code> sera émis lorsque le process de rendu aura rendu la page pour la première fois si la fenêtre n'a pas encore été rendue. Afficher la page une fois que l'event a été trigger rendra la page sans ce processus de chargement au fur et à mesure:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span> })\nwin.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => {\n  win.show()\n})\n</code></pre>\n<p>Cet événement est généralement émis après l’événement <code>did-finish-load</code>, mais pour les pages avec beaucoup de ressources distantes, il peut être émis avant l’événement <code>did-finish-load</code>.</p>\n<p>Veuillez noter que l'utilisation de cet événement implique que le moteur de rendu sera considéré comme \"visible\" et peinture, même si <code>show</code> est faux.  Cet événement ne se déclenchera jamais si vous utilisez <code>paintWhenInitiallyHidden: false</code></p>\n<h3 id=\"setting-the-backgroundcolor-property\"><a href=\"#setting-the-backgroundcolor-property\">Setting the <code>backgroundColor</code> property</a></h3>\n<p>Pour une application complexe, l’événement <code>ready-to-show</code> pourrait être émis trop tard, donnant une impression de lenteur. Dans ce cas, il est recommandé d'afficher la fenêtre immédiatement et d'utiliser un <code>backgroundColor</code> proche de la couleur de fond de votre application :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#2e2c29'</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<p>Notez que même pour les applications qui utilisent l'évènement <code>ready-to-show</code>, il est toujours recommandé de définir <code>backgroundColor</code> pour avoir un rendu plus naturel.</p>\n<h2 id=\"fenêtres-parent-et-enfant\"><a href=\"#fenêtres-parent-et-enfant\">Fenêtres parent et enfant</a></h2>\n<p>En utilisant l'option <code>parent</code>, vous pouvez créer une fenêtre enfant:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> top = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n<span class=\"hljs-keyword\">const</span> child = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">parent</span>: top })\nchild.show()\ntop.show()\n</code></pre>\n<p>La fenêtre <code>child</code> sera toujours au dessus de la fenêtre <code>top</code>.</p>\n<h2 id=\"fenêtres-modales\"><a href=\"#fenêtres-modales\">Fenêtres modales</a></h2>\n<p>Une fenêtre modale est une fenêtre enfant qui désactive la fenêtre parent. Pour créer une fenêtre modale, il faut définir les options <code>parent</code> et <code>modal</code> :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> child = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">parent</span>: top, <span class=\"hljs-attr\">modal</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span> })\nchild.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\nchild.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => {\n  child.show()\n})\n</code></pre>\n<h2 id=\"visibilité-de-la-page\"><a href=\"#visibilité-de-la-page\">Visibilité de la page</a></h2>\n<p>L'<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API\">API de visibilité de la page</a> fonctionne comme ci-dessous :</p>\n<ul>\n<li>Sur toutes les plateformes, l'état de visibilité détécte si la fenêtre est cachée/minimisée ou pas.</li>\n<li>De plus, sur macOS, l'état de visibilité détécte également l'état d'occlusion de la fenêtre. Si la fenêtre est occluée (c'est-à-dire entièrement recouverte) par une autre fenêtre, l'état de visibilité sera <code>hidden</code>. Sur les autres plateformes, l'état de visibilité sera <code>hidden</code> seulement lorsque la fenêtre est minimisée ou cachée explicitement avec <code>win.hide()</code>.</li>\n<li>Si une <code>BrowserWindow</code> est crée avec <code>show:false</code>, l'état de visibilité initial sera <code>visible</code> même si la fenêtre est cachée.</li>\n<li>Si <code>backgroundThrottling</code> est désactivé, l'état de visibilité restera <code>visible</code> même si la fenêtre est minimisée, obstruée ou cachée.</li>\n</ul>\n<p>Il est recommandé de mettre en pause les opérations coûteuse lorsque l'état de visibilité est <code>hidden</code> afin de minimiser la consommation d'énergie.</p>\n<h2 id=\"avertissement-sur-les-plateformes\"><a href=\"#avertissement-sur-les-plateformes\">Avertissement sur les plateformes</a></h2>\n<ul>\n<li>Sur macOS, les fenêtres modales seront affichés comme des feuilles attachées à la fenêtre parent.</li>\n<li>Sur macOS, la fenêtre enfant va garder la position relative à la fenêtre parent lorsque la fenêtre parent bouge. Sur Windows et Linux, la fenêtre enfant ne bougera pas.</li>\n<li>Sur Linux, le type des fenêtre modales sera changé par <code>dialog</code>.</li>\n<li>Sur Linux, beaucoup d'environnements bureau ne peuvent pas cacher une fenêtre modale.</li>\n</ul>\n<h2 id=\"classe--browserwindow\"><a href=\"#classe--browserwindow\">Classe : BrowserWindow</a></h2>\n<blockquote>\n<p>Créer et gérer des fenêtres navigateur.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>BrowserWindow</code> est un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p>Cela crée une nouvelle <code>BrowserWindow</code> avec les propriétés natives définies par les <code>options</code>.</p>\n<h3 id=\"new-browserwindowoptions\"><a href=\"#new-browserwindowoptions\"><code>new BrowserWindow([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>width</code> Entier (facultatif) - Largeur de la fenêtre en pixels. Le Defaut est<code>800</code>.</li>\n<li><code>height</code> Entier (facultatif) - Hauteur de la fenêtre en pixels. Defaut es <code>600</code>.</li>\n<li><code>x</code> Entier (optionel) - (<strong>obligatoire</strong> si y n'est pas utilise) Le décalage de la fenêtre a été effacé de l'écran. Le defaut est de centrer la fenetre.</li>\n<li><code>y</code> Entier (optionel) - (<strong>obligatoire</strong> si x est utilisé) Le décalage de la partie supérieure de la fenêtre a été efface de l'écran. Le defaut est de centrer la fenetre.</li>\n<li><code>useContentSize</code> Boolean (facultatif) - La largeur et la hauteur (<code>width</code> et <code>height</code>) seront utilisées pour définir la taille de la page Web, ce qui signifie que la taille de la fenêtre réelle inclura la taille du cadre de celle-ci. La fenêtre complète sera donc légèrement plus grande que la taille de son contenu. Par défaut la valeur est <code>false</code>.</li>\n<li><code>center</code> Boolean (facultatif) - afficher la fenêtre dans le centre de l’écran.</li>\n<li><code>Largeurmin</code>Integre (optionel)-La largeur minimum de la Fenetre. La valeur par defaut en est ``.</li>\n<li><code>minHeight</code> Integer (facultatif) - Hauteur minimale de la fenêtre en pixels. La valeur par defaut en est ``.</li>\n<li><code>maxWidth</code> Integer (optional) - Window's maximum width. Default is no limit.</li>\n<li><code>maxHeight</code> Integer (optional) - Window's maximum height. Default is no limit.</li>\n<li><code>resizable</code> Boolean (optional) - Whether window is resizable. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>movable</code> Boolean (optional) - Whether window is movable. Ceci n'est pas implémenté sur Linux. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>minimizable</code> Boolean (optional) - Whether window is minimizable. Ceci n'est pas implémenté sous Linux. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>maximizable</code> Boolean (optional) - Whether window is maximizable. Ceci n'est pas implémenté sous Linux. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>closable</code> Boolean (optional) - Whether window is closable. Ceci n'est pas implémenté sur Linux. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>focusable</code> Boolean (facultatif) - Si la fenêtre peut avoir le focus. La valeur par défaut est <code>true</code>. Sur Windows, mettre <code>focusable: false</code> implique également le réglage <code>skipTaskbar: true</code>. Sur Linux, mettre <code>focusable: false</code> fait que la fenêtre arrête d'interragir avec wm, par conséquent la fenêtre restera toujours au dessus dans tous les espaces de travail.</li>\n<li><code>alwaysOnTop</code> Boolean (optional) - Whether the window should always stay on top of other windows. Par défaut la valeur est <code>false</code>.</li>\n<li><code>fullscreen</code> Boolean (facultatif) - Est-ce que la fenêtre doit s'afficher en plein écran. Quand explicitement mit a <code>false</code>, le bouton plein écran sera caché ou désactivé sur macOS. Par défaut la valeur est <code>false</code>.</li>\n<li><code>fullscreenable</code> Boolean (facultatif) - Est-ce que la fenêtre peut s'afficher en plein écran. Sur macOS, indiquez également si le bouton de maximizer/zoom doit basculer en mode plein écran ou agrandir la fenêtre. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>simpleFullscreen</code> Boolean (optional) - Use pre-Lion fullscreen on macOS. Par défaut la valeur est <code>false</code>.</li>\n<li><code>skipTaskbar</code> Boolean (optional) - Whether to show the window in taskbar. La valeur par défaut est <code>false</code>.</li>\n<li><code>kiosk</code> Boolean (optional) - Whether the window is in kiosk mode. Par défaut la valeur est <code>false</code>.</li>\n<li><code>titre</code> String (facultatif) - Titre par défaut de la fenêtre. La valeur par défaut est <code>\"Electron\"</code>. Si la balise HTML <code>&#x3C;title></code> est définie dans le fichier HTML chargé par <code>loadURL()</code>, cette propriété sera ignorée.</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (facultatif) - L'icône de la fenêtre. Sur Windows, il est recommandé d'utiliser le format <code>ICO</code> pour un rendu optimal. Si non défini, l'icone de l’exécutable sera utilisé.</li>\n<li><code>show</code> Boolean (optional) - Whether window should be shown when created. La valeur par défaut est <code>true</code>.</li>\n<li><code>paintWhenInitiallyHidden</code> Boolean (facultatif) - Si le moteur de rendu doit être actif lorsque <code>show</code> est <code>false</code> et qu'il vient d'être créé.  Afin que <code>document.visibilityState</code> fonctionne correctement lors du premier chargement avec <code>show: false</code> vous devez définir ceci à <code>false</code>.  Mettre ceci à <code>false</code> fera que l'événement <code>prêt-à-montrer</code> ne sera pas déclenché.  La valeur par défaut est <code>vraie</code>.</li>\n<li><code>frame</code> Boolean (optional) - Specify <code>false</code> to create a <a href=\"/docs/api/frameless-window\">Frameless Window</a>. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>parent</code> BrowserWindow (optional) - Specify parent window. Par défaut la valeur est <code>null</code>.</li>\n<li><code>modal</code> Boolean (optional) - Whether this is a modal window. This only works when the window is a child window. Par défaut la valeur est <code>false</code>.</li>\n<li><code>acceptFirstMouse</code> Boolean (facultatif) - Un click sur une fenêtre inactive passera à travers jusqu'au contenu Web. La valeur par défaut est <code>false</code> sur macOS. Cette option n'est pas configurable sur les autres plateformes.</li>\n<li><code>disableAutoHideCursor</code> Boolean (optional) - Whether to hide cursor when typing. Par défaut la valeur est <code>false</code>.</li>\n<li><code>autoHideMenuBar</code> Boolean (optional) - Auto hide the menu bar unless the <code>Alt</code> key is pressed. Par défaut la valeur est <code>false</code>.</li>\n<li><code>enableLargerThanScreen</code> Booléen (facultatif) - Permet à la fenêtre d'être redimensionnée plus grande que l'écran. Seulement pertinent pour macOS, car les autres systèmes d'exploitation autorisent par défaut des fenêtres plus grandes qu'écran par défaut. Par défaut la valeur est <code>false</code>.</li>\n<li><code>BackgroundColor</code> String (facultatif) - Couleur d'arrière-plan de la fenêtre en valeur hexadécimale, comme <code>#66CD00</code> ou <code>#FFF</code> ou <code>#80FFFFFF</code> (alpha au format #AARRGGBB est supporté si <code>transparent</code> est défini à <code>true</code>). La valeur par défaut est <code>#FFF</code> (white).</li>\n<li><code>hasShadow</code> Boolean (optional) - Whether window should have a shadow. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>opacity</code> Number (optional) - Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0 (fully opaque). Ceci n'est implémenté que sur Windows et macOS.</li>\n<li><code>darkTheme</code> Boolean (optionnel) - Force l'utilisation du thème sombre pour la fenêtre, fonctionne uniquement sur certains environnements de bureau GTK+3. Par défaut la valeur est <code>false</code>.</li>\n<li><code>transparent</code> Boolean (facultatif) - Rend la fenêtre <a href=\"/docs/api/frameless-window#transparent-window\">transparente</a>. Par défaut la valeur est <code>false</code>. Sous Windows, ne fonctionne pas à moins que la fenêtre ne soit sans cadres.</li>\n<li><code>type</code> String (optional) - The type of window, default is normal window. See more about this below.</li>\n<li><code>visualEffectState</code> String (optional) - Specify how the material appearance should reflect window activity state on macOS. Must be used with the <code>vibrancy</code> property. Les valeurs possibles sont :<ul>\n<li><code>followWindow</code> - The backdrop should automatically appear active when the window is active, and inactive when it is not. This is the default.</li>\n<li><code>active</code> - The backdrop should always appear active.</li>\n<li><code>inactive</code> - The backdrop should always appear inactive.</li>\n</ul></li>\n<li><code>titleBarStyle</code> String (optional) <em>macOS</em> <em>Windows</em> - The style of window title bar. Par défaut la valeur est <code>default</code>. Les valeurs possibles sont :<ul>\n<li><code>default</code> - Results in the standard title bar for macOS or Windows respectively.</li>\n<li><code>hidden</code> - Results in a hidden title bar and a full size content window. On macOS, the window still has the standard window controls (“traffic lights”) in the top left. On Windows, when combined with <code>titleBarOverlay: true</code> it will activate the Window Controls Overlay (see <code>titleBarOverlay</code> for more information), otherwise no window controls will be shown.</li>\n<li><code>hiddenInset</code> - Only on macOS, results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge.</li>\n<li><code>customButtonsOnHover</code> - Only on macOS, results in a hidden title bar and a full size content window, the traffic light buttons will display when being hovered over in the top left of the window.  <strong>Note:</strong> Cette option est actuellement expérimentale.</li>\n</ul></li>\n<li><code>trafficLightPosition</code> <a href=\"/docs/api/structures/point\">Point</a> (optional) - Set a custom position for the traffic light buttons in frameless windows.</li>\n<li><code>roundedCorners</code> Boolean (optional) - Whether frameless window should have rounded corners on macOS. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>fullscreenWindowTitle</code> Boolean (optional) <em>Deprecated</em> - Shows the title in the title bar in full screen mode on macOS for <code>hiddenInset</code> titleBarStyle. Par défaut la valeur est <code>false</code>.</li>\n<li><code>thickFrame</code> Boolean (facultatif) - Utilisez le style <code>WS_THICKFRAME</code> pour les fenêtres sans cadre sur Windows, qui ajoute une image standard de fenêtre. Le définir à <code>false</code> supprimera les animations de fenêtre et de fenêtre. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>vibrancy</code> String (facultatif) - Ajoute un type d'effet de vibrance à la fenêtre, uniquement sur macOS. Peut être <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>titlebar</code>, <code>selection</code>, <code>menu</code>, <code>popover</code>, <code>, &#x3C;code>sidebar</code>, <code>medium-light</code>, <code>ultra-dark</code>, <code>header</code>, <code>sheet</code>, <code>window</code>, <code>hud</code>, <code>fullscreen-ui</code>, <code>outil>, &#x3C;code>content&#x3C;code>, &#x3C;0>sous-window</code>. Please note that <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>medium-light</code>, and <code>ultra-dark</code> are deprecated and have been removed in macOS Catalina (10.15).</li>\n<li><code>zoomToPageWidth</code> Boolean (optional) - Controls the behavior on macOS when option-clicking the green stoplight button on the toolbar or by clicking the Window > Zoom menu item. Si <code>true</code>, la fenêtre grandira à la largeur préférée de la page web lors du zoom, <code>false</code> le fera zoomer sur la largeur de l'écran. Cela affectera également le comportement lorsque vous appelez <code>maximize()</code> directement. Par défaut la valeur est <code>false</code>.</li>\n<li><code>tabbingIdentifier</code> String (facultatif) - Nom du groupe d'onglets, permet d'ouvrir la fenêtre sous la forme d'un onglet natif sur macOS 10.12+. Les fenêtres avec le même identifiant de tabulation seront regroupées. Cela ajoute également un nouveau bouton d'onglet natif à la barre d'onglets de votre fenêtre et permet à votre <code>app</code> et fenêtre de recevoir l'événement <code>new-window-for-tab</code>.</li>\n<li><code>webPreferences</code> Object (optional) - Settings of web page's features.<ul>\n<li><code>devTools</code> Boolean (facultatif) - Activer ou non DevTools. Si elle est définie à <code>false</code>, ne peut pas utiliser <code>BrowserWindow.webContents.openDevTools()</code> pour ouvrir DevTools. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>nodeIntegration</code> Boolean (optional) - Whether node integration is enabled. Par défaut la valeur est <code>false</code>.</li>\n<li><code>nodeIntegrationInWorker</code> Boolean (facultatif) - Si l'intégration de nœuds est activée dans les workflows web. Par défaut la valeur est <code>false</code>. Plus d'informations peuvent être trouvée dans <a href=\"/docs/tutorial/multithreading\">Multithreading</a>.</li>\n<li><code>nodeIntegrationInSubFrames</code> Boolean (facultatif) - Option expérimentale pour activer le support de Node.js dans les sous-cadres tels que les iframes et les fenêtres enfants. Tous vos préchargements seront chargés pour chaque iframe, vous pouvez utiliser <code>process.isMainFrame</code> pour déterminer si vous êtes dans le cadre principal ou non.</li>\n<li><code>preload</code> String (facultatif) - Spécifie un script qui sera chargé avant les autres scripts exécutés dans la page. Ce script aura toujours accès aux API de noeuds peu importe que l'intégration de noeuds soit activée ou désactivée. La valeur doit être le chemin absolu vers le script. Lorsque l'intégration des nœuds est désactivée, le script de préchargement peut réintroduire les symboles globaux de nœud dans la portée globale. Voir l'exemple <a href=\"/docs/api/context-bridge#exposing-node-global-symbols\">ici</a>.</li>\n<li><code>sandbox</code> Booléen (facultatif) - Si défini, le moteur de rendu associé à la fenêtre, la rendre compatible avec le bac à sable Chromium au niveau du système d'exploitation et la désactivation du nœud. s moteur. Ce n'est pas la même chose que l'option <code>nodeIntegration</code> et les API disponibles pour le script de préchargement sont plus limitées. En savoir plus sur l'option <a href=\"/docs/tutorial/sandbox\">ici</a>.</li>\n<li><code>session</code> <a href=\"/docs/api/session#class-session\">Session</a> (facultatif) - Définit la session utilisée par la page . Au lieu de passer l'objet Session directement, vous pouvez également choisir d'utiliser l'option <code>partition</code> à la place, qui accepte une chaîne de partition. Lorsque <code>session</code> et <code>partition</code> sont fournies, <code>session</code> sera préférée. La session par défaut est celle par défaut.</li>\n<li><code>partition</code> String (facultatif) - Définit la session utilisée par la page en fonction de la chaîne de partition de la session . Si <code>partition</code> commence par <code>persist:</code>, la page utilisera une session persistante disponible pour toutes les pages de l'application avec le même <code>partition</code>. S'il n'y a pas de préfixe <code>persistant:</code>, la page utilisera une session en mémoire . En assignant la même <code>partition</code>, plusieurs pages peuvent partager la même session. La session par défaut est celle par défaut.</li>\n<li><code>zoomFactor</code> Number (optional) - The default zoom factor of the page, <code>3.0</code> represents <code>300%</code>. Par défaut la valeur est <code>1.0</code>.</li>\n<li><code>javascript</code> Boolean (optional) - Enables JavaScript support. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>webSecurity</code> Boolean (facultatif) - Lorsque <code>false</code>, il désactivera la politique de même origine (généralement en utilisant des sites de test par des personnes), et définissez <code>allowRunningInsecureContent</code> à <code>true</code> si cette option n'a pas été définie par l'utilisateur. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>allowRunningInsecureContent</code> Boolean (optional) - Allow an https page to run JavaScript, CSS or plugins from http URLs. Par défaut la valeur est <code>false</code>.</li>\n<li><code>images</code> Boolean (optional) - Enables image support. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>imageAnimationPolicy</code> String (optional) - Specifies how to run image animations (E.g. GIFs).  Can be <code>animate</code>, <code>animateOnce</code> or <code>noAnimation</code>.  La valeur par défaut est <code>animate</code>.</li>\n<li><code>textAreasAreResizable</code> Boolean (optional) - Make TextArea elements resizable. Default is <code>true</code>.</li>\n<li><code>webgl</code> Boolean (optional) - Enables WebGL support. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>plugins</code> Boolean (optional) - Whether plugins should be enabled. Par défaut la valeur est <code>false</code>.</li>\n<li><code>experimentalFeatures</code> Boolean (optional) - Enables Chromium's experimental features. Par défaut la valeur est <code>false</code>.</li>\n<li><code>scrollBounce</code> Boolean (optional) - Enables scroll bounce (rubber banding) effect on macOS. Par défaut la valeur est <code>false</code>.</li>\n<li><code>enableBlinkFeatures</code> String (facultatif) - Une liste de chaînes de caractères séparées par <code>,</code>, comme <code>CSSVariables,KeyEventKey</code> pour activer. La liste complète des chaînes de caractères supportées peut être trouvée dans le fichier <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> .</li>\n<li><code>disableBlinkFeatures</code> String (facultatif) - Une liste de chaînes de caractères séparées par <code>,</code>, comme <code>CSSVariables,KeyEventKey</code> pour désactiver. La liste complète des chaînes de fonctionnalités supportées peut être trouvée dans le fichier <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> .</li>\n<li><code>defaultFontFamily</code> Object (optional) - Sets the default font for the font-family.<ul>\n<li><code>standard</code> String (facultatif) - Par défaut <code>Times New Roman</code>.</li>\n<li><code>serif</code> String (facultatif) - Par défaut <code>Times New Roman</code>.</li>\n<li><code>sansSerif</code> String (facultatif) - <code>Arial</code>.</li>\n<li><code>monospace</code> String (facultatif) - <code>Courrier New</code>.</li>\n<li><code>cursive</code> String (facultatif) - <code>Script</code>.</li>\n<li><code>fantasy</code> String (facultatif) - <code>Impact</code>.</li>\n</ul></li>\n<li><code>defaultFontSize</code> Integer (facultatif) - <code>16</code>.</li>\n<li><code>defaultMonospaceFontSize</code> Integer (facultatif) - <code>13</code>.</li>\n<li><code>minimumFontSize</code> Integer (facultatif) - <code>0</code>.</li>\n<li><code>defaultEncoding</code> String (facultatif) - <code>ISO-8859-1</code>.</li>\n<li><code>backgroundThrottling</code> Boolean (facultatif) - Si vous voulez maîtriser les animations et les minuteurs lorsque la page devient en arrière-plan. Cela affecte également l'API <a href=\"#page-visibility\">Visibilité de la page</a>. Par défaut, <code>true</code>.</li>\n<li><code>Offscreen</code> Boolean (facultatif) - Activer le rendu hors écran pour la fenêtre du navigateur. Par défaut, <code>faux</code>. Voir le <a href=\"/docs/tutorial/offscreen-rendering\">tutoriel de rendu hors écran</a> pour plus de détails.</li>\n<li><code>contextIsolation</code> Boolean (facultatif) - Exécuter les API Electron et le script <code>preload</code> spécifié dans un contexte JavaScript séparé. Est à <code>true</code> par défaut. Le contexte dans lequel le script <code>preload</code> s’exécute n’aura accès qu'à ses propres <code>document</code> , globales de <code>window</code> et ensemble de types JavaScript intégrés (<code>Array</code>, <code>Object</code>, <code>JSON</code>, etc.), qui seront tous invisibles pour le contenu chargé. L'API Electron ne sera disponible que dans le script de préchargement de `<code>et pas dans la page chargée. Cette option doit être utilisée lors du chargement de contenu distant potentiellement non fiable afin de se prémunit de toute utilisation frauduleuse du script</code>preload` ou des APIs Electron.  Cette option utilise la même technique que celle utilisée par les <a href=\"https://developer.chrome.com/extensions/content_scripts#execution-environment\">Chrome Content Scripts</a>.  Vous pouvez accéder à ce contexte dans les outils de développement en sélectionnant l'entrée 'Electron Isolated Context' de la liste déroulante en haut de l'onglet Console.</li>\n<li><code>nativeWindowOpen</code> Boolean (facultatif) - Utiliser natif <code>window.open()</code>. Par défaut, <code>true</code>. Les fenêtres enfants auront toujours l'intégration du nœud désactivée sauf si <code>nodeIntegrationInSubFrames</code> est vrai.</li>\n<li><code>webviewTag</code> Boolean (facultatif) - Activer la balise <a href=\"/docs/api/webview-tag\"><code>&#x3C; webview></code></a>. Par défaut, <code>faux</code>. <strong>Remarque :</strong> Le script <code>preload</code> configuré pour le <code>&#x3C; webview></code> aura une intégration de nœuds activée lorsqu'il est exécuté, donc vous devez vous assurer que le contenu distant/non fiable n'est pas en mesure de créer une balise <code>&#x3C;webview></code> avec un préchargement de <code>potentiellement malveillant</code> script. Vous pouvez utiliser l'événement <code>will-attach-webview</code> sur <a href=\"/docs/api/web-contents\">webContents</a> pour supprimer le script <code>preload</code> et valider ou modifier les paramètres initiaux de <code>&#x3C; webview></code>.</li>\n<li><code>additionalArguments</code> String<a href=\"/docs/api/facultatif\"></a> - Liste de chaînes qui seront ajoutées au <code>process.argv</code> dans le processus de rendu de cette application.  Utile afin de transmettre de petites informations aux scripts de préchargement du processus de rendu.</li>\n<li><code>safeDialogs</code> Boolean (facultatif) - Indique s’il faut activer la protection pour les boîtes de dialogue consécutives à la mode \"navigateur\". Par défaut la valeur est <code>false</code>.</li>\n<li><code>safeDialogsMessage</code> String (facultatif) - Le message à afficher lorsque la protection consécutive des dialogues est déclenchée. Si non défini, le message par défaut serait utilisé, notez que le message par défaut est actuellement en anglais et non localisé.</li>\n<li><code>disableDialogs</code> Boolean (optional) - Whether to disable dialogs completely. Overrides <code>safeDialogs</code>. Par défaut la valeur est <code>false</code>.</li>\n<li><code>navigateOnDragDrop</code> Boolean (optional) - Whether dragging and dropping a file or link onto the page causes a navigation. Par défaut la valeur est <code>false</code>.</li>\n<li><code>autoplayPolicy</code> String (facultatif) - La politique de lecture automatique à appliquer au contenu dans la fenêtre, peut être <code>no-user-gesture-required</code>, <code>user-gesture-required</code>, <code>document-user-activation-required</code>. Par défaut, <code>no-user-gesture-required</code>.</li>\n<li><code>disableHtmlFullscreenWindowResize</code> Boolean (optional) - Whether to prevent the window from resizing when entering HTML Fullscreen. Default is <code>false</code>.</li>\n<li><code>accessibleTitle</code> String (optional) - An alternative title string provided only to accessibility tools such as screen readers. This string is not directly visible to users.</li>\n<li><code>spellcheck</code> Boolean (optional) - Whether to enable the builtin spellchecker. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>enableWebSQL</code> Boolean (optional) - Whether to enable the <a href=\"https://www.w3.org/TR/webdatabase/\">WebSQL api</a>. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>v8CacheOptions</code> String (optional) - Enforces the v8 code caching policy used by blink. Les valeurs acceptées sont<ul>\n<li><code>none</code> - Disables code caching</li>\n<li><code>code</code> - Heuristic based code caching</li>\n<li><code>bypassHeatCheck</code> - Bypass code caching heuristics but with lazy compilation</li>\n<li><code>bypassHeatCheckAndEagerCompile</code> - Same as above except compilation is eager. Default policy is <code>code</code>.</li>\n</ul></li>\n<li><code>enablePreferredSizeMode</code> Boolean (optional) - Whether to enable preferred size mode. The preferred size is the minimum size needed to contain the layout of the document—without requiring scrolling. Enabling this will cause the <code>preferred-size-changed</code> event to be emitted on the <code>WebContents</code> when the preferred size changes. Par défaut la valeur est <code>false</code>.</li>\n</ul></li>\n<li><code>titleBarOverlay</code> Object | Boolean (optional) -  When using a frameless window in conjuction with <code>win.setWindowButtonVisibility(true)</code> on macOS or using a <code>titleBarStyle</code> so that the standard window controls (\"traffic lights\" on macOS) are visible, this property enables the Window Controls Overlay <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis\">JavaScript APIs</a> and <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables\">CSS Environment Variables</a>. Specifying <code>true</code> will result in an overlay with default system colors. Par défaut la valeur est <code>false</code>.<ul>\n<li><code>color</code> String (optional) <em>Windows</em> - The CSS color of the Window Controls Overlay when enabled. Default is the system color.</li>\n<li><code>symbolColor</code> String (optional) <em>Windows</em> - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Lorsque l'on définie une taille minimum ou maximum pour la fenêtre avec <code>minWidth</code>/<code>maxWidth</code>/ <code>minHeight</code>/<code>maxHeight</code>, cela contraint les utilisateurs uniquement. Cela ne vous empêche pas de passer une taille qui ne suit pas les contraintes de tailles à <code>setBounds</code>/<code>setSize</code> ou au constructeur de <code>BrowserWindow</code>.</p>\n<p>The possible values and behaviors of the <code>type</code> option are platform dependent. Les valeurs possibles sont :</p>\n<ul>\n<li>Sur Linux, les types possible sont <code>desktop</code>, <code>dock</code>, <code>toolbar</code>, <code>splash</code>, <code>notification</code>.</li>\n<li>On macOS, possible types are <code>desktop</code>, <code>textured</code>.<ul>\n<li>Le type <code>textured</code> ajoute un aspect métal dégradé (<code>NSTexturedBackgroundWindowMask</code>).</li>\n<li>Le type <code>desktop</code> place les fenêtre au niveau de l'arière plan. (<code>kCGDesktopWindowLevel - 1</code>). Remarque, la fenêtre du Bureau ne recevra pas le focus ni les évennements souris ou clavier, mais il est possible d'utiliser <code>globalShortcut</code> pour recevoir des entrées avec modération.</li>\n</ul></li>\n<li>Sur Windows, le type possible est <code>toolbar</code>.</li>\n</ul>\n<h3 id=\"événements-dinstance\"><a href=\"#événements-dinstance\">Événements d’instance</a></h3>\n<p>Les objets crées avec <code>new BrowserWindow</code> émettent les évennements suivants :</p>\n<p><strong>Remarque :</strong> Certains événements sont seulement disponibles sur des systèmes d'exploitation spécifiques et sont étiquetés comme tels.</p>\n<h4 id=\"événement--page-title-updated\"><a href=\"#événement--page-title-updated\">Événement : 'page-title-updated'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>Émis lorsque le document a changé son titre, appeler <code>event.preventDefault()</code> empêchera le titre de la fenêtre native de changer. <code>explicitSet</code> est faux lorsque le titre est synthétisé à partir de l'URL du fichier.</p>\n<h4 id=\"événement--close\"><a href=\"#événement--close\">Événement : 'close'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emis lorsque la fenêtre va être fermée. Émis avant les événements <code>beforeunload</code> et <code>unload</code> du DOM. Appeler <code>event.preventDefault()</code> annulera la fermeture.</p>\n<p>Normalement, vous voudriez utiliser le gestionnaire <code>beforeunload</code> pour décider si une fenêtre doit être fermée, ce qui sera aussi appelé lorsque la fenêtre est rechargée. Dans Electron, n'importe quelle valeur retournée autre que <code>undefined</code> annulera la fermeture. Par exemple :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-built_in\">window</span>.onbeforeunload = <span class=\"hljs-function\">(<span class=\"hljs-params\">e</span>) =></span> {   <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'I do not want to be closed'</span>)  \n\n<span class=\"hljs-comment\">// A la différence des navigateurs web, un message sera affiché aux utilisateurs, retourner</span>\n<span class=\"hljs-comment\">// une valeur non-nulle annulera la fermeture.</span>\n  <span class=\"hljs-comment\">// Il est recommandé d'utiliser l'API de dialogue afin de laisser l'utilisateur confirmer la fermeture de</span>\n<span class=\"hljs-comment\">// l'application.</span>\n  e.returnValue = <span class=\"hljs-literal\">false</span> <span class=\"hljs-comment\">// Equivaut à un `return false` mais ce n'est pas recommandé</span>\n}\n</code></pre>\n<p><em><strong>Note</strong>: Il y a une subtile différence entre le comportement de <code>window.onbeforeunload = handler</code> et <code>window.addEventListener('beforeunload', handler)</code>. Il est recommendé de toujours spécifier l' <code>event.returnValue</code> explicitement, plutôt que de seulement retourner une valeur, cette méthode fonctionne mieux avec Electron.</em></p>\n<h4 id=\"événement--closed\"><a href=\"#événement--closed\">Événement : 'closed'</a></h4>\n<p>Emitted when the window is closed. After you have received this event you should remove the reference to the window and avoid using it any more.</p>\n<h4 id=\"événement--session-end-windows\"><a href=\"#événement--session-end-windows\">Événement : 'session-end' <em>Windows</em></a></h4>\n<p>Émis lorsque la session va se terminer à cause d'une redémarage, un éteignage forcé ou une déconnexion.</p>\n<h4 id=\"événement--unresponsive\"><a href=\"#événement--unresponsive\">Événement : 'unresponsive'</a></h4>\n<p>Émis lorsque la page web cesse de répondre.</p>\n<h4 id=\"événement--responsive\"><a href=\"#événement--responsive\">Événement : 'responsive'</a></h4>\n<p>Émis lorsque la page web répond à nouveau.</p>\n<h4 id=\"événement--blur\"><a href=\"#événement--blur\">Événement : 'blur'</a></h4>\n<p>Émis lorsque la fenêtre perd le focus.</p>\n<h4 id=\"événement--focus\"><a href=\"#événement--focus\">Événement : 'focus'</a></h4>\n<p>Émis lorsque la fenêtre obtient le focus.</p>\n<h4 id=\"événement--show\"><a href=\"#événement--show\">Événement : 'show'</a></h4>\n<p>Émis lorsque la fenêtre est affichée.</p>\n<h4 id=\"événement--hide\"><a href=\"#événement--hide\">Événement : 'hide'</a></h4>\n<p>Émis lorsque la fenêtre est masquée.</p>\n<h4 id=\"événement--ready-to-show\"><a href=\"#événement--ready-to-show\">Événement : 'ready-to-show'</a></h4>\n<p>Émis lorsque la page web à été chargée (tout en n'était pas affichée) et la fenêtre peut être affichée sans flash visuel.</p>\n<p>Veuillez noter que l'utilisation de cet événement implique que le moteur de rendu sera considéré comme \"visible\" et peinture, même si <code>show</code> est faux.  Cet événement ne se déclenchera jamais si vous utilisez <code>paintWhenInitiallyHidden: false</code></p>\n<h4 id=\"événement--maximize\"><a href=\"#événement--maximize\">Événement : 'maximize'</a></h4>\n<p>Émis lorsque la fenêtre est agrandie.</p>\n<h4 id=\"événement--unmaximize\"><a href=\"#événement--unmaximize\">Événement : 'unmaximize'</a></h4>\n<p>Émis lorsque la fenêtre quitte un état maximisé.</p>\n<h4 id=\"événement--minimize\"><a href=\"#événement--minimize\">Événement : 'minimize'</a></h4>\n<p>Émis lorsque la fenêtre est réduite.</p>\n<h4 id=\"événement--restore\"><a href=\"#événement--restore\">Événement : 'restore'</a></h4>\n<p>Émis lorsque la fenêtre est restaurée à partir d’un état réduit.</p>\n<h4 id=\"événement--will-resize-macos-windows\"><a href=\"#événement--will-resize-macos-windows\">Événement : 'will-resize' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newBounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Taille de la fenêtre en cours de redimensionnage.</li>\n<li>Objet <code>details</code><ul>\n<li><code>edge</code> (String) - The edge of the window being dragged for resizing. Can be <code>bottom</code>, <code>left</code>, <code>right</code>, <code>top-left</code>, <code>top-right</code>, <code>bottom-left</code> or <code>bottom-right</code>.</li>\n</ul></li>\n</ul>\n<p>Emitted before the window is resized. Calling <code>event.preventDefault()</code> will prevent the window from being resized.</p>\n<p>Note that this is only emitted when the window is being resized manually. Resizing the window with <code>setBounds</code>/<code>setSize</code> will not emit this event.</p>\n<p>The possible values and behaviors of the <code>edge</code> option are platform dependent. Les valeurs possibles sont :</p>\n<ul>\n<li>On Windows, possible values are <code>bottom</code>, <code>top</code>, <code>left</code>, <code>right</code>, <code>top-left</code>, <code>top-right</code>, <code>bottom-left</code>, <code>bottom-right</code>.</li>\n<li>On macOS, possible values are <code>bottom</code> and <code>right</code>.<ul>\n<li>The value <code>bottom</code> is used to denote vertical resizing.</li>\n<li>The value <code>right</code> is used to denote horizontal resizing.</li>\n</ul></li>\n</ul>\n<h4 id=\"événement--resize\"><a href=\"#événement--resize\">Événement : 'resize'</a></h4>\n<p>Émis après que la fenêtre soit redimensionnée.</p>\n<h4 id=\"événement--resized-macos-windows\"><a href=\"#événement--resized-macos-windows\">Événement : 'resized' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Emitted once when the window has finished being resized.</p>\n<p>This is usually emitted when the window has been resized manually. On macOS, resizing the window with <code>setBounds</code>/<code>setSize</code> and setting the <code>animate</code> parameter to <code>true</code> will also emit this event once resizing has finished.</p>\n<h4 id=\"événement--will-move-macos-windows\"><a href=\"#événement--will-move-macos-windows\">Événement : 'will-move' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newBounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Emplacement où la fenêtre est en cours de déplacement.</li>\n</ul>\n<p>Emitted before the window is moved. On Windows, calling <code>event.preventDefault()</code> will prevent the window from being moved.</p>\n<p>Note that this is only emitted when the window is being resized manually. Resizing the window with <code>setBounds</code>/<code>setSize</code> will not emit this event.</p>\n<h4 id=\"événement--move\"><a href=\"#événement--move\">Événement : 'move'</a></h4>\n<p>Émis lorsque la fenêtre est déplacée vers une nouvelle position.</p>\n<h4 id=\"événement--moved-macos-windows\"><a href=\"#événement--moved-macos-windows\">Événement : 'moved' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Émis une fois lorsque la fenêtre est déplacée vers une nouvelle position.</p>\n<p><strong>Note</strong> : Sous macOS, cet événement est un alias de <code>move</code>.</p>\n<h4 id=\"événement--enter-full-screen\"><a href=\"#événement--enter-full-screen\">Événement : 'enter-full-screen'</a></h4>\n<p>Émis lorsque la fenêtre passe à un état de plein écran.</p>\n<h4 id=\"événement--leave-full-screen\"><a href=\"#événement--leave-full-screen\">Événement : 'leave-full-screen'</a></h4>\n<p>Émis lorsque la fenêtre revient d'un état de plein écran.</p>\n<h4 id=\"événement--enter-html-full-screen\"><a href=\"#événement--enter-html-full-screen\">Événement : 'enter-html-full-screen'</a></h4>\n<p>Émis lorsque la fenêtre entre dans un état de plein écran déclenchée par l’API HTML.</p>\n<h4 id=\"événement--leave-html-full-screen\"><a href=\"#événement--leave-html-full-screen\">Événement : 'leave-html-full-screen'</a></h4>\n<p>Émis lorsque la fenêtre revient d'un état de plein écran déclenchée par l’API HTML.</p>\n<h4 id=\"événement--always-on-top-changed\"><a href=\"#événement--always-on-top-changed\">Événement : 'always-on-top-changed'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>isAlwaysOnTop</code> Boolean</li>\n</ul>\n<p>Émis lorsque la fenêtre est définie ou non définie pour toujours afficher au dessus des autres fenêtres.</p>\n<h4 id=\"événement--app-command-windows-linux\"><a href=\"#événement--app-command-windows-linux\">Événement : 'app-command' <em>Windows</em> <em>Linux</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>command</code> String</li>\n</ul>\n<p>Émis lorsqu'une <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/ms646275(v=vs.85).aspx\">App Command</a> est appelée. Elles sont généralement liées aux touches multimédia du clavier ou aux commandes du navigateur, ainsi que le bouton \"Retour\" intégré à certaines souris sous Windows.</p>\n<p>Les commandes sont en minuscules, les traits de soulignement sont remplacés par des traits d'union, et le préfixe <code>APPCOMMAND_</code> est supprimé. par exemple <code>APPCOMMAND_BROWSER_BACKWARD</code> est émise en tant que <code>browser-backward</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-comment\">// Navigate the window back when the user hits their mouse back button</span>\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'browser-backward'</span> &#x26;&#x26; win.webContents.canGoBack()) {\n    win.webContents.goBack()\n  }\n})\n</code></pre>\n<p>Les commandes d'application suivantes sont explicitement prises en charge sur Linux :</p>\n<ul>\n<li><code>retour en arrière du navigateur</code></li>\n<li><code>navigateur-transfert</code></li>\n</ul>\n<h4 id=\"événement--scroll-touch-begin-macos\"><a href=\"#événement--scroll-touch-begin-macos\">Événement : 'scroll-touch-begin' <em>macOS</em></a></h4>\n<p>Émis lorsque l’événement scroll de la souris a commencé.</p>\n<h4 id=\"événement--scroll-touch-end-macos\"><a href=\"#événement--scroll-touch-end-macos\">Événement : 'scroll-touch-end' <em>macOS</em></a></h4>\n<p>Émis lorsque l’événement scroll de la souris est terminée.</p>\n<h4 id=\"événement--scroll-touch-edge-macos\"><a href=\"#événement--scroll-touch-edge-macos\">Événement : 'scroll-touch-edge' <em>macOS</em></a></h4>\n<p>Émis lorsque l’événement scroll de la souris arrive au bord d'un élément.</p>\n<h4 id=\"événement--swipe-macos\"><a href=\"#événement--swipe-macos\">Événement : 'swipe' <em>macOS</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>direction</code> String</li>\n</ul>\n<p>Emitted on 3-finger swipe. Possible directions are <code>up</code>, <code>right</code>, <code>down</code>, <code>left</code>.</p>\n<p>The method underlying this event is built to handle older macOS-style trackpad swiping, where the content on the screen doesn't move with the swipe. Most macOS trackpads are not configured to allow this kind of swiping anymore, so in order for it to emit properly the 'Swipe between pages' preference in <code>System Preferences > Trackpad > More Gestures</code> must be set to 'Swipe with two or three fingers'.</p>\n<h4 id=\"événement--rotate-gesture-macos\"><a href=\"#événement--rotate-gesture-macos\">Événement : 'rotate-gesture' <em>macOS</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>rotation</code> Float</li>\n</ul>\n<p>Émis lors du mouvement de rotation du trackpad. Émission continue jusqu'à la fin du geste de rotation. La valeur <code>rotation</code> sur chaque émission est l'angle en degrés tourné depuis la dernière émission. Le dernier événement émis lors d'un geste de rotation sera toujours de la valeur <code>0</code>. Les valeurs de rotation dans le sens inverse des aiguilles d'une montre sont positives, tandis que les valeurs dans le sens horaire sont négatives.</p>\n<h4 id=\"événement--sheet-begin-macos\"><a href=\"#événement--sheet-begin-macos\">Événement : 'sheet-begin' <em>macOS</em></a></h4>\n<p>Émis lorsque la fenêtre ouvre une feuille.</p>\n<h4 id=\"événement--sheet-end-macos\"><a href=\"#événement--sheet-end-macos\">Événement : 'sheet-end' <em>macOS</em></a></h4>\n<p>Émis lorsque la fenêtre a fermé une feuille.</p>\n<h4 id=\"événement--new-window-for-tab-macos\"><a href=\"#événement--new-window-for-tab-macos\">Événement : 'new-window-for-tab' <em>macOS</em></a></h4>\n<p>Émis lorsque le bouton natif du nouvel onglet est cliqué.</p>\n<h4 id=\"événement--system-context-menu-windows\"><a href=\"#événement--system-context-menu-windows\">Événement : 'system-context-menu' <em>Windows</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a> - The screen coordinates the context menu was triggered at</li>\n</ul>\n<p>Emitted when the system context menu is triggered on the window, this is normally only triggered when the user right clicks on the non-client area of your window.  This is the window titlebar or any area you have declared as <code>-webkit-app-region: drag</code> in a frameless window.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent the menu from being displayed.</p>\n<h3 id=\"méthodes-statiques\"><a href=\"#méthodes-statiques\">Méthodes statiques</a></h3>\n<p>La classe <code>BrowserWindow</code> a les méthodes statiques suivantes :</p>\n<h4 id=\"browserwindowgetallwindows\"><a href=\"#browserwindowgetallwindows\"><code>BrowserWindow.getAllWindows()</code></a></h4>\n<p>Retourne <code>BrowserWindow[]</code> - Un tableau de toutes les fenêtres ouvertes.</p>\n<h4 id=\"browserwindowgetfocusedwindow\"><a href=\"#browserwindowgetfocusedwindow\"><code>BrowserWindow.getFocusedWindow()</code></a></h4>\n<p>Retourne <code>BrowserWindow | null</code> - La fenêtre qui est concentrée dans cette application, sinon retourne <code>null</code>.</p>\n<h4 id=\"browserwindowfromwebcontentswebcontents\"><a href=\"#browserwindowfromwebcontentswebcontents\"><code>BrowserWindow.fromWebContents(webContents)</code></a></h4>\n<ul>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Returns <code>BrowserWindow | null</code> - The window that owns the given <code>webContents</code> or <code>null</code> if the contents are not owned by a window.</p>\n<h4 id=\"browserwindowfrombrowserviewbrowserview\"><a href=\"#browserwindowfrombrowserviewbrowserview\"><code>BrowserWindow.fromBrowserView(browserView)</code></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>Retourne <code>BrowserWindow | null</code> - La fenêtre qui possède le <code>browserView</code>. If the given view is not attached to any window, returns <code>null</code>.</p>\n<h4 id=\"browserwindowfromidid\"><a href=\"#browserwindowfromidid\"><code>BrowserWindow.fromId(id)</code></a></h4>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Retourne <code>BrowserWindow | null</code> - La fenêtre avec l'<code>id</code> donné.</p>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<p>Les objets créés avec <code>nouveau BrowserWindow</code> ont les propriétés suivantes :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">// In this example `win` is our instance</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<h4 id=\"winwebcontents-readonly\"><a href=\"#winwebcontents-readonly\"><code>win.webContents</code> <em>Readonly</em></a></h4>\n<p>A <code>WebContents</code> object this window owns. All web page related events and operations will be done via it.</p>\n<p>Voir la <a href=\"/docs/api/web-contents\"><code>webContents</code> documentation</a> pour ses méthodes et ses événements.</p>\n<h4 id=\"winid-readonly\"><a href=\"#winid-readonly\"><code>win.id</code> <em>Readonly</em></a></h4>\n<p>Une propriété <code>Integer</code> représentant l'ID unique de la fenêtre. Chaque ID est unique parmi ceux des instances de <code>BrowserWindow</code> de l'application Electron.</p>\n<h4 id=\"format0-winautohidemenubar\"><a href=\"#format0-winautohidemenubar\"><code>format@@0 win.autoHideMenuBar</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window menu bar should hide itself automatically. Once set, the menu bar will only show when users press the single <code>Alt</code> key.</p>\n<p>Si la barre de menu est déjà visible, le réglage de cette propriété sur <code>true</code> ne le fera pas le cacher immédiatement.</p>\n<h4 id=\"winsimplefullscreen\"><a href=\"#winsimplefullscreen\"><code>win.simpleFullScreen</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in simple (pre-Lion) fullscreen mode.</p>\n<h4 id=\"winfullscreen\"><a href=\"#winfullscreen\"><code>win.fullScreen</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in fullscreen mode.</p>\n<h4 id=\"winfocusable-windows-macos\"><a href=\"#winfocusable-windows-macos\"><code>win.focusable</code> <em>Windows</em> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is focusable.</p>\n<h4 id=\"winvisibleonallworkspaces\"><a href=\"#winvisibleonallworkspaces\"><code>win.visibleOnAllWorkspaces</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is visible on all workspaces.</p>\n<p><strong>Note:</strong> Always returns false on Windows.</p>\n<h4 id=\"winshadow\"><a href=\"#winshadow\"><code>win.shadow</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window has a shadow.</p>\n<h4 id=\"winmenubarvisible-windows-linux\"><a href=\"#winmenubarvisible-windows-linux\"><code>win.menuBarVisible</code> <em>Windows</em> <em>Linux</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the menu bar should be visible.</p>\n<p><strong>Note:</strong> If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single <code>Alt</code> key.</p>\n<h4 id=\"winkiosk\"><a href=\"#winkiosk\"><code>win.kiosk</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in kiosk mode.</p>\n<h4 id=\"windocumentedited-macos\"><a href=\"#windocumentedited-macos\"><code>win.documentEdited</code> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that specifies whether the window’s document has been edited.</p>\n<p>The icon in title bar will become gray when set to <code>true</code>.</p>\n<h4 id=\"winrepresentedfilename-macos\"><a href=\"#winrepresentedfilename-macos\"><code>win.representedFilename</code> <em>macOS</em></a></h4>\n<p>A <code>String</code> property that determines the pathname of the file the window represents, and the icon of the file will show in window's title bar.</p>\n<h4 id=\"wintitle\"><a href=\"#wintitle\"><code>win.title</code></a></h4>\n<p>A <code>String</code> property that determines the title of the native window.</p>\n<p><strong>Note:</strong> The title of the web page can be different from the title of the native window.</p>\n<h4 id=\"winminimizable\"><a href=\"#winminimizable\"><code>win.minimizable</code></a></h4>\n<p>Une propriété <code>Boolean</code> qui détermine si la fenêtre peut être minimisée manuellement par l'utilisateur.</p>\n<p>Sur Linux, le setter est un no-op, bien que le getter retourne <code>true</code>.</p>\n<h4 id=\"winmaximizable\"><a href=\"#winmaximizable\"><code>win.maximizable</code></a></h4>\n<p>Une propriété <code>Boolean</code> qui détermine si la fenêtre peut être agrandie manuellement par l'utilisateur.</p>\n<p>Sur Linux, le setter est un no-op, bien que le getter retourne <code>true</code>.</p>\n<h4 id=\"winfullscreenable\"><a href=\"#winfullscreenable\"><code>win.fullScreenable</code></a></h4>\n<p>Une propriété <code>Boolean</code> qui détermine si le bouton maximiser/zoom de la fenêtre active le mode plein écran ou maximise la fenêtre.</p>\n<h4 id=\"winresizable\"><a href=\"#winresizable\"><code>win.resizable</code></a></h4>\n<p>Une propriété <code>Boolean</code> qui détermine si la fenêtre peut être redimensionnée manuellement par l'utilisateur.</p>\n<h4 id=\"winclosable\"><a href=\"#winclosable\"><code>win.closable</code></a></h4>\n<p>Une propriété <code>Boolean</code> qui détermine si la fenêtre peut être fermée manuellement par l'utilisateur.</p>\n<p>Sur Linux, le setter est un no-op, bien que le getter retourne <code>true</code>.</p>\n<h4 id=\"winmovable\"><a href=\"#winmovable\"><code>win.movable</code></a></h4>\n<p>Une propriété <code>Boolean</code> qui détermine si la fenêtre peut être déplacée par l'utilisateur.</p>\n<p>Sur Linux, le setter est un no-op, bien que le getter retourne <code>true</code>.</p>\n<h4 id=\"winexcludedfromshownwindowsmenu-macos\"><a href=\"#winexcludedfromshownwindowsmenu-macos\"><code>win.excludedFromShownWindowsMenu</code> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is excluded from the application’s Windows menu. <code>false</code> par défaut.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-keyword\">const</span> template = [\n  {\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'windowmenu'</span>\n  }\n]\n\ngagne. xcludedFromShownWindowsMenu = <span class=\"hljs-literal\">true</span>\n\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\nMenu.setApplicationMenu(menu)\n</code></pre>\n<h4 id=\"winaccessibletitle\"><a href=\"#winaccessibletitle\"><code>win.accessibleTitle</code></a></h4>\n<p>A <code>String</code> property that defines an alternative title provided only to accessibility tools such as screen readers. This string is not directly visible to users.</p>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<p>Les objets créés avec <code>nouveau BrowserWindow</code> ont les méthodes d'instance suivantes :</p>\n<p><strong>Remarque :</strong> Certaines méthodes sont seulement disponibles sur des systèmes d'exploitation spécifiques et sont étiquetés comme tels.</p>\n<h4 id=\"windestroy\"><a href=\"#windestroy\"><code>win.destroy()</code></a></h4>\n<p>Forcer la fermeture de la fenêtre, les <code>unload</code> et <code>beforeunload</code> événement ne seront pas émises pour la page web, et l'évènement <code>close</code> ne sera pas non plus émise pour cette fenêtre, mais il garantit que l'événement <code>closed</code> sera émis.</p>\n<h4 id=\"winclose\"><a href=\"#winclose\"><code>win.close()</code></a></h4>\n<p>Try to close the window. This has the same effect as a user manually clicking the close button of the window. The web page may cancel the close though. See the <a href=\"#event-close\">close event</a>.</p>\n<h4 id=\"winfocus\"><a href=\"#winfocus\"><code>win.focus()</code></a></h4>\n<p>Ramène la fenêtre au premier plan.</p>\n<h4 id=\"winblur\"><a href=\"#winblur\"><code>win.blur()</code></a></h4>\n<p>Supprime le focus de la fenêtre.</p>\n<h4 id=\"winisfocused\"><a href=\"#winisfocused\"><code>win.isFocused()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la fenêtre est mise au point.</p>\n<h4 id=\"winisdestroyed\"><a href=\"#winisdestroyed\"><code>win.isDestroyed()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la fenêtre est détruite.</p>\n<h4 id=\"winshow\"><a href=\"#winshow\"><code>win.show()</code></a></h4>\n<p>Affiche la fenêtre et la ramène au premier plan.</p>\n<h4 id=\"winshowinactive\"><a href=\"#winshowinactive\"><code>win.showInactive()</code></a></h4>\n<p>Affiche la fenêtre, mais ne la ramène pas au premier plan.</p>\n<h4 id=\"winhide\"><a href=\"#winhide\"><code>win.hide()</code></a></h4>\n<p>Masque la fenêtre.</p>\n<h4 id=\"winisvisible\"><a href=\"#winisvisible\"><code>win.isVisible()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la fenêtre est visible pour l'utilisateur ou non.</p>\n<h4 id=\"winismodal\"><a href=\"#winismodal\"><code>win.isModal()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la fenêtre actuelle est une fenêtre modale ou non.</p>\n<h4 id=\"winmaximize\"><a href=\"#winmaximize\"><code>win.maximize()</code></a></h4>\n<p>Maximizes the window. This will also show (but not focus) the window if it isn't being displayed already.</p>\n<h4 id=\"winunmaximize\"><a href=\"#winunmaximize\"><code>win.unmaximize()</code></a></h4>\n<p>Réduit la fenêtre à sa taille initiale.</p>\n<h4 id=\"winismaximized\"><a href=\"#winismaximized\"><code>win.isMaximized()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la taille de la fenêtre est maximisée ou non.</p>\n<h4 id=\"winminimize\"><a href=\"#winminimize\"><code>win.minimize()</code></a></h4>\n<p>Minimizes the window. On some platforms the minimized window will be shown in the Dock.</p>\n<h4 id=\"winrestore\"><a href=\"#winrestore\"><code>win.restore()</code></a></h4>\n<p>Restaure la fenêtre depuis l'état réduit à son état précédent.</p>\n<h4 id=\"winisminimized\"><a href=\"#winisminimized\"><code>win.isMinimized()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la taille de la fenêtre est minimisée ou non.</p>\n<h4 id=\"winsetfullscreenflag\"><a href=\"#winsetfullscreenflag\"><code>win.setFullScreen(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Définit si la fenêtre doit être en mode plein écran.</p>\n<h4 id=\"winisfullscreen\"><a href=\"#winisfullscreen\"><code>win.isFullScreen()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la fenêtre est en plein écran ou non.</p>\n<h4 id=\"winsetsimplefullscreenflag-macos\"><a href=\"#winsetsimplefullscreenflag-macos\"><code>win.setSimpleFullScreen(flag)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Entre ou sort du mode plein-écran simple.</p>\n<p>Simple fullscreen mode emulates the native fullscreen behavior found in versions of macOS prior to Lion (10.7).</p>\n<h4 id=\"winissimplefullscreen-macos\"><a href=\"#winissimplefullscreen-macos\"><code>win.isSimpleFullScreen()</code> <em>macOS</em></a></h4>\n<p>Retourne <code>Boolean</code> - Si la fenêtre est en mode plein-écran simple (pré-Lion) ou non.</p>\n<h4 id=\"winisnormal\"><a href=\"#winisnormal\"><code>win.isNormal()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la fenêtre est dans son état normal (ni maximisée, ni minimisée, ni en plein écran).</p>\n<h4 id=\"winsetaspectratioaspectratio-extrasize\"><a href=\"#winsetaspectratioaspectratio-extrasize\"><code>win.setAspectRatio(aspectRatio[, extraSize])</code></a></h4>\n<ul>\n<li><code>aspectRatio</code> Float - L'aspect ratio à maintenir pour une partie de la vue de contenu .</li>\n<li><code>extraSize</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) <em>macOS</em> - The extra size not to be included while maintaining the aspect ratio.</li>\n</ul>\n<p>Cela fera que la fenêtre maintient un ratio d'aspect. La taille supplémentaire permet à un développeur d'avoir de l'espace, spécifié en pixels, non inclus dans les calculs de ratio de l'aspect. Cette API prend déjà en compte la différence entre la taille d'une fenêtre et sa taille de contenu.</p>\n<p>Considérez une fenêtre normale avec un lecteur vidéo HD et des commandes associées. Il y a peut-être 15 pixels de contrôles sur le bord gauche, 25 pixels de contrôles sur le bord droit et 50 pixels de contrôles sous le joueur. In order to maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within the player itself we would call this function with arguments of 16/9 and\n{ width: 40, height: 50 }. Le deuxième argument ne se soucie pas du fait que la largeur et la hauteur supplémentaires sont dans la vue de contenu --seulement qu'elles existent. Sommez toute la largeur supplémentaire et les zones de hauteur que vous avez dans la vue de contenu globale.</p>\n<p>The aspect ratio is not respected when window is resized programmatically with APIs like <code>win.setSize</code>.</p>\n<h4 id=\"winsetbackgroundcolorbackgroundcolor\"><a href=\"#winsetbackgroundcolorbackgroundcolor\"><code>win.setBackgroundColor(backgroundColor)</code></a></h4>\n<ul>\n<li><code>backgroundColor</code> String - Couleur d'arrière-plan de la fenêtre sous la forme d'une valeur hexadécimale, comme <code>#66CD00</code> ou <code>#FFF</code> ou <code>#80FFFFFF</code> (l'alpha est supporté si <code>transparent</code> est <code>true</code>). La valeur par défaut est <code>#FFF</code> (white).</li>\n</ul>\n<p>Sets the background color of the window. See <a href=\"#setting-backgroundcolor\">Setting <code>backgroundColor</code></a>.</p>\n<h4 id=\"winpreviewfilepath-displayname-macos\"><a href=\"#winpreviewfilepath-displayname-macos\"><code>win.previewFile(path[, displayName])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>path</code> String - Le chemin absolu vers le fichier à prévisualiser avec QuickLook. Ceci est important car Quick Look utilise le nom de fichier et l'extension de fichier sur le chemin pour déterminer le type de contenu du fichier à ouvrir.</li>\n<li><code>displayName</code> String (facultatif) - Le nom du fichier à afficher dans la vue modale de Quick Look . Ceci est purement visuel et n'affecte pas le type de contenu du fichier. Par défaut, <code>chemin</code>.</li>\n</ul>\n<p>Utilise <a href=\"https://en.wikipedia.org/wiki/Quick_Look\">Aperçu rapide</a> pour prévisualiser un fichier à un chemin donné.</p>\n<h4 id=\"winclosefilepreview-macos\"><a href=\"#winclosefilepreview-macos\"><code>win.closeFilePreview()</code> <em>macOS</em></a></h4>\n<p>Ferme le panneau <a href=\"https://en.wikipedia.org/wiki/Quick_Look\">Aperçu rapide</a> actuellement ouvert.</p>\n<h4 id=\"winsetboundsbounds-animate\"><a href=\"#winsetboundsbounds-animate\"><code>win.setBounds(bounds[, animate])</code></a></h4>\n<ul>\n<li><code>limites</code> Partiel<unk> Rectangle></unk></li>\n<li><code>animate</code> Boolean (facultatif) <em>macOS</em></li>\n</ul>\n<p>Redimensionne et déplace la fenêtre vers les limites fournies. Any properties that are not supplied will default to their current values.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-comment\">// définit toutes les propriétés limites</span>\ngagner. etBounds({ <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">440</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">225</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-comment\">// a fixé une propriété de simples limites</span>\ngagner. etBounds({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">100</span> })\n\n<span class=\"hljs-comment\">// { x: 440, y: 225, width: 100, height: 600 }</span>\n<span class=\"hljs-built_in\">console</span>.log(win.getBounds())\n</code></pre>\n<h4 id=\"wingetbounds\"><a href=\"#wingetbounds\"><code>win.getBounds()</code></a></h4>\n<p>Retourne <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - Les <code>limites</code> de la fenêtre comme <code>Object</code>.</p>\n<h4 id=\"wingetbackgroundcolor\"><a href=\"#wingetbackgroundcolor\"><code>win.getBackgroundColor()</code></a></h4>\n<p>Returns <code>String</code> - Gets the background color of the window. See <a href=\"#setting-backgroundcolor\">Setting <code>backgroundColor</code></a>.</p>\n<h4 id=\"winsetcontentboundsbounds-animate\"><a href=\"#winsetcontentboundsbounds-animate\"><code>win.setContentBounds(bounds[, animate])</code></a></h4>\n<ul>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n<li><code>animate</code> Boolean (facultatif) <em>macOS</em></li>\n</ul>\n<p>Redimensionne et déplace la zone client de la fenêtre (par exemple la page web) vers les limites fournies.</p>\n<h4 id=\"wingetcontentbounds\"><a href=\"#wingetcontentbounds\"><code>win.getContentBounds()</code></a></h4>\n<p>Retourne <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - Les <code>limites</code> de la zone client de la fenêtre comme <code>Object</code>.</p>\n<h4 id=\"wingetnormalbounds\"><a href=\"#wingetnormalbounds\"><code>win.getNormalBounds()</code></a></h4>\n<p>Retourne <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - Contient les limites de la fenêtre de l'état normal</p>\n<p><strong>Remarque :</strong> quel que soit l'état actuel de la fenêtre : maximisé, minimisé ou en plein écran, retourne toujours la position et la taille de la fenêtre en état normal. En état normal, getBounds et getNormalBounds renvoient le même <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a>.</p>\n<h4 id=\"winsetenabledenable\"><a href=\"#winsetenabledenable\"><code>win.setEnabled(enable)</code></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Active ou désactive la fenêtre.</p>\n<h4 id=\"winisenabled\"><a href=\"#winisenabled\"><code>win.isEnabled()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la fenêtre est activée.</p>\n<h4 id=\"winsetsizewidth-height-animate\"><a href=\"#winsetsizewidth-height-animate\"><code>win.setSize(width, height[, animate])</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>animate</code> Boolean (facultatif) <em>macOS</em></li>\n</ul>\n<p>Redimensionne la fenêtre à <code>width</code> x <code>height</code>. Si la largeur <code>width</code> ou la hauteur <code>height</code> sont inférieures aux minima définis, la fenêtre se limitera à sa taille minimale.</p>\n<h4 id=\"wingetsize\"><a href=\"#wingetsize\"><code>win.getSize()</code></a></h4>\n<p>Retourne <code>Integer[]</code> - Contient la largeur et la hauteur de la fenêtre.</p>\n<h4 id=\"winsetcontentsizewidth-height-animate\"><a href=\"#winsetcontentsizewidth-height-animate\"><code>win.setContentSize(width, height[, animate])</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>animate</code> Boolean (facultatif) <em>macOS</em></li>\n</ul>\n<p>Redimensionne la zone client de la fenêtre (par exemple la page web) à <code>largeur</code> et <code>hauteur</code>.</p>\n<h4 id=\"wingetcontentsize\"><a href=\"#wingetcontentsize\"><code>win.getContentSize()</code></a></h4>\n<p>Retourne <code>Integer[]</code> - Contient la largeur et la hauteur de la zone client de la fenêtre.</p>\n<h4 id=\"winsetminimumsizewidth-height\"><a href=\"#winsetminimumsizewidth-height\"><code>win.setMinimumSize(width, height)</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n</ul>\n<p>Définit la taille minimale de la fenêtre à <code>width</code> et <code>height</code>.</p>\n<h4 id=\"wingetminimumsize\"><a href=\"#wingetminimumsize\"><code>win.getMinimumSize()</code></a></h4>\n<p>Retourne <code>Integer[]</code> - Contient la largeur et la hauteur minimale de la fenêtre.</p>\n<h4 id=\"winsetmaximumsizewidth-height\"><a href=\"#winsetmaximumsizewidth-height\"><code>win.setMaximumSize(width, height)</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n</ul>\n<p>Définit la taille maximale de la fenêtre à <code>width</code> et <code>height</code>.</p>\n<h4 id=\"wingetmaximumsize\"><a href=\"#wingetmaximumsize\"><code>win.getMaximumSize()</code></a></h4>\n<p>Retourne <code>Integer[]</code> - Contient la largeur et la hauteur maximale de la fenêtre.</p>\n<h4 id=\"winsetresizableresizable\"><a href=\"#winsetresizableresizable\"><code>win.setResizable(resizable)</code></a></h4>\n<ul>\n<li><code>resizable</code> Boolean</li>\n</ul>\n<p>Définit si la fenêtre peut être redimensionnée ou pas par l’utilisateur.</p>\n<h4 id=\"winisresizable\"><a href=\"#winisresizable\"><code>win.isResizable()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la fenêtre peut être redimensionnée manuellement par l'utilisateur.</p>\n<h4 id=\"winsetmovablemovable-macos-windows\"><a href=\"#winsetmovablemovable-macos-windows\"><code>win.setMovable(movable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>movable</code> Boolean</li>\n</ul>\n<p>Définit si la fenêtre peut être déplacée par l’utilisateur. N'a aucun effet sous Linux.</p>\n<h4 id=\"winismovable-macos-windows\"><a href=\"#winismovable-macos-windows\"><code>win.isMovable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Retourne <code>Boolean</code> - Si la fenêtre peut être déplacée par l'utilisateur.</p>\n<p>Sous Linux, retourne toujours <code>true</code>.</p>\n<h4 id=\"winsetminimizableminimizable-macos-windows\"><a href=\"#winsetminimizableminimizable-macos-windows\"><code>win.setMinimizable(minimizable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>minimizable</code> Boolean</li>\n</ul>\n<p>Définit si la fenêtre peut être minimisée par l’utilisateur. N'a aucun effet sous Linux.</p>\n<h4 id=\"winisminimizable-macos-windows\"><a href=\"#winisminimizable-macos-windows\"><code>win.isMinimizable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Retourne <code>Boolean</code> - Si la fenêtre peut être minimisée par l'utilisateur.</p>\n<p>Sous Linux, retourne toujours <code>true</code>.</p>\n<h4 id=\"winsetmaximizablemaximizable-macos-windows\"><a href=\"#winsetmaximizablemaximizable-macos-windows\"><code>win.setMaximizable(maximizable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>maximizable</code> Boolean</li>\n</ul>\n<p>Définit si la fenêtre peut être maximalisée par l’utilisateur. N'a aucun effet sous Linux.</p>\n<h4 id=\"winismaximizable-macos-windows\"><a href=\"#winismaximizable-macos-windows\"><code>win.isMaximizable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Retourne <code>Boolean</code> - Si la fenêtre peut être agrandie manuellement par l'utilisateur.</p>\n<p>Sous Linux, retourne toujours <code>true</code>.</p>\n<h4 id=\"winsetfullscreenablefullscreenable\"><a href=\"#winsetfullscreenablefullscreenable\"><code>win.setFullScreenable(fullscreenable)</code></a></h4>\n<ul>\n<li><code>fullscreenable</code> Boolean</li>\n</ul>\n<p>Définit si le bouton agrandir/zoom de la fenêtre active/désactive le mode plein écran ou agrandit la fenêtre.</p>\n<h4 id=\"winisfullscreenable\"><a href=\"#winisfullscreenable\"><code>win.isFullScreenable()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.</p>\n<h4 id=\"winsetclosableclosable-macos-windows\"><a href=\"#winsetclosableclosable-macos-windows\"><code>win.setClosable(closable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>closable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually closed by user. N'a aucun effet sous Linux.</p>\n<h4 id=\"winisclosable-macos-windows\"><a href=\"#winisclosable-macos-windows\"><code>win.isClosable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Retourne <code>Boolean</code> - Si la fenêtre peut être fermée manuellement par l'utilisateur.</p>\n<p>Sous Linux, retourne toujours <code>true</code>.</p>\n<h4 id=\"winsetalwaysontopflag-level-relativelevel\"><a href=\"#winsetalwaysontopflag-level-relativelevel\"><code>win.setAlwaysOnTop(flag[, level][, relativeLevel])</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n<li><code>level</code> String (facultatif) <em>macOS</em> <em>Windows</em> - Les valeurs incluent <code>normal</code>, <code>floating</code>, <code>torn-off-menu</code>, <code>modal-panel</code>, <code>main-menu</code>, <code>statuus</code>, <code>pop-up-menu</code>, <code>screen-saver</code>, et ~<code>dock</code>~~ (obsolète). La valeur par défaut est <code>floating</code> lorsque <code>flag</code> est vrai. Le <code>niveau</code> est réinitialisé à <code>normal</code> lorsque le drapeau est faux. Notez que de <code>flottant</code> à <code>statut</code> inclus, la fenêtre est placée sous le Dock sur macOS et sous la barre des tâches sous Windows. De <code>pop-up-menu</code> à une valeur supérieure, il est affiché au-dessus du Dock sur macOS et au-dessus de la barre des tâches sur Windows. Voir la documentation <a href=\"https://developer.apple.com/documentation/appkit/nswindow/level\">macOS</a> pour plus de détails.</li>\n<li><code>relativeLevel</code> Integer (facultatif) <em>macOS</em> - Le nombre de calques supérieur à définir cette fenêtre par rapport au <code>level</code>. Par défaut, <code>0</code>. Notez que Apple décourage le réglage de niveaux supérieurs à 1 au-dessus de <code>économiseur d'écran</code>.</li>\n</ul>\n<p>Sets whether the window should show always on top of other windows. After setting this, the window is still a normal window, not a toolbox window which can not be focused on.</p>\n<h4 id=\"winisalwaysontop\"><a href=\"#winisalwaysontop\"><code>win.isAlwaysOnTop()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la fenêtre est toujours au-dessus des autres fenêtres ou non.</p>\n<h4 id=\"winmoveabovemediasourceid\"><a href=\"#winmoveabovemediasourceid\"><code>win.moveAbove(mediaSourceId)</code></a></h4>\n<ul>\n<li><code>mediaSourceId</code> String - Window id in the format of DesktopCapturerSource's id. Par exemple \"window:1869:0\".</li>\n</ul>\n<p>Moves window above the source window in the sense of z-order. If the <code>mediaSourceId</code> is not of type window or if the window does not exist then this method throws an error.</p>\n<h4 id=\"winmovetop\"><a href=\"#winmovetop\"><code>win.moveTop()</code></a></h4>\n<p>Déplace la fenêtre sur le dessus (dans l'ordre z) peu importe qu'elle ait le focus ou non</p>\n<h4 id=\"wincenter\"><a href=\"#wincenter\"><code>win.center()</code></a></h4>\n<p>Déplace la fenêtre vers le centre de l’écran.</p>\n<h4 id=\"winsetpositionx-y-animate\"><a href=\"#winsetpositionx-y-animate\"><code>win.setPosition(x, y[, animate])</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n<li><code>animate</code> Boolean (facultatif) <em>macOS</em></li>\n</ul>\n<p>Déplace la fenêtre à la position <code>x</code> et <code>y</code>.</p>\n<h4 id=\"wingetposition\"><a href=\"#wingetposition\"><code>win.getPosition()</code></a></h4>\n<p>Retourne <code>Integer[]</code> - Contient la position actuelle de la fenêtre.</p>\n<h4 id=\"winsettitletitle\"><a href=\"#winsettitletitle\"><code>win.setTitle(title)</code></a></h4>\n<ul>\n<li><code>title</code> String</li>\n</ul>\n<p>Remplace le titre de la fenêtre native par <code>title</code>.</p>\n<h4 id=\"wingettitle\"><a href=\"#wingettitle\"><code>win.getTitle()</code></a></h4>\n<p>Retourne <code>String</code> - le titre de la fenêtre native.</p>\n<p><strong>Remarque :</strong> Le titre de la page web peut être différent du titre de la fenêtre native .</p>\n<h4 id=\"winsetsheetoffsetoffsety-offsetx-macos\"><a href=\"#winsetsheetoffsetoffsety-offsetx-macos\"><code>win.setSheetOffset(offsetY[, offsetX])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>offsetY</code> Float</li>\n<li><code>offsetX</code> Float (facultatif)</li>\n</ul>\n<p>Changes the attachment point for sheets on macOS. By default, sheets are attached just below the window frame, but you may want to display them beneath a HTML-rendered toolbar. Par exemple :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-keyword\">const</span> toolbarRect = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'toolbar'</span>).getBoundingClientRect()\nwin.setSheetOffset(toolbarRect.height)\n</code></pre>\n<h4 id=\"winflashframeflag\"><a href=\"#winflashframeflag\"><code>win.flashFrame(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Démarre ou arrête de flasher la fenêtre pour attirer l'attention de l'utilisateur.</p>\n<h4 id=\"winsetskiptaskbarskip\"><a href=\"#winsetskiptaskbarskip\"><code>win.setSkipTaskbar(skip)</code></a></h4>\n<ul>\n<li><code>skip</code> Boolean</li>\n</ul>\n<p>Fait que la fenêtre ne soit pas affichée dans la barre des tâches.</p>\n<h4 id=\"winsetkioskflag\"><a href=\"#winsetkioskflag\"><code>win.setKiosk(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Enters or leaves kiosk mode.</p>\n<h4 id=\"winiskiosk\"><a href=\"#winiskiosk\"><code>win.isKiosk()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la fenêtre est en mode kiosque.</p>\n<h4 id=\"winistabletmode-windows\"><a href=\"#winistabletmode-windows\"><code>win.isTabletMode()</code> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in Windows 10 tablet mode.</p>\n<p>Since Windows 10 users can <a href=\"https://support.microsoft.com/en-us/help/17210/windows-10-use-your-pc-like-a-tablet\">use their PC as tablet</a>, under this mode apps can choose to optimize their UI for tablets, such as enlarging the titlebar and hiding titlebar buttons.</p>\n<p>This API returns whether the window is in tablet mode, and the <code>resize</code> event can be be used to listen to changes to tablet mode.</p>\n<h4 id=\"wingetmediasourceid\"><a href=\"#wingetmediasourceid\"><code>win.getMediaSourceId()</code></a></h4>\n<p>Returns <code>String</code> - Window id in the format of DesktopCapturerSource's id. Par exemple \"window:1324:0\".</p>\n<p>More precisely the format is <code>window:id:other_id</code> where <code>id</code> is <code>HWND</code> on Windows, <code>CGWindowID</code> (<code>uint64_t</code>) on macOS and <code>Window</code> (<code>unsigned long</code>) on Linux. <code>other_id</code> is used to identify web contents (tabs) so within the same top level window.</p>\n<h4 id=\"wingetnativewindowhandle\"><a href=\"#wingetnativewindowhandle\"><code>win.getNativeWindowHandle()</code></a></h4>\n<p>Retourne <code>Buffer</code> - Le gestionnaire spécifique à la plate-forme de la fenêtre.</p>\n<p>Le type natif du handle est <code>HWND</code> sous Windows, <code>NSView*</code> sur macOS, et <code>Window</code> (<code>long</code>non signé&#x3C;/0>) sous Linux.</p>\n<h4 id=\"winhookwindowmessagemessage-callback-windows\"><a href=\"#winhookwindowmessagemessage-callback-windows\"><code>win.hookWindowMessage(message, callback)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n<li><code>callback</code> Function<ul>\n<li><code>wParam</code> any - The <code>wParam</code> provided to the WndProc</li>\n<li><code>lParam</code> any - The <code>lParam</code> provided to the WndProc</li>\n</ul></li>\n</ul>\n<p>Hooks a windows message. La <code>callback</code> est appelée lorsque le message est reçu dans le WndProc.</p>\n<h4 id=\"winiswindowmessagehookedmessage-windows\"><a href=\"#winiswindowmessagehookedmessage-windows\"><code>win.isWindowMessageHooked(message)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n</ul>\n<p>Retourne <code>Boolean</code> - <code>true</code> ou <code>false</code> selon que le message est accroché.</p>\n<h4 id=\"winunhookwindowmessagemessage-windows\"><a href=\"#winunhookwindowmessagemessage-windows\"><code>win.unhookWindowMessage(message)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n</ul>\n<p>Débranchez le message de la fenêtre.</p>\n<h4 id=\"winunhookallwindowmessages-windows\"><a href=\"#winunhookallwindowmessages-windows\"><code>win.unhookAllWindowMessages()</code> <em>Windows</em></a></h4>\n<p>Décroche tous les messages de la fenêtre.</p>\n<h4 id=\"winsetrepresentedfilenamefilename-macos\"><a href=\"#winsetrepresentedfilenamefilename-macos\"><code>win.setRepresentedFilename(filename)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>filename</code> String</li>\n</ul>\n<p>Définit le chemin d'accès du fichier que la fenêtre représente, et l'icône du fichier s'affichera dans la barre de titre de la fenêtre.</p>\n<h4 id=\"wingetrepresentedfilename-macos\"><a href=\"#wingetrepresentedfilename-macos\"><code>win.getRepresentedFilename()</code> <em>macOS</em></a></h4>\n<p>Retourne <code>String</code> - Le chemin du fichier que la fenêtre représente.</p>\n<h4 id=\"winsetdocumenteditededited-macos\"><a href=\"#winsetdocumenteditededited-macos\"><code>win.setDocumentEdited(edited)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>edited</code> Boolean</li>\n</ul>\n<p>Spécifie si le document de la fenêtre a été modifié, et l'icône dans la barre de titre deviendra grise lorsque réglé sur <code>true</code>.</p>\n<h4 id=\"winisdocumentedited-macos\"><a href=\"#winisdocumentedited-macos\"><code>win.isDocumentEdited()</code> <em>macOS</em></a></h4>\n<p>Retourne <code>Boolean</code> - Si le document de la fenêtre a été modifié.</p>\n<h4 id=\"winfocusonwebview\"><a href=\"#winfocusonwebview\"><code>win.focusOnWebView()</code></a></h4>\n<h4 id=\"winblurwebview\"><a href=\"#winblurwebview\"><code>win.blurWebView()</code></a></h4>\n<h4 id=\"wincapturepagerect\"><a href=\"#wincapturepagerect\"><code>win.capturePage([rect])</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (facultatif) - Les limites à capturer</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;NativeImage></code> - résout avec une <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Captures a snapshot of the page within <code>rect</code>. Omitting <code>rect</code> will capture the whole visible page. Si la page n'est pas visible, <code>rect</code> peut être vide.</p>\n<h4 id=\"winloadurlurl-options\"><a href=\"#winloadurlurl-options\"><code>win.loadURL(url[, options])</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (facultatif) - Une URL de référence HTTP.</li>\n<li><code>userAgent</code> String (optionnel) - Un agent utilisateur d'où provient la requête.</li>\n<li><code>extraHeaders</code> String (optionnel) - Headers supplémentaires séparés par \"\\n\"</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (facultatif) - URL de base (avec séparateur de chemin de pointe) pour que les fichiers soient chargés par l'URL de données. Ceci n'est nécessaire que si l'<code>url</code> spécifiée est une URL de données et a besoin de charger d'autres fichiers.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Promise&#x3C;void></code> - la promesse se résoudra lorsque la page aura terminé le chargement (voir <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), et rejette si la page ne parvient pas à se charger (voir <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Même que <a href=\"/docs/api/web-contents#contentsloadurlurl-options\"><code>webContents.loadURL(url[, options])</code></a>.</p>\n<p>L'<code>url</code> peut être une adresse distante (par exemple <code>http://</code>) ou un chemin vers un fichier HTML local en utilisant le <code>file://</code> protocole.</p>\n<p>Pour s'assurer que les URL de fichier sont correctement formatées, il est recommandé d'utiliser la méthode Node's <a href=\"https://nodejs.org/api/url.html#url_url_format_urlobject\"><code>url.format</code></a> :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>).format({\n  <span class=\"hljs-attr\">protocol</span>: <span class=\"hljs-string\">'file'</span>,\n  <span class=\"hljs-attr\">slashes</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">pathname</span>: <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>).join(__dirname, <span class=\"hljs-string\">'index.html'</span>)\n})\n\nwin.loadURL(url)\n</code></pre>\n<p>Vous pouvez charger une URL en utilisant une requête <code>POST</code> avec des données encodées par URL en faisant ce qui suit :</p>\n<pre><code class=\"hljs language-javascript\">win.loadURL(<span class=\"hljs-string\">'http://localhost:8000/post'</span>, {\n  <span class=\"hljs-attr\">postData</span>: [{\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'rawData'</span>,\n    <span class=\"hljs-attr\">bytes</span>: Buffer.from(<span class=\"hljs-string\">'hello=world'</span>)\n  }],\n  <span class=\"hljs-attr\">extraHeaders</span>: <span class=\"hljs-string\">'Content-Type: application/x-www-form-urlencoded'</span>\n})\n</code></pre>\n<h4 id=\"winloadfilefilepath-options\"><a href=\"#winloadfilefilepath-options\"><code>win.loadFile(filePath[, options])</code></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>query</code> Enregistrement&#x3C;String, String> (facultatif) - Passé à <code>url.format()</code>.</li>\n<li><code>search</code> String (facultatif) - Passé à <code>url.format()</code>.</li>\n<li><code>hash</code> String (facultatif) - Passé à <code>url.format()</code>.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Promise&#x3C;void></code> - la promesse se résoudra lorsque la page aura terminé le chargement (voir <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), et rejette si la page ne parvient pas à se charger (voir <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Same as <code>webContents.loadFile</code>, <code>filePath</code> should be a path to an HTML file relative to the root of your application.  See the <code>webContents</code> docs for more information.</p>\n<h4 id=\"winreload\"><a href=\"#winreload\"><code>win.reload()</code></a></h4>\n<p>Identique à <code>webContents.reload</code>.</p>\n<h4 id=\"winsetmenumenu-linux-windows\"><a href=\"#winsetmenumenu-linux-windows\"><code>win.setMenu(menu)</code> <em>Linux</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Définit le <code>menu</code> comme barre de menu de la fenêtre.</p>\n<h4 id=\"winremovemenu-linux-windows\"><a href=\"#winremovemenu-linux-windows\"><code>win.removeMenu()</code> <em>Linux</em> <em>Windows</em></a></h4>\n<p>Retirez la barre de menu de la fenêtre.</p>\n<h4 id=\"winsetprogressbarprogress-options\"><a href=\"#winsetprogressbarprogress-options\"><code>win.setProgressBar(progress[, options])</code></a></h4>\n<ul>\n<li><code>progress</code> Double</li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>mode</code> String <em>Windows</em> - Mode for the progress bar. Can be <code>none</code>, <code>normal</code>, <code>indeterminate</code>, <code>error</code> or <code>paused</code>.</li>\n</ul></li>\n</ul>\n<p>Définit la valeur de progression dans la barre de progression. La plage valide est [0, 1.0].</p>\n<p>Supprimer la barre de progression lorsque la progression &#x3C; 0 ; Passer en mode indéterminé lorsque la progression > 1.</p>\n<p>Sur la plate-forme Linux, ne prend en charge que l'environnement de bureau Unity, vous devez spécifier le nom du fichier <code>*.desktop</code> au champ <code>desktopName</code> dans <code>package.json</code>. Par défaut, il assumera <code>{app.name}.desktop</code>.</p>\n<p>Sous Windows, un mode peut être passé. Les valeurs acceptées sont <code>none</code>, <code>normal</code>, <code>indeterminate</code>, <code>erreur</code>, et <code>paused</code>. Si vous appelez <code>setProgressBar</code> sans mode défini (mais avec une valeur dans la plage valide), <code>normal</code> sera utilisé.</p>\n<h4 id=\"winsetoverlayiconoverlay-description-windows\"><a href=\"#winsetoverlayiconoverlay-description-windows\"><code>win.setOverlayIcon(overlay, description)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>overlay</code> <a href=\"/docs/api/native-image\">NativeImage</a> | null - l'icône à afficher en bas à droite de l'icône de la barre des tâches. Si ce paramètre est <code>null</code>, l'overlay est effacé</li>\n<li><code>description</code> Chaîne - une description qui sera fournie aux lecteurs d'écran d'accessibilité</li>\n</ul>\n<p>Définit une superposition de 16 x 16 pixels sur l'icône actuelle de la barre des tâches, généralement utilisé pour transmettre une sorte de statut d'application ou pour notifier passivement l'utilisateur.</p>\n<h4 id=\"winsethasshadowhasshadow\"><a href=\"#winsethasshadowhasshadow\"><code>win.setHasShadow(hasShadow)</code></a></h4>\n<ul>\n<li><code>hasShadow</code> Boolean</li>\n</ul>\n<p>Définit si la fenêtre doit avoir une ombre.</p>\n<h4 id=\"winhasshadow\"><a href=\"#winhasshadow\"><code>win.hasShadow()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la fenêtre a une ombre.</p>\n<h4 id=\"winsetopacityopacity-windows-macos\"><a href=\"#winsetopacityopacity-windows-macos\"><code>win.setOpacity(opacity)</code> <em>Windows</em> <em>macOS</em></a></h4>\n<ul>\n<li><code>opacité</code> Nombre - entre 0.0 (entièrement transparent) et 1.0 (entièrement opaque)</li>\n</ul>\n<p>Définit l'opacité de la fenêtre. Sur Linux, n'a aucun effet. Out of bound number values are clamped to the [0, 1] range.</p>\n<h4 id=\"wingetopacity\"><a href=\"#wingetopacity\"><code>win.getOpacity()</code></a></h4>\n<p>Returns <code>Number</code> - between 0.0 (fully transparent) and 1.0 (fully opaque). Sur Linux, renvoie toujours 1.</p>\n<h4 id=\"winsetshaperects-windows-linux-experimental\"><a href=\"#winsetshaperects-windows-linux-experimental\"><code>win.setShape(rects)</code> <em>Windows</em> <em>Linux</em> <em>Experimental</em></a></h4>\n<ul>\n<li><code>rects</code> <a href=\"/docs/api/structures/rectangle\">Rectangle[]</a> - Sets a shape on the window. Passing an empty list reverts the window to being rectangular.</li>\n</ul>\n<p>Définir une forme de fenêtre détermine la zone dans la fenêtre où le système permet de dessiner et d'interagir avec l'utilisateur. En dehors de la région donnée, aucun pixel ne sera dessiné et aucun événement de souris ne sera enregistré. Les événements de souris en dehors de la région ne seront pas reçus par cette fenêtre, mais passeront à tout ce qui se trouve derrière la fenêtre.</p>\n<h4 id=\"winsetthumbarbuttonsbuttons-windows\"><a href=\"#winsetthumbarbuttonsbuttons-windows\"><code>win.setThumbarButtons(buttons)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>buttons</code> <a href=\"/docs/api/structures/thumbar-button\">ThumbarButton[]</a></li>\n</ul>\n<p>Retourne <code>Boolean</code> - Si les boutons ont été ajoutés avec succès</p>\n<p>Ajouter une barre d'outils miniature avec un ensemble de boutons spécifié à l'image de miniature d'une fenêtre dans la disposition d'un bouton de la barre des tâches. Renvoie un objet <code>Booléen</code> indique si la vignette a été ajoutée avec succès.</p>\n<p>Le nombre de boutons dans la barre d'outils miniature ne doit pas dépasser 7 en raison de la salle limitée. Une fois que vous avez configuré la barre d'outils miniature, la barre d'outils ne peut pas être retirée en raison de la limitation de la plateforme. Mais vous pouvez appeler l'API avec un tableau vide pour nettoyer les boutons.</p>\n<p>Le <code>boutons</code> est un tableau d'objets <code>Bouton</code> :</p>\n<ul>\n<li>Objet <code>Button</code><ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - L'icône s'affichant dans la miniature dans la barre d'outils.</li>\n<li><code>click</code> Function</li>\n<li><code>tooltip</code> String (facultatif) - Le texte dans l'info-bulle du bouton.</li>\n<li><code>flags</code> String<a href=\"/docs/api/facultatif\"></a> - Contrôle les états et comportements spécifiques du bouton. Par défaut, il est <code>['activé']</code>.</li>\n</ul></li>\n</ul>\n<p>Le <code>flags</code> est un tableau pouvant inclure ces <code>String</code>s suivant :</p>\n<ul>\n<li><code>enabled</code> - Le bouton est actif et disponible à l'utilisateur.</li>\n<li><code>désactivé</code> - Le bouton est désactivé. Il est présent, mais a un état visuel indiquant qu'il ne répondra pas à l'action de l'utilisateur.</li>\n<li><code>dismissonclick</code> - Lorsque le bouton est cliqué, la fenêtre de miniature se ferme immédiatement.</li>\n<li><code>nobackground</code> - Utilise uniquement l'image et ne dessine pas de bordure sur le bouton.</li>\n<li><code>hidden</code> - Le bouton n'est pas affiché à l'utilisateur.</li>\n<li><code>non interactif</code> - Le bouton est activé mais non interactif ; aucun état de bouton n'est dessiné. Cette valeur est destinée aux cas où le bouton est utilisé dans une notification.</li>\n</ul>\n<h4 id=\"winsetthumbnailclipregion-windows\"><a href=\"#winsetthumbnailclipregion-windows\"><code>win.setThumbnailClip(region)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>region</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - La région de la fenêtre</li>\n</ul>\n<p>Définit la région de la fenêtre à afficher comme image de miniature affichée lorsque survole la fenêtre dans la barre des tâches. Vous pouvez réinitialiser la miniature en toute la fenêtre en spécifiant une région vide : <code>{ x: 0, y: 0, width: 0, height: 0 }</code>.</p>\n<h4 id=\"winsetthumbnailtooltiptooltip-windows\"><a href=\"#winsetthumbnailtooltiptooltip-windows\"><code>win.setThumbnailToolTip(toolTip)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>toolTip</code> String</li>\n</ul>\n<p>Définit l'infobulle qui s'affiche en survolant la vignette de la fenêtre dans la barre des tâches.</p>\n<h4 id=\"winsetappdetailsoptions-windows\"><a href=\"#winsetappdetailsoptions-windows\"><code>win.setAppDetails(options)</code> <em>Windows</em></a></h4>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>appId</code> String (facultatif) - Fenêtre <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391569(v=vs.85).aspx\">App User Model ID</a>. Elle doit être définie, sinon les autres options n'auront aucun effet.</li>\n<li><code>appIconPath</code> String (facultatif) - Fenêtre <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391573(v=vs.85).aspx\">Icône de relance</a>.</li>\n<li><code>appIconIndex</code> Integer (optional) - Index of the icon in <code>appIconPath</code>. Ignored when <code>appIconPath</code> is not set. La valeur par defaut en est ``.</li>\n<li><code>relaunchCommand</code> String (facultatif) - La <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391571(v=vs.85).aspx\">Relaunch Command</a>de Windows.</li>\n<li><code>relaunchDisplayName</code> String (facultatif) - Window's <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391572(v=vs.85).aspx\">Relaunch Display Name</a>.</li>\n</ul></li>\n</ul>\n<p>Définit les propriétés du bouton de la barre des tâches de la fenêtre.</p>\n<p><strong>Note:</strong> <code>relaunchCommand</code> and <code>relaunchDisplayName</code> must always be set together. Si l'une de ces propriétés n'est pas définie, aucune ne sera utilisée.</p>\n<h4 id=\"winshowdefinitionforselection-macos\"><a href=\"#winshowdefinitionforselection-macos\"><code>win.showDefinitionForSelection()</code> <em>macOS</em></a></h4>\n<p>Identique à <code>webContents.showDefinitionForSelection()</code>.</p>\n<h4 id=\"winseticonicon-windows-linux\"><a href=\"#winseticonicon-windows-linux\"><code>win.setIcon(icon)</code> <em>Windows</em> <em>Linux</em></a></h4>\n<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | Chaîne</li>\n</ul>\n<p>Change l'icône de la fenêtre.</p>\n<h4 id=\"winsetwindowbuttonvisibilityvisible-macos\"><a href=\"#winsetwindowbuttonvisibilityvisible-macos\"><code>win.setWindowButtonVisibility(visible)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n</ul>\n<p>Définit si les boutons du feu de la fenêtre doivent être visibles.</p>\n<h4 id=\"winsetautohidemenubarhide\"><a href=\"#winsetautohidemenubarhide\"><code>win.setAutoHideMenuBar(hide)</code></a></h4>\n<ul>\n<li><code>hide</code> Boolean</li>\n</ul>\n<p>Définit si la barre de menus de la fenêtre doit se cacher automatiquement. Once set the menu bar will only show when users press the single <code>Alt</code> key.</p>\n<p>If the menu bar is already visible, calling <code>setAutoHideMenuBar(true)</code> won't hide it immediately.</p>\n<h4 id=\"winismenubarautohide\"><a href=\"#winismenubarautohide\"><code>win.isMenuBarAutoHide()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la barre de menu se cache automatiquement.</p>\n<h4 id=\"winsetmenubarvisibilityvisible-windows-linux\"><a href=\"#winsetmenubarvisibilityvisible-windows-linux\"><code>win.setMenuBarVisibility(visible)</code> <em>Windows</em> <em>Linux</em></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n</ul>\n<p>Sets whether the menu bar should be visible. If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single <code>Alt</code> key.</p>\n<h4 id=\"winismenubarvisible\"><a href=\"#winismenubarvisible\"><code>win.isMenuBarVisible()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la barre de menu est visible.</p>\n<h4 id=\"winsetvisibleonworkspacesvisible-options\"><a href=\"#winsetvisibleonworkspacesvisible-options\"><code>win.setVisibleOnWorkspaces(visible[, options])</code></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>visibleOnFullScreen</code> Booléen (facultatif) <em>macOS</em> - Définit si la fenêtre doit être visible au-dessus des fenêtres plein écran.</li>\n<li><code>skipTransformProcessType</code> Boolean (optional) <em>macOS</em> - Calling setVisibleOnAllWorkspaces will by default transform the process type between UIElementApplication and ForegroundApplication to ensure the correct behavior. However, this will hide the window and dock for a short time every time it is called. If your window is already of type UIElementApplication, you can bypass this transformation by passing true to skipTransformProcessType.</li>\n</ul></li>\n</ul>\n<p>Définit si la fenêtre doit être visible sur tous les espaces de travail.</p>\n<p><strong>Remarque :</strong> Cette API ne fonctionne pas sous Windows.</p>\n<h4 id=\"winisvisibleonallworkspaces\"><a href=\"#winisvisibleonallworkspaces\"><code>win.isVisibleOnAllWorkspaces()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la fenêtre est visible sur tous les espaces de travail.</p>\n<p><strong>Remarque </strong>: Cette API retourne toujours false sur Windows.</p>\n<h4 id=\"winsetignoremouseeventsignore-options\"><a href=\"#winsetignoremouseeventsignore-options\"><code>win.setIgnoreMouseEvents(ignore[, options])</code></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>Avancer</code> Boolean (facultatif) <em>macOS</em> <em>Windows</em> - Si vrai, transférez la souris messages vers Chromium, en activant les événements liés à la souris tels que <code>souris</code>. Utilisé uniquement lorsque <code>ignore</code> est vrai. Si <code>ignore</code> est faux, le transfert est toujours désactivé quelle que soit cette valeur.</li>\n</ul></li>\n</ul>\n<p>Fait que la fenêtre ignore tous les événements de la souris.</p>\n<p>Tous les événements survenus dans cette fenêtre seront passés à la fenêtre ci-dessous cette fenêtre, mais si cette fenêtre a le focus, elle recevra toujours les événements du clavier .</p>\n<h4 id=\"winsetcontentprotectionenable-macos-windows\"><a href=\"#winsetcontentprotectionenable-macos-windows\"><code>win.setContentProtection(enable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Empêche le contenu de la fenêtre d'être capturé par d'autres applications.</p>\n<p>On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows it calls SetWindowDisplayAffinity with <code>WDA_EXCLUDEFROMCAPTURE</code>. For Windows 10 version 2004 and up the window will be removed from capture entirely, older Windows versions behave as if <code>WDA_MONITOR</code> is applied capturing a black window.</p>\n<h4 id=\"winsetfocusablefocusable-macos-windows\"><a href=\"#winsetfocusablefocusable-macos-windows\"><code>win.setFocusable(focusable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>focusable</code> Boolean</li>\n</ul>\n<p>Modifie si la fenêtre peut être mise au point.</p>\n<p>Sur macOS, il ne supprime pas le focus de la fenêtre.</p>\n<h4 id=\"winisfocusable-macos-windows\"><a href=\"#winisfocusable-macos-windows\"><code>win.isFocusable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns whether the window can be focused.</p>\n<h4 id=\"winsetparentwindowparent\"><a href=\"#winsetparentwindowparent\"><code>win.setParentWindow(parent)</code></a></h4>\n<ul>\n<li><code>parent</code> BrowserWindow | null</li>\n</ul>\n<p>Définit <code>parent</code> comme la fenêtre parent de la fenêtre actuelle, en passant <code>null</code> transformera la fenêtre actuelle en une fenêtre de niveau supérieur.</p>\n<h4 id=\"wingetparentwindow\"><a href=\"#wingetparentwindow\"><code>win.getParentWindow()</code></a></h4>\n<p>Retourne <code>BrowserWindow</code> - La fenêtre parent.</p>\n<h4 id=\"wingetchildwindows\"><a href=\"#wingetchildwindows\"><code>win.getChildWindows()</code></a></h4>\n<p>Retourne <code>BrowserWindow[]</code> - Toutes les fenêtres enfants.</p>\n<h4 id=\"winsetautohidecursorautohide-macos\"><a href=\"#winsetautohidecursorautohide-macos\"><code>win.setAutoHideCursor(autoHide)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>autoHide</code> Boolean</li>\n</ul>\n<p>Contrôle s'il faut masquer le curseur lors de la saisie.</p>\n<h4 id=\"winselectprevioustab-macos\"><a href=\"#winselectprevioustab-macos\"><code>win.selectPreviousTab()</code> <em>macOS</em></a></h4>\n<p>Sélectionne l'onglet précédent lorsque les onglets natifs sont activés et il y a d'autres onglets dans la fenêtre.</p>\n<h4 id=\"winselectnexttab-macos\"><a href=\"#winselectnexttab-macos\"><code>win.selectNextTab()</code> <em>macOS</em></a></h4>\n<p>Sélectionne l'onglet suivant lorsque les onglets natifs sont activés et il y a d'autres onglets dans la fenêtre.</p>\n<h4 id=\"winmergeallwindows-macos\"><a href=\"#winmergeallwindows-macos\"><code>win.mergeAllWindows()</code> <em>macOS</em></a></h4>\n<p>Fusionne toutes les fenêtres dans une seule fenêtre avec plusieurs onglets lorsque les onglets natifs sont activés et qu'il y a plus d'une fenêtre ouverte.</p>\n<h4 id=\"winmovetabtonewwindow-macos\"><a href=\"#winmovetabtonewwindow-macos\"><code>win.moveTabToNewWindow()</code> <em>macOS</em></a></h4>\n<p>Déplace l'onglet actuel dans une nouvelle fenêtre si les onglets natifs sont activés et il y a plus d'un onglet dans la fenêtre actuelle.</p>\n<h4 id=\"wintoggletabbar-macos\"><a href=\"#wintoggletabbar-macos\"><code>win.toggleTabBar()</code> <em>macOS</em></a></h4>\n<p>Active/désactive la visibilité de la barre d’onglets si les onglets natifs sont activés et il n’y a qu’un seul onglet dans la fenêtre actuelle.</p>\n<h4 id=\"winaddtabbedwindowbrowserwindow-macos\"><a href=\"#winaddtabbedwindowbrowserwindow-macos\"><code>win.addTabbedWindow(browserWindow)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>browserWindow</code> BrowserWindow</li>\n</ul>\n<p>Ajoute une fenêtre sous la forme d'un onglet sur cette fenêtre, après l'onglet de l'instance de fenêtre.</p>\n<h4 id=\"winsetvibrancytype-macos\"><a href=\"#winsetvibrancytype-macos\"><code>win.setVibrancy(type)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>type</code> String | null - Peut être <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>titlebar</code>, <code>selection</code>, <code>menu</code>, <code>popover</code>, <code>sidebar</code>, <code>medium-light</code>, <code>ultra-dark</code>, <code>header</code>, <code>sheet</code>, <code>window</code>, <code>hud</code>, <code>fullscreen-ui</code>, <code>tooltip</code>, <code>content</code>, <code>sous-window</code>, ou <code>sous-page</code>. Voir la documentation <a href=\"https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc\">macOS</a> pour plus de détails.</li>\n</ul>\n<p>Adds a vibrancy effect to the browser window. Passing <code>null</code> or an empty string will remove the vibrancy effect on the window.</p>\n<p>Notez que <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>medium-light</code>, et <code>ultra-dark</code> ont été obsolètes et seront supprimées dans une prochaine version de macOS.</p>\n<h4 id=\"winsettrafficlightpositionposition-macos\"><a href=\"#winsettrafficlightpositionposition-macos\"><code>win.setTrafficLightPosition(position)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Set a custom position for the traffic light buttons in frameless window.</p>\n<h4 id=\"wingettrafficlightposition-macos\"><a href=\"#wingettrafficlightposition-macos\"><code>win.getTrafficLightPosition()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Point</code> - The custom position for the traffic light buttons in frameless window.</p>\n<h4 id=\"winsettouchbartouchbar-macos\"><a href=\"#winsettouchbartouchbar-macos\"><code>win.setTouchBar(touchBar)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>touchBar</code> TouchBar | null</li>\n</ul>\n<p>Définit la disposition de la barre tactile pour la fenêtre actuelle. La spécification <code>null</code> ou <code>undefined</code> efface la barre de contact. Cette méthode n'a d'effet que si la machine a une barre tactile et est en cours d'exécution sur macOS 10.12.1+.</p>\n<p><strong>Remarque :</strong> L’API TouchBar est actuellement expérimentale et peut changer ou être supprimée dans les futures mises à jour d'Electron.</p>\n<h4 id=\"winsetbrowserviewbrowserview-experimental\"><a href=\"#winsetbrowserviewbrowserview-experimental\"><code>win.setBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a> | null - Attache une <code>browserView</code> à <code>win</code>. Si d'autres <code>BrowserView</code>sont déjà attachées, elles seront supprimés de cette fenêtre.</li>\n</ul>\n<h4 id=\"wingetbrowserview-expérimental\"><a href=\"#wingetbrowserview-expérimental\"><code>win.getBrowserView()</code> <em>Expérimental</em></a></h4>\n<p>Retourne <code>BrowserView | null</code> - La <code>BrowserView</code> attachée à <code>win</code>. Retourne <code>null</code> si aucune n'est attachée. Lance une erreur si plusieurs <code>BrowserView</code> sont attachées.</p>\n<h4 id=\"winaddbrowserviewbrowserview-expérimental\"><a href=\"#winaddbrowserviewbrowserview-expérimental\"><code>win.addBrowserView(browserView)</code> <em>Expérimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>Remplacement de l'API pour setBrowserView prenant en charge le travail avec des vues multi navigateurs.</p>\n<h4 id=\"winremovebrowserviewbrowserview-expérimental\"><a href=\"#winremovebrowserviewbrowserview-expérimental\"><code>win.removeBrowserView(browserView)</code> <em>Expérimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<h4 id=\"winsettopbrowserviewbrowserview-expérimental\"><a href=\"#winsettopbrowserviewbrowserview-expérimental\"><code>win.setTopBrowserView(browserView)</code> <em>Expérimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>Raises <code>browserView</code> above other <code>BrowserView</code>s attached to <code>win</code>. Lance une erreur si <code>browserView</code> n'est pas attaché à <code>win</code>.</p>\n<h4 id=\"wingetbrowserviews-expérimental\"><a href=\"#wingetbrowserviews-expérimental\"><code>win.getBrowserViews()</code> <em>Expérimental</em></a></h4>\n<p>Retourne <code>BrowserView[]</code> - un tableau de toutes les BrowserViews qui ont été attachées avec <code>addBrowserView</code> ou <code>setBrowserView</code>.</p>\n<p><strong>Remarque :</strong> L’API BrowserView est actuellement expérimentale et peut changer ou être supprimée dans les futures mises à jour d'Electron.</p>",
      "title": "BrowserWindow",
      "description": "Créer et gérer des fenêtres navigateur."
    },
    "/docs/api/browser-window-proxy": {
      "locale": "fr-FR",
      "slug": "browser-window-proxy",
      "href": "/docs/api/browser-window-proxy",
      "crowdinFileId": "256285",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-window-proxy.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe--browserwindowproxy\"><a href=\"#classe--browserwindowproxy\">Classe : BrowserWindowProxy</a></h2>\n<blockquote>\n<p>Manipule la fenêtre enfant</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>L'objet <code>BrowserWindowProxy</code> est retournée par <code>window.open</code> et fournit les fonctionnalités limitées avec la fenêtre enfant.</p>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<p>L’objet <code>BrowserWindowProxy</code> dispose des méthodes d’instance suivantes :</p>\n<h4 id=\"winblur\"><a href=\"#winblur\"><code>win.blur()</code></a></h4>\n<p>Retire le focus de la fenêtre enfant.</p>\n<h4 id=\"winclose\"><a href=\"#winclose\"><code>win.close()</code></a></h4>\n<p>Force la fermeture de la fenêtre enfant sans appeler l'événement unload.</p>\n<h4 id=\"winevalcode\"><a href=\"#winevalcode\"><code>win.eval(code)</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n</ul>\n<p>Évalue le code dans la fenêtre enfant.</p>\n<h4 id=\"winfocus\"><a href=\"#winfocus\"><code>win.focus()</code></a></h4>\n<p>Donne le focus à la fenêtre enfant (met la fenêtre au premier-plan).</p>\n<h4 id=\"winprint\"><a href=\"#winprint\"><code>win.print()</code></a></h4>\n<p>Appelle la boîte de dialogue Impression sur la fenêtre enfant.</p>\n<h4 id=\"winpostmessagemessage-targetorigin\"><a href=\"#winpostmessagemessage-targetorigin\"><code>win.postMessage(message, targetOrigin)</code></a></h4>\n<ul>\n<li><code>message</code> tous</li>\n<li><code>targetOrigin</code> String</li>\n</ul>\n<p>Envoie un message à la fenêtre enfant avec l'origine spécifié ou <code>*</code> pour aucune préférence d'origine.</p>\n<p>En plus de ces méthodes, la fenêtre enfant implémente l'objet <code>window.opener</code> avec aucune propriété et une méthode unique.</p>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<p>L’objet <code>BrowserWindowProxy</code> dispose des propriétés d’instance suivantes :</p>\n<h4 id=\"winclosed\"><a href=\"#winclosed\"><code>win.closed</code></a></h4>\n<p>Un <code>Boolean</code> qui a la valeur true après que la fenêtre enfant soit fermée.</p>",
      "title": "Classe : BrowserWindowProxy",
      "description": "Manipule la fenêtre enfant"
    },
    "/docs/development/build-instructions-gn": {
      "locale": "fr-FR",
      "slug": "build-instructions-gn",
      "href": "/docs/development/build-instructions-gn",
      "crowdinFileId": "256131",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-gn.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"build-instructions\"><a href=\"#build-instructions\">Build Instructions</a></h1>\n<p>Suivez les instructions ci-dessous pour compiler <strong>Electron</strong>, afin de créer une version compilée personnalisée d'Electron. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"platform-prerequisites\"><a href=\"#platform-prerequisites\">Platform prerequisites</a></h2>\n<p>Vérifiez les prérequis de build pour votre plateforme avant de continuer</p>\n<ul>\n<li><a href=\"/docs/development/build-instructions-macos#prerequisites\">macOS</a></li>\n<li><a href=\"/docs/development/build-instructions-linux#prerequisites\">Linux</a></li>\n<li><a href=\"/docs/development/build-instructions-windows#prerequisites\">Windows</a></li>\n</ul>\n<h2 id=\"build-tools\"><a href=\"#build-tools\">Build Tools</a></h2>\n<p><a href=\"https://github.com/electron/build-tools\">Electron's Build Tools</a> automate much of the setup for compiling Electron from source with different configurations and build targets. If you wish to set up the environment manually, the instructions are listed below.</p>\n<h2 id=\"gn-prerequisites\"><a href=\"#gn-prerequisites\">GN prerequisites</a></h2>\n<p>Vous devrez installer <a href=\"https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up\"><code>depot_tools</code></a>, l'ensemble d'outils utilisé pour récupérer Chromium et ses dépendances.</p>\n<p>De plus, sous Windows, vous devrez définir la variable d'environnement <code>DEPOT_TOOLS_WIN_TOOLCHAIN=0</code>. Pour ce faire, ouvrez <code>Panneau de configuration</code> → <code>Système et Sécurité</code> → <code>Système</code> → <code>Paramètres système avancés</code> et ajouter une variable système <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> avec la valeur <code>0</code>.  Cela indique au <code>depot_tools</code> d’utiliser votre version locale de Visual Studio (par défaut, <code>depot_tools</code> essaiera de télécharger une version interne de Google uniquement accessible à ses utilisateurs).</p>\n<h3 id=\"setting-up-the-git-cache\"><a href=\"#setting-up-the-git-cache\">Setting up the git cache</a></h3>\n<p>If you plan on checking out Electron more than once (for example, to have multiple parallel directories checked out to different branches), using the git cache will speed up subsequent calls to <code>gclient</code>. To do this, set a <code>GIT_CACHE_PATH</code> environment variable:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">export</span> GIT_CACHE_PATH=<span class=\"hljs-string\">\"<span class=\"hljs-variable\">${HOME}</span>/.git_cache\"</span>\n$ mkdir -p <span class=\"hljs-string\">\"<span class=\"hljs-variable\">${GIT_CACHE_PATH}</span>\"</span>\n<span class=\"hljs-comment\"># This will use about 16G.</span>\n</code></pre>\n<h2 id=\"obtenir-le-code\"><a href=\"#obtenir-le-code\">Obtenir le code</a></h2>\n<pre><code class=\"hljs language-sh\">$ mkdir electron &#x26;&#x26; <span class=\"hljs-built_in\">cd</span> electron\n$ gclient config --name <span class=\"hljs-string\">\"src/electron\"</span> --unmanaged https://github.com/electron/electron\n$ gclient sync --with_branch_heads --with_tags\n<span class=\"hljs-comment\"># This will take a while, go get a coffee.</span>\n</code></pre>\n<blockquote>\n<p>Au lieu de <code>https://github.com/electron/electron</code>, vous pouvez utiliser votre propre fork ici (quelque chose comme <code>https://github.com/&#x3C;username>/electron</code>).</p>\n</blockquote>\n<h3 id=\"a-note-on-pullingpushing\"><a href=\"#a-note-on-pullingpushing\">A note on pulling/pushing</a></h3>\n<p>If you intend to <code>git pull</code> or <code>git push</code> from the official <code>electron</code> repository in the future, you now need to update the respective folder's origin URLs.</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src/electron\n$ git remote remove origin\n$ git remote add origin https://github.com/electron/electron\n$ git checkout main\n$ git branch --<span class=\"hljs-built_in\">set</span>-upstream-to=origin/main\n$ <span class=\"hljs-built_in\">cd</span> -\n</code></pre>\n<p>📝 <code>gclient</code> works by checking a file called <code>DEPS</code> inside the <code>src/electron</code> folder for dependencies (like Chromium or Node.js). Running <code>gclient sync -f</code> ensures that all dependencies required to build Electron match that file.</p>\n<p>So, in order to pull, you'd run the following commands:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src/electron\n$ git pull\n$ gclient sync -f\n</code></pre>\n<h2 id=\"compilation\"><a href=\"#compilation\">Compilation</a></h2>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src\n$ <span class=\"hljs-built_in\">export</span> CHROMIUM_BUILDTOOLS_PATH=`<span class=\"hljs-built_in\">pwd</span>`/buildtools\n$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p>Ou sous Windows (sans l'argument optionnel) :</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src\n$ <span class=\"hljs-built_in\">set</span> CHROMIUM_BUILDTOOLS_PATH=%<span class=\"hljs-built_in\">cd</span>%\\buildtools\n$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\")\"</span>\n</code></pre>\n<p>This will generate a build directory <code>out/Testing</code> under <code>src/</code> with the testing build configuration. You can replace <code>Testing</code> with another name, but it should be a subdirectory of <code>out</code>. Also you shouldn't have to run <code>gn gen</code> again—if you want to change the build arguments, you can run <code>gn args out/Testing</code> to bring up an editor.</p>\n<p>To see the list of available build configuration options, run <code>gn args out/Testing --list</code>.</p>\n<p><strong>For generating Testing build config of Electron:</strong></p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p><strong>For generating Release (aka \"non-component\" or \"static\") build config of Electron:</strong></p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Release --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/release.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p><strong>To build, run <code>ninja</code> with the <code>electron</code> target:</strong> Nota Bene: This will also take a while and probably heat up your lap.</p>\n<p>Pour la configuration de test :</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Testing electron\n</code></pre>\n<p>For the release configuration:</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Release electron\n</code></pre>\n<p>This will build all of what was previously 'libchromiumcontent' (i.e. the <code>content/</code> directory of <code>chromium</code> and its dependencies, incl. WebKit and V8), so it will take a while.</p>\n<p>The built executable will be under <code>./out/Testing</code>:</p>\n<pre><code class=\"hljs language-sh\">$ ./out/Testing/Electron.app/Contents/MacOS/Electron\n<span class=\"hljs-comment\"># or, on Windows</span>\n$ ./out/Testing/electron.exe\n<span class=\"hljs-comment\"># or, on Linux</span>\n$ ./out/Testing/electron\n</code></pre>\n<h3 id=\"livraison\"><a href=\"#livraison\">Livraison</a></h3>\n<p>Sous Linux, supprimez d'abord les informations de débogage et de symbole :</p>\n<pre><code class=\"hljs language-sh\">electron/script/strip-binaries.py -d out/Release\n</code></pre>\n<p>To package the electron build as a distributable zip file:</p>\n<pre><code class=\"hljs language-sh\">ninja -C out/Release electron:electron_dist_zip\n</code></pre>\n<h3 id=\"cross-compiling\"><a href=\"#cross-compiling\">Cross-compiling</a></h3>\n<p>To compile for a platform that isn't the same as the one you're building on, set the <code>target_cpu</code> and <code>target_os</code> GN arguments. For example, to compile an x86 target from an x64 host, specify <code>target_cpu = \"x86\"</code> in <code>gn args</code>.</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing-x86 --args=<span class=\"hljs-string\">'... target_cpu = \"x86\"'</span>\n</code></pre>\n<p>Not all combinations of source and target CPU/OS are supported by Chromium.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Host</th><th>Target</th><th>Notice</th></tr></thead><tbody><tr><td>Windows x64</td><td>Windows arm64</td><td>Expérimental</td></tr><tr><td>Windows x64</td><td>Windows x86</td><td>Automatically tested</td></tr><tr><td>Linux x64</td><td>Linux x86</td><td>Automatically tested</td></tr></tbody></table>\n<p>Si vous testez d'autres combinaisons et trouvez qu'elles fonctionnent, veuillez mettre à jour ce document :)</p>\n<p>See the GN reference for allowable values of <a href=\"https://gn.googlesource.com/gn/+/master/docs/reference.md#built_in-predefined-variables-target_os_the-desired-operating-system-for-the-build-possible-values\"><code>target_os</code></a> and <a href=\"https://gn.googlesource.com/gn/+/master/docs/reference.md#built_in-predefined-variables-target_cpu_the-desired-cpu-architecture-for-the-build-possible-values\"><code>target_cpu</code></a>.</p>\n<h4 id=\"windows-on-arm-experimental\"><a href=\"#windows-on-arm-experimental\">Windows on Arm (experimental)</a></h4>\n<p>To cross-compile for Windows on Arm, <a href=\"https://chromium.googlesource.com/chromium/src/+/refs/heads/master/docs/windows_build_instructions.md#Visual-Studio\">follow Chromium's guide</a> to get the necessary dependencies, SDK and libraries, then build with <code>ELECTRON_BUILDING_WOA=1</code> in your environment before running <code>gclient sync</code>.</p>\n<pre><code class=\"hljs language-bat\"><span class=\"hljs-built_in\">set</span> ELECTRON_BUILDING_WOA=<span class=\"hljs-number\">1</span>\ngclient sync -f --with_branch_heads --with_tags\n</code></pre>\n<p>Ou (si vous utilisez PowerShell) :</p>\n<pre><code class=\"hljs language-powershell\"><span class=\"hljs-variable\">$env:ELECTRON_BUILDING_WOA</span>=<span class=\"hljs-number\">1</span>\ngclient sync -f --with_branch_heads --with_tags\n</code></pre>\n<p>Next, run <code>gn gen</code> as above with <code>target_cpu=\"arm64\"</code>.</p>\n<h2 id=\"tests\"><a href=\"#tests\">Tests</a></h2>\n<p>To run the tests, you'll first need to build the test modules against the same version of Node.js that was built as part of the build process. To generate build headers for the modules to compile against, run the following under <code>src/</code> directory.</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Testing third_party/electron_node:headers\n</code></pre>\n<p>Vous pouvez maintenant <a href=\"/docs/development/testing#unit-tests\">exécuter les tests</a>.</p>\n<p>If you're debugging something, it can be helpful to pass some extra flags to the Electron binary:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span> -- \\\n  --<span class=\"hljs-built_in\">enable</span>-logging -g <span class=\"hljs-string\">'BrowserWindow module'</span>\n</code></pre>\n<h2 id=\"partage-du-cache-git-entre-plusieurs-machines\"><a href=\"#partage-du-cache-git-entre-plusieurs-machines\">Partage du cache git entre plusieurs machines</a></h2>\n<p>It is possible to share the gclient git cache with other machines by exporting it as SMB share on linux, but only one process/machine can be using the cache at a time. The locks created by git-cache script will try to prevent this, but it may not work perfectly in a network.</p>\n<p>On Windows, SMBv2 has a directory cache that will cause problems with the git cache script, so it is necessary to disable it by setting the registry key</p>\n<pre><code class=\"hljs language-sh\">HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\Lanmanworkstation\\Parameters\\DirectoryCacheLifetime\n</code></pre>\n<p>à 0. Plus d'informations : <a href=\"https://stackoverflow.com/a/9935126\">https://stackoverflow.com/a/9935126</a></p>\n<p>Cela peut être défini rapidement dans powershell (exécuté en tant qu'administrateur) :</p>\n<pre><code class=\"hljs language-powershell\"><span class=\"hljs-built_in\">New-ItemProperty</span> -Path <span class=\"hljs-string\">\"HKLM:\\System\\CurrentControlSet\\Services\\Lanmanworkstation\\Parameters\"</span> -Name DirectoryCacheLifetime -Value <span class=\"hljs-number\">0</span> -PropertyType DWORD -Force\n</code></pre>\n<h2 id=\"résolution-de-problème\"><a href=\"#résolution-de-problème\">Résolution de problème</a></h2>\n<h3 id=\"gclient-sync-complains-about-rebase\"><a href=\"#gclient-sync-complains-about-rebase\">gclient sync complains about rebase</a></h3>\n<p>If <code>gclient sync</code> is interrupted the git tree may be left in a bad state, leading to a cryptic message when running <code>gclient sync</code> in the future:</p>\n<pre><code class=\"hljs language-plaintext\">2> Conflict while rebasing this branch.\n2> Fix the conflict and run gclient again.\n2> See man git-rebase for details.\n</code></pre>\n<p>If there are no git conflicts or rebases in <code>src/electron</code>, you may need to abort a <code>git am</code> in <code>src</code>:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> ../\n$ git am --abort\n$ <span class=\"hljs-built_in\">cd</span> electron\n$ gclient sync -f\n</code></pre>\n<h3 id=\"on-me-demande-de-saisir-mes-nom-dutilisateur-et-mot-de-passe-pour-chromium-internalgooglesourcecom\"><a href=\"#on-me-demande-de-saisir-mes-nom-dutilisateur-et-mot-de-passe-pour-chromium-internalgooglesourcecom\">On me demande de saisir mes nom d'utilisateur et mot de passe pour chromium-internal.googlesource.com</a></h3>\n<p>Si vous voyez une invite pour <code>nom d'utilisateur pour 'https://chrome-internal.googlesource. om':</code> lorsque vous exécutez <code>gclient sync</code> sous Windows, c'est probablement parce que la variable d'environnement <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> n'est pas définie à 0. Ouvrez <code>Control Panel</code> → <code>System and Security</code> → <code>System</code> → <code>Advanced system settings</code> et ajoutez une variable système <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> avec comme valeur <code>0</code>.  Cela indique au <code>depot_tools</code> d’utiliser votre version locale de Visual Studio (par défaut, <code>depot_tools</code> essaiera de télécharger une version interne de Google uniquement accessible à ses utilisateurs).</p>",
      "title": "Build Instructions",
      "description": "Au lieu de https://github.com/electron/electron, vous pouvez utiliser votre propre fork ici (quelque chose comme https://github.com/<username>/electron)."
    },
    "/docs/development/build-instructions-linux": {
      "locale": "fr-FR",
      "slug": "build-instructions-linux",
      "href": "/docs/development/build-instructions-linux",
      "crowdinFileId": "256133",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-linux.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"instructions-de-build-linux\"><a href=\"#instructions-de-build-linux\">Instructions de Build (Linux)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on Linux, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>\n<p>At least 25GB disk space and 8GB RAM.</p>\n</li>\n<li>\n<p>Python 2.7.x. Some distributions like CentOS 6.x still use Python 2.6.x so you may need to check your Python version with <code>python -V</code>.</p>\n<p>Please also ensure that your system and Python version support at least TLS 1.2. For a quick test, run the following script:</p>\n<pre><code class=\"hljs language-sh\">$ npx @electron/check-python-tls\n</code></pre>\n<p>If the script returns that your configuration is using an outdated security protocol, use your system's package manager to update Python to the latest version in the 2.7.x branch. Alternatively, visit <a href=\"https://www.python.org/downloads/\">https://www.python.org/downloads/</a> for detailed instructions.</p>\n</li>\n<li>\n<p>Node.js. There are various ways to install Node. You can download source code from <a href=\"https://nodejs.org\">nodejs.org</a> and compile it. Doing so permits installing Node on your own home directory as a standard user. Or try repositories such as <a href=\"https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories\">NodeSource</a>.</p>\n</li>\n<li>\n<p><a href=\"https://clang.llvm.org/get_started.html\">clang</a> 3.4 or later.</p>\n</li>\n<li>\n<p>Development headers of GTK 3 and libnotify.</p>\n</li>\n</ul>\n<p>On Ubuntu, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install build-essential clang libdbus-1-dev libgtk-3-dev \\\n                       libnotify-dev libgnome-keyring-dev \\\n                       libasound2-dev libcap-dev libcups2-dev libxtst-dev \\\n                       libxss1 libnss3-dev gcc-multilib g++-multilib curl \\\n                       gperf bison python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On RHEL / CentOS, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo yum install clang dbus-devel gtk3-devel libnotify-devel \\\n                   libgnome-keyring-devel xorg-x11-server-utils libcap-devel \\\n                   cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \\\n                   nss-devel python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On Fedora, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo dnf install clang dbus-devel gtk3-devel libnotify-devel \\\n                   libgnome-keyring-devel xorg-x11-server-utils libcap-devel \\\n                   cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \\\n                   nss-devel python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On Arch Linux / Manjaro, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo pacman -Syu base-devel clang libdbus gtk2 libnotify \\\n                   libgnome-keyring alsa-lib libcap libcups libxtst \\\n                   libxss nss gcc-multilib curl gperf bison \\\n                   python2 python-dbusmock jdk8-openjdk\n</code></pre>\n<p>Other distributions may offer similar packages for installation via package managers such as pacman. Or one can compile from source code.</p>\n<h3 id=\"cross-compilation\"><a href=\"#cross-compilation\">Cross compilation</a></h3>\n<p>If you want to build for an <code>arm</code> target you should also install the following dependencies:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install libc6-dev-armhf-cross linux-libc-dev-armhf-cross \\\n                       g++-arm-linux-gnueabihf\n</code></pre>\n<p>Similarly for <code>arm64</code>, install the following:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install libc6-dev-arm64-cross linux-libc-dev-arm64-cross \\\n                       g++-aarch64-linux-gnu\n</code></pre>\n<p>And to cross-compile for <code>arm</code> or <code>ia32</code> targets, you should pass the <code>target_cpu</code> parameter to <code>gn gen</code>:</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">'import(...) target_cpu=\"arm\"'</span>\n</code></pre>\n<h2 id=\"compilation\"><a href=\"#compilation\">Compilation</a></h2>\n<p>See <a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a></p>\n<h2 id=\"résolution-de-problème\"><a href=\"#résolution-de-problème\">Résolution de problème</a></h2>\n<h3 id=\"error-while-loading-shared-libraries-libtinfoso5\"><a href=\"#error-while-loading-shared-libraries-libtinfoso5\">Error While Loading Shared Libraries: libtinfo.so.5</a></h3>\n<p>Prebuilt <code>clang</code> will try to link to <code>libtinfo.so.5</code>. Depending on the host architecture, symlink to appropriate <code>libncurses</code>:</p>\n<pre><code class=\"hljs language-sh\">$ sudo ln -s /usr/lib/libncurses.so.5 /usr/lib/libtinfo.so.5\n</code></pre>\n<h2 id=\"advanced-topics\"><a href=\"#advanced-topics\">Advanced topics</a></h2>\n<p>The default building configuration is targeted for major desktop Linux distributions. To build for a specific distribution or device, the following information may help you.</p>\n<h3 id=\"using-system-clang-instead-of-downloaded-clang-binaries\"><a href=\"#using-system-clang-instead-of-downloaded-clang-binaries\">Using system <code>clang</code> instead of downloaded <code>clang</code> binaries</a></h3>\n<p>By default Electron is built with prebuilt <a href=\"https://clang.llvm.org/get_started.html\"><code>clang</code></a> binaries provided by the Chromium project. If for some reason you want to build with the <code>clang</code> installed in your system, you can specify the <code>clang_base_path</code> argument in the GN args.</p>\n<p>For example if you installed <code>clang</code> under <code>/usr/local/bin/clang</code>:</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">'import(\"//electron/build/args/testing.gn\") clang_base_path = \"/usr/local/bin\"'</span>\n</code></pre>\n<h3 id=\"using-compilers-other-than-clang\"><a href=\"#using-compilers-other-than-clang\">Using compilers other than <code>clang</code></a></h3>\n<p>Building Electron with compilers other than <code>clang</code> is not supported.</p>",
      "title": "Instructions de Build (Linux)",
      "description": ""
    },
    "/docs/development/build-instructions-macos": {
      "locale": "fr-FR",
      "slug": "build-instructions-macos",
      "href": "/docs/development/build-instructions-macos",
      "crowdinFileId": "256135",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-macos.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"instructions-de-build-macos\"><a href=\"#instructions-de-build-macos\">Instructions de Build (macOS)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on macOS, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>macOS >= 10.11.6</li>\n<li><a href=\"https://developer.apple.com/technologies/tools/\">Xcode</a> >= 9.0.0</li>\n<li><a href=\"https://nodejs.org\">node.js</a> (externe)</li>\n<li>Python 2.7 avec le support de TLS 1.2</li>\n</ul>\n<h2 id=\"python\"><a href=\"#python\">Python</a></h2>\n<p>Please also ensure that your system and Python version support at least TLS 1.2. Cela dépend à la fois de votre version de macOS et de Python. For a quick test, run:</p>\n<pre><code class=\"hljs language-sh\">$ npx @electron/check-python-tls\n</code></pre>\n<p>If the script returns that your configuration is using an outdated security protocol, you can either update macOS to High Sierra or install a new version of Python 2.7.x. Pour mettre à jour Python, utilisez <a href=\"https://brew.sh/\">Homebrew</a> :</p>\n<pre><code class=\"hljs language-sh\">$ brew install python@2 &#x26;&#x26; brew link python@2 --force\n</code></pre>\n<p>Si vous utilisez le Python fournit par Homebrew, vous devez également installer les modules Python suivants:</p>\n<ul>\n<li><a href=\"https://pypi.org/project/pyobjc/#description\">pyobjc</a></li>\n</ul>\n<p>Vous pouvez utiliser <code>pip</code> pour l'installer :</p>\n<pre><code class=\"hljs language-sh\">$ pip install pyobjc\n</code></pre>\n<h2 id=\"sdk-macos\"><a href=\"#sdk-macos\">SDK macOS</a></h2>\n<p>Si vous développez Electron et ne prévoyez pas de redistribuer votre version d'Electron vous pouvez sauter cette section.</p>\n<p>Official Electron builds are built with <a href=\"https://download.developer.apple.com/Developer_Tools/Xcode_12.2/Xcode_12.2.xip\">Xcode 12.2</a>, and the macOS 11.0 SDK. Compiler avec des nouvelles version du SDK marche aussi, mais les releases utilisent actuellement le SDK 11.0.</p>\n<h2 id=\"compilation-delectron\"><a href=\"#compilation-delectron\">Compilation d'Electron</a></h2>\n<p>Voir les <a href=\"/docs/development/build-instructions-gn\">Instructions de compilation : GN</a>.</p>",
      "title": "Instructions de Build (macOS)",
      "description": ""
    },
    "/docs/development/build-instructions-windows": {
      "locale": "fr-FR",
      "slug": "build-instructions-windows",
      "href": "/docs/development/build-instructions-windows",
      "crowdinFileId": "256137",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-windows.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"instructions-de-build-windows\"><a href=\"#instructions-de-build-windows\">Instructions de Build (Windows)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on Windows, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prérequis\"><a href=\"#prérequis\">Prérequis</a></h2>\n<ul>\n<li>Windows 10 / Server 2012 R2 ou supérieur</li>\n<li>Visual Studio 2017 15.7.2 ou plus - <a href=\"https://www.visualstudio.com/vs/\">télécharger VS 2019 Community Edition gratuitement</a><ul>\n<li>Voir <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md#visual-studio\">la documentation de construction de Chromium</a> pour plus de détails sur les composants de Visual Studio.</li>\n<li>Si votre Visual Studio est installé dans un autre répertoire que celui par défaut, vous aurez besoin de définir quelques variables d'environnement pour pointer les chaînes de compilation vers votre chemin d'installation.<ul>\n<li><code>vs2019_install = DRIVE:\\path\\to\\Microsoft Visual Studio\\2019\\Community</code>, remplaçant <code>2019</code> et <code>Communauté</code> par vos versions installées et remplaçant <code>DRIVE:</code> par le lecteur sur lequel Visual Studio est allumé. Souvent, ce sera <code>C:</code>.</li>\n<li><code>WINDOWSSDKDIR = DRIVE:\\path\\to\\Windows Kits\\10</code>, replacing <code>DRIVE:</code> with the drive that Windows Kits is on. Souvent, ce sera <code>C:</code>.</li>\n</ul></li>\n<li><a href=\"https://pypi.org/project/pywin32/#files\">Les extensions Python pour Windows (pywin32) </a> sont également nécessaires pour exécuter le processus de compilation.</li>\n</ul></li>\n<li><a href=\"https://nodejs.org/download/\">Node.js</a></li>\n<li><a href=\"https://git-scm.com\">Git</a></li>\n<li>Debugging Tools for Windows of Windows SDK 10.0.15063.468 if you plan on creating a full distribution since <code>symstore.exe</code> is used for creating a symbol store from <code>.pdb</code> files.<ul>\n<li>Différentes versions du SDK peuvent être installées côte à côte. Pour installer le SDK, ouvrez Visual Studio Installer, sélectionnez <code>Modify</code> → <code>Composants individuels</code>, faites défiler vers le bas et sélectionnez le SDK Windows approprié à installer. Une autre option serait de regarder la <a href=\"https://developer.microsoft.com/en-us/windows/downloads/sdk-archive\">Windows SDK et l'archive émulateur</a> et de télécharger la version autonome du SDK respectivement.</li>\n<li>Les outils de débogage SDK doivent également être installés. Si le SDK Windows 10 a été installé via l'installateur Visual Studio, alors ils peuvent être installés en allant à: <code>Panneau de configuration</code> → <code>Programmes</code> → <code>Programmes et fonctionnalités</code> → Sélectionnez le \"Kit de développement du logiciel Windows\" → <code>Changement</code> → <code>Changement</code> → Vérifiez \"Outils de débogage pour Windows\" → <code>Changement</code>. Ou, vous pouvez télécharger l'installateur SDK autonome et l'utiliser pour installer les outils de débogage.</li>\n</ul></li>\n</ul>\n<p>Si vous ne disposez pas d’une installation Windows, <a href=\"https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/\">dev.microsoftedge.com</a> propose des versions de Windows qui vous permets de compiler Electron.</p>\n<p>La compilation d'Electron se fait entièrement avec des scripts en ligne de commande et ne peut se faire avec Visual Studio. Vous pouvez développer Electron avec n’importe quel éditeur, mais le support de la compilation avec Visual Studio viendra dans le futur.</p>\n<p><strong>Remarque :</strong> Même si Visual Studio n’est pas utilisé pour la compilation, il est toujours <strong>nécessaire</strong> car nous avons besoin du build toolchains qu'il fournit.</p>\n<h2 id=\"exclude-source-tree-from-windows-security\"><a href=\"#exclude-source-tree-from-windows-security\">Exclude source tree from Windows Security</a></h2>\n<p>Windows Security doesn't like one of the files in the Chromium source code (see <a href=\"https://crbug.com/441184\">https://crbug.com/441184</a>), so it will constantly delete it, causing <code>gclient sync</code> issues. You can exclude the source tree from being monitored by Windows Security by <a href=\"https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26\">following these instructions</a>.</p>\n<h2 id=\"compilation\"><a href=\"#compilation\">Compilation</a></h2>\n<p>See <a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a></p>\n<h2 id=\"compilation-32bit\"><a href=\"#compilation-32bit\">Compilation 32bit</a></h2>\n<p>Pour construire pour la cible 32 bits, vous devez passer <code>target_cpu = \"x86\"</code> en tant qu'arg. GN. Vous pouvez construire la cible 32 bits à côté de la cible 64 bits en utilisant un répertoire de sortie différent pour GN, par exemple <code>out/Release-x86</code>, avec des arguments différents.</p>\n<pre><code class=\"hljs language-powershell\">$ gn gen out/Release-x86 --args=<span class=\"hljs-string\">\"import(\\\"</span>//electron/build/args/release.gn\\<span class=\"hljs-string\">\") target_cpu=\\\"</span>x86\\<span class=\"hljs-string\">\"\"</span>\n</code></pre>\n<p>Les autres étapes pour la compilation sont exactement les mêmes.</p>\n<h2 id=\"projet-visual-studio\"><a href=\"#projet-visual-studio\">Projet Visual Studio</a></h2>\n<p>Pour générer un projet Visual Studio, vous pouvez passer le paramètre <code>--ide=vs2017</code> à <code>gn gen</code>:</p>\n<pre><code class=\"hljs language-powershell\">$ gn gen out/Testing --ide=vs2017\n</code></pre>\n<h2 id=\"résolution-de-problème\"><a href=\"#résolution-de-problème\">Résolution de problème</a></h2>\n<h3 id=\"xxxx-commande-introuvable\"><a href=\"#xxxx-commande-introuvable\">xxxx commande introuvable</a></h3>\n<p>Si vous avez rencontré une erreur comme <code>commande xxxx introuvable</code>, vous pouvez essayez la console de <code>ligne de commande VS2015</code> pour exécuter les scripts de compilation.</p>\n<h3 id=\"fatal-internal-compiler-error-c1001\"><a href=\"#fatal-internal-compiler-error-c1001\">Fatal internal compiler error: C1001</a></h3>\n<p>Assurez-vous d'avoir la dernière mise à jour de Visual Studio installé.</p>\n<h3 id=\"lnk1181-cannot-open-input-file-kernel32lib\"><a href=\"#lnk1181-cannot-open-input-file-kernel32lib\">LNK1181: cannot open input file 'kernel32.lib'</a></h3>\n<p>Essayez de réinstaller Node.js 32bit.</p>\n<h3 id=\"error-enoent-stat-cusersusernameappdataroamingnpm\"><a href=\"#error-enoent-stat-cusersusernameappdataroamingnpm\">Error: ENOENT, stat 'C:\\Users\\USERNAME\\AppData\\Roaming\\npm'</a></h3>\n<p>La création du répertoire suivant <a href=\"https://stackoverflow.com/a/25095327/102704\">devrait corriger le problème</a> :</p>\n<pre><code class=\"hljs language-powershell\">$ mkdir ~\\AppData\\Roaming\\npm\n</code></pre>\n<h3 id=\"node-gyp-is-not-recognized-as-an-internal-or-external-command\"><a href=\"#node-gyp-is-not-recognized-as-an-internal-or-external-command\">node-gyp is not recognized as an internal or external command</a></h3>\n<p>Cette erreur peut se produire si vous utilisez Git Bash pour la compilation, vous devez utiliser PowerShell ou l'invite de commande de VS2015 à la place.</p>\n<h3 id=\"ne-peut-pas-créer-le-répertoire-à--nom-de-fichier-trop-long\"><a href=\"#ne-peut-pas-créer-le-répertoire-à--nom-de-fichier-trop-long\">ne peut pas créer le répertoire à '...': nom de fichier trop long</a></h3>\n<p>node.js a quelques <a href=\"https://github.com/electron/node/tree/electron/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/read-pkg-up/node_modules/read-pkg/node_modules/load-json-file/node_modules/parse-json/node_modules/error-ex/node_modules/is-arrayish\">noms de chemin extrêmement longs</a>, et par défaut git sur windows ne gère pas correctement les chemins longs (même si Windows les supporte). Cela devrait être réparé :</p>\n<pre><code class=\"hljs language-sh\">$ git config --system core.longpaths <span class=\"hljs-literal\">true</span>\n</code></pre>\n<h3 id=\"erreur-utilisation-de-lidentifiant-non-déclaré-defaultdelegatecheckmode\"><a href=\"#erreur-utilisation-de-lidentifiant-non-déclaré-defaultdelegatecheckmode\">erreur: utilisation de l'identifiant non déclaré 'DefaultDelegateCheckMode'</a></h3>\n<p>This can happen during build, when Debugging Tools for Windows has been installed with Windows Driver Kit. Uninstall Windows Driver Kit and install Debugging Tools with steps described above.</p>\n<h3 id=\"erreur-dimportation--aucun-module-nommé-win32file\"><a href=\"#erreur-dimportation--aucun-module-nommé-win32file\">Erreur d'importation : Aucun module nommé win32file</a></h3>\n<p>Assurez-vous d'avoir installé <code>pywin32</code> avec <code>pip install pywin32</code>.</p>\n<h3 id=\"construire-des-scripts-pendent-jusquà-ce-que-le-bouton-soit-appuyé\"><a href=\"#construire-des-scripts-pendent-jusquà-ce-que-le-bouton-soit-appuyé\">Construire des scripts pendent jusqu'à ce que le bouton soit appuyé</a></h3>\n<p>Ce bug est une « fonctionnalité » de l'invite de commande de Windows. Cela se produit lorsque vous cliquez dans la fenêtre d'invite avec l'option <code>Édition rapide</code> et est destiné à permettre la sélection et la copie du texte de sortie facilement. Puisque chaque clic accidentel met en pause le processus de construction, vous pouvez désactiver cette fonctionnalité dans les propriétés de l'invite de commande.</p>",
      "title": "Instructions de Build (Windows)",
      "description": ""
    },
    "/docs/development/build-system-overview": {
      "locale": "fr-FR",
      "slug": "build-system-overview",
      "href": "/docs/development/build-system-overview",
      "crowdinFileId": "256139",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-system-overview.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"aperçu-du-système-de-compilation\"><a href=\"#aperçu-du-système-de-compilation\">Aperçu du Système de compilation</a></h1>\n<p>Electron utilise <a href=\"https://gn.googlesource.com/gn\">GN</a> pour la génération de projet et <a href=\"https://ninja-build.org/\">ninja</a> pour la construction. Les configurations du projet peuvent être trouvées dans les fichiers <code>.gn</code> et <code>.gni</code> .</p>\n<h2 id=\"fichiers-gn\"><a href=\"#fichiers-gn\">Fichiers GN</a></h2>\n<p>Les fichiers <code>gn</code> suivants contiennent les règles principales pour la construction d'Electron :</p>\n<ul>\n<li><code>BUILD.gn</code> définit comment Electron lui-même est construit et inclut les configurations par défaut pour se connecter avec Chromium.</li>\n<li><code>build/args/{debug,release,all}.gn</code> contient les arguments de construction par défaut pour compilant Electron.</li>\n</ul>\n<h2 id=\"component-build\"><a href=\"#component-build\">Component Build</a></h2>\n<p>Étant donné que Chrome est un sacré gros projet, la dernière étape de reliage (linking) peut prendre quelques minutes, ce qui rend le développement difficile. Afin de résoudre ce problème, Chrome a introduit le « component build », qui compile chaque composant comme une bibliothèque partagée distincte, faisant le lien très rapidement mais sacrifie la taille de fichier et la performance.</p>\n<p>Electron hérite de cette option de compilation de Chromium. Dans les versions <code>Debug</code>, le binaire sera lié à une version partagée de la bibliothèque des composants de Chromium pour obtenir un temps de liaison rapide ; pour les versions <code>Release</code>, le binaire sera lié à les versions statiques de la bibliothèque, pour que nous puissions avoir la meilleure taille binaire possible et les meilleures performances .</p>\n<h2 id=\"tests\"><a href=\"#tests\">Tests</a></h2>\n<p><strong>NB</strong> <em>cette section est obsolète et contient des informations qui ne sont plus pertinentes pour l'électronique GN.</em></p>\n<p>Pour tester que vos changements soient conforme avec le code style du projet :</p>\n<pre><code class=\"hljs language-sh\">$ npm run lint\n</code></pre>\n<p>Pour tester les fonctionnalités :</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>Chaque fois que vous apportez des modifications au code source d'Electron, vous devez ré-exécuter la compilation avant les tests :</p>\n<pre><code class=\"hljs language-sh\">$ npm run build &#x26;&#x26; npm <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>Vous pouvez rendre la suite de tests plus rapide en isolant le test spécifique ou bloc que vous travaillez actuellement à l’aide de la fonctionnalité <a href=\"https://mochajs.org/#exclusive-tests\">tests exclusifs</a> de Mocha. Ajoutez <code>.only</code> pour chaque appel aux fonctions <code>describe</code> ou <code>it</code>:</p>\n<pre><code class=\"hljs language-js\">describe.only(<span class=\"hljs-string\">'some feature'</span>, () => {\n  <span class=\"hljs-comment\">// ... Seuls les tests de ce bloc seront exécutés</span>\n})\n</code></pre>\n<p>Alternativement, vous pouvez utiliser l'option <code>grep</code> de Mocha pour exécuter uniquement les tests correspondant au modèle d’expression régulière donnée :</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span> -- --grep child_process\n</code></pre>\n<p>Les tests qui incluent des modules natifs (par exemple <code>runas</code>) ne peuvent être exécutées avec le débogage (voir <a href=\"https://github.com/electron/electron/issues/2558\">#2558</a> pour plus de détails), mais ils fonctionneront avec la version Release.</p>\n<p>Pour exécuter les tests avec le build release :</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span> -- -R\n</code></pre>",
      "title": "Aperçu du Système de compilation",
      "description": ""
    },
    "/docs/api/structures/certificate": {
      "locale": "fr-FR",
      "slug": "certificate",
      "href": "/docs/api/structures/certificate",
      "crowdinFileId": "256415",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/certificate.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"certificate-object\"><a href=\"#certificate-object\">Certificate Object</a></h1>\n<ul>\n<li><code>data</code> String - PEM encoded data</li>\n<li><code>issuer</code> <a href=\"/docs/api/structures/certificate-principal\">CertificatePrincipal</a> - Issuer principal</li>\n<li><code>issuerName</code> String - Issuer's Common Name</li>\n<li><code>issuerCert</code> Certificate - Issuer certificate (if not self-signed)</li>\n<li><code>subject</code> <a href=\"/docs/api/structures/certificate-principal\">CertificatePrincipal</a> - Subject principal</li>\n<li><code>subjectName</code> String - Subject's Common Name</li>\n<li><code>serialNumber</code> String - Hex value represented string</li>\n<li><code>validStart</code> Number - Start date of the certificate being valid in seconds</li>\n<li><code>validExpiry</code> Number - End date of the certificate being valid in seconds</li>\n<li><code>fingerprint</code> String - Fingerprint of the certificate</li>\n</ul>",
      "title": "Certificate Object",
      "description": ""
    },
    "/docs/api/structures/certificate-principal": {
      "locale": "fr-FR",
      "slug": "certificate-principal",
      "href": "/docs/api/structures/certificate-principal",
      "crowdinFileId": "256413",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/certificate-principal.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"certificateprincipal-object\"><a href=\"#certificateprincipal-object\">CertificatePrincipal Object</a></h1>\n<ul>\n<li><code>commonName</code> String - Common Name.</li>\n<li><code>organizations</code> String[] - Organization names.</li>\n<li><code>organizationUnits</code> String[] - Organization Unit names.</li>\n<li><code>locality</code> String - Locality.</li>\n<li><code>state</code> String - State or province.</li>\n<li><code>country</code> String - Country or region.</li>\n</ul>",
      "title": "CertificatePrincipal Object",
      "description": ""
    },
    "/docs/development/chromium-development": {
      "locale": "fr-FR",
      "slug": "chromium-development",
      "href": "/docs/development/chromium-development",
      "crowdinFileId": "256141",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/chromium-development.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"développement-chromium\"><a href=\"#développement-chromium\">Développement Chromium</a></h1>\n<blockquote>\n<p>Une collection de ressources pour l’apprentissage à propos de Chromium et pour suivre son développement</p>\n</blockquote>\n<ul>\n<li><a href=\"https://twitter.com/ChromiumDev\">@ChromiumDev</a> sur Twitter</li>\n<li><a href=\"https://twitter.com/googlechrome\">@googlechrome</a> sur Twitter</li>\n<li><a href=\"https://blog.chromium.org\">Blog</a></li>\n<li><a href=\"https://cs.chromium.org/\">Recherche de code</a></li>\n<li><a href=\"https://cs.chromium.org/chromium/src/\">Code source</a></li>\n<li><a href=\"https://www.chromium.org/developers/calendar\">Calendrier de développement et Info sur les releases</a></li>\n<li><a href=\"https://www.chromium.org/developers/discussion-groups\">Groupes de discussion</a></li>\n</ul>\n<p>Voir aussi <a href=\"/docs/development/v8-development\">Développement V8</a></p>",
      "title": "Développement Chromium",
      "description": "Une collection de ressources pour l’apprentissage à propos de Chromium et pour suivre son développement"
    },
    "/docs/development/clang-format": {
      "locale": "fr-FR",
      "slug": "clang-format",
      "href": "/docs/development/clang-format",
      "crowdinFileId": "256143",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/clang-format.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"utilisation-du-clang-format-sur-du-code-c\"><a href=\"#utilisation-du-clang-format-sur-du-code-c\">Utilisation du clang-format sur du code C++</a></h1>\n<p><a href=\"https://clang.llvm.org/docs/ClangFormat.html\"><code>Clang-format</code></a> est un outil pour formater le code C/C++/Objective-C permettant aux développeurs de ne pas se soucier des problèmes de style au cours de la révision du code.</p>\n<p>Il est fortement recommandé de formater votre code C++ avant d'ouvrir des pull requests afin de vous faire gagner du temps ainsi qu'aux réviseurs.</p>\n<p>Vous pouvez installer <code>clang-format</code> et <code>git-clang-format</code> via <code>npm install -g clang-format</code>.</p>\n<p>To automatically format a file according to Electron C++ code style, run <code>clang-format -i path/to/electron/file.cc</code>. It should work on macOS/Linux/Windows.</p>\n<p>Suivez ces étapes pour changer votre code :</p>\n<ol>\n<li>Apportez des modifications de codes dans le repository d'Electron.</li>\n<li>Exécutez <code>git add votre_fichier.cc</code>.</li>\n<li>Exécutez <code>git-clang-format</code> et vous verrez probablement des modifications dans <code>votre_fichier.cc</code>, ces modifications sont générées à partir de <code>clang-format</code>.</li>\n<li>Exécutez <code>git add votre_fichier.cc</code> et commitez vos modifications.</li>\n<li>Maintenant la branche est prête pour être en pull request.</li>\n</ol>\n<p>If you want to format the changed code on your latest git commit (HEAD), you can run <code>git-clang-format HEAD~1</code>. See <code>git-clang-format -h</code> for more details.</p>\n<h2 id=\"intégration-dans-léditeur\"><a href=\"#intégration-dans-léditeur\">Intégration dans l’éditeur</a></h2>\n<p>You can also integrate <code>clang-format</code> directly into your favorite editors. For further guidance on setting up editor integration, see these pages:</p>\n<ul>\n<li><a href=\"https://atom.io/packages/clang-format\">Atom</a></li>\n<li><a href=\"https://clang.llvm.org/docs/ClangFormat.html#vim-integration\">Vim &#x26; Emacs</a></li>\n<li><a href=\"https://marketplace.visualstudio.com/items?itemName=xaver.clang-format\">Visual Studio Code</a></li>\n</ul>",
      "title": "Utilisation du clang-format sur du code C++",
      "description": ""
    },
    "/docs/development/clang-tidy": {
      "locale": "fr-FR",
      "slug": "clang-tidy",
      "href": "/docs/development/clang-tidy",
      "crowdinFileId": "256145",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/clang-tidy.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"utilisation-de-clang-tidy-sur-du-code-c-\"><a href=\"#utilisation-de-clang-tidy-sur-du-code-c-\">Utilisation de clang-tidy sur du code C ++</a></h1>\n<p><a href=\"https://clang.llvm.org/extra/clang-tidy/\"><code>clang-tidy</code></a> is a tool to automatically check C/C++/Objective-C code for style violations, programming errors, and best practices.</p>\n<p>Electron's <code>clang-tidy</code> integration is provided as a linter script which can be run with <code>npm run lint:clang-tidy</code>. While <code>clang-tidy</code> checks your on-disk files, you need to have built Electron so that it knows which compiler flags were used. There is one required option for the script <code>--output-dir</code>, which tells the script which build directory to pull the compilation information from. Une utilisation typique serait : <code>npm run lint:clang-tidy --out-dir ../out/Testing</code></p>\n<p>With no filenames provided, all C/C++/Objective-C files will be checked. Vous pouvez fournir une liste de fichiers à vérifier en passant les noms de fichiers après les options : <code>npm run lint:clang-tidy --out-dir ../out/Testing shell/browser/api/electron_api_app.cc</code></p>\n<p>While <code>clang-tidy</code> has a <a href=\"https://clang.llvm.org/extra/clang-tidy/checks/list.html\">long list</a> of possible checks, in Electron only a few are enabled by default. At the moment Electron doesn't have a <code>.clang-tidy</code> config, so <code>clang-tidy</code> will find the one from Chromium at <code>src/.clang-tidy</code> and use the checks which Chromium has enabled. Vous pouvez modifier les vérifications exécutées en utilisant le l'option <code>--checks=</code>. Ceci est transmis directement à <code>clang-tidy</code>, alors voyez sa documentation pour plus de détails. Wildcards can be used, and checks can be disabled by prefixing a <code>-</code>. By default any checks listed are added to those in <code>.clang-tidy</code>, so if you'd like to limit the checks to specific ones you should first exclude all checks then add back what you want, like <code>--checks=-*,performance*</code>.</p>\n<p>Running <code>clang-tidy</code> is rather slow - internally it compiles each file and then runs the checks so it will always be some factor slower than compilation. While you can use parallel runs to speed it up using the <code>--jobs|-j</code> option, <code>clang-tidy</code> also uses a lot of memory during its checks, so it can easily run into out-of-memory errors. En tant que tel, le nombre de tâches par défaut est un.</p>",
      "title": "Utilisation de clang-tidy sur du code C ++",
      "description": ""
    },
    "/docs/api/client-request": {
      "locale": "fr-FR",
      "slug": "client-request",
      "href": "/docs/api/client-request",
      "crowdinFileId": "256289",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/client-request.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe--clientrequest\"><a href=\"#classe--clientrequest\">Classe : ClientRequest</a></h2>\n<blockquote>\n<p>Faire des requêtes HTTP/HTTPS.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>ClientRequest</code> implémente l'interface de <a href=\"https://nodejs.org/api/stream.html#stream_writable_streams\">Writable Stream</a> et, du coup, elle est un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h3 id=\"new-clientrequestoptions\"><a href=\"#new-clientrequestoptions\"><code>new ClientRequest(options)</code></a></h3>\n<ul>\n<li><code>options</code> (Object | String) - If <code>options</code> is a String, it is interpreted as the request URL. If it is an object, it is expected to fully specify an HTTP request via the following properties:<ul>\n<li><code>method</code> String (optional) - The HTTP request method. Defaults to the GET method.</li>\n<li><code>url</code> String (optional) - The request URL. Must be provided in the absolute form with the protocol scheme specified as http or https.</li>\n<li><code>session</code> Session (facultatif) - l'instance <a href=\"/docs/api/session\"><code>Session</code></a> avec à laquelle la requête est associée.</li>\n<li><code>partition</code> String (facultatif) - Le nom de la <a href=\"/docs/api/session\"><code>partition</code></a> avec laquelle la requête est associée. Par défaut, la chaîne vide est utilisée. The <code>session</code> option supersedes <code>partition</code>. Ainsi, si une <code>session</code> est explicitement spécifiée , <code>partition</code> est ignorée.</li>\n<li><code>credentials</code> String (optional) - Can be <code>include</code> or <code>omit</code>. Whether to send <a href=\"https://fetch.spec.whatwg.org/#credentials\">credentials</a> with this request. If set to <code>include</code>, credentials from the session associated with the request will be used. If set to <code>omit</code>, credentials will not be sent with the request (and the <code>'login'</code> event will not be triggered in the event of a 401). This matches the behavior of the <a href=\"https://fetch.spec.whatwg.org/#concept-request-credentials-mode\">fetch</a> option of the same name. If this option is not specified, authentication data from the session will be sent, and cookies will not be sent (unless <code>useSessionCookies</code> is set).</li>\n<li><code>useSessionCookies</code> Boolean (optional) - Whether to send cookies with this request from the provided session. If <code>credentials</code> is specified, this option has no effect. Par défaut la valeur est <code>false</code>.</li>\n<li><code>protocol</code> String (optional) - Can be <code>http:</code> or <code>https:</code>. The protocol scheme in the form 'scheme:'. Defaults to 'http:'.</li>\n<li><code>host</code> String (facultatif) - L'hôte du serveur fourni en concaténation de le nom d'hôte et le numéro de port 'hostname:port'.</li>\n<li><code>hostname</code> String (facultatif) - Le nom d'hôte du serveur.</li>\n<li><code>port</code> Integer (facultatif) - Le numéro de port d'écoute du serveur.</li>\n<li><code>path</code> String (facultatif) - La partie chemin de l'URL de la requête.</li>\n<li><code>redirect</code> String (facultatif) -Peut être <code>follow</code>, <code>error</code> ou <code>manual</code>. The redirect mode for this request. When mode is <code>error</code>, any redirection will be aborted. When mode is <code>manual</code> the redirection will be cancelled unless <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> is invoked synchronously during the <a href=\"#event-redirect\"><code>redirect</code></a> event.  Par défaut, <code>follow</code>.</li>\n<li><code>origin</code> String (optional) - The origin URL of the request.</li>\n</ul></li>\n</ul>\n<p><code>options</code> propriétés telles que <code>protocole</code>, <code>host</code>, <code>hostname</code>, <code>port</code> et <code>path</code> suivent strictement le modèle Node.js comme décrit dans le module <a href=\"https://nodejs.org/api/url.html\">URL</a>.</p>\n<p>Par exemple, nous aurions pu créer la même requête à 'github.com' comme suit:</p>\n<pre><code class=\"hljs language-JavaScript\"><span class=\"hljs-keyword\">const</span> request = net.request({\n  <span class=\"hljs-attr\">method</span>: <span class=\"hljs-string\">'GET'</span>,\n  <span class=\"hljs-attr\">protocol</span>: <span class=\"hljs-string\">'https:'</span>,\n  <span class=\"hljs-attr\">hostname</span>: <span class=\"hljs-string\">'github.com'</span>,\n  <span class=\"hljs-attr\">port</span>: <span class=\"hljs-number\">443</span>,\n  <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'/'</span>\n})\n</code></pre>\n<h3 id=\"événements-dinstance\"><a href=\"#événements-dinstance\">Événements d’instance</a></h3>\n<h4 id=\"événement--response\"><a href=\"#événement--response\">Événement : 'response'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>response</code> <a href=\"/docs/api/incoming-message\">IncomingMessage</a> - Un objet représentant le message de réponse HTTP.</li>\n</ul>\n<h4 id=\"événement--login\"><a href=\"#événement--login\">Événement : 'login'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li>Objet <code>authInfo</code><ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>nom d'utilisateur</code> String (facultatif)</li>\n<li><code>mot de passe</code> String (facultatif)</li>\n</ul></li>\n</ul>\n<p>Émis lorsqu'un proxy d'authentification demande les identifiants de l'utilisateur.</p>\n<p>La fonction <code>callback</code> est censée être rappelée avec les identifiants de l'utilisateur :</p>\n<ul>\n<li><code>username</code> String</li>\n<li><code>password</code> String</li>\n</ul>\n<pre><code class=\"hljs language-JavaScript\">request.on(<span class=\"hljs-string\">'login'</span>, (authInfo, callback) => {\n  callback(<span class=\"hljs-string\">'username'</span>, <span class=\"hljs-string\">'password'</span>)\n})\n</code></pre>\n<p>Fournir des identifiants vides annulera la demande et signalera une erreur d'authentification sur l'objet de réponse :</p>\n<pre><code class=\"hljs language-JavaScript\">request.on(<span class=\"hljs-string\">'response'</span>, (response) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`STATUS: <span class=\"hljs-subst\">${response.statusCode}</span>`</span>);\n  response.on(<span class=\"hljs-string\">'error'</span>, (error) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`ERROR: <span class=\"hljs-subst\">${<span class=\"hljs-built_in\">JSON</span>.stringify(error)}</span>`</span>)\n  })\n})\nrequest.on(<span class=\"hljs-string\">'login'</span>, (authInfo, callback) => {\n  callback()\n})\n</code></pre>\n<h4 id=\"événement--finish\"><a href=\"#événement--finish\">Événement : 'finish'</a></h4>\n<p>Émis juste après le dernier chunk de l'objet <code>request</code> a été écrit dans l'objet <code>request</code>.</p>\n<h4 id=\"événement--abort\"><a href=\"#événement--abort\">Événement : 'abort'</a></h4>\n<p>Emitted when the <code>request</code> is aborted. The <code>abort</code> event will not be fired if the <code>request</code> is already closed.</p>\n<h4 id=\"événement--error\"><a href=\"#événement--error\">Événement : 'error'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>error</code> Erreur - un objet d'erreur fournissant des informations sur l'échec.</li>\n</ul>\n<p>Émis lorsque le module <code>net</code> ne parvient pas à émettre une requête réseau. Généralement lorsque l'objet <code>request</code> émet un événement <code>error</code>, un événement <code>close</code> sera ensuite suivi et aucun objet de réponse ne sera fourni.</p>\n<h4 id=\"événement--close\"><a href=\"#événement--close\">Événement : 'close'</a></h4>\n<p>Émis en tant que dernier événement dans la transaction de réponse de requête HTTP. L'événement <code>close</code> indique qu'aucun événement ne sera émis sur les objets <code>request</code> ou <code>response</code>.</p>\n<h4 id=\"événement--redirect\"><a href=\"#événement--redirect\">Événement : 'redirect'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>statusCode</code> Integer</li>\n<li><code>method</code> String</li>\n<li><code>redirectUrl</code> String</li>\n<li><code>En-têtes</code> de réponse&#x3C;String, String[]></li>\n</ul>\n<p>Émis lorsque le serveur renvoie une réponse de redirection (par exemple 301 Déplacé de manière permanente). Appeler <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> va continuer avec la redirection.  Si cet événement est géré, <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> doit être appelé <strong>synchrones</strong>, sinon la requête sera annulée.</p>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<h4 id=\"requestchunkedencoding\"><a href=\"#requestchunkedencoding\"><code>request.chunkedEncoding</code></a></h4>\n<p>Un <code>Booléen</code> spécifiant si la requête utilisera l'encodage de transfert HTTP chunked ou non. Par défaut, faux. La propriété est lisible et en écriture, Cependant, il ne peut être défini que avant la première opération d'écriture car les en-têtes HTTP ne sont pas encore mis sur le fil. Tenter de définir la propriété <code>chunkedEncoding</code> après la première écriture lancera une erreur.</p>\n<p>L'utilisation de l'encodage chunked est fortement recommandée si vous avez besoin d'envoyer un grand corps de requête car les données seront diffusées en petits morceaux au lieu d'être en mémoire tampon interne dans la mémoire de processus d'Electron.</p>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<h4 id=\"requestsetheadername-value\"><a href=\"#requestsetheadername-value\"><code>request.setHeader(name, value)</code></a></h4>\n<ul>\n<li><code>name</code> String - Un nom d'en-tête HTTP supplémentaire.</li>\n<li><code>valeur</code> String - Une valeur d'en-tête HTTP supplémentaire.</li>\n</ul>\n<p>Ajoute un en-tête HTTP supplémentaire. Le nom de l'en-tête sera publié tel quel sans minuscules. Il peut être appelé seulement avant d'écrire en premier. Appeler cette méthode après la première écriture lancera une erreur. Si la valeur passée n'est pas une <code>String</code>, sa méthode <code>toString()</code> sera appelée pour obtenir la valeur finale.</p>\n<p>Certain headers are restricted from being set by apps. These headers are listed below. More information on restricted headers can be found in <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:services/network/public/cpp/header_util.cc;drc=1562cab3f1eda927938f8f4a5a91991fefde66d3;bpv=1;bpt=1;l=22\">Chromium's header utils</a>.</p>\n<ul>\n<li><code>Content-Length</code></li>\n<li><code>Host</code></li>\n<li><code>Trailer</code> or <code>Te</code></li>\n<li><code>Upgrade</code></li>\n<li><code>Cookie2</code></li>\n<li><code>Keep-Alive</code></li>\n<li><code>Transfer-Encoding</code></li>\n</ul>\n<p>Additionally, setting the <code>Connection</code> header to the value <code>upgrade</code> is also disallowed.</p>\n<h4 id=\"requestgetheadername\"><a href=\"#requestgetheadername\"><code>request.getHeader(name)</code></a></h4>\n<ul>\n<li><code>name</code> Chaîne - Spécifie un nom d'en-tête supplémentaire.</li>\n</ul>\n<p>Retourne <code>String</code> - La valeur d'un nom d'en-tête supplémentaire précédemment défini.</p>\n<h4 id=\"requestremoveheadername\"><a href=\"#requestremoveheadername\"><code>request.removeHeader(name)</code></a></h4>\n<ul>\n<li><code>name</code> Chaîne - Spécifie un nom d'en-tête supplémentaire.</li>\n</ul>\n<p>Removes a previously set extra header name. This method can be called only before first write. Trying to call it after the first write will throw an error.</p>\n<h4 id=\"requestwritechunk-encoding-callback\"><a href=\"#requestwritechunk-encoding-callback\"><code>request.write(chunk[, encoding][, callback])</code></a></h4>\n<ul>\n<li><code>chunk</code> (String | Buffer) - A chunk of the request body's data. If it is a string, it is converted into a Buffer using the specified encoding.</li>\n<li><code>encoding</code> String (optional) - Used to convert string chunks into Buffer objects. Defaults to 'utf-8'.</li>\n<li><code>callback</code> Fonction (facultatif) - Appelée après la fin de l'opération d'écriture.</li>\n</ul>\n<p><code>callback</code> est essentiellement une fonction factice introduite dans le but de conserver la similarité avec l'API Node.js. Il est appelé de manière asynchrone dans le prochain tick après que le contenu <code>chunk</code> ait été livré à la couche de réseau Chromium. Contrairement à l'implémentation de Node.js, il n'est pas garanti que le contenu <code>chunk</code> ait été vidé sur le fil avant que <code>callback</code> ne soit appelé.</p>\n<p>Ajoute un morceau de données au corps de la requête. La première opération d'écriture peut causer la publication des en-têtes de la requête sur le fil. Après la première opération d'écriture, il n'est pas autorisé d'ajouter ou de supprimer un en-tête personnalisé.</p>\n<h4 id=\"requestendchunk-encoding-callback\"><a href=\"#requestendchunk-encoding-callback\"><code>request.end([chunk][, encoding][, callback])</code></a></h4>\n<ul>\n<li><code>chunk</code> (String | Buffer) (facultatif)</li>\n<li><code>encoding</code> String (facultatif)</li>\n<li><code>callback</code> Function (facultatif)</li>\n</ul>\n<p>Sends the last chunk of the request data. Subsequent write or end operations will not be allowed. The <code>finish</code> event is emitted just after the end operation.</p>\n<h4 id=\"requestabort\"><a href=\"#requestabort\"><code>request.abort()</code></a></h4>\n<p>Annule une transaction HTTP en cours. Si la requête a déjà émis l'événement <code>close</code> , l'opération d'abandon n'aura aucun effet. Sinon, un événement en cours émettra des événements <code>abandon</code> et <code>close</code> . De plus, s'il y a un objet de réponse en cours, il émettra l'évènement <code>abandonné</code>.</p>\n<h4 id=\"requestfollowredirect\"><a href=\"#requestfollowredirect\"><code>request.followRedirect()</code></a></h4>\n<p>Continues any pending redirection. Can only be called during a <code>'redirect'</code> event.</p>\n<h4 id=\"requestgetuploadprogress\"><a href=\"#requestgetuploadprogress\"><code>request.getUploadProgress()</code></a></h4>\n<p>Retourne <code>Object</code>:</p>\n<ul>\n<li><code>active</code> Boolean - Whether the request is currently active. If this is false no other properties will be set</li>\n<li><code>started</code> Boolean - Whether the upload has started. If this is false both <code>current</code> and <code>total</code> will be set to 0.</li>\n<li><code>current</code> Integer - Le nombre d'octets qui ont été téléchargés jusqu'à présent</li>\n<li><code>total</code> Integer - Le nombre d'octets qui seront chargés dans cette requête</li>\n</ul>\n<p>Vous pouvez utiliser cette méthode en conjonction avec les requêtes <code>POST</code> pour obtenir la progression d'un téléchargement de fichier ou d'un autre transfert de données.</p>",
      "title": "Classe : ClientRequest",
      "description": "Faire des requêtes HTTP/HTTPS."
    },
    "/docs/api/clipboard": {
      "locale": "fr-FR",
      "slug": "clipboard",
      "href": "/docs/api/clipboard",
      "crowdinFileId": "256291",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/clipboard.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"clipboard\"><a href=\"#clipboard\">clipboard</a></h1>\n<blockquote>\n<p>Permet d'effectuer les opérations copier et coller dans le presse-papiers.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>On Linux, there is also a <code>selection</code> clipboard. To manipulate it you need to pass <code>selection</code> to each method:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeText(<span class=\"hljs-string\">'Mon exemple'</span>, <span class=\"hljs-string\">'selection'</span>) <span class=\"hljs-built_in\">console</span>.log(clipboard.readText(<span class=\"hljs-string\">'selection'</span>))\n</code></pre>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module <code>clipboard</code> dispose des méthodes suivantes :</p>\n<p><strong>Remarque :</strong> Les APIs expérimentales sont marquées comme telles et sont susceptibles d'être supprimés à l'avenir.</p>\n<h3 id=\"clipboardreadtexttype\"><a href=\"#clipboardreadtexttype\"><code>clipboard.readText([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> n'est disponible que sur Linux.</li>\n</ul>\n<p>Retourne <code>String</code> - Le contenu du presse-papiers en tant que texte brut.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeText(<span class=\"hljs-string\">'hello i am a bit of text!'</span>)\n\n<span class=\"hljs-keyword\">const</span> text = clipboard.readText()\n<span class=\"hljs-built_in\">console</span>.log(text)\n<span class=\"hljs-comment\">// hello i am a bit of text!'</span>\n</code></pre>\n<h3 id=\"clipboardwritetexttext-type\"><a href=\"#clipboardwritetexttext-type\"><code>clipboard.writeText(text[, type])</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> n'est disponible que sur Linux.</li>\n</ul>\n<p>Écrit le <code>text</code> dans le presse-papiers au format texte brut.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> text = <span class=\"hljs-string\">'bonjour je suis un peu de texte!'</span>\nclipboard.writeText(text)\n</code></pre>\n<h3 id=\"clipboardreadhtmltype\"><a href=\"#clipboardreadhtmltype\"><code>clipboard.readHTML([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> n'est disponible que sur Linux.</li>\n</ul>\n<p>Retourne <code>String</code> - Le contenu du presse-papiers en tant que balisage.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeHTML(<span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b>'</span>)\n<span class=\"hljs-keyword\">const</span> html = clipboard.readHTML()\n\n<span class=\"hljs-built_in\">console</span>.log(html)\n<span class=\"hljs-comment\">// &#x3C;meta charset='utf-8'>&#x3C;b>Hi&#x3C;/b></span>\n</code></pre>\n<h3 id=\"clipboardwritehtmlmarkup-type\"><a href=\"#clipboardwritehtmlmarkup-type\"><code>clipboard.writeHTML(markup[, type])</code></a></h3>\n<ul>\n<li><code>markup</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> n'est disponible que sur Linux.</li>\n</ul>\n<p>Écrit le <code>markup</code> dans le presse-papiers.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeHTML(<span class=\"hljs-string\">'&#x3C;b>Bonjour&#x3C;/b'</span>)\n</code></pre>\n<h3 id=\"clipboardreadimagetype\"><a href=\"#clipboardreadimagetype\"><code>clipboard.readImage([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> n'est disponible que sur Linux.</li>\n</ul>\n<p>Retourne <a href=\"/docs/api/native-image\"><code>NativeImage</code></a> - Le contenu de l'image du presse-papiers.</p>\n<h3 id=\"clipboardwriteimageimage-type\"><a href=\"#clipboardwriteimageimage-type\"><code>clipboard.writeImage(image[, type])</code></a></h3>\n<ul>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a></li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> n'est disponible que sur Linux.</li>\n</ul>\n<p>Écrit l'<code>image</code> dans le presse-papiers.</p>\n<h3 id=\"clipboardreadrtftype\"><a href=\"#clipboardreadrtftype\"><code>clipboard.readRTF([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> n'est disponible que sur Linux.</li>\n</ul>\n<p>Retourne <code>String</code> - Le contenu presse-papiers en RTF.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeRTF(<span class=\"hljs-string\">'{\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nCeci est du texte {\\\\b bold}. \\par\\n}'</span>)\n\n<span class=\"hljs-keyword\">const</span> rtf = clipboard.readRTF()\n<span class=\"hljs-built_in\">console</span>.log(rtf)\n<span class=\"hljs-comment\">// {\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nIl s'agit de quelques {\\\\b bold} text.\\\\par\\n</span>\n</code></pre>\n<h3 id=\"clipboardwritertftext-type\"><a href=\"#clipboardwritertftext-type\"><code>clipboard.writeRTF(text[, type])</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> n'est disponible que sur Linux.</li>\n</ul>\n<p>Écrit le <code>text</code> dans le presse-papiers en RTF.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> rtf = <span class=\"hljs-string\">'{\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nCeci est un peu {\\\\b bold} text.\\\\par\\n}'</span>\nclipboard.writeRTF(rtf)\n</code></pre>\n<h3 id=\"clipboardreadbookmark-macos-windows\"><a href=\"#clipboardreadbookmark-macos-windows\"><code>clipboard.readBookmark()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Retourne <code>Object</code>:</p>\n<ul>\n<li><code>title</code> String</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Retourne un objet contenant les clés <code>title</code> et <code>url</code> représentant le marque-page du presse-papiers. La valeur des clés <code>title</code> et <code>url</code> sera une chaîne de caractères vide si le marque-page n'est pas disponible.</p>\n<h3 id=\"clipboardwritebookmarktitle-url-type-macos-windows\"><a href=\"#clipboardwritebookmarktitle-url-type-macos-windows\"><code>clipboard.writeBookmark(title, url[, type])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>title</code> String</li>\n<li><code>url</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> n'est disponible que sur Linux.</li>\n</ul>\n<p>Écrit le <code>title</code> et <code>url</code> dans le presse-papiers comme marque-page.</p>\n<p><strong>Remarque :</strong> La plupart des applications sur Windows ne supportent pas le format marque-page, du coup vous pouvez utiliser <code>clipboard.write</code> pour écrire un marque-page et un texte de secours dans le presse-papiers.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeBookmark({\n  <span class=\"hljs-attr\">text</span>: <span class=\"hljs-string\">'https://electronjs.org'</span>,\n  <span class=\"hljs-attr\">signet</span>: <span class=\"hljs-string\">'Page d'</span>accueil Electron<span class=\"hljs-string\">'\n})\n</span></code></pre>\n<h3 id=\"clipboardreadfindtext-macos\"><a href=\"#clipboardreadfindtext-macos\"><code>clipboard.readFindText()</code> <em>macOS</em></a></h3>\n<p>Retourne <code>Chaîne de caractères</code> - Le texte sur le tableau de bord, qui est le presse-papier qui contient des informations sur l'état actuel du panneau de recherche de l'application active.</p>\n<p>Cette méthode utilise un IPC synchronisé lorsqu'il est appelé depuis le processus de rendu. The cached value is reread from the find pasteboard whenever the application is activated.</p>\n<h3 id=\"clipboardwritefindtexttext-macos\"><a href=\"#clipboardwritefindtexttext-macos\"><code>clipboard.writeFindText(text)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Écrit le <code>texte</code> dans le presse-papier find (le presse-papier qui contient des informations sur l'état actuel du panneau de recherche de l'application active) en texte brut. Cette méthode utilise un IPC synchronisé lorsqu'il est appelé depuis le processus de rendu.</p>\n<h3 id=\"clipboardcleartype\"><a href=\"#clipboardcleartype\"><code>clipboard.clear([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> n'est disponible que sur Linux.</li>\n</ul>\n<p>Efface le contenu du presse-papiers.</p>\n<h3 id=\"clipboardavailableformatstype\"><a href=\"#clipboardavailableformatstype\"><code>clipboard.availableFormats([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> n'est disponible que sur Linux.</li>\n</ul>\n<p>Retourne <code>String[]</code> - Un tableau de format pris en charge pour le <code>type</code> du presse-papiers.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nformats <span class=\"hljs-keyword\">const</span> = clipboard.availableFormats()\n<span class=\"hljs-built_in\">console</span>.log(formats)\n<span class=\"hljs-comment\">// [ 'text/plain', 'text/html' ]</span>\n</code></pre>\n<h3 id=\"clipboardhasformat-type-experimental\"><a href=\"#clipboardhasformat-type-experimental\"><code>clipboard.has(format[, type])</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> n'est disponible que sur Linux.</li>\n</ul>\n<p>Retourne <code>Boolean</code> - Si le presse-papiers prend en charge le <code>format</code> spécifié.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> hasFormat = clipboard.has(<span class=\"hljs-string\">'&#x3C;p>selection&#x3C;/p>'</span>)\n<span class=\"hljs-built_in\">console</span>.log(hasFormat)\n<span class=\"hljs-comment\">// 'true' ou 'false'</span>\n</code></pre>\n<h3 id=\"clipboardreadformat-expérimental\"><a href=\"#clipboardreadformat-expérimental\"><code>clipboard.read(format)</code> <em>Expérimental</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n</ul>\n<p>Retourne <code>String</code> - Lit le type de <code>format</code> depuis le presse-papiers.</p>\n<p><code>format</code> should contain valid ASCII characters and have <code>/</code> separator. <code>a/c</code>, <code>a/bc</code> are valid formats while <code>/abc</code>, <code>abc/</code>, <code>a/</code>, <code>/a</code>, <code>a</code> are not valid.</p>\n<h3 id=\"clipboardreadbufferformat-expérimental\"><a href=\"#clipboardreadbufferformat-expérimental\"><code>clipboard.readBuffer(format)</code> <em>Expérimental</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n</ul>\n<p>Retourne un <code>Buffer</code> - Lit le type de <code>format</code> depuis le presse-papiers.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> buffer = Buffer.from(<span class=\"hljs-string\">'this is binary'</span>, <span class=\"hljs-string\">'utf8'</span>)\nclipboard.writeBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>, buffer)\n\n<span class=\"hljs-keyword\">const</span> ret = clipboard.readBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>)\n\n<span class=\"hljs-built_in\">console</span>.log(buffer.equals(out))\n<span class=\"hljs-comment\">// true</span>\n</code></pre>\n<h3 id=\"clipboardwritebufferformat-buffer-type-experimental\"><a href=\"#clipboardwritebufferformat-buffer-type-experimental\"><code>clipboard.writeBuffer(format, buffer[, type])</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n<li><code>buffer</code> Buffer</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> n'est disponible que sur Linux.</li>\n</ul>\n<p>Écrit le <code>buffer</code> dans le presse-papiers comme <code>format</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> buffer = Buffer.from(<span class=\"hljs-string\">'writeBuffer'</span>, <span class=\"hljs-string\">'utf8'</span>)\nclipboard.writeBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>, buffer)\n</code></pre>\n<h3 id=\"clipboardwritedata-type\"><a href=\"#clipboardwritedata-type\"><code>clipboard.write(data[, type])</code></a></h3>\n<ul>\n<li>Objet <code>data</code><ul>\n<li><code>text</code> String (facultatif)</li>\n<li><code>html</code> String (facultatif)</li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> (facultatif)</li>\n<li><code>rtf</code> String (facultatif)</li>\n<li><code>marque-page</code> String (facultatif) - Le titre de l'URL à <code>text</code>.</li>\n</ul></li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> n'est disponible que sur Linux.</li>\n</ul>\n<p>Écrit <code>data</code> dans le presse-papiers.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\npresse-papiers. rite({\n  <span class=\"hljs-attr\">text</span>: <span class=\"hljs-string\">'test'</span>,\n  <span class=\"hljs-attr\">html</span>: <span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b>'</span>,\n  <span class=\"hljs-attr\">rtf</span>: <span class=\"hljs-string\">'{\\\\rtf1\\\\utf8 text}'</span>,\n  marque-page : <span class=\"hljs-string\">'un titre'</span>\n})\n\n<span class=\"hljs-built_in\">console</span>. og(presse-papiers. eadText())\n<span class=\"hljs-comment\">// 'test'</span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readHTML())\n<span class=\"hljs-comment\">// &#x3C;meta charset='utf-8'>&#x3C;b>Hi&#x3C;/b></span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readRTF())\n<span class=\"hljs-comment\">// '{\\\\rtf1\\\\utf8 text}'</span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readBookmark())\n<span class=\"hljs-comment\">// { title: 'a title', url: 'test' }</span>\n</code></pre>",
      "title": "clipboard",
      "description": "Permet d'effectuer les opérations copier et coller dans le presse-papiers."
    },
    "/docs/tutorial/code-signing": {
      "locale": "fr-FR",
      "slug": "code-signing",
      "href": "/docs/tutorial/code-signing",
      "crowdinFileId": "256183",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/code-signing.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"signature-de-code\"><a href=\"#signature-de-code\">Signature de code</a></h1>\n<p>La signature de code est une technologie de sécurité que vous utilisez pour certifier qu'une application a bien été créée par vous.</p>\n<p>Sur macOS le système peut détecter tout changement apporté à l'application, qu'il s'agisse d'une modification introduite accidentellement ou par du code malicieux.</p>\n<p>Sous Windows, le système assigne un niveau de confiance à votre certificat de signature de code, les utilisateurs seront avisés par des affichages de sécurité au démarrage de votre application si vous n'en possédez pas ou si votre niveau de confiance est faible .  Le niveau de confiance s'établit au fil du temps, il est donc préférable de signer le code le plus tôt possible.</p>\n<p>Bien qu'il soit possible de distribuer des applications non signées, cela n'est pas recommandé. Windows et macOS empêcheront par défaut le téléchargement ou l'exécution d'applications non signées. À partir de macOS Catalina (version 10.15), les utilisateurs doivent passer par plusieurs étapes manuelles pour ouvrir des applications non signées.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/gatekeeper.png\" alt=\"macOS Catalina Gatekeeper warning: The app cannot be opened because the\ndeveloper cannot be verified\"></p>\n<p>Comme vous pouvez le voir, les utilisateurs ont deux options : déplacez l'application directement dans la corbeille ou annulez son exécution. Vous ne voulez pas que vos utilisateurs voient cette boîte de dialogue.</p>\n<p>Si vous développez une application Electron destinée à être empaquetée et distribuée, son code devra être signé.</p>\n<h1 id=\"signature--certification-des-versions-macos\"><a href=\"#signature--certification-des-versions-macos\">Signature &#x26; certification des versions macOS</a></h1>\n<p>Une bonne préparation des applications macOS pour la publication nécessite deux étapes : tout d'abord, l'application doit être signée. Then, the app needs to be uploaded to Apple for a process called \"notarization\", where automated systems will further verify that your app isn't doing anything to endanger its users.</p>\n<p>Pour démarrer le processus, assurez-vous que vous remplissez les conditions pour signer et certifier votre application :</p>\n<ol>\n<li>S'inscrire au <a href=\"https://developer.apple.com/programs/\">Programme de Développeurs Apple</a> (moyennant des frais annuels)</li>\n<li>Téléchargez et installez <a href=\"https://developer.apple.com/xcode\">Xcode</a> - cela nécessite un ordinateur exécutant macOS</li>\n<li>Générer, télécharger et installer <a href=\"https://github.com/electron/electron-osx-sign/wiki/1.-Getting-Started#certificates\">des certificats de signature</a></li>\n</ol>\n<p>L'écosystème d'Electron donne priorité à la configuration et a la liberté et bien sur donc il y a plusieurs moyens de signer et certifier votre application.</p>\n<h2 id=\"electron-forge\"><a href=\"#electron-forge\"><code>electron-forge</code></a></h2>\n<p>Si vous utilisez l'outil de génération d'Electron vous devrez faire quelques ajouts à votre configuration pour signer et certifier votre application. <a href=\"https://electronforge.io\">Forge</a> is a collection of the official Electron tools, using <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>, <a href=\"https://github.com/electron-userland/electron-osx-sign\"><code>electron-osx-sign</code></a>, and <a href=\"https://github.com/electron/electron-notarize\"><code>electron-notarize</code></a> under the hood.</p>\n<p>Regardons un exemple de configuration comportant tous les champs obligatoires. Not all of them are required: the tools will be clever enough to automatically find a suitable <code>identity</code>, for instance, but we recommend that you are explicit.</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"my-app\"</span>,\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.0.1\"</span>,\n  <span class=\"hljs-attr\">\"config\"</span>: {\n    <span class=\"hljs-attr\">\"forge\"</span>: {\n      <span class=\"hljs-attr\">\"packagerConfig\"</span>: {\n        <span class=\"hljs-attr\">\"osxSign\"</span>: {\n          <span class=\"hljs-attr\">\"identity\"</span>: <span class=\"hljs-string\">\"Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)\"</span>,\n          <span class=\"hljs-attr\">\"hardened-runtime\"</span>: <span class=\"hljs-literal\">true</span>,\n          <span class=\"hljs-attr\">\"entitlements\"</span>: <span class=\"hljs-string\">\"entitlements.plist\"</span>,\n          <span class=\"hljs-attr\">\"entitlements-inherit\"</span>: <span class=\"hljs-string\">\"entitlements.plist\"</span>,\n          <span class=\"hljs-attr\">\"signature-flags\"</span>: <span class=\"hljs-string\">\"library\"</span>\n        },\n        <span class=\"hljs-attr\">\"osxNotarize\"</span>: {\n          <span class=\"hljs-attr\">\"appleId\"</span>: <span class=\"hljs-string\">\"felix@felix.fun\"</span>,\n          <span class=\"hljs-attr\">\"appleIdPassword\"</span>: <span class=\"hljs-string\">\"my-apple-id-password\"</span>,\n        }\n      }\n    }\n  }\n}\n</code></pre>\n<p>Le fichier <code>plist</code> référencé ici a besoin des habilitations spécifiques à macOS suivantes pour certifier aux mécanismes de sécurité d'Apple que votre application agit sans risque :</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.allow-jit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.debugger<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>Note that up until Electron 12, the <code>com.apple.security.cs.allow-unsigned-executable-memory</code> entitlement was required as well. Cependant, il ne doit plus être utilisé s'il peut être évité.</p>\n<p>Pour voir tout cela en action, consultez le code source d'Electron Fiddle, <a href=\"https://github.com/electron/fiddle/blob/master/forge.config.js\">en particulier son fichier de configuration pour <code>electron-forge</code> </a>.</p>\n<p>Si vous prévoyez dans votre application d'accéder au microphone ou à la caméra à l'aide des API d'Electron, vous devrez également ajouter les droits suivants :</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.device.audio-input<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.device.camera<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>If these are not present in your app's entitlements when you invoke, for example:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> microphone = systemPreferences.askForMediaAccess(<span class=\"hljs-string\">'microphone'</span>)\n</code></pre>\n<p>Votre application peut planter. See the Resource Access section in <a href=\"https://developer.apple.com/documentation/security/hardened_runtime\">Hardened Runtime</a> for more information and entitlements you may need.</p>\n<h2 id=\"electron-builder\"><a href=\"#electron-builder\"><code>electron-builder</code></a></h2>\n<p>Electron Builder comes with a custom solution for signing your application. You can find <a href=\"https://www.electron.build/code-signing\">its documentation here</a>.</p>\n<h2 id=\"electron-packager\"><a href=\"#electron-packager\"><code>electron-packager</code></a></h2>\n<p>If you're not using an integrated build pipeline like Forge or Builder, you are likely using <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>, which includes <a href=\"https://github.com/electron-userland/electron-osx-sign\"><code>electron-osx-sign</code></a> and <a href=\"https://github.com/electron/electron-notarize\"><code>electron-notarize</code></a>.</p>\n<p>Si vous utilisez l'API de Packager, vous pouvez fournit une <a href=\"https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html\">configuration</a> qui signera et certifiera votre application.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> packager = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-packager'</span>)\n\npackager({\n  <span class=\"hljs-attr\">dir</span>: <span class=\"hljs-string\">'/path/to/my/app'</span>,\n  <span class=\"hljs-attr\">osxSign</span>: {\n    <span class=\"hljs-attr\">identity</span>: <span class=\"hljs-string\">'Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)'</span>,\n    <span class=\"hljs-string\">'hardened-runtime'</span>: <span class=\"hljs-literal\">true</span>,\n    <span class=\"hljs-attr\">entitlements</span>: <span class=\"hljs-string\">'entitlements.plist'</span>,\n    <span class=\"hljs-string\">'entitlements-inherit'</span>: <span class=\"hljs-string\">'entitlements.plist'</span>,\n    <span class=\"hljs-string\">'signature-flags'</span>: <span class=\"hljs-string\">'library'</span>\n  },\n  <span class=\"hljs-attr\">osxNotarize</span>: {\n    <span class=\"hljs-attr\">appleId</span>: <span class=\"hljs-string\">'felix@felix.fun'</span>,\n    <span class=\"hljs-attr\">appleIdPassword</span>: <span class=\"hljs-string\">'my-apple-id-password'</span>\n  }\n})\n</code></pre>\n<p>Le fichier <code>plist</code> référencé ici a besoin des habilitations spécifiques à macOS suivantes pour certifier aux mécanismes de sécurité d'Apple que votre application agit sans risque :</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.allow-jit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.debugger<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>Up until Electron 12, the <code>com.apple.security.cs.allow-unsigned-executable-memory</code> entitlement was required as well. Cependant, il ne doit plus être utilisé s'il peut être évité.</p>\n<h2 id=\"mac-app-store\"><a href=\"#mac-app-store\">Mac App Store</a></h2>\n<p>See the <a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store Guide</a>.</p>\n<h1 id=\"signature-des-versions-windows\"><a href=\"#signature-des-versions-windows\">Signature des versions Windows</a></h1>\n<p>Avant de signer les versions pour Windows, vous devez faire ce qui suit :</p>\n<ol>\n<li>Obtenir un certificat de signature de code d'authentification Windows (frais annuels)</li>\n<li>Installez Visual Studio pour obtenir l'utilitaire de signature ( <a href=\"https://visualstudio.microsoft.com/vs/community/\">Community Edition </a> qui est gratuite est suffisante)</li>\n</ol>\n<p>Vous pouvez obtenir un certificat de signature de code auprès de nombreux revendeurs. Les prix varient, donc il peut valoir la peine que vous compariez. Popular resellers include:</p>\n<ul>\n<li><a href=\"https://www.digicert.com/code-signing/microsoft-authenticode.htm\">digicert</a></li>\n<li><a href=\"https://sectigo.com/ssl-certificates-tls/code-signing\">Sectigo</a></li>\n<li>Et bien d'autres, veuillez comparer pour en trouver un qui correspond à vos besoins, Google est votre ami 😄</li>\n</ul>\n<p>Il existe un certain nombre d’outils pour la signature de votre application empaquetée :</p>\n<ul>\n<li><a href=\"https://github.com/electron/windows-installer\"><code>electron-winstaller</code></a> génére un installateur pour Windowq et le signe pour vous</li>\n<li><a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a> peut signer les installateurs qu'il génère à travers des cibles Squirrel.Windows ou MSI.</li>\n<li><a href=\"https://github.com/electron-userland/electron-builder\"><code>électron-builder</code></a> peut signer certaines de ses cibles Windows</li>\n</ul>\n<h2 id=\"windows-store\"><a href=\"#windows-store\">Windows Store</a></h2>\n<p>Consultez le <a href=\"/docs/tutorial/windows-store-guide\">Guide Windows Store</a>.</p>",
      "title": "Signature de code",
      "description": ""
    },
    "/docs/development/coding-style": {
      "locale": "fr-FR",
      "slug": "coding-style",
      "href": "/docs/development/coding-style",
      "crowdinFileId": "256147",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/coding-style.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"style-de-codage\"><a href=\"#style-de-codage\">Style de Codage</a></h1>\n<p>Ce sont les règles de style pour coder dans Electron.</p>\n<p>Vous pouvez exécuter <code>npm run lint</code> pour montrer tous les problèmes de style détectés par <code>cpplint</code> et <code>eslint</code>.</p>\n<h2 id=\"code-général\"><a href=\"#code-général\">Code général</a></h2>\n<ul>\n<li>Terminer les fichiers avec une ligne vide.</li>\n<li>Le positionnement est exigé dans l'ordre suivant :<ul>\n<li>Modules Node embarqués (tel que <code>path</code>)</li>\n<li>Modules Electron embarqués (tels que <code>ipc</code>, <code>app</code>)</li>\n<li>Modules locaux (utilisant des chemins relatifs)</li>\n</ul></li>\n<li>Le positionnement des classes dans l'ordre suivant :<ul>\n<li>Méthodes et propriétés de la classe (méthodes commençant par un <code>@</code>)</li>\n<li>Méthodes et propriétés d'instance</li>\n</ul></li>\n<li>Évitez le code dépendant de la plateforme :<ul>\n<li>Utilisez <code>path.join()</code> pour concaténer les noms de fichiers.</li>\n<li>Utilisez <code>os.tmpdir()</code> au lieu de <code>/tmp</code> lorsque vous devez référencer le répertoire temporaire.</li>\n</ul></li>\n<li>Using a plain <code>return</code> when returning explicitly at the end of a function.<ul>\n<li>Pas de <code>return null</code>, <code>return undefined</code>, <code>null</code> ou <code>undefined</code></li>\n</ul></li>\n</ul>\n<h2 id=\"c-et-python\"><a href=\"#c-et-python\">C++ et Python</a></h2>\n<p>Pour C++ et Python, nous suivons le <a href=\"https://chromium.googlesource.com/chromium/src/+/refs/heads/main/styleguide/styleguide.md\">Style de codage</a> de Chromium. Vous pouvez utiliser <a href=\"/docs/development/clang-format\">clang-format</a> pour formatter le code C++ automatiquement. Il y a aussi un script <code>script/cpplint.py</code> pour vérifier si tous les fichiers sont conformes.</p>\n<p>La version de Python que nous utilisons est Python 2.7.</p>\n<p>Le code C++ utilise beaucoup d’abstractions et de types de Chromium, il est donc recommandé de se familiariser avec eux. Un bon endroit pour commencer est : <a href=\"https://www.chromium.org/developers/coding-style/important-abstractions-and-data-structures\">Abstractions Importantes et Structure des Données</a> de Chromium. Le document mentionne certains types spéciaux, les types de portée limitées (qui libère automatiquement leur mémoire en allant hors de portée), mécanismes de journalisation etc.</p>\n<h2 id=\"documentation\"><a href=\"#documentation\">Documentation</a></h2>\n<ul>\n<li>Ecrivez les <a href=\"https://github.com/remarkjs/remark\">remarques</a> en markdown.</li>\n</ul>\n<p>Vous pouvez exécuter <code>npm run lint-docs</code> pour vous assurer que vos modifications de documentation sont formatés correctement.</p>\n<h2 id=\"javascript\"><a href=\"#javascript\">JavaScript</a></h2>\n<ul>\n<li>Écrire <a href=\"https://www.npmjs.com/package/standard\">standard</a> style JavaScript.</li>\n<li>Les noms des fichiers doivent être liés avec <code>–</code> au lieu de <code>_</code>, par exemple : <code>fichier-name.js</code> plutôt que <code>file_name.js</code>, parce que dans <a href=\"https://github.com/github/atom\">github/atome</a> les noms de modules sont généralement sous la forme <code>nom-du-module</code>. Cette règle s’applique uniquement aux fichiers <code>.js</code>.</li>\n<li>Utilisez la nouvelle syntaxe ES6/ES2015, le cas écheant<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const\"><code>const</code></a> pour les exigences et d'autres constantes.  Si la valeur est une primitive, utilisez un nom en majuscules (par ex. <code>const NUMBER_OF_RETRIES = 5</code>).</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let\"><code>let</code></a> pour définir des variables</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions\">Arrow functions</a> au lieu de <code>function () { }</code></li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals\">Template literals</a> au lieu de la concaténation de chaîne en utilisant <code>+</code></li>\n</ul></li>\n</ul>\n<h2 id=\"nommer-les-choses\"><a href=\"#nommer-les-choses\">Nommer les choses</a></h2>\n<p>L'API Electron utilise le même système de capitalisation que Node.js :</p>\n<ul>\n<li>Lorsque le module lui-même est une classe comme <code>BrowserWindow</code>, utilisez le <code>PascalCase</code>.</li>\n<li>Lorsque le module est un ensemble d’API, comme <code>globalShortcut</code>, utilisez le <code>camelCase</code>.</li>\n<li>Lorsque l’API est une propriété d’objet comme <code>win.webContents</code>, utilisez <code>mixedCase</code>.</li>\n<li>Pour d’autres API non-module, utilisez des titres naturels, tels que <code>&#x3C;webview>Tag</code> ou <code>Process Object</code>.</li>\n</ul>\n<p>Lorsque vous créez une nouvelle API, il est préférable d’utiliser des getters et setters au lieu du style une-fonction de jQuery. Par exemple, <code>.getText()</code> et <code>.setText(text)</code> sont préférés aux <code>.text([text])</code>. Il y a une <a href=\"https://github.com/electron/electron/issues/46\">discussion</a> là-dessus.</p>",
      "title": "Style de Codage",
      "description": ""
    },
    "/docs/api/command-line": {
      "locale": "fr-FR",
      "slug": "command-line",
      "href": "/docs/api/command-line",
      "crowdinFileId": "256295",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/command-line.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-commandline\"><a href=\"#class-commandline\">Class: CommandLine</a></h2>\n<blockquote>\n<p>Manipulate the command line arguments for your app that Chromium reads</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>L'exemple suivant montre comment vérifier si l'indicateur <code>--disable-gpu</code> est défini.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.hasSwitch(<span class=\"hljs-string\">'disable-gpu'</span>)\n</code></pre>\n<p>For more information on what kinds of flags and switches you can use, check out the <a href=\"/docs/api/command-line-switches\">Command Line Switches</a> document.</p>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<h4 id=\"commandlineappendswitchswitch-value\"><a href=\"#commandlineappendswitchswitch-value\"><code>commandLine.appendSwitch(switch[, value])</code></a></h4>\n<ul>\n<li><code>switch</code> String - A command-line switch, without the leading <code>--</code></li>\n<li><code>value</code> String (optional) - A value for the given switch</li>\n</ul>\n<p>Append a switch (with optional <code>value</code>) to Chromium's command line.</p>\n<p><strong>Note:</strong> Ceci n'affecte pas <code>process.argv</code>. The intended usage of this function is to control Chromium's behavior.</p>\n<h4 id=\"commandlineappendargumentvalue\"><a href=\"#commandlineappendargumentvalue\"><code>commandLine.appendArgument(value)</code></a></h4>\n<ul>\n<li><code>value</code> String - L'argument à ajouter à la ligne de commande</li>\n</ul>\n<p>Append an argument to Chromium's command line. The argument will be quoted correctly. Switches will precede arguments regardless of appending order.</p>\n<p>If you're appending an argument like <code>--switch=value</code>, consider using <code>appendSwitch('switch', 'value')</code> instead.</p>\n<p><strong>Note:</strong> Ceci n'affecte pas <code>process.argv</code>. The intended usage of this function is to control Chromium's behavior.</p>\n<h4 id=\"commandlinehasswitchswitch\"><a href=\"#commandlinehasswitchswitch\"><code>commandLine.hasSwitch(switch)</code></a></h4>\n<ul>\n<li><code>switch</code> String - A command-line switch</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the command-line switch is present.</p>\n<h4 id=\"commandlinegetswitchvalueswitch\"><a href=\"#commandlinegetswitchvalueswitch\"><code>commandLine.getSwitchValue(switch)</code></a></h4>\n<ul>\n<li><code>switch</code> String - A command-line switch</li>\n</ul>\n<p>Returns <code>String</code> - The command-line switch value.</p>\n<p><strong>Note:</strong> When the switch is not present or has no value, it returns empty string.</p>",
      "title": "CommandLine",
      "description": "Manipulate the command line arguments for your app that Chromium reads"
    },
    "/docs/api/command-line-switches": {
      "locale": "fr-FR",
      "slug": "command-line-switches",
      "href": "/docs/api/command-line-switches",
      "crowdinFileId": "256293",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/command-line-switches.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"commandes-supportées\"><a href=\"#commandes-supportées\">Commandes Supportées</a></h1>\n<blockquote>\n<p>Paramètres de ligne de commande pris en charge par Electron.</p>\n</blockquote>\n<p>Vous pouvez utiliser <a href=\"/docs/api/command-line#commandlineappendswitchswitch-value\">app.commandLine.appendSwitch</a> pour l'ajouter au script principal de votre application avant que l'événement <a href=\"/docs/api/app#event-ready\">ready</a> du module <a href=\"/docs/api/app\">app</a> soit émis :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'remote-debugging-port'</span>, <span class=\"hljs-string\">'8315'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'host-rules'</span>, <span class=\"hljs-string\">'MAP * 127.0.0.1'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Your code here</span>\n})\n</code></pre>\n<h2 id=\"electron-cli-flags\"><a href=\"#electron-cli-flags\">Electron CLI Flags</a></h2>\n<h3 id=\"--auth-server-whitelisturl\"><a href=\"#--auth-server-whitelisturl\">--auth-server-whitelist=<code>url</code></a></h3>\n<p>Une liste de serveurs séparés par des virgules pour lesquels l'authentification intégrée est activée.</p>\n<p>Par exemple :</p>\n<pre><code class=\"hljs language-sh\">--auth-server-whitelist=<span class=\"hljs-string\">'*example.com, *foobar.com, *baz'</span>\n</code></pre>\n<p>puis toute <code>url</code> finissant par <code>example.com</code>, <code>foobar.com</code>, <code>baz</code> se verra appliquer une authentification intégrée. Sans le préfixe <code>*</code> l'URL doit correspondre exactement.</p>\n<h3 id=\"--auth-negotiate-delegate-whitelisturl\"><a href=\"#--auth-negotiate-delegate-whitelisturl\">--auth-negotiate-delegate-whitelist=<code>url</code></a></h3>\n<p>A comma-separated list of servers for which delegation of user credentials is required. Sans le préfixe <code>*</code> l'URL doit correspondre exactement.</p>\n<h3 id=\"--disable-ntlm-v2\"><a href=\"#--disable-ntlm-v2\">--disable-ntlm-v2</a></h3>\n<p>Disables NTLM v2 for posix platforms, no effect elsewhere.</p>\n<h3 id=\"--disable-http-cache\"><a href=\"#--disable-http-cache\">--disable-http-cache</a></h3>\n<p>Désactive le cache disque pour les requêtes HTTP.</p>\n<h3 id=\"--disable-http2\"><a href=\"#--disable-http2\">--disable-http2</a></h3>\n<p>Désactive les protocoles HTTP/2 et SPDY/3.1.</p>\n<h3 id=\"--disable-renderer-backgrounding\"><a href=\"#--disable-renderer-backgrounding\">--disable-renderer-backgrounding</a></h3>\n<p>Empêche Chromium d'abaisser la priorité des processus de rendu des pages invisibles.</p>\n<p>Ce commutateur est global à tous les processus de rendu, si vous voulez seulement désactiver l'ajustement d'une fenêtre, vous pouvez passer par la modification de <a href=\"https://github.com/atom/atom/pull/9485/files\">playing silent audio</a>.</p>\n<h3 id=\"--disk-cache-sizesize\"><a href=\"#--disk-cache-sizesize\">--disk-cache-size=<code>size</code></a></h3>\n<p>Force l'espace disque maximum à utiliser par le cache disque, en octets.</p>\n<h3 id=\"--enable-api-filtering-logging\"><a href=\"#--enable-api-filtering-logging\">--enable-api-filtering-logging</a></h3>\n<p>Enables caller stack logging for the following APIs (filtering events):</p>\n<ul>\n<li><code>desktopCapturer.getSources()</code> / <code>desktop-capturer-get-sources</code></li>\n</ul>\n<h3 id=\"--enable-loggingfile\"><a href=\"#--enable-loggingfile\">--enable-logging[=file]</a></h3>\n<p>Prints Chromium's logging to stderr (or a log file).</p>\n<p>The <code>ELECTRON_ENABLE_LOGGING</code> environment variable has the same effect as passing <code>--enable-logging</code>.</p>\n<p>Passing <code>--enable-logging</code> will result in logs being printed on stderr. Passing <code>--enable-logging=file</code> will result in logs being saved to the file specified by <code>--log-file=...</code>, or to <code>electron_debug.log</code> in the user-data directory if <code>--log-file</code> is not specified.</p>\n<blockquote>\n<p><strong>Note:</strong> On Windows, logs from child processes cannot be sent to stderr. Logging to a file is the most reliable way to collect logs on Windows.</p>\n</blockquote>\n<p>See also <code>--log-file</code>, <code>--log-level</code>, <code>--v</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--force-fieldtrialstrials\"><a href=\"#--force-fieldtrialstrials\">--force-fieldtrials=<code>trials</code></a></h3>\n<p>Les essais sur le terrain doivent être activés ou désactivés de force.</p>\n<p>For example: <code>WebRTC-Audio-Red-For-Opus/Enabled/</code></p>\n<h3 id=\"--host-rulesrules\"><a href=\"#--host-rulesrules\">--host-rules=<code>rules</code></a></h3>\n<p>Une liste séparée par des virgules de <code>rules</code> qui contrôle comment les noms d'hôtes sont mappés.</p>\n<p>Par exemple :</p>\n<ul>\n<li><code>MAP * 127.0.0.1</code> Force tous les noms d'hôtes à être mappés à 127.0.0.1</li>\n<li><code>MAP *.google.com proxy</code> Force tous les sous-domaines google.com à être résolus en \"proxy\".</li>\n<li><code>MAP test.com [::1]:77</code> Forces \"test.com\" to resolve to IPv6 loopback. Will also force the port of the resulting socket address to be 77.</li>\n<li><code>MAP * baz, EXCLUDE www.google.com</code> Remappe tout à \"baz\", sauf pour \"www.google.com\".</li>\n</ul>\n<p>Ces mappages s'appliquent à l'hôte ciblé dans une requête réseau (le résolveur de connexion et d'hôte TCP dans une connexion directe, et l'hôte <code>CONNECT</code> dans une connexion avec proxy HTTP, et l'hôte du point terminal dans une connexion proxy <code>SOCKS</code>).</p>\n<h3 id=\"--host-resolver-rulesrules\"><a href=\"#--host-resolver-rulesrules\">--host-resolver-rules=<code>rules</code></a></h3>\n<p>Comme <code>--host-rules</code> mais ces <code>rules</code> ne s'appliquent qu'au résolveur hôte.</p>\n<h3 id=\"--ignore-certificate-errors\"><a href=\"#--ignore-certificate-errors\">--ignore-certificate-errors</a></h3>\n<p>Ignore les erreurs relatives au certificat.</p>\n<h3 id=\"--ignore-connections-limitdomains\"><a href=\"#--ignore-connections-limitdomains\">--ignore-connections-limit=<code>domains</code></a></h3>\n<p>Ignore la limite de connexion pour la liste de <code>domains</code> séparés par <code>,</code>.</p>\n<h3 id=\"--js-flagsflags\"><a href=\"#--js-flagsflags\">--js-flags=<code>flags</code></a></h3>\n<p>Specifies the flags passed to the Node.js engine. It has to be passed when starting Electron if you want to enable the <code>flags</code> in the main process.</p>\n<pre><code class=\"hljs language-sh\">$ electron --js-flags=<span class=\"hljs-string\">\"--harmony_proxies --harmony_collections\"</span> votre-app\n</code></pre>\n<p>Consultez la documentation <a href=\"https://nodejs.org/api/cli.html\">Node.js</a> ou exécutez <code>node --help</code> dans votre terminal pour une liste des drapeaux disponibles. De plus, exécutez <code>node --v8-options</code> pour voir une liste de drapeaux qui se réfèrent spécifiquement au moteur JavaScript V8 de Node.js.</p>\n<h3 id=\"--lang\"><a href=\"#--lang\">--lang</a></h3>\n<p>Permet de mettre une langue personnalisée.</p>\n<h3 id=\"--log-filepath\"><a href=\"#--log-filepath\">--log-file=<code>path</code></a></h3>\n<p>If <code>--enable-logging</code> is specified, logs will be written to the given path. The parent directory must exist.</p>\n<p>Setting the <code>ELECTRON_LOG_FILE</code> environment variable is equivalent to passing this flag. If both are present, the command-line switch takes precedence.</p>\n<h3 id=\"--log-net-logpath\"><a href=\"#--log-net-logpath\">--log-net-log=<code>path</code></a></h3>\n<p>Permet que les événements réseau net log soient sauvés et les écrit dans <code>path</code>.</p>\n<h3 id=\"--log-leveln\"><a href=\"#--log-leveln\">--log-level=<code>N</code></a></h3>\n<p>Sets the verbosity of logging when used together with <code>--enable-logging</code>. <code>N</code> should be one of <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h?q=logging::LogSeverity&#x26;ss=chromium\">Chrome's LogSeverities</a>.</p>\n<p>Note that two complimentary logging mechanisms in Chromium -- <code>LOG()</code> and <code>VLOG()</code> -- are controlled by different switches. <code>--log-level</code> controls <code>LOG()</code> messages, while <code>--v</code> and <code>--vmodule</code> control <code>VLOG()</code> messages. So you may want to use a combination of these three switches depending on the granularity you want and what logging calls are made by the code you're trying to watch.</p>\n<p>See <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h\">Chromium Logging source</a> for more information on how <code>LOG()</code> and <code>VLOG()</code> interact. Loosely speaking, <code>VLOG()</code> can be thought of as sub-levels / per-module levels inside <code>LOG(INFO)</code> to control the firehose of <code>LOG(INFO)</code> data.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, <code>--v</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--no-proxy-server\"><a href=\"#--no-proxy-server\">--no-proxy-server</a></h3>\n<p>N'utilisez pas de serveur proxy et établissez toujours des connexions directes. Overrides any other proxy server flags that are passed.</p>\n<h3 id=\"--no-sandbox\"><a href=\"#--no-sandbox\">--no-sandbox</a></h3>\n<p>Désactive le <a href=\"https://www.chromium.org/developers/design-documents/sandbox\">bac à sable</a> Chromium. Force le processus de rendu et les processus d'assistance Chromium à s'exécuter sans bac à sable. Ne doit être utilisé que pour les tests.</p>\n<h3 id=\"--proxy-bypass-listhosts\"><a href=\"#--proxy-bypass-listhosts\">--proxy-bypass-list=<code>hosts</code></a></h3>\n<p>Instructs Electron to bypass the proxy server for the given semi-colon-separated list of hosts. This flag has an effect only if used in tandem with <code>--proxy-server</code>.</p>\n<p>Par exemple :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'proxy-bypass-list'</span>, <span class=\"hljs-string\">'&#x3C;local>;*.google.com;*foo.com;1.2.3.4:5678'</span>)\n</code></pre>\n<p>Utilise le serveur proxy pour tous les hôtes sauf les adresses locales (<code>localhost</code>, <code>127.0.0.1</code>, etc.), les sous-domaines <code>google.com</code>, les hôtes qui contiennent le suffixe <code>foo. com</code> et tout ce qui est à <code>1.2.3.4:5678</code>.</p>\n<h3 id=\"--proxy-pac-urlurl\"><a href=\"#--proxy-pac-urlurl\">--proxy-pac-url=<code>url</code></a></h3>\n<p>Utilise le script PAC à l'<code>url</code> spécifiée.</p>\n<h3 id=\"--proxy-serveraddressport\"><a href=\"#--proxy-serveraddressport\">--proxy-server=<code>address:port</code></a></h3>\n<p>Utilise le serveur proxy spécifié, qui remplace le paramètre système. Cet indicateur n'affecte que les requêtes avec le protocole HTTP, y compris les requêtes HTTPS et WebSocket. Il est également intéressant de noter que tous les serveurs proxy ne supportent pas les requêtes HTTPS et WebSocket. L'url du proxy ne supporte pas l'authentification par nom d'utilisateur et mot de passe <a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=615947\">selon un bug Chronium</a>.</p>\n<h3 id=\"--remote-debugging-portport\"><a href=\"#--remote-debugging-portport\">--remote-debugging-port=<code>port</code></a></h3>\n<p>Active le débogage distant via HTTP sur le <code>port</code> spécifié.</p>\n<h3 id=\"--vlog_level\"><a href=\"#--vlog_level\">--v=<code>log_level</code></a></h3>\n<p>Gives the default maximal active V-logging level; 0 is the default. Normally positive values are used for V-logging levels.</p>\n<p>Ce commutateur ne fonctionne que si <code>--enable-logging</code> est également fourni.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--vmodulepattern\"><a href=\"#--vmodulepattern\">--vmodule=<code>pattern</code></a></h3>\n<p>Permet que les niveaux maximum par module de V-logging puisse dépasser la valeur donnée par <code>--v</code>. Exemple : <code>my_module=2,foo*=3</code> would change the logging level for all code in source files <code>my_module.*</code> and <code>foo*.*</code>.</p>\n<p>Tout pattern contenant un slash ou un anti-slash sera testé pour tout le chemin et pas seulement le module. Exemple : <code>*/foo/bar/*=2</code> would change the logging level for all code in the source files under a <code>foo/bar</code> directory.</p>\n<p>Ce commutateur ne fonctionne que si <code>--enable-logging</code> est également fourni.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, and <code>--v</code>.</p>\n<h3 id=\"--force_high_performance_gpu\"><a href=\"#--force_high_performance_gpu\">--force_high_performance_gpu</a></h3>\n<p>Force using discrete GPU when there are multiple GPUs available.</p>\n<h3 id=\"--force_low_power_gpu\"><a href=\"#--force_low_power_gpu\">--force_low_power_gpu</a></h3>\n<p>Force using integrated GPU when there are multiple GPUs available.</p>\n<h2 id=\"nodejs-flags\"><a href=\"#nodejs-flags\">Node.js Flags</a></h2>\n<p>Electron prend en charge certains des <a href=\"https://nodejs.org/api/cli.html\">drapeaux CLI</a> pris en charge par Node.js.</p>\n<p><strong>Remarque :</strong> Le passage d'options de ligne de commande non supportées n'aura aucun effet lorsque Electron ne s'exécute pas en mode <code>ELECTRON_RUN_AS_NODE</code>.</p>\n<h3 id=\"--inspect-brkhostport\"><a href=\"#--inspect-brkhostport\">--inspect-brk[=[host:]port]</a></h3>\n<p>Activate inspector on host:port and break at start of user script. Configuration par défaut pour host:port 127.0.0.1:9229.</p>\n<p>Aliased to <code>--debug-brk=[host:]port</code>.</p>\n<h3 id=\"--inspect-porthostport\"><a href=\"#--inspect-porthostport\">--inspect-port=[host:]port</a></h3>\n<p>Set the <code>host:port</code> to be used when the inspector is activated. Utile lors de l’activation de l’inspecteur en envoyant le signal SIGUSR1. L'hôte par défaut est <code>127.0.0.1</code>.</p>\n<p>Aliased to <code>--debug-port=[host:]port</code>.</p>\n<h3 id=\"--inspecthostport\"><a href=\"#--inspecthostport\">--inspect[=[host:]port]</a></h3>\n<p>Activate inspector on <code>host:port</code>. Par défaut la valeur est <code>127.0.0.1:9229</code>.</p>\n<p>V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug and profile Electron instances. The tools attach to Electron instances via a TCP port and communicate using the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">Chrome DevTools Protocol</a>.</p>\n<p>See the <a href=\"/docs/tutorial/debugging-main-process\">Debugging the Main Process</a> guide for more details.</p>\n<p>Aliased to <code>--debug[=[host:]port</code>.</p>\n<h3 id=\"--inspect-publish-uidstderrhttp\"><a href=\"#--inspect-publish-uidstderrhttp\">--inspect-publish-uid=stderr,http</a></h3>\n<p>Specify ways of the inspector web socket url exposure.</p>\n<p>Par défaut, l'url du websocket de l'inspecteur est disponible dans stderr et dans /json/list endpoint sur <a href=\"http://host:port/json/list\">http://host:port/json/list</a>.</p>",
      "title": "Commandes Supportées",
      "description": "Paramètres de ligne de commande pris en charge par Electron."
    },
    "/docs/api/content-tracing": {
      "locale": "fr-FR",
      "slug": "content-tracing",
      "href": "/docs/api/content-tracing",
      "crowdinFileId": "256297",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/content-tracing.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"contenttracing\"><a href=\"#contenttracing\">contentTracing</a></h1>\n<blockquote>\n<p>Collecter des données de traçage de Chromium pour trouver des goulets d'étranglement de performance et des opérations lentes.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>Ce module n'inclut pas d'interface web. Pour afficher les traces enregistrées, utilisez <a href=\"https://chromium.googlesource.com/catapult/+/HEAD/tracing/README.md\">visionneuse de traces</a>, disponible sur <code>chrome://tracing</code> dans Chrome.</p>\n<p><strong>Remarque :</strong> Vous ne devriez pas utiliser ce module tant que l'événement <code>ready</code> du module de l'application n'est pas émis.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, contentTracing } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  (<span class=\"hljs-keyword\">async</span> () => {\n    <span class=\"hljs-keyword\">await</span> contentTracing.startRecording({\n      <span class=\"hljs-attr\">included_categories</span>: [<span class=\"hljs-string\">'*'</span>]\n    })\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Tracing started'</span>)\n    <span class=\"hljs-keyword\">await</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> setTimeout(resolve, <span class=\"hljs-number\">5000</span>))\n    <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> contentTracing.stopRecording()\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Tracing data recorded to '</span> + path)\n  })()\n})\n</code></pre>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module <code>contentTracing</code> a les méthodes suivantes :</p>\n<h3 id=\"contenttracinggetcategories\"><a href=\"#contenttracinggetcategories\"><code>contentTracing.getCategories()</code></a></h3>\n<p>Retourne <code>Promise&#x3C;String[]></code> - résout avec un tableau de groupes de catégories une fois que tous les processus enfants ont reconnu la requête <code>getCategories</code></p>\n<p>Obtenir un ensemble de groupes de catégories. Les groupes de catégories peuvent changer lorsque de nouveaux chemins de code sont atteints. Voir aussi la <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">liste des catégories de traçage intégrées</a>.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Electron adds a non-default tracing category called <code>\"electron\"</code>. This category can be used to capture Electron-specific tracing events.</p>\n</blockquote>\n<h3 id=\"contenttracingstartrecordingoptions\"><a href=\"#contenttracingstartrecordingoptions\"><code>contentTracing.startRecording(options)</code></a></h3>\n<ul>\n<li><code>options</code> (<a href=\"/docs/api/structures/trace-config\">TraceConfig</a> | <a href=\"/docs/api/structures/trace-categories-and-options\">TraceCategoriesAndOptions</a>)</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;void></code> - résolu une fois que tous les processus enfants ont reconnu la requête <code>startRecording</code>.</p>\n<p>Commencez à enregistrer sur tous les processus.</p>\n<p>L'enregistrement commence immédiatement localement et de manière asynchrone sur les processus enfants dès qu'il reçoit la demande EnableRecording.</p>\n<p>Si un enregistrement est déjà en cours, la promesse sera immédiatement résolue, car seule une opération de trace peut être en cours à la fois.</p>\n<h3 id=\"contenttracingstoprecordingresultfilepath\"><a href=\"#contenttracingstoprecordingresultfilepath\"><code>contentTracing.stopRecording([resultFilePath])</code></a></h3>\n<ul>\n<li><code>resultFilePath</code> String (facultatif)</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;String></code> - résout avec un chemin vers un fichier qui contient les données tracées une fois que tous les processus enfants ont reconnu la requête <code>stopRecording</code></p>\n<p>Arrêter l'enregistrement sur tous les processus.</p>\n<p>Les processus fils mettent généralement en cache les données de trace et ne suppriment que rarement et envoient données de trace au processus principal. Cela aide à minimiser les frais d'exécution de traçage puisque l'envoi de données de traces via IPC peut être une opération coûteuse. Ainsi, pour terminer le traçage, Chromium demande asynchrone à tous les processus enfants de vider les données de traces en attente.</p>\n<p>Les données de trace seront écrites dans <code>resultFilePath</code>. Si <code>resultFilePath</code> est vide ou non fourni, les données de trace seront écrites dans un fichier temporaire, et le chemin sera retourné dans la promesse.</p>\n<h3 id=\"contenttracinggettracebufferusage\"><a href=\"#contenttracinggettracebufferusage\"><code>contentTracing.getTraceBufferUsage()</code></a></h3>\n<p>Retourne <code>Promise&#x3C;Object></code> - Résolution avec un objet contenant la <code>valeur</code> et <code>pourcentage</code> d'utilisation maximale du tampon de trace</p>\n<ul>\n<li><code>value</code> Number</li>\n<li><code>percentage</code> Number</li>\n</ul>\n<p>Récupère l'utilisation maximale sur les processus de mémoire tampon trace en pourcentage de l'état complet de .</p>",
      "title": "contentTracing",
      "description": "Collecter des données de traçage de Chromium pour trouver des goulets d'étranglement de performance et des opérations lentes."
    },
    "/docs/api/context-bridge": {
      "locale": "fr-FR",
      "slug": "context-bridge",
      "href": "/docs/api/context-bridge",
      "crowdinFileId": "256299",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/context-bridge.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"contextbridge\"><a href=\"#contextbridge\">contextBridge</a></h1>\n<blockquote>\n<p>Crée un pont synchrone sécurisé, bidirectionnel entre des contextes isolés</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>Exemple d’une API exposée à un rendu à partir d’un script de preload:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Preload (Isolated World)</span>\n<span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(\n  <span class=\"hljs-string\">'electron'</span>,\n  {\n    <span class=\"hljs-attr\">doThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.send(<span class=\"hljs-string\">'do-a-thing'</span>)\n  }\n)\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Renderer (Main World)</span>\n\n<span class=\"hljs-built_in\">window</span>.electron.doThing()\n</code></pre>\n<h2 id=\"glossaire\"><a href=\"#glossaire\">Glossaire</a></h2>\n<h3 id=\"main-world\"><a href=\"#main-world\">Main World</a></h3>\n<p>« Main World » est le contexte JavaScript dans lequel votre code de rendu principal s'exécute. Par défaut, la page que vous chargez dans votre moteur de rendu exécute son code dans cet univers.</p>\n<h3 id=\"isolated-world\"><a href=\"#isolated-world\">Isolated World</a></h3>\n<p>Votre script <code>preload</code> s'exécute dans un \"Isolated World\" lorsque <code>contextIsolation</code> est activé dans votre <code>webPreferences</code> (ce qui est le comportement par défaut depuis Electron 12.0.0).  Vous pourrez en savoir plus sur l'isolement du contexte et ce qu'il affecte dans la partie <a href=\"/docs/tutorial/security#3-enable-context-isolation-for-remote-content\">sécurité</a> de la documentation. .</p>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module <code>contextBridge</code> possède les méthodes suivantes :</p>\n<h3 id=\"contextbridgeexposeinmainworldapikey-api\"><a href=\"#contextbridgeexposeinmainworldapikey-api\"><code>contextBridge.exposeInMainWorld(apiKey, api)</code></a></h3>\n<ul>\n<li><code>apiKey</code> String - La clé à utiliser pour injecter l'API dans <code>fenêtre</code>.  L’API sera accessible par <code>window[apiKey]</code>.</li>\n<li><code>api</code> any- Votre API, plus d'informations sur ce que peut être cette API et son fonctionnement est disponible ci-dessous.</li>\n</ul>\n<h2 id=\"utilisation\"><a href=\"#utilisation\">Utilisation</a></h2>\n<h3 id=\"api\"><a href=\"#api\">API</a></h3>\n<p>L' <code>api</code> fourni à <a href=\"#contextbridgeexposeinmainworldapikey-api\"><code>exposeInMainWorld</code></a> peut être du type <code>Function</code>, <code>String</code>, <code>Number</code>, <code>Array</code>, <code>Boolean</code> ou un objet dont les clés sont des chaînes de caractères et les valeurs du type <code>Function</code>, <code>String</code>, <code>Number</code>, <code>Array</code>, <code>Boolean</code> ou un autre objet imbriqué qui remplit les mêmes conditions.</p>\n<p><code>Function</code> values are proxied to the other context and all other values are <strong>copied</strong> and <strong>frozen</strong>. Toutes les données ou primitives envoyées par l'API deviennent immuables et les mises à jour de chaque côté du pont de connexion ne donnent pas lieu à une mise à jour de l'autre côté.</p>\n<p>Exemple d’API complexe:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(\n  <span class=\"hljs-string\">'electron'</span>,\n  {\n    <span class=\"hljs-attr\">doThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.send(<span class=\"hljs-string\">'do-a-thing'</span>),\n    <span class=\"hljs-attr\">myPromises</span>: [<span class=\"hljs-built_in\">Promise</span>.resolve(), <span class=\"hljs-built_in\">Promise</span>.reject(<span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'whoops'</span>))],\n    <span class=\"hljs-attr\">anAsyncFunction</span>: <span class=\"hljs-keyword\">async</span> () => <span class=\"hljs-number\">123</span>,\n    <span class=\"hljs-attr\">data</span>: {\n      <span class=\"hljs-attr\">myFlags</span>: [<span class=\"hljs-string\">'a'</span>, <span class=\"hljs-string\">'b'</span>, <span class=\"hljs-string\">'c'</span>],\n      <span class=\"hljs-attr\">bootTime</span>: <span class=\"hljs-number\">1234</span>\n    },\n    <span class=\"hljs-attr\">nestedAPI</span>: {\n      <span class=\"hljs-attr\">evenDeeper</span>: {\n        <span class=\"hljs-attr\">youCanDoThisAsMuchAsYouWant</span>: {\n          <span class=\"hljs-attr\">fn</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ({\n            <span class=\"hljs-attr\">returnData</span>: <span class=\"hljs-number\">123</span>\n          })\n        }\n      }\n    }\n  }\n)\n</code></pre>\n<h3 id=\"api-functions\"><a href=\"#api-functions\">API Functions</a></h3>\n<p>Les valeurs <code>Function</code> que vous liez à travers le <code>contextBridge</code> sont servies par l'intermédiaire d'Electron pour s'assurer que les contextes restent isolés.  Ceci entraîne certaines limitations clés décrites ci-dessous.</p>\n<h4 id=\"prise-en-charge-des-paramètres-erreurs-et-type-de-retour\"><a href=\"#prise-en-charge-des-paramètres-erreurs-et-type-de-retour\">Prise en charge des paramètres, erreurs et type de retour</a></h4>\n<p>Étant donné que les paramètres, erreurs et valeurs de retour sont <strong>copiés</strong> lors de leur transmission par le pont, seuls certains types peuvent être utilisés. Mais si le type que vous voulez utiliser peut être sérialisé et désérialisé dans le même objet cela fonctionnera.  Une table des types supportés est incluse en complément:</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Type</th><th>Complexité</th><th>Parameter Support</th><th>Return Value Support</th><th>Limitations</th></tr></thead><tbody><tr><td><code>String</code></td><td>Simple</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Number</code></td><td>Simple</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Boolean</code></td><td>Simple</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Objet</code></td><td>Complexe</td><td>✅</td><td>✅</td><td>Keys must be supported using only \"Simple\" types in this table.  Values must be supported in this table.  Prototype modifications are dropped.  Sending custom classes will copy values but not the prototype.</td></tr><tr><td><code>Array</code></td><td>Complexe</td><td>✅</td><td>✅</td><td>Same limitations as the <code>Object</code> type</td></tr><tr><td><code>Erreur</code></td><td>Complexe</td><td>✅</td><td>✅</td><td>Errors that are thrown are also copied, this can result in the message and stack trace of the error changing slightly due to being thrown in a different context</td></tr><tr><td><code>Promise</code></td><td>Complexe</td><td>✅</td><td>✅</td><td>Promises are only proxied if they are the return value or exact parameter.  Promises nested in arrays or objects will be dropped.</td></tr><tr><td><code>Function</code></td><td>Complexe</td><td>✅</td><td>✅</td><td>Prototype modifications are dropped.  Sending classes or constructors will not work.</td></tr><tr><td><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Cloneable Types</a></td><td>Simple</td><td>✅</td><td>✅</td><td>See the linked document on cloneable types</td></tr><tr><td><code>Élément</code></td><td>Complexe</td><td>✅</td><td>✅</td><td>Prototype modifications are dropped.  L'envoi d'éléments personnalisés ne fonctionnera pas.</td></tr><tr><td><code>Objet blob</code></td><td>Complexe</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Symbole</code></td><td>N/A</td><td>❌</td><td>❌</td><td>Symbols cannot be copied across contexts so they are dropped</td></tr></tbody></table>\n<p>If the type you care about is not in the above table, it is probably not supported.</p>\n<h3 id=\"exposition-des-symboles-globaux-de-node\"><a href=\"#exposition-des-symboles-globaux-de-node\">Exposition des symboles globaux de Node</a></h3>\n<p>The <code>contextBridge</code> can be used by the preload script to give your renderer access to Node APIs. The table of supported types described above also applies to Node APIs that you expose through <code>contextBridge</code>. Please note that many Node APIs grant access to local system resources. Be very cautious about which globals and APIs you expose to untrusted remote content.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> crypto = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'crypto'</span>)\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'nodeCrypto'</span>, {\n  sha256sum (data) {\n    <span class=\"hljs-keyword\">const</span> hash = crypto.createHash(<span class=\"hljs-string\">'sha256'</span>)\n    hash.update(data)\n    <span class=\"hljs-keyword\">return</span> hash.digest(<span class=\"hljs-string\">'hex'</span>)\n  }\n})\n</code></pre>",
      "title": "contextBridge",
      "description": "Crée un pont synchrone sécurisé, bidirectionnel entre des contextes isolés"
    },
    "/docs/tutorial/context-isolation": {
      "locale": "fr-FR",
      "slug": "context-isolation",
      "href": "/docs/tutorial/context-isolation",
      "crowdinFileId": "256185",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/context-isolation.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"context-isolation\"><a href=\"#context-isolation\">Context Isolation</a></h1>\n<h2 id=\"quest-ce-que-cest-\"><a href=\"#quest-ce-que-cest-\">Qu'est-ce que c'est ?</a></h2>\n<p>L'isolement du contexte est une fonctionnalité qui garantit l'exécution dans des contextes différents de vos scripts <code>preload</code> avec la logique interne d'Electron et du site Web que vous chargez dans un <a href=\"/docs/api/web-contents\"><code>webContents</code></a>.  Ceci est important pour des raisons de sécurité car cela empêcher le site Web d'accéder aux fonctionalités d'Electron ou aux API puissantes auxquelles votre script preload accède.</p>\n<p>Cela signifie que l'objet <code>window</code> auquel votre script de préchargement a accès est un objet différent de celui auquel que le site Web a accès.  For example, if you set <code>window.hello = 'wave'</code> in your preload script and context isolation is enabled, <code>window.hello</code> will be undefined if the website tries to access it.</p>\n<p>Context isolation has been enabled by default since Electron 12, and it is a recommended security setting for <em>all applications</em>.</p>\n<h2 id=\"migration\"><a href=\"#migration\">Migration</a></h2>\n<blockquote>\n<p>Without context isolation, I used to provide APIs from my preload script using <code>window.X = apiObject</code>. Now what?</p>\n</blockquote>\n<h3 id=\"before-context-isolation-disabled\"><a href=\"#before-context-isolation-disabled\">Before: context isolation disabled</a></h3>\n<p>Exposing APIs from your preload script to a loaded website in the renderer process is a common use-case. With context isolation disabled, your preload script would share a common global <code>window</code> object with the renderer. You could then attach arbitrary properties to a preload script:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// preload with contextIsolation disabled</span>\n<span class=\"hljs-built_in\">window</span>.myAPI = {\n  <span class=\"hljs-attr\">doAThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {}\n}\n</code></pre>\n<p>The <code>doAThing()</code> function could then be used directly in the renderer process:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// use the exposed API in the renderer</span>\n<span class=\"hljs-built_in\">window</span>.myAPI.doAThing()\n</code></pre>\n<h3 id=\"after-context-isolation-enabled\"><a href=\"#after-context-isolation-enabled\">After: context isolation enabled</a></h3>\n<p>There is a dedicated module in Electron to help you do this in a painless way. The <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> module can be used to <strong>safely</strong> expose APIs from your preload script's isolated context to the context the website is running in. L'API sera également accessible depuis le site web sur <code>window.myAPI</code> comme avant.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// preload with contextIsolation enabled</span>\n<span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">doAThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {}\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// use the exposed API in the renderer</span>\n<span class=\"hljs-built_in\">window</span>.myAPI.doAThing()\n</code></pre>\n<p>Please read the <code>contextBridge</code> documentation linked above to fully understand its limitations. For instance, you can't send custom prototypes or symbols over the bridge.</p>\n<h2 id=\"security-considerations\"><a href=\"#security-considerations\">Security considerations</a></h2>\n<p>L'activation de <code>contextIsolation</code> et l'utilisation de <code>contextBridge</code> ne signifie pas automatiquement que tout ce que vous faites est sûr. For instance, this code is <strong>unsafe</strong>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// ❌ Bad code</span>\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">send</span>: ipcRenderer.send\n})\n</code></pre>\n<p>It directly exposes a powerful API without any kind of argument filtering. This would allow any website to send arbitrary IPC messages, which you do not want to be possible. The correct way to expose IPC-based APIs would instead be to provide one method per IPC message.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// ✅ Good code</span>\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">loadPreferences</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'load-prefs'</span>)\n})\n</code></pre>\n<h2 id=\"usage-with-typescript\"><a href=\"#usage-with-typescript\">Usage with TypeScript</a></h2>\n<p>If you're building your Electron app with TypeScript, you'll want to add types to your APIs exposed over the context bridge. The renderer's <code>window</code> object won't have the correct typings unless you extend the types with a <a href=\"https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html\">declaration file</a>.</p>\n<p>For example, given this <code>preload.ts</code> script:</p>\n<pre><code class=\"hljs language-typescript\">contextBridge.exposeInMainWorld(<span class=\"hljs-string\">'electronAPI'</span>, {\n  loadPreferences: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'load-prefs'</span>)\n})\n</code></pre>\n<p>You can create a <code>renderer.d.ts</code> declaration file and globally augment the <code>Window</code> interface:</p>\n<pre><code class=\"hljs language-typescript\"><span class=\"hljs-keyword\">export</span> <span class=\"hljs-keyword\">interface</span> IElectronAPI {\n  loadPreferences: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-built_in\">Promise</span>&#x3C;<span class=\"hljs-built_in\">void</span>>,\n}\n\n<span class=\"hljs-keyword\">declare</span> global {\n  <span class=\"hljs-keyword\">interface</span> Window {\n    electronAPI: IElectronAPI\n  }\n}\n</code></pre>\n<p>Doing so will ensure that the TypeScript compiler will know about the <code>electronAPI</code> property on your global <code>window</code> object when writing scripts in your renderer process:</p>\n<pre><code class=\"hljs language-typescript\"><span class=\"hljs-built_in\">window</span>.electronAPI.loadPreferences()\n</code></pre>",
      "title": "Context Isolation",
      "description": "Without context isolation, I used to provide APIs from my preload script using window.X = apiObject. Now what?"
    },
    "/docs/api/structures/cookie": {
      "locale": "fr-FR",
      "slug": "cookie",
      "href": "/docs/api/structures/cookie",
      "crowdinFileId": "256417",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/cookie.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"cookie-object\"><a href=\"#cookie-object\">Cookie Object</a></h1>\n<ul>\n<li><code>name</code> String - The name of the cookie.</li>\n<li><code>value</code> String - The value of the cookie.</li>\n<li><code>domain</code> String (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains.</li>\n<li><code>hostOnly</code> Boolean (optional) - Whether the cookie is a host-only cookie; this will only be <code>true</code> if no domain was passed.</li>\n<li><code>path</code> String (optional) - The path of the cookie.</li>\n<li><code>secure</code> Boolean (optional) - Whether the cookie is marked as secure.</li>\n<li><code>httpOnly</code> Boolean (optional) - Whether the cookie is marked as HTTP only.</li>\n<li><code>session</code> Boolean (optional) - Whether the cookie is a session cookie or a persistent cookie with an expiration date.</li>\n<li><code>expirationDate</code> Double (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies.</li>\n<li><code>sameSite</code> String - The <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies\">Same Site</a> policy applied to this cookie.  Can be <code>unspecified</code>, <code>no_restriction</code>, <code>lax</code> or <code>strict</code>.</li>\n</ul>",
      "title": "Cookie Object",
      "description": ""
    },
    "/docs/api/cookies": {
      "locale": "fr-FR",
      "slug": "cookies",
      "href": "/docs/api/cookies",
      "crowdinFileId": "256301",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/cookies.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe--cookies\"><a href=\"#classe--cookies\">Classe : Cookies</a></h2>\n<blockquote>\n<p>Interroger et modifier la session des cookies.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Les instances de la classe <code>Cookies</code> sont accessibles à l'aide de la propriété <code>cookies</code> d'une <code>Session</code>.</p>\n<p>Par exemple :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Récupère tous les cookies.</span>\nsession.defaultSession.cookies.get({})\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">cookies</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(cookies)\n  }). atch(<span class=\"hljs-function\">(<span class=\"hljs-params\">error</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(error)\n  })\n\n<span class=\"hljs-comment\">// Interroge tous les cookies associés à une Url spécifique.</span>\nsession.defaultSession.cookies.get({ <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'http://www.github.com'</span> })\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">cookies</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(cookies)\n  }). atch(<span class=\"hljs-function\">(<span class=\"hljs-params\">erreur</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>. og(error)\n  })\n\n<span class=\"hljs-comment\">// Définit un cookie avec les données de cookie spécifiées;</span>\n<span class=\"hljs-comment\">// peut écraser les cookies équivalents s'ils existent.</span>\n<span class=\"hljs-keyword\">const</span> cookie = { <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'http://www.github.com'</span>, <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'dummy_name'</span>, <span class=\"hljs-attr\">value</span>: <span class=\"hljs-string\">'dummy'</span> }\nsession.defaultSession.cookies.set(cookie)\n  . hen(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// succès</span>\n  }, (erreur) => {\n    <span class=\"hljs-built_in\">console</span>. rror(erreur)\n})\n</code></pre>\n<h3 id=\"événements-dinstance\"><a href=\"#événements-dinstance\">Événements d’instance</a></h3>\n<p>Les événements suivants sont disponibles pour les instances de <code>Cookies</code> :</p>\n<h4 id=\"événement--changed\"><a href=\"#événement--changed\">Événement : 'changed'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>cookie</code> <a href=\"/docs/api/structures/cookie\">Cookie</a> - Le cookie qui a été changé.</li>\n<li><code>cause</code> String - The cause of the change with one of the following values:<ul>\n<li><code>explicit</code> - Le cookie a été modifié directement par l'action du consommateur.</li>\n<li><code>overwrite</code> - Le cookie a été supprimé automatiquement a cause d'une insertion écrasante.</li>\n<li><code>expired</code> - Le cookie a été supprimé automatiquement par expiration.</li>\n<li><code>evicted</code> - Le cookie a été expulsée automatiquement par le ramasse-miettes.</li>\n<li><code>expired-overwrite</code> - Le cookie a été écrasé avec une date d'expiration dépassée.</li>\n</ul></li>\n<li><code>removed</code> Boolean - <code>true</code> si le cookie a été supprimé, <code>false</code> autrement.</li>\n</ul>\n<p>Émis lorsqu’un cookie a été changé car il a été ajouté, édité, enlevé ou a expiré.</p>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<p>Les méthodes suivants sont disponibles pour les instances de <code>Cookies</code> :</p>\n<h4 id=\"cookiesgetfilter\"><a href=\"#cookiesgetfilter\"><code>cookies.get(filter)</code></a></h4>\n<ul>\n<li>Objet <code>filter</code><ul>\n<li><code>url</code> String (optional) - Retrieves cookies which are associated with <code>url</code>. Empty implies retrieving cookies of all URLs.</li>\n<li><code>name</code> String (facultatif) - Filtre les cookies par nom.</li>\n<li><code>domain</code> String (facultatif) - Récupère les cookies dont les domaines correspondent ou sont des sous-domaines de <code>domains</code>.</li>\n<li><code>path</code> String (facultatif) - Récupère les cookies dont le chemin correspond à <code>path</code>.</li>\n<li><code>secure</code> Boolean (facultatif) - Filtre les cookies par leur propriété de sécuritée.</li>\n<li><code>session</code> Boolean (facultatif) - filtre les session ou les cookies persistants.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Promise&#x3C;Cookie[]></code> - Une promesse qui résout un tableau d'objets de cookies.</p>\n<p>Envoie une demande pour obtenir tous les cookies correspondant à <code>filter</code>, et résout une promesse avec la réponse.</p>\n<h4 id=\"cookiessetdétails\"><a href=\"#cookiessetdétails\"><code>cookies.set(détails)</code></a></h4>\n<ul>\n<li>Objet <code>details</code><ul>\n<li><code>url</code> String - The URL to associate the cookie with. The promise will be rejected if the URL is invalid.</li>\n<li><code>name</code> String (optional) - The name of the cookie. Empty by default if omitted.</li>\n<li><code>value</code> String (optional) - The value of the cookie. Empty by default if omitted.</li>\n<li><code>domain</code> String (facultatif) - Le nom de domaine du cookie; ce dernier sera normalisé par un point le précédent pour qu'il soit valide pour les sous-domaines. Empty by default if omitted.</li>\n<li><code>path</code> String (facultatif) - Le chemin du cookie. Empty by default if omitted.</li>\n<li><code>secure</code> Boolean (optional) - Whether the cookie should be marked as Secure. Defaults to false unless <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite#samesitenone_requires_secure\">Same Site=None</a> attribute is used.</li>\n<li><code>httpOnly</code> Boolean (optional) - Whether the cookie should be marked as HTTP only. Par défaut, faux.</li>\n<li><code>expirationDate</code> Double (facultatif) - La date d'expiration du cookie en nombre de secondes depuis l'epoch UNIX. Si omis, le cookie devient alors un cookie de session et ne sera pas conservé entre deux sessions.</li>\n<li><code>sameSite</code> String (optional) - The <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies\">Same Site</a> policy to apply to this cookie.  Peut être <code>unspecified</code>, <code>no_restriction</code>, <code>lax</code> ou <code>strict</code>.  Par défaut la valeur est <code>no_restriction</code>.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Promise&#x3C;void></code> - Une promesse qui résout lorsque le cookie a été défini</p>\n<p>Définit un cookie avec <code>détails</code>.</p>\n<h4 id=\"cookiesremoveurl-nom\"><a href=\"#cookiesremoveurl-nom\"><code>cookies.remove(url, nom)</code></a></h4>\n<ul>\n<li><code>url</code> String - L'url associée au cookie.</li>\n<li><code>name</code> String - Le nom du cookie à supprimer.</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;void></code> - Une promesse qui résout lorsque le cookie a été supprimé</p>\n<p>Supprime les cookies correspondant à <code>url</code> et <code>name</code></p>\n<h4 id=\"cookiesflushstore\"><a href=\"#cookiesflushstore\"><code>cookies.flushStore()</code></a></h4>\n<p>Retourne <code>Promise&#x3C;void></code> - Une promesse qui résout lorsque la boutique de cookies a été vidée</p>\n<p>Écrit toutes les données des cookies non écrites sur le disque.</p>",
      "title": "Classe : Cookies",
      "description": "Interroger et modifier la session des cookies."
    },
    "/docs/api/structures/cpu-usage": {
      "locale": "fr-FR",
      "slug": "cpu-usage",
      "href": "/docs/api/structures/cpu-usage",
      "crowdinFileId": "256419",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/cpu-usage.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"cpuusage-object\"><a href=\"#cpuusage-object\">CPUUsage Object</a></h1>\n<ul>\n<li><code>percentCPUUsage</code> Number - Percentage of CPU used since the last call to getCPUUsage. First call returns 0.</li>\n<li><code>idleWakeupsPerSecond</code> Number - The number of average idle CPU wakeups per second since the last call to getCPUUsage. First call returns 0. Will always return 0 on Windows.</li>\n</ul>",
      "title": "CPUUsage Object",
      "description": ""
    },
    "/docs/api/structures/crash-report": {
      "locale": "fr-FR",
      "slug": "crash-report",
      "href": "/docs/api/structures/crash-report",
      "crowdinFileId": "256421",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/crash-report.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"crashreport-object\"><a href=\"#crashreport-object\">CrashReport Object</a></h1>\n<ul>\n<li><code>date</code> Date</li>\n<li><code>id</code> String</li>\n</ul>",
      "title": "CrashReport Object",
      "description": ""
    },
    "/docs/api/crash-reporter": {
      "locale": "fr-FR",
      "slug": "crash-reporter",
      "href": "/docs/api/crash-reporter",
      "crowdinFileId": "256303",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/crash-reporter.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"crashreporter\"><a href=\"#crashreporter\">crashReporter</a></h1>\n<blockquote>\n<p>Soumet un rapport de plantage à un serveur distant.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>The following is an example of setting up Electron to automatically submit crash reports to a remote server:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { crashReporter } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncrashReporter.start({ <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://your-domain.com/url-to-submit'</span> })\n</code></pre>\n<p>Pour configurer un serveur pour accepter et traiter les rapports de plantage, vous pouvez utiliser les projets suivants :</p>\n<ul>\n<li><a href=\"https://github.com/mozilla/socorro\">socorro</a></li>\n<li><a href=\"https://github.com/electron/mini-breakpad-server\">mini-breakpad-server</a></li>\n</ul>\n<p>Ou utilisez une solution hébergée par un tiers :</p>\n<ul>\n<li><a href=\"https://backtrace.io/electron/\">Trace d'appels</a></li>\n<li><a href=\"https://docs.sentry.io/clients/electron\">Sentinelle</a></li>\n<li><a href=\"https://www.bugsplat.com/docs/platforms/electron\">BugSplat</a></li>\n</ul>\n<p>Crash reports are stored temporarily before being uploaded in a directory underneath the app's user data directory (called 'Crashpad' on Windows and Mac, or 'Crash Reports' on Linux). You can override this directory by calling <code>app.setPath('crashDumps', '/path/to/crashes')</code> before starting the crash reporter.</p>\n<p>On Windows and macOS, Electron uses <a href=\"https://chromium.googlesource.com/crashpad/crashpad/+/master/README.md\">crashpad</a> to monitor and report crashes. Sous Linux, Electron utilise <a href=\"https://chromium.googlesource.com/breakpad/breakpad/+/master/\">breakpad</a>. This is an implementation detail driven by Chromium, and it may change in future. In particular, crashpad is newer and will likely eventually replace breakpad on all platforms.</p>\n<h3 id=\"note-about-node-child-processes-on-linux\"><a href=\"#note-about-node-child-processes-on-linux\">Note about Node child processes on Linux</a></h3>\n<p>If you are using the Node.js <code>child_process</code> module and want to report crashes from those processes on Linux, there is an extra step you will need to take to properly initialize the crash reporter in the child process. This is not necessary on Mac or Windows, as those platforms use Crashpad, which automatically monitors child processes.</p>\n<p>Since <code>require('electron')</code> is not available in Node child processes, the following APIs are available on the <code>process</code> object in Node child processes. Note that, on Linux, each Node child process has its own separate instance of the breakpad crash reporter. This is dissimilar to renderer child processes, which have a \"stub\" breakpad reporter which returns information to the main process for reporting.</p>\n<h4 id=\"processcrashreporterstartoptions\"><a href=\"#processcrashreporterstartoptions\"><code>process.crashReporter.start(options)</code></a></h4>\n<p>See <a href=\"#crashreporterstartoptions\"><code>crashReporter.start()</code></a>.</p>\n<h4 id=\"processcrashreportergetparameters\"><a href=\"#processcrashreportergetparameters\"><code>process.crashReporter.getParameters()</code></a></h4>\n<p>See <a href=\"#crashreportergetparameters\"><code>crashReporter.getParameters()</code></a>.</p>\n<h4 id=\"processcrashreporteraddextraparameterkey-value\"><a href=\"#processcrashreporteraddextraparameterkey-value\"><code>process.crashReporter.addExtraParameter(key, value)</code></a></h4>\n<p>See <a href=\"#crashreporteraddextraparameterkey-value\"><code>crashReporter.addExtraParameter(key, value)</code></a>.</p>\n<h4 id=\"processcrashreporterremoveextraparameterkey\"><a href=\"#processcrashreporterremoveextraparameterkey\"><code>process.crashReporter.removeExtraParameter(key)</code></a></h4>\n<p>See <a href=\"#crashreporterremoveextraparameterkey\"><code>crashReporter.removeExtraParameter(key)</code></a>.</p>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module <code>crashReporter</code> dispose des méthodes suivantes :</p>\n<h3 id=\"crashreporterstartoptions\"><a href=\"#crashreporterstartoptions\"><code>crashReporter.start(options)</code></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>submitURL</code> String (optional) - URL that crash reports will be sent to as POST. Required unless <code>uploadToServer</code> is <code>false</code>.</li>\n<li><code>productName</code> String (facultatif) - <code>app.name</code>.</li>\n<li><code>companyName</code> String (optional) <em>Deprecated</em> - Deprecated alias for <code>{ globalExtra: { _companyName: ... } }</code>.</li>\n<li><code>uploadToServer</code> Boolean (optional) - Whether crash reports should be sent to the server. If false, crash reports will be collected and stored in the crashes directory, but not uploaded. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>ignoreSystemCrashHandler</code> Boolean (optional) - If true, crashes generated in the main process will not be forwarded to the system crash handler. Par défaut la valeur est <code>false</code>.</li>\n<li><code>rateLimit</code> Boolean (optional) <em>macOS</em> <em>Windows</em> - If true, limit the number of crashes uploaded to 1/hour. Par défaut la valeur est <code>false</code>.</li>\n<li><code>compress</code> Boolean (optional) - If true, crash reports will be compressed and uploaded with <code>Content-Encoding: gzip</code>. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>extra</code> Record&#x3C;String, String> (optional) - Extra string key/value annotations that will be sent along with crash reports that are generated in the main process. Only string values are supported. Crashes generated in child processes will not contain these extra parameters to crash reports generated from child processes, call <a href=\"#crashreporteraddextraparameterkey-value\"><code>addExtraParameter</code></a> from the child process.</li>\n<li><code>globalExtra</code> Record&#x3C;String, String> (optional) - Extra string key/value annotations that will be sent along with any crash reports generated in any process. These annotations cannot be changed once the crash reporter has been started. If a key is present in both the global extra parameters and the process-specific extra parameters, then the global one will take precedence. By default, <code>productName</code> and the app version are included, as well as the Electron version.</li>\n</ul></li>\n</ul>\n<p>This method must be called before using any other <code>crashReporter</code> APIs. Once initialized this way, the crashpad handler collects crashes from all subsequently created processes. The crash reporter cannot be disabled once started.</p>\n<p>This method should be called as early as possible in app startup, preferably before <code>app.on('ready')</code>. If the crash reporter is not initialized at the time a renderer process is created, then that renderer process will not be monitored by the crash reporter.</p>\n<p><strong>Note:</strong> You can test out the crash reporter by generating a crash using <code>process.crash()</code>.</p>\n<p><strong>Note:</strong> If you need to send additional/updated <code>extra</code> parameters after your first call <code>start</code> you can call <code>addExtraParameter</code>.</p>\n<p><strong>Note:</strong> Parameters passed in <code>extra</code>, <code>globalExtra</code> or set with <code>addExtraParameter</code> have limits on the length of the keys and values. Key names must be at most 39 bytes long, and values must be no longer than 127 bytes. Keys with names longer than the maximum will be silently ignored. Key values longer than the maximum length will be truncated.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportergetlastcrashreport\"><a href=\"#crashreportergetlastcrashreport\"><code>crashReporter.getLastCrashReport()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/crash-report\"><code>CrashReport</code></a> - The date and ID of the last crash report. Only crash reports that have been uploaded will be returned; even if a crash report is present on disk it will not be returned until it is uploaded. Dans le cas où il n'y a pas de rapports téléchargés, <code>null</code> est retourné.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportergetuploadedreports\"><a href=\"#crashreportergetuploadedreports\"><code>crashReporter.getUploadedReports()</code></a></h3>\n<p>Retourne <a href=\"/docs/api/structures/crash-report\"><code>CrashReport[]</code></a> :</p>\n<p>Returns all uploaded crash reports. Each report contains the date and uploaded ID.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportergetuploadtoserver\"><a href=\"#crashreportergetuploadtoserver\"><code>crashReporter.getUploadToServer()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether reports should be submitted to the server. Set through the <code>start</code> method or <code>setUploadToServer</code>.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportersetuploadtoserveruploadtoserver\"><a href=\"#crashreportersetuploadtoserveruploadtoserver\"><code>crashReporter.setUploadToServer(uploadToServer)</code></a></h3>\n<ul>\n<li><code>uploadToServer</code> Boolean - Whether reports should be submitted to the server.</li>\n</ul>\n<p>This would normally be controlled by user preferences. This has no effect if called before <code>start</code> is called.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreporteraddextraparameterkey-value\"><a href=\"#crashreporteraddextraparameterkey-value\"><code>crashReporter.addExtraParameter(key, value)</code></a></h3>\n<ul>\n<li><code>key</code> String - Parameter key, must be no longer than 39 bytes.</li>\n<li><code>value</code> String - Parameter value, must be no longer than 127 bytes.</li>\n</ul>\n<p>Définit un paramètre supplémentaire à envoyer avec le rapport de plantage. The values specified here will be sent in addition to any values set via the <code>extra</code> option when <code>start</code> was called.</p>\n<p>Parameters added in this fashion (or via the <code>extra</code> parameter to <code>crashReporter.start</code>) are specific to the calling process. Adding extra parameters in the main process will not cause those parameters to be sent along with crashes from renderer or other child processes. Similarly, adding extra parameters in a renderer process will not result in those parameters being sent with crashes that occur in other renderer processes or in the main process.</p>\n<p><strong>Note:</strong> Parameters have limits on the length of the keys and values. Key names must be no longer than 39 bytes, and values must be no longer than 20320 bytes. Keys with names longer than the maximum will be silently ignored. Key values longer than the maximum length will be truncated.</p>\n<p><strong>Note:</strong> On linux values that are longer than 127 bytes will be chunked into multiple keys, each 127 bytes in length.  Exemple : <code>addExtraParameter('foo', 'a'.repeat(130))</code> will result in two chunked keys <code>foo__1</code> and <code>foo__2</code>, the first will contain the first 127 bytes and the second will contain the remaining 3 bytes.  On your crash reporting backend you should stitch together keys in this format.</p>\n<h3 id=\"crashreporterremoveextraparameterkey\"><a href=\"#crashreporterremoveextraparameterkey\"><code>crashReporter.removeExtraParameter(key)</code></a></h3>\n<ul>\n<li><code>key</code> String - Parameter key, must be no longer than 39 bytes.</li>\n</ul>\n<p>Remove an extra parameter from the current set of parameters. Future crashes will not include this parameter.</p>\n<h3 id=\"crashreportergetparameters\"><a href=\"#crashreportergetparameters\"><code>crashReporter.getParameters()</code></a></h3>\n<p>Returns <code>Record&#x3C;String, String></code> - The current 'extra' parameters of the crash reporter.</p>\n<h2 id=\"payload-du-crash-report\"><a href=\"#payload-du-crash-report\">Payload du Crash Report</a></h2>\n<p>Le rapporteur de plantage enverra les données suivantes à <code>submitURL</code> comme un <code>POST</code> en <code>multipart/form-data</code> :</p>\n<ul>\n<li><code>ver</code> String - La version d'Electron.</li>\n<li><code>platform</code> String - Par exemple 'win32'.</li>\n<li><code>process_type</code> String - Par exemple 'renderer'.</li>\n<li><code>guid</code> String - Par exemple '5e1286fc-da97-479e-918b-6bfb0c3d1c72'.</li>\n<li><code>_version</code> String - La version dans <code>package.json</code>.</li>\n<li><code>_productName</code> String - Le nom du produit dans l'objet <code>options</code> de <code>crashReporter</code>.</li>\n<li><code>prod</code> String - Name of the underlying product. In this case Electron.</li>\n<li><code>_companyName</code> String - Le nom de l'entreprise dans l'objet <code>options</code> de <code>crashReporter</code>.</li>\n<li><code>upload_file_minidump</code> File - Le rapport d'incident dans le format <code>minidump</code>.</li>\n<li>Toutes les propriétés de niveau 1 de l'objet <code>extra</code> dans l'objet <code>options</code> de <code>crashReporter</code>.</li>\n</ul>",
      "title": "crashReporter",
      "description": "Soumet un rapport de plantage à un serveur distant."
    },
    "/docs/api/structures/custom-scheme": {
      "locale": "fr-FR",
      "slug": "custom-scheme",
      "href": "/docs/api/structures/custom-scheme",
      "crowdinFileId": "256423",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/custom-scheme.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"customscheme-object\"><a href=\"#customscheme-object\">CustomScheme Object</a></h1>\n<ul>\n<li><code>scheme</code> String - Custom schemes to be registered with options.</li>\n<li><code>privileges</code> Object (optional)<ul>\n<li><code>standard</code> Boolean (optional) - Default false.</li>\n<li><code>secure</code> Boolean (optional) - Default false.</li>\n<li><code>bypassCSP</code> Boolean (optional) - Default false.</li>\n<li><code>allowServiceWorkers</code> Boolean (optional) - Default false.</li>\n<li><code>supportFetchAPI</code> Boolean (optional) - Default false.</li>\n<li><code>corsEnabled</code> Boolean (optional) - Default false.</li>\n<li><code>stream</code> Boolean (optional) - Default false.</li>\n</ul></li>\n</ul>",
      "title": "CustomScheme Object",
      "description": ""
    },
    "/docs/tutorial/dark-mode": {
      "locale": "fr-FR",
      "slug": "dark-mode",
      "href": "/docs/tutorial/dark-mode",
      "crowdinFileId": "256187",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/dark-mode.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"thème-sombre\"><a href=\"#thème-sombre\">Thème Sombre</a></h1>\n<h2 id=\"vue-densemble\"><a href=\"#vue-densemble\">Vue d'ensemble</a></h2>\n<h3 id=\"automatically-update-the-native-interfaces\"><a href=\"#automatically-update-the-native-interfaces\">Automatically update the native interfaces</a></h3>\n<p>\"Native interfaces\" include the file picker, window border, dialogs, context menus, and more - anything where the UI comes from your operating system and not from your app. The default behavior is to opt into this automatic theming from the OS.</p>\n<h3 id=\"automatically-update-your-own-interfaces\"><a href=\"#automatically-update-your-own-interfaces\">Automatically update your own interfaces</a></h3>\n<p>If your app has its own dark mode, you should toggle it on and off in sync with the system's dark mode setting. You can do this by using the [prefer-color-scheme] CSS media query.</p>\n<h3 id=\"manually-update-your-own-interfaces\"><a href=\"#manually-update-your-own-interfaces\">Manually update your own interfaces</a></h3>\n<p>If you want to manually switch between light/dark modes, you can do this by setting the desired mode in the <a href=\"/docs/api/native-theme#nativethemethemesource\">themeSource</a> property of the <code>nativeTheme</code> module. This property's value will be propagated to your Renderer process. Any CSS rules related to <code>prefers-color-scheme</code> will be updated accordingly.</p>\n<h2 id=\"paramètres-macos\"><a href=\"#paramètres-macos\">paramètres macOS</a></h2>\n<p>In macOS 10.14 Mojave, Apple introduced a new <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/dark-mode/\">system-wide dark mode</a> for all macOS computers. If your Electron app has a dark mode, you can make it follow the system-wide dark mode setting using <a href=\"/docs/api/native-theme\">the <code>nativeTheme</code> api</a>.</p>\n<p>In macOS 10.15 Catalina, Apple introduced a new \"automatic\" dark mode option for all macOS computers. In order for the <code>nativeTheme.shouldUseDarkColors</code> and <code>Tray</code> APIs to work correctly in this mode on Catalina, you need to use Electron <code>>=7.0.0</code>, or set <code>NSRequiresAquaSystemAppearance</code> to <code>false</code> in your <code>Info.plist</code> file for older versions. <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a> et <a href=\"https://www.electronforge.io/\">Electron Forge</a> ont une option <a href=\"https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html#darwindarkmodesupport\"><code>darwinDarkModeSupport</code></a> pour automatiser les infos <code>Info.plist</code> modifications pendant la compilation de l'application.</p>\n<p>If you wish to opt-out while using Electron > 8.0.0, you must set the <code>NSRequiresAquaSystemAppearance</code> key in the <code>Info.plist</code> file to <code>true</code>. Please note that Electron 8.0.0 and above will not let you opt-out of this theming, due to the use of the macOS 10.14 SDK.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<p>This example demonstrates an Electron application that derives its theme colors from the <code>nativeTheme</code>. Additionally, it provides theme toggle and reset controls using IPC channels.</p>\n<h3 id=\"comment-cela-fonctionne-\"><a href=\"#comment-cela-fonctionne-\">Comment cela fonctionne ?</a></h3>\n<p>Starting with the <code>index.html</code> file:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"script-src 'self' 'unsafe-inline';\"</span> /></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/css\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"./styles.css\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">p</span>></span>Current theme source: <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">strong</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"theme-source\"</span>></span>System<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">strong</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">p</span>></span>\n\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"toggle-dark-mode\"</span>></span>Toggle Dark Mode<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">button</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"reset-to-system\"</span>></span>Reset to System Theme<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">button</span>></span>\n\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>Et le fichier <code>styles.css</code>:</p>\n<pre><code class=\"hljs language-css\">@<span class=\"hljs-keyword\">media</span> (prefers-color-scheme: dark) {\n  <span class=\"hljs-selector-tag\">body</span> { <span class=\"hljs-attribute\">background</span>: <span class=\"hljs-number\">#333</span>; <span class=\"hljs-attribute\">color</span>: white; }\n}\n\n@<span class=\"hljs-keyword\">media</span> (prefers-color-scheme: light) {\n  <span class=\"hljs-selector-tag\">body</span> { <span class=\"hljs-attribute\">background</span>: <span class=\"hljs-number\">#ddd</span>; <span class=\"hljs-attribute\">color</span>: black; }\n}\n</code></pre>\n<p>L'exemple produit une page HTML avec quelques éléments. The <code>&#x3C;strong id=\"theme-source\"></code> element shows which theme is currently selected, and the two <code>&#x3C;button></code> elements are the controls. The CSS file uses the <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> media query to set the <code>&#x3C;body></code> element background and text colors.</p>\n<p>The <code>preload.js</code> script adds a new API to the <code>window</code> object called <code>darkMode</code>. This API exposes two IPC channels to the renderer process, <code>'dark-mode:toggle'</code> and <code>'dark-mode:system'</code>. It also assigns two methods, <code>toggle</code> and <code>system</code>, which pass messages from the renderer to the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'darkMode'</span>, {\n  <span class=\"hljs-attr\">toggle</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'dark-mode:toggle'</span>),\n  <span class=\"hljs-attr\">system</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'dark-mode:system'</span>)\n})\n</code></pre>\n<p>Now the renderer process can communicate with the main process securely and perform the necessary mutations to the <code>nativeTheme</code> object.</p>\n<p>The <code>renderer.js</code> file is responsible for controlling the <code>&#x3C;button></code> functionality.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'toggle-dark-mode'</span>).addEventListener(<span class=\"hljs-string\">'click'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> isDarkMode = <span class=\"hljs-keyword\">await</span> <span class=\"hljs-built_in\">window</span>.darkMode.toggle()\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'theme-source'</span>).innerHTML = isDarkMode ? <span class=\"hljs-string\">'Dark'</span> : <span class=\"hljs-string\">'Light'</span>\n})\n\n<span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'reset-to-system'</span>).addEventListener(<span class=\"hljs-string\">'click'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> <span class=\"hljs-built_in\">window</span>.darkMode.system()\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'theme-source'</span>).innerHTML = <span class=\"hljs-string\">'System'</span>\n})\n</code></pre>\n<p>Using <code>addEventListener</code>, the <code>renderer.js</code> file adds <code>'click'</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\">event listeners</a> to each button element. Each event listener handler makes calls to the respective <code>window.darkMode</code> API methods.</p>\n<p>Finally, the <code>main.js</code> file represents the main process and contains the actual <code>nativeTheme</code> API.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, ipcMain, nativeTheme } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  ipcMain.handle(<span class=\"hljs-string\">'dark-mode:toggle'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (nativeTheme.shouldUseDarkColors) {\n      nativeTheme.themeSource = <span class=\"hljs-string\">'light'</span>\n    } <span class=\"hljs-keyword\">else</span> {\n      nativeTheme.themeSource = <span class=\"hljs-string\">'dark'</span>\n    }\n    <span class=\"hljs-keyword\">return</span> nativeTheme.shouldUseDarkColors\n  })\n\n  ipcMain.handle(<span class=\"hljs-string\">'dark-mode:system'</span>, () => {\n    nativeTheme.themeSource = <span class=\"hljs-string\">'system'</span>\n  })\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span> , () => {\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n      createWindow()\n    }\n  })\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n</code></pre>\n<p>The <code>ipcMain.handle</code> methods are how the main process responds to the click events from the buttons on the HTML page.</p>\n<p>The <code>'dark-mode:toggle'</code> IPC channel handler method checks the <code>shouldUseDarkColors</code> boolean property, sets the corresponding <code>themeSource</code>, and then returns the current <code>shouldUseDarkColors</code> property. Looking back on the renderer process event listener for this IPC channel, the return value from this handler is utilized to assign the correct text to the <code>&#x3C;strong id='theme-source'></code> element.</p>\n<p>The <code>'dark-mode:system'</code> IPC channel handler method assigns the string <code>'system'</code> to the <code>themeSource</code> and returns nothing. This also corresponds with the relative renderer process event listener as the method is awaited with no return value expected.</p>\n<p>Run the example using Electron Fiddle and then click the \"Toggle Dark Mode\" button; the app should start alternating between a light and dark background color.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/dark_mode.gif\" alt=\"Thème Sombre\"></p>",
      "title": "Thème Sombre",
      "description": ""
    },
    "/docs/development/debug-instructions-windows": {
      "locale": "fr-FR",
      "slug": "debug-instructions-windows",
      "href": "/docs/development/debug-instructions-windows",
      "crowdinFileId": "256149",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debug-instructions-windows.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"débogage-sur-windows\"><a href=\"#débogage-sur-windows\">Débogage sur Windows</a></h1>\n<p>Si vous rencontrez des crash ou des problèmes dans Electron et que vous croyez qu'il ne viennent pas de votre app JavaScript, mais plutôt d'Electron lui-même, alors le débogage peut être un peu difficile, surtout pour les développeurs peu expérimentés pour le débogage natif/C++. However, using Visual Studio, Electron's hosted Symbol Server, and the Electron source code, you can enable step-through debugging with breakpoints inside Electron's source code.</p>\n<p><strong>Voir aussi</strong> : Il y a une richesse d'information sur le débogage de Chronium, la plupart s'appliquant aussi pour Electron, sur le site developpeur de Chronium : <a href=\"https://www.chromium.org/developers/how-tos/debugging-on-windows\">Debugging Chromium on Windows</a>.</p>\n<h2 id=\"spécifications-requises\"><a href=\"#spécifications-requises\">Spécifications requises</a></h2>\n<ul>\n<li>\n<p><strong>Un debug build d'Electron</strong> : le moyen le plus simple est généralement de le compiler vous-même, en utilisant les outils et prérequis énumérées dans les <a href=\"/docs/development/build-instructions-windows\">instructions de compilation pour Windows</a>. Tandis que vous pouvez facilement déboguer Electron puisque vous pouvez le télécharger directement, vous trouverez qu’il est fortement optimisé, ce qui rend le débogage sensiblement plus difficile : le débogueur ne sera pas en mesure de vous montrer le contenu de toutes les variables et le chemin d’exécution peut sembler étrange à cause de l’inlining, liste des appels qui s’enchaînent et d'autres optimisations du compilateur.</p>\n</li>\n<li>\n<p><strong>Outils Visual Studio C++</strong> : les éditions de la communauté gratuite de Visual Studio 2013 et Visual Studio 2015 fonctionnent tous les deux. Once installed, <a href=\"/docs/development/setting-up-symbol-server\">configure Visual Studio to use Electron's Symbol server</a>. Il permettra à Visual Studio d’acquérir une meilleure compréhension de ce qui se passe à l’intérieur d'Electron, rendant plus facile l'affichage des variables dans un format lisible par l’homme.</p>\n</li>\n<li>\n<p><strong>ProcMon</strong> : l'<a href=\"https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx\">outil gratuit de SysInternals</a> vous permet d’inspecter un paramètres de processus, gère les fichiers et les opérations de registre.</p>\n</li>\n</ul>\n<h2 id=\"débogage-delectron\"><a href=\"#débogage-delectron\">Débogage d'Electron</a></h2>\n<p>Pour démarrer une session de débogage, ouvrez PowerShell/CMD et exécutez votre version debug d'Electron, utilisant votre application comme paramètre.</p>\n<pre><code class=\"hljs language-powershell\">$ ./out/Testing/electron.exe ~/my-electron-app/\n</code></pre>\n<h3 id=\"définition-de-points-darrêt\"><a href=\"#définition-de-points-darrêt\">Définition de points d’arrêt</a></h3>\n<p>Vous pouvez ouvrir Visual Studio. Electron n’est pas compilé avec Visual Studio et par conséquent ne contient pas de fichier de projet - vous pouvez cependant ouvrir les fichiers de code source « Comme fichier », ce qui signifie que Visual Studio va les ouvrir par eux-mêmes. Vous pouvez quand même définir des points d’arrêt - Visual Studio cherchera automatiquement le code source correspond au code qui s’exécute dans le processus attaché et le stopper en conséquence.</p>\n<p>Les fichiers de code pertinents peuvent être trouvés dans <code>./shell/</code>.</p>\n<h3 id=\"attacher\"><a href=\"#attacher\">Attacher</a></h3>\n<p>Vous pouvez attacher le débogueur Visual Studio à un processus en cours d’exécution sur un ordinateur local ou distant. Lorsque le processus est en cours d’exécution, cliquez sur déboguer/attacher au processus (ou appuyez sur <code>CTRL+ALT+P</code>) pour ouvrir la boîte de dialogue « Attacher au processus ». Vous pouvez utiliser cette fonctionnalité pour déboguer des applications qui s'exécutent sur un ordinateur local ou distant, déboguer plusieurs processus simultanément.</p>\n<p>Si Electron s’exécute sous un compte d’utilisateur différent, sélectionnez la case <code>afficher les processus de tous les utilisateurs</code>. Notez que selon le nombre de BrowserWindows ouvert de votre application, vous verrez plusieurs processus. Une application typique avec une seule fenêtre se traduira dans Visual Studio par présenter juste deux entrées d'<code>Electron.exe</code> - l'un pour le processus principal et l’autre pour le processus de rendu. Étant donné que la liste vous donne seulement des noms, il n’y a actuellement aucun moyen fiable de savoir qui est qui.</p>\n<h3 id=\"quel-processus-dois-je-attacher-\"><a href=\"#quel-processus-dois-je-attacher-\">Quel processus dois-je attacher ?</a></h3>\n<p>Le code exécuté dans le processus principal (qui est le code se trouvant ou est lancé par votre fichier JavaScript main) s'exécutera à l’intérieur du processus principal, tandis que les autres morceaux de code s’exécuteront à l’intérieur de leur processus de rendu respectif.</p>\n<p>Vous pouvez être attaché à plusieurs programmes lorsque vous déboguez, mais un seul programme est actif dans le débogueur à tout moment. Vous pouvez configurer le programme actif dans la barre d’outils <code>Emplacement de débogage</code> ou de la <code>fenêtre de processus</code>.</p>\n<h2 id=\"utilisation-de-procmon-pour-observer-un-processus\"><a href=\"#utilisation-de-procmon-pour-observer-un-processus\">Utilisation de ProcMon pour observer un processus</a></h2>\n<p>Alors que Visual Studio est fantastique pour l’inspection de code spécifiques, la force de ProcMon est vraiment dans l'observation de tout ce que fait votre application avec le système d’exploitation - il capture les fichiers, registre, réseau, processus et fait un profilage des processus. Il tente de logguer <strong>tous</strong> les événements qui se produisent et peut être assez écrasant, mais si vous cherchez à comprendre pourquoi et comment votre application fonctionne avec le système d’exploitation, il peut être une ressource précieuse.</p>\n<p>Pour une introduction aux fonctionnalités de débogage de base et avancées de ProcMon, allez voir <a href=\"https://channel9.msdn.com/shows/defrag-tools/defrag-tools-4-process-monitor\">ce tutoriel vidéo</a> fourni par Microsoft.</p>",
      "title": "Débogage sur Windows",
      "description": ""
    },
    "/docs/api/debugger": {
      "locale": "fr-FR",
      "slug": "debugger",
      "href": "/docs/api/debugger",
      "crowdinFileId": "256305",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/debugger.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe--debugger\"><a href=\"#classe--debugger\">Classe : Debugger</a></h2>\n<blockquote>\n<p>Un transport alternatif pour le protocole de débogage distant de Chrome.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Chrome Developer Tools possède une <a href=\"https://chromedevtools.github.io/devtools-protocol/\">liaison spéciale</a> disponible à l'exécutable JavaScript qui permet d'interagir avec les pages et de les instrumentaliser.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-keyword\">try</span> {\n  win.webContents.debugger.attach(<span class=\"hljs-string\">'1.1'</span>)\n} <span class=\"hljs-keyword\">catch</span> (err) {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Debugger attach failed : '</span>, err)\n}\n\nwin.webContents.debugger.on(<span class=\"hljs-string\">'detach'</span>, (event, reason) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Debugger detached due to : '</span>, reason)\n})\n\nwin.webContents.debugger.on(<span class=\"hljs-string\">'message'</span>, (event, method, params) => {\n  <span class=\"hljs-keyword\">if</span> (method === <span class=\"hljs-string\">'Network.requestWillBeSent'</span>) {\n    <span class=\"hljs-keyword\">if</span> (params.request.url === <span class=\"hljs-string\">'https://www.github.com'</span>) {\n      win.webContents.debugger.detach()\n    }\n  }\n})\n\nwin.webContents.debugger.sendCommand(<span class=\"hljs-string\">'Network.enable'</span>)\n</code></pre>\n<h3 id=\"événements-dinstance\"><a href=\"#événements-dinstance\">Événements d’instance</a></h3>\n<h4 id=\"événement--detach\"><a href=\"#événement--detach\">Événement : 'detach'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>reason</code> String - Motif du retrait du débogueur.</li>\n</ul>\n<p>Emitted when the debugging session is terminated. This happens either when <code>webContents</code> is closed or devtools is invoked for the attached <code>webContents</code>.</p>\n<h4 id=\"événement--message\"><a href=\"#événement--message\">Événement : 'message'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>method</code> String - Nom de la méthode.</li>\n<li><code>params</code> any - Event parameters defined by the 'parameters' attribute in the remote debugging protocol.</li>\n<li><code>sessionId</code> String - Unique identifier of attached debugging session, will match the value sent from <code>debugger.sendCommand</code>.</li>\n</ul>\n<p>Émis chaque fois que la cible de débogage émet un événement d'instrumentation.</p>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<h4 id=\"debuggerattachprotocolversion\"><a href=\"#debuggerattachprotocolversion\"><code>debugger.attach([protocolVersion])</code></a></h4>\n<ul>\n<li><code>protocolVersion</code> String (facultatif) - Version de protocole de débogage demandée.</li>\n</ul>\n<p>Attache le débogueur au <code>webContents</code>.</p>\n<h4 id=\"debuggerisattached\"><a href=\"#debuggerisattached\"><code>debugger.isAttached()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si un débogueur est attaché au <code>webContents</code>.</p>\n<h4 id=\"debuggerdetach\"><a href=\"#debuggerdetach\"><code>debugger.detach()</code></a></h4>\n<p>Détache le débogueur depuis le <code>webContents</code>.</p>\n<h4 id=\"debuggersendcommandmethod-commandparams-sessionid\"><a href=\"#debuggersendcommandmethod-commandparams-sessionid\"><code>debugger.sendCommand(method[, commandParams, sessionId])</code></a></h4>\n<ul>\n<li><code>method</code> String - Method name, should be one of the methods defined by the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">remote debugging protocol</a>.</li>\n<li><code>commandParams</code> n'importe quel objet (facultatif) - JSON avec les paramètres de la requête.</li>\n<li><code>sessionId</code> String (optional) - send command to the target with associated debugging session id. The initial value can be obtained by sending <a href=\"https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-attachToTarget\">Target.attachToTarget</a> message.</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;any></code> - Une promesse qui se résout avec la réponse définie par l'attribut 'returns' de la description de la commande dans le protocole de débogage distant ou qui est rejetée indiquant l'échec de la commande.</p>\n<p>Envoi une commande au débogueur.</p>",
      "title": "Classe : Debugger",
      "description": "Un transport alternatif pour le protocole de débogage distant de Chrome."
    },
    "/docs/development/debugging-instructions-macos": {
      "locale": "fr-FR",
      "slug": "debugging-instructions-macos",
      "href": "/docs/development/debugging-instructions-macos",
      "crowdinFileId": "256153",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debugging-instructions-macos.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"débogage-sur-macos\"><a href=\"#débogage-sur-macos\">Débogage sur macOS</a></h1>\n<p>Si vous rencontrez des crash ou des problèmes dans Electron et que vous croyez qu'il ne viennent pas de votre app JavaScript, mais plutôt d'Electron lui-même, alors le débogage peut être un peu difficile, surtout pour les développeurs peu expérimentés pour le débogage natif/C++. Toutefois, en utilisant Ildb, et le code source d'Electron, il est assez facile d'activer le débogage avec des points d’arrêt dans le code source d'Electron. Vous pouvez également utiliser <a href=\"/docs/development/debugging-instructions-macos-xcode\">XCode pour le débogage</a> si vous préférez une interface graphique.</p>\n<h2 id=\"spécifications-requises\"><a href=\"#spécifications-requises\">Spécifications requises</a></h2>\n<ul>\n<li>\n<p><strong>Une compilation debug d'Electron</strong> : le moyen le plus simple est généralement de le compiler vous-même, en utilisant les outils et prérequis énumérées dans les <a href=\"/docs/development/build-instructions-macos\">instructions de compilation pour macOS</a>. Tandis que vous pouvez facilement déboguer Electron puisque vous pouvez le télécharger directement, vous trouverez qu’il est fortement optimisé, ce qui rend le débogage sensiblement plus difficile : le débogueur ne sera pas en mesure de vous montrer le contenu de toutes les variables et le chemin d’exécution peut sembler étrange à cause de l’inlining, liste des appels qui s’enchaînent et d'autres optimisations du compilateur.</p>\n</li>\n<li>\n<p><strong>Xcode</strong>: En plus de Xcode, vous devez aussi installer les outils de ligne de commande de Xcode. Ils incluent LLDB, le débogueur par défaut dans Xcode sur macOS. Il prend en charge le débogage en C, Objectif-C et Cm sur les appareils et simulateurs de bureau et d’iOS.</p>\n</li>\n<li>\n<p><strong>.lldbinit</strong> : Créez ou éditez <code>~/.lldbinit</code> pour permettre au code Chromium d'être correctement source-mappé.</p>\n<pre><code class=\"hljs language-plaintext\"># e.g: ['~/electron/src/tools/lldb']\nscript sys.path[:0] = ['&#x3C;...path/to/electron/src/tools/lldb>']\nscript import lldbinit\n</code></pre>\n</li>\n</ul>\n<h2 id=\"débogage-delectron\"><a href=\"#débogage-delectron\">Débogage d'Electron</a></h2>\n<p>Pour démarrer une session de débogage, ouvrez le Terminal et démarrez <code>lldb</code>, en passant une version non-version d'Electron en paramètre.</p>\n<pre><code class=\"hljs language-sh\">$ lldb ./out/Testing/Electron.app\n(lldb) target create <span class=\"hljs-string\">\"./out/Testing/Electron.app\"</span>\nCurrent executable <span class=\"hljs-built_in\">set</span> to <span class=\"hljs-string\">'./out/Testing/Electron.app'</span> (x86_64).\n</code></pre>\n<h3 id=\"définition-de-points-darrêt\"><a href=\"#définition-de-points-darrêt\">Définition de points d’arrêt</a></h3>\n<p>LLDB est un outil puissant et supporte plusieurs stratégies d'inspection de code. Pour cette introduction basique, assumons que vous exécutez une commande JavaScript qui ne se comporte pas correctement - donc vous aimeriez voir l'equivalent de cette commande en C++.</p>\n<p>Les fichiers de code pertinents peuvent être trouvés dans <code>./shell/</code>.</p>\n<p>Supposons que vous souhaitez déboguer <code>app.setName()</code>, qui est définie dans <code>browser.cc</code> comme <code>Browser::SetName()</code>. Définissez le point d’arrêt à l’aide de la commande de <code>breakpoint</code>, en spécifiant le fichier et la ligne à couper :</p>\n<pre><code class=\"hljs language-sh\">(lldb) breakpoint <span class=\"hljs-built_in\">set</span> --file browser.cc --line 117\nBreakpoint 1: <span class=\"hljs-built_in\">where</span> = Electron Framework`atom::Browser::SetName(std::__1::basic_string&#x3C;char, std::__1::char_traits&#x3C;char>, std::__1::allocator&#x3C;char> > const&#x26;) + 20 at browser.cc:118, address = 0x000000000015fdb4\n</code></pre>\n<p>Ensuite, démarrez Electron :</p>\n<pre><code class=\"hljs language-sh\">(lldb) run\n</code></pre>\n<p>L’app sera immédiatement suspendu, puisque l’électron définit le nom de l’application au lancement :</p>\n<pre><code class=\"hljs language-sh\">(lldb) run\nProcess 25244 launched: <span class=\"hljs-string\">'/Users/fr/Code/electron/out/Testing/Electron. pp/Contents/MacOS/Electron'</span> (x86_64)\nLe processus 25244 s<span class=\"hljs-string\">'est arrêté\n* thread #1: tid = 0x839a4c, 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 20 au navigateur. c:118, queue = '</span>com.apple.main-thread<span class=\"hljs-string\">', stop reason = point d'</span>arrêt 1.\n    frame <span class=\"hljs-comment\">#0: 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 20 dans le navigateur. c:118</span>\n   115 }\n   116\n   117 void Browser::SetName(const std::string&#x26; name) {\n-> 118 name_override_ = name;\n   119 }\n   120\n   121 int Browser::<span class=\"hljs-function\"><span class=\"hljs-title\">GetBadgeCount</span></span>() {\n(lldb)\n</code></pre>\n<p>Pour afficher les arguments et les variables locales pour le frame en cours, exécutez <code>frame variable</code> (ou <code>fr v</code>), qui vous montrera que l'app est en train de mettre le nom à \"Electron\".</p>\n<pre><code class=\"hljs language-sh\">(lldb) frame variable\n(atom::Browser *) this = 0x0000000108b14f20\n(const string &#x26;) name = <span class=\"hljs-string\">\"Electron\"</span>: {\n    [...]\n}\n</code></pre>\n<p>Pour faire une étape au niveau source dans le thread actuellement sélectionné, exécutez <code>step</code> (ou <code>s</code>). Cela vous amènerait dans <code>name_override_.empty()</code>. Pour continuer et refaire une étape, exécutez <code>next</code> (ou <code>n</code>).</p>\n<pre><code class=\"hljs language-sh\">(lldb) step\nProcess 25244 stopped\n* thread <span class=\"hljs-comment\">#1: tid = 0x839a4c, 0x0000000100162dcc Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 44 at browser.cc:119, queue = 'com.apple.main-thread', stop reason = step in</span>\n    frame <span class=\"hljs-comment\">#0: 0x0000000100162dcc Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 44 at browser.cc:119</span>\n   116\n   117  void Browser::SetName(const std::string&#x26; name) {\n   118    name_override_ = name;\n-> 119  }\n   120\n   121  int Browser::<span class=\"hljs-function\"><span class=\"hljs-title\">GetBadgeCount</span></span>() {\n   122    <span class=\"hljs-built_in\">return</span> badge_count_;\n</code></pre>\n<p><strong>NOTE:</strong> If you don't see source code when you think you should, you may not have added the <code>~/.lldbinit</code> file above.</p>\n<p>Pour terminer de déboguer à ce stade, exécutez : <code>process continue</code>. Vous pouvez également continuer jusqu'à ce que la ligne soit frappée dans ce thread (<code>thread jusqu'à 100</code>). Cette commande exécutera le thread dans le frame actif jusqu'à ce qu’il atteigne la ligne 100 dans cette trame ou s’arrête si elle quitte le frame en cours.</p>\n<p>Maintenant, si vous ouvrez les outils de développement d'Electron et appelez <code>setName</code>, vous frapperez une fois de plus le point d’arrêt.</p>\n<h3 id=\"lectures-additionnelles\"><a href=\"#lectures-additionnelles\">Lectures additionnelles</a></h3>\n<p>LLDB est un outil puissant, avec une excellente documentation. To learn more about it, consider Apple's debugging documentation, for instance the <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-basics.html#//apple_ref/doc/uid/TP40012917-CH2-SW2\">LLDB Command Structure Reference</a> or the introduction to <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-terminal-workflow-tutorial.html\">Using LLDB as a Standalone Debugger</a>.</p>\n<p>You can also check out LLDB's fantastic <a href=\"https://lldb.llvm.org/tutorial.html\">manual and tutorial</a>, which will explain more complex debugging scenarios.</p>",
      "title": "Débogage sur macOS",
      "description": ""
    },
    "/docs/development/debugging-instructions-macos-xcode": {
      "locale": "fr-FR",
      "slug": "debugging-instructions-macos-xcode",
      "href": "/docs/development/debugging-instructions-macos-xcode",
      "crowdinFileId": "256151",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debugging-instructions-macos-xcode.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h2 id=\"débogage-avec-xcode\"><a href=\"#débogage-avec-xcode\">Débogage avec XCode</a></h2>\n<h3 id=\"generate-xcode-project-for-debugging-sources-cannot-build-code-from-xcode\"><a href=\"#generate-xcode-project-for-debugging-sources-cannot-build-code-from-xcode\">Generate xcode project for debugging sources (cannot build code from xcode)</a></h3>\n<p>Run <code>gn gen</code> with the --ide=xcode argument.</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --ide=xcode\n</code></pre>\n<p>Cela générera le electron.ninja.xcworkspace. Vous devrez ouvrir cet espace de travail pour définir des points d'arrêt et inspecter.</p>\n<p>See <code>gn help gen</code> for more information on generating IDE projects with GN.</p>\n<h3 id=\"debugging-and-breakpoints\"><a href=\"#debugging-and-breakpoints\">Debugging and breakpoints</a></h3>\n<p>Launch Electron app after build. You can now open the xcode workspace created above and attach to the Electron process through the Debug > Attach To Process > Electron debug menu. [Note: If you want to debug the renderer process, you need to attach to the Electron Helper as well.]</p>\n<p>Vous pouvez maintenant définir des points d'arrêt dans l'un des fichiers indexés. However, you will not be able to set breakpoints directly in the Chromium source. To set break points in the Chromium source, you can choose Debug > Breakpoints > Create Symbolic Breakpoint and set any function name as the symbol. This will set the breakpoint for all functions with that name, from all the classes if there are more than one. You can also do this step of setting break points prior to attaching the debugger, however, actual breakpoints for symbolic breakpoint functions may not show up until the debugger is attached to the app.</p>",
      "title": "Débogage avec XCode",
      "description": ""
    },
    "/docs/tutorial/debugging-main-process": {
      "locale": "fr-FR",
      "slug": "debugging-main-process",
      "href": "/docs/tutorial/debugging-main-process",
      "crowdinFileId": "256189",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/debugging-main-process.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"débogguer-le-processus-principal\"><a href=\"#débogguer-le-processus-principal\">Débogguer le Processus Principal</a></h1>\n<p>Les DevTools dans une fenêtre de navigateur d’Electron peut seulement débogguer le JavaScript qui est exécuté dans cette fenêtre (c'est-à-dire les pages web). Pour débogguer le code JavaScript qui s’exécute dans le main process, vous devrez utiliser un déboggueur externe et lancer Electron avec les variables d'environnement <code>--inspect</code> ou <code>--inspect-brk</code>.</p>\n<h2 id=\"variables-denvironnement\"><a href=\"#variables-denvironnement\">Variables d'environnement</a></h2>\n<p>Utilisez une des variables d'environnement de ligne de commande suivantes pour activer le déboggage du main process :</p>\n<h3 id=\"--inspectport\"><a href=\"#--inspectport\"><code>--inspect=[port]</code></a></h3>\n<p>Electron will listen for V8 inspector protocol messages on the specified <code>port</code>, an external debugger will need to connect on this port. The default <code>port</code> is <code>5858</code>.</p>\n<pre><code class=\"hljs language-shell\">electron --inspect=5858 votre/app\n</code></pre>\n<h3 id=\"--inspect-brkport\"><a href=\"#--inspect-brkport\"><code>--inspect-brk=[port]</code></a></h3>\n<p>Comme <code>--inspect</code> mais interrompt l'exécution sur la première ligne de JavaScript.</p>\n<h2 id=\"déboggueurs-externes\"><a href=\"#déboggueurs-externes\">Déboggueurs externes</a></h2>\n<p>Vous devrez utiliser un débogueur supportant le protocole de l'inspecteur V8.</p>\n<ul>\n<li>Connectez Chrome en visitant <code>chrome://inspect</code> et sélectionnez inspecter l'application Electron lancé présente ici.</li>\n<li><a href=\"/docs/tutorial/debugging-vscode\">Débogage dans VSCode</a></li>\n</ul>",
      "title": "Débogguer le Processus Principal",
      "description": ""
    },
    "/docs/tutorial/debugging-vscode": {
      "locale": "fr-FR",
      "slug": "debugging-vscode",
      "href": "/docs/tutorial/debugging-vscode",
      "crowdinFileId": "256191",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/debugging-vscode.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"débogage-dans-vscode\"><a href=\"#débogage-dans-vscode\">Débogage dans VSCode</a></h1>\n<p>Ce guide explique comment configurer le débogage de VSCode pour votre propre projet Electron ainsi que pour la base de code natif d'Electron.</p>\n<h2 id=\"débogage-de-votre-application-electron\"><a href=\"#débogage-de-votre-application-electron\">Débogage de votre application Electron</a></h2>\n<h3 id=\"processus-principal\"><a href=\"#processus-principal\">Processus principal</a></h3>\n<h4 id=\"1-ouvrez-un-projet-electron-dans-vscode\"><a href=\"#1-ouvrez-un-projet-electron-dans-vscode\">1. Ouvrez un projet Electron dans VSCode.</a></h4>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:electron/electron-quick-start.git\n$ code electron-quick-start\n</code></pre>\n<h4 id=\"2-ajouter-un-fichier-vscodelaunchjson-avec-la-configuration-suivante-\"><a href=\"#2-ajouter-un-fichier-vscodelaunchjson-avec-la-configuration-suivante-\">2. Ajouter un fichier <code>.vscode/launch.json</code> avec la configuration suivante :</a></h4>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.2.0\"</span>,\n  <span class=\"hljs-attr\">\"configurations\"</span>: [\n    {\n      <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"Debug Main Process\"</span>,\n      <span class=\"hljs-attr\">\"type\"</span>: <span class=\"hljs-string\">\"node\"</span>,\n      <span class=\"hljs-attr\">\"request\"</span>: <span class=\"hljs-string\">\"launch\"</span>,\n      <span class=\"hljs-attr\">\"cwd\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      <span class=\"hljs-attr\">\"runtimeExecutable\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}/node_modules/.bin/electron\"</span>,\n      <span class=\"hljs-attr\">\"windows\"</span>: {\n        <span class=\"hljs-attr\">\"runtimeExecutable\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}/node_modules/.bin/electron.cmd\"</span>\n      },\n      <span class=\"hljs-attr\">\"args\"</span> : [<span class=\"hljs-string\">\".\"</span>],\n      <span class=\"hljs-attr\">\"outputCapture\"</span>: <span class=\"hljs-string\">\"std\"</span>\n    }\n  ]\n}\n</code></pre>\n<h4 id=\"3-debugging\"><a href=\"#3-debugging\">3. Debugging</a></h4>\n<p>Set some breakpoints in <code>main.js</code>, and start debugging in the <a href=\"https://code.visualstudio.com/docs/editor/debugging\">Debug View</a>. You should be able to hit the breakpoints.</p>\n<p>Voici un projet pré-configuré que vous pouvez télécharger et déboguer directement dans VSCode : <a href=\"https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start\">https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start</a></p>\n<h2 id=\"débogage-du-code-de-base-delectron\"><a href=\"#débogage-du-code-de-base-delectron\">Débogage du code de base d'Electron</a></h2>\n<p>Cette section vous aidera à tester vos modifications si vous souhaitez générer Electron à partir des sources et modifier le code natif de base d'Electron. .</p>\n<p>Si vous ne savez pas où aller chercher ce code ce code ou comment le générer, <a href=\"https://github.com/electron/build-tools\">Electron's Build Tools</a> automatise et explique la plupart de ce processus. Si vous souhaitez configurer manuellement l’environnement, vous pouvez utiliser ces <a href=\"/docs/development/build-instructions-gn\">instructions de génération</a>.</p>\n<h3 id=\"windows-c\"><a href=\"#windows-c\">Windows (C++)</a></h3>\n<h4 id=\"1-ouvrez-un-projet-electron-dans-vscode-1\"><a href=\"#1-ouvrez-un-projet-electron-dans-vscode-1\">1. Ouvrez un projet Electron dans VSCode.</a></h4>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:electron/electron-quick-start.git\n$ code electron-quick-start\n</code></pre>\n<h4 id=\"2-ajouter-un-fichier-vscodelaunchjson-avec-la-configuration-suivante--1\"><a href=\"#2-ajouter-un-fichier-vscodelaunchjson-avec-la-configuration-suivante--1\">2. Ajouter un fichier <code>.vscode/launch.json</code> avec la configuration suivante :</a></h4>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.2.0\"</span>,\n  <span class=\"hljs-attr\">\"configurations\"</span>: [\n    {\n      <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"(Windows) Launch\"</span>,\n      <span class=\"hljs-attr\">\"type\"</span>: <span class=\"hljs-string\">\"cppvsdbg\"</span>,\n      <span class=\"hljs-attr\">\"request\"</span>: <span class=\"hljs-string\">\"launch\"</span>,\n      <span class=\"hljs-attr\">\"program\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\\\\out\\\\your-executable-location\\\\electron.exe\"</span>,\n      <span class=\"hljs-attr\">\"args\"</span>: [<span class=\"hljs-string\">\"your-electron-project-path\"</span>],\n      <span class=\"hljs-attr\">\"stopAtEntry\"</span>: <span class=\"hljs-literal\">false</span>,\n      <span class=\"hljs-attr\">\"cwd\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      <span class=\"hljs-attr\">\"environment\"</span>: [\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_ENABLE_LOGGING\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"true\"</span>},\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_ENABLE_STACK_DUMPING\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"true\"</span>},\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_RUN_AS_NODE\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"\"</span>},\n      ],\n      <span class=\"hljs-attr\">\"externalConsole\"</span>: <span class=\"hljs-literal\">false</span>,\n      <span class=\"hljs-attr\">\"sourceFileMap\"</span>: {\n          <span class=\"hljs-attr\">\"o:\\\\\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      },\n    },\n  ]\n}\n</code></pre>\n<p><strong>Configuration Notes</strong></p>\n<ul>\n<li><code>cppvsdbg</code> requires the <a href=\"https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools\">built-in C/C++ extension</a> be enabled.</li>\n<li><code>${workspaceFolder}</code> is the full path to Chromium's <code>src</code> directory.</li>\n<li><code>your-executable-location</code> will be one of the following depending on a few items:<ul>\n<li><code>Testing</code>: If you are using the default settings of <a href=\"https://github.com/electron/build-tools\">Electron's Build-Tools</a> or the default instructions when <a href=\"/docs/development/build-instructions-gn#building\">building from source</a>.</li>\n<li><code>Release</code>: If you built a Release build rather than a Testing build.</li>\n<li><code>your-directory-name</code>: If you modified this during your build process from the default, this will be whatever you specified.</li>\n</ul></li>\n<li>The <code>args</code> array string <code>\"your-electron-project-path\"</code> should be the absolute path to either the directory or <code>main.js</code> file of the Electron project you are using for testing. In this example, it should be your path to <code>electron-quick-start</code>.</li>\n</ul>\n<h4 id=\"3-debugging-1\"><a href=\"#3-debugging-1\">3. Debugging</a></h4>\n<p>Définissez quelques points d'arrêt dans le code natif Electron C++ et commencez à déboguer dans la <a href=\"https://code.visualstudio.com/docs/editor/debugging\">Vue débogage</a>.</p>",
      "title": "Débogage dans VSCode",
      "description": ""
    },
    "/docs/api/desktop-capturer": {
      "locale": "fr-FR",
      "slug": "desktop-capturer",
      "href": "/docs/api/desktop-capturer",
      "crowdinFileId": "256307",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/desktop-capturer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktopcapturer\"><a href=\"#desktopcapturer\">desktopCapturer</a></h1>\n<blockquote>\n<p>Access information about media sources that can be used to capture audio and video from the desktop using the <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> API.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>L'exemple suivant montre comment faire pour capturer la vidéo à partir d'une fenêtre dont le titre est <code>Electron</code> :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Dans le processus renderer.</span>\n<span class=\"hljs-keyword\">const</span> { desktopCapturer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ndesktopCapturer.getSources({ <span class=\"hljs-attr\">types</span>: [<span class=\"hljs-string\">'window'</span>, <span class=\"hljs-string\">'screen'</span>] }).then(<span class=\"hljs-keyword\">async</span> sources => {\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> source <span class=\"hljs-keyword\">of</span> sources) {\n    <span class=\"hljs-keyword\">if</span> (source.name === <span class=\"hljs-string\">'Electron'</span>) {\n      <span class=\"hljs-keyword\">try</span> {\n        <span class=\"hljs-keyword\">const</span> stream = <span class=\"hljs-keyword\">await</span> navigator.mediaDevices.getUserMedia({\n          <span class=\"hljs-attr\">audio</span>: <span class=\"hljs-literal\">false</span>,\n          <span class=\"hljs-attr\">video</span>: {\n            <span class=\"hljs-attr\">mandatory</span>: {\n              <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>,\n              <span class=\"hljs-attr\">chromeMediaSourceId</span>: source.id,\n              <span class=\"hljs-attr\">minWidth</span>: <span class=\"hljs-number\">1280</span>,\n              <span class=\"hljs-attr\">maxWidth</span>: <span class=\"hljs-number\">1280</span>,\n              <span class=\"hljs-attr\">minHeight</span>: <span class=\"hljs-number\">720</span>,\n              <span class=\"hljs-attr\">maxHeight</span>: <span class=\"hljs-number\">720</span>\n            }\n          }\n        })\n        handleStream(stream)\n      } <span class=\"hljs-keyword\">catch</span> (e) {\n        handleError(e)\n      }\n      <span class=\"hljs-keyword\">return</span>\n    }\n  }\n})\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleStream</span> (<span class=\"hljs-params\">stream</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> video = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'video'</span>)\n  video.srcObject = stream\n  video.onloadedmetadata = <span class=\"hljs-function\">(<span class=\"hljs-params\">e</span>) =></span> video.play()\n}\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleError</span> (<span class=\"hljs-params\">e</span>) </span>{\n  <span class=\"hljs-built_in\">console</span>.log(e)\n}\n</code></pre>\n<p>To capture video from a source provided by <code>desktopCapturer</code> the constraints passed to <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> must include <code>chromeMediaSource: 'desktop'</code>, and <code>audio: false</code>.</p>\n<p>To capture both audio and video from the entire desktop the constraints passed to <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> must include <code>chromeMediaSource: 'desktop'</code>, for both <code>audio</code> and <code>video</code>, but should not include a <code>chromeMediaSourceId</code> constraint.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> constraints = {\n  <span class=\"hljs-attr\">audio</span>: {\n    <span class=\"hljs-attr\">mandatory</span>: {\n      <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>\n    }\n  },\n  <span class=\"hljs-attr\">video</span>: {\n    <span class=\"hljs-attr\">mandatory</span>: {\n      <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>\n    }\n  }\n}\n</code></pre>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module <code>desktopCapturer</code> dispose des méthodes suivantes :</p>\n<h3 id=\"desktopcapturergetsourcesoptions\"><a href=\"#desktopcapturergetsourcesoptions\"><code>desktopCapturer.getSources(options)</code></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>types</code> String[] - un tableau de Chaîne de caractères qui répertorie les types de sources bureau à être capturé, les types disponibles sont <code>screen</code> et <code>window</code>.</li>\n<li><code>thumbnailSize</code> <a href=\"/docs/api/structures/size\">Size</a> (facultatif) - La taille de la miniature de la source de média doit être redimensionnée. La valeur par défaut est <code>150</code> x <code>150</code>. Définissez la largeur ou la hauteur à 0 lorsque vous n'avez pas besoin de les vignettes. Cela permettra de gagner le temps de traitement nécessaire pour capturer le contenu de chaque fenêtre et écran.</li>\n<li><code>fetchWindowIcons</code> Boolean (facultatif) - Définir à true pour activer la récupération des icônes de fenêtre. La valeur par défaut est faux. Lorsque false la propriété appIcon des sources retourne null. Même si une source a l'écran de type.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Promise&#x3C;DesktopCapturerSource[]></code> - Résout avec un tableau de <a href=\"/docs/api/structures/desktop-capturer-source\"><code>DesktopCapturerSource</code></a>, chaque <code>DesktopCapturerSource</code> représente un écran ou une fenêtre individuelle qui peut être capturée.</p>\n<p><strong>Note</strong> Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher, which can detected by <a href=\"/docs/api/system-preferences#systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><code>systemPreferences.getMediaAccessStatus</code></a>.</p>\n<h2 id=\"avertissements\"><a href=\"#avertissements\">Avertissements</a></h2>\n<p><code>navigator.mediaDevices. etUserMedia</code> ne fonctionne pas sur macOS pour la capture audio en raison d'une limitation fondamentale par laquelle les applications qui veulent accéder à l'audio du système nécessitent une <a href=\"https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/KernelExtensions/KernelExtensions.html\">extension du noyau signée</a>. Chromium, et par extension Electron, ne le fournit pas.</p>\n<p>Il est possible de contourner cette limitation en capturant le système audio avec une autre application macOS comme Soundflower et en le passant par un périphérique d'entrée audio virtuel. Ce périphérique virtuel peut ensuite être interrogé avec <code>navigator.mediaDevices.getUserMedia</code>.</p>",
      "title": "desktopCapturer",
      "description": "Access information about media sources that can be used to capture audio and video from the desktop using the navigator.mediaDevices.getUserMedia API."
    },
    "/docs/api/structures/desktop-capturer-source": {
      "locale": "fr-FR",
      "slug": "desktop-capturer-source",
      "href": "/docs/api/structures/desktop-capturer-source",
      "crowdinFileId": "256425",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/desktop-capturer-source.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktopcapturersource-object\"><a href=\"#desktopcapturersource-object\">DesktopCapturerSource Object</a></h1>\n<ul>\n<li><code>id</code> String - The identifier of a window or screen that can be used as a <code>chromeMediaSourceId</code> constraint when calling [<code>navigator.webkitGetUserMedia</code>]. The format of the identifier will be <code>window:XX:YY</code> or <code>screen:ZZ:0</code>. XX is the windowID/handle. YY is 1 for the current process, and 0 for all others. ZZ is a sequential number that represents the screen, and it does not equal to the index in the source's name.</li>\n<li><code>name</code> String - A screen source will be named either <code>Entire Screen</code> or <code>Screen &#x3C;index></code>, while the name of a window source will match the window title.</li>\n<li><code>thumbnail</code> <a href=\"/docs/api/native-image\">NativeImage</a> - A thumbnail image. <strong>Note:</strong> There is no guarantee that the size of the thumbnail is the same as the <code>thumbnailSize</code> specified in the <code>options</code> passed to <code>desktopCapturer.getSources</code>. The actual size depends on the scale of the screen or window.</li>\n<li><code>display_id</code> String - A unique identifier that will correspond to the <code>id</code> of the matching <a href=\"/docs/api/structures/display\">Display</a> returned by the <a href=\"/docs/api/screen\">Screen API</a>. On some platforms, this is equivalent to the <code>XX</code> portion of the <code>id</code> field above and on others it will differ. It will be an empty string if not available.</li>\n<li><code>appIcon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - An icon image of the application that owns the window or null if the source has a type screen. The size of the icon is not known in advance and depends on what the application provides.</li>\n</ul>",
      "title": "DesktopCapturerSource Object",
      "description": ""
    },
    "/docs/tutorial/devices": {
      "locale": "fr-FR",
      "slug": "devices",
      "href": "/docs/tutorial/devices",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/devices.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"accès-au-périphérique\"><a href=\"#accès-au-périphérique\">Accès au périphérique</a></h1>\n<p>Comme les navigateurs basés sur Chromium, Electron fournit un accès au matériel du périphérique via des API Web.  Ces API fonctionnent pour la plupart, comme dans un navigateur, mais il y a quelques différences qui doivent être prises en compte.  La principale différence entre Electron et les navigateurs est ce qui se passe lorsque l'accès à l'appareil est demandé .  Dans un navigateur, les utilisateurs se voient présenter une popup où ils peuvent accorder l' accès à un appareil individuel.  Dans Electron des APIsont fournies pouvant être utilisées par un développeur pour choisir automatiquement un périphérique ou demander aux utilisateurs de choisir un périphérique via une interface créée par un développeur.</p>\n<h2 id=\"api-web-bluetooth\"><a href=\"#api-web-bluetooth\">API Web Bluetooth</a></h2>\n<p>L’API <a href=\"https://web.dev/bluetooth/\">Web Bluetooth</a> peut être utilisée pour communiquer avec des périphériques Bluetooth. Afin d'utiliser cette API dans Electron, les développeurs devront gérer l'événement <a href=\"/docs/api/web-contents#event-select-bluetooth-device\"><code>select-bluetooth-device</code> sur le webContents</a> associé à la demande de périphérique.</p>\n<h3 id=\"example\"><a href=\"#example\">Example</a></h3>\n<p>Cet exemple montre une application Electron qui sélectionne automatiquement le premier périphérique Bluetooth disponible lorsque le bouton <code>Test Bluetooth</code> est cliqué.</p>\n<h2 id=\"webhid-api\"><a href=\"#webhid-api\">WebHID API</a></h2>\n<p>The <a href=\"https://web.dev/hid/\">WebHID API</a> can be used to access HID devices such as keyboards and gamepads.  Electron provides several APIs for working with the WebHID API:</p>\n<ul>\n<li>The <a href=\"/docs/api/session#event-select-hid-device\"><code>select-hid-device</code> event on the Session</a> can be used to select a HID device when a call to <code>navigator.hid.requestDevice</code> is made.  Additionally the <a href=\"/docs/api/session#event-hid-device-added\"><code>hid-device-added</code></a> and <a href=\"/docs/api/session#event-hid-device-removed\"><code>hid-device-removed</code></a> events on the Session can be used to handle devices being plugged in or unplugged during the <code>navigator.hid.requestDevice</code> process.</li>\n<li><a href=\"/docs/api/session#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a> can be used to provide default permissioning to devices without first calling for permission to devices via <code>navigator.hid.requestDevice</code>.  Additionally, the default behavior of Electron is to store granted device permision through the lifetime of the corresponding WebContents.  If longer term storage is needed, a developer can store granted device permissions (eg when handling the <code>select-hid-device</code> event) and then read from that storage with <code>setDevicePermissionHandler</code>.</li>\n<li><a href=\"/docs/api/session#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a> can be used to disable HID access for specific origins.</li>\n</ul>\n<h3 id=\"blocklist\"><a href=\"#blocklist\">Blocklist</a></h3>\n<p>By default Electron employs the same <a href=\"https://github.com/WICG/webhid/blob/main/blocklist.txt\">blocklist</a> used by Chromium.  If you wish to override this behavior, you can do so by setting the <code>disable-hid-blocklist</code> flag:</p>\n<pre><code class=\"hljs language-javascript\">app.commandLine.appendSwitch(<span class=\"hljs-string\">'disable-hid-blocklist'</span>)\n</code></pre>\n<h3 id=\"example-1\"><a href=\"#example-1\">Example</a></h3>\n<p>This example demonstrates an Electron application that automatically selects HID devices through <a href=\"/docs/api/session#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a> and through <a href=\"/docs/api/session#event-select-hid-device\"><code>select-hid-device</code> event on the Session</a> when the <code>Test WebHID</code> button is clicked.</p>\n<h2 id=\"web-serial-api\"><a href=\"#web-serial-api\">Web Serial API</a></h2>\n<p>The <a href=\"https://web.dev/serial/\">Web Serial API</a> can be used to access serial devices that are connected via serial port, USB, or Bluetooth.  In order to use this API in Electron, developers will need to handle the <a href=\"/docs/api/session#event-select-serial-port\"><code>select-serial-port</code> event on the Session</a> associated with the serial port request.</p>\n<p>There are several additional APIs for working with the Web Serial API:</p>\n<ul>\n<li>The <a href=\"/docs/api/session#event-serial-port-added\"><code>serial-port-added</code></a> and <a href=\"/docs/api/session#event-serial-port-removed\"><code>serial-port-removed</code></a> events on the Session can be used to handle devices being plugged in or unplugged during the <code>navigator.serial.requestPort</code> process.</li>\n<li><a href=\"/docs/api/session#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a> can be used to disable serial access for specific origins.</li>\n</ul>\n<h3 id=\"example-2\"><a href=\"#example-2\">Example</a></h3>\n<p>This example demonstrates an Electron application that automatically selects the first available Arduino Uno serial device (if connected) through <a href=\"/docs/api/session#event-select-serial-port\"><code>select-serial-port</code> event on the Session</a> when the <code>Test Web Serial</code> button is clicked.</p>",
      "title": "Accès au périphérique",
      "description": ""
    },
    "/docs/tutorial/devtools-extension": {
      "locale": "fr-FR",
      "slug": "devtools-extension",
      "href": "/docs/tutorial/devtools-extension",
      "crowdinFileId": "256195",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/devtools-extension.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"extension-devtools\"><a href=\"#extension-devtools\">Extension DevTools</a></h1>\n<p>Electron prend en charge les <a href=\"https://developer.chrome.com/extensions/devtools\">Chrome DevTools extensions</a>, qui peuvent être utilisées pour étendre les capacités des devtools de Chrome pour le débogage des framework les plus populaires.</p>\n<h2 id=\"chargement-dune-extension-devtools-avec-outillage\"><a href=\"#chargement-dune-extension-devtools-avec-outillage\">Chargement d'une extension DevTools avec outillage</a></h2>\n<p>La façon la plus simple de charger une extension DevTools est l'utilisation d'outil tiers pour automatiser à votre place le processus. Le package <a href=\"https://github.com/MarshallOfSound/electron-devtools-installer\">electron-devtools-installer</a> disponible via NPM correspond exactement à cela.</p>\n<h2 id=\"chargement-manuel-dune-extension-des-devtools\"><a href=\"#chargement-manuel-dune-extension-des-devtools\">Chargement manuel d'une extension des DevTools</a></h2>\n<p>Si vous ne voulez pas utiliser l'approche outillage, vous pouvez de toute façon effectuer toutes les opérations nécessaires à la main. Pour charger une extension dans Electron, vous devez tout d'abord la télécharger via Chrome puis localiser son chemin dans le système de fichiers et la charger enfin dans votre <a href=\"/docs/api/session\">Session</a> en appelant l'API [<code>ses.loadExtension</code>].</p>\n<p>Exemple utilisant <a href=\"https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi\">React Developer Tools</a> :</p>\n<ol>\n<li>\n<p>Installez l'extension dans Google Chrome.</p>\n</li>\n<li>\n<p>Accédez à <code>chrome://extensions</code> et trouvez son ID d’extension, qui est une chaîne de hachage comme <code>fmkadmapgofadopljbjfkapdkoienihi</code>.</p>\n</li>\n<li>\n<p>Découvrez l'emplacement utilisé par Chrome dans le système de fichiers pour stocker les extensions :</p>\n<ul>\n<li>sous Windows, c'est <code>%LOCALAPPDATA%\\Google\\Chrome\\User Data\\Default\\Extensions</code> ;</li>\n<li>sous Linux, ça pourrait être :<ul>\n<li><code>~/.config/google-chrome/Default/Extensions/</code></li>\n<li><code>~/.config/google-chrome-beta/Default/Extensions/</code></li>\n<li><code>~/.config/google-chrome-canary/Default/Extensions/</code></li>\n<li><code>~/.config/chromium/Default/Extensions/</code></li>\n</ul></li>\n<li>sur macOS c’est <code>~/Library/Application Support/Google/Chrome/Default/Extensions</code>.</li>\n</ul>\n</li>\n<li>\n<p>Transmettre l'emplacement de l'extension à l'API <a href=\"/docs/api/session#sesloadextensionpath-options\"><code>ses.loadExtension</code></a> . Pour les outils de développement React <code>v4.9.0</code>, cela ressemble à quelque chose comme :</p>\n<pre><code class=\"hljs language-javascript\"> <span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n <span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n\n <span class=\"hljs-comment\">// sur macOS</span>\n <span class=\"hljs-keyword\">const</span> reactDevToolsPath = path.join(\n   os.homedir(),\n   <span class=\"hljs-string\">'/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/4.9.0_0'</span>\n )\n\n app.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n   <span class=\"hljs-keyword\">await</span> session.defaultSession.loadExtension(reactDevToolsPath)\n })\n</code></pre>\n</li>\n</ol>\n<p><strong>Remarque :</strong></p>\n<ul>\n<li><code>loadExtension</code> retourne une Promise avec un objet de type <a href=\"/docs/api/structures/extension\">Extension</a> contenant des métadonnées à propos de l'extension qui a été chargée. Cette promesse doit être résolue (par exemple avec une expression <code>await</code> ) avant de charger une page. Sinon il n'est pas garanti que l'extension se charge.</li>\n<li><code>loadExtension</code> ne doit pas être invoquée avant que l'évènement <code>ready</code> du module <code>app</code> ne soit émis, ni lors de sessions en mémoire (non persistantes).</li>\n<li>Pour que l'extension soit chargée <code>loadExtension</code> devrat être invoquée à chaque démarrage de votre application.</li>\n</ul>\n<h3 id=\"suppression-dune-extension-devtools\"><a href=\"#suppression-dune-extension-devtools\">Suppression d’une extension DevTools</a></h3>\n<p>Afin de supprimer une extension vous devez passer l'ID de l'extension à l'API <a href=\"/docs/api/session#sesremoveextensionextensionid\"><code>ses.removeExtension</code></a>. Les extensions chargées ne persistent s pas entre deux lancements d’application.</p>\n<h2 id=\"support-de-lextension-devtools\"><a href=\"#support-de-lextension-devtools\">Support de l'extension DevTools</a></h2>\n<p>Electron ne prend en charge qu'un <a href=\"/docs/api/extensions\">ensemble limité des APIs <code>chrome.</code> </a>, donc les extensions utilisant les APIs non supportées sous le capot peuvent ne pas fonctionner.</p>\n<p>Les Extensions Devtools suivantes ont été testées et sont garanties de fonctionner dans Electron :</p>\n<ul>\n<li><a href=\"https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi\">Inspecteur Ember</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi\">Outils de développement React</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/backbone-debugger/bhljhndlimiafopmmhjlgfpnnchjjbhd\">Débogueur Backbone</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/jquery-debugger/dbhhnnnpaeobfddmlalhnehgclcmjimi\">Débogueur jQuery</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/angularjs-batarang/ighdmehidhipcmcojjgiloacoafjmpfk\">Batarang AngularJS</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd\">Devtools Vue.js</a></li>\n<li><a href=\"https://cerebraljs.com/docs/introduction/devtools.html\">Débogueur Cerebral</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd\">Extension DevTools Redux</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/mobx-developer-tools/pfgnfdagidkfgccljigdamigbcnndkod\">MobX Developer Tools</a></li>\n</ul>\n<h3 id=\"que-faire-si-une-extension-devtools-ne-fonctionne-pas-\"><a href=\"#que-faire-si-une-extension-devtools-ne-fonctionne-pas-\">Que faire si une extension DevTools ne fonctionne pas ?</a></h3>\n<p>Tout d'abord, assurez-vous que l'extension est toujours maintenue, et qu'elle est compatible avec la dernière version de Google Chrome. Nous ne pouvons pas fournir de support supplémentaire pour les extensions non prises en charge.</p>\n<p>Si l'extension fonctionne sur Chrome mais pas sur Electron, signalez une bug dans le traqueur de tickets d'Electron en décrivant quelle partie de l'extension ne fonctionne pas comme prévu.</p>",
      "title": "Extension DevTools",
      "description": ""
    },
    "/docs/api/dialog": {
      "locale": "fr-FR",
      "slug": "dialog",
      "href": "/docs/api/dialog",
      "crowdinFileId": "256309",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/dialog.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dialog\"><a href=\"#dialog\">dialog</a></h1>\n<blockquote>\n<p>Affiche une boîte de dialogue du système natif pour ouvrir et enregistrer des fichiers, alertes, etc...</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>Un exemple d'afficher une boîte de dialogue pour sélectionner plusieurs fichiers :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(dialog.showOpenDialog({ <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'multiSelections'</span>] }))\n</code></pre>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module <code>dialog</code> dispose des méthodes suivantes :</p>\n<h3 id=\"dialogshowopendialogsyncbrowserwindow-options\"><a href=\"#dialogshowopendialogsyncbrowserwindow-options\"><code>dialog.showOpenDialogSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (facultatif)</li>\n<li>Objet <code>options</code><ul>\n<li><code>title</code> String (facultatif)</li>\n<li><code>defaultPath</code> String (facultatif)</li>\n<li><code>buttonLabel</code> String (facultatif) - Étiquette personnalisé pour le bouton de confirmation. Si laissé vide, l'étiquette par défaut sera utilisé.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (facultatif)</li>\n<li><code>properties</code> String[] (facultatif) - Contient les fonctionnalités que la boîte de dialogue doit utiliser. Les valeurs suivantes sont prises en charge :<ul>\n<li><code>openFile</code> - Permet la sélection de fichiers.</li>\n<li><code>openDirectory</code> - Permet la sélection de dossiers.</li>\n<li><code>multiSelections</code> - Permet la sélection de multiples chemins.</li>\n<li><code>showHiddenFiles</code> - Affiche les fichiers cachés dans la boîte de dialogue.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Permet la création de nouveaux dossiers depuis la boîte de dialogue.</li>\n<li><code>promptToCreate</code> <em>Windows</em> - Demande la création du dossier si le chemin d'accès du fichier entré dans la boîte de dialogue n'existe pas. Cela ne créer par réellement le fichier dans le chemin d'accès mais permet de donner des chemins d'accès inexistant qui devraient être créés par l'application.</li>\n<li><code>noResolveAliases</code> <em>macOS</em> - Désactive la résolution de l'alias automatique (lien symbolique) . Les alias sélectionnés retourneront alors le chemin de l'alias au lieu de celui de leur cible.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Considérer les paquets, tels que les dossiers <code>.app</code>, comme des dossiers plutôt que des fichiers.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - N'ajoutez pas l'élément en cours d'ouverture à la liste des documents récents.</li>\n</ul></li>\n<li><code>message</code> String (facultatif) <em>macOS</em> - Message à afficher au-dessus des zones de saisie.</li>\n<li><code>securityScopedBookmarks</code> Boolean (facultatif) <em>macOS</em> <em>mas</em> - Créez <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">signets à portée de sécurité</a> lorsqu'ils sont empaquetés pour le Mac App Store.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>String[] | undefined</code> - le chemin du fichier choisi par l'utilisateur ; si la boîte de dialogue est annulée retourne <code>undefined</code>.</p>\n<p>L'argument <code>browserWindow</code> permet à la boîte de dialogue de s'attacher elle-même à la fenêtre parent, la rendant modale.</p>\n<p>The <code>filters</code> specifies an array of file types that can be displayed or selected when you want to limit the user to a specific type. Par exemple :</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">filtres</span>: [\n    { <span class=\"hljs-attr\">name</span> : <span class=\"hljs-string\">'Images'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'jpg'</span>, <span class=\"hljs-string\">'png'</span>, <span class=\"hljs-string\">'gif'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Films'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'mkv'</span>, <span class=\"hljs-string\">'avi'</span>, <span class=\"hljs-string\">'mp4'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Type de fichier personnalisé'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'as'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Tous les fichiers'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'*'</span>] }\n  ]\n}\n</code></pre>\n<p>Le tableau d'<code>extensions</code> devrait contenir les extensions sans caractères génériques ou de point (par exemple <code>'png'</code> est correct, mais <code>'.png'</code> et <code>'*.png'</code> ne l'est pas). Pour afficher tous les fichiers, utilisez le caractère générique <code>'*'</code> (aucun autre caractère générique n'est pris en charge).</p>\n<p><strong>Remarque :</strong> Sur Windows et Linux, une boîte de dialogue ne peux pas être à la fois une sélection de fichier et une sélection de dossier, donc si vous définissez <code>properties</code> à <code>['openFile', 'openDirectory']</code> sur ces plateformes, c'est la sélection de dossier qui s'affichera.</p>\n<pre><code class=\"hljs language-js\">dialog.showOpenDialogSync(mainWindow, {\n  propriétés: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'openDirectory'</span>]\n})\n</code></pre>\n<h3 id=\"dialogshowopendialogbrowserwindow-options\"><a href=\"#dialogshowopendialogbrowserwindow-options\"><code>dialog.showOpenDialog([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (facultatif)</li>\n<li>Objet <code>options</code><ul>\n<li><code>title</code> String (facultatif)</li>\n<li><code>defaultPath</code> String (facultatif)</li>\n<li><code>buttonLabel</code> String (facultatif) - Étiquette personnalisé pour le bouton de confirmation. Si laissé vide, l'étiquette par défaut sera utilisé.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (facultatif)</li>\n<li><code>properties</code> String[] (facultatif) - Contient les fonctionnalités que la boîte de dialogue doit utiliser. Les valeurs suivantes sont prises en charge :<ul>\n<li><code>openFile</code> - Permet la sélection de fichiers.</li>\n<li><code>openDirectory</code> - Permet la sélection de dossiers.</li>\n<li><code>multiSelections</code> - Permet la sélection de multiples chemins.</li>\n<li><code>showHiddenFiles</code> - Affiche les fichiers cachés dans la boîte de dialogue.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Permet la création de nouveaux dossiers depuis la boîte de dialogue.</li>\n<li><code>promptToCreate</code> <em>Windows</em> - Demande la création du dossier si le chemin d'accès du fichier entré dans la boîte de dialogue n'existe pas. Cela ne créer par réellement le fichier dans le chemin d'accès mais permet de donner des chemins d'accès inexistant qui devraient être créés par l'application.</li>\n<li><code>noResolveAliases</code> <em>macOS</em> - Désactive la résolution de l'alias automatique (lien symbolique) . Les alias sélectionnés retourneront alors le chemin de l'alias au lieu de celui de leur cible.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Considérer les paquets, tels que les dossiers <code>.app</code>, comme des dossiers plutôt que des fichiers.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - N'ajoutez pas l'élément en cours d'ouverture à la liste des documents récents.</li>\n</ul></li>\n<li><code>message</code> String (facultatif) <em>macOS</em> - Message à afficher au-dessus des zones de saisie.</li>\n<li><code>securityScopedBookmarks</code> Boolean (facultatif) <em>macOS</em> <em>mas</em> - Créez <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">signets à portée de sécurité</a> lorsqu'ils sont empaquetés pour le Mac App Store.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Promise&#x3C;Object></code> - Résoudre avec un objet contenant les éléments suivants :</p>\n<ul>\n<li><code>annulé</code> Booléen - que la boîte de dialogue ait été annulée ou non.</li>\n<li><code>filePaths</code> String[] - Un tableau de chemins d'accès choisi par l'utilisateur. If the dialog is cancelled this will be an empty array.</li>\n<li><code>signets</code> String[] (facultatif) <em>macOS</em> <em>mas</em> - Un tableau correspondant au tableau <code>filePaths</code> de chaînes encodées en base64 qui contient des données de marque-pages à portée de sécurité. <code>securityScopedBookmarks</code> doit être activé pour que ceci soit rempli. (Pour les valeurs de retour, voir la <a href=\"#bookmarks-array\">table ici</a>.)</li>\n</ul>\n<p>L'argument <code>browserWindow</code> permet à la boîte de dialogue de s'attacher elle-même à la fenêtre parent, la rendant modale.</p>\n<p>The <code>filters</code> specifies an array of file types that can be displayed or selected when you want to limit the user to a specific type. Par exemple :</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">filtres</span>: [\n    { <span class=\"hljs-attr\">name</span> : <span class=\"hljs-string\">'Images'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'jpg'</span>, <span class=\"hljs-string\">'png'</span>, <span class=\"hljs-string\">'gif'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Films'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'mkv'</span>, <span class=\"hljs-string\">'avi'</span>, <span class=\"hljs-string\">'mp4'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Type de fichier personnalisé'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'as'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Tous les fichiers'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'*'</span>] }\n  ]\n}\n</code></pre>\n<p>Le tableau d'<code>extensions</code> devrait contenir les extensions sans caractères génériques ou de point (par exemple <code>'png'</code> est correct, mais <code>'.png'</code> et <code>'*.png'</code> ne l'est pas). Pour afficher tous les fichiers, utilisez le caractère générique <code>'*'</code> (aucun autre caractère générique n'est pris en charge).</p>\n<p><strong>Remarque :</strong> Sur Windows et Linux, une boîte de dialogue ne peux pas être à la fois une sélection de fichier et une sélection de dossier, donc si vous définissez <code>properties</code> à <code>['openFile', 'openDirectory']</code> sur ces plateformes, c'est la sélection de dossier qui s'affichera.</p>\n<pre><code class=\"hljs language-js\">dialog.showOpenDialog(mainWindow, {\n  <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'openDirectory'</span>]\n}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">result</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(result.canceled)\n  <span class=\"hljs-built_in\">console</span>.log(result.filePaths)\n}).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(err)\n})\n</code></pre>\n<h3 id=\"dialogshowsavedialogsyncbrowserwindow-options\"><a href=\"#dialogshowsavedialogsyncbrowserwindow-options\"><code>dialog.showSaveDialogSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (facultatif)</li>\n<li>Objet <code>options</code><ul>\n<li><code>title</code> String (optional) - The dialog title. Ne peut pas être affiché sur certains environnements de bureau <em>Linux</em>.</li>\n<li><code>defaultPath</code> String (facultatif) - Chemin d'accès absolu, le chemin d'accès absolu du fichier, ou le nom du fichier à utiliser par défaut.</li>\n<li><code>buttonLabel</code> String (facultatif) - Étiquette personnalisé pour le bouton de confirmation. Si laissé vide, l'étiquette par défaut sera utilisé.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (facultatif)</li>\n<li><code>message</code> String (facultatif) <em>macOS</em> - Message à afficher au-dessus des champs de texte.</li>\n<li><code>nameFieldLabel</code> String (facultatif) <em>macOS</em> - Étiquette personnalisé pour le texte affiché dans la zone de texte du nom de fichier.</li>\n<li><code>showsTagField</code> Boolean (facultatif) <em>macOS</em> - Affiche le champ de texte. <code>true</code> par défaut.</li>\n<li><code>properties</code> String[] (facultatif)<ul>\n<li><code>showHiddenFiles</code> - Affiche les fichiers cachés dans la boîte de dialogue.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Permet la création de nouveaux dossiers depuis la boîte de dialogue.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Considérer les paquets, tels que les dossiers <code>.app</code>, comme des dossiers plutôt que des fichiers.</li>\n<li><code>showOverwriteConfirmation</code> <em>Linux</em> - Définit si une boîte de dialogue de confirmation sera affichée lorsque l’utilisateur tape un nom de fichier déjà existant.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - N'ajoutez pas l'élément en cours d'ouverture à la liste des documents récents.</li>\n</ul></li>\n<li><code>securityScopedBookmarks</code> Boolean (facultatif) <em>macOS</em> <em>mas</em> - Créez un <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">marque-page à portée de sécurité</a> lorsque empaqueté pour le Mac App Store. Si cette option est activée et que le fichier n'existe pas encore, un fichier vide sera créé dans le chemin choisi.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>String | undefined</code>, le chemin du fichier choisi par l'utilisateur ; si la boîte de dialogue est annulée, elle retourne <code>undefined</code>.</p>\n<p>L'argument <code>browserWindow</code> permet à la boîte de dialogue de s'attacher elle-même à la fenêtre parent, la rendant modale.</p>\n<p>Les <code>filters</code> spécifie un tableau de types de fichiers qui peuvent être affichés, allez voir <code>dialog.showOpenDialog</code> pour un exemple.</p>\n<h3 id=\"dialogshowsavedialogbrowserwindow-options\"><a href=\"#dialogshowsavedialogbrowserwindow-options\"><code>dialog.showSaveDialog([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (facultatif)</li>\n<li>Objet <code>options</code><ul>\n<li><code>title</code> String (optional) - The dialog title. Ne peut pas être affiché sur certains environnements de bureau <em>Linux</em>.</li>\n<li><code>defaultPath</code> String (facultatif) - Chemin d'accès absolu, le chemin d'accès absolu du fichier, ou le nom du fichier à utiliser par défaut.</li>\n<li><code>buttonLabel</code> String (facultatif) - Étiquette personnalisé pour le bouton de confirmation. Si laissé vide, l'étiquette par défaut sera utilisé.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (facultatif)</li>\n<li><code>message</code> String (facultatif) <em>macOS</em> - Message à afficher au-dessus des champs de texte.</li>\n<li><code>nameFieldLabel</code> String (facultatif) <em>macOS</em> - Étiquette personnalisé pour le texte affiché dans la zone de texte du nom de fichier.</li>\n<li><code>showsTagField</code> Boolean (facultatif) <em>macOS</em> - Affiche le champ de texte, par défaut à <code>true</code>.</li>\n<li><code>properties</code> String[] (facultatif)<ul>\n<li><code>showHiddenFiles</code> - Affiche les fichiers cachés dans la boîte de dialogue.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Permet la création de nouveaux dossiers depuis la boîte de dialogue.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Considérer les paquets, tels que les dossiers <code>.app</code>, comme des dossiers plutôt que des fichiers.</li>\n<li><code>showOverwriteConfirmation</code> <em>Linux</em> - Définit si une boîte de dialogue de confirmation sera affichée lorsque l’utilisateur tape un nom de fichier déjà existant.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - N'ajoutez pas l'élément en cours d'ouverture à la liste des documents récents.</li>\n</ul></li>\n<li><code>securityScopedBookmarks</code> Boolean (facultatif) <em>macOS</em> <em>mas</em> - Créez un <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">marque-page à portée de sécurité</a> lorsque empaqueté pour le Mac App Store. Si cette option est activée et que le fichier n'existe pas encore, un fichier vide sera créé dans le chemin choisi.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Promise&#x3C;Object></code> - Résoudre avec un objet contenant les éléments suivants :</p>\n<ul>\n<li><code>annulé</code> Booléen - que la boîte de dialogue ait été annulée ou non.</li>\n<li><code>filePath</code> String (optional) - If the dialog is canceled, this will be <code>undefined</code>.</li>\n<li><code>bookmark</code> String (optional) <em>macOS</em> <em>mas</em> - Base64 encoded string which contains the security scoped bookmark data for the saved file. <code>securityScopedBookmarks</code> must be enabled for this to be present. (Pour les valeurs de retour, voir la <a href=\"#bookmarks-array\">table ici</a>.)</li>\n</ul>\n<p>L'argument <code>browserWindow</code> permet à la boîte de dialogue de s'attacher elle-même à la fenêtre parent, la rendant modale.</p>\n<p>Les <code>filters</code> spécifie un tableau de types de fichiers qui peuvent être affichés, allez voir <code>dialog.showOpenDialog</code> pour un exemple.</p>\n<p><strong>Remarque :</strong> Sur macOS, l'utilisation de la version asynchrone est recommandée pour éviter les problèmes lorsque étend et réduit la boîte de dialogue.</p>\n<h3 id=\"dialogshowmessageboxsyncbrowserwindow-options\"><a href=\"#dialogshowmessageboxsyncbrowserwindow-options\"><code>dialog.showMessageBoxSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (facultatif)</li>\n<li>Objet <code>options</code><ul>\n<li><code>message</code> Chaîne - Contenu de la boîte de message.</li>\n<li><code>type</code> String (facultatif) - Peut être <code>\"none\"</code>, <code>\"info\"</code>, <code>\"error\"</code>, <code>\"question\"</code> ou <code>\"warning\"</code>. Sur Windows, <code>\"question\"</code> affiche la même icône que <code>\"info\"</code>, sauf si vous définissez une icône en utilisant l'option <code>\"icône\"</code>. Sur macOS, <code>\"avertissement\"</code> et <code>\"erreur\"</code> affichent la même icône d'avertissement.</li>\n<li><code>boutons</code> String[] (facultatif) - Tableau de textes pour les boutons. On Windows, an empty array will result in one button labeled \"OK\".</li>\n<li><code>defaultId</code> Integer (facultatif) - Index du bouton dans le tableau des boutons qui seront sélectionnés par défaut lorsque la boîte de message s'ouvrira.</li>\n<li><code>title</code> String (facultatif) - Titre de la boîte de message, certaines plateformes ne l'afficheront pas.</li>\n<li><code>detail</code> String (facultatif) - Informations supplémentaires du message.</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (facultatif)</li>\n<li><code>textWidth</code> Integer (optional) <em>macOS</em> - Custom width of the text in the message box.</li>\n<li><code>cancelId</code> Integer (facultatif) - L'index du bouton à utiliser pour annuler la boîte de dialogue, via la touche <code>Esc</code>. Par défaut, ceci est assigné au premier bouton avec l'étiquette \"annuler\" ou \"non\". Si aucun bouton de ce type n'existe et que cette option n'est pas définie, <code>0</code> sera utilisé comme valeur de retour .</li>\n<li><code>noLink</code> Booléen (optionnel) - Sous Windows, Electron essaiera de déterminer lequel des les boutons `<code>sont des boutons courants (comme \"Annuler\" ou \"Oui\"), et affichent le d'autres comme liens de commande dans le dialogue. Cela peut faire apparaître la boîte de dialogue dans le style des applications Windows modernes. Si vous n'aimez pas ce comportement, vous pouvez définir</code>noLink<code>à</code>true`.</li>\n<li><code>normalizeAccessKeys</code> Boolean (facultatif) - Normalise les clés d'accès au clavier sur toutes les plateformes. Par défaut la valeur est <code>false</code>. Activer ceci suppose que <code>&#x26;</code> est utilisé dans les étiquettes des boutons pour le placement de la touche d'accès du raccourci clavier et les étiquettes seront converties pour qu'elles fonctionnent correctement sur chaque plateforme, <code>&#x26;</code> les caractères sont supprimés sur macOS, convertis en <code>_</code> sous Linux, et intactés sur Windows. Par exemple, une étiquette de bouton de <code>Vie&#x26;w</code> sera converti en <code>Vie_w</code> sous Linux et <code>Vie</code> sous macOS et peut être sélectionné via <code>Alt-W</code> sur Windows et Linux.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Integer</code> - l'index du bouton cliqué.</p>\n<p>Affiche une boîte de message, elle bloque le processus jusqu'à ce que la boîte de message soit fermée. It returns the index of the clicked button.</p>\n<p>L'argument <code>browserWindow</code> permet à la boîte de dialogue de s'attacher elle-même à la fenêtre parent, la rendant modale. If <code>browserWindow</code> is not shown dialog will not be attached to it. In such case it will be displayed as an independent window.</p>\n<h3 id=\"dialogshowmessageboxbrowserwindow-options\"><a href=\"#dialogshowmessageboxbrowserwindow-options\"><code>dialog.showMessageBox([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (facultatif)</li>\n<li>Objet <code>options</code><ul>\n<li><code>message</code> Chaîne - Contenu de la boîte de message.</li>\n<li><code>type</code> String (facultatif) - Peut être <code>\"none\"</code>, <code>\"info\"</code>, <code>\"error\"</code>, <code>\"question\"</code> ou <code>\"warning\"</code>. Sur Windows, <code>\"question\"</code> affiche la même icône que <code>\"info\"</code>, sauf si vous définissez une icône en utilisant l'option <code>\"icône\"</code>. Sur macOS, <code>\"avertissement\"</code> et <code>\"erreur\"</code> affichent la même icône d'avertissement.</li>\n<li><code>boutons</code> String[] (facultatif) - Tableau de textes pour les boutons. On Windows, an empty array will result in one button labeled \"OK\".</li>\n<li><code>defaultId</code> Integer (facultatif) - Index du bouton dans le tableau des boutons qui seront sélectionnés par défaut lorsque la boîte de message s'ouvrira.</li>\n<li><code>signal</code> AbortSignal (optional) - Pass an instance of <a href=\"https://nodejs.org/api/globals.html#globals_class_abortsignal\">AbortSignal</a> to optionally close the message box, the message box will behave as if it was cancelled by the user. On macOS, <code>signal</code> does not work with message boxes that do not have a parent window, since those message boxes run synchronously due to platform limitations.</li>\n<li><code>title</code> String (facultatif) - Titre de la boîte de message, certaines plateformes ne l'afficheront pas.</li>\n<li><code>detail</code> String (facultatif) - Informations supplémentaires du message.</li>\n<li><code>checkboxLabel</code> String (facultatif) - Si fourni, la case de message inclura une case à cocher avec l'étiquette donnée.</li>\n<li><code>checkboxChecked</code> Boolean (optional) - Initial checked state of the checkbox. <code>false</code> par défaut.</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> (facultatif)</li>\n<li><code>textWidth</code> Integer (optional) <em>macOS</em> - Custom width of the text in the message box.</li>\n<li><code>cancelId</code> Integer (facultatif) - L'index du bouton à utiliser pour annuler la boîte de dialogue, via la touche <code>Esc</code>. Par défaut, ceci est assigné au premier bouton avec l'étiquette \"annuler\" ou \"non\". Si aucun bouton de ce type n'existe et que cette option n'est pas définie, <code>0</code> sera utilisé comme valeur de retour .</li>\n<li><code>noLink</code> Booléen (optionnel) - Sous Windows, Electron essaiera de déterminer lequel des les boutons `<code>sont des boutons courants (comme \"Annuler\" ou \"Oui\"), et affichent le d'autres comme liens de commande dans le dialogue. Cela peut faire apparaître la boîte de dialogue dans le style des applications Windows modernes. Si vous n'aimez pas ce comportement, vous pouvez définir</code>noLink<code>à</code>true`.</li>\n<li><code>normalizeAccessKeys</code> Boolean (facultatif) - Normalise les clés d'accès au clavier sur toutes les plateformes. Par défaut la valeur est <code>false</code>. Activer ceci suppose que <code>&#x26;</code> est utilisé dans les étiquettes des boutons pour le placement de la touche d'accès du raccourci clavier et les étiquettes seront converties pour qu'elles fonctionnent correctement sur chaque plateforme, <code>&#x26;</code> les caractères sont supprimés sur macOS, convertis en <code>_</code> sous Linux, et intactés sur Windows. Par exemple, une étiquette de bouton de <code>Vie&#x26;w</code> sera converti en <code>Vie_w</code> sous Linux et <code>Vie</code> sous macOS et peut être sélectionné via <code>Alt-W</code> sur Windows et Linux.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Promise&#x3C;Object></code> - résout avec une promesse contenant les propriétés suivantes :</p>\n<ul>\n<li><code>response</code> Number - The index of the clicked button.</li>\n<li><code>checkboxChecked</code> Boolean - The checked state of the checkbox if <code>checkboxLabel</code> was set. Sinon <code>false</code>.</li>\n</ul>\n<p>Shows a message box.</p>\n<p>L'argument <code>browserWindow</code> permet à la boîte de dialogue de s'attacher elle-même à la fenêtre parent, la rendant modale.</p>\n<h3 id=\"dialogshowerrorboxtitle-content\"><a href=\"#dialogshowerrorboxtitle-content\"><code>dialog.showErrorBox(title, content)</code></a></h3>\n<ul>\n<li><code>titre</code> Chaîne - Le titre à afficher dans la boîte d'erreur.</li>\n<li><code>contenu</code> Chaîne - Le contenu du texte à afficher dans la boîte d'erreur.</li>\n</ul>\n<p>Affiche une boîte de dialogue modale qui affiche un message d'erreur.</p>\n<p>Cette API peut être appelée en toute sécurité avant l'évènement <code>prêt</code> que le module <code>app</code> émet, il est généralement utilisé pour signaler des erreurs au début du démarrage. Si appelé avant l'application <code>prêt</code>événement sous Linux, le message sera émis sur stderr, et aucune fenêtre GUI n'apparaîtra.</p>\n<h3 id=\"dialogshowcertificatetrustdialogbrowserwindow-options-macos-windows\"><a href=\"#dialogshowcertificatetrustdialogbrowserwindow-options-macos-windows\"><code>dialog.showCertificateTrustDialog([browserWindow, ]options)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (facultatif)</li>\n<li>Objet <code>options</code><ul>\n<li><code>certificat</code> <a href=\"/docs/api/structures/certificate\">certificat</a> - Le certificat de confiance/importation.</li>\n<li><code>message</code> String - Le message à afficher à l'utilisateur.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Promise&#x3C;void></code> - résout lorsque la boîte de dialogue de confiance du certificat est affichée.</p>\n<p>Sur macOS, ceci affiche une boîte de dialogue modale présentant un message, les informations du certificat et donnant à l'utilisateur la possibilité de se fier/importer le certificat. Si vous fournissez une argument <code>browserWindow</code>, la boîte de dialogue sera attachée à la fenêtre parente.</p>\n<p>Sous Windows, les options sont plus limitées, en raison des API Win32 utilisées:</p>\n<ul>\n<li>L'argument <code>message</code> n'est pas utilisé, car l'OS fournit sa propre boîte de dialogue de confirmation.</li>\n<li>L'argument <code>browserWindow</code> est ignoré car il n'est pas possible de rendre cette fenêtre de confirmation modale.</li>\n</ul>\n<h2 id=\"tableau-des-signets\"><a href=\"#tableau-des-signets\">Tableau des signets</a></h2>\n<p><code>showOpenDialog</code>, <code>showOpenDialogSync</code>, <code>showSaveDialog</code>, and <code>showSaveDialogSync</code> will return a <code>bookmarks</code> array.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Type de compilation</th><th>securityScopedBookmarks boolean</th><th align=\"center\">Return Type</th><th>Return Value</th></tr></thead><tbody><tr><td>macOS mas</td><td>True</td><td align=\"center\">Succès</td><td><code>['LONGBOOKMARKSTRING']</code></td></tr><tr><td>macOS mas</td><td>True</td><td align=\"center\">Erreur</td><td><code>['']</code> (array of empty string)</td></tr><tr><td>macOS mas</td><td>False</td><td align=\"center\">NA</td><td><code>[]</code> (empty array)</td></tr><tr><td>non mas</td><td>any</td><td align=\"center\">NA</td><td><code>[]</code> (empty array)</td></tr></tbody></table>\n<h2 id=\"feuilles\"><a href=\"#feuilles\">Feuilles</a></h2>\n<p>Sur macOS, les dialogues sont présentés comme des feuilles attachées à une fenêtre si vous fournissez une référence <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> dans le paramètre <code>browserWindow</code>, ou modales si aucune fenêtre n'est fournie.</p>\n<p>Vous pouvez appeler <code>BrowserWindow.getCurrentWindow().setSheetOffset(offset)</code> pour changer le décalage depuis la fenêtre où les feuilles sont attachées.</p>",
      "title": "dialog",
      "description": "Affiche une boîte de dialogue du système natif pour ouvrir et enregistrer des fichiers, alertes, etc..."
    },
    "/docs/api/structures/display": {
      "locale": "fr-FR",
      "slug": "display",
      "href": "/docs/api/structures/display",
      "crowdinFileId": "256427",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/display.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"display-object\"><a href=\"#display-object\">Display Object</a></h1>\n<ul>\n<li><code>id</code> Number - Unique identifier associated with the display.</li>\n<li><code>rotation</code> Number - Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.</li>\n<li><code>scaleFactor</code> Number - Output device's pixel scale factor.</li>\n<li><code>touchSupport</code> String - Can be <code>available</code>, <code>unavailable</code>, <code>unknown</code>.</li>\n<li><code>monochrome</code> Boolean - Whether or not the display is a monochrome display.</li>\n<li><code>accelerometerSupport</code> String - Can be <code>available</code>, <code>unavailable</code>, <code>unknown</code>.</li>\n<li><code>colorSpace</code> String -  represent a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions</li>\n<li><code>colorDepth</code> Number - The number of bits per pixel.</li>\n<li><code>depthPerComponent</code> Number - The number of bits per color component.</li>\n<li><code>displayFrequency</code> Number - The display refresh rate.</li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - the bounds of the display in DIP points.</li>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a></li>\n<li><code>workArea</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - the work area of the display in DIP points.</li>\n<li><code>workAreaSize</code> <a href=\"/docs/api/structures/size\">Size</a></li>\n<li><code>internal</code> Boolean - <code>true</code> for an internal display and <code>false</code> for an external display</li>\n</ul>\n<p>The <code>Display</code> object represents a physical display connected to the system. A fake <code>Display</code> may exist on a headless system, or a <code>Display</code> may correspond to a remote, virtual display.</p>",
      "title": "Display Object",
      "description": ""
    },
    "/docs/api/dock": {
      "locale": "fr-FR",
      "slug": "dock",
      "href": "/docs/api/dock",
      "crowdinFileId": "256311",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/dock.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-dock\"><a href=\"#class-dock\">Class: Dock</a></h2>\n<blockquote>\n<p>Control your app in the macOS dock</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>The following example shows how to bounce your icon on the dock.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.dock.bounce()\n</code></pre>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<h4 id=\"dockbouncetype-macos\"><a href=\"#dockbouncetype-macos\"><code>dock.bounce([type])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>critical</code> or <code>informational</code>. The default is <code>informational</code></li>\n</ul>\n<p>Returns <code>Integer</code> - an ID representing the request.</p>\n<p>Lorsque la <code>critical</code> est passé, l’icône du dock rebondira jusqu'à ce que l’application redevienne active ou que la requête est annulée.</p>\n<p>When <code>informational</code> is passed, the dock icon will bounce for one second. However, the request remains active until either the application becomes active or the request is canceled.</p>\n<p><strong>Nota Bene:</strong> This method can only be used while the app is not focused; when the app is focused it will return -1.</p>\n<h4 id=\"dockcancelbounceid-macos\"><a href=\"#dockcancelbounceid-macos\"><code>dock.cancelBounce(id)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Annule le rebond de l'<code>id</code>.</p>\n<h4 id=\"dockdownloadfinishedfilepath-macos\"><a href=\"#dockdownloadfinishedfilepath-macos\"><code>dock.downloadFinished(filePath)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n</ul>\n<p>Fait rebondir la pile de téléchargements si le chemin d'accès se trouve le dossier Téléchargements.</p>\n<h4 id=\"docksetbadgetext-macos\"><a href=\"#docksetbadgetext-macos\"><code>dock.setBadge(text)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Définit la chaîne de caractères à afficher dans la zone du badge du dock.</p>\n<h4 id=\"dockgetbadge-macos\"><a href=\"#dockgetbadge-macos\"><code>dock.getBadge()</code> <em>macOS</em></a></h4>\n<p>Retourne <code>String</code> - Le texte du badge du dock.</p>\n<h4 id=\"dockhide-macos\"><a href=\"#dockhide-macos\"><code>dock.hide()</code> <em>macOS</em></a></h4>\n<p>Masque l’icône du dock.</p>\n<h4 id=\"dockshow-macos\"><a href=\"#dockshow-macos\"><code>dock.show()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the dock icon is shown.</p>\n<h4 id=\"dockisvisible-macos\"><a href=\"#dockisvisible-macos\"><code>dock.isVisible()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the dock icon is visible.</p>\n<h4 id=\"docksetmenumenu-macos\"><a href=\"#docksetmenumenu-macos\"><code>dock.setMenu(menu)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>menu</code> <a href=\"/docs/api/menu\">Menu</a></li>\n</ul>\n<p>Sets the application's [dock menu][dock-menu].</p>\n<h4 id=\"dockgetmenu-macos\"><a href=\"#dockgetmenu-macos\"><code>dock.getMenu()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Menu | null</code> - The application's [dock menu][dock-menu].</p>\n<h4 id=\"dockseticonimage-macos\"><a href=\"#dockseticonimage-macos\"><code>dock.setIcon(image)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>Définit l’<code>image</code> associée à l'icône du dock.</p>",
      "title": "Dock",
      "description": "Control your app in the macOS dock"
    },
    "/docs/api/download-item": {
      "locale": "fr-FR",
      "slug": "download-item",
      "href": "/docs/api/download-item",
      "crowdinFileId": "256313",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/download-item.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe--downloaditem\"><a href=\"#classe--downloaditem\">Classe : DownloadItem</a></h2>\n<blockquote>\n<p>Gère les téléchargements de fichiers depuis des sources distantes.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>DownloadItem</code> est un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a> qui représente un élément de téléchargement dans Electron. Il est utilisé dans l'événement <code>will-download</code> de la classe <code>Session</code>, et permet aux utilisateurs de gérer les fichiers en cours de téléchargement.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Dans le processus main.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.session.on(<span class=\"hljs-string\">'will-download'</span>, (event, item, webContents) => {\n  <span class=\"hljs-comment\">// Set the save path, making Electron not to prompt a save dialog.</span>\n  item.setSavePath(<span class=\"hljs-string\">'/tmp/save.pdf'</span>)\n\n  item.on(<span class=\"hljs-string\">'updated'</span>, (event, state) => {\n    <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'interrupted'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Le téléchargement est interrompu mais peut être redémarrer'</span>)\n    } <span class=\"hljs-keyword\">else</span> <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'progressing'</span>) {\n      <span class=\"hljs-keyword\">if</span> (item.isPaused()) {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Le téléchargement est en pause'</span>)\n      } <span class=\"hljs-keyword\">else</span> {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Received bytes: <span class=\"hljs-subst\">${item.getReceivedBytes()}</span>`</span>)\n      }\n    }\n  })\n  item.once(<span class=\"hljs-string\">'done'</span>, (event, state) => {\n    <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'completed'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Téléchargement réussi'</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Téléchargement échoué : <span class=\"hljs-subst\">${state}</span>`</span>)\n    }\n  })\n})\n</code></pre>\n<h3 id=\"événements-dinstance\"><a href=\"#événements-dinstance\">Événements d’instance</a></h3>\n<h4 id=\"événement-updated\"><a href=\"#événement-updated\">Événement 'updated'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>state</code> Chaîne de caratères - Peut être <code>progressing</code> ou <code>interrupted</code>.</li>\n</ul>\n<p>Émis lorsque le téléchargement a été mis à jour et n'est pas fini.</p>\n<p>Le <code>state</code> peut être un de ces cas :</p>\n<ul>\n<li><code>progressing</code> - Le téléchargement est en cours.</li>\n<li><code>interrupted</code> - Le téléchargement a été interrompu et peut être repris.</li>\n</ul>\n<h4 id=\"événement-done\"><a href=\"#événement-done\">Événement 'done'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>state</code> Chaîne de caratères - Peut être <code>completed</code>, <code>cancelled</code> ou <code>interrupted</code>.</li>\n</ul>\n<p>Emitted when the download is in a terminal state. This includes a completed download, a cancelled download (via <code>downloadItem.cancel()</code>), and interrupted download that can't be resumed.</p>\n<p>Le <code>state</code> peut être un de ces cas :</p>\n<ul>\n<li><code>completed</code> - Le téléchargement s'est terminé avec succès.</li>\n<li><code>cancelled</code> - Le téléchargement a été annulé.</li>\n<li><code>interrupted</code> - Le téléchargement a été interrompu et ne peux pas être repris.</li>\n</ul>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<p>L'objet <code>downloadItem</code> dispose des méthodes suivantes :</p>\n<h4 id=\"downloaditemsetsavepathpath\"><a href=\"#downloaditemsetsavepathpath\"><code>downloadItem.setSavePath(path)</code></a></h4>\n<ul>\n<li><code>path</code> String - Définit le chemin d'accès pour le téléchargement.</li>\n</ul>\n<p>Cet API est seulement disponible dans la fonction de rappel de <code>will-download</code> dans session. If <code>path</code> doesn't exist, Electron will try to make the directory recursively. Si l'utilisateur ne définit pas le chemin de sauvegarde via l'API, Electron utilisera la routine d'origine pour déterminer le chemin de sauvegarde ; cela demande généralement une boîte de dialogue de sauvegarde.</p>\n<h4 id=\"downloaditemgetsavepath\"><a href=\"#downloaditemgetsavepath\"><code>downloadItem.getSavePath()</code></a></h4>\n<p>Returns <code>String</code> - The save path of the download item. This will be either the path set via <code>downloadItem.setSavePath(path)</code> or the path selected from the shown save dialog.</p>\n<h4 id=\"downloaditemsetsavedialogoptionsoptions\"><a href=\"#downloaditemsetsavedialogoptionsoptions\"><code>downloadItem.setSaveDialogOptions(options)</code></a></h4>\n<ul>\n<li><code>options</code> SaveDialogOptions - Définit les options de la boîte de dialogue de sauvegarde des fichiers. Cet objet a la même comme le paramètre <code>options</code> de <a href=\"/docs/api/dialog\"><code>dialog.showSaveDialog()</code></a>.</li>\n</ul>\n<p>This API allows the user to set custom options for the save dialog that opens for the download item by default. Cet API est seulement disponible dans la fonction de rappel de <code>will-download</code> dans session.</p>\n<h4 id=\"downloaditemgetsavedialogoptions\"><a href=\"#downloaditemgetsavedialogoptions\"><code>downloadItem.getSaveDialogOptions()</code></a></h4>\n<p>Retourne <code>SaveDialogOptions</code> - Retourne l'objet précédemment défini par <code>downloadItem.setSaveDialogOptions(options)</code>.</p>\n<h4 id=\"downloaditempause\"><a href=\"#downloaditempause\"><code>downloadItem.pause()</code></a></h4>\n<p>Met en pause le téléchargement.</p>\n<h4 id=\"downloaditemispaused\"><a href=\"#downloaditemispaused\"><code>downloadItem.isPaused()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si le téléchargement est en pause.</p>\n<h4 id=\"downloaditemresume\"><a href=\"#downloaditemresume\"><code>downloadItem.resume()</code></a></h4>\n<p>Reprend le téléchargement qui a été mis en pause.</p>\n<p><strong>Note:</strong> To enable resumable downloads the server you are downloading from must support range requests and provide both <code>Last-Modified</code> and <code>ETag</code> header values. Sinon <code>resume()</code> va rejeter les octets reçus précédemment et redémarrer le téléchargement depuis le début.</p>\n<h4 id=\"downloaditemcanresume\"><a href=\"#downloaditemcanresume\"><code>downloadItem.canResume()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si le téléchargement peut être repris.</p>\n<h4 id=\"downloaditemcancel\"><a href=\"#downloaditemcancel\"><code>downloadItem.cancel()</code></a></h4>\n<p>Annule le téléchargement.</p>\n<h4 id=\"downloaditemgeturl\"><a href=\"#downloaditemgeturl\"><code>downloadItem.getURL()</code></a></h4>\n<p>Retourne <code>String</code> - L'URL d'origine d'où l'élément est téléchargé.</p>\n<h4 id=\"downloaditemgetmimetype\"><a href=\"#downloaditemgetmimetype\"><code>downloadItem.getMimeType()</code></a></h4>\n<p>Retourne <code>String</code> - Le mime type du fichier.</p>\n<h4 id=\"downloaditemhasusergesture\"><a href=\"#downloaditemhasusergesture\"><code>downloadItem.hasUserGesture()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si le téléchargement à des gestures.</p>\n<h4 id=\"downloaditemgetfilename\"><a href=\"#downloaditemgetfilename\"><code>downloadItem.getFilename()</code></a></h4>\n<p>Retourne <code>String</code> - le nom du fichier du téléchargement.</p>\n<p><strong>Note:</strong> The file name is not always the same as the actual one saved in local disk. Si l'utilisateur modifie le nom du fichier dans la boîte de dialogue de sauvegarde, alors le nom actuel et le nom du fichier sauvegardé seront différent.</p>\n<h4 id=\"downloaditemgettotalbytes\"><a href=\"#downloaditemgettotalbytes\"><code>downloadItem.getTotalBytes()</code></a></h4>\n<p>Retourne <code>Integer</code> - La taille totale en octets du téléchargement.</p>\n<p>Si la taille est inconnue, retourne 0.</p>\n<h4 id=\"downloaditemgetreceivedbytes\"><a href=\"#downloaditemgetreceivedbytes\"><code>downloadItem.getReceivedBytes()</code></a></h4>\n<p>Retourne <code>Integer</code> - Le nombre d'octets reçu du téléchargement.</p>\n<h4 id=\"downloaditemgetcontentdisposition\"><a href=\"#downloaditemgetcontentdisposition\"><code>downloadItem.getContentDisposition()</code></a></h4>\n<p>Retourne <code>String</code> - Le champ Content-Disposition venant de l'en-tête de la réponse.</p>\n<h4 id=\"downloaditemgetstate\"><a href=\"#downloaditemgetstate\"><code>downloadItem.getState()</code></a></h4>\n<p>Returns <code>String</code> - The current state. Can be <code>progressing</code>, <code>completed</code>, <code>cancelled</code> or <code>interrupted</code>.</p>\n<p><strong>Note:</strong> The following methods are useful specifically to resume a <code>cancelled</code> item when session is restarted.</p>\n<h4 id=\"downloaditemgeturlchain\"><a href=\"#downloaditemgeturlchain\"><code>downloadItem.getURLChain()</code></a></h4>\n<p>Retourne <code>String[]</code> - La chaîne d'URL complète de l'élément incluant toutes les redirections.</p>\n<h4 id=\"downloaditemgetlastmodifiedtime\"><a href=\"#downloaditemgetlastmodifiedtime\"><code>downloadItem.getLastModifiedTime()</code></a></h4>\n<p>Retourne <code>String</code> - La valeur de l'en-tête Last-Modified.</p>\n<h4 id=\"downloaditemgetetag\"><a href=\"#downloaditemgetetag\"><code>downloadItem.getETag()</code></a></h4>\n<p>Retourne <code>String</code> - La valeur de l'en-tête ETag.</p>\n<h4 id=\"downloaditemgetstarttime\"><a href=\"#downloaditemgetstarttime\"><code>downloadItem.getStartTime()</code></a></h4>\n<p>Retourne <code>Double</code> - Le nombre de secondes depuis l'époch UNIX lorsque le téléchargement s'est lancé.</p>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<h4 id=\"chemin-daccès-à-la-sauvegarde\"><a href=\"#chemin-daccès-à-la-sauvegarde\"><code>chemin d'accès à la sauvegarde</code></a></h4>\n<p>Une propriété <code>String</code> qui détermine le chemin du fichier de sauvegarde de l'élément téléchargé.</p>\n<p>La propriété n'est disponible que dans la fonction de rappel <code>will-download</code> de la session. Si l'utilisateur ne définit pas le chemin de sauvegarde via la propriété, Electron utilisera la routine d'origine pour déterminer le chemin de sauvegarde ; cela demande généralement une boîte de dialogue de sauvegarde.</p>",
      "title": "Classe : DownloadItem",
      "description": "Gère les téléchargements de fichiers depuis des sources distantes."
    },
    "/docs/tutorial/electron-timelines": {
      "locale": "fr-FR",
      "slug": "electron-timelines",
      "href": "/docs/tutorial/electron-timelines",
      "crowdinFileId": "256197",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/electron-timelines.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"chronologie-de-sortie-délectron\"><a href=\"#chronologie-de-sortie-délectron\">Chronologie de sortie d'électron</a></h1>\n<p>Remarques particulières:</p>\n<ul>\n<li>Les dates <code>-beta.1</code> et <code>stables</code> sont nos dates de sortie.</li>\n<li>Nous nous efforçons d'obtenir des versions bêta hebdomadaires, mais nous publions souvent plus de bêtas que prévu.</li>\n<li>Toutes les dates sont nos objectifs, mais il peut y avoir des raisons d’ajuster la date limite, telles que des problèmes de sécurité.</li>\n<li>Consultez l'article <a href=\"https://electronjs.org/blog/electron-5-0-timeline\">5.0.0 Timeline</a> sur le blog Timeline pour plus d'informations sur la publication de nos dates de publication.</li>\n<li>Depuis Electron 6.0, nous ciblons toute nouvelle version de Chromium et publions notre version stable le même jour que Chrome. Vous pouvez vous référer au calendrier de publication de Chromium <a href=\"https://chromiumdash.appspot.com/schedule\">ici</a>. Consultez <a href=\"https://www.electronjs.org/blog/12-week-cadence\">le blog de cadence des nouvelle versions d'Electron</a> pour plus de détails sur notre calendrier de sortie.</li>\n<li>Electron 15.0 n'inclura qu'une version Alpha spéciale. À partir d’Electron 16.0, nous publierons sur une cadence de 8 semaines. Pour plus de détails, consultez le nouveau billet de blog cadence de 8 semaines de <a href=\"https://www.electronjs.org/blog/8-week-cadence\">Electron</a> .</li>\n</ul>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Electron</th><th>Alpha</th><th>Beta</th><th>Stable</th><th>Chrome</th><th>Node</th></tr></thead><tbody><tr><td>2.0.0</td><td>--</td><td>2018-Feb-21</td><td>2018-May-01</td><td>M61</td><td>v8.9</td></tr><tr><td>3.0.0</td><td>--</td><td>2018-Jun-21</td><td>2018-Sep-18</td><td>M66</td><td>v10.2</td></tr><tr><td>4.0.0</td><td>--</td><td>2018-Oct-11</td><td>2018-Dec-20</td><td>M69</td><td>v10.11</td></tr><tr><td>5.0.0</td><td>--</td><td>2019-Jan-22</td><td>2019-Apr-24</td><td>M73</td><td>v12.0</td></tr><tr><td>6.0.0</td><td>--</td><td>2019-May-01</td><td>2019-Jul-30</td><td>M76</td><td>v12.4</td></tr><tr><td>7.0.0</td><td>--</td><td>2019-Aug-01</td><td>2019-Oct-22</td><td>M78</td><td>v12.8</td></tr><tr><td>8.0.0</td><td>--</td><td>2019-Oct-24</td><td>2020-Feb-04</td><td>M80</td><td>v12.13</td></tr><tr><td>9.0.0</td><td>--</td><td>2020-Feb-06</td><td>2020-May-19</td><td>M83</td><td>v12.14</td></tr><tr><td>10.0.0</td><td>--</td><td>2020-May-21</td><td>2020-Aug-25</td><td>M85</td><td>v12.16</td></tr><tr><td>11.0.0</td><td>--</td><td>2020-Aug-27</td><td>2020-Nov-17</td><td>M87</td><td>v12.18</td></tr><tr><td>12.0.0</td><td>--</td><td>2020-Nov-19</td><td>2021-Mar-02</td><td>M89</td><td>v14.16</td></tr><tr><td>13.0.0</td><td>--</td><td>2021-Mar-04</td><td>2021-May-25</td><td>M91</td><td>v14.16</td></tr><tr><td>14.0.0</td><td>--</td><td>2021-May-27</td><td>2021-Aug-31</td><td>M93</td><td>v14.17</td></tr><tr><td>15.0.0</td><td>2021-Jul-20</td><td>2021-Sep-01</td><td>2021-Sep-21</td><td>M94</td><td>v16.5</td></tr><tr><td>16.0.0</td><td>--</td><td>2021-Sep-23</td><td>2021-Nov-16</td><td>M96</td><td>TBD</td></tr></tbody></table>",
      "title": "Chronologie de sortie d'électron",
      "description": ""
    },
    "/docs/tutorial/electron-versioning": {
      "locale": "fr-FR",
      "slug": "electron-versioning",
      "href": "/docs/tutorial/electron-versioning",
      "crowdinFileId": "256199",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/electron-versioning.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"la-gestion-de-versions-delectron\"><a href=\"#la-gestion-de-versions-delectron\">La gestion de versions d'Electron</a></h1>\n<blockquote>\n<p>Un descriptif de la politique de gestion de version et d'implémentation.</p>\n</blockquote>\n<p>As of version 2.0.0, Electron follows <a href=\"#semver\">SemVer</a>. The following command will install the most recent stable build of Electron:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron\n</code></pre>\n<p>Pour mettre à jour un projet existant afin d'utiliser la dernière version stable :</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron@latest\n</code></pre>\n<h2 id=\"version-1x\"><a href=\"#version-1x\">Version 1.x</a></h2>\n<p>Electron versions <em>&#x3C; 2.0</em> did not conform to the <a href=\"https://semver.org\">SemVer</a> spec: major versions corresponded to end-user API changes, minor versions corresponded to Chromium major releases, and patch versions corresponded to new features and bug fixes. Bien que pratique pour les développeurs qui fusionnent des fonctionnalités, cela crée des problèmes pour les développeurs d'applications côté client. Les cycles de tests QA d'applications majeures comme Slack, Stride, Teams, Skype, VS Code, Atom et Desktop peuvent être longs et la stabilité est un résultat très attendu. Il y a un grand risque d'inclure de nouvelles fonctionnalités en tentant de récupérer des correctifs.</p>\n<p>Voici un exemple de la stratégie 1.x :</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-0.png\" alt=\"1.x Versioning\"></p>\n<p>Une application développée avec la <code>1.8.1</code> ne peut pas avoir les corrections d'anomalies de la <code>1.8.3</code> sans inclure la fonctionnalité de la <code>1.8.2</code>, ou faire un rétroportage de la correction tout en maintenant une nouvelle ligne de versionnage.</p>\n<h2 id=\"version-20-et-suivantes\"><a href=\"#version-20-et-suivantes\">Version 2.0 et suivantes</a></h2>\n<p>There are several major changes from our 1.x strategy outlined below. Each change is intended to satisfy the needs and priorities of developers/maintainers and app developers.</p>\n<ol>\n<li>Strict use of SemVer</li>\n<li>Introduction de semver compatible avec les tags <code>-beta</code></li>\n<li>Introduction des <a href=\"https://conventionalcommits.org/\">messages de commit conventionnels</a></li>\n<li>Branches de stabilisation bien définies</li>\n<li>La branche <code>master</code> est sans version; seules les branches de stabilisation contiennent des informations de version</li>\n</ol>\n<p>Nous expliquerons en détail comment les branches de git fonctionnent, comment le tagging npm fonctionne, ce que les développeurs devraient d'attendre à voir, et comment l'on peut rapporter les changements antérieurement.</p>\n<h1 id=\"semver\"><a href=\"#semver\">SemVer</a></h1>\n<p>From 2.0 onward, Electron will follow SemVer.</p>\n<p>Below is a table explicitly mapping types of changes to their corresponding category of SemVer (e.g. Major, Minor, Patch).</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Incréments de version Majeure</th><th>Incréments de version mineure</th><th>Incréments de version de Correctifs</th></tr></thead><tbody><tr><td>changement Electron qui altère l'API</td><td>changement Electron n'altérant pas l'API</td><td>Electron bug fixes</td></tr><tr><td>Mises à jour de la version majeure de Node.js</td><td>Mises à jour mineure de la version de Node.js</td><td>Mises à jour des correctifs de Node.js</td></tr><tr><td>mises à jour de version Chromium</td><td></td><td>mises à jour de correctifs Chromium</td></tr></tbody></table>\n<p>Note that most Chromium updates will be considered breaking. Fixes that can be backported will likely be cherry-picked as patches.</p>\n<h1 id=\"branches-de-stabilisation\"><a href=\"#branches-de-stabilisation\">Branches de stabilisation</a></h1>\n<p>Stabilization branches are branches that run parallel to master, taking in only cherry-picked commits that are related to security or stability. These branches are never merged back to master.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-1.png\" alt=\"Branches de stabilisation\"></p>\n<p>Since Electron 8, stabilization branches are always <strong>major</strong> version lines, and named against the following template <code>$MAJOR-x-y</code> e.g. <code>8-x-y</code>.  Prior to that we used <strong>minor</strong> version lines and named them as <code>$MAJOR-$MINOR-x</code> e.g. <code>2-0-x</code></p>\n<p>Nous permettons à plusieurs branches de stabilisation d'exister simultanément, et ont l'intention de supporter au moins deux en parallèle en tout temps, en rétroportant les correctifs de sécurité si nécessaire. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-2.png\" alt=\"Multiple Stability Branches\"></p>\n<p>Les anciennes lignes ne seront pas supportées par GitHub, mais d'autres groupes peuvent prendre possession et rétroporter des correctifs de stabilité et de sécurité par eux-mêmes. Nous décourageons cela, mais reconnaissons que cela facilite la vie de nombreux développeurs d'applications.</p>\n<h1 id=\"versions-bêta-et-corrections-de-bugs\"><a href=\"#versions-bêta-et-corrections-de-bugs\">Versions bêta et corrections de bugs</a></h1>\n<p>Les développeurs veulent savoir quelles versions sont fiables (<em>safe</em>). Même des fonctionnalités apparemment innocentes peuvent introduire des régressions dans des applications complexes. En même temps, verrouiller une version corrigée est dangereux parce que vous ignorez les correctifs de sécurité et les corrections de bogues qui sont peut-être apparues depuis votre version. Notre objectif est d'autoriser les plages de semver standards suivantes dans <code>package.json</code> :</p>\n<ul>\n<li>Utilisez <code>~2.0.0</code> pour admettre que les corrections liées à la stabilité ou à la sécurité dans votre version <code>2.0.0</code>.</li>\n<li>Utilisez <code>^2.0.0</code> pour admettre que la fonctionnalité <em>raisonnablement stable</em> ne soit pas cassée, ainsi que la sécurité et les corrections de bogues.</li>\n</ul>\n<p>Ce qui est important dans le deuxième point, c'est que les applications utilisant <code>^</code> devraient quand même pouvoir s'attendre à un niveau raisonnable de stabilité. To accomplish this, SemVer allows for a <em>pre-release identifier</em> to indicate a particular version is not yet <em>safe</em> or <em>stable</em>.</p>\n<p>Quoi que vous choisissiez, vous devrez périodiquement remonter la version dans votre <code>package.json</code> car les changements cassés sont un fait de la vie de Chromium.</p>\n<p>Le processus est le suivant:</p>\n<ol>\n<li>All new major and minor releases lines begin with a beta series indicated by SemVer prerelease tags of <code>beta.N</code>, e.g. <code>2.0.0-beta.1</code>. After the first beta, subsequent beta releases must meet all of the following conditions:<ol>\n<li>Le changement est compatible avec l'API ascendante (les dépréciations sont autorisées)</li>\n<li>Le risque de respect de notre calendrier de stabilité doit être faible.</li>\n</ol></li>\n<li>Si les modifications autorisées doivent être apportées une fois qu'une version est bêta, elles sont appliquées et la balise de prélocation est incrémentée, par exemple <code>2.0.0-beta.2</code>.</li>\n<li>Si une version bêta particulière est <em>généralement considérée</em> comme stable, elle sera relancée comme une version stable, ne changeant que les informations de version. par exemple <code>2.0.0</code>. Après la première stable, tous les changements doivent être des bogues rétrocompatibles ou des corrections de sécurité.</li>\n<li>Si de futures corrections de bogues ou de correctifs de sécurité doivent être faites une fois qu'une version est stable, elles sont appliquées et la version <em>patch</em> est incrémentée e. . <code>2.0.1</code>.</li>\n</ol>\n<p>Plus précisément, ce qui précède signifie :</p>\n<ol>\n<li>Admitting non-breaking-API changes before Week 3 in the beta cycle is okay, even if those changes have the potential to cause moderate side-effects.</li>\n<li>Admitting feature-flagged changes, that do not otherwise alter existing code paths, at most points in the beta cycle is okay. Users can explicitly enable those flags in their apps.</li>\n<li>Admitting features of any sort after Week 3 in the beta cycle is 👎 without a very good reason.</li>\n</ol>\n<p>Pour chaque bosse majeure et mineure, vous devriez vous attendre à voir quelque chose comme ceci:</p>\n<pre><code class=\"hljs language-plaintext\">2.0.0-beta.1\n2.0.0-beta.2\n2.0.0-beta.3\n2.0.0\n2.0.1\n2.0.2\n</code></pre>\n<p>Un exemple de cycle de vie dans les images :</p>\n<ul>\n<li>A new release branch is created that includes the latest set of features. It is published as <code>2.0.0-beta.1</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-3.png\" alt=\"New Release Branch\"></li>\n<li>A bug fix comes into master that can be backported to the release branch. The patch is applied, and a new beta is published as <code>2.0.0-beta.2</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-4.png\" alt=\"Bugfix Backport to Beta\"></li>\n<li>La bêta est considérée comme <em>généralement stable</em> et est à nouveau publiée comme non-bêta sous <code>2.0.0</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-5.png\" alt=\"Beta to Stable\"></li>\n<li>Later, a zero-day exploit is revealed and a fix is applied to master. We backport the fix to the <code>2-0-x</code> line and release <code>2.0.1</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-6.png\" alt=\"Security Backports\"></li>\n</ul>\n<p>A few examples of how various SemVer ranges will pick up new releases:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-7.png\" alt=\"Semvers and Releases\"></p>\n<h1 id=\"caractéristiques-manquantes--alphas\"><a href=\"#caractéristiques-manquantes--alphas\">Caractéristiques manquantes : Alphas</a></h1>\n<p>Notre stratégie comporte quelques compromis qui, pour l'instant, nous semblent appropriés. Le plus important est que les nouvelles fonctionnalités dans master peuvent prendre un certain temps avant d'atteindre une ligne de publication stable. Si vous voulez essayer une nouvelle fonctionnalité immédiatement, vous devrez construire Electron vous-même.</p>\n<p>À l'avenir, nous pourrions introduire l'un ou l'autre des éléments suivants:</p>\n<ul>\n<li>les versions alpha qui ont des contraintes de stabilité plus lâches aux bêta; par exemple, il serait permis d'admettre de nouvelles fonctionnalités alors qu'un canal de stabilité est en <em>alpha</em></li>\n</ul>\n<h1 id=\"indicateurs-de-fonctionnalités\"><a href=\"#indicateurs-de-fonctionnalités\">Indicateurs de fonctionnalités</a></h1>\n<p>Les drapeaux de fonctionnalités sont une pratique courante dans Chromium, et sont bien établis dans l'écosystème de développement Web. Dans le contexte d'Electron, une fonctionnalité ou une <strong>branche soft</strong> doit avoir les propriétés suivantes :</p>\n<ul>\n<li>il est activé/désactivé soit au moment de l'exécution, soit au moment de la construction ; nous ne prenons pas en charge le concept d'une fonctionnalité à portée de requête</li>\n<li>il segmente complètement les chemins de code nouveaux et anciens; refactoring l'ancien code pour supporter une nouvelle fonctionnalité <em>violation</em> le contrat de trait-flag</li>\n<li>les drapeaux de fonctionnalités sont éventuellement supprimés après la publication de la fonctionnalité</li>\n</ul>\n<h1 id=\"commits-sémantiques\"><a href=\"#commits-sémantiques\">Commits sémantiques</a></h1>\n<p>Nous cherchons à accroître la clarté à tous les niveaux du processus de mise à jour et de publication. À partir de <code>2.0.0</code> nous aurons besoin que les demandes de fusion adhèrent à la spécification <a href=\"https://conventionalcommits.org/\">Engagements conventionnels</a>, qui peut être résumée comme suit :</p>\n<ul>\n<li>\n<p>Commits that would result in a SemVer <strong>major</strong> bump must start their body with <code>BREAKING CHANGE:</code>.</p>\n</li>\n<li>\n<p>Commits that would result in a SemVer <strong>minor</strong> bump must start with <code>feat:</code>.</p>\n</li>\n<li>\n<p>Commits that would result in a SemVer <strong>patch</strong> bump must start with <code>fix:</code>.</p>\n</li>\n<li>\n<p>We allow squashing of commits, provided that the squashed message adheres to the above message format.</p>\n</li>\n<li>\n<p>Il est acceptable pour certains commits dans une pull request de ne pas inclure un préfixe sémantique, aussi longtemps que le titre de la demande d'ajout contient un message sémantique significatif.</p>\n</li>\n</ul>\n<h1 id=\"version-master\"><a href=\"#version-master\">Version <code>master</code></a></h1>\n<ul>\n<li>La branche <code>master</code> contiendra toujours la prochaine version majeure <code>X.0.0-nightly.DATE</code> dans son <code>package.json</code></li>\n<li>Les branches de version ne sont jamais fusionnées vers master</li>\n<li>Les branches de version <em>do</em> contiennent la version correcte dans leur <code>package.json</code></li>\n<li>As soon as a release branch is cut for a major, master must be bumped to the next major.  I.e. <code>master</code> is always versioned as the next theoretical release branch</li>\n</ul>",
      "title": "La gestion de versions d'Electron",
      "description": "Un descriptif de la politique de gestion de version et d'implémentation."
    },
    "/docs/development/electron-vs-nwjs": {
      "locale": "fr-FR",
      "slug": "electron-vs-nwjs",
      "href": "/docs/development/electron-vs-nwjs",
      "crowdinFileId": "256155",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/electron-vs-nwjs.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"différences-techniques-entre-electron-et-nwjs\"><a href=\"#différences-techniques-entre-electron-et-nwjs\">Différences techniques entre Electron et NW.js</a></h1>\n<p>Comme <a href=\"https://nwjs.io/\">NW.js</a>, Electron fournit une plate-forme pour développer des applications de bureau avec des technologies web. Les deux plates-formes permettent aux développeurs d'utiliser du HTML, JavaScript et Node.js. En surface, ils semblent très similaires.</p>\n<p>Il existe cependant des différences fondamentales entre les deux projets qui font d'Electron un produit complètement distinct de NW.js.</p>\n<h2 id=\"1-point-dentré-de-lapplication\"><a href=\"#1-point-dentré-de-lapplication\">1) Point d'entré de l'application</a></h2>\n<p>Dans NW.js, le point d'entrée principal d'une application peut être une page Web HTML. Dans dans ce cas, NW.js ouvrira le point d'entrée donné dans une fenêtre de navigateur.</p>\n<p>Dans Electron, le point d'entrée est toujours un script JavaScript. Au lieu de fournir un URL directement, vous créez manuellement une fenêtre de navigateur et chargez un fichier HTML en utilisant l'API. Vous devez également écouter les événements de fenêtre pour décider quand quitter l'application.</p>\n<p>Electron fonctionne plus comme le runtime Node.js. Electron's APIs are lower level so you can use it for browser testing in place of <a href=\"https://phantomjs.org/\">PhantomJS</a>.</p>\n<h2 id=\"2-intégration-de-node\"><a href=\"#2-intégration-de-node\">2) Intégration de Node</a></h2>\n<p>Dans NW.js, l'intégration de node dans les pages web requière de patcher Chronium pour fonctionner, alors que dans Electron nou avons choisi une approche différente d'intégrer la boucle <code>libuv</code> avec le protocole de communication de chaque plateforme pour éviter le piratage de Chronium. Voir le code <a href=\"https://github.com/electron/electron/tree/main/lib/common\"><code>node_bindings</code></a> pour comprendre comment cela a été fait.</p>\n<h2 id=\"3-contextes-javascript\"><a href=\"#3-contextes-javascript\">3) Contextes JavaScript</a></h2>\n<p>Si vous êtes un utilisateur expérimenté de NW.js, vous devez être familiarisé avec le concept de contexte de Node et contexte Web. Ces concepts ont été inventés à cause de la manière dont NW.js a été implémenté.</p>\n<p>En utilisant le <a href=\"https://github.com/nodejs/node-v0.x-archive/commit/756b622\">multi-contexte</a> fonctionnalité de Node, Electron n'introduit pas de nouveau contexte JavaScript dans les pages web.</p>\n<p>Remarque : NW.js supporte éventuellement le multi-contexte depuis la v0.13.</p>\n<h2 id=\"4-rétrocompatibilité\"><a href=\"#4-rétrocompatibilité\">4) Rétrocompatibilité</a></h2>\n<p>NW.js offre quand même de la rétrocompatibilité jusque sur Windows XP. Il ne reçoit pas les mises à jour de sécurité.</p>\n<p>Etant donné que les fabriquants de matériel, Microsoft, Chronium, et Node.js n'ont pas réalisés de mise à jour de sécurité pour Windows XP, nous devons vous avertir que l'utiliser sur cette plateforme est totallement non sécurisé et très irresponsable.</p>\n<p>Cependant, nous comprenons que des exigences en dehors de notre imagination la plus folle peuvent exister, donc si vous recherchez quelque chose comme Electron qui fonctionne sous Windows XP, la version héritée de NW.js pourrait vous convenir.</p>\n<h2 id=\"5-fonctionnalités\"><a href=\"#5-fonctionnalités\">5) Fonctionnalités</a></h2>\n<p>Il existe de nombreuses différences dans la quantité de fonctionnalités prises en charge. Electron a une plus grande communauté, plus d'application sur le marché, et <a href=\"https://www.npmjs.com/search?q=electron\">une grande quantité de librairies disponibles sur npm</a>.</p>\n<p>À titre d'exemple, Electron a un support intégré pour les mises à jour automatiques et d'innombrables outils qui facilitent la création d'installateurs. A titre d'exemple en faveur de NW.js, NW.js prend en charge davantage d'API <code>Chrome.*</code> pour le développement d'applications Chrome.</p>\n<p>Naturellement, nous pensons qu'Electron est la meilleure plate-forme pour les applications de production construites avec les technologies Web (comme Visual Studio Code, Slack ou Facebook Messenger); cependant, nous voulons être équitables envers notre technologie Web copain. Si vous avez des besoins en fonctionnalités auxquels Electron ne répond pas, vous voudrez peut-être essayer NW.js.</p>",
      "title": "Différences techniques entre Electron et NW.js",
      "description": ""
    },
    "/docs/api/environment-variables": {
      "locale": "fr-FR",
      "slug": "environment-variables",
      "href": "/docs/api/environment-variables",
      "crowdinFileId": "256315",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/environment-variables.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"variables-denvironnement\"><a href=\"#variables-denvironnement\">Variables d'environnement</a></h1>\n<blockquote>\n<p>Contrôle la configuration et le comportement de l'application sans modifier le code.</p>\n</blockquote>\n<p>Certains comportements d'Electron sont contrôlés par les variables d'environnement car ils sont initialisés avant les indicateurs de ligne de commande et le code de l'application.</p>\n<p>Exemple sur un shell POSIX :</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">export</span> ELECTRON_ENABLE_LOGGING=<span class=\"hljs-literal\">true</span>\n$ electron\n</code></pre>\n<p>Exemple sur la console Windows :</p>\n<pre><code class=\"hljs language-powershell\">> set ELECTRON_ENABLE_LOGGING=true\n> electron\n</code></pre>\n<h2 id=\"variables-de-production\"><a href=\"#variables-de-production\">Variables de production</a></h2>\n<p>Les variables d'environnement suivantes sont destinés principalement à l'exécution des applications Electron empaquetées.</p>\n<h3 id=\"node_options\"><a href=\"#node_options\"><code>NODE_OPTIONS</code></a></h3>\n<p>Electron inclut le support pour un sous-ensemble des <a href=\"https://nodejs.org/api/cli.html#cli_node_options_options\"><code>NODE_OPTIONS</code></a> de Node. La majorité sont supportés à l'exception de celles qui rentrent en conflit avec l'utilisation de BoringSSL dans Chronium.</p>\n<p>Exemple :</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">export</span> NODE_OPTIONS=<span class=\"hljs-string\">\"--no-warnings --max-old-space-size=2048\"</span>\n</code></pre>\n<p>Les options non supportées sont :</p>\n<pre><code class=\"hljs language-sh\">--use-bundled-ca\n--force-fips\n--<span class=\"hljs-built_in\">enable</span>-fips\n--openssl-config\n--use-openssl-ca\n</code></pre>\n<p>Les <code>NODE_OPTIONS</code> sont strictement interdites dans les applications compilées :</p>\n<pre><code class=\"hljs language-sh\">--max-http-header-size\n--http-parser\n</code></pre>\n<h3 id=\"google_api_key\"><a href=\"#google_api_key\"><code>GOOGLE_API_KEY</code></a></h3>\n<p>Geolocation support in Electron requires the use of Google Cloud Platform's geolocation webservice. To enable this feature, acquire a <a href=\"https://developers.google.com/maps/documentation/geolocation/get-api-key\">Google API key</a> and place the following code in your main process file, before opening any browser windows that will make geolocation requests:</p>\n<pre><code class=\"hljs language-javascript\">process.env.GOOGLE_API_KEY = <span class=\"hljs-string\">'VOTRE_CLE_ICI'</span>\n</code></pre>\n<p>By default, a newly generated Google API key may not be allowed to make geolocation requests. To enable the geolocation webservice for your project, enable it through the <a href=\"https://console.cloud.google.com/apis/library\">API library</a>.</p>\n<p>N.B. You will need to add a <a href=\"https://cloud.google.com/billing/docs/how-to/payment-methods#add_a_payment_method\">Billing Account</a> to the project associated to the API key for the geolocation webservice to work.</p>\n<h3 id=\"electron_no_asar\"><a href=\"#electron_no_asar\"><code>ELECTRON_NO_ASAR</code></a></h3>\n<p>Disables ASAR support. This variable is only supported in forked child processes and spawned child processes that set <code>ELECTRON_RUN_AS_NODE</code>.</p>\n<h3 id=\"electron_run_as_node\"><a href=\"#electron_run_as_node\"><code>ELECTRON_RUN_AS_NODE</code></a></h3>\n<p>Démarre le processus comme un processus normal de Node.js.</p>\n<p>In this mode, you will be able to pass <a href=\"https://nodejs.org/api/cli.html\">cli options</a> to Node.js as you would when running the normal Node.js executable, with the exception of the following flags:</p>\n<ul>\n<li>\"--openssl-config\"</li>\n<li>\"--use-bundled-ca\"</li>\n<li>\"--use-openssl-ca\",</li>\n<li>\"--force-fips\"</li>\n<li>\"--enable-fips\"</li>\n</ul>\n<p>These flags are disabled owing to the fact that Electron uses BoringSSL instead of OpenSSL when building Node.js' <code>crypto</code> module, and so will not work as designed.</p>\n<h3 id=\"electron_no_attach_console-windows\"><a href=\"#electron_no_attach_console-windows\"><code>ELECTRON_NO_ATTACH_CONSOLE</code> <em>Windows</em></a></h3>\n<p>Ne s'attache pas la session courante de la console.</p>\n<h3 id=\"electron_force_window_menu_bar-linux\"><a href=\"#electron_force_window_menu_bar-linux\"><code>ELECTRON_FORCE_WINDOW_MENU_BAR</code> <em>Linux</em></a></h3>\n<p>N'utilise pas la bar de menu global sur Linux.</p>\n<h3 id=\"electron_trash-linux\"><a href=\"#electron_trash-linux\"><code>ELECTRON_TRASH</code> <em>Linux</em></a></h3>\n<p>Set the trash implementation on Linux. Par défaut la valeur est <code>gio</code>.</p>\n<p>Options :</p>\n<ul>\n<li><code>gvfs-trash</code></li>\n<li><code>trash-cli</code></li>\n<li><code>kioclient5</code></li>\n<li><code>kioclient</code></li>\n</ul>\n<h2 id=\"variables-de-développement\"><a href=\"#variables-de-développement\">Variables de développement</a></h2>\n<p>Les variables d'environnement suivantes sont destinés principalement pour le développement et le débogage.</p>\n<h3 id=\"electron_enable_logging\"><a href=\"#electron_enable_logging\"><code>ELECTRON_ENABLE_LOGGING</code></a></h3>\n<p>Prints Chromium's internal logging to the console.</p>\n<p>Setting this variable is the same as passing <code>--enable-logging</code> on the command line. For more info, see <code>--enable-logging</code> in <a href=\"/docs/api/command-line-switches#enable-loggingfile\">command-line switches</a>.</p>\n<h3 id=\"electron_log_file\"><a href=\"#electron_log_file\"><code>ELECTRON_LOG_FILE</code></a></h3>\n<p>Sets the file destination for Chromium's internal logging.</p>\n<p>Setting this variable is the same as passing <code>--log-file</code> on the command line. For more info, see <code>--log-file</code> in <a href=\"/docs/api/command-line-switches#log-filepath\">command-line switches</a>.</p>\n<h3 id=\"electron_debug_drag_regions\"><a href=\"#electron_debug_drag_regions\"><code>ELECTRON_DEBUG_DRAG_REGIONS</code></a></h3>\n<p>Adds coloration to draggable regions on <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>s on macOS - draggable regions will be colored green and non-draggable regions will be colored red to aid debugging.</p>\n<h3 id=\"electron_debug_notifications\"><a href=\"#electron_debug_notifications\"><code>ELECTRON_DEBUG_NOTIFICATIONS</code></a></h3>\n<p>Adds extra logs to <a href=\"/docs/api/notification\"><code>Notification</code></a> lifecycles on macOS to aid in debugging. Extra logging will be displayed when new Notifications are created or activated. They will also be displayed when common a tions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.</p>\n<p>Sample output:</p>\n<pre><code class=\"hljs language-sh\">Notification created (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification displayed (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification activated (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification replied to (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\n</code></pre>\n<h3 id=\"electron_log_asar_reads\"><a href=\"#electron_log_asar_reads\"><code>ELECTRON_LOG_ASAR_READS</code></a></h3>\n<p>When Electron reads from an ASAR file, log the read offset and file path to the system <code>tmpdir</code>. The resulting file can be provided to the ASAR module to optimize file ordering.</p>\n<h3 id=\"electron_enable_stack_dumping\"><a href=\"#electron_enable_stack_dumping\"><code>ELECTRON_ENABLE_STACK_DUMPING</code></a></h3>\n<p>Affiche la stack trace sur la console lorsqu'Electron plante.</p>\n<p>Cette variable d'environnement ne fonctionnera pas si vous avez démarré <code>crashReporter</code>.</p>\n<h3 id=\"electron_default_error_mode-windows\"><a href=\"#electron_default_error_mode-windows\"><code>ELECTRON_DEFAULT_ERROR_MODE</code> <em>Windows</em></a></h3>\n<p>Affiche la boite de dialogue de plantage lorsqu'Electron plante.</p>\n<p>Cette variable d'environnement ne fonctionnera pas si vous avez démarré <code>crashReporter</code>.</p>\n<h3 id=\"electron_override_dist_path\"><a href=\"#electron_override_dist_path\"><code>ELECTRON_OVERRIDE_DIST_PATH</code></a></h3>\n<p>Quand lancée depuis le paquet <code>electron</code> , cette variable dit à la commande d'<code>electron</code> d'utiliser la version spécifiée au lieu de celle intallée avec <code>npm install</code>. Utilisation:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">export</span> ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Testing\n</code></pre>\n<h2 id=\"set-by-electron\"><a href=\"#set-by-electron\">Set By Electron</a></h2>\n<p>Electron sets some variables in your environment at runtime.</p>\n<h3 id=\"original_xdg_current_desktop\"><a href=\"#original_xdg_current_desktop\"><code>ORIGINAL_XDG_CURRENT_DESKTOP</code></a></h3>\n<p>This variable is set to the value of <code>XDG_CURRENT_DESKTOP</code> that your application originally launched with.  Electron sometimes modifies the value of <code>XDG_CURRENT_DESKTOP</code> to affect other logic within Chromium so if you want access to the <em>original</em> value you should look up this environment variable instead.</p>",
      "title": "Variables d'environnement",
      "description": "Contrôle la configuration et le comportement de l'application sans modifier le code."
    },
    "/docs/api/structures/event": {
      "locale": "fr-FR",
      "slug": "event",
      "href": "/docs/api/structures/event",
      "crowdinFileId": "256429",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"event-object-extends-globalevent\"><a href=\"#event-object-extends-globalevent\">Event Object extends <code>GlobalEvent</code></a></h1>\n<ul>\n<li><code>preventDefault</code> VoidFunction</li>\n</ul>",
      "title": "Event Object extends GlobalEvent",
      "description": ""
    },
    "/docs/experimental": {
      "locale": "fr-FR",
      "slug": "experimental",
      "href": "/docs/experimental",
      "crowdinFileId": "256119",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/experimental.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"api-expérimentales\"><a href=\"#api-expérimentales\">API expérimentales</a></h1>\n<p>Some of Electrons APIs are tagged with <code>_Experimental_</code> in the documentation. This tag indicates that the API may not be considered stable and the API may be removed or modified more frequently than other APIs with less warning.</p>\n<h2 id=\"conditions-for-an-api-to-be-tagged-as-experimental\"><a href=\"#conditions-for-an-api-to-be-tagged-as-experimental\">Conditions for an API to be tagged as Experimental</a></h2>\n<p>Anyone can request an API be tagged as experimental in a feature PR, disagreements on the experimental nature of a feature can be discussed in the API WG if they can't be resolved in the PR.</p>\n<h2 id=\"process-for-removing-the-experimental-tag\"><a href=\"#process-for-removing-the-experimental-tag\">Process for removing the Experimental tag</a></h2>\n<p>Once an API has been stable and in at least two major stable release lines it can be nominated to have its experimental tag removed.  This discussion should happen at an API WG meeting.  Things to consider when discussing / nominating:</p>\n<ul>\n<li>The above \"two major stables release lines\" condition must have been met</li>\n<li>During that time no major bugs / issues should have been caused by the adoption of this feature</li>\n<li>The API is stable enough and hasn't been heavily impacted by Chromium upgrades</li>\n<li>Is anyone using the API?</li>\n<li>Is the API fulfilling the original proposed usecases, does it have any gaps?</li>\n</ul>",
      "title": "API expérimentales",
      "description": ""
    },
    "/docs/api/structures/extension": {
      "locale": "fr-FR",
      "slug": "extension",
      "href": "/docs/api/structures/extension",
      "crowdinFileId": "256433",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/extension.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"extension-object\"><a href=\"#extension-object\">Extension Object</a></h1>\n<ul>\n<li><code>id</code> String</li>\n<li><code>manifest</code> any - Copy of the <a href=\"https://developer.chrome.com/extensions/manifest\">extension's manifest data</a>.</li>\n<li><code>name</code> String</li>\n<li><code>path</code> String - The extension's file path.</li>\n<li><code>version</code> String</li>\n<li><code>url</code> String - The extension's <code>chrome-extension://</code> URL.</li>\n</ul>",
      "title": "Extension Object",
      "description": ""
    },
    "/docs/api/structures/extension-info": {
      "locale": "fr-FR",
      "slug": "extension-info",
      "href": "/docs/api/structures/extension-info",
      "crowdinFileId": "256431",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/extension-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"extensioninfo-object\"><a href=\"#extensioninfo-object\">ExtensionInfo Object</a></h1>\n<ul>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>",
      "title": "ExtensionInfo Object",
      "description": ""
    },
    "/docs/api/extensions": {
      "locale": "fr-FR",
      "slug": "extensions",
      "href": "/docs/api/extensions",
      "crowdinFileId": "256317",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/extensions.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"chrome-extension-support\"><a href=\"#chrome-extension-support\">Chrome Extension Support</a></h1>\n<p>Electron supports a subset of the <a href=\"https://developer.chrome.com/extensions/api_index\">Chrome Extensions API</a>, primarily to support DevTools extensions and Chromium-internal extensions, but it also happens to support some other extension capabilities.</p>\n<blockquote>\n<p><strong>Note:</strong> Electron does not support arbitrary Chrome extensions from the store, and it is a <strong>non-goal</strong> of the Electron project to be perfectly compatible with Chrome's implementation of Extensions.</p>\n</blockquote>\n<h2 id=\"chargement-des-extensions\"><a href=\"#chargement-des-extensions\">Chargement des extensions</a></h2>\n<p>Electron only supports loading unpacked extensions (i.e., <code>.crx</code> files do not work). Extensions are installed per-<code>session</code>. To load an extension, call <a href=\"/docs/api/session#sesloadextensionpath-options\"><code>ses.loadExtension</code></a>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession.loadExtension(<span class=\"hljs-string\">'path/to/unpacked/extension'</span>).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ id }</span>) =></span> {\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<p>Loaded extensions will not be automatically remembered across exits; if you do not call <code>loadExtension</code> when the app runs, the extension will not be loaded.</p>\n<p>Notez que le chargement d'extensions n'est pris en charge que dans les sessions persistantes. Tenter de charger une extension dans une session en mémoire générera une erreur.</p>\n<p>See the <a href=\"/docs/api/session\"><code>session</code></a> documentation for more information about loading, unloading, and querying active extensions.</p>\n<h2 id=\"supported-extensions-apis\"><a href=\"#supported-extensions-apis\">Supported Extensions APIs</a></h2>\n<p>Nous prenons en charge les API d'extensions suivantes, avec quelques mises en garde. Other APIs may additionally be supported, but support for any APIs not listed here is provisional and may be removed.</p>\n<h3 id=\"chromedevtoolsinspectedwindow\"><a href=\"#chromedevtoolsinspectedwindow\"><code>chrome.devtools.inspectedWindow</code></a></h3>\n<p>Toutes les fonctionnalités de cette API sont prises en charge.</p>\n<h3 id=\"chromedevtoolsnetwork\"><a href=\"#chromedevtoolsnetwork\"><code>chrome.devtools.network</code></a></h3>\n<p>Toutes les fonctionnalités de cette API sont prises en charge.</p>\n<h3 id=\"chromedevtoolspanels\"><a href=\"#chromedevtoolspanels\"><code>chrome.devtools.panels</code></a></h3>\n<p>Toutes les fonctionnalités de cette API sont prises en charge.</p>\n<h3 id=\"chromeextension\"><a href=\"#chromeextension\"><code>chrome.extension</code></a></h3>\n<p>Les propriétés suivantes de <code>chrome.extension</code> sont prises en charge :</p>\n<ul>\n<li><code>chrome.extension.lastError</code></li>\n</ul>\n<p>Les méthodes suivantes de <code>chrome.extension</code> sont prises en charge :</p>\n<ul>\n<li><code>chrome.extension.getURL</code></li>\n<li><code>chrome.extension.getBackgroundPage</code></li>\n</ul>\n<h3 id=\"chromeruntime\"><a href=\"#chromeruntime\"><code>chrome.runtime</code></a></h3>\n<p>Les propriétés suivantes de <code>chrome.runtime</code> sont prises en charge :</p>\n<ul>\n<li><code>chrome.runtime.lastError</code></li>\n<li><code>chrome.runtime.id</code></li>\n</ul>\n<p>Les méthodes suivantes de <code>chrome.runtime</code> sont prises en charge :</p>\n<ul>\n<li><code>chrome.runtime.getBackgroundPage</code></li>\n<li><code>chrome.runtime.getManifest</code></li>\n<li><code>chrome.runtime.getPlatformInfo</code></li>\n<li><code>chrome.runtime.getURL</code></li>\n<li><code>chrome.runtime.connect</code></li>\n<li><code>chrome.runtime.sendMessage</code></li>\n<li><code>chrome.runtime.reload</code></li>\n</ul>\n<p>Les événements suivants de <code>chrome.runtime</code> sont pris en charge :</p>\n<ul>\n<li><code>chrome.runtime.onStartup</code></li>\n<li><code>chrome.runtime.onInstalled</code></li>\n<li><code>chrome.runtime.onSuspend</code></li>\n<li><code>chrome.runtime.onSuspendCanceled</code></li>\n<li><code>chrome.runtime.onConnect</code></li>\n<li><code>chrome.runtime.onMessage</code></li>\n</ul>\n<h3 id=\"chromestorage\"><a href=\"#chromestorage\"><code>chrome.storage</code></a></h3>\n<p>Only <code>chrome.storage.local</code> is supported; <code>chrome.storage.sync</code> and <code>chrome.storage.managed</code> are not.</p>\n<h3 id=\"chrometabs\"><a href=\"#chrometabs\"><code>chrome.tabs</code></a></h3>\n<p>Les méthodes suivantes de <code>chrome.tabs</code> sont prises en charge :</p>\n<ul>\n<li><code>chrome.tabs.sendMessage</code></li>\n<li><code>chrome.tabs.executeScript</code></li>\n</ul>\n<blockquote>\n<p><strong>Note:</strong> In Chrome, passing <code>-1</code> as a tab ID signifies the \"currently active tab\". Since Electron has no such concept, passing <code>-1</code> as a tab ID is not supported and will raise an error.</p>\n</blockquote>\n<h3 id=\"chromemanagement\"><a href=\"#chromemanagement\"><code>chrome.management</code></a></h3>\n<p>Les méthodes suivantes de <code>chrome.management</code> sont prises en charge :</p>\n<ul>\n<li><code>chrome.management.getAll</code></li>\n<li><code>chrome.management.get</code></li>\n<li><code>chrome.management.getSelf</code></li>\n<li><code>chrome.management.getPermissionWarningsById</code></li>\n<li><code>chrome.management.getPermissionWarningsByManifest</code></li>\n<li><code>chrome.management.onEnabled</code></li>\n<li><code>chrome.management.onDisabled</code></li>\n</ul>\n<h3 id=\"chromewebrequest\"><a href=\"#chromewebrequest\"><code>chrome.webRequest</code></a></h3>\n<p>Toutes les fonctionnalités de cette API sont prises en charge.</p>\n<blockquote>\n<p><strong>REMARQUE :</strong> Le module <a href=\"/docs/api/web-request\"><code>webRequest</code></a> d’Electron est prioritaire sur <code>chrome.webRequest</code> en cas de conflit de gestionnaires.</p>\n</blockquote>",
      "title": "Chrome Extension Support",
      "description": "Note: Electron does not support arbitrary Chrome extensions from the store, and it is a non-goal of the Electron project to be perfectly compatible with Chrome's implementation of Extensions."
    },
    "/docs/faq": {
      "locale": "fr-FR",
      "slug": "faq",
      "href": "/docs/faq",
      "crowdinFileId": "256121",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/faq.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"faq-electron\"><a href=\"#faq-electron\">FAQ Electron</a></h1>\n<h2 id=\"pourquoi-ai-je-des-difficultés-à-installer-electron-\"><a href=\"#pourquoi-ai-je-des-difficultés-à-installer-electron-\">Pourquoi ai-je des difficultés à installer Electron ?</a></h2>\n<p>Lorsque vous exécutez <code>npm install electron</code>, certains utilisateurs rencontrent parfois des erreurs d'installation.</p>\n<p>Dans la plupart des cas, ces erreurs sont le résultat d'un problème de réseau et non un soucis avec le packet npm <code>electron</code>. Les erreurs comme <code>ELIFECYCLE</code>, <code>EAI_AGAIN</code>, <code>ECONNRESET</code> et <code>ETIMEDOUT</code> sont toutes des indications d'un problème de réseau. La meilleure solution est d'essayer en changeant de réseau ou juste d'attendre un peu et de réessayer l'installation.</p>\n<p>Vous pouvez également essayer de télécharger Electron directement depuis <a href=\"https://github.com/electron/electron/releases\">electron/electron/releases</a> si l'installation via <code>npm</code> ne marche pas.</p>\n<h2 id=\"quand-est-ce-quelectron-aura-la-dernière-mise-à-jour-de-chrome-\"><a href=\"#quand-est-ce-quelectron-aura-la-dernière-mise-à-jour-de-chrome-\">Quand est-ce qu'Electron aura la dernière mise à jour de Chrome ?</a></h2>\n<p>La version Chrome d'Electron est généralement mise à jour entre une et deux semaines après qu'une nouvelle mise à jour stable de Chrome soit disponible. Cette estimation n'est toutefois pas garantie et dépend de l'effort nécessaire pour faire la mise à jour.</p>\n<p>Seul le canal stable de Chrome est utilisé. If an important fix is in beta or dev channel, we will back-port it.</p>\n<p>Pour plus d'informations, veuillez voir <a href=\"/docs/tutorial/security\">l'introduction à la sécurité</a>.</p>\n<h2 id=\"quand-est-ce-quelectron-aura-la-dernière-mise-à-jour-de-nodejs\"><a href=\"#quand-est-ce-quelectron-aura-la-dernière-mise-à-jour-de-nodejs\">Quand est-ce qu'Electron aura la dernière mise à jour de Node.js?</a></h2>\n<p>Quand une nouvelle version de Node.js est disponible, nous attendons généralement un mois avant de faire la mise à jour du Node.js d'Electron. Ainsi nous évitons d'être affectés par des bugs introduits dans les nouvelles versions de Node.js, ce qui arrive très souvent.</p>\n<p>Les nouvelles fonctionnalités de Node.js sont généralement ajoutées dans les mises à jour de V8. Depuis qu'Electron utilise la V8 du navigateur Chrome, les nouvelles fonctionnalités JavaScript d'une nouvelle version de Node.js sont généralement déjà dans Electron.</p>\n<h2 id=\"comment-partager-les-données-entre-les-pages-web-\"><a href=\"#comment-partager-les-données-entre-les-pages-web-\">Comment partager les données entre les pages web ?</a></h2>\n<p>Pour partager des données entre les pages web (les processus de rendu), le moyen le plus simple est d'utiliser les APIs HTML5 qui sont déjà disponibles dans les navigateurs. Les bons candidats sont <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Storage\">API Storage</a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage\"><code>localStorage</code></a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage\"><code>sessionStorage</code></a> et <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API\">IndexedDB</a>.</p>\n<p>Alternatively, you can use the IPC primitives that are provided by Electron. To share data between the main and renderer processes, you can use the <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> and <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> modules. To communicate directly between web pages, you can send a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> from one to the other, possibly via the main process using <a href=\"/docs/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage()</code></a>. Subsequent communication over message ports is direct and does not detour through the main process.</p>\n<h2 id=\"la-fenêtreicône-de-mon-application-a-disparu-au-bout-de-quelques-minutes\"><a href=\"#la-fenêtreicône-de-mon-application-a-disparu-au-bout-de-quelques-minutes\">La fenêtre/icône de mon application a disparu au bout de quelques minutes.</a></h2>\n<p>Cela se produit lorsque la variable qui sert à stocker la fenêtre/icône est détruite par le ramasse-miettes.</p>\n<p>Si vous rencontrez ce problème, les articles suivants peuvent s'avérer utiles :</p>\n<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management\">Gestion de la mémoire</a></li>\n<li><a href=\"https://msdn.microsoft.com/library/bzt2dkta(v=vs.94).aspx\">Portée des variables</a></li>\n</ul>\n<p>Si vous voulez une solution rapide, vous pouvez mettre les variables en globale en changeant votre code comme celui-ci :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/icon.png'</span>)\n  tray.setTitle(<span class=\"hljs-string\">'hello world'</span>)\n})\n</code></pre>\n<p>pour cela :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> tray = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/icon.png'</span>)\n  tray.setTitle(<span class=\"hljs-string\">'hello world'</span>)\n})\n</code></pre>\n<h2 id=\"je-ne-peux-pas-utiliser-jqueryrequirejsmeteorangularjs-avec-electron\"><a href=\"#je-ne-peux-pas-utiliser-jqueryrequirejsmeteorangularjs-avec-electron\">Je ne peux pas utiliser jQuery/RequireJS/Meteor/AngularJS avec Electron.</a></h2>\n<p>En raison de l'intégration de Node.js dans Electron, il y a quelques symboles supplémentaires insérés dans le DOM comme <code>module</code>, <code>exports</code>, <code>require</code>. Cela pose des problèmes pour certaines bibliothèques, puisqu'ils veulent insérer des symboles avec les mêmes noms.</p>\n<p>Pour résoudre ce problème, vous pouvez désactiver l'intégration de node dans Electron :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Dans le processus main.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\nwin.show()\n</code></pre>\n<p>Mais si vous voulez garder la possibilité d'utiliser Node.js et l'API Electron, vous devez renommer les symboles dans la page avant d’inclure d'autres bibliothèques :</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-built_in\">window</span>.nodeRequire = <span class=\"hljs-built_in\">require</span>;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.require;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.exports;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.module;\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/javascript\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"jquery.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n</code></pre>\n<h2 id=\"requireelectronxxx-is-undefined\"><a href=\"#requireelectronxxx-is-undefined\"><code>require('electron').xxx</code> is undefined.</a></h2>\n<p>Lorsque vous utilisez le module intégré d'Electron, vous pouvez obtenir une erreur comme celle-ci :</p>\n<pre><code class=\"hljs language-sh\">> require(<span class=\"hljs-string\">'electron'</span>).webFrame.setZoomFactor(1.0)\nUncaught TypeError: Cannot <span class=\"hljs-built_in\">read</span> property <span class=\"hljs-string\">'setZoomLevel'</span> of undefined\n</code></pre>\n<p>Il est très probable que vous utilisez le module dans le mauvais processus. Par exemple <code>electron.app</code> peut seulement être utilisé dans le processus principal, tandis que <code>electron.webFrame</code> n'est disponible que dans les processus de rendu.</p>\n<h2 id=\"la-police-semble-floue-quest-ce-et-à-que-puis-je-faire\"><a href=\"#la-police-semble-floue-quest-ce-et-à-que-puis-je-faire\">La police semble floue, qu'est-ce et à que puis-je faire?</a></h2>\n<p>Si <a href=\"https://alienryderflex.com/sub_pixel/\">sub-pixel anti-aliasing</a> est désactivé sur les écrans LCD les polices peuvent être floues. Exemple . Exemple :</p>\n<p><img src=\"/docs/images/subpixel-rendering-screenshot.gif\" alt=\"subpixel rendering example\"></p>\n<p>L'anticrénelage des sous-pixels nécessite un fond non transparent pour la fenêtre contenant les glyphes d'une police d'écriture. (Voir <a href=\"https://github.com/electron/electron/issues/6344#issuecomment-420371918\">cette issue</a> pour plus d'infos).</p>\n<p>To achieve this goal, set the background in the constructor for <a href=\"/docs/api/browser-window\">BrowserWindow</a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#fff'</span>\n})\n</code></pre>\n<p>L'effet n'est visible que sur (certains?) Écrans LCD. Even if you don't see a difference, some of your users may. It is best to always set the background this way, unless you have reasons not to do so.</p>\n<p>Veuillez noter que simplement paramétrer la couleur de fond avec le CSS ne donnera pas l'effet souhaité.</p>",
      "title": "FAQ Electron",
      "description": ""
    },
    "/docs/api/structures/file-filter": {
      "locale": "fr-FR",
      "slug": "file-filter",
      "href": "/docs/api/structures/file-filter",
      "crowdinFileId": "256435",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/file-filter.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"filefilter-object\"><a href=\"#filefilter-object\">FileFilter Object</a></h1>\n<ul>\n<li><code>name</code> String</li>\n<li><code>extensions</code> String[]</li>\n</ul>",
      "title": "FileFilter Object",
      "description": ""
    },
    "/docs/api/file-object": {
      "locale": "fr-FR",
      "slug": "file-object",
      "href": "/docs/api/file-object",
      "crowdinFileId": "256319",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/file-object.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"objet-file\"><a href=\"#objet-file\">Objet <code>File</code></a></h1>\n<blockquote>\n<p>Use the HTML5 <code>File</code> API to work natively with files on the filesystem.</p>\n</blockquote>\n<p>L'interface de fichier du DOM fournit une abstraction autour des fichiers natifs afin de permettre aux utilisateurs de travailler sur des fichiers natifs directement avec l'API HTML5 File. Electron a ajouté un attribut <code>path</code> à l'interface <code>File</code> qui expose le chemin réel du fichier sur le système de fichiers.</p>\n<p>Exemple pour obtenir le chemin réel d'un fichier glissé dans l'application :</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">div</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"holder\"</span>></span>\n  Faites glisser votre fichier ici\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">div</span>></span>\n\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  <span class=\"hljs-built_in\">document</span>. ddEventListener(<span class=\"hljs-string\">'drop'</span>, (e) => {\n    e. reventDefault();\n    e.stopPropagation();\n\n    <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> f <span class=\"hljs-keyword\">of</span> e. ataTransfer.files) {\n      <span class=\"hljs-built_in\">console</span>. og(<span class=\"hljs-string\">'Fichier(s) que vous avez glissé ici : '</span>, f.path)\n    }\n  });\n  <span class=\"hljs-built_in\">document</span>. ddEventListener(<span class=\"hljs-string\">'dragover'</span>, (e) => {\n    e.preventDefault();\n    e.stopPropagation();\n  });\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>",
      "title": "Objet File",
      "description": "Use the HTML5 File API to work natively with files on the filesystem."
    },
    "/docs/api/structures/file-path-with-headers": {
      "locale": "fr-FR",
      "slug": "file-path-with-headers",
      "href": "/docs/api/structures/file-path-with-headers",
      "crowdinFileId": "256437",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/file-path-with-headers.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"filepathwithheaders-object\"><a href=\"#filepathwithheaders-object\">FilePathWithHeaders Object</a></h1>\n<ul>\n<li><code>path</code> String - The path to the file to send.</li>\n<li><code>headers</code> Record&#x3C;string, string> (optional) - Additional headers to be sent.</li>\n</ul>",
      "title": "FilePathWithHeaders Object",
      "description": ""
    },
    "/docs/api/frameless-window": {
      "locale": "fr-FR",
      "slug": "frameless-window",
      "href": "/docs/api/frameless-window",
      "crowdinFileId": "256321",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/frameless-window.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"fenêtre-sans-bords\"><a href=\"#fenêtre-sans-bords\">Fenêtre sans bords</a></h1>\n<blockquote>\n<p>Ouvre une fenêtre sans barre d'outils, sans bordures ou autre \"chrome\" graphique.</p>\n</blockquote>\n<p>Une fenêtre sans cadre est une fenêtre qui n'a pas de <a href=\"https://developer.mozilla.org/en-US/docs/Glossary/Chrome\">chrome</a>, les parties de la fenêtre, comme des barres d'outils, qui ne font pas partie de la page Web. Ce sont des options dans la classe <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<h2 id=\"créer-une-fenêtre-sans-bords\"><a href=\"#créer-une-fenêtre-sans-bords\">Créer une fenêtre sans bords</a></h2>\n<p>Pour créer une fenêtre sans cadre, vous devez définir <code>frame</code> à <code>false</code> dans <a href=\"/docs/api/browser-window\">BrowserWindow</a>'s <code>options</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h3 id=\"alternatives\"><a href=\"#alternatives\">Alternatives</a></h3>\n<p>There's an alternative way to specify a chromeless window on macOS and Windows. Instead of setting <code>frame</code> to <code>false</code> which disables both the titlebar and window controls, you may want to have the title bar hidden and your content extend to the full window size, yet still preserve the window controls (\"traffic lights\" on macOS) for standard window actions. Vous pouvez le faire en spécifiant l'option <code>titleBarStyle</code> :</p>\n<h4 id=\"hidden\"><a href=\"#hidden\"><code>hidden</code></a></h4>\n<p>Results in a hidden title bar and a full size content window. On macOS, the title bar still has the standard window controls (“traffic lights”) in the top left.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span> })\nwin.show()\n</code></pre>\n<h3 id=\"alternatives-sur-macos\"><a href=\"#alternatives-sur-macos\">Alternatives sur macOS</a></h3>\n<h4 id=\"hiddeninset\"><a href=\"#hiddeninset\"><code>hiddenInset</code></a></h4>\n<p>Résultats dans une barre de titre cachée avec un aspect alternatif où les boutons de feux de circulation sont un peu plus intégrés à partir du bord de la fenêtre.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span> })\nwin.show()\n</code></pre>\n<h4 id=\"custombuttonsonhover\"><a href=\"#custombuttonsonhover\"><code>customButtonsOnHover</code></a></h4>\n<p>Utilise les boutons personnalisés de fermeture dessinée, et miniaturise les boutons qui affichent en survolant en haut à gauche de la fenêtre. The fullscreen button is not available due to restrictions of frameless windows as they interface with Apple's macOS window masks. Ces boutons personnalisés empêchent les problèmes liés aux événements de la souris qui se produisent avec les boutons standard de la barre d'outils de la fenêtre. Cette option n'est applicable que pour les fenêtres sans cadres.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'customButtonsOnHover'</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h2 id=\"windows-control-overlay\"><a href=\"#windows-control-overlay\">Windows Control Overlay</a></h2>\n<p>When using a frameless window in conjuction with <code>win.setWindowButtonVisibility(true)</code> on macOS, using one of the <code>titleBarStyle</code>s as described above so that the traffic lights are visible, or using <code>titleBarStyle: hidden</code> on Windows, you can access the Window Controls Overlay <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis\">JavaScript APIs</a> and <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables\">CSS Environment Variables</a> by setting the <code>titleBarOverlay</code> option to true. Specifying <code>true</code> will result in an overlay with default system colors.</p>\n<p>On Windows, you can also specify the color of the overlay and its symbols by setting <code>titleBarOverlay</code> to an object with the options <code>color</code> and <code>symbolColor</code>. If an option is not specified, the color will default to its system color for the window control buttons:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span>,\n  <span class=\"hljs-attr\">titleBarOverlay</span>: <span class=\"hljs-literal\">true</span>\n})\nwin.show()\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span>,\n  <span class=\"hljs-attr\">titleBarOverlay</span>: {\n    <span class=\"hljs-attr\">color</span>: <span class=\"hljs-string\">'#2f3241'</span>,\n    <span class=\"hljs-attr\">symbolColor</span>: <span class=\"hljs-string\">'#74b1be'</span>\n  }\n})\nwin.show()\n</code></pre>\n<h2 id=\"fenêtre-transparente\"><a href=\"#fenêtre-transparente\">Fenêtre transparente</a></h2>\n<p>En définissant l'option <code>transparente</code> à <code>true</code>, vous pouvez également rendre la fenêtre sans cadre transparente :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">transparent</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h3 id=\"limitations\"><a href=\"#limitations\">Limitations</a></h3>\n<ul>\n<li>Vous ne pouvez pas cliquer à travers la zone transparente. Nous allons introduire une API pour définir la forme de fenêtre pour résoudre ce problème, voir <a href=\"https://github.com/electron/electron/issues/1335\">notre problème</a> pour plus de détails.</li>\n<li>Transparent windows are not resizable. Setting <code>resizable</code> to <code>true</code> may make a transparent window stop working on some platforms.</li>\n<li>Le filtre <code>flur</code> ne s'applique qu'à la page web, donc il n'y a aucun moyen d'appliquer l'effet de flou au contenu en dessous de la fenêtre (i. . d'autres applications s'ouvrent sur le système de l'utilisateur).</li>\n<li>The window will not be transparent when DevTools is opened.</li>\n<li>On Windows operating systems,<ul>\n<li>transparent windows will not work when DWM is disabled.</li>\n<li>transparent windows can not be maximized using the Windows system menu or by double clicking the title bar. The reasoning behind this can be seen on <a href=\"https://github.com/electron/electron/pull/28207\">this pull request</a>.</li>\n</ul></li>\n<li>Sous Linux, les utilisateurs doivent mettre <code>--enable-transparent-visuals --disable-gpu</code> dans la ligne de commande pour désactiver le GPU et permettre à ARGB de rendre une fenêtre transparente, ceci est causé par un bogue amont que <a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=369209\">canal alpha ne fonctionne pas sur certains pilotes NVidia</a> sur Linux.</li>\n<li>Sur Mac, l'ombre native de la fenêtre ne sera pas affichée sur une fenêtre transparente.</li>\n</ul>\n<h2 id=\"fenêtre-non-cliquable\"><a href=\"#fenêtre-non-cliquable\">Fenêtre non cliquable</a></h2>\n<p>Pour créer une fenêtre non cliquable, c'est-à-dire faire en sorte que la fenêtre ignore tous les événements de la souris, vous pouvez appeler l'API <a href=\"/docs/api/browser-window#winsetignoremouseeventsignore-options\">win.setIgnoreMouseEvents(ignore)</a> :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.setIgnoreMouseEvents(<span class=\"hljs-literal\">true</span>)\n</code></pre>\n<h3 id=\"transfert\"><a href=\"#transfert\">Transfert</a></h3>\n<p>Ignorer les messages de la souris rend la page Web inaccessible au mouvement de la souris, ce qui signifie que les événements de déplacement de la souris ne seront pas émis. Sur les systèmes d'exploitation Windows, un paramètre optionnel peut être utilisé pour déplacer les messages de la souris vers la page web, permettant d'émettre des événements tels que <code>souris</code> :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> el = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'clickThroughElement'</span>)\nel.addEventListener(<span class=\"hljs-string\">'mouseenter'</span>, () => {\n  ipcRenderer.send(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, <span class=\"hljs-literal\">true</span>, { <span class=\"hljs-attr\">forward</span>: <span class=\"hljs-literal\">true</span> })\n})\nel.addEventListener(<span class=\"hljs-string\">'mouseleave'</span>, () => {\n  ipcRenderer.send(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, <span class=\"hljs-literal\">false</span>)\n})\n\n<span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, (event, ...args) => {\n  BrowserWindow.fromWebContents(event.sender).setIgnoreMouseEvents(...args)\n})\n</code></pre>\n<p>Cela rend la page web cliquante quand plus de <code>el</code>, et retourne à la normale en dehors de elle.</p>\n<h2 id=\"région-déplaçable\"><a href=\"#région-déplaçable\">Région déplaçable</a></h2>\n<p>Par défaut, la fenêtre sans cadre ne peut pas être déplacée. Les applications doivent spécifier <code>-webkit-app-region: glisser</code> dans CSS pour dire à Electron quelles régions sont glissables (comme la barre de titre standard de l'OS), et les applications peuvent également utiliser <code>-webkit-app-region : no-drag</code> pour exclure la zone non glissable de la région glissable. Notez que seules les formes rectangulaires sont actuellement prises en charge.</p>\n<p>Remarque : <code>-webkit-app-region: drag</code> est connu pour avoir des problèmes pendant que les outils de développement sont ouverts. Voir ceci <a href=\"https://github.com/electron/electron/issues/3647\">Problème GitHub</a> pour plus d'informations, y compris une solution de contournement.</p>\n<p>Pour que toute la fenêtre puisse être déplacée, vous pouvez ajouter <code>-webkit-app-region : glisser</code> comme <code>body</code>'s style :</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"-webkit-app-region: drag\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n</code></pre>\n<p>Et notez que si vous avez rendu toute la fenêtre déplaçable, vous devez également marquer les boutons comme non glissables, sinon il serait impossible pour les utilisateurs de cliquer sur eux :</p>\n<pre><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">button</span> {\n  <span class=\"hljs-attribute\">-webkit-app-region</span>: no-drag;\n}\n</code></pre>\n<p>Si vous définissez seulement une barre de titre personnalisée comme glissable, vous devez également rendre tous les boutons de la barre de titre non glissables.</p>\n<h2 id=\"sélection-de-texte\"><a href=\"#sélection-de-texte\">Sélection de texte</a></h2>\n<p>In a frameless window the dragging behavior may conflict with selecting text. Par exemple, lorsque vous faites glisser la fenêtre depuis la barre de titre, vous pouvez accidentellement sélectionner son texte. Afin d'éviter cela, vous devez désactiver la sélection de texte dans une zone déplaçable. Comme ceci :</p>\n<pre><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.titlebar</span> {\n  <span class=\"hljs-attribute\">-webkit-user-select</span>: none;\n  <span class=\"hljs-attribute\">-webkit-app-region</span>: drag;\n}\n</code></pre>\n<h2 id=\"menu-contextuel\"><a href=\"#menu-contextuel\">Menu contextuel</a></h2>\n<p>Sur certaines plateformes, la zone glissable sera traitée comme une image non-client, donc lorsque vous faites un clic droit dessus un menu système apparaîtra. Pour que le menu contextuel se comporte correctement sur toutes les plates-formes, vous ne devriez jamais utiliser un menu contextuel personnalisé sur zones glissables.</p>",
      "title": "Fenêtre sans bords",
      "description": "Ouvre une fenêtre sans barre d'outils, sans bordures ou autre \"chrome\" graphique."
    },
    "/docs/tutorial/fuses": {
      "locale": "fr-FR",
      "slug": "fuses",
      "href": "/docs/tutorial/fuses",
      "crowdinFileId": "256201",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/fuses.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-fuses\"><a href=\"#electron-fuses\">Electron Fuses</a></h1>\n<blockquote>\n<p>Activation de fonctionnalités au moment du packaging</p>\n</blockquote>\n<h2 id=\"que-sont-les-fuses-\"><a href=\"#que-sont-les-fuses-\">Que sont les fuses ?</a></h2>\n<p>Pour n'utiliser qu'un sous-ensemble de fonctionnalités d'Electron, il semble logique de désactiver certaines fonctionnalités pour l'ensemble d'une application.  Par exemple, 99% des applications n'utilisent pas <code>ELECTRON_RUN_AS_NODE</code>, leurs concepteurs veulent être en mesure de livrer un exécutable qui n'utilise pas cette fonctionnalité.  Nous ne voulons pas non plus que les utilisateurs d'Electron génère Electron à partir des sources car ce serait à la fois un défi technique énorme et aurait un coût élevé que ce soit en temps ou en argent.</p>\n<p>Les fuses sont la solution à ce problème, à un haut niveau, ils sont des \"bits magiques\" dans l'exécutable d'Electron qui peuvent être activés ou non au moment du packaging de votre application Electron pour activer ou désactiver certaines fonctionnalités ou restrictions.  Comme ils sont activés au moment du packaging et donc avant que vous ne signiez votre application, l'OS devient responsable de s'assurer que ces bits n'ont pas été désactivés via la validation du code du système d'exploitation (Gatekeeper / App Locker).</p>\n<h2 id=\"comment-activer-les-fuses-\"><a href=\"#comment-activer-les-fuses-\">Comment activer les fuses ?</a></h2>\n<h3 id=\"la-manière-simple\"><a href=\"#la-manière-simple\">La manière simple</a></h3>\n<p>Nous avons créé un module pratique <code>@electron/fuses</code> pour faciliter l'activation de ces fuses.  Consultez le README de ce module pour plus de détails sur l'utilisation et les éventuels cas d'erreur.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/fuses'</span>).flipFuses(\n  <span class=\"hljs-comment\">// Chemin vers electron</span>\n  <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>),\n  <span class=\"hljs-comment\">// Les Fuses à activer</span>\n  {\n    <span class=\"hljs-attr\">runAsNode</span>: <span class=\"hljs-literal\">false</span>\n  }\n)\n</code></pre>\n<h3 id=\"manière-plus-compliquée\"><a href=\"#manière-plus-compliquée\">Manière plus compliquée</a></h3>\n<h4 id=\"glossaire-rapide\"><a href=\"#glossaire-rapide\">Glossaire rapide</a></h4>\n<ul>\n<li><strong>Fuse Wire</strong>: Une séquence d’octets dans le binaire d'Electron utilisé pour gérer les fuses</li>\n<li><strong>Sentinel</strong>: Une séquence statique d’octets connue que vous pouvez utiliser pour localiser le &#x3C;0>fuse wire&#x3C;/0></li>\n<li><strong>Fuse Schema</strong>: Le format et les valeurs autorisées pour le &#x3C;0>fuse wire&#x3C;/0></li>\n</ul>\n<p>Pour activer les fuses manuellement, il est nécessaire d'éditer le binaire d'Electron et modifier la séquence d'octets du fuse wire pour qu'elle représente l'état des fuses désiré.</p>\n<p>Quelque part dans le binaire Electron, il y a une séquence d'octets qui ressembler à ceci :</p>\n<pre><code class=\"hljs language-plaintext\">| ...binary | sentinel_bytes | fuse_version | fuse_wire_length | fuse_wire | ...binary |\n</code></pre>\n<ul>\n<li><code>sentinel_bytes</code> est toujours exactement cette chaîne <code>dL7pKGdnNz796PbbjQWNKmHXBZaB9tsX</code></li>\n<li><code>fuse_version</code> est un seul octet dont la valeur de type unsigned integer représente la version du schéma du fuse</li>\n<li><code>fuse_wire_length</code> est un seul octet dont la valeur de type unsigned integer représente le nombre de fuses dans le fuse wire</li>\n<li><code>fuse_wire</code> est une séquence de N octets, chaque octet représentant un seul fuse et son état.<ul>\n<li>\"0\" (0x30) indique que le fusible est inactif</li>\n<li>\"1\" (0x31) indique que le fusible est actif</li>\n<li>\"r\" (0x72) indique que le fuse a été supprimé et le changement de l'octet à 1 ou 0 n'aura aucun effet.</li>\n</ul></li>\n</ul>\n<p>Pour actionner un fuse, vous devez trouver sa position dans le fuse wire et le mettre à \"0\" ou \"1\" selon l'état que vous désirez.</p>\n<p>Vous pouvez voir le schéma actuel <a href=\"https://github.com/electron/electron/blob/main/build/fuses/fuses.json5\">ici</a>.</p>",
      "title": "Electron Fuses",
      "description": "Activation de fonctionnalités au moment du packaging"
    },
    "/docs/api/global-shortcut": {
      "locale": "fr-FR",
      "slug": "global-shortcut",
      "href": "/docs/api/global-shortcut",
      "crowdinFileId": "256323",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/global-shortcut.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"globalshortcut\"><a href=\"#globalshortcut\">globalShortcut</a></h1>\n<blockquote>\n<p>Détecte les événements de clavier lorsque l'application n'a pas le focus du clavier.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>Le module <code>globalShortcut</code> peut inscrire/désinscrire un raccourci clavier global avec le système d'exploitation afin que vous puissiez personnaliser les opérations pour les différents raccourcis.</p>\n<p><strong>Remarque :</strong> Le raccourci est global; il fonctionnera même si l'application n'a pas le focus du clavier. This module cannot be used before the <code>ready</code> event of the app module is emitted.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Register a 'CommandOrControl+X' shortcut listener.</span>\n  <span class=\"hljs-keyword\">const</span> ret = globalShortcut.register(<span class=\"hljs-string\">'CommandOrControl+X'</span>, () => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'CommandOrControl+X is pressed'</span>)\n  })\n\n  <span class=\"hljs-keyword\">if</span> (!ret) {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'enregistrement échoué'</span>)\n  }\n\n  <span class=\"hljs-comment\">// Check si le raccourci est enregistré.</span>\n  <span class=\"hljs-built_in\">console</span>.log(globalShortcut.isRegistered(<span class=\"hljs-string\">'CommandOrControl+X'</span>))\n})\n\napp.on(<span class=\"hljs-string\">'will-quit'</span>, () => {\n  <span class=\"hljs-comment\">// Retire le raccourci.</span>\n  globalShortcut.unregister(<span class=\"hljs-string\">'CommandOrControl+X'</span>)\n\n  <span class=\"hljs-comment\">// Supprime tous les raccourcis.</span>\n  globalShortcut.unregisterAll()\n})\n</code></pre>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module <code>globalShortcut</code> dispose des méthodes suivantes :</p>\n<h3 id=\"globalshortcutregisteraccelerator-callback\"><a href=\"#globalshortcutregisteraccelerator-callback\"><code>globalShortcut.register(accelerator, callback)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n<li><code>callback</code> Function</li>\n</ul>\n<p>Retourne <code>Boolean</code> - Si le raccourci a été enregistré avec succès.</p>\n<p>Registers a global shortcut of <code>accelerator</code>. The <code>callback</code> is called when the registered shortcut is pressed by the user.</p>\n<p>Lorsque l'accélérateur est déjà utilisé par d'autres applications, cet appel échouera silencieusement. Ce comportement est prévu par les systèmes d'exploitation, car ils ne veulent pas que les applications se battent pour des raccourcis globaux.</p>\n<p>Les accélérateurs suivants ne seront pas enregistrés correctement sur macOS 10.14 Mojave à moins que l'application ait été autorisée en tant qu'<a href=\"https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html\">application client approuvée</a> :</p>\n<ul>\n<li>\"Media Play/Pause\"</li>\n<li>\"Media Piste Suivante\"</li>\n<li>\"Media Piste Précédente\"</li>\n<li>\"Media Stop\"</li>\n</ul>\n<h3 id=\"globalshortcutregisterallaccélérateurs-callback\"><a href=\"#globalshortcutregisterallaccélérateurs-callback\"><code>globalShortcut.registerAll(accélérateurs, callback)</code></a></h3>\n<ul>\n<li><code>accélérateur</code> String[] - un tableau de <a href=\"/docs/api/accelerator\">Accelerator</a>s.</li>\n<li><code>callback</code> Function</li>\n</ul>\n<p>Registers a global shortcut of all <code>accelerator</code> items in <code>accelerators</code>. The <code>callback</code> is called when any of the registered shortcuts are pressed by the user.</p>\n<p>Lorsqu'un accélérateur donné est déjà pris par d'autres applications, cet appel échouera silencieusement. Ce comportement est prévu par les systèmes d'exploitation, car ils ne veulent pas que les applications se battent pour des raccourcis globaux.</p>\n<p>Les accélérateurs suivants ne seront pas enregistrés correctement sur macOS 10.14 Mojave à moins que l'application ait été autorisée en tant qu'<a href=\"https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html\">application client approuvée</a> :</p>\n<ul>\n<li>\"Media Play/Pause\"</li>\n<li>\"Media Piste Suivante\"</li>\n<li>\"Media Piste Précédente\"</li>\n<li>\"Media Stop\"</li>\n</ul>\n<h3 id=\"globalshortcutisregisteredaccelerator\"><a href=\"#globalshortcutisregisteredaccelerator\"><code>globalShortcut.isRegistered(accelerator)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n</ul>\n<p>Retourne un <code>Boolean</code> - Si l'application à enregistrer l'<code>accelerator</code>.</p>\n<p>Lorsque l'accelerator est déjà utilisé par d'autres applications, cet appel retournera toujours <code>false</code>. Ce comportement est prévu par les systèmes d'exploitation, car ils ne veulent pas que les applications se battent pour des raccourcis globaux.</p>\n<h3 id=\"globalshortcutunregisteraccelerator\"><a href=\"#globalshortcutunregisteraccelerator\"><code>globalShortcut.unregister(accelerator)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n</ul>\n<p>Supprime le raccourci global de l'<code>accelerator</code>.</p>\n<h3 id=\"globalshortcutunregisterall\"><a href=\"#globalshortcutunregisterall\"><code>globalShortcut.unregisterAll()</code></a></h3>\n<p>Supprime tous les raccourcis globaux.</p>",
      "title": "globalShortcut",
      "description": "Détecte les événements de clavier lorsque l'application n'a pas le focus du clavier."
    },
    "/docs/glossary": {
      "locale": "fr-FR",
      "slug": "glossary",
      "href": "/docs/glossary",
      "crowdinFileId": "256123",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/glossary.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"glossaire\"><a href=\"#glossaire\">Glossaire</a></h1>\n<p>Cette page définit certaines terminologies qui sont couramment utilisées dans le développement d'Electron.</p>\n<h3 id=\"asar\"><a href=\"#asar\">ASAR</a></h3>\n<p>ASAR signifie Atom Shell Archive Format. Une archive <a href=\"https://github.com/electron/asar\">asar</a> est un simple fichier <code>.tar</code>, comme le format de compression de fichiers. Electron peut lire les fichiers sans avoir à décompresser l'archive.</p>\n<p>Le format ASAR a été créé principalement pour améliorer les performances sous Windows lorsque il y a de grandes quantités de petits fichiers ( par ex. lors du chargement de l'arborescence des dépendances JavaScript de votre application depuis <code>node_modules</code>).</p>\n<h3 id=\"signature-de-code\"><a href=\"#signature-de-code\">signature de code</a></h3>\n<p>La signature de code est un processus où un développeur d'applications signe numériquement son code pour assurer qu'il n'a pas été altéré après l'empaquetage. Windows et macOS implémentent leur propre version de signature de code. En tant que développeur d'applications de bureau, il est important que vous signiez votre code si vous prévoyez de le distribuer au grand public.</p>\n<p>Pour plus d'informations, lisez le tutoriel <a href=\"/docs/tutorial/code-signing\">Signature de code</a>.</p>\n<h3 id=\"isolement-du-contexte\"><a href=\"#isolement-du-contexte\">isolement du contexte</a></h3>\n<p>L’isolation de contexte est une mesure de sécurité d'Electron qui garantit que votre script de préchargement(preload) ne peut pas permettre que le site web contenu dans le WebContent n'accède aux API d’Électron ou de Node.js. Avec l'isolement de contexte activé, le seul moyen d'exposer les API de votre script de préchargement est de passer par l'API <code>contextBridge</code>.</p>\n<p>Pour plus d'informations, lisez le tutoriel <a href=\"/docs/tutorial/context-isolation\">Isolation du contexte</a>.</p>\n<p>Voir aussi: <a href=\"#preload-script\">script preload</a>, <a href=\"#renderer-process\">processus de rendu</a></p>\n<h3 id=\"crt\"><a href=\"#crt\">CRT</a></h3>\n<p>La bibliothèque de Runtime C (CRT) est la partie de la bibliothèque Standard C++ intégrant la bibliothèque standard ISO C99. Les bibliothèques Visual C++ qui implémentent le CRT supportent le développement de code natif, de code mixte natif et managé ainsi que le code managé pur pour le développement .NET.</p>\n<h3 id=\"dmg\"><a href=\"#dmg\">DMG</a></h3>\n<p>Une Image disque Apple est un format de package utilisé par macOS. Les fichiers DMG sont couramment utilisés pour distribuer un « installateur » d'une application.</p>\n<h3 id=\"ime\"><a href=\"#ime\">IME</a></h3>\n<p>Éditeur de méthode d'entrée (Input Method Editor). Un programme qui permet aux utilisateurs d'entrer des caractères et des symboles n'existant pas sur leur clavier. Par exemple, cela permet aux utilisateurs de clavier Latin d'entrer des caractères chinois, japonais, coréen et hindi.</p>\n<h3 id=\"idl\"><a href=\"#idl\">IDL</a></h3>\n<p>Interface description language. Décrit les signatures des fonctions et des types de données dans un format qui peut être utilisé pour générer des interfaces en Java, C++, JavaScript, etc.</p>\n<h3 id=\"ipc\"><a href=\"#ipc\">IPC</a></h3>\n<p>IPC signifie communication inter-processus. Electron utilise les IPC pour envoyer des messages sérialisés en JSON entre le processus principal et les processus de rendu.</p>\n<p>voir aussi : <a href=\"#main-process\">processus principal</a>, <a href=\"#renderer-process\">processus de rendu</a></p>\n<h3 id=\"main-process-processus-principal\"><a href=\"#main-process-processus-principal\">main process (processus principal)</a></h3>\n<p>Le processus principal, généralement un fichier nommé <code>main.js</code>, est le point d'entrée de chaque application Electron. Il contrôle la vie de l'application, de l'ouverture à la fermeture. Il gère également les éléments natifs tels que le Menu, Menu Bar, Dock, Tray, etc. The main process is responsible for creating each new renderer process in the app. L'API complète de Node est intégrée.</p>\n<p>Every app's main process file is specified in the <code>main</code> property in <code>package.json</code>. This is how <code>electron .</code> knows what file to execute at startup.</p>\n<p>In Chromium, this process is referred to as the \"browser process\". It is renamed in Electron to avoid confusion with renderer processes.</p>\n<p>Voir aussi : <a href=\"#process\">processus</a>, <a href=\"#renderer-process\">processus de rendu</a></p>\n<h3 id=\"mas\"><a href=\"#mas\">MAS</a></h3>\n<p>Acronym for Apple's Mac App Store. Pour plus de détails sur la soumission de votre application au MAS, consultez le <a href=\"/docs/tutorial/mac-app-store-submission-guide\">Guide de soumission du Mac App Store</a>.</p>\n<h3 id=\"mojo\"><a href=\"#mojo\">Mojo</a></h3>\n<p>Un système IPC pour la communication intra - ou inter-processus, et c’est important car Chrome a tendance à diviser ses tâches dans des processus distincts ou non, en fonction des contraintes de mémoire etc.</p>\n<p>Voir <a href=\"https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md\">https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md</a></p>\n<p>Voir aussi: <a href=\"#ipc\">IPC</a></p>\n<h3 id=\"msi\"><a href=\"#msi\">MSI</a></h3>\n<p>Sous Windows, les paquets MSI sont utilisés par le service Windows Installer (également connu sous le nom d'installateur Microsoft) pour installer et configurer des applications .</p>\n<p>Plus d'informations peuvent être trouvées dans la documentation de <a href=\"https://docs.microsoft.com/en-us/windows/win32/msi/windows-installer-portal\">Microsoft</a>.</p>\n<h3 id=\"modules-natifs\"><a href=\"#modules-natifs\">modules natifs</a></h3>\n<p>Les modules natifs (également appelés <a href=\"https://nodejs.org/api/addons.html\">addons</a> dans Node.js) sont des modules écrits en C ou C++ qui peuvent être chargés dans Node.js ou Electron à l'aide de la fonction require() et sont utilisés comme si ils étaient des modules ordinaires de Node.js. Ils sont utilisés principalement pour fournir une interface entre JavaScript s’exécutant dans les librairies Node.js et C/C++.</p>\n<p>Les modules natifs de Node sont pris en charge par Electron, mais étant donné qu'Electron est très susceptible d'utiliser une version différente de V8 du binaire Node installée sur votre système. Vous devez spécifier manuellement l'emplacement des en-têtes d'Electron, lors de la compilation de modules natifs.</p>\n<p>Pour plus d'informations, lisez le tutoriel [Modules de Node Natif].</p>\n<h3 id=\"notarization\"><a href=\"#notarization\">notarization</a></h3>\n<p>Notarization is a macOS-specific process where a developer can send a code-signed app to Apple servers to get verified for malicious components through an automated service.</p>\n<p>See also: <a href=\"#code-signing\">code signing</a></p>\n<h3 id=\"osr\"><a href=\"#osr\">OSR</a></h3>\n<p>OSR (offscreen rendering) can be used for loading heavy page in background and then displaying it after (it will be much faster). It allows you to render page without showing it on screen.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/offscreen-rendering\">Offscreen Rendering</a>[osr] tutorial.</p>\n<h3 id=\"preload-script\"><a href=\"#preload-script\">preload script</a></h3>\n<p>Preload scripts contain code that executes in a renderer process before its web contents begin loading. These scripts run within the renderer context, but are granted more privileges by having access to Node.js APIs.</p>\n<p>See also: <a href=\"#renderer-process\">renderer process</a>, <a href=\"#context-isolation\">context isolation</a></p>\n<h3 id=\"processus-process\"><a href=\"#processus-process\">processus (process)</a></h3>\n<p>Un processus est une instance d'un programme d'ordinateur en execution. Les apps Electron qui utilisent le processus <a href=\"#main-process\">principal</a> et un ou plusieurs processus <a href=\"#renderer-process\">de rendu</a> font tourner plusieurs programmes en même temps.</p>\n<p>Dans Node.js et Electron, chaque processus en execution ont un objet <code>processus</code>. Cet objet global donne des informations et permet de contrôler le processus current. Comme une variable global, cet objet est disponible dans l'application sans utiliser require().</p>\n<p>Voir aussi : <a href=\"#main-process\">processus principal</a>, <a href=\"#renderer-process\">processus de rendu</a></p>\n<h3 id=\"processus-de-rendu-renderer-process\"><a href=\"#processus-de-rendu-renderer-process\">processus de rendu (renderer process)</a></h3>\n<p>Le processus de rendu est une fenêtre de navigateur dans votre application. Contrairement au processus principal, il peut y en avoir plusieurs et chacun est exécuté dans un processus distinct. Ils peuvent également être cachés.</p>\n<p>Voir aussi : <a href=\"#process\">processus</a>, <a href=\"#main-process\">processus principal</a></p>\n<h3 id=\"mode-bac-à-sable\"><a href=\"#mode-bac-à-sable\">mode bac à sable</a></h3>\n<p>Le bac à sable est une fonctionnalité de sécurité héritée de Chromium qui limite vos processus de rendu à un ensemble limité d'autorisations.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/sandbox\">Process Sandboxing</a> tutorial.</p>\n<p>See also: <a href=\"#process\">process</a></p>\n<h3 id=\"squirrel\"><a href=\"#squirrel\">Squirrel</a></h3>\n<p>Squirrel est un framework open-source permettant aux apps Electron de se mettre à jour automatiquement quand une nouvelle version est disponible. Voir l'API <a href=\"/docs/api/auto-updater\">autoUpdater</a> pour plus d’informations sur comment démarrer avec Squirrel.</p>\n<h3 id=\"userland\"><a href=\"#userland\">userland</a></h3>\n<p>Ce terme provient de la communauté Unix, où « userland » ou « userspace » fait référence aux programmes qui s’exécutent en dehors du noyau de système d’exploitation. Plus récemment, le terme a été popularisé dans Node et la communauté npm afin d’établir une distinction entre les fonctionnalités disponibles dans « Node core » par rapport aux paquets publié au registre npm par une grande majorité « d'utilisateurs » de la communauté.</p>\n<p>Comme Node, Electron se concentre sur le fait d'avoir un petit ensemble d'APIs qui fournissent tout le nécessaire primaire pour développer des applications de bureau multiplateformes. Cette philosophie de conception permet à Electron de rester un outil souple sans être trop normative sur la façon dont il doit être utilisé. L'Userland permet aux utilisateurs de créer et partager des outils qui fournissent des fonctionnalités supplémentaires au dessus de ce qui est disponible dans le « noyau ».</p>\n<h3 id=\"v8\"><a href=\"#v8\">V8</a></h3>\n<p>V8 est le moteur JavaScript open source de Google. Il est écrit en C++ et est utilisé dans Google Chrome. V8 can run standalone, or can be embedded into any C++ application.</p>\n<p>Electron compile V8 de Chromium et fait pointer Node à ce V8 pendant la compilation.</p>\n<p>V8's version numbers always correspond to those of Google Chrome. Chrome 59 includes V8 5.9, Chrome 58 includes V8 5.8, etc.</p>\n<ul>\n<li><a href=\"https://v8.dev/\">v8.dev</a></li>\n<li><a href=\"https://nodejs.org/api/v8.html\">nodejs.org/api/v8.html</a></li>\n<li><a href=\"/docs/development/v8-development\">docs/development/v8-development.md</a></li>\n</ul>\n<h3 id=\"webview\"><a href=\"#webview\">webview</a></h3>\n<p><code>webview</code> tags are used to embed 'guest' content (such as external web pages) in your Electron app. They are similar to <code>iframe</code>s, but differ in that each webview runs in a separate process. Il n’a pas les mêmes autorisations que votre page web et toutes les interactions entre votre application et le contenu incorporé seront asynchrones. Cela protège votre application du contenu incorporé.</p>",
      "title": "Glossaire",
      "description": ""
    },
    "/docs/development/goma": {
      "locale": "fr-FR",
      "slug": "goma",
      "href": "/docs/development/goma",
      "crowdinFileId": "256157",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/goma.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"goma\"><a href=\"#goma\">Goma</a></h1>\n<blockquote>\n<p>Goma est un service de compilation distribué pour les projets open source tels que Chrome et Android.</p>\n</blockquote>\n<p>Electron has a deployment of a custom Goma Backend that we make available to all Electron Maintainers.  See the <a href=\"#access\">Access</a> section below for details on authentication.  There is also a <code>cache-only</code> Goma endpoint that will be used by default if you do not have credentials.  Requests to the cache-only Goma will not hit our cluster, but will read from our cache and should result in significantly faster build times.</p>\n<h2 id=\"enabling-goma\"><a href=\"#enabling-goma\">Enabling Goma</a></h2>\n<p>Currently the only supported way to use Goma is to use our <a href=\"https://github.com/electron/build-tools\">Build Tools</a>. La configuration de Goma est automatiquement incluse lorsque vous configurez <code>build-tools</code>.</p>\n<p>If you are a maintainer and have access to our cluster, please ensure that you run <code>e init</code> with <code>--goma=cluster</code> in order to configure <code>build-tools</code> to use the Goma cluster.  If you have an existing config, you can just set <code>\"goma\": \"cluster\"</code> in your config file.</p>\n<h2 id=\"building-with-goma\"><a href=\"#building-with-goma\">Building with Goma</a></h2>\n<p>When you are using Goma you can run <code>ninja</code> with a substantially higher <code>j</code> value than would normally be supported by your machine.</p>\n<p>Veuillez ne pas définir une valeur supérieure à <strong>200</strong> sous Windows ou Linux et <strong>50</strong> sur macOS. We monitor Goma system usage, and users found to be abusing it with unreasonable concurrency will be de-activated.</p>\n<pre><code class=\"hljs language-bash\">ninja -C out/Testing electron -j 200\n</code></pre>\n<p>If you're using <code>build-tools</code>, appropriate <code>-j</code> values will automatically be used for you.</p>\n<h2 id=\"monitoring-goma\"><a href=\"#monitoring-goma\">Monitoring Goma</a></h2>\n<p>Si vous accédez à <a href=\"http://localhost:8088\">http://localhost:8088</a> sur votre machine, vous pouvez surveiller les tâches de compilation au fur et à mesure qu'elles transitent par le système goma.</p>\n<h2 id=\"access\"><a href=\"#access\">Access</a></h2>\n<p>Pour des raisons de sécurité et de coût, l'accès au cluster Goma d'Electron est actuellement restreint aux mainteneurs d'Electron.  Si vous souhaitez y accéder, rendez-vous sur <code>#access-requests</code> dans Slack et ping <code>@goma-squad</code> pour demander l'accès.  Please be aware that being a maintainer does not <em>automatically</em> grant access and access is determined on a case by case basis.</p>\n<h2 id=\"uptime--support\"><a href=\"#uptime--support\">Uptime / Support</a></h2>\n<p>Nous avons une surveillance automatisée de notre cluster et de notre cache Goma sur <a href=\"https://status.notgoma.com\">https://status.notgoma.com</a></p>\n<p>We do not provide support for usage of Goma and any issues raised asking for help / having issues will <em>probably</em> be closed without much reason, we do not have the capacity to handle that kind of support.</p>",
      "title": "Goma",
      "description": "Goma est un service de compilation distribué pour les projets open source tels que Chrome et Android."
    },
    "/docs/api/structures/gpu-feature-status": {
      "locale": "fr-FR",
      "slug": "gpu-feature-status",
      "href": "/docs/api/structures/gpu-feature-status",
      "crowdinFileId": "256439",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/gpu-feature-status.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"gpufeaturestatus-object\"><a href=\"#gpufeaturestatus-object\">GPUFeatureStatus Object</a></h1>\n<ul>\n<li><code>2d_canvas</code> String - Canvas.</li>\n<li><code>flash_3d</code> String - Flash.</li>\n<li><code>flash_stage3d</code> String - Flash Stage3D.</li>\n<li><code>flash_stage3d_baseline</code> String - Flash Stage3D Baseline profile.</li>\n<li><code>gpu_compositing</code> String - Compositing.</li>\n<li><code>multiple_raster_threads</code> String - Multiple Raster Threads.</li>\n<li><code>native_gpu_memory_buffers</code> String - Native GpuMemoryBuffers.</li>\n<li><code>rasterization</code> String - Rasterization.</li>\n<li><code>video_decode</code> String - Video Decode.</li>\n<li><code>video_encode</code> String - Video Encode.</li>\n<li><code>vpx_decode</code> String - VPx Video Decode.</li>\n<li><code>webgl</code> String - WebGL.</li>\n<li><code>webgl2</code> String - WebGL2.</li>\n</ul>\n<p>Valeurs possibles :</p>\n<ul>\n<li><code>disabled_software</code> - Software only. Hardware acceleration disabled (yellow)</li>\n<li><code>disabled_off</code> - Disabled (red)</li>\n<li><code>disabled_off_ok</code> - Disabled (yellow)</li>\n<li><code>unavailable_software</code> - Software only, hardware acceleration unavailable (yellow)</li>\n<li><code>unavailable_off</code> - Unavailable (red)</li>\n<li><code>unavailable_off_ok</code> - Unavailable (yellow)</li>\n<li><code>enabled_readback</code> - Hardware accelerated but at reduced performance (yellow)</li>\n<li><code>enabled_force</code> - Hardware accelerated on all pages (green)</li>\n<li><code>enabled</code> - Hardware accelerated (green)</li>\n<li><code>enabled_on</code> - Enabled (green)</li>\n<li><code>enabled_force_on</code> - Force enabled (green)</li>\n</ul>",
      "title": "GPUFeatureStatus Object",
      "description": ""
    },
    "/docs/api/structures/hid-device": {
      "locale": "fr-FR",
      "slug": "hid-device",
      "href": "/docs/api/structures/hid-device",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/hid-device.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"hiddevice-object\"><a href=\"#hiddevice-object\">HIDDevice Object</a></h1>\n<ul>\n<li><code>deviceId</code> String - Unique identifier for the device.</li>\n<li><code>name</code> String - Name of the device.</li>\n<li><code>vendorId</code> Integer - The USB vendor ID.</li>\n<li><code>productId</code> Integer - The USB product ID.</li>\n<li><code>serialNumber</code> String (optional) - The USB device serial number.</li>\n<li><code>guid</code> String (optional) - Unique identifier for the HID interface.  A device may have multiple HID interfaces.</li>\n</ul>",
      "title": "HIDDevice Object",
      "description": ""
    },
    "/docs/api/in-app-purchase": {
      "locale": "fr-FR",
      "slug": "in-app-purchase",
      "href": "/docs/api/in-app-purchase",
      "crowdinFileId": "256325",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/in-app-purchase.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"achat-inapp\"><a href=\"#achat-inapp\">Achat inApp</a></h1>\n<blockquote>\n<p>Achats inApp sur l'Apple Store.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h2 id=\"événements\"><a href=\"#événements\">Événements</a></h2>\n<p>Le module <code>inAppPurchase</code> émet les événements suivants :</p>\n<h3 id=\"événement--transactions-updated\"><a href=\"#événement--transactions-updated\">Événement : 'transactions-updated'</a></h3>\n<p>Émis lorsqu’une ou plusieurs transactions ont été mises à jour.</p>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>transactions</code> Transaction[] - Tableau d'objets <a href=\"/docs/api/structures/transaction\"><code>Transaction</code></a>.</li>\n</ul>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module <code>inAppPurchase</code> possède les méthodes suivantes :</p>\n<h3 id=\"inapppurchasepurchaseproductproductid-quantity\"><a href=\"#inapppurchasepurchaseproductproductid-quantity\"><code>inAppPurchase.purchaseProduct(productID[, quantity])</code></a></h3>\n<ul>\n<li><code>productID</code> String - Les identifiants du produit à acheter. (L'identifiant de <code>com.example.app.product1</code> est <code>product1</code>).</li>\n<li><code>quantity</code> Integer (optionnel) - Le nombre d'items que l'utilisateur veut acheter.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Boolean></code> - Returns <code>true</code> if the product is valid and added to the payment queue.</p>\n<p>Tu devrais écouter l'événement <code>transactions-updated</code> dès que possible et surement avant d'appeler <code>purchaseProduct</code>.</p>\n<h3 id=\"inapppurchasegetproductsproductids\"><a href=\"#inapppurchasegetproductsproductids\"><code>inAppPurchase.getProducts(productIDs)</code></a></h3>\n<ul>\n<li><code>productIDs</code> String[] - Les identifiants des produits à recevoir.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Product[]></code> - Resolves with an array of <a href=\"/docs/api/structures/product\"><code>Product</code></a> objects.</p>\n<p>Retourne les descriptions des produits.</p>\n<h3 id=\"inapppurchasecanmakepayments\"><a href=\"#inapppurchasecanmakepayments\"><code>inAppPurchase.canMakePayments()</code></a></h3>\n<p>Returns <code>Boolean</code> - whether a user can make a payment.</p>\n<h3 id=\"inapppurchaserestorecompletedtransactions\"><a href=\"#inapppurchaserestorecompletedtransactions\"><code>inAppPurchase.restoreCompletedTransactions()</code></a></h3>\n<p>Restores finished transactions. This method can be called either to install purchases on additional devices, or to restore purchases for an application that the user deleted and reinstalled.</p>\n<p><a href=\"https://developer.apple.com/documentation/storekit/skpaymentqueue?language=objc\">The payment queue</a> delivers a new transaction for each previously completed transaction that can be restored. Each transaction includes a copy of the original transaction.</p>\n<h3 id=\"inapppurchasegetreceipturl\"><a href=\"#inapppurchasegetreceipturl\"><code>inAppPurchase.getReceiptURL()</code></a></h3>\n<p>Returns <code>String</code> - the path to the receipt.</p>\n<h3 id=\"inapppurchasefinishalltransactions\"><a href=\"#inapppurchasefinishalltransactions\"><code>inAppPurchase.finishAllTransactions()</code></a></h3>\n<p>Termine toutes les transactions en cours.</p>\n<h3 id=\"inapppurchasefinishtransactionbydatedate\"><a href=\"#inapppurchasefinishtransactionbydatedate\"><code>inAppPurchase.finishTransactionByDate(date)</code></a></h3>\n<ul>\n<li><code>date</code> String - La date sous format ISO de la fin de la transaction.</li>\n</ul>\n<p>Termine les transactions correspondantes à la date.</p>",
      "title": "Achat inApp",
      "description": "Achats inApp sur l'Apple Store."
    },
    "/docs/tutorial/in-app-purchases": {
      "locale": "fr-FR",
      "slug": "in-app-purchases",
      "href": "/docs/tutorial/in-app-purchases",
      "crowdinFileId": "256203",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/in-app-purchases.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"achats-avec-lapplication-macos\"><a href=\"#achats-avec-lapplication-macos\">Achats avec l'application (macOS)</a></h1>\n<h2 id=\"préparation\"><a href=\"#préparation\">Préparation</a></h2>\n<h3 id=\"paid-applications-agreement\"><a href=\"#paid-applications-agreement\">Paid Applications Agreement</a></h3>\n<p>If you haven't already, you’ll need to sign the Paid Applications Agreement and set up your banking and tax information in iTunes Connect.</p>\n<p><a href=\"https://help.apple.com/itunes-connect/developer/#/devb6df5ee51\">iTunes Connect Developer Help: Agreements, tax, and banking overview</a></p>\n<h3 id=\"create-your-in-app-purchases\"><a href=\"#create-your-in-app-purchases\">Create Your In-App Purchases</a></h3>\n<p>Then, you'll need to configure your in-app purchases in iTunes Connect, and include details such as name, pricing, and description that highlights the features and functionality of your in-app purchase.</p>\n<p><a href=\"https://help.apple.com/itunes-connect/developer/#/devae49fb316\">iTunes Connect Developer Help: Create an in-app purchase</a></p>\n<h3 id=\"change-the-cfbundleidentifier\"><a href=\"#change-the-cfbundleidentifier\">Change the CFBundleIdentifier</a></h3>\n<p>To test In-App Purchase in development with Electron you'll have to change the <code>CFBundleIdentifier</code> in <code>node_modules/electron/dist/Electron.app/Contents/Info.plist</code>. You have to replace <code>com.github.electron</code> by the bundle identifier of the application you created with iTunes Connect.</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>CFBundleIdentifier<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>com.example.app<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n</code></pre>\n<h2 id=\"code-example\"><a href=\"#code-example\">Code example</a></h2>\n<p>Here is an example that shows how to use In-App Purchases in Electron. You'll have to replace the product ids by the identifiers of the products created with iTunes Connect (the identifier of <code>com.example.app.product1</code> is <code>product1</code>). Note that you have to listen to the <code>transactions-updated</code> event as soon as possible in your app.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Processus principal</span>\n<span class=\"hljs-keyword\">const</span> { inAppPurchase } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> PRODUCT_IDS = [<span class=\"hljs-string\">'id1'</span>, <span class=\"hljs-string\">'id2'</span>]\n\n<span class=\"hljs-comment\">// Écouter les transactions dès que possible.</span>\ninAppPurchase.on(<span class=\"hljs-string\">'transactions-updated'</span>, (event, transactions) => {\n  <span class=\"hljs-keyword\">if</span> (!<span class=\"hljs-built_in\">Array</span>.isArray(transactions)) {\n    <span class=\"hljs-keyword\">return</span>\n  }\n\n  <span class=\"hljs-comment\">// Check each transaction.</span>\n  transactions.forEach(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\">transaction</span>) </span>{\n    <span class=\"hljs-keyword\">const</span> payment = transaction.payment\n\n    <span class=\"hljs-keyword\">switch</span> (transaction.transactionState) {\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'purchasing'</span>:\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Purchasing <span class=\"hljs-subst\">${payment.productIdentifier}</span>...`</span>)\n        <span class=\"hljs-keyword\">break</span>\n\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'purchased'</span>: {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${payment.productIdentifier}</span> purchased.`</span>)\n\n        <span class=\"hljs-comment\">// Get the receipt url.</span>\n        <span class=\"hljs-keyword\">const</span> receiptURL = inAppPurchase.getReceiptURL()\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Receipt URL: <span class=\"hljs-subst\">${receiptURL}</span>`</span>)\n\n        <span class=\"hljs-comment\">// Submit the receipt file to the server and check if it is valid.</span>\n        <span class=\"hljs-comment\">// @see https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html</span>\n        <span class=\"hljs-comment\">// ...</span>\n        <span class=\"hljs-comment\">// If the receipt is valid, the product is purchased</span>\n        <span class=\"hljs-comment\">// ...</span>\n\n        <span class=\"hljs-comment\">// Terminer la transaction.</span>\n        inAppPurchase.finishTransactionByDate(transaction.transactionDate)\n\n        <span class=\"hljs-keyword\">break</span>\n      }\n\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'failed'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Failed to purchase <span class=\"hljs-subst\">${payment.productIdentifier}</span>.`</span>)\n\n        <span class=\"hljs-comment\">// Finish the transaction.</span>\n        inAppPurchase.finishTransactionByDate(transaction.transactionDate)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'restored'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The purchase of <span class=\"hljs-subst\">${payment.productIdentifier}</span> has been restored.`</span>)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'deferred'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The purchase of <span class=\"hljs-subst\">${payment.productIdentifier}</span> has been deferred.`</span>)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-attr\">default</span>:\n        <span class=\"hljs-keyword\">break</span>\n    }\n  })\n})\n\n<span class=\"hljs-comment\">// Check if the user is allowed to make in-app purchase.</span>\n<span class=\"hljs-keyword\">if</span> (!inAppPurchase.canMakePayments()) {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The user is not allowed to make in-app purchase.'</span>)\n}\n\n<span class=\"hljs-comment\">// Retrieve and display the product descriptions.</span>\ninAppPurchase.getProducts(PRODUCT_IDS).then(<span class=\"hljs-function\"><span class=\"hljs-params\">products</span> =></span> {\n  <span class=\"hljs-comment\">// Check the parameters.</span>\n  <span class=\"hljs-keyword\">if</span> (!<span class=\"hljs-built_in\">Array</span>.isArray(products) || products.length &#x3C;= <span class=\"hljs-number\">0</span>) {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Unable to retrieve the product informations.'</span>)\n    <span class=\"hljs-keyword\">return</span>\n  }\n\n  <span class=\"hljs-comment\">// Display the name and price of each product.</span>\n  products.forEach(<span class=\"hljs-function\"><span class=\"hljs-params\">product</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The price of <span class=\"hljs-subst\">${product.localizedTitle}</span> is <span class=\"hljs-subst\">${product.formattedPrice}</span>.`</span>)\n  })\n\n  <span class=\"hljs-comment\">// Ask the user which product he/she wants to purchase.</span>\n  <span class=\"hljs-keyword\">const</span> selectedProduct = products[<span class=\"hljs-number\">0</span>]\n  <span class=\"hljs-keyword\">const</span> selectedQuantity = <span class=\"hljs-number\">1</span>\n\n  <span class=\"hljs-comment\">// Purchase the selected product.</span>\n  inAppPurchase.purchaseProduct(selectedProduct.productIdentifier, selectedQuantity).then(<span class=\"hljs-function\"><span class=\"hljs-params\">isProductValid</span> =></span> {\n    <span class=\"hljs-keyword\">if</span> (!isProductValid) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The product is not valid.'</span>)\n      <span class=\"hljs-keyword\">return</span>\n    }\n\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The payment has been added to the payment queue.'</span>)\n  })\n})\n</code></pre>",
      "title": "Achats avec l'application (macOS)",
      "description": ""
    },
    "/docs/api/incoming-message": {
      "locale": "fr-FR",
      "slug": "incoming-message",
      "href": "/docs/api/incoming-message",
      "crowdinFileId": "256327",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/incoming-message.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe--incomingmessage\"><a href=\"#classe--incomingmessage\">Classe : IncomingMessage</a></h2>\n<blockquote>\n<p>Gère les réponses aux requêtes HTTP/HTTPS.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>IncomingMessage</code> Implémente l'interface <a href=\"https://nodejs.org/api/stream.html#stream_readable_streams\">Readable Stream</a> et est donc un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h3 id=\"événements-dinstance\"><a href=\"#événements-dinstance\">Événements d’instance</a></h3>\n<h4 id=\"événement--data\"><a href=\"#événement--data\">Événement : 'data'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>chunk</code> Buffer - Un segment de données du corps de réponse.</li>\n</ul>\n<p>L'événement <code>data</code> est la méthode habituelle de transfert des données de réponse dans le code applicatif.</p>\n<h4 id=\"événement--end\"><a href=\"#événement--end\">Événement : 'end'</a></h4>\n<p>Indique que le corps de réponse est terminée. Must be placed before 'data' event.</p>\n<h4 id=\"événement--aborted\"><a href=\"#événement--aborted\">Événement : 'aborted'</a></h4>\n<p>Émis lorsqu’une requête a été annulée lors d’une transaction HTTP en cours.</p>\n<h4 id=\"événement--error\"><a href=\"#événement--error\">Événement : 'error'</a></h4>\n<p>Retourne :</p>\n<p><code>error</code> Error - Retourne généralement une chaîne de caractères d’erreur identifiant les causes d’échec.</p>\n<p>Émis lorsqu’une erreur s’est produite pendant le transfert d’événements de données de réponse. Par exemple, si le serveur ferme la connexion alors que la réponse est toujours en transfert, un événement <code>error</code> retentit sur l’objet de réponse et un événement <code>close</code> suivra par la suite sur l’objet de la demande.</p>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<p>Une instance <code>IncomingMessage</code> possède les propriétés suivantes :</p>\n<h4 id=\"responsestatuscode\"><a href=\"#responsestatuscode\"><code>response.statusCode</code></a></h4>\n<p>Un <code>Integer</code> indiquant le code d'état de la réponse HTTP.</p>\n<h4 id=\"responsestatusmessage\"><a href=\"#responsestatusmessage\"><code>response.statusMessage</code></a></h4>\n<p>Un <code>String</code> représentant le message d'état HTTP.</p>\n<h4 id=\"responseheaders\"><a href=\"#responseheaders\"><code>response.headers</code></a></h4>\n<p>A <code>Record&#x3C;string, string | string[]></code> representing the HTTP response headers. The <code>headers</code> object is formatted as follows:</p>\n<ul>\n<li>Tous les noms d’en-têtes sont en minuscules.</li>\n<li>Duplicates of <code>age</code>, <code>authorization</code>, <code>content-length</code>, <code>content-type</code>, <code>etag</code>, <code>expires</code>, <code>from</code>, <code>host</code>, <code>if-modified-since</code>, <code>if-unmodified-since</code>, <code>last-modified</code>, <code>location</code>, <code>max-forwards</code>, <code>proxy-authorization</code>, <code>referer</code>, <code>retry-after</code>, <code>server</code>, or <code>user-agent</code> are discarded.</li>\n<li><code>set-cookie</code> is always an array. Duplicates are added to the array.</li>\n<li>For duplicate <code>cookie</code> headers, the values are joined together with '; '.</li>\n<li>For all other headers, the values are joined together with ', '.</li>\n</ul>\n<h4 id=\"responsehttpversion\"><a href=\"#responsehttpversion\"><code>response.httpVersion</code></a></h4>\n<p>Un <code>String</code> indiquant le numéro de version du protocole HTTP. Les valeurs habituelles sont '1.0' ou '1.1'. De plus, <code>httpVersionMajor</code> et <code>httpVersionMinor</code> sont deux propriétés entières lisibles qui retournent respectivement les numéros de version principale et secondaire de HTTP.</p>\n<h4 id=\"responsehttpversionmajor\"><a href=\"#responsehttpversionmajor\"><code>response.httpVersionMajor</code></a></h4>\n<p>Un <code>Integer</code>indiquant le numéro de version majeur du protocol HTTP.</p>\n<h4 id=\"responsehttpversionminor\"><a href=\"#responsehttpversionminor\"><code>response.httpVersionMinor</code></a></h4>\n<p>Un <code>Integer</code> indiquant le numéro de version mineur du protocol HTTP.</p>",
      "title": "Classe : IncomingMessage",
      "description": "Gère les réponses aux requêtes HTTP/HTTPS."
    },
    "/docs/api/structures/input-event": {
      "locale": "fr-FR",
      "slug": "input-event",
      "href": "/docs/api/structures/input-event",
      "crowdinFileId": "256441",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"inputevent-object\"><a href=\"#inputevent-object\">InputEvent Object</a></h1>\n<ul>\n<li><code>modifiers</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of modifiers of the event, can be <code>shift</code>, <code>control</code>, <code>ctrl</code>, <code>alt</code>, <code>meta</code>, <code>command</code>, <code>cmd</code>, <code>isKeypad</code>, <code>isAutoRepeat</code>, <code>leftButtonDown</code>, <code>middleButtonDown</code>, <code>rightButtonDown</code>, <code>capsLock</code>, <code>numLock</code>, <code>left</code>, <code>right</code>.</li>\n</ul>",
      "title": "InputEvent Object",
      "description": ""
    },
    "/docs/tutorial/installation": {
      "locale": "fr-FR",
      "slug": "installation",
      "href": "/docs/tutorial/installation",
      "crowdinFileId": "256205",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/installation.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"instructions-dinstallation-avancées\"><a href=\"#instructions-dinstallation-avancées\">Instructions d’installation avancées</a></h1>\n<p>To install prebuilt Electron binaries, use <a href=\"https://docs.npmjs.com\"><code>npm</code></a>. The preferred method is to install Electron as a development dependency in your app:</p>\n<pre><code class=\"hljs language-sh\">npm install electron --save-dev\n</code></pre>\n<p>Voir la <a href=\"/docs/tutorial/electron-versioning\">documentation du versionnage</a> pour plus d'informations sur la façon de gérer différentes versions d'Electron dans vos applications.</p>\n<h2 id=\"running-electron-ad-hoc\"><a href=\"#running-electron-ad-hoc\">Running Electron ad-hoc</a></h2>\n<p>If you're in a pinch and would prefer to not use <code>npm install</code> in your local project, you can also run Electron ad-hoc using the <a href=\"https://docs.npmjs.com/cli/v7/commands/npx\"><code>npx</code></a> command runner bundled with <code>npm</code>:</p>\n<pre><code class=\"hljs language-sh\">npx electron .\n</code></pre>\n<p>La commande ci-dessus exécutera le répertoire de travail actuel avec Electron. Note that any dependencies in your app will not be installed.</p>\n<h2 id=\"personnalisation\"><a href=\"#personnalisation\">Personnalisation</a></h2>\n<p>Si vous souhaitez modifier l'architecture qui est téléchargée (par exemple, <code>ia32</code> sur une machine <code>x64</code>), vous pouvez utiliser le paramètre <code>--arch</code> avec npm install ou définir la variable d'environnement <code>npm_config_arch</code> :</p>\n<pre><code class=\"hljs language-shell\">npm install --arch=ia32 electron\n</code></pre>\n<p>En plus de modifier l'architecture, vous pouvez également spécifier la platforme (par exemple, <code>win32</code>, <code>linux</code>, etc.) en utilisant le paramètre <code>--platform</code> :</p>\n<pre><code class=\"hljs language-shell\">npm install --platform=win32 electron\n</code></pre>\n<h2 id=\"les-proxys\"><a href=\"#les-proxys\">Les proxys</a></h2>\n<p>If you need to use an HTTP proxy, you need to set the <code>ELECTRON_GET_USE_PROXY</code> variable to any value, plus additional environment variables depending on your host system's Node version:</p>\n<ul>\n<li><a href=\"https://github.com/gajus/global-agent/blob/v2.1.5/README.md#environment-variables\">Node 10 et plus</a></li>\n<li><a href=\"https://github.com/np-maintain/global-tunnel/blob/v2.7.1/README.md#auto-config\">Avant Node 10</a></li>\n</ul>\n<h2 id=\"mirroirs-et-caches-personnalisés\"><a href=\"#mirroirs-et-caches-personnalisés\">Mirroirs et Caches personnalisés</a></h2>\n<p>Lors de l’installation, le module <code>electron</code> appellera <a href=\"https://github.com/electron/get\"><code>@electron/get</code></a> pour télécharger les binaires précompilés d’Electron pour votre plate-forme. Cela se fera en se connectant à la page GitHub des release (<code>https://github.com/electron/electron/releases/tag/v$VERSION</code>, ou <code>$VERSION</code> est la version exacte d'Electron).</p>\n<p>Si vous êtes dans l'incapacité d'accéder à github ou si vous avez besoin de fournir un binaire personnalisé, vous pouvez aussi le faire en mettant à disposition un miroir ou un répertoire de cache existant.</p>\n<h4 id=\"miroir\"><a href=\"#miroir\">Miroir</a></h4>\n<p>Vous pouvez utiliser des variables d’environnement pour substituer l’URL de base, le chemin d’accès où chercher les binaires d'Electron, et le nom du fichier binaire. The URL used by <code>@electron/get</code> is composed as follows:</p>\n<pre><code class=\"hljs language-javascript\">url = ELECTRON_MIRROR + ELECTRON_CUSTOM_DIR + <span class=\"hljs-string\">'/'</span> + ELECTRON_CUSTOM_FILENAME\n</code></pre>\n<p>For instance, to use the China CDN mirror:</p>\n<pre><code class=\"hljs language-shell\">ELECTRON_MIRROR=\"https://cdn.npm.taobao.org/dist/electron/\"\n</code></pre>\n<p>Par défaut, <code>ELECTRON_CUSTOM_DIR</code> est défini sur <code>v$VERSION</code>. To change the format, use the <code>{{ version }}</code> placeholder. For example, <code>version-{{ version }}</code> resolves to <code>version-5.0.0</code>, <code>{{ version }}</code> resolves to <code>5.0.0</code>, and <code>v{{ version }}</code> is equivalent to the default. As a more concrete example, to use the China non-CDN mirror:</p>\n<pre><code class=\"hljs language-shell\">ELECTRON_MIRROR=\"https://npm.taobao.org/mirrors/electron/\"\nELECTRON_CUSTOM_DIR=\"{{ version }}\"\n</code></pre>\n<p>La configuration ci-dessus sera téléchargée à partir d'URL telles que <code>https://npm.taobao.org/mirrors/electron/8.0.0/electron-v8.0.0-linux-x64.zip</code>.</p>\n<p>Si votre serveur miroir délivre des artefacts avec des checksums différentes de celles de la version officielle d'Electron, vous devrez définir <code>ELECTRON_USE_REMOTE_CHECKSUMS=1</code> afin forcer Electron à utiliser le fichier distant <code>SHASUMS256.txt</code> pour vérifier la somme de contrôle au lieu de celles intégrées.</p>\n<h4 id=\"cache\"><a href=\"#cache\">Cache</a></h4>\n<p>Egalement vous pouvez, surcharger le cache local. <code>@electron/get</code> mettra en cache le téléchargement des binaires dans un répertoire local afin d'économiser de la bande passante. Vous pouvez utiliser ce répertoire de cache pour fournir des binaires personnalisés d'Electron ou pour éviter d'utiliser le réseau.</p>\n<ul>\n<li>Linux: <code>$XDG_CACHE_HOME</code> or <code>~/.cache/electron/</code></li>\n<li>macOS: <code>~/Library/Caches/electron/</code></li>\n<li>Windows: <code>$LOCALAPPDATA/electron/Cache</code> or <code>~/AppData/Local/electron/Cache/</code></li>\n</ul>\n<p>Sur les environnements qui utilisent des versions plus anciennes d’électron, vous pourriez trouver le cache aussi dans <code>~/.electron</code>.</p>\n<p>Vous pouvez également substituer l’emplacement du cache local en fournissant une variable d’environnement <code>electron_config_cache</code>.</p>\n<p>The cache contains the version's official zip file as well as a checksum, stored as a text file. A typical cache might look like this:</p>\n<pre><code class=\"hljs language-sh\">├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9electron-v1.7.9-darwin-x64.zip\n│   └── electron-v1.7.9-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1electron-v1.8.1-darwin-x64.zip\n│   └── electron-v1.8.1-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1electron-v1.8.2-beta.1-darwin-x64.zip\n│   └── electron-v1.8.2-beta.1-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2electron-v1.8.2-beta.2-darwin-x64.zip\n│   └── electron-v1.8.2-beta.2-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3electron-v1.8.2-beta.3-darwin-x64.zip\n│   └── electron-v1.8.2-beta.3-darwin-x64.zip\n└── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3SHASUMS256.txt\n    └── SHASUMS256.txt\n</code></pre>\n<h2 id=\"désactiver-le-téléchargement-des-binaires\"><a href=\"#désactiver-le-téléchargement-des-binaires\">Désactiver le téléchargement des binaires</a></h2>\n<p>Sous le capot, l'API JavaScript d'Electron est rattachée à un binaire contenant son implémentation. Ce binaire est indispensable au fonctionnement de toute application Electron, il est donc téléchargé par défaut dans l’étape du <code>postinstall</code> chaque fois que vous installez <code>electron</code> à partir du dépôt npm.</p>\n<p>Toutefois, si vous souhaitez installer les dépendances de votre projet sans avoir besoin d’utiliser les fonctionnalité d'Electron, vous pouvez définir la variable d’environnement <code>ELECTRON_SKIP_BINARY_DOWNLOAD</code> pour empêcher le téléchargement du fichier binaire. Ce peut être utile, par exemple dans les environnements d’intégration continue lors de l’exécution de tests unitaires qui simulent le module <code>electron</code> .</p>\n<pre><code class=\"hljs language-sh\">ELECTRON_SKIP_BINARY_DOWNLOAD=1 npm install\n</code></pre>\n<h2 id=\"résolution-de-problème\"><a href=\"#résolution-de-problème\">Résolution de problème</a></h2>\n<p>Lorsque vous exécutez <code>npm install electron</code>, certains utilisateurs rencontrent parfois des erreurs d'installation.</p>\n<p>Dans la plupart des cas, ces erreurs sont le résultat d'un problème de réseau et non un soucis avec le packet npm <code>electron</code>. Les erreurs comme <code>ELIFECYCLE</code>, <code>EAI_AGAIN</code>, <code>ECONNRESET</code> et <code>ETIMEDOUT</code> sont toutes des indications d'un problème de réseau. La meilleure solution est d'essayer en changeant de réseau ou juste d'attendre un peu et de réessayer l'installation.</p>\n<p>Vous pouvez également essayer de télécharger Electron directement depuis <a href=\"https://github.com/electron/electron/releases\">electron/electron/releases</a> si l'installation via <code>npm</code> ne marche pas.</p>\n<p>If installation fails with an <code>EACCESS</code> error you may need to <a href=\"https://docs.npmjs.com/getting-started/fixing-npm-permissions\">fix your npm permissions</a>.</p>\n<p>If the above error persists, the <a href=\"https://docs.npmjs.com/misc/config#unsafe-perm\">unsafe-perm</a> flag may need to be set to true:</p>\n<pre><code class=\"hljs language-sh\">sudo npm install electron --unsafe-perm=<span class=\"hljs-literal\">true</span>\n</code></pre>\n<p>Sur des réseaux plus lents, il est plus souhaitable d'utiliser le paramètre <code>--verbose</code> pour afficher la progression du téléchargement :</p>\n<pre><code class=\"hljs language-sh\">npm install --verbose electron\n</code></pre>\n<p>Si vous devez forcer le re-téléchargement de l'asset et du fichier SHASUM, mettez la variable d'environnement <code>force_no_cache</code> à <code>true</code>.</p>",
      "title": "Instructions d’installation avancées",
      "description": ""
    },
    "/docs/tutorial/introduction": {
      "locale": "fr-FR",
      "slug": "introduction",
      "href": "/docs/tutorial/introduction",
      "crowdinFileId": "256207",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/introduction.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"introduction\"><a href=\"#introduction\">Introduction</a></h1>\n<p>Bienvenue sur la documentation d'Electron ! Si c'est la première fois que vous développez une application Electron, lisez cette section Getting Started pour vous familiariser avec les bases. Sinon, n'hésitez pas à explorer nos guides et notre documentation sur l'API !</p>\n<h2 id=\"quest-ce-quelectron-\"><a href=\"#quest-ce-quelectron-\">Qu'est-ce qu'Electron ?</a></h2>\n<p>Electron est un framework pour construire des applications de bureau en utilisant JavaScript, HTML et CSS. En intégrant <a href=\"https://www.chromium.org/\">Chromium</a> et <a href=\"https://nodejs.org/\">Node.js</a> dans son binaire, Electron vous permet de maintenir une base de code JavaScript et de créer des applications multi-plateformes qui fonctionnent sous Windows, MacOS et Linux — aucune expérience de développement natif requise.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<p>Ces docs fonctionnent en supposant que le lecteur est familier avec Node.js et le développement web général. Si vous avez besoin d'être plus à l'aise avec l'un ou l'autre de ces domaines, nous vous recommandons les ressources suivantes :</p>\n<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web\">Commencer avec le Web (MDN)</a></li>\n<li><a href=\"https://nodejs.dev/learn\">Introduction à Node.js</a></li>\n</ul>\n<p>De plus, vous comprendrez mieux comment fonctionne Electron si vous vous familiarisé avec le modèle de processus de Chromium. Vous pouvez obtenir un bref aperçu de l'architecture Chrome avec la <a href=\"https://www.google.com/googlebooks/chrome/\">bande dessinée Chrome </a>, qui a été publiée en même temps que le lancement de Chrome en 2008. Bien que cela fait plus d’une décennie depuis, les principes de base introduits dans la bande dessinée restent utiles pour comprendre Electron.</p>\n<h2 id=\"exemples-dexécution-avec-electron-fiddle\"><a href=\"#exemples-dexécution-avec-electron-fiddle\">Exemples d'exécution avec Electron Fiddle</a></h2>\n<p><a href=\"https://electronjs.org/fiddle\">Electron Fiddle</a> est une application de type bac à sable écrite avec Electron et supportée par les contributeurs d'Electron. Nous recommandons fortement de l'installer comme outil d'apprentissage pour expérimenter avec les API d'Electron ou pour prototyper des fonctionnalités pendant le développement.</p>\n<p>Fiddle s'intègre également parfaitement à notre documentation. Lorsque vous parcourrez des exemples dans nos tutoriels, vous verrez fréquemment un bouton \"Ouvrir dans Electron Fiddle\" sous un bloc de code. Si vous avez Fiddle installé, ce bouton ouvrira un lien <code>fiddle.electronjs.org</code> qui chargera automatiquement l'exemple dans Fiddle, pas de copier-coller requis.</p>\n<h2 id=\"pour-obtenir-de-laide\"><a href=\"#pour-obtenir-de-laide\">Pour obtenir de l'aide</a></h2>\n<p>Êtes-vous coincé quelque part ? Voici quelques liens vers des endroits où chercher :</p>\n<ul>\n<li>Si vous avez besoin d'aide pour développer votre application, notre <a href=\"https://discord.gg/electron\">serveur communautaire Discord</a> est un excellent endroit pour obtenir des conseils d'autres développeurs d'applications Electron.</li>\n<li>Si vous soupçonnez que vous rencontrez un bug avec le paquetage <code>electron</code> , veuillez consulter le <a href=\"https://github.com/electron/electron/issues\">suivi de tickets GitHub</a> pour voir si des problèmes existants correspondent au votre. Si ce n'est pas le cas, n'hésitez pas à remplir notre modèle de rapport de bug et à nous le soumettre.</li>\n</ul>",
      "title": "Introduction",
      "description": ""
    },
    "/docs/api/structures/io-counters": {
      "locale": "fr-FR",
      "slug": "io-counters",
      "href": "/docs/api/structures/io-counters",
      "crowdinFileId": "256443",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/io-counters.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"iocounters-object\"><a href=\"#iocounters-object\">IOCounters Object</a></h1>\n<ul>\n<li><code>readOperationCount</code> Number - The number of I/O read operations.</li>\n<li><code>writeOperationCount</code> Number - The number of I/O write operations.</li>\n<li><code>otherOperationCount</code> Number - Then number of I/O other operations.</li>\n<li><code>readTransferCount</code> Number - The number of I/O read transfers.</li>\n<li><code>writeTransferCount</code> Number - The number of I/O write transfers.</li>\n<li><code>otherTransferCount</code> Number - Then number of I/O other transfers.</li>\n</ul>",
      "title": "IOCounters Object",
      "description": ""
    },
    "/docs/api/ipc-main": {
      "locale": "fr-FR",
      "slug": "ipc-main",
      "href": "/docs/api/ipc-main",
      "crowdinFileId": "256329",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/ipc-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmain\"><a href=\"#ipcmain\">ipcMain</a></h1>\n<blockquote>\n<p>Communiquer de manière asynchrone depuis le processus main aux processus renderer.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>Le module <code>ipcMain</code> est un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">Event Emitter</a>. Lorsqu'il est utilisé dans le processus main, il gère les messages asynchrones et synchrones envoyés à partir d'un processus renderer (page web). Les messages envoyés par un renderer seront émis vers ce module.</p>\n<h2 id=\"envoyer-des-messages\"><a href=\"#envoyer-des-messages\">Envoyer des messages</a></h2>\n<p>Il est également possible d'envoyer des messages depuis le processus main pour le processus renderer. Voir <a href=\"/docs/api/web-contents#contentssendchannel-args\">webContents.send</a> pour plus d'information.</p>\n<ul>\n<li>Lors de l'envoi d'un message, le nom de l'événement est <code>channel</code>.</li>\n<li>Pour répondre à un message synchrone, vous devez définir <code>event.returnValue</code>.</li>\n<li>Pour renvoyer un message asynchrone à l'expéditeur, vous pouvez utiliser <code>event.reply(...)</code>.  Cette méthode d'aide gérera automatiquement les messages provenant des images qui ne sont pas le cadre principal (e. . iframes) alors que <code>event.sender.send(...)</code> enverra toujours au cadre principal.</li>\n</ul>\n<p>Un exemple d'envoi et de gestion des messages entre le processus main et renderer :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Dans le processus principal .</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'asynchronous-message'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// affiche \"ping\"</span>\n  event.reply(<span class=\"hljs-string\">'asynchronous-reply'</span>, <span class=\"hljs-string\">'pong'</span>)\n})\n\nipcMain.on(<span class=\"hljs-string\">'synchronous-message'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// affiche \"ping\"</span>\n  event.returnValue = <span class=\"hljs-string\">'pong'</span>\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Dans le processus de rendu (page web).</span>\n<span class=\"hljs-comment\">// NB. Electron APIs are only accessible from preload, unless contextIsolation is disabled.</span>\n<span class=\"hljs-comment\">// Voir https://www.electronjs.org/docs/tutorial/process-model#preload-scripts pour plus de détails.</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(ipcRenderer.sendSync(<span class=\"hljs-string\">'synchronous-message'</span>, <span class=\"hljs-string\">'ping'</span>)) <span class=\"hljs-comment\">// affiche \"pong\"</span>\n\nipcRenderer.on(<span class=\"hljs-string\">'asynchronous-reply'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// affiche \"pong\"</span>\n})\nipcRenderer.send(<span class=\"hljs-string\">'asynchronous-message'</span>, <span class=\"hljs-string\">'ping'</span>)\n</code></pre>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module de <code>ipcMain</code> possède les méthodes suivantes pour écouter les événements :</p>\n<h3 id=\"ipcmainonchannel-listener\"><a href=\"#ipcmainonchannel-listener\"><code>ipcMain.on(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>événement</code> IpcMainEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>En écoutant <code>channel</code>, lorsqu'un nouveau message arrive, <code>listener</code> sera appelé comme ceci <code>listener(event, args...)</code>.</p>\n<h3 id=\"ipcmainoncechannel-listener\"><a href=\"#ipcmainoncechannel-listener\"><code>ipcMain.once(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>événement</code> IpcMainEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Ajoute un <code>listener</code> à déclenchement unique pour l’événement. Ce <code>listener</code> sera appelé uniquement lors de la prochaine émission d'un message sur le <code>channel</code>, après quoi il sera supprimé.</p>\n<h3 id=\"ipcmainremovelistenerchannel-listener\"><a href=\"#ipcmainremovelistenerchannel-listener\"><code>ipcMain.removeListener(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Supprime le <code>listener</code> spécifié du tableau d'écouteurs pour le <code>channel</code> spécifié.</p>\n<h3 id=\"ipcmainremovealllistenerschannel\"><a href=\"#ipcmainremovealllistenerschannel\"><code>ipcMain.removeAllListeners([channel])</code></a></h3>\n<ul>\n<li><code>channel</code> String (facultatif)</li>\n</ul>\n<p>Supprime tous les écouteurs du <code>channel</code> spécifié.</p>\n<h3 id=\"ipcmainhandlecanal-écouteur\"><a href=\"#ipcmainhandlecanal-écouteur\"><code>ipcMain.handle(canal, écouteur)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function&#x3C;Promise\\<void> | any><ul>\n<li><code>événement</code> IpcMainInvokeEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></void></li>\n</ul>\n<p>Adds a handler for an <code>invoke</code>able IPC. This handler will be called whenever a renderer calls <code>ipcRenderer.invoke(channel, ...args)</code>.</p>\n<p>Si <code>listener</code> renvoie une Promise, le résultat final de la promesse sera retourné en réponse à l'appelant distant. Sinon, la valeur de retour de l'écouteur sera utilisée comme valeur de la réponse.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Processus principal</span>\nipcMain.handle(<span class=\"hljs-string\">'my-invokable-ipc'</span>, <span class=\"hljs-keyword\">async</span> (event, ...args) => {\n  <span class=\"hljs-keyword\">const</span> result = wait somePromise(... rgs)\n  <span class=\"hljs-keyword\">return</span> result\n})\n\n\n\n <span class=\"hljs-comment\">// Processus de rendu</span>\n<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> result = wait ipcRenderer. nvoke(<span class=\"hljs-string\">'my-invokable-ipc'</span>, arg1, arg2)\n  <span class=\"hljs-comment\">// ...</span>\n}\n</code></pre>\n<p>Le <code>event</code> qui est passé comme premier argument au gestionnaire est le même que que celui passé à un event listener régulier. Il contient des informations sur lequel WebContents est la source de la demande d'appel.</p>\n<p>Errors thrown through <code>handle</code> in the main process are not transparent as they are serialized and only the <code>message</code> property from the original error is provided to the renderer process. Please refer to <a href=\"https://github.com/electron/electron/issues/24427\">#24427</a> for details.</p>\n<h3 id=\"ipcmainhandleoncechannel-listener\"><a href=\"#ipcmainhandleoncechannel-listener\"><code>ipcMain.handleOnce(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function&#x3C;Promise\\<void> | any><ul>\n<li><code>événement</code> IpcMainInvokeEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></void></li>\n</ul>\n<p>Handles a single <code>invoke</code>able IPC message, then removes the listener. See <code>ipcMain.handle(channel, listener)</code>.</p>\n<h3 id=\"ipcmainremovehandlerchannel\"><a href=\"#ipcmainremovehandlerchannel\"><code>ipcMain.removeHandler(channel)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n</ul>\n<p>Supprime tout gestionnaire pour <code>canal</code>, si présent.</p>\n<h2 id=\"objet-ipcmainevent\"><a href=\"#objet-ipcmainevent\">Objet IpcMainEvent</a></h2>\n<p>La documentation de l'objet <code>événement</code> passé à la <code>callback</code> peut être trouvée dans la documentation de la structure <a href=\"/docs/api/structures/ipc-main-event\"><code>ipc-main-event</code></a>.</p>\n<h2 id=\"objet-ipcmaininvokeevent\"><a href=\"#objet-ipcmaininvokeevent\">Objet IpcMainInvokeEvent</a></h2>\n<p>La documentation de l'objet <code>événement</code> passé à <code>handle</code> callbacks peut être trouvée dans la documentation de la structure <a href=\"/docs/api/structures/ipc-main-invoke-event\"><code>ipc-main-invoke-event</code></a> .</p>",
      "title": "ipcMain",
      "description": "Communiquer de manière asynchrone depuis le processus main aux processus renderer."
    },
    "/docs/api/structures/ipc-main-event": {
      "locale": "fr-FR",
      "slug": "ipc-main-event",
      "href": "/docs/api/structures/ipc-main-event",
      "crowdinFileId": "256445",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-main-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmainevent-object-extends-event\"><a href=\"#ipcmainevent-object-extends-event\">IpcMainEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>processId</code> Integer - The internal ID of the renderer process that sent this message</li>\n<li><code>frameId</code> Integer - The ID of the renderer frame that sent this message</li>\n<li><code>returnValue</code> any - Set this to the value to be returned in a synchronous message</li>\n<li><code>sender</code> WebContents - Returns the <code>webContents</code> that sent the message</li>\n<li><code>senderFrame</code> WebFrameMain <em>Readonly</em> - The frame that sent this message</li>\n<li><code>ports</code> MessagePortMain[] - A list of MessagePorts that were transferred with this message</li>\n<li><code>reply</code> Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling.  You should use this method to \"reply\" to the sent message in order to guarantee the reply will go to the correct process and frame.<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>",
      "title": "IpcMainEvent Object extends Event",
      "description": ""
    },
    "/docs/api/structures/ipc-main-invoke-event": {
      "locale": "fr-FR",
      "slug": "ipc-main-invoke-event",
      "href": "/docs/api/structures/ipc-main-invoke-event",
      "crowdinFileId": "256447",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-main-invoke-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmaininvokeevent-object-extends-event\"><a href=\"#ipcmaininvokeevent-object-extends-event\">IpcMainInvokeEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>processId</code> Integer - The internal ID of the renderer process that sent this message</li>\n<li><code>frameId</code> Integer - The ID of the renderer frame that sent this message</li>\n<li><code>sender</code> WebContents - Returns the <code>webContents</code> that sent the message</li>\n<li><code>senderFrame</code> WebFrameMain <em>Readonly</em> - The frame that sent this message</li>\n</ul>",
      "title": "IpcMainInvokeEvent Object extends Event",
      "description": ""
    },
    "/docs/api/ipc-renderer": {
      "locale": "fr-FR",
      "slug": "ipc-renderer",
      "href": "/docs/api/ipc-renderer",
      "crowdinFileId": "256331",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/ipc-renderer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcrenderer\"><a href=\"#ipcrenderer\">ipcRenderer</a></h1>\n<blockquote>\n<p>Communiquer de manière asynchrone depuis le processus renderer au processus main.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>Le module <code>ipcRender</code> est un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>. Il fournit quelques méthodes pour pouvoir envoyer des messages synchrones et asynchrones depuis le processus render (page web) pour le processus main. Vous pouvez également recevoir des réponses du processus main.</p>\n<p>Voir <a href=\"/docs/api/ipc-main\">ipcMain</a> pour des exemples de code.</p>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module de <code>ipcRenderer</code> possède les méthodes suivantes pour écouter les événements et envoyer des messages :</p>\n<h3 id=\"ipcrendereronchannel-listener\"><a href=\"#ipcrendereronchannel-listener\"><code>ipcRenderer.on(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>événement</code> IpcRendererEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>En écoutant <code>channel</code>, lorsqu'un nouveau message arrive, <code>listener</code> sera appelé comme ceci <code>listener(event, args...)</code>.</p>\n<h3 id=\"ipcrendereroncechannel-listener\"><a href=\"#ipcrendereroncechannel-listener\"><code>ipcRenderer.once(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>événement</code> IpcRendererEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Ajoute un <code>listener</code> à déclenchement unique pour l’événement. Ce <code>listener</code> sera appelé uniquement lors de la prochaine émission d'un message sur le <code>channel</code>, après quoi il sera supprimé.</p>\n<h3 id=\"ipcrendererremovelistenerchannel-listener\"><a href=\"#ipcrendererremovelistenerchannel-listener\"><code>ipcRenderer.removeListener(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function<ul>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Supprime le <code>listener</code> spécifié du tableau d'écouteurs pour le <code>channel</code> spécifié.</p>\n<h3 id=\"ipcrendererremovealllistenerschannel\"><a href=\"#ipcrendererremovealllistenerschannel\"><code>ipcRenderer.removeAllListeners(channel)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n</ul>\n<p>Supprime tous les écouteurs, ou ceux du <code>channel</code> spécifié.</p>\n<h3 id=\"ipcrenderersendchannel-args\"><a href=\"#ipcrenderersendchannel-args\"><code>ipcRenderer.send(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Envoyez un message asynchrone au processus principal via <code>channel</code>, ainsi que des arguments. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over Electron's IPC to the main process, as the main process would have no way to decode them. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>Le processus principal le gère en écoutant le <code>canal</code> avec le module <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a>.</p>\n<p>If you need to transfer a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> to the main process, use <a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a>.</p>\n<p>If you want to receive a single response from the main process, like the result of a method call, consider using <a href=\"#ipcrendererinvokechannel-args\"><code>ipcRenderer.invoke</code></a>.</p>\n<h3 id=\"ipcrendererinvokechannel-args\"><a href=\"#ipcrendererinvokechannel-args\"><code>ipcRenderer.invoke(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;any></code> - résout avec la réponse du processus principal.</p>\n<p>Envoie un message au processus principal via <code>channel</code> et attend un résultat asynchrone. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over Electron's IPC to the main process, as the main process would have no way to decode them. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>Le processus principal devrait écouter le <code>canal</code> avec <a href=\"/docs/api/ipc-main#ipcmainhandlechannel-listener\"><code>ipcMain.handle()</code></a>.</p>\n<p>Par exemple :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Processus de rendu</span>\nipcRenderer.invoke(<span class=\"hljs-string\">'some-name'</span>, someArgument).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">result</span>) =></span> {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// Processus principal</span>\nipcMain.handle(<span class=\"hljs-string\">'some-name'</span>, <span class=\"hljs-keyword\">async</span> (event, someArgument) => {\n  <span class=\"hljs-keyword\">const</span> result = wait doSomeWork(someArgument)\n  <span class=\"hljs-keyword\">return</span> result\n})\n</code></pre>\n<p>If you need to transfer a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> to the main process, use <a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a>.</p>\n<p>If you do not need a response to the message, consider using <a href=\"#ipcrenderersendchannel-args\"><code>ipcRenderer.send</code></a>.</p>\n<h3 id=\"ipcrenderersendsynccanal-args\"><a href=\"#ipcrenderersendsynccanal-args\"><code>ipcRenderer.sendSync(canal, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Retourne <code>any</code> - La valeur renvoyé par l'écouteur du <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a>.</p>\n<p>Envoyez un message au processus principal via <code>channel</code> et attendez un résultat de manière synchrone.  Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over Electron's IPC to the main process, as the main process would have no way to decode them. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>Le processus principal le gère en écoutant le <code>canal</code> avec le module <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> , et répond en définissant <code>event.returnValue</code>.</p>\n<blockquote>\n<p>⚠️ <strong>WARNING</strong>: Sending a synchronous message will block the whole renderer process until the reply is received, so use this method only as a last resort. It's much better to use the asynchronous version, <a href=\"/docs/api/ipc-renderer#ipcrendererinvokechannel-args\"><code>invoke()</code></a>.</p>\n</blockquote>\n<h3 id=\"ipcrendererpostmessagechannel-message-transfer\"><a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage(channel, message, [transfer])</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> tous</li>\n<li><code>transfer</code> MessagePort<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Send a message to the main process, optionally transferring ownership of zero or more <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> objects.</p>\n<p>The transferred <code>MessagePort</code> objects will be available in the main process as <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> objects by accessing the <code>ports</code> property of the emitted event.</p>\n<p>Par exemple :</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Renderer process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannel()\nipcRenderer.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Main process</span>\nipcMain.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<p>For more information on using <code>MessagePort</code> and <code>MessageChannel</code>, see the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\">MDN documentation</a>.</p>\n<h3 id=\"ipcrenderersendtowebcontentsid-channel-args\"><a href=\"#ipcrenderersendtowebcontentsid-channel-args\"><code>ipcRenderer.sendTo(webContentsId, channel, ...args)</code></a></h3>\n<ul>\n<li><code>webContentsId</code> Number</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Envoie un message à une fenêtre avec <code>webContentsId</code> via <code>canal</code>.</p>\n<h3 id=\"ipcrenderersendtohostcanal-args\"><a href=\"#ipcrenderersendtohostcanal-args\"><code>ipcRenderer.sendToHost(canal, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Comme <code>ipcRenderer.send</code>, mais l'événement sera envoyé à l'élément <code>&#x3C;webview></code> dans la page hôte au lieu du processus main.</p>\n<h2 id=\"objet-event\"><a href=\"#objet-event\">Objet event</a></h2>\n<p>La documentation de l'objet <code>événement</code> passé à la <code>callback</code> peut être trouvée dans la documentation de la structure <a href=\"/docs/api/structures/ipc-renderer-event\"><code>ipc-renderer-event</code></a>.</p>",
      "title": "ipcRenderer",
      "description": "Communiquer de manière asynchrone depuis le processus renderer au processus main."
    },
    "/docs/api/structures/ipc-renderer-event": {
      "locale": "fr-FR",
      "slug": "ipc-renderer-event",
      "href": "/docs/api/structures/ipc-renderer-event",
      "crowdinFileId": "256449",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-renderer-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcrendererevent-object-extends-event\"><a href=\"#ipcrendererevent-object-extends-event\">IpcRendererEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>sender</code> IpcRenderer - The <code>IpcRenderer</code> instance that emitted the event originally</li>\n<li><code>senderId</code> Integer - The <code>webContents.id</code> that sent the message, you can call <code>event.sender.sendTo(event.senderId, ...)</code> to reply to the message, see <a href=\"/docs/api/ipc-renderer#ipcrenderersendtowebcontentsid-channel-args\">ipcRenderer.sendTo</a> for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set <code>event.senderId</code> to <code>0</code>.</li>\n<li><code>ports</code> MessagePort[] - A list of MessagePorts that were transferred with this message</li>\n</ul>",
      "title": "IpcRendererEvent Object extends Event",
      "description": ""
    },
    "/docs/development/issues": {
      "locale": "fr-FR",
      "slug": "issues",
      "href": "/docs/development/issues",
      "crowdinFileId": "256159",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/issues.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"les-issues-dans-electron\"><a href=\"#les-issues-dans-electron\">Les issues dans Electron</a></h1>\n<ul>\n<li><a href=\"#how-to-contribute-to-issues\">How to Contribute to Issues</a></li>\n<li><a href=\"#asking-for-general-help\">Demander de l'aide générale</a></li>\n<li><a href=\"#submitting-a-bug-report\">Envoi d'un rapport de bug</a></li>\n<li><a href=\"#triaging-a-bug-report\">Triaging a Bug Report</a></li>\n<li><a href=\"#resolving-a-bug-report\">Résolution d'un rapport de bug</a></li>\n</ul>\n<h2 id=\"how-to-contribute-to-issues\"><a href=\"#how-to-contribute-to-issues\">How to Contribute to Issues</a></h2>\n<p>Pour toute question, il y a fondamentalement trois façons pour une personne de Contribuer:</p>\n<ol>\n<li>By opening the issue for discussion: If you believe that you have found a new bug in Electron, you should report it by creating a new issue in the <a href=\"https://github.com/electron/electron/issues\"><code>electron/electron</code> issue tracker</a>.</li>\n<li>En aidant à trier le problème : vous pouvez le faire soit en fournissant des détails supplémentaires (un cas de test reproductible qui démontre un bogue) soit en fournissant des suggestions pour résoudre le problème.</li>\n<li>En aidant à résoudre le problème : cela peut être fait en démontrant que le problème n'est pas un bug ou qu'il est résolu ; mais plus souvent, en ouvrant une pull request (demande de tirage) qui modifie la source dans <code>electron/electron</code> d'une manière concrète et vérifiable.</li>\n</ol>\n<h2 id=\"demander-de-laide-générale\"><a href=\"#demander-de-laide-générale\">Demander de l'aide générale</a></h2>\n<p><a href=\"/docs/tutorial/support#finding-support\">\"Trouver un soutien\"</a> a un liste de ressources pour obtenir de l’aide à la programmation, signaler les problèmes de sécurité, contribuer, et plus encore. Veuillez utiliser le gestionnaire de tickets uniquement pour les bugs !</p>\n<h2 id=\"envoi-dun-rapport-de-bug\"><a href=\"#envoi-dun-rapport-de-bug\">Envoi d'un rapport de bug</a></h2>\n<p>To submit a bug report:</p>\n<p>When opening a new issue in the <a href=\"https://github.com/electron/electron/issues/new/choose\"><code>electron/electron</code> issue tracker</a>, users will be presented with a template that should be filled in.</p>\n<p>If you believe that you have found a bug in Electron, please fill out the template to the best of your ability.</p>\n<p>The two most important pieces of information needed to evaluate the report are a description of the bug and a simple test case to recreate it. It is easier to fix a bug if it can be reproduced.</p>\n<p>See <a href=\"https://stackoverflow.com/help/mcve\">How to create a Minimal, Complete, and Verifiable example</a>.</p>\n<h2 id=\"triaging-a-bug-report\"><a href=\"#triaging-a-bug-report\">Triaging a Bug Report</a></h2>\n<p>Il est fréquent que les questions ouvertes impliquent des discussions. Certains contributeurs peuvent avoir des opinions différentes, y compris si le comportement est un bogue ou une fonctionnalité. This discussion is part of the process and should be kept focused, helpful, and professional.</p>\n<p>Terse responses that provide neither additional context nor supporting detail are not helpful or professional. Pour beaucoup, de telles réponses sont ennuyeuses et peu amicales.</p>\n<p>Contributors are encouraged to solve issues collaboratively and help one another make progress. If you encounter an issue that you feel is invalid, or which contains incorrect information, explain <em>why</em> you feel that way with additional supporting context, and be willing to be convinced that you may be wrong. By doing so, we can often reach the correct outcome faster.</p>\n<h2 id=\"résolution-dun-rapport-de-bug\"><a href=\"#résolution-dun-rapport-de-bug\">Résolution d'un rapport de bug</a></h2>\n<p>La plupart des issues sont résolus en ouvrant une pull request. The process for opening and reviewing a pull request is similar to that of opening and triaging issues, but carries with it a necessary review and approval workflow that ensures that the proposed changes meet the minimal quality and functional guidelines of the Electron project.</p>",
      "title": "Les issues dans Electron",
      "description": ""
    },
    "/docs/api/structures/jump-list-category": {
      "locale": "fr-FR",
      "slug": "jump-list-category",
      "href": "/docs/api/structures/jump-list-category",
      "crowdinFileId": "256451",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/jump-list-category.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"jumplistcategory-object\"><a href=\"#jumplistcategory-object\">JumpListCategory Object</a></h1>\n<ul>\n<li><code>type</code> String (optional) - One of the following:<ul>\n<li><code>tasks</code> - Items in this category will be placed into the standard <code>Tasks</code> category. There can be only one such category, and it will always be displayed at the bottom of the Jump List.</li>\n<li><code>frequent</code> - Displays a list of files frequently opened by the app, the name of the category and its items are set by Windows.</li>\n<li><code>recent</code> - Displays a list of files recently opened by the app, the name of the category and its items are set by Windows. Items may be added to this category indirectly using <code>app.addRecentDocument(path)</code>.</li>\n<li><code>custom</code> - Displays tasks or file links, <code>name</code> must be set by the app.</li>\n</ul></li>\n<li><code>name</code> String (optional) - Must be set if <code>type</code> is <code>custom</code>, otherwise it should be omitted.</li>\n<li><code>items</code> JumpListItem<a href=\"/docs/api/structures/optional\"></a> - Array of <a href=\"/docs/api/structures/jump-list-item\"><code>JumpListItem</code></a> objects if <code>type</code> is <code>tasks</code> or <code>custom</code>, otherwise it should be omitted.</li>\n</ul>\n<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>\n<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>",
      "title": "JumpListCategory Object",
      "description": ""
    },
    "/docs/api/structures/jump-list-item": {
      "locale": "fr-FR",
      "slug": "jump-list-item",
      "href": "/docs/api/structures/jump-list-item",
      "crowdinFileId": "256453",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/jump-list-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"jumplistitem-object\"><a href=\"#jumplistitem-object\">JumpListItem Object</a></h1>\n<ul>\n<li><code>type</code> String (optional) - One of the following:<ul>\n<li><code>task</code> - A task will launch an app with specific arguments.</li>\n<li><code>separator</code> - Can be used to separate items in the standard <code>Tasks</code> category.</li>\n<li><code>file</code> - A file link will open a file using the app that created the Jump List, for this to work the app must be registered as a handler for the file type (though it doesn't have to be the default handler).</li>\n</ul></li>\n<li><code>path</code> String (optional) - Path of the file to open, should only be set if <code>type</code> is <code>file</code>.</li>\n<li><code>program</code> String (optional) - Path of the program to execute, usually you should specify <code>process.execPath</code> which opens the current program. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>args</code> String (optional) - The command line arguments when <code>program</code> is executed. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>title</code> String (optional) - The text to be displayed for the item in the Jump List. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>description</code> String (optional) - Description of the task (displayed in a tooltip). Should only be set if <code>type</code> is <code>task</code>. Maximum length 260 characters.</li>\n<li><code>iconPath</code> String (optional) - The absolute path to an icon to be displayed in a Jump List, which can be an arbitrary resource file that contains an icon (e.g. <code>.ico</code>, <code>.exe</code>, <code>.dll</code>). You can usually specify <code>process.execPath</code> to show the program icon.</li>\n<li><code>iconIndex</code> Number (optional) - The index of the icon in the resource file. If a resource file contains multiple icons this value can be used to specify the zero-based index of the icon that should be displayed for this task. If a resource file contains only one icon, this property should be set to zero.</li>\n<li><code>workingDirectory</code> String (optional) - The working directory. Default is empty.</li>\n</ul>",
      "title": "JumpListItem Object",
      "description": ""
    },
    "/docs/api/structures/keyboard-event": {
      "locale": "fr-FR",
      "slug": "keyboard-event",
      "href": "/docs/api/structures/keyboard-event",
      "crowdinFileId": "256455",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/keyboard-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"keyboardevent-object\"><a href=\"#keyboardevent-object\">KeyboardEvent Object</a></h1>\n<ul>\n<li><code>ctrlKey</code> Boolean (optional) - whether the Control key was used in an accelerator to trigger the Event</li>\n<li><code>metaKey</code> Boolean (optional) - whether a meta key was used in an accelerator to trigger the Event</li>\n<li><code>shiftKey</code> Boolean (optional) - whether a Shift key was used in an accelerator to trigger the Event</li>\n<li><code>altKey</code> Boolean (optional) - whether an Alt key was used in an accelerator to trigger the Event</li>\n<li><code>triggeredByAccelerator</code> Boolean (optional) - whether an accelerator was used to trigger the event as opposed to another user gesture like mouse click</li>\n</ul>",
      "title": "KeyboardEvent Object",
      "description": ""
    },
    "/docs/api/structures/keyboard-input-event": {
      "locale": "fr-FR",
      "slug": "keyboard-input-event",
      "href": "/docs/api/structures/keyboard-input-event",
      "crowdinFileId": "256457",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/keyboard-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"keyboardinputevent-object-extends-inputevent\"><a href=\"#keyboardinputevent-object-extends-inputevent\">KeyboardInputEvent Object extends <code>InputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>keyDown</code>, <code>keyUp</code> or <code>char</code>.</li>\n<li><code>keyCode</code> String - The character that will be sent as the keyboard event. Should only use the valid key codes in <a href=\"/docs/api/accelerator\">Accelerator</a>.</li>\n</ul>",
      "title": "KeyboardInputEvent Object extends InputEvent",
      "description": ""
    },
    "/docs/tutorial/keyboard-shortcuts": {
      "locale": "fr-FR",
      "slug": "keyboard-shortcuts",
      "href": "/docs/tutorial/keyboard-shortcuts",
      "crowdinFileId": "256209",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/keyboard-shortcuts.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"raccourcis-clavier\"><a href=\"#raccourcis-clavier\">Raccourcis clavier</a></h1>\n<h2 id=\"vue-densemble\"><a href=\"#vue-densemble\">Vue d'ensemble</a></h2>\n<p>Cette fonctionnalité vous permet de configurer les raccourcis clavier locaux et globaux de votre application Electron.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<h3 id=\"raccourcis-locaux\"><a href=\"#raccourcis-locaux\">Raccourcis Locaux</a></h3>\n<p>Les raccourcis clavier locaux ne sont déclenchés que lorsque l'application a le focus. To configure a local keyboard shortcut, you need to specify an <a href=\"/docs/api/accelerator\"><code>accelerator</code></a> property when creating a <a href=\"/docs/api/menu-item\">MenuItem</a> within the <a href=\"/docs/api/menu\">Menu</a> module.</p>\n<p>Commençons avec une application fonctionnelle issue du <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, mettez à jour le fichier <code>main.js</code> avec les lignes suivantes :</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/local\"><span class=\"hljs-keyword\">const</span> { Menu, MenuItem } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> menu = <span class=\"hljs-keyword\">new</span> Menu()\nmenu.append(<span class=\"hljs-keyword\">new</span> MenuItem({\n  <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Electron'</span>,\n  <span class=\"hljs-attr\">submenu</span>: [{\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'help'</span>,\n    <span class=\"hljs-attr\">accelerator</span>: process.platform === <span class=\"hljs-string\">'darwin'</span> ? <span class=\"hljs-string\">'Alt+Cmd+I'</span> : <span class=\"hljs-string\">'Alt+Shift+I'</span>,\n    <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Electron rocks!'</span>) }\n  }]\n}))\n\nMenu.setApplicationMenu(menu)\n</code></pre>\n<blockquote>\n<p>REMARQUE : Dans le code ci-dessus, vous pouvez voir que l'accélérateur diffère selon le système d'exploitation de l'utilisateur . Pour MacOS, c'est <code>Alt+Cmd+I</code>, alors que pour Linux et Windows, c'est <code>Alt+Shift+I</code>.</p>\n</blockquote>\n<p>Après avoir lancé l'application Electron, vous devriez voir le menu de l'application avec le raccourci local que vous venez de définir:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/local-shortcut.png\" alt=\"Menu avec un raccourci local\"></p>\n<p>Si vous cliquez sur <code>Aide</code> ou appuyez sur l'accélérateur défini, puis ouvrez le terminal depuis lequel vous avez exécuté votre application Electron, vous verrez le message qui a été généré après avoir déclenché l'événement <code>click</code> : \"Electron rocks!\".</p>\n<h3 id=\"raccourcis-globaux\"><a href=\"#raccourcis-globaux\">Raccourcis globaux</a></h3>\n<p>Pour configurer un raccourci clavier global, vous devez utiliser le module <a href=\"/docs/api/global-shortcut\">globalShortcut</a> pour détecter les événements du clavier même si l'application n'a pas le focus.</p>\n<p>Commençons avec une application fonctionnelle issue du <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, mettez à jour le fichier <code>main.js</code> avec les lignes suivantes :</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/global\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  globalShortcut.register(<span class=\"hljs-string\">'Alt+CommandOrControl+I'</span>, () => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Electron loves global shortcuts!'</span>)\n  })\n}).then(createWindow)\n</code></pre>\n<blockquote>\n<p>NOTE: Dans le code ci-dessus, la combinaison <code>CommandOrControl</code> utilise <code>Command</code> sur macOS et <code>Control</code> sur Windows/Linux.</p>\n</blockquote>\n<p>Après avoir lancé l'application Electron, si vous appuyez sur la combinaison de touches définie puis que vous ouvrez le terminal depuis lequel vous avez exécuté votre application Electron, vous verrez Electron loves global shortcuts!</p>\n<h3 id=\"raccourcis-dans-un-browserwindow\"><a href=\"#raccourcis-dans-un-browserwindow\">Raccourcis dans un BrowserWindow</a></h3>\n<h4 id=\"utilisation-des-api-web\"><a href=\"#utilisation-des-api-web\">Utilisation des API web</a></h4>\n<p>Si vous voulez gérer les raccourcis clavier dans une <a href=\"/docs/api/browser-window\">BrowserWindow</a>, vous pouvez écouter les <code>keyup</code> et <code>keydown</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/Events\">DOM events</a> dans le processus de rendu en utilisant l'API <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\">addEventListener()</a>.</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/web-apis\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleKeyPress</span>(<span class=\"hljs-params\">event</span>) </span>{\n  <span class=\"hljs-comment\">// Vous pouvez mettre ici du code de gestion des touches.</span>\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">\"last-keypress\"</span>).innerText = event.key;\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`You pressed <span class=\"hljs-subst\">${event.key}</span>`</span>);\n}\n\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'keyup'</span>, handleKeyPress, <span class=\"hljs-literal\">true</span>);\n</code></pre>\n<blockquote>\n<p>Note: le troisième paramètre <code>true</code> signifie que l'écouteur recevra toujours les actions des touches avant les autres écouteurs d'événement afin qu'ils ne puissent pas appeler eux-même <code>stopPropagation()</code>.</p>\n</blockquote>\n<h4 id=\"interception-des-événements-dans-le-processus-principal\"><a href=\"#interception-des-événements-dans-le-processus-principal\">Interception des événements dans le processus principal</a></h4>\n<p>L’événement <a href=\"/docs/api/web-contents#event-before-input-event\"><code>before-input-event</code></a> est émis avant d’envoyer les événements <code>keydown</code> et <code>keyup</code> dans la page. Il peut être utilisé pour intercepter et gérer des raccourcis personnalisés qui ne sont pas visibles dans le menu.</p>\n<p>Commençons avec une application fonctionnelle issue du <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, mettez à jour le fichier <code>main.js</code> avec les lignes suivantes :</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/interception-from-main\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n  win.webContents.on(<span class=\"hljs-string\">'before-input-event'</span>, (event, input) => {\n    <span class=\"hljs-keyword\">if</span> (input.control &#x26;&#x26; input.key.toLowerCase() === <span class=\"hljs-string\">'i'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Pressed Control+I'</span>)\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<p>Après avoir lancé l'application Electron, si vous ouvrez le terminal depuis lequel vous avez exécuté votre application Electron et appuyez sur la combinaison de touches <code>Ctrl+I</code> , vous allez voir que cette combinaison de touches a été interceptée avec succès.</p>\n<h4 id=\"utilisation-de-bibliothèques-tierces\"><a href=\"#utilisation-de-bibliothèques-tierces\">Utilisation de bibliothèques tierces</a></h4>\n<p>Si vous ne voulez pas analyser manuellement les raccourcis, il existe des bibliothèque qui font de la détection avancée comme par exemple <a href=\"https://github.com/ccampbell/mousetrap\">mousetrap</a>. Voici des exemples d’utilisation de <code>mousetrap</code> s'exécutant dans le processus Renderer :</p>\n<pre><code class=\"hljs language-js\">Mousetrap.bind(<span class=\"hljs-string\">'4'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'4'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'?'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'show shortcuts!'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'esc'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'escape'</span>) }, <span class=\"hljs-string\">'keyup'</span>)\n\n<span class=\"hljs-comment\">// combinations</span>\nMousetrap.bind(<span class=\"hljs-string\">'command+shift+k'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'command shift k'</span>) })\n\n<span class=\"hljs-comment\">// map multiple combinations to the same callback</span>\nMousetrap.bind([<span class=\"hljs-string\">'command+k'</span>, <span class=\"hljs-string\">'ctrl+k'</span>], () => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'command k or control k'</span>)\n\n  <span class=\"hljs-comment\">// return false to prevent default behavior and stop event from bubbling</span>\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n\n<span class=\"hljs-comment\">// gmail style sequences</span>\nMousetrap.bind(<span class=\"hljs-string\">'g i'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'go to inbox'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'* a'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'select all'</span>) })\n\n<span class=\"hljs-comment\">// konami code!</span>\nMousetrap.bind(<span class=\"hljs-string\">'up up down down left right left right b a enter'</span>, () => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'konami code'</span>)\n})\n</code></pre>",
      "title": "Raccourcis clavier",
      "description": "REMARQUE : Dans le code ci-dessus, vous pouvez voir que l'accélérateur diffère selon le système d'exploitation de l'utilisateur . Pour MacOS, c'est Alt+Cmd+I, alors que pour Linux et Windows, c'est Alt+Shift+I."
    },
    "/docs/tutorial/launch-app-from-url-in-another-app": {
      "locale": "fr-FR",
      "slug": "launch-app-from-url-in-another-app",
      "href": "/docs/tutorial/launch-app-from-url-in-another-app",
      "crowdinFileId": "256211",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/launch-app-from-url-in-another-app.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<hr>\n<p>title: Lancement de votre application Electron depuis une URL dans une autre application\ndescription: This guide will take you through the process of setting your electron app as the default handler for a specific protocol.\nslug: launch-app-from-url-in-another-app</p>\n<h2 id=\"hide_title-true\"><a href=\"#hide_title-true\">hide_title: true</a></h2>\n<h1 id=\"lancement-de-votre-application-electron-depuis-une-url-dans-une-autre-application\"><a href=\"#lancement-de-votre-application-electron-depuis-une-url-dans-une-autre-application\">Lancement de votre application Electron depuis une URL dans une autre application</a></h1>\n<h2 id=\"vue-densemble\"><a href=\"#vue-densemble\">Vue d'ensemble</a></h2>\n<!-- ✍ Update this section if you want to provide more details -->\n<p>Ce guide vous guidera à travers le processus de configuration de votre application Electron comme gestionnaire par défaut pour un <a href=\"https://www.electronjs.org/docs/api/protocol\">protocol spécifique</a>.</p>\n<p>À la fin de ce tutoriel, nous aurons configuré notre application pour intercepter et gérer toutes les URL qui commençant par un protocole spécifique. Dans ce guide, le protocole utilisé sera \"<code>electron-fiddle://</code>\".</p>\n<h2 id=\"exemples\"><a href=\"#exemples\">Exemples</a></h2>\n<h3 id=\"processus-principal-mainjs\"><a href=\"#processus-principal-mainjs\">Processus principal (main.js)</a></h3>\n<p>Importons tout d'abord les modules requis depuis <code>electron</code>. Ces modules aident à gérer le cycle de notre application et à créer une fenêtre de navigateur native.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n</code></pre>\n<p>Ensuite, déclarons application comme gestionnaire des protocoles \"<code>electron-fiddle://</code>\".</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">if</span> (process.defaultApp) {\n  <span class=\"hljs-keyword\">if</span> (process.argv.length >= <span class=\"hljs-number\">2</span>) {\n    app.setAsDefaultProtocolClient(<span class=\"hljs-string\">'electron-fiddle'</span>, process.execPath, [path.resolve(process.argv[<span class=\"hljs-number\">1</span>])])\n  }\n} <span class=\"hljs-keyword\">else</span> {\n  app.setAsDefaultProtocolClient(<span class=\"hljs-string\">'electron-fiddle'</span>)\n}\n</code></pre>\n<p>Nous allons maintenant définir la fonction chargée de la création de notre fenêtre de navigateur et charger le fichier <code>index.html</code> de notre application.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> createWindow = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Créer la fenêtre du navigateur.</span>\n  mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  mainWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n</code></pre>\n<p>Dans l'étape suivante , nous allons créer notre  <code>BrowserWindow</code> et dire à notre application comment gérer un événement venant d'un lien vers un protocole externe.</p>\n<p>Ce code sera différent selon le système d'exploitation : WindowsOS, MacOS ou Linux. Cela est dû au fait que Windows a besoin de code supplémentaire pour ouvrir le contenu du lien de protocole dans la même instance Electron. Pour en savoir plus à ce sujet <a href=\"https://www.electronjs.org/docs/api/app#apprequestsingleinstancelock\">ici</a>.</p>\n<h4 id=\"code-pour-windows\"><a href=\"#code-pour-windows\">Code pour Windows:</a></h4>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> gotTheLock = app.requestSingleInstanceLock()\n\n<span class=\"hljs-keyword\">if</span> (!gotTheLock) {\n  app.quit()\n} <span class=\"hljs-keyword\">else</span> {\n  app.on(<span class=\"hljs-string\">'second-instance'</span>, (event, commandLine, workingDirectory) => {\n    <span class=\"hljs-comment\">// Someone tried to run a second instance, we should focus our window.</span>\n    <span class=\"hljs-keyword\">if</span> (mainWindow) {\n      <span class=\"hljs-keyword\">if</span> (mainWindow.isMinimized()) mainWindow.restore()\n      mainWindow.focus()\n    }\n  })\n\n  <span class=\"hljs-comment\">// Create mainWindow, load the rest of the app, etc...</span>\n  app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n})\n\n<span class=\"hljs-comment\">// gestion du protocole. In this case, we choose to show an Error Box.</span>\n  app.on(<span class=\"hljs-string\">'open-url'</span>, (event, url) => {\n    dialog.showErrorBox(<span class=\"hljs-string\">'Welcome Back'</span>, <span class=\"hljs-string\">`You arrived from: <span class=\"hljs-subst\">${url}</span>`</span>)\n  })\n}\n</code></pre>\n<h4 id=\"code-pour-macos-ou-linux-\"><a href=\"#code-pour-macos-ou-linux-\">Code pour MacOS ou Linux :</a></h4>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Cette méthode sera appelée quant Electron aura fini</span>\n<span class=\"hljs-comment\">// de s'initialiser et sera prêt à créer des fenêtres de navigation.</span>\n<span class=\"hljs-comment\">// Certaines APIs peuvent être utilisées uniquement quant cet événement est émit.</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n})\n\n<span class=\"hljs-comment\">// gestion du protocole. In this case, we choose to show an Error Box.</span>\napp.on(<span class=\"hljs-string\">'open-url'</span>, (event, url) => {\n  dialog.showErrorBox(<span class=\"hljs-string\">'Content de vous revoir '</span>, <span class=\"hljs-string\">`Vous venez de: <span class=\"hljs-subst\">${url}</span>`</span>)\n})\n</code></pre>\n<p>Enfin, nous ajouterons du code supplémentaire pour gérer la fermeture de notre application par l'utilisateur.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Quit when all windows are closed, except on macOS. Là, il est courant</span>\n/ pour les applications et leur barre de menus de rester actives jusqu’à ce que l’utilisateur quitte\n/ explicitement avec Cmd + Q.\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h2 id=\"notes-importantes\"><a href=\"#notes-importantes\">Notes importantes</a></h2>\n<h3 id=\"livraison\"><a href=\"#livraison\">Livraison</a></h3>\n<p>Sous macOS et Linux, cette fonctionnalité ne fonctionnera que si votre application est empaquetée. Cela ne fonctionne pas lorsque vous le lancez en développement à partir de la ligne de commande. Lorsque vous empaquetez votre application, vous devrez vous assurer que les fichiers <code>Info.plist</code> sur macOS et le Linux <code>.desktop</code> sur Linux sont mis à jour pour inclure le nouveau gestionnaire de protocole. Certains des outils d'Electron pour regrouper et distribuer des applications gèrent cela pour vous.</p>\n<h4 id=\"electron-forge\"><a href=\"#electron-forge\"></a><a href=\"https://electronforge.io\">Electron Forge</a></h4>\n<p>If you're using Electron Forge, adjust <code>packagerConfig</code> for macOS support, and the configuration for the appropriate Linux makers for Linux support, in your <a href=\"https://www.electronforge.io/configuration\">Forge configuration</a> <em>(please note the following example only shows the bare minimum needed to add the configuration changes)</em>:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"config\"</span>: {\n    <span class=\"hljs-attr\">\"forge\"</span>: {\n      <span class=\"hljs-attr\">\"packagerConfig\"</span>: {\n        <span class=\"hljs-attr\">\"protocols\"</span>: [\n          {\n            <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"Electron Fiddle\"</span>,\n            <span class=\"hljs-attr\">\"schemes\"</span>: [<span class=\"hljs-string\">\"electron-fiddle\"</span>]\n          }\n        ]\n      },\n      <span class=\"hljs-attr\">\"makers\"</span>: [\n        {\n          <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"@electron-forge/maker-deb\"</span>,\n          <span class=\"hljs-attr\">\"config\"</span>: {\n            <span class=\"hljs-attr\">\"mimeType\"</span>: [<span class=\"hljs-string\">\"x-scheme-handler/electron-fiddle\"</span>]\n          }\n        }\n      ]\n    }\n  }\n}\n</code></pre>\n<h4 id=\"electron-packager\"><a href=\"#electron-packager\"></a><a href=\"https://github.com/electron/electron-packager\">Electron Packager</a></h4>\n<p>For macOS support:</p>\n<p>If you're using Electron Packager's API, adding support for protocol handlers is similar to how Electron Forge is handled, except <code>protocols</code> is part of the Packager options passed to the <code>packager</code> function.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> packager = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-packager'</span>)\n\npackager({\n  <span class=\"hljs-comment\">// ...other options...</span>\n  <span class=\"hljs-attr\">protocols</span>: [\n    {\n      <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Electron Fiddle'</span>,\n      <span class=\"hljs-attr\">schemes</span>: [<span class=\"hljs-string\">'electron-fiddle'</span>]\n    }\n  ]\n\n}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">paths</span> =></span> <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`SUCCESS: Created <span class=\"hljs-subst\">${paths.join(<span class=\"hljs-string\">', '</span>)}</span>`</span>))\n  .catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">`ERROR: <span class=\"hljs-subst\">${err.message}</span>`</span>))\n</code></pre>\n<p>If you're using Electron Packager's CLI, use the <code>--protocol</code> and <code>--protocol-name</code> flags. Par exemple :</p>\n<pre><code class=\"hljs language-shell\">npx electron-packager . --protocol=electron-fiddle --protocol-name=\"Electron Fiddle\"\n</code></pre>\n<h2 id=\"conclusion\"><a href=\"#conclusion\">Conclusion</a></h2>\n<p>After you start your Electron app, you can enter in a URL in your browser that contains the custom protocol, for example <code>\"electron-fiddle://open\"</code> and observe that the application will respond and show an error dialog box.</p>\n<!--\n    Because Electron examples usually require multiple files (HTML, CSS, JS\n    for the main and renderer process, etc.), we use this custom code block\n    for Fiddle (https://www.electronjs.org/fiddle).\n    Please modify any of the files in the referenced folder to fit your\n    example.\n    The content in this codeblock will not be rendered in the website so you\n    can leave it empty.\n-->\n<!-- ✍ Explanation of the code below -->",
      "title": "Lancement de votre application Electron depuis une URL dans une autre application",
      "description": ""
    },
    "/docs/tutorial/linux-desktop-actions": {
      "locale": "fr-FR",
      "slug": "linux-desktop-actions",
      "href": "/docs/tutorial/linux-desktop-actions",
      "crowdinFileId": "256213",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/linux-desktop-actions.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"actions-du-lanceur-dapplications-sur-le-bureau-linux\"><a href=\"#actions-du-lanceur-dapplications-sur-le-bureau-linux\">Actions du lanceur d'applications sur le bureau (Linux)</a></h1>\n<h2 id=\"vue-densemble\"><a href=\"#vue-densemble\">Vue d'ensemble</a></h2>\n<p>Sur de nombreux environnements Linux, vous pouvez ajouter des entrées personnalisées à son lanceur d'application en modifiant le fichier <code>.desktop</code>. For Canonical's Unity documentation, see <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Adding Shortcuts to a Launcher</a>. For details on a more generic implementation, see the <a href=\"https://specifications.freedesktop.org/desktop-entry-spec/1.1/ar01s11.html\">freedesktop.org Specification</a>.</p>\n<p><img src=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles?action=AttachFile&#x26;do=get&#x26;target=shortcuts.png\" alt=\"audacieux\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example of launcher shortcuts in Audacious audio player</p>\n</blockquote>\n<p>To create a shortcut, you need to provide <code>Name</code> and <code>Exec</code> properties for the entry you want to add to the shortcut menu. Unity will execute the command defined in the <code>Exec</code> field after the user clicked the shortcut menu item. Un exemple du fichier <code>.desktop</code> peut ressembler à ceci :</p>\n<pre><code class=\"hljs language-plaintext\">Actions=PlayPause;Next;Previous\n\n[Desktop Action PlayPause]\nName=Play-Pause\nExec=audacious -t\nOnlyShowIn=Unity;\n\n[Desktop Action Next]\nName=Next\nExec=audacious -f\nOnlyShowIn=Unity;\n\n[Desktop Action Previous]\nName=Previous\nExec=audacious -r\nOnlyShowIn=Unity;\n</code></pre>\n<p>The preferred way for Unity to instruct your application on what to do is using parameters. Vous pouvez les trouver dans votre application dans la variable globale <code>process.argv</code>.</p>",
      "title": "Actions du lanceur d'applications sur le bureau (Linux)",
      "description": "NOTE: The screenshot above is an example of launcher shortcuts in Audacious audio player"
    },
    "/docs/tutorial/mac-app-store-submission-guide": {
      "locale": "fr-FR",
      "slug": "mac-app-store-submission-guide",
      "href": "/docs/tutorial/mac-app-store-submission-guide",
      "crowdinFileId": "256215",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/mac-app-store-submission-guide.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"guide-de-soumission-mac-app-store\"><a href=\"#guide-de-soumission-mac-app-store\">Guide de Soumission Mac App Store</a></h1>\n<p>Ce guide fournit des informations sur :</p>\n<ul>\n<li>Comment signer des applications Electron sur macOS ;</li>\n<li>Comment soumettre des applications Electron sur le Mac App Store (MAS) ;</li>\n<li>Les limitations de la compilation pour le MAS.</li>\n</ul>\n<h2 id=\"spécifications-requises\"><a href=\"#spécifications-requises\">Spécifications requises</a></h2>\n<p>Pour signer des applications Electron, les outils suivants doivent d'abord être installés :</p>\n<ul>\n<li>Xcode 11 ou plus.</li>\n<li>Le module npm <a href=\"https://github.com/electron/electron-osx-sign\">electron-osx-sign</a>.</li>\n</ul>\n<p>Vous devez également créer un compte Apple Developer et rejoindre le <a href=\"https://developer.apple.com/support/compare-memberships/\">Apple Developper Program</a>.</p>\n<h2 id=\"signer-des-applications-electron\"><a href=\"#signer-des-applications-electron\">Signer des applications Electron</a></h2>\n<p>Les applications Electron peuvent être distribuées via le Mac App Store ou en dehors de celui-ci. Chaque moyen de distribution nécessite différentes façons de signer et de tester. Ce guide se concentre sur la distribution via le Mac App Store, mais mentionnera également d'autres méthodes.</p>\n<p>Les étapes suivantes décrivent comment obtenir les certificats d'Apple, comment signer des applications Electron, et comment les tester.</p>\n<h3 id=\"obtenir-des-certificats\"><a href=\"#obtenir-des-certificats\">Obtenir des certificats</a></h3>\n<p>La façon la plus simple d’obtenir des certificats de signature est d’utiliser Xcode :</p>\n<ol>\n<li>Ouvrir Xcode et dans les préférences ouvrir \"Comptes\" ;</li>\n<li>Connectez-vous avec votre compte Apple ;</li>\n<li>Sélectionnez une équipe et cliquez sur \"Gérer les certificats\" ;</li>\n<li>Dans le coin inférieur gauche de la feuille de certificats de signature, cliquez sur le bouton Ajouter (+) et ajoutez les certificats suivants :<ul>\n<li>\"Apple Development\"</li>\n<li>\"Apple Distribution\"</li>\n</ul></li>\n</ol>\n<p>The \"Apple Development\" certificate is used to sign apps for development and testing, on machines that have been registered on Apple Developer website. The method of registration will be described in <a href=\"#prepare-provisioning-profile\">Prepare provisioning profile</a>.</p>\n<p>Apps signed with the \"Apple Development\" certificate cannot be submitted to Mac App Store. For that purpose, apps must be signed with the \"Apple Distribution\" certificate instead. But note that apps signed with the \"Apple Distribution\" certificate cannot run directly, they must be re-signed by Apple to be able to run, which will only be possible after being downloaded from the Mac App Store.</p>\n<h4 id=\"autres-certificats\"><a href=\"#autres-certificats\">Autres certificats</a></h4>\n<p>Vous remarquerez peut-être qu'il existe également d'autres types de certificats.</p>\n<p>The \"Developer ID Application\" certificate is used to sign apps before distributing them outside the Mac App Store.</p>\n<p>The \"Developer ID Installer\" and \"Mac Installer Distribution\" certificates are used to sign the Mac Installer Package instead of the app itself. Most Electron apps do not use Mac Installer Package so they are generally not needed.</p>\n<p>La liste complète des types de certificats peut être trouvée <a href=\"https://help.apple.com/xcode/mac/current/#/dev80c6204ec\">ici</a>.</p>\n<p>Apps signed with \"Apple Development\" and \"Apple Distribution\" certificates can only run under <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandbox</a>, so they must use the MAS build of Electron. However, the \"Developer ID Application\" certificate does not have this restrictions, so apps signed with it can use either the normal build or the MAS build of Electron.</p>\n<h4 id=\"legacy-certificate-names\"><a href=\"#legacy-certificate-names\">Legacy certificate names</a></h4>\n<p>Apple has been changing the names of certificates during past years, you might encounter them when reading old documentations, and some utilities are still using one of the old names.</p>\n<ul>\n<li>The \"Apple Distribution\" certificate was also named as \"3rd Party Mac Developer Application\" and \"Mac App Distribution\".</li>\n<li>The \"Apple Development\" certificate was also named as \"Mac Developer\" and \"Development\".</li>\n</ul>\n<h3 id=\"prepare-provisioning-profile\"><a href=\"#prepare-provisioning-profile\">Prepare provisioning profile</a></h3>\n<p>If you want to test your app on your local machine before submitting your app to the Mac App Store, you have to sign the app with the \"Apple Development\" certificate with the provisioning profile embedded in the app bundle.</p>\n<p>To <a href=\"https://help.apple.com/developer-account/#/devf2eb157f8\">create a provisioning profile</a>, you can follow the below steps:</p>\n<ol>\n<li>Open the \"Certificates, Identifiers &#x26; Profiles\" page on the <a href=\"https://developer.apple.com/account\">Apple Developer</a> website.</li>\n<li>Add a new App ID for your app in the \"Identifiers\" page.</li>\n<li>Register your local machine in the \"Devices\" page. You can find your machine's \"Device ID\" in the \"Hardware\" page of the \"System Information\" app.</li>\n<li>Register a new Provisioning Profile in the \"Profiles\" page, and download it to <code>/path/to/yourapp.provisionprofile</code>.</li>\n</ol>\n<h3 id=\"enable-apples-app-sandbox\"><a href=\"#enable-apples-app-sandbox\">Enable Apple's App Sandbox</a></h3>\n<p>Apps submitted to the Mac App Store must run under Apple's <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandbox</a>, and only the MAS build of Electron can run with the App Sandbox. The standard darwin build of Electron will fail to launch when run under App Sandbox.</p>\n<p>When signing the app with <code>electron-osx-sign</code>, it will automatically add the necessary entitlements to your app's entitlements, but if you are using custom entitlements, you must ensure App Sandbox capacity is added:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<h4 id=\"étapes-supplémentaires-sans-electron-osx-sign\"><a href=\"#étapes-supplémentaires-sans-electron-osx-sign\">Étapes supplémentaires sans <code>electron-osx-sign</code></a></h4>\n<p>Si vous signez votre application sans utiliser <code>electron-osx-sign</code>, vous devez vous assurer les droits du bundle d'applications ont au moins les clés suivantes :</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1. //FR\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com. pple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security. groupes de pplication<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">array</span>></span>\n      <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>TEAM_ID. notre.bundle.id<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n    <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">array</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>The <code>TEAM_ID</code> should be replaced with your Apple Developer account's Team ID, and the <code>your.bundle.id</code> should be replaced with the App ID of the app.</p>\n<p>And the following entitlements must be added to the binaries and helpers in the app's bundle:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.inherit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>And the app bundle's <code>Info.plist</code> must include <code>ElectronTeamID</code> key, which has your Apple Developer account's Team ID as its value:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n  ...\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>ElectronTeamID<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>TEAM_ID<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>When using <code>electron-osx-sign</code> the <code>ElectronTeamID</code> key will be added automatically by extracting the Team ID from the certificate's name. You may need to manually add this key if <code>electron-osx-sign</code> could not find the correct Team ID.</p>\n<h3 id=\"sign-apps-for-development\"><a href=\"#sign-apps-for-development\">Sign apps for development</a></h3>\n<p>To sign an app that can run on your development machine, you must sign it with the \"Apple Development\" certificate and pass the provisioning profile to <code>electron-osx-sign</code>.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Apple Development'</span> --provisioning-profile=/path/to/yourapp.provisionprofile\n</code></pre>\n<p>If you are signing without <code>electron-osx-sign</code>, you must place the provisioning profile to <code>YourApp.app/Contents/embedded.provisionprofile</code>.</p>\n<p>The signed app can only run on the machines that registered by the provisioning profile, and this is the only way to test the signed app before submitting to Mac App Store.</p>\n<h3 id=\"sign-apps-for-submitting-to-the-mac-app-store\"><a href=\"#sign-apps-for-submitting-to-the-mac-app-store\">Sign apps for submitting to the Mac App Store</a></h3>\n<p>To sign an app that will be submitted to Mac App Store, you must sign it with the \"Apple Distribution\" certificate. Note that apps signed with this certificate will not run anywhere, unless it is downloaded from Mac App Store.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Apple Distribution'</span>\n</code></pre>\n<h3 id=\"sign-apps-for-distribution-outside-the-mac-app-store\"><a href=\"#sign-apps-for-distribution-outside-the-mac-app-store\">Sign apps for distribution outside the Mac App Store</a></h3>\n<p>If you don't plan to submit the app to Mac App Store, you can sign it the \"Developer ID Application\" certificate. In this way there is no requirement on App Sandbox, and you should use the normal darwin build of Electron if you don't use App Sandbox.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Developer ID Application'</span> --no-gatekeeper-assess\n</code></pre>\n<p>By passing <code>--no-gatekeeper-assess</code>, the <code>electron-osx-sign</code> will skip the macOS GateKeeper check as your app usually has not been notarized yet by this step.</p>\n<!-- TODO(zcbenz): Add a chapter about App Notarization -->\n<p>This guide does not cover <a href=\"https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution\">App Notarization</a>, but you might want to do it otherwise Apple may prevent users from using your app outside Mac App Store.</p>\n<h2 id=\"submit-apps-to-the-mac-app-store\"><a href=\"#submit-apps-to-the-mac-app-store\">Submit Apps to the Mac App Store</a></h2>\n<p>After signing the app with the \"Apple Distribution\" certificate, you can continue to submit it to Mac App Store.</p>\n<p>However, this guide do not ensure your app will be approved by Apple; you still need to read Apple's <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/SubmittingYourApp/SubmittingYourApp.html\">Submitting Your App</a> guide on how to meet the Mac App Store requirements.</p>\n<h3 id=\"upload\"><a href=\"#upload\">Upload</a></h3>\n<p>The Application Loader should be used to upload the signed app to iTunes Connect for processing, making sure you have <a href=\"https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/CreatingiTunesConnectRecord.html\">created a record</a> before uploading.</p>\n<p>If you are seeing errors like private APIs uses, you should check if the app is using the MAS build of Electron.</p>\n<h3 id=\"soumettre-pour-vérification\"><a href=\"#soumettre-pour-vérification\">Soumettre pour vérification</a></h3>\n<p>After uploading, you should <a href=\"https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html\">submit your app for review</a>.</p>\n<h2 id=\"limitation-de-mas-build\"><a href=\"#limitation-de-mas-build\">Limitation de MAS Build</a></h2>\n<p>Afin de satisfaire toutes les exigences pour l'app sandboxing, les modules suivants ont été désactivé dans la compilation MAS :</p>\n<ul>\n<li><code>crashReporter</code></li>\n<li><code>autoUpdater</code></li>\n</ul>\n<p>et les comportements suivants ont été modifiés :</p>\n<ul>\n<li>La capture vidéo peut ne pas fonctionner pour certaines machines.</li>\n<li>Certaines fonctionnalités d'accessibilité peuvent ne pas fonctionner.</li>\n<li>Les applications ne seront pas au courant des changements DNS.</li>\n</ul>\n<p>De plus, en raison de l'utilisation de l'app sandboxing, les ressources étant accessibles par l'application sont strictement limitées. Vous pouvez lire <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandboxing</a> pour plus d'informations.</p>\n<h3 id=\"droits-supplémentaires\"><a href=\"#droits-supplémentaires\">Droits supplémentaires</a></h3>\n<p>Depending on which Electron APIs your app uses, you may need to add additional entitlements to your app's entitlements file. Otherwise, the App Sandbox may prevent you from using them.</p>\n<h4 id=\"accès-réseau\"><a href=\"#accès-réseau\">Accès réseau</a></h4>\n<p>Activez les connexions sortantes du réseau pour permettre votre application de se connecter à un serveur :</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.network.client<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>Activez les connexion entrantes du réseau pour permettre votre application d'ouvrir un système d'écoute socket :</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.network.server<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>Voir la <a href=\"https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW9\">documentation Activer les accès réseaux</a> pour plus de détails.</p>\n<h4 id=\"dialogshowopendialog\"><a href=\"#dialogshowopendialog\">dialog.showOpenDialog</a></h4>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.files.user-selected.read-only<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>Voir la <a href=\"https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6\">documentation Activer les fichiers sélectionnés par l'utilisateur</a> pour plus de détails.</p>\n<h4 id=\"dialogshowsavedialog\"><a href=\"#dialogshowsavedialog\">dialog.showSaveDialog</a></h4>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.files.user-selected.read-write<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>Voir la <a href=\"https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6\">documentation Activer les fichiers sélectionnés par l'utilisateur</a> pour plus de détails.</p>\n<h2 id=\"algorithmes-de-chiffrement-utilisés-par-electron\"><a href=\"#algorithmes-de-chiffrement-utilisés-par-electron\">Algorithmes de chiffrement utilisés par Electron</a></h2>\n<p>Selon les pays dans lesquels vous publiez votre application, vous pourriez être requis pour fournir des informations sur les algorithmes de chiffrement utilisés dans votre logiciel . Voir la <a href=\"https://help.apple.com/app-store-connect/#/devc3f64248f\">documentation de conformité à l'exportation de chiffrement</a> pour plus d'informations.</p>\n<p>Electron utilise ces algorithmes de chiffrement suivants :</p>\n<ul>\n<li>AES - <a href=\"https://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf\">NIST SP 800-38A</a>, <a href=\"https://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf\">NIST SP 800-38D</a>, <a href=\"https://www.ietf.org/rfc/rfc3394.txt\">RFC 3394</a></li>\n<li>HMAC - <a href=\"https://csrc.nist.gov/publications/fips/fips198-1/FIPS-198-1_final.pdf\">FIPS 198-1</a></li>\n<li>ECDSA - ANS X9.62–2005</li>\n<li>ECDH - ANS X9.63–2001</li>\n<li>HKDF - <a href=\"https://csrc.nist.gov/publications/nistpubs/800-56C/SP-800-56C.pdf\">NIST SP 800-56C</a></li>\n<li>PBKDF2 - <a href=\"https://tools.ietf.org/html/rfc2898\">RFC 2898</a></li>\n<li>RSA - <a href=\"https://www.ietf.org/rfc/rfc3447\">RFC 3447</a></li>\n<li>SHA - <a href=\"https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf\">FIPS 180-4</a></li>\n<li>Blowfish - <a href=\"https://www.schneier.com/cryptography/blowfish/\">https://www.schneier.com/cryptography/blowfish/</a></li>\n<li>CAST - <a href=\"https://tools.ietf.org/html/rfc2144\">RFC 2144</a>, <a href=\"https://tools.ietf.org/html/rfc2612\">RFC 2612</a></li>\n<li>DES - <a href=\"https://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf\">FIPS 46-3</a></li>\n<li>DH - <a href=\"https://tools.ietf.org/html/rfc2631\">RFC 2631</a></li>\n<li>DSA - <a href=\"https://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+X9.30-1%3A1997\">ANSI X9.30</a></li>\n<li>EC - <a href=\"https://www.secg.org/sec1-v2.pdf\">SEC 1</a></li>\n<li>IDEA - \"On the Design and Security of Block Ciphers\" book by X. Lai</li>\n<li>MD2 - <a href=\"https://tools.ietf.org/html/rfc1319\">RFC 1319</a></li>\n<li>MD4 - <a href=\"https://tools.ietf.org/html/rfc6150\">RFC 6150</a></li>\n<li>MD5 - <a href=\"https://tools.ietf.org/html/rfc1321\">RFC 1321</a></li>\n<li>MDC2 - <a href=\"https://wiki.openssl.org/index.php/Manual:Mdc2(3)\">ISO/IEC 10118-2</a></li>\n<li>RC2 - <a href=\"https://tools.ietf.org/html/rfc2268\">RFC 2268</a></li>\n<li>RC4 - <a href=\"https://tools.ietf.org/html/rfc4345\">RFC 4345</a></li>\n<li>RC5 - <a href=\"https://people.csail.mit.edu/rivest/Rivest-rc5rev.pdf\">https://people.csail.mit.edu/rivest/Rivest-rc5rev.pdf</a></li>\n<li>RIPEMD - <a href=\"https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2010118-3:2004\">ISO/IEC 10118-3</a></li>\n</ul>",
      "title": "Guide de Soumission Mac App Store",
      "description": ""
    },
    "/docs/tutorial/macos-dock": {
      "locale": "fr-FR",
      "slug": "macos-dock",
      "href": "/docs/tutorial/macos-dock",
      "crowdinFileId": "256217",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/macos-dock.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dock-macos\"><a href=\"#dock-macos\">Dock (macOS)</a></h1>\n<p>Electron a des APIs pour configurer l'icône de l'application dans le macOS Dock. A macOS-only API exists to create a custom dock menu, but Electron also uses the app dock icon as the entry point for cross-platform features like <a href=\"/docs/tutorial/recent-documents\">recent documents</a> and <a href=\"/docs/tutorial/progress-bar\">application progress</a>.</p>\n<p>Le dock personnalisé est généralement utilisé pour ajouter des raccourcis aux tâches pour lesquelles l'utilisateur ne voudrait pas ouvrir toute la fenêtre de l'application.</p>\n<p><strong>Menu du Dock de Terminal.app :</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5069962/6032658a-6e9c-11e4-9953-aa84006bdfff.png\" alt=\"Menu Dock\"></p>\n<p>To set your custom dock menu, you need to use the <a href=\"/docs/api/dock#docksetmenumenu-macos\"><code>app.dock.setMenu</code></a> API, which is only available on macOS.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/macos-dock-menu\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\n<span class=\"hljs-keyword\">const</span> dockMenu = Menu.buildFromTemplate([\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Window'</span>,\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'New Window'</span>) }\n  }, {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Window with Settings'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Basic'</span> },\n      { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Pro'</span> }\n    ]\n  },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Command...'</span> }\n])\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">if</span> (process.platform === <span class=\"hljs-string\">'darwin'</span>) {\n    app.dock.setMenu(dockMenu)\n  }\n}).then(createWindow)\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n\n</code></pre>\n<p>After launching the Electron application, right click the application icon. You should see the custom menu you just defined:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/macos-dock-menu.png\" alt=\"macOS dock menu\"></p>",
      "title": "Dock (macOS)",
      "description": ""
    },
    "/docs/api/structures/memory-info": {
      "locale": "fr-FR",
      "slug": "memory-info",
      "href": "/docs/api/structures/memory-info",
      "crowdinFileId": "256459",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/memory-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"memoryinfo-object\"><a href=\"#memoryinfo-object\">MemoryInfo Object</a></h1>\n<ul>\n<li><code>workingSetSize</code> Integer - The amount of memory currently pinned to actual physical RAM.</li>\n<li><code>peakWorkingSetSize</code> Integer - The maximum amount of memory that has ever been pinned to actual physical RAM.</li>\n<li><code>privateBytes</code> Integer (optional) <em>Windows</em> - The amount of memory not shared by other processes, such as JS heap or HTML content.</li>\n</ul>\n<p>Note that all statistics are reported in Kilobytes.</p>",
      "title": "MemoryInfo Object",
      "description": ""
    },
    "/docs/api/structures/memory-usage-details": {
      "locale": "fr-FR",
      "slug": "memory-usage-details",
      "href": "/docs/api/structures/memory-usage-details",
      "crowdinFileId": "256461",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/memory-usage-details.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"memoryusagedetails-object\"><a href=\"#memoryusagedetails-object\">MemoryUsageDetails Object</a></h1>\n<ul>\n<li><code>count</code> Number</li>\n<li><code>size</code> Number</li>\n<li><code>liveSize</code> Number</li>\n</ul>",
      "title": "MemoryUsageDetails Object",
      "description": ""
    },
    "/docs/api/menu": {
      "locale": "fr-FR",
      "slug": "menu",
      "href": "/docs/api/menu",
      "crowdinFileId": "256335",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/menu.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"menu\"><a href=\"#menu\">Menu</a></h1>\n<h2 id=\"classe--menu\"><a href=\"#classe--menu\">Classe : Menu</a></h2>\n<blockquote>\n<p>Crée des menus d'applications natifs et des menus contextuels.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h3 id=\"new-menu\"><a href=\"#new-menu\"><code>new Menu()</code></a></h3>\n<p>Créer un nouveau menu.</p>\n<h3 id=\"méthodes-statiques\"><a href=\"#méthodes-statiques\">Méthodes statiques</a></h3>\n<p>La classe <code>Menu</code> a les méthodes statiques suivantes :</p>\n<h4 id=\"menusetapplicationmenumenu\"><a href=\"#menusetapplicationmenumenu\"><code>Menu.setApplicationMenu(menu)</code></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Définit le menu <code>comme le menu d'application sur macOS. Sous Windows et Linux, le menu</code> sera défini comme le menu supérieur de chaque fenêtre.</p>\n<p>Aussi sous Windows et Linux, vous pouvez utiliser un <code>&#x26;</code> dans le nom de l'élément de niveau supérieur pour indiquer quelle lettre doit obtenir un accélérateur généré. Par exemple, en utilisant <code>&#x26;Fichier</code> pour le menu de fichiers, l'accélérateur <code>Alt-F</code> généré qui ouvre le menu associé. The indicated character in the button label then gets an underline, and the <code>&#x26;</code> character is not displayed on the button label.</p>\n<p>In order to escape the <code>&#x26;</code> character in an item name, add a proceeding <code>&#x26;</code>. For example, <code>&#x26;&#x26;File</code> would result in <code>&#x26;File</code> displayed on the button label.</p>\n<p>Passing <code>null</code> will suppress the default menu. Sous Windows et Linux, cela a pour effet supplémentaire de supprimer la barre de menu de la fenêtre.</p>\n<p><strong>Note:</strong> Le menu par défaut sera créé automatiquement si l'application ne le définit pas. Il contient des éléments standard tels que <code>Fichier</code>, <code>Modifier</code>, <code>Voir</code>, <code>Window</code> et <code>Aide</code>.</p>\n<h4 id=\"menugetapplicationmenu\"><a href=\"#menugetapplicationmenu\"><code>Menu.getApplicationMenu()</code></a></h4>\n<p>Retourne <code>Menu | null</code> - Le menu de l’application, si défini, ou <code>null</code>, si non défini.</p>\n<p><strong>Remarque :</strong> L'instance du <code>Menu</code> retourné, ne supporte pas l'ajout ou la suppression dynamique d’éléments de menu. Les <a href=\"#instance-properties\">propriétés de l’instance</a> peuvent encore être modifiées dynamiquement.</p>\n<h4 id=\"menusendactiontofirstresponderaction-macos\"><a href=\"#menusendactiontofirstresponderaction-macos\"><code>Menu.sendActionToFirstResponder(action)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>action</code> String</li>\n</ul>\n<p>Envoie <code>action</code> au premier répondant de l'application. Ceci est utilisé pour émuler les comportements du menu de macOS par défaut. Habituellement, vous utiliseriez la propriété <a href=\"/docs/api/menu-item#roles\"><code>rôle</code></a> d'un <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>.</p>\n<p>Voir le <a href=\"https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW7\">Guide de gestion des événements Cocoa de macOS</a> pour plus d'informations sur les actions natives de macOS.</p>\n<h4 id=\"menubuildfromtemplatetemplate\"><a href=\"#menubuildfromtemplatetemplate\"><code>Menu.buildFromTemplate(template)</code></a></h4>\n<ul>\n<li><code>template</code> (MenuItemConstructorOptions | MenuItem)[]</li>\n</ul>\n<p>Retourne <code>Menu</code></p>\n<p>Généralement, le paramètre <code>template</code> est un tableau d' <code>options</code> pour construire un <a href=\"/docs/api/menu-item\">MenuItem</a>. L’utilisation peut être référencée ci-dessus. L'utilisation peut être référencée ci-dessus.</p>\n<p>Vous pouvez également attacher d'autres champs à l'élément du <code>template</code> et ils deviendront des propriétés des éléments de menu construits.</p>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<p>L'objet <code>menu</code> a les méthodes d'instance suivantes:</p>\n<h4 id=\"menupopupoptions\"><a href=\"#menupopupoptions\"><code>menu.popup([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (facultatif) - La fenêtre focalisée est par défaut.</li>\n<li><code>x</code> Number (facultatif) - C'est par défaut la position actuelle du curseur de la souris. Doit être déclaré si <code>y</code> est déclaré.</li>\n<li><code>x</code> Number (facultatif) - C'est par défaut la position actuelle du curseur de la souris. Doit être déclaré si <code>x</code> est déclaré.</li>\n<li><code>positioningItem</code> Number (facultatif) <em>macOS</em> - L'index de l'élément de menu à positionner sous le curseur de la souris aux coordonnées spécifiées. est. La valeur par défaut est -1.</li>\n<li><code>callback</code> Fonction (facultatif) - Appelée lorsque le menu est fermé.</li>\n</ul></li>\n</ul>\n<p>Dépile ce menu sous la forme d'un menu contextuel dans la <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<h4 id=\"menuclosepopupbrowserwindow\"><a href=\"#menuclosepopupbrowserwindow\"><code>menu.closePopup([browserWindow])</code></a></h4>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (facultatif) - La fenêtre focalisée est par défaut.</li>\n</ul>\n<p>Ferme le menu contextuel dans la <code>browserWindow</code>.</p>\n<h4 id=\"menuappendmenuitem\"><a href=\"#menuappendmenuitem\"><code>menu.append(menuItem)</code></a></h4>\n<ul>\n<li><code>menuItem</code> <a href=\"/docs/api/menu-item\">MenuItem</a></li>\n</ul>\n<p>Ajoute le <code>menuItem</code> au menu.</p>\n<h4 id=\"menugetmenuitembyidid\"><a href=\"#menugetmenuitembyidid\"><code>menu.getMenuItemById(id)</code></a></h4>\n<ul>\n<li><code>id</code> String</li>\n</ul>\n<p>Retourne <code>MenuItem | null</code> l'élément avec le <code>id</code> spécifié</p>\n<h4 id=\"menuinsertpos-menuitem\"><a href=\"#menuinsertpos-menuitem\"><code>menu.insert(pos, menuItem)</code></a></h4>\n<ul>\n<li><code>pos</code> Integer</li>\n<li><code>menuItem</code> <a href=\"/docs/api/menu-item\">MenuItem</a></li>\n</ul>\n<p>Insère le <code>menuItem</code> à la position <code>pos</code> du menu.</p>\n<h3 id=\"événements-dinstance\"><a href=\"#événements-dinstance\">Événements d’instance</a></h3>\n<p>Les objets créés avec <code>nouveau Menu</code> ou retournés par <code>Menu.buildFromTemplate</code> émettent les événements suivants :</p>\n<p><strong>Remarque :</strong> Certains événements sont seulement disponibles sur des systèmes d'exploitation spécifiques et sont étiquetés comme tels.</p>\n<h4 id=\"événement--menu-will-show\"><a href=\"#événement--menu-will-show\">Événement : 'menu-will-show'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Émis lorsque <code>menu.popup()</code> est appelé.</p>\n<h4 id=\"événement--menu-will-close\"><a href=\"#événement--menu-will-close\">Événement : 'menu-will-close'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Émis lorsqu'un popup est fermé manuellement ou avec <code>menu.closePopup()</code>.</p>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<p>Les objets <code>menu</code> ont également les propriétés suivantes :</p>\n<h4 id=\"menuitems\"><a href=\"#menuitems\"><code>menu.items</code></a></h4>\n<p>Un tableau <code>MenuItem[]</code> contenant les éléments du menu.</p>\n<p>Chaque <code>Menu</code> consiste en plusieurs <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>s et chaque <code>MenuItem</code> peut avoir un sous-menu.</p>\n<h2 id=\"exemples\"><a href=\"#exemples\">Exemples</a></h2>\n<p>Un exemple de création du menu de l'application avec l'API de modèle simple :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> isMac = process.platform === <span class=\"hljs-string\">'darwin'</span>\n\n<span class=\"hljs-keyword\">const</span> template = [\n  <span class=\"hljs-comment\">// { role: 'appMenu' }</span>\n  ...(isMac ? [{\n    <span class=\"hljs-attr\">label</span>: app. ame,\n    sous-menu : [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'about'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'services'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'hide'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'hideOthers'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'unhide'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'quit'</span> }\n    ]\n  }] : []),\n  <span class=\"hljs-comment\">// { role: 'fileMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Fichier'</span>,\n    sous-menu : [\n      isMac ? { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'close'</span> } : { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'quit'</span> }\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'editMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Modifier'</span>,\n    sous-menu : [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'undo'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'redo'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'cut'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'copy'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'paste'</span> },\n      . .(isMac ? [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'pasteAndMatchStyle'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'delete'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'selectAll'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        {\n          <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Speech'</span>,\n          <span class=\"hljs-attr\">submenu</span>: [\n            { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'startSpeaking'</span> },\n            { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'stopSpeaking'</span> }\n          ]\n        }\n      ] : [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'delete'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'selectAll'</span> }\n      ])\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'viewMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'View'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'reload'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'forceReload'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'toggleDevTools'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'resetZoom'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoomIn'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoomOut'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'togglefullscreen'</span> }\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'windowMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Window'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'minimize'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoom'</span> },\n      ...(isMac ? [\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'front'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'window'</span> }\n      ] : [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'close'</span> }\n      ])\n    ]\n  },\n  {\n    rôle: <span class=\"hljs-string\">'help'</span>,\n    sous-menu : [\n      {\n        <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'En savoir plus'</span>,\n        <span class=\"hljs-attr\">clic</span> : <span class=\"hljs-keyword\">async</span> () => {\n          <span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n          attendent shell. penExternal(<span class=\"hljs-string\">'https://electronjs. rg'</span>)\n        }\n\n    ]\n  }\n]\n\n<span class=\"hljs-keyword\">const</span> menu = Menu. uildFromTemplate(template)\nMenu.setApplicationMenu(menu)\n</code></pre>\n<h3 id=\"processus-de-rendu\"><a href=\"#processus-de-rendu\">Processus de rendu</a></h3>\n<p>To create menus initiated by the renderer process, send the required information to the main process using IPC and have the main process display the menu on behalf of the renderer.</p>\n<p>Voici un exemple d'affichage d'un menu lorsque l'utilisateur clique avec le bouton droit sur la page :</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer</span>\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'contextmenu'</span>, (e) => {\n  e.preventDefault()\n  ipcRenderer.send(<span class=\"hljs-string\">'show-context-menu'</span>)\n})\n\nipcRenderer.on(<span class=\"hljs-string\">'context-menu-command'</span>, (e, command) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// main</span>\nipcMain.on(<span class=\"hljs-string\">'show-context-menu'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> template = [\n    {\n      <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Menu Item 1'</span>,\n      <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { event.sender.send(<span class=\"hljs-string\">'context-menu-command'</span>, <span class=\"hljs-string\">'menu-item-1'</span>) }\n    },\n    { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Menu Item 2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'checkbox'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> }\n  ]\n  <span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\n  menu.popup(BrowserWindow.fromWebContents(event.sender))\n})\n</code></pre>\n<h2 id=\"notes-sur-le-menu-dapplication-macos\"><a href=\"#notes-sur-le-menu-dapplication-macos\">Notes sur le menu d'application macOS</a></h2>\n<p>macOS a un style de menu d'application complètement différent de Windows et Linux. Voici quelques notes pour rendre le menu de votre application plus natif.</p>\n<h3 id=\"standard-menus\"><a href=\"#standard-menus\">Standard Menus</a></h3>\n<p>Sur macOS, il y a beaucoup de menus standards définis par le système, comme les <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc\"><code>Services</code></a> et <code>Windows</code>. Pour faire de votre menu un menu standard, vous devriez définir le <code>rôle de votre menu</code> à l'un des rôles suivants et Electron les reconnaîtra et les fera devenir des menus standard :</p>\n<ul>\n<li><code>window</code></li>\n<li><code>help</code></li>\n<li><code>services</code></li>\n</ul>\n<h3 id=\"actions-des-éléments-de-menu-standard\"><a href=\"#actions-des-éléments-de-menu-standard\">Actions des éléments de menu standard</a></h3>\n<p>macOS a fourni des actions standard pour certains liens de menu, comme <code>À propos de xxx</code>, <code>Cacher xxx</code>, et <code>Cacher les autres</code>. Pour définir l'action d'un lien de menu à une action standard , vous devez définir l'attribut <code>rôle</code> de l'élément de menu.</p>\n<h3 id=\"nom-du-menu-principal\"><a href=\"#nom-du-menu-principal\">Nom du menu principal</a></h3>\n<p>Sur macOS, l'étiquette du premier élément du menu de l'application est toujours le nom de votre application, quel que soit le libellé que vous avez défini. Pour le modifier, modifiez le fichier <code>Info.plist</code> de votre pack d'applications. See <a href=\"https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html\">About Information Property List Files</a> for more information.</p>\n<h2 id=\"setting-menu-for-specific-browser-window-linux-windows\"><a href=\"#setting-menu-for-specific-browser-window-linux-windows\">Setting Menu for Specific Browser Window (<em>Linux</em> <em>Windows</em>)</a></h2>\n<p>La <a href=\"/docs/api/browser-window#winsetmenumenu-linux-windows\"><code>setMenu</code> méthode</a> des fenêtres du navigateur peut définir le menu de certaines fenêtres de navigateur .</p>\n<h2 id=\"position-de-lélément-de-menu\"><a href=\"#position-de-lélément-de-menu\">Position de l'élément de menu</a></h2>\n<p>Vous pouvez utiliser <code>avant</code>, <code>after</code>, <code>beforeGroupContaining</code>, <code>afterGroupContaining</code> et <code>id</code> pour contrôler comment l'élément sera placé lors de la construction d'un menu avec <code>Menu.buildFromTemplate</code>.</p>\n<ul>\n<li><code>avant</code> - Insère cet élément avant l'élément avec l'étiquette spécifiée. Si l'élément référencé n'existe pas, l'élément sera inséré à la fin de le menu. Implique également que le lien de menu en question doit être placé dans le même « groupe » que l’élément.</li>\n<li><code>après</code> - Insère cet élément après l'élément avec l'étiquette spécifiée. Si l'élément référencé n'existe pas, l'élément sera inséré à la fin de le menu. Implique également que le lien de menu en question doit être placé dans le même « groupe » que l’élément.</li>\n<li><code>beforeGroupContaining</code> - Fournit un moyen pour un seul menu contextuel de déclarer le placement de leur groupe contenant avant le groupe contenant de l'élément avec l'étiquette spécifiée.</li>\n<li><code>afterGroupContaining</code> - Fournit un moyen pour un seul menu contextuel de déclarer le placement de leur groupe contenant après le groupe contenant de l'élément avec l'étiquette spécifiée.</li>\n</ul>\n<p>Par défaut, les éléments seront insérés dans l'ordre dans lequel ils existent dans le modèle, sauf si l'un des mots-clés de positionnement spécifiés est utilisé.</p>\n<h3 id=\"exemples-1\"><a href=\"#exemples-1\">Exemples</a></h3>\n<p>Modèle :</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'4'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'four'</span> }\n]\n</code></pre>\n<p>Menu :</p>\n<pre><code class=\"hljs language-sh\">- 1\n- 2\n- 3\n- 4\n</code></pre>\n<p>Modèle :</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span> },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span>, <span class=\"hljs-attr\">beforeGroupContaining</span>: [<span class=\"hljs-string\">'1'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'4'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'four'</span>, <span class=\"hljs-attr\">afterGroupContaining</span>: [<span class=\"hljs-string\">'2'</span>] },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span> }\n]\n</code></pre>\n<p>Menu :</p>\n<pre><code class=\"hljs language-sh\">- 3\n- 4\n- ---\n- 1\n- ---\n- 2\n</code></pre>\n<p>Modèle :</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span>, <span class=\"hljs-attr\">after</span>: [<span class=\"hljs-string\">'3'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span>, <span class=\"hljs-attr\">before</span>: [<span class=\"hljs-string\">'1'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span> }\n]\n</code></pre>\n<p>Menu :</p>\n<pre><code class=\"hljs language-sh\">- ---\n- 3\n- 2\n- 1\n</code></pre>",
      "title": "Menu",
      "description": "Crée des menus d'applications natifs et des menus contextuels."
    },
    "/docs/api/menu-item": {
      "locale": "fr-FR",
      "slug": "menu-item",
      "href": "/docs/api/menu-item",
      "crowdinFileId": "256333",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/menu-item.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe--menuitem\"><a href=\"#classe--menuitem\">Classe : MenuItem</a></h2>\n<blockquote>\n<p>Ajoute des éléments aux menus et menus contextuels de l’application native.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>Voir <a href=\"/docs/api/menu\"><code>Menu</code></a> pour des exemples.</p>\n<h3 id=\"new-menuitemoptions\"><a href=\"#new-menuitemoptions\"><code>new MenuItem(options)</code></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>click</code> Function (optional) - Will be called with <code>click(menuItem, browserWindow, event)</code> when the menu item is clicked.<ul>\n<li><code>menuItem</code> MenuItem</li>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | undefined - This will not be defined if no window is open.</li>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n</ul></li>\n<li><code>role</code> String (optional) - Can be <code>undo</code>, <code>redo</code>, <code>cut</code>, <code>copy</code>, <code>paste</code>, <code>pasteAndMatchStyle</code>, <code>delete</code>, <code>selectAll</code>, <code>reload</code>, <code>forceReload</code>, <code>toggleDevTools</code>, <code>resetZoom</code>, <code>zoomIn</code>, <code>zoomOut</code>, <code>toggleSpellChecker</code>, <code>togglefullscreen</code>, <code>window</code>, <code>minimize</code>, <code>close</code>, <code>help</code>, <code>about</code>, <code>services</code>, <code>hide</code>, <code>hideOthers</code>, <code>unhide</code>, <code>quit</code>, <code>startSpeaking</code>, <code>stopSpeaking</code>, <code>zoom</code>, <code>front</code>, <code>appMenu</code>, <code>fileMenu</code>, <code>editMenu</code>, <code>viewMenu</code>, <code>shareMenu</code>, <code>recentDocuments</code>, <code>toggleTabBar</code>, <code>selectNextTab</code>, <code>selectPreviousTab</code>, <code>mergeAllWindows</code>, <code>clearRecentDocuments</code>, <code>moveTabToNewWindow</code> or <code>windowMenu</code> - Define the action of the menu item, when specified the <code>click</code> property will be ignored. Voir <a href=\"#roles\">rôles</a>.</li>\n<li><code>type</code> String (facultatif) - Peut être <code>normal</code>, <code>séparateur</code>, <code>sous-menu</code>, <code>checkbox</code> ou <code>radio</code>.</li>\n<li><code>label</code> String (optionnel)</li>\n<li><code>sublabel</code> String (optionnel)</li>\n<li><code>toolTip</code> String (optional) <em>macOS</em> - Hover text for this menu item.</li>\n<li><code>accélérateur</code> <a href=\"/docs/api/accelerator\">Accelerator</a> (facultatif)</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (facultatif)</li>\n<li><code>activé</code> Booléen (facultatif) - Si faux, l'élément de menu sera grisé et non cliquable.</li>\n<li><code>acceleratorWorksWhenHidden</code> Boolean (optional) <em>macOS</em> - default is <code>true</code>, and when <code>false</code> will prevent the accelerator from triggering the item if the item is not visible`.</li>\n<li><code>visible</code> Boolean (facultatif) - Si false, l'élément de menu sera entièrement masqué.</li>\n<li><code>coché</code> Booléen (facultatif) - Ne doit être spécifié que pour <code>case à cocher</code> ou <code>radio</code> type des liens de menu .</li>\n<li><code>registerAccelerator</code> Boolean (optional) <em>Linux</em> <em>Windows</em> - If false, the accelerator won't be registered with the system, but it will still be displayed. Defaults to true.</li>\n<li><code>sharingItem</code> SharingItem (optional) <em>macOS</em> - The item to share when the <code>role</code> is <code>shareMenu</code>.</li>\n<li><code>sous-menu</code> (MenuItemConstructorOptions[] | <a href=\"/docs/api/menu\">Menu</a>) (facultatif) - Doit être spécifié pour <code>sous-menu</code> type éléments de menu. Si <code>sous-menu</code> est spécifié, le <code>type: 'submenu'</code> peut être omis. Si la valeur n'est pas un <a href=\"/docs/api/menu\"><code>Menu</code></a> alors elle sera automatiquement convertie en un en utilisant <code>Menu.buildFromTemplate</code>.</li>\n<li><code>id</code> String (optional) - Unique within a single menu. If defined then it can be used as a reference to this item by the position attribute.</li>\n<li><code>avant</code> String<a href=\"/docs/api/facultatif\"></a> - Insère cet élément avant l'élément avec le libellé spécifié. Si l'élément référencé n'existe pas, l'élément sera inséré à la fin du menu. Implique également que l'élément de menu en question doit être placé dans le même « groupe » que l'élément.</li>\n<li><code>after</code> String<a href=\"/docs/api/optional\"></a> - Inserts this item after the item with the specified label. Si l'élément référencé n'existe pas, l'élément sera inséré à la fin de le menu.</li>\n<li><code>beforeGroupContaining</code> String<a href=\"/docs/api/facultatif\"></a> - Fournit un moyen pour un seul menu contextuel de déclarer le placement de leur groupe contenant avant le groupe contenant l'élément avec l'étiquette spécifiée.</li>\n<li><code>afterGroupContaining</code> String<a href=\"/docs/api/facultatif\"></a> - Fournit un moyen pour un seul menu contextuel de déclarer le placement de leur groupe contenant après le groupe contenant de l'élément avec l'étiquette spécifiée.</li>\n</ul></li>\n</ul>\n<p><strong>Note:</strong> <code>acceleratorWorksWhenHidden</code> is specified as being macOS-only because accelerators always work when items are hidden on Windows and Linux. L'option est exposée aux utilisateurs pour leur donner la possibilité de la désactiver, car cela est possible dans le développement natif de macOS. Cette propriété n'est utilisable que sur macOS Haute Sierra 10.13 ou plus récente.</p>\n<h3 id=\"rôles\"><a href=\"#rôles\">Rôles</a></h3>\n<p>Les rôles permettent à des éléments du menu d'avoir des comportements prédéfinis.</p>\n<p>Il est préférable de spécifier <code>rôle</code> pour tout élément de menu qui correspond à un rôle standard, plutôt que d'essayer d'implémenter manuellement le comportement dans une fonction <code>clic</code>. Le comportement <code>rôle</code> intégré donnera la meilleure expérience native.</p>\n<p>Les valeurs <code>label</code> et <code>accélérateur</code> sont optionnelles lorsque vous utilisez un <code>rôle</code> et par défaut des valeurs appropriées pour chaque plateforme.</p>\n<p>Chaque lien de menu doit avoir soit un <code>rôle</code>, <code>label</code>, soit dans le cas d'un séparateur un <code>type</code>.</p>\n<p>La propriété <code>role</code> peut avoir les valeurs suivantes :</p>\n<ul>\n<li><code>undo</code></li>\n<li><code>about</code> - Trigger a native about panel (custom message box on Window, which does not provide its own).</li>\n<li><code>redo</code></li>\n<li><code>cut</code></li>\n<li><code>copy</code></li>\n<li><code>paste</code></li>\n<li><code>pasteAndMatchStyle</code></li>\n<li><code>selectAll</code></li>\n<li><code>delete</code></li>\n<li><code>minimize</code> - Minimize current window.</li>\n<li><code>close</code> - Close current window.</li>\n<li><code>quitter</code> - Quitter l'application.</li>\n<li><code>reload</code> - Reload the current window.</li>\n<li><code>forceReload</code> - Recharge la fenêtre courante ignorant le cache.</li>\n<li><code>toggleDevTools</code> - Bascule les outils de développement dans la fenêtre actuelle.</li>\n<li><code>togglefullscreen</code> - Basculer en mode plein écran dans la fenêtre actuelle.</li>\n<li><code>resetZoom</code> - Réinitialise le niveau de zoom de la page ciblée à la taille d'origine.</li>\n<li><code>zoomIn</code> - Zoom sur la page ciblée par 10%.</li>\n<li><code>zoomOut</code> - Zoom arrière de la page ciblée de 10%.</li>\n<li><code>toggleSpellChecker</code> - Enable/disable builtin spell checker.</li>\n<li><code>fileMenu</code> - Menu par défaut entier \"Fichier\" (Close / Quitter)</li>\n<li><code>editMenu</code> - Tout le menu \"Edit\" par défaut (Annuler, Copier, etc.).</li>\n<li><code>viewMenu</code> - Menu \"Affichage\" par défaut (Recharger, Activer/désactiver les outils de développement, etc.)</li>\n<li><code>windowMenu</code> - Menu par défaut entier \"Windows\" (Minimize, Zoom, etc.).</li>\n</ul>\n<p>The following additional roles are available on <em>macOS</em>:</p>\n<ul>\n<li><code>appMenu</code> - Tout le menu \"App\" par défaut (About, Services, etc.)</li>\n<li><code>hide</code> - Mappez à l'action <code>caché</code>.</li>\n<li><code>hideOthers</code> - Mappez à l'action <code>hideOtherApplications</code>.</li>\n<li><code>unhide</code> - Mappez à l'action <code>unhideAllApplications</code>.</li>\n<li><code>startSpeaking</code> - Carte à l'action <code>startSpeaking</code>.</li>\n<li><code>stopSpeaking</code> - Carte à l'action <code>stopSpeaking</code>.</li>\n<li><code>front</code> - Mappez à l'action <code>arrangeInFront</code>.</li>\n<li><code>zoom</code> - Mappez à l'action <code>performZoom</code>.</li>\n<li><code>toggleTabBar</code> - Mappez à l'action <code>toggleTabBar</code>.</li>\n<li><code>selectNextTab</code> - Mappez à l'action <code>selectNextTab</code>.</li>\n<li><code>selectPreviousTab</code> - Mappez à l'action <code>selectPreviousTab</code>.</li>\n<li><code>mergeAllWindows</code> - Mappez à l'action <code>mergeAllWindows</code>.</li>\n<li><code>moveTabToNewWindow</code> - Mappez à l'action <code>moveTabToNewWindow</code>.</li>\n<li><code>window</code> - Le sous-menu est un menu \"Windows\".</li>\n<li><code>help</code> - Le sous-menu est un menu \"Aide\".</li>\n<li><code>services</code> - Le sous-menu est un menu <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc\">\"Services\"</a>. This is only intended for use in the Application Menu and is <em>not</em> the same as the \"Services\" submenu used in context menus in macOS apps, which is not implemented in Electron.</li>\n<li><code>recentDocuments</code> - Le sous-menu est un menu \"Ouvrir Récents\".</li>\n<li><code>clearRecentDocuments</code> - Carte à l'action <code>clearRecentDocuments</code>.</li>\n<li><code>shareMenu</code> - The submenu is <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/\">share menu</a>. The <code>sharingItem</code> property must also be set to indicate the item to share.</li>\n</ul>\n<p>Lorsque vous spécifiez un <code>rôle</code> sur macOS, <code>label</code> et <code>accélérateur</code> sont les seules options qui affecteront l'élément de menu. Toutes les autres options seront ignorées. La minuscule <code>rôle</code>, par exemple <code>toggledevtools</code>, est toujours supportée.</p>\n<p><strong>Nota Bene:</strong> The <code>enabled</code> and <code>visibility</code> properties are not available for top-level menu items in the tray on macOS.</p>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<p>Les propriétés suivantes sont disponibles pour les instances de <code>MenuItem</code> :</p>\n<h4 id=\"menuitemid\"><a href=\"#menuitemid\"><code>menuItem.id</code></a></h4>\n<p>Une <code>String</code> indiquant l'identifiant unique de l'élément, cette propriété peut être modifiée dynamiquement.</p>\n<h4 id=\"menuitemlabel\"><a href=\"#menuitemlabel\"><code>menuItem.label</code></a></h4>\n<p>A <code>String</code> indicating the item's visible label.</p>\n<h4 id=\"menuitemclick\"><a href=\"#menuitemclick\"><code>menuItem.click</code></a></h4>\n<p>A <code>Function</code> that is fired when the MenuItem receives a click event. It can be called with <code>menuItem.click(event, focusedWindow, focusedWebContents)</code>.</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>focusedWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n<li><code>focusedWebContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<h4 id=\"menuitemsubmenu\"><a href=\"#menuitemsubmenu\"><code>menuItem.submenu</code></a></h4>\n<p>Un <code>Menu</code> (facultatif) contenant le sous-menu de l'élément de menu s'il est présent.</p>\n<h4 id=\"menuitemtype\"><a href=\"#menuitemtype\"><code>menuItem.type</code></a></h4>\n<p>A <code>String</code> indicating the type of the item. Can be <code>normal</code>, <code>separator</code>, <code>submenu</code>, <code>checkbox</code> or <code>radio</code>.</p>\n<h4 id=\"menuitemrole\"><a href=\"#menuitemrole\"><code>menuItem.role</code></a></h4>\n<p>Un <code>String</code> (facultatif) indiquant le rôle de l'élément, si défini. Can be <code>undo</code>, <code>redo</code>, <code>cut</code>, <code>copy</code>, <code>paste</code>, <code>pasteAndMatchStyle</code>, <code>delete</code>, <code>selectAll</code>, <code>reload</code>, <code>forceReload</code>, <code>toggleDevTools</code>, <code>resetZoom</code>, <code>zoomIn</code>, <code>zoomOut</code>, <code>toggleSpellChecker</code>, <code>togglefullscreen</code>, <code>window</code>, <code>minimize</code>, <code>close</code>, <code>help</code>, <code>about</code>, <code>services</code>, <code>hide</code>, <code>hideOthers</code>, <code>unhide</code>, <code>quit</code>, <code>startSpeaking</code>, <code>stopSpeaking</code>, <code>zoom</code>, <code>front</code>, <code>appMenu</code>, <code>fileMenu</code>, <code>editMenu</code>, <code>viewMenu</code>, <code>shareMenu</code>, <code>recentDocuments</code>, <code>toggleTabBar</code>, <code>selectNextTab</code>, <code>selectPreviousTab</code>, <code>mergeAllWindows</code>, <code>clearRecentDocuments</code>, <code>moveTabToNewWindow</code> or <code>windowMenu</code></p>\n<h4 id=\"menuitemaccelerator\"><a href=\"#menuitemaccelerator\"><code>menuItem.accelerator</code></a></h4>\n<p>An <code>Accelerator</code> (optional) indicating the item's accelerator, if set.</p>\n<h4 id=\"menuitemuseraccelerator-readonly-macos\"><a href=\"#menuitemuseraccelerator-readonly-macos\"><code>menuItem.userAccelerator</code> <em>Readonly</em> <em>macOS</em></a></h4>\n<p>An <code>Accelerator | null</code> indicating the item's <a href=\"https://developer.apple.com/documentation/appkit/nsmenuitem/1514850-userkeyequivalent?language=objc\">user-assigned accelerator</a> for the menu item.</p>\n<p><strong>Note:</strong> This property is only initialized after the <code>MenuItem</code> has been added to a <code>Menu</code>. Either via <code>Menu.buildFromTemplate</code> or via <code>Menu.append()/insert()</code>.  Accessing before initialization will just return <code>null</code>.</p>\n<h4 id=\"menuitemicon\"><a href=\"#menuitemicon\"><code>menuItem.icon</code></a></h4>\n<p>A <code>NativeImage | String</code> (facultatif) indiquant l'icône de l'élément , si défini.</p>\n<h4 id=\"menuitemsublabel\"><a href=\"#menuitemsublabel\"><code>menuItem.sublabel</code></a></h4>\n<p>A <code>String</code> indicating the item's sublabel.</p>\n<h4 id=\"menuitemtooltip-macos\"><a href=\"#menuitemtooltip-macos\"><code>menuItem.toolTip</code> <em>macOS</em></a></h4>\n<p>Une <code>Chaîne</code> indiquant le texte du survol de l'élément.</p>\n<h4 id=\"menuitemenabled\"><a href=\"#menuitemenabled\"><code>menuItem.enabled</code></a></h4>\n<p>Un <code>Booléen</code> indiquant si l'élément est activé, cette propriété peut être modifiée dynamiquement.</p>\n<h4 id=\"menuitemvisible\"><a href=\"#menuitemvisible\"><code>menuItem.visible</code></a></h4>\n<p>Un <code>Booléen</code> indiquant si l'élément est visible, cette propriété peut être modifiée dynamiquement.</p>\n<h4 id=\"menuitemchecked\"><a href=\"#menuitemchecked\"><code>menuItem.checked</code></a></h4>\n<p>Un <code>Booléen</code> indiquant si l'élément est vérifié, cette propriété peut être modifiée dynamiquement.</p>\n<p>Une <code>case à cocher</code> lien de menu activera et éteindra la propriété <code>cochée</code> lorsque sera sélectionné.</p>\n<p>Un lien de menu <code>radio</code> activera sa propriété <code>cochée</code> une fois cliqué, et désactivera cette propriété pour tous les éléments adjacents du même menu.</p>\n<p>Vous pouvez ajouter une fonction <code>clic</code> pour un comportement supplémentaire.</p>\n<h4 id=\"menuitemregisteraccelerator\"><a href=\"#menuitemregisteraccelerator\"><code>menuItem.registerAccelerator</code></a></h4>\n<p>A <code>Boolean</code> indicating if the accelerator should be registered with the system or just displayed.</p>\n<p>This property can be dynamically changed.</p>\n<h4 id=\"menuitemsharingitem-macos\"><a href=\"#menuitemsharingitem-macos\"><code>menuItem.sharingItem</code> <em>macOS</em></a></h4>\n<p>A <code>SharingItem</code> indicating the item to share when the <code>role</code> is <code>shareMenu</code>.</p>\n<p>This property can be dynamically changed.</p>\n<h4 id=\"menuitemcommandid\"><a href=\"#menuitemcommandid\"><code>menuItem.commandId</code></a></h4>\n<p>Un <code>Nombre</code> indiquant l'identifiant unique d'un élément.</p>\n<h4 id=\"menuitemmenu\"><a href=\"#menuitemmenu\"><code>menuItem.menu</code></a></h4>\n<p>Un <code>Menu</code> dont l'item fait partie.</p>",
      "title": "Classe : MenuItem",
      "description": "Ajoute des éléments aux menus et menus contextuels de l’application native."
    },
    "/docs/api/message-channel-main": {
      "locale": "fr-FR",
      "slug": "message-channel-main",
      "href": "/docs/api/message-channel-main",
      "crowdinFileId": "256337",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/message-channel-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messagechannelmain\"><a href=\"#messagechannelmain\">MessageChannelMain</a></h1>\n<p><code>MessagePortMain</code> est l’équivalent coté processus principal de <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\"><code>MessagePort</code></a> du DOM . Son unique fonction est de créer une paire d'objets <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> connectés .</p>\n<p>Pour plus d'informations sur son utilisation consultez la documentation de <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a>.</p>\n<h2 id=\"class-messagechannelmain\"><a href=\"#class-messagechannelmain\">Class: MessageChannelMain</a></h2>\n<blockquote>\n<p>Interface de canal pour la messagerie de canal dans le processus principal.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>Exemple :</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// processus principal</span>\n<span class=\"hljs-keyword\">const</span> { MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nw.webContents.postMessage(<span class=\"hljs-string\">'port'</span>, <span class=\"hljs-literal\">null</span>, [port2])\nport1.postMessage({ <span class=\"hljs-attr\">some</span>: <span class=\"hljs-string\">'message'</span> })\n\n<span class=\"hljs-comment\">// processus de rendu</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e) => {\n  <span class=\"hljs-comment\">// e.ports est une liste de ports envoyée conjointement avec ce message</span>\n  e.ports[<span class=\"hljs-number\">0</span>].on(<span class=\"hljs-string\">'message'</span>, (messageEvent) => {\n    <span class=\"hljs-built_in\">console</span>.log(messageEvent.data)\n  })\n})\n</code></pre>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<h4 id=\"channelport1\"><a href=\"#channelport1\"><code>channel.port1</code></a></h4>\n<p>Une propriété <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a>.</p>\n<h4 id=\"channelport2\"><a href=\"#channelport2\"><code>channel.port2</code></a></h4>\n<p>Une propriété <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a>.</p>",
      "title": "MessageChannelMain",
      "description": "Interface de canal pour la messagerie de canal dans le processus principal."
    },
    "/docs/api/message-port-main": {
      "locale": "fr-FR",
      "slug": "message-port-main",
      "href": "/docs/api/message-port-main",
      "crowdinFileId": "256339",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/message-port-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messageportmain\"><a href=\"#messageportmain\">MessagePortMain</a></h1>\n<p><code>MessagePortMain</code> est l’équivalent de <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> du DOM mais coté processus principal. Il se comporte de la même manière que la version DOM, sauf qu'il utilise le système d'événements de Node.js <code>EventEmitter</code> au lieu du système <code>EventTarget</code> du DOM. Cela signifie que vous devrez utiliser <code>port.on('message', ...)</code> pour écouter les événements, au lieu de <code>port. nmessage = ...</code> ou <code>port.addEventListener('message', ...)</code></p>\n<p>Pour plus d'informations sur son utilisation consultez la documentation de <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a>.</p>\n<p><code>MessagePortMain</code> est un [EventEmitter][event-emitter].</p>\n<h2 id=\"classe-messageportmain\"><a href=\"#classe-messageportmain\">Classe: MessagePortMain</a></h2>\n<blockquote>\n<p>Port interface for channel messaging in the main process.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<h4 id=\"portpostmessagemessage-transfer\"><a href=\"#portpostmessagemessage-transfer\"><code>port.postMessage(message, [transfer])</code></a></h4>\n<ul>\n<li><code>message</code> tous</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Envoie un message depuis le port, et le cas échéant, transfère la propriété d'objets à d’autres contextes de navigation.</p>\n<h4 id=\"portstart\"><a href=\"#portstart\"><code>port.start()</code></a></h4>\n<p>Démarre l'envoi de messages en file d'attente sur le port. Les messages seront mis en file d'attente jusqu'à ce que cette méthode soit appelée.</p>\n<h4 id=\"portclose\"><a href=\"#portclose\"><code>port.close()</code></a></h4>\n<p>Déconnecte le port qui ne sera donc plus actif.</p>\n<h3 id=\"événements-dinstance\"><a href=\"#événements-dinstance\">Événements d’instance</a></h3>\n<h4 id=\"événement--message\"><a href=\"#événement--message\">Événement : 'message'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li>Objet <code>messageEvent</code><ul>\n<li><code>data</code> {any}</li>\n<li><code>ports</code> MessagePortMain[]</li>\n</ul></li>\n</ul>\n<p>Émis lorsqu'un objet MessagePortMain reçoit un message.</p>\n<h4 id=\"événement--close\"><a href=\"#événement--close\">Événement : 'close'</a></h4>\n<p>Émis lorsque l’extrémité distante d’un objet MessagePortMain devient déconnectée.</p>",
      "title": "MessagePortMain",
      "description": "Port interface for channel messaging in the main process."
    },
    "/docs/tutorial/message-ports": {
      "locale": "fr-FR",
      "slug": "message-ports",
      "href": "/docs/tutorial/message-ports",
      "crowdinFileId": "256219",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/message-ports.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messageports-dans-electron\"><a href=\"#messageports-dans-electron\">MessagePorts dans Electron</a></h1>\n<p>Un <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a>s est une fonctionnalité web permettant l'échange de messages entre différents contextes. C'est un peu comme <code>window.postMessage</code>, mais sur différents canaux. The goal of this document is to describe how Electron extends the Channel Messaging model, and to give some examples of how you might use MessagePorts in your app.</p>\n<p>Voici un petit exemple de MessagePort et de son fonctionnement:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// rendererer.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-comment\">// Les MessagePorts sont créés par paires. On appelle canal une paire de MessagePort connectés .</span>\n<span class=\"hljs-keyword\">const</span> channel = <span class=\"hljs-keyword\">new</span> MessageChannel()\n\n<span class=\"hljs-comment\">// La seule différence entre port1 et port2 est dans la façon dont vous les utilisez. Les messages envoyés à port1 seront reçus par port2 et vice-versa.</span>\n<span class=\"hljs-keyword\">const</span> port1 = channel.port1\n<span class=\"hljs-keyword\">const</span> port2 = channel. ort2\n\n<span class=\"hljs-comment\">// Il est possible d'envoyer un message sur le canal avant que l'autre extrémité n'ait enregistré un écouteur. Les messages seront dans ce cas mis en file d'attente jusqu'à ce qu'un écouteur soit enregistré.</span>\nport2.postMessage({ <span class=\"hljs-attr\">answer</span>: <span class=\"hljs-number\">42</span> })\n\n<span class=\"hljs-comment\">// Ici nous envoyons l'autre extrémité du canal, port1, au processus principal. //Il est également possible d'envoyer des MessagePorts à d'autres frames, Web Workers, etc.</span>\nipcRenderer.postMessage(<span class=\"hljs-string\">'port'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-comment\">// Dans le processus principal, nous recevons le port.</span>\nipcMain.on(<span class=\"hljs-string\">'port'</span>, (event) => {\n  <span class=\"hljs-comment\">// Lorsque nous recevons un MessagePort dans le processus principal, il devient un</span>\n  <span class=\"hljs-comment\">// MessagePortMain.</span>\n  <span class=\"hljs-keyword\">const</span> port = event.ports[<span class=\"hljs-number\">0</span>]\n\n  <span class=\"hljs-comment\">// MessagePortMain utilise une API des événements du style Node.js plutôt que web. So .on('message', ...) instead of .onmessage = ...</span>\n  port.on(<span class=\"hljs-string\">'message'</span>, (event) => {\n    <span class=\"hljs-comment\">// data is { answer: 42 }</span>\n    <span class=\"hljs-keyword\">const</span> data = event.data\n  })\n\n  <span class=\"hljs-comment\">// MessagePortMain met les messages en attente jusqu'à ce que la méthode .start() soit invoquée.</span>\n  port.start()\n})\n</code></pre>\n<p>La documentation de <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> est un excellent moyen d'en apprendre plus sur le fonctionnement des MessagePorts.</p>\n<h2 id=\"les-messageports-dans-le-processus-principal\"><a href=\"#les-messageports-dans-le-processus-principal\">Les MessagePorts dans le processus principal</a></h2>\n<p>Dans le moteur de rendu, la classe <code>MessagePort</code> se comporte exactement comme pour le Web. Le processus principal n'étant pas pas une page web, il n'y a pas l'intégration de Blink — et donc pas de classe <code>MessagePort</code> ou <code>MessageChannel</code>. Afin de gérer et interagir à l'aide de MessagePorts avec le processus principal, Electron ajoute deux nouvelles classes : <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> et <a href=\"/docs/api/message-channel-main\"><code>MessageChannelMain</code></a>. Celles-ci se comportent comme les classes analogues dans le moteur de rendu.</p>\n<p>Les objets de type <code>MessagePort</code> peuvent être créés soit dans le moteur de rendu soit dans le processus principal, et passés dans les deux sens en utilisant les méthodes <a href=\"/docs/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer. ostMessage</code></a> et <a href=\"/docs/api/web-contents#contentspostmessagechannel-message-transfer\"><code>WebContents.postMessage</code></a> . Notez bien que les méthodes IPC usuelles telles que <code>send</code> et <code>invoke</code> ne peuvent pas être utilisées pour transférer des <code>MessagePort</code>, seules la méthode <code>postMessage</code> le peut pour transférer des <code>MessagePort</code>.</p>\n<p>En transmettant un <code>MessagePort</code>s via le processus principal, vous pouvez connecter deux pages qui sans cela n'auraient pas été en mesure de communiquer (par ex à cause de restrictions sur une même origine).</p>\n<h2 id=\"extension-close-event\"><a href=\"#extension-close-event\">Extension: <code>close</code> event</a></h2>\n<p>Electron ajoute une fonctionnalité à <code>MessagePort</code> non présente pour le web afin de rendre MessagePorts plus utile. Il s'agit de l'événement <code>close</code> , qui est émis lorsque l'autre extrémité du canal est fermée. Les ports peuvent également être implicitement fermés par une purge du garbage-collector.</p>\n<p>Dans le moteur de rendu, vous pouvez ajouter des écouteurs sur l'événement <code>close</code> soit par assignation avec <code>port.onclose</code> ou en invoquant la méthode <code>port.addEventListener('close', ...)</code>. Dans le processus , vous pouvez le faire appelant <code>port.on ('close',...)</code>.</p>\n<h2 id=\"exemple-de-cas-dutilisation\"><a href=\"#exemple-de-cas-dutilisation\">Exemple de cas d'utilisation</a></h2>\n<h3 id=\"worker-process\"><a href=\"#worker-process\">Worker process</a></h3>\n<p>In this example, your app has a worker process implemented as a hidden window. You want the app page to be able to communicate directly with the worker process, without the performance overhead of relaying via the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow, app, ipcMain, MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-comment\">// The worker process is a hidden BrowserWindow, so that it will have access</span>\n  <span class=\"hljs-comment\">// to a full Blink context (including e.g. &#x3C;canvas>, audio, fetch(), etc.)</span>\n  <span class=\"hljs-keyword\">const</span> worker = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span> }\n  })\n  <span class=\"hljs-keyword\">await</span> worker.loadFile(<span class=\"hljs-string\">'worker.html'</span>)\n\n  <span class=\"hljs-comment\">// The main window will send work to the worker process and receive results</span>\n  <span class=\"hljs-comment\">// over a MessagePort.</span>\n  <span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span> }\n  })\n  mainWindow.loadFile(<span class=\"hljs-string\">'app.html'</span>)\n\n  <span class=\"hljs-comment\">// We can't use ipcMain.handle() here, because the reply needs to transfer a</span>\n  <span class=\"hljs-comment\">// MessagePort.</span>\n  ipcMain.on(<span class=\"hljs-string\">'request-worker-channel'</span>, (event) => {\n    <span class=\"hljs-comment\">// For security reasons, let's make sure only the frames we expect can</span>\n    <span class=\"hljs-comment\">// access the worker.</span>\n    <span class=\"hljs-keyword\">if</span> (event.senderFrame === mainWindow.webContents.mainFrame) {\n      <span class=\"hljs-comment\">// Create a new channel ...</span>\n      <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\n      <span class=\"hljs-comment\">// ... send one end to the worker ...</span>\n      worker.webContents.postMessage(<span class=\"hljs-string\">'new-client'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n      <span class=\"hljs-comment\">// ... and the other end to the main window.</span>\n      event.senderFrame.postMessage(<span class=\"hljs-string\">'provide-worker-channel'</span>, <span class=\"hljs-literal\">null</span>, [port2])\n      <span class=\"hljs-comment\">// Now the main window and the worker can communicate with each other</span>\n      <span class=\"hljs-comment\">// without going through the main process!</span>\n    }\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- worker.html ------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">doWork</span>(<span class=\"hljs-params\">input</span>) </span>{\n  <span class=\"hljs-comment\">// Something cpu-intensive.</span>\n  <span class=\"hljs-keyword\">return</span> input * <span class=\"hljs-number\">2</span>\n}\n\n<span class=\"hljs-comment\">// We might get multiple clients, for instance if there are multiple windows,</span>\n<span class=\"hljs-comment\">// or if the main window reloads.</span>\nipcRenderer.on(<span class=\"hljs-string\">'new-client'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n  port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    <span class=\"hljs-comment\">// The event data can be any serializable object (and the event could even</span>\n    <span class=\"hljs-comment\">// carry other MessagePorts with it!)</span>\n    <span class=\"hljs-keyword\">const</span> result = doWork(event.data)\n    port.postMessage(result)\n  }\n})\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- app.html ---------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// We request that the main process sends us a channel we can use to</span>\n<span class=\"hljs-comment\">// communicate with the worker.</span>\nipcRenderer.send(<span class=\"hljs-string\">'request-worker-channel'</span>)\n\nipcRenderer.once(<span class=\"hljs-string\">'provide-worker-channel'</span>, (event) => {\n  <span class=\"hljs-comment\">// Once we receive the reply, we can take the port...</span>\n  <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n  <span class=\"hljs-comment\">// ... register a handler to receive results ...</span>\n  port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'received result:'</span>, event.data)\n  }\n  <span class=\"hljs-comment\">// ... and start sending it work!</span>\n  port.postMessage(<span class=\"hljs-number\">21</span>)\n})\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h3 id=\"reply-streams\"><a href=\"#reply-streams\">Reply streams</a></h3>\n<p>Electron's built-in IPC methods only support two modes: fire-and-forget (e.g. <code>send</code>), or request-response (e.g. <code>invoke</code>). Using MessageChannels, you can implement a \"response stream\", where a single request responds with a stream of data.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer.js ///////////////////////////////////////////////////////////////</span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">makeStreamingRequest</span> (<span class=\"hljs-params\">element, callback</span>) </span>{\n  <span class=\"hljs-comment\">// MessageChannels are lightweight--it's cheap to create a new one for each</span>\n  <span class=\"hljs-comment\">// request.</span>\n  <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannel()\n\n  <span class=\"hljs-comment\">// We send one end of the port to the main process ...</span>\n  ipcRenderer.postMessage(\n    <span class=\"hljs-string\">'give-me-a-stream'</span>,\n    { element, <span class=\"hljs-attr\">count</span>: <span class=\"hljs-number\">10</span> },\n    [port2]\n  )\n\n  <span class=\"hljs-comment\">// ... and we hang on to the other end. The main process will send messages</span>\n  <span class=\"hljs-comment\">// to its end of the port, and close it when it's finished.</span>\n  port1.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    callback(event.data)\n  }\n  port1.onclose = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'stream ended'</span>)\n  }\n}\n\nmakeStreamingRequest(<span class=\"hljs-number\">42</span>, (data) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'got response data:'</span>, event.data)\n})\n<span class=\"hljs-comment\">// We will see \"got response data: 42\" 10 times.</span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n\nipcMain.on(<span class=\"hljs-string\">'give-me-a-stream'</span>, (event, msg) => {\n  <span class=\"hljs-comment\">// The renderer has sent us a MessagePort that it wants us to send our</span>\n  <span class=\"hljs-comment\">// response over.</span>\n  <span class=\"hljs-keyword\">const</span> [replyPort] = event.ports\n\n  <span class=\"hljs-comment\">// Here we send the messages synchronously, but we could just as easily store</span>\n  <span class=\"hljs-comment\">// the port somewhere and send messages asynchronously.</span>\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">let</span> i = <span class=\"hljs-number\">0</span>; i &#x3C; msg.count; i++) {\n    replyPort.postMessage(msg.element)\n  }\n\n  <span class=\"hljs-comment\">// We close the port when we're done to indicate to the other end that we</span>\n  <span class=\"hljs-comment\">// won't be sending any more messages. This isn't strictly necessary--if we</span>\n  <span class=\"hljs-comment\">// didn't explicitly close the port, it would eventually be garbage</span>\n  <span class=\"hljs-comment\">// collected, which would also trigger the 'close' event in the renderer.</span>\n  replyPort.close()\n})\n</code></pre>\n<h3 id=\"communicating-directly-between-the-main-process-and-the-main-world-of-a-context-isolated-page\"><a href=\"#communicating-directly-between-the-main-process-and-the-main-world-of-a-context-isolated-page\">Communicating directly between the main process and the main world of a context-isolated page</a></h3>\n<p>When <a href=\"/docs/tutorial/context-isolation\">context isolation</a> is enabled, IPC messages from the main process to the renderer are delivered to the isolated world, rather than to the main world. Sometimes you want to deliver messages to the main world directly, without having to step through the isolated world.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow, app, MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-comment\">// Create a BrowserWindow with contextIsolation enabled.</span>\n  <span class=\"hljs-keyword\">const</span> bw = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">contextIsolation</span>: <span class=\"hljs-literal\">true</span>,\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n  bw.loadURL(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-comment\">// We'll be sending one end of this channel to the main world of the</span>\n  <span class=\"hljs-comment\">// context-isolated page.</span>\n  <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\n\n  <span class=\"hljs-comment\">// It's OK to send a message on the channel before the other end has</span>\n  <span class=\"hljs-comment\">// registered a listener. Messages will be queued until a listener is</span>\n  <span class=\"hljs-comment\">// registered.</span>\n  port2.postMessage({ <span class=\"hljs-attr\">test</span>: <span class=\"hljs-number\">21</span> })\n\n  <span class=\"hljs-comment\">// We can also receive messages from the main world of the renderer.</span>\n  port2.on(<span class=\"hljs-string\">'message'</span>, (event) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'from renderer main world:'</span>, event.data)\n  })\n  port2.start()\n\n  <span class=\"hljs-comment\">// The preload script will receive this IPC message and transfer the port</span>\n  <span class=\"hljs-comment\">// over to the main world.</span>\n  bw.webContents.postMessage(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// preload.js ////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// We need to wait until the main world is ready to receive the message before</span>\n<span class=\"hljs-comment\">// sending the port. We create this promise in the preload so it's guaranteed</span>\n<span class=\"hljs-comment\">// to register the onload listener before the load event is fired.</span>\n<span class=\"hljs-keyword\">const</span> windowLoaded = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> {\n  <span class=\"hljs-built_in\">window</span>.onload = resolve\n})\n\nipcRenderer.on(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-keyword\">async</span> (event) => {\n  <span class=\"hljs-keyword\">await</span> windowLoaded\n  <span class=\"hljs-comment\">// We use regular window.postMessage to transfer the port from the isolated</span>\n  <span class=\"hljs-comment\">// world to the main world.</span>\n  <span class=\"hljs-built_in\">window</span>.postMessage(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-string\">'*'</span>, event.ports)\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- index.html -------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-built_in\">window</span>.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n  <span class=\"hljs-comment\">// event.source === window means the message is coming from the preload</span>\n  <span class=\"hljs-comment\">// script, as opposed to from an &#x3C;iframe> or other source.</span>\n  <span class=\"hljs-keyword\">if</span> (event.source === <span class=\"hljs-built_in\">window</span> &#x26;&#x26; event.data === <span class=\"hljs-string\">'main-world-port'</span>) {\n    <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n    <span class=\"hljs-comment\">// Once we have the port, we can communicate directly with the main</span>\n    <span class=\"hljs-comment\">// process.</span>\n    port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'from main process:'</span>, event.data)\n      port.postMessage(event.data * <span class=\"hljs-number\">2</span>)\n    }\n  }\n}\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>",
      "title": "MessagePorts dans Electron",
      "description": ""
    },
    "/docs/api/structures/mime-typed-buffer": {
      "locale": "fr-FR",
      "slug": "mime-typed-buffer",
      "href": "/docs/api/structures/mime-typed-buffer",
      "crowdinFileId": "256463",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mime-typed-buffer.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mimetypedbuffer-object\"><a href=\"#mimetypedbuffer-object\">MimeTypedBuffer Object</a></h1>\n<ul>\n<li><code>mimeType</code> String (optional) - MIME type of the buffer.</li>\n<li><code>charset</code> String (optional) - Charset of the buffer.</li>\n<li><code>data</code> Buffer - The actual Buffer content.</li>\n</ul>",
      "title": "MimeTypedBuffer Object",
      "description": ""
    },
    "/docs/api/structures/mouse-input-event": {
      "locale": "fr-FR",
      "slug": "mouse-input-event",
      "href": "/docs/api/structures/mouse-input-event",
      "crowdinFileId": "256465",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mouse-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mouseinputevent-object-extends-inputevent\"><a href=\"#mouseinputevent-object-extends-inputevent\">MouseInputEvent Object extends <code>InputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>mouseDown</code>, <code>mouseUp</code>, <code>mouseEnter</code>, <code>mouseLeave</code>, <code>contextMenu</code>, <code>mouseWheel</code> or <code>mouseMove</code>.</li>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n<li><code>button</code> String (optional) - The button pressed, can be <code>left</code>, <code>middle</code>, <code>right</code>.</li>\n<li><code>globalX</code> Integer (optional)</li>\n<li><code>globalY</code> Integer (optional)</li>\n<li><code>movementX</code> Integer (optional)</li>\n<li><code>movementY</code> Integer (optional)</li>\n<li><code>clickCount</code> Integer (optional)</li>\n</ul>",
      "title": "MouseInputEvent Object extends InputEvent",
      "description": ""
    },
    "/docs/api/structures/mouse-wheel-input-event": {
      "locale": "fr-FR",
      "slug": "mouse-wheel-input-event",
      "href": "/docs/api/structures/mouse-wheel-input-event",
      "crowdinFileId": "256467",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mouse-wheel-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mousewheelinputevent-object-extends-mouseinputevent\"><a href=\"#mousewheelinputevent-object-extends-mouseinputevent\">MouseWheelInputEvent Object extends <code>MouseInputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>mouseWheel</code>.</li>\n<li><code>deltaX</code> Integer (optional)</li>\n<li><code>deltaY</code> Integer (optional)</li>\n<li><code>wheelTicksX</code> Integer (optional)</li>\n<li><code>wheelTicksY</code> Integer (optional)</li>\n<li><code>accelerationRatioX</code> Integer (optional)</li>\n<li><code>accelerationRatioY</code> Integer (optional)</li>\n<li><code>hasPreciseScrollingDeltas</code> Boolean (optional)</li>\n<li><code>canScroll</code> Boolean (optional)</li>\n</ul>",
      "title": "MouseWheelInputEvent Object extends MouseInputEvent",
      "description": ""
    },
    "/docs/tutorial/multithreading": {
      "locale": "fr-FR",
      "slug": "multithreading",
      "href": "/docs/tutorial/multithreading",
      "crowdinFileId": "256221",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/multithreading.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"multithreading\"><a href=\"#multithreading\">Multithreading</a></h1>\n<p>Avec <a href=\"https://developer.mozilla.org/en/docs/Web/API/Web_Workers_API/Using_web_workers\">Web Workers</a>, il est possible d'exécuter du code JavaScript au niveau du système d'exploitation.</p>\n<h2 id=\"multi-threaded-nodejs\"><a href=\"#multi-threaded-nodejs\">Multi-threaded Node.js</a></h2>\n<p>Il est possible d’utiliser des fonctionnalités de Node.js dans les Web Workers d'Electron, pour ce faire, l’option <code>nodeIntegrationInWorker</code> doit être définie à <code>true</code> dans <code>webPreferences</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegrationInWorker</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<p>Le <code>nodeIntegrationInWorker</code> peut être utilisé indépendamment de <code>nodeIntegration</code>, mais le <code>sandbox</code> ne doit pas être défini sur <code>true</code>.</p>\n<h2 id=\"api-disponibles\"><a href=\"#api-disponibles\">API disponibles</a></h2>\n<p>Tous les modules intégrés de Node.js sont pris en charge dans les Web Workers, et les archives <code>asar</code> peuvent encore être lues avec les API de Node.js. Toutefois, aucun des modules intégrés d'Electron peut être utilisé dans un environnement multithread.</p>\n<h2 id=\"modules-natifs-de-nodejs\"><a href=\"#modules-natifs-de-nodejs\">Modules natifs de Node.js</a></h2>\n<p>N’importe quel module de Node.js natif peut être chargé directement dans les Web Workers, mais il est fortement recommandé de ne pas le faire. La plupart des modules natifs existants ont été écrits en supposant un environnement mono-thread, leur utilisation dans les Web Workers peut entrainer des crash et corruptions de mémoire.</p>\n<p>Notez que même si un module natif de Node.js est thread-safe, il n’est toujours pas sûr de le charger dans un Web Worker car la fonction <code>process.dlopen</code> n’est pas thread-safe.</p>\n<p>La seule façon de charger un module natif en toute sécurité pour l’instant, est de s’assurer que l’application ne charge aucun module natif après que les Web Workers aient démarré.</p>\n<pre><code class=\"hljs language-javascript\">process.dlopen = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Load native module is not safe'</span>)\n}\n<span class=\"hljs-keyword\">const</span> worker = <span class=\"hljs-keyword\">new</span> Worker(<span class=\"hljs-string\">'script.js'</span>)\n</code></pre>",
      "title": "Multithreading",
      "description": ""
    },
    "/docs/tutorial/native-file-drag-drop": {
      "locale": "fr-FR",
      "slug": "native-file-drag-drop",
      "href": "/docs/tutorial/native-file-drag-drop",
      "crowdinFileId": "256223",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/native-file-drag-drop.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"fichier-natif-drag--drop\"><a href=\"#fichier-natif-drag--drop\">Fichier natif Drag &#x26; Drop</a></h1>\n<h2 id=\"vue-densemble\"><a href=\"#vue-densemble\">Vue d'ensemble</a></h2>\n<p>Certains types d'applications manipulant des fichiers peuvent prendre en charge la fonction de glisser-déplacer native du système d'exploitation. Le déplacement de fichiers dans le contenu Web est courant et est supporté par de nombreux sites Web. Electron prend également en charge le déplacement des fichiers et du contenu du contenu Web vers le monde du système d'exploitation.</p>\n<p>Pour implémenter cette fonctionnalité dans votre application, vous devez appeler l'API <a href=\"/docs/api/web-contents#contentsstartdragitem\"><code>webContents.startDrag(item)</code></a> dans la réponse à l'événement <code>ondragstart</code>.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<p>An example demonstrating how you can create a file on the fly to be dragged out of the window.</p>\n<h3 id=\"preloadjs\"><a href=\"#preloadjs\">Preload.js</a></h3>\n<p>In <code>preload.js</code> use the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> to inject a method <code>window.electron.startDrag(...)</code> that will send an IPC message to the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'electron'</span>, {\n  <span class=\"hljs-attr\">startDrag</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">fileName</span>) =></span> {\n    ipcRenderer.send(<span class=\"hljs-string\">'ondragstart'</span>, path.join(process.cwd(), fileName))\n  }\n})\n</code></pre>\n<h3 id=\"indexhtml\"><a href=\"#indexhtml\">Index.html</a></h3>\n<p>Add a draggable element to <code>index.html</code>, and reference your renderer script:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">div</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"border:2px solid black;border-radius:3px;padding:5px;display:inline-block\"</span> <span class=\"hljs-attr\">draggable</span>=<span class=\"hljs-string\">\"true\"</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"drag\"</span>></span>Drag me<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">div</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h3 id=\"rendererjs\"><a href=\"#rendererjs\">Renderer.js</a></h3>\n<p>In <code>renderer.js</code> set up the renderer process to handle drag events by calling the method you added via the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> above.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'drag'</span>).ondragstart = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n  event.preventDefault()\n  <span class=\"hljs-built_in\">window</span>.electron.startDrag(<span class=\"hljs-string\">'drag-and-drop.md'</span>)\n}\n</code></pre>\n<h3 id=\"mainjs\"><a href=\"#mainjs\">Main.js</a></h3>\n<p>In the Main process (<code>main.js</code> file), expand the received event with a path to the file that is being dragged and an icon:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/drag-and-drop\"><span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nipcMain.on(<span class=\"hljs-string\">'ondragstart'</span>, (event, filePath) => {\n  event.sender.startDrag({\n    <span class=\"hljs-attr\">file</span>: filePath,\n    <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'/path/to/icon.png'</span>\n  })\n})\n</code></pre>\n<p>After launching the Electron application, try dragging and dropping the item from the BrowserWindow onto your desktop. Dans ce guide, l'élément est un fichier Markdown situé à la racine du projet :</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/drag-and-drop.gif\" alt=\"Drag and drop\"></p>",
      "title": "Fichier natif Drag & Drop",
      "description": ""
    },
    "/docs/api/native-image": {
      "locale": "fr-FR",
      "slug": "native-image",
      "href": "/docs/api/native-image",
      "crowdinFileId": "256341",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/native-image.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nativeimage\"><a href=\"#nativeimage\">nativeImage</a></h1>\n<blockquote>\n<p>Créez des icônes de bac, d'ancrage et d'application à l'aide de fichiers PNG ou JPG.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>Dans Electron, pour les API d'acquisition d'images, vous pouvez passer des chemins de fichiers ou des instances de tyipe <code>NativeImage</code>. Une image vide sera utilisée lorsque <code>null</code> sera transmise.</p>\n<p>For example, when creating a tray or setting a window's icon, you can pass an image file path as a <code>String</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'/Users/somebody/images/window.png'</span> })\n<span class=\"hljs-built_in\">console</span>.log(appIcon, win)\n</code></pre>\n<p>Or read the image from the clipboard, which returns a <code>NativeImage</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { clipboard, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> image = clipboard.readImage()\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(image)\n<span class=\"hljs-built_in\">console</span>.log(appIcon)\n</code></pre>\n<h2 id=\"formats-supportés\"><a href=\"#formats-supportés\">Formats supportés</a></h2>\n<p>Actuellement, les formats d'image <code>PNG</code> et <code>JPEG</code> sont pris en charge. <code>PNG</code> est recommandé en raison de son support de la transparence et de la compression sans perte.</p>\n<p>Sous Windows, vous pouvez également charger les icônes <code>ICO</code> à partir de chemins de fichier. Pour une meilleure qualité visuelle , il est recommandé d'inclure au moins les tailles suivantes dans les :</p>\n<ul>\n<li>Petite icône<ul>\n<li>16x16 (100% DPI scale)</li>\n<li>20x20 (125% DPI scale)</li>\n<li>24x24 (150% DPI scale)</li>\n<li>32x32 (200% DPI scale)</li>\n</ul></li>\n<li>Grande icône<ul>\n<li>32x32 (100% DPI scale)</li>\n<li>40x40 (125% DPI scale)</li>\n<li>48x48 (150% DPI scale)</li>\n<li>64x64 (200% DPI scale)</li>\n<li>256x256</li>\n</ul></li>\n</ul>\n<p>Consultez la section <em>Taille requise</em> dans <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dn742485(v=vs.85).aspx\">cet article</a>.</p>\n<h2 id=\"images-à-haute-résolution\"><a href=\"#images-à-haute-résolution\">Images à haute résolution</a></h2>\n<p>On platforms that have high-DPI support such as Apple Retina displays, you can append <code>@2x</code> after image's base filename to mark it as a high resolution image.</p>\n<p>For example, if <code>icon.png</code> is a normal image that has standard resolution, then <code>icon@2x.png</code> will be treated as a high resolution image that has double DPI density.</p>\n<p>Si vous voulez prendre en charge simultanément les écrans avec des densités DPI différentes, vous pouvez mettre des images de tailles différentes dans le même dossier et utiliser le nom de fichier sans le suffixe des DPI. Par exemple :</p>\n<pre><code class=\"hljs language-plaintext\">images/\n├── icon.png\n├── icon@2x.png\n└── icon@3x.png\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-built_in\">console</span>.log(appIcon)\n</code></pre>\n<p>Les suffixes suivants pour le DPI sont également pris en charge :</p>\n<ul>\n<li><code>@1x</code></li>\n<li><code>@1.25x</code></li>\n<li><code>@1.33x</code></li>\n<li><code>@1.4x</code></li>\n<li><code>@1.5x</code></li>\n<li><code>@1.8x</code></li>\n<li><code>@2x</code></li>\n<li><code>@2.5x</code></li>\n<li><code>@3x</code></li>\n<li><code>@4x</code></li>\n<li><code>@5x</code></li>\n</ul>\n<h2 id=\"template-image\"><a href=\"#template-image\">Template Image</a></h2>\n<p>Les templates d'image sont constituées de noir et d'un canal alpha. Elles ne sont pas destinées à être utilisées comme des images autonomes mais sont généralement mélangées avec d'autres contenus pour créer l'apparence finale désirée.</p>\n<p>The most common case is to use template images for a menu bar icon, so it can adapt to both light and dark menu bars.</p>\n<p><strong>Remarque :</strong> Les template d'image ne sont pas prise en charge que sur macOS.</p>\n<p>To mark an image as a template image, its filename should end with the word <code>Template</code>. Par exemple :</p>\n<ul>\n<li><code>xxxTemplate.png</code></li>\n<li><code>xxxTemplate@2x.png</code></li>\n</ul>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>The <code>nativeImage</code> module has the following methods, all of which return an instance of the <code>NativeImage</code> class:</p>\n<h3 id=\"nativeimagecreateempty\"><a href=\"#nativeimagecreateempty\"><code>nativeImage.createEmpty()</code></a></h3>\n<p>Retourne <code>NativeImage</code></p>\n<p>Crée une instance <code>NativeImage</code> vide.</p>\n<h3 id=\"nativeimagecreatethumbnailfrompathpath-maxsize-macos-windows\"><a href=\"#nativeimagecreatethumbnailfrompathpath-maxsize-macos-windows\"><code>nativeImage.createThumbnailFromPath(path, maxSize)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>path</code> String - path to a file that we intend to construct a thumbnail out of.</li>\n<li><code>maxSize</code> <a href=\"/docs/api/structures/size\">Size</a> - the maximum width and height (positive numbers) the thumbnail returned can be. The Windows implementation will ignore <code>maxSize.height</code> and scale the height according to <code>maxSize.width</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - fulfilled with the file's thumbnail preview image, which is a <a href=\"/docs/api/native-image\">NativeImage</a>.</p>\n<h3 id=\"nativeimagecreatefrompathpath\"><a href=\"#nativeimagecreatefrompathpath\"><code>nativeImage.createFromPath(path)</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Retourne <code>NativeImage</code></p>\n<p>Creates a new <code>NativeImage</code> instance from a file located at <code>path</code>. This method returns an empty image if the <code>path</code> does not exist, cannot be read, or is not a valid image.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> nativeImage = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).nativeImage\n\n<span class=\"hljs-keyword\">const</span> image = nativeImage.createFromPath(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-built_in\">console</span>.log(image)\n</code></pre>\n<h3 id=\"nativeimagecreatefrombitmapbuffer-options\"><a href=\"#nativeimagecreatefrombitmapbuffer-options\"><code>nativeImage.createFromBitmap(buffer, options)</code></a></h3>\n<ul>\n<li><code>buffer</code> <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a></li>\n<li>Objet <code>options</code><ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>scaleFactor</code> Double (facultatif) - 1.0 par défaut.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>NativeImage</code></p>\n<p>Creates a new <code>NativeImage</code> instance from <code>buffer</code> that contains the raw bitmap pixel data returned by <code>toBitmap()</code>. The specific format is platform-dependent.</p>\n<h3 id=\"nativeimagecreatefrombufferbuffer-options\"><a href=\"#nativeimagecreatefrombufferbuffer-options\"><code>nativeImage.createFromBuffer(buffer[, options])</code></a></h3>\n<ul>\n<li><code>buffer</code> <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a></li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>width</code> Integer (optional) - Required for bitmap buffers.</li>\n<li><code>height</code> Integer (optional) - Required for bitmap buffers.</li>\n<li><code>scaleFactor</code> Double (facultatif) - 1.0 par défaut.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>NativeImage</code></p>\n<p>Crée une nouvelle instance <code>NativeImage</code> à partir de <code>buffer</code>. Tries to decode as PNG or JPEG first.</p>\n<h3 id=\"nativeimagecreatefromdataurldataurl\"><a href=\"#nativeimagecreatefromdataurldataurl\"><code>nativeImage.createFromDataURL(dataURL)</code></a></h3>\n<ul>\n<li><code>dataURL</code> String</li>\n</ul>\n<p>Retourne <code>NativeImage</code></p>\n<p>Crée une nouvelle instance <code>NativeImage</code> à partir de <code>dataURL</code>.</p>\n<h3 id=\"nativeimagecreatefromnamedimageimagename-hslshift-macos\"><a href=\"#nativeimagecreatefromnamedimageimagename-hslshift-macos\"><code>nativeImage.createFromNamedImage(imageName[, hslShift])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>imageName</code> String</li>\n<li><code>hslShift</code> Number<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Retourne <code>NativeImage</code></p>\n<p>Creates a new <code>NativeImage</code> instance from the NSImage that maps to the given image name. See <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/system-icons/\"><code>System Icons</code></a> for a list of possible values.</p>\n<p>The <code>hslShift</code> is applied to the image with the following rules:</p>\n<ul>\n<li><code>hsl_shift[0]</code> (hue): The absolute hue value for the image - 0 and 1 map to 0 and 360 on the hue color wheel (red).</li>\n<li><code>hsl_shift[1]</code> (saturation): A saturation shift for the image, with the following key values: 0 = remove all color. 0.5 = leave unchanged. 1 = fully saturate the image.</li>\n<li><code>hsl_shift[2]</code> (lightness): A lightness shift for the image, with the following key values: 0 = remove all lightness (make all pixels black). 0.5 = leave unchanged. 1 = full lightness (make all pixels white).</li>\n</ul>\n<p>This means that <code>[-1, 0, 1]</code> will make the image completely white and <code>[-1, 1, 0]</code> will make the image completely black.</p>\n<p>In some cases, the <code>NSImageName</code> doesn't match its string representation; one example of this is <code>NSFolderImageName</code>, whose string representation would actually be <code>NSFolder</code>. Par conséquent, vous devrez déterminer la bonne représentation de votre image avant de la passer. Cela peut être fait avec les éléments suivants :</p>\n<p><code>echo -e '#import &#x3C;Cocoa/Cocoa.h>\\nint main() { NSLog(@\"%@\", SYSTEM_IMAGE_NAME); }' | clang -otest -x objective-c -framework Cocoa - &#x26;&#x26; ./test</code></p>\n<p>where <code>SYSTEM_IMAGE_NAME</code> should be replaced with any value from <a href=\"https://developer.apple.com/documentation/appkit/nsimagename?language=objc\">this list</a>.</p>\n<h2 id=\"classe--nativeimage\"><a href=\"#classe--nativeimage\">Classe : NativeImage</a></h2>\n<blockquote>\n<p>Natively wrap images such as tray, dock, and application icons.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<p>The following methods are available on instances of the <code>NativeImage</code> class:</p>\n<h4 id=\"imagetopngoptions\"><a href=\"#imagetopngoptions\"><code>image.toPNG([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>scaleFactor</code> Double (facultatif) - 1.0 par défaut.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Buffer</code> - Un <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">tampon</a> qui contient les données encodées <code>PNG</code> de l'image.</p>\n<h4 id=\"imagetojpegquality\"><a href=\"#imagetojpegquality\"><code>image.toJPEG(quality)</code></a></h4>\n<ul>\n<li><code>qualité</code> Entier - Entre 0 - 100.</li>\n</ul>\n<p>Retourne <code>Buffer</code> - Un <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">tampon</a> qui contient les données encodées en <code>JPEG</code> de l'image.</p>\n<h4 id=\"imagetobitmapoptions\"><a href=\"#imagetobitmapoptions\"><code>image.toBitmap([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>scaleFactor</code> Double (facultatif) - 1.0 par défaut.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Buffer</code> - Un <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">tampon</a> qui contient une copie des données du pixel brut bitmap de l'image.</p>\n<h4 id=\"imagetodataurloptions\"><a href=\"#imagetodataurloptions\"><code>image.toDataURL([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>scaleFactor</code> Double (facultatif) - 1.0 par défaut.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>String</code> - L'URL des données de l'image.</p>\n<h4 id=\"imagegetbitmapoptions\"><a href=\"#imagegetbitmapoptions\"><code>image.getBitmap([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>scaleFactor</code> Double (facultatif) - 1.0 par défaut.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Buffer</code> - Un <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">tampon</a> qui contient les données brutes des pixels bitmap de l'image.</p>\n<p>The difference between <code>getBitmap()</code> and <code>toBitmap()</code> is that <code>getBitmap()</code> does not copy the bitmap data, so you have to use the returned Buffer immediately in current event loop tick; otherwise the data might be changed or destroyed.</p>\n<h4 id=\"imagegetnativehandle-macos\"><a href=\"#imagegetnativehandle-macos\"><code>image.getNativeHandle()</code> <em>macOS</em></a></h4>\n<p>Retourne <code>Buffer</code> - Un <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">tampon</a> qui stocke le pointeur C sur la gestion native sous-jacente de l'image . Sur macOS, un pointeur vers <code>NSImage</code> serait retourné.</p>\n<p>Note que le pointeur retourné est un pointeur faible vers l'image native sous-jacente au lieu d'une copie, donc vous <em>devez</em> vous assurer que l'instance associée <code>nativeImage</code> est conservée.</p>\n<h4 id=\"imageisempty\"><a href=\"#imageisempty\"><code>image.isEmpty()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si l'image est vide.</p>\n<h4 id=\"imagegetsizescalefactor\"><a href=\"#imagegetsizescalefactor\"><code>image.getSize([scaleFactor])</code></a></h4>\n<ul>\n<li><code>scaleFactor</code> Double (facultatif) - 1.0 par défaut.</li>\n</ul>\n<p>Retourne <a href=\"/docs/api/structures/size\"><code>Size</code></a>.</p>\n<p>If <code>scaleFactor</code> is passed, this will return the size corresponding to the image representation most closely matching the passed value.</p>\n<h4 id=\"imagesettemplateimageoption\"><a href=\"#imagesettemplateimageoption\"><code>image.setTemplateImage(option)</code></a></h4>\n<ul>\n<li><code>option</code> Boolean</li>\n</ul>\n<p>Marque l'image comme une image de modèle.</p>\n<h4 id=\"imageistemplateimage\"><a href=\"#imageistemplateimage\"><code>image.isTemplateImage()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si l'image est une image de modèle.</p>\n<h4 id=\"imagecroprect\"><a href=\"#imagecroprect\"><code>image.crop(rect)</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - L'aire de l'image à recadrer.</li>\n</ul>\n<p>Retourne <code>NativeImage</code> - L'image recadrée.</p>\n<h4 id=\"imageresizeoptions\"><a href=\"#imageresizeoptions\"><code>image.resize(options)</code></a></h4>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>width</code> Integer (optional) - Defaults to the image's width.</li>\n<li><code>height</code> Integer (facultatif) - La hauteur de l'image par défaut.</li>\n<li><code>Qualité</code> String (facultatif) - La qualité souhaitée de l'image de retaille. Les valeurs possibles sont <code>good</code>, <code>better</code>, ou <code>best</code>. La valeur par défaut est <code>meilleur</code>. Ces valeurs expriment un compromis qualité/vitesse souhaité. They are translated into an algorithm-specific method that depends on the capabilities (CPU, GPU) of the underlying platform. It is possible for all three methods to be mapped to the same algorithm on a given platform.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>NativeImage</code> - L'image redimensionnée.</p>\n<p>Si seulement la <code>hauteur</code> ou la <code>largeur</code> sont spécifiées, alors le ratio d'aspect actuel sera préservé dans l'image redimensionnée.</p>\n<h4 id=\"imagegetaspectratioscalefactor\"><a href=\"#imagegetaspectratioscalefactor\"><code>image.getAspectRatio([scaleFactor])</code></a></h4>\n<ul>\n<li><code>scaleFactor</code> Double (facultatif) - 1.0 par défaut.</li>\n</ul>\n<p>Retourne <code>Float</code> - Le ratio d'aspect de l'image.</p>\n<p>If <code>scaleFactor</code> is passed, this will return the aspect ratio corresponding to the image representation most closely matching the passed value.</p>\n<h4 id=\"imagegetscalefactors\"><a href=\"#imagegetscalefactors\"><code>image.getScaleFactors()</code></a></h4>\n<p>Returns <code>Float[]</code> - An array of all scale factors corresponding to representations for a given nativeImage.</p>\n<h4 id=\"imageaddrepresentationoptions\"><a href=\"#imageaddrepresentationoptions\"><code>image.addRepresentation(options)</code></a></h4>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>scaleFactor</code> Double - The scale factor to add the image representation for.</li>\n<li><code>largeur</code> Integer (facultatif) - 0 par défaut. Required if a bitmap buffer is specified as <code>buffer</code>.</li>\n<li><code>height</code> Integer (facultatif) - 0 par défaut. Required if a bitmap buffer is specified as <code>buffer</code>.</li>\n<li><code>tampon</code> Buffer (facultatif) - Le tampon contenant les données de l'image brute.</li>\n<li><code>dataURL</code> String (optional) - The data URL containing either a base 64 encoded PNG or JPEG image.</li>\n</ul></li>\n</ul>\n<p>Add an image representation for a specific scale factor. This can be used to explicitly add different scale factor representations to an image. This can be called on empty images.</p>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<h4 id=\"nativeimageismactemplateimage-macos\"><a href=\"#nativeimageismactemplateimage-macos\"><code>nativeImage.isMacTemplateImage</code> <em>macOS</em></a></h4>\n<p>Une propriété <code>Boolean</code> qui détermine si l'image est considérée comme une <a href=\"https://developer.apple.com/documentation/appkit/nsimage/1520017-template\">image de modèle</a>.</p>\n<p>Veuillez noter que cette propriété n'a qu'un effet sur macOS.</p>",
      "title": "nativeImage",
      "description": "Créez des icônes de bac, d'ancrage et d'application à l'aide de fichiers PNG ou JPG."
    },
    "/docs/api/native-theme": {
      "locale": "fr-FR",
      "slug": "native-theme",
      "href": "/docs/api/native-theme",
      "crowdinFileId": "256343",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/native-theme.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nativetheme\"><a href=\"#nativetheme\">nativeTheme</a></h1>\n<blockquote>\n<p>Consulte et réagit aux changements du thème de couleur natif de Chromium.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h2 id=\"événements\"><a href=\"#événements\">Événements</a></h2>\n<p>Le module <code>nativeTheme</code> déclenche les événements suivants :</p>\n<h3 id=\"événement-updated\"><a href=\"#événement-updated\">Événement 'updated'</a></h3>\n<p>Émis lorsque quelque chose dans le NativeTheme sous-jacent a changé. This normally means that either the value of <code>shouldUseDarkColors</code>, <code>shouldUseHighContrastColors</code> or <code>shouldUseInvertedColorScheme</code> has changed. You will have to check them to determine which one has changed.</p>\n<h2 id=\"propriétés\"><a href=\"#propriétés\">Propriétés</a></h2>\n<p>Le module <code>nativeTheme</code> dispose des propriétés suivantes :</p>\n<h3 id=\"nativethemeshouldusedarkcolors-lecture-seule\"><a href=\"#nativethemeshouldusedarkcolors-lecture-seule\"><code>nativeTheme.shouldUseDarkColors</code> <em>Lecture seule</em></a></h3>\n<p>A <code>Boolean</code> for if the OS / Chromium currently has a dark mode enabled or is being instructed to show a dark-style UI.  If you want to modify this value you should use <code>themeSource</code> below.</p>\n<h3 id=\"nativethemethemesource\"><a href=\"#nativethemethemesource\"><code>nativeTheme.themeSource</code></a></h3>\n<p>Une propriété <code>String</code> qui peut être <code>system</code>, <code>light</code> ou <code>dark</code>.  It is used to override and supersede the value that Chromium has chosen to use internally.</p>\n<p>Setting this property to <code>system</code> will remove the override and everything will be reset to the OS default.  By default <code>themeSource</code> is <code>system</code>.</p>\n<p>Settings this property to <code>dark</code> will have the following effects:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code> will be <code>true</code> when accessed</li>\n<li>Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the dark UI.</li>\n<li>Any UI the OS renders on macOS including menus, window frames, etc. will use the dark UI.</li>\n<li>The <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> CSS query will match <code>dark</code> mode.</li>\n<li>The <code>updated</code> event will be emitted</li>\n</ul>\n<p>Settings this property to <code>light</code> will have the following effects:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code> will be <code>false</code> when accessed</li>\n<li>Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the light UI.</li>\n<li>Any UI the OS renders on macOS including menus, window frames, etc. will use the light UI.</li>\n<li>The <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> CSS query will match <code>light</code> mode.</li>\n<li>The <code>updated</code> event will be emitted</li>\n</ul>\n<p>L'utilisation de cette propriété devrait s'accorder avec le \"mode sombre\" classique du système dans votre application où l'utilisateur a trois options.</p>\n<ul>\n<li><code>Suivant OS</code> --> <code>themeSource = 'system'</code></li>\n<li><code>Mode sombre</code> --> <code>themeSource = 'dark'</code></li>\n<li><code>Mode clair</code> --> <code>themeSource = 'light'</code></li>\n</ul>\n<p>Votre application devrait alors toujours utiliser <code>shouldUseDarkColors</code> pour déterminer quel CSS appliquer.</p>\n<h3 id=\"nativethemeshouldusehighcontrastcolors-macos-windows-lecture-seule\"><a href=\"#nativethemeshouldusehighcontrastcolors-macos-windows-lecture-seule\"><code>nativeTheme.shouldUseHighContrastColors</code> <em>macOS</em> <em>Windows</em> <em>Lecture seule</em></a></h3>\n<p>Un <code>booléen</code> pour déterminer si le système d'exploitation / Chromium a actuellement un mode de couleurs à contraste élevé activé ou est applique une interface à contraste élevé.</p>\n<h3 id=\"nativethemeshoulduseinvertedcolorscheme-macos-windows-lecture-seule\"><a href=\"#nativethemeshoulduseinvertedcolorscheme-macos-windows-lecture-seule\"><code>nativeTheme.shouldUseInvertedColorScheme</code> <em>macOS</em> <em>Windows</em> <em>Lecture seule</em></a></h3>\n<p>Un <code>booléen</code> pour déterminer si le système d'exploitation / Chromium a actuellement un mode de couleurs inversé ou commence à utiliser un modèle de couleurs inversé.</p>",
      "title": "nativeTheme",
      "description": "Consulte et réagit aux changements du thème de couleur natif de Chromium."
    },
    "/docs/api/net": {
      "locale": "fr-FR",
      "slug": "net",
      "href": "/docs/api/net",
      "crowdinFileId": "256347",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/net.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"net\"><a href=\"#net\">net</a></h1>\n<blockquote>\n<p>Émet des requêtes HTTP/HTTPS à l'aide de la bibliothèque réseau natif de Chromium</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>Le module <code>net</code> est une API côté client pour émettre des requêtes HTTP(S). Il est semblable aux modules <a href=\"https://nodejs.org/api/http.html\">HTTP</a> et <a href=\"https://nodejs.org/api/https.html\">HTTPS</a> de Node.js, mais utilise la bibliothèque réseau natif de Chromium au lieu de l'implémentation de Node.js, offrant un meilleur support pour les proxy web. It also supports checking network status.</p>\n<p>Voici une liste non exhaustive de pourquoi vous devriez utiliser le module <code>net</code> plutôt que les modules natifs de Node.js :</p>\n<ul>\n<li>Gestion automatique de la configuration de proxy système, support du protocole wpad et les fichiers de configuration de proxy pac.</li>\n<li>Tunnel automatique des requêtes HTTPS.</li>\n<li>Prise en charge de l'authentification proxy en utilisant basic, digest, NTLM, Kerberos ou en négociant des schémas d'authentification.</li>\n<li>Prise en charge des proxy de surveillance du trafic: Proxy de type Fiddler utilisés pour le contrôle et la surveillance des accès.</li>\n</ul>\n<p>Les composants de l'API (y compris les classes, méthodes, propriétés et noms d'événements) sont similaires à ceux utilisés dans Node.js.</p>\n<p>Exemple d'utilisation :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> { net } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n  <span class=\"hljs-keyword\">const</span> request = net.request(<span class=\"hljs-string\">'https://github.com'</span>)\n  request.on(<span class=\"hljs-string\">'response'</span>, (response) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`STATUS: <span class=\"hljs-subst\">${response.statusCode}</span>`</span>)\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`HEADERS: <span class=\"hljs-subst\">${<span class=\"hljs-built_in\">JSON</span>.stringify(response.headers)}</span>`</span>)\n    response.on(<span class=\"hljs-string\">'data'</span>, (chunk) => {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`BODY: <span class=\"hljs-subst\">${chunk}</span>`</span>)\n    })\n    response.on(<span class=\"hljs-string\">'end'</span>, () => {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'No more data in response.'</span>)\n    })\n  })\n  request.end()\n})\n</code></pre>\n<p>L'API <code>net</code> ne peut être utilisée qu'après que l'application ait émit un événement <code>ready</code>. Trying to use the module before the <code>ready</code> event will throw an error.</p>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module <code>net</code> dispose des méthodes suivantes :</p>\n<h3 id=\"netrequestoptions\"><a href=\"#netrequestoptions\"><code>net.request(options)</code></a></h3>\n<ul>\n<li><code>options</code> (ClientRequestConstructorOptions | String) - Les `options du constructeur.</li></ul>\n\n<p spaces-before=\"0\">Retourne <a href=\"./client-request.md\"><code>ClientRequest`</code></a></p><code>\n<p>Créer une instance de <a href=\"/docs/api/client-request\"><code>ClientRequest</code></a> avec les <code>options</code> founies qui sont directement transmis au constructor de <code>ClientRequest</code>. La méthode <code>net.request</code> doit être utilisée pour émettre des requêtes HTTP sécurisés et non sécurisés selon le schéma de protocole spécifié dans l'objet <code>options</code>.</p>\n<h3 id=\"netisonline\"><a href=\"#netisonline\"><code>net.isOnline()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether there is currently internet connection.</p>\n<p>A return value of <code>false</code> is a pretty strong indicator that the user won't be able to connect to remote sites. However, a return value of <code>true</code> is inconclusive; even if some link is up, it is uncertain whether a particular connection attempt to a particular remote site will be successful.</p>\n<h2 id=\"propriétés\"><a href=\"#propriétés\">Propriétés</a></h2>\n<h3 id=\"netonline-lecture-seule\"><a href=\"#netonline-lecture-seule\"><code>net.online</code> <em>Lecture seule</em></a></h3>\n<p>Une propriété <code>Boolean</code>. Whether there is currently internet connection.</p>\n<p>A return value of <code>false</code> is a pretty strong indicator that the user won't be able to connect to remote sites. However, a return value of <code>true</code> is inconclusive; even if some link is up, it is uncertain whether a particular connection attempt to a particular remote site will be successful.</p></code>",
      "title": "net",
      "description": "Émet des requêtes HTTP/HTTPS à l'aide de la bibliothèque réseau natif de Chromium"
    },
    "/docs/api/net-log": {
      "locale": "fr-FR",
      "slug": "net-log",
      "href": "/docs/api/net-log",
      "crowdinFileId": "256345",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/net-log.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"netlog\"><a href=\"#netlog\">netLog</a></h1>\n<blockquote>\n<p>Log d'évènements de réseau lors d'une session.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { netLog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> netLog.startLogging(<span class=\"hljs-string\">'/path/to/net-log'</span>)\n  <span class=\"hljs-comment\">// After some network events</span>\n  <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> netLog.stopLogging()\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Net-logs written to'</span>, path)\n})\n</code></pre>\n<p>Voir <a href=\"/docs/api/command-line-switches#--log-net-logpath\"><code>--log-net-log</code></a> pour log les évènement réseau à travers le cycle de vie de l'application.</p>\n<p><strong>Note :</strong> Toutes les méthodes si non spécifiées ne peuvent être utilisées qu'après que l'évènement <code>ready</code> de l' <code>app</code> ne soit émis.</p>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<h3 id=\"netlogstartloggingpath-options\"><a href=\"#netlogstartloggingpath-options\"><code>netLog.startLogging(path[, options])</code></a></h3>\n<ul>\n<li><code>path</code> String - Chemin du fichier où sera enregistré le log.</li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>captureMode</code> String (optional) - What kinds of data should be captured. By default, only metadata about requests will be captured. Setting this to <code>includeSensitive</code> will include cookies and authentication data. Setting it to <code>everything</code> will include all bytes transferred on sockets. Can be <code>default</code>, <code>includeSensitive</code> or <code>everything</code>.</li>\n<li><code>maxFileSize</code> Number (optional) - When the log grows beyond this size, logging will automatically stop. Defaults to unlimited.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the net log has begun recording.</p>\n<p>Commence d'enregistrer les évènements de réseau dans <code>path</code> .</p>\n<h3 id=\"netlogstoplogging\"><a href=\"#netlogstoplogging\"><code>netLog.stopLogging()</code></a></h3>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the net log has been flushed to disk.</p>\n<p>Arrête d'enregistrer les évènements réseau. Si elle n'est pas appelée, elle sera automatiquement arrêtée quand l'application s'arrêtera.</p>\n<h2 id=\"propriétés\"><a href=\"#propriétés\">Propriétés</a></h2>\n<h3 id=\"netlogcurrentlylogging-lecture-seule\"><a href=\"#netlogcurrentlylogging-lecture-seule\"><code>netLog.currentlyLogging</code> <em>Lecture seule</em></a></h3>\n<p>A <code>Boolean</code> property that indicates whether network logs are currently being recorded.</p>",
      "title": "netLog",
      "description": "Log d'évènements de réseau lors d'une session."
    },
    "/docs/api/structures/new-window-web-contents-event": {
      "locale": "fr-FR",
      "slug": "new-window-web-contents-event",
      "href": "/docs/api/structures/new-window-web-contents-event",
      "crowdinFileId": "256469",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/new-window-web-contents-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"newwindowwebcontentsevent-object-extends-event\"><a href=\"#newwindowwebcontentsevent-object-extends-event\">NewWindowWebContentsEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>newGuest</code> BrowserWindow (optional)</li>\n</ul>",
      "title": "NewWindowWebContentsEvent Object extends Event",
      "description": ""
    },
    "/docs/api/notification": {
      "locale": "fr-FR",
      "slug": "notification",
      "href": "/docs/api/notification",
      "crowdinFileId": "256349",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/notification.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"notification\"><a href=\"#notification\">Notification</a></h1>\n<blockquote>\n<p>Créer des notifications bureau spécifique à l'OS</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h2 id=\"utilisation-dans-le-processus-de-rendu\"><a href=\"#utilisation-dans-le-processus-de-rendu\">Utilisation dans le processus de rendu</a></h2>\n<p>SI vous voulez afficher des notifications depuis un processus de rendu, vous devez utiliser l'<a href=\"/docs/tutorial/notifications\">API HTML5 de notification</a></p>\n<h2 id=\"classe--notification\"><a href=\"#classe--notification\">Classe : Notification</a></h2>\n<blockquote>\n<p>Créer des notifications bureau spécifique à l'OS</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>Notification</code> est un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p>Cela crée une nouvelle <code>Notification</code> avec les propriétés natives définies par les <code>options</code>.</p>\n<h3 id=\"méthodes-statiques\"><a href=\"#méthodes-statiques\">Méthodes statiques</a></h3>\n<p>La classe <code>Notification</code> dispose des méthodes statiques suivantes :</p>\n<h4 id=\"notificationissupported\"><a href=\"#notificationissupported\"><code>Notification.isSupported()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si le système actuel prend en charge les notification bureau ou non</p>\n<h3 id=\"new-notificationoptions\"><a href=\"#new-notificationoptions\"><code>new Notification([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>title</code> String (optional) - A title for the notification, which will be shown at the top of the notification window when it is shown.</li>\n<li><code>subtitle</code> String (facultatif) <em>macOS</em> - Un sous-titre pour la notification, qui sera affiché sous le titre.</li>\n<li><code>body</code> String (optional) - The body text of the notification, which will be displayed below the title or subtitle.</li>\n<li><code>silent</code> Boolean (facultatif) - Émet ou non un bruit de notification lors de l'affichage de la notification.</li>\n<li><code>icône</code> (String | <a href=\"/docs/api/native-image\">NativeImage</a>) (facultatif) - Une icône à utiliser dans la notification.</li>\n<li><code>hasReply</code> Boolean (facultatif) <em>macOS</em> - Ajout ou non d'une option de réponse en ligne à la notification.</li>\n<li><code>timeoutType</code> String (optional) <em>Linux</em> <em>Windows</em> - The timeout duration of the notification. Can be 'default' or 'never'.</li>\n<li><code>replyPlaceholder</code> String (facultatif) <em>macOS</em> - L'espace réservé à écrire dans le champ de saisie de réponse en ligne.</li>\n<li><code>sound</code> String (facultatif) <em>macOS</em> - Le nom du fichier audio à jouer lorsque la notification est affichée.</li>\n<li><code>urgency</code> String (optional) <em>Linux</em> - The urgency level of the notification. Can be 'normal', 'critical', or 'low'.</li>\n<li><code>actions</code> <a href=\"/docs/api/structures/notification-action\">NotificationAction[]</a> (optional) <em>macOS</em> - Actions to add to the notification. Please read the available actions and limitations in the <code>NotificationAction</code> documentation.</li>\n<li><code>closeButtonText</code> String (optional) <em>macOS</em> - A custom title for the close button of an alert. An empty string will cause the default localized text to be used.</li>\n<li><code>toastXml</code> String (optional) <em>Windows</em> - A custom description of the Notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification.</li>\n</ul></li>\n</ul>\n<h3 id=\"événements-dinstance\"><a href=\"#événements-dinstance\">Événements d’instance</a></h3>\n<p>Les objets créés avec <code>new Notification</code> émettent les événements suivants :</p>\n<p><strong>Remarque :</strong> Certains événements sont seulement disponibles sur des systèmes d'exploitation spécifiques et sont étiquetés comme tels.</p>\n<h4 id=\"événement--show\"><a href=\"#événement--show\">Événement : 'show'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Émis lorsque la notification est affiché à l'utilisateur, notez que cet événement peut être émis plusieurs fois du fait qu'une notification peut être affichée plusieurs fois par le biais de la méthode <code>show()</code>.</p>\n<h4 id=\"événement--click\"><a href=\"#événement--click\">Événement : 'click'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Émis lorsque l'utilisateur clique sur la notification.</p>\n<h4 id=\"événement--close\"><a href=\"#événement--close\">Événement : 'close'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Émis lorsque la notification est fermée manuellement par l'utilisateur.</p>\n<p>Cet événement ne garantit pas d'être émis dans tous les cas de fermeture de la notification.</p>\n<h4 id=\"événement--reply-macos\"><a href=\"#événement--reply-macos\">Événement : 'reply' <em>macOS</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>reply</code> String - La chaîne de caractères que l'utilisateur a écrite dans le champ de réponse.</li>\n</ul>\n<p>Émis lorsque l'utilisateur clique sur le bouton \"Reply\" sur une notification avec <code>hasReply: true</code>.</p>\n<h4 id=\"événement--action-macos\"><a href=\"#événement--action-macos\">Événement : 'action' <em>macOS</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>index</code> Number - L'indice de l'action qui a été activée.</li>\n</ul>\n<h4 id=\"event-failed-windows\"><a href=\"#event-failed-windows\">Event: 'failed' <em>Windows</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>error</code> String - The error encountered during execution of the <code>show()</code> method.</li>\n</ul>\n<p>Emitted when an error is encountered while creating and showing the native notification.</p>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<p>Les objets créés avec <code>new Notification</code> ont les méthodes d'instance suivantes :</p>\n<h4 id=\"notificationshow\"><a href=\"#notificationshow\"><code>notification.show()</code></a></h4>\n<p>Montre immédiatement la notification à l'utilisateur, veuillez noter que cela signifie que contrairement à la Mise en œuvre de la notification HTML5, instanciation d'une <code>nouvelle notification</code> fait ne pas le montrer immédiatement à l'utilisateur, vous devez appeler cette méthode avant le système d'exploitation l'affichera.</p>\n<p>Si la notification a déjà été affichée auparavant, cette méthode rejettera la notification précédemment affichée et en créera une nouvelle avec des propriétés identiques.</p>\n<h4 id=\"notificationclose\"><a href=\"#notificationclose\"><code>notification.close()</code></a></h4>\n<p>Rejette la notification.</p>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<h4 id=\"notificationtitle\"><a href=\"#notificationtitle\"><code>notification.title</code></a></h4>\n<p>Une propriété <code>String</code> représentant le titre de la notification.</p>\n<h4 id=\"notificationsubtitle\"><a href=\"#notificationsubtitle\"><code>notification.subtitle</code></a></h4>\n<p>Une propriété <code>String</code> représentant le sous-titre de la notification.</p>\n<h4 id=\"notificationbody\"><a href=\"#notificationbody\"><code>notification.body</code></a></h4>\n<p>Une propriété <code>String</code> représentant le corps de la notification.</p>\n<h4 id=\"notificationreplyplaceholder\"><a href=\"#notificationreplyplaceholder\"><code>notification.replyPlaceholder</code></a></h4>\n<p>Une propriété <code>String</code> représentant le placeholder de la réponse de la notification.</p>\n<h4 id=\"notificationsound\"><a href=\"#notificationsound\"><code>notification.sound</code></a></h4>\n<p>Une propriété <code>String</code> représentant le son de la notification.</p>\n<h4 id=\"notificationclosebuttontext\"><a href=\"#notificationclosebuttontext\"><code>notification.closeButtonText</code></a></h4>\n<p>Une propriété <code>String</code> représentant le texte du bouton de fermeture de la notification.</p>\n<h4 id=\"notificationsilent\"><a href=\"#notificationsilent\"><code>notification.silent</code></a></h4>\n<p>Une propriété <code>Boolean</code> qui indique si la notification est silencieuse.</p>\n<h4 id=\"notificationhasreply\"><a href=\"#notificationhasreply\"><code>notification.hasReply</code></a></h4>\n<p>Une propriété <code>Booléenne</code> qui indique si la notification a une action de réponse.</p>\n<h4 id=\"notificationurgency-linux\"><a href=\"#notificationurgency-linux\"><code>notification.urgency</code> <em>Linux</em></a></h4>\n<p>A <code>String</code> property representing the urgency level of the notification. Can be 'normal', 'critical', or 'low'.</p>\n<p>Default is 'low' - see <a href=\"https://developer.gnome.org/notification-spec/#urgency-levels\">NotifyUrgency</a> for more information.</p>\n<h4 id=\"notificationtimeouttype-linux-windows\"><a href=\"#notificationtimeouttype-linux-windows\"><code>notification.timeoutType</code> <em>Linux</em> <em>Windows</em></a></h4>\n<p>A <code>String</code> property representing the type of timeout duration for the notification. Can be 'default' or 'never'.</p>\n<p>If <code>timeoutType</code> is set to 'never', the notification never expires. It stays open until closed by the calling API or the user.</p>\n<h4 id=\"notificationactions\"><a href=\"#notificationactions\"><code>notification.actions</code></a></h4>\n<p>Une propriété <a href=\"/docs/api/structures/notification-action\"><code>NotificationAction[]</code></a> représentant les actions de la notification.</p>\n<h4 id=\"notificationtoastxml-windows\"><a href=\"#notificationtoastxml-windows\"><code>notification.toastXml</code> <em>Windows</em></a></h4>\n<p>A <code>String</code> property representing the custom Toast XML of the notification.</p>\n<h3 id=\"lire-un-son\"><a href=\"#lire-un-son\">Lire un son</a></h3>\n<p>Sur macOS, vous pouvez spécifier le nom du son que vous voulez jouer lors de l'affichage de la notification. Any of the default sounds (under System Preferences > Sound) can be used, in addition to custom sound files. Assurez-vous que le fichier audio soit copié dans l'\"app bundle\" (par exemple, <code>VotreApp.app/Contents/Resources</code>), ou l'un des emplacements suivants :</p>\n<ul>\n<li><code>~/Library/Sounds</code></li>\n<li><code>/Library/Sounds</code></li>\n<li><code>/Network/Library/Sounds</code></li>\n<li><code>/System/Library/Sounds</code></li>\n</ul>\n<p>Consultez la documentation de <a href=\"https://developer.apple.com/documentation/appkit/nssound\"><code>NSSound</code></a> pour plus d'informations.</p>",
      "title": "Notification",
      "description": "Créer des notifications bureau spécifique à l'OS"
    },
    "/docs/api/structures/notification-action": {
      "locale": "fr-FR",
      "slug": "notification-action",
      "href": "/docs/api/structures/notification-action",
      "crowdinFileId": "256471",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/notification-action.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificationaction-object\"><a href=\"#notificationaction-object\">NotificationAction Object</a></h1>\n<ul>\n<li><code>type</code> String - The type of action, can be <code>button</code>.</li>\n<li><code>text</code> String (optional) - The label for the given action.</li>\n</ul>\n<h2 id=\"platform--action-support\"><a href=\"#platform--action-support\">Platform / Action Support</a></h2>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Action Type</th><th>Platform Support</th><th>Usage of <code>text</code></th><th>Default <code>text</code></th><th>Limitations</th></tr></thead><tbody><tr><td><code>button</code></td><td>macOS</td><td>Used as the label for the button</td><td>\"Show\" (or a localized string by system default if first of such <code>button</code>, otherwise empty)</td><td>Only the first one is used. If multiple are provided, those beyond the first will be listed as additional actions (displayed when mouse active over the action button). Any such action also is incompatible with <code>hasReply</code> and will be ignored if <code>hasReply</code> is <code>true</code>.</td></tr></tbody></table>\n<h3 id=\"button-support-on-macos\"><a href=\"#button-support-on-macos\">Button support on macOS</a></h3>\n<p>In order for extra notification buttons to work on macOS your app must meet the following criteria.</p>\n<ul>\n<li>App is signed</li>\n<li>App has it's <code>NSUserNotificationAlertStyle</code> set to <code>alert</code> in the <code>Info.plist</code>.</li>\n</ul>\n<p>If either of these requirements are not met the button won't appear.</p>",
      "title": "NotificationAction Object",
      "description": ""
    },
    "/docs/api/structures/notification-response": {
      "locale": "fr-FR",
      "slug": "notification-response",
      "href": "/docs/api/structures/notification-response",
      "crowdinFileId": "256473",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/notification-response.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificationresponse-object\"><a href=\"#notificationresponse-object\">NotificationResponse Object</a></h1>\n<ul>\n<li><code>actionIdentifier</code> String - The identifier string of the action that the user selected.</li>\n<li><code>date</code> Number - The delivery date of the notification.</li>\n<li><code>identifier</code> String - The unique identifier for this notification request.</li>\n<li><code>userInfo</code> Record&#x3C;String, any> - A dictionary of custom information associated with the notification.</li>\n<li><code>userText</code> String (optional) - The text entered or chosen by the user.</li>\n</ul>",
      "title": "NotificationResponse Object",
      "description": ""
    },
    "/docs/tutorial/notifications": {
      "locale": "fr-FR",
      "slug": "notifications",
      "href": "/docs/tutorial/notifications",
      "crowdinFileId": "256225",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/notifications.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"notifications\"><a href=\"#notifications\">Notifications</a></h1>\n<h2 id=\"vue-densemble\"><a href=\"#vue-densemble\">Vue d'ensemble</a></h2>\n<p>All three operating systems provide means for applications to send notifications to the user. The technique of showing notifications is different for the Main and Renderer processes.</p>\n<p>For the Renderer process, Electron conveniently allows developers to send notifications with the <a href=\"https://notifications.spec.whatwg.org/\">HTML5 Notification API</a>, using the currently running operating system's native notification APIs to display it.</p>\n<p>To show notifications in the Main process, you need to use the <a href=\"/docs/api/notification\">Notification</a> module.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<h3 id=\"show-notifications-in-the-renderer-process\"><a href=\"#show-notifications-in-the-renderer-process\">Show notifications in the Renderer process</a></h3>\n<p>En partant d'une application fonctionnelle du <a href=\"/docs/tutorial/quick-start\">Guide de démarrage rapide</a>, ajoutez les lignes suivantes au fichier <code>index.html</code> avant la balise de fermeture <code>&#x3C;/body></code> :</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<p>... et ajoutez le fichier <code>renderer.js</code> :</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/notifications/renderer\"><span class=\"hljs-keyword\">const</span> NOTIFICATION_TITLE = <span class=\"hljs-string\">'Titre'</span>\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_BODY = <span class=\"hljs-string\">'Notification du Processus de rendu. Cliquez pour écrire dans la console.'</span>\n<span class=\"hljs-keyword\">const</span> CLICK_MESSAGE = <span class=\"hljs-string\">'Notification cliquée'</span>\n\n<span class=\"hljs-keyword\">new</span> Notification(NOTIFICATION_TITLE, { <span class=\"hljs-attr\">body</span>: NOTIFICATION_BODY })\n  .onclick = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-built_in\">console</span>.log(CLICK_MESSAGE)\n</code></pre>\n<p>After launching the Electron application, you should see the notification:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/notification-renderer.png\" alt=\"Notification in the Renderer process\"></p>\n<p>De plus, si vous cliquez sur la notification, le DOM se mettra à jour pour afficher \"Notification cliquée!\".</p>\n<h3 id=\"show-notifications-in-the-main-process\"><a href=\"#show-notifications-in-the-main-process\">Show notifications in the Main process</a></h3>\n<p>À partir d’une application fonctionnelle du <a href=\"/docs/tutorial/quick-start\">Guide de démarrage rapide</a>, mettez à jour le fichier <code>main.js</code> avec les lignes suivantes :</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/notifications/main\"><span class=\"hljs-keyword\">const</span> { Notification } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_TITLE = <span class=\"hljs-string\">'Basic Notification'</span>\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_BODY = <span class=\"hljs-string\">'Notification from the Main process'</span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">showNotification</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">new</span> Notification({ <span class=\"hljs-attr\">title</span>: NOTIFICATION_TITLE, <span class=\"hljs-attr\">body</span>: NOTIFICATION_BODY }).show()\n}\n\napp.whenReady().then(createWindow).then(showNotification)\n</code></pre>\n<p>Après avoir lancé l'application Electron, vous devriez voir la notification système :</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/notification-main.png\" alt=\"Notification dans le processus principal\"></p>\n<h2 id=\"additional-information\"><a href=\"#additional-information\">Additional information</a></h2>\n<p>Le code et l’expérience utilisateur sur les différents systèmes d’exploitation sont semblables, mais il y a des différences.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<ul>\n<li>Sous Windows 10, un raccourci vers votre application avec un <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">ID de modèle d’utilisateur d’application</a> doit être installé sur le Menu Démarrer. This can be overkill during development, so adding <code>node_modules\\electron\\dist\\electron.exe</code> to your Start Menu also does the trick. Naviguez vers le fichier dans l'explorateur, cliquez avec le bouton droit de la souris et 'Épingler pour démarrer le menu'. Vous devrez ensuite ajouter la ligne <code>app.setAppUserModelId(process.execPath)</code> à votre processus principal pour voir les notifications.</li>\n<li>Sous Windows 8.1 et Windows 8, un raccourci vers votre application avec un <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Utilisateur de l'application ID modèle</a> doit être installé sur l'écran de démarrage. Notez, cependant, qu’il n’a pas besoin d’être épinglée à l’écran de démarrage.</li>\n<li>Sur Windows 7, les notifications fonctionnent via une implémentation personnalisée qui ressemble visuellement au natif sur les systèmes plus récents.</li>\n</ul>\n<p>Electron tente d'automatiser le travail autour de l'ID du modèle utilisateur de l'application. Quand Electron est utilisé conjointement avec l'installation et la mise à jour du framework Squirrel, <a href=\"https://github.com/electron/windows-installer/blob/master/README.md#handling-squirrel-events\">raccourcis seront automatiquement configurés correctement</a>. De plus, Electron détectera que Squirrel a été utilisé et appellera automatiquement <code>app.setAppUserModelId()</code> avec la valeur correcte. Pendant le développement, vous pouvez avoir pour appeler <a href=\"/docs/api/app#appsetappusermodelidid-windows\"><code>app.setAppUserModelId()</code></a> vous-même.</p>\n<p>En outre, dans Windows 8, la longueur maximale pour le corps de notification est de 250 caractères, l'équipe Windows recommande que les notifications fassent jusqu'à 200 caractères. Cela dit, la limitation a été retiré sur Windows 10. L'équipe Windows demandant aux développeurs de rester raisonnable. Essayer d'envoyer des quantités gigantesques de textes à l'API (milliers de caractères) peut entraîner une instabilité.</p>\n<h4 id=\"notifications-enrichies\"><a href=\"#notifications-enrichies\">Notifications enrichies</a></h4>\n<p>Les versions ultérieures de Windows permettent aux notifications enrichies, avec des modèles personnalisés, des images et autres éléments. Pour envoyer ces notifications (depuis processus principal ou le processus de rendu), utilisez le \"userland\" module <a href=\"https://github.com/felixrieseberg/electron-windows-notifications\">electron-windows-notifications</a>, qui utilise un addons natif de Node pour envoyer des objets <code>ToastNotification</code> et <code>TileNotification</code>.</p>\n<p>Bien que les notifications incluant des boutons fonctionnent avec <code>electron-windows-notifications</code>, la gestion des réponses nécessite l'utilisation de <a href=\"https://github.com/felixrieseberg/electron-windows-interactive-notifications\"><code>electron-windows-interactive-notification</code></a>, qui aide à l'enregistrement des composants COM requis et fait l'appel à votre application Electron avec les données saisies par l'utilisateur.</p>\n<h4 id=\"ne-pas-déranger--mode-présentation\"><a href=\"#ne-pas-déranger--mode-présentation\">Ne pas déranger / Mode présentation</a></h4>\n<p>Utilisez le module userland <a href=\"https://github.com/felixrieseberg/electron-notification-state\">electron-notification-state</a> afin de détecter si vous êtes autorisé à envoyer une notification, .</p>\n<p>Cela permet de déterminer à l'avance si Windows supprimera silencieusement la notification.</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>Les notifications sont simples sur macOS, mais vous devriez être au courant de <a href=\"https://developer.apple.com/macos/human-interface-guidelines/system-capabilities/notifications/\">Directives de l'interface humaine d'Apple concernant les notifications</a>.</p>\n<p>Notez que les notifications sont limitées à 256 octets de taille et risque d’être tronquées si vous dépassez cette limite.</p>\n<h4 id=\"ne-pas-déranger--état-de-la-session\"><a href=\"#ne-pas-déranger--état-de-la-session\">Ne pas déranger / État de la session</a></h4>\n<p>Pour détecter si oui ou non vous êtes autorisé à envoyer une notification, utilisez module \"userland\" <a href=\"https://github.com/felixrieseberg/electron-notification-state\">electron-notification-state</a>.</p>\n<p>Cela vous permettra de détecter si la notification sera affichée ou pas.</p>\n<h3 id=\"linux\"><a href=\"#linux\">Linux</a></h3>\n<p>Les notifications sont envoyées à l'aide de <code>libnotify</code> qui permet l'affichage de notifications sur n'importe quel environnement bureau suivant <a href=\"https://developer.gnome.org/notification-spec/\">Desktop Notifications Specification</a>, comme Cinnamon, Enlightenment, Unity, GNOME et KDE.</p>",
      "title": "Notifications",
      "description": ""
    },
    "/docs/tutorial/offscreen-rendering": {
      "locale": "fr-FR",
      "slug": "offscreen-rendering",
      "href": "/docs/tutorial/offscreen-rendering",
      "crowdinFileId": "256227",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/offscreen-rendering.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"rendu-hors-de-lécran\"><a href=\"#rendu-hors-de-lécran\">Rendu hors de l'écran</a></h1>\n<h2 id=\"vue-densemble\"><a href=\"#vue-densemble\">Vue d'ensemble</a></h2>\n<p>Le Rendu hors-écran vous permet de récupérer le contenu d’une <code>BrowserWindow</code> dans un fichier bitmap, donc il pourra être restitué n’importe où, par exemple une texture dans une scène 3D. Le rendu hors-écran d'Electron utilise une approche comparable au projet <a href=\"https://bitbucket.org/chromiumembedded/cef\">Chromium Embedded Framework</a>.</p>\n<p><em>Notes</em> :</p>\n<ul>\n<li>Il y a deux modes de rendu qui peuvent être utilisés (voir la section ci-dessous) et seule la zone modifiée est concernée par l'événement <code>paint</code> pour plus d'efficacité.</li>\n<li>Vous pouvez stopper/reprendre le rendu ainsi que définir la fréquence d'affichage de l’image.</li>\n<li>Le taux de rafraîchissement maximal est de 240 car des valeurs plus élevées n'apportent que des pertes de performances sans avantage particulier.</li>\n<li>Quand rien ne se passe sur une page Web, aucune image n'est générée.</li>\n<li><strong>Remarque :</strong> Une fenêtre hors-écran est toujours créée comme une <a href=\"/docs/api/frameless-window\">Frameless Window</a>.</li>\n</ul>\n<h3 id=\"mode-de-rendu\"><a href=\"#mode-de-rendu\">Mode de rendu</a></h3>\n<h4 id=\"accélération-gpu\"><a href=\"#accélération-gpu\">Accélération GPU</a></h4>\n<p>Le rendu par l'acceleration GPU signifie que le GPU est utilisé pour la composition. A cause de cela, cette fenêtre doit être copiée depuis le GPU et cela nécessite plus de performances. Donc ce mode est légèrement plus lent que l'autre. L’avantage de ce mode est que WebGL et les animations CSS 3D sont prises en charge.</p>\n<h4 id=\"périphérique-daffichage-logiciel\"><a href=\"#périphérique-daffichage-logiciel\">Périphérique d'affichage logiciel</a></h4>\n<p>Ce mode utilise un périphérique d'affichage logiciel pour le rendu du CPU, donc la génération de l'image est beaucoup plus rapide. Par conséquent, ce mode est préférable au mode d'accélération GPU.</p>\n<p>Pour activer ce mode, l'accélération GPU doit être désactivée en appelant l'API <a href=\"/docs/api/app#appdisablehardwareacceleration\"><code>app.disableHardwareAcceleration()</code></a>.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/offscreen-rendering\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\napp.disableHardwareAcceleration()\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">offscreen</span>: <span class=\"hljs-literal\">true</span> } })\n\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  win.webContents.on(<span class=\"hljs-string\">'paint'</span>, (event, dirty, image) => {\n    fs.writeFileSync(<span class=\"hljs-string\">'ex.png'</span>, image.toPNG())\n  })\n  win.webContents.setFrameRate(<span class=\"hljs-number\">60</span>)\n})\n</code></pre>\n<p>Après avoir lancé l'application Electron, accédez au dossier contenant votre application, où vous trouverez l'image affichée.</p>",
      "title": "Rendu hors de l'écran",
      "description": ""
    },
    "/docs/tutorial/online-offline-events": {
      "locale": "fr-FR",
      "slug": "online-offline-events",
      "href": "/docs/tutorial/online-offline-events",
      "crowdinFileId": "256229",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/online-offline-events.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"détection-des-événements-en-lignehors-ligne\"><a href=\"#détection-des-événements-en-lignehors-ligne\">Détection des événements en ligne/hors ligne</a></h1>\n<h2 id=\"vue-densemble\"><a href=\"#vue-densemble\">Vue d'ensemble</a></h2>\n<p>La détection des <a href=\"https://developer.mozilla.org/en-US/docs/Online_and_offline_events\">événements Online et offline</a> peut être implémentée dans le processus de rendu en utilisant l'attribut <a href=\"http://html5index.org/Offline%20-%20NavigatorOnLine.html\"><code>navigator.onLine</code></a>, faisant partie de l'API HTML5 standard.</p>\n<p>L'attribut <code>navigator.onLine</code> renvoie :</p>\n<ul>\n<li><code>false</code> si toute requête réseau est garantie vouée à l'échec (par exemple, lors de la déconnexion du réseau).</li>\n<li><code>true</code> dans tous les autres cas.</li>\n</ul>\n<p>Puisque de nombreux cas retournent <code>true</code>, vous devriez traiter avec précaution les cas pouvant être des faux positifs, car la valeur <code>true</code> ne signifie pas toujours qu'Electron puisse accéder à Internet. Par exemple, dans les cas où l'ordinateur exécute un logiciel de virtualisation qui a des adaptateurs Ethernet virtuels avec l'état « toujours connecté ». Par conséquent, si vous voulez déterminer le statut de l'accès à Internet d'Electron, vous devrez mettre en œuvre des moyens supplémentaires de vérification.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<p>En partant d'un fichier HTML <code>index.html</code>, cet exemple démontrera comment l'API <code>navigator.onLine</code> peut être utilisée pour construire un indicateur d'état de connexion.</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"script-src 'self' 'unsafe-inline';\"</span> /></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Connection status: <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">strong</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">'status'</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">strong</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>In order to mutate the DOM, create a <code>renderer.js</code> file that adds event listeners to the <code>'online'</code> and <code>'offline'</code> <code>window</code> events. The event handler sets the content of the <code>&#x3C;strong id='status'></code> element depending on the result of <code>navigator.onLine</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">updateOnlineStatus</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'status'</span>).innerHTML = navigator.onLine ? <span class=\"hljs-string\">'online'</span> : <span class=\"hljs-string\">'offline'</span>\n}\n\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'online'</span>, updateOnlineStatus)\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'offline'</span>, updateOnlineStatus)\n\nupdateOnlineStatus()\n</code></pre>\n<p>Finally, create a <code>main.js</code> file for main process that creates the window.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> onlineStatusWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">400</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">100</span>\n  })\n\n  onlineStatusWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n      createWindow()\n    }\n  })\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n</code></pre>\n<p>After launching the Electron application, you should see the notification:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/connection-status.png\" alt=\"Connection status\"></p>\n<blockquote>\n<p>Note: If you need to communicate the connection status to the main process, use the <a href=\"/docs/api/ipc-renderer\">IPC renderer</a> API.</p>\n</blockquote>",
      "title": "Détection des événements en ligne/hors ligne",
      "description": "Note: If you need to communicate the connection status to the main process, use the IPC renderer API."
    },
    "/docs/development/patches": {
      "locale": "fr-FR",
      "slug": "patches",
      "href": "/docs/development/patches",
      "crowdinFileId": "256161",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/patches.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"patches-in-electron\"><a href=\"#patches-in-electron\">Patches in Electron</a></h1>\n<p>Electron is built on two major upstream projects: Chromium and Node.js. Chacun de ces projets a également plusieurs de ses propres dépendances. Nous faisons de notre mieux pour utiliser ces dépendances exactement telles qu'elles sont, mais parfois nous ne pouvons pas atteindre nos objectifs sans corriger ces dépendances en amont pour les adapter à nos cas d'utilisation.</p>\n<h2 id=\"patch-justification\"><a href=\"#patch-justification\">Patch justification</a></h2>\n<p>Chaque patch dans Electron est une charge de maintenance. When upstream code changes, patches can break—sometimes without even a patch conflict or a compilation error. It's an ongoing effort to keep our patch set up-to-date and effective. Nous nous efforçons donc de maintenir notre nombre de patchs au minimum. À cette fin, chaque patch doit décrire sa raison d'être dans son message de commit. Cette raison doit être l'une des suivantes :</p>\n<ol>\n<li>The patch is temporary, and is intended to be (or has been) committed upstream or otherwise eventually removed. Include a link to an upstream PR or code review if available, or a procedure for verifying whether the patch is still needed at a later date.</li>\n<li>The patch allows the code to compile in the Electron environment, but cannot be upstreamed because it's Electron-specific (e.g. patching out references to Chrome's <code>Profile</code>). Include reasoning about why the change cannot be implemented without a patch (e.g. by subclassing or copying the code).</li>\n<li>The patch makes Electron-specific changes in functionality which are fundamentally incompatible with upstream.</li>\n</ol>\n<p>In general, all the upstream projects we work with are friendly folks and are often happy to accept refactorings that allow the code in question to be compatible with both Electron and the upstream project. (See e.g. <a href=\"https://chromium-review.googlesource.com/c/chromium/src/+/1637040\">this</a> change in Chromium, which allowed us to remove a patch that did the same thing, or <a href=\"https://github.com/nodejs/node/pull/22110\">this</a> change in Node, which was a no-op for Node but fixed a bug in Electron.) <strong>We should aim to upstream changes whenever we can, and avoid indefinite-lifetime patches</strong>.</p>\n<h2 id=\"patch-system\"><a href=\"#patch-system\">Patch system</a></h2>\n<p>If you find yourself in the unfortunate position of having to make a change which can only be made through patching an upstream project, you'll need to know how to manage patches in Electron.</p>\n<p>All patches to upstream projects in Electron are contained in the <code>patches/</code> directory. Each subdirectory of <code>patches/</code> contains several patch files, along with a <code>.patches</code> file which lists the order in which the patches should be applied. Think of these files as making up a series of git commits that are applied on top of the upstream project after we check it out.</p>\n<pre><code class=\"hljs language-plaintext\">patches\n├── config.json   &#x3C;-- this describes which patchset directory is applied to what project\n├── chromium\n│   ├── .patches\n│   ├── accelerator.patch\n│   ├── add_contentgpuclient_precreatemessageloop_callback.patch\n│   ⋮\n├── node\n│   ├── .patches\n│   ├── add_openssl_is_boringssl_guard_to_oaep_hash_check.patch\n│   ├── build_add_gn_build_files.patch\n│   ⋮\n⋮\n</code></pre>\n<p>To help manage these patch sets, we provide two tools: <code>git-import-patches</code> and <code>git-export-patches</code>. <code>git-import-patches</code> imports a set of patch files into a git repository by applying each patch in the correct order and creating a commit for each one. <code>git-export-patches</code> does the reverse; it exports a series of git commits in a repository into a set of files in a directory and an accompanying <code>.patches</code> file.</p>\n<blockquote>\n<p>Side note: the reason we use a <code>.patches</code> file to maintain the order of applied patches, rather than prepending a number like <code>001-</code> to each file, is because it reduces conflicts related to patch ordering. It prevents the situation where two PRs both add a patch at the end of the series with the same numbering and end up both getting merged resulting in a duplicate identifier, and it also reduces churn when a patch is added or deleted in the middle of the series.</p>\n</blockquote>\n<h3 id=\"utilisation\"><a href=\"#utilisation\">Utilisation</a></h3>\n<h4 id=\"adding-a-new-patch\"><a href=\"#adding-a-new-patch\">Adding a new patch</a></h4>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n$ vim some/code/file.cc\n$ git commit\n$ ../../electron/script/git-export-patches -o ../../electron/patches/node\n</code></pre>\n<blockquote>\n<p><strong>NOTE</strong>: <code>git-export-patches</code> ignores any uncommitted files, so you must create a commit if you want your changes to be exported. The subject line of the commit message will be used to derive the patch file name, and the body of the commit message should include the reason for the patch's existence.</p>\n</blockquote>\n<p>Re-exporting patches will sometimes cause shasums in unrelated patches to change. This is generally harmless and can be ignored (but go ahead and add those changes to your PR, it'll stop them from showing up for other people).</p>\n<h4 id=\"editing-an-existing-patch\"><a href=\"#editing-an-existing-patch\">Editing an existing patch</a></h4>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/v8\n$ vim some/code/file.cc\n$ git <span class=\"hljs-built_in\">log</span>\n<span class=\"hljs-comment\"># Find the commit sha of the patch you want to edit.</span>\n$ git commit --fixup [COMMIT_SHA]\n$ git rebase --autosquash -i [COMMIT_SHA]^\n$ ../electron/script/git-export-patches -o ../electron/patches/v8\n</code></pre>\n<h4 id=\"removing-a-patch\"><a href=\"#removing-a-patch\">Removing a patch</a></h4>\n<pre><code class=\"hljs language-bash\">$ vim src/electron/patches/node/.patches\n<span class=\"hljs-comment\"># Delete the line with the name of the patch you want to remove</span>\n$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n$ git reset --hard refs/patches/upstream-head\n$ ../../electron/script/git-import-patches ../../electron/patches/node\n$ ../../electron/script/git-export-patches -o ../../electron/patches/node\n</code></pre>\n<p>Note that <code>git-import-patches</code> will mark the commit that was <code>HEAD</code> when it was run as <code>refs/patches/upstream-head</code>. This lets you keep track of which commits are from Electron patches (those that come after <code>refs/patches/upstream-head</code>) and which commits are in upstream (those before <code>refs/patches/upstream-head</code>).</p>\n<h4 id=\"resolving-conflicts\"><a href=\"#resolving-conflicts\">Resolving conflicts</a></h4>\n<p>When updating an upstream dependency, patches may fail to apply cleanly. Often, the conflict can be resolved automatically by git with a 3-way merge. You can instruct <code>git-import-patches</code> to use the 3-way merge algorithm by passing the <code>-3</code> argument:</p>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n<span class=\"hljs-comment\"># If the patch application failed midway through, you can reset it with:</span>\n$ git am --abort\n<span class=\"hljs-comment\"># And then retry with 3-way merge:</span>\n$ ../../electron/script/git-import-patches -3 ../../electron/patches/node\n</code></pre>\n<p>If <code>git-import-patches -3</code> encounters a merge conflict that it can't resolve automatically, it will pause and allow you to resolve the conflict manually. Once you have resolved the conflict, <code>git add</code> the resolved files and continue to apply the rest of the patches by running <code>git am --continue</code>.</p>",
      "title": "Patches in Electron",
      "description": "Side note: the reason we use a .patches file to maintain the order of applied patches, rather than prepending a number like 001- to each file, is because it reduces conflicts related to patch ordering. It prevents the situation where two PRs both add a patch at the end of the series with the same numbering and end up both getting merged resulting in a duplicate identifier, and it also reduces churn when a patch is added or deleted in the middle of the series."
    },
    "/docs/tutorial/performance": {
      "locale": "fr-FR",
      "slug": "performance",
      "href": "/docs/tutorial/performance",
      "crowdinFileId": "256231",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/performance.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"performance\"><a href=\"#performance\">Performance</a></h1>\n<p>Developers frequently ask about strategies to optimize the performance of Electron applications. Software engineers, consumers, and framework developers do not always agree on one single definition of what \"performance\" means. This document outlines some of the Electron maintainers' favorite ways to reduce the amount of memory, CPU, and disk resources being used while ensuring that your app is responsive to user input and completes operations as quickly as possible. Furthermore, we want all performance strategies to maintain a high standard for your app's security.</p>\n<p>Wisdom and information about how to build performant websites with JavaScript generally applies to Electron apps, too. To a certain extent, resources discussing how to build performant Node.js applications also apply, but be careful to understand that the term \"performance\" means different things for a Node.js backend than it does for an application running on a client.</p>\n<p>This list is provided for your convenience – and is, much like our <a href=\"/docs/tutorial/security\">security checklist</a> – not meant to exhaustive. It is probably possible to build a slow Electron app that follows all the steps outlined below. Electron is a powerful development platform that enables you, the developer, to do more or less whatever you want. All that freedom means that performance is largely your responsibility.</p>\n<h2 id=\"measure-measure-measure\"><a href=\"#measure-measure-measure\">Measure, Measure, Measure</a></h2>\n<p>The list below contains a number of steps that are fairly straightforward and easy to implement. However, building the most performant version of your app will require you to go beyond a number of steps. Instead, you will have to closely examine all the code running in your app by carefully profiling and measuring. Where are the bottlenecks? When the user clicks a button, what operations take up the brunt of the time? While the app is simply idling, which objects take up the most memory?</p>\n<p>Time and time again, we have seen that the most successful strategy for building a performant Electron app is to profile the running code, find the most resource-hungry piece of it, and to optimize it. Repeating this seemingly laborious process over and over again will dramatically increase your app's performance. Experience from working with major apps like Visual Studio Code or Slack has shown that this practice is by far the most reliable strategy to improve performance.</p>\n<p>To learn more about how to profile your app's code, familiarize yourself with the Chrome Developer Tools. For advanced analysis looking at multiple processes at once, consider the <a href=\"https://www.chromium.org/developers/how-tos/trace-event-profiling-tool\">Chrome Tracing</a> tool.</p>\n<h3 id=\"recommended-reading\"><a href=\"#recommended-reading\">Recommended Reading</a></h3>\n<ul>\n<li><a href=\"https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/\">Get Started With Analyzing Runtime Performance</a></li>\n<li><a href=\"https://www.youtube.com/watch?v=r0OeHRUCCb4\">Conférence: \"Visual Studio Code - The First Second\"</a></li>\n</ul>\n<h2 id=\"liste-de-contrôle\"><a href=\"#liste-de-contrôle\">Liste de contrôle</a></h2>\n<p>Chances are that your app could be a little leaner, faster, and generally less resource-hungry if you attempt these steps.</p>\n<ol>\n<li><a href=\"#1-carelessly-including-modules\">Carelessly including modules</a></li>\n<li><a href=\"#2-loading-and-running-code-too-soon\">Loading and running code too soon</a></li>\n<li><a href=\"#3-blocking-the-main-process\">Blocking the main process</a></li>\n<li><a href=\"#4-blocking-the-renderer-process\">Blocking the renderer process</a></li>\n<li><a href=\"#5-unnecessary-polyfills\">Unnecessary polyfills</a></li>\n<li><a href=\"#6-unnecessary-or-blocking-network-requests\">Unnecessary or blocking network requests</a></li>\n<li><a href=\"#7-bundle-your-code\">Bundle your code</a></li>\n</ol>\n<h2 id=\"1-carelessly-including-modules\"><a href=\"#1-carelessly-including-modules\">1) Carelessly including modules</a></h2>\n<p>Before adding a Node.js module to your application, examine said module. How many dependencies does that module include? What kind of resources does it need to simply be called in a <code>require()</code> statement? You might find that the module with the most downloads on the NPM package registry or the most stars on GitHub is not in fact the leanest or smallest one available.</p>\n<h3 id=\"pourquoi-\"><a href=\"#pourquoi-\">Pourquoi ?</a></h3>\n<p>The reasoning behind this recommendation is best illustrated with a real-world example. During the early days of Electron, reliable detection of network connectivity was a problem, resulting many apps to use a module that exposed a simple <code>isOnline()</code> method.</p>\n<p>That module detected your network connectivity by attempting to reach out to a number of well-known endpoints. For the list of those endpoints, it depended on a different module, which also contained a list of well-known ports. This dependency itself relied on a module containing information about ports, which came in the form of a JSON file with more than 100,000 lines of content. Whenever the module was loaded (usually in a <code>require('module')</code> statement), it would load all its dependencies and eventually read and parse this JSON file. Parsing many thousands lines of JSON is a very expensive operation. On a slow machine it can take up whole seconds of time.</p>\n<p>In many server contexts, startup time is virtually irrelevant. A Node.js server that requires information about all ports is likely actually \"more performant\" if it loads all required information into memory whenever the server boots at the benefit of serving requests faster. The module discussed in this example is not a \"bad\" module. Electron apps, however, should not be loading, parsing, and storing in memory information that it does not actually need.</p>\n<p>In short, a seemingly excellent module written primarily for Node.js servers running Linux might be bad news for your app's performance. In this particular example, the correct solution was to use no module at all, and to instead use connectivity checks included in later versions of Chromium.</p>\n<h3 id=\"comment-\"><a href=\"#comment-\">Comment ?</a></h3>\n<p>When considering a module, we recommend that you check:</p>\n<ol>\n<li>the size of dependencies included</li>\n<li>the resources required to load (<code>require()</code>) it</li>\n<li>the resources required to perform the action you're interested in</li>\n</ol>\n<p>Generating a CPU profile and a heap memory profile for loading a module can be done with a single command on the command line. In the example below, we're looking at the popular module <code>request</code>.</p>\n<pre><code class=\"hljs language-sh\">node --cpu-prof --heap-prof -e <span class=\"hljs-string\">\"require('request')\"</span>\n</code></pre>\n<p>Executing this command results in a <code>.cpuprofile</code> file and a <code>.heapprofile</code> file in the directory you executed it in. Both files can be analyzed using the Chrome Developer Tools, using the <code>Performance</code> and <code>Memory</code> tabs respectively.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/performance-cpu-prof.png\" alt=\"Profil de performance de CPU\"></p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/performance-heap-prof.png\" alt=\"Profil de performance de la mémoire du tas\"></p>\n<p>Dans cet exemple, sur la machine de l'auteur, nous avons vu que le chargement du module Request `<code>a pris près d'une demi-seconde, alors que</code>node-fetch` a pris beaucoup moins de mémoire et moins de 50ms.</p>\n<h2 id=\"2-loading-and-running-code-too-soon\"><a href=\"#2-loading-and-running-code-too-soon\">2) Loading and running code too soon</a></h2>\n<p>If you have expensive setup operations, consider deferring those. Inspect all the work being executed right after the application starts. Instead of firing off all operations right away, consider staggering them in a sequence more closely aligned with the user's journey.</p>\n<p>In traditional Node.js development, we're used to putting all our <code>require()</code> statements at the top. If you're currently writing your Electron application using the same strategy <em>and</em> are using sizable modules that you do not immediately need, apply the same strategy and defer loading to a more opportune time.</p>\n<h3 id=\"pourquoi--1\"><a href=\"#pourquoi--1\">Pourquoi ?</a></h3>\n<p>Loading modules is a surprisingly expensive operation, especially on Windows. When your app starts, it should not make users wait for operations that are currently not necessary.</p>\n<p>This might seem obvious, but many applications tend to do a large amount of work immediately after the app has launched - like checking for updates, downloading content used in a later flow, or performing heavy disk I/O operations.</p>\n<p>Let's consider Visual Studio Code as an example. When you open a file, it will immediately display the file to you without any code highlighting, prioritizing your ability to interact with the text. Once it has done that work, it will move on to code highlighting.</p>\n<h3 id=\"comment--1\"><a href=\"#comment--1\">Comment ?</a></h3>\n<p>Let's consider an example and assume that your application is parsing files in the fictitious <code>.foo</code> format. In order to do that, it relies on the equally fictitious <code>foo-parser</code> module. In traditional Node.js development, you might write code that eagerly loads dependencies:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> fooParser = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'foo-parser'</span>)\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">Parser</span> </span>{\n  <span class=\"hljs-keyword\">constructor</span> () {\n    <span class=\"hljs-keyword\">this</span>.files = fs.readdirSync(<span class=\"hljs-string\">'.'</span>)\n  }\n\n  getParsedFiles () {\n    <span class=\"hljs-keyword\">return</span> fooParser.parse(<span class=\"hljs-keyword\">this</span>.files)\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> parser = <span class=\"hljs-keyword\">new</span> Parser()\n\n<span class=\"hljs-built_in\">module</span>.exports = { parser }\n</code></pre>\n<p>In the above example, we're doing a lot of work that's being executed as soon as the file is loaded. Do we need to get parsed files right away? Could we do this work a little later, when <code>getParsedFiles()</code> is actually called?</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// \"fs\" is likely already being loaded, so the `require()` call is cheap</span>\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">Parser</span> </span>{\n  <span class=\"hljs-keyword\">async</span> getFiles () {\n    <span class=\"hljs-comment\">// Touch the disk as soon as `getFiles` is called, not sooner.</span>\n    <span class=\"hljs-comment\">// Also, ensure that we're not blocking other operations by using</span>\n    <span class=\"hljs-comment\">// the asynchronous version.</span>\n    <span class=\"hljs-keyword\">this</span>.files = <span class=\"hljs-keyword\">this</span>.files || <span class=\"hljs-keyword\">await</span> fs.readdir(<span class=\"hljs-string\">'.'</span>)\n\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-keyword\">this</span>.files\n  }\n\n  <span class=\"hljs-keyword\">async</span> getParsedFiles () {\n    <span class=\"hljs-comment\">// Our fictitious foo-parser is a big and expensive module to load, so</span>\n    <span class=\"hljs-comment\">// defer that work until we actually need to parse files.</span>\n    <span class=\"hljs-comment\">// Since `require()` comes with a module cache, the `require()` call</span>\n    <span class=\"hljs-comment\">// will only be expensive once - subsequent calls of `getParsedFiles()`</span>\n    <span class=\"hljs-comment\">// will be faster.</span>\n    <span class=\"hljs-keyword\">const</span> fooParser = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'foo-parser'</span>)\n    <span class=\"hljs-keyword\">const</span> files = <span class=\"hljs-keyword\">await</span> <span class=\"hljs-keyword\">this</span>.getFiles()\n\n    <span class=\"hljs-keyword\">return</span> fooParser.parse(files)\n  }\n}\n\n<span class=\"hljs-comment\">// This operation is now a lot cheaper than in our previous example</span>\n<span class=\"hljs-keyword\">const</span> parser = <span class=\"hljs-keyword\">new</span> Parser()\n\n<span class=\"hljs-built_in\">module</span>.exports = { parser }\n</code></pre>\n<p>In short, allocate resources \"just in time\" rather than allocating them all when your app starts.</p>\n<h2 id=\"3-blocking-the-main-process\"><a href=\"#3-blocking-the-main-process\">3) Blocking the main process</a></h2>\n<p>Electron's main process (sometimes called \"browser process\") is special: It is the parent process to all your app's other processes and the primary process the operating system interacts with. It handles windows, interactions, and the communication between various components inside your app. It also houses the UI thread.</p>\n<p>Under no circumstances should you block this process and the UI thread with long-running operations. Blocking the UI thread means that your entire app will freeze until the main process is ready to continue processing.</p>\n<h3 id=\"pourquoi--2\"><a href=\"#pourquoi--2\">Pourquoi ?</a></h3>\n<p>The main process and its UI thread are essentially the control tower for major operations inside your app. When the operating system tells your app about a mouse click, it'll go through the main process before it reaches your window. If your window is rendering a buttery-smooth animation, it'll need to talk to the GPU process about that – once again going through the main process.</p>\n<p>Electron and Chromium are careful to put heavy disk I/O and CPU-bound operations onto new threads to avoid blocking the UI thread. You should do the same.</p>\n<h3 id=\"comment--2\"><a href=\"#comment--2\">Comment ?</a></h3>\n<p>Electron's powerful multi-process architecture stands ready to assist you with your long-running tasks, but also includes a small number of performance traps.</p>\n<p>1) For long running CPU-heavy tasks, make use of <a href=\"https://nodejs.org/api/worker_threads.html\">worker threads</a>, consider moving them to the BrowserWindow, or (as a last resort) spawn a dedicated process.</p>\n<p>2) Avoid using the synchronous IPC and the <code>remote</code> module as much as possible. While there are legitimate use cases, it is far too easy to unknowingly block the UI thread using the <code>remote</code> module.</p>\n<p>3) Avoid using blocking I/O operations in the main process. Bref, chaque fois que des modules coeur de Node.js (comme <code>fs</code> ou <code>child_process</code>) offrent une version synchrone ou une version asynchrone vous devriez préférer la variante asynchrone et non-bloquant .</p>\n<h2 id=\"4-blocking-the-renderer-process\"><a href=\"#4-blocking-the-renderer-process\">4) Blocking the renderer process</a></h2>\n<p>Since Electron ships with a current version of Chrome, you can make use of the latest and greatest features the Web Platform offers to defer or offload heavy operations in a way that keeps your app smooth and responsive.</p>\n<h3 id=\"pourquoi--3\"><a href=\"#pourquoi--3\">Pourquoi ?</a></h3>\n<p>Your app probably has a lot of JavaScript to run in the renderer process. The trick is to execute operations as quickly as possible without taking away resources needed to keep scrolling smooth, respond to user input, or animations at 60fps.</p>\n<p>Orchestrating the flow of operations in your renderer's code is particularly useful if users complain about your app sometimes \"stuttering\".</p>\n<h3 id=\"comment--3\"><a href=\"#comment--3\">Comment ?</a></h3>\n<p>Generally speaking, all advice for building performant web apps for modern browsers apply to Electron's renderers, too. The two primary tools at your disposal  are currently <code>requestIdleCallback()</code> for small operations and <code>Web Workers</code> for long-running operations.</p>\n<p><em><code>requestIdleCallback()</code></em> allows developers to queue up a function to be executed as soon as the process is entering an idle period. It enables you to perform low-priority or background work without impacting the user experience. For more information about how to use it, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\">check out its documentation on MDN</a>.</p>\n<p><em>Web Workers</em> are a powerful tool to run code on a separate thread. There are some caveats to consider – consult Electron's <a href=\"/docs/tutorial/multithreading\">multithreading documentation</a> and the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers\">MDN documentation for Web Workers</a>. They're an ideal solution for any operation that requires a lot of CPU power for an extended period of time.</p>\n<h2 id=\"5-unnecessary-polyfills\"><a href=\"#5-unnecessary-polyfills\">5) Unnecessary polyfills</a></h2>\n<p>One of Electron's great benefits is that you know exactly which engine will parse your JavaScript, HTML, and CSS. If you're re-purposing code that was written for the web at large, make sure to not polyfill features included in Electron.</p>\n<h3 id=\"pourquoi--4\"><a href=\"#pourquoi--4\">Pourquoi ?</a></h3>\n<p>When building a web application for today's Internet, the oldest environments dictate what features you can and cannot use. Even though Electron supports well-performing CSS filters and animations, an older browser might not. Where you could use WebGL, your developers may have chosen a more resource-hungry solution to support older phones.</p>\n<p>When it comes to JavaScript, you may have included toolkit libraries like jQuery for DOM selectors or polyfills like the <code>regenerator-runtime</code> to support <code>async/await</code>.</p>\n<p>It is rare for a JavaScript-based polyfill to be faster than the equivalent native feature in Electron. Do not slow down your Electron app by shipping your own version of standard web platform features.</p>\n<h3 id=\"comment--4\"><a href=\"#comment--4\">Comment ?</a></h3>\n<p>Operate under the assumption that polyfills in current versions of Electron are unnecessary. If you have doubts, check <a href=\"https://caniuse.com/\">caniuse.com</a> and check if the <a href=\"/docs/api/process#processversionschrome-readonly\">version of Chromium used in your Electron version</a> supports the feature you desire.</p>\n<p>In addition, carefully examine the libraries you use. Are they really necessary? <code>jQuery</code>, for example, was such a success that many of its features are now part of the <a href=\"http://youmightnotneedjquery.com/\">standard JavaScript feature set available</a>.</p>\n<p>If you're using a transpiler/compiler like TypeScript, examine its configuration and ensure that you're targeting the latest ECMAScript version supported by Electron.</p>\n<h2 id=\"6-unnecessary-or-blocking-network-requests\"><a href=\"#6-unnecessary-or-blocking-network-requests\">6) Unnecessary or blocking network requests</a></h2>\n<p>Avoid fetching rarely changing resources from the internet if they could easily be bundled with your application.</p>\n<h3 id=\"pourquoi--5\"><a href=\"#pourquoi--5\">Pourquoi ?</a></h3>\n<p>Many users of Electron start with an entirely web-based app that they're turning into a desktop application. As web developers, we are used to loading resources from a variety of content delivery networks. Now that you are shipping a proper desktop application, attempt to \"cut the cord\" where possible and avoid letting your users wait for resources that never change and could easily be included  in your app.</p>\n<p>A typical example is Google Fonts. Many developers make use of Google's impressive collection of free fonts, which comes with a content delivery network. The pitch is straightforward: Include a few lines of CSS and Google will take care of the rest.</p>\n<p>When building an Electron app, your users are better served if you download the fonts and include them in your app's bundle.</p>\n<h3 id=\"comment--5\"><a href=\"#comment--5\">Comment ?</a></h3>\n<p>In an ideal world, your application wouldn't need the network to operate at all. To get there, you must understand what resources your app is downloading - and how large those resources are.</p>\n<p>To do so, open up the developer tools. Navigate to the <code>Network</code> tab and check the <code>Disable cache</code> option. Then, reload your renderer. Unless your app prohibits such reloads, you can usually trigger a reload by hitting <code>Cmd + R</code> or <code>Ctrl + R</code> with the developer tools in focus.</p>\n<p>The tools will now meticulously record all network requests. In a first pass, take stock of all the resources being downloaded, focusing on the larger files first. Are any of them images, fonts, or media files that don't change and could be included with your bundle? If so, include them.</p>\n<p>As a next step, enable <code>Network Throttling</code>. Find the drop-down that currently reads <code>Online</code> and select a slower speed such as <code>Fast 3G</code>. Reload your renderer and see if there are any resources that your app is unnecessarily waiting for. In many cases, an app will wait for a network request to complete despite not actually needing the involved resource.</p>\n<p>As a tip, loading resources from the Internet that you might want to change without shipping an application update is a powerful strategy. For advanced control over how resources are being loaded, consider investing in <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API\">Service Workers</a>.</p>\n<h2 id=\"7-bundle-your-code\"><a href=\"#7-bundle-your-code\">7) Bundle your code</a></h2>\n<p>As already pointed out in \"<a href=\"#2-loading-and-running-code-too-soon\">Loading and running code too soon</a>\", calling <code>require()</code> is an expensive operation. If you are able to do so, bundle your application's code into a single file.</p>\n<h3 id=\"pourquoi--6\"><a href=\"#pourquoi--6\">Pourquoi ?</a></h3>\n<p>Modern JavaScript development usually involves many files and modules. While that's perfectly fine for developing with Electron, we heavily recommend that you bundle all your code into one single file to ensure that the overhead included in calling <code>require()</code> is only paid once when your application loads.</p>\n<h3 id=\"comment--6\"><a href=\"#comment--6\">Comment ?</a></h3>\n<p>There are numerous JavaScript bundlers out there and we know better than to anger the community by recommending one tool over another. We do however recommend that you use a bundler that is able to handle Electron's unique environment that needs to handle both Node.js and browser environments.</p>\n<p>As of writing this article, the popular choices include <a href=\"https://webpack.js.org/\">Webpack</a>, <a href=\"https://parceljs.org/\">Parcel</a>, and <a href=\"https://rollupjs.org/\">rollup.js</a>.</p>",
      "title": "Performance",
      "description": ""
    },
    "/docs/api/structures/point": {
      "locale": "fr-FR",
      "slug": "point",
      "href": "/docs/api/structures/point",
      "crowdinFileId": "256475",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/point.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"point-object\"><a href=\"#point-object\">Point Object</a></h1>\n<ul>\n<li><code>x</code> Number</li>\n<li><code>y</code> Number</li>\n</ul>\n<p><strong>Note:</strong> Both <code>x</code> and <code>y</code> must be whole integers, when providing a point object as input to an Electron API we will automatically round your <code>x</code> and <code>y</code> values to the nearest whole integer.</p>",
      "title": "Point Object",
      "description": ""
    },
    "/docs/api/structures/post-body": {
      "locale": "fr-FR",
      "slug": "post-body",
      "href": "/docs/api/structures/post-body",
      "crowdinFileId": "256477",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/post-body.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"postbody-object\"><a href=\"#postbody-object\">PostBody Object</a></h1>\n<ul>\n<li><code>data</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)[] - The post data to be sent to the new window.</li>\n<li><code>contentType</code> String - The <code>content-type</code> header used for the data. One of <code>application/x-www-form-urlencoded</code> or <code>multipart/form-data</code>. Corresponds to the <code>enctype</code> attribute of the submitted HTML form.</li>\n<li><code>boundary</code> String (optional) - The boundary used to separate multiple parts of the message. Only valid when <code>contentType</code> is <code>multipart/form-data</code>.</li>\n</ul>\n<p>Note that keys starting with <code>--</code> are not currently supported. For example, this will errantly submit as <code>multipart/form-data</code> when <code>nativeWindowOpen</code> is set to <code>false</code> in webPreferences:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">form</span>\n  <span class=\"hljs-attr\">target</span>=<span class=\"hljs-string\">\"_blank\"</span>\n  <span class=\"hljs-attr\">method</span>=<span class=\"hljs-string\">\"POST\"</span>\n  <span class=\"hljs-attr\">enctype</span>=<span class=\"hljs-string\">\"application/x-www-form-urlencoded\"</span>\n  <span class=\"hljs-attr\">action</span>=<span class=\"hljs-string\">\"https://postman-echo.com/post\"</span>\n></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">input</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text\"</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">\"--theKey\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">input</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"submit\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">form</span>></span>\n</code></pre>",
      "title": "PostBody Object",
      "description": ""
    },
    "/docs/api/power-monitor": {
      "locale": "fr-FR",
      "slug": "power-monitor",
      "href": "/docs/api/power-monitor",
      "crowdinFileId": "256351",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/power-monitor.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"powermonitor\"><a href=\"#powermonitor\">powerMonitor</a></h1>\n<blockquote>\n<p>Surveille les changements d'état de puissance.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h2 id=\"événements\"><a href=\"#événements\">Événements</a></h2>\n<p>Le module <code>powerMonitor</code> émet les événements suivants :</p>\n<h3 id=\"événement--suspend\"><a href=\"#événement--suspend\">Événement : 'suspend'</a></h3>\n<p>Émis lorsque le système est suspendu.</p>\n<h3 id=\"événement--resume\"><a href=\"#événement--resume\">Événement : 'resume'</a></h3>\n<p>Émis lorsque le système reprend.</p>\n<h3 id=\"event-on-ac-macos-windows\"><a href=\"#event-on-ac-macos-windows\">Event: 'on-ac' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Émis lorsque le système est branché sur prise.</p>\n<h3 id=\"event-on-battery-macos--windows\"><a href=\"#event-on-battery-macos--windows\">Event: 'on-battery' <em>macOS</em>  <em>Windows</em></a></h3>\n<p>Émis lorsque le système passe sur batterie.</p>\n<h3 id=\"événement--shutdown-linux-macos\"><a href=\"#événement--shutdown-linux-macos\">Événement : 'shutdown' <em>Linux</em> <em>macOS</em></a></h3>\n<p>Émis lorsque le système est sur le point de redémarrer ou d'arrêter. Si le gestionnaire d'événements appelle <code>e.preventDefault()</code>, Electron tentera de retarder l'arrêt du système dans afin que l'application se ferme proprement. Si <code>e.preventDefault()</code> est appelé, l'application devrait quitter dès que possible en appelant quelque chose comme <code>app.quit()</code>.</p>\n<h3 id=\"événement--lock-screen-macos-windows\"><a href=\"#événement--lock-screen-macos-windows\">Événement : 'lock-screen' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Émis lorsque le système est sur le point de verrouiller l'écran.</p>\n<h3 id=\"événement--unlock-screen-macos-windows\"><a href=\"#événement--unlock-screen-macos-windows\">Événement : 'unlock-screen' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Émis dès que l'écran du système est déverrouillé.</p>\n<h3 id=\"event-user-did-become-active-macos\"><a href=\"#event-user-did-become-active-macos\">Event: 'user-did-become-active' <em>macOS</em></a></h3>\n<p>Emitted when a login session is activated. See <a href=\"https://developer.apple.com/documentation/appkit/nsworkspacesessiondidbecomeactivenotification?language=objc\">documentation</a> for more information.</p>\n<h3 id=\"event-user-did-resign-active-macos\"><a href=\"#event-user-did-resign-active-macos\">Event: 'user-did-resign-active' <em>macOS</em></a></h3>\n<p>Emitted when a login session is deactivated. See <a href=\"https://developer.apple.com/documentation/appkit/nsworkspacesessiondidresignactivenotification?language=objc\">documentation</a> for more information.</p>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module <code>powerMonitor</code> a les méthodes suivantes :</p>\n<h3 id=\"format0-powermonitorgetsystemidlestateidlethreshold\"><a href=\"#format0-powermonitorgetsystemidlestateidlethreshold\"><code>format@@0 powerMonitor.getSystemIdleState(idleThreshold)</code></a></h3>\n<ul>\n<li><code>idleThreshold</code> Entier</li>\n</ul>\n<p>Returns <code>String</code> - The system's current state. Peut être <code>active</code>, <code>idle</code>, <code>locked</code> ou <code>unknown</code>.</p>\n<p>Calculate the system idle state. <code>idleThreshold</code> is the amount of time (in seconds) before considered idle.  <code>locked</code> is available on supported systems only.</p>\n<h3 id=\"getsystemidletime\"><a href=\"#getsystemidletime\"><code>getSystemIdleTime()</code></a></h3>\n<p>Retourne <code>Integer</code> - Temps d'inactivité en secondes</p>\n<p>Calculer le temps d'inactivité du système en secondes.</p>\n<h3 id=\"powermonitorisonbatterypower\"><a href=\"#powermonitorisonbatterypower\"><code>powerMonitor.isOnBatteryPower()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the system is on battery power.</p>\n<p>To monitor for changes in this property, use the <code>on-battery</code> and <code>on-ac</code> events.</p>\n<h2 id=\"propriétés\"><a href=\"#propriétés\">Propriétés</a></h2>\n<h3 id=\"powermonitoronbatterypower\"><a href=\"#powermonitoronbatterypower\"><code>powerMonitor.onBatteryPower</code></a></h3>\n<p>Une propriété <code>Boolean</code>. True if the system is on battery power.</p>\n<p>See <a href=\"#powermonitorisonbatterypower\"><code>powerMonitor.isOnBatteryPower()</code></a>.</p>",
      "title": "powerMonitor",
      "description": "Surveille les changements d'état de puissance."
    },
    "/docs/api/power-save-blocker": {
      "locale": "fr-FR",
      "slug": "power-save-blocker",
      "href": "/docs/api/power-save-blocker",
      "crowdinFileId": "256353",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/power-save-blocker.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"powersaveblocker\"><a href=\"#powersaveblocker\">powerSaveBlocker</a></h1>\n<blockquote>\n<p>Bloquer le système de passer en mode de faible puissance (sommeil).</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>Par exemple :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { powerSaveBlocker } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> id = powerSaveBlocker.start(<span class=\"hljs-string\">'prevent-display-sleep'</span>)\n<span class=\"hljs-built_in\">console</span>.log(powerSaveBlocker.isStarted(id))\n\npowerSaveBlocker.stop(id)\n</code></pre>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module <code>powerSaveBlocker</code> dispose des méthodes suivantes :</p>\n<h3 id=\"powersaveblockerstarttype\"><a href=\"#powersaveblockerstarttype\"><code>powerSaveBlocker.start(type)</code></a></h3>\n<ul>\n<li><code>type</code> String - Power save blocker type.<ul>\n<li><code>prevent-app-suspension</code> - Prevent the application from being suspended. Keeps system active but allows screen to be turned off. Example use cases: downloading a file or playing audio.</li>\n<li><code>prevent-display-sleep</code> - Prevent the display from going to sleep. Keeps system and screen active. Example use case: playing video.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Integer</code> - L'ID du blocage assigné à ce power blocker.</p>\n<p>Starts preventing the system from entering lower-power mode. Returns an integer identifying the power save blocker.</p>\n<p><strong>Remarque :</strong> <code>prevent-display-sleep</code> a une priorité plus élevée que <code>prevent-app-suspension</code>. Seulement le type de priorité le plus élevé prendra effet. En d'autres termes, <code>prevent-display-sleep</code> a toujours la priorité sur <code>prevent-app-suspension</code>.</p>\n<p>Par exemple, une API requête A pour <code>prevent-app-suspension</code>, et un autre requête B pour <code>prevent-display-sleep</code>. <code>prevent-display-sleep</code> sera utilisé jusqu’à ce que la requête B se stoppe. Après cela, <code>prevent-app-suspension</code> est utilisé.</p>\n<h3 id=\"powersaveblockerstopid\"><a href=\"#powersaveblockerstopid\"><code>powerSaveBlocker.stop(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer - L'id du bloqueur d'économie d'énergie renvoyé par <code>powerSaveBlocker.start</code>.</li>\n</ul>\n<p>Arrête le bloqueur d'économie d'énergie spécifié.</p>\n<h3 id=\"powersaveblockerisstartedid\"><a href=\"#powersaveblockerisstartedid\"><code>powerSaveBlocker.isStarted(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer - L'id du bloqueur d'économie d'énergie renvoyé par <code>powerSaveBlocker.start</code>.</li>\n</ul>\n<p>Returns <code>Boolean</code> - Si le <code>powerSaveBlocker</code> correspondant a démarré.</p>",
      "title": "powerSaveBlocker",
      "description": "Bloquer le système de passer en mode de faible puissance (sommeil)."
    },
    "/docs/api/structures/printer-info": {
      "locale": "fr-FR",
      "slug": "printer-info",
      "href": "/docs/api/structures/printer-info",
      "crowdinFileId": "256479",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/printer-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"printerinfo-object\"><a href=\"#printerinfo-object\">PrinterInfo Object</a></h1>\n<ul>\n<li><code>name</code> String - the name of the printer as understood by the OS.</li>\n<li><code>displayName</code> String - the name of the printer as shown in Print Preview.</li>\n<li><code>description</code> String - a longer description of the printer's type.</li>\n<li><code>status</code> Number - the current status of the printer.</li>\n<li><code>isDefault</code> Boolean - whether or not a given printer is set as the default printer on the OS.</li>\n<li><code>options</code> Object - an object containing a variable number of platform-specific printer information.</li>\n</ul>\n<p>The number represented by <code>status</code> means different things on different platforms: on Windows its potential values can be found <a href=\"https://docs.microsoft.com/en-us/windows/win32/printdocs/printer-info-2\">here</a>, and on Linux and macOS they can be found <a href=\"https://www.cups.org/doc/cupspm.html\">here</a>.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<p>Below is an example of some of the additional options that may be set which may be different on each platform.</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Austin_4th_Floor_Printer___C02XK13BJHD4'</span>,\n  <span class=\"hljs-attr\">displayName</span>: <span class=\"hljs-string\">'Austin 4th Floor Printer @ C02XK13BJHD4'</span>,\n  <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'TOSHIBA ColorMFP'</span>,\n  <span class=\"hljs-attr\">status</span>: <span class=\"hljs-number\">3</span>,\n  <span class=\"hljs-attr\">isDefault</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">options</span>: {\n    <span class=\"hljs-attr\">copies</span>: <span class=\"hljs-string\">'1'</span>,\n    <span class=\"hljs-string\">'device-uri'</span>: <span class=\"hljs-string\">'dnssd://Austin%204th%20Floor%20Printer%20%40%20C02XK13BJHD4._ipps._tcp.local./?uuid=71687f1e-1147-3274-6674-22de61b110bd'</span>,\n    <span class=\"hljs-attr\">finishings</span>: <span class=\"hljs-string\">'3'</span>,\n    <span class=\"hljs-string\">'job-cancel-after'</span>: <span class=\"hljs-string\">'10800'</span>,\n    <span class=\"hljs-string\">'job-hold-until'</span>: <span class=\"hljs-string\">'no-hold'</span>,\n    <span class=\"hljs-string\">'job-priority'</span>: <span class=\"hljs-string\">'50'</span>,\n    <span class=\"hljs-string\">'job-sheets'</span>: <span class=\"hljs-string\">'none,none'</span>,\n    <span class=\"hljs-string\">'marker-change-time'</span>: <span class=\"hljs-string\">'0'</span>,\n    <span class=\"hljs-string\">'number-up'</span>: <span class=\"hljs-string\">'1'</span>,\n    <span class=\"hljs-string\">'printer-commands'</span>: <span class=\"hljs-string\">'ReportLevels,PrintSelfTestPage,com.toshiba.ColourProfiles.update,com.toshiba.EFiling.update,com.toshiba.EFiling.checkPassword'</span>,\n    <span class=\"hljs-string\">'printer-info'</span>: <span class=\"hljs-string\">'Austin 4th Floor Printer @ C02XK13BJHD4'</span>,\n    <span class=\"hljs-string\">'printer-is-accepting-jobs'</span>: <span class=\"hljs-string\">'true'</span>,\n    <span class=\"hljs-string\">'printer-is-shared'</span>: <span class=\"hljs-string\">'false'</span>,\n    <span class=\"hljs-string\">'printer-is-temporary'</span>: <span class=\"hljs-string\">'false'</span>,\n    <span class=\"hljs-string\">'printer-location'</span>: <span class=\"hljs-string\">''</span>,\n    <span class=\"hljs-string\">'printer-make-and-model'</span>: <span class=\"hljs-string\">'TOSHIBA ColorMFP'</span>,\n    <span class=\"hljs-string\">'printer-state'</span>: <span class=\"hljs-string\">'3'</span>,\n    <span class=\"hljs-string\">'printer-state-change-time'</span>: <span class=\"hljs-string\">'1573472937'</span>,\n    <span class=\"hljs-string\">'printer-state-reasons'</span>: <span class=\"hljs-string\">'offline-report,com.toshiba.snmp.failed'</span>,\n    <span class=\"hljs-string\">'printer-type'</span>: <span class=\"hljs-string\">'10531038'</span>,\n    <span class=\"hljs-string\">'printer-uri-supported'</span>: <span class=\"hljs-string\">'ipp://localhost/printers/Austin_4th_Floor_Printer___C02XK13BJHD4'</span>,\n    <span class=\"hljs-attr\">system_driverinfo</span>: <span class=\"hljs-string\">'T'</span>\n  }\n}\n</code></pre>",
      "title": "PrinterInfo Object",
      "description": ""
    },
    "/docs/api/process": {
      "locale": "fr-FR",
      "slug": "process",
      "href": "/docs/api/process",
      "crowdinFileId": "256355",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/process.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"processus-process\"><a href=\"#processus-process\">processus (process)</a></h1>\n<blockquote>\n<p>Extension de l'objet process.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>L'objet <code>process</code> d'Electron une extension de l'<a href=\"https://nodejs.org/api/process.html\">objet <code>process</code> de Node.js</a>. Cela ajoute les événements, propriétés et méthodes suivantes :</p>\n<h2 id=\"mode-bac-à-sable\"><a href=\"#mode-bac-à-sable\">Mode bac à sable</a></h2>\n<p>Dans les moteurs de rendu en bac à sable, l'objet <code>process</code> ne contient qu'un sous-ensemble des APIs :</p>\n<ul>\n<li><code>crash()</code></li>\n<li><code>hang()</code></li>\n<li><code>getCreationTime()</code></li>\n<li><code>getHeapStatistics()</code></li>\n<li><code>getBlinkMemoryInfo()</code></li>\n<li><code>getProcessMemoryInfo()</code></li>\n<li><code>getSystemMemoryInfo()</code></li>\n<li><code>getSystemVersion()</code></li>\n<li><code>getCPUUsage()</code></li>\n<li><code>getIOCounters()</code></li>\n<li><code>uptime()</code></li>\n<li><code>argv</code></li>\n<li><code>execPath</code></li>\n<li><code>env</code></li>\n<li><code>pid</code></li>\n<li><code>arc</code></li>\n<li><code>plateforme</code></li>\n<li><code>bac à sable</code></li>\n<li><code>contextIsolated</code></li>\n<li><code>type</code></li>\n<li><code>version</code></li>\n<li><code>versions</code></li>\n<li><code>mas</code></li>\n<li><code>windowsStore</code></li>\n<li><code>contextId</code></li>\n</ul>\n<h2 id=\"événements\"><a href=\"#événements\">Événements</a></h2>\n<h3 id=\"événement--loaded\"><a href=\"#événement--loaded\">Événement : 'loaded'</a></h3>\n<p>Émis lorsque Electron a chargé son script d'initialisation interne et que commence à charger la page web ou le script principal.</p>\n<h2 id=\"propriétés\"><a href=\"#propriétés\">Propriétés</a></h2>\n<h3 id=\"processdefaultapp-readonly\"><a href=\"#processdefaultapp-readonly\"><code>process.defaultApp</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>. When app is started by being passed as parameter to the default app, this property is <code>true</code> in the main process, otherwise it is <code>undefined</code>.</p>\n<h3 id=\"processismainframe-readonly\"><a href=\"#processismainframe-readonly\"><code>process.isMainFrame</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>, <code>true</code> when the current renderer context is the \"main\" renderer frame. If you want the ID of the current frame you should use <code>webFrame.routingId</code>.</p>\n<h3 id=\"processmas-readonly\"><a href=\"#processmas-readonly\"><code>process.mas</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>. For Mac App Store build, this property is <code>true</code>, for other builds it is <code>undefined</code>.</p>\n<h3 id=\"processnoasar\"><a href=\"#processnoasar\"><code>process.noAsar</code></a></h3>\n<p>A <code>Boolean</code> that controls ASAR support inside your application. Setting this to <code>true</code> will disable the support for <code>asar</code> archives in Node's built-in modules.</p>\n<h3 id=\"processnodeprecation\"><a href=\"#processnodeprecation\"><code>process.noDeprecation</code></a></h3>\n<p>Un <code>Booléen</code> qui contrôle si oui ou non les avertissements de dépréciation sont imprimés sur <code>stderr</code>. Mettre ceci à <code>true</code> fera taire les avertissements de dépréciation. Cette propriété est utilisée à la place du drapeau <code>--no-deprecation</code>.</p>\n<h3 id=\"processresourcespath-readonly\"><a href=\"#processresourcespath-readonly\"><code>process.resourcesPath</code> <em>Readonly</em></a></h3>\n<p>Une <code>String</code> représentant le chemin vers le répertoire des ressources.</p>\n<h3 id=\"processsandboxed-readonly\"><a href=\"#processsandboxed-readonly\"><code>process.sandboxed</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>. When the renderer process is sandboxed, this property is <code>true</code>, otherwise it is <code>undefined</code>.</p>\n<h3 id=\"processcontextisolated-lecture-seule\"><a href=\"#processcontextisolated-lecture-seule\"><code>process.contextIsolated</code> <em>Lecture seule</em></a></h3>\n<p>A <code>Boolean</code> that indicates whether the current renderer context has <code>contextIsolation</code> enabled. It is <code>undefined</code> in the main process.</p>\n<h3 id=\"processthrowdeprecation\"><a href=\"#processthrowdeprecation\"><code>process.throwDeprecation</code></a></h3>\n<p>Un <code>Booléen</code> qui contrôle si oui ou non les avertissements de dépréciation seront lancés sous forme d'exceptions . En définissant cette valeur à <code>true</code> lancera des erreurs pour les dépréciations. Cette propriété est utilisée à la place du drapeau de ligne de commande <code>--throw-deprecation</code>.</p>\n<h3 id=\"processtracedeprecation\"><a href=\"#processtracedeprecation\"><code>process.traceDeprecation</code></a></h3>\n<p>Un <code>Booléen</code> qui contrôle si les dépréciations affichées sur <code>stderr</code> incluent leur trace de pile. En définissant cette valeur à <code>true</code> affichera les traces de piles pour les dépréciations. Cette propriété est à la place du drapeau <code>--trace-deprecation</code>.</p>\n<h3 id=\"processtraceprocesswarnings\"><a href=\"#processtraceprocesswarnings\"><code>process.traceProcessWarnings</code></a></h3>\n<p>Un <code>Booléen</code> qui contrôle si oui ou non les avertissements affichés sur <code>stderr</code> incluent leur trace de pile. En définissant cette valeur à <code>true</code> affichera les traces de piles pour les avertissements de processus (y compris les dépréciations). Cette propriété est à la place du drapeau de ligne <code>--trace-warnings</code> de la commande .</p>\n<h3 id=\"processtype-readonly\"><a href=\"#processtype-readonly\"><code>process.type</code> <em>Readonly</em></a></h3>\n<p>A <code>String</code> representing the current process's type, can be:</p>\n<ul>\n<li><code>browser</code> - The main process</li>\n<li><code>renderer</code> - A renderer process</li>\n<li><code>worker</code> - In a web worker</li>\n</ul>\n<h3 id=\"processversionschrome-readonly\"><a href=\"#processversionschrome-readonly\"><code>process.versions.chrome</code> <em>Readonly</em></a></h3>\n<p>Un <code>String</code> représentant la version de Chrome.</p>\n<h3 id=\"processversionselectron-readonly\"><a href=\"#processversionselectron-readonly\"><code>process.versions.electron</code> <em>Readonly</em></a></h3>\n<p>Un <code>String</code> représentant la version d'Electron.</p>\n<h3 id=\"processwindowsstore-readonly\"><a href=\"#processwindowsstore-readonly\"><code>process.windowsStore</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>. If the app is running as a Windows Store app (appx), this property is <code>true</code>, for otherwise it is <code>undefined</code>.</p>\n<h3 id=\"processcontextid-lecture-seule\"><a href=\"#processcontextid-lecture-seule\"><code>process.contextId</code> <em>Lecture seule</em></a></h3>\n<p>A <code>String</code> (optional) representing a globally unique ID of the current JavaScript context. Each frame has its own JavaScript context. When contextIsolation is enabled, the isolated world also has a separate JavaScript context. This property is only available in the renderer process.</p>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>L'objet <code>process</code> dispose des méthodes suivantes :</p>\n<h3 id=\"processcrash\"><a href=\"#processcrash\"><code>process.crash()</code></a></h3>\n<p>Cause le thread principal du processus en cours de plantage.</p>\n<h3 id=\"processgetcreationtime\"><a href=\"#processgetcreationtime\"><code>process.getCreationTime()</code></a></h3>\n<p>Retourne <code>Nombre | null</code> - Le nombre de millisecondes depuis Epoch, ou <code>null</code> si l'information est indisponible</p>\n<p>Indicates the creation time of the application. Le temps est représenté par le nombre de millisecondes depuis l'epoch. It returns null if it is unable to get the process creation time.</p>\n<h3 id=\"processgetcpuusage\"><a href=\"#processgetcpuusage\"><code>process.getCPUUsage()</code></a></h3>\n<p>Retourne <a href=\"/docs/api/structures/cpu-usage\"><code>CPUUsage</code></a></p>\n<h3 id=\"processgetiocounters-windows-linux\"><a href=\"#processgetiocounters-windows-linux\"><code>process.getIOCounters()</code> <em>Windows</em> <em>Linux</em></a></h3>\n<p>Retourne <a href=\"/docs/api/structures/io-counters\"><code>IOCounters</code></a></p>\n<h3 id=\"processgetheapstatistics\"><a href=\"#processgetheapstatistics\"><code>process.getHeapStatistics()</code></a></h3>\n<p>Retourne <code>Object</code>:</p>\n<ul>\n<li><code>totalHeapSize</code> Integer</li>\n<li><code>totalHeapSizeExecutable</code> Entier</li>\n<li><code>Taillephysique</code> Entier</li>\n<li><code>Taille totale</code> Entier</li>\n<li><code>usedHeapSize</code> Integer</li>\n<li><code>heapSizeLimit</code> Integer</li>\n<li><code>Mémoire de malloced</code> Entier</li>\n<li><code>peakMallocedMemory</code> Integer</li>\n<li><code>doesZapGarbage</code> Boolean</li>\n</ul>\n<p>Returns an object with V8 heap statistics. Notez que toutes les statistiques sont en kilo-octets.</p>\n<h3 id=\"processgetblinkmemoryinfo\"><a href=\"#processgetblinkmemoryinfo\"><code>process.getBlinkMemoryInfo()</code></a></h3>\n<p>Retourne <code>Object</code>:</p>\n<ul>\n<li><code>alloué</code> Integer - Taille de tous les objets alloués dans Kilobytes.</li>\n<li><code>marked</code> Integer - Taille de tous les objets marqués dans Kilobytes.</li>\n<li><code>total</code> Integer - Espace total alloué en kilobytes.</li>\n</ul>\n<p>Returns an object with Blink memory information. It can be useful for debugging rendering / DOM related memory issues. Note that all values are reported in Kilobytes.</p>\n<h3 id=\"processgetprocessmemoryinfo\"><a href=\"#processgetprocessmemoryinfo\"><code>process.getProcessMemoryInfo()</code></a></h3>\n<p>Retourne <code>Promise&#x3C;ProcessMemoryInfo></code> - résout avec un <a href=\"/docs/api/structures/process-memory-info\">ProcessMemoryInfo</a></p>\n<p>Returns an object giving memory usage statistics about the current process. Note that all statistics are reported in Kilobytes. This api should be called after app ready.</p>\n<p>Chromium ne fournit pas de valeur <code>residentSet</code> pour macOS. Ceci est dû au fait que macOS effectue une compression en mémoire des pages qui n'ont pas été récemment utilisées. En tant que résultat la valeur de la taille de la définition résident n'est pas celle qu'on pourrait attendre. <code>la mémoire privé</code> est plus représentative de l'utilisation réelle de la mémoire de pré-compression du processus sur macOS.</p>\n<h3 id=\"processgetsystemmemoryinfo\"><a href=\"#processgetsystemmemoryinfo\"><code>process.getSystemMemoryInfo()</code></a></h3>\n<p>Retourne <code>Object</code>:</p>\n<ul>\n<li><code>total</code> Integer - La quantité totale de mémoire physique dans Kilobytes disponibles pour le système .</li>\n<li><code>libre</code> Integer - La quantité totale de mémoire non utilisée par les applications ou le cache du disque.</li>\n<li><code>swapTotal</code> Integer <em>Windows</em> <em>Linux</em> - La quantité totale de mémoire swap dans Kilobytes disponible pour le système .</li>\n<li><code>swapFree</code> Integer <em>Windows</em> <em>Linux</em> - La quantité gratuite de mémoire swap dans Kilobytes disponible pour le système .</li>\n</ul>\n<p>Returns an object giving memory usage statistics about the entire system. Note that all statistics are reported in Kilobytes.</p>\n<h3 id=\"processgetsystemversion\"><a href=\"#processgetsystemversion\"><code>process.getSystemVersion()</code></a></h3>\n<p>Retourne <code>String</code> - La version du système d'exploitation hôte.</p>\n<p>Exemple :</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> version = process.getSystemVersion()\n<span class=\"hljs-built_in\">console</span>.log(version)\n<span class=\"hljs-comment\">// Sur macOS -> '10. 3.6'</span>\n<span class=\"hljs-comment\">// Sous Windows -> '10.0.17763'</span>\n<span class=\"hljs-comment\">// Sous Linux -> '4.15.0-45-générique'</span>\n</code></pre>\n<p><strong>Remarque :</strong> Il retourne la version réelle du système d'exploitation au lieu de la version du noyau sur macOS contrairement à <code>os.release()</code>.</p>\n<h3 id=\"processtakeheapsnapshotfilepath\"><a href=\"#processtakeheapsnapshotfilepath\"><code>process.takeHeapSnapshot(filePath)</code></a></h3>\n<ul>\n<li><code>filePath</code> String - Chemin vers le fichier de sortie.</li>\n</ul>\n<p>Retourne <code>Boolean</code> - Indique si l'instantané a été créé avec succès.</p>\n<p>Prend un instantané de tas V8 et l'enregistre dans <code>filePath</code>.</p>\n<h3 id=\"processhang\"><a href=\"#processhang\"><code>process.hang()</code></a></h3>\n<p>Cause le fil de discussion principal du processus actuel.</p>\n<h3 id=\"processsetfdlimitmaxdescriptors-macos-linux\"><a href=\"#processsetfdlimitmaxdescriptors-macos-linux\"><code>process.setFdLimit(maxDescriptors)</code> <em>macOS</em> <em>Linux</em></a></h3>\n<ul>\n<li><code>maxDescriptors</code> Integer</li>\n</ul>\n<p>Définit la limite de programmation du descripteur de fichier à <code>maxDescriptors</code> ou la limite de dur de l'OS, quelle que soit la plus faible pour le processus en cours.</p>",
      "title": "processus (process)",
      "description": "Extension de l'objet process."
    },
    "/docs/api/structures/process-memory-info": {
      "locale": "fr-FR",
      "slug": "process-memory-info",
      "href": "/docs/api/structures/process-memory-info",
      "crowdinFileId": "256481",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/process-memory-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"processmemoryinfo-object\"><a href=\"#processmemoryinfo-object\">ProcessMemoryInfo Object</a></h1>\n<ul>\n<li><code>residentSet</code> Integer <em>Linux</em> <em>Windows</em> - The amount of memory currently pinned to actual physical RAM in Kilobytes.</li>\n<li><code>private</code> Integer - The amount of memory not shared by other processes, such as JS heap or HTML content in Kilobytes.</li>\n<li><code>shared</code> Integer - The amount of memory shared between processes, typically memory consumed by the Electron code itself in Kilobytes.</li>\n</ul>",
      "title": "ProcessMemoryInfo Object",
      "description": ""
    },
    "/docs/api/structures/process-metric": {
      "locale": "fr-FR",
      "slug": "process-metric",
      "href": "/docs/api/structures/process-metric",
      "crowdinFileId": "256483",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/process-metric.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"processmetric-object\"><a href=\"#processmetric-object\">ProcessMetric Object</a></h1>\n<ul>\n<li><code>pid</code> Integer - Process id of the process.</li>\n<li><code>type</code> String - Type de processus. Une des valeurs suivantes:<ul>\n<li><code>Browser</code></li>\n<li><code>Tab</code></li>\n<li><code>Utilitaire</code></li>\n<li><code>Zygote</code></li>\n<li><code>Assistant bac à sable</code></li>\n<li><code>GPU</code></li>\n<li><code>Plugin Pepper</code></li>\n<li><code>Broker de plugin Pepper</code></li>\n<li><code>Inconnu</code></li>\n</ul></li>\n<li><code>serviceName</code> String (optional) - The non-localized name of the process.</li>\n<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>\n<li><code>cpu</code> <a href=\"/docs/api/structures/cpu-usage\">CPUUsage</a> - CPU usage of the process.</li>\n<li><code>creationTime</code> Number - Creation time for this process. The time is represented as number of milliseconds since epoch. Since the <code>pid</code> can be reused after a process dies, it is useful to use both the <code>pid</code> and the <code>creationTime</code> to uniquely identify a process.</li>\n<li><code>memory</code> <a href=\"/docs/api/structures/memory-info\">MemoryInfo</a> - Memory information for the process.</li>\n<li><code>sandboxed</code> Boolean (optional) <em>macOS</em> <em>Windows</em> - Whether the process is sandboxed on OS level.</li>\n<li><code>integrityLevel</code> String (optional) <em>Windows</em> - One of the following values:<ul>\n<li><code>untrusted</code></li>\n<li><code>low</code></li>\n<li><code>medium</code></li>\n<li><code>high</code></li>\n<li><code>unknown</code></li>\n</ul></li>\n</ul>",
      "title": "ProcessMetric Object",
      "description": ""
    },
    "/docs/tutorial/process-model": {
      "locale": "fr-FR",
      "slug": "process-model",
      "href": "/docs/tutorial/process-model",
      "crowdinFileId": "256233",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/process-model.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"modèle-de-processus\"><a href=\"#modèle-de-processus\">Modèle de processus</a></h1>\n<p>Electron hérite de son architecture multi-processus de Chromium, ce qui rend le framework architecturalement très similaire à un navigateur web moderne. Dans ce guide, nous allons exposer connaissances conceptuelles d’Electron que nous avons appliquées dans l’application de démarrage rapide minimale [][].</p>\n<h2 id=\"why-not-a-single-process\"><a href=\"#why-not-a-single-process\">Why not a single process?</a></h2>\n<p>Web browsers are incredibly complicated applications. Aside from their primary ability to display web content, they have many secondary responsibilities, such as managing multiple windows (or tabs) and loading third-party extensions.</p>\n<p>Dans les jours précédents, les navigateurs ont généralement utilisé un processus unique pour toutes ces fonctionnalités . Bien que ce modèle signifiait moins de frais pour chaque onglet, vous aviez ouverts, cela signifiait également qu'un site Web plantait ou suspendait affecterait l'ensemble du navigateur.</p>\n<h2 id=\"le-modèle-multi-processus\"><a href=\"#le-modèle-multi-processus\">Le modèle multi-processus</a></h2>\n<p>Pour résoudre ce problème, l'équipe de Chrome a décidé que chaque onglet serait rendu dans son propre processus , limiter les dommages que le code bogué ou malveillant sur une page web pourrait causer à l'application dans son ensemble. Un seul processus de navigateur contrôle ensuite ces processus, ainsi que que le cycle de vie de l'application dans son ensemble. Ce diagramme ci-dessous de la <a href=\"https://www.google.com/googlebooks/chrome/\">Bd Chrome</a> visualise ce modèle :</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/chrome-processes.png\" alt=\"Chrome&#x27;s multi-process architecture\"></p>\n<p>Electron applications are structured very similarly. En tant que développeur d'applications, vous contrôlez deux types de processus : principal et moteur de rendu. These are analogous to Chrome's own browser and renderer processes outlined above.</p>\n<h2 id=\"the-main-process\"><a href=\"#the-main-process\">The main process</a></h2>\n<p>Each Electron app has a single main process, which acts as the application's entry point. The main process runs in a Node.js environment, meaning it has the ability to <code>require</code> modules and use all of Node.js APIs.</p>\n<h3 id=\"window-management\"><a href=\"#window-management\">Window management</a></h3>\n<p>The main process' primary purpose is to create and manage application windows with the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> module.</p>\n<p>Each instance of the <code>BrowserWindow</code> class creates an application window that loads a web page in a separate renderer process. You can interact with this web content from the main process using the window's <a href=\"/docs/api/web-contents\"><code>webContents</code></a> object.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> contents = win.webContents\n<span class=\"hljs-built_in\">console</span>.log(contents)\n</code></pre>\n<blockquote>\n<p>Note: A renderer process is also created for <a href=\"/docs/tutorial/web-embeds\">web embeds</a> such as the <code>BrowserView</code> module. The <code>webContents</code> object is also accessible for embedded web content.</p>\n</blockquote>\n<p>Because the <code>BrowserWindow</code> module is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\"><code>EventEmitter</code></a>, you can also add handlers for various user events (for example, minimizing or maximizing your window).</p>\n<p>When a <code>BrowserWindow</code> instance is destroyed, its corresponding renderer process gets terminated as well.</p>\n<h3 id=\"application-lifecycle\"><a href=\"#application-lifecycle\">Application lifecycle</a></h3>\n<p>The main process also controls your application's lifecycle through Electron's <a href=\"/docs/api/app\"><code>app</code></a> module. This module provides a large set of events and methods that you can use to add custom application behaviour (for instance, programatically quitting your application, modifying the application dock, or showing an About panel).</p>\n<p>As a practical example, the app shown in the <a href=\"/docs/tutorial/quick-start#manage-your-windows-lifecycle\">quick start guide</a> uses <code>app</code> APIs to create a more native application window experience.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// fermeture de l'application lrsqu'aucune fenêtre n'est ouverte et ce sur les plateformes non-macOS.</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h3 id=\"native-apis\"><a href=\"#native-apis\">Native APIs</a></h3>\n<p>To extend Electron's features beyond being a Chromium wrapper for web contents, the main process also adds custom APIs to interact with the user's operating system. Electron exposes various modules that control native desktop functionality, such as menus, dialogs, and tray icons.</p>\n<p>For a full list of Electron's main process modules, check out our API documentation.</p>\n<h2 id=\"the-renderer-process\"><a href=\"#the-renderer-process\">The renderer process</a></h2>\n<p>Each Electron app spawns a separate renderer process for each open <code>BrowserWindow</code> (and each web embed). As its name implies, a renderer is responsible for <em>rendering</em> web content. For all intents and purposes, code ran in renderer processes should behave according to web standards (insofar as Chromium does, at least).</p>\n<p>Therefore, all user interfaces and app functionality within a single browser window should be written with the same tools and paradigms that you use on the web.</p>\n<p>Although explaining every web spec is out of scope for this guide, the bare minimum to understand is:</p>\n<ul>\n<li>An HTML file is your entry point for the renderer process.</li>\n<li>UI styling is added through Cascading Style Sheets (CSS).</li>\n<li>Executable JavaScript code can be added through <code>&#x3C;script></code> elements.</li>\n</ul>\n<p>Moreover, this also means that the renderer has no direct access to <code>require</code> or other Node.js APIs. In order to directly include NPM modules in the renderer, you must use the same bundler toolchains (for example, <code>webpack</code> or <code>parcel</code>) that you use on the web.</p>\n<blockquote>\n<p>Note: Renderer processes can be spawned with a full Node.js environment for ease of development. Historiquement, c'était la valeur par défaut, mais cette fonctionnalité a été désactivée pour des raisons de sécurité.</p>\n</blockquote>\n<p>At this point, you might be wondering how your renderer process user interfaces can interact with Node.js and Electron's native desktop functionality if these features are only accessible from the main process. In fact, there is no direct way to import Electron's content scripts.</p>\n<h2 id=\"scripts-de-preload\"><a href=\"#scripts-de-preload\">Scripts de preload</a></h2>\n<!-- Note: This guide doesn't take sandboxing into account, which might fundamentally \nchange the statements here. --> Preload scripts contain code that executes in a renderer process before its web content begins loading. Ces scripts s’exécutent dans le contexte du moteur de rendu, mais ont des privilèges supplémentaires qui leur donnent accès aux API Node.js.\n<p>A preload script can be attached to the main process in the <code>BrowserWindow</code> constructor's <code>webPreferences</code> option.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">//...</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">preload</span>: <span class=\"hljs-string\">'path/to/preload.js'</span>\n  }\n})\n<span class=\"hljs-comment\">//...</span>\n</code></pre>\n<p>Because the preload script shares a global <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window\"><code>Window</code></a> interface with the renderers and can access Node.js APIs, it serves to enhance your renderer by exposing arbitrary APIs in the <code>window</code> global that your web contents can then consume.</p>\n<p>Although preload scripts share a <code>window</code> global with the renderer they're attached to, you cannot directly attach any variables from the preload script to <code>window</code> because of the <a href=\"/docs/tutorial/context-isolation\"><code>contextIsolation</code></a> default.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.myAPI = {\n  <span class=\"hljs-attr\">desktop</span>: <span class=\"hljs-literal\">true</span>\n}\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-built_in\">window</span>.myAPI)\n<span class=\"hljs-comment\">// => undefined</span>\n</code></pre>\n<p>Context Isolation means that preload scripts are isolated from the renderer's main world to avoid leaking any privileged APIs into your web content's code.</p>\n<p>Instead, use the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> module to accomplish this securely:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">desktop</span>: <span class=\"hljs-literal\">true</span>\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-built_in\">window</span>.myAPI)\n<span class=\"hljs-comment\">// => { desktop: true }</span>\n</code></pre>\n<p>Cette fonctionnalité est incroyablement utile pour deux objectifs principaux :</p>\n<ul>\n<li>By exposing <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> helpers to the renderer, you can use inter-process communication (IPC) to trigger main process tasks from the renderer (and vice-versa).</li>\n<li>If you're developing an Electron wrapper for an existing web app hosted on a remote URL, you can add custom properties onto the renderer's <code>window</code> global that can be used for desktop-only logic on the web client's side.</li>\n</ul>",
      "title": "Modèle de processus",
      "description": "Note: A renderer process is also created for web embeds such as the BrowserView module. The webContents object is also accessible for embedded web content."
    },
    "/docs/api/structures/product": {
      "locale": "fr-FR",
      "slug": "product",
      "href": "/docs/api/structures/product",
      "crowdinFileId": "256485",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/product.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"product-object\"><a href=\"#product-object\">Product Object</a></h1>\n<ul>\n<li><code>productIdentifier</code> String - The string that identifies the product to the Apple App Store.</li>\n<li><code>localizedDescription</code> String - A description of the product.</li>\n<li><code>localizedTitle</code> String - The name of the product.</li>\n<li><code>contentVersion</code> String - A string that identifies the version of the content.</li>\n<li><code>contentLengths</code> Number[] - The total size of the content, in bytes.</li>\n<li><code>price</code> Number - The cost of the product in the local currency.</li>\n<li><code>formattedPrice</code> String - The locale formatted price of the product.</li>\n<li><code>currencyCode</code> String - 3 character code presenting a product's currency based on the ISO 4217 standard.</li>\n<li><code>isDownloadable</code> Boolean - A Boolean value that indicates whether the App Store has downloadable content for this product. <code>true</code> if at least one file has been associated with the product.</li>\n</ul>",
      "title": "Product Object",
      "description": ""
    },
    "/docs/tutorial/progress-bar": {
      "locale": "fr-FR",
      "slug": "progress-bar",
      "href": "/docs/tutorial/progress-bar",
      "crowdinFileId": "256235",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/progress-bar.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"barre-de-progression-de-la-barre-des-tâches-windows--macos\"><a href=\"#barre-de-progression-de-la-barre-des-tâches-windows--macos\">Barre de progression de la barre des tâches (Windows &#x26; macOS)</a></h1>\n<h2 id=\"vue-densemble\"><a href=\"#vue-densemble\">Vue d'ensemble</a></h2>\n<p>Une barre de progression permet à une fenêtre de fournir une informations à l'utilisateur sur la progression sans avoir besoin de basculer sur cette même fenêtre.</p>\n<p>Sous Windows, vous pouvez utiliser un bouton de la barre des tâches pour afficher une barre de progression.</p>\n<p>![Windows Progress Bar][<a href=\"https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png%5C\">https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png\\</a>]</p>\n<p>Sous macOS, la barre de progression s'affichera dans le cadre de l'icône du dock.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/macos-progress-bar.png\" alt=\"Barre de progression sous macOS\"></p>\n<p>Sur Linux, l’interface graphique Unity dispose également d’une fonctionnalité similaire qui vous permet de spécifier la barre de progression dans le lanceur.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/linux-progress-bar.png\" alt=\"Barre de progression sous Linux\"></p>\n<blockquote>\n<p>REMARQUE : sur Windows, chaque fenêtre peut avoir sa propre barre de progression, tandis que sur macOS et Linux (Unity) il ne peut y avoir qu’une seule barre de progression pour l’application.</p>\n</blockquote>\n<hr>\n<p>Les trois cas sont couverts par la même API - la méthode <a href=\"/docs/api/browser-window#winsetprogressbarprogress-options\"><code>setProgressBar()</code></a> disponible sur une instance de <code>BrowserWindows</code>. Pour indiquer l'état de la progression vous devez appeler cette méthode avec un nombre entre <code>0</code> et <code>1</code>. Par exemple: Si vous avez une tâche qui dure relativement longtemps et qui est en est actuellement à 63% avant sa finalisation, vous l'appelleriez avec <code>setProgressBar(0.63)</code>.</p>\n<p>Si le paramètre à une valeur négative (par exemple <code>-1</code>) cela supprimera la barre de progression. . Une valeur supérieure à <code>1</code> indiquera sous Windows une barre de progression indéfinie et la verrouillera à 100% avec les autres systèmes d'exploitation. Une barre de progression indéterminée reste active mais n’affiche pas de pourcentage réel et est utilisée pour les situations où on ne sait pas combien de temps une opération prendra pour se terminer.</p>\n<p>Voir la <a href=\"/docs/api/browser-window#winsetprogressbarprogress-options\">documentation API pour plus d'options et de modes</a>.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<p>Dans cet exemple, nous ajoutons une barre de progression à la fenêtre principale qui s’incrémente au fil du temps à l’aide des timers de Node.js.</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/progress-bar\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> progressInterval\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-keyword\">const</span> INCREMENT = <span class=\"hljs-number\">0.03</span>\n  <span class=\"hljs-keyword\">const</span> INTERVAL_DELAY = <span class=\"hljs-number\">100</span> <span class=\"hljs-comment\">// ms</span>\n\n  <span class=\"hljs-keyword\">let</span> c = <span class=\"hljs-number\">0</span>\n  progressInterval = setInterval(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// update progress bar to next value</span>\n    <span class=\"hljs-comment\">// values between 0 and 1 will show progress, >1 will show indeterminate or stick at 100%</span>\n    win.setProgressBar(c)\n\n    <span class=\"hljs-comment\">// increment or reset progress bar</span>\n    <span class=\"hljs-keyword\">if</span> (c &#x3C; <span class=\"hljs-number\">2</span>) c += INCREMENT\n    <span class=\"hljs-keyword\">else</span> c = <span class=\"hljs-number\">0</span>\n  }, INTERVAL_DELAY)\n}\n\napp.whenReady().then(createWindow)\n\n<span class=\"hljs-comment\">// before the app is terminated, clear both timers</span>\napp.on(<span class=\"hljs-string\">'before-quit'</span>, () => {\n  clearInterval(progressInterval)\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<p>Après le lancement de l’application Electron, le dock (macOS) ou la barre des tâches (Windows, Unity) affichera une barre de progression qui commence à zéro et progresse jusqu’à 100 % à la fin. Cela devrait alors s'afficher brièvement en indéterminé (Windows) ou vérouillé à 100% (autres systèmes d'exploitation), puis boucler.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/dock-progress-bar.png\" alt=\"Barre de progression du dock macOS\"></p>\n<p>Pour macOS, la barre de progression de votre application sera également indiquée lors de l'utilisation de <a href=\"https://support.apple.com/en-us/HT204100\">Mission Control</a>:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/mission-control-progress-bar.png\" alt=\"Barre de progression avec Mission Control\"></p>",
      "title": "Barre de progression de la barre des tâches (Windows & macOS)",
      "description": "REMARQUE : sur Windows, chaque fenêtre peut avoir sa propre barre de progression, tandis que sur macOS et Linux (Unity) il ne peut y avoir qu’une seule barre de progression pour l’application."
    },
    "/docs/api/protocol": {
      "locale": "fr-FR",
      "slug": "protocol",
      "href": "/docs/api/protocol",
      "crowdinFileId": "256357",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/protocol.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocol\"><a href=\"#protocol\">protocol</a></h1>\n<blockquote>\n<p>Enregistrez un protocole personnalisé et interceptez les requêtes de protocole existantes.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>Un exemple d'implémentation d'un protocole qui a le même effet que le protocole <code>file://</code> :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })\n})\n</code></pre>\n<p><strong>Note :</strong> Toutes les méthodes si non spécifiées ne peuvent être utilisées qu'après que l'évènement <code>ready</code> de l' <code>app</code> ne soit émis.</p>\n<h2 id=\"utiliser-protocole-avec-une-partition-personnalisée-ou-session\"><a href=\"#utiliser-protocole-avec-une-partition-personnalisée-ou-session\">Utiliser <code>protocole</code> avec une <code>partition</code> personnalisée ou <code>session</code></a></h2>\n<p>A protocol is registered to a specific Electron <a href=\"/docs/api/session\"><code>session</code></a> object. If you don't specify a session, then your <code>protocol</code> will be applied to the default session that Electron uses. However, if you define a <code>partition</code> or <code>session</code> on your <code>browserWindow</code>'s <code>webPreferences</code>, then that window will use a different session and your custom protocol will not work if you just use <code>electron.protocol.XXX</code>.</p>\n<p>To have your custom protocol work in combination with a custom session, you need to register it to that session explicitly.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session, app, protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> partition = <span class=\"hljs-string\">'persist:example'</span>\n  <span class=\"hljs-keyword\">const</span> ses = session.fromPartition(partition)\n\n  ses.protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })\n\n  mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { partition } })\n})\n</code></pre>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module <code>protocol</code> dispose des méthodes suivantes :</p>\n<h3 id=\"protocolregisterschemesaspriviledcustomschemes\"><a href=\"#protocolregisterschemesaspriviledcustomschemes\"><code>protocol.registerSchemesAsPriviled(customSchemes)</code></a></h3>\n<ul>\n<li><code>customSchemes</code> <a href=\"/docs/api/structures/custom-scheme\">CustomScheme[]</a></li>\n</ul>\n<p><strong>Note:</strong> Cette méthode ne peut être utilisée qu'avant l'événement <code>ready</code> du <code>app</code> est émis et ne peut être appelé qu'une seule fois.</p>\n<p>Registers the <code>scheme</code> as standard, secure, bypasses content security policy for resources, allows registering ServiceWorker, supports fetch API, and streaming video/audio. Specify a privilege with the value of <code>true</code> to enable the capability.</p>\n<p>An example of registering a privileged scheme, that bypasses Content Security Policy:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nprotocol.registerSchemesAsPrivileged([\n  { <span class=\"hljs-attr\">scheme</span>: <span class=\"hljs-string\">'foo'</span>, privilèges: { <span class=\"hljs-attr\">bypassCSP</span>: <span class=\"hljs-literal\">true</span> } }\n])\n</code></pre>\n<p>Un schéma standard adhère à ce que la RFC 3986 appelle la syntaxe <a href=\"https://tools.ietf.org/html/rfc3986#section-3\">générique de l'URI </a>. Par exemple <code>http</code> et <code>https</code> sont des schémas standard, alors que <code>file</code> ne l'est pas.</p>\n<p>Registering a scheme as standard allows relative and absolute resources to be resolved correctly when served. Sinon, le schéma se comportera comme le protocole <code>fichier</code>, mais sans la possibilité de résoudre les URL relatives.</p>\n<p>Par exemple lorsque vous chargez la page suivante avec un protocole personnalisé sans l'enregistrer en tant que schéma standard, l'image ne sera pas chargée car les schémas non standards ne peuvent pas reconnaître les URL relatives :</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">img</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">'test.png'</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n</code></pre>\n<p>L'enregistrement d'un schéma en tant que standard permettra l'accès aux fichiers via l'API <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/LocalFileSystem\">FileSystem API</a>. Sinon, le moteur de rendu lancera une erreur de sécurité pour le schéma.</p>\n<p>By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB, cookies) are disabled for non standard schemes. So in general if you want to register a custom protocol to replace the <code>http</code> protocol, you have to register it as a standard scheme.</p>\n<p>Protocols that use streams (http and stream protocols) should set <code>stream: true</code>. The <code>&#x3C;video></code> and <code>&#x3C;audio></code> HTML elements expect protocols to buffer their responses by default. The <code>stream</code> flag configures those elements to correctly expect streaming responses.</p>\n<h3 id=\"protocolregisterfileprotocolscheme-handler\"><a href=\"#protocolregisterfileprotocolscheme-handler\"><code>protocol.registerFileProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send a file as the response. The <code>handler</code> will be called with <code>request</code> and <code>callback</code> where <code>request</code> is an incoming request for the <code>scheme</code>.</p>\n<p>Pour gérer la <code>requête</code>, la <code>callback</code> doit être appelée soit avec le chemin du fichier, soit avec un objet qui a une propriété <code>chemin</code>. . <code>callback(filePath)</code> ou <code>callback({ path: filePath })</code>. The <code>filePath</code> must be an absolute path.</p>\n<p>By default the <code>scheme</code> is treated like <code>http:</code>, which is parsed differently from protocols that follow the \"generic URI syntax\" like <code>file:</code>.</p>\n<h3 id=\"protocolregisterbufferprotocolscheme-handler\"><a href=\"#protocolregisterbufferprotocolscheme-handler\"><code>protocol.registerBufferProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (Buffer | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Enregistre un protocole de <code>schéma</code> qui enverra un <code>Buffer</code> en tant que réponse.</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code> should be called with either a <code>Buffer</code> object or an object that has the <code>data</code> property.</p>\n<p>Exemple :</p>\n<pre><code class=\"hljs language-javascript\">protocol.registerBufferProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback({ <span class=\"hljs-attr\">mimeType</span>: <span class=\"hljs-string\">'text/html'</span>, <span class=\"hljs-attr\">data</span>: Buffer.from(<span class=\"hljs-string\">'&#x3C;h5>Response&#x3C;/h5>'</span>) })\n})\n</code></pre>\n<h3 id=\"protocolregisterstringprotocolscheme-handler\"><a href=\"#protocolregisterstringprotocolscheme-handler\"><code>protocol.registerStringProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Enregistre un protocole de <code>schéma</code> qui enverra une <code>String</code> en tant que réponse.</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code> should be called with either a <code>String</code> or an object that has the <code>data</code> property.</p>\n<h3 id=\"protocolregisterhttpprotocolscheme-handler\"><a href=\"#protocolregisterhttpprotocolscheme-handler\"><code>protocol.registerHttpProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> ProtocolResponse</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Enregistre un protocole de <code>schéma</code> qui enverra une requête HTTP en réponse.</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code> should be called with an object that has the <code>url</code> property.</p>\n<h3 id=\"protocolregisterstreamprotocolscheme-handler\"><a href=\"#protocolregisterstreamprotocolscheme-handler\"><code>protocol.registerStreamProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (ReadableStream | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send a stream as a response.</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code> should be called with either a <a href=\"https://nodejs.org/api/stream.html#stream_class_stream_readable\"><code>ReadableStream</code></a> object or an object that has the <code>data</code> property.</p>\n<p>Exemple :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { PassThrough } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'stream'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createStream</span> (<span class=\"hljs-params\">text</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> rv = <span class=\"hljs-keyword\">new</span> PassThrough() <span class=\"hljs-comment\">// PassThrough is also a Readable stream</span>\n  rv.push(text)\n  rv.push(<span class=\"hljs-literal\">null</span>)\n  <span class=\"hljs-keyword\">return</span> rv\n}\n\nprotocol.registerStreamProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback({\n    <span class=\"hljs-attr\">statusCode</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">headers</span>: {\n      <span class=\"hljs-string\">'content-type'</span>: <span class=\"hljs-string\">'text/html'</span>\n    },\n    <span class=\"hljs-attr\">data</span>: createStream(<span class=\"hljs-string\">'&#x3C;h5>Response&#x3C;/h5>'</span>)\n  })\n})\n</code></pre>\n<p>It is possible to pass any object that implements the readable stream API (emits <code>data</code>/<code>end</code>/<code>error</code> events). For example, here's how a file could be returned:</p>\n<pre><code class=\"hljs language-javascript\">protocol.registerStreamProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback(fs.createReadStream(<span class=\"hljs-string\">'index.html'</span>))\n})\n</code></pre>\n<h3 id=\"protocolunregisterprotocolscheme\"><a href=\"#protocolunregisterprotocolscheme\"><code>protocol.unregisterProtocol(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully unregistered</p>\n<p>Enregistre le protocole personnalisé de <code>schéma</code>.</p>\n<h3 id=\"protocolisprotocolregisteredscheme\"><a href=\"#protocolisprotocolregisteredscheme\"><code>protocol.isProtocolRegistered(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether <code>scheme</code> is already registered.</p>\n<h3 id=\"protocolinterceptfileprotocolscheme-handler\"><a href=\"#protocolinterceptfileprotocolscheme-handler\"><code>protocol.interceptFileProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepte le protocole <code>schéma</code> et utilise <code>handler</code> comme nouveau gestionnaire du protocole, qui envoie un fichier comme réponse.</p>\n<h3 id=\"protocolinterceptstringprotocolscheme-handler\"><a href=\"#protocolinterceptstringprotocolscheme-handler\"><code>protocol.interceptStringProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepte le protocole <code>schéma</code> et utilise <code>handler</code> comme nouveau gestionnaire du protocole, qui envoie une <code>String</code> comme réponse.</p>\n<h3 id=\"protocolinterceptbufferprotocolscheme-handler\"><a href=\"#protocolinterceptbufferprotocolscheme-handler\"><code>protocol.interceptBufferProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (Buffer | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepte le protocole <code>schéma</code> et utilise <code>handler</code> comme nouveau gestionnaire du protocole, qui envoie un <code>Buffer</code> comme réponse.</p>\n<h3 id=\"protocolintercepthttpprotocolscheme-handler\"><a href=\"#protocolintercepthttpprotocolscheme-handler\"><code>protocol.interceptHttpProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepte le protocole <code>schéma</code> et utilise <code>handler</code> comme nouveau gestionnaire du protocole, qui envoie une nouvelle requête HTTP comme réponse.</p>\n<h3 id=\"protocolinterceptstreamprotocolscheme-handler\"><a href=\"#protocolinterceptstreamprotocolscheme-handler\"><code>protocol.interceptStreamProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (ReadableStream | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Identique à <code>protocol.registerStreamProtocol</code>, excepté qu'il remplace un gestionnaire de protocole existant.</p>\n<h3 id=\"protocoluninterceptprotocolscheme\"><a href=\"#protocoluninterceptprotocolscheme\"><code>protocol.uninterceptProtocol(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully unintercepted</p>\n<p>Retirez l'intercepteur installé pour <code>schéma</code> et restaurez son gestionnaire d'origine.</p>\n<h3 id=\"protocolisprotocolinterceptedscheme\"><a href=\"#protocolisprotocolinterceptedscheme\"><code>protocol.isProtocolIntercepted(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether <code>scheme</code> is already intercepted.</p>",
      "title": "protocol",
      "description": "Enregistrez un protocole personnalisé et interceptez les requêtes de protocole existantes."
    },
    "/docs/api/structures/protocol-request": {
      "locale": "fr-FR",
      "slug": "protocol-request",
      "href": "/docs/api/structures/protocol-request",
      "crowdinFileId": "256487",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-request.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolrequest-object\"><a href=\"#protocolrequest-object\">ProtocolRequest Object</a></h1>\n<ul>\n<li><code>url</code> String</li>\n<li><code>referrer</code> String</li>\n<li><code>method</code> String</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/upload-data\">UploadData[]</a> (optional)</li>\n<li><code>headers</code> Record&#x3C;String, String></li>\n</ul>",
      "title": "ProtocolRequest Object",
      "description": ""
    },
    "/docs/api/structures/protocol-response": {
      "locale": "fr-FR",
      "slug": "protocol-response",
      "href": "/docs/api/structures/protocol-response",
      "crowdinFileId": "256491",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-response.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolresponse-object\"><a href=\"#protocolresponse-object\">ProtocolResponse Object</a></h1>\n<ul>\n<li><code>error</code> Integer (optional) - When assigned, the <code>request</code> will fail with the <code>error</code> number . For the available error numbers you can use, please see the <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">net error list</a>.</li>\n<li><code>statusCode</code> Number (optional) - The HTTP response code, default is 200.</li>\n<li><code>charset</code> String (optional) - The charset of response body, default is <code>\"utf-8\"</code>.</li>\n<li><code>mimeType</code> String (optional) - The MIME type of response body, default is <code>\"text/html\"</code>. Setting <code>mimeType</code> would implicitly set the <code>content-type</code> header in response, but if <code>content-type</code> is already set in <code>headers</code>, the <code>mimeType</code> would be ignored.</li>\n<li><code>headers</code> Record&#x3C;string, string | string[]> (optional) - An object containing the response headers. The keys must be String, and values must be either String or Array of String.</li>\n<li><code>data</code> (Buffer | String | ReadableStream) (optional) - The response body. When returning stream as response, this is a Node.js readable stream representing the response body. When returning <code>Buffer</code> as response, this is a <code>Buffer</code>. When returning <code>String</code> as response, this is a <code>String</code>. This is ignored for other types of responses.</li>\n<li><code>path</code> String (optional) - Path to the file which would be sent as response body. This is only used for file responses.</li>\n<li><code>url</code> String (optional) - Download the <code>url</code> and pipe the result as response body. This is only used for URL responses.</li>\n<li><code>referrer</code> String (optional) - The <code>referrer</code> URL. This is only used for file and URL responses.</li>\n<li><code>method</code> String (optional) - The HTTP <code>method</code>. This is only used for file and URL responses.</li>\n<li><code>session</code> Session (optional) - The session used for requesting URL, by default the HTTP request will reuse the current session. Setting <code>session</code> to <code>null</code> would use a random independent session. This is only used for URL responses.</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/protocol-response-upload-data\">ProtocolResponseUploadData</a> (optional) - The data used as upload data. This is only used for URL responses when <code>method</code> is <code>\"POST\"</code>.</li>\n</ul>",
      "title": "ProtocolResponse Object",
      "description": ""
    },
    "/docs/api/structures/protocol-response-upload-data": {
      "locale": "fr-FR",
      "slug": "protocol-response-upload-data",
      "href": "/docs/api/structures/protocol-response-upload-data",
      "crowdinFileId": "256489",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-response-upload-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolresponseuploaddata-object\"><a href=\"#protocolresponseuploaddata-object\">ProtocolResponseUploadData Object</a></h1>\n<ul>\n<li><code>contentType</code> String - MIME type of the content.</li>\n<li><code>data</code> String | Buffer - Content to be sent.</li>\n</ul>",
      "title": "ProtocolResponseUploadData Object",
      "description": ""
    },
    "/docs/development/pull-requests": {
      "locale": "fr-FR",
      "slug": "pull-requests",
      "href": "/docs/development/pull-requests",
      "crowdinFileId": "256163",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/pull-requests.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"pull-requests\"><a href=\"#pull-requests\">Pull Requests</a></h1>\n<ul>\n<li><a href=\"#setting-up-your-local-environment\">Configurer votre environnement local</a><ul>\n<li><a href=\"#step-1-fork\">Étape 1 : Dupliquer un projet</a></li>\n<li><a href=\"#step-2-build\">Etape 2 : Construire, compiler</a></li>\n<li><a href=\"#step-3-branch\">Step 3: Branches</a></li>\n</ul></li>\n<li><a href=\"#making-changes\">Apporter des changements</a><ul>\n<li><a href=\"#step-4-code\">Étape 4 : Code</a></li>\n<li><a href=\"#step-5-commit\">Étape 5 : modifications</a><ul>\n<li><a href=\"#commit-message-guidelines\">Ecrire un messages de modification</a></li>\n</ul></li>\n<li><a href=\"#step-6-rebase\">Étape 6 : Refonder - Rebase</a></li>\n<li><a href=\"#step-7-test\">Étape 7 : Tester</a></li>\n<li><a href=\"#step-8-push\">Étape 8 : Pousser</a></li>\n<li><a href=\"#step-9-opening-the-pull-request\">Étape 9 : Ouvrir la proposition d'évolution - la demande de Pull</a></li>\n<li><a href=\"#step-10-discuss-and-update\">Étape 10 : Examiner et mettre à jour</a><ul>\n<li><a href=\"#approval-and-request-changes-workflow\">Procédure de validation et de demandes d'évolutions</a></li>\n</ul></li>\n<li><a href=\"#step-11-landing\">Étape 11 : Approbation</a></li>\n<li><a href=\"#continuous-integration-testing\">Tests en intégration continue</a></li>\n</ul></li>\n</ul>\n<h2 id=\"configurer-votre-environnement-local\"><a href=\"#configurer-votre-environnement-local\">Configurer votre environnement local</a></h2>\n<h3 id=\"étape-1--dupliquer-un-projet\"><a href=\"#étape-1--dupliquer-un-projet\">Étape 1 : Dupliquer un projet</a></h3>\n<p>Fork the project <a href=\"https://github.com/electron/electron\">on GitHub</a> and clone your fork locally.</p>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:username/electron.git\n$ <span class=\"hljs-built_in\">cd</span> electron\n$ git remote add upstream https://github.com/electron/electron.git\n$ git fetch upstream\n</code></pre>\n<h3 id=\"etape-2--construire-compiler\"><a href=\"#etape-2--construire-compiler\">Etape 2 : Construire, compiler</a></h3>\n<p>Le type de système d'exploitation peut faire varier les étapes de construction et les dépendances. Reportez vous au guide dédié pour compiler Electron:</p>\n<ul>\n<li><a href=\"/docs/development/build-instructions-macos\">Building on macOS</a></li>\n<li><a href=\"/docs/development/build-instructions-linux\">Construire sous Linux</a></li>\n<li><a href=\"/docs/development/build-instructions-windows\">Construire sous Windows</a></li>\n</ul>\n<p>Dès que le projet est construit, vous pouvez apporter des modifications !</p>\n<h3 id=\"step-3-branches\"><a href=\"#step-3-branches\">Step 3: Branches</a></h3>\n<p>Pour un environnement de développement ordonné, créez une branche locale qui contiendra votre travail. Votre branche doit être crée directement à partir de la branche <code>main</code>.</p>\n<pre><code class=\"hljs language-sh\">$ git checkout -b my-branch -t upstream/main\n</code></pre>\n<h2 id=\"apporter-des-changements\"><a href=\"#apporter-des-changements\">Apporter des changements</a></h2>\n<h3 id=\"étape-4--code\"><a href=\"#étape-4--code\">Étape 4 : Code</a></h3>\n<p>Most pull requests opened against the <code>electron/electron</code> repository include changes to either the C/C++ code in the <code>shell/</code> folder, the JavaScript code in the <code>lib/</code> folder, the documentation in <code>docs/api/</code> or tests in the <code>spec/</code> folder.</p>\n<p>Penser à lancer régulièrement <code>npm run lint</code> après chaque évolution du code, pour en garantir la conformité de style du projet.</p>\n<p>Voir <a href=\"/docs/development/coding-style\">coding style</a> pour plus d'informations sur les meilleurs usages lors de modification de code dans les différentes parties du projet.</p>\n<h3 id=\"étape-5--modifications\"><a href=\"#étape-5--modifications\">Étape 5 : modifications</a></h3>\n<p>Il est recommandé de regrouper logiquement les modifications dans des commit dédiés. La plus-part des contributeurs préfèrent passer en revue les changements faits de plusieurs commit. Il est possible d'avoir autant de commit que nécessaire lors d'une proposition d'évolution - demande de Pull - .</p>\n<pre><code class=\"hljs language-sh\">$ git add my/changed/files\n$ git commit\n</code></pre>\n<p>Au final lorsqu'ils sont revus, de nombreux commit sont fusionnés.</p>\n<h4 id=\"ecrire-un-messages-de-modification\"><a href=\"#ecrire-un-messages-de-modification\">Ecrire un messages de modification</a></h4>\n<p>Un bon message de modification/commit doit décrire le changement et sa raison. The Electron project uses <a href=\"https://conventionalcommits.org/\">semantic commit messages</a> to streamline the release process.</p>\n<p>Before a pull request can be merged, it <strong>must</strong> have a pull request title with a semantic prefix.</p>\n<p>Exemples de messages de commit avec préfixes sémantiques :</p>\n<ul>\n<li><code>fix: don't overwrite prevent_default if default wasn't prevented</code></li>\n<li><code>feat: add app.isPackaged() method</code></li>\n<li><code>docs: app.isDefaultProtocolClient is now available on Linux</code></li>\n</ul>\n<p>Common prefixes:</p>\n<ul>\n<li>fix: A bug fix</li>\n<li>feat: A new feature</li>\n<li>docs: Documentation changes</li>\n<li>test: Adding missing tests or correcting existing tests</li>\n<li>build: Changes that affect the build system</li>\n<li>ci: Changes to our CI configuration files and scripts</li>\n<li>perf: A code change that improves performance</li>\n<li>refactor: A code change that neither fixes a bug nor adds a feature</li>\n<li>style: Changes that do not affect the meaning of the code (linting)</li>\n</ul>\n<p>Autres choses à garder à l'esprit lors de la rédaction d'un message de commit :</p>\n<ol>\n<li>La première ligne doit :<ul>\n<li>contain a short description of the change (preferably 50 characters or less, and no more than 72 characters)</li>\n<li>être entièrement en minuscules à l’exception des noms propres, acronymes et les mots qui font référence au code, comme les noms de variable/fonction</li>\n</ul></li>\n<li>Garder vide la deuxième ligne.</li>\n<li>Ne pas dépasser 72 caractères pour les lignes suivantes.</li>\n</ol>\n<h4 id=\"changements-de-rupture\"><a href=\"#changements-de-rupture\">Changements de rupture</a></h4>\n<p>A commit that has the text <code>BREAKING CHANGE:</code> at the beginning of its optional body or footer section introduces a breaking API change (correlating with Major in semantic versioning). A breaking change can be part of commits of any type. e.g., a <code>fix:</code>, <code>feat:</code> &#x26; <code>chore:</code> types would all be valid, in addition to any other type.</p>\n<p>Voir <a href=\"https://conventionalcommits.org\">conventionalcommits.org</a> pour plus de détails.</p>\n<h3 id=\"étape-6--refonder---rebase\"><a href=\"#étape-6--refonder---rebase\">Étape 6 : Refonder - Rebase</a></h3>\n<p>Une fois vos changements livrés-\"committés\", il est recommander d'utiliser <code>git rebase</code> plutôt que <code>git merge</code> pour réintégrer l'historique général dans votre branche de travail.</p>\n<pre><code class=\"hljs language-sh\">$ git fetch upstream\n$ git rebase upstream/main\n</code></pre>\n<p>Cela garantit que votre branche de travail a les dernières modifications de <code>electron/electron</code> main.</p>\n<h3 id=\"étape-7--tester\"><a href=\"#étape-7--tester\">Étape 7 : Tester</a></h3>\n<p>Corrections et fonctionnalités doivent toujours être accompagnées de tests. Un <a href=\"/docs/development/testing\">guide du test</a> est fourni pour rendre le travail plus facile. S'inspirer d'autres tests peut aussi aider.</p>\n<p>Exécutez toujours la suite de tests complète avant de soumettre une contribution. Pour exécuter les tests:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>Assurez-vous que linter ne renvoie aucun problème et que tous les tests passent. Ne soumettez aucun patch ne passant pas l'un des tests.</p>\n<p>If you are updating tests and want to run a single spec to check it:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span> -match=menu\n</code></pre>\n<p>The above would only run spec modules matching <code>menu</code>, which is useful for anyone who's working on tests that would otherwise be at the very end of the testing cycle.</p>\n<h3 id=\"étape-8--pousser\"><a href=\"#étape-8--pousser\">Étape 8 : Pousser</a></h3>\n<p>Dès que vos commit sont prêts -- tests et lint inclus --, la procédure de soumission commence par un push de votre branche vers votre fork sur Github.</p>\n<pre><code class=\"hljs language-sh\">$ git push origin my-branch\n</code></pre>\n<h3 id=\"étape-9--ouvrir-la-proposition-dévolution---la-demande-de-pull\"><a href=\"#étape-9--ouvrir-la-proposition-dévolution---la-demande-de-pull\">Étape 9 : Ouvrir la proposition d'évolution - la demande de Pull</a></h3>\n<p>Depuis GitHub, en ouvrant une proposition de contribution dite --pull request--, vous aurez à remplir un caneva :</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"xml\"><span class=\"hljs-comment\">&#x3C;!--\nThank you for your pull request. Please provide a description above and review\nthe requirements below.\n\nBug fixes and new features should include tests and possibly benchmarks.\n\nContributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.md\n--></span></span>\n</code></pre>\n<h3 id=\"étape-10--examiner-et-mettre-à-jour\"><a href=\"#étape-10--examiner-et-mettre-à-jour\">Étape 10 : Examiner et mettre à jour</a></h3>\n<p>You will probably get feedback or requests for changes to your pull request. Ceci est une grande partie du processus de soumission, donc ne soyez pas découragé ! Some contributors may sign off on the pull request right away. Others may have detailed comments or feedback. This is a necessary part of the process in order to evaluate whether the changes are correct and necessary.</p>\n<p>To make changes to an existing pull request, make the changes to your local branch, add a new commit with those changes, and push those to your fork. GitHub will automatically update the pull request.</p>\n<pre><code class=\"hljs language-sh\">$ git add my/changed/files\n$ git commit\n$ git push origin my-branch\n</code></pre>\n<p>There are a number of more advanced mechanisms for managing commits using <code>git rebase</code> that can be used, but are beyond the scope of this guide.</p>\n<p>Feel free to post a comment in the pull request to ping reviewers if you are awaiting an answer on something. If you encounter words or acronyms that seem unfamiliar, refer to this <a href=\"https://sites.google.com/a/chromium.org/dev/glossary\">glossary</a>.</p>\n<h4 id=\"procédure-de-validation-et-de-demandes-dévolutions\"><a href=\"#procédure-de-validation-et-de-demandes-dévolutions\">Procédure de validation et de demandes d'évolutions</a></h4>\n<p>Toutes les demandes de pull nécessitent l'approbation d'un propriétaire de code <a href=\"https://github.com/electron/electron/blob/main/.github/CODEOWNERS\">Code Owner</a> de la zone que vous avez modifiée. Whenever a maintainer reviews a pull request they may request changes. These may be small, such as fixing a typo, or may involve substantive changes. Such requests are intended to be helpful, but at times may come across as abrupt or unhelpful, especially if they do not include concrete suggestions on <em>how</em> to change them.</p>\n<p>Essayez de ne pas vous décourager. If you feel that a review is unfair, say so or seek the input of another project contributor. Often such comments are the result of a reviewer having taken insufficient time to review and are not ill-intended. Such difficulties can often be resolved with a bit of patience. That said, reviewers should be expected to provide helpful feedback.</p>\n<h3 id=\"étape-11--approbation\"><a href=\"#étape-11--approbation\">Étape 11 : Approbation</a></h3>\n<p>In order to land, a pull request needs to be reviewed and approved by at least one Electron Code Owner and pass CI. After that, if there are no objections from other contributors, the pull request can be merged.</p>\n<p>Félicitations et merci pour votre contribution !</p>\n<h3 id=\"tests-en-intégration-continue\"><a href=\"#tests-en-intégration-continue\">Tests en intégration continue</a></h3>\n<p>Every pull request is tested on the Continuous Integration (CI) system to confirm that it works on Electron's supported platforms.</p>\n<p>Ideally, the pull request will pass (\"be green\") on all of CI's platforms. This means that all tests pass and there are no linting errors. However, it is not uncommon for the CI infrastructure itself to fail on specific platforms or for so-called \"flaky\" tests to fail (\"be red\"). Each CI failure must be manually inspected to determine the cause.</p>\n<p>CI starts automatically when you open a pull request, but only core maintainers can restart a CI run. If you believe CI is giving a false negative, ask a maintainer to restart the tests.</p>",
      "title": "Pull Requests",
      "description": ""
    },
    "/docs/tutorial/quick-start": {
      "locale": "fr-FR",
      "slug": "quick-start",
      "href": "/docs/tutorial/quick-start",
      "crowdinFileId": "256237",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/quick-start.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"démarrage-rapide\"><a href=\"#démarrage-rapide\">Démarrage Rapide</a></h1>\n<p>Ce tutoriel vous guidera dans le processus de création d'une application Hello World dans Electron, similaire à <a href=\"https://github.com/electron/electron-quick-start\"><code>electron/electron-quick-start</code></a>.</p>\n<p>À la fin de ce tutoriel, votre application ouvrira une fenêtre de navigateur qui affichera une page web avec des informations sur quelles versions de Chromium, de Node.js et d'Electron sont en cours d'exécution.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<p>Pour utiliser Electron, vous devez installer <a href=\"https://nodejs.org/en/download/\">Node.js</a>. Nous vous recommandons d'utiliser la dernière version <code>LTS</code> disponible.</p>\n<blockquote>\n<p>Please install Node.js using pre-built installers for your platform. You may encounter incompatibility issues with different development tools otherwise.</p>\n</blockquote>\n<p>Pour vérifier que Node.js a été installé correctement, tapez les commandes suivantes dans votre terminal client :</p>\n<pre><code class=\"hljs language-sh\">node -v\nnpm -v\n</code></pre>\n<p>Les commandes devraient imprimer respectivement les versions de Node.js et npm.</p>\n<p><strong>Remarque :</strong> Puisque Electron embarque Node.js dans son binaire, la version de Node.js exécutant votre code n'est pas lié à la version en cours d'exécution sur votre système.</p>\n<h2 id=\"créer-votre-application\"><a href=\"#créer-votre-application\">Créer votre application</a></h2>\n<h3 id=\"initialisation-du-projet\"><a href=\"#initialisation-du-projet\">Initialisation du projet</a></h3>\n<p>Les applications Electron suivent la même structure générale que les autres projets Node.js. Commencez par créer un dossier et initialiser un package npm.</p>\n<pre><code class=\"hljs language-sh\">mkdir my-electron-app &#x26;&#x26; <span class=\"hljs-built_in\">cd</span> my-electron-app\nnpm init\n</code></pre>\n<p>La commande interactive <code>init</code> vous demandera de définir quelques champs dans votre configuration. Il y a quelques règles à suivre pour les besoins de ce didacticiel :</p>\n<ul>\n<li><code>entry point</code> devrait être <code>main.js</code>.</li>\n<li><code>author</code> et <code>description</code> peuvent être n’importe quelle valeur, mais sont nécessaires pour <a href=\"#package-and-distribute-your-application\">le packaging de l'application</a>.</li>\n</ul>\n<p>Votre fichier <code>package.json</code> devrait ressembler à ceci :</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"my-electron-app\"</span>,\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"1.0.0\"</span>,\n  <span class=\"hljs-attr\">\"description\"</span>: <span class=\"hljs-string\">\"Hello World!\"</span>,\n  <span class=\"hljs-attr\">\"main\"</span>: <span class=\"hljs-string\">\"main.js\"</span>,\n  <span class=\"hljs-attr\">\"author\"</span>: <span class=\"hljs-string\">\"Jane Doe\"</span>,\n  <span class=\"hljs-attr\">\"license\"</span>: <span class=\"hljs-string\">\"MIT\"</span>\n}\n</code></pre>\n<p>Ensuite, installez le package <code>electron</code> dans les <code>devDependencies</code> de votre application.</p>\n<pre><code class=\"hljs language-sh\">$ npm install --save-dev electron\n</code></pre>\n<blockquote>\n<p>Remarque : Si vous rencontrez des problèmes avec l'installation d'Electron, veuillez consulter le guide <a href=\"/docs/tutorial/installation\">Installation avancée</a>.</p>\n</blockquote>\n<p>Enfin, vous voulez pouvoir exécuter Electron. Dans le champ <a href=\"https://docs.npmjs.com/cli/v7/using-npm/scripts\"><code>scripts</code></a> de votre fichier de configuration <code>package.json</code> , ajoutez une commande <code>start</code> comme suit :</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"scripts\"</span>: {\n    <span class=\"hljs-attr\">\"start\"</span>: <span class=\"hljs-string\">\"electron .\"</span>\n  }\n}\n</code></pre>\n<p>Cette commande <code>start</code> vous permettra d'ouvrir votre application en mode développement.</p>\n<pre><code class=\"hljs language-sh\">npm start\n</code></pre>\n<blockquote>\n<p>Remarque : Ce script indique à Electron de s’exécuter à la racine du dossier de votre projet. À ce stade, votre application va immédiatement lancer une erreur vous disant qu'elle ne trouve pas d'application à exécuter.</p>\n</blockquote>\n<h3 id=\"exécuter-le-processus-principal\"><a href=\"#exécuter-le-processus-principal\">Exécuter le processus principal</a></h3>\n<p>Le point d’entrée de toute application Electron est son script <code>main</code>. Ce script contrôle le <strong>processus principal</strong>, qui s'exécute dans un environnement Node.js et est responsable de contrôler le cycle de vie de votre application, d'afficher les interfaces natives, d'effectuer des opérations privilégiées et de gérer les processus de rendu (plus d'information à ce sujet par la suite).</p>\n<p>Pendant l’exécution, Electron va chercher ce script dans le champ <a href=\"https://docs.npmjs.com/cli/v7/configuring-npm/package-json#main\"><code>main</code></a> du fichier de configuration <code>package.json</code> de l’application que vous devriez avoir configuré lors de l’étape <a href=\"#scaffold-the-project\">Initialisation du projet</a>.</p>\n<p>Pour initialiser le script <code>main</code>, créez un fichier vide nommé <code>main.js</code> dans le dossier racine de votre projet.</p>\n<blockquote>\n<p>Remarque : Si vous exécutez à nouveau le script <code>start</code> à ce stade, votre application ne lancera plus d'erreur ! Cependant, il ne fera rien pour le moment parce que nous n'avons pas ajouté de code dans <code>main.js</code>.</p>\n</blockquote>\n<h3 id=\"créer-une-page-web\"><a href=\"#créer-une-page-web\">Créer une page Web</a></h3>\n<p>Avant de pouvoir créer une fenêtre pour notre application, nous devons créer le contenu qui sera chargé dedans. Dans Electron, chaque fenêtre affiche le contenu Web qui peut être chargé à partir d'un fichier HTML local ou d'une URL distante.</p>\n<p>Pour ce tutoriel, vous allez faire le premier. Créez un fichier <code>index.html</code> à la racine de votre projet :</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-comment\">&#x3C;!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"X-Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    Nous utilisons Node.js <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"node-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    Chromium <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"chrome-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    et Electron <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"electron-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>.\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<blockquote>\n<p>Remarque : en regardant ce document HTML, vous pouvez observer que les numéros de version sont manquants du texte du body. Nous les insérerons manuellement plus tard à l’aide de JavaScript.</p>\n</blockquote>\n<h3 id=\"ouverture-de-votre-page-web-dans-une-fenêtre-de-navigateur\"><a href=\"#ouverture-de-votre-page-web-dans-une-fenêtre-de-navigateur\">Ouverture de votre page web dans une fenêtre de navigateur</a></h3>\n<p>Maintenant que vous avez une page web, chargez-la dans une fenêtre d'application. Pour ce faire, vous aurez besoin de deux modules Electron :</p>\n<ul>\n<li>Le module <a href=\"/docs/api/app\"><code>app</code></a>, qui contrôle le cycle de vie des événements de votre application.</li>\n<li>Le module <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>, qui crée et gère les fenêtres d’application.</li>\n</ul>\n<p>Étant donné que le processus principal exécute Node.js, vous pouvez importer ces derniers en tant que modules <a href=\"https://nodejs.org/docs/latest/api/modules.html#modules_modules_commonjs_modules\">CommonJS</a> en haut de votre fichier :</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>Ensuite, ajoutez une fonction <code>createWindow()</code> qui charge <code>index.html</code> dans une nouvelle instance <code>BrowserWindow</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n</code></pre>\n<p>Ensuite, appelez cette fonction <code>createWindow()</code> pour ouvrir votre fenêtre.</p>\n<p>Dans Electron, les fenêtres du navigateur ne peuvent être créées qu'après que l’événement <a href=\"/docs/api/app#event-ready\"><code>ready</code></a> du module <code>app</code> est déclenché. Vous pouvez attendre cet événement en utilisant l'API <a href=\"/docs/api/app#appwhenready\"><code>app.whenReady()</code></a>. Appelez <code>createWindow()</code> après que <code>whenReady()</code> a résolu sa Promise.</p>\n<pre><code class=\"hljs language-js\">app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n})\n</code></pre>\n<blockquote>\n<p>Remarque : À ce stade, votre application Electron devrait ouvrir avec succès une fenêtre qui affiche votre page web !</p>\n</blockquote>\n<h3 id=\"gérer-le-cycle-de-vie-de-votre-fenêtre\"><a href=\"#gérer-le-cycle-de-vie-de-votre-fenêtre\">Gérer le cycle de vie de votre fenêtre</a></h3>\n<p>Bien que vous puissiez maintenant ouvrir une fenêtre de navigateur, vous aurez besoin de code boilerplate supplémentaire pour le rendre plus natif de chaque plate-forme. Les fenêtres d’application se comportent différemment sur chaque système d’exploitation et Electron met la responsabilité sur les développeurs d’implémenter ces conventions dans leur application.</p>\n<p>En général, vous pouvez utiliser l'attribut <a href=\"https://nodejs.org/api/process.html#process_process_platform\"><code>platform</code></a> de la variable globale <code>process</code> pour exécuter du code spécifiquement pour certains systèmes d’exploitation.</p>\n<h4 id=\"quitter-lapplication-lorsque-toutes-les-fenêtres-sont-fermées-windows--linux\"><a href=\"#quitter-lapplication-lorsque-toutes-les-fenêtres-sont-fermées-windows--linux\">Quitter l'application lorsque toutes les fenêtres sont fermées (Windows &#x26; Linux)</a></h4>\n<p>Sur Windows et Linux, quitter toutes les fenêtres quitte généralement une application entièrement.</p>\n<p>To implement this, listen for the <code>app</code> module's <a href=\"/docs/api/app#event-window-all-closed\"><code>'window-all-closed'</code></a> event, and call <a href=\"/docs/api/app#appquit\"><code>app.quit()</code></a> if the user is not on macOS (<code>darwin</code>).</p>\n<pre><code class=\"hljs language-js\">app.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h4 id=\"ouvrir-une-fenêtre-si-aucune-nest-ouverte-macos\"><a href=\"#ouvrir-une-fenêtre-si-aucune-nest-ouverte-macos\">Ouvrir une fenêtre si aucune n'est ouverte (macOS)</a></h4>\n<p>Alors que les applications Linux et Windows se ferment lorsqu'elles n'ont pas de fenêtres ouvertes, les applications macOS continuent généralement de s'exécuter même sans aucune fenêtre ouverte et activer l'application lorsqu'aucune fenêtre n'est disponible devrait en ouvrir une nouvelle.</p>\n<p>To implement this feature, listen for the <code>app</code> module's <a href=\"/docs/api/app#event-activate-macos\"><code>activate</code></a> event, and call your existing <code>createWindow()</code> method if no browser windows are open.</p>\n<p>Étant donné que les fenêtres ne peuvent pas être créées avant l'événement <code>ready</code> , vous ne devriez écouter l'événement <code>activate</code> qu'après l'initialisation de votre application. Pour ce faire, attachez votre event listener à partir de votre callback <code>whenReady()</code> existant.</p>\n<pre><code class=\"hljs language-js\">app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) createWindow()\n  })\n})\n</code></pre>\n<blockquote>\n<p>Remarque: À ce stade, vos contrôles de fenêtre doivent être entièrement fonctionnels!</p>\n</blockquote>\n<h3 id=\"accéder-à-nodejs-depuis-le-moteur-de-rendu-avec-un-script-de-préchargement\"><a href=\"#accéder-à-nodejs-depuis-le-moteur-de-rendu-avec-un-script-de-préchargement\">Accéder à Node.js depuis le moteur de rendu avec un script de préchargement</a></h3>\n<p>Maintenant, la dernière chose à faire est d'afficher les numéros de version pour Electron et ses dépendances sur votre page web.</p>\n<p>L’accès à ces informations est trivial à faire dans le processus principal via l’objet global <code>process</code> de Node. Cependant, vous ne pouvez pas simplement modifier le DOM à partir du processus principal car il n'a pas accès au contexte du <code>document</code> du moteur de rendu. Ils sont dans des processus entièrement différents!</p>\n<blockquote>\n<p>Note: If you need a more in-depth look at Electron processes, see the <a href=\"/docs/tutorial/process-model\">Process Model</a> document.</p>\n</blockquote>\n<p>C'est là que l'attachement d'un script <strong>preload</strong> à votre moteur de rendu est pratique. Un script de préchargement s'exécute avant que le processus de rendu soit chargé, et a accès aux deux renderer globals (e. <code>window</code> et <code>document</code>) et environnement Node.js.</p>\n<p>Créer un nouveau script nommé <code>preload.js</code> :</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'DOMContentLoaded'</span>, () => {\n  <span class=\"hljs-keyword\">const</span> replaceText = <span class=\"hljs-function\">(<span class=\"hljs-params\">selector, text</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> element = <span class=\"hljs-built_in\">document</span>.getElementById(selector)\n    <span class=\"hljs-keyword\">if</span> (element) element.innerText = text\n  }\n\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> dependency <span class=\"hljs-keyword\">of</span> [<span class=\"hljs-string\">'chrome'</span>, <span class=\"hljs-string\">'node'</span>, <span class=\"hljs-string\">'electron'</span>]) {\n    replaceText(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${dependency}</span>-version`</span>, process.versions[dependency])\n  }\n})\n</code></pre>\n<p>Le code ci-dessus accède à l'objet <code>process.versions</code> de Node.js et exécute une fonction d'aide de <code>replaceText</code> de base pour insérer les numéros de version dans le document HTML.</p>\n<p>Pour attacher ce script à votre processus de rendu, passez le chemin d’accès à votre script de préchargement à l’option <code>webPreferences.preload</code> dans votre constructeur <code>BrowserWindow</code> existant.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// inclus le module 'path' tout en haut du fichier</span>\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-comment\">// modifier votre fonction createWindow()</span>\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n<span class=\"hljs-comment\">// ...</span>\n</code></pre>\n<p>Il y a deux concepts Node.js qui sont utilisés ici :</p>\n<ul>\n<li>The <a href=\"https://nodejs.org/api/modules.html#modules_dirname\"><code>__dirname</code></a> string points to the path of the currently executing script (in this case, your project's root folder).</li>\n<li>The <a href=\"https://nodejs.org/api/path.html#path_path_join_paths\"><code>path.join</code></a> API joins multiple path segments together, creating a combined path string that works across all platforms.</li>\n</ul>\n<p>Nous utilisons un chemin relatif au fichier JavaScript en cours d'exécution afin que votre chemin relatif fonctionne en mode développement et en mode packaged.</p>\n<h3 id=\"bonus--ajoutez-des-fonctionnalités-à-vos-contenus-web\"><a href=\"#bonus--ajoutez-des-fonctionnalités-à-vos-contenus-web\">Bonus : Ajoutez des fonctionnalités à vos contenus web</a></h3>\n<p>À ce stade, vous pourriez vous demander comment ajouter plus de fonctionnalités à votre application.</p>\n<p>Pour toute interaction avec votre contenu web, vous souhaitez ajouter des scripts à votre processus de rendu. Parce que le moteur de rendu fonctionne dans un environnement web normal, vous pouvez ajouter une balise <code>&#x3C;script></code> juste avant votre balise de fermeture <code>&#x3C;/body></code> du fichier <code>index.html</code> pour inclure n'importe quel script de votre choix :</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"./renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<p>The code contained in <code>renderer.js</code> can then use the same JavaScript APIs and tooling you use for typical front-end development, such as using <a href=\"https://webpack.js.org\"><code>webpack</code></a> to bundle and minify your code or <a href=\"https://reactjs.org\">React</a> to manage your user interfaces.</p>\n<h3 id=\"récapitulatif\"><a href=\"#récapitulatif\">Récapitulatif</a></h3>\n<p>Après avoir suivi les étapes ci-dessus, vous devriez avoir une application Electron entièrement fonctionnelle qui ressemble à ceci :</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/simplest-electron-app.png\" alt=\"Application Electron la plus simple\"></p>\n<!--TODO(erickzhao): Remove the individual code blocks for static website -->\n<p>Le code complet est disponible ci-dessous :</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\n\n<span class=\"hljs-comment\">// Modules pour controler la vie de l'application et créer une fenêtre de navigation native</span>\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-comment\">// Créer la fenêtre de navigation.</span>\n  <span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  <span class=\"hljs-comment\">// et charger l'index.html de l'application.</span>\n  mainWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-comment\">// Ouvrir les outils de développement.</span>\n  <span class=\"hljs-comment\">// mainWindow.webContents.openDevTools()</span>\n}\n\n<span class=\"hljs-comment\">// Cette méthode sera appelée quand Electron aura fini</span>\n<span class=\"hljs-comment\">// de s'initialiser et sera prêt à créer des fenêtres de navigation.</span>\n<span class=\"hljs-comment\">// Certaines APIs peuvent être utilisées uniquement quant cet événement est émit.</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n    <span class=\"hljs-comment\">// Sur macOS il est d'usage de recréer une fenêtre dans l'application quand</span>\n    <span class=\"hljs-comment\">// l'icône du dock est cliquée et qu'il n'y a pas d'autre fenêtre ouverte.</span>\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) createWindow()\n  })\n})\n\n<span class=\"hljs-comment\">// Quitter quand toutes les fenêtres sont fermées, sauf sur macOS. Sur macOS, il est courant</span>\n<span class=\"hljs-comment\">// pour les applications et leur barre de menu de rester actives jusqu’à ce que l’utilisateur quitte</span>\n<span class=\"hljs-comment\">// explicitement avec Cmd + Q.</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n\n<span class=\"hljs-comment\">// Dans ce fichier, vous pouvez inclure le reste du code spécifique du</span>\n<span class=\"hljs-comment\">// processus principal de votre application. Vous pouvez également le mettre dans des fichiers séparés et les inclure ici.</span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// preload.js</span>\n\n<span class=\"hljs-comment\">// Toutes les APIs Node.js sont disponibles dans le processus de préchargement.</span>\n<span class=\"hljs-comment\">// Il a la même sandbox qu'une extension Chrome.</span>\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'DOMContentLoaded'</span>, () => {\n  <span class=\"hljs-keyword\">const</span> replaceText = <span class=\"hljs-function\">(<span class=\"hljs-params\">selector, text</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> element = <span class=\"hljs-built_in\">document</span>.getElementById(selector)\n    <span class=\"hljs-keyword\">if</span> (element) element.innerText = text\n  }\n\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> dependency <span class=\"hljs-keyword\">of</span> [<span class=\"hljs-string\">'chrome'</span>, <span class=\"hljs-string\">'node'</span>, <span class=\"hljs-string\">'electron'</span>]) {\n    replaceText(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${dependency}</span>-version`</span>, process.versions[dependency])\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!--index.html--></span>\n\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-comment\">&#x3C;!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"X-Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    Nous utilisons Node.js <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"node-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    Chromium <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"chrome-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    et Electron <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"electron-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>.\n\n    <span class=\"hljs-comment\">&#x3C;!-- Vous pouvez également requérir que d’autres fichiers s’exécutent dans ce processus --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"./renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>Pour résumer toutes les étapes que nous avons effectuées :</p>\n<ul>\n<li>\n<p>Nous avons amorcé une application Node.js et ajouté Electron en tant que dépendance.</p>\n</li>\n<li>\n<p>Nous avons créé un script <code>main.js</code> qui exécute notre processus principal, qui contrôle notre application et s'exécute dans un environnement Node.js. Dans ce script, nous avons utilisé les modules d'Electron <code>app</code> et <code>BrowserWindow</code> pour créer une fenêtre de navigateur qui affiche le contenu web dans un processus séparé (le moteur de rendu).</p>\n</li>\n<li>\n<p>Afin d'accéder à certaines fonctionnalités de Node.js dans le moteur de rendu, nous avons attaché un script de préchargement à notre constructeur <code>BrowserWindow</code>.</p>\n</li>\n</ul>\n<h2 id=\"packager-et-distribuer-votre-application\"><a href=\"#packager-et-distribuer-votre-application\">Packager et distribuer votre application</a></h2>\n<p>Le moyen le plus rapide de distribuer votre application nouvellement créée est d'utiliser\n<a href=\"https://www.electronforge.io\">Electron Forge</a>.</p>\n<ol>\n<li>\n<p>Ajouter Electron Forge comme dépendance de développement de votre application et utiliser sa commande <code>import</code> pour commencer l'initialisation de Forge :</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev @electron-forge/cli\nnpx electron-forge import\n\n✔ Checking your system\n✔ Initializing Git Repository\n✔ Writing modified package.json file\n✔ Installing dependencies\n✔ Writing modified package.json file\n✔ Fixing .gitignore\n\nWe have ATTEMPTED to convert your app to be <span class=\"hljs-keyword\">in</span> a format that electron-forge understands.\n\nThanks <span class=\"hljs-keyword\">for</span> using <span class=\"hljs-string\">\"electron-forge\"</span>!!!\n</code></pre>\n</li>\n<li>\n<p>Créez une distribution en utilisant la commande <code>make</code> de Forge :</p>\n<pre><code class=\"hljs language-sh\">npm run make\n\n> my-electron-app@1.0.0 make /my-electron-app\n> electron-forge make\n\n✔ Checking your system\n✔ Resolving Forge Config\nWe need to package your application before we can make it\n✔ Preparing to Package Application <span class=\"hljs-keyword\">for</span> arch: x64\n✔ Preparing native dependencies\n✔ Packaging Application\nMaking <span class=\"hljs-keyword\">for</span> the following targets: zip\n✔ Making <span class=\"hljs-keyword\">for</span> target: zip - On platform: darwin - For arch: x64\n</code></pre>\n<p>Electron Forge crée le dossier <code>out</code> où se trouvera votre paquet:</p>\n<pre><code class=\"hljs language-plain\">// Exemple pour macOS\nout/\n├── out/make/zip/darwin/x64/my-electron-app-darwin-x64-1.0.0.zip\n├── ...\n└── out/my-electron-app-darwin-x64/my-electron-app.app/Contents/MacOS/my-electron-app\n</code></pre>\n</li>\n</ol>",
      "title": "Démarrage Rapide",
      "description": "Please install Node.js using pre-built installers for your platform. You may encounter incompatibility issues with different development tools otherwise."
    },
    "/docs/README": {
      "locale": "fr-FR",
      "slug": "README",
      "href": "/docs/README",
      "crowdinFileId": "256115",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/README.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"guide-officiel\"><a href=\"#guide-officiel\">Guide officiel</a></h1>\n<p>Veuillez vous assurer d'utiliser la documentation qui correspond à votre version d'Electron. Le numéro de version doit être une partie de l'URL de la page. Si ce n'est pas le cas, vous utilisez probablement la documentation d'une branche de développement pouvant contenir des modifications de l'API qui ne sont pas compatibles avec votre version d'Electron. Pour consulter les anciennes versions de la documentation, vous pouvez <a href=\"https://github.com/electron/electron/tree/v1.4.0\">Parcourir par tag</a> sur GitHub en ouvrant la liste déroulante « Switch branches/tags » et sélectionnez le tag qui correspond à votre version.</p>\n<h2 id=\"faq\"><a href=\"#faq\">FAQ</a></h2>\n<p>Caertaines questions qui sont assez souvent posées. Vérifiez ceci avant de déclarer un problème:</p>\n<ul>\n<li><a href=\"/docs/faq\">FAQ Electron</a></li>\n</ul>\n<h2 id=\"guides-et-tutoriels\"><a href=\"#guides-et-tutoriels\">Guides et tutoriels</a></h2>\n<h3 id=\"premiers-pas\"><a href=\"#premiers-pas\">Premiers Pas</a></h3>\n<ul>\n<li><a href=\"/docs/tutorial/introduction\">Introduction</a></li>\n<li><a href=\"/docs/tutorial/quick-start\">Démarrage Rapide</a></li>\n<li><a href=\"/docs/tutorial/process-model\">Modèle de processus</a></li>\n</ul>\n<h3 id=\"apprendre-les-bases\"><a href=\"#apprendre-les-bases\">Apprendre les bases</a></h3>\n<ul>\n<li>Ajouter des fonctionnalités à votre App<ul>\n<li><a href=\"/docs/tutorial/notifications\">Notifications</a></li>\n<li><a href=\"/docs/tutorial/recent-documents\">Documents récents</a></li>\n<li><a href=\"/docs/tutorial/progress-bar\">Progression de l'Application</a></li>\n<li><a href=\"/docs/tutorial/macos-dock\">Menu Dock personnalisé</a></li>\n<li><a href=\"/docs/tutorial/windows-taskbar\">Barre des tâches Windows personnalisée</a></li>\n<li><a href=\"/docs/tutorial/linux-desktop-actions\">Actions de bureau Linux personnalisées</a></li>\n<li><a href=\"/docs/tutorial/keyboard-shortcuts\">Raccourcis clavier</a></li>\n<li><a href=\"/docs/tutorial/online-offline-events\">Détection en ligne/hors ligne</a></li>\n<li><a href=\"/docs/tutorial/represented-file\">Fichier représenté pour BrowserWindows sur macOS</a></li>\n<li><a href=\"/docs/tutorial/native-file-drag-drop\">Fichier natif Drag &#x26; Drop</a></li>\n<li><a href=\"/docs/tutorial/offscreen-rendering\">Rendu hors de l'écran</a></li>\n<li><a href=\"/docs/tutorial/dark-mode\">Thème Sombre</a></li>\n<li><a href=\"/docs/tutorial/web-embeds\">Les web embeds dans Electron</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis\">Les Boilerplates et CLIs</a><ul>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#boilerplate-vs-cli\">Boilerplate vs CLI</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-forge\">electron-forge</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-builder\">electron-builder</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-react-boilerplate\">electron-react-boilerplate</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#other-tools-and-boilerplates\">Autres outils et boilerplates</a></li>\n</ul></li>\n</ul>\n<h3 id=\"sujets-avancés\"><a href=\"#sujets-avancés\">Sujets Avancés</a></h3>\n<ul>\n<li>Architecture d'une application<ul>\n<li><a href=\"/docs/tutorial/using-native-node-modules\">Utilisation des Modules Natifs de Node.js</a></li>\n<li><a href=\"/docs/tutorial/performance\">Stratégies de performance</a></li>\n<li><a href=\"/docs/tutorial/security\">Stratégies de sécurité</a></li>\n<li><a href=\"/docs/tutorial/sandbox\">Mise en bac à sable de processus</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/accessibility\">Accessibilité</a><ul>\n<li><a href=\"/docs/tutorial/accessibility#manually-enabling-accessibility-features\">Activation manuelle des fonctionnalités d’accessibilité</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/application-debugging\">Test et débogage</a><ul>\n<li><a href=\"/docs/tutorial/debugging-main-process\">Débogguer le Processus Principal</a></li>\n<li><a href=\"/docs/tutorial/debugging-vscode\">Débogage avec Visual Studio Code</a></li>\n<li><a href=\"/docs/tutorial/using-selenium-and-webdriver\">Utilisation de Selenium et WebDriver</a></li>\n<li><a href=\"/docs/tutorial/testing-on-headless-ci\">Tests sur les systèmes CI (Travis, Jenkins)</a></li>\n<li><a href=\"/docs/tutorial/devtools-extension\">Extension DevTools</a></li>\n<li><a href=\"/docs/tutorial/automated-testing-with-a-custom-driver\">Test automatisé avec un driver personalisé</a></li>\n<li><a href=\"/docs/tutorial/repl\">REPL</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/application-distribution\">Distribution</a><ul>\n<li><a href=\"/docs/tutorial/support#supported-platforms\">Plateformes supportées</a></li>\n<li><a href=\"/docs/tutorial/code-signing\">Signature de code</a></li>\n<li><a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store</a></li>\n<li><a href=\"/docs/tutorial/windows-store-guide\">Windows Store</a></li>\n<li><a href=\"/docs/tutorial/snapcraft\">Snapcraft</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/updates\">Mises à jour</a><ul>\n<li><a href=\"/docs/tutorial/updates#deploying-an-update-server\">Déploiement d’un serveur de mise à jour</a></li>\n<li><a href=\"/docs/tutorial/updates#implementing-updates-in-your-app\">Implémentation des mises à jour dans votre application</a></li>\n<li><a href=\"/docs/tutorial/updates#applying-updates\">Application des mises à jour</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/support\">Obtenir de l'aide</a></li>\n</ul>\n<h2 id=\"tutoriels-détaillés\"><a href=\"#tutoriels-détaillés\">Tutoriels détaillés</a></h2>\n<p>Ces tutoriels individuels développent les sujets abordés dans le guide ci-dessus.</p>\n<ul>\n<li><a href=\"/docs/tutorial/installation\">Installer Electron</a><ul>\n<li><a href=\"/docs/tutorial/installation#proxies\">Les proxys</a></li>\n<li><a href=\"/docs/tutorial/installation#custom-mirrors-and-caches\">Mirroirs et Caches personnalisés</a></li>\n<li><a href=\"/docs/tutorial/installation#troubleshooting\">Résolution de problème</a></li>\n</ul></li>\n<li>Releases d'Electron &#x26; Feedback<ul>\n<li><a href=\"/docs/tutorial/electron-versioning\">Versioning Policy</a></li>\n<li><a href=\"/docs/tutorial/electron-timelines\">Calendrier de release99</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/testing-widevine-cdm\">Tester le CDM Widevine</a></li>\n</ul>\n<hr>\n<ul>\n<li><a href=\"/docs/glossary\">Glossaire des termes</a></li>\n</ul>\n<h2 id=\"références-de-lapi\"><a href=\"#références-de-lapi\">Références de l'API</a></h2>\n<ul>\n<li><a href=\"/docs/api/synopsis\">Synopsis</a></li>\n<li><a href=\"/docs/api/process\">Process Object</a></li>\n<li><a href=\"/docs/api/command-line-switches\">Commandes Supportées</a></li>\n<li><a href=\"/docs/api/environment-variables\">Variables d'environnement</a></li>\n<li><a href=\"/docs/api/extensions\">Chrome Extensions Support</a></li>\n<li><a href=\"/docs/breaking-changes\">Modifications importantes de l'API</a></li>\n</ul>\n<h3 id=\"éléments-dom-personnalisé-\"><a href=\"#éléments-dom-personnalisé-\">Éléments DOM Personnalisé :</a></h3>\n<ul>\n<li><a href=\"/docs/api/file-object\">Objet <code>File</code></a></li>\n<li><a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code> Tag</a></li>\n<li><a href=\"/docs/api/window-open\"><code>window.open</code> Function</a></li>\n<li><a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code> Object</a></li>\n</ul>\n<h3 id=\"modules-pour-le-processus-principal-\"><a href=\"#modules-pour-le-processus-principal-\">Modules pour le processus principal :</a></h3>\n<ul>\n<li><a href=\"/docs/api/app\">app</a></li>\n<li><a href=\"/docs/api/auto-updater\">autoUpdater</a></li>\n<li><a href=\"/docs/api/browser-view\">BrowserView</a></li>\n<li><a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n<li><a href=\"/docs/api/content-tracing\">contentTracing</a></li>\n<li><a href=\"/docs/api/dialog\">dialog</a></li>\n<li><a href=\"/docs/api/global-shortcut\">globalShortcut</a></li>\n<li><a href=\"/docs/api/in-app-purchase\">Achat inApp</a></li>\n<li><a href=\"/docs/api/ipc-main\">ipcMain</a></li>\n<li><a href=\"/docs/api/menu\">Menu</a></li>\n<li><a href=\"/docs/api/menu-item\">MenuItem</a></li>\n<li><a href=\"/docs/api/message-channel-main\">MessageChannelMain</a></li>\n<li><a href=\"/docs/api/message-port-main\">MessagePortMain</a></li>\n<li><a href=\"/docs/api/net\">net</a></li>\n<li><a href=\"/docs/api/net-log\">netLog</a></li>\n<li><a href=\"/docs/api/native-theme\">nativeTheme</a></li>\n<li><a href=\"/docs/api/notification\">Notification</a></li>\n<li><a href=\"/docs/api/power-monitor\">powerMonitor</a></li>\n<li><a href=\"/docs/api/power-save-blocker\">powerSaveBlocker</a></li>\n<li><a href=\"/docs/api/protocol\">protocol</a></li>\n<li><a href=\"/docs/api/screen\">screen</a></li>\n<li><a href=\"/docs/api/session\">session</a></li>\n<li><a href=\"/docs/api/share-menu\">ShareMenu</a></li>\n<li><a href=\"/docs/api/system-preferences\">systemPreferences</a></li>\n<li><a href=\"/docs/api/touch-bar\">TouchBar</a></li>\n<li><a href=\"/docs/api/tray\">Tray</a></li>\n<li><a href=\"/docs/api/web-contents\">webContents</a></li>\n<li><a href=\"/docs/api/web-frame-main\">webFrameMain</a></li>\n</ul>\n<h3 id=\"modules-pour-le-processus-de-rendu-page-web-\"><a href=\"#modules-pour-le-processus-de-rendu-page-web-\">Modules pour le processus de rendu (Page Web) :</a></h3>\n<ul>\n<li><a href=\"/docs/api/context-bridge\">contextBridge</a></li>\n<li><a href=\"/docs/api/ipc-renderer\">ipcRenderer</a></li>\n<li><a href=\"/docs/api/web-frame\">webFrame</a></li>\n</ul>\n<h3 id=\"modules-pour-les-deux-processus-\"><a href=\"#modules-pour-les-deux-processus-\">Modules pour les deux processus :</a></h3>\n<ul>\n<li><a href=\"/docs/api/clipboard\">clipboard</a></li>\n<li><a href=\"/docs/api/crash-reporter\">crashReporter</a></li>\n<li><a href=\"/docs/api/desktop-capturer\">desktopCapturer</a></li>\n<li><a href=\"/docs/api/native-image\">nativeImage</a></li>\n<li><a href=\"/docs/api/shell\">shell</a></li>\n</ul>\n<h2 id=\"développement\"><a href=\"#développement\">Développement</a></h2>\n<p>Voir <a href=\"/docs/development/README\">development/README.md</a></p>",
      "title": "Guide officiel",
      "description": ""
    },
    "/docs/development/README": {
      "locale": "fr-FR",
      "slug": "README",
      "href": "/docs/development/README",
      "crowdinFileId": "256127",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/README.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"développer-electron\"><a href=\"#développer-electron\">Développer Electron</a></h1>\n<p>Ces guides sont destinés aux personnes travaillant sur le projet Electron lui-même. Pour des guides sur le développement d'applications Electron, voir <a href=\"/docs/README#guides-and-tutorials\">/docs/README.md</a>.</p>\n<ul>\n<li><a href=\"https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md\">Code de conduite</a></li>\n<li><a href=\"https://github.com/electron/electron/blob/main/CONTRIBUTING.md\">Contribuer à Electron</a></li>\n<li><a href=\"/docs/development/issues\">Issues</a></li>\n<li><a href=\"/docs/development/pull-requests\">Pull Requests</a></li>\n<li><a href=\"/docs/development/coding-style#documentation\">Documentation Styleguide</a></li>\n<li><a href=\"/docs/development/source-code-directory-structure\">Structure du répertoire du Code Source</a></li>\n<li><a href=\"/docs/development/coding-style\">Style de Codage</a></li>\n<li><a href=\"/docs/development/clang-format\">Utilisation du clang-format sur du code C++</a></li>\n<li><a href=\"/docs/development/clang-tidy\">Utilisation de clang-tidy sur du code C ++</a></li>\n<li><a href=\"/docs/development/build-system-overview\">Aperçu du Système de compilation</a></li>\n<li><a href=\"/docs/development/build-instructions-macos\">Instructions de Build (macOS)</a></li>\n<li><a href=\"/docs/development/build-instructions-windows\">Instructions de Build (Windows)</a></li>\n<li><a href=\"/docs/development/build-instructions-linux\">Instructions de Build (Linux)</a></li>\n<li><a href=\"/docs/development/chromium-development\">Développement Chromium</a></li>\n<li><a href=\"/docs/development/v8-development\">Développement V8</a></li>\n<li><a href=\"/docs/development/testing\">Test</a></li>\n<li><a href=\"/docs/development/debug-instructions-windows\">Débogage sur Windows</a></li>\n<li><a href=\"/docs/development/debugging-instructions-macos\">Débogage sur macOS</a></li>\n<li><a href=\"/docs/development/setting-up-symbol-server\">Configuration du serveur de symboles dans le déboggueur</a></li>\n<li><a href=\"/docs/development/patches\">Patchs</a></li>\n</ul>",
      "title": "Développer Electron",
      "description": ""
    },
    "/docs/tutorial/recent-documents": {
      "locale": "fr-FR",
      "slug": "recent-documents",
      "href": "/docs/tutorial/recent-documents",
      "crowdinFileId": "256239",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/recent-documents.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"documents-récents-windows--macos\"><a href=\"#documents-récents-windows--macos\">Documents récents (Windows &#x26; macOS)</a></h1>\n<h2 id=\"vue-densemble\"><a href=\"#vue-densemble\">Vue d'ensemble</a></h2>\n<p>Windows et macOS permettent d’accéder facilement à la liste des documents récemment ouverts par l'application respectivement via JumpList ou dock menu.</p>\n<p><strong>JumpList :</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/2289/23446924/11a27b98-fdfc-11e6-8485-cc3b1e86b80a.png\" alt=\"JumpList fichiers récents\"></p>\n<p><strong>Menu application du dock :</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5069610/2aa80758-6e97-11e4-8cfb-c1a414a10774.png\" alt=\"Dock de macOS\"></p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<h3 id=\"gestiçon-des-documents-récents\"><a href=\"#gestiçon-des-documents-récents\">Gestiçon des documents récents</a></h3>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/recent-documents\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\n<span class=\"hljs-keyword\">const</span> fileName = <span class=\"hljs-string\">'recently-used.md'</span>\nfs.writeFile(fileName, <span class=\"hljs-string\">'Lorem Ipsum'</span>, () => {\n  app.addRecentDocument(path.join(__dirname, fileName))\n})\n\napp.whenReady().then(createWindow)\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  app.clearRecentDocuments()\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<h4 id=\"ajout-dun-document-récent\"><a href=\"#ajout-dun-document-récent\">Ajout d'un document récent</a></h4>\n<p>Utilisez l'API <a href=\"/docs/api/app#appaddrecentdocumentpath-macos-windows\">app.addRecentDocument</a> pour ajouter un fichier aux documents récents .</p>\n<p>After launching the Electron application, right click the application icon. Dans ce guide, l'élément est un fichier Markdown situé à la racine du projet. Vous devriez voir <code>recently-used.md</code> ajouté à la liste des fichiers récents :</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/recent-documents.png\" alt=\"Document récent\"></p>\n<h4 id=\"effacement-de-la-liste-des-documents-récents\"><a href=\"#effacement-de-la-liste-des-documents-récents\">Effacement de la liste des documents récents</a></h4>\n<p>Pour effacer la liste des documents récents, utilisez l'API <a href=\"/docs/api/app#appclearrecentdocuments-macos-windows\">app.clearRecentDocuments</a>. Dans ce guide, la liste des documents est effacée lorsque toutes les fenêtres ont été fermées.</p>\n<h2 id=\"additional-information\"><a href=\"#additional-information\">Additional information</a></h2>\n<h3 id=\"remarques-windows\"><a href=\"#remarques-windows\">Remarques Windows</a></h3>\n<p>Pour utiliser cette fonctionnalité sur Windows, votre application doit être enregistrée en tant que gestionnaire/responsable du type de fichier du document, sinon le fichier n’apparaîtra pas dans la JumpList même après l'avoir ajouté. Vous trouverez tout l'enregistrement de votre application dans <a href=\"https://msdn.microsoft.com/en-us/library/cc144104(VS.85).aspx\">Enregistrement de l'application</a>.</p>\n<p>Lorsqu’un utilisateur clique sur un fichier à partir de la JumpList, cela démarre une nouvelle instance de votre application avec le chemin d’accès du fichier ajouté comme un argument de ligne de commande.</p>\n<h3 id=\"remarques-macos\"><a href=\"#remarques-macos\">Remarques macOS</a></h3>\n<h4 id=\"ajouter-la-liste-des-documents-récents-au-menu-de-lapplication\"><a href=\"#ajouter-la-liste-des-documents-récents-au-menu-de-lapplication\">Ajouter la liste des Documents récents au menu de l'application</a></h4>\n<p>Vous pouvez ajouter des éléments de menu pour accéder et supprimer les documents récents en ajoutant le code suivant à votre template de menu :</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"submenu\"</span>:[\n    {\n      <span class=\"hljs-attr\">\"label\"</span>:<span class=\"hljs-string\">\"Ouvrir récent\"</span>,\n      <span class=\"hljs-attr\">\"role\"</span>:<span class=\"hljs-string\">\"recentdocuments\"</span>,\n      <span class=\"hljs-attr\">\"submenu\"</span>:[\n        {\n          <span class=\"hljs-attr\">\"label\"</span>:<span class=\"hljs-string\">\"Effacer récent\"</span>,\n          <span class=\"hljs-attr\">\"role\"</span>:<span class=\"hljs-string\">\"clearrecentdocuments\"</span>\n        }\n      ]\n    }\n  ]\n}\n</code></pre>\n<p>Assurez-vous que le menu de l'application soit ajouté après l'événement <a href=\"/docs/api/app#event-ready\"><code>'ready'</code></a> et pas avant, ou l'élément de menu sera désactivé :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> template = [\n  <span class=\"hljs-comment\">// Modèle de Menu </span>\n]\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  Menu.setApplicationMenu(menu)\n})\n</code></pre>\n<p><img src=\"https://user-images.githubusercontent.com/3168941/33003655-ea601c3a-cd70-11e7-97fa-7c062149cfb1.png\" alt=\"élément de menu Documents récents macOS\"></p>\n<p>Lorsqu’un fichier est demandé dans le menu documents récents, l’événement <code>open-file</code> du module <code>app</code> sera émit.</p>",
      "title": "Documents récents (Windows & macOS)",
      "description": ""
    },
    "/docs/api/structures/rectangle": {
      "locale": "fr-FR",
      "slug": "rectangle",
      "href": "/docs/api/structures/rectangle",
      "crowdinFileId": "256493",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/rectangle.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"rectangle-object\"><a href=\"#rectangle-object\">Rectangle Object</a></h1>\n<ul>\n<li><code>x</code> Number - The x coordinate of the origin of the rectangle (must be an integer).</li>\n<li><code>y</code> Number - The y coordinate of the origin of the rectangle (must be an integer).</li>\n<li><code>width</code> Number - The width of the rectangle (must be an integer).</li>\n<li><code>height</code> Number - The height of the rectangle (must be an integer).</li>\n</ul>",
      "title": "Rectangle Object",
      "description": ""
    },
    "/docs/api/structures/referrer": {
      "locale": "fr-FR",
      "slug": "referrer",
      "href": "/docs/api/structures/referrer",
      "crowdinFileId": "256495",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/referrer.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"referrer-object\"><a href=\"#referrer-object\">Referrer Object</a></h1>\n<ul>\n<li><code>url</code> String - HTTP Referrer URL.</li>\n<li><code>policy</code> String - Can be <code>default</code>, <code>unsafe-url</code>, <code>no-referrer-when-downgrade</code>, <code>no-referrer</code>, <code>origin</code>, <code>strict-origin-when-cross-origin</code>, <code>same-origin</code> or <code>strict-origin</code>. See the <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy\">Referrer-Policy spec</a> for more details on the meaning of these values.</li>\n</ul>",
      "title": "Referrer Object",
      "description": ""
    },
    "/docs/tutorial/repl": {
      "locale": "fr-FR",
      "slug": "repl",
      "href": "/docs/tutorial/repl",
      "crowdinFileId": "256241",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/repl.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"repl\"><a href=\"#repl\">REPL</a></h1>\n<p><a href=\"https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop\">Read-Eval-Print-Loop</a> (REPL) is a simple, interactive computer programming environment that takes single user inputs (i.e. single expressions), evaluates them, and returns the result to the user.</p>\n<h2 id=\"processus-principal\"><a href=\"#processus-principal\">Processus principal</a></h2>\n<p>Electron exposes the <a href=\"https://nodejs.org/dist/latest/docs/api/repl.html\">Node.js <code>repl</code> module</a> through the <code>--interactive</code> CLI flag. Assuming you have <code>electron</code> installed as a local project dependency, you should be able to access the REPL with the following command:</p>\n<pre><code class=\"hljs language-sh\">./node_modules/.bin/electron --interactive\n</code></pre>\n<p><strong>Note:</strong> <code>electron --interactive</code> is not available on Windows (see <a href=\"https://github.com/electron/electron/pull/5776\">electron/electron#5776</a> for more details).</p>\n<h2 id=\"processus-de-rendu\"><a href=\"#processus-de-rendu\">Processus de rendu</a></h2>\n<p>You can use the DevTools Console tab to get a REPL for any renderer process. Pour en savoir plus, lisez <a href=\"https://developer.chrome.com/docs/devtools/console/\">la documentation Chrome</a>.</p>",
      "title": "REPL",
      "description": ""
    },
    "/docs/tutorial/represented-file": {
      "locale": "fr-FR",
      "slug": "represented-file",
      "href": "/docs/tutorial/represented-file",
      "crowdinFileId": "256243",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/represented-file.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"représentation-des-fichiers-dans-une-browserwindow-macos\"><a href=\"#représentation-des-fichiers-dans-une-browserwindow-macos\">Représentation des fichiers dans une BrowserWindow (macOS)</a></h1>\n<h2 id=\"vue-densemble\"><a href=\"#vue-densemble\">Vue d'ensemble</a></h2>\n<p>On macOS, you can set a represented file for any window in your application. The represented file's icon will be shown in the title bar, and when users <code>Command-Click</code> or <code>Control-Click</code>, a popup with a path to the file will be shown.</p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5082061/670a949a-6f14-11e4-987a-9aaa04b23c1d.png\" alt=\"Fichier représenté\"></p>\n<blockquote>\n<p>NOTE : La capture d'écran ci-dessus est un exemple où cette fonctionnalité est utilisée pour indiquer le fichier actuellement ouvert dans l'éditeur de texte Atom.</p>\n</blockquote>\n<p>You can also set the edited state for a window so that the file icon can indicate whether the document in this window has been modified.</p>\n<p>To set the represented file of window, you can use the <a href=\"/docs/api/browser-window#winsetrepresentedfilenamefilename-macos\">BrowserWindow.setRepresentedFilename</a> and <a href=\"/docs/api/browser-window#winsetdocumenteditededited-macos\">BrowserWindow.setDocumentEdited</a> APIs.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/represented-file\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>);\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.setRepresentedFilename(os.homedir())\n  win.setDocumentEdited(<span class=\"hljs-literal\">true</span>)\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<p>Après avoir lancé l'application Electron, cliquez sur le titre en pressant sur la touche <code>Command</code> ou <code>Control</code>. Vous devriez voir une popup avec le fichier représenté en haut. En ce qui concerne ce guide, il s'agit du répertoire home de l'utilisateur actuel:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/represented-file.png\" alt=\"Fichier représenté\"></p>",
      "title": "Représentation des fichiers dans une BrowserWindow (macOS)",
      "description": "NOTE : La capture d'écran ci-dessus est un exemple où cette fonctionnalité est utilisée pour indiquer le fichier actuellement ouvert dans l'éditeur de texte Atom."
    },
    "/docs/api/safe-storage": {
      "locale": "fr-FR",
      "slug": "safe-storage",
      "href": "/docs/api/safe-storage",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/safe-storage.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"safestorage\"><a href=\"#safestorage\">safeStorage</a></h1>\n<blockquote>\n<p>Allows access to simple encryption and decryption of strings for storage on the local machine.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>This module protects data stored on disk from being accessed by other applications or users with full disk access.</p>\n<p>Note that on Mac, access to the system Keychain is required and these calls can block the current thread to collect user input. The same is true for Linux, if a password management tool is available.</p>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module <code>safeStorage</code> possède les méthodes suivantes :</p>\n<h3 id=\"safestorageisencryptionavailable\"><a href=\"#safestorageisencryptionavailable\"><code>safeStorage.isEncryptionAvailable()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether encryption is available.</p>\n<p>On Linux, returns true if the secret key is available. On MacOS, returns true if Keychain is available. On Windows, returns true with no other preconditions.</p>\n<h3 id=\"safestorageencryptstringplaintext\"><a href=\"#safestorageencryptstringplaintext\"><code>safeStorage.encryptString(plainText)</code></a></h3>\n<ul>\n<li><code>plainText</code> String</li>\n</ul>\n<p>Returns <code>Buffer</code> -  An array of bytes representing the encrypted string.</p>\n<p>This function will throw an error if encryption fails.</p>\n<h3 id=\"safestoragedecryptstringencrypted\"><a href=\"#safestoragedecryptstringencrypted\"><code>safeStorage.decryptString(encrypted)</code></a></h3>\n<ul>\n<li><code>encrypted</code> Buffer</li>\n</ul>\n<p>Returns <code>String</code> - the decrypted string. Decrypts the encrypted buffer obtained  with <code>safeStorage.encryptString</code> back into a string.</p>\n<p>This function will throw an error if decryption fails.</p>",
      "title": "safeStorage",
      "description": "Allows access to simple encryption and decryption of strings for storage on the local machine."
    },
    "/docs/tutorial/sandbox": {
      "locale": "fr-FR",
      "slug": "sandbox",
      "href": "/docs/tutorial/sandbox",
      "crowdinFileId": "256245",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/sandbox.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"mise-en-bac-à-sable-de-processus\"><a href=\"#mise-en-bac-à-sable-de-processus\">Mise en bac à sable de processus</a></h1>\n<p>L'une des principales fonctionnalités de sécurité de Chromium est que les processus peuvent être exécutés dans un bac à sable. The sandbox limits the harm that malicious code can cause by limiting access to most system resources — sandboxed processes can only freely use CPU cycles and memory. Afin d’effectuer des opérations nécessitant un privilège supplémentaire, les processus mis en bac à sable utilisent des canaux de communication dédiés pour déléguer des tâches à des processus plus privilégiés.</p>\n<p>Dans Chromium, le bac à sable est appliqué à la plupart des processus autres que le processus principal. Cela inclut les processus de rendu, ainsi que les processus utilitaires tels que le service audio, le service GPU et le service réseau.</p>\n<p>Reportez-vous au document <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/design/sandbox.md\">Conception du bac à sable</a> pour plus d'informations.</p>\n<h2 id=\"politiques-du-bac-à-sable-delectron\"><a href=\"#politiques-du-bac-à-sable-delectron\">Politiques du bac à sable d’Electron</a></h2>\n<p>Electron est livré avec un environnement de bac à sable mixte, ce qui signifie que les processus s'y exécutant peuvent fonctionner aux côtés de processus privilégiés. Par défaut, les processus de rendu ne sont pas en bac à sable mais les processus utilitaires le sont. Notez que dans Chromium le processus principal (navigateur) est privilégié et ne peut pas être mis en bac à sable.</p>\n<p>Historiquement, cette approche du bac à sable mixte a été établie car la disponibilité de Node.js dans le moteur de rendu est un outil extrêmement puissant pour les développeurs d'applications. Malheureusement cette fonctionnalité est également une vulnérabilité de sécurité tout aussi massive.</p>\n<p>Théoriquement les rendus hors bac à sable ne sont pas un problème pour les applications de bureau qui affichent uniquement du code de confiance mais ils rendent Electron moins sûr que Chromium pour afficher du contenu Web non fiable. Cependant même du code prétendument fiable peut être dangereux - il existe d’innombrables vecteurs d’attaque utilisables par des acteurs malveillants, du script cross-site à l’injection de contenu aux attaques \"man-in-the-middle\" sur des sites Web distants chargés pour n’en nommer que quelques-uns. Pour cette raison, nous recommandons d'être très prudent et d’activer le bac à sable pour les rendus dans la grande majorité des cas.</p>\n<!--TODO: update this guide when #28466 is either solved or closed -->\n<p>Notez qu'il y a une discussion active dans le gestionnaire de tickets au sujet de l'activation par défaut de la mise en bac à sable des rendus . Voir <a href=\"https://github.com/electron/electron/issues/28466\">#28466</a>) pour plus de détails.</p>\n<h2 id=\"comportement-du-bac-à-sable-dans-electron\"><a href=\"#comportement-du-bac-à-sable-dans-electron\">Comportement du bac à sable dans Electron</a></h2>\n<p>Dans Electron les processus mis en bac à sable se comportent principalement de la même manière qu'avec Chromium mais il y a quelques concepts supplémentaires à considérer puisque Electron s’interface avec Node.js.</p>\n<h3 id=\"processus-de-rendu\"><a href=\"#processus-de-rendu\">Processus de rendu</a></h3>\n<p>Lorsque les processus de rendu dans Electron sont en bac à sable, ils se comportent de la même manière qu'un moteur de rendu Chrome régulier le ferait. Un moteur de rendu en bac à sable n'aura pas d'environnement Node.js initialisé.</p>\n<!-- TODO(erickzhao): when we have a solid guide for IPC, link it here -->\n<p>Par conséquent, lorsque le bac à sable est activé, les processus de rendu ne peuvent effectuer des tâches privilégiées (telles que l’interaction avec le système de fichiers, apporter des modifications au système ou engendrer des sous-processus) qu'en déléguant ces tâches au processus principal par la communication inter-processus (IPC).</p>\n<h3 id=\"scripts-de-preload\"><a href=\"#scripts-de-preload\">Scripts de preload</a></h3>\n<p>Afin de permettre aux processus de rendu de communiquer avec le processus principal, les scripts de préchargement attachés aux rendus en bac à sable auront toujours un sous-ensemble polyfill de l'API Node.js disponible. Une fonction <code>require</code> similaire au module <code>require</code> de Node module est exposée mais ne peut importer qu'un sous-ensemble des modules intégrés d'Electron et de Node :</p>\n<ul>\n<li><code>electron</code> (uniquement les modules de processus de rendu)</li>\n<li><a href=\"https://nodejs.org/api/events.html\"><code>événements</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html\"><code>timers</code></a></li>\n<li><a href=\"https://nodejs.org/api/url.html\"><code>url</code></a></li>\n</ul>\n<p>En outre, le script de préchargement simule également certaines primitives Node.js en tant que globales :</p>\n<ul>\n<li><a href=\"https://nodejs.org/api/Buffer.html\"><code>Buffer</code></a></li>\n<li><a href=\"/docs/api/process\"><code>processus (process)</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html#timers_clearimmediate_immediate\"><code>clearImmédite</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html#timers_setimmediate_callback_args\"><code>setImmédite</code></a></li>\n</ul>\n<p>Étant donné que la fonction <code>require</code> est un polyfill avec des fonctionnalités limitées, vous ne serez pas en mesure d’utiliser <a href=\"https://nodejs.org/api/modules.html#modules_modules_commonjs_modules\">modules CommonJS</a> pour séparer votre script de préchargement en plusieurs fichiers . Si vous avez besoin de diviser votre code de préchargement, utilisez un groupeur de module tel que <a href=\"https://webpack.js.org/\">webpack</a> ou <a href=\"https://parceljs.org/\">Parcel</a>.</p>\n<p>Note that because the environment presented to the <code>preload</code> script is substantially more privileged than that of a sandboxed renderer, it is still possible to leak privileged APIs to untrusted code running in the renderer process unless <a href=\"/docs/tutorial/context-isolation\"><code>contextIsolation</code></a> is enabled.</p>\n<h2 id=\"configuration-du-bac-à-sable\"><a href=\"#configuration-du-bac-à-sable\">Configuration du bac à sable</a></h2>\n<h3 id=\"activation-du-bac-à-sable-pour-un-processus-unique\"><a href=\"#activation-du-bac-à-sable-pour-un-processus-unique\">Activation du bac à sable pour un processus unique</a></h3>\n<p>Dans Electron, la mise en bac à sable d'un rendu peut être activé par processus avec la préférence <code>sandbox: true</code> dans le constructeur de la <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">sandbox</span>: <span class=\"hljs-literal\">true</span>\n    }\n  })\n  win.loadURL(<span class=\"hljs-string\">'https://google.com'</span>)\n})\n</code></pre>\n<h3 id=\"activation-globale-du-bac-à-sable\"><a href=\"#activation-globale-du-bac-à-sable\">Activation globale du bac à sable</a></h3>\n<p>Si vous souhaitez activer de force le bac à sable pour tous les rendus, vous pouvez également utiliser l' <a href=\"/docs/api/app#appenablesandbox\"><code>app.enableSandbox</code></a> API. Notez que cette API doit être appelée avant l'événement <code>ready</code> de l’application.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\napp.enableSandbox()\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// inutile de passer `sandbox: true` puisque `app.enableSandbox()` a été appelé.</span>\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://google.com'</span>)\n})\n</code></pre>\n<h3 id=\"désactivation-du-bac-à-sable-de-chromium-pour-test-uniquement\"><a href=\"#désactivation-du-bac-à-sable-de-chromium-pour-test-uniquement\">Désactivation du bac à sable de Chromium (pour test uniquement)</a></h3>\n<p>Vous pouvez également désactiver entièrement le bac à sable de Chromium avec le drapeau CLI <a href=\"/docs/api/command-line-switches#--no-sandbox\"><code>--no-sandbox</code></a> , qui le désactivera pour tous les processus (y compris les processus utilitaires). Nous vous recommandons fortement d'utiliser ce drapeau uniquement à des fins de test, et <strong>jamais</strong> en production.</p>\n<p>Notez que l'option <code>sandbox : true</code> désactivera toujours l'environnement Node.js du moteur de rendu .</p>\n<h2 id=\"une-note-sur-le-rendu-de-contenu-non-fiable\"><a href=\"#une-note-sur-le-rendu-de-contenu-non-fiable\">Une note sur le rendu de contenu non fiable</a></h2>\n<p>Le rendu de contenu non fiable dans Electron est encore un territoire quelque peu inconnu, bien que certaines applications trouvent le succès (par exemple. <a href=\"https://github.com/beakerbrowser/beaker\">Beaker Browser</a>). Notre objectif est de nous rapprocher le plus possible de Chrome en termes de sécurité des contenus en bac à sable, mais en fin de compte, nous serons toujours à la traîne en raison de quelques problèmes fondamentaux :</p>\n<ol>\n<li>We do not have the dedicated resources or expertise that Chromium has to apply to the security of its product. We do our best to make use of what we have, to inherit everything we can from Chromium, and to respond quickly to security issues, but Electron cannot be as secure as Chromium without the resources that Chromium is able to dedicate.</li>\n<li>Some security features in Chrome (such as Safe Browsing and Certificate Transparency) require a centralized authority and dedicated servers, both of which run counter to the goals of the Electron project. As such, we disable those features in Electron, at the cost of the associated security they would otherwise bring.</li>\n<li>Il n'y a qu'un seul Chromium, alors qu'il y a plusieurs milliers d'applications créées sur Electron, qui se comportent tous légèrement différemment. Accounting for those differences can yield a huge possibility space, and make it challenging to ensure the security of the platform in unusual use cases.</li>\n<li>We can't push security updates to users directly, so we rely on app vendors to upgrade the version of Electron underlying their app in order for security updates to reach users.</li>\n</ol>\n<p>Alors que nous faisons de notre mieux pour rétroporter les correctifs de sécurité Chromium vers d'anciennes versions d'Electron, nous ne garantissons pas que chaque correctif sera rétroporté. Votre meilleure chance de rester en sécurité est d'être sur la dernière version stable d'Electron.</p>",
      "title": "Mise en bac à sable de processus",
      "description": ""
    },
    "/docs/api/screen": {
      "locale": "fr-FR",
      "slug": "screen",
      "href": "/docs/api/screen",
      "crowdinFileId": "256361",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/screen.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"screen\"><a href=\"#screen\">screen</a></h1>\n<blockquote>\n<p>Récupère les informations sur la taille, l'écran, la position du curseur, etc.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>Ce module ne peut pas être utilisé tant que l'événement <code>prêt</code> du module <code>app</code> n'est pas émis.</p>\n<p><code>screen</code> est un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p><strong>Remarque :</strong> Dans le renderer / DevTools, <code>window.screen</code> est une propriété réservée au DOM, alors écrire <code>let { screen } = require('electron')</code> ne fonctionnera pas.</p>\n<p>Un exemple de création d'une fenêtre qui prendra tout l'écran :</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/screen/fit-screen\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, screen } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> { width, height } = screen.getPrimaryDisplay().workAreaSize\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ width, height })\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>Un autre exemple de création d'une fenêtre dans l'écran externe :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, screen } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> displays = screen.getAllDisplays()\n  <span class=\"hljs-keyword\">const</span> externalDisplay = displays.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">display</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> display.bounds.x !== <span class=\"hljs-number\">0</span> || display.bounds.y !== <span class=\"hljs-number\">0</span>\n  })\n\n  <span class=\"hljs-keyword\">if</span> (externalDisplay) {\n    win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n      <span class=\"hljs-attr\">x</span>: externalDisplay.bounds.x + <span class=\"hljs-number\">50</span>,\n      <span class=\"hljs-attr\">y</span>: externalDisplay.bounds.y + <span class=\"hljs-number\">50</span>\n    })\n    win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  }\n})\n</code></pre>\n<h2 id=\"événements\"><a href=\"#événements\">Événements</a></h2>\n<p>Le module <code>screen</code> émet les événements suivants :</p>\n<h3 id=\"événement--display-added\"><a href=\"#événement--display-added\">Événement : 'display-added'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newDisplay</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n</ul>\n<p>Émis lorsque <code>newDisplay</code> a été ajouté.</p>\n<h3 id=\"événement--display-removed\"><a href=\"#événement--display-removed\">Événement : 'display-removed'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>oldDisplay</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n</ul>\n<p>Émis lorsque <code>oldDisplay</code> a été retiré.</p>\n<h3 id=\"événement-display-metrics-changed\"><a href=\"#événement-display-metrics-changed\">Événement 'display-metrics-changed'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>display</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n<li><code>changedMetrics</code> String[]</li>\n</ul>\n<p>Émis lorsqu’un ou plusieurs métrics changent dans un <code>display</code>. <code>changedMetrics</code> est un tableau de chaîne de caractères décrivant les modifications. Les modifications possibles sont <code>bounds</code>, <code>workArea</code>, <code>scaleFactor</code> et <code>rotation</code>.</p>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module <code>screen</code> dispose des méthodes suivantes :</p>\n<h3 id=\"screengetcursorscreenpoint\"><a href=\"#screengetcursorscreenpoint\"><code>screen.getCursorScreenPoint()</code></a></h3>\n<p>Retourne <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>La position absolue du pointeur de la souris.</p>\n<p><strong>Note:</strong> The return value is a DIP point, not a screen physical point.</p>\n<h3 id=\"screengetprimarydisplay\"><a href=\"#screengetprimarydisplay\"><code>screen.getPrimaryDisplay()</code></a></h3>\n<p>Retourne <a href=\"/docs/api/structures/display\"><code>Display</code></a> - L'écran principal.</p>\n<h3 id=\"screengetalldisplays\"><a href=\"#screengetalldisplays\"><code>screen.getAllDisplays()</code></a></h3>\n<p>Retourne <a href=\"/docs/api/structures/display\"><code>Display[]</code></a> - Un tableau d'écrans qui sont actuellement disponibles.</p>\n<h3 id=\"screengetdisplaynearestpointpoint\"><a href=\"#screengetdisplaynearestpointpoint\"><code>screen.getDisplayNearestPoint(point)</code></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Retourne <a href=\"/docs/api/structures/display\"><code>Display</code></a> - L'écran le plus proche du point spécifié.</p>\n<h3 id=\"screengetdisplaymatchingrect\"><a href=\"#screengetdisplaymatchingrect\"><code>screen.getDisplayMatching(rect)</code></a></h3>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Retourne <a href=\"/docs/api/structures/display\"><code>Display</code></a> - L'écran qui croise le plus les limites d'intersection données.</p>\n<h3 id=\"screenscreentodippointpoint-windows\"><a href=\"#screenscreentodippointpoint-windows\"><code>screen.screenToDipPoint(point)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Retourne <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>Converts a screen physical point to a screen DIP point. The DPI scale is performed relative to the display containing the physical point.</p>\n<h3 id=\"screendiptoscreenpointpoint-windows\"><a href=\"#screendiptoscreenpointpoint-windows\"><code>screen.dipToScreenPoint(point)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Retourne <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>Converts a screen DIP point to a screen physical point. The DPI scale is performed relative to the display containing the DIP point.</p>\n<h3 id=\"screenscreentodiprectwindow-rect-windows\"><a href=\"#screenscreentodiprectwindow-rect-windows\"><code>screen.screenToDipRect(window, rect)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | null</li>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Retourne <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>Converts a screen physical rect to a screen DIP rect. The DPI scale is performed relative to the display nearest to <code>window</code>. If <code>window</code> is null, scaling will be performed to the display nearest to <code>rect</code>.</p>\n<h3 id=\"screendiptoscreenrectwindow-rect-windows\"><a href=\"#screendiptoscreenrectwindow-rect-windows\"><code>screen.dipToScreenRect(window, rect)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | null</li>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Retourne <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>Converts a screen DIP rect to a screen physical rect. The DPI scale is performed relative to the display nearest to <code>window</code>. If <code>window</code> is null, scaling will be performed to the display nearest to <code>rect</code>.</p>",
      "title": "screen",
      "description": "Récupère les informations sur la taille, l'écran, la position du curseur, etc."
    },
    "/docs/api/structures/scrubber-item": {
      "locale": "fr-FR",
      "slug": "scrubber-item",
      "href": "/docs/api/structures/scrubber-item",
      "crowdinFileId": "256497",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/scrubber-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"scrubberitem-object\"><a href=\"#scrubberitem-object\">ScrubberItem Object</a></h1>\n<ul>\n<li><code>label</code> String (optional) - The text to appear in this item.</li>\n<li><code>icon</code> NativeImage (optional) - The image to appear in this item.</li>\n</ul>",
      "title": "ScrubberItem Object",
      "description": ""
    },
    "/docs/tutorial/security": {
      "locale": "fr-FR",
      "slug": "security",
      "href": "/docs/tutorial/security",
      "crowdinFileId": "256247",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/security.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"sécurité-fonctionnalités-natives-et-votre-responsabilité\"><a href=\"#sécurité-fonctionnalités-natives-et-votre-responsabilité\">Sécurité, fonctionnalités natives et votre responsabilité</a></h1>\n<p>En tant que développeurs web, nous apprécions généralement le réseau de sécurité du navigateur - les risques associés au code que nous écrivons sont relativement faibles. Nos sites Web bénéficient de pouvoirs limités dans un bac à sable, et nous sommes convaincus que nos utilisateurs bénéficient d'un navigateur construit par une grande équipe d'ingénieurs capables de répondre rapidement aux menaces de sécurité récemment découvertes.</p>\n<p>Lorsque vous travaillez avec Electron, il est important de comprendre que l’Electron n’est pas un navigateur web. Il vous permet de developper des applications de bureau riche en fonctionnalités avec des technologies web familières, mais votre code exerce un pouvoir beaucoup plus grand. JavaScript peut accéder au système de fichiers, au shell et bien plus. Cela vous permet de développer des applications natives de haute qualité, mais les risques de sécurité inhérents évoluent avec les pouvoirs supplémentaires accordés à votre code.</p>\n<p>Dans cet esprit, sachez qu’afficher un contenu arbitraire de sources peu fiables est un grave risque pour la sécurité qu'Electron n’est pas destiné à gérer. En fait, les applications les plus populaires Electron (Atom, Slack, Visual Studio Code, etc.) affichent principalement du contenu local (ou un contenu distant fiable et sécurisé sans intégration de Node) – si votre application exécute le code provenant d’une source en ligne, il est de votre responsabilité de vous assurer que le code n’est pas malveillant.</p>\n<h2 id=\"signalement-des-problèmes-de-sécurité\"><a href=\"#signalement-des-problèmes-de-sécurité\">Signalement des problèmes de sécurité</a></h2>\n<p>Pour plus d’informations sur la façon de communiquer correctement une vulnérabilité d'Electron, voir <a href=\"https://github.com/electron/electron/tree/main/SECURITY.md\">SECURITY.md</a></p>\n<h2 id=\"problèmes-de-sécurité-et-mises-à-jour-de-chromium\"><a href=\"#problèmes-de-sécurité-et-mises-à-jour-de-chromium\">Problèmes de sécurité et mises à jour de Chromium</a></h2>\n<p>Electron keeps up to date with alternating Chromium releases. For more information, see the <a href=\"https://electronjs.org/blog/12-week-cadence\">Electron Release Cadence blog post</a>.</p>\n<h2 id=\"la-sécurité-est-la-responsabilité-de-tous\"><a href=\"#la-sécurité-est-la-responsabilité-de-tous\">La sécurité est la responsabilité de tous</a></h2>\n<p>Il est important de se rappeler que la sécurité de votre application Electron dépend de la sécurité globalement de la fondation du framework (<em>Chromium</em>, <em>Node.js</em>), Electron lui-même, toutes les dépendances NPM et votre code. Ainsi, il est de votre responsabilité de suivre quelques pratiques essentielles de test :</p>\n<ul>\n<li>\n<p><strong>Gardez votre application à jour avec la dernière version de framework Electron. </strong> Lorsque vous libérez votre produit, vous expédiez également un paquet composé d'Electron, bibliothèque partagée Chromium et Node.js. Les vulnérabilités affectant ces composants peuvent affecter la sécurité de votre application. En mettant à jour Electron vers la dernière version vous vous assurez que les vulnérabilités critiques (telles que <em>nodeIntegration bypasses</em>) sont déjà corrigées et ne peuvent pas être exploitées dans votre application. Pour plus d'informations, voir \"<a href=\"#16-use-a-current-version-of-electron\">Utiliser une version actuelle d'Electron</a>\".</p>\n</li>\n<li>\n<p><strong>Évaluez vos dépendances.</strong> Alors que NPM fournit un demi-million de paquets réutilisables, il est de votre responsabilité de choisir des bibliothèques de tiers de confiance. Si vous utilisez des bibliothèques obsolètes affectées par des vulnérabilités connues ou si vous êtes dépendants d'un code mal géré, la sécurité de votre application pourrait être compromise.</p>\n</li>\n<li>\n<p><strong>Adoptez des pratiques de codage sécurisées.</strong> La première ligne de défense pour votre application est votre propre code. Des vulnérabilités web courantes, telles que le cross-site scripting (XSS), ont un impact de sécurité plus élevé sur les applications Electron, c'est pourquoi il est fortement recommandé d'adopter des meilleures pratiques de développement de logiciel sécurisé et d'effectuer des tests de sécurité.</p>\n</li>\n</ul>\n<h2 id=\"isolation-pour-les-contenus-non-approuvés\"><a href=\"#isolation-pour-les-contenus-non-approuvés\">Isolation pour les contenus non approuvés</a></h2>\n<p>Un problème de sécurité existe chaque fois que vous recevez du code d'une source non fiable (par exemple, un serveur distant) et que vous l'exécutez localement. À titre d'exemple, considérez qu'un site Web distant est affiché à l'intérieur d'un <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> par défaut. Si un attaquant parvient d'une manière ou d'une autre à modifier ledit contenu (soit en s'attaquant directement à la source, ou en se plaçant entre votre application et la destination voulue), il sera en mesure d'exécuter le code natif sur la machine de l'utilisateur.</p>\n<blockquote>\n<p>⚠️ en aucune circonstance vous devriez charger et exécuter du code distant avec l'intégration de Node.js activé. Utilisez plutôt les fichiers locaux (empaquetés avec votre application) pour exécuter le code de Node. Pour afficher du contenu à distance, utilisez le tag  <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> ou <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, assurez-vous de désactiver <code>nodeIntegration</code> et d'activer <code>contextIsolation</code>.</p>\n</blockquote>\n<h2 id=\"avertissements-de-sécurité-delectron\"><a href=\"#avertissements-de-sécurité-delectron\">Avertissements de sécurité d'Electron</a></h2>\n<p>A partir d'Electron 2.0, les développeurs recevront des avertissements et recommandations directement dans la console de développement. Ils n'apparaissent que lorsque le nom du binaire est Electron, indiquant qu'un développeur regarde actuellement la console.</p>\n<p>Vous pouvez forcer l'activation ou la désactivation ces avertissements en définissant <code>ELECTRON_ENABLE_SECURITY_WARNINGS</code> ou <code>ELECTRON_DISABLE_SECURITY_WARNINGS</code> sur <code>process.env</code> ou sur l’objet <code>window</code>.</p>\n<h2 id=\"checklist--recommandations-de-sécurité\"><a href=\"#checklist--recommandations-de-sécurité\">Checklist : recommandations de sécurité</a></h2>\n<p>Vous devriez au moins suivre ces étapes pour améliorer la sécurité de votre application :</p>\n<ol>\n<li><a href=\"#1-only-load-secure-content\">Charger uniquement du contenu sécurisé</a></li>\n<li><a href=\"#2-do-not-enable-nodejs-integration-for-remote-content\">Désactiver l'intégration de Node.js dans tous les moteurs de rendu qui affichent du contenu distant</a></li>\n<li><a href=\"#3-enable-context-isolation-for-remote-content\">Activer l'isolement du contexte dans tous les moteurs de rendu qui affichent le contenu distant</a></li>\n<li><a href=\"#4-enable-sandboxing\">Activer le bac à sable</a></li>\n<li><a href=\"#5-handle-session-permission-requests-from-remote-content\">Utiliser <code>ses.setPermissionRequestHandler()</code> dans toutes les sessions qui se chargent de contenu distant</a></li>\n<li><a href=\"#6-do-not-disable-websecurity\">Ne pas désactiver <code>webSecurity</code></a></li>\n<li><a href=\"#7-define-a-content-security-policy\">Définissez une <code>Content-Security-Policy</code></a> et utilisez des règles restrictives (c.-à-d. <code>script-src 'self'</code>)</li>\n<li><a href=\"#8-do-not-set-allowrunninginsecurecontent-to-true\">Ne pas définir <code>allowRunningInsecureContent</code> à <code>true</code></a></li>\n<li><a href=\"#9-do-not-enable-experimental-features\">Ne pas activer les fonctionnalités expérimentales</a></li>\n<li><a href=\"#10-do-not-use-enableblinkfeatures\">Ne pas utiliser <code>enableBlinkFeatures</code></a></li>\n<li><a href=\"#11-do-not-use-allowpopups\"><code>&#x3C;webview></code> : N'utilisez pas <code>allowpopups</code></a></li>\n<li><a href=\"#12-verify-webview-options-before-creation\"><code>&#x3C;webview></code>: Vérifier les options et les paramètres</a></li>\n<li><a href=\"#13-disable-or-limit-navigation\">Désactiver ou limiter la navigation</a></li>\n<li><a href=\"#14-disable-or-limit-creation-of-new-windows\">Désactiver ou limiter la création de nouvelles fenêtres</a></li>\n<li><a href=\"#15-do-not-use-openexternal-with-untrusted-content\">Ne pas utiliser <code>openExternal</code> avec un contenu non fiable</a></li>\n<li><a href=\"#16-use-a-current-version-of-electron\">Utiliser une version actuelle d'Electron</a></li>\n</ol>\n<p>Pour automatiser la détection de mauvaises configurations et de patrons non sécurisés, il est possible d'utiliser <a href=\"https://github.com/doyensec/electronegativity\">electronegativity</a>. Pour plus de détails sur les faiblesses potentielles et les bogues d'implémentation lorsque développant des applications utilisant Electron, veuillez vous référer à ce <a href=\"https://doyensec.com/resources/us-17-Carettoni-Electronegativity-A-Study-Of-Electron-Security-wp.pdf\">guide pour développeurs et auditeurs</a></p>\n<h2 id=\"1-ne-télécharger-que-des-contenus-sécurisés\"><a href=\"#1-ne-télécharger-que-des-contenus-sécurisés\">1) Ne télécharger que des contenus sécurisés</a></h2>\n<p>Toutes les ressources non incluses avec votre application doivent être téléchargées à l’aide d’un protocole sécurisé <code>HTTPS</code>. En d’autres termes, n’utilisez pas de protocoles non sécurisés tels que <code>HTTP</code>. De même, nous vous recommandons d’utiliser <code>WSS</code> plutôt <code>WS</code>, <code>FTPS</code> par <code>FTP</code> et ainsi de suite.</p>\n<h3 id=\"pourquoi-\"><a href=\"#pourquoi-\">Pourquoi ?</a></h3>\n<p><code>HTTPS</code> a trois principaux avantages :</p>\n<p>1) Il authentifie le serveur distant, ce qui certifie que votre application se connecte au bon hôte plutôt qu'a un imitateur. 2) Il assure l'intégrité des données, certifiant que les données n'ont pas été modifiées durant le transit entre l'application et l'hôte. 3) Il encrypte le trafic entre votre l'utilisateur et l'hôte de destination, ce qui complique la tâche de quiconque voudrait épier les informations échangées entre l'hôte et votre application.</p>\n<h3 id=\"comment-\"><a href=\"#comment-\">Comment ?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Incorrect</span>\nbrowserWindow.loadURL(<span class=\"hljs-string\">'http://example.com'</span>)\n\n<span class=\"hljs-comment\">// Correct</span>\nbrowserWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Incorrect --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">crossorigin</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://example.com/react.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"http://example.com/style.css\"</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Correct --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">crossorigin</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://example.com/react.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"https://example.com/style.css\"</span>></span>\n</code></pre>\n<h2 id=\"2-ne-pas-activer-lintégration-de-nodejs-pour-le-contenu-distant\"><a href=\"#2-ne-pas-activer-lintégration-de-nodejs-pour-le-contenu-distant\">2) Ne pas activer l'intégration de Node.js pour le contenu distant</a></h2>\n<p><em>Cette recommandation est le comportement par défaut d'Electron depuis la version 5.0.0.</em></p>\n<p>Il est primordial que vous n'activiez pas l'intégration de Node.js dans aucun moteur de rendu (<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>, <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, ou <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>&#x3C;3>&#x3C;/2>) qui charge le contenu distant. Le but est de limiter les permissions accordées aux contenus distants, ce qui complique drastiquement la tâche pour un attaquant qui souhaiterait nuire à vos utilisateurs (si jamais cet attaquant réussissait à exécuter du javascript sur votre site).</p>\n<p>Une fois cela fait, vous pouvez accorder des permissions supplémentaires à des hôtes spécifiques. Par exemple, si vous ouvrez un BrowserWindow pointé sur <code>https://example. om/</code>, vous pouvez donner à ce site exactement les capacités dont il a besoin, mais pas plus.</p>\n<h3 id=\"pourquoi--1\"><a href=\"#pourquoi--1\">Pourquoi ?</a></h3>\n<p>Une attaque cross-site-scripting (XSS) est plus dangereuse si un attaquant peut sortir du processus de rendu et exécuter du code sur l'ordinateur de l'utilisateur. Les attaques de type cross-site-scripting sont assez courantes - et tant qu'un problème, leur pouvoir se limite généralement à gâcher avec le site Web sur lequel ils sont exécutés. La désactivation de l'intégration de Node.js aide à empêcher un XSS d'être escaladé pour devenir une attaque appelée \"Exécution de Code distant\" (RCE).</p>\n<h3 id=\"comment--1\"><a href=\"#comment--1\">Comment ?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Mauvais</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span>,\n    <span class=\"hljs-attr\">nodeIntegrationInWorker</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n\nmainWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bon</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">preload</span>: path.join(app.getAppPath(), <span class=\"hljs-string\">'preload.js'</span>)\n  }\n})\n\nmainWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Incorrect --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">nodeIntegration</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Correct --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>Lors de la désactivation de l'intégration de Node.js, vous pouvez toujours exposer des API à votre site web qui consomment des modules ou des fonctionnalités de Node.js. Les scripts de préchargement continuent d'avoir accès à <code>require</code> et aux autres fonctionnalités de Node.js, permettant aux développeurs d'exposer une API personnalisée au contenu chargé à distance.</p>\n<p>Dans l'exemple suivant du script de préchargement, le site web chargé plus tard aura accès à une méthode <code>window.readConfig()</code>, mais aucune fonctionnalité Node.js.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { readFileSync } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-built_in\">window</span>.readConfig = <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> data = readFileSync(<span class=\"hljs-string\">'./config.json'</span>)\n  <span class=\"hljs-keyword\">return</span> data\n}\n</code></pre>\n<h2 id=\"3-activer-lisolement-du-contexte-pour-le-contenu-distant\"><a href=\"#3-activer-lisolement-du-contexte-pour-le-contenu-distant\">3) Activer l'isolement du contexte pour le contenu distant</a></h2>\n<p>L'isolement du contexte est une fonctionnalité d'Electron qui permet aux développeurs d'exécuter du code dans les scripts de préchargement et dans les API Electron dans un contexte JavaScript dédié. Dans la pratique cela signifie que les objets globaux comme <code>Array.prototype.push</code> ou <code>JSON.parse</code> ne peuvent pas être modifiés par les scripts exécutés dans le processus de rendu.</p>\n<p>L'électron utilise la même technologie que le chrome <a href=\"https://developer.chrome.com/extensions/content_scripts#execution-environment\">Content Scripts</a> pour permettre ce comportement.</p>\n<p>Même lorsque <code>nodeIntegration: false</code> est utilisé, pour vraiment appliquer une isolation forte et empêcher l'utilisation de Node primitives <code>contextIsolation</code> <strong>doivent</strong> également être utilisées.</p>\n<h3 id=\"pourquoi--comment-\"><a href=\"#pourquoi--comment-\">Pourquoi &#x26; Comment ?</a></h3>\n<p>For more information on what <code>contextIsolation</code> is and how to enable it please see our dedicated <a href=\"/docs/tutorial/context-isolation\">Context Isolation</a> document.</p>\n<h2 id=\"activer-le-bac-à-sable\"><a href=\"#activer-le-bac-à-sable\">Activer le bac à sable</a></h2>\n<p><a href=\"/docs/tutorial/sandbox\">Sandboxing</a> est une fonctionnalité de Chromium qui utilise le système d’exploitation pour limiter considérablement ce à quoi les processus de rendu ont accès. Vous devez activer le bac à sable dans tous les moteurs de rendu. Charger, lire ou traiter tout contenu non fiable dans un processus non protégé par le bac à sable, y compris le processus principal, n'est pas conseillé.</p>\n<h3 id=\"comment--2\"><a href=\"#comment--2\">Comment ?</a></h3>\n<p>Lors de la création d'une fenêtre, passez l'option <code>sandbox : true</code> dans <code>webPreferences</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">sandbox</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h2 id=\"5-gérer-les-demandes-dautorisation-de-session-à-partir-du-contenu-distant\"><a href=\"#5-gérer-les-demandes-dautorisation-de-session-à-partir-du-contenu-distant\">5) Gérer les demandes d'autorisation de session à partir du contenu distant</a></h2>\n<p>Vous avez peut-être vu des demandes d'autorisation lors de l'utilisation de Chrome : elles apparaissent chaque fois que le site Web tente d'utiliser une fonctionnalité que l'utilisateur doit approuver manuellement ( comme les notifications).</p>\n<p>L'API se base sur <a href=\"https://developer.chrome.com/extensions/permissions\">l'API de permissions Chromium</a> et implémente le même type de permissions.</p>\n<h3 id=\"pourquoi--2\"><a href=\"#pourquoi--2\">Pourquoi ?</a></h3>\n<p>Par défaut, Electron approuvera automatiquement toutes les demandes de permission, sauf si le développeur a manuellement configuré un gestionnaire personnalisé. Bien que la valeur par défaut soit solide, les développeurs soucieux de la sécurité pourraient vouloir assumer le contraire.</p>\n<h3 id=\"comment--3\"><a href=\"#comment--3\">Comment ?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession\n  .fromPartition(<span class=\"hljs-string\">'some-partition'</span>)\n  .setPermissionRequestHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, callback</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> url = webContents.getURL()\n\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'notifications'</span>) {\n      <span class=\"hljs-comment\">// Approves the permissions request</span>\n      callback(<span class=\"hljs-literal\">true</span>)\n    }\n\n    <span class=\"hljs-comment\">// Verify URL</span>\n    <span class=\"hljs-keyword\">if</span> (!url.startsWith(<span class=\"hljs-string\">'https://example.com/'</span>)) {\n      <span class=\"hljs-comment\">// Denies the permissions request</span>\n      <span class=\"hljs-keyword\">return</span> callback(<span class=\"hljs-literal\">false</span>)\n    }\n  })\n</code></pre>\n<h2 id=\"6-ne-pas-désactiver-websecurity\"><a href=\"#6-ne-pas-désactiver-websecurity\">6) Ne pas désactiver WebSecurity</a></h2>\n<p><em>Cette recommandation est appliquée par défaut sur Electron</em></p>\n<p>Vous avez peut-être déjà deviné que la désactivation de la propriété <code>webSecurity</code> sur un processus de rendu (<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>, <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, ou <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>) désactive les fonctionnalités de sécurité cruciales. .</p>\n<p>Ne pas désactiver <code>webSecurity</code> dans les applications de production.</p>\n<h3 id=\"pourquoi--3\"><a href=\"#pourquoi--3\">Pourquoi ?</a></h3>\n<p>Désactiver <code>webSecurity</code> désactivera la politique de même origine et définira la propriété <code>allowRunningInsecureContent</code> à <code>true</code>. En d'autres termes, il permet l'exécution de code non sécurisé à partir de différents domaines.</p>\n<h3 id=\"comment--4\"><a href=\"#comment--4\">Comment ?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Incorrect</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">webSecurity</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Correct</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Incorrect --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">disablewebsecurity</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Correct --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<h2 id=\"7-définir-une-politique-de-sécurité-de-contenu\"><a href=\"#7-définir-une-politique-de-sécurité-de-contenu\">7) Définir une politique de sécurité de contenu</a></h2>\n<p>Une politique de sécurité de contenu (CSP) est une couche supplémentaire de protection contre des attaques cross-site-scripting et des attaques d'injection de données. Nous recommandons qu'ils soient activés par n'importe quel site Web que vous chargez dans Electron.</p>\n<h3 id=\"pourquoi--4\"><a href=\"#pourquoi--4\">Pourquoi ?</a></h3>\n<p>CSP permet au serveur servant le contenu de restreindre et de contrôler les ressources Electron peut charger pour cette page web. <code>https://example.com</code> devrait être autorisé à charger des scripts depuis les origines que vous avez définies alors que les scripts de <code>https://evil.attacker.com</code> ne devraient pas être autorisés à s'exécuter. Définir un CSP est un moyen facile d'améliorer la sécurité de votre application.</p>\n<p>Le CSP suivant permettra à Electron d'exécuter des scripts depuis le site web actuel et depuis <code>apis.example.com</code>.</p>\n<pre><code class=\"hljs language-plaintext\">// Incorrect\nContent-Security-Policy: '*'\n\n// Correct\nContent-Security-Policy: script-src 'self' https://apis.example.com\n</code></pre>\n<h3 id=\"entête-csp-http\"><a href=\"#entête-csp-http\">Entête CSP HTTP</a></h3>\n<p>Electron respecte le <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy\"><code>Content-Security-Policy</code> en-tête HTTP</a> qui peut être défini en utilisant le gestionnaire <a href=\"/docs/api/web-request#webrequestonheadersreceivedfilter-listener\"><code>webRequest.onHeadersReceived</code></a> d'Electron :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession.defaultSession.webRequest.onHeadersReceived(<span class=\"hljs-function\">(<span class=\"hljs-params\">details, callback</span>) =></span> {\n  callback({\n    <span class=\"hljs-attr\">responseHeaders</span>: {\n      ...details.responseHeaders,\n      <span class=\"hljs-string\">'Content-Security-Policy'</span>: [<span class=\"hljs-string\">'default-src \\'none\\''</span>]\n    }\n  })\n})\n</code></pre>\n<h3 id=\"csp-meta-tag\"><a href=\"#csp-meta-tag\">CSP Meta Tag</a></h3>\n<p>Le mécanisme de livraison préféré de CSP est un en-tête HTTP, cependant il n'est pas possible d'utiliser cette méthode lors du chargement d'une ressource en utilisant le protocole <code>file://</code>. Il peut être utile dans certains cas, par exemple en utilisant le protocole <code>file://</code> , pour définir une politique sur une page directement dans le balisage en utilisant une balise <code>&#x3C; meta></code> :</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'none'\"</span>></span>\n</code></pre>\n<h2 id=\"8-ne-pas-définir-allowrunninginsecurecontent-à-true\"><a href=\"#8-ne-pas-définir-allowrunninginsecurecontent-à-true\">8) Ne pas définir <code>allowRunningInsecureContent</code> à <code>true</code></a></h2>\n<p><em>Cette recommandation est appliquée par défaut sur Electron</em></p>\n<p>Par défaut, Electron n'autorisera pas les sites Web chargés sur <code>HTTPS</code> à charger et exécuter des scripts, CSS ou plugins à partir de sources non sécurisées (<code>HTTP</code>). Définir la propriété <code>allowRunningInsecureContent</code> à <code>true</code> désactive cette protection.</p>\n<p>Chargement du HTML initial d'un site sur <code>HTTPS</code> et tentative de chargement de ressources ultérieures via <code>HTTP</code> est aussi connu sous le nom de \"contenu mixte\".</p>\n<h3 id=\"pourquoi--5\"><a href=\"#pourquoi--5\">Pourquoi ?</a></h3>\n<p>Le chargement du contenu sur <code>HTTPS</code> assure l'authenticité et l'intégrité des ressources chargées tout en chiffrant le trafic lui-même. Consultez la section sur l' <a href=\"#1-only-load-secure-content\">affichage du contenu sécurisé uniquement</a> pour plus de détails.</p>\n<h3 id=\"comment--5\"><a href=\"#comment--5\">Comment ?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Incorrect</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">allowRunningInsecureContent</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Correct</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({})\n</code></pre>\n<h2 id=\"9-nautorisez-pas-de-fonctionnalités-expérimentales\"><a href=\"#9-nautorisez-pas-de-fonctionnalités-expérimentales\">9) N'autorisez pas de fonctionnalités expérimentales</a></h2>\n<p><em>Cette recommandation est appliquée par défaut sur Electron</em></p>\n<p>Les utilisateurs avancés d'Electron peuvent activer les fonctionnalités expérimentales de Chromium en utilisant la propriété <code>fonctionnalités expérimentales</code>.</p>\n<h3 id=\"pourquoi--6\"><a href=\"#pourquoi--6\">Pourquoi ?</a></h3>\n<p>Experimental features are, as the name suggests, experimental and have not been enabled for all Chromium users. Furthermore, their impact on Electron as a whole has likely not been tested.</p>\n<p>Il est parfois légitime de les implémenter, mais à moins que vous sachiez vraiment ce que vous faites, vous ne devriez pas autoriser ces fonctionnalités.</p>\n<h3 id=\"comment--6\"><a href=\"#comment--6\">Comment ?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Incorrect</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">experimentalFeatures</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Correct</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({})\n</code></pre>\n<h2 id=\"10-nutilisez-pas-enableblinkfeatures\"><a href=\"#10-nutilisez-pas-enableblinkfeatures\">10) N'utilisez pas <code>enableBlinkFeatures</code></a></h2>\n<p><em>Cette recommandation est appliquée par défaut sur Electron</em></p>\n<p>Blink est le nom du moteur de rendu derrière Chromium. Comme pour <code>experimentalFeatures</code>, la propriété <code>enableBlinkFeatures</code> permet aux développeurs d'activer les fonctionnalités qui ont été désactivées par défaut.</p>\n<h3 id=\"pourquoi--7\"><a href=\"#pourquoi--7\">Pourquoi ?</a></h3>\n<p>De manière générale, il y a probablement de bonnes raisons si une fonctionnalité n'était pas activée par défaut. Il existe des cas d'utilisation légitime pour l'activation de fonctionnalités spécifiques. En tant que développeur , vous devriez savoir exactement pourquoi vous avez besoin d'activer une fonctionnalité, quelles sont les ramifications et comment elles ont un impact sur la sécurité de votre application. En aucune circonstance ne devrait vous permettre d'activer des fonctionnalités de manière spéculative.</p>\n<h3 id=\"comment--7\"><a href=\"#comment--7\">Comment ?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Mauvais</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">enableBlinkFeatures</span>: <span class=\"hljs-string\">'ExecCommandInJavaScript'</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Correct</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n</code></pre>\n<h2 id=\"11-ne-pas-utiliser-allowpopups\"><a href=\"#11-ne-pas-utiliser-allowpopups\">11) Ne pas utiliser <code>allowpopups</code></a></h2>\n<p><em>Cette recommandation est appliquée par défaut sur Electron</em></p>\n<p>Si vous utilisez <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>, vous aurez peut-être besoin des pages et des scripts chargés dans votre balise <code>&#x3C;webview></code> pour ouvrir de nouvelles fenêtres. L'attribut <code>allowpopups</code> leur permet de créer un nouveau <a href=\"/docs/api/browser-window\"><code>BrowserWindows</code></a> en utilisant la méthode <code>window.open()</code>. Les balises <code>&#x3C;webview></code> ne sont pas autorisées à créer de nouvelles fenêtres .</p>\n<h3 id=\"pourquoi--8\"><a href=\"#pourquoi--8\">Pourquoi ?</a></h3>\n<p>Si vous n'avez pas besoin de popups, il vaut mieux ne pas autoriser la création de nouveaux <a href=\"/docs/api/browser-window\"><code>BrowserWindows</code></a> par défaut. Cela suit le principe d'accès minimum requis : ne laissez pas un site web créer de nouvelles fenêtres popups à moins que vous sachiez qu'il a besoin de cette fonctionnalité.</p>\n<h3 id=\"comment--8\"><a href=\"#comment--8\">Comment ?</a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Incorrect --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">allowpopups</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Correct --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<h2 id=\"12-vérifiez-les-options-de-webview-avant-la-création\"><a href=\"#12-vérifiez-les-options-de-webview-avant-la-création\">12) Vérifiez les options de WebView avant la création</a></h2>\n<p>Un WebView créé dans un processus de rendu qui n'a pas d'intégration Node.js activé ne sera pas en mesure d'activer l'intégration elle-même. Cependant, un WebView créera toujours un processus de rendu indépendant avec ses propres <code>webPreferences</code>.</p>\n<p>C'est une bonne idée de contrôler la création de nouvelles balises <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>&#x3C;1>&#x3C;/0> depuis le processus principal et de vérifier que leurs préférences web ne désactivent pas les fonctions de sécurité .</p>\n<h3 id=\"pourquoi--9\"><a href=\"#pourquoi--9\">Pourquoi ?</a></h3>\n<p>Depuis que <code>&#x3C;webview></code> vivent dans le DOM, ils peuvent être créés par un script exécuté sur votre site web même si l'intégration de Node.js est désactivée.</p>\n<p>Electron permet aux développeurs de désactiver diverses fonctionnalités de sécurité qui contrôlent un processus de rendu. Dans la plupart des cas, les développeurs n'ont pas besoin de désactiver ces fonctionnalités - et vous ne devriez donc pas autoriser différentes configurations pour les balises <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>&#x3C;1>&#x3C;/0> nouvellement créées.</p>\n<h3 id=\"comment--9\"><a href=\"#comment--9\">Comment ?</a></h3>\n<p>Avant qu'un tag <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a><code>&#x3C;/0> ne soit attaché, Electron lancera l'événement &#x3C;2>will-attach-webview&#x3C;/2> sur l'hébergement &#x3C;2>webContents&#x3C;/2>. Utilisez l'événement pour empêcher la création de &#x3C;code>webViews</code> avec des options potentiellement non sécurisées.</p>\n<pre><code class=\"hljs language-js\">app.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.on(<span class=\"hljs-string\">'will-attach-webview'</span>, (event, webPreferences, params) => {\n    <span class=\"hljs-comment\">// Strip away preload scripts if unused or verify their location is legitimate</span>\n    <span class=\"hljs-keyword\">delete</span> webPreferences.preload\n    <span class=\"hljs-keyword\">delete</span> webPreferences.preloadURL\n\n    <span class=\"hljs-comment\">// Disable Node.js integration</span>\n    webPreferences.nodeIntegration = <span class=\"hljs-literal\">false</span>\n\n    <span class=\"hljs-comment\">// Verify URL being loaded</span>\n    <span class=\"hljs-keyword\">if</span> (!params.src.startsWith(<span class=\"hljs-string\">'https://example.com/'</span>)) {\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<p>Again, this list merely minimizes the risk, it does not remove it. If your goal is to display a website, a browser will be a more secure option.</p>\n<h2 id=\"13-désactiver-ou-limiter-la-navigation\"><a href=\"#13-désactiver-ou-limiter-la-navigation\">13) Désactiver ou limiter la navigation</a></h2>\n<p>Si votre application n'a pas besoin de naviguer ou a seulement besoin de naviguer vers des pages connues, c'est une bonne idée de limiter la navigation directement à cette portée connue, interdire tout autre type de navigation.</p>\n<h3 id=\"pourquoi--10\"><a href=\"#pourquoi--10\">Pourquoi ?</a></h3>\n<p>La navigation est un vecteur d'attaque courant. Si un attaquant peut convaincre votre application de naviguer loin de sa page actuelle, ils peuvent éventuellement forcer votre application à ouvrir sites web sur Internet. Même si vos <code>webContents</code> sont configurés pour être plus sécurisé (comme avoir <code>nodeIntegration</code> désactivé ou <code>contextIsolation</code> activé), pour que votre application ouvre un site web aléatoire rendra le travail d'exploiter votre application beaucoup plus facile.</p>\n<p>Un modèle d'attaque courant est que l'attaquant convainc les utilisateurs de votre application d'interagir avec l'application de manière à ce qu'il navigue sur l'une des pages de l'attaquant. Cela se fait généralement par le biais de liens, de plugins, ou d'autres contenus générés par l'utilisateur.</p>\n<h3 id=\"comment--10\"><a href=\"#comment--10\">Comment ?</a></h3>\n<p>Si votre application n'a pas besoin de navigation, vous pouvez appeler <code>event.preventDefault()</code> dans un gestionnaire <a href=\"/docs/api/web-contents#event-will-navigate\"><code>navigate</code></a>. Si vous savez vers quelles pages votre application peut naviguer, vérifiez l'URL dans le gestionnaire d'événements et laissez seulement la navigation se produire si elle correspond aux URL que vous attendez.</p>\n<p>Nous vous recommandons d'utiliser l'analyseur de Node pour les URL. Des comparaisons simples de chaînes de caractères peuvent parfois être dupliquées - un test <code>startsWith('https://example.com')</code> laisserait pas <code>https://example.com.attacker.com</code> à travers.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> URL = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>).URL\n\napp.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contenu. n(<span class=\"hljs-string\">'will-navigate'</span>, (event, navigationUrl) => {\n    <span class=\"hljs-keyword\">const</span> parsedUrl = <span class=\"hljs-keyword\">new</span> URL(navigationUrl)\n\n    <span class=\"hljs-keyword\">if</span> (parsedUrl. rigin !== <span class=\"hljs-string\">'https://example.com'</span>) {\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<h2 id=\"14-désactiver-ou-limiter-la-création-de-nouvelles-fenêtres\"><a href=\"#14-désactiver-ou-limiter-la-création-de-nouvelles-fenêtres\">14) Désactiver ou limiter la création de nouvelles fenêtres</a></h2>\n<p>Si vous avez un ensemble connu de fenêtres, il est bon de limiter la création de fenêtres supplémentaires dans votre application.</p>\n<h3 id=\"pourquoi--11\"><a href=\"#pourquoi--11\">Pourquoi ?</a></h3>\n<p>Tout comme la navigation, la création de nouveaux <code>webContents</code> est un vecteur d'attaque commun . Les attaquants tentent de convaincre votre application de créer de nouvelles fenêtres, cadres, ou d'autres processus de rendu avec plus de privilèges qu'avant; ou avec des pages ouvertes qu'ils ne pouvaient pas ouvrir avant.</p>\n<p>Si vous n'avez pas besoin de créer des fenêtres en plus de celles que vous savez que vous aurez besoin de créer, la désactivation de la création vous permet d'acheter gratuitement un peu de sécurité supplémentaire. C'est généralement le cas pour les applications qui ouvrent une <code>BrowserWindow</code> et n'ont pas besoin d'ouvrir un nombre arbitraire de fenêtres supplémentaires à l'exécution.</p>\n<h3 id=\"comment--11\"><a href=\"#comment--11\">Comment ?</a></h3>\n<p><a href=\"/docs/api/web-contents\"><code>webContents</code></a> will delegate to its <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\">window open handler</a> before creating new windows. The handler will receive, amongst other parameters, the <code>url</code> the window was requested to open and the options used to create it. We recommend that you register a handler to monitor the creation of windows, and deny any unexpected window creation.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n    <span class=\"hljs-comment\">// In this example, we'll ask the operating system</span>\n    <span class=\"hljs-comment\">// to open this event's url in the default browser.</span>\n    <span class=\"hljs-comment\">//</span>\n    <span class=\"hljs-comment\">// See the following item for considerations regarding what</span>\n    <span class=\"hljs-comment\">// URLs should be allowed through to shell.openExternal.</span>\n    <span class=\"hljs-keyword\">if</span> (isSafeForExternalOpen(url)) {\n      setImmediate(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n        shell.openExternal(url)\n      })\n    }\n\n    <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n  })\n})\n</code></pre>\n<h2 id=\"15-nutilisez-pas-openexternal-avec-du-contenu-non-fiable\"><a href=\"#15-nutilisez-pas-openexternal-avec-du-contenu-non-fiable\">15) N'utilisez pas <code>openExternal</code> avec du contenu non fiable</a></h2>\n<p>Le <a href=\"/docs/api/shell#shellopenexternalurl-options\"><code>openExternal</code></a> de Shell permet d'ouvrir un URI de protocole donné avec les utilitaires natifs du bureau. Sur macOS, par exemple, cette fonction est similaire à l'utilitaire de commande terminal <code>open</code> et ouvrira l'application spécifique basée sur l'URI et l'association de type fichier.</p>\n<h3 id=\"pourquoi--12\"><a href=\"#pourquoi--12\">Pourquoi ?</a></h3>\n<p>L'utilisation incorrecte de <a href=\"/docs/api/shell#shellopenexternalurl-options\"><code>openExternal</code></a> peut être utilisée pour compromettre l'hôte de l'utilisateur. Lorsque openExternal est utilisé avec du contenu non fiable, il peut être exploité pour exécuter des commandes arbitraires.</p>\n<h3 id=\"comment--12\"><a href=\"#comment--12\">Comment ?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Mauvais</span>\n<span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nshell.openExternal(USER_CONTROLLED_DATA_HERE)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bon</span>\n<span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nshell.openExternal(<span class=\"hljs-string\">'https://example.com/index.html'</span>)\n</code></pre>\n<h2 id=\"16-utiliser-une-version-actuelle-delectron\"><a href=\"#16-utiliser-une-version-actuelle-delectron\">16) Utiliser une version actuelle d'Electron</a></h2>\n<p>Vous devriez toujours vous efforcer d'utiliser la dernière version disponible d'Electron. Chaque fois qu'une nouvelle version majeure est publiée, vous devriez essayer de mettre à jour votre application le plus rapidement possible.</p>\n<h3 id=\"pourquoi--13\"><a href=\"#pourquoi--13\">Pourquoi ?</a></h3>\n<p>Une application construite avec une ancienne version d'Electron, de Chromium ou de Node.js est une cible plus facile qu'une application qui utilise des versions plus récentes de ces composants. De manière générale, les problèmes de sécurité et les exploitation de failles pour les anciennes versions de Chromium et de Node.js sont plus fréquentes.</p>\n<p>Chromium et Node.js représentent des prouesses impressionnantes d'ingénierie produites par des milliers de développeurs talentueux. Compte tenu de leur popularité, leur sécurité est soigneusement testée et analysée par des chercheurs en sécurité tout aussi compétents. Beaucoup de ces chercheurs <a href=\"https://en.wikipedia.org/wiki/Responsible_disclosure\">révèlent des vulnérabilités de manière responsable</a>, ce qui signifie généralement que les chercheurs donnent de leur temps à Chromium et Node.js pour résoudre les problèmes avant de les publier. Votre application sera plus sécurisée si elle exécute une version récente d'Electron (et donc Chromium et Node.js) dont les problèmes de sécurité potentiels ne sont pas aussi connus.</p>",
      "title": "Sécurité, fonctionnalités natives et votre responsabilité",
      "description": "⚠️ en aucune circonstance vous devriez charger et exécuter du code distant avec l'intégration de Node.js activé. Utilisez plutôt les fichiers locaux (empaquetés avec votre application) pour exécuter le code de Node. Pour afficher du contenu à distance, utilisez le tag  <webview> ou BrowserView, assurez-vous de désactiver nodeIntegration et d'activer contextIsolation."
    },
    "/docs/api/structures/segmented-control-segment": {
      "locale": "fr-FR",
      "slug": "segmented-control-segment",
      "href": "/docs/api/structures/segmented-control-segment",
      "crowdinFileId": "256499",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/segmented-control-segment.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"segmentedcontrolsegment-object\"><a href=\"#segmentedcontrolsegment-object\">SegmentedControlSegment Object</a></h1>\n<ul>\n<li><code>label</code> String (optional) - The text to appear in this segment.</li>\n<li><code>icon</code> NativeImage (optional) - The image to appear in this segment.</li>\n<li><code>enabled</code> Boolean (optional) - Whether this segment is selectable. Default: true.</li>\n</ul>",
      "title": "SegmentedControlSegment Object",
      "description": ""
    },
    "/docs/api/structures/serial-port": {
      "locale": "fr-FR",
      "slug": "serial-port",
      "href": "/docs/api/structures/serial-port",
      "crowdinFileId": "256501",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/serial-port.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"serialport-object\"><a href=\"#serialport-object\">SerialPort Object</a></h1>\n<ul>\n<li><code>portId</code> String - Unique identifier for the port.</li>\n<li><code>portName</code> String - Name of the port.</li>\n<li><code>displayName</code> String - A string suitable for display to the user for describing this device.</li>\n<li><code>vendorId</code> String - Optional USB vendor ID.</li>\n<li><code>productId</code> String - Optional USB product ID.</li>\n<li><code>serialNumber</code> String - The USB device serial number.</li>\n<li><code>usbDriverName</code> String (optional) - Represents a single serial port on macOS can be enumerated by multiple drivers.</li>\n<li><code>deviceInstanceId</code> String (optional) - A stable identifier on Windows that can be used for device permissions.</li>\n</ul>",
      "title": "SerialPort Object",
      "description": ""
    },
    "/docs/api/structures/service-worker-info": {
      "locale": "fr-FR",
      "slug": "service-worker-info",
      "href": "/docs/api/structures/service-worker-info",
      "crowdinFileId": "256503",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/service-worker-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"serviceworkerinfo-object\"><a href=\"#serviceworkerinfo-object\">ServiceWorkerInfo Object</a></h1>\n<ul>\n<li><code>scriptUrl</code> String - The full URL to the script that this service worker runs</li>\n<li><code>scope</code> String - The base URL that this service worker is active for.</li>\n<li><code>renderProcessId</code> Number - The virtual ID of the process that this service worker is running in.  This is not an OS level PID.  This aligns with the ID set used for <code>webContents.getProcessId()</code>.</li>\n</ul>",
      "title": "ServiceWorkerInfo Object",
      "description": ""
    },
    "/docs/api/service-workers": {
      "locale": "fr-FR",
      "slug": "service-workers",
      "href": "/docs/api/service-workers",
      "crowdinFileId": "256363",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/service-workers.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-serviceworkers\"><a href=\"#class-serviceworkers\">Class: ServiceWorkers</a></h2>\n<blockquote>\n<p>Query and receive events from a sessions active service workers.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Les instances de la classe <code>ServiceWorkers</code> sont accessibles à l'aide de la propriété <code>serviceWorkers</code> d'une <code>Session</code>.</p>\n<p>Par exemple :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Get all service workers.</span>\n<span class=\"hljs-built_in\">console</span>.log(session.defaultSession.serviceWorkers.getAllRunning())\n\n<span class=\"hljs-comment\">// Handle logs and get service worker info</span>\nsession.defaultSession.serviceWorkers.on(<span class=\"hljs-string\">'console-message'</span>, (event, messageDetails) => {\n  <span class=\"hljs-built_in\">console</span>.log(\n    <span class=\"hljs-string\">'Got service worker message'</span>,\n    messageDetails,\n    <span class=\"hljs-string\">'from'</span>,\n    session.defaultSession.serviceWorkers.getFromVersionID(messageDetails.versionId)\n  )\n})\n</code></pre>\n<h3 id=\"événements-dinstance\"><a href=\"#événements-dinstance\">Événements d’instance</a></h3>\n<p>Les événements suivants sont disponibles pour les instances de <code>ServiceWorkers</code> :</p>\n<h4 id=\"événement--console-message\"><a href=\"#événement--console-message\">Événement : 'console-message'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>messageDetails</code> Object - Information about the console message<ul>\n<li><code>message</code> String - The actual console message</li>\n<li><code>versionId</code> Number - The version ID of the service worker that sent the log message</li>\n<li><code>source</code> String - The type of source for this message.  Can be <code>javascript</code>, <code>xml</code>, <code>network</code>, <code>console-api</code>, <code>storage</code>, <code>app-cache</code>, <code>rendering</code>, <code>security</code>, <code>deprecation</code>, <code>worker</code>, <code>violation</code>, <code>intervention</code>, <code>recommendation</code> or <code>other</code>.</li>\n<li><code>level</code> Number - The log level, from 0 to 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>sourceUrl</code> String - The URL the message came from</li>\n<li><code>lineNumber</code> Number - The line number of the source that triggered this console message</li>\n</ul></li>\n</ul>\n<p>Emitted when a service worker logs something to the console.</p>\n<h4 id=\"event-registration-completed\"><a href=\"#event-registration-completed\">Event: 'registration-completed'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object - Information about the registered service worker<ul>\n<li><code>scope</code> String - The base URL that a service worker is registered for</li>\n</ul></li>\n</ul>\n<p>Emitted when a service worker has been registered. Can occur after a call to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\"><code>navigator.serviceWorker.register('/sw.js')</code></a> successfully resolves or when a Chrome extension is loaded.</p>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<p>Les méthodes suivants sont disponibles pour les instances de <code>ServiceWorkers</code> :</p>\n<h4 id=\"serviceworkersgetallrunning\"><a href=\"#serviceworkersgetallrunning\"><code>serviceWorkers.getAllRunning()</code></a></h4>\n<p>Returns <code>Record&#x3C;Number, ServiceWorkerInfo></code> - A <a href=\"/docs/api/structures/service-worker-info\">ServiceWorkerInfo</a> object where the keys are the service worker version ID and the values are the information about that service worker.</p>\n<h4 id=\"serviceworkersgetfromversionidversionid\"><a href=\"#serviceworkersgetfromversionidversionid\"><code>serviceWorkers.getFromVersionID(versionId)</code></a></h4>\n<ul>\n<li><code>versionId</code> Number</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/service-worker-info\"><code>ServiceWorkerInfo</code></a> - Information about this service worker</p>\n<p>If the service worker does not exist or is not running this method will throw an exception.</p>",
      "title": "ServiceWorkers",
      "description": "Query and receive events from a sessions active service workers."
    },
    "/docs/api/session": {
      "locale": "fr-FR",
      "slug": "session",
      "href": "/docs/api/session",
      "crowdinFileId": "256365",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/session.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"session\"><a href=\"#session\">session</a></h1>\n<blockquote>\n<p>Gère les sessions du navigateur, les cookies, le cache, les paramètres de proxy, etc.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>Le module <code>session</code> peut être utilisé pour créer des objets <code>Session</code>.</p>\n<p>Vous pouvez également accéder à la <code>session</code> des pages existantes à l’aide de la propriété <code>session</code> des <a href=\"/docs/api/web-contents\"><code>WebContents</code></a>, ou le module <code>session</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> ses = win.webContents.session\n<span class=\"hljs-built_in\">console</span>.log(ses.getUserAgent())\n</code></pre>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module <code>session</code> dispose des méthodes suivantes :</p>\n<h3 id=\"sessionfrompartitionpartition-options\"><a href=\"#sessionfrompartitionpartition-options\"><code>session.fromPartition(partition[, options])</code></a></h3>\n<ul>\n<li><code>partition</code> String</li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>cache</code> Boolean - Si vous voulez activer le cache.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Session</code> - Une instance de session de la chaîne de caractères <code>partition</code>. Quand il y a une <code>Session</code> existante avec la même <code>partition</code>, elle sera retournée; sinon une nouvelle instance <code>Session</code> sera créée avec <code>options</code>.</p>\n<p>Si <code>partition</code> commence par <code>persist:</code>, la page utilisera une session persistante disponible pour toutes les pages de l'application avec la même <code>partition</code>. s'il n'y a pas de <code>persist:</code> préfixe, la page utilisera une session en mémoire. Si le <code>partition</code> est vide puis la session par défaut de l'application sera retournée.</p>\n<p>Pour créer une <code>Session</code> avec <code>options</code>, vous devez vous assurer que la <code>Session</code> avec la <code>partition</code> n'a jamais été utilisée auparavant. Il n'y a pas moyen de changer les <code>options</code> d'un objet <code>Session</code> existant.</p>\n<h2 id=\"propriétés\"><a href=\"#propriétés\">Propriétés</a></h2>\n<p>Le module <code>session</code> dispose des propriétés suivantes :</p>\n<h3 id=\"sessiondefaultsession\"><a href=\"#sessiondefaultsession\"><code>session.defaultSession</code></a></h3>\n<p>Un objet <code>Session</code>, l'objet d'une session par défaut de l'application.</p>\n<h2 id=\"classe--session\"><a href=\"#classe--session\">Classe : Session</a></h2>\n<blockquote>\n<p>Les propriétés getter et setter d'une session.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Vous pouvez créer un objet <code>Session</code> avec le module <code>session</code> :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> ses = session.fromPartition(<span class=\"hljs-string\">'persist:name'</span>)\n<span class=\"hljs-built_in\">console</span>.log(ses.getUserAgent())\n</code></pre>\n<h3 id=\"événements-dinstance\"><a href=\"#événements-dinstance\">Événements d’instance</a></h3>\n<p>Les événements suivants sont disponibles pour les instances de <code>Session</code> :</p>\n<h4 id=\"événement--will-download\"><a href=\"#événement--will-download\">Événement : 'will-download'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>item</code> <a href=\"/docs/api/download-item\">DownloadItem</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Émis lorsque Electron est sur le point de télécharger <code>item</code> dans <code>webContents</code>.</p>\n<p>Faire appel à <code>Event.preventDefault ()</code> annule le téléchargement et <code>item</code> ne sera pas disponible dans le battement suivant du processus.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nsession.defaultSession.on(<span class=\"hljs-string\">'will-download'</span>, (event, item, webContents) => {\n  event.preventDefault()\n  <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'got'</span>)(item.getURL()).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">response</span>) =></span> {\n    <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>).writeFileSync(<span class=\"hljs-string\">'/somewhere'</span>, response.body)\n  })\n})\n</code></pre>\n<h4 id=\"événement--extension-loaded\"><a href=\"#événement--extension-loaded\">Événement : 'extension-loaded'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Émis après le chargement d’une extension. Cela se produit chaque fois qu’une extension ajoutée à l’ensemble d’extensions « activées ». Ceci comprend :</p>\n<ul>\n<li>Extensions chargées à partir <code>session.loadExtension</code>.</li>\n<li>Extensions rechargées :<ul>\n<li>à partir d'un plantage.</li>\n<li>si l'extension l'a demandée (<a href=\"https://developer.chrome.com/extensions/runtime#method-reload\"><code>chrome.runtime.reload()</code></a>).</li>\n</ul></li>\n</ul>\n<h4 id=\"event-extension-unloaded\"><a href=\"#event-extension-unloaded\">Event: 'extension-unloaded'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Emitted after an extension is unloaded. Cela se produit lorsque <code>Session.removeExtension</code> est appelée.</p>\n<h4 id=\"event-extension-ready\"><a href=\"#event-extension-ready\">Event: 'extension-ready'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Emitted after an extension is loaded and all necessary browser state is initialized to support the start of the extension's background page.</p>\n<h4 id=\"event-preconnect\"><a href=\"#event-preconnect\">Event: 'preconnect'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preconnectUrl</code> String - L'URL demandée pour la préconnexion par le moteur de rendu .</li>\n<li><code>allowCredentials</code> Booléen - Vrai si le moteur de rendu demande que la connexion inclue les informations d'identification (voir la <a href=\"https://w3c.github.io/resource-hints/#preconnect\">spec</a> pour plus de détails.)</li>\n</ul>\n<p>Émis lorsqu'un processus de rendu demande de préconnexion à une URL, généralement à cause de un hint<a href=\"https://w3c.github.io/resource-hints/\">ressource </a>.</p>\n<h4 id=\"événement--spellcheck-dictionary-initialized\"><a href=\"#événement--spellcheck-dictionary-initialized\">Événement : 'spellcheck-dictionary-initialized'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file has been successfully initialized. This occurs after the file has been downloaded.</p>\n<h4 id=\"événement--spellcheck-dictionary-download-begin\"><a href=\"#événement--spellcheck-dictionary-download-begin\">Événement : 'spellcheck-dictionary-download-begin'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file starts downloading</p>\n<h4 id=\"événement--spellcheck-dictionary-download-success\"><a href=\"#événement--spellcheck-dictionary-download-success\">Événement : 'spellcheck-dictionary-download-success'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file has been successfully downloaded</p>\n<h4 id=\"événement--spellcheck-dictionary-download-failure\"><a href=\"#événement--spellcheck-dictionary-download-failure\">Événement : 'spellcheck-dictionary-download-failure'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file download fails.  For details on the failure you should collect a netlog and inspect the download request.</p>\n<h4 id=\"event-select-hid-device\"><a href=\"#event-select-hid-device\">Event: 'select-hid-device'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>Objet <code>details</code><ul>\n<li><code>deviceList</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>deviceId</code> String | null (optional)</li>\n</ul></li>\n</ul>\n<p>Emitted when a HID device needs to be selected when a call to <code>navigator.hid.requestDevice</code> is made. <code>callback</code> should be called with <code>deviceId</code> to be selected; passing no arguments to <code>callback</code> will cancel the request.  Additionally, permissioning on <code>navigator.hid</code> can be further managed by using <a href=\"#sessetpermissioncheckhandlerhandler\">ses.setPermissionCheckHandler(handler)</a> and <a href=\"#sessetdevicepermissionhandlerhandler\">ses.setDevicePermissionHandler(handler)`</a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.webContents.session.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin, details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-comment\">// Add logic here to determine if permission should be given to allow HID selection</span>\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  <span class=\"hljs-comment\">// Optionally, retrieve previously persisted devices from a persistent store</span>\n  <span class=\"hljs-keyword\">const</span> grantedDevices = fetchGrantedDevices()\n\n  win.webContents.session.setDevicePermissionHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(details.origin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; details.deviceType === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-keyword\">if</span> (details.device.vendorId === <span class=\"hljs-number\">123</span> &#x26;&#x26; details.device.productId === <span class=\"hljs-number\">345</span>) {\n        <span class=\"hljs-comment\">// Always allow this type of device (this allows skipping the call to `navigator.hid.requestDevice` first)</span>\n        <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n      }\n\n      <span class=\"hljs-comment\">// Search through the list of devices that have previously been granted permission</span>\n      <span class=\"hljs-keyword\">return</span> grantedDevices.some(<span class=\"hljs-function\">(<span class=\"hljs-params\">grantedDevice</span>) =></span> {\n        <span class=\"hljs-keyword\">return</span> grantedDevice.vendorId === details.device.vendorId &#x26;&#x26;\n              grantedDevice.productId === details.device.productId &#x26;&#x26;\n              grantedDevice.serialNumber &#x26;&#x26; grantedDevice.serialNumber === details.device.serialNumber\n      })\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  win.webContents.session.on(<span class=\"hljs-string\">'select-hid-device'</span>, (event, details, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedDevice = details.deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    callback(selectedPort?.deviceId)\n  })\n})\n</code></pre>\n<h4 id=\"event-hid-device-added\"><a href=\"#event-hid-device-added\">Event: 'hid-device-added'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>Objet <code>details</code><ul>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n</ul>\n<p>Emitted when a new HID device becomes available. For example, when a new USB device is plugged in.</p>\n<p>This event will only be emitted after <code>navigator.hid.requestDevice</code> has been called and <code>select-hid-device</code> has fired.</p>\n<h4 id=\"event-hid-device-removed\"><a href=\"#event-hid-device-removed\">Event: 'hid-device-removed'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>Objet <code>details</code><ul>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n</ul>\n<p>Emitted when a HID device has been removed.  Par exemple, cet événement se déclenchera lorsqu'un périphérique USB est débranché.</p>\n<p>This event will only be emitted after <code>navigator.hid.requestDevice</code> has been called and <code>select-hid-device</code> has fired.</p>\n<h4 id=\"event-select-serial-port\"><a href=\"#event-select-serial-port\">Event: 'select-serial-port'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>portList</code> <a href=\"/docs/api/structures/serial-port\">SerialPort[]</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>portId</code> String</li>\n</ul></li>\n</ul>\n<p>Emitted when a serial port needs to be selected when a call to <code>navigator.serial.requestPort</code> is made. <code>callback</code> should be called with <code>portId</code> to be selected, passing an empty string to <code>callback</code> will cancel the request.  Additionally, permissioning on <code>navigator.serial</code> can be managed by using <a href=\"#sessetpermissioncheckhandlerhandler\">ses.setPermissionCheckHandler(handler)</a> with the <code>serial</code> permission.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n  win.webContents.session.on(<span class=\"hljs-string\">'select-serial-port'</span>, (event, portList, webContents, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedPort = portList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    <span class=\"hljs-keyword\">if</span> (!selectedPort) {\n      callback(<span class=\"hljs-string\">''</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      callback(selectedPort.portId)\n    }\n  })\n})\n</code></pre>\n<h4 id=\"event-serial-port-added\"><a href=\"#event-serial-port-added\">Event: 'serial-port-added'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>port</code> <a href=\"/docs/api/structures/serial-port\">SerialPort</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitted after <code>navigator.serial.requestPort</code> has been called and <code>select-serial-port</code> has fired if a new serial port becomes available.  Par exemple, cet événement se déclenchera lorsqu'un nouveau périphérique USB est branché.</p>\n<h4 id=\"event-serial-port-removed\"><a href=\"#event-serial-port-removed\">Event: 'serial-port-removed'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>port</code> <a href=\"/docs/api/structures/serial-port\">SerialPort</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitted after <code>navigator.serial.requestPort</code> has been called and <code>select-serial-port</code> has fired if a serial port has been removed.  Par exemple, cet événement se déclenchera lorsqu'un périphérique USB est débranché.</p>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<p>Les méthodes suivantes sont disponibles pour les instances de <code>Session</code> :</p>\n<h4 id=\"sesgetcachesize\"><a href=\"#sesgetcachesize\"><code>ses.getCacheSize()</code></a></h4>\n<p>Retourne <code>Promise&#x3C;Integer></code> - la taille actuelle du cache de la session, en octets.</p>\n<h4 id=\"sesclearcache\"><a href=\"#sesclearcache\"><code>ses.clearCache()</code></a></h4>\n<p>Retourne <code>Promise&#x3C;void></code> - résout lorsque l'opération de nettoyage du cache est terminée.</p>\n<p>Efface le cache HTTP de la session.</p>\n<h4 id=\"sesclearstoragedataoptions\"><a href=\"#sesclearstoragedataoptions\"><code>ses.clearStorageData([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>origin</code> String (facultatif) - Doit suivre la représentation de <code>window.location.origin</code> <code>scheme://host:port</code>.</li>\n<li><code>storages</code> String<a href=\"/docs/api/facultatif\"></a> - Les types de stockage à effacer, peuvent contenir : <code>appcache</code>, <code>cookies</code>, <code>filesystem</code>, <code>indexdb</code>, <code>localstorage</code>, <code>shadercache</code>, <code>websql</code>, <code>serviceworkers</code>, <code>cachestorage</code>. Si ce n'est pas spécifié, effacez tous les types de stockage.</li>\n<li><code>quotas</code> String<a href=\"/docs/api/optional\"></a> - The types of quotas to clear, can contain: <code>temporary</code>, <code>persistent</code>, <code>syncable</code>. S'il n'est pas spécifié, effacez tous les quotas.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the storage data has been cleared.</p>\n<h4 id=\"sesflushstoragedata\"><a href=\"#sesflushstoragedata\"><code>ses.flushStorageData()</code></a></h4>\n<p>Writes any unwritten DOMStorage data to disk.</p>\n<h4 id=\"sessetproxyconfig\"><a href=\"#sessetproxyconfig\"><code>ses.setProxy(config)</code></a></h4>\n<ul>\n<li><code>config</code> Object<ul>\n<li><code>mode</code> String (optional) - The proxy mode. Should be one of <code>direct</code>, <code>auto_detect</code>, <code>pac_script</code>, <code>fixed_servers</code> or <code>system</code>. If it's unspecified, it will be automatically determined based on other specified options.<ul>\n<li><code>direct</code> In direct mode all connections are created directly, without any proxy involved.</li>\n<li><code>auto_detect</code> In auto_detect mode the proxy configuration is determined by a PAC script that can be downloaded at <a href=\"http://wpad/wpad.dat\">http://wpad/wpad.dat</a>.</li>\n<li><code>pac_script</code> In pac_script mode the proxy configuration is determined by a PAC script that is retrieved from the URL specified in the <code>pacScript</code>. C'est le mode par défaut si <code>pacScript</code> est spécifié.</li>\n<li><code>fixed_servers</code> En mode fixed_servers, la configuration du proxy est spécifiée dans <code>proxyRules</code>. Il s'agit du mode par défaut si <code>proxyRules</code> est spécifié.</li>\n<li><code>system</code> In system mode the proxy configuration is taken from the operating system. Note that the system mode is different from setting no proxy configuration. In the latter case, Electron falls back to the system settings only if no command-line options influence the proxy configuration.</li>\n</ul></li>\n<li><code>pacScript</code> String (optional) - The URL associated with the PAC file.</li>\n<li><code>proxyRules</code> String (optional) - Rules indicating which proxies to use.</li>\n<li><code>proxyBypassRules</code> String (optional) - Rules indicating which URLs should bypass the proxy settings.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the proxy setting process is complete.</p>\n<p>Indique les paramètres de proxy.</p>\n<p>When <code>mode</code> is unspecified, <code>pacScript</code> and <code>proxyRules</code> are provided together, the <code>proxyRules</code> option is ignored and <code>pacScript</code> configuration is applied.</p>\n<p>You may need <code>ses.closeAllConnections</code> to close currently in flight connections to prevent pooled sockets using previous proxy from being reused by future requests.</p>\n<p>Les <code>proxyRules</code> doivent suivre les règles ci-dessous :</p>\n<pre><code class=\"hljs language-sh\">proxyRules = schemeProxies[<span class=\"hljs-string\">\";\"</span>&#x3C;schemeProxies>]\nschemeProxies = [&#x3C;urlScheme><span class=\"hljs-string\">\"=\"</span>]&#x3C;proxyURIList>\nurlScheme = <span class=\"hljs-string\">\"http\"</span> | <span class=\"hljs-string\">\"https\"</span> | <span class=\"hljs-string\">\"ftp\"</span> | <span class=\"hljs-string\">\"socks\"</span>\nproxyURIList = &#x3C;proxyURL>[<span class=\"hljs-string\">\",\"</span>&#x3C;proxyURIList>]\nproxyURL = [&#x3C;proxyScheme><span class=\"hljs-string\">\"://\"</span>]&#x3C;proxyHost>[<span class=\"hljs-string\">\":\"</span>&#x3C;proxyPort>]\n</code></pre>\n<p>Par exemple :</p>\n<ul>\n<li><code>http=foopy:80;ftp=foopy2</code> - Use HTTP proxy <code>foopy:80</code> for <code>http://</code> URLs, and HTTP proxy <code>foopy2:80</code> for <code>ftp://</code> URLs.</li>\n<li><code>foopy:80</code> - Use HTTP proxy <code>foopy:80</code> for all URLs.</li>\n<li><code>foopy:80,bar,direct://</code> - Use HTTP proxy <code>foopy:80</code> for all URLs, failing over to <code>bar</code> if <code>foopy:80</code> is unavailable, and after that using no proxy.</li>\n<li><code>socks4://foopy</code> - Use SOCKS v4 proxy <code>foopy:1080</code> for all URLs.</li>\n<li><code>http=foopy,socks5://bar.com</code> - Use HTTP proxy <code>foopy</code> for http URLs, and fail over to the SOCKS5 proxy <code>bar.com</code> if <code>foopy</code> is unavailable.</li>\n<li><code>http=foopy,direct://</code> - Use HTTP proxy <code>foopy</code> for http URLs, and use no proxy if <code>foopy</code> is unavailable.</li>\n<li><code>http=foopy;socks=foopy2</code> - Use HTTP proxy <code>foopy</code> for http URLs, and use <code>socks4://foopy2</code> for all other URLs.</li>\n</ul>\n<p>Le <code>proxyBypassRules</code> est une liste de règles séparées par des virgules, comme décrites ci-dessous :</p>\n<ul>\n<li>\n<p><code>[ URL_SCHEME \"://\" ] HOSTNAME_PATTERN [ \":\" &#x3C;port> ]</code></p>\n<p> Correspond à tous les noms d'hôte qui correspondent au pattern HOSTNAME_PATTERN.</p>\n<p> Examples: \"foobar.com\", \"<em>foobar.com\", \"</em>.foobar.com\", \"<em>foobar.com:99\", \"<a href=\"https://x\">https://x</a>.</em>.y.com:99\"</p>\n</li>\n<li>\n<p><code>\".\" HOSTNAME_SUFFIX_PATTERN [ \":\" PORT ]</code></p>\n<p> Correspond à un suffixe de domaine particulier.</p>\n<p> Exemples: \".google.com\", \".com\", \"<a href=\"http://.google.com\">http://.google.com</a>\"</p>\n</li>\n<li>\n<p><code>[ SCHEME \"://\" ] IP_LITERAL [ \":\" PORT ]</code></p>\n<p> Correspond aux URLs qui sont des adresses IP littérales.</p>\n<p> Exemples: \"127.0.1\", \"[0:0::1]\", \"[::1]\", \"<a href=\"http://%5B::1%5D:99\">http://[::1]:99</a>\"</p>\n</li>\n<li>\n<p><code>IP_LITERAL \"/\" PREFIX_LENGTH_IN_BITS</code></p>\n<p> Match any URL that is to an IP literal that falls between the given range. IP range is specified using CIDR notation.</p>\n<p> Exemples: \"192.168.1.1/16\", \"fefe:13::abc/33\".</p>\n</li>\n<li>\n<p><code>&#x3C;local></code></p>\n<p> Match local addresses. The meaning of <code>&#x3C;local></code> is whether the host matches one of: \"127.0.0.1\", \"::1\", \"localhost\".</p>\n</li>\n</ul>\n<h4 id=\"sesresolveproxyurl\"><a href=\"#sesresolveproxyurl\"><code>ses.resolveProxy(url)</code></a></h4>\n<ul>\n<li><code>url</code> URL</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - Resolves with the proxy information for <code>url</code>.</p>\n<h4 id=\"sesforcereloadproxyconfig\"><a href=\"#sesforcereloadproxyconfig\"><code>ses.forceReloadProxyConfig()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the all internal states of proxy service is reset and the latest proxy configuration is reapplied if it's already available. Le script pac sera à nouveau extrait de <code>pacScript</code> si le mode proxy est <code>pac_script</code>.</p>\n<h4 id=\"sessetdownloadpathpath\"><a href=\"#sessetdownloadpathpath\"><code>ses.setDownloadPath(path)</code></a></h4>\n<ul>\n<li><code>path</code> String - The download location.</li>\n</ul>\n<p>Sets download saving directory. By default, the download directory will be the <code>Downloads</code> under the respective app folder.</p>\n<h4 id=\"sesenablenetworkemulationoptions\"><a href=\"#sesenablenetworkemulationoptions\"><code>ses.enableNetworkEmulation(options)</code></a></h4>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>offline</code> Boolean (optional) - Whether to emulate network outage. Defaults to false.</li>\n<li><code>latency</code> Double (optional) - RTT in ms. Defaults to 0 which will disable latency throttling.</li>\n<li><code>downloadThroughput</code> Double (optional) - Download rate in Bps. Defaults to 0 which will disable download throttling.</li>\n<li><code>uploadThroughput</code> Double (optional) - Upload rate in Bps. Defaults to 0 which will disable upload throttling.</li>\n</ul></li>\n</ul>\n<p>Emule le réseau avec la configuration donnée pour la <code>session</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Pour émuler une connexion GPRS avec un débit de 50kbps et une latence de 500 ms.</span>\n<span class=\"hljs-built_in\">window</span>.webContents.session.enableNetworkEmulation({\n  <span class=\"hljs-attr\">latency</span>: <span class=\"hljs-number\">500</span>,\n  <span class=\"hljs-attr\">downloadThroughput</span>: <span class=\"hljs-number\">6400</span>,\n  <span class=\"hljs-attr\">uploadThroughput</span>: <span class=\"hljs-number\">6400</span>\n})\n\n<span class=\"hljs-comment\">// Pour simuler une panne réseau.</span>\n<span class=\"hljs-built_in\">window</span>.webContents.session.enableNetworkEmulation({ <span class=\"hljs-attr\">offline</span>: <span class=\"hljs-literal\">true</span> })\n</code></pre>\n<h4 id=\"sespreconnectoptions\"><a href=\"#sespreconnectoptions\"><code>ses.preconnect(options)</code></a></h4>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>url</code> String - URL for preconnect. Only the origin is relevant for opening the socket.</li>\n<li><code>numSockets</code> Number (optional) - number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.</li>\n</ul></li>\n</ul>\n<p>Preconnects the given number of sockets to an origin.</p>\n<h4 id=\"sescloseallconnections\"><a href=\"#sescloseallconnections\"><code>ses.closeAllConnections()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when all connections are closed.</p>\n<p><strong>Note:</strong> It will terminate / fail all requests currently in flight.</p>\n<h4 id=\"sesdisablenetworkemulation\"><a href=\"#sesdisablenetworkemulation\"><code>ses.disableNetworkEmulation()</code></a></h4>\n<p>Disables any network emulation already active for the <code>session</code>. Resets to the original network configuration.</p>\n<h4 id=\"sessetcertificateverifyprocproc\"><a href=\"#sessetcertificateverifyprocproc\"><code>ses.setCertificateVerifyProc(proc)</code></a></h4>\n<ul>\n<li><code>proc</code> Function | null<ul>\n<li><code>request</code> Object<ul>\n<li><code>hostname</code> String</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>validatedCertificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>verificationResult</code> String - Résultat de la vérification par Chromium.</li>\n<li><code>errorCode</code> Integer - Code d'erreur.</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>verificationResult</code> Integer - Value can be one of certificate error codes from <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">here</a>. Apart from the certificate error codes, the following special codes can be used.<ul>\n<li><code>0</code> - Indique la réussite et désactive la vérification de transparence de certificat.</li>\n<li><code>-2</code> - Indique l'échec.</li>\n<li><code>-3</code> - Utilise le résultat de la vérification de Chromium.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Sets the certificate verify proc for <code>session</code>, the <code>proc</code> will be called with <code>proc(request, callback)</code> whenever a server certificate verification is requested. Calling <code>callback(0)</code> accepts the certificate, calling <code>callback(-2)</code> rejects it.</p>\n<p>Calling <code>setCertificateVerifyProc(null)</code> will revert back to default certificate verify proc.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.webContents.session.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">request, callback</span>) =></span> {\n  <span class=\"hljs-keyword\">const</span> { hostname } = request\n  <span class=\"hljs-keyword\">if</span> (hostname === <span class=\"hljs-string\">'github.com'</span>) {\n    callback(<span class=\"hljs-number\">0</span>)\n  } <span class=\"hljs-keyword\">else</span> {\n    callback(<span class=\"hljs-number\">-2</span>)\n  }\n})\n</code></pre>\n<blockquote>\n<p><strong>NOTE:</strong> The result of this procedure is cached by the network service.</p>\n</blockquote>\n<h4 id=\"sessetpermissionrequesthandlerhandler\"><a href=\"#sessetpermissionrequesthandlerhandler\"><code>ses.setPermissionRequestHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Function | null<ul>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a> - WebContents qui demandent la permission.  Please note that if the request comes from a subframe you should use <code>requestingUrl</code> to check the request origin.</li>\n<li><code>permission</code> String - The type of requested permission.<ul>\n<li><code>clipboard-read</code> - Demande d'accès à la lecture depuis le presse-papiers.</li>\n<li><code>média</code> - Demande l'accès à des périphériques multimédia tels que la caméra, le microphone et les haut-parleurs.</li>\n<li><code>afficher-capture</code> Demander acces pour capturer l'ecran.</li>\n<li><code>mediaKeysystem</code> - Demande d’accès au contenu protégé par DRM.</li>\n<li><code>geolocation</code> - Demande d'accès à l'emplacement actuel de l'utilisateur.</li>\n<li><code>notifications</code> - Request notification creation and the ability to display them in the user's system tray.</li>\n<li><code>midi</code> - Request MIDI access in the <code>webmidi</code> API.</li>\n<li><code>midiSysex</code> - Request the use of system exclusive messages in the <code>webmidi</code> API.</li>\n<li><code>pointerLock</code> - Request to directly interpret mouse movements as an input method. Cliquez <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API\">ici</a> pour en savoir plus.</li>\n<li><code>fullscreen</code> - Demande de l'application pour passer en mode plein écran.</li>\n<li><code>openExternal</code> - Request to open links in external applications.</li>\n<li><code>unknown</code> - An unrecognized permission request</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>permissionGranted</code> Boolean - Allow or deny the permission.</li>\n</ul></li>\n<li><code>details</code> Object - Some properties are only available on certain permission types.<ul>\n<li><code>externalURL</code> String (optional) - The url of the <code>openExternal</code> request.</li>\n<li><code>mediaTypes</code> String<a href=\"/docs/api/optional\"></a> - The types of media access being requested, elements can be <code>video</code> or <code>audio</code></li>\n<li><code>requestingUrl</code> String - The last URL the requesting frame loaded</li>\n<li><code>isMainFrame</code> Boolean - Whether the frame making the request is the main frame</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Sets the handler which can be used to respond to permission requests for the <code>session</code>. Calling <code>callback(true)</code> will allow the permission and <code>callback(false)</code> will reject it. Pour effacer le gestionnaire, appelez <code>setPermissionRequestHandler(null)</code>.  Please note that you must also implement <code>setPermissionCheckHandler</code> to get complete permission handling. Most web APIs do a permission check and then make a permission request if the check is denied.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nsession.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).setPermissionRequestHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, callback</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (webContents.getURL() === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notifications'</span>) {\n    <span class=\"hljs-keyword\">return</span> callback(<span class=\"hljs-literal\">false</span>) <span class=\"hljs-comment\">// interdit.</span>\n  }\n\n  callback(<span class=\"hljs-literal\">true</span>)\n})\n</code></pre>\n<h4 id=\"sessetpermissioncheckhandlerhandler\"><a href=\"#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Function\\<boolean> | null<ul>\n<li><code>webContents</code> (<a href=\"/docs/api/web-contents\">WebContents</a> | null) - WebContents checking the permission.  Please note that if the request comes from a subframe you should use <code>requestingUrl</code> to check the request origin.  Toutes les frames de cross origin effectuant des vérifications de permission passeront un <code>null</code> webContents à ce gestionnaire, alors que certaines autres vérifications de permissions, telles que <code>notifications</code> , passeront toujours <code>null</code>.  You should use <code>embeddingOrigin</code> and <code>requestingOrigin</code> to determine what origin the owning frame and the requesting frame are on respectively.</li>\n<li><code>permission</code> String - Type of permission check.  Valid values are <code>midiSysex</code>, <code>notifications</code>, <code>geolocation</code>, <code>media</code>,<code>mediaKeySystem</code>,<code>midi</code>, <code>pointerLock</code>, <code>fullscreen</code>, <code>openExternal</code>, <code>hid</code>, or <code>serial</code>.</li>\n<li><code>requestingOrigin</code> String - The origin URL of the permission check</li>\n<li><code>details</code> Object - Some properties are only available on certain permission types.<ul>\n<li><code>embeddingOrigin</code> String (optional) - The origin of the frame embedding the frame that made the permission check.  Only set for cross-origin sub frames making permission checks.</li>\n<li><code>securityOrigin</code> String (optional) - The security origin of the <code>media</code> check.</li>\n<li><code>mediaType</code> String (optional) - The type of media access being requested, can be <code>video</code>, <code>audio</code> or <code>unknown</code></li>\n<li><code>requestingUrl</code> String (optional) - The last URL the requesting frame loaded.  This is not provided for cross-origin sub frames making permission checks.</li>\n<li><code>isMainFrame</code> Boolean - Whether the frame making the request is the main frame</li>\n</ul></li>\n</ul></boolean></li>\n</ul>\n<p>Sets the handler which can be used to respond to permission checks for the <code>session</code>. Returning <code>true</code> will allow the permission and <code>false</code> will reject it.  Please note that you must also implement <code>setPermissionRequestHandler</code> to get complete permission handling. Most web APIs do a permission check and then make a permission request if the check is denied. Pour effacer le gestionnaire, appelez <code>setPermissionCheckHandler(null)</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>)\nsession.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(requestingOrigin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notifications'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span> <span class=\"hljs-comment\">// granted</span>\n  }\n\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span> <span class=\"hljs-comment\">// denied</span>\n})\n</code></pre>\n<h4 id=\"sessetdevicepermissionhandlerhandler\"><a href=\"#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Function\\<boolean> | null<ul>\n<li>Objet <code>details</code><ul>\n<li><code>deviceType</code> String - The type of device that permission is being requested on, can be <code>hid</code>.</li>\n<li><code>origin</code> String - The origin URL of the device permission check.</li>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice</a> - the device that permission is being requested for.</li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a> - WebFrameMain checking the device permission.</li>\n</ul></li>\n</ul></boolean></li>\n</ul>\n<p>Sets the handler which can be used to respond to device permission checks for the <code>session</code>. Returning <code>true</code> will allow the device to be permitted and <code>false</code> will reject it. To clear the handler, call <code>setDevicePermissionHandler(null)</code>. This handler can be used to provide default permissioning to devices without first calling for permission to devices (eg via <code>navigator.hid.requestDevice</code>).  If this handler is not defined, the default device permissions as granted through device selection (eg via <code>navigator.hid.requestDevice</code>) will be used. Additionally, the default behavior of Electron is to store granted device permision through the lifetime of the corresponding WebContents.  If longer term storage is needed, a developer can store granted device permissions (eg when handling the <code>select-hid-device</code> event) and then read from that storage with <code>setDevicePermissionHandler</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.webContents.session.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin, details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-comment\">// Add logic here to determine if permission should be given to allow HID selection</span>\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  <span class=\"hljs-comment\">// Optionally, retrieve previously persisted devices from a persistent store</span>\n  <span class=\"hljs-keyword\">const</span> grantedDevices = fetchGrantedDevices()\n\n  win.webContents.session.setDevicePermissionHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(details.origin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; details.deviceType === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-keyword\">if</span> (details.device.vendorId === <span class=\"hljs-number\">123</span> &#x26;&#x26; details.device.productId === <span class=\"hljs-number\">345</span>) {\n        <span class=\"hljs-comment\">// Always allow this type of device (this allows skipping the call to `navigator.hid.requestDevice` first)</span>\n        <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n      }\n\n      <span class=\"hljs-comment\">// Search through the list of devices that have previously been granted permission</span>\n      <span class=\"hljs-keyword\">return</span> grantedDevices.some(<span class=\"hljs-function\">(<span class=\"hljs-params\">grantedDevice</span>) =></span> {\n        <span class=\"hljs-keyword\">return</span> grantedDevice.vendorId === details.device.vendorId &#x26;&#x26;\n              grantedDevice.productId === details.device.productId &#x26;&#x26;\n              grantedDevice.serialNumber &#x26;&#x26; grantedDevice.serialNumber === details.device.serialNumber\n      })\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  win.webContents.session.on(<span class=\"hljs-string\">'select-hid-device'</span>, (event, details, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedDevice = details.deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    callback(selectedPort?.deviceId)\n  })\n})\n</code></pre>\n<h4 id=\"sesclearhostresolvercache\"><a href=\"#sesclearhostresolvercache\"><code>ses.clearHostResolverCache()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the operation is complete.</p>\n<p>Vide le cache de résolution de l'hôte.</p>\n<h4 id=\"sesallowntlmcredentialsfordomainsdomains\"><a href=\"#sesallowntlmcredentialsfordomainsdomains\"><code>ses.allowNTLMCredentialsForDomains(domains)</code></a></h4>\n<ul>\n<li><code>domaines</code> String - Une liste de serveurs séparés par des virgules pour lesquels l'authentification intégrée est activée.</li>\n</ul>\n<p>Définit dynamiquement s'il faut toujours envoyer des identifiants pour l'authentification HTTP NTLM ou Négocier .</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">// considère n'importe quelle url se terminant par `example.com`, `foobar.com`, `baz`</span>\n<span class=\"hljs-comment\">// pour une authentification intégrée.</span>\nsession.defaultSession.allowNTLMCredentialsForDomains(<span class=\"hljs-string\">'*example.com, *foobar.com, *baz'</span>)\n\n<span class=\"hljs-comment\">// considère toutes les urls pour une authentification intégrée.</span>\nsession.defaultSession.allowNTLMCredentialsForDomains(<span class=\"hljs-string\">'*'</span>)\n</code></pre>\n<h4 id=\"sessetuseragentuseragent-acceptlanguages\"><a href=\"#sessetuseragentuseragent-acceptlanguages\"><code>ses.setUserAgent(userAgent[, acceptLanguages])</code></a></h4>\n<ul>\n<li><code>userAgent</code> String</li>\n<li><code>acceptLanguages</code> String (facultatif)</li>\n</ul>\n<p>Remplace les <code>userAgent</code> et <code>acceptLanguages</code> pour cette session.</p>\n<p>Le <code>acceptLanguages</code> doit être une liste ordonnée de codes de langue séparés par des virgules, pour exemple <code>\"en-US,fr,de,ko,zh-CN,ja\"</code>.</p>\n<p>Cela n'affecte pas les <code>WebContents</code>, et chaque <code>WebContents</code> peut utiliser <code>webContents.setUserAgent</code> pour remplacer l'agent utilisateur à l'échelle de la session.</p>\n<h4 id=\"sesispersistent\"><a href=\"#sesispersistent\"><code>ses.isPersistent()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether or not this session is a persistent one. The default <code>webContents</code> session of a <code>BrowserWindow</code> is persistent. When creating a session from a partition, session prefixed with <code>persist:</code> will be persistent, while others will be temporary.</p>\n<h4 id=\"sesgetuseragent\"><a href=\"#sesgetuseragent\"><code>ses.getUserAgent()</code></a></h4>\n<p>Renvoie <code>String</code> - L'utilisateur de cette session.</p>\n<h4 id=\"sessetsslconfigconfig\"><a href=\"#sessetsslconfigconfig\"><code>ses.setSSLConfig(config)</code></a></h4>\n<ul>\n<li><code>config</code> Object<ul>\n<li><code>minVersion</code> String (optional) - Can be <code>tls1</code>, <code>tls1.1</code>, <code>tls1.2</code> or <code>tls1.3</code>. The minimum SSL version to allow when connecting to remote servers. <code>tls1</code> par défaut.</li>\n<li><code>maxVersion</code> String (optional) - Can be <code>tls1.2</code> or <code>tls1.3</code>. The maximum SSL version to allow when connecting to remote servers. Par défaut, <code>tls1.3</code>.</li>\n<li><code>disabledCipherSuites</code> Integer<a href=\"/docs/api/optional\"></a> - List of cipher suites which should be explicitly prevented from being used in addition to those disabled by the net built-in policy. Supported literal forms: 0xAABB, where AA is <code>cipher_suite[0]</code> and BB is <code>cipher_suite[1]</code>, as defined in RFC 2246, Section 7.4.1.2. Unrecognized but parsable cipher suites in this form will not return an error. Ex: To disable TLS_RSA_WITH_RC4_128_MD5, specify 0x0004, while to disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002. Note that TLSv1.3 ciphers cannot be disabled using this mechanism.</li>\n</ul></li>\n</ul>\n<p>Sets the SSL configuration for the session. All subsequent network requests will use the new configuration. Existing network connections (such as WebSocket connections) will not be terminated, but old sockets in the pool will not be reused for new connections.</p>\n<h4 id=\"sesgetblobdataidentifier\"><a href=\"#sesgetblobdataidentifier\"><code>ses.getBlobData(identifier)</code></a></h4>\n<ul>\n<li><code>identifier</code> String - UUID valide.</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;Buffer></code> - résout avec des données Blob.</p>\n<h4 id=\"sesdownloadurlurl\"><a href=\"#sesdownloadurlurl\"><code>ses.downloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code>. The API will generate a <a href=\"/docs/api/download-item\">DownloadItem</a> that can be accessed with the <a href=\"#event-will-download\">will-download</a> event.</p>\n<p><strong>Note:</strong> This does not perform any security checks that relate to a page's origin, unlike <a href=\"/docs/api/web-contents#contentsdownloadurlurl\"><code>webContents.downloadURL</code></a>.</p>\n<h4 id=\"sescreateinterrupteddownloadoptions\"><a href=\"#sescreateinterrupteddownloadoptions\"><code>ses.createInterruptedDownload(options)</code></a></h4>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>path</code> String - Chemin d'accès absolu pour le téléchargement.</li>\n<li><code>urlChain</code> String[] - Chaîne de caractère complète de l'URL du téléchargement.</li>\n<li><code>type</code> String (facultatif)</li>\n<li><code>offset</code> Integer - Portée de départ pour le téléchargement.</li>\n<li><code>length</code> Integer - Longueur totale du le téléchargement.</li>\n<li><code>lastModified</code> String (optional) - Last-Modified header value.</li>\n<li><code>eTag</code> String (optional) - ETag header value.</li>\n<li><code>startTime</code> Double (facultatif) - Heure du début de téléchargement, en nombre de secondes depuis la date initiale UNIX (1er janvier 1970 à 0 heure (UTC)).</li>\n</ul></li>\n</ul>\n<p>Autorise la reprise des téléchargements <code>annulés</code> ou <code>interrompus</code> depuis la <code>Session</code>précédente. L'API va générer un <a href=\"/docs/api/download-item\">DownloadItem</a> accessible avec l'événement <a href=\"#event-will-download\">will-download</a> . Le <a href=\"/docs/api/download-item\">DownloadItem</a> n'aura aucun <code>WebContents</code> associé et l'état initial sera <code>interrompu</code>. Le téléchargement ne démarre que lorsque l'API <code>resume</code> est appelée sur <a href=\"/docs/api/download-item\">DownloadItem</a>.</p>\n<h4 id=\"sesclearauthcache\"><a href=\"#sesclearauthcache\"><code>ses.clearAuthCache()</code></a></h4>\n<p>Retourne <code>Promise&#x3C;void></code> - résout lorsque le cache d'authentification HTTP de la session a été effacé.</p>\n<h4 id=\"sessetpreloadspreloads\"><a href=\"#sessetpreloadspreloads\"><code>ses.setPreloads(preloads)</code></a></h4>\n<ul>\n<li><code>preloads</code> String[] - Un tableau de chemin absolu pour précharger les scripts</li>\n</ul>\n<p>Ajoute des scripts qui seront exécutés sur TOUS les contenus web qui sont associés à cette session juste avant l'exécution normale des scripts <code>preload</code>.</p>\n<h4 id=\"sesgetpreloads\"><a href=\"#sesgetpreloads\"><code>ses.getPreloads()</code></a></h4>\n<p>Retourne <code>String[]</code> un tableau de chemins pour précharger les scripts qui ont été enregistrés.</p>\n<h4 id=\"sessetspellcheckerenabledenable\"><a href=\"#sessetspellcheckerenabledenable\"><code>ses.setSpellCheckerEnabled(enable)</code></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Sets whether to enable the builtin spell checker.</p>\n<h4 id=\"sesisspellcheckerenabled\"><a href=\"#sesisspellcheckerenabled\"><code>ses.isSpellCheckerEnabled()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the builtin spell checker is enabled.</p>\n<h4 id=\"sessetspellcheckerlanguageslanguages\"><a href=\"#sessetspellcheckerlanguageslanguages\"><code>ses.setSpellCheckerLanguages(languages)</code></a></h4>\n<ul>\n<li><code>languages</code> String[] - An array of language codes to enable the spellchecker for.</li>\n</ul>\n<p>The built in spellchecker does not automatically detect what language a user is typing in.  In order for the spell checker to correctly check their words you must call this API with an array of language codes.  You can get the list of supported language codes with the <code>ses.availableSpellCheckerLanguages</code> property.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and will detect your language automatically.  This API is a no-op on macOS.</p>\n<h4 id=\"sesgetspellcheckerlanguages\"><a href=\"#sesgetspellcheckerlanguages\"><code>ses.getSpellCheckerLanguages()</code></a></h4>\n<p>Returns <code>String[]</code> - An array of language codes the spellchecker is enabled for.  If this list is empty the spellchecker will fallback to using <code>en-US</code>.  By default on launch if this setting is an empty list Electron will try to populate this setting with the current OS locale.  This setting is persisted across restarts.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and has its own list of languages.  This API is a no-op on macOS.</p>\n<h4 id=\"sessetspellcheckerdictionarydownloadurlurl\"><a href=\"#sessetspellcheckerdictionarydownloadurlurl\"><code>ses.setSpellCheckerDictionaryDownloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String - A base URL for Electron to download hunspell dictionaries from.</li>\n</ul>\n<p>By default Electron will download hunspell dictionaries from the Chromium CDN.  If you want to override this behavior you can use this API to point the dictionary downloader at your own hosted version of the hunspell dictionaries.  We publish a <code>hunspell_dictionaries.zip</code> file with each release which contains the files you need to host here, the file server must be <strong>case insensitive</strong> you must upload each file twice, once with the case it has in the ZIP file and once with the filename as all lower case.</p>\n<p>If the files present in <code>hunspell_dictionaries.zip</code> are available at <code>https://example.com/dictionaries/language-code.bdic</code> then you should call this api with <code>ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')</code>.  Please note the trailing slash.  The URL to the dictionaries is formed as <code>${url}${filename}</code>.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and therefore we do not download any dictionary files.  This API is a no-op on macOS.</p>\n<h4 id=\"seslistwordsinspellcheckerdictionary\"><a href=\"#seslistwordsinspellcheckerdictionary\"><code>ses.listWordsInSpellCheckerDictionary()</code></a></h4>\n<p>Returns <code>Promise&#x3C;String[]></code> - An array of all words in app's custom dictionary. Resolves when the full dictionary is loaded from disk.</p>\n<h4 id=\"sesaddwordtospellcheckerdictionaryword\"><a href=\"#sesaddwordtospellcheckerdictionaryword\"><code>ses.addWordToSpellCheckerDictionary(word)</code></a></h4>\n<ul>\n<li><code>word</code> String - The word you want to add to the dictionary</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the word was successfully written to the custom dictionary. This API will not work on non-persistent (in-memory) sessions.</p>\n<p><strong>Note:</strong> On macOS and Windows 10 this word will be written to the OS custom dictionary as well</p>\n<h4 id=\"sesremovewordfromspellcheckerdictionaryword\"><a href=\"#sesremovewordfromspellcheckerdictionaryword\"><code>ses.removeWordFromSpellCheckerDictionary(word)</code></a></h4>\n<ul>\n<li><code>word</code> String - The word you want to remove from the dictionary</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the word was successfully removed from the custom dictionary. This API will not work on non-persistent (in-memory) sessions.</p>\n<p><strong>Note:</strong> On macOS and Windows 10 this word will be removed from the OS custom dictionary as well</p>\n<h4 id=\"sesloadextensionpath-options\"><a href=\"#sesloadextensionpath-options\"><code>ses.loadExtension(path[, options])</code></a></h4>\n<ul>\n<li><code>path</code> String - Path to a directory containing an unpacked Chrome extension</li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>allowFileAccess</code> Boolean - Whether to allow the extension to read local files over <code>file://</code> protocol and inject content scripts into <code>file://</code> pages. This is required e.g. for loading devtools extensions on <code>file://</code> URLs. Par défaut, faux.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Extension></code> - resolves when the extension is loaded.</p>\n<p>This method will raise an exception if the extension could not be loaded. If there are warnings when installing the extension (e.g. if the extension requests an API that Electron does not support) then they will be logged to the console.</p>\n<p>Note that Electron does not support the full range of Chrome extensions APIs. See <a href=\"/docs/api/extensions#supported-extensions-apis\">Supported Extensions APIs</a> for more details on what is supported.</p>\n<p>Note that in previous versions of Electron, extensions that were loaded would be remembered for future runs of the application. This is no longer the case: <code>loadExtension</code> must be called on every boot of your app if you want the extension to be loaded.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.on(<span class=\"hljs-string\">'ready'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> session.defaultSession.loadExtension(\n    path.join(__dirname, <span class=\"hljs-string\">'react-devtools'</span>),\n    <span class=\"hljs-comment\">// allowFileAccess is required to load the devtools extension on file:// URLs.</span>\n    { <span class=\"hljs-attr\">allowFileAccess</span>: <span class=\"hljs-literal\">true</span> }\n  )\n  <span class=\"hljs-comment\">// Note that in order to use the React DevTools extension, you'll need to</span>\n  <span class=\"hljs-comment\">// download and unzip a copy of the extension.</span>\n})\n</code></pre>\n<p>This API does not support loading packed (.crx) extensions.</p>\n<p><strong>Remarque :</strong> Cette API ne peut pas être appelée avant que l'événement <code>prêt</code> du module <code>app</code> ne soit émis.</p>\n<p><strong>Note:</strong> Loading extensions into in-memory (non-persistent) sessions is not supported and will throw an error.</p>\n<h4 id=\"sesremoveextensionextensionid\"><a href=\"#sesremoveextensionextensionid\"><code>ses.removeExtension(extensionId)</code></a></h4>\n<ul>\n<li><code>extensionId</code> String - ID of extension to remove</li>\n</ul>\n<p>Unloads an extension.</p>\n<p><strong>Remarque :</strong> Cette API ne peut pas être appelée avant que l'événement <code>prêt</code> du module <code>app</code> ne soit émis.</p>\n<h4 id=\"sesgetextensionextensionid\"><a href=\"#sesgetextensionextensionid\"><code>ses.getExtension(extensionId)</code></a></h4>\n<ul>\n<li><code>extensionId</code> String - ID of extension to query</li>\n</ul>\n<p>Returns <code>Extension</code> | <code>null</code> - The loaded extension with the given ID.</p>\n<p><strong>Remarque :</strong> Cette API ne peut pas être appelée avant que l'événement <code>prêt</code> du module <code>app</code> ne soit émis.</p>\n<h4 id=\"sesgetallextensions\"><a href=\"#sesgetallextensions\"><code>ses.getAllExtensions()</code></a></h4>\n<p>Returns <code>Extension[]</code> - A list of all loaded extensions.</p>\n<p><strong>Remarque :</strong> Cette API ne peut pas être appelée avant que l'événement <code>prêt</code> du module <code>app</code> ne soit émis.</p>\n<h4 id=\"sesgetstoragepath\"><a href=\"#sesgetstoragepath\"><code>ses.getStoragePath()</code></a></h4>\n<p>A <code>String | null</code> indicating the absolute file system path where data for this session is persisted on disk.  For in memory sessions this returns <code>null</code>.</p>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<p>Les propriétés suivantes sont disponibles pour les instances de <code>Session</code> :</p>\n<h4 id=\"sesavailablespellcheckerlanguages-lecture-seule\"><a href=\"#sesavailablespellcheckerlanguages-lecture-seule\"><code>ses.availableSpellCheckerLanguages</code> <em>Lecture seule</em></a></h4>\n<p>A <code>String[]</code> array which consists of all the known available spell checker languages.  Providing a language code to the <code>setSpellCheckerLanguages</code> API that isn't in this array will result in an error.</p>\n<h4 id=\"sesspellcheckerenabled\"><a href=\"#sesspellcheckerenabled\"><code>ses.spellCheckerEnabled</code></a></h4>\n<p>A <code>Boolean</code> indicating whether builtin spell checker is enabled.</p>\n<h4 id=\"sesstoragepath-lecture-seule\"><a href=\"#sesstoragepath-lecture-seule\"><code>ses.storagePath</code> <em>Lecture seule</em></a></h4>\n<p>A <code>String | null</code> indicating the absolute file system path where data for this session is persisted on disk.  For in memory sessions this returns <code>null</code>.</p>\n<h4 id=\"sescookies-readonly\"><a href=\"#sescookies-readonly\"><code>ses.cookies</code> <em>Readonly</em></a></h4>\n<p>Un objet <a href=\"/docs/api/cookies\"><code>Cookies</code></a> pour cette session.</p>\n<h4 id=\"sesserviceworkers-lecture-seule\"><a href=\"#sesserviceworkers-lecture-seule\"><code>ses.serviceWorkers</code> <em>Lecture seule</em></a></h4>\n<p>Un objet <a href=\"/docs/api/service-workers\"><code>ServiceWorkers</code></a> pour cette session.</p>\n<h4 id=\"seswebrequest-readonly\"><a href=\"#seswebrequest-readonly\"><code>ses.webRequest</code> <em>Readonly</em></a></h4>\n<p>Un objet <a href=\"/docs/api/web-request\"><code>WebRequest</code></a> pour cette session.</p>\n<h4 id=\"sesprotocol-readonly\"><a href=\"#sesprotocol-readonly\"><code>ses.protocol</code> <em>Readonly</em></a></h4>\n<p>Un objet <a href=\"/docs/api/protocol\"><code>Protocole</code></a> pour cette session.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> protocol = session.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).protocol\n  <span class=\"hljs-keyword\">if</span> (!protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })) {\n    <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Failed to register protocol'</span>)\n  }\n})\n</code></pre>\n<h4 id=\"sesnetlog-readonly\"><a href=\"#sesnetlog-readonly\"><code>ses.netLog</code> <em>Readonly</em></a></h4>\n<p>Un objet <a href=\"/docs/api/net-log\"><code>NetLog</code></a> pour cette session.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> netLog = session.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).netLog\n  netLog.startLogging(<span class=\"hljs-string\">'/path/to/net-log'</span>)\n  <span class=\"hljs-comment\">// After some network events</span>\n  <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> netLog.stopLogging()\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Net-logs written to'</span>, path)\n})\n</code></pre>",
      "title": "session",
      "description": "Gère les sessions du navigateur, les cookies, le cache, les paramètres de proxy, etc."
    },
    "/docs/development/setting-up-symbol-server": {
      "locale": "fr-FR",
      "slug": "setting-up-symbol-server",
      "href": "/docs/development/setting-up-symbol-server",
      "crowdinFileId": "256165",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/setting-up-symbol-server.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"configuration-du-serveur-de-symboles-dans-le-déboggueur\"><a href=\"#configuration-du-serveur-de-symboles-dans-le-déboggueur\">Configuration du serveur de symboles dans le déboggueur</a></h1>\n<p>Les symboles de déboggage vous permettent d’avoir de meilleurs sessions de déboggage. Ils ont des informations sur les fonctions contenues dans les fichiers exécutables et les bibliothèques dynamiques et vous fournissent des renseignements pour obtenir des piles d’appels propre. Un serveur de symboles permet au déboggueur de charger les symboles appropriés, les fichiers binaires et les fichiers sources automatiquement, sans forcer les utilisateurs à télécharger de gros fichiers de déboggage. Documentation sur <a href=\"https://support.microsoft.com/kb/311503\">Le serveur de symboles de Microsoft</a>.</p>\n<p>Notez que parce que Electron est fortement optimisé, le déboggage n’est pas toujours facile. Le déboggueur ne sera pas en mesure de vous montrer le contenu de toutes les variables et le chemin d’exécution peut sembler étrange à cause de l’inlining, queue d’appels et autres optimisations du compilateur. La seule solution est de build une version locale non optimisée.</p>\n<p>L’URL du serveur symbole officiel pour Electron est <a href=\"https://symbols.electronjs.org\">https://symbols.electronjs.org</a>. Vous ne pouvez pas visiter cette URL directement, vous devez l’ajouter au chemin de symbole de votre outil de déboggage. Dans les exemples ci-dessous, un répertoire de cache local est utilisé pour éviter la lecture à plusieurs reprises du PDB sur le serveur. Remplacez <code>c:\\code\\symbols</code> par un répertoire de cache approprié sur votre ordinateur.</p>\n<h2 id=\"à-laide-du-serveur-de-symboles-dans-windbg\"><a href=\"#à-laide-du-serveur-de-symboles-dans-windbg\">À l’aide du serveur de symboles dans Windbg</a></h2>\n<p>Le chemin de symbole Windbg est configuré avec un string délimité par des : *. Pour utiliser uniquement le serveur de symboles d’Electron, ajoutez l’entrée suivante à votre chemin de symbole (<strong>Remarque :</strong> vous pouvez remplacer <code>c:\\code\\symbols</code> par n’importe quel répertoire accessible en écriture sur votre ordinateur, si vous préférez un emplacement différent pour les symboles téléchargés) :</p>\n<pre><code class=\"hljs language-powershell\">SRV*c:\\code\\symbols\\*https://symbols.electronjs.org\n</code></pre>\n<p>Définissez le string à <code>_NT_SYMBOL_PATH</code> dans l’environnement, en utilisant les menus de Windbg, ou en tapant la commande <code>.sympath</code>. Si vous souhaitez obtenir les symboles du serveur de symboles Microsoft, vous devez indiquer cela :</p>\n<pre><code class=\"hljs language-powershell\">SRV*c:\\code\\symbols\\*https://msdl.microsoft.com/download/symbols;SRV*c:\\code\\symbols\\*https://symbols.electronjs.org\n</code></pre>\n<h2 id=\"à-laide-du-serveur-de-symboles-dans-visual-studio\"><a href=\"#à-laide-du-serveur-de-symboles-dans-visual-studio\">À l’aide du serveur de symboles dans Visual Studio</a></h2>\n<p><img src=\"https://mdn.mozillademos.org/files/733/symbol-server-vc8express-menu.jpg\" alt=\"Outils -> Options\"> <img src=\"https://mdn.mozillademos.org/files/2497/2005_options.gif\" alt=\"Paramètres des symboles\"></p>\n<h2 id=\"problèmes--les-symboles-ne-se-chargent-pas\"><a href=\"#problèmes--les-symboles-ne-se-chargent-pas\">Problèmes : Les symboles ne se chargent pas</a></h2>\n<p>Tapez les commandes suivantes dans Windbg pour savoir pourquoi les symboles ne se chargent pas:</p>\n<pre><code class=\"hljs language-powershell\">> !sym noisy\n> .reload /f electron.exe\n</code></pre>",
      "title": "Configuration du serveur de symboles dans le déboggueur",
      "description": ""
    },
    "/docs/api/share-menu": {
      "locale": "fr-FR",
      "slug": "share-menu",
      "href": "/docs/api/share-menu",
      "crowdinFileId": "256367",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/share-menu.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharemenu\"><a href=\"#sharemenu\">ShareMenu</a></h1>\n<p>The <code>ShareMenu</code> class creates <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/\">Share Menu</a> on macOS, which can be used to share information from the current context to apps, social media accounts, and other services.</p>\n<p>For including the share menu as a submenu of other menus, please use the <code>shareMenu</code> role of <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>.</p>\n<h2 id=\"class-sharemenu\"><a href=\"#class-sharemenu\">Class: ShareMenu</a></h2>\n<blockquote>\n<p>Create share menu on macOS.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h3 id=\"new-sharemenusharingitem\"><a href=\"#new-sharemenusharingitem\"><code>new ShareMenu(sharingItem)</code></a></h3>\n<ul>\n<li><code>sharingItem</code> SharingItem - The item to share.</li>\n</ul>\n<p>Creates a new share menu.</p>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<p>L’objet <code>shareMenu</code> dispose des méthodes d’instance suivantes :</p>\n<h4 id=\"sharemenupopupoptions\"><a href=\"#sharemenupopupoptions\"><code>shareMenu.popup([options])</code></a></h4>\n<ul>\n<li><code>options</code> PopupOptions (optional)<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (facultatif) - La fenêtre focalisée est par défaut.</li>\n<li><code>x</code> Number (facultatif) - C'est par défaut la position actuelle du curseur de la souris. Doit être déclaré si <code>y</code> est déclaré.</li>\n<li><code>x</code> Number (facultatif) - C'est par défaut la position actuelle du curseur de la souris. Doit être déclaré si <code>x</code> est déclaré.</li>\n<li><code>positioningItem</code> Number (facultatif) <em>macOS</em> - L'index de l'élément de menu à positionner sous le curseur de la souris aux coordonnées spécifiées. est. La valeur par défaut est -1.</li>\n<li><code>callback</code> Fonction (facultatif) - Appelée lorsque le menu est fermé.</li>\n</ul></li>\n</ul>\n<p>Dépile ce menu sous la forme d'un menu contextuel dans la <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<h4 id=\"sharemenuclosepopupbrowserwindow\"><a href=\"#sharemenuclosepopupbrowserwindow\"><code>shareMenu.closePopup([browserWindow])</code></a></h4>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (facultatif) - La fenêtre focalisée est par défaut.</li>\n</ul>\n<p>Ferme le menu contextuel dans la <code>browserWindow</code>.</p>",
      "title": "ShareMenu",
      "description": "Create share menu on macOS."
    },
    "/docs/api/structures/shared-worker-info": {
      "locale": "fr-FR",
      "slug": "shared-worker-info",
      "href": "/docs/api/structures/shared-worker-info",
      "crowdinFileId": "256505",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/shared-worker-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharedworkerinfo-object\"><a href=\"#sharedworkerinfo-object\">SharedWorkerInfo Object</a></h1>\n<ul>\n<li><code>id</code> String - The unique id of the shared worker.</li>\n<li><code>url</code> String - The url of the shared worker.</li>\n</ul>",
      "title": "SharedWorkerInfo Object",
      "description": ""
    },
    "/docs/api/structures/sharing-item": {
      "locale": "fr-FR",
      "slug": "sharing-item",
      "href": "/docs/api/structures/sharing-item",
      "crowdinFileId": "256507",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/sharing-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharingitem-object\"><a href=\"#sharingitem-object\">SharingItem Object</a></h1>\n<ul>\n<li><code>texts</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of text to share.</li>\n<li><code>filePaths</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of files to share.</li>\n<li><code>urls</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of URLs to share.</li>\n</ul>",
      "title": "SharingItem Object",
      "description": ""
    },
    "/docs/api/shell": {
      "locale": "fr-FR",
      "slug": "shell",
      "href": "/docs/api/shell",
      "crowdinFileId": "256369",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/shell.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"shell\"><a href=\"#shell\">shell</a></h1>\n<blockquote>\n<p>Gère des fichiers et URLs à l'aide de leurs applications par défaut.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a> (non-sandboxed only)</p>\n<p>Le module <code>shell</code> fournit des fonctions liées à l'intégration bureau.</p>\n<p>Un exemple d'ouverture d'une URL dans le navigateur par défaut de l'utilisateur :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nshell.openExternal(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<p><strong>Note:</strong> While the <code>shell</code> module can be used in the renderer process, it will not function in a sandboxed renderer.</p>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Le module <code>shell</code> dispose des méthodes suivantes :</p>\n<h3 id=\"shellshowiteminfolderfullpath\"><a href=\"#shellshowiteminfolderfullpath\"><code>shell.showItemInFolder(fullPath)</code></a></h3>\n<ul>\n<li><code>fullPath</code> String</li>\n</ul>\n<p>Show the given file in a file manager. If possible, select the file.</p>\n<h3 id=\"shellopenpathpath\"><a href=\"#shellopenpathpath\"><code>shell.openPath(path)</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - Resolves with a string containing the error message corresponding to the failure if a failure occurred, otherwise \"\".</p>\n<p>Ouvre le fichier donné dans la manière par défaut de l'ordinateur.</p>\n<h3 id=\"shellopenexternalurl-options\"><a href=\"#shellopenexternalurl-options\"><code>shell.openExternal(url[, options])</code></a></h3>\n<ul>\n<li><code>url</code> String - 2081 caractères max. sur Windows.</li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>activate</code> Boolean (optional) <em>macOS</em> - <code>true</code> to bring the opened application to the foreground. Par défaut, <code>true</code>.</li>\n<li><code>workingDirectory</code> String (optional) <em>Windows</em> - Le dossier de travail.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Promise&#x3C;void></code></p>\n<p>Open the given external protocol URL in the desktop's default manner. (For example, mailto: URLs in the user's default mail agent).</p>\n<h3 id=\"shelltrashitempath\"><a href=\"#shelltrashitempath\"><code>shell.trashItem(path)</code></a></h3>\n<ul>\n<li><code>path</code> String - path to the item to be moved to the trash.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the operation has been completed. Rejects if there was an error while deleting the requested item.</p>\n<p>This moves a path to the OS-specific trash location (Trash on macOS, Recycle Bin on Windows, and a desktop-environment-specific location on Linux).</p>\n<h3 id=\"shellbeep\"><a href=\"#shellbeep\"><code>shell.beep()</code></a></h3>\n<p>Émet un signal sonore.</p>\n<h3 id=\"shellwriteshortcutlinkshortcutpath-operation-options-windows\"><a href=\"#shellwriteshortcutlinkshortcutpath-operation-options-windows\"><code>shell.writeShortcutLink(shortcutPath[, operation], options)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>shortcutPath</code> String</li>\n<li><code>operation</code> String (optional) - Default is <code>create</code>, can be one of following:<ul>\n<li><code>create</code> - Créer un nouveau raccourci, écrase si besoin.</li>\n<li><code>update</code> - Met à jour les propriétés seulement sur un raccourci existant.</li>\n<li><code>replace</code> - Remplace un raccourci existant, échoue si le raccourci n'existe pas.</li>\n</ul></li>\n<li><code>options</code> <a href=\"/docs/api/structures/shortcut-details\">ShortcutDetails</a></li>\n</ul>\n<p>Retourne <code>Boolean</code> - Si le raccourci a été créé avec succès.</p>\n<p>Créer ou met à jour un lien raccourci à <code>shortcutPath</code>.</p>\n<h3 id=\"shellreadshortcutlinkshortcutpath-windows\"><a href=\"#shellreadshortcutlinkshortcutpath-windows\"><code>shell.readShortcutLink(shortcutPath)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>shortcutPath</code> String</li>\n</ul>\n<p>Retourne <a href=\"/docs/api/structures/shortcut-details\"><code>ShortcutDetails</code></a></p>\n<p>Résout le lien raccourci à <code>shortcutPath</code>.</p>\n<p>Une exception sera levée lorsqu’une erreur se produit.</p>",
      "title": "shell",
      "description": "Gère des fichiers et URLs à l'aide de leurs applications par défaut."
    },
    "/docs/api/structures/shortcut-details": {
      "locale": "fr-FR",
      "slug": "shortcut-details",
      "href": "/docs/api/structures/shortcut-details",
      "crowdinFileId": "256509",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/shortcut-details.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"shortcutdetails-object\"><a href=\"#shortcutdetails-object\">ShortcutDetails Object</a></h1>\n<ul>\n<li><code>target</code> String - The target to launch from this shortcut.</li>\n<li><code>cwd</code> String (optional) - The working directory. Default is empty.</li>\n<li><code>args</code> String (optional) - The arguments to be applied to <code>target</code> when launching from this shortcut. Default is empty.</li>\n<li><code>description</code> String (optional) - The description of the shortcut. Default is empty.</li>\n<li><code>icon</code> String (optional) - The path to the icon, can be a DLL or EXE. <code>icon</code> and <code>iconIndex</code> have to be set together. Default is empty, which uses the target's icon.</li>\n<li><code>iconIndex</code> Number (optional) - The resource ID of icon when <code>icon</code> is a DLL or EXE. Default is 0.</li>\n<li><code>appUserModelId</code> String (optional) - The Application User Model ID. Default is empty.</li>\n<li><code>toastActivatorClsid</code> String (optional) - The Application Toast Activator CLSID. Needed for participating in Action Center.</li>\n</ul>",
      "title": "ShortcutDetails Object",
      "description": ""
    },
    "/docs/api/structures/size": {
      "locale": "fr-FR",
      "slug": "size",
      "href": "/docs/api/structures/size",
      "crowdinFileId": "256511",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/size.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"size-object\"><a href=\"#size-object\">Size Object</a></h1>\n<ul>\n<li><code>width</code> Number</li>\n<li><code>height</code> Number</li>\n</ul>",
      "title": "Size Object",
      "description": ""
    },
    "/docs/tutorial/snapcraft": {
      "locale": "fr-FR",
      "slug": "snapcraft",
      "href": "/docs/tutorial/snapcraft",
      "crowdinFileId": "256249",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/snapcraft.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"guide-snapcraft-linux\"><a href=\"#guide-snapcraft-linux\">Guide Snapcraft (Linux)</a></h1>\n<p>Ce guide fournit des informations sur comment empaqueter votre application Electron pour n’importe quel environnement Snapcraft, y compris l’Ubuntu Software Center.</p>\n<h2 id=\"contexte-et-exigences\"><a href=\"#contexte-et-exigences\">Contexte et exigences</a></h2>\n<p>Avec une plus large communauté Linux, Canonical a pour but de corriger de nombreux problèmes d'installation de logiciels courants avec le projet <a href=\"https://snapcraft.io/\"><code>snapcraft</code></a> . Snaps are containerized software packages that include required dependencies, auto-update, and work on all major Linux distributions without system modification.</p>\n<p>Il existe trois méthodes pour créer un fichier <code>.snap</code> :</p>\n<p>1) En utilisant <a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a> ou <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a>, deux outils qui sont livrés en supportant <code>snap</code> par nature. C'est l'option la plus simple. 2) En utilisant <code>electron-installer-snap</code>, qui réceptionne les émissions d'<code>electron-packager</code>. 3) En utilisant un package <code>.deb</code> déjà créé.</p>\n<p>In some cases, you will need to have the <code>snapcraft</code> tool installed. Instructions to install <code>snapcraft</code> for your particular distribution are available <a href=\"https://snapcraft.io/docs/installing-snapcraft\">here</a>.</p>\n<h2 id=\"utilisation-de-electron-installer-snap\"><a href=\"#utilisation-de-electron-installer-snap\">Utilisation de <code>electron-installer-snap</code></a></h2>\n<p>Le module fonctionne comme <a href=\"https://github.com/electron/windows-installer\"><code>electron-winstaller</code></a> et les modules similaires en ce sens que sa portée est limitée à la construction de paquets snap. Vous pouvez installer avec :</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron-installer-snap\n</code></pre>\n<h3 id=\"étape-1--empaqueter-votre-application-electron\"><a href=\"#étape-1--empaqueter-votre-application-electron\">Étape 1 : Empaqueter votre Application Electron</a></h3>\n<p>Empaquetez l’application à l’aide de <a href=\"https://github.com/electron/electron-packager\">electron-packager</a> (ou d'un outil similaire). Assurez vous de supprimer <code>node_modules</code> dont vous n'avez plus besoin dans votre application finale, puisque tout module dont vous n'avez pas besoin augmentera inutilement la taille de votre application.</p>\n<p>La sortie devrait ressembler à peu près à ceci :</p>\n<pre><code class=\"hljs language-plaintext\">.\n└── dist\n    └── app-linux-x64\n        ├── LICENSE\n        ├── LICENSES.chromium.html\n        ├── content_shell.pak\n        ├── app\n        ├── icudtl.dat\n        ├── libgcrypt.so.11\n        ├── libnode.so\n        ├── locales\n        ├── resources\n        ├── v8_context_snapshot.bin\n        └── version\n</code></pre>\n<h3 id=\"step-2-running-electron-installer-snap\"><a href=\"#step-2-running-electron-installer-snap\">Step 2: Running <code>electron-installer-snap</code></a></h3>\n<p>Depuis un terminal qui a <code>snapcraft</code> dans son <code>PATH</code>, exécutez <code>electron-installer-snap</code> avec seulement <code>--src</code>, qui est l'emplacement de votre application Electron créée à la première étape.</p>\n<pre><code class=\"hljs language-sh\">npx electron-installer-snap --src=out/myappname-linux-x64\n</code></pre>\n<p>Si vous avez un pipeline de construction existant, vous pouvez utiliser programmer <code>electron-installer-snap</code>. Pour plus d'informations, voir <a href=\"https://docs.snapcraft.io/build-snaps/syntax\">la doc Snapcraft API</a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> snap = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-installer-snap'</span>)\n\nsnap(options)\n  .then(<span class=\"hljs-function\"><span class=\"hljs-params\">snapPath</span> =></span> <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Created snap at <span class=\"hljs-subst\">${snapPath}</span>!`</span>))\n</code></pre>\n<h2 id=\"using-snapcraft-with-electron-packager\"><a href=\"#using-snapcraft-with-electron-packager\">Using <code>snapcraft</code> with <code>electron-packager</code></a></h2>\n<h3 id=\"step-1-create-sample-snapcraft-project\"><a href=\"#step-1-create-sample-snapcraft-project\">Step 1: Create Sample Snapcraft Project</a></h3>\n<p>Create your project directory and add the following to <code>snap/snapcraft.yaml</code>:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">electron-packager-hello-world</span>\n<span class=\"hljs-attr\">version:</span> <span class=\"hljs-string\">'0.1'</span>\n<span class=\"hljs-attr\">summary:</span> <span class=\"hljs-string\">Hello</span> <span class=\"hljs-string\">World</span> <span class=\"hljs-string\">Electron</span> <span class=\"hljs-string\">app</span>\n<span class=\"hljs-attr\">description:</span> <span class=\"hljs-string\">|\n  Simple Hello World Electron app as an example\n</span><span class=\"hljs-attr\">base:</span> <span class=\"hljs-string\">core18</span>\n<span class=\"hljs-attr\">confinement:</span> <span class=\"hljs-string\">strict</span>\n<span class=\"hljs-attr\">grade:</span> <span class=\"hljs-string\">stable</span>\n\n<span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">electron-packager-hello-world:</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">electron-quick-start/electron-quick-start</span> <span class=\"hljs-string\">--no-sandbox</span>\n    <span class=\"hljs-attr\">extensions:</span> <span class=\"hljs-string\">[gnome-3-34]</span>\n    <span class=\"hljs-attr\">plugs:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">browser-support</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">network</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">network-bind</span>\n    <span class=\"hljs-attr\">environment:</span>\n      <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n      <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n      <span class=\"hljs-attr\">TMPDIR:</span> <span class=\"hljs-string\">$XDG_RUNTIME_DIR</span>\n\n<span class=\"hljs-attr\">parts:</span>\n  <span class=\"hljs-attr\">electron-quick-start:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">nil</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">https://github.com/electron/electron-quick-start.git</span>\n    <span class=\"hljs-attr\">override-build:</span> <span class=\"hljs-string\">|\n        npm install electron electron-packager\n        npx electron-packager . --overwrite --platform=linux --output=release-build --prune=true\n        cp -rv ./electron-quick-start-linux-* $SNAPCRAFT_PART_INSTALL/electron-quick-start\n</span>    <span class=\"hljs-attr\">build-snaps:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">node/14/stable</span>\n    <span class=\"hljs-attr\">build-packages:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">unzip</span>\n    <span class=\"hljs-attr\">stage-packages:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnss3</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnspr4</span>\n</code></pre>\n<p>If you want to apply this example to an existing project:</p>\n<ul>\n<li>Replace <code>source: https://github.com/electron/electron-quick-start.git</code> with <code>source: .</code>.</li>\n<li>Replace all instances of <code>electron-quick-start</code> with your project's name.</li>\n</ul>\n<h3 id=\"step-2-build-the-snap\"><a href=\"#step-2-build-the-snap\">Step 2: Build the snap</a></h3>\n<pre><code class=\"hljs language-sh\">$ snapcraft\n\n&#x3C;output snipped>\nSnapped electron-packager-hello-world_0.1_amd64.snap\n</code></pre>\n<h3 id=\"step-3-install-the-snap\"><a href=\"#step-3-install-the-snap\">Step 3: Install the snap</a></h3>\n<pre><code class=\"hljs language-sh\">sudo snap install electron-packager-hello-world_0.1_amd64.snap --dangerous\n</code></pre>\n<h3 id=\"step-4-run-the-snap\"><a href=\"#step-4-run-the-snap\">Step 4: Run the snap</a></h3>\n<pre><code class=\"hljs language-sh\">electron-packager-hello-world\n</code></pre>\n<h2 id=\"en-utilisant-un-package-debian-existant\"><a href=\"#en-utilisant-un-package-debian-existant\">En utilisant un package Debian existant</a></h2>\n<p>Snapcraft est capable de prendre un fichier <code>.deb</code> existant et de le convertir en un fichier <code>.snap</code>. La création d'un snap est configurée via un fichier <code>snapcraft.yaml</code> qui décrit les sources, dépendances, descriptions, et d'autres blocs de construction cruciaux.</p>\n<h3 id=\"étape-1--créer-un-package-debian\"><a href=\"#étape-1--créer-un-package-debian\">Étape 1 : Créer un package Debian</a></h3>\n<p>Si vous n’avez pas déjà un package <code>.deb</code>, utiliser <code>electron-installer-snap</code> peut être un chemin plus facile pour créer des packages snap. However, multiple solutions for creating Debian packages exist, including <a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a>, <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> or <a href=\"https://github.com/unindented/electron-installer-debian\"><code>electron-installer-debian</code></a>.</p>\n<h3 id=\"étape-2--créer-un-snapcraftyaml\"><a href=\"#étape-2--créer-un-snapcraftyaml\">Étape 2 : Créer un snapcraft.yaml</a></h3>\n<p>For more information on the available configuration options, see the <a href=\"https://docs.snapcraft.io/build-snaps/syntax\">documentation on the snapcraft syntax</a>. Examinons un exemple :</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">myApp</span>\n<span class=\"hljs-attr\">version:</span> <span class=\"hljs-string\">'2.0.0'</span>\n<span class=\"hljs-attr\">summary:</span> <span class=\"hljs-string\">Une</span> <span class=\"hljs-string\">breve</span> <span class=\"hljs-string\">description</span> <span class=\"hljs-string\">de</span> <span class=\"hljs-string\">mon</span> <span class=\"hljs-string\">apli.</span>\n<span class=\"hljs-attr\">description:</span> <span class=\"hljs-string\">|\n You know what? This app is amazing! It does all the things\n for you. Some say it keeps you young, maybe even happy.\n</span>\n<span class=\"hljs-attr\">grade:</span> <span class=\"hljs-string\">stable</span>\n<span class=\"hljs-attr\">confinement:</span> <span class=\"hljs-string\">classic</span>\n\n<span class=\"hljs-attr\">parts:</span>\n  <span class=\"hljs-attr\">slack:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">dump</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">my-deb.deb</span>\n    <span class=\"hljs-attr\">source-type:</span> <span class=\"hljs-string\">deb</span>\n    <span class=\"hljs-attr\">after:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">desktop-gtk3</span>\n    <span class=\"hljs-attr\">stage-packages:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libasound2</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnotify4</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnspr4</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnss3</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libpcre3</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libpulse0</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libxss1</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libxtst6</span>\n  <span class=\"hljs-attr\">electron-launch:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">dump</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">files/</span>\n    <span class=\"hljs-attr\">prepare:</span> <span class=\"hljs-string\">|\n      chmod +x bin/electron-launch\n</span>\n<span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">myApp:</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">bin/electron-launch</span> <span class=\"hljs-string\">$SNAP/usr/lib/myApp/myApp</span>\n    <span class=\"hljs-attr\">desktop:</span> <span class=\"hljs-string\">usr/share/applications/myApp.desktop</span>\n    <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n    <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n    <span class=\"hljs-attr\">environment:</span>\n      <span class=\"hljs-attr\">TMPDIR:</span> <span class=\"hljs-string\">$XDG_RUNTIME_DIR</span>\n</code></pre>\n<p>Comme vous pouvez le voir, le <code>snapcraft.yaml</code> demande au système d'exécuter le fichier nommé <code>electron-launch</code>. Dans cet exemple, il transmet des informations au code binaire de l'application :</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-meta\">#!/bin/sh\n</span>\n<span class=\"hljs-built_in\">exec</span> <span class=\"hljs-string\">\"<span class=\"hljs-variable\">$@</span>\"</span> --executed-from=<span class=\"hljs-string\">\"<span class=\"hljs-variable\">$(pwd)</span>\"</span> --pid=$$ > /dev/null 2>&#x26;1 &#x26;\n</code></pre>\n<p>Alternativement, si vous générez votre <code>snap</code> avec la restriction <code>strict</code> , vous pouvez utiliser la commande <code>desktop-launch</code>:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">myApp:</span>\n    <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n    <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">env</span> <span class=\"hljs-string\">TMPDIR=$XDG_RUNTIME_DIR</span> <span class=\"hljs-string\">PATH=/usr/local/bin:${PATH}</span> <span class=\"hljs-string\">${SNAP}/bin/desktop-launch</span> <span class=\"hljs-string\">$SNAP/myApp/desktop</span>\n    <span class=\"hljs-attr\">desktop:</span> <span class=\"hljs-string\">usr/share/applications/desktop.desktop</span>\n</code></pre>",
      "title": "Guide Snapcraft (Linux)",
      "description": ""
    },
    "/docs/development/source-code-directory-structure": {
      "locale": "fr-FR",
      "slug": "source-code-directory-structure",
      "href": "/docs/development/source-code-directory-structure",
      "crowdinFileId": "256167",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/source-code-directory-structure.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"structure-du-répertoire-du-code-source\"><a href=\"#structure-du-répertoire-du-code-source\">Structure du répertoire du Code Source</a></h1>\n<p>Le code source d'Electron est séparé en plusieurs parties, principalement suivant les conventions de séparation de Chromium.</p>\n<p>Vous devrez peut-être vous familiariser avec l'<a href=\"https://dev.chromium.org/developers/design-documents/multi-process-architecture\">architecture multi-processus de Chromium</a> pour mieux comprendre le code source.</p>\n<h2 id=\"structure-du-code-source\"><a href=\"#structure-du-code-source\">Structure du Code Source</a></h2>\n<pre><code class=\"hljs language-diff\">Electron\n── build/ - Construire les fichiers de configuration nécessaires pour construire avec GN.\n── buildflags/ - Détermine l'ensemble des fonctionnalités qui peuvent être construites de manière conditionnelle.\n── chromium_src/ - Code source copié à partir de Chromium qui ne fait pas partie de la couche de contenu.\n── default_app/ - Une application par défaut exécutée lorsque Electron est démarré sans\n| fournissant une application consommateur.\n── docs/ - Documentation d'Electron.\n| ── api/ - Documentation pour les modules et les API externes d'Electron.\n| ── development/ - Documentation pour aider au développement pour et avec Electron.\n| ── violondes/ - Un ensemble de snippets de code que l'on peut exécuter dans Electron Fiddle.\n| ── images/ - Images utilisées dans la documentation.\n| &#x3C;unk> ─ tutorial/ - Documents de tutoriel pour divers aspects d'Electron.\n├── lib/ - JavaScript/TypeScript source code.\n| ── browser/ - Code d'initialisation du processus principal.\n| | | ─ api/ - Implémentation d'API pour les modules de processus principaux.\n| | &#x3C;unk> ─ remote/ - Code relatif au module distant tel qu'il est\n| | utilisé dans le processus principal.\n| ── common/ - Relating to logic needed by both main and renderer process.\n| | &#x3C;unk> ─ api/ - Implémentation de l'API pour les modules qui peuvent être utilisés dans\n| | | à la fois les processus principaux et les processus de rendu\n| ── isoated_render/ - Permet la création de processus de rendu isolés lorsque\n| | | contextIsolation est activée.\n| ── render/ - Code d'initialisation du processus de rendu.\n| | | ─ api/ - Implémentation d'API pour les modules de processus de rendu.\n| | | ── extension/ - Code relatif à l'utilisation des extensions Chrome\n| | | dans le processus de rendu d'Electron.\n| | | ─ remote/ - Logique qui gère l'usage du module remote dans\n| | | | le processus principal.\n| | &#x3C;unk> ─ web-view/ - Logique qui gère l'utilisation des webviews dans le processus\n| | renderer.\n| ── sandboxed_render/ - Logique qui gère la création du moteur de rendu en bac à sable\n| | | processus.\n| | &#x3C;unk> ─ api/ - Implémentation de l'API pour les processus de rendu bac à sable.\n| &#x3C;unk> ─ worker/ - Logique qui gère les bonnes fonctionnalités de Node.js\n| environnements dans les Web Workers.\n── patches/ - Des correctifs appliqués au dessus des dépendances principales d'Electron\n| | | afin de gérer les différences entre nos cas d'utilisation et\n| | fonctionnalité par défaut.\n| ── boringssl/ - Patchs appliqués au fork Google d'OpenSSL, BoringSSL.\n| ── chromium/ - Patchs appliqués à Chromium.\n| ── node/ - Patches appliqués au-dessus de Node.js.\n| &#x3C;unk> ─ v8/ - Patches appliqués au dessus du moteur V8 de Google.\n── shell/ - Code source C++.\n|   ├── app/ - Code d'entrée du système.\n|   ├── browser/ - Le frontend incluent la fenêtre principale, l'UI et toutes les \n|   |   |          choses du processus principal. Ceci parle au moteur de rendu pour gérer le web\n| | pages.\n|   |   ├── ui/ - Implementation de l'UI pour différentes plateformes.\n|   |   |   ├── cocoa/ - Code Source spécifique à Cocoa.\n|   |   |   ├── win/ - Code source spécifique pour le GUI Windows.\n|   |   |   └── x/ - Code Source spécifique à X11.\n|   |   ├── api/ - L'implementation des principales API de processus.\n|   |   ├── net/ - Code lié au réseau.\n|   |   ├── mac/ - Code Source Objective-C spécifique à MacOS.\n|   |   └── resources/ - Icons, platform-dependent files, etc.\n|   ├── renderer/ - Code that runs in renderer process.\n|   |   └── api/ - L'implementation des API de processus de rendu.\n| &#x3C;unk> ─ common/ - Code qui est utilisé à la fois par les processus principaux et les processus de rendu,\n| | y compris quelques fonctions utilitaires et du code pour intégrer les nœuds\n| | boucle message dans la boucle de message de Chromium.\n| &#x3C;unk> ─ api/ - Implémentation d'API communes, et fondations de\n| Modules intégrés d'Electron.\n── spec/ - Les composants de la suite de tests d'Electron exécutés dans le processus de rendu.\n── spec-main/ - Les composants de la suite de tests d'Electron s'exécutent dans le processus principal.\n&#x3C;unk> ─ BUILD.gn - Règles de construction d'Electron.\n</code></pre>\n<h2 id=\"structure-dautres-dossiers\"><a href=\"#structure-dautres-dossiers\">Structure d'autres Dossiers</a></h2>\n<ul>\n<li><strong>.circleci</strong> - Fichier de configuration pour CI avec CircleCI.</li>\n<li><strong>.github</strong> - Les fichiers de configuration spécifiques à GitHub, y compris les modèles de problèmes et CODEOWNERS.</li>\n<li><strong>dist</strong> - Dossier temporaire créé par <code>script/create-dist.py</code> lors de la création d'une distribution.</li>\n<li><strong>node_modules</strong> - Modules de Node tiers utilisés pour les builds.</li>\n<li><strong>npm</strong> - Logique pour l'installation d'Electron via npm.</li>\n<li><strong>out</strong> - Dossier de sortie temporaire de <code>ninja</code>.</li>\n<li><strong>script</strong> - Scripts utilisés à des fins de développement comme le build, le packaging, les tests, etc.</li>\n</ul>\n<pre><code class=\"hljs language-diff\">script/ - L'ensemble de tous les scripts que Electron exécute pour une variété de fonctions.\n── codesign/ - Codesign Fakes pour les applications Electron ; utilisé pour les tests.\n── lib/ - Divers scripts python.\n&#x3C;unk> ─ release/ - Scripts exécutés pendant le processus de publication d'Electron.\n    ── notes/ - Génère des notes de publication pour les nouvelles versions d'Electron.\n    &#x3C;unk> ─ ─ uploaders/ - Envoie divers fichiers liés à la version pendant la sortie.\n</code></pre>\n<ul>\n<li><strong>typings</strong> - Types TypeScript pour le code interne d'Electron.</li>\n</ul>",
      "title": "Structure du répertoire du Code Source",
      "description": ""
    },
    "/docs/tutorial/spellchecker": {
      "locale": "fr-FR",
      "slug": "spellchecker",
      "href": "/docs/tutorial/spellchecker",
      "crowdinFileId": "256251",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/spellchecker.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"spellchecker\"><a href=\"#spellchecker\">SpellChecker</a></h1>\n<p>Electron has built-in support for Chromium's spellchecker since Electron 8.  On Windows and Linux this is powered by Hunspell dictionaries, and on macOS it makes use of the native spellchecker APIs.</p>\n<h2 id=\"how-to-enable-the-spellchecker\"><a href=\"#how-to-enable-the-spellchecker\">How to enable the spellchecker?</a></h2>\n<p>For Electron 9 and higher the spellchecker is enabled by default.  For Electron 8 you need to enable it in <code>webPreferences</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> myWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">spellcheck</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h2 id=\"how-to-set-the-languages-the-spellchecker-uses\"><a href=\"#how-to-set-the-languages-the-spellchecker-uses\">How to set the languages the spellchecker uses?</a></h2>\n<p>On macOS as we use the native APIs there is no way to set the language that the spellchecker uses. By default on macOS the native spellchecker will automatically detect the language being used for you.</p>\n<p>For Windows and Linux there are a few Electron APIs you should use to set the languages for the spellchecker.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Sets the spellchecker to check English US and French</span>\nmyWindow.session.setSpellCheckerLanguages([<span class=\"hljs-string\">'en-US'</span>, <span class=\"hljs-string\">'fr'</span>])\n\n<span class=\"hljs-comment\">// An array of all available language codes</span>\n<span class=\"hljs-keyword\">const</span> possibleLanguages = myWindow.session.availableSpellCheckerLanguages\n</code></pre>\n<p>By default the spellchecker will enable the language matching the current OS locale.</p>\n<h2 id=\"how-do-i-put-the-results-of-the-spellchecker-in-my-context-menu\"><a href=\"#how-do-i-put-the-results-of-the-spellchecker-in-my-context-menu\">How do I put the results of the spellchecker in my context menu?</a></h2>\n<p>All the required information to generate a context menu is provided in the <a href=\"/docs/api/web-contents#event-context-menu\"><code>context-menu</code></a> event on each <code>webContents</code> instance.  A small example of how to make a context menu with this information is provided below.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { Menu, MenuItem } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nmyWindow.webContents.on(<span class=\"hljs-string\">'context-menu'</span>, (event, params) => {\n  <span class=\"hljs-keyword\">const</span> menu = <span class=\"hljs-keyword\">new</span> Menu()\n\n  <span class=\"hljs-comment\">// Add each spelling suggestion</span>\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> suggestion <span class=\"hljs-keyword\">of</span> params.dictionarySuggestions) {\n    menu.append(<span class=\"hljs-keyword\">new</span> MenuItem({\n      <span class=\"hljs-attr\">label</span>: suggestion,\n      <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> mainWindow.webContents.replaceMisspelling(suggestion)\n    }))\n  }\n\n  <span class=\"hljs-comment\">// Allow users to add the misspelled word to the dictionary</span>\n  <span class=\"hljs-keyword\">if</span> (params.misspelledWord) {\n    menu.append(\n      <span class=\"hljs-keyword\">new</span> MenuItem({\n        <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Add to dictionary'</span>,\n        <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> mainWindow.webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord)\n      })\n    )\n  }\n\n  menu.popup()\n})\n</code></pre>\n<h2 id=\"does-the-spellchecker-use-any-google-services\"><a href=\"#does-the-spellchecker-use-any-google-services\">Does the spellchecker use any Google services?</a></h2>\n<p>Although the spellchecker itself does not send any typings, words or user input to Google services the hunspell dictionary files are downloaded from a Google CDN by default.  If you want to avoid this you can provide an alternative URL to download the dictionaries from.</p>\n<pre><code class=\"hljs language-js\">myWindow.session.setSpellCheckerDictionaryDownloadURL(<span class=\"hljs-string\">'https://example.com/dictionaries/'</span>)\n</code></pre>\n<p>Consultez la documentation de <a href=\"/docs/api/session#sessetspellcheckerdictionarydownloadurlurl\"><code>session.setSpellCheckerDictionaryDownloadURL</code></a> pour plus d'informations sur l'endroit où obtenir les fichiers de dictionnaire et comment vous devez les héberger.</p>",
      "title": "SpellChecker",
      "description": ""
    },
    "/docs/styleguide": {
      "locale": "fr-FR",
      "slug": "styleguide",
      "href": "/docs/styleguide",
      "crowdinFileId": "256125",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/styleguide.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"règles-de-style-pour-la-documentation-delectron\"><a href=\"#règles-de-style-pour-la-documentation-delectron\">Règles de style pour la documentation d'Electron</a></h1>\n<p>Ce sont les lignes directrices pour la rédaction de la documentation d'Electron.</p>\n<h2 id=\"titres\"><a href=\"#titres\">Titres</a></h2>\n<ul>\n<li>Chaque page doit avoir un seul titre de niveau <code>#</code> au début de la page.</li>\n<li>Les chapitres d'une même page doivent avoir leur titre au niveau <code>##</code>.</li>\n<li>Les sous-chapitres doivent voir le nombre de <code>#</code> de leur titre qui augmentent selon leur niveau d'imbrication.</li>\n<li>Le titre de la page doit suivre <a href=\"https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case\">la casse de titre APA</a>.</li>\n<li>Tous les chapitres doivent suivre les <a href=\"https://apastyle.apa.org/style-grammar-guidelines/capitalization/sentence-case\">règles de phrase APA</a>.</li>\n</ul>\n<p>Utilisez <code>Démarrage Rapide</code> comme exemple :</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># Démarrage rapide</span>\n\n...\n\n<span class=\"hljs-section\">## Processus principal</span>\n\n...\n\n<span class=\"hljs-section\">## Processus de rendu</span>\n\n...\n\n<span class=\"hljs-section\">## Lancez votre application</span>\n\n...\n\n<span class=\"hljs-section\">### Exécuter en tant que distribution</span>\n\n...\n\n<span class=\"hljs-section\">### Téléchargement manuel du binaire Electron</span>\n\n...\n</code></pre>\n<p>Dans le cas de références de l'API, il existe des exceptions à cette règle.</p>\n<h2 id=\"règles-pour-le-markdown\"><a href=\"#règles-pour-le-markdown\">Règles pour le markdown</a></h2>\n<p>Ce dépôt utilise le paquet <a href=\"https://github.com/DavidAnson/markdownlint\"><code>markdownlint</code></a> pour imposer un style cohérent au Markdown. Pour les règles exactes, voir le fichier <code>.markdownlint.json</code> dans le dossier racine .</p>\n<p>Quelques règles de style non couvertes par les règles de linter :</p>\n<!--TODO(erickzhao): make sure this matches with the lint:markdownlint task-->\n<ul>\n<li>Utilisez <code>sh</code> au lieu de <code>cmd</code> dans les blocs de code (en raison de l'outil de coloration syntaxique).</li>\n<li>Les lignes doivent être si possible limitées entre 80 et 100 caractères pour des raisons de lisibilité .</li>\n<li>Les listes ne doivent pas dépasser 2 niveaux (à cause du formatage du markdown).</li>\n<li>Tous les blocs de code <code>js</code> et <code>javascript</code> sont vérifiés avec le <a href=\"https://www.npmjs.com/package/standard-markdown\">standard-markdown</a>.</li>\n<li>Pour les listes non ordonnées, utilisez des astérisques plutôt que des tirets.</li>\n</ul>\n<h2 id=\"choix-des-mots\"><a href=\"#choix-des-mots\">Choix des mots</a></h2>\n<ul>\n<li>Utilisez \"sera\" au lieu de \"devrait\" pour décrire des résultats.</li>\n<li>Préférez « dans le processus de ___ » au lieu de « sur ».</li>\n</ul>\n<h2 id=\"références-de-lapi\"><a href=\"#références-de-lapi\">Références de l'API</a></h2>\n<p>Les règles suivantes s'appliquent uniquement à la documentation des APIs.</p>\n<h3 id=\"titre-et-description\"><a href=\"#titre-et-description\">Titre et description</a></h3>\n<p>La doc API de chaque module doit utiliser le nom réel de l'objet retourné par <code>require('electron')</code> comme titre (tel que <code>BrowserWindow</code>, <code>autoUpdater</code> ou <code>session</code>).</p>\n<p>Directement sous le titre de la page, ajouter une ligne de description du module comme une citation markdown (commençant par <code>></code>).</p>\n<p>En prenant <code>session</code> comme exemple :</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># session</span>\n\n<span class=\"hljs-quote\">> Gère les sessions, les cookies, le cache, les paramètres de proxy, etc. du navigateur.</span>\n</code></pre>\n<h3 id=\"événements-et-méthodes-des-modules\"><a href=\"#événements-et-méthodes-des-modules\">Événements et méthodes des modules</a></h3>\n<p>Pour les modules qui ne sont pas des classes, leurs méthodes et événements doivent figurer sous les chapitres <code>## Methods</code> et <code>## Events</code>.</p>\n<p>En prenant <code>autoUpdater</code> comme exemple :</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># autoUpdater</span>\n\n<span class=\"hljs-section\">## Events</span>\n\n<span class=\"hljs-section\">### Event: 'error'</span>\n\n<span class=\"hljs-section\">## Methods</span>\n\n<span class=\"hljs-section\">### `autoUpdater.setFeedURL(url[, requestHeaders])`</span>\n</code></pre>\n<h3 id=\"classes\"><a href=\"#classes\">Classes</a></h3>\n<ul>\n<li>Les classes de l'API ou les classes faisant partie des modules doivent être listées sous un chapitre <code>## Class: TheClassName</code>.</li>\n<li>Une page peut avoir plusieurs classes.</li>\n<li>Les constructeurs doivent être listés avec un titre de niveau <code>###</code>.</li>\n<li>Les <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static\">Méthodes Statiques</a> doivent être listées sous un chapitre <code>### Méthodes Statiques</code>.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Prototype_methods\">Instance Methods</a> must be listed under an <code>### Instance Methods</code> chapter.</li>\n<li>All methods that have a return value must start their description with \"Returns <code>[TYPE]</code> - [Return description]\"<ul>\n<li>If the method returns an <code>Object</code>, its structure can be specified using a colon followed by a newline then an unordered list of properties in the same style as function parameters.</li>\n</ul></li>\n<li>Les événements d'instance doivent être listés sous un chapitre <code>### Instance Events</code>.</li>\n<li>Instance Properties must be listed under an <code>### Instance Properties</code> chapter.<ul>\n<li>Instance Properties must start with \"A [Property Type] ...\"</li>\n</ul></li>\n</ul>\n<p>En prenant les classes <code>Session</code> et <code>Cookies</code> comme exemple :</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># session</span>\n\n<span class=\"hljs-section\">## Méthodes</span>\n\n<span class=\"hljs-section\">### session.fromPartition(partition)</span>\n\n<span class=\"hljs-section\">## Propriétés Statiques</span>\n\n<span class=\"hljs-section\">### session.defaultSession</span>\n\n<span class=\"hljs-section\">## Classe : Session</span>\n\n<span class=\"hljs-section\">### Événements d'instance</span>\n\n<span class=\"hljs-section\">#### Événement : 'will-download'</span>\n\n<span class=\"hljs-section\">### Méthodes d'instance</span>\n\n<span class=\"hljs-section\">#### `ses.getCacheSize()`</span>\n\n<span class=\"hljs-section\">### Propriétés d'instance</span>\n\n<span class=\"hljs-section\">#### `ses.cookies`</span>\n\n<span class=\"hljs-section\">## Classe : Cookies</span>\n\n<span class=\"hljs-section\">### Méthodes d'instance</span>\n\n<span class=\"hljs-section\">#### `cookies.get(filter, callback)`</span>\n</code></pre>\n<h3 id=\"méthodes-et-leurs-arguments\"><a href=\"#méthodes-et-leurs-arguments\">Méthodes et leurs arguments</a></h3>\n<p>Le chapitre sur les méthodes doit respecter la forme suivante :</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### `objectName.methodName(required[, optional]))`</span>\n<span class=\"hljs-bullet\">\n* </span><span class=\"hljs-code\">`required`</span> String - A parameter description.\n<span class=\"hljs-bullet\">* </span><span class=\"hljs-code\">`optional`</span> Integer (optional) - Another parameter description.\n\n...\n</code></pre>\n<h4 id=\"heading-level\"><a href=\"#heading-level\">Heading level</a></h4>\n<p>The heading can be <code>###</code> or <code>####</code>-levels depending on whether the method belongs to a module or a class.</p>\n<h4 id=\"function-signature\"><a href=\"#function-signature\">Function signature</a></h4>\n<p>For modules, the <code>objectName</code> is the module's name. For classes, it must be the name of the instance of the class, and must not be the same as the module's name.</p>\n<p>Par exemple, les méthodes de la classe <code>Session</code> sous le module <code>session</code> doivent utiliser <code>ses</code> pour le <code>objectName</code>.</p>\n<p>Optional arguments are notated by square brackets <code>[]</code> surrounding the optional argument as well as the comma required if this optional argument follows another argument:</p>\n<pre><code class=\"hljs language-markdown\">required[, optional]\n</code></pre>\n<h4 id=\"descriptions-des-arguments\"><a href=\"#descriptions-des-arguments\">Descriptions des arguments</a></h4>\n<p>Des informations plus détaillées sur chacun des arguments sont notées dans une liste non ordonnée en dessous de la méthode. The type of argument is notated by either JavaScript primitives (e.g. <code>String</code>, <code>Promise</code>, or <code>Object</code>), a custom API structure like Electron's <a href=\"/docs/api/structures/cookie\"><code>Cookie</code></a>, or the wildcard <code>any</code>.</p>\n<p>If the argument is of type <code>Array</code>, use <code>[]</code> shorthand with the type of value inside the array (for example,<code>any[]</code> or <code>String[]</code>).</p>\n<p>If the argument is of type <code>Promise</code>, parametrize the type with what the promise resolves to (for example, <code>Promise&#x3C;void></code> or <code>Promise&#x3C;String></code>).</p>\n<p>Si un argument peut être de plusieurs types, séparez les types par <code>|</code>.</p>\n<p>La description des arguments de type <code>Function</code> devrait clairement expliquer comment il peut être appelé et lister les types des paramètres qui lui seront transmis.</p>\n<h4 id=\"platform-specific-functionality\"><a href=\"#platform-specific-functionality\">Platform-specific functionality</a></h4>\n<p>Si un argument ou une méthode est propre à certaines plateformes, ces plateformes sont listés en italique après le type de données. Les valeurs peuvent être <code>macOS</code>, <code>Windows</code> ou <code>Linux</code>.</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-bullet\">* </span><span class=\"hljs-code\">`animate`</span> Boolean (optional) <span class=\"hljs-emphasis\">_macOS_</span> <span class=\"hljs-emphasis\">_Windows_</span> - Animate the thing.\n</code></pre>\n<h3 id=\"événements\"><a href=\"#événements\">Événements</a></h3>\n<p>Le chapitre sur les événements doit être sous la forme suivante :</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### Event: 'wake-up'</span>\n\nReturns:\n<span class=\"hljs-bullet\">\n* </span><span class=\"hljs-code\">`time`</span> String\n\n...\n</code></pre>\n<p>L'en-tête peut être de niveau <code>###</code> ou <code>####</code> selon que l'événement appartient à un module ou à une classe.</p>\n<p>Les arguments d'un événement suivent les mêmes règles que les méthodes.</p>\n<h3 id=\"propriétés\"><a href=\"#propriétés\">Propriétés</a></h3>\n<p>Le chapitre des propriétés doit être sous la forme suivante :</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### session.defaultSession</span>\n\n...\n</code></pre>\n<p>L'en-tête peut être de niveau <code>###</code> ou <code>####</code> selon que la propriété appartient à un module ou à une classe.</p>\n<h2 id=\"traductions-de-la-documentation\"><a href=\"#traductions-de-la-documentation\">Traductions de la documentation</a></h2>\n<p>Voir <a href=\"https://github.com/electron/i18n#readme\">electron/i18n</a></p>",
      "title": "Règles de style pour la documentation d'Electron",
      "description": ""
    },
    "/docs/tutorial/support": {
      "locale": "fr-FR",
      "slug": "support",
      "href": "/docs/tutorial/support",
      "crowdinFileId": "256253",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/support.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"support-electron\"><a href=\"#support-electron\">Support Electron</a></h1>\n<h2 id=\"trouver-de-laide\"><a href=\"#trouver-de-laide\">Trouver de l'aide</a></h2>\n<p>Si vous avez un problème de sécurité, veuillez consulter le <a href=\"https://github.com/electron/electron/tree/main/SECURITY.md\">document sur la sécurité</a>.</p>\n<p>Si vous avez besoin d’aide pour la programmation, de réponses à vos questions, ou pour rejoindre une discussion avec d’autres développeurs qui utilisent Electron, vous pouvez interagir avec la Communauté à ces adresses :</p>\n<ul>\n<li>Sur les Canaux de <a href=\"https://discord.com/invite/electron\"><code>Electron's Discord</code></a>:<ul>\n<li>Pour obtenir de l'aide</li>\n<li>A propos d'applications de l'écosystème comme <a href=\"https://github.com/electron-userland/electron-forge\">Electron Forge</a> ou <a href=\"https://github.com/electron/fiddle\">Electron Fiddle</a></li>\n<li>Pour partager vos avec d’autres développeurs d’applications Electron</li>\n<li>Et bien plus!</li>\n</ul></li>\n<li>Catégories des forums Atom concernant <a href=\"https://discuss.atom.io/c/electron\"><code>electron</code></a></li>\n<li>``Electron<a href=\"https://discuss.atom.io/t/join-us-on-slack/16638?source_topic_id=25406\"></a> sur le canal Slack d'Atom</li>\n<li><a href=\"https://telegram.me/electron_ru\"><code>electron-ru</code></a> <em>(Russe)</em></li>\n<li><a href=\"https://electron-br.slack.com\"><code>electron-br</code></a> <em>(Brézilien Portugais)</em></li>\n<li><a href=\"https://electron-kr.github.io/electron-kr\"><code>electron-kr</code></a> <em>(Coréen)</em></li>\n<li><a href=\"https://electron-jp.slack.com\"><code>electron-jp</code></a> <em>(Japonais)</em></li>\n<li><a href=\"https://electron-tr.herokuapp.com\"><code>electron-tr</code></a> <em>(Turque)</em></li>\n<li><a href=\"https://electron-id.slack.com\"><code>electron-id</code></a> <em>(Indonésien)</em></li>\n<li><a href=\"https://electronpl.github.io\"><code>electron-pl</code></a> <em>(Polonais)</em></li>\n</ul>\n<p>Si vous souhaitez contribuer sur Electron, lisez le <a href=\"https://github.com/electron/electron/blob/main/CONTRIBUTING.md\">document de contribution</a>.</p>\n<p>Si vous découvrez une erreur dans une <a href=\"#supported-versions\">version supportée</a> d'Electron, veuillez s’il vous plaît la signaler dans notre <a href=\"/docs/development/issues\">suivi d'erreurs</a>.</p>\n<p><a href=\"https://github.com/sindresorhus/awesome-electron\">awesome-electron</a> regroupe une liste d'exemples d'applications, d'outils et de ressources très utiles, maintenue par la Communauté.</p>\n<h2 id=\"versions-supportées\"><a href=\"#versions-supportées\">Versions supportées</a></h2>\n<p><em><strong>Note:</strong> Beginning in September 2021 with Electron 15, the Electron team will temporarily support the latest <strong>four</strong> stable major versions. This extended support is intended to help Electron developers transition to the <a href=\"https://electronjs.org/blog/8-week-cadence\">new eight week release cadence</a>, and will continue until May 2022, with the release of Electron 19. At that time, the Electron team will drop support back to the latest three stable major versions.</em></p>\n<p>Les trois dernières versions majeures <em>stables</em> sont prises en charge par l'équipe Electron. For example, if the latest release is 6.1.x, then the 5.0.x as well as the 4.2.x series are supported.  We only support the latest minor release for each stable release series.  This means that in the case of a security fix 6.1.x will receive the fix, but we will not release a new version of 6.0.x.</p>\n<p>The latest stable release unilaterally receives all fixes from <code>main</code>, and the version prior to that receives the vast majority of those fixes as time and bandwidth warrants. The oldest supported release line will receive only security fixes directly.</p>\n<p>All supported release lines will accept external pull requests to backport fixes previously merged to <code>main</code>, though this may be on a case-by-case basis for some older supported lines. All contested decisions around release line backports will be resolved by the <a href=\"https://github.com/electron/governance/tree/main/wg-releases\">Releases Working Group</a> as an agenda item at their weekly meeting the week the backport PR is raised.</p>\n<p>When an API is changed or removed in a way that breaks existing functionality, the previous functionality will be supported for a minimum of two major versions when possible before being removed. For example, if a function takes three arguments, and that number is reduced to two in major version 10, the three-argument version would continue to work until, at minimum, major version 12. Past the minimum two-version threshold, we will attempt to support backwards compatibility beyond two versions until the maintainers feel the maintenance burden is too high to continue doing so.</p>\n<h3 id=\"currently-supported-versions\"><a href=\"#currently-supported-versions\">Currently supported versions</a></h3>\n<ul>\n<li>15.x.y</li>\n<li>14.x.y</li>\n<li>13.x.y</li>\n<li>12</li>\n</ul>\n<h3 id=\"end-of-life\"><a href=\"#end-of-life\">End-of-life</a></h3>\n<p>Quand une branche de version arrive au terme de son cycle de support, les révisions associées sont rendues obsolètes dans NPM et une toute dernière révision de fin de support est mise à disposition. Cette révision signalera alors que la version d'Electron utilisée n'est plus supportée.</p>\n<p>Ces étapes permettent aux développeurs d'applications d'être informés que la branche qu'ils utilisent ne sera bientôt plus supportée, sans toutefois trop importuner l'utilisateur final.</p>\n<p>Si, pour une raison exceptionnelle, une application nécessite de rester sur une version d'Electron qui n'est plus supportée, les développeurs peuvent désactiver l'avertissement de fin de support en omettant d'ajouter dans la collection <code>devDependencies</code> du fichier <code>package.json</code> la dernière révision de fin de support. Par exemple, comme la version 1.6 est clôturée par la révision de fin de support 1.6.18, les développeurs pourraient choisir de continuer à l'utiliser sans message d'avertissement en précisant, dans <code>devDependency</code>, <code>\"electron\": 1.6.0 - 1.6.17</code>.</p>\n<h2 id=\"plateformes-supportées\"><a href=\"#plateformes-supportées\">Plateformes supportées</a></h2>\n<p>Les plateformes suivantes sont prises en charge par Electron :</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>Seul les binaires 64bit sont fournit pour macOs, et la version minimale de macOs supportée est macOS 10.11 (El Capitan).</p>\n<p>Le support natif des appareils Apple Silicon (<code>arm64</code>) a été ajouté dans Electron 11.0.0.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<p>Windows 7 et versions ultérieures sont pris en charge, les systèmes d’exploitation plus anciens ne sont pas pris en charge (et ne fonctionnent pas).</p>\n<p>Les deux binaires <code>ia32</code> (<code>x86</code>) et <code>x64</code> (<code>amd64</code>) sont fournit pour Windows. <a href=\"/docs/tutorial/windows-arm\">Le support natif pour Windows sur les appareils Arm (<code>arm64</code>) a été ajouté dans Electron 6.0.8.</a>. Running apps packaged with previous versions is possible using the ia32 binary.</p>\n<h3 id=\"linux\"><a href=\"#linux\">Linux</a></h3>\n<p>Les binaires prédéfinis d'Electron sont construits sur Ubuntu 18.04.</p>\n<p>Le fait qu'un binaire pré-compilé peut ou non s'exécuter sur une distribution dépend si la distribution inclut ou non les librairies qu'Electron utilise pour compiler l'application. Du coup, seulement Ubuntu 18.04 est garanti de fonctionner, ainsi que les distributions suivantes pour faire fonctionner les binaires pré-compilés d'Electron :</p>\n<ul>\n<li>Ubuntu 14.04 et supérieur</li>\n<li>Fedora 24 et supérieur</li>\n<li>Debian 8 et supérieur</li>\n</ul>",
      "title": "Support Electron",
      "description": ""
    },
    "/docs/api/synopsis": {
      "locale": "fr-FR",
      "slug": "synopsis",
      "href": "/docs/api/synopsis",
      "crowdinFileId": "256371",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/synopsis.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"synopsis\"><a href=\"#synopsis\">Synopsis</a></h1>\n<blockquote>\n<p>Comment utiliser les APIs de Nodejs et d'Electron.</p>\n</blockquote>\n<p>Tous les <a href=\"https://nodejs.org/api/\">modules intégrés de Node.js</a> sont disponibles dans Electron, ainsi que les modules tiers pour node sont totalement supportés (incluant les <a href=\"/docs/tutorial/using-native-node-modules\">modules natifs</a>).</p>\n<p>Electron fournit également quelques modules supplémentaires intégrés pour le développement d'application de bureau natives. Some modules are only available in the main process, some are only available in the renderer process (web page), and some can be used in either process type.</p>\n<p>La règle de base est : si un module est une <a href=\"https://en.wikipedia.org/wiki/Graphical_user_interface\">GUI</a> ou un système de bas niveau est associé, il devrait être disponible dans le processus main. You need to be familiar with the concept of main process vs. renderer process scripts to be able to use those modules.</p>\n<p>Le script &#x3C;0>main process&#x3C;/0> ressemble à script Node.js normal :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>The renderer process is no different than a normal web page, except for the extra ability to use node modules if <code>nodeIntegration</code> is enabled:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  <span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n  <span class=\"hljs-built_in\">console</span>.log(fs.readFileSync(__filename, <span class=\"hljs-string\">'utf8'</span>))\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<h2 id=\"affectation-par-décomposition\"><a href=\"#affectation-par-décomposition\">Affectation par décomposition</a></h2>\n<p>À partir de la 0.37, vous pouvez utiliser l'<a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment\">affectation par décomposition</a> pour rendre l'utilisation des modules intégrés plus simple.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>Si vous avez besoin la totalité du module <code>electron</code>, vous pouvez faire un require et décomposer ensuite le tout pour accéder aux modules venant d'<code>electron</code> individuellement.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> electron = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = electron\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>Ce qui est équivalent au code suivant :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> electron = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> app = electron.app\n<span class=\"hljs-keyword\">const</span> BrowserWindow = electron.BrowserWindow\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>",
      "title": "Synopsis",
      "description": "Comment utiliser les APIs de Nodejs et d'Electron."
    },
    "/docs/api/system-preferences": {
      "locale": "fr-FR",
      "slug": "system-preferences",
      "href": "/docs/api/system-preferences",
      "crowdinFileId": "256373",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/system-preferences.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"systempreferences\"><a href=\"#systempreferences\">systemPreferences</a></h1>\n<blockquote>\n<p>Récuperer les préférences système.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(systemPreferences.isDarkMode())\n</code></pre>\n<h2 id=\"événements\"><a href=\"#événements\">Événements</a></h2>\n<p>L'objet <code>systemPreferences</code> émet les événements suivants :</p>\n<h3 id=\"événement--accent-color-changed-windows\"><a href=\"#événement--accent-color-changed-windows\">Événement : 'accent-color-changed' <em>Windows</em></a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newColor</code> String - La nouvelle couleur RGBA que l'utilisateur à assigné à son système.</li>\n</ul>\n<h3 id=\"événement--color-changed-windows\"><a href=\"#événement--color-changed-windows\">Événement : 'color-changed' <em>Windows</em></a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<h3 id=\"événement--inverted-color-scheme-changed-windows-deprecated\"><a href=\"#événement--inverted-color-scheme-changed-windows-deprecated\">Événement : 'inverted-color-scheme-changed' <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>invertedColorScheme</code> Boolean - <code>true</code> si un schéma de couleur inversé (un schéma de couleur à contraste élevé avec le texte clair et les fonds sombres) est utilisé, <code>faux</code> sinon.</li>\n</ul>\n<p><strong>Déprécié :</strong> Doit utiliser le nouvel événement <a href=\"/docs/api/native-theme#event-updated\"><code>mis à jour</code></a> sur le module <code>nativeTheme</code>.</p>\n<h3 id=\"événement--high-contrast-color-scheme-changed-windows-deprecated\"><a href=\"#événement--high-contrast-color-scheme-changed-windows-deprecated\">Événement : 'high-contrast-color-scheme-changed' <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>highContrastColorScheme</code> Boolean - <code>true</code> si un thème à contraste élevé est utilisé, <code>false</code> sinon.</li>\n</ul>\n<p><strong>Déprécié :</strong> Doit utiliser le nouvel événement <a href=\"/docs/api/native-theme#event-updated\"><code>mis à jour</code></a> sur le module <code>nativeTheme</code>.</p>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<h3 id=\"systempreferencesisdarkmode-macos-windows-déprécié\"><a href=\"#systempreferencesisdarkmode-macos-windows-déprécié\"><code>systemPreferences.isDarkMode()</code> <em>macOS</em> <em>Windows</em> <em>Déprécié</em></a></h3>\n<p>Retourne <code>Boolean</code> - Si le système est en mode sombre.</p>\n<p><strong>Déprécié :</strong> Doit utiliser le nouveau <a href=\"/docs/api/native-theme#nativethemeshouldusedarkcolors-readonly\"><code>nativeTheme.shouldUseDarkColors</code></a> API.</p>\n<h3 id=\"systempreferencesisswipetrackingfromscrolleventsenabled-macos\"><a href=\"#systempreferencesisswipetrackingfromscrolleventsenabled-macos\"><code>systemPreferences.isSwipeTrackingFromScrollEventsEnabled()</code> <em>macOS</em></a></h3>\n<p>Retourne <code>Boolean</code> - Si l'option Swipe entre les pages est activé.</p>\n<h3 id=\"systempreferencespostnotificationevent-userinfo-deliverimmediately-macos\"><a href=\"#systempreferencespostnotificationevent-userinfo-deliverimmediately-macos\"><code>systemPreferences.postNotification(event, userInfo[, deliverImmediately])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li>Enregistrement <code>userInfo</code>&#x3C;String, any></li>\n<li><code>deliverImmédiately</code> Booléen (facultatif) - <code>true</code> pour publier des notifications immédiatement même lorsque l'application d'abonnement est inactive.</li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencespostlocalnotificationevent-userinfo-macos\"><a href=\"#systempreferencespostlocalnotificationevent-userinfo-macos\"><code>systemPreferences.postLocalNotification(event, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li>Enregistrement <code>userInfo</code>&#x3C;String, any></li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencespostworkspacenotificationevent-userinfo-macos\"><a href=\"#systempreferencespostworkspacenotificationevent-userinfo-macos\"><code>systemPreferences.postWorkspaceNotification(event, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li>Enregistrement <code>userInfo</code>&#x3C;String, any></li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencessubscribenotificationevent-callback-macos\"><a href=\"#systempreferencessubscribenotificationevent-callback-macos\"><code>systemPreferences.subscribeNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li>Enregistrement <code>userInfo</code>&#x3C;String, unknown></li>\n<li>Chaîne <code>objet</code></li>\n</ul></li>\n</ul>\n<p>Retourne <code>Nombre</code> - L'ID de cet abonnement</p>\n<p>S'abonne aux notifications natives de macOS, <code>callback</code> sera appelé avec <code>callback(event, userInfo)</code> lorsque le <code>event</code> correspondant se produit. <code>userInfo</code> est un objet qui contient le dictionnaire d'information utilisateur envoyé avec la notification. L'objet <code>object</code> est l'expéditeur de la notification, et ne supporte que les valeurs <code>NSString</code> pour le moment.</p>\n<p>Le <code>id</code> de l'abonné est retourné, qui peut être utilisé pour désabonner le <code>événement</code>.</p>\n<p>Sous le capot, cette API s'abonne à <code>NSDistributedNotificationCenter</code>, Les valeurs d'exemple de <code>event</code> sont :</p>\n<ul>\n<li><code>AppleInterfaceThemeChangedNotification</code></li>\n<li><code>AppleAquaColorVariantChanged</code></li>\n<li><code>AppleColorPreferencesChangedNotification</code></li>\n<li><code>AppleShowScrollBarsSettingChanged</code></li>\n</ul>\n<h3 id=\"systempreferencessubscribelocalnotificationevent-callback-macos\"><a href=\"#systempreferencessubscribelocalnotificationevent-callback-macos\"><code>systemPreferences.subscribeLocalNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li>Enregistrement <code>userInfo</code>&#x3C;String, unknown></li>\n<li>Chaîne <code>objet</code></li>\n</ul></li>\n</ul>\n<p>Retourne <code>Nombre</code> - L'ID de cet abonnement</p>\n<p>Same as <code>subscribeNotification</code>, but uses <code>NSNotificationCenter</code> for local defaults. Ceci est nécessaire pour des événements tels que <code>NSUserDefaultsDidChangeNotification</code>.</p>\n<h3 id=\"systempreferencessubscribeworkspacenotificationevent-callback-macos\"><a href=\"#systempreferencessubscribeworkspacenotificationevent-callback-macos\"><code>systemPreferences.subscribeWorkspaceNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li>Enregistrement <code>userInfo</code>&#x3C;String, unknown></li>\n<li>Chaîne <code>objet</code></li>\n</ul></li>\n</ul>\n<p>Retourne <code>Nombre</code> - L'ID de cet abonnement</p>\n<p>Identique à <code>subscribeNotification</code>, mais utilise <code>NSWorkspace.sharedWorkspace.notificationCenter</code>. Ceci est nécessaire pour des événements tels que <code>NSWorkspaceDidActivateApplicationNotification</code>.</p>\n<h3 id=\"systempreferencesunsubscribenotificationid-macos\"><a href=\"#systempreferencesunsubscribenotificationid-macos\"><code>systemPreferences.unsubscribeNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Supprime l'abonnement avec <code>l'id</code>.</p>\n<h3 id=\"systempreferencesunsubscribelocalnotificationid-macos\"><a href=\"#systempreferencesunsubscribelocalnotificationid-macos\"><code>systemPreferences.unsubscribeLocalNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Identique à <code>unsubscribeNotification</code>, mais supprime l'abonné de <code>NSNotificationCenter</code>.</p>\n<h3 id=\"systempreferencesunsubscribeworkspacenotificationid-macos\"><a href=\"#systempreferencesunsubscribeworkspacenotificationid-macos\"><code>systemPreferences.unsubscribeWorkspaceNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Identique à <code>unsubscribeNotification</code>, mais supprime l'abonné de <code>NSWorkspace.sharedWorkspace.notificationCenter</code>.</p>\n<h3 id=\"systempreferencesregisterdefaultsdefaults-macos\"><a href=\"#systempreferencesregisterdefaultsdefaults-macos\"><code>systemPreferences.registerDefaults(defaults)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>Par défaut</code> Enregistrement&#x3C;String, String | Boolean | Number> - un dictionnaire de (<code>clé: valeur</code>) par défaut de l'utilisateur</li>\n</ul>\n<p>Ajoute les valeurs par défaut à <code>NSUserDefaults</code>de votre application.</p>\n<h3 id=\"systempreferencesgetuserdefaulttype-extends-keyof-userdefaulttypeskey-type-macos\"><a href=\"#systempreferencesgetuserdefaulttype-extends-keyof-userdefaulttypeskey-type-macos\"><code>systemPreferences.getUserDefault&#x3C;Type extends keyof UserDefaultTypes>(key, type)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n<li><code>type</code> Type - Can be <code>string</code>, <code>boolean</code>, <code>integer</code>, <code>float</code>, <code>double</code>, <code>url</code>, <code>array</code> or <code>dictionary</code>.</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/user-default-types\"><code>UserDefaultTypes[Type]</code></a> - The value of <code>key</code> in <code>NSUserDefaults</code>.</p>\n<p>Certaines <code>clé</code> populaires et <code>type</code>s sont:</p>\n<ul>\n<li><code>AppleInterfaceStyle</code>: <code>chaîne</code></li>\n<li><code>AppleAquaColorVariant</code>: <code>integer</code></li>\n<li><code>AppleHighlightColor</code>: <code>chaîne</code></li>\n<li><code>AppleShowScrollBars</code>: <code>string</code></li>\n<li><code>NSNavRecentPlaces</code>: <code>tableau</code></li>\n<li><code>NSPreferredWebServices</code>: <code>dictionnaire</code></li>\n<li><code>NSUserDictionaryReplacementItems</code>: <code>tableau</code></li>\n</ul>\n<h3 id=\"systempreferencessetuserdefaultkey-type-value-macos\"><a href=\"#systempreferencessetuserdefaultkey-type-value-macos\"><code>systemPreferences.setUserDefault(key, type, value)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n<li><code>type</code> String - Can be <code>string</code>, <code>boolean</code>, <code>integer</code>, <code>float</code>, <code>double</code>, <code>url</code>, <code>array</code> or <code>dictionary</code>.</li>\n<li><code>value</code> String</li>\n</ul>\n<p>Définit la valeur de <code>clé</code> dans <code>NSUserDefaults</code>.</p>\n<p>Note that <code>type</code> should match actual type of <code>value</code>. An exception is thrown if they don't.</p>\n<p>Certaines <code>clé</code> populaires et <code>type</code>s sont:</p>\n<ul>\n<li><code>ApplePressAndHoldEnabled</code> : <code>booléen</code></li>\n</ul>\n<h3 id=\"systempreferencesremoveuserdefaultkey-macos\"><a href=\"#systempreferencesremoveuserdefaultkey-macos\"><code>systemPreferences.removeUserDefault(key)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Removes the <code>key</code> in <code>NSUserDefaults</code>. This can be used to restore the default or global value of a <code>key</code> previously set with <code>setUserDefault</code>.</p>\n<h3 id=\"systempreferencesisaeroglassenabled-windows\"><a href=\"#systempreferencesisaeroglassenabled-windows\"><code>systemPreferences.isAeroGlassEnabled()</code> <em>Windows</em></a></h3>\n<p>Retourne <code>Boolean</code> - <code>true</code> si la <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/aa969540.aspx\">composition DWM </a> (Aero Glass) est activée, et <code>false</code> sinon.</p>\n<p>Un exemple d'utilisation pour déterminer si vous devez créer une fenêtre transparente ou non (les fenêtres transparentes ne fonctionneront pas correctement lorsque la composition DWM est désactivée) :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> browserOptions = { <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">1000</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">800</span> }\n\n<span class=\"hljs-comment\">// Make the window transparent only if the platform supports it.</span>\n<span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'win32'</span> || systemPreferences.isAeroGlassEnabled()) {\n  browserOptions.transparent = <span class=\"hljs-literal\">true</span>\n  browserOptions.frame = <span class=\"hljs-literal\">false</span>\n}\n\n<span class=\"hljs-comment\">// Create the window.</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow(browserOptions)\n\n<span class=\"hljs-comment\">// Navigate.</span>\n<span class=\"hljs-keyword\">if</span> (browserOptions.transparent) {\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/index.html`</span>)\n} <span class=\"hljs-keyword\">else</span> {\n  <span class=\"hljs-comment\">// Pas de transparence, donc nous chargeons un repli qui utilise des styles de base.</span>\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/fallback.html`</span>)\n}\n</code></pre>\n<h3 id=\"systempreferencesgetaccentcolor-windows-macos\"><a href=\"#systempreferencesgetaccentcolor-windows-macos\"><code>systemPreferences.getAccentColor()</code> <em>Windows</em> <em>macOS</em></a></h3>\n<p>Retourne <code>String</code> - Les utilisateurs du système actuel de préférence de couleur d'accentuation large en RGBA forme hexadécimale.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> color = systemPreferences.getAccentColor() <span class=\"hljs-comment\">// `\"aabbccdd\"`</span>\n<span class=\"hljs-keyword\">const</span> red = color.substr(<span class=\"hljs-number\">0</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"aa\"</span>\n<span class=\"hljs-keyword\">const</span> green = color.substr(<span class=\"hljs-number\">2</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"bb\"</span>\n<span class=\"hljs-keyword\">const</span> blue = color.substr(<span class=\"hljs-number\">4</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"cc\"</span>\n<span class=\"hljs-keyword\">const</span> alpha = color.substr(<span class=\"hljs-number\">6</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"dd\"</span>\n</code></pre>\n<p>Cette API n'est disponible que sur macOS 10.14 Mojave ou plus récent.</p>\n<h3 id=\"systempreferencesgetcolorcolor-windows-macos\"><a href=\"#systempreferencesgetcolorcolor-windows-macos\"><code>systemPreferences.getColor(color)</code> <em>Windows</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>color</code> String - One of the following values:<ul>\n<li>On <strong>Windows</strong>:<ul>\n<li><code>3d-dark-shadow</code> - Ombre noir pour les éléments affichés en trois dimensions.</li>\n<li><code>3d-face</code> - Couleur de la face pour les éléments affichés en trois dimensions et le fond des boîtes de dialogue.</li>\n<li><code>3d-hihlight</code> - Couleur de surlignage pour les éléments affichés en trois dimensions.</li>\n<li><code>3d-light</code> - Couleur de la lumière pour les éléments affichés en trois dimensions.</li>\n<li><code>3d-shadow</code> - Couleur d'ombre pour les éléments affichés en trois dimensions.</li>\n<li><code>active-border</code> - Bordure de la fenêtre active.</li>\n<li><code>active-caption</code> - Active window title bar. Specifies the left side color in the color gradient of an active window's title bar if the gradient effect is enabled.</li>\n<li><code>active-caption-gradient</code> - Couleur du côté droit du dégradé de couleur de la barre de titre de la fenêtre active.</li>\n<li><code>app-workspace</code> - Couleur de fond d'une interface d'application de document multiple (MDI).</li>\n<li><code>button-text</code> - Texte sur les boutons d'envoi.</li>\n<li><code>caption-text</code> - Texte dans une légende, boîte de dimensions, boîte avec la flèche pour la barre de défilement.</li>\n<li><code>desktop</code> - Couleur de fond du bureau.</li>\n<li><code>disabled-text</code> - Texte grisé (désactivé).</li>\n<li><code>highlight</code> - Élément(s) sélectionné(s) dans un groupe.</li>\n<li><code>highlight-text</code> - Texte des éléments sélectionnés dans un contrôle.</li>\n<li><code>hotlight</code> - Couleur pour un lien hypertexte ou un élément à suivre.</li>\n<li><code>inactive-border</code> - Bordure de fenêtre inactive.</li>\n<li><code>inactive-caption</code> - Inactive window caption. Specifies the left side color in the color gradient of an inactive window's title bar if the gradient effect is enabled.</li>\n<li><code>inactive-caption-gradient</code> - Couleur du côté droit dans le gradient de couleur d'une barre de titre de la fenêtre inactive.</li>\n<li><code>inactive-caption-text</code> - Color of text in an inactive caption.</li>\n<li><code>info-background</code> - Background color for tooltip controls.</li>\n<li><code>info-text</code> - Text color for tooltip controls.</li>\n<li><code>menu</code> - Menu background.</li>\n<li><code>menu-highlight</code> - The color used to highlight menu items when the menu appears as a flat menu.</li>\n<li><code>menubar</code> - La couleur de fond de la barre de menu lorsque les menus apparaissent sous la forme de menus plats.</li>\n<li><code>menu-text</code> - Texte dans les menus.</li>\n<li><code>scrollbar</code> - Zone grise de la barre de défilement.</li>\n<li><code>window</code> - Fond de la fenêtre.</li>\n<li><code>window-frame</code> - Cadre de fenêtres.</li>\n<li><code>window-text</code> - Texte dans windows.</li>\n</ul></li>\n<li>On <strong>macOS</strong><ul>\n<li><code>alternate-selected-control-text</code> - Le texte sur une surface sélectionnée dans une liste ou un tableau. <em>déprécié</em></li>\n<li><code>control-background</code> - L'arrière-plan d'un élément de grande interface, tel qu'un navigateur ou un tableau.</li>\n<li><code>control</code> - La surface d'un contrôle.</li>\n<li><code>control-text</code> -Le texte d'un contrôle qui n'est pas désactivé.</li>\n<li><code>disabled-control-text</code> - Le texte d'un contrôle qui est désactivé.</li>\n<li><code>find-highlight</code> - La couleur d'un indicateur de recherche.</li>\n<li><code>grille</code> - Les lignes de grilles d'un élément d'interface comme une table.</li>\n<li><code>header-text</code> - Le texte d'une cellule d'en-tête dans un tableau.</li>\n<li><code>surlignement</code> - La source de lumière virtuelle à l'écran.</li>\n<li><code>keyboard-focus-indicator</code> - L'anneau qui apparaît autour du contrôle actuellement focalisé lors de l'utilisation du clavier pour la navigation de l'interface.</li>\n<li><code>label</code> - Le texte d'une étiquette contenant le contenu principal.</li>\n<li><code>lien</code> - Un lien vers un autre contenu.</li>\n<li><code>placeholder-text</code> - Une chaîne de caractères dans une vue de contrôle ou de texte.</li>\n<li><code>quaternary-label</code> - Le texte d'une étiquette de moindre importance qu'une étiquette tertiaire telle que le texte du filigrane.</li>\n<li><code>scrubber-textured-background</code> - L'arrière-plan d'un scrubber dans la barre tactile.</li>\n<li><code>étiquette secondaire</code> - Le texte d'une étiquette de moindre importance qu'une étiquette normale telle qu'une étiquette utilisée pour représenter une sous-rubrique ou des informations complémentaires.</li>\n<li><code>selected-content-background</code> - L'arrière-plan du contenu sélectionné dans une fenêtre ou une vue clé.</li>\n<li><code>selected-control</code> - La surface d'une commande sélectionnée.</li>\n<li><code>selected-control-text</code> - Le texte d'une commande sélectionnée.</li>\n<li><code>selected-menu-item-text</code> - Le texte d'un menu sélectionné.</li>\n<li><code>selected-text-background</code> - L'arrière-plan du texte sélectionné.</li>\n<li><code>texte sélectionné</code> - Texte sélectionné.</li>\n<li><code>Séparateur</code> - Un séparateur entre différentes sections de contenu.</li>\n<li><code>shadow</code> - L'ombre virtuelle projetée par un objet levé à l'écran.</li>\n<li><code>étiquette-tertiaire</code> - Le texte d'une étiquette de moindre importance qu'une étiquette secondaire telle qu'une étiquette utilisée pour représenter le texte désactivé.</li>\n<li><code>text-background</code> - Fond d'écran du texte.</li>\n<li><code>text</code> - Le texte dans un document.</li>\n<li><code>sous-page-background</code> - L'arrière-plan derrière le contenu d'un document.</li>\n<li><code>unemphaszed-selected-content-background</code> - Le contenu sélectionné dans une fenêtre ou une vue non-clé.</li>\n<li><code>unemphaszed-selected-text-background</code> - Un fond pour le texte sélectionné dans une fenêtre ou une vue non-clé.</li>\n<li><code>unemphaszed-selected-text</code> - Texte sélectionné dans une fenêtre ou une vue non-clé.</li>\n<li><code>window-background</code> - L'arrière-plan d'une fenêtre.</li>\n<li><code>window-frame-text</code> - Le texte dans la barre de titre de la fenêtre.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Retourne <code>String</code> - Le paramètre de couleur système sous forme hexadécimale RVB (<code>#ABCDEF</code>). See the <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx\">Windows docs</a> and the <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#dynamic-system-colors\">macOS docs</a> for more details.</p>\n<p>The following colors are only available on macOS 10.14: <code>find-highlight</code>, <code>selected-content-background</code>, <code>separator</code>, <code>unemphasized-selected-content-background</code>, <code>unemphasized-selected-text-background</code>, and <code>unemphasized-selected-text</code>.</p>\n<h3 id=\"systempreferencesgetsystemcolorcolor-macos\"><a href=\"#systempreferencesgetsystemcolorcolor-macos\"><code>systemPreferences.getSystemColor(color)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>color</code> String - One of the following values:<ul>\n<li><code>bleu</code></li>\n<li><code>marron</code></li>\n<li><code>gris</code></li>\n<li><code>vert</code></li>\n<li><code>orange</code></li>\n<li><code>rose</code></li>\n<li><code>violet</code></li>\n<li><code>rouge</code></li>\n<li><code>jaune</code></li>\n</ul></li>\n</ul>\n<p>Returns <code>String</code> - The standard system color formatted as <code>#RRGGBBAA</code>.</p>\n<p>Returns one of several standard system colors that automatically adapt to vibrancy and changes in accessibility settings like 'Increase contrast' and 'Reduce transparency'. See <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#system-colors\">Apple Documentation</a> for  more details.</p>\n<h3 id=\"systempreferencesisinvertedcolorscheme-windows-déprécié\"><a href=\"#systempreferencesisinvertedcolorscheme-windows-déprécié\"><code>systemPreferences.isInvertedColorScheme()</code> <em>Windows</em> <em>Déprécié</em></a></h3>\n<p>Returns <code>Boolean</code> - <code>true</code> if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is active, <code>false</code> otherwise.</p>\n<p><strong>Déprécié :</strong> Doit utiliser le nouveau <a href=\"/docs/api/native-theme#nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly\"><code>nativeTheme.shouldUseInvertedColorScheme</code></a> API.</p>\n<h3 id=\"systempreferencesishighcontrastcolorscheme-macos-windows-déprécié\"><a href=\"#systempreferencesishighcontrastcolorscheme-macos-windows-déprécié\"><code>systemPreferences.isHighContrastColorScheme()</code> <em>macOS</em> <em>Windows</em> <em>Déprécié</em></a></h3>\n<p>Returns <code>Boolean</code> - <code>true</code> if a high contrast theme is active, <code>false</code> otherwise.</p>\n<p><strong>Déprécié :</strong> Doit utiliser le nouveau <a href=\"/docs/api/native-theme#nativethemeshouldusehighcontrastcolors-macos-windows-readonly\"><code>nativeTheme.shouldUseHighContrastColors</code></a> API.</p>\n<h3 id=\"systempreferencesgeteffectiveappearance-macos\"><a href=\"#systempreferencesgeteffectiveappearance-macos\"><code>systemPreferences.getEffectiveAppearance()</code> <em>macOS</em></a></h3>\n<p>Returns <code>String</code> - Can be <code>dark</code>, <code>light</code> or <code>unknown</code>.</p>\n<p>Gets the macOS appearance setting that is currently applied to your application, maps to <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc\">NSApplication.effectiveAppearance</a></p>\n<h3 id=\"systempreferencesgetapplevelappearance-macos-déprécié\"><a href=\"#systempreferencesgetapplevelappearance-macos-déprécié\"><code>systemPreferences.getAppLevelAppearance()</code> <em>macOS</em> <em>Déprécié</em></a></h3>\n<p>Returns <code>String</code> | <code>null</code> - Can be <code>dark</code>, <code>light</code> or <code>unknown</code>.</p>\n<p>Gets the macOS appearance setting that you have declared you want for your application, maps to <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc\">NSApplication.appearance</a>. You can use the <code>setAppLevelAppearance</code> API to set this value.</p>\n<h3 id=\"systempreferencessetapplevelappearanceappearance-macos-déprécié\"><a href=\"#systempreferencessetapplevelappearanceappearance-macos-déprécié\"><code>systemPreferences.setAppLevelAppearance(appearance)</code> <em>macOS</em> <em>Déprécié</em></a></h3>\n<ul>\n<li><code>appearance</code> String | null - Can be <code>dark</code> or <code>light</code></li>\n</ul>\n<p>Sets the appearance setting for your application, this should override the system default and override the value of <code>getEffectiveAppearance</code>.</p>\n<h3 id=\"systempreferencescanprompttouchid-macos\"><a href=\"#systempreferencescanprompttouchid-macos\"><code>systemPreferences.canPromptTouchID()</code> <em>macOS</em></a></h3>\n<p>Returns <code>Boolean</code> - whether or not this device has the ability to use Touch ID.</p>\n<p><strong>NOTE:</strong> This API will return <code>false</code> on macOS systems older than Sierra 10.12.2.</p>\n<h3 id=\"systempreferencesprompttouchidreason-macos\"><a href=\"#systempreferencesprompttouchidreason-macos\"><code>systemPreferences.promptTouchID(reason)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>reason</code> String - The reason you are asking for Touch ID authentication</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves if the user has successfully authenticated with Touch ID.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsystemPreferences.promptTouchID(<span class=\"hljs-string\">'To get consent for a Security-Gated Thing'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">success</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'You have successfully authenticated with Touch ID!'</span>)\n}).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(err)\n})\n</code></pre>\n<p>This API itself will not protect your user data; rather, it is a mechanism to allow you to do so. Native apps will need to set <a href=\"https://developer.apple.com/documentation/security/secaccesscontrolcreateflags?language=objc\">Access Control Constants</a> like <a href=\"https://developer.apple.com/documentation/security/secaccesscontrolcreateflags/ksecaccesscontroluserpresence?language=objc\"><code>kSecAccessControlUserPresence</code></a> on their keychain entry so that reading it would auto-prompt for Touch ID biometric consent. This could be done with <a href=\"https://github.com/atom/node-keytar\"><code>node-keytar</code></a>, such that one would store an encryption key with <code>node-keytar</code> and only fetch it if <code>promptTouchID()</code> resolves.</p>\n<p><strong>NOTE:</strong> This API will return a rejected Promise on macOS systems older than Sierra 10.12.2.</p>\n<h3 id=\"systempreferencesistrustedaccessibilityclientprompt-macos\"><a href=\"#systempreferencesistrustedaccessibilityclientprompt-macos\"><code>systemPreferences.isTrustedAccessibilityClient(prompt)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>prompt</code> Boolean - whether or not the user will be informed via prompt if the current process is untrusted.</li>\n</ul>\n<p>Returns <code>Boolean</code> - <code>true</code> if the current process is a trusted accessibility client and <code>false</code> if it is not.</p>\n<h3 id=\"systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><a href=\"#systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><code>systemPreferences.getMediaAccessStatus(mediaType)</code> <em>Windows</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>mediaType</code> String -Peut être <code>microphone</code>, <code>camera</code> ou <code>screen</code>.</li>\n</ul>\n<p>Returns <code>String</code> - Can be <code>not-determined</code>, <code>granted</code>, <code>denied</code>, <code>restricted</code> or <code>unknown</code>.</p>\n<p>This user consent was not required on macOS 10.13 High Sierra or lower so this method will always return <code>granted</code>. macOS 10.14 Mojave or higher requires consent for <code>microphone</code> and <code>camera</code> access. macOS 10.15 Catalina or higher requires consent for <code>screen</code> access.</p>\n<p>Windows 10 has a global setting controlling <code>microphone</code> and <code>camera</code> access for all win32 applications. It will always return <code>granted</code> for <code>screen</code> and for all media types on older versions of Windows.</p>\n<h3 id=\"systempreferencesaskformediaaccessmediatype-macos\"><a href=\"#systempreferencesaskformediaaccessmediatype-macos\"><code>systemPreferences.askForMediaAccess(mediaType)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>mediaType</code> String - the type of media being requested; can be <code>microphone</code>, <code>camera</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Boolean></code> - A promise that resolves with <code>true</code> if consent was granted and <code>false</code> if it was denied. If an invalid <code>mediaType</code> is passed, the promise will be rejected. If an access request was denied and later is changed through the System Preferences pane, a restart of the app will be required for the new permissions to take effect. If access has already been requested and denied, it <em>must</em> be changed through the preference pane; an alert will not pop up and the promise will resolve with the existing access status.</p>\n<p><strong>Important:</strong> In order to properly leverage this API, you <a href=\"https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos?language=objc\">must set</a> the <code>NSMicrophoneUsageDescription</code> and <code>NSCameraUsageDescription</code> strings in your app's <code>Info.plist</code> file. Les valeurs de ces clés seront utilisées pour remplir les boîtes de dialogue des permissions afin que l'utilisateur soit correctement informé du but de la demande de permission. Voir <a href=\"/docs/tutorial/application-distribution#macos\">Electron Application Distribution</a> pour plus d'informations sur la façon de les définir dans le contexte d'Electron.</p>\n<p>Ce consentement de l'utilisateur n'était pas requis avant macOS 10. 4 Mojave, donc cette méthode retournera toujours <code>true</code> si votre système fonctionne 10.13 Haute Sierra ou moins.</p>\n<h3 id=\"systempreferencesgetanimationsettings\"><a href=\"#systempreferencesgetanimationsettings\"><code>systemPreferences.getAnimationSettings()</code></a></h3>\n<p>Retourne <code>Object</code>:</p>\n<ul>\n<li><code>shouldRenderRichAnimation</code> Boolean - Renvoie vrai si les animations riches doivent être rendues. Regarde le type de session (par exemple, bureau distant) et les paramètres d'accessibilité pour donner des conseils pour les animations lourdes.</li>\n<li><code>scrollAnimationsEnabledBySystem</code> Boolean - Détermine par plate-forme si les animations de défilement (par exemple produites par la touche maison/fin) doivent être activées.</li>\n<li><code>prefersReducedMotion</code> Booléen - Détermine si l'utilisateur souhaite des mouvements réduits basés sur des API de plate-forme.</li>\n</ul>\n<p>Retourne un objet avec les paramètres d'animation du système.</p>\n<h2 id=\"propriétés\"><a href=\"#propriétés\">Propriétés</a></h2>\n<h3 id=\"systempreferencesapplevelapparence-macos\"><a href=\"#systempreferencesapplevelapparence-macos\"><code>systemPreferences.appLevelApparence</code> <em>macOS</em></a></h3>\n<p>Une propriété <code>String</code> qui peut être <code>dark</code>, <code>light</code> ou <code>unknown</code>. Il détermine le paramètre d'apparence macOS pour votre application. Cette correspondance aux valeurs dans: <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc\">NSApplication.appearance</a>. Définir ceci remplacera la valeur par défaut du système ainsi que la valeur de <code>getEffectiveAppearance</code>.</p>\n<p>Les valeurs possibles qui peuvent être définies sont <code>dark</code> et <code>light</code>, et les valeurs de retour possibles sont <code>dark</code>, <code>light</code>, et <code>unknown</code>.</p>\n<p>Cette propriété n'est disponible que sur macOS 10.14 Mojave ou plus récent.</p>\n<h3 id=\"systempreferenceseffectiveappearance-macos-readonly\"><a href=\"#systempreferenceseffectiveappearance-macos-readonly\"><code>systemPreferences.effectiveAppearance</code> <em>macOS</em> <em>Readonly</em></a></h3>\n<p>Une propriété <code>String</code> qui peut être <code>dark</code>, <code>light</code> ou <code>unknown</code>.</p>\n<p>Retourne le paramètre d'apparence macOS qui est actuellement appliqué à votre application, correspond à <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc\">NSApplication.effectiveAppearance</a></p>",
      "title": "systemPreferences",
      "description": "Récuperer les préférences système."
    },
    "/docs/api/structures/task": {
      "locale": "fr-FR",
      "slug": "task",
      "href": "/docs/api/structures/task",
      "crowdinFileId": "256513",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/task.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"task-object\"><a href=\"#task-object\">Task Object</a></h1>\n<ul>\n<li><code>program</code> String - Path of the program to execute, usually you should specify <code>process.execPath</code> which opens the current program.</li>\n<li><code>arguments</code> String - The command line arguments when <code>program</code> is executed.</li>\n<li><code>title</code> String - The string to be displayed in a JumpList.</li>\n<li><code>description</code> String - Description of this task.</li>\n<li><code>iconPath</code> String - The absolute path to an icon to be displayed in a JumpList, which can be an arbitrary resource file that contains an icon. You can usually specify <code>process.execPath</code> to show the icon of the program.</li>\n<li><code>iconIndex</code> Number - The icon index in the icon file. If an icon file consists of two or more icons, set this value to identify the icon. If an icon file consists of one icon, this value is 0.</li>\n<li><code>workingDirectory</code> String (optional) - The working directory. Default is empty.</li>\n</ul>",
      "title": "Task Object",
      "description": ""
    },
    "/docs/development/testing": {
      "locale": "fr-FR",
      "slug": "testing",
      "href": "/docs/development/testing",
      "crowdinFileId": "256169",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/testing.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"test\"><a href=\"#test\">Test</a></h1>\n<p>Notre essayons de garder une couverture de code élevée pour Electron. Nous demandons à ce que toutes les demandes de \"pull\" passent tout les tests existants, mais ajoutent aussi des tests couvrant les changements de codes et les nouveaux scénarios. Cela nous assure ainsi que nous intégrons le plus de code possible tout en étant sûr que Electron soit livré avec le moins de bugs possible.</p>\n<p>Ce dépôt utilise des règles de qualité de code pour JavaScript et C++ ainsi que des tests unitaires et d'intégrations. Pour en apprendre plus sur le style de code d'Electron, référez-vous au document <a href=\"/docs/development/coding-style\">style de code</a>.</p>\n<h2 id=\"linting\"><a href=\"#linting\">Linting</a></h2>\n<p>To ensure that your JavaScript is in compliance with the Electron coding style, run <code>npm run lint-js</code>, which will run <code>standard</code> against both Electron itself as well as the unit tests. If you are using an editor with a plugin/addon system, you might want to use one of the many <a href=\"https://standardjs.com/#are-there-text-editor-plugins\">StandardJS addons</a> to be informed of coding style violations before you ever commit them.</p>\n<p>To run <code>standard</code> with parameters, run <code>npm run lint-js --</code> followed by arguments you want passed to <code>standard</code>.</p>\n<p>To ensure that your C++ is in compliance with the Electron coding style, run <code>npm run lint-cpp</code>, which runs a <code>cpplint</code> script. We recommend that you use <code>clang-format</code> and prepared <a href=\"/docs/development/clang-format\">a short tutorial</a>.</p>\n<p>There is not a lot of Python in this repository, but it too is governed by coding style rules. <code>npm run lint-py</code> will check all Python, using <code>pylint</code> to do so.</p>\n<h2 id=\"tests-unitaires\"><a href=\"#tests-unitaires\">Tests unitaires</a></h2>\n<p>If you are not using <a href=\"https://github.com/electron/build-tools\">build-tools</a>, ensure that that name you have configured for your local build of Electron is one of <code>Testing</code>, <code>Release</code>, <code>Default</code>, <code>Debug</code>, or you have set <code>process.env.ELECTRON_OUT_DIR</code>. Without these set, Electron will fail to perform some pre-testing steps.</p>\n<p>To run all unit tests, run <code>npm run test</code>. The unit tests are an Electron app (surprise!) that can be found in the <code>spec</code> folder. Note that it has its own <code>package.json</code> and that its dependencies are therefore not defined in the top-level <code>package.json</code>.</p>\n<p>To run only specific tests matching a pattern, run <code>npm run test -- -g=PATTERN</code>, replacing the <code>PATTERN</code> with a regex that matches the tests you would like to run. As an example: If you want to run only IPC tests, you would run <code>npm run test -- -g ipc</code>.</p>\n<h3 id=\"testing-on-windows-10-devices\"><a href=\"#testing-on-windows-10-devices\">Testing on Windows 10 devices</a></h3>\n<h4 id=\"extra-steps-to-run-the-unit-test\"><a href=\"#extra-steps-to-run-the-unit-test\">Extra steps to run the unit test:</a></h4>\n<ol>\n<li>\n<p>Visual Studio 2019 must be installed.</p>\n</li>\n<li>\n<p>Node headers have to be compiled for your configuration.</p>\n<pre><code class=\"hljs language-powershell\">ninja -C out\\Testing third_party\\electron_node:headers\n</code></pre>\n</li>\n<li>\n<p>The electron.lib has to be copied as node.lib.</p>\n<pre><code class=\"hljs language-powershell\">cd out\\Testing\nmkdir gen\\node_headers\\Release\ncopy electron.lib gen\\node_headers\\Release\\node.lib\n</code></pre>\n</li>\n</ol>\n<h4 id=\"missing-fonts\"><a href=\"#missing-fonts\">Missing fonts</a></h4>\n<p><a href=\"https://docs.microsoft.com/en-us/typography/fonts/windows_10_font_list\">Some Windows 10 devices</a> do not ship with the Meiryo font installed, which may cause a font fallback test to fail. To install Meiryo:</p>\n<ol>\n<li>Push the Windows key and search for <em>Manage optional features</em>.</li>\n<li>Click <em>Add a feature</em>.</li>\n<li>Select <em>Japanese Supplemental Fonts</em> and click <em>Install</em>.</li>\n</ol>\n<h4 id=\"pixel-measurements\"><a href=\"#pixel-measurements\">Pixel measurements</a></h4>\n<p>Some tests which rely on precise pixel measurements may not work correctly on devices with Hi-DPI screen settings due to floating point precision errors. To run these tests correctly, make sure the device is set to 100% scaling.</p>\n<p>To configure display scaling:</p>\n<ol>\n<li>Push the Windows key and search for <em>Display settings</em>.</li>\n<li>Under <em>Scale and layout</em>, make sure that the device is set to 100%.</li>\n</ol>",
      "title": "Test",
      "description": ""
    },
    "/docs/tutorial/testing-on-headless-ci": {
      "locale": "fr-FR",
      "slug": "testing-on-headless-ci",
      "href": "/docs/tutorial/testing-on-headless-ci",
      "crowdinFileId": "256255",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/testing-on-headless-ci.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"tests-sur-les-systèmes-ci-headless-travis-ci-jenkins\"><a href=\"#tests-sur-les-systèmes-ci-headless-travis-ci-jenkins\">Tests sur les systèmes CI Headless (Travis CI, Jenkins)</a></h1>\n<p>Étant basé sur Chromium, Electron requiert un pilote d’affichage de la fonction. Si Chromium ne peut pas trouver un pilote d’affichage, Electron échouera tout simplement au lancement - et par conséquent, n'exécutera aucun de vos tests, peu importe comment vous les exécutez. Tester les applications Electron sur Travis, Circle, Jenkins ou systèmes similaires exige donc un peu de configuration. En substance, nous devons utiliser un pilote d’affichage virtuel.</p>\n<h2 id=\"configuration-du-serveur-daffichage-virtuel\"><a href=\"#configuration-du-serveur-daffichage-virtuel\">Configuration du serveur d’affichage virtuel</a></h2>\n<p>Tout d’abord, installez <a href=\"https://en.wikipedia.org/wiki/Xvfb\">Xvfb</a>. C’est un framebuffer virtuel, mettant en oeuvre le protocole du serveur d'affichage X11 - il effectue toutes les opérations graphiques en mémoire sans montrer n’importe quel sortie à l'écran, c'est exactement ce dont nous avons besoin.</p>\n<p>Ensuite, créez un écran virtuel Xvfb et exportez une variable d'environnement appelée DISPLAY qui pointe vers elle. Chromium dans Electron va automatiquement chercher pour <code>$DISPLAY</code>, donc aucune configuration supplémentaire de votre application n’est nécessaire. Cette étape peut être automatisée avec Anaïs Betts <a href=\"https://github.com/anaisbetts/xvfb-maybe\">xvfb-peut-être</a> : Préfixer vos commandes de test avec <code>xvfb-maybe</code> et le petit outil configurera automatiquement Xvfb, si requis par le système actuel. Sous Windows ou macOS, il ne se passera rien.</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-comment\">## Sous Windows ou macOS, electron-mocha est invoque</span>\n<span class=\"hljs-comment\">## Sous Linux, si on est dans un environement headless, cela reviendra </span>\n<span class=\"hljs-comment\">## à xvfb-run electron-mocha ./test/*.js </span>\nxvfb-maybe electron-mocha ./<span class=\"hljs-built_in\">test</span>/*.js\n</code></pre>\n<h3 id=\"travis-ci\"><a href=\"#travis-ci\">Travis CI</a></h3>\n<p>Sur Travis, votre <code>.travis.yml</code> devrait ressembler à peu près à ça :</p>\n<pre><code class=\"hljs language-yml\"><span class=\"hljs-attr\">addons:</span>\n  <span class=\"hljs-attr\">apt:</span>\n    <span class=\"hljs-attr\">packages:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">xvfb</span>\n\n<span class=\"hljs-attr\">install:</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">export</span> <span class=\"hljs-string\">DISPLAY=':99.0'</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">Xvfb</span> <span class=\"hljs-string\">:99</span> <span class=\"hljs-string\">-screen</span> <span class=\"hljs-number\">0</span> <span class=\"hljs-string\">1024x768x24</span> <span class=\"hljs-string\">></span> <span class=\"hljs-string\">/dev/null</span> <span class=\"hljs-number\">2</span><span class=\"hljs-string\">>&#x26;1</span> <span class=\"hljs-string\">&#x26;</span>\n</code></pre>\n<h3 id=\"jenkins\"><a href=\"#jenkins\">Jenkins</a></h3>\n<p>Pour Jenkins, un <a href=\"https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin\">plugin Xvfb est disponible</a>.</p>\n<h3 id=\"circle-ci\"><a href=\"#circle-ci\">Circle CI</a></h3>\n<p>Circle CI est génial et a Xvfb et <code>$DISPLAY</code> <a href=\"https://circleci.com/docs/environment#browsers\">déjà configuré, donc aucune nouvelle configuration n'est nécessaire</a>.</p>\n<h3 id=\"appveyor\"><a href=\"#appveyor\">AppVeyor</a></h3>\n<p>AppVeyor s'exécute sur Windows, supportant Selenium, Chromium, Electron et outils similaires - aucune configuration n’est requise.</p>",
      "title": "Tests sur les systèmes CI Headless (Travis CI, Jenkins)",
      "description": ""
    },
    "/docs/tutorial/testing-widevine-cdm": {
      "locale": "fr-FR",
      "slug": "testing-widevine-cdm",
      "href": "/docs/tutorial/testing-widevine-cdm",
      "crowdinFileId": "256257",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/testing-widevine-cdm.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"tester-le-cdm-widevine\"><a href=\"#tester-le-cdm-widevine\">Tester le CDM Widevine</a></h1>\n<p>Dans Electron, vous pouvez utiliser le plugin Widevine CDM livré avec le navigateur Chrome.</p>\n<p>Widevine Content Decryption Modules (CDMs) are how streaming services protect content using HTML5 video to web browsers without relying on an NPAPI plugin like Flash or Silverlight. Widevine support is an alternative solution for streaming services that currently rely on Silverlight for playback of DRM-protected video content. It will allow websites to show DRM-protected video content in Firefox without the use of NPAPI plugins. The Widevine CDM runs in an open-source CDM sandbox providing better user security than NPAPI plugins.</p>\n<h4 id=\"note-on-vmp\"><a href=\"#note-on-vmp\">Note on VMP</a></h4>\n<p>As of <a href=\"https://electronjs.org/releases#1.8.1\"><code>Electron v1.8.0 (Chrome v59)</code></a>, the below steps are may only be some of the necessary steps to enable Widevine; any app on or after that version intending to use the Widevine CDM may need to be signed using a license obtained from <a href=\"https://www.widevine.com/\">Widevine</a> itself.</p>\n<p>Per <a href=\"https://www.widevine.com/\">Widevine</a>:</p>\n<blockquote>\n<p>Chrome 59 (and later) includes support for Verified Media Path (VMP). VMP provides a method to verify the authenticity of a device platform. For browser deployments, this will provide an additional signal to determine if a browser-based implementation is reliable and secure.</p>\n<p>The proxy integration guide has been updated with information about VMP and how to issue licenses.</p>\n<p>Widevine recommends our browser-based integrations (vendors and browser-based applications) add support for VMP.</p>\n</blockquote>\n<p>Pour activer la lecture vidéo avec cette nouvelle restriction, <a href=\"https://castlabs.com/open-source/downstream/\">castLabs</a> a créé un <a href=\"https://github.com/castlabs/electron-releases\">fork</a> qui a implémenté les modifications nécessaires pour permettre la lecture de Widevine dans une application Electron si on a obtenu les licences nécessaires de widevine.</p>\n<h2 id=\"getting-the-library\"><a href=\"#getting-the-library\">Getting the library</a></h2>\n<p>Open <code>chrome://components/</code> in Chrome browser, find <code>Widevine Content Decryption Module</code> and make sure it is up to date, then you can find the library files from the application directory.</p>\n<h3 id=\"sur-windows\"><a href=\"#sur-windows\">Sur Windows </a></h3>\n<p>Le fichier de bibliothèque <code>widevinecdm.dll</code> sera sous <code>Program Files(x86)/Google/Chrome/Application/CHROME_VERSION/WidevineCdm/_platform_specific/win_(x86|x64)/</code> dossier</p>\n<h3 id=\"sur-macos\"><a href=\"#sur-macos\">Sur macOS </a></h3>\n<p>Le fichier de bibliothèque <code>libwidevinecdm.dylib</code> sera sous <code>/Applications/Google Chrome.app/Contents/Versions/CHROME_VERSION/Google Chrome Framework.framework/Versions/A/Libraries/WidevineCdm/_platform_specific/mac_(x86|x64)/</code> dossier</p>\n<p><strong>Remarque:</strong>Assurez-vous que la version chromée utilisée par Electron est supérieure ou égale à la valeur <code>min_chrome_version</code> du composant CDM Widevine de Chrome. The value can be found in <code>manifest.json</code> under <code>WidevineCdm</code> directory.</p>\n<h2 id=\"using-the-library\"><a href=\"#using-the-library\">Using the library</a></h2>\n<p>After getting the library files, you should pass the path to the file with <code>--widevine-cdm-path</code> command line switch, and the library's version with <code>--widevine-cdm-version</code> switch. The command line switches have to be passed before the <code>ready</code> event of <code>app</code> module gets emitted.</p>\n<p>Exemple de code :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// You have to pass the directory that contains widevine library here, it is</span>\n<span class=\"hljs-comment\">// * `libwidevinecdm.dylib` on macOS,</span>\n<span class=\"hljs-comment\">// * `widevinecdm.dll` on Windows.</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'widevine-cdm-path'</span>, <span class=\"hljs-string\">'/path/to/widevine_library'</span>)\n<span class=\"hljs-comment\">// The version of plugin can be got from `chrome://components` page in Chrome.</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'widevine-cdm-version'</span>, <span class=\"hljs-string\">'1.4.8.866'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.show()\n})\n</code></pre>\n<h2 id=\"vérification-de-la-prise-en-charge-de-widevine-cdm\"><a href=\"#vérification-de-la-prise-en-charge-de-widevine-cdm\">Vérification de la prise en charge de Widevine CDM</a></h2>\n<p>Pour vérifier si Widevine fonctionne, vous pouvez utiliser les méthodes suivantes:</p>\n<ul>\n<li>Ouvrez <a href=\"https://shaka-player-demo.appspot.com/\">https://shaka-player-demo.appspot.com/</a> et charger un manifeste qui utilise <code>Widevine</code>.</li>\n<li>Ouvrez <a href=\"http://www.dash-player.com/demo/drm-test-area/\">http://www.dash-player.com/demo/drm-test-area/</a>, vérifier que la page indique <code>bitdash uses Widevine in your browser</code>, puis lancez la vidéo.</li>\n</ul>",
      "title": "Tester le CDM Widevine",
      "description": "Chrome 59 (and later) includes support for Verified Media Path (VMP). VMP provides a method to verify the authenticity of a device platform. For browser deployments, this will provide an additional signal to determine if a browser-based implementation is reliable and secure.\nThe proxy integration guide has been updated with information about VMP and how to issue licenses.\nWidevine recommends our browser-based integrations (vendors and browser-based applications) add support for VMP."
    },
    "/docs/api/structures/thumbar-button": {
      "locale": "fr-FR",
      "slug": "thumbar-button",
      "href": "/docs/api/structures/thumbar-button",
      "crowdinFileId": "256515",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/thumbar-button.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"thumbarbutton-object\"><a href=\"#thumbarbutton-object\">ThumbarButton Object</a></h1>\n<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - The icon showing in thumbnail toolbar.</li>\n<li><code>click</code> Function</li>\n<li><code>tooltip</code> String (optional) - The text of the button's tooltip.</li>\n<li><code>flags</code> String<a href=\"/docs/api/structures/optional\"></a> - Control specific states and behaviors of the button. By default, it is <code>['enabled']</code>.</li>\n</ul>\n<p>The <code>flags</code> is an array that can include following <code>String</code>s:</p>\n<ul>\n<li><code>enabled</code> - The button is active and available to the user.</li>\n<li><code>disabled</code> - The button is disabled. It is present, but has a visual state indicating it will not respond to user action.</li>\n<li><code>dismissonclick</code> - When the button is clicked, the thumbnail window closes immediately.</li>\n<li><code>nobackground</code> - Do not draw a button border, use only the image.</li>\n<li><code>hidden</code> - The button is not shown to the user.</li>\n<li><code>noninteractive</code> - The button is enabled but not interactive; no pressed button state is drawn. This value is intended for instances where the button is used in a notification.</li>\n</ul>",
      "title": "ThumbarButton Object",
      "description": ""
    },
    "/docs/api/touch-bar": {
      "locale": "fr-FR",
      "slug": "touch-bar",
      "href": "/docs/api/touch-bar",
      "crowdinFileId": "256395",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"touchbar\"><a href=\"#touchbar\">TouchBar</a></h1>\n<h2 id=\"classe--touchbar\"><a href=\"#classe--touchbar\">Classe : TouchBar</a></h2>\n<blockquote>\n<p>Créer une disposition TouchBar pour les applications natives macOS</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h3 id=\"new-touchbaroptions\"><a href=\"#new-touchbaroptions\"><code>new TouchBar(options)</code></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>items</code> (<a href=\"/docs/api/touch-bar-button\">TouchBarButton</a> | <a href=\"/docs/api/touch-bar-color-picker\">TouchBarColorPicker</a> | <a href=\"/docs/api/touch-bar-group\">TouchBarGroup</a> | <a href=\"/docs/api/touch-bar-label\">TouchBarLabel</a> | <a href=\"/docs/api/touch-bar-popover\">TouchBarPopover</a> | <a href=\"/docs/api/touch-bar-scrubber\">TouchBarScrubber</a> | <a href=\"/docs/api/touch-bar-segmented-control\">TouchBarSegmentedControl</a> | <a href=\"/docs/api/touch-bar-slider\">TouchBarSlider</a> | <a href=\"/docs/api/touch-bar-spacer\">TouchBarSpacer</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>escapeItem</code> (<a href=\"/docs/api/touch-bar-button\">TouchBarButton</a> | <a href=\"/docs/api/touch-bar-color-picker\">TouchBarColorPicker</a> | <a href=\"/docs/api/touch-bar-group\">TouchBarGroup</a> | <a href=\"/docs/api/touch-bar-label\">TouchBarLabel</a> | <a href=\"/docs/api/touch-bar-popover\">TouchBarPopover</a> | <a href=\"/docs/api/touch-bar-scrubber\">TouchBarScrubber</a> | <a href=\"/docs/api/touch-bar-segmented-control\">TouchBarSegmentedControl</a> | <a href=\"/docs/api/touch-bar-slider\">TouchBarSlider</a> | <a href=\"/docs/api/touch-bar-spacer\">TouchBarSpacer</a> | null) (optional)</li>\n</ul></li>\n</ul>\n<p>Creates a new touch bar with the specified items. Use <code>BrowserWindow.setTouchBar</code> to add the <code>TouchBar</code> to a window.</p>\n<p><strong>Remarque :</strong> L’API TouchBar est actuellement expérimentale et peut changer ou être supprimée dans les futures mises à jour d'Electron.</p>\n<p><strong>Tip:</strong> If you don't have a MacBook with Touch Bar, you can use <a href=\"https://github.com/sindresorhus/touch-bar-simulator\">Touch Bar Simulator</a> to test Touch Bar usage in your app.</p>\n<h3 id=\"static-properties\"><a href=\"#static-properties\">Static Properties</a></h3>\n<h4 id=\"touchbarbutton\"><a href=\"#touchbarbutton\"><code>TouchBarButton</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-button\"><code>typeof TouchBarButton</code></a> reference to the <code>TouchBarButton</code> class.</p>\n<h4 id=\"touchbarcolorpicker\"><a href=\"#touchbarcolorpicker\"><code>TouchBarColorPicker</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-color-picker\"><code>typeof TouchBarColorPicker</code></a> reference to the <code>TouchBarColorPicker</code> class.</p>\n<h4 id=\"touchbargroup\"><a href=\"#touchbargroup\"><code>TouchBarGroup</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-group\"><code>typeof TouchBarGroup</code></a> reference to the <code>TouchBarGroup</code> class.</p>\n<h4 id=\"touchbarlabel\"><a href=\"#touchbarlabel\"><code>TouchBarLabel</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-label\"><code>typeof TouchBarLabel</code></a> reference to the <code>TouchBarLabel</code> class.</p>\n<h4 id=\"touchbarpopover\"><a href=\"#touchbarpopover\"><code>TouchBarPopover</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-popover\"><code>typeof TouchBarPopover</code></a> reference to the <code>TouchBarPopover</code> class.</p>\n<h4 id=\"touchbarscrubber\"><a href=\"#touchbarscrubber\"><code>TouchBarScrubber</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-scrubber\"><code>typeof TouchBarScrubber</code></a> reference to the <code>TouchBarScrubber</code> class.</p>\n<h4 id=\"touchbarsegmentedcontrol\"><a href=\"#touchbarsegmentedcontrol\"><code>TouchBarSegmentedControl</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-segmented-control\"><code>typeof TouchBarSegmentedControl</code></a> reference to the <code>TouchBarSegmentedControl</code> class.</p>\n<h4 id=\"touchbarslider\"><a href=\"#touchbarslider\"><code>TouchBarSlider</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-slider\"><code>typeof TouchBarSlider</code></a> reference to the <code>TouchBarSlider</code> class.</p>\n<h4 id=\"touchbarspacer\"><a href=\"#touchbarspacer\"><code>TouchBarSpacer</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-spacer\"><code>typeof TouchBarSpacer</code></a> reference to the <code>TouchBarSpacer</code> class.</p>\n<h4 id=\"touchbarotheritemsproxy\"><a href=\"#touchbarotheritemsproxy\"><code>TouchBarOtherItemsProxy</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-other-items-proxy\"><code>typeof TouchBarOtherItemsProxy</code></a> reference to the <code>TouchBarOtherItemsProxy</code> class.</p>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<p>Les propriétés suivantes sont disponibles pour les instances de <code>TouchBar</code> :</p>\n<h4 id=\"touchbarescapeitem\"><a href=\"#touchbarescapeitem\"><code>touchBar.escapeItem</code></a></h4>\n<p>A <code>TouchBarItem</code> that will replace the \"esc\" button on the touch bar when set. Le définir à <code>null</code> restaurera le bouton \"esc\". Changer cette valeur immédiatement met à jour le bouton \"esc\" dans la touch bar.</p>\n<h2 id=\"exemples\"><a href=\"#exemples\">Exemples</a></h2>\n<p>Voici un exemple d’un jeu de machine à sous dans la touch bar avec un bouton et quelques labels.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, TouchBar } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> { TouchBarLabel, TouchBarButton, TouchBarSpacer } = TouchBar\n\n<span class=\"hljs-keyword\">let</span> spinning = <span class=\"hljs-literal\">false</span>\n\n<span class=\"hljs-comment\">// Reel labels</span>\n<span class=\"hljs-keyword\">const</span> reel1 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n<span class=\"hljs-keyword\">const</span> reel2 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n<span class=\"hljs-keyword\">const</span> reel3 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n\n<span class=\"hljs-comment\">// Spin result label</span>\n<span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n\n<span class=\"hljs-comment\">// Spin button</span>\n<span class=\"hljs-keyword\">const</span> spin = <span class=\"hljs-keyword\">new</span> TouchBarButton({\n  <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'🎰 Spin'</span>,\n  <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#7851A9'</span>,\n  <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// Ignore clicks if already spinning</span>\n    <span class=\"hljs-keyword\">if</span> (spinning) {\n      <span class=\"hljs-keyword\">return</span>\n    }\n\n    spinning = <span class=\"hljs-literal\">true</span>\n    result.label = <span class=\"hljs-string\">''</span>\n\n    <span class=\"hljs-keyword\">let</span> timeout = <span class=\"hljs-number\">10</span>\n    <span class=\"hljs-keyword\">const</span> spinLength = <span class=\"hljs-number\">4</span> * <span class=\"hljs-number\">1000</span> <span class=\"hljs-comment\">// 4 seconds</span>\n    <span class=\"hljs-keyword\">const</span> startTime = <span class=\"hljs-built_in\">Date</span>.now()\n\n    <span class=\"hljs-keyword\">const</span> spinReels = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      updateReels()\n\n      <span class=\"hljs-keyword\">if</span> ((<span class=\"hljs-built_in\">Date</span>.now() - startTime) >= spinLength) {\n        finishSpin()\n      } <span class=\"hljs-keyword\">else</span> {\n        <span class=\"hljs-comment\">// Slow down a bit on each spin</span>\n        timeout *= <span class=\"hljs-number\">1.1</span>\n        setTimeout(spinReels, timeout)\n      }\n    }\n\n    spinReels()\n  }\n})\n\n<span class=\"hljs-keyword\">const</span> getRandomValue = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> values = [<span class=\"hljs-string\">'🍒'</span>, <span class=\"hljs-string\">'💎'</span>, <span class=\"hljs-string\">'7️⃣'</span>, <span class=\"hljs-string\">'🍊'</span>, <span class=\"hljs-string\">'🔔'</span>, <span class=\"hljs-string\">'⭐'</span>, <span class=\"hljs-string\">'🍇'</span>, <span class=\"hljs-string\">'🍀'</span>]\n  <span class=\"hljs-keyword\">return</span> values[<span class=\"hljs-built_in\">Math</span>.floor(<span class=\"hljs-built_in\">Math</span>.random() * values.length)]\n}\n\n<span class=\"hljs-keyword\">const</span> updateReels = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  reel1.label = getRandomValue()\n  reel2.label = getRandomValue()\n  reel3.label = getRandomValue()\n}\n\n<span class=\"hljs-keyword\">const</span> finishSpin = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> uniqueValues = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Set</span>([reel1.label, reel2.label, reel3.label]).size\n  <span class=\"hljs-keyword\">if</span> (uniqueValues === <span class=\"hljs-number\">1</span>) {\n    <span class=\"hljs-comment\">// All 3 values are the same</span>\n    result.label = <span class=\"hljs-string\">'💰 Jackpot!'</span>\n    result.textColor = <span class=\"hljs-string\">'#FDFF00'</span>\n  } <span class=\"hljs-keyword\">else</span> <span class=\"hljs-keyword\">if</span> (uniqueValues === <span class=\"hljs-number\">2</span>) {\n    <span class=\"hljs-comment\">// 2 values are the same</span>\n    result.label = <span class=\"hljs-string\">'😍 Winner!'</span>\n    result.textColor = <span class=\"hljs-string\">'#FDFF00'</span>\n  } <span class=\"hljs-keyword\">else</span> {\n    <span class=\"hljs-comment\">// No values are the same</span>\n    result.label = <span class=\"hljs-string\">'🙁 Spin Again'</span>\n    result.textColor = <span class=\"hljs-literal\">null</span>\n  }\n  spinning = <span class=\"hljs-literal\">false</span>\n}\n\n<span class=\"hljs-keyword\">const</span> touchBar = <span class=\"hljs-keyword\">new</span> TouchBar({\n  <span class=\"hljs-attr\">items</span>: [\n    spin,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'large'</span> }),\n    reel1,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'small'</span> }),\n    reel2,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'small'</span> }),\n    reel3,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'large'</span> }),\n    result\n  ]\n})\n\n<span class=\"hljs-keyword\">let</span> <span class=\"hljs-built_in\">window</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-built_in\">window</span> = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span>,\n    <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span>,\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#000'</span>\n  })\n  <span class=\"hljs-built_in\">window</span>.loadURL(<span class=\"hljs-string\">'about:blank'</span>)\n  <span class=\"hljs-built_in\">window</span>.setTouchBar(touchBar)\n})\n</code></pre>\n<h3 id=\"exécution-de-lexemple-ci-dessus\"><a href=\"#exécution-de-lexemple-ci-dessus\">Exécution de l’exemple ci-dessus</a></h3>\n<p>Pour exécuter l’exemple ci-dessus, vous devrez (en supposant que vous avez un terminal ouvert dans le répertoire où vous souhaitez exécuter l’exemple) :</p>\n<ol>\n<li>Enregistrez le fichier ci-dessus sur votre ordinateur comme <code>touchbar.js</code></li>\n<li>Installez Electron via <code>npm install electron</code></li>\n<li>Exécutez l’exemple avec Electron : <code>./node_modules/.bin/electron touchbar.js</code></li>\n</ol>\n<p>Vous devriez alors voir une nouvelle fenêtre Electron et l’application en cours d’exécution dans votre touch bar (ou touch bar emulator).</p>",
      "title": "TouchBar",
      "description": "Créer une disposition TouchBar pour les applications natives macOS"
    },
    "/docs/api/touch-bar-button": {
      "locale": "fr-FR",
      "slug": "touch-bar-button",
      "href": "/docs/api/touch-bar-button",
      "crowdinFileId": "256375",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-button.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe--touchbarbutton\"><a href=\"#classe--touchbarbutton\">Classe : TouchBarButton</a></h2>\n<blockquote>\n<p>Créer un bouton dans la touch bar pour les applications native macOS</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarbuttonoptions\"><a href=\"#new-touchbarbuttonoptions\"><code>new TouchBarButton(options)</code></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>label</code> String (facultatif) - Texte du bouton.</li>\n<li><code>accessibilityLabel</code> String (optional) - A short description of the button for use by screenreaders like VoiceOver.</li>\n<li><code>backgroundColor</code> String (facultatif) - Couleur de fond hexadécimal du bouton, c.-à-d. <code>#ABCDEF</code>.</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String(facultatif) - Icône du bouton.</li>\n<li><code>iconPosition</code> String (facultatif) -Peut être <code>left</code>, <code>right</code> ou <code>overlay</code>. Par défaut, <code>overlay</code>.</li>\n<li><code>click</code> Function (facultatif) - Fonction à appeler lorsque le bouton est cliqué.</li>\n<li><code>enabled</code> Boolean (optional) - Whether the button is in an enabled state.  La valeur par défaut est <code>vraie</code>.</li>\n</ul></li>\n</ul>\n<p>When defining <code>accessibilityLabel</code>, ensure you have considered macOS <a href=\"https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc\">best practices</a>.</p>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<p>Les propriétés suivantes sont disponibles pour les instances de <code>TouchBarButton</code> :</p>\n<h4 id=\"touchbarbuttonaccessibilitylabel\"><a href=\"#touchbarbuttonaccessibilitylabel\"><code>touchBarButton.accessibilityLabel</code></a></h4>\n<p>A <code>String</code> representing the description of the button to be read by a screen reader. Will only be read by screen readers if no label is set.</p>\n<h4 id=\"touchbarbuttonlabel\"><a href=\"#touchbarbuttonlabel\"><code>touchBarButton.label</code></a></h4>\n<p>A <code>String</code> representing the button's current text. Changing this value immediately updates the button in the touch bar.</p>\n<h4 id=\"touchbarbuttonbackgroundcolor\"><a href=\"#touchbarbuttonbackgroundcolor\"><code>touchBarButton.backgroundColor</code></a></h4>\n<p>A <code>String</code> hex code representing the button's current background color. Changing this value immediately updates the button in the touch bar.</p>\n<h4 id=\"touchbarbuttonicon\"><a href=\"#touchbarbuttonicon\"><code>touchBarButton.icon</code></a></h4>\n<p>A <code>NativeImage</code> representing the button's current icon. Changing this value immediately updates the button in the touch bar.</p>\n<h4 id=\"touchbarbuttoniconposition\"><a href=\"#touchbarbuttoniconposition\"><code>touchBarButton.iconPosition</code></a></h4>\n<p>A <code>String</code> - Can be <code>left</code>, <code>right</code> or <code>overlay</code>.  Par défaut, <code>overlay</code>.</p>\n<h4 id=\"touchbarbuttonenabled\"><a href=\"#touchbarbuttonenabled\"><code>touchBarButton.enabled</code></a></h4>\n<p>A <code>Boolean</code> representing whether the button is in an enabled state.</p>",
      "title": "Classe : TouchBarButton",
      "description": "Créer un bouton dans la touch bar pour les applications native macOS"
    },
    "/docs/api/touch-bar-color-picker": {
      "locale": "fr-FR",
      "slug": "touch-bar-color-picker",
      "href": "/docs/api/touch-bar-color-picker",
      "crowdinFileId": "256377",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-color-picker.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe--touchbarcolorpicker\"><a href=\"#classe--touchbarcolorpicker\">Classe : TouchBarColorPicker</a></h2>\n<blockquote>\n<p>Créer un sélecteur de couleur dans la touch bar pour les applications native macOS</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarcolorpickeroptions\"><a href=\"#new-touchbarcolorpickeroptions\"><code>new TouchBarColorPicker(options)</code></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>availableColors</code> String<a href=\"/docs/api/facultatif\"></a> - Tableau de chaîne de caractères de couleurs en hexadécimal pouvant être choisi.</li>\n<li><code>selectedColor</code> String (facultatif) - La couleur en hexadécimal selectionné dans le sélecteur, c.-à-d. <code>#ABCDEF</code>.</li>\n<li><code>change</code> Function (optional) - Function to call when a color is selected.<ul>\n<li><code>color</code> String - La couleur que l'utilisateur a sélectionnée dans le sélecteur.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<p>Les propriétés suivantes sont disponibles pour les instances de <code>TouchBarColorPicker</code> :</p>\n<h4 id=\"touchbarcolorpickeravailablecolors\"><a href=\"#touchbarcolorpickeravailablecolors\"><code>touchBarColorPicker.availableColors</code></a></h4>\n<p>A <code>String[]</code> array representing the color picker's available colors to select. Changing this value immediately updates the color picker in the touch bar.</p>\n<h4 id=\"touchbarcolorpickerselectedcolor\"><a href=\"#touchbarcolorpickerselectedcolor\"><code>touchBarColorPicker.selectedColor</code></a></h4>\n<p>A <code>String</code> hex code representing the color picker's currently selected color. Changing this value immediately updates the color picker in the touch bar.</p>",
      "title": "Classe : TouchBarColorPicker",
      "description": "Créer un sélecteur de couleur dans la touch bar pour les applications native macOS"
    },
    "/docs/api/touch-bar-group": {
      "locale": "fr-FR",
      "slug": "touch-bar-group",
      "href": "/docs/api/touch-bar-group",
      "crowdinFileId": "256379",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-group.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe-touchbargroup\"><a href=\"#classe-touchbargroup\">Classe: TouchBarGroup</a></h2>\n<blockquote>\n<p>Créer un groupe dans la touch bar pour les applications native macOS</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbargroupoptions\"><a href=\"#new-touchbargroupoptions\"><code>new TouchBarGroup(options)</code></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>items</code> <a href=\"/docs/api/touch-bar\">TouchBar</a> - Éléments à afficher en tant que groupe.</li>\n</ul></li>\n</ul>",
      "title": "Classe: TouchBarGroup",
      "description": "Créer un groupe dans la touch bar pour les applications native macOS"
    },
    "/docs/api/touch-bar-label": {
      "locale": "fr-FR",
      "slug": "touch-bar-label",
      "href": "/docs/api/touch-bar-label",
      "crowdinFileId": "256381",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-label.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe--touchbarlabel\"><a href=\"#classe--touchbarlabel\">Classe : TouchBarLabel</a></h2>\n<blockquote>\n<p>Créer un label dans la touch bar pour les applications native macOS</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarlabeloptions\"><a href=\"#new-touchbarlabeloptions\"><code>new TouchBarLabel(options)</code></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>label</code> String (facultatif) - Texte à afficher.</li>\n<li><code>accessibilityLabel</code> String (optional) - A short description of the button for use by screenreaders like VoiceOver.</li>\n<li><code>textColor</code> String (facultatif) - Couleur hexadécimal du texte, c.-à-d. <code>#ABCDEF</code>.</li>\n</ul></li>\n</ul>\n<p>When defining <code>accessibilityLabel</code>, ensure you have considered macOS <a href=\"https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc\">best practices</a>.</p>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<p>Les propriétés suivantes sont disponibles pour les instances de <code>TouchBarLabel</code> :</p>\n<h4 id=\"touchbarlabellabel\"><a href=\"#touchbarlabellabel\"><code>touchBarLabel.label</code></a></h4>\n<p>A <code>String</code> representing the label's current text. Changing this value immediately updates the label in the touch bar.</p>\n<h4 id=\"touchbarlabelaccessibilitylabel\"><a href=\"#touchbarlabelaccessibilitylabel\"><code>touchBarLabel.accessibilityLabel</code></a></h4>\n<p>A <code>String</code> representing the description of the label to be read by a screen reader.</p>\n<h4 id=\"touchbarlabeltextcolor\"><a href=\"#touchbarlabeltextcolor\"><code>touchBarLabel.textColor</code></a></h4>\n<p>A <code>String</code> hex code representing the label's current text color. Changing this value immediately updates the label in the touch bar.</p>",
      "title": "Classe : TouchBarLabel",
      "description": "Créer un label dans la touch bar pour les applications native macOS"
    },
    "/docs/api/touch-bar-other-items-proxy": {
      "locale": "fr-FR",
      "slug": "touch-bar-other-items-proxy",
      "href": "/docs/api/touch-bar-other-items-proxy",
      "crowdinFileId": "256383",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-other-items-proxy.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarotheritemsproxy\"><a href=\"#class-touchbarotheritemsproxy\">Class: TouchBarOtherItemsProxy</a></h2>\n<blockquote>\n<p>Instantiates a special \"other items proxy\", which nests TouchBar elements inherited from Chromium at the space indicated by the proxy. By default, this proxy is added to each TouchBar at the end of the input. For more information, see the AppKit docs on <a href=\"https://developer.apple.com/documentation/appkit/nstouchbaritemidentifierotheritemsproxy\">NSTouchBarItemIdentifierOtherItemsProxy</a></p>\n<p>Note: Only one instance of this class can be added per TouchBar.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarotheritemsproxy\"><a href=\"#new-touchbarotheritemsproxy\"><code>new TouchBarOtherItemsProxy()</code></a></h3>",
      "title": "TouchBarOtherItemsProxy",
      "description": "Instantiates a special \"other items proxy\", which nests TouchBar elements inherited from Chromium at the space indicated by the proxy. By default, this proxy is added to each TouchBar at the end of the input. For more information, see the AppKit docs on NSTouchBarItemIdentifierOtherItemsProxy\nNote: Only one instance of this class can be added per TouchBar."
    },
    "/docs/api/touch-bar-popover": {
      "locale": "fr-FR",
      "slug": "touch-bar-popover",
      "href": "/docs/api/touch-bar-popover",
      "crowdinFileId": "256385",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-popover.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe--touchbarpopover\"><a href=\"#classe--touchbarpopover\">Classe : TouchBarPopover</a></h2>\n<blockquote>\n<p>Créer un popover dans la touch bar pour les applications native macOS</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarpopoveroptions\"><a href=\"#new-touchbarpopoveroptions\"><code>new TouchBarPopover(options)</code></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>label</code> String (facultatif) - Texte du bouton popover.</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> (facultatif) - Icône du bouton popover.</li>\n<li><code>items</code> <a href=\"/docs/api/touch-bar\">TouchBar</a> - Items to display in the popover.</li>\n<li><code>showCloseButton</code> Boolean (optional) - <code>true</code> to display a close button on the left of the popover, <code>false</code> to not show it. La valeur par défaut est <code>vraie</code>.</li>\n</ul></li>\n</ul>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<p>Les propriétés suivantes sont disponibles pour les instances de <code>TouchBarPopover</code> :</p>\n<h4 id=\"touchbarpopoverlabel\"><a href=\"#touchbarpopoverlabel\"><code>touchBarPopover.label</code></a></h4>\n<p>A <code>String</code> representing the popover's current button text. Changing this value immediately updates the popover in the touch bar.</p>\n<h4 id=\"touchbarpopovericon\"><a href=\"#touchbarpopovericon\"><code>touchBarPopover.icon</code></a></h4>\n<p>A <code>NativeImage</code> representing the popover's current button icon. Changing this value immediately updates the popover in the touch bar.</p>",
      "title": "Classe : TouchBarPopover",
      "description": "Créer un popover dans la touch bar pour les applications native macOS"
    },
    "/docs/api/touch-bar-scrubber": {
      "locale": "fr-FR",
      "slug": "touch-bar-scrubber",
      "href": "/docs/api/touch-bar-scrubber",
      "crowdinFileId": "256387",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-scrubber.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe--touchbarscrubber\"><a href=\"#classe--touchbarscrubber\">Classe : TouchBarScrubber</a></h2>\n<blockquote>\n<p>Créer un scrubber (un sélecteur de défilement)</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarscrubberoptions\"><a href=\"#new-touchbarscrubberoptions\"><code>new TouchBarScrubber(options)</code></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>items</code> <a href=\"/docs/api/structures/scrubber-item\">ScrubberItem[]</a> - Un tableau d'éléments à placer dans ce scrubber.</li>\n<li><code>select</code> Function (optional) - Called when the user taps an item that was not the last tapped item.<ul>\n<li><code>selectedIndex</code> Integer - L'index de l'élément que l'utilisateur a sélectionné.</li>\n</ul></li>\n<li><code>highlight</code> Function (optional) - Called when the user taps any item.<ul>\n<li><code>highlightedIndex</code> Integer - L'index de l'élément que l'utilisateur a sélectionné.</li>\n</ul></li>\n<li><code>selectedStyle</code> String (optional) - Selected item style. Can be <code>background</code>, <code>outline</code> or <code>none</code>. Par défaut, <code>none</code>.</li>\n<li><code>overlayStyle</code> String (optional) - Selected overlay item style. Can be <code>background</code>, <code>outline</code> or <code>none</code>. Par défaut, <code>none</code>.</li>\n<li><code>showArrowButtons</code> Boolean (facultatif) - Afficher ou non les boutons flèches. La valeur par défaut est <code>false</code> et n'est affichée que si <code>items</code> n'est pas vide.</li>\n<li><code>mode</code> String (optional) - Can be <code>fixed</code> or <code>free</code>. Par défaut, <code>free</code>.</li>\n<li><code>continuous</code> Boolean (optionnel) - <code>true</code> par défaut.</li>\n</ul></li>\n</ul>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<p>Les propriétés suivantes sont disponibles pour les instances de <code>TouchBarScrubber</code> :</p>\n<h4 id=\"touchbarscrubberitems\"><a href=\"#touchbarscrubberitems\"><code>touchBarScrubber.items</code></a></h4>\n<p>Un tableau de <code>ScrubberItem[]</code>représentant les éléments dans ce scrubber. Changer cette valeur immédiatement met à jour le contrôle dans la touch bar. Changer une propriété dans le tableau <strong>ne met pas à jour la touch bar</strong>.</p>\n<h4 id=\"touchbarscrubberselectedstyle\"><a href=\"#touchbarscrubberselectedstyle\"><code>touchBarScrubber.selectedStyle</code></a></h4>\n<p>Un <code>String</code> représentant le style des éléments sélectionnés dans le scrubber. Changer cette valeur immédiatement met à jour le contrôle dans la touch bar. Valeurs possibles :</p>\n<ul>\n<li><code>background</code> - Mappé à <code>[NSScrubberSelectionStyle roundedBackgroundStyle]</code>.</li>\n<li><code>outline</code> - Mappé à <code>[NSScrubberSelectionStyle outlineOverlayStyle]</code>.</li>\n<li><code>none</code> - Removes all styles.</li>\n</ul>\n<h4 id=\"touchbarscrubberoverlaystyle\"><a href=\"#touchbarscrubberoverlaystyle\"><code>touchBarScrubber.overlayStyle</code></a></h4>\n<p>Un <code>String</code> représentant le style des éléments sélectionnés dans le scrubber. Ce style est superposé sur le dessus de l'élément scrubber au lieu d'être placé derrière. Changer cette valeur immédiatement met à jour le contrôle dans la touch bar. Valeurs possibles :</p>\n<ul>\n<li><code>background</code> - Mappé à <code>[NSScrubberSelectionStyle roundedBackgroundStyle]</code>.</li>\n<li><code>outline</code> - Mappé à <code>[NSScrubberSelectionStyle outlineOverlayStyle]</code>.</li>\n<li><code>none</code> - Removes all styles.</li>\n</ul>\n<h4 id=\"touchbarscrubbershowarrowbuttons\"><a href=\"#touchbarscrubbershowarrowbuttons\"><code>touchBarScrubber.showArrowButtons</code></a></h4>\n<p>A <code>Boolean</code> representing whether to show the left / right selection arrows in this scrubber. Updating this value immediately updates the control in the touch bar.</p>\n<h4 id=\"touchbarscrubbermode\"><a href=\"#touchbarscrubbermode\"><code>touchBarScrubber.mode</code></a></h4>\n<p>A <code>String</code> representing the mode of this scrubber. Changer cette valeur immédiatement met à jour le contrôle dans la touch bar. Valeurs possibles :</p>\n<ul>\n<li><code>fixed</code> - Mappé à <code>NSScrubberModeFixed</code>.</li>\n<li><code>free</code> - Mappé à <code>NSScrubberModeFree</code>.</li>\n</ul>\n<h4 id=\"touchbarscrubbercontinuous\"><a href=\"#touchbarscrubbercontinuous\"><code>touchBarScrubber.continuous</code></a></h4>\n<p>A <code>Boolean</code> representing whether this scrubber is continuous or not. Changer cette valeur immédiatement met à jour le contrôle dans la touch bar.</p>",
      "title": "Classe : TouchBarScrubber",
      "description": "Créer un scrubber (un sélecteur de défilement)"
    },
    "/docs/api/touch-bar-segmented-control": {
      "locale": "fr-FR",
      "slug": "touch-bar-segmented-control",
      "href": "/docs/api/touch-bar-segmented-control",
      "crowdinFileId": "256389",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-segmented-control.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe--touchbarsegmentedcontrol\"><a href=\"#classe--touchbarsegmentedcontrol\">Classe : TouchBarSegmentedControl</a></h2>\n<blockquote>\n<p>Créer un contrôle segmenté (un groupe de bouton) où un seul bouton a un état sélectionné</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarsegmentedcontroloptions\"><a href=\"#new-touchbarsegmentedcontroloptions\"><code>new TouchBarSegmentedControl(options)</code></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>segmentStyle</code> String (optional) - Style of the segments:<ul>\n<li><code>automatique</code> - Par défaut. The appearance of the segmented control is automatically determined based on the type of window in which the control is displayed and the position within the window. Maps to <code>NSSegmentStyleAutomatic</code>.</li>\n<li><code>rounded</code> - Le contrôle est affiché en utilisant le style arrondi. Maps to <code>NSSegmentStyleRounded</code>.</li>\n<li><code>textured-rounded</code> - Le contrôle est affiché en utilisant le style arrondi texturé. Maps to <code>NSSegmentStyleTexturedRounded</code>.</li>\n<li><code>round-rect</code> - Le contrôle est affiché en utilisant le style arrondi rect. Maps to <code>NSSegmentStyleRoundRect</code>.</li>\n<li><code>textured-square</code> - Le contrôle est affiché en utilisant le style carré texturé. Maps to <code>NSSegmentStyleTexturedSquare</code>.</li>\n<li><code>capsule</code> - Le contrôle s’affiche selon le style capsule. Maps to <code>NSSegmentStyleCapsule</code>.</li>\n<li><code>small-square</code> - Le contrôle est affiché en utilisant le style petit carré. Maps to <code>NSSegmentStyleSmallSquare</code>.</li>\n<li><code>separated</code> - Les segments du contrôle sont affichés très proches entre eux, mais ne se touche pas. Maps to <code>NSSegmentStyleSeparated</code>.</li>\n</ul></li>\n<li><code>mode</code> String (optional) - The selection mode of the control:<ul>\n<li><code>single</code> - Default. One item selected at a time, selecting one deselects the previously selected item. Maps to <code>NSSegmentSwitchTrackingSelectOne</code>.</li>\n<li><code>multiple</code> - Plusieurs éléments peuvent être sélectionnés simultanément. Maps to <code>NSSegmentSwitchTrackingSelectAny</code>.</li>\n<li><code>buttons</code> - Transforme les segments en boutons, chaque segment peut être pressé et relâché, mais jamais être marqué comme actif. Maps to <code>NSSegmentSwitchTrackingMomentary</code>.</li>\n</ul></li>\n<li><code>segments</code> <a href=\"/docs/api/structures/segmented-control-segment\">SegmentedControlSegment[]</a> - Un tableau de segments à placer dans ce contrôle.</li>\n<li><code>selectedIndex</code> Integer (facultatif) - L'index du segment actuellement sélectionné, mis automatiquement à jour avec une interaction utilisateur. When the mode is <code>multiple</code> it will be the last selected item.</li>\n<li><code>change</code> Function (optional) - Called when the user selects a new segment.<ul>\n<li><code>selectedIndex</code> Integer - L'index du segment que l'utilisateur a sélectionné.</li>\n<li><code>isSelected</code> Boolean - Si après la selection de l'utilisateur, le segment est selectionné ou non.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<p>Les propriétés suivantes sont disponibles pour les instances de <code>TouchBarSegmentedControl</code> :</p>\n<h4 id=\"touchbarsegmentedcontrolsegmentstyle\"><a href=\"#touchbarsegmentedcontrolsegmentstyle\"><code>touchBarSegmentedControl.segmentStyle</code></a></h4>\n<p>A <code>String</code> representing the controls current segment style. Updating this value immediately updates the control in the touch bar.</p>\n<h4 id=\"touchbarsegmentedcontrolsegments\"><a href=\"#touchbarsegmentedcontrolsegments\"><code>touchBarSegmentedControl.segments</code></a></h4>\n<p>Un tableau de <code>SegmentedControlSegment[]</code>, qui représente les segments dans ce contrôle. Changer cette valeur immédiatement met à jour le contrôle dans la touch bar. Changer une propriété dans le tableau <strong>ne met pas à jour la touch bar</strong>.</p>\n<h4 id=\"touchbarsegmentedcontrolselectedindex\"><a href=\"#touchbarsegmentedcontrolselectedindex\"><code>touchBarSegmentedControl.selectedIndex</code></a></h4>\n<p>Un <code>Integer</code> qui représente le segment sélectionné. Changer cette valeur immédiatement met à jour le contrôle dans la touch bar. Une interaction utilisateur avec la touch bar mettra à jour cette valeur automatiquement.</p>\n<h4 id=\"touchbarsegmentedcontrolmode\"><a href=\"#touchbarsegmentedcontrolmode\"><code>touchBarSegmentedControl.mode</code></a></h4>\n<p>A <code>String</code> representing the current selection mode of the control.  Can be <code>single</code>, <code>multiple</code> or <code>buttons</code>.</p>",
      "title": "Classe : TouchBarSegmentedControl",
      "description": "Créer un contrôle segmenté (un groupe de bouton) où un seul bouton a un état sélectionné"
    },
    "/docs/api/touch-bar-slider": {
      "locale": "fr-FR",
      "slug": "touch-bar-slider",
      "href": "/docs/api/touch-bar-slider",
      "crowdinFileId": "256391",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-slider.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe--touchbarslider\"><a href=\"#classe--touchbarslider\">Classe : TouchBarSlider</a></h2>\n<blockquote>\n<p>Créer un curseur dans la touch bar pour les applications native macOS</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarslideroptions\"><a href=\"#new-touchbarslideroptions\"><code>new TouchBarSlider(options)</code></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>label</code> String (facultatif) - Texte du label.</li>\n<li><code>value</code> Integer (facultatif) - Valeur sélectionnée.</li>\n<li><code>minValue</code> Integer (facultatif) - Valeur minimale.</li>\n<li><code>maxValue</code> Integer (facultatif) - Valeur maximale.</li>\n<li><code>change</code> Function (optional) - Function to call when the slider is changed.<ul>\n<li><code>newValue</code> Number - La valeur que l'utilisateur a sélectionnée sur le curseur.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<p>Les propriétés suivantes sont disponibles pour les instances de <code>TouchBarSlider</code> :</p>\n<h4 id=\"touchbarsliderlabel\"><a href=\"#touchbarsliderlabel\"><code>touchBarSlider.label</code></a></h4>\n<p>A <code>String</code> representing the slider's current text. Changing this value immediately updates the slider in the touch bar.</p>\n<h4 id=\"touchbarslidervalue\"><a href=\"#touchbarslidervalue\"><code>touchBarSlider.value</code></a></h4>\n<p>A <code>Number</code> representing the slider's current value. Changing this value immediately updates the slider in the touch bar.</p>\n<h4 id=\"touchbarsliderminvalue\"><a href=\"#touchbarsliderminvalue\"><code>touchBarSlider.minValue</code></a></h4>\n<p>A <code>Number</code> representing the slider's current minimum value. Changing this value immediately updates the slider in the touch bar.</p>\n<h4 id=\"touchbarslidermaxvalue\"><a href=\"#touchbarslidermaxvalue\"><code>touchBarSlider.maxValue</code></a></h4>\n<p>A <code>Number</code> representing the slider's current maximum value. Changing this value immediately updates the slider in the touch bar.</p>",
      "title": "Classe : TouchBarSlider",
      "description": "Créer un curseur dans la touch bar pour les applications native macOS"
    },
    "/docs/api/touch-bar-spacer": {
      "locale": "fr-FR",
      "slug": "touch-bar-spacer",
      "href": "/docs/api/touch-bar-spacer",
      "crowdinFileId": "256393",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-spacer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe--touchbarspacer\"><a href=\"#classe--touchbarspacer\">Classe : TouchBarSpacer</a></h2>\n<blockquote>\n<p>Créer un espacement entre deux éléments dans la touch bar pour les applications native macOS</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarspaceroptions\"><a href=\"#new-touchbarspaceroptions\"><code>new TouchBarSpacer(options)</code></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>size</code> String (optional) - Size of spacer, possible values are:<ul>\n<li><code>small</code> - petit espacement entre les éléments. Maps to <code>NSTouchBarItemIdentifierFixedSpaceSmall</code>. This is the default.</li>\n<li><code>large</code> - grand espacement entre les éléments. Maps to <code>NSTouchBarItemIdentifierFixedSpaceLarge</code>.</li>\n<li><code>flexible</code> - Prend tout l'espace disponible. Maps to <code>NSTouchBarItemIdentifierFlexibleSpace</code>.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<p>Les propriétés suivantes sont disponibles pour les instances de <code>TouchBarSpacer</code> :</p>\n<h4 id=\"touchbarspacersize\"><a href=\"#touchbarspacersize\"><code>touchBarSpacer.size</code></a></h4>\n<p>A <code>String</code> representing the size of the spacer.  Can be <code>small</code>, <code>large</code> or <code>flexible</code>.</p>",
      "title": "Classe : TouchBarSpacer",
      "description": "Créer un espacement entre deux éléments dans la touch bar pour les applications native macOS"
    },
    "/docs/api/structures/trace-categories-and-options": {
      "locale": "fr-FR",
      "slug": "trace-categories-and-options",
      "href": "/docs/api/structures/trace-categories-and-options",
      "crowdinFileId": "256517",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/trace-categories-and-options.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"tracecategoriesandoptions-object\"><a href=\"#tracecategoriesandoptions-object\">TraceCategoriesAndOptions Object</a></h1>\n<ul>\n<li><code>categoryFilter</code> String - A filter to control what category groups should be traced. A filter can have an optional '-' prefix to exclude category groups that contain a matching category. Having both included and excluded category patterns in the same list is not supported. Examples: <code>test_MyTest*</code>, <code>test_MyTest*,test_OtherStuff</code>, <code>-excluded_category1,-excluded_category2</code>.</li>\n<li><code>traceOptions</code> String - Controls what kind of tracing is enabled, it is a comma-delimited sequence of the following strings: <code>record-until-full</code>, <code>record-continuously</code>, <code>trace-to-console</code>, <code>enable-sampling</code>, <code>enable-systrace</code>, e.g. <code>'record-until-full,enable-sampling'</code>. The first 3 options are trace recording modes and hence mutually exclusive. If more than one trace recording modes appear in the <code>traceOptions</code> string, the last one takes precedence. If none of the trace recording modes are specified, recording mode is <code>record-until-full</code>. The trace option will first be reset to the default option (<code>record_mode</code> set to <code>record-until-full</code>, <code>enable_sampling</code> and <code>enable_systrace</code> set to <code>false</code>) before options parsed from <code>traceOptions</code> are applied on it.</li>\n</ul>",
      "title": "TraceCategoriesAndOptions Object",
      "description": ""
    },
    "/docs/api/structures/trace-config": {
      "locale": "fr-FR",
      "slug": "trace-config",
      "href": "/docs/api/structures/trace-config",
      "crowdinFileId": "256519",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/trace-config.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"traceconfig-object\"><a href=\"#traceconfig-object\">TraceConfig Object</a></h1>\n<ul>\n<li><code>recording_mode</code> String (optional) - Can be <code>record-until-full</code>, <code>record-continuously</code>, <code>record-as-much-as-possible</code> or <code>trace-to-console</code>. Defaults to <code>record-until-full</code>.</li>\n<li><code>trace_buffer_size_in_kb</code> number (optional) - maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.</li>\n<li><code>trace_buffer_size_in_events</code> number (optional) - maximum size of the trace recording buffer in events.</li>\n<li><code>enable_argument_filter</code> boolean (optional) - if true, filter event data according to a specific list of events that have been manually vetted to not include any PII. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/services/tracing/public/cpp/trace_event_args_whitelist.cc\">the implementation in Chromium</a> for specifics.</li>\n<li><code>included_categories</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of tracing categories to include. Can include glob-like patterns using <code>*</code> at the end of the category name. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">tracing categories</a> for the list of categories.</li>\n<li><code>excluded_categories</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of tracing categories to exclude. Can include glob-like patterns using <code>*</code> at the end of the category name. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">tracing categories</a> for the list of categories.</li>\n<li><code>included_process_ids</code> number<a href=\"/docs/api/structures/optional\"></a> - a list of process IDs to include in the trace. If not specified, trace all processes.</li>\n<li><code>histogram_names</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of <a href=\"https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md\">histogram</a> names to report with the trace.</li>\n<li><code>memory_dump_config</code> Record&#x3C;String, any> (optional) - if the <code>disabled-by-default-memory-infra</code> category is enabled, this contains optional additional configuration for data collection. See the <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/memory-infra/memory_infra_startup_tracing.md#the-advanced-way\">Chromium memory-infra docs</a> for more information.</li>\n</ul>\n<p>An example TraceConfig that roughly matches what Chrome DevTools records:</p>\n<pre><code class=\"hljs language-js\">{\n  <span class=\"hljs-attr\">recording_mode</span>: <span class=\"hljs-string\">'record-until-full'</span>,\n  <span class=\"hljs-attr\">included_categories</span>: [\n    <span class=\"hljs-string\">'devtools.timeline'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline.frame'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline.stack'</span>,\n    <span class=\"hljs-string\">'v8.execute'</span>,\n    <span class=\"hljs-string\">'blink.console'</span>,\n    <span class=\"hljs-string\">'blink.user_timing'</span>,\n    <span class=\"hljs-string\">'latencyInfo'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-v8.cpu_profiler'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-v8.cpu_profiler.hires'</span>\n  ],\n  <span class=\"hljs-attr\">excluded_categories</span>: [<span class=\"hljs-string\">'*'</span>]\n}\n</code></pre>",
      "title": "TraceConfig Object",
      "description": ""
    },
    "/docs/api/structures/transaction": {
      "locale": "fr-FR",
      "slug": "transaction",
      "href": "/docs/api/structures/transaction",
      "crowdinFileId": "256521",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/transaction.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"transaction-object\"><a href=\"#transaction-object\">Transaction Object</a></h1>\n<ul>\n<li><code>transactionIdentifier</code> String - A string that uniquely identifies a successful payment transaction.</li>\n<li><code>transactionDate</code> String - The date the transaction was added to the App Store’s payment queue.</li>\n<li><code>originalTransactionIdentifier</code> String - The identifier of the restored transaction by the App Store.</li>\n<li><code>transactionState</code> String - The transaction state, can be <code>purchasing</code>, <code>purchased</code>, <code>failed</code>, <code>restored</code> or <code>deferred</code>.</li>\n<li><code>errorCode</code> Integer - The error code if an error occurred while processing the transaction.</li>\n<li><code>errorMessage</code> String - The error message if an error occurred while processing the transaction.</li>\n<li><code>payment</code> Object<ul>\n<li><code>productIdentifier</code> String - The identifier of the purchased product.</li>\n<li><code>quantity</code> Integer  - The quantity purchased.</li>\n</ul></li>\n</ul>",
      "title": "Transaction Object",
      "description": ""
    },
    "/docs/api/tray": {
      "locale": "fr-FR",
      "slug": "tray",
      "href": "/docs/api/tray",
      "crowdinFileId": "256397",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/tray.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"tray\"><a href=\"#tray\">Tray</a></h1>\n<h2 id=\"classe--tray\"><a href=\"#classe--tray\">Classe : Tray</a></h2>\n<blockquote>\n<p>Ajoute des icônes et des menus contextuels à la zone de notification du système.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>Tray</code> est un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> tray = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/my/icon'</span>)\n  <span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item3'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item4'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n  ])\n  tray.setToolTip(<span class=\"hljs-string\">'This is my application.'</span>)\n  tray.setContextMenu(contextMenu)\n})\n</code></pre>\n<p><strong>Limitations selon les plateformes :</strong></p>\n<ul>\n<li>Sur Linux, l'indicateur d'application sera utilisé s'il est pris en charge, sinon <code>GtkStatusIcon</code> sera utilisé à la place.</li>\n<li>Sur les distributions Linux qui ont seulement le support de l'indicateur d'application, vous devrez installer <code>libappindicator1</code> pour faire fonctionner l'icône.</li>\n<li>L'indicateur d'application sera affiché seulement lorsqu'il a un menu contextuel.</li>\n<li>Lorsque l'indicateur d'application est utilisé sur Linux, l'événement <code>click</code> est ignoré.</li>\n<li>On Linux in order for changes made to individual <code>MenuItem</code>s to take effect, you have to call <code>setContextMenu</code> again. Par exemple :</li>\n</ul>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> appIcon = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/my/icon'</span>)\n  <span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n  ])\n\n  <span class=\"hljs-comment\">// Make a change to the context menu</span>\n  contextMenu.items[<span class=\"hljs-number\">1</span>].checked = <span class=\"hljs-literal\">false</span>\n\n  <span class=\"hljs-comment\">// Call this again for Linux because we modified the context menu</span>\n  appIcon.setContextMenu(contextMenu)\n})\n</code></pre>\n<ul>\n<li>Sur Windows, il est recommandé d'utiliser des icônes du type <code>ICO</code> pour obtenir les meilleurs effets visuels.</li>\n</ul>\n<p>Si vous souhaitez conserver les mêmes comportements sur toutes les plateformes, vous ne devriez pas vous appuyez sur l'événement <code>click</code> et toujours fixer un menu contextuel sur l'icône.</p>\n<h3 id=\"new-trayimage-guid\"><a href=\"#new-trayimage-guid\"><code>new Tray(image, [guid])</code></a></h3>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n<li><code>guid</code> String (optional) <em>Windows</em> - Assigns a GUID to the tray icon. If the executable is signed and the signature contains an organization in the subject line then the GUID is permanently associated with that signature. OS level settings like the position of the tray icon in the system tray will persist even if the path to the executable changes. If the executable is not code-signed then the GUID is permanently associated with the path to the executable. Changing the path to the executable will break the creation of the tray icon and a new GUID must be used. However, it is highly recommended to use the GUID parameter only in conjunction with code-signed executable. If an App defines multiple tray icons then each icon must use a separate GUID.</li>\n</ul>\n<p>Créer une nouvelle icône dans la barre de notification avec l'<code>image</code>.</p>\n<h3 id=\"événements-dinstance\"><a href=\"#événements-dinstance\">Événements d’instance</a></h3>\n<p>Le module <code>Tray</code> émet les événements suivants :</p>\n<h4 id=\"événement--click\"><a href=\"#événement--click\">Événement : 'click'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Les limites de l'icône.</li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - la position de l’événement.</li>\n</ul>\n<p>Émis lorsque l’utilisateur clique sur l’icône.</p>\n<h4 id=\"événement--right-click-macos-windows\"><a href=\"#événement--right-click-macos-windows\">Événement : 'right-click' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Les limites de l'icône.</li>\n</ul>\n<p>Émis lorsque l’utilisateur fait un clique droit sur l’icône.</p>\n<h4 id=\"événement--double-click-macos-windows\"><a href=\"#événement--double-click-macos-windows\">Événement : 'double-click' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Les limites de l'icône.</li>\n</ul>\n<p>Émis lorsque l’utilisateur double clique sur l’icône.</p>\n<h4 id=\"événement--balloon-show-windows\"><a href=\"#événement--balloon-show-windows\">Événement : 'balloon-show' <em>Windows</em></a></h4>\n<p>Émis lorsque le ballon de la barre d’État s’affiche.</p>\n<h4 id=\"événement--balloon-click-windows\"><a href=\"#événement--balloon-click-windows\">Événement : 'balloon-click' <em>Windows</em></a></h4>\n<p>Émis lorsque l’utilisateur clique sur le ballon de la barre d'État.</p>\n<h4 id=\"événement--balloon-closed-windows\"><a href=\"#événement--balloon-closed-windows\">Événement : 'balloon-closed' <em>Windows</em></a></h4>\n<p>Émis lorsque le ballon de la barre d’État est fermé en raison du délai d’attente dépassé ou de l’utilisateur le ferme manuellement.</p>\n<h4 id=\"événement--drop-macos\"><a href=\"#événement--drop-macos\">Événement : 'drop' <em>macOS</em></a></h4>\n<p>Émis lorsque un ou des éléments sont glissés et déposés sur l’icône.</p>\n<h4 id=\"événement--drop-files-macos\"><a href=\"#événement--drop-files-macos\">Événement : 'drop-files' <em>macOS</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>files</code> String[] - les chemins d’accès des fichiers déposés.</li>\n</ul>\n<p>Émis lorsque des fichiers sont glissés et déposés sur l’icône.</p>\n<h4 id=\"événement--drop-text-macos\"><a href=\"#événement--drop-text-macos\">Événement : 'drop-text' <em>macOS</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>text</code> String - le texte déposé.</li>\n</ul>\n<p>Émis lorsqu'un texte est déposé sur l’icône.</p>\n<h4 id=\"événement--drag-enter-macos\"><a href=\"#événement--drag-enter-macos\">Événement : 'drag-enter' <em>macOS</em></a></h4>\n<p>Émis lorsqu’une opération glisser entre dans la zone de l’icône.</p>\n<h4 id=\"événement--drag-leave-macos\"><a href=\"#événement--drag-leave-macos\">Événement : 'drag-leave' <em>macOS</em></a></h4>\n<p>Émis lorsqu’une opération glisser sort de la zone de l’icône.</p>\n<h4 id=\"événement--drag-end-macos\"><a href=\"#événement--drag-end-macos\">Événement : 'drag-end' <em>macOS</em></a></h4>\n<p>Émis lorsqu’une opération glisser se termine sur l'icône ou à un autre emplacement.</p>\n<h4 id=\"event-mouse-up-macos\"><a href=\"#event-mouse-up-macos\">Event: 'mouse-up' <em>macOS</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - la position de l’événement.</li>\n</ul>\n<p>Emitted when the mouse is released from clicking the tray icon.</p>\n<p>Note: This will not be emitted if you have set a context menu for your Tray using <code>tray.setContextMenu</code>, as a result of macOS-level constraints.</p>\n<h4 id=\"event-mouse-down-macos\"><a href=\"#event-mouse-down-macos\">Event: 'mouse-down' <em>macOS</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - la position de l’événement.</li>\n</ul>\n<p>Emitted when the mouse clicks the tray icon.</p>\n<h4 id=\"événement--mouse-enter-macos\"><a href=\"#événement--mouse-enter-macos\">Événement : 'mouse-enter' <em>macOS</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - la position de l’événement.</li>\n</ul>\n<p>Émis lorsque la souris entre dans la zone de l’icône.</p>\n<h4 id=\"événement--mouse-leave-macos\"><a href=\"#événement--mouse-leave-macos\">Événement : 'mouse-leave' <em>macOS</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - la position de l’événement.</li>\n</ul>\n<p>Émis lorsque la souris sort de la zone de l’icône.</p>\n<h4 id=\"event-mouse-move-macos-windows\"><a href=\"#event-mouse-move-macos-windows\">Event: 'mouse-move' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - la position de l’événement.</li>\n</ul>\n<p>Émis lorsque la souris bouge dans la zone de l’icône.</p>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<p>La classe <code>Tray</code> dispose des méthodes suivantes :</p>\n<h4 id=\"traydestroy\"><a href=\"#traydestroy\"><code>tray.destroy()</code></a></h4>\n<p>Détruit l’icône immédiatement.</p>\n<h4 id=\"traysetimageimage\"><a href=\"#traysetimageimage\"><code>tray.setImage(image)</code></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>Définit l’<code>image</code> associée à l'icône.</p>\n<h4 id=\"traysetpressedimageimage-macos\"><a href=\"#traysetpressedimageimage-macos\"><code>tray.setPressedImage(image)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>Définit l’<code>image</code> associée à l'icône quand elle est pressée sur macOS.</p>\n<h4 id=\"traysettooltiptooltip\"><a href=\"#traysettooltiptooltip\"><code>tray.setToolTip(toolTip)</code></a></h4>\n<ul>\n<li><code>toolTip</code> String</li>\n</ul>\n<p>Définit le texte au survol pour l'icône.</p>\n<h4 id=\"traysettitletitle-options-macos\"><a href=\"#traysettitletitle-options-macos\"><code>tray.setTitle(title[, options])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>title</code> String</li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>fontType</code> String (optional) - The font family variant to display, can be <code>monospaced</code> or <code>monospacedDigit</code>. <code>monospaced</code> is available in macOS 10.15+ and <code>monospacedDigit</code> is available in macOS 10.11+.  When left blank, the title uses the default system font.</li>\n</ul></li>\n</ul>\n<p>Définit le titre affiché à côté de l'icône de la barre d'état dans la barre d'état (couleurs support ANSI).</p>\n<h4 id=\"traygettitle-macos\"><a href=\"#traygettitle-macos\"><code>tray.getTitle()</code> <em>macOS</em></a></h4>\n<p>Retourne <code>String</code> - le titre affiché à côté de l'icône de la barre d'état</p>\n<h4 id=\"traysetignoredoubleclickeventsignore-macos\"><a href=\"#traysetignoredoubleclickeventsignore-macos\"><code>tray.setIgnoreDoubleClickEvents(ignore)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n</ul>\n<p>Sets the option to ignore double click events. Ignoring these events allows you to detect every individual click of the tray icon.</p>\n<p>Cette valeur est définie à &#x3C;0>false&#x3C;/0> par défaut.</p>\n<h4 id=\"traygetignoredoubleclickevents-macos\"><a href=\"#traygetignoredoubleclickevents-macos\"><code>tray.getIgnoreDoubleClickEvents()</code> <em>macOS</em></a></h4>\n<p>Retourne un <code>Boolean</code> - Si oui ou non les événènements de double clic seront ignorés.</p>\n<h4 id=\"traydisplayballoonoptions-windows\"><a href=\"#traydisplayballoonoptions-windows\"><code>tray.displayBalloon(options)</code> <em>Windows</em></a></h4>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (optional) - Icon to use when <code>iconType</code> is <code>custom</code>.</li>\n<li><code>iconType</code> String (optional) - Can be <code>none</code>, <code>info</code>, <code>warning</code>, <code>error</code> or <code>custom</code>. <code>custom</code> par défaut.</li>\n<li><code>title</code> String</li>\n<li><code>content</code> String</li>\n<li><code>largeIcon</code> Boolean (optional) - The large version of the icon should be used. La valeur par défaut est <code>vraie</code>. Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_large_icon-0x00000020\"><code>NIIF_LARGE_ICON</code></a>.</li>\n<li><code>noSound</code> Boolean (optional) - Do not play the associated sound. Par défaut la valeur est <code>false</code>. Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_nosound-0x00000010\"><code>NIIF_NOSOUND</code></a>.</li>\n<li><code>respectQuietTime</code> Boolean (optional) - Do not display the balloon notification if the current user is in \"quiet time\". Par défaut la valeur est <code>false</code>. Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_respect_quiet_time-0x00000080\"><code>NIIF_RESPECT_QUIET_TIME</code></a>.</li>\n</ul></li>\n</ul>\n<p>Affiche une bulle dans la barre d'État.</p>\n<h4 id=\"trayremoveballoon-windows\"><a href=\"#trayremoveballoon-windows\"><code>tray.removeBalloon()</code> <em>Windows</em></a></h4>\n<p>Removes a tray balloon.</p>\n<h4 id=\"trayfocus-windows\"><a href=\"#trayfocus-windows\"><code>tray.focus()</code> <em>Windows</em></a></h4>\n<p>Returns focus to the taskbar notification area. Notification area icons should use this message when they have completed their UI operation. For example, if the icon displays a shortcut menu, but the user presses ESC to cancel it, use <code>tray.focus()</code> to return focus to the notification area.</p>\n<h4 id=\"traypopupcontextmenumenu-position-macos-windows\"><a href=\"#traypopupcontextmenumenu-position-macos-windows\"><code>tray.popUpContextMenu([menu, position])</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>menu</code> Menu (facultatif)</li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> (facultatif) - Position du menu.</li>\n</ul>\n<p>Pops up the context menu of the tray icon. When <code>menu</code> is passed, the <code>menu</code> will be shown instead of the tray icon's context menu.</p>\n<p>La <code>position</code> n’est disponible que sur Windows, et c’est (0, 0) par défaut.</p>\n<h4 id=\"trayclosecontextmenu-macos-windows\"><a href=\"#trayclosecontextmenu-macos-windows\"><code>tray.closeContextMenu()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Closes an open context menu, as set by <code>tray.setContextMenu()</code>.</p>\n<h4 id=\"traysetcontextmenumenu\"><a href=\"#traysetcontextmenumenu\"><code>tray.setContextMenu(menu)</code></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Définit le menu contextuel de l'icône.</p>\n<h4 id=\"traygetbounds-macos-windows\"><a href=\"#traygetbounds-macos-windows\"><code>tray.getBounds()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Retourne <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>Les <code>limites</code> de l'icône de la barre d’État en tant qu'<code>Objet</code>.</p>\n<h4 id=\"trayisdestroyed\"><a href=\"#trayisdestroyed\"><code>tray.isDestroyed()</code></a></h4>\n<p>Retourne <code>Boolean</code> - si l’icône est détruite.</p>",
      "title": "Tray",
      "description": "Ajoute des icônes et des menus contextuels à la zone de notification du système."
    },
    "/docs/tutorial/tray": {
      "locale": "fr-FR",
      "slug": "tray",
      "href": "/docs/tutorial/tray",
      "crowdinFileId": "256259",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/tray.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<hr>\n<p>title: Tray\ndescription: Ce guide vous guidera tout au long du processus de création d’une icône de la barre d’état avec son propre menu contextuel dans la zone de notification du système.\nslug: tray</p>\n<h2 id=\"hide_title-true\"><a href=\"#hide_title-true\">hide_title: true</a></h2>\n<h1 id=\"tray\"><a href=\"#tray\">Tray</a></h1>\n<h2 id=\"vue-densemble\"><a href=\"#vue-densemble\">Vue d'ensemble</a></h2>\n<!-- ✍ Update this section if you want to provide more details -->\n<p>Ce guide vous guidera tout au long du processus de création d’une icône de la barre d’état <a href=\"https://www.electronjs.org/docs/api/tray\"></a>avec son propre menu contextuel dans la zone de notification du système.</p>\n<p>Sur MacOS et Ubuntu, la zone de notification sera située dans le coin supérieur droit de l'écran, à coté des icônes batterie et wifi. Sous Windows, la barre d'états se trouve généralement dans le coin inférieur droit.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<h3 id=\"mainjs\"><a href=\"#mainjs\">main.js</a></h3>\n<p>Nous devons d’abord importer <code>app</code>, <code>Tray</code>, <code>Menu</code>, <code>nativeImage</code> depuis <code>electron</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, Tray, Menu, nativeImage } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>Ensuite, nous allons créer notre Tray. Pour ce faire, nous utiliserons une icône <a href=\"https://www.electronjs.org/docs/api/native-image\"><code>NativeImage</code></a> , qui peut être créée via l’une de ces <a href=\"https://www.electronjs.org/docs/api/native-image#methods\">méthodes</a>. Notez que nous encapsulons notre code de création du Tray dans un <a href=\"https://www.electronjs.org/docs/api/app#appwhenready\"><code>app.whenReady</code></a> car nous devrons attendre que notre application electron termine de s'initialiser.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">let</span> tray\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> icon = nativeImage.createFromPath(<span class=\"hljs-string\">'path/to/asset.png'</span>)\n  tray = <span class=\"hljs-keyword\">new</span> Tray(icon)\n\n  <span class=\"hljs-comment\">// note: votre code contextMenu, Tooltip and Title ira ici!</span>\n})\n</code></pre>\n<p>Génial! Maintenant nous pouvons commencer à attacher un menu contextuel à notre Tray, comme ceci:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item3'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item4'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n])\n\ntray.setContextMenu(contextMenu)\n</code></pre>\n<p>Le code ci-dessus créera 4 éléments distincts de type radio dans le menu contextuel. Pour en savoir plus sur la création de menus natifs, cliquez sur ce lien <a href=\"https://www.electronjs.org/docs/api/menu#menubuildfromtemplatetemplate\">ici</a>.</p>\n<p>Enfin, donnons à notre barre d’états une infobulle et un titre.</p>\n<pre><code class=\"hljs language-js\">tray.setToolTip(<span class=\"hljs-string\">'Ceci est mon application'</span>)\ntray.setTitle(<span class=\"hljs-string\">'Ceci est mon titre'</span>)\n</code></pre>\n<h2 id=\"conclusion\"><a href=\"#conclusion\">Conclusion</a></h2>\n<p>Après avoir démarré votre application electron, vous devriez voir le Tray placé en soit haut soit en bas à droite de votre écran, selon votre système d'exploitation.\n<code>fiddle docs/fiddles/native-ui/tray</code></p>",
      "title": "Tray",
      "description": ""
    },
    "/docs/tutorial/updates": {
      "locale": "fr-FR",
      "slug": "updates",
      "href": "/docs/tutorial/updates",
      "crowdinFileId": "256261",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/updates.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"mise-à-jour-dune-application\"><a href=\"#mise-à-jour-dune-application\">Mise à jour d'une application</a></h1>\n<p>Il y a plusieurs méthodes pour mettre à jour une application Electron. La plus simple, et celle qui est officiellement supportée, tire parti de l'intégration du framework <a href=\"https://github.com/Squirrel\">Squirrel</a> et du module <a href=\"/docs/api/auto-updater\">autoUpdater</a> d'Electron.</p>\n<h2 id=\"utilisation-de-updateelectronjsorg\"><a href=\"#utilisation-de-updateelectronjsorg\">Utilisation de <code>update.electronjs.org</code></a></h2>\n<p>The Electron team maintains <a href=\"https://github.com/electron/update.electronjs.org\">update.electronjs.org</a>, a free and open-source webservice that Electron apps can use to self-update. Ce service est conçu pour les applications Electron répondant aux critères suivant:</p>\n<ul>\n<li>L'application tourne sous macOs ou Windows</li>\n<li>L'application a un répertoire GitHub public</li>\n<li>Les livrables sont publiés en tant que release sous Github</li>\n<li>Les livrables sont signés</li>\n</ul>\n<p>La façon la plus simple d'utiliser ce service est d'installer <a href=\"https://github.com/electron/update-electron-app\">update-electron-app</a>, un module Node.js pré-configuré pour être utilisé avec update.electronjs.org.</p>\n<p>Installer le module:</p>\n<pre><code class=\"hljs language-sh\">npm install update-electron-app\n</code></pre>\n<p>Déclenchez la mise à jour à partir du processus principal de votre application :</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'update-electron-app'</span>)()\n</code></pre>\n<p>Par défaut, ce module vérifiera les mises à jour au démarrage de l'application, toutes les dix- minutes. Lorsqu’une mise à jour est trouvée, elle sera automatiquement téléchargée en arrière-plan. Une fois le téléchargement terminé, une boîte de dialogue s’affiche permettant à l’utilisateur de redémarrer l’application.</p>\n<p>Si vous avez besoin personnaliser votre configuration, vous pouvez <a href=\"https://github.com/electron/update-electron-app\">passer des paramètres à <code>update-electron-app</code></a> ou <a href=\"https://github.com/electron/update.electronjs.org\">utiliser le service de mise à jour directement</a>.</p>\n<h2 id=\"déploiement-dun-serveur-de-mise-à-jour\"><a href=\"#déploiement-dun-serveur-de-mise-à-jour\">Déploiement d’un serveur de mise à jour</a></h2>\n<p>Si vous développez une application Electron privée, ou si vous ne publiez pas votre application sous GitHub, il peut être nécessaire de mettre en place votre propre serveur de mise à jour.</p>\n<p>Selon vos besoins, vous pouvez choisir parmi l'un d'entre eux :</p>\n<ul>\n<li><a href=\"https://github.com/vercel/hazel\">Hazel</a> - Serveur de mise à jour pour les applications privées ou open source qui peuvent être déployées gratuitement sur <a href=\"https://vercel.com\">Vercel</a>. Cela récupère les <a href=\"https://help.github.com/articles/creating-releases/\">releases GitHub</a> et exploite la puissance du CDN de GitHub.</li>\n<li><a href=\"https://github.com/GitbookIO/nuts\">Nuts</a> – Utilise aussi les <a href=\"https://help.github.com/articles/creating-releases/\">releases GitHub</a>, mais met en cache les mises à jour des applications sur le disque et prend en charge les dépôts privés.</li>\n<li><a href=\"https://github.com/ArekSredzki/electron-release-server\">electron-release-server</a> – Fournit un tableau de bord pour la gestion des releases et n'exige pas que les releases soient créés sur GitHub.</li>\n<li><a href=\"https://github.com/atlassian/nucleus\">Nucleus</a> – Un serveur de mise à jour complet pour les applications Electron maintenues par Atlassian. Prend en charge plusieurs applications et canaux; utilise un magasin de fichiers statique pour minimiser le coût du serveur.</li>\n</ul>\n<h2 id=\"implémentation-des-mises-à-jour-dans-votre-application\"><a href=\"#implémentation-des-mises-à-jour-dans-votre-application\">Implémentation des mises à jour dans votre application</a></h2>\n<p>Une fois que vous avez déployé votre serveur de mise à jour, continuez d'importer les modules requis dans votre code. Le code suivant peut varier pour les différents serveurs, mais il fonctionne comme décrit lors de l'utilisation de <a href=\"https://github.com/vercel/hazel\">Hazel</a>.</p>\n<p><strong>Important :</strong> Veuillez vous assurer que le code ci-dessous sera exécuté uniquement dans votre application empaquetée, et non dans la version en développement. Vous pouvez utiliser <a href=\"https://github.com/sindresorhus/electron-is-dev\">electron-is-dev</a> pour vérifier l'environnement.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, autoUpdater, dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>Ensuite, construisez l'URL du serveur de mise à jour et informez-en <a href=\"/docs/api/auto-updater\">autoUpdater</a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> server = <span class=\"hljs-string\">'https://your-deployment-url.com'</span>\n<span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-string\">`<span class=\"hljs-subst\">${server}</span>/update/<span class=\"hljs-subst\">${process.platform}</span>/<span class=\"hljs-subst\">${app.getVersion()}</span>`</span>\n\nautoUpdater.setFeedURL({ url })\n</code></pre>\n<p>Comme dernière étape, vérifiez les mises à jour. L'exemple ci-dessous vérifiera chaque minute:</p>\n<pre><code class=\"hljs language-javascript\">setInterval(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  autoUpdater.checkForUpdates()\n}, <span class=\"hljs-number\">60000</span>)\n</code></pre>\n<p>Une fois que votre application est <a href=\"/docs/tutorial/application-distribution\">empaquetée</a>, elle recevra une mise à jour pour chaque nouvelle <a href=\"https://help.github.com/articles/creating-releases/\">version GitHub</a> que vous publierez.</p>\n<h2 id=\"application-des-mises-à-jour\"><a href=\"#application-des-mises-à-jour\">Application des mises à jour</a></h2>\n<p>Maintenant que vous avez configuré le mécanisme de mise à jour de base de votre application, vous devez vous assurer que l’utilisateur sera notifié quand il y a une mise à jour. Cela peut être réalisé avec les <a href=\"/docs/api/auto-updater#events\">événements</a> de l'API autoUpdater:</p>\n<pre><code class=\"hljs language-javascript\">autoUpdater.on(<span class=\"hljs-string\">'update-downloaded'</span>, (event, releaseNotes, releaseName) => {\n  <span class=\"hljs-keyword\">const</span> dialogOpts = {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'info'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Restart'</span>, <span class=\"hljs-string\">'Later'</span>],\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Application Update'</span>,\n    <span class=\"hljs-attr\">message</span>: process.platform === <span class=\"hljs-string\">'win32'</span> ? releaseNotes : releaseName,\n    <span class=\"hljs-attr\">detail</span>: <span class=\"hljs-string\">\"A new version has been downloaded. Restart the application to apply the updates.'\n  }\n\n  dialog.showMessageBox(dialogOpts).then((returnValue) => {\n    if (returnValue.response === 0) autoUpdater.quitAndInstall()\n  })\n})\n</span></code></pre>\n<p>Assurez-vous également que les erreurs sont <a href=\"/docs/api/auto-updater#event-error\">gérées</a>. Voici un exemple pour les renvoyer sur <code>stderr</code>:</p>\n<pre><code class=\"hljs language-javascript\">autoUpdater.on(<span class=\"hljs-string\">'error'</span>, message => {\n  <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'There was a problem updating the application'</span>)\n  <span class=\"hljs-built_in\">console</span>.error(message)\n})\n</code></pre>\n<h2 id=\"gestion-manuelle-des-mises-à-jour\"><a href=\"#gestion-manuelle-des-mises-à-jour\">Gestion manuelle des mises à jour</a></h2>\n<p>Because the requests made by Auto Update aren't under your direct control, you may find situations that are difficult to handle (such as if the update server is behind authentication). The <code>url</code> field does support files, which means that with some effort, you can sidestep the server-communication aspect of the process. <a href=\"https://github.com/electron/electron/issues/5020#issuecomment-477636990\">Here's an example of how this could work</a>.</p>",
      "title": "Mise à jour d'une application",
      "description": ""
    },
    "/docs/api/structures/upload-data": {
      "locale": "fr-FR",
      "slug": "upload-data",
      "href": "/docs/api/structures/upload-data",
      "crowdinFileId": "256523",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploaddata-object\"><a href=\"#uploaddata-object\">UploadData Object</a></h1>\n<ul>\n<li><code>bytes</code> Buffer - Content being sent.</li>\n<li><code>file</code> String (optional) - Path of file being uploaded.</li>\n<li><code>blobUUID</code> String (optional) - UUID of blob data. Use <a href=\"/docs/api/session#sesgetblobdataidentifier\">ses.getBlobData</a> method to retrieve the data.</li>\n</ul>",
      "title": "UploadData Object",
      "description": ""
    },
    "/docs/api/structures/upload-file": {
      "locale": "fr-FR",
      "slug": "upload-file",
      "href": "/docs/api/structures/upload-file",
      "crowdinFileId": "256525",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-file.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploadfile-object\"><a href=\"#uploadfile-object\">UploadFile Object</a></h1>\n<ul>\n<li><code>type</code> 'file' - <code>file</code>.</li>\n<li><code>filePath</code> String - Path of file to be uploaded.</li>\n<li><code>offset</code> Integer - Defaults to <code>0</code>.</li>\n<li><code>length</code> Integer - Number of bytes to read from <code>offset</code>. Defaults to <code>0</code>.</li>\n<li><code>modificationTime</code> Double - Last Modification time in number of seconds since the UNIX epoch.</li>\n</ul>",
      "title": "UploadFile Object",
      "description": ""
    },
    "/docs/api/structures/upload-raw-data": {
      "locale": "fr-FR",
      "slug": "upload-raw-data",
      "href": "/docs/api/structures/upload-raw-data",
      "crowdinFileId": "256527",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-raw-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploadrawdata-object\"><a href=\"#uploadrawdata-object\">UploadRawData Object</a></h1>\n<ul>\n<li><code>type</code> 'rawData' - <code>rawData</code>.</li>\n<li><code>bytes</code> Buffer - Data to be uploaded.</li>\n</ul>",
      "title": "UploadRawData Object",
      "description": ""
    },
    "/docs/api/structures/user-default-types": {
      "locale": "fr-FR",
      "slug": "user-default-types",
      "href": "/docs/api/structures/user-default-types",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/user-default-types.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"userdefaulttypes-object\"><a href=\"#userdefaulttypes-object\">UserDefaultTypes Object</a></h1>\n<ul>\n<li><code>string</code> String</li>\n<li><code>boolean</code> Boolean</li>\n<li><code>integer</code> Number</li>\n<li><code>float</code> Number</li>\n<li><code>double</code> Number</li>\n<li><code>url</code> String</li>\n<li><code>array</code> Array\\<unknown></unknown></li>\n<li>Enregistrement <code>dictionary</code>\\&#x3C;string, unknown></li>\n</ul>\n<p>This type is a helper alias, no object will never exist of this type.</p>",
      "title": "UserDefaultTypes Object",
      "description": ""
    },
    "/docs/tutorial/using-native-node-modules": {
      "locale": "fr-FR",
      "slug": "using-native-node-modules",
      "href": "/docs/tutorial/using-native-node-modules",
      "crowdinFileId": "256263",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-native-node-modules.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"modules-natifs-de-node\"><a href=\"#modules-natifs-de-node\">Modules natifs de Node</a></h1>\n<p>Native Node.js modules are supported by Electron, but since Electron has a different <a href=\"https://en.wikipedia.org/wiki/Application_binary_interface\">application binary interface (ABI)</a> from a given Node.js binary (due to differences such as using Chromium's BoringSSL instead of OpenSSL), the native modules you use will need to be recompiled for Electron. Sinon, vous obtiendrez l'erreur de classe suivante lorsque vous essaierez d'exécuter votre application :</p>\n<pre><code class=\"hljs language-sh\">Erreur : Le module <span class=\"hljs-string\">'/path/to/native/module.node'</span>\na été compilé avec une version de Node.js différente en utilisant\nNODE_MODULE_VERSION <span class=\"hljs-variable\">$XYZ</span>. Cette version de Node.js nécessite\nNODE_MODULE_VERSION <span class=\"hljs-variable\">$ABC</span>. Veuillez essayer de re-compiler ou de réinstaller\nle module (par exemple, en utilisant `npm rebuild` ou `npm install`).\n</code></pre>\n<h2 id=\"comment-installer-des-modules-natifs\"><a href=\"#comment-installer-des-modules-natifs\">Comment installer des modules natifs</a></h2>\n<p>Il y a plusieurs façons d'installer des modules natifs :</p>\n<h3 id=\"installation-et-compilation-de-modules-pour-electron\"><a href=\"#installation-et-compilation-de-modules-pour-electron\">Installation et compilation de modules pour Electron</a></h3>\n<p>Vous pouvez choisir d'installer les modules comme les autres projets Node, puis recompiler les modules pour Electron avec le paquet <a href=\"https://github.com/electron/electron-rebuild\"><code>electron-rebuild</code></a>. Ce module peut automatiquement obtenir la version d'Electron et gérer les étapes manuelles de téléchargement des en-têtes, compiler les modules natifs pour votre application. If you are using <a href=\"https://electronforge.io/\">Electron Forge</a>, this tool is used automatically in both development mode and when making distributables.</p>\n<p>For example, to install the standalone <code>electron-rebuild</code> tool and then rebuild modules with it via the command line:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron-rebuild\n\n<span class=\"hljs-comment\"># Every time you run \"npm install\", run this:</span>\n./node_modules/.bin/electron-rebuild\n\n<span class=\"hljs-comment\"># If you have trouble on Windows, try:</span>\n.\\node_modules\\.bin\\electron-rebuild.cmd\n</code></pre>\n<p>For more information on usage and integration with other tools such as <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a>, consult the project's README.</p>\n<h3 id=\"à-laide-de-npm\"><a href=\"#à-laide-de-npm\">À l'aide de <code>npm</code></a></h3>\n<p>En définissant quelques variables d’environnement, vous pouvez utiliser <code>npm</code> pour installer des modules directement.</p>\n<p>Par exemple, pour installer toutes les dépendances d'Electron :</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-comment\"># Version d'Electron.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_target=1.2.3\n<span class=\"hljs-comment\"># L'architecture d'Electron, consultez</span>\nhttps://electronjs.org/docs/tutorial/support<span class=\"hljs-comment\">#supported-platforms</span>\n<span class=\"hljs-comment\"># pour les architectures prises en charge.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_arch=x64\n<span class=\"hljs-built_in\">export</span> npm_config_target_arch=x64\n<span class=\"hljs-comment\"># Télécharge les en-têtes pour Electron.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_disturl=https://electronjs.org/headers\n<span class=\"hljs-comment\"># Indique à node-pre-gyp que l'on compile pour Electron.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_runtime=electron\n<span class=\"hljs-comment\"># Indique à node-pre-gyp de compiler les modules depuis leur code source.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_build_from_source=<span class=\"hljs-literal\">true</span>\n<span class=\"hljs-comment\"># Installe toutes les dépendances, et met en cache à ~/.electron-gyp.</span>\nHOME=~/.electron-gyp npm install\n</code></pre>\n<h3 id=\"compilation-manuelle-pour-electron\"><a href=\"#compilation-manuelle-pour-electron\">Compilation manuelle pour Electron</a></h3>\n<p>Si vous êtes un développeur développant un module natif et que vous voulez le tester avec Electron, vous pouvez recompiler le module pour Electron manuellement. Vous pouvez utiliser <code>node-gyp</code> directement pour compiler pour Electron:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">cd</span> /path-to-module/\nHOME=~/.electron-gyp node-gyp rebuild --target=1.2.3 --arch=x64 --dist-url=https://electronjs.org/headers\n</code></pre>\n<ul>\n<li><code>HOME=~/.electron-gyp</code> indique où trouver les en-têtes pour le développement.</li>\n<li><code>--target=1.2.3</code> est la version d'Electron.</li>\n<li><code>--dist-url=...</code> indique où télécharger les en-têtes.</li>\n<li><code>--arch=x64</code> spécifie que le module est prévu pour un système 64 bits.</li>\n</ul>\n<h3 id=\"compilation-manuelle-pour-une-compilation-personnalisée-delectron\"><a href=\"#compilation-manuelle-pour-une-compilation-personnalisée-delectron\">Compilation manuelle pour une compilation personnalisée d'Electron</a></h3>\n<p>Pour compiler des modules Node natifs avec une compilation personnalisée d'Electron qui ne correspond pas à une release publique, utilisez la commande <code>npm</code> pour utiliser la version de Node que vous avez empaquetée avec votre compilation personnalisée.</p>\n<pre><code class=\"hljs language-sh\">npm rebuild --nodedir=/path/to/src/out/Default/gen/node_headers\n</code></pre>\n<h2 id=\"résolution-de-problème\"><a href=\"#résolution-de-problème\">Résolution de problème</a></h2>\n<p>Si vous avez installé un module natif et trouvé que cela ne fonctionnait pas, vous devez vérifier ces éléments suivants :</p>\n<ul>\n<li>En cas de doute, exécutez d'abord <code>electron-rebuild</code>.</li>\n<li>Assurez-vous que le module natif est compatible avec la plateforme cible et l'architecture pour votre application Electron.</li>\n<li>Assurez-vous que <code>win_delay_load_hook</code> n'est pas défini comme <code>false</code> dans le module <code>binding.gyp</code>.</li>\n<li>Après avoir mise à jour Electron, vous devez habituellement recompiler les modules.</li>\n</ul>\n<h3 id=\"une-remarque-sur-win_delay_load_hook\"><a href=\"#une-remarque-sur-win_delay_load_hook\">Une remarque sur <code>win_delay_load_hook</code></a></h3>\n<p>Sur Windows, par défaut, <code>node-gyp</code> relie les modules natifs à <code>node.dll</code>. Cependant, dans Electron 4.x et supérieur, les symboles nécessaires aux modules natifs sont exportés par <code>electron.exe</code>, et <code>node.dll</code> n'existe pas. Afin de charger les modules natifs sous Windows, <code>node-gyp</code> installe un <a href=\"https://msdn.microsoft.com/en-us/library/z9h1h6ty.aspx\">delay-load hoook</a> qui déclenche lorsque le module natif est chargé, et redirige le <code>noeud. la référence ll</code> pour utiliser l'exécutable de chargement au lieu de rechercher <code>node.dll</code> dans le chemin de la recherche de bibliothèque (qui n'afficherait rien). Ainsi, sur Electron 4.x et supérieur, <code>'win_delay_load_hook' : 'true'</code> est requis pour charger les modules natifs.</p>\n<p>Si vous obtenez une erreur comme <code>Module ne s'est pas auto-enregistré</code>, ou <code>La procédure spécifiée n'a pas pu être trouvée</code>, cela peut signifier que le module que vous essayez d'utiliser n'a pas inclus correctement le crochet de chargement de retard.  Si le module est construit avec node-gyp, assurez-vous que la variable <code>win_delay_load_hook</code> est définie à <code>true</code> dans la liaison <code>. fichier yp</code> et ne se fait pas écrasé partout.  Si le module est construit avec un autre système, vous devrez vous assurer que vous construisez avec un crochet de chargement tardif installé dans le <code> principal. fichier ode</code>. Votre invocation <code>link.exe</code> devrait ressembler à ceci :</p>\n<pre><code class=\"hljs language-plaintext\"> link.exe /OUT:\"foo.node\" \"...\\node.lib\" delayimp.lib /DELAYLOAD:node.exe /DLL\n     \"my_addon.obj\" \"win_delay_load_hook.obj\"\n</code></pre>\n<p>En particulier, il est important que :</p>\n<ul>\n<li>you link against <code>node.lib</code> from <em>Electron</em> and not Node. If you link against the wrong <code>node.lib</code> you will get load-time errors when you require the module in Electron.</li>\n<li>vous incluez le drapeau <code>/DELAYLOAD:node.exe</code>. Si le <code>noeud. Le lien xe</code> n'est pas retardé, alors le crochet de chargement de temps n'aura pas de chance de tirer et les symboles du noeud ne seront pas correctement résolus.</li>\n<li><code>win_delay_load_hook.obj</code> is linked directly into the final DLL. If the hook is set up in a dependent DLL, it won't fire at the right time.</li>\n</ul>\n<p>Voir <a href=\"https://github.com/nodejs/node-gyp/blob/e2401e1395bef1d3c8acec268b42dc5fb71c4a38/src/win_delay_load_hook.cc\"><code>node-gyp</code></a> pour un exemple de Hook de chargement à retardement si vous implémentez le vôtre.</p>\n<h2 id=\"les-modules-sappuyant-sur-prebuild\"><a href=\"#les-modules-sappuyant-sur-prebuild\">Les modules s'appuyant sur <code>prebuild</code></a></h2>\n<p><a href=\"https://github.com/prebuild/prebuild\"><code>prebuild</code></a> permet de publier facilement des modules natifs Node avec des binaires précompilés pour plusieurs version de Node et d'Electron.</p>\n<p>If the <code>prebuild</code>-powered module provide binaries for the usage in Electron, make sure to omit <code>--build-from-source</code> and the <code>npm_config_build_from_source</code> environment variable in order to take full advantage of the prebuilt binaries.</p>\n<h2 id=\"les-modules-sappuyant-sur-node-pre-gyp\"><a href=\"#les-modules-sappuyant-sur-node-pre-gyp\">Les modules s'appuyant sur <code>node-pre-gyp</code></a></h2>\n<p><a href=\"https://github.com/mapbox/node-pre-gyp\"><code>node-pre-gyp</code> tool</a> fournit un moyen de déployer des modules natifs Node avec des binaires précompilés, beaucoup de modules populaires l'utilisent.</p>\n<p>Sometimes those modules work fine under Electron, but when there are no Electron-specific binaries available, you'll need to build from source. Because of this, it is recommended to use <code>electron-rebuild</code> for these modules.</p>\n<p>If you are following the <code>npm</code> way of installing modules, you'll need to pass <code>--build-from-source</code> to <code>npm</code>, or set the <code>npm_config_build_from_source</code> environment variable.</p>",
      "title": "Modules natifs de Node",
      "description": ""
    },
    "/docs/tutorial/using-pepper-flash-plugin": {
      "locale": "fr-FR",
      "slug": "using-pepper-flash-plugin",
      "href": "/docs/tutorial/using-pepper-flash-plugin",
      "crowdinFileId": "256265",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-pepper-flash-plugin.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"plugin-pepper-flash\"><a href=\"#plugin-pepper-flash\">Plugin Pepper Flash</a></h1>\n<p>Electron no longer supports the Pepper Flash plugin, as Chrome has removed support.</p>\n<p>See <a href=\"https://www.chromium.org/flash-roadmap\">Chromium's Flash Roadmap</a> for more details.</p>",
      "title": "Plugin Pepper Flash",
      "description": ""
    },
    "/docs/tutorial/using-selenium-and-webdriver": {
      "locale": "fr-FR",
      "slug": "using-selenium-and-webdriver",
      "href": "/docs/tutorial/using-selenium-and-webdriver",
      "crowdinFileId": "256267",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-selenium-and-webdriver.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"selenium-et-webdriver\"><a href=\"#selenium-et-webdriver\">Selenium et WebDriver</a></h1>\n<p>De <a href=\"https://sites.google.com/a/chromium.org/chromedriver/\">ChromeDriver - WebDriver pour Chrome</a> :</p>\n<blockquote>\n<p>WebDriver est un outil open source pour les tests automatisés d'applications web sur plusieurs navigateurs. Il fournit des fonctions pour naviguer vers les pages web, simuler l'input utilisateur, l’exécution de JavaScript, etc... . ChromeDriver est un serveur autonome qui implémente le protocole de WebDriver (WebDriver's wire protocol) pour Chromium. Il est développé par des membres des équipes chrome et WebDriver.</p>\n</blockquote>\n<h2 id=\"mise-en-place-de-spectron\"><a href=\"#mise-en-place-de-spectron\">Mise en place de Spectron</a></h2>\n<p><a href=\"https://electronjs.org/spectron\">Spectron</a> est le framework ChromeDriver de test officiel pour Electron. Il est basé sur <a href=\"https://webdriver.io/\">WebdriverIO</a> et a des helpers pour accéder aux APIS d'Electron dans vos tests et bundles ChromeDriver.</p>\n<pre><code class=\"hljs language-sh\">$ npm install --save-dev spectron\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Un test simple pour vérifier si une fenêtre visible est ouverte avec un titre</span>\n<span class=\"hljs-keyword\">const</span> Application = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spectron'</span>).Application\n<span class=\"hljs-keyword\">const</span> assert = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'assert'</span>)\n\n<span class=\"hljs-keyword\">const</span> myApp = <span class=\"hljs-keyword\">new</span> Application({\n  <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'/Applications/MyApp.app/Contents/MacOS/MyApp'</span>\n})\n\n<span class=\"hljs-keyword\">const</span> verifyWindowIsVisibleWithTitle = <span class=\"hljs-keyword\">async</span> (app) => {\n  <span class=\"hljs-keyword\">await</span> app.start()\n  <span class=\"hljs-keyword\">try</span> {\n    <span class=\"hljs-comment\">// Vérifie si la fenêtre est visible</span>\n    <span class=\"hljs-keyword\">const</span> isVisible = <span class=\"hljs-keyword\">await</span> app.browserWindow.isVisible()\n    assert.strictEqual(isVisible, <span class=\"hljs-literal\">true</span>)\n    <span class=\"hljs-comment\">// Récupère le titre de la fenêtre</span>\n    <span class=\"hljs-keyword\">const</span> title = <span class=\"hljs-keyword\">await</span> app.client.getTitle()\n    <span class=\"hljs-comment\">// Vérifie le titre de la fenêtre</span>\n    assert.strictEqual(title, <span class=\"hljs-string\">'My App'</span>)\n  } <span class=\"hljs-keyword\">catch</span> (error) {\n    <span class=\"hljs-comment\">// Note toute erreur rencontrée</span>\n    <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Test failed'</span>, error.message)\n  }\n  <span class=\"hljs-comment\">// Arrête l'application</span>\n  <span class=\"hljs-keyword\">await</span> app.stop()\n}\n\nverifyWindowIsVisibleWithTitle(myApp)\n</code></pre>\n<h2 id=\"mise-en-place-avec-webdriverjs\"><a href=\"#mise-en-place-avec-webdriverjs\">Mise en place avec WebdriverJs</a></h2>\n<p><a href=\"https://www.selenium.dev/selenium/docs/api/javascript/index.html\">WebDriverJs</a> provides a Node package for testing with web driver, we will use it as an example.</p>\n<h3 id=\"1-start-chromedriver\"><a href=\"#1-start-chromedriver\">1. Start ChromeDriver</a></h3>\n<p>Tout d’abord, téléchargez <code>chromedriver</code>, puis exécutez-le :</p>\n<pre><code class=\"hljs language-sh\">$ npm install electron-chromedriver\n$ ./node_modules/.bin/chromedriver\nDémarre ChromeDriver (v2.10.291558) sur le port 9515\nSeulement les connexions locales sont autorisées.\n</code></pre>\n<p>N'oubliez pas le numéro du port <code>9515</code>, qui servira plus tard</p>\n<h3 id=\"2-install-webdriverjs\"><a href=\"#2-install-webdriverjs\">2. Install WebDriverJS</a></h3>\n<pre><code class=\"hljs language-sh\">$ npm install selenium-webdriver\n</code></pre>\n<h3 id=\"3-connect-to-chromedriver\"><a href=\"#3-connect-to-chromedriver\">3. Connect to ChromeDriver</a></h3>\n<p>L’utilisation de <code> selenium-webdriver</code> avec Electron est pratiquement la même chose qu'avec upstream, sauf que vous devez spécifier manuellement comment connecter le driver chrome et où trouver le fichier binaire d'Electron :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webdriver = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'selenium-webdriver'</span>)\n\n<span class=\"hljs-keyword\">const</span> driver = <span class=\"hljs-keyword\">new</span> webdriver.Builder()\n  <span class=\"hljs-comment\">// \"9515\" est le port ouvert par ChromeDriver.</span>\n  .usingServer(<span class=\"hljs-string\">'http://localhost:9515'</span>)\n  .withCapabilities({\n    <span class=\"hljs-string\">'goog:chromeOptions'</span>: {\n      <span class=\"hljs-comment\">// Here is the path to your Electron binary.</span>\n      <span class=\"hljs-attr\">binary</span>: <span class=\"hljs-string\">'/Path-to-Your-App.app/Contents/MacOS/Electron'</span>\n    }\n  })\n  .forBrowser(<span class=\"hljs-string\">'chrome'</span>) <span class=\"hljs-comment\">// note: use .forBrowser('electron') for selenium-webdriver &#x3C;= 3.6.0</span>\n  .build()\n\ndriver.get(<span class=\"hljs-string\">'http://www.google.com'</span>)\ndriver.findElement(webdriver.By.name(<span class=\"hljs-string\">'q'</span>)).sendKeys(<span class=\"hljs-string\">'webdriver'</span>)\ndriver.findElement(webdriver.By.name(<span class=\"hljs-string\">'btnG'</span>)).click()\ndriver.wait(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">return</span> driver.getTitle().then(<span class=\"hljs-function\">(<span class=\"hljs-params\">title</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> title === <span class=\"hljs-string\">'webdriver - Google Search'</span>\n  })\n}, <span class=\"hljs-number\">1000</span>)\n\ndriver.quit()\n</code></pre>\n<h2 id=\"mise-en-place-avec-webdriverio\"><a href=\"#mise-en-place-avec-webdriverio\">Mise en place avec WebdriverIO</a></h2>\n<p><a href=\"https://webdriver.io/\">WebdriverIO</a> provides a Node package for testing with web driver.</p>\n<h3 id=\"1-start-chromedriver-1\"><a href=\"#1-start-chromedriver-1\">1. Start ChromeDriver</a></h3>\n<p>Tout d’abord, téléchargez <code>chromedriver</code>, puis exécutez-le :</p>\n<pre><code class=\"hljs language-sh\">$ npm install electron-chromedriver\n$ ./node_modules/.bin/chromedriver --url-base=wd/hub --port=9515\nDemarre ChromeDriver (v2.10.291558) sur le port 9515\nSeulement les connexions locales sont autorisées.\n</code></pre>\n<p>N'oubliez pas le numéro du port <code>9515</code>, qui servira plus tard</p>\n<h3 id=\"2-install-webdriverio\"><a href=\"#2-install-webdriverio\">2. Install WebdriverIO</a></h3>\n<pre><code class=\"hljs language-sh\">$ npm install webdriverio\n</code></pre>\n<h3 id=\"3-connect-to-chrome-driver\"><a href=\"#3-connect-to-chrome-driver\">3. Connect to chrome driver</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webdriverio = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'webdriverio'</span>)\n<span class=\"hljs-keyword\">const</span> options = {\n  <span class=\"hljs-attr\">host</span>: <span class=\"hljs-string\">'localhost'</span>, <span class=\"hljs-comment\">// Utilisez localhost comme serveur ChromeDriver</span>\n  <span class=\"hljs-attr\">port</span>: <span class=\"hljs-number\">9515</span>,        <span class=\"hljs-comment\">// \"9515\" est le port ouvert par ChromeDriver.</span>\n  <span class=\"hljs-attr\">desiredCapabilities</span>: {\n    <span class=\"hljs-attr\">browserName</span>: <span class=\"hljs-string\">'chrome'</span>,\n    <span class=\"hljs-attr\">chromeOptions</span>: {\n      <span class=\"hljs-attr\">binary</span>: <span class=\"hljs-string\">'/Path-to-Your-App/electron'</span>, <span class=\"hljs-comment\">// Chemin vers votre binaire Electron.</span>\n      <span class=\"hljs-attr\">args</span>: [<span class=\"hljs-comment\">/* cli arguments */</span>] <span class=\"hljs-comment\">// Optional, perhaps 'app=' + /path/to/your/app/</span>\n    }\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> client = webdriverio.remote(options)\n\nclient\n  .init()\n  .url(<span class=\"hljs-string\">'http://google.com'</span>)\n  .setValue(<span class=\"hljs-string\">'#q'</span>, <span class=\"hljs-string\">'webdriverio'</span>)\n  .click(<span class=\"hljs-string\">'#btnG'</span>)\n  .getTitle().then(<span class=\"hljs-function\">(<span class=\"hljs-params\">title</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Title was: '</span> + title)\n  })\n  .end()\n</code></pre>\n<h2 id=\"workflow\"><a href=\"#workflow\">Workflow</a></h2>\n<p>Pour tester votre application sans re-compiler Electron, il suffit de <a href=\"/docs/tutorial/application-distribution\">placer</a> la source de votre app dans le dossier des ressources d'Electron.</p>\n<p>Alternatively, pass an argument to run with your Electron binary that points to your app's folder. This eliminates the need to copy-paste your app into Electron's resource directory.</p>",
      "title": "Selenium et WebDriver",
      "description": "WebDriver est un outil open source pour les tests automatisés d'applications web sur plusieurs navigateurs. Il fournit des fonctions pour naviguer vers les pages web, simuler l'input utilisateur, l’exécution de JavaScript, etc... . ChromeDriver est un serveur autonome qui implémente le protocole de WebDriver (WebDriver's wire protocol) pour Chromium. Il est développé par des membres des équipes chrome et WebDriver."
    },
    "/docs/development/v8-development": {
      "locale": "fr-FR",
      "slug": "v8-development",
      "href": "/docs/development/v8-development",
      "crowdinFileId": "256171",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/v8-development.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"développement-v8\"><a href=\"#développement-v8\">Développement V8</a></h1>\n<blockquote>\n<p>Une collection de ressources pour l’apprentissage et à l'utilisation de V8</p>\n</blockquote>\n<ul>\n<li><a href=\"https://v8.dev/docs/trace\">V8 Tracing</a></li>\n<li><a href=\"https://v8.dev/docs/profile\">Profileur V8</a> - combinaisons de profileur pouvant être utile pour le profilage : <code>--prof</code>, <code>--trace-ic</code>, <code>--trace-opt</code>, <code>--trace-deopt</code>, <code>--print-bytecode</code>, <code>--print-opt-code</code></li>\n<li><a href=\"https://docs.google.com/document/d/11T2CRex9hXxoJwbYqVQ32yIPMh0uouUZLdyrtmMoL44/edit?ts=56f27d9d#heading=h.6jz9dj3bnr8t\">V8 Interpreter Design</a></li>\n<li><a href=\"https://v8.dev/docs/turbofan\">Optimisation compileur</a></li>\n<li><a href=\"https://v8.dev/docs/gdb-jit\">Débogage V8 GDB</a></li>\n</ul>\n<p>Voir aussi <a href=\"/docs/development/chromium-development\">Développement de Chromium</a></p>",
      "title": "Développement V8",
      "description": "Une collection de ressources pour l’apprentissage et à l'utilisation de V8"
    },
    "/docs/api/web-contents": {
      "locale": "fr-FR",
      "slug": "web-contents",
      "href": "/docs/api/web-contents",
      "crowdinFileId": "256399",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-contents.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webcontents\"><a href=\"#webcontents\">webContents</a></h1>\n<blockquote>\n<p>Fait le rendu et contrôle des pages web.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>webContents</code> est un <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>. Il est responsable du rendu et du contrôle d'une page web et est une propriété de l'objet <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. Exemple d'accès à l'objet <code>webContents</code> :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> contents = win.webContents\n<span class=\"hljs-built_in\">console</span>.log(contents)\n</code></pre>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>Ces méthodes sont accessibles depuis le module <code>webContents</code> :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(webContents)\n</code></pre>\n<h3 id=\"webcontentsgetallwebcontents\"><a href=\"#webcontentsgetallwebcontents\"><code>webContents.getAllWebContents()</code></a></h3>\n<p>Retourne <code>WebContents[]</code> - Un tableau de toutes les instances de <code>WebContents</code>. Celui-ci contiendra le contenu web de toutes les fenêtres, webviews, devtools ouvertes et pages d'extention d'arrière-plan des devtools .</p>\n<h3 id=\"webcontentsgetfocusedwebcontents\"><a href=\"#webcontentsgetfocusedwebcontents\"><code>webContents.getFocusedWebContents()</code></a></h3>\n<p>Retourne <code>WebContents</code> - Le contenu web qui a le focus dans cette application, sinon retourne <code>null</code>.</p>\n<h3 id=\"webcontentsfromidid\"><a href=\"#webcontentsfromidid\"><code>webContents.fromId(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Returns <code>WebContents</code> | undefined - A WebContents instance with the given ID, or <code>undefined</code> if there is no WebContents associated with the given ID.</p>\n<h3 id=\"webcontentsfromdevtoolstargetidtargetid\"><a href=\"#webcontentsfromdevtoolstargetidtargetid\"><code>webContents.fromDevToolsTargetId(targetId)</code></a></h3>\n<ul>\n<li><code>targetId</code> String - The Chrome DevTools Protocol <a href=\"https://chromedevtools.github.io/devtools-protocol/tot/Target/#type-TargetID\">TargetID</a> associated with the WebContents instance.</li>\n</ul>\n<p>Returns <code>WebContents</code> | undefined - A WebContents instance with the given TargetID, or <code>undefined</code> if there is no WebContents associated with the given TargetID.</p>\n<p>When communicating with the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">Chrome DevTools Protocol</a>, it can be useful to lookup a WebContents instance based on its assigned TargetID.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">lookupTargetId</span> (<span class=\"hljs-params\">browserWindow</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> wc = browserWindow.webContents\n  <span class=\"hljs-keyword\">await</span> wc.debugger.attach(<span class=\"hljs-string\">'1.3'</span>)\n  <span class=\"hljs-keyword\">const</span> { targetInfo } = <span class=\"hljs-keyword\">await</span> wc.debugger.sendCommand(<span class=\"hljs-string\">'Target.getTargetInfo'</span>)\n  <span class=\"hljs-keyword\">const</span> { targetId } = targetInfo\n  <span class=\"hljs-keyword\">const</span> targetWebContents = <span class=\"hljs-keyword\">await</span> webContents.fromDevToolsTargetId(targetId)\n}\n</code></pre>\n<h2 id=\"classe--webcontents\"><a href=\"#classe--webcontents\">Classe : WebContents</a></h2>\n<blockquote>\n<p>Affiche et contrôle le contenu d'une instance de BrowserWindow.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"événements-dinstance\"><a href=\"#événements-dinstance\">Événements d’instance</a></h3>\n<h4 id=\"événement--did-finish-load\"><a href=\"#événement--did-finish-load\">Événement : 'did-finish-load'</a></h4>\n<p>Émis lorsque la navigation a abouti, c'est à dire que le loader de l'onglet a cessé de tourner, et l'événement <code>onload</code> a été émis.</p>\n<h4 id=\"événement--did-fail-load\"><a href=\"#événement--did-fail-load\">Événement : 'did-fail-load'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Cet événement est comme <code>did-finish-load</code> mais émis lorsque le chargement a échoué. La liste complète des codes d'erreur et leur signification est disponible <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">ici</a>.</p>\n<h4 id=\"événement--did-fail-provisional-load\"><a href=\"#événement--did-fail-provisional-load\">Événement : 'did-fail-provisional-load'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Cet événement est comme <code>did-fail-load</code> mais émis lorsque la charge a été annulée (par exemple <code>window.stop()</code> a été appelé).</p>\n<h4 id=\"événement--did-frame-finish-load\"><a href=\"#événement--did-frame-finish-load\">Événement : 'did-frame-finish-load'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Émis lorsqu'un frame a fini sa navigation.</p>\n<h4 id=\"événement--did-start-loading\"><a href=\"#événement--did-start-loading\">Événement : 'did-start-loading'</a></h4>\n<p>Correspond au moment où le loader de l'onglet commence à tourner.</p>\n<h4 id=\"événement--did-stop-loading\"><a href=\"#événement--did-stop-loading\">Événement : 'did-stop-loading'</a></h4>\n<p>Correspond au moment où le loader de l'onglet arrête de tourner.</p>\n<h4 id=\"événement--dom-ready\"><a href=\"#événement--dom-ready\">Événement : 'dom-ready'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the document in the top-level frame is loaded.</p>\n<h4 id=\"événement--page-title-updated\"><a href=\"#événement--page-title-updated\">Événement : 'page-title-updated'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>Fired when page title is set during navigation. <code>explicitSet</code> is false when title is synthesized from file url.</p>\n<h4 id=\"événement--page-favicon-updated\"><a href=\"#événement--page-favicon-updated\">Événement : 'page-favicon-updated'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>favicons</code> String[] - Tableau d'URLs.</li>\n</ul>\n<p>Émis lorsque la page reçoit l’url du favicon.</p>\n<h4 id=\"événement--new-window-déprécié\"><a href=\"#événement--new-window-déprécié\">Événement : 'new-window' <em>Déprécié</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> NewWindowWebContentsEvent</li>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String</li>\n<li><code>disposition</code> String - Peut être <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> et <code>other</code>.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - Les options qui seront utilisées pour créer le nouveau <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</li>\n<li><code>additionalFeatures</code> String[] - Les fonctionnalités non standards (fonctionnalités non gérés par Chromium ou Electron) donné à <code>window.open()</code>. Deprecated, and will now always be the empty array <code>[]</code>.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - Le parrain qui sera passé à la nouvelle fenêtre. Peut ou ne peut pas entraîner l'envoi de l'en-tête <code>Référent</code> en fonction de la politique du référent.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that will be sent to the new window, along with the appropriate headers that will be set. If no post data is to be sent, the value will be <code>null</code>. Only defined when the window is being created by a form that set <code>target=_blank</code>.</li>\n</ul>\n<p>Obsolète, utiliser <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a> à la place.</p>\n<p>Emitted when the page requests to open a new window for a <code>url</code>. It could be requested by <code>window.open</code> or an external link like <code>&#x3C;a target='_blank'></code>.</p>\n<p>Un nouveau <code>BrowserWindow</code> sera créé par défaut pour l'<code>url</code>.</p>\n<p>L'appel à <code>event.preventDefault()</code> empêchera Electron de créer automatiquement une nouvelle <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. Si vous appelez <code>event.preventDefault()</code> et créez manuellement un nouveau <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> alors vous devez définir <code>événement. ewGuest</code> pour référencer la nouvelle instance <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> . Si vous ne le faites pas, cela peut entraîner un comportement inattendu. Par exemple :</p>\n<pre><code class=\"hljs language-javascript\">myBrowserWindow.webContents.on(<span class=\"hljs-string\">'new-window'</span>, (event, url, frameName, disposition, options, additionalFeatures, referrer, postBody) => {\n  event.preventDefault()\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webContents</span>: options.webContents, <span class=\"hljs-comment\">// use existing webContents if provided</span>\n    <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span>\n  })\n  win.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => win.show())\n  <span class=\"hljs-keyword\">if</span> (!options.webContents) {\n    <span class=\"hljs-keyword\">const</span> loadOptions = {\n      <span class=\"hljs-attr\">httpReferrer</span>: referrer\n    }\n    <span class=\"hljs-keyword\">if</span> (postBody != <span class=\"hljs-literal\">null</span>) {\n      <span class=\"hljs-keyword\">const</span> { data, contentType, boundary } = postBody\n      loadOptions.postData = postBody.data\n      loadOptions.extraHeaders = <span class=\"hljs-string\">`content-type: <span class=\"hljs-subst\">${contentType}</span>; boundary=<span class=\"hljs-subst\">${boundary}</span>`</span>\n    }\n\n    win.loadURL(url, loadOptions) <span class=\"hljs-comment\">// existing webContents will be navigated automatically</span>\n  }\n  event.newGuest = win\n})\n</code></pre>\n<h4 id=\"event-did-create-window\"><a href=\"#event-did-create-window\">Event: 'did-create-window'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>window</code> BrowserWindow</li>\n<li>Objet <code>details</code><ul>\n<li><code>url</code> String - URL for the created window.</li>\n<li><code>frameName</code> String - Name given to the created window in the <code>window.open()</code> call.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - The options used to create the BrowserWindow. They are merged in increasing precedence: parsed options from the <code>features</code> string from <code>window.open()</code>, security-related webPreferences inherited from the parent, and options given by <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>. Unrecognized options are not filtered out.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - Le parrain qui sera passé à la nouvelle fenêtre. May or may not result in the <code>Referer</code> header being sent, depending on the referrer policy.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that will be sent to the new window, along with the appropriate headers that will be set. If no post data is to be sent, the value will be <code>null</code>. Only defined when the window is being created by a form that set <code>target=_blank</code>.</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> and <code>other</code>.</li>\n</ul></li>\n</ul>\n<p>Emitted <em>after</em> successful creation of a window via <code>window.open</code> in the renderer. Not emitted if the creation of the window is canceled from <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>.</p>\n<p>See <a href=\"/docs/api/window-open\"><code>window.open()</code></a> for more details and how to use this in conjunction with <code>webContents.setWindowOpenHandler</code>.</p>\n<h4 id=\"événement--will-navigate\"><a href=\"#événement--will-navigate\">Événement : 'will-navigate'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when a user or the page wants to start navigation. It can happen when the <code>window.location</code> object is changed or a user clicks a link in the page.</p>\n<p>Cet événement ne sera pas émis lorsque la navigation démarre par programmation grâce aux APIs comme <code>webContents.loadURL</code> et <code>webContents.back</code>.</p>\n<p>It is also not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<p>Appeler <code>event.preventDefault()</code> permet d'éviter la navigation.</p>\n<h4 id=\"événement--did-start-navigation\"><a href=\"#événement--did-start-navigation\">Événement : 'did-start-navigation'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame (including main) starts navigating. <code>isInPlace</code> will be <code>true</code> for in-page navigations.</p>\n<h4 id=\"événement--will-redirect\"><a href=\"#événement--will-redirect\">Événement : 'will-redirect'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted as a server side redirect occurs during navigation.  For example a 302 redirect.</p>\n<p>Cet événement sera émis après <code>did-start-navigation</code> et pour la même navigation toujours avant l'événement <code>did-redirect-navigation</code> .</p>\n<p>L'appel à <code>event.preventDefault()</code> empêchera la navigation (pas seulement la redirection).</p>\n<h4 id=\"event-did-redirect-navigation\"><a href=\"#event-did-redirect-navigation\">Event: 'did-redirect-navigation'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted after a server side redirect occurs during navigation.  For example a 302 redirect.</p>\n<p>This event cannot be prevented, if you want to prevent redirects you should checkout out the <code>will-redirect</code> event above.</p>\n<h4 id=\"événement--did-navigate\"><a href=\"#événement--did-navigate\">Événement : 'did-navigate'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - empty for non HTTP navigations</li>\n</ul>\n<p>Émis lorsque la navigation d'une fenêtre principale est terminée.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h4 id=\"event-did-frame-navigate\"><a href=\"#event-did-frame-navigate\">Event: 'did-frame-navigate'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - vide pour les navigations non HTTP,</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Émis lorsqu'une navigation est terminée.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h4 id=\"événement--did-navigate-in-page\"><a href=\"#événement--did-navigate-in-page\">Événement : 'did-navigate-in-page'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when an in-page navigation happened in any frame.</p>\n<p>En cas de navigation dans la page, l'URL de la page change mais ne provoque pas de navigation à l'extérieur de la page. Par exemple, lorsque vous cliquez sur un lien d'ancrage ou lorsque l'événement DOM <code>hashchange</code> est déclenché.</p>\n<h4 id=\"événement--will-prevent-unload\"><a href=\"#événement--will-prevent-unload\">Événement : 'will-prevent-unload'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Émis lorsqu’un écouteur de l'événement <code>beforeunload</code> tente d’annuler un déchargement de la page.</p>\n<p>Appeler <code>event.preventDefault()</code> ignorera l'écouteur de l'événement <code>beforeunload</code> et va laisser la page se décharger.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.webContents.on(<span class=\"hljs-string\">'will-prevent-unload'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> choice = dialog.showMessageBoxSync(win, {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'question'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Leave'</span>, <span class=\"hljs-string\">'Stay'</span>],\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Do you want to leave this site?'</span>,\n    <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'Changes you made may not be saved.'</span>,\n    <span class=\"hljs-attr\">defaultId</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">cancelId</span>: <span class=\"hljs-number\">1</span>\n  })\n  <span class=\"hljs-keyword\">const</span> leave = (choice === <span class=\"hljs-number\">0</span>)\n  <span class=\"hljs-keyword\">if</span> (leave) {\n    event.preventDefault()\n  }\n})\n</code></pre>\n<p><strong>Note:</strong> This will be emitted for <code>BrowserViews</code> but will <em>not</em> be respected - this is because we have chosen not to tie the <code>BrowserView</code> lifecycle to its owning BrowserWindow should one exist per the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event\">specification</a>.</p>\n<h4 id=\"événement--crash-déprécié\"><a href=\"#événement--crash-déprécié\">Événement : 'crash' <em>Déprécié</em></a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>Émis lorsque le processus renderer crash ou est interrompu.</p>\n<p><strong>Deprecated:</strong> Cet événement est remplacé par l'événement <code>render-process-gone</code> qui contient plus d'informations à propos de la raison du plantage du processus enfant. Ceci n'est pas toujours causé par un plantage.  Le booléen <code>killed</code> peut être remplacé par la vérification de <code>reason === 'killed'</code> lorsque vous passez à l'utilisation de cet événement.</p>\n<h4 id=\"événement--render-process-gone\"><a href=\"#événement--render-process-gone\">Événement : 'render-process-gone'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>Objet <code>details</code><ul>\n<li><code>reason</code> String - La raison pour laquelle le processus de rendu a disparu.  Valeurs possibles :<ul>\n<li>`` de sortie propre - Processus s'est terminé avec le code de sortie zéro</li>\n<li><code>anormal-exit</code> - Le Processus s'est terminé avec un code de sortie différent de zéro</li>\n<li><code>killed</code> - Le processus a reçu un SIGTERM ou a été tué autrement de l'extérieur</li>\n<li><code>crashed</code> - Processus s'est planté</li>\n<li><code>oom</code> - Le processus est tombé à cours de mémoire</li>\n<li><code>launch-failed</code> - Le processus ne s'est pas lancé avec succès</li>\n<li><code>integrity-failure</code> - Les vérifications d'intégrité du code Windows ont échouées</li>\n</ul></li>\n<li><code>exitCode</code> Integer - Le code de sortie du proces, sauf si <code>reason</code> est <code>launch-failed</code>, dans ce cas là <code>exitCode</code> sera specifique per plateforme.</li>\n</ul></li>\n</ul>\n<p>Émis lorsque le processus de rendu plante de manière inattendue.  C'est normalement dans les cas où il s'est planté ou qu'il a été tué.</p>\n<h4 id=\"événement--unresponsive\"><a href=\"#événement--unresponsive\">Événement : 'unresponsive'</a></h4>\n<p>Émis lorsque la page web cesse de répondre.</p>\n<h4 id=\"événement--responsive\"><a href=\"#événement--responsive\">Événement : 'responsive'</a></h4>\n<p>Émis lorsque la page web répond à nouveau.</p>\n<h4 id=\"événement--plugin-crashed\"><a href=\"#événement--plugin-crashed\">Événement : 'plugin-crashed'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>\n<p>Émis lorsqu’un processus de plugin crash.</p>\n<h4 id=\"événement--destroyed\"><a href=\"#événement--destroyed\">Événement : 'destroyed'</a></h4>\n<p>Émis lorsqu'un <code>webContents</code> est détruit.</p>\n<h4 id=\"événement--before-input-event\"><a href=\"#événement--before-input-event\">Événement : 'before-input-event'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>input</code> Object - Input properties.<ul>\n<li><code>type</code> String - Either <code>keyUp</code> or <code>keyDown</code>.</li>\n<li><code>key</code> String - Équivalent à <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.key</a>.</li>\n<li><code>code</code> String - Équivalent à <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.code</a>.</li>\n<li><code>isAutoRepeat</code> Boolean - Équivalent à <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.repeat</a>.</li>\n<li><code>isComposing</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.isComposing</a>.</li>\n<li><code>shift</code> Boolean - Équivalent à <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.shiftKey</a>.</li>\n<li><code>control</code> Boolean - Équivalent à <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.controlKey</a>.</li>\n<li><code>alt</code> Boolean - Équivalent à <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.altKey</a>.</li>\n<li><code>meta</code> Boolean - Équivalent à <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.metakey</a>.</li>\n<li><code>location</code> Number - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.location</a>.</li>\n<li><code>modifiers</code> String[] - See <a href=\"/docs/api/structures/input-event\">InputEvent.modifiers</a>.</li>\n</ul></li>\n</ul>\n<p>Émis avant d'envoyer les événements <code>keydown</code> et <code>keyup</code> dans la page. Appeler <code>event.preventDefault</code> empêchera les événements <code>keydown</code>/<code>keyup</code> et les raccourcis du menu dans la page.</p>\n<p>To only prevent the menu shortcuts, use <a href=\"#contentssetignoremenushortcutsignore\"><code>setIgnoreMenuShortcuts</code></a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\nwin.webContents.on(<span class=\"hljs-string\">'before-input-event'</span>, (event, input) => {\n  <span class=\"hljs-comment\">// For example, only enable application menu keyboard shortcuts when</span>\n  <span class=\"hljs-comment\">// Ctrl/Cmd are down.</span>\n  win.webContents.setIgnoreMenuShortcuts(!input.control &#x26;&#x26; !input.meta)\n})\n</code></pre>\n<h4 id=\"événement--enter-html-full-screen\"><a href=\"#événement--enter-html-full-screen\">Événement : 'enter-html-full-screen'</a></h4>\n<p>Émis lorsque la fenêtre entre dans un état de plein écran déclenchée par l’API HTML.</p>\n<h4 id=\"événement--leave-html-full-screen\"><a href=\"#événement--leave-html-full-screen\">Événement : 'leave-html-full-screen'</a></h4>\n<p>Émis lorsque la fenêtre revient d'un état de plein écran déclenchée par l’API HTML.</p>\n<h4 id=\"événement--zoom-changed\"><a href=\"#événement--zoom-changed\">Événement : 'zoom-changed'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>zoomDirection</code> String - Peut être <code>in</code> ou <code>out</code>.</li>\n</ul>\n<p>Émis lorsque l'utilisateur demande à changer le niveau de zoom en utilisant la molette de la souris.</p>\n<h4 id=\"événement--devtools-opened\"><a href=\"#événement--devtools-opened\">Événement : 'devtools-opened'</a></h4>\n<p>Émis lorsque la DevTools est ouverte.</p>\n<h4 id=\"événement--devtools-closed\"><a href=\"#événement--devtools-closed\">Événement : 'devtools-closed'</a></h4>\n<p>Émis lorsque la DevTools est fermée.</p>\n<h4 id=\"événement--devtools-focused\"><a href=\"#événement--devtools-focused\">Événement : 'devtools-focused'</a></h4>\n<p>Émis lorsque la DevTools est active / ouverte.</p>\n<h4 id=\"événement-certificate-error\"><a href=\"#événement-certificate-error\">Événement 'certificate-error'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>error</code> String - The error code.</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>isTrusted</code> Boolean - Indicates whether the certificate can be considered trusted.</li>\n</ul></li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Émis lorsqu'il n'a pas pu vérifier le <code>certificat</code> de l'<code>url</code>.</p>\n<p>L'utilisation est pareil que <a href=\"/docs/api/app#event-certificate-error\">l'événement <code>certificate-error</code> de <code>app</code></a>.</p>\n<h4 id=\"événement--select-client-certificate\"><a href=\"#événement--select-client-certificate\">Événement : 'select-client-certificate'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> URL</li>\n<li><code>certificateList</code> <a href=\"/docs/api/structures/certificate\">Certificate[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> - Must be a certificate from the given list.</li>\n</ul></li>\n</ul>\n<p>Émis lorsqu'un certificat client est demandé.</p>\n<p>L'utilisation est pareil que <a href=\"/docs/api/app#event-select-client-certificate\">l'événement <code>select-client-certificate</code> de <code>app</code></a>.</p>\n<h4 id=\"événement--login\"><a href=\"#événement--login\">Événement : 'login'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>Objet <code>authenticationResponseDetails</code><ul>\n<li><code>url</code> URL</li>\n</ul></li>\n<li>Objet <code>authInfo</code><ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>nom d'utilisateur</code> String (facultatif)</li>\n<li><code>mot de passe</code> String (facultatif)</li>\n</ul></li>\n</ul>\n<p>Émis lorsque <code>webContents</code> veut faire une authentification normale.</p>\n<p>L'utilisation est pareil que <a href=\"/docs/api/app#event-login\">l'événement <code>login</code> de <code>app</code></a>.</p>\n<h4 id=\"événement--found-in-page\"><a href=\"#événement--found-in-page\">Événement : 'found-in-page'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>result</code> Object<ul>\n<li><code>requestId</code> Integer</li>\n<li><code>activeMatchOrdinal</code> Integer - Position du résultat actif.</li>\n<li><code>matches</code> Integer - Nombre de résultats.</li>\n<li><code>sélectionArea</code> Rectangle - Coordonnées de la région de la première correspondance.</li>\n<li><code>finalUpdate</code> Boolean</li>\n</ul></li>\n</ul>\n<p>Émis lorsqu'un résultat est disponible pour la requête [<code>webContents.findInPage</code>].</p>\n<h4 id=\"événement--media-started-playing\"><a href=\"#événement--media-started-playing\">Événement : 'media-started-playing'</a></h4>\n<p>Émis lorsqu'un média se démarre.</p>\n<h4 id=\"événement--media-paused\"><a href=\"#événement--media-paused\">Événement : 'media-paused'</a></h4>\n<p>Émis lorsque le média est suspendu ou terminé.</p>\n<h4 id=\"événement--did-change-theme-color\"><a href=\"#événement--did-change-theme-color\">Événement : 'did-change-theme-color'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>color</code> (String | null) - Theme color is in format of '#rrggbb'. It is <code>null</code> when no theme color is set.</li>\n</ul>\n<p>Emitted when a page's theme color changes. This is usually due to encountering a meta tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">'theme-color'</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">'#ff0000'</span>></span>\n</code></pre>\n<h4 id=\"événement--update-target-url\"><a href=\"#événement--update-target-url\">Événement : 'update-target-url'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Émis lorsque la souris passe sur un lien ou le clavier déplace le focus vers un lien.</p>\n<h4 id=\"événement--cursor-changed\"><a href=\"#événement--cursor-changed\">Événement : 'cursor-changed'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String</li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> (facultatif)</li>\n<li><code>scale</code> Float (optional) - scaling factor for the custom cursor.</li>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) - the size of the <code>image</code>.</li>\n<li><code>hotspot</code> <a href=\"/docs/api/structures/point\">Point</a> (optional) - coordinates of the custom cursor's hotspot.</li>\n</ul>\n<p>Émis lorsque le type du curseur change. The <code>type</code> parameter can be <code>default</code>, <code>crosshair</code>, <code>pointer</code>, <code>text</code>, <code>wait</code>, <code>help</code>, <code>e-resize</code>, <code>n-resize</code>, <code>ne-resize</code>, <code>nw-resize</code>, <code>s-resize</code>, <code>se-resize</code>, <code>sw-resize</code>, <code>w-resize</code>, <code>ns-resize</code>, <code>ew-resize</code>, <code>nesw-resize</code>, <code>nwse-resize</code>, <code>col-resize</code>, <code>row-resize</code>, <code>m-panning</code>, <code>e-panning</code>, <code>n-panning</code>, <code>ne-panning</code>, <code>nw-panning</code>, <code>s-panning</code>, <code>se-panning</code>, <code>sw-panning</code>, <code>w-panning</code>, <code>move</code>, <code>vertical-text</code>, <code>cell</code>, <code>context-menu</code>, <code>alias</code>, <code>progress</code>, <code>nodrop</code>, <code>copy</code>, <code>none</code>, <code>not-allowed</code>, <code>zoom-in</code>, <code>zoom-out</code>, <code>grab</code>, <code>grabbing</code> or <code>custom</code>.</p>\n<p>Si le paramètre <code>type</code> est <code>custom</code>, le paramètre <code>image</code> contiendra l'image du curseur personnalisé dans un <a href=\"/docs/api/native-image\"><code>NativeImage</code></a>, et <code>scale</code>, <code>size</code> et <code>hotspot</code> contiendront les informations complémentaires à propos du curseur personnalisé.</p>\n<h4 id=\"événement--context-menu\"><a href=\"#événement--context-menu\">Événement : 'context-menu'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>params</code> Object<ul>\n<li><code>x</code> Integer - x coordinate.</li>\n<li><code>y</code> Integer - y coordinate.</li>\n<li><code>frame</code> WebFrameMain - Frame from which the context menu was invoked.</li>\n<li><code>linkURL</code> String - L'URL du lien qui englobe le nœud du menu contextuel.</li>\n<li><code>linkText</code> String - Text associated with the link. May be an empty string if the contents of the link are an image.</li>\n<li><code>pageURL</code> String - L'URL de la page haut niveau d'où le menu contextuel a été invoqué.</li>\n<li><code>frameURL</code> String - L'URL de la subframe d'où le menu contextuel a été invoqué.</li>\n<li><code>srcURL</code> String - Source URL for the element that the context menu was invoked on. Elements with source URLs are images, audio and video.</li>\n<li><code>mediaType</code> String - Type du nœud sur lequel le menu contextuel a été appelé. Peut être <code>none</code>, <code>image</code>, <code>audio</code>, <code>vidéo</code>, <code>toile</code>, <code>fichier</code> ou <code>plugin</code>.</li>\n<li><code>hasImageContents</code> Boolean - Si le menu contextuel a été invoqué sur une image au contenu non-vide ou non.</li>\n<li><code>isEditable</code> Boolean - Si le contexte est modifiable ou non.</li>\n<li><code>selectionText</code> String - Texte de la sélection sur laquelle le menu contextuel a été invoqué.</li>\n<li><code>titleText</code> String - Title text of the selection that the context menu was invoked on.</li>\n<li><code>altText</code> String - Alt text of the selection that the context menu was invoked on.</li>\n<li><code>suggestedFilename</code> String - Suggested filename to be used when saving file through 'Save Link As' option of context menu.</li>\n<li><code>selectionRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Rect representing the coordinates in the document space of the selection.</li>\n<li><code>selectionStartOffset</code> Number - Start position of the selection text.</li>\n<li><code>referrerPolicy</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer policy of the frame on which the menu is invoked.</li>\n<li><code>misspelledWord</code> String - Mot mal orthographié sous le curseur, si applicable.</li>\n<li><code>dictionarySuggestions</code> String[] - Un tableau de mots suggérés à montrer à l'utilisateur pour remplacer le <code>misspelledWord</code>.  Uniquement disponible si un mot est mal orthographié et que le correcteur orthographique est activé.</li>\n<li><code>frameCharset</code> String - L'encodage des caractères de la fenêtre sur lequel le menu a été appelé.</li>\n<li><code>inputFieldType</code> String - Si le menu contextuel a été appelé sur un champ modifiable, donne le type de ce champ. Les valeurs possibles sont <code>none</code>, <code>plainText</code>, <code>password</code>, <code>other</code>.</li>\n<li><code>spellcheckEnabled</code> Boolean - If the context is editable, whether or not spellchecking is enabled.</li>\n<li><code>menuSourceType</code> String - Input source that invoked the context menu. Can be <code>none</code>, <code>mouse</code>, <code>keyboard</code>, <code>touch</code>, <code>touchMenu</code>, <code>longPress</code>, <code>longTap</code>, <code>touchHandle</code>, <code>stylus</code>, <code>adjustSelection</code>, or <code>adjustSelectionReset</code>.</li>\n<li><code>mediaFlags</code> Object - The flags for the media element the context menu was invoked on.<ul>\n<li><code>inError</code> Boolean - Si l'élément multimédia a crash.</li>\n<li><code>isPaused</code> Boolean - Si l'élément multimédia est en pause.</li>\n<li><code>isMuted</code> Boolean - Si l'élément multimédia est mis en sourdine.</li>\n<li><code>hasAudio</code> Boolean - Si l'élément multimédia émet un son audio.</li>\n<li><code>isLooping</code> Boolean - Si l'élément multimédia est en boucle.</li>\n<li><code>isControlsVisible</code> Boolean - Si les contrôles de l'élément multimédia sont visibles.</li>\n<li><code>canToggleControls</code> Boolean - Si les contrôles de l'élément multimédia sont toggleable.</li>\n<li><code>canPrint</code> Boolean - Whether the media element can be printed.</li>\n<li><code>canSave</code> Boolean - Whether or not the media element can be downloaded.</li>\n<li><code>canShowPictureInPicture</code> Boolean - Whether the media element can show picture-in-picture.</li>\n<li><code>isShowingPictureInPicture</code> Boolean - Whether the media element is currently showing picture-in-picture.</li>\n<li><code>canRotate</code> Boolean - Si l'élément multimédia peut être pivoté.</li>\n<li><code>canLoop</code> Boolean - Whether the media element can be looped.</li>\n</ul></li>\n<li><code>editFlags</code> Object - These flags indicate whether the renderer believes it is able to perform the corresponding action.<ul>\n<li><code>canUndo</code> Boolean - Si le moteur de rendu pense pouvoir aller en arrière.</li>\n<li><code>canRedo</code> Boolean - Si le moteur de rendu pense pouvoir aller en avant.</li>\n<li><code>canCut</code> Boolean - Si le moteur de rendu pense pouvoir couper.</li>\n<li><code>canCopy</code> Boolean - Si le moteur de rendu pense pouvoir copier.</li>\n<li><code>canPaste</code> Boolean - Si le moteur de rendu pense pouvoir coller.</li>\n<li><code>canDelete</code> Boolean - Si le moteur de rendu pense pouvoir supprimer.</li>\n<li><code>canSelectAll</code> Boolean - Si le moteur de rendu pense pouvoir tout sélectionner.</li>\n<li><code>canEditRichly</code> Boolean - Whether the renderer believes it can edit text richly.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Émis lorsqu'un nouveau menu contextuel a besoin d'être pris en charge.</p>\n<h4 id=\"événement--select-bluetooth-device\"><a href=\"#événement--select-bluetooth-device\">Événement : 'select-bluetooth-device'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>devices</code> <a href=\"/docs/api/structures/bluetooth-device\">BluetoothDevice[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>deviceId</code> String</li>\n</ul></li>\n</ul>\n<p>Émis lorsque le périphérique bluetooth a besoin d'être selectionné lors de l'appel de <code>navigator.bluetooth.requestDevice</code>. Pour utiliser l'api <code>navigator.bluetooth</code>, <code>webBluethooth</code> doit être activé. Si <code>event.preventDefault</code> n'est pas appelé, le premier périphérique disponible sera sélectionné. <code>callback</code> doit être appelé avec <code>deviceId</code> à sélectionner, en passant une chaîne de caractère vide au <code>callback</code> annulera la requête.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'enable-experimental-web-platform-features'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.webContents.on(<span class=\"hljs-string\">'select-bluetooth-device'</span>, (event, deviceList, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> result = deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.deviceName === <span class=\"hljs-string\">'test'</span>\n    })\n    <span class=\"hljs-keyword\">if</span> (!result) {\n      callback(<span class=\"hljs-string\">''</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      callback(result.deviceId)\n    }\n  })\n})\n</code></pre>\n<h4 id=\"événement--paint\"><a href=\"#événement--paint\">Événement : 'paint'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>dirtyRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> - Les données de l'image du frame entier.</li>\n</ul>\n<p>Emitted when a new frame is generated. Only the dirty area is passed in the buffer.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">offscreen</span>: <span class=\"hljs-literal\">true</span> } })\nwin.webContents.on(<span class=\"hljs-string\">'paint'</span>, (event, dirty, image) => {\n  <span class=\"hljs-comment\">// updateBitmap(dirty, image.getBitmap())</span>\n})\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n</code></pre>\n<h4 id=\"événement--devtools-reload-page\"><a href=\"#événement--devtools-reload-page\">Événement : 'devtools-reload-page'</a></h4>\n<p>Émis quand la fenêtre des outils développeur demande aux webContents de se recharger</p>\n<h4 id=\"événement--will-attach-webview\"><a href=\"#événement--will-attach-webview\">Événement : 'will-attach-webview'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webPreferences</code> WebPreferences - The web preferences that will be used by the guest page. This object can be modified to adjust the preferences for the guest page.</li>\n<li><code>params</code> Record&#x3C;string, string> - The other <code>&#x3C;webview></code> parameters such as the <code>src</code> URL. This object can be modified to adjust the parameters of the guest page.</li>\n</ul>\n<p>Emitted when a <code>&#x3C;webview></code>'s web contents is being attached to this web contents. Calling <code>event.preventDefault()</code> will destroy the guest page.</p>\n<p>This event can be used to configure <code>webPreferences</code> for the <code>webContents</code> of a <code>&#x3C;webview></code> before it's loaded, and provides the ability to set settings that can't be set via <code>&#x3C;webview></code> attributes.</p>\n<p><strong>Note:</strong> The specified <code>preload</code> script option will appear as <code>preloadURL</code> (not <code>preload</code>) in the <code>webPreferences</code> object emitted with this event.</p>\n<h4 id=\"événement--will-attach-webview-1\"><a href=\"#événement--will-attach-webview-1\">Événement : 'will-attach-webview'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> WebContents - Les contenus web invités qui sont utilisés par <code>&#x3C;webview></code>.</li>\n</ul>\n<p>Émis quand un <code>&#x3C;webview></code> a été rattaché à ce contenu web.</p>\n<h4 id=\"événement--console-message\"><a href=\"#événement--console-message\">Événement : 'console-message'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>level</code> Integer - The log level, from 0 to 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>message</code> String - The actual console message</li>\n<li><code>line</code> Integer - The line number of the source that triggered this console message</li>\n<li><code>sourceId</code> String</li>\n</ul>\n<p>Emitted when the associated window logs a console message.</p>\n<h4 id=\"event-preload-error\"><a href=\"#event-preload-error\">Event: 'preload-error'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preloadPath</code> String</li>\n<li><code>error</code> Error</li>\n</ul>\n<p>Emitted when the preload script <code>preloadPath</code> throws an unhandled exception <code>error</code>.</p>\n<h4 id=\"événement--ipc-message\"><a href=\"#événement--ipc-message\">Événement : 'ipc-message'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Emitted when the renderer process sends an asynchronous message via <code>ipcRenderer.send()</code>.</p>\n<h4 id=\"event-ipc-message-sync\"><a href=\"#event-ipc-message-sync\">Event: 'ipc-message-sync'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Emitted when the renderer process sends a synchronous message via <code>ipcRenderer.sendSync()</code>.</p>\n<h4 id=\"événement--desktop-capturer-get-sources\"><a href=\"#événement--desktop-capturer-get-sources\">Événement : 'desktop-capturer-get-sources'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when <code>desktopCapturer.getSources()</code> is called in the renderer process. L' Appel à <code>event.preventDefault()</code> lui fera retourner des sources vides.</p>\n<h4 id=\"event-preferred-size-changed\"><a href=\"#event-preferred-size-changed\">Event: 'preferred-size-changed'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preferredSize</code> <a href=\"/docs/api/structures/size\">Size</a> - The minimum size needed to contain the layout of the document—without requiring scrolling.</li>\n</ul>\n<p>Emitted when the <code>WebContents</code> preferred size has changed.</p>\n<p>This event will only be emitted when <code>enablePreferredSizeMode</code> is set to <code>true</code> in <code>webPreferences</code>.</p>\n<h4 id=\"event-frame-created\"><a href=\"#event-frame-created\">Event: 'frame-created'</a></h4>\n<p>Retourne :</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>Objet <code>details</code><ul>\n<li><code>frame</code> WebFrameMain</li>\n</ul></li>\n</ul>\n<p>Emitted when the <a href=\"/docs/api/web-contents#contentsmainframe-readonly\">mainFrame</a>, an <code>&#x3C;iframe></code>, or a nested <code>&#x3C;iframe></code> is loaded within the page.</p>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<h4 id=\"contentsloadurlurl-options\"><a href=\"#contentsloadurlurl-options\"><code>contents.loadURL(url[, options])</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (optional) - An HTTP Referrer url.</li>\n<li><code>userAgent</code> String (optionnel) - Un agent utilisateur d'où provient la requête.</li>\n<li><code>extraHeaders</code> String (optional) - Extra headers separated by \"\\n\".</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified <code>url</code> is a data url and needs to load other files.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - the promise will resolve when the page has finished loading (see <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects if the page fails to load (see <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>). A noop rejection handler is already attached, which avoids unhandled rejection errors.</p>\n<p>Loads the <code>url</code> in the window. The <code>url</code> must contain the protocol prefix, e.g. the <code>http://</code> or <code>file://</code>. If the load should bypass http cache then use the <code>pragma</code> header to achieve it.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> options = { <span class=\"hljs-attr\">extraHeaders</span>: <span class=\"hljs-string\">'pragma: no-cache\\n'</span> }\nwebContents.loadURL(<span class=\"hljs-string\">'https://github.com'</span>, options)\n</code></pre>\n<h4 id=\"contentsloadfilefilepath-options\"><a href=\"#contentsloadfilefilepath-options\"><code>contents.loadFile(filePath[, options])</code></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>query</code> Enregistrement&#x3C;String, String> (facultatif) - Passé à <code>url.format()</code>.</li>\n<li><code>search</code> String (facultatif) - Passé à <code>url.format()</code>.</li>\n<li><code>hash</code> String (facultatif) - Passé à <code>url.format()</code>.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Promise&#x3C;void></code> - la promesse se résoudra lorsque la page aura terminé le chargement (voir <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), et rejette si la page ne parvient pas à se charger (voir <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Loads the given file in the window, <code>filePath</code> should be a path to an HTML file relative to the root of your application.  For instance an app structure like this:</p>\n<pre><code class=\"hljs language-sh\">| root\n| - package.json\n| - src\n|   - main.js\n|   - index.html\n</code></pre>\n<p>Would require code like this</p>\n<pre><code class=\"hljs language-js\">win.loadFile(<span class=\"hljs-string\">'src/index.html'</span>)\n</code></pre>\n<h4 id=\"contentsdownloadurlurl\"><a href=\"#contentsdownloadurlurl\"><code>contents.downloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code> without navigating. The <code>will-download</code> event of <code>session</code> will be triggered.</p>\n<h4 id=\"contentsgeturl\"><a href=\"#contentsgeturl\"><code>contents.getURL()</code></a></h4>\n<p>Retourne <code>String</code> - l'URL de la page web courante.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> currentURL = win.webContents.getURL()\n  <span class=\"hljs-built_in\">console</span>.log(currentURL)\n})\n</code></pre>\n<h4 id=\"contentsgettitle\"><a href=\"#contentsgettitle\"><code>contents.getTitle()</code></a></h4>\n<p>Retourne <code>String</code> - le titre de la page web courante.</p>\n<h4 id=\"contentsisdestroyed\"><a href=\"#contentsisdestroyed\"><code>contents.isDestroyed()</code></a></h4>\n<p>Retourne <code>Boolean</code> - si la page web est détruite.</p>\n<h4 id=\"contentsfocus\"><a href=\"#contentsfocus\"><code>contents.focus()</code></a></h4>\n<p>Met au premier plan la page web.</p>\n<h4 id=\"contentsisfocused\"><a href=\"#contentsisfocused\"><code>contents.isFocused()</code></a></h4>\n<p>Retourne <code>Boolean</code> - si la page web est au premier plan.</p>\n<h4 id=\"contentsisloading\"><a href=\"#contentsisloading\"><code>contents.isLoading()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la page web est toujours en train de charger des ressources.</p>\n<h4 id=\"contentsisloadingmainframe\"><a href=\"#contentsisloadingmainframe\"><code>contents.isLoadingMainFrame()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la frame principale (et pas seulement un iframe ou frames qu'il contient) sont toujours en chargement.</p>\n<h4 id=\"contentsiswaitingforresponse\"><a href=\"#contentsiswaitingforresponse\"><code>contents.isWaitingForResponse()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si la page web est en attente d'une première réponse de la principale ressource de la page.</p>\n<h4 id=\"contentsstop\"><a href=\"#contentsstop\"><code>contents.stop()</code></a></h4>\n<p>Arrête toute navigation en attente.</p>\n<h4 id=\"contentsreload\"><a href=\"#contentsreload\"><code>contents.reload()</code></a></h4>\n<p>Recharge la page web courante.</p>\n<h4 id=\"contentsreloadignoringcache\"><a href=\"#contentsreloadignoringcache\"><code>contents.reloadIgnoringCache()</code></a></h4>\n<p>Recharge la page courante et ignore le cache.</p>\n<h4 id=\"contentscangoback\"><a href=\"#contentscangoback\"><code>contents.canGoBack()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the browser can go back to previous web page.</p>\n<h4 id=\"contentscangoforward\"><a href=\"#contentscangoforward\"><code>contents.canGoForward()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the browser can go forward to next web page.</p>\n<h4 id=\"contentscangotooffsetoffset\"><a href=\"#contentscangotooffsetoffset\"><code>contents.canGoToOffset(offset)</code></a></h4>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the web page can go to <code>offset</code>.</p>\n<h4 id=\"contentsclearhistory\"><a href=\"#contentsclearhistory\"><code>contents.clearHistory()</code></a></h4>\n<p>Efface l'historique de navigation.</p>\n<h4 id=\"contentsgoback\"><a href=\"#contentsgoback\"><code>contents.goBack()</code></a></h4>\n<p>Makes the browser go back a web page.</p>\n<h4 id=\"contentsgoforward\"><a href=\"#contentsgoforward\"><code>contents.goForward()</code></a></h4>\n<p>Makes the browser go forward a web page.</p>\n<h4 id=\"contentsgotoindexindex\"><a href=\"#contentsgotoindexindex\"><code>contents.goToIndex(index)</code></a></h4>\n<ul>\n<li><code>index</code> Integer</li>\n</ul>\n<p>Navigates browser to the specified absolute web page index.</p>\n<h4 id=\"contentsgotooffsetoffset\"><a href=\"#contentsgotooffsetoffset\"><code>contents.goToOffset(offset)</code></a></h4>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Navigates to the specified offset from the \"current entry\".</p>\n<h4 id=\"contentsiscrashed\"><a href=\"#contentsiscrashed\"><code>contents.isCrashed()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the renderer process has crashed.</p>\n<h4 id=\"contentsforcefullycrashrenderer\"><a href=\"#contentsforcefullycrashrenderer\"><code>contents.forcefullyCrashRenderer()</code></a></h4>\n<p>Forcefully terminates the renderer process that is currently hosting this <code>webContents</code>. Cela provoquera l'émission de l'événement <code>render-process-gone</code> indiquant la cause avec <code>reason=killed || reason=crashed</code>. Please note that some webContents share renderer processes and therefore calling this method may also crash the host process for other webContents as well.</p>\n<p>Calling <code>reload()</code> immediately after calling this method will force the reload to occur in a new process. This should be used when this process is unstable or unusable, for instance in order to recover from the <code>unresponsive</code> event.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'unresponsive'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> { response } = <span class=\"hljs-keyword\">await</span> dialog.showMessageBox({\n    <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'App X has become unresponsive'</span>,\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Do you want to try forcefully reloading the app?'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'OK'</span>, <span class=\"hljs-string\">'Cancel'</span>],\n    <span class=\"hljs-attr\">cancelId</span>: <span class=\"hljs-number\">1</span>\n  })\n  <span class=\"hljs-keyword\">if</span> (response === <span class=\"hljs-number\">0</span>) {\n    contents.forcefullyCrashRenderer()\n    contents.reload()\n  }\n})\n</code></pre>\n<h4 id=\"contentssetuseragentuseragent\"><a href=\"#contentssetuseragentuseragent\"><code>contents.setUserAgent(userAgent)</code></a></h4>\n<ul>\n<li><code>userAgent</code> String</li>\n</ul>\n<p>Overrides the user agent for this web page.</p>\n<h4 id=\"contentsgetuseragent\"><a href=\"#contentsgetuseragent\"><code>contents.getUserAgent()</code></a></h4>\n<p>Returns <code>String</code> - The user agent for this web page.</p>\n<h4 id=\"contentsinsertcsscss-options\"><a href=\"#contentsinsertcsscss-options\"><code>contents.insertCSS(css[, options])</code></a></h4>\n<ul>\n<li><code>css</code> String</li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>cssOrigin</code> String (optional) - Can be either 'user' or 'author'; Specifying 'user' enables you to prevent websites from overriding the CSS you insert. Default is 'author'.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - A promise that resolves with a key for the inserted CSS that can later be used to remove the CSS via <code>contents.removeInsertedCSS(key)</code>.</p>\n<p>Injecte du CSS dans la page Web actuelle et renvoie une clé unique pour la feuille de style insérée .</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n  contents.insertCSS(<span class=\"hljs-string\">'html, body { background-color: #f00; }'</span>)\n})\n</code></pre>\n<h4 id=\"contentsremoveinsertedcsskey\"><a href=\"#contentsremoveinsertedcsskey\"><code>contents.removeInsertedCSS(key)</code></a></h4>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves if the removal was successful.</p>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from <code>contents.insertCSS(css)</code>.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'did-finish-load'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> key = <span class=\"hljs-keyword\">await</span> contents.insertCSS(<span class=\"hljs-string\">'html, body { background-color: #f00; }'</span>)\n  contents.removeInsertedCSS(key)\n})\n</code></pre>\n<h4 id=\"contentsexecutejavascriptcode-usergesture\"><a href=\"#contentsexecutejavascriptcode-usergesture\"><code>contents.executeJavaScript(code[, userGesture])</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (facultatif) - <code>false</code> par défaut.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if the result of the code is a rejected promise.</p>\n<p>Évalue le <code>code</code> dans la page.</p>\n<p>Dans la fenêtre du navigateur, certaines APIs HTML comme <code>requestFullScreen</code> peut être invoqué seulement par un geste de l'utilisateur. Définir <code>userGesture</code> à <code>true</code> supprimera cette limitation.</p>\n<p>L'exécution du code sera suspendue jusqu'à la fin du chargement de la page web.</p>\n<pre><code class=\"hljs language-js\">contents.executeJavaScript(<span class=\"hljs-string\">'fetch(\"https://jsonplaceholder.typicode.com/users/1\").then(resp => resp.json())'</span>, <span class=\"hljs-literal\">true</span>)\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">result</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(result) <span class=\"hljs-comment\">// Will be the JSON object from the fetch call</span>\n  })\n</code></pre>\n<h4 id=\"contentsexecutejavascriptinisolatedworldworldid-scripts-usergesture\"><a href=\"#contentsexecutejavascriptinisolatedworldworldid-scripts-usergesture\"><code>contents.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture])</code></a></h4>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default world, <code>999</code> is the world used by Electron's <code>contextIsolation</code> feature.  You can provide any integer here.</li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/web-source\">WebSource[]</a></li>\n<li><code>userGesture</code> Boolean (facultatif) - <code>false</code> par défaut.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if the result of the code is a rejected promise.</p>\n<p>Works like <code>executeJavaScript</code> but evaluates <code>scripts</code> in an isolated context.</p>\n<h4 id=\"contentssetignoremenushortcutsignore\"><a href=\"#contentssetignoremenushortcutsignore\"><code>contents.setIgnoreMenuShortcuts(ignore)</code></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n</ul>\n<p>Ignore application menu shortcuts while this web contents is focused.</p>\n<h4 id=\"contentssetwindowopenhandlerhandler\"><a href=\"#contentssetwindowopenhandlerhandler\"><code>contents.setWindowOpenHandler(handler)</code></a></h4>\n<ul>\n<li>\n<p><code>handler</code> Function&#x3C;{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}></p>\n<ul>\n<li>Objet <code>details</code><ul>\n<li><code>url</code>Fiche-La _version_resolue du URL envoyee a<code>fenetre.ouverte{}</code>. par ex. ouvrir une fenetre avec<code>fenetre.ouverte ('foo')</code>va generer une chose comme<code>https://the-origin/the/current/path/foo</code>.</li>\n<li><code>Nommarge</code>Fiche-Nom de fenetre fourni a <code>window.open=fenetre.ouverte()</code></li>\n<li><code>traits</code>Fiche-Une liste de traits de fenetre separee par comas, a ete fournie a<code>window.open()</code>.</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> or <code>other</code>.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - Le parrain qui sera passé à la nouvelle fenêtre. Peut ou ne peut pas entraîner l'envoi de l'en-tête <code>Référent</code> en fonction de la politique du référent.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that will be sent to the new window, along with the appropriate headers that will be set. If no post data is to be sent, the value will be <code>null</code>. Only defined when the window is being created by a form that set <code>target=_blank</code>.</li>\n</ul></li>\n</ul>\n<p>Va donner <code>{action: 'deny'} | {action: 'permettre', surpasserOptionsduNavigateurFenetreBrowser?: OptionsConstructeurNavigateursFenetre}</code>- - <code>refuser</code> va supprimer la creation dans la fenetre nouvelle. <code>permettre</code>va permettre la creation d'une fenetre nouvelle. Specifying <code>overrideBrowserWindowOptions</code> allows customization of the created window. Returning an unrecognized value such as a null, undefined, or an object without a recognized 'action' value will result in a console error and have the same effect as returning <code>{action: 'deny'}</code>.</p>\n</li>\n</ul>\n<p>Called before creating a window a new window is requested by the renderer, e.g. by <code>window.open()</code>, a link with <code>target=\"_blank\"</code>, shift+clicking on a link, or submitting a form with <code>&#x3C;form target=\"_blank\"></code>. See <a href=\"/docs/api/window-open\"><code>window.open()</code></a> for more details and how to use this in conjunction with <code>did-create-window</code>.</p>\n<h4 id=\"contentssetaudiomutedmuted\"><a href=\"#contentssetaudiomutedmuted\"><code>contents.setAudioMuted(muted)</code></a></h4>\n<ul>\n<li><code>muted</code> Boolean</li>\n</ul>\n<p>Mute the audio on the current web page.</p>\n<h4 id=\"contentsisaudiomuted\"><a href=\"#contentsisaudiomuted\"><code>contents.isAudioMuted()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether this page has been muted.</p>\n<h4 id=\"contentsiscurrentlyaudible\"><a href=\"#contentsiscurrentlyaudible\"><code>contents.isCurrentlyAudible()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether audio is currently playing.</p>\n<h4 id=\"contentssetzoomfactorfactor\"><a href=\"#contentssetzoomfactorfactor\"><code>contents.setZoomFactor(factor)</code></a></h4>\n<ul>\n<li><code>factor</code> Double - Zoom factor; default is 1.0.</li>\n</ul>\n<p>Modifie le facteur de zoom en utilisant le facteur spécifié. Le Zoom factor est égal à la valeur du zoom exprimée en pourcent divisée par 100, donc 300% = 3.0.</p>\n<p>Le rapport doit être supérieur à 0.0.</p>\n<h4 id=\"contentsgetzoomfactor\"><a href=\"#contentsgetzoomfactor\"><code>contents.getZoomFactor()</code></a></h4>\n<p>Returns <code>Number</code> - the current zoom factor.</p>\n<h4 id=\"contentssetzoomlevellevel\"><a href=\"#contentssetzoomlevellevel\"><code>contents.setZoomLevel(level)</code></a></h4>\n<ul>\n<li><code>level</code> Number - Niveau de zoom.</li>\n</ul>\n<p>Modifie le niveau de zoom jusqu'au niveau spécifié. La taille originale est de 0 et chaque incrément au-dessus ou en dessous représente un zoom de 20% supérieur ou inférieure jusqu'au limites de 300% et 50% de la taille originale, respectivement. La formule pour cela est <code>'scale:= 1,2 ^ level</code>.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h4 id=\"contentsgetzoomlevel\"><a href=\"#contentsgetzoomlevel\"><code>contents.getZoomLevel()</code></a></h4>\n<p>Returns <code>Number</code> - the current zoom level.</p>\n<h4 id=\"contentssetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#contentssetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>contents.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h4>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;void></code></p>\n<p>Définit le niveau maximum et minimum le niveau pinch-to-zoom.</p>\n<blockquote>\n<p><strong>NOTE</strong>: Le zoom visuel est désactivé par défaut dans Electron. To re-enable it, call:</p>\n<pre><code class=\"hljs language-js\">contents.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">3</span>)\n</code></pre>\n</blockquote>\n<h4 id=\"contentsundo\"><a href=\"#contentsundo\"><code>contents.undo()</code></a></h4>\n<p>Executes the editing command <code>undo</code> in web page.</p>\n<h4 id=\"contentsredo\"><a href=\"#contentsredo\"><code>contents.redo()</code></a></h4>\n<p>Executes the editing command <code>redo</code> in web page.</p>\n<h4 id=\"contentscut\"><a href=\"#contentscut\"><code>contents.cut()</code></a></h4>\n<p>Executes the editing command <code>cut</code> in web page.</p>\n<h4 id=\"contentscopy\"><a href=\"#contentscopy\"><code>contents.copy()</code></a></h4>\n<p>Executes the editing command <code>copy</code> in web page.</p>\n<h4 id=\"contentscopyimageatx-y\"><a href=\"#contentscopyimageatx-y\"><code>contents.copyImageAt(x, y)</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Copy the image at the given position to the clipboard.</p>\n<h4 id=\"contentspaste\"><a href=\"#contentspaste\"><code>contents.paste()</code></a></h4>\n<p>Executes the editing command <code>paste</code> in web page.</p>\n<h4 id=\"contentspasteandmatchstyle\"><a href=\"#contentspasteandmatchstyle\"><code>contents.pasteAndMatchStyle()</code></a></h4>\n<p>Executes the editing command <code>pasteAndMatchStyle</code> in web page.</p>\n<h4 id=\"contentsdelete\"><a href=\"#contentsdelete\"><code>contents.delete()</code></a></h4>\n<p>Executes the editing command <code>delete</code> in web page.</p>\n<h4 id=\"contentsselectall\"><a href=\"#contentsselectall\"><code>contents.selectAll()</code></a></h4>\n<p>Executes the editing command <code>selectAll</code> in web page.</p>\n<h4 id=\"contentsunselect\"><a href=\"#contentsunselect\"><code>contents.unselect()</code></a></h4>\n<p>Executes the editing command <code>unselect</code> in web page.</p>\n<h4 id=\"contentsreplacetext\"><a href=\"#contentsreplacetext\"><code>contents.replace(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes the editing command <code>replace</code> in web page.</p>\n<h4 id=\"contentsreplacemisspellingtext\"><a href=\"#contentsreplacemisspellingtext\"><code>contents.replaceMisspelling(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes the editing command <code>replaceMisspelling</code> in web page.</p>\n<h4 id=\"contentsinserttexttext\"><a href=\"#contentsinserttexttext\"><code>contents.insertText(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;void></code></p>\n<p>Insère le <code>text</code> à l'élément ciblé.</p>\n<h4 id=\"contentsfindinpagetext-options\"><a href=\"#contentsfindinpagetext-options\"><code>contents.findInPage(text[, options])</code></a></h4>\n<ul>\n<li><code>text</code> String - Content to be searched, must not be empty.</li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>forward</code> Boolean (facultatif) - Rechercher soit en avant soit en arrière, la valeur par défaut est <code>true</code>.</li>\n<li><code>findNext</code> Boolean (optional) - Whether to begin a new text finding session with this request. Doit être <code>true</code> pour les requêtes initiales et <code>false</code> pour les requêtes de suivi. Par défaut, <code>faux</code>.</li>\n<li><code>matchCase</code> Boolean (optional) - Whether search should be case-sensitive, defaults to <code>false</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code> - The request id used for the request.</p>\n<p>Starts a request to find all matches for the <code>text</code> in the web page. Le résultat de la requête peut être obtenu en s'abonnant à l'événement <a href=\"/docs/api/web-contents#event-found-in-page\"><code>found-in-page</code></a>.</p>\n<h4 id=\"contentsstopfindinpageaction\"><a href=\"#contentsstopfindinpageaction\"><code>contents.stopFindInPage(action)</code></a></h4>\n<ul>\n<li><code>action</code> String - Specifies the action to take place when ending [<code>webContents.findInPage</code>] request.<ul>\n<li><code>clearSelection</code> - Clear the selection.</li>\n<li><code>keepSelection</code> - Translate the selection into a normal selection.</li>\n<li><code>activateSelection</code> - Focus and click the selection node.</li>\n</ul></li>\n</ul>\n<p>Stops any <code>findInPage</code> request for the <code>webContents</code> with the provided <code>action</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nwebContents.on(<span class=\"hljs-string\">'found-in-page'</span>, (event, result) => {\n  <span class=\"hljs-keyword\">if</span> (result.finalUpdate) webContents.stopFindInPage(<span class=\"hljs-string\">'clearSelection'</span>)\n})\n\n<span class=\"hljs-keyword\">const</span> requestId = webContents.findInPage(<span class=\"hljs-string\">'api'</span>)\n<span class=\"hljs-built_in\">console</span>.log(requestId)\n</code></pre>\n<h4 id=\"contentscapturepagerect\"><a href=\"#contentscapturepagerect\"><code>contents.capturePage([rect])</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (optionnel) - La zone de la page dont on doit réaliser la capture.</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;NativeImage></code> - résout avec une <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Captures a snapshot of the page within <code>rect</code>. Omitting <code>rect</code> will capture the whole visible page.</p>\n<h4 id=\"contentsisbeingcaptured\"><a href=\"#contentsisbeingcaptured\"><code>contents.isBeingCaptured()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether this page is being captured. It returns true when the capturer count is large then 0.</p>\n<h4 id=\"contentsincrementcapturercountsize-stayhidden-stayawake\"><a href=\"#contentsincrementcapturercountsize-stayhidden-stayawake\"><code>contents.incrementCapturerCount([size, stayHidden, stayAwake])</code></a></h4>\n<ul>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) - The preferred size for the capturer.</li>\n<li><code>stayHidden</code> Boolean (optional) -  Keep the page hidden instead of visible.</li>\n<li><code>stayAwake</code> Boolean (optional) -  Keep the system awake instead of allowing it to sleep.</li>\n</ul>\n<p>Increase the capturer count by one. The page is considered visible when its browser window is hidden and the capturer count is non-zero. If you would like the page to stay hidden, you should ensure that <code>stayHidden</code> is set to true.</p>\n<p>This also affects the Page Visibility API.</p>\n<h4 id=\"contentsdecrementcapturercountstayhidden-stayawake\"><a href=\"#contentsdecrementcapturercountstayhidden-stayawake\"><code>contents.decrementCapturerCount([stayHidden, stayAwake])</code></a></h4>\n<ul>\n<li><code>stayHidden</code> Boolean (optional) -  Keep the page in hidden state instead of visible.</li>\n<li><code>stayAwake</code> Boolean (optional) -  Keep the system awake instead of allowing it to sleep.</li>\n</ul>\n<p>Decrease the capturer count by one. The page will be set to hidden or occluded state when its browser window is hidden or occluded and the capturer count reaches zero. If you want to decrease the hidden capturer count instead you should set <code>stayHidden</code> to true.</p>\n<h4 id=\"contentsgetprinters\"><a href=\"#contentsgetprinters\"><code>contents.getPrinters()</code></a></h4>\n<p>Récupère la liste des imprimantes système.</p>\n<p>Returns <a href=\"/docs/api/structures/printer-info\"><code>PrinterInfo[]</code></a></p>\n<h4 id=\"contentsprintoptions-callback\"><a href=\"#contentsprintoptions-callback\"><code>contents.print([options], [callback])</code></a></h4>\n<ul>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>silent</code> Boolean (optional) - Don't ask user for print settings. Par défaut la valeur est <code>false</code>.</li>\n<li><code>printBackground</code> Boolean (optional) - Prints the background color and image of the web page. Par défaut la valeur est <code>false</code>.</li>\n<li><code>deviceName</code> String (optional) - Set the printer device name to use. Must be the system-defined name and not the 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.</li>\n<li><code>color</code> Boolean (optional) - Set whether the printed web page will be in color or grayscale. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>margins</code> Object (facultatif)<ul>\n<li><code>marginType</code> String (optional) - Can be <code>default</code>, <code>none</code>, <code>printableArea</code>, or <code>custom</code>. If <code>custom</code> is chosen, you will also need to specify <code>top</code>, <code>bottom</code>, <code>left</code>, and <code>right</code>.</li>\n<li><code>top</code> Number (optional) - The top margin of the printed web page, in pixels.</li>\n<li><code>bottom</code> Number (optional) - The bottom margin of the printed web page, in pixels.</li>\n<li><code>left</code> Number (optional) - The left margin of the printed web page, in pixels.</li>\n<li><code>right</code> Number (optional) - The right margin of the printed web page, in pixels.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - Whether the web page should be printed in landscape mode. Par défaut la valeur est <code>false</code>.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page.</li>\n<li><code>pagesPerSheet</code> Number (optional) - The number of pages to print per page sheet.</li>\n<li><code>collate</code> Boolean (optional) - Whether the web page should be collated.</li>\n<li><code>copies</code> Number (optional) - The number of copies of the web page to print.</li>\n<li><code>pageRanges</code> Object<a href=\"/docs/api/optional\"></a> - The page range to print. Sur macOS, une seule plage est respectée.<ul>\n<li><code>from</code> Number - Index de la première page à imprimer (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>duplexMode</code> String (optional) - Set the duplex mode of the printed web page. Can be <code>simplex</code>, <code>shortEdge</code>, or <code>longEdge</code>.</li>\n<li><code>dpi</code> Record&#x3C;string, number> (optional)<ul>\n<li><code>horizontal</code> Number (optional) - The horizontal dpi.</li>\n<li><code>vertical</code> Number (optional) - The vertical dpi.</li>\n</ul></li>\n<li><code>header</code> String (optional) - String to be printed as page header.</li>\n<li><code>footer</code> String (optional) - String to be printed as page footer.</li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the printed document. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code>.</li>\n</ul></li>\n<li><code>callback</code> Function (facultatif)<ul>\n<li><code>success</code> Boolean - Indicates success of the print call.</li>\n<li><code>failureReason</code> String - Error description called back if the print fails.</li>\n</ul></li>\n</ul>\n<p>When a custom <code>pageSize</code> is passed, Chromium attempts to validate platform specific minimum values for <code>width_microns</code> and <code>height_microns</code>. Width and height must both be minimum 353 microns but may be higher on some operating systems.</p>\n<p>Prints window's web page. When <code>silent</code> is set to <code>true</code>, Electron will pick the system's default printer if <code>deviceName</code> is empty and the default settings for printing.</p>\n<p>Use <code>page-break-before: always;</code> CSS style to force to print to a new page.</p>\n<p>Exemple d'utilisation :</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> options = {\n  <span class=\"hljs-attr\">silent</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">deviceName</span>: <span class=\"hljs-string\">'My-Printer'</span>,\n  <span class=\"hljs-attr\">pageRanges</span>: [{\n    <span class=\"hljs-attr\">from</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">to</span>: <span class=\"hljs-number\">1</span>\n  }]\n}\nwin.webContents.print(options, (success, errorType) => {\n  <span class=\"hljs-keyword\">if</span> (!success) <span class=\"hljs-built_in\">console</span>.log(errorType)\n})\n</code></pre>\n<h4 id=\"contentsprinttopdfoptions\"><a href=\"#contentsprinttopdfoptions\"><code>contents.printToPDF(options)</code></a></h4>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>headerFooter</code> Record&#x3C;string, string> (optional) - the header and footer for the PDF.<ul>\n<li><code>title</code> String - The title for the PDF header.</li>\n<li><code>url</code> String - the url for the PDF footer.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - <code>true</code> for landscape, <code>false</code> for portrait.</li>\n<li><code>marginsType</code> Integer (optional) - Specifies the type of margins to use. Uses 0 for default margin, 1 for no margin, and 2 for minimum margin.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page. Can range from 0 to 100.</li>\n<li><code>pageRanges</code> Record&#x3C;string, number> (optional) - The page range to print.<ul>\n<li><code>from</code> Number - Index de la première page à imprimer (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the generated PDF. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code> and <code>width</code> in microns.</li>\n<li><code>printBackground</code> Boolean (optional) - Whether to print CSS backgrounds.</li>\n<li><code>printSelectionOnly</code> Boolean (optional) - Whether to print selection only.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Buffer></code> - Resolves with the generated PDF data.</p>\n<p>Prints window's web page as PDF with Chromium's preview printing custom settings.</p>\n<p>The <code>landscape</code> will be ignored if <code>@page</code> CSS at-rule is used in the web page.</p>\n<p>By default, an empty <code>options</code> will be regarded as:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">marginsType</span>: <span class=\"hljs-number\">0</span>,\n  <span class=\"hljs-attr\">printBackground</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">printSelectionOnly</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">landscape</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">pageSize</span>: <span class=\"hljs-string\">'A4'</span>,\n  <span class=\"hljs-attr\">scaleFactor</span>: <span class=\"hljs-number\">100</span>\n}\n</code></pre>\n<p>Use <code>page-break-before: always;</code> CSS style to force to print to a new page.</p>\n<p>An example of <code>webContents.printToPDF</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n<span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\nwin.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n  <span class=\"hljs-comment\">// Use default printing options</span>\n  win.webContents.printToPDF({}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">data</span> =></span> {\n    <span class=\"hljs-keyword\">const</span> pdfPath = path.join(os.homedir(), <span class=\"hljs-string\">'Desktop'</span>, <span class=\"hljs-string\">'temp.pdf'</span>)\n    fs.writeFile(pdfPath, data, (error) => {\n      <span class=\"hljs-keyword\">if</span> (error) <span class=\"hljs-keyword\">throw</span> error\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Wrote PDF successfully to <span class=\"hljs-subst\">${pdfPath}</span>`</span>)\n    })\n  }).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">error</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Failed to write PDF to <span class=\"hljs-subst\">${pdfPath}</span>: `</span>, error)\n  })\n})\n</code></pre>\n<h4 id=\"contentsaddworkspacepath\"><a href=\"#contentsaddworkspacepath\"><code>contents.addWorkSpace(path)</code></a></h4>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Ajoute le chemin spécifié à l'espace de travail des DevTools. Doit être utilisé après la création des DevTools :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.on(<span class=\"hljs-string\">'devtools-opened'</span>, () => {\n  win.webContents.addWorkSpace(__dirname)\n})\n</code></pre>\n<h4 id=\"contentsremoveworkspacepath\"><a href=\"#contentsremoveworkspacepath\"><code>contents.removeWorkSpace(path)</code></a></h4>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Removes the specified path from DevTools workspace.</p>\n<h4 id=\"contentssetdevtoolswebcontentsdevtoolswebcontents\"><a href=\"#contentssetdevtoolswebcontentsdevtoolswebcontents\"><code>contents.setDevToolsWebContents(devToolsWebContents)</code></a></h4>\n<ul>\n<li><code>devToolsWebContents</code> WebContents</li>\n</ul>\n<p>Uses the <code>devToolsWebContents</code> as the target <code>WebContents</code> to show devtools.</p>\n<p>The <code>devToolsWebContents</code> must not have done any navigation, and it should not be used for other purposes after the call.</p>\n<p>By default Electron manages the devtools by creating an internal <code>WebContents</code> with native view, which developers have very limited control of. With the <code>setDevToolsWebContents</code> method, developers can use any <code>WebContents</code> to show the devtools in it, including <code>BrowserWindow</code>, <code>BrowserView</code> and <code>&#x3C;webview></code> tag.</p>\n<p>Note that closing the devtools does not destroy the <code>devToolsWebContents</code>, it is caller's responsibility to destroy <code>devToolsWebContents</code>.</p>\n<p>An example of showing devtools in a <code>&#x3C;webview></code> tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">style</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/css\"</span>></span><span class=\"css\">\n    * { <span class=\"hljs-attribute\">margin</span>: <span class=\"hljs-number\">0</span>; }\n    <span class=\"hljs-selector-id\">#browser</span> { <span class=\"hljs-attribute\">height</span>: <span class=\"hljs-number\">70%</span>; }\n    <span class=\"hljs-selector-id\">#devtools</span> { <span class=\"hljs-attribute\">height</span>: <span class=\"hljs-number\">30%</span>; }\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">style</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"browser\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"devtools\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"about:blank\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n    <span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n    <span class=\"hljs-keyword\">const</span> emittedOnce = <span class=\"hljs-function\">(<span class=\"hljs-params\">element, eventName</span>) =></span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> {\n      element.addEventListener(eventName, event => resolve(event), { <span class=\"hljs-attr\">once</span>: <span class=\"hljs-literal\">true</span> })\n    })\n    <span class=\"hljs-keyword\">const</span> browserView = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'browser'</span>)\n    <span class=\"hljs-keyword\">const</span> devtoolsView = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'devtools'</span>)\n    <span class=\"hljs-keyword\">const</span> browserReady = emittedOnce(browserView, <span class=\"hljs-string\">'dom-ready'</span>)\n    <span class=\"hljs-keyword\">const</span> devtoolsReady = emittedOnce(devtoolsView, <span class=\"hljs-string\">'dom-ready'</span>)\n    <span class=\"hljs-built_in\">Promise</span>.all([browserReady, devtoolsReady]).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      <span class=\"hljs-keyword\">const</span> targetId = browserView.getWebContentsId()\n      <span class=\"hljs-keyword\">const</span> devtoolsId = devtoolsView.getWebContentsId()\n      ipcRenderer.send(<span class=\"hljs-string\">'open-devtools'</span>, targetId, devtoolsId)\n    })\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain, webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'open-devtools'</span>, (event, targetContentsId, devtoolsContentsId) => {\n  <span class=\"hljs-keyword\">const</span> target = webContents.fromId(targetContentsId)\n  <span class=\"hljs-keyword\">const</span> devtools = webContents.fromId(devtoolsContentsId)\n  target.setDevToolsWebContents(devtools)\n  target.openDevTools()\n})\n</code></pre>\n<p>An example of showing devtools in a <code>BrowserWindow</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n<span class=\"hljs-keyword\">let</span> devtools = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  devtools = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  win.webContents.setDevToolsWebContents(devtools.webContents)\n  win.webContents.openDevTools({ <span class=\"hljs-attr\">mode</span>: <span class=\"hljs-string\">'detach'</span> })\n})\n</code></pre>\n<h4 id=\"contentsopendevtoolsoptions\"><a href=\"#contentsopendevtoolsoptions\"><code>contents.openDevTools([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>mode</code> String - Opens the devtools with specified dock state, can be <code>right</code>, <code>bottom</code>, <code>undocked</code>, <code>detach</code>. Defaults to last used dock state. In <code>undocked</code> mode it's possible to dock back. In <code>detach</code> mode it's not.</li>\n<li><code>activate</code> Boolean (optional) - Whether to bring the opened devtools window to the foreground. Par défaut, <code>true</code>.</li>\n</ul></li>\n</ul>\n<p>Ouvre les devtools.</p>\n<p>When <code>contents</code> is a <code>&#x3C;webview></code> tag, the <code>mode</code> would be <code>detach</code> by default, explicitly passing an empty <code>mode</code> can force using last used dock state.</p>\n<h4 id=\"contentsclosedevtools\"><a href=\"#contentsclosedevtools\"><code>contents.closeDevTools()</code></a></h4>\n<p>Ferme les devtools.</p>\n<h4 id=\"contentsisdevtoolsopened\"><a href=\"#contentsisdevtoolsopened\"><code>contents.isDevToolsOpened()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si les devtools sont ouvert.</p>\n<h4 id=\"contentsisdevtoolsfocused\"><a href=\"#contentsisdevtoolsfocused\"><code>contents.isDevToolsFocused()</code></a></h4>\n<p>Retourne <code>Boolean</code> - Si les devtools ont le focus.</p>\n<h4 id=\"contentstoggledevtools\"><a href=\"#contentstoggledevtools\"><code>contents.toggleDevTools()</code></a></h4>\n<p>Active/désactive les outils développeur.</p>\n<h4 id=\"contentsinspectelementx-y\"><a href=\"#contentsinspectelementx-y\"><code>contents.inspectElement(x, y)</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Starts inspecting element at position (<code>x</code>, <code>y</code>).</p>\n<h4 id=\"contentsinspectsharedworker\"><a href=\"#contentsinspectsharedworker\"><code>contents.inspectSharedWorker()</code></a></h4>\n<p>Opens the developer tools for the shared worker context.</p>\n<h4 id=\"contentsinspectsharedworkerbyidworkerid\"><a href=\"#contentsinspectsharedworkerbyidworkerid\"><code>contents.inspectSharedWorkerById(workerId)</code></a></h4>\n<ul>\n<li><code>workerId</code> String</li>\n</ul>\n<p>Inspects the shared worker based on its ID.</p>\n<h4 id=\"contentsgetallsharedworkers\"><a href=\"#contentsgetallsharedworkers\"><code>contents.getAllSharedWorkers()</code></a></h4>\n<p>Returns <a href=\"/docs/api/structures/shared-worker-info\"><code>SharedWorkerInfo[]</code></a> - Information about all Shared Workers.</p>\n<h4 id=\"contentsinspectserviceworker\"><a href=\"#contentsinspectserviceworker\"><code>contents.inspectServiceWorker()</code></a></h4>\n<p>Opens the developer tools for the service worker context.</p>\n<h4 id=\"contentssendchannel-args\"><a href=\"#contentssendchannel-args\"><code>contents.send(channel, ...args)</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to the renderer process via <code>channel</code>, along with arguments. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE</strong>: Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n</blockquote>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>An example of sending messages from the main process to the renderer process:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Dans le processus main.</span>\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/index.html`</span>)\n  win.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n    win.webContents.send(<span class=\"hljs-string\">'ping'</span>, <span class=\"hljs-string\">'whoooooooh!'</span>)\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- index.html --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n    <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).ipcRenderer.on(<span class=\"hljs-string\">'ping'</span>, (event, message) => {\n      <span class=\"hljs-built_in\">console</span>.log(message) <span class=\"hljs-comment\">// Prints 'whoooooooh!'</span>\n    })\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<h4 id=\"contentssendtoframeframeid-channel-args\"><a href=\"#contentssendtoframeframeid-channel-args\"><code>contents.sendToFrame(frameId, channel, ...args)</code></a></h4>\n<ul>\n<li><code>frameId</code> Integer | [number, number] - the ID of the frame to send to, or a pair of <code>[processId, frameId]</code> if the frame is in a different process to the main frame.</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to a specific frame in a renderer process via <code>channel</code>, along with arguments. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n</blockquote>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>If you want to get the <code>frameId</code> of a given renderer context you should use the <code>webFrame.routingId</code> value.  Exemple :</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// In a renderer process</span>\n<span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'My frameId is:'</span>, <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).webFrame.routingId)\n</code></pre>\n<p>You can also read <code>frameId</code> from all incoming IPC messages in the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// In the main process</span>\nipcMain.on(<span class=\"hljs-string\">'ping'</span>, (event) => {\n  <span class=\"hljs-built_in\">console</span>.info(<span class=\"hljs-string\">'Message came from frameId:'</span>, event.frameId)\n})\n</code></pre>\n<h4 id=\"contentspostmessagechannel-message-transfer\"><a href=\"#contentspostmessagechannel-message-transfer\"><code>contents.postMessage(channel, message, [transfer])</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> tous</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Envoie un message au processus de rendu en effectuant éventuellement un transfert de propriété de zéro ou plus objets de type [<code>MessagePortMain</code>][].</p>\n<p>Les objets <code>MessagePortMain</code> transférés seront disponibles dans le processus de rendu en accédant à la propriété <code>ports</code> de l'événement émis. Ils seront des objets DOM <code>MessagePort</code> natifs en arrivant dans le moteur de rendu.</p>\n<p>Par exemple :</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nwebContents.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<h4 id=\"contentsenabledeviceemulationparameters\"><a href=\"#contentsenabledeviceemulationparameters\"><code>contents.enableDeviceEmulation(parameters)</code></a></h4>\n<ul>\n<li>Objet <code>parameters</code><ul>\n<li><code>screenPosition</code> String - Specify the screen type to emulate (default: <code>desktop</code>):<ul>\n<li><code>desktop</code> - Desktop screen type.</li>\n<li><code>mobile</code> - Mobile screen type.</li>\n</ul></li>\n<li><code>screenSize</code> <a href=\"/docs/api/structures/size\">Size</a> - Set the emulated screen size (screenPosition == mobile).</li>\n<li><code>viewPosition</code> <a href=\"/docs/api/structures/point\">Point</a> - Position the view on the screen (screenPosition == mobile) (default: <code>{ x: 0, y: 0 }</code>).</li>\n<li><code>deviceScaleFactor</code> Integer - Set the device scale factor (if zero defaults to original device scale factor) (default: <code>0</code>).</li>\n<li><code>viewSize</code> <a href=\"/docs/api/structures/size\">Size</a> - Set the emulated view size (empty means no override)</li>\n<li><code>scale</code> Float - Scale of emulated view inside available space (not in fit to view mode) (default: <code>1</code>).</li>\n</ul></li>\n</ul>\n<p>Enable device emulation with the given parameters.</p>\n<h4 id=\"contentsdisabledeviceemulation\"><a href=\"#contentsdisabledeviceemulation\"><code>contents.disableDeviceEmulation()</code></a></h4>\n<p>Disable device emulation enabled by <code>webContents.enableDeviceEmulation</code>.</p>\n<h4 id=\"contentssendinputeventinputevent\"><a href=\"#contentssendinputeventinputevent\"><code>contents.sendInputEvent(inputEvent)</code></a></h4>\n<ul>\n<li><code>inputEvent</code> <a href=\"/docs/api/structures/mouse-input-event\">MouseInputEvent</a> | <a href=\"/docs/api/structures/mouse-wheel-input-event\">MouseWheelInputEvent</a> | <a href=\"/docs/api/structures/keyboard-input-event\">KeyboardInputEvent</a></li>\n</ul>\n<p>Sends an input <code>event</code> to the page. <strong>Note:</strong> The <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> containing the contents needs to be focused for <code>sendInputEvent()</code> to work.</p>\n<h4 id=\"contentsbeginframesubscriptiononlydirty-callback\"><a href=\"#contentsbeginframesubscriptiononlydirty-callback\"><code>contents.beginFrameSubscription([onlyDirty ,]callback)</code></a></h4>\n<ul>\n<li><code>onlyDirty</code> Boolean (optionnel) - <code>false</code> par défaut.</li>\n<li><code>callback</code> Function<ul>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a></li>\n<li><code>dirtyRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul></li>\n</ul>\n<p>Begin subscribing for presentation events and captured frames, the <code>callback</code> will be called with <code>callback(image, dirtyRect)</code> when there is a presentation event.</p>\n<p>The <code>image</code> is an instance of <a href=\"/docs/api/native-image\">NativeImage</a> that stores the captured frame.</p>\n<p>The <code>dirtyRect</code> is an object with <code>x, y, width, height</code> properties that describes which part of the page was repainted. If <code>onlyDirty</code> is set to <code>true</code>, <code>image</code> will only contain the repainted area. <code>onlyDirty</code> defaults to <code>false</code>.</p>\n<h4 id=\"contentsendframesubscription\"><a href=\"#contentsendframesubscription\"><code>contents.endFrameSubscription()</code></a></h4>\n<p>End subscribing for frame presentation events.</p>\n<h4 id=\"contentsstartdragitem\"><a href=\"#contentsstartdragitem\"><code>contents.startDrag(item)</code></a></h4>\n<ul>\n<li>Objet <code>item</code><ul>\n<li><code>file</code> String - The path to the file being dragged.</li>\n<li><code>files</code> String<a href=\"/docs/api/optional\"></a> - The paths to the files being dragged. (<code>files</code> will override <code>file</code> field)</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String - The image must be non-empty on macOS.</li>\n</ul></li>\n</ul>\n<p>Sets the <code>item</code> as dragging item for current drag-drop operation, <code>file</code> is the absolute path of the file to be dragged, and <code>icon</code> is the image showing under the cursor when dragging.</p>\n<h4 id=\"contentssavepagefullpath-savetype\"><a href=\"#contentssavepagefullpath-savetype\"><code>contents.savePage(fullPath, saveType)</code></a></h4>\n<ul>\n<li><code>fullPath</code> String - The full file path.</li>\n<li><code>saveType</code> String - Specify the save type.<ul>\n<li><code>HTMLOnly</code> - Save only the HTML of the page.</li>\n<li><code>HTMLComplete</code> - Save complete-html page.</li>\n<li><code>MHTML</code> - Save complete-html page as MHTML.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves if the page is saved.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\nwin.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  win.webContents.savePage(<span class=\"hljs-string\">'/tmp/test.html'</span>, <span class=\"hljs-string\">'HTMLComplete'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Page was saved successfully.'</span>)\n  }).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(err)\n  })\n})\n</code></pre>\n<h4 id=\"contentsshowdefinitionforselection-macos\"><a href=\"#contentsshowdefinitionforselection-macos\"><code>contents.showDefinitionForSelection()</code> <em>macOS</em></a></h4>\n<p>Shows pop-up dictionary that searches the selected word on the page.</p>\n<h4 id=\"contentsisoffscreen\"><a href=\"#contentsisoffscreen\"><code>contents.isOffscreen()</code></a></h4>\n<p>Returns <code>Boolean</code> - Indicates whether <em>offscreen rendering</em> is enabled.</p>\n<h4 id=\"contentsstartpainting\"><a href=\"#contentsstartpainting\"><code>contents.startPainting()</code></a></h4>\n<p>If <em>offscreen rendering</em> is enabled and not painting, start painting.</p>\n<h4 id=\"contentsstoppainting\"><a href=\"#contentsstoppainting\"><code>contents.stopPainting()</code></a></h4>\n<p>If <em>offscreen rendering</em> is enabled and painting, stop painting.</p>\n<h4 id=\"contentsispainting\"><a href=\"#contentsispainting\"><code>contents.isPainting()</code></a></h4>\n<p>Returns <code>Boolean</code> - If <em>offscreen rendering</em> is enabled returns whether it is currently painting.</p>\n<h4 id=\"contentssetframeratefps\"><a href=\"#contentssetframeratefps\"><code>contents.setFrameRate(fps)</code></a></h4>\n<ul>\n<li><code>fps</code> Integer</li>\n</ul>\n<p>If <em>offscreen rendering</em> is enabled sets the frame rate to the specified number. Only values between 1 and 240 are accepted.</p>\n<h4 id=\"contentsgetframerate\"><a href=\"#contentsgetframerate\"><code>contents.getFrameRate()</code></a></h4>\n<p>Returns <code>Integer</code> - If <em>offscreen rendering</em> is enabled returns the current frame rate.</p>\n<h4 id=\"contentsinvalidate\"><a href=\"#contentsinvalidate\"><code>contents.invalidate()</code></a></h4>\n<p>Schedules a full repaint of the window this web contents is in.</p>\n<p>If <em>offscreen rendering</em> is enabled invalidates the frame and generates a new one through the <code>'paint'</code> event.</p>\n<h4 id=\"contentsgetwebrtciphandlingpolicy\"><a href=\"#contentsgetwebrtciphandlingpolicy\"><code>contents.getWebRTCIPHandlingPolicy()</code></a></h4>\n<p>Returns <code>String</code> - Returns the WebRTC IP Handling Policy.</p>\n<h4 id=\"contentssetwebrtciphandlingpolicypolicy\"><a href=\"#contentssetwebrtciphandlingpolicypolicy\"><code>contents.setWebRTCIPHandlingPolicy(policy)</code></a></h4>\n<ul>\n<li><code>policy</code> String - Specify the WebRTC IP Handling Policy.<ul>\n<li><code>default</code> - Exposes user's public and local IPs. C’est le comportement par défaut. When this policy is used, WebRTC has the right to enumerate all interfaces and bind them to discover public interfaces.</li>\n<li><code>default_public_interface_only</code> - Exposes user's public IP, but does not expose user's local IP. When this policy is used, WebRTC should only use the default route used by http. This doesn't expose any local addresses.</li>\n<li><code>default_public_and_private_interfaces</code> - Exposes user's public and local IPs. When this policy is used, WebRTC should only use the default route used by http. This also exposes the associated default private address. Default route is the route chosen by the OS on a multi-homed endpoint.</li>\n<li><code>disable_non_proxied_udp</code> - Does not expose public or local IPs. When this policy is used, WebRTC should only use TCP to contact peers or servers unless the proxy server supports UDP.</li>\n</ul></li>\n</ul>\n<p>Setting the WebRTC IP handling policy allows you to control which IPs are exposed via WebRTC. See <a href=\"https://browserleaks.com/webrtc\">BrowserLeaks</a> for more details.</p>\n<h4 id=\"contentsgetosprocessid\"><a href=\"#contentsgetosprocessid\"><code>contents.getOSProcessId()</code></a></h4>\n<p>Returns <code>Integer</code> - The operating system <code>pid</code> of the associated renderer process.</p>\n<h4 id=\"contentsgetprocessid\"><a href=\"#contentsgetprocessid\"><code>contents.getProcessId()</code></a></h4>\n<p>Returns <code>Integer</code> - The Chromium internal <code>pid</code> of the associated renderer. Can be compared to the <code>frameProcessId</code> passed by frame specific navigation events (e.g. <code>did-frame-navigate</code>)</p>\n<h4 id=\"contentstakeheapsnapshotfilepath\"><a href=\"#contentstakeheapsnapshotfilepath\"><code>contents.takeHeapSnapshot(filePath)</code></a></h4>\n<ul>\n<li><code>filePath</code> String - Chemin vers le fichier de sortie.</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;void></code> - Indique si l'instantané a été créé avec succès.</p>\n<p>Prend un instantané de tas V8 et l'enregistre dans <code>filePath</code>.</p>\n<h4 id=\"contentsgetbackgroundthrottling\"><a href=\"#contentsgetbackgroundthrottling\"><code>contents.getBackgroundThrottling()</code></a></h4>\n<p>Returns <code>Boolean</code> - whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentssetbackgroundthrottlingallowed\"><a href=\"#contentssetbackgroundthrottlingallowed\"><code>contents.setBackgroundThrottling(allowed)</code></a></h4>\n<ul>\n<li><code>allowed</code> Boolean</li>\n</ul>\n<p>Controls whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentsgettype\"><a href=\"#contentsgettype\"><code>contents.getType()</code></a></h4>\n<p>Returns <code>String</code> - the type of the webContent. Can be <code>backgroundPage</code>, <code>window</code>, <code>browserView</code>, <code>remote</code>, <code>webview</code> or <code>offscreen</code>.</p>\n<h4 id=\"contentssetimageanimationpolicypolicy\"><a href=\"#contentssetimageanimationpolicypolicy\"><code>contents.setImageAnimationPolicy(policy)</code></a></h4>\n<ul>\n<li><code>policy</code> Chaîne de caratères - Peut être <code>animate</code>, <code>animateOnce</code> ou <code>noAnimation</code>.</li>\n</ul>\n<p>Sets the image animation policy for this webContents.  The policy only affects <em>new</em> images, existing images that are currently being animated are unaffected. This is a known limitation in Chromium, you can force image animation to be recalculated with <code>img.src = img.src</code> which will result in no network traffic but will update the animation policy.</p>\n<p>This corresponds to the <a href=\"https://developer.chrome.com/docs/extensions/reference/accessibilityFeatures/#property-animationPolicy\">animationPolicy</a> accessibility feature in Chromium.</p>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<h4 id=\"contentsaudiomuted\"><a href=\"#contentsaudiomuted\"><code>contents.audioMuted</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether this page is muted.</p>\n<h4 id=\"contentsuseragent\"><a href=\"#contentsuseragent\"><code>contents.userAgent</code></a></h4>\n<p>A <code>String</code> property that determines the user agent for this web page.</p>\n<h4 id=\"contentszoomlevel\"><a href=\"#contentszoomlevel\"><code>contents.zoomLevel</code></a></h4>\n<p>A <code>Number</code> property that determines the zoom level for this web contents.</p>\n<p>The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. The formula for this is <code>scale := 1.2 ^ level</code>.</p>\n<h4 id=\"contentszoomfactor\"><a href=\"#contentszoomfactor\"><code>contents.zoomFactor</code></a></h4>\n<p>A <code>Number</code> property that determines the zoom factor for this web contents.</p>\n<p>The zoom factor is the zoom percent divided by 100, so 300% = 3.0.</p>\n<h4 id=\"contentsframerate\"><a href=\"#contentsframerate\"><code>contents.frameRate</code></a></h4>\n<p>An <code>Integer</code> property that sets the frame rate of the web contents to the specified number. Only values between 1 and 240 are accepted.</p>\n<p>Only applicable if <em>offscreen rendering</em> is enabled.</p>\n<h4 id=\"contentsid-lecture-seule\"><a href=\"#contentsid-lecture-seule\"><code>contents.id</code> <em>Lecture seule</em></a></h4>\n<p>A <code>Integer</code> representing the unique ID of this WebContents. Chaque ID est unique parmi ceux des instances de <code>WebContents</code> de l'application Electron.</p>\n<h4 id=\"contentssession-lecture-seule\"><a href=\"#contentssession-lecture-seule\"><code>contents.session</code> <em>Lecture seule</em></a></h4>\n<p>A <a href=\"/docs/api/session\"><code>Session</code></a> used by this webContents.</p>\n<h4 id=\"contentshostwebcontents-lecture-seule\"><a href=\"#contentshostwebcontents-lecture-seule\"><code>contents.hostWebContents</code> <em>Lecture seule</em></a></h4>\n<p>A <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> instance that might own this <code>WebContents</code>.</p>\n<h4 id=\"contentsdevtoolswebcontents-lecture-seule\"><a href=\"#contentsdevtoolswebcontents-lecture-seule\"><code>contents.devToolsWebContents</code> <em>Lecture seule</em></a></h4>\n<p>A <code>WebContents | null</code> property that represents the of DevTools <code>WebContents</code> associated with a given <code>WebContents</code>.</p>\n<p><strong>Note:</strong> Users should never store this object because it may become <code>null</code> when the DevTools has been closed.</p>\n<h4 id=\"contentsdebugger-lecture-seule\"><a href=\"#contentsdebugger-lecture-seule\"><code>contents.debugger</code> <em>Lecture seule</em></a></h4>\n<p>A <a href=\"/docs/api/debugger\"><code>Debugger</code></a> instance for this webContents.</p>\n<h4 id=\"contentsbackgroundthrottling\"><a href=\"#contentsbackgroundthrottling\"><code>contents.backgroundThrottling</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentsmainframe-lecture-seule\"><a href=\"#contentsmainframe-lecture-seule\"><code>contents.mainFrame</code> <em>Lecture seule</em></a></h4>\n<p>A <a href=\"/docs/api/web-frame-main\"><code>WebFrameMain</code></a> property that represents the top frame of the page's frame hierarchy.</p>",
      "title": "webContents",
      "description": "Fait le rendu et contrôle des pages web."
    },
    "/docs/tutorial/web-embeds": {
      "locale": "fr-FR",
      "slug": "web-embeds",
      "href": "/docs/tutorial/web-embeds",
      "crowdinFileId": "256269",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/web-embeds.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"intégrations-web\"><a href=\"#intégrations-web\">Intégrations Web</a></h1>\n<h2 id=\"vue-densemble\"><a href=\"#vue-densemble\">Vue d'ensemble</a></h2>\n<p>Pour intégrer du contenu web (tiers) dans une <code>BrowserWindow d'Electron</code> vous disposez des trois options suivantes: soit les balises <code>&#x3C;iframe></code> ou <code>&#x3C;webview></code> soit en utilisant les <code>BrowserViews</code>. Chacune offre des fonctionnalités légèrement différentes et utile dans des situations différentes. Pour vous aider dans votre choix, ce guide explique les différences et les capacités de chaque option.</p>\n<h3 id=\"iframes\"><a href=\"#iframes\">Iframes</a></h3>\n<p>Iframes in Electron behave like iframes in regular browsers. Un élément <code>&#x3C;iframe></code> dans votre page peut afficher des pages web externes, à condition que leur <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP\">Content Security Policy</a> le permette. Pour limiter les fonctionnalités d’un site dans une balise <code>&#x3C;iframe></code> , il est recommandé d’utiliser<a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox\"> l’attribut <code>sandbox</code></a> et d’autoriser uniquement les fonctionnalités que vous souhaitez prendre en charge.</p>\n<h3 id=\"webviews\"><a href=\"#webviews\">WebViews</a></h3>\n<blockquote>\n<p>Note importante : <a href=\"/docs/api/webview-tag#warning\">nous vous déconseillons d'utiliser WebViews</a>, car cette balise subit des changements architecturaux dramatiques qui peuvent affecter la stabilité de votre application. Envisagez de basculer vers les alternatives,<code>iframe</code> ,  Electron's <code>BrowserView</code> ou une architecture évitant par sa conception d'embarquer du contenu.</p>\n</blockquote>\n<p><a href=\"/docs/api/webview-tag\">Les WebViews</a> sont basées sur les WebViews de Chromium et ne sont pas explicitement supportés par Electron. Nous ne garantissons pas que l'API WebView restera disponible dans les futures versions d'Electron. Pour utiliser les balises <code>&#x3C;webview></code> , vous devrez définir <code>webviewTag</code> à <code>true</code> dans les <code>webPreferences</code> de votre <code>BrowserWindow</code>.</p>\n<p>WebView est un élément personnalisé (<code>&#x3C;webview></code>) qui ne fonctionnera qu'à l'intérieur d'Electron. They are implemented as an \"out-of-process iframe\". Cela signifie que toute la communication avec la <code>&#x3C;webview></code> est faite de manière asynchrone en utilisant IPC. L'élément <code>&#x3C;webview></code> possède de nombreuses méthodes et événements personnalisés, similaire à <code>webContents</code>, qui vous donnent un grand contrôle sur le contenu.</p>\n<p>Comparé à un <code>&#x3C;iframe></code>, <code>&#x3C;webview></code> tend à être légèrement plus lent, mais offre un contrôle beaucoup plus important dans le chargement et la communication avec le contenu tiers et la gestion de divers événements.</p>\n<h3 id=\"browserviews\"><a href=\"#browserviews\">BrowserViews</a></h3>\n<p><a href=\"/docs/api/browser-view\">Les BrowserViews</a> sont créés et pilotés par votre processus principal et ne font pas partie du DOM . Ils sont simplement une couche supplémentaire de contenu web au dessus de votre fenêtre existante. Cela signifie qu'ils sont complètement séparés du contenu de votre <code>BrowserWindow</code> et leur position n'est contrôlée ni par le DOM ni par le CSS. Au lieu de cela, elle est contrôlée en définissant les limites dans le processus principal.</p>\n<p><code>BrowserViews</code> offre le meilleur contrôle sur leur contenu, car ils implémentent le <code>webContents</code> de la même façon que la <code>BrowserWindow</code>. Cependant, comme les <code>BrowserViews</code> ne font pas partie de votre DOM étant plutôt superposés par dessus , vous devrez gérer leur position manuellement.</p>",
      "title": "Intégrations Web",
      "description": "Note importante : nous vous déconseillons d'utiliser WebViews, car cette balise subit des changements architecturaux dramatiques qui peuvent affecter la stabilité de votre application. Envisagez de basculer vers les alternatives,iframe ,  Electron's BrowserView ou une architecture évitant par sa conception d'embarquer du contenu."
    },
    "/docs/api/web-frame": {
      "locale": "fr-FR",
      "slug": "web-frame",
      "href": "/docs/api/web-frame",
      "crowdinFileId": "256403",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-frame.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webframe\"><a href=\"#webframe\">webFrame</a></h1>\n<blockquote>\n<p>Personnaliser le rendu de la page web actuelle.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p><code>webFrame</code> export of the Electron module is an instance of the <code>WebFrame</code> class representing the top frame of the current <code>BrowserWindow</code>. Sub-frames can be retrieved by certain properties and methods (e.g. <code>webFrame.firstChild</code>).</p>\n<p>Un exemple d'un zoom de 200% de la page actuelle.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nwebFrame.setZoomFactor(<span class=\"hljs-number\">2</span>)\n</code></pre>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>The <code>WebFrame</code> class has the following instance methods:</p>\n<h3 id=\"webframesetzoomfactorfactor\"><a href=\"#webframesetzoomfactorfactor\"><code>webFrame.setZoomFactor(factor)</code></a></h3>\n<ul>\n<li><code>factor</code> Double - Zoom factor; default is 1.0.</li>\n</ul>\n<p>Modifie le facteur de zoom en utilisant le facteur spécifié. Le Zoom factor est égal à la valeur du zoom exprimée en pourcent divisée par 100, donc 300% = 3.0.</p>\n<p>Le rapport doit être supérieur à 0.0.</p>\n<h3 id=\"webframegetzoomfactor\"><a href=\"#webframegetzoomfactor\"><code>webFrame.getZoomFactor()</code></a></h3>\n<p>Retourne <code>Number</code> - Le facteur de zoom actuel.</p>\n<h3 id=\"webframesetzoomlevellevel\"><a href=\"#webframesetzoomlevellevel\"><code>webFrame.setZoomLevel(level)</code></a></h3>\n<ul>\n<li><code>level</code> Number - Niveau de zoom.</li>\n</ul>\n<p>Modifie le niveau de zoom jusqu'au niveau spécifié. La taille originale est de 0 et chaque incrément au-dessus ou en dessous représente un zoom de 20% supérieur ou inférieure jusqu'au limites de 300% et 50% de la taille originale, respectivement.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h3 id=\"webframegetzoomlevel\"><a href=\"#webframegetzoomlevel\"><code>webFrame.getZoomLevel()</code></a></h3>\n<p>Retourne <code>Number</code> - Le niveau de zoom actuel.</p>\n<h3 id=\"webframesetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#webframesetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>webFrame.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h3>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>Définit le niveau maximum et minimum le niveau pinch-to-zoom.</p>\n<blockquote>\n<p><strong>NOTE</strong>: Le zoom visuel est désactivé par défaut dans Electron. To re-enable it, call:</p>\n<pre><code class=\"hljs language-js\">webFrame.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">3</span>)\n</code></pre>\n</blockquote>\n<blockquote>\n<p><strong>NOTE</strong>: Le zoom visuel s'applique uniquement au comportement pinch-to-zoom. Les raccourcis de zoom Cmd+/-/0 sont contrôlés par les rôles des MenuItem 'zoomIn', 'zoomOut' et 'resetZoom' dans le menu de l'application. Pour désactiver les raccourcis, <a href=\"/docs/api/menu#examples\">définissez manuellement le Menu</a> et omettez les rôles de zoom de la définition.</p>\n</blockquote>\n<h3 id=\"webframesetspellcheckproviderlanguage-provider\"><a href=\"#webframesetspellcheckproviderlanguage-provider\"><code>webFrame.setSpellCheckProvider(language, provider)</code></a></h3>\n<ul>\n<li><code>language</code> String</li>\n<li>Objet <code>provider</code><ul>\n<li><code>spellCheck</code> Function<ul>\n<li><code>words</code> String[]</li>\n<li><code>callback</code> Function<ul>\n<li><code>misspeltWords</code> String[]</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Définit un fournisseur pour la correction orthographique dans les champs de saisie et les zones de texte.</p>\n<p>If you want to use this method you must disable the builtin spellchecker when you construct the window.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">spellcheck</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\n</code></pre>\n<p>The <code>provider</code> must be an object that has a <code>spellCheck</code> method that accepts an array of individual words for spellchecking. The <code>spellCheck</code> function runs asynchronously and calls the <code>callback</code> function with an array of misspelt words when complete.</p>\n<p>Un exemple d'utilisation de <a href=\"https://github.com/atom/node-spellchecker\">node-spellchecker</a> comme fournisseur :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> spellChecker = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spellchecker'</span>)\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, {\n  spellCheck (words, callback) {\n    setTimeout(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      <span class=\"hljs-keyword\">const</span> spellchecker = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spellchecker'</span>)\n      <span class=\"hljs-keyword\">const</span> misspelled = words.filter(<span class=\"hljs-function\"><span class=\"hljs-params\">x</span> =></span> spellchecker.isMisspelled(x))\n      callback(misspelled)\n    }, <span class=\"hljs-number\">0</span>)\n  }\n})\n</code></pre>\n<h3 id=\"webframeinsertcsscss\"><a href=\"#webframeinsertcsscss\"><code>webFrame.insertCSS(css)</code></a></h3>\n<ul>\n<li><code>css</code> String - CSS source code.</li>\n</ul>\n<p>Returns <code>String</code> - A key for the inserted CSS that can later be used to remove the CSS via <code>webFrame.removeInsertedCSS(key)</code>.</p>\n<p>Injecte du CSS dans la page Web actuelle et renvoie une clé unique pour la feuille de style insérée .</p>\n<h3 id=\"webframeremoveinsertedcsskey\"><a href=\"#webframeremoveinsertedcsskey\"><code>webFrame.removeInsertedCSS(key)</code></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from <code>webFrame.insertCSS(css)</code>.</p>\n<h3 id=\"webframeinserttexttext\"><a href=\"#webframeinserttexttext\"><code>webFrame.insertText(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Insère le <code>text</code> à l'élément ciblé.</p>\n<h3 id=\"webframeexecutejavascriptcode-usergesture-callback\"><a href=\"#webframeexecutejavascriptcode-usergesture-callback\"><code>webFrame.executeJavaScript(code[, userGesture, callback])</code></a></h3>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (facultatif) - <code>false</code> par défaut.</li>\n<li><code>callback</code> Function (optional) - Called after script has been executed. Unless the frame is suspended (e.g. showing a modal alert), execution will be synchronous and the callback will be invoked before the method returns. For compatibility with an older version of this method, the error parameter is second.<ul>\n<li><code>result</code> Any</li>\n<li><code>error</code> Error</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if execution throws or results in a rejected promise.</p>\n<p>Évalue le <code>code</code> dans la page.</p>\n<p>Dans la fenêtre du navigateur, certaines APIs HTML comme <code>requestFullScreen</code> peut être invoqué seulement par un geste de l'utilisateur. Définir <code>userGesture</code> à <code>true</code> supprimera cette limitation.</p>\n<h3 id=\"webframeexecutejavascriptinisolatedworldworldid-scripts-usergesture-callback\"><a href=\"#webframeexecutejavascriptinisolatedworldworldid-scripts-usergesture-callback\"><code>webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture, callback])</code></a></h3>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default main world (where content runs), <code>999</code> is the world used by Electron's <code>contextIsolation</code> feature. Accepts values in the range 1..536870911.</li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/web-source\">WebSource[]</a></li>\n<li><code>userGesture</code> Boolean (facultatif) - <code>false</code> par défaut.</li>\n<li><code>callback</code> Function (optional) - Called after script has been executed. Unless the frame is suspended (e.g. showing a modal alert), execution will be synchronous and the callback will be invoked before the method returns.  For compatibility with an older version of this method, the error parameter is second.<ul>\n<li><code>result</code> Any</li>\n<li><code>error</code> Error</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if execution could not start.</p>\n<p>Works like <code>executeJavaScript</code> but evaluates <code>scripts</code> in an isolated context.</p>\n<p>Note that when the execution of script fails, the returned promise will not reject and the <code>result</code> would be <code>undefined</code>. This is because Chromium does not dispatch errors of isolated worlds to foreign worlds.</p>\n<h3 id=\"webframesetisolatedworldinfoworldid-info\"><a href=\"#webframesetisolatedworldinfoworldid-info\"><code>webFrame.setIsolatedWorldInfo(worldId, info)</code></a></h3>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default world, <code>999</code> is the world used by Electrons <code>contextIsolation</code> feature. Chrome extensions reserve the range of IDs in <code>[1 &#x3C;&#x3C; 20, 1 &#x3C;&#x3C; 29)</code>. You can provide any integer here.</li>\n<li>Objet <code>info</code><ul>\n<li><code>securityOrigin</code> String (optional) - Security origin for the isolated world.</li>\n<li><code>csp</code> String (optional) - Content Security Policy for the isolated world.</li>\n<li><code>name</code> String (optional) - Name for isolated world. Useful in devtools.</li>\n</ul></li>\n</ul>\n<p>Set the security origin, content security policy and name of the isolated world. Note: If the <code>csp</code> is specified, then the <code>securityOrigin</code> also has to be specified.</p>\n<h3 id=\"webframegetresourceusage\"><a href=\"#webframegetresourceusage\"><code>webFrame.getResourceUsage()</code></a></h3>\n<p>Retourne <code>Object</code>:</p>\n<ul>\n<li><code>images</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>cssStyleSheets</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>xslStyleSheets</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>fonts</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>other</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n</ul>\n<p>Retourne un objet décrivant les informations d'utilisation de caches de mémoire interne de Blink.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(webFrame.getResourceUsage())\n</code></pre>\n<p>Cela va générer :</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">images</span>: {\n    <span class=\"hljs-attr\">count</span>: <span class=\"hljs-number\">22</span>,\n    <span class=\"hljs-attr\">size</span>: <span class=\"hljs-number\">2549</span>,\n    <span class=\"hljs-attr\">liveSize</span>: <span class=\"hljs-number\">2542</span>\n  },\n  <span class=\"hljs-attr\">cssStyleSheets</span>: { <span class=\"hljs-comment\">/* pareil qu'avec \"images\" */</span> },\n  <span class=\"hljs-attr\">xslStyleSheets</span>: { <span class=\"hljs-comment\">/* pareil qu'avec \"images\" */</span> },\n  <span class=\"hljs-attr\">fonts</span>: { <span class=\"hljs-comment\">/* pareil qu'avec \"images\" */</span> },\n  <span class=\"hljs-attr\">other</span>: { <span class=\"hljs-comment\">/* pareil qu'avec \"images\" */</span> }\n}\n</code></pre>\n<h3 id=\"webframeclearcache\"><a href=\"#webframeclearcache\"><code>webFrame.clearCache()</code></a></h3>\n<p>Tente de libérer de la mémoire qui n'est plus utilisée (comme les images d'une navigation précédente).</p>\n<p>Notez que le fait d'appeler aveuglément cette méthode rend probablement Electron plus lent car il devra remplir ces caches vides, vous ne devriez l'appeler que si un événement dans votre application s'est produit vous faisant penser que votre page utilise réellement moins mémoire (c. -à-d. que vous avez navigué d'une page super lourde à une page presque vide, et avez l'intention d'y rester).</p>\n<h3 id=\"webframegetframeforselectorselector\"><a href=\"#webframegetframeforselectorselector\"><code>webFrame.getFrameForSelector(selector)</code></a></h3>\n<ul>\n<li><code>selector</code> String - CSS selector for a frame element.</li>\n</ul>\n<p>Returns <code>WebFrame</code> - The frame element in <code>webFrame's</code> document selected by <code>selector</code>, <code>null</code> would be returned if <code>selector</code> does not select a frame or if the frame is not in the current renderer process.</p>\n<h3 id=\"webframefindframebynamename\"><a href=\"#webframefindframebynamename\"><code>webFrame.findFrameByName(name)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n</ul>\n<p>Returns <code>WebFrame</code> - A child of <code>webFrame</code> with the supplied <code>name</code>, <code>null</code> would be returned if there's no such frame or if the frame is not in the current renderer process.</p>\n<h3 id=\"webframefindframebyroutingidroutingid\"><a href=\"#webframefindframebyroutingidroutingid\"><code>webFrame.findFrameByRoutingId(routingId)</code></a></h3>\n<ul>\n<li><code>routingId</code> Integer - An <code>Integer</code> representing the unique frame id in the current renderer process. Routing IDs can be retrieved from <code>WebFrame</code> instances (<code>webFrame.routingId</code>) and are also passed by frame specific <code>WebContents</code> navigation events (e.g. <code>did-frame-navigate</code>)</li>\n</ul>\n<p>Returns <code>WebFrame</code> - that has the supplied <code>routingId</code>, <code>null</code> if not found.</p>\n<h3 id=\"webframeiswordmisspelledword\"><a href=\"#webframeiswordmisspelledword\"><code>webFrame.isWordMisspelled(word)</code></a></h3>\n<ul>\n<li><code>word</code> String - The word to be spellchecked.</li>\n</ul>\n<p>Returns <code>Boolean</code> - True if the word is misspelled according to the built in spellchecker, false otherwise. If no dictionary is loaded, always return false.</p>\n<h3 id=\"webframegetwordsuggestionsword\"><a href=\"#webframegetwordsuggestionsword\"><code>webFrame.getWordSuggestions(word)</code></a></h3>\n<ul>\n<li><code>word</code> String - The misspelled word.</li>\n</ul>\n<p>Returns <code>String[]</code> - A list of suggested words for a given word. If the word is spelled correctly, the result will be empty.</p>\n<h2 id=\"propriétés\"><a href=\"#propriétés\">Propriétés</a></h2>\n<h3 id=\"webframetop-lecture-seule\"><a href=\"#webframetop-lecture-seule\"><code>webFrame.top</code> <em>Lecture seule</em></a></h3>\n<p>A <code>WebFrame | null</code> representing top frame in frame hierarchy to which <code>webFrame</code> belongs, the property would be <code>null</code> if top frame is not in the current renderer process.</p>\n<h3 id=\"webframeopener-lecture-seule\"><a href=\"#webframeopener-lecture-seule\"><code>webFrame.opener</code> <em>Lecture seule</em></a></h3>\n<p>A <code>WebFrame | null</code> representing the frame which opened <code>webFrame</code>, the property would be <code>null</code> if there's no opener or opener is not in the current renderer process.</p>\n<h3 id=\"webframeparent-lecture-seule\"><a href=\"#webframeparent-lecture-seule\"><code>webFrame.parent</code> <em>Lecture seule</em></a></h3>\n<p>A <code>WebFrame | null</code> representing parent frame of <code>webFrame</code>, the property would be <code>null</code> if <code>webFrame</code> is top or parent is not in the current renderer process.</p>\n<h3 id=\"webframefirstchild-lecture-seule\"><a href=\"#webframefirstchild-lecture-seule\"><code>webFrame.firstChild</code> <em>Lecture seule</em></a></h3>\n<p>A <code>WebFrame | null</code> representing the first child frame of <code>webFrame</code>, the property would be <code>null</code> if <code>webFrame</code> has no children or if first child is not in the current renderer process.</p>\n<h3 id=\"webframenextsibling-lecture-seule\"><a href=\"#webframenextsibling-lecture-seule\"><code>webFrame.nextSibling</code> <em>Lecture seule</em></a></h3>\n<p>A <code>WebFrame | null</code> representing next sibling frame, the property would be <code>null</code> if <code>webFrame</code> is the last frame in its parent or if the next sibling is not in the current renderer process.</p>\n<h3 id=\"webframeroutingid-lecture-seule\"><a href=\"#webframeroutingid-lecture-seule\"><code>webFrame.routingId</code> <em>Lecture seule</em></a></h3>\n<p>An <code>Integer</code> representing the unique frame id in the current renderer process. Distinct WebFrame instances that refer to the same underlying frame will have the same <code>routingId</code>.</p>",
      "title": "webFrame",
      "description": "Personnaliser le rendu de la page web actuelle."
    },
    "/docs/api/web-frame-main": {
      "locale": "fr-FR",
      "slug": "web-frame-main",
      "href": "/docs/api/web-frame-main",
      "crowdinFileId": "256401",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-frame-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webframemain\"><a href=\"#webframemain\">webFrameMain</a></h1>\n<blockquote>\n<p>Control web pages and iframes.</p>\n</blockquote>\n<p>Processus : <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>The <code>webFrameMain</code> module can be used to lookup frames across existing <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> instances. Navigation events are the common use case.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, webFrameMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://twitter.com'</span>)\n\nwin.webContents.on(\n  <span class=\"hljs-string\">'did-frame-navigate'</span>,\n  (event, url, isMainFrame, frameProcessId, frameRoutingId) => {\n    <span class=\"hljs-keyword\">const</span> frame = webFrameMain.fromId(frameProcessId, frameRoutingId)\n    <span class=\"hljs-keyword\">if</span> (frame) {\n      <span class=\"hljs-keyword\">const</span> code = <span class=\"hljs-string\">'document.body.innerHTML = document.body.innerHTML.replaceAll(\"heck\", \"h*ck\")'</span>\n      frame.executeJavaScript(code)\n    }\n  }\n)\n</code></pre>\n<p>You can also access frames of existing pages by using the <code>mainFrame</code> property of <a href=\"/docs/api/web-contents\"><code>WebContents</code></a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">main</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  <span class=\"hljs-keyword\">await</span> win.loadURL(<span class=\"hljs-string\">'https://reddit.com'</span>)\n\n  <span class=\"hljs-keyword\">const</span> youtubeEmbeds = win.webContents.mainFrame.frames.filter(<span class=\"hljs-function\">(<span class=\"hljs-params\">frame</span>) =></span> {\n    <span class=\"hljs-keyword\">try</span> {\n      <span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-keyword\">new</span> URL(frame.url)\n      <span class=\"hljs-keyword\">return</span> url.host === <span class=\"hljs-string\">'www.youtube.com'</span>\n    } <span class=\"hljs-keyword\">catch</span> {\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n    }\n  })\n\n  <span class=\"hljs-built_in\">console</span>.log(youtubeEmbeds)\n}\n\nmain()\n</code></pre>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>These methods can be accessed from the <code>webFrameMain</code> module:</p>\n<h3 id=\"webframemainfromidprocessid-routingid\"><a href=\"#webframemainfromidprocessid-routingid\"><code>webFrameMain.fromId(processId, routingId)</code></a></h3>\n<ul>\n<li><code>processId</code> Integer - An <code>Integer</code> representing the internal ID of the process which owns the frame.</li>\n<li><code>routingId</code> Integer - An <code>Integer</code> representing the unique frame ID in the current renderer process. Routing IDs can be retrieved from <code>WebFrameMain</code> instances (<code>frame.routingId</code>) and are also passed by frame specific <code>WebContents</code> navigation events (e.g. <code>did-frame-navigate</code>).</li>\n</ul>\n<p>Returns <code>WebFrameMain | undefined</code> - A frame with the given process and routing IDs, or <code>undefined</code> if there is no WebFrameMain associated with the given IDs.</p>\n<h2 id=\"class-webframemain\"><a href=\"#class-webframemain\">Class: WebFrameMain</a></h2>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"événements-dinstance\"><a href=\"#événements-dinstance\">Événements d’instance</a></h3>\n<h4 id=\"événement--dom-ready\"><a href=\"#événement--dom-ready\">Événement : 'dom-ready'</a></h4>\n<p>Emitted when the document is loaded.</p>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<h4 id=\"frameexecutejavascriptcode-usergesture\"><a href=\"#frameexecutejavascriptcode-usergesture\"><code>frame.executeJavaScript(code[, userGesture])</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (facultatif) - <code>false</code> par défaut.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;unknown></code> - A promise that resolves with the result of the executed code or is rejected if execution throws or results in a rejected promise.</p>\n<p>Évalue le <code>code</code> dans la page.</p>\n<p>Dans la fenêtre du navigateur, certaines APIs HTML comme <code>requestFullScreen</code> peut être invoqué seulement par un geste de l'utilisateur. Définir <code>userGesture</code> à <code>true</code> supprimera cette limitation.</p>\n<h4 id=\"framereload\"><a href=\"#framereload\"><code>frame.reload()</code></a></h4>\n<p>Returns <code>boolean</code> - Whether the reload was initiated successfully. Only results in <code>false</code> when the frame has no history.</p>\n<h4 id=\"framesendchannel-args\"><a href=\"#framesendchannel-args\"><code>frame.send(channel, ...args)</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to the renderer process via <code>channel</code>, along with arguments. Arguments will be serialized with the [Structured Clone Algorithm][SCA], just like [<code>postMessage</code>][], so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<h4 id=\"framepostmessagechannel-message-transfer\"><a href=\"#framepostmessagechannel-message-transfer\"><code>frame.postMessage(channel, message, [transfer])</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> tous</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Envoie un message au processus de rendu en effectuant éventuellement un transfert de propriété de zéro ou plus objets de type [<code>MessagePortMain</code>][].</p>\n<p>Les objets <code>MessagePortMain</code> transférés seront disponibles dans le processus de rendu en accédant à la propriété <code>ports</code> de l'événement émis. Ils seront des objets DOM <code>MessagePort</code> natifs en arrivant dans le moteur de rendu.</p>\n<p>Par exemple :</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nwebContents.mainFrame.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<h3 id=\"propriétés-dinstance\"><a href=\"#propriétés-dinstance\">Propriétés d'instance</a></h3>\n<h4 id=\"frameurl-readonly\"><a href=\"#frameurl-readonly\"><code>frame.url</code> <em>Readonly</em></a></h4>\n<p>A <code>string</code> representing the current URL of the frame.</p>\n<h4 id=\"frametop-readonly\"><a href=\"#frametop-readonly\"><code>frame.top</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain | null</code> representing top frame in the frame hierarchy to which <code>frame</code> belongs.</p>\n<h4 id=\"frameparent-readonly\"><a href=\"#frameparent-readonly\"><code>frame.parent</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain | null</code> representing parent frame of <code>frame</code>, the property would be <code>null</code> if <code>frame</code> is the top frame in the frame hierarchy.</p>\n<h4 id=\"frameframes-readonly\"><a href=\"#frameframes-readonly\"><code>frame.frames</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain[]</code> collection containing the direct descendents of <code>frame</code>.</p>\n<h4 id=\"frameframesinsubtree-readonly\"><a href=\"#frameframesinsubtree-readonly\"><code>frame.framesInSubtree</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain[]</code> collection containing every frame in the subtree of <code>frame</code>, including itself. This can be useful when traversing through all frames.</p>\n<h4 id=\"frameframetreenodeid-readonly\"><a href=\"#frameframetreenodeid-readonly\"><code>frame.frameTreeNodeId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the id of the frame's internal FrameTreeNode instance. This id is browser-global and uniquely identifies a frame that hosts content. The identifier is fixed at the creation of the frame and stays constant for the lifetime of the frame. When the frame is removed, the id is not used again.</p>\n<h4 id=\"framename-readonly\"><a href=\"#framename-readonly\"><code>frame.name</code> <em>Readonly</em></a></h4>\n<p>A <code>String</code> representing the frame name.</p>\n<h4 id=\"frameosprocessid-readonly\"><a href=\"#frameosprocessid-readonly\"><code>frame.osProcessId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the operating system <code>pid</code> of the process which owns this frame.</p>\n<h4 id=\"frameprocessid-readonly\"><a href=\"#frameprocessid-readonly\"><code>frame.processId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the Chromium internal <code>pid</code> of the process which owns this frame. This is not the same as the OS process ID; to read that use <code>frame.osProcessId</code>.</p>\n<h4 id=\"frameroutingid-readonly\"><a href=\"#frameroutingid-readonly\"><code>frame.routingId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the unique frame id in the current renderer process. Distinct <code>WebFrameMain</code> instances that refer to the same underlying frame will have the same <code>routingId</code>.</p>\n<h4 id=\"framevisibilitystate-lecture-seule\"><a href=\"#framevisibilitystate-lecture-seule\"><code>frame.visibilityState</code> <em>Lecture seule</em></a></h4>\n<p>A <code>string</code> representing the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState\">visibility state</a> of the frame.</p>\n<p>See also how the <a href=\"/docs/api/browser-window#page-visibility\">Page Visibility API</a> is affected by other Electron APIs.</p>",
      "title": "webFrameMain",
      "description": "Control web pages and iframes."
    },
    "/docs/api/web-request": {
      "locale": "fr-FR",
      "slug": "web-request",
      "href": "/docs/api/web-request",
      "crowdinFileId": "256405",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-request.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe--webrequest\"><a href=\"#classe--webrequest\">Classe : WebRequest</a></h2>\n<blockquote>\n<p>Intercepte et modifie le contenu d'une requête à différents stades de son existence.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Les instances de la classe <code>WebRequest</code> sont accessibles à l'aide de la propriété <code>WebRequest</code> d'une <code>Session</code>.</p>\n<p>Les méthodes de <code>WebRequest</code> acceptent un <code>filter</code> et un <code>listener</code> optionnels. Le <code>listener</code> va être appelé avec <code>listener(details)</code> quand l'événement de l'API est émis. L'objet <code>details</code> représente la requête.</p>\n<p>⚠️ Only the last attached <code>listener</code> will be used. Passing <code>null</code> as <code>listener</code> will unsubscribe from the event.</p>\n<p>L'objet <code>filter</code> a une propriété <code>url</code> qui est un tableau de modèles d'URL qui seront utilisés pour filtrer les requêtes qui ne satisfont pas aux modèles. . Si <code>filter</code> est omis, toutes les requêtes seront jugées comme conformes.</p>\n<p>Pour certains événements, le <code>listener</code> est passé accompagné d'une <code>callback</code>, qui devrait être appelée avec un objet <code>response</code>lorsque le <code>listener</code> a fini son travail.</p>\n<p>Un exemple d'ajout de l'en-tête <code>User-Agent</code> pour les requêtes :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Modify the user agent for all requests to the following urls.</span>\n<span class=\"hljs-keyword\">const</span> filter = {\n  <span class=\"hljs-attr\">urls</span>: [<span class=\"hljs-string\">'https://*.github.com/*'</span>, <span class=\"hljs-string\">'*://electron.github.io'</span>]\n}\n\nsession.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback) => {\n  details.requestHeaders[<span class=\"hljs-string\">'User-Agent'</span>] = <span class=\"hljs-string\">'MyAgent'</span>\n  callback({ <span class=\"hljs-attr\">requestHeaders</span>: details.requestHeaders })\n})\n</code></pre>\n<h3 id=\"méthodes-dinstance\"><a href=\"#méthodes-dinstance\">Méthodes d’instance</a></h3>\n<p>Les méthodes suivantes sont disponibles pour les instances de <code>WebRequest</code> :</p>\n<h4 id=\"webrequestonbeforerequestfilter-listener\"><a href=\"#webrequestonbeforerequestfilter-listener\"><code>webRequest.onBeforeRequest([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Objet <code>details</code><ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (facultatif)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/upload-data\">UploadData[]</a></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li>Objet <code>response</code><ul>\n<li><code>cancel</code> Boolean)</li>\n<li><code>redirectURL</code> String (facultatif) - Empêche la requête originale d'être envoyée ou complétée et à la place celle ci est redirigée vers l'URL donnée.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Le <code>listener</code> sera appelé avec <code>listener(détails, callback)</code> lorsqu'une requête est sur le point de se produire.</p>\n<p>Le <code>uploadData</code> est un tableau d'objets <code>UploadData</code>.</p>\n<p>La <code>callback</code> doit être appelé avec un objet <code>response</code>.</p>\n<p>Some examples of valid <code>urls</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-string\">'http://foo:1234/'</span>\n<span class=\"hljs-string\">'http://foo.com/'</span>\n<span class=\"hljs-string\">'http://foo:1234/bar'</span>\n<span class=\"hljs-string\">'*://*/*'</span>\n<span class=\"hljs-string\">'*://example.com/*'</span>\n<span class=\"hljs-string\">'*://example.com/foo/*'</span>\n<span class=\"hljs-string\">'http://*.foo:1234/'</span>\n<span class=\"hljs-string\">'file://foo:1234/bar'</span>\n<span class=\"hljs-string\">'http://foo:*/'</span>\n<span class=\"hljs-string\">'*://www.foo.com/'</span>\n</code></pre>\n<h4 id=\"webrequestonbeforesendheadersfilter-listener\"><a href=\"#webrequestonbeforesendheadersfilter-listener\"><code>webRequest.onBeforeSendHeaders([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Objet <code>details</code><ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (facultatif)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li>Enregistrement <code>requestHeaders</code>&#x3C;string, string></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li>Objet <code>beforeSendResponse</code><ul>\n<li><code>cancel</code> Boolean)</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string | string[]> (optional) - When provided, request will be made with these headers.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details, callback)</code> before sending an HTTP request, once the request headers are available. This may occur after a TCP connection is made to the server, but before any http data is sent.</p>\n<p>The <code>callback</code> has to be called with a <code>response</code> object.</p>\n<h4 id=\"webrequestonsendheadersfilter-listener\"><a href=\"#webrequestonsendheadersfilter-listener\"><code>webRequest.onSendHeaders([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Objet <code>details</code><ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (facultatif)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li>Enregistrement <code>requestHeaders</code>&#x3C;string, string></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> just before a request is going to be sent to the server, modifications of previous <code>onBeforeSendHeaders</code> response are visible by the time this listener is fired.</p>\n<h4 id=\"webrequestonheadersreceivedfilter-listener\"><a href=\"#webrequestonheadersreceivedfilter-listener\"><code>webRequest.onHeadersReceived([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Objet <code>details</code><ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (facultatif)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>statusLine</code> String</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li>Objet <code>headersReceivedResponse</code><ul>\n<li><code>cancel</code> Boolean)</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string | string[]> (optional) - When provided, the server is assumed to have responded with these headers.</li>\n<li><code>statusLine</code> String (optional) - Should be provided when overriding <code>responseHeaders</code> to change header status otherwise original response header's status will be used.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details, callback)</code> when HTTP response headers of a request have been received.</p>\n<p>The <code>callback</code> has to be called with a <code>response</code> object.</p>\n<h4 id=\"webrequestonresponsestartedfilter-listener\"><a href=\"#webrequestonresponsestartedfilter-listener\"><code>webRequest.onResponseStarted([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Objet <code>details</code><ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (facultatif)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n<li><code>fromCache</code> Boolean - Indicates whether the response was fetched from disk cache.</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when first byte of the response body is received. For HTTP requests, this means that the status line and response headers are available.</p>\n<h4 id=\"webrequestonbeforeredirectfilter-listener\"><a href=\"#webrequestonbeforeredirectfilter-listener\"><code>webRequest.onBeforeRedirect([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Objet <code>details</code><ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (facultatif)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>redirectURL</code> String</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n<li><code>ip</code> String (optional) - The server IP address that the request was actually sent to.</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when a server initiated redirect is about to occur.</p>\n<h4 id=\"webrequestoncompletedfilter-listener\"><a href=\"#webrequestoncompletedfilter-listener\"><code>webRequest.onCompleted([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Objet <code>details</code><ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (facultatif)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n<li><code>error</code> String</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when a request is completed.</p>\n<h4 id=\"webrequestonerroroccurredfilter-listener\"><a href=\"#webrequestonerroroccurredfilter-listener\"><code>webRequest.onErrorOccurred([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Objet <code>details</code><ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (facultatif)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>error</code> String - La description de l'erreur.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when an error occurs.</p>",
      "title": "Classe : WebRequest",
      "description": "Intercepte et modifie le contenu d'une requête à différents stades de son existence."
    },
    "/docs/api/structures/web-request-filter": {
      "locale": "fr-FR",
      "slug": "web-request-filter",
      "href": "/docs/api/structures/web-request-filter",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/web-request-filter.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"webrequestfilter-object\"><a href=\"#webrequestfilter-object\">WebRequestFilter Object</a></h1>\n<ul>\n<li><code>urls</code> String[] - Array of URL patterns that will be used to filter out the requests that do not match the URL patterns.</li>\n</ul>",
      "title": "WebRequestFilter Object",
      "description": ""
    },
    "/docs/api/structures/web-source": {
      "locale": "fr-FR",
      "slug": "web-source",
      "href": "/docs/api/structures/web-source",
      "crowdinFileId": "256529",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/web-source.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"websource-object\"><a href=\"#websource-object\">WebSource Object</a></h1>\n<ul>\n<li><code>code</code> String</li>\n<li><code>url</code> String (optional)</li>\n<li><code>startLine</code> Integer (optional) - Default is 1.</li>\n</ul>",
      "title": "WebSource Object",
      "description": ""
    },
    "/docs/api/webview-tag": {
      "locale": "fr-FR",
      "slug": "webview-tag",
      "href": "/docs/api/webview-tag",
      "crowdinFileId": "256407",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/webview-tag.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webview-tag\"><a href=\"#webview-tag\"><code>&#x3C;webview></code> Tag</a></h1>\n<h2 id=\"avertissement\"><a href=\"#avertissement\">Avertissement</a></h2>\n<p>La balise <code>webview</code> d'Electron est basée sur la webview <a href=\"https://developer.chrome.com/docs/extensions/reference/webviewTag/\">de <code>Chromium</code></a>, qui subit des changements architecturaux spectaculaires. Cela affecte la stabilité des <code>webviews</code>, y compris le rendu, la navigation et le routage des événements. Nous recommandons actuellement de ne pas utiliser le tag <code>webview</code> et d’envisager des alternatives, comme <code>iframe</code>, <a href=\"/docs/api/browser-view\">Electron’s <code>BrowserView</code></a>, ou une architecture qui évite complètement le contenu intégré.</p>\n<h2 id=\"enabling\"><a href=\"#enabling\">Enabling</a></h2>\n<p>Par défaut, la balise <code>webview</code> est désactivée dans Electron >= 5.  Vous devez activer la balise en définissant l'option <code>webviewTag </code> des webPréferenceslors de l'instanciation de votre <code>BrowserWindow</code>. Pour plus d'information voir la doc pour : <a href=\"/docs/api/browser-window\">BrowserWindow constructor </a>.</p>\n<h2 id=\"vue-densemble\"><a href=\"#vue-densemble\">Vue d'ensemble</a></h2>\n<blockquote>\n<p>Affiche un contenu web externe dans une frame et un processus isolés.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Utilisez la balise <code>webview</code> pour intégrer du contenu 'hébergé' (comme des pages web) dans votre application Electron. Le contenu hébergé est inclus dans le conteneur <code>webview</code>. Une page intégrée dans votre application gère la façon dont le contenu est mis en page et affiché.</p>\n<p>Contrairement à une<code>iframe</code>, la <code>webview</code> s'exécute dans un processus séparé de votre application . Il n'a pas les mêmes permissions que votre page web et toutes les interactions entre votre application et le contenu intégré seront asynchrones. Cela protège votre application du contenu incorporé. <strong>Remarque :</strong> La plupart des méthodes appelées sur la webview à partir de la page hôte nécessitent un appel synchrone au processus principal.</p>\n<h2 id=\"example\"><a href=\"#example\">Example</a></h2>\n<p>Pour intégrer une page web dans votre application, ajoutez la balise <code>webview</code> à la page de votre application qui va l'intégrer (c'est la page de l'application qui affichera le contenu de cette page). Dans sa forme la plus simple la balise <code>webview</code> inclut la <code>src</code> de la page web et les styles css qui contrôlent l'apparence du conteneur <code>webview</code>:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"foo\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"display:inline-flex; width:640px; height:480px\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>Si vous voulez contrôler de quelque manière que ce soit le contenu hébergé , vous pouvez écrire du JavaScript qui écoute les événements <code>webview</code> et répond à ces événements en utilisant les méthodes de la <code>webview</code>. Voici un exemple de code avec deux écouteurs d'événements : un qui écoute quand la page web commence à télécharger, l'autre quand la page web arrête le chargement, et affiche un message \"loading...\" pendant le temps de chargement :</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  onload = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\n    <span class=\"hljs-keyword\">const</span> indicator = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'.indicator'</span>)\n\n    <span class=\"hljs-keyword\">const</span> loadstart = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      indicator.innerText = <span class=\"hljs-string\">'loading...'</span>\n    }\n\n    <span class=\"hljs-keyword\">const</span> loadstop = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      indicator.innerText = <span class=\"hljs-string\">''</span>\n    }\n\n    webview.addEventListener(<span class=\"hljs-string\">'did-start-loading'</span>, loadstart)\n    webview.addEventListener(<span class=\"hljs-string\">'did-stop-loading'</span>, loadstop)\n  }\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h2 id=\"implémentation-interne\"><a href=\"#implémentation-interne\">Implémentation interne</a></h2>\n<p>Dans les détails <code>webview</code> est implémentée avec des <a href=\"https://www.chromium.org/developers/design-documents/oop-iframes\">iframes hors processus (OOPIF)</a>. La balise <code>webview</code> est essentiellement un élément personnalisé utilisant un DOM fantôme pour encapsuler un élément <code>iframe</code>.</p>\n<p>Donc, le comportement d'une <code>webview</code> est très similaire à une <code>iframe </code> cross-domain, comme dans ces exemples :</p>\n<ul>\n<li>When clicking into a <code>webview</code>, the page focus will move from the embedder frame to <code>webview</code>.</li>\n<li>You can not add keyboard, mouse, and scroll event listeners to <code>webview</code>.</li>\n<li>All reactions between the embedder frame and <code>webview</code> are asynchronous.</li>\n</ul>\n<h2 id=\"note-de-style-css\"><a href=\"#note-de-style-css\">Note de style CSS</a></h2>\n<p>Please note that the <code>webview</code> tag's style uses <code>display:flex;</code> internally to ensure the child <code>iframe</code> element fills the full height and width of its <code>webview</code> container when used with traditional and flexbox layouts. Please do not overwrite the default <code>display:flex;</code> CSS property, unless specifying <code>display:inline-flex;</code> for inline layout.</p>\n<h2 id=\"les-attributs-de-la-balise-webview\"><a href=\"#les-attributs-de-la-balise-webview\">Les Attributs de la balise Webview</a></h2>\n<p>La balise <code>webview</code> possède les attributs suivants :</p>\n<h3 id=\"src\"><a href=\"#src\"><code>src</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>Un <code>String</code> représentant l'URL visible. Writing to this attribute initiates top-level navigation.</p>\n<p>En affectant sa propre valeur l'attribut <code>src</code> on rechargera la page actuelle.</p>\n<p>L'attribut <code>src</code> peut également accepter des URL de données, telles que <code>data:text/plain,Hello, world !</code>.</p>\n<h3 id=\"nodeintegration\"><a href=\"#nodeintegration\"><code>nodeintegration</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://www.google.com/\"</span> <span class=\"hljs-attr\">nodeintegration</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. Lorsque cet attribut est présent, la page hébergée dans la <code>webview </code> pourra utiliser les API de node de nœud telles que <code>require</code> ou <code>process</code> pour accéder à des ressources système de bas niveau. Node integration est désactivée par défaut dans la page hébergée .</p>\n<h3 id=\"nodeintegrationinsubframes\"><a href=\"#nodeintegrationinsubframes\"><code>nodeintegrationinsubframes</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://www.google.com/\"</span> <span class=\"hljs-attr\">nodeintegrationinsubframes</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code> for the experimental option for enabling NodeJS support in sub-frames such as iframes inside the <code>webview</code>. All your preloads will load for every iframe, you can use <code>process.isMainFrame</code> to determine if you are in the main frame or not. Cette option est désactivée par défaut dans la page invité.</p>\n<h3 id=\"plugins\"><a href=\"#plugins\"><code>plugins</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">plugins</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page in <code>webview</code> will be able to use browser plugins. Les plugins sont désactivés par défaut.</p>\n<h3 id=\"preload\"><a href=\"#preload\"><code>preload</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- à partir d'un fichier --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">preload</span>=<span class=\"hljs-string\">\"./test.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">!</span> <span class=\"hljs-attr\">-</span> <span class=\"hljs-attr\">ou</span> <span class=\"hljs-attr\">si</span> <span class=\"hljs-attr\">vous</span> <span class=\"hljs-attr\">voulez</span> à <span class=\"hljs-attr\">partir</span> <span class=\"hljs-attr\">d</span>'<span class=\"hljs-attr\">une</span> <span class=\"hljs-attr\">archive</span> <span class=\"hljs-attr\">asar</span> <span class=\"hljs-attr\">--</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">preload</span>=<span class=\"hljs-string\">\"./app.asar/test.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p><code>String </code> (facultatif) Spécifie un script qui sera chargé avant les autres scripts exécutés dans la page hébergée. Le protocole de l'URL du script doit être <code>file :</code> (même en utilisant des archives <code>asar :</code> ) car il sera chargé, sous le capot, par <code>require</code> de Node qui traite les archives <code>asar :</code> comme des répertoires virtuels .</p>\n<p>When the guest page doesn't have node integration this script will still have access to all Node APIs, but global objects injected by Node will be deleted after this script has finished executing.</p>\n<p><strong>Note :</strong> Cette option apparaîtra comme <code>preloadURL</code> (et non <code>preload</code>) dans <code>webPréferences</code> spécifiées à l’événement <code>will-attach-webview </code>.</p>\n<h3 id=\"httpreferrer\"><a href=\"#httpreferrer\"><code>httpreferrer</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">httpreferrer</span>=<span class=\"hljs-string\">\"http://cheng.guru\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the referrer URL for the guest page.</p>\n<h3 id=\"useragent\"><a href=\"#useragent\"><code>useragent</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">useragent</span>=<span class=\"hljs-string\">\"Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the user agent for the guest page before the page is navigated to. Once the page is loaded, use the <code>setUserAgent</code> method to change the user agent.</p>\n<h3 id=\"disablewebsecurity\"><a href=\"#disablewebsecurity\"><code>disablewebsecurity</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">disablewebsecurity</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page will have web security disabled. La sécurité Web est activée par défaut.</p>\n<h3 id=\"partition\"><a href=\"#partition\"><code>partition</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span> <span class=\"hljs-attr\">partition</span>=<span class=\"hljs-string\">\"persist:github\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://electronjs.org\"</span> <span class=\"hljs-attr\">partition</span>=<span class=\"hljs-string\">\"electron\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the session used by the page. If <code>partition</code> starts with <code>persist:</code>, the page will use a persistent session available to all pages in the app with the same <code>partition</code>. s'il n'y a pas de préfixe <code>persistant:</code>, la page utilisera une session en mémoire . En assignant la même <code>partition</code>, plusieurs pages peuvent partager la même session. If the <code>partition</code> is unset then default session of the app will be used.</p>\n<p>This value can only be modified before the first navigation, since the session of an active renderer process cannot change. Subsequent attempts to modify the value will fail with a DOM exception.</p>\n<h3 id=\"allowpopups\"><a href=\"#allowpopups\"><code>allowpopups</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">allowpopups</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page will be allowed to open new windows. Les popups sont désactivés par défaut.</p>\n<h3 id=\"webpreferences\"><a href=\"#webpreferences\"><code>webpreferences</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span> <span class=\"hljs-attr\">webpreferences</span>=<span class=\"hljs-string\">\"allowRunningInsecureContent, javascript=no\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> which is a comma separated list of strings which specifies the web preferences to be set on the webview. The full list of supported preference strings can be found in <a href=\"/docs/api/browser-window#new-browserwindowoptions\">BrowserWindow</a>.</p>\n<p>The string follows the same format as the features string in <code>window.open</code>. A name by itself is given a <code>true</code> boolean value. A preference can be set to another value by including an <code>=</code>, followed by the value. Special values <code>yes</code> and <code>1</code> are interpreted as <code>true</code>, while <code>no</code> and <code>0</code> are interpreted as <code>false</code>.</p>\n<h3 id=\"enableblinkfeatures\"><a href=\"#enableblinkfeatures\"><code>enableblinkfeatures</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">enableblinkfeatures</span>=<span class=\"hljs-string\">\"PreciseMemoryInfo, CSSVariables\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> which is a list of strings which specifies the blink features to be enabled separated by <code>,</code>. The full list of supported feature strings can be found in the <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> file.</p>\n<h3 id=\"disableblinkfeatures\"><a href=\"#disableblinkfeatures\"><code>disableblinkfeatures</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">disableblinkfeatures</span>=<span class=\"hljs-string\">\"PreciseMemoryInfo, CSSVariables\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> which is a list of strings which specifies the blink features to be disabled separated by <code>,</code>. The full list of supported feature strings can be found in the <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> file.</p>\n<h2 id=\"méthodes\"><a href=\"#méthodes\">Méthodes</a></h2>\n<p>La balise <code>webview</code> possède les méthodes suivantes :</p>\n<p><strong>Note:</strong> The webview element must be loaded before using the methods.</p>\n<p><strong>Example</strong></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'dom-ready'</span>, () => {\n  webview.openDevTools()\n})\n</code></pre>\n<h3 id=\"webviewloadurlurl-options\"><a href=\"#webviewloadurlurl-options\"><code>&#x3C;webview>.loadURL(url[, options])</code></a></h3>\n<ul>\n<li><code>url</code> URL</li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (optional) - An HTTP Referrer url.</li>\n<li><code>userAgent</code> String (optionnel) - Un agent utilisateur d'où provient la requête.</li>\n<li><code>extraHeaders</code> String (optionnel) - Headers supplémentaires séparés par \"\\n\"</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified <code>url</code> is a data url and needs to load other files.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - The promise will resolve when the page has finished loading (see <a href=\"/docs/api/webview-tag#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects if the page fails to load (see <a href=\"/docs/api/webview-tag#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Loads the <code>url</code> in the webview, the <code>url</code> must contain the protocol prefix, e.g. the <code>http://</code> or <code>file://</code>.</p>\n<h3 id=\"webviewdownloadurlurl\"><a href=\"#webviewdownloadurlurl\"><code>&#x3C;webview>.downloadURL(url)</code></a></h3>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code> without navigating.</p>\n<h3 id=\"webviewgeturl\"><a href=\"#webviewgeturl\"><code>&#x3C;webview>.getURL()</code></a></h3>\n<p>Returns <code>String</code> - The URL of guest page.</p>\n<h3 id=\"webviewgettitle\"><a href=\"#webviewgettitle\"><code>&#x3C;webview>.getTitle()</code></a></h3>\n<p>Returns <code>String</code> - The title of guest page.</p>\n<h3 id=\"webviewisloading\"><a href=\"#webviewisloading\"><code>&#x3C;webview>.isLoading()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether guest page is still loading resources.</p>\n<h3 id=\"webviewisloadingmainframe\"><a href=\"#webviewisloadingmainframe\"><code>&#x3C;webview>.isLoadingMainFrame()</code></a></h3>\n<p>Retourne <code>Boolean</code> - Si la frame principale (et pas seulement un iframe ou frames qu'il contient) sont toujours en chargement.</p>\n<h3 id=\"webviewiswaitingforresponse\"><a href=\"#webviewiswaitingforresponse\"><code>&#x3C;webview>.isWaitingForResponse()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the guest page is waiting for a first-response for the main resource of the page.</p>\n<h3 id=\"webviewstop\"><a href=\"#webviewstop\"><code>&#x3C;webview>.stop()</code></a></h3>\n<p>Arrête toute navigation en attente.</p>\n<h3 id=\"webviewreload\"><a href=\"#webviewreload\"><code>&#x3C;webview>.reload()</code></a></h3>\n<p>Reloads the guest page.</p>\n<h3 id=\"webviewreloadignoringcache\"><a href=\"#webviewreloadignoringcache\"><code>&#x3C;webview>.reloadIgnoringCache()</code></a></h3>\n<p>Reloads the guest page and ignores cache.</p>\n<h3 id=\"webviewcangoback\"><a href=\"#webviewcangoback\"><code>&#x3C;webview>.canGoBack()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the guest page can go back.</p>\n<h3 id=\"webviewcangoforward\"><a href=\"#webviewcangoforward\"><code>&#x3C;webview>.canGoForward()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the guest page can go forward.</p>\n<h3 id=\"webviewcangotooffsetoffset\"><a href=\"#webviewcangotooffsetoffset\"><code>&#x3C;webview>.canGoToOffset(offset)</code></a></h3>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the guest page can go to <code>offset</code>.</p>\n<h3 id=\"webviewclearhistory\"><a href=\"#webviewclearhistory\"><code>&#x3C;webview>.clearHistory()</code></a></h3>\n<p>Efface l'historique de navigation.</p>\n<h3 id=\"webviewgoback\"><a href=\"#webviewgoback\"><code>&#x3C;webview>.goBack()</code></a></h3>\n<p>Makes the guest page go back.</p>\n<h3 id=\"webviewgoforward\"><a href=\"#webviewgoforward\"><code>&#x3C;webview>.goForward()</code></a></h3>\n<p>Makes the guest page go forward.</p>\n<h3 id=\"webviewgotoindexindex\"><a href=\"#webviewgotoindexindex\"><code>&#x3C;webview>.goToIndex(index)</code></a></h3>\n<ul>\n<li><code>index</code> Integer</li>\n</ul>\n<p>Navigates to the specified absolute index.</p>\n<h3 id=\"webviewgotooffsetoffset\"><a href=\"#webviewgotooffsetoffset\"><code>&#x3C;webview>.goToOffset(offset)</code></a></h3>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Navigates to the specified offset from the \"current entry\".</p>\n<h3 id=\"webviewiscrashed\"><a href=\"#webviewiscrashed\"><code>&#x3C;webview>.isCrashed()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the renderer process has crashed.</p>\n<h3 id=\"webviewsetuseragentuseragent\"><a href=\"#webviewsetuseragentuseragent\"><code>&#x3C;webview>.setUserAgent(userAgent)</code></a></h3>\n<ul>\n<li><code>userAgent</code> String</li>\n</ul>\n<p>Overrides the user agent for the guest page.</p>\n<h3 id=\"webviewgetuseragent\"><a href=\"#webviewgetuseragent\"><code>&#x3C;webview>.getUserAgent()</code></a></h3>\n<p>Returns <code>String</code> - The user agent for guest page.</p>\n<h3 id=\"webviewinsertcsscss\"><a href=\"#webviewinsertcsscss\"><code>&#x3C;webview>.insertCSS(css)</code></a></h3>\n<ul>\n<li><code>css</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - A promise that resolves with a key for the inserted CSS that can later be used to remove the CSS via <code>&#x3C;webview>.removeInsertedCSS(key)</code>.</p>\n<p>Injecte du CSS dans la page Web actuelle et renvoie une clé unique pour la feuille de style insérée .</p>\n<h3 id=\"webviewremoveinsertedcsskey\"><a href=\"#webviewremoveinsertedcsskey\"><code>&#x3C;webview>.removeInsertedCSS(key)</code></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves if the removal was successful.</p>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from <code>&#x3C;webview>.insertCSS(css)</code>.</p>\n<h3 id=\"webviewexecutejavascriptcode-usergesture\"><a href=\"#webviewexecutejavascriptcode-usergesture\"><code>&#x3C;webview>.executeJavaScript(code[, userGesture])</code></a></h3>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (optional) - Default <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if the result of the code is a rejected promise.</p>\n<p>Évalue le <code>code</code> dans la page. If <code>userGesture</code> is set, it will create the user gesture context in the page. HTML APIs like <code>requestFullScreen</code>, which require user action, can take advantage of this option for automation.</p>\n<h3 id=\"webviewopendevtools\"><a href=\"#webviewopendevtools\"><code>&#x3C;webview>.openDevTools()</code></a></h3>\n<p>Opens a DevTools window for guest page.</p>\n<h3 id=\"webviewclosedevtools\"><a href=\"#webviewclosedevtools\"><code>&#x3C;webview>.closeDevTools()</code></a></h3>\n<p>Closes the DevTools window of guest page.</p>\n<h3 id=\"webviewisdevtoolsopened\"><a href=\"#webviewisdevtoolsopened\"><code>&#x3C;webview>.isDevToolsOpened()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether guest page has a DevTools window attached.</p>\n<h3 id=\"webviewisdevtoolsfocused\"><a href=\"#webviewisdevtoolsfocused\"><code>&#x3C;webview>.isDevToolsFocused()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether DevTools window of guest page is focused.</p>\n<h3 id=\"webviewinspectelementx-y\"><a href=\"#webviewinspectelementx-y\"><code>&#x3C;webview>.inspectElement(x, y)</code></a></h3>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Starts inspecting element at position (<code>x</code>, <code>y</code>) of guest page.</p>\n<h3 id=\"webviewinspectsharedworker\"><a href=\"#webviewinspectsharedworker\"><code>&#x3C;webview>.inspectSharedWorker()</code></a></h3>\n<p>Opens the DevTools for the shared worker context present in the guest page.</p>\n<h3 id=\"webviewinspectserviceworker\"><a href=\"#webviewinspectserviceworker\"><code>&#x3C;webview>.inspectServiceWorker()</code></a></h3>\n<p>Opens the DevTools for the service worker context present in the guest page.</p>\n<h3 id=\"webviewsetaudiomutedmuted\"><a href=\"#webviewsetaudiomutedmuted\"><code>&#x3C;webview>.setAudioMuted(muted)</code></a></h3>\n<ul>\n<li><code>muted</code> Boolean</li>\n</ul>\n<p>Set guest page muted.</p>\n<h3 id=\"webviewisaudiomuted\"><a href=\"#webviewisaudiomuted\"><code>&#x3C;webview>.isAudioMuted()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether guest page has been muted.</p>\n<h3 id=\"webviewiscurrentlyaudible\"><a href=\"#webviewiscurrentlyaudible\"><code>&#x3C;webview>.isCurrentlyAudible()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether audio is currently playing.</p>\n<h3 id=\"webviewundo\"><a href=\"#webviewundo\"><code>&#x3C;webview>.undo()</code></a></h3>\n<p>Executes editing command <code>undo</code> in page.</p>\n<h3 id=\"webviewredo\"><a href=\"#webviewredo\"><code>&#x3C;webview>.redo()</code></a></h3>\n<p>Executes editing command <code>redo</code> in page.</p>\n<h3 id=\"webviewcut\"><a href=\"#webviewcut\"><code>&#x3C;webview>.cut()</code></a></h3>\n<p>Executes editing command <code>cut</code> in page.</p>\n<h3 id=\"webviewcopy\"><a href=\"#webviewcopy\"><code>&#x3C;webview>.copy()</code></a></h3>\n<p>Executes editing command <code>copy</code> in page.</p>\n<h3 id=\"webviewpaste\"><a href=\"#webviewpaste\"><code>&#x3C;webview>.paste()</code></a></h3>\n<p>Executes editing command <code>paste</code> in page.</p>\n<h3 id=\"webviewpasteandmatchstyle\"><a href=\"#webviewpasteandmatchstyle\"><code>&#x3C;webview>.pasteAndMatchStyle()</code></a></h3>\n<p>Executes editing command <code>pasteAndMatchStyle</code> in page.</p>\n<h3 id=\"webviewdelete\"><a href=\"#webviewdelete\"><code>&#x3C;webview>.delete()</code></a></h3>\n<p>Executes editing command <code>delete</code> in page.</p>\n<h3 id=\"webviewselectall\"><a href=\"#webviewselectall\"><code>&#x3C;webview>.selectAll()</code></a></h3>\n<p>Executes editing command <code>selectAll</code> in page.</p>\n<h3 id=\"webviewunselect\"><a href=\"#webviewunselect\"><code>&#x3C;webview>.unselect()</code></a></h3>\n<p>Executes editing command <code>unselect</code> in page.</p>\n<h3 id=\"webviewreplacetext\"><a href=\"#webviewreplacetext\"><code>&#x3C;webview>.replace(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes editing command <code>replace</code> in page.</p>\n<h3 id=\"webviewreplacemisspellingtext\"><a href=\"#webviewreplacemisspellingtext\"><code>&#x3C;webview>.replaceMisspelling(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes editing command <code>replaceMisspelling</code> in page.</p>\n<h3 id=\"webviewinserttexttext\"><a href=\"#webviewinserttexttext\"><code>&#x3C;webview>.insertText(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;void></code></p>\n<p>Insère le <code>text</code> à l'élément ciblé.</p>\n<h3 id=\"webviewfindinpagetext-options\"><a href=\"#webviewfindinpagetext-options\"><code>&#x3C;webview>.findInPage(text[, options])</code></a></h3>\n<ul>\n<li><code>text</code> String - Content to be searched, must not be empty.</li>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>forward</code> Boolean (facultatif) - Rechercher soit en avant soit en arrière, la valeur par défaut est <code>true</code>.</li>\n<li><code>findNext</code> Boolean (optional) - Whether to begin a new text finding session with this request. Doit être <code>true</code> pour les requêtes initiales et <code>false</code> pour les requêtes de suivi. Par défaut, <code>faux</code>.</li>\n<li><code>matchCase</code> Boolean (optional) - Whether search should be case-sensitive, defaults to <code>false</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code> - The request id used for the request.</p>\n<p>Starts a request to find all matches for the <code>text</code> in the web page. Le résultat de la requête peut être obtenu en s'abonnant à l'événement <a href=\"/docs/api/webview-tag#event-found-in-page\"><code>found-in-page</code></a>.</p>\n<h3 id=\"webviewstopfindinpageaction\"><a href=\"#webviewstopfindinpageaction\"><code>&#x3C;webview>.stopFindInPage(action)</code></a></h3>\n<ul>\n<li><code>action</code> String - Specifies the action to take place when ending <a href=\"#webviewfindinpagetext-options\"><code>&#x3C;webview>.findInPage</code></a> request.<ul>\n<li><code>clearSelection</code> - Clear the selection.</li>\n<li><code>keepSelection</code> - Translate the selection into a normal selection.</li>\n<li><code>activateSelection</code> - Focus and click the selection node.</li>\n</ul></li>\n</ul>\n<p>Stops any <code>findInPage</code> request for the <code>webview</code> with the provided <code>action</code>.</p>\n<h3 id=\"webviewprintoptions\"><a href=\"#webviewprintoptions\"><code>&#x3C;webview>.print([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (facultatif)<ul>\n<li><code>silent</code> Boolean (optional) - Don't ask user for print settings. Par défaut la valeur est <code>false</code>.</li>\n<li><code>printBackground</code> Boolean (optional) - Prints the background color and image of the web page. Par défaut la valeur est <code>false</code>.</li>\n<li><code>deviceName</code> String (optional) - Set the printer device name to use. Must be the system-defined name and not the 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.</li>\n<li><code>color</code> Boolean (optional) - Set whether the printed web page will be in color or grayscale. La valeur par défaut est <code>vraie</code>.</li>\n<li><code>margins</code> Object (facultatif)<ul>\n<li><code>marginType</code> String (optional) - Can be <code>default</code>, <code>none</code>, <code>printableArea</code>, or <code>custom</code>. If <code>custom</code> is chosen, you will also need to specify <code>top</code>, <code>bottom</code>, <code>left</code>, and <code>right</code>.</li>\n<li><code>top</code> Number (optional) - The top margin of the printed web page, in pixels.</li>\n<li><code>bottom</code> Number (optional) - The bottom margin of the printed web page, in pixels.</li>\n<li><code>left</code> Number (optional) - The left margin of the printed web page, in pixels.</li>\n<li><code>right</code> Number (optional) - The right margin of the printed web page, in pixels.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - Whether the web page should be printed in landscape mode. Par défaut la valeur est <code>false</code>.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page.</li>\n<li><code>pagesPerSheet</code> Number (optional) - The number of pages to print per page sheet.</li>\n<li><code>collate</code> Boolean (optional) - Whether the web page should be collated.</li>\n<li><code>copies</code> Number (optional) - The number of copies of the web page to print.</li>\n<li><code>pageRanges</code> Object<a href=\"/docs/api/facultatif\"></a> - La plage de page à imprimer.<ul>\n<li><code>from</code> Number - Index de la première page à imprimer (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>duplexMode</code> String (optional) - Set the duplex mode of the printed web page. Can be <code>simplex</code>, <code>shortEdge</code>, or <code>longEdge</code>.</li>\n<li><code>dpi</code> Record&#x3C;string, number> (optional)<ul>\n<li><code>horizontal</code> Number (optional) - The horizontal dpi.</li>\n<li><code>vertical</code> Number (optional) - The vertical dpi.</li>\n</ul></li>\n<li><code>header</code> String (optional) - String to be printed as page header.</li>\n<li><code>footer</code> String (optional) - String to be printed as page footer.</li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the printed document. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code>.</li>\n</ul></li>\n</ul>\n<p>Retourne <code>Promise&#x3C;void></code></p>\n<p>Prints <code>webview</code>'s web page. Identique à <code>webContents.print([options])</code>.</p>\n<h3 id=\"webviewprinttopdfoptions\"><a href=\"#webviewprinttopdfoptions\"><code>&#x3C;webview>.printToPDF(options)</code></a></h3>\n<ul>\n<li>Objet <code>options</code><ul>\n<li><code>headerFooter</code> Record&#x3C;string, string> (optional) - the header and footer for the PDF.<ul>\n<li><code>title</code> String - The title for the PDF header.</li>\n<li><code>url</code> String - the url for the PDF footer.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - <code>true</code> for landscape, <code>false</code> for portrait.</li>\n<li><code>marginsType</code> Integer (optional) - Specifies the type of margins to use. Uses 0 for default margin, 1 for no margin, and 2 for minimum margin. and <code>width</code> in microns.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page. Can range from 0 to 100.</li>\n<li><code>pageRanges</code> Record&#x3C;string, number> (optional) - The page range to print. On macOS, only the first range is honored.<ul>\n<li><code>from</code> Number - Index de la première page à imprimer (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the generated PDF. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code></li>\n<li><code>printBackground</code> Boolean (optional) - Whether to print CSS backgrounds.</li>\n<li><code>printSelectionOnly</code> Boolean (optional) - Whether to print selection only.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Uint8Array></code> - Resolves with the generated PDF data.</p>\n<p>Prints <code>webview</code>'s web page as PDF, Same as <code>webContents.printToPDF(options)</code>.</p>\n<h3 id=\"webviewcapturepagerect\"><a href=\"#webviewcapturepagerect\"><code>&#x3C;webview>.capturePage([rect])</code></a></h3>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (optionnel) - La zone de la page dont on doit réaliser la capture.</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;NativeImage></code> - résout avec une <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Captures a snapshot of the page within <code>rect</code>. Omitting <code>rect</code> will capture the whole visible page.</p>\n<h3 id=\"webviewsendchannel-args\"><a href=\"#webviewsendchannel-args\"><code>&#x3C;webview>.send(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;void></code></p>\n<p>Send an asynchronous message to renderer process via <code>channel</code>, you can also send arbitrary arguments. The renderer process can handle the message by listening to the <code>channel</code> event with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>See <a href=\"/docs/api/web-contents#contentssendchannel-args\">webContents.send</a> for examples.</p>\n<h3 id=\"webviewsendtoframeframeid-channel-args\"><a href=\"#webviewsendtoframeframeid-channel-args\"><code>&#x3C;webview>.sendToFrame(frameId, channel, ...args)</code></a></h3>\n<ul>\n<li><code>frameId</code> [number, number] - <code>[processId, frameId]</code></li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;void></code></p>\n<p>Send an asynchronous message to renderer process via <code>channel</code>, you can also send arbitrary arguments. The renderer process can handle the message by listening to the <code>channel</code> event with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>See <a href=\"/docs/api/web-contents#contentssendtoframeframeid-channel-args\">webContents.sendToFrame</a> for examples.</p>\n<h3 id=\"webviewsendinputeventevent\"><a href=\"#webviewsendinputeventevent\"><code>&#x3C;webview>.sendInputEvent(event)</code></a></h3>\n<ul>\n<li><code>event</code>  <a href=\"/docs/api/structures/mouse-input-event\">MouseInputEvent</a> | <a href=\"/docs/api/structures/mouse-wheel-input-event\">MouseWheelInputEvent</a> | <a href=\"/docs/api/structures/keyboard-input-event\">KeyboardInputEvent</a></li>\n</ul>\n<p>Retourne <code>Promise&#x3C;void></code></p>\n<p>Sends an input <code>event</code> to the page.</p>\n<p>See <a href=\"/docs/api/web-contents#contentssendinputeventinputevent\">webContents.sendInputEvent</a> for detailed description of <code>event</code> object.</p>\n<h3 id=\"webviewsetzoomfactorfactor\"><a href=\"#webviewsetzoomfactorfactor\"><code>&#x3C;webview>.setZoomFactor(factor)</code></a></h3>\n<ul>\n<li><code>factor</code> Number - Facteur de zoom.</li>\n</ul>\n<p>Modifie le facteur de zoom en utilisant le facteur spécifié. Le Zoom factor est égal à la valeur du zoom exprimée en pourcent divisée par 100, donc 300% = 3.0.</p>\n<h3 id=\"webviewsetzoomlevellevel\"><a href=\"#webviewsetzoomlevellevel\"><code>&#x3C;webview>.setZoomLevel(level)</code></a></h3>\n<ul>\n<li><code>level</code> Number - Niveau de zoom.</li>\n</ul>\n<p>Modifie le niveau de zoom jusqu'au niveau spécifié. La taille originale est de 0 et chaque incrément au-dessus ou en dessous représente un zoom de 20% supérieur ou inférieure jusqu'au limites de 300% et 50% de la taille originale, respectivement. La formule pour cela est <code>'scale:= 1,2 ^ level</code>.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h3 id=\"webviewgetzoomfactor\"><a href=\"#webviewgetzoomfactor\"><code>&#x3C;webview>.getZoomFactor()</code></a></h3>\n<p>Returns <code>Number</code> - the current zoom factor.</p>\n<h3 id=\"webviewgetzoomfactor-1\"><a href=\"#webviewgetzoomfactor-1\"><code>&#x3C;webview>.getZoomFactor()</code></a></h3>\n<p>Returns <code>Number</code> - the current zoom level.</p>\n<h3 id=\"webviewsetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#webviewsetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>&#x3C;webview>.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h3>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>Retourne <code>Promise&#x3C;void></code></p>\n<p>Définit le niveau maximum et minimum le niveau pinch-to-zoom.</p>\n<h3 id=\"webviewshowdefinitionforselection-macos\"><a href=\"#webviewshowdefinitionforselection-macos\"><code>&#x3C;webview>.showDefinitionForSelection()</code> <em>macOS</em></a></h3>\n<p>Shows pop-up dictionary that searches the selected word on the page.</p>\n<h3 id=\"webviewgetwebcontentsid\"><a href=\"#webviewgetwebcontentsid\"><code>&#x3C;webview>.getWebContentsId()</code></a></h3>\n<p>Returns <code>Number</code> - The WebContents ID of this <code>webview</code>.</p>\n<h2 id=\"dom-events\"><a href=\"#dom-events\">DOM Events</a></h2>\n<p>The following DOM events are available to the <code>webview</code> tag:</p>\n<h3 id=\"événement--load-commit\"><a href=\"#événement--load-commit\">Événement : 'load-commit'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Fired when a load has committed. This includes navigation within the current document as well as subframe document-level loads, but does not include asynchronous resource loads.</p>\n<h3 id=\"événement--did-finish-load\"><a href=\"#événement--did-finish-load\">Événement : 'did-finish-load'</a></h3>\n<p>Fired when the navigation is done, i.e. the spinner of the tab will stop spinning, and the <code>onload</code> event is dispatched.</p>\n<h3 id=\"événement--did-fail-load\"><a href=\"#événement--did-fail-load\">Événement : 'did-fail-load'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>This event is like <code>did-finish-load</code>, but fired when the load failed or was cancelled, e.g. <code>window.stop()</code> is invoked.</p>\n<h3 id=\"événement--did-frame-finish-load\"><a href=\"#événement--did-frame-finish-load\">Événement : 'did-frame-finish-load'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Fired when a frame has done navigation.</p>\n<h3 id=\"événement--did-start-loading\"><a href=\"#événement--did-start-loading\">Événement : 'did-start-loading'</a></h3>\n<p>Corresponds to the points in time when the spinner of the tab starts spinning.</p>\n<h3 id=\"événement--did-stop-loading\"><a href=\"#événement--did-stop-loading\">Événement : 'did-stop-loading'</a></h3>\n<p>Corresponds to the points in time when the spinner of the tab stops spinning.</p>\n<h3 id=\"événement--did-navigate\"><a href=\"#événement--did-navigate\">Événement : 'did-navigate'</a></h3>\n<p>Déclenché lors de l'attachement au contenu Web de l'élément l'intégrant.</p>\n<h3 id=\"événement--dom-ready\"><a href=\"#événement--dom-ready\">Événement : 'dom-ready'</a></h3>\n<p>Fired when document in the given frame is loaded.</p>\n<h3 id=\"événement--page-title-updated\"><a href=\"#événement--page-title-updated\">Événement : 'page-title-updated'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>Fired when page title is set during navigation. <code>explicitSet</code> is false when title is synthesized from file url.</p>\n<h3 id=\"événement--page-favicon-updated\"><a href=\"#événement--page-favicon-updated\">Événement : 'page-favicon-updated'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>favicons</code> String[] - Tableau d'URLs.</li>\n</ul>\n<p>Fired when page receives favicon urls.</p>\n<h3 id=\"événement--enter-html-full-screen\"><a href=\"#événement--enter-html-full-screen\">Événement : 'enter-html-full-screen'</a></h3>\n<p>Fired when page enters fullscreen triggered by HTML API.</p>\n<h3 id=\"événement--leave-html-full-screen\"><a href=\"#événement--leave-html-full-screen\">Événement : 'leave-html-full-screen'</a></h3>\n<p>Fired when page leaves fullscreen triggered by HTML API.</p>\n<h3 id=\"événement--console-message\"><a href=\"#événement--console-message\">Événement : 'console-message'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>level</code> Integer - The log level, from 0 to 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>message</code> String - The actual console message</li>\n<li><code>line</code> Integer - The line number of the source that triggered this console message</li>\n<li><code>sourceId</code> String</li>\n</ul>\n<p>Fired when the guest window logs a console message.</p>\n<p>The following example code forwards all log messages to the embedder's console without regard for log level or other properties.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'console-message'</span>, (e) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'La page invité a envoyé un message :'</span>, e.message)\n})\n</code></pre>\n<h3 id=\"événement--found-in-page\"><a href=\"#événement--found-in-page\">Événement : 'found-in-page'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>result</code> Object<ul>\n<li><code>requestId</code> Integer</li>\n<li><code>activeMatchOrdinal</code> Integer - Position du résultat actif.</li>\n<li><code>matches</code> Integer - Nombre de résultats.</li>\n<li><code>sélectionArea</code> Rectangle - Coordonnées de la région de la première correspondance.</li>\n<li><code>finalUpdate</code> Boolean</li>\n</ul></li>\n</ul>\n<p>Fired when a result is available for <a href=\"#webviewfindinpagetext-options\"><code>webview.findInPage</code></a> request.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'found-in-page'</span>, (e) => {\n  webview.stopFindInPage(<span class=\"hljs-string\">'keepSelection'</span>)\n})\n\n<span class=\"hljs-keyword\">const</span> requestId = webview.findInPage(<span class=\"hljs-string\">'test'</span>)\n<span class=\"hljs-built_in\">console</span>.log(requestId)\n</code></pre>\n<h3 id=\"événement--new-window\"><a href=\"#événement--new-window\">Événement : 'new-window'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String</li>\n<li><code>disposition</code> String - Peut être <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> et <code>other</code>.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - The options which should be used for creating the new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</li>\n</ul>\n<p>Fired when the guest page attempts to open a new browser window.</p>\n<p>The following example code opens the new url in system's default browser.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\n\nwebview.addEventListener(<span class=\"hljs-string\">'new-window'</span>, <span class=\"hljs-keyword\">async</span> (e) => {\n  <span class=\"hljs-keyword\">const</span> protocol = (<span class=\"hljs-keyword\">new</span> URL(e.url)).protocol\n  <span class=\"hljs-keyword\">if</span> (protocol === <span class=\"hljs-string\">'http:'</span> || protocol === <span class=\"hljs-string\">'https:'</span>) {\n    <span class=\"hljs-keyword\">await</span> shell.openExternal(e.url)\n  }\n})\n</code></pre>\n<h3 id=\"événement--will-navigate\"><a href=\"#événement--will-navigate\">Événement : 'will-navigate'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when a user or the page wants to start navigation. It can happen when the <code>window.location</code> object is changed or a user clicks a link in the page.</p>\n<p>Cet événement ne sera pas émis lorsque la navigation démarre par programmation grâce aux APIs comme <code>&#x3C;webview>.loadURL</code> et <code>&#x3C;webview>.back</code>.</p>\n<p>It is also not emitted during in-page navigation, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<p>Calling <code>event.preventDefault()</code> does <strong>NOT</strong> have any effect.</p>\n<h3 id=\"événement--did-start-navigation\"><a href=\"#événement--did-start-navigation\">Événement : 'did-start-navigation'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame (including main) starts navigating. <code>isInPlace</code> will be <code>true</code> for in-page navigations.</p>\n<h3 id=\"event-did-redirect-navigation\"><a href=\"#event-did-redirect-navigation\">Event: 'did-redirect-navigation'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted after a server side redirect occurs during navigation. For example a 302 redirect.</p>\n<h3 id=\"événement--did-navigate-1\"><a href=\"#événement--did-navigate-1\">Événement : 'did-navigate'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Émis lorsqu'une navigation est faite.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h3 id=\"event-did-frame-navigate\"><a href=\"#event-did-frame-navigate\">Event: 'did-frame-navigate'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - vide pour les navigations non HTTP,</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Émis lorsqu'une navigation est terminée.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h3 id=\"événement--did-navigate-in-page\"><a href=\"#événement--did-navigate-in-page\">Événement : 'did-navigate-in-page'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Émis lorsqu'une navigation dans la page s'est produite.</p>\n<p>En cas de navigation dans la page, l'URL de la page change mais ne provoque pas de navigation à l'extérieur de la page. Par exemple, lorsque vous cliquez sur un lien d'ancrage ou lorsque l'événement DOM <code>hashchange</code> est déclenché.</p>\n<h3 id=\"événement--close\"><a href=\"#événement--close\">Événement : 'close'</a></h3>\n<p>Fired when the guest page attempts to close itself.</p>\n<p>The following example code navigates the <code>webview</code> to <code>about:blank</code> when the guest attempts to close itself.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'close'</span>, () => {\n  webview.src = <span class=\"hljs-string\">'about:blank'</span>\n})\n</code></pre>\n<h3 id=\"événement--ipc-message\"><a href=\"#événement--ipc-message\">Événement : 'ipc-message'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>frameId</code> [number, number] - pair of <code>[processId, frameId]</code>.</li>\n<li><code>channel</code> String</li>\n<li><code>args</code> any[]</li>\n</ul>\n<p>Fired when the guest page has sent an asynchronous message to embedder page.</p>\n<p>With <code>sendToHost</code> method and <code>ipc-message</code> event you can communicate between guest page and embedder page:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In embedder page.</span>\n<span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'ipc-message'</span>, (event) => {\n  <span class=\"hljs-built_in\">console</span>.log(event.channel)\n  <span class=\"hljs-comment\">// Prints \"pong\"</span>\n})\nwebview.send(<span class=\"hljs-string\">'ping'</span>)\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In guest page.</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcRenderer.on(<span class=\"hljs-string\">'ping'</span>, () => {\n  ipcRenderer.sendToHost(<span class=\"hljs-string\">'pong'</span>)\n})\n</code></pre>\n<h3 id=\"événement--crashed\"><a href=\"#événement--crashed\">Événement : 'crashed'</a></h3>\n<p>Fired when the renderer process is crashed.</p>\n<h3 id=\"événement--plugin-crashed\"><a href=\"#événement--plugin-crashed\">Événement : 'plugin-crashed'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>\n<p>Déclenché lorsqu’un processus de plugin crash.</p>\n<h3 id=\"événement--destroyed\"><a href=\"#événement--destroyed\">Événement : 'destroyed'</a></h3>\n<p>Déclenché lorsque le WebContents est détruit.</p>\n<h3 id=\"événement--media-started-playing\"><a href=\"#événement--media-started-playing\">Événement : 'media-started-playing'</a></h3>\n<p>Émis lorsqu'un média se démarre.</p>\n<h3 id=\"événement--media-paused\"><a href=\"#événement--media-paused\">Événement : 'media-paused'</a></h3>\n<p>Émis lorsque le média est suspendu ou terminé.</p>\n<h3 id=\"événement--did-change-theme-color\"><a href=\"#événement--did-change-theme-color\">Événement : 'did-change-theme-color'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>themeColor</code> String</li>\n</ul>\n<p>Emitted when a page's theme color changes. This is usually due to encountering a meta tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">'theme-color'</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">'#ff0000'</span>></span>\n</code></pre>\n<h3 id=\"événement--update-target-url\"><a href=\"#événement--update-target-url\">Événement : 'update-target-url'</a></h3>\n<p>Retourne :</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Émis lorsque la souris passe sur un lien ou le clavier déplace le focus vers un lien.</p>\n<h3 id=\"événement--devtools-opened\"><a href=\"#événement--devtools-opened\">Événement : 'devtools-opened'</a></h3>\n<p>Émis lorsque la DevTools est ouverte.</p>\n<h3 id=\"événement--devtools-closed\"><a href=\"#événement--devtools-closed\">Événement : 'devtools-closed'</a></h3>\n<p>Émis lorsque la DevTools est fermée.</p>\n<h3 id=\"événement--devtools-focused\"><a href=\"#événement--devtools-focused\">Événement : 'devtools-focused'</a></h3>\n<p>Émis lorsque la DevTools est active / ouverte.</p>",
      "title": "<webview> Tag",
      "description": "Affiche un contenu web externe dans une frame et un processus isolés."
    },
    "/docs/api/window-open": {
      "locale": "fr-FR",
      "slug": "window-open",
      "href": "/docs/api/window-open",
      "crowdinFileId": "256409",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/window-open.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"opening-windows-from-the-renderer\"><a href=\"#opening-windows-from-the-renderer\">Opening windows from the renderer</a></h1>\n<p>There are several ways to control how windows are created from trusted or untrusted content within a renderer. Windows can be created from the renderer in two ways:</p>\n<ul>\n<li>clicking on links or submitting forms adorned with <code>target=_blank</code></li>\n<li>JavaScript calling <code>window.open()</code></li>\n</ul>\n<p>For same-origin content, the new window is created within the same process, enabling the parent to access the child window directly. This can be very useful for app sub-windows that act as preference panels, or similar, as the parent can render to the sub-window directly, as if it were a <code>div</code> in the parent. This is the same behavior as in the browser.</p>\n<p>When <code>nativeWindowOpen</code> is set to false, <code>window.open</code> instead results in the creation of a <a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code></a>, a light wrapper around <code>BrowserWindow</code>.</p>\n<p>Electron pairs this native Chrome <code>Window</code> with a BrowserWindow under the hood. You can take advantage of all the customization available when creating a BrowserWindow in the main process by using <code>webContents.setWindowOpenHandler()</code> for renderer-created windows.</p>\n<p>Les options du constructeur BrowserWindow sont définies par ordre croissant de priorité : avec d'abord les options héritées du parent puis les options analysées à partir de la chaîne <code>features</code> de <code>window.open()</code> puis les webPreferences héritées du parent et liées à la sécurité et enfin les options données par <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>. Note that <code>webContents.setWindowOpenHandler</code> has final say and full privilege because it is invoked in the main process.</p>\n<h3 id=\"windowopenurl-framename-features\"><a href=\"#windowopenurl-framename-features\"><code>window.open(url[, frameName][, features])</code></a></h3>\n<ul>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String (facultatif)</li>\n<li><code>features</code> String (facultatif)</li>\n</ul>\n<p>Returns <a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code></a> | <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window\"><code>Window</code></a></p>\n<p><code>features</code> is a comma-separated key-value list, following the standard format of the browser. Electron will parse <code>BrowserWindowConstructorOptions</code> out of this list where possible, for convenience. For full control and better ergonomics, consider using <code>webContents.setWindowOpenHandler</code> to customize the BrowserWindow creation.</p>\n<p>A subset of <code>WebPreferences</code> can be set directly, unnested, from the features string: <code>zoomFactor</code>, <code>nodeIntegration</code>, <code>preload</code>, <code>javascript</code>, <code>contextIsolation</code>, and <code>webviewTag</code>.</p>\n<p>Par exemple :</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">'https://github.com'</span>, <span class=\"hljs-string\">'_blank'</span>, <span class=\"hljs-string\">'top=500,left=200,frame=false,nodeIntegration=no'</span>)\n</code></pre>\n<p><strong>Remarque :</strong></p>\n<ul>\n<li>L'intégration de Node sera toujours désactivée dans le nouveau <code>window</code> si elle est désactivée sur la fenêtre parent.</li>\n<li>L'isolation du context sera toujours activée dans le nouveau <code>window</code> si elle est activée sur la fenêtre parent.</li>\n<li>JavaScript sera toujours désactivé dans le nouveau <code>window</code> si il est désactivé sur la fenêtre parent.</li>\n<li>Les fonctionnalités non standards (non gérées par Chromium ou Electron) renseignées dans <code>features</code> seront transmises à tout gestionnaire de l'événement <code>did-create-window</code> enregistré de <code>webContents</code> dans le paramètre <code>options</code>.</li>\n<li><code>frameName</code> suit la spécification de <code>windowName</code> située dans la <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters\">documentation native</a>.</li>\n</ul>\n<p>To customize or cancel the creation of the window, you can optionally set an override handler with <code>webContents.setWindowOpenHandler()</code> from the main process. Returning <code>{ action: 'deny' }</code> cancels the window. Returning <code>{ action: 'allow', overrideBrowserWindowOptions: { ... } }</code> will allow opening the window and setting the <code>BrowserWindowConstructorOptions</code> to be used when creating the window. Note that this is more powerful than passing options through the feature string, as the renderer has more limited privileges in deciding security preferences than the main process.</p>\n<h3 id=\"native-window-example\"><a href=\"#native-window-example\">Native <code>Window</code> example</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// main.js</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-comment\">// In this example, only windows with the `about:blank` url will be created.</span>\n<span class=\"hljs-comment\">// All other urls will be blocked.</span>\nmainWindow.webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (url === <span class=\"hljs-string\">'about:blank'</span>) {\n    <span class=\"hljs-keyword\">return</span> {\n      <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span>,\n      <span class=\"hljs-attr\">overrideBrowserWindowOptions</span>: {\n        <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span>,\n        <span class=\"hljs-attr\">fullscreenable</span>: <span class=\"hljs-literal\">false</span>,\n        <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'black'</span>,\n        <span class=\"hljs-attr\">webPreferences</span>: {\n          <span class=\"hljs-attr\">preload</span>: <span class=\"hljs-string\">'my-child-window-preload-script.js'</span>\n        }\n      }\n    }\n  }\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// renderer process (mainWindow)</span>\n<span class=\"hljs-keyword\">const</span> childWindow = <span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">''</span>, <span class=\"hljs-string\">'modal'</span>)\nchildWindow.document.write(<span class=\"hljs-string\">'&#x3C;h1>Hello&#x3C;/h1>'</span>)\n</code></pre>\n<h3 id=\"browserwindowproxy-example\"><a href=\"#browserwindowproxy-example\"><code>BrowserWindowProxy</code> example</a></h3>\n<pre><code class=\"hljs language-javascript\">\n<span class=\"hljs-comment\">// main.js</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nativeWindowOpen</span>: <span class=\"hljs-literal\">false</span> }\n})\n\nmainWindow.webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (url.startsWith(<span class=\"hljs-string\">'https://github.com/'</span>)) {\n    <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span> }\n  }\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n\nmainWindow.webContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (childWindow) => {\n  <span class=\"hljs-comment\">// For example...</span>\n  childWindow.webContents.on(<span class=\"hljs-string\">'will-navigate'</span>, (e) => {\n    e.preventDefault()\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// renderer.js</span>\n<span class=\"hljs-keyword\">const</span> windowProxy = <span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">'https://github.com/'</span>, <span class=\"hljs-literal\">null</span>, <span class=\"hljs-string\">'minimizable=false'</span>)\nwindowProxy.postMessage(<span class=\"hljs-string\">'hi'</span>, <span class=\"hljs-string\">'*'</span>)\n</code></pre>",
      "title": "Opening windows from the renderer",
      "description": ""
    },
    "/docs/tutorial/windows-arm": {
      "locale": "fr-FR",
      "slug": "windows-arm",
      "href": "/docs/tutorial/windows-arm",
      "crowdinFileId": "256271",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-arm.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"windows-sur-arm\"><a href=\"#windows-sur-arm\">Windows sur ARM</a></h1>\n<p>If your app runs with Electron 6.0.8 or later, you can now build it for Windows 10 on Arm. This considerably improves performance, but requires recompilation of any native modules used in your app. It may also require small fixups to your build and packaging scripts.</p>\n<h2 id=\"running-a-basic-app\"><a href=\"#running-a-basic-app\">Running a basic app</a></h2>\n<p>If your app doesn't use any native modules, then it's really easy to create an Arm version of your app.</p>\n<ol>\n<li>Make sure that your app's <code>node_modules</code> directory is empty.</li>\n<li>Using a <em>Command Prompt</em>, run <code>set npm_config_arch=arm64</code> before running <code>npm install</code>/<code>yarn install</code> as usual.</li>\n<li><a href=\"/docs/tutorial/quick-start#prerequisites\">If you have Electron installed as a development dependency</a>, npm will download and unpack the arm64 version. You can then package and distribute your app as normal.</li>\n</ol>\n<h2 id=\"general-considerations\"><a href=\"#general-considerations\">General considerations</a></h2>\n<h3 id=\"architecture-specific-code\"><a href=\"#architecture-specific-code\">Architecture-specific code</a></h3>\n<p>Lots of Windows-specific code contains if... else logic that selects between either the x64 or x86 architectures.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">if</span> (process.arch === <span class=\"hljs-string\">'x64'</span>) {\n  <span class=\"hljs-comment\">// Do 64-bit thing...</span>\n} <span class=\"hljs-keyword\">else</span> {\n  <span class=\"hljs-comment\">// Do 32-bit thing...</span>\n}\n</code></pre>\n<p>If you want to target arm64, logic like this will typically select the wrong architecture, so carefully check your application and build scripts for conditions like this. In custom build and packaging scripts, you should always check the value of <code>npm_config_arch</code> in the environment, rather than relying on the current process arch.</p>\n<h3 id=\"native-modules\"><a href=\"#native-modules\">Native modules</a></h3>\n<p>If you use native modules, you must make sure that they compile against v142 of the MSVC compiler (provided in Visual Studio 2017). You must also check that any pre-built <code>.dll</code> or <code>.lib</code> files provided or referenced by the native module are available for Windows on Arm.</p>\n<h3 id=\"testing-your-app\"><a href=\"#testing-your-app\">Testing your app</a></h3>\n<p>To test your app, use a Windows on Arm device running Windows 10 (version 1903 or later). Make sure that you copy your application over to the target device - Chromium's sandbox will not work correctly when loading your application assets from a network location.</p>\n<h2 id=\"development-prerequisites\"><a href=\"#development-prerequisites\">Development prerequisites</a></h2>\n<h3 id=\"nodejsnode-gyp\"><a href=\"#nodejsnode-gyp\">Node.js/node-gyp</a></h3>\n<p><a href=\"https://nodejs.org/en/\">Node.js v12.9.0 or later is recommended.</a> If updating to a new version of Node is  undesirable, you can instead <a href=\"https://github.com/nodejs/node-gyp/wiki/Updating-npm&#x27;s-bundled-node-gyp\">update npm's copy of node-gyp manually</a> to version 5.0.2 or later, which contains the required changes to compile native modules for Arm.</p>\n<h3 id=\"visual-studio-2017\"><a href=\"#visual-studio-2017\">Visual Studio 2017</a></h3>\n<p>Visual Studio 2017 (any edition) is required for cross-compiling native modules. You can download Visual Studio Community 2017 via Microsoft's <a href=\"https://visualstudio.microsoft.com/dev-essentials/\">Visual Studio Dev Essentials program</a>. After installation, you can add the Arm-specific components by running the following from a <em>Command Prompt</em>:</p>\n<pre><code class=\"hljs language-powershell\">vs_installer.exe ^\n--add Microsoft.VisualStudio.Workload.NativeDesktop ^\n--add Microsoft.VisualStudio.Component.VC.ATLMFC ^\n--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ^\n--add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ^\n--includeRecommended\n</code></pre>\n<h4 id=\"creating-a-cross-compilation-command-prompt\"><a href=\"#creating-a-cross-compilation-command-prompt\">Creating a cross-compilation command prompt</a></h4>\n<p>Setting <code>npm_config_arch=arm64</code> in the environment creates the correct arm64 <code>.obj</code> files, but the standard <em>Developer Command Prompt for VS 2017</em> will use the x64 linker. To fix this:</p>\n<ol>\n<li>Duplicate the <em>x64_x86 Cross Tools Command Prompt for VS 2017</em> shortcut (e.g. by locating it in the start menu, right clicking, selecting <em>Open File Location</em>, copying and pasting) to somewhere convenient.</li>\n<li>Right click the new shortcut and choose <em>Properties</em>.</li>\n<li>Change the <em>Target</em> field to read <code>vcvarsamd64_arm64.bat</code> at the end instead of <code>vcvarsamd64_x86.bat</code>.</li>\n</ol>\n<p>If done successfully, the command prompt should print something similar to this on startup:</p>\n<pre><code class=\"hljs language-bat\">**********************************************************************\n** Visual Studio <span class=\"hljs-number\">2017</span> Developer Command Prompt v15.<span class=\"hljs-number\">9</span>.<span class=\"hljs-number\">15</span>\n** Copyright (c) <span class=\"hljs-number\">2017</span> Microsoft Corporation\n**********************************************************************\n[vcvarsall.bat] Environment initialized <span class=\"hljs-keyword\">for</span>: 'x64_arm64'\n</code></pre>\n<p>If you want to develop your application directly on a Windows on Arm device, substitute <code>vcvarsx86_arm64.bat</code> in <em>Target</em> so that cross-compilation can happen with the device's x86 emulation.</p>\n<h3 id=\"linking-against-the-correct-nodelib\"><a href=\"#linking-against-the-correct-nodelib\">Linking against the correct <code>node.lib</code></a></h3>\n<p>By default, <code>node-gyp</code> unpacks Electron's node headers and downloads the x86 and x64 versions of <code>node.lib</code> into <code>%APPDATA%\\..\\Local\\node-gyp\\Cache</code>, but it does not download the arm64 version (<a href=\"https://github.com/nodejs/node-gyp/pull/1875\">a fix for this is in development</a>.) To fix this:</p>\n<ol>\n<li>Download the arm64 <code>node.lib</code> from <a href=\"https://electronjs.org/headers/v6.0.9/win-arm64/node.lib\">https://electronjs.org/headers/v6.0.9/win-arm64/node.lib</a></li>\n<li>Move it to <code>%APPDATA%\\..\\Local\\node-gyp\\Cache\\6.0.9\\arm64\\node.lib</code></li>\n</ol>\n<p>Substitute <code>6.0.9</code> for the version you're using.</p>\n<h2 id=\"cross-compiling-native-modules\"><a href=\"#cross-compiling-native-modules\">Cross-compiling native modules</a></h2>\n<p>After completing all of the above, open your cross-compilation command prompt and run <code>set npm_config_arch=arm64</code>. Then use <code>npm install</code> to build your project as normal. As with cross-compiling x86 modules, you may need to remove <code>node_modules</code> to force recompilation of native modules if they were previously compiled for another architecture.</p>\n<h2 id=\"debugging-native-modules\"><a href=\"#debugging-native-modules\">Debugging native modules</a></h2>\n<p>Debugging native modules can be done with Visual Studio 2017 (running on your development machine) and corresponding <a href=\"https://docs.microsoft.com/en-us/visualstudio/debugger/remote-debugging-cpp?view=vs-2019\">Visual Studio Remote Debugger</a> running on the target device. To debug:</p>\n<ol>\n<li>Launch your app <code>.exe</code> on the target device via the <em>Command Prompt</em> (passing <code>--inspect-brk</code> to pause it before any native modules are loaded).</li>\n<li>Launch Visual Studio 2017 on your development machine.</li>\n<li>Connect to the target device by selecting <em>Debug > Attach to Process...</em> and enter the device's IP address and the port number displayed by the Visual Studio Remote Debugger tool.</li>\n<li>Click <em>Refresh</em> and select the <a href=\"/docs/development/debug-instructions-windows\">appropriate Electron process to attach</a>.</li>\n<li>You may need to make sure that any symbols for native modules in your app are loaded correctly. To configure this, head to <em>Debug > Options...</em> in Visual Studio 2017, and add the folders containing your <code>.pdb</code> symbols under <em>Debugging > Symbols</em>.</li>\n<li>Once attached, set any appropriate breakpoints and resume JavaScript execution using Chrome's <a href=\"/docs/tutorial/debugging-main-process\">remote tools for Node</a>.</li>\n</ol>\n<h2 id=\"getting-additional-help\"><a href=\"#getting-additional-help\">Getting additional help</a></h2>\n<p>If you encounter a problem with this documentation, or if your app works when compiled for x86 but not for arm64, please <a href=\"/docs/development/issues\">file an issue</a> with \"Windows on Arm\" in the title.</p>",
      "title": "Windows sur ARM",
      "description": ""
    },
    "/docs/tutorial/windows-store-guide": {
      "locale": "fr-FR",
      "slug": "windows-store-guide",
      "href": "/docs/tutorial/windows-store-guide",
      "crowdinFileId": "256273",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-store-guide.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"guide-windows-store\"><a href=\"#guide-windows-store\">Guide Windows Store</a></h1>\n<p>Avec Windows 10, le bon vieux executable win32 a un nouveau frère: La plateforme Universelle de Windows. Le nouveau format <code>.appx</code> ne permet pas seulement d'avoir de nouvelles API puissantes comme Cortana ou Push Notifications, mais via le Windows Store, il simplifie également les installations et les mises à jour.</p>\n<p>Microsoft <a href=\"https://github.com/catalystcode/electron-windows-store\">à développé un outil qui compile les apps Electron en packages <code>.appx</code></a>, permettant aux développeurs d'utiliser une partie des goodies trouvés dans le nouveau modèle d'application. Ce guide explique comment l'utiliser - et quelles sont les capacités et les limites d'un package Electron AppX.</p>\n<h2 id=\"contexte-et-exigences\"><a href=\"#contexte-et-exigences\">Contexte et exigences</a></h2>\n<p>Windows 10 \"Anniversary Update\" est capable d'exécuter des binaires win32 <code>.exe</code> en les lançant avec un système de fichier et un registre virtualisé. Ils sont tout les deux créés durant la compilation en exécutant l'app et l'installer a l'intérieur d'un conteneur de Windows, ce qui permet à Windows d'identifier exactement quelles modifications au système d'exploitation sont effectuées pendant l'installation. Appareiller l'exécutable avec un système de fichiers virtuel et un registre virtuel permet à Windows la désinstallation et l'installation en un seul clic.</p>\n<p>En addition, le exe est lancé à l'intérieur du modèle appx - ce qui signifie qu'il peut utiliser beaucoup des API disponibles pour la plateforme Universelle Windows. Pour gagner encore plus de fonctionnalités, une app Electron peut jumeler avec une tâche d'arrière-plan invisible UWP lancée avec le <code>exe</code> - sorte d'acolyte pour exécuter des tâches en arrière-plan, recevoir des notifications push, ou pour communiquer avec d'autres applications UWP.</p>\n<p>Pour compiler n’importe quelle app Electron existante, assurez-vous que vous avez les exigences suivantes :</p>\n<ul>\n<li>Windows 10 avec Anniversary Update (sorti le 2 Août 2016)</li>\n<li>Le SDK Windows 10, <a href=\"https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk\">downloadable here</a></li>\n<li>Au minimum Node 4 (pour vérifier, exécutez <code>node -v</code>)</li>\n</ul>\n<p>Ensuite, installez <code>electron-windows-store</code> CLI:</p>\n<pre><code class=\"hljs language-sh\">npm install -g electron-windows-store\n</code></pre>\n<h2 id=\"étape-1--empaqueter-votre-application-electron\"><a href=\"#étape-1--empaqueter-votre-application-electron\">Étape 1 : Empaqueter votre Application Electron</a></h2>\n<p>Empaquetez l’application à l’aide de <a href=\"https://github.com/electron/electron-packager\">electron-packager</a> (ou un outil similaire). Assurez vous de supprimer <code>node_modules</code> que vous n'avez pas besoin dans votre application finale, puisque n'importe quel module dont vous n'avez pas besoin augmentera inutilement la taille de votre application.</p>\n<p>La sortie devrait ressembler à peu près à ceci :</p>\n<pre><code class=\"hljs language-plaintext\">├── Ghost.exe\n├── LICENSE\n├── content_resources_200_percent.pak\n├── content_shell.pak\n├── d3dcompiler_47.dll\n├── ffmpeg.dll\n├── icudtl.dat\n├── libEGL.dll\n├── libGLESv2.dll\n├── locales\n│   ├── am.pak\n│   ├── ar.pak\n│   ├── [...]\n├── node.dll\n├── resources\n│   └── app.asar\n├── v8_context_snapshot.bin\n├── squirrel.exe\n└── ui_resources_200_percent.pak\n</code></pre>\n<h2 id=\"étape-2-exécuter-electron-windows-store\"><a href=\"#étape-2-exécuter-electron-windows-store\">Étape 2: Exécuter electron-windows-store</a></h2>\n<p>Depuis un PowerShell élevé (exécuter le \"en tant Administrateur\"), exécutez <code>electron-windows-store</code> avec les paramètres requis, en mettant le dossier d'entrée, le dossier de sortie, le nom et la version de l'application, et confirmer que <code>node_modules</code> doit être aplati :</p>\n<pre><code class=\"hljs language-powershell\">electron-windows-store `\n    --input-directory C:\\myelectronapp `\n    --output-directory C:\\output\\myelectronapp `\n    --package-version <span class=\"hljs-number\">1.0</span>.<span class=\"hljs-number\">0.0</span> `\n    --package-name myelectronapp\n</code></pre>\n<p>Une fois exécuté, l’outil se met au travail : il accepte votre app Electron comme entrée, et aplatit les <code>node_modules</code>. Ensuite, il archive votre application comme <code>app.zip</code>. En utilisant un installateur et un conteneur de Windows, l’outil crée un paquet AppX « élargi » - contenant le manifeste d’Application Windows (<code>AppXManifest.xml</code>) ainsi que le système de fichiers virtuel et le registre virtuel à l’intérieur de votre dossier de sortie.</p>\n<p>Une fois les fichiers AppX élargis sont créés, l’outil utilise le Windows App Packager (<code>MakeAppx.exe</code>) pour créer un package de AppX de fichier unique de ces fichiers sur le disque. Enfin, l’outil peut servir pour créer un certificat approuvé sur votre ordinateur pour signer le nouveau paquet AppX. Avec le package AppX signé, la CLI peut également automatiquement installer le package sur votre machine.</p>\n<h2 id=\"étape-3--utiliser-le-package-appx\"><a href=\"#étape-3--utiliser-le-package-appx\">Étape 3 : Utiliser le Package AppX</a></h2>\n<p>Afin d’exécuter votre paquet, vos utilisateurs auront besoin de Windows 10 \"Anniversaire Update\" - plus de détails sur comment mettre à jour Windows peuvent être trouvés <a href=\"https://blogs.windows.com/windowsexperience/2016/08/02/how-to-get-the-windows-10-anniversary-update\">ici</a>.</p>\n<p>En opposition aux traditionelles apps UWP, actuellement les apps empaquetées doivent subir un processus de vérification manuelle, pour lequel vous pouvez appliquer <a href=\"https://developer.microsoft.com/en-us/windows/projects/campaigns/desktop-bridge\">ici</a>. En attendant, tous les utilisateurs seront en mesure d’installer votre paquet en double-cliquant dessus, donc une soumission au store ne sera ne peut-être pas nécessaire si vous cherchez simplement une méthode d’installation plus facile. Dans des environnements gérés (généralement des entreprises), l'<code>Add-AppxPackage</code> <a href=\"https://technet.microsoft.com/en-us/library/hh856048.aspx\">applet de commande PowerShell permet de l'installer de façon automatisée</a>.</p>\n<p>Une autre limitation importante est que le paquet AppX compilé contient un fichier exécutable win32 - toujours et qu’il ne fonctionnera donc pas sur Xbox, HoloLens ou téléphones.</p>\n<h2 id=\"facultatif--ajouter-les-fonctionnalités-uwp-à-laide-dun-backgroundtask\"><a href=\"#facultatif--ajouter-les-fonctionnalités-uwp-à-laide-dun-backgroundtask\">Facultatif : Ajouter les fonctionnalités UWP à l’aide d’un BackgroundTask</a></h2>\n<p>Vous pouvez coupler votre app Electron avec une tâche en arrière-plan UWP invisible qui vous permet de tirer pleinement parti des fonctionnalités de Windows 10 - comme notifications push, ou les tuiles vivantes.</p>\n<p>Pour voir comment une app Electron peut utiliser une tâche de fond pour envoyer des notifications toast et tuiles vivantes, <a href=\"https://github.com/felixrieseberg/electron-uwp-background\">consultez l'exemple fourni par Microsoft</a>.</p>\n<h2 id=\"optionnel-conversion-en-utilisant-la-virtualisation-de-conteneur\"><a href=\"#optionnel-conversion-en-utilisant-la-virtualisation-de-conteneur\">Optionnel: Conversion en utilisant la virtualisation de conteneur</a></h2>\n<p>Pour générer le package AppX, l'<code>electron-windows-store</code> CLI utilise un modèle qui devrait fonctionner pour la plupart des applications Electron. Toutefois, si vous utilisez un programme d’installation personnalisé, ou si vous rencontrez des problèmes avec le paquet généré, vous pouvez essayer de créer un package à l’aide de compilation avec un conteneur Windows - dans ce mode, le CLI va installer et exécuter votre application dans un conteneur vide de Windows pour déterminer quelles modifications votre application fait au système d’exploitation.</p>\n<p>Avant d'exécuter le CLI pour la première fois, vous devrez configurer le \"Windows Desktop App Converter\". Cela prendra quelques minutes, mais ne vous inquiétez pas il suffit de le faire une fois. Téléchargez le Desktop App Converter <a href=\"https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-run-desktop-app-converter\">ici</a>. Vous recevrez deux fichiers: <code>DesktopAppConverter.zip</code> et <code>BaseImage-14316.wim</code>.</p>\n<ol>\n<li>Décompressez <code>DesktopAppConverter.zip</code>. Depuis un PowerShell élevé (ouvert avec \"exécuter en tant qu'administrateur\"), faire en sorte que votre stratégie d'exécution de systèmes nous permet d'exécuter tout que nous avons besoin d'exécuter en appelant <code>Set-ExecutionPolicy bypass</code>.</li>\n<li>Ensuite, exécutez l'installation du Desktop App Converter, en lui passant l'emplacement du Windows base Image (téléchargé comme <code>BaseImage-14316.wim</code>), en exécutant la commande <code>.\\DesktopAppConverter.ps1 -Setup -BaseImage .\\BaseImage-14316.wim</code>.</li>\n<li>Si la commande ci-dessus vous demande un redémarrage, veuillez redémarrer votre machine et exécuter la commande ci-dessus une nouvelle fois après le redémarrage réussi.</li>\n</ol>\n<p>Une fois l’installation réussie, vous pouvez passer à la compilation de votre app Electron.</p>",
      "title": "Guide Windows Store",
      "description": ""
    },
    "/docs/tutorial/windows-taskbar": {
      "locale": "fr-FR",
      "slug": "windows-taskbar",
      "href": "/docs/tutorial/windows-taskbar",
      "crowdinFileId": "256275",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-taskbar.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"personnalisation-de-la-barre-des-tâches-windows\"><a href=\"#personnalisation-de-la-barre-des-tâches-windows\">Personnalisation de la barre des tâches (Windows)</a></h1>\n<h2 id=\"vue-densemble\"><a href=\"#vue-densemble\">Vue d'ensemble</a></h2>\n<p>Electron possède des APIs pour configurer l'icône de l'application dans la barre des tâches de Windows. This API supports both Windows-only features like <a href=\"#jumplist\">creation of a <code>JumpList</code></a>, <a href=\"#thumbnail-toolbars\">custom thumbnails and toolbars</a>, <a href=\"#icon-overlays-in-taskbar\">icon overlays</a>, and the so-called <a href=\"#flash-frame\">\"Flash Frame\" effect</a>, and cross-platform features like <a href=\"/docs/tutorial/recent-documents\">recent documents</a> and <a href=\"/docs/tutorial/progress-bar\">application progress</a>.</p>\n<h2 id=\"jumplist\"><a href=\"#jumplist\">JumpList</a></h2>\n<p>Windows permet aux applications de définir un menu contextuel personnalisé s'affichant lorsque les utilisateurs effectuent un clic-droit sur l’icône de l’application dans la barre des tâches. Ce menu contextuel est appelé <code>JumpList</code>. You specify custom actions in the <code>Tasks</code> category of JumpList, as quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#tasks\">MSDN</a>:</p>\n<blockquote>\n<p>Les applications définissent des tâches basées sur les caractéristiques du programme et les fonctionnalités clés que l'utilisateur est censé utiliser. Les tâches doivent être indépendantes du contexte, c'est à dire qu'elles n'ont pas besoin de s'exécuter pour fonctionner. Il devrait également il y avoir les actions statistiquement plus courantes qu'un utilisateur normal utiliserait dans une application, comme rédiger un message électronique ou ouvrir le calendrier dans un logiciel de messagerie, ou créer un nouveau document dans un traitement de texte, lancer une application dans un certain mode, ou lancer une des ses sous-commandes. Une application ne doit pas encombrer le menu avec des fonctions avancées que les utilisateurs standards n'auraient pas besoin ou des actions ponctuelles telles que l'inscription. Ne pas utiliser les tâches pour les articles promotionnels tels que les mises à niveau ou des offres spéciales.</p>\n<p>Il est fortement recommandé que la liste des tâches soit statique. Il devrait rester le même quelque soit l'état ou le statut de l'application. Bien qu'il soit possible de faire varier la liste dynamiquement, vous devez envisager que cela puisse confondre l'utilisateur qui n'attend pas que cette portion de la liste puisse changer.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420539.png\" alt=\"IE\"></p>\n<blockquote>\n<p>REMARQUE : La capture d'écran ci-dessus est un exemple de tâches générales de Internet Explorer</p>\n</blockquote>\n<p>Contrairement au menu du dock dans macOS, qui est un vrai menu, les tâches utilisateur dans Windows fonctionnent comme des raccourcis d'application. Par exemple, lorsqu'un utilisateur clique sur une tâche, le programme sera exécuté avec les arguments spécifiés.</p>\n<p>To set user tasks for your application, you can use <a href=\"/docs/api/app#appsetusertaskstasks-windows\">app.setUserTasks</a> API.</p>\n<h4 id=\"exemples\"><a href=\"#exemples\">Exemples</a></h4>\n<h5 id=\"définir-les-tâches-utilisateur\"><a href=\"#définir-les-tâches-utilisateur\">Définir les tâches utilisateur</a></h5>\n<p>Commençons avec une application fonctionnelle issue du <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, mettez à jour le fichier <code>main.js</code> avec les lignes suivantes :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setUserTasks([\n  {\n    <span class=\"hljs-attr\">program</span>: process.execPath,\n    <span class=\"hljs-attr\">arguments</span>: <span class=\"hljs-string\">'--new-window'</span>,\n    <span class=\"hljs-attr\">iconPath</span>: process.execPath,\n    <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Nouvelle fenêtre'</span>,\n    <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Créer une nouvelle fenêtre'</span>\n  }\n])\n</code></pre>\n<h5 id=\"effacer-la-liste-des-tâches\"><a href=\"#effacer-la-liste-des-tâches\">Effacer la liste des tâches</a></h5>\n<p>Pour effacer votre liste de tâches, vous devez appeler <code>app.setUserTasks</code> avec un tableau vide dans le fichier <code>main.js</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setUserTasks([])\n</code></pre>\n<blockquote>\n<p>Les tâches utilisateur seront visibles même après la fermeture de votre application, donc l'icône et le chemin d'accès du programme spécifié pour une tâche doivent exister jusqu'à ce que votre application soit désinstallée.</p>\n</blockquote>\n<h3 id=\"barres-doutils-miniatures\"><a href=\"#barres-doutils-miniatures\">Barres d’outils miniatures</a></h3>\n<p>Sur Windows, vous pouvez ajouter à la barre des tâches d'une fenêtre d'une 'application une barre d'outils miniatures avec des boutons spécifiés. Cela donne aux utilisateurs un moyen d'accéder aux commandes particulières d'une fenêtre sans avoir à restaurer ou réactiver la fenêtre.</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#thumbnail-toolbars\">MSDN</a>:</p>\n<blockquote>\n<p>Cette barre d’outils est simplement le composant standard pour la barre d’outils. Il a un maximum de sept boutons. Chaque identifiant, image, info-bulle et état du bouton sont spécifiés dans une structure, qui est ensuite passée à la barre des tâches. L'application peut afficher, activer, désactiver ou masquer des boutons de la barre d'outils miniature comme requis par son état actuel.</p>\n<p>Par exemple, le lecteur Windows Media Player peut offrir un support standard de contrôles tels que lecture, pause, muet et arrêt.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420540.png\" alt=\"lecteur\"></p>\n<blockquote>\n<p>REMARQUE : La capture d'écran ci-dessus est un exemple de barre d'outils miniatures de Windows Media Player</p>\n</blockquote>\n<p>Pour définir la barre d'outils des miniatures dans votre application, vous devez utiliser <a href=\"/docs/api/browser-window#winsetthumbarbuttonsbuttons-windows\">BrowserWindow.setThumbarButtons</a></p>\n<h4 id=\"exemples-1\"><a href=\"#exemples-1\">Exemples</a></h4>\n<h5 id=\"définir-la-barre-doutils-miniatures\"><a href=\"#définir-la-barre-doutils-miniatures\">Définir la barre d'outils miniatures</a></h5>\n<p>Commençons avec une application fonctionnelle issue du <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, mettez à jour le fichier <code>main.js</code> avec les lignes suivantes :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.setThumbarButtons([\n  {\n    <span class=\"hljs-attr\">tooltip</span>: <span class=\"hljs-string\">'button1'</span>,\n    <span class=\"hljs-attr\">icon</span>: path.join(__dirname, <span class=\"hljs-string\">'button1.png'</span>),\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'button1 clicked'</span>) }\n  }, {\n    <span class=\"hljs-attr\">tooltip</span>: <span class=\"hljs-string\">'button2'</span>,\n    <span class=\"hljs-attr\">icon</span>: path.join(__dirname, <span class=\"hljs-string\">'button2.png'</span>),\n    <span class=\"hljs-attr\">flags</span>: [<span class=\"hljs-string\">'enabled'</span>, <span class=\"hljs-string\">'dismissonclick'</span>],\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'button2 clicked.'</span>) }\n  }\n])\n</code></pre>\n<h5 id=\"vider-la-barre-doutils-miniatures\"><a href=\"#vider-la-barre-doutils-miniatures\">Vider la barre d'outils miniatures</a></h5>\n<p>Pour effacer les boutons de la barre d'outils miniatures, vous devez appeler <code>BrowserWindow.setThumbarButtons</code> avec un tableau vide dans le fichier <code>main.js</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.setThumbarButtons([])\n</code></pre>\n<h3 id=\"superposition-dicône-dans-la-barre-des-tâches\"><a href=\"#superposition-dicône-dans-la-barre-des-tâches\">Superposition d'icône dans la barre des tâches</a></h3>\n<p>Sous Windows, un bouton de la barre des tâches peut utiliser un petit overlay pour afficher l'état de l'application.</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#icon-overlays\">MSDN</a>:</p>\n<blockquote>\n<p>Les superpositions d'icônes servent en tant que notification contextuelle du statut, et sont destinées à dénier la nécessité d'une zone de notification séparée pour communiquer cette information à l'utilisateur. Par exemple, le nouveau statut de messagerie de Microsoft Outlook, actuellement affiché dans la zone de notification, est maintenant indiqué par une superposition dans sur le bouton de la barre des tâches. Encore une fois, vous devez décider au cours de votre cycle de développement quelle méthode est la meilleure pour votre application. Les icônes de recouvrement sont destinées à fournir une information importante et de long terme, telle que l'état du réseau, un statut de messagerie ou de nouveaux messages. L'utilisateur ne devrait pas se retrouver face à des superpositions ou des animations en constante évolution.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420441.png\" alt=\"Overlay sur le bouton de la barre des tâches\"></p>\n<blockquote>\n<p>REMARQUE : La capture d'écran ci-dessus est un exemple d'overlay sur un bouton de la barre des tâches</p>\n</blockquote>\n<p>To set the overlay icon for a window, you need to use the <a href=\"/docs/api/browser-window#winsetoverlayiconoverlay-description-windows\">BrowserWindow.setOverlayIcon</a> API.</p>\n<h4 id=\"example\"><a href=\"#example\">Example</a></h4>\n<p>Commençons avec une application fonctionnelle issue du <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, mettez à jour le fichier <code>main.js</code> avec les lignes suivantes :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.setOverlayIcon(<span class=\"hljs-string\">\"path/to/overlay.png\"</span>, <span class=\"hljs-string\">\"Description de l'overlay\"</span>)\n</code></pre>\n<h3 id=\"fenêtre-clignotante\"><a href=\"#fenêtre-clignotante\">Fenêtre clignotante</a></h3>\n<p>Sur Windows vous pouvez mettre en valeur un bouton de la barre des tâches pour attirer l'attention de l'utilisateur. C'est similaire à l'effet de rebond des icônes dans le dock macOS.</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-flashwindow#remarks\">MSDN</a>:</p>\n<blockquote>\n<p>En règle générale, une fenêtre clignote pour informer l'utilisateur que la fenêtre nécessite de l'attention alors qu'elle n'a pas le focus clavier.</p>\n</blockquote>\n<p>To flash the BrowserWindow taskbar button, you need to use the <a href=\"/docs/api/browser-window#winflashframeflag\">BrowserWindow.flashFrame</a> API.</p>\n<h4 id=\"example-1\"><a href=\"#example-1\">Example</a></h4>\n<p>Commençons avec une application fonctionnelle issue du <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, mettez à jour le fichier <code>main.js</code> avec les lignes suivantes :</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.once(<span class=\"hljs-string\">'focus'</span>, () => win.flashFrame(<span class=\"hljs-literal\">false</span>))\nwin.flashFrame(<span class=\"hljs-literal\">true</span>)\n</code></pre>\n<blockquote>\n<p>NOTE : N'oubliez pas d'appeler <code>win.flashFrame(false)</code> pour désactiver le flash. Dans l'exemple ci-dessus, l'appel s'effectue quand la fenêtre est focalisée, mais vous pouvez utiliser une temporisation ou un autre événement pour désactiver.</p>\n</blockquote>",
      "title": "Personnalisation de la barre des tâches (Windows)",
      "description": "Les applications définissent des tâches basées sur les caractéristiques du programme et les fonctionnalités clés que l'utilisateur est censé utiliser. Les tâches doivent être indépendantes du contexte, c'est à dire qu'elles n'ont pas besoin de s'exécuter pour fonctionner. Il devrait également il y avoir les actions statistiquement plus courantes qu'un utilisateur normal utiliserait dans une application, comme rédiger un message électronique ou ouvrir le calendrier dans un logiciel de messagerie, ou créer un nouveau document dans un traitement de texte, lancer une application dans un certain mode, ou lancer une des ses sous-commandes. Une application ne doit pas encombrer le menu avec des fonctions avancées que les utilisateurs standards n'auraient pas besoin ou des actions ponctuelles telles que l'inscription. Ne pas utiliser les tâches pour les articles promotionnels tels que les mises à niveau ou des offres spéciales.\nIl est fortement recommandé que la liste des tâches soit statique. Il devrait rester le même quelque soit l'état ou le statut de l'application. Bien qu'il soit possible de faire varier la liste dynamiquement, vous devez envisager que cela puisse confondre l'utilisateur qui n'attend pas que cette portion de la liste puisse changer."
    }
  },
  "ru-RU": {
    "/docs/api/accelerator": {
      "locale": "ru-RU",
      "slug": "accelerator",
      "href": "/docs/api/accelerator",
      "crowdinFileId": "256277",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/accelerator.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"accelerator\"><a href=\"#accelerator\">Accelerator</a></h1>\n<blockquote>\n<p>Определите сочетания клавиш.</p>\n</blockquote>\n<p>Акселераторы - строки, которые могут содержать множество модификаторов и код одной клавиши, комбинированные символом <code>+</code>, и используются для определения сочетания клавиш по всему приложению.</p>\n<p>Примеры:</p>\n<ul>\n<li><code>CommandOrControl+A</code></li>\n<li><code>CommandOrControl+Shift+Z</code></li>\n</ul>\n<p>Сочетания клавиш регистрируются с помощью модуля <a href=\"/docs/api/global-shortcut\"><code>globalShortcut</code></a>, используя метод <a href=\"/docs/api/global-shortcut#globalshortcutregisteraccelerator-callback\"><code>register</code></a>, т.е.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Регистрирует слушателя сочетания клавиш 'CommandOrControl+Y'.</span>\n  globalShortcut.register(<span class=\"hljs-string\">'CommandOrControl+Y'</span>, () => {\n    <span class=\"hljs-comment\">// Сделайте что-нибудь, когда Y и Command/Control нажаты.</span>\n  })\n})\n</code></pre>\n<h2 id=\"платформа-заметок\"><a href=\"#платформа-заметок\">Платформа заметок</a></h2>\n<p>На Linux и Windows, клавиша <code>Command</code> не имеет никакого эффекта, так что используйте <code>CommandOrControl</code>, который представляет собой <code>Command</code> на macOS и <code>Control</code> на Linux и Windows для определения некоторых акселераторов.</p>\n<p>Используйте <code>Alt</code> вместо <code>опции</code>. Клавиша <code>Option</code> существует только на macOS, в то время как клавиша <code>Alt</code> доступна на всех платформах.</p>\n<p>The <code>Super</code> (or <code>Meta</code>) key is mapped to the <code>Windows</code> key on Windows and Linux and <code>Cmd</code> on macOS.</p>\n<h2 id=\"доступные-модификаторы\"><a href=\"#доступные-модификаторы\">Доступные модификаторы</a></h2>\n<ul>\n<li><code>Command</code> (или <code>Cmd</code> для краткости)</li>\n<li><code>Control</code> (или <code>Ctrl</code> для краткости)</li>\n<li><code>CommandOrControl</code> (или <code>CmdOrCtrl</code> для краткости)</li>\n<li><code>Alt</code></li>\n<li><code>Option</code></li>\n<li><code>AltGr</code></li>\n<li><code>Shift</code></li>\n<li><code>Super</code></li>\n<li><code>Meta</code></li>\n</ul>\n<h2 id=\"доступные-коды-клавиш\"><a href=\"#доступные-коды-клавиш\">Доступные коды клавиш</a></h2>\n<ul>\n<li><code>0</code> - <code>9</code></li>\n<li><code>A</code> - <code>Z</code></li>\n<li><code>F1</code> - <code>F24</code></li>\n<li>Символы <code>~</code>, <code>!</code>, <code>@</code>, <code>#</code>, <code>$</code> и т.д.</li>\n<li><code>Plus</code></li>\n<li><code>Space</code></li>\n<li><code>Tab</code></li>\n<li><code>Capslock</code></li>\n<li><code>Numlock</code></li>\n<li><code>Scrolllock</code></li>\n<li><code>Backspace</code></li>\n<li><code>Delete</code></li>\n<li><code>Insert</code></li>\n<li><code>Return</code> (или <code>Enter</code> как псевдоним)</li>\n<li><code>Up</code>, <code>Down</code>, <code>Left</code> и <code>Right</code></li>\n<li><code>Home</code> и <code>End</code></li>\n<li><code>PageUp</code> и <code>PageDown</code></li>\n<li><code>Escape</code> (или <code>Esc</code> для краткости)</li>\n<li><code>VolumeUp</code>, <code>VolumeDown</code> и <code>VolumeMute</code></li>\n<li><code>MediaNextTrack</code>, <code>MediaPreviousTrack</code>, <code>MediaStop</code> и <code>MediaPlayPause</code></li>\n<li><code>PrintScreen</code></li>\n<li>NumPad клавиши<ul>\n<li><code>num0</code> - <code>num9</code></li>\n<li><code>numdec</code> - клавиша десятичный разделитель</li>\n<li><code>numadd</code> - клавиша <code>+</code> на numpad</li>\n<li><code>numsub</code> - клавиша <code>-</code> на numpad</li>\n<li><code>nummult</code> - клавиша <code>*</code> на numpad</li>\n<li><code>numdiv</code> - клавиша <code>÷</code> на numpad</li>\n</ul></li>\n</ul>",
      "title": "Accelerator",
      "description": "Определите сочетания клавиш."
    },
    "/docs/tutorial/accessibility": {
      "locale": "ru-RU",
      "slug": "accessibility",
      "href": "/docs/tutorial/accessibility",
      "crowdinFileId": "256173",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/accessibility.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"доступность\"><a href=\"#доступность\">Доступность</a></h1>\n<p>Создание доступных приложений важно и мы рады представить новые функции <a href=\"https://electronjs.org/devtron\">Devtron</a> и <a href=\"https://electronjs.org/spectron\">Spectron</a>, которые дают разработчикам возможность делать свои приложения лучше для всех.</p>\n<hr>\n<p>Проблемы с доступностью в приложениях Electron аналогичны веб-сайтам, поскольку они оба в конечном итоге являются HTML. Однако, в приложениях на Electron мы не можем использовать онлайн-ресурсы для аудита доступности, поскольку ваше приложение не имеет URL-адреса.</p>\n<p>These features bring those auditing tools to your Electron app. You can choose to add audits to your tests with Spectron or use them within DevTools with Devtron. Читайте далее ознакомление с инструментами.</p>\n<h2 id=\"spectron\"><a href=\"#spectron\">Spectron</a></h2>\n<p>In the testing framework Spectron, you can now audit each window and <code>&#x3C;webview></code> tag in your application. Например:</p>\n<pre><code class=\"hljs language-javascript\">app.client.auditAccessibility().then(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\">audit</span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (audit.failed) {\n    <span class=\"hljs-built_in\">console</span>.error(audit.message)\n  }\n})\n</code></pre>\n<p>Вы можете прочитать больше об этой функции в <a href=\"https://github.com/electron/spectron#accessibility-testing\">Spectron документации</a>.</p>\n<h2 id=\"devtron\"><a href=\"#devtron\">Devtron</a></h2>\n<p>In Devtron, there is an accessibility tab which will allow you to audit a page in your app, sort and filter the results.</p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/1305617/17156618/9f9bcd72-533f-11e6-880d-389115f40a2a.png\" alt=\"devtron скриншот\"></p>\n<p>Оба эти средства используют библиотеку <a href=\"https://github.com/GoogleChrome/accessibility-developer-tools\">Accessibility Developer Tools</a>, построенную Google для Chrome. Вы можете узнать больше о правилах для аудита доступности, которые эта библиотека использует, в этих <a href=\"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules\">wiki репозиториях </a>.</p>\n<p>Если вы знаете другие средства для поверки доступности в Electron, добавите их в документацию через pull request.</p>\n<h2 id=\"manually-enabling-accessibility-features\"><a href=\"#manually-enabling-accessibility-features\">Manually enabling accessibility features</a></h2>\n<p>Electron applications will automatically enable accessibility features in the presence of assistive technology (e.g. <a href=\"https://www.freedomscientific.com/products/software/jaws/\">JAWS</a> on Windows or <a href=\"https://help.apple.com/voiceover/mac/10.15/\">VoiceOver</a> on macOS). See Chrome's <a href=\"https://www.chromium.org/developers/design-documents/accessibility#TOC-How-Chrome-detects-the-presence-of-Assistive-Technology\">accessibility documentation</a> for more details.</p>\n<p>You can also manually toggle these features either within your Electron application or by setting flags in third-party native software.</p>\n<h3 id=\"using-electrons-api\"><a href=\"#using-electrons-api\">Using Electron's API</a></h3>\n<p>By using the <a href=\"/docs/api/app#appsetaccessibilitysupportenabledenabled-macos-windows\"><code>app.setAccessibilitySupportEnabled(enabled)</code></a> API, you can manually expose Chrome's accessibility tree to users in the application preferences. Note that the user's system assistive utilities have priority over this setting and will override it.</p>\n<h3 id=\"within-third-party-software\"><a href=\"#within-third-party-software\">Within third-party software</a></h3>\n<h4 id=\"macos\"><a href=\"#macos\">macOS</a></h4>\n<p>On macOS, third-party assistive technology can toggle accessibility features inside Electron applications by setting the <code>AXManualAccessibility</code> attribute programmatically:</p>\n<pre><code class=\"hljs language-objc\"><span class=\"hljs-built_in\">CFStringRef</span> kAXManualAccessibility = <span class=\"hljs-built_in\">CFSTR</span>(<span class=\"hljs-string\">\"AXManualAccessibility\"</span>);\n\n+ (<span class=\"hljs-keyword\">void</span>)enableAccessibility:(<span class=\"hljs-built_in\">BOOL</span>)enable inElectronApplication:(<span class=\"hljs-built_in\">NSRunningApplication</span> *)app\n{\n    AXUIElementRef appRef = AXUIElementCreateApplication(app.processIdentifier);\n    <span class=\"hljs-keyword\">if</span> (appRef == <span class=\"hljs-literal\">nil</span>)\n        <span class=\"hljs-keyword\">return</span>;\n\n    <span class=\"hljs-built_in\">CFBooleanRef</span> value = enable ? kCFBooleanTrue : kCFBooleanFalse;\n    AXUIElementSetAttributeValue(appRef, kAXManualAccessibility, value);\n    <span class=\"hljs-built_in\">CFRelease</span>(appRef);\n}\n</code></pre>",
      "title": "Доступность",
      "description": ""
    },
    "/docs/api/app": {
      "locale": "ru-RU",
      "slug": "app",
      "href": "/docs/api/app",
      "crowdinFileId": "256279",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/app.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"app\"><a href=\"#app\">app</a></h1>\n<blockquote>\n<p>Контролируйте жизненный цикл Вашего приложения.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p>Этот пример показывает, как закрыть приложение, когда последнее окно будет закрыто:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  app.quit()\n})\n</code></pre>\n<h2 id=\"события\"><a href=\"#события\">События</a></h2>\n<p>Объект <code>app</code> имеет следующие события:</p>\n<h3 id=\"событие-will-finish-launching\"><a href=\"#событие-will-finish-launching\">Событие: 'will-finish-launching'</a></h3>\n<p>Происходит, когда приложение заканчивает основной запуск. На Windows и Linux событие <code>will-finish-launching</code> подобно событию <code>ready</code>; на macOS это событие представляет собой уведомление <code>applicationWillFinishLaunching</code> объекта <code>NSApplication</code>. Обычно настраивают слушателей для <code>open-file</code> и <code>open-url</code> событий, и запускают репортер сбоев и автоматическое обновление.</p>\n<p>В большинстве случаев, Вы должны выполнять всё в обработчике события <code>ready</code>.</p>\n<h3 id=\"событие-ready\"><a href=\"#событие-ready\">Событие: 'ready'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>launchInfo</code> Record&#x3C;string, any> | <a href=\"/docs/api/structures/notification-response\">NotificationResponse</a> <em>macOS</em></li>\n</ul>\n<p>Происходит единожды при завершении инициализации Electron. On macOS, <code>launchInfo</code> holds the <code>userInfo</code> of the <code>NSUserNotification</code> or information from <a href=\"/docs/api/structures/notification-response\"><code>UNNotificationResponse</code></a> that was used to open the application, if it was launched from Notification Center. Вы также можете вызвать <code>app.isReady()</code> для проверки того, что событие уже произошло и <code>app.whenReady()</code> чтобы получить Promise, который выполнится, когда Electron будет инициализирован.</p>\n<h3 id=\"событие-window-all-closed\"><a href=\"#событие-window-all-closed\">Событие: 'window-all-closed'</a></h3>\n<p>Происходит при закрытии всех окон.</p>\n<p>Если Вы не подпишитесь на это событие, и все окна будут закрыты, поведением по умолчанию является выход из приложения; Однако, если Вы подпишитесь, то Вы определяете, будет ли приложение закрыто или нет. Если пользователь нажал <code>Cmd + Q</code> или разработчик вызвал <code>app.quit()</code>, Electron сначала попытается закрыть все окна, а затем происходит событие <code>will-quit</code>, и в этом случае событие <code>window-all-closed</code> не будет происходить.</p>\n<h3 id=\"событие-before-quit\"><a href=\"#событие-before-quit\">Событие: 'before-quit'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n</ul>\n<p>Происходит до того, как приложение начнет закрывать свои окна. Вызов <code>event.preventDefault()</code> предотвратит поведение по умолчанию, которое приводит к прекращению работы приложения.</p>\n<p><strong>Примечание:</strong> Если выход приложения был инициирован <code>autoUpdater.quitAndInstall()</code>, тогда <code>before-quit</code> происходит <em>после</em> того, как происходит событие <code>close</code> на всех окнах и закрывает их.</p>\n<p><strong>Примечание:</strong> На Windows это событие не произойдет, если приложение закрылось из-за выключения/перезагрузки системы или выхода пользователя из системы.</p>\n<h3 id=\"событие-will-quit\"><a href=\"#событие-will-quit\">Событие: 'will-quit'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n</ul>\n<p>Возникает, когда все окна будут закрыты и приложение завершит работу. Вызов <code>event.preventDefault()</code> предотвратит поведение по умолчанию, которое приводит к прекращению работы приложения.</p>\n<p>Смотрите описание события <code>window-all-closed</code> для различий между событиями <code>will-quit</code> и <code>window-all-closed</code>.</p>\n<p><strong>Примечание:</strong> На Windows это событие не произойдет, если приложение закрылось из-за выключения/перезагрузки системы или выхода пользователя из системы.</p>\n<h3 id=\"событие-quit\"><a href=\"#событие-quit\">Событие: 'quit'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>exitCode</code> Integer</li>\n</ul>\n<p>Происходит при выходе из приложения.</p>\n<p><strong>Примечание:</strong> На Windows это событие не произойдет, если приложение закрылось из-за выключения/перезагрузки системы или выхода пользователя из системы.</p>\n<h3 id=\"событие-open-file-macos\"><a href=\"#событие-open-file-macos\">Событие: 'open-file' <em>macOS</em></a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>path</code> String</li>\n</ul>\n<p>Происходит, когда пользователь хочет открыть файл. Событие <code>open-file</code> обычно происходит, когда приложение уже открыто и ОС хочет переиспользовать приложение, чтобы открыть файл. <code>open-file</code> также происходит, когда файл уже находится на Dock панели, но приложение еще не запущено. Убедитесь, что обработчик события <code>open-file</code> в самом начале запуска Вашего приложения обрабатывает этот случай (даже прежде, чем происходит событие <code> ready</code>).</p>\n<p>Вы должны вызвать <code>event.preventDefault()</code>, если хотите обработать это событие.</p>\n<p>На Windows Вам необходимо распарсить <code>process.argv</code> (в основном процессе), чтобы получить путь к файлу.</p>\n<h3 id=\"событие-open-url-macos\"><a href=\"#событие-open-url-macos\">Событие: 'open-url' <em>macOS</em></a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>url</code> String</li>\n</ul>\n<p>Происходит, когда пользователь хочет открыть URL-адрес из приложения. Файл Вашего приложения <code>Info.plist</code> должнен определять схему URL в ключе <code>CFBundleURLTypes</code> и установить <code>NSPrincipalClass</code> в <code>AtomApplication</code>.</p>\n<p>Вы должны вызвать <code>event.preventDefault()</code>, если хотите обработать это событие.</p>\n<h3 id=\"событие-activate-macos\"><a href=\"#событие-activate-macos\">Событие: 'activate' <em>macOS</em></a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>hasVisibleWindows</code> Boolean</li>\n</ul>\n<p>Происходит при активации приложения. Различные действия могут запускать это событие, например, запуск приложения в первый раз, попытка перезапустить приложение, когда оно уже запущено, или клик на иконку приложения на панели dock или панели задач.</p>\n<h3 id=\"событие-did-become-active-macos\"><a href=\"#событие-did-become-active-macos\">Событие: 'did-become-active' <em>macOS</em></a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n</ul>\n<p>Происходит при активации приложения. Отличие от события <code>activate</code> в том, что <code>did-become-active</code> происходит после каждой активации приложения, а не только при нажатии на иконку на панели задач или перезапуске приложения.</p>\n<h3 id=\"событие-continue-activity-macos\"><a href=\"#событие-continue-activity-macos\">Событие: 'continue-activity' <em>macOS</em></a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>type</code> String - строка идентифицирует активность. Карты для <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> unknown - содержит специфическое для приложения состояние, сохраненное на другом устройстве.</li>\n<li>Объект <code>details</code><ul>\n<li><code>webpageURL</code> String (optional) - A string identifying the URL of the webpage accessed by the activity on another device, if available.</li>\n</ul></li>\n</ul>\n<p>Происходит во время <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a>, когда активность с другого устройства хочет возобновиться. Если вы хотите обработать это событие следует вызвать <code>event.preventDefault()</code>.</p>\n<p>Активность пользователя может быть продолжена только в приложении, которое имеет тот же ID команды разработчика, что и исходное приложение, и поддерживает тип активности. Поддерживаемые типы активности, указаны в <code>Info.plist</code> приложения под ключом <code>NSUserActivityTypes</code>.</p>\n<h3 id=\"событие-will-continue-activity-macos\"><a href=\"#событие-will-continue-activity-macos\">Событие: 'will-continue-activity' <em>macOS</em></a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>type</code> String - строка идентифицирует активность. Карты для <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n</ul>\n<p>Происходит во время <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> до того, как активность с другого устройства хочет возобновиться. Если вы хотите обработать это событие следует вызвать <code>event.preventDefault()</code>.</p>\n<h3 id=\"событие-continue-activity-macos-1\"><a href=\"#событие-continue-activity-macos-1\">Событие: 'continue-activity' <em>macOS</em></a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>type</code> String - строка идентифицирует активность. Карты для <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>error</code> String - cтрока с локализованным описанием ошибки.</li>\n</ul>\n<p>Происходит во время <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a>, при ошибочном возобновлении активности на различных устройствах.</p>\n<h3 id=\"событие-activity-was-continued-macos\"><a href=\"#событие-activity-was-continued-macos\">Событие: 'activity-was-continued' <em>macOS</em></a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>type</code> String - строка идентифицирует активность. Карты для <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> unknown - содержит специфичное, для приложения, состояние, сохраненное в хранилище по активности.</li>\n</ul>\n<p>Происходит во время <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a>, после удачного возобновления на другом устройстве.</p>\n<h3 id=\"событие-update-activity-state-macos\"><a href=\"#событие-update-activity-state-macos\">Событие: 'update-activity-state' <em>macOS</em></a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>type</code> String - строка идентифицирует активность. Карты для <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> unknown - содержит специфичное, для приложения, состояние, сохраненное в хранилище по активности.</li>\n</ul>\n<p>Происходит во время <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a>, когда вот-вот возобновится на другом устройстве. Если Вы хотите обновить состояние, которое будет передано, Вам необходимо вызвать <code>event.preventDefault()</code> немедленно, собрать новый словарь <code>userInfo</code> и вызвать <code>app.updateCurrentActivity()</code> своевременно. Иначе, операция завершится ошибкой и будет вызвано <code>continue-activity-error</code>.</p>\n<h3 id=\"событие-new-window-for-tab-macos\"><a href=\"#событие-new-window-for-tab-macos\">Событие: 'new-window-for-tab' <em>macOS</em></a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n</ul>\n<p>Возникает при нажатии пользователем кнопки новой вкладки macOS. Кнопка новой вкладки отобразится только если текущий <code>BrowserWindow</code> имеет <code>tabbingIdentifier</code></p>\n<h3 id=\"событие-browser-window-blur\"><a href=\"#событие-browser-window-blur\">Событие: 'browser-window-blur'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Возникает, когда <a href=\"/docs/api/browser-window\">browserWindow</a> получает размытие.</p>\n<h3 id=\"событие-browser-window-focus\"><a href=\"#событие-browser-window-focus\">Событие: 'browser-window-focus'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Возникает, когда <a href=\"/docs/api/browser-window\">browserWindow</a> получает фокус.</p>\n<h3 id=\"событие-browser-window-created\"><a href=\"#событие-browser-window-created\">Событие: 'browser-window-created'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Происходит, когда создался новый <a href=\"/docs/api/browser-window\">browserWindow</a>.</p>\n<h3 id=\"событие-web-contents-created\"><a href=\"#событие-web-contents-created\">Событие: 'web-contents-created'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Происходит, когда создался новый <a href=\"/docs/api/web-contents\">webContents</a>.</p>\n<h3 id=\"событие-certificate-error\"><a href=\"#событие-certificate-error\">Событие: 'certificate-error'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>url</code> String</li>\n<li><code>error</code> String - код ошибки</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>isTrusted</code> Boolean - учитывать ли сертификат как надёжный</li>\n</ul></li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Возникает, когда не удалось проверить <code>certificate</code> для <code>url</code>, чтобы доверять сертификату, вы должны предотвратить поведение по умолчанию с <code>event.preventDefault()</code> и вызвать <code>callback(true)</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'certificate-error'</span>, (event, webContents, url, error, certificate, callback) => {\n  <span class=\"hljs-keyword\">if</span> (url === <span class=\"hljs-string\">'https://github.com'</span>) {\n    <span class=\"hljs-comment\">// Сверка логики.</span>\n    event.preventDefault()\n    callback(<span class=\"hljs-literal\">true</span>)\n  } <span class=\"hljs-keyword\">else</span> {\n    callback(<span class=\"hljs-literal\">false</span>)\n  }\n})\n</code></pre>\n<h3 id=\"событие-select-client-certificate\"><a href=\"#событие-select-client-certificate\">Событие: 'select-client-certificate'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>url</code> URL</li>\n<li><code>certificateList</code> <a href=\"/docs/api/structures/certificate\">Certificate[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> (опиционально)</li>\n</ul></li>\n</ul>\n<p>Возникает при запросе сертификата клиента.</p>\n<p><code>url</code> соответствует записи навигации, запрашивающей сертификат клиента и <code>callback</code> можно вызвать с записью, отфильтрованной из списка. <code>event.preventDefault()</code> предотвращает приложению использование первого сертификата из хранилища.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'select-client-certificate'</span>, (event, webContents, url, list, callback) => {\n  event.preventDefault()\n  callback(list[<span class=\"hljs-number\">0</span>])\n})\n</code></pre>\n<h3 id=\"событие-login\"><a href=\"#событие-login\">Событие: 'login'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>authenticationResponseDetails</code> Object<ul>\n<li><code>url</code> URL</li>\n</ul></li>\n<li><code>authInfo</code> Object<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (опционально)</li>\n<li><code>password</code> String (опционально)</li>\n</ul></li>\n</ul>\n<p>Возникает <code>webContents</code>, когда делается базовый auth.</p>\n<p>Поведение по умолчанию - отмена всех аутентификаций. Чтобы переопределить это, Вы должны предотвратить поведение по умолчанию с помощью <code>event.preventDefault()</code> и вызвать <code>callback(username, password)</code> с учетными данными.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'login'</span>, (event, webContents, details, authInfo, callback) => {\n  event.preventDefault()\n  callback(<span class=\"hljs-string\">'username'</span>, <span class=\"hljs-string\">'secret'</span>)\n})\n</code></pre>\n<p>Если <code> calllback</code> вызывается без имени пользователя или пароля, запрос аутентификации будет отменен и ошибка аутентификации будет возвращена на страницу.</p>\n<h3 id=\"событие-gpu-info-update\"><a href=\"#событие-gpu-info-update\">Событие: 'gpu-info-update'</a></h3>\n<p>Выдается при каждом обновлении информации о GPU.</p>\n<h3 id=\"event-gpu-process-crashed-deprecated\"><a href=\"#event-gpu-process-crashed-deprecated\">Event: 'gpu-process-crashed' <em>Deprecated</em></a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>Возникает, когда процесс GPU аварийно завершает работу или завершается принудительно.</p>\n<p><strong>Устарело:</strong> Это событие заменяется событием <code>child-process-gone</code>, которое содержит больше информации о том, почему дочерний процесс исчез. 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>\n<h3 id=\"event-renderer-process-crashed-deprecated\"><a href=\"#event-renderer-process-crashed-deprecated\">Event: 'renderer-process-crashed' <em>Deprecated</em></a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>Происходит, когда графический процесс <code>webContents</code> аварийно завершает работу или является убитым.</p>\n<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>\n<h3 id=\"event-render-process-gone\"><a href=\"#event-render-process-gone\">Event: 'render-process-gone'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li>Объект <code>details</code><ul>\n<li><code>reason</code> String - The reason the render process is gone.  Возможные значения:<ul>\n<li><code>clean-exit</code> - Process exited with an exit code of zero</li>\n<li><code>abnormal-exit</code> - Process exited with a non-zero exit code</li>\n<li><code>killed</code> - Process was sent a SIGTERM or otherwise killed externally</li>\n<li><code>crashed</code> - Process crashed</li>\n<li><code>oom</code> - Process ran out of memory</li>\n<li><code>launch-failed</code> - Process never successfully launched</li>\n<li><code>integrity-failure</code> - Windows code integrity checks failed</li>\n</ul></li>\n<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>\n</ul></li>\n</ul>\n<p>Emitted when the renderer process unexpectedly disappears.  This is normally because it was crashed or killed.</p>\n<h3 id=\"событие-child-process-gone\"><a href=\"#событие-child-process-gone\">Событие 'child-process-gone'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li>Объект <code>details</code><ul>\n<li><code>type</code> String - Тип процесса. Одно из следующих значений:<ul>\n<li><code>Utility</code></li>\n<li><code>Zygote</code></li>\n<li><code>Sandbox helper</code></li>\n<li><code>GPU</code></li>\n<li><code>Pepper Plugin</code></li>\n<li><code>Pepper Plugin Broker</code></li>\n<li><code>Unknown</code></li>\n</ul></li>\n<li><code>reason</code> String - Причина исчезновения дочернего процесса. Возможные значения:<ul>\n<li><code>clean-exit</code> - Process exited with an exit code of zero</li>\n<li><code>abnormal-exit</code> - Process exited with a non-zero exit code</li>\n<li><code>killed</code> - Process was sent a SIGTERM or otherwise killed externally</li>\n<li><code>crashed</code> - Process crashed</li>\n<li><code>oom</code> - Process ran out of memory</li>\n<li><code>launch-failed</code> - Process never successfully launched</li>\n<li><code>integrity-failure</code> - Windows code integrity checks failed</li>\n</ul></li>\n<li><code>exitCode</code> Number - The exit code for the process (e.g. status from waitpid if on posix, from GetExitCodeProcess on Windows).</li>\n<li><code>serviceName</code> String (optional) - The non-localized name of the process.</li>\n<li><code>name</code> String (опционально) - Название процесса. Например: <code>Audio Service</code>, <code>Content Decryption Module Service</code>, <code>Network Service</code>, <code>Video Capture</code> и т.д.</li>\n</ul></li>\n</ul>\n<p>Emitted when the child process unexpectedly disappears. This is normally because it was crashed or killed. It does not include renderer processes.</p>\n<h3 id=\"событие-accessibility-support-changed-macos-windows\"><a href=\"#событие-accessibility-support-changed-macos-windows\">Событие: 'accessibility-support-changed' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>accessibilitySupportEnabled</code> Boolean - <code>true</code> когда доступность поддержки Chrome включена, <code>false</code> в противном случае.</li>\n</ul>\n<p>Возникает при изменении Chrome поддержки специальных возможностей. Это событие срабатывает, когда вспомогательные технологии, такие как устройства чтения с экрана, включены или отключены. Смотрите <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">https://www.chromium.org/developers/design-documents/accessibility</a> для подробностей.</p>\n<h3 id=\"событие-session-created\"><a href=\"#событие-session-created\">Событие: 'session-created'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>session</code> <a href=\"/docs/api/session\">Session</a></li>\n</ul>\n<p>Происходит, когда Electron создал новый объект <code>session</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'session-created'</span>, (session) => {\n  <span class=\"hljs-built_in\">console</span>.log(session)\n})\n</code></pre>\n<h3 id=\"событие-second-instance\"><a href=\"#событие-second-instance\">Событие: 'second-instance'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>argv</code> String [] - массив аргументов командной строки вторичных экземпляров</li>\n<li><code>workingDirectory</code> String - рабочий каталог вторичных экземпляров</li>\n</ul>\n<p>Это событие произойдет внутри главного экземпляра Вашего приложения, когда второй экземпляр был запущен и вызывает <code>app.requestSingleInstanceLock()</code>.</p>\n<p><code>argv</code> это массив аргументов командной строки второго экземпляра, а <code>workingDirectory</code> это текущая рабочая директория. Обычно приложения реагируют на это, делая их основное окно сфокусированным и не свернутым.</p>\n<p><strong>Примечание:</strong> Если второй экземпляр запускается другим пользователем, массив <code>argv</code> не будет содержать аргументы.</p>\n<p>Это событие гарантировано происходит после события <code>ready</code> в <code>app</code>.</p>\n<p><strong>Примечание:</strong> Дополнительные аргументы командной строки могут быть добавлены Chromium, такие как <code>--original-process-start-time</code>.</p>\n<h3 id=\"событие-desktop-capturer-get-sources\"><a href=\"#событие-desktop-capturer-get-sources\">Событие: 'desktop-capturer-get-sources'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Возникает, когда <code>desktopCapturer.getSources()</code> вызывается в процессе рендерера <code>webContents</code>. Вызов <code>event.preventDefault()</code> вернет пустые источники.</p>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Объект <code>app</code> имеет следующие методы:</p>\n<p><strong>Примечание:</strong> Некоторые методы доступны только в определенных операционных системах и помечены как таковые.</p>\n<h3 id=\"appquit\"><a href=\"#appquit\"><code>app.quit()</code></a></h3>\n<p>Попробуйте закрыть все окна. Сначала возникнет событие <code>before-quit</code>. Если все окна успешно закрыты, событие <code>will-quit</code> возникнет и по умолчанию приложение будет завершено.</p>\n<p>Этот метод гарантирует, что все обработчики событий <code>beforeunload</code> и <code>unload</code> выполнятся корректно. Вполне возможно, что окно отменит выход, возвращая <code>false</code> в обработчике событий <code>beforeunload</code>.</p>\n<h3 id=\"appexitexitcode\"><a href=\"#appexitexitcode\"><code>app.exit([exitCode])</code></a></h3>\n<ul>\n<li><code>exitCode</code> Integer (опционально)</li>\n</ul>\n<p>Немедленный выход с помощью <code>exitCode</code>. <code>exitCode</code> по умолчанию 0.</p>\n<p>Все окна будут закрыты немедленно, без разрешения пользователя, а также события <code>before-quit</code> и <code>will-quit</code> не будут происходить.</p>\n<h3 id=\"apprelaunchoptions\"><a href=\"#apprelaunchoptions\"><code>app.relaunch([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>args</code> String<a href=\"/docs/api/%D0%BE%D0%BF%D1%86%D0%B8%D0%BE%D0%BD%D0%B0%D0%BB%D1%8C%D0%BD%D0%BE\"></a></li>\n<li><code>execPath</code> String (опционально)</li>\n</ul></li>\n</ul>\n<p>Перезапускает приложение, когда существует текущий экземпляр.</p>\n<p>По умолчанию, новый экземпляр будет использовать ту же самую рабочую директорию и аргументы командной строки, что и текущий экземпляр. Когда <code>args</code> указаны, <code>args</code> передадутся как аргументы командной строки. Когда <code>execPath</code> задан, вместо текущего приложения будет выполнен <code>execPath</code> для перезапуска.</p>\n<p>Обратите внимание, что этот метод не завершает приложение при выполнении, Вам нужно вызвать <code>app.quit</code> или <code>app.exit</code> после вызова <code>app.relaunch</code>, чтобы перезапустить приложение.</p>\n<p>Когда <code>app.relaunch</code> вызывается несколько раз, несколько экземпляров будет запущено после выхода из текущего экземпляра.</p>\n<p>Пример немедленного перезапуска текущего экземпляра и добавления нового аргумента в командную строку нового экземпляра:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.relaunch({ <span class=\"hljs-attr\">args</span>: process.argv.slice(<span class=\"hljs-number\">1</span>).concat([<span class=\"hljs-string\">'--relaunch'</span>]) })\napp.exit(<span class=\"hljs-number\">0</span>)\n</code></pre>\n<h3 id=\"appisready\"><a href=\"#appisready\"><code>app.isReady()</code></a></h3>\n<p>Возвращает <code>Boolean</code> - <code>true,</code> если Electron завершил инициализацию, иначе <code>false</code>. См. также <code>app.whenReady()</code>.</p>\n<h3 id=\"appwhenready\"><a href=\"#appwhenready\"><code>app.whenReady()</code></a></h3>\n<p>Возвращает <code>Promise&#x3C;void></code> - выполняется при инициализации Electron. Может быть использован в качестве удобной альтернативы проверки <code>app.isReady()</code> и подписывания на событие <code>ready</code>, если приложение еще не готово.</p>\n<h3 id=\"appfocusoptions\"><a href=\"#appfocusoptions\"><code>app.focus([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>steal</code> Boolean <em>macOS</em> - Make the receiver the active app even if another app is currently active.</li>\n</ul></li>\n</ul>\n<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>\n<p>You should seek to use the <code>steal</code> option as sparingly as possible.</p>\n<h3 id=\"apphide-macos\"><a href=\"#apphide-macos\"><code>app.hide()</code> <em>macOS</em></a></h3>\n<p>Скрывает все окна приложения, не минимизируя их.</p>\n<h3 id=\"appshow-macos\"><a href=\"#appshow-macos\"><code>app.show()</code> <em>macOS</em></a></h3>\n<p>Показывает окна приложения после того, как они были скрыты. Автоматической фокусировки на них не происходит.</p>\n<h3 id=\"appsetapplogspathpath\"><a href=\"#appsetapplogspathpath\"><code>app.setAppLogsPath([path])</code></a></h3>\n<ul>\n<li><code>path</code> String (опционально) - пользовательский путь для Ваших логов. Должен быть абсолютным.</li>\n</ul>\n<p>Устанавливает или создает каталог логов Вашего приложения, которые затем могут быть обработаны с помощью <code>app.getPath()</code> или <code>app.setPath(pathName, newPath)</code>.</p>\n<p>Вызов <code>app.setAppLogsPath()</code> без параметра <code>path</code> приведет к тому, что этот каталог будет установлен на <code>~/Library/Logs/YourAppName</code> на <em>macOS</em>, и внутри директории <code>userData</code> на <em>Linux</em> и <em>Windows</em>.</p>\n<h3 id=\"appgetapppath\"><a href=\"#appgetapppath\"><code>app.getAppPath()</code></a></h3>\n<p>Возвращает <code>String</code> - текущая директория приложения.</p>\n<h3 id=\"appgetpathname\"><a href=\"#appgetpathname\"><code>app.getPath(name)</code></a></h3>\n<ul>\n<li><code>name</code> String - You can request the following paths by the name:<ul>\n<li><code>home</code> домашняя директория пользователя.</li>\n<li><code>appData</code> Per-user application data directory, which by default points to:<ul>\n<li><code>%APPDATA%</code> на Windows</li>\n<li><code>$XDG_CONFIG_HOME</code> или <code>~/.config</code> на Linux</li>\n<li><code>~/Library/Application Support</code> на macOS</li>\n</ul></li>\n<li><code>userData</code> директория для хранения файлов конфигурации Вашего приложения, которая по умолчанию является директорией <code>appData</code> с названием Вашего приложения в конце.</li>\n<li><code>кэш</code></li>\n<li><code>temp</code> временный каталог.</li>\n<li><code>exe</code> текущий исполняемый файл.</li>\n<li><code>module</code> библиотека <code>libchromiumcontent</code>.</li>\n<li><code>desktop</code> директория рабочего стола, для текущего пользователя.</li>\n<li><code>documents</code> директория пользователя \"Мои Документы\".</li>\n<li><code>downloads</code> директория пользователя для загрузок.</li>\n<li><code>music</code> директория пользователя для музыки.</li>\n<li><code>pictures</code> директория пользователя для фотографий.</li>\n<li><code>videos</code> директория пользователя для видео.</li>\n<li><code>recent</code> Directory for the user's recent files (Windows only).</li>\n<li><code>logs</code> директория для логов Вашего приложения.</li>\n<li><code>crashDumps</code> Directory where crash dumps are stored.</li>\n</ul></li>\n</ul>\n<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>\n<p>Если <code>app.getPath('logs')</code> вызывается без имени <code>app.setAppLogsPath()</code>, то сначала создается каталог журнала по умолчанию, эквивалентный вызову <code>app.setAppLogsPath()</code> без параметра <code>path</code>.</p>\n<h3 id=\"appgetfileiconpath-options\"><a href=\"#appgetfileiconpath-options\"><code>app.getFileIcon(path[, options])</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n<li><code>options</code> Object (опционально)<ul>\n<li>Строка <code>size</code><ul>\n<li><code>small</code> - 16x16</li>\n<li><code>normal</code> - 32x32</li>\n<li><code>large</code> - 48x48 на <em>Linux</em>, 32x32 на <em>Windows</em>, не поддерживается на <em>macOS</em>.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;NativeImage></code> - содержащий иконку приложения, которая является <a href=\"/docs/api/native-image\">NativeImage</a>.</p>\n<p>Извлекает иконку, связанную с путем.</p>\n<p>На <em>Windows</em> есть 2 вида иконок:</p>\n<ul>\n<li>Значки, связанные с определенными расширениями, такими как <code>.mp3</code>, <code>.png</code>, и т.д.</li>\n<li>Значки внутри файла, таких как <code>.exe</code>, <code>.dll</code>, <code>.ico</code>.</li>\n</ul>\n<p>На <em>Linux</em> и <em>macOS</em> иконки зависят от приложения, ассоциируемого с mime-типом файла.</p>\n<h3 id=\"appsetpathname-path\"><a href=\"#appsetpathname-path\"><code>app.setPath(name, path)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n<li><code>path</code> String</li>\n</ul>\n<p>Переопределяет <code>path</code> в специальную директорию или файл, связанный с <code>name</code>. Если путь задает каталог, который не существует, то при вызове выбросится <code>Error</code>. В этом случае каталог должен быть создан с помощью <code>fs.mkdirSync</code> или аналогичным способом.</p>\n<p>Можно переопределять только пути <code>name</code>, определенные в <code>app.getPath</code>.</p>\n<p>По умолчанию cookies и кэш веб-страницы будут храниться в директории <code>userData</code>. Если Вы хотите изменить это расположение, Вам необходимо переопределить путь <code>userData</code> прежде, чем событие <code>ready</code> модуля <code>app</code> произойдет.</p>\n<h3 id=\"appgetversion\"><a href=\"#appgetversion\"><code>app.getVersion()</code></a></h3>\n<p>Возвращает <code>String</code> - версию загруженного приложения. Если версия не найдена в файле приложения <code>package.json</code>, возвращается версия текущего пакета или исполняемого файла.</p>\n<h3 id=\"appgetname\"><a href=\"#appgetname\"><code>app.getName()</code></a></h3>\n<p>Возвращает <code>String</code> - имя текущего приложения, которое является именем в файле приложения <code>package.json</code>.</p>\n<p>Обычно поле <code>name</code> в <code>package.json</code> является коротким именем, написанном в нижнем регистре, согласно спецификации модулей npm. Обычно Вы должны также указать поле <code>productName</code>, которое пишется заглавными буквами - имя Вашего приложения, и которое будет предпочтительнее <code>name</code> для Electron.</p>\n<h3 id=\"appsetnamename\"><a href=\"#appsetnamename\"><code>app.setName(name)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n</ul>\n<p>Переопределяет имя текущего приложения.</p>\n<p><strong>Примечание:</strong> Эта функция перекрывает имя, используемое внутри Electron; это не влияет на имя, которое использует ОС.</p>\n<h3 id=\"appgetlocale\"><a href=\"#appgetlocale\"><code>app.getLocale()</code></a></h3>\n<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://source.chromium.org/chromium/chromium/src/+/master:ui/base/l10n/l10n_util.cc\">here</a>.</p>\n<p>To set the locale, you'll want to use a command line switch at app startup, which may be found <a href=\"/docs/api/command-line-switches\">here</a>.</p>\n<p><strong>Примечание:</strong> При распространении упакованного приложения, нужно также добавить папку <code>locales</code>.</p>\n<p><strong>Примечание</strong> На Windows Вы должны вызывать этот метод после того, как событие <code>ready</code> произойдет.</p>\n<h3 id=\"appgetlocalecountrycode\"><a href=\"#appgetlocalecountrycode\"><code>app.getLocaleCountryCode()</code></a></h3>\n<p>Returns <code>String</code> - User operating system's locale two-letter <a href=\"https://www.iso.org/iso-3166-country-codes.html\">ISO 3166</a> country code. The value is taken from native OS APIs.</p>\n<p><strong>Примечание:</strong> Когда невозможно определить код страны языка, возвращает пустую строку.</p>\n<h3 id=\"appaddrecentdocumentpath-macos-windows\"><a href=\"#appaddrecentdocumentpath-macos-windows\"><code>app.addRecentDocument(path)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Добавляет <code>path</code> к списку последних документов.</p>\n<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>\n<h3 id=\"appclearrecentdocuments-macos-windows\"><a href=\"#appclearrecentdocuments-macos-windows\"><code>app.clearRecentDocuments()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Очищает список последних документов.</p>\n<h3 id=\"appsetasdefaultprotocolclientprotocol-path-args\"><a href=\"#appsetasdefaultprotocolclientprotocol-path-args\"><code>app.setAsDefaultProtocolClient(protocol[, path, args])</code></a></h3>\n<ul>\n<li><code>protocol</code> String - имя вашего протокола, без <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>\n<li><code>path</code> String (optional) <em>Windows</em> - The path to the Electron executable. Defaults to <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - Arguments passed to the executable. По умолчанию пустой массив</li>\n</ul>\n<p>Возвращает <code>Boolean</code> - был ли вызов успешным.</p>\n<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>\n<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://www.electronforge.io/\">Electron Forge</a>, <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a>, or by editing <code>info.plist</code> with a text editor. За подробными сведениями обращайтесь к <a href=\"https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102207-TPXREF115\">документации компании Apple</a>.</p>\n<p><strong>Примечание:</strong> В окружении Windows Store (когда упаковано как <code>appx</code>) этот метод вернет <code>true</code> для всех вызовов, но ключ реестра, который он устанавливает, не будет доступен другим приложениям.  Чтобы зарегистрировать Ваше приложения в Windows Store как обработчик протокола по умолчанию, Вы должны <a href=\"https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol\">объявить протокол в Вашем манифесте</a>.</p>\n<p>The API uses the Windows Registry and <code>LSSetDefaultHandlerForURLScheme</code> internally.</p>\n<h3 id=\"appremoveasdefaultprotocolclientprotocol-path-args-macos-windows\"><a href=\"#appremoveasdefaultprotocolclientprotocol-path-args-macos-windows\"><code>app.removeAsDefaultProtocolClient(protocol[, path, args])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>protocol</code> String - имя вашего протокола, без <code>://</code>.</li>\n<li><code>path</code> String (optional) <em>Windows</em> - по умолчанию <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - по умолчанию пустой массив</li>\n</ul>\n<p>Возвращает <code>Boolean</code> - был ли вызов успешным.</p>\n<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>\n<h3 id=\"appisdefaultprotocolclientprotocol-path-args\"><a href=\"#appisdefaultprotocolclientprotocol-path-args\"><code>app.isDefaultProtocolClient(protocol[, path, args])</code></a></h3>\n<ul>\n<li><code>protocol</code> String - имя вашего протокола, без <code>://</code>.</li>\n<li><code>path</code> String (optional) <em>Windows</em> - по умолчанию <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - по умолчанию пустой массив</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the current executable is the default handler for a protocol (aka URI scheme).</p>\n<p><strong>Примечание:</strong> На macOS можно использовать этот метод для проверки, если приложение было зарегистрировано в качестве обработчика протокола по умолчанию для протокола. Вы также можете проверить это, проверив <code>~/Library/Preferences/com.apple.LaunchServices.plist</code> на машине macOS. За подробными сведениями обращайтесь к <a href=\"https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme\">документации компании Apple</a>.</p>\n<p>The API uses the Windows Registry and <code>LSCopyDefaultHandlerForURLScheme</code> internally.</p>\n<h3 id=\"appgetapplicationnameforprotocolurl\"><a href=\"#appgetapplicationnameforprotocolurl\"><code>app.getApplicationNameForProtocol(url)</code></a></h3>\n<ul>\n<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>\n</ul>\n<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>\n<p>This method returns the application name of the default handler for the protocol (aka URI scheme) of a URL.</p>\n<h3 id=\"appgetapplicationinfoforprotocolurl-macos-windows\"><a href=\"#appgetapplicationinfoforprotocolurl-macos-windows\"><code>app.getApplicationInfoForProtocol(url)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<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>\n</ul>\n<p>Возвращает <code>Promise&#x3C;Object></code> - Разрешить с объектом, содержащим следующее:</p>\n<ul>\n<li><code>icon</code> NativeImage - the display icon of the app handling the protocol.</li>\n<li><code>path</code> String  - installation path of the app handling the protocol.</li>\n<li><code>name</code> String - display name of the app handling the protocol.</li>\n</ul>\n<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>\n<h3 id=\"appsetusertaskstasks-windows\"><a href=\"#appsetusertaskstasks-windows\"><code>app.setUserTasks(tasks)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>tasks</code> <a href=\"/docs/api/structures/task\">Task[]</a> - массив объектов <code>Task</code></li>\n</ul>\n<p>Добавляет <code>tasks</code> к категории <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks\">Tasks</a> в JumpList на Windows.</p>\n<p><code>tasks</code> - массив объектов <a href=\"/docs/api/structures/task\"><code>Task</code></a>.</p>\n<p>Возвращает <code>Boolean</code> - был ли вызов успешным.</p>\n<p><strong>Примечание:</strong> Если Вы хотите настроить список переходов еще больше - используйте <code>app.setJumpList(categories)</code>.</p>\n<h3 id=\"appgetjumplistsettings-windows\"><a href=\"#appgetjumplistsettings-windows\"><code>app.getJumpListSettings()</code> <em>Windows</em></a></h3>\n<p>Возвращает <code>Object</code>:</p>\n<ul>\n<li><code>minItems</code> Integer - минимальное количество элементов, которые будут показаны в Jump List (для более подробного описания этого значение см. <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx\">документация MSDN</a>).</li>\n<li><code>removedItems</code> <a href=\"/docs/api/structures/jump-list-item\">JumpListItem []</a> - массив объектов <code>JumpListItem</code>, которые соответствуют элементам, которые пользователь явно удалил из настраиваемых категорий в Jump List. Эти элементы не должны быть снова добавлены в список переходов, при <strong>следующем</strong> вызове <code>app.setJumpList()</code>, Windows не будет отображать любую пользовательскую категорию, содержащую любой из удаленных элементов.</li>\n</ul>\n<h3 id=\"appsetjumplistcategories-windows\"><a href=\"#appsetjumplistcategories-windows\"><code>app.setJumpList(categories)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>categories</code> <a href=\"/docs/api/structures/jump-list-category\">JumpListCategory[]</a> | <code>null</code> - массив типа <code>JumpListCategory</code>, состоящий из объектов.</li>\n</ul>\n<p>Задает или удаляет пользовательский список переходов для приложения и возвращает одну из следующих строк:</p>\n<ul>\n<li><code>ok</code> - ничего не случилось.</li>\n<li><code>error</code> - произошла одна или несколько ошибок, включите ведение журнала выполнения, чтобы выяснить возможную ошибку.</li>\n<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>\n<li><code>fileTypeRegistrationError</code> - была сделана попытка добавить ссылку на файл в список переходов для типа файла, который в приложении не зарегистрирован для обработки.</li>\n<li><code>customCategoryAccessDeniedError</code> - пользовательские категории не могут быть добавлены в список переходов из-за ограничений конфиденциальности пользователей или групповой политики.</li>\n</ul>\n<p>Если <code>categories</code> - <code>null</code>, то ранее установленный пользовательский список переходов (если таковой имеется) будет заменён стандартным списком переходов для приложения (управляется Windows).</p>\n<p><strong>Примечание:</strong> Если объект <code>JumpListCategory</code> не имеет ни <code>type</code>, ни <code>name</code> свойства, тогда <code>type</code> считается как <code>tasks</code>. Если свойство <code>name</code> установлено, но свойство <code>type</code> опущено, тогда <code>type</code> считается <code>custom</code>.</p>\n<p><strong>Примечание:</strong> Пользователи могут удалять элементы из пользовательских категорий, но Windows не будет позволять возвращать удаленный элемент в пользовательскую категорию до <strong>следующего</strong> удачного вызова <code>app.setJumpList(categories)</code>. Любая попытка вновь добавить удаленный элемент в пользовательскую категорию перед тем, как метод выполнится, приведёт к исключению всей категории из списка переходов. Список удаленных элементов можно получить с помощью <code>app.getJumpListSetting()</code>.</p>\n<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>\n<p>Вот очень простой способ, как создать пользовательский список переходов:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setJumpList([\n  {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'custom'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Recent Projects'</span>,\n    <span class=\"hljs-attr\">items</span>: [\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'file'</span>, <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'C:\\\\Projects\\\\project1.proj'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'file'</span>, <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'C:\\\\Projects\\\\project2.proj'</span> }\n    ]\n  },\n  { <span class=\"hljs-comment\">// has a name so `type` is assumed to be \"custom\"</span>\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Tools'</span>,\n    <span class=\"hljs-attr\">items</span>: [\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Tool A'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--run-tool-a'</span>,\n        <span class=\"hljs-attr\">icon</span>: process.execPath,\n        <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Runs Tool A'</span>\n      },\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Tool B'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--run-tool-b'</span>,\n        <span class=\"hljs-attr\">icon</span>: process.execPath,\n        <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Runs Tool B'</span>\n      }\n    ]\n  },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'frequent'</span> },\n  { <span class=\"hljs-comment\">// has no name and no type so `type` is assumed to be \"tasks\"</span>\n    <span class=\"hljs-attr\">items</span>: [\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'New Project'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--new-project'</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Create a new project.'</span>\n      },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Recover Project'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--recover-project'</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Recover Project'</span>\n      }\n    ]\n  }\n])\n</code></pre>\n<h3 id=\"apprequestsingleinstancelock\"><a href=\"#apprequestsingleinstancelock\"><code>app.requestSingleInstanceLock()</code></a></h3>\n<p>Возвращает <code>Boolean</code></p>\n<p>Значение, которое возвращает этот метод, указывает, успешно или нет экземпляр Вашего приложения получило блокировку.  Если не удалось получить блокировку, можно предположить, что другой экземпляр Вашего приложения уже запущен с блокировкой и немедленно выходит.</p>\n<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.  Возвращает <code>false</code>, если Ваш процесс должен немедленно завершиться, так как он отправил свои параметры другому экземпляру, которые уже приобрел блокировку.</p>\n<p>На macOS система автоматически обеспечивает единственный экземпляр, когда пользователи пытаются открыть второй экземпляра Вашего приложения в Finder, для этого будут происходить <code>open-file</code> и <code>open-url</code> события. Так или иначе, когда пользователи запустят Ваше приложение через командную строку, системный механизм единственного экземпляра будет обойден, и Вы должны использовать этот метод, чтобы обеспечить единственный экземпляр.</p>\n<p>Пример активации окна первичного экземпляра, при запуске второго экземпляра:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> myWindow = <span class=\"hljs-literal\">null</span>\n\n<span class=\"hljs-keyword\">const</span> gotTheLock = app.requestSingleInstanceLock()\n\n<span class=\"hljs-keyword\">if</span> (!gotTheLock) {\n  app.quit()\n} <span class=\"hljs-keyword\">else</span> {\n  app.on(<span class=\"hljs-string\">'second-instance'</span>, (event, commandLine, workingDirectory) => {\n    <span class=\"hljs-comment\">// Кто-то пытался запустить второй экземпляр, мы должны сфокусировать наше окно.</span>\n    <span class=\"hljs-keyword\">if</span> (myWindow) {\n      <span class=\"hljs-keyword\">if</span> (myWindow.isMinimized()) myWindow.restore()\n      myWindow.focus()\n    }\n  })\n\n  <span class=\"hljs-comment\">// Создать myWindow, загрузить остальную часть приложения, и т.д.</span>\n  app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    myWindow = createWindow()\n  })\n}\n</code></pre>\n<h3 id=\"apphassingleinstancelock\"><a href=\"#apphassingleinstancelock\"><code>app.hasSingleInstanceLock()</code></a></h3>\n<p>Возвращает <code>Boolean</code></p>\n<p>Этот метод возвращает состояние, является или нет экземпляр Вашего приложения в данный момент, удерживающим блокировку единственного экземпляра.  Вы можете запросить блокировку с помощью <code>app.requestSingleInstanceLock()</code> и освободить с помощью <code>app.releaseSingleInstanceLock()</code></p>\n<h3 id=\"appreleasesingleinstancelock\"><a href=\"#appreleasesingleinstancelock\"><code>app.releaseSingleInstanceLock()</code></a></h3>\n<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>\n<h3 id=\"appsetuseractivitytype-userinfo-webpageurl-macos\"><a href=\"#appsetuseractivitytype-userinfo-webpageurl-macos\"><code>app.setUserActivity(type, userInfo[, webpageURL])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>type</code> String - уникально идентифицирует действие. Карты для <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> any- специфичное, для приложения, состояние для использования другими устройствами.</li>\n<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>\n</ul>\n<p>Создает <code>NSUserActivity</code> и задает её в качестве текущей активности. Активность позже имеет право для <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> на другом устройстве.</p>\n<h3 id=\"appgetcurrentactivitytype-macos\"><a href=\"#appgetcurrentactivitytype-macos\"><code>app.getCurrentActivityType()</code> <em>macOS</em></a></h3>\n<p>Возвращает <code>String</code> - тип текущей выполняемой активности.</p>\n<h3 id=\"appinvalidatecurrentactivity-macos\"><a href=\"#appinvalidatecurrentactivity-macos\"><code>app.invalidateCurrentActivity()</code> <em>macOS</em></a></h3>\n<p>Аннулирует текущую <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> активность пользователя.</p>\n<h3 id=\"appresigncurrentactivity-macos\"><a href=\"#appresigncurrentactivity-macos\"><code>app.resignCurrentActivity()</code> <em>macOS</em></a></h3>\n<p>Помечает текущую <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> активность пользователя как неактивную без ее отмены.</p>\n<h3 id=\"appupdatecurrentactivitytype-userinfo-macos\"><a href=\"#appupdatecurrentactivitytype-userinfo-macos\"><code>app.updateCurrentActivity(type, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>type</code> String - уникально идентифицирует действие. Карты для <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> any- специфичное, для приложения, состояние для использования другими устройствами.</li>\n</ul>\n<p>Обновляет текущую активность, если его тип совпадает с <code>type</code>, объединяет записи из <code>userInfo</code> в его текущем словаре <code>userInfo</code>.</p>\n<h3 id=\"appsetappusermodelidid-windows\"><a href=\"#appsetappusermodelidid-windows\"><code>app.setAppUserModelId(id)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>id</code> String</li>\n</ul>\n<p>Изменяет <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> на <code>id</code>.</p>\n<h3 id=\"appsetactivationpolicypolicy-macos\"><a href=\"#appsetactivationpolicypolicy-macos\"><code>app.setActivationPolicy(policy)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>policy</code> String - Can be 'regular', 'accessory', or 'prohibited'.</li>\n</ul>\n<p>Sets the activation policy for a given app.</p>\n<p>Activation policy types:</p>\n<ul>\n<li>'regular' - The application is an ordinary app that appears in the Dock and may have a user interface.</li>\n<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>\n<li>'prohibited' - The application doesn’t appear in the Dock and may not create windows or be activated.</li>\n</ul>\n<h3 id=\"appimportcertificateoptions-callback-linux\"><a href=\"#appimportcertificateoptions-callback-linux\"><code>app.importCertificate(options, callback)</code> <em>Linux</em></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>certificate</code> String - путь к pkcs12 файлу.</li>\n<li><code>password</code> String - парольная фраза для сертификата.</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>result</code> Integer - результат импорта.</li>\n</ul></li>\n</ul>\n<p>Импорт сертификата в формате pkcs12 из платформы хранилища сертификатов. <code>callback</code> вызывается с <code>result</code> - результат операции импорта, значение <code>0</code> указывает на успех, все другие значения указывают на ошибку в соответствии со списком <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">net_error_list</a> в Chromium.</p>\n<h3 id=\"appconfigurehostresolveroptions\"><a href=\"#appconfigurehostresolveroptions\"><code>app.configureHostResolver(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<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>\n<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>\n<li><code>secureDnsServers</code> String[] (optional) - A list of DNS-over-HTTP server templates. See <a href=\"https://datatracker.ietf.org/doc/html/rfc8484#section-3\">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://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&#x26;ss=chromium%2Fchromium%2Fsrc\">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>\n<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>\n</ul></li>\n</ul>\n<p>Configures host resolution (DNS and DNS-over-HTTPS). By default, the following resolvers will be used, in order:</p>\n<ol>\n<li>DNS-over-HTTPS, if the <a href=\"https://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&#x26;ss=chromium%2Fchromium%2Fsrc\">DNS provider supports it</a>, then</li>\n<li>the built-in resolver (enabled on macOS only by default), then</li>\n<li>the system's resolver (e.g. <code>getaddrinfo</code>).</li>\n</ol>\n<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>\n<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>\n<pre><code class=\"hljs language-js\">app.configureHostResolver({\n  <span class=\"hljs-attr\">secureDnsMode</span>: <span class=\"hljs-string\">'secure'</span>,\n  <span class=\"hljs-attr\">secureDnsServers</span>: [\n    <span class=\"hljs-string\">'https://cloudflare-dns.com/dns-query'</span>\n  ]\n})\n</code></pre>\n<p>Этот API должен вызываться после того, как произошло событие <code>ready</code>.</p>\n<h3 id=\"appdisablehardwareacceleration\"><a href=\"#appdisablehardwareacceleration\"><code>app.disableHardwareAcceleration()</code></a></h3>\n<p>Отключает аппаратное ускорение для текущего приложения.</p>\n<p>Этот метод может быть вызван только до того, как приложение будет готово.</p>\n<h3 id=\"appdisabledomainblockingfor3dapis\"><a href=\"#appdisabledomainblockingfor3dapis\"><code>app.disableDomainBlockingFor3DAPIs()</code></a></h3>\n<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>\n<p>Этот метод может быть вызван только до того, как приложение будет готово.</p>\n<h3 id=\"appgetappmetrics\"><a href=\"#appgetappmetrics\"><code>app.getAppMetrics()</code></a></h3>\n<p>Возвращает <a href=\"/docs/api/structures/process-metric\"><code>ProcessMetric[]</code></a>: массив объектов <code>ProcessMetric</code>, которые соответствует статистике использования памяти и CPU всех процессов, связанных с приложением.</p>\n<h3 id=\"appgetgpufeaturestatus\"><a href=\"#appgetgpufeaturestatus\"><code>app.getGPUFeatureStatus()</code></a></h3>\n<p>Возвращает <a href=\"/docs/api/structures/gpu-feature-status\"><code>GPUFeatureStatus</code></a> - статус функции графики из <code>chrome://gpu/</code>.</p>\n<p><strong>Примечание:</strong> Эта информация может использоваться только после возникновения события <code>gpu-info-update</code>.</p>\n<h3 id=\"appgetgpuinfoinfotype\"><a href=\"#appgetgpuinfoinfotype\"><code>app.getGPUInfo(infoType)</code></a></h3>\n<ul>\n<li><code>infoType</code> String - Может быть <code>basic</code> или <code>complete</code>.</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;unknown></code></p>\n<p>Для <code>infoType</code> равным <code>complete</code>: Промис выполняется с <code>объектом</code>, содержащий всю GPU информацию как в <a href=\"https://chromium.googlesource.com/chromium/src/+/4178e190e9da409b055e5dff469911ec6f6b716f/gpu/config/gpu_info.cc\">объекте GPUInfo в chromium</a>. Это включает информацию о версии и драйвере, показанную на странице <code>chrome://gpu</code>.</p>\n<p>Для <code>infoType</code> равным <code>basic</code>: Промис выполняется с <code>объектом</code>, содержащий меньшее количество атрибутов, чем когда запрашивается с <code>complete</code>. Вот пример базового ответа:</p>\n<pre><code class=\"hljs language-js\">{\n  <span class=\"hljs-attr\">auxAttributes</span>:\n   {\n     <span class=\"hljs-attr\">amdSwitchable</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">canSupportThreadedTextureMailbox</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">directComposition</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">directRendering</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">glResetNotificationStrategy</span>: <span class=\"hljs-number\">0</span>,\n     <span class=\"hljs-attr\">inProcessGpu</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">initializationTime</span>: <span class=\"hljs-number\">0</span>,\n     <span class=\"hljs-attr\">jpegDecodeAcceleratorSupported</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">optimus</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">passthroughCmdDecoder</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">sandboxed</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">softwareRendering</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">supportsOverlays</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">videoDecodeAcceleratorFlags</span>: <span class=\"hljs-number\">0</span>\n   },\n  <span class=\"hljs-attr\">gpuDevice</span>:\n   [{ <span class=\"hljs-attr\">active</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">deviceId</span>: <span class=\"hljs-number\">26657</span>, <span class=\"hljs-attr\">vendorId</span>: <span class=\"hljs-number\">4098</span> },\n     { <span class=\"hljs-attr\">active</span>: <span class=\"hljs-literal\">false</span>, <span class=\"hljs-attr\">deviceId</span>: <span class=\"hljs-number\">3366</span>, <span class=\"hljs-attr\">vendorId</span>: <span class=\"hljs-number\">32902</span> }],\n  <span class=\"hljs-attr\">machineModelName</span>: <span class=\"hljs-string\">'MacBookPro'</span>,\n  <span class=\"hljs-attr\">machineModelVersion</span>: <span class=\"hljs-string\">'11.5'</span>\n}\n</code></pre>\n<p>Использование <code>basics</code> должно быть предпочтительным, если требуется только основная информация, такая как <code>vendorId</code> или <code>driverId</code>.</p>\n<h3 id=\"appsetbadgecountcount-linux-macos\"><a href=\"#appsetbadgecountcount-linux-macos\"><code>app.setBadgeCount([count])</code> <em>Linux</em> <em>macOS</em></a></h3>\n<ul>\n<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>\n</ul>\n<p>Возвращает <code>Boolean</code> - был ли вызов успешным.</p>\n<p>Sets the counter badge for current app. Setting the count to <code>0</code> will hide the badge.</p>\n<p>На macOS отображается на иконке в Dock. На Linux работает только для лаунчера Unity.</p>\n<p><strong>Примечание:</strong> для работы Unity лаунчера требуется файл <code>.desktop</code>. Дополнительную информациюможно прочесть в <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Документации по интеграции Юнити</a>.</p>\n<h3 id=\"appgetbadgecount-linux-macos\"><a href=\"#appgetbadgecount-linux-macos\"><code>app.getBadgeCount()</code> <em>Linux</em> <em>macOS</em></a></h3>\n<p>Возвращает <code>Integer</code> - текущее значение, отображаемое в значке счётчика.</p>\n<h3 id=\"appisunityrunning-linux\"><a href=\"#appisunityrunning-linux\"><code>app.isUnityRunning()</code> <em>Linux</em></a></h3>\n<p>Возвращает <code>Boolean</code> - является ли текущее окружение рабочего стола Unity.</p>\n<h3 id=\"appgetloginitemsettingsoptions-macos-windows\"><a href=\"#appgetloginitemsettingsoptions-macos-windows\"><code>app.getLoginItemSettings([options])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>path</code> String (optional) <em>Windows</em> - The executable path to compare against. Defaults to <code>process.execPath</code>.</li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - The command-line arguments to compare against. Defaults to an empty array.</li>\n</ul></li>\n</ul>\n<p>Если Вы предоставили параметры <code>path</code> и <code>args</code> в <code>app.setLoginItemSettings</code>, тогда Вам необходимо передать те же аргументы сюда, чтобы <code>openAtLogin</code> установилось корректно.</p>\n<p>Возвращает <code>Object</code>:</p>\n<ul>\n<li><code>openAtLogin</code> Boolean - <code>true</code> если приложение планируется открыть при входе в систему.</li>\n<li><code>openAsHidden</code> Boolean <em>macOS</em> - <code>true</code> if the app is set to open as hidden at login. Эта настройка недоступна в <a href=\"/docs/tutorial/mac-app-store-submission-guide\">сборках MAS</a>.</li>\n<li><code>wasOpenedAtLogin</code> Boolean <em>macOS</em> - <code>true</code> if the app was opened at login automatically. Эта настройка недоступна в <a href=\"/docs/tutorial/mac-app-store-submission-guide\">сборках MAS</a>.</li>\n<li><code>wasOpenedAsHidden</code> Boolean <em>macOS</em> - <code>true</code> if the app was opened as a hidden login item. Это означает, что приложению не следует открывать любое окно при запуске. Эта настройка недоступна в <a href=\"/docs/tutorial/mac-app-store-submission-guide\">сборках MAS</a>.</li>\n<li><code>restoreState</code> Boolean <em>macOS</em> - <code>true</code> if the app was opened as a login item that should restore the state from the previous session. Это означает, что приложение должно восстановить окна, которые были открыты в последний раз, когда приложение было закрыто. Эта настройка недоступна в <a href=\"/docs/tutorial/mac-app-store-submission-guide\">сборках MAS</a>.</li>\n<li><code>executableWillLaunchAtLogin</code> Boolean <em>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>\n<li><code>launchItems</code> Object[] <em>Windows</em><ul>\n<li><code>name</code> String <em>Windows</em> - name value of a registry entry.</li>\n<li><code>path</code> String <em>Windows</em> - The executable to an app that corresponds to a registry entry.</li>\n<li><code>args</code> String[] <em>Windows</em> - the command-line arguments to pass to the executable.</li>\n<li><code>scope</code> String <em>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>\n<li><code>enabled</code> Boolean <em>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>\n</ul></li>\n</ul>\n<h3 id=\"appsetloginitemsettingssettings-macos-windows\"><a href=\"#appsetloginitemsettingssettings-macos-windows\"><code>app.setLoginItemSettings(settings)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>settings</code> Object<ul>\n<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>\n<li><code>openAsHidden</code> Boolean (optional) <em>macOS</em> - <code>true</code> to open the app as hidden. Значение по умолчанию: <code>false</code>. Пользователь может редактировать этот параметр в системных настройках, так что <code>app.getLoginItemSettings().wasOpenedAsHidden</code> должно быть проверено, когда приложение открыто, чтобы узнать текущее значение. Эта настройка недоступна в <a href=\"/docs/tutorial/mac-app-store-submission-guide\">сборках MAS</a>.</li>\n<li><code>path</code> String (optional) <em>Windows</em> - The executable to launch at login. Defaults to <code>process.execPath</code>.</li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - The command-line arguments to pass to the executable. Defaults to an empty array. Take care to wrap paths in quotes.</li>\n<li><code>enabled</code> Boolean (optional) <em>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>\n<li><code>name</code> String (optional) <em>Windows</em> - value name to write into registry. Defaults to the app's AppUserModelId(). Установите приложению параметры при входе в систему.</li>\n</ul></li>\n</ul>\n<p>Для работы с Electron <code>autoUpdater</code> на Windows, который использует <a href=\"https://github.com/Squirrel/Squirrel.Windows\">Squirrel</a>, вы можете задать путь запуска Update.exe и передавать аргументы, которые указывают на имя приложения. Например:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> appFolder = path.dirname(process.execPath)\n<span class=\"hljs-keyword\">const</span> updateExe = path.resolve(appFolder, <span class=\"hljs-string\">'..'</span>, <span class=\"hljs-string\">'Update.exe'</span>)\n<span class=\"hljs-keyword\">const</span> exeName = path.basename(process.execPath)\n\napp.setLoginItemSettings({\n  <span class=\"hljs-attr\">openAtLogin</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">path</span>: updateExe,\n  <span class=\"hljs-attr\">args</span>: [\n    <span class=\"hljs-string\">'--processStart'</span>, <span class=\"hljs-string\">`\"<span class=\"hljs-subst\">${exeName}</span>\"`</span>,\n    <span class=\"hljs-string\">'--process-start-args'</span>, <span class=\"hljs-string\">`\"--hidden\"`</span>\n  ]\n})\n</code></pre>\n<h3 id=\"appisaccessibilitysupportenabled-macos-windows\"><a href=\"#appisaccessibilitysupportenabled-macos-windows\"><code>app.isAccessibilitySupportEnabled()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Возвращает <code>Boolean</code> - <code>true</code> если включена поддержка специальных возможностей Chrome, и <code>false</code> в противном случае. Этот API будет возвращать <code>true</code>, если обнаружено использование вспомогательных технологий, таких как средства чтения с экрана. Смотрите <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">https://www.chromium.org/developers/design-documents/accessibility</a> для подробностей.</p>\n<h3 id=\"appsetaccessibilitysupportenabledenabled-macos-windows\"><a href=\"#appsetaccessibilitysupportenabledenabled-macos-windows\"><code>app.setAccessibilitySupportEnabled(enabled)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>enabled</code> Boolean - включить или отключить рендеринг древа <a href=\"https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree\">специальных возможностей</a></li>\n</ul>\n<p>Вручную включает поддержку специальных возможностей от Chrome, позволяя пользователям открывать специальные возможности в настройках приложения. Смотрите <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">документацию специальных возможностей Chromium</a> для подробной информации. Отключено по умолчанию.</p>\n<p>Этот API должен вызываться после того, как произошло событие <code>ready</code>.</p>\n<p><strong>Note:</strong> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.</p>\n<h3 id=\"appshowaboutpanel\"><a href=\"#appshowaboutpanel\"><code>app.showAboutPanel()</code></a></h3>\n<p>Show the app's about panel options. These options can be overridden with <code>app.setAboutPanelOptions(options)</code>.</p>\n<h3 id=\"appsetaboutpaneloptionsoptions\"><a href=\"#appsetaboutpaneloptionsoptions\"><code>app.setAboutPanelOptions(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>applicationName</code> String (опиционально) - имя приложения.</li>\n<li><code>applicationVersion</code> String (опиционально) - версия приложения.</li>\n<li><code>copyright</code> String (опиционально) - copyright информация.</li>\n<li><code>version</code> String (optional) <em>macOS</em> - The app's build version number.</li>\n<li><code>credits</code> String (optional) <em>macOS</em> <em>Windows</em> - Credit information.</li>\n<li><code>authors</code> String<a href=\"/docs/api/optional\"></a> <em>Linux</em> - List of app authors.</li>\n<li><code>website</code> String (optional) <em>Linux</em> - The app's website.</li>\n<li><code>iconPath</code> String (optional) <em>Linux</em> <em>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>\n</ul></li>\n</ul>\n<p>Установите описание панели опций. This will override the values defined in the app's <code>.plist</code> file on macOS. Смотрите <a href=\"https://developer.apple.com/reference/appkit/nsapplication/1428479-orderfrontstandardaboutpanelwith?language=objc\">Apple docs</a> для получения более подробной информации. На Linux необходимо устанавливать все значения; по умолчанию значений нет.</p>\n<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://developer.apple.com/documentation/appkit/nsaboutpaneloptioncredits?language=objc\">documentation</a> for more information.</p>\n<h3 id=\"appisemojipanelsupported\"><a href=\"#appisemojipanelsupported\"><code>app.isEmojiPanelSupported()</code></a></h3>\n<p>Возвращает <code>Boolean</code> - позволяет или нет текущая версия ОС выбирать нативные эмодзи.</p>\n<h3 id=\"appshowemojipanel-macos-windows\"><a href=\"#appshowemojipanel-macos-windows\"><code>app.showEmojiPanel()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Показывает нативный выбор эмодзи.</p>\n<h3 id=\"appstartaccessingsecurityscopedresourcebookmarkdata-mas\"><a href=\"#appstartaccessingsecurityscopedresourcebookmarkdata-mas\"><code>app.startAccessingSecurityScopedResource(bookmarkData)</code> <em>mas</em></a></h3>\n<ul>\n<li><code>bookmarkData</code> String - Закодированные base64 данные закладки области безопасности, возвращаемые <code>dialog.showOpenDialog</code> или <code>dialog.showSaveDialog</code>.</li>\n</ul>\n<p>Returns <code>Function</code> - This function <strong>must</strong> be called once you have finished accessing the security scoped file. Если Вы забыли, запретить доступ к закладке, <a href=\"https://developer.apple.com/reference/foundation/nsurl/1417051-startaccessingsecurityscopedreso?language=objc\">возможно утечка ресурсов ядра</a> и ваше приложение потеряет свою способность выйти за пределы песочницы, пока не будет перезапущено.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Получение доступа к файлу.</span>\n<span class=\"hljs-keyword\">const</span> stopAccessingSecurityScopedResource = app.startAccessingSecurityScopedResource(data)\n<span class=\"hljs-comment\">// Теперь вы можете получить доступ к файлу за пределами песочницы🎉</span>\n\n<span class=\"hljs-comment\">// Не забудьте прекратить доступ к файлу после того, как закончите с ним.</span>\nstopAccessingSecurityScopedResource()\n</code></pre>\n<p>Начать доступ в области безопасности ресурса. С помощью этого метода Electron приложения, которые упакованы для Mac App Store, могут выходить на пределы их песочницы, чтобы получить файлы, выбранные пользователем. Подробное описание как работает эта система, смотри <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">Apple's documentation</a>.</p>\n<h3 id=\"appenablesandbox\"><a href=\"#appenablesandbox\"><code>app.enableSandbox()</code></a></h3>\n<p>Включает полноценный режим песочницы в приложении. Это означает, что все рендереры будут запускаться изолированно, независимо от значения параметра <code>sandbox</code> флаг в WebPreferences.</p>\n<p>Этот метод может быть вызван только до того, как приложение будет готово.</p>\n<h3 id=\"appisinapplicationsfolder-macos\"><a href=\"#appisinapplicationsfolder-macos\"><code>app.isInApplicationsFolder()</code> <em>macOS</em></a></h3>\n<p>Возвращает <code>Boolean</code> - выполняется ли приложение в данный момент из системной папки Приложения. Используйте в сочетании с <code>app.moveToApplicationsFolder()</code></p>\n<h3 id=\"appmovetoapplicationsfolderoptions-macos\"><a href=\"#appmovetoapplicationsfolderoptions-macos\"><code>app.moveToApplicationsFolder([options])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>conflictHandler</code> Function\\<boolean> (опционально) - обработчик потенциальных конфликтов при неудачных попытках.<ul>\n<li><code>conflictType</code> String - Тип конфликта перемещения, с которым столкнулся обработчик; может быть <code>exists</code> или <code>existsAndRunning</code>, где <code>exists</code> означает, что приложение с тем же именем присутствует в каталоге приложений, а <code>existsAndRunning</code> означает, что он существует и работает в данный момент.</li>\n</ul></boolean></li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Boolean</code> - если перемещение было успешным. Обратите внимание, что если перемещение выполнено успешно, ваше приложение закроется и перезапустится.</p>\n<p>По умолчанию диалоговое окно подтверждения не отображается. Если нужно подтверждение операции пользователем, используйте <a href=\"/docs/api/dialog\"><code>dialog</code></a> API.</p>\n<p><strong>ПРИМЕЧАНИЕ:</strong> Этот метод выдает ошибки, если что-то, кроме пользователя, вызывает переход к неудачи. Например, если пользователь отменяет диалоговое окно авторизации, этот метод возвращает false. Если нам не удастся выполнить копирование, этот метод вызовет ошибку. Сообщение об ошибке должно быть информативным и сообщать вам именно то, что пошло не так.</p>\n<p>По умолчанию, если приложение с тем же именем, что и перемещаемое, существует в каталоге Applications и <em>not</em> запущено, существующее приложение будет удалено, а активное приложение перемещено на свое место. Если оно <em>работает</em>, на уже существующее запущенное приложение переместится фокус, а ранее активное приложение само завершит работу. Это поведение можно изменить, предоставив необязательный обработчик конфликтов, где логическое значение, возвращаемое обработчиком, определяет, будет ли конфликт перемещения разрешен с поведением по умолчанию.  то есть возврат <code>false</code> гарантирует, что дальнейшие действия не будут приняты, возврат <code>true</code> приведет к поведению по умолчанию и продолжению метода.</p>\n<p>Например:</p>\n<pre><code class=\"hljs language-js\">app.moveToApplicationsFolder({\n  <span class=\"hljs-attr\">conflictHandler</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">conflictType</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (conflictType === <span class=\"hljs-string\">'exists'</span>) {\n      <span class=\"hljs-keyword\">return</span> dialog.showMessageBoxSync({\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'question'</span>,\n        <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Halt Move'</span>, <span class=\"hljs-string\">'Continue Move'</span>],\n        <span class=\"hljs-attr\">defaultId</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'An app of this name already exists'</span>\n      }) === <span class=\"hljs-number\">1</span>\n    }\n  }\n})\n</code></pre>\n<p>Будет означать, что если приложение уже существует в каталоге пользователя, если пользователь выберет 'Continue Move', то эта функция будет продолжена с поведением по умолчанию, и существующее приложение будет удалено и активное приложение будет перемещено на место.</p>\n<h3 id=\"appissecurekeyboardentryenabled-macos\"><a href=\"#appissecurekeyboardentryenabled-macos\"><code>app.isSecureKeyboardEntryEnabled()</code> <em>macOS</em></a></h3>\n<p>Возвращает <code>Boolean</code> - если включен <code>Secure Keyboard Entry</code>.</p>\n<p>По умолчанию этот API вернет <code>false</code>.</p>\n<h3 id=\"appsetsecurekeyboardentryenabledenabled-macos\"><a href=\"#appsetsecurekeyboardentryenabledenabled-macos\"><code>app.setSecureKeyboardEntryEnabled(enabled)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>enabled</code> Boolean - Включить или отключить <code>Secure Keyboard Entry</code></li>\n</ul>\n<p>Установка <code>Secure Keyboard Entry</code> включена в вашем приложении.</p>\n<p>Используя этот API, можно предотвратить перехват важной информации, такой как пароль и другую конфиденциальную информацию, другими процессами.</p>\n<p>См. <a href=\"https://developer.apple.com/library/archive/technotes/tn2150/_index.html\">Apple's documentation</a> для получения дополнительной информации подробности.</p>\n<p><strong>Примечание:</strong> Включайте <code>Secure Keyboard Entry</code> только тогда, когда он нужен, и отключайте, когда он больше не нужен.</p>\n<h2 id=\"свойства\"><a href=\"#свойства\">Свойства</a></h2>\n<h3 id=\"appaccessibilitysupportenabled-macos-windows\"><a href=\"#appaccessibilitysupportenabled-macos-windows\"><code>app.accessibilitySupportEnabled</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p><code>Boolean</code> свойство, которое <code>true</code>, если поддержка специальных возможностей Chrome включена, иначе <code>false</code>. Это свойство будет <code>true</code>, если использование вспомогательных технологий, таких как средства чтения с экрана, были обнаружены. Устанавливая это свойство на <code>true</code>, вручную включает поддержку специальных возможностей Chrome, позволяя разработчикам показать пользователю переключатели специальных возможностей в настройках приложения.</p>\n<p>См. <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">Chromium's accessibility docs</a> для получения более подробной информации. Отключено по умолчанию.</p>\n<p>Этот API должен вызываться после того, как произошло событие <code>ready</code>.</p>\n<p><strong>Note:</strong> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.</p>\n<h3 id=\"appapplicationmenu\"><a href=\"#appapplicationmenu\"><code>app.applicationMenu</code></a></h3>\n<p>A <code>Menu | null</code>свойство, которое возвращает <a href=\"/docs/api/menu\"><code>Menu</code></a> если оно было установлено, в противном случае возвращает <code>null</code>. Пользователи могут передать <a href=\"/docs/api/menu\">Меню</a>, чтобы установить это свойство.</p>\n<h3 id=\"appbadgecount-linux-macos\"><a href=\"#appbadgecount-linux-macos\"><code>app.badgeCount</code> <em>Linux</em> <em>macOS</em></a></h3>\n<p>Свойство <code>Integer</code>, которое возвращает количество значков для текущего приложения. Установка счетчика на <code>0</code> скроет значок.</p>\n<p>В macOS установка любого ненулевого целого числа отображается на значке док-станции. В Linux это свойство работает только для модуля запуска Unity.</p>\n<p><strong>Примечание:</strong> для работы Unity лаунчера требуется файл <code>.desktop</code>. Дополнительную информациюможно прочесть в <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Документации по интеграции Юнити</a>.</p>\n<p><strong>Примечание:</strong> На macOS, вы должны убедиться, что ваше приложение имеет разрешение на отображение уведомлений.</p>\n<h3 id=\"appcommandline-readonly\"><a href=\"#appcommandline-readonly\"><code>app.commandLine</code> <em>Readonly</em></a></h3>\n<p>Объект <a href=\"/docs/api/command-line\"><code>CommandLine</code></a>, который позволяет читать и манипулировать аргументами командной строки, используемыми Chromium.</p>\n<h3 id=\"appdock-macos-readonly\"><a href=\"#appdock-macos-readonly\"><code>app.dock</code> <em>macOS</em> <em>Readonly</em></a></h3>\n<p>Это <a href=\"/docs/api/dock\"><code>Dock</code></a> <code>| undefined</code> объект, который позволяет вам выполнять действия со значком вашего приложения в пользовательском док на macOS.</p>\n<h3 id=\"appispackaged-readonly\"><a href=\"#appispackaged-readonly\"><code>app.isPackaged</code> <em>Readonly</em></a></h3>\n<p><code>Boolean</code> свойство, которое возвращает <code>true</code>, если приложение упаковано, <code>false</code> иначе. Для многих приложений это свойство может использоваться для отличия среды разработки и производства.</p>\n<h3 id=\"appname\"><a href=\"#appname\"><code>app.name</code></a></h3>\n<p>Свойство <code>String</code>, указывающее имя текущего приложения, которое является именем в файле <code>package.json</code>.</p>\n<p>Обычно поле <code>name</code> в <code>package.json</code> является коротким именем, написанном в нижнем регистре, согласно спецификации модулей npm. Обычно Вы должны также указать поле <code>productName</code>, которое пишется заглавными буквами - имя Вашего приложения, и которое будет предпочтительнее <code>name</code> для Electron.</p>\n<h3 id=\"appuseragentfallback\"><a href=\"#appuseragentfallback\"><code>app.userAgentFallback</code></a></h3>\n<p><code>Строка</code>, которая является строкой агента пользователя, которую Electron будет использовать в качестве глобального запаса.</p>\n<p>Это агент пользователя, который будет использоваться, если ни один агент пользователя не установлен на уровнях <code>webContents</code> или <code>session</code>.  Это полезно для того, чтобы все ваше приложение имело один и тот же пользовательский агент.  Установите пользовательское значение как можно раньше в инициализации Ваших приложений, чтобы убедиться, что используется переопределенное значение.</p>\n<h3 id=\"apprunningunderrosettatranslation-macos-readonly-deprecated\"><a href=\"#apprunningunderrosettatranslation-macos-readonly-deprecated\"><code>app.runningUnderRosettaTranslation</code> <em>macOS</em> <em>Readonly</em> <em>Deprecated</em></a></h3>\n<p>A <code>Boolean</code> which when <code>true</code> indicates that the app is currently running under the <a href=\"https://en.wikipedia.org/wiki/Rosetta_(software)\">Rosetta Translator Environment</a>.</p>\n<p>Вы можете использовать это свойство, чтобы предложить пользователям загрузить версию для arm64 вашего приложения, когда они запускают версию x64 под Rosetta неправильно.</p>\n<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>\n<h3 id=\"apprunningunderarm64translation-readonly-macos-windows\"><a href=\"#apprunningunderarm64translation-readonly-macos-windows\"><code>app.runningUnderARM64Translation</code> <em>Readonly</em> <em>macOS</em> <em>Windows</em></a></h3>\n<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://en.wikipedia.org/wiki/Rosetta_(software)\">Rosetta Translator Environment</a> or Windows <a href=\"https://en.wikipedia.org/wiki/Windows_on_Windows\">WOW</a>).</p>\n<p>Вы можете использовать это свойство, чтобы предложить пользователям загрузить версию для arm64 вашего приложения, когда они запускают версию x64 под Rosetta неправильно.</p>",
      "title": "app",
      "description": "Контролируйте жизненный цикл Вашего приложения."
    },
    "/docs/tutorial/application-debugging": {
      "locale": "ru-RU",
      "slug": "application-debugging",
      "href": "/docs/tutorial/application-debugging",
      "crowdinFileId": "256175",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/application-debugging.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"отладка-приложений\"><a href=\"#отладка-приложений\">Отладка приложений</a></h1>\n<p>Всякий раз, когда ваше приложение Electron не ведет себя так, как вы этого хотели, массив средств отладки может помочь вам найти ошибки в кодировании, узкие места производительности или возможности оптимизации.</p>\n<h2 id=\"процесс-визуализации\"><a href=\"#процесс-визуализации\">Процесс визуализации</a></h2>\n<p>Наиболее полным инструментом для отладки отдельных процессов рендеринга является набор инструментов разработчика Chromium. Он доступен для всех процессов рендеринга, включая экземпляры таких объектов как <code>BrowserWindow</code>, <code>BrowserView</code>, и <code>WebView</code>. Вы можете открыть их программно, вызывая API <code>openDevTools()</code> в <code>webContents</code> экземпляра:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.openDevTools()\n</code></pre>\n<p>Google предлагает <a href=\"https://developer.chrome.com/devtools\">отличную документацию для своих инструментов разработчика</a>. Мы рекомендуем вам ознакомиться с ними - они, как правило, являются одними из самых мощных утилит в инструментальном окружении для разработчиков Electron.</p>\n<h2 id=\"основной-процесс\"><a href=\"#основной-процесс\">Основной процесс</a></h2>\n<p>Отладка основного процесса немного сложнее, поскольку вы не можете открыть для них инструменты для разработчиков. Инструменты Chromium Developer Tools <a href=\"https://nodejs.org/en/docs/inspector/\">могут использоваться для отладки основного процесса Electron</a> благодаря более тесному сотрудничеству между Google / Chrome и Node.js, но вы можете столкнуться с такими странностями, которые вам не <code>нужны</code> в консоли.</p>\n<p>Для получения дополнительной информации см. Документацию <a href=\"/docs/tutorial/debugging-main-process\">Отладка основной процедуры</a>.</p>\n<h2 id=\"v8-crashes\"><a href=\"#v8-crashes\">V8 Crashes</a></h2>\n<p>If the V8 context crashes, the DevTools will display this message.</p>\n<p><code>DevTools was disconnected from the page. Once page is reloaded, DevTools will automatically reconnect.</code></p>\n<p>Chromium logs can be enabled via the <code>ELECTRON_ENABLE_LOGGING</code> environment variable. Для получения дополнительной информации обратитесь к <a href=\"/docs/api/environment-variables#electron_enable_logging\">документации по переменным окружения</a>.</p>\n<p>Alternatively, the command line argument <code>--enable-logging</code> can be passed. Дополнительная информация доступна в <a href=\"/docs/api/command-line-switches#--enable-loggingfile\">switches документации командной строки</a>.</p>",
      "title": "Отладка приложений",
      "description": ""
    },
    "/docs/tutorial/application-distribution": {
      "locale": "ru-RU",
      "slug": "application-distribution",
      "href": "/docs/tutorial/application-distribution",
      "crowdinFileId": "256177",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/application-distribution.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"распространение-приложений\"><a href=\"#распространение-приложений\">Распространение приложений</a></h1>\n<h2 id=\"обзор\"><a href=\"#обзор\">Обзор</a></h2>\n<p>To distribute your app with Electron, you need to package and rebrand it. Для этого можно использовать специализированный инструментарий или ручной подход.</p>\n<h2 id=\"с-инструментами\"><a href=\"#с-инструментами\">С инструментами</a></h2>\n<p>Вы можете использовать следующие инструменты для распространения вашего приложения:</p>\n<ul>\n<li><a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a></li>\n<li><a href=\"https://github.com/electron-userland/electron-builder\">electron-builder</a></li>\n<li><a href=\"https://github.com/electron/electron-packager\">electron-packager</a></li>\n</ul>\n<p>Эти инструменты позаботятся о всех шагах, которые вам нужно предпринять, чтобы получить распространяемое приложение Electron, такие как сборка вашего приложения, ребрендинг выполнения и установка нужных иконок.</p>\n<p>You can check the example of how to package your app with <code>electron-forge</code> in the <a href=\"/docs/tutorial/quick-start#package-and-distribute-your-application\">Quick Start guide</a>.</p>\n<h2 id=\"ручное-распространение\"><a href=\"#ручное-распространение\">Ручное распространение</a></h2>\n<h3 id=\"с-предустановленными-бинарными-файлами\"><a href=\"#с-предустановленными-бинарными-файлами\">С предустановленными бинарными файлами</a></h3>\n<p>Для ручного распространения вашего приложения Electron, вам нужно скачать <a href=\"https://github.com/electron/electron/releases\">предварительно собранные двоичные файлы</a> Electron. Далее папку, содержащую ваше приложение следует назвать <code>app</code> и поместить в каталог ресурсов Electron, как показано в следующих примерах.</p>\n<blockquote>\n<p><em>ПРИМЕЧАНИЕ:</em> расположение заранее встроенных двоичных файлов Electron указывается на примерах ниже, начиная с <code>electron/</code>.</p>\n</blockquote>\n<p><em>На macOS:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/Electron.app/Contents/Resources/app/\n├── package.json\n├── main.js\n└── index.html\n</code></pre>\n<p><em>На Windows и Linux:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/resources/app\n├── package.json\n├── main.js\n└── index.html\n</code></pre>\n<p>Then execute <code>Electron.app</code> on macOS, <code>electron</code> on Linux, or <code>electron.exe</code> on Windows, and Electron will start as your app. The <code>electron</code> directory will then be your distribution to deliver to users.</p>\n<h3 id=\"с-архивом-исходного-кода-приложения\"><a href=\"#с-архивом-исходного-кода-приложения\">С архивом исходного кода приложения</a></h3>\n<p>Вместо того, чтобы отправлять ваше приложение, копируя все исходные файлы, вы можете запаковать ваше приложение в <a href=\"https://github.com/electron/asar\">asar</a> архив, чтобы улучшить производительность чтения файлов на платформах, таких как Windows, если вы еще не используете такой пакет как Parcel или Webpack.</p>\n<p>Чтобы использовать архив <code>asar</code> для замены каталога <code>app</code>, необходимо переименовать архив в <code>app.asar</code> и положить его в каталог ресурсов Electron, как показано ниже, и Electron будет пытаться прочитать архив и начать с него.</p>\n<p><em>На macOS:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/Electron.app/Contents/Resources/\n└── app.asar\n</code></pre>\n<p><em>На Windows и Linux:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/resources/\n└── app.asar\n</code></pre>\n<p>Более подробную информацию об использовании <code>asar</code> вы можете найти в репозитории <a href=\"https://github.com/electron/asar\"><code>electron/asar</code></a>.</p>\n<h3 id=\"ребрендинг-скачанных-бинарных-файлов\"><a href=\"#ребрендинг-скачанных-бинарных-файлов\">Ребрендинг скачанных бинарных файлов</a></h3>\n<p>После построения вашего приложения в Electron и перед распространением вам следует провести его ребрендинг.</p>\n<h4 id=\"macos\"><a href=\"#macos\">macOS</a></h4>\n<p>Вы можете переименовать <code>Electron.app</code>, а также вы должны переименовать поля <code>CFBundleDisplayName</code>, <code>CFBundleIdentifier</code> и <code>CFBundleName</code> в следующих файлах:</p>\n<ul>\n<li><code>Electron.app/Contents/Info.plist</code></li>\n<li><code>Electron.app/Contents/Frameworks/Electron Helper.app/Contents/Info.plist</code></li>\n</ul>\n<p>Вы также можете переименовать helper приложения, чтобы избежать показа <code>Electron Helper</code> в Activity Monitor, но убедитесь, что вы переименовали имя исполняемого файла helper приложения.</p>\n<p>Структура переименования app будет такая:</p>\n<pre><code class=\"hljs language-plaintext\">MyApp.app/Contents\n├── Info.plist\n├── MacOS/\n│   └── MyApp\n└── Frameworks/\n    └── MyApp Helper.app\n        ├── Info.plist\n        └── MacOS/\n            └── MyApp Helper\n</code></pre>\n<h4 id=\"windows\"><a href=\"#windows\">Windows</a></h4>\n<p>Вы можете сменить имя файла <code>electron.exe</code> на любое понравившееся, отредактировать его значок и другую информацию такими инструментами, как <a href=\"https://github.com/electron/rcedit\">rcedit</a>.</p>\n<h4 id=\"linux\"><a href=\"#linux\">Linux</a></h4>\n<p><code>Electron</code> исполняемый файл можно переименовать на любое имя, которое вам нравится.</p>\n<h3 id=\"проведите-ребрендинг-пересобрав-electron-из-исходных-кодов\"><a href=\"#проведите-ребрендинг-пересобрав-electron-из-исходных-кодов\">Проведите ребрендинг, пересобрав Electron из исходных кодов</a></h3>\n<p>Можно изменить бренд Electron путем изменения имени продукта и сборки его из исходных кодов. Для этого вам надо установить аргумент, отвечающий за имя продукта (<code>electron_product_name = \"YourProductName\"</code>) в файле <code>args.gn</code> и пересобрать Electron.</p>",
      "title": "Распространение приложений",
      "description": "ПРИМЕЧАНИЕ: расположение заранее встроенных двоичных файлов Electron указывается на примерах ниже, начиная с electron/."
    },
    "/docs/api/auto-updater": {
      "locale": "ru-RU",
      "slug": "auto-updater",
      "href": "/docs/api/auto-updater",
      "crowdinFileId": "256281",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/auto-updater.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"autoupdater\"><a href=\"#autoupdater\">autoUpdater</a></h1>\n<blockquote>\n<p>Позвольте приложениям автоматически обновляться.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p><strong>См. также: <a href=\"/docs/tutorial/updates\">Подробное руководство о том, как внедрять обновления в Ваше приложение</a>.</strong></p>\n<p><code>autoUpdater</code> это <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h2 id=\"платформа-заметок\"><a href=\"#платформа-заметок\">Платформа заметок</a></h2>\n<p>В настоящее время поддерживаются только macOS и Windows. На Linux нет встроенной поддержи автоматического обновление, поэтому рекомендуется использовать менеджер пакетов для обновления вашего приложения.</p>\n<p>Кроме того есть некоторые тонкие различия на каждой платформе:</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>На macOS модуль <code>autoUpdater</code> построен на <a href=\"https://github.com/Squirrel/Squirrel.Mac\">Squirrel.Mac</a>, что означает, что Вам не нужно делать каких-либо специальных настроек, чтобы заставить его работать. Для серверных условий, Вы можете прочитать <a href=\"https://github.com/Squirrel/Squirrel.Mac#server-support\">Поддержку сервера</a>. Заметьте, что <a href=\"https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW35\">App Transport Security</a> (ATS) применяется ко всем запросам, сделанным как часть процесса обновления. Приложению, у которого требуется отключить ATS, можно добавить ключ <code>NSAllowsArbitraryLoads</code> в список свойств приложения (plist).</p>\n<p><strong>Примечание:</strong> Ваше приложение должно быть подписано для автоматических обновлений на macOS. Это требование <code>Squirrel.Mac</code>.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<p>На Windows Вам придется установить приложение на компьютер пользователя, прежде чем Вы сможете использовать <code>autoUpdater</code>, поэтому рекомендуется использовать пакет <a href=\"https://github.com/electron/windows-installer\">electron-winstaller</a>, <a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a> или <a href=\"https://github.com/electron/grunt-electron-installer\">grunt-electron-installer</a> для создания установщика Windows.</p>\n<p>При использовании <a href=\"https://github.com/electron/windows-installer\">electron-winstaller</a> или <a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a> убедитесь, что Вы не пытаетесь обновить ваше приложение <a href=\"https://github.com/electron/windows-installer#handling-squirrel-events\">при первом запуске</a> (также см. <a href=\"https://github.com/electron/electron/issues/7155\">этот вопрос для получения дополнительной информации</a>). Также рекомендуется использовать <a href=\"https://github.com/mongodb-js/electron-squirrel-startup\">electron-squirrel-startup</a>, для получения ярлыка Вашего приложения на рабочем столе.</p>\n<p>Установщик, сгенерированный с помощью Squirrel, создаст ярлык с <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> в формате <code>com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE</code>, <code>com.squirrel.slack.Slack</code> и <code>com.squirrel.code.Code</code>. Вы должны использовать тот же ID для Вашего приложения в <code>app.setAppUserModelId</code> API, иначе Windows не сможет должным образом закрепить приложение в панели задач.</p>\n<p>Как и Squirrel.Mac, Windows может размещать обновления на S3 или любом другом статическом файловом хосте. Вы можете прочитать документацию о <a href=\"https://github.com/Squirrel/Squirrel.Windows\">Squirrel.Windows</a>, для получения более подробной информации о том, как работает Squirrel.Windows.</p>\n<h2 id=\"события\"><a href=\"#события\">События</a></h2>\n<p>Объект <code>autoUpdater</code> имеет следующие события:</p>\n<h3 id=\"событие-error\"><a href=\"#событие-error\">Событие: 'error'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>error</code> Error</li>\n</ul>\n<p>Возникает когда происходит ошибка при обновлении.</p>\n<h3 id=\"событие-checking-for-update\"><a href=\"#событие-checking-for-update\">Событие: 'checking-for-update'</a></h3>\n<p>Возникает при проверке, если обновление началось.</p>\n<h3 id=\"событие-update-available\"><a href=\"#событие-update-available\">Событие: 'update-available'</a></h3>\n<p>Происходит при наличии доступного обновления. Обновление загружается автоматически.</p>\n<h3 id=\"событие-update-not-available\"><a href=\"#событие-update-not-available\">Событие: 'update-not-available'</a></h3>\n<p>Возникает, когда нет доступных обновлений.</p>\n<h3 id=\"событие-update-downloaded\"><a href=\"#событие-update-downloaded\">Событие: 'update-downloaded'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>releaseNotes</code> String</li>\n<li><code>releaseName</code> String</li>\n<li><code>releaseDate</code> Date</li>\n<li><code>updateURL</code> String</li>\n</ul>\n<p>Возникает при загрузке обновления.</p>\n<p>На Windows доступен только <code>releaseName</code>.</p>\n<p><strong>Примечание:</strong> Не обязательно обрабатывать это событие. Успешно загруженное обновление будет применено при следующем запуске приложения.</p>\n<h3 id=\"событие-before-quit-for-update\"><a href=\"#событие-before-quit-for-update\">Событие: 'before-quit-for-update'</a></h3>\n<p>Это событие происходит после вызова <code>quitAndInstall()</code>.</p>\n<p>Когда это API вызывается, событие <code>before-quit</code> не будет происходить, до тех пор, пока все окна не будут закрыты. В результате Вы должны прослушивать это событие, если хотите выполнить действия до закрытия окон, во время завершения процесса, а также прослушивать <code>before-quit</code>.</p>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Объект <code>autoUpdater</code> имеет следующие методы:</p>\n<h3 id=\"autoupdatersetfeedurloptions\"><a href=\"#autoupdatersetfeedurloptions\"><code>autoUpdater.setFeedURL(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>url</code> String</li>\n<li><code>headers</code> Record&#x3C;String, String> (optional) <em>macOS</em> - HTTP request headers.</li>\n<li><code>serverType</code> String (опционально) <em>macOS</em> - может быть <code>json</code>, либо <code>default</code>, смотрите README <a href=\"https://github.com/Squirrel/Squirrel.Mac\">Squirrel.Mac</a> для подробной информации.</li>\n</ul></li>\n</ul>\n<p>Задает <code>url</code> и инициализирует автоматическое обновление.</p>\n<h3 id=\"autoupdatergetfeedurl\"><a href=\"#autoupdatergetfeedurl\"><code>autoUpdater.getFeedURL()</code></a></h3>\n<p><code>String</code> - возвращает URL текущей подписки обновления.</p>\n<h3 id=\"autoupdatercheckforupdates\"><a href=\"#autoupdatercheckforupdates\"><code>autoUpdater.checkForUpdates()</code></a></h3>\n<p>Спрашивает сервер, есть ли обновление. Вы должны вызвать <code>setFeedURL</code> перед использованием API.</p>\n<p><strong>Note:</strong> If an update is available it will be downloaded automatically. Calling <code>autoUpdater.checkForUpdates()</code> twice will download the update two times.</p>\n<h3 id=\"autoupdaterquitandinstall\"><a href=\"#autoupdaterquitandinstall\"><code>autoUpdater.quitAndInstall()</code></a></h3>\n<p>Перезапускает приложение и устанавливает обновление после его загрузки. Следует вызывать только после произошедшего <code>update-downloaded</code>.</p>\n<p>Внутри, вызов <code>autoUpdater.quitAndInstall()</code> сначала закроет все окна приложения, и автоматически вызовет <code>app.quit()</code>, после того, как все окна будут закрыты.</p>\n<p><strong>Note:</strong> It is not strictly necessary to call this function to apply an update, as a successfully downloaded update will always be applied the next time the application starts.</p>",
      "title": "autoUpdater",
      "description": "Позвольте приложениям автоматически обновляться."
    },
    "/docs/tutorial/automated-testing-with-a-custom-driver": {
      "locale": "ru-RU",
      "slug": "automated-testing-with-a-custom-driver",
      "href": "/docs/tutorial/automated-testing-with-a-custom-driver",
      "crowdinFileId": "256179",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/automated-testing-with-a-custom-driver.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"автоматическое-тестирование-с-помощью-специального-драйвера\"><a href=\"#автоматическое-тестирование-с-помощью-специального-драйвера\">Автоматическое тестирование с помощью специального драйвера</a></h1>\n<p>Для написания автоматических тестов для вашего приложения Electron вам понадобится способ \"управлять\" вашим приложением. <a href=\"https://electronjs.org/spectron\">Spectron</a> - это широко используемое решение, которое позволяет вам эмулировать действия пользователя через <a href=\"https://webdriver.io/\">WebDriver</a>. Тем не менее, также можно написать свой собственный драйвер с помощью встроенного в узел IPC-over-STDIO. Преимущество собственного драйвера состоит в том, что он требует меньше служебных данных, чем Spectron, и позволяет вам использовать собственные методы для вашего набора тестов.</p>\n<p>Чтобы создать собственный драйвер, мы будем использовать Node.js API <a href=\"https://nodejs.org/api/child_process.html\">child_process</a>. Набор тестов вызовет процесс Electron, а затем установит простой протокол обмена сообщениями:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> childProcess = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'child_process'</span>)\n<span class=\"hljs-keyword\">const</span> electronPath = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// spawn the process</span>\n<span class=\"hljs-keyword\">const</span> env = { <span class=\"hljs-comment\">/* ... */</span> }\n<span class=\"hljs-keyword\">const</span> stdio = [<span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'ipc'</span>]\n<span class=\"hljs-keyword\">const</span> appProcess = childProcess.spawn(electronPath, [<span class=\"hljs-string\">'./app'</span>], { stdio, env })\n\n<span class=\"hljs-comment\">// listen for IPC messages from the app</span>\nappProcess.on(<span class=\"hljs-string\">'message'</span>, (msg) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// отправляем IPC сообщение в приложение</span>\nappProcess.send({ <span class=\"hljs-attr\">my</span>: <span class=\"hljs-string\">'message'</span> })\n</code></pre>\n<p>Из приложения Electron вы можете прослушивать сообщения и посылать ответы с помощью API <a href=\"https://nodejs.org/api/process.html\">process</a> из Node.js:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// слушаем IPC сообщение из теста</span>\nprocess.on(<span class=\"hljs-string\">'message'</span>, (msg) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// отправляем IPC сообщение в тест</span>\nprocess.send({ <span class=\"hljs-attr\">my</span>: <span class=\"hljs-string\">'message'</span> })\n</code></pre>\n<p>Теперь мы можем передавать данные из теста в приложению Electron, используя объект <code>appProcess</code>.</p>\n<p>Для удобства, вы можете обернуть <code>appProcess</code> в объект драйвера, который предоставляет более высокоуровневые функции. Here is an example of how you can do this:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">TestDriver</span> </span>{\n  <span class=\"hljs-keyword\">constructor</span> ({ path, args, env }) {\n    <span class=\"hljs-keyword\">this</span>.rpcCalls = []\n\n    <span class=\"hljs-comment\">// start child process</span>\n    env.APP_TEST_DRIVER = <span class=\"hljs-number\">1</span> <span class=\"hljs-comment\">// let the app know it should listen for messages</span>\n    <span class=\"hljs-keyword\">this</span>.process = childProcess.spawn(path, args, { <span class=\"hljs-attr\">stdio</span>: [<span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'ipc'</span>], env })\n\n    <span class=\"hljs-comment\">// handle rpc responses</span>\n    <span class=\"hljs-keyword\">this</span>.process.on(<span class=\"hljs-string\">'message'</span>, (message) => {\n      <span class=\"hljs-comment\">// pop the handler</span>\n      <span class=\"hljs-keyword\">const</span> rpcCall = <span class=\"hljs-keyword\">this</span>.rpcCalls[message.msgId]\n      <span class=\"hljs-keyword\">if</span> (!rpcCall) <span class=\"hljs-keyword\">return</span>\n      <span class=\"hljs-keyword\">this</span>.rpcCalls[message.msgId] = <span class=\"hljs-literal\">null</span>\n      <span class=\"hljs-comment\">// reject/resolve</span>\n      <span class=\"hljs-keyword\">if</span> (message.reject) rpcCall.reject(message.reject)\n      <span class=\"hljs-keyword\">else</span> rpcCall.resolve(message.resolve)\n    })\n\n    <span class=\"hljs-comment\">// wait for ready</span>\n    <span class=\"hljs-keyword\">this</span>.isReady = <span class=\"hljs-keyword\">this</span>.rpc(<span class=\"hljs-string\">'isReady'</span>).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">err</span>) =></span> {\n      <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Application failed to start'</span>, err)\n      <span class=\"hljs-keyword\">this</span>.stop()\n      process.exit(<span class=\"hljs-number\">1</span>)\n    })\n  }\n\n  <span class=\"hljs-comment\">// simple RPC call</span>\n  <span class=\"hljs-comment\">// to use: driver.rpc('method', 1, 2, 3).then(...)</span>\n  <span class=\"hljs-keyword\">async</span> rpc (cmd, ...args) {\n    <span class=\"hljs-comment\">// send rpc request</span>\n    <span class=\"hljs-keyword\">const</span> msgId = <span class=\"hljs-keyword\">this</span>.rpcCalls.length\n    <span class=\"hljs-keyword\">this</span>.process.send({ msgId, cmd, args })\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\">(<span class=\"hljs-params\">resolve, reject</span>) =></span> <span class=\"hljs-keyword\">this</span>.rpcCalls.push({ resolve, reject }))\n  }\n\n  stop () {\n    <span class=\"hljs-keyword\">this</span>.process.kill()\n  }\n}\n</code></pre>\n<p>В приложении вам нужно будет написать простой обработчик для вызовов RPC:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">if</span> (process.env.APP_TEST_DRIVER) {\n  process.on(<span class=\"hljs-string\">'message'</span>, onMessage)\n}\n\n<span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">onMessage</span> (<span class=\"hljs-params\">{ msgId, cmd, args }</span>) </span>{\n  <span class=\"hljs-keyword\">let</span> method = METHODS[cmd]\n  <span class=\"hljs-keyword\">if</span> (!method) method = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Invalid method: '</span> + cmd)\n  <span class=\"hljs-keyword\">try</span> {\n    <span class=\"hljs-keyword\">const</span> resolve = <span class=\"hljs-keyword\">await</span> method(...args)\n    process.send({ msgId, resolve })\n  } <span class=\"hljs-keyword\">catch</span> (err) {\n    <span class=\"hljs-keyword\">const</span> reject = {\n      <span class=\"hljs-attr\">message</span>: err.message,\n      <span class=\"hljs-attr\">stack</span>: err.stack,\n      <span class=\"hljs-attr\">name</span>: err.name\n    }\n    process.send({ msgId, reject })\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> METHODS = {\n  isReady () {\n    <span class=\"hljs-comment\">// do any setup needed</span>\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-comment\">// define your RPC-able methods here</span>\n}\n</code></pre>\n<p>Затем в тесте можно использовать тестовый драйвер следующим образом:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> test = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'ava'</span>)\n<span class=\"hljs-keyword\">const</span> electronPath = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> app = <span class=\"hljs-keyword\">new</span> TestDriver({\n  <span class=\"hljs-attr\">path</span>: electronPath,\n  <span class=\"hljs-attr\">args</span>: [<span class=\"hljs-string\">'./app'</span>],\n  <span class=\"hljs-attr\">env</span>: {\n    <span class=\"hljs-attr\">NODE_ENV</span>: <span class=\"hljs-string\">'test'</span>\n  }\n})\ntest.before(<span class=\"hljs-keyword\">async</span> t => {\n  <span class=\"hljs-keyword\">await</span> app.isReady\n})\ntest.after.always(<span class=\"hljs-string\">'cleanup'</span>, <span class=\"hljs-keyword\">async</span> t => {\n  <span class=\"hljs-keyword\">await</span> app.stop()\n})\n</code></pre>",
      "title": "Автоматическое тестирование с помощью специального драйвера",
      "description": ""
    },
    "/docs/development/azure-vm-setup": {
      "locale": "ru-RU",
      "slug": "azure-vm-setup",
      "href": "/docs/development/azure-vm-setup",
      "crowdinFileId": "256129",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/azure-vm-setup.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"updating-an-appveyor-azure-image\"><a href=\"#updating-an-appveyor-azure-image\">Updating an Appveyor Azure Image</a></h1>\n<p>Electron CI на Windows использует AppVeyor, который в свою очередь использует изображения Azure VM для запуска.  Occasionally, these VM images need to be updated due to changes in Chromium requirements.  In order to update you will need <a href=\"https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6\">PowerShell</a> and the <a href=\"https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-1.8.0&#x26;viewFallbackFrom=azurermps-6.13.0\">Azure PowerShell module</a>.</p>\n<p>Occasionally we need to update these images owing to changes in Chromium or other miscellaneous build requirement changes.</p>\n<p>Пример применения:\n* We need <code>VS15.9</code> and we have <code>VS15.7</code> installed; this would require us to update an Azure image.</p>\n<ol>\n<li>\n<p>Identify the image you wish to modify.</p>\n<ul>\n<li>In <a href=\"https://github.com/electron/electron/blob/main/appveyor.yml\">appveyor.yml</a>, the image is identified by the property <em>image</em>.<ul>\n<li>The names used correspond to the <em>\"images\"</em> defined for a build cloud, eg the <a href=\"https://windows-ci.electronjs.org/build-clouds/8\">libcc-20 cloud</a>.</li>\n</ul></li>\n<li>Find the image you wish to modify in the build cloud and make note of the <strong>VHD Blob Path</strong> for that image, which is the value for that corresponding key.<ul>\n<li>You will need this URI path to copy into a new image.</li>\n</ul></li>\n<li>You will also need the storage account name which is labeled in AppVeyor as the <strong>Disk Storage Account Name</strong></li>\n</ul>\n</li>\n<li>\n<p>Get the Azure storage account key</p>\n<ul>\n<li>Log into Azure using credentials stored in LastPass (under Azure Enterprise) and then find the storage account corresponding to the name found in AppVeyor.<ul>\n<li>Example, for <code>appveyorlibccbuilds</code> <strong>Disk Storage Account Name</strong> you'd look for <code>appveyorlibccbuilds</code> in the list of storage accounts @ Home &#x3C; Storage Accounts<ul>\n<li>Click into it and look for <code>Access Keys</code>, and then you can use any of the keys present in the list.</li>\n</ul></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Get the full virtual machine image URI from Azure</p>\n<ul>\n<li>Navigate to Home &#x3C; Storage Accounts &#x3C; <code>$ACCT_NAME</code> &#x3C; Blobs &#x3C; Images<ul>\n<li>In the following list, look for the VHD path name you got from Appveyor and then click on it.<ul>\n<li>Copy the whole URL from the top of the subsequent window.</li>\n</ul></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Copy the image using the <a href=\"https://github.com/appveyor/ci/blob/master/scripts/enterprise/copy-master-image-azure.ps1\">Copy Master Image PowerShell script</a>.</p>\n<ul>\n<li>It is essential to copy the VM because if you spin up a VM against an image that image cannot at the same time be used by AppVeyor.</li>\n<li>Use the storage account name, key, and URI obtained from Azure to run this script.<ul>\n<li>See Step 3 for URI &#x26; when prompted, press enter to use same storage account as destination.</li>\n<li>Use default destination container name <code>(images)</code></li>\n<li>Also, when naming the copy, use a name that indicates what the new image will contain (if that has changed) and date stamp.<ul>\n<li>Ex. <code>libcc-20core-vs2017-15.9-2019-04-15.vhd</code></li>\n</ul></li>\n</ul></li>\n<li>Go into Azure and get the URI for the newly created image as described in a previous step</li>\n</ul>\n</li>\n<li>\n<p>Spin up a new VM using the <a href=\"https://github.com/appveyor/ci/blob/master/scripts/enterprise/create_master_vm_from_vhd.ps1\">Create Master VM from VHD PowerShell</a>.</p>\n<ul>\n<li>From PowerShell, execute <code>ps1</code> file with <code>./create_master_vm_from_vhd.ps1</code></li>\n<li>You will need the credential information available in the AppVeyor build cloud definition.<ul>\n<li>This includes:<ul>\n<li>Client ID</li>\n<li>Client Secret</li>\n<li>Tenant ID</li>\n<li>Subscription ID</li>\n<li>Resource Group</li>\n<li>Virtual Network</li>\n</ul></li>\n</ul></li>\n<li>You will also need to specify<ul>\n<li>Master VM name - just a unique name to identify the temporary VM</li>\n<li>Master VM size - use <code>Standard_F32s_v2</code></li>\n<li>Master VHD URI - use URI obtained @ end of previous step</li>\n<li>Location use <code>East US</code></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Log back into Azure and find the VM you just created in Home &#x3C; Virtual Machines &#x3C; <code>$YOUR_NEW_VM</code></p>\n<ul>\n<li>You can download a RDP (Remote Desktop) file to access the VM.</li>\n</ul>\n</li>\n<li>\n<p>Using Microsoft Remote Desktop, click <code>Connect</code> to connect to the VM.</p>\n<ul>\n<li>Credentials for logging into the VM are found in LastPass under the <code>AppVeyor Enterprise master VM</code> credentials.</li>\n</ul>\n</li>\n<li>\n<p>Modify the VM as required.</p>\n</li>\n<li>\n<p>Shut down the VM and then delete it in Azure.</p>\n</li>\n<li>\n<p>Add the new image to the Appveyor Cloud settings or modify an existing image to point to the new VHD.</p>\n</li>\n</ol>",
      "title": "Updating an Appveyor Azure Image",
      "description": ""
    },
    "/docs/api/structures/bluetooth-device": {
      "locale": "ru-RU",
      "slug": "bluetooth-device",
      "href": "/docs/api/structures/bluetooth-device",
      "crowdinFileId": "256411",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/bluetooth-device.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"bluetoothdevice-object\"><a href=\"#bluetoothdevice-object\">BluetoothDevice Object</a></h1>\n<ul>\n<li><code>deviceName</code> String</li>\n<li><code>deviceId</code> String</li>\n</ul>",
      "title": "BluetoothDevice Object",
      "description": ""
    },
    "/docs/tutorial/boilerplates-and-clis": {
      "locale": "ru-RU",
      "slug": "boilerplates-and-clis",
      "href": "/docs/tutorial/boilerplates-and-clis",
      "crowdinFileId": "256181",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/boilerplates-and-clis.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"макеты-и-cli\"><a href=\"#макеты-и-cli\">Макеты и CLI</a></h1>\n<p>Разработка в Electron разнообразна - нет \"одного истинного пути\" для разработки, сборки, упаковки или выпуска приложения. Дополнительные особенности для Electron, как для сборки, так и для времени выполнения, обычно можно найти в <a href=\"https://www.npmjs.com/search?q=electron\">npm</a> в отдельных пакетах, что позволяет разработчикам как создать приложение, так и построить конвейер, в котором они нуждаются.</p>\n<p>Этот уровень модульности и расширяемости гарантирует, что все разработчики, работающие с Electron, как большие, так и малые по размеру группы, никогда не ограничены тем, что они могут или не могут делать в любое время в течение своего жизненного цикла разработки. Тем не менее, для многих разработчиков один из управляемых сообществом шаблонов или инструментов командной строки может значительно упростить компиляцию, упаковку и выпуск приложения.</p>\n<h2 id=\"макеты-против-cli\"><a href=\"#макеты-против-cli\">Макеты против CLI</a></h2>\n<p>Шаблон является только отправной точкой - это, так сказать, холст, из которого вы создаете свое приложение. Они обычно приходят в виде репозитория, который вы можете клонировать и настраивать ваш контент.</p>\n<p>С другой стороны, инструмент командной строки продолжает поддерживать вас на протяжении всей разработки и выпуска. Они более полезны и поддерживаемы, но обеспечивают соблюдение рекомендаций о том, как ваш код должен быть структурирован и построен. <em>Специально для новичков - использование командной строки будет весьма полезно</em>.</p>\n<h2 id=\"electron-forge\"><a href=\"#electron-forge\">electron-forge</a></h2>\n<p>\"Полноценный инструмент для создания современных приложений Electron\". Electron Forge объединяет существующие (и хорошо поддерживаемые) инструменты сборки в единый пакет, чтобы каждый мог прямо сейчас заняться разработкой в Electron.</p>\n<p>Forge поставляется с <a href=\"https://electronforge.io/templates\">готовым к использованию шаблонои</a>, используя Webpack в качестве бандлера. Он включает в себя пример конфигурации typescript и предоставляет два конфигурационных файла, которые позволяют легко настраивать. It uses the same core modules used by the greater Electron community (like <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>) – changes made by Electron maintainers (like Slack) benefit Forge's users, too.</p>\n<p>Вы можете найти больше информации и документации на <a href=\"https://electronforge.io/\">electronforge.io</a>.</p>\n<h2 id=\"electron-builder\"><a href=\"#electron-builder\">electron-builder</a></h2>\n<p>\"Полноценное решение для упаковки и создания готового к использованию приложения Electron\", которое фокусируется на интегрированном опыте. <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> добавляет одну единственную зависимость, ориентированную на простоту, и управляет всеми дополнительными требованиями изнутри.</p>\n<p><code>electron-builder</code> заменяет функции и модули, используемые майнтейнерами Electron (такими как автообновление) с пользовательскими. Они, как правило, более тесно интегрированы, но будут иметь меньше общего с популярными приложениями Electron, такими как Atom, Visual Studio Code или Slack.</p>\n<p>Вы можете найти дополнительную информацию и документацию в <a href=\"https://github.com/electron-userland/electron-builder\">репозитории</a>.</p>\n<h2 id=\"electron-react-boilerplate\"><a href=\"#electron-react-boilerplate\">electron-react-boilerplate</a></h2>\n<p>Если вам не нужны какие-либо инструменты, а только плоский шаблон, из которого можно собрать приложение, вам стоит взглянуть на <a href=\"https://github.com/chentsulin/electron-react-boilerplate\"><code>electron-react-boilerplate</code></a>. Он довольно популярен в сообществе и использует встроенный <code>electron-builder</code>.</p>\n<h2 id=\"другие-инструменты-и-макеты\"><a href=\"#другие-инструменты-и-макеты\">Другие инструменты и макеты</a></h2>\n<p>Список <a href=\"https://github.com/sindresorhus/awesome-electron#boilerplates\">«Awesome Electron»</a> предоставляет большой выбор инструментов и шаблонов. Если вы обнаружите, что длина списка вас пугает, не забывайте, что можно добавлять инструменты по ходу работы.</p>",
      "title": "Макеты и CLI",
      "description": ""
    },
    "/docs/breaking-changes": {
      "locale": "ru-RU",
      "slug": "breaking-changes",
      "href": "/docs/breaking-changes",
      "crowdinFileId": "256117",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/breaking-changes.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"критические-изменения\"><a href=\"#критические-изменения\">Критические изменения</a></h1>\n<p>Здесь будут описаны критические изменения, а также будут добавлены предупреждения об устаревших функциях в JS коде, где это возможно, по крайней мере перед тем, как изменения будут сделаны в <a href=\"/docs/tutorial/electron-versioning#semver\">одной мажорной версии</a>.</p>\n<h3 id=\"типы-критических-изменений\"><a href=\"#типы-критических-изменений\">Типы критических изменений</a></h3>\n<p>В этом документе используется следующее соглашение для классификации критических изменений:</p>\n<ul>\n<li><strong>Изменение API:</strong> API был изменен таким образом, что код, который не был обновлен, гарантировано бросит исключение.</li>\n<li><strong>Изменение поведения:</strong> Поведение Electron было изменено, но не обязательно появление исключений.</li>\n<li><strong>Изменено значение по-умолчанию:</strong> Код, работа которого зависит от старого значения по-умолчанию, может сломаться, не обязательно кидая исключение. Старое поведение можно восстановить, если явно указать значение.</li>\n<li><strong>Устарело:</strong> API был помечен как устаревший. API продолжит функционировать, но будет появляться предупреждающее сообщение о том, что API будет удален в будущем релизе.</li>\n<li><strong>Удалено:</strong> API или функция была удалена и больше не поддерживается Electron.</li>\n</ul>\n<h2 id=\"запланированные-критические-изменения-api-140\"><a href=\"#запланированные-критические-изменения-api-140\">Запланированные критические изменения API (14.0)</a></h2>\n<h3 id=\"removed-remote-module\"><a href=\"#removed-remote-module\">Removed: <code>remote</code> module</a></h3>\n<p>The <code>remote</code> module was deprecated in Electron 12, and will be removed in Electron 14. It is replaced by the <a href=\"https://github.com/electron/remote\"><code>@electron/remote</code></a> module.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 12:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Replace with:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote'</span>)\n\n<span class=\"hljs-comment\">// In the main process:</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote/main'</span>).initialize()\n</code></pre>\n<h3 id=\"удален-appallowrendererprocessreuse\"><a href=\"#удален-appallowrendererprocessreuse\">Удален: <code>app.allowRendererProcessReuse</code></a></h3>\n<p>The <code>app.allowRendererProcessReuse</code> property will be removed as part of our plan to more closely align with Chromium's process model for security, performance and maintainability.</p>\n<p>Для подробностей см. <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"removed-browser-window-affinity\"><a href=\"#removed-browser-window-affinity\">Removed: Browser Window Affinity</a></h3>\n<p>Параметр <code>affinity</code> при создании нового <code>BrowserWindow</code> будет удален в рамках нашего плана для более тесной связи с моделью процесса Chrome в целях безопасности, производительность и лучшей поддержки.</p>\n<p>Для подробностей см. <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"изменения-в-api-windowopen\"><a href=\"#изменения-в-api-windowopen\">Изменения в API: <code>window.open()</code></a></h3>\n<p>Необязательный параметр <code>frameName</code> больше не устанавливает название окна. Теперь это следует спецификации, описанной в <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters\">документации</a> в соответствии с параметром <code>windowName</code>.</p>\n<p>Если вы использовали этот параметр, чтобы задать заголовок окна, вы можете использовать <a href=\"/docs/api/browser-window#winsettitletitle\">win.setTitle(title)</a>.</p>\n<h3 id=\"удален-worldsafeexecutejavascript\"><a href=\"#удален-worldsafeexecutejavascript\">Удален: <code>worldSafeExecuteJavaScript</code></a></h3>\n<p>В Electron 14 <code>worldSafeExecuteJavaScript</code> будет удален.  Альтернатива отсутствует, пожалуйста, убедитесь, что в вашем коде данный параметр включен.  Он был включен в Electron по умолчанию\n12.</p>\n<p>На вас повлияет это изменение, если вы используете либо <code>webFrame.executeJavaScript</code> или <code>webFrame.executeJavaScriptInIsolatedWorld</code>. Вам нужно будет убедиться, что значения, возвращаемые одним из этих методов, поддерживаются <a href=\"/docs/api/context-bridge#parameter--error--return-type-support\">Context Bridge API</a>, поскольку эти методы используют одинаковую семантику значения.</p>\n<h3 id=\"default-changed-nativewindowopen-defaults-to-true\"><a href=\"#default-changed-nativewindowopen-defaults-to-true\">Default Changed: <code>nativeWindowOpen</code> defaults to <code>true</code></a></h3>\n<p>Prior to Electron 14, <code>window.open</code> was by default shimmed to use <code>BrowserWindowProxy</code>. This meant that <code>window.open('about:blank')</code> did not work to open synchronously scriptable child windows, among other incompatibilities. <code>nativeWindowOpen</code> is no longer experimental, and is now the default.</p>\n<p>See the documentation for <a href=\"/docs/api/window-open\">window.open in Electron</a> for more details.</p>\n<h3 id=\"removed-browserwindowconstructoroptions-inheriting-from-parent-windows\"><a href=\"#removed-browserwindowconstructoroptions-inheriting-from-parent-windows\">Removed: BrowserWindowConstructorOptions inheriting from parent windows</a></h3>\n<p>Prior to Electron 14, windows opened with <code>window.open</code> would inherit BrowserWindow constructor options such as <code>transparent</code> and <code>resizable</code> from their parent window. Beginning with Electron 14, this behavior is removed, and windows will not inherit any BrowserWindow constructor options from their parents.</p>\n<p>Instead, explicitly set options for the new window with <code>setWindowOpenHandler</code>:</p>\n<pre><code class=\"hljs language-js\">webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n  <span class=\"hljs-keyword\">return</span> {\n    <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span>,\n    <span class=\"hljs-attr\">overrideBrowserWindowOptions</span>: {\n      <span class=\"hljs-comment\">// ...</span>\n    }\n  }\n})\n</code></pre>\n<h3 id=\"удален-additionalfeatures\"><a href=\"#удален-additionalfeatures\">Удален: <code>additionalFeatures</code></a></h3>\n<p>The deprecated <code>additionalFeatures</code> property in the <code>new-window</code> and <code>did-create-window</code> events of WebContents has been removed. Since <code>new-window</code> uses positional arguments, the argument is still present, but will always be the empty array <code>[]</code>. (Though note, the <code>new-window</code> event itself is deprecated, and is replaced by <code>setWindowOpenHandler</code>.) Bare keys in window features will now present as keys with the value <code>true</code> in the options object.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 14</span>\n<span class=\"hljs-comment\">// Triggered by window.open('...', '', 'my-key')</span>\nwebContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (<span class=\"hljs-built_in\">window</span>, details) => {\n  <span class=\"hljs-keyword\">if</span> (details.additionalFeatures.includes(<span class=\"hljs-string\">'my-key'</span>)) {\n    <span class=\"hljs-comment\">// ...</span>\n  }\n})\n\n<span class=\"hljs-comment\">// Replace with</span>\nwebContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (<span class=\"hljs-built_in\">window</span>, details) => {\n  <span class=\"hljs-keyword\">if</span> (details.options[<span class=\"hljs-string\">'my-key'</span>]) {\n    <span class=\"hljs-comment\">// ...</span>\n  }\n})\n</code></pre>\n<h2 id=\"запланированные-критические-изменения-api-130\"><a href=\"#запланированные-критические-изменения-api-130\">Запланированные критические изменения API (13.0)</a></h2>\n<h3 id=\"изменения-в-api-sessionsetpermissioncheckhandlerhandler\"><a href=\"#изменения-в-api-sessionsetpermissioncheckhandlerhandler\">Изменения в API: <code>session.setPermissionCheckHandler(handler)</code></a></h3>\n<p>Первым параметром <code>handler</code> был ранее всегда <code>webContents</code>, теперь он иногда может быть <code>null</code>.  Вы должны использовать <code>requestingOrigin</code>, <code>embeddingOrigin</code> и <code>securityOrigin</code> свойства для правильного ответа на проверку.  Так как <code>webContents</code> может быть <code>null</code> больше, на него нельзя полагаться.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Старый код</span>\nsession.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (webContents.getURL().startsWith(<span class=\"hljs-string\">'https://google. om/'</span>) &#x26;&#x26; permission === <span class=\"hljs-string\">'notification'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  возвращает <span class=\"hljs-literal\">false</span>\n})\n\n<span class=\"hljs-comment\">// Заменить на</span>\nсессию. etPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(requestingOrigin). ostname === <span class=\"hljs-string\">'google.com'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notification'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  возвращает <span class=\"hljs-literal\">false</span>\n})\n</code></pre>\n<h3 id=\"удален-shellmoveitemtotrash\"><a href=\"#удален-shellmoveitemtotrash\">Удален: <code>shell.moveItemToTrash()</code></a></h3>\n<p>Удален устаревший синхронный <code>shell.moveItemToTrash()</code> API. Вместо этого используйте асинхронный <code>shell.trashItem()</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Удалён в Electron 13</span>\nshell.moveItemToTrash(path)\n<span class=\"hljs-comment\">// Замена на</span>\nshell.trashItem(path).then(<span class=\"hljs-comment\">/* ... */</span>)\n</code></pre>\n<h3 id=\"удалено-browserwindow-api-расширений\"><a href=\"#удалено-browserwindow-api-расширений\">Удалено: <code>BrowserWindow</code> API расширений</a></h3>\n<p>Удалено устаревшее API расширений:</p>\n<ul>\n<li><code>BrowserWindow.addExtension(path)</code></li>\n<li><code>BrowserWindow.addDevToolsExtension(path)</code></li>\n<li><code>BrowserWindow.removeExtension(name)</code></li>\n<li><code>BrowserWindow.removeDevToolsExtension(name)</code></li>\n<li><code>BrowserWindow.getExtensions()</code></li>\n<li><code>BrowserWindow.getDevToolsExtensions()</code></li>\n</ul>\n<p>Использовать API сессии:</p>\n<ul>\n<li><code>ses.loadExtension(path)</code></li>\n<li><code>ses.removeExtension(extension_id)</code></li>\n<li><code>ses.getAllExtensions()</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Удален в Electron 13</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// Заменить</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Удален в Electron 13</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// Заменить</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Удален в Electron 13</span>\nBrowserWindow.getExtensions()\nBrowserWindow.getDevToolsExtensions()\n<span class=\"hljs-comment\">// Заменить</span>\nsession.defaultSession.getAllExtensions()\n</code></pre>\n<h3 id=\"удалено-методы-в-systempreferences\"><a href=\"#удалено-методы-в-systempreferences\">Удалено: методы в <code>systemPreferences</code></a></h3>\n<p>Следующие <code>systemPreferences</code> были устаревшими:</p>\n<ul>\n<li><code>systemPreferences.isDarkMode()</code></li>\n<li><code>systemPreferences.isvertedColorScheme()</code></li>\n<li><code>systemPreferences.isHighContrastColorScheme()</code></li>\n</ul>\n<p>Используйте следующие свойства <code>nativeTheme</code> вместо этого:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code></li>\n<li><code>nativeTheme.shouldUseInvertedColorScheme</code></li>\n<li><code>nativeTheme.shouldUseHighContrastColors</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Удалён в Electron 13</span>\nsystemPreferences.isDarkMode()\n<span class=\"hljs-comment\">// Заменить на</span>\nnativeTheme.shouldUseDarkColors\n\n<span class=\"hljs-comment\">// Удалён в Electron 13</span>\nsystemPreferences. sInvertedColorScheme()\n<span class=\"hljs-comment\">// Заменить на</span>\nnativeTheme.shouldUseInvertedColorScheme\n\n<span class=\"hljs-comment\">// Удалено в Electron 13</span>\nsystemPreferences.isHighContrastColorScheme()\n<span class=\"hljs-comment\">// Заменить на</span>\nnativeTheme.shouldUseHighContrastColors\n</code></pre>\n<h3 id=\"устарело-webcontents-new-window-событие\"><a href=\"#устарело-webcontents-new-window-событие\">Устарело: WebContents <code>new-window</code> событие</a></h3>\n<p>Событие <code>new-window</code> сетевого контента является устаревшим. Заменяется на <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler()</code></a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устарел в Electron 13</span>\nwebContents.on(<span class=\"hljs-string\">'new-window'</span>, (event) => {\n  событие. reventDefault()\n})\n\n<span class=\"hljs-comment\">// Заменить на</span>\nwebContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n</code></pre>\n<h2 id=\"запланированные-критические-изменения-api-120\"><a href=\"#запланированные-критические-изменения-api-120\">Запланированные критические изменения API (12.0)</a></h2>\n<h3 id=\"удалено-поддержка-pepper-flash\"><a href=\"#удалено-поддержка-pepper-flash\">Удалено: Поддержка Pepper Flash</a></h3>\n<p>Chromium удалил поддержку Flash, и поэтому мы должны следовать этому примеру. Смотрите Chromium <a href=\"https://www.chromium.org/flash-roadmap\">Flash Roadmap</a> для получения более подробной информации.</p>\n<h3 id=\"default-changed-worldsafeexecutejavascript-defaults-to-true\"><a href=\"#default-changed-worldsafeexecutejavascript-defaults-to-true\">Default Changed: <code>worldSafeExecuteJavaScript</code> defaults to <code>true</code></a></h3>\n<p>В Electron 12, <code>worldSafeExecuteJavaScript</code> будет включен по умолчанию.  Чтобы восстановить предыдущее поведение, в WebPreferences должен быть определен <code>worldSafeExecuteJavaScript: false</code>. Обратите внимание, что установливать этого параметр в <code>false</code> <strong>небезопасно</strong>.</p>\n<p>This option will be removed in Electron 14 so please migrate your code to support the default value.</p>\n<h3 id=\"default-changed-contextisolation-defaults-to-true\"><a href=\"#default-changed-contextisolation-defaults-to-true\">Default Changed: <code>contextIsolation</code> defaults to <code>true</code></a></h3>\n<p><code> </code>  <code> </code></p>\n<p>We <a href=\"/docs/tutorial/security#3-enable-context-isolation-for-remote-content\">recommend having contextIsolation enabled</a> for the security of your application.</p>\n<p>Another implication is that <code>require()</code> cannot be used in the renderer process unless <code>nodeIntegration</code> is <code>true</code> and <code>contextIsolation</code> is <code>false</code>.</p>\n<p>Подробнее см.: <a href=\"https://github.com/electron/electron/issues/23506\">https://github.com/electron/electron/issues/23506</a></p>\n<h3 id=\"удален-crashreportergetcrashesdirectory\"><a href=\"#удален-crashreportergetcrashesdirectory\">Удален: <code>crashReporter.getCrashesDirectory()</code></a></h3>\n<p>The <code>crashReporter.getCrashesDirectory</code> method has been removed. Usage should be replaced by <code>app.getPath('crashDumps')</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 12</span>\ncrashReporter.getCrashesDirectory()\n<span class=\"hljs-comment\">// Replace with</span>\napp.getPath(<span class=\"hljs-string\">'crashDumps'</span>)\n</code></pre>\n<h3 id=\"removed-crashreporter-methods-in-the-renderer-process\"><a href=\"#removed-crashreporter-methods-in-the-renderer-process\">Removed: <code>crashReporter</code> methods in the renderer process</a></h3>\n<p>The following <code>crashReporter</code> methods are no longer available in the renderer process:</p>\n<ul>\n<li><code>crashReporter.start</code></li>\n<li><code>crashReporter.getLastCrashReport</code></li>\n<li><code>crashReporter.getUploadedReports</code></li>\n<li><code>crashReporter.getUploadToServer</code></li>\n<li><code>вылетать Reporter.setUploadToServer</code></li>\n<li><code>crashReporter.getCrashesDirectory</code></li>\n</ul>\n<p>They should be called only from the main process.</p>\n<p>See <a href=\"https://github.com/electron/electron/pull/23265\">#23265</a> for more details.</p>\n<h3 id=\"default-changed-crashreporterstart-compress-true-\"><a href=\"#default-changed-crashreporterstart-compress-true-\">Default Changed: <code>crashReporter.start({ compress: true })</code></a></h3>\n<p>The default value of the <code>compress</code> option to <code>crashReporter.start</code> has changed from <code>false</code> to <code>true</code>. This means that crash dumps will be uploaded to the crash ingestion server with the <code>Content-Encoding: gzip</code> header, and the body will be compressed.</p>\n<p>If your crash ingestion server does not support compressed payloads, you can turn off compression by specifying <code>{ compress: false }</code> in the crash reporter options.</p>\n<h3 id=\"deprecated-remote-module\"><a href=\"#deprecated-remote-module\">Deprecated: <code>remote</code> module</a></h3>\n<p>The <code>remote</code> module is deprecated in Electron 12, and will be removed in Electron 14. It is replaced by the <a href=\"https://github.com/electron/remote\"><code>@electron/remote</code></a> module.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 12:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Replace with:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote'</span>)\n\n<span class=\"hljs-comment\">// In the main process:</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote/main'</span>).initialize()\n</code></pre>\n<h3 id=\"obsoleto-shellmoveitemtotrash\"><a href=\"#obsoleto-shellmoveitemtotrash\">Obsoleto: <code>shell.moveItemToTrash()</code></a></h3>\n<p>The synchronous <code>shell.moveItemToTrash()</code> has been replaced by the new, asynchronous <code>shell.trashItem()</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 12</span>\nshell.moveItemToTrash(path)\n<span class=\"hljs-comment\">// Replace with</span>\nshell.trashItem(path).then(<span class=\"hljs-comment\">/* ... */</span>)\n</code></pre>\n<h2 id=\"запланированные-критические-изменения-api-110\"><a href=\"#запланированные-критические-изменения-api-110\">Запланированные критические изменения API (11.0)</a></h2>\n<h3 id=\"removed-browserviewdestroy-fromid-fromwebcontents-getallviews-and-id-property-of-browserview\"><a href=\"#removed-browserviewdestroy-fromid-fromwebcontents-getallviews-and-id-property-of-browserview\">Removed: <code>BrowserView.{destroy, fromId, fromWebContents, getAllViews}</code> and <code>id</code> property of <code>BrowserView</code></a></h3>\n<p>The experimental APIs <code>BrowserView.{destroy, fromId, fromWebContents, getAllViews}</code> have now been removed. Additionally, the <code>id</code> property of <code>BrowserView</code> has also been removed.</p>\n<p>For more detailed information, see <a href=\"https://github.com/electron/electron/pull/23578\">#23578</a>.</p>\n<h2 id=\"запланированные-критические-изменения-api-100\"><a href=\"#запланированные-критические-изменения-api-100\">Запланированные критические изменения API (10.0)</a></h2>\n<h3 id=\"deprecated-companyname-argument-to-crashreporterstart\"><a href=\"#deprecated-companyname-argument-to-crashreporterstart\">Deprecated: <code>companyName</code> argument to <code>crashReporter.start()</code></a></h3>\n<p>The <code>companyName</code> argument to <code>crashReporter.start()</code>, which was previously required, is now optional, and further, is deprecated. To get the same behavior in a non-deprecated way, you can pass a <code>companyName</code> value in <code>globalExtra</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 10</span>\ncrashReporter.start({ <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Umbrella Corporation'</span> })\n<span class=\"hljs-comment\">// Replace with</span>\ncrashReporter.start({ <span class=\"hljs-attr\">globalExtra</span>: { <span class=\"hljs-attr\">_companyName</span>: <span class=\"hljs-string\">'Umbrella Corporation'</span> } })\n</code></pre>\n<h3 id=\"obsoleto-crashreportergetcrashesdirectory\"><a href=\"#obsoleto-crashreportergetcrashesdirectory\">Obsoleto: <code>crashReporter.getCrashesDirectory()</code></a></h3>\n<p>The <code>crashReporter.getCrashesDirectory</code> method has been deprecated. Usage should be replaced by <code>app.getPath('crashDumps')</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 10</span>\ncrashReporter.getCrashesDirectory()\n<span class=\"hljs-comment\">// Replace with</span>\napp.getPath(<span class=\"hljs-string\">'crashDumps'</span>)\n</code></pre>\n<h3 id=\"deprecated-crashreporter-methods-in-the-renderer-process\"><a href=\"#deprecated-crashreporter-methods-in-the-renderer-process\">Deprecated: <code>crashReporter</code> methods in the renderer process</a></h3>\n<p>Calling the following <code>crashReporter</code> methods from the renderer process is deprecated:</p>\n<ul>\n<li><code>crashReporter.start</code></li>\n<li><code>crashReporter.getLastCrashReport</code></li>\n<li><code>crashReporter.getUploadedReports</code></li>\n<li><code>crashReporter.getUploadToServer</code></li>\n<li><code>вылетать Reporter.setUploadToServer</code></li>\n<li><code>crashReporter.getCrashesDirectory</code></li>\n</ul>\n<p>The only non-deprecated methods remaining in the <code>crashReporter</code> module in the renderer are <code>addExtraParameter</code>, <code>removeExtraParameter</code> and <code>getParameters</code>.</p>\n<p>All above methods remain non-deprecated when called from the main process.</p>\n<p>See <a href=\"https://github.com/electron/electron/pull/23265\">#23265</a> for more details.</p>\n<h3 id=\"obsoleto-crashreporterstart-compress-false-\"><a href=\"#obsoleto-crashreporterstart-compress-false-\">Obsoleto: <code>crashReporter.start({ compress: false })</code></a></h3>\n<p>Setting <code>{ compress: false }</code> in <code>crashReporter.start</code> is deprecated. Nearly all crash ingestion servers support gzip compression. This option will be removed in a future version of Electron.</p>\n<h3 id=\"изменение-значения-по-умолчанию-enableremotemodule-изменено-на-false\"><a href=\"#изменение-значения-по-умолчанию-enableremotemodule-изменено-на-false\">Изменение значения по-умолчанию: <code>enableRemoteModule</code> изменено на <code>false</code></a></h3>\n<p>In Electron 9, using the remote module without explicitly enabling it via the <code>enableRemoteModule</code> WebPreferences option began emitting a warning. In Electron 10, the remote module is now disabled by default. To use the remote module, <code>enableRemoteModule: true</code> must be specified in WebPreferences:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> w = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">enableRemoteModule</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<p>We <a href=\"https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31\">recommend moving away from the remote module</a>.</p>\n<h3 id=\"protocolunregisterprotocol\"><a href=\"#protocolunregisterprotocol\"><code>protocol.unregisterProtocol</code></a></h3>\n<h3 id=\"protocoluninterceptprotocol\"><a href=\"#protocoluninterceptprotocol\"><code>protocol.uninterceptProtocol</code></a></h3>\n<p>API теперь синхронизируются, и необязательный обратный вызов больше не требуется.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Deprecated</span>\nprotocol.unregisterProtocol(scheme, () => { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nprotocol.unregisterProtocol(scheme)\n</code></pre>\n<h3 id=\"protocolregisterfileprotocol\"><a href=\"#protocolregisterfileprotocol\"><code>protocol.registerFileProtocol</code></a></h3>\n<h3 id=\"protocolregisterbufferprotocol\"><a href=\"#protocolregisterbufferprotocol\"><code>protocol.registerBufferProtocol</code></a></h3>\n<h3 id=\"protocolregisterstringprotocol\"><a href=\"#protocolregisterstringprotocol\"><code>protocol.registerStringProtocol</code></a></h3>\n<h3 id=\"protocolregisterhttpprotocol\"><a href=\"#protocolregisterhttpprotocol\"><code>protocol.registerHttpProtocol</code></a></h3>\n<h3 id=\"protocolregisterstreamprotocol\"><a href=\"#protocolregisterstreamprotocol\"><code>protocol.registerStreamProtocol</code></a></h3>\n<h3 id=\"protocolinterceptfileprotocol\"><a href=\"#protocolinterceptfileprotocol\"><code>protocol.interceptFileProtocol</code></a></h3>\n<h3 id=\"protocolinterceptstringprotocol\"><a href=\"#protocolinterceptstringprotocol\"><code>protocol.interceptStringProtocol</code></a></h3>\n<h3 id=\"protocolinterceptbufferprotocol\"><a href=\"#protocolinterceptbufferprotocol\"><code>protocol.interceptBufferProtocol</code></a></h3>\n<h3 id=\"protocolintercepthttpprotocol\"><a href=\"#protocolintercepthttpprotocol\"><code>protocol.interceptHttpProtocol</code></a></h3>\n<h3 id=\"protocolinterceptstreamprotocol\"><a href=\"#protocolinterceptstreamprotocol\"><code>protocol.interceptStreamProtocol</code></a></h3>\n<p>API теперь синхронизируются, и необязательный обратный вызов больше не требуется.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Deprecated</span>\nprotocol.registerFileProtocol(scheme, handler, () => { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nprotocol.registerFileProtocol(scheme, handler)\n</code></pre>\n<p>Зарегистрированный или перехваченный протокол не влияет на текущую страницу до тех пор, пока не произойдет навигация.</p>\n<h3 id=\"protocolisprotocolhandled\"><a href=\"#protocolisprotocolhandled\"><code>protocol.isProtocolHandled</code></a></h3>\n<p>Этот API является устаревшим, пользователи должны использовать <code>protocol.isProtocolRegistered</code> и <code>protocol.isProtocolIntercepted</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Deprecated</span>\nprotocol.isProtocolHandled(scheme).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> isRegistered = protocol.isProtocolRegistered(scheme)\n<span class=\"hljs-keyword\">const</span> isIntercepted = protocol.isProtocolIntercepted(scheme)\n</code></pre>\n<h2 id=\"запланированные-критические-изменения-api-90\"><a href=\"#запланированные-критические-изменения-api-90\">Запланированные критические изменения API (9.0)</a></h2>\n<h3 id=\"default-changed-loading-non-context-aware-native-modules-in-the-renderer-process-is-disabled-by-default\"><a href=\"#default-changed-loading-non-context-aware-native-modules-in-the-renderer-process-is-disabled-by-default\">Default Changed: Loading non-context-aware native modules in the renderer process is disabled by default</a></h3>\n<p>As of Electron 9 we do not allow loading of non-context-aware native modules in the renderer process.  This is to improve security, performance and maintainability of Electron as a project.</p>\n<p>If this impacts you, you can temporarily set <code>app.allowRendererProcessReuse</code> to <code>false</code> to revert to the old behavior.  This flag will only be an option until Electron 11 so you should plan to update your native modules to be context aware.</p>\n<p>Для подробностей см. <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"deprecated-browserwindow-extension-apis\"><a href=\"#deprecated-browserwindow-extension-apis\">Deprecated: <code>BrowserWindow</code> extension APIs</a></h3>\n<p>The following extension APIs have been deprecated:</p>\n<ul>\n<li><code>BrowserWindow.addExtension(path)</code></li>\n<li><code>BrowserWindow.addDevToolsExtension(path)</code></li>\n<li><code>BrowserWindow.removeExtension(name)</code></li>\n<li><code>BrowserWindow.removeDevToolsExtension(name)</code></li>\n<li><code>BrowserWindow.getExtensions()</code></li>\n<li><code>BrowserWindow.getDevToolsExtensions()</code></li>\n</ul>\n<p>Использовать API сессии:</p>\n<ul>\n<li><code>ses.loadExtension(path)</code></li>\n<li><code>ses.removeExtension(extension_id)</code></li>\n<li><code>ses.getAllExtensions()</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 9</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 9</span>\nBrowserWindow.removeExtension(name)\nBrowserWindow.removeDevToolsExtension(name)\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.removeExtension(extension_id)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 9</span>\nBrowserWindow.getExtensions()\nBrowserWindow.getDevToolsExtensions()\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.getAllExtensions()\n</code></pre>\n<h3 id=\"removed-webviewgetwebcontents\"><a href=\"#removed-webviewgetwebcontents\">Removed: <code>&#x3C;webview>.getWebContents()</code></a></h3>\n<p>Удален этот API, устаревший в Electron 8.0.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Удален в Electron 9.0</span>\nwebview.getWebContents()\n<span class=\"hljs-comment\">// Замена на</span>\n<span class=\"hljs-keyword\">const</span> { remote } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nremote.webContents.fromId(webview.getWebContentsId())\n</code></pre>\n<h3 id=\"удален-webframesetlayoutzoomlevellimits\"><a href=\"#удален-webframesetlayoutzoomlevellimits\">Удален: <code>webFrame.setLayoutZoomLevelLimits()</code></a></h3>\n<p>Chromium has removed support for changing the layout zoom level limits, and it is beyond Electron's capacity to maintain it. The function was deprecated in Electron 8.x, and has been removed in Electron 9.x. The layout zoom level limits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined <a href=\"https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11\">here</a>.</p>\n<h3 id=\"behavior-changed-sending-non-js-objects-over-ipc-now-throws-an-exception\"><a href=\"#behavior-changed-sending-non-js-objects-over-ipc-now-throws-an-exception\">Behavior Changed: Sending non-JS objects over IPC now throws an exception</a></h3>\n<p>In Electron 8.0, IPC was changed to use the Structured Clone Algorithm, bringing significant performance improvements. To help ease the transition, the old IPC serialization algorithm was kept and used for some objects that aren't serializable with Structured Clone. In particular, DOM objects (e.g. <code>Element</code>, <code>Location</code> and <code>DOMMatrix</code>), Node.js objects backed by C++ classes (e.g. <code>process.env</code>, some members of <code>Stream</code>), and Electron objects backed by C++ classes (e.g. <code>WebContents</code>, <code>BrowserWindow</code> and <code>WebFrame</code>) are not serializable with Structured Clone. Whenever the old algorithm was invoked, a deprecation warning was printed.</p>\n<p>In Electron 9.0, the old serialization algorithm has been removed, and sending such non-serializable objects will now throw an \"object could not be cloned\" error.</p>\n<h3 id=\"api-changed-shellopenitem-is-now-shellopenpath\"><a href=\"#api-changed-shellopenitem-is-now-shellopenpath\">API Changed: <code>shell.openItem</code> is now <code>shell.openPath</code></a></h3>\n<p>The <code>shell.openItem</code> API has been replaced with an asynchronous <code>shell.openPath</code> API. You can see the original API proposal and reasoning <a href=\"https://github.com/electron/governance/blob/main/wg-api/spec-documents/shell-openitem.md\">here</a>.</p>\n<h2 id=\"запланированные-критические-изменения-api-80\"><a href=\"#запланированные-критические-изменения-api-80\">Запланированные критические изменения API (8.0)</a></h2>\n<h3 id=\"behavior-changed-values-sent-over-ipc-are-now-serialized-with-structured-clone-algorithm\"><a href=\"#behavior-changed-values-sent-over-ipc-are-now-serialized-with-structured-clone-algorithm\">Behavior Changed: Values sent over IPC are now serialized with Structured Clone Algorithm</a></h3>\n<p>The algorithm used to serialize objects sent over IPC (through <code>ipcRenderer.send</code>, <code>ipcRenderer.sendSync</code>, <code>WebContents.send</code> and related methods) has been switched from a custom algorithm to V8's built-in <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, the same algorithm used to serialize messages for <code>postMessage</code>. This brings about a 2x performance improvement for large messages, but also brings some breaking changes in behavior.</p>\n<ul>\n<li>Sending Functions, Promises, WeakMaps, WeakSets, or objects containing any such values, over IPC will now throw an exception, instead of silently converting the functions to <code>undefined</code>.</li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Previously:</span>\nipcRenderer.send(<span class=\"hljs-string\">'channel'</span>, { <span class=\"hljs-attr\">value</span>: <span class=\"hljs-number\">3</span>, <span class=\"hljs-attr\">someFunction</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {} })\n<span class=\"hljs-comment\">// => results in { value: 3 } arriving in the main process</span>\n\n<span class=\"hljs-comment\">// From Electron 8:</span>\nipcRenderer.send(<span class=\"hljs-string\">'channel'</span>, { <span class=\"hljs-attr\">value</span>: <span class=\"hljs-number\">3</span>, <span class=\"hljs-attr\">someFunction</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {} })\n<span class=\"hljs-comment\">// => throws Error(\"() => {} could not be cloned.\")</span>\n</code></pre>\n<ul>\n<li><code>NaN</code>, <code>Infinity</code> and <code>-Infinity</code> will now be correctly serialized, instead of being converted to <code>null</code>.</li>\n<li>Objects containing cyclic references will now be correctly serialized, instead of being converted to <code>null</code>.</li>\n<li><code>Set</code>, <code>Map</code>, <code>Error</code> and <code>RegExp</code> values will be correctly serialized, instead of being converted to <code>{}</code>.</li>\n<li><code>BigInt</code> values will be correctly serialized, instead of being converted to <code>null</code>.</li>\n<li>Sparse arrays will be serialized as such, instead of being converted to dense arrays with <code>null</code>s.</li>\n<li><code>Date</code> objects will be transferred as <code>Date</code> objects, instead of being converted to their ISO string representation.</li>\n<li>Typed Arrays (such as <code>Uint8Array</code>, <code>Uint16Array</code>, <code>Uint32Array</code> and so on) will be transferred as such, instead of being converted to Node.js <code>Buffer</code>.</li>\n<li>Node.js <code>Buffer</code> objects will be transferred as <code>Uint8Array</code>s. You can convert a <code>Uint8Array</code> back to a Node.js <code>Buffer</code> by wrapping the underlying <code>ArrayBuffer</code>:</li>\n</ul>\n<pre><code class=\"hljs language-js\">Buffer.from(value.buffer, value.byteOffset, value.byteLength)\n</code></pre>\n<p>Sending any objects that aren't native JS types, such as DOM objects (e.g. <code>Element</code>, <code>Location</code>, <code>DOMMatrix</code>), Node.js objects (e.g. <code>process.env</code>, <code>Stream</code>), or Electron objects (e.g. <code>WebContents</code>, <code>BrowserWindow</code>, <code>WebFrame</code>) is deprecated. In Electron 8, these objects will be serialized as before with a DeprecationWarning message, but starting in Electron 9, sending these kinds of objects will throw a 'could not be cloned' error.</p>\n<h3 id=\"obsoleto-webviewgetwebcontents\"><a href=\"#obsoleto-webviewgetwebcontents\">Obsoleto: <code>&#x3C;webview>.getWebContents()</code></a></h3>\n<p>This API is implemented using the <code>remote</code> module, which has both performance and security implications. Therefore its usage should be explicit.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebview.getWebContents()\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> { remote } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nremote.webContents.fromId(webview.getWebContentsId())\n</code></pre>\n<p>However, it is recommended to avoid using the <code>remote</code> module altogether.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain, webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> getGuestForWebContents = <span class=\"hljs-function\">(<span class=\"hljs-params\">webContentsId, contents</span>) =></span> {\n  <span class=\"hljs-keyword\">const</span> guest = webContents.fromId(webContentsId)\n  <span class=\"hljs-keyword\">if</span> (!guest) {\n    <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">`Invalid webContentsId: <span class=\"hljs-subst\">${webContentsId}</span>`</span>)\n  }\n  <span class=\"hljs-keyword\">if</span> (guest.hostWebContents !== contents) {\n    <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Access denied to webContents'</span>)\n  }\n  <span class=\"hljs-keyword\">return</span> guest\n}\n\nipcMain.handle(<span class=\"hljs-string\">'openDevTools'</span>, (event, webContentsId) => {\n  <span class=\"hljs-keyword\">const</span> guest = getGuestForWebContents(webContentsId, event.sender)\n  guest.openDevTools()\n})\n\n<span class=\"hljs-comment\">// renderer</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nipcRenderer.invoke(<span class=\"hljs-string\">'openDevTools'</span>, webview.getWebContentsId())\n</code></pre>\n<h3 id=\"deprecated-webframesetlayoutzoomlevellimits\"><a href=\"#deprecated-webframesetlayoutzoomlevellimits\">Deprecated: <code>webFrame.setLayoutZoomLevelLimits()</code></a></h3>\n<p>Chromium has removed support for changing the layout zoom level limits, and it is beyond Electron's capacity to maintain it. The function will emit a warning in Electron 8.x, and cease to exist in Electron 9.x. The layout zoom level limits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined <a href=\"https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11\">here</a>.</p>\n<h3 id=\"deprecated-events-in-systempreferences\"><a href=\"#deprecated-events-in-systempreferences\">Deprecated events in <code>systemPreferences</code></a></h3>\n<p>The following <code>systemPreferences</code> events have been deprecated:</p>\n<ul>\n<li><code>inverted-color-scheme-changed</code></li>\n<li><code>high-contrast-color-scheme-changed</code></li>\n</ul>\n<p>Use the new <code>updated</code> event on the <code>nativeTheme</code> module instead.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.on(<span class=\"hljs-string\">'inverted-color-scheme-changed'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\nsystemPreferences.on(<span class=\"hljs-string\">'high-contrast-color-scheme-changed'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\n\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.on(<span class=\"hljs-string\">'updated'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\n</code></pre>\n<h3 id=\"deprecated-methods-in-systempreferences\"><a href=\"#deprecated-methods-in-systempreferences\">Deprecated: methods in <code>systemPreferences</code></a></h3>\n<p>Следующие <code>systemPreferences</code> были устаревшими:</p>\n<ul>\n<li><code>systemPreferences.isDarkMode()</code></li>\n<li><code>systemPreferences.isvertedColorScheme()</code></li>\n<li><code>systemPreferences.isHighContrastColorScheme()</code></li>\n</ul>\n<p>Используйте следующие свойства <code>nativeTheme</code> вместо этого:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code></li>\n<li><code>nativeTheme.shouldUseInvertedColorScheme</code></li>\n<li><code>nativeTheme.shouldUseHighContrastColors</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.isDarkMode()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseDarkColors\n\n<span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.isInvertedColorScheme()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseInvertedColorScheme\n\n<span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.isHighContrastColorScheme()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseHighContrastColors\n</code></pre>\n<h2 id=\"запланированные-критические-изменения-api-70\"><a href=\"#запланированные-критические-изменения-api-70\">Запланированные критические изменения API (7.0)</a></h2>\n<h3 id=\"deprecated-atomio-node-headers-url\"><a href=\"#deprecated-atomio-node-headers-url\">Deprecated: Atom.io Node Headers URL</a></h3>\n<p>Это URL, указанный как <code>disturl</code> в файле <code>.npmrc</code> или как <code>--dist-url</code> флаг командной строки, при сборке нативных модулей Node.  Оба будут поддерживаться в обозримом будущем, но рекомендуется переключиться.</p>\n<p>Deprecated: <a href=\"https://atom.io/download/electron\">https://atom.io/download/electron</a></p>\n<p>Replace with: <a href=\"https://electronjs.org/headers\">https://electronjs.org/headers</a></p>\n<h3 id=\"api-changed-sessionclearauthcache-no-longer-accepts-options\"><a href=\"#api-changed-sessionclearauthcache-no-longer-accepts-options\">API Changed: <code>session.clearAuthCache()</code> no longer accepts options</a></h3>\n<p><code>session.clearAuthCache</code> API больше не принимает параметры для очистки, а вместо этого безоговорочно очищает весь кэш.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устарело</span>\nsession.clearAuthCache({ <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'password'</span> })\n<span class=\"hljs-comment\">// Заменить на</span>\nsession.clearAuthCache()\n</code></pre>\n<h3 id=\"api-changed-powermonitorquerysystemidlestate-is-now-powermonitorgetsystemidlestate\"><a href=\"#api-changed-powermonitorquerysystemidlestate-is-now-powermonitorgetsystemidlestate\">API Changed: <code>powerMonitor.querySystemIdleState</code> is now <code>powerMonitor.getSystemIdleState</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\npowerMonitor.querySystemIdleState(threshold, callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleState = powerMonitor.getSystemIdleState(threshold)\n</code></pre>\n<h3 id=\"api-changed-powermonitorquerysystemidletime-is-now-powermonitorgetsystemidletime\"><a href=\"#api-changed-powermonitorquerysystemidletime-is-now-powermonitorgetsystemidletime\">API Changed: <code>powerMonitor.querySystemIdleTime</code> is now <code>powerMonitor.getSystemIdleTime</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\npowerMonitor.querySystemIdleTime(callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleTime = powerMonitor.getSystemIdleTime()\n</code></pre>\n<h3 id=\"api-changed-webframesetisolatedworldinfo-replaces-separate-methods\"><a href=\"#api-changed-webframesetisolatedworldinfo-replaces-separate-methods\">API Changed: <code>webFrame.setIsolatedWorldInfo</code> replaces separate methods</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Удалено в Electron 7.0</span>\nwebFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)\nwebFrame.setIsolatedWorldHumanReadableName(worldId, name)\nwebFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)\n<span class=\"hljs-comment\">// Заменить на</span>\nwebFrame.setIsolatedWorldInfo(\n  worldId,\n  {\n    <span class=\"hljs-attr\">securityOrigin</span>: <span class=\"hljs-string\">'some_origin'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'human_readable_name'</span>,\n    <span class=\"hljs-attr\">csp</span>: <span class=\"hljs-string\">'content_security_policy'</span>\n  })\n</code></pre>\n<h3 id=\"removed-marked-property-on-getblinkmemoryinfo\"><a href=\"#removed-marked-property-on-getblinkmemoryinfo\">Removed: <code>marked</code> property on <code>getBlinkMemoryInfo</code></a></h3>\n<p>Это свойство было удалено в Chromium 77, и как таковое больше не доступно.</p>\n<h3 id=\"behavior-changed-webkitdirectory-attribute-for-input-typefile-now-lists-directory-contents\"><a href=\"#behavior-changed-webkitdirectory-attribute-for-input-typefile-now-lists-directory-contents\">Behavior Changed: <code>webkitdirectory</code> attribute for <code>&#x3C;input type=\"file\"/></code> now lists directory contents</a></h3>\n<p>The <code>webkitdirectory</code> property on HTML file inputs allows them to select folders. Previous versions of Electron had an incorrect implementation where the <code>event.target.files</code> of the input returned a <code>FileList</code> that returned one <code>File</code> corresponding to the selected folder.</p>\n<p>As of Electron 7, that <code>FileList</code> is now list of all files contained within the folder, similarly to Chrome, Firefox, and Edge (<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory\">link to MDN docs</a>).</p>\n<p>As an illustration, take a folder with this structure:</p>\n<pre><code class=\"hljs language-console\">folder\n├── file1\n├── file2\n└── file3\n</code></pre>\n<p>In Electron &#x3C;=6, this would return a <code>FileList</code> with a <code>File</code> object for:</p>\n<pre><code class=\"hljs language-console\">path/to/folder\n</code></pre>\n<p>In Electron 7, this now returns a <code>FileList</code> with a <code>File</code> object for:</p>\n<pre><code class=\"hljs language-console\">/path/to/folder/file3\n/path/to/folder/file2\n/path/to/folder/file1\n</code></pre>\n<p>Note that <code>webkitdirectory</code> no longer exposes the path to the selected folder. If you require the path to the selected folder rather than the folder contents, see the <code>dialog.showOpenDialog</code> API (<a href=\"/docs/api/dialog#dialogshowopendialogbrowserwindow-options\">link</a>).</p>\n<h3 id=\"api-changed-callback-based-versions-of-promisified-apis\"><a href=\"#api-changed-callback-based-versions-of-promisified-apis\">API Changed: Callback-based versions of promisified APIs</a></h3>\n<p>Electron 5 and Electron 6 introduced Promise-based versions of existing asynchronous APIs and deprecated their older, callback-based counterparts. In Electron 7, all deprecated callback-based APIs are now removed.</p>\n<p>These functions now only return Promises:</p>\n<ul>\n<li><code>app.getFileIcon()</code> <a href=\"https://github.com/electron/electron/pull/15742\">#15742</a></li>\n<li><code>app.dock.show()</code> <a href=\"https://github.com/electron/electron/pull/16904\">#16904</a></li>\n<li><code>contentTracing.getCategories()</code> <a href=\"https://github.com/electron/electron/pull/16583\">#16583</a></li>\n<li><code>contentTracing.getTraceBufferUsage()</code> <a href=\"https://github.com/electron/electron/pull/16600\">#16600</a></li>\n<li><code>contentTracing.startRecording()</code> <a href=\"https://github.com/electron/electron/pull/16584\">#16584</a></li>\n<li><code>contentTracing.stopRecording()</code> <a href=\"https://github.com/electron/electron/pull/16584\">#16584</a></li>\n<li><code>contents.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>cookies.flushStore()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.get()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.remove()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.set()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>debugger.sendCommand()</code> <a href=\"https://github.com/electron/electron/pull/16861\">#16861</a></li>\n<li><code>dialog.showCertificateTrustDialog()</code> <a href=\"https://github.com/electron/electron/pull/17181\">#17181</a></li>\n<li><code>inAppPurchase.getProducts()</code> <a href=\"https://github.com/electron/electron/pull/17355\">#17355</a></li>\n<li><code>inAppPurchase.purchaseProduct()</code><a href=\"https://github.com/electron/electron/pull/17355\">#17355</a></li>\n<li><code>netLog.stopLogging()</code> <a href=\"https://github.com/electron/electron/pull/16862\">#16862</a></li>\n<li><code>session.clearAuthCache()</code> <a href=\"https://github.com/electron/electron/pull/17259\">#17259</a></li>\n<li><code>session.clearCache()</code>  <a href=\"https://github.com/electron/electron/pull/17185\">#17185</a></li>\n<li><code>session.clearHostResolverCache()</code> <a href=\"https://github.com/electron/electron/pull/17229\">#17229</a></li>\n<li><code>session.clearStorageData()</code> <a href=\"https://github.com/electron/electron/pull/17249\">#17249</a></li>\n<li><code>session.getBlobData()</code> <a href=\"https://github.com/electron/electron/pull/17303\">#17303</a></li>\n<li><code>session.getCacheSize()</code>  <a href=\"https://github.com/electron/electron/pull/17185\">#17185</a></li>\n<li><code>session.resolveProxy()</code> <a href=\"https://github.com/electron/electron/pull/17222\">#17222</a></li>\n<li><code>session.setProxy()</code>  <a href=\"https://github.com/electron/electron/pull/17222\">#17222</a></li>\n<li><code>shell.openExternal()</code> <a href=\"https://github.com/electron/electron/pull/16176\">#16176</a></li>\n<li><code>webContents.loadFile()</code> <a href=\"https://github.com/electron/electron/pull/15855\">#15855</a></li>\n<li><code>webContents.loadURL()</code> <a href=\"https://github.com/electron/electron/pull/15855\">#15855</a></li>\n<li><code>webContents.hasServiceWorker()</code> <a href=\"https://github.com/electron/electron/pull/16535\">#16535</a></li>\n<li><code>webContents.printToPDF()</code> <a href=\"https://github.com/electron/electron/pull/16795\">#16795</a></li>\n<li><code>webContents.savePage()</code> <a href=\"https://github.com/electron/electron/pull/16742\">#16742</a></li>\n<li><code>webFrame.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>webFrame.executeJavaScriptInIsolatedWorld()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>webviewTag.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>win.capturePage()</code> <a href=\"https://github.com/electron/electron/pull/15743\">#15743</a></li>\n</ul>\n<p>These functions now have two forms, synchronous and Promise-based asynchronous:</p>\n<ul>\n<li><code>dialog.showMessageBox()</code>/<code>dialog.showMessageBoxSync()</code> <a href=\"https://github.com/electron/electron/pull/17298\">#17298</a></li>\n<li><code>dialog.showOpenDialog()</code>/<code>dialog.showOpenDialogSync()</code> <a href=\"https://github.com/electron/electron/pull/16973\">#16973</a></li>\n<li><code>dialog.showSaveDialog()</code>/<code>dialog.showSaveDialogSync()</code> <a href=\"https://github.com/electron/electron/pull/17054\">#17054</a></li>\n</ul>\n<h2 id=\"запланированные-критические-изменения-api-60\"><a href=\"#запланированные-критические-изменения-api-60\">Запланированные критические изменения API (6.0)</a></h2>\n<h3 id=\"api-changed-winsetmenunull-is-now-winremovemenu\"><a href=\"#api-changed-winsetmenunull-is-now-winremovemenu\">API Changed: <code>win.setMenu(null)</code> is now <code>win.removeMenu()</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устаревшее</span>\nwin.setMenu(<span class=\"hljs-literal\">null</span>)\n<span class=\"hljs-comment\">// Заменено на</span>\nwin.removeMenu()\n</code></pre>\n<h3 id=\"api-changed-electronscreen-in-the-renderer-process-should-be-accessed-via-remote\"><a href=\"#api-changed-electronscreen-in-the-renderer-process-should-be-accessed-via-remote\">API Changed: <code>electron.screen</code> in the renderer process should be accessed via <code>remote</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устаревшее</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).screen\n<span class=\"hljs-comment\">// Заменено на</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.screen\n</code></pre>\n<h3 id=\"api-changed-requireing-node-builtins-in-sandboxed-renderers-no-longer-implicitly-loads-the-remote-version\"><a href=\"#api-changed-requireing-node-builtins-in-sandboxed-renderers-no-longer-implicitly-loads-the-remote-version\">API Changed: <code>require()</code>ing node builtins in sandboxed renderers no longer implicitly loads the <code>remote</code> version</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устаревшее</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'child_process'</span>)\n<span class=\"hljs-comment\">// Заменено на</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'child_process'</span>)\n\n<span class=\"hljs-comment\">// Устаревшее</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-comment\">// Заменено на</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-comment\">// Устаревшее</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n<span class=\"hljs-comment\">// Заменено на</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'os'</span>)\n\n<span class=\"hljs-comment\">// Устаревшее</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n<span class=\"hljs-comment\">// Заменено на</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'path'</span>)\n</code></pre>\n<h3 id=\"deprecated-powermonitorquerysystemidlestate-replaced-with-powermonitorgetsystemidlestate\"><a href=\"#deprecated-powermonitorquerysystemidlestate-replaced-with-powermonitorgetsystemidlestate\">Deprecated: <code>powerMonitor.querySystemIdleState</code> replaced with <code>powerMonitor.getSystemIdleState</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\npowerMonitor.querySystemIdleState(threshold, callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleState = powerMonitor.getSystemIdleState(threshold)\n</code></pre>\n<h3 id=\"deprecated-powermonitorquerysystemidletime-replaced-with-powermonitorgetsystemidletime\"><a href=\"#deprecated-powermonitorquerysystemidletime-replaced-with-powermonitorgetsystemidletime\">Deprecated: <code>powerMonitor.querySystemIdleTime</code> replaced with <code>powerMonitor.getSystemIdleTime</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\npowerMonitor.querySystemIdleTime(callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleTime = powerMonitor.getSystemIdleTime()\n</code></pre>\n<h3 id=\"deprecated-appenablemixedsandbox-is-no-longer-needed\"><a href=\"#deprecated-appenablemixedsandbox-is-no-longer-needed\">Deprecated: <code>app.enableMixedSandbox()</code> is no longer needed</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устарело</span>\napp.enableMixedSandbox()\n</code></pre>\n<p>Режим смешанной песочницы теперь включен по умолчанию.</p>\n<h3 id=\"deprecated-traysethighlightmode\"><a href=\"#deprecated-traysethighlightmode\">Deprecated: <code>Tray.setHighlightMode</code></a></h3>\n<p>Под macOS Catalina наша прежняя реализация Tray нарушена. Нативная замена Apple не поддерживает изменение поведения подсветки.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устарело</span>\ntray.setHighlightMode(mode)\n<span class=\"hljs-comment\">// Метод будет удален в v7.0 без альтернатив.</span>\n</code></pre>\n<h2 id=\"запланированные-критические-изменения-api-50\"><a href=\"#запланированные-критические-изменения-api-50\">Запланированные критические изменения API (5.0)</a></h2>\n<h3 id=\"default-changed-nodeintegration-and-webviewtag-default-to-false-contextisolation-defaults-to-true\"><a href=\"#default-changed-nodeintegration-and-webviewtag-default-to-false-contextisolation-defaults-to-true\">Default Changed: <code>nodeIntegration</code> and <code>webviewTag</code> default to false, <code>contextIsolation</code> defaults to true</a></h3>\n<p>Следующие значения по умолчанию для параметра <code>webPreferences</code> устарели в пользу новых значений по умолчанию, перечисленных ниже.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Свойство</th><th>Устаревшее</th><th>Новое</th></tr></thead><tbody><tr><td><code>contextIsolation</code></td><td><code>false</code></td><td><code>true</code></td></tr><tr><td><code>nodeIntegration</code></td><td><code>true</code></td><td><code>false</code></td></tr><tr><td><code>webviewTag</code></td><td><code>nodeIntegration</code>, если установлено, иначе <code>true</code></td><td><code>false</code></td></tr></tbody></table>\n<p>Например, Re-enabling the webviewTag</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> w = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">webviewTag</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h3 id=\"behavior-changed-nodeintegration-in-child-windows-opened-via-nativewindowopen\"><a href=\"#behavior-changed-nodeintegration-in-child-windows-opened-via-nativewindowopen\">Behavior Changed: <code>nodeIntegration</code> in child windows opened via <code>nativeWindowOpen</code></a></h3>\n<p>Child windows opened with the <code>nativeWindowOpen</code> option will always have Node.js integration disabled, unless <code>nodeIntegrationInSubFrames</code> is <code>true</code>.</p>\n<h3 id=\"api-changed-registering-privileged-schemes-must-now-be-done-before-app-ready\"><a href=\"#api-changed-registering-privileged-schemes-must-now-be-done-before-app-ready\">API Changed: Registering privileged schemes must now be done before app ready</a></h3>\n<p>Renderer process APIs <code>webFrame.registerURLSchemeAsPrivileged</code> and <code>webFrame.registerURLSchemeAsBypassingCSP</code> as well as browser process API <code>protocol.registerStandardSchemes</code> have been removed. Новый API <code>protocol.registerSchemesAsPrivileged</code> был добавлен и должен использоваться для регистрации пользовательских схем с необходимыми привилегиями. Пользовательские схемы должны быть зарегистрированы до готовности приложения.</p>\n<h3 id=\"deprecated-webframesetisolatedworld-replaced-with-webframesetisolatedworldinfo\"><a href=\"#deprecated-webframesetisolatedworld-replaced-with-webframesetisolatedworldinfo\">Deprecated: <code>webFrame.setIsolatedWorld*</code> replaced with <code>webFrame.setIsolatedWorldInfo</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устарело</span>\nwebFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)\nwebFrame.setIsolatedWorldHumanReadableName(worldId, name)\nwebFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)\n<span class=\"hljs-comment\">// Заменено на</span>\nwebFrame.setIsolatedWorldInfo(\n  worldId,\n  {\n    <span class=\"hljs-attr\">securityOrigin</span>: <span class=\"hljs-string\">'some_origin'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'human_readable_name'</span>,\n    <span class=\"hljs-attr\">csp</span>: <span class=\"hljs-string\">'content_security_policy'</span>\n  })\n</code></pre>\n<h3 id=\"api-changed-webframesetspellcheckprovider-now-takes-an-asynchronous-callback\"><a href=\"#api-changed-webframesetspellcheckprovider-now-takes-an-asynchronous-callback\">API Changed: <code>webFrame.setSpellCheckProvider</code> now takes an asynchronous callback</a></h3>\n<p>Параметр <code>spellCheck</code> теперь асинхронный, а параметр <code>autoCorrectWord</code> был удален.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устаревшее</span>\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, <span class=\"hljs-literal\">true</span>, {\n  <span class=\"hljs-attr\">spellCheck</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">text</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> !spellchecker. sMisspelled(text)\n  }\n})\n<span class=\"hljs-comment\">// Заменить на</span>\nwebFrame. etSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, {\n  <span class=\"hljs-attr\">spellCheck</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">words, callback</span>) =></span> {\n    callback(слова. ilter(<span class=\"hljs-function\"><span class=\"hljs-params\">text</span> =></span> spellchecker.isMisspelled(text)))\n  }\n})\n</code></pre>\n<h3 id=\"api-changed-webcontentsgetzoomlevel-and-webcontentsgetzoomfactor-are-now-synchronous\"><a href=\"#api-changed-webcontentsgetzoomlevel-and-webcontentsgetzoomfactor-are-now-synchronous\">API Changed: <code>webContents.getZoomLevel</code> and <code>webContents.getZoomFactor</code> are now synchronous</a></h3>\n<p><code>webContents.getZoomLevel</code> and <code>webContents.getZoomFactor</code> no longer take callback parameters, instead directly returning their number values.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebContents.getZoomLevel(<span class=\"hljs-function\">(<span class=\"hljs-params\">level</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(level)\n})\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> level = webContents.getZoomLevel()\n<span class=\"hljs-built_in\">console</span>.log(level)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebContents.getZoomFactor(<span class=\"hljs-function\">(<span class=\"hljs-params\">factor</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(factor)\n})\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> factor = webContents.getZoomFactor()\n<span class=\"hljs-built_in\">console</span>.log(factor)\n</code></pre>\n<h2 id=\"запланированные-критические-изменения-api-40\"><a href=\"#запланированные-критические-изменения-api-40\">Запланированные критические изменения API (4.0)</a></h2>\n<p>Следующий список включает в себя критические изменения API, сделанные в Electron 4.0.</p>\n<h3 id=\"appmakesingleinstance\"><a href=\"#appmakesingleinstance\"><code>app.makeSingleInstance</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\napp.makeSingleInstance(<span class=\"hljs-function\">(<span class=\"hljs-params\">argv, cwd</span>) =></span> {\n  <span class=\"hljs-comment\">/* ... */</span>\n})\n<span class=\"hljs-comment\">// Replace with</span>\napp.requestSingleInstanceLock()\napp.on(<span class=\"hljs-string\">'second-instance'</span>, (event, argv, cwd) => {\n  <span class=\"hljs-comment\">/* ... */</span>\n})\n</code></pre>\n<h3 id=\"appreleasesingleinstance\"><a href=\"#appreleasesingleinstance\"><code>app.releaseSingleInstance</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устарело</span>\napp.releaseSingleInstance()\n<span class=\"hljs-comment\">// Заменено на</span>\napp.releaseSingleInstanceLock()\n</code></pre>\n<h3 id=\"appgetgpuinfo\"><a href=\"#appgetgpuinfo\"><code>app.getGPUInfo</code></a></h3>\n<pre><code class=\"hljs language-js\">app.getGPUInfo(<span class=\"hljs-string\">'complete'</span>)\n<span class=\"hljs-comment\">// Теперь ведет себя так же с `basic` в macOS</span>\napp.getGPUInfo(<span class=\"hljs-string\">'basic'</span>)\n</code></pre>\n<h3 id=\"win_delay_load_hook\"><a href=\"#win_delay_load_hook\"><code>win_delay_load_hook</code></a></h3>\n<p>При создании нативных модулей для Windows переменная <code>win_delay_load_hook</code> в <code>binding.gyp</code> модуля должна быть true (это значение по умолчанию). Если этот хук отсутствует, то нативный модуль на Windows неудачно загрузится, с сообщением об ошибке, например <code>Cannot find module</code>. См. <a href=\"/docs/tutorial/using-native-node-modules\">руководство по нативным модулям</a> для получения дополнительной информации.</p>\n<h2 id=\"критические-изменения-api-30\"><a href=\"#критические-изменения-api-30\">Критические изменения API (3.0)</a></h2>\n<p>Данный список включает в себя критические изменения в API для Electron 3.0.</p>\n<h3 id=\"app\"><a href=\"#app\"><code>app</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устарело</span>\napp.getAppMemoryInfo()\n<span class=\"hljs-comment\">// Заменить на</span>\napp.getAppMetrics()\n\n<span class=\"hljs-comment\">// Устарело</span>\n<span class=\"hljs-keyword\">const</span> metrics = app.getAppMetrics()\n<span class=\"hljs-keyword\">const</span> { memory } = metrics[<span class=\"hljs-number\">0</span>] <span class=\"hljs-comment\">// свойство устарело</span>\n</code></pre>\n<h3 id=\"browserwindow\"><a href=\"#browserwindow\"><code>BrowserWindow</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-keyword\">const</span> optionsA = { <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">blinkFeatures</span>: <span class=\"hljs-string\">''</span> } }\n<span class=\"hljs-keyword\">const</span> windowA = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsA)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> optionsB = { <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">enableBlinkFeatures</span>: <span class=\"hljs-string\">''</span> } }\n<span class=\"hljs-keyword\">const</span> windowB = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsB)\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">window</span>.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'media-play_pause'</span>) {\n    <span class=\"hljs-comment\">// do something</span>\n  }\n})\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">window</span>.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'media-play-pause'</span>) {\n    <span class=\"hljs-comment\">// do something</span>\n  }\n})\n</code></pre>\n<h3 id=\"clipboard\"><a href=\"#clipboard\"><code>clipboard</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устарело</span>\nclipboard.readRtf()\n<span class=\"hljs-comment\">// Заменить на</span>\nclipboard.readRTF()\n\n<span class=\"hljs-comment\">// Устарело</span>\nclipboard.writeRtf()\n<span class=\"hljs-comment\">// Заменить на</span>\nclipboard.writeRTF()\n\n<span class=\"hljs-comment\">// Устарело</span>\nclipboard.readHtml()\n<span class=\"hljs-comment\">// Заменить на</span>\nclipboard.readHTML()\n\n<span class=\"hljs-comment\">// Устарело</span>\nclipboard.writeHtml()\n<span class=\"hljs-comment\">// Заменить на</span>\nclipboard.writeHTML()\n</code></pre>\n<h3 id=\"crashreporter\"><a href=\"#crashreporter\"><code>crashReporter</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устарело</span>\ncrashReporter.start({\n  <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Crashly'</span>,\n  <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://crash.server.com'</span>,\n  <span class=\"hljs-attr\">autoSubmit</span>: <span class=\"hljs-literal\">true</span>\n})\n<span class=\"hljs-comment\">// Заменить на</span>\ncrashReporter.start({\n  <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Crashly'</span>,\n  <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://crash.server.com'</span>,\n  <span class=\"hljs-attr\">uploadToServer</span>: <span class=\"hljs-literal\">true</span>\n})\n</code></pre>\n<h3 id=\"nativeimage\"><a href=\"#nativeimage\"><code>nativeImage</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устарело</span>\nnativeImage.createFromBuffer(buffer, <span class=\"hljs-number\">1.0</span>)\n<span class=\"hljs-comment\">// Заменить на</span>\nnativeImage.createFromBuffer(buffer, {\n  <span class=\"hljs-attr\">scaleFactor</span>: <span class=\"hljs-number\">1.0</span>\n})\n</code></pre>\n<h3 id=\"process\"><a href=\"#process\"><code>process</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устарело</span>\n<span class=\"hljs-keyword\">const</span> info = process.getProcessMemoryInfo()\n</code></pre>\n<h3 id=\"screen\"><a href=\"#screen\"><code>screen</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устарело</span>\nscreen.getMenuBarHeight()\n<span class=\"hljs-comment\">// Заменить на</span>\nscreen.getPrimaryDisplay().workArea\n</code></pre>\n<h3 id=\"session\"><a href=\"#session\"><code>session</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устарело</span>\nses.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">hostname, certificate, callback</span>) =></span> {\n  callback(<span class=\"hljs-literal\">true</span>)\n})\n<span class=\"hljs-comment\">// Заменено на</span>\nses.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">request, callback</span>) =></span> {\n  callback(<span class=\"hljs-number\">0</span>)\n})\n</code></pre>\n<h3 id=\"tray\"><a href=\"#tray\"><code>Tray</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устарело</span>\ntray.setHighlightMode(<span class=\"hljs-literal\">true</span>)\n<span class=\"hljs-comment\">// Заменить на</span>\ntray.setHighlightMode(<span class=\"hljs-string\">'on'</span>)\n\n<span class=\"hljs-comment\">// Устарело</span>\ntray.setHighlightMode(<span class=\"hljs-literal\">false</span>)\n<span class=\"hljs-comment\">// Заменить на</span>\ntray.setHighlightMode(<span class=\"hljs-string\">'off'</span>)\n</code></pre>\n<h3 id=\"webcontents\"><a href=\"#webcontents\"><code>webContents</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устарело</span>\nwebContents.openDevTools({ <span class=\"hljs-attr\">detach</span>: <span class=\"hljs-literal\">true</span> })\n<span class=\"hljs-comment\">// Заменить на</span>\nwebContents.openDevTools({ <span class=\"hljs-attr\">mode</span>: <span class=\"hljs-string\">'detach'</span> })\n\n<span class=\"hljs-comment\">// Удалено</span>\nwebContents.setSize(options)\n<span class=\"hljs-comment\">// Нет замены для этого API</span>\n</code></pre>\n<h3 id=\"webframe\"><a href=\"#webframe\"><code>webFrame</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Устарело</span>\nwebFrame.registerURLSchemeAsSecure(<span class=\"hljs-string\">'app'</span>)\n<span class=\"hljs-comment\">// Заменить на</span>\nprotocol.registerStandardSchemes([<span class=\"hljs-string\">'app'</span>], { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n\n<span class=\"hljs-comment\">// Устарело</span>\nwebFrame.registerURLSchemeAsPrivileged(<span class=\"hljs-string\">'app'</span>, { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n<span class=\"hljs-comment\">// Заменить на</span>\nprotocol.registerStandardSchemes([<span class=\"hljs-string\">'app'</span>], { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n</code></pre>\n<h3 id=\"webview\"><a href=\"#webview\"><code>&#x3C;webview></code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Удалено</span>\nwebview.setAttribute(<span class=\"hljs-string\">'disableguestresize'</span>, <span class=\"hljs-string\">''</span>)\n<span class=\"hljs-comment\">// Нет замены для этого API</span>\n\n<span class=\"hljs-comment\">// Удалено</span>\nwebview.setAttribute(<span class=\"hljs-string\">'guestinstance'</span>, instanceId)\n<span class=\"hljs-comment\">// Нет замены для этого API</span>\n\n<span class=\"hljs-comment\">// Слушатели клавиатуры больше не работают в webview теге</span>\nwebview.onkeydown&#x26;nbsp;= <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* обработчик */</span> }\nwebview.onkeyup&#x26;nbsp;= <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* обработчик */</span> }\n</code></pre>\n<h3 id=\"node-headers-url\"><a href=\"#node-headers-url\">Node Headers URL</a></h3>\n<p>Это URL, указанный как <code>disturl</code> в файле <code>.npmrc</code> или как <code>--dist-url</code> флаг командной строки, при сборке нативных модулей Node.</p>\n<p>Устарело: <a href=\"https://atom.io/download/atom-shell\">https://atom.io/download/atom-shell</a></p>\n<p>Заменено на: <a href=\"https://atom.io/download/electron\">https://atom.io/download/electron</a></p>\n<h2 id=\"критические-изменения-api-20\"><a href=\"#критические-изменения-api-20\">Критические изменения API (2.0)</a></h2>\n<p>Следующий список включает в себя критические изменения API, сделанные в Electron 2.0.</p>\n<h3 id=\"browserwindow-1\"><a href=\"#browserwindow-1\"><code>BrowserWindow</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-keyword\">const</span> optionsA = { <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden-inset'</span> }\n<span class=\"hljs-keyword\">const</span> windowA = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsA)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> optionsB = { <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span> }\n<span class=\"hljs-keyword\">const</span> windowB = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsB)\n</code></pre>\n<h3 id=\"menu\"><a href=\"#menu\"><code>menu</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Удалено</span>\nmenu.popup(browserWindow, <span class=\"hljs-number\">100</span>, <span class=\"hljs-number\">200</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Заменить на</span>\nmenu.popup(browserWindow, { <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">100</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">200</span>, <span class=\"hljs-attr\">positioningItem</span>: <span class=\"hljs-number\">2</span> })\n</code></pre>\n<h3 id=\"nativeimage-1\"><a href=\"#nativeimage-1\"><code>nativeImage</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Удалено</span>\nnativeImage.toPng()\n<span class=\"hljs-comment\">// Заменить на</span>\nnativeImage.toPNG()\n\n<span class=\"hljs-comment\">// Удалено</span>\nnativeImage.toJpeg()\n<span class=\"hljs-comment\">// Заменить на</span>\nnativeImage.toJPEG()\n</code></pre>\n<h3 id=\"process-1\"><a href=\"#process-1\"><code>process</code></a></h3>\n<ul>\n<li><code>process.versions.electron</code> и <code>process.version.chrome</code> будут доступны только для чтения, для согласованности с другими свойствами <code>process.versions</code>, установленными в Node.</li>\n</ul>\n<h3 id=\"webcontents-1\"><a href=\"#webcontents-1\"><code>webContents</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Удалено</span>\nwebContents.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Заменить на</span>\nwebContents.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"webframe-1\"><a href=\"#webframe-1\"><code>webFrame</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Удалено</span>\nwebFrame.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Заменить на</span>\nwebFrame.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"webview-1\"><a href=\"#webview-1\"><code>&#x3C;webview></code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Удалено</span>\nwebview.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Заменить на</span>\nwebview.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"двойные-arm-ресурсы\"><a href=\"#двойные-arm-ресурсы\">Двойные ARM ресурсы</a></h3>\n<p>Каждый выпуск Electron включает в себя две идентичные сборки ARM с немного разными имена файлов, такие как <code>electron-v1.7.3-linux-arm.zip</code> и <code>electron-v1.7.3-linux-armv7l.zip</code>. Ресурсы с префиксом <code>v7l</code> были добавлены, чтобы уточнить для пользователей, какую версию ARM они поддерживают, и чтобы исключить их в будущих ресурсах armv6l и arm64, которые могут быть произведены.</p>\n<p>The file <em>without the prefix</em> is still being published to avoid breaking any setups that may be consuming it. Начиная с версии 2.0, файл без префикса более не будет публиковаться.</p>\n<p>Для подробностей см. <a href=\"https://github.com/electron/electron/pull/6986\">6986</a> и <a href=\"https://github.com/electron/electron/pull/7189\">7189</a>.</p>",
      "title": "Критические изменения",
      "description": ""
    },
    "/docs/api/browser-view": {
      "locale": "ru-RU",
      "slug": "browser-view",
      "href": "/docs/api/browser-view",
      "crowdinFileId": "256283",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-view.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"browserview\"><a href=\"#browserview\">BrowserView</a></h1>\n<p><code>BrowserView</code> может использоваться для встраивания дополнительного веб-контента в <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. Это как дочернее окно, за исключением того, что оно позиционируется относительно его владельца окна. Он предназначен для того, чтобы быть альтернативой тега <code>webview</code>.</p>\n<h2 id=\"класс-browserview\"><a href=\"#класс-browserview\">Класс: BrowserView</a></h2>\n<blockquote>\n<p>Создание и управление видами.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<h3 id=\"пример\"><a href=\"#пример\">Пример</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// В основном процессе.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserView, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-keyword\">const</span> view = <span class=\"hljs-keyword\">new</span> BrowserView()\nwin.setBrowserView(view)\nview.setBounds({ <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">0</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">0</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">300</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">300</span> })\nview.webContents.loadURL(<span class=\"hljs-string\">'https://electronjs.org'</span>)\n</code></pre>\n<h3 id=\"new-browserviewoptions-экспериментально\"><a href=\"#new-browserviewoptions-экспериментально\"><code>new BrowserView([options])</code> <em>Экспериментально</em></a></h3>\n<ul>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>webPreferences</code> Объект (опционально) - Смотрите <a href=\"/docs/api/browser-window\">BrowserWindow</a>.</li>\n</ul></li>\n</ul>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<p>Объекты, созданные с помощью <code>new BrowserView</code>, имеют следующие свойства:</p>\n<h4 id=\"viewwebcontents-экспериментально\"><a href=\"#viewwebcontents-экспериментально\"><code>view.webContents</code> <em>Экспериментально</em></a></h4>\n<p>Объект <a href=\"/docs/api/web-contents\"><code>WebContents</code></a>, принадлежащий этому виду.</p>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<p>Объекты, созданные с помощью <code>new BrowserView</code>, имеют следующие свойства:</p>\n<h4 id=\"viewsetautoresizeoptions-экспериментально\"><a href=\"#viewsetautoresizeoptions-экспериментально\"><code>view.setAutoResize(options)</code> <em>Экспериментально</em></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>width</code> Boolean (опционально) - если <code>true</code>, то ширина будет увеличиваться и уменьшаться вместе с окном. По умолчанию <code>false</code>.</li>\n<li><code>height</code> Boolean (опционально) - если <code>true</code>, то высота будет увеличиваться и уменьшаться вместе с окном. По умолчанию <code>false</code>.</li>\n<li><code>horizontal</code> Boolean (опционально) - если <code>true</code>, то положение по X и ширина будут увеличиваться и уменьшаться вместе с окном. По умолчанию <code>false</code>.</li>\n<li><code>vertical</code> Boolean (опционально) - если <code>true</code>, то положение по Y и высота будут увеличиваться и уменьшаться вместе с окном. По умолчанию <code>false</code>.</li>\n</ul></li>\n</ul>\n<h4 id=\"viewsetboundsbounds-экспериментально\"><a href=\"#viewsetboundsbounds-экспериментально\"><code>view.setBounds(bounds)</code> <em>Экспериментально</em></a></h4>\n<ul>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Изменяет и перемещает вид в предоставленные границы, относительно окна.</p>\n<h4 id=\"viewgetbounds-experimental\"><a href=\"#viewgetbounds-experimental\"><code>view.getBounds()</code> <em>Experimental</em></a></h4>\n<p>Возвращает <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p><code>bounds</code> этого экземпляра BrowserView как <code>Object</code>.</p>\n<h4 id=\"viewsetbackgroundcolorcolor-экспериментально\"><a href=\"#viewsetbackgroundcolorcolor-экспериментально\"><code>view.setBackgroundColor(color)</code> <em>Экспериментально</em></a></h4>\n<ul>\n<li><code>color</code> String - цвет вида <code>#aarrggbb</code> или <code>#argb</code>. Альфа-канал является опциональным.</li>\n</ul>",
      "title": "BrowserView",
      "description": "Создание и управление видами."
    },
    "/docs/api/browser-window": {
      "locale": "ru-RU",
      "slug": "browser-window",
      "href": "/docs/api/browser-window",
      "crowdinFileId": "256287",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-window.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"browserwindow\"><a href=\"#browserwindow\">BrowserWindow</a></h1>\n<blockquote>\n<p>Создавайте окна браузера и управляйте ими.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// В основном процессе.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-comment\">// Загрузка удаленного URL</span>\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\n<span class=\"hljs-comment\">// Или загрузка локального HTML файла</span>\nwin.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n</code></pre>\n<h2 id=\"окно-без-рамки\"><a href=\"#окно-без-рамки\">Окно без рамки</a></h2>\n<p>Для создания окна без хрома или прозрачного окна произвольной формы, можно использовать API <a href=\"/docs/api/frameless-window\">окна без рамки</a>.</p>\n<h2 id=\"showing-the-window-gracefully\"><a href=\"#showing-the-window-gracefully\">Showing the window gracefully</a></h2>\n<p>When loading a page in the window directly, users may see the page load incrementally, which is not a good experience for a native app. To make the window display without a visual flash, there are two solutions for different situations.</p>\n<h3 id=\"using-the-ready-to-show-event\"><a href=\"#using-the-ready-to-show-event\">Using the <code>ready-to-show</code> event</a></h3>\n<p>При загрузке страницы, после отрисовки страницы будет происходить событие <code>ready-to-show</code>, которое будет происходить первый раз, если окно до этого еще не было показано. Окно, показанное после этого события, не будет иметь визуальной ступенчатой подгрузки:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span> })\nwin.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => {\n  win.show()\n})\n</code></pre>\n<p>Обычно это событие происходит после события <code>did-finish-load</code>. Однако, страницы, включающие в себя удаленные ресурсы, могут продолжать подгружаться после происхождения события <code>did-finish-load</code>.</p>\n<p>Пожалуйста, обратите внимание, что использование этого события означает, что рендерер будет считаться \"видимым\" и отрисуется, даже если <code>show</code> является false.  Это событие никогда не сработает, если вы используете <code>paintWhenInitiallyHidden: false</code></p>\n<h3 id=\"setting-the-backgroundcolor-property\"><a href=\"#setting-the-backgroundcolor-property\">Setting the <code>backgroundColor</code> property</a></h3>\n<p>Для больших приложений событие <code>ready-to-show</code> может вызываться слишком поздно, что может замедлить приложение. В этом случае рекомендуется показать окно немедленно, и использовать <code>backgroundColor</code>, задающий цвет фона Вашего приложения:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#2e2c29'</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<p>Обратите внимание, что даже для приложений, использующих <code>ready-to-show</code> события, по-прежнему рекомендуется установить <code>backgroundColor</code>, чтобы сделать приложение более нативным.</p>\n<h2 id=\"родительские-и-дочерние-окна\"><a href=\"#родительские-и-дочерние-окна\">Родительские и дочерние окна</a></h2>\n<p>С помощью параметра <code>parent</code>, Вы можете создавать дочерние окна:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> top = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n<span class=\"hljs-keyword\">const</span> child = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">parent</span>: top })\nchild.show()\ntop.show()\n</code></pre>\n<p>Окно <code>child</code> будет всегда показано поверх окна <code>top</code>.</p>\n<h2 id=\"модальные-окна\"><a href=\"#модальные-окна\">Модальные окна</a></h2>\n<p>Модальное окно - дочернее окно, которое делает недоступным родительское окно. Чтобы создать модальное окно, Вы должны установить два параметра <code>parent</code> и <code>modal</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> child = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">parent</span>: top, <span class=\"hljs-attr\">modal</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span> })\nchild.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\nchild.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => {\n  child.show()\n})\n</code></pre>\n<h2 id=\"видимость-страниц\"><a href=\"#видимость-страниц\">Видимость страниц</a></h2>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API\">API видимости страниц</a> работает следующим образом:</p>\n<ul>\n<li>На всех платформах состояние видимости отслеживает скрыто/уменьшено окно или нет.</li>\n<li>Кроме того, на macOS, состояние видимости также отслеживает состояние перекрытия окна. Если окно перекрыто (т.е. полностью покрыто) другим окном, состояние видимости будет <code>hidden</code>. На других платформах состояние видимости будет <code>hidden</code>, только когда окно уменьшено или явно скрыто при помощи <code>win.hide()</code>.</li>\n<li>Если <code>BrowserWindow</code> создано с <code>show: false</code>, первоначальное состояние видимости будет <code>visible</code>, несмотря на фактически скрытое окно.</li>\n<li>Если <code>backgroundThrottling</code> отключено, состояние видимости останется <code>visible</code>, даже если окно уменьшено, закрыто или скрыто.</li>\n</ul>\n<p>Рекомендуется приостановить дорогостоящие операции, когда состояние видимости <code>hidden</code>, для того чтобы свести к минимуму потребление энергии.</p>\n<h2 id=\"платформа-заметок\"><a href=\"#платформа-заметок\">Платформа заметок</a></h2>\n<ul>\n<li>На macOS модальные окна будут отображены в виде страниц, прикрепленных к родительскому окну.</li>\n<li>На macOS дочерние окна будут находиться относительно родительского окна, во время передвижения родительского окна, тем временем на Windows и Linux дочерние окна не будут двигаться.</li>\n<li>На Linux тип модального окна будет поменян в <code>dialog</code>.</li>\n<li>На Linux многие среды рабочего стола не поддерживают скрытие модального окна.</li>\n</ul>\n<h2 id=\"класс-browserwindow\"><a href=\"#класс-browserwindow\">Класс: BrowserWindow</a></h2>\n<blockquote>\n<p>Создавайте окна браузера и управляйте ими.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p><code>BrowserWindow</code> это<a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p>Так создается новый экземпляр <code>BrowserWindow</code> с нативными свойствами, установленными в <code>options</code>.</p>\n<h3 id=\"new-browserwindowoptions\"><a href=\"#new-browserwindowoptions\"><code>new BrowserWindow([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>width</code> Integer (опционально) - ширина окна в пикселях. По умолчанию <code>800</code>.</li>\n<li><code>height</code> Integer (опционально) - высота окна в пикселях. По умолчанию <code>600</code>.</li>\n<li><code>x</code> Integer (опционально) - (<strong>обязателен</strong>, если используется y) отступ окна слева от экрана. Значение по умолчанию центрирует окно.</li>\n<li><code>y</code> Integer (опционально) - (<strong>обязателен</strong>, если используется x) отступ окна сверху от экрана. Значение по умолчанию центрирует окно.</li>\n<li><code>useContentSize</code> Boolean (опционально) - <code>width</code> и <code>height</code> могут использоваться как размеры веб-страницы, это значит, что актуальный размер окна будет включать размер фрейма и будет немного крупнее. По умолчанию - <code>false</code>.</li>\n<li><code>center</code> Boolean (опционально) - показывает окно в центре экрана.</li>\n<li><code>minWidth</code> Integer (опционально) - минимальная ширина окна. По умолчанию <code>0</code>.</li>\n<li><code>minHeight</code> Integer (опционально) - минимальная высота окна. По умолчанию <code>0</code>.</li>\n<li><code>maxWidth</code> Integer (опционально) - максимальная ширина окна. По умолчанию нет ограничения.</li>\n<li><code>maxHeight</code> Integer (опционально) - максимальная высота окна. По умолчанию нет ограничения.</li>\n<li><code>resizable</code> Boolean (опционально) - будет ли окно изменять размеры. По умолчанию - <code>true</code>.</li>\n<li><code>movable</code> Boolean (optional) - можно ли будет перемещать окно. Не реализовано в Linux. По умолчанию - <code>true</code>.</li>\n<li><code>minimizable</code> Boolean (optional) - Whether window is minimizable. Не реализовано в Linux. По умолчанию - <code>true</code>.</li>\n<li><code>maximizable</code> Boolean (optional) - Whether window is maximizable. Не реализовано в Linux. По умолчанию - <code>true</code>.</li>\n<li><code>closable</code> Boolean (optional) - Whether window is closable. Не реализовано в Linux. По умолчанию - <code>true</code>.</li>\n<li><code>focusable</code> Boolean (опционально) - может ли быть окно в фокусе. По умолчанию - <code>true</code>. На Windows настройка <code>focusable: false</code> также подразумевает настройку <code>skipTaskbar: true</code>. На Linux настройка <code>focusable: false</code> прекращает взаимодействие окна с оконным менеджером, на Windows же всегда остается поверх всех рабочих областей.</li>\n<li><code>alwaysOnTop</code> Boolean (опционально) - будет ли окно всегда оставаться поверх других окон. По умолчанию - <code>false</code>.</li>\n<li><code>fullscreen</code> Boolean (опционально) - будет ли окно показываться во весь экран. Когда явно установлено <code>false</code>, на macOS кнопка полноэкранного режима будет скрыта или отключена. По умолчанию - <code>false</code>.</li>\n<li><code>fullscreenable</code> Boolean (опционально) - может ли окно быть в полноэкранном режиме. На macOS также кнопка увеличить/зумировать должна переключить в полноэкранный режим или увеличить окно. По умолчанию - <code>true</code>.</li>\n<li><code>simpleFullscreen</code> Boolean (optional) - Use pre-Lion fullscreen on macOS. По умолчанию - <code>false</code>.</li>\n<li><code>skipTaskbar</code> Boolean (optional) - Whether to show the window in taskbar. По умолчанию - <code>false</code>.</li>\n<li><code>kiosk</code> Boolean (optional) - Whether the window is in kiosk mode. По умолчанию - <code>false</code>.</li>\n<li><code>title</code> String (опционально) - заголовок окна по умолчанию. По умолчанию <code>\"Electron\"</code>. Если HTML-тег <code>&#x3C;title></code> определен в HTML-файле, загруженном с помощью <code>loadURL()</code>, то это свойство будет игнорироваться.</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (опционально) - иконка окна. На Windows рекомендуется использовать иконки <code>ICO</code>, чтобы получить лучший визуальный эффект, Вы также можете оставить неопределенным, чтобы был использован значок исполняемого файла.</li>\n<li><code>show</code> Boolean (необязательно) - Будет ли показано окно, когда будет создано. По умолчанию - <code>true</code>.</li>\n<li><code>paintWhenInitiallyHidden</code> Boolean (опционально) - Должен ли рендерер быть активным, когда <code>show</code> равен <code>false</code> и он только что создан.  Для <code>document.visibilityState</code> для корректной работы при первой загрузке с <code>show: false</code> необходимо установить значение <code>false</code>.  Установка этого в <code>false</code> приведёт к тому, что события <code>ready-to-show</code> не будут запускаться.  По умолчанию - <code>true</code>.</li>\n<li><code>frame</code> Boolean (optional) - Specify <code>false</code> to create a <a href=\"/docs/api/frameless-window\">Frameless Window</a>. По умолчанию - <code>true</code>.</li>\n<li><code>parent</code> BrowserWindow (optional) - Specify parent window. По умолчанию - <code>null</code>.</li>\n<li><code>modal</code> Boolean (optional) - Whether this is a modal window. This only works when the window is a child window. По умолчанию - <code>false</code>.</li>\n<li><code>acceptFirstMouse</code> Boolean (optional) - Whether clicking an inactive window will also click through to the web contents. Default is <code>false</code> on macOS. This option is not configurable on other platforms.</li>\n<li><code>disableAutoHideCursor</code> Boolean (optional) - Whether to hide cursor when typing. По умолчанию - <code>false</code>.</li>\n<li><code>autoHideMenuBar</code> Boolean (optional) - Auto hide the menu bar unless the <code>Alt</code> key is pressed. По умолчанию - <code>false</code>.</li>\n<li><code>enableLargerThanScreen</code> Boolean (опционально) - позволяет окну изменять размер больше, чем экран. Относится только к macOS, так как другие ОС по умолчанию разрешают окна больше экрана. По умолчанию - <code>false</code>.</li>\n<li><code>backgroundColor</code> String (опционально) - фоновый цвет окна в HEX-формате, например <code>#66CD00</code>, <code>#FFF</code> или <code>#80FFFFFF</code> (альфа в формате #AARRGGBB поддерживается, если <code>transparent</code> установлено <code>true</code>). По умолчанию - <code>#FFF</code> (белый).</li>\n<li><code>hasShadow</code> Boolean (optional) - Whether window should have a shadow. По умолчанию - <code>true</code>.</li>\n<li><code>opacity</code> Number (optional) - Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0 (fully opaque). This is only implemented on Windows and macOS.</li>\n<li><code>darkTheme</code> Boolean (optional) - Forces using dark theme for the window, only works on some GTK+3 desktop environments. По умолчанию - <code>false</code>.</li>\n<li><code>transparent</code> Boolean (опционально) - делает окно <a href=\"/docs/api/frameless-window#transparent-window\">прозрачным</a>. По умолчанию - <code>false</code>. В Windows не работает до тех пор, пока окно не будет без фрейма.</li>\n<li><code>type</code> String (optional) - The type of window, default is normal window. See more about this below.</li>\n<li><code>visualEffectState</code> String (optional) - Specify how the material appearance should reflect window activity state on macOS. Must be used with the <code>vibrancy</code> property. Возможные значения:<ul>\n<li><code>followWindow</code> - The backdrop should automatically appear active when the window is active, and inactive when it is not. This is the default.</li>\n<li><code>active</code> - The backdrop should always appear active.</li>\n<li><code>inactive</code> - The backdrop should always appear inactive.</li>\n</ul></li>\n<li><code>titleBarStyle</code> Строка (необязательно) <em>macOS</em> <em>Windows</em> - Стиль строки заголовка окна. По умолчанию - <code>default</code>. Возможные значения:<ul>\n<li><code>по умолчанию</code> - результаты в стандартной строке заголовка для macOS или Windows, соответственно.</li>\n<li><code>скрытые</code> - результаты в скрытой строке заголовка и окно полного размера. На macOS в левом верхнем углу окна все еще есть стандартное управление окном (\"светофоры\"). На Windows, когда в сочетании с заголовком <code>titleBarOverlay: true</code> он активирует Overlay Window Controls Overlay (см. <code>titleBarOverlay</code> для получения дополнительной информации), иначе панель управления окном не будет показана.</li>\n<li><code>hiddenInset</code> - Только в macOS приводит к скрытой строке заголовка с альтернативным видом где кнопки светофора немного дальше от края окна.</li>\n<li><code>customButtonsOnHover</code> - Только в macOS приводит к скрытой строке заголовка и полному размеру окно содержимого, кнопки светофора будут отображаться при наведении курсора в верхнем левом углу окна.  <strong>Примечание:</strong> Эта опция в настоящее время экспериментальная.</li>\n</ul></li>\n<li><code>trafficLightPosition</code> <a href=\"/docs/api/structures/point\">Point</a> (optional) - Set a custom position for the traffic light buttons in frameless windows.</li>\n<li><code>roundedCorners</code> Boolean (optional) - Whether frameless window should have rounded corners on macOS. По умолчанию - <code>true</code>.</li>\n<li><code>fullscreenWindowTitle</code> Boolean (optional) <em>Deprecated</em> - Shows the title in the title bar in full screen mode on macOS for <code>hiddenInset</code> titleBarStyle. По умолчанию - <code>false</code>.</li>\n<li><code>thickFrame</code> Boolenan (необязательно) - Использовать стиль <code>WS_THICKFRAME</code> на окнах с отсутствием рамок на Windows, добавляющий стандартные рамки окна. Установив значение <code>false</code>, тень окна и анимация окна будут удалены. По умолчанию - <code>true</code>.</li>\n<li><code>vibrancy</code> String (опционально) - добавить тип эффекта вибрации к окну, только на macOS. Может быть <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>titlebar</code>, <code>selection</code>, <code>menu</code>, <code>popover</code>, <code>sidebar</code>, <code>medium-light</code>, <code>ultra-dark</code>, <code>header</code>, <code>sheet</code>, <code>window</code>, <code>hud</code>, <code>fullscreen-ui</code>, <code>tooltip</code>, <code>content</code>, <code>under-window</code> или <code>under-page</code>. Please note that <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>medium-light</code>, and <code>ultra-dark</code> are deprecated and have been removed in macOS Catalina (10.15).</li>\n<li><code>zoomToPageWidth</code> Boolean (optional) - Controls the behavior on macOS when option-clicking the green stoplight button on the toolbar or by clicking the Window > Zoom menu item. Если <code>true</code>, окно будет увеличиваться до предпочтительной ширины веб-страницы при увеличении, <code>false</code> приведет к увеличению масштаба до ширины экрана. Это также повлияет на поведение при вызове <code>maximize()</code> напрямую. По умолчанию - <code>false</code>.</li>\n<li><code>tabbingIdentifier</code> String (опционально) - название группы вкладок, позволяет открывать окно как нативную вкладку в macOS 10.12+. Окна с одинаковым идентификатором вкладки будут сгруппированы вместе. Это также добавляет новую нативную кнопку вкладки в панель вкладок вашего окна и позволяет Вашему <code>приложению</code> и окну получать событие <code>new-window-for-tab</code>.</li>\n<li><code>webPreferences</code> Object (optional) - Settings of web page's features.<ul>\n<li><code>devTools</code> Boolean (опционально) - включает инструменты разработчика. Если значение <code>false</code>, нельзя будет использовать <code>BrowserWindow.webContents.openDevTools()</code>, чтобы открыть инструменты разработчика. По умолчанию - <code>true</code>.</li>\n<li><code>nodeIntegration</code> Boolean (optional) - Whether node integration is enabled. По умолчанию - <code>false</code>.</li>\n<li><code>nodeIntegrationInWorker</code> Boolean (опционально) - включает интеграцию NodeJS в веб-воркерах. По умолчанию - <code>false</code>. Больше об этом можно найти в <a href=\"/docs/tutorial/multithreading\">многопоточности</a>.</li>\n<li><code>nodeIntegrationInSubFrames</code> Boolean (опционально) - экспериментальная опция для включения поддержки NodeJS в подфреймах, таких как iframes и дочерних окнах. Все Ваши предварительные загрузки будут загружены для каждого iframe, Вы можете использовать <code>process.isMainFrame</code>, чтобы определить в главном фрейме Вы или нет.</li>\n<li><code>preload</code> String (опционально) - Определяет скрипт, который будет загружен до других скриптов загружаемых в странице. Этот скрипт будет всегда иметь доступ к узлам API в не зависимости включено или выключено объединение узлов. Значение должно быть абсолютным файловым путем к скрипту. Когда интеграция узлов отключена, сценарий предварительной загрузки может повторно вводить глобальные символы узла обратно в глобальную область. Посмотреть пример <a href=\"/docs/api/context-bridge#exposing-node-global-symbols\">здесь</a>.</li>\n<li><code>sandbox</code> Boolean (опционально) - если установлено в true, то в окне будет запущена песочница рендеринга, что делает ее совместимой с Chromium на уровне операционной системы и отключает Node.js. Это не тоже самое, что параметр <code>nodeIntegration</code>, доступные АПИ для предзагрузки более ограничены. Узнать больше об этой опции можно <a href=\"/docs/tutorial/sandbox\">здесь</a>.</li>\n<li><code>session</code> <a href=\"/docs/api/session#class-session\">Сессия</a> (опционально) - отсылает сессию используемую на странице. Вместо передачи объекта Session напрямую, вы можете также выбрать использование <code>partition</code> опции вместо которой принимает строку раздела. Когда оба <code>session</code> и <code>partition</code> определены, <code>session</code> будет приоритентней. По умолчанию используется session по умолчанию.</li>\n<li><code>partition</code> String (опционально) - Устанавливает сеанс, используемый страницей в соответствии со строкой раздела сессии. Если <code>partition</code> начинается с <code>persist:</code>, страница будет использовать постоянную сессию доступная всем страницам в приложении с некоторыми <code>partition</code>. Если нет <code>persist:</code> префикса, страница будет использовать сеанс в памяти. При присваивании одинаковой <code>partition</code>, разные страницы могут иметь одинаковую сессию. По умолчанию используется session по умолчанию.</li>\n<li><code>zoomFactor</code> Number (optional) - The default zoom factor of the page, <code>3.0</code> represents <code>300%</code>. По умолчанию - <code>1.0</code>.</li>\n<li><code>javascript</code> Boolean (optional) - Enables JavaScript support. По умолчанию - <code>true</code>.</li>\n<li><code>webSecurity</code> Boolean (опционально) - Когда <code>false</code>, отключается политика same-origin (обычно используется при тестировании вебсайтов людьми), и устанавливается <code>allowRunningInsecureContent</code> в <code>true</code>, если параметр не был установлен пользователем. По умолчанию - <code>true</code>.</li>\n<li><code>allowRunningInsecureContent</code> Boolean (optional) - Allow an https page to run JavaScript, CSS or plugins from http URLs. По умолчанию - <code>false</code>.</li>\n<li><code>images</code> Boolean (optional) - Enables image support. По умолчанию - <code>true</code>.</li>\n<li><code>imageAnimationPolicy</code> String (optional) - Specifies how to run image animations (E.g. GIFs).  Can be <code>animate</code>, <code>animateOnce</code> or <code>noAnimation</code>.  По умолчанию - <code>animate</code>.</li>\n<li><code>textAreasAreResizable</code> Boolean (optional) - Make TextArea elements resizable. Default is <code>true</code>.</li>\n<li><code>webgl</code> Boolean (optional) - Enables WebGL support. По умолчанию - <code>true</code>.</li>\n<li><code>plugins</code> Boolean (optional) - Whether plugins should be enabled. По умолчанию - <code>false</code>.</li>\n<li><code>experimentalFeatures</code> Boolean (optional) - Enables Chromium's experimental features. По умолчанию - <code>false</code>.</li>\n<li><code>scrollBounce</code> Boolean (optional) - Enables scroll bounce (rubber banding) effect on macOS. По умолчанию - <code>false</code>.</li>\n<li><code>enableBlinkFeatures</code> String (опционально) - список строк функций, разделенных <code>запятой</code>, которые нужно включить, например <code>CSSVariables,KeyboardEventKey</code>. Полный список поддерживаемых возможностей можно найти в файле <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a>.</li>\n<li><code>disableBlinkFeatures</code> String (опционально) - Список функциональных возможностей для выключения, разделяются <code>','</code>, например <code>CSSVariables,KeyboardEventKey</code>. Полный список поддерживаемых возможностей можно найти в файле <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a>.</li>\n<li><code>defaultFontFamily</code> Object (optional) - Sets the default font for the font-family.<ul>\n<li><code>standard</code> String (опционально) - По умолчанию <code>Times New Roman</code>.</li>\n<li><code>serif</code> String (опционально) - По умолчанию <code>Times New Roman</code>.</li>\n<li><code>sansSerif</code> String (опционально) - По умолчанию <code>Arial</code>.</li>\n<li><code>monospace</code> String (опционально) - По умолчанию <code>Courier New</code>.</li>\n<li><code>cursive</code> String (optional) - Defaults to <code>Script</code>.</li>\n<li><code>fantasy</code> String (optional) - Defaults to <code>Impact</code>.</li>\n</ul></li>\n<li><code>defaultFontSize</code> Integer (optional) - Defaults to <code>16</code>.</li>\n<li><code>defaultMonospaceFontSize</code> Integer (optional) - Defaults to <code>13</code>.</li>\n<li><code>minimumFontSize</code> Integer (optional) - Defaults to <code>0</code>.</li>\n<li><code>defaultEncoding</code> String (optional) - Defaults to <code>ISO-8859-1</code>.</li>\n<li><code>backgroundThrottling</code> Boolean (optional) - Whether to throttle animations and timers when the page becomes background. This also affects the <a href=\"#page-visibility\">Page Visibility API</a>. Defaults to <code>true</code>.</li>\n<li><code>offscreen</code> Boolean (optional) - Whether to enable offscreen rendering for the browser window. Defaults to <code>false</code>. See the <a href=\"/docs/tutorial/offscreen-rendering\">offscreen rendering tutorial</a> for more details.</li>\n<li><code>contextIsolation</code> Boolean (optional) - Whether to run Electron APIs and the specified <code>preload</code> script in a separate JavaScript context. Defaults to <code>true</code>. The context that the <code>preload</code> script runs in will only have access to its own dedicated <code>document</code> and <code>window</code> globals, as well as its own set of JavaScript builtins (<code>Array</code>, <code>Object</code>, <code>JSON</code>, etc.), which are all invisible to the loaded content. The Electron API will only be available in the <code>preload</code> script and not the loaded page. This option should be used when loading potentially untrusted remote content to ensure the loaded content cannot tamper with the <code>preload</code> script and any Electron APIs being used.  This option uses the same technique used by <a href=\"https://developer.chrome.com/extensions/content_scripts#execution-environment\">Chrome Content Scripts</a>.  You can access this context in the dev tools by selecting the 'Electron Isolated Context' entry in the combo box at the top of the Console tab.</li>\n<li><code>nativeWindowOpen</code> Boolean (optional) - Whether to use native <code>window.open()</code>. Defaults to <code>true</code>. Дочерние окна всегда будут отключены для интеграции узлов, если <code>nodeIntegrationInSubFrames</code> будет true.</li>\n<li><code>webviewTag</code> Boolean (опционально) - включает <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code>-тег</a>. Defaults to <code>false</code>. <strong>Примечание:</strong> Cкрипт <code>предварительной загрузки</code>, настроенный для <code>&#x3C;webview></code>, будет иметь интеграцию NodeJS, когда будет запущен, так что Вы должны убедиться, что удаленный/непроверенный контент не может создавать тег <code>&#x3C;webview></code> с возможно вредоносным скриптом <code>предварительной загрузки</code>. Вы можете использовать событие <code>will-attach-webview</code> на <a href=\"/docs/api/web-contents\">webContents</a>, чтобы снять скрипт <code>предварительной загрузки</code> и проверить или изменить начальные настройки <code>&#x3C;webview></code>.</li>\n<li><code>additionalArguments</code> String<a href=\"/docs/api/optional\"></a> - A list of strings that will be appended to <code>process.argv</code> in the renderer process of this app.  Useful for passing small bits of data down to renderer process preload scripts.</li>\n<li><code>safeDialogs</code> Boolean (optional) - Whether to enable browser style consecutive dialog protection. По умолчанию - <code>false</code>.</li>\n<li><code>safeDialogsMessage</code> String (optional) - The message to display when consecutive dialog protection is triggered. If not defined the default message would be used, note that currently the default message is in English and not localized.</li>\n<li><code>disableDialogs</code> Boolean (optional) - Whether to disable dialogs completely. Overrides <code>safeDialogs</code>. По умолчанию - <code>false</code>.</li>\n<li><code>navigateOnDragDrop</code> Boolean (optional) - Whether dragging and dropping a file or link onto the page causes a navigation. По умолчанию - <code>false</code>.</li>\n<li><code>autoplayPolicy</code> String (опционально) - политика автовоспроизведения для применения к содержимому в окне, может быть <code>no-user-gesture-required</code>, <code>user-gesture-required</code> или <code>document-user-activation-required</code>. По умолчанию <code>no-user-gesture-required</code>.</li>\n<li><code>disableHtmlFullscreenWindowResize</code> Boolean (optional) - Whether to prevent the window from resizing when entering HTML Fullscreen. Default is <code>false</code>.</li>\n<li><code>accessibleTitle</code> String (optional) - An alternative title string provided only to accessibility tools such as screen readers. This string is not directly visible to users.</li>\n<li><code>spellcheck</code> Boolean (optional) - Whether to enable the builtin spellchecker. По умолчанию - <code>true</code>.</li>\n<li><code>enableWebSQL</code> Boolean (optional) - Whether to enable the <a href=\"https://www.w3.org/TR/webdatabase/\">WebSQL api</a>. По умолчанию - <code>true</code>.</li>\n<li><code>v8CacheOptions</code> String (optional) - Enforces the v8 code caching policy used by blink. Accepted values are<ul>\n<li><code>none</code> - Disables code caching</li>\n<li><code>code</code> - Heuristic based code caching</li>\n<li><code>bypassHeatCheck</code> - Bypass code caching heuristics but with lazy compilation</li>\n<li><code>bypassHeatCheckAndEagerCompile</code> - Same as above except compilation is eager. Default policy is <code>code</code>.</li>\n</ul></li>\n<li><code>enablePreferredSizeMode</code> Boolean (optional) - Whether to enable preferred size mode. The preferred size is the minimum size needed to contain the layout of the document—without requiring scrolling. Enabling this will cause the <code>preferred-size-changed</code> event to be emitted on the <code>WebContents</code> when the preferred size changes. По умолчанию - <code>false</code>.</li>\n</ul></li>\n<li><code>titleBarOverlay</code> Object | Boolean (optional) -  When using a frameless window in conjuction with <code>win.setWindowButtonVisibility(true)</code> on macOS or using a <code>titleBarStyle</code> so that the standard window controls (\"traffic lights\" on macOS) are visible, this property enables the Window Controls Overlay <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis\">JavaScript APIs</a> and <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables\">CSS Environment Variables</a>. Specifying <code>true</code> will result in an overlay with default system colors. По умолчанию - <code>false</code>.<ul>\n<li><code>color</code> String (optional) <em>Windows</em> - The CSS color of the Window Controls Overlay when enabled. Default is the system color.</li>\n<li><code>symbolColor</code> String (optional) <em>Windows</em> - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Когда установлен минимальный или максимальный размер окна, при помощи <code>minWidth</code>/<code>maxWidth</code>/<code>minHeight</code>/<code>maxHeight</code>, это ограничивает только пользователей. Это не позволит Вам установить размер, который не будет следовать ограничениям размера, в <code>setBounds</code>/<code>setSize</code> или в конструкторе <code>BrowserWindow</code>.</p>\n<p>The possible values and behaviors of the <code>type</code> option are platform dependent. Возможные значения:</p>\n<ul>\n<li>На Linux возможны типы <code>desktop</code>, <code>dock</code>, <code>toolbar</code>, <code>splash</code>, <code>notification</code>.</li>\n<li>On macOS, possible types are <code>desktop</code>, <code>textured</code>.<ul>\n<li>Тип <code>textured</code> добавляет вид металлического градиента (<code>NSTexturedBackgroundWindowMask</code>).</li>\n<li>Тип <code>desktop</code> размещает окно на уровень фонового окна рабочего стола (<code>kCGDesktopWindowLevel - 1</code>). Обратите внимание, что окно рабочего стола не будет получить события фокуса, клавиатуры или мыши, но Вы можете использовать <code>globalShortcut</code>, чтобы получать ввод.</li>\n</ul></li>\n<li>На Windows возможен тип <code>toolbar</code>.</li>\n</ul>\n<h3 id=\"события-экземпляра\"><a href=\"#события-экземпляра\">События экземпляра</a></h3>\n<p>Объекты созданные с помощью <code>new BrowserWindow</code> имеют следующие события:</p>\n<p><strong>Примечание:</strong> Некоторые методы доступны только в определенных операционных системах и помечены как таковые.</p>\n<h4 id=\"событие-page-title-updated\"><a href=\"#событие-page-title-updated\">Событие: 'page-title-updated'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>Вызывается, когда документ меняет свой заголовок, вызов <code>event.preventDefault()</code> предотвратит изменение заголовка родного окна. <code>explicitSet</code> является false, когда заголовок синтезирован из url файла.</p>\n<h4 id=\"событие-close\"><a href=\"#событие-close\">Событие: 'close'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n</ul>\n<p>Происходит при закрытии окна. Оно происходит перед событиями <code>beforeunload</code> и <code>unload</code> в DOM. Вызов <code>event.preventDefault()</code> предотвратит закрытие.</p>\n<p>Скорее всего, Вы захотите использовать обработчик <code>beforeunload</code>, чтобы решить, когда окно должно быть закрыто, который также будет вызываться, когда окно перезагружается. В Electron возврат любого значения, отличного от <code>undefined</code>, предотвратит закрытие. Например:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-built_in\">window</span>.onbeforeunload = <span class=\"hljs-function\">(<span class=\"hljs-params\">e</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Я не хочу быть закрыт'</span>)\n\n  <span class=\"hljs-comment\">// В отличие от браузеров, пользователю будет показано окно с сообщением.</span>\n  <span class=\"hljs-comment\">// Возврат любого значения незаметно отменит закрытие.</span>\n  <span class=\"hljs-comment\">// Рекомендуется использовать dialog API, чтобы дать пользователям</span>\n  <span class=\"hljs-comment\">// возможность подтвердить закрытие приложения.</span>\n  e.returnValue = <span class=\"hljs-literal\">false</span> <span class=\"hljs-comment\">// идентично `return false`, но в использовании не рекомендуется</span>\n}\n</code></pre>\n<p><em><strong>Примечание</strong>: Существует тонкая разница между поведением <code>window.onbeforeunload = handler</code> и <code>window.addEventListener('beforeunload', handler)</code>. Рекомендуется всегда устанавливать <code>event.returnValue</code> явно, вместо того, чтобы просто возвращать значение, поскольку первое работает более последовательно в Electron.</em></p>\n<h4 id=\"событие-closed\"><a href=\"#событие-closed\">Событие: 'closed'</a></h4>\n<p>происходит когда окно приложения закрыто. After you have received this event you should remove the reference to the window and avoid using it any more.</p>\n<h4 id=\"событие-session-end-windows\"><a href=\"#событие-session-end-windows\">Событие: 'session-end' <em>Windows</em></a></h4>\n<p>Происходит, когда сеанс окна заканчивается из-за выключения, перезагрузки компьютера или отключения сеанса.</p>\n<h4 id=\"событие-unresponsive\"><a href=\"#событие-unresponsive\">Событие: 'unresponsive'</a></h4>\n<p>Вызывается, когда страница \"не отвечает\".</p>\n<h4 id=\"событие-responsive\"><a href=\"#событие-responsive\">Событие: 'responsive'</a></h4>\n<p>Происходит, когда страница, которая \"не отвечала\", снова реагирует.</p>\n<h4 id=\"событие-blur\"><a href=\"#событие-blur\">Событие: 'blur'</a></h4>\n<p>Вызывается, когда окно теряет фокус.</p>\n<h4 id=\"событие-focus\"><a href=\"#событие-focus\">Событие: 'focus'</a></h4>\n<p>Вызывается, когда на окне фокусируются.</p>\n<h4 id=\"событие-show\"><a href=\"#событие-show\">Событие: 'show'</a></h4>\n<p>Происходит, когда отображается окно.</p>\n<h4 id=\"событие-hide\"><a href=\"#событие-hide\">Событие: 'hide'</a></h4>\n<p>Происходит, когда окно спрятано.</p>\n<h4 id=\"событие-ready-to-show\"><a href=\"#событие-ready-to-show\">Событие: 'ready-to-show'</a></h4>\n<p>Происходит, когда веб-страница была отрисована (пока не отображена) и окно может быть отображено без визуального мерцания.</p>\n<p>Пожалуйста, обратите внимание, что использование этого события означает, что рендерер будет считаться \"видимым\" и отрисуется, даже если <code>show</code> является false.  Это событие никогда не сработает, если вы используете <code>paintWhenInitiallyHidden: false</code></p>\n<h4 id=\"событие-maximize\"><a href=\"#событие-maximize\">Событие: 'maximize'</a></h4>\n<p>Происходит, когда окно увеличивается до предела.</p>\n<h4 id=\"событие-unmaximize\"><a href=\"#событие-unmaximize\">Событие: 'unmaximize'</a></h4>\n<p>Происходит, когда окно выходит из увеличенного состояния.</p>\n<h4 id=\"событие-minimize\"><a href=\"#событие-minimize\">Событие: 'minimize'</a></h4>\n<p>Происходит, когда окно было свернуто.</p>\n<h4 id=\"событие-restore\"><a href=\"#событие-restore\">Событие: 'restore'</a></h4>\n<p>Происходит, когда окно восстанавливается из свернутого состояния.</p>\n<h4 id=\"событие-will-resize-macos-windows\"><a href=\"#событие-will-resize-macos-windows\">Событие: 'will-resize' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>newBounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Размер окна, на который будет изменено.</li>\n<li>Объект <code>details</code><ul>\n<li><code>edge</code> (String) - The edge of the window being dragged for resizing. Can be <code>bottom</code>, <code>left</code>, <code>right</code>, <code>top-left</code>, <code>top-right</code>, <code>bottom-left</code> or <code>bottom-right</code>.</li>\n</ul></li>\n</ul>\n<p>Emitted before the window is resized. Calling <code>event.preventDefault()</code> will prevent the window from being resized.</p>\n<p>Note that this is only emitted when the window is being resized manually. Resizing the window with <code>setBounds</code>/<code>setSize</code> will not emit this event.</p>\n<p>The possible values and behaviors of the <code>edge</code> option are platform dependent. Возможные значения:</p>\n<ul>\n<li>On Windows, possible values are <code>bottom</code>, <code>top</code>, <code>left</code>, <code>right</code>, <code>top-left</code>, <code>top-right</code>, <code>bottom-left</code>, <code>bottom-right</code>.</li>\n<li>On macOS, possible values are <code>bottom</code> and <code>right</code>.<ul>\n<li>The value <code>bottom</code> is used to denote vertical resizing.</li>\n<li>The value <code>right</code> is used to denote horizontal resizing.</li>\n</ul></li>\n</ul>\n<h4 id=\"событие-resize\"><a href=\"#событие-resize\">Событие: 'resize'</a></h4>\n<p>Происходит после того, как изменился размер окна.</p>\n<h4 id=\"event-resized-macos-windows\"><a href=\"#event-resized-macos-windows\">Event: 'resized' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Emitted once when the window has finished being resized.</p>\n<p>This is usually emitted when the window has been resized manually. On macOS, resizing the window with <code>setBounds</code>/<code>setSize</code> and setting the <code>animate</code> parameter to <code>true</code> will also emit this event once resizing has finished.</p>\n<h4 id=\"событие-will-move--macos-windows\"><a href=\"#событие-will-move--macos-windows\">Событие: 'will-move'  <em>macOS</em> <em>Windows</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>newBounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Расположение, куда окно будет перемещено.</li>\n</ul>\n<p>Emitted before the window is moved. On Windows, calling <code>event.preventDefault()</code> will prevent the window from being moved.</p>\n<p>Note that this is only emitted when the window is being resized manually. Resizing the window with <code>setBounds</code>/<code>setSize</code> will not emit this event.</p>\n<h4 id=\"событие-move\"><a href=\"#событие-move\">Событие: 'move'</a></h4>\n<p>Происходит, когда окно перемещено на новое место.</p>\n<h4 id=\"event-moved-macos-windows\"><a href=\"#event-moved-macos-windows\">Event: 'moved' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Происходит единожды, когда окно перемещается в новое положение.</p>\n<p><strong>Примечание</strong>: На macOS это событие является псевдонимом <code>move</code>.</p>\n<h4 id=\"событие-enter-full-screen\"><a href=\"#событие-enter-full-screen\">Событие: 'enter-full-screen'</a></h4>\n<p>Происходит, когда окно переходит в полноэкранный режим.</p>\n<h4 id=\"событие-leave-full-screen\"><a href=\"#событие-leave-full-screen\">Событие: 'leave-full-screen'</a></h4>\n<p>Происходит, когда окно выходит из полноэкранного режима.</p>\n<h4 id=\"событие-enter-html-full-screen\"><a href=\"#событие-enter-html-full-screen\">Событие: 'enter-html-full-screen'</a></h4>\n<p>Происходит, когда окно входит в полноэкранный режим с помощью HTML API.</p>\n<h4 id=\"событие-leave-html-full-screen\"><a href=\"#событие-leave-html-full-screen\">Событие: 'leave-html-full-screen'</a></h4>\n<p>Происходит, когда окно выходит из полноэкранного режима с помощью HTML API.</p>\n<h4 id=\"событие-always-on-top-changed\"><a href=\"#событие-always-on-top-changed\">Событие: 'always-on-top-changed'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>isAlwaysOnTop</code> Boolean</li>\n</ul>\n<p>Происходит, когда окно переключает режим отображения поверх всех окон.</p>\n<h4 id=\"событие-app-command-windows-linux\"><a href=\"#событие-app-command-windows-linux\">Событие: 'app-command' <em>Windows</em> <em>Linux</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>command</code> String</li>\n</ul>\n<p>Происходит, когда вызывается <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/ms646275(v=vs.85).aspx\">команда приложения</a>. Обычно это касается клавиатурных медиа-клавиш или команд браузера, а также кнопки \"Назад\", встроенной в некоторые мыши на Windows.</p>\n<p>Команды в нижнем регистре, подчеркивание заменено на дефисы, а префикс <code>APPCOMMAND_</code> обрезан. например <code>APPCOMMAND_BROWSER_BACKWARD</code> происходит как <code>browser-backward</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-comment\">// Navigate the window back when the user hits their mouse back button</span>\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'browser-backward'</span> &#x26;&#x26; win.webContents.canGoBack()) {\n    win.webContents.goBack()\n  }\n})\n</code></pre>\n<p>Следующие команды приложения явно поддерживаются на Linux:</p>\n<ul>\n<li><code>browser-backward</code></li>\n<li><code>browser-forward</code></li>\n</ul>\n<h4 id=\"событие-scroll-touch-begin-macos\"><a href=\"#событие-scroll-touch-begin-macos\">Событие: 'scroll-touch-begin' <em>macOS</em></a></h4>\n<p>Происходит, когда начинается прокрутка колеса.</p>\n<h4 id=\"событие-scroll-touch-end-macos\"><a href=\"#событие-scroll-touch-end-macos\">Событие: 'scroll-touch-end' <em>macOS</em></a></h4>\n<p>Происходит, когда заканчивается прокрутка колеса.</p>\n<h4 id=\"событие-scroll-touch-edge-macos\"><a href=\"#событие-scroll-touch-edge-macos\">Событие: 'scroll-touch-edge' <em>macOS</em></a></h4>\n<p>Происходит, когда прокрутка колеса достигает края элемента.</p>\n<h4 id=\"событие-swipe-macos\"><a href=\"#событие-swipe-macos\">Событие: 'swipe' <em>macOS</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>direction</code> String</li>\n</ul>\n<p>Emitted on 3-finger swipe. Possible directions are <code>up</code>, <code>right</code>, <code>down</code>, <code>left</code>.</p>\n<p>Метод, лежащий в основе этого события, создан для обработки событий смахивания на устаревших трекпадах в стиле macOS, где содержимое на экране нельзя переместить смахнув. Большинство трекпадов macOS по умолчанию не настроены под этот вид смахивания, поэтому для того чтобы правильно работал 'Переход между страницами смахиванием' перейдите в <code>Системные настройки > Трекпад > Другие жесты </code> и включите \"Смахивание двумя или тремя пальцами\".</p>\n<h4 id=\"событие-rotate-gesture-macos\"><a href=\"#событие-rotate-gesture-macos\">Событие: 'rotate-gesture' <em>macOS</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>rotation</code> Float</li>\n</ul>\n<p>Генерируется жестом вращения трекпада. Непрерывно генерируется до тех пор, пока жест поворота не будет завершен. Значение <code>rotation</code> при каждом выбросе - угол поворота в градусах, отсчитанный от последнего выброса. Последнее событие на жесте вращения всегда будет иметь значение <code>0</code>. Значения вращения против часовой стрелки положительные, по часовой стрелке отрицательные.</p>\n<h4 id=\"событие-sheet-begin-macos\"><a href=\"#событие-sheet-begin-macos\">Событие: 'sheet-begin' <em>macOS</em></a></h4>\n<p>Происходит, когда окно открывает лист.</p>\n<h4 id=\"событие-sheet-end-macos\"><a href=\"#событие-sheet-end-macos\">Событие: 'sheet-end' <em>macOS</em></a></h4>\n<p>Происходит, когда окно закрыло лист.</p>\n<h4 id=\"событие-new-window-for-tab-macos\"><a href=\"#событие-new-window-for-tab-macos\">Событие: 'new-window-for-tab' <em>macOS</em></a></h4>\n<p>Происходит, когда нажимается нативная кнопка новой вкладки.</p>\n<h4 id=\"event-system-context-menu-windows\"><a href=\"#event-system-context-menu-windows\">Event: 'system-context-menu' <em>Windows</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a> - The screen coordinates the context menu was triggered at</li>\n</ul>\n<p>Emitted when the system context menu is triggered on the window, this is normally only triggered when the user right clicks on the non-client area of your window.  This is the window titlebar or any area you have declared as <code>-webkit-app-region: drag</code> in a frameless window.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent the menu from being displayed.</p>\n<h3 id=\"статические-методы\"><a href=\"#статические-методы\">Статические методы</a></h3>\n<p>Класс <code>BrowserWindow</code> имеет следующие статические методы:</p>\n<h4 id=\"browserwindowgetallwindows\"><a href=\"#browserwindowgetallwindows\"><code>BrowserWindow.getAllWindows()</code></a></h4>\n<p>Возвращает <code>BrowserWindow[]</code> - массив всех открытых окон браузера.</p>\n<h4 id=\"browserwindowgetfocusedwindow\"><a href=\"#browserwindowgetfocusedwindow\"><code>BrowserWindow.getFocusedWindow()</code></a></h4>\n<p>Возвращает <code>BrowserWindow | null</code> - окно, которое сфокусировано в этом приложении, иначе возвращает <code>null</code>.</p>\n<h4 id=\"browserwindowfromwebcontentswebcontents\"><a href=\"#browserwindowfromwebcontentswebcontents\"><code>BrowserWindow.fromWebContents(webContents)</code></a></h4>\n<ul>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Возвращает <code>BrowserWindow | null</code> - окно, которое владеет объектом <code>webContents</code>, или имеет <code>null</code> если не содержит контент.</p>\n<h4 id=\"browserwindowfrombrowserviewbrowserview\"><a href=\"#browserwindowfrombrowserviewbrowserview\"><code>BrowserWindow.fromBrowserView(browserView)</code></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>Возвращает <code>BrowserWindow</code> - окно, которое владеет объектом <code>webContents</code>. If the given view is not attached to any window, returns <code>null</code>.</p>\n<h4 id=\"browserwindowfromidid\"><a href=\"#browserwindowfromidid\"><code>BrowserWindow.fromId(id)</code></a></h4>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Возвращает <code>BrowserWindow | null</code> - окно с указанным <code>id</code>.</p>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<p>Объекты, созданные с помощью <code>new BrowserWindow</code>, имеют следующие свойства:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">// In this example `win` is our instance</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<h4 id=\"winwebcontents-только-чтение\"><a href=\"#winwebcontents-только-чтение\"><code>win.webContents</code> <em>Только чтение</em></a></h4>\n<p>A <code>WebContents</code> object this window owns. All web page related events and operations will be done via it.</p>\n<p>Смотрите <a href=\"/docs/api/web-contents\">документацию <code>webContents</code></a> для его методов и событий.</p>\n<h4 id=\"winid-только-чтение\"><a href=\"#winid-только-чтение\"><code>win.id</code> <em>Только чтение</em></a></h4>\n<p>Свойство <code>Integer</code> представляющее уникальный идентификатор окна. Each ID is unique among all <code>BrowserWindow</code> instances of the entire Electron application.</p>\n<h4 id=\"winautohidemenubar\"><a href=\"#winautohidemenubar\"><code>win.autoHideMenuBar</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window menu bar should hide itself automatically. Once set, the menu bar will only show when users press the single <code>Alt</code> key.</p>\n<p>Если панель меню уже видна, установка этого свойства в <code>true</code> не будет скрывать ее немедленно.</p>\n<h4 id=\"winsimplefullscreen\"><a href=\"#winsimplefullscreen\"><code>win.simpleFullScreen</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in simple (pre-Lion) fullscreen mode.</p>\n<h4 id=\"winfullscreen\"><a href=\"#winfullscreen\"><code>win.fullScreen</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in fullscreen mode.</p>\n<h4 id=\"winfocusable-windows-macos\"><a href=\"#winfocusable-windows-macos\"><code>win.focusable</code> <em>Windows</em> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is focusable.</p>\n<h4 id=\"winvisibleonallworkspaces\"><a href=\"#winvisibleonallworkspaces\"><code>win.visibleOnAllWorkspaces</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is visible on all workspaces.</p>\n<p><strong>Note:</strong> Always returns false on Windows.</p>\n<h4 id=\"winshadow\"><a href=\"#winshadow\"><code>win.shadow</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window has a shadow.</p>\n<h4 id=\"winmenubarvisible-windows-linux\"><a href=\"#winmenubarvisible-windows-linux\"><code>win.menuBarVisible</code> <em>Windows</em> <em>Linux</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the menu bar should be visible.</p>\n<p><strong>Note:</strong> If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single <code>Alt</code> key.</p>\n<h4 id=\"winkiosk\"><a href=\"#winkiosk\"><code>win.kiosk</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in kiosk mode.</p>\n<h4 id=\"windocumentedited-macos\"><a href=\"#windocumentedited-macos\"><code>win.documentEdited</code> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that specifies whether the window’s document has been edited.</p>\n<p>The icon in title bar will become gray when set to <code>true</code>.</p>\n<h4 id=\"winrepresentedfilename-macos\"><a href=\"#winrepresentedfilename-macos\"><code>win.representedFilename</code> <em>macOS</em></a></h4>\n<p>A <code>String</code> property that determines the pathname of the file the window represents, and the icon of the file will show in window's title bar.</p>\n<h4 id=\"wintitle\"><a href=\"#wintitle\"><code>win.title</code></a></h4>\n<p>A <code>String</code> property that determines the title of the native window.</p>\n<p><strong>Note:</strong> The title of the web page can be different from the title of the native window.</p>\n<h4 id=\"winminimizable\"><a href=\"#winminimizable\"><code>win.minimizable</code></a></h4>\n<p>Свойство <code>Boolean</code> определяет, может ли окно быть вручную свернуто пользователем.</p>\n<p>В Linux setter это невозможно, хотя getter возвращает <code>true</code>.</p>\n<h4 id=\"winmaximizable\"><a href=\"#winmaximizable\"><code>win.maximizable</code></a></h4>\n<p>Свойство <code>Boolean</code> определяет, может ли окно быть вручную развернуто пользователем.</p>\n<p>В Linux setter это невозможно, хотя getter возвращает <code>true</code>.</p>\n<h4 id=\"winfullscreenable\"><a href=\"#winfullscreenable\"><code>win.fullScreenable</code></a></h4>\n<p>Свойство <code>Boolean</code> которое определяет, может ли кнопка увеличить/зумировать окно переключать полноэкранный режим или увеличивать до предела окно.</p>\n<h4 id=\"winresizable\"><a href=\"#winresizable\"><code>win.resizable</code></a></h4>\n<p>Свойство <code>Boolean</code> определяет, может ли окно быть вручную изменено пользователем.</p>\n<h4 id=\"winclosable\"><a href=\"#winclosable\"><code>win.closable</code></a></h4>\n<p>Свойство <code>Boolean</code> определяет, может ли окно быть вручную закрыто пользователем.</p>\n<p>В Linux setter это невозможно, хотя getter возвращает <code>true</code>.</p>\n<h4 id=\"winmovable\"><a href=\"#winmovable\"><code>win.movable</code></a></h4>\n<p>Свойство <code>Boolean</code> определяет, может ли окно перемещаться пользователем.</p>\n<p>В Linux setter это невозможно, хотя getter возвращает <code>true</code>.</p>\n<h4 id=\"winexcludedfromshownwindowsmenu-macos\"><a href=\"#winexcludedfromshownwindowsmenu-macos\"><code>win.excludedFromShownWindowsMenu</code> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is excluded from the application’s Windows menu. По умолчанию <code>false</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-keyword\">const</span> template = [\n  {\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'windowmenu'</span>\n  }\n]\n\nwin.excludedFromShownWindowsMenu = <span class=\"hljs-literal\">true</span>\n\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\nMenu.setApplicationMenu(menu)\n</code></pre>\n<h4 id=\"winaccessibletitle\"><a href=\"#winaccessibletitle\"><code>win.accessibleTitle</code></a></h4>\n<p>A <code>String</code> property that defines an alternative title provided only to accessibility tools such as screen readers. This string is not directly visible to users.</p>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<p>Objects created with <code>new BrowserWindow</code> have the following instance methods:</p>\n<p><strong>Примечание:</strong> Некоторые методы доступны только в определенных операционных системах и помечены как таковые.</p>\n<h4 id=\"windestroy\"><a href=\"#windestroy\"><code>win.destroy()</code></a></h4>\n<p>Force closing the window, the <code>unload</code> and <code>beforeunload</code> event won't be emitted for the web page, and <code>close</code> event will also not be emitted for this window, but it guarantees the <code>closed</code> event will be emitted.</p>\n<h4 id=\"winclose\"><a href=\"#winclose\"><code>win.close()</code></a></h4>\n<p>Try to close the window. This has the same effect as a user manually clicking the close button of the window. The web page may cancel the close though. See the <a href=\"#event-close\">close event</a>.</p>\n<h4 id=\"winfocus\"><a href=\"#winfocus\"><code>win.focus()</code></a></h4>\n<p>Focuses on the window.</p>\n<h4 id=\"winblur\"><a href=\"#winblur\"><code>win.blur()</code></a></h4>\n<p>Removes focus from the window.</p>\n<h4 id=\"winisfocused\"><a href=\"#winisfocused\"><code>win.isFocused()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is focused.</p>\n<h4 id=\"winisdestroyed\"><a href=\"#winisdestroyed\"><code>win.isDestroyed()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is destroyed.</p>\n<h4 id=\"winshow\"><a href=\"#winshow\"><code>win.show()</code></a></h4>\n<p>Shows and gives focus to the window.</p>\n<h4 id=\"winshowinactive\"><a href=\"#winshowinactive\"><code>win.showInactive()</code></a></h4>\n<p>Shows the window but doesn't focus on it.</p>\n<h4 id=\"winhide\"><a href=\"#winhide\"><code>win.hide()</code></a></h4>\n<p>Скрывает окно.</p>\n<h4 id=\"winisvisible\"><a href=\"#winisvisible\"><code>win.isVisible()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is visible to the user.</p>\n<h4 id=\"winismodal\"><a href=\"#winismodal\"><code>win.isModal()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether current window is a modal window.</p>\n<h4 id=\"winmaximize\"><a href=\"#winmaximize\"><code>win.maximize()</code></a></h4>\n<p>Maximizes the window. This will also show (but not focus) the window if it isn't being displayed already.</p>\n<h4 id=\"winunmaximize\"><a href=\"#winunmaximize\"><code>win.unmaximize()</code></a></h4>\n<p>Unmaximizes the window.</p>\n<h4 id=\"winismaximized\"><a href=\"#winismaximized\"><code>win.isMaximized()</code></a></h4>\n<p>Возвращает <code>Boolean</code> - если окно развернуто.</p>\n<h4 id=\"winminimize\"><a href=\"#winminimize\"><code>win.minimize()</code></a></h4>\n<p>Minimizes the window. On some platforms the minimized window will be shown in the Dock.</p>\n<h4 id=\"winrestore\"><a href=\"#winrestore\"><code>win.restore()</code></a></h4>\n<p>Restores the window from minimized state to its previous state.</p>\n<h4 id=\"winisminimized\"><a href=\"#winisminimized\"><code>win.isMinimized()</code></a></h4>\n<p>Возвращает <code>Boolean</code> - если окно свернуто.</p>\n<h4 id=\"winsetfullscreenflag\"><a href=\"#winsetfullscreenflag\"><code>win.setFullScreen(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Sets whether the window should be in fullscreen mode.</p>\n<h4 id=\"winisfullscreen\"><a href=\"#winisfullscreen\"><code>win.isFullScreen()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in fullscreen mode.</p>\n<h4 id=\"winsetsimplefullscreenflag-macos\"><a href=\"#winsetsimplefullscreenflag-macos\"><code>win.setSimpleFullScreen(flag)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Enters or leaves simple fullscreen mode.</p>\n<p>Simple fullscreen mode emulates the native fullscreen behavior found in versions of macOS prior to Lion (10.7).</p>\n<h4 id=\"winissimplefullscreen-macos\"><a href=\"#winissimplefullscreen-macos\"><code>win.isSimpleFullScreen()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in simple (pre-Lion) fullscreen mode.</p>\n<h4 id=\"winisnormal\"><a href=\"#winisnormal\"><code>win.isNormal()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in normal state (not maximized, not minimized, not in fullscreen mode).</p>\n<h4 id=\"winsetaspectratioaspectratio-extrasize\"><a href=\"#winsetaspectratioaspectratio-extrasize\"><code>win.setAspectRatio(aspectRatio[, extraSize])</code></a></h4>\n<ul>\n<li><code>aspectRatio</code> Float - The aspect ratio to maintain for some portion of the content view.</li>\n<li><code>extraSize</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) <em>macOS</em> - The extra size not to be included while maintaining the aspect ratio.</li>\n</ul>\n<p>This will make a window maintain an aspect ratio. The extra size allows a developer to have space, specified in pixels, not included within the aspect ratio calculations. This API already takes into account the difference between a window's size and its content size.</p>\n<p>Consider a normal window with an HD video player and associated controls. Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls on the right edge and 50 pixels of controls below the player. In order to maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within the player itself we would call this function with arguments of 16/9 and\n{ width: 40, height: 50 }. The second argument doesn't care where the extra width and height are within the content view--only that they exist. Sum any extra width and height areas you have within the overall content view.</p>\n<p>The aspect ratio is not respected when window is resized programmatically with APIs like <code>win.setSize</code>.</p>\n<h4 id=\"winsetbackgroundcolorbackgroundcolor\"><a href=\"#winsetbackgroundcolorbackgroundcolor\"><code>win.setBackgroundColor(backgroundColor)</code></a></h4>\n<ul>\n<li><code>backgroundColor</code> String - Window's background color as a hexadecimal value, like <code>#66CD00</code> or <code>#FFF</code> or <code>#80FFFFFF</code> (alpha is supported if <code>transparent</code> is <code>true</code>). По умолчанию - <code>#FFF</code> (белый).</li>\n</ul>\n<p>Sets the background color of the window. See <a href=\"#setting-backgroundcolor\">Setting <code>backgroundColor</code></a>.</p>\n<h4 id=\"winpreviewfilepath-displayname-macos\"><a href=\"#winpreviewfilepath-displayname-macos\"><code>win.previewFile(path[, displayName])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>path</code> String - абсолютный путь до файла, для предпросмотра в QuickLook. Это важно, так как QuickLook использует имя файла и расширение файла из пути, чтобы определить тип содержимого файла для открытия.</li>\n<li><code>displayName</code> String (опционально) - имя файла, для отображения в модальном виде QuickLook. Это чисто визуально и не влияет на тип содержимого файла. По умолчанию <code>path</code>.</li>\n</ul>\n<p>Использует <a href=\"https://en.wikipedia.org/wiki/Quick_Look\">QuickLook</a> для предпросмотра файла, по данному пути.</p>\n<h4 id=\"winclosefilepreview-macos\"><a href=\"#winclosefilepreview-macos\"><code>win.closeFilePreview()</code> <em>macOS</em></a></h4>\n<p>Закрывает текущую открытую панель <a href=\"https://en.wikipedia.org/wiki/Quick_Look\">QuickLook</a>.</p>\n<h4 id=\"winsetboundsbounds-animate\"><a href=\"#winsetboundsbounds-animate\"><code>win.setBounds(bounds[, animate])</code></a></h4>\n<ul>\n<li><code>bounds</code> Partial&#x3C;<a href=\"/docs/api/structures/rectangle\">Rectangle</a>></li>\n<li><code>animate</code> Boolean (необязательно) <em>macOS</em></li>\n</ul>\n<p>Resizes and moves the window to the supplied bounds. Any properties that are not supplied will default to their current values.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-comment\">// Установить все свойства границы</span>\nwin.setBounds({ <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">440</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">225</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-comment\">// Установить одно свойство границы</span>\nwin.setBounds({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">100</span> })\n\n<span class=\"hljs-comment\">// { x: 440, y: 225, width: 100, height: 600 }</span>\n<span class=\"hljs-built_in\">console</span>.log(win.getBounds())\n</code></pre>\n<h4 id=\"wingetbounds\"><a href=\"#wingetbounds\"><code>win.getBounds()</code></a></h4>\n<p>Возвращает <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - <code>границы</code> окна как <code>объект</code>.</p>\n<h4 id=\"wingetbackgroundcolor\"><a href=\"#wingetbackgroundcolor\"><code>win.getBackgroundColor()</code></a></h4>\n<p>Returns <code>String</code> - Gets the background color of the window. See <a href=\"#setting-backgroundcolor\">Setting <code>backgroundColor</code></a>.</p>\n<h4 id=\"winsetcontentboundsbounds-animate\"><a href=\"#winsetcontentboundsbounds-animate\"><code>win.setContentBounds(bounds[, animate])</code></a></h4>\n<ul>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n<li><code>animate</code> Boolean (необязательно) <em>macOS</em></li>\n</ul>\n<p>Меняет размеры и перемещает клиентскую область окна (например, веб-страницу) на заданные границы.</p>\n<h4 id=\"wingetcontentbounds\"><a href=\"#wingetcontentbounds\"><code>win.getContentBounds()</code></a></h4>\n<p>Возвращает <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - <code>границы</code> области клиентского окна как <code>объект</code>.</p>\n<h4 id=\"wingetnormalbounds\"><a href=\"#wingetnormalbounds\"><code>win.getNormalBounds()</code></a></h4>\n<p>Возвращает <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - содержит границы окна в нормальном состоянии</p>\n<p><strong>Примечание:</strong> Независимо от текущего состояния окна: увеличено до предела, свернуто или в полноэкранном режиме, эта функция всегда возвратит позицию и размер окна в нормальном состоянии. В нормальном состоянии, getBounds и getNormalBounds возвращают тот же <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a>.</p>\n<h4 id=\"winsetenabledenable\"><a href=\"#winsetenabledenable\"><code>win.setEnabled(enable)</code></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Включает или выключает окно.</p>\n<h4 id=\"winisenabled\"><a href=\"#winisenabled\"><code>win.isEnabled()</code></a></h4>\n<p>Returns <code>Boolean</code> - whether the window is enabled.</p>\n<h4 id=\"winsetsizewidth-height-animate\"><a href=\"#winsetsizewidth-height-animate\"><code>win.setSize(width, height[, animate])</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>animate</code> Boolean (необязательно) <em>macOS</em></li>\n</ul>\n<p>Resizes the window to <code>width</code> and <code>height</code>. If <code>width</code> or <code>height</code> are below any set minimum size constraints the window will snap to its minimum size.</p>\n<h4 id=\"wingetsize\"><a href=\"#wingetsize\"><code>win.getSize()</code></a></h4>\n<p>Возвращает <code>Integer[]</code> - Содержит высоту и ширину окна.</p>\n<h4 id=\"winsetcontentsizewidth-height-animate\"><a href=\"#winsetcontentsizewidth-height-animate\"><code>win.setContentSize(width, height[, animate])</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>animate</code> Boolean (необязательно) <em>macOS</em></li>\n</ul>\n<p>Меняет размер клиентской области окна (например, веб-страница) на <code>width</code> и <code>height</code>.</p>\n<h4 id=\"wingetcontentsize\"><a href=\"#wingetcontentsize\"><code>win.getContentSize()</code></a></h4>\n<p>Возвращает <code>Integer[]</code> - содержит ширину и высоту клиентской области окна.</p>\n<h4 id=\"winsetminimumsizewidth-height\"><a href=\"#winsetminimumsizewidth-height\"><code>win.setMinimumSize(width, height)</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n</ul>\n<p>Устанавливает минимальный размер окна на <code>width</code> и <code>height</code>.</p>\n<h4 id=\"wingetminimumsize\"><a href=\"#wingetminimumsize\"><code>win.getMinimumSize()</code></a></h4>\n<p>Возвращает <code>Integer[]</code> - содержит минимальную ширину и высоту окна.</p>\n<h4 id=\"winsetmaximumsizewidth-height\"><a href=\"#winsetmaximumsizewidth-height\"><code>win.setMaximumSize(width, height)</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n</ul>\n<p>Устанавливает максимальный размер окна на <code>width</code> и <code>height</code>.</p>\n<h4 id=\"wingetmaximumsize\"><a href=\"#wingetmaximumsize\"><code>win.getMaximumSize()</code></a></h4>\n<p>Возвращает <code>Integer[]</code> - содержит максимальную ширину и высоту окна.</p>\n<h4 id=\"winsetresizableresizable\"><a href=\"#winsetresizableresizable\"><code>win.setResizable(resizable)</code></a></h4>\n<ul>\n<li><code>resizable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually resized by the user.</p>\n<h4 id=\"winisresizable\"><a href=\"#winisresizable\"><code>win.isResizable()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be manually resized by the user.</p>\n<h4 id=\"winsetmovablemovable-macos-windows\"><a href=\"#winsetmovablemovable-macos-windows\"><code>win.setMovable(movable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>movable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be moved by user. On Linux does nothing.</p>\n<h4 id=\"winismovable-macos-windows\"><a href=\"#winismovable-macos-windows\"><code>win.isMovable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Возвращает <code>Boolean</code> - может пользователь перемещать окно или нет.</p>\n<p>На Linux всегда возвращает <code>true</code>.</p>\n<h4 id=\"winsetminimizableminimizable-macos-windows\"><a href=\"#winsetminimizableminimizable-macos-windows\"><code>win.setMinimizable(minimizable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>minimizable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually minimized by user. On Linux does nothing.</p>\n<h4 id=\"winisminimizable-macos-windows\"><a href=\"#winisminimizable-macos-windows\"><code>win.isMinimizable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be manually minimized by the user.</p>\n<p>На Linux всегда возвращает <code>true</code>.</p>\n<h4 id=\"winsetmaximizablemaximizable-macos-windows\"><a href=\"#winsetmaximizablemaximizable-macos-windows\"><code>win.setMaximizable(maximizable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>maximizable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually maximized by user. On Linux does nothing.</p>\n<h4 id=\"winismaximizable-macos-windows\"><a href=\"#winismaximizable-macos-windows\"><code>win.isMaximizable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Возвращает <code>Boolean</code> - может пользователь вручную увеличивать до предела окно или нет.</p>\n<p>На Linux всегда возвращает <code>true</code>.</p>\n<h4 id=\"winsetfullscreenablefullscreenable\"><a href=\"#winsetfullscreenablefullscreenable\"><code>win.setFullScreenable(fullscreenable)</code></a></h4>\n<ul>\n<li><code>fullscreenable</code> Boolean</li>\n</ul>\n<p>Sets whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.</p>\n<h4 id=\"winisfullscreenable\"><a href=\"#winisfullscreenable\"><code>win.isFullScreenable()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.</p>\n<h4 id=\"winsetclosableclosable-macos-windows\"><a href=\"#winsetclosableclosable-macos-windows\"><code>win.setClosable(closable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>closable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually closed by user. On Linux does nothing.</p>\n<h4 id=\"winisclosable-macos-windows\"><a href=\"#winisclosable-macos-windows\"><code>win.isClosable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Возвращает <code>Boolean</code> - может пользователь вручную закрывать окно или нет.</p>\n<p>На Linux всегда возвращает <code>true</code>.</p>\n<h4 id=\"winsetalwaysontopflag-level-relativelevel\"><a href=\"#winsetalwaysontopflag-level-relativelevel\"><code>win.setAlwaysOnTop(flag[, level][, relativeLevel])</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n<li><code>level</code> String (опционально) <em>macOS</em> <em>Windows</em> - Значения включают <code>normal</code>, <code>floating</code>, <code>torn-off-menu</code>, <code>modal-panel</code>, <code>main-menu</code>, <code>status</code>, <code>pop-up-menu</code>, <code>screen-saver</code> и <del><code>dock</code></del> (Устарело). По умолчанию <code>floating</code>, когда <code>flag</code> установлен true. <code>level</code> сбрасывается на <code>normal</code>, когда флаг устанавливается false. Обратите внимание, что от <code>floating</code> до <code>status</code> включительно, окно находится под Dock в macOS и под панелью задач в Windows. От <code>pop-up-menu</code> и выше отображается над Dock на macOS и выше панели задач на Windows. Смотрите <a href=\"https://developer.apple.com/documentation/appkit/nswindow/level\">документацию macOS</a> для подробностей.</li>\n<li><code>relativeLevel</code> Integer (опционально) <em>macOS</em> - количество слоев выше, чтобы установить окно относительно заданного <code>level</code>. По умолчанию - <code>0</code>. Обратите внимание, что Apple не рекомендует устанавливать уровни выше, чем 1 верхнего <code>screen-saver</code>.</li>\n</ul>\n<p>Sets whether the window should show always on top of other windows. After setting this, the window is still a normal window, not a toolbox window which can not be focused on.</p>\n<h4 id=\"winisalwaysontop\"><a href=\"#winisalwaysontop\"><code>win.isAlwaysOnTop()</code></a></h4>\n<p>Возвращает <code>Boolean</code> - всегда ли окно поверх остальных окон.</p>\n<h4 id=\"winmoveabovemediasourceid\"><a href=\"#winmoveabovemediasourceid\"><code>win.moveAbove(mediaSourceId)</code></a></h4>\n<ul>\n<li><code>mediaSourceId</code> String - Window id in the format of DesktopCapturerSource's id. For example \"window:1869:0\".</li>\n</ul>\n<p>Moves window above the source window in the sense of z-order. If the <code>mediaSourceId</code> is not of type window or if the window does not exist then this method throws an error.</p>\n<h4 id=\"winmovetop\"><a href=\"#winmovetop\"><code>win.moveTop()</code></a></h4>\n<p>Перемещает окно на верх(z-order) независимо от фокуса</p>\n<h4 id=\"wincenter\"><a href=\"#wincenter\"><code>win.center()</code></a></h4>\n<p>Перемещает окно в центр экрана.</p>\n<h4 id=\"winsetpositionx-y-animate\"><a href=\"#winsetpositionx-y-animate\"><code>win.setPosition(x, y[, animate])</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n<li><code>animate</code> Boolean (необязательно) <em>macOS</em></li>\n</ul>\n<p>Перемещает окно на <code>x</code> и <code>y</code>.</p>\n<h4 id=\"wingetposition\"><a href=\"#wingetposition\"><code>win.getPosition()</code></a></h4>\n<p>Возвращает <code>Integer[]</code> - содержит текущую позицию окна.</p>\n<h4 id=\"winsettitletitle\"><a href=\"#winsettitletitle\"><code>win.setTitle(title)</code></a></h4>\n<ul>\n<li><code>title</code> String</li>\n</ul>\n<p>Изменяет название нативного окна на <code>title</code>.</p>\n<h4 id=\"wingettitle\"><a href=\"#wingettitle\"><code>win.getTitle()</code></a></h4>\n<p>Возвращает <code>String</code> - название нативного окна.</p>\n<p><strong>Примечание:</strong> Название веб-страницы может отличаться от названия нативного окна.</p>\n<h4 id=\"winsetsheetoffsetoffsety-offsetx-macos\"><a href=\"#winsetsheetoffsetoffsety-offsetx-macos\"><code>win.setSheetOffset(offsetY[, offsetX])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>offsetY</code> Float</li>\n<li><code>offsetX</code> Float (опционально)</li>\n</ul>\n<p>Changes the attachment point for sheets on macOS. By default, sheets are attached just below the window frame, but you may want to display them beneath a HTML-rendered toolbar. Например:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-keyword\">const</span> toolbarRect = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'toolbar'</span>).getBoundingClientRect()\nwin.setSheetOffset(toolbarRect.height)\n</code></pre>\n<h4 id=\"winflashframeflag\"><a href=\"#winflashframeflag\"><code>win.flashFrame(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Starts or stops flashing the window to attract user's attention.</p>\n<h4 id=\"winsetskiptaskbarskip\"><a href=\"#winsetskiptaskbarskip\"><code>win.setSkipTaskbar(skip)</code></a></h4>\n<ul>\n<li><code>skip</code> Boolean</li>\n</ul>\n<p>Makes the window not show in the taskbar.</p>\n<h4 id=\"winsetkioskflag\"><a href=\"#winsetkioskflag\"><code>win.setKiosk(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Enters or leaves kiosk mode.</p>\n<h4 id=\"winiskiosk\"><a href=\"#winiskiosk\"><code>win.isKiosk()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in kiosk mode.</p>\n<h4 id=\"winistabletmode-windows\"><a href=\"#winistabletmode-windows\"><code>win.isTabletMode()</code> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in Windows 10 tablet mode.</p>\n<p>Since Windows 10 users can <a href=\"https://support.microsoft.com/en-us/help/17210/windows-10-use-your-pc-like-a-tablet\">use their PC as tablet</a>, under this mode apps can choose to optimize their UI for tablets, such as enlarging the titlebar and hiding titlebar buttons.</p>\n<p>This API returns whether the window is in tablet mode, and the <code>resize</code> event can be be used to listen to changes to tablet mode.</p>\n<h4 id=\"wingetmediasourceid\"><a href=\"#wingetmediasourceid\"><code>win.getMediaSourceId()</code></a></h4>\n<p>Returns <code>String</code> - Window id in the format of DesktopCapturerSource's id. For example \"window:1324:0\".</p>\n<p>More precisely the format is <code>window:id:other_id</code> where <code>id</code> is <code>HWND</code> on Windows, <code>CGWindowID</code> (<code>uint64_t</code>) on macOS and <code>Window</code> (<code>unsigned long</code>) on Linux. <code>other_id</code> is used to identify web contents (tabs) so within the same top level window.</p>\n<h4 id=\"wingetnativewindowhandle\"><a href=\"#wingetnativewindowhandle\"><code>win.getNativeWindowHandle()</code></a></h4>\n<p>Returns <code>Buffer</code> - The platform-specific handle of the window.</p>\n<p>The native type of the handle is <code>HWND</code> on Windows, <code>NSView*</code> on macOS, and <code>Window</code> (<code>unsigned long</code>) on Linux.</p>\n<h4 id=\"winhookwindowmessagemessage-callback-windows\"><a href=\"#winhookwindowmessagemessage-callback-windows\"><code>win.hookWindowMessage(message, callback)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n<li><code>callback</code> Function<ul>\n<li><code>wParam</code> any - The <code>wParam</code> provided to the WndProc</li>\n<li><code>lParam</code> any - The <code>lParam</code> provided to the WndProc</li>\n</ul></li>\n</ul>\n<p>Hooks a windows message. The <code>callback</code> is called when the message is received in the WndProc.</p>\n<h4 id=\"winiswindowmessagehookedmessage-windows\"><a href=\"#winiswindowmessagehookedmessage-windows\"><code>win.isWindowMessageHooked(message)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n</ul>\n<p>Returns <code>Boolean</code> - <code>true</code> or <code>false</code> depending on whether the message is hooked.</p>\n<h4 id=\"winunhookwindowmessagemessage-windows\"><a href=\"#winunhookwindowmessagemessage-windows\"><code>win.unhookWindowMessage(message)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n</ul>\n<p>Unhook the window message.</p>\n<h4 id=\"winunhookallwindowmessages-windows\"><a href=\"#winunhookallwindowmessages-windows\"><code>win.unhookAllWindowMessages()</code> <em>Windows</em></a></h4>\n<p>Unhooks all of the window messages.</p>\n<h4 id=\"winsetrepresentedfilenamefilename-macos\"><a href=\"#winsetrepresentedfilenamefilename-macos\"><code>win.setRepresentedFilename(filename)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>filename</code> String</li>\n</ul>\n<p>Sets the pathname of the file the window represents, and the icon of the file will show in window's title bar.</p>\n<h4 id=\"wingetrepresentedfilename-macos\"><a href=\"#wingetrepresentedfilename-macos\"><code>win.getRepresentedFilename()</code> <em>macOS</em></a></h4>\n<p>Returns <code>String</code> - The pathname of the file the window represents.</p>\n<h4 id=\"winsetdocumenteditededited-macos\"><a href=\"#winsetdocumenteditededited-macos\"><code>win.setDocumentEdited(edited)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>edited</code> Boolean</li>\n</ul>\n<p>Specifies whether the window’s document has been edited, and the icon in title bar will become gray when set to <code>true</code>.</p>\n<h4 id=\"winisdocumentedited-macos\"><a href=\"#winisdocumentedited-macos\"><code>win.isDocumentEdited()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window's document has been edited.</p>\n<h4 id=\"winfocusonwebview\"><a href=\"#winfocusonwebview\"><code>win.focusOnWebView()</code></a></h4>\n<h4 id=\"winblurwebview\"><a href=\"#winblurwebview\"><code>win.blurWebView()</code></a></h4>\n<h4 id=\"wincapturepagerect\"><a href=\"#wincapturepagerect\"><code>win.capturePage([rect])</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (optional) - The bounds to capture</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;NativeImage></code> - разрешается с <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Захватывает снимок страницы в границах <code>rect</code>. Пропустив <code>rect</code>, будет сделан захват всей видимой страницы. If the page is not visible, <code>rect</code> may be empty.</p>\n<h4 id=\"winloadurlurl-options\"><a href=\"#winloadurlurl-options\"><code>win.loadURL(url[, options])</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (опционально) - HTTP Referrer.</li>\n<li><code>userAgent</code> String (optional) - A user agent originating the request.</li>\n<li><code>extraHeaders</code> String (optional) - Extra headers separated by \"\\n\"</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (опционально) - Базовый URL (с разделителем пути), для файлов, которые будут загружены по URL данных. Это необходимо, только если указанный <code>url</code> это URL данных и необходимо загрузить другие файлы.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code> - промис будет разрешен, когда страница завершит загрузку (см. <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), и отклоняет, если страница не удачно загрузилась (см. <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Тоже, что и <a href=\"/docs/api/web-contents#contentsloadurlurl-options\"><code>webContents.loadURL(url[, options])</code></a>.</p>\n<p>The <code>url</code> can be a remote address (e.g. <code>http://</code>) or a path to a local HTML file using the <code>file://</code> protocol.</p>\n<p>To ensure that file URLs are properly formatted, it is recommended to use Node's <a href=\"https://nodejs.org/api/url.html#url_url_format_urlobject\"><code>url.format</code></a> method:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>).format({\n  <span class=\"hljs-attr\">protocol</span>: <span class=\"hljs-string\">'file'</span>,\n  <span class=\"hljs-attr\">slashes</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">pathname</span>: <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>).join(__dirname, <span class=\"hljs-string\">'index.html'</span>)\n})\n\nwin.loadURL(url)\n</code></pre>\n<p>You can load a URL using a <code>POST</code> request with URL-encoded data by doing the following:</p>\n<pre><code class=\"hljs language-javascript\">win.loadURL(<span class=\"hljs-string\">'http://localhost:8000/post'</span>, {\n  <span class=\"hljs-attr\">postData</span>: [{\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'rawData'</span>,\n    <span class=\"hljs-attr\">bytes</span>: Buffer.from(<span class=\"hljs-string\">'hello=world'</span>)\n  }],\n  <span class=\"hljs-attr\">extraHeaders</span>: <span class=\"hljs-string\">'Content-Type: application/x-www-form-urlencoded'</span>\n})\n</code></pre>\n<h4 id=\"winloadfilefilepath-options\"><a href=\"#winloadfilefilepath-options\"><code>win.loadFile(filePath[, options])</code></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>query</code> Record&#x3C;String, String> (опционально) - переданная в <code>url.format()</code>.</li>\n<li><code>search</code> String (optional) - Passed to <code>url.format()</code>.</li>\n<li><code>hash</code> String (optional) - Passed to <code>url.format()</code>.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code> - промис будет разрешен, когда страница завершит загрузку (см. <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), и отклоняет, если страница не удачно загрузилась (см. <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Same as <code>webContents.loadFile</code>, <code>filePath</code> should be a path to an HTML file relative to the root of your application.  See the <code>webContents</code> docs for more information.</p>\n<h4 id=\"winreload\"><a href=\"#winreload\"><code>win.reload()</code></a></h4>\n<p>Same as <code>webContents.reload</code>.</p>\n<h4 id=\"winsetmenumenu-linux-windows\"><a href=\"#winsetmenumenu-linux-windows\"><code>win.setMenu(menu)</code> <em>Linux</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Устанавливает <code>menu</code> в меню окна.</p>\n<h4 id=\"winremovemenu-linux-windows\"><a href=\"#winremovemenu-linux-windows\"><code>win.removeMenu()</code> <em>Linux</em> <em>Windows</em></a></h4>\n<p>Удаляет меню окна.</p>\n<h4 id=\"winsetprogressbarprogress-options\"><a href=\"#winsetprogressbarprogress-options\"><code>win.setProgressBar(progress[, options])</code></a></h4>\n<ul>\n<li><code>progress</code> Double</li>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>mode</code> String <em>Windows</em> - Mode for the progress bar. Can be <code>none</code>, <code>normal</code>, <code>indeterminate</code>, <code>error</code> or <code>paused</code>.</li>\n</ul></li>\n</ul>\n<p>Устанавливает значение прогресса на шкале прогресса. Valid range is [0, 1.0].</p>\n<p>Удаляет индикатор прогресса, когда прогресс меньше 0; Изменяет в режим indeterminate, когда прогресс больше 1.</p>\n<p>На платформе Linux поддерживается только рабочая среда Unity, Вам необходимо указать имя файла <code>*.desktop</code> в поле <code>desktopName</code> в <code>package.json</code>. По умолчанию будет предполагаться <code>{app.name}.desktop</code>.</p>\n<p>На Windows режим может быть передан. Принимаемые значения: <code>none</code>, <code>normal</code>, <code>indeterminate</code>, <code>error</code> и <code>paused</code>. Если Вы вызовете <code>setProgressBar</code> без установленного режима (но со значением в пределах допустимого диапозона), будет предполагаться <code>normal</code>.</p>\n<h4 id=\"winsetoverlayiconoverlay-description-windows\"><a href=\"#winsetoverlayiconoverlay-description-windows\"><code>win.setOverlayIcon(overlay, description)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>overlay</code> <a href=\"/docs/api/native-image\">NativeImage</a> | null - иконка, которая будет отображаться в правом краю иконки на панели задач. Если параметр <code>null</code>, оверлей будет очищен</li>\n<li><code>description</code> String - описание, которое будет представлено для доступности чтения с экрана</li>\n</ul>\n<p>Устанавливает 16x16 пиксельный оверлей поверх текущей иконки в панели задач, обычно используется для передачи какого-либо статуса приложения или пассивного уведомления пользователя.</p>\n<h4 id=\"winsethasshadowhasshadow\"><a href=\"#winsethasshadowhasshadow\"><code>win.setHasShadow(hasShadow)</code></a></h4>\n<ul>\n<li><code>hasShadow</code> Boolean</li>\n</ul>\n<p>Устанавливает, будет ли окно иметь тень.</p>\n<h4 id=\"winhasshadow\"><a href=\"#winhasshadow\"><code>win.hasShadow()</code></a></h4>\n<p>Возвращает <code>Boolean</code> - есть ли у окна тень.</p>\n<h4 id=\"winsetopacityopacity-windows-macos\"><a href=\"#winsetopacityopacity-windows-macos\"><code>win.setOpacity(opacity)</code> <em>Windows</em> <em>macOS</em></a></h4>\n<ul>\n<li><code>opacity</code> Number - между 0.0 (полная прозрачность) и 1.0 (полная видимость)</li>\n</ul>\n<p>Sets the opacity of the window. On Linux, does nothing. Out of bound number values are clamped to the [0, 1] range.</p>\n<h4 id=\"wingetopacity\"><a href=\"#wingetopacity\"><code>win.getOpacity()</code></a></h4>\n<p>Возвращает <code>Number</code> - между 0.0 (полная прозрачность) и 1.0 (полная видимость). On Linux, always returns 1.</p>\n<h4 id=\"winsetshaperects-windows-linux-экспериментально\"><a href=\"#winsetshaperects-windows-linux-экспериментально\"><code>win.setShape(rects)</code> <em>Windows</em> <em>Linux</em> <em>Экспериментально</em></a></h4>\n<ul>\n<li><code>rects</code> <a href=\"/docs/api/structures/rectangle\">Rectangle[]</a> - Sets a shape on the window. Passing an empty list reverts the window to being rectangular.</li>\n</ul>\n<p>Установка формы окна, которая определяет область в окне, где система разрешает отрисовку и взаимодействие пользователя. Вне данного региона ни один пиксель не отрисуется и ни одно событие мыши не будет зарегистрировано. Вне региона события мыши не будут получены этим окном, но будет передаваться чему-либо позади окна.</p>\n<h4 id=\"winsetthumbarbuttonsbuttons-windows\"><a href=\"#winsetthumbarbuttonsbuttons-windows\"><code>win.setThumbarButtons(buttons)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>buttons</code> <a href=\"/docs/api/structures/thumbar-button\">ThumbarButton[]</a></li>\n</ul>\n<p>Возвращает <code>Boolean</code> - успешно ли добавлены кнопки</p>\n<p>Добавляет панель миниатюр, с определенным набором кнопок, на слой кнопок в изображении эскиза окна в панели задач. Возвращает объект <code>Boolean</code>, который указывает успешно ли добавлена панель миниатюр.</p>\n<p>Количество кнопок в панели миниатюр не должно быть больше, чем 7, из-за ограничений. После установки панели миниатюр, панель не может быть удалена, из-за ограничений платформы. Но Вы можете вызвать метод с пустым массивом, чтобы убрать кнопки.</p>\n<p><code>buttons</code> является массивом объектов <code>Button</code>:</p>\n<ul>\n<li><code>Button</code> Object<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - иконка, отображаемая на панели миниатюр.</li>\n<li><code>click</code> Function</li>\n<li><code>tooltip</code> String (опционально) - текст всплывающей подсказки на кнопке.</li>\n<li><code>flags</code> String<a href=\"/docs/api/%D0%BE%D0%BF%D1%86%D0%B8%D0%BE%D0%BD%D0%B0%D0%BB%D1%8C%D0%BD%D0%BE\"></a> - Управление конкретными состояниями и поведением кнопки. По умолчанию, является <code>['enabled']</code>.</li>\n</ul></li>\n</ul>\n<p><code>flags</code> — это массив, который может включать следующие <code>строки</code>:</p>\n<ul>\n<li><code>enabled</code> - кнопка активна и доступна пользователю.</li>\n<li><code>disabled</code> - Кнопка отключена. Она присутствует, но имеет неактивное визуальное состояние и не будет реагировать на действия пользователя.</li>\n<li><code>dismissonclick</code> - когда кнопка нажата, окно панели миниатюр закрывается немедленно.</li>\n<li><code>nobackground</code> - не рисует границы кнопок, использует только изображение.</li>\n<li><code>hidden</code> - кнопка не отображается пользователю.</li>\n<li><code>noninteractive</code> - Кнопка включена, но не интерактивна; ни одно состояние кнопки не отображается. Это значение предназначено для случаев, когда кнопка используется в уведомлении.</li>\n</ul>\n<h4 id=\"winsetthumbnailclipregion-windows\"><a href=\"#winsetthumbnailclipregion-windows\"><code>win.setThumbnailClip(region)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>region</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - область окна</li>\n</ul>\n<p>Устанавливает область окна, которая будет показана в панели миниатюр, при наведении мыши на окно в панели задач. Вы можете сбросить панель миниатюры, чтобы показывалось окно полностью, указав пустую область: <code>{ x: 0, y: 0, width: 0, height: 0 }</code>.</p>\n<h4 id=\"winsetthumbnailtooltiptooltip-windows\"><a href=\"#winsetthumbnailtooltiptooltip-windows\"><code>win.setThumbnailToolTip(toolTip)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>toolTip</code> String</li>\n</ul>\n<p>Устанавливает всплывающую подсказку, которая будет отображена, при наведении мыши на панель миниатюры окна в панели задач.</p>\n<h4 id=\"winsetappdetailsoptions-windows\"><a href=\"#winsetappdetailsoptions-windows\"><code>win.setAppDetails(options)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>appId</code> String (опционально) - <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391569(v=vs.85).aspx\">App User Model ID</a> окна. Это должно быть установлено, иначе остальные параметры не будут иметь никакого эффекта.</li>\n<li><code>appIconPath</code> String (опционально) - <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391573(v=vs.85).aspx\">иконка перезапуска</a> окна.</li>\n<li><code>appIconIndex</code> Integer (optional) - Index of the icon in <code>appIconPath</code>. Ignored when <code>appIconPath</code> is not set. По умолчанию <code>0</code>.</li>\n<li><code>relaunchCommand</code> String (опционально) - <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391571(v=vs.85).aspx\">команда перезапуска</a> окна.</li>\n<li><code>relaunchDisplayName</code> String (опционально) - <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391572(v=vs.85).aspx\">отображаемое имя перезапуска</a> окна.</li>\n</ul></li>\n</ul>\n<p>Устанавливает свойства для кнопки окна на панели задач.</p>\n<p><strong>Note:</strong> <code>relaunchCommand</code> and <code>relaunchDisplayName</code> must always be set together. If one of those properties is not set, then neither will be used.</p>\n<h4 id=\"winshowdefinitionforselection-macos\"><a href=\"#winshowdefinitionforselection-macos\"><code>win.showDefinitionForSelection()</code> <em>macOS</em></a></h4>\n<p>Тоже, что и <code>webContents.showDefinitionForSelection()</code>.</p>\n<h4 id=\"winseticonicon-windows-linux\"><a href=\"#winseticonicon-windows-linux\"><code>win.setIcon(icon)</code> <em>Windows</em> <em>Linux</em></a></h4>\n<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String</li>\n</ul>\n<p>Меняет иконку окна.</p>\n<h4 id=\"winsetwindowbuttonvisibilityvisible-macos\"><a href=\"#winsetwindowbuttonvisibilityvisible-macos\"><code>win.setWindowButtonVisibility(visible)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n</ul>\n<p>Устанавливает, должны ли быть видны кнопки контроля окна.</p>\n<h4 id=\"winsetautohidemenubarhide\"><a href=\"#winsetautohidemenubarhide\"><code>win.setAutoHideMenuBar(hide)</code></a></h4>\n<ul>\n<li><code>hide</code> Boolean</li>\n</ul>\n<p>Sets whether the window menu bar should hide itself automatically. Once set the menu bar will only show when users press the single <code>Alt</code> key.</p>\n<p>If the menu bar is already visible, calling <code>setAutoHideMenuBar(true)</code> won't hide it immediately.</p>\n<h4 id=\"winismenubarautohide\"><a href=\"#winismenubarautohide\"><code>win.isMenuBarAutoHide()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether menu bar automatically hides itself.</p>\n<h4 id=\"winsetmenubarvisibilityvisible-windows-linux\"><a href=\"#winsetmenubarvisibilityvisible-windows-linux\"><code>win.setMenuBarVisibility(visible)</code> <em>Windows</em> <em>Linux</em></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n</ul>\n<p>Sets whether the menu bar should be visible. If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single <code>Alt</code> key.</p>\n<h4 id=\"winismenubarvisible\"><a href=\"#winismenubarvisible\"><code>win.isMenuBarVisible()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the menu bar is visible.</p>\n<h4 id=\"winsetvisibleonallworkspacesvisible-options\"><a href=\"#winsetvisibleonallworkspacesvisible-options\"><code>win.setVisibleOnAllWorkspaces(visible[, options])</code></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>visibleOnFullScreen</code> Boolean (optional) <em>macOS</em> - Sets whether the window should be visible above fullscreen windows.</li>\n<li><code>skipTransformProcessType</code> Boolean (optional) <em>macOS</em> - Calling setVisibleOnAllWorkspaces will by default transform the process type between UIElementApplication and ForegroundApplication to ensure the correct behavior. However, this will hide the window and dock for a short time every time it is called. If your window is already of type UIElementApplication, you can bypass this transformation by passing true to skipTransformProcessType.</li>\n</ul></li>\n</ul>\n<p>Устанавливает видимость окна на всех рабочих местах.</p>\n<p><strong>Примечание:</strong> Этот API ничего не делает в Windows.</p>\n<h4 id=\"winisvisibleonallworkspaces\"><a href=\"#winisvisibleonallworkspaces\"><code>win.isVisibleOnAllWorkspaces()</code></a></h4>\n<p>Возвращает <code>Boolean</code> - видно ли окно на всех рабочих местах.</p>\n<p><strong>Примечание:</strong> Данный API всегда возвращает false в Windows.</p>\n<h4 id=\"winsetignoremouseeventsignore-options\"><a href=\"#winsetignoremouseeventsignore-options\"><code>win.setIgnoreMouseEvents(ignore[, options])</code></a></h4>\n<ul>\n<li><code>ignore</code> Логическое значение</li>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>forward</code> Boolean (optional) <em>macOS</em> <em>Windows</em> - If true, forwards mouse move messages to Chromium, enabling mouse related events such as <code>mouseleave</code>. Only used when <code>ignore</code> is true. If <code>ignore</code> is false, forwarding is always disabled regardless of this value.</li>\n</ul></li>\n</ul>\n<p>Включает для окна игнорирование событий от мыши.</p>\n<p>Все события мыши, произошедшие в этом окне, будут переданы окну позади этого окна, но, если это окно сфокусировано, оно все еще будет получать события клавиатуры.</p>\n<h4 id=\"winsetcontentprotectionenable-macos-windows\"><a href=\"#winsetcontentprotectionenable-macos-windows\"><code>win.setContentProtection(enable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Предотвращает захват содержимого окна другими приложениями.</p>\n<p>On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows it calls SetWindowDisplayAffinity with <code>WDA_EXCLUDEFROMCAPTURE</code>. For Windows 10 version 2004 and up the window will be removed from capture entirely, older Windows versions behave as if <code>WDA_MONITOR</code> is applied capturing a black window.</p>\n<h4 id=\"winsetfocusablefocusable-macos-windows\"><a href=\"#winsetfocusablefocusable-macos-windows\"><code>win.setFocusable(focusable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>focusable</code> Boolean</li>\n</ul>\n<p>Меняет, может ли окно быть сфокусировано.</p>\n<p>На macOS он не снимает фокус с окна.</p>\n<h4 id=\"winisfocusable-macos-windows\"><a href=\"#winisfocusable-macos-windows\"><code>win.isFocusable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns whether the window can be focused.</p>\n<h4 id=\"winsetparentwindowparent\"><a href=\"#winsetparentwindowparent\"><code>win.setParentWindow(parent)</code></a></h4>\n<ul>\n<li><code>parent</code> BrowserWindow | null</li>\n</ul>\n<p>Устанавливает <code>parent</code> как родителя текущего окна, передав <code>null</code> превратит текущее окно в окно верхнего уровня.</p>\n<h4 id=\"wingetparentwindow\"><a href=\"#wingetparentwindow\"><code>win.getParentWindow()</code></a></h4>\n<p>Возвращает <code>BrowserWindow</code> - родительское окно.</p>\n<h4 id=\"wingetchildwindows\"><a href=\"#wingetchildwindows\"><code>win.getChildWindows()</code></a></h4>\n<p>Возвращает <code>BrowserWindow[]</code> - все дочерние окна.</p>\n<h4 id=\"winsetautohidecursorautohide-macos\"><a href=\"#winsetautohidecursorautohide-macos\"><code>win.setAutoHideCursor(autoHide)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>autoHide</code> Boolean</li>\n</ul>\n<p>Контролирует скрытие курсора при вводе текста.</p>\n<h4 id=\"winselectprevioustab-macos\"><a href=\"#winselectprevioustab-macos\"><code>win.selectPreviousTab()</code> <em>macOS</em></a></h4>\n<p>Выбирает предыдущую вкладку, когда нативные вкладки включены и в окне присутствуют другие вкладки.</p>\n<h4 id=\"winselectnexttab-macos\"><a href=\"#winselectnexttab-macos\"><code>win.selectNextTab()</code> <em>macOS</em></a></h4>\n<p>Выбирает следующую вкладку, когда нативные вкладки включены и в окне присутствуют другие вкладки.</p>\n<h4 id=\"winmergeallwindows-macos\"><a href=\"#winmergeallwindows-macos\"><code>win.mergeAllWindows()</code> <em>macOS</em></a></h4>\n<p>Объединяет все окна в одно окно с множественными вкладками, когда нативные вкладки включены и в присутствуют открытые окна больше, чем 1.</p>\n<h4 id=\"winmovetabtonewwindow-macos\"><a href=\"#winmovetabtonewwindow-macos\"><code>win.moveTabToNewWindow()</code> <em>macOS</em></a></h4>\n<p>Перемещает текущую вкладку в новое окно, если нативные вкладки включены и присутствует больше, чем одна вкладка, в текущем окне.</p>\n<h4 id=\"wintoggletabbar-macos\"><a href=\"#wintoggletabbar-macos\"><code>win.toggleTabBar()</code> <em>macOS</em></a></h4>\n<p>Переключает видимость вкладки, если включены нативные вкладки и присутствует только одна вкладка в текущем окне.</p>\n<h4 id=\"winaddtabbedwindowbrowserwindow-macos\"><a href=\"#winaddtabbedwindowbrowserwindow-macos\"><code>win.addTabbedWindow(browserWindow)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>browserWindow</code> BrowserWindow</li>\n</ul>\n<p>Добавляет окно, как вкладку, в это окно, после вкладки экземпляра окна.</p>\n<h4 id=\"winsetvibrancytype-macos\"><a href=\"#winsetvibrancytype-macos\"><code>win.setVibrancy(type)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>type</code> String | null - Может быть <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>titlebar</code>, <code>selection</code>, <code>menu</code>, <code>popover</code>, <code>sidebar</code>, <code>medium-light</code>, <code>ultra-dark</code>, <code>header</code>, <code>sheet</code>, <code>window</code>, <code>hud</code>, <code>fullscreen-ui</code>, <code>tooltip</code>, <code>content</code>, <code>under-window</code> и <code>under-page</code>. See the <a href=\"https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc\">macOS documentation</a> for more details.</li>\n</ul>\n<p>Adds a vibrancy effect to the browser window. Passing <code>null</code> or an empty string will remove the vibrancy effect on the window.</p>\n<p>Обратите внимание, что <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>medium-light</code> и <code>ultra-dark</code> устарела и будет удалена в следующей версии macOS.</p>\n<h4 id=\"winsettrafficlightpositionposition-macos\"><a href=\"#winsettrafficlightpositionposition-macos\"><code>win.setTrafficLightPosition(position)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Set a custom position for the traffic light buttons in frameless window.</p>\n<h4 id=\"wingettrafficlightposition-macos\"><a href=\"#wingettrafficlightposition-macos\"><code>win.getTrafficLightPosition()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Point</code> - The custom position for the traffic light buttons in frameless window.</p>\n<h4 id=\"winsettouchbartouchbar-macos\"><a href=\"#winsettouchbartouchbar-macos\"><code>win.setTouchBar(touchBar)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>touchBar</code> TouchBar | null</li>\n</ul>\n<p>Sets the touchBar layout for the current window. Specifying <code>null</code> or <code>undefined</code> clears the touch bar. This method only has an effect if the machine has a touch bar and is running on macOS 10.12.1+.</p>\n<p><strong>Примечание:</strong> TouchBar API в настоящее время является экспериментальным и может быть изменен или удален в будущих версиях Electron.</p>\n<h4 id=\"winsetbrowserviewbrowserview-экспериментально\"><a href=\"#winsetbrowserviewbrowserview-экспериментально\"><code>win.setBrowserView(browserView)</code> <em>Экспериментально</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a> | null - Attach <code>browserView</code> to <code>win</code>. If there are other <code>BrowserView</code>s attached, they will be removed from this window.</li>\n</ul>\n<h4 id=\"wingetbrowserview-экспериментально\"><a href=\"#wingetbrowserview-экспериментально\"><code>win.getBrowserView()</code> <em>Экспериментально</em></a></h4>\n<p>Returns <code>BrowserView | null</code> - The <code>BrowserView</code> attached to <code>win</code>. Returns <code>null</code> if one is not attached. Throws an error if multiple <code>BrowserView</code>s are attached.</p>\n<h4 id=\"winaddbrowserviewbrowserview-экспериментально\"><a href=\"#winaddbrowserviewbrowserview-экспериментально\"><code>win.addBrowserView(browserView)</code> <em>Экспериментально</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>Заменяет метод setBrowserView, для поддержки работы с множественными видами браузера.</p>\n<h4 id=\"winremovebrowserviewbrowserview-экспериментально\"><a href=\"#winremovebrowserviewbrowserview-экспериментально\"><code>win.removeBrowserView(browserView)</code> <em>Экспериментально</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<h4 id=\"winsettopbrowserviewbrowserview-экспериментально\"><a href=\"#winsettopbrowserviewbrowserview-экспериментально\"><code>win.setTopBrowserView(browserView)</code> <em>Экспериментально</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>Raises <code>browserView</code> above other <code>BrowserView</code>s attached to <code>win</code>. Throws an error if <code>browserView</code> is not attached to <code>win</code>.</p>\n<h4 id=\"wingetbrowserviews-экспериментально\"><a href=\"#wingetbrowserviews-экспериментально\"><code>win.getBrowserViews()</code> <em>Экспериментально</em></a></h4>\n<p>Возвращает <code>BrowserView[]</code> - массив всех BrowserViews которые были присоединены с <code>addBrowserView</code> или <code>setBrowserView</code>.</p>\n<p><strong>Примечание:</strong> BrowserView API в настоящее время экспериментально и может измениться или быть удалено в будущих релизах Electron.</p>",
      "title": "BrowserWindow",
      "description": "Создавайте окна браузера и управляйте ими."
    },
    "/docs/api/browser-window-proxy": {
      "locale": "ru-RU",
      "slug": "browser-window-proxy",
      "href": "/docs/api/browser-window-proxy",
      "crowdinFileId": "256285",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-window-proxy.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"класс-browserwindowproxy\"><a href=\"#класс-browserwindowproxy\">Класс: BrowserWindowProxy</a></h2>\n<blockquote>\n<p>Манипулируйте дочерним окном браузера</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Объект <code>BrowserWindowProxy</code> возвращается из <code>window.open</code> и предоставляет ограниченное управление дочерним окном.</p>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<p>Экземпляр объекта <code>BrowserWindowProxy</code> содержит следующие методы:</p>\n<h4 id=\"winblur\"><a href=\"#winblur\"><code>win.blur()</code></a></h4>\n<p>Убирает фокус с дочернего окна.</p>\n<h4 id=\"winclose\"><a href=\"#winclose\"><code>win.close()</code></a></h4>\n<p>Принудительно закрывает дочернее окно без вызова события выгрузки.</p>\n<h4 id=\"winevalcode\"><a href=\"#winevalcode\"><code>win.eval(code)</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n</ul>\n<p>Позволяет запускать код в дочернем окне.</p>\n<h4 id=\"winfocus\"><a href=\"#winfocus\"><code>win.focus()</code></a></h4>\n<p>Фокусируется на дочернем окне (переносит окно на передний план).</p>\n<h4 id=\"winprint\"><a href=\"#winprint\"><code>win.print()</code></a></h4>\n<p>Вызывает диалог print в рамках дочернего окна.</p>\n<h4 id=\"winpostmessagemessage-targetorigin\"><a href=\"#winpostmessagemessage-targetorigin\"><code>win.postMessage(message, targetOrigin)</code></a></h4>\n<ul>\n<li><code>message</code> any</li>\n<li><code>targetOrigin</code> String</li>\n</ul>\n<p>Отправляет сообщение дочернему окну с указанием родительского окна или <code>*</code> - без указания.</p>\n<p>Помимо этих методов, дочернее окно реализует объект <code>window.opener</code> без свойств и с одним методом.</p>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<p>Экземпляр объекта <code>BrowserWindowProxy</code> содержит следующие свойства:</p>\n<h4 id=\"winclosed\"><a href=\"#winclosed\"><code>win.closed</code></a></h4>\n<p><code>Boolean</code>, который устанавливается на true после закрытия дочернего окна.</p>",
      "title": "Класс: BrowserWindowProxy",
      "description": "Манипулируйте дочерним окном браузера"
    },
    "/docs/development/build-instructions-gn": {
      "locale": "ru-RU",
      "slug": "build-instructions-gn",
      "href": "/docs/development/build-instructions-gn",
      "crowdinFileId": "256131",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-gn.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"инструкции-по-сборке\"><a href=\"#инструкции-по-сборке\">Инструкции по сборке</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong>, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"системные-требования\"><a href=\"#системные-требования\">Системные требования</a></h2>\n<p>Перед началом проверьте требования сборки для вашей системы</p>\n<ul>\n<li><a href=\"/docs/development/build-instructions-macos#prerequisites\">macOS</a></li>\n<li><a href=\"/docs/development/build-instructions-linux#prerequisites\">Linux</a></li>\n<li><a href=\"/docs/development/build-instructions-windows#prerequisites\">Windows</a></li>\n</ul>\n<h2 id=\"build-tools\"><a href=\"#build-tools\">Build Tools</a></h2>\n<p><a href=\"https://github.com/electron/build-tools\">Electron's Build Tools</a> automate much of the setup for compiling Electron from source with different configurations and build targets. If you wish to set up the environment manually, the instructions are listed below.</p>\n<h2 id=\"требования-для-gn\"><a href=\"#требования-для-gn\">Требования для GN</a></h2>\n<p>Вам нужно будет установить <a href=\"https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up\"><code>depot_tools</code></a>, набор инструментов, используемый для извлечения Chromium и его зависимостей.</p>\n<p>Также, для Windows вам потребуется добавить переменную среды <code>DEPOT_TOOLS_WIN_TOOLCHAIN=0</code>. Чтобы это сделать, откройте <code>Панель управления</code> → <code>Система и безопасность</code> → <code>Система</code> → <code>Дополнительные параметры системы</code> и добавьте системную переменную <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> со значением <code>0</code>.  Она говорит <code>depot_tools</code> использовать вашу локальную версию Visual Studio (по умолчанию, <code>depot_tools</code> попробует загрузить приватную Google версию к которой имеют доступ только Гугловцы).</p>\n<h3 id=\"setting-up-the-git-cache\"><a href=\"#setting-up-the-git-cache\">Setting up the git cache</a></h3>\n<p>If you plan on checking out Electron more than once (for example, to have multiple parallel directories checked out to different branches), using the git cache will speed up subsequent calls to <code>gclient</code>. To do this, set a <code>GIT_CACHE_PATH</code> environment variable:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">export</span> GIT_CACHE_PATH=<span class=\"hljs-string\">\"<span class=\"hljs-variable\">${HOME}</span>/.git_cache\"</span>\n$ mkdir -p <span class=\"hljs-string\">\"<span class=\"hljs-variable\">${GIT_CACHE_PATH}</span>\"</span>\n<span class=\"hljs-comment\"># Это будет использовать примерно 16 гигабайт.</span>\n</code></pre>\n<h2 id=\"получение-кода\"><a href=\"#получение-кода\">Получение кода</a></h2>\n<pre><code class=\"hljs language-sh\">$ mkdir electron &#x26;&#x26; <span class=\"hljs-built_in\">cd</span> electron\n$ gclient config --name <span class=\"hljs-string\">\"src/electron\"</span> --unmanaged https://github.com/electron/electron\n$ gclient sync --with_branch_heads --with_tags\n<span class=\"hljs-comment\"># This will take a while, go get a coffee.</span>\n</code></pre>\n<blockquote>\n<p>Вместо <code>https://github.com/electron/electron</code>, вы можете использовать здесь свой собственный форк (что-то вроде <code>https://github.com/&#x3C;username>/electron</code>).</p>\n</blockquote>\n<h3 id=\"a-note-on-pullingpushing\"><a href=\"#a-note-on-pullingpushing\">A note on pulling/pushing</a></h3>\n<p>If you intend to <code>git pull</code> or <code>git push</code> from the official <code>electron</code> repository in the future, you now need to update the respective folder's origin URLs.</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src/electron\n$ git remote remove origin\n$ git remote add origin https://github.com/electron/electron\n$ git checkout main\n$ git branch --<span class=\"hljs-built_in\">set</span>-upstream-to=origin/main\n$ <span class=\"hljs-built_in\">cd</span> -\n</code></pre>\n<p>📝 <code>gclient</code> works by checking a file called <code>DEPS</code> inside the <code>src/electron</code> folder for dependencies (like Chromium or Node.js). Running <code>gclient sync -f</code> ensures that all dependencies required to build Electron match that file.</p>\n<p>So, in order to pull, you'd run the following commands:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src/electron\n$ git pull\n$ gclient sync -f\n</code></pre>\n<h2 id=\"сборка\"><a href=\"#сборка\">Сборка</a></h2>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src\n$ <span class=\"hljs-built_in\">export</span> CHROMIUM_BUILDTOOLS_PATH=`<span class=\"hljs-built_in\">pwd</span>`/buildtools\n$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p>Или на Windows (без дополнительных аргументов):</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src\n$ <span class=\"hljs-built_in\">set</span> CHROMIUM_BUILDTOOLS_PATH=%<span class=\"hljs-built_in\">cd</span>%\\buildtools\n$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\")\"</span>\n</code></pre>\n<p>This will generate a build directory <code>out/Testing</code> under <code>src/</code> with the testing build configuration. You can replace <code>Testing</code> with another name, but it should be a subdirectory of <code>out</code>. Also you shouldn't have to run <code>gn gen</code> again—if you want to change the build arguments, you can run <code>gn args out/Testing</code> to bring up an editor.</p>\n<p>To see the list of available build configuration options, run <code>gn args out/Testing --list</code>.</p>\n<p><strong>Для генерации тестовой сборки Electron:</strong></p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p><strong>For generating Release (aka \"non-component\" or \"static\") build config of Electron:</strong></p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Release --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/release.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p><strong>Чтобы построить, запустите <code>ninja</code> с целью <code>electron</code>:</strong> Nota Bene: Это займет некоторое время и, вероятно, нагревает ваш ноутбук.</p>\n<p>Для конфигурации тестирования:</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Testing electron\n</code></pre>\n<p>Для конфигурации релиза:</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Release electron\n</code></pre>\n<p>This will build all of what was previously 'libchromiumcontent' (i.e. the <code>content/</code> directory of <code>chromium</code> and its dependencies, incl. WebKit and V8), so it will take a while.</p>\n<p>Собранный исполняемый файл будет находиться в <code>./out/Testing</code>:</p>\n<pre><code class=\"hljs language-sh\">$ ./out/Testing/Electron.app/Contents/MacOS/Electron\n<span class=\"hljs-comment\"># или, на Windows</span>\n$ ./out/Testing/electron.exe\n<span class=\"hljs-comment\"># или, на Linux</span>\n$ ./out/Testing/electron\n</code></pre>\n<h3 id=\"упаковка\"><a href=\"#упаковка\">Упаковка</a></h3>\n<p>On linux, first strip the debugging and symbol information:</p>\n<pre><code class=\"hljs language-sh\">electron/script/strip-binaries.py -d out/Release\n</code></pre>\n<p>To package the electron build as a distributable zip file:</p>\n<pre><code class=\"hljs language-sh\">ninja -C out/Release electron:electron_dist_zip\n</code></pre>\n<h3 id=\"кросс-компиляция\"><a href=\"#кросс-компиляция\">Кросс-компиляция</a></h3>\n<p>To compile for a platform that isn't the same as the one you're building on, set the <code>target_cpu</code> and <code>target_os</code> GN arguments. For example, to compile an x86 target from an x64 host, specify <code>target_cpu = \"x86\"</code> in <code>gn args</code>.</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing-x86 --args=<span class=\"hljs-string\">'... target_cpu = \"x86\"'</span>\n</code></pre>\n<p>Not all combinations of source and target CPU/OS are supported by Chromium.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Host</th><th>Target</th><th>Состояние</th></tr></thead><tbody><tr><td>Windows x64</td><td>Windows arm64</td><td>Experimental</td></tr><tr><td>Windows x64</td><td>Windows x86</td><td>Автоматически тестировано</td></tr><tr><td>Linux x64</td><td>Linux x86</td><td>Автоматически тестировано</td></tr></tbody></table>\n<p>If you test other combinations and find them to work, please update this document :)</p>\n<p>See the GN reference for allowable values of <a href=\"https://gn.googlesource.com/gn/+/master/docs/reference.md#built_in-predefined-variables-target_os_the-desired-operating-system-for-the-build-possible-values\"><code>target_os</code></a> and <a href=\"https://gn.googlesource.com/gn/+/master/docs/reference.md#built_in-predefined-variables-target_cpu_the-desired-cpu-architecture-for-the-build-possible-values\"><code>target_cpu</code></a>.</p>\n<h4 id=\"windows-на-arm-экспериментально\"><a href=\"#windows-на-arm-экспериментально\">Windows на Arm (экспериментально)</a></h4>\n<p>To cross-compile for Windows on Arm, <a href=\"https://chromium.googlesource.com/chromium/src/+/refs/heads/master/docs/windows_build_instructions.md#Visual-Studio\">follow Chromium's guide</a> to get the necessary dependencies, SDK and libraries, then build with <code>ELECTRON_BUILDING_WOA=1</code> in your environment before running <code>gclient sync</code>.</p>\n<pre><code class=\"hljs language-bat\"><span class=\"hljs-built_in\">set</span> ELECTRON_BUILDING_WOA=<span class=\"hljs-number\">1</span>\ngclient sync -f --with_branch_heads --with_tags\n</code></pre>\n<p>Или (если используется PowerShell):</p>\n<pre><code class=\"hljs language-powershell\"><span class=\"hljs-variable\">$env:ELECTRON_BUILDING_WOA</span>=<span class=\"hljs-number\">1</span>\ngclient sync -f --with_branch_heads --with_tags\n</code></pre>\n<p>Далее, запустите <code>gn gen</code>, как указано выше, с <code>target_cpu=\"arm64\"</code>.</p>\n<h2 id=\"тестирование\"><a href=\"#тестирование\">Тестирование</a></h2>\n<p>To run the tests, you'll first need to build the test modules against the same version of Node.js that was built as part of the build process. To generate build headers for the modules to compile against, run the following under <code>src/</code> directory.</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Testing third_party/electron_node:headers\n</code></pre>\n<p>Теперь вы можете <a href=\"/docs/development/testing#unit-tests\">запустить тесты</a>.</p>\n<p>Если вы что-то отлаживаете, то вам может быть полезно передать некоторые дополнительные флаги в бинарный Electron:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span> -- \\\n  --<span class=\"hljs-built_in\">enable</span>-logging -g <span class=\"hljs-string\">'BrowserWindow module'</span>\n</code></pre>\n<h2 id=\"sharing-the-git-cache-between-multiple-machines\"><a href=\"#sharing-the-git-cache-between-multiple-machines\">Sharing the git cache between multiple machines</a></h2>\n<p>It is possible to share the gclient git cache with other machines by exporting it as SMB share on linux, but only one process/machine can be using the cache at a time. Блокировки, установленные скриптом git-cache попытаются предотвратить это, однако возможна нестабильная работа по сети.</p>\n<p>На Windows, у SMBv2 есть кэш директорий, который будет создавать проблемы со скриптом git-cache, поэтому необходимо отключить его, установив ключ регистра</p>\n<pre><code class=\"hljs language-sh\">HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\Lanmanworkstation\\Parameters\\DirectoryCacheLifetime\n</code></pre>\n<p>на 0. Подробнее: <a href=\"https://stackoverflow.com/a/9935126\">https://stackoverflow.com/a/9935126</a></p>\n<p>Это можно быстро установить в powershell (запускается от имени администратора):</p>\n<pre><code class=\"hljs language-powershell\"><span class=\"hljs-built_in\">New-ItemProperty</span> -Path <span class=\"hljs-string\">\"HKLM:\\System\\CurrentControlSet\\Services\\Lanmanworkstation\\Parameters\"</span> -Name DirectoryCacheLifetime -Value <span class=\"hljs-number\">0</span> -PropertyType DWORD -Force\n</code></pre>\n<h2 id=\"устранение-проблем\"><a href=\"#устранение-проблем\">Устранение проблем</a></h2>\n<h3 id=\"gclient-sync-complains-about-rebase\"><a href=\"#gclient-sync-complains-about-rebase\">gclient sync complains about rebase</a></h3>\n<p>If <code>gclient sync</code> is interrupted the git tree may be left in a bad state, leading to a cryptic message when running <code>gclient sync</code> in the future:</p>\n<pre><code class=\"hljs language-plaintext\">2> Conflict while rebasing this branch.\n2> Fix the conflict and run gclient again.\n2> See man git-rebase for details.\n</code></pre>\n<p>If there are no git conflicts or rebases in <code>src/electron</code>, you may need to abort a <code>git am</code> in <code>src</code>:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> ../\n$ git am --abort\n$ <span class=\"hljs-built_in\">cd</span> electron\n$ gclient sync -f\n</code></pre>\n<h3 id=\"im-being-asked-for-a-usernamepassword-for-chromium-internalgooglesourcecom\"><a href=\"#im-being-asked-for-a-usernamepassword-for-chromium-internalgooglesourcecom\">I'm being asked for a username/password for chromium-internal.googlesource.com</a></h3>\n<p>Если вы видите запрос для <code>Имя пользователя для 'https://chrome-internal.googlesource.com':</code> при запуске <code>gclient sync</code> на Windows, это возможно, потому что <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> переменная окружения не установлена в 0. Откройте <code>Панель управления</code> → <code>Система и безопасность</code> → <code>Система</code> → <code>Дополнительные параметры системы</code> и добавьте системную переменную <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> с значением <code>0</code>.  Она говорит <code>depot_tools</code> использовать вашу локальную версию Visual Studio (по умолчанию, <code>depot_tools</code> попробует загрузить приватную Google версию к которой имеют доступ только Гугловцы).</p>",
      "title": "Инструкции по сборке",
      "description": "Вместо https://github.com/electron/electron, вы можете использовать здесь свой собственный форк (что-то вроде https://github.com/<username>/electron)."
    },
    "/docs/development/build-instructions-linux": {
      "locale": "ru-RU",
      "slug": "build-instructions-linux",
      "href": "/docs/development/build-instructions-linux",
      "crowdinFileId": "256133",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-linux.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"инструкции-по-сборке-linux\"><a href=\"#инструкции-по-сборке-linux\">Инструкции по сборке (Linux)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on Linux, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>\n<p>At least 25GB disk space and 8GB RAM.</p>\n</li>\n<li>\n<p>Python 2.7.x. Some distributions like CentOS 6.x still use Python 2.6.x so you may need to check your Python version with <code>python -V</code>.</p>\n<p>Please also ensure that your system and Python version support at least TLS 1.2. For a quick test, run the following script:</p>\n<pre><code class=\"hljs language-sh\">$ npx @electron/check-python-tls\n</code></pre>\n<p>If the script returns that your configuration is using an outdated security protocol, use your system's package manager to update Python to the latest version in the 2.7.x branch. Alternatively, visit <a href=\"https://www.python.org/downloads/\">https://www.python.org/downloads/</a> for detailed instructions.</p>\n</li>\n<li>\n<p>Node.js. There are various ways to install Node. You can download source code from <a href=\"https://nodejs.org\">nodejs.org</a> and compile it. Doing so permits installing Node on your own home directory as a standard user. Or try repositories such as <a href=\"https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories\">NodeSource</a>.</p>\n</li>\n<li>\n<p><a href=\"https://clang.llvm.org/get_started.html\">clang</a> 3.4 or later.</p>\n</li>\n<li>\n<p>Development headers of GTK 3 and libnotify.</p>\n</li>\n</ul>\n<p>On Ubuntu, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install build-essential clang libdbus-1-dev libgtk-3-dev \\\n                       libnotify-dev libgnome-keyring-dev \\\n                       libasound2-dev libcap-dev libcups2-dev libxtst-dev \\\n                       libxss1 libnss3-dev gcc-multilib g++-multilib curl \\\n                       gperf bison python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On RHEL / CentOS, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo yum install clang dbus-devel gtk3-devel libnotify-devel \\\n                   libgnome-keyring-devel xorg-x11-server-utils libcap-devel \\\n                   cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \\\n                   nss-devel python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On Fedora, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo dnf install clang dbus-devel gtk3-devel libnotify-devel \\\n                   libgnome-keyring-devel xorg-x11-server-utils libcap-devel \\\n                   cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \\\n                   nss-devel python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On Arch Linux / Manjaro, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo pacman -Syu base-devel clang libdbus gtk2 libnotify \\\n                   libgnome-keyring alsa-lib libcap libcups libxtst \\\n                   libxss nss gcc-multilib curl gperf bison \\\n                   python2 python-dbusmock jdk8-openjdk\n</code></pre>\n<p>Other distributions may offer similar packages for installation via package managers such as pacman. Or one can compile from source code.</p>\n<h3 id=\"cross-compilation\"><a href=\"#cross-compilation\">Cross compilation</a></h3>\n<p>If you want to build for an <code>arm</code> target you should also install the following dependencies:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install libc6-dev-armhf-cross linux-libc-dev-armhf-cross \\\n                       g++-arm-linux-gnueabihf\n</code></pre>\n<p>Similarly for <code>arm64</code>, install the following:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install libc6-dev-arm64-cross linux-libc-dev-arm64-cross \\\n                       g++-aarch64-linux-gnu\n</code></pre>\n<p>And to cross-compile for <code>arm</code> or <code>ia32</code> targets, you should pass the <code>target_cpu</code> parameter to <code>gn gen</code>:</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">'import(...) target_cpu=\"arm\"'</span>\n</code></pre>\n<h2 id=\"сборка\"><a href=\"#сборка\">Сборка</a></h2>\n<p>See <a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a></p>\n<h2 id=\"устранение-проблем\"><a href=\"#устранение-проблем\">Устранение проблем</a></h2>\n<h3 id=\"error-while-loading-shared-libraries-libtinfoso5\"><a href=\"#error-while-loading-shared-libraries-libtinfoso5\">Error While Loading Shared Libraries: libtinfo.so.5</a></h3>\n<p>Prebuilt <code>clang</code> will try to link to <code>libtinfo.so.5</code>. Depending on the host architecture, symlink to appropriate <code>libncurses</code>:</p>\n<pre><code class=\"hljs language-sh\">$ sudo ln -s /usr/lib/libncurses.so.5 /usr/lib/libtinfo.so.5\n</code></pre>\n<h2 id=\"advanced-topics\"><a href=\"#advanced-topics\">Advanced topics</a></h2>\n<p>The default building configuration is targeted for major desktop Linux distributions. To build for a specific distribution or device, the following information may help you.</p>\n<h3 id=\"using-system-clang-instead-of-downloaded-clang-binaries\"><a href=\"#using-system-clang-instead-of-downloaded-clang-binaries\">Using system <code>clang</code> instead of downloaded <code>clang</code> binaries</a></h3>\n<p>By default Electron is built with prebuilt <a href=\"https://clang.llvm.org/get_started.html\"><code>clang</code></a> binaries provided by the Chromium project. If for some reason you want to build with the <code>clang</code> installed in your system, you can specify the <code>clang_base_path</code> argument in the GN args.</p>\n<p>For example if you installed <code>clang</code> under <code>/usr/local/bin/clang</code>:</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">'import(\"//electron/build/args/testing.gn\") clang_base_path = \"/usr/local/bin\"'</span>\n</code></pre>\n<h3 id=\"using-compilers-other-than-clang\"><a href=\"#using-compilers-other-than-clang\">Using compilers other than <code>clang</code></a></h3>\n<p>Building Electron with compilers other than <code>clang</code> is not supported.</p>",
      "title": "Инструкции по сборке (Linux)",
      "description": ""
    },
    "/docs/development/build-instructions-macos": {
      "locale": "ru-RU",
      "slug": "build-instructions-macos",
      "href": "/docs/development/build-instructions-macos",
      "crowdinFileId": "256135",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-macos.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"инструкции-по-сборке-macos\"><a href=\"#инструкции-по-сборке-macos\">Инструкции по сборке (macOS)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on macOS, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>macOS >= 10.11.6</li>\n<li><a href=\"https://developer.apple.com/technologies/tools/\">Xcode</a> >= 9.0.0</li>\n<li><a href=\"https://nodejs.org\">node.js</a> (внешнее)</li>\n<li>Python 2.7 с поддержкой TLS 1.2</li>\n</ul>\n<h2 id=\"python\"><a href=\"#python\">Python</a></h2>\n<p>Please also ensure that your system and Python version support at least TLS 1.2. This depends on both your version of macOS and Python. For a quick test, run:</p>\n<pre><code class=\"hljs language-sh\">$ npx @electron/check-python-tls\n</code></pre>\n<p>If the script returns that your configuration is using an outdated security protocol, you can either update macOS to High Sierra or install a new version of Python 2.7.x. To upgrade Python, use <a href=\"https://brew.sh/\">Homebrew</a>:</p>\n<pre><code class=\"hljs language-sh\">$ brew install python@2 &#x26;&#x26; brew link python@2 --force\n</code></pre>\n<p>Если вы используете Python предоставленный Homebrew, вам также необходимо установить следующие модули Python:</p>\n<ul>\n<li><a href=\"https://pypi.org/project/pyobjc/#description\">pyobjc</a></li>\n</ul>\n<p>Вы можете использовать <code>pip</code> для установки:</p>\n<pre><code class=\"hljs language-sh\">$ pip установить pyobjc\n</code></pre>\n<h2 id=\"macos-sdk\"><a href=\"#macos-sdk\">macOS SDK</a></h2>\n<p>If you're developing Electron and don't plan to redistribute your custom Electron build, you may skip this section.</p>\n<p>Official Electron builds are built with <a href=\"https://download.developer.apple.com/Developer_Tools/Xcode_12.2/Xcode_12.2.xip\">Xcode 12.2</a>, and the macOS 11.0 SDK. Building with a newer SDK works too, but the releases currently use the 11.0 SDK.</p>\n<h2 id=\"собираем-electron\"><a href=\"#собираем-electron\">Собираем Electron</a></h2>\n<p>See <a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a>.</p>",
      "title": "Инструкции по сборке (macOS)",
      "description": ""
    },
    "/docs/development/build-instructions-windows": {
      "locale": "ru-RU",
      "slug": "build-instructions-windows",
      "href": "/docs/development/build-instructions-windows",
      "crowdinFileId": "256137",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-windows.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"инструкции-по-сборке-windows\"><a href=\"#инструкции-по-сборке-windows\">Инструкции по сборке (Windows)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on Windows, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>Windows 10 / Server 2012 R2 или выше</li>\n<li>Visual Studio 2017 15.7.2 or higher - <a href=\"https://www.visualstudio.com/vs/\">download VS 2019 Community Edition for free</a><ul>\n<li>Смотрите <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md#visual-studio\">документацию по сборке Chromium</a> для получения более подробной информации о том, какие компоненты Visual Studio необходимы.</li>\n<li>Если ваша Visual Studio установлена в каталог, отличающийся от стандартного, вам нужно установить несколько переменных среды, чтобы указать инструментам на путь установки.<ul>\n<li><code>vs2019_install = DRIVE:\\path\\to\\Microsoft Visual Studio\\2019\\Community</code>, replacing <code>2019</code> and <code>Community</code> with your installed versions and replacing <code>DRIVE:</code> with the drive that Visual Studio is on. Обычно, это <code>C:</code>.</li>\n<li><code>WINDOWSSDKDIR = DRIVE:\\path\\to\\Windows Kits\\10</code>, replacing <code>DRIVE:</code> with the drive that Windows Kits is on. Обычно, это <code>C:</code>.</li>\n</ul></li>\n<li><a href=\"https://pypi.org/project/pywin32/#files\">Дополнения Python для Windows (pywin32)</a> также нужны для запуска процесса сборки.</li>\n</ul></li>\n<li><a href=\"https://nodejs.org/download/\">Node.js</a></li>\n<li><a href=\"https://git-scm.com\">Git</a></li>\n<li>Debugging Tools for Windows of Windows SDK 10.0.15063.468 if you plan on creating a full distribution since <code>symstore.exe</code> is used for creating a symbol store from <code>.pdb</code> files.<ul>\n<li>Различные версии SDK могут быть установлены бок о бок. To install the SDK, open Visual Studio Installer, select <code>Modify</code> → <code>Individual Components</code>, scroll down and select the appropriate Windows SDK to install. Another option would be to look at the <a href=\"https://developer.microsoft.com/en-us/windows/downloads/sdk-archive\">Windows SDK and emulator archive</a> and download the standalone version of the SDK respectively.</li>\n<li>Также необходимо установить инструменты отладки SDK. If the Windows 10 SDK was installed via the Visual Studio installer, then they can be installed by going to: <code>Control Panel</code> → <code>Programs</code> → <code>Programs and Features</code> → Select the \"Windows Software Development Kit\" → <code>Change</code> → <code>Change</code> → Check \"Debugging Tools For Windows\" → <code>Change</code>. Or, you can download the standalone SDK installer and use it to install the Debugging Tools.</li>\n</ul></li>\n</ul>\n<p>Если у вас нет установщика Windows, то <a href=\"https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/\">dev.microsoftedge.com</a> имеет версии Windows, которые вы можете использовать для сборки Electron.</p>\n<p>Сборка Electron осуществляется исключительно через скрипты командной строки, и не может быть осуществлена в Visual Studio. Вы можете разрабатывать Electron в любом редакторе, но в будущем будет поддержка сборки в Visual Studio.</p>\n<p><strong>Примечание:</strong> Даже если Visual Studio не используется для сборки, он всё ещё <strong>требуется</strong>, потому что нам нужны средства сборки, которые он предоставляет.</p>\n<h2 id=\"exclude-source-tree-from-windows-security\"><a href=\"#exclude-source-tree-from-windows-security\">Exclude source tree from Windows Security</a></h2>\n<p>Windows Security doesn't like one of the files in the Chromium source code (see <a href=\"https://crbug.com/441184\">https://crbug.com/441184</a>), so it will constantly delete it, causing <code>gclient sync</code> issues. You can exclude the source tree from being monitored by Windows Security by <a href=\"https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26\">following these instructions</a>.</p>\n<h2 id=\"сборка\"><a href=\"#сборка\">Сборка</a></h2>\n<p>See <a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a></p>\n<h2 id=\"32-битная-сборка\"><a href=\"#32-битная-сборка\">32-битная сборка</a></h2>\n<p>To build for the 32bit target, you need to pass <code>target_cpu = \"x86\"</code> as a GN arg. You can build the 32bit target alongside the 64bit target by using a different output directory for GN, e.g. <code>out/Release-x86</code>, with different arguments.</p>\n<pre><code class=\"hljs language-powershell\">$ gn gen out/Release-x86 --args=<span class=\"hljs-string\">\"import(\\\"</span>//electron/build/args/release.gn\\<span class=\"hljs-string\">\") target_cpu=\\\"</span>x86\\<span class=\"hljs-string\">\"\"</span>\n</code></pre>\n<p>Все остальные инструкции по сборке идентичны.</p>\n<h2 id=\"проект-visual-studio\"><a href=\"#проект-visual-studio\">Проект Visual Studio</a></h2>\n<p>Для генерации проекта в Visual Studio, вы можете передать параметр <code>--ide=vs2017</code> в <code>gn gen</code>:</p>\n<pre><code class=\"hljs language-powershell\">$ gn gen out/Testing --ide=vs2017\n</code></pre>\n<h2 id=\"устранение-проблем\"><a href=\"#устранение-проблем\">Устранение проблем</a></h2>\n<h3 id=\"команда-xxxx-не-найдена\"><a href=\"#команда-xxxx-не-найдена\">Команда xxxx не найдена</a></h3>\n<p>Если вы столкнулись с ошибкой по типу <code>Команда xxxx не найдена</code>, вы можете попробовать использовать <code>VS2015 Command Prompt</code> консоль для выполнения скриптов сборки.</p>\n<h3 id=\"fatal-internal-compiler-error-c1001\"><a href=\"#fatal-internal-compiler-error-c1001\">Fatal internal compiler error: C1001</a></h3>\n<p>Убедитесь, что у вас установлена последняя версия Visual Studio.</p>\n<h3 id=\"lnk1181-cannot-open-input-file-kernel32lib\"><a href=\"#lnk1181-cannot-open-input-file-kernel32lib\">LNK1181: cannot open input file 'kernel32.lib'</a></h3>\n<p>Попробуйте переустановить 32-х битный Node.js.</p>\n<h3 id=\"error-enoent-stat-cusersusernameappdataroamingnpm\"><a href=\"#error-enoent-stat-cusersusernameappdataroamingnpm\">Error: ENOENT, stat 'C:\\Users\\USERNAME\\AppData\\Roaming\\npm'</a></h3>\n<p>Создание директории по данному пути <a href=\"https://stackoverflow.com/a/25095327/102704\">должно исправить проблему</a>:</p>\n<pre><code class=\"hljs language-powershell\">$ mkdir ~\\AppData\\Roaming\\npm\n</code></pre>\n<h3 id=\"node-gyp-is-not-recognized-as-an-internal-or-external-command\"><a href=\"#node-gyp-is-not-recognized-as-an-internal-or-external-command\">node-gyp is not recognized as an internal or external command</a></h3>\n<p>Вы можете столкнуться с этой ошибкой, если вы используете Git Bash для сборки, вместо этого, вы должны использовать PowerShell или командную строку Visual Code.</p>\n<h3 id=\"cannot-create-directory-at--filename-too-long\"><a href=\"#cannot-create-directory-at--filename-too-long\">cannot create directory at '...': Filename too long</a></h3>\n<p>node.js имеет несколько <a href=\"https://github.com/electron/node/tree/electron/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/read-pkg-up/node_modules/read-pkg/node_modules/load-json-file/node_modules/parse-json/node_modules/error-ex/node_modules/is-arrayish\">слишком длинных путей</a>, и по стандарту, git на windows не обрабатывает длинные пути корректно (даже если windows их поддерживает). Это должно помочь:</p>\n<pre><code class=\"hljs language-sh\">$ git config --system core.longpaths <span class=\"hljs-literal\">true</span>\n</code></pre>\n<h3 id=\"error-use-of-undeclared-identifier-defaultdelegatecheckmode\"><a href=\"#error-use-of-undeclared-identifier-defaultdelegatecheckmode\">error: use of undeclared identifier 'DefaultDelegateCheckMode'</a></h3>\n<p>This can happen during build, when Debugging Tools for Windows has been installed with Windows Driver Kit. Uninstall Windows Driver Kit and install Debugging Tools with steps described above.</p>\n<h3 id=\"importerror-no-module-named-win32file\"><a href=\"#importerror-no-module-named-win32file\">ImportError: No module named win32file</a></h3>\n<p>Убедитесь, что вы установили <code>pywin32</code> при помощи <code>pip install pywin32</code>.</p>\n<h3 id=\"строить-сценарии-повесить-до-keypress\"><a href=\"#строить-сценарии-повесить-до-keypress\">Строить сценарии повесить до Keypress</a></h3>\n<p>Эта ошибка является \"функцией\" командной строки Windows. It happens when clicking inside the prompt window with <code>QuickEdit</code> enabled and is intended to allow selecting and copying output text easily. Puisque chaque clic accidentel met en pause le processus de construction, vous pouvez désactiver cette fonctionnalité dans les propriétés de l'invite de commande.</p>",
      "title": "Инструкции по сборке (Windows)",
      "description": ""
    },
    "/docs/development/build-system-overview": {
      "locale": "ru-RU",
      "slug": "build-system-overview",
      "href": "/docs/development/build-system-overview",
      "crowdinFileId": "256139",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-system-overview.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"обзор-системы-сборки\"><a href=\"#обзор-системы-сборки\">Обзор системы сборки</a></h1>\n<p>Electron uses <a href=\"https://gn.googlesource.com/gn\">GN</a> for project generation and <a href=\"https://ninja-build.org/\">ninja</a> for building. Project configurations can be found in the <code>.gn</code> and <code>.gni</code> files.</p>\n<h2 id=\"gn-files\"><a href=\"#gn-files\">GN Files</a></h2>\n<p>The following <code>gn</code> files contain the main rules for building Electron:</p>\n<ul>\n<li><code>BUILD.gn</code> defines how Electron itself is built and includes the default configurations for linking with Chromium.</li>\n<li><code>build/args/{debug,release,all}.gn</code> contain the default build arguments for building Electron.</li>\n</ul>\n<h2 id=\"component-build\"><a href=\"#component-build\">Component Build</a></h2>\n<p>Since Chromium is quite a large project, the final linking stage can take quite a few minutes, which makes it hard for development. In order to solve this, Chromium introduced the \"component build\", which builds each component as a separate shared library, making linking very quick but sacrificing file size and performance.</p>\n<p>Electron inherits this build option from Chromium. In <code>Debug</code> builds, the binary will be linked to a shared library version of Chromium's components to achieve fast linking time; for <code>Release</code> builds, the binary will be linked to the static library versions, so we can have the best possible binary size and performance.</p>\n<h2 id=\"тестирование\"><a href=\"#тестирование\">Тестирование</a></h2>\n<p><strong>NB</strong> <em>this section is out of date and contains information that is no longer relevant to the GN-built electron.</em></p>\n<p>Test your changes conform to the project coding style using:</p>\n<pre><code class=\"hljs language-sh\">$ npm run lint\n</code></pre>\n<p>Test functionality using:</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>Whenever you make changes to Electron source code, you'll need to re-run the build before the tests:</p>\n<pre><code class=\"hljs language-sh\">$ npm run build &#x26;&#x26; npm <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>You can make the test suite run faster by isolating the specific test or block you're currently working on using Mocha's <a href=\"https://mochajs.org/#exclusive-tests\">exclusive tests</a> feature. Append <code>.only</code> to any <code>describe</code> or <code>it</code> function call:</p>\n<pre><code class=\"hljs language-js\">describe.only(<span class=\"hljs-string\">'some feature'</span>, () => {\n  <span class=\"hljs-comment\">// ... только в этом блоке будут выполняться тесты</span>\n})\n</code></pre>\n<p>Alternatively, you can use mocha's <code>grep</code> option to only run tests matching the given regular expression pattern:</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span> -- --grep child_process\n</code></pre>\n<p>Tests that include native modules (e.g. <code>runas</code>) can't be executed with the debug build (see <a href=\"https://github.com/electron/electron/issues/2558\">#2558</a> for details), but they will work with the release build.</p>\n<p>To run the tests with the release build use:</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span> -- -R\n</code></pre>",
      "title": "Обзор системы сборки",
      "description": ""
    },
    "/docs/api/structures/certificate": {
      "locale": "ru-RU",
      "slug": "certificate",
      "href": "/docs/api/structures/certificate",
      "crowdinFileId": "256415",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/certificate.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"certificate-object\"><a href=\"#certificate-object\">Certificate Object</a></h1>\n<ul>\n<li><code>data</code> String - PEM encoded data</li>\n<li><code>issuer</code> <a href=\"/docs/api/structures/certificate-principal\">CertificatePrincipal</a> - Issuer principal</li>\n<li><code>issuerName</code> String - Issuer's Common Name</li>\n<li><code>issuerCert</code> Certificate - Issuer certificate (if not self-signed)</li>\n<li><code>subject</code> <a href=\"/docs/api/structures/certificate-principal\">CertificatePrincipal</a> - Subject principal</li>\n<li><code>subjectName</code> String - Subject's Common Name</li>\n<li><code>serialNumber</code> String - Hex value represented string</li>\n<li><code>validStart</code> Number - Start date of the certificate being valid in seconds</li>\n<li><code>validExpiry</code> Number - End date of the certificate being valid in seconds</li>\n<li><code>fingerprint</code> String - Fingerprint of the certificate</li>\n</ul>",
      "title": "Certificate Object",
      "description": ""
    },
    "/docs/api/structures/certificate-principal": {
      "locale": "ru-RU",
      "slug": "certificate-principal",
      "href": "/docs/api/structures/certificate-principal",
      "crowdinFileId": "256413",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/certificate-principal.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"certificateprincipal-object\"><a href=\"#certificateprincipal-object\">CertificatePrincipal Object</a></h1>\n<ul>\n<li><code>commonName</code> String - Common Name.</li>\n<li><code>organizations</code> String[] - Organization names.</li>\n<li><code>organizationUnits</code> String[] - Organization Unit names.</li>\n<li><code>locality</code> String - Locality.</li>\n<li><code>state</code> String - State or province.</li>\n<li><code>country</code> String - Country or region.</li>\n</ul>",
      "title": "CertificatePrincipal Object",
      "description": ""
    },
    "/docs/development/chromium-development": {
      "locale": "ru-RU",
      "slug": "chromium-development",
      "href": "/docs/development/chromium-development",
      "crowdinFileId": "256141",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/chromium-development.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"разработка-chromium\"><a href=\"#разработка-chromium\">Разработка Chromium</a></h1>\n<blockquote>\n<p>Список ресурсов для изучения Chromium и отслеживания его разработки</p>\n</blockquote>\n<ul>\n<li><a href=\"https://twitter.com/ChromiumDev\">@ChromiumDev</a> в Twitter</li>\n<li><a href=\"https://twitter.com/googlechrome\">@googlechrome</a> on Twitter</li>\n<li><a href=\"https://blog.chromium.org\">Блог</a></li>\n<li><a href=\"https://cs.chromium.org/\">Code Search</a></li>\n<li><a href=\"https://cs.chromium.org/chromium/src/\">Source Code</a></li>\n<li><a href=\"https://www.chromium.org/developers/calendar\">Development Calendar and Release Info</a></li>\n<li><a href=\"https://www.chromium.org/developers/discussion-groups\">Discussion Groups</a></li>\n</ul>\n<p>Также смотрите <a href=\"/docs/development/v8-development\">V8 Development</a></p>",
      "title": "Разработка Chromium",
      "description": "Список ресурсов для изучения Chromium и отслеживания его разработки"
    },
    "/docs/development/clang-format": {
      "locale": "ru-RU",
      "slug": "clang-format",
      "href": "/docs/development/clang-format",
      "crowdinFileId": "256143",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/clang-format.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"использование-clang-format-на-c-коде\"><a href=\"#использование-clang-format-на-c-коде\">Использование clang-format на C++ коде</a></h1>\n<p><a href=\"https://clang.llvm.org/docs/ClangFormat.html\"><code>clang-format</code></a> это инструмент для автоматического форматирования кода на C/C++/Objective-C code, он используется для того, чтобы в процессе ревью разработчики не беспокоились о проблемах, связанных с форматированием.</p>\n<p>Настоятельно рекомендуется форматировать измененный вами код C++ перед открытием пулл-реквестов, это сэкономят время вам и ревьюверам.</p>\n<p>Вы можете установить <code>clang-format</code> и <code>git-clang-format</code> командой <code>npm install -g clang-format</code>.</p>\n<p>To automatically format a file according to Electron C++ code style, run <code>clang-format -i path/to/electron/file.cc</code>. It should work on macOS/Linux/Windows.</p>\n<p>Процесс форматирования измененного вами кода:</p>\n<ol>\n<li>Сделать изменения кода в репозитории Electron.</li>\n<li>Запустите <code>git add your_changed_file.cc</code>.</li>\n<li>Выполните <code>git-clang-format</code>, и вы вероятно увидите изменения в <code>your_changed_file.cc</code>, эти изменения сформированы из <code>clang-format</code>.</li>\n<li>Запустите <code>git add your_changed_file.cc</code>, и выполните commit.</li>\n<li>Теперь эта ветка готова для открытия пулл-реквеста.</li>\n</ol>\n<p>If you want to format the changed code on your latest git commit (HEAD), you can run <code>git-clang-format HEAD~1</code>. See <code>git-clang-format -h</code> for more details.</p>\n<h2 id=\"интеграция-с-редактором-кода\"><a href=\"#интеграция-с-редактором-кода\">Интеграция с редактором кода</a></h2>\n<p>You can also integrate <code>clang-format</code> directly into your favorite editors. For further guidance on setting up editor integration, see these pages:</p>\n<ul>\n<li><a href=\"https://atom.io/packages/clang-format\">Atom</a></li>\n<li><a href=\"https://clang.llvm.org/docs/ClangFormat.html#vim-integration\">Vim и Emacs</a></li>\n<li><a href=\"https://marketplace.visualstudio.com/items?itemName=xaver.clang-format\">Visual Studio Code</a></li>\n</ul>",
      "title": "Использование clang-format на C++ коде",
      "description": ""
    },
    "/docs/development/clang-tidy": {
      "locale": "ru-RU",
      "slug": "clang-tidy",
      "href": "/docs/development/clang-tidy",
      "crowdinFileId": "256145",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/clang-tidy.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"using-clang-tidy-on-c-code\"><a href=\"#using-clang-tidy-on-c-code\">Using clang-tidy on C++ Code</a></h1>\n<p><a href=\"https://clang.llvm.org/extra/clang-tidy/\"><code>clang-tidy</code></a> is a tool to automatically check C/C++/Objective-C code for style violations, programming errors, and best practices.</p>\n<p>Electron's <code>clang-tidy</code> integration is provided as a linter script which can be run with <code>npm run lint:clang-tidy</code>. While <code>clang-tidy</code> checks your on-disk files, you need to have built Electron so that it knows which compiler flags were used. There is one required option for the script <code>--output-dir</code>, which tells the script which build directory to pull the compilation information from. A typical usage would be: <code>npm run lint:clang-tidy --out-dir ../out/Testing</code></p>\n<p>With no filenames provided, all C/C++/Objective-C files will be checked. You can provide a list of files to be checked by passing the filenames after the options: <code>npm run lint:clang-tidy --out-dir ../out/Testing shell/browser/api/electron_api_app.cc</code></p>\n<p>While <code>clang-tidy</code> has a <a href=\"https://clang.llvm.org/extra/clang-tidy/checks/list.html\">long list</a> of possible checks, in Electron only a few are enabled by default. At the moment Electron doesn't have a <code>.clang-tidy</code> config, so <code>clang-tidy</code> will find the one from Chromium at <code>src/.clang-tidy</code> and use the checks which Chromium has enabled. You can change which checks are run by using the <code>--checks=</code> option. This is passed straight through to <code>clang-tidy</code>, so see its documentation for full details. Wildcards can be used, and checks can be disabled by prefixing a <code>-</code>. By default any checks listed are added to those in <code>.clang-tidy</code>, so if you'd like to limit the checks to specific ones you should first exclude all checks then add back what you want, like <code>--checks=-*,performance*</code>.</p>\n<p>Running <code>clang-tidy</code> is rather slow - internally it compiles each file and then runs the checks so it will always be some factor slower than compilation. While you can use parallel runs to speed it up using the <code>--jobs|-j</code> option, <code>clang-tidy</code> also uses a lot of memory during its checks, so it can easily run into out-of-memory errors. As such the default number of jobs is one.</p>",
      "title": "Using clang-tidy on C++ Code",
      "description": ""
    },
    "/docs/api/client-request": {
      "locale": "ru-RU",
      "slug": "client-request",
      "href": "/docs/api/client-request",
      "crowdinFileId": "256289",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/client-request.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-clientrequest\"><a href=\"#class-clientrequest\">Class: ClientRequest</a></h2>\n<blockquote>\n<p>Создает HTTP/HTTPS-запросы.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>ClientRequest</code> реализует интерфейс <a href=\"https://nodejs.org/api/stream.html#stream_writable_streams\">Writable Stream</a> и <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h3 id=\"new-clientrequestoptions\"><a href=\"#new-clientrequestoptions\"><code>new ClientRequest(options)</code></a></h3>\n<ul>\n<li><code>options</code> (Object | String) - Если <code>options</code> является String, то она интепретируется как URL запроса. Если это объект, ожидается полное указание HTTP запроса через следующие свойства:<ul>\n<li><code>method</code> String (опционально) - Метод HTTP-запроса. По умолчанию метод GET.</li>\n<li><code>url</code> String (опционально) - URL запроса. Необходимо предоставить в абсолютной форме с протокольной схемой, указанной как http или https.</li>\n<li><code>session</code> Session (опционально) – экземпляр <a href=\"/docs/api/session\"><code>Session</code></a>, с которым ассоциирован данный запрос.</li>\n<li><code>partition</code> String (опционально) – название <a href=\"/docs/api/session\"><code>раздела</code></a>, с которым ассоциирован данный запрос. По умолчанию является пустой строкой. The <code>session</code> option supersedes <code>partition</code>. Поэтому, если параметр <code>session</code> явно указан, то <code>partition</code> игнорируется.</li>\n<li><code>credentials</code> String (опционально) - Может быть <code>include</code> или <code>omit</code>. Whether to send <a href=\"https://fetch.spec.whatwg.org/#credentials\">credentials</a> with this request. If set to <code>include</code>, credentials from the session associated with the request will be used. If set to <code>omit</code>, credentials will not be sent with the request (and the <code>'login'</code> event will not be triggered in the event of a 401). This matches the behavior of the <a href=\"https://fetch.spec.whatwg.org/#concept-request-credentials-mode\">fetch</a> option of the same name. If this option is not specified, authentication data from the session will be sent, and cookies will not be sent (unless <code>useSessionCookies</code> is set).</li>\n<li><code>useSessionCookies</code> Boolean (optional) - Whether to send cookies with this request from the provided session. If <code>credentials</code> is specified, this option has no effect. По умолчанию - <code>false</code>.</li>\n<li><code>protocol</code> String (опционально) - Может быть <code>http:</code> или <code>https:</code>. The protocol scheme in the form 'scheme:'. По умолчанию 'http:'.</li>\n<li><code>host</code> String (опционально) - объединенное с номером порта доменное имя сервера 'доменное_имя:порт'.</li>\n<li><code>hostname</code> String (опционально) – доменное имя сервера.</li>\n<li><code>port</code> Integer (опционально) – номер порта сервера.</li>\n<li><code>path</code> String (опционально) - часть пути запроса URL.</li>\n<li><code>redirect</code> String (необязательный) - Позиция иконки, может иметь значения <code>follow</code>, <code>error</code> или <code>manual</code>. The redirect mode for this request. When mode is <code>error</code>, any redirection will be aborted. When mode is <code>manual</code> the redirection will be cancelled unless <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> is invoked synchronously during the <a href=\"#event-redirect\"><code>redirect</code></a> event.  По умолчанию - <code>follow</code>.</li>\n<li><code>origin</code> String (optional) - The origin URL of the request.</li>\n</ul></li>\n</ul>\n<p>Свойства <code>options</code>, такие как <code>protocol</code>, <code>host</code>, <code>hostname</code>, <code>port</code> и <code>path</code>, строго следуют модели Node.js, которая описана в модуле <a href=\"https://nodejs.org/api/url.html\">URL</a>.</p>\n<p>Например, мы могли бы создать такой же запрос на 'github.com' следующим образом:</p>\n<pre><code class=\"hljs language-JavaScript\"><span class=\"hljs-keyword\">const</span> request = net.request({\n  <span class=\"hljs-attr\">method</span>: <span class=\"hljs-string\">'GET'</span>,\n  <span class=\"hljs-attr\">protocol</span>: <span class=\"hljs-string\">'https:'</span>,\n  <span class=\"hljs-attr\">hostname</span>: <span class=\"hljs-string\">'github.com'</span>,\n  <span class=\"hljs-attr\">port</span>: <span class=\"hljs-number\">443</span>,\n  <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'/'</span>\n})\n</code></pre>\n<h3 id=\"события-экземпляра\"><a href=\"#события-экземпляра\">События экземпляра</a></h3>\n<h4 id=\"событие-response\"><a href=\"#событие-response\">Событие: 'response'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li><code>response</code> <a href=\"/docs/api/incoming-message\">IncomingMessage</a> - Объект, представляющий ответ HTTP.</li>\n</ul>\n<h4 id=\"событие-login\"><a href=\"#событие-login\">Событие: 'login'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li><code>authInfo</code> Object<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (опционально)</li>\n<li><code>password</code> String (опционально)</li>\n</ul></li>\n</ul>\n<p>Происходит, когда прокси-сервер, выполняющий проверку подлинности, запрашивает учетные данные пользователя.</p>\n<p>Ожидается, что функция <code>callback</code> будет вызвана с учетными данными пользователя:</p>\n<ul>\n<li><code>username</code> String</li>\n<li><code>password</code> String</li>\n</ul>\n<pre><code class=\"hljs language-JavaScript\">request.on(<span class=\"hljs-string\">'login'</span>, (authInfo, callback) => {\n  callback(<span class=\"hljs-string\">'username'</span>, <span class=\"hljs-string\">'password'</span>)\n})\n</code></pre>\n<p>Предоставление пустых учетных данных отменит запрос и сообщит об ошибке проверки подлинности в объекте ответа:</p>\n<pre><code class=\"hljs language-JavaScript\">request.on(<span class=\"hljs-string\">'response'</span>, (response) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`STATUS: <span class=\"hljs-subst\">${response.statusCode}</span>`</span>);\n  response.on(<span class=\"hljs-string\">'error'</span>, (error) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`ERROR: <span class=\"hljs-subst\">${<span class=\"hljs-built_in\">JSON</span>.stringify(error)}</span>`</span>)\n  })\n})\nrequest.on(<span class=\"hljs-string\">'login'</span>, (authInfo, callback) => {\n  callback()\n})\n</code></pre>\n<h4 id=\"событие-finish\"><a href=\"#событие-finish\">Событие: 'finish'</a></h4>\n<p>Происходит сразу после того, как последняя часть данных <code>запроса</code> была записана в объект <code>request</code>.</p>\n<h4 id=\"событие-abort\"><a href=\"#событие-abort\">Событие: 'abort'</a></h4>\n<p>Возникает при прерывании <code>request</code>. Событие <code>abort</code> не будет запущено, если <code>request</code> уже закрыт.</p>\n<h4 id=\"событие-error\"><a href=\"#событие-error\">Событие: 'error'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li><code>error</code> Error - объект ошибки, содержащий некоторую информацию о неудаче.</li>\n</ul>\n<p>Происходит, когда модулю <code>net</code> не удается выполнить сетевой запрос. Обычно, когда объект <code>request</code> генерирует событие <code>error</code>, в последствии последует событие <code>close</code> и не будет представлен объект ответа.</p>\n<h4 id=\"событие-close\"><a href=\"#событие-close\">Событие: 'close'</a></h4>\n<p>Происходит как последнее событие в транзакции HTTP запроса-ответа. Событие <code>close</code> указывает, что больше события не будут происходить ни на <code>request</code>, ни на <code>response</code> объектах.</p>\n<h4 id=\"событие-redirect\"><a href=\"#событие-redirect\">Событие: 'redirect'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li><code>statusCode</code> Integer</li>\n<li><code>method</code> String</li>\n<li><code>redirectUrl</code> String</li>\n<li><code>responseHeaders</code> Record&#x3C;String, String[]></li>\n</ul>\n<p>Используется при возврате сервером перенаправленного ответа (например, 301 Перемещено навсегда). Вызов <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> продолжится с перенаправлением.  Если событие обработано, <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> должен вызываться <strong>синхронно</strong>, в противном случае запрос будет отменен.</p>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<h4 id=\"requestchunkedencoding\"><a href=\"#requestchunkedencoding\"><code>request.chunkedEncoding</code></a></h4>\n<p><code>Boolean</code>, определяющий, будет ли запрос использовать в HTTP шифрование передачи частей или нет. По умолчанию - false. Свойство доступно для чтения и записи, в любом случае оно может быть установлено только до первой операции записи, поскольку HTTP-заголовки еще не отправлены. Попытка установить свойство <code>chunkedEncoding</code> после первой записи вызовет ошибку.</p>\n<p>Использование шифрование частей настоятельно рекомендуется, если Вам необходимо отправить большое содержимое запроса как данные, которые будут передаваться в потоке малыми частями вместо внутренней буферизации в памяти процесса Electron.</p>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<h4 id=\"requestsetheadername-value\"><a href=\"#requestsetheadername-value\"><code>request.setHeader(name, value)</code></a></h4>\n<ul>\n<li><code>name</code> String - имя дополнительного HTTP-заголовка.</li>\n<li><code>value</code> String - значение дополнительного HTTP-заголовка.</li>\n</ul>\n<p>Добавляет дополнительный HTTP-заголовок. Имя заголовка будет выдано как есть, без нижнего регистра. Может быть вызвано только перед первой записи. Вызов этого метода после первой записи вызовет ошибку. Если переданное значение это не <code>String</code>, тогда метод <code>toString()</code> будет вызван, чтобы получить конечное значение.</p>\n<p>Certain headers are restricted from being set by apps. These headers are listed below. More information on restricted headers can be found in <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:services/network/public/cpp/header_util.cc;drc=1562cab3f1eda927938f8f4a5a91991fefde66d3;bpv=1;bpt=1;l=22\">Chromium's header utils</a>.</p>\n<ul>\n<li><code>Content-Length</code></li>\n<li><code>Host</code></li>\n<li><code>Trailer</code> or <code>Te</code></li>\n<li><code>Upgrade</code></li>\n<li><code>Cookie2</code></li>\n<li><code>Keep-Alive</code></li>\n<li><code>Transfer-Encoding</code></li>\n</ul>\n<p>Additionally, setting the <code>Connection</code> header to the value <code>upgrade</code> is also disallowed.</p>\n<h4 id=\"requestgetheadername\"><a href=\"#requestgetheadername\"><code>request.getHeader(name)</code></a></h4>\n<ul>\n<li><code>name</code> String - Specify an extra header name.</li>\n</ul>\n<p>Возвращает <code>String</code> - значение ранее установленного дополнительного заголовка.</p>\n<h4 id=\"requestremoveheadername\"><a href=\"#requestremoveheadername\"><code>request.removeHeader(name)</code></a></h4>\n<ul>\n<li><code>name</code> String - Specify an extra header name.</li>\n</ul>\n<p>Удаляет ранее установленное дополнительное имя заголовка. Этот метод может быть вызван только перед первой записью. Попытка вызвать его после первой записи приведет к ошибке.</p>\n<h4 id=\"requestwritechunk-encoding-callback\"><a href=\"#requestwritechunk-encoding-callback\"><code>request.write(chunk[, encoding][, callback])</code></a></h4>\n<ul>\n<li><code>chunk</code> (String | Buffer) - Часть данных в теле запроса. Если это строка, то она преобразуется в буфер в заданной кодировке.</li>\n<li><code>encoding</code> String (опционально) - используется для конвертирования строковые части в объект Buffer. По умолчанию 'utf-8'.</li>\n<li><code>callback</code> Function (опционально) - вызывается после того, как закончится операция записи.</li>\n</ul>\n<p><code>callback</code> является по существу фиктивной функцией, представленной в целях сохранения схожести с API Node.JS. Вызывается асинхронно в следующем такте, после содержимое <code>chunk</code> будет отправлено в сетевой слой Chromium. В отличие от реализации Node.JS, не гарантировано, что содержимое <code>chunk</code> будет отправлено до вызова <code>callback</code>.</p>\n<p>Добавляет часть данных в содержимое запроса. Первая операция записи может привести тому, что заголовки запроса будут отправлены. После первой операции записи, недопустимо добавлять или удалять пользовательские заголовки.</p>\n<h4 id=\"requestendchunk-encoding-callback\"><a href=\"#requestendchunk-encoding-callback\"><code>request.end([chunk][, encoding][, callback])</code></a></h4>\n<ul>\n<li><code>chunk</code> (String | Buffer) (опционально)</li>\n<li><code>encoding</code> String (опционально)</li>\n<li><code>callback</code> Function (опционально)</li>\n</ul>\n<p>Отправляет последний фрагмент данных запроса. Последующие операции по записи или завершению не будут разрешены. Событие <code>finish</code> происходит сразу после завершения операции.</p>\n<h4 id=\"requestabort\"><a href=\"#requestabort\"><code>request.abort()</code></a></h4>\n<p>Отменяет текущую транзакцию HTTP. Если запрос уже сгенерировал событие <code>close</code>, операция прерывания не будет иметь эффекта. Иначе текущее событие будет генерировать события <code>abort</code> и <code>close</code>. Кроме того, если есть текущий объект ответа, будет сгенерировано событие <code>aborted</code>.</p>\n<h4 id=\"requestfollowredirect\"><a href=\"#requestfollowredirect\"><code>request.followRedirect()</code></a></h4>\n<p>Continues any pending redirection. Can only be called during a <code>'redirect'</code> event.</p>\n<h4 id=\"requestgetuploadprogress\"><a href=\"#requestgetuploadprogress\"><code>request.getUploadProgress()</code></a></h4>\n<p>Возвращает <code>Object</code>:</p>\n<ul>\n<li><code>active</code> Boolean - Активен ли запрос в данный момент. Если это false, никакие другие свойства не будут установлены</li>\n<li><code>started</code> Boolean - Началась ли загрузка. Если это false, то и <code>current</code> и <code>total</code> будут установлены в 0.</li>\n<li><code>current</code> Integer - количество байтов, которые были загружены</li>\n<li><code>total</code> Integer - количество байтов, которые будут загружены в этом запросе</li>\n</ul>\n<p>Вы можете использовать этот метод в сочетании с запросами <code>POST</code>, чтобы получить прогресс загрузки файла или другой передачи данных.</p>",
      "title": "ClientRequest",
      "description": "Создает HTTP/HTTPS-запросы."
    },
    "/docs/api/clipboard": {
      "locale": "ru-RU",
      "slug": "clipboard",
      "href": "/docs/api/clipboard",
      "crowdinFileId": "256291",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/clipboard.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"clipboard\"><a href=\"#clipboard\">clipboard</a></h1>\n<blockquote>\n<p>Выполняет копирование и вставку в буфер обмена системы.</p>\n</blockquote>\n<p>Процессы: <a href=\"/docs/glossary#main-process\">Основной</a>, <a href=\"/docs/glossary#renderer-process\">Графический</a></p>\n<p>В Linux также есть <code>selection</code> буфер обмена. Для работы с ним необходимо передать <code>selection</code> каждому методу:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeText(<span class=\"hljs-string\">'Пример строки'</span>, <span class=\"hljs-string\">'selection)\nconsole.log(clipboard.readText('</span>selection<span class=\"hljs-string\">'))\n</span></code></pre>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code>clipboard</code> имеет следующие методы:</p>\n<p><strong>Примечание:</strong> Экспериментальные API помечены и могут быть удалены в будущем.</p>\n<h3 id=\"clipboardreadtexttype\"><a href=\"#clipboardreadtexttype\"><code>clipboard.readText([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (опционально) - Может быть <code>selection</code> или <code>clipboard</code>; по умолчанию 'clipboard'. <code>selection</code> доступен только в Linux.</li>\n</ul>\n<p>Возвращает <code>String</code> — содержимое буфера обмена в виде обычного текста.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeText(<span class=\"hljs-string\">'hello i am a bit of text!'</span>)\n\n<span class=\"hljs-keyword\">const</span> text = clipboard.readText()\n<span class=\"hljs-built_in\">console</span>.log(text)\n<span class=\"hljs-comment\">// hello i am a bit of text!'</span>\n</code></pre>\n<h3 id=\"clipboardwritetexttext-type\"><a href=\"#clipboardwritetexttext-type\"><code>clipboard.writeText(text[, type])</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n<li><code>type</code> String (опционально) - Может быть <code>selection</code> или <code>clipboard</code>; по умолчанию 'clipboard'. <code>selection</code> доступен только в Linux.</li>\n</ul>\n<p>Записывает <code>text</code> в буфер обмена, как обычный текст.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> text = <span class=\"hljs-string\">'hello i am a bit of text!'</span>\nclipboard.writeText(text)\n</code></pre>\n<h3 id=\"clipboardreadhtmltype\"><a href=\"#clipboardreadhtmltype\"><code>clipboard.readHTML([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (опционально) - Может быть <code>selection</code> или <code>clipboard</code>; по умолчанию 'clipboard'. <code>selection</code> доступен только в Linux.</li>\n</ul>\n<p>Возвращает <code>String</code> - содержимое буфера обмена в виде разметки.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeHTML(<span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b>'</span>)\n<span class=\"hljs-keyword\">const</span> html = clipboard.readHTML()\n\n<span class=\"hljs-built_in\">console</span>.log(html)\n<span class=\"hljs-comment\">// &#x3C;meta charset='utf-8'>&#x3C;b>Hi&#x3C;/b></span>\n</code></pre>\n<h3 id=\"clipboardwritehtmlmarkup-type\"><a href=\"#clipboardwritehtmlmarkup-type\"><code>clipboard.writeHTML(markup[, type])</code></a></h3>\n<ul>\n<li><code>markup</code> String</li>\n<li><code>type</code> String (опционально) - Может быть <code>selection</code> или <code>clipboard</code>; по умолчанию 'clipboard'. <code>selection</code> доступен только в Linux.</li>\n</ul>\n<p>Записывает <code>markup</code> в буфер обмена.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeHTML(<span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b'</span>)\n</code></pre>\n<h3 id=\"clipboardreadimagetype\"><a href=\"#clipboardreadimagetype\"><code>clipboard.readImage([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (опционально) - Может быть <code>selection</code> или <code>clipboard</code>; по умолчанию 'clipboard'. <code>selection</code> доступен только в Linux.</li>\n</ul>\n<p>Возвращает <a href=\"/docs/api/native-image\"><code>NativeImage</code></a> - содержимое изображения в буфере обмена.</p>\n<h3 id=\"clipboardwriteimageimage-type\"><a href=\"#clipboardwriteimageimage-type\"><code>clipboard.writeImage(image[, type])</code></a></h3>\n<ul>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a></li>\n<li><code>type</code> String (опционально) - Может быть <code>selection</code> или <code>clipboard</code>; по умолчанию 'clipboard'. <code>selection</code> доступен только в Linux.</li>\n</ul>\n<p>Записывает <code>image</code> в буфер обмена.</p>\n<h3 id=\"clipboardreadrtftype\"><a href=\"#clipboardreadrtftype\"><code>clipboard.readRTF([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (опционально) - Может быть <code>selection</code> или <code>clipboard</code>; по умолчанию 'clipboard'. <code>selection</code> доступен только в Linux.</li>\n</ul>\n<p>Возвращает <code>String</code> - содержимое в буфере обмена в виде RTF.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeRTF(<span class=\"hljs-string\">'{\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}'</span>)\n\n<span class=\"hljs-keyword\">const</span> rtf = clipboard.readRTF()\n<span class=\"hljs-built_in\">console</span>.log(rtf)\n<span class=\"hljs-comment\">// {\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}</span>\n</code></pre>\n<h3 id=\"clipboardwritertftext-type\"><a href=\"#clipboardwritertftext-type\"><code>clipboard.writeRTF(text[, type])</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n<li><code>type</code> String (опционально) - Может быть <code>selection</code> или <code>clipboard</code>; по умолчанию 'clipboard'. <code>selection</code> доступен только в Linux.</li>\n</ul>\n<p>Записывает <code>text</code> в буфер обмена как RTF.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> rtf = <span class=\"hljs-string\">'{\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}'</span>\nclipboard.writeRTF(rtf)\n</code></pre>\n<h3 id=\"clipboardreadbookmark-macos-windows\"><a href=\"#clipboardreadbookmark-macos-windows\"><code>clipboard.readBookmark()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Возвращает <code>Object</code>:</p>\n<ul>\n<li><code>title</code> String</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Возвращает объект, содержащий ключи <code>title</code> и <code>url</code>, представляющие закладку в буфере обмена. Значения <code>title</code> и <code>url</code> будут пустыми строками, когда закладки недоступны.</p>\n<h3 id=\"clipboardwritebookmarktitle-url-type-macos-windows\"><a href=\"#clipboardwritebookmarktitle-url-type-macos-windows\"><code>clipboard.writeBookmark(title, url[, type])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>title</code> String</li>\n<li><code>url</code> String</li>\n<li><code>type</code> String (опционально) - Может быть <code>selection</code> или <code>clipboard</code>; по умолчанию 'clipboard'. <code>selection</code> доступен только в Linux.</li>\n</ul>\n<p>Записывает <code>title</code> и <code>url</code> в буфер обмена, как закладку.</p>\n<p><strong>Примечание:</strong> Большинство приложений на Windows не поддерживают вставку закладок в них, так что Вы можете использовать <code>clipboard.write</code>, чтобы записать как закладку, так и резервный текст в буфер обмена.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeBookmark({\n  <span class=\"hljs-attr\">text</span>: <span class=\"hljs-string\">'https://electronjs.org'</span>,\n  <span class=\"hljs-attr\">bookmark</span>: <span class=\"hljs-string\">'Electron Homepage'</span>\n})\n</code></pre>\n<h3 id=\"clipboardreadfindtext-macos\"><a href=\"#clipboardreadfindtext-macos\"><code>clipboard.readFindText()</code> <em>macOS</em></a></h3>\n<p>Возвращает <code>String</code> - текст в панели поиска, который представляет собой информацию о текущем состоянии панели поиска активного приложения.</p>\n<p>Этот метод использует синхронный IPC, когда вызывается в процессе рендеринга. Закэшированное значение перечитывается из буфера обмена, всякий раз, когда приложение активировано.</p>\n<h3 id=\"clipboardwritefindtexttext-macos\"><a href=\"#clipboardwritefindtexttext-macos\"><code>clipboard.writeFindText(text)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Записывает <code>text</code> в панель поиска (панель, которая содержит информацию о текущем состоянии панели поиска активного приложения) в виде простого текста. Этот метод использует синхронный IPC, когда вызывается в процессе рендеринга.</p>\n<h3 id=\"clipboardcleartype\"><a href=\"#clipboardcleartype\"><code>clipboard.clear([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (опционально) - Может быть <code>selection</code> или <code>clipboard</code>; по умолчанию 'clipboard'. <code>selection</code> доступен только в Linux.</li>\n</ul>\n<p>Очищает содержимое буфера обмена.</p>\n<h3 id=\"clipboardavailableformatstype\"><a href=\"#clipboardavailableformatstype\"><code>clipboard.availableFormats([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (опционально) - Может быть <code>selection</code> или <code>clipboard</code>; по умолчанию 'clipboard'. <code>selection</code> доступен только в Linux.</li>\n</ul>\n<p>Возвращает <code>String[]</code> - массив поддерживаемых форматов для <code>type</code> буфера обмена.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> formats = clipboard.availableFormats()\n<span class=\"hljs-built_in\">console</span>.log(formats)\n<span class=\"hljs-comment\">// [ 'text/plain', 'text/html' ]</span>\n</code></pre>\n<h3 id=\"clipboardhasformat-type-экспериментально\"><a href=\"#clipboardhasformat-type-экспериментально\"><code>clipboard.has(format[, type])</code> <em>Экспериментально</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n<li><code>type</code> String (опционально) - Может быть <code>selection</code> или <code>clipboard</code>; по умолчанию 'clipboard'. <code>selection</code> доступен только в Linux.</li>\n</ul>\n<p>Возвращает <code>Boolean</code> - поддерживает ли буфер обмена указанный <code>format</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> hasFormat = clipboard.has(<span class=\"hljs-string\">'&#x3C;p>selection&#x3C;/p>'</span>)\n<span class=\"hljs-built_in\">console</span>.log(hasFormat)\n<span class=\"hljs-comment\">// 'true' or 'false'</span>\n</code></pre>\n<h3 id=\"clipboardreadformat-экспериментально\"><a href=\"#clipboardreadformat-экспериментально\"><code>clipboard.read(format)</code> <em>Экспериментально</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n</ul>\n<p>Возвращает <code>String</code> - читает тип <code>format</code> из буфера обмена.</p>\n<p><code>format</code> should contain valid ASCII characters and have <code>/</code> separator. <code>a/c</code>, <code>a/bc</code> are valid formats while <code>/abc</code>, <code>abc/</code>, <code>a/</code>, <code>/a</code>, <code>a</code> are not valid.</p>\n<h3 id=\"clipboardreadbufferformat-экспериментально\"><a href=\"#clipboardreadbufferformat-экспериментально\"><code>clipboard.readBuffer(format)</code> <em>Экспериментально</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n</ul>\n<p>Возвращает <code>Buffer</code> - читает тип <code>format</code> из буфера обмена.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> buffer = Buffer.from(<span class=\"hljs-string\">'this is binary'</span>, <span class=\"hljs-string\">'utf8'</span>)\nclipboard.writeBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>, buffer)\n\n<span class=\"hljs-keyword\">const</span> ret = clipboard.readBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>)\n\n<span class=\"hljs-built_in\">console</span>.log(buffer.equals(out))\n<span class=\"hljs-comment\">// true</span>\n</code></pre>\n<h3 id=\"clipboardwritebufferformat-buffer-type-экспериментально\"><a href=\"#clipboardwritebufferformat-buffer-type-экспериментально\"><code>clipboard.writeBuffer(format, buffer[, type])</code> <em>Экспериментально</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n<li><code>buffer</code> Buffer</li>\n<li><code>type</code> String (опционально) - Может быть <code>selection</code> или <code>clipboard</code>; по умолчанию 'clipboard'. <code>selection</code> доступен только в Linux.</li>\n</ul>\n<p>Записывает <code>buffer</code> в буфер обмена, как <code>format</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> buffer = Buffer.from(<span class=\"hljs-string\">'writeBuffer'</span>, <span class=\"hljs-string\">'utf8'</span>)\nclipboard.writeBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>, buffer)\n</code></pre>\n<h3 id=\"clipboardwritedata-type\"><a href=\"#clipboardwritedata-type\"><code>clipboard.write(data[, type])</code></a></h3>\n<ul>\n<li><code>data</code> Object<ul>\n<li><code>text</code> String (опционально)</li>\n<li><code>html</code> String (опционально)</li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> (опционально)</li>\n<li><code>rtf</code> String (опционально)</li>\n<li><code>bookmark</code> String (опционально) - заголовок ссылки на <code>text</code>.</li>\n</ul></li>\n<li><code>type</code> String (опционально) - Может быть <code>selection</code> или <code>clipboard</code>; по умолчанию 'clipboard'. <code>selection</code> доступен только в Linux.</li>\n</ul>\n<p>Записывает <code>data</code> в буфер обмена.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.write({\n  <span class=\"hljs-attr\">text</span>: <span class=\"hljs-string\">'test'</span>,\n  <span class=\"hljs-attr\">html</span>: <span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b>'</span>,\n  <span class=\"hljs-attr\">rtf</span>: <span class=\"hljs-string\">'{\\\\rtf1\\\\utf8 text}'</span>,\n  <span class=\"hljs-attr\">bookmark</span>: <span class=\"hljs-string\">'a title'</span>\n})\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readText())\n<span class=\"hljs-comment\">// 'test'</span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readHTML())\n<span class=\"hljs-comment\">// &#x3C;meta charset='utf-8'>&#x3C;b>Hi&#x3C;/b></span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readRTF())\n<span class=\"hljs-comment\">// '{\\\\rtf1\\\\utf8 text}'</span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readBookmark())\n<span class=\"hljs-comment\">// { title: 'a title', url: 'test' }</span>\n</code></pre>",
      "title": "clipboard",
      "description": "Выполняет копирование и вставку в буфер обмена системы."
    },
    "/docs/tutorial/code-signing": {
      "locale": "ru-RU",
      "slug": "code-signing",
      "href": "/docs/tutorial/code-signing",
      "crowdinFileId": "256183",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/code-signing.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"подписывание-кода\"><a href=\"#подписывание-кода\">Подписывание кода</a></h1>\n<p>Подпись кода - это технология безопасности, которую вы используете для удостоверения того, что приложение было создано вами.</p>\n<p>On macOS the system can detect any change to the app, whether the change is introduced accidentally or by malicious code.</p>\n<p>On Windows, the system assigns a trust level to your code signing certificate which if you don't have, or if your trust level is low, will cause security dialogs to appear when users start using your application.  Trust level builds over time so it's better to start code signing as early as possible.</p>\n<p>Можно распространять неподписанные приложения, но не рекомендуется. Both Windows and macOS will, by default, prevent either the download or the execution of unsigned applications. Starting with macOS Catalina (version 10.15), users have to go through multiple manual steps to open unsigned applications.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/gatekeeper.png\" alt=\"предупреждение macOS Catalina Gatekeeper: Не удается открыть приложение, так как\nразработчик не может быть проверен\"></p>\n<p>As you can see, users get two options: Move the app straight to the trash or cancel running it. You don't want your users to see that dialog.</p>\n<p>If you are building an Electron app that you intend to package and distribute, it should be code-signed.</p>\n<h1 id=\"signing--notarizing-macos-builds\"><a href=\"#signing--notarizing-macos-builds\">Signing &#x26; notarizing macOS builds</a></h1>\n<p>Properly preparing macOS applications for release requires two steps: First, the app needs to be code-signed. Then, the app needs to be uploaded to Apple for a process called \"notarization\", where automated systems will further verify that your app isn't doing anything to endanger its users.</p>\n<p>To start the process, ensure that you fulfill the requirements for signing and notarizing your app:</p>\n<ol>\n<li>Зарегистрироваться в <a href=\"https://developer.apple.com/programs/\">Apple Developer Program</a> (требует оплату раз в год)</li>\n<li>Download and install <a href=\"https://developer.apple.com/xcode\">Xcode</a> - this requires a computer running macOS</li>\n<li>Сгенерировать <a href=\"https://github.com/electron/electron-osx-sign/wiki/1.-Getting-Started#certificates\">подписанные сертификаты</a></li>\n</ol>\n<p>Electron's ecosystem favors configuration and freedom, so there are multiple ways to get your application signed and notarized.</p>\n<h2 id=\"electron-forge\"><a href=\"#electron-forge\"><code>electron-forge</code></a></h2>\n<p>If you're using Electron's favorite build tool, getting your application signed and notarized requires a few additions to your configuration. <a href=\"https://electronforge.io\">Forge</a> is a collection of the official Electron tools, using <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>, <a href=\"https://github.com/electron-userland/electron-osx-sign\"><code>electron-osx-sign</code></a>, and <a href=\"https://github.com/electron/electron-notarize\"><code>electron-notarize</code></a> under the hood.</p>\n<p>Let's take a look at an example configuration with all required fields. Not all of them are required: the tools will be clever enough to automatically find a suitable <code>identity</code>, for instance, but we recommend that you are explicit.</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"my-app\"</span>,\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.0.1\"</span>,\n  <span class=\"hljs-attr\">\"config\"</span>: {\n    <span class=\"hljs-attr\">\"forge\"</span>: {\n      <span class=\"hljs-attr\">\"packagerConfig\"</span>: {\n        <span class=\"hljs-attr\">\"osxSign\"</span>: {\n          <span class=\"hljs-attr\">\"identity\"</span>: <span class=\"hljs-string\">\"Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)\"</span>,\n          <span class=\"hljs-attr\">\"hardened-runtime\"</span>: <span class=\"hljs-literal\">true</span>,\n          <span class=\"hljs-attr\">\"entitlements\"</span>: <span class=\"hljs-string\">\"entitlements.plist\"</span>,\n          <span class=\"hljs-attr\">\"entitlements-inherit\"</span>: <span class=\"hljs-string\">\"entitlements.plist\"</span>,\n          <span class=\"hljs-attr\">\"signature-flags\"</span>: <span class=\"hljs-string\">\"library\"</span>\n        },\n        <span class=\"hljs-attr\">\"osxNotarize\"</span>: {\n          <span class=\"hljs-attr\">\"appleId\"</span>: <span class=\"hljs-string\">\"felix@felix.fun\"</span>,\n          <span class=\"hljs-attr\">\"appleIdPassword\"</span>: <span class=\"hljs-string\">\"my-apple-id-password\"</span>,\n        }\n      }\n    }\n  }\n}\n</code></pre>\n<p>The <code>plist</code> file referenced here needs the following macOS-specific entitlements to assure the Apple security mechanisms that your app is doing these things without meaning any harm:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.allow-jit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.debugger<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>Обратите внимание, что до Electron 12 также требовалось право на <code>com.apple.security.cs.allow-unsigned-executable-memory</code>. Тем не менее, его больше не следует использовать, если есть возможность.</p>\n<p>To see all of this in action, check out Electron Fiddle's source code, <a href=\"https://github.com/electron/fiddle/blob/master/forge.config.js\">especially its <code>electron-forge</code> configuration file</a>.</p>\n<p>If you plan to access the microphone or camera within your app using Electron's APIs, you'll also need to add the following entitlements:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.device.audio-input<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.device.camera<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>If these are not present in your app's entitlements when you invoke, for example:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> microphone = systemPreferences.askForMediaAccess(<span class=\"hljs-string\">'microphone'</span>)\n</code></pre>\n<p>Your app may crash. See the Resource Access section in <a href=\"https://developer.apple.com/documentation/security/hardened_runtime\">Hardened Runtime</a> for more information and entitlements you may need.</p>\n<h2 id=\"electron-builder\"><a href=\"#electron-builder\"><code>electron-builder</code></a></h2>\n<p>Electron Builder comes with a custom solution for signing your application. You can find <a href=\"https://www.electron.build/code-signing\">its documentation here</a>.</p>\n<h2 id=\"electron-packager\"><a href=\"#electron-packager\"><code>electron-packager</code></a></h2>\n<p>If you're not using an integrated build pipeline like Forge or Builder, you are likely using <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>, which includes <a href=\"https://github.com/electron-userland/electron-osx-sign\"><code>electron-osx-sign</code></a> and <a href=\"https://github.com/electron/electron-notarize\"><code>electron-notarize</code></a>.</p>\n<p>Если вы используете API Packager, вы можете передать <a href=\"https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html\">то, что подписывает и заверяет нотариально ваше приложение </a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> packager = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-packager'</span>)\n\npackager({\n  <span class=\"hljs-attr\">dir</span>: <span class=\"hljs-string\">'/path/to/my/app'</span>,\n  <span class=\"hljs-attr\">osxSign</span>: {\n    <span class=\"hljs-attr\">identity</span>: <span class=\"hljs-string\">'Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)'</span>,\n    <span class=\"hljs-string\">'hardened-runtime'</span>: <span class=\"hljs-literal\">true</span>,\n    <span class=\"hljs-attr\">entitlements</span>: <span class=\"hljs-string\">'entitlements.plist'</span>,\n    <span class=\"hljs-string\">'entitlements-inherit'</span>: <span class=\"hljs-string\">'entitlements.plist'</span>,\n    <span class=\"hljs-string\">'signature-flags'</span>: <span class=\"hljs-string\">'library'</span>\n  },\n  <span class=\"hljs-attr\">osxNotarize</span>: {\n    <span class=\"hljs-attr\">appleId</span>: <span class=\"hljs-string\">'felix@felix.fun'</span>,\n    <span class=\"hljs-attr\">appleIdPassword</span>: <span class=\"hljs-string\">'my-apple-id-password'</span>\n  }\n})\n</code></pre>\n<p>The <code>plist</code> file referenced here needs the following macOS-specific entitlements to assure the Apple security mechanisms that your app is doing these things without meaning any harm:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.allow-jit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.debugger<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>Вплоть до Electron 12 элемент <code>com.apple.security.cs.allow-unsigned-executable-memory</code> обязателен. Тем не менее, его больше не следует использовать, если есть возможность.</p>\n<h2 id=\"mac-app-store\"><a href=\"#mac-app-store\">Mac App Store</a></h2>\n<p>See the <a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store Guide</a>.</p>\n<h1 id=\"подписывание-сборок-для-windows\"><a href=\"#подписывание-сборок-для-windows\">Подписывание сборок для Windows</a></h1>\n<p>Перед подписью, следует:</p>\n<ol>\n<li>Получить сертификат для подписания кода аутентификации Windows (требуется ежегодная плата)</li>\n<li>Установите Visual Studio для получения утилиты подписи (бесплатной версия <a href=\"https://visualstudio.microsoft.com/vs/community/\"> Community Edition</a> достаточно)</li>\n</ol>\n<p>Вы можете получить сертификат от множества продавцов, включая самых популярных. Цены варьируются, поэтому это может стоить вашего времени, чтобы ходить по магазинам. Популярные реселлеры включают:</p>\n<ul>\n<li><a href=\"https://www.digicert.com/code-signing/microsoft-authenticode.htm\">digicert</a></li>\n<li><a href=\"https://sectigo.com/ssl-certificates-tls/code-signing\">Sectigo</a></li>\n<li>Amongst others, please shop around to find one that suits your needs, Google is your friend 😄</li>\n</ul>\n<p>Существует ряд инструментов для подписывания приложений:</p>\n<ul>\n<li><a href=\"https://github.com/electron/windows-installer\"><code>electron-winstaller</code></a> will generate an installer for windows and sign it for you</li>\n<li><a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a> can sign installers it generates through the Squirrel.Windows or MSI targets.</li>\n<li><a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> can sign some of its windows targets</li>\n</ul>\n<h2 id=\"windows-store\"><a href=\"#windows-store\">Windows Store</a></h2>\n<p>Смотри страницу <a href=\"/docs/tutorial/windows-store-guide\">Windows Store Guide</a>.</p>",
      "title": "Подписывание кода",
      "description": ""
    },
    "/docs/development/coding-style": {
      "locale": "ru-RU",
      "slug": "coding-style",
      "href": "/docs/development/coding-style",
      "crowdinFileId": "256147",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/coding-style.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"стиль-кода\"><a href=\"#стиль-кода\">Стиль кода</a></h1>\n<p>Это руководство по стилю кодирования для Electron.</p>\n<p>Вы пожете запустить <code>npm run lint</code> для того чтобы получить список проблемных мест по стилю кода, найденных с помощью <code>cpplint</code> и <code>eslint</code>.</p>\n<h2 id=\"оформление-кода\"><a href=\"#оформление-кода\">Оформление кода</a></h2>\n<ul>\n<li>Завершайте все файлы переводом строки.</li>\n<li>Размещайте require в следующем порядке:<ul>\n<li>Встроенные модули Node (такие как <code>path</code>)</li>\n<li>Встроенные модули Electron (такие как <code>ipc</code>, <code>app</code>)</li>\n<li>Локальные модули (используя относительные пути)</li>\n</ul></li>\n<li>Размещайте свойства классов в следующем порядке:<ul>\n<li>Методы и свойства класса (названия методов должны начинаться с <code>@</code>)</li>\n<li>Методы и свойства объекта (экземпляра)</li>\n</ul></li>\n<li>Избегайте платформенно-зависимого кода:<ul>\n<li>Используйте <code>path.join()</code> для конкатенации имен файлов.</li>\n<li>Используйте <code>os.tmpdir()</code> вместо <code>/tmp</code> когда нужно сослаться на каталог для временных файлов.</li>\n</ul></li>\n<li>Using a plain <code>return</code> when returning explicitly at the end of a function.<ul>\n<li>Не <code>return null</code>, не <code>return undefined</code>, не <code>null</code> или <code>undefined</code></li>\n</ul></li>\n</ul>\n<h2 id=\"c-и-python\"><a href=\"#c-и-python\">C++ и Python</a></h2>\n<p>Для C++ и Python мы следуем <a href=\"https://chromium.googlesource.com/chromium/src/+/refs/heads/main/styleguide/styleguide.md\">стилю кодирования</a> Chromium. Для автоматического форматирования кода на C++ вы можете использовать <a href=\"/docs/development/clang-format\">clang-format</a>. Есть также скрипт <code>script/cpplint.py</code>, позволяющий проверить, что все файлы соответствуют стилю.</p>\n<p>Версией Python, которую мы используем в настоящее время, является Python 2.7.</p>\n<p>Код C++ использует многожество абстракций и типов Chrome, поэтому рекомендуется ознакомиться с ними. Хорошее место чтобы начать это <a href=\"https://www.chromium.org/developers/coding-style/important-abstractions-and-data-structures\">Important Abstractions and Data Structures</a> из документации по Chromium. Документ упоминает некоторые специальные типы, областные типы (которые автоматически освобождают используемую ими память при выходе из области), механизмы логгирования и т. д.</p>\n<h2 id=\"документация\"><a href=\"#документация\">Документация</a></h2>\n<ul>\n<li>Используйте стиль разметки <a href=\"https://github.com/remarkjs/remark\">remark</a>.</li>\n</ul>\n<p>Вы можете выполнить команду <code>npm run lint-docs</code> чтобы убедиться, что ваши изменения документации корректно отформатированы.</p>\n<h2 id=\"javascript\"><a href=\"#javascript\">JavaScript</a></h2>\n<ul>\n<li>Пишите в стиле <a href=\"https://www.npmjs.com/package/standard\">стандартном</a> для JavaScript.</li>\n<li>Имена файлов должны соединяться через <code>-</code> вместо <code>_</code>, например, <code>file-name.js</code> вместо <code>file_name.js</code>, поскольку имена в <a href=\"https://github.com/github/atom\">github/atom</a> обычно пишутся в форме <code>module-name</code>. Это правило применяется только к <code>.js</code>-файлам.</li>\n<li>Используйте новый синтаксис ES6/ES2015 там, где это уместно<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const\"><code>const</code></a> для requires и прочих постоянных значений.  Если значение примитивно, используйте имя в верхнем регистре (например, <code>const NUMBER_OF_RETRIES = 5</code>).</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let\"><code>let</code></a> для определения переменных</li>\n<li><a href=\"https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Functions/Arrow_functions\">Стрелочные функции</a> вместо <code>function () { }</code></li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals\">Используйте шаблоны литералов</a> вместо конкатенации строк с использованием <code>+</code></li>\n</ul></li>\n</ul>\n<h2 id=\"именование-сущностей\"><a href=\"#именование-сущностей\">Именование сущностей</a></h2>\n<p>Electron APIs использует ту же схему капитализации, что и Node.js:</p>\n<ul>\n<li>Если сам модуль является классом, напр. <code>BrowserWindow</code>, используйте <code>PascalCase</code>.</li>\n<li>Если модуль является набором API, напр. <code>globalShortcut</code>, используйте <code>camelCase</code>.</li>\n<li>Когда API это свойство объекта, и оно обладает достаточной сложностью для помещения в отдельную главу, как например <code>win.webContents</code>, используйте <code>mixedCase</code>.</li>\n<li>Для всех других не модульных API используйте естественные названия, напр. <code> Tag</code> или <code>Process Object</code>.</li>\n</ul>\n<p>При создании новых API рекомендуется использовать getters и setters вместо одной функции для доступа в типичном для jQuery стиле. Например, <code>.getText()</code> и <code>.setText(text)</code> более предпочтительны, чем <code>.text([text])</code>. См. обсуждение этой темы <a href=\"https://github.com/electron/electron/issues/46\">здесь</a>.</p>",
      "title": "Стиль кода",
      "description": ""
    },
    "/docs/api/command-line": {
      "locale": "ru-RU",
      "slug": "command-line",
      "href": "/docs/api/command-line",
      "crowdinFileId": "256295",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/command-line.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-commandline\"><a href=\"#class-commandline\">Class: CommandLine</a></h2>\n<blockquote>\n<p>Манипулирование аргументами командной строки для вашего приложения, которое читает Chromium</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>В следующем примере показано, как проверить, установлен ли флаг <code>--disable-gpu</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.hasSwitch(<span class=\"hljs-string\">'disable-gpu'</span>)\n</code></pre>\n<p>Для получения более подробной информации о том, какие флаги и переключатели можно использовать, смотрите <a href=\"/docs/api/command-line-switches\">переключатели командной строки</a>.</p>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<h4 id=\"commandlineappendswitchswitch-value\"><a href=\"#commandlineappendswitchswitch-value\"><code>commandLine.appendSwitch(switch[, value])</code></a></h4>\n<ul>\n<li><code>switch</code> String - переключатель командной строки, без ведущего <code>--</code></li>\n<li><code>value</code> String (опиционально) - значение для данного переключателя</li>\n</ul>\n<p>Добавьте переключатель (с опциональным значением <code>value</code>) Chromium в командной строке.</p>\n<p><strong>Примечание:</strong> Это не повлияет на <code>process.argv</code>. Предполагаемое использование этой функции — управлять поведением Chromium.</p>\n<h4 id=\"commandlineappendargumentvalue\"><a href=\"#commandlineappendargumentvalue\"><code>commandLine.appendArgument(value)</code></a></h4>\n<ul>\n<li><code>value</code> String - аргумент для добавления в командную строку</li>\n</ul>\n<p>Добавляет аргумент в командную строку Chromium. Аргумент будет указан правильно. Переключатели будут предшествовать аргументам независимо от порядка добавления.</p>\n<p>Если Вы добавляете аргумент, такой как <code>--switch=value</code>, вместо этого рассмотрите использование <code>appendSwitch('switch', 'value')</code>.</p>\n<p><strong>Примечание:</strong> Это не повлияет на <code>process.argv</code>. Предполагаемое использование этой функции — управлять поведением Chromium.</p>\n<h4 id=\"commandlinehasswitchswitch\"><a href=\"#commandlinehasswitchswitch\"><code>commandLine.hasSwitch(switch)</code></a></h4>\n<ul>\n<li><code>switch</code> String - переключатель командной строки</li>\n</ul>\n<p>Возвращает <code>Boolean</code> - есть или нет переключатель командной строки.</p>\n<h4 id=\"commandlinegetswitchvalueswitch\"><a href=\"#commandlinegetswitchvalueswitch\"><code>commandLine.getSwitchValue(switch)</code></a></h4>\n<ul>\n<li><code>switch</code> String - переключатель командной строки</li>\n</ul>\n<p>Возвращает <code>String</code> - значение переключателя командной строки.</p>\n<p><strong>Примечание:</strong> Когда переключатель не присутствует или не имеет значения, возвращает пустую строку.</p>",
      "title": "CommandLine",
      "description": "Манипулирование аргументами командной строки для вашего приложения, которое читает Chromium"
    },
    "/docs/api/command-line-switches": {
      "locale": "ru-RU",
      "slug": "command-line-switches",
      "href": "/docs/api/command-line-switches",
      "crowdinFileId": "256293",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/command-line-switches.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"поддерживаемые-параметры-командной-строки\"><a href=\"#поддерживаемые-параметры-командной-строки\">Поддерживаемые параметры командной строки</a></h1>\n<blockquote>\n<p>Параметры командной строки поддерживаемые Electron.</p>\n</blockquote>\n<p>Вы можете использовать <a href=\"/docs/api/command-line#commandlineappendswitchswitch-value\">app.commandLine.appendSwitch</a>, для добавления параметров командной строки, в основном скрипте Вашего приложения, перед тем как произойдет событие <a href=\"/docs/api/app#event-ready\">ready</a> модуля <a href=\"/docs/api/app\">app</a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'remote-debugging-port'</span>, <span class=\"hljs-string\">'8315'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'host-rules'</span>, <span class=\"hljs-string\">'MAP * 127.0.0.1'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Your code here</span>\n})\n</code></pre>\n<h2 id=\"electron-cli-flags\"><a href=\"#electron-cli-flags\">Electron CLI Flags</a></h2>\n<h3 id=\"--auth-server-whitelistссылка\"><a href=\"#--auth-server-whitelistссылка\">--auth-server-whitelist=<code>ссылка</code></a></h3>\n<p>Список серверов (разделенные запятой), для которых разрешена интегрированная аутентификация.</p>\n<p>Например:</p>\n<pre><code class=\"hljs language-sh\">--auth-server-whitelist=<span class=\"hljs-string\">'*example.com, *foobar.com, *baz'</span>\n</code></pre>\n<p>тогда любая <code>ссылка</code> заканчивающаяся на <code>example.com</code>, <code>foobar.com</code> и <code>baz</code> будут рассматриваться для интегрированной аутентификации. Без префикса <code>*</code>, ссылка будет полностью соответствовать.</p>\n<h3 id=\"--auth-negotiate-delegate-whitelistссылка\"><a href=\"#--auth-negotiate-delegate-whitelistссылка\">--auth-negotiate-delegate-whitelist=<code>ссылка</code></a></h3>\n<p>A comma-separated list of servers for which delegation of user credentials is required. Без префикса <code>*</code>, ссылка будет полностью соответствовать.</p>\n<h3 id=\"--disable-ntlm-v2\"><a href=\"#--disable-ntlm-v2\">--disable-ntlm-v2</a></h3>\n<p>Disables NTLM v2 for posix platforms, no effect elsewhere.</p>\n<h3 id=\"--disable-http-cache\"><a href=\"#--disable-http-cache\">--disable-http-cache</a></h3>\n<p>Отключить кэширование на жёсткий диск для HTTP запросов.</p>\n<h3 id=\"--disable-http2\"><a href=\"#--disable-http2\">--disable-http2</a></h3>\n<p>Отключить HTTP/2 и SPDY/3.1 протоколы.</p>\n<h3 id=\"--disable-renderer-backgrounding\"><a href=\"#--disable-renderer-backgrounding\">--disable-renderer-backgrounding</a></h3>\n<p>Предотвращает Chromium от понижения приоритета для невидимых страниц графических процессов.</p>\n<p>Этот параметр глобален для всех графических процессов, если Вы хотите отключить троттлинг в одном окне, Вы может использовать трюк с <a href=\"https://github.com/atom/atom/pull/9485/files\">проигрыванием беззвучных звуков</a>.</p>\n<h3 id=\"--disk-cache-sizeразмер\"><a href=\"#--disk-cache-sizeразмер\">--disk-cache-size=<code>размер</code></a></h3>\n<p>Максимальный размер кеша на жёстком диске в байтах.</p>\n<h3 id=\"--enable-api-filtering-logging\"><a href=\"#--enable-api-filtering-logging\">--enable-api-filtering-logging</a></h3>\n<p>Enables caller stack logging for the following APIs (filtering events):</p>\n<ul>\n<li><code>desktopCapturer.getSources()</code> / <code>desktop-capturer-get-sources</code></li>\n</ul>\n<h3 id=\"--enable-loggingfile\"><a href=\"#--enable-loggingfile\">--enable-logging[=file]</a></h3>\n<p>Prints Chromium's logging to stderr (or a log file).</p>\n<p>The <code>ELECTRON_ENABLE_LOGGING</code> environment variable has the same effect as passing <code>--enable-logging</code>.</p>\n<p>Passing <code>--enable-logging</code> will result in logs being printed on stderr. Passing <code>--enable-logging=file</code> will result in logs being saved to the file specified by <code>--log-file=...</code>, or to <code>electron_debug.log</code> in the user-data directory if <code>--log-file</code> is not specified.</p>\n<blockquote>\n<p><strong>Note:</strong> On Windows, logs from child processes cannot be sent to stderr. Logging to a file is the most reliable way to collect logs on Windows.</p>\n</blockquote>\n<p>See also <code>--log-file</code>, <code>--log-level</code>, <code>--v</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--force-fieldtrialstrials\"><a href=\"#--force-fieldtrialstrials\">--force-fieldtrials=<code>trials</code></a></h3>\n<p>Field trials to be forcefully enabled or disabled.</p>\n<p>For example: <code>WebRTC-Audio-Red-For-Opus/Enabled/</code></p>\n<h3 id=\"--host-rulesправила\"><a href=\"#--host-rulesправила\">--host-rules=<code>правила</code></a></h3>\n<p>Список <code>правил</code>, разделённых точкой с запятой, которые контролируют как сопоставляются имена хостов.</p>\n<p>Например:</p>\n<ul>\n<li><code>MAP * 127.0.0.1</code> Все имена хостов будут перенаправлены на 127.0.0.1</li>\n<li><code>MAP *.google.com proxy</code> Заставляет все поддомены google.com обращаться к \"proxy\".</li>\n<li><code>MAP test.com [::1]:77</code> Forces \"test.com\" to resolve to IPv6 loopback. Также принудительно выставит порт получаемого адреса сокета, равный 77.</li>\n<li><code>MAP * baz, EXCLUDE www.google.com</code> Перенаправляет всё на \"baz\", за исключением \"www.google.com\".</li>\n</ul>\n<p>Эти перенаправления применяются к хосту конечной точки в сетевом запросе (TCP соединения и резолвер хоста в прямых соединениях, <code>CONNECT</code> в HTTP прокси-соединениях и хост конечной точки в <code>SOCKS</code> прокси-соединений).</p>\n<h3 id=\"--host-resolver-rulesправила\"><a href=\"#--host-resolver-rulesправила\">--host-resolver-rules=<code>правила</code></a></h3>\n<p>Как <code>--host-rules</code>, но эти <code>правила</code> применяются только к резолверу хоста.</p>\n<h3 id=\"--ignore-certificate-errors\"><a href=\"#--ignore-certificate-errors\">--ignore-certificate-errors</a></h3>\n<p>Игнорировать ошибки, связанные с сертификатами.</p>\n<h3 id=\"--ignore-connections-limitдомены\"><a href=\"#--ignore-connections-limitдомены\">--ignore-connections-limit=<code>домены</code></a></h3>\n<p>Игнорировать лимит подключения для списка <code>доменов</code>, разделённых <code>,</code>.</p>\n<h3 id=\"--js-flagsфлаги\"><a href=\"#--js-flagsфлаги\">--js-flags=<code>флаги</code></a></h3>\n<p>Specifies the flags passed to the Node.js engine. Если вы хотите включить <code>flags</code> в главном процессе, то он должен быть передан при запуске Electron.</p>\n<pre><code class=\"hljs language-sh\">$ electron --js-flags=<span class=\"hljs-string\">\"--harmony_proxies --harmony_collections\"</span> your-app\n</code></pre>\n<p>Смотрите <a href=\"https://nodejs.org/api/cli.html\">документацию Node.js</a> или запустите <code>node --help</code> в командной строке для списка доступных флагов. Дополнительно, запустите <code>node --v8-options</code> для просмотра списка флагов, которые касаются JavaScript движка V8 в Node.js.</p>\n<h3 id=\"--lang\"><a href=\"#--lang\">--lang</a></h3>\n<p>Установить пользовательский язык.</p>\n<h3 id=\"--log-filepath\"><a href=\"#--log-filepath\">--log-file=<code>path</code></a></h3>\n<p>If <code>--enable-logging</code> is specified, logs will be written to the given path. The parent directory must exist.</p>\n<p>Setting the <code>ELECTRON_LOG_FILE</code> environment variable is equivalent to passing this flag. If both are present, the command-line switch takes precedence.</p>\n<h3 id=\"--log-net-logпуть\"><a href=\"#--log-net-logпуть\">--log-net-log=<code>путь</code></a></h3>\n<p>Включает логи сетевых событий для сохранения и записывает их в <code>путь</code>.</p>\n<h3 id=\"--log-leveln\"><a href=\"#--log-leveln\">--log-level=<code>N</code></a></h3>\n<p>Sets the verbosity of logging when used together with <code>--enable-logging</code>. <code>N</code> should be one of <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h?q=logging::LogSeverity&#x26;ss=chromium\">Chrome's LogSeverities</a>.</p>\n<p>Note that two complimentary logging mechanisms in Chromium -- <code>LOG()</code> and <code>VLOG()</code> -- are controlled by different switches. <code>--log-level</code> controls <code>LOG()</code> messages, while <code>--v</code> and <code>--vmodule</code> control <code>VLOG()</code> messages. So you may want to use a combination of these three switches depending on the granularity you want and what logging calls are made by the code you're trying to watch.</p>\n<p>See <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h\">Chromium Logging source</a> for more information on how <code>LOG()</code> and <code>VLOG()</code> interact. Loosely speaking, <code>VLOG()</code> can be thought of as sub-levels / per-module levels inside <code>LOG(INFO)</code> to control the firehose of <code>LOG(INFO)</code> data.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, <code>--v</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--no-proxy-server\"><a href=\"#--no-proxy-server\">--no-proxy-server</a></h3>\n<p>Не использовать прокси сервер и всегда делать прямые соединения. Переопределяет все остальные флаги прокси-сервера, которые были указаны.</p>\n<h3 id=\"--no-sandbox\"><a href=\"#--no-sandbox\">--no-sandbox</a></h3>\n<p>Disables the Chromium <a href=\"https://www.chromium.org/developers/design-documents/sandbox\">sandbox</a>. Forces renderer process and Chromium helper processes to run un-sandboxed. Should only be used for testing.</p>\n<h3 id=\"--proxy-bypass-listхосты\"><a href=\"#--proxy-bypass-listхосты\">--proxy-bypass-list=<code>хосты</code></a></h3>\n<p>Указывает Electron обходить прокси-сервер для списка хостов, разделённых точкой с запятой. Этот флаг действует только в том случае, если он используется вместе с <code>--proxy-server</code>.</p>\n<p>Например:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'proxy-bypass-list'</span>, <span class=\"hljs-string\">'&#x3C;local>;*.google.com;*foo.com;1.2.3.4:5678'</span>)\n</code></pre>\n<p>Будет использовать прокси сервер для всех хостов, за исключением локальных адресов (<code>localhost</code>, <code>127.0.0.1</code> и т. д.), <code>google.com</code> поддоменов, хостов которые содержат <code>foo.com</code> и <code>1.2.3.4:5678</code>.</p>\n<h3 id=\"--proxy-pac-urlссылка\"><a href=\"#--proxy-pac-urlссылка\">--proxy-pac-url=<code>ссылка</code></a></h3>\n<p>Использовать PAC скрипт для указанного <code>url</code>.</p>\n<h3 id=\"--proxy-serverадреспорт\"><a href=\"#--proxy-serverадреспорт\">--proxy-server=<code>адрес:порт</code></a></h3>\n<p>Использует указанный proxy сервер, который перезаписывает системные настройки. Этот параметр влияет только на запросы HTTP протокола, включая HTTPS и WebSocket. Примечательно также, что не все proxy серверы поддерживают HTTPS и WebSocket протоколы. В URL для прокси не поддерживается указание имени пользователя и пароля для аутентификации, <a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=615947\">из-за проблемы в Chromium</a>.</p>\n<h3 id=\"--remote-debugging-portпорт\"><a href=\"#--remote-debugging-portпорт\">--remote-debugging-port=<code>порт</code></a></h3>\n<p>Включает удалённую отладку через HTTP для указанного <code>порта</code>.</p>\n<h3 id=\"--vуровень_логирования\"><a href=\"#--vуровень_логирования\">--v=<code>уровень_логирования</code></a></h3>\n<p>Gives the default maximal active V-logging level; 0 is the default. Normally positive values are used for V-logging levels.</p>\n<p>Этот параметр работает только когда <code>--enable-logging</code> также указан.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--vmoduleшаблон\"><a href=\"#--vmoduleшаблон\">--vmodule=<code>шаблон</code></a></h3>\n<p>Дает на каждый модуль максимальный уровень V-логирования, чтобы переопределить значения, заданное <code>--v</code>. Например, <code>my_module=2,foo*=3</code> would change the logging level for all code in source files <code>my_module.*</code> and <code>foo*.*</code>.</p>\n<p>Любой шаблон, содержащий переднюю или обратную косую черту, будет протестирован против всего пути, а не только модуля. Например, <code>*/foo/bar/*=2</code> would change the logging level for all code in the source files under a <code>foo/bar</code> directory.</p>\n<p>Этот параметр работает только когда <code>--enable-logging</code> также указан.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, and <code>--v</code>.</p>\n<h3 id=\"--force_high_performance_gpu\"><a href=\"#--force_high_performance_gpu\">--force_high_performance_gpu</a></h3>\n<p>Force using discrete GPU when there are multiple GPUs available.</p>\n<h3 id=\"--force_low_power_gpu\"><a href=\"#--force_low_power_gpu\">--force_low_power_gpu</a></h3>\n<p>Force using integrated GPU when there are multiple GPUs available.</p>\n<h2 id=\"nodejs-flags\"><a href=\"#nodejs-flags\">Node.js Flags</a></h2>\n<p>Electron поддерживает некоторые из флагов <a href=\"https://nodejs.org/api/cli.html\">CLI</a>, поддерживаемых Node.js.</p>\n<p><strong>Note:</strong> Passing unsupported command line switches to Electron when it is not running in <code>ELECTRON_RUN_AS_NODE</code> will have no effect.</p>\n<h3 id=\"--inspect-brkhostport\"><a href=\"#--inspect-brkhostport\">--inspect-brk[=[host:]port]</a></h3>\n<p>Activate inspector on host:port and break at start of user script. Default host:port is 127.0.0.1:9229.</p>\n<p>Aliased to <code>--debug-brk=[host:]port</code>.</p>\n<h3 id=\"--inspect-porthostport\"><a href=\"#--inspect-porthostport\">--inspect-port=[host:]port</a></h3>\n<p>Set the <code>host:port</code> to be used when the inspector is activated. Useful when activating the inspector by sending the SIGUSR1 signal. Default host is <code>127.0.0.1</code>.</p>\n<p>Aliased to <code>--debug-port=[host:]port</code>.</p>\n<h3 id=\"--inspecthostport\"><a href=\"#--inspecthostport\">--inspect[=[host:]port]</a></h3>\n<p>Activate inspector on <code>host:port</code>. По умолчанию - <code>127.0.0.1:9229</code>.</p>\n<p>V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug and profile Electron instances. The tools attach to Electron instances via a TCP port and communicate using the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">Chrome DevTools Protocol</a>.</p>\n<p>Смотрите <a href=\"/docs/tutorial/debugging-main-process\">Руководство по отладке главного процесса</a> для получения более подробной информации.</p>\n<p>Aliased to <code>--debug[=[host:]port</code>.</p>\n<h3 id=\"--inspect-publish-uidstderrhttp\"><a href=\"#--inspect-publish-uidstderrhttp\">--inspect-publish-uid=stderr,http</a></h3>\n<p>Specify ways of the inspector web socket url exposure.</p>\n<p>By default inspector websocket url is available in stderr and under /json/list endpoint on <a href=\"http://host:port/json/list\">http://host:port/json/list</a>.</p>",
      "title": "Поддерживаемые параметры командной строки",
      "description": "Параметры командной строки поддерживаемые Electron."
    },
    "/docs/api/content-tracing": {
      "locale": "ru-RU",
      "slug": "content-tracing",
      "href": "/docs/api/content-tracing",
      "crowdinFileId": "256297",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/content-tracing.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"contenttracing\"><a href=\"#contenttracing\">contentTracing</a></h1>\n<blockquote>\n<p>Собирает данные трассировки из содержимого модуля Chromium для поиска узких мест производительности и медленных операций.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p>Этот модуль не содержит веб-интерфейса. Для просмотра записанных треков, используйте <a href=\"https://chromium.googlesource.com/catapult/+/HEAD/tracing/README.md\">trace viewer</a>, доступного по адресу <code>chrome://tracing</code> в Chrome.</p>\n<p><strong>Примечание:</strong> Вам не следует использовать данный модуль до тех пор, пока событие <code>ready</code> модуля app не произошло.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, contentTracing } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  (<span class=\"hljs-keyword\">async</span> () => {\n    <span class=\"hljs-keyword\">await</span> contentTracing.startRecording({\n      <span class=\"hljs-attr\">included_categories</span>: [<span class=\"hljs-string\">'*'</span>]\n    })\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Tracing started'</span>)\n    <span class=\"hljs-keyword\">await</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> setTimeout(resolve, <span class=\"hljs-number\">5000</span>))\n    <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> contentTracing.stopRecording()\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Tracing data recorded to '</span> + path)\n  })()\n})\n</code></pre>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code> contentTracing</code> имеет следующие методы:</p>\n<h3 id=\"contenttracinggetcategories\"><a href=\"#contenttracinggetcategories\"><code>contentTracing.getCategories()</code></a></h3>\n<p>Возвращает <code>Promise&#x3C;String[]></code> - возвращает массив групп категорий, как только все дочерние процессы признают запрос <code>getCategories</code></p>\n<p>Получить набор групп категорий. Группы категорий могут меняться при достижении новых путей кода. Смотрите также <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">список встроенных категорий трассировки</a>.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Electron adds a non-default tracing category called <code>\"electron\"</code>. This category can be used to capture Electron-specific tracing events.</p>\n</blockquote>\n<h3 id=\"contenttracingstartrecordingoptions\"><a href=\"#contenttracingstartrecordingoptions\"><code>contentTracing.startRecording(options)</code></a></h3>\n<ul>\n<li><code>options</code> (<a href=\"/docs/api/structures/trace-config\">TraceConfig</a> | <a href=\"/docs/api/structures/trace-categories-and-options\">TraceCategoriesAndOptions</a>)</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code> - возвращается, как только все дочерние процессы признают запрос <code>startRecording</code>.</p>\n<p>Начинает запись во всех процессах.</p>\n<p>Запись начинается незамедлительно локально и ассинхронно в дочерних процессах, как только они получили запрос EnableRecording.</p>\n<p>Если запись уже запущена, promise будет немедленно разрешен, поскольку одновременно может выполняться только одна операция трассировки.</p>\n<h3 id=\"contenttracingstoprecordingresultfilepath\"><a href=\"#contenttracingstoprecordingresultfilepath\"><code>contentTracing.stopRecording([resultFilePath])</code></a></h3>\n<ul>\n<li><code>resultFilePath</code> String (опционально)</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;String></code> - возвращает путь к файлу, который содержит данные трассировки, как только все дочерние процессы признают запрос <code>stopRecording</code></p>\n<p>Останавливает запись во всех процессах.</p>\n<p>Дочерние процессы кэшируют данные трассировки и только изредка очищают и отправляют эти данные обратно в главный процесс. Это помогает свести к минимуму издержки трассировки, так как отправка данных трассировки через IPC может быть дорогостоящей операцией. Поэтому, чтобы окончить Chromium ассинхронно запрашивает все дочерние процессы, чтобы очистить оставшиеся данные трассировки.</p>\n<p>Данные трассировки будут записаны в <code>resultFilePath</code>. Если <code>resultFilePath</code> является пустым или не указано, Данные трассировки будут записаны во временный файл, и путь будет возвращен в promise.</p>\n<h3 id=\"contenttracinggettracebufferusage\"><a href=\"#contenttracinggettracebufferusage\"><code>contentTracing.getTraceBufferUsage()</code></a></h3>\n<p>Возвращает <code>Promise &#x3C;Object> </code> - разрешается с объектом, содержащим <code>value</code> и <code>percentage</code> максимального использования буфера трассировки</p>\n<ul>\n<li><code>value</code> Number</li>\n<li><code>percentage</code> Number</li>\n</ul>\n<p>Максимальное использование в различных процессах буфера трассировки в процентах от полного состояния.</p>",
      "title": "contentTracing",
      "description": "Собирает данные трассировки из содержимого модуля Chromium для поиска узких мест производительности и медленных операций."
    },
    "/docs/api/context-bridge": {
      "locale": "ru-RU",
      "slug": "context-bridge",
      "href": "/docs/api/context-bridge",
      "crowdinFileId": "256299",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/context-bridge.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"contextbridge\"><a href=\"#contextbridge\">contextBridge</a></h1>\n<blockquote>\n<p>Создает безопасный, двунаправленный, синхронный мост через изолированные контексты</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#renderer-process\">Графический</a></p>\n<p>Пример предоставления API-интерфейса средству визуализации из изолированного сценария предварительной загрузки приведен ниже:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Предварительная загрузка (Isolated World/Изолированный Мир)</span>\n<span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(\n  <span class=\"hljs-string\">'electron'</span>,\n  {\n    <span class=\"hljs-attr\">doThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.send(<span class=\"hljs-string\">'do-a-thing'</span>)\n  }\n)\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Рендер (Main World/Основной Мир)</span>\n\n<span class=\"hljs-built_in\">window</span>.electron.doThing()\n</code></pre>\n<h2 id=\"глоссарий\"><a href=\"#глоссарий\">Глоссарий</a></h2>\n<h3 id=\"main-world--основной-мир\"><a href=\"#main-world--основной-мир\">Main World / Основной Мир</a></h3>\n<p>\"Main World\" - это контекст javascript, в котором запускается ваш основной код рендера. По умолчанию загружаемая вами страница выполняет код в этом контексте.</p>\n<h3 id=\"isolated-world--изолированный-мир\"><a href=\"#isolated-world--изолированный-мир\">Isolated World / Изолированный Мир</a></h3>\n<p>Когда <code>contextIsolation</code> включен в вашем <code>webPreferences</code> (Это стандартное поведение в Electron 12.0.0) ваши <code>preload</code> скрипты выполняются в \"Isolated World\".  Вы можете прочитать больше о контекстной изоляции и на что это влияет в документации <a href=\"/docs/tutorial/security#3-enable-context-isolation-for-remote-content\">BrowserWindow</a>.</p>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code>contextBridge</code> имеет следующие методы:</p>\n<h3 id=\"contextbridgeexposeinmainworldapikey-api\"><a href=\"#contextbridgeexposeinmainworldapikey-api\"><code>contextBridge.exposeInMainWorld(apiKey, api)</code></a></h3>\n<ul>\n<li><code>apiKey</code> String - Ключ для вставки API в <code>window</code>.  API будет доступен в <code>window[apiKey]</code>.</li>\n<li><code>api</code> Record - Ваш объект API, более подробная информация о том, что это и как он будет работать, доступна ниже.</li>\n</ul>\n<h2 id=\"usage\"><a href=\"#usage\">Usage</a></h2>\n<h3 id=\"api\"><a href=\"#api\">API</a></h3>\n<p>Объект <code>api</code>, предоставленный для <a href=\"#contextbridgeexposeinmainworldapikey-api\"><code>exposeInMainWorld</code></a>, должен быть объектом, ключи которого являются строками, а значения являются <code>Function</code>, <code>String</code>, <code>Number</code>, <code>Array</code>, <code>Boolean</code> или другой вложенный объект, удовлетворяющий тем же условиям.</p>\n<p>Значения <code>Function</code> передаются в другой контекст, а все остальные значения <strong>копируются</strong> и <strong>заморожены</strong>. То есть Любые данные / примитивы, отправленные в объекте API, становятся неизменяемыми, и обновления на любой стороне моста не приводят к обновлению на другой стороне.</p>\n<p>Пример сложного объекта API показан ниже:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(\n  <span class=\"hljs-string\">'electron'</span>,\n  {\n    <span class=\"hljs-attr\">doThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.send(<span class=\"hljs-string\">'do-a-thing'</span>),\n    <span class=\"hljs-attr\">myPromises</span>: [<span class=\"hljs-built_in\">Promise</span>.resolve(), <span class=\"hljs-built_in\">Promise</span>.reject(<span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'whoops'</span>))],\n    <span class=\"hljs-attr\">anAsyncFunction</span>: <span class=\"hljs-keyword\">async</span> () => <span class=\"hljs-number\">123</span>,\n    <span class=\"hljs-attr\">data</span>: {\n      <span class=\"hljs-attr\">myFlags</span>: [<span class=\"hljs-string\">'a'</span>, <span class=\"hljs-string\">'b'</span>, <span class=\"hljs-string\">'c'</span>],\n      <span class=\"hljs-attr\">bootTime</span>: <span class=\"hljs-number\">1234</span>\n    },\n    <span class=\"hljs-attr\">nestedAPI</span>: {\n      <span class=\"hljs-attr\">evenDeeper</span>: {\n        <span class=\"hljs-attr\">youCanDoThisAsMuchAsYouWant</span>: {\n          <span class=\"hljs-attr\">fn</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ({\n            <span class=\"hljs-attr\">returnData</span>: <span class=\"hljs-number\">123</span>\n          })\n        }\n      }\n    }\n  }\n)\n</code></pre>\n<h3 id=\"функции-api\"><a href=\"#функции-api\">Функции API</a></h3>\n<p>Значения <code>Function</code>, которые вы связываете через <code>contextBridge</code>, передаются через Electron, чтобы гарантировать, что контексты остаются изолированными.  Это приводит к некоторым ключевым ограничениям, которые мы описали ниже.</p>\n<h4 id=\"параметр--ошибка--поддержка-возвращаемого-типа\"><a href=\"#параметр--ошибка--поддержка-возвращаемого-типа\">Параметр / Ошибка / Поддержка возвращаемого типа</a></h4>\n<p>Поскольку параметры, ошибки и возвращаемые значения <strong>скопированы</strong> при отправке через мост, существуют только определенные типы, которые могут быть использованы. На высоком уровне, если тип, который вы хотите использовать, может быть сериализован и десериализован в один и тот же объект, то он будет работать.  A table of type support has been included below for completeness:</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Тип</th><th>Сложность</th><th>Поддержка параметров</th><th>Возврат значения поддержки</th><th>Ограничения</th></tr></thead><tbody><tr><td><code>String</code></td><td>Простой</td><td>✅</td><td>✅</td><td>Нет</td></tr><tr><td><code>Number</code></td><td>Простой</td><td>✅</td><td>✅</td><td>Нет</td></tr><tr><td><code>Boolean</code></td><td>Простой</td><td>✅</td><td>✅</td><td>Нет</td></tr><tr><td><code>Object</code></td><td>Сложный</td><td>✅</td><td>✅</td><td>Ключи должны поддерживаться «Простыми» типами в этой таблице.  Значения должны поддерживаться в этой таблице.  Модификации прототипа отбрасываются.  Отправка пользовательских классов будет копировать значения, но не прототип.</td></tr><tr><td><code>Array</code></td><td>Сложный</td><td>✅</td><td>✅</td><td>Те же ограничения, что и в типе <code>Object</code></td></tr><tr><td><code>Error</code></td><td>Сложный</td><td>✅</td><td>✅</td><td>Ошибки, которые выбрасываются также копируются, это может привести к тому, что сообщение и трассировка стека ошибки немного изменятся из-за того, что они будут выброшены в другом контексте</td></tr><tr><td><code>Promise</code></td><td>Сложный</td><td>✅</td><td>✅</td><td>Промисы передаются только если они являются возвращаемым значением или точным параметром.  Промисы, вложенные в массивы или объекты, будут удалены.</td></tr><tr><td><code>Function</code></td><td>Сложный</td><td>✅</td><td>✅</td><td>Модификации прототипа отбрасываются.  Отправка классов или конструкторов не будет работать.</td></tr><tr><td><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Cloneable Types</a></td><td>Простой</td><td>✅</td><td>✅</td><td>Смотрите связанный документ по клонируемым типам</td></tr><tr><td><code>Element</code></td><td>Сложный</td><td>✅</td><td>✅</td><td>Модификации прототипа отбрасываются.  Отправка пользовательских элементов не будет работать.</td></tr><tr><td><code>Blob</code></td><td>Сложный</td><td>✅</td><td>✅</td><td>Нет</td></tr><tr><td><code>Symbol</code></td><td>Нет</td><td>❌</td><td>❌</td><td>Символы не могут быть скопированы в разных контекстах, поэтому они отбрасываются</td></tr></tbody></table>\n<p>Если тип, о котором вы хотите использовать, не находится в приведенной выше таблице, то он, вероятно, не поддерживается.</p>\n<h3 id=\"exposing-node-global-symbols\"><a href=\"#exposing-node-global-symbols\">Exposing Node Global Symbols</a></h3>\n<p><code>contextBridge</code> может использоваться скриптом preload для предоставления вашему устройству доступа к узлам API. Таблица поддерживаемых типов, описанная выше, также применяется к Node API, которые вы используете через <code>contextBridge</code>. Пожалуйста, обратите внимание, что многие Node API предоставляют доступ к локальным системным ресурсам. Будьте очень осторожны относительно того, какие глобальные переменные и API вы предоставляете в ненадежном удаленном контенте.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> crypto = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'crypto'</span>)\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'nodeCrypto'</span>, {\n  sha256sum (data) {\n    <span class=\"hljs-keyword\">const</span> hash = crypto.createHash(<span class=\"hljs-string\">'sha256'</span>)\n    hash.update(data)\n    <span class=\"hljs-keyword\">return</span> hash.digest(<span class=\"hljs-string\">'hex'</span>)\n  }\n})\n</code></pre>",
      "title": "contextBridge",
      "description": "Создает безопасный, двунаправленный, синхронный мост через изолированные контексты"
    },
    "/docs/tutorial/context-isolation": {
      "locale": "ru-RU",
      "slug": "context-isolation",
      "href": "/docs/tutorial/context-isolation",
      "crowdinFileId": "256185",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/context-isolation.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"context-isolation\"><a href=\"#context-isolation\">Context Isolation</a></h1>\n<h2 id=\"what-is-it\"><a href=\"#what-is-it\">What is it?</a></h2>\n<p>Context Isolation is a feature that ensures that both your <code>preload</code> scripts and Electron's internal logic run in a separate context to the website you load in a <a href=\"/docs/api/web-contents\"><code>webContents</code></a>.  This is important for security purposes as it helps prevent the website from accessing Electron internals or the powerful APIs your preload script has access to.</p>\n<p>This means that the <code>window</code> object that your preload script has access to is actually a <strong>different</strong> object than the website would have access to.  For example, if you set <code>window.hello = 'wave'</code> in your preload script and context isolation is enabled, <code>window.hello</code> will be undefined if the website tries to access it.</p>\n<p>Context isolation has been enabled by default since Electron 12, and it is a recommended security setting for <em>all applications</em>.</p>\n<h2 id=\"migration\"><a href=\"#migration\">Migration</a></h2>\n<blockquote>\n<p>Without context isolation, I used to provide APIs from my preload script using <code>window.X = apiObject</code>. Now what?</p>\n</blockquote>\n<h3 id=\"before-context-isolation-disabled\"><a href=\"#before-context-isolation-disabled\">Before: context isolation disabled</a></h3>\n<p>Exposing APIs from your preload script to a loaded website in the renderer process is a common use-case. With context isolation disabled, your preload script would share a common global <code>window</code> object with the renderer. You could then attach arbitrary properties to a preload script:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// preload with contextIsolation disabled</span>\n<span class=\"hljs-built_in\">window</span>.myAPI = {\n  <span class=\"hljs-attr\">doAThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {}\n}\n</code></pre>\n<p>The <code>doAThing()</code> function could then be used directly in the renderer process:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// use the exposed API in the renderer</span>\n<span class=\"hljs-built_in\">window</span>.myAPI.doAThing()\n</code></pre>\n<h3 id=\"after-context-isolation-enabled\"><a href=\"#after-context-isolation-enabled\">After: context isolation enabled</a></h3>\n<p>There is a dedicated module in Electron to help you do this in a painless way. The <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> module can be used to <strong>safely</strong> expose APIs from your preload script's isolated context to the context the website is running in. The API will also be accessible from the website on <code>window.myAPI</code> just like it was before.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// preload with contextIsolation enabled</span>\n<span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">doAThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {}\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// use the exposed API in the renderer</span>\n<span class=\"hljs-built_in\">window</span>.myAPI.doAThing()\n</code></pre>\n<p>Please read the <code>contextBridge</code> documentation linked above to fully understand its limitations. For instance, you can't send custom prototypes or symbols over the bridge.</p>\n<h2 id=\"security-considerations\"><a href=\"#security-considerations\">Security considerations</a></h2>\n<p>Just enabling <code>contextIsolation</code> and using <code>contextBridge</code> does not automatically mean that everything you do is safe. For instance, this code is <strong>unsafe</strong>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// ❌ Bad code</span>\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">send</span>: ipcRenderer.send\n})\n</code></pre>\n<p>It directly exposes a powerful API without any kind of argument filtering. This would allow any website to send arbitrary IPC messages, which you do not want to be possible. The correct way to expose IPC-based APIs would instead be to provide one method per IPC message.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// ✅ Good code</span>\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">loadPreferences</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'load-prefs'</span>)\n})\n</code></pre>\n<h2 id=\"usage-with-typescript\"><a href=\"#usage-with-typescript\">Usage with TypeScript</a></h2>\n<p>If you're building your Electron app with TypeScript, you'll want to add types to your APIs exposed over the context bridge. The renderer's <code>window</code> object won't have the correct typings unless you extend the types with a <a href=\"https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html\">declaration file</a>.</p>\n<p>For example, given this <code>preload.ts</code> script:</p>\n<pre><code class=\"hljs language-typescript\">contextBridge.exposeInMainWorld(<span class=\"hljs-string\">'electronAPI'</span>, {\n  loadPreferences: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'load-prefs'</span>)\n})\n</code></pre>\n<p>You can create a <code>renderer.d.ts</code> declaration file and globally augment the <code>Window</code> interface:</p>\n<pre><code class=\"hljs language-typescript\"><span class=\"hljs-keyword\">export</span> <span class=\"hljs-keyword\">interface</span> IElectronAPI {\n  loadPreferences: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-built_in\">Promise</span>&#x3C;<span class=\"hljs-built_in\">void</span>>,\n}\n\n<span class=\"hljs-keyword\">declare</span> global {\n  <span class=\"hljs-keyword\">interface</span> Window {\n    electronAPI: IElectronAPI\n  }\n}\n</code></pre>\n<p>Doing so will ensure that the TypeScript compiler will know about the <code>electronAPI</code> property on your global <code>window</code> object when writing scripts in your renderer process:</p>\n<pre><code class=\"hljs language-typescript\"><span class=\"hljs-built_in\">window</span>.electronAPI.loadPreferences()\n</code></pre>",
      "title": "Context Isolation",
      "description": "Without context isolation, I used to provide APIs from my preload script using window.X = apiObject. Now what?"
    },
    "/docs/api/structures/cookie": {
      "locale": "ru-RU",
      "slug": "cookie",
      "href": "/docs/api/structures/cookie",
      "crowdinFileId": "256417",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/cookie.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"cookie-object\"><a href=\"#cookie-object\">Cookie Object</a></h1>\n<ul>\n<li><code>name</code> String - The name of the cookie.</li>\n<li><code>value</code> String - The value of the cookie.</li>\n<li><code>domain</code> String (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains.</li>\n<li><code>hostOnly</code> Boolean (optional) - Whether the cookie is a host-only cookie; this will only be <code>true</code> if no domain was passed.</li>\n<li><code>path</code> String (optional) - The path of the cookie.</li>\n<li><code>secure</code> Boolean (optional) - Whether the cookie is marked as secure.</li>\n<li><code>httpOnly</code> Boolean (optional) - Whether the cookie is marked as HTTP only.</li>\n<li><code>session</code> Boolean (optional) - Whether the cookie is a session cookie or a persistent cookie with an expiration date.</li>\n<li><code>expirationDate</code> Double (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies.</li>\n<li><code>sameSite</code> String - The <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies\">Same Site</a> policy applied to this cookie.  Can be <code>unspecified</code>, <code>no_restriction</code>, <code>lax</code> or <code>strict</code>.</li>\n</ul>",
      "title": "Cookie Object",
      "description": ""
    },
    "/docs/api/cookies": {
      "locale": "ru-RU",
      "slug": "cookies",
      "href": "/docs/api/cookies",
      "crowdinFileId": "256301",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/cookies.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-cookies\"><a href=\"#class-cookies\">Class: Cookies</a></h2>\n<blockquote>\n<p>Запрашивайте и изменяйте cookie.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Экземпляры класса <code>Cookies</code> доступны через свойство <code>cookies</code> объекта <code>Session</code>.</p>\n<p>Например:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Запрос всех cookies.</span>\nsession.defaultSession.cookies.get({})\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">cookies</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(cookies)\n  }).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">error</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(error)\n  })\n\n<span class=\"hljs-comment\">// Запрос всех cookies, связанных с определенным Url.</span>\nsession.defaultSession.cookies.get({ <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'http://www.github.com'</span> })\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">cookies</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(cookies)\n  }).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">error</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(error)\n  })\n\n<span class=\"hljs-comment\">// Установить cookie с данными объекта cookie;</span>\n<span class=\"hljs-comment\">// перезаписывает эквивалентные cookie, если такие есть.</span>\n<span class=\"hljs-keyword\">const</span> cookie = { <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'http://www.github.com'</span>, <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'dummy_name'</span>, <span class=\"hljs-attr\">value</span>: <span class=\"hljs-string\">'dummy'</span> }\nsession.defaultSession.cookies.set(cookie)\n  .then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// success</span>\n  }, (error) => {\n    <span class=\"hljs-built_in\">console</span>.error(error)\n  })\n</code></pre>\n<h3 id=\"события-экземпляра\"><a href=\"#события-экземпляра\">События экземпляра</a></h3>\n<p>Для экземпляров <code>Cookies</code> доступны следующие события:</p>\n<h4 id=\"событие-changed\"><a href=\"#событие-changed\">Событие: 'changed'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>cookie</code> <a href=\"/docs/api/structures/cookie\">Cookie</a> - Cookie, который был изменен.</li>\n<li><code>cause</code> String - The cause of the change with one of the following values:<ul>\n<li><code>explic</code> - Cookie был изменен непосредственно действием потребителя.</li>\n<li><code>overwrite</code> - Cookie был автоматически удален из-за операции вставки, которая перезаписала его.</li>\n<li><code>expired</code> - Cookie был автоматически удален по истечении срока его действия.</li>\n<li><code>evicted</code> - Cookie был автоматически исключен во время сбора мусора.</li>\n<li><code>expired-overwrite</code> - Cookie был перезаписан с уже истекшим сроком действия.</li>\n</ul></li>\n<li><code>removed</code> Boolean - <code>true</code> если cookie был удален, в противном случае <code>false</code>.</li>\n</ul>\n<p>Возникает при изменении cookie, так как она была добавлена, изменена, удалена или истекла.</p>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<p>В экземпляре <code>Cookies</code> доступны следующие методы:</p>\n<h4 id=\"cookiesgetfilter\"><a href=\"#cookiesgetfilter\"><code>cookies.get(filter)</code></a></h4>\n<ul>\n<li>Объект <code>filter</code><ul>\n<li><code>url</code> String (optional) - Retrieves cookies which are associated with <code>url</code>. Empty implies retrieving cookies of all URLs.</li>\n<li><code>name</code> String (опционально) - Фильтрует cookies по имени.</li>\n<li><code>domain</code> String (опционально) - Изменяет cookies, чьи домены совпадают или являются поддоменами <code>domains</code>.</li>\n<li><code>path</code> String (опционально) - Извлекает cookies чей путь совпадает с <code>path</code>.</li>\n<li><code>secure</code> Boolean (опционально) - Фильтрует cookies по их защищенному свойству.</li>\n<li><code>session</code> Boolean (опционально) - Отфильтровывает сеансовые или постоянные файлы cookie.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;Cookie[]></code> - промисы, которые разрешают массив Cookie объектов.</p>\n<p>Отправляет запрос на получение всех cookies, соответствующих <code>filter</code>, и выдает promise с ответом.</p>\n<h4 id=\"cookiessetdetails\"><a href=\"#cookiessetdetails\"><code>cookies.set(details)</code></a></h4>\n<ul>\n<li>Объект <code>details</code><ul>\n<li><code>url</code> String - The URL to associate the cookie with. The promise will be rejected if the URL is invalid.</li>\n<li><code>name</code> String (optional) - The name of the cookie. Empty by default if omitted.</li>\n<li><code>value</code> String (optional) - The value of the cookie. Empty by default if omitted.</li>\n<li><code>domain</code> String (опционально) - домен cookie; это будет нормализовано с предыдущей точкой, чтобы он также был действителен для поддоменов. Empty by default if omitted.</li>\n<li><code>path</code> String (опционально) - Путь к cookie. Empty by default if omitted.</li>\n<li><code>secure</code> Boolean (optional) - Whether the cookie should be marked as Secure. Defaults to false unless <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite#samesitenone_requires_secure\">Same Site=None</a> attribute is used.</li>\n<li><code>httpOnly</code> Boolean (optional) - Whether the cookie should be marked as HTTP only. По умолчанию - false.</li>\n<li><code>expirationDate</code> Double (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted then the cookie becomes a session cookie and will not be retained between sessions.</li>\n<li><code>sameSite</code> String (optional) - The <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies\">Same Site</a> policy to apply to this cookie.  Может быть <code>unspecified</code>, <code>no_restriction</code>, <code>lax</code> или <code>strict</code>.  По умолчанию - <code>no_restriction</code>.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code> - Promise, которое разрешается после установки файла cookie</p>\n<p>Устанавливает cookie с <code>details</code>.</p>\n<h4 id=\"cookiesremoveurl-name\"><a href=\"#cookiesremoveurl-name\"><code>cookies.remove(url, name)</code></a></h4>\n<ul>\n<li><code>url</code> String - URL-дарес, связанный с cookie.</li>\n<li><code>name</code> String - Название cookie для удаления.</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code> - Promise, которое разрешается после удаления файла cookie</p>\n<p>Удаляет cookies, соответствующие <code>url</code> и <code>name</code></p>\n<h4 id=\"cookiesflushstore\"><a href=\"#cookiesflushstore\"><code>cookies.flushStore()</code></a></h4>\n<p>Возвращает <code>Promise&#x3C;void></code> - Promise, которое разрешается, когда хранилище cookie было очищено</p>\n<p>Записывает непрочитанные cookies на диск.</p>",
      "title": "Cookies",
      "description": "Запрашивайте и изменяйте cookie."
    },
    "/docs/api/structures/cpu-usage": {
      "locale": "ru-RU",
      "slug": "cpu-usage",
      "href": "/docs/api/structures/cpu-usage",
      "crowdinFileId": "256419",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/cpu-usage.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"cpuusage-object\"><a href=\"#cpuusage-object\">CPUUsage Object</a></h1>\n<ul>\n<li><code>percentCPUUsage</code> Number - Percentage of CPU used since the last call to getCPUUsage. First call returns 0.</li>\n<li><code>idleWakeupsPerSecond</code> Number - The number of average idle CPU wakeups per second since the last call to getCPUUsage. First call returns 0. Will always return 0 on Windows.</li>\n</ul>",
      "title": "CPUUsage Object",
      "description": ""
    },
    "/docs/api/structures/crash-report": {
      "locale": "ru-RU",
      "slug": "crash-report",
      "href": "/docs/api/structures/crash-report",
      "crowdinFileId": "256421",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/crash-report.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"crashreport-object\"><a href=\"#crashreport-object\">CrashReport Object</a></h1>\n<ul>\n<li><code>date</code> Date</li>\n<li><code>id</code> String</li>\n</ul>",
      "title": "CrashReport Object",
      "description": ""
    },
    "/docs/api/crash-reporter": {
      "locale": "ru-RU",
      "slug": "crash-reporter",
      "href": "/docs/api/crash-reporter",
      "crowdinFileId": "256303",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/crash-reporter.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"crashreporter\"><a href=\"#crashreporter\">crashReporter</a></h1>\n<blockquote>\n<p>Отправляйте отчёты об ошибках на удалённый сервер.</p>\n</blockquote>\n<p>Процессы: <a href=\"/docs/glossary#main-process\">Основной</a>, <a href=\"/docs/glossary#renderer-process\">Графический</a></p>\n<p>The following is an example of setting up Electron to automatically submit crash reports to a remote server:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { crashReporter } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncrashReporter.start({ <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://your-domain.com/url-to-submit'</span> })\n</code></pre>\n<p>Чтобы настроить сервер для приёма и обработки отчётов об ошибках, вы можете использовать эти проекты:</p>\n<ul>\n<li><a href=\"https://github.com/mozilla/socorro\">socorro</a></li>\n<li><a href=\"https://github.com/electron/mini-breakpad-server\">mini-breakpad-server</a></li>\n</ul>\n<p>Или используйте стороннее решение:</p>\n<ul>\n<li><a href=\"https://backtrace.io/electron/\">Backtrace</a></li>\n<li><a href=\"https://docs.sentry.io/clients/electron\">Sentry</a></li>\n<li><a href=\"https://www.bugsplat.com/docs/platforms/electron\">BugSplat</a></li>\n</ul>\n<p>Crash reports are stored temporarily before being uploaded in a directory underneath the app's user data directory (called 'Crashpad' on Windows and Mac, or 'Crash Reports' on Linux). You can override this directory by calling <code>app.setPath('crashDumps', '/path/to/crashes')</code> before starting the crash reporter.</p>\n<p>On Windows and macOS, Electron uses <a href=\"https://chromium.googlesource.com/crashpad/crashpad/+/master/README.md\">crashpad</a> to monitor and report crashes. On Linux, Electron uses <a href=\"https://chromium.googlesource.com/breakpad/breakpad/+/master/\">breakpad</a>. This is an implementation detail driven by Chromium, and it may change in future. In particular, crashpad is newer and will likely eventually replace breakpad on all platforms.</p>\n<h3 id=\"note-about-node-child-processes-on-linux\"><a href=\"#note-about-node-child-processes-on-linux\">Note about Node child processes on Linux</a></h3>\n<p>If you are using the Node.js <code>child_process</code> module and want to report crashes from those processes on Linux, there is an extra step you will need to take to properly initialize the crash reporter in the child process. This is not necessary on Mac or Windows, as those platforms use Crashpad, which automatically monitors child processes.</p>\n<p>Since <code>require('electron')</code> is not available in Node child processes, the following APIs are available on the <code>process</code> object in Node child processes. Note that, on Linux, each Node child process has its own separate instance of the breakpad crash reporter. This is dissimilar to renderer child processes, which have a \"stub\" breakpad reporter which returns information to the main process for reporting.</p>\n<h4 id=\"processcrashreporterstartoptions\"><a href=\"#processcrashreporterstartoptions\"><code>process.crashReporter.start(options)</code></a></h4>\n<p>See <a href=\"#crashreporterstartoptions\"><code>crashReporter.start()</code></a>.</p>\n<h4 id=\"processcrashreportergetparameters\"><a href=\"#processcrashreportergetparameters\"><code>process.crashReporter.getParameters()</code></a></h4>\n<p>See <a href=\"#crashreportergetparameters\"><code>crashReporter.getParameters()</code></a>.</p>\n<h4 id=\"processcrashreporteraddextraparameterkey-value\"><a href=\"#processcrashreporteraddextraparameterkey-value\"><code>process.crashReporter.addExtraParameter(key, value)</code></a></h4>\n<p>See <a href=\"#crashreporteraddextraparameterkey-value\"><code>crashReporter.addExtraParameter(key, value)</code></a>.</p>\n<h4 id=\"processcrashreporterremoveextraparameterkey\"><a href=\"#processcrashreporterremoveextraparameterkey\"><code>process.crashReporter.removeExtraParameter(key)</code></a></h4>\n<p>See <a href=\"#crashreporterremoveextraparameterkey\"><code>crashReporter.removeExtraParameter(key)</code></a>.</p>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code>crashReporter</code> имеет следующие методы:</p>\n<h3 id=\"crashreporterstartoptions\"><a href=\"#crashreporterstartoptions\"><code>crashReporter.start(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>submitURL</code> String (optional) - URL that crash reports will be sent to as POST. Required unless <code>uploadToServer</code> is <code>false</code>.</li>\n<li><code>productName</code> String (опционально) - Значение по умолчанию - <code>app.name</code>.</li>\n<li><code>companyName</code> String (optional) <em>Deprecated</em> - Deprecated alias for <code>{ globalExtra: { _companyName: ... } }</code>.</li>\n<li><code>uploadToServer</code> Boolean (optional) - Whether crash reports should be sent to the server. If false, crash reports will be collected and stored in the crashes directory, but not uploaded. По умолчанию - <code>true</code>.</li>\n<li><code>ignoreSystemCrashHandler</code> Boolean (optional) - If true, crashes generated in the main process will not be forwarded to the system crash handler. По умолчанию - <code>false</code>.</li>\n<li><code>rateLimit</code> Boolean (optional) <em>macOS</em> <em>Windows</em> - If true, limit the number of crashes uploaded to 1/hour. По умолчанию - <code>false</code>.</li>\n<li><code>compress</code> Boolean (optional) - If true, crash reports will be compressed and uploaded with <code>Content-Encoding: gzip</code>. По умолчанию - <code>true</code>.</li>\n<li><code>extra</code> Record&#x3C;String, String> (optional) - Extra string key/value annotations that will be sent along with crash reports that are generated in the main process. Only string values are supported. Crashes generated in child processes will not contain these extra parameters to crash reports generated from child processes, call <a href=\"#crashreporteraddextraparameterkey-value\"><code>addExtraParameter</code></a> from the child process.</li>\n<li><code>globalExtra</code> Record&#x3C;String, String> (optional) - Extra string key/value annotations that will be sent along with any crash reports generated in any process. These annotations cannot be changed once the crash reporter has been started. If a key is present in both the global extra parameters and the process-specific extra parameters, then the global one will take precedence. By default, <code>productName</code> and the app version are included, as well as the Electron version.</li>\n</ul></li>\n</ul>\n<p>This method must be called before using any other <code>crashReporter</code> APIs. Once initialized this way, the crashpad handler collects crashes from all subsequently created processes. The crash reporter cannot be disabled once started.</p>\n<p>This method should be called as early as possible in app startup, preferably before <code>app.on('ready')</code>. If the crash reporter is not initialized at the time a renderer process is created, then that renderer process will not be monitored by the crash reporter.</p>\n<p><strong>Note:</strong> You can test out the crash reporter by generating a crash using <code>process.crash()</code>.</p>\n<p><strong>Note:</strong> If you need to send additional/updated <code>extra</code> parameters after your first call <code>start</code> you can call <code>addExtraParameter</code>.</p>\n<p><strong>Note:</strong> Parameters passed in <code>extra</code>, <code>globalExtra</code> or set with <code>addExtraParameter</code> have limits on the length of the keys and values. Key names must be at most 39 bytes long, and values must be no longer than 127 bytes. Keys with names longer than the maximum will be silently ignored. Key values longer than the maximum length will be truncated.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportergetlastcrashreport\"><a href=\"#crashreportergetlastcrashreport\"><code>crashReporter.getLastCrashReport()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/crash-report\"><code>CrashReport</code></a> - The date and ID of the last crash report. Only crash reports that have been uploaded will be returned; even if a crash report is present on disk it will not be returned until it is uploaded. Если нет загруженных отчетов, возвращается <code>null</code>.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportergetuploadedreports\"><a href=\"#crashreportergetuploadedreports\"><code>crashReporter.getUploadedReports()</code></a></h3>\n<p>Возвращает <a href=\"/docs/api/structures/crash-report\"><code>CrashReport[]</code></a>:</p>\n<p>Returns all uploaded crash reports. Each report contains the date and uploaded ID.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportergetuploadtoserver\"><a href=\"#crashreportergetuploadtoserver\"><code>crashReporter.getUploadToServer()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether reports should be submitted to the server. Set through the <code>start</code> method or <code>setUploadToServer</code>.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportersetuploadtoserveruploadtoserver\"><a href=\"#crashreportersetuploadtoserveruploadtoserver\"><code>crashReporter.setUploadToServer(uploadToServer)</code></a></h3>\n<ul>\n<li><code>uploadToServer</code> Boolean - Whether reports should be submitted to the server.</li>\n</ul>\n<p>This would normally be controlled by user preferences. This has no effect if called before <code>start</code> is called.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreporteraddextraparameterkey-value\"><a href=\"#crashreporteraddextraparameterkey-value\"><code>crashReporter.addExtraParameter(key, value)</code></a></h3>\n<ul>\n<li><code>key</code> String - Parameter key, must be no longer than 39 bytes.</li>\n<li><code>value</code> String - Parameter value, must be no longer than 127 bytes.</li>\n</ul>\n<p>Установите дополнительный параметр, который будет отправлен с отчетом о сбое. The values specified here will be sent in addition to any values set via the <code>extra</code> option when <code>start</code> was called.</p>\n<p>Parameters added in this fashion (or via the <code>extra</code> parameter to <code>crashReporter.start</code>) are specific to the calling process. Adding extra parameters in the main process will not cause those parameters to be sent along with crashes from renderer or other child processes. Similarly, adding extra parameters in a renderer process will not result in those parameters being sent with crashes that occur in other renderer processes or in the main process.</p>\n<p><strong>Note:</strong> Parameters have limits on the length of the keys and values. Key names must be no longer than 39 bytes, and values must be no longer than 20320 bytes. Keys with names longer than the maximum will be silently ignored. Key values longer than the maximum length will be truncated.</p>\n<p><strong>Note:</strong> On linux values that are longer than 127 bytes will be chunked into multiple keys, each 127 bytes in length.  Например, <code>addExtraParameter('foo', 'a'.repeat(130))</code> will result in two chunked keys <code>foo__1</code> and <code>foo__2</code>, the first will contain the first 127 bytes and the second will contain the remaining 3 bytes.  On your crash reporting backend you should stitch together keys in this format.</p>\n<h3 id=\"crashreporterremoveextraparameterkey\"><a href=\"#crashreporterremoveextraparameterkey\"><code>crashReporter.removeExtraParameter(key)</code></a></h3>\n<ul>\n<li><code>key</code> String - Parameter key, must be no longer than 39 bytes.</li>\n</ul>\n<p>Remove an extra parameter from the current set of parameters. Future crashes will not include this parameter.</p>\n<h3 id=\"crashreportergetparameters\"><a href=\"#crashreportergetparameters\"><code>crashReporter.getParameters()</code></a></h3>\n<p>Returns <code>Record&#x3C;String, String></code> - The current 'extra' parameters of the crash reporter.</p>\n<h2 id=\"отчет-о-нагрузке\"><a href=\"#отчет-о-нагрузке\">Отчет о нагрузке</a></h2>\n<p>Процесс отчетов о сбоях отправит следующие данные в <code>submitURL</code> как <code>multipart/form-data</code> <code>POST</code>:</p>\n<ul>\n<li><code>ver</code> String - Версия Electron.</li>\n<li><code>platform</code> String - например, 'win32'.</li>\n<li><code>process_type</code> String - например, 'renderer'.</li>\n<li><code>guid</code> String - например, '5e1286fc-da97-479e-918b-6bfb0c3d1c72'.</li>\n<li><code>_version</code> String - Версия в <code>package.json</code>.</li>\n<li><code>_productName</code> String - Имя продукта в <code>crashReporter</code> <code>options</code> объекте.</li>\n<li><code>prod</code> String - Name of the underlying product. In this case Electron.</li>\n<li><code>_companyName</code> String - Имя компании в <code>crashReporter</code> <code>options</code> объекте.</li>\n<li><code>upload_file_minidump</code> File - Отчет о сбое в формате <code>minidump</code>.</li>\n<li>Все свойства на уровне 1 объекта <code>extra</code> в объекте <code>crashReporter</code> <code>options</code>.</li>\n</ul>",
      "title": "crashReporter",
      "description": "Отправляйте отчёты об ошибках на удалённый сервер."
    },
    "/docs/api/structures/custom-scheme": {
      "locale": "ru-RU",
      "slug": "custom-scheme",
      "href": "/docs/api/structures/custom-scheme",
      "crowdinFileId": "256423",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/custom-scheme.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"customscheme-object\"><a href=\"#customscheme-object\">CustomScheme Object</a></h1>\n<ul>\n<li><code>scheme</code> String - Custom schemes to be registered with options.</li>\n<li><code>privileges</code> Object (optional)<ul>\n<li><code>standard</code> Boolean (optional) - Default false.</li>\n<li><code>secure</code> Boolean (optional) - Default false.</li>\n<li><code>bypassCSP</code> Boolean (optional) - Default false.</li>\n<li><code>allowServiceWorkers</code> Boolean (optional) - Default false.</li>\n<li><code>supportFetchAPI</code> Boolean (optional) - Default false.</li>\n<li><code>corsEnabled</code> Boolean (optional) - Default false.</li>\n<li><code>stream</code> Boolean (optional) - Default false.</li>\n</ul></li>\n</ul>",
      "title": "CustomScheme Object",
      "description": ""
    },
    "/docs/tutorial/dark-mode": {
      "locale": "ru-RU",
      "slug": "dark-mode",
      "href": "/docs/tutorial/dark-mode",
      "crowdinFileId": "256187",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/dark-mode.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"темный-режим\"><a href=\"#темный-режим\">Темный режим</a></h1>\n<h2 id=\"обзор\"><a href=\"#обзор\">Обзор</a></h2>\n<h3 id=\"automatically-update-the-native-interfaces\"><a href=\"#automatically-update-the-native-interfaces\">Automatically update the native interfaces</a></h3>\n<p>\"Native interfaces\" include the file picker, window border, dialogs, context menus, and more - anything where the UI comes from your operating system and not from your app. The default behavior is to opt into this automatic theming from the OS.</p>\n<h3 id=\"automatically-update-your-own-interfaces\"><a href=\"#automatically-update-your-own-interfaces\">Automatically update your own interfaces</a></h3>\n<p>If your app has its own dark mode, you should toggle it on and off in sync with the system's dark mode setting. You can do this by using the [prefer-color-scheme] CSS media query.</p>\n<h3 id=\"manually-update-your-own-interfaces\"><a href=\"#manually-update-your-own-interfaces\">Manually update your own interfaces</a></h3>\n<p>If you want to manually switch between light/dark modes, you can do this by setting the desired mode in the <a href=\"/docs/api/native-theme#nativethemethemesource\">themeSource</a> property of the <code>nativeTheme</code> module. This property's value will be propagated to your Renderer process. Any CSS rules related to <code>prefers-color-scheme</code> will be updated accordingly.</p>\n<h2 id=\"macos-settings\"><a href=\"#macos-settings\">macOS settings</a></h2>\n<p>В macOS 10.14 Mojave, Apple представила новый <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/dark-mode/\">системный темный режим</a> для всех компьютеров macOS. If your Electron app has a dark mode, you can make it follow the system-wide dark mode setting using <a href=\"/docs/api/native-theme\">the <code>nativeTheme</code> api</a>.</p>\n<p>In macOS 10.15 Catalina, Apple introduced a new \"automatic\" dark mode option for all macOS computers. In order for the <code>nativeTheme.shouldUseDarkColors</code> and <code>Tray</code> APIs to work correctly in this mode on Catalina, you need to use Electron <code>>=7.0.0</code>, or set <code>NSRequiresAquaSystemAppearance</code> to <code>false</code> in your <code>Info.plist</code> file for older versions. Both <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a> and <a href=\"https://www.electronforge.io/\">Electron Forge</a> have a <a href=\"https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html#darwindarkmodesupport\"><code>darwinDarkModeSupport</code> option</a> to automate the <code>Info.plist</code> changes during app build time.</p>\n<p>If you wish to opt-out while using Electron > 8.0.0, you must set the <code>NSRequiresAquaSystemAppearance</code> key in the <code>Info.plist</code> file to <code>true</code>. Please note that Electron 8.0.0 and above will not let you opt-out of this theming, due to the use of the macOS 10.14 SDK.</p>\n<h2 id=\"пример\"><a href=\"#пример\">Пример</a></h2>\n<p>This example demonstrates an Electron application that derives its theme colors from the <code>nativeTheme</code>. Additionally, it provides theme toggle and reset controls using IPC channels.</p>\n<h3 id=\"how-does-this-work\"><a href=\"#how-does-this-work\">How does this work?</a></h3>\n<p>Starting with the <code>index.html</code> file:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"script-src 'self' 'unsafe-inline';\"</span> /></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/css\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"./styles.css\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">p</span>></span>Current theme source: <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">strong</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"theme-source\"</span>></span>System<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">strong</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">p</span>></span>\n\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"toggle-dark-mode\"</span>></span>Toggle Dark Mode<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">button</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"reset-to-system\"</span>></span>Reset to System Theme<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">button</span>></span>\n\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>И файл <code>styles.css</code>:</p>\n<pre><code class=\"hljs language-css\">@<span class=\"hljs-keyword\">media</span> (prefers-color-scheme: dark) {\n  <span class=\"hljs-selector-tag\">body</span> { <span class=\"hljs-attribute\">background</span>: <span class=\"hljs-number\">#333</span>; <span class=\"hljs-attribute\">color</span>: white; }\n}\n\n@<span class=\"hljs-keyword\">media</span> (prefers-color-scheme: light) {\n  <span class=\"hljs-selector-tag\">body</span> { <span class=\"hljs-attribute\">background</span>: <span class=\"hljs-number\">#ddd</span>; <span class=\"hljs-attribute\">color</span>: black; }\n}\n</code></pre>\n<p>The example renders an HTML page with a couple elements. The <code>&#x3C;strong id=\"theme-source\"></code> element shows which theme is currently selected, and the two <code>&#x3C;button></code> elements are the controls. The CSS file uses the <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> media query to set the <code>&#x3C;body></code> element background and text colors.</p>\n<p>The <code>preload.js</code> script adds a new API to the <code>window</code> object called <code>darkMode</code>. This API exposes two IPC channels to the renderer process, <code>'dark-mode:toggle'</code> and <code>'dark-mode:system'</code>. It also assigns two methods, <code>toggle</code> and <code>system</code>, which pass messages from the renderer to the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'darkMode'</span>, {\n  <span class=\"hljs-attr\">toggle</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'dark-mode:toggle'</span>),\n  <span class=\"hljs-attr\">system</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'dark-mode:system'</span>)\n})\n</code></pre>\n<p>Now the renderer process can communicate with the main process securely and perform the necessary mutations to the <code>nativeTheme</code> object.</p>\n<p>The <code>renderer.js</code> file is responsible for controlling the <code>&#x3C;button></code> functionality.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'toggle-dark-mode'</span>).addEventListener(<span class=\"hljs-string\">'click'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> isDarkMode = <span class=\"hljs-keyword\">await</span> <span class=\"hljs-built_in\">window</span>.darkMode.toggle()\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'theme-source'</span>).innerHTML = isDarkMode ? <span class=\"hljs-string\">'Dark'</span> : <span class=\"hljs-string\">'Light'</span>\n})\n\n<span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'reset-to-system'</span>).addEventListener(<span class=\"hljs-string\">'click'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> <span class=\"hljs-built_in\">window</span>.darkMode.system()\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'theme-source'</span>).innerHTML = <span class=\"hljs-string\">'System'</span>\n})\n</code></pre>\n<p>Using <code>addEventListener</code>, the <code>renderer.js</code> file adds <code>'click'</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\">event listeners</a> to each button element. Each event listener handler makes calls to the respective <code>window.darkMode</code> API methods.</p>\n<p>Finally, the <code>main.js</code> file represents the main process and contains the actual <code>nativeTheme</code> API.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, ipcMain, nativeTheme } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  ipcMain.handle(<span class=\"hljs-string\">'dark-mode:toggle'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (nativeTheme.shouldUseDarkColors) {\n      nativeTheme.themeSource = <span class=\"hljs-string\">'light'</span>\n    } <span class=\"hljs-keyword\">else</span> {\n      nativeTheme.themeSource = <span class=\"hljs-string\">'dark'</span>\n    }\n    <span class=\"hljs-keyword\">return</span> nativeTheme.shouldUseDarkColors\n  })\n\n  ipcMain.handle(<span class=\"hljs-string\">'dark-mode:system'</span>, () => {\n    nativeTheme.themeSource = <span class=\"hljs-string\">'system'</span>\n  })\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n      createWindow()\n    }\n  })\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n</code></pre>\n<p>The <code>ipcMain.handle</code> methods are how the main process responds to the click events from the buttons on the HTML page.</p>\n<p>The <code>'dark-mode:toggle'</code> IPC channel handler method checks the <code>shouldUseDarkColors</code> boolean property, sets the corresponding <code>themeSource</code>, and then returns the current <code>shouldUseDarkColors</code> property. Looking back on the renderer process event listener for this IPC channel, the return value from this handler is utilized to assign the correct text to the <code>&#x3C;strong id='theme-source'></code> element.</p>\n<p>The <code>'dark-mode:system'</code> IPC channel handler method assigns the string <code>'system'</code> to the <code>themeSource</code> and returns nothing. This also corresponds with the relative renderer process event listener as the method is awaited with no return value expected.</p>\n<p>Run the example using Electron Fiddle and then click the \"Toggle Dark Mode\" button; the app should start alternating between a light and dark background color.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/dark_mode.gif\" alt=\"Темный режим\"></p>",
      "title": "Темный режим",
      "description": ""
    },
    "/docs/development/debug-instructions-windows": {
      "locale": "ru-RU",
      "slug": "debug-instructions-windows",
      "href": "/docs/development/debug-instructions-windows",
      "crowdinFileId": "256149",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debug-instructions-windows.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"отладка-под-windows\"><a href=\"#отладка-под-windows\">Отладка под Windows</a></h1>\n<p>Если вы наблюдаете аварии или проблемы в работе Electron, которые, как вы считаете, вызваны самим Electron, а не приложением на JavaScript, отладка может быть немного сложной, особенно для разработчиков ранее не занимавшихся отладкой кода на C++. However, using Visual Studio, Electron's hosted Symbol Server, and the Electron source code, you can enable step-through debugging with breakpoints inside Electron's source code.</p>\n<p><strong>См. также</strong>: Есть много информации об отладке Chromium, большая часть из которых относится и к Electron, на сайте разработчиков Chromium: <a href=\"https://www.chromium.org/developers/how-tos/debugging-on-windows\">Отладка Chromium на Windows</a>.</p>\n<h2 id=\"требования\"><a href=\"#требования\">Требования</a></h2>\n<ul>\n<li>\n<p><strong>Отладочная сборка Electron</strong>: Обычно проще всего собрать ее самостоятельно, используя инструменты и предварительные требования, перечисленные в <a href=\"/docs/development/build-instructions-windows\">инструкции по сборке под Windows</a>. Вы конечно можете скачать обычную сборку Electron и подключиться для отладки к ней, но вы обнаружите, что она сильно оптимизирована, и это существенно затрудняет отладку: отладчик не сможет показать вам содержимое всех переменных, так же путь выполнения может казаться странным вследствие встраивания функций (inlining), хвостовых вызовов (trail calls) и других оптимизаций, выполненных компилятором.</p>\n</li>\n<li>\n<p><strong>Visual Studio с инструментами C++</strong>: бесплатная общественная редакция Visual Studio, можно использовать версии VS2013 и VS2015. Once installed, <a href=\"/docs/development/setting-up-symbol-server\">configure Visual Studio to use Electron's Symbol server</a>. Это позволит Visual Studio получить лучшее представление о том, что происходит внутри Electron, что позводит представить переменные в удобочитаемом формате.</p>\n</li>\n<li>\n<p><strong>ProcMon</strong>: <a href=\"https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx\">бесплатный инструмент от SysInternals</a>, позволяющий вам просматривать параметры процессов, файловые дескрипторы, и операции над реестром.</p>\n</li>\n</ul>\n<h2 id=\"подключение-к-electron-для-отладки\"><a href=\"#подключение-к-electron-для-отладки\">Подключение к Electron для отладки</a></h2>\n<p>Для запуска сеанса отладки, откройте PowerShell/CMD и запустите отладочную сборку Electron, указав приложение в качестве параметра.</p>\n<pre><code class=\"hljs language-powershell\">$ ./out/Testing/electron.exe ~/my-electron-app/\n</code></pre>\n<h3 id=\"задание-точек-останова\"><a href=\"#задание-точек-останова\">Задание точек останова</a></h3>\n<p>Затем, откройте Visual Studio. Electron не был собран из Visual Studio, и поэтому код не содержит файла проекта; тем не менее, вы можете открывать исходные файлы просто \"как файл\", то есть Visual Studio откроет их сами по себе. Тем не менее, вы можете ставить точки останова - Visual Studio автоматически определит, что этот исходный код соответствует исполняемому коду в подключенном процессе, и остановится на указанной точке останова.</p>\n<p>Соответствующие файлы кода можно найти в <code>./shell/</code>.</p>\n<h3 id=\"подключение\"><a href=\"#подключение\">Подключение</a></h3>\n<p>Вы можете подключить отладчик Visual Studio к запущенному процессу, на локальном или удаленном компьютере. После того как процесс был запущен, нажмите Debug / Attach to Process (или нажмите <code>CTRL + ALT + P</code>), чтобы открыть диалоговое окно «Attach to Process». Вы можете использовать эту возможность для отладки приложений, выполняемых на локальном или удаленном компьютере, и для одновременной отладки нескольких процессов.</p>\n<p>Если Electron выполняется под учетной записью другого пользователя, установите флажок <code>Show processes from all users</code>. Обратите внимание, что вы увидите несколько процессов, их количество зависит от того, сколько BrowserWindows открыто в вашем приложении. Типичное одноокнонное приложение будет выглядеть в Visual Studio как два процесса <code>Electron.exe</code> - один для основного процесса и один для процесса визуализации. Поскольку список показывает вам только имена, в настоящее время нет надежного способа выяснить какой из них к чему относится.</p>\n<h3 id=\"к-какому-процессу-я-должен-подключиться\"><a href=\"#к-какому-процессу-я-должен-подключиться\">К какому процессу я должен подключиться?</a></h3>\n<p>Code executed within the main process (that is, code found in or eventually run by your main JavaScript file) will run inside the main process, while other code will execute inside its respective renderer process.</p>\n<p>Вы можете подключиться к несколько программам для отладки, но только одна программа будет активна в отладчике в каждый момент времени. Вы можете задать активную программу в панели инструментов <code>Debug Location</code> либо в окне <code>Processes</code>.</p>\n<h2 id=\"использование-procmon-для-наблюдения-за-процессом\"><a href=\"#использование-procmon-для-наблюдения-за-процессом\">Использование ProcMon для наблюдения за процессом</a></h2>\n<p>В то время как Visual Studio отлично подходит для изучения конкретных путей выполнения, ProcMon действительно силен в наблюдении за всем, что делает ваше приложение с операционной системой - включая файлы, реестр, сеть, процессы и детальное профилирование процессов. Он пытается протоколировать <strong>все</strong> происходящие события, что может быть даже весьма излишним, но если вы стремитесь понять, что и как делает ваше приложение с операционной системой, это может быть ценным ресурсом.</p>\n<p>В качестве введения в базовые и расширенные возможности отладки через ProcMon можно рекомендовать <a href=\"https://channel9.msdn.com/shows/defrag-tools/defrag-tools-4-process-monitor\">это видео руководство</a> от Microsoft.</p>",
      "title": "Отладка под Windows",
      "description": ""
    },
    "/docs/api/debugger": {
      "locale": "ru-RU",
      "slug": "debugger",
      "href": "/docs/api/debugger",
      "crowdinFileId": "256305",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/debugger.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-debugger\"><a href=\"#class-debugger\">Class: Debugger</a></h2>\n<blockquote>\n<p>Альтернативный транспорт для удаленной отладки протокола Chrome.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Инструменты разработчика Chrome имеют <a href=\"https://chromedevtools.github.io/devtools-protocol/\">специальную привязку</a> доступную во время выполнения JavaScript, что позволяет взаимодействовать со страницами и управлять ими.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-keyword\">try</span> {\n  win.webContents.debugger.attach(<span class=\"hljs-string\">'1.1'</span>)\n} <span class=\"hljs-keyword\">catch</span> (err) {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Debugger attach failed : '</span>, err)\n}\n\nwin.webContents.debugger.on(<span class=\"hljs-string\">'detach'</span>, (event, reason) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Debugger detached due to : '</span>, reason)\n})\n\nwin.webContents.debugger.on(<span class=\"hljs-string\">'message'</span>, (event, method, params) => {\n  <span class=\"hljs-keyword\">if</span> (method === <span class=\"hljs-string\">'Network.requestWillBeSent'</span>) {\n    <span class=\"hljs-keyword\">if</span> (params.request.url === <span class=\"hljs-string\">'https://www.github.com'</span>) {\n      win.webContents.debugger.detach()\n    }\n  }\n})\n\nwin.webContents.debugger.sendCommand(<span class=\"hljs-string\">'Network.enable'</span>)\n</code></pre>\n<h3 id=\"события-экземпляра\"><a href=\"#события-экземпляра\">События экземпляра</a></h3>\n<h4 id=\"событие-detach\"><a href=\"#событие-detach\">Событие: 'detach'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>reason</code> String - причина отсоединения отладчика.</li>\n</ul>\n<p>Emitted when the debugging session is terminated. This happens either when <code>webContents</code> is closed or devtools is invoked for the attached <code>webContents</code>.</p>\n<h4 id=\"событие-message\"><a href=\"#событие-message\">Событие: 'message'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>method</code> String - имя метода.</li>\n<li><code>params</code> any - Event parameters defined by the 'parameters' attribute in the remote debugging protocol.</li>\n<li><code>sessionId</code> String - Unique identifier of attached debugging session, will match the value sent from <code>debugger.sendCommand</code>.</li>\n</ul>\n<p>Возникает при отладке инструментальных событий.</p>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<h4 id=\"debuggerattachprotocolversion\"><a href=\"#debuggerattachprotocolversion\"><code>debugger.attach([protocolVersion])</code></a></h4>\n<ul>\n<li><code>protocolVersion</code> String (опционально) - запрошенная версия протокола отладки.</li>\n</ul>\n<p>Подключает отладчик к <code>webContents</code>.</p>\n<h4 id=\"debuggerisattached\"><a href=\"#debuggerisattached\"><code>debugger.isAttached()</code></a></h4>\n<p>Возвращает <code>Boolean</code> - если отладчик присоединен к <code>webContents</code>.</p>\n<h4 id=\"debuggerdetach\"><a href=\"#debuggerdetach\"><code>debugger.detach()</code></a></h4>\n<p>Отключает отладчик от <code>webContents</code>.</p>\n<h4 id=\"debuggersendcommandmethod-commandparams-sessionid\"><a href=\"#debuggersendcommandmethod-commandparams-sessionid\"><code>debugger.sendCommand(method[, commandParams, sessionId])</code></a></h4>\n<ul>\n<li><code>method</code> String - Method name, should be one of the methods defined by the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">remote debugging protocol</a>.</li>\n<li><code>commandParams</code> any (опционально) - JSON объект с параметрами запроса.</li>\n<li><code>sessionId</code> String (optional) - send command to the target with associated debugging session id. The initial value can be obtained by sending <a href=\"https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-attachToTarget\">Target.attachToTarget</a> message.</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;any></code> - Promise, которое разрешается с ответом, определенным атрибутом 'returns' описания команды в протоколе удаленной отладки, или отклоняется, указывая на сбой команды.</p>\n<p>Отправьте заданную команду на цель отладки.</p>",
      "title": "Debugger",
      "description": "Альтернативный транспорт для удаленной отладки протокола Chrome."
    },
    "/docs/development/debugging-instructions-macos": {
      "locale": "ru-RU",
      "slug": "debugging-instructions-macos",
      "href": "/docs/development/debugging-instructions-macos",
      "crowdinFileId": "256153",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debugging-instructions-macos.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"отладка-под-macos\"><a href=\"#отладка-под-macos\">Отладка под macOS</a></h1>\n<p>Если вы наблюдаете аварии или проблемы в работе Electron, которые, как вы считаете, вызваны самим Electron, а не приложением на JavaScript, отладка может быть немного сложной, особенно для разработчиков ранее не занимавшихся отладкой кода на C++. Однако, используя lldb и исходный код Electron, вы можете включить отладку с точками останова внутри исходного кода Electron. Если вы предпочитаете графический интерфейс, Вы также можете использовать <a href=\"/docs/development/debugging-instructions-macos-xcode\">XCode для отладки</a>.</p>\n<h2 id=\"требования\"><a href=\"#требования\">Требования</a></h2>\n<ul>\n<li>\n<p><strong>A debug build of Electron</strong>: The easiest way is usually building it yourself, using the tools and prerequisites listed in the <a href=\"/docs/development/build-instructions-macos\">build instructions for macOS</a>. Вы конечно можете скачать обычную сборку Electron и подключиться для отладки к ней, но вы обнаружите, что она сильно оптимизирована, и это существенно затрудняет отладку: отладчик не сможет показать вам содержимое всех переменных, так же путь выполнения может казаться странным вследствие встраивания функций (inlining), хвостовых вызовов (trail calls) и других оптимизаций, выполненных компилятором.</p>\n</li>\n<li>\n<p><strong>Xcode</strong>: В дополнение к Xcode, также установите утилиты командной строки Xcode. Они включают в себя LLDB, дебаггер по умолчанию в Xcode на macOS. Он поддерживает отладку C, Objective-C и C++ на настольных и iOS устройствах и симуляторах.</p>\n</li>\n<li>\n<p><strong>.lldbinit</strong>: Create or edit <code>~/.lldbinit</code> to allow Chromium code to be properly source-mapped.</p>\n<pre><code class=\"hljs language-plaintext\"># e.g: ['~/electron/src/tools/lldb']\nscript sys.path[:0] = ['&#x3C;...path/to/electron/src/tools/lldb>']\nscript import lldbinit\n</code></pre>\n</li>\n</ul>\n<h2 id=\"подключение-к-electron-для-отладки\"><a href=\"#подключение-к-electron-для-отладки\">Подключение к Electron для отладки</a></h2>\n<p>To start a debugging session, open up Terminal and start <code>lldb</code>, passing a non-release build of Electron as a parameter.</p>\n<pre><code class=\"hljs language-sh\">$ lldb ./out/Testing/Electron.app\n(lldb) target create <span class=\"hljs-string\">\"./out/Testing/Electron.app\"</span>\nCurrent executable <span class=\"hljs-built_in\">set</span> to <span class=\"hljs-string\">'./out/Testing/Electron.app'</span> (x86_64).\n</code></pre>\n<h3 id=\"задание-точек-останова\"><a href=\"#задание-точек-останова\">Задание точек останова</a></h3>\n<p>LLDB is a powerful tool and supports multiple strategies for code inspection. For this basic introduction, let's assume that you're calling a command from JavaScript that isn't behaving correctly - so you'd like to break on that command's C++ counterpart inside the Electron source.</p>\n<p>Соответствующие файлы кода можно найти в <code>./shell/</code>.</p>\n<p>Let's assume that you want to debug <code>app.setName()</code>, which is defined in <code>browser.cc</code> as <code>Browser::SetName()</code>. Set the breakpoint using the <code>breakpoint</code> command, specifying file and line to break on:</p>\n<pre><code class=\"hljs language-sh\">(lldb) breakpoint <span class=\"hljs-built_in\">set</span> --file browser.cc --line 117\nBreakpoint 1: <span class=\"hljs-built_in\">where</span> = Electron Framework`atom::Browser::SetName(std::__1::basic_string&#x26;lt;char, std::__1::char_traits&#x26;lt;char&#x26;gt;, std::__1::allocator&#x26;lt;char&#x26;gt; > const&#x26;) + 20 at browser.cc:118, address = 0x000000000015fdb4\n</code></pre>\n<p>Затем, запустите Electron:</p>\n<pre><code class=\"hljs language-sh\">(lldb) запуск\n</code></pre>\n<p>The app will immediately be paused, since Electron sets the app's name on launch:</p>\n<pre><code class=\"hljs language-sh\">(lldb) run\nProcess 25244 launched: <span class=\"hljs-string\">'/Users/fr/Code/electron/out/Testing/Electron.app/Contents/MacOS/Electron'</span> (x86_64)\nProcess 25244 stopped\n* thread <span class=\"hljs-comment\">#1: tid = 0x839a4c, 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 20 at browser.cc:118, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1</span>\n    frame <span class=\"hljs-comment\">#0: 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 20 at browser.cc:118</span>\n   115  }\n   116\n   117  void Browser::SetName(const std::string&#x26; name) {\n-> 118    name_override_ = name;\n   119  }\n   120\n   121  int Browser::<span class=\"hljs-function\"><span class=\"hljs-title\">GetBadgeCount</span></span>() {\n(lldb)\n</code></pre>\n<p>To show the arguments and local variables for the current frame, run <code>frame variable</code> (or <code>fr v</code>), which will show you that the app is currently setting the name to \"Electron\".</p>\n<pre><code class=\"hljs language-sh\">(lldb) frame variable\n(atom::Browser *) this = 0x0000000108b14f20\n(const string &#x26;) name = <span class=\"hljs-string\">\"Electron\"</span>: {\n    [...]\n}\n</code></pre>\n<p>To do a source level single step in the currently selected thread, execute <code>step</code> (or <code>s</code>). This would take you into <code>name_override_.empty()</code>. To proceed and do a step over, run <code>next</code> (or <code>n</code>).</p>\n<pre><code class=\"hljs language-sh\">(lldb) step\nProcess 25244 stopped\n* thread <span class=\"hljs-comment\">#1: tid = 0x839a4c, 0x0000000100162dcc Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 44 at browser.cc:119, queue = 'com.apple.main-thread', stop reason = step in</span>\n    frame <span class=\"hljs-comment\">#0: 0x0000000100162dcc Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 44 at browser.cc:119</span>\n   116\n   117  void Browser::SetName(const std::string&#x26; name) {\n   118    name_override_ = name;\n-> 119  }\n   120\n   121  int Browser::<span class=\"hljs-function\"><span class=\"hljs-title\">GetBadgeCount</span></span>() {\n   122    <span class=\"hljs-built_in\">return</span> badge_count_;\n</code></pre>\n<p><strong>NOTE:</strong> If you don't see source code when you think you should, you may not have added the <code>~/.lldbinit</code> file above.</p>\n<p>To finish debugging at this point, run <code>process continue</code>. You can also continue until a certain line is hit in this thread (<code>thread until 100</code>). This command will run the thread in the current frame till it reaches line 100 in this frame or stops if it leaves the current frame.</p>\n<p>Now, if you open up Electron's developer tools and call <code>setName</code>, you will once again hit the breakpoint.</p>\n<h3 id=\"дальнейшее-изучение\"><a href=\"#дальнейшее-изучение\">Дальнейшее изучение</a></h3>\n<p>LLDB это мощный инструмент с отличной документацией. To learn more about it, consider Apple's debugging documentation, for instance the <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-basics.html#//apple_ref/doc/uid/TP40012917-CH2-SW2\">LLDB Command Structure Reference</a> or the introduction to <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-terminal-workflow-tutorial.html\">Using LLDB as a Standalone Debugger</a>.</p>\n<p>You can also check out LLDB's fantastic <a href=\"https://lldb.llvm.org/tutorial.html\">manual and tutorial</a>, which will explain more complex debugging scenarios.</p>",
      "title": "Отладка под macOS",
      "description": ""
    },
    "/docs/development/debugging-instructions-macos-xcode": {
      "locale": "ru-RU",
      "slug": "debugging-instructions-macos-xcode",
      "href": "/docs/development/debugging-instructions-macos-xcode",
      "crowdinFileId": "256151",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debugging-instructions-macos-xcode.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h2 id=\"debugging-with-xcode\"><a href=\"#debugging-with-xcode\">Debugging with XCode</a></h2>\n<h3 id=\"генерировать-xcode-проект-для-отладки-исходников-невозможно-собрать-код-из-xcode\"><a href=\"#генерировать-xcode-проект-для-отладки-исходников-невозможно-собрать-код-из-xcode\">Генерировать xcode проект для отладки исходников (невозможно собрать код из xcode)</a></h3>\n<p>Run <code>gn gen</code> with the --ide=xcode argument.</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --ide=xcode\n</code></pre>\n<p>Это будет генерировать electron.ninja.xcworkspace. Вам придётся открыть этот проект для установки точек останова и проверки.</p>\n<p>Смотрите <code>gn help gen</code> для получения дополнительной информации о генерации проектов IDE с помощью GN.</p>\n<h3 id=\"отладка-и-точки-останова\"><a href=\"#отладка-и-точки-останова\">Отладка и точки останова</a></h3>\n<p>Запустить Electron приложение после сборки. You can now open the xcode workspace created above and attach to the Electron process through the Debug > Attach To Process > Electron debug menu. [Примечание: если вы хотите отладить процесс рендеринга, вам также нужно присоединиться к Electron Helper.]</p>\n<p>Теперь вы можете установить точки останова в любом из индексированных файлов. Тем не менее, вы не сможете установить точки останова непосредственно в исходниках Chromium. To set break points in the Chromium source, you can choose Debug > Breakpoints > Create Symbolic Breakpoint and set any function name as the symbol. Это установит точку останова для всех функций с таким именем, из всех классов, если их несколько. Вы также можете сделать этот шаг установки точек останова до прикрепления отладчика, однако, фактические точки останова для символической точки останова могут не появиться до тех пор, пока отладчик не будет прикреплен к приложению.</p>",
      "title": "Debugging with XCode",
      "description": ""
    },
    "/docs/tutorial/debugging-main-process": {
      "locale": "ru-RU",
      "slug": "debugging-main-process",
      "href": "/docs/tutorial/debugging-main-process",
      "crowdinFileId": "256189",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/debugging-main-process.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"отладка-главного-процесса\"><a href=\"#отладка-главного-процесса\">Отладка главного процесса</a></h1>\n<p>DevTools, который открывается в окне браузера может отлаживать только тот JavaScript, который выполняется в этом окне (т.е. веб-страницы). Для отладки кода основного процесса вам нужно будет использовать внешний отладчик и запускать Electron с ключом <code>--inspect</code> или <code>--inspect-brk</code>.</p>\n<h2 id=\"параметры-командной-строки\"><a href=\"#параметры-командной-строки\">Параметры командной строки</a></h2>\n<p>Для отладки основного процесса используйте один из следующих параметров командной строки:</p>\n<h3 id=\"--inspectport\"><a href=\"#--inspectport\"><code>--inspect=[port]</code></a></h3>\n<p>Electron will listen for V8 inspector protocol messages on the specified <code>port</code>, an external debugger will need to connect on this port. The default <code>port</code> is <code>5858</code>.</p>\n<pre><code class=\"hljs language-shell\">electron --inspect=5858 ваше/приложение\n</code></pre>\n<h3 id=\"--inspect-brkport\"><a href=\"#--inspect-brkport\"><code>--inspect-brk=[port]</code></a></h3>\n<p>Работает так же, как <code>--inspect</code>, но останавливает выполнение в первой строке JavaScript.</p>\n<h2 id=\"внешние-отладчики\"><a href=\"#внешние-отладчики\">Внешние отладчики</a></h2>\n<p>Вам нужно будет использовать отладчик, поддерживающий протокол инспектора V8.</p>\n<ul>\n<li>Откройте <code>chrome://inspect</code> в Chrome и выберите для проверки запущенное приложение Electron.</li>\n<li><a href=\"/docs/tutorial/debugging-vscode\">Отладка в VSCode</a></li>\n</ul>",
      "title": "Отладка главного процесса",
      "description": ""
    },
    "/docs/tutorial/debugging-vscode": {
      "locale": "ru-RU",
      "slug": "debugging-vscode",
      "href": "/docs/tutorial/debugging-vscode",
      "crowdinFileId": "256191",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/debugging-vscode.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"отладка-в-vscode\"><a href=\"#отладка-в-vscode\">Отладка в VSCode</a></h1>\n<p>Это руководство посвящено тому, как настроить VSCode отладку как для вашего проекта Electron, так и для родного кода Electron.</p>\n<h2 id=\"отладка-приложения-electron\"><a href=\"#отладка-приложения-electron\">Отладка приложения Electron</a></h2>\n<h3 id=\"главный-процесс\"><a href=\"#главный-процесс\">Главный процесс</a></h3>\n<h4 id=\"1-open-an-electron-project-in-vscode\"><a href=\"#1-open-an-electron-project-in-vscode\">1. Open an Electron project in VSCode.</a></h4>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:electron/electron-quick-start.git\n$ code electron-quick-start\n</code></pre>\n<h4 id=\"2-создайте-файл-vscodelaunchjson-со-следующей-конфигурацией\"><a href=\"#2-создайте-файл-vscodelaunchjson-со-следующей-конфигурацией\">2. Создайте файл <code>.vscode/launch.json</code> со следующей конфигурацией:</a></h4>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.2.0\"</span>,\n  <span class=\"hljs-attr\">\"configurations\"</span>: [\n    {\n      <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"Debug Main Process\"</span>,\n      <span class=\"hljs-attr\">\"type\"</span>: <span class=\"hljs-string\">\"node\"</span>,\n      <span class=\"hljs-attr\">\"request\"</span>: <span class=\"hljs-string\">\"launch\"</span>,\n      <span class=\"hljs-attr\">\"cwd\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      <span class=\"hljs-attr\">\"runtimeExecutable\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}/node_modules/.bin/electron\"</span>,\n      <span class=\"hljs-attr\">\"windows\"</span>: {\n        <span class=\"hljs-attr\">\"runtimeExecutable\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}/node_modules/.bin/electron.cmd\"</span>\n      },\n      <span class=\"hljs-attr\">\"args\"</span> : [<span class=\"hljs-string\">\".\"</span>]\n    }\n  ]\n}\n</code></pre>\n<h4 id=\"3-debugging\"><a href=\"#3-debugging\">3. Debugging</a></h4>\n<p>Установите некоторые точки останова в <code>main.js</code>и начните отладку в <a href=\"https://code.visualstudio.com/docs/editor/debugging\">Debug View</a>. You should be able to hit the breakpoints.</p>\n<p>Это заранее настроенный проект, который вы можете скачать и непосредственно отладить в VSCode: <a href=\"https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start\">https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start</a></p>\n<h2 id=\"отладка-кода-electron\"><a href=\"#отладка-кода-electron\">Отладка кода Electron</a></h2>\n<p>Если вы хотите собрать Electron из исходного кода и модифицировать его, данный раздел поможет тестировать ваши изменения.</p>\n<p>Для тех, кто не знает, где получить или как собрать его, <a href=\"https://github.com/electron/build-tools\">Electron Build Tools</a> автоматизирует и объясняет большую часть этого процесса. Если вы хотите самостоятельно настроить окружение, вы можете использовать эти <a href=\"/docs/development/build-instructions-gn\">инструкции по сборке</a>.</p>\n<h3 id=\"windows-c\"><a href=\"#windows-c\">Windows (C++)</a></h3>\n<h4 id=\"1-open-an-electron-project-in-vscode-1\"><a href=\"#1-open-an-electron-project-in-vscode-1\">1. Open an Electron project in VSCode.</a></h4>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:electron/electron-quick-start.git\n$ code electron-quick-start\n</code></pre>\n<h4 id=\"2-создайте-файл-vscodelaunchjson-со-следующей-конфигурацией-1\"><a href=\"#2-создайте-файл-vscodelaunchjson-со-следующей-конфигурацией-1\">2. Создайте файл <code>.vscode/launch.json</code> со следующей конфигурацией:</a></h4>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.2.0\"</span>,\n  <span class=\"hljs-attr\">\"configurations\"</span>: [\n    {\n      <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"(Windows) Launch\"</span>,\n      <span class=\"hljs-attr\">\"type\"</span>: <span class=\"hljs-string\">\"cppvsdbg\"</span>,\n      <span class=\"hljs-attr\">\"request\"</span>: <span class=\"hljs-string\">\"launch\"</span>,\n      <span class=\"hljs-attr\">\"program\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\\\\out\\\\your-executable-location\\\\electron.exe\"</span>,\n      <span class=\"hljs-attr\">\"args\"</span>: [<span class=\"hljs-string\">\"your-electron-project-path\"</span>],\n      <span class=\"hljs-attr\">\"stopAtEntry\"</span>: <span class=\"hljs-literal\">false</span>,\n      <span class=\"hljs-attr\">\"cwd\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      <span class=\"hljs-attr\">\"environment\"</span>: [\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_ENABLE_LOGGING\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"true\"</span>},\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_ENABLE_STACK_DUMPING\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"true\"</span>},\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_RUN_AS_NODE\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"\"</span>},\n      ],\n      <span class=\"hljs-attr\">\"externalConsole\"</span>: <span class=\"hljs-literal\">false</span>,\n      <span class=\"hljs-attr\">\"sourceFileMap\"</span>: {\n          <span class=\"hljs-attr\">\"o:\\\\\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      },\n    },\n  ]\n}\n</code></pre>\n<p><strong>Примечания к настройке</strong></p>\n<ul>\n<li><code>cppvsdbg</code> требует включённого <a href=\"https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools\">встроенного расширения C/C++</a>.</li>\n<li><code>${workspaceFolder}</code> – это полный путь к каталогу <code>src</code> Chromium.</li>\n<li><code>your-executable-location</code> будет одним из следующих, в зависимости от нескольких пунктов:<ul>\n<li><code>Testing</code>: Если вы используете стандартные настройки <a href=\"https://github.com/electron/build-tools\">Electron Build Tools</a> или полностью следуете <a href=\"/docs/development/build-instructions-gn#building\">инструкции по сборке</a>.</li>\n<li><code>Release</code>: Если вы собирали release-версию, а не testing.</li>\n<li><code>your-directory-name</code>: Если вы изменили его во время сборки, оно будет таким, каким вы его указали.</li>\n</ul></li>\n<li>Массив <code>args</code> должен содержать строки <code>your-electron-project-path</code>, которые являются абсолютными путями до каждой директории или <code>main.js</code> файла проекта, который вы хотели бы протестировать. В данном примере в нём должен быть путь до <code>electron-quick-start</code>.</li>\n</ul>\n<h4 id=\"3-debugging-1\"><a href=\"#3-debugging-1\">3. Debugging</a></h4>\n<p>Установите некоторые точки останова в .cc файле выбранного вами кода Electron C++ и начните отладку в <a href=\"https://code.visualstudio.com/docs/editor/debugging\">Debug View</a>.</p>",
      "title": "Отладка в VSCode",
      "description": ""
    },
    "/docs/api/desktop-capturer": {
      "locale": "ru-RU",
      "slug": "desktop-capturer",
      "href": "/docs/api/desktop-capturer",
      "crowdinFileId": "256307",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/desktop-capturer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktopcapturer\"><a href=\"#desktopcapturer\">desktopCapturer</a></h1>\n<blockquote>\n<p>Access information about media sources that can be used to capture audio and video from the desktop using the <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> API.</p>\n</blockquote>\n<p>Процессы: <a href=\"/docs/glossary#main-process\">Основной</a>, <a href=\"/docs/glossary#renderer-process\">Графический</a></p>\n<p>Следующий пример демонстрирует захват видео с окна рабочего стола с названием <code>Electron</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// В графическом процессе.</span>\n<span class=\"hljs-keyword\">const</span> { desktopCapturer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ndesktopCapturer.getSources({ <span class=\"hljs-attr\">types</span>: [<span class=\"hljs-string\">'window'</span>, <span class=\"hljs-string\">'screen'</span>] }).then(<span class=\"hljs-keyword\">async</span> sources => {\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> source <span class=\"hljs-keyword\">of</span> sources) {\n    <span class=\"hljs-keyword\">if</span> (source.name === <span class=\"hljs-string\">'Electron'</span>) {\n      <span class=\"hljs-keyword\">try</span> {\n        <span class=\"hljs-keyword\">const</span> stream = <span class=\"hljs-keyword\">await</span> navigator.mediaDevices.getUserMedia({\n          <span class=\"hljs-attr\">audio</span>: <span class=\"hljs-literal\">false</span>,\n          <span class=\"hljs-attr\">video</span>: {\n            <span class=\"hljs-attr\">mandatory</span>: {\n              <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>,\n              <span class=\"hljs-attr\">chromeMediaSourceId</span>: source.id,\n              <span class=\"hljs-attr\">minWidth</span>: <span class=\"hljs-number\">1280</span>,\n              <span class=\"hljs-attr\">maxWidth</span>: <span class=\"hljs-number\">1280</span>,\n              <span class=\"hljs-attr\">minHeight</span>: <span class=\"hljs-number\">720</span>,\n              <span class=\"hljs-attr\">maxHeight</span>: <span class=\"hljs-number\">720</span>\n            }\n          }\n        })\n        handleStream(stream)\n      } <span class=\"hljs-keyword\">catch</span> (e) {\n        handleError(e)\n      }\n      <span class=\"hljs-keyword\">return</span>\n    }\n  }\n})\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleStream</span> (<span class=\"hljs-params\">stream</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> video = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'video'</span>)\n  video.srcObject = stream\n  video.onloadedmetadata = <span class=\"hljs-function\">(<span class=\"hljs-params\">e</span>) =></span> video.play()\n}\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleError</span> (<span class=\"hljs-params\">e</span>) </span>{\n  <span class=\"hljs-built_in\">console</span>.log(e)\n}\n</code></pre>\n<p>To capture video from a source provided by <code>desktopCapturer</code> the constraints passed to <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> must include <code>chromeMediaSource: 'desktop'</code>, and <code>audio: false</code>.</p>\n<p>To capture both audio and video from the entire desktop the constraints passed to <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> must include <code>chromeMediaSource: 'desktop'</code>, for both <code>audio</code> and <code>video</code>, but should not include a <code>chromeMediaSourceId</code> constraint.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> constraints = {\n  <span class=\"hljs-attr\">audio</span>: {\n    <span class=\"hljs-attr\">mandatory</span>: {\n      <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>\n    }\n  },\n  <span class=\"hljs-attr\">video</span>: {\n    <span class=\"hljs-attr\">mandatory</span>: {\n      <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>\n    }\n  }\n}\n</code></pre>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p><code>desktopCapturer</code> имеет следующие методы:</p>\n<h3 id=\"desktopcapturergetsourcesoptions\"><a href=\"#desktopcapturergetsourcesoptions\"><code>desktopCapturer.getSources(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>types</code> String[] - массив строк, который отображает типы источников рабочего стола для захвата, доступные типы <code>screen</code> и <code>window</code>.</li>\n<li><code>thumbnailSize</code> <a href=\"/docs/api/structures/size\">Size</a> (опционально) - Размер, до которого должен быть масштабирован эскиз источника мультимедиа. По умолчанию это <code>150</code> x <code>150</code>. Установите ширину или высоту в 0, если вам не нужны эскизы. Это сэкономит время на обработку содержимого каждого окна и экрана.</li>\n<li><code>fetchWindowIcons</code> Boolean (опционально) - установите значение true, чтобы включить загрузку значков окна. Значение по умолчанию false. Если false, то свойство appIcon из источников возвращает null. То же самое, если источник имеет тип экрана.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;DesktopCapturerSource[]></code> - разрешается с массивом объектов <a href=\"/docs/api/structures/desktop-capturer-source\"><code>DesktopCapturerSource</code></a>, каждый <code>DesktopCapturerSource </code> представляет экран или отдельное окно, которое может быть захвачено.</p>\n<p><strong>Note</strong> Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher, which can detected by <a href=\"/docs/api/system-preferences#systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><code>systemPreferences.getMediaAccessStatus</code></a>.</p>\n<h2 id=\"предупреждения\"><a href=\"#предупреждения\">Предупреждения</a></h2>\n<p><code>navigator.mediaDevices. etUserMedia</code> не работает в macOS из-за фундаментального ограничения, из-за которого приложениям, желающим получить доступ к звуку системы, требуется <a href=\"https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/KernelExtensions/KernelExtensions.html\">подписанное расширение ядра</a>. Chromium, и расширение Electron, не предоставляет этого.</p>\n<p>Это ограничение можно обойти путем захвата системного звука с помощью другого приложения macOS вроде Soundflower и передачи его через виртуальное устройство ввода. Это виртуальное устройство может быть запрошено с помощью <code>navigator.mediaDevices.getUserMedia</code>.</p>",
      "title": "desktopCapturer",
      "description": "Access information about media sources that can be used to capture audio and video from the desktop using the navigator.mediaDevices.getUserMedia API."
    },
    "/docs/api/structures/desktop-capturer-source": {
      "locale": "ru-RU",
      "slug": "desktop-capturer-source",
      "href": "/docs/api/structures/desktop-capturer-source",
      "crowdinFileId": "256425",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/desktop-capturer-source.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktopcapturersource-object\"><a href=\"#desktopcapturersource-object\">DesktopCapturerSource Object</a></h1>\n<ul>\n<li><code>id</code> String - The identifier of a window or screen that can be used as a <code>chromeMediaSourceId</code> constraint when calling [<code>navigator.webkitGetUserMedia</code>]. The format of the identifier will be <code>window:XX:YY</code> or <code>screen:ZZ:0</code>. XX is the windowID/handle. YY is 1 for the current process, and 0 for all others. ZZ is a sequential number that represents the screen, and it does not equal to the index in the source's name.</li>\n<li><code>name</code> String - A screen source will be named either <code>Entire Screen</code> or <code>Screen &#x3C;index></code>, while the name of a window source will match the window title.</li>\n<li><code>thumbnail</code> <a href=\"/docs/api/native-image\">NativeImage</a> - A thumbnail image. <strong>Note:</strong> There is no guarantee that the size of the thumbnail is the same as the <code>thumbnailSize</code> specified in the <code>options</code> passed to <code>desktopCapturer.getSources</code>. The actual size depends on the scale of the screen or window.</li>\n<li><code>display_id</code> String - A unique identifier that will correspond to the <code>id</code> of the matching <a href=\"/docs/api/structures/display\">Display</a> returned by the <a href=\"/docs/api/screen\">Screen API</a>. On some platforms, this is equivalent to the <code>XX</code> portion of the <code>id</code> field above and on others it will differ. It will be an empty string if not available.</li>\n<li><code>appIcon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - An icon image of the application that owns the window or null if the source has a type screen. The size of the icon is not known in advance and depends on what the application provides.</li>\n</ul>",
      "title": "DesktopCapturerSource Object",
      "description": ""
    },
    "/docs/tutorial/devices": {
      "locale": "ru-RU",
      "slug": "devices",
      "href": "/docs/tutorial/devices",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/devices.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"device-access\"><a href=\"#device-access\">Device Access</a></h1>\n<p>Like Chromium based browsers, Electron provides access to device hardware through web APIs.  For the most part these APIs work like they do in a browser, but there are some differences that need to be taken into account.  The primary difference between Electron and browsers is what happens when device access is requested.  In a browser, users are presented with a popup where they can grant access to an individual device.  In Electron APIs are provided which can be used by a developer to either automatically pick a device or prompt users to pick a device via a developer created interface.</p>\n<h2 id=\"web-bluetooth-api\"><a href=\"#web-bluetooth-api\">Web Bluetooth API</a></h2>\n<p>The <a href=\"https://web.dev/bluetooth/\">Web Bluetooth API</a> can be used to communicate with bluetooth devices. In order to use this API in Electron, developers will need to handle the <a href=\"/docs/api/web-contents#event-select-bluetooth-device\"><code>select-bluetooth-device</code> event on the webContents</a> associated with the device request.</p>\n<h3 id=\"пример\"><a href=\"#пример\">Пример</a></h3>\n<p>This example demonstrates an Electron application that automatically selects the first available bluetooth device when the <code>Test Bluetooth</code> button is clicked.</p>\n<h2 id=\"webhid-api\"><a href=\"#webhid-api\">WebHID API</a></h2>\n<p>The <a href=\"https://web.dev/hid/\">WebHID API</a> can be used to access HID devices such as keyboards and gamepads.  Electron provides several APIs for working with the WebHID API:</p>\n<ul>\n<li>The <a href=\"/docs/api/session#event-select-hid-device\"><code>select-hid-device</code> event on the Session</a> can be used to select a HID device when a call to <code>navigator.hid.requestDevice</code> is made.  Additionally the <a href=\"/docs/api/session#event-hid-device-added\"><code>hid-device-added</code></a> and <a href=\"/docs/api/session#event-hid-device-removed\"><code>hid-device-removed</code></a> events on the Session can be used to handle devices being plugged in or unplugged during the <code>navigator.hid.requestDevice</code> process.</li>\n<li><a href=\"/docs/api/session#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a> can be used to provide default permissioning to devices without first calling for permission to devices via <code>navigator.hid.requestDevice</code>.  Additionally, the default behavior of Electron is to store granted device permision through the lifetime of the corresponding WebContents.  If longer term storage is needed, a developer can store granted device permissions (eg when handling the <code>select-hid-device</code> event) and then read from that storage with <code>setDevicePermissionHandler</code>.</li>\n<li><a href=\"/docs/api/session#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a> can be used to disable HID access for specific origins.</li>\n</ul>\n<h3 id=\"blocklist\"><a href=\"#blocklist\">Blocklist</a></h3>\n<p>By default Electron employs the same <a href=\"https://github.com/WICG/webhid/blob/main/blocklist.txt\">blocklist</a> used by Chromium.  If you wish to override this behavior, you can do so by setting the <code>disable-hid-blocklist</code> flag:</p>\n<pre><code class=\"hljs language-javascript\">app.commandLine.appendSwitch(<span class=\"hljs-string\">'disable-hid-blocklist'</span>)\n</code></pre>\n<h3 id=\"пример-1\"><a href=\"#пример-1\">Пример</a></h3>\n<p>This example demonstrates an Electron application that automatically selects HID devices through <a href=\"/docs/api/session#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a> and through <a href=\"/docs/api/session#event-select-hid-device\"><code>select-hid-device</code> event on the Session</a> when the <code>Test WebHID</code> button is clicked.</p>\n<h2 id=\"web-serial-api\"><a href=\"#web-serial-api\">Web Serial API</a></h2>\n<p>The <a href=\"https://web.dev/serial/\">Web Serial API</a> can be used to access serial devices that are connected via serial port, USB, or Bluetooth.  In order to use this API in Electron, developers will need to handle the <a href=\"/docs/api/session#event-select-serial-port\"><code>select-serial-port</code> event on the Session</a> associated with the serial port request.</p>\n<p>There are several additional APIs for working with the Web Serial API:</p>\n<ul>\n<li>The <a href=\"/docs/api/session#event-serial-port-added\"><code>serial-port-added</code></a> and <a href=\"/docs/api/session#event-serial-port-removed\"><code>serial-port-removed</code></a> events on the Session can be used to handle devices being plugged in or unplugged during the <code>navigator.serial.requestPort</code> process.</li>\n<li><a href=\"/docs/api/session#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a> can be used to disable serial access for specific origins.</li>\n</ul>\n<h3 id=\"пример-2\"><a href=\"#пример-2\">Пример</a></h3>\n<p>This example demonstrates an Electron application that automatically selects the first available Arduino Uno serial device (if connected) through <a href=\"/docs/api/session#event-select-serial-port\"><code>select-serial-port</code> event on the Session</a> when the <code>Test Web Serial</code> button is clicked.</p>",
      "title": "Device Access",
      "description": ""
    },
    "/docs/tutorial/devtools-extension": {
      "locale": "ru-RU",
      "slug": "devtools-extension",
      "href": "/docs/tutorial/devtools-extension",
      "crowdinFileId": "256195",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/devtools-extension.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"расширение-devtools\"><a href=\"#расширение-devtools\">Расширение DevTools</a></h1>\n<p>Electron supports <a href=\"https://developer.chrome.com/extensions/devtools\">Chrome DevTools extensions</a>, which can be used to extend the ability of Chrome's developer tools for debugging popular web frameworks.</p>\n<h2 id=\"loading-a-devtools-extension-with-tooling\"><a href=\"#loading-a-devtools-extension-with-tooling\">Loading a DevTools extension with tooling</a></h2>\n<p>The easiest way to load a DevTools extension is to use third-party tooling to automate the process for you. <a href=\"https://github.com/MarshallOfSound/electron-devtools-installer\">electron-devtools-installer</a> is a popular NPM package that does just that.</p>\n<h2 id=\"manually-loading-a-devtools-extension\"><a href=\"#manually-loading-a-devtools-extension\">Manually loading a DevTools extension</a></h2>\n<p>If you don't want to use the tooling approach, you can also do all of the necessary operations by hand. To load an extension in Electron, you need to download it via Chrome, locate its filesystem path, and then load it into your <a href=\"/docs/api/session\">Session</a> by calling the [<code>ses.loadExtension</code>] API.</p>\n<p>Using the <a href=\"https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi\">React Developer Tools</a> as an example:</p>\n<ol>\n<li>Install the extension in Google Chrome.</li>\n<li>Перейдите ` chrome: // extensions &#x3C;/ 0> и найдите его идентификатор расширения, который является хешем строка как <code> fmkadmapgofadopljbjfkapdkoienihi &#x3C;/ 0>.<p></p></code></li><li><p spaces-before=\"0\"><code>Find out the filesystem location used by Chrome for storing extensions:</code></p></li><code>\n</code></ol><code>\n<ul>\n<li>в Windows it is <code>%LOCALAPPDATA%\\Google\\Chrome\\User Data\\Default\\Extensions`;</code></li><code>\n   * в Linux это может быть:\n     * `~/.config/google-chrome/Default/Extensions/`\n     * `~/.config/google-chrome-beta/Default/Extensions/`\n     * `~/.config/google-chrome-canary/Default/Extensions/`\n     * `~/.config/chromium/Default/Extensions/`\n   * в macOS это `~/Library/Application Support/Google/Chrome/Default/Extensions`.</code></ul><code>\n1 Передайте местоположение расширения в [`ses.loadExtension`][load-extension] API. For React Developer Tools `v4.9.0`, it looks something like:\n<pre><code class=\"hljs language-javascript\"> <span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n <span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n\n <span class=\"hljs-comment\">// on macOS</span>\n <span class=\"hljs-keyword\">const</span> reactDevToolsPath = path.join(\n   os.homedir(),\n   <span class=\"hljs-string\">'/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/4.9.0_0'</span>\n )\n\n app.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n   <span class=\"hljs-keyword\">await</span> session.defaultSession.loadExtension(reactDevToolsPath)\n })\n</code></pre>\n\n<p><strong>Примечания:</strong></p>\n<ul>\n<li><code>loadExtension</code> returns a Promise with an <a href=\"/docs/api/structures/extension\">Extension object</a>, which contains metadata about the extension that was loaded. This promise needs to resolve (e.g. with an <code>await</code> expression) before loading a page. Otherwise, the extension won't be guaranteed to load.</li>\n<li><code>loadExtension</code> cannot be called before the <code>ready</code> event of the <code>app</code> module is emitted, nor can it be called on in-memory (non-persistent) sessions.</li>\n<li><code>loadExtension</code> must be called on every boot of your app if you want the extension to be loaded.</li>\n</ul>\n<h3 id=\"removing-a-devtools-extension\"><a href=\"#removing-a-devtools-extension\">Removing a DevTools extension</a></h3>\n<p>You can pass the extension's ID to the <a href=\"/docs/api/session#sesremoveextensionextensionid\"><code>ses.removeExtension</code></a> API to remove it from your Session. Loaded extensions are not persisted between app launches.</p>\n<h2 id=\"devtools-extension-support\"><a href=\"#devtools-extension-support\">DevTools extension support</a></h2>\n<p>Electron only supports <a href=\"/docs/api/extensions\">a limited set of <code>chrome.*</code> APIs</a>, so extensions using unsupported <code>chrome.*</code> APIs under the hood may not work.</p>\n<p>The following Devtools extensions have been tested to work in Electron:</p>\n<ul>\n<li><a href=\"https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi\">Ember Inspector</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi\">React Developer Tools</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/backbone-debugger/bhljhndlimiafopmmhjlgfpnnchjjbhd\">Backbone Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/jquery-debugger/dbhhnnnpaeobfddmlalhnehgclcmjimi\">jQuery Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/angularjs-batarang/ighdmehidhipcmcojjgiloacoafjmpfk\">AngularJS Batarang</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd\">Vue.js devtools</a></li>\n<li><a href=\"https://cerebraljs.com/docs/introduction/devtools.html\">Cerebral Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd\">Redux DevTools Extension</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/mobx-developer-tools/pfgnfdagidkfgccljigdamigbcnndkod\">MobX Developer Tools</a></li>\n</ul>\n<h3 id=\"what-should-i-do-if-a-devtools-extension-is-not-working\"><a href=\"#what-should-i-do-if-a-devtools-extension-is-not-working\">What should I do if a DevTools extension is not working?</a></h3>\n<p>First, please make sure the extension is still being maintained and is compatible with the latest version of Google Chrome. We cannot provide additional support for unsupported extensions.</p>\n<p>If the extension works on Chrome but not on Electron, file a bug in Electron's <a href=\"https://github.com/electron/electron/issues\">issue tracker</a> and describe which part of the extension is not working as expected.</p></code></code>",
      "title": "Расширение DevTools",
      "description": ""
    },
    "/docs/api/dialog": {
      "locale": "ru-RU",
      "slug": "dialog",
      "href": "/docs/api/dialog",
      "crowdinFileId": "256309",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/dialog.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dialog\"><a href=\"#dialog\">dialog</a></h1>\n<blockquote>\n<p>Показывает стандартные диалоги для открытия и сохранения файлов, предупреждения и т.п.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p>Пример для показа диалога выбора нескольких файлов:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(dialog.showOpenDialog({ <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'multiSelections'</span>] }))\n</code></pre>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code>dialog</code> имеет следующие методы:</p>\n<h3 id=\"dialogshowopendialogsyncbrowserwindow-options\"><a href=\"#dialogshowopendialogsyncbrowserwindow-options\"><code>dialog.showOpenDialogSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (опционально)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> String (опционально)</li>\n<li><code>defaultPath</code> String (опционально)</li>\n<li><code>buttonLabel</code> String(опционально) - Пользовательский текст кнопки подтверждения. Если оставить пустым будет использован стандартный текст.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (опционально)</li>\n<li><code>properties</code> String[] (optional) - Contains which features the dialog should use. The following values are supported:<ul>\n<li><code>openFile</code> - Позволяет выбирать файлы.</li>\n<li><code>openDirectory</code> - Позволяет выбирать папки.</li>\n<li><code>multiSelections</code> - Позволяет выбрать несколько объектов.</li>\n<li><code>showHiddenFiles</code> - Отображает в диалоге скрытые файлы.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Позволяет создавать новые директории из диалога.</li>\n<li><code>promptToCreate</code> <em>Windows</em> - Запрашивает подтверждение на создание недостающих папок по выбранному пути, если они не существуют. На самом деле, эта функция не создаёт их. Она всего лишь позволяет возвращать несуществующие пути из диалогового окна, которые должны после этого быть созданы приложением.</li>\n<li><code>noResolveAliases</code> <em>macOS</em> - Disable the automatic alias (symlink) path resolution. Selected aliases will now return the alias path instead of their target path.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Считает пакеты, такие как папки <code>.app</code>, за папки, а не файлы.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - Do not add the item being opened to the recent documents list.</li>\n</ul></li>\n<li><code>message</code> String (опционально) <em>macOS</em> - Сообщение, которое будет отображено над полями ввода.</li>\n<li><code>securityScopedBookmarks</code> Boolean (опционально) <em>macOS</em> <em>mas</em> - Создает <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">закладки с областью безопасности</a>, при сборке пакета для Mac App Store.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>String[] | undefined</code> - пути файла, выбранные пользователем; если диалог отменен, то возвращает <code>undefined</code>.</p>\n<p>Аргумент <code>browserWindow</code> позволяет диалоговому окну прикрепляться к родительскому, что делает его модальным.</p>\n<p>The <code>filters</code> specifies an array of file types that can be displayed or selected when you want to limit the user to a specific type. Например:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">filters</span>: [\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Изображения'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'jpg'</span>, <span class=\"hljs-string\">'png'</span>, <span class=\"hljs-string\">'gif'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Видео'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'mkv'</span>, <span class=\"hljs-string\">'avi'</span>, <span class=\"hljs-string\">'mp4'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Свой тип файлов'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'as'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Все файлы'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'*'</span>] }\n  ]\n}\n</code></pre>\n<p>Массив <code>extentions</code> должен содержать расширения файлов без шаблонов поиска и точек (например, <code>png</code> - верно, а <code>.png</code> и <code>*.png</code> - нет). Для того, чтобы показать все фалы, можно использовать шаблон поиска <code>'*'</code> (другие шаблоны не поддерживаются).</p>\n<p><strong>Замечание:</strong> на Windows и Linux в диалоговом окне нельзя дновременно выбирать и файлы, и директории, так что если вы установили <code>properties</code> в <code>['openFile', 'openDirectory']</code> на этих платформах, то возможно будет выбирать только директории.</p>\n<pre><code class=\"hljs language-js\">dialog.showOpenDialogSync(mainWindow, {\n  <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'openDirectory'</span>]\n})\n</code></pre>\n<h3 id=\"dialogshowopendialogbrowserwindow-options\"><a href=\"#dialogshowopendialogbrowserwindow-options\"><code>dialog.showOpenDialog([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (опционально)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> String (опционально)</li>\n<li><code>defaultPath</code> String (опционально)</li>\n<li><code>buttonLabel</code> String(опционально) - Пользовательский текст кнопки подтверждения. Если оставить пустым будет использован стандартный текст.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (опционально)</li>\n<li><code>properties</code> String[] (optional) - Contains which features the dialog should use. The following values are supported:<ul>\n<li><code>openFile</code> - Позволяет выбирать файлы.</li>\n<li><code>openDirectory</code> - Позволяет выбирать папки.</li>\n<li><code>multiSelections</code> - Позволяет выбрать несколько объектов.</li>\n<li><code>showHiddenFiles</code> - Отображает в диалоге скрытые файлы.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Позволяет создавать новые директории из диалога.</li>\n<li><code>promptToCreate</code> <em>Windows</em> - Запрашивает подтверждение на создание недостающих папок по выбранному пути, если они не существуют. На самом деле, эта функция не создаёт их. Она всего лишь позволяет возвращать несуществующие пути из диалогового окна, которые должны после этого быть созданы приложением.</li>\n<li><code>noResolveAliases</code> <em>macOS</em> - Disable the automatic alias (symlink) path resolution. Selected aliases will now return the alias path instead of their target path.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Считает пакеты, такие как папки <code>.app</code>, за папки, а не файлы.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - Do not add the item being opened to the recent documents list.</li>\n</ul></li>\n<li><code>message</code> String (опционально) <em>macOS</em> - Сообщение, которое будет отображено над полями ввода.</li>\n<li><code>securityScopedBookmarks</code> Boolean (опционально) <em>macOS</em> <em>mas</em> - Создает <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">закладки с областью безопасности</a>, при сборке пакета для Mac App Store.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;Object></code> - Разрешить с объектом, содержащим следующее:</p>\n<ul>\n<li><code>canceled</code> Boolean - независимо от того, был ли диалог отменен.</li>\n<li><code>filePaths</code> String[] - Массив файлов, которые выбрал пользователь. If the dialog is cancelled this will be an empty array.</li>\n<li><code>bookmarks</code> String[] (optional) <em>macOS</em> <em>mas</em> - An array matching the <code>filePaths</code> array of base64 encoded strings which contains security scoped bookmark data. Для его использования, <code>securityScopedBookmarks</code> должны быть активированы. (For return values, see <a href=\"#bookmarks-array\">table here</a>.)</li>\n</ul>\n<p>Аргумент <code>browserWindow</code> позволяет диалоговому окну прикрепляться к родительскому, что делает его модальным.</p>\n<p>The <code>filters</code> specifies an array of file types that can be displayed or selected when you want to limit the user to a specific type. Например:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">filters</span>: [\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Изображения'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'jpg'</span>, <span class=\"hljs-string\">'png'</span>, <span class=\"hljs-string\">'gif'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Видео'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'mkv'</span>, <span class=\"hljs-string\">'avi'</span>, <span class=\"hljs-string\">'mp4'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Свой тип файлов'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'as'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Все файлы'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'*'</span>] }\n  ]\n}\n</code></pre>\n<p>Массив <code>extentions</code> должен содержать расширения файлов без шаблонов поиска и точек (например, <code>png</code> - верно, а <code>.png</code> и <code>*.png</code> - нет). Для того, чтобы показать все фалы, можно использовать шаблон поиска <code>'*'</code> (другие шаблоны не поддерживаются).</p>\n<p><strong>Замечание:</strong> на Windows и Linux в диалоговом окне нельзя дновременно выбирать и файлы, и директории, так что если вы установили <code>properties</code> в <code>['openFile', 'openDirectory']</code> на этих платформах, то возможно будет выбирать только директории.</p>\n<pre><code class=\"hljs language-js\">dialog.showOpenDialog(mainWindow, {\n  <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'openDirectory'</span>]\n}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">result</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(result.canceled)\n  <span class=\"hljs-built_in\">console</span>.log(result.filePaths)\n}).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(err)\n})\n</code></pre>\n<h3 id=\"dialogshowsavedialogsyncbrowserwindow-options\"><a href=\"#dialogshowsavedialogsyncbrowserwindow-options\"><code>dialog.showSaveDialogSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (опционально)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> String (optional) - The dialog title. Cannot be displayed on some <em>Linux</em> desktop environments.</li>\n<li><code>defaultPath</code> String (опционально) - Абсолютный путь к директории, файлу или имя файла выбранного по умолчанию.</li>\n<li><code>buttonLabel</code> String(опционально) - Пользовательский текст кнопки подтверждения. Если оставить пустым будет использован стандартный текст.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (опционально)</li>\n<li><code>message</code> String (опционально) <em>macOS</em> - Сообщение, которое будет показано над полями ввода.</li>\n<li><code>nameFieldLabel</code> String (опционально) <em>macOS</em> - Специальная метка для текста, отображаемая перед текстовым полем с именем файла.</li>\n<li><code>showsTagField</code> Boolean (опционально) <em>macOS</em> - Показать поле ввода тегов, по умолчанию <code>true</code>.</li>\n<li><code>properties</code> String[] (optional)<ul>\n<li><code>showHiddenFiles</code> - Отображает в диалоге скрытые файлы.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Позволяет создавать новые директории из диалога.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Считает пакеты, такие как папки <code>.app</code>, за папки, а не файлы.</li>\n<li><code>showOverwriteConfirmation</code> <em>Linux</em> - Sets whether the user will be presented a confirmation dialog if the user types a file name that already exists.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - Do not add the item being saved to the recent documents list.</li>\n</ul></li>\n<li><code>securityScopedBookmarks</code> Boolean (необязательно) <em>maxOS</em> <em>mas</em> - Создавать <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">закладки с областью безопасности</a> при сборке для Mac App Store. Если эта опция включена и выбранного файла не существует, то пустой файл будет создан по выбранному пути.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>String | undefined</code>, путь к файлу, выбранному пользователем; если диалог отменен, то возвращает <code>undefined</code>.</p>\n<p>Аргумент <code>browserWindow</code> позволяет диалоговому окну прикрепляться к родительскому, что делает его модальным.</p>\n<p><code>filters</code> определяет массив типов файлов, которые могут быть отображены. Для примера смотрите <code>dialog.showOpenDialog</code>.</p>\n<h3 id=\"dialogshowsavedialogbrowserwindow-options\"><a href=\"#dialogshowsavedialogbrowserwindow-options\"><code>dialog.showSaveDialog([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (опционально)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> String (optional) - The dialog title. Cannot be displayed on some <em>Linux</em> desktop environments.</li>\n<li><code>defaultPath</code> String (опционально) - Абсолютный путь к директории, файлу или имя файла выбранного по умолчанию.</li>\n<li><code>buttonLabel</code> String(опционально) - Пользовательский текст кнопки подтверждения. Если оставить пустым будет использован стандартный текст.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (опционально)</li>\n<li><code>message</code> String (опционально) <em>macOS</em> - Сообщение, которое будет показано над полями ввода.</li>\n<li><code>nameFieldLabel</code> String (опционально) <em>macOS</em> - Специальная метка для текста, отображаемая перед текстовым полем с именем файла.</li>\n<li><code>showsTagField</code> Boolean (optional) <em>macOS</em> - Show the tags input box, defaults to <code>true</code>.</li>\n<li><code>properties</code> String[] (optional)<ul>\n<li><code>showHiddenFiles</code> - Отображает в диалоге скрытые файлы.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Позволяет создавать новые директории из диалога.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Считает пакеты, такие как папки <code>.app</code>, за папки, а не файлы.</li>\n<li><code>showOverwriteConfirmation</code> <em>Linux</em> - Sets whether the user will be presented a confirmation dialog if the user types a file name that already exists.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - Do not add the item being saved to the recent documents list.</li>\n</ul></li>\n<li><code>securityScopedBookmarks</code> Boolean (необязательно) <em>maxOS</em> <em>mas</em> - Создавать <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">закладки с областью безопасности</a> при сборке для Mac App Store. Если эта опция включена и выбранного файла не существует, то пустой файл будет создан по выбранному пути.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;Object></code> - Разрешить с объектом, содержащим следующее:</p>\n<ul>\n<li><code>canceled</code> Boolean - независимо от того, был ли диалог отменен.</li>\n<li><code>filePath</code> String (optional) - If the dialog is canceled, this will be <code>undefined</code>.</li>\n<li><code>bookmark</code> String (необязательно) <em>macOS</em> <em>mas</em> - Строка в кодировке base64, содержащая зкладку с областью безопасности сохранённого файла. <code>securityScopedBookmarks</code> должны быть активированы для её использования. (For return values, see <a href=\"#bookmarks-array\">table here</a>.)</li>\n</ul>\n<p>Аргумент <code>browserWindow</code> позволяет диалоговому окну прикрепляться к родительскому, что делает его модальным.</p>\n<p><code>filters</code> определяет массив типов файлов, которые могут быть отображены. Для примера смотрите <code>dialog.showOpenDialog</code>.</p>\n<p><strong>Заметка:</strong> На MacOS, рекомендуется асинхронная версия, чтобы избежать проблем при расширении и свёртывании окна.</p>\n<h3 id=\"dialogshowmessageboxsyncbrowserwindow-options\"><a href=\"#dialogshowmessageboxsyncbrowserwindow-options\"><code>dialog.showMessageBoxSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (опционально)</li>\n<li><code>options</code> Object<ul>\n<li><code>message</code> String - содержимое сообщения.</li>\n<li><code>type</code> String (опционально) - Может быть <code>\"none\"</code>, <code>\"info\"</code>, <code>\"error\"</code>, <code>\"question\"</code> или <code>\"warning\"</code>. В Windows, <code>\"question\"</code> отображает ту же иконку, что и <code>\"info\"</code>, если вы не установили иконку, используя опцию <code>\"icon\"</code>. На macOS и <code>\"warning\"</code> и <code>\"error\"</code> отображают ту же иконку предупреждения (warning).</li>\n<li><code>buttons</code> String[] (optional) - Array of texts for buttons. On Windows, an empty array will result in one button labeled \"OK\".</li>\n<li><code>defaultId</code> Integer (опционально) - Индекс кнопки в массиве кнопок, который будет выбран по умолчанию при открытии окна сообщения.</li>\n<li><code>title</code> String (необязательно) - Заголовок окна сообщения, некоторые платформы не смогут его отобразить.</li>\n<li><code>detail</code> String (опционально) - Дополнительные сведения о сообщении.</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (опционально)</li>\n<li><code>textWidth</code> Integer (optional) <em>macOS</em> - Custom width of the text in the message box.</li>\n<li><code>cancelId</code> Integer (опционально) - Индекс кнопки, которая будет использоваться для отмены диалога, через клавишу <code>Esc</code>. По умолчанию это назначается первой кнопке с меткой \"Отмена\" или \"Нет\". Если этот параметр не установлен и нет таких отмеченных кнопок, как возвращаемое значение будет использоваться <code>0</code>.</li>\n<li><code>noLink</code> Boolean (опционально) - В Windows Electron попытается выяснить, какие из <code>buttons</code> являются общими кнопками (например, «Отмена» или «Да»), и отобразить остальные как ссылки команд в диалоговом окне. Это может сделать диалог в стиле современных приложений Windows. Если вам не нравится такое поведение, вы можете установить <code>noLink</code> на <code>true</code>.</li>\n<li><code>normalizeAccessKeys</code> Boolean (опционально) - Нормализация клавиш доступа к клавиатуре на разных платформах. По умолчанию - <code>false</code>. Включение этого предполагает, что <code>&#x26;</code> используется в метках кнопок для размещения клавиши быстрого доступа, и метки будут преобразованы, чтобы они правильно работали на каждой платформе, символы <code>&#x26;</code> удаляются в macOS, преобразуются в <code>_</code> в Linux и остаются нетронутыми в Windows. Например, метка кнопки <code>Vie&#x26;w</code> будет преобразована в <code>Vie_w</code> в Linux и <code>View </code> в macOS и может быть выбрана с помощью <code>Alt-W</code> в Windows и Linux.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Integer</code> - индекс нажатой кнопки.</p>\n<p>Показывает окно сообщения, оно будет блокировать процесс, пока не будет закрыто окно сообщения. It returns the index of the clicked button.</p>\n<p>Аргумент <code>browserWindow</code> позволяет диалоговому окну прикрепляться к родительскому, что делает его модальным. If <code>browserWindow</code> is not shown dialog will not be attached to it. В этом случае он будет отображаться как независимое окно.</p>\n<h3 id=\"dialogshowmessageboxbrowserwindow-options\"><a href=\"#dialogshowmessageboxbrowserwindow-options\"><code>dialog.showMessageBox([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (опционально)</li>\n<li><code>options</code> Object<ul>\n<li><code>message</code> String - содержимое сообщения.</li>\n<li><code>type</code> String (опционально) - Может быть <code>\"none\"</code>, <code>\"info\"</code>, <code>\"error\"</code>, <code>\"question\"</code> или <code>\"warning\"</code>. В Windows, <code>\"question\"</code> отображает ту же иконку, что и <code>\"info\"</code>, если вы не установили иконку, используя опцию <code>\"icon\"</code>. На macOS и <code>\"warning\"</code> и <code>\"error\"</code> отображают ту же иконку предупреждения (warning).</li>\n<li><code>buttons</code> String[] (optional) - Array of texts for buttons. On Windows, an empty array will result in one button labeled \"OK\".</li>\n<li><code>defaultId</code> Integer (опционально) - Индекс кнопки в массиве кнопок, который будет выбран по умолчанию при открытии окна сообщения.</li>\n<li><code>signal</code> AbortSignal (optional) - Pass an instance of <a href=\"https://nodejs.org/api/globals.html#globals_class_abortsignal\">AbortSignal</a> to optionally close the message box, the message box will behave as if it was cancelled by the user. On macOS, <code>signal</code> does not work with message boxes that do not have a parent window, since those message boxes run synchronously due to platform limitations.</li>\n<li><code>title</code> String (необязательно) - Заголовок окна сообщения, некоторые платформы не смогут его отобразить.</li>\n<li><code>detail</code> String (опционально) - Дополнительные сведения о сообщении.</li>\n<li><code>checkboxLabel</code> String (опционально) - Если это предусмотрено, в окне сообщения будет установлен флажок с данной меткой.</li>\n<li><code>checkboxChecked</code> Boolean (optional) - Initial checked state of the checkbox. По умолчанию <code>false</code>.</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> (опционально)</li>\n<li><code>textWidth</code> Integer (optional) <em>macOS</em> - Custom width of the text in the message box.</li>\n<li><code>cancelId</code> Integer (опционально) - Индекс кнопки, которая будет использоваться для отмены диалога, через клавишу <code>Esc</code>. По умолчанию это назначается первой кнопке с меткой \"Отмена\" или \"Нет\". Если этот параметр не установлен и нет таких отмеченных кнопок, как возвращаемое значение будет использоваться <code>0</code>.</li>\n<li><code>noLink</code> Boolean (опционально) - В Windows Electron попытается выяснить, какие из <code>buttons</code> являются общими кнопками (например, «Отмена» или «Да»), и отобразить остальные как ссылки команд в диалоговом окне. Это может сделать диалог в стиле современных приложений Windows. Если вам не нравится такое поведение, вы можете установить <code>noLink</code> на <code>true</code>.</li>\n<li><code>normalizeAccessKeys</code> Boolean (опционально) - Нормализация клавиш доступа к клавиатуре на разных платформах. По умолчанию - <code>false</code>. Включение этого предполагает, что <code>&#x26;</code> используется в метках кнопок для размещения клавиши быстрого доступа, и метки будут преобразованы, чтобы они правильно работали на каждой платформе, символы <code>&#x26;</code> удаляются в macOS, преобразуются в <code>_</code> в Linux и остаются нетронутыми в Windows. Например, метка кнопки <code>Vie&#x26;w</code> будет преобразована в <code>Vie_w</code> в Linux и <code>View </code> в macOS и может быть выбрана с помощью <code>Alt-W</code> в Windows и Linux.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;Object></code> - разрешает Promise, содержащие следующие свойства:</p>\n<ul>\n<li><code>response</code> Number - The index of the clicked button.</li>\n<li><code>checkboxChecked</code> Boolean - The checked state of the checkbox if <code>checkboxLabel</code> was set. Otherwise <code>false</code>.</li>\n</ul>\n<p>Shows a message box.</p>\n<p>Аргумент <code>browserWindow</code> позволяет диалоговому окну прикрепляться к родительскому, что делает его модальным.</p>\n<h3 id=\"dialogshowerrorboxtitle-content\"><a href=\"#dialogshowerrorboxtitle-content\"><code>dialog.showErrorBox(title, content)</code></a></h3>\n<ul>\n<li><code>title</code> String - Заголовок для отображения в поле ошибки.</li>\n<li><code>title</code> String - Текстовое содержимое для отображения в поле ошибки.</li>\n</ul>\n<p>Отображает модальное диалоговое окно, показывающее сообщение об ошибке.</p>\n<p>Этот API можно безопасно вызывать до события <code>ready</code>, которое выдает модуль <code>app</code>, он обычно используется для сообщений об ошибках на ранней стадии запуска. При вызове до события app <code>ready</code> в Linux, сообщение будет выдано в stderr, и диалоговое окно GUI не появится.</p>\n<h3 id=\"dialogshowcertificatetrustdialogbrowserwindow-options-macos-windows\"><a href=\"#dialogshowcertificatetrustdialogbrowserwindow-options-macos-windows\"><code>dialog.showCertificateTrustDialog([browserWindow, ]options)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (опционально)</li>\n<li><code>options</code> Object<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> - Сертификат доверия/импорта.</li>\n<li><code>message</code> String - Сообщение, отображаемое пользователю.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code> - выполняется, когда показано диалоговое окно доверия сертификата.</p>\n<p>На macOS отображается модальное диалоговое окно, которое показывает сообщение и сертификат информации, и предоставляет пользователю возможность доверия/импорта сертификата. Если вы укажете аргумент <code>browserWindow</code>, диалоговое окно будет присоединено к родительскому окну, что сделает его модальным.</p>\n<p>В Windows параметры более ограничены, благодаря используемым API Win32:</p>\n<ul>\n<li>Не используется аргумент <code>message</code>, так как ОС предоставляет свое собственное подтверждение диалогового окна.</li>\n<li>Экран <code>browserWindow</code> игнорируется, поскольку невозможно сделать это диалоговое окно подтверждения.</li>\n</ul>\n<h2 id=\"bookmarks-array\"><a href=\"#bookmarks-array\">Bookmarks array</a></h2>\n<p><code>showOpenDialog</code>, <code>showOpenDialogSync</code>, <code>showSaveDialog</code>, and <code>showSaveDialogSync</code> will return a <code>bookmarks</code> array.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Build Type</th><th>securityScopedBookmarks boolean</th><th align=\"center\">Return Type</th><th>Return Value</th></tr></thead><tbody><tr><td>macOS mas</td><td>True</td><td align=\"center\">Success</td><td><code>['LONGBOOKMARKSTRING']</code></td></tr><tr><td>macOS mas</td><td>True</td><td align=\"center\">Error</td><td><code>['']</code> (array of empty string)</td></tr><tr><td>macOS mas</td><td>False</td><td align=\"center\">NA</td><td><code>[]</code> (empty array)</td></tr><tr><td>non mas</td><td>any</td><td align=\"center\">NA</td><td><code>[]</code> (empty array)</td></tr></tbody></table>\n<h2 id=\"листы\"><a href=\"#листы\">\"Листы\"</a></h2>\n<p>В macOS диалоговые окна представляются в виде листов, прикрепленных к окну, если вы указали ссылку <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> в параметре <code>browserWindow</code>, или являются модальными, если окно не предусмотрено.</p>\n<p>Вы можете вызвать <code>BrowserWindow.getCurrentWindow().SetSheetOffset(offset)</code>, чтобы изменить смещение рамки окна, к которой прикреплены листы.</p>",
      "title": "dialog",
      "description": "Показывает стандартные диалоги для открытия и сохранения файлов, предупреждения и т.п."
    },
    "/docs/api/structures/display": {
      "locale": "ru-RU",
      "slug": "display",
      "href": "/docs/api/structures/display",
      "crowdinFileId": "256427",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/display.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"display-object\"><a href=\"#display-object\">Display Object</a></h1>\n<ul>\n<li><code>id</code> Number - Unique identifier associated with the display.</li>\n<li><code>rotation</code> Number - Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.</li>\n<li><code>scaleFactor</code> Number - Output device's pixel scale factor.</li>\n<li><code>touchSupport</code> String - Can be <code>available</code>, <code>unavailable</code>, <code>unknown</code>.</li>\n<li><code>monochrome</code> Boolean - Whether or not the display is a monochrome display.</li>\n<li><code>accelerometerSupport</code> String - Can be <code>available</code>, <code>unavailable</code>, <code>unknown</code>.</li>\n<li><code>colorSpace</code> String -  represent a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions</li>\n<li><code>colorDepth</code> Number - The number of bits per pixel.</li>\n<li><code>depthPerComponent</code> Number - The number of bits per color component.</li>\n<li><code>displayFrequency</code> Number - The display refresh rate.</li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - the bounds of the display in DIP points.</li>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a></li>\n<li><code>workArea</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - the work area of the display in DIP points.</li>\n<li><code>workAreaSize</code> <a href=\"/docs/api/structures/size\">Size</a></li>\n<li><code>internal</code> Boolean - <code>true</code> for an internal display and <code>false</code> for an external display</li>\n</ul>\n<p>The <code>Display</code> object represents a physical display connected to the system. A fake <code>Display</code> may exist on a headless system, or a <code>Display</code> may correspond to a remote, virtual display.</p>",
      "title": "Display Object",
      "description": ""
    },
    "/docs/api/dock": {
      "locale": "ru-RU",
      "slug": "dock",
      "href": "/docs/api/dock",
      "crowdinFileId": "256311",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/dock.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"класс-dock\"><a href=\"#класс-dock\">Класс: Dock</a></h2>\n<blockquote>\n<p>Управляйте вашим приложением в macOS dock</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Следующий пример показывает, как отскочить вашу иконку в dock.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.dock.bounce()\n</code></pre>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<h4 id=\"dockbouncetype-macos\"><a href=\"#dockbouncetype-macos\"><code>dock.bounce([type])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>type</code> String (опционально) - Может быть <code>critical</code> или <code>informational</code>. По умолчанию <code>informational</code></li>\n</ul>\n<p>Возвращает <code>Integer</code> - ID, представляющий запрос.</p>\n<p>Когда <code>critical</code> передается, значок dock будет отскакивать, пока приложение не станет активным или запрос отменяется.</p>\n<p>Когда <code>informational</code> пропущен, значок dock будет подпрыгивать в течение одной секунды. Тем не менее, запрос остается активным, пока приложение не станет активным или запрос не будет отменен.</p>\n<p><strong>Обратите внимание:</strong> Этот метод можно использовать только тогда, когда приложение не сфокусировано; когда приложение сфокусировано, оно вернет -1.</p>\n<h4 id=\"dockcancelbounceid-macos\"><a href=\"#dockcancelbounceid-macos\"><code>dock.cancelBounce(id)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Отменить отскок по <code>id</code>.</p>\n<h4 id=\"dockdownloadfinishedfilepath-macos\"><a href=\"#dockdownloadfinishedfilepath-macos\"><code>dock.downloadFinished(filePath)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n</ul>\n<p>Отскакивает от \"Downloads\", если путь к файлу находится в папке \"Downloads\".</p>\n<h4 id=\"docksetbadgetext-macos\"><a href=\"#docksetbadgetext-macos\"><code>dock.setBadge(text)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Устанавливает строку для отображения в панели dock запирающими областями.</p>\n<h4 id=\"dockgetbadge-macos\"><a href=\"#dockgetbadge-macos\"><code>dock.getBadge()</code> <em>macOS</em></a></h4>\n<p>Возвращает <code>String</code> - строки значка в dock.</p>\n<h4 id=\"dockhide-macos\"><a href=\"#dockhide-macos\"><code>dock.hide()</code> <em>macOS</em></a></h4>\n<p>Скрыть значок в dock.</p>\n<h4 id=\"dockshow-macos\"><a href=\"#dockshow-macos\"><code>dock.show()</code> <em>macOS</em></a></h4>\n<p>Возвращает <code>Promise&#x3C;void></code> - выполняется, когда показан значок dock.</p>\n<h4 id=\"dockisvisible-macos\"><a href=\"#dockisvisible-macos\"><code>dock.isVisible()</code> <em>macOS</em></a></h4>\n<p>Возвращает <code>Boolean</code> - виден или нет значок dock.</p>\n<h4 id=\"docksetmenumenu-macos\"><a href=\"#docksetmenumenu-macos\"><code>dock.setMenu(menu)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>menu</code> <a href=\"/docs/api/menu\">Menu</a></li>\n</ul>\n<p>Устанавливает Dock меню приложения [dock-menu].</p>\n<h4 id=\"dockgetmenu-macos\"><a href=\"#dockgetmenu-macos\"><code>dock.getMenu()</code> <em>macOS</em></a></h4>\n<p>Возвращает <code>Menu | null</code> - Dock меню приложения [dock-menu].</p>\n<h4 id=\"dockseticonimage-macos\"><a href=\"#dockseticonimage-macos\"><code>dock.setIcon(image)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>Задает <code>image</code>, связывает со значком в dock.</p>",
      "title": "Класс: Dock",
      "description": "Управляйте вашим приложением в macOS dock"
    },
    "/docs/api/download-item": {
      "locale": "ru-RU",
      "slug": "download-item",
      "href": "/docs/api/download-item",
      "crowdinFileId": "256313",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/download-item.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-downloaditem\"><a href=\"#class-downloaditem\">Class: DownloadItem</a></h2>\n<blockquote>\n<p>Контроль загрузки файлов из удаленных источников.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>DownloadItem</code> это <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>, который представляет элемент загрузки в Electron. Он используется в событии <code>will-download</code> класса <code>Session</code> и позволяет пользователям управлять элементом загрузки.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// В основном процессе.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.session.on(<span class=\"hljs-string\">'will-download'</span>, (event, item, webContents) => {\n  <span class=\"hljs-comment\">// Установите путь сохранения, чтобы Electron не отображал диалоговое окно сохранения.</span>\n  item.setSavePath(<span class=\"hljs-string\">'/tmp/save.pdf'</span>)\n\n  item.on(<span class=\"hljs-string\">'updated'</span>, (event, state) => {\n    <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'interrupted'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download is interrupted but can be resumed'</span>)\n    } <span class=\"hljs-keyword\">else</span> <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'progressing'</span>) {\n      <span class=\"hljs-keyword\">if</span> (item.isPaused()) {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download is paused'</span>)\n      } <span class=\"hljs-keyword\">else</span> {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Received bytes: <span class=\"hljs-subst\">${item.getReceivedBytes()}</span>`</span>)\n      }\n    }\n  })\n  item.once(<span class=\"hljs-string\">'done'</span>, (event, state) => {\n    <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'completed'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download successfully'</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Download failed: <span class=\"hljs-subst\">${state}</span>`</span>)\n    }\n  })\n})\n</code></pre>\n<h3 id=\"события-экземпляра\"><a href=\"#события-экземпляра\">События экземпляра</a></h3>\n<h4 id=\"событие-updated\"><a href=\"#событие-updated\">Событие: 'updated'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>state</code> String - Может быть <code>progressing</code> или <code>interrupted</code>.</li>\n</ul>\n<p>Возникает, когда загрузка была обновлена и не завершена.</p>\n<p><code>state</code> может быть одним из следующих:</p>\n<ul>\n<li><code>progressing</code> - Загрузка находится в процессе загрузки.</li>\n<li><code>interrupted</code> - загрузка прервалась и может быть возобновлена.</li>\n</ul>\n<h4 id=\"событие-done\"><a href=\"#событие-done\">Событие: 'done'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>state</code> String - может быть завершено <code>completed</code>, отменено <code>cancelled</code> или прервано <code>interrupted</code>.</li>\n</ul>\n<p>Emitted when the download is in a terminal state. This includes a completed download, a cancelled download (via <code>downloadItem.cancel()</code>), and interrupted download that can't be resumed.</p>\n<p><code>state</code> может быть одним из следующих:</p>\n<ul>\n<li><code>completed</code> - Загрузка завершена успешно.</li>\n<li><code>cancelled</code> - загрузка была отменена.</li>\n<li><code>interrupted</code> - загрузка прервалась и не может быть возобновлена.</li>\n</ul>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<p>Объект <code>downloadItem</code> имеет следующие методы:</p>\n<h4 id=\"downloaditemsetsavepathpath\"><a href=\"#downloaditemsetsavepathpath\"><code>downloadItem.setSavePath(path)</code></a></h4>\n<ul>\n<li><code>path</code> String - Установить путь сохраняемого элемента загрузки.</li>\n</ul>\n<p>API доступен только в сессии <code>will-download</code> функции обратного вызова. If <code>path</code> doesn't exist, Electron will try to make the directory recursively. Если пользователь не устанавливает путь сохранения через API, Electron будет использовать исходную процедуру для определения пути сохранения; здесь обычно вызывается диалоговое окно сохранения.</p>\n<h4 id=\"downloaditemgetsavepath\"><a href=\"#downloaditemgetsavepath\"><code>downloadItem.getSavePath()</code></a></h4>\n<p>Returns <code>String</code> - The save path of the download item. This will be either the path set via <code>downloadItem.setSavePath(path)</code> or the path selected from the shown save dialog.</p>\n<h4 id=\"downloaditemsetsavedialogoptionsoptions\"><a href=\"#downloaditemsetsavedialogoptionsoptions\"><code>downloadItem.setSaveDialogOptions(options)</code></a></h4>\n<ul>\n<li><code>options</code> SaveDialogOptions - Установите параметры диалога сохранения. Этот объект имеет те же свойства, что и параметры <code>options</code> в <a href=\"/docs/api/dialog\"><code>dialog.showSaveDialog()</code></a>.</li>\n</ul>\n<p>This API allows the user to set custom options for the save dialog that opens for the download item by default. API доступен только в сессии <code>will-download</code> функции обратного вызова.</p>\n<h4 id=\"downloaditemgetsavedialogoptions\"><a href=\"#downloaditemgetsavedialogoptions\"><code>downloadItem.getSaveDialogOptions()</code></a></h4>\n<p>Возвращает <code>SaveDialogOptions</code> - Возвращает ранее установленный объект <code>downloadItem.setSaveDialogOptions(options)</code>.</p>\n<h4 id=\"downloaditempause\"><a href=\"#downloaditempause\"><code>downloadItem.pause()</code></a></h4>\n<p>Приостановить скачивание.</p>\n<h4 id=\"downloaditemispaused\"><a href=\"#downloaditemispaused\"><code>downloadItem.isPaused()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the download is paused.</p>\n<h4 id=\"downloaditemresume\"><a href=\"#downloaditemresume\"><code>downloadItem.resume()</code></a></h4>\n<p>Resumes the download that has been paused.</p>\n<p><strong>Note:</strong> To enable resumable downloads the server you are downloading from must support range requests and provide both <code>Last-Modified</code> and <code>ETag</code> header values. Otherwise <code>resume()</code> will dismiss previously received bytes and restart the download from the beginning.</p>\n<h4 id=\"downloaditemcanresume\"><a href=\"#downloaditemcanresume\"><code>downloadItem.canResume()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the download can resume.</p>\n<h4 id=\"downloaditemcancel\"><a href=\"#downloaditemcancel\"><code>downloadItem.cancel()</code></a></h4>\n<p>Cancels the download operation.</p>\n<h4 id=\"downloaditemgeturl\"><a href=\"#downloaditemgeturl\"><code>downloadItem.getURL()</code></a></h4>\n<p>Возвращает <code>String</code> - URL источника, из которого загружается элемент.</p>\n<h4 id=\"downloaditemgetmimetype\"><a href=\"#downloaditemgetmimetype\"><code>downloadItem.getMimeType()</code></a></h4>\n<p>Returns <code>String</code> - The files mime type.</p>\n<h4 id=\"downloaditemhasusergesture\"><a href=\"#downloaditemhasusergesture\"><code>downloadItem.hasUserGesture()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the download has user gesture.</p>\n<h4 id=\"downloaditemgetfilename\"><a href=\"#downloaditemgetfilename\"><code>downloadItem.getFilename()</code></a></h4>\n<p>Returns <code>String</code> - The file name of the download item.</p>\n<p><strong>Note:</strong> The file name is not always the same as the actual one saved in local disk. If user changes the file name in a prompted download saving dialog, the actual name of saved file will be different.</p>\n<h4 id=\"downloaditemgettotalbytes\"><a href=\"#downloaditemgettotalbytes\"><code>downloadItem.getTotalBytes()</code></a></h4>\n<p>Returns <code>Integer</code> - The total size in bytes of the download item.</p>\n<p>If the size is unknown, it returns 0.</p>\n<h4 id=\"downloaditemgetreceivedbytes\"><a href=\"#downloaditemgetreceivedbytes\"><code>downloadItem.getReceivedBytes()</code></a></h4>\n<p>Returns <code>Integer</code> - The received bytes of the download item.</p>\n<h4 id=\"downloaditemgetcontentdisposition\"><a href=\"#downloaditemgetcontentdisposition\"><code>downloadItem.getContentDisposition()</code></a></h4>\n<p>Returns <code>String</code> - The Content-Disposition field from the response header.</p>\n<h4 id=\"downloaditemgetstate\"><a href=\"#downloaditemgetstate\"><code>downloadItem.getState()</code></a></h4>\n<p>Returns <code>String</code> - The current state. Can be <code>progressing</code>, <code>completed</code>, <code>cancelled</code> or <code>interrupted</code>.</p>\n<p><strong>Note:</strong> The following methods are useful specifically to resume a <code>cancelled</code> item when session is restarted.</p>\n<h4 id=\"downloaditemgeturlchain\"><a href=\"#downloaditemgeturlchain\"><code>downloadItem.getURLChain()</code></a></h4>\n<p>Возвращает <code>String[]</code> - полная URL-цепочка до элемента, включая любые перенаправления.</p>\n<h4 id=\"downloaditemgetlastmodifiedtime\"><a href=\"#downloaditemgetlastmodifiedtime\"><code>downloadItem.getLastModifiedTime()</code></a></h4>\n<p>Returns <code>String</code> - Last-Modified header value.</p>\n<h4 id=\"downloaditemgetetag\"><a href=\"#downloaditemgetetag\"><code>downloadItem.getETag()</code></a></h4>\n<p>Returns <code>String</code> - ETag header value.</p>\n<h4 id=\"downloaditemgetstarttime\"><a href=\"#downloaditemgetstarttime\"><code>downloadItem.getStartTime()</code></a></h4>\n<p>Returns <code>Double</code> - Number of seconds since the UNIX epoch when the download was started.</p>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<h4 id=\"downloaditemsavepath\"><a href=\"#downloaditemsavepath\"><code>downloadItem.savePath</code></a></h4>\n<p>Свойство <code>String</code>, которое определяет путь к файлу сохранения элемента загрузки.</p>\n<p>Свойство доступно только в сессии <code>will-download</code> функции обратного вызова. Если пользователь не устанавливает путь сохранения через свойство, Electron будет использовать исходную процедуру для определения пути сохранения; здесь обычно вызывается диалоговое окно сохранения.</p>",
      "title": "DownloadItem",
      "description": "Контроль загрузки файлов из удаленных источников."
    },
    "/docs/tutorial/electron-timelines": {
      "locale": "ru-RU",
      "slug": "electron-timelines",
      "href": "/docs/tutorial/electron-timelines",
      "crowdinFileId": "256197",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/electron-timelines.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"графики-выпуска-electron\"><a href=\"#графики-выпуска-electron\">Графики выпуска Electron</a></h1>\n<p>Special notes:</p>\n<ul>\n<li>The <code>-beta.1</code> and <code>stable</code> dates are our solid release dates.</li>\n<li>Мы стремимся к еженедельным бета-релизам, однако мы часто выпускаем больше бета-версий, чем запланировано.</li>\n<li>Все даты являются нашими целями, но могут быть причины для корректировки стабильного срока, например, ошибки безопасности.</li>\n<li>Take a look at the <a href=\"https://electronjs.org/blog/electron-5-0-timeline\">5.0.0 Timeline blog post</a> for info about publicizing our release dates.</li>\n<li>Since Electron 6.0, we've been targeting every other Chromium version and releasing our stable on the same day as Chrome stable. You can reference Chromium's release schedule <a href=\"https://chromiumdash.appspot.com/schedule\">here</a>. See <a href=\"https://www.electronjs.org/blog/12-week-cadence\">Electron's new release cadence blog post</a> for more details on our release schedule.</li>\n<li>Electron 15.0 only will include a special Alpha release. Starting in Electron 16.0, we will release on an 8-week cadence. See <a href=\"https://www.electronjs.org/blog/8-week-cadence\">Electron's new 8-week cadence blog post</a> for more details.</li>\n</ul>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Electron</th><th>Alpha</th><th>Beta</th><th>Стабильная</th><th>Chrome</th><th>Node</th></tr></thead><tbody><tr><td>2.0.0</td><td>--</td><td>2018-Feb-21</td><td>2018-May-01</td><td>М61</td><td>v8.9</td></tr><tr><td>3.0.0</td><td>--</td><td>2018-Jun-21</td><td>2018-Sep-18</td><td>М66</td><td>v10.2</td></tr><tr><td>4.0.0</td><td>--</td><td>2018-Oct-11</td><td>2018-Dec-20</td><td>М69</td><td>v10.11</td></tr><tr><td>5.0.0</td><td>--</td><td>2019-Jan-22</td><td>2019-Apr-24</td><td>М73</td><td>v12.0</td></tr><tr><td>6.0.0</td><td>--</td><td>2019-May-01</td><td>2019-Jul-30</td><td>М76</td><td>v12.4</td></tr><tr><td>7.0.0</td><td>--</td><td>2019-Aug-01</td><td>2019-Oct-22</td><td>М78</td><td>v12.8</td></tr><tr><td>8.0.0</td><td>--</td><td>2019-Oct-24</td><td>2020-Feb-04</td><td>M80</td><td>v12.13</td></tr><tr><td>9.0.0</td><td>--</td><td>2020-Feb-06</td><td>2020-May-19</td><td>M83</td><td>v12.14</td></tr><tr><td>10.0.0</td><td>--</td><td>2020-May-21</td><td>2020-Aug-25</td><td>M85</td><td>v12.16</td></tr><tr><td>11.0.0</td><td>--</td><td>2020-Aug-27</td><td>2020-Nov-17</td><td>M87</td><td>v12.18</td></tr><tr><td>12.0.0</td><td>--</td><td>2020-Nov-19</td><td>2021-Mar-02</td><td>M89</td><td>v14.16</td></tr><tr><td>13.0.0</td><td>--</td><td>2021-Mar-04</td><td>2021-May-25</td><td>M91</td><td>v14.16</td></tr><tr><td>14.0.0</td><td>--</td><td>2021-May-27</td><td>2021-Aug-31</td><td>M93</td><td>v14.17</td></tr><tr><td>15.0.0</td><td>2021-Jul-20</td><td>2021-Sep-01</td><td>2021-Sep-21</td><td>M94</td><td>v16.5</td></tr><tr><td>16.0.0</td><td>--</td><td>2021-Sep-23</td><td>2021-Nov-16</td><td>M96</td><td>TBD</td></tr></tbody></table>",
      "title": "Графики выпуска Electron",
      "description": ""
    },
    "/docs/tutorial/electron-versioning": {
      "locale": "ru-RU",
      "slug": "electron-versioning",
      "href": "/docs/tutorial/electron-versioning",
      "crowdinFileId": "256199",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/electron-versioning.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"нумерация-версий-electron\"><a href=\"#нумерация-версий-electron\">Нумерация версий Electron</a></h1>\n<blockquote>\n<p>Детализированный взгляд на политику версионирования и ее реализацию.</p>\n</blockquote>\n<p>As of version 2.0.0, Electron follows <a href=\"#semver\">SemVer</a>. The following command will install the most recent stable build of Electron:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron\n</code></pre>\n<p>Обновление до последней стабильной версии в существующем проекте:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron@latest\n</code></pre>\n<h2 id=\"версия-1x\"><a href=\"#версия-1x\">Версия 1.x</a></h2>\n<p>Electron versions <em>&#x3C; 2.0</em> did not conform to the <a href=\"https://semver.org\">SemVer</a> spec: major versions corresponded to end-user API changes, minor versions corresponded to Chromium major releases, and patch versions corresponded to new features and bug fixes. While convenient for developers merging features, it creates problems for developers of client-facing applications. The QA testing cycles of major apps like Slack, Stride, Teams, Skype, VS Code, Atom, and Desktop can be lengthy and stability is a highly desired outcome. There is a high risk in adopting new features while trying to absorb bug fixes.</p>\n<p>Here is an example of the 1.x strategy:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-0.png\" alt=\"1.x Versioning\"></p>\n<p>An app developed with <code>1.8.1</code> cannot take the <code>1.8.3</code> bug fix without either absorbing the <code>1.8.2</code> feature, or by backporting the fix and maintaining a new release line.</p>\n<h2 id=\"версия-20-и-выше\"><a href=\"#версия-20-и-выше\">Версия 2.0 и выше</a></h2>\n<p>There are several major changes from our 1.x strategy outlined below. Each change is intended to satisfy the needs and priorities of developers/maintainers and app developers.</p>\n<ol>\n<li>Strict use of SemVer</li>\n<li>Introduction of semver-compliant <code>-beta</code> tags</li>\n<li>Introduction of <a href=\"https://conventionalcommits.org/\">conventional commit messages</a></li>\n<li>Well-defined stabilization branches</li>\n<li>The <code>master</code> branch is versionless; only stabilization branches contain version information</li>\n</ol>\n<p>We will cover in detail how git branching works, how npm tagging works, what developers should expect to see, and how one can backport changes.</p>\n<h1 id=\"semver\"><a href=\"#semver\">SemVer</a></h1>\n<p>From 2.0 onward, Electron will follow SemVer.</p>\n<p>Below is a table explicitly mapping types of changes to their corresponding category of SemVer (e.g. Major, Minor, Patch).</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Major Version Increments</th><th>Minor Version Increments</th><th>Patch Version Increments</th></tr></thead><tbody><tr><td>Electron breaking API changes</td><td>Electron non-breaking API changes</td><td>Electron bug fixes</td></tr><tr><td>Node.js major version updates</td><td>Node.js minor version updates</td><td>Node.js patch version updates</td></tr><tr><td>Chromium version updates</td><td></td><td>fix-related chromium patches</td></tr></tbody></table>\n<p>Note that most Chromium updates will be considered breaking. Fixes that can be backported will likely be cherry-picked as patches.</p>\n<h1 id=\"стабильные-ветки\"><a href=\"#стабильные-ветки\">Стабильные ветки</a></h1>\n<p>Stabilization branches are branches that run parallel to master, taking in only cherry-picked commits that are related to security or stability. These branches are never merged back to master.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-1.png\" alt=\"Стабильные ветки\"></p>\n<p>Since Electron 8, stabilization branches are always <strong>major</strong> version lines, and named against the following template <code>$MAJOR-x-y</code> e.g. <code>8-x-y</code>.  Prior to that we used <strong>minor</strong> version lines and named them as <code>$MAJOR-$MINOR-x</code> e.g. <code>2-0-x</code></p>\n<p>We allow for multiple stabilization branches to exist simultaneously, and intend to support at least two in parallel at all times, backporting security fixes as necessary. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-2.png\" alt=\"Multiple Stability Branches\"></p>\n<p>Older lines will not be supported by GitHub, but other groups can take ownership and backport stability and security fixes on their own. We discourage this, but recognize that it makes life easier for many app developers.</p>\n<h1 id=\"бета-релизы-и-исправление-багов\"><a href=\"#бета-релизы-и-исправление-багов\">Бета-релизы и исправление багов</a></h1>\n<p>Developers want to know which releases are <em>safe</em> to use. Even seemingly innocent features can introduce regressions in complex applications. At the same time, locking to a fixed version is dangerous because you’re ignoring security patches and bug fixes that may have come out since your version. Our goal is to allow the following standard semver ranges in <code>package.json</code> :</p>\n<ul>\n<li>Use <code>~2.0.0</code> to admit only stability or security related fixes to your <code>2.0.0</code> release.</li>\n<li>Use <code>^2.0.0</code> to admit non-breaking <em>reasonably stable</em> feature work as well as security and bug fixes.</li>\n</ul>\n<p>What’s important about the second point is that apps using <code>^</code> should still be able to expect a reasonable level of stability. To accomplish this, SemVer allows for a <em>pre-release identifier</em> to indicate a particular version is not yet <em>safe</em> or <em>stable</em>.</p>\n<p>Whatever you choose, you will periodically have to bump the version in your <code>package.json</code> as breaking changes are a fact of Chromium life.</p>\n<p>The process is as follows:</p>\n<ol>\n<li>All new major and minor releases lines begin with a beta series indicated by SemVer prerelease tags of <code>beta.N</code>, e.g. <code>2.0.0-beta.1</code>. After the first beta, subsequent beta releases must meet all of the following conditions:<ol>\n<li>The change is backwards API-compatible (deprecations are allowed)</li>\n<li>The risk to meeting our stability timeline must be low.</li>\n</ol></li>\n<li>If allowed changes need to be made once a release is beta, they are applied and the prerelease tag is incremented, e.g. <code>2.0.0-beta.2</code>.</li>\n<li>If a particular beta release is <em>generally regarded</em> as stable, it will be re-released as a stable build, changing only the version information. e.g. <code>2.0.0</code>. After the first stable, all changes must be backwards-compatible bug or security fixes.</li>\n<li>If future bug fixes or security patches need to be made once a release is stable, they are applied and the <em>patch</em> version is incremented e.g. <code>2.0.1</code>.</li>\n</ol>\n<p>Specifically, the above means:</p>\n<ol>\n<li>Admitting non-breaking-API changes before Week 3 in the beta cycle is okay, even if those changes have the potential to cause moderate side-effects.</li>\n<li>Admitting feature-flagged changes, that do not otherwise alter existing code paths, at most points in the beta cycle is okay. Users can explicitly enable those flags in their apps.</li>\n<li>Admitting features of any sort after Week 3 in the beta cycle is 👎 without a very good reason.</li>\n</ol>\n<p>For each major and minor bump, you should expect to see something like the following:</p>\n<pre><code class=\"hljs language-plaintext\">2.0.0-beta.1\n2.0.0-beta.2\n2.0.0-beta.3\n2.0.0\n2.0.1\n2.0.2\n</code></pre>\n<p>An example lifecycle in pictures:</p>\n<ul>\n<li>A new release branch is created that includes the latest set of features. It is published as <code>2.0.0-beta.1</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-3.png\" alt=\"New Release Branch\"></li>\n<li>A bug fix comes into master that can be backported to the release branch. The patch is applied, and a new beta is published as <code>2.0.0-beta.2</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-4.png\" alt=\"Bugfix Backport to Beta\"></li>\n<li>The beta is considered <em>generally stable</em> and it is published again as a non-beta under <code>2.0.0</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-5.png\" alt=\"Beta to Stable\"></li>\n<li>Later, a zero-day exploit is revealed and a fix is applied to master. We backport the fix to the <code>2-0-x</code> line and release <code>2.0.1</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-6.png\" alt=\"Security Backports\"></li>\n</ul>\n<p>A few examples of how various SemVer ranges will pick up new releases:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-7.png\" alt=\"Semvers and Releases\"></p>\n<h1 id=\"missing-features-alphas\"><a href=\"#missing-features-alphas\">Missing Features: Alphas</a></h1>\n<p>Our strategy has a few tradeoffs, which for now we feel are appropriate. Most importantly that new features in master may take a while before reaching a stable release line. If you want to try a new feature immediately, you will have to build Electron yourself.</p>\n<p>As a future consideration, we may introduce one or both of the following:</p>\n<ul>\n<li>alpha releases that have looser stability constraints to betas; for example it would be allowable to admit new features while a stability channel is in <em>alpha</em></li>\n</ul>\n<h1 id=\"feature-flags\"><a href=\"#feature-flags\">Feature Flags</a></h1>\n<p>Feature flags are a common practice in Chromium, and are well-established in the web-development ecosystem. In the context of Electron, a feature flag or <strong>soft branch</strong> must have the following properties:</p>\n<ul>\n<li>it is enabled/disabled either at runtime, or build-time; we do not support the concept of a request-scoped feature flag</li>\n<li>it completely segments new and old code paths; refactoring old code to support a new feature <em>violates</em> the feature-flag contract</li>\n<li>feature flags are eventually removed after the feature is released</li>\n</ul>\n<h1 id=\"semantic-commits\"><a href=\"#semantic-commits\">Semantic Commits</a></h1>\n<p>We seek to increase clarity at all levels of the update and releases process. Starting with <code>2.0.0</code> we will require pull requests adhere to the <a href=\"https://conventionalcommits.org/\">Conventional Commits</a> spec, which can be summarized as follows:</p>\n<ul>\n<li>\n<p>Commits that would result in a SemVer <strong>major</strong> bump must start their body with <code>BREAKING CHANGE:</code>.</p>\n</li>\n<li>\n<p>Commits that would result in a SemVer <strong>minor</strong> bump must start with <code>feat:</code>.</p>\n</li>\n<li>\n<p>Commits that would result in a SemVer <strong>patch</strong> bump must start with <code>fix:</code>.</p>\n</li>\n<li>\n<p>We allow squashing of commits, provided that the squashed message adheres to the above message format.</p>\n</li>\n<li>\n<p>It is acceptable for some commits in a pull request to not include a semantic prefix, as long as the pull request title contains a meaningful encompassing semantic message.</p>\n</li>\n</ul>\n<h1 id=\"versioned-master\"><a href=\"#versioned-master\">Versioned <code>master</code></a></h1>\n<ul>\n<li>The <code>master</code> branch will always contain the next major version <code>X.0.0-nightly.DATE</code> in its <code>package.json</code></li>\n<li>Release branches are never merged back to master</li>\n<li>Release branches <em>do</em> contain the correct version in their <code>package.json</code></li>\n<li>As soon as a release branch is cut for a major, master must be bumped to the next major.  I.e. <code>master</code> is always versioned as the next theoretical release branch</li>\n</ul>",
      "title": "Нумерация версий Electron",
      "description": "Детализированный взгляд на политику версионирования и ее реализацию."
    },
    "/docs/development/electron-vs-nwjs": {
      "locale": "ru-RU",
      "slug": "electron-vs-nwjs",
      "href": "/docs/development/electron-vs-nwjs",
      "crowdinFileId": "256155",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/electron-vs-nwjs.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"технические-различия-между-electron-и-nwjs\"><a href=\"#технические-различия-между-electron-и-nwjs\">Технические различия между Electron и NW.js</a></h1>\n<p>Like <a href=\"https://nwjs.io/\">NW.js</a>, Electron provides a platform to write desktop applications with web technologies. Both platforms enable developers to utilize HTML, JavaScript, and Node.js. On the surface, they seem very similar.</p>\n<p>There are however fundamental differences between the two projects that make Electron a completely separate product from NW.js.</p>\n<h2 id=\"1-entry-of-application\"><a href=\"#1-entry-of-application\">1) Entry of Application</a></h2>\n<p>In NW.js, the main entry point of an application can be an HTML web page. In that case, NW.js will open the given entry point in a browser window.</p>\n<p>In Electron, the entry point is always a JavaScript script. Instead of providing a URL directly, you manually create a browser window and load an HTML file using the API. You also need to listen to window events to decide when to quit the application.</p>\n<p>Electron works more like the Node.js runtime. Electron's APIs are lower level so you can use it for browser testing in place of <a href=\"https://phantomjs.org/\">PhantomJS</a>.</p>\n<h2 id=\"2-node-integration\"><a href=\"#2-node-integration\">2) Node Integration</a></h2>\n<p>In NW.js, the Node integration in web pages requires patching Chromium to work, while in Electron we chose a different way to integrate the <code>libuv</code> loop with each platform's message loop to avoid hacking Chromium. Вы можете изучить код <a href=\"https://github.com/electron/electron/tree/main/lib/common\"><code>node_bindings</code></a>, чтобы узнать, как это было реализовано.</p>\n<h2 id=\"3-javascript-contexts\"><a href=\"#3-javascript-contexts\">3) JavaScript Contexts</a></h2>\n<p>If you are an experienced NW.js user, you should be familiar with the concept of Node context and web context. These concepts were invented because of how NW.js was implemented.</p>\n<p>By using the <a href=\"https://github.com/nodejs/node-v0.x-archive/commit/756b622\">multi-context</a> feature of Node, Electron doesn't introduce a new JavaScript context in web pages.</p>\n<p>Примечание: Поддержка multi-context была представлена c 0.13 версии NW.js.</p>\n<h2 id=\"4-legacy-support\"><a href=\"#4-legacy-support\">4) Legacy Support</a></h2>\n<p>NW.js still offers a \"legacy release\" that supports Windows XP. It doesn't receive security updates.</p>\n<p>Given that hardware manufacturers, Microsoft, Chromium, and Node.js haven't released even critical security updates for that system, we have to warn you that using Windows XP is wildly insecure and outright irresponsible.</p>\n<p>However, we understand that requirements outside our wildest imagination may exist, so if you're looking for something like Electron that runs on Windows XP, the NW.js legacy release might be the right fit for you.</p>\n<h2 id=\"5-features\"><a href=\"#5-features\">5) Features</a></h2>\n<p>There are numerous differences in the amount of supported features. Electron has a bigger community, more production apps using it, and <a href=\"https://www.npmjs.com/search?q=electron\">a large amount of userland modules available on npm</a>.</p>\n<p>As an example, Electron has built-in support for automatic updates and countless tools that make the creation of installers easier. As an example in favor of NW.js, NW.js supports more <code>Chrome.*</code> APIs for the development of Chrome Apps.</p>\n<p>Naturally, we believe that Electron is the better platform for polished production applications built with web technologies (like Visual Studio Code, Slack, or Facebook Messenger); however, we want to be fair to our web technology friends. If you have feature needs that Electron does not meet, you might want to try NW.js.</p>",
      "title": "Технические различия между Electron и NW.js",
      "description": ""
    },
    "/docs/api/environment-variables": {
      "locale": "ru-RU",
      "slug": "environment-variables",
      "href": "/docs/api/environment-variables",
      "crowdinFileId": "256315",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/environment-variables.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"переменные-окружения\"><a href=\"#переменные-окружения\">Переменные окружения</a></h1>\n<blockquote>\n<p>Управляй настройкой приложения и его поведением без изменения кода.</p>\n</blockquote>\n<p>Некоторые поведения Electron управляются переменными окружения, потому что они инициализируются раньше, чем флаги командной строки и код приложения.</p>\n<p>Пример терминала POSIX:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">export</span> ELECTRON_ENABLE_LOGGING=<span class=\"hljs-literal\">true</span>\n$ electron\n</code></pre>\n<p>Пример терминала Windows:</p>\n<pre><code class=\"hljs language-powershell\">> set ELECTRON_ENABLE_LOGGING=true\n> electron\n</code></pre>\n<h2 id=\"переменные-production\"><a href=\"#переменные-production\">Переменные production</a></h2>\n<p>Следующие переменные окружения предназначены для использования в среде выполнения приложения Electron.</p>\n<h3 id=\"node_options\"><a href=\"#node_options\"><code>NODE_OPTIONS</code></a></h3>\n<p>Electron включает поддержку подмножества Node's <a href=\"https://nodejs.org/api/cli.html#cli_node_options_options\"><code>NODE_OPTIONS</code></a>. Большинство поддерживаются за исключением тех, которые конфликтуют с использованием Chromium BoringSSL.</p>\n<p>Пример:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">export</span> NODE_OPTIONS=<span class=\"hljs-string\">\"--no-warnings --max-old-space-size=2048\"</span>\n</code></pre>\n<p>Неподдерживаемые опции:</p>\n<pre><code class=\"hljs language-sh\">--use-bundled-ca\n--force-fips\n--<span class=\"hljs-built_in\">enable</span>-fips\n--openssl-config\n--use-openssl-ca\n</code></pre>\n<p><code>NODE_OPTIONS</code> are explicitly disallowed in packaged apps, except for the following:</p>\n<pre><code class=\"hljs language-sh\">--max-http-header-size\n--http-parser\n</code></pre>\n<h3 id=\"google_api_key\"><a href=\"#google_api_key\"><code>GOOGLE_API_KEY</code></a></h3>\n<p>Поддержка геолокации в Electron требует использования сервиса геолокации Google Cloud Platform. Для включения этой функции получите <a href=\"https://developers.google.com/maps/documentation/geolocation/get-api-key\">Ключ Google API</a> и поместите следующий код в ваш файл основного процесса перед открытием любых окон браузера, делающим запросы геолокации:</p>\n<pre><code class=\"hljs language-javascript\">process.env.GOOGLE_API_KEY = <span class=\"hljs-string\">'YOUR_KEY_HERE'</span>\n</code></pre>\n<p>По умолчанию, новый сгенерированный ключ API Google не может делать запросы геолокации. Чтобы включить веб-сервис геолокации для вашего проекта требуется <a href=\"https://console.cloud.google.com/apis/library\">библиотека API</a>.</p>\n<p>Обратите внимание. You will need to add a <a href=\"https://cloud.google.com/billing/docs/how-to/payment-methods#add_a_payment_method\">Billing Account</a> to the project associated to the API key for the geolocation webservice to work.</p>\n<h3 id=\"electron_no_asar\"><a href=\"#electron_no_asar\"><code>ELECTRON_NO_ASAR</code></a></h3>\n<p>Отключает поддержку ASAR. Данная переменная поддерживается только в дочерних процессах, которые установили переменную окружения <code>ELECTRON_RUN_AS_NODE</code>.</p>\n<h3 id=\"electron_run_as_node\"><a href=\"#electron_run_as_node\"><code>ELECTRON_RUN_AS_NODE</code></a></h3>\n<p>Начинает процесс как Node.js процесс.</p>\n<p>In this mode, you will be able to pass <a href=\"https://nodejs.org/api/cli.html\">cli options</a> to Node.js as you would when running the normal Node.js executable, with the exception of the following flags:</p>\n<ul>\n<li>\"--openssl-config\"</li>\n<li>\"--use-bundled-ca\"</li>\n<li>\"--use-openssl-ca\",</li>\n<li>\"--force-fips\"</li>\n<li>\"--enable-fips\"</li>\n</ul>\n<p>These flags are disabled owing to the fact that Electron uses BoringSSL instead of OpenSSL when building Node.js' <code>crypto</code> module, and so will not work as designed.</p>\n<h3 id=\"electron_no_attach_console-windows\"><a href=\"#electron_no_attach_console-windows\"><code>ELECTRON_NO_ATTACH_CONSOLE</code> <em>Windows</em></a></h3>\n<p>Не присоединяться к текущей сессии терминала.</p>\n<h3 id=\"electron_force_window_menu_bar-linux\"><a href=\"#electron_force_window_menu_bar-linux\"><code>ELECTRON_FORCE_WINDOW_MENU_BAR</code> <em>Linux</em></a></h3>\n<p>Не использовать глобальное меню в Linux.</p>\n<h3 id=\"electron_trash-linux\"><a href=\"#electron_trash-linux\"><code>ELECTRON_TRASH</code> <em>Linux</em></a></h3>\n<p>Set the trash implementation on Linux. По умолчанию - <code>gio</code>.</p>\n<p>Параметры:</p>\n<ul>\n<li><code>gvfs-trash</code></li>\n<li><code>trash-cli</code></li>\n<li><code>kioclient5</code></li>\n<li><code>kioclient</code></li>\n</ul>\n<h2 id=\"переменные-разработки-development\"><a href=\"#переменные-разработки-development\">Переменные разработки (development)</a></h2>\n<p>Следующие переменные окружения предназначены для использования в среде выполнения приложения Electron во время разработки и отладки.</p>\n<h3 id=\"electron_enable_logging\"><a href=\"#electron_enable_logging\"><code>ELECTRON_ENABLE_LOGGING</code></a></h3>\n<p>Prints Chromium's internal logging to the console.</p>\n<p>Setting this variable is the same as passing <code>--enable-logging</code> on the command line. For more info, see <code>--enable-logging</code> in <a href=\"/docs/api/command-line-switches#enable-loggingfile\">command-line switches</a>.</p>\n<h3 id=\"electron_log_file\"><a href=\"#electron_log_file\"><code>ELECTRON_LOG_FILE</code></a></h3>\n<p>Sets the file destination for Chromium's internal logging.</p>\n<p>Setting this variable is the same as passing <code>--log-file</code> on the command line. For more info, see <code>--log-file</code> in <a href=\"/docs/api/command-line-switches#log-filepath\">command-line switches</a>.</p>\n<h3 id=\"electron_debug_drag_regions\"><a href=\"#electron_debug_drag_regions\"><code>ELECTRON_DEBUG_DRAG_REGIONS</code></a></h3>\n<p>Adds coloration to draggable regions on <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>s on macOS - draggable regions will be colored green and non-draggable regions will be colored red to aid debugging.</p>\n<h3 id=\"electron_debug_notifications\"><a href=\"#electron_debug_notifications\"><code>ELECTRON_DEBUG_NOTIFICATIONS</code></a></h3>\n<p>Adds extra logs to <a href=\"/docs/api/notification\"><code>Notification</code></a> lifecycles on macOS to aid in debugging. Extra logging will be displayed when new Notifications are created or activated. They will also be displayed when common a tions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.</p>\n<p>Sample output:</p>\n<pre><code class=\"hljs language-sh\">Notification created (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification displayed (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification activated (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification replied to (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\n</code></pre>\n<h3 id=\"electron_log_asar_reads\"><a href=\"#electron_log_asar_reads\"><code>ELECTRON_LOG_ASAR_READS</code></a></h3>\n<p>When Electron reads from an ASAR file, log the read offset and file path to the system <code>tmpdir</code>. The resulting file can be provided to the ASAR module to optimize file ordering.</p>\n<h3 id=\"electron_enable_stack_dumping\"><a href=\"#electron_enable_stack_dumping\"><code>ELECTRON_ENABLE_STACK_DUMPING</code></a></h3>\n<p>Выводит содержимое стэка в консоль при сбое Electron приложения.</p>\n<p>Данная переменная окружения не будет работать, если <code>crashReporter</code> запущен.</p>\n<h3 id=\"electron_default_error_mode-windows\"><a href=\"#electron_default_error_mode-windows\"><code>ELECTRON_DEFAULT_ERROR_MODE</code> <em>Windows</em></a></h3>\n<p>Показывает диалог сбоя Windows при сбое Electron приложения.</p>\n<p>Данная переменная окружения не будет работать, если <code>crashReporter</code> запущен.</p>\n<h3 id=\"electron_override_dist_path\"><a href=\"#electron_override_dist_path\"><code>ELECTRON_OVERRIDE_DIST_PATH</code></a></h3>\n<p>При запуске из <code>electron</code> пакета, эта переменная дает команду <code>electron</code> использовать указанную сборку Electron вместо загруженной по <code>npm install</code>. Использование:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">export</span> ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Testing\n</code></pre>\n<h2 id=\"set-by-electron\"><a href=\"#set-by-electron\">Set By Electron</a></h2>\n<p>Electron sets some variables in your environment at runtime.</p>\n<h3 id=\"original_xdg_current_desktop\"><a href=\"#original_xdg_current_desktop\"><code>ORIGINAL_XDG_CURRENT_DESKTOP</code></a></h3>\n<p>This variable is set to the value of <code>XDG_CURRENT_DESKTOP</code> that your application originally launched with.  Electron sometimes modifies the value of <code>XDG_CURRENT_DESKTOP</code> to affect other logic within Chromium so if you want access to the <em>original</em> value you should look up this environment variable instead.</p>",
      "title": "Переменные окружения",
      "description": "Управляй настройкой приложения и его поведением без изменения кода."
    },
    "/docs/api/structures/event": {
      "locale": "ru-RU",
      "slug": "event",
      "href": "/docs/api/structures/event",
      "crowdinFileId": "256429",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"event-object-extends-globalevent\"><a href=\"#event-object-extends-globalevent\">Event Object extends <code>GlobalEvent</code></a></h1>\n<ul>\n<li><code>preventDefault</code> VoidFunction</li>\n</ul>",
      "title": "Event Object extends GlobalEvent",
      "description": ""
    },
    "/docs/experimental": {
      "locale": "ru-RU",
      "slug": "experimental",
      "href": "/docs/experimental",
      "crowdinFileId": "256119",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/experimental.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"experimental-apis\"><a href=\"#experimental-apis\">Experimental APIs</a></h1>\n<p>Some of Electrons APIs are tagged with <code>_Experimental_</code> in the documentation. This tag indicates that the API may not be considered stable and the API may be removed or modified more frequently than other APIs with less warning.</p>\n<h2 id=\"conditions-for-an-api-to-be-tagged-as-experimental\"><a href=\"#conditions-for-an-api-to-be-tagged-as-experimental\">Conditions for an API to be tagged as Experimental</a></h2>\n<p>Anyone can request an API be tagged as experimental in a feature PR, disagreements on the experimental nature of a feature can be discussed in the API WG if they can't be resolved in the PR.</p>\n<h2 id=\"process-for-removing-the-experimental-tag\"><a href=\"#process-for-removing-the-experimental-tag\">Process for removing the Experimental tag</a></h2>\n<p>Once an API has been stable and in at least two major stable release lines it can be nominated to have its experimental tag removed.  This discussion should happen at an API WG meeting.  Things to consider when discussing / nominating:</p>\n<ul>\n<li>The above \"two major stables release lines\" condition must have been met</li>\n<li>During that time no major bugs / issues should have been caused by the adoption of this feature</li>\n<li>The API is stable enough and hasn't been heavily impacted by Chromium upgrades</li>\n<li>Is anyone using the API?</li>\n<li>Is the API fulfilling the original proposed usecases, does it have any gaps?</li>\n</ul>",
      "title": "Experimental APIs",
      "description": ""
    },
    "/docs/api/structures/extension": {
      "locale": "ru-RU",
      "slug": "extension",
      "href": "/docs/api/structures/extension",
      "crowdinFileId": "256433",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/extension.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"extension-object\"><a href=\"#extension-object\">Extension Object</a></h1>\n<ul>\n<li><code>id</code> String</li>\n<li><code>manifest</code> any - Copy of the <a href=\"https://developer.chrome.com/extensions/manifest\">extension's manifest data</a>.</li>\n<li><code>name</code> String</li>\n<li><code>path</code> String - The extension's file path.</li>\n<li><code>version</code> String</li>\n<li><code>url</code> String - The extension's <code>chrome-extension://</code> URL.</li>\n</ul>",
      "title": "Extension Object",
      "description": ""
    },
    "/docs/api/structures/extension-info": {
      "locale": "ru-RU",
      "slug": "extension-info",
      "href": "/docs/api/structures/extension-info",
      "crowdinFileId": "256431",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/extension-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"extensioninfo-object\"><a href=\"#extensioninfo-object\">ExtensionInfo Object</a></h1>\n<ul>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>",
      "title": "ExtensionInfo Object",
      "description": ""
    },
    "/docs/api/extensions": {
      "locale": "ru-RU",
      "slug": "extensions",
      "href": "/docs/api/extensions",
      "crowdinFileId": "256317",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/extensions.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"chrome-extension-support\"><a href=\"#chrome-extension-support\">Chrome Extension Support</a></h1>\n<p>Electron частично поддерживает <a href=\"https://developer.chrome.com/extensions/api_index\">Chrome Extensions API</a> прежде всего для поддержки расширений для DevTools и внутренних Chromium расширений, но он также поддерживает и некоторые другие возможности расширений.</p>\n<blockquote>\n<p><strong>Примечание:</strong> Electron не поддерживает пользовательские расширения из магазина Chrome. Идеальная совместимость с реализацией расширений Chrome <strong>не является целью</strong> проекта Electron.</p>\n</blockquote>\n<h2 id=\"загрузка-расширений\"><a href=\"#загрузка-расширений\">Загрузка расширений</a></h2>\n<p>Electron поддерживает загрузку только распакованных расширение (т.е. файлы <code>.crx</code> не будут работать). Расширения устанавливаются с помощью объекта <code>session</code>. Для загрузки расширения вызовите <a href=\"/docs/api/session#sesloadextensionpath-options\"><code>ses.loadExtension</code></a>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession.loadExtension(<span class=\"hljs-string\">'path/to/unpacked/extension'</span>).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ id }</span>) =></span> {\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<p>Загруженные расширения не буду автоматически запоминаться при выходе: если вы не вызовите <code>loadExtension</code> при запуске приложения - расширение не будет загружено.</p>\n<p>Обратите внимание, что загрузка расширений поддерживается только в постоянных сессиях. Попытка загрузить расширение в сохраненную сессию приведет к ошибке.</p>\n<p>Смотрите документацию по <a href=\"/docs/api/session\"><code>session</code></a> чтобы узнать больше о загрузке, выгрузке и получении активных расширений.</p>\n<h2 id=\"поддерживаемые-api-расширений\"><a href=\"#поддерживаемые-api-расширений\">Поддерживаемые API расширений</a></h2>\n<p>Мы поддерживаем следующие API расширений с некоторыми оговорками. Остальные API могут дополнительно поддерживаться, но поддержка API, не перечисленных здесь, является предварительной и может быть удалена.</p>\n<h3 id=\"chromedevtoolsinspectedwindow\"><a href=\"#chromedevtoolsinspectedwindow\"><code>chrome.devtools.inspectedWindow</code></a></h3>\n<p>Все функции этого API поддерживаются.</p>\n<h3 id=\"chromedevtoolsnetwork\"><a href=\"#chromedevtoolsnetwork\"><code>chrome.devtools.network</code></a></h3>\n<p>Все функции этого API поддерживаются.</p>\n<h3 id=\"chromedevtoolspanels\"><a href=\"#chromedevtoolspanels\"><code>chrome.devtools.panels</code></a></h3>\n<p>Все функции этого API поддерживаются.</p>\n<h3 id=\"chromeextension\"><a href=\"#chromeextension\"><code>chrome.extension</code></a></h3>\n<p>Поддерживаются только следующие свойства <code>chrome.extension</code>:</p>\n<ul>\n<li><code>chrome.extension.lastError</code></li>\n</ul>\n<p>Поддерживаются только следующие методы <code>chrome.extension</code>:</p>\n<ul>\n<li><code>chrome.extension.getURL</code></li>\n<li><code>chrome.extension.getBackgroundPage</code></li>\n</ul>\n<h3 id=\"chromeruntime\"><a href=\"#chromeruntime\"><code>chrome.runtime</code></a></h3>\n<p>Поддерживаются только следующие свойства <code>chrome.runtime</code>:</p>\n<ul>\n<li><code>chrome.runtime.lastError</code></li>\n<li><code>chrome.runtime.id</code></li>\n</ul>\n<p>Поддерживаются только следующие методы <code>chrome.runtime</code>:</p>\n<ul>\n<li><code>chrome.runtime.getBackgroundPage</code></li>\n<li><code>chrome.runtime.getManifest</code></li>\n<li><code>chrome.runtime.getPlatformInfo</code></li>\n<li><code>chrome.runtime.getURL</code></li>\n<li><code>chrome.runtime.connect</code></li>\n<li><code>chrome.runtime.sendMessage</code></li>\n<li><code>chrome.runtime.reload</code></li>\n</ul>\n<p>Поддерживаются только следующие события <code>chrome.runtime</code>:</p>\n<ul>\n<li><code>chrome.runtime.onStartup</code></li>\n<li><code>chrome.runtime.onInstalled</code></li>\n<li><code>chrome.runtime.onSuspend</code></li>\n<li><code>chrome.runtime.onSuspendCanceled</code></li>\n<li><code>chrome.runtime.onConnect</code></li>\n<li><code>chrome.runtime.onMessage</code></li>\n</ul>\n<h3 id=\"chromestorage\"><a href=\"#chromestorage\"><code>chrome.storage</code></a></h3>\n<p>Поддерживается только <code>chrome.storage.local</code>; <code>chrome.storage.sync</code> и <code>chrome.storage.managed</code> не поддерживаются.</p>\n<h3 id=\"chrometabs\"><a href=\"#chrometabs\"><code>chrome.tabs</code></a></h3>\n<p>Поддерживаются только следующие методы <code>chrome.tabs</code>:</p>\n<ul>\n<li><code>chrome.tabs.sendMessage</code></li>\n<li><code>chrome.tabs.executeScript</code></li>\n</ul>\n<blockquote>\n<p><strong>Примечание:</strong> В Chrome, передача <code>-1</code> в качестве идентификатора вкладки означает \"текущую активную вкладку\". Поскольку в Electron такого понятия нет, передача <code>-1</code> не поддерживается и вызовет ошибку.</p>\n</blockquote>\n<h3 id=\"chromemanagement\"><a href=\"#chromemanagement\"><code>chrome.management</code></a></h3>\n<p>Поддерживаются только следующие методы <code>chrome.management</code>:</p>\n<ul>\n<li><code>chrome.management.getAll</code></li>\n<li><code>chrome.management.get</code></li>\n<li><code>chrome.management.getSelf</code></li>\n<li><code>chrome.management.getPermissionWarningsById</code></li>\n<li><code>chrome.management.getPermissionWarningsByManifest</code></li>\n<li><code>chrome.management.onEnabled</code></li>\n<li><code>chrome.management.onDisabled</code></li>\n</ul>\n<h3 id=\"chromewebrequest\"><a href=\"#chromewebrequest\"><code>chrome.webRequest</code></a></h3>\n<p>Все функции этого API поддерживаются.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Electron's <a href=\"/docs/api/web-request\"><code>webRequest</code></a> module takes precedence over <code>chrome.webRequest</code> if there are conflicting handlers.</p>\n</blockquote>",
      "title": "Chrome Extension Support",
      "description": "Примечание: Electron не поддерживает пользовательские расширения из магазина Chrome. Идеальная совместимость с реализацией расширений Chrome не является целью проекта Electron."
    },
    "/docs/faq": {
      "locale": "ru-RU",
      "slug": "faq",
      "href": "/docs/faq",
      "crowdinFileId": "256121",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/faq.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"faq-по-electron\"><a href=\"#faq-по-electron\">FAQ по Electron</a></h1>\n<h2 id=\"проблемы-возникающие-при-установке-electron\"><a href=\"#проблемы-возникающие-при-установке-electron\">Проблемы, возникающие при установке Electron</a></h2>\n<p>При выполнении команды <code>npm install electron</code>, некоторые пользователи сталкиваются с проблемами установки.</p>\n<p>В большинстве случаев, эти ошибки являются результатом проблем сети и не связаны с npm пакетом <code>electron</code>. Такие ошибки, как <code>ELIFECYCLE</code>, <code>EAI_AGAIN</code>, <code>ECONNRESET</code> и<code>ETIMEDOUT</code> возникают в результате проблем с сетью. Лучшее решение - попытаться переключить сеть, или немного подождать, и попытаться установить снова.</p>\n<p>Также вы можете попытаться скачать Electron непосредственно из <a href=\"https://github.com/electron/electron/releases\">electron/electron/releases</a>, если установка через <code>npm</code> терпит неудачу.</p>\n<h2 id=\"когда-electron-получит-последнее-обновление-chrome\"><a href=\"#когда-electron-получит-последнее-обновление-chrome\">Когда Electron получит последнее обновление Chrome?</a></h2>\n<p>Chrome для Electron обычно выпускается в течение одной или двух недель после выпуска стабильной версии Chrome. Этот срок не является гарантированным и зависит от объема работ, связанных с обновлением.</p>\n<p>Only the stable channel of Chrome is used. If an important fix is in beta or dev channel, we will back-port it.</p>\n<p>Для получения дополнительной информации, пожалуйста, просмотрите <a href=\"/docs/tutorial/security\">введение в обеспечение безопасности</a>.</p>\n<h2 id=\"когда-electron-получит-последнее-обновление-nodejs\"><a href=\"#когда-electron-получит-последнее-обновление-nodejs\">Когда Electron получит последнее обновление Node.js?</a></h2>\n<p>После выпуска новой версии Node.js, мы обычно ждем примерно месяц до обновления в Electron. Это помогает избежать ошибок, которые присутствуют в новых версиях Node.js, что случается довольно часто.</p>\n<p>Новые возможности Node.js обычно входят в обновления V8, так как Electron использует V8, поставляемый с браузером Chrome, новейшие возможности JavaScript в новой версии Node.js обычно уже входят в Electron.</p>\n<h2 id=\"как-передавать-данные-между-страницами\"><a href=\"#как-передавать-данные-между-страницами\">Как передавать данные между страницами?</a></h2>\n<p>Для передачи данных между веб-страницами (графическими процессами) самым простым способом является использование HTML5 API, который уже доступен в браузерах. Good candidates are <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Storage\">Storage API</a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage\"><code>localStorage</code></a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage\"><code>sessionStorage</code></a>, and <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API\">IndexedDB</a>.</p>\n<p>Alternatively, you can use the IPC primitives that are provided by Electron. To share data between the main and renderer processes, you can use the <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> and <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> modules. To communicate directly between web pages, you can send a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> from one to the other, possibly via the main process using <a href=\"/docs/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage()</code></a>. Subsequent communication over message ports is direct and does not detour through the main process.</p>\n<h2 id=\"трей-моего-приложения-исчезает-через-несколько-минут\"><a href=\"#трей-моего-приложения-исчезает-через-несколько-минут\">Трей моего приложения исчезает через несколько минут.</a></h2>\n<p>Это происходит, когда переменная, используемая для хранения трея уничтожается сборщиком мусора.</p>\n<p>Если Вы столкнулись с этой проблемой, могут оказаться полезными следующие статьи:</p>\n<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management\">Управление памятью</a></li>\n<li><a href=\"https://msdn.microsoft.com/library/bzt2dkta(v=vs.94).aspx\">Область видимости переменной</a></li>\n</ul>\n<p>Если Вы хотите это быстро исправить, Вы можете сделать переменную глобальной, заменив для этого следующий код:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/путь/до/иконки.png'</span>)\n  tray.setTitle(<span class=\"hljs-string\">'привет мир'</span>)\n})\n</code></pre>\n<p>на этот:</p>\n<pre><code class=\"hljs language-javascript\">{ app, Tray }\n</code></pre>\n<h2 id=\"у-меня-не-получается-использовать-jqueryrequirejsmeteorangularjs-в-electron\"><a href=\"#у-меня-не-получается-использовать-jqueryrequirejsmeteorangularjs-в-electron\">У меня не получается использовать jQuery/RequireJS/Meteor/AngularJS в Electron.</a></h2>\n<p>В связи с интеграцией Node.js с Electron, существуют некоторые дополнительные ключевые слова вставляемые в DOM, такие как: <code>module</code>, <code>exports</code>, и <code>require</code>. Это вызывает проблемы для некоторых библиотек, так как они пытаются вставить такие же имена.</p>\n<p>Для решения этой проблемы, Вы можете отключить интеграцию node в Electron:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// В основном процессе.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\nwin.show()\n</code></pre>\n<p>Но если Вы хотите сохранить возможность использования Node.js или API Electron, Вы должны переименовать переменные на странице перед подключением других библиотек:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-built_in\">window</span>.nodeRequire = <span class=\"hljs-built_in\">require</span>;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.require;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.exports;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.module;\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/javascript\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"jquery.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n</code></pre>\n<h2 id=\"requireelectronxxx-is-undefined-не-определено\"><a href=\"#requireelectronxxx-is-undefined-не-определено\"><code>require('electron').xxx</code> is undefined (не определено).</a></h2>\n<p>При использовании встроенного модуля Electron может возникнуть подобная ошибка:</p>\n<pre><code class=\"hljs language-sh\">> require(<span class=\"hljs-string\">'electron'</span>).webFrame.setZoomFactor(1.0)\nUncaught TypeError: Cannot <span class=\"hljs-built_in\">read</span> property <span class=\"hljs-string\">'setZoomLevel'</span> of undefined\n</code></pre>\n<p>Скорее всего, Вы используете модуль в неправильном процессе. Например <code>electron.app</code> может быть использован только в главном процессе, в то время как <code>electron.webFrame</code> доступен только в процессах рендеринга.</p>\n<h2 id=\"шрифт-выглядит-размытым-что-это-и-что-я-могу-с-этим-сделать\"><a href=\"#шрифт-выглядит-размытым-что-это-и-что-я-могу-с-этим-сделать\">Шрифт выглядит размытым, что это и что я могу с этим сделать?</a></h2>\n<p>If <a href=\"https://alienryderflex.com/sub_pixel/\">sub-pixel anti-aliasing</a> is deactivated, then fonts on LCD screens can look blurry. Пример:</p>\n<p><img src=\"/docs/images/subpixel-rendering-screenshot.gif\" alt=\"subpixel rendering example\"></p>\n<p>Для анти-алиасинга подпикселя требуется непрозрачный фон, содержащий глифы шрифта. (См. <a href=\"https://github.com/electron/electron/issues/6344#issuecomment-420371918\">эту проблему</a> для получения дополнительной информации).</p>\n<p>To achieve this goal, set the background in the constructor for <a href=\"/docs/api/browser-window\">BrowserWindow</a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#fff'</span>\n})\n</code></pre>\n<p>The effect is visible only on (some?) LCD screens. Even if you don't see a difference, some of your users may. It is best to always set the background this way, unless you have reasons not to do so.</p>\n<p>Обратите внимание, что только настройка фона в CSS не имеет желаемого эффекта.</p>",
      "title": "FAQ по Electron",
      "description": ""
    },
    "/docs/api/structures/file-filter": {
      "locale": "ru-RU",
      "slug": "file-filter",
      "href": "/docs/api/structures/file-filter",
      "crowdinFileId": "256435",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/file-filter.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"filefilter-object\"><a href=\"#filefilter-object\">FileFilter Object</a></h1>\n<ul>\n<li><code>name</code> String</li>\n<li><code>extensions</code> String[]</li>\n</ul>",
      "title": "FileFilter Object",
      "description": ""
    },
    "/docs/api/file-object": {
      "locale": "ru-RU",
      "slug": "file-object",
      "href": "/docs/api/file-object",
      "crowdinFileId": "256319",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/file-object.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"объект-file\"><a href=\"#объект-file\">Объект <code>File</code></a></h1>\n<blockquote>\n<p>Использует <code>File</code> из HTML5 API для найтивной работы с файлами в файловой системе.</p>\n</blockquote>\n<p>Файловый интерфейс DOM предоставляет абстракции над файловой системой, чтобы позволить пользователям работать с ней с помощью файлового API HTML5. Electron добавил атрибут <code>path</code> к интерфейсу <code>File</code>, который предоставляет настоящий путь к файлу в файловой системе.</p>\n<p>Пример получения настоящего пути из перетаскиваемого в приложение файла:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">div</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"holder\"</span>></span>\n  Drag your file here\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">div</span>></span>\n\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  <span class=\"hljs-built_in\">document</span>.addEventListener(<span class=\"hljs-string\">'drop'</span>, (e) => {\n    e.preventDefault();\n    e.stopPropagation();\n\n    <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> f <span class=\"hljs-keyword\">of</span> e.dataTransfer.files) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'File(s) you dragged here: '</span>, f.path)\n    }\n  });\n  <span class=\"hljs-built_in\">document</span>.addEventListener(<span class=\"hljs-string\">'dragover'</span>, (e) => {\n    e.preventDefault();\n    e.stopPropagation();\n  });\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>",
      "title": "Объект File",
      "description": "Использует File из HTML5 API для найтивной работы с файлами в файловой системе."
    },
    "/docs/api/structures/file-path-with-headers": {
      "locale": "ru-RU",
      "slug": "file-path-with-headers",
      "href": "/docs/api/structures/file-path-with-headers",
      "crowdinFileId": "256437",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/file-path-with-headers.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"filepathwithheaders-object\"><a href=\"#filepathwithheaders-object\">FilePathWithHeaders Object</a></h1>\n<ul>\n<li><code>path</code> String - The path to the file to send.</li>\n<li><code>headers</code> Record&#x3C;string, string> (optional) - Additional headers to be sent.</li>\n</ul>",
      "title": "FilePathWithHeaders Object",
      "description": ""
    },
    "/docs/api/frameless-window": {
      "locale": "ru-RU",
      "slug": "frameless-window",
      "href": "/docs/api/frameless-window",
      "crowdinFileId": "256321",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/frameless-window.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"окно-без-рамки\"><a href=\"#окно-без-рамки\">Окно без рамки</a></h1>\n<blockquote>\n<p>Откройте окно без панелей инструментов, границ или другого графического «chrome».</p>\n</blockquote>\n<p>Безрамное окно - окно, в котором нет <a href=\"https://developer.mozilla.org/en-US/docs/Glossary/Chrome\">chrome</a> частей окна, например панели инструментов, которые не являются частью веб-страницы. Эти варианты в классе <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<h2 id=\"создание-безрамного-окна\"><a href=\"#создание-безрамного-окна\">Создание безрамного окна</a></h2>\n<p>Для создания безрамного окна, нужно установить <code>frame: false</code> в <code>параметрах</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h3 id=\"alternatives\"><a href=\"#alternatives\">Alternatives</a></h3>\n<p>There's an alternative way to specify a chromeless window on macOS and Windows. Instead of setting <code>frame</code> to <code>false</code> which disables both the titlebar and window controls, you may want to have the title bar hidden and your content extend to the full window size, yet still preserve the window controls (\"traffic lights\" on macOS) for standard window actions. Вы можете сделать это, указав параметр <code>titleBarStyle</code>:</p>\n<h4 id=\"hidden\"><a href=\"#hidden\"><code>hidden</code></a></h4>\n<p>Results in a hidden title bar and a full size content window. On macOS, the title bar still has the standard window controls (“traffic lights”) in the top left.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span> })\nwin.show()\n</code></pre>\n<h3 id=\"альтернативы-на-macos\"><a href=\"#альтернативы-на-macos\">Альтернативы на macOS</a></h3>\n<h4 id=\"hiddeninset\"><a href=\"#hiddeninset\"><code>hiddenInset</code></a></h4>\n<p>В результате скрытый заголовок с альтернативным видом, где кнопки контролирования немного больше вставки от края окна.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span> })\nwin.show()\n</code></pre>\n<h4 id=\"custombuttonsonhover\"><a href=\"#custombuttonsonhover\"><code>customButtonsOnHover</code></a></h4>\n<p>Использует кастомные кнопки закрыть и уменьшить, которые display при наведении на верхний левый угол окна. The fullscreen button is not available due to restrictions of frameless windows as they interface with Apple's macOS window masks. Эти пользовательские кнопки предотвращают проблемы с событиями мыши, которые случаются со стандартными кнопками панели инструментов. Эта опция применима только для окон без рамки.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'customButtonsOnHover'</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h2 id=\"windows-control-overlay\"><a href=\"#windows-control-overlay\">Windows Control Overlay</a></h2>\n<p>When using a frameless window in conjuction with <code>win.setWindowButtonVisibility(true)</code> on macOS, using one of the <code>titleBarStyle</code>s as described above so that the traffic lights are visible, or using <code>titleBarStyle: hidden</code> on Windows, you can access the Window Controls Overlay <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis\">JavaScript APIs</a> and <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables\">CSS Environment Variables</a> by setting the <code>titleBarOverlay</code> option to true. Specifying <code>true</code> will result in an overlay with default system colors.</p>\n<p>On Windows, you can also specify the color of the overlay and its symbols by setting <code>titleBarOverlay</code> to an object with the options <code>color</code> and <code>symbolColor</code>. If an option is not specified, the color will default to its system color for the window control buttons:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span>,\n  <span class=\"hljs-attr\">titleBarOverlay</span>: <span class=\"hljs-literal\">true</span>\n})\nwin.show()\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span>,\n  <span class=\"hljs-attr\">titleBarOverlay</span>: {\n    <span class=\"hljs-attr\">color</span>: <span class=\"hljs-string\">'#2f3241'</span>,\n    <span class=\"hljs-attr\">symbolColor</span>: <span class=\"hljs-string\">'#74b1be'</span>\n  }\n})\nwin.show()\n</code></pre>\n<h2 id=\"прозрачное-окно\"><a href=\"#прозрачное-окно\">Прозрачное окно</a></h2>\n<p>Установив для параметра <code>transparent</code> значение <code>true</code>, можно также сделать безрамочный окно прозрачным:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">transparent</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h3 id=\"ограничения\"><a href=\"#ограничения\">Ограничения</a></h3>\n<ul>\n<li>Вы не можете кликнуть по прозрачной области. Мы собираемся ввести API, чтобы установить форму окна для решения этой задачи, смотрите <a href=\"https://github.com/electron/electron/issues/1335\">нашу проблему</a>.</li>\n<li>Transparent windows are not resizable. Setting <code>resizable</code> to <code>true</code> may make a transparent window stop working on some platforms.</li>\n<li>Фильтр <code>blur</code> применяется только к веб-странице, поэтому невозможно применить эффект размытия к содержимому под окном (т.е. другие приложения открываются в системе пользователя).</li>\n<li>The window will not be transparent when DevTools is opened.</li>\n<li>On Windows operating systems,<ul>\n<li>transparent windows will not work when DWM is disabled.</li>\n<li>transparent windows can not be maximized using the Windows system menu or by double clicking the title bar. The reasoning behind this can be seen on <a href=\"https://github.com/electron/electron/pull/28207\">this pull request</a>.</li>\n</ul></li>\n<li>В Linux пользователи должны поставить <code>--enable-transparent-visuals --disable-gpu</code> в командной строке, чтобы отключить GPU процессор и позволить ARGB создать прозрачное окно, это вызвано вышестоящей ошибкой, когда <a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=369209\">альфа-канал не работает на некоторых драйверах NVidia</a> на Linux.</li>\n<li>На Mac, тень родного окна не будет отображаться в прозрачном окне.</li>\n</ul>\n<h2 id=\"невзаимодействующее-окно\"><a href=\"#невзаимодействующее-окно\">Невзаимодействующее окно</a></h2>\n<p>Чтобы создать окно клика, т.е. сделать так, чтобы окно игнорировало все события мыши, можно вызвать <a href=\"/docs/api/browser-window#winsetignoremouseeventsignore-options\">win.setIgnoreMouseEvents(ignore)</a> API:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.setIgnoreMouseEvents(<span class=\"hljs-literal\">true</span>)\n</code></pre>\n<h3 id=\"пересылка\"><a href=\"#пересылка\">Пересылка</a></h3>\n<p>Игнорирование сообщений мыши заставляет веб-страницу забыть о движении мыши, что означает, что события движения мыши не будут вырабатываться. В операционных системах Windows дополнительный параметр может быть использован для передачи сообщений о перемещении мыши на веб-странице, что позволяют такие события как <code>mouseleave</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> el = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'clickThroughElement'</span>)\nel.addEventListener(<span class=\"hljs-string\">'mouseenter'</span>, () => {\n  ipcRenderer.send(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, <span class=\"hljs-literal\">true</span>, { <span class=\"hljs-attr\">forward</span>: <span class=\"hljs-literal\">true</span> })\n})\nel.addEventListener(<span class=\"hljs-string\">'mouseleave'</span>, () => {\n  ipcRenderer.send(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, <span class=\"hljs-literal\">false</span>)\n})\n\n<span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, (event, ...args) => {\n  BrowserWindow.fromWebContents(event.sender).setIgnoreMouseEvents(...args)\n})\n</code></pre>\n<p>Это делает переход по веб-странице по окончании <code>el</code>, и возвращается к нормальному состоянию за ее пределами.</p>\n<h2 id=\"регион-переноса-drag-and-drop\"><a href=\"#регион-переноса-drag-and-drop\">Регион переноса (drag-and-drop)</a></h2>\n<p>По-умолчанию, безрамное окно невозможно перетаскивать. В коде приложения необходимо указать в стилях CSS <code>-webkit-app-region: drag</code>, чтобы за выделенную область было возможно переносить окно (как за заголовок стандартного окна), также можно использовать <code>-webkit-app-region: no-drag</code> для исключения непереносимой области внутри переносимой. Обратите внимание, что в настоящий момент поддерживается прямоугольная форма области.</p>\n<p>Примечание: <code>-webkit-app-region: drag</code> имеет проблемы, пока инструменты разработчика открыты. Смотрите <a href=\"https://github.com/electron/electron/issues/3647\">Проблемы GitHub</a> для получения дополнительной информации, включая обход.</p>\n<p>Чтобы сделать все окно перетаскиваемым, вы можете добавить <code>-webkit-app-region: drag</code> как стиль <code>body</code>:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"-webkit-app-region: drag\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n</code></pre>\n<p>И обратите внимание, что если вы перетащили окно целиком, вы также должны отметить кнопки как не перетаскиваемые, иначе пользователям было бы невозможно на них нажать:</p>\n<pre><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">button</span> {\n  <span class=\"hljs-attribute\">-webkit-app-region</span>: no-drag;\n}\n</code></pre>\n<p>Если вы устанавливаете перетаскиваемым только пользовательский заголовок, вам нужно все кнопки в заголовке сделать без возможности перетаскивания.</p>\n<h2 id=\"выделение-текста\"><a href=\"#выделение-текста\">Выделение текста</a></h2>\n<p>In a frameless window the dragging behavior may conflict with selecting text. Например, когда вы перетащите заголовок, вы можете случайно выбрать текст на панели заголовка. Чтобы предотвратить это, вам нужно отключить выбор текста в перетаскиваемой области, такой как:</p>\n<pre><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.titlebar</span> {\n  <span class=\"hljs-attribute\">-webkit-user-select</span>: none;\n  <span class=\"hljs-attribute\">-webkit-app-region</span>: drag;\n}\n</code></pre>\n<h2 id=\"контекстное-меню\"><a href=\"#контекстное-меню\">Контекстное меню</a></h2>\n<p>На некоторых платформах перетаскиваемая область будет рассматриваться как неклиентский фрейм, поэтому при щелчке правой кнопкой мыши на ней появится системное меню. Чтобы контекстное меню работало правильно на всех платформах, вы никогда не должны использовать настраиваемое контекстное меню в перетаскиваемых областях.</p>",
      "title": "Окно без рамки",
      "description": "Откройте окно без панелей инструментов, границ или другого графического «chrome»."
    },
    "/docs/tutorial/fuses": {
      "locale": "ru-RU",
      "slug": "fuses",
      "href": "/docs/tutorial/fuses",
      "crowdinFileId": "256201",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/fuses.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-fuses\"><a href=\"#electron-fuses\">Electron Fuses</a></h1>\n<blockquote>\n<p>Package time feature toggles</p>\n</blockquote>\n<h2 id=\"what-are-fuses\"><a href=\"#what-are-fuses\">What are fuses?</a></h2>\n<p>For a subset of Electron functionality it makes sense to disable certain features for an entire application.  For example, 99% of apps don't make use of <code>ELECTRON_RUN_AS_NODE</code>, these applications want to be able to ship a binary that is incapable of using that feature.  We also don't want Electron consumers building Electron from source as that is both a massive technical challenge and has a high cost of both time and money.</p>\n<p>Fuses are the solution to this problem, at a high level they are \"magic bits\" in the Electron binary that can be flipped when packaging your Electron app to enable / disable certain features / restrictions.  Because they are flipped at package time before you code sign your app the OS becomes responsible for ensuring those bits aren't flipped back via OS level code signing validation (Gatekeeper / App Locker).</p>\n<h2 id=\"how-do-i-flip-the-fuses\"><a href=\"#how-do-i-flip-the-fuses\">How do I flip the fuses?</a></h2>\n<h3 id=\"the-easy-way\"><a href=\"#the-easy-way\">The easy way</a></h3>\n<p>We've made a handy module <code>@electron/fuses</code> to make flipping these fuses easy.  Check out the README of that module for more details on usage and potential error cases.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/fuses'</span>).flipFuses(\n  <span class=\"hljs-comment\">// Path to electron</span>\n  <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>),\n  <span class=\"hljs-comment\">// Fuses to flip</span>\n  {\n    <span class=\"hljs-attr\">runAsNode</span>: <span class=\"hljs-literal\">false</span>\n  }\n)\n</code></pre>\n<h3 id=\"the-hard-way\"><a href=\"#the-hard-way\">The hard way</a></h3>\n<h4 id=\"quick-glossary\"><a href=\"#quick-glossary\">Quick Glossary</a></h4>\n<ul>\n<li><strong>Fuse Wire</strong>: A sequence of bytes in the Electron binary used to control the fuses</li>\n<li><strong>Sentinel</strong>: A static known sequence of bytes you can use to locate the fuse wire</li>\n<li><strong>Fuse Schema</strong>: The format / allowed values for the fuse wire</li>\n</ul>\n<p>Manually flipping fuses requires editing the Electron binary and modifying the fuse wire to be the sequence of bytes that represent the state of the fuses you want.</p>\n<p>Somewhere in the Electron binary there will be a sequence of bytes that look like this:</p>\n<pre><code class=\"hljs language-plaintext\">| ...binary | sentinel_bytes | fuse_version | fuse_wire_length | fuse_wire | ...binary |\n</code></pre>\n<ul>\n<li><code>sentinel_bytes</code> is always this exact string <code>dL7pKGdnNz796PbbjQWNKmHXBZaB9tsX</code></li>\n<li><code>fuse_version</code> is a single byte whose unsigned integer value represents the version of the fuse schema</li>\n<li><code>fuse_wire_length</code> is a single byte whose unsigned integer value represents the number of fuses in the following fuse wire</li>\n<li><code>fuse_wire</code> is a sequence of N bytes, each byte represents a single fuse and its state.<ul>\n<li>\"0\" (0x30) indicates the fuse is disabled</li>\n<li>\"1\" (0x31) indicates the fuse is enabled</li>\n<li>\"r\" (0x72) indicates the fuse has been removed and changing the byte to either 1 or 0 will have no effect.</li>\n</ul></li>\n</ul>\n<p>To flip a fuse you find its position in the fuse wire and change it to \"0\" or \"1\" depending on the state you'd like.</p>\n<p>Вы можете просмотреть текущую схему <a href=\"https://github.com/electron/electron/blob/main/build/fuses/fuses.json5\">здесь</a>.</p>",
      "title": "Electron Fuses",
      "description": "Package time feature toggles"
    },
    "/docs/api/global-shortcut": {
      "locale": "ru-RU",
      "slug": "global-shortcut",
      "href": "/docs/api/global-shortcut",
      "crowdinFileId": "256323",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/global-shortcut.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"globalshortcut\"><a href=\"#globalshortcut\">globalShortcut</a></h1>\n<blockquote>\n<p>Отслеживает действия на клавиатуре, когда она не сфокусирована на приложении.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p>Модуль <code>globalShortcut</code> может регистрировать/отменять регистрацию глобальных сочетаний клавиш, так что вы можете настраивать задачи для различных сочетаний клавиш.</p>\n<p><strong>Примечание:</strong> Сочетания клавиш являются глобальными, они будут работать, даже если ваше приложение не акцентирует внимание на клавиатуре. This module cannot be used before the <code>ready</code> event of the app module is emitted.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Register a 'CommandOrControl+X' shortcut listener.</span>\n  <span class=\"hljs-keyword\">const</span> ret = globalShortcut.register(<span class=\"hljs-string\">'CommandOrControl+X'</span>, () => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'CommandOrControl+X is pressed'</span>)\n  })\n\n  <span class=\"hljs-keyword\">if</span> (!ret) {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'ошибка регистрации'</span>)\n  }\n\n  <span class=\"hljs-comment\">// Проверяем, было ли сочетание зарегистрировано.</span>\n  <span class=\"hljs-built_in\">console</span>.log(globalShortcut.isRegistered(<span class=\"hljs-string\">'CommandOrControl+X'</span>))\n})\n\napp.on(<span class=\"hljs-string\">'will-quit'</span>, () => {\n  <span class=\"hljs-comment\">// Отменяем регистрацию сочетания клавиш.</span>\n  globalShortcut.unregister(<span class=\"hljs-string\">'CommandOrControl+X'</span>)\n\n  <span class=\"hljs-comment\">// Отменяем регистрацию всех сочетаний.</span>\n  globalShortcut.unregisterAll()\n})\n</code></pre>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code>globalShortcut</code> имеет следующие методы:</p>\n<h3 id=\"globalshortcutregisteraccelerator-callback\"><a href=\"#globalshortcutregisteraccelerator-callback\"><code>globalShortcut.register(accelerator, callback)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n<li><code>callback</code> Function</li>\n</ul>\n<p>Возвращает <code>Boolean</code> - было ли сочетание клавиш успешно зарегистрировано.</p>\n<p>Registers a global shortcut of <code>accelerator</code>. The <code>callback</code> is called when the registered shortcut is pressed by the user.</p>\n<p>Когда accelerator уже занят другими приложениями, этот вызов будет молча завершаться ошибкой. Такое поведение назначается операционными системами, поскольку они не хотят, чтобы приложения боролись за глобальные сочетания клавиш.</p>\n<p>Следующие accelerators не будут успешно зарегистрированы на macOS 10.14 Mojave, если приложение не было авторизовано в качестве <a href=\"https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html\">доверенного клиента специальных возможностей</a>:</p>\n<ul>\n<li>\"Media Play/Pause\"</li>\n<li>\"Media Next Track\"</li>\n<li>\"Media Previous Track\"</li>\n<li>\"Media Stop\"</li>\n</ul>\n<h3 id=\"globalshortcutregisterallaccelerators-callback\"><a href=\"#globalshortcutregisterallaccelerators-callback\"><code>globalShortcut.registerAll(accelerators, callback)</code></a></h3>\n<ul>\n<li><code>accelerators</code> String[] - массив <a href=\"/docs/api/accelerator\">Accelerator</a>.</li>\n<li><code>callback</code> Function</li>\n</ul>\n<p>Registers a global shortcut of all <code>accelerator</code> items in <code>accelerators</code>. The <code>callback</code> is called when any of the registered shortcuts are pressed by the user.</p>\n<p>Когда определенный accelerator уже занят другими приложениями, этот вызов будет молча завершаться ошибкой. Такое поведение назначается операционными системами, поскольку они не хотят, чтобы приложения боролись за глобальные сочетания клавиш.</p>\n<p>Следующие accelerators не будут успешно зарегистрированы на macOS 10.14 Mojave, если приложение не было авторизовано в качестве <a href=\"https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html\">доверенного клиента специальных возможностей</a>:</p>\n<ul>\n<li>\"Media Play/Pause\"</li>\n<li>\"Media Next Track\"</li>\n<li>\"Media Previous Track\"</li>\n<li>\"Media Stop\"</li>\n</ul>\n<h3 id=\"globalshortcutisregisteredaccelerator\"><a href=\"#globalshortcutisregisteredaccelerator\"><code>globalShortcut.isRegistered(accelerator)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n</ul>\n<p>Возвращает <code>Boolean</code> - независимо от того, зарегистрировало ли это приложение <code>accelerator</code>.</p>\n<p>Когда ускоритель уже занят другими приложениями, этот вызов будет возвращать <code>false</code>. Такое поведение назначается операционными системами, поскольку они не хотят, чтобы приложения боролись за глобальные сочетания клавиш.</p>\n<h3 id=\"globalshortcutunregisteraccelerator\"><a href=\"#globalshortcutunregisteraccelerator\"><code>globalShortcut.unregister(accelerator)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n</ul>\n<p>Отмена регистрации сочетания клавиш <code>accelerator</code>.</p>\n<h3 id=\"globalshortcutunregisterall\"><a href=\"#globalshortcutunregisterall\"><code>globalShortcut.unregisterAll()</code></a></h3>\n<p>Отменяет регистрацию всех глобальных ярлыков.</p>",
      "title": "globalShortcut",
      "description": "Отслеживает действия на клавиатуре, когда она не сфокусирована на приложении."
    },
    "/docs/glossary": {
      "locale": "ru-RU",
      "slug": "glossary",
      "href": "/docs/glossary",
      "crowdinFileId": "256123",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/glossary.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"глоссарий\"><a href=\"#глоссарий\">Глоссарий</a></h1>\n<p>Данная страница посвящена терминам, которые обычно используются при разработке на Electron.</p>\n<h3 id=\"asar\"><a href=\"#asar\">ASAR</a></h3>\n<p>ASAR это Atom Shell Archive Format. <a href=\"https://github.com/electron/asar\">Asar</a> это простой архив <code>tar</code>-подобного формата, который объединяет файлы в один файл. Electron может читать файлы в архиве без распаковки оного.</p>\n<p>Формат ASAR был создан в первую очередь для повышения производительности в Windows при чтения большого количества небольших файлов (например, при загрузке дерева зависимостей JavaScript приложения из <code>node_modules</code>).</p>\n<h3 id=\"code-signing\"><a href=\"#code-signing\">code signing</a></h3>\n<p>Подписывание кода — это процесс, при котором разработчик приложения подписывает свой код цифровой подписью, чтобы после упаковки подтвердить, что он не подделан. И Windows, и macOS реализуют собственную версию подписи кода. Как разработчик классических приложений, важно подписать свой код, если вы планируете распространять его среди широкой общественности.</p>\n<p>Дополнительные сведения можно узнать в обучении <a href=\"/docs/tutorial/code-signing\">подписывание кода</a>.</p>\n<h3 id=\"изоляция-контекста\"><a href=\"#изоляция-контекста\">изоляция контекста</a></h3>\n<p>Context isolation is a security measure in Electron that ensures that your preload script cannot leak privileged Electron or Node.js APIs to the web contents in your renderer process. With context isolation enabled, the only way to expose APIs from your preload script is through the <code>contextBridge</code> API.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/context-isolation\">Context Isolation</a> tutorial.</p>\n<p>See also: <a href=\"#preload-script\">preload script</a>, <a href=\"#renderer-process\">renderer process</a></p>\n<h3 id=\"crt\"><a href=\"#crt\">CRT</a></h3>\n<p>The C Runtime Library (CRT) is the part of the C++ Standard Library that incorporates the ISO C99 standard library. Библиотеки Visual C++, которые реализуют CRT, поддерживают развитие машинного кода и смешанного собственного и управляемого кода и чисто управляемого кода для разработки .NET.</p>\n<h3 id=\"dmg\"><a href=\"#dmg\">DMG</a></h3>\n<p>Apple Disk Image (DMG) это пакетный формат, который используется в macOS. DMG файлы обычно используются для распространения \"установщиков\" приложения.</p>\n<h3 id=\"ime\"><a href=\"#ime\">IME</a></h3>\n<p>Input Method Editor. Эта программа позволяет пользователям вводить символы, которые отсутствуют на клавиатуре. Например, это позволяет пользователям Латинской клавиатуры вводить Китайские, Японские, Корейские и Хинди символы.</p>\n<h3 id=\"idl\"><a href=\"#idl\">IDL</a></h3>\n<p>Interface description language. Write function signatures and data types in a format that can be used to generate interfaces in Java, C++, JavaScript, etc.</p>\n<h3 id=\"ipc\"><a href=\"#ipc\">IPC</a></h3>\n<p>IPC stands for inter-process communication. Electron uses IPC to send serialized JSON messages between the main and renderer processes.</p>\n<p>см. также: <a href=\"#main-process\">основной(main) процесс</a>, <a href=\"#renderer-process\">процесс отображения(renderer)</a></p>\n<h3 id=\"главный-main-процесс\"><a href=\"#главный-main-процесс\">главный (main) процесс</a></h3>\n<p>The main process, commonly a file named <code>main.js</code>, is the entry point to every Electron app. It controls the life of the app, from open to close. Также управляет нативными элементами, такими как Menu, Menu Bar, Dock, Tray, и др. The main process is responsible for creating each new renderer process in the app. The full Node API is built in.</p>\n<p>Every app's main process file is specified in the <code>main</code> property in <code>package.json</code>. This is how <code>electron .</code> knows what file to execute at startup.</p>\n<p>In Chromium, this process is referred to as the \"browser process\". It is renamed in Electron to avoid confusion with renderer processes.</p>\n<p>См. также: <a href=\"#process\">процесс</a>, <a href=\"#renderer-process\">процесс отображения(renderer)</a></p>\n<h3 id=\"mas\"><a href=\"#mas\">MAS</a></h3>\n<p>Acronym for Apple's Mac App Store. For details on submitting your app to the MAS, see the <a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store Submission Guide</a>.</p>\n<h3 id=\"mojo\"><a href=\"#mojo\">Mojo</a></h3>\n<p>An IPC system for communicating intra- or inter-process, and that's important because Chrome is keen on being able to split its work into separate processes or not, depending on memory pressures etc.</p>\n<p>Смотри <a href=\"https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md\">https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md</a></p>\n<p>See also: <a href=\"#ipc\">IPC</a></p>\n<h3 id=\"msi\"><a href=\"#msi\">MSI</a></h3>\n<p>On Windows, MSI packages are used by the Windows Installer (also known as Microsoft Installer) service to install and configure applications.</p>\n<p>More information can be found in <a href=\"https://docs.microsoft.com/en-us/windows/win32/msi/windows-installer-portal\">Microsoft's documentation</a>.</p>\n<h3 id=\"собственные-модули\"><a href=\"#собственные-модули\">собственные модули</a></h3>\n<p>Собственные модули (также называемые <a href=\"https://nodejs.org/api/addons.html\">дополнениями</a> в Node.js) это модули написанные на C или C++, которые могут быть загружены в Node.js или Electron используя функцию require(), и используются так, как если бы они были обычным модулем Node.js. Они используются главным образом для предоставления интерфейса между скриптов JavaScript, выполняющийся в Node.js и C/C++ библиотеках.</p>\n<p>Собственные модули Node поддерживаются в Electron, но учитывая, что Electron предпочитает использовать разные версии V8 для Node, установленного на Вашем компьютере, вы должны вручную указать расположение заголовков Electron'а, когда собираете собственные модули.</p>\n<p>For more information, read the [Native Node Modules] tutorial.</p>\n<h3 id=\"notarization\"><a href=\"#notarization\">notarization</a></h3>\n<p>Notarization is a macOS-specific process where a developer can send a code-signed app to Apple servers to get verified for malicious components through an automated service.</p>\n<p>See also: <a href=\"#code-signing\">code signing</a></p>\n<h3 id=\"osr\"><a href=\"#osr\">OSR</a></h3>\n<p>OSR (offscreen rendering) can be used for loading heavy page in background and then displaying it after (it will be much faster). It allows you to render page without showing it on screen.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/offscreen-rendering\">Offscreen Rendering</a>[osr] tutorial.</p>\n<h3 id=\"preload-script\"><a href=\"#preload-script\">preload script</a></h3>\n<p>Preload scripts contain code that executes in a renderer process before its web contents begin loading. These scripts run within the renderer context, but are granted more privileges by having access to Node.js APIs.</p>\n<p>See also: <a href=\"#renderer-process\">renderer process</a>, <a href=\"#context-isolation\">context isolation</a></p>\n<h3 id=\"process\"><a href=\"#process\">process</a></h3>\n<p>Процесс является экземпляром выполняемой компьютерной программы. Electron приложения используют <a href=\"#main-process\">главный(main)</a> процесс и один или более процессы <a href=\"#renderer-process\">отображения(renderer)</a>, на самом деле работает несколько программ одновременно.</p>\n<p>В Node.js и Electron, каждый запущенный процесс имеет объект <code>process</code>. Этот объект является глобальным, предоставляющий информацию о текущем процессе и контроль над ним. Он всегда доступен глобально в приложение без использования require().</p>\n<p>См. также: <a href=\"#main-process\">основной(main) процесс</a>, <a href=\"#renderer-process\">процесс отображения(renderer)</a></p>\n<h3 id=\"процесс-отображения-renderer-process\"><a href=\"#процесс-отображения-renderer-process\">Процесс отображения (renderer process)</a></h3>\n<p>The renderer process is a browser window in your app. Unlike the main process, there can be multiple of these and each is run in a separate process. They can also be hidden.</p>\n<p>См. также: <a href=\"#process\">процесс</a>, <a href=\"#main-process\">основной(main) процесс</a></p>\n<h3 id=\"песочница\"><a href=\"#песочница\">песочница</a></h3>\n<p>The sandbox is a security feature inherited from Chromium that restricts your renderer processes to a limited set of permissions.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/sandbox\">Process Sandboxing</a> tutorial.</p>\n<p>See also: <a href=\"#process\">process</a></p>\n<h3 id=\"squirrel\"><a href=\"#squirrel\">Squirrel</a></h3>\n<p>Squirrel является фреймворком с открытым исходным кодом, который позволяет Electron приложениям автоматически обновляться, когда выпустится новая версия. См. <a href=\"/docs/api/auto-updater\">autoUpdated</a> API для информации о начале работы с Squirrel.</p>\n<h3 id=\"пользовательское-пространство\"><a href=\"#пользовательское-пространство\">пользовательское пространство</a></h3>\n<p>Этот термин возник в сообществе Unix, где \"userland\" или \"userspace\" относится к программам, которые выполняются за пределами ядра операционной системы. Этот термин был популяризирован в сообществах Node и npm, чтобы различать функции доступные в \"ядре Node\" по сравнению с пакетами опубликованными в реестре npm гораздо более \"пользовательским\" сообществом.</p>\n<p>Как и Node, Electron сфокусирован на наличии небольшого набора API функций, которые обеспечивают весь необходимый базис для разработки кросс-платформенных настольных приложений. Такая философия позволяет Electron оставаться гибким инструментом, будучи не предписывая того как им пользоваться. Пользовательское пространство позволяет создавать и совместно использовать инструменты, которые обеспечивают дополнительный функционал поверх того, который доступен в ядре.</p>\n<h3 id=\"v8\"><a href=\"#v8\">V8</a></h3>\n<p>V8 is Google's open source JavaScript engine. It is written in C++ and is used in Google Chrome. V8 can run standalone, or can be embedded into any C++ application.</p>\n<p>Electron компилирует V8 как часть Chromium а затем указывает Node использовать этот V8 при сборке.</p>\n<p>V8's version numbers always correspond to those of Google Chrome. Chrome 59 includes V8 5.9, Chrome 58 includes V8 5.8, etc.</p>\n<ul>\n<li><a href=\"https://v8.dev/\">v8.dev</a></li>\n<li><a href=\"https://nodejs.org/api/v8.html\">nodejs.org/api/v8.html</a></li>\n<li><a href=\"/docs/development/v8-development\">docs/development/v8-development.md</a></li>\n</ul>\n<h3 id=\"webview\"><a href=\"#webview\">webview</a></h3>\n<p><code>webview</code> tags are used to embed 'guest' content (such as external web pages) in your Electron app. They are similar to <code>iframe</code>s, but differ in that each webview runs in a separate process. Оно не имеет тех же разрешений, так как ваша веб страница и все взаимодействие между вашим приложением и встроенным контентом будут асинхронными. Это позволяет защитить ваше приложение от встраиваемого содержимого.</p>",
      "title": "Глоссарий",
      "description": ""
    },
    "/docs/development/goma": {
      "locale": "ru-RU",
      "slug": "goma",
      "href": "/docs/development/goma",
      "crowdinFileId": "256157",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/goma.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"goma\"><a href=\"#goma\">Goma</a></h1>\n<blockquote>\n<p>Goma is a distributed compiler service for open-source projects such as Chromium and Android.</p>\n</blockquote>\n<p>Electron has a deployment of a custom Goma Backend that we make available to all Electron Maintainers.  See the <a href=\"#access\">Access</a> section below for details on authentication.  There is also a <code>cache-only</code> Goma endpoint that will be used by default if you do not have credentials.  Requests to the cache-only Goma will not hit our cluster, but will read from our cache and should result in significantly faster build times.</p>\n<h2 id=\"enabling-goma\"><a href=\"#enabling-goma\">Enabling Goma</a></h2>\n<p>Currently the only supported way to use Goma is to use our <a href=\"https://github.com/electron/build-tools\">Build Tools</a>. Goma configuration is automatically included when you set up <code>build-tools</code>.</p>\n<p>If you are a maintainer and have access to our cluster, please ensure that you run <code>e init</code> with <code>--goma=cluster</code> in order to configure <code>build-tools</code> to use the Goma cluster.  If you have an existing config, you can just set <code>\"goma\": \"cluster\"</code> in your config file.</p>\n<h2 id=\"building-with-goma\"><a href=\"#building-with-goma\">Building with Goma</a></h2>\n<p>When you are using Goma you can run <code>ninja</code> with a substantially higher <code>j</code> value than would normally be supported by your machine.</p>\n<p>Please do not set a value higher than <strong>200</strong> on Windows or Linux and <strong>50</strong> on macOS. We monitor Goma system usage, and users found to be abusing it with unreasonable concurrency will be de-activated.</p>\n<pre><code class=\"hljs language-bash\">ninja -C out/Testing electron -j 200\n</code></pre>\n<p>If you're using <code>build-tools</code>, appropriate <code>-j</code> values will automatically be used for you.</p>\n<h2 id=\"monitoring-goma\"><a href=\"#monitoring-goma\">Monitoring Goma</a></h2>\n<p>If you access <a href=\"http://localhost:8088\">http://localhost:8088</a> on your local machine you can monitor compile jobs as they flow through the goma system.</p>\n<h2 id=\"access\"><a href=\"#access\">Access</a></h2>\n<p>For security and cost reasons, access to Electron's Goma cluster is currently restricted to Electron Maintainers.  If you want access please head to <code>#access-requests</code> in Slack and ping <code>@goma-squad</code> to ask for access.  Please be aware that being a maintainer does not <em>automatically</em> grant access and access is determined on a case by case basis.</p>\n<h2 id=\"uptime--support\"><a href=\"#uptime--support\">Uptime / Support</a></h2>\n<p>We have automated monitoring of our Goma cluster and cache at <a href=\"https://status.notgoma.com\">https://status.notgoma.com</a></p>\n<p>We do not provide support for usage of Goma and any issues raised asking for help / having issues will <em>probably</em> be closed without much reason, we do not have the capacity to handle that kind of support.</p>",
      "title": "Goma",
      "description": "Goma is a distributed compiler service for open-source projects such as Chromium and Android."
    },
    "/docs/api/structures/gpu-feature-status": {
      "locale": "ru-RU",
      "slug": "gpu-feature-status",
      "href": "/docs/api/structures/gpu-feature-status",
      "crowdinFileId": "256439",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/gpu-feature-status.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"gpufeaturestatus-object\"><a href=\"#gpufeaturestatus-object\">GPUFeatureStatus Object</a></h1>\n<ul>\n<li><code>2d_canvas</code> String - Canvas.</li>\n<li><code>flash_3d</code> String - Flash.</li>\n<li><code>flash_stage3d</code> String - Flash Stage3D.</li>\n<li><code>flash_stage3d_baseline</code> String - Flash Stage3D Baseline profile.</li>\n<li><code>gpu_compositing</code> String - Compositing.</li>\n<li><code>multiple_raster_threads</code> String - Multiple Raster Threads.</li>\n<li><code>native_gpu_memory_buffers</code> String - Native GpuMemoryBuffers.</li>\n<li><code>rasterization</code> String - Rasterization.</li>\n<li><code>video_decode</code> String - Video Decode.</li>\n<li><code>video_encode</code> String - Video Encode.</li>\n<li><code>vpx_decode</code> String - VPx Video Decode.</li>\n<li><code>webgl</code> String - WebGL.</li>\n<li><code>webgl2</code> String - WebGL2.</li>\n</ul>\n<p>Возможные значения:</p>\n<ul>\n<li><code>disabled_software</code> - Software only. Hardware acceleration disabled (yellow)</li>\n<li><code>disabled_off</code> - Disabled (red)</li>\n<li><code>disabled_off_ok</code> - Disabled (yellow)</li>\n<li><code>unavailable_software</code> - Software only, hardware acceleration unavailable (yellow)</li>\n<li><code>unavailable_off</code> - Unavailable (red)</li>\n<li><code>unavailable_off_ok</code> - Unavailable (yellow)</li>\n<li><code>enabled_readback</code> - Hardware accelerated but at reduced performance (yellow)</li>\n<li><code>enabled_force</code> - Hardware accelerated on all pages (green)</li>\n<li><code>enabled</code> - Hardware accelerated (green)</li>\n<li><code>enabled_on</code> - Enabled (green)</li>\n<li><code>enabled_force_on</code> - Force enabled (green)</li>\n</ul>",
      "title": "GPUFeatureStatus Object",
      "description": ""
    },
    "/docs/api/structures/hid-device": {
      "locale": "ru-RU",
      "slug": "hid-device",
      "href": "/docs/api/structures/hid-device",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/hid-device.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"hiddevice-object\"><a href=\"#hiddevice-object\">HIDDevice Object</a></h1>\n<ul>\n<li><code>deviceId</code> String - Unique identifier for the device.</li>\n<li><code>name</code> String - Name of the device.</li>\n<li><code>vendorId</code> Integer - The USB vendor ID.</li>\n<li><code>productId</code> Integer - The USB product ID.</li>\n<li><code>serialNumber</code> String (optional) - The USB device serial number.</li>\n<li><code>guid</code> String (optional) - Unique identifier for the HID interface.  A device may have multiple HID interfaces.</li>\n</ul>",
      "title": "HIDDevice Object",
      "description": ""
    },
    "/docs/api/in-app-purchase": {
      "locale": "ru-RU",
      "slug": "in-app-purchase",
      "href": "/docs/api/in-app-purchase",
      "crowdinFileId": "256325",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/in-app-purchase.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"inapppurchase\"><a href=\"#inapppurchase\">inAppPurchase</a></h1>\n<blockquote>\n<p>Покупки внутри приложения в Mac App Store.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<h2 id=\"события\"><a href=\"#события\">События</a></h2>\n<p>Модуль <code>inAppPurchase</code> генерирует следующие события:</p>\n<h3 id=\"ивент-transactions-updated\"><a href=\"#ивент-transactions-updated\">Ивент: 'transactions-updated'</a></h3>\n<p>Возникает при обновлении одной или нескольких транзакций.</p>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>transactions</code> Transaction[] - Массив <a href=\"/docs/api/structures/transaction\"><code>Transaction</code></a> объектов.</li>\n</ul>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code>inAppPurchase</code> имеет следующие методы:</p>\n<h3 id=\"inapppurchasepurchaseproductproductid-quantity\"><a href=\"#inapppurchasepurchaseproductproductid-quantity\"><code>inAppPurchase.purchaseProduct(productID[, quantity])</code></a></h3>\n<ul>\n<li><code>productID</code> String - Идентификаторы продукта для покупки. (Идентификатор <code>com.example.app.product1</code> это <code>product1</code>).</li>\n<li><code>quantity</code> Integer (опционально) - Количество товаров, которое хочет приобрести пользователь.</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;Boolean></code> - Возвращает <code>true</code>, если товар действителен и добавлен в очередь платежей.</p>\n<p>Вы должны начать считывать событие <code>transactions-updated</code> как можно скорее и в любом случае перед тем, как вызвать <code>purchaseProduct</code>.</p>\n<h3 id=\"inapppurchasegetproductsproductids\"><a href=\"#inapppurchasegetproductsproductids\"><code>inAppPurchase.getProducts(productIDs)</code></a></h3>\n<ul>\n<li><code>productIDs</code> String[] - Идентификаторы получаемых продуктов.</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;Product[]></code> - Разрешает с массив объектов <a href=\"/docs/api/structures/product\"><code>Product</code></a>.</p>\n<p>Получает описания товара.</p>\n<h3 id=\"inapppurchasecanmakepayments\"><a href=\"#inapppurchasecanmakepayments\"><code>inAppPurchase.canMakePayments()</code></a></h3>\n<p>Returns <code>Boolean</code> - whether a user can make a payment.</p>\n<h3 id=\"inapppurchaserestorecompletedtransactions\"><a href=\"#inapppurchaserestorecompletedtransactions\"><code>inAppPurchase.restoreCompletedTransactions()</code></a></h3>\n<p>How can I get paid for translation or proofreading of this? Do you pay by Paypal? Can i also create reports for this?-Pls reply-Thank you in adv. This method can be called either to install purchases on additional devices, or to restore purchases for an application that the user deleted and reinstalled.</p>\n<p><a href=\"https://developer.apple.com/documentation/storekit/skpaymentqueue?language=objc\">The payment queue</a> delivers a new transaction for each previously completed transaction that can be restored. Each transaction includes a copy of the original transaction.</p>\n<h3 id=\"inapppurchasegetreceipturl\"><a href=\"#inapppurchasegetreceipturl\"><code>inAppPurchase.getReceiptURL()</code></a></h3>\n<p>Returns <code>String</code> - the path to the receipt.</p>\n<h3 id=\"inapppurchasefinishalltransactions\"><a href=\"#inapppurchasefinishalltransactions\"><code>inAppPurchase.finishAllTransactions()</code></a></h3>\n<p>Завершает все ожидающие транзакции.</p>\n<h3 id=\"inapppurchasefinishtransactionbydatedate\"><a href=\"#inapppurchasefinishtransactionbydatedate\"><code>inAppPurchase.finishTransactionByDate(date)</code></a></h3>\n<ul>\n<li><code>date</code> String - Дата завершения транзакции в формате ISO.</li>\n</ul>\n<p>Завершает отложенные транзакции, соответствующие дате.</p>",
      "title": "inAppPurchase",
      "description": "Покупки внутри приложения в Mac App Store."
    },
    "/docs/tutorial/in-app-purchases": {
      "locale": "ru-RU",
      "slug": "in-app-purchases",
      "href": "/docs/tutorial/in-app-purchases",
      "crowdinFileId": "256203",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/in-app-purchases.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"in-app-purchases-macos\"><a href=\"#in-app-purchases-macos\">In-App Purchases (macOS)</a></h1>\n<h2 id=\"подготовка\"><a href=\"#подготовка\">Подготовка</a></h2>\n<h3 id=\"paid-applications-agreement\"><a href=\"#paid-applications-agreement\">Paid Applications Agreement</a></h3>\n<p>If you haven't already, you’ll need to sign the Paid Applications Agreement and set up your banking and tax information in iTunes Connect.</p>\n<p><a href=\"https://help.apple.com/itunes-connect/developer/#/devb6df5ee51\">iTunes Connect Developer Help: Agreements, tax, and banking overview</a></p>\n<h3 id=\"create-your-in-app-purchases\"><a href=\"#create-your-in-app-purchases\">Create Your In-App Purchases</a></h3>\n<p>Then, you'll need to configure your in-app purchases in iTunes Connect, and include details such as name, pricing, and description that highlights the features and functionality of your in-app purchase.</p>\n<p><a href=\"https://help.apple.com/itunes-connect/developer/#/devae49fb316\">iTunes Connect Developer Help: Create an in-app purchase</a></p>\n<h3 id=\"изменить-cfbundleidentifier\"><a href=\"#изменить-cfbundleidentifier\">Изменить CFBundleIdentifier</a></h3>\n<p>Для проверки встроенных покупок в разработке с Electron вам нужно изменить <code>CFBundleIdentifier</code> в <code>node_modules/electron/dist/Electron.app/Contents/Info.plist</code>. Вы должны заменить <code>com.github.electron</code> идентификатором приложения, созданного с помощью iTunes Connect.</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>CFBundleIdentifier<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>com.example.app<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n</code></pre>\n<h2 id=\"пример-кода\"><a href=\"#пример-кода\">Пример кода</a></h2>\n<p>Here is an example that shows how to use In-App Purchases in Electron. You'll have to replace the product ids by the identifiers of the products created with iTunes Connect (the identifier of <code>com.example.app.product1</code> is <code>product1</code>). Note that you have to listen to the <code>transactions-updated</code> event as soon as possible in your app.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { inAppPurchase } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> PRODUCT_IDS = [<span class=\"hljs-string\">'id1'</span>, <span class=\"hljs-string\">'id2'</span>]\n\n<span class=\"hljs-comment\">// Listen for transactions as soon as possible.</span>\ninAppPurchase.on(<span class=\"hljs-string\">'transactions-updated'</span>, (event, transactions) => {\n  <span class=\"hljs-keyword\">if</span> (!<span class=\"hljs-built_in\">Array</span>.isArray(transactions)) {\n    <span class=\"hljs-keyword\">return</span>\n  }\n\n  <span class=\"hljs-comment\">// Check each transaction.</span>\n  transactions.forEach(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\">transaction</span>) </span>{\n    <span class=\"hljs-keyword\">const</span> payment = transaction.payment\n\n    <span class=\"hljs-keyword\">switch</span> (transaction.transactionState) {\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'purchasing'</span>:\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Purchasing <span class=\"hljs-subst\">${payment.productIdentifier}</span>...`</span>)\n        <span class=\"hljs-keyword\">break</span>\n\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'purchased'</span>: {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${payment.productIdentifier}</span> purchased.`</span>)\n\n        <span class=\"hljs-comment\">// Get the receipt url.</span>\n        <span class=\"hljs-keyword\">const</span> receiptURL = inAppPurchase.getReceiptURL()\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Receipt URL: <span class=\"hljs-subst\">${receiptURL}</span>`</span>)\n\n        <span class=\"hljs-comment\">// Submit the receipt file to the server and check if it is valid.</span>\n        <span class=\"hljs-comment\">// @see https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html</span>\n        <span class=\"hljs-comment\">// ...</span>\n        <span class=\"hljs-comment\">// If the receipt is valid, the product is purchased</span>\n        <span class=\"hljs-comment\">// ...</span>\n\n        <span class=\"hljs-comment\">// Finish the transaction.</span>\n        inAppPurchase.finishTransactionByDate(transaction.transactionDate)\n\n        <span class=\"hljs-keyword\">break</span>\n      }\n\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'failed'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Failed to purchase <span class=\"hljs-subst\">${payment.productIdentifier}</span>.`</span>)\n\n        <span class=\"hljs-comment\">// Finish the transaction.</span>\n        inAppPurchase.finishTransactionByDate(transaction.transactionDate)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'restored'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The purchase of <span class=\"hljs-subst\">${payment.productIdentifier}</span> has been restored.`</span>)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'deferred'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The purchase of <span class=\"hljs-subst\">${payment.productIdentifier}</span> has been deferred.`</span>)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-attr\">default</span>:\n        <span class=\"hljs-keyword\">break</span>\n    }\n  })\n})\n\n<span class=\"hljs-comment\">// Check if the user is allowed to make in-app purchase.</span>\n<span class=\"hljs-keyword\">if</span> (!inAppPurchase.canMakePayments()) {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The user is not allowed to make in-app purchase.'</span>)\n}\n\n<span class=\"hljs-comment\">// Retrieve and display the product descriptions.</span>\ninAppPurchase.getProducts(PRODUCT_IDS).then(<span class=\"hljs-function\"><span class=\"hljs-params\">products</span> =></span> {\n  <span class=\"hljs-comment\">// Check the parameters.</span>\n  <span class=\"hljs-keyword\">if</span> (!<span class=\"hljs-built_in\">Array</span>.isArray(products) || products.length &#x3C;= <span class=\"hljs-number\">0</span>) {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Unable to retrieve the product informations.'</span>)\n    <span class=\"hljs-keyword\">return</span>\n  }\n\n  <span class=\"hljs-comment\">// Display the name and price of each product.</span>\n  products.forEach(<span class=\"hljs-function\"><span class=\"hljs-params\">product</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The price of <span class=\"hljs-subst\">${product.localizedTitle}</span> is <span class=\"hljs-subst\">${product.formattedPrice}</span>.`</span>)\n  })\n\n  <span class=\"hljs-comment\">// Ask the user which product he/she wants to purchase.</span>\n  <span class=\"hljs-keyword\">const</span> selectedProduct = products[<span class=\"hljs-number\">0</span>]\n  <span class=\"hljs-keyword\">const</span> selectedQuantity = <span class=\"hljs-number\">1</span>\n\n  <span class=\"hljs-comment\">// Purchase the selected product.</span>\n  inAppPurchase.purchaseProduct(selectedProduct.productIdentifier, selectedQuantity).then(<span class=\"hljs-function\"><span class=\"hljs-params\">isProductValid</span> =></span> {\n    <span class=\"hljs-keyword\">if</span> (!isProductValid) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The product is not valid.'</span>)\n      <span class=\"hljs-keyword\">return</span>\n    }\n\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The payment has been added to the payment queue.'</span>)\n  })\n})\n</code></pre>",
      "title": "In-App Purchases (macOS)",
      "description": ""
    },
    "/docs/api/incoming-message": {
      "locale": "ru-RU",
      "slug": "incoming-message",
      "href": "/docs/api/incoming-message",
      "crowdinFileId": "256327",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/incoming-message.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-incomingmessage\"><a href=\"#class-incomingmessage\">Class: IncomingMessage</a></h2>\n<blockquote>\n<p>Обрабатывает запросы на HTTP/HTTPS-запросы.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>IncomingMessage</code> реализует интерфейс <a href=\"https://nodejs.org/api/stream.html#stream_readable_streams\">Readable Stream</a> и, тем самым, также и <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h3 id=\"события-экземпляра\"><a href=\"#события-экземпляра\">События экземпляра</a></h3>\n<h4 id=\"событие-data\"><a href=\"#событие-data\">Событие: 'data'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li><code>chunk</code> Buffer - Часть данных в теле ответа.</li>\n</ul>\n<p>Событие <code>data</code> является обычным способом передачи данных ответа в применимый код.</p>\n<h4 id=\"событие-end\"><a href=\"#событие-end\">Событие: 'end'</a></h4>\n<p>Указывает, что тело ответа закончилось. Must be placed before 'data' event.</p>\n<h4 id=\"событие-aborted\"><a href=\"#событие-aborted\">Событие: 'aborted'</a></h4>\n<p>Возникает, когда запрос был отменен во время текущей HTTP-транзакции.</p>\n<h4 id=\"событие-error\"><a href=\"#событие-error\">Событие: 'error'</a></h4>\n<p>Возвращает:</p>\n<p><code>error</code> Error - Содержит строку ошибки, идентифицирующую причину отказа.</p>\n<p>Возникает при обнаружении ошибки во время потоковой передачи ответных данных. Например, если сервер закрывает базовый объект во время потоковой передачи ответа, объекту ответа будет выдано <code>error</code>, а событие <code>close</code> впоследствии будет выдано объекту запроса.</p>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<p><code>IncomingMessage</code> имеет следующие свойства для чтения:</p>\n<h4 id=\"responsestatuscode\"><a href=\"#responsestatuscode\"><code>response.statusCode</code></a></h4>\n<p><code>Integer</code> с указанием кода ответа HTTP.</p>\n<h4 id=\"responsestatusmessage\"><a href=\"#responsestatusmessage\"><code>response.statusMessage</code></a></h4>\n<p><code>String</code>, представляющая сообщение о состоянии HTTP.</p>\n<h4 id=\"responseheaders\"><a href=\"#responseheaders\"><code>response.headers</code></a></h4>\n<p>A <code>Record&#x3C;string, string | string[]></code> representing the HTTP response headers. The <code>headers</code> object is formatted as follows:</p>\n<ul>\n<li>Все имена заголовков в нижнем регистре.</li>\n<li>Duplicates of <code>age</code>, <code>authorization</code>, <code>content-length</code>, <code>content-type</code>, <code>etag</code>, <code>expires</code>, <code>from</code>, <code>host</code>, <code>if-modified-since</code>, <code>if-unmodified-since</code>, <code>last-modified</code>, <code>location</code>, <code>max-forwards</code>, <code>proxy-authorization</code>, <code>referer</code>, <code>retry-after</code>, <code>server</code>, or <code>user-agent</code> are discarded.</li>\n<li><code>set-cookie</code> is always an array. Duplicates are added to the array.</li>\n<li>For duplicate <code>cookie</code> headers, the values are joined together with '; '.</li>\n<li>For all other headers, the values are joined together with ', '.</li>\n</ul>\n<h4 id=\"responsehttpversion\"><a href=\"#responsehttpversion\"><code>response.httpVersion</code></a></h4>\n<p><code>String</code> с указанием номера HTTP протокола. Типичные значения: «1.0» или «1.1». Дополнительно <code>httpVersionMajor</code> и <code>httpVersionMinor</code> являются двумя целочисленными читаемыми свойствами, которые возвращают соответственно основные и второстепенные номера версий HTTP.</p>\n<h4 id=\"responsehttpversionmajor\"><a href=\"#responsehttpversionmajor\"><code>response.httpVersionMajor</code></a></h4>\n<p><code>Integer</code> с указанием основной версии протокола HTTP.</p>\n<h4 id=\"responsehttpversionminor\"><a href=\"#responsehttpversionminor\"><code>response.httpVersionMinor</code></a></h4>\n<p><code>Integer</code>, указание номера младшей версии протокола HTTP.</p>",
      "title": "IncomingMessage",
      "description": "Обрабатывает запросы на HTTP/HTTPS-запросы."
    },
    "/docs/api/structures/input-event": {
      "locale": "ru-RU",
      "slug": "input-event",
      "href": "/docs/api/structures/input-event",
      "crowdinFileId": "256441",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"inputevent-object\"><a href=\"#inputevent-object\">InputEvent Object</a></h1>\n<ul>\n<li><code>modifiers</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of modifiers of the event, can be <code>shift</code>, <code>control</code>, <code>ctrl</code>, <code>alt</code>, <code>meta</code>, <code>command</code>, <code>cmd</code>, <code>isKeypad</code>, <code>isAutoRepeat</code>, <code>leftButtonDown</code>, <code>middleButtonDown</code>, <code>rightButtonDown</code>, <code>capsLock</code>, <code>numLock</code>, <code>left</code>, <code>right</code>.</li>\n</ul>",
      "title": "InputEvent Object",
      "description": ""
    },
    "/docs/tutorial/installation": {
      "locale": "ru-RU",
      "slug": "installation",
      "href": "/docs/tutorial/installation",
      "crowdinFileId": "256205",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/installation.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"advanced-installation-instructions\"><a href=\"#advanced-installation-instructions\">Advanced Installation Instructions</a></h1>\n<p>To install prebuilt Electron binaries, use <a href=\"https://docs.npmjs.com\"><code>npm</code></a>. The preferred method is to install Electron as a development dependency in your app:</p>\n<pre><code class=\"hljs language-sh\">npm install electron --save-dev\n</code></pre>\n<p>Смотри <a href=\"/docs/tutorial/electron-versioning\">документацию к версиям Electron</a>, чтобы узнать, как управлять версиями Electron в приложении.</p>\n<h2 id=\"running-electron-ad-hoc\"><a href=\"#running-electron-ad-hoc\">Running Electron ad-hoc</a></h2>\n<p>If you're in a pinch and would prefer to not use <code>npm install</code> in your local project, you can also run Electron ad-hoc using the <a href=\"https://docs.npmjs.com/cli/v7/commands/npx\"><code>npx</code></a> command runner bundled with <code>npm</code>:</p>\n<pre><code class=\"hljs language-sh\">npx electron .\n</code></pre>\n<p>The above command will run the current working directory with Electron. Note that any dependencies in your app will not be installed.</p>\n<h2 id=\"настройка\"><a href=\"#настройка\">Настройка</a></h2>\n<p>Если хочешь изменить архитектуру загружаемого контента (например, <code>i32</code> на компьютере с <code>x64</code>), можно использовать аргумент <code>--arch</code> при установке или использовать переменную окружения <code>npm_config_arch</code>:</p>\n<pre><code class=\"hljs language-shell\">npm install --arch=ia32 electron\n</code></pre>\n<p>Так же можно менять платформу приложения (например, <code>win32</code> или <code>linux</code>) при помощи аргумента <code>--platform</code>:</p>\n<pre><code class=\"hljs language-shell\">npm install --platform=win32 electron\n</code></pre>\n<h2 id=\"прокси\"><a href=\"#прокси\">Прокси</a></h2>\n<p>If you need to use an HTTP proxy, you need to set the <code>ELECTRON_GET_USE_PROXY</code> variable to any value, plus additional environment variables depending on your host system's Node version:</p>\n<ul>\n<li><a href=\"https://github.com/gajus/global-agent/blob/v2.1.5/README.md#environment-variables\">Node 10 and above</a></li>\n<li><a href=\"https://github.com/np-maintain/global-tunnel/blob/v2.7.1/README.md#auto-config\">Before Node 10</a></li>\n</ul>\n<h2 id=\"пользовательские-зеркала-и-кеши\"><a href=\"#пользовательские-зеркала-и-кеши\">Пользовательские зеркала и кеши</a></h2>\n<p>Во время установки модуль <code>electron</code> будет обращаться к <a href=\"https://github.com/electron/get\"><code>@electron/get</code></a>, чтобы загрузить скомпилированные бинарники для твоей платформы, если она указана в списке релиза (<code>https://github.com/electron/electron/releases/tag/v$VERSION</code>, где <code>$VERSION</code> — версия Electron).</p>\n<p>Если доступа к GitHub нет или нужна другая сборка, можно задать зеркало или папку кеша.</p>\n<h4 id=\"зеркало\"><a href=\"#зеркало\">Зеркало</a></h4>\n<p>Можно использовать переменную окружения, чтобы переопределить базовый URL, по которому ищутся бинарники или имена файлов. The URL used by <code>@electron/get</code> is composed as follows:</p>\n<pre><code class=\"hljs language-javascript\">url = ELECTRON_MIRROR + ELECTRON_CUSTOM_DIR + <span class=\"hljs-string\">'/'</span> + ELECTRON_CUSTOM_FILENAME\n</code></pre>\n<p>For instance, to use the China CDN mirror:</p>\n<pre><code class=\"hljs language-shell\">ELECTRON_MIRROR=\"https://cdn.npm.taobao.org/dist/electron/\"\n</code></pre>\n<p>By default, <code>ELECTRON_CUSTOM_DIR</code> is set to <code>v$VERSION</code>. To change the format, use the <code>{{ version }}</code> placeholder. For example, <code>version-{{ version }}</code> resolves to <code>version-5.0.0</code>, <code>{{ version }}</code> resolves to <code>5.0.0</code>, and <code>v{{ version }}</code> is equivalent to the default. As a more concrete example, to use the China non-CDN mirror:</p>\n<pre><code class=\"hljs language-shell\">ELECTRON_MIRROR=\"https://npm.taobao.org/mirrors/electron/\"\nELECTRON_CUSTOM_DIR=\"{{ version }}\"\n</code></pre>\n<p>The above configuration will download from URLs such as <code>https://npm.taobao.org/mirrors/electron/8.0.0/electron-v8.0.0-linux-x64.zip</code>.</p>\n<p>If your mirror serves artifacts with different checksums to the official Electron release you may have to set <code>ELECTRON_USE_REMOTE_CHECKSUMS=1</code> to force Electron to use the remote <code>SHASUMS256.txt</code> file to verify the checksum instead of the embedded checksums.</p>\n<h4 id=\"кеш\"><a href=\"#кеш\">Кеш</a></h4>\n<p>Кроме того, можно заменить локальный кеш. <code>@electron/get</code> скачивает файлы в кеш, чтобы снизить нагрузку на сеть. Папку с кешем можно использовать для кастомных сборок или, чтобы полностью избежать сетевого трафика.</p>\n<ul>\n<li>Linux: <code>$XDG_CACHE_HOME</code> или <code>~/.cache/electron/</code></li>\n<li>macOS: <code>~/Library/Caches/electron/</code></li>\n<li>Windows: <code>$LOCALAPPDATA/electron/Cache</code> или <code>~/AppData/Local/electron/Cache/</code></li>\n</ul>\n<p>В старом Electron возможно использование папки <code>~/.electron</code>.</p>\n<p>Также можно переопределить место кеша с помощью переменной окружения <code>electron_config_cache</code>.</p>\n<p>The cache contains the version's official zip file as well as a checksum, stored as a text file. A typical cache might look like this:</p>\n<pre><code class=\"hljs language-sh\">├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9electron-v1.7.9-darwin-x64.zip\n│   └── electron-v1.7.9-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1electron-v1.8.1-darwin-x64.zip\n│   └── electron-v1.8.1-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1electron-v1.8.2-beta.1-darwin-x64.zip\n│   └── electron-v1.8.2-beta.1-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2electron-v1.8.2-beta.2-darwin-x64.zip\n│   └── electron-v1.8.2-beta.2-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3electron-v1.8.2-beta.3-darwin-x64.zip\n│   └── electron-v1.8.2-beta.3-darwin-x64.zip\n└── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3SHASUMS256.txt\n    └── SHASUMS256.txt\n</code></pre>\n<h2 id=\"skip-binary-download\"><a href=\"#skip-binary-download\">Skip binary download</a></h2>\n<p>Under the hood, Electron's JavaScript API binds to a binary that contains its implementations. Because this binary is crucial to the function of any Electron app, it is downloaded by default in the <code>postinstall</code> step every time you install <code>electron</code> from the npm registry.</p>\n<p>However, if you want to install your project's dependencies but don't need to use Electron functionality, you can set the <code>ELECTRON_SKIP_BINARY_DOWNLOAD</code> environment variable to prevent the binary from being downloaded. For instance, this feature can be useful in continuous integration environments when running unit tests that mock out the <code>electron</code> module.</p>\n<pre><code class=\"hljs language-sh\">ELECTRON_SKIP_BINARY_DOWNLOAD=1 npm install\n</code></pre>\n<h2 id=\"устранение-проблем\"><a href=\"#устранение-проблем\">Устранение проблем</a></h2>\n<p>При выполнении команды <code>npm install electron</code>, некоторые пользователи сталкиваются с проблемами установки.</p>\n<p>В большинстве случаев, эти ошибки являются результатом проблем сети и не связаны с npm пакетом <code>electron</code>. Такие ошибки, как <code>ELIFECYCLE</code>, <code>EAI_AGAIN</code>, <code>ECONNRESET</code> и<code>ETIMEDOUT</code> возникают в результате проблем с сетью. Лучшее решение - попытаться переключить сеть, или немного подождать, и попытаться установить снова.</p>\n<p>You can also attempt to download Electron directly from <a href=\"https://github.com/electron/electron/releases\">electron/electron/releases</a> if installing via <code>npm</code> is failing.</p>\n<p>If installation fails with an <code>EACCESS</code> error you may need to <a href=\"https://docs.npmjs.com/getting-started/fixing-npm-permissions\">fix your npm permissions</a>.</p>\n<p>If the above error persists, the <a href=\"https://docs.npmjs.com/misc/config#unsafe-perm\">unsafe-perm</a> flag may need to be set to true:</p>\n<pre><code class=\"hljs language-sh\">sudo npm install electron --unsafe-perm=<span class=\"hljs-literal\">true</span>\n</code></pre>\n<p>На слабой сети следует использовать аргумент <code>--verbose</code>, чтобы задействовать замедленную загрузку:</p>\n<pre><code class=\"hljs language-sh\">npm install --verbose electron\n</code></pre>\n<p>Если нужно перезагрузить файлы без кеша, нужно использовать переменную окружения <code>force_no_cache</code> = <code>true</code>.</p>",
      "title": "Advanced Installation Instructions",
      "description": ""
    },
    "/docs/tutorial/introduction": {
      "locale": "ru-RU",
      "slug": "introduction",
      "href": "/docs/tutorial/introduction",
      "crowdinFileId": "256207",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/introduction.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"введение\"><a href=\"#введение\">Введение</a></h1>\n<p>Добро пожаловать в документацию Electron! Если вы впервые разрабатываете приложение на Electron, начните знакомство с раздела Getting Started, чтобы ознакомиться с основами. В противном случае, не стесняйтесь изучать наши руководства и документацию по API!</p>\n<h2 id=\"что-такое-electron\"><a href=\"#что-такое-electron\">Что такое Electron?</a></h2>\n<p>Electron - это фреймворк для разработки десктопных приложений с использованием HTML, CSS и JavaScript. В двоичный код Electron уже встроены <a href=\"https://www.chromium.org/\">Chromium</a> и <a href=\"https://nodejs.org/\">Node.js</a>, и это позволяет вам поддерживать только JavaScript код и создавать кроссплатформенные приложение, которые будут работать как на Windows, так и на macOS и Linux без необходимости иметь собственный опыт разработки.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<p>Данная документация опирается на предположение о том, что читатель знаком как с Node.js, так и с веб-разработкой в общем виде. Если вы хотите стать более уверенными в какой-либо из этих областей разработки, то мы рекомендуем вам следующие ресурсы для ознакомления:</p>\n<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web\">Начало работы с Интернетом (MDN)</a></li>\n<li><a href=\"https://nodejs.dev/learn\">Введение в Node.js</a></li>\n</ul>\n<p>Более того, вы будете лучше понимать, как работает Electron, если вы ознакомитесь с моделью процессов Chromium. Вы можете ознакомиться с кратким обзором архитектуры Chrome с помощью <a href=\"https://www.google.com/googlebooks/chrome/\">комикса Chrome</a>, который был выпущен вместе с релизом Chrome в 2008 году. Несмотря на то, что с тех пор прошло более десяти лет, основные принципы, представленные в комиксе, по-прежнему полезны для понимания Electron.</p>\n<h2 id=\"эксперименты-с-electron-fiddle\"><a href=\"#эксперименты-с-electron-fiddle\">Эксперименты с Electron Fiddle</a></h2>\n<p><a href=\"https://electronjs.org/fiddle\">Electron Fiddle</a> - песочница, написанная на Electron и поддерживаемая разработчиками Electron. Мы настоятельно рекомендуем установить его в качестве обучающего инструмента для экспериментов с API-интерфейсами Electron или для создания прототипов функций во время разработки.</p>\n<p>Fiddle также прекрасно интегрируется с нашей документацией. При просмотре примеров в наших учебниках вы часто видите кнопку \"Открыть в Electron Fiddle\" под блоком кода. Если у вас установлен Fiddle эта кнопка откроет <code>, fiddle.electronjs. rg</code> ссылка, которая автоматически загрузит пример в Fiddle, не требуется.</p>\n<h2 id=\"getting-help\"><a href=\"#getting-help\">Getting help</a></h2>\n<p>Вы застряли где-нибудь? Вот несколько ссылок для поиска:</p>\n<ul>\n<li>Если вам нужна помощь в разработке вашего приложения, наше <a href=\"https://discord.gg/electron\">сообщество Discord сервер</a> отличное место для получения советов от других разработчиков приложений Electron.</li>\n<li>Если вы подозреваете, что вы столкнулись с ошибкой в пакете <code>electron</code>, пожалуйста, проверьте на <a href=\"https://github.com/electron/electron/issues\">GitHub issue tracker</a>, чтобы увидеть, соответствуют ли какие-либо проблемы вашей проблеме. Если нет, заполните наш шаблон отчета об ошибке и отправьте новый выпуск.</li>\n</ul>",
      "title": "Введение",
      "description": ""
    },
    "/docs/api/structures/io-counters": {
      "locale": "ru-RU",
      "slug": "io-counters",
      "href": "/docs/api/structures/io-counters",
      "crowdinFileId": "256443",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/io-counters.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"iocounters-object\"><a href=\"#iocounters-object\">IOCounters Object</a></h1>\n<ul>\n<li><code>readOperationCount</code> Number - The number of I/O read operations.</li>\n<li><code>writeOperationCount</code> Number - The number of I/O write operations.</li>\n<li><code>otherOperationCount</code> Number - Then number of I/O other operations.</li>\n<li><code>readTransferCount</code> Number - The number of I/O read transfers.</li>\n<li><code>writeTransferCount</code> Number - The number of I/O write transfers.</li>\n<li><code>otherTransferCount</code> Number - Then number of I/O other transfers.</li>\n</ul>",
      "title": "IOCounters Object",
      "description": ""
    },
    "/docs/api/ipc-main": {
      "locale": "ru-RU",
      "slug": "ipc-main",
      "href": "/docs/api/ipc-main",
      "crowdinFileId": "256329",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/ipc-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmain\"><a href=\"#ipcmain\">ipcMain</a></h1>\n<blockquote>\n<p>Асинхронно взаимодействуйте с процессами рендеринга из главного процесса.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p>Модуль <code>ipcMain</code> представляет собой <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">Event Emitter</a>. При использовании в основном процессе он обрабатывает асинхронные и синхронные сообщения, отправленные из процесса рендеринга (веб-страницы). Сообщения, отправленные из процесса рендеринга, будут направлены в этот модуль.</p>\n<h2 id=\"отправка-сообщений\"><a href=\"#отправка-сообщений\">Отправка сообщений</a></h2>\n<p>Кроме того, существует возможность пересылать сообщения из главного процесса в процессы рендеринга. Более подробно это описано в <a href=\"/docs/api/web-contents#contentssendchannel-args\">webContents.send</a>.</p>\n<ul>\n<li>При отправке сообщения, событие именуется <code>channel</code>.</li>\n<li>Чтобы ответить на синхронное сообщение, нужно задать <code>event.returnValue</code>.</li>\n<li>Чтобы отправить ассинхронное сообщение назад отправителю, используйте <code>event.reply(...)</code>.  Этот вспомогательный метод автоматически обрабатывает сообщения, поступающие из фреймов, которые не являются основным фреймом (например, iframe), в то время как <code>event.sender.send(...)</code> всегда будет посылать в основной фрейм.</li>\n</ul>\n<p>Пример отправки и обработки сообщений между render и main процессами:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// В main процессе.</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'asynchronous-message'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"ping\"</span>\n  event.reply(<span class=\"hljs-string\">'asynchronous-reply'</span>, <span class=\"hljs-string\">'pong'</span>)\n})\n\nipcMain.on(<span class=\"hljs-string\">'synchronous-message'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"ping\"</span>\n  event.returnValue = <span class=\"hljs-string\">'pong'</span>\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// В renderer процессе (web страница).</span>\n<span class=\"hljs-comment\">// NB. Electron APIs are only accessible from preload, unless contextIsolation is disabled.</span>\n<span class=\"hljs-comment\">// See https://www.electronjs.org/docs/tutorial/process-model#preload-scripts for more details.</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(ipcRenderer.sendSync(<span class=\"hljs-string\">'synchronous-message'</span>, <span class=\"hljs-string\">'ping'</span>)) <span class=\"hljs-comment\">// prints \"pong\"</span>\n\nipcRenderer.on(<span class=\"hljs-string\">'asynchronous-reply'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"pong\"</span>\n})\nipcRenderer.send(<span class=\"hljs-string\">'asynchronous-message'</span>, <span class=\"hljs-string\">'ping'</span>)\n</code></pre>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code>ipcMain</code> имеет следующие методы для прослушивая событий:</p>\n<h3 id=\"ipcmainonchannel-listener\"><a href=\"#ipcmainonchannel-listener\"><code>ipcMain.on(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>listener</code> Function (Функция)<ul>\n<li><code>event</code> IpcMainEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Слушает <code>channel</code>, когда приходит новое сообщение <code>listener</code> вызовется с <code>listener(event, args...)</code>.</p>\n<h3 id=\"ipcmainoncechannel-listener\"><a href=\"#ipcmainoncechannel-listener\"><code>ipcMain.once(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>listener</code> Function (Функция)<ul>\n<li><code>event</code> IpcMainEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Adds a one time <code>listener</code> function for the event. This <code>listener</code> is invoked only the next time a message is sent to <code>channel</code>, after which it is removed.</p>\n<h3 id=\"ipcmainremovelistenerchannel-listener\"><a href=\"#ipcmainremovelistenerchannel-listener\"><code>ipcMain.removeListener(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>listener</code> Function (Функция)<ul>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Удаляет указанный <code>listener</code> из массива слушателей конкретного <code>channel</code>.</p>\n<h3 id=\"ipcmainremovealllistenerschannel\"><a href=\"#ipcmainremovealllistenerschannel\"><code>ipcMain.removeAllListeners([channel])</code></a></h3>\n<ul>\n<li><code>channel</code> String (опционально)</li>\n</ul>\n<p>Удаляет всех слушателей <code>channel</code>.</p>\n<h3 id=\"ipcmainhandlechannel-listener\"><a href=\"#ipcmainhandlechannel-listener\"><code>ipcMain.handle(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>listener</code> Function&#x3C;Promise\\<void> | any><ul>\n<li><code>event</code> IpcMainInvokeEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></void></li>\n</ul>\n<p>Adds a handler for an <code>invoke</code>able IPC. This handler will be called whenever a renderer calls <code>ipcRenderer.invoke(channel, ...args)</code>.</p>\n<p>Если <code>listener</code> возвращает Promise, то конечный результат Promise, будет возвращен в качестве ответа удаленному вызывающему объекту. В противном случае, возвращаемое значение слушателя будет использоваться как значение ответа.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\nipcMain.handle(<span class=\"hljs-string\">'my-invokable-ipc'</span>, <span class=\"hljs-keyword\">async</span> (event, ...args) => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> somePromise(...args)\n  <span class=\"hljs-keyword\">return</span> result\n})\n\n<span class=\"hljs-comment\">// Renderer process</span>\n<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> ipcRenderer.invoke(<span class=\"hljs-string\">'my-invokable-ipc'</span>, arg1, arg2)\n  <span class=\"hljs-comment\">// ...</span>\n}\n</code></pre>\n<p><code>event</code>, которое передается обработчику в качестве первого аргумента, такое же, какое передается обычному прослушивателю событий. Оно включает информацию о том, какой WebContents является источником запроса на вызов.</p>\n<p>Errors thrown through <code>handle</code> in the main process are not transparent as they are serialized and only the <code>message</code> property from the original error is provided to the renderer process. Please refer to <a href=\"https://github.com/electron/electron/issues/24427\">#24427</a> for details.</p>\n<h3 id=\"ipcmainhandleoncechannel-listener\"><a href=\"#ipcmainhandleoncechannel-listener\"><code>ipcMain.handleOnce(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>listener</code> Function&#x3C;Promise\\<void> | any><ul>\n<li><code>event</code> IpcMainInvokeEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></void></li>\n</ul>\n<p>Handles a single <code>invoke</code>able IPC message, then removes the listener. See <code>ipcMain.handle(channel, listener)</code>.</p>\n<h3 id=\"ipcmainremovehandlerchannel\"><a href=\"#ipcmainremovehandlerchannel\"><code>ipcMain.removeHandler(channel)</code></a></h3>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n</ul>\n<p>Удаляет обработчик для <code>channel</code>, если он присутствует.</p>\n<h2 id=\"ipcmainevent-object\"><a href=\"#ipcmainevent-object\">IpcMainEvent object</a></h2>\n<p>Документацию для объекта <code>event</code>, передаваемого в <code>callback</code>, можно найти в документации по структуре <a href=\"/docs/api/structures/ipc-main-event\"><code>ipc-main-event</code></a>.</p>\n<h2 id=\"ipcmaininvokeevent-object\"><a href=\"#ipcmaininvokeevent-object\">IpcMainInvokeEvent object</a></h2>\n<p>Документацию по объекту <code>event</code>, переданном обратным вызовом <code>handle</code>, можно найти в документации по структуре <a href=\"/docs/api/structures/ipc-main-invoke-event\"><code>ipc-main-invoke-event</code></a>.</p>",
      "title": "ipcMain",
      "description": "Асинхронно взаимодействуйте с процессами рендеринга из главного процесса."
    },
    "/docs/api/structures/ipc-main-event": {
      "locale": "ru-RU",
      "slug": "ipc-main-event",
      "href": "/docs/api/structures/ipc-main-event",
      "crowdinFileId": "256445",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-main-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmainevent-object-extends-event\"><a href=\"#ipcmainevent-object-extends-event\">IpcMainEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>processId</code> Integer - The internal ID of the renderer process that sent this message</li>\n<li><code>frameId</code> Integer - The ID of the renderer frame that sent this message</li>\n<li><code>returnValue</code> any - Set this to the value to be returned in a synchronous message</li>\n<li><code>sender</code> WebContents - Returns the <code>webContents</code> that sent the message</li>\n<li><code>senderFrame</code> WebFrameMain <em>Readonly</em> - The frame that sent this message</li>\n<li><code>ports</code> MessagePortMain[] - A list of MessagePorts that were transferred with this message</li>\n<li><code>reply</code> Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling.  You should use this method to \"reply\" to the sent message in order to guarantee the reply will go to the correct process and frame.<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>",
      "title": "IpcMainEvent Object extends Event",
      "description": ""
    },
    "/docs/api/structures/ipc-main-invoke-event": {
      "locale": "ru-RU",
      "slug": "ipc-main-invoke-event",
      "href": "/docs/api/structures/ipc-main-invoke-event",
      "crowdinFileId": "256447",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-main-invoke-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmaininvokeevent-object-extends-event\"><a href=\"#ipcmaininvokeevent-object-extends-event\">IpcMainInvokeEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>processId</code> Integer - The internal ID of the renderer process that sent this message</li>\n<li><code>frameId</code> Integer - The ID of the renderer frame that sent this message</li>\n<li><code>sender</code> WebContents - Returns the <code>webContents</code> that sent the message</li>\n<li><code>senderFrame</code> WebFrameMain <em>Readonly</em> - The frame that sent this message</li>\n</ul>",
      "title": "IpcMainInvokeEvent Object extends Event",
      "description": ""
    },
    "/docs/api/ipc-renderer": {
      "locale": "ru-RU",
      "slug": "ipc-renderer",
      "href": "/docs/api/ipc-renderer",
      "crowdinFileId": "256331",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/ipc-renderer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcrenderer\"><a href=\"#ipcrenderer\">ipcRenderer</a></h1>\n<blockquote>\n<p>Асинхронное взаимодействие между процессом визуализации и основным процессом.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#renderer-process\">Графический</a></p>\n<p>Модуль <code>ipcRenderer</code> представляет собой <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>. Он предоставляет несколько методов, чтобы вы могли отправлять синхронные и асинхронные сообщения из процесса визуализации (веб-страницы) в основной процесс. Вы также можете получать ответы от главного процесса.</p>\n<p>Примеры кода смотрите в <a href=\"/docs/api/ipc-main\">ipcMain</a>.</p>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code>ipcRenderer</code> имеет следующие методы для прослушивания событий и отправки сообщений:</p>\n<h3 id=\"ipcrendereronchannel-listener\"><a href=\"#ipcrendereronchannel-listener\"><code>ipcRenderer.on(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>listener</code> Function (Функция)<ul>\n<li><code>event</code> IpcRendererEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Слушает <code>channel</code>, когда приходит новое сообщение <code>listener</code> вызовется с <code>listener(event, args...)</code>.</p>\n<h3 id=\"ipcrendereroncechannel-listener\"><a href=\"#ipcrendereroncechannel-listener\"><code>ipcRenderer.once(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>listener</code> Function (Функция)<ul>\n<li><code>event</code> IpcRendererEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Adds a one time <code>listener</code> function for the event. This <code>listener</code> is invoked only the next time a message is sent to <code>channel</code>, after which it is removed.</p>\n<h3 id=\"ipcrendererremovelistenerchannel-listener\"><a href=\"#ipcrendererremovelistenerchannel-listener\"><code>ipcRenderer.removeListener(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>listener</code> Function (Функция)<ul>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Удаляет указанный <code>listener</code> из массива слушателей конкретного <code>channel</code>.</p>\n<h3 id=\"ipcrendererremovealllistenerschannel\"><a href=\"#ipcrendererremovealllistenerschannel\"><code>ipcRenderer.removeAllListeners(channel)</code></a></h3>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n</ul>\n<p>Удаляет всех слушателей или слушателей из указанного <code>channel</code>.</p>\n<h3 id=\"ipcrenderersendchannel-args\"><a href=\"#ipcrenderersendchannel-args\"><code>ipcRenderer.send(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to the main process via <code>channel</code>, along with arguments. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over Electron's IPC to the main process, as the main process would have no way to decode them. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>Основной процесс обрабатывает его путем прослушивания <code>channel</code> с модулем <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a>.</p>\n<p>If you need to transfer a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> to the main process, use <a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a>.</p>\n<p>If you want to receive a single response from the main process, like the result of a method call, consider using <a href=\"#ipcrendererinvokechannel-args\"><code>ipcRenderer.invoke</code></a>.</p>\n<h3 id=\"ipcrendererinvokechannel-args\"><a href=\"#ipcrendererinvokechannel-args\"><code>ipcRenderer.invoke(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;any></code> - Разрешается с ответом от основного процесса.</p>\n<p>Send a message to the main process via <code>channel</code> and expect a result asynchronously. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over Electron's IPC to the main process, as the main process would have no way to decode them. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>Основной процесс должен прослушивать <code>channel</code> с <a href=\"/docs/api/ipc-main#ipcmainhandlechannel-listener\"><code>ipcMain.handle()</code></a>.</p>\n<p>Например:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.invoke(<span class=\"hljs-string\">'some-name'</span>, someArgument).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">result</span>) =></span> {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// Main process</span>\nipcMain.handle(<span class=\"hljs-string\">'some-name'</span>, <span class=\"hljs-keyword\">async</span> (event, someArgument) => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> doSomeWork(someArgument)\n  <span class=\"hljs-keyword\">return</span> result\n})\n</code></pre>\n<p>If you need to transfer a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> to the main process, use <a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a>.</p>\n<p>If you do not need a response to the message, consider using <a href=\"#ipcrenderersendchannel-args\"><code>ipcRenderer.send</code></a>.</p>\n<h3 id=\"ipcrenderersendsyncchannel-args\"><a href=\"#ipcrenderersendsyncchannel-args\"><code>ipcRenderer.sendSync(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Возвращает <code>any</code> - Значение, отправленное обработчиком <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a>.</p>\n<p>Send a message to the main process via <code>channel</code> and expect a result synchronously. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over Electron's IPC to the main process, as the main process would have no way to decode them. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>Основной процесс обрабатывает его, прослушивая <code>channel</code> с помощью модуля <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a>, и отвечая, установив <code>event.returnValue</code>.</p>\n<blockquote>\n<p>⚠️ <strong>WARNING</strong>: Sending a synchronous message will block the whole renderer process until the reply is received, so use this method only as a last resort. It's much better to use the asynchronous version, <a href=\"/docs/api/ipc-renderer#ipcrendererinvokechannel-args\"><code>invoke()</code></a>.</p>\n</blockquote>\n<h3 id=\"ipcrendererpostmessagechannel-message-transfer\"><a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage(channel, message, [transfer])</code></a></h3>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePort<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Send a message to the main process, optionally transferring ownership of zero or more <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> objects.</p>\n<p>The transferred <code>MessagePort</code> objects will be available in the main process as <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> objects by accessing the <code>ports</code> property of the emitted event.</p>\n<p>Например:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Renderer process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannel()\nipcRenderer.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Main process</span>\nipcMain.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<p>For more information on using <code>MessagePort</code> and <code>MessageChannel</code>, see the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\">MDN documentation</a>.</p>\n<h3 id=\"ipcrenderersendtowebcontentsid-channel-args\"><a href=\"#ipcrenderersendtowebcontentsid-channel-args\"><code>ipcRenderer.sendTo(webContentsId, channel, ...args)</code></a></h3>\n<ul>\n<li><code>webContentsId</code> Number</li>\n<li><code>channel</code> String (Строка)</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Отправляет сообщение в окно с помощью <code>webContentsId</code> через <code>channel</code>.</p>\n<h3 id=\"ipcrenderersendtohostchannel-args\"><a href=\"#ipcrenderersendtohostchannel-args\"><code>ipcRenderer.sendToHost(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Как <code>ipcRenderer.send</code>, но событие будет отправлено в элемент <code>&#x3C;webview></code> на главной странице вместо основного процесса.</p>\n<h2 id=\"объект-события\"><a href=\"#объект-события\">Объект события</a></h2>\n<p>Документацию для объекта <code>event</code>, передаваемого в <code>callback</code>, можно найти в документации по структуре <a href=\"/docs/api/structures/ipc-renderer-event\"><code>ipc-renderer-event</code></a>.</p>",
      "title": "ipcRenderer",
      "description": "Асинхронное взаимодействие между процессом визуализации и основным процессом."
    },
    "/docs/api/structures/ipc-renderer-event": {
      "locale": "ru-RU",
      "slug": "ipc-renderer-event",
      "href": "/docs/api/structures/ipc-renderer-event",
      "crowdinFileId": "256449",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-renderer-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcrendererevent-object-extends-event\"><a href=\"#ipcrendererevent-object-extends-event\">IpcRendererEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>sender</code> IpcRenderer - The <code>IpcRenderer</code> instance that emitted the event originally</li>\n<li><code>senderId</code> Integer - The <code>webContents.id</code> that sent the message, you can call <code>event.sender.sendTo(event.senderId, ...)</code> to reply to the message, see <a href=\"/docs/api/ipc-renderer#ipcrenderersendtowebcontentsid-channel-args\">ipcRenderer.sendTo</a> for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set <code>event.senderId</code> to <code>0</code>.</li>\n<li><code>ports</code> MessagePort[] - A list of MessagePorts that were transferred with this message</li>\n</ul>",
      "title": "IpcRendererEvent Object extends Event",
      "description": ""
    },
    "/docs/development/issues": {
      "locale": "ru-RU",
      "slug": "issues",
      "href": "/docs/development/issues",
      "crowdinFileId": "256159",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/issues.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"задачи-в-electron\"><a href=\"#задачи-в-electron\">Задачи в Electron</a></h1>\n<ul>\n<li><a href=\"#how-to-contribute-to-issues\">Как внести свой вклад в проблемы</a></li>\n<li><a href=\"#asking-for-general-help\">Просьба об общей помощи</a></li>\n<li><a href=\"#submitting-a-bug-report\">Отправить отчет об ошибке</a></li>\n<li><a href=\"#triaging-a-bug-report\">Прохождение сообщения об ошибке</a></li>\n<li><a href=\"#resolving-a-bug-report\">Разрешение отчета об ошибке</a></li>\n</ul>\n<h2 id=\"как-внести-свой-вклад-в-проблемы\"><a href=\"#как-внести-свой-вклад-в-проблемы\">Как внести свой вклад в проблемы</a></h2>\n<p>Для любого вопроса есть три основных способа, которыми человек может сделать вклад:</p>\n<ol>\n<li>Открыть issue для обсуждения: если Вы считаете, что нашли новый баг в Electron, сообщите об этом, заведя issue в <a href=\"https://github.com/electron/electron/issues\"><code>electron/electron</code> issue tracker</a>.</li>\n<li>Помочь воспроизвести проблему: Вы можете сделать это либо предоставив вспомогательную информацию (воспроизводимый тестовый случай, который демонстрирует ошибку), либо предложив решить проблему.</li>\n<li>Помочь решить проблему: это можно сделать, продемонстрировав что проблема не является ошибкой или исправлена; но чаще, открыв запрос на слияние, который изменяет исходник в <code>electron/electron</code> в конкретный и рецензируемый способ.</li>\n</ol>\n<h2 id=\"просьба-об-общей-помощи\"><a href=\"#просьба-об-общей-помощи\">Просьба об общей помощи</a></h2>\n<p><a href=\"/docs/tutorial/support#finding-support\">\"Finding Support\"</a> имеет список ресурсов для получения помощи по программированию, сообщения о проблемах безопасности, и многое другое. Пожалуйста, используйте трекер ошибок только для ошибок!</p>\n<h2 id=\"отправить-отчет-об-ошибке\"><a href=\"#отправить-отчет-об-ошибке\">Отправить отчет об ошибке</a></h2>\n<p>Чтобы сообщить об ошибке:</p>\n<p>When opening a new issue in the <a href=\"https://github.com/electron/electron/issues/new/choose\"><code>electron/electron</code> issue tracker</a>, users will be presented with a template that should be filled in.</p>\n<p>If you believe that you have found a bug in Electron, please fill out the template to the best of your ability.</p>\n<p>Двумя наиболее важными частями информации, необходимой для оценки отчета, являются описание ошибки и простой тестовый случай для его создания. Легче исправить ошибку, если она может быть воспроизведена.</p>\n<p>Смотрите <a href=\"https://stackoverflow.com/help/mcve\">Как создать минимальный, завершенный и проверяемый пример</a>.</p>\n<h2 id=\"прохождение-сообщения-об-ошибке\"><a href=\"#прохождение-сообщения-об-ошибке\">Прохождение сообщения об ошибке</a></h2>\n<p>Чаще всего открытые вопросы могут включать в себя обсуждение. Некоторые участники могут иметь различные мнения, в том числе, является ли поведение ошибкой или функцией. Эта дискуссия является частью процесса и должна быть целенаправленной, полезной, и профессиональной.</p>\n<p>Краткие ответы, которые не предоставляют ни дополнительного контекста, ни вспомогательных деталей не полезны или не профессиональны. Многих такие ответы раздражают и не дружественны.</p>\n<p>Contributors are encouraged to solve issues collaboratively and help one another make progress. If you encounter an issue that you feel is invalid, or which contains incorrect information, explain <em>why</em> you feel that way with additional supporting context, and be willing to be convinced that you may be wrong. При этом мы часто можем достичь правильного результата быстрее.</p>\n<h2 id=\"разрешение-отчета-об-ошибке\"><a href=\"#разрешение-отчета-об-ошибке\">Разрешение отчета об ошибке</a></h2>\n<p>Большинство проблем решается путем открытия pull-запроса. The process for opening and reviewing a pull request is similar to that of opening and triaging issues, but carries with it a necessary review and approval workflow that ensures that the proposed changes meet the minimal quality and functional guidelines of the Electron project.</p>",
      "title": "Задачи в Electron",
      "description": ""
    },
    "/docs/api/structures/jump-list-category": {
      "locale": "ru-RU",
      "slug": "jump-list-category",
      "href": "/docs/api/structures/jump-list-category",
      "crowdinFileId": "256451",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/jump-list-category.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"jumplistcategory-object\"><a href=\"#jumplistcategory-object\">JumpListCategory Object</a></h1>\n<ul>\n<li><code>type</code> String (optional) - One of the following:<ul>\n<li><code>tasks</code> - Items in this category will be placed into the standard <code>Tasks</code> category. There can be only one such category, and it will always be displayed at the bottom of the Jump List.</li>\n<li><code>frequent</code> - Displays a list of files frequently opened by the app, the name of the category and its items are set by Windows.</li>\n<li><code>recent</code> - Displays a list of files recently opened by the app, the name of the category and its items are set by Windows. Items may be added to this category indirectly using <code>app.addRecentDocument(path)</code>.</li>\n<li><code>custom</code> - Displays tasks or file links, <code>name</code> must be set by the app.</li>\n</ul></li>\n<li><code>name</code> String (optional) - Must be set if <code>type</code> is <code>custom</code>, otherwise it should be omitted.</li>\n<li><code>items</code> JumpListItem<a href=\"/docs/api/structures/optional\"></a> - Array of <a href=\"/docs/api/structures/jump-list-item\"><code>JumpListItem</code></a> objects if <code>type</code> is <code>tasks</code> or <code>custom</code>, otherwise it should be omitted.</li>\n</ul>\n<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>\n<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>",
      "title": "JumpListCategory Object",
      "description": ""
    },
    "/docs/api/structures/jump-list-item": {
      "locale": "ru-RU",
      "slug": "jump-list-item",
      "href": "/docs/api/structures/jump-list-item",
      "crowdinFileId": "256453",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/jump-list-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"jumplistitem-object\"><a href=\"#jumplistitem-object\">JumpListItem Object</a></h1>\n<ul>\n<li><code>type</code> String (optional) - One of the following:<ul>\n<li><code>task</code> - A task will launch an app with specific arguments.</li>\n<li><code>separator</code> - Can be used to separate items in the standard <code>Tasks</code> category.</li>\n<li><code>file</code> - A file link will open a file using the app that created the Jump List, for this to work the app must be registered as a handler for the file type (though it doesn't have to be the default handler).</li>\n</ul></li>\n<li><code>path</code> String (optional) - Path of the file to open, should only be set if <code>type</code> is <code>file</code>.</li>\n<li><code>program</code> String (optional) - Path of the program to execute, usually you should specify <code>process.execPath</code> which opens the current program. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>args</code> String (optional) - The command line arguments when <code>program</code> is executed. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>title</code> String (optional) - The text to be displayed for the item in the Jump List. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>description</code> String (optional) - Description of the task (displayed in a tooltip). Should only be set if <code>type</code> is <code>task</code>. Maximum length 260 characters.</li>\n<li><code>iconPath</code> String (optional) - The absolute path to an icon to be displayed in a Jump List, which can be an arbitrary resource file that contains an icon (e.g. <code>.ico</code>, <code>.exe</code>, <code>.dll</code>). You can usually specify <code>process.execPath</code> to show the program icon.</li>\n<li><code>iconIndex</code> Number (optional) - The index of the icon in the resource file. If a resource file contains multiple icons this value can be used to specify the zero-based index of the icon that should be displayed for this task. If a resource file contains only one icon, this property should be set to zero.</li>\n<li><code>workingDirectory</code> String (optional) - The working directory. Default is empty.</li>\n</ul>",
      "title": "JumpListItem Object",
      "description": ""
    },
    "/docs/api/structures/keyboard-event": {
      "locale": "ru-RU",
      "slug": "keyboard-event",
      "href": "/docs/api/structures/keyboard-event",
      "crowdinFileId": "256455",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/keyboard-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"keyboardevent-object\"><a href=\"#keyboardevent-object\">KeyboardEvent Object</a></h1>\n<ul>\n<li><code>ctrlKey</code> Boolean (optional) - whether the Control key was used in an accelerator to trigger the Event</li>\n<li><code>metaKey</code> Boolean (optional) - whether a meta key was used in an accelerator to trigger the Event</li>\n<li><code>shiftKey</code> Boolean (optional) - whether a Shift key was used in an accelerator to trigger the Event</li>\n<li><code>altKey</code> Boolean (optional) - whether an Alt key was used in an accelerator to trigger the Event</li>\n<li><code>triggeredByAccelerator</code> Boolean (optional) - whether an accelerator was used to trigger the event as opposed to another user gesture like mouse click</li>\n</ul>",
      "title": "KeyboardEvent Object",
      "description": ""
    },
    "/docs/api/structures/keyboard-input-event": {
      "locale": "ru-RU",
      "slug": "keyboard-input-event",
      "href": "/docs/api/structures/keyboard-input-event",
      "crowdinFileId": "256457",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/keyboard-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"keyboardinputevent-object-extends-inputevent\"><a href=\"#keyboardinputevent-object-extends-inputevent\">KeyboardInputEvent Object extends <code>InputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>keyDown</code>, <code>keyUp</code> or <code>char</code>.</li>\n<li><code>keyCode</code> String - The character that will be sent as the keyboard event. Should only use the valid key codes in <a href=\"/docs/api/accelerator\">Accelerator</a>.</li>\n</ul>",
      "title": "KeyboardInputEvent Object extends InputEvent",
      "description": ""
    },
    "/docs/tutorial/keyboard-shortcuts": {
      "locale": "ru-RU",
      "slug": "keyboard-shortcuts",
      "href": "/docs/tutorial/keyboard-shortcuts",
      "crowdinFileId": "256209",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/keyboard-shortcuts.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"горячие-клавиши\"><a href=\"#горячие-клавиши\">Горячие клавиши</a></h1>\n<h2 id=\"обзор\"><a href=\"#обзор\">Обзор</a></h2>\n<p>Эта функция позволяет настроить локальные и глобальные сочетания клавиш для приложения Electron.</p>\n<h2 id=\"пример\"><a href=\"#пример\">Пример</a></h2>\n<h3 id=\"локальные-горячие-клавиши\"><a href=\"#локальные-горячие-клавиши\">Локальные горячие клавиши</a></h3>\n<p>Local keyboard shortcuts are triggered only when the application is focused. To configure a local keyboard shortcut, you need to specify an <a href=\"/docs/api/accelerator\"><code>accelerator</code></a> property when creating a <a href=\"/docs/api/menu-item\">MenuItem</a> within the <a href=\"/docs/api/menu\">Menu</a> module.</p>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/local\"><span class=\"hljs-keyword\">const</span> { Menu, MenuItem } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> menu = <span class=\"hljs-keyword\">new</span> Menu()\nmenu.append(<span class=\"hljs-keyword\">new</span> MenuItem({\n  <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Electron'</span>,\n  <span class=\"hljs-attr\">submenu</span>: [{\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'help'</span>,\n    <span class=\"hljs-attr\">accelerator</span>: process.platform === <span class=\"hljs-string\">'darwin'</span> ? <span class=\"hljs-string\">'Alt+Cmd+I'</span> : <span class=\"hljs-string\">'Alt+Shift+I'</span>,\n    <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Electron rocks!'</span>) }\n  }]\n}))\n\nMenu.setApplicationMenu(menu)\n</code></pre>\n<blockquote>\n<p>NOTE: In the code above, you can see that the accelerator differs based on the user's operating system. For MacOS, it is <code>Alt+Cmd+I</code>, whereas for Linux and Windows, it is <code>Alt+Shift+I</code>.</p>\n</blockquote>\n<p>After launching the Electron application, you should see the application menu along with the local shortcut you just defined:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/local-shortcut.png\" alt=\"Menu with a local shortcut\"></p>\n<p>If you click <code>Help</code> or press the defined accelerator and then open the terminal that you ran your Electron application from, you will see the message that was generated after triggering the <code>click</code> event: \"Electron rocks!\".</p>\n<h3 id=\"глобальные-сочетания-клавиш\"><a href=\"#глобальные-сочетания-клавиш\">Глобальные сочетания клавиш</a></h3>\n<p>To configure a global keyboard shortcut, you need to use the <a href=\"/docs/api/global-shortcut\">globalShortcut</a> module to detect keyboard events even when the application does not have keyboard focus.</p>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/global\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  globalShortcut.register(<span class=\"hljs-string\">'Alt+CommandOrControl+I'</span>, () => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Electron loves global shortcuts!'</span>)\n  })\n}).then(createWindow)\n</code></pre>\n<blockquote>\n<p>NOTE: In the code above, the <code>CommandOrControl</code> combination uses <code>Command</code> on macOS and <code>Control</code> on Windows/Linux.</p>\n</blockquote>\n<p>After launching the Electron application, if you press the defined key combination then open the terminal that you ran your Electron application from, you will see that Electron loves global shortcuts!</p>\n<h3 id=\"горячие-клавиши-в-browserwindow\"><a href=\"#горячие-клавиши-в-browserwindow\">Горячие клавиши в BrowserWindow</a></h3>\n<h4 id=\"using-web-apis\"><a href=\"#using-web-apis\">Using web APIs</a></h4>\n<p>If you want to handle keyboard shortcuts within a <a href=\"/docs/api/browser-window\">BrowserWindow</a>, you can listen for the <code>keyup</code> and <code>keydown</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/Events\">DOM events</a> inside the renderer process using the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\">addEventListener() API</a>.</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/web-apis\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleKeyPress</span>(<span class=\"hljs-params\">event</span>) </span>{\n  <span class=\"hljs-comment\">// You can put code here to handle the keypress.</span>\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">\"last-keypress\"</span>).innerText = event.key;\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`You pressed <span class=\"hljs-subst\">${event.key}</span>`</span>);\n}\n\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'keyup'</span>, handleKeyPress, <span class=\"hljs-literal\">true</span>);\n</code></pre>\n<blockquote>\n<p>Note:  the third parameter <code>true</code> indicates that the listener will always receive key presses before other listeners so they can't have <code>stopPropagation()</code> called on them.</p>\n</blockquote>\n<h4 id=\"intercepting-events-in-the-main-process\"><a href=\"#intercepting-events-in-the-main-process\">Intercepting events in the main process</a></h4>\n<p>Событие <a href=\"/docs/api/web-contents#event-before-input-event\"><code>before-input-event</code></a> генерируется перед отправкой событий <code>keydown</code> и <code>keyup</code> на странице. It can be used to catch and handle custom shortcuts that are not visible in the menu.</p>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/interception-from-main\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n  win.webContents.on(<span class=\"hljs-string\">'before-input-event'</span>, (event, input) => {\n    <span class=\"hljs-keyword\">if</span> (input.control &#x26;&#x26; input.key.toLowerCase() === <span class=\"hljs-string\">'i'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Pressed Control+I'</span>)\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<p>After launching the Electron application, if you open the terminal that you ran your Electron application from and press <code>Ctrl+I</code> key combination, you will see that this key combination was successfully intercepted.</p>\n<h4 id=\"using-third-party-libraries\"><a href=\"#using-third-party-libraries\">Using third-party libraries</a></h4>\n<p>If you don't want to do manual shortcut parsing, there are libraries that do advanced key detection, such as <a href=\"https://github.com/ccampbell/mousetrap\">mousetrap</a>. Below are examples of usage of the <code>mousetrap</code> running in the Renderer process:</p>\n<pre><code class=\"hljs language-js\">Mousetrap.bind(<span class=\"hljs-string\">'4'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'4'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'?'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'show shortcuts!'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'esc'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'escape'</span>) }, <span class=\"hljs-string\">'keyup'</span>)\n\n<span class=\"hljs-comment\">// combinations</span>\nMousetrap.bind(<span class=\"hljs-string\">'command+shift+k'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'command shift k'</span>) })\n\n<span class=\"hljs-comment\">// map multiple combinations to the same callback</span>\nMousetrap.bind([<span class=\"hljs-string\">'command+k'</span>, <span class=\"hljs-string\">'ctrl+k'</span>], () => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'command k or control k'</span>)\n\n  <span class=\"hljs-comment\">// return false to prevent default behavior and stop event from bubbling</span>\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n\n<span class=\"hljs-comment\">// gmail style sequences</span>\nMousetrap.bind(<span class=\"hljs-string\">'g i'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'go to inbox'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'* a'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'select all'</span>) })\n\n<span class=\"hljs-comment\">// konami code!</span>\nMousetrap.bind(<span class=\"hljs-string\">'up up down down left right left right b a enter'</span>, () => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'konami code'</span>)\n})\n</code></pre>",
      "title": "Горячие клавиши",
      "description": "NOTE: In the code above, you can see that the accelerator differs based on the user's operating system. For MacOS, it is Alt+Cmd+I, whereas for Linux and Windows, it is Alt+Shift+I."
    },
    "/docs/tutorial/launch-app-from-url-in-another-app": {
      "locale": "ru-RU",
      "slug": "launch-app-from-url-in-another-app",
      "href": "/docs/tutorial/launch-app-from-url-in-another-app",
      "crowdinFileId": "256211",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/launch-app-from-url-in-another-app.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<hr>\n<p>title: Launching Your Electron App From a URL In Another App\ndescription: This guide will take you through the process of setting your electron app as the default handler for a specific protocol.\nslug: launch-app-from-url-in-another-app</p>\n<h2 id=\"hide_title-true\"><a href=\"#hide_title-true\">hide_title: true</a></h2>\n<h1 id=\"launching-your-electron-app-from-a-url-in-another-app\"><a href=\"#launching-your-electron-app-from-a-url-in-another-app\">Launching Your Electron App From A URL In Another App</a></h1>\n<h2 id=\"обзор\"><a href=\"#обзор\">Обзор</a></h2>\n<!-- ✍ Update this section if you want to provide more details -->\n<p>This guide will take you through the process of setting your Electron app as the default handler for a specific <a href=\"https://www.electronjs.org/docs/api/protocol\">protocol</a>.</p>\n<p>By the end of this tutorial, we will have set our app to intercept and handle any clicked URLs that start with a specific protocol. In this guide, the protocol we will use will be \"<code>electron-fiddle://</code>\".</p>\n<h2 id=\"примеры\"><a href=\"#примеры\">Примеры</a></h2>\n<h3 id=\"main-process-mainjs\"><a href=\"#main-process-mainjs\">Main Process (main.js)</a></h3>\n<p>First, we will import the required modules from <code>electron</code>. These modules help control our application lifecycle and create a native browser window.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n</code></pre>\n<p>Next, we will proceed to register our application to handle all \"<code>electron-fiddle://</code>\" protocols.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">if</span> (process.defaultApp) {\n  <span class=\"hljs-keyword\">if</span> (process.argv.length >= <span class=\"hljs-number\">2</span>) {\n    app.setAsDefaultProtocolClient(<span class=\"hljs-string\">'electron-fiddle'</span>, process.execPath, [path.resolve(process.argv[<span class=\"hljs-number\">1</span>])])\n  }\n} <span class=\"hljs-keyword\">else</span> {\n  app.setAsDefaultProtocolClient(<span class=\"hljs-string\">'electron-fiddle'</span>)\n}\n</code></pre>\n<p>We will now define the function in charge of creating our browser window and load our application's <code>index.html</code> file.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> createWindow = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Create the browser window.</span>\n  mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  mainWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n</code></pre>\n<p>In this next step, we will create our  <code>BrowserWindow</code> and tell our application how to handle an event in which an external protocol is clicked.</p>\n<p>This code will be different in Windows compared to MacOS and Linux. This is due to Windows requiring additional code in order to open the contents of the protocol link within the same Electron instance. Read more about this <a href=\"https://www.electronjs.org/docs/api/app#apprequestsingleinstancelock\">here</a>.</p>\n<h4 id=\"windows-code\"><a href=\"#windows-code\">Windows code:</a></h4>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> gotTheLock = app.requestSingleInstanceLock()\n\n<span class=\"hljs-keyword\">if</span> (!gotTheLock) {\n  app.quit()\n} <span class=\"hljs-keyword\">else</span> {\n  app.on(<span class=\"hljs-string\">'second-instance'</span>, (event, commandLine, workingDirectory) => {\n    <span class=\"hljs-comment\">// Someone tried to run a second instance, we should focus our window.</span>\n    <span class=\"hljs-keyword\">if</span> (mainWindow) {\n      <span class=\"hljs-keyword\">if</span> (mainWindow.isMinimized()) mainWindow.restore()\n      mainWindow.focus()\n    }\n  })\n\n  <span class=\"hljs-comment\">// Create mainWindow, load the rest of the app, etc...</span>\n  app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    createWindow()\n  })\n\n  <span class=\"hljs-comment\">// Handle the protocol. In this case, we choose to show an Error Box.</span>\n  app.on(<span class=\"hljs-string\">'open-url'</span>, (event, url) => {\n    dialog.showErrorBox(<span class=\"hljs-string\">'Welcome Back'</span>, <span class=\"hljs-string\">`You arrived from: <span class=\"hljs-subst\">${url}</span>`</span>)\n  })\n}\n</code></pre>\n<h4 id=\"macos-and-linux-code\"><a href=\"#macos-and-linux-code\">MacOS and Linux code:</a></h4>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// This method will be called when Electron has finished</span>\n<span class=\"hljs-comment\">// initialization and is ready to create browser windows.</span>\n<span class=\"hljs-comment\">// Некоторые интерфейсы API могут использоваться только после возникновения этого события.</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n})\n\n<span class=\"hljs-comment\">// Handle the protocol. In this case, we choose to show an Error Box.</span>\napp.on(<span class=\"hljs-string\">'open-url'</span>, (event, url) => {\n  dialog.showErrorBox(<span class=\"hljs-string\">'Welcome Back'</span>, <span class=\"hljs-string\">`You arrived from: <span class=\"hljs-subst\">${url}</span>`</span>)\n})\n</code></pre>\n<p>Finally, we will add some additional code to handle when someone closes our application.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Quit when all windows are closed, except on macOS. There, it's common</span>\n<span class=\"hljs-comment\">// for applications and their menu bar to stay active until the user quits</span>\n<span class=\"hljs-comment\">// explicitly with Cmd + Q.</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h2 id=\"important-notes\"><a href=\"#important-notes\">Important notes</a></h2>\n<h3 id=\"упаковка\"><a href=\"#упаковка\">Упаковка</a></h3>\n<p>On macOS and Linux, this feature will only work when your app is packaged. It will not work when you're launching it in development from the command-line. When you package your app you'll need to make sure the macOS <code>Info.plist</code> and the Linux <code>.desktop</code> files for the app are updated to include the new protocol handler. Some of the Electron tools for bundling and distributing apps handle this for you.</p>\n<h4 id=\"electron-forge\"><a href=\"#electron-forge\"></a><a href=\"https://electronforge.io\">Electron Forge</a></h4>\n<p>If you're using Electron Forge, adjust <code>packagerConfig</code> for macOS support, and the configuration for the appropriate Linux makers for Linux support, in your <a href=\"https://www.electronforge.io/configuration\">Forge configuration</a> <em>(please note the following example only shows the bare minimum needed to add the configuration changes)</em>:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"config\"</span>: {\n    <span class=\"hljs-attr\">\"forge\"</span>: {\n      <span class=\"hljs-attr\">\"packagerConfig\"</span>: {\n        <span class=\"hljs-attr\">\"protocols\"</span>: [\n          {\n            <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"Electron Fiddle\"</span>,\n            <span class=\"hljs-attr\">\"schemes\"</span>: [<span class=\"hljs-string\">\"electron-fiddle\"</span>]\n          }\n        ]\n      },\n      <span class=\"hljs-attr\">\"makers\"</span>: [\n        {\n          <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"@electron-forge/maker-deb\"</span>,\n          <span class=\"hljs-attr\">\"config\"</span>: {\n            <span class=\"hljs-attr\">\"mimeType\"</span>: [<span class=\"hljs-string\">\"x-scheme-handler/electron-fiddle\"</span>]\n          }\n        }\n      ]\n    }\n  }\n}\n</code></pre>\n<h4 id=\"electron-packager\"><a href=\"#electron-packager\"></a><a href=\"https://github.com/electron/electron-packager\">Electron Packager</a></h4>\n<p>For macOS support:</p>\n<p>If you're using Electron Packager's API, adding support for protocol handlers is similar to how Electron Forge is handled, except <code>protocols</code> is part of the Packager options passed to the <code>packager</code> function.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> packager = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-packager'</span>)\n\npackager({\n  <span class=\"hljs-comment\">// ...other options...</span>\n  <span class=\"hljs-attr\">protocols</span>: [\n    {\n      <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Electron Fiddle'</span>,\n      <span class=\"hljs-attr\">schemes</span>: [<span class=\"hljs-string\">'electron-fiddle'</span>]\n    }\n  ]\n\n}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">paths</span> =></span> <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`SUCCESS: Created <span class=\"hljs-subst\">${paths.join(<span class=\"hljs-string\">', '</span>)}</span>`</span>))\n  .catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">`ERROR: <span class=\"hljs-subst\">${err.message}</span>`</span>))\n</code></pre>\n<p>If you're using Electron Packager's CLI, use the <code>--protocol</code> and <code>--protocol-name</code> flags. For example:</p>\n<pre><code class=\"hljs language-shell\">npx electron-packager . --protocol=electron-fiddle --protocol-name=\"Electron Fiddle\"\n</code></pre>\n<h2 id=\"conclusion\"><a href=\"#conclusion\">Conclusion</a></h2>\n<p>After you start your Electron app, you can enter in a URL in your browser that contains the custom protocol, for example <code>\"electron-fiddle://open\"</code> and observe that the application will respond and show an error dialog box.</p>\n<!--\n    Because Electron examples usually require multiple files (HTML, CSS, JS\n    for the main and renderer process, etc.), we use this custom code block\n    for Fiddle (https://www.electronjs.org/fiddle).\n    Please modify any of the files in the referenced folder to fit your\n    example.\n    The content in this codeblock will not be rendered in the website so you\n    can leave it empty.\n-->\n<!-- ✍ Explanation of the code below -->",
      "title": "Launching Your Electron App From A URL In Another App",
      "description": ""
    },
    "/docs/tutorial/linux-desktop-actions": {
      "locale": "ru-RU",
      "slug": "linux-desktop-actions",
      "href": "/docs/tutorial/linux-desktop-actions",
      "crowdinFileId": "256213",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/linux-desktop-actions.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktop-launcher-actions-linux\"><a href=\"#desktop-launcher-actions-linux\">Desktop Launcher Actions (Linux)</a></h1>\n<h2 id=\"обзор\"><a href=\"#обзор\">Обзор</a></h2>\n<p>On many Linux environments, you can add custom entries to the system launcher by modifying the <code>.desktop</code> file. For Canonical's Unity documentation, see <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Adding Shortcuts to a Launcher</a>. For details on a more generic implementation, see the <a href=\"https://specifications.freedesktop.org/desktop-entry-spec/1.1/ar01s11.html\">freedesktop.org Specification</a>.</p>\n<p><img src=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles?action=AttachFile&#x26;do=get&#x26;target=shortcuts.png\" alt=\"audacious\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example of launcher shortcuts in Audacious audio player</p>\n</blockquote>\n<p>To create a shortcut, you need to provide <code>Name</code> and <code>Exec</code> properties for the entry you want to add to the shortcut menu. Unity will execute the command defined in the <code>Exec</code> field after the user clicked the shortcut menu item. An example of the <code>.desktop</code> file may look as follows:</p>\n<pre><code class=\"hljs language-plaintext\">Actions=PlayPause;Next;Previous\n\n[Desktop Action PlayPause]\nName=Play-Pause\nExec=audacious -t\nOnlyShowIn=Unity;\n\n[Desktop Action Next]\nName=Next\nExec=audacious -f\nOnlyShowIn=Unity;\n\n[Desktop Action Previous]\nName=Previous\nExec=audacious -r\nOnlyShowIn=Unity;\n</code></pre>\n<p>The preferred way for Unity to instruct your application on what to do is using parameters. You can find them in your application in the global variable <code>process.argv</code>.</p>",
      "title": "Desktop Launcher Actions (Linux)",
      "description": "NOTE: The screenshot above is an example of launcher shortcuts in Audacious audio player"
    },
    "/docs/tutorial/mac-app-store-submission-guide": {
      "locale": "ru-RU",
      "slug": "mac-app-store-submission-guide",
      "href": "/docs/tutorial/mac-app-store-submission-guide",
      "crowdinFileId": "256215",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/mac-app-store-submission-guide.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"руководство-по-распространению-с-помощью-mac-app-store\"><a href=\"#руководство-по-распространению-с-помощью-mac-app-store\">Руководство по распространению с помощью Mac App Store</a></h1>\n<p>This guide provides information on:</p>\n<ul>\n<li>How to sign Electron apps on macOS;</li>\n<li>How to submit Electron apps to Mac App Store (MAS);</li>\n<li>The limitations of the MAS build.</li>\n</ul>\n<h2 id=\"требования\"><a href=\"#требования\">Требования</a></h2>\n<p>To sign Electron apps, the following tools must be installed first:</p>\n<ul>\n<li>Xcode 11 or above.</li>\n<li>The <a href=\"https://github.com/electron/electron-osx-sign\">electron-osx-sign</a> npm module.</li>\n</ul>\n<p>You also have to register an Apple Developer account and join the <a href=\"https://developer.apple.com/support/compare-memberships/\">Apple Developer Program</a>.</p>\n<h2 id=\"sign-electron-apps\"><a href=\"#sign-electron-apps\">Sign Electron apps</a></h2>\n<p>Electron apps can be distributed through Mac App Store or outside it. Each way requires different ways of signing and testing. This guide focuses on distribution via Mac App Store, but will also mention other methods.</p>\n<p>The following steps describe how to get the certificates from Apple, how to sign Electron apps, and how to test them.</p>\n<h3 id=\"get-certificates\"><a href=\"#get-certificates\">Get certificates</a></h3>\n<p>The simplest way to get signing certificates is to use Xcode:</p>\n<ol>\n<li>Open Xcode and open \"Accounts\" preferences;</li>\n<li>Sign in with your Apple account;</li>\n<li>Select a team and click \"Manage Certificates\";</li>\n<li>In the lower-left corner of the signing certificates sheet, click the Add button (+), and add following certificates:<ul>\n<li>\"Apple Development\"</li>\n<li>\"Apple Distribution\"</li>\n</ul></li>\n</ol>\n<p>The \"Apple Development\" certificate is used to sign apps for development and testing, on machines that have been registered on Apple Developer website. The method of registration will be described in <a href=\"#prepare-provisioning-profile\">Prepare provisioning profile</a>.</p>\n<p>Apps signed with the \"Apple Development\" certificate cannot be submitted to Mac App Store. For that purpose, apps must be signed with the \"Apple Distribution\" certificate instead. But note that apps signed with the \"Apple Distribution\" certificate cannot run directly, they must be re-signed by Apple to be able to run, which will only be possible after being downloaded from the Mac App Store.</p>\n<h4 id=\"other-certificates\"><a href=\"#other-certificates\">Other certificates</a></h4>\n<p>You may notice that there are also other kinds of certificates.</p>\n<p>The \"Developer ID Application\" certificate is used to sign apps before distributing them outside the Mac App Store.</p>\n<p>The \"Developer ID Installer\" and \"Mac Installer Distribution\" certificates are used to sign the Mac Installer Package instead of the app itself. Most Electron apps do not use Mac Installer Package so they are generally not needed.</p>\n<p>The full list of certificate types can be found <a href=\"https://help.apple.com/xcode/mac/current/#/dev80c6204ec\">here</a>.</p>\n<p>Apps signed with \"Apple Development\" and \"Apple Distribution\" certificates can only run under <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandbox</a>, so they must use the MAS build of Electron. However, the \"Developer ID Application\" certificate does not have this restrictions, so apps signed with it can use either the normal build or the MAS build of Electron.</p>\n<h4 id=\"legacy-certificate-names\"><a href=\"#legacy-certificate-names\">Legacy certificate names</a></h4>\n<p>Apple has been changing the names of certificates during past years, you might encounter them when reading old documentations, and some utilities are still using one of the old names.</p>\n<ul>\n<li>The \"Apple Distribution\" certificate was also named as \"3rd Party Mac Developer Application\" and \"Mac App Distribution\".</li>\n<li>The \"Apple Development\" certificate was also named as \"Mac Developer\" and \"Development\".</li>\n</ul>\n<h3 id=\"prepare-provisioning-profile\"><a href=\"#prepare-provisioning-profile\">Prepare provisioning profile</a></h3>\n<p>If you want to test your app on your local machine before submitting your app to the Mac App Store, you have to sign the app with the \"Apple Development\" certificate with the provisioning profile embedded in the app bundle.</p>\n<p>To <a href=\"https://help.apple.com/developer-account/#/devf2eb157f8\">create a provisioning profile</a>, you can follow the below steps:</p>\n<ol>\n<li>Open the \"Certificates, Identifiers &#x26; Profiles\" page on the <a href=\"https://developer.apple.com/account\">Apple Developer</a> website.</li>\n<li>Add a new App ID for your app in the \"Identifiers\" page.</li>\n<li>Register your local machine in the \"Devices\" page. You can find your machine's \"Device ID\" in the \"Hardware\" page of the \"System Information\" app.</li>\n<li>Register a new Provisioning Profile in the \"Profiles\" page, and download it to <code>/path/to/yourapp.provisionprofile</code>.</li>\n</ol>\n<h3 id=\"enable-apples-app-sandbox\"><a href=\"#enable-apples-app-sandbox\">Enable Apple's App Sandbox</a></h3>\n<p>Apps submitted to the Mac App Store must run under Apple's <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandbox</a>, and only the MAS build of Electron can run with the App Sandbox. The standard darwin build of Electron will fail to launch when run under App Sandbox.</p>\n<p>When signing the app with <code>electron-osx-sign</code>, it will automatically add the necessary entitlements to your app's entitlements, but if you are using custom entitlements, you must ensure App Sandbox capacity is added:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<h4 id=\"extra-steps-without-electron-osx-sign\"><a href=\"#extra-steps-without-electron-osx-sign\">Extra steps without <code>electron-osx-sign</code></a></h4>\n<p>If you are signing your app without using <code>electron-osx-sign</code>, you must ensure the app bundle's entitlements have at least following keys:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.application-groups<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">array</span>></span>\n      <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>TEAM_ID.your.bundle.id<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n    <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">array</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>The <code>TEAM_ID</code> should be replaced with your Apple Developer account's Team ID, and the <code>your.bundle.id</code> should be replaced with the App ID of the app.</p>\n<p>And the following entitlements must be added to the binaries and helpers in the app's bundle:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.inherit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>And the app bundle's <code>Info.plist</code> must include <code>ElectronTeamID</code> key, which has your Apple Developer account's Team ID as its value:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n  ...\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>ElectronTeamID<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>TEAM_ID<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>When using <code>electron-osx-sign</code> the <code>ElectronTeamID</code> key will be added automatically by extracting the Team ID from the certificate's name. You may need to manually add this key if <code>electron-osx-sign</code> could not find the correct Team ID.</p>\n<h3 id=\"sign-apps-for-development\"><a href=\"#sign-apps-for-development\">Sign apps for development</a></h3>\n<p>To sign an app that can run on your development machine, you must sign it with the \"Apple Development\" certificate and pass the provisioning profile to <code>electron-osx-sign</code>.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Apple Development'</span> --provisioning-profile=/path/to/yourapp.provisionprofile\n</code></pre>\n<p>If you are signing without <code>electron-osx-sign</code>, you must place the provisioning profile to <code>YourApp.app/Contents/embedded.provisionprofile</code>.</p>\n<p>The signed app can only run on the machines that registered by the provisioning profile, and this is the only way to test the signed app before submitting to Mac App Store.</p>\n<h3 id=\"sign-apps-for-submitting-to-the-mac-app-store\"><a href=\"#sign-apps-for-submitting-to-the-mac-app-store\">Sign apps for submitting to the Mac App Store</a></h3>\n<p>To sign an app that will be submitted to Mac App Store, you must sign it with the \"Apple Distribution\" certificate. Note that apps signed with this certificate will not run anywhere, unless it is downloaded from Mac App Store.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Apple Distribution'</span>\n</code></pre>\n<h3 id=\"sign-apps-for-distribution-outside-the-mac-app-store\"><a href=\"#sign-apps-for-distribution-outside-the-mac-app-store\">Sign apps for distribution outside the Mac App Store</a></h3>\n<p>If you don't plan to submit the app to Mac App Store, you can sign it the \"Developer ID Application\" certificate. In this way there is no requirement on App Sandbox, and you should use the normal darwin build of Electron if you don't use App Sandbox.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Developer ID Application'</span> --no-gatekeeper-assess\n</code></pre>\n<p>By passing <code>--no-gatekeeper-assess</code>, the <code>electron-osx-sign</code> will skip the macOS GateKeeper check as your app usually has not been notarized yet by this step.</p>\n<!-- TODO(zcbenz): Add a chapter about App Notarization -->\n<p>This guide does not cover <a href=\"https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution\">App Notarization</a>, but you might want to do it otherwise Apple may prevent users from using your app outside Mac App Store.</p>\n<h2 id=\"submit-apps-to-the-mac-app-store\"><a href=\"#submit-apps-to-the-mac-app-store\">Submit Apps to the Mac App Store</a></h2>\n<p>After signing the app with the \"Apple Distribution\" certificate, you can continue to submit it to Mac App Store.</p>\n<p>However, this guide do not ensure your app will be approved by Apple; you still need to read Apple's <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/SubmittingYourApp/SubmittingYourApp.html\">Submitting Your App</a> guide on how to meet the Mac App Store requirements.</p>\n<h3 id=\"upload\"><a href=\"#upload\">Upload</a></h3>\n<p>The Application Loader should be used to upload the signed app to iTunes Connect for processing, making sure you have <a href=\"https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/CreatingiTunesConnectRecord.html\">created a record</a> before uploading.</p>\n<p>If you are seeing errors like private APIs uses, you should check if the app is using the MAS build of Electron.</p>\n<h3 id=\"submit-for-review\"><a href=\"#submit-for-review\">Submit for review</a></h3>\n<p>After uploading, you should <a href=\"https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html\">submit your app for review</a>.</p>\n<h2 id=\"ограничения-сборки-mas\"><a href=\"#ограничения-сборки-mas\">Ограничения сборки MAS</a></h2>\n<p>In order to satisfy all requirements for app sandboxing, the following modules have been disabled in the MAS build:</p>\n<ul>\n<li><code>crashReporter</code></li>\n<li><code>autoUpdater</code></li>\n</ul>\n<p>and the following behaviors have been changed:</p>\n<ul>\n<li>Video capture may not work for some machines.</li>\n<li>Certain accessibility features may not work.</li>\n<li>Apps will not be aware of DNS changes.</li>\n</ul>\n<p>Also, due to the usage of app sandboxing, the resources which can be accessed by the app are strictly limited; you can read <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandboxing</a> for more information.</p>\n<h3 id=\"additional-entitlements\"><a href=\"#additional-entitlements\">Additional entitlements</a></h3>\n<p>Depending on which Electron APIs your app uses, you may need to add additional entitlements to your app's entitlements file. Otherwise, the App Sandbox may prevent you from using them.</p>\n<h4 id=\"network-access\"><a href=\"#network-access\">Network access</a></h4>\n<p>Enable outgoing network connections to allow your app to connect to a server:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.network.client<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>Enable incoming network connections to allow your app to open a network listening socket:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.network.server<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>See the <a href=\"https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW9\">Enabling Network Access documentation</a> for more details.</p>\n<h4 id=\"dialogshowopendialog\"><a href=\"#dialogshowopendialog\">dialog.showOpenDialog</a></h4>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.files.user-selected.read-only<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>See the <a href=\"https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6\">Enabling User-Selected File Access documentation</a> for more details.</p>\n<h4 id=\"dialogshowsavedialog\"><a href=\"#dialogshowsavedialog\">dialog.showSaveDialog</a></h4>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.files.user-selected.read-write<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>See the <a href=\"https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6\">Enabling User-Selected File Access documentation</a> for more details.</p>\n<h2 id=\"криптографические-алгоритмы-которые-использует-electron\"><a href=\"#криптографические-алгоритмы-которые-использует-electron\">Криптографические алгоритмы, которые использует Electron</a></h2>\n<p>Depending on the countries in which you are releasing your app, you may be required to provide information on the cryptographic algorithms used in your software. See the <a href=\"https://help.apple.com/app-store-connect/#/devc3f64248f\">encryption export compliance docs</a> for more information.</p>\n<p>Electron использует следующие криптографические алгоритмы:</p>\n<ul>\n<li>AES - <a href=\"https://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf\">NIST SP 800-38A</a>, <a href=\"https://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf\">NIST SP 800-38D</a>, <a href=\"https://www.ietf.org/rfc/rfc3394.txt\">RFC 3394</a></li>\n<li>HMAC - <a href=\"https://csrc.nist.gov/publications/fips/fips198-1/FIPS-198-1_final.pdf\">FIPS 198-1</a></li>\n<li>ECDSA - ANS X9.62–2005</li>\n<li>ECDH - ANS X9.63–2001</li>\n<li>HKDF - <a href=\"https://csrc.nist.gov/publications/nistpubs/800-56C/SP-800-56C.pdf\">NIST SP 800-56C</a></li>\n<li>PBKDF2 - <a href=\"https://tools.ietf.org/html/rfc2898\">RFC 2898</a></li>\n<li>RSA - <a href=\"https://www.ietf.org/rfc/rfc3447\">RFC 3447</a></li>\n<li>SHA - <a href=\"https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf\">FIPS 180-4</a></li>\n<li>Blowfish - <a href=\"https://www.schneier.com/cryptography/blowfish/\">https://www.schneier.com/cryptography/blowfish/</a></li>\n<li>CAST - <a href=\"https://tools.ietf.org/html/rfc2144\">RFC 2144</a>, <a href=\"https://tools.ietf.org/html/rfc2612\">RFC 2612</a></li>\n<li>DES - <a href=\"https://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf\">FIPS 46-3</a></li>\n<li>DH - <a href=\"https://tools.ietf.org/html/rfc2631\">RFC 2631</a></li>\n<li>DSA - <a href=\"https://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+X9.30-1%3A1997\">ANSI X9.30</a></li>\n<li>EC - <a href=\"https://www.secg.org/sec1-v2.pdf\">SEC 1</a></li>\n<li>IDEA - \"On the Design and Security of Block Ciphers\" book by X. Lai</li>\n<li>MD2 - <a href=\"https://tools.ietf.org/html/rfc1319\">RFC 1319</a></li>\n<li>MD4 - <a href=\"https://tools.ietf.org/html/rfc6150\">RFC 6150</a></li>\n<li>MD5 - <a href=\"https://tools.ietf.org/html/rfc1321\">RFC 1321</a></li>\n<li>MDC2 - <a href=\"https://wiki.openssl.org/index.php/Manual:Mdc2(3)\">ISO/IEC 10118-2</a></li>\n<li>RC2 - <a href=\"https://tools.ietf.org/html/rfc2268\">RFC 2268</a></li>\n<li>RC4 - <a href=\"https://tools.ietf.org/html/rfc4345\">RFC 4345</a></li>\n<li>RC5 - <a href=\"https://people.csail.mit.edu/rivest/Rivest-rc5rev.pdf\">https://people.csail.mit.edu/rivest/Rivest-rc5rev.pdf</a></li>\n<li>RIPEMD - <a href=\"https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2010118-3:2004\">ISO/IEC 10118-3</a></li>\n</ul>",
      "title": "Руководство по распространению с помощью Mac App Store",
      "description": ""
    },
    "/docs/tutorial/macos-dock": {
      "locale": "ru-RU",
      "slug": "macos-dock",
      "href": "/docs/tutorial/macos-dock",
      "crowdinFileId": "256217",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/macos-dock.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dock-macos\"><a href=\"#dock-macos\">Dock (macOS)</a></h1>\n<p>Electron has APIs to configure the app's icon in the macOS Dock. A macOS-only API exists to create a custom dock menu, but Electron also uses the app dock icon as the entry point for cross-platform features like <a href=\"/docs/tutorial/recent-documents\">recent documents</a> and <a href=\"/docs/tutorial/progress-bar\">application progress</a>.</p>\n<p>The custom dock is commonly used to add shortcuts to tasks the user wouldn't want to open the whole app window for.</p>\n<p><strong>Dock меню из Terminal.app:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5069962/6032658a-6e9c-11e4-9953-aa84006bdfff.png\" alt=\"Dock Menu\"></p>\n<p>To set your custom dock menu, you need to use the <a href=\"/docs/api/dock#docksetmenumenu-macos\"><code>app.dock.setMenu</code></a> API, which is only available on macOS.</p>\n<h2 id=\"пример\"><a href=\"#пример\">Пример</a></h2>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/macos-dock-menu\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\n<span class=\"hljs-keyword\">const</span> dockMenu = Menu.buildFromTemplate([\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Window'</span>,\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'New Window'</span>) }\n  }, {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Window with Settings'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Basic'</span> },\n      { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Pro'</span> }\n    ]\n  },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Command...'</span> }\n])\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">if</span> (process.platform === <span class=\"hljs-string\">'darwin'</span>) {\n    app.dock.setMenu(dockMenu)\n  }\n}).then(createWindow)\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n\n</code></pre>\n<p>After launching the Electron application, right click the application icon. You should see the custom menu you just defined:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/macos-dock-menu.png\" alt=\"macOS dock menu\"></p>",
      "title": "Dock (macOS)",
      "description": ""
    },
    "/docs/api/structures/memory-info": {
      "locale": "ru-RU",
      "slug": "memory-info",
      "href": "/docs/api/structures/memory-info",
      "crowdinFileId": "256459",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/memory-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"memoryinfo-object\"><a href=\"#memoryinfo-object\">MemoryInfo Object</a></h1>\n<ul>\n<li><code>workingSetSize</code> Integer - The amount of memory currently pinned to actual physical RAM.</li>\n<li><code>peakWorkingSetSize</code> Integer - The maximum amount of memory that has ever been pinned to actual physical RAM.</li>\n<li><code>privateBytes</code> Integer (optional) <em>Windows</em> - The amount of memory not shared by other processes, such as JS heap or HTML content.</li>\n</ul>\n<p>Note that all statistics are reported in Kilobytes.</p>",
      "title": "MemoryInfo Object",
      "description": ""
    },
    "/docs/api/structures/memory-usage-details": {
      "locale": "ru-RU",
      "slug": "memory-usage-details",
      "href": "/docs/api/structures/memory-usage-details",
      "crowdinFileId": "256461",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/memory-usage-details.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"memoryusagedetails-object\"><a href=\"#memoryusagedetails-object\">MemoryUsageDetails Object</a></h1>\n<ul>\n<li><code>count</code> Number</li>\n<li><code>size</code> Number</li>\n<li><code>liveSize</code> Number</li>\n</ul>",
      "title": "MemoryUsageDetails Object",
      "description": ""
    },
    "/docs/api/menu": {
      "locale": "ru-RU",
      "slug": "menu",
      "href": "/docs/api/menu",
      "crowdinFileId": "256335",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/menu.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"menu\"><a href=\"#menu\">Menu</a></h1>\n<h2 id=\"класс-menu\"><a href=\"#класс-menu\">Класс: Menu</a></h2>\n<blockquote>\n<p>Создайте меню приложения и контекстное меню.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<h3 id=\"new-menu\"><a href=\"#new-menu\"><code>new Menu()</code></a></h3>\n<p>Создает новое меню.</p>\n<h3 id=\"статические-методы\"><a href=\"#статические-методы\">Статические методы</a></h3>\n<p>Класс <code>Menu</code> имеет следующие статические методы:</p>\n<h4 id=\"menusetapplicationmenumenu\"><a href=\"#menusetapplicationmenumenu\"><code>Menu.setApplicationMenu(menu)</code></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Устанавливает <code>меню</code> в качестве меню приложения на macOS. On Windows and Linux, the <code>menu</code> will be set as each window's top menu.</p>\n<p>Также на Windows и Linux, Вы можете использовать <code>&#x26;</code> в названии подменю верхнего списка, чтобы указать, какая буква должна получить сгенерированный акселератор( Accelerator ). Для примера, использование <code>&#x26;File</code> для меню файла в результате сгенерирует акселератор( Accelerator ) <code>Alt-F</code>, который открывает соответствующее меню. The indicated character in the button label then gets an underline, and the <code>&#x26;</code> character is not displayed on the button label.</p>\n<p>In order to escape the <code>&#x26;</code> character in an item name, add a proceeding <code>&#x26;</code>. For example, <code>&#x26;&#x26;File</code> would result in <code>&#x26;File</code> displayed on the button label.</p>\n<p>Passing <code>null</code> will suppress the default menu. On Windows and Linux, this has the additional effect of removing the menu bar from the window.</p>\n<p><strong>Примечание:</strong> Меню по умолчанию будет создано автоматически, если приложение не установит его. Он содержит стандартные элементы, такие как <code>Файл</code>, <code>Редактировать</code>, <code>Вид</code>, <code>Окно</code> и <code>Помощь</code>.</p>\n<h4 id=\"menugetapplicationmenu\"><a href=\"#menugetapplicationmenu\"><code>Menu.getApplicationMenu()</code></a></h4>\n<p>Возвращает <code>Menu | null</code> - меню приложения, если значение задано, в противном случае <code>null</code>.</p>\n<p><strong>Примечание:</strong> Возвращенный экземпляр <code>Menu</code> не поддерживает динамическое добавление или удаление пунктов меню. <a href=\"#instance-properties\">Параметры экземпляра</a> все ещё могут быть динамически изменены.</p>\n<h4 id=\"menusendactiontofirstresponderaction-macos\"><a href=\"#menusendactiontofirstresponderaction-macos\"><code>Menu.sendActionToFirstResponder(action)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>action</code> String</li>\n</ul>\n<p>Посылает <code>action</code> первому ответчику приложения. Это используется для эмуляции поведения меню macOS. Usually you would use the <a href=\"/docs/api/menu-item#roles\"><code>role</code></a> property of a <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>.</p>\n<p>Для дополнительной информации по нативным действиям в macOS смотрите <a href=\"https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW7\">macOS Cocoa Event Handling Guide</a>.</p>\n<h4 id=\"menubuildfromtemplatetemplate\"><a href=\"#menubuildfromtemplatetemplate\"><code>Menu.buildFromTemplate(template)</code></a></h4>\n<ul>\n<li><code>template</code> (MenuItemConstructorOptions | MenuItem)[]</li>\n</ul>\n<p>Возвращает <code>Menu</code></p>\n<p>Generally, the <code>template</code> is an array of <code>options</code> for constructing a <a href=\"/docs/api/menu-item\">MenuItem</a>. The usage can be referenced above.</p>\n<p>Вы также можете прикрепить другие поля к элементу <code>template</code> и они станут свойствами элементов созданного меню.</p>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<p>Объект <code>меню</code> имеет следующие методы экземпляра:</p>\n<h4 id=\"menupopupoptions\"><a href=\"#menupopupoptions\"><code>menu.popup([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>windows</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (опционально) - по умолчанию это сфокусированное окно.</li>\n<li><code>x</code> Number (optional) - Default is the current mouse cursor position. Must be declared if <code>y</code> is declared.</li>\n<li><code>y</code> Number (optional) - Default is the current mouse cursor position. Must be declared if <code>x</code> is declared.</li>\n<li><code>positioningItem</code> Number (optional) <em>macOS</em> - The index of the menu item to be positioned under the mouse cursor at the specified coordinates. Default is -1.</li>\n<li><code>callback</code> Функция (опционально) - вызывается, когда меню закрыто.</li>\n</ul></li>\n</ul>\n<p>Переключает это меню в контекстное меню в <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<h4 id=\"menuclosepopupbrowserwindow\"><a href=\"#menuclosepopupbrowserwindow\"><code>menu.closePopup([browserWindow])</code></a></h4>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (опционально) - по умолчанию это сфокусированное окно.</li>\n</ul>\n<p>Закрывает контекстное меню в <code>browserWindow</code>.</p>\n<h4 id=\"menuappendmenuitem\"><a href=\"#menuappendmenuitem\"><code>menu.append(menuItem)</code></a></h4>\n<ul>\n<li><code>menuItem</code> <a href=\"/docs/api/menu-item\">MenuItem</a></li>\n</ul>\n<p>Добавляет <code>menuItem</code> в меню.</p>\n<h4 id=\"menugetmenuitembyidid\"><a href=\"#menugetmenuitembyidid\"><code>menu.getMenuItemById(id)</code></a></h4>\n<ul>\n<li><code>id</code> String</li>\n</ul>\n<p>Возвращает элемент <code>MenuItem</code> с указанным <code>id</code></p>\n<h4 id=\"menuinsertpos-menuitem\"><a href=\"#menuinsertpos-menuitem\"><code>menu.insert(pos, menuItem)</code></a></h4>\n<ul>\n<li><code>port</code> Integer</li>\n<li><code>menuItem</code> <a href=\"/docs/api/menu-item\">MenuItem</a></li>\n</ul>\n<p>Вставляет <code>menuItem</code> в меню на позицию <code>pos</code>.</p>\n<h3 id=\"события-экземпляра\"><a href=\"#события-экземпляра\">События экземпляра</a></h3>\n<p>Объекты созданные с помощью <code>new Menu</code> или возвращенные из <code>Menu.buildFromTemplate</code> вызывают следующие события:</p>\n<p><strong>Примечание:</strong> Некоторые методы доступны только в определенных операционных системах и помечены как таковые.</p>\n<h4 id=\"событие-menu-will-show\"><a href=\"#событие-menu-will-show\">Событие: 'menu-will-show'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n</ul>\n<p>Вызывается при вызове <code>menu.popup()</code>.</p>\n<h4 id=\"событие-menu-will-close\"><a href=\"#событие-menu-will-close\">Событие: 'menu-will-close'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n</ul>\n<p>Вызывается, когда всплывающее окно закрывается вручную или с помощью <code>menu.closePopup()</code>.</p>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<p>Объекты <code>menu</code> также имеют следующие свойства:</p>\n<h4 id=\"menuitems\"><a href=\"#menuitems\"><code>menu.items</code></a></h4>\n<p>Массив <code>MenuItem[]</code> содержит элементы меню.</p>\n<p>Каждое <code>Menu</code> состоит из нескольких <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a> и каждое <code>MenuItem</code> может иметь подменю.</p>\n<h2 id=\"примеры\"><a href=\"#примеры\">Примеры</a></h2>\n<p>An example of creating the application menu with the simple template API:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> isMac = process.platform === <span class=\"hljs-string\">'darwin'</span>\n\n<span class=\"hljs-keyword\">const</span> template = [\n  <span class=\"hljs-comment\">// { role: 'appMenu' }</span>\n  ...(isMac ? [{\n    <span class=\"hljs-attr\">label</span>: app.name,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'about'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'services'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'hide'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'hideOthers'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'unhide'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'quit'</span> }\n    ]\n  }] : []),\n  <span class=\"hljs-comment\">// { role: 'fileMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'File'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      isMac ? { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'close'</span> } : { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'quit'</span> }\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'editMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Edit'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'undo'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'redo'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'cut'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'copy'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'paste'</span> },\n      ...(isMac ? [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'pasteAndMatchStyle'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'delete'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'selectAll'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        {\n          <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Speech'</span>,\n          <span class=\"hljs-attr\">submenu</span>: [\n            { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'startSpeaking'</span> },\n            { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'stopSpeaking'</span> }\n          ]\n        }\n      ] : [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'delete'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'selectAll'</span> }\n      ])\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'viewMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'View'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'reload'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'forceReload'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'toggleDevTools'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'resetZoom'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoomIn'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoomOut'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'togglefullscreen'</span> }\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'windowMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Window'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'minimize'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoom'</span> },\n      ...(isMac ? [\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'front'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'window'</span> }\n      ] : [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'close'</span> }\n      ])\n    ]\n  },\n  {\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'help'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      {\n        <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Learn More'</span>,\n        <span class=\"hljs-attr\">click</span>: <span class=\"hljs-keyword\">async</span> () => {\n          <span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n          <span class=\"hljs-keyword\">await</span> shell.openExternal(<span class=\"hljs-string\">'https://electronjs.org'</span>)\n        }\n      }\n    ]\n  }\n]\n\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\nMenu.setApplicationMenu(menu)\n</code></pre>\n<h3 id=\"графический-процесс\"><a href=\"#графический-процесс\">Графический процесс</a></h3>\n<p>To create menus initiated by the renderer process, send the required information to the main process using IPC and have the main process display the menu on behalf of the renderer.</p>\n<p>Below is an example of showing a menu when the user right clicks the page:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer</span>\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'contextmenu'</span>, (e) => {\n  e.preventDefault()\n  ipcRenderer.send(<span class=\"hljs-string\">'show-context-menu'</span>)\n})\n\nipcRenderer.on(<span class=\"hljs-string\">'context-menu-command'</span>, (e, command) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// main</span>\nipcMain.on(<span class=\"hljs-string\">'show-context-menu'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> template = [\n    {\n      <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Menu Item 1'</span>,\n      <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { event.sender.send(<span class=\"hljs-string\">'context-menu-command'</span>, <span class=\"hljs-string\">'menu-item-1'</span>) }\n    },\n    { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Menu Item 2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'checkbox'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> }\n  ]\n  <span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\n  menu.popup(BrowserWindow.fromWebContents(event.sender))\n})\n</code></pre>\n<h2 id=\"замечания-о-меню-приложения-в-macos\"><a href=\"#замечания-о-меню-приложения-в-macos\">Замечания о меню приложения в macOS</a></h2>\n<p>macOS has a completely different style of application menu from Windows and Linux. Here are some notes on making your app's menu more native-like.</p>\n<h3 id=\"стандартные-меню\"><a href=\"#стандартные-меню\">Стандартные меню</a></h3>\n<p>На macOS есть много стандратных системных меню, таких как <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc\"><code>Службы</code></a> и <code>Окно</code>. Чтобы сделать меню стандартным меню, Вы должны установить значение <code>role</code> у меню в одно из следующих, а Electron распознает их и сделает их стандартным меню:</p>\n<ul>\n<li><code>window</code></li>\n<li><code>help</code></li>\n<li><code>services</code></li>\n</ul>\n<h3 id=\"действия-элементов-стандартного-меню\"><a href=\"#действия-элементов-стандартного-меню\">Действия элементов стандартного меню</a></h3>\n<p>macOS представляет стандартные действия для некоторых элементов меню, таких как <code>About xxx</code>, <code>Hide xxx</code> и <code>Hide Others</code>. Чтобы установить действие элемента меню на стандартное действие, Вы должны установить атрибут <code>role</code> элемента меню.</p>\n<h3 id=\"имя-главного-меню\"><a href=\"#имя-главного-меню\">Имя главного меню</a></h3>\n<p>На macOS название первого элемента меню приложения - всегда название Вашего приложения, независимо от того, какое название элемента Вы установили. Чтобы изменить его, измените файл <code>Info.plist</code> Вашей сборки приложения. See <a href=\"https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html\">About Information Property List Files</a> for more information.</p>\n<h2 id=\"setting-menu-for-specific-browser-window-linux-windows\"><a href=\"#setting-menu-for-specific-browser-window-linux-windows\">Setting Menu for Specific Browser Window (<em>Linux</em> <em>Windows</em>)</a></h2>\n<p><a href=\"/docs/api/browser-window#winsetmenumenu-linux-windows\">Метод <code>setMenu</code></a> окна браузера может установить меню определенных окон браузера.</p>\n<h2 id=\"позиция-элемента-меню\"><a href=\"#позиция-элемента-меню\">Позиция элемента меню</a></h2>\n<p>Вы можете использовать <code>before</code>, <code>after</code>, <code>beforeGroupContaining</code>, <code>afterGroupContaining</code> и <code>id</code>, чтобы контролировать то, как элементы будут размещены, при создании меню с помощью <code>Menu.buildFromTemplate</code>.</p>\n<ul>\n<li><code>before</code> - вставляет этот элемент перед элементом с указанным названием. Если ссылаемый элемент не существует, тогда элемент будет вставлен в конец меню. Кроме того, подразумевается, что рассматриваемый элемент меню размещен в той же \"группе\", что и сам элемент.</li>\n<li><code>after</code> - вставляет элемент после элемента с указанным названием. Если ссылаемый элемент не существует, тогда элемент будет вставлен в конец меню. Кроме того, подразумевается, что рассматриваемый элемент меню размещен в той же \"группе\", что и сам элемент.</li>\n<li><code>beforeGroupContaining</code> - представляет средства для одного контекстного меню, чтобы объявить размещение их содержащей группы перед содержащей группы элемента с указанным названием.</li>\n<li><code>afterGroupContaining</code> - представляет средства для одного контекстного меню, чтобы объявить размещение их содержащей группы после содержащей группы элемента с указанным названием.</li>\n</ul>\n<p>По умолчанию, элементы будут вставлены в том порядке, в котором они существуют в шаблоне, если не используется ни один из указанных ключевых слов позиционирования.</p>\n<h3 id=\"примеры-1\"><a href=\"#примеры-1\">Примеры</a></h3>\n<p>Шаблон:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'4'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'four'</span> }\n]\n</code></pre>\n<p>Меню:</p>\n<pre><code class=\"hljs language-sh\">- 1\n- 2\n- 3\n- 4\n</code></pre>\n<p>Шаблон:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span> },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span>, <span class=\"hljs-attr\">beforeGroupContaining</span>: [<span class=\"hljs-string\">'1'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'4'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'four'</span>, <span class=\"hljs-attr\">afterGroupContaining</span>: [<span class=\"hljs-string\">'2'</span>] },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span> }\n]\n</code></pre>\n<p>Меню:</p>\n<pre><code class=\"hljs language-sh\">- 3\n- 4\n- ---\n- 1\n- ---\n- 2\n</code></pre>\n<p>Шаблон:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span>, <span class=\"hljs-attr\">after</span>: [<span class=\"hljs-string\">'3'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span>, <span class=\"hljs-attr\">before</span>: [<span class=\"hljs-string\">'1'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span> }\n]\n</code></pre>\n<p>Меню:</p>\n<pre><code class=\"hljs language-sh\">- ---\n- 3\n- 2\n- 1\n</code></pre>",
      "title": "Menu",
      "description": "Создайте меню приложения и контекстное меню."
    },
    "/docs/api/menu-item": {
      "locale": "ru-RU",
      "slug": "menu-item",
      "href": "/docs/api/menu-item",
      "crowdinFileId": "256333",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/menu-item.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-menuitem\"><a href=\"#class-menuitem\">Class: MenuItem</a></h2>\n<blockquote>\n<p>Добавляет элементы в основное меню и контекстное меню приложения.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p>Просмотрите <a href=\"/docs/api/menu\"><code>Menu</code></a> для примеров использования.</p>\n<h3 id=\"new-menuitemoptions\"><a href=\"#new-menuitemoptions\"><code>new MenuItem(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>click</code> Function (optional) - Will be called with <code>click(menuItem, browserWindow, event)</code> when the menu item is clicked.<ul>\n<li><code>menuItem</code> MenuItem</li>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | undefined - This will not be defined if no window is open.</li>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n</ul></li>\n<li><code>role</code> String (optional) - Can be <code>undo</code>, <code>redo</code>, <code>cut</code>, <code>copy</code>, <code>paste</code>, <code>pasteAndMatchStyle</code>, <code>delete</code>, <code>selectAll</code>, <code>reload</code>, <code>forceReload</code>, <code>toggleDevTools</code>, <code>resetZoom</code>, <code>zoomIn</code>, <code>zoomOut</code>, <code>toggleSpellChecker</code>, <code>togglefullscreen</code>, <code>window</code>, <code>minimize</code>, <code>close</code>, <code>help</code>, <code>about</code>, <code>services</code>, <code>hide</code>, <code>hideOthers</code>, <code>unhide</code>, <code>quit</code>, <code>startSpeaking</code>, <code>stopSpeaking</code>, <code>zoom</code>, <code>front</code>, <code>appMenu</code>, <code>fileMenu</code>, <code>editMenu</code>, <code>viewMenu</code>, <code>shareMenu</code>, <code>recentDocuments</code>, <code>toggleTabBar</code>, <code>selectNextTab</code>, <code>selectPreviousTab</code>, <code>mergeAllWindows</code>, <code>clearRecentDocuments</code>, <code>moveTabToNewWindow</code> or <code>windowMenu</code> - Define the action of the menu item, when specified the <code>click</code> property will be ignored. Смотрите <a href=\"#roles\">роли</a>.</li>\n<li><code>type</code> String (опционально) - Может быть <code>normal</code>, <code>separator</code>, <code>submenu</code>, <code>checkbox</code> или <code>radio</code>.</li>\n<li><code>label</code> String (опционально)</li>\n<li><code>sublabel</code> String (опционально)</li>\n<li><code>toolTip</code> String (optional) <em>macOS</em> - Hover text for this menu item.</li>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a> (опционально)</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (опционально)</li>\n<li><code>enabled</code> Boolean (опционально) - Если false, пункт меню выделится серым цветом и не будет нажимться.</li>\n<li><code>acceleratorWorksWhenHidden</code> Boolean (optional) <em>macOS</em> - default is <code>true</code>, and when <code>false</code> will prevent the accelerator from triggering the item if the item is not visible`.</li>\n<li><code>visible</code> Boolean (опционально) - Если false, пункт меню будет полностью скрыт.</li>\n<li><code>checked</code> Boolean (опционально) - Должно быть указано только для <code>checkbox</code> или <code>radio</code> типов элементов меню.</li>\n<li><code>registerAccelerator</code> Boolean (optional) <em>Linux</em> <em>Windows</em> - If false, the accelerator won't be registered with the system, but it will still be displayed. Defaults to true.</li>\n<li><code>sharingItem</code> SharingItem (optional) <em>macOS</em> - The item to share when the <code>role</code> is <code>shareMenu</code>.</li>\n<li><code>submenu</code> (MenuItemConstructorOptions[] | <a href=\"/docs/api/menu\">Menu</a>) (опционально) - Необходимо указать для <code>submenu</code> типы элементов меню. Если <code>submenu</code> указано, то <code>type: 'submenu'</code> может быть опущен. Если значение не является <a href=\"/docs/api/menu\"><code>Menu</code></a> то оно будет автоматически преобразовано в значение <code>Menu.buildFromTemplate</code>.</li>\n<li><code>id</code> String (optional) - Unique within a single menu. If defined then it can be used as a reference to this item by the position attribute.</li>\n<li><code>before</code> String<a href=\"/docs/api/%D0%BE%D0%BF%D1%86%D0%B8%D0%BE%D0%BD%D0%B0%D0%BB%D1%8C%D0%BD%D0%BE\"></a> - Вставляет этот элемент перед элементом с указанным названием. Если указанный элемент не существует, то элемент будет вставлен в конец меню. Кроме того, подразумевается, что рассматриваемый элемент меню размещен в той же \"группе\", что и сам элемент.</li>\n<li><code>after</code> String<a href=\"/docs/api/optional\"></a> - Inserts this item after the item with the specified label. Если ссылаемый элемент не существует, тогда элемент будет вставлен в конец меню.</li>\n<li><code>beforeGroupContaining</code> String<a href=\"/docs/api/%D0%BE%D0%BF%D1%86%D0%B8%D0%BE%D0%BD%D0%B0%D0%BB%D1%8C%D0%BD%D0%BE\"></a> - Предоставляет возможность в одном контекстном меню объявить размещение группы, содержащей элемент, перед группой, содержащей элемент с указанной меткой.</li>\n<li><code>afterGroupContaining</code> String<a href=\"/docs/api/%D0%BE%D0%BF%D1%86%D0%B8%D0%BE%D0%BD%D0%B0%D0%BB%D1%8C%D0%BD%D0%BE\"></a> - Предоставляет возможность в одном контекстном меню объявить размещение группы, содержащей элемент, после группы, содержащей элемент с указанной меткой.</li>\n</ul></li>\n</ul>\n<p><strong>Note:</strong> <code>acceleratorWorksWhenHidden</code> is specified as being macOS-only because accelerators always work when items are hidden on Windows and Linux. Эта опция доступна пользователям для того, чтобы дать им возможность отключить ее, так как это возможно в родной macOS разработке. Это свойство можно использовать только на macOS High Sierra 10.13 или новее.</p>\n<h3 id=\"роли\"><a href=\"#роли\">Роли</a></h3>\n<p>Роли позволяют элементам класса menu иметь заранее определенные поведения.</p>\n<p>Лучше всего указать <code>role</code> для любого элемента меню, который соответствует стандартной роли, а не пытаться вручную реализовать поведение в функции <code>click</code>. Встроенное поведение <code>role</code> даст наилучшую нативную возможность использования.</p>\n<p>Значения <code>label</code> и <code>accelerator</code> необязательны при использовании <code>role</code> и по умолчанию будут присваиваться для каждой для каждой платформы.</p>\n<p>Каждый элемент меню должен иметь <code>role</code> или <code>label</code>, или в случае разделителя <code>type</code>.</p>\n<p>Свойство <code>role</code> может иметь следующие значения:</p>\n<ul>\n<li><code>undo - Отменить</code></li>\n<li><code>about</code> - Trigger a native about panel (custom message box on Window, which does not provide its own).</li>\n<li><code>redo - Восстановить</code></li>\n<li><code>cut - Вырезать</code></li>\n<li><code>copy - Копировать</code></li>\n<li><code>paste - Вставить</code></li>\n<li><code>pasteAndMatchStyle - Вставить и применить стиль</code></li>\n<li><code>selectAll - Выделить все</code></li>\n<li><code>delete - Удалить</code></li>\n<li><code>minimize</code> - Свернуть текущее окно.</li>\n<li><code>close</code> - Закрыть текущее окно.</li>\n<li><code>quit</code> - Выйти из приложения.</li>\n<li><code>reload</code> - Перезагрузить текущее окно.</li>\n<li><code>forceReload</code> - Перезагрузить текущее окно, игнорировать кэш.</li>\n<li><code>toggleDevTools</code> - Включить инструмент разработчика для текущего окна.</li>\n<li><code>togglefullscreen</code> -Включить полноэкранный режим для текущего окна.</li>\n<li><code>resetZoom</code> - Сброс измененного масштаба страницы до исходного размера.</li>\n<li><code>zoomIn</code> - Увеличение масштаба страницы на 10%.</li>\n<li><code>zoomOut</code> - Уменьшение масштаба страницы на 10%.</li>\n<li><code>toggleSpellChecker</code> - Enable/disable builtin spell checker.</li>\n<li><code>fileMenu</code> - Полное меню \"Файл\" по умолчанию (Закрыть/Выйти)</li>\n<li><code>editMenu</code> - Whole default \"Edit\" menu (Undo, Copy, etc.).</li>\n<li><code>viewMenu</code> - Полное меню \"Вид\" по умолчанию (перезагрузка, переключение инструментов разработчика и т. д.)</li>\n<li><code>windowMenu</code> - Полное меню \"Окно\" по умолчанию (Свернуть, масштаб и т. д.).</li>\n</ul>\n<p>The following additional roles are available on <em>macOS</em>:</p>\n<ul>\n<li><code>appMenu</code> - Полное меню \"App\" по умолчанию (О программе, службах и т. д.)</li>\n<li><code>hide</code> - Map to the <code>hide</code> action.</li>\n<li><code>hideOthers</code> - Map to the <code>hideOtherApplications</code> action.</li>\n<li><code>unhide</code> - Map to the <code>unhideAllApplications</code> action.</li>\n<li><code>startSpeaking</code> - Map to the <code>startSpeaking</code> action.</li>\n<li><code>stopSpeaking</code> - Map to the <code>stopSpeaking</code> action.</li>\n<li><code>front</code> - Map to the <code>arrangeInFront</code> action.</li>\n<li><code>zoom</code> - Map to the <code>performZoom</code> action.</li>\n<li><code>toggleTabBar</code> - Map to the <code>toggleTabBar</code> action.</li>\n<li><code>selectNextTab</code> - Map to the <code>selectNextTab</code> action.</li>\n<li><code>selectPreviousTab</code> - Map to the <code>selectPreviousTab</code> action.</li>\n<li><code>mergeAllWindows</code> - Map to the <code>mergeAllWindows</code> action.</li>\n<li><code>moveTabToNewWindow</code> - Map to the <code>moveTabToNewWindow</code> action.</li>\n<li><code>window</code> - The submenu is a \"Window\" menu.</li>\n<li><code>help</code> - The submenu is a \"Help\" menu.</li>\n<li><code>services</code> - Подменю меню <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc\">\"Сервисы\"</a>. This is only intended for use in the Application Menu and is <em>not</em> the same as the \"Services\" submenu used in context menus in macOS apps, which is not implemented in Electron.</li>\n<li><code>recentDocuments</code> - The submenu is an \"Open Recent\" menu.</li>\n<li><code>clearRecentDocuments</code> - Map to the <code>clearRecentDocuments</code> action.</li>\n<li><code>shareMenu</code> - The submenu is <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/\">share menu</a>. The <code>sharingItem</code> property must also be set to indicate the item to share.</li>\n</ul>\n<p>При задании <code>role</code> на macOS, <code>label</code> и <code>accelerator</code> являются единственными параметрами, которые влияют на пункт меню. Все остальные параметры будут проигнорированы. Нижний регистр <code>role</code>, например <code>toggledevtools</code>, все еще поддерживается.</p>\n<p><strong>Nota Bene:</strong> The <code>enabled</code> and <code>visibility</code> properties are not available for top-level menu items in the tray on macOS.</p>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<p>Для экземпляров <code>MenuItem</code> доступны следующие свойства:</p>\n<h4 id=\"menuitemid\"><a href=\"#menuitemid\"><code>menuItem.id</code></a></h4>\n<p><code>Строка</code> с указанием уникального id элемента, это свойство может быть динамически изменено.</p>\n<h4 id=\"menuitemlabel\"><a href=\"#menuitemlabel\"><code>menuItem.label</code></a></h4>\n<p>A <code>String</code> indicating the item's visible label.</p>\n<h4 id=\"menuitemclick\"><a href=\"#menuitemclick\"><code>menuItem.click</code></a></h4>\n<p>A <code>Function</code> that is fired when the MenuItem receives a click event. It can be called with <code>menuItem.click(event, focusedWindow, focusedWebContents)</code>.</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>focusedWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n<li><code>focusedWebContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<h4 id=\"menuitemsubmenu\"><a href=\"#menuitemsubmenu\"><code>menuItem.submenu</code></a></h4>\n<p><code>Menu</code> (опционально), содержащие подменю пункты, если таковые имеются.</p>\n<h4 id=\"menuitemtype\"><a href=\"#menuitemtype\"><code>menuItem.type</code></a></h4>\n<p><code>Строка</code> с указанием типа элемента. Can be <code>normal</code>, <code>separator</code>, <code>submenu</code>, <code>checkbox</code> or <code>radio</code>.</p>\n<h4 id=\"menuitemrole\"><a href=\"#menuitemrole\"><code>menuItem.role</code></a></h4>\n<p><code>String</code> (опционально) с указанием роли элемента, если установлено. Can be <code>undo</code>, <code>redo</code>, <code>cut</code>, <code>copy</code>, <code>paste</code>, <code>pasteAndMatchStyle</code>, <code>delete</code>, <code>selectAll</code>, <code>reload</code>, <code>forceReload</code>, <code>toggleDevTools</code>, <code>resetZoom</code>, <code>zoomIn</code>, <code>zoomOut</code>, <code>toggleSpellChecker</code>, <code>togglefullscreen</code>, <code>window</code>, <code>minimize</code>, <code>close</code>, <code>help</code>, <code>about</code>, <code>services</code>, <code>hide</code>, <code>hideOthers</code>, <code>unhide</code>, <code>quit</code>, <code>startSpeaking</code>, <code>stopSpeaking</code>, <code>zoom</code>, <code>front</code>, <code>appMenu</code>, <code>fileMenu</code>, <code>editMenu</code>, <code>viewMenu</code>, <code>shareMenu</code>, <code>recentDocuments</code>, <code>toggleTabBar</code>, <code>selectNextTab</code>, <code>selectPreviousTab</code>, <code>mergeAllWindows</code>, <code>clearRecentDocuments</code>, <code>moveTabToNewWindow</code> or <code>windowMenu</code></p>\n<h4 id=\"menuitemaccelerator\"><a href=\"#menuitemaccelerator\"><code>menuItem.accelerator</code></a></h4>\n<p>An <code>Accelerator</code> (optional) indicating the item's accelerator, if set.</p>\n<h4 id=\"menuitemuseraccelerator-readonly-macos\"><a href=\"#menuitemuseraccelerator-readonly-macos\"><code>menuItem.userAccelerator</code> <em>Readonly</em> <em>macOS</em></a></h4>\n<p>An <code>Accelerator | null</code> indicating the item's <a href=\"https://developer.apple.com/documentation/appkit/nsmenuitem/1514850-userkeyequivalent?language=objc\">user-assigned accelerator</a> for the menu item.</p>\n<p><strong>Note:</strong> This property is only initialized after the <code>MenuItem</code> has been added to a <code>Menu</code>. Either via <code>Menu.buildFromTemplate</code> or via <code>Menu.append()/insert()</code>.  Accessing before initialization will just return <code>null</code>.</p>\n<h4 id=\"menuitemicon\"><a href=\"#menuitemicon\"><code>menuItem.icon</code></a></h4>\n<p><code>NativeImage | Строка</code> (опционально) с указанием иконки элемента, если установлено.</p>\n<h4 id=\"menuitemsublabel\"><a href=\"#menuitemsublabel\"><code>menuItem.sublabel</code></a></h4>\n<p>A <code>String</code> indicating the item's sublabel.</p>\n<h4 id=\"menuitemtooltip-macos\"><a href=\"#menuitemtooltip-macos\"><code>menuItem.toolTip</code> <em>macOS</em></a></h4>\n<p><code>String</code> с указанием текста, который появляется при наведении курсора на элемент.</p>\n<h4 id=\"menuitemenabled\"><a href=\"#menuitemenabled\"><code>menuItem.enabled</code></a></h4>\n<p><code>Boolean</code> указывает, включен ли элемент, это свойство может быть динамически изменено.</p>\n<h4 id=\"menuitemvisible\"><a href=\"#menuitemvisible\"><code>menuItem.visible</code></a></h4>\n<p><code>Boolean</code> указывает, видим ли элемент, это свойство может быть динамически изменено.</p>\n<h4 id=\"menuitemchecked\"><a href=\"#menuitemchecked\"><code>menuItem.checked</code></a></h4>\n<p><code>Boolean</code> указывает, помечен ли элемент флажком, это свойство может быть динамически изменено.</p>\n<p>Элемент меню <code>checkbox</code> будет включать и выключать свойство <code>checked</code> при его выборе.</p>\n<p><code>Radio</code> пункт меню включит его свойство <code>checked</code> при нажатии, и отключит это свойство для всех смежных пунктов в том же меню.</p>\n<p>Вы можете добавить функцию <code>click</code> для дополнительного поведения.</p>\n<h4 id=\"menuitemregisteraccelerator\"><a href=\"#menuitemregisteraccelerator\"><code>menuItem.registerAccelerator</code></a></h4>\n<p>A <code>Boolean</code> indicating if the accelerator should be registered with the system or just displayed.</p>\n<p>This property can be dynamically changed.</p>\n<h4 id=\"menuitemsharingitem-macos\"><a href=\"#menuitemsharingitem-macos\"><code>menuItem.sharingItem</code> <em>macOS</em></a></h4>\n<p>A <code>SharingItem</code> indicating the item to share when the <code>role</code> is <code>shareMenu</code>.</p>\n<p>This property can be dynamically changed.</p>\n<h4 id=\"menuitemcommandid\"><a href=\"#menuitemcommandid\"><code>menuItem.commandId</code></a></h4>\n<p><code>Номер</code> с указанием уникального последовательного идентификатора элемента.</p>\n<h4 id=\"menuitemmenu\"><a href=\"#menuitemmenu\"><code>menuItem.menu</code></a></h4>\n<p><code>Меню</code>, частью которого является элемент.</p>",
      "title": "MenuItem",
      "description": "Добавляет элементы в основное меню и контекстное меню приложения."
    },
    "/docs/api/message-channel-main": {
      "locale": "ru-RU",
      "slug": "message-channel-main",
      "href": "/docs/api/message-channel-main",
      "crowdinFileId": "256337",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/message-channel-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messagechannelmain\"><a href=\"#messagechannelmain\">MessageChannelMain</a></h1>\n<p><code>MessageChannelMain</code> is the main-process-side equivalent of the DOM <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\"><code>MessageChannel</code></a> object. Its singular function is to create a pair of connected <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> objects.</p>\n<p>See the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> documentation for more information on using channel messaging.</p>\n<h2 id=\"class-messagechannelmain\"><a href=\"#class-messagechannelmain\">Class: MessageChannelMain</a></h2>\n<blockquote>\n<p>Channel interface for channel messaging in the main process.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p>Пример:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nw.webContents.postMessage(<span class=\"hljs-string\">'port'</span>, <span class=\"hljs-literal\">null</span>, [port2])\nport1.postMessage({ <span class=\"hljs-attr\">some</span>: <span class=\"hljs-string\">'message'</span> })\n\n<span class=\"hljs-comment\">// Renderer process</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e) => {\n  <span class=\"hljs-comment\">// e.ports is a list of ports sent along with this message</span>\n  e.ports[<span class=\"hljs-number\">0</span>].on(<span class=\"hljs-string\">'message'</span>, (messageEvent) => {\n    <span class=\"hljs-built_in\">console</span>.log(messageEvent.data)\n  })\n})\n</code></pre>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<h4 id=\"channelport1\"><a href=\"#channelport1\"><code>channel.port1</code></a></h4>\n<p>A <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> property.</p>\n<h4 id=\"channelport2\"><a href=\"#channelport2\"><code>channel.port2</code></a></h4>\n<p>A <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> property.</p>",
      "title": "MessageChannelMain",
      "description": "Channel interface for channel messaging in the main process."
    },
    "/docs/api/message-port-main": {
      "locale": "ru-RU",
      "slug": "message-port-main",
      "href": "/docs/api/message-port-main",
      "crowdinFileId": "256339",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/message-port-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messageportmain\"><a href=\"#messageportmain\">MessagePortMain</a></h1>\n<p><code>MessagePortMain</code> is the main-process-side equivalent of the DOM <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> object. It behaves similarly to the DOM version, with the exception that it uses the Node.js <code>EventEmitter</code> event system, instead of the DOM <code>EventTarget</code> system. This means you should use <code>port.on('message', ...)</code> to listen for events, instead of <code>port.onmessage = ...</code> or <code>port.addEventListener('message', ...)</code></p>\n<p>See the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> documentation for more information on using channel messaging.</p>\n<p><code>MessagePortMain</code> is an [EventEmitter][event-emitter].</p>\n<h2 id=\"class-messageportmain\"><a href=\"#class-messageportmain\">Class: MessagePortMain</a></h2>\n<blockquote>\n<p>Port interface for channel messaging in the main process.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<h4 id=\"portpostmessagemessage-transfer\"><a href=\"#portpostmessagemessage-transfer\"><code>port.postMessage(message, [transfer])</code></a></h4>\n<ul>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.</p>\n<h4 id=\"portstart\"><a href=\"#portstart\"><code>port.start()</code></a></h4>\n<p>Starts the sending of messages queued on the port. Messages will be queued until this method is called.</p>\n<h4 id=\"portclose\"><a href=\"#portclose\"><code>port.close()</code></a></h4>\n<p>Disconnects the port, so it is no longer active.</p>\n<h3 id=\"события-экземпляра\"><a href=\"#события-экземпляра\">События экземпляра</a></h3>\n<h4 id=\"событие-message\"><a href=\"#событие-message\">Событие: 'message'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li><code>messageEvent</code> Object<ul>\n<li><code>data</code> any</li>\n<li><code>ports</code> MessagePortMain[]</li>\n</ul></li>\n</ul>\n<p>Emitted when a MessagePortMain object receives a message.</p>\n<h4 id=\"событие-close\"><a href=\"#событие-close\">Событие: 'close'</a></h4>\n<p>Emitted when the remote end of a MessagePortMain object becomes disconnected.</p>",
      "title": "MessagePortMain",
      "description": "Port interface for channel messaging in the main process."
    },
    "/docs/tutorial/message-ports": {
      "locale": "ru-RU",
      "slug": "message-ports",
      "href": "/docs/tutorial/message-ports",
      "crowdinFileId": "256219",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/message-ports.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messageports-in-electron\"><a href=\"#messageports-in-electron\">MessagePorts in Electron</a></h1>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a>s are a web feature that allow passing messages between different contexts. It's like <code>window.postMessage</code>, but on different channels. The goal of this document is to describe how Electron extends the Channel Messaging model, and to give some examples of how you might use MessagePorts in your app.</p>\n<p>Here is a very brief example of what a MessagePort is and how it works:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer.js ///////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-comment\">// MessagePorts are created in pairs. A connected pair of message ports is</span>\n<span class=\"hljs-comment\">// called a channel.</span>\n<span class=\"hljs-keyword\">const</span> channel = <span class=\"hljs-keyword\">new</span> MessageChannel()\n\n<span class=\"hljs-comment\">// The only difference between port1 and port2 is in how you use them. Messages</span>\n<span class=\"hljs-comment\">// sent to port1 will be received by port2 and vice-versa.</span>\n<span class=\"hljs-keyword\">const</span> port1 = channel.port1\n<span class=\"hljs-keyword\">const</span> port2 = channel.port2\n\n<span class=\"hljs-comment\">// It's OK to send a message on the channel before the other end has registered</span>\n<span class=\"hljs-comment\">// a listener. Messages will be queued until a listener is registered.</span>\nport2.postMessage({ <span class=\"hljs-attr\">answer</span>: <span class=\"hljs-number\">42</span> })\n\n<span class=\"hljs-comment\">// Here we send the other end of the channel, port1, to the main process. It's</span>\n<span class=\"hljs-comment\">// also possible to send MessagePorts to other frames, or to Web Workers, etc.</span>\nipcRenderer.postMessage(<span class=\"hljs-string\">'port'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-comment\">// In the main process, we receive the port.</span>\nipcMain.on(<span class=\"hljs-string\">'port'</span>, (event) => {\n  <span class=\"hljs-comment\">// When we receive a MessagePort in the main process, it becomes a</span>\n  <span class=\"hljs-comment\">// MessagePortMain.</span>\n  <span class=\"hljs-keyword\">const</span> port = event.ports[<span class=\"hljs-number\">0</span>]\n\n  <span class=\"hljs-comment\">// MessagePortMain uses the Node.js-style events API, rather than the</span>\n  <span class=\"hljs-comment\">// web-style events API. So .on('message', ...) instead of .onmessage = ...</span>\n  port.on(<span class=\"hljs-string\">'message'</span>, (event) => {\n    <span class=\"hljs-comment\">// data is { answer: 42 }</span>\n    <span class=\"hljs-keyword\">const</span> data = event.data\n  })\n\n  <span class=\"hljs-comment\">// MessagePortMain queues messages until the .start() method has been called.</span>\n  port.start()\n})\n</code></pre>\n<p>The <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> documentation is a great way to learn more about how MessagePorts work.</p>\n<h2 id=\"messageports-in-the-main-process\"><a href=\"#messageports-in-the-main-process\">MessagePorts in the main process</a></h2>\n<p>In the renderer, the <code>MessagePort</code> class behaves exactly as it does on the web. The main process is not a web page, though—it has no Blink integration—and so it does not have the <code>MessagePort</code> or <code>MessageChannel</code> classes. In order to handle and interact with MessagePorts in the main process, Electron adds two new classes: <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> and <a href=\"/docs/api/message-channel-main\"><code>MessageChannelMain</code></a>. These behave similarly to the analogous classes in the renderer.</p>\n<p><code>MessagePort</code> objects can be created in either the renderer or the main process, and passed back and forth using the <a href=\"/docs/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a> and <a href=\"/docs/api/web-contents#contentspostmessagechannel-message-transfer\"><code>WebContents.postMessage</code></a> methods. Note that the usual IPC methods like <code>send</code> and <code>invoke</code> cannot be used to transfer <code>MessagePort</code>s, only the <code>postMessage</code> methods can transfer <code>MessagePort</code>s.</p>\n<p>By passing <code>MessagePort</code>s via the main process, you can connect two pages that might not otherwise be able to communicate (e.g. due to same-origin restrictions).</p>\n<h2 id=\"extension-close-event\"><a href=\"#extension-close-event\">Extension: <code>close</code> event</a></h2>\n<p>Electron adds one feature to <code>MessagePort</code> that isn't present on the web, in order to make MessagePorts more useful. That is the <code>close</code> event, which is emitted when the other end of the channel is closed. Ports can also be implicitly closed by being garbage-collected.</p>\n<p>In the renderer, you can listen for the <code>close</code> event either by assigning to <code>port.onclose</code> or by calling <code>port.addEventListener('close', ...)</code>. In the main process, you can listen for the <code>close</code> event by calling <code>port.on('close', ...)</code>.</p>\n<h2 id=\"example-use-cases\"><a href=\"#example-use-cases\">Example use cases</a></h2>\n<h3 id=\"worker-process\"><a href=\"#worker-process\">Worker process</a></h3>\n<p>In this example, your app has a worker process implemented as a hidden window. You want the app page to be able to communicate directly with the worker process, without the performance overhead of relaying via the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow, app, ipcMain, MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-comment\">// The worker process is a hidden BrowserWindow, so that it will have access</span>\n  <span class=\"hljs-comment\">// to a full Blink context (including e.g. &#x3C;canvas>, audio, fetch(), etc.)</span>\n  <span class=\"hljs-keyword\">const</span> worker = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span> }\n  })\n  <span class=\"hljs-keyword\">await</span> worker.loadFile(<span class=\"hljs-string\">'worker.html'</span>)\n\n  <span class=\"hljs-comment\">// The main window will send work to the worker process and receive results</span>\n  <span class=\"hljs-comment\">// over a MessagePort.</span>\n  <span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span> }\n  })\n  mainWindow.loadFile(<span class=\"hljs-string\">'app.html'</span>)\n\n  <span class=\"hljs-comment\">// We can't use ipcMain.handle() here, because the reply needs to transfer a</span>\n  <span class=\"hljs-comment\">// MessagePort.</span>\n  ipcMain.on(<span class=\"hljs-string\">'request-worker-channel'</span>, (event) => {\n    <span class=\"hljs-comment\">// For security reasons, let's make sure only the frames we expect can</span>\n    <span class=\"hljs-comment\">// access the worker.</span>\n    <span class=\"hljs-keyword\">if</span> (event.senderFrame === mainWindow.webContents.mainFrame) {\n      <span class=\"hljs-comment\">// Create a new channel ...</span>\n      <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\n      <span class=\"hljs-comment\">// ... send one end to the worker ...</span>\n      worker.webContents.postMessage(<span class=\"hljs-string\">'new-client'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n      <span class=\"hljs-comment\">// ... and the other end to the main window.</span>\n      event.senderFrame.postMessage(<span class=\"hljs-string\">'provide-worker-channel'</span>, <span class=\"hljs-literal\">null</span>, [port2])\n      <span class=\"hljs-comment\">// Now the main window and the worker can communicate with each other</span>\n      <span class=\"hljs-comment\">// without going through the main process!</span>\n    }\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- worker.html ------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">doWork</span>(<span class=\"hljs-params\">input</span>) </span>{\n  <span class=\"hljs-comment\">// Something cpu-intensive.</span>\n  <span class=\"hljs-keyword\">return</span> input * <span class=\"hljs-number\">2</span>\n}\n\n<span class=\"hljs-comment\">// We might get multiple clients, for instance if there are multiple windows,</span>\n<span class=\"hljs-comment\">// or if the main window reloads.</span>\nipcRenderer.on(<span class=\"hljs-string\">'new-client'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n  port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    <span class=\"hljs-comment\">// The event data can be any serializable object (and the event could even</span>\n    <span class=\"hljs-comment\">// carry other MessagePorts with it!)</span>\n    <span class=\"hljs-keyword\">const</span> result = doWork(event.data)\n    port.postMessage(result)\n  }\n})\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- app.html ---------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// We request that the main process sends us a channel we can use to</span>\n<span class=\"hljs-comment\">// communicate with the worker.</span>\nipcRenderer.send(<span class=\"hljs-string\">'request-worker-channel'</span>)\n\nipcRenderer.once(<span class=\"hljs-string\">'provide-worker-channel'</span>, (event) => {\n  <span class=\"hljs-comment\">// Once we receive the reply, we can take the port...</span>\n  <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n  <span class=\"hljs-comment\">// ... register a handler to receive results ...</span>\n  port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'received result:'</span>, event.data)\n  }\n  <span class=\"hljs-comment\">// ... and start sending it work!</span>\n  port.postMessage(<span class=\"hljs-number\">21</span>)\n})\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h3 id=\"reply-streams\"><a href=\"#reply-streams\">Reply streams</a></h3>\n<p>Electron's built-in IPC methods only support two modes: fire-and-forget (e.g. <code>send</code>), or request-response (e.g. <code>invoke</code>). Using MessageChannels, you can implement a \"response stream\", where a single request responds with a stream of data.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer.js ///////////////////////////////////////////////////////////////</span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">makeStreamingRequest</span> (<span class=\"hljs-params\">element, callback</span>) </span>{\n  <span class=\"hljs-comment\">// MessageChannels are lightweight--it's cheap to create a new one for each</span>\n  <span class=\"hljs-comment\">// request.</span>\n  <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannel()\n\n  <span class=\"hljs-comment\">// We send one end of the port to the main process ...</span>\n  ipcRenderer.postMessage(\n    <span class=\"hljs-string\">'give-me-a-stream'</span>,\n    { element, <span class=\"hljs-attr\">count</span>: <span class=\"hljs-number\">10</span> },\n    [port2]\n  )\n\n  <span class=\"hljs-comment\">// ... and we hang on to the other end. The main process will send messages</span>\n  <span class=\"hljs-comment\">// to its end of the port, and close it when it's finished.</span>\n  port1.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    callback(event.data)\n  }\n  port1.onclose = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'stream ended'</span>)\n  }\n}\n\nmakeStreamingRequest(<span class=\"hljs-number\">42</span>, (data) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'got response data:'</span>, event.data)\n})\n<span class=\"hljs-comment\">// We will see \"got response data: 42\" 10 times.</span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n\nipcMain.on(<span class=\"hljs-string\">'give-me-a-stream'</span>, (event, msg) => {\n  <span class=\"hljs-comment\">// The renderer has sent us a MessagePort that it wants us to send our</span>\n  <span class=\"hljs-comment\">// response over.</span>\n  <span class=\"hljs-keyword\">const</span> [replyPort] = event.ports\n\n  <span class=\"hljs-comment\">// Here we send the messages synchronously, but we could just as easily store</span>\n  <span class=\"hljs-comment\">// the port somewhere and send messages asynchronously.</span>\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">let</span> i = <span class=\"hljs-number\">0</span>; i &#x3C; msg.count; i++) {\n    replyPort.postMessage(msg.element)\n  }\n\n  <span class=\"hljs-comment\">// We close the port when we're done to indicate to the other end that we</span>\n  <span class=\"hljs-comment\">// won't be sending any more messages. This isn't strictly necessary--if we</span>\n  <span class=\"hljs-comment\">// didn't explicitly close the port, it would eventually be garbage</span>\n  <span class=\"hljs-comment\">// collected, which would also trigger the 'close' event in the renderer.</span>\n  replyPort.close()\n})\n</code></pre>\n<h3 id=\"communicating-directly-between-the-main-process-and-the-main-world-of-a-context-isolated-page\"><a href=\"#communicating-directly-between-the-main-process-and-the-main-world-of-a-context-isolated-page\">Communicating directly between the main process and the main world of a context-isolated page</a></h3>\n<p>When <a href=\"/docs/tutorial/context-isolation\">context isolation</a> is enabled, IPC messages from the main process to the renderer are delivered to the isolated world, rather than to the main world. Sometimes you want to deliver messages to the main world directly, without having to step through the isolated world.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow, app, MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-comment\">// Create a BrowserWindow with contextIsolation enabled.</span>\n  <span class=\"hljs-keyword\">const</span> bw = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">contextIsolation</span>: <span class=\"hljs-literal\">true</span>,\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n  bw.loadURL(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-comment\">// We'll be sending one end of this channel to the main world of the</span>\n  <span class=\"hljs-comment\">// context-isolated page.</span>\n  <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\n\n  <span class=\"hljs-comment\">// It's OK to send a message on the channel before the other end has</span>\n  <span class=\"hljs-comment\">// registered a listener. Messages will be queued until a listener is</span>\n  <span class=\"hljs-comment\">// registered.</span>\n  port2.postMessage({ <span class=\"hljs-attr\">test</span>: <span class=\"hljs-number\">21</span> })\n\n  <span class=\"hljs-comment\">// We can also receive messages from the main world of the renderer.</span>\n  port2.on(<span class=\"hljs-string\">'message'</span>, (event) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'from renderer main world:'</span>, event.data)\n  })\n  port2.start()\n\n  <span class=\"hljs-comment\">// The preload script will receive this IPC message and transfer the port</span>\n  <span class=\"hljs-comment\">// over to the main world.</span>\n  bw.webContents.postMessage(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// preload.js ////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// We need to wait until the main world is ready to receive the message before</span>\n<span class=\"hljs-comment\">// sending the port. We create this promise in the preload so it's guaranteed</span>\n<span class=\"hljs-comment\">// to register the onload listener before the load event is fired.</span>\n<span class=\"hljs-keyword\">const</span> windowLoaded = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> {\n  <span class=\"hljs-built_in\">window</span>.onload = resolve\n})\n\nipcRenderer.on(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-keyword\">async</span> (event) => {\n  <span class=\"hljs-keyword\">await</span> windowLoaded\n  <span class=\"hljs-comment\">// We use regular window.postMessage to transfer the port from the isolated</span>\n  <span class=\"hljs-comment\">// world to the main world.</span>\n  <span class=\"hljs-built_in\">window</span>.postMessage(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-string\">'*'</span>, event.ports)\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- index.html -------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-built_in\">window</span>.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n  <span class=\"hljs-comment\">// event.source === window means the message is coming from the preload</span>\n  <span class=\"hljs-comment\">// script, as opposed to from an &#x3C;iframe> or other source.</span>\n  <span class=\"hljs-keyword\">if</span> (event.source === <span class=\"hljs-built_in\">window</span> &#x26;&#x26; event.data === <span class=\"hljs-string\">'main-world-port'</span>) {\n    <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n    <span class=\"hljs-comment\">// Once we have the port, we can communicate directly with the main</span>\n    <span class=\"hljs-comment\">// process.</span>\n    port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'from main process:'</span>, event.data)\n      port.postMessage(event.data * <span class=\"hljs-number\">2</span>)\n    }\n  }\n}\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>",
      "title": "MessagePorts in Electron",
      "description": ""
    },
    "/docs/api/structures/mime-typed-buffer": {
      "locale": "ru-RU",
      "slug": "mime-typed-buffer",
      "href": "/docs/api/structures/mime-typed-buffer",
      "crowdinFileId": "256463",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mime-typed-buffer.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mimetypedbuffer-object\"><a href=\"#mimetypedbuffer-object\">MimeTypedBuffer Object</a></h1>\n<ul>\n<li><code>mimeType</code> String (optional) - MIME type of the buffer.</li>\n<li><code>charset</code> String (optional) - Charset of the buffer.</li>\n<li><code>data</code> Buffer - The actual Buffer content.</li>\n</ul>",
      "title": "MimeTypedBuffer Object",
      "description": ""
    },
    "/docs/api/structures/mouse-input-event": {
      "locale": "ru-RU",
      "slug": "mouse-input-event",
      "href": "/docs/api/structures/mouse-input-event",
      "crowdinFileId": "256465",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mouse-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mouseinputevent-object-extends-inputevent\"><a href=\"#mouseinputevent-object-extends-inputevent\">MouseInputEvent Object extends <code>InputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>mouseDown</code>, <code>mouseUp</code>, <code>mouseEnter</code>, <code>mouseLeave</code>, <code>contextMenu</code>, <code>mouseWheel</code> or <code>mouseMove</code>.</li>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n<li><code>button</code> String (optional) - The button pressed, can be <code>left</code>, <code>middle</code>, <code>right</code>.</li>\n<li><code>globalX</code> Integer (optional)</li>\n<li><code>globalY</code> Integer (optional)</li>\n<li><code>movementX</code> Integer (optional)</li>\n<li><code>movementY</code> Integer (optional)</li>\n<li><code>clickCount</code> Integer (optional)</li>\n</ul>",
      "title": "MouseInputEvent Object extends InputEvent",
      "description": ""
    },
    "/docs/api/structures/mouse-wheel-input-event": {
      "locale": "ru-RU",
      "slug": "mouse-wheel-input-event",
      "href": "/docs/api/structures/mouse-wheel-input-event",
      "crowdinFileId": "256467",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mouse-wheel-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mousewheelinputevent-object-extends-mouseinputevent\"><a href=\"#mousewheelinputevent-object-extends-mouseinputevent\">MouseWheelInputEvent Object extends <code>MouseInputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>mouseWheel</code>.</li>\n<li><code>deltaX</code> Integer (optional)</li>\n<li><code>deltaY</code> Integer (optional)</li>\n<li><code>wheelTicksX</code> Integer (optional)</li>\n<li><code>wheelTicksY</code> Integer (optional)</li>\n<li><code>accelerationRatioX</code> Integer (optional)</li>\n<li><code>accelerationRatioY</code> Integer (optional)</li>\n<li><code>hasPreciseScrollingDeltas</code> Boolean (optional)</li>\n<li><code>canScroll</code> Boolean (optional)</li>\n</ul>",
      "title": "MouseWheelInputEvent Object extends MouseInputEvent",
      "description": ""
    },
    "/docs/tutorial/multithreading": {
      "locale": "ru-RU",
      "slug": "multithreading",
      "href": "/docs/tutorial/multithreading",
      "crowdinFileId": "256221",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/multithreading.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"многопоточность\"><a href=\"#многопоточность\">Многопоточность</a></h1>\n<p>С помощью <a href=\"https://developer.mozilla.org/en/docs/Web/API/Web_Workers_API/Using_web_workers\">Web Workers</a>, есть возможность запускать JavaScript в потоках на уровне операционной системы.</p>\n<h2 id=\"многопоточный-nodejs\"><a href=\"#многопоточный-nodejs\">Многопоточный Node.js</a></h2>\n<p>It is possible to use Node.js features in Electron's Web Workers, to do so the <code>nodeIntegrationInWorker</code> option should be set to <code>true</code> in <code>webPreferences</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegrationInWorker</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<p>The <code>nodeIntegrationInWorker</code> can be used independent of <code>nodeIntegration</code>, but <code>sandbox</code> must not be set to <code>true</code>.</p>\n<h2 id=\"available-apis\"><a href=\"#available-apis\">Available APIs</a></h2>\n<p>All built-in modules of Node.js are supported in Web Workers, and <code>asar</code> archives can still be read with Node.js APIs. However none of Electron's built-in modules can be used in a multi-threaded environment.</p>\n<h2 id=\"native-nodejs-modules\"><a href=\"#native-nodejs-modules\">Native Node.js modules</a></h2>\n<p>Any native Node.js module can be loaded directly in Web Workers, but it is strongly recommended not to do so. Most existing native modules have been written assuming single-threaded environment, using them in Web Workers will lead to crashes and memory corruptions.</p>\n<p>Note that even if a native Node.js module is thread-safe it's still not safe to load it in a Web Worker because the <code>process.dlopen</code> function is not thread safe.</p>\n<p>The only way to load a native module safely for now, is to make sure the app loads no native modules after the Web Workers get started.</p>\n<pre><code class=\"hljs language-javascript\">process.dlopen = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Load native module is not safe'</span>)\n}\n<span class=\"hljs-keyword\">const</span> worker = <span class=\"hljs-keyword\">new</span> Worker(<span class=\"hljs-string\">'script.js'</span>)\n</code></pre>",
      "title": "Многопоточность",
      "description": ""
    },
    "/docs/tutorial/native-file-drag-drop": {
      "locale": "ru-RU",
      "slug": "native-file-drag-drop",
      "href": "/docs/tutorial/native-file-drag-drop",
      "crowdinFileId": "256223",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/native-file-drag-drop.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"нативное-перемещение-файла\"><a href=\"#нативное-перемещение-файла\">Нативное перемещение файла</a></h1>\n<h2 id=\"обзор\"><a href=\"#обзор\">Обзор</a></h2>\n<p>Некоторым приложениям может понадобиться поддержка реализованной в операционной системе функции перетаскивания файлов. Перетаскивание файлов в веб-контент поддерживается большинством веб-сайтов. Electron дополнительно поддерживает перетаскивание файлов и содержимого приложения в операционную систему.</p>\n<p>To implement this feature in your app, you need to call the <a href=\"/docs/api/web-contents#contentsstartdragitem\"><code>webContents.startDrag(item)</code></a> API in response to the <code>ondragstart</code> event.</p>\n<h2 id=\"пример\"><a href=\"#пример\">Пример</a></h2>\n<p>An example demonstrating how you can create a file on the fly to be dragged out of the window.</p>\n<h3 id=\"preloadjs\"><a href=\"#preloadjs\">Preload.js</a></h3>\n<p>In <code>preload.js</code> use the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> to inject a method <code>window.electron.startDrag(...)</code> that will send an IPC message to the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'electron'</span>, {\n  <span class=\"hljs-attr\">startDrag</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">fileName</span>) =></span> {\n    ipcRenderer.send(<span class=\"hljs-string\">'ondragstart'</span>, path.join(process.cwd(), fileName))\n  }\n})\n</code></pre>\n<h3 id=\"indexhtml\"><a href=\"#indexhtml\">Index.html</a></h3>\n<p>Add a draggable element to <code>index.html</code>, and reference your renderer script:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">div</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"border:2px solid black;border-radius:3px;padding:5px;display:inline-block\"</span> <span class=\"hljs-attr\">draggable</span>=<span class=\"hljs-string\">\"true\"</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"drag\"</span>></span>Drag me<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">div</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h3 id=\"rendererjs\"><a href=\"#rendererjs\">Renderer.js</a></h3>\n<p>In <code>renderer.js</code> set up the renderer process to handle drag events by calling the method you added via the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> above.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'drag'</span>).ondragstart = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n  event.preventDefault()\n  <span class=\"hljs-built_in\">window</span>.electron.startDrag(<span class=\"hljs-string\">'drag-and-drop.md'</span>)\n}\n</code></pre>\n<h3 id=\"mainjs\"><a href=\"#mainjs\">Main.js</a></h3>\n<p>In the Main process (<code>main.js</code> file), expand the received event with a path to the file that is being dragged and an icon:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/drag-and-drop\"><span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nipcMain.on(<span class=\"hljs-string\">'ondragstart'</span>, (event, filePath) => {\n  event.sender.startDrag({\n    <span class=\"hljs-attr\">file</span>: filePath,\n    <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'/path/to/icon.png'</span>\n  })\n})\n</code></pre>\n<p>After launching the Electron application, try dragging and dropping the item from the BrowserWindow onto your desktop. In this guide, the item is a Markdown file located in the root of the project:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/drag-and-drop.gif\" alt=\"Drag and drop\"></p>",
      "title": "Нативное перемещение файла",
      "description": ""
    },
    "/docs/api/native-image": {
      "locale": "ru-RU",
      "slug": "native-image",
      "href": "/docs/api/native-image",
      "crowdinFileId": "256341",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/native-image.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nativeimage\"><a href=\"#nativeimage\">nativeImage</a></h1>\n<blockquote>\n<p>Создает иконки приложения, в том числе для системного лотка (Windows), дока (macOS), используя файлы PNG и JPG.</p>\n</blockquote>\n<p>Процессы: <a href=\"/docs/glossary#main-process\">Основной</a>, <a href=\"/docs/glossary#renderer-process\">Графический</a></p>\n<p>In Electron, for the APIs that take images, you can pass either file paths or <code>NativeImage</code> instances. An empty image will be used when <code>null</code> is passed.</p>\n<p>Например, при создании вкладки в области уведомлений или установке иконки окна можно задать путь к файлу изображения в виде <code>String</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'/Users/somebody/images/window.png'</span> })\n<span class=\"hljs-built_in\">console</span>.log(appIcon, win)\n</code></pre>\n<p>Or read the image from the clipboard, which returns a <code>NativeImage</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { clipboard, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> image = clipboard.readImage()\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(image)\n<span class=\"hljs-built_in\">console</span>.log(appIcon)\n</code></pre>\n<h2 id=\"поддерживаемые-форматы\"><a href=\"#поддерживаемые-форматы\">Поддерживаемые форматы</a></h2>\n<p>Currently <code>PNG</code> and <code>JPEG</code> image formats are supported. <code>PNG</code> is recommended because of its support for transparency and lossless compression.</p>\n<p>On Windows, you can also load <code>ICO</code> icons from file paths. For best visual quality, it is recommended to include at least the following sizes in the:</p>\n<ul>\n<li>Мелкие значки<ul>\n<li>16x16 (100% DPI scale)</li>\n<li>20x20 (125% DPI scale)</li>\n<li>24x24 (150% DPI scale)</li>\n<li>32x32 (200% DPI scale)</li>\n</ul></li>\n<li>Большие значки<ul>\n<li>32x32 (100% DPI scale)</li>\n<li>40x40 (125% DPI scale)</li>\n<li>48x48 (150% DPI scale)</li>\n<li>64x64 (200% DPI scale)</li>\n<li>256x256</li>\n</ul></li>\n</ul>\n<p>Проверьте раздел <em>Size requirements</em> в <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dn742485(v=vs.85).aspx\">этой статье</a>.</p>\n<h2 id=\"изображения-с-высоким-разрешением\"><a href=\"#изображения-с-высоким-разрешением\">Изображения с высоким разрешением</a></h2>\n<p>На платформах, имеющих поддержку высокого DPI, таких как дисплеи Apple Retina, вы можете добавить <code>@2x</code> после имени файла изображения, чтобы пометить его как изображение с высоким разрешением.</p>\n<p>For example, if <code>icon.png</code> is a normal image that has standard resolution, then <code>icon@2x.png</code> will be treated as a high resolution image that has double DPI density.</p>\n<p>If you want to support displays with different DPI densities at the same time, you can put images with different sizes in the same folder and use the filename without DPI suffixes. Например:</p>\n<pre><code class=\"hljs language-plaintext\">images/\n├── icon.png\n├── icon@2x.png\n└── icon@3x.png\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-built_in\">console</span>.log(appIcon)\n</code></pre>\n<p>The following suffixes for DPI are also supported:</p>\n<ul>\n<li><code>@1x</code></li>\n<li><code>@1.25x</code></li>\n<li><code>@1.33x</code></li>\n<li><code>@1.4x</code></li>\n<li><code>@1.5x</code></li>\n<li><code>@1.8x</code></li>\n<li><code>@2x</code></li>\n<li><code>@2.5x</code></li>\n<li><code>@3x</code></li>\n<li><code>@4x</code></li>\n<li><code>@5x</code></li>\n</ul>\n<h2 id=\"шаблон-изображения\"><a href=\"#шаблон-изображения\">Шаблон изображения</a></h2>\n<p>Template images consist of black and an alpha channel. Template images are not intended to be used as standalone images and are usually mixed with other content to create the desired final appearance.</p>\n<p>The most common case is to use template images for a menu bar icon, so it can adapt to both light and dark menu bars.</p>\n<p><strong>Внимание:</strong> Шаблонные изображения поддерживаются только на macOS.</p>\n<p>To mark an image as a template image, its filename should end with the word <code>Template</code>. Например:</p>\n<ul>\n<li><code>xxxTemplate.png</code></li>\n<li><code>xxxTemplate@2x.png</code></li>\n</ul>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code>nativeImage</code> имеет следующие методы, все из которых возвращают экземпляр класса <code>NativeImage</code>:</p>\n<h3 id=\"nativeimagecreateempty\"><a href=\"#nativeimagecreateempty\"><code>nativeImage.createEmpty()</code></a></h3>\n<p>Возвращает <code>NativeImage</code></p>\n<p>Создает пустой экземпляр <code>NativeImage</code>.</p>\n<h3 id=\"nativeimagecreatethumbnailfrompathpath-maxsize-macos-windows\"><a href=\"#nativeimagecreatethumbnailfrompathpath-maxsize-macos-windows\"><code>nativeImage.createThumbnailFromPath(path, maxSize)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>path</code> String - path to a file that we intend to construct a thumbnail out of.</li>\n<li><code>maxSize</code> <a href=\"/docs/api/structures/size\">Size</a> - the maximum width and height (positive numbers) the thumbnail returned can be. The Windows implementation will ignore <code>maxSize.height</code> and scale the height according to <code>maxSize.width</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - fulfilled with the file's thumbnail preview image, which is a <a href=\"/docs/api/native-image\">NativeImage</a>.</p>\n<h3 id=\"nativeimagecreatefrompathpath\"><a href=\"#nativeimagecreatefrompathpath\"><code>nativeImage.createFromPath(path)</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Возвращает <code>NativeImage</code></p>\n<p>Создает новый экземпляр <code>NativeImage</code> из файла, расположенного по адресу <code>path</code>. Этот метод возвращает пустое изображение, если путь <code>path</code> не существует, не может быть прочитан или является некорректным.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> nativeImage = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).nativeImage\n\n<span class=\"hljs-keyword\">const</span> image = nativeImage.createFromPath(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-built_in\">console</span>.log(image)\n</code></pre>\n<h3 id=\"nativeimagecreatefrombitmapbuffer-options\"><a href=\"#nativeimagecreatefrombitmapbuffer-options\"><code>nativeImage.createFromBitmap(buffer, options)</code></a></h3>\n<ul>\n<li><code>buffer</code> <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a></li>\n<li><code>options</code> Object<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>scaleFactor</code> Double (опционально) - По умолчанию 1.0.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>NativeImage</code></p>\n<p>Creates a new <code>NativeImage</code> instance from <code>buffer</code> that contains the raw bitmap pixel data returned by <code>toBitmap()</code>. The specific format is platform-dependent.</p>\n<h3 id=\"nativeimagecreatefrombufferbuffer-options\"><a href=\"#nativeimagecreatefrombufferbuffer-options\"><code>nativeImage.createFromBuffer(buffer[, options])</code></a></h3>\n<ul>\n<li><code>buffer</code> <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a></li>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>width</code> Integer (опционально) - требуется для буферов растровых изображений.</li>\n<li><code>height</code> Integer (опционально) - требуется для буферов растровых изображений.</li>\n<li><code>scaleFactor</code> Double (опционально) - По умолчанию 1.0.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>NativeImage</code></p>\n<p>Создает новый <code>NativeImage</code> из <code>buffer</code>. Tries to decode as PNG or JPEG first.</p>\n<h3 id=\"nativeimagecreatefromdataurldataurl\"><a href=\"#nativeimagecreatefromdataurldataurl\"><code>nativeImage.createFromDataURL(dataURL)</code></a></h3>\n<ul>\n<li><code>dataURL</code> String</li>\n</ul>\n<p>Возвращает <code>NativeImage</code></p>\n<p>Создает новый <code>NativeImage</code> из <code>dataURL</code>.</p>\n<h3 id=\"nativeimagecreatefromnamedimageimagename-hslshift-macos\"><a href=\"#nativeimagecreatefromnamedimageimagename-hslshift-macos\"><code>nativeImage.createFromNamedImage(imageName[, hslShift])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>imageName</code> String</li>\n<li><code>hslShift</code> Number<a href=\"/docs/api/%D0%BE%D0%BF%D1%86%D0%B8%D0%BE%D0%BD%D0%B0%D0%BB%D1%8C%D0%BD%D0%BE\"></a></li>\n</ul>\n<p>Возвращает <code>NativeImage</code></p>\n<p>Создает новый экземпляр <code>NativeImage</code> из NSImage, который сопоставляется с заданным именем изображения. Смотрите <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/system-icons/\"><code>System Icons</code></a> для получения списка возможных значений.</p>\n<p><code>hslShift</code> применяется к изображению со следующими правилами:</p>\n<ul>\n<li><code>hsl_shift[0]</code> (hue): The absolute hue value for the image - 0 and 1 map to 0 and 360 on the hue color wheel (red).</li>\n<li><code>hsl_shift[1]</code> (saturation): A saturation shift for the image, with the following key values: 0 = remove all color. 0,5 = оставить без изменений. 1 = fully saturate the image.</li>\n<li><code>hsl_shift[2]</code> (lightness): A lightness shift for the image, with the following key values: 0 = remove all lightness (make all pixels black). 0,5 = оставить без изменений. 1 = полная яркость (сделать все точки белыми).</li>\n</ul>\n<p>Это означает, что <code>[-1, 0, 1]</code> сделает изображение полностью белым, а <code>[-1, 1, 0]</code> сделает изображение полностью чёрным.</p>\n<p>В некоторых случаях <code>NSImageName</code> не соответствует строковому представлению; одним из примеров может служить <code>NSFolderImageName</code>, строковое представление которого будет <code>NSFolder</code>. Поэтому вам нужно определить правильное представление строк для вашего изображения, перед тем как его передавать. Это можно сделать следующим образом:</p>\n<p><code>echo -e '#import &#x3C;Cocoa/Cocoa.h>\\nint main() { NSLog(@\"%@\", SYSTEM_IMAGE_NAME); }' | clang -otest -x objective-c -framework Cocoa - &#x26;&#x26; ./test</code></p>\n<p>где <code>SYSTEM_IMAGE_NAME</code> следует заменить любым значением из <a href=\"https://developer.apple.com/documentation/appkit/nsimagename?language=objc\">этого списка</a>.</p>\n<h2 id=\"класс-nativeimage\"><a href=\"#класс-nativeimage\">Класс: NativeImage</a></h2>\n<blockquote>\n<p>Встроенная упаковка изображений, таких как область уведомлений, док-станция и значки приложений.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<p>Для экземпляров класса <code>NativeImage</code> доступны следующие методы:</p>\n<h4 id=\"imagetopngoptions\"><a href=\"#imagetopngoptions\"><code>image.toPNG([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>scaleFactor</code> Double (опционально) - По умолчанию 1.0.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Buffer</code> - A <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a>, который содержит закодированные данные изображения <code>PNG</code>.</p>\n<h4 id=\"imagetojpegquality\"><a href=\"#imagetojpegquality\"><code>image.toJPEG(quality)</code></a></h4>\n<ul>\n<li><code>quality</code> Integer - Качество От 0 до 100.</li>\n</ul>\n<p>Возвращает <code>Buffer</code> - A <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a>, который содержит закодированные данные изображения <code>JPEG</code>.</p>\n<h4 id=\"imagetobitmapoptions\"><a href=\"#imagetobitmapoptions\"><code>image.toBitmap([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>scaleFactor</code> Double (опционально) - По умолчанию 1.0.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Buffer</code> - <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a>, который содержит копию сырых данных растровых пикселей изображения.</p>\n<h4 id=\"imagetodataurloptions\"><a href=\"#imagetodataurloptions\"><code>image.toDataURL([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>scaleFactor</code> Double (опционально) - По умолчанию 1.0.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>String</code> - данные URL изображения.</p>\n<h4 id=\"imagegetbitmapoptions\"><a href=\"#imagegetbitmapoptions\"><code>image.getBitmap([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>scaleFactor</code> Double (опционально) - По умолчанию 1.0.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Buffer</code> - <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a>, который содержит сырые данные растровых пикселей изображения.</p>\n<p>The difference between <code>getBitmap()</code> and <code>toBitmap()</code> is that <code>getBitmap()</code> does not copy the bitmap data, so you have to use the returned Buffer immediately in current event loop tick; otherwise the data might be changed or destroyed.</p>\n<h4 id=\"imagegetnativehandle-macos\"><a href=\"#imagegetnativehandle-macos\"><code>image.getNativeHandle()</code> <em>macOS</em></a></h4>\n<p>Возвращает <code>Buffer</code> - <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> в котором хранится указатель C на базовый собственный дескриптор изображения. На macOS возвращается указатель на экземпляр <code>NSImage</code>.</p>\n<p>Обратите внимание, что возвращаемый указатель - это слабый указатель на исходное изображение, а не на копию, поэтому вы <em>должны</em> убедиться, что связанный с ним экземпляр <code>NativeImage</code> находится рядом.</p>\n<h4 id=\"imageisempty\"><a href=\"#imageisempty\"><code>image.isEmpty()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the image is empty.</p>\n<h4 id=\"imagegetsizescalefactor\"><a href=\"#imagegetsizescalefactor\"><code>image.getSize([scaleFactor])</code></a></h4>\n<ul>\n<li><code>scaleFactor</code> Double (опционально) - По умолчанию 1.0.</li>\n</ul>\n<p>Возвращает <a href=\"/docs/api/structures/size\"><code>Size</code></a>.</p>\n<p>If <code>scaleFactor</code> is passed, this will return the size corresponding to the image representation most closely matching the passed value.</p>\n<h4 id=\"imagesettemplateimageoption\"><a href=\"#imagesettemplateimageoption\"><code>image.setTemplateImage(option)</code></a></h4>\n<ul>\n<li><code>option</code> Boolean</li>\n</ul>\n<p>Marks the image as a template image.</p>\n<h4 id=\"imageistemplateimage\"><a href=\"#imageistemplateimage\"><code>image.isTemplateImage()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the image is a template image.</p>\n<h4 id=\"imagecroprect\"><a href=\"#imagecroprect\"><code>image.crop(rect)</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - область изображения до которой нужно обрезать.</li>\n</ul>\n<p>Возвращает <code>NativeImage</code> - обрезанное изображение.</p>\n<h4 id=\"imageresizeoptions\"><a href=\"#imageresizeoptions\"><code>image.resize(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>width</code> Integer (optional) - Defaults to the image's width.</li>\n<li><code>height</code> Integer (optional) - Defaults to the image's height.</li>\n<li><code>quality</code> String (optional) - The desired quality of the resize image. Possible values are <code>good</code>, <code>better</code>, or <code>best</code>. The default is <code>best</code>. These values express a desired quality/speed tradeoff. They are translated into an algorithm-specific method that depends on the capabilities (CPU, GPU) of the underlying platform. It is possible for all three methods to be mapped to the same algorithm on a given platform.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>NativeImage</code> - измененый размер изображения.</p>\n<p>Если указаны только <code>height</code> или <code>width</code>, то текущее соотношение сторон будет сохранено в изображении.</p>\n<h4 id=\"imagegetaspectratioscalefactor\"><a href=\"#imagegetaspectratioscalefactor\"><code>image.getAspectRatio([scaleFactor])</code></a></h4>\n<ul>\n<li><code>scaleFactor</code> Double (опционально) - По умолчанию 1.0.</li>\n</ul>\n<p>Возвращает <code>Float</code> - пропорции изображения.</p>\n<p>If <code>scaleFactor</code> is passed, this will return the aspect ratio corresponding to the image representation most closely matching the passed value.</p>\n<h4 id=\"imagegetscalefactors\"><a href=\"#imagegetscalefactors\"><code>image.getScaleFactors()</code></a></h4>\n<p>Returns <code>Float[]</code> - An array of all scale factors corresponding to representations for a given nativeImage.</p>\n<h4 id=\"imageaddrepresentationoptions\"><a href=\"#imageaddrepresentationoptions\"><code>image.addRepresentation(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>scaleFactor</code> Double - The scale factor to add the image representation for.</li>\n<li><code>width</code> Integer (optional) - Defaults to 0. Required if a bitmap buffer is specified as <code>buffer</code>.</li>\n<li><code>height</code> Integer (optional) - Defaults to 0. Required if a bitmap buffer is specified as <code>buffer</code>.</li>\n<li><code>buffer</code> Buffer (optional) - The buffer containing the raw image data.</li>\n<li><code>dataURL</code> String (optional) - The data URL containing either a base 64 encoded PNG or JPEG image.</li>\n</ul></li>\n</ul>\n<p>Add an image representation for a specific scale factor. This can be used to explicitly add different scale factor representations to an image. This can be called on empty images.</p>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<h4 id=\"nativeimageismactemplateimage-macos\"><a href=\"#nativeimageismactemplateimage-macos\"><code>nativeImage.isMacTemplateImage</code> <em>macOS</em></a></h4>\n<p>Свойство <code>Boolean</code> определяет, считается ли <a href=\"https://developer.apple.com/documentation/appkit/nsimage/1520017-template\">изображение шаблоном</a>.</p>\n<p>Пожалуйста, обратите внимание, что это свойство влияет только на macOS.</p>",
      "title": "nativeImage",
      "description": "Создает иконки приложения, в том числе для системного лотка (Windows), дока (macOS), используя файлы PNG и JPG."
    },
    "/docs/api/native-theme": {
      "locale": "ru-RU",
      "slug": "native-theme",
      "href": "/docs/api/native-theme",
      "crowdinFileId": "256343",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/native-theme.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nativetheme-родная-тема\"><a href=\"#nativetheme-родная-тема\">nativeTheme (Родная тема)</a></h1>\n<blockquote>\n<p>Читайте и реагируйте на изменения в родной цветовой теме Chromium.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<h2 id=\"события\"><a href=\"#события\">События</a></h2>\n<p>Объект <code>nativeTheme</code> имеет следующие события:</p>\n<h3 id=\"событие-updated\"><a href=\"#событие-updated\">Событие: 'updated'</a></h3>\n<p>Возникает, когда в основной NativeTheme что-то изменилось. Это обычно означает, что значение <code>shouldUseDarkColors</code> (использовать темные цвета), <code>shouldUseHighContrastColors</code> (использовать высококонтрастные цвета) или <code>shouldUseInvertedColorScheme</code> (использовать инвертированную цветовую гамму) - изменилось. Вам придется проверить их для того, чтобы определить, какие из них были изменены.</p>\n<h2 id=\"свойства\"><a href=\"#свойства\">Свойства</a></h2>\n<p>Объект <code>nativeTheme</code> имеет следующие свойства:</p>\n<h3 id=\"nativethemeshouldusedarkcolors-только-чтение\"><a href=\"#nativethemeshouldusedarkcolors-только-чтение\"><code>nativeTheme.shouldUseDarkColors</code> <em>Только чтение</em></a></h3>\n<p><code>Boolean</code> - в данный момент для текущей OS / Chromium включен темный режим или дается указание отображать пользовательский интерфейс в темном режиме.  Если вы хотите изменить это значение, вы должны использовать <code>themeSource</code> ниже.</p>\n<h3 id=\"nativethemethemesource\"><a href=\"#nativethemethemesource\"><code>nativeTheme.themeSource</code></a></h3>\n<p>Свойство <code>String</code> может быть <code>system</code>, <code>light</code> или <code>dark</code>.  It is used to override and supersede the value that Chromium has chosen to use internally.</p>\n<p>Установка этого свойства на <code>system</code> удалит переопределение и все будет сброшено на установленное ОС по умолчанию.  По умолчанию <code>themeSource</code> является <code>system</code>.</p>\n<p>Параметры свойства <code>dark</code> имеют следующие эффекты:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code> при обращении будет <code>true</code></li>\n<li>Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the dark UI.</li>\n<li>Any UI the OS renders on macOS including menus, window frames, etc. will use the dark UI.</li>\n<li>Запрос <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> CSS будет соответствовать режиму <code>dark</code>.</li>\n<li>Возникнет событие <code>updated</code></li>\n</ul>\n<p>Параметры свойства <code>light</code> имеют следующие эффекты:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code> при обращении будет <code>false</code></li>\n<li>Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the light UI.</li>\n<li>Any UI the OS renders on macOS including menus, window frames, etc. will use the light UI.</li>\n<li>Запрос <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> CSS будет соответствовать режиму <code>light</code>.</li>\n<li>Возникнет событие <code>updated</code></li>\n</ul>\n<p>Использование этого свойства должно совпадать с классическим \"темным режимом\" машины в вашем приложении, где у пользователя есть три варианта.</p>\n<ul>\n<li><code>Follow OS</code> --> <code>themeSource = 'system'</code></li>\n<li><code>Dark Mode</code> --> <code>themeSource = 'dark'</code></li>\n<li><code>Light Mode</code> --> <code>themeSource = 'light'</code></li>\n</ul>\n<p>В этом случае ваше приложение должно всегда использовать <code>shouldUseDarkColors</code>, чтобы определить, какой CSS будет применяться.</p>\n<h3 id=\"nativethemeshouldusehighcontrastcolors-macos-windows-только-чтение\"><a href=\"#nativethemeshouldusehighcontrastcolors-macos-windows-только-чтение\"><code>nativeTheme.shouldUseHighContrastColors</code> <em>macOS</em> <em>Windows</em> <em>Только чтение</em></a></h3>\n<p>A <code>Boolean</code> for if the OS / Chromium currently has high-contrast mode enabled or is being instructed to show a high-contrast UI.</p>\n<h3 id=\"nativethemeshoulduseinvertedcolorscheme-macos-windows-только-чтение\"><a href=\"#nativethemeshoulduseinvertedcolorscheme-macos-windows-только-чтение\"><code>nativeTheme.shouldUseInvertedColorScheme</code> <em>macOS</em> <em>Windows</em> <em>Только чтение</em></a></h3>\n<p><code>Boolean</code> - в данный момент для текущей OS / Chromium включен режим инвертирования цветовой схемы или дается указание отображать пользовательский интерфейс с инвертированной цветовой схемой.</p>",
      "title": "nativeTheme (Родная тема)",
      "description": "Читайте и реагируйте на изменения в родной цветовой теме Chromium."
    },
    "/docs/api/net": {
      "locale": "ru-RU",
      "slug": "net",
      "href": "/docs/api/net",
      "crowdinFileId": "256347",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/net.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"net\"><a href=\"#net\">net</a></h1>\n<blockquote>\n<p>Выполнение HTTP/HTTPS запросов с использованием родной сетевой библиотеки Chromium</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p>Модуль <code>net</code> представляет собой клиентский API для выдачи HTTP(S) запросов. Он похож на модули <a href=\"https://nodejs.org/api/http.html\">HTTP</a> и <a href=\"https://nodejs.org/api/https.html\">HTTPS</a> в Node.js, но использует собственную сетевую библиотеку Chromium вместо реализации Node.js, обеспечивая лучшую поддержку веб-прокси. It also supports checking network status.</p>\n<p>Ниже приведен неполный список причин, по которым вы можете рассмотреть использование модуля <code>net</code> вместо собственных модулей Node.js:</p>\n<ul>\n<li>Автоматическое управление конфигурацией прокси системы, поддержка протокола wpad и файлов pac конфигурации прокси.</li>\n<li>Автоматическое туннелирование HTTPS запросов.</li>\n<li>Поддержка аутентификации прокси с помощью BASIC, DIGEST, NTLM, KERBEROS или NEGOTIATE схем аутентификации.</li>\n<li>Поддержка прокси-серверов для мониторинга трафика: Fiddler-подобные прокси, используемые для контроля доступа и мониторинга.</li>\n</ul>\n<p>Компоненты API (включая классы, методы, свойства и имена событий) похожи на компоненты, используемые в Node.js.</p>\n<p>Пример использования:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> { net } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n  <span class=\"hljs-keyword\">const</span> request = net.request(<span class=\"hljs-string\">'https://github.com'</span>)\n  request.on(<span class=\"hljs-string\">'response'</span>, (response) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`STATUS: <span class=\"hljs-subst\">${response.statusCode}</span>`</span>)\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`HEADERS: <span class=\"hljs-subst\">${<span class=\"hljs-built_in\">JSON</span>.stringify(response.headers)}</span>`</span>)\n    response.on(<span class=\"hljs-string\">'data'</span>, (chunk) => {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`BODY: <span class=\"hljs-subst\">${chunk}</span>`</span>)\n    })\n    response.on(<span class=\"hljs-string\">'end'</span>, () => {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'No more data in response.'</span>)\n    })\n  })\n  request.end()\n})\n</code></pre>\n<p>The <code>net</code> API can be used only after the application emits the <code>ready</code> event. Trying to use the module before the <code>ready</code> event will throw an error.</p>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code>net</code> имеет следующие методы:</p>\n<h3 id=\"netrequestoptions\"><a href=\"#netrequestoptions\"><code>net.request(options)</code></a></h3>\n<ul>\n<li><code>options</code> (ClientRequestConstructorOptions | String) - Параметры конструктора <code>ClientRequest</code>.</li>\n</ul>\n<p>Возвращает <a href=\"/docs/api/client-request\"><code>ClientRequest</code></a></p>\n<p>Создает экземпляр <a href=\"/docs/api/client-request\"><code>ClientRequest</code></a>, используя предоставленные <code>options</code>, которые напрямую передаются конструктору <code>ClientRequest</code>. Метод <code>net.request</code> будет использован для выполнения как безопасных, так и небезопасных HTTP-запросов в соответствии со схемой указанного протокола в объекте <code>options</code>.</p>\n<h3 id=\"netisonline\"><a href=\"#netisonline\"><code>net.isOnline()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether there is currently internet connection.</p>\n<p>A return value of <code>false</code> is a pretty strong indicator that the user won't be able to connect to remote sites. However, a return value of <code>true</code> is inconclusive; even if some link is up, it is uncertain whether a particular connection attempt to a particular remote site will be successful.</p>\n<h2 id=\"свойства\"><a href=\"#свойства\">Свойства</a></h2>\n<h3 id=\"netonline-только-чтение\"><a href=\"#netonline-только-чтение\"><code>net.online</code> <em>Только чтение</em></a></h3>\n<p>A <code>Boolean</code> property. Whether there is currently internet connection.</p>\n<p>A return value of <code>false</code> is a pretty strong indicator that the user won't be able to connect to remote sites. However, a return value of <code>true</code> is inconclusive; even if some link is up, it is uncertain whether a particular connection attempt to a particular remote site will be successful.</p>",
      "title": "net",
      "description": "Выполнение HTTP/HTTPS запросов с использованием родной сетевой библиотеки Chromium"
    },
    "/docs/api/net-log": {
      "locale": "ru-RU",
      "slug": "net-log",
      "href": "/docs/api/net-log",
      "crowdinFileId": "256345",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/net-log.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"netlog\"><a href=\"#netlog\">netLog</a></h1>\n<blockquote>\n<p>Журналирование сетевых событий сессии.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { netLog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> netLog.startLogging(<span class=\"hljs-string\">'/path/to/net-log'</span>)\n  <span class=\"hljs-comment\">// After some network events</span>\n  <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> netLog.stopLogging()\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Net-logs written to'</span>, path)\n})\n</code></pre>\n<p>Смотрите <a href=\"/docs/api/command-line-switches#--log-net-logpath\"><code>--log-net-log</code></a> для регистрации сетевых событий на протяжении всего жизненного цикла приложения.</p>\n<p><strong>Примечание:</strong> Все методы, если не указано другого, могут быть использованы только после того, как событие <code>ready</code> модуля <code>app</code> будет отправлено.</p>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<h3 id=\"netlogstartloggingpath-options\"><a href=\"#netlogstartloggingpath-options\"><code>netLog.startLogging(path[, options])</code></a></h3>\n<ul>\n<li><code>path</code> String - путь к файлу для записи сетевых журналов.</li>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>captureMode</code> String (опционально) - Какие типы данных должны быть зафиксированы. По умолчанию будут записаны только метаданные о запросах. Установка этого в <code>includeSensitive</code> будет включать cookies и данные аутентификации. Установка на <code>everything</code> включит все байты, передаваемые на сокеты. Может быть <code>default</code>, <code>includeSensitive</code> или <code>everything</code>.</li>\n<li><code>maxFileSize</code> Number (опционально) - Когда журнал заполнится и станет больше этого размера, регистрация автоматически прекратится. По умолчанию неограничено.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code> - разрешает, когда сетевой журнал начал запись.</p>\n<p>Запускает запись сетевых событий в <code>path</code>.</p>\n<h3 id=\"netlogstoplogging\"><a href=\"#netlogstoplogging\"><code>netLog.stopLogging()</code></a></h3>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the net log has been flushed to disk.</p>\n<p>Остановка записи сетевых событий. Если не вызвано, ведение сетевого журнала автоматически закроется при выходе из приложения.</p>\n<h2 id=\"свойства\"><a href=\"#свойства\">Свойства</a></h2>\n<h3 id=\"netlogcurrentlylogging-только-чтение\"><a href=\"#netlogcurrentlylogging-только-чтение\"><code>netLog.currentlyLogging</code> <em>Только чтение</em></a></h3>\n<p>A <code>Boolean</code> property that indicates whether network logs are currently being recorded.</p>",
      "title": "netLog",
      "description": "Журналирование сетевых событий сессии."
    },
    "/docs/api/structures/new-window-web-contents-event": {
      "locale": "ru-RU",
      "slug": "new-window-web-contents-event",
      "href": "/docs/api/structures/new-window-web-contents-event",
      "crowdinFileId": "256469",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/new-window-web-contents-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"newwindowwebcontentsevent-object-extends-event\"><a href=\"#newwindowwebcontentsevent-object-extends-event\">NewWindowWebContentsEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>newGuest</code> BrowserWindow (optional)</li>\n</ul>",
      "title": "NewWindowWebContentsEvent Object extends Event",
      "description": ""
    },
    "/docs/api/notification": {
      "locale": "ru-RU",
      "slug": "notification",
      "href": "/docs/api/notification",
      "crowdinFileId": "256349",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/notification.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"notification-оповещения\"><a href=\"#notification-оповещения\">Notification (Оповещения)</a></h1>\n<blockquote>\n<p>Создание уведомлений на рабочем столе ОС</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<h2 id=\"использование-в-рендерер-процессе\"><a href=\"#использование-в-рендерер-процессе\">Использование в Рендерер-процессе</a></h2>\n<p>Если вы хотите отобразить уведомления в Рендерер-процессе, вы должны использовать <a href=\"/docs/tutorial/notifications\">HTML5 Notification API</a></p>\n<h2 id=\"class-notification--уведомление\"><a href=\"#class-notification--уведомление\">Class: Notification / Уведомление</a></h2>\n<blockquote>\n<p>Создание уведомлений на рабочем столе ОС</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p><code>Notification</code> является <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p>Так создается новый экземпляр <code>BrowserWindow</code> с собственными свойствами, установленными в <code>options</code>.</p>\n<h3 id=\"статические-методы\"><a href=\"#статические-методы\">Статические методы</a></h3>\n<p>Класс <code>Notification</code> имеет следующие статические методы:</p>\n<h4 id=\"notificationissupported\"><a href=\"#notificationissupported\"><code>Notification.isSupported()</code></a></h4>\n<p>Возвращает <code>Boolean</code> - Поддерживаются ли уведомления рабочего стола в текущей системе</p>\n<h3 id=\"new-notificationoptions\"><a href=\"#new-notificationoptions\"><code>new Notification([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>title</code> String (optional) - A title for the notification, which will be shown at the top of the notification window when it is shown.</li>\n<li><code>subtitle</code> String (опционально) <em>macOS</em> - Подзаголовок для уведомления, который будет отображаться под заголовком.</li>\n<li><code>body</code> String (optional) - The body text of the notification, which will be displayed below the title or subtitle.</li>\n<li><code>silent</code> Boolean (опционально) - Использовать ли звук уведомления ОС при отображении уведомления.</li>\n<li><code>icon</code> (String | <a href=\"/docs/api/native-image\">NativeImage</a>) (опционально) - Значок для отображения в уведомлении.</li>\n<li><code>hasReply</code> Boolean (опционально) <em>macOS</em> - Нужно ли добавлять встроенный ответ к уведомлению.</li>\n<li><code>timeoutType</code> String (optional) <em>Linux</em> <em>Windows</em> - The timeout duration of the notification. Can be 'default' or 'never'.</li>\n<li><code>replyPlaceholder</code> String (опционально) <em>macOS</em> - Заполнитель для записи в поле ввода встроенного ответа.</li>\n<li><code>sound</code> String (опционально) <em>macOS</em> - Имя звукового файла, воспроизводимого при отображении уведомления.</li>\n<li><code>urgency</code> String (optional) <em>Linux</em> - The urgency level of the notification. Can be 'normal', 'critical', or 'low'.</li>\n<li><code>actions</code> <a href=\"/docs/api/structures/notification-action\">NotificationAction[]</a> (опционально) <em>macOS</em> - Действия для добавления к уведомлению. Пожалуйста, прочитайте доступные действия и ограничения в документации <code>NotificationAction</code>.</li>\n<li><code>closeButtonText</code> String (optional) <em>macOS</em> - A custom title for the close button of an alert. An empty string will cause the default localized text to be used.</li>\n<li><code>toastXml</code> String (optional) <em>Windows</em> - A custom description of the Notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification.</li>\n</ul></li>\n</ul>\n<h3 id=\"события-экземпляра\"><a href=\"#события-экземпляра\">События экземпляра</a></h3>\n<p>Объекты созданные с помощью <code>new Notification</code> имеют следующие события:</p>\n<p><strong>Примечание:</strong> Некоторые методы доступны только в определенных операционных системах и помечены как таковые.</p>\n<h4 id=\"событие-show\"><a href=\"#событие-show\">Событие: 'show'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n</ul>\n<p>Возникает, когда уведомление отображается пользователю, обратите внимание, что оно может быть вызвано несколько раз, поскольку уведомление может быть показано несколько раз с помощью метода <code>show()</code>.</p>\n<h4 id=\"событие-click\"><a href=\"#событие-click\">Событие: 'click'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n</ul>\n<p>Возникает при нажатии на уведомление пользователя.</p>\n<h4 id=\"событие-close\"><a href=\"#событие-close\">Событие: 'close'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n</ul>\n<p>Возникает при закрытии уведомления вручную пользователем.</p>\n<p>Не гарантируется, что это событие будет отправлено во всех случаях, когда уведомление закрыто.</p>\n<h4 id=\"событие-reply-macos\"><a href=\"#событие-reply-macos\">Событие: 'reply' <em>macOS</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>reply</code> String - Строка, введенная пользователем в поле ответа в строке ответа.</li>\n</ul>\n<p>Возникает при нажатии пользователем кнопки \"Ответить\" в уведомлении с <code>hasReply: true</code>.</p>\n<h4 id=\"событие-action-macos\"><a href=\"#событие-action-macos\">Событие: 'action' <em>macOS</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>index</code> Number - Индекс действия, которое было активировано.</li>\n</ul>\n<h4 id=\"event-failed-windows\"><a href=\"#event-failed-windows\">Event: 'failed' <em>Windows</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>error</code> String - The error encountered during execution of the <code>show()</code> method.</li>\n</ul>\n<p>Emitted when an error is encountered while creating and showing the native notification.</p>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<p>Объекты, созданные с помощью <code>New Notification</code>, имеют следующие методы экземпляра:</p>\n<h4 id=\"notificationshow\"><a href=\"#notificationshow\"><code>notification.show()</code></a></h4>\n<p>Сразу же показывает уведомление пользователю, обратите внимание, что это означает, в отличие от реализации HTML5 Notification, создание экземпляра <code>new Notification</code> не сразу показывает его пользователю, вам нужно вызвать этот метод, прежде чем ОС покажет его.</p>\n<p>Если уведомление было показано ранее, этот метод отклонит ранее показанное уведомление и создаст новое с идентичными свойствами.</p>\n<h4 id=\"notificationclose\"><a href=\"#notificationclose\"><code>notification.close()</code></a></h4>\n<p>Отклоняет уведомление.</p>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<h4 id=\"notificationtitle\"><a href=\"#notificationtitle\"><code>notification.title</code></a></h4>\n<p>Свойство <code>String</code>, представляющее заголовок уведомления.</p>\n<h4 id=\"notificationsubtitle\"><a href=\"#notificationsubtitle\"><code>notification.subtitle</code></a></h4>\n<p>Свойство <code>String</code>, представляющее подзаголовок уведомления.</p>\n<h4 id=\"notificationbody\"><a href=\"#notificationbody\"><code>notification.body</code></a></h4>\n<p>Свойство <code>String</code>, представляющее тело уведомления.</p>\n<h4 id=\"notificationreplyplaceholder\"><a href=\"#notificationreplyplaceholder\"><code>notification.replyPlaceholder</code></a></h4>\n<p>Свойство <code>String</code>, представляющее заполнитель ответа уведомления.</p>\n<h4 id=\"notificationsound\"><a href=\"#notificationsound\"><code>notification.sound</code></a></h4>\n<p>Свойство <code>String</code>, представляющее звук уведомления.</p>\n<h4 id=\"notificationclosebuttontext\"><a href=\"#notificationclosebuttontext\"><code>notification.closeButtonText</code></a></h4>\n<p>Свойство <code>String</code>, представляющее текст кнопки закрытия уведомления.</p>\n<h4 id=\"notificationsilent\"><a href=\"#notificationsilent\"><code>notification.silent</code></a></h4>\n<p>Свойство <code>Boolean</code>, представляющее, является ли уведомление беззвучным.</p>\n<h4 id=\"notificationhasreply\"><a href=\"#notificationhasreply\"><code>notification.hasReply</code></a></h4>\n<p>Свойство <code>Boolean</code>, представляющее, есть ли в уведомлении действие для ответа.</p>\n<h4 id=\"notificationurgency-linux\"><a href=\"#notificationurgency-linux\"><code>notification.urgency</code> <em>Linux</em></a></h4>\n<p>A <code>String</code> property representing the urgency level of the notification. Can be 'normal', 'critical', or 'low'.</p>\n<p>Стандартное значение - 'low'. Что бы узнать подробнее, смотрите <a href=\"https://developer.gnome.org/notification-spec/#urgency-levels\">NotifyUrgency</a>.</p>\n<h4 id=\"notificationtimeouttype-linux-windows\"><a href=\"#notificationtimeouttype-linux-windows\"><code>notification.timeoutType</code> <em>Linux</em> <em>Windows</em></a></h4>\n<p>A <code>String</code> property representing the type of timeout duration for the notification. Can be 'default' or 'never'.</p>\n<p>If <code>timeoutType</code> is set to 'never', the notification never expires. It stays open until closed by the calling API or the user.</p>\n<h4 id=\"notificationactions\"><a href=\"#notificationactions\"><code>notification.actions</code></a></h4>\n<p>A <a href=\"/docs/api/structures/notification-action\"><code>NotificationAction[]</code></a> свойство, представляющее действия уведомления.</p>\n<h4 id=\"notificationtoastxml-windows\"><a href=\"#notificationtoastxml-windows\"><code>notification.toastXml</code> <em>Windows</em></a></h4>\n<p>A <code>String</code> property representing the custom Toast XML of the notification.</p>\n<h3 id=\"воспроизведение-звуков\"><a href=\"#воспроизведение-звуков\">Воспроизведение звуков</a></h3>\n<p>В macOS вы можете указать название звука, который вы хотели бы воспроизвести, когда отображается уведомление. Any of the default sounds (under System Preferences > Sound) can be used, in addition to custom sound files. Убедитесь, что звуковой файл скопирован в папку пакета приложений (например, <code>YourApp.app/Contents/Resources</code>), или в одно из следующих мест:</p>\n<ul>\n<li><code>~/Library/Sounds (~/Библиотека/Звуки)</code></li>\n<li><code>/Library/Sounds (/Библиотека/Звуки)</code></li>\n<li><code>/Network/Library/Sounds (/Сеть/Библиотека/Звуки)</code></li>\n<li><code>/System/Library/Sounds (/Система/Библиотека/Звуки)</code></li>\n</ul>\n<p>Смотрите документацию <a href=\"https://developer.apple.com/documentation/appkit/nssound\"><code>NSSound</code></a> для получения дополнительной информации.</p>",
      "title": "Notification (Оповещения)",
      "description": "Создание уведомлений на рабочем столе ОС"
    },
    "/docs/api/structures/notification-action": {
      "locale": "ru-RU",
      "slug": "notification-action",
      "href": "/docs/api/structures/notification-action",
      "crowdinFileId": "256471",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/notification-action.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificationaction-object\"><a href=\"#notificationaction-object\">NotificationAction Object</a></h1>\n<ul>\n<li><code>type</code> String - The type of action, can be <code>button</code>.</li>\n<li><code>text</code> String (optional) - The label for the given action.</li>\n</ul>\n<h2 id=\"platform--action-support\"><a href=\"#platform--action-support\">Platform / Action Support</a></h2>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Action Type</th><th>Platform Support</th><th>Usage of <code>text</code></th><th>Default <code>text</code></th><th>Limitations</th></tr></thead><tbody><tr><td><code>button</code></td><td>macOS</td><td>Used as the label for the button</td><td>\"Show\" (or a localized string by system default if first of such <code>button</code>, otherwise empty)</td><td>Only the first one is used. If multiple are provided, those beyond the first will be listed as additional actions (displayed when mouse active over the action button). Any such action also is incompatible with <code>hasReply</code> and will be ignored if <code>hasReply</code> is <code>true</code>.</td></tr></tbody></table>\n<h3 id=\"button-support-on-macos\"><a href=\"#button-support-on-macos\">Button support on macOS</a></h3>\n<p>In order for extra notification buttons to work on macOS your app must meet the following criteria.</p>\n<ul>\n<li>App is signed</li>\n<li>App has it's <code>NSUserNotificationAlertStyle</code> set to <code>alert</code> in the <code>Info.plist</code>.</li>\n</ul>\n<p>If either of these requirements are not met the button won't appear.</p>",
      "title": "NotificationAction Object",
      "description": ""
    },
    "/docs/api/structures/notification-response": {
      "locale": "ru-RU",
      "slug": "notification-response",
      "href": "/docs/api/structures/notification-response",
      "crowdinFileId": "256473",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/notification-response.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificationresponse-object\"><a href=\"#notificationresponse-object\">NotificationResponse Object</a></h1>\n<ul>\n<li><code>actionIdentifier</code> String - The identifier string of the action that the user selected.</li>\n<li><code>date</code> Number - The delivery date of the notification.</li>\n<li><code>identifier</code> String - The unique identifier for this notification request.</li>\n<li><code>userInfo</code> Record&#x3C;String, any> - A dictionary of custom information associated with the notification.</li>\n<li><code>userText</code> String (optional) - The text entered or chosen by the user.</li>\n</ul>",
      "title": "NotificationResponse Object",
      "description": ""
    },
    "/docs/tutorial/notifications": {
      "locale": "ru-RU",
      "slug": "notifications",
      "href": "/docs/tutorial/notifications",
      "crowdinFileId": "256225",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/notifications.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"notification-оповещения\"><a href=\"#notification-оповещения\">Notification (Оповещения)</a></h1>\n<h2 id=\"обзор\"><a href=\"#обзор\">Обзор</a></h2>\n<p>All three operating systems provide means for applications to send notifications to the user. The technique of showing notifications is different for the Main and Renderer processes.</p>\n<p>For the Renderer process, Electron conveniently allows developers to send notifications with the <a href=\"https://notifications.spec.whatwg.org/\">HTML5 Notification API</a>, using the currently running operating system's native notification APIs to display it.</p>\n<p>To show notifications in the Main process, you need to use the <a href=\"/docs/api/notification\">Notification</a> module.</p>\n<h2 id=\"пример\"><a href=\"#пример\">Пример</a></h2>\n<h3 id=\"show-notifications-in-the-renderer-process\"><a href=\"#show-notifications-in-the-renderer-process\">Show notifications in the Renderer process</a></h3>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, add the following line to the <code>index.html</code> file before the closing <code>&#x3C;/body></code> tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<p>...and add the <code>renderer.js</code> file:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/notifications/renderer\"><span class=\"hljs-keyword\">const</span> NOTIFICATION_TITLE = <span class=\"hljs-string\">'Title'</span>\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_BODY = <span class=\"hljs-string\">'Notification from the Renderer process. Click to log to console.'</span>\n<span class=\"hljs-keyword\">const</span> CLICK_MESSAGE = <span class=\"hljs-string\">'Notification clicked'</span>\n\n<span class=\"hljs-keyword\">new</span> Notification(NOTIFICATION_TITLE, { <span class=\"hljs-attr\">body</span>: NOTIFICATION_BODY })\n  .onclick = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-built_in\">console</span>.log(CLICK_MESSAGE)\n</code></pre>\n<p>After launching the Electron application, you should see the notification:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/notification-renderer.png\" alt=\"Notification in the Renderer process\"></p>\n<p>Additionally, if you click on the notification, the DOM will update to show \"Notification clicked!\".</p>\n<h3 id=\"show-notifications-in-the-main-process\"><a href=\"#show-notifications-in-the-main-process\">Show notifications in the Main process</a></h3>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/notifications/main\"><span class=\"hljs-keyword\">const</span> { Notification } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_TITLE = <span class=\"hljs-string\">'Basic Notification'</span>\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_BODY = <span class=\"hljs-string\">'Notification from the Main process'</span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">showNotification</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">new</span> Notification({ <span class=\"hljs-attr\">title</span>: NOTIFICATION_TITLE, <span class=\"hljs-attr\">body</span>: NOTIFICATION_BODY }).show()\n}\n\napp.whenReady().then(createWindow).then(showNotification)\n</code></pre>\n<p>After launching the Electron application, you should see the system notification:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/notification-main.png\" alt=\"Notification in the Main process\"></p>\n<h2 id=\"additional-information\"><a href=\"#additional-information\">Additional information</a></h2>\n<p>Хотя код и Ux схожий между операционными системами, все же есть небольшие различия.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<ul>\n<li>On Windows 10, a shortcut to your app with an <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> must be installed to the Start Menu. This can be overkill during development, so adding <code>node_modules\\electron\\dist\\electron.exe</code> to your Start Menu also does the trick. Navigate to the file in Explorer, right-click and 'Pin to Start Menu'. You will then need to add the line <code>app.setAppUserModelId(process.execPath)</code> to your main process to see notifications.</li>\n<li>On Windows 8.1 and Windows 8, a shortcut to your app with an <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> must be installed to the Start screen. Note, however, that it does not need to be pinned to the Start screen.</li>\n<li>On Windows 7, notifications work via a custom implementation which visually resembles the native one on newer systems.</li>\n</ul>\n<p>Electron attempts to automate the work around the Application User Model ID. When Electron is used together with the installation and update framework Squirrel, <a href=\"https://github.com/electron/windows-installer/blob/master/README.md#handling-squirrel-events\">shortcuts will automatically be set correctly</a>. Furthermore, Electron will detect that Squirrel was used and will automatically call <code>app.setAppUserModelId()</code> with the correct value. During development, you may have to call <a href=\"/docs/api/app#appsetappusermodelidid-windows\"><code>app.setAppUserModelId()</code></a> yourself.</p>\n<p>Furthermore, in Windows 8, the maximum length for the notification body is 250 characters, with the Windows team recommending that notifications should be kept to 200 characters. That said, that limitation has been removed in Windows 10, with the Windows team asking developers to be reasonable. Attempting to send gigantic amounts of text to the API (thousands of characters) might result in instability.</p>\n<h4 id=\"advanced-notifications\"><a href=\"#advanced-notifications\">Advanced Notifications</a></h4>\n<p>Later versions of Windows allow for advanced notifications, with custom templates, images, and other flexible elements. To send those notifications (from either the main process or the renderer process), use the userland module <a href=\"https://github.com/felixrieseberg/electron-windows-notifications\">electron-windows-notifications</a>, which uses native Node addons to send <code>ToastNotification</code> and <code>TileNotification</code> objects.</p>\n<p>While notifications including buttons work with <code>electron-windows-notifications</code>, handling replies requires the use of <a href=\"https://github.com/felixrieseberg/electron-windows-interactive-notifications\"><code>electron-windows-interactive-notifications</code></a>, which helps with registering the required COM components and calling your Electron app with the entered user data.</p>\n<h4 id=\"quiet-hours--presentation-mode\"><a href=\"#quiet-hours--presentation-mode\">Quiet Hours / Presentation Mode</a></h4>\n<p>To detect whether or not you're allowed to send a notification, use the userland module <a href=\"https://github.com/felixrieseberg/electron-notification-state\">electron-notification-state</a>.</p>\n<p>This allows you to determine ahead of time whether or not Windows will silently throw the notification away.</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>Notifications are straight-forward on macOS, but you should be aware of <a href=\"https://developer.apple.com/macos/human-interface-guidelines/system-capabilities/notifications/\">Apple's Human Interface guidelines regarding notifications</a>.</p>\n<p>Note that notifications are limited to 256 bytes in size and will be truncated if you exceed that limit.</p>\n<h4 id=\"do-not-disturb--session-state\"><a href=\"#do-not-disturb--session-state\">Do not disturb / Session State</a></h4>\n<p>To detect whether or not you're allowed to send a notification, use the userland module <a href=\"https://github.com/felixrieseberg/electron-notification-state\">electron-notification-state</a>.</p>\n<p>This will allow you to detect ahead of time whether or not the notification will be displayed.</p>\n<h3 id=\"linux\"><a href=\"#linux\">Linux</a></h3>\n<p>Notifications are sent using <code>libnotify</code> which can show notifications on any desktop environment that follows <a href=\"https://developer.gnome.org/notification-spec/\">Desktop Notifications Specification</a>, including Cinnamon, Enlightenment, Unity, GNOME, KDE.</p>",
      "title": "Notification (Оповещения)",
      "description": ""
    },
    "/docs/tutorial/offscreen-rendering": {
      "locale": "ru-RU",
      "slug": "offscreen-rendering",
      "href": "/docs/tutorial/offscreen-rendering",
      "crowdinFileId": "256227",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/offscreen-rendering.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"закадровый-рендеринг\"><a href=\"#закадровый-рендеринг\">Закадровый рендеринг</a></h1>\n<h2 id=\"обзор\"><a href=\"#обзор\">Обзор</a></h2>\n<p>Offscreen rendering lets you obtain the content of a <code>BrowserWindow</code> in a bitmap, so it can be rendered anywhere, for example, on texture in a 3D scene. The offscreen rendering in Electron uses a similar approach to that of the <a href=\"https://bitbucket.org/chromiumembedded/cef\">Chromium Embedded Framework</a> project.</p>\n<p><em>Notes</em>:</p>\n<ul>\n<li>There are two rendering modes that can be used (see the section below) and only the dirty area is passed to the <code>paint</code> event to be more efficient.</li>\n<li>You can stop/continue the rendering as well as set the frame rate.</li>\n<li>The maximum frame rate is 240 because greater values bring only performance losses with no benefits.</li>\n<li>When nothing is happening on a webpage, no frames are generated.</li>\n<li>An offscreen window is always created as a <a href=\"/docs/api/frameless-window\">Frameless Window</a>.</li>\n</ul>\n<h3 id=\"режими-рендеринга\"><a href=\"#режими-рендеринга\">Режими рендеринга</a></h3>\n<h4 id=\"аппаратное-ускорение\"><a href=\"#аппаратное-ускорение\">Аппаратное ускорение</a></h4>\n<p>GPU accelerated rendering means that the GPU is used for composition. Because of that, the frame has to be copied from the GPU which requires more resources, thus this mode is slower than the Software output device. The benefit of this mode is that WebGL and 3D CSS animations are supported.</p>\n<h4 id=\"software-output-device\"><a href=\"#software-output-device\">Software output device</a></h4>\n<p>This mode uses a software output device for rendering in the CPU, so the frame generation is much faster. As a result, this mode is preferred over the GPU accelerated one.</p>\n<p>To enable this mode, GPU acceleration has to be disabled by calling the <a href=\"/docs/api/app#appdisablehardwareacceleration\"><code>app.disableHardwareAcceleration()</code></a> API.</p>\n<h2 id=\"пример\"><a href=\"#пример\">Пример</a></h2>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/offscreen-rendering\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\napp.disableHardwareAcceleration()\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">offscreen</span>: <span class=\"hljs-literal\">true</span> } })\n\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  win.webContents.on(<span class=\"hljs-string\">'paint'</span>, (event, dirty, image) => {\n    fs.writeFileSync(<span class=\"hljs-string\">'ex.png'</span>, image.toPNG())\n  })\n  win.webContents.setFrameRate(<span class=\"hljs-number\">60</span>)\n})\n</code></pre>\n<p>After launching the Electron application, navigate to your application's working folder, where you'll find the rendered image.</p>",
      "title": "Закадровый рендеринг",
      "description": ""
    },
    "/docs/tutorial/online-offline-events": {
      "locale": "ru-RU",
      "slug": "online-offline-events",
      "href": "/docs/tutorial/online-offline-events",
      "crowdinFileId": "256229",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/online-offline-events.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"обнаружение-onlineoffline-событий\"><a href=\"#обнаружение-onlineoffline-событий\">Обнаружение Online/Offline событий</a></h1>\n<h2 id=\"обзор\"><a href=\"#обзор\">Обзор</a></h2>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Online_and_offline_events\">Online and offline event</a> detection can be implemented in the Renderer process using the <a href=\"http://html5index.org/Offline%20-%20NavigatorOnLine.html\"><code>navigator.onLine</code></a> attribute, part of standard HTML5 API.</p>\n<p>The <code>navigator.onLine</code> attribute returns:</p>\n<ul>\n<li><code>false</code> if all network requests are guaranteed to fail (e.g. when disconnected from the network).</li>\n<li><code>true</code> in all other cases.</li>\n</ul>\n<p>Since many cases return <code>true</code>, you should treat with care situations of getting false positives, as we cannot always assume that <code>true</code> value means that Electron can access the Internet. For example, in cases when the computer is running a virtualization software that has virtual Ethernet adapters in \"always connected\" state. Therefore, if you want to determine the Internet access status of Electron, you should develop additional means for this check.</p>\n<h2 id=\"пример\"><a href=\"#пример\">Пример</a></h2>\n<p>Starting with an HTML file <code>index.html</code>, this example will demonstrate how the <code>navigator.onLine</code> API can be used to build a connection status indicator.</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"script-src 'self' 'unsafe-inline';\"</span> /></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Connection status: <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">strong</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">'status'</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">strong</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>In order to mutate the DOM, create a <code>renderer.js</code> file that adds event listeners to the <code>'online'</code> and <code>'offline'</code> <code>window</code> events. The event handler sets the content of the <code>&#x3C;strong id='status'></code> element depending on the result of <code>navigator.onLine</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">updateOnlineStatus</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'status'</span>).innerHTML = navigator.onLine ? <span class=\"hljs-string\">'online'</span> : <span class=\"hljs-string\">'offline'</span>\n}\n\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'online'</span>, updateOnlineStatus)\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'offline'</span>, updateOnlineStatus)\n\nupdateOnlineStatus()\n</code></pre>\n<p>Finally, create a <code>main.js</code> file for main process that creates the window.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> onlineStatusWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">400</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">100</span>\n  })\n\n  onlineStatusWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n      createWindow()\n    }\n  })\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n</code></pre>\n<p>After launching the Electron application, you should see the notification:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/connection-status.png\" alt=\"Connection status\"></p>\n<blockquote>\n<p>Note: If you need to communicate the connection status to the main process, use the <a href=\"/docs/api/ipc-renderer\">IPC renderer</a> API.</p>\n</blockquote>",
      "title": "Обнаружение Online/Offline событий",
      "description": "Note: If you need to communicate the connection status to the main process, use the IPC renderer API."
    },
    "/docs/development/patches": {
      "locale": "ru-RU",
      "slug": "patches",
      "href": "/docs/development/patches",
      "crowdinFileId": "256161",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/patches.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"патчи-в-electron\"><a href=\"#патчи-в-electron\">Патчи в Electron</a></h1>\n<p>Electron is built on two major upstream projects: Chromium and Node.js. Each of these projects has several of their own dependencies, too. We try our best to use these dependencies exactly as they are but sometimes we can't achieve our goals without patching those upstream dependencies to fit our use cases.</p>\n<h2 id=\"patch-justification\"><a href=\"#patch-justification\">Patch justification</a></h2>\n<p>Every patch in Electron is a maintenance burden. When upstream code changes, patches can break—sometimes without even a patch conflict or a compilation error. It's an ongoing effort to keep our patch set up-to-date and effective. So we strive to keep our patch count at a minimum. To that end, every patch must describe its reason for existence in its commit message. That reason must be one of the following:</p>\n<ol>\n<li>The patch is temporary, and is intended to be (or has been) committed upstream or otherwise eventually removed. Include a link to an upstream PR or code review if available, or a procedure for verifying whether the patch is still needed at a later date.</li>\n<li>The patch allows the code to compile in the Electron environment, but cannot be upstreamed because it's Electron-specific (e.g. patching out references to Chrome's <code>Profile</code>). Include reasoning about why the change cannot be implemented without a patch (e.g. by subclassing or copying the code).</li>\n<li>The patch makes Electron-specific changes in functionality which are fundamentally incompatible with upstream.</li>\n</ol>\n<p>In general, all the upstream projects we work with are friendly folks and are often happy to accept refactorings that allow the code in question to be compatible with both Electron and the upstream project. (See e.g. <a href=\"https://chromium-review.googlesource.com/c/chromium/src/+/1637040\">this</a> change in Chromium, which allowed us to remove a patch that did the same thing, or <a href=\"https://github.com/nodejs/node/pull/22110\">this</a> change in Node, which was a no-op for Node but fixed a bug in Electron.) <strong>We should aim to upstream changes whenever we can, and avoid indefinite-lifetime patches</strong>.</p>\n<h2 id=\"patch-system\"><a href=\"#patch-system\">Patch system</a></h2>\n<p>If you find yourself in the unfortunate position of having to make a change which can only be made through patching an upstream project, you'll need to know how to manage patches in Electron.</p>\n<p>All patches to upstream projects in Electron are contained in the <code>patches/</code> directory. Each subdirectory of <code>patches/</code> contains several patch files, along with a <code>.patches</code> file which lists the order in which the patches should be applied. Think of these files as making up a series of git commits that are applied on top of the upstream project after we check it out.</p>\n<pre><code class=\"hljs language-plaintext\">patches\n├── config.json   &#x3C;-- this describes which patchset directory is applied to what project\n├── chromium\n│   ├── .patches\n│   ├── accelerator.patch\n│   ├── add_contentgpuclient_precreatemessageloop_callback.patch\n│   ⋮\n├── node\n│   ├── .patches\n│   ├── add_openssl_is_boringssl_guard_to_oaep_hash_check.patch\n│   ├── build_add_gn_build_files.patch\n│   ⋮\n⋮\n</code></pre>\n<p>To help manage these patch sets, we provide two tools: <code>git-import-patches</code> and <code>git-export-patches</code>. <code>git-import-patches</code> imports a set of patch files into a git repository by applying each patch in the correct order and creating a commit for each one. <code>git-export-patches</code> does the reverse; it exports a series of git commits in a repository into a set of files in a directory and an accompanying <code>.patches</code> file.</p>\n<blockquote>\n<p>Side note: the reason we use a <code>.patches</code> file to maintain the order of applied patches, rather than prepending a number like <code>001-</code> to each file, is because it reduces conflicts related to patch ordering. It prevents the situation where two PRs both add a patch at the end of the series with the same numbering and end up both getting merged resulting in a duplicate identifier, and it also reduces churn when a patch is added or deleted in the middle of the series.</p>\n</blockquote>\n<h3 id=\"usage\"><a href=\"#usage\">Usage</a></h3>\n<h4 id=\"добавление-нового-патча\"><a href=\"#добавление-нового-патча\">Добавление нового патча</a></h4>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n$ vim some/code/file.cc\n$ git commit\n$ ../../electron/script/git-export-patches -o ../../electron/patches/node\n</code></pre>\n<blockquote>\n<p><strong>NOTE</strong>: <code>git-export-patches</code> ignores any uncommitted files, so you must create a commit if you want your changes to be exported. The subject line of the commit message will be used to derive the patch file name, and the body of the commit message should include the reason for the patch's existence.</p>\n</blockquote>\n<p>Re-exporting patches will sometimes cause shasums in unrelated patches to change. This is generally harmless and can be ignored (but go ahead and add those changes to your PR, it'll stop them from showing up for other people).</p>\n<h4 id=\"редактирование-существующего-патча\"><a href=\"#редактирование-существующего-патча\">Редактирование существующего патча</a></h4>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/v8\n$ vim some/code/file.cc\n$ git <span class=\"hljs-built_in\">log</span>\n<span class=\"hljs-comment\"># Найти коммит патча, который вы хотите редактировать.</span>\n$ git commit --fixup [COMMIT_SHA]\n$ git rebase --autosquash -i [COMMIT_SHA]^\n$ ../electron/script/git-export-patches -o ../electron/patches/v8\n</code></pre>\n<h4 id=\"удаление-патча\"><a href=\"#удаление-патча\">Удаление патча</a></h4>\n<pre><code class=\"hljs language-bash\">$ vim src/electron/patches/node/.patches\n<span class=\"hljs-comment\"># Delete the line with the name of the patch you want to remove</span>\n$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n$ git reset --hard refs/patches/upstream-head\n$ ../../electron/script/git-import-patches ../../electron/patches/node\n$ ../../electron/script/git-export-patches -o ../../electron/patches/node\n</code></pre>\n<p>Note that <code>git-import-patches</code> will mark the commit that was <code>HEAD</code> when it was run as <code>refs/patches/upstream-head</code>. This lets you keep track of which commits are from Electron patches (those that come after <code>refs/patches/upstream-head</code>) and which commits are in upstream (those before <code>refs/patches/upstream-head</code>).</p>\n<h4 id=\"разрешение-конфликтов\"><a href=\"#разрешение-конфликтов\">Разрешение конфликтов</a></h4>\n<p>When updating an upstream dependency, patches may fail to apply cleanly. Often, the conflict can be resolved automatically by git with a 3-way merge. You can instruct <code>git-import-patches</code> to use the 3-way merge algorithm by passing the <code>-3</code> argument:</p>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n<span class=\"hljs-comment\"># If the patch application failed midway through, you can reset it with:</span>\n$ git am --abort\n<span class=\"hljs-comment\"># And then retry with 3-way merge:</span>\n$ ../../electron/script/git-import-patches -3 ../../electron/patches/node\n</code></pre>\n<p>If <code>git-import-patches -3</code> encounters a merge conflict that it can't resolve automatically, it will pause and allow you to resolve the conflict manually. Once you have resolved the conflict, <code>git add</code> the resolved files and continue to apply the rest of the patches by running <code>git am --continue</code>.</p>",
      "title": "Патчи в Electron",
      "description": "Side note: the reason we use a .patches file to maintain the order of applied patches, rather than prepending a number like 001- to each file, is because it reduces conflicts related to patch ordering. It prevents the situation where two PRs both add a patch at the end of the series with the same numbering and end up both getting merged resulting in a duplicate identifier, and it also reduces churn when a patch is added or deleted in the middle of the series."
    },
    "/docs/tutorial/performance": {
      "locale": "ru-RU",
      "slug": "performance",
      "href": "/docs/tutorial/performance",
      "crowdinFileId": "256231",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/performance.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"характеристика\"><a href=\"#характеристика\">Характеристика</a></h1>\n<p>Разработчики часто спрашивают о стратегиях оптимизации производительности приложений Electron. Les ingénieurs, les consommateurs et les développeurs de framework ne sont pas toujours d'accord sur une seule définition de ce que signifie \"performance\". This document outlines some of the Electron maintainers' favorite ways to reduce the amount of memory, CPU, and disk resources being used while ensuring that your app is responsive to user input and completes operations as quickly as possible. Furthermore, we want all performance strategies to maintain a high standard for your app's security.</p>\n<p>Wisdom and information about how to build performant websites with JavaScript generally applies to Electron apps, too. To a certain extent, resources discussing how to build performant Node.js applications also apply, but be careful to understand that the term \"performance\" means different things for a Node.js backend than it does for an application running on a client.</p>\n<p>This list is provided for your convenience – and is, much like our <a href=\"/docs/tutorial/security\">security checklist</a> – not meant to exhaustive. It is probably possible to build a slow Electron app that follows all the steps outlined below. Electron is a powerful development platform that enables you, the developer, to do more or less whatever you want. All that freedom means that performance is largely your responsibility.</p>\n<h2 id=\"measure-measure-measure\"><a href=\"#measure-measure-measure\">Measure, Measure, Measure</a></h2>\n<p>В приведенном ниже списке содержится ряд шагов, которые достаточно просты и легко осуществить. Тем не менее, создание наиболее эффективной версии вашего приложения потребует вас выйти за рамки нескольких шагов. Instead, you will have to closely examine all the code running in your app by carefully profiling and measuring. Where are the bottlenecks? When the user clicks a button, what operations take up the brunt of the time? While the app is simply idling, which objects take up the most memory?</p>\n<p>Time and time again, we have seen that the most successful strategy for building a performant Electron app is to profile the running code, find the most resource-hungry piece of it, and to optimize it. Repeating this seemingly laborious process over and over again will dramatically increase your app's performance. Experience from working with major apps like Visual Studio Code or Slack has shown that this practice is by far the most reliable strategy to improve performance.</p>\n<p>To learn more about how to profile your app's code, familiarize yourself with the Chrome Developer Tools. For advanced analysis looking at multiple processes at once, consider the <a href=\"https://www.chromium.org/developers/how-tos/trace-event-profiling-tool\">Chrome Tracing</a> tool.</p>\n<h3 id=\"recommended-reading\"><a href=\"#recommended-reading\">Recommended Reading</a></h3>\n<ul>\n<li><a href=\"https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/\">Get Started With Analyzing Runtime Performance</a></li>\n<li><a href=\"https://www.youtube.com/watch?v=r0OeHRUCCb4\">Talk: \"Visual Studio Code - The First Second\"</a></li>\n</ul>\n<h2 id=\"checklist\"><a href=\"#checklist\">Checklist</a></h2>\n<p>Chances are that your app could be a little leaner, faster, and generally less resource-hungry if you attempt these steps.</p>\n<ol>\n<li><a href=\"#1-carelessly-including-modules\">Carelessly including modules</a></li>\n<li><a href=\"#2-loading-and-running-code-too-soon\">Loading and running code too soon</a></li>\n<li><a href=\"#3-blocking-the-main-process\">Blocking the main process</a></li>\n<li><a href=\"#4-blocking-the-renderer-process\">Blocking the renderer process</a></li>\n<li><a href=\"#5-unnecessary-polyfills\">Unnecessary polyfills</a></li>\n<li><a href=\"#6-unnecessary-or-blocking-network-requests\">Unnecessary or blocking network requests</a></li>\n<li><a href=\"#7-bundle-your-code\">Bundle your code</a></li>\n</ol>\n<h2 id=\"1-carelessly-including-modules\"><a href=\"#1-carelessly-including-modules\">1) Carelessly including modules</a></h2>\n<p>Before adding a Node.js module to your application, examine said module. How many dependencies does that module include? What kind of resources does it need to simply be called in a <code>require()</code> statement? You might find that the module with the most downloads on the NPM package registry or the most stars on GitHub is not in fact the leanest or smallest one available.</p>\n<h3 id=\"почему\"><a href=\"#почему\">Почему?</a></h3>\n<p>The reasoning behind this recommendation is best illustrated with a real-world example. During the early days of Electron, reliable detection of network connectivity was a problem, resulting many apps to use a module that exposed a simple <code>isOnline()</code> method.</p>\n<p>That module detected your network connectivity by attempting to reach out to a number of well-known endpoints. For the list of those endpoints, it depended on a different module, which also contained a list of well-known ports. This dependency itself relied on a module containing information about ports, which came in the form of a JSON file with more than 100,000 lines of content. Whenever the module was loaded (usually in a <code>require('module')</code> statement), it would load all its dependencies and eventually read and parse this JSON file. Parsing many thousands lines of JSON is a very expensive operation. On a slow machine it can take up whole seconds of time.</p>\n<p>In many server contexts, startup time is virtually irrelevant. A Node.js server that requires information about all ports is likely actually \"more performant\" if it loads all required information into memory whenever the server boots at the benefit of serving requests faster. The module discussed in this example is not a \"bad\" module. Electron apps, however, should not be loading, parsing, and storing in memory information that it does not actually need.</p>\n<p>In short, a seemingly excellent module written primarily for Node.js servers running Linux might be bad news for your app's performance. In this particular example, the correct solution was to use no module at all, and to instead use connectivity checks included in later versions of Chromium.</p>\n<h3 id=\"как\"><a href=\"#как\">Как?</a></h3>\n<p>When considering a module, we recommend that you check:</p>\n<ol>\n<li>the size of dependencies included</li>\n<li>the resources required to load (<code>require()</code>) it</li>\n<li>the resources required to perform the action you're interested in</li>\n</ol>\n<p>Generating a CPU profile and a heap memory profile for loading a module can be done with a single command on the command line. In the example below, we're looking at the popular module <code>request</code>.</p>\n<pre><code class=\"hljs language-sh\">node --cpu-prof --heap-prof -e <span class=\"hljs-string\">\"require('request')\"</span>\n</code></pre>\n<p>Executing this command results in a <code>.cpuprofile</code> file and a <code>.heapprofile</code> file in the directory you executed it in. Both files can be analyzed using the Chrome Developer Tools, using the <code>Performance</code> and <code>Memory</code> tabs respectively.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/performance-cpu-prof.png\" alt=\"Performance CPU Profile\"></p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/performance-heap-prof.png\" alt=\"Performance Heap Memory Profile\"></p>\n<p>In this example, on the author's machine, we saw that loading <code>request</code> took almost half a second, whereas <code>node-fetch</code> took dramatically less memory and less than 50ms.</p>\n<h2 id=\"2-loading-and-running-code-too-soon\"><a href=\"#2-loading-and-running-code-too-soon\">2) Loading and running code too soon</a></h2>\n<p>If you have expensive setup operations, consider deferring those. Inspect all the work being executed right after the application starts. Instead of firing off all operations right away, consider staggering them in a sequence more closely aligned with the user's journey.</p>\n<p>In traditional Node.js development, we're used to putting all our <code>require()</code> statements at the top. If you're currently writing your Electron application using the same strategy <em>and</em> are using sizable modules that you do not immediately need, apply the same strategy and defer loading to a more opportune time.</p>\n<h3 id=\"почему-1\"><a href=\"#почему-1\">Почему?</a></h3>\n<p>Loading modules is a surprisingly expensive operation, especially on Windows. When your app starts, it should not make users wait for operations that are currently not necessary.</p>\n<p>This might seem obvious, but many applications tend to do a large amount of work immediately after the app has launched - like checking for updates, downloading content used in a later flow, or performing heavy disk I/O operations.</p>\n<p>Let's consider Visual Studio Code as an example. When you open a file, it will immediately display the file to you without any code highlighting, prioritizing your ability to interact with the text. Once it has done that work, it will move on to code highlighting.</p>\n<h3 id=\"как-1\"><a href=\"#как-1\">Как?</a></h3>\n<p>Let's consider an example and assume that your application is parsing files in the fictitious <code>.foo</code> format. In order to do that, it relies on the equally fictitious <code>foo-parser</code> module. In traditional Node.js development, you might write code that eagerly loads dependencies:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> fooParser = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'foo-parser'</span>)\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">Parser</span> </span>{\n  <span class=\"hljs-keyword\">constructor</span> () {\n    <span class=\"hljs-keyword\">this</span>.files = fs.readdirSync(<span class=\"hljs-string\">'.'</span>)\n  }\n\n  getParsedFiles () {\n    <span class=\"hljs-keyword\">return</span> fooParser.parse(<span class=\"hljs-keyword\">this</span>.files)\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> parser = <span class=\"hljs-keyword\">new</span> Parser()\n\n<span class=\"hljs-built_in\">module</span>.exports = { parser }\n</code></pre>\n<p>In the above example, we're doing a lot of work that's being executed as soon as the file is loaded. Do we need to get parsed files right away? Could we do this work a little later, when <code>getParsedFiles()</code> is actually called?</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// \"fs\" is likely already being loaded, so the `require()` call is cheap</span>\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">Parser</span> </span>{\n  <span class=\"hljs-keyword\">async</span> getFiles () {\n    <span class=\"hljs-comment\">// Touch the disk as soon as `getFiles` is called, not sooner.</span>\n    <span class=\"hljs-comment\">// Also, ensure that we're not blocking other operations by using</span>\n    <span class=\"hljs-comment\">// the asynchronous version.</span>\n    <span class=\"hljs-keyword\">this</span>.files = <span class=\"hljs-keyword\">this</span>.files || <span class=\"hljs-keyword\">await</span> fs.readdir(<span class=\"hljs-string\">'.'</span>)\n\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-keyword\">this</span>.files\n  }\n\n  <span class=\"hljs-keyword\">async</span> getParsedFiles () {\n    <span class=\"hljs-comment\">// Our fictitious foo-parser is a big and expensive module to load, so</span>\n    <span class=\"hljs-comment\">// defer that work until we actually need to parse files.</span>\n    <span class=\"hljs-comment\">// Since `require()` comes with a module cache, the `require()` call</span>\n    <span class=\"hljs-comment\">// will only be expensive once - subsequent calls of `getParsedFiles()`</span>\n    <span class=\"hljs-comment\">// will be faster.</span>\n    <span class=\"hljs-keyword\">const</span> fooParser = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'foo-parser'</span>)\n    <span class=\"hljs-keyword\">const</span> files = <span class=\"hljs-keyword\">await</span> <span class=\"hljs-keyword\">this</span>.getFiles()\n\n    <span class=\"hljs-keyword\">return</span> fooParser.parse(files)\n  }\n}\n\n<span class=\"hljs-comment\">// This operation is now a lot cheaper than in our previous example</span>\n<span class=\"hljs-keyword\">const</span> parser = <span class=\"hljs-keyword\">new</span> Parser()\n\n<span class=\"hljs-built_in\">module</span>.exports = { parser }\n</code></pre>\n<p>In short, allocate resources \"just in time\" rather than allocating them all when your app starts.</p>\n<h2 id=\"3-блокировка-основного-процесса\"><a href=\"#3-блокировка-основного-процесса\">3) Блокировка основного процесса</a></h2>\n<p>Electron's main process (sometimes called \"browser process\") is special: It is the parent process to all your app's other processes and the primary process the operating system interacts with. It handles windows, interactions, and the communication between various components inside your app. It also houses the UI thread.</p>\n<p>Under no circumstances should you block this process and the UI thread with long-running operations. Blocking the UI thread means that your entire app will freeze until the main process is ready to continue processing.</p>\n<h3 id=\"почему-2\"><a href=\"#почему-2\">Почему?</a></h3>\n<p>The main process and its UI thread are essentially the control tower for major operations inside your app. When the operating system tells your app about a mouse click, it'll go through the main process before it reaches your window. If your window is rendering a buttery-smooth animation, it'll need to talk to the GPU process about that – once again going through the main process.</p>\n<p>Electron and Chromium are careful to put heavy disk I/O and CPU-bound operations onto new threads to avoid blocking the UI thread. You should do the same.</p>\n<h3 id=\"как-2\"><a href=\"#как-2\">Как?</a></h3>\n<p>Electron's powerful multi-process architecture stands ready to assist you with your long-running tasks, but also includes a small number of performance traps.</p>\n<p>1) For long running CPU-heavy tasks, make use of <a href=\"https://nodejs.org/api/worker_threads.html\">worker threads</a>, consider moving them to the BrowserWindow, or (as a last resort) spawn a dedicated process.</p>\n<p>2) Avoid using the synchronous IPC and the <code>remote</code> module as much as possible. While there are legitimate use cases, it is far too easy to unknowingly block the UI thread using the <code>remote</code> module.</p>\n<p>3) Avoid using blocking I/O operations in the main process. In short, whenever core Node.js modules (like <code>fs</code> or <code>child_process</code>) offer a synchronous or an asynchronous version, you should prefer the asynchronous and non-blocking variant.</p>\n<h2 id=\"4-blocking-the-renderer-process\"><a href=\"#4-blocking-the-renderer-process\">4) Blocking the renderer process</a></h2>\n<p>Since Electron ships with a current version of Chrome, you can make use of the latest and greatest features the Web Platform offers to defer or offload heavy operations in a way that keeps your app smooth and responsive.</p>\n<h3 id=\"почему-3\"><a href=\"#почему-3\">Почему?</a></h3>\n<p>Your app probably has a lot of JavaScript to run in the renderer process. The trick is to execute operations as quickly as possible without taking away resources needed to keep scrolling smooth, respond to user input, or animations at 60fps.</p>\n<p>Orchestrating the flow of operations in your renderer's code is particularly useful if users complain about your app sometimes \"stuttering\".</p>\n<h3 id=\"как-3\"><a href=\"#как-3\">Как?</a></h3>\n<p>Generally speaking, all advice for building performant web apps for modern browsers apply to Electron's renderers, too. The two primary tools at your disposal  are currently <code>requestIdleCallback()</code> for small operations and <code>Web Workers</code> for long-running operations.</p>\n<p><em><code>requestIdleCallback()</code></em> allows developers to queue up a function to be executed as soon as the process is entering an idle period. It enables you to perform low-priority or background work without impacting the user experience. For more information about how to use it, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\">check out its documentation on MDN</a>.</p>\n<p><em>Web Workers</em> are a powerful tool to run code on a separate thread. There are some caveats to consider – consult Electron's <a href=\"/docs/tutorial/multithreading\">multithreading documentation</a> and the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers\">MDN documentation for Web Workers</a>. They're an ideal solution for any operation that requires a lot of CPU power for an extended period of time.</p>\n<h2 id=\"5-ненужные-polyfills\"><a href=\"#5-ненужные-polyfills\">5) Ненужные polyfills</a></h2>\n<p>Одним из преимуществ Electron является то, что вы точно знаете, какой движок будет парсить ваш JavaScript, HTML и CSS. Если вы повторно используете код, который был написан для веб в целом, убедитесь, что вы не должны полифилить функции, включенные в Electron.</p>\n<h3 id=\"почему-4\"><a href=\"#почему-4\">Почему?</a></h3>\n<p>When building a web application for today's Internet, the oldest environments dictate what features you can and cannot use. Even though Electron supports well-performing CSS filters and animations, an older browser might not. Where you could use WebGL, your developers may have chosen a more resource-hungry solution to support older phones.</p>\n<p>When it comes to JavaScript, you may have included toolkit libraries like jQuery for DOM selectors or polyfills like the <code>regenerator-runtime</code> to support <code>async/await</code>.</p>\n<p>It is rare for a JavaScript-based polyfill to be faster than the equivalent native feature in Electron. Do not slow down your Electron app by shipping your own version of standard web platform features.</p>\n<h3 id=\"как-4\"><a href=\"#как-4\">Как?</a></h3>\n<p>Operate under the assumption that polyfills in current versions of Electron are unnecessary. If you have doubts, check <a href=\"https://caniuse.com/\">caniuse.com</a> and check if the <a href=\"/docs/api/process#processversionschrome-readonly\">version of Chromium used in your Electron version</a> supports the feature you desire.</p>\n<p>Кроме того, внимательно изучите используемые вами библиотеки. Действительно ли они необходимы? Например, <code>jQuery</code>, был настолько успешным, что многие его функции теперь являются частью <a href=\"http://youmightnotneedjquery.com/\">стандартного набора возможностей JavaScript</a>.</p>\n<p>If you're using a transpiler/compiler like TypeScript, examine its configuration and ensure that you're targeting the latest ECMAScript version supported by Electron.</p>\n<h2 id=\"6-unnecessary-or-blocking-network-requests\"><a href=\"#6-unnecessary-or-blocking-network-requests\">6) Unnecessary or blocking network requests</a></h2>\n<p>Avoid fetching rarely changing resources from the internet if they could easily be bundled with your application.</p>\n<h3 id=\"почему-5\"><a href=\"#почему-5\">Почему?</a></h3>\n<p>Many users of Electron start with an entirely web-based app that they're turning into a desktop application. As web developers, we are used to loading resources from a variety of content delivery networks. Now that you are shipping a proper desktop application, attempt to \"cut the cord\" where possible and avoid letting your users wait for resources that never change and could easily be included  in your app.</p>\n<p>A typical example is Google Fonts. Many developers make use of Google's impressive collection of free fonts, which comes with a content delivery network. The pitch is straightforward: Include a few lines of CSS and Google will take care of the rest.</p>\n<p>When building an Electron app, your users are better served if you download the fonts and include them in your app's bundle.</p>\n<h3 id=\"как-5\"><a href=\"#как-5\">Как?</a></h3>\n<p>In an ideal world, your application wouldn't need the network to operate at all. To get there, you must understand what resources your app is downloading - and how large those resources are.</p>\n<p>To do so, open up the developer tools. Navigate to the <code>Network</code> tab and check the <code>Disable cache</code> option. Then, reload your renderer. Unless your app prohibits such reloads, you can usually trigger a reload by hitting <code>Cmd + R</code> or <code>Ctrl + R</code> with the developer tools in focus.</p>\n<p>The tools will now meticulously record all network requests. In a first pass, take stock of all the resources being downloaded, focusing on the larger files first. Are any of them images, fonts, or media files that don't change and could be included with your bundle? If so, include them.</p>\n<p>As a next step, enable <code>Network Throttling</code>. Find the drop-down that currently reads <code>Online</code> and select a slower speed such as <code>Fast 3G</code>. Reload your renderer and see if there are any resources that your app is unnecessarily waiting for. In many cases, an app will wait for a network request to complete despite not actually needing the involved resource.</p>\n<p>As a tip, loading resources from the Internet that you might want to change without shipping an application update is a powerful strategy. For advanced control over how resources are being loaded, consider investing in <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API\">Service Workers</a>.</p>\n<h2 id=\"7-bundle-your-code\"><a href=\"#7-bundle-your-code\">7) Bundle your code</a></h2>\n<p>As already pointed out in \"<a href=\"#2-loading-and-running-code-too-soon\">Loading and running code too soon</a>\", calling <code>require()</code> is an expensive operation. If you are able to do so, bundle your application's code into a single file.</p>\n<h3 id=\"почему-6\"><a href=\"#почему-6\">Почему?</a></h3>\n<p>Modern JavaScript development usually involves many files and modules. While that's perfectly fine for developing with Electron, we heavily recommend that you bundle all your code into one single file to ensure that the overhead included in calling <code>require()</code> is only paid once when your application loads.</p>\n<h3 id=\"как-6\"><a href=\"#как-6\">Как?</a></h3>\n<p>There are numerous JavaScript bundlers out there and we know better than to anger the community by recommending one tool over another. We do however recommend that you use a bundler that is able to handle Electron's unique environment that needs to handle both Node.js and browser environments.</p>\n<p>As of writing this article, the popular choices include <a href=\"https://webpack.js.org/\">Webpack</a>, <a href=\"https://parceljs.org/\">Parcel</a>, and <a href=\"https://rollupjs.org/\">rollup.js</a>.</p>",
      "title": "Характеристика",
      "description": ""
    },
    "/docs/api/structures/point": {
      "locale": "ru-RU",
      "slug": "point",
      "href": "/docs/api/structures/point",
      "crowdinFileId": "256475",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/point.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"point-object\"><a href=\"#point-object\">Point Object</a></h1>\n<ul>\n<li><code>x</code> Number</li>\n<li><code>y</code> Number</li>\n</ul>\n<p><strong>Note:</strong> Both <code>x</code> and <code>y</code> must be whole integers, when providing a point object as input to an Electron API we will automatically round your <code>x</code> and <code>y</code> values to the nearest whole integer.</p>",
      "title": "Point Object",
      "description": ""
    },
    "/docs/api/structures/post-body": {
      "locale": "ru-RU",
      "slug": "post-body",
      "href": "/docs/api/structures/post-body",
      "crowdinFileId": "256477",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/post-body.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"postbody-object\"><a href=\"#postbody-object\">PostBody Object</a></h1>\n<ul>\n<li><code>data</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)[] - The post data to be sent to the new window.</li>\n<li><code>contentType</code> String - The <code>content-type</code> header used for the data. One of <code>application/x-www-form-urlencoded</code> or <code>multipart/form-data</code>. Corresponds to the <code>enctype</code> attribute of the submitted HTML form.</li>\n<li><code>boundary</code> String (optional) - The boundary used to separate multiple parts of the message. Only valid when <code>contentType</code> is <code>multipart/form-data</code>.</li>\n</ul>\n<p>Note that keys starting with <code>--</code> are not currently supported. For example, this will errantly submit as <code>multipart/form-data</code> when <code>nativeWindowOpen</code> is set to <code>false</code> in webPreferences:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">form</span>\n  <span class=\"hljs-attr\">target</span>=<span class=\"hljs-string\">\"_blank\"</span>\n  <span class=\"hljs-attr\">method</span>=<span class=\"hljs-string\">\"POST\"</span>\n  <span class=\"hljs-attr\">enctype</span>=<span class=\"hljs-string\">\"application/x-www-form-urlencoded\"</span>\n  <span class=\"hljs-attr\">action</span>=<span class=\"hljs-string\">\"https://postman-echo.com/post\"</span>\n></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">input</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text\"</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">\"--theKey\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">input</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"submit\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">form</span>></span>\n</code></pre>",
      "title": "PostBody Object",
      "description": ""
    },
    "/docs/api/power-monitor": {
      "locale": "ru-RU",
      "slug": "power-monitor",
      "href": "/docs/api/power-monitor",
      "crowdinFileId": "256351",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/power-monitor.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"powermonitor\"><a href=\"#powermonitor\">powerMonitor</a></h1>\n<blockquote>\n<p>Отслеживает изменения состояния питания устройства.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<h2 id=\"события\"><a href=\"#события\">События</a></h2>\n<p>Модуль <code>powerMonitor</code> выдает следующие события:</p>\n<h3 id=\"событие-suspend\"><a href=\"#событие-suspend\">Событие: 'suspend'</a></h3>\n<p>Возникает, когда система приостановлена.</p>\n<h3 id=\"событие-resume\"><a href=\"#событие-resume\">Событие: 'resume'</a></h3>\n<p>Возникает при возобновлении работы системы.</p>\n<h3 id=\"event-on-ac-macos-windows\"><a href=\"#event-on-ac-macos-windows\">Event: 'on-ac' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Используется при переключении системы на питание от переменного тока (блока питания).</p>\n<h3 id=\"event-on-battery-macos--windows\"><a href=\"#event-on-battery-macos--windows\">Event: 'on-battery' <em>macOS</em>  <em>Windows</em></a></h3>\n<p>Используется при переключении системы на питание от батареи.</p>\n<h3 id=\"событие-shutdown-linux-macos\"><a href=\"#событие-shutdown-linux-macos\">Событие: 'shutdown' <em>Linux</em> <em>macOS</em></a></h3>\n<p>Возникает, когда система собирается перезагрузиться или выключиться. Если обработчик события вызывает <code>e.preventDefault()</code>, Electron попытается отложить завершение работы системы, чтобы приложение корректно завершило работу. Если вызывается <code>e.preventDefault()</code>, приложение должно выйти как можно скорее, вызвав что-то вроде <code>app.quit()</code>.</p>\n<h3 id=\"событие-lock-screen-macos-windows\"><a href=\"#событие-lock-screen-macos-windows\">Событие: 'lock-screen' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Возникает, когда система собирается заблокировать экран.</p>\n<h3 id=\"событие-unlock-screen-macos-windows\"><a href=\"#событие-unlock-screen-macos-windows\">Событие: 'unlock-screen' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Возникает, как только система разблокирует экран.</p>\n<h3 id=\"event-user-did-become-active-macos\"><a href=\"#event-user-did-become-active-macos\">Event: 'user-did-become-active' <em>macOS</em></a></h3>\n<p>Emitted when a login session is activated. See <a href=\"https://developer.apple.com/documentation/appkit/nsworkspacesessiondidbecomeactivenotification?language=objc\">documentation</a> for more information.</p>\n<h3 id=\"event-user-did-resign-active-macos\"><a href=\"#event-user-did-resign-active-macos\">Event: 'user-did-resign-active' <em>macOS</em></a></h3>\n<p>Emitted when a login session is deactivated. See <a href=\"https://developer.apple.com/documentation/appkit/nsworkspacesessiondidresignactivenotification?language=objc\">documentation</a> for more information.</p>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code>powerMonitor</code> имеет следующие методы:</p>\n<h3 id=\"powermonitorgetsystemidlestateidlethreshold\"><a href=\"#powermonitorgetsystemidlestateidlethreshold\"><code>powerMonitor.getSystemIdleState(idleThreshold)</code></a></h3>\n<ul>\n<li><code>idleThreshold</code> Integer</li>\n</ul>\n<p>Returns <code>String</code> - The system's current state. Может быть <code>active</code>, <code>idle</code>, <code>locked</code> или <code>unknown</code>.</p>\n<p>Calculate the system idle state. <code>idleThreshold</code> is the amount of time (in seconds) before considered idle.  <code>locked</code> is available on supported systems only.</p>\n<h3 id=\"powermonitorgetsystemidletime\"><a href=\"#powermonitorgetsystemidletime\"><code>powerMonitor.getSystemIdleTime()</code></a></h3>\n<p>Возвращает <code>Integer</code> - время простоя в секундах</p>\n<p>Расчет времени простоя системы в секундах.</p>\n<h3 id=\"powermonitorisonbatterypower\"><a href=\"#powermonitorisonbatterypower\"><code>powerMonitor.isOnBatteryPower()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the system is on battery power.</p>\n<p>To monitor for changes in this property, use the <code>on-battery</code> and <code>on-ac</code> events.</p>\n<h2 id=\"свойства\"><a href=\"#свойства\">Свойства</a></h2>\n<h3 id=\"powermonitoronbatterypower\"><a href=\"#powermonitoronbatterypower\"><code>powerMonitor.onBatteryPower</code></a></h3>\n<p>A <code>Boolean</code> property. True if the system is on battery power.</p>\n<p>See <a href=\"#powermonitorisonbatterypower\"><code>powerMonitor.isOnBatteryPower()</code></a>.</p>",
      "title": "powerMonitor",
      "description": "Отслеживает изменения состояния питания устройства."
    },
    "/docs/api/power-save-blocker": {
      "locale": "ru-RU",
      "slug": "power-save-blocker",
      "href": "/docs/api/power-save-blocker",
      "crowdinFileId": "256353",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/power-save-blocker.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"powersaveblocker\"><a href=\"#powersaveblocker\">powerSaveBlocker</a></h1>\n<blockquote>\n<p>Предотвращает переход системы в режим пониженного потребления питания.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p>Например:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { powerSaveBlocker } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> id = powerSaveBlocker.start(<span class=\"hljs-string\">'prevent-display-sleep'</span>)\n<span class=\"hljs-built_in\">console</span>.log(powerSaveBlocker.isStarted(id))\n\npowerSaveBlocker.stop(id)\n</code></pre>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code>powerSaveBlocker</code> имеет следующие методы:</p>\n<h3 id=\"powersaveblockerstarttype\"><a href=\"#powersaveblockerstarttype\"><code>powerSaveBlocker.start(type)</code></a></h3>\n<ul>\n<li><code>type</code> String - Power save blocker type.<ul>\n<li><code>prevent-app-suspension</code> - Prevent the application from being suspended. Keeps system active but allows screen to be turned off. Example use cases: downloading a file or playing audio.</li>\n<li><code>prevent-display-sleep</code> - Prevent the display from going to sleep. Keeps system and screen active. Example use case: playing video.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Integer</code> - Идентификатор блокировщика, назначенный этому блокировщику питания.</p>\n<p>Starts preventing the system from entering lower-power mode. Returns an integer identifying the power save blocker.</p>\n<p><strong>Примечание:</strong> <code>prevent-display-sleep</code> имеет более высокий приоритет перед <code>prevent-app-suspension</code>. Вступает в силу только наиболее высокий тип приоритета. Другими словами, <code>prevent-display-sleep</code> всегда выше <code>prevent-app-suspension</code>.</p>\n<p>Например, API-интерфейс, вызывающий запросы A для <code>prevent-app-suspension</code>, и другой вызов запросов B для <code>prevent-display-sleep</code>. <code>prevent-display-sleep</code> будет использоваться до тех пор, пока B не прекратит свой запрос. После этого, будет использоваться <code>prevent-app-suspension</code>.</p>\n<h3 id=\"powersaveblockerstopid\"><a href=\"#powersaveblockerstopid\"><code>powerSaveBlocker.stop(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer - Идентификатор блокировщика энергосбережения, возвращённый <code>powerSaveBlocker.start</code>.</li>\n</ul>\n<p>Останавливает указанный блокировщик энергосбережения.</p>\n<h3 id=\"powersaveblockerisstartedid\"><a href=\"#powersaveblockerisstartedid\"><code>powerSaveBlocker.isStarted(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer - Идентификатор блокировщика энергосбережения, возвращённый <code>powerSaveBlocker.start</code>.</li>\n</ul>\n<p>Возвращает <code>Boolean</code> - Запущен ли соответствующий <code>powerSaveBlocker</code>.</p>",
      "title": "powerSaveBlocker",
      "description": "Предотвращает переход системы в режим пониженного потребления питания."
    },
    "/docs/api/structures/printer-info": {
      "locale": "ru-RU",
      "slug": "printer-info",
      "href": "/docs/api/structures/printer-info",
      "crowdinFileId": "256479",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/printer-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"printerinfo-object\"><a href=\"#printerinfo-object\">PrinterInfo Object</a></h1>\n<ul>\n<li><code>name</code> String - the name of the printer as understood by the OS.</li>\n<li><code>displayName</code> String - the name of the printer as shown in Print Preview.</li>\n<li><code>description</code> String - a longer description of the printer's type.</li>\n<li><code>status</code> Number - the current status of the printer.</li>\n<li><code>isDefault</code> Boolean - whether or not a given printer is set as the default printer on the OS.</li>\n<li><code>options</code> Object - an object containing a variable number of platform-specific printer information.</li>\n</ul>\n<p>The number represented by <code>status</code> means different things on different platforms: on Windows its potential values can be found <a href=\"https://docs.microsoft.com/en-us/windows/win32/printdocs/printer-info-2\">here</a>, and on Linux and macOS they can be found <a href=\"https://www.cups.org/doc/cupspm.html\">here</a>.</p>\n<h2 id=\"пример\"><a href=\"#пример\">Пример</a></h2>\n<p>Below is an example of some of the additional options that may be set which may be different on each platform.</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Austin_4th_Floor_Printer___C02XK13BJHD4'</span>,\n  <span class=\"hljs-attr\">displayName</span>: <span class=\"hljs-string\">'Austin 4th Floor Printer @ C02XK13BJHD4'</span>,\n  <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'TOSHIBA ColorMFP'</span>,\n  <span class=\"hljs-attr\">status</span>: <span class=\"hljs-number\">3</span>,\n  <span class=\"hljs-attr\">isDefault</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">options</span>: {\n    <span class=\"hljs-attr\">copies</span>: <span class=\"hljs-string\">'1'</span>,\n    <span class=\"hljs-string\">'device-uri'</span>: <span class=\"hljs-string\">'dnssd://Austin%204th%20Floor%20Printer%20%40%20C02XK13BJHD4._ipps._tcp.local./?uuid=71687f1e-1147-3274-6674-22de61b110bd'</span>,\n    <span class=\"hljs-attr\">finishings</span>: <span class=\"hljs-string\">'3'</span>,\n    <span class=\"hljs-string\">'job-cancel-after'</span>: <span class=\"hljs-string\">'10800'</span>,\n    <span class=\"hljs-string\">'job-hold-until'</span>: <span class=\"hljs-string\">'no-hold'</span>,\n    <span class=\"hljs-string\">'job-priority'</span>: <span class=\"hljs-string\">'50'</span>,\n    <span class=\"hljs-string\">'job-sheets'</span>: <span class=\"hljs-string\">'none,none'</span>,\n    <span class=\"hljs-string\">'marker-change-time'</span>: <span class=\"hljs-string\">'0'</span>,\n    <span class=\"hljs-string\">'number-up'</span>: <span class=\"hljs-string\">'1'</span>,\n    <span class=\"hljs-string\">'printer-commands'</span>: <span class=\"hljs-string\">'ReportLevels,PrintSelfTestPage,com.toshiba.ColourProfiles.update,com.toshiba.EFiling.update,com.toshiba.EFiling.checkPassword'</span>,\n    <span class=\"hljs-string\">'printer-info'</span>: <span class=\"hljs-string\">'Austin 4th Floor Printer @ C02XK13BJHD4'</span>,\n    <span class=\"hljs-string\">'printer-is-accepting-jobs'</span>: <span class=\"hljs-string\">'true'</span>,\n    <span class=\"hljs-string\">'printer-is-shared'</span>: <span class=\"hljs-string\">'false'</span>,\n    <span class=\"hljs-string\">'printer-is-temporary'</span>: <span class=\"hljs-string\">'false'</span>,\n    <span class=\"hljs-string\">'printer-location'</span>: <span class=\"hljs-string\">''</span>,\n    <span class=\"hljs-string\">'printer-make-and-model'</span>: <span class=\"hljs-string\">'TOSHIBA ColorMFP'</span>,\n    <span class=\"hljs-string\">'printer-state'</span>: <span class=\"hljs-string\">'3'</span>,\n    <span class=\"hljs-string\">'printer-state-change-time'</span>: <span class=\"hljs-string\">'1573472937'</span>,\n    <span class=\"hljs-string\">'printer-state-reasons'</span>: <span class=\"hljs-string\">'offline-report,com.toshiba.snmp.failed'</span>,\n    <span class=\"hljs-string\">'printer-type'</span>: <span class=\"hljs-string\">'10531038'</span>,\n    <span class=\"hljs-string\">'printer-uri-supported'</span>: <span class=\"hljs-string\">'ipp://localhost/printers/Austin_4th_Floor_Printer___C02XK13BJHD4'</span>,\n    <span class=\"hljs-attr\">system_driverinfo</span>: <span class=\"hljs-string\">'T'</span>\n  }\n}\n</code></pre>",
      "title": "PrinterInfo Object",
      "description": ""
    },
    "/docs/api/process": {
      "locale": "ru-RU",
      "slug": "process",
      "href": "/docs/api/process",
      "crowdinFileId": "256355",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/process.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"process\"><a href=\"#process\">process</a></h1>\n<blockquote>\n<p>Расширения для обработки объекта.</p>\n</blockquote>\n<p>Процессы: <a href=\"/docs/glossary#main-process\">Основной</a>, <a href=\"/docs/glossary#renderer-process\">Графический</a></p>\n<p>Объект Electron <code>process</code> является расширенной версией объекта <a href=\"https://nodejs.org/api/process.html\">Node.js <code>process</code></a>. Он добавляет следующие события, свойства и методы:</p>\n<h2 id=\"песочница\"><a href=\"#песочница\">Песочница</a></h2>\n<p>В песочнице графический объект <code>process</code> содержит только подмножество API:</p>\n<ul>\n<li><code>crash() - Падение</code></li>\n<li><code>hang() - Зависание</code></li>\n<li><code>getCreationTime() - Время создания</code></li>\n<li><code>getHeapStatistics() - Статистика кучи (распределяемой памяти)</code></li>\n<li><code>getBlinkMemoryInfo() - Информация о памяти Blink</code></li>\n<li><code>getProcessMemoryInfo() - Сведения о памяти процесса</code></li>\n<li><code>getSystemMemoryInfo() - Информация о системной памяти</code></li>\n<li><code>getSystemVersion() - Версия системы</code></li>\n<li><code>getCPUUsage() - Использование процессора</code></li>\n<li><code>getIOCounters() - Счетчики IO</code></li>\n<li><code>uptime()</code></li>\n<li><code>argv</code></li>\n<li><code>execPath</code></li>\n<li><code>env</code></li>\n<li><code>pid</code></li>\n<li><code>arch</code></li>\n<li><code>platform</code></li>\n<li><code>sandboxed - Запущена ли песочница</code></li>\n<li><code>contextIsolated</code></li>\n<li><code>тип</code></li>\n<li><code>версия</code></li>\n<li><code>versions - Список с версиями и их зависимостями</code></li>\n<li><code>mas - Является ли сборкой Mac App Store</code></li>\n<li><code>windowsStore - Является ли приложением Windows Store (appx)</code></li>\n<li><code>contextId</code></li>\n</ul>\n<h2 id=\"события\"><a href=\"#события\">События</a></h2>\n<h3 id=\"событие-loaded\"><a href=\"#событие-loaded\">Событие: 'loaded'</a></h3>\n<p>Срабатывает, когда Electron загрузил свой скрипт внутренней инициализации и начинает загружать веб-страницу или основной скрипт.</p>\n<h2 id=\"свойства\"><a href=\"#свойства\">Свойства</a></h2>\n<h3 id=\"processdefaultapp-только-чтение\"><a href=\"#processdefaultapp-только-чтение\"><code>process.defaultApp</code> <em>Только чтение</em></a></h3>\n<p>A <code>Boolean</code>. When app is started by being passed as parameter to the default app, this property is <code>true</code> in the main process, otherwise it is <code>undefined</code>.</p>\n<h3 id=\"processismainframe-только-чтение\"><a href=\"#processismainframe-только-чтение\"><code>process.isMainFrame</code> <em>Только чтение</em></a></h3>\n<p>A <code>Boolean</code>, <code>true</code> when the current renderer context is the \"main\" renderer frame. If you want the ID of the current frame you should use <code>webFrame.routingId</code>.</p>\n<h3 id=\"processmas-только-чтение\"><a href=\"#processmas-только-чтение\"><code>process.mas</code> <em>Только чтение</em></a></h3>\n<p>A <code>Boolean</code>. For Mac App Store build, this property is <code>true</code>, for other builds it is <code>undefined</code>.</p>\n<h3 id=\"processnoasar\"><a href=\"#processnoasar\"><code>process.noAsar</code></a></h3>\n<p>A <code>Boolean</code> that controls ASAR support inside your application. Setting this to <code>true</code> will disable the support for <code>asar</code> archives in Node's built-in modules.</p>\n<h3 id=\"processnodeprecation\"><a href=\"#processnodeprecation\"><code>process.noDeprecation</code></a></h3>\n<p><code>Boolean</code>. Контролирует будут ли неодобряющие предупреждения выводиться в <code>stderr</code>. Установка в <code>true</code> заглушит неодобряющие предупреждения. Это свойство используется вместо флага командной строки <code>--no-deprecation</code>.</p>\n<h3 id=\"processresourcespath-только-чтение\"><a href=\"#processresourcespath-только-чтение\"><code>process.resourcesPath</code> <em>Только чтение</em></a></h3>\n<p><code>String</code>. Представляет из себя путь до каталога с ресурсами.</p>\n<h3 id=\"processsandboxed-только-чтение\"><a href=\"#processsandboxed-только-чтение\"><code>process.sandboxed</code> <em>Только чтение</em></a></h3>\n<p>A <code>Boolean</code>. When the renderer process is sandboxed, this property is <code>true</code>, otherwise it is <code>undefined</code>.</p>\n<h3 id=\"processcontextisolated-только-чтение\"><a href=\"#processcontextisolated-только-чтение\"><code>process.contextIsolated</code> <em>Только чтение</em></a></h3>\n<p>A <code>Boolean</code> that indicates whether the current renderer context has <code>contextIsolation</code> enabled. It is <code>undefined</code> in the main process.</p>\n<h3 id=\"processthrowdeprecation\"><a href=\"#processthrowdeprecation\"><code>process.throwDeprecation</code></a></h3>\n<p><code>Boolean</code>, определяет, будут ли предупреждения об устаревании выдаваться как исключения. Установка значения <code>true</code> приведет к выдаче ошибок при устаревании. Это свойство используется вместо флага командной строки <code>--throw-deprecation</code>.</p>\n<h3 id=\"processtracedeprecation\"><a href=\"#processtracedeprecation\"><code>process.traceDeprecation</code></a></h3>\n<p><code>Boolean</code>, определяет, будут ли сообщения об устаревании выдаваемые в <code>stderr</code>, включать трассировку стека. Установка значения <code>true</code> напечатает трассировку стека при устаревании. Это свойство вместо флага командной строки <code>--trace-deprecation</code>.</p>\n<h3 id=\"processtraceprocesswarnings\"><a href=\"#processtraceprocesswarnings\"><code>process.traceProcessWarnings</code></a></h3>\n<p><code>Boolean</code>, определяет, будут ли предупреждения процесса, выдаваемые в <code>stderr</code>, включать трассировку стека. Установка значения <code>true</code> напечатает трассировку стека для предупреждений процесса (включая устаревания). Это свойство вместо флага командной строки <code>--trace-warnings</code>.</p>\n<h3 id=\"processtype-только-чтение\"><a href=\"#processtype-только-чтение\"><code>process.type</code> <em>Только чтение</em></a></h3>\n<p>A <code>String</code> representing the current process's type, can be:</p>\n<ul>\n<li><code>browser</code> - The main process</li>\n<li><code>renderer</code> - A renderer process</li>\n<li><code>worker</code> - In a web worker</li>\n</ul>\n<h3 id=\"processversionschrome-только-чтение\"><a href=\"#processversionschrome-только-чтение\"><code>process.versions.chrome</code> <em>Только чтение</em></a></h3>\n<p><code>String</code>, представляющая строку версии Chrome.</p>\n<h3 id=\"processversionselectron-только-чтение\"><a href=\"#processversionselectron-только-чтение\"><code>process.versions.electron</code> <em>Только чтение</em></a></h3>\n<p><code>String</code>, представляющая строку версии Electron.</p>\n<h3 id=\"processwindowsstore-только-чтение\"><a href=\"#processwindowsstore-только-чтение\"><code>process.windowsStore</code> <em>Только чтение</em></a></h3>\n<p>A <code>Boolean</code>. If the app is running as a Windows Store app (appx), this property is <code>true</code>, for otherwise it is <code>undefined</code>.</p>\n<h3 id=\"processcontextid-только-чтение\"><a href=\"#processcontextid-только-чтение\"><code>process.contextId</code> <em>Только чтение</em></a></h3>\n<p>A <code>String</code> (optional) representing a globally unique ID of the current JavaScript context. Each frame has its own JavaScript context. When contextIsolation is enabled, the isolated world also has a separate JavaScript context. This property is only available in the renderer process.</p>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Объект <code>process</code> имеет следующие методы:</p>\n<h3 id=\"processcrash\"><a href=\"#processcrash\"><code>process.crash()</code></a></h3>\n<p>Вызывает сбой основного потока текущего процесса.</p>\n<h3 id=\"processgetcreationtime\"><a href=\"#processgetcreationtime\"><code>process.getCreationTime()</code></a></h3>\n<p>Возвращает <code>Number | null</code> - Количество миллисекунд с начала эпохи, или <code>null</code>, если информация недоступна</p>\n<p>Indicates the creation time of the application. Время представлено как количество миллисекунд с начала эпохи. It returns null if it is unable to get the process creation time.</p>\n<h3 id=\"processgetcpuusage\"><a href=\"#processgetcpuusage\"><code>process.getCPUUsage()</code></a></h3>\n<p>Возвращает <a href=\"/docs/api/structures/cpu-usage\"><code>CPUUsage</code></a></p>\n<h3 id=\"processgetiocounters-windows-linux\"><a href=\"#processgetiocounters-windows-linux\"><code>process.getIOCounters()</code> <em>Windows</em> <em>Linux</em></a></h3>\n<p>Возвращает <a href=\"/docs/api/structures/io-counters\"><code>IOCounters</code></a></p>\n<h3 id=\"processgetheapstatistics\"><a href=\"#processgetheapstatistics\"><code>process.getHeapStatistics()</code></a></h3>\n<p>Возвращает <code>Object</code>:</p>\n<ul>\n<li><code>totalHeapSize</code> Integer - Память, выделенная для кучи</li>\n<li><code>totalHeapSizeExecutable</code> Integer - Память для исполняемого файла</li>\n<li><code>totalPhysicalSize</code> Integer - Заданный размер</li>\n<li><code>totalAvailableSize</code> Integer - Доступный размер кучи</li>\n<li><code>usedHeapSize</code> Integer - Память, используемая данными приложения</li>\n<li><code>heapSizeLimit</code> Integer - Абсолютный предел, который куча не может превышать</li>\n<li><code>mallocedMemory</code> Integer - Текущий объем памяти, полученный через malloc</li>\n<li><code>peakMallocedMemory</code> Integer - Пиковый объем памяти, полученный через malloc</li>\n<li><code>doesZapGarbage</code> Boolean - Включена ли опция --zap_code_space</li>\n</ul>\n<p>Returns an object with V8 heap statistics. Обратите внимание, что вся статистика предоставляется ​​в Килобайтах.</p>\n<h3 id=\"processgetblinkmemoryinfo\"><a href=\"#processgetblinkmemoryinfo\"><code>process.getBlinkMemoryInfo()</code></a></h3>\n<p>Возвращает <code>Object</code>:</p>\n<ul>\n<li><code>allocated</code> Integer - Размер всех выделенных объектов в Килобайтах.</li>\n<li><code>marked</code> Integer - Размер всех отмеченных объектов в Килобайтах.</li>\n<li><code>total</code> Integer - Всего выделено места в Килобайтах.</li>\n</ul>\n<p>Returns an object with Blink memory information. It can be useful for debugging rendering / DOM related memory issues. Note that all values are reported in Kilobytes.</p>\n<h3 id=\"processgetprocessmemoryinfo\"><a href=\"#processgetprocessmemoryinfo\"><code>process.getProcessMemoryInfo()</code></a></h3>\n<p>Возвращает <code>Promise&#x3C;ProcessMemoryInfo></code> - Разрешается с <a href=\"/docs/api/structures/process-memory-info\">ProcessMemoryInfo</a></p>\n<p>Returns an object giving memory usage statistics about the current process. Note that all statistics are reported in Kilobytes. This api should be called after app ready.</p>\n<p>Chromium не предоставляет значение <code>residentSet</code> для macOS. Это связано с тем, что MacOS сжимает в памяти страницы, которые в последнее время не использовались. В результате значение размера резидентного набора не соответствует ожидаемому. <code>private</code> память является более репрезентативной для фактического использования перед сжатием памяти процесса в MacOS.</p>\n<h3 id=\"processgetsystemmemoryinfo\"><a href=\"#processgetsystemmemoryinfo\"><code>process.getSystemMemoryInfo()</code></a></h3>\n<p>Возвращает <code>Object</code>:</p>\n<ul>\n<li><code>total</code> Integer - Общий объем физической памяти в килобайтах, доступный системе.</li>\n<li><code>free</code> Integer - Общий объем памяти, не используемый приложениями или дисковым кэшем.</li>\n<li><code>swapTotal</code> Integer <em>Windows</em> <em>Linux</em> - Общий объем памяти подкачки в килобайтах, доступной системе.</li>\n<li><code>swapFree</code> Integer <em>Windows</em> <em>Linux</em> - Свободный объем памяти подкачки в килобайтах, доступный системе.</li>\n</ul>\n<p>Returns an object giving memory usage statistics about the entire system. Note that all statistics are reported in Kilobytes.</p>\n<h3 id=\"processgetsystemversion\"><a href=\"#processgetsystemversion\"><code>process.getSystemVersion()</code></a></h3>\n<p>Возвращает <code>String</code> - Версию операционной системы хоста.</p>\n<p>Пример:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> version = process.getSystemVersion()\n<span class=\"hljs-built_in\">console</span>.log(version)\n<span class=\"hljs-comment\">// В macOS -> '10.13.6'</span>\n<span class=\"hljs-comment\">// В Windows -> '10.0.17763'</span>\n<span class=\"hljs-comment\">// В Linux -> '4.15.0-45-generic'</span>\n</code></pre>\n<p><strong>Примечание:</strong> В отличие от <code>os.release()</code> он возвращает фактическую версию операционной системы, а не версию ядра на MacOS.</p>\n<h3 id=\"processtakeheapsnapshotfilepath\"><a href=\"#processtakeheapsnapshotfilepath\"><code>process.takeHeapSnapshot(filePath)</code></a></h3>\n<ul>\n<li><code>filePath</code> String - Path to the output file.</li>\n</ul>\n<p>Возвращает <code>Boolean</code>, который указывает успешно ли создан снимок.</p>\n<p>Делает снимок кучи V8 и сохраняет его в <code>filePath</code>.</p>\n<h3 id=\"processhang\"><a href=\"#processhang\"><code>process.hang()</code></a></h3>\n<p>Вызывает зависание основного потока текущего процесса.</p>\n<h3 id=\"processsetfdlimitmaxdescriptors-macos-linux\"><a href=\"#processsetfdlimitmaxdescriptors-macos-linux\"><code>process.setFdLimit(maxDescriptors)</code> <em>macOS</em> <em>Linux</em></a></h3>\n<ul>\n<li><code>maxDescriptors</code> Integer</li>\n</ul>\n<p>Устанавливает мягкое ограничение дескрипторов файлов до <code>maxDescriptors</code> или жесткое ограничение операционной системы, в зависимости от того, какое значение ниже для текущего процесса.</p>",
      "title": "process",
      "description": "Расширения для обработки объекта."
    },
    "/docs/api/structures/process-memory-info": {
      "locale": "ru-RU",
      "slug": "process-memory-info",
      "href": "/docs/api/structures/process-memory-info",
      "crowdinFileId": "256481",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/process-memory-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"processmemoryinfo-object\"><a href=\"#processmemoryinfo-object\">ProcessMemoryInfo Object</a></h1>\n<ul>\n<li><code>residentSet</code> Integer <em>Linux</em> <em>Windows</em> - The amount of memory currently pinned to actual physical RAM in Kilobytes.</li>\n<li><code>private</code> Integer - The amount of memory not shared by other processes, such as JS heap or HTML content in Kilobytes.</li>\n<li><code>shared</code> Integer - The amount of memory shared between processes, typically memory consumed by the Electron code itself in Kilobytes.</li>\n</ul>",
      "title": "ProcessMemoryInfo Object",
      "description": ""
    },
    "/docs/api/structures/process-metric": {
      "locale": "ru-RU",
      "slug": "process-metric",
      "href": "/docs/api/structures/process-metric",
      "crowdinFileId": "256483",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/process-metric.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"processmetric-object\"><a href=\"#processmetric-object\">ProcessMetric Object</a></h1>\n<ul>\n<li><code>pid</code> Integer - Process id of the process.</li>\n<li><code>type</code> String - Тип процесса. Одно из следующих значений:<ul>\n<li><code>Browser</code></li>\n<li><code>Tab</code></li>\n<li><code>Utility</code></li>\n<li><code>Zygote</code></li>\n<li><code>Sandbox helper</code></li>\n<li><code>GPU</code></li>\n<li><code>Pepper Plugin</code></li>\n<li><code>Pepper Plugin Broker</code></li>\n<li><code>Unknown</code></li>\n</ul></li>\n<li><code>serviceName</code> String (optional) - The non-localized name of the process.</li>\n<li><code>name</code> String (опционально) - Название процесса. Например: <code>Audio Service</code>, <code>Content Decryption Module Service</code>, <code>Network Service</code>, <code>Video Capture</code> и т.д.</li>\n<li><code>cpu</code> <a href=\"/docs/api/structures/cpu-usage\">CPUUsage</a> - CPU usage of the process.</li>\n<li><code>creationTime</code> Number - Creation time for this process. The time is represented as number of milliseconds since epoch. Since the <code>pid</code> can be reused after a process dies, it is useful to use both the <code>pid</code> and the <code>creationTime</code> to uniquely identify a process.</li>\n<li><code>memory</code> <a href=\"/docs/api/structures/memory-info\">MemoryInfo</a> - Memory information for the process.</li>\n<li><code>sandboxed</code> Boolean (optional) <em>macOS</em> <em>Windows</em> - Whether the process is sandboxed on OS level.</li>\n<li><code>integrityLevel</code> String (optional) <em>Windows</em> - One of the following values:<ul>\n<li><code>untrusted</code></li>\n<li><code>low</code></li>\n<li><code>medium</code></li>\n<li><code>high</code></li>\n<li><code>unknown</code></li>\n</ul></li>\n</ul>",
      "title": "ProcessMetric Object",
      "description": ""
    },
    "/docs/tutorial/process-model": {
      "locale": "ru-RU",
      "slug": "process-model",
      "href": "/docs/tutorial/process-model",
      "crowdinFileId": "256233",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/process-model.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"моделирование-процесса\"><a href=\"#моделирование-процесса\">Моделирование процесса</a></h1>\n<p>Electron inherits its multi-process architecture from Chromium, which makes the framework architecturally very similar to a modern web browser. In this guide, we'll expound on the conceptual knowledge of Electron that we applied in the minimal <a href=\"/docs/tutorial/quick-start\">quick start app</a>.</p>\n<h2 id=\"why-not-a-single-process\"><a href=\"#why-not-a-single-process\">Why not a single process?</a></h2>\n<p>Web browsers are incredibly complicated applications. Aside from their primary ability to display web content, they have many secondary responsibilities, such as managing multiple windows (or tabs) and loading third-party extensions.</p>\n<p>In the earlier days, browsers usually used a single process for all of this functionality. Although this pattern meant less overhead for each tab you had open, it also meant that one website crashing or hanging would affect the entire browser.</p>\n<h2 id=\"the-multi-process-model\"><a href=\"#the-multi-process-model\">The multi-process model</a></h2>\n<p>To solve this problem, the Chrome team decided that each tab would render in its own process, limiting the harm that buggy or malicious code on a web page could cause to the app as a whole. A single browser process then controls these processes, as well as the application lifecycle as a whole. This diagram below from the <a href=\"https://www.google.com/googlebooks/chrome/\">Chrome Comic</a> visualizes this model:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/chrome-processes.png\" alt=\"Chrome&#x27;s multi-process architecture\"></p>\n<p>Electron applications are structured very similarly. As an app developer, you control two types of processes: main and renderer. These are analogous to Chrome's own browser and renderer processes outlined above.</p>\n<h2 id=\"the-main-process\"><a href=\"#the-main-process\">The main process</a></h2>\n<p>Each Electron app has a single main process, which acts as the application's entry point. The main process runs in a Node.js environment, meaning it has the ability to <code>require</code> modules and use all of Node.js APIs.</p>\n<h3 id=\"window-management\"><a href=\"#window-management\">Window management</a></h3>\n<p>The main process' primary purpose is to create and manage application windows with the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> module.</p>\n<p>Each instance of the <code>BrowserWindow</code> class creates an application window that loads a web page in a separate renderer process. You can interact with this web content from the main process using the window's <a href=\"/docs/api/web-contents\"><code>webContents</code></a> object.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> contents = win.webContents\n<span class=\"hljs-built_in\">console</span>.log(contents)\n</code></pre>\n<blockquote>\n<p>Note: A renderer process is also created for <a href=\"/docs/tutorial/web-embeds\">web embeds</a> such as the <code>BrowserView</code> module. The <code>webContents</code> object is also accessible for embedded web content.</p>\n</blockquote>\n<p>Because the <code>BrowserWindow</code> module is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\"><code>EventEmitter</code></a>, you can also add handlers for various user events (for example, minimizing or maximizing your window).</p>\n<p>When a <code>BrowserWindow</code> instance is destroyed, its corresponding renderer process gets terminated as well.</p>\n<h3 id=\"application-lifecycle\"><a href=\"#application-lifecycle\">Application lifecycle</a></h3>\n<p>The main process also controls your application's lifecycle through Electron's <a href=\"/docs/api/app\"><code>app</code></a> module. This module provides a large set of events and methods that you can use to add custom application behaviour (for instance, programatically quitting your application, modifying the application dock, or showing an About panel).</p>\n<p>As a practical example, the app shown in the <a href=\"/docs/tutorial/quick-start#manage-your-windows-lifecycle\">quick start guide</a> uses <code>app</code> APIs to create a more native application window experience.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// выход из приложения на не macOS платформах , если окно программы не открылось</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h3 id=\"native-apis\"><a href=\"#native-apis\">Native APIs</a></h3>\n<p>To extend Electron's features beyond being a Chromium wrapper for web contents, the main process also adds custom APIs to interact with the user's operating system. Electron exposes various modules that control native desktop functionality, such as menus, dialogs, and tray icons.</p>\n<p>For a full list of Electron's main process modules, check out our API documentation.</p>\n<h2 id=\"the-renderer-process\"><a href=\"#the-renderer-process\">The renderer process</a></h2>\n<p>Each Electron app spawns a separate renderer process for each open <code>BrowserWindow</code> (and each web embed). As its name implies, a renderer is responsible for <em>rendering</em> web content. For all intents and purposes, code ran in renderer processes should behave according to web standards (insofar as Chromium does, at least).</p>\n<p>Therefore, all user interfaces and app functionality within a single browser window should be written with the same tools and paradigms that you use on the web.</p>\n<p>Although explaining every web spec is out of scope for this guide, the bare minimum to understand is:</p>\n<ul>\n<li>An HTML file is your entry point for the renderer process.</li>\n<li>UI styling is added through Cascading Style Sheets (CSS).</li>\n<li>Executable JavaScript code can be added through <code>&#x3C;script></code> elements.</li>\n</ul>\n<p>Moreover, this also means that the renderer has no direct access to <code>require</code> or other Node.js APIs. In order to directly include NPM modules in the renderer, you must use the same bundler toolchains (for example, <code>webpack</code> or <code>parcel</code>) that you use on the web.</p>\n<blockquote>\n<p>Note: Renderer processes can be spawned with a full Node.js environment for ease of development. Historically, this used to be the default, but this feature was disabled for security reasons.</p>\n</blockquote>\n<p>At this point, you might be wondering how your renderer process user interfaces can interact with Node.js and Electron's native desktop functionality if these features are only accessible from the main process. In fact, there is no direct way to import Electron's content scripts.</p>\n<h2 id=\"preload-scripts\"><a href=\"#preload-scripts\">Preload scripts</a></h2>\n<!-- Note: This guide doesn't take sandboxing into account, which might fundamentally \nchange the statements here. --> Preload scripts contain code that executes in a renderer process before its web content begins loading. These scripts run within the renderer context, but are granted more privileges by having access to Node.js APIs.\n<p>A preload script can be attached to the main process in the <code>BrowserWindow</code> constructor's <code>webPreferences</code> option.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">//...</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">preload</span>: <span class=\"hljs-string\">'path/to/preload.js'</span>\n  }\n})\n<span class=\"hljs-comment\">//...</span>\n</code></pre>\n<p>Because the preload script shares a global <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window\"><code>Window</code></a> interface with the renderers and can access Node.js APIs, it serves to enhance your renderer by exposing arbitrary APIs in the <code>window</code> global that your web contents can then consume.</p>\n<p>Although preload scripts share a <code>window</code> global with the renderer they're attached to, you cannot directly attach any variables from the preload script to <code>window</code> because of the <a href=\"/docs/tutorial/context-isolation\"><code>contextIsolation</code></a> default.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.myAPI = {\n  <span class=\"hljs-attr\">desktop</span>: <span class=\"hljs-literal\">true</span>\n}\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-built_in\">window</span>.myAPI)\n<span class=\"hljs-comment\">// => undefined</span>\n</code></pre>\n<p>Context Isolation means that preload scripts are isolated from the renderer's main world to avoid leaking any privileged APIs into your web content's code.</p>\n<p>Instead, use the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> module to accomplish this securely:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">desktop</span>: <span class=\"hljs-literal\">true</span>\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-built_in\">window</span>.myAPI)\n<span class=\"hljs-comment\">// => { desktop: true }</span>\n</code></pre>\n<p>This feature is incredibly useful for two main purposes:</p>\n<ul>\n<li>By exposing <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> helpers to the renderer, you can use inter-process communication (IPC) to trigger main process tasks from the renderer (and vice-versa).</li>\n<li>If you're developing an Electron wrapper for an existing web app hosted on a remote URL, you can add custom properties onto the renderer's <code>window</code> global that can be used for desktop-only logic on the web client's side.</li>\n</ul>",
      "title": "Моделирование процесса",
      "description": "Note: A renderer process is also created for web embeds such as the BrowserView module. The webContents object is also accessible for embedded web content."
    },
    "/docs/api/structures/product": {
      "locale": "ru-RU",
      "slug": "product",
      "href": "/docs/api/structures/product",
      "crowdinFileId": "256485",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/product.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"product-object\"><a href=\"#product-object\">Product Object</a></h1>\n<ul>\n<li><code>productIdentifier</code> String - The string that identifies the product to the Apple App Store.</li>\n<li><code>localizedDescription</code> String - A description of the product.</li>\n<li><code>localizedTitle</code> String - The name of the product.</li>\n<li><code>contentVersion</code> String - A string that identifies the version of the content.</li>\n<li><code>contentLengths</code> Number[] - The total size of the content, in bytes.</li>\n<li><code>price</code> Number - The cost of the product in the local currency.</li>\n<li><code>formattedPrice</code> String - The locale formatted price of the product.</li>\n<li><code>currencyCode</code> String - 3 character code presenting a product's currency based on the ISO 4217 standard.</li>\n<li><code>isDownloadable</code> Boolean - A Boolean value that indicates whether the App Store has downloadable content for this product. <code>true</code> if at least one file has been associated with the product.</li>\n</ul>",
      "title": "Product Object",
      "description": ""
    },
    "/docs/tutorial/progress-bar": {
      "locale": "ru-RU",
      "slug": "progress-bar",
      "href": "/docs/tutorial/progress-bar",
      "crowdinFileId": "256235",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/progress-bar.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"taskbar-progress-bar-windows--macos\"><a href=\"#taskbar-progress-bar-windows--macos\">Taskbar Progress Bar (Windows &#x26; macOS)</a></h1>\n<h2 id=\"обзор\"><a href=\"#обзор\">Обзор</a></h2>\n<p>Progress bar позволяет окну предоставлять информацию о прогрессе пользователю без необходимости переключения на само окно.</p>\n<p>В Windows вы можете использовать кнопку панели задач для отображения progress bar.</p>\n<p>![Windows Progress Bar][<a href=\"https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png%5C\">https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png\\</a>]</p>\n<p>На macOS progress bar будет отображаться как часть dock icon.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/macos-progress-bar.png\" alt=\"macOS Progress Bar\"></p>\n<p>На Linux графический интерфейс Unity также имеет аналогичную функцию, которая вам указать планку прогресса в пусковой установке.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/linux-progress-bar.png\" alt=\"Linux Progress Bar\"></p>\n<blockquote>\n<p>ПРИМЕЧАНИЕ: на Windows, каждое окно может иметь свой собственный планку прогресса, в то время как на macOS и Linux (Unity) может быть только одна планка прогресса для приложения.</p>\n</blockquote>\n<hr>\n<p>Все три случая охватываются одним и тем же API - <a href=\"/docs/api/browser-window#winsetprogressbarprogress-options\"><code>setProgressBar()</code></a> методом, доступным на экземпляре <code>BrowserWindow</code>. Чтобы указать свой прогресс, позвоните в этот метод с номером между <code>0</code> и <code>1</code>. Например, если у вас есть давняя задача, которая в настоящее время 63% к завершению, вы назвали бы ее как <code>setProgressBar(0.63)</code>.</p>\n<p>Setting the parameter to negative values (e.g. <code>-1</code>) will remove the progress bar. Setting it to a value greater than <code>1</code> will indicate an indeterminate progress bar in Windows or clamp to 100% in other operating systems. An indeterminate progress bar remains active but does not show an actual percentage, and is used for situations when you do not know how long an operation will take to complete.</p>\n<p>Просмотрите <a href=\"/docs/api/browser-window#winsetprogressbarprogress-options\">документацию по API для большего количества опций и режимов</a>.</p>\n<h2 id=\"пример\"><a href=\"#пример\">Пример</a></h2>\n<p>In this example, we add a progress bar to the main window that increments over time using Node.js timers.</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/progress-bar\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> progressInterval\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-keyword\">const</span> INCREMENT = <span class=\"hljs-number\">0.03</span>\n  <span class=\"hljs-keyword\">const</span> INTERVAL_DELAY = <span class=\"hljs-number\">100</span> <span class=\"hljs-comment\">// ms</span>\n\n  <span class=\"hljs-keyword\">let</span> c = <span class=\"hljs-number\">0</span>\n  progressInterval = setInterval(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// update progress bar to next value</span>\n    <span class=\"hljs-comment\">// values between 0 and 1 will show progress, >1 will show indeterminate or stick at 100%</span>\n    win.setProgressBar(c)\n\n    <span class=\"hljs-comment\">// increment or reset progress bar</span>\n    <span class=\"hljs-keyword\">if</span> (c &#x3C; <span class=\"hljs-number\">2</span>) c += INCREMENT\n    <span class=\"hljs-keyword\">else</span> c = <span class=\"hljs-number\">0</span>\n  }, INTERVAL_DELAY)\n}\n\napp.whenReady().then(createWindow)\n\n<span class=\"hljs-comment\">// before the app is terminated, clear both timers</span>\napp.on(<span class=\"hljs-string\">'before-quit'</span>, () => {\n  clearInterval(progressInterval)\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<p>After launching the Electron application, the dock (macOS) or taskbar (Windows, Unity) should show a progress bar that starts at zero and progresses through 100% to completion. It should then show indeterminate (Windows) or pin to 100% (other operating systems) briefly and then loop.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/dock-progress-bar.png\" alt=\"macOS dock progress bar\"></p>\n<p>Для macOS планка прогресса также будет указана для вашей приложения использовании <a href=\"https://support.apple.com/en-us/HT204100\">Mission Control</a>:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/mission-control-progress-bar.png\" alt=\"Mission Control Progress Bar\"></p>",
      "title": "Taskbar Progress Bar (Windows & macOS)",
      "description": "ПРИМЕЧАНИЕ: на Windows, каждое окно может иметь свой собственный планку прогресса, в то время как на macOS и Linux (Unity) может быть только одна планка прогресса для приложения."
    },
    "/docs/api/protocol": {
      "locale": "ru-RU",
      "slug": "protocol",
      "href": "/docs/api/protocol",
      "crowdinFileId": "256357",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/protocol.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocol\"><a href=\"#protocol\">protocol</a></h1>\n<blockquote>\n<p>Регистрация пользовательского протокола и перехват существующих запросов протокола.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p>Пример реализации протокола, имеющего тот же эффект, что и протокол <code>file://</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })\n})\n</code></pre>\n<p><strong>Примечание:</strong> Все методы, если не указано другого, могут быть использованы только после того, как событие <code>ready</code> модуля <code>app</code> будет отправлено.</p>\n<h2 id=\"использование-протокола-protocol-с-пользовательским-разделом-partition-или-сеансом-session\"><a href=\"#использование-протокола-protocol-с-пользовательским-разделом-partition-или-сеансом-session\">Использование протокола <code>protocol</code> с пользовательским разделом <code>partition</code> или сеансом <code>session</code></a></h2>\n<p>Протокол регистрируется для определенного Electron объекта <a href=\"/docs/api/session\"><code>session</code></a>. Если вы не укажете сеанс, то ваш <code>protocol</code> будет применен сеансу по умолчанию, который использует Electron. Однако, если вы определите <code>partition</code> или <code>session</code> в <code>браузереWindow</code> в <code>webPreferences</code>, то это окно будет использовать другой сеанс, и ваш пользовательский протокол не будет работать, если вы просто используете <code>electron.protocol.XXX</code>.</p>\n<p>Для того, чтобы ваш пользовательский протокол работал в сочетании с пользовательским сеансом, вам необходимо явно зарегистрировать его в этом сеансе.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session, app, protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> partition = <span class=\"hljs-string\">'persist:example'</span>\n  <span class=\"hljs-keyword\">const</span> ses = session.fromPartition(partition)\n\n  ses.protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })\n\n  mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { partition } })\n})\n</code></pre>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code>protocol</code> имеет следующие методы:</p>\n<h3 id=\"protocolregisterschemesasprivilegedcustomschemes\"><a href=\"#protocolregisterschemesasprivilegedcustomschemes\"><code>protocol.registerSchemesAsPrivileged(customSchemes)</code></a></h3>\n<ul>\n<li><code>customSchemes</code> <a href=\"/docs/api/structures/custom-scheme\">CustomScheme[]</a></li>\n</ul>\n<p><strong>Примечание:</strong> Этот метод можно использовать только до отправки события <code>ready</code> модуля <code>app</code> и может быть вызван только один раз.</p>\n<p>Registers the <code>scheme</code> as standard, secure, bypasses content security policy for resources, allows registering ServiceWorker, supports fetch API, and streaming video/audio. Specify a privilege with the value of <code>true</code> to enable the capability.</p>\n<p>Пример регистрации привилегированной схемы, которая обходит Политику безопасности контента:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nprotocol.registerSchemesAsPrivileged([\n  { <span class=\"hljs-attr\">scheme</span>: <span class=\"hljs-string\">'foo'</span>, <span class=\"hljs-attr\">privileges</span>: { <span class=\"hljs-attr\">bypassCSP</span>: <span class=\"hljs-literal\">true</span> } }\n])\n</code></pre>\n<p>Стандартная схема соответствует вызовам RFC 3986 <a href=\"https://tools.ietf.org/html/rfc3986#section-3\">универсальный синтаксис URI</a>. Например, <code>http</code> и <code>https</code> являются стандартными схемами, в то время как <code>file</code> не является.</p>\n<p>Регистрация схемы в качестве стандартной позволяет правильно разрешать относительные и абсолютные ресурсы при обслуживании. В противном случае схема будет вести себя как протокол <code>file</code>, но без возможности разрешения относительных URL-адресов.</p>\n<p>Например, когда вы загружаете следующую страницу с помощью пользовательского протокола, не регистрируя его как стандартную схему, изображение не будет загружено, потому что нестандартные схемы не могут распознать относительные URL-адреса:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">img</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">'test.png'</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n</code></pre>\n<p>Registering a scheme as standard will allow access to files through the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/LocalFileSystem\">FileSystem API</a>. В противном случае программа для схемы выдаст ошибку безопасности.</p>\n<p>По умолчанию веб-хранилище Apis (localStorage, sessionStorage, webSQL, indexedDB, cookies) отключено для нестандартных схем. Поэтому в общем случае, если вы хотите зарегистрировать пользовательский протокол для замены протокола <code>http</code>, необходимо зарегистрировать его как стандартную схему.</p>\n<p>Protocols that use streams (http and stream protocols) should set <code>stream: true</code>. The <code>&#x3C;video></code> and <code>&#x3C;audio></code> HTML elements expect protocols to buffer their responses by default. The <code>stream</code> flag configures those elements to correctly expect streaming responses.</p>\n<h3 id=\"protocolregisterfileprotocolscheme-handler\"><a href=\"#protocolregisterfileprotocolscheme-handler\"><code>protocol.registerFileProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Регистрирует протокол <code>scheme</code>, который отправит файл в качестве ответа. Обработчик <code>handler</code> будет вызван с запросом <code>request</code> и обратным вызовом <code>callback</code>, где запрос <code>request</code> является входящим запросом для схемы <code>scheme</code>.</p>\n<p>To handle the <code>request</code>, the <code>callback</code> should be called with either the file's path or an object that has a <code>path</code> property, e.g. <code>callback(filePath)</code> or <code>callback({ path: filePath })</code>. <code>filePath</code> должен быть абсолютным путем.</p>\n<p>По умолчанию <code>scheme</code> обрабатывается как <code>http:</code>, который анализируется иначе, чем протоколы, которые следуют \"общему синтаксису URI\", как <code>file:</code>.</p>\n<h3 id=\"protocolregisterbufferprotocolscheme-handler\"><a href=\"#protocolregisterbufferprotocolscheme-handler\"><code>protocol.registerBufferProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (Buffer | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Регистрирует протокол <code>scheme</code>, который отправит <code>Buffer</code> в качестве ответа.</p>\n<p>Использование аналогично <code>registerFileProtocol</code>, за исключением того, что <code>callback</code> должен вызываться либо с объектом <code>Buffer</code>, либо с объектом, имеющим свойство <code>data</code>.</p>\n<p>Пример:</p>\n<pre><code class=\"hljs language-javascript\">protocol.registerBufferProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback({ <span class=\"hljs-attr\">mimeType</span>: <span class=\"hljs-string\">'text/html'</span>, <span class=\"hljs-attr\">data</span>: Buffer.from(<span class=\"hljs-string\">'&#x3C;h5>Response&#x3C;/h5>'</span>) })\n})\n</code></pre>\n<h3 id=\"protocolregisterstringprotocolscheme-handler\"><a href=\"#protocolregisterstringprotocolscheme-handler\"><code>protocol.registerStringProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Регистрирует протокол <code>scheme</code>, который отправит <code>String</code> в качестве ответа.</p>\n<p>Использование аналогично <code>registerFileProtocol</code>, за исключением того, что <code>callback</code> должен вызываться либо с <code>String</code>, либо с объектом, имеющим свойство <code>data</code>.</p>\n<h3 id=\"protocolregisterhttpprotocolscheme-handler\"><a href=\"#protocolregisterhttpprotocolscheme-handler\"><code>protocol.registerHttpProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> ProtocolResponse</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Регистрирует протокол <code>scheme</code>, который отправит HTTP-запрос в качестве ответа.</p>\n<p>Использование аналогично <code>registerFileProtocol</code>, за исключением того, что <code>callback</code> должен быть вызван с объектом, имеющим свойство <code>url</code>.</p>\n<h3 id=\"protocolregisterstreamprotocolscheme-handler\"><a href=\"#protocolregisterstreamprotocolscheme-handler\"><code>protocol.registerStreamProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (ReadableStream | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Регистрирует протокол <code>scheme</code>, который отправит поток в качестве ответа.</p>\n<p>Использование аналогично <code>registerFileProtocol</code>, за исключением того, что <code>callback</code> должен вызываться либо с объектом <a href=\"https://nodejs.org/api/stream.html#stream_class_stream_readable\"><code>ReadableStream</code></a>, либо с объектом, имеющим свойство <code>data</code>.</p>\n<p>Пример:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { PassThrough } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'stream'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createStream</span> (<span class=\"hljs-params\">text</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> rv = <span class=\"hljs-keyword\">new</span> PassThrough() <span class=\"hljs-comment\">// PassThrough is also a Readable stream</span>\n  rv.push(text)\n  rv.push(<span class=\"hljs-literal\">null</span>)\n  <span class=\"hljs-keyword\">return</span> rv\n}\n\nprotocol.registerStreamProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback({\n    <span class=\"hljs-attr\">statusCode</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">headers</span>: {\n      <span class=\"hljs-string\">'content-type'</span>: <span class=\"hljs-string\">'text/html'</span>\n    },\n    <span class=\"hljs-attr\">data</span>: createStream(<span class=\"hljs-string\">'&#x3C;h5>Response&#x3C;/h5>'</span>)\n  })\n})\n</code></pre>\n<p>Возможно передать любой объект, реализующий читаемый потоковый API (выдающий <code>data</code>/<code>end</code>/<code>error</code> события). Например, вот как может быть возвращен файл:</p>\n<pre><code class=\"hljs language-javascript\">protocol.registerStreamProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback(fs.createReadStream(<span class=\"hljs-string\">'index.html'</span>))\n})\n</code></pre>\n<h3 id=\"protocolunregisterprotocolscheme\"><a href=\"#protocolunregisterprotocolscheme\"><code>protocol.unregisterProtocol(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully unregistered</p>\n<p>Отменяет регистрацию пользовательского протокола <code>scheme</code>.</p>\n<h3 id=\"protocolisprotocolregisteredscheme\"><a href=\"#protocolisprotocolregisteredscheme\"><code>protocol.isProtocolRegistered(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Возвращает <code>Boolean</code> - является ли <code>scheme</code> уже зарегистрированной.</p>\n<h3 id=\"protocolinterceptfileprotocolscheme-handler\"><a href=\"#protocolinterceptfileprotocolscheme-handler\"><code>protocol.interceptFileProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Перехватывает протокол <code>scheme</code> и использует <code>handler</code> в качестве нового обработчика протокола, который отправляет файл в качестве ответа.</p>\n<h3 id=\"protocolinterceptstringprotocolscheme-handler\"><a href=\"#protocolinterceptstringprotocolscheme-handler\"><code>protocol.interceptStringProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Перехватывает протокол <code>scheme</code> и использует <code>handler</code> в качестве нового обработчика протокола, который отправляет <code>String</code> в качестве ответа.</p>\n<h3 id=\"protocolinterceptbufferprotocolscheme-handler\"><a href=\"#protocolinterceptbufferprotocolscheme-handler\"><code>protocol.interceptBufferProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (Buffer | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Перехватывает протокол <code>scheme</code> и использует <code>handler</code> в качестве нового обработчика протокола, который отправляет <code>Buffer</code> в качестве ответа.</p>\n<h3 id=\"protocolintercepthttpprotocolscheme-handler\"><a href=\"#protocolintercepthttpprotocolscheme-handler\"><code>protocol.interceptHttpProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Перехватывает протокол <code>scheme</code> и использует <code>handler</code> в качестве нового обработчика протокола, который отправляет новый HTTP-запрос в качестве ответа.</p>\n<h3 id=\"protocolinterceptstreamprotocolscheme-handler\"><a href=\"#protocolinterceptstreamprotocolscheme-handler\"><code>protocol.interceptStreamProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Function<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (ReadableStream | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>То же самое, что и <code>protocol.registerStreamProtocol</code>, за исключением того, что он заменяет существующий обработчик протокола.</p>\n<h3 id=\"protocoluninterceptprotocolscheme\"><a href=\"#protocoluninterceptprotocolscheme\"><code>protocol.uninterceptProtocol(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully unintercepted</p>\n<p>Remove the interceptor installed for <code>scheme</code> and restore its original handler.</p>\n<h3 id=\"protocolisprotocolinterceptedscheme\"><a href=\"#protocolisprotocolinterceptedscheme\"><code>protocol.isProtocolIntercepted(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Возвращает <code>Boolean</code> - является ли <code>scheme</code> уже перехваченной.</p>",
      "title": "protocol",
      "description": "Регистрация пользовательского протокола и перехват существующих запросов протокола."
    },
    "/docs/api/structures/protocol-request": {
      "locale": "ru-RU",
      "slug": "protocol-request",
      "href": "/docs/api/structures/protocol-request",
      "crowdinFileId": "256487",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-request.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolrequest-object\"><a href=\"#protocolrequest-object\">ProtocolRequest Object</a></h1>\n<ul>\n<li><code>url</code> String</li>\n<li><code>referrer</code> String</li>\n<li><code>method</code> String</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/upload-data\">UploadData[]</a> (optional)</li>\n<li><code>headers</code> Record&#x3C;String, String></li>\n</ul>",
      "title": "ProtocolRequest Object",
      "description": ""
    },
    "/docs/api/structures/protocol-response": {
      "locale": "ru-RU",
      "slug": "protocol-response",
      "href": "/docs/api/structures/protocol-response",
      "crowdinFileId": "256491",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-response.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolresponse-object\"><a href=\"#protocolresponse-object\">ProtocolResponse Object</a></h1>\n<ul>\n<li><code>error</code> Integer (optional) - When assigned, the <code>request</code> will fail with the <code>error</code> number . For the available error numbers you can use, please see the <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">net error list</a>.</li>\n<li><code>statusCode</code> Number (optional) - The HTTP response code, default is 200.</li>\n<li><code>charset</code> String (optional) - The charset of response body, default is <code>\"utf-8\"</code>.</li>\n<li><code>mimeType</code> String (optional) - The MIME type of response body, default is <code>\"text/html\"</code>. Setting <code>mimeType</code> would implicitly set the <code>content-type</code> header in response, but if <code>content-type</code> is already set in <code>headers</code>, the <code>mimeType</code> would be ignored.</li>\n<li><code>headers</code> Record&#x3C;string, string | string[]> (optional) - An object containing the response headers. The keys must be String, and values must be either String or Array of String.</li>\n<li><code>data</code> (Buffer | String | ReadableStream) (optional) - The response body. When returning stream as response, this is a Node.js readable stream representing the response body. When returning <code>Buffer</code> as response, this is a <code>Buffer</code>. When returning <code>String</code> as response, this is a <code>String</code>. This is ignored for other types of responses.</li>\n<li><code>path</code> String (optional) - Path to the file which would be sent as response body. This is only used for file responses.</li>\n<li><code>url</code> String (optional) - Download the <code>url</code> and pipe the result as response body. This is only used for URL responses.</li>\n<li><code>referrer</code> String (optional) - The <code>referrer</code> URL. This is only used for file and URL responses.</li>\n<li><code>method</code> String (optional) - The HTTP <code>method</code>. This is only used for file and URL responses.</li>\n<li><code>session</code> Session (optional) - The session used for requesting URL, by default the HTTP request will reuse the current session. Setting <code>session</code> to <code>null</code> would use a random independent session. This is only used for URL responses.</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/protocol-response-upload-data\">ProtocolResponseUploadData</a> (optional) - The data used as upload data. This is only used for URL responses when <code>method</code> is <code>\"POST\"</code>.</li>\n</ul>",
      "title": "ProtocolResponse Object",
      "description": ""
    },
    "/docs/api/structures/protocol-response-upload-data": {
      "locale": "ru-RU",
      "slug": "protocol-response-upload-data",
      "href": "/docs/api/structures/protocol-response-upload-data",
      "crowdinFileId": "256489",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-response-upload-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolresponseuploaddata-object\"><a href=\"#protocolresponseuploaddata-object\">ProtocolResponseUploadData Object</a></h1>\n<ul>\n<li><code>contentType</code> String - MIME type of the content.</li>\n<li><code>data</code> String | Buffer - Content to be sent.</li>\n</ul>",
      "title": "ProtocolResponseUploadData Object",
      "description": ""
    },
    "/docs/development/pull-requests": {
      "locale": "ru-RU",
      "slug": "pull-requests",
      "href": "/docs/development/pull-requests",
      "crowdinFileId": "256163",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/pull-requests.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"запросы-на-слияние\"><a href=\"#запросы-на-слияние\">Запросы на слияние</a></h1>\n<ul>\n<li><a href=\"#setting-up-your-local-environment\">Setting up your local environment</a><ul>\n<li><a href=\"#step-1-fork\">Step 1: Fork</a></li>\n<li><a href=\"#step-2-build\">Step 2: Build</a></li>\n<li><a href=\"#step-3-branch\">Step 3: Branch</a></li>\n</ul></li>\n<li><a href=\"#making-changes\">Making Changes</a><ul>\n<li><a href=\"#step-4-code\">Step 4: Code</a></li>\n<li><a href=\"#step-5-commit\">Step 5: Commit</a><ul>\n<li><a href=\"#commit-message-guidelines\">Commit message guidelines</a></li>\n</ul></li>\n<li><a href=\"#step-6-rebase\">Step 6: Rebase</a></li>\n<li><a href=\"#step-7-test\">Step 7: Test</a></li>\n<li><a href=\"#step-8-push\">Step 8: Push</a></li>\n<li><a href=\"#step-9-opening-the-pull-request\">Step 9: Opening the Pull Request</a></li>\n<li><a href=\"#step-10-discuss-and-update\">Step 10: Discuss and Update</a><ul>\n<li><a href=\"#approval-and-request-changes-workflow\">Approval and Request Changes Workflow</a></li>\n</ul></li>\n<li><a href=\"#step-11-landing\">Step 11: Landing</a></li>\n<li><a href=\"#continuous-integration-testing\">Continuous Integration Testing</a></li>\n</ul></li>\n</ul>\n<h2 id=\"setting-up-your-local-environment\"><a href=\"#setting-up-your-local-environment\">Setting up your local environment</a></h2>\n<h3 id=\"step-1-fork\"><a href=\"#step-1-fork\">Step 1: Fork</a></h3>\n<p>Fork the project <a href=\"https://github.com/electron/electron\">on GitHub</a> and clone your fork locally.</p>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:username/electron.git\n$ <span class=\"hljs-built_in\">cd</span> electron\n$ git remote add upstream https://github.com/electron/electron.git\n$ git fetch upstream\n</code></pre>\n<h3 id=\"step-2-build\"><a href=\"#step-2-build\">Step 2: Build</a></h3>\n<p>Build steps and dependencies differ slightly depending on your operating system. See these detailed guides on building Electron locally:</p>\n<ul>\n<li><a href=\"/docs/development/build-instructions-macos\">Building on macOS</a></li>\n<li><a href=\"/docs/development/build-instructions-linux\">Building on Linux</a></li>\n<li><a href=\"/docs/development/build-instructions-windows\">Building on Windows</a></li>\n</ul>\n<p>Once you've built the project locally, you're ready to start making changes!</p>\n<h3 id=\"step-3-branch\"><a href=\"#step-3-branch\">Step 3: Branch</a></h3>\n<p>To keep your development environment organized, create local branches to hold your work. Они должны быть вынесены непосредственно от ветки <code>main</code>.</p>\n<pre><code class=\"hljs language-sh\">$ git checkout -b my-branch -t upstream/main\n</code></pre>\n<h2 id=\"making-changes\"><a href=\"#making-changes\">Making Changes</a></h2>\n<h3 id=\"step-4-code\"><a href=\"#step-4-code\">Step 4: Code</a></h3>\n<p>Most pull requests opened against the <code>electron/electron</code> repository include changes to either the C/C++ code in the <code>shell/</code> folder, the JavaScript code in the <code>lib/</code> folder, the documentation in <code>docs/api/</code> or tests in the <code>spec/</code> folder.</p>\n<p>Please be sure to run <code>npm run lint</code> from time to time on any code changes to ensure that they follow the project's code style.</p>\n<p>See <a href=\"/docs/development/coding-style\">coding style</a> for more information about best practice when modifying code in different parts of the project.</p>\n<h3 id=\"step-5-commit\"><a href=\"#step-5-commit\">Step 5: Commit</a></h3>\n<p>It is recommended to keep your changes grouped logically within individual commits. Many contributors find it easier to review changes that are split across multiple commits. There is no limit to the number of commits in a pull request.</p>\n<pre><code class=\"hljs language-sh\">$ git add my/changed/files\n$ git commit\n</code></pre>\n<p>Note that multiple commits often get squashed when they are landed.</p>\n<h4 id=\"commit-message-guidelines\"><a href=\"#commit-message-guidelines\">Commit message guidelines</a></h4>\n<p>A good commit message should describe what changed and why. The Electron project uses <a href=\"https://conventionalcommits.org/\">semantic commit messages</a> to streamline the release process.</p>\n<p>Before a pull request can be merged, it <strong>must</strong> have a pull request title with a semantic prefix.</p>\n<p>Examples of commit messages with semantic prefixes:</p>\n<ul>\n<li><code>fix: don't overwrite prevent_default if default wasn't prevented</code></li>\n<li><code>feat: add app.isPackaged() method</code></li>\n<li><code>docs: app.isDefaultProtocolClient is now available on Linux</code></li>\n</ul>\n<p>Common prefixes:</p>\n<ul>\n<li>fix: A bug fix</li>\n<li>feat: A new feature</li>\n<li>docs: Documentation changes</li>\n<li>test: Adding missing tests or correcting existing tests</li>\n<li>build: Changes that affect the build system</li>\n<li>ci: Changes to our CI configuration files and scripts</li>\n<li>perf: A code change that improves performance</li>\n<li>refactor: A code change that neither fixes a bug nor adds a feature</li>\n<li>style: Changes that do not affect the meaning of the code (linting)</li>\n</ul>\n<p>Other things to keep in mind when writing a commit message:</p>\n<ol>\n<li>The first line should:<ul>\n<li>contain a short description of the change (preferably 50 characters or less, and no more than 72 characters)</li>\n<li>be entirely in lowercase with the exception of proper nouns, acronyms, and the words that refer to code, like function/variable names</li>\n</ul></li>\n<li>Keep the second line blank.</li>\n<li>Wrap all other lines at 72 columns.</li>\n</ol>\n<h4 id=\"критические-изменения\"><a href=\"#критические-изменения\">Критические изменения</a></h4>\n<p>A commit that has the text <code>BREAKING CHANGE:</code> at the beginning of its optional body or footer section introduces a breaking API change (correlating with Major in semantic versioning). A breaking change can be part of commits of any type. e.g., a <code>fix:</code>, <code>feat:</code> &#x26; <code>chore:</code> types would all be valid, in addition to any other type.</p>\n<p>See <a href=\"https://conventionalcommits.org\">conventionalcommits.org</a> for more details.</p>\n<h3 id=\"step-6-rebase\"><a href=\"#step-6-rebase\">Step 6: Rebase</a></h3>\n<p>Once you have committed your changes, it is a good idea to use <code>git rebase</code> (not <code>git merge</code>) to synchronize your work with the main repository.</p>\n<pre><code class=\"hljs language-sh\">$ git fetch upstream\n$ git rebase upstream/main\n</code></pre>\n<p>This ensures that your working branch has the latest changes from <code>electron/electron</code> main.</p>\n<h3 id=\"step-7-test\"><a href=\"#step-7-test\">Step 7: Test</a></h3>\n<p>Bug fixes and features should always come with tests. A <a href=\"/docs/development/testing\">testing guide</a> has been provided to make the process easier. Looking at other tests to see how they should be structured can also help.</p>\n<p>Before submitting your changes in a pull request, always run the full test suite. To run the tests:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>Make sure the linter does not report any issues and that all tests pass. Please do not submit patches that fail either check.</p>\n<p>If you are updating tests and want to run a single spec to check it:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span> -match=menu\n</code></pre>\n<p>The above would only run spec modules matching <code>menu</code>, which is useful for anyone who's working on tests that would otherwise be at the very end of the testing cycle.</p>\n<h3 id=\"step-8-push\"><a href=\"#step-8-push\">Step 8: Push</a></h3>\n<p>Once your commits are ready to go -- with passing tests and linting -- begin the process of opening a pull request by pushing your working branch to your fork on GitHub.</p>\n<pre><code class=\"hljs language-sh\">$ git push origin my-branch\n</code></pre>\n<h3 id=\"step-9-opening-the-pull-request\"><a href=\"#step-9-opening-the-pull-request\">Step 9: Opening the Pull Request</a></h3>\n<p>From within GitHub, opening a new pull request will present you with a template that should be filled out:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"xml\"><span class=\"hljs-comment\">&#x3C;!--\nThank you for your pull request. Please provide a description above and review\nthe requirements below.\n\nBug fixes and new features should include tests and possibly benchmarks.\n\nРуководство для разработчиков: https://github.com/electron/electron/blob/main/CONTRIBUTING.md\n--></span></span>\n</code></pre>\n<h3 id=\"step-10-discuss-and-update\"><a href=\"#step-10-discuss-and-update\">Step 10: Discuss and update</a></h3>\n<p>You will probably get feedback or requests for changes to your pull request. This is a big part of the submission process so don't be discouraged! Some contributors may sign off on the pull request right away. Others may have detailed comments or feedback. This is a necessary part of the process in order to evaluate whether the changes are correct and necessary.</p>\n<p>To make changes to an existing pull request, make the changes to your local branch, add a new commit with those changes, and push those to your fork. GitHub will automatically update the pull request.</p>\n<pre><code class=\"hljs language-sh\">$ git add my/changed/files\n$ git commit\n$ git push origin my-branch\n</code></pre>\n<p>There are a number of more advanced mechanisms for managing commits using <code>git rebase</code> that can be used, but are beyond the scope of this guide.</p>\n<p>Feel free to post a comment in the pull request to ping reviewers if you are awaiting an answer on something. If you encounter words or acronyms that seem unfamiliar, refer to this <a href=\"https://sites.google.com/a/chromium.org/dev/glossary\">glossary</a>.</p>\n<h4 id=\"approval-and-request-changes-workflow\"><a href=\"#approval-and-request-changes-workflow\">Approval and Request Changes Workflow</a></h4>\n<p>Все Pull Request'ы требуют одобрения от <a href=\"https://github.com/electron/electron/blob/main/.github/CODEOWNERS\">владельца кода</a> той области, которую вы изменили, для завершения. Whenever a maintainer reviews a pull request they may request changes. These may be small, such as fixing a typo, or may involve substantive changes. Such requests are intended to be helpful, but at times may come across as abrupt or unhelpful, especially if they do not include concrete suggestions on <em>how</em> to change them.</p>\n<p>Try not to be discouraged. If you feel that a review is unfair, say so or seek the input of another project contributor. Often such comments are the result of a reviewer having taken insufficient time to review and are not ill-intended. Such difficulties can often be resolved with a bit of patience. That said, reviewers should be expected to provide helpful feedback.</p>\n<h3 id=\"step-11-landing\"><a href=\"#step-11-landing\">Step 11: Landing</a></h3>\n<p>In order to land, a pull request needs to be reviewed and approved by at least one Electron Code Owner and pass CI. After that, if there are no objections from other contributors, the pull request can be merged.</p>\n<p>Congratulations and thanks for your contribution!</p>\n<h3 id=\"continuous-integration-testing\"><a href=\"#continuous-integration-testing\">Continuous Integration Testing</a></h3>\n<p>Every pull request is tested on the Continuous Integration (CI) system to confirm that it works on Electron's supported platforms.</p>\n<p>Ideally, the pull request will pass (\"be green\") on all of CI's platforms. This means that all tests pass and there are no linting errors. However, it is not uncommon for the CI infrastructure itself to fail on specific platforms or for so-called \"flaky\" tests to fail (\"be red\"). Each CI failure must be manually inspected to determine the cause.</p>\n<p>CI starts automatically when you open a pull request, but only core maintainers can restart a CI run. If you believe CI is giving a false negative, ask a maintainer to restart the tests.</p>",
      "title": "Запросы на слияние",
      "description": ""
    },
    "/docs/tutorial/quick-start": {
      "locale": "ru-RU",
      "slug": "quick-start",
      "href": "/docs/tutorial/quick-start",
      "crowdinFileId": "256237",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/quick-start.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"руководство-для-начинающих\"><a href=\"#руководство-для-начинающих\">Руководство для начинающих</a></h1>\n<p>Это руководство проведёт вас через процесс создания простого Hello World приложения в Electron, похожий на <a href=\"https://github.com/electron/electron-quick-start\"><code>electron/electron-quick-start</code></a>.</p>\n<p>К концу этого урока ваше приложение откроет окно браузера, отображая веб-страницу с информацией о том, какие версии Chromium.js Node и Electron работают.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<p>Чтобы использовать Electron вы должны установить <a href=\"https://nodejs.org/en/download/\">Node.js</a>. Мы рекомендуем Вам использовать последнюю доступную <code>LTS</code> версию.</p>\n<blockquote>\n<p>Пожалуйста, установите Node.js с помощью предварительно собранных установщиков для вашей платформы. You may encounter incompatibility issues with different development tools otherwise.</p>\n</blockquote>\n<p>Чтобы убедится что Node.js был установлен правильно, напишите следующие команды в терминале:</p>\n<pre><code class=\"hljs language-sh\">node -v\nnpm -v\n</code></pre>\n<p>Команды должны вывести версии Node.js и npm соответственно.</p>\n<p><strong>Note:</strong>Так как Electron встраивает Node.js в двоичный код, выполняемая версия Node.js может отличатся.</p>\n<h2 id=\"создание-приложения\"><a href=\"#создание-приложения\">Создание приложения</a></h2>\n<h3 id=\"сборка-приложения\"><a href=\"#сборка-приложения\">Сборка приложения</a></h3>\n<p>Приложения Electron имеют ту же общую структуру, что и другие проекты Node.js. Начните с создания папки и инициализации пакета npm.</p>\n<pre><code class=\"hljs language-sh\">mkdir my-electron-app &#x26;&#x26; <span class=\"hljs-built_in\">cd</span> my-electron-app\nnpm init\n</code></pre>\n<p>The interactive <code>init</code> command will prompt you to set some fields in your config. There are a few rules to follow for the purposes of this tutorial:</p>\n<ul>\n<li><code>entry point</code> should be <code>main.js</code>.</li>\n<li><code>author</code> and <code>description</code> can be any value, but are necessary for <a href=\"#package-and-distribute-your-application\">app packaging</a>.</li>\n</ul>\n<p>Ваш <code>package.json</code> файл должен выглядеть примерно так:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"my-electron-app\"</span>,\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"1.0.0\"</span>,\n  <span class=\"hljs-attr\">\"description\"</span>: <span class=\"hljs-string\">\"Hello World!\"</span>,\n  <span class=\"hljs-attr\">\"main\"</span>: <span class=\"hljs-string\">\"main.js\"</span>,\n  <span class=\"hljs-attr\">\"author\"</span>: <span class=\"hljs-string\">\"Jane Doe\"</span>,\n  <span class=\"hljs-attr\">\"license\"</span>: <span class=\"hljs-string\">\"MIT\"</span>\n}\n</code></pre>\n<p>Then, install the <code>electron</code> package into your app's <code>devDependencies</code>.</p>\n<pre><code class=\"hljs language-sh\">$ npm install --save-dev electron\n</code></pre>\n<blockquote>\n<p>Note: If you're encountering any issues with installing Electron, please refer to the <a href=\"/docs/tutorial/installation\">Advanced Installation</a> guide.</p>\n</blockquote>\n<p>Finally, you want to be able to execute Electron. In the <a href=\"https://docs.npmjs.com/cli/v7/using-npm/scripts\"><code>scripts</code></a> field of your <code>package.json</code> config, add a <code>start</code> command like so:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"scripts\"</span>: {\n    <span class=\"hljs-attr\">\"start\"</span>: <span class=\"hljs-string\">\"electron .\"</span>\n  }\n}\n</code></pre>\n<p>Эта <code>start</code> команда откроет ваше приложение в режиме разработчика.</p>\n<pre><code class=\"hljs language-sh\">npm start\n</code></pre>\n<blockquote>\n<p>Примечание: Эта команда запускает приложение из корневой папки. На этом шаге возможна ошибка, которая заключается в том, что не найдено приложение для запуска.</p>\n</blockquote>\n<h3 id=\"запуск-main-process\"><a href=\"#запуск-main-process\">Запуск main process</a></h3>\n<p>Входной точкой для любого приложения на Electron является скрипт <code>main</code>. Этот скрипт управляет <strong>основным процессом</strong>, который запускается в полной среде Node.js и отвечает за управление рабочего цикла вашего приложения, отображение основного интерфейса, выполнение привилегированных операций и управление процессом визуализации (подробнее об этом позже).</p>\n<p>В процессе выполнения, Electron будет искать этот скрипт в <a href=\"https://docs.npmjs.com/cli/v7/configuring-npm/package-json#main\"><code>основном</code></a> поле вашего <code>package.json</code> конфига, который вы сконфигурировали в процессе <a href=\"#scaffold-the-project\">формирования кода приложения</a>.</p>\n<p>Чтобы инициализировать <code>основной</code> скрипт, создайте пустой файл с именем <code>main.js</code> в корневой папке вашего проекта.</p>\n<blockquote>\n<p>Примечание: Если вы снова запустите скрипт <code>запуска</code> на этот момент, ваше приложение больше не будет выявлять никаких ошибок! Тем не менее, он не будет делать ничего, потому что мы не добавили код в <code>main.js</code>.</p>\n</blockquote>\n<h3 id=\"создание-веб-страницы\"><a href=\"#создание-веб-страницы\">Создание веб-страницы</a></h3>\n<p>Прежде чем мы сможем создать окно для нашего приложения, нам нужно создать контент, который будет загружен в него. В Electron каждое окно отображает веб-содержимое, которое может быть загружено из локального HTML файла или удаленного URL.</p>\n<p>В этом туториале вы будете создавать первое. Создайте <code>index.html</code> файл в корневой папке проекта:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-comment\">&#x3C;!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"X-Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    We are using Node.js <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"node-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    Chromium <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"chrome-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    and Electron <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"electron-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>.\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<blockquote>\n<p>Замечание: Посмотрев на этот HTML-документ, можно заметить, что версии не указаны в блоке body. Мы вручную вставим их позже с помощью JavaScript.</p>\n</blockquote>\n<h3 id=\"opening-your-web-page-in-a-browser-window\"><a href=\"#opening-your-web-page-in-a-browser-window\">Opening your web page in a browser window</a></h3>\n<p>Now that you have a web page, load it into an application window. To do so, you'll need two Electron modules:</p>\n<ul>\n<li>The <a href=\"/docs/api/app\"><code>app</code></a> module, which controls your application's event lifecycle.</li>\n<li>The <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> module, which creates and manages application windows.</li>\n</ul>\n<p>Because the main process runs Node.js, you can import these as <a href=\"https://nodejs.org/docs/latest/api/modules.html#modules_modules_commonjs_modules\">CommonJS</a> modules at the top of your file:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>Then, add a <code>createWindow()</code> function that loads <code>index.html</code> into a new <code>BrowserWindow</code> instance.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n</code></pre>\n<p>Next, call this <code>createWindow()</code> function to open your window.</p>\n<p>In Electron, browser windows can only be created after the <code>app</code> module's <a href=\"/docs/api/app#event-ready\"><code>ready</code></a> event is fired. You can wait for this event by using the <a href=\"/docs/api/app#appwhenready\"><code>app.whenReady()</code></a> API. Call <code>createWindow()</code> after <code>whenReady()</code> resolves its Promise.</p>\n<pre><code class=\"hljs language-js\">app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n})\n</code></pre>\n<blockquote>\n<p>Note: At this point, your Electron application should successfully open a window that displays your web page!</p>\n</blockquote>\n<h3 id=\"manage-your-windows-lifecycle\"><a href=\"#manage-your-windows-lifecycle\">Manage your window's lifecycle</a></h3>\n<p>Although you can now open a browser window, you'll need some additional boilerplate code to make it feel more native to each platform. Application windows behave differently on each OS, and Electron puts the responsibility on developers to implement these conventions in their app.</p>\n<p>In general, you can use the <code>process</code> global's <a href=\"https://nodejs.org/api/process.html#process_process_platform\"><code>platform</code></a> attribute to run code specifically for certain operating systems.</p>\n<h4 id=\"quit-the-app-when-all-windows-are-closed-windows--linux\"><a href=\"#quit-the-app-when-all-windows-are-closed-windows--linux\">Quit the app when all windows are closed (Windows &#x26; Linux)</a></h4>\n<p>On Windows and Linux, exiting all windows generally quits an application entirely.</p>\n<p>To implement this, listen for the <code>app</code> module's <a href=\"/docs/api/app#event-window-all-closed\"><code>'window-all-closed'</code></a> event, and call <a href=\"/docs/api/app#appquit\"><code>app.quit()</code></a> if the user is not on macOS (<code>darwin</code>).</p>\n<pre><code class=\"hljs language-js\">app.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h4 id=\"open-a-window-if-none-are-open-macos\"><a href=\"#open-a-window-if-none-are-open-macos\">Open a window if none are open (macOS)</a></h4>\n<p>Whereas Linux and Windows apps quit when they have no windows open, macOS apps generally continue running even without any windows open, and activating the app when no windows are available should open a new one.</p>\n<p>To implement this feature, listen for the <code>app</code> module's <a href=\"/docs/api/app#event-activate-macos\"><code>activate</code></a> event, and call your existing <code>createWindow()</code> method if no browser windows are open.</p>\n<p>Because windows cannot be created before the <code>ready</code> event, you should only listen for <code>activate</code> events after your app is initialized. Do this by attaching your event listener from within your existing <code>whenReady()</code> callback.</p>\n<pre><code class=\"hljs language-js\">app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) createWindow()\n  })\n})\n</code></pre>\n<blockquote>\n<p>Note: At this point, your window controls should be fully functional!</p>\n</blockquote>\n<h3 id=\"access-nodejs-from-the-renderer-with-a-preload-script\"><a href=\"#access-nodejs-from-the-renderer-with-a-preload-script\">Access Node.js from the renderer with a preload script</a></h3>\n<p>Now, the last thing to do is print out the version numbers for Electron and its dependencies onto your web page.</p>\n<p>Accessing this information is trivial to do in the main process through Node's global <code>process</code> object. However, you can't just edit the DOM from the main process because it has no access to the renderer's <code>document</code> context. They're in entirely different processes!</p>\n<blockquote>\n<p>Note: If you need a more in-depth look at Electron processes, see the <a href=\"/docs/tutorial/process-model\">Process Model</a> document.</p>\n</blockquote>\n<p>This is where attaching a <strong>preload</strong> script to your renderer comes in handy. A preload script runs before the renderer process is loaded, and has access to both renderer globals (e.g. <code>window</code> and <code>document</code>) and a Node.js environment.</p>\n<p>Create a new script named <code>preload.js</code> as such:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'DOMContentLoaded'</span>, () => {\n  <span class=\"hljs-keyword\">const</span> replaceText = <span class=\"hljs-function\">(<span class=\"hljs-params\">selector, text</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> element = <span class=\"hljs-built_in\">document</span>.getElementById(selector)\n    <span class=\"hljs-keyword\">if</span> (element) element.innerText = text\n  }\n\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> dependency <span class=\"hljs-keyword\">of</span> [<span class=\"hljs-string\">'chrome'</span>, <span class=\"hljs-string\">'node'</span>, <span class=\"hljs-string\">'electron'</span>]) {\n    replaceText(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${dependency}</span>-version`</span>, process.versions[dependency])\n  }\n})\n</code></pre>\n<p>The above code accesses the Node.js <code>process.versions</code> object and runs a basic <code>replaceText</code> helper function to insert the version numbers into the HTML document.</p>\n<p>To attach this script to your renderer process, pass in the path to your preload script to the <code>webPreferences.preload</code> option in your existing <code>BrowserWindow</code> constructor.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// include the Node.js 'path' module at the top of your file</span>\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-comment\">// modify your existing createWindow() function</span>\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n<span class=\"hljs-comment\">// ...</span>\n</code></pre>\n<p>There are two Node.js concepts that are used here:</p>\n<ul>\n<li>The <a href=\"https://nodejs.org/api/modules.html#modules_dirname\"><code>__dirname</code></a> string points to the path of the currently executing script (in this case, your project's root folder).</li>\n<li>The <a href=\"https://nodejs.org/api/path.html#path_path_join_paths\"><code>path.join</code></a> API joins multiple path segments together, creating a combined path string that works across all platforms.</li>\n</ul>\n<p>We use a path relative to the currently executing JavaScript file so that your relative path will work in both development and packaged mode.</p>\n<h3 id=\"bonus-add-functionality-to-your-web-contents\"><a href=\"#bonus-add-functionality-to-your-web-contents\">Bonus: Add functionality to your web contents</a></h3>\n<p>At this point, you might be wondering how to add more functionality to your application.</p>\n<p>For any interactions with your web contents, you want to add scripts to your renderer process. Because the renderer runs in a normal web environment, you can add a <code>&#x3C;script></code> tag right before your <code>index.html</code> file's closing <code>&#x3C;/body></code> tag to include any arbitrary scripts you want:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"./renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<p>The code contained in <code>renderer.js</code> can then use the same JavaScript APIs and tooling you use for typical front-end development, such as using <a href=\"https://webpack.js.org\"><code>webpack</code></a> to bundle and minify your code or <a href=\"https://reactjs.org\">React</a> to manage your user interfaces.</p>\n<h3 id=\"recap\"><a href=\"#recap\">Recap</a></h3>\n<p>After following the above steps, you should have a fully functional Electron application that looks like this:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/simplest-electron-app.png\" alt=\"Simplest Electron app\"></p>\n<!--TODO(erickzhao): Remove the individual code blocks for static website -->\n<p>The full code is available below:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\n\n<span class=\"hljs-comment\">// Modules to control application life and create native browser window</span>\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-comment\">// Create the browser window.</span>\n  <span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  <span class=\"hljs-comment\">// and load the index.html of the app.</span>\n  mainWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-comment\">// Open the DevTools.</span>\n  <span class=\"hljs-comment\">// mainWindow.webContents.openDevTools()</span>\n}\n\n<span class=\"hljs-comment\">// This method will be called when Electron has finished</span>\n<span class=\"hljs-comment\">// initialization and is ready to create browser windows.</span>\n<span class=\"hljs-comment\">// Некоторые интерфейсы API могут использоваться только после возникновения этого события.</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n    <span class=\"hljs-comment\">// On macOS it's common to re-create a window in the app when the</span>\n    <span class=\"hljs-comment\">// dock icon is clicked and there are no other windows open.</span>\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) createWindow()\n  })\n})\n\n<span class=\"hljs-comment\">// Quit when all windows are closed, except on macOS. There, it's common</span>\n<span class=\"hljs-comment\">// for applications and their menu bar to stay active until the user quits</span>\n<span class=\"hljs-comment\">// explicitly with Cmd + Q.</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n\n<span class=\"hljs-comment\">// In this file you can include the rest of your app's specific main process</span>\n<span class=\"hljs-comment\">// code. Можно также поместить их в отдельные файлы и применить к ним require.</span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// preload.js</span>\n\n<span class=\"hljs-comment\">// All of the Node.js APIs are available in the preload process.</span>\n<span class=\"hljs-comment\">// It has the same sandbox as a Chrome extension.</span>\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'DOMContentLoaded'</span>, () => {\n  <span class=\"hljs-keyword\">const</span> replaceText = <span class=\"hljs-function\">(<span class=\"hljs-params\">selector, text</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> element = <span class=\"hljs-built_in\">document</span>.getElementById(selector)\n    <span class=\"hljs-keyword\">if</span> (element) element.innerText = text\n  }\n\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> dependency <span class=\"hljs-keyword\">of</span> [<span class=\"hljs-string\">'chrome'</span>, <span class=\"hljs-string\">'node'</span>, <span class=\"hljs-string\">'electron'</span>]) {\n    replaceText(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${dependency}</span>-version`</span>, process.versions[dependency])\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!--index.html--></span>\n\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-comment\">&#x3C;!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"X-Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    We are using Node.js <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"node-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    Chromium <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"chrome-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    and Electron <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"electron-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>.\n\n    <span class=\"hljs-comment\">&#x3C;!-- You can also require other files to run in this process --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"./renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>To summarize all the steps we've done:</p>\n<ul>\n<li>\n<p>We bootstrapped a Node.js application and added Electron as a dependency.</p>\n</li>\n<li>\n<p>We created a <code>main.js</code> script that runs our main process, which controls our app\nand runs in a Node.js environment. In this script, we used Electron's <code>app</code> and\n<code>BrowserWindow</code> modules to create a browser window that displays web content\nin a separate process (the renderer).</p>\n</li>\n<li>\n<p>In order to access certain Node.js functionality in the renderer, we attached\na preload script to our <code>BrowserWindow</code> constructor.</p>\n</li>\n</ul>\n<h2 id=\"package-and-distribute-your-application\"><a href=\"#package-and-distribute-your-application\">Package and distribute your application</a></h2>\n<p>The fastest way to distribute your newly created app is using\n<a href=\"https://www.electronforge.io\">Electron Forge</a>.</p>\n<ol>\n<li>\n<p>Add Electron Forge as a development dependency of your app, and use its <code>import</code> command to set up\nForge's scaffolding:</p>\n<pre><code class=\"hljs language-routeros\">```sh npm2yarn\nnpm install --save-dev @electron-forge/cli\nnpx electron-forge import\n\n✔ Checking your<span class=\"hljs-built_in\"> system\n</span>✔ Initializing Git Repository\n✔ Writing modified package.json file\n✔ Installing dependencies\n✔ Writing modified package.json file\n✔ Fixing .gitignore\n\nWe have ATTEMPTED <span class=\"hljs-keyword\">to</span> convert your app <span class=\"hljs-keyword\">to</span> be <span class=\"hljs-keyword\">in</span> a format that electron-forge understands.\n\nСпасибо за использование <span class=\"hljs-string\">\"electron-forge\"</span>!!!\n```\n</code></pre>\n</li>\n<li>\n<p>Create a distributable using Forge's <code>make</code> command:</p>\n<pre><code class=\"hljs language-sh\">npm run make\n\n> my-electron-app@1.0.0 make /my-electron-app\n> electron-forge make\n\n✔ Checking your system\n✔ Resolving Forge Config\nWe need to package your application before we can make it\n✔ Preparing to Package Application <span class=\"hljs-keyword\">for</span> arch: x64\n✔ Preparing native dependencies\n✔ Packaging Application\nMaking <span class=\"hljs-keyword\">for</span> the following targets: zip\n✔ Making <span class=\"hljs-keyword\">for</span> target: zip - On platform: darwin - For arch: x64\n</code></pre>\n<p>Electron Forge creates the <code>out</code> folder where your package will be located:</p>\n<pre><code class=\"hljs language-plain\">// Example for macOS\nout/\n├── out/make/zip/darwin/x64/my-electron-app-darwin-x64-1.0.0.zip\n├── ...\n└── out/my-electron-app-darwin-x64/my-electron-app.app/Contents/MacOS/my-electron-app\n</code></pre>\n</li>\n</ol>",
      "title": "Руководство для начинающих",
      "description": "Пожалуйста, установите Node.js с помощью предварительно собранных установщиков для вашей платформы. You may encounter incompatibility issues with different development tools otherwise."
    },
    "/docs/README": {
      "locale": "ru-RU",
      "slug": "README",
      "href": "/docs/README",
      "crowdinFileId": "256115",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/README.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"официальное-руководство\"><a href=\"#официальное-руководство\">Официальное руководство</a></h1>\n<p>Убедитесь, что Вы используете документацию, соответствующую вашей версии Electron. Версия должна быть частью URL-адреса страницы. If it's not, you are probably using the documentation of a development branch which may contain API changes that are not compatible with your Electron version. Чтобы просмотреть более старые версии документации, Вы можете использовать <a href=\"https://github.com/electron/electron/tree/v1.4.0\">browse by tag</a> на GitHub, открыв список «Switch branches/tags» и выбрав тег, соответствующий вашей версии.</p>\n<h2 id=\"faq\"><a href=\"#faq\">FAQ</a></h2>\n<p>Есть вопросы, которые довольно часто задаваются. Проверьте это перед созданием проблемы:</p>\n<ul>\n<li><a href=\"/docs/faq\">FAQ по Electron</a></li>\n</ul>\n<h2 id=\"руководство\"><a href=\"#руководство\">Руководство</a></h2>\n<h3 id=\"начало-работы\"><a href=\"#начало-работы\">Начало работы</a></h3>\n<ul>\n<li><a href=\"/docs/tutorial/introduction\">Введение</a></li>\n<li><a href=\"/docs/tutorial/quick-start\">Руководство для начинающих</a></li>\n<li><a href=\"/docs/tutorial/process-model\">Моделирование процесса</a></li>\n</ul>\n<h3 id=\"изучите-основы\"><a href=\"#изучите-основы\">Изучите основы</a></h3>\n<ul>\n<li>Добавление функционала в Ваше приложение<ul>\n<li><a href=\"/docs/tutorial/notifications\">Notification (Оповещения)</a></li>\n<li><a href=\"/docs/tutorial/recent-documents\">Недавние документы</a></li>\n<li><a href=\"/docs/tutorial/progress-bar\">Прогресс приложения</a></li>\n<li><a href=\"/docs/tutorial/macos-dock\">Пользовательское меню macOS</a></li>\n<li><a href=\"/docs/tutorial/windows-taskbar\">Пользовательские задачи Windows</a></li>\n<li><a href=\"/docs/tutorial/linux-desktop-actions\">Пользовательские действия на Linux</a></li>\n<li><a href=\"/docs/tutorial/keyboard-shortcuts\">Горячие клавиши</a></li>\n<li><a href=\"/docs/tutorial/online-offline-events\">Оффлайн/Онлайн обнаружение</a></li>\n<li><a href=\"/docs/tutorial/represented-file\">Представленный файл для macOS BrowserWindows</a></li>\n<li><a href=\"/docs/tutorial/native-file-drag-drop\">Нативное перемещение файла</a></li>\n<li><a href=\"/docs/tutorial/offscreen-rendering\">Закадровый рендеринг</a></li>\n<li><a href=\"/docs/tutorial/dark-mode\">Темный режим</a></li>\n<li><a href=\"/docs/tutorial/web-embeds\">Встраивание веб в Electron</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis\">Макеты и CLI</a><ul>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#boilerplate-vs-cli\">Макеты против CLI</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-forge\">electron-forge</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-builder\">electron-builder</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-react-boilerplate\">electron-react-boilerplate</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#other-tools-and-boilerplates\">Другие инструменты и макеты</a></li>\n</ul></li>\n</ul>\n<h3 id=\"advanced-topics\"><a href=\"#advanced-topics\">Advanced topics</a></h3>\n<ul>\n<li>Архитектура приложения<ul>\n<li><a href=\"/docs/tutorial/using-native-node-modules\">Использование нативных модулей Node.js</a></li>\n<li><a href=\"/docs/tutorial/performance\">Performance Strategies</a></li>\n<li><a href=\"/docs/tutorial/security\">Стратегии безопасности</a></li>\n<li><a href=\"/docs/tutorial/sandbox\">Dima@mail.ru </a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/accessibility\">Доступность</a><ul>\n<li><a href=\"/docs/tutorial/accessibility#manually-enabling-accessibility-features\">Включение функций специальных возможностей вручную</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/application-debugging\">Тестирование и отладка</a><ul>\n<li><a href=\"/docs/tutorial/debugging-main-process\">Отладка главного процесса</a></li>\n<li><a href=\"/docs/tutorial/debugging-vscode\">Отладка с кодом Visual Studio</a></li>\n<li><a href=\"/docs/tutorial/using-selenium-and-webdriver\">Использование Selenium и WebDriver</a></li>\n<li><a href=\"/docs/tutorial/testing-on-headless-ci\">Тестирование с помощью систем непрерывной интеграции (Travis, Jenkins)</a></li>\n<li><a href=\"/docs/tutorial/devtools-extension\">Расширение DevTools</a></li>\n<li><a href=\"/docs/tutorial/automated-testing-with-a-custom-driver\">Автоматическое тестирование с помощью специального драйвера</a></li>\n<li><a href=\"/docs/tutorial/repl\">REPL</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/application-distribution\">Распространение</a><ul>\n<li><a href=\"/docs/tutorial/support#supported-platforms\">Поддерживаемые платформы</a></li>\n<li><a href=\"/docs/tutorial/code-signing\">Подписывание кода</a></li>\n<li><a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store</a></li>\n<li><a href=\"/docs/tutorial/windows-store-guide\">Windows Store</a></li>\n<li><a href=\"/docs/tutorial/snapcraft\">Snapcraft</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/updates\">Обновления</a><ul>\n<li><a href=\"/docs/tutorial/updates#deploying-an-update-server\">Развертывание сервера обновлений</a></li>\n<li><a href=\"/docs/tutorial/updates#implementing-updates-in-your-app\">Внедрение обновлений в Ваше приложение</a></li>\n<li><a href=\"/docs/tutorial/updates#applying-updates\">Применение обновлений</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/support\">Получение поддержки</a></li>\n</ul>\n<h2 id=\"подробное-руководство\"><a href=\"#подробное-руководство\">Подробное руководство</a></h2>\n<p>Эти индивидуальные руководства расширят темы, обсуждаемые выше.</p>\n<ul>\n<li><a href=\"/docs/tutorial/installation\">Установка Electron</a><ul>\n<li><a href=\"/docs/tutorial/installation#proxies\">Прокси</a></li>\n<li><a href=\"/docs/tutorial/installation#custom-mirrors-and-caches\">Пользовательские зеркала и кеши</a></li>\n<li><a href=\"/docs/tutorial/installation#troubleshooting\">Устранение проблем</a></li>\n</ul></li>\n<li>Отзыв разработчика Electron Releases &#x26;<ul>\n<li><a href=\"/docs/tutorial/electron-versioning\">Политика контроля версиями</a></li>\n<li><a href=\"/docs/tutorial/electron-timelines\">Графики выпуска</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/testing-widevine-cdm\">Testing Widevine CDM</a></li>\n</ul>\n<hr>\n<ul>\n<li><a href=\"/docs/glossary\">Глоссарий</a></li>\n</ul>\n<h2 id=\"справочник-по-api\"><a href=\"#справочник-по-api\">Справочник по API</a></h2>\n<ul>\n<li><a href=\"/docs/api/synopsis\">Краткий обзор</a></li>\n<li><a href=\"/docs/api/process\">Объект процесса</a></li>\n<li><a href=\"/docs/api/command-line-switches\">Поддерживаемые параметры командной строки</a></li>\n<li><a href=\"/docs/api/environment-variables\">Переменные окружения</a></li>\n<li><a href=\"/docs/api/extensions\">Chrome Extensions Support</a></li>\n<li><a href=\"/docs/breaking-changes\">Критические изменения в API</a></li>\n</ul>\n<h3 id=\"пользовательские-dom-элементы\"><a href=\"#пользовательские-dom-элементы\">Пользовательские DOM-элементы:</a></h3>\n<ul>\n<li><a href=\"/docs/api/file-object\">Объект <code>File</code></a></li>\n<li><a href=\"/docs/api/webview-tag\">Тег <code>&#x3C;webview></code></a></li>\n<li><a href=\"/docs/api/window-open\">Функция <code>window.open</code></a></li>\n<li><a href=\"/docs/api/browser-window-proxy\">Объект <code>BrowserWindowProxy</code></a></li>\n</ul>\n<h3 id=\"модули-для-главного-процесса\"><a href=\"#модули-для-главного-процесса\">Модули для главного процесса:</a></h3>\n<ul>\n<li><a href=\"/docs/api/app\">app</a></li>\n<li><a href=\"/docs/api/auto-updater\">autoUpdater</a></li>\n<li><a href=\"/docs/api/browser-view\">BrowserView</a></li>\n<li><a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n<li><a href=\"/docs/api/content-tracing\">contentTracing</a></li>\n<li><a href=\"/docs/api/dialog\">dialog</a></li>\n<li><a href=\"/docs/api/global-shortcut\">globalShortcut</a></li>\n<li><a href=\"/docs/api/in-app-purchase\">inAppPurchase</a></li>\n<li><a href=\"/docs/api/ipc-main\">ipcMain</a></li>\n<li><a href=\"/docs/api/menu\">Menu</a></li>\n<li><a href=\"/docs/api/menu-item\">MenuItem</a></li>\n<li><a href=\"/docs/api/message-channel-main\">MessageChannelMain</a></li>\n<li><a href=\"/docs/api/message-port-main\">MessagePortMain</a></li>\n<li><a href=\"/docs/api/net\">net</a></li>\n<li><a href=\"/docs/api/net-log\">netLog</a></li>\n<li><a href=\"/docs/api/native-theme\">nativeTheme (Родная тема)</a></li>\n<li><a href=\"/docs/api/notification\">Notification (Оповещения)</a></li>\n<li><a href=\"/docs/api/power-monitor\">powerMonitor</a></li>\n<li><a href=\"/docs/api/power-save-blocker\">powerSaveBlocker</a></li>\n<li><a href=\"/docs/api/protocol\">protocol</a></li>\n<li><a href=\"/docs/api/screen\">screen</a></li>\n<li><a href=\"/docs/api/session\">session</a></li>\n<li><a href=\"/docs/api/share-menu\">ShareMenu</a></li>\n<li><a href=\"/docs/api/system-preferences\">systemPreferences</a></li>\n<li><a href=\"/docs/api/touch-bar\">TouchBar</a></li>\n<li><a href=\"/docs/api/tray\">Tray</a></li>\n<li><a href=\"/docs/api/web-contents\">webContents</a></li>\n<li><a href=\"/docs/api/web-frame-main\">webFrameMain</a></li>\n</ul>\n<h3 id=\"модули-для-процесса-рендерера-веб-страницы\"><a href=\"#модули-для-процесса-рендерера-веб-страницы\">Модули для процесса-рендерера (веб-страницы):</a></h3>\n<ul>\n<li><a href=\"/docs/api/context-bridge\">contextBridge</a></li>\n<li><a href=\"/docs/api/ipc-renderer\">ipcRenderer</a></li>\n<li><a href=\"/docs/api/web-frame\">webFrame</a></li>\n</ul>\n<h3 id=\"модули-для-обоих-процессов\"><a href=\"#модули-для-обоих-процессов\">Модули для обоих процессов:</a></h3>\n<ul>\n<li><a href=\"/docs/api/clipboard\">clipboard</a></li>\n<li><a href=\"/docs/api/crash-reporter\">crashReporter</a></li>\n<li><a href=\"/docs/api/desktop-capturer\">desktopCapturer</a></li>\n<li><a href=\"/docs/api/native-image\">nativeImage</a></li>\n<li><a href=\"/docs/api/shell\">shell</a></li>\n</ul>\n<h2 id=\"разработка\"><a href=\"#разработка\">Разработка</a></h2>\n<p>См. <a href=\"/docs/development/README\">development/README.md</a></p>",
      "title": "Официальное руководство",
      "description": ""
    },
    "/docs/development/README": {
      "locale": "ru-RU",
      "slug": "README",
      "href": "/docs/development/README",
      "crowdinFileId": "256127",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/README.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"разработка-electron\"><a href=\"#разработка-electron\">Разработка Electron</a></h1>\n<p>Эти руководства предназначены для людей, которые работают над Electron самостоятельно. Для руководств по разработке приложения Electron, посетите <a href=\"/docs/README#guides-and-tutorials\">/docs/README.md</a>.</p>\n<ul>\n<li><a href=\"https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md\">Кодекс поведения</a></li>\n<li><a href=\"https://github.com/electron/electron/blob/main/CONTRIBUTING.md\">Вклад в Elecetron</a></li>\n<li><a href=\"/docs/development/issues\">Вопросы</a></li>\n<li><a href=\"/docs/development/pull-requests\">Запросы на слияние</a></li>\n<li><a href=\"/docs/development/coding-style#documentation\">Руководство по написанию документации</a></li>\n<li><a href=\"/docs/development/source-code-directory-structure\">Структура каталога с исходным кодом</a></li>\n<li><a href=\"/docs/development/coding-style\">Стиль кода</a></li>\n<li><a href=\"/docs/development/clang-format\">Использование clang-format на C++ коде</a></li>\n<li><a href=\"/docs/development/clang-tidy\">Using clang-tidy on C++ Code</a></li>\n<li><a href=\"/docs/development/build-system-overview\">Обзор системы сборки</a></li>\n<li><a href=\"/docs/development/build-instructions-macos\">Инструкции по сборке (macOS)</a></li>\n<li><a href=\"/docs/development/build-instructions-windows\">Инструкции по сборке (Windows)</a></li>\n<li><a href=\"/docs/development/build-instructions-linux\">Инструкции по сборке (Linux)</a></li>\n<li><a href=\"/docs/development/chromium-development\">Разработка Chromium</a></li>\n<li><a href=\"/docs/development/v8-development\">Разработка V8</a></li>\n<li><a href=\"/docs/development/testing\">Тестирование</a></li>\n<li><a href=\"/docs/development/debug-instructions-windows\">Отладка под Windows</a></li>\n<li><a href=\"/docs/development/debugging-instructions-macos\">Отладка под macOS</a></li>\n<li><a href=\"/docs/development/setting-up-symbol-server\">Настройка сервера символов в отладчике</a></li>\n<li><a href=\"/docs/development/patches\">Патчи</a></li>\n</ul>",
      "title": "Разработка Electron",
      "description": ""
    },
    "/docs/tutorial/recent-documents": {
      "locale": "ru-RU",
      "slug": "recent-documents",
      "href": "/docs/tutorial/recent-documents",
      "crowdinFileId": "256239",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/recent-documents.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"недавние-документы-windows--macos\"><a href=\"#недавние-документы-windows--macos\">Недавние документы (Windows &#x26; macOS)</a></h1>\n<h2 id=\"обзор\"><a href=\"#обзор\">Обзор</a></h2>\n<p>Windows и macOS предоставляют легкий доступ к списку последних документов открытых приложением через JumpList или dock меню, соответственно.</p>\n<p><strong>JumpList:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/2289/23446924/11a27b98-fdfc-11e6-8485-cc3b1e86b80a.png\" alt=\"JumpList Recent Files\"></p>\n<p><strong>Dock меню приложения:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5069610/2aa80758-6e97-11e4-8cfb-c1a414a10774.png\" alt=\"Меню macOS Dock\"></p>\n<h2 id=\"пример\"><a href=\"#пример\">Пример</a></h2>\n<h3 id=\"managing-recent-documents\"><a href=\"#managing-recent-documents\">Managing recent documents</a></h3>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/recent-documents\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\n<span class=\"hljs-keyword\">const</span> fileName = <span class=\"hljs-string\">'recently-used.md'</span>\nfs.writeFile(fileName, <span class=\"hljs-string\">'Lorem Ipsum'</span>, () => {\n  app.addRecentDocument(path.join(__dirname, fileName))\n})\n\napp.whenReady().then(createWindow)\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  app.clearRecentDocuments()\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<h4 id=\"adding-a-recent-document\"><a href=\"#adding-a-recent-document\">Adding a recent document</a></h4>\n<p>To add a file to recent documents, use the <a href=\"/docs/api/app#appaddrecentdocumentpath-macos-windows\">app.addRecentDocument</a> API.</p>\n<p>After launching the Electron application, right click the application icon. In this guide, the item is a Markdown file located in the root of the project. You should see <code>recently-used.md</code> added to the list of recent files:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/recent-documents.png\" alt=\"Недавний документ\"></p>\n<h4 id=\"clearing-the-list-of-recent-documents\"><a href=\"#clearing-the-list-of-recent-documents\">Clearing the list of recent documents</a></h4>\n<p>To clear the list of recent documents, use the <a href=\"/docs/api/app#appclearrecentdocuments-macos-windows\">app.clearRecentDocuments</a> API. In this guide, the list of documents is cleared once all windows have been closed.</p>\n<h2 id=\"additional-information\"><a href=\"#additional-information\">Additional information</a></h2>\n<h3 id=\"windows-примечания\"><a href=\"#windows-примечания\">Windows примечания</a></h3>\n<p>To use this feature on Windows, your application has to be registered as a handler of the file type of the document, otherwise the file won't appear in JumpList even after you have added it. You can find everything on registering your application in <a href=\"https://msdn.microsoft.com/en-us/library/cc144104(VS.85).aspx\">Application Registration</a>.</p>\n<p>Когда пользователь щелкает файл из JumpList, новый экземпляр приложения будет запущен с добавленного пути файла, как аргумент командной строки.</p>\n<h3 id=\"macos-примечания\"><a href=\"#macos-примечания\">macOS примечания</a></h3>\n<h4 id=\"add-the-recent-documents-list-to-the-application-menu\"><a href=\"#add-the-recent-documents-list-to-the-application-menu\">Add the Recent Documents list to the application menu</a></h4>\n<p>You can add menu items to access and clear recent documents by adding the following code snippet to your menu template:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"submenu\"</span>:[\n    {\n      <span class=\"hljs-attr\">\"label\"</span>:<span class=\"hljs-string\">\"Open Recent\"</span>,\n      <span class=\"hljs-attr\">\"role\"</span>:<span class=\"hljs-string\">\"recentdocuments\"</span>,\n      <span class=\"hljs-attr\">\"submenu\"</span>:[\n        {\n          <span class=\"hljs-attr\">\"label\"</span>:<span class=\"hljs-string\">\"Clear Recent\"</span>,\n          <span class=\"hljs-attr\">\"role\"</span>:<span class=\"hljs-string\">\"clearrecentdocuments\"</span>\n        }\n      ]\n    }\n  ]\n}\n</code></pre>\n<p>Make sure the application menu is added after the <a href=\"/docs/api/app#event-ready\"><code>'ready'</code></a> event and not before, or the menu item will be disabled:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> template = [\n  <span class=\"hljs-comment\">// Menu template here</span>\n]\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  Menu.setApplicationMenu(menu)\n})\n</code></pre>\n<p><img src=\"https://user-images.githubusercontent.com/3168941/33003655-ea601c3a-cd70-11e7-97fa-7c062149cfb1.png\" alt=\"Элемент меню macOS последних документов\"></p>\n<p>When a file is requested from the recent documents menu, the <code>open-file</code> event of <code>app</code> module will be emitted for it.</p>",
      "title": "Недавние документы (Windows & macOS)",
      "description": ""
    },
    "/docs/api/structures/rectangle": {
      "locale": "ru-RU",
      "slug": "rectangle",
      "href": "/docs/api/structures/rectangle",
      "crowdinFileId": "256493",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/rectangle.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"rectangle-object\"><a href=\"#rectangle-object\">Rectangle Object</a></h1>\n<ul>\n<li><code>x</code> Number - The x coordinate of the origin of the rectangle (must be an integer).</li>\n<li><code>y</code> Number - The y coordinate of the origin of the rectangle (must be an integer).</li>\n<li><code>width</code> Number - The width of the rectangle (must be an integer).</li>\n<li><code>height</code> Number - The height of the rectangle (must be an integer).</li>\n</ul>",
      "title": "Rectangle Object",
      "description": ""
    },
    "/docs/api/structures/referrer": {
      "locale": "ru-RU",
      "slug": "referrer",
      "href": "/docs/api/structures/referrer",
      "crowdinFileId": "256495",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/referrer.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"referrer-object\"><a href=\"#referrer-object\">Referrer Object</a></h1>\n<ul>\n<li><code>url</code> String - HTTP Referrer URL.</li>\n<li><code>policy</code> String - Can be <code>default</code>, <code>unsafe-url</code>, <code>no-referrer-when-downgrade</code>, <code>no-referrer</code>, <code>origin</code>, <code>strict-origin-when-cross-origin</code>, <code>same-origin</code> or <code>strict-origin</code>. See the <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy\">Referrer-Policy spec</a> for more details on the meaning of these values.</li>\n</ul>",
      "title": "Referrer Object",
      "description": ""
    },
    "/docs/tutorial/repl": {
      "locale": "ru-RU",
      "slug": "repl",
      "href": "/docs/tutorial/repl",
      "crowdinFileId": "256241",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/repl.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"repl\"><a href=\"#repl\">REPL</a></h1>\n<p><a href=\"https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop\">Read-Eval-Print-Loop</a> (REPL) is a simple, interactive computer programming environment that takes single user inputs (i.e. single expressions), evaluates them, and returns the result to the user.</p>\n<h2 id=\"главный-процесс\"><a href=\"#главный-процесс\">Главный процесс</a></h2>\n<p>Electron exposes the <a href=\"https://nodejs.org/dist/latest/docs/api/repl.html\">Node.js <code>repl</code> module</a> through the <code>--interactive</code> CLI flag. Assuming you have <code>electron</code> installed as a local project dependency, you should be able to access the REPL with the following command:</p>\n<pre><code class=\"hljs language-sh\">./node_modules/.bin/electron --interactive\n</code></pre>\n<p><strong>Note:</strong> <code>electron --interactive</code> is not available on Windows (see <a href=\"https://github.com/electron/electron/pull/5776\">electron/electron#5776</a> for more details).</p>\n<h2 id=\"renderer-process\"><a href=\"#renderer-process\">Renderer process</a></h2>\n<p>You can use the DevTools Console tab to get a REPL for any renderer process. To learn more, read <a href=\"https://developer.chrome.com/docs/devtools/console/\">the Chrome documentation</a>.</p>",
      "title": "REPL",
      "description": ""
    },
    "/docs/tutorial/represented-file": {
      "locale": "ru-RU",
      "slug": "represented-file",
      "href": "/docs/tutorial/represented-file",
      "crowdinFileId": "256243",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/represented-file.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"representing-files-in-a-browserwindow-macos\"><a href=\"#representing-files-in-a-browserwindow-macos\">Representing Files in a BrowserWindow (macOS)</a></h1>\n<h2 id=\"обзор\"><a href=\"#обзор\">Обзор</a></h2>\n<p>On macOS, you can set a represented file for any window in your application. The represented file's icon will be shown in the title bar, and when users <code>Command-Click</code> or <code>Control-Click</code>, a popup with a path to the file will be shown.</p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5082061/670a949a-6f14-11e4-987a-9aaa04b23c1d.png\" alt=\"Представленный файл\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example where this feature is used to indicate the currently opened file in the Atom text editor.</p>\n</blockquote>\n<p>You can also set the edited state for a window so that the file icon can indicate whether the document in this window has been modified.</p>\n<p>Для установления представленного файла можно использовать <a href=\"/docs/api/browser-window#winsetrepresentedfilenamefilename-macos\">BrowserWindow.setRepresentedFilename</a> и <a href=\"/docs/api/browser-window#winsetdocumenteditededited-macos\">BrowserWindow.setDocumentEdited</a> APIs.</p>\n<h2 id=\"пример\"><a href=\"#пример\">Пример</a></h2>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/represented-file\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>);\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.setRepresentedFilename(os.homedir())\n  win.setDocumentEdited(<span class=\"hljs-literal\">true</span>)\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<p>After launching the Electron application, click on the title with <code>Command</code> or <code>Control</code> key pressed. You should see a popup with the represented file at the top. In this guide, this is the current user's home directory:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/represented-file.png\" alt=\"Represented file\"></p>",
      "title": "Representing Files in a BrowserWindow (macOS)",
      "description": "NOTE: The screenshot above is an example where this feature is used to indicate the currently opened file in the Atom text editor."
    },
    "/docs/api/safe-storage": {
      "locale": "ru-RU",
      "slug": "safe-storage",
      "href": "/docs/api/safe-storage",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/safe-storage.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"safestorage\"><a href=\"#safestorage\">safeStorage</a></h1>\n<blockquote>\n<p>Allows access to simple encryption and decryption of strings for storage on the local machine.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p>This module protects data stored on disk from being accessed by other applications or users with full disk access.</p>\n<p>Note that on Mac, access to the system Keychain is required and these calls can block the current thread to collect user input. The same is true for Linux, if a password management tool is available.</p>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code>safeStorage</code> имеет следующие методы:</p>\n<h3 id=\"safestorageisencryptionavailable\"><a href=\"#safestorageisencryptionavailable\"><code>safeStorage.isEncryptionAvailable()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether encryption is available.</p>\n<p>On Linux, returns true if the secret key is available. On MacOS, returns true if Keychain is available. On Windows, returns true with no other preconditions.</p>\n<h3 id=\"safestorageencryptstringplaintext\"><a href=\"#safestorageencryptstringplaintext\"><code>safeStorage.encryptString(plainText)</code></a></h3>\n<ul>\n<li>Строка <code>plainText</code></li>\n</ul>\n<p>Returns <code>Buffer</code> -  An array of bytes representing the encrypted string.</p>\n<p>This function will throw an error if encryption fails.</p>\n<h3 id=\"safestoragedecryptstringencrypted\"><a href=\"#safestoragedecryptstringencrypted\"><code>safeStorage.decryptString(encrypted)</code></a></h3>\n<ul>\n<li><code>encrypted</code> Buffer</li>\n</ul>\n<p>Returns <code>String</code> - the decrypted string. Decrypts the encrypted buffer obtained  with <code>safeStorage.encryptString</code> back into a string.</p>\n<p>This function will throw an error if decryption fails.</p>",
      "title": "safeStorage",
      "description": "Allows access to simple encryption and decryption of strings for storage on the local machine."
    },
    "/docs/tutorial/sandbox": {
      "locale": "ru-RU",
      "slug": "sandbox",
      "href": "/docs/tutorial/sandbox",
      "crowdinFileId": "256245",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/sandbox.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dimamailru\"><a href=\"#dimamailru\">Dima@mail.ru</a></h1>\n<p>Одна из ключевых функций безопасности в Chromium заключается в том, что процессы могут быть выполнены в песочнице. Песочница ограничивает вред, который может нанести вредоносный код, ограничивая доступ к большинству системных ресурсов — изолированные процессы могут свободно использовать только циклы ЦП и память. Для выполнения операций, требующих дополнительных привилегий, изолированные процессы используют выделенные каналы связи для делегирования задач более привилегированным процессам.</p>\n<p>В Chromium песочница применяется к большинству процессов, отличных от основного процесса. Сюда входят процессы визуализации, а также вспомогательные процессы, такие как службы аудио, служба GPU и сетевая служба.</p>\n<p>Смотрите <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/design/sandbox.md\">дизайн приложения Chromium</a> для более подробной информации.</p>\n<h2 id=\"политика-песочницы-electron\"><a href=\"#политика-песочницы-electron\">Политика песочницы Electron</a></h2>\n<p>Electron поставляется со смешанной средой песочницы, что означает, что изолированные процессы могут выполняться наряду с привилегированными. По умолчанию, процессы рендеринга не выполняются в \"песочнице\", но служебные процессы - да. Обратите внимание, что, как и в Chromium, основной процесс (браузер) является привилегированным и не может быть изолирован.</p>\n<p>Исторически сложилось так, что этот смешанный подход к песочнице был создан потому, что наличие Node.js доступной в рендерере, является чрезвычайно мощным инструментом для разработчиков приложений. К сожалению, эта функция также является столь же мощной уязвимостью в безопасности.</p>\n<p>Теоретически, рендереры вне песочниц не являются проблемой для настольных приложений, которые отображают только доверенный код, но они делают Electron менее безопасным, чем Chromium для отображения ненадежного веб-контента. Тем не менее, даже якобы доверенный код может быть опасным — существует бесчисленное множество векторов атак, которые могут использовать злоумышленники, от межсайтовых сценариев до внедрения контента и атак «человек посередине» на удаленно загруженные веб-сайты, и это лишь некоторые из них. По этой причине мы рекомендуем включить песочницу рендереров для подавляющего большинства случаев с осторожностью.</p>\n<!--TODO: update this guide when #28466 is either solved or closed -->\n<p>Обратите внимание, что в трекере задач активно обсуждается включение песочницы рендерера по умолчанию. Подробности см. в <a href=\"https://github.com/electron/electron/issues/28466\">#28466</a>).</p>\n<h2 id=\"sandbox-behaviour-in-electron\"><a href=\"#sandbox-behaviour-in-electron\">Sandbox behaviour in Electron</a></h2>\n<p>Sandboxed processes in Electron behave <em>mostly</em> in the same way as Chromium's do, but Electron has a few additional concepts to consider because it interfaces with Node.js.</p>\n<h3 id=\"renderer-processes\"><a href=\"#renderer-processes\">Renderer processes</a></h3>\n<p>When renderer processes in Electron are sandboxed, they behave in the same way as a regular Chrome renderer would. A sandboxed renderer won't have a Node.js environment initialized.</p>\n<!-- TODO(erickzhao): when we have a solid guide for IPC, link it here -->\n<p>Therefore, when the sandbox is enabled, renderer processes can only perform privileged tasks (such as interacting with the filesystem, making changes to the system, or spawning subprocesses) by delegating these tasks to the main process via inter-process communication (IPC).</p>\n<h3 id=\"preload-scripts\"><a href=\"#preload-scripts\">Preload scripts</a></h3>\n<p>In order to allow renderer processes to communicate with the main process, preload scripts attached to sandboxed renderers will still have a polyfilled subset of Node.js APIs available. A <code>require</code> function similar to Node's <code>require</code> module is exposed, but can only import a subset of Electron and Node's built-in modules:</p>\n<ul>\n<li><code>electron</code> (only renderer process modules)</li>\n<li><a href=\"https://nodejs.org/api/events.html\"><code>events</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html\"><code>timers</code></a></li>\n<li><a href=\"https://nodejs.org/api/url.html\"><code>url</code></a></li>\n</ul>\n<p>In addition, the preload script also polyfills certain Node.js primitives as globals:</p>\n<ul>\n<li><a href=\"https://nodejs.org/api/Buffer.html\"><code>Buffer</code></a></li>\n<li><a href=\"/docs/api/process\"><code>process</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html#timers_clearimmediate_immediate\"><code>clearImmediate</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html#timers_setimmediate_callback_args\"><code>setImmediate</code></a></li>\n</ul>\n<p>Because the <code>require</code> function is a polyfill with limited functionality, you will not be able to use <a href=\"https://nodejs.org/api/modules.html#modules_modules_commonjs_modules\">CommonJS modules</a> to separate your preload script into multiple files. If you need to split your preload code, use a bundler such as <a href=\"https://webpack.js.org/\">webpack</a> or <a href=\"https://parceljs.org/\">Parcel</a>.</p>\n<p>Note that because the environment presented to the <code>preload</code> script is substantially more privileged than that of a sandboxed renderer, it is still possible to leak privileged APIs to untrusted code running in the renderer process unless <a href=\"/docs/tutorial/context-isolation\"><code>contextIsolation</code></a> is enabled.</p>\n<h2 id=\"configuring-the-sandbox\"><a href=\"#configuring-the-sandbox\">Configuring the sandbox</a></h2>\n<h3 id=\"enabling-the-sandbox-for-a-single-process\"><a href=\"#enabling-the-sandbox-for-a-single-process\">Enabling the sandbox for a single process</a></h3>\n<p>In Electron, renderer sandboxing can be enabled on a per-process basis with the <code>sandbox: true</code> preference in the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> constructor.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">sandbox</span>: <span class=\"hljs-literal\">true</span>\n    }\n  })\n  win.loadURL(<span class=\"hljs-string\">'https://google.com'</span>)\n})\n</code></pre>\n<h3 id=\"enabling-the-sandbox-globally\"><a href=\"#enabling-the-sandbox-globally\">Enabling the sandbox globally</a></h3>\n<p>If you want to force sandboxing for all renderers, you can also use the <a href=\"/docs/api/app#appenablesandbox\"><code>app.enableSandbox</code></a> API. Note that this API has to be called before the app's <code>ready</code> event.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\napp.enableSandbox()\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// no need to pass `sandbox: true` since `app.enableSandbox()` was called.</span>\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://google.com'</span>)\n})\n</code></pre>\n<h3 id=\"disabling-chromiums-sandbox-testing-only\"><a href=\"#disabling-chromiums-sandbox-testing-only\">Disabling Chromium's sandbox (testing only)</a></h3>\n<p>You can also disable Chromium's sandbox entirely with the <a href=\"/docs/api/command-line-switches#--no-sandbox\"><code>--no-sandbox</code></a> CLI flag, which will disable the sandbox for all processes (including utility processes). We highly recommend that you only use this flag for testing purposes, and <strong>never</strong> in production.</p>\n<p>Note that the <code>sandbox: true</code> option will still disable the renderer's Node.js environment.</p>\n<h2 id=\"a-note-on-rendering-untrusted-content\"><a href=\"#a-note-on-rendering-untrusted-content\">A note on rendering untrusted content</a></h2>\n<p>Rendering untrusted content in Electron is still somewhat uncharted territory, though some apps are finding success (e.g. <a href=\"https://github.com/beakerbrowser/beaker\">Beaker Browser</a>). Our goal is to get as close to Chrome as we can in terms of the security of sandboxed content, but ultimately we will always be behind due to a few fundamental issues:</p>\n<ol>\n<li>We do not have the dedicated resources or expertise that Chromium has to apply to the security of its product. We do our best to make use of what we have, to inherit everything we can from Chromium, and to respond quickly to security issues, but Electron cannot be as secure as Chromium without the resources that Chromium is able to dedicate.</li>\n<li>Some security features in Chrome (such as Safe Browsing and Certificate Transparency) require a centralized authority and dedicated servers, both of which run counter to the goals of the Electron project. As such, we disable those features in Electron, at the cost of the associated security they would otherwise bring.</li>\n<li>There is only one Chromium, whereas there are many thousands of apps built on Electron, all of which behave slightly differently. Accounting for those differences can yield a huge possibility space, and make it challenging to ensure the security of the platform in unusual use cases.</li>\n<li>We can't push security updates to users directly, so we rely on app vendors to upgrade the version of Electron underlying their app in order for security updates to reach users.</li>\n</ol>\n<p>While we make our best effort to backport Chromium security fixes to older versions of Electron, we do not make a guarantee that every fix will be backported. Your best chance at staying secure is to be on the latest stable version of Electron.</p>",
      "title": "Dima@mail.ru",
      "description": ""
    },
    "/docs/api/screen": {
      "locale": "ru-RU",
      "slug": "screen",
      "href": "/docs/api/screen",
      "crowdinFileId": "256361",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/screen.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"screen\"><a href=\"#screen\">screen</a></h1>\n<blockquote>\n<p>Предоставляет информацию о размере экрана, дисплеях, позиции курсора.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p>Этот модуль нельзя использовать до тех пор, пока событие <code>ready</code> в <code>app</code> не будет готово к использованию.</p>\n<p><code>screen</code> is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p><strong>Note:</strong> In the renderer / DevTools, <code>window.screen</code> is a reserved DOM property, so writing <code>let { screen } = require('electron')</code> will not work.</p>\n<p>An example of creating a window that fills the whole screen:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/screen/fit-screen\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, screen } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> { width, height } = screen.getPrimaryDisplay().workAreaSize\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ width, height })\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>Другой пример создания окна на внешнем дисплее:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, screen } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> displays = screen.getAllDisplays()\n  <span class=\"hljs-keyword\">const</span> externalDisplay = displays.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">display</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> display.bounds.x !== <span class=\"hljs-number\">0</span> || display.bounds.y !== <span class=\"hljs-number\">0</span>\n  })\n\n  <span class=\"hljs-keyword\">if</span> (externalDisplay) {\n    win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n      <span class=\"hljs-attr\">x</span>: externalDisplay.bounds.x + <span class=\"hljs-number\">50</span>,\n      <span class=\"hljs-attr\">y</span>: externalDisplay.bounds.y + <span class=\"hljs-number\">50</span>\n    })\n    win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  }\n})\n</code></pre>\n<h2 id=\"события\"><a href=\"#события\">События</a></h2>\n<p>Объект <code>screen</code> имеет следующие события:</p>\n<h3 id=\"событие-display-added\"><a href=\"#событие-display-added\">Событие: 'display-added'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>newDisplay</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n</ul>\n<p>Возникает при добавлении <code>newDisplay</code>.</p>\n<h3 id=\"событие-display-removed\"><a href=\"#событие-display-removed\">Событие: 'display-removed'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>oldDisplay</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n</ul>\n<p>Возникает при удалении <code>oldDisplay</code>.</p>\n<h3 id=\"событие-display-metrics-changed\"><a href=\"#событие-display-metrics-changed\">Событие: 'display-metrics-changed'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>display</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n<li><code>changedMetrics</code> String[]</li>\n</ul>\n<p>Возникает при изменении одной или нескольких метрик в <code>display</code>. <code>changedMetrics</code> является массивом строк, описывающих изменения. Возможные изменения <code>bounds</code>, <code>workArea</code>, <code>scaleFactor</code> и <code>rotation</code>.</p>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code>screen</code> имеет следующие методы:</p>\n<h3 id=\"screengetcursorscreenpoint\"><a href=\"#screengetcursorscreenpoint\"><code>screen.getCursorScreenPoint()</code></a></h3>\n<p>Возвращает <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>Текущее абсолютное положение указателя мыши.</p>\n<p><strong>Note:</strong> The return value is a DIP point, not a screen physical point.</p>\n<h3 id=\"screengetprimarydisplay\"><a href=\"#screengetprimarydisplay\"><code>screen.getPrimaryDisplay()</code></a></h3>\n<p>Возвращает <a href=\"/docs/api/structures/display\"><code>Display</code></a> - Основной дисплей.</p>\n<h3 id=\"screengetalldisplays\"><a href=\"#screengetalldisplays\"><code>screen.getAllDisplays()</code></a></h3>\n<p>Возвращает <a href=\"/docs/api/structures/display\"><code>Display[]</code></a> - Массив доступных в настоящее время дисплеев.</p>\n<h3 id=\"screengetdisplaynearestpointpoint\"><a href=\"#screengetdisplaynearestpointpoint\"><code>screen.getDisplayNearestPoint(point)</code></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Возвращает <a href=\"/docs/api/structures/display\"><code>Display</code></a> - Дисплей, ближайший к указанной точке.</p>\n<h3 id=\"screengetdisplaymatchingrect\"><a href=\"#screengetdisplaymatchingrect\"><code>screen.getDisplayMatching(rect)</code></a></h3>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Возвращает <a href=\"/docs/api/structures/display\"><code>Display</code></a> - Дисплей, который наиболее близко пересекает заданные границы.</p>\n<h3 id=\"screenscreentodippointpoint-windows\"><a href=\"#screenscreentodippointpoint-windows\"><code>screen.screenToDipPoint(point)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Возвращает <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>Преобразует физическую точку экрана в точку DIP экрана. Масштаб DPI выполняется относительно отображения, содержащего физическую точку.</p>\n<h3 id=\"screendiptoscreenpointpoint-windows\"><a href=\"#screendiptoscreenpointpoint-windows\"><code>screen.dipToScreenPoint(point)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Возвращает <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>Преобразует точку DIP экрана в физическую точку экрана. Масштаб DPI выполняется относительно отображения, содержащего точку DIP.</p>\n<h3 id=\"screenscreentodiprectwindow-rect-windows\"><a href=\"#screenscreentodiprectwindow-rect-windows\"><code>screen.screenToDipRect(window, rect)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | null</li>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Возвращает <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>Преобразует физический прямоугольник экрана в DIP-прямоугольник экрана. Шкала DPI выполняется относительно дисплея, ближайшего к <code>window</code>. Если <code>window</code> равен нулю, то масштабирование будет производиться до ближайшего к <code>rect</code>.</p>\n<h3 id=\"screendiptoscreenrectwindow-rect-windows\"><a href=\"#screendiptoscreenrectwindow-rect-windows\"><code>screen.dipToScreenRect(window, rect)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | null</li>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Возвращает <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>Преобразовывает DIP-прямоуголник экрана в физический прямоугольник экрана. Шкала DPI выполняется относительно дисплея, ближайшего к <code>window</code>. Если <code>window</code> равен нулю, то масштабирование будет производиться до ближайшего к <code>rect</code>.</p>",
      "title": "screen",
      "description": "Предоставляет информацию о размере экрана, дисплеях, позиции курсора."
    },
    "/docs/api/structures/scrubber-item": {
      "locale": "ru-RU",
      "slug": "scrubber-item",
      "href": "/docs/api/structures/scrubber-item",
      "crowdinFileId": "256497",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/scrubber-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"scrubberitem-object\"><a href=\"#scrubberitem-object\">ScrubberItem Object</a></h1>\n<ul>\n<li><code>label</code> String (optional) - The text to appear in this item.</li>\n<li><code>icon</code> NativeImage (optional) - The image to appear in this item.</li>\n</ul>",
      "title": "ScrubberItem Object",
      "description": ""
    },
    "/docs/tutorial/security": {
      "locale": "ru-RU",
      "slug": "security",
      "href": "/docs/tutorial/security",
      "crowdinFileId": "256247",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/security.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"безопасность-нативные-возможности-и-ваша-ответственность\"><a href=\"#безопасность-нативные-возможности-и-ваша-ответственность\">Безопасность, нативные возможности и ваша ответственность</a></h1>\n<p>Как веб-разработчики, мы заботимся о безопасности браузера и риски, связанные с кодом, который мы пишем, достаточно небольшие. Наши веб-сайты имеют ограниченные полномочия в песочнице, и мы верим, что пользователи довольны браузером, созданным большой командой инженеров, которая может быстро реагировать на последние обнаруженные угрозы безопасности.</p>\n<p>Когда вы работаете в среде Электрон, важно понимать, что это не веб браузер. Электрон позволяет создавать функционально развитые приложения для настольных компьютеров с помощью веб технологий, но ваш код обладает большими возможностями. JavaScript имеет доступ к файловой системе, пользовательским скриптам и т. д. Благодаря этим возможностям вы можете создавать высококачественные нативные приложения, но это так же множит риски увеличивающиеся с дополнительными полномочиями вашего кода.</p>\n<p>Учтите что показ произвольного содержимого от недоверенных источников влечет за собой риски безопасности, которые Электрон не предназначен купировать. К сведению, наиболее популярные приложения Электрон (Atom, Slack, Visual Studio Code, etc) предназначены для локальной работы (или с доверенными удаленными узлами, без Node интеграции). Если ваше приложение выполняет код из онлайн источника, вы обязаны обеспечить безопасность кода.</p>\n<h2 id=\"отчеты-по-безопасности\"><a href=\"#отчеты-по-безопасности\">Отчеты по безопасности</a></h2>\n<p>Для получения информации о том, как правильно устранять уязвимости Electron, загляни в <a href=\"https://github.com/electron/electron/tree/main/SECURITY.md\">SECURITY.md</a></p>\n<h2 id=\"вопросы-и-обновления-безопасности-chromium\"><a href=\"#вопросы-и-обновления-безопасности-chromium\">Вопросы и обновления безопасности Chromium</a></h2>\n<p>Electron keeps up to date with alternating Chromium releases. For more information, see the <a href=\"https://electronjs.org/blog/12-week-cadence\">Electron Release Cadence blog post</a>.</p>\n<h2 id=\"безопасность---это-ответственность-каждого\"><a href=\"#безопасность---это-ответственность-каждого\">Безопасность - это ответственность каждого</a></h2>\n<p>Важно помнить, что безопасность вашего Electron приложения является результатом общей безопасности основы платформы (<em>Chromium</em>, <em>Node.js</em>), самого Electron, всех NPM-зависимостей и вашего кода. Поэтому вы обязаны следовать нескольким важным рекомендациям:</p>\n<ul>\n<li>\n<p><strong>Keep your application up-to-date with the latest Electron framework release.</strong> When releasing your product, you’re also shipping a bundle composed of Electron, Chromium shared library and Node.js. Vulnerabilities affecting these components may impact the security of your application. By updating Electron to the latest version, you ensure that critical vulnerabilities (such as <em>nodeIntegration bypasses</em>) are already patched and cannot be exploited in your application. For more information, see \"<a href=\"#16-use-a-current-version-of-electron\">Use a current version of Electron</a>\".</p>\n</li>\n<li>\n<p><strong>Оцените свои зависимости.</strong> В то время как NPM предоставляет полмиллиона многоразовых пакетов, вы несете ответственность за выбор надежных библиотек третьей стороны. If you use outdated libraries affected by known vulnerabilities or rely on poorly maintained code, your application security could be in jeopardy.</p>\n</li>\n<li>\n<p><strong>Используйте безопасные методы программирования</strong> Первая линия защиты вашей заявки — ваш собственный код. Common web vulnerabilities, such as Cross-Site Scripting (XSS), have a higher security impact on Electron applications hence it is highly recommended to adopt secure software development best practices and perform security testing.</p>\n</li>\n</ul>\n<h2 id=\"изоляция-ненадежного-контента\"><a href=\"#изоляция-ненадежного-контента\">Изоляция ненадежного контента</a></h2>\n<p>Проблемы безопасности возникают всякий раз, когда вы получаете код из ненадежного источника (напр., удаленный сервер) и выполняете его локально. As an example, consider a remote website being displayed inside a default <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. If an attacker somehow manages to change said content (either by attacking the source directly, or by sitting between your app and the actual destination), they will be able to execute native code on the user's machine.</p>\n<blockquote>\n<p>⚠️  ни при каких обстоятельствах не следует загружать и выполнять удаленный код с Node.js integration enabled. Вместо этого используйте только локальные файлы (упакованные вместе с вашим приложением), для выполнения Node.js кода. To display remote content, use the <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> tag or <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, make sure to disable the <code>nodeIntegration</code> and enable <code>contextIsolation</code>.</p>\n</blockquote>\n<h2 id=\"предупреждение-безопасности-electron\"><a href=\"#предупреждение-безопасности-electron\">Предупреждение безопасности Electron</a></h2>\n<p>Электрон 2.0 показывает разработчикам предупреждения и рекомендации в консоли. Они показываются только тогда, когда имя исполняемого файла - Electron.</p>\n<p>Вы можете принудительно включить или выключить эти предупреждения в настройках <code>ELECTRON_ENABLE_SECURITY_WARNINGS</code> или <code>ELECTRON_DISABLE_SECURITY_WARNINGS</code> на любом <code>process.env</code> или объекте <code>window</code>.</p>\n<h2 id=\"чеклист-рекомендации-по-безопасности\"><a href=\"#чеклист-рекомендации-по-безопасности\">Чеклист: рекомендации по безопасности</a></h2>\n<p>You should at least follow these steps to improve the security of your application:</p>\n<ol>\n<li><a href=\"#1-only-load-secure-content\">Загружайте только безопасный контент</a></li>\n<li><a href=\"#2-do-not-enable-nodejs-integration-for-remote-content\">Выключите Node.js интеграцию во всех видах (renderers) показывающих удаленный контент</a></li>\n<li><a href=\"#3-enable-context-isolation-for-remote-content\">Включите контекстную изоляцию для всех видов (renders) с удаленным контентом</a></li>\n<li><a href=\"#4-enable-sandboxing\">Enable sandboxing</a></li>\n<li><a href=\"#5-handle-session-permission-requests-from-remote-content\">Используйте <code>ses.setPermissionRequestHandler()</code> в сессиях с загрузкой удаленного контента</a></li>\n<li><a href=\"#6-do-not-disable-websecurity\">Не выключайте <code>webSecurity</code></a></li>\n<li><a href=\"#7-define-a-content-security-policy\">Определите <code>Content-Security-Policy</code></a> и используйте ограничительные правила (i.e. <code>script-src 'self'</code>)</li>\n<li><a href=\"#8-do-not-set-allowrunninginsecurecontent-to-true\">Не устанавливайте <code>allowRunningInsecureContent</code> в <code>true</code></a></li>\n<li><a href=\"#9-do-not-enable-experimental-features\">Не включайте экспериментальные функции</a></li>\n<li><a href=\"#10-do-not-use-enableblinkfeatures\">Не испольхуйте <code>enableBlinkFeatures</code></a></li>\n<li><a href=\"#11-do-not-use-allowpopups\"><code>&#x3C;webview></code>: Do not use <code>allowpopups</code></a></li>\n<li><a href=\"#12-verify-webview-options-before-creation\"><code>&#x3C;webview></code>: Verify options and params</a></li>\n<li><a href=\"#13-disable-or-limit-navigation\">Disable or limit navigation</a></li>\n<li><a href=\"#14-disable-or-limit-creation-of-new-windows\">Disable or limit creation of new windows</a></li>\n<li><a href=\"#15-do-not-use-openexternal-with-untrusted-content\">Do not use <code>openExternal</code> with untrusted content</a></li>\n<li><a href=\"#16-use-a-current-version-of-electron\">Use a current version of Electron</a></li>\n</ol>\n<p>To automate the detection of misconfigurations and insecure patterns, it is possible to use <a href=\"https://github.com/doyensec/electronegativity\">electronegativity</a>. For additional details on potential weaknesses and implementation bugs when developing applications using Electron, please refer to this <a href=\"https://doyensec.com/resources/us-17-Carettoni-Electronegativity-A-Study-Of-Electron-Security-wp.pdf\">guide for developers and auditors</a></p>\n<h2 id=\"1-загружать-только-безопасный-контент\"><a href=\"#1-загружать-только-безопасный-контент\">1) Загружать только безопасный контент</a></h2>\n<p>Все ресурсы не включенные в ваше приложение должны быть загружены с использованием безопасного протокола <code>HTTPS</code>. Откажитесь от не безопасных протоколов, таких как <code>HTTP</code>. Так же мы рекомендуем <code>WSS</code> over <code>WS</code>, <code>FTPS</code> over <code>FTP</code>, и т. п.</p>\n<h3 id=\"почему\"><a href=\"#почему\">Почему?</a></h3>\n<p><code>HTTPS</code> имеет 3 главных преимущества:</p>\n<p>1) It authenticates the remote server, ensuring your app connects to the correct host instead of an impersonator. 2) It ensures data integrity, asserting that the data was not modified while in transit between your application and the host. 3) Он шифрует трафик между вашим пользователем и хостом назначения, что усложняет перехват информации, отправленную между вашим приложением и хостом.</p>\n<h3 id=\"как\"><a href=\"#как\">Как?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Плохо</span>\nbrowserWindow.loadURL(<span class=\"hljs-string\">'http://example.com'</span>) \n\n<span class=\"hljs-comment\">// Хорошо</span>\nbrowserWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Плохо --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">crossorigin</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://example.com/react.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"http://example.com/style.css\"</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Хорошо --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">crossorigin</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://example.com/react.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"https://example.com/style.css\"</span>></span>\n</code></pre>\n<h2 id=\"2-do-not-enable-nodejs-integration-for-remote-content\"><a href=\"#2-do-not-enable-nodejs-integration-for-remote-content\">2) Do not enable Node.js Integration for Remote Content</a></h2>\n<p><em>This recommendation is the default behavior in Electron since 5.0.0.</em></p>\n<p>It is paramount that you do not enable Node.js integration in any renderer (<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>, <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, or <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>) that loads remote content. The goal is to limit the powers you grant to remote content, thus making it dramatically more difficult for an attacker to harm your users should they gain the ability to execute JavaScript on your website.</p>\n<p>After this, you can grant additional permissions for specific hosts. For example, if you are opening a BrowserWindow pointed at <code>https://example.com/</code>, you can give that website exactly the abilities it needs, but no more.</p>\n<h3 id=\"почему-1\"><a href=\"#почему-1\">Почему?</a></h3>\n<p>A cross-site-scripting (XSS) attack is more dangerous if an attacker can jump out of the renderer process and execute code on the user's computer. Cross-site-scripting attacks are fairly common - and while an issue, their power is usually limited to messing with the website that they are executed on. Disabling Node.js integration helps prevent an XSS from being escalated into a so-called \"Remote Code Execution\" (RCE) attack.</p>\n<h3 id=\"как-1\"><a href=\"#как-1\">Как?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span>,\n    <span class=\"hljs-attr\">nodeIntegrationInWorker</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n\nmainWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">preload</span>: path.join(app.getAppPath(), <span class=\"hljs-string\">'preload.js'</span>)\n  }\n})\n\nmainWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Bad --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">nodeIntegration</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Good --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>При отключении интеграции с Node.js, можно по-прежнему использовать API на вашем сайте, которые используют модули или функции Node.js. Preload scripts continue to have access to <code>require</code> and other Node.js features, allowing developers to expose a custom API to remotely loaded content.</p>\n<p>In the following example preload script, the later loaded website will have access to a <code>window.readConfig()</code> method, but no Node.js features.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { readFileSync } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-built_in\">window</span>.readConfig = <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> data = readFileSync(<span class=\"hljs-string\">'./config.json'</span>)\n  <span class=\"hljs-keyword\">return</span> data\n}\n</code></pre>\n<h2 id=\"3-включите-контекстную-изоляцию-для-удаленного-содержимого\"><a href=\"#3-включите-контекстную-изоляцию-для-удаленного-содержимого\">3) Включите контекстную изоляцию для удаленного содержимого</a></h2>\n<p>Context isolation is an Electron feature that allows developers to run code in preload scripts and in Electron APIs in a dedicated JavaScript context. In practice, that means that global objects like <code>Array.prototype.push</code> or <code>JSON.parse</code> cannot be modified by scripts running in the renderer process.</p>\n<p>Electron uses the same technology as Chromium's <a href=\"https://developer.chrome.com/extensions/content_scripts#execution-environment\">Content Scripts</a> to enable this behavior.</p>\n<p>Even when <code>nodeIntegration: false</code> is used, to truly enforce strong isolation and prevent the use of Node primitives <code>contextIsolation</code> <strong>must</strong> also be used.</p>\n<h3 id=\"why--how\"><a href=\"#why--how\">Why &#x26; How?</a></h3>\n<p>For more information on what <code>contextIsolation</code> is and how to enable it please see our dedicated <a href=\"/docs/tutorial/context-isolation\">Context Isolation</a> document.</p>\n<h2 id=\"4-enable-sandboxing\"><a href=\"#4-enable-sandboxing\">4) Enable Sandboxing</a></h2>\n<p><a href=\"/docs/tutorial/sandbox\">Sandboxing</a> is a Chromium feature that uses the operating system to significantly limit what renderer processes have access to. You should enable the sandbox in all renderers. Loading, reading or processing any untrusted content in an unsandboxed process, including the main process, is not advised.</p>\n<h3 id=\"как-2\"><a href=\"#как-2\">Как?</a></h3>\n<p>When creating a window, pass the <code>sandbox: true</code> option in <code>webPreferences</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">sandbox</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h2 id=\"5-handle-session-permission-requests-from-remote-content\"><a href=\"#5-handle-session-permission-requests-from-remote-content\">5) Handle Session Permission Requests From Remote Content</a></h2>\n<p>You may have seen permission requests while using Chrome: They pop up whenever the website attempts to use a feature that the user has to manually approve ( like notifications).</p>\n<p>The API is based on the <a href=\"https://developer.chrome.com/extensions/permissions\">Chromium permissions API</a> and implements the same types of permissions.</p>\n<h3 id=\"почему-2\"><a href=\"#почему-2\">Почему?</a></h3>\n<p>By default, Electron will automatically approve all permission requests unless the developer has manually configured a custom handler. While a solid default, security-conscious developers might want to assume the very opposite.</p>\n<h3 id=\"как-3\"><a href=\"#как-3\">Как?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession\n  .fromPartition(<span class=\"hljs-string\">'some-partition'</span>)\n  .setPermissionRequestHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, callback</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> url = webContents.getURL()\n\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'notifications'</span>) {\n      <span class=\"hljs-comment\">// Approves the permissions request</span>\n      callback(<span class=\"hljs-literal\">true</span>)\n    }\n\n    <span class=\"hljs-comment\">// Verify URL</span>\n    <span class=\"hljs-keyword\">if</span> (!url.startsWith(<span class=\"hljs-string\">'https://example.com/'</span>)) {\n      <span class=\"hljs-comment\">// Denies the permissions request</span>\n      <span class=\"hljs-keyword\">return</span> callback(<span class=\"hljs-literal\">false</span>)\n    }\n  })\n</code></pre>\n<h2 id=\"6-do-not-disable-websecurity\"><a href=\"#6-do-not-disable-websecurity\">6) Do Not Disable WebSecurity</a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>You may have already guessed that disabling the <code>webSecurity</code> property on a renderer process (<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>, <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, or <a href=\"/docs/api/webview-tag\"><code>&#x26;lt;webview&#x26;gt;</code></a>) disables crucial security features.</p>\n<p>Do not disable <code>webSecurity</code> in production applications.</p>\n<h3 id=\"почему-3\"><a href=\"#почему-3\">Почему?</a></h3>\n<p>Disabling <code>webSecurity</code> will disable the same-origin policy and set <code>allowRunningInsecureContent</code> property to <code>true</code>. In other words, it allows the execution of insecure code from different domains.</p>\n<h3 id=\"как-4\"><a href=\"#как-4\">Как?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">webSecurity</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Bad --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">disablewebsecurity</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Good --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<h2 id=\"7-define-a-content-security-policy\"><a href=\"#7-define-a-content-security-policy\">7) Define a Content Security Policy</a></h2>\n<p>A Content Security Policy (CSP) is an additional layer of protection against cross-site-scripting attacks and data injection attacks. We recommend that they be enabled by any website you load inside Electron.</p>\n<h3 id=\"почему-4\"><a href=\"#почему-4\">Почему?</a></h3>\n<p>CSP allows the server serving content to restrict and control the resources Electron can load for that given web page. <code>https://example.com</code> should be allowed to load scripts from the origins you defined while scripts from <code>https://evil.attacker.com</code> should not be allowed to run. Defining a CSP is an easy way to improve your application's security.</p>\n<p>The following CSP will allow Electron to execute scripts from the current website and from <code>apis.example.com</code>.</p>\n<pre><code class=\"hljs language-plaintext\">// Bad\nContent-Security-Policy: '*'\n\n// Good\nContent-Security-Policy: script-src 'self' https://apis.example.com\n</code></pre>\n<h3 id=\"csp-http-header\"><a href=\"#csp-http-header\">CSP HTTP Header</a></h3>\n<p>Electron respects the <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy\"><code>Content-Security-Policy</code> HTTP header</a> which can be set using Electron's <a href=\"/docs/api/web-request#webrequestonheadersreceivedfilter-listener\"><code>webRequest.onHeadersReceived</code></a> handler:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession.defaultSession.webRequest.onHeadersReceived(<span class=\"hljs-function\">(<span class=\"hljs-params\">details, callback</span>) =></span> {\n  callback({\n    <span class=\"hljs-attr\">responseHeaders</span>: {\n      ...details.responseHeaders,\n      <span class=\"hljs-string\">'Content-Security-Policy'</span>: [<span class=\"hljs-string\">'default-src \\'none\\''</span>]\n    }\n  })\n})\n</code></pre>\n<h3 id=\"csp-meta-tag\"><a href=\"#csp-meta-tag\">CSP Meta Tag</a></h3>\n<p>CSP's preferred delivery mechanism is an HTTP header, however it is not possible to use this method when loading a resource using the <code>file://</code> protocol. It can be useful in some cases, such as using the <code>file://</code> protocol, to set a policy on a page directly in the markup using a <code>&#x26;lt;meta&#x26;gt;</code> tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'none'\"</span>></span>\n</code></pre>\n<h2 id=\"8-do-not-set-allowrunninginsecurecontent-to-true\"><a href=\"#8-do-not-set-allowrunninginsecurecontent-to-true\">8) Do Not Set <code>allowRunningInsecureContent</code> to <code>true</code></a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>By default, Electron will not allow websites loaded over <code>HTTPS</code> to load and execute scripts, CSS, or plugins from insecure sources (<code>HTTP</code>). Setting the property <code>allowRunningInsecureContent</code> to <code>true</code> disables that protection.</p>\n<p>Loading the initial HTML of a website over <code>HTTPS</code> and attempting to load subsequent resources via <code>HTTP</code> is also known as \"mixed content\".</p>\n<h3 id=\"почему-5\"><a href=\"#почему-5\">Почему?</a></h3>\n<p>Loading content over <code>HTTPS</code> assures the authenticity and integrity of the loaded resources while encrypting the traffic itself. See the section on <a href=\"#1-only-load-secure-content\">only displaying secure content</a> for more details.</p>\n<h3 id=\"как-5\"><a href=\"#как-5\">Как?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">allowRunningInsecureContent</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({})\n</code></pre>\n<h2 id=\"9-do-not-enable-experimental-features\"><a href=\"#9-do-not-enable-experimental-features\">9) Do Not Enable Experimental Features</a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>Advanced users of Electron can enable experimental Chromium features using the <code>experimentalFeatures</code> property.</p>\n<h3 id=\"почему-6\"><a href=\"#почему-6\">Почему?</a></h3>\n<p>Experimental features are, as the name suggests, experimental and have not been enabled for all Chromium users. Furthermore, their impact on Electron as a whole has likely not been tested.</p>\n<p>Legitimate use cases exist, but unless you know what you are doing, you should not enable this property.</p>\n<h3 id=\"как-6\"><a href=\"#как-6\">Как?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">experimentalFeatures</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({})\n</code></pre>\n<h2 id=\"10-do-not-use-enableblinkfeatures\"><a href=\"#10-do-not-use-enableblinkfeatures\">10) Do Not Use <code>enableBlinkFeatures</code></a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>Blink is the name of the rendering engine behind Chromium. As with <code>experimentalFeatures</code>, the <code>enableBlinkFeatures</code> property allows developers to enable features that have been disabled by default.</p>\n<h3 id=\"почему-7\"><a href=\"#почему-7\">Почему?</a></h3>\n<p>Generally speaking, there are likely good reasons if a feature was not enabled by default. Legitimate use cases for enabling specific features exist. As a developer, you should know exactly why you need to enable a feature, what the ramifications are, and how it impacts the security of your application. Under no circumstances should you enable features speculatively.</p>\n<h3 id=\"как-7\"><a href=\"#как-7\">Как?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">enableBlinkFeatures</span>: <span class=\"hljs-string\">'ExecCommandInJavaScript'</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n</code></pre>\n<h2 id=\"11-do-not-use-allowpopups\"><a href=\"#11-do-not-use-allowpopups\">11) Do Not Use <code>allowpopups</code></a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>If you are using <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>, you might need the pages and scripts loaded in your <code>&#x3C;webview></code> tag to open new windows. The <code>allowpopups</code> attribute enables them to create new <a href=\"/docs/api/browser-window\"><code>BrowserWindows</code></a> using the <code>window.open()</code> method. <code>&#x3C;webview></code> tags are otherwise not allowed to create new windows.</p>\n<h3 id=\"почему-8\"><a href=\"#почему-8\">Почему?</a></h3>\n<p>If you do not need popups, you are better off not allowing the creation of new <a href=\"/docs/api/browser-window\"><code>BrowserWindows</code></a> by default. This follows the principle of minimally required access: Don't let a website create new popups unless you know it needs that feature.</p>\n<h3 id=\"как-8\"><a href=\"#как-8\">Как?</a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Bad --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">allowpopups</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Good --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<h2 id=\"12-verify-webview-options-before-creation\"><a href=\"#12-verify-webview-options-before-creation\">12) Verify WebView Options Before Creation</a></h2>\n<p>A WebView created in a renderer process that does not have Node.js integration enabled will not be able to enable integration itself. However, a WebView will always create an independent renderer process with its own <code>webPreferences</code>.</p>\n<p>It is a good idea to control the creation of new <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> tags from the main process and to verify that their webPreferences do not disable security features.</p>\n<h3 id=\"почему-9\"><a href=\"#почему-9\">Почему?</a></h3>\n<p>Since <code>&#x3C;webview></code> live in the DOM, they can be created by a script running on your website even if Node.js integration is otherwise disabled.</p>\n<p>Electron enables developers to disable various security features that control a renderer process. In most cases, developers do not need to disable any of those features - and you should therefore not allow different configurations for newly created <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> tags.</p>\n<h3 id=\"как-9\"><a href=\"#как-9\">Как?</a></h3>\n<p>Before a <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> tag is attached, Electron will fire the <code>will-attach-webview</code> event on the hosting <code>webContents</code>. Use the event to prevent the creation of <code>webViews</code> with possibly insecure options.</p>\n<pre><code class=\"hljs language-js\">app.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.on(<span class=\"hljs-string\">'will-attach-webview'</span>, (event, webPreferences, params) => {\n    <span class=\"hljs-comment\">// Strip away preload scripts if unused or verify their location is legitimate</span>\n    <span class=\"hljs-keyword\">delete</span> webPreferences.preload\n    <span class=\"hljs-keyword\">delete</span> webPreferences.preloadURL\n\n    <span class=\"hljs-comment\">// Disable Node.js integration</span>\n    webPreferences.nodeIntegration = <span class=\"hljs-literal\">false</span>\n\n    <span class=\"hljs-comment\">// Verify URL being loaded</span>\n    <span class=\"hljs-keyword\">if</span> (!params.src.startsWith(<span class=\"hljs-string\">'https://example.com/'</span>)) {\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<p>Again, this list merely minimizes the risk, it does not remove it. If your goal is to display a website, a browser will be a more secure option.</p>\n<h2 id=\"13-disable-or-limit-navigation\"><a href=\"#13-disable-or-limit-navigation\">13) Disable or limit navigation</a></h2>\n<p>If your app has no need to navigate or only needs to navigate to known pages, it is a good idea to limit navigation outright to that known scope, disallowing any other kinds of navigation.</p>\n<h3 id=\"почему-10\"><a href=\"#почему-10\">Почему?</a></h3>\n<p>Navigation is a common attack vector. If an attacker can convince your app to navigate away from its current page, they can possibly force your app to open web sites on the Internet. Even if your <code>webContents</code> are configured to be more secure (like having <code>nodeIntegration</code> disabled or <code>contextIsolation</code> enabled), getting your app to open a random web site will make the work of exploiting your app a lot easier.</p>\n<p>A common attack pattern is that the attacker convinces your app's users to interact with the app in such a way that it navigates to one of the attacker's pages. This is usually done via links, plugins, or other user-generated content.</p>\n<h3 id=\"как-10\"><a href=\"#как-10\">Как?</a></h3>\n<p>If your app has no need for navigation, you can call <code>event.preventDefault()</code> in a <a href=\"/docs/api/web-contents#event-will-navigate\"><code>will-navigate</code></a> handler. If you know which pages your app might navigate to, check the URL in the event handler and only let navigation occur if it matches the URLs you're expecting.</p>\n<p>We recommend that you use Node's parser for URLs. Simple string comparisons can sometimes be fooled - a <code>startsWith('https://example.com')</code> test would let <code>https://example.com.attacker.com</code> through.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> URL = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>).URL\n\napp.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.on(<span class=\"hljs-string\">'will-navigate'</span>, (event, navigationUrl) => {\n    <span class=\"hljs-keyword\">const</span> parsedUrl = <span class=\"hljs-keyword\">new</span> URL(navigationUrl)\n\n    <span class=\"hljs-keyword\">if</span> (parsedUrl.origin !== <span class=\"hljs-string\">'https://example.com'</span>) {\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<h2 id=\"14-disable-or-limit-creation-of-new-windows\"><a href=\"#14-disable-or-limit-creation-of-new-windows\">14) Disable or limit creation of new windows</a></h2>\n<p>If you have a known set of windows, it's a good idea to limit the creation of additional windows in your app.</p>\n<h3 id=\"почему-11\"><a href=\"#почему-11\">Почему?</a></h3>\n<p>Much like navigation, the creation of new <code>webContents</code> is a common attack vector. Attackers attempt to convince your app to create new windows, frames, or other renderer processes with more privileges than they had before; or with pages opened that they couldn't open before.</p>\n<p>If you have no need to create windows in addition to the ones you know you'll need to create, disabling the creation buys you a little bit of extra security at no cost. This is commonly the case for apps that open one <code>BrowserWindow</code> and do not need to open an arbitrary number of additional windows at runtime.</p>\n<h3 id=\"как-11\"><a href=\"#как-11\">Как?</a></h3>\n<p><a href=\"/docs/api/web-contents\"><code>webContents</code></a> will delegate to its <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\">window open handler</a> before creating new windows. The handler will receive, amongst other parameters, the <code>url</code> the window was requested to open and the options used to create it. We recommend that you register a handler to monitor the creation of windows, and deny any unexpected window creation.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n    <span class=\"hljs-comment\">// In this example, we'll ask the operating system</span>\n    <span class=\"hljs-comment\">// to open this event's url in the default browser.</span>\n    <span class=\"hljs-comment\">//</span>\n    <span class=\"hljs-comment\">// See the following item for considerations regarding what</span>\n    <span class=\"hljs-comment\">// URLs should be allowed through to shell.openExternal.</span>\n    <span class=\"hljs-keyword\">if</span> (isSafeForExternalOpen(url)) {\n      setImmediate(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n        shell.openExternal(url)\n      })\n    }\n\n    <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n  })\n})\n</code></pre>\n<h2 id=\"15-do-not-use-openexternal-with-untrusted-content\"><a href=\"#15-do-not-use-openexternal-with-untrusted-content\">15) Do not use <code>openExternal</code> with untrusted content</a></h2>\n<p>Shell's <a href=\"/docs/api/shell#shellopenexternalurl-options\"><code>openExternal</code></a> allows opening a given protocol URI with the desktop's native utilities. On macOS, for instance, this function is similar to the <code>open</code> terminal command utility and will open the specific application based on the URI and filetype association.</p>\n<h3 id=\"почему-12\"><a href=\"#почему-12\">Почему?</a></h3>\n<p>Improper use of <a href=\"/docs/api/shell#shellopenexternalurl-options\"><code>openExternal</code></a> can be leveraged to compromise the user's host. When openExternal is used with untrusted content, it can be leveraged to execute arbitrary commands.</p>\n<h3 id=\"как-12\"><a href=\"#как-12\">Как?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">//  Bad</span>\n<span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nshell.openExternal(USER_CONTROLLED_DATA_HERE)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">//  Good</span>\n<span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nshell.openExternal(<span class=\"hljs-string\">'https://example.com/index.html'</span>)\n</code></pre>\n<h2 id=\"16-use-a-current-version-of-electron\"><a href=\"#16-use-a-current-version-of-electron\">16) Use a current version of Electron</a></h2>\n<p>You should strive for always using the latest available version of Electron. Whenever a new major version is released, you should attempt to update your app as quickly as possible.</p>\n<h3 id=\"почему-13\"><a href=\"#почему-13\">Почему?</a></h3>\n<p>An application built with an older version of Electron, Chromium, and Node.js is an easier target than an application that is using more recent versions of those components. Generally speaking, security issues and exploits for older versions of Chromium and Node.js are more widely available.</p>\n<p>Both Chromium and Node.js are impressive feats of engineering built by thousands of talented developers. Given their popularity, their security is carefully tested and analyzed by equally skilled security researchers. Many of those researchers <a href=\"https://en.wikipedia.org/wiki/Responsible_disclosure\">disclose vulnerabilities responsibly</a>, which generally means that researchers will give Chromium and Node.js some time to fix issues before publishing them. Your application will be more secure if it is running a recent version of Electron (and thus, Chromium and Node.js) for which potential security issues are not as widely known.</p>",
      "title": "Безопасность, нативные возможности и ваша ответственность",
      "description": "⚠️  ни при каких обстоятельствах не следует загружать и выполнять удаленный код с Node.js integration enabled. Вместо этого используйте только локальные файлы (упакованные вместе с вашим приложением), для выполнения Node.js кода. To display remote content, use the <webview> tag or BrowserView, make sure to disable the nodeIntegration and enable contextIsolation."
    },
    "/docs/api/structures/segmented-control-segment": {
      "locale": "ru-RU",
      "slug": "segmented-control-segment",
      "href": "/docs/api/structures/segmented-control-segment",
      "crowdinFileId": "256499",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/segmented-control-segment.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"segmentedcontrolsegment-object\"><a href=\"#segmentedcontrolsegment-object\">SegmentedControlSegment Object</a></h1>\n<ul>\n<li><code>label</code> String (optional) - The text to appear in this segment.</li>\n<li><code>icon</code> NativeImage (optional) - The image to appear in this segment.</li>\n<li><code>enabled</code> Boolean (optional) - Whether this segment is selectable. Default: true.</li>\n</ul>",
      "title": "SegmentedControlSegment Object",
      "description": ""
    },
    "/docs/api/structures/serial-port": {
      "locale": "ru-RU",
      "slug": "serial-port",
      "href": "/docs/api/structures/serial-port",
      "crowdinFileId": "256501",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/serial-port.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"serialport-object\"><a href=\"#serialport-object\">SerialPort Object</a></h1>\n<ul>\n<li><code>portId</code> String - Unique identifier for the port.</li>\n<li><code>portName</code> String - Name of the port.</li>\n<li><code>displayName</code> String - A string suitable for display to the user for describing this device.</li>\n<li><code>vendorId</code> String - Optional USB vendor ID.</li>\n<li><code>productId</code> String - Optional USB product ID.</li>\n<li><code>serialNumber</code> String - The USB device serial number.</li>\n<li><code>usbDriverName</code> String (optional) - Represents a single serial port on macOS can be enumerated by multiple drivers.</li>\n<li><code>deviceInstanceId</code> String (optional) - A stable identifier on Windows that can be used for device permissions.</li>\n</ul>",
      "title": "SerialPort Object",
      "description": ""
    },
    "/docs/api/structures/service-worker-info": {
      "locale": "ru-RU",
      "slug": "service-worker-info",
      "href": "/docs/api/structures/service-worker-info",
      "crowdinFileId": "256503",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/service-worker-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"serviceworkerinfo-object\"><a href=\"#serviceworkerinfo-object\">ServiceWorkerInfo Object</a></h1>\n<ul>\n<li><code>scriptUrl</code> String - The full URL to the script that this service worker runs</li>\n<li><code>scope</code> String - The base URL that this service worker is active for.</li>\n<li><code>renderProcessId</code> Number - The virtual ID of the process that this service worker is running in.  This is not an OS level PID.  This aligns with the ID set used for <code>webContents.getProcessId()</code>.</li>\n</ul>",
      "title": "ServiceWorkerInfo Object",
      "description": ""
    },
    "/docs/api/service-workers": {
      "locale": "ru-RU",
      "slug": "service-workers",
      "href": "/docs/api/service-workers",
      "crowdinFileId": "256363",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/service-workers.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-serviceworkers\"><a href=\"#class-serviceworkers\">Class: ServiceWorkers</a></h2>\n<blockquote>\n<p>Query and receive events from a sessions active service workers.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Экземпляры класса <code>ServiceWorkers</code> доступны через свойство <code>serviceWorkers</code> объекта <code>Session</code>.</p>\n<p>Например:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Get all service workers.</span>\n<span class=\"hljs-built_in\">console</span>.log(session.defaultSession.serviceWorkers.getAllRunning())\n\n<span class=\"hljs-comment\">// Handle logs and get service worker info</span>\nsession.defaultSession.serviceWorkers.on(<span class=\"hljs-string\">'console-message'</span>, (event, messageDetails) => {\n  <span class=\"hljs-built_in\">console</span>.log(\n    <span class=\"hljs-string\">'Got service worker message'</span>,\n    messageDetails,\n    <span class=\"hljs-string\">'from'</span>,\n    session.defaultSession.serviceWorkers.getFromVersionID(messageDetails.versionId)\n  )\n})\n</code></pre>\n<h3 id=\"события-экземпляра\"><a href=\"#события-экземпляра\">События экземпляра</a></h3>\n<p>Для экземпляров <code>ServiceWorkers</code> доступны следующие события:</p>\n<h4 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>messageDetails</code> Object - Information about the console message<ul>\n<li><code>message</code> String - The actual console message</li>\n<li><code>versionId</code> Number - The version ID of the service worker that sent the log message</li>\n<li><code>source</code> String - The type of source for this message.  Can be <code>javascript</code>, <code>xml</code>, <code>network</code>, <code>console-api</code>, <code>storage</code>, <code>app-cache</code>, <code>rendering</code>, <code>security</code>, <code>deprecation</code>, <code>worker</code>, <code>violation</code>, <code>intervention</code>, <code>recommendation</code> or <code>other</code>.</li>\n<li><code>level</code> Number - The log level, from 0 to 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>sourceUrl</code> String - The URL the message came from</li>\n<li><code>lineNumber</code> Number - The line number of the source that triggered this console message</li>\n</ul></li>\n</ul>\n<p>Emitted when a service worker logs something to the console.</p>\n<h4 id=\"event-registration-completed\"><a href=\"#event-registration-completed\">Event: 'registration-completed'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>details</code> Object - Information about the registered service worker<ul>\n<li><code>scope</code> String - The base URL that a service worker is registered for</li>\n</ul></li>\n</ul>\n<p>Emitted when a service worker has been registered. Can occur after a call to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\"><code>navigator.serviceWorker.register('/sw.js')</code></a> successfully resolves or when a Chrome extension is loaded.</p>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<p>В экземпляре <code>ServiceWorkers</code> доступны следующие методы:</p>\n<h4 id=\"serviceworkersgetallrunning\"><a href=\"#serviceworkersgetallrunning\"><code>serviceWorkers.getAllRunning()</code></a></h4>\n<p>Returns <code>Record&#x3C;Number, ServiceWorkerInfo></code> - A <a href=\"/docs/api/structures/service-worker-info\">ServiceWorkerInfo</a> object where the keys are the service worker version ID and the values are the information about that service worker.</p>\n<h4 id=\"serviceworkersgetfromversionidversionid\"><a href=\"#serviceworkersgetfromversionidversionid\"><code>serviceWorkers.getFromVersionID(versionId)</code></a></h4>\n<ul>\n<li><code>versionId</code> Number</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/service-worker-info\"><code>ServiceWorkerInfo</code></a> - Information about this service worker</p>\n<p>If the service worker does not exist or is not running this method will throw an exception.</p>",
      "title": "ServiceWorkers",
      "description": "Query and receive events from a sessions active service workers."
    },
    "/docs/api/session": {
      "locale": "ru-RU",
      "slug": "session",
      "href": "/docs/api/session",
      "crowdinFileId": "256365",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/session.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"session\"><a href=\"#session\">session</a></h1>\n<blockquote>\n<p>Session Управление сеансами браузера, куками, кешем, настройками прокси и т. д.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p>Модуль <code>session</code> может быть использован для создания новых объектов <code>Session</code>.</p>\n<p>Вы также можете получить доступ к <code>session</code> существующих страниц, используя свойство <code>session</code> в <a href=\"/docs/api/web-contents\"><code>WebContents</code></a>, или из модуля <code>session</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> ses = win.webContents.session\n<span class=\"hljs-built_in\">console</span>.log(ses.getUserAgent())\n</code></pre>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code>session</code> имеет следующие методы:</p>\n<h3 id=\"sessionfrompartitionpartition-options\"><a href=\"#sessionfrompartitionpartition-options\"><code>session.fromPartition(partition[, options])</code></a></h3>\n<ul>\n<li><code>partition</code> String</li>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>cache</code> Boolean - Включен ли кэш.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Session</code> - Экземпляр сеанса из строки <code>partition</code>. При наличии <code>Session</code> с таким же <code>partition</code>, он будет возвращен; иначе новый экземпляр <code>Session</code> будет создан с <code>options</code>.</p>\n<p>Если <code>partition</code> начинается с <code>persist:</code>, страница будет использовать постоянный сеанс, который доступен всем страницам в приложении с тем же <code>partition</code>. если нет префикса <code>persist:</code>, страница будет использовать сеанс в памяти. Если <code>partition</code> пуст, то будет возвращен сеанс приложения по умолчанию.</p>\n<p>Чтобы создать <code>Session</code> с <code>options</code>, вы должны убедиться, что <code>Session</code> с <code>partition</code> раньше никогда не использовался. Невозможно изменить <code>options</code> из существующего <code>Session</code> объекта.</p>\n<h2 id=\"свойства\"><a href=\"#свойства\">Свойства</a></h2>\n<p>Модуль <code>session</code> имеет следующие свойства:</p>\n<h3 id=\"sessiondefaultsession\"><a href=\"#sessiondefaultsession\"><code>session.defaultSession</code></a></h3>\n<p>Объект <code>Session</code>, объект сеанса по умолчанию для приложения.</p>\n<h2 id=\"класс-session\"><a href=\"#класс-session\">Класс: Session</a></h2>\n<blockquote>\n<p>Получает и устанавливает свойства сеанса.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Вы можете создать объект <code>Session</code> в модуле <code>session</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> ses = session.fromPartition(<span class=\"hljs-string\">'persist:name'</span>)\n<span class=\"hljs-built_in\">console</span>.log(ses.getUserAgent())\n</code></pre>\n<h3 id=\"события-экземпляра\"><a href=\"#события-экземпляра\">События экземпляра</a></h3>\n<p>Для экземпляров <code>Session</code> доступны следующие события:</p>\n<h4 id=\"событие-will-download\"><a href=\"#событие-will-download\">Событие: 'will-download'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>item</code> <a href=\"/docs/api/download-item\">DownloadItem</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Возникает, когда Electron собирается загрузить <code>item</code> в <code>webContents</code>.</p>\n<p>Вызов <code>event.preventDefault()</code> отменит загрузку, и <code>item</code> не будет доступен со следующего тика процесса.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nsession.defaultSession.on(<span class=\"hljs-string\">'will-download'</span>, (event, item, webContents) => {\n  event.preventDefault()\n  <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'got'</span>)(item.getURL()).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">response</span>) =></span> {\n    <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>).writeFileSync(<span class=\"hljs-string\">'/somewhere'</span>, response.body)\n  })\n})\n</code></pre>\n<h4 id=\"event-extension-loaded\"><a href=\"#event-extension-loaded\">Event: 'extension-loaded'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Emitted after an extension is loaded. This occurs whenever an extension is added to the \"enabled\" set of extensions. This includes:</p>\n<ul>\n<li>Extensions being loaded from <code>Session.loadExtension</code>.</li>\n<li>Extensions being reloaded:<ul>\n<li>from a crash.</li>\n<li>if the extension requested it (<a href=\"https://developer.chrome.com/extensions/runtime#method-reload\"><code>chrome.runtime.reload()</code></a>).</li>\n</ul></li>\n</ul>\n<h4 id=\"event-extension-unloaded\"><a href=\"#event-extension-unloaded\">Event: 'extension-unloaded'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Emitted after an extension is unloaded. This occurs when <code>Session.removeExtension</code> is called.</p>\n<h4 id=\"event-extension-ready\"><a href=\"#event-extension-ready\">Event: 'extension-ready'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Emitted after an extension is loaded and all necessary browser state is initialized to support the start of the extension's background page.</p>\n<h4 id=\"event-preconnect\"><a href=\"#event-preconnect\">Event: 'preconnect'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>preconnectUrl</code> String - URL-адрес, запрашиваемый рендерером для предварительного подключения.</li>\n<li><code>allowCredentials</code> Boolean - True если рендерер запрашивает, чтобы соединение включало учетные данные (см. <a href=\"https://w3c.github.io/resource-hints/#preconnect\">spec</a> для получения более подробной информации.)</li>\n</ul>\n<p>Возникает, когда в процессе рендеринга запрашивается предварительное подключение к URL, как правило, из-за <a href=\"https://w3c.github.io/resource-hints/\">подсказки ресурса</a>.</p>\n<h4 id=\"event-spellcheck-dictionary-initialized\"><a href=\"#event-spellcheck-dictionary-initialized\">Event: 'spellcheck-dictionary-initialized'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file has been successfully initialized. This occurs after the file has been downloaded.</p>\n<h4 id=\"event-spellcheck-dictionary-download-begin\"><a href=\"#event-spellcheck-dictionary-download-begin\">Event: 'spellcheck-dictionary-download-begin'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file starts downloading</p>\n<h4 id=\"event-spellcheck-dictionary-download-success\"><a href=\"#event-spellcheck-dictionary-download-success\">Event: 'spellcheck-dictionary-download-success'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file has been successfully downloaded</p>\n<h4 id=\"event-spellcheck-dictionary-download-failure\"><a href=\"#event-spellcheck-dictionary-download-failure\">Event: 'spellcheck-dictionary-download-failure'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file download fails.  For details on the failure you should collect a netlog and inspect the download request.</p>\n<h4 id=\"event-select-hid-device\"><a href=\"#event-select-hid-device\">Event: 'select-hid-device'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li>Объект <code>details</code><ul>\n<li><code>deviceList</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>deviceId</code> String | null (optional)</li>\n</ul></li>\n</ul>\n<p>Emitted when a HID device needs to be selected when a call to <code>navigator.hid.requestDevice</code> is made. <code>callback</code> should be called with <code>deviceId</code> to be selected; passing no arguments to <code>callback</code> will cancel the request.  Additionally, permissioning on <code>navigator.hid</code> can be further managed by using <a href=\"#sessetpermissioncheckhandlerhandler\">ses.setPermissionCheckHandler(handler)</a> and <a href=\"#sessetdevicepermissionhandlerhandler\">ses.setDevicePermissionHandler(handler)`</a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.webContents.session.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin, details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-comment\">// Add logic here to determine if permission should be given to allow HID selection</span>\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  <span class=\"hljs-comment\">// Optionally, retrieve previously persisted devices from a persistent store</span>\n  <span class=\"hljs-keyword\">const</span> grantedDevices = fetchGrantedDevices()\n\n  win.webContents.session.setDevicePermissionHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(details.origin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; details.deviceType === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-keyword\">if</span> (details.device.vendorId === <span class=\"hljs-number\">123</span> &#x26;&#x26; details.device.productId === <span class=\"hljs-number\">345</span>) {\n        <span class=\"hljs-comment\">// Always allow this type of device (this allows skipping the call to `navigator.hid.requestDevice` first)</span>\n        <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n      }\n\n      <span class=\"hljs-comment\">// Search through the list of devices that have previously been granted permission</span>\n      <span class=\"hljs-keyword\">return</span> grantedDevices.some(<span class=\"hljs-function\">(<span class=\"hljs-params\">grantedDevice</span>) =></span> {\n        <span class=\"hljs-keyword\">return</span> grantedDevice.vendorId === details.device.vendorId &#x26;&#x26;\n              grantedDevice.productId === details.device.productId &#x26;&#x26;\n              grantedDevice.serialNumber &#x26;&#x26; grantedDevice.serialNumber === details.device.serialNumber\n      })\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  win.webContents.session.on(<span class=\"hljs-string\">'select-hid-device'</span>, (event, details, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedDevice = details.deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    callback(selectedPort?.deviceId)\n  })\n})\n</code></pre>\n<h4 id=\"event-hid-device-added\"><a href=\"#event-hid-device-added\">Event: 'hid-device-added'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li>Объект <code>details</code><ul>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n</ul>\n<p>Emitted when a new HID device becomes available. For example, when a new USB device is plugged in.</p>\n<p>This event will only be emitted after <code>navigator.hid.requestDevice</code> has been called and <code>select-hid-device</code> has fired.</p>\n<h4 id=\"event-hid-device-removed\"><a href=\"#event-hid-device-removed\">Event: 'hid-device-removed'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li>Объект <code>details</code><ul>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n</ul>\n<p>Emitted when a HID device has been removed.  For example, this event will fire when a USB device is unplugged.</p>\n<p>This event will only be emitted after <code>navigator.hid.requestDevice</code> has been called and <code>select-hid-device</code> has fired.</p>\n<h4 id=\"event-select-serial-port\"><a href=\"#event-select-serial-port\">Event: 'select-serial-port'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>portList</code> <a href=\"/docs/api/structures/serial-port\">SerialPort[]</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>callback</code> Function<ul>\n<li>Строка <code>portId</code></li>\n</ul></li>\n</ul>\n<p>Emitted when a serial port needs to be selected when a call to <code>navigator.serial.requestPort</code> is made. <code>callback</code> should be called with <code>portId</code> to be selected, passing an empty string to <code>callback</code> will cancel the request.  Additionally, permissioning on <code>navigator.serial</code> can be managed by using <a href=\"#sessetpermissioncheckhandlerhandler\">ses.setPermissionCheckHandler(handler)</a> with the <code>serial</code> permission.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n  win.webContents.session.on(<span class=\"hljs-string\">'select-serial-port'</span>, (event, portList, webContents, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedPort = portList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    <span class=\"hljs-keyword\">if</span> (!selectedPort) {\n      callback(<span class=\"hljs-string\">''</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      callback(selectedPort.portId)\n    }\n  })\n})\n</code></pre>\n<h4 id=\"event-serial-port-added\"><a href=\"#event-serial-port-added\">Event: 'serial-port-added'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>port</code> <a href=\"/docs/api/structures/serial-port\">SerialPort</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitted after <code>navigator.serial.requestPort</code> has been called and <code>select-serial-port</code> has fired if a new serial port becomes available.  For example, this event will fire when a new USB device is plugged in.</p>\n<h4 id=\"event-serial-port-removed\"><a href=\"#event-serial-port-removed\">Event: 'serial-port-removed'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>port</code> <a href=\"/docs/api/structures/serial-port\">SerialPort</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitted after <code>navigator.serial.requestPort</code> has been called and <code>select-serial-port</code> has fired if a serial port has been removed.  For example, this event will fire when a USB device is unplugged.</p>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<p>Для экземпляров <code>Session</code> доступны следующие методы:</p>\n<h4 id=\"sesgetcachesize\"><a href=\"#sesgetcachesize\"><code>ses.getCacheSize()</code></a></h4>\n<p>Возвращает <code>Promise&#x3C;Integer></code> - текущий размер кэша сеанса, в байтах.</p>\n<h4 id=\"sesclearcache\"><a href=\"#sesclearcache\"><code>ses.clearCache()</code></a></h4>\n<p>Возвращает <code>Promise&#x3C;void></code> - Разрешение после завершения операции очистки кэша.</p>\n<p>Очищает HTTP-кэш сеанса.</p>\n<h4 id=\"sesclearstoragedataoptions\"><a href=\"#sesclearstoragedataoptions\"><code>ses.clearStorageData([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>origin</code> String (опционально) - Должен следовать представлению <code>window.location.origin</code> <code>scheme://host:port</code>.</li>\n<li><code>storages</code> String<a href=\"/docs/api/%D0%BE%D0%BF%D1%86%D0%B8%D0%BE%D0%BD%D0%B0%D0%BB%D1%8C%D0%BD%D0%BE\"></a> - типы хранилищ для очистки, могут содержать: <code>appcache</code>, <code>cookies</code>, <code>filesystem</code>, <code>indexdb</code>, <code>localstorage</code>, <code>shadercache</code>, <code>websql</code>, <code>serviceworkers</code>, <code>cachestorage</code>. If not specified, clear all storage types.</li>\n<li><code>quotas</code> String<a href=\"/docs/api/%D0%BE%D0%BF%D1%86%D0%B8%D0%BE%D0%BD%D0%B0%D0%BB%D1%8C%D0%BD%D0%BE\"></a> - типы квот для очистки, могут содержать: <code>temporary</code>, <code>persistent</code>, <code>syncable</code>. If not specified, clear all quotas.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code> - Разрешение после завершения очистки данных хранилища.</p>\n<h4 id=\"sesflushstoragedata\"><a href=\"#sesflushstoragedata\"><code>ses.flushStorageData()</code></a></h4>\n<p>Записывает непрочитанные DOMStorage данные на диск.</p>\n<h4 id=\"sessetproxyconfig\"><a href=\"#sessetproxyconfig\"><code>ses.setProxy(config)</code></a></h4>\n<ul>\n<li><code>config</code> Object<ul>\n<li><code>mode</code> String (optional) - The proxy mode. Should be one of <code>direct</code>, <code>auto_detect</code>, <code>pac_script</code>, <code>fixed_servers</code> or <code>system</code>. If it's unspecified, it will be automatically determined based on other specified options.<ul>\n<li><code>direct</code> In direct mode all connections are created directly, without any proxy involved.</li>\n<li><code>auto_detect</code> In auto_detect mode the proxy configuration is determined by a PAC script that can be downloaded at <a href=\"http://wpad/wpad.dat\">http://wpad/wpad.dat</a>.</li>\n<li><code>pac_script</code> In pac_script mode the proxy configuration is determined by a PAC script that is retrieved from the URL specified in the <code>pacScript</code>. This is the default mode if <code>pacScript</code> is specified.</li>\n<li><code>fixed_servers</code> In fixed_servers mode the proxy configuration is specified in <code>proxyRules</code>. This is the default mode if <code>proxyRules</code> is specified.</li>\n<li><code>system</code> In system mode the proxy configuration is taken from the operating system. Note that the system mode is different from setting no proxy configuration. In the latter case, Electron falls back to the system settings only if no command-line options influence the proxy configuration.</li>\n</ul></li>\n<li><code>pacScript</code> String (optional) - The URL associated with the PAC file.</li>\n<li><code>proxyRules</code> String (optional) - Rules indicating which proxies to use.</li>\n<li><code>proxyBypassRules</code> String (optional) - Rules indicating which URLs should bypass the proxy settings.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code> - Разрешение после завершения процесса настройки прокси.</p>\n<p>Установка настроек прокси.</p>\n<p>When <code>mode</code> is unspecified, <code>pacScript</code> and <code>proxyRules</code> are provided together, the <code>proxyRules</code> option is ignored and <code>pacScript</code> configuration is applied.</p>\n<p>You may need <code>ses.closeAllConnections</code> to close currently in flight connections to prevent pooled sockets using previous proxy from being reused by future requests.</p>\n<p><code>proxyRules</code> должен следовать следующим правилам:</p>\n<pre><code class=\"hljs language-sh\">proxyRules = schemeProxies[<span class=\"hljs-string\">\";\"</span>&#x3C;;0>]\nschemeProxies = [&#x3C;;1><span class=\"hljs-string\">\"=\"</span>]&#x3C;;2>\nurlScheme = <span class=\"hljs-string\">\"http\"</span> | <span class=\"hljs-string\">\"https\"</span> | <span class=\"hljs-string\">\"ftp\"</span> | <span class=\"hljs-string\">\"socks\"</span>\nproxyURIList = &#x3C;;3>[<span class=\"hljs-string\">\",\"</span>&#x3C;;2>]\nproxyURL = [&#x3C;;4><span class=\"hljs-string\">\"://\"</span>]&#x3C;;5>[<span class=\"hljs-string\">\":\"</span>&#x3C;;6>]\n</code></pre>\n<p>Например:</p>\n<ul>\n<li><code>http=foopy:80;ftp=foopy2</code> - Использовать HTTP прокси <code>foopy:80</code> для URL <code>http://</code>, и HTTP прокси <code>foopy2:80</code> для URL <code>ftp://</code>.</li>\n<li><code>foopy:80</code> - Использовать HTTP прокси <code>foopy:80</code> для всех URL.</li>\n<li><code>foopy:80,bar,direct://</code> - Использовать HTTP прокси <code>foopy:80</code> для всех URL-адресов, переключение на <code>bar</code>, если <code>foopy:80</code> недоступен, и после этого прокси не использовать.</li>\n<li><code>socks4://foopy</code> - Использовать SOCKS v4 прокси <code>foopy:1080</code> для всех URL.</li>\n<li><code>http=foopy,socks5://bar.com</code> - Использовать HTTP прокси <code>foopy</code> для http URL-адресов и и переключиться на прокси SOCKS5 <code>bar.com</code>, если <code>foopy</code> недоступен.</li>\n<li><code>http=foopy,direct://</code> - Использовать HTTP прокси <code>foopy</code> для http URL-адресов и не использовать прокси, если <code>foopy</code> недоступен.</li>\n<li><code>http=foopy;socks=foopy2</code> - Использовать HTTP прокси <code>foopy</code> для http URL-адресов и использовать <code>socks4://foopy2</code> для всех других URL.</li>\n</ul>\n<p><code>proxyBypassRules</code> - это список правил, разделенных запятыми:</p>\n<ul>\n<li>\n<p><code>[ URL_SCHEME \"://\" ] HOSTNAME_PATTERN [ \":\" &#x3C;;0> ]</code></p>\n<p> Сопоставьте все имена хостов, которые соответствуют шаблону HOSTNAME_PATTERN.</p>\n<p> Examples: \"foobar.com\", \"<em>foobar.com\", \"</em>.foobar.com\", \"<em>foobar.com:99\", \"<a href=\"https://x\">https://x</a>.</em>.y.com:99\"</p>\n</li>\n<li>\n<p><code>\".\" HOSTNAME_SUFFIX_PATTERN [ \":\" PORT ]</code></p>\n<p> Соответствует суффиксу конкретного домена.</p>\n<p> Examples: \".google.com\", \".com\", \"<a href=\"http://.google.com\">http://.google.com</a>\"</p>\n</li>\n<li>\n<p><code>[ SCHEME \"://\" ] IP_LITERAL [ \":\" PORT ]</code></p>\n<p> Сравнивать URL, которые являются знаками IP-адресов.</p>\n<p> Например: \"127.0.1\", \"[0:0::1]\", \"[::1]\", \"<a href=\"http://%5B::1%5D:99\">http://[::1]:99</a>\"</p>\n</li>\n<li>\n<p><code>IP_LITERAL \"/\" PREFIX_LENGTH_IN_BITS</code></p>\n<p> Match any URL that is to an IP literal that falls between the given range. IP range is specified using CIDR notation.</p>\n<p> Например: \"192.168.1.1/16\", \"fefe:13::abc/33\".</p>\n</li>\n<li>\n<p><code>&#x3C;local></code></p>\n<p> Match local addresses. The meaning of <code>&#x3C;local></code> is whether the host matches one of: \"127.0.0.1\", \"::1\", \"localhost\".</p>\n</li>\n</ul>\n<h4 id=\"sesresolveproxyurl\"><a href=\"#sesresolveproxyurl\"><code>ses.resolveProxy(url)</code></a></h4>\n<ul>\n<li><code>url</code> URL</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;String></code> - Разрешение с информацией прокси для <code>url</code>.</p>\n<h4 id=\"sesforcereloadproxyconfig\"><a href=\"#sesforcereloadproxyconfig\"><code>ses.forceReloadProxyConfig()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the all internal states of proxy service is reset and the latest proxy configuration is reapplied if it's already available. The pac script will be fetched from <code>pacScript</code> again if the proxy mode is <code>pac_script</code>.</p>\n<h4 id=\"sessetdownloadpathpath\"><a href=\"#sessetdownloadpathpath\"><code>ses.setDownloadPath(path)</code></a></h4>\n<ul>\n<li><code>path</code> String - Место загрузки.</li>\n</ul>\n<p>Sets download saving directory. By default, the download directory will be the <code>Downloads</code> under the respective app folder.</p>\n<h4 id=\"sesenablenetworkemulationoptions\"><a href=\"#sesenablenetworkemulationoptions\"><code>ses.enableNetworkEmulation(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>offline</code> Boolean (optional) - Whether to emulate network outage. Defaults to false.</li>\n<li><code>latency</code> Double (optional) - RTT in ms. Defaults to 0 which will disable latency throttling.</li>\n<li><code>downloadThroughput</code> Double (optional) - Download rate in Bps. Defaults to 0 which will disable download throttling.</li>\n<li><code>uploadThroughput</code> Double (optional) - Upload rate in Bps. Defaults to 0 which will disable upload throttling.</li>\n</ul></li>\n</ul>\n<p>Эмулирует сеть с заданной конфигурацией для <code>session</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Для эмулирования GPRS соединения с пропускной способностью 50кбит/с и задержкой 500 мс.</span>\n<span class=\"hljs-built_in\">window</span>.webContents.session.enableNetworkEmulation({\n  <span class=\"hljs-attr\">latency</span>: <span class=\"hljs-number\">500</span>,\n  <span class=\"hljs-attr\">downloadThroughput</span>: <span class=\"hljs-number\">6400</span>,\n  <span class=\"hljs-attr\">uploadThroughput</span>: <span class=\"hljs-number\">6400</span>\n})\n\n<span class=\"hljs-comment\">// Для эмулирования отключения или отказа сети.</span>\n<span class=\"hljs-built_in\">window</span>.webContents.session.enableNetworkEmulation({ <span class=\"hljs-attr\">offline</span>: <span class=\"hljs-literal\">true</span> })\n</code></pre>\n<h4 id=\"sespreconnectoptions\"><a href=\"#sespreconnectoptions\"><code>ses.preconnect(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>url</code> String - URL for preconnect. Only the origin is relevant for opening the socket.</li>\n<li><code>numSockets</code> Number (optional) - number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.</li>\n</ul></li>\n</ul>\n<p>Preconnects the given number of sockets to an origin.</p>\n<h4 id=\"sescloseallconnections\"><a href=\"#sescloseallconnections\"><code>ses.closeAllConnections()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when all connections are closed.</p>\n<p><strong>Note:</strong> It will terminate / fail all requests currently in flight.</p>\n<h4 id=\"sesdisablenetworkemulation\"><a href=\"#sesdisablenetworkemulation\"><code>ses.disableNetworkEmulation()</code></a></h4>\n<p>Disables any network emulation already active for the <code>session</code>. Resets to the original network configuration.</p>\n<h4 id=\"sessetcertificateverifyprocproc\"><a href=\"#sessetcertificateverifyprocproc\"><code>ses.setCertificateVerifyProc(proc)</code></a></h4>\n<ul>\n<li><code>proc</code> Function | null<ul>\n<li><code>request</code> Object<ul>\n<li><code>hostname</code> String</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>validatedCertificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>verificationResult</code> String - Результат проверки из хрома.</li>\n<li><code>errorCode</code> Integer - Код ошибки.</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>verificationResult</code> Integer - Value can be one of certificate error codes from <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">here</a>. Apart from the certificate error codes, the following special codes can be used.<ul>\n<li><code>0</code> - Указывает на успех и отключает проверку прозрачности сертификата.</li>\n<li><code>-2</code> - указывает на сбой.</li>\n<li><code>-3</code> - Использует результат проверки из хрома.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Устанавливает значение проверки сертификата для <code>session</code>, <code>proc</code> будет вызываться с <code>proc(request, callback)</code> всякий раз, когда запрашивается сертификат сервера. Вызов <code>callback(0)</code> принимает сертификат, вызов <code>callback(-2)</code> отклоняет его.</p>\n<p>Вызов <code>setCertificateVerifyProc (null)</code> приведет к возврату к процедуре проверки сертификата по умолчанию.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.webContents.session.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">request, callback</span>) =></span> {\n  <span class=\"hljs-keyword\">const</span> { hostname } = request\n  <span class=\"hljs-keyword\">if</span> (hostname === <span class=\"hljs-string\">'github.com'</span>) {\n    callback(<span class=\"hljs-number\">0</span>)\n  } <span class=\"hljs-keyword\">else</span> {\n    callback(<span class=\"hljs-number\">-2</span>)\n  }\n})\n</code></pre>\n<blockquote>\n<p><strong>NOTE:</strong> The result of this procedure is cached by the network service.</p>\n</blockquote>\n<h4 id=\"sessetpermissionrequesthandlerhandler\"><a href=\"#sessetpermissionrequesthandlerhandler\"><code>ses.setPermissionRequestHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Function | null<ul>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a> - WebContents requesting the permission.  Please note that if the request comes from a subframe you should use <code>requestingUrl</code> to check the request origin.</li>\n<li><code>permission</code> String - The type of requested permission.<ul>\n<li><code>clipboard-read</code> - Request access to read from the clipboard.</li>\n<li><code>media</code> -  Request access to media devices such as camera, microphone and speakers.</li>\n<li><code>display-capture</code> - Request access to capture the screen.</li>\n<li><code>mediaKeySystem</code> - Request access to DRM protected content.</li>\n<li><code>geolocation</code> - Request access to user's current location.</li>\n<li><code>notifications</code> - Request notification creation and the ability to display them in the user's system tray.</li>\n<li><code>midi</code> - Request MIDI access in the <code>webmidi</code> API.</li>\n<li><code>midiSysex</code> - Request the use of system exclusive messages in the <code>webmidi</code> API.</li>\n<li><code>pointerLock</code> - Request to directly interpret mouse movements as an input method. Click <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API\">here</a> to know more.</li>\n<li><code>fullscreen</code> - Request for the app to enter fullscreen mode.</li>\n<li><code>openExternal</code> - Request to open links in external applications.</li>\n<li><code>unknown</code> - An unrecognized permission request</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>permissionGranted</code> Boolean - Allow or deny the permission.</li>\n</ul></li>\n<li><code>details</code> Object - Some properties are only available on certain permission types.<ul>\n<li><code>externalURL</code> String (optional) - The url of the <code>openExternal</code> request.</li>\n<li><code>mediaTypes</code> String<a href=\"/docs/api/optional\"></a> - The types of media access being requested, elements can be <code>video</code> or <code>audio</code></li>\n<li><code>requestingUrl</code> String - The last URL the requesting frame loaded</li>\n<li><code>isMainFrame</code> Boolean - Whether the frame making the request is the main frame</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Sets the handler which can be used to respond to permission requests for the <code>session</code>. Calling <code>callback(true)</code> will allow the permission and <code>callback(false)</code> will reject it. To clear the handler, call <code>setPermissionRequestHandler(null)</code>.  Please note that you must also implement <code>setPermissionCheckHandler</code> to get complete permission handling. Most web APIs do a permission check and then make a permission request if the check is denied.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nsession.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).setPermissionRequestHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, callback</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (webContents.getURL() === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notifications'</span>) {\n    <span class=\"hljs-keyword\">return</span> callback(<span class=\"hljs-literal\">false</span>) <span class=\"hljs-comment\">// denied.</span>\n  }\n\n  callback(<span class=\"hljs-literal\">true</span>)\n})\n</code></pre>\n<h4 id=\"sessetpermissioncheckhandlerhandler\"><a href=\"#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Function\\<boolean> | null<ul>\n<li><code>webContents</code> (<a href=\"/docs/api/web-contents\">WebContents</a> | null) - WebContents checking the permission.  Please note that if the request comes from a subframe you should use <code>requestingUrl</code> to check the request origin.  Все перекрёстные подкадры, делающие проверку прав доступа, передадут этому обработчику <code>null</code> webContents, в то время как другие проверку прав доступа, такие как <code>notifications</code>, после проверки всегда будут передавать <code>null</code>.  You should use <code>embeddingOrigin</code> and <code>requestingOrigin</code> to determine what origin the owning frame and the requesting frame are on respectively.</li>\n<li><code>permission</code> String - Type of permission check.  Valid values are <code>midiSysex</code>, <code>notifications</code>, <code>geolocation</code>, <code>media</code>,<code>mediaKeySystem</code>,<code>midi</code>, <code>pointerLock</code>, <code>fullscreen</code>, <code>openExternal</code>, <code>hid</code>, or <code>serial</code>.</li>\n<li><code>requestingOrigin</code> String - The origin URL of the permission check</li>\n<li><code>details</code> Object - Some properties are only available on certain permission types.<ul>\n<li><code>embeddingOrigin</code> String (optional) - The origin of the frame embedding the frame that made the permission check.  Only set for cross-origin sub frames making permission checks.</li>\n<li><code>securityOrigin</code> String (optional) - The security origin of the <code>media</code> check.</li>\n<li><code>mediaType</code> String (optional) - The type of media access being requested, can be <code>video</code>, <code>audio</code> or <code>unknown</code></li>\n<li><code>requestingUrl</code> String (optional) - The last URL the requesting frame loaded.  This is not provided for cross-origin sub frames making permission checks.</li>\n<li><code>isMainFrame</code> Boolean - Whether the frame making the request is the main frame</li>\n</ul></li>\n</ul></boolean></li>\n</ul>\n<p>Sets the handler which can be used to respond to permission checks for the <code>session</code>. Returning <code>true</code> will allow the permission and <code>false</code> will reject it.  Please note that you must also implement <code>setPermissionRequestHandler</code> to get complete permission handling. Most web APIs do a permission check and then make a permission request if the check is denied. To clear the handler, call <code>setPermissionCheckHandler(null)</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>)\nsession.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(requestingOrigin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notifications'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span> <span class=\"hljs-comment\">// granted</span>\n  }\n\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span> <span class=\"hljs-comment\">// denied</span>\n})\n</code></pre>\n<h4 id=\"sessetdevicepermissionhandlerhandler\"><a href=\"#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Function\\<boolean> | null<ul>\n<li>Объект <code>details</code><ul>\n<li><code>deviceType</code> String - The type of device that permission is being requested on, can be <code>hid</code>.</li>\n<li><code>origin</code> String - The origin URL of the device permission check.</li>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice</a> - the device that permission is being requested for.</li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a> - WebFrameMain checking the device permission.</li>\n</ul></li>\n</ul></boolean></li>\n</ul>\n<p>Sets the handler which can be used to respond to device permission checks for the <code>session</code>. Returning <code>true</code> will allow the device to be permitted and <code>false</code> will reject it. To clear the handler, call <code>setDevicePermissionHandler(null)</code>. This handler can be used to provide default permissioning to devices without first calling for permission to devices (eg via <code>navigator.hid.requestDevice</code>).  If this handler is not defined, the default device permissions as granted through device selection (eg via <code>navigator.hid.requestDevice</code>) will be used. Additionally, the default behavior of Electron is to store granted device permision through the lifetime of the corresponding WebContents.  If longer term storage is needed, a developer can store granted device permissions (eg when handling the <code>select-hid-device</code> event) and then read from that storage with <code>setDevicePermissionHandler</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.webContents.session.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin, details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-comment\">// Add logic here to determine if permission should be given to allow HID selection</span>\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  <span class=\"hljs-comment\">// Optionally, retrieve previously persisted devices from a persistent store</span>\n  <span class=\"hljs-keyword\">const</span> grantedDevices = fetchGrantedDevices()\n\n  win.webContents.session.setDevicePermissionHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(details.origin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; details.deviceType === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-keyword\">if</span> (details.device.vendorId === <span class=\"hljs-number\">123</span> &#x26;&#x26; details.device.productId === <span class=\"hljs-number\">345</span>) {\n        <span class=\"hljs-comment\">// Always allow this type of device (this allows skipping the call to `navigator.hid.requestDevice` first)</span>\n        <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n      }\n\n      <span class=\"hljs-comment\">// Search through the list of devices that have previously been granted permission</span>\n      <span class=\"hljs-keyword\">return</span> grantedDevices.some(<span class=\"hljs-function\">(<span class=\"hljs-params\">grantedDevice</span>) =></span> {\n        <span class=\"hljs-keyword\">return</span> grantedDevice.vendorId === details.device.vendorId &#x26;&#x26;\n              grantedDevice.productId === details.device.productId &#x26;&#x26;\n              grantedDevice.serialNumber &#x26;&#x26; grantedDevice.serialNumber === details.device.serialNumber\n      })\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  win.webContents.session.on(<span class=\"hljs-string\">'select-hid-device'</span>, (event, details, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedDevice = details.deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    callback(selectedPort?.deviceId)\n  })\n})\n</code></pre>\n<h4 id=\"sesclearhostresolvercache\"><a href=\"#sesclearhostresolvercache\"><code>ses.clearHostResolverCache()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the operation is complete.</p>\n<p>Clears the host resolver cache.</p>\n<h4 id=\"sesallowntlmcredentialsfordomainsdomains\"><a href=\"#sesallowntlmcredentialsfordomainsdomains\"><code>ses.allowNTLMCredentialsForDomains(domains)</code></a></h4>\n<ul>\n<li><code>domains</code> String - A comma-separated list of servers for which integrated authentication is enabled.</li>\n</ul>\n<p>Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate authentication.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">// consider any url ending with `example.com`, `foobar.com`, `baz`</span>\n<span class=\"hljs-comment\">// for integrated authentication.</span>\nsession.defaultSession.allowNTLMCredentialsForDomains(<span class=\"hljs-string\">'*example.com, *foobar.com, *baz'</span>)\n\n<span class=\"hljs-comment\">// consider all urls for integrated authentication.</span>\nsession.defaultSession.allowNTLMCredentialsForDomains(<span class=\"hljs-string\">'*'</span>)\n</code></pre>\n<h4 id=\"sessetuseragentuseragent-acceptlanguages\"><a href=\"#sessetuseragentuseragent-acceptlanguages\"><code>ses.setUserAgent(userAgent[, acceptLanguages])</code></a></h4>\n<ul>\n<li><code>userAgent</code> String</li>\n<li><code>acceptLanguages</code> String (опционально)</li>\n</ul>\n<p>Overrides the <code>userAgent</code> and <code>acceptLanguages</code> for this session.</p>\n<p>The <code>acceptLanguages</code> must a comma separated ordered list of language codes, for example <code>\"en-US,fr,de,ko,zh-CN,ja\"</code>.</p>\n<p>This doesn't affect existing <code>WebContents</code>, and each <code>WebContents</code> can use <code>webContents.setUserAgent</code> to override the session-wide user agent.</p>\n<h4 id=\"sesispersistent\"><a href=\"#sesispersistent\"><code>ses.isPersistent()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether or not this session is a persistent one. The default <code>webContents</code> session of a <code>BrowserWindow</code> is persistent. When creating a session from a partition, session prefixed with <code>persist:</code> will be persistent, while others will be temporary.</p>\n<h4 id=\"sesgetuseragent\"><a href=\"#sesgetuseragent\"><code>ses.getUserAgent()</code></a></h4>\n<p>Returns <code>String</code> - The user agent for this session.</p>\n<h4 id=\"sessetsslconfigconfig\"><a href=\"#sessetsslconfigconfig\"><code>ses.setSSLConfig(config)</code></a></h4>\n<ul>\n<li><code>config</code> Object<ul>\n<li><code>minVersion</code> String (опционально) - Может быть <code>tls1</code>, <code>tls1.1</code>, <code>tls1.2</code> или <code>tls1.3</code>. The minimum SSL version to allow when connecting to remote servers. Значение по умолчанию: <code>tls1</code>.</li>\n<li><code>maxVersion</code> String (опционально) - Может быть <code>tls1.2</code> или <code>tls1.3</code>. The maximum SSL version to allow when connecting to remote servers. Defaults to <code>tls1.3</code>.</li>\n<li><code>disabledCipherSuites</code> Integer<a href=\"/docs/api/optional\"></a> - List of cipher suites which should be explicitly prevented from being used in addition to those disabled by the net built-in policy. Supported literal forms: 0xAABB, where AA is <code>cipher_suite[0]</code> and BB is <code>cipher_suite[1]</code>, as defined in RFC 2246, Section 7.4.1.2. Unrecognized but parsable cipher suites in this form will not return an error. Ex: To disable TLS_RSA_WITH_RC4_128_MD5, specify 0x0004, while to disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002. Note that TLSv1.3 ciphers cannot be disabled using this mechanism.</li>\n</ul></li>\n</ul>\n<p>Sets the SSL configuration for the session. All subsequent network requests will use the new configuration. Existing network connections (such as WebSocket connections) will not be terminated, but old sockets in the pool will not be reused for new connections.</p>\n<h4 id=\"sesgetblobdataidentifier\"><a href=\"#sesgetblobdataidentifier\"><code>ses.getBlobData(identifier)</code></a></h4>\n<ul>\n<li><code>identifier</code> String - Valid UUID.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Buffer></code> - resolves with blob data.</p>\n<h4 id=\"sesdownloadurlurl\"><a href=\"#sesdownloadurlurl\"><code>ses.downloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code>. The API will generate a <a href=\"/docs/api/download-item\">DownloadItem</a> that can be accessed with the <a href=\"#event-will-download\">will-download</a> event.</p>\n<p><strong>Note:</strong> This does not perform any security checks that relate to a page's origin, unlike <a href=\"/docs/api/web-contents#contentsdownloadurlurl\"><code>webContents.downloadURL</code></a>.</p>\n<h4 id=\"sescreateinterrupteddownloadoptions\"><a href=\"#sescreateinterrupteddownloadoptions\"><code>ses.createInterruptedDownload(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>path</code> String - Absolute path of the download.</li>\n<li><code>urlChain</code> String[] - Complete URL chain for the download.</li>\n<li><code>mimeType</code> String (опционально)</li>\n<li><code>offset</code> Integer - Start range for the download.</li>\n<li><code>length</code> Integer - Total length of the download.</li>\n<li><code>lastModified</code> String (optional) - Last-Modified header value.</li>\n<li><code>eTag</code> String (optional) - ETag header value.</li>\n<li><code>startTime</code> Double (optional) - Time when download was started in number of seconds since UNIX epoch.</li>\n</ul></li>\n</ul>\n<p>Allows resuming <code>cancelled</code> or <code>interrupted</code> downloads from previous <code>Session</code>. The API will generate a <a href=\"/docs/api/download-item\">DownloadItem</a> that can be accessed with the <a href=\"#event-will-download\">will-download</a> event. The <a href=\"/docs/api/download-item\">DownloadItem</a> will not have any <code>WebContents</code> associated with it and the initial state will be <code>interrupted</code>. The download will start only when the <code>resume</code> API is called on the <a href=\"/docs/api/download-item\">DownloadItem</a>.</p>\n<h4 id=\"sesclearauthcache\"><a href=\"#sesclearauthcache\"><code>ses.clearAuthCache()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the session’s HTTP authentication cache has been cleared.</p>\n<h4 id=\"sessetpreloadspreloads\"><a href=\"#sessetpreloadspreloads\"><code>ses.setPreloads(preloads)</code></a></h4>\n<ul>\n<li><code>preloads</code> String[] - An array of absolute path to preload scripts</li>\n</ul>\n<p>Adds scripts that will be executed on ALL web contents that are associated with this session just before normal <code>preload</code> scripts run.</p>\n<h4 id=\"sesgetpreloads\"><a href=\"#sesgetpreloads\"><code>ses.getPreloads()</code></a></h4>\n<p>Returns <code>String[]</code> an array of paths to preload scripts that have been registered.</p>\n<h4 id=\"sessetspellcheckerenabledenable\"><a href=\"#sessetspellcheckerenabledenable\"><code>ses.setSpellCheckerEnabled(enable)</code></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Sets whether to enable the builtin spell checker.</p>\n<h4 id=\"sesisspellcheckerenabled\"><a href=\"#sesisspellcheckerenabled\"><code>ses.isSpellCheckerEnabled()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the builtin spell checker is enabled.</p>\n<h4 id=\"sessetspellcheckerlanguageslanguages\"><a href=\"#sessetspellcheckerlanguageslanguages\"><code>ses.setSpellCheckerLanguages(languages)</code></a></h4>\n<ul>\n<li><code>languages</code> String[] - An array of language codes to enable the spellchecker for.</li>\n</ul>\n<p>The built in spellchecker does not automatically detect what language a user is typing in.  In order for the spell checker to correctly check their words you must call this API with an array of language codes.  You can get the list of supported language codes with the <code>ses.availableSpellCheckerLanguages</code> property.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and will detect your language automatically.  This API is a no-op on macOS.</p>\n<h4 id=\"sesgetspellcheckerlanguages\"><a href=\"#sesgetspellcheckerlanguages\"><code>ses.getSpellCheckerLanguages()</code></a></h4>\n<p>Returns <code>String[]</code> - An array of language codes the spellchecker is enabled for.  If this list is empty the spellchecker will fallback to using <code>en-US</code>.  By default on launch if this setting is an empty list Electron will try to populate this setting with the current OS locale.  This setting is persisted across restarts.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and has its own list of languages.  This API is a no-op on macOS.</p>\n<h4 id=\"sessetspellcheckerdictionarydownloadurlurl\"><a href=\"#sessetspellcheckerdictionarydownloadurlurl\"><code>ses.setSpellCheckerDictionaryDownloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String - A base URL for Electron to download hunspell dictionaries from.</li>\n</ul>\n<p>By default Electron will download hunspell dictionaries from the Chromium CDN.  If you want to override this behavior you can use this API to point the dictionary downloader at your own hosted version of the hunspell dictionaries.  We publish a <code>hunspell_dictionaries.zip</code> file with each release which contains the files you need to host here, the file server must be <strong>case insensitive</strong> you must upload each file twice, once with the case it has in the ZIP file and once with the filename as all lower case.</p>\n<p>If the files present in <code>hunspell_dictionaries.zip</code> are available at <code>https://example.com/dictionaries/language-code.bdic</code> then you should call this api with <code>ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')</code>.  Please note the trailing slash.  The URL to the dictionaries is formed as <code>${url}${filename}</code>.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and therefore we do not download any dictionary files.  This API is a no-op on macOS.</p>\n<h4 id=\"seslistwordsinspellcheckerdictionary\"><a href=\"#seslistwordsinspellcheckerdictionary\"><code>ses.listWordsInSpellCheckerDictionary()</code></a></h4>\n<p>Returns <code>Promise&#x3C;String[]></code> - An array of all words in app's custom dictionary. Resolves when the full dictionary is loaded from disk.</p>\n<h4 id=\"sesaddwordtospellcheckerdictionaryword\"><a href=\"#sesaddwordtospellcheckerdictionaryword\"><code>ses.addWordToSpellCheckerDictionary(word)</code></a></h4>\n<ul>\n<li><code>word</code> String - The word you want to add to the dictionary</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the word was successfully written to the custom dictionary. This API will not work on non-persistent (in-memory) sessions.</p>\n<p><strong>Note:</strong> On macOS and Windows 10 this word will be written to the OS custom dictionary as well</p>\n<h4 id=\"sesremovewordfromspellcheckerdictionaryword\"><a href=\"#sesremovewordfromspellcheckerdictionaryword\"><code>ses.removeWordFromSpellCheckerDictionary(word)</code></a></h4>\n<ul>\n<li><code>word</code> String - The word you want to remove from the dictionary</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the word was successfully removed from the custom dictionary. This API will not work on non-persistent (in-memory) sessions.</p>\n<p><strong>Note:</strong> On macOS and Windows 10 this word will be removed from the OS custom dictionary as well</p>\n<h4 id=\"sesloadextensionpath-options\"><a href=\"#sesloadextensionpath-options\"><code>ses.loadExtension(path[, options])</code></a></h4>\n<ul>\n<li><code>path</code> String - Path to a directory containing an unpacked Chrome extension</li>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>allowFileAccess</code> Boolean - Whether to allow the extension to read local files over <code>file://</code> protocol and inject content scripts into <code>file://</code> pages. This is required e.g. for loading devtools extensions on <code>file://</code> URLs. По умолчанию - false.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Extension></code> - resolves when the extension is loaded.</p>\n<p>This method will raise an exception if the extension could not be loaded. If there are warnings when installing the extension (e.g. if the extension requests an API that Electron does not support) then they will be logged to the console.</p>\n<p>Note that Electron does not support the full range of Chrome extensions APIs. See <a href=\"/docs/api/extensions#supported-extensions-apis\">Supported Extensions APIs</a> for more details on what is supported.</p>\n<p>Note that in previous versions of Electron, extensions that were loaded would be remembered for future runs of the application. This is no longer the case: <code>loadExtension</code> must be called on every boot of your app if you want the extension to be loaded.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.on(<span class=\"hljs-string\">'ready'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> session.defaultSession.loadExtension(\n    path.join(__dirname, <span class=\"hljs-string\">'react-devtools'</span>),\n    <span class=\"hljs-comment\">// allowFileAccess is required to load the devtools extension on file:// URLs.</span>\n    { <span class=\"hljs-attr\">allowFileAccess</span>: <span class=\"hljs-literal\">true</span> }\n  )\n  <span class=\"hljs-comment\">// Note that in order to use the React DevTools extension, you'll need to</span>\n  <span class=\"hljs-comment\">// download and unzip a copy of the extension.</span>\n})\n</code></pre>\n<p>This API does not support loading packed (.crx) extensions.</p>\n<p><strong>Примечание:</strong> Этот метод не может быть вызван до тех пор, пока событие <code>ready</code> модуля <code>app</code> не произойдет.</p>\n<p><strong>Note:</strong> Loading extensions into in-memory (non-persistent) sessions is not supported and will throw an error.</p>\n<h4 id=\"sesremoveextensionextensionid\"><a href=\"#sesremoveextensionextensionid\"><code>ses.removeExtension(extensionId)</code></a></h4>\n<ul>\n<li><code>extensionId</code> String - ID of extension to remove</li>\n</ul>\n<p>Unloads an extension.</p>\n<p><strong>Примечание:</strong> Этот метод не может быть вызван до тех пор, пока событие <code>ready</code> модуля <code>app</code> не произойдет.</p>\n<h4 id=\"sesgetextensionextensionid\"><a href=\"#sesgetextensionextensionid\"><code>ses.getExtension(extensionId)</code></a></h4>\n<ul>\n<li><code>extensionId</code> String - ID of extension to query</li>\n</ul>\n<p>Returns <code>Extension</code> | <code>null</code> - The loaded extension with the given ID.</p>\n<p><strong>Примечание:</strong> Этот метод не может быть вызван до тех пор, пока событие <code>ready</code> модуля <code>app</code> не произойдет.</p>\n<h4 id=\"sesgetallextensions\"><a href=\"#sesgetallextensions\"><code>ses.getAllExtensions()</code></a></h4>\n<p>Returns <code>Extension[]</code> - A list of all loaded extensions.</p>\n<p><strong>Примечание:</strong> Этот метод не может быть вызван до тех пор, пока событие <code>ready</code> модуля <code>app</code> не произойдет.</p>\n<h4 id=\"sesgetstoragepath\"><a href=\"#sesgetstoragepath\"><code>ses.getStoragePath()</code></a></h4>\n<p>A <code>String | null</code> indicating the absolute file system path where data for this session is persisted on disk.  For in memory sessions this returns <code>null</code>.</p>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<p>Для экземпляров <code>Session</code> доступны следующие свойства:</p>\n<h4 id=\"sesavailablespellcheckerlanguages-только-чтение\"><a href=\"#sesavailablespellcheckerlanguages-только-чтение\"><code>ses.availableSpellCheckerLanguages</code> <em>Только чтение</em></a></h4>\n<p>A <code>String[]</code> array which consists of all the known available spell checker languages.  Providing a language code to the <code>setSpellCheckerLanguages</code> API that isn't in this array will result in an error.</p>\n<h4 id=\"sesspellcheckerenabled\"><a href=\"#sesspellcheckerenabled\"><code>ses.spellCheckerEnabled</code></a></h4>\n<p>A <code>Boolean</code> indicating whether builtin spell checker is enabled.</p>\n<h4 id=\"sesstoragepath-только-чтение\"><a href=\"#sesstoragepath-только-чтение\"><code>ses.storagePath</code> <em>Только чтение</em></a></h4>\n<p>A <code>String | null</code> indicating the absolute file system path where data for this session is persisted on disk.  For in memory sessions this returns <code>null</code>.</p>\n<h4 id=\"sescookies-только-чтение\"><a href=\"#sescookies-только-чтение\"><code>ses.cookies</code> <em>Только чтение</em></a></h4>\n<p>A <a href=\"/docs/api/cookies\"><code>Cookies</code></a> object for this session.</p>\n<h4 id=\"sesserviceworkers-только-чтение\"><a href=\"#sesserviceworkers-только-чтение\"><code>ses.serviceWorkers</code> <em>Только чтение</em></a></h4>\n<p>A <a href=\"/docs/api/service-workers\"><code>ServiceWorkers</code></a> object for this session.</p>\n<h4 id=\"seswebrequest-только-чтение\"><a href=\"#seswebrequest-только-чтение\"><code>ses.webRequest</code> <em>Только чтение</em></a></h4>\n<p>A <a href=\"/docs/api/web-request\"><code>WebRequest</code></a> object for this session.</p>\n<h4 id=\"sesprotocol-только-чтение\"><a href=\"#sesprotocol-только-чтение\"><code>ses.protocol</code> <em>Только чтение</em></a></h4>\n<p>A <a href=\"/docs/api/protocol\"><code>Protocol</code></a> object for this session.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> protocol = session.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).protocol\n  <span class=\"hljs-keyword\">if</span> (!protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })) {\n    <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Failed to register protocol'</span>)\n  }\n})\n</code></pre>\n<h4 id=\"sesnetlog-только-чтение\"><a href=\"#sesnetlog-только-чтение\"><code>ses.netLog</code> <em>Только чтение</em></a></h4>\n<p>A <a href=\"/docs/api/net-log\"><code>NetLog</code></a> object for this session.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> netLog = session.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).netLog\n  netLog.startLogging(<span class=\"hljs-string\">'/path/to/net-log'</span>)\n  <span class=\"hljs-comment\">// After some network events</span>\n  <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> netLog.stopLogging()\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Net-logs written to'</span>, path)\n})\n</code></pre>",
      "title": "session",
      "description": "Session Управление сеансами браузера, куками, кешем, настройками прокси и т. д."
    },
    "/docs/development/setting-up-symbol-server": {
      "locale": "ru-RU",
      "slug": "setting-up-symbol-server",
      "href": "/docs/development/setting-up-symbol-server",
      "crowdinFileId": "256165",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/setting-up-symbol-server.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"настройка-сервера-символов-в-отладчике\"><a href=\"#настройка-сервера-символов-в-отладчике\">Настройка сервера символов в отладчике</a></h1>\n<p>Debug symbols allow you to have better debugging sessions. They have information about the functions contained in executables and dynamic libraries and provide you with information to get clean call stacks. A Symbol Server allows the debugger to load the correct symbols, binaries and sources automatically without forcing users to download large debugging files. The server functions like <a href=\"https://support.microsoft.com/kb/311503\">Microsoft's symbol server</a> so the documentation there can be useful.</p>\n<p>Note that because released Electron builds are heavily optimized, debugging is not always easy. The debugger will not be able to show you the content of all variables and the execution path can seem strange because of inlining, tail calls, and other compiler optimizations. The only workaround is to build an unoptimized local build.</p>\n<p>The official symbol server URL for Electron is <a href=\"https://symbols.electronjs.org\">https://symbols.electronjs.org</a>. You cannot visit this URL directly, you must add it to the symbol path of your debugging tool. In the examples below, a local cache directory is used to avoid repeatedly fetching the PDB from the server. Replace <code>c:\\code\\symbols</code> with an appropriate cache directory on your machine.</p>\n<h2 id=\"использование-сервера-символов-в-windbg\"><a href=\"#использование-сервера-символов-в-windbg\">Использование сервера символов в Windbg</a></h2>\n<p>The Windbg symbol path is configured with a string value delimited with asterisk characters. To use only the Electron symbol server, add the following entry to your symbol path (<strong>Note:</strong> you can replace <code>c:\\code\\symbols</code> with any writable directory on your computer, if you'd prefer a different location for downloaded symbols):</p>\n<pre><code class=\"hljs language-powershell\">SRV*c:\\code\\symbols\\*https://symbols.electronjs.org\n</code></pre>\n<p>Set this string as <code>_NT_SYMBOL_PATH</code> in the environment, using the Windbg menus, or by typing the <code>.sympath</code> command. If you would like to get symbols from Microsoft's symbol server as well, you should list that first:</p>\n<pre><code class=\"hljs language-powershell\">SRV*c:\\code\\symbols\\*https://msdl.microsoft.com/download/symbols;SRV*c:\\code\\symbols\\*https://symbols.electronjs.org\n</code></pre>\n<h2 id=\"использование-сервера-символов-в-visual-studio\"><a href=\"#использование-сервера-символов-в-visual-studio\">Использование сервера символов в Visual Studio</a></h2>\n<p><img src=\"https://mdn.mozillademos.org/files/733/symbol-server-vc8express-menu.jpg\" alt=\"Tools -> Options\"> <img src=\"https://mdn.mozillademos.org/files/2497/2005_options.gif\" alt=\"Symbols Settings\"></p>\n<h2 id=\"устранение-неполадок-символы-не-загружаются\"><a href=\"#устранение-неполадок-символы-не-загружаются\">Устранение неполадок: символы не загружаются</a></h2>\n<p>Type the following commands in Windbg to print why symbols are not loading:</p>\n<pre><code class=\"hljs language-powershell\">> !sym noisy\n> .reload /f electron.exe\n</code></pre>",
      "title": "Настройка сервера символов в отладчике",
      "description": ""
    },
    "/docs/api/share-menu": {
      "locale": "ru-RU",
      "slug": "share-menu",
      "href": "/docs/api/share-menu",
      "crowdinFileId": "256367",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/share-menu.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharemenu\"><a href=\"#sharemenu\">ShareMenu</a></h1>\n<p>The <code>ShareMenu</code> class creates <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/\">Share Menu</a> on macOS, which can be used to share information from the current context to apps, social media accounts, and other services.</p>\n<p>For including the share menu as a submenu of other menus, please use the <code>shareMenu</code> role of <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>.</p>\n<h2 id=\"class-sharemenu\"><a href=\"#class-sharemenu\">Class: ShareMenu</a></h2>\n<blockquote>\n<p>Create share menu on macOS.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<h3 id=\"new-sharemenusharingitem\"><a href=\"#new-sharemenusharingitem\"><code>new ShareMenu(sharingItem)</code></a></h3>\n<ul>\n<li><code>sharingItem</code> SharingItem - The item to share.</li>\n</ul>\n<p>Creates a new share menu.</p>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<p>Экземпляр объекта <code>shareMenu</code> содержит следующие методы:</p>\n<h4 id=\"sharemenupopupoptions\"><a href=\"#sharemenupopupoptions\"><code>shareMenu.popup([options])</code></a></h4>\n<ul>\n<li><code>options</code> PopupOptions (optional)<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (опционально) - по умолчанию это сфокусированное окно.</li>\n<li><code>x</code> Number (optional) - Default is the current mouse cursor position. Must be declared if <code>y</code> is declared.</li>\n<li><code>y</code> Number (optional) - Default is the current mouse cursor position. Must be declared if <code>x</code> is declared.</li>\n<li><code>positioningItem</code> Number (optional) <em>macOS</em> - The index of the menu item to be positioned under the mouse cursor at the specified coordinates. Default is -1.</li>\n<li><code>callback</code> Функция (опционально) - вызывается, когда меню закрыто.</li>\n</ul></li>\n</ul>\n<p>Переключает это меню в контекстное меню в <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<h4 id=\"sharemenuclosepopupbrowserwindow\"><a href=\"#sharemenuclosepopupbrowserwindow\"><code>shareMenu.closePopup([browserWindow])</code></a></h4>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (опционально) - по умолчанию это сфокусированное окно.</li>\n</ul>\n<p>Закрывает контекстное меню в <code>browserWindow</code>.</p>",
      "title": "ShareMenu",
      "description": "Create share menu on macOS."
    },
    "/docs/api/structures/shared-worker-info": {
      "locale": "ru-RU",
      "slug": "shared-worker-info",
      "href": "/docs/api/structures/shared-worker-info",
      "crowdinFileId": "256505",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/shared-worker-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharedworkerinfo-object\"><a href=\"#sharedworkerinfo-object\">SharedWorkerInfo Object</a></h1>\n<ul>\n<li><code>id</code> String - The unique id of the shared worker.</li>\n<li><code>url</code> String - The url of the shared worker.</li>\n</ul>",
      "title": "SharedWorkerInfo Object",
      "description": ""
    },
    "/docs/api/structures/sharing-item": {
      "locale": "ru-RU",
      "slug": "sharing-item",
      "href": "/docs/api/structures/sharing-item",
      "crowdinFileId": "256507",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/sharing-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharingitem-object\"><a href=\"#sharingitem-object\">SharingItem Object</a></h1>\n<ul>\n<li><code>texts</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of text to share.</li>\n<li><code>filePaths</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of files to share.</li>\n<li><code>urls</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of URLs to share.</li>\n</ul>",
      "title": "SharingItem Object",
      "description": ""
    },
    "/docs/api/shell": {
      "locale": "ru-RU",
      "slug": "shell",
      "href": "/docs/api/shell",
      "crowdinFileId": "256369",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/shell.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"shell\"><a href=\"#shell\">shell</a></h1>\n<blockquote>\n<p>Управление файлами и URL-ами, используя стандартные приложения для их открытия.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a> (non-sandboxed only)</p>\n<p>Модуль <code>shell</code> предоставляет функции, относящиеся к десктопной интеграции.</p>\n<p>Пример открытия ссылки в стандартном браузере пользователя:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nshell.openExternal(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<p><strong>Note:</strong> While the <code>shell</code> module can be used in the renderer process, it will not function in a sandboxed renderer.</p>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Модуль <code>shell</code> имеет следующие методы:</p>\n<h3 id=\"shellshowiteminfolderfullpath\"><a href=\"#shellshowiteminfolderfullpath\"><code>shell.showItemInFolder(fullPath)</code></a></h3>\n<ul>\n<li><code>fullPath</code> String</li>\n</ul>\n<p>Show the given file in a file manager. If possible, select the file.</p>\n<h3 id=\"shellopenpathpath\"><a href=\"#shellopenpathpath\"><code>shell.openPath(path)</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - Resolves with a string containing the error message corresponding to the failure if a failure occurred, otherwise \"\".</p>\n<p>Open the given file in the desktop's default manner.</p>\n<h3 id=\"shellopenexternalurl-options\"><a href=\"#shellopenexternalurl-options\"><code>shell.openExternal(url[, options])</code></a></h3>\n<ul>\n<li><code>url</code> String - Max 2081 characters on windows.</li>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>activate</code> Boolean (optional) <em>macOS</em> - <code>true</code> to bring the opened application to the foreground. По-умолчанию - <code>true</code>.</li>\n<li><code>workingDirectory</code> String (optional) <em>Windows</em> - The working directory.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code></p>\n<p>Open the given external protocol URL in the desktop's default manner. (For example, mailto: URLs in the user's default mail agent).</p>\n<h3 id=\"shelltrashitempath\"><a href=\"#shelltrashitempath\"><code>shell.trashItem(path)</code></a></h3>\n<ul>\n<li><code>path</code> String - path to the item to be moved to the trash.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the operation has been completed. Rejects if there was an error while deleting the requested item.</p>\n<p>This moves a path to the OS-specific trash location (Trash on macOS, Recycle Bin on Windows, and a desktop-environment-specific location on Linux).</p>\n<h3 id=\"shellbeep\"><a href=\"#shellbeep\"><code>shell.beep()</code></a></h3>\n<p>Play the beep sound.</p>\n<h3 id=\"shellwriteshortcutlinkshortcutpath-operation-options-windows\"><a href=\"#shellwriteshortcutlinkshortcutpath-operation-options-windows\"><code>shell.writeShortcutLink(shortcutPath[, operation], options)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>shortcutPath</code> String</li>\n<li><code>operation</code> String (optional) - Default is <code>create</code>, can be one of following:<ul>\n<li><code>create</code> - Creates a new shortcut, overwriting if necessary.</li>\n<li><code>update</code> - Updates specified properties only on an existing shortcut.</li>\n<li><code>replace</code> - Overwrites an existing shortcut, fails if the shortcut doesn't exist.</li>\n</ul></li>\n<li><code>options</code> <a href=\"/docs/api/structures/shortcut-details\">ShortcutDetails</a></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the shortcut was created successfully.</p>\n<p>Creates or updates a shortcut link at <code>shortcutPath</code>.</p>\n<h3 id=\"shellreadshortcutlinkshortcutpath-windows\"><a href=\"#shellreadshortcutlinkshortcutpath-windows\"><code>shell.readShortcutLink(shortcutPath)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>shortcutPath</code> String</li>\n</ul>\n<p>Возвращает <a href=\"/docs/api/structures/shortcut-details\"><code>ShortcutDetails</code></a></p>\n<p>Resolves the shortcut link at <code>shortcutPath</code>.</p>\n<p>An exception will be thrown when any error happens.</p>",
      "title": "shell",
      "description": "Управление файлами и URL-ами, используя стандартные приложения для их открытия."
    },
    "/docs/api/structures/shortcut-details": {
      "locale": "ru-RU",
      "slug": "shortcut-details",
      "href": "/docs/api/structures/shortcut-details",
      "crowdinFileId": "256509",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/shortcut-details.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"shortcutdetails-object\"><a href=\"#shortcutdetails-object\">ShortcutDetails Object</a></h1>\n<ul>\n<li><code>target</code> String - The target to launch from this shortcut.</li>\n<li><code>cwd</code> String (optional) - The working directory. Default is empty.</li>\n<li><code>args</code> String (optional) - The arguments to be applied to <code>target</code> when launching from this shortcut. Default is empty.</li>\n<li><code>description</code> String (optional) - The description of the shortcut. Default is empty.</li>\n<li><code>icon</code> String (optional) - The path to the icon, can be a DLL or EXE. <code>icon</code> and <code>iconIndex</code> have to be set together. Default is empty, which uses the target's icon.</li>\n<li><code>iconIndex</code> Number (optional) - The resource ID of icon when <code>icon</code> is a DLL or EXE. Default is 0.</li>\n<li><code>appUserModelId</code> String (optional) - The Application User Model ID. Default is empty.</li>\n<li><code>toastActivatorClsid</code> String (optional) - The Application Toast Activator CLSID. Needed for participating in Action Center.</li>\n</ul>",
      "title": "ShortcutDetails Object",
      "description": ""
    },
    "/docs/api/structures/size": {
      "locale": "ru-RU",
      "slug": "size",
      "href": "/docs/api/structures/size",
      "crowdinFileId": "256511",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/size.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"size-object\"><a href=\"#size-object\">Size Object</a></h1>\n<ul>\n<li><code>width</code> Number</li>\n<li><code>height</code> Number</li>\n</ul>",
      "title": "Size Object",
      "description": ""
    },
    "/docs/tutorial/snapcraft": {
      "locale": "ru-RU",
      "slug": "snapcraft",
      "href": "/docs/tutorial/snapcraft",
      "crowdinFileId": "256249",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/snapcraft.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"snapcraft-guide-linux\"><a href=\"#snapcraft-guide-linux\">Snapcraft Guide (Linux)</a></h1>\n<p>This guide provides information on how to package your Electron application for any Snapcraft environment, including the Ubuntu Software Center.</p>\n<h2 id=\"предыстория-и-требования\"><a href=\"#предыстория-и-требования\">Предыстория и требования</a></h2>\n<p>Together with the broader Linux community, Canonical aims to fix many of the common software installation problems with the <a href=\"https://snapcraft.io/\"><code>snapcraft</code></a> project. Snaps are containerized software packages that include required dependencies, auto-update, and work on all major Linux distributions without system modification.</p>\n<p>There are three ways to create a <code>.snap</code> file:</p>\n<p>1) Using <a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a> or <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a>, both tools that come with <code>snap</code> support out of the box. This is the easiest option. 2) Using <code>electron-installer-snap</code>, which takes <code>electron-packager</code>'s output. 3) Using an already created <code>.deb</code> package.</p>\n<p>В некоторых случаях вам нужно установить инструмент <code>snapcraft</code>. Инструкции по установке <code>snapcraft</code> для вашего конкретного дистрибутива доступны <a href=\"https://snapcraft.io/docs/installing-snapcraft\">здесь</a>.</p>\n<h2 id=\"использование-electron-installer-snap\"><a href=\"#использование-electron-installer-snap\">Использование <code>electron-installer-snap</code></a></h2>\n<p>The module works like <a href=\"https://github.com/electron/windows-installer\"><code>electron-winstaller</code></a> and similar modules in that its scope is limited to building snap packages. Вы можете установить его с:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron-installer-snap\n</code></pre>\n<h3 id=\"1-шаг-упакуйте-ваше-приложение\"><a href=\"#1-шаг-упакуйте-ваше-приложение\">1 Шаг: Упакуйте ваше приложение</a></h3>\n<p>Package the application using <a href=\"https://github.com/electron/electron-packager\">electron-packager</a> (or a similar tool). Удостоверьтесь, что вы удалили <code>node_modules</code>, которые не понадобятся вам в финальной версии приложения, так как любой неиспользуемый модуль в конечном счете увеличит размер вашего приложения.</p>\n<p>Консольный вывод должен иметь примерный вид:</p>\n<pre><code class=\"hljs language-plaintext\">.\n└── dist\n    └── app-linux-x64\n        ├── LICENSE\n        ├── LICENSES.chromium.html\n        ├── content_shell.pak\n        ├── app\n        ├── icudtl.dat\n        ├── libgcrypt.so.11\n        ├── libnode.so\n        ├── locales\n        ├── resources\n        ├── v8_context_snapshot.bin\n        └── version\n</code></pre>\n<h3 id=\"step-2-running-electron-installer-snap\"><a href=\"#step-2-running-electron-installer-snap\">Step 2: Running <code>electron-installer-snap</code></a></h3>\n<p>С терминала, который имеет <code>snapcraft</code> в <code>PATH</code>, запустить <code>electron-installer-snap</code> с единственным требуемым параметром <code>--src</code>, которое является местоположением вашего упакованного приложения Electron, созданного на первом шаге.</p>\n<pre><code class=\"hljs language-sh\">npx electron-installer-snap --src=out/myappname-linux-x64\n</code></pre>\n<p>If you have an existing build pipeline, you can use <code>electron-installer-snap</code> programmatically. For more information, see the <a href=\"https://docs.snapcraft.io/build-snaps/syntax\">Snapcraft API docs</a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> snap = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-installer-snap'</span>)\n\nsnap(options)\n  .then(<span class=\"hljs-function\"><span class=\"hljs-params\">snapPath</span> =></span> <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Created snap at <span class=\"hljs-subst\">${snapPath}</span>!`</span>))\n</code></pre>\n<h2 id=\"using-snapcraft-with-electron-packager\"><a href=\"#using-snapcraft-with-electron-packager\">Using <code>snapcraft</code> with <code>electron-packager</code></a></h2>\n<h3 id=\"step-1-create-sample-snapcraft-project\"><a href=\"#step-1-create-sample-snapcraft-project\">Step 1: Create Sample Snapcraft Project</a></h3>\n<p>Create your project directory and add the following to <code>snap/snapcraft.yaml</code>:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">electron-packager-hello-world</span>\n<span class=\"hljs-attr\">version:</span> <span class=\"hljs-string\">'0.1'</span>\n<span class=\"hljs-attr\">summary:</span> <span class=\"hljs-string\">Hello</span> <span class=\"hljs-string\">World</span> <span class=\"hljs-string\">Electron</span> <span class=\"hljs-string\">app</span>\n<span class=\"hljs-attr\">description:</span> <span class=\"hljs-string\">|\n  Simple Hello World Electron app as an example\n</span><span class=\"hljs-attr\">base:</span> <span class=\"hljs-string\">core18</span>\n<span class=\"hljs-attr\">confinement:</span> <span class=\"hljs-string\">strict</span>\n<span class=\"hljs-attr\">grade:</span> <span class=\"hljs-string\">stable</span>\n\n<span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">electron-packager-hello-world:</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">electron-quick-start/electron-quick-start</span> <span class=\"hljs-string\">--no-sandbox</span>\n    <span class=\"hljs-attr\">extensions:</span> <span class=\"hljs-string\">[gnome-3-34]</span>\n    <span class=\"hljs-attr\">plugs:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">browser-support</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">network</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">network-bind</span>\n    <span class=\"hljs-attr\">environment:</span>\n      <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n      <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n      <span class=\"hljs-attr\">TMPDIR:</span> <span class=\"hljs-string\">$XDG_RUNTIME_DIR</span>\n\n<span class=\"hljs-attr\">parts:</span>\n  <span class=\"hljs-attr\">electron-quick-start:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">nil</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">https://github.com/electron/electron-quick-start.git</span>\n    <span class=\"hljs-attr\">override-build:</span> <span class=\"hljs-string\">|\n        npm install electron electron-packager\n        npx electron-packager . --overwrite --platform=linux --output=release-build --prune=true\n        cp -rv ./electron-quick-start-linux-* $SNAPCRAFT_PART_INSTALL/electron-quick-start\n</span>    <span class=\"hljs-attr\">build-snaps:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">node/14/stable</span>\n    <span class=\"hljs-attr\">build-packages:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">unzip</span>\n    <span class=\"hljs-attr\">stage-packages:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnss3</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnspr4</span>\n</code></pre>\n<p>If you want to apply this example to an existing project:</p>\n<ul>\n<li>Replace <code>source: https://github.com/electron/electron-quick-start.git</code> with <code>source: .</code>.</li>\n<li>Replace all instances of <code>electron-quick-start</code> with your project's name.</li>\n</ul>\n<h3 id=\"step-2-build-the-snap\"><a href=\"#step-2-build-the-snap\">Step 2: Build the snap</a></h3>\n<pre><code class=\"hljs language-sh\">$ snapcraft\n\n&#x3C;output snipped>\nSnapped electron-packager-hello-world_0.1_amd64.snap\n</code></pre>\n<h3 id=\"step-3-install-the-snap\"><a href=\"#step-3-install-the-snap\">Step 3: Install the snap</a></h3>\n<pre><code class=\"hljs language-sh\">sudo snap install electron-packager-hello-world_0.1_amd64.snap --dangerous\n</code></pre>\n<h3 id=\"step-4-run-the-snap\"><a href=\"#step-4-run-the-snap\">Step 4: Run the snap</a></h3>\n<pre><code class=\"hljs language-sh\">electron-packager-hello-world\n</code></pre>\n<h2 id=\"using-an-existing-debian-package\"><a href=\"#using-an-existing-debian-package\">Using an Existing Debian Package</a></h2>\n<p>Snapcraft is capable of taking an existing <code>.deb</code> file and turning it into a <code>.snap</code> file. The creation of a snap is configured using a <code>snapcraft.yaml</code> file that describes the sources, dependencies, description, and other core building blocks.</p>\n<h3 id=\"step-1-create-a-debian-package\"><a href=\"#step-1-create-a-debian-package\">Step 1: Create a Debian Package</a></h3>\n<p>If you do not already have a <code>.deb</code> package, using <code>electron-installer-snap</code> might be an easier path to create snap packages. However, multiple solutions for creating Debian packages exist, including <a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a>, <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> or <a href=\"https://github.com/unindented/electron-installer-debian\"><code>electron-installer-debian</code></a>.</p>\n<h3 id=\"step-2-create-a-snapcraftyaml\"><a href=\"#step-2-create-a-snapcraftyaml\">Step 2: Create a snapcraft.yaml</a></h3>\n<p>For more information on the available configuration options, see the <a href=\"https://docs.snapcraft.io/build-snaps/syntax\">documentation on the snapcraft syntax</a>. Let's look at an example:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">myApp</span>\n<span class=\"hljs-attr\">version:</span> <span class=\"hljs-string\">'2.0.0'</span>\n<span class=\"hljs-attr\">summary:</span> <span class=\"hljs-string\">A</span> <span class=\"hljs-string\">little</span> <span class=\"hljs-string\">description</span> <span class=\"hljs-string\">for</span> <span class=\"hljs-string\">the</span> <span class=\"hljs-string\">app.</span>\n<span class=\"hljs-attr\">description:</span> <span class=\"hljs-string\">|\n You know what? This app is amazing! It does all the things\n for you. Some say it keeps you young, maybe even happy.\n</span>\n<span class=\"hljs-attr\">grade:</span> <span class=\"hljs-string\">stable</span>\n<span class=\"hljs-attr\">confinement:</span> <span class=\"hljs-string\">classic</span>\n\n<span class=\"hljs-attr\">parts:</span>\n  <span class=\"hljs-attr\">slack:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">dump</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">my-deb.deb</span>\n    <span class=\"hljs-attr\">source-type:</span> <span class=\"hljs-string\">deb</span>\n    <span class=\"hljs-attr\">after:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">desktop-gtk3</span>\n    <span class=\"hljs-attr\">stage-packages:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libasound2</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnotify4</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnspr4</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnss3</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libpcre3</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libpulse0</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libxss1</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libxtst6</span>\n  <span class=\"hljs-attr\">electron-launch:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">dump</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">files/</span>\n    <span class=\"hljs-attr\">prepare:</span> <span class=\"hljs-string\">|\n      chmod +x bin/electron-launch\n</span>\n<span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">myApp:</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">bin/electron-launch</span> <span class=\"hljs-string\">$SNAP/usr/lib/myApp/myApp</span>\n    <span class=\"hljs-attr\">desktop:</span> <span class=\"hljs-string\">usr/share/applications/myApp.desktop</span>\n    <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n    <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n    <span class=\"hljs-attr\">environment:</span>\n      <span class=\"hljs-attr\">TMPDIR:</span> <span class=\"hljs-string\">$XDG_RUNTIME_DIR</span>\n</code></pre>\n<p>As you can see, the <code>snapcraft.yaml</code> instructs the system to launch a file called <code>electron-launch</code>. In this example, it passes information on to the app's binary:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-meta\">#!/bin/sh\n</span>\n<span class=\"hljs-built_in\">exec</span> <span class=\"hljs-string\">\"<span class=\"hljs-variable\">$@</span>\"</span> --executed-from=<span class=\"hljs-string\">\"<span class=\"hljs-variable\">$(pwd)</span>\"</span> --pid=$$ > /dev/null 2>&#x26;1 &#x26;\n</code></pre>\n<p>Alternatively, if you're building your <code>snap</code> with <code>strict</code> confinement, you can use the <code>desktop-launch</code> command:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">myApp:</span>\n    <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n    <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">env</span> <span class=\"hljs-string\">TMPDIR=$XDG_RUNTIME_DIR</span> <span class=\"hljs-string\">PATH=/usr/local/bin:${PATH}</span> <span class=\"hljs-string\">${SNAP}/bin/desktop-launch</span> <span class=\"hljs-string\">$SNAP/myApp/desktop</span>\n    <span class=\"hljs-attr\">desktop:</span> <span class=\"hljs-string\">usr/share/applications/desktop.desktop</span>\n</code></pre>",
      "title": "Snapcraft Guide (Linux)",
      "description": ""
    },
    "/docs/development/source-code-directory-structure": {
      "locale": "ru-RU",
      "slug": "source-code-directory-structure",
      "href": "/docs/development/source-code-directory-structure",
      "crowdinFileId": "256167",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/source-code-directory-structure.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"структура-каталога-с-исходным-кодом\"><a href=\"#структура-каталога-с-исходным-кодом\">Структура каталога с исходным кодом</a></h1>\n<p>The source code of Electron is separated into a few parts, mostly following Chromium on the separation conventions.</p>\n<p>You may need to become familiar with <a href=\"https://dev.chromium.org/developers/design-documents/multi-process-architecture\">Chromium's multi-process architecture</a> to understand the source code better.</p>\n<h2 id=\"structure-of-source-code\"><a href=\"#structure-of-source-code\">Structure of Source Code</a></h2>\n<pre><code class=\"hljs language-diff\">Electron\n├── build/ - Build configuration files needed to build with GN.\n├── buildflags/ - Determines the set of features that can be conditionally built.\n├── chromium_src/ - Source code copied from Chromium that isn't part of the content layer.\n├── default_app/ - A default app run when Electron is started without\n|                  providing a consumer app.\n├── docs/ - Electron's documentation.\n|   ├── api/ - Documentation for Electron's externally-facing modules and APIs.\n|   ├── development/ - Documentation to aid in developing for and with Electron.\n|   ├── fiddles/ - A set of code snippets one can run in Electron Fiddle.\n|   ├── images/ - Images used in documentation.\n|   └── tutorial/ - Tutorial documents for various aspects of Electron.\n├── lib/ - JavaScript/TypeScript source code.\n|   ├── browser/ - Main process initialization code.\n|   |   ├── api/ - API implementation for main process modules.\n|   |   └── remote/ - Code related to the remote module as it is\n|   |                 used in the main process.\n|   ├── common/ - Relating to logic needed by both main and renderer processes.\n|   |   └── api/ - API implementation for modules that can be used in\n|   |              both the main and renderer processes\n|   ├── isolated_renderer/ - Handles creation of isolated renderer processes when\n|   |                        contextIsolation is enabled.\n|   ├── renderer/ - Renderer process initialization code.\n|   |   ├── api/ - API implementation for renderer process modules.\n|   |   ├── extension/ - Code related to use of Chrome Extensions\n|   |   |                in Electron's renderer process.\n|   |   ├── remote/ - Logic that handles use of the remote module in\n|   |   |             the main process.\n|   |   └── web-view/ - Logic that handles the use of webviews in the\n|   |                   renderer process.\n|   ├── sandboxed_renderer/ - Logic that handles creation of sandboxed renderer\n|   |   |                     processes.\n|   |   └── api/ - API implementation for sandboxed renderer processes.\n|   └── worker/ - Logic that handles proper functionality of Node.js\n|                 environments in Web Workers.\n├── patches/ - Patches applied on top of Electron's core dependencies\n|   |          in order to handle differences between our use cases and\n|   |          default functionality.\n|   ├── boringssl/ - Patches applied to Google's fork of OpenSSL, BoringSSL.\n|   ├── chromium/ - Patches applied to Chromium.\n|   ├── node/ - Patches applied on top of Node.js.\n|   └── v8/ - Patches applied on top of Google's V8 engine.\n├── shell/ - C++ source code.\n|   ├── app/ - System entry code.\n|   ├── browser/ - The frontend including the main window, UI, and all of the\n|   |   |          main process things. This talks to the renderer to manage web\n|   |   |          pages.\n|   |   ├── ui/ - Implementation of UI stuff for different platforms.\n|   |   |   ├── cocoa/ - Cocoa specific source code.\n|   |   |   ├── win/ - исходный код специфичный для Windows GUI.\n|   |   ├── net/ - исходный код специфичный для X11.\n|   |   ├── api/ - The implementation of the main process APIs.\n|   |   ├── net/ - Код, связанный с сетью.\n|   |   ├── mac/ - Исходный код на Objective-C специфичный для Mac.\n|   |   └── resources/ - Icons, platform-dependent files, etc.\n|   ├── renderer/ - Code that runs in renderer process.\n|   |   └── api/ - The implementation of renderer process APIs.\n|   └── common/ - Code that used by both the main and renderer processes,\n|       |         including some utility functions and code to integrate node's\n|       |         message loop into Chromium's message loop.\n|       └── api/ - The implementation of common APIs, and foundations of\n|                  Electron's built-in modules.\n├── spec/ - Components of Electron's test suite run in the renderer process.\n├── spec-main/ - Components of Electron's test suite run in the main process.\n└── BUILD.gn - Building rules of Electron.\n</code></pre>\n<h2 id=\"structure-of-other-directories\"><a href=\"#structure-of-other-directories\">Structure of Other Directories</a></h2>\n<ul>\n<li><strong>.circleci</strong> - Config file for CI with CircleCI.</li>\n<li><strong>.github</strong> - GitHub-specific config files including issues templates and CODEOWNERS.</li>\n<li><strong>dist</strong> - Temporary directory created by <code>script/create-dist.py</code> script when creating a distribution.</li>\n<li><strong>node_modules</strong> - Third party node modules used for building.</li>\n<li><strong>npm</strong> - Logic for installation of Electron via npm.</li>\n<li><strong>out</strong> - Temporary output directory of <code>ninja</code>.</li>\n<li><strong>script</strong> - Scripts used for development purpose like building, packaging, testing, etc.</li>\n</ul>\n<pre><code class=\"hljs language-diff\">script/ - The set of all scripts Electron runs for a variety of purposes.\n├── codesign/ - Fakes codesigning for Electron apps; used for testing.\n├── lib/ - Miscellaneous python utility scripts.\n└── release/ - Scripts run during Electron's release process.\n    ├── notes/ - Generates release notes for new Electron versions.\n    └── uploaders/ - Uploads various release-related files during release.\n</code></pre>\n<ul>\n<li><strong>typings</strong> - TypeScript typings for Electron's internal code.</li>\n</ul>",
      "title": "Структура каталога с исходным кодом",
      "description": ""
    },
    "/docs/tutorial/spellchecker": {
      "locale": "ru-RU",
      "slug": "spellchecker",
      "href": "/docs/tutorial/spellchecker",
      "crowdinFileId": "256251",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/spellchecker.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"spellchecker\"><a href=\"#spellchecker\">SpellChecker</a></h1>\n<p>Electron has built-in support for Chromium's spellchecker since Electron 8.  On Windows and Linux this is powered by Hunspell dictionaries, and on macOS it makes use of the native spellchecker APIs.</p>\n<h2 id=\"how-to-enable-the-spellchecker\"><a href=\"#how-to-enable-the-spellchecker\">How to enable the spellchecker?</a></h2>\n<p>For Electron 9 and higher the spellchecker is enabled by default.  For Electron 8 you need to enable it in <code>webPreferences</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> myWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">spellcheck</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h2 id=\"how-to-set-the-languages-the-spellchecker-uses\"><a href=\"#how-to-set-the-languages-the-spellchecker-uses\">How to set the languages the spellchecker uses?</a></h2>\n<p>On macOS as we use the native APIs there is no way to set the language that the spellchecker uses. By default on macOS the native spellchecker will automatically detect the language being used for you.</p>\n<p>For Windows and Linux there are a few Electron APIs you should use to set the languages for the spellchecker.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Sets the spellchecker to check English US and French</span>\nmyWindow.session.setSpellCheckerLanguages([<span class=\"hljs-string\">'en-US'</span>, <span class=\"hljs-string\">'fr'</span>])\n\n<span class=\"hljs-comment\">// An array of all available language codes</span>\n<span class=\"hljs-keyword\">const</span> possibleLanguages = myWindow.session.availableSpellCheckerLanguages\n</code></pre>\n<p>By default the spellchecker will enable the language matching the current OS locale.</p>\n<h2 id=\"how-do-i-put-the-results-of-the-spellchecker-in-my-context-menu\"><a href=\"#how-do-i-put-the-results-of-the-spellchecker-in-my-context-menu\">How do I put the results of the spellchecker in my context menu?</a></h2>\n<p>All the required information to generate a context menu is provided in the <a href=\"/docs/api/web-contents#event-context-menu\"><code>context-menu</code></a> event on each <code>webContents</code> instance.  A small example of how to make a context menu with this information is provided below.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { Menu, MenuItem } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nmyWindow.webContents.on(<span class=\"hljs-string\">'context-menu'</span>, (event, params) => {\n  <span class=\"hljs-keyword\">const</span> menu = <span class=\"hljs-keyword\">new</span> Menu()\n\n  <span class=\"hljs-comment\">// Add each spelling suggestion</span>\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> suggestion <span class=\"hljs-keyword\">of</span> params.dictionarySuggestions) {\n    menu.append(<span class=\"hljs-keyword\">new</span> MenuItem({\n      <span class=\"hljs-attr\">label</span>: suggestion,\n      <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> mainWindow.webContents.replaceMisspelling(suggestion)\n    }))\n  }\n\n  <span class=\"hljs-comment\">// Allow users to add the misspelled word to the dictionary</span>\n  <span class=\"hljs-keyword\">if</span> (params.misspelledWord) {\n    menu.append(\n      <span class=\"hljs-keyword\">new</span> MenuItem({\n        <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Add to dictionary'</span>,\n        <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> mainWindow.webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord)\n      })\n    )\n  }\n\n  menu.popup()\n})\n</code></pre>\n<h2 id=\"does-the-spellchecker-use-any-google-services\"><a href=\"#does-the-spellchecker-use-any-google-services\">Does the spellchecker use any Google services?</a></h2>\n<p>Although the spellchecker itself does not send any typings, words or user input to Google services the hunspell dictionary files are downloaded from a Google CDN by default.  If you want to avoid this you can provide an alternative URL to download the dictionaries from.</p>\n<pre><code class=\"hljs language-js\">myWindow.session.setSpellCheckerDictionaryDownloadURL(<span class=\"hljs-string\">'https://example.com/dictionaries/'</span>)\n</code></pre>\n<p>Check out the docs for <a href=\"/docs/api/session#sessetspellcheckerdictionarydownloadurlurl\"><code>session.setSpellCheckerDictionaryDownloadURL</code></a> for more information on where to get the dictionary files from and how you need to host them.</p>",
      "title": "SpellChecker",
      "description": ""
    },
    "/docs/styleguide": {
      "locale": "ru-RU",
      "slug": "styleguide",
      "href": "/docs/styleguide",
      "crowdinFileId": "256125",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/styleguide.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"руководство-по-стилю-документации-electron\"><a href=\"#руководство-по-стилю-документации-electron\">Руководство по стилю документации Electron</a></h1>\n<p>Это руководство для написания Electron документации.</p>\n<h2 id=\"headings\"><a href=\"#headings\">Headings</a></h2>\n<ul>\n<li>Каждая страница должна иметь один заголовок <code>#</code> в верхней части.</li>\n<li>Chapters in the same page must have <code>##</code>-level headings.</li>\n<li>Sub-chapters need to increase the number of <code>#</code> in the heading according to their nesting depth.</li>\n<li>The page's title must follow <a href=\"https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case\">APA title case</a>.</li>\n<li>All chapters must follow <a href=\"https://apastyle.apa.org/style-grammar-guidelines/capitalization/sentence-case\">APA sentence case</a>.</li>\n</ul>\n<p>Используйте <code>Быстрый старт</code> как пример:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># Quick Start</span>\n\n...\n\n<span class=\"hljs-section\">## Main process</span>\n\n...\n\n<span class=\"hljs-section\">## Renderer process</span>\n\n...\n\n<span class=\"hljs-section\">## Run your app</span>\n\n...\n\n<span class=\"hljs-section\">### Run as a distribution</span>\n\n...\n\n<span class=\"hljs-section\">### Manually downloaded Electron binary</span>\n\n...\n</code></pre>\n<p>Для ссылок на API есть исключения из этого правила.</p>\n<h2 id=\"markdown-правила\"><a href=\"#markdown-правила\">Markdown правила</a></h2>\n<p>This repository uses the <a href=\"https://github.com/DavidAnson/markdownlint\"><code>markdownlint</code></a> package to enforce consistent Markdown styling. For the exact rules, see the <code>.markdownlint.json</code> file in the root folder.</p>\n<p>There are a few style guidelines that aren't covered by the linter rules:</p>\n<!--TODO(erickzhao): make sure this matches with the lint:markdownlint task-->\n<ul>\n<li>Используйте <code>sh</code> вместо <code>cmd</code> в блоках кода (из-за синтаксической подсветки).</li>\n<li>Keep line lengths between 80 and 100 characters if possible for readability purposes.</li>\n<li>Не делать вложенные списки более чем 2 уровня (из-за markdown отображения).</li>\n<li>Все блоки кода <code>js</code> и <code>javascript</code> проверяются линтером по <a href=\"https://www.npmjs.com/package/standard-markdown\">standard-markdown</a>.</li>\n<li>For unordered lists, use asterisks instead of dashes.</li>\n</ul>\n<h2 id=\"выбор-слов\"><a href=\"#выбор-слов\">Выбор слов</a></h2>\n<ul>\n<li>Используйте \"будет\" вместо \"был бы\" при описании результатов.</li>\n<li>Предпочитайте \"в ___ процессе\" чем \"в\".</li>\n</ul>\n<h2 id=\"справочник-по-api\"><a href=\"#справочник-по-api\">Справочник по API</a></h2>\n<p>Следующие правила применяются только к документации по API.</p>\n<h3 id=\"title-and-description\"><a href=\"#title-and-description\">Title and description</a></h3>\n<p>Each module's API doc must use the actual object name returned by <code>require('electron')</code> as its title (such as <code>BrowserWindow</code>, <code>autoUpdater</code>, and <code>session</code>).</p>\n<p>Directly under the page title, add a one-line description of the module as a markdown quote (beginning with <code>></code>).</p>\n<p>Using the <code>session</code> module as an example:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># session</span>\n\n<span class=\"hljs-quote\">> Управление сеансами браузера, куками, кешем, настройками прокси и т.д.</span>\n</code></pre>\n<h3 id=\"методы-и-события-модуля\"><a href=\"#методы-и-события-модуля\">Методы и события модуля</a></h3>\n<p>Для модулей, которые не являются классами, методы и события должны быть перечислены под главами <code>## Методы</code> и <code>## События</code> .</p>\n<p>Используйте <code>autoUpdater</code> как пример:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># autoUpdater</span>\n\n<span class=\"hljs-section\">## События </span>\n\n<span class=\"hljs-section\">### Событие: 'error' </span>\n\n<span class=\"hljs-section\">## Методы </span>\n\n<span class=\"hljs-section\">### `autoUpdater.setFeedURL(url[, requestHeaders])`</span>\n</code></pre>\n<h3 id=\"классы\"><a href=\"#классы\">Классы</a></h3>\n<ul>\n<li>Классы API или классы, которые являются частью модулей должны быть перечислены под главой <code>## Класс: НазваниеКласса</code>.</li>\n<li>Одна страница может иметь несколько классов.</li>\n<li>Constructors must be listed with <code>###</code>-level headings.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static\">Static Methods</a> must be listed under a <code>### Static Methods</code> chapter.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Prototype_methods\">Instance Methods</a> must be listed under an <code>### Instance Methods</code> chapter.</li>\n<li>All methods that have a return value must start their description with \"Returns <code>[TYPE]</code> - [Return description]\"<ul>\n<li>If the method returns an <code>Object</code>, its structure can be specified using a colon followed by a newline then an unordered list of properties in the same style as function parameters.</li>\n</ul></li>\n<li>События экземпляров, должны быть перечислены под главой <code>### События экземпляра</code>.</li>\n<li>Instance Properties must be listed under an <code>### Instance Properties</code> chapter.<ul>\n<li>Instance Properties must start with \"A [Property Type] ...\"</li>\n</ul></li>\n</ul>\n<p>Используйте классы <code>Session</code> и <code>Cookies</code> в качестве примера:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># session</span>\n\n<span class=\"hljs-section\">## Методы</span>\n\n<span class=\"hljs-section\">### session.fromPartition(partition)</span>\n\n<span class=\"hljs-section\">## Статические свойства</span>\n\n<span class=\"hljs-section\">### session.defaultSession</span>\n\n<span class=\"hljs-section\">## Class: Session</span>\n\n<span class=\"hljs-section\">### События экземпляра</span>\n\n<span class=\"hljs-section\">#### Event: 'will-download'</span>\n\n<span class=\"hljs-section\">### Методы экземпляра</span>\n\n<span class=\"hljs-section\">#### `ses.getCacheSize()`</span>\n\n<span class=\"hljs-section\">### Свойства экземпляра</span>\n\n<span class=\"hljs-section\">#### `ses.cookies`</span>\n\n<span class=\"hljs-section\">## Class: Cookies</span>\n\n<span class=\"hljs-section\">### Методы экземпляра</span>\n\n<span class=\"hljs-section\">#### `cookies.get(filter, callback)`</span>\n</code></pre>\n<h3 id=\"methods-and-their-arguments\"><a href=\"#methods-and-their-arguments\">Methods and their arguments</a></h3>\n<p>Методы главы должны быть в следующем виде:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### `objectName.methodName(required[, optional]))`</span>\n<span class=\"hljs-bullet\">\n* </span><span class=\"hljs-code\">`required`</span> String - A parameter description.\n<span class=\"hljs-bullet\">* </span><span class=\"hljs-code\">`optional`</span> Integer (optional) - Another parameter description.\n\n...\n</code></pre>\n<h4 id=\"heading-level\"><a href=\"#heading-level\">Heading level</a></h4>\n<p>The heading can be <code>###</code> or <code>####</code>-levels depending on whether the method belongs to a module or a class.</p>\n<h4 id=\"function-signature\"><a href=\"#function-signature\">Function signature</a></h4>\n<p>For modules, the <code>objectName</code> is the module's name. For classes, it must be the name of the instance of the class, and must not be the same as the module's name.</p>\n<p>Например, методы класса <code>Session</code> под модулем <code>session</code> должны использовать <code>ses</code> как <code>objectName</code>.</p>\n<p>Optional arguments are notated by square brackets <code>[]</code> surrounding the optional argument as well as the comma required if this optional argument follows another argument:</p>\n<pre><code class=\"hljs language-markdown\">required[, optional]\n</code></pre>\n<h4 id=\"argument-descriptions\"><a href=\"#argument-descriptions\">Argument descriptions</a></h4>\n<p>More detailed information on each of the arguments is noted in an unordered list below the method. The type of argument is notated by either JavaScript primitives (e.g. <code>String</code>, <code>Promise</code>, or <code>Object</code>), a custom API structure like Electron's <a href=\"/docs/api/structures/cookie\"><code>Cookie</code></a>, or the wildcard <code>any</code>.</p>\n<p>If the argument is of type <code>Array</code>, use <code>[]</code> shorthand with the type of value inside the array (for example,<code>any[]</code> or <code>String[]</code>).</p>\n<p>If the argument is of type <code>Promise</code>, parametrize the type with what the promise resolves to (for example, <code>Promise&#x3C;void></code> or <code>Promise&#x3C;String></code>).</p>\n<p>If an argument can be of multiple types, separate the types with <code>|</code>.</p>\n<p>Описание аргументов типа <code>Function</code> должно дать понять, как это может быть вызвано и перечислить типы параметров, которые будут переданы ему.</p>\n<h4 id=\"platform-specific-functionality\"><a href=\"#platform-specific-functionality\">Platform-specific functionality</a></h4>\n<p>Если аргумент или метод является уникальным для определенных платформ, эти платформы обозначаются списком, разделенных пробелами, после типа данных. Значения могут быть <code>macOS</code>, <code>Windows</code> или <code>Linux</code>.</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-bullet\">* </span><span class=\"hljs-code\">`animate`</span> Boolean (по усмотрению) <span class=\"hljs-emphasis\">_macOS_</span> <span class=\"hljs-emphasis\">_Windows_</span> - анимировать вещь.\n</code></pre>\n<h3 id=\"события\"><a href=\"#события\">События</a></h3>\n<p>Глава события должна быть в следующем виде:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### Событие: 'wake-up'</span>\n\nВозвращает:\n<span class=\"hljs-bullet\">\n* </span><span class=\"hljs-code\">`time`</span> String\n\n...\n</code></pre>\n<p>The heading can be <code>###</code> or <code>####</code>-levels depending on whether the event belongs to a module or a class.</p>\n<p>Аргументы события следуют тем же правилам методов.</p>\n<h3 id=\"свойства\"><a href=\"#свойства\">Свойства</a></h3>\n<p>Глава свойства должна быть в следующем виде:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### session.defaultSession</span>\n\n...\n</code></pre>\n<p>The heading can be <code>###</code> or <code>####</code>-levels depending on whether the property belongs to a module or a class.</p>\n<h2 id=\"documentation-translations\"><a href=\"#documentation-translations\">Documentation translations</a></h2>\n<p>См. <a href=\"https://github.com/electron/i18n#readme\">electron/i18n</a></p>",
      "title": "Руководство по стилю документации Electron",
      "description": ""
    },
    "/docs/tutorial/support": {
      "locale": "ru-RU",
      "slug": "support",
      "href": "/docs/tutorial/support",
      "crowdinFileId": "256253",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/support.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"поддержка-electron\"><a href=\"#поддержка-electron\">Поддержка Electron</a></h1>\n<h2 id=\"поиск-поддержки\"><a href=\"#поиск-поддержки\">Поиск поддержки</a></h2>\n<p>Если у вас есть проблема с безопасностью, смотрите <a href=\"https://github.com/electron/electron/tree/main/SECURITY.md\">документ безопасности</a>.</p>\n<p>Если вы ищете помощь в программировании, для ответов на вопросы, или присоединиться к обсуждению с другими разработчиками, которые используют Electron, вы можете взаимодействовать с сообществом в этих местах:</p>\n<ul>\n<li><a href=\"https://discord.com/invite/electron\"><code>Electron's Discord</code></a> has channels for:<ul>\n<li>Getting help</li>\n<li>Ecosystem apps like <a href=\"https://github.com/electron-userland/electron-forge\">Electron Forge</a> and <a href=\"https://github.com/electron/fiddle\">Electron Fiddle</a></li>\n<li>Sharing ideas with other Electron app developers</li>\n<li>And more!</li>\n</ul></li>\n<li><a href=\"https://discuss.atom.io/c/electron\"><code>electron</code></a> category on the Atom forums</li>\n<li><code>#electron</code> канал на <a href=\"https://discuss.atom.io/t/join-us-on-slack/16638?source_topic_id=25406\">Atom Slack</a></li>\n<li><a href=\"https://telegram.me/electron_ru\"><code>electron-ru</code></a> <em>(Русский)</em></li>\n<li><a href=\"https://electron-br.slack.com\"><code>electron-br</code></a> <em>(Бразильский Португальский)</em></li>\n<li><a href=\"https://electron-kr.github.io/electron-kr\"><code>electron-kr</code></a> <em>(Корейский)</em></li>\n<li><a href=\"https://electron-jp.slack.com\"><code>electron-jp</code></a> <em>(Японский)</em></li>\n<li><a href=\"https://electron-tr.herokuapp.com\"><code>electron-tr</code></a> <em>(Турецкий)</em></li>\n<li><a href=\"https://electron-id.slack.com\"><code>electron-id</code></a> <em>(Индонезия)</em></li>\n<li><a href=\"https://electronpl.github.io\"><code>electron-pl</code></a> <em>(Польша)</em></li>\n</ul>\n<p>Если вы хотите внести свой вклад в Electron, смотрите <a href=\"https://github.com/electron/electron/blob/main/CONTRIBUTING.md\">документ</a>.</p>\n<p>Если вы обнаружили ошибку в <a href=\"#supported-versions\">поддерживаемой версии</a> Electron, сообщите об этом <a href=\"/docs/development/issues\">issue tracker</a>.</p>\n<p><a href=\"https://github.com/sindresorhus/awesome-electron\">awesome-electron</a> is a community-maintained list of useful example apps, tools and resources.</p>\n<h2 id=\"поддерживаемые-версии\"><a href=\"#поддерживаемые-версии\">Поддерживаемые версии</a></h2>\n<p><em><strong>Note:</strong> Beginning in September 2021 with Electron 15, the Electron team will temporarily support the latest <strong>four</strong> stable major versions. This extended support is intended to help Electron developers transition to the <a href=\"https://electronjs.org/blog/8-week-cadence\">new eight week release cadence</a>, and will continue until May 2022, with the release of Electron 19. At that time, the Electron team will drop support back to the latest three stable major versions.</em></p>\n<p>The latest three <em>stable</em> major versions are supported by the Electron team. For example, if the latest release is 6.1.x, then the 5.0.x as well as the 4.2.x series are supported.  We only support the latest minor release for each stable release series.  This means that in the case of a security fix 6.1.x will receive the fix, but we will not release a new version of 6.0.x.</p>\n<p>The latest stable release unilaterally receives all fixes from <code>main</code>, and the version prior to that receives the vast majority of those fixes as time and bandwidth warrants. The oldest supported release line will receive only security fixes directly.</p>\n<p>All supported release lines will accept external pull requests to backport fixes previously merged to <code>main</code>, though this may be on a case-by-case basis for some older supported lines. All contested decisions around release line backports will be resolved by the <a href=\"https://github.com/electron/governance/tree/main/wg-releases\">Releases Working Group</a> as an agenda item at their weekly meeting the week the backport PR is raised.</p>\n<p>When an API is changed or removed in a way that breaks existing functionality, the previous functionality will be supported for a minimum of two major versions when possible before being removed. For example, if a function takes three arguments, and that number is reduced to two in major version 10, the three-argument version would continue to work until, at minimum, major version 12. Past the minimum two-version threshold, we will attempt to support backwards compatibility beyond two versions until the maintainers feel the maintenance burden is too high to continue doing so.</p>\n<h3 id=\"currently-supported-versions\"><a href=\"#currently-supported-versions\">Currently supported versions</a></h3>\n<ul>\n<li>15.x.y</li>\n<li>14.x.y</li>\n<li>13.x.y</li>\n<li>12</li>\n</ul>\n<h3 id=\"end-of-life\"><a href=\"#end-of-life\">End-of-life</a></h3>\n<p>When a release branch reaches the end of its support cycle, the series will be deprecated in NPM and a final end-of-support release will be made. This release will add a warning to inform that an unsupported version of Electron is in use.</p>\n<p>These steps are to help app developers learn when a branch they're using becomes unsupported, but without being excessively intrusive to end users.</p>\n<p>If an application has exceptional circumstances and needs to stay on an unsupported series of Electron, developers can silence the end-of-support warning by omitting the final release from the app's <code>package.json</code> <code>devDependencies</code>. For example, since the 1-6-x series ended with an end-of-support 1.6.18 release, developers could choose to stay in the 1-6-x series without warnings with <code>devDependency</code> of <code>\"electron\": 1.6.0 - 1.6.17</code>.</p>\n<h2 id=\"поддерживаемые-платформы\"><a href=\"#поддерживаемые-платформы\">Поддерживаемые платформы</a></h2>\n<p>Следующие платформы поддерживаются Electron:</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>对 macOS 仅提供64位版本，并且只支持 macOS 10.11 (El Capitan) 以及更高版本。.</p>\n<p>Native support for Apple Silicon (<code>arm64</code>) devices was added in Electron 11.0.0.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<p>Поддерживаются Windows 7 и более поздние версии, более старые операционные системы не поддерживаются (и не работают).</p>\n<p>Both <code>ia32</code> (<code>x86</code>) and <code>x64</code> (<code>amd64</code>) binaries are provided for Windows. <a href=\"/docs/tutorial/windows-arm\">Native support for Windows on Arm (<code>arm64</code>) devices was added in Electron 6.0.8.</a>. Running apps packaged with previous versions is possible using the ia32 binary.</p>\n<h3 id=\"linux\"><a href=\"#linux\">Linux</a></h3>\n<p>The prebuilt binaries of Electron are built on Ubuntu 18.04.</p>\n<p>Будет ли готовая бинарная сборка включена в дистрибутив, зависит от того, включает ли дистрибутив библиотеки, с которыми связан Electron на компилирруемой платформе, поэтому гарантируется работа только в Ubuntu 18.04, но следующие платформы также проверяются, чтобы иметь возможность запускать прекомпилированные сборки Electron:</p>\n<ul>\n<li>Ubuntu 14.04 и новее</li>\n<li>Fedora 24 and newer</li>\n<li>Debian 8 and newer</li>\n</ul>",
      "title": "Поддержка Electron",
      "description": ""
    },
    "/docs/api/synopsis": {
      "locale": "ru-RU",
      "slug": "synopsis",
      "href": "/docs/api/synopsis",
      "crowdinFileId": "256371",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/synopsis.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"краткий-обзор\"><a href=\"#краткий-обзор\">Краткий обзор</a></h1>\n<blockquote>\n<p>Как использовать API Node.js и Electron.</p>\n</blockquote>\n<p>Все <a href=\"https://nodejs.org/api/\">встроенные модули Node.js</a> доступны в Electron и сторонних модулях (включая <a href=\"/docs/tutorial/using-native-node-modules\">нативные модули</a>).</p>\n<p>Кроме того, Electron предоставляет дополнительные встроенные модули для разработки нативных дестопных приложений. Некоторые модули доступны только в главном процессе, некоторые доступны только в процессе отрисовки (веб-страницы), а некоторые могут быть использованы в обоих процессах.</p>\n<p>Основное правило: если модуль связан с <a href=\"https://en.wikipedia.org/wiki/Graphical_user_interface\">GUI</a> или системой низкого уровня, то должно быть доступно только в основном процессе. You need to be familiar with the concept of main process vs. renderer process scripts to be able to use those modules.</p>\n<p>Скрипт основного процесса похож на обычный скрипт Node.js:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>Процесс отрисовки ничем не отличается от обычной веб-страницы, за исключением дополнительной возможности использования модулей node, если параметр <code>nodeIntegration</code> имеет значение \"Включён\":</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  <span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n  <span class=\"hljs-built_in\">console</span>.log(fs.readFileSync(__filename, <span class=\"hljs-string\">'utf8'</span>))\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<h2 id=\"деструктирующее-присваивание\"><a href=\"#деструктирующее-присваивание\">Деструктирующее присваивание</a></h2>\n<p>Начиная с версии 0.37 можно использовать <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment\">деструктирующее присваивание</a>, для того чтобы упростить использование встроенных модулей.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>If you need the entire <code>electron</code> module, you can require it and then using destructuring to access the individual modules from <code>electron</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> electron = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = electron\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>Это эквивалентно следующему коду:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> electron = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> app = electron.app\n<span class=\"hljs-keyword\">const</span> BrowserWindow = electron.BrowserWindow\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>",
      "title": "Краткий обзор",
      "description": "Как использовать API Node.js и Electron."
    },
    "/docs/api/system-preferences": {
      "locale": "ru-RU",
      "slug": "system-preferences",
      "href": "/docs/api/system-preferences",
      "crowdinFileId": "256373",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/system-preferences.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"systempreferences\"><a href=\"#systempreferences\">systemPreferences</a></h1>\n<blockquote>\n<p>Получение системных параметров.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(systemPreferences.isDarkMode())\n</code></pre>\n<h2 id=\"события\"><a href=\"#события\">События</a></h2>\n<p>Объект <code>systemPreferences</code> включает следующие события:</p>\n<h3 id=\"событие-accent-color-changed-windows\"><a href=\"#событие-accent-color-changed-windows\">Событие: 'accent-color-changed' <em>Windows</em></a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>newColor</code> Строка - новый цвет RGBA, назначенный пользователем в качестве акцентного цвета.</li>\n</ul>\n<h3 id=\"событие-color-changed-windows\"><a href=\"#событие-color-changed-windows\">Событие: 'color-changed' <em>Windows</em></a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n</ul>\n<h3 id=\"event-inverted-color-scheme-changed-windows-deprecated\"><a href=\"#event-inverted-color-scheme-changed-windows-deprecated\">Event: 'inverted-color-scheme-changed' <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>invertedColorScheme</code> Boolean - <code>true</code> if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is being used, <code>false</code> otherwise.</li>\n</ul>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#event-updated\"><code>updated</code></a> event on the <code>nativeTheme</code> module.</p>\n<h3 id=\"event-high-contrast-color-scheme-changed-windows-deprecated\"><a href=\"#event-high-contrast-color-scheme-changed-windows-deprecated\">Event: 'high-contrast-color-scheme-changed' <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>highContrastColorScheme</code> Boolean - <code>true</code> if a high contrast theme is being used, <code>false</code> otherwise.</li>\n</ul>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#event-updated\"><code>updated</code></a> event on the <code>nativeTheme</code> module.</p>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<h3 id=\"systempreferencesisdarkmode-macos-windows-deprecated\"><a href=\"#systempreferencesisdarkmode-macos-windows-deprecated\"><code>systemPreferences.isDarkMode()</code> <em>macOS</em> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Возвращает <code>Boolean</code> - если система в Ночном режиме.</p>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#nativethemeshouldusedarkcolors-readonly\"><code>nativeTheme.shouldUseDarkColors</code></a> API.</p>\n<h3 id=\"systempreferencesisswipetrackingfromscrolleventsenabled-macos\"><a href=\"#systempreferencesisswipetrackingfromscrolleventsenabled-macos\"><code>systemPreferences.isSwipeTrackingFromScrollEventsEnabled()</code> <em>macOS</em></a></h3>\n<p>Returns <code>Boolean</code> - Whether the Swipe between pages setting is on.</p>\n<h3 id=\"systempreferencespostnotificationevent-userinfo-deliverimmediately-macos\"><a href=\"#systempreferencespostnotificationevent-userinfo-deliverimmediately-macos\"><code>systemPreferences.postNotification(event, userInfo[, deliverImmediately])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n<li><code>deliverImmediately</code> Boolean (optional) - <code>true</code> to post notifications immediately even when the subscribing app is inactive.</li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencespostlocalnotificationevent-userinfo-macos\"><a href=\"#systempreferencespostlocalnotificationevent-userinfo-macos\"><code>systemPreferences.postLocalNotification(event, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencespostworkspacenotificationevent-userinfo-macos\"><a href=\"#systempreferencespostworkspacenotificationevent-userinfo-macos\"><code>systemPreferences.postWorkspaceNotification(event, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencessubscribenotificationevent-callback-macos\"><a href=\"#systempreferencessubscribenotificationevent-callback-macos\"><code>systemPreferences.subscribeNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> String</li>\n</ul></li>\n</ul>\n<p>Returns <code>Number</code> - The ID of this subscription</p>\n<p>Subscribes to native notifications of macOS, <code>callback</code> will be called with <code>callback(event, userInfo)</code> when the corresponding <code>event</code> happens. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification. The <code>object</code> is the sender of the notification, and only supports <code>NSString</code> values for now.</p>\n<p>The <code>id</code> of the subscriber is returned, which can be used to unsubscribe the <code>event</code>.</p>\n<p>Under the hood this API subscribes to <code>NSDistributedNotificationCenter</code>, example values of <code>event</code> are:</p>\n<ul>\n<li><code>AppleInterfaceThemeChangedNotification</code></li>\n<li><code>AppleAquaColorVariantChanged</code></li>\n<li><code>AppleColorPreferencesChangedNotification</code></li>\n<li><code>AppleShowScrollBarsSettingChanged</code></li>\n</ul>\n<h3 id=\"systempreferencessubscribelocalnotificationevent-callback-macos\"><a href=\"#systempreferencessubscribelocalnotificationevent-callback-macos\"><code>systemPreferences.subscribeLocalNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> String</li>\n</ul></li>\n</ul>\n<p>Returns <code>Number</code> - The ID of this subscription</p>\n<p>Same as <code>subscribeNotification</code>, but uses <code>NSNotificationCenter</code> for local defaults. This is necessary for events such as <code>NSUserDefaultsDidChangeNotification</code>.</p>\n<h3 id=\"systempreferencessubscribeworkspacenotificationevent-callback-macos\"><a href=\"#systempreferencessubscribeworkspacenotificationevent-callback-macos\"><code>systemPreferences.subscribeWorkspaceNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> String</li>\n</ul></li>\n</ul>\n<p>Returns <code>Number</code> - The ID of this subscription</p>\n<p>Same as <code>subscribeNotification</code>, but uses <code>NSWorkspace.sharedWorkspace.notificationCenter</code>. This is necessary for events such as <code>NSWorkspaceDidActivateApplicationNotification</code>.</p>\n<h3 id=\"systempreferencesunsubscribenotificationid-macos\"><a href=\"#systempreferencesunsubscribenotificationid-macos\"><code>systemPreferences.unsubscribeNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Removes the subscriber with <code>id</code>.</p>\n<h3 id=\"systempreferencesunsubscribelocalnotificationid-macos\"><a href=\"#systempreferencesunsubscribelocalnotificationid-macos\"><code>systemPreferences.unsubscribeLocalNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Same as <code>unsubscribeNotification</code>, but removes the subscriber from <code>NSNotificationCenter</code>.</p>\n<h3 id=\"systempreferencesunsubscribeworkspacenotificationid-macos\"><a href=\"#systempreferencesunsubscribeworkspacenotificationid-macos\"><code>systemPreferences.unsubscribeWorkspaceNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Same as <code>unsubscribeNotification</code>, but removes the subscriber from <code>NSWorkspace.sharedWorkspace.notificationCenter</code>.</p>\n<h3 id=\"systempreferencesregisterdefaultsdefaults-macos\"><a href=\"#systempreferencesregisterdefaultsdefaults-macos\"><code>systemPreferences.registerDefaults(defaults)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>defaults</code> Record&#x3C;String, String | Boolean | Number> - a dictionary of (<code>key: value</code>) user defaults</li>\n</ul>\n<p>Add the specified defaults to your application's <code>NSUserDefaults</code>.</p>\n<h3 id=\"systempreferencesgetuserdefaulttype-extends-keyof-userdefaulttypeskey-type-macos\"><a href=\"#systempreferencesgetuserdefaulttype-extends-keyof-userdefaulttypeskey-type-macos\"><code>systemPreferences.getUserDefault&#x3C;Type extends keyof UserDefaultTypes>(key, type)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n<li><code>type</code> Type - Can be <code>string</code>, <code>boolean</code>, <code>integer</code>, <code>float</code>, <code>double</code>, <code>url</code>, <code>array</code> or <code>dictionary</code>.</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/user-default-types\"><code>UserDefaultTypes[Type]</code></a> - The value of <code>key</code> in <code>NSUserDefaults</code>.</p>\n<p>Самые популярные <code>key</code> и <code>type</code>:</p>\n<ul>\n<li><code>AppleInterfaceStyle</code>: <code>string</code></li>\n<li><code>AppleAquaColorVariant</code>: <code>integer</code></li>\n<li><code>AppleHighlightColor</code>: <code>string</code></li>\n<li><code>AppleShowScrollBars</code>: <code>string</code></li>\n<li><code>NSNavRecentPlaces</code>: <code>array</code></li>\n<li><code>NSPreferredWebServices</code>: <code>dictionary</code></li>\n<li><code>NSUserDictionaryReplacementItems</code>: <code>array</code></li>\n</ul>\n<h3 id=\"systempreferencessetuserdefaultkey-type-value-macos\"><a href=\"#systempreferencessetuserdefaultkey-type-value-macos\"><code>systemPreferences.setUserDefault(key, type, value)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n<li><code>type</code> String - Can be <code>string</code>, <code>boolean</code>, <code>integer</code>, <code>float</code>, <code>double</code>, <code>url</code>, <code>array</code> or <code>dictionary</code>.</li>\n<li><code>value</code> String</li>\n</ul>\n<p>Устанавливает значение <code>key</code> в <code>NSUserDefaults</code>.</p>\n<p>Note that <code>type</code> should match actual type of <code>value</code>. An exception is thrown if they don't.</p>\n<p>Самые популярные <code>key</code> и <code>type</code>:</p>\n<ul>\n<li><code>ApplePressAndHoldEnabled</code>: <code>boolean</code></li>\n</ul>\n<h3 id=\"systempreferencesremoveuserdefaultkey-macos\"><a href=\"#systempreferencesremoveuserdefaultkey-macos\"><code>systemPreferences.removeUserDefault(key)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Removes the <code>key</code> in <code>NSUserDefaults</code>. This can be used to restore the default or global value of a <code>key</code> previously set with <code>setUserDefault</code>.</p>\n<h3 id=\"systempreferencesisaeroglassenabled-windows\"><a href=\"#systempreferencesisaeroglassenabled-windows\"><code>systemPreferences.isAeroGlassEnabled()</code> <em>Windows</em></a></h3>\n<p>Returns <code>Boolean</code> - <code>true</code> if <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/aa969540.aspx\">DWM composition</a> (Aero Glass) is enabled, and <code>false</code> otherwise.</p>\n<p>An example of using it to determine if you should create a transparent window or not (transparent windows won't work correctly when DWM composition is disabled):</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> browserOptions = { <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">1000</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">800</span> }\n\n<span class=\"hljs-comment\">// Make the window transparent only if the platform supports it.</span>\n<span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'win32'</span> || systemPreferences.isAeroGlassEnabled()) {\n  browserOptions.transparent = <span class=\"hljs-literal\">true</span>\n  browserOptions.frame = <span class=\"hljs-literal\">false</span>\n}\n\n<span class=\"hljs-comment\">// Create the window.</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow(browserOptions)\n\n<span class=\"hljs-comment\">// Navigate.</span>\n<span class=\"hljs-keyword\">if</span> (browserOptions.transparent) {\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/index.html`</span>)\n} <span class=\"hljs-keyword\">else</span> {\n  <span class=\"hljs-comment\">// Без прозрачности, значит мы загружаем резерв, использующий базовые стили.</span>\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/fallback.html`</span>) \n}\n</code></pre>\n<h3 id=\"systempreferencesgetaccentcolor-windows-macos\"><a href=\"#systempreferencesgetaccentcolor-windows-macos\"><code>systemPreferences.getAccentColor()</code> <em>Windows</em> <em>macOS</em></a></h3>\n<p>Returns <code>String</code> - The users current system wide accent color preference in RGBA hexadecimal form.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> color = systemPreferences.getAccentColor() <span class=\"hljs-comment\">// `\"aabbccdd\"` </span>\n<span class=\"hljs-keyword\">const</span> red = color.substr(<span class=\"hljs-number\">0</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"aa\" </span>\n<span class=\"hljs-keyword\">const</span> green = color.substr(<span class=\"hljs-number\">2</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"bb\" </span>\n<span class=\"hljs-keyword\">const</span> blue = color.substr(<span class=\"hljs-number\">4</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"cc\" </span>\n<span class=\"hljs-keyword\">const</span> alpha = color.substr(<span class=\"hljs-number\">6</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"dd\"</span>\n</code></pre>\n<p>This API is only available on macOS 10.14 Mojave or newer.</p>\n<h3 id=\"systempreferencesgetcolorcolor-windows-macos\"><a href=\"#systempreferencesgetcolorcolor-windows-macos\"><code>systemPreferences.getColor(color)</code> <em>Windows</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>color</code> String - One of the following values:<ul>\n<li>On <strong>Windows</strong>:<ul>\n<li><code>3d-dark-shadow</code> - Dark shadow for three-dimensional display elements.</li>\n<li><code>3d-face</code> - Face color for three-dimensional display elements and for dialog box backgrounds.</li>\n<li><code>3d-highlight</code> - Highlight color for three-dimensional display elements.</li>\n<li><code>3d-light</code> - Light color for three-dimensional display elements.</li>\n<li><code>3d-shadow</code> - Shadow color for three-dimensional display elements.</li>\n<li><code>active-border</code> - Active window border.</li>\n<li><code>active-caption</code> - Active window title bar. Specifies the left side color in the color gradient of an active window's title bar if the gradient effect is enabled.</li>\n<li><code>active-caption-gradient</code> - Right side color in the color gradient of an active window's title bar.</li>\n<li><code>app-workspace</code> - Background color of multiple document interface (MDI) applications.</li>\n<li><code>button-text</code> - Text on push buttons.</li>\n<li><code>caption-text</code> - Text in caption, size box, and scroll bar arrow box.</li>\n<li><code>desktop</code> - Desktop background color.</li>\n<li><code>disabled-text</code> - Grayed (disabled) text.</li>\n<li><code>highlight</code> - Item(s) selected in a control.</li>\n<li><code>highlight-text</code> - Text of item(s) selected in a control.</li>\n<li><code>hotlight</code> - Color for a hyperlink or hot-tracked item.</li>\n<li><code>inactive-border</code> - Inactive window border.</li>\n<li><code>inactive-caption</code> - Inactive window caption. Specifies the left side color in the color gradient of an inactive window's title bar if the gradient effect is enabled.</li>\n<li><code>inactive-caption-gradient</code> - Right side color in the color gradient of an inactive window's title bar.</li>\n<li><code>inactive-caption-text</code> - Color of text in an inactive caption.</li>\n<li><code>info-background</code> - Background color for tooltip controls.</li>\n<li><code>info-text</code> - Text color for tooltip controls.</li>\n<li><code>menu</code> - Menu background.</li>\n<li><code>menu-highlight</code> - The color used to highlight menu items when the menu appears as a flat menu.</li>\n<li><code>menubar</code> - The background color for the menu bar when menus appear as flat menus.</li>\n<li><code>menu-text</code> - Text in menus.</li>\n<li><code>scrollbar</code> - Scroll bar gray area.</li>\n<li><code>window</code> - Window background.</li>\n<li><code>window-frame</code> - Window frame.</li>\n<li><code>window-text</code> - Text in windows.</li>\n</ul></li>\n<li>On <strong>macOS</strong><ul>\n<li><code>alternate-selected-control-text</code> - The text on a selected surface in a list or table. <em>deprecated</em></li>\n<li><code>control-background</code> - The background of a large interface element, such as a browser or table.</li>\n<li><code>control</code> - The surface of a control.</li>\n<li><code>control-text</code> -The text of a control that isn’t disabled.</li>\n<li><code>disabled-control-text</code> - The text of a control that’s disabled.</li>\n<li><code>find-highlight</code> - The color of a find indicator.</li>\n<li><code>grid</code> - The gridlines of an interface element such as a table.</li>\n<li><code>header-text</code> - The text of a header cell in a table.</li>\n<li><code>highlight</code> - The virtual light source onscreen.</li>\n<li><code>keyboard-focus-indicator</code> - The ring that appears around the currently focused control when using the keyboard for interface navigation.</li>\n<li><code>label</code> - The text of a label containing primary content.</li>\n<li><code>link</code> - A link to other content.</li>\n<li><code>placeholder-text</code> -  A placeholder string in a control or text view.</li>\n<li><code>quaternary-label</code> - The text of a label of lesser importance than a tertiary label such as watermark text.</li>\n<li><code>scrubber-textured-background</code> - The background of a scrubber in the Touch Bar.</li>\n<li><code>secondary-label</code> - The text of a label of lesser importance than a normal label such as a label used to represent a subheading or additional information.</li>\n<li><code>selected-content-background</code> - The background for selected content in a key window or view.</li>\n<li><code>selected-control</code> - The surface of a selected control.</li>\n<li><code>selected-control-text</code> - The text of a selected control.</li>\n<li><code>selected-menu-item-text</code> - The text of a selected menu.</li>\n<li><code>selected-text-background</code> - The background of selected text.</li>\n<li><code>selected-text</code> - Selected text.</li>\n<li><code>separator</code> - A separator between different sections of content.</li>\n<li><code>shadow</code> - The virtual shadow cast by a raised object onscreen.</li>\n<li><code>tertiary-label</code> - The text of a label of lesser importance than a secondary label such as a label used to represent disabled text.</li>\n<li><code>text-background</code> - Text background.</li>\n<li><code>text</code> -  The text in a document.</li>\n<li><code>under-page-background</code> -  The background behind a document's content.</li>\n<li><code>unemphasized-selected-content-background</code> - The selected content in a non-key window or view.</li>\n<li><code>unemphasized-selected-text-background</code> - A background for selected text in a non-key window or view.</li>\n<li><code>unemphasized-selected-text</code> - Selected text in a non-key window or view.</li>\n<li><code>window-background</code> - The background of a window.</li>\n<li><code>window-frame-text</code> - The text in the window's titlebar area.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>String</code> - The system color setting in RGB hexadecimal form (<code>#ABCDEF</code>). See the <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx\">Windows docs</a> and the <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#dynamic-system-colors\">macOS docs</a> for more details.</p>\n<p>The following colors are only available on macOS 10.14: <code>find-highlight</code>, <code>selected-content-background</code>, <code>separator</code>, <code>unemphasized-selected-content-background</code>, <code>unemphasized-selected-text-background</code>, and <code>unemphasized-selected-text</code>.</p>\n<h3 id=\"systempreferencesgetsystemcolorcolor-macos\"><a href=\"#systempreferencesgetsystemcolorcolor-macos\"><code>systemPreferences.getSystemColor(color)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>color</code> String - One of the following values:<ul>\n<li><code>blue</code></li>\n<li><code>brown</code></li>\n<li><code>gray</code></li>\n<li><code>green</code></li>\n<li><code>orange</code></li>\n<li><code>pink</code></li>\n<li><code>purple</code></li>\n<li><code>red</code></li>\n<li><code>yellow</code></li>\n</ul></li>\n</ul>\n<p>Returns <code>String</code> - The standard system color formatted as <code>#RRGGBBAA</code>.</p>\n<p>Returns one of several standard system colors that automatically adapt to vibrancy and changes in accessibility settings like 'Increase contrast' and 'Reduce transparency'. See <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#system-colors\">Apple Documentation</a> for  more details.</p>\n<h3 id=\"systempreferencesisinvertedcolorscheme-windows-deprecated\"><a href=\"#systempreferencesisinvertedcolorscheme-windows-deprecated\"><code>systemPreferences.isInvertedColorScheme()</code> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Returns <code>Boolean</code> - <code>true</code> if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is active, <code>false</code> otherwise.</p>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly\"><code>nativeTheme.shouldUseInvertedColorScheme</code></a> API.</p>\n<h3 id=\"systempreferencesishighcontrastcolorscheme-macos-windows-deprecated\"><a href=\"#systempreferencesishighcontrastcolorscheme-macos-windows-deprecated\"><code>systemPreferences.isHighContrastColorScheme()</code> <em>macOS</em> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Returns <code>Boolean</code> - <code>true</code> if a high contrast theme is active, <code>false</code> otherwise.</p>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#nativethemeshouldusehighcontrastcolors-macos-windows-readonly\"><code>nativeTheme.shouldUseHighContrastColors</code></a> API.</p>\n<h3 id=\"systempreferencesgeteffectiveappearance-macos\"><a href=\"#systempreferencesgeteffectiveappearance-macos\"><code>systemPreferences.getEffectiveAppearance()</code> <em>macOS</em></a></h3>\n<p>Returns <code>String</code> - Can be <code>dark</code>, <code>light</code> or <code>unknown</code>.</p>\n<p>Gets the macOS appearance setting that is currently applied to your application, maps to <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc\">NSApplication.effectiveAppearance</a></p>\n<h3 id=\"systempreferencesgetapplevelappearance-macos-deprecated\"><a href=\"#systempreferencesgetapplevelappearance-macos-deprecated\"><code>systemPreferences.getAppLevelAppearance()</code> <em>macOS</em> <em>Deprecated</em></a></h3>\n<p>Returns <code>String</code> | <code>null</code> - Can be <code>dark</code>, <code>light</code> or <code>unknown</code>.</p>\n<p>Gets the macOS appearance setting that you have declared you want for your application, maps to <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc\">NSApplication.appearance</a>. You can use the <code>setAppLevelAppearance</code> API to set this value.</p>\n<h3 id=\"systempreferencessetapplevelappearanceappearance-macos-deprecated\"><a href=\"#systempreferencessetapplevelappearanceappearance-macos-deprecated\"><code>systemPreferences.setAppLevelAppearance(appearance)</code> <em>macOS</em> <em>Deprecated</em></a></h3>\n<ul>\n<li><code>appearance</code> String | null - Can be <code>dark</code> or <code>light</code></li>\n</ul>\n<p>Sets the appearance setting for your application, this should override the system default and override the value of <code>getEffectiveAppearance</code>.</p>\n<h3 id=\"systempreferencescanprompttouchid-macos\"><a href=\"#systempreferencescanprompttouchid-macos\"><code>systemPreferences.canPromptTouchID()</code> <em>macOS</em></a></h3>\n<p>Returns <code>Boolean</code> - whether or not this device has the ability to use Touch ID.</p>\n<p><strong>NOTE:</strong> This API will return <code>false</code> on macOS systems older than Sierra 10.12.2.</p>\n<h3 id=\"systempreferencesprompttouchidreason-macos\"><a href=\"#systempreferencesprompttouchidreason-macos\"><code>systemPreferences.promptTouchID(reason)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>reason</code> String - The reason you are asking for Touch ID authentication</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves if the user has successfully authenticated with Touch ID.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsystemPreferences.promptTouchID(<span class=\"hljs-string\">'To get consent for a Security-Gated Thing'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">success</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'You have successfully authenticated with Touch ID!'</span>)\n}).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(err)\n})\n</code></pre>\n<p>This API itself will not protect your user data; rather, it is a mechanism to allow you to do so. Native apps will need to set <a href=\"https://developer.apple.com/documentation/security/secaccesscontrolcreateflags?language=objc\">Access Control Constants</a> like <a href=\"https://developer.apple.com/documentation/security/secaccesscontrolcreateflags/ksecaccesscontroluserpresence?language=objc\"><code>kSecAccessControlUserPresence</code></a> on their keychain entry so that reading it would auto-prompt for Touch ID biometric consent. This could be done with <a href=\"https://github.com/atom/node-keytar\"><code>node-keytar</code></a>, such that one would store an encryption key with <code>node-keytar</code> and only fetch it if <code>promptTouchID()</code> resolves.</p>\n<p><strong>NOTE:</strong> This API will return a rejected Promise on macOS systems older than Sierra 10.12.2.</p>\n<h3 id=\"systempreferencesistrustedaccessibilityclientprompt-macos\"><a href=\"#systempreferencesistrustedaccessibilityclientprompt-macos\"><code>systemPreferences.isTrustedAccessibilityClient(prompt)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>prompt</code> Boolean - whether or not the user will be informed via prompt if the current process is untrusted.</li>\n</ul>\n<p>Returns <code>Boolean</code> - <code>true</code> if the current process is a trusted accessibility client and <code>false</code> if it is not.</p>\n<h3 id=\"systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><a href=\"#systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><code>systemPreferences.getMediaAccessStatus(mediaType)</code> <em>Windows</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>mediaType</code> String - может быть завершено <code>microphone</code>, отменено <code>camera</code> или прервано <code>screen</code>.</li>\n</ul>\n<p>Returns <code>String</code> - Can be <code>not-determined</code>, <code>granted</code>, <code>denied</code>, <code>restricted</code> or <code>unknown</code>.</p>\n<p>This user consent was not required on macOS 10.13 High Sierra or lower so this method will always return <code>granted</code>. macOS 10.14 Mojave or higher requires consent for <code>microphone</code> and <code>camera</code> access. macOS 10.15 Catalina or higher requires consent for <code>screen</code> access.</p>\n<p>Windows 10 has a global setting controlling <code>microphone</code> and <code>camera</code> access for all win32 applications. It will always return <code>granted</code> for <code>screen</code> and for all media types on older versions of Windows.</p>\n<h3 id=\"systempreferencesaskformediaaccessmediatype-macos\"><a href=\"#systempreferencesaskformediaaccessmediatype-macos\"><code>systemPreferences.askForMediaAccess(mediaType)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>mediaType</code> String - the type of media being requested; can be <code>microphone</code>, <code>camera</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Boolean></code> - A promise that resolves with <code>true</code> if consent was granted and <code>false</code> if it was denied. If an invalid <code>mediaType</code> is passed, the promise will be rejected. If an access request was denied and later is changed through the System Preferences pane, a restart of the app will be required for the new permissions to take effect. If access has already been requested and denied, it <em>must</em> be changed through the preference pane; an alert will not pop up and the promise will resolve with the existing access status.</p>\n<p><strong>Important:</strong> In order to properly leverage this API, you <a href=\"https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos?language=objc\">must set</a> the <code>NSMicrophoneUsageDescription</code> and <code>NSCameraUsageDescription</code> strings in your app's <code>Info.plist</code> file. The values for these keys will be used to populate the permission dialogs so that the user will be properly informed as to the purpose of the permission request. See <a href=\"/docs/tutorial/application-distribution#macos\">Electron Application Distribution</a> for more information about how to set these in the context of Electron.</p>\n<p>This user consent was not required until macOS 10.14 Mojave, so this method will always return <code>true</code> if your system is running 10.13 High Sierra or lower.</p>\n<h3 id=\"systempreferencesgetanimationsettings\"><a href=\"#systempreferencesgetanimationsettings\"><code>systemPreferences.getAnimationSettings()</code></a></h3>\n<p>Возвращает <code>Object</code>:</p>\n<ul>\n<li><code>shouldRenderRichAnimation</code> Boolean - Returns true if rich animations should be rendered. Looks at session type (e.g. remote desktop) and accessibility settings to give guidance for heavy animations.</li>\n<li><code>scrollAnimationsEnabledBySystem</code> Boolean - Determines on a per-platform basis whether scroll animations (e.g. produced by home/end key) should be enabled.</li>\n<li><code>prefersReducedMotion</code> Boolean - Determines whether the user desires reduced motion based on platform APIs.</li>\n</ul>\n<p>Returns an object with system animation settings.</p>\n<h2 id=\"свойства\"><a href=\"#свойства\">Свойства</a></h2>\n<h3 id=\"systempreferencesapplevelappearance-macos\"><a href=\"#systempreferencesapplevelappearance-macos\"><code>systemPreferences.appLevelAppearance</code> <em>macOS</em></a></h3>\n<p>Свойство <code>String</code> может быть <code>dark</code>, <code>light</code> или <code>unknown</code>. It determines the macOS appearance setting for your application. This maps to values in: <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc\">NSApplication.appearance</a>. Setting this will override the system default as well as the value of <code>getEffectiveAppearance</code>.</p>\n<p>Possible values that can be set are <code>dark</code> and <code>light</code>, and possible return values are <code>dark</code>, <code>light</code>, and <code>unknown</code>.</p>\n<p>This property is only available on macOS 10.14 Mojave or newer.</p>\n<h3 id=\"systempreferenceseffectiveappearance-macos-readonly\"><a href=\"#systempreferenceseffectiveappearance-macos-readonly\"><code>systemPreferences.effectiveAppearance</code> <em>macOS</em> <em>Readonly</em></a></h3>\n<p>Свойство <code>String</code> может быть <code>dark</code>, <code>light</code> или <code>unknown</code>.</p>\n<p>Returns the macOS appearance setting that is currently applied to your application, maps to <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc\">NSApplication.effectiveAppearance</a></p>",
      "title": "systemPreferences",
      "description": "Получение системных параметров."
    },
    "/docs/api/structures/task": {
      "locale": "ru-RU",
      "slug": "task",
      "href": "/docs/api/structures/task",
      "crowdinFileId": "256513",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/task.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"task-object\"><a href=\"#task-object\">Task Object</a></h1>\n<ul>\n<li><code>program</code> String - Path of the program to execute, usually you should specify <code>process.execPath</code> which opens the current program.</li>\n<li><code>arguments</code> String - The command line arguments when <code>program</code> is executed.</li>\n<li><code>title</code> String - The string to be displayed in a JumpList.</li>\n<li><code>description</code> String - Description of this task.</li>\n<li><code>iconPath</code> String - The absolute path to an icon to be displayed in a JumpList, which can be an arbitrary resource file that contains an icon. You can usually specify <code>process.execPath</code> to show the icon of the program.</li>\n<li><code>iconIndex</code> Number - The icon index in the icon file. If an icon file consists of two or more icons, set this value to identify the icon. If an icon file consists of one icon, this value is 0.</li>\n<li><code>workingDirectory</code> String (optional) - The working directory. Default is empty.</li>\n</ul>",
      "title": "Task Object",
      "description": ""
    },
    "/docs/development/testing": {
      "locale": "ru-RU",
      "slug": "testing",
      "href": "/docs/development/testing",
      "crowdinFileId": "256169",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/testing.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"тестирование\"><a href=\"#тестирование\">Тестирование</a></h1>\n<p>Мы стремимся сохранить кодовое покрытие Electron высоким. We ask that all pull request not only pass all existing tests, but ideally also add new tests to cover changed code and new scenarios. <a href=\"https://crowdin.com/translate/electron/159/en-ru#13105\">https://crowdin.com/translate/electron/159/en-ru#13105</a>.</p>\n<p>This repository comes with linting rules for both JavaScript and C++ – as well as unit and integration tests. To learn more about Electron's coding style, please see the <a href=\"/docs/development/coding-style\">coding-style</a> document.</p>\n<h2 id=\"linting\"><a href=\"#linting\">Linting</a></h2>\n<p>To ensure that your JavaScript is in compliance with the Electron coding style, run <code>npm run lint-js</code>, which will run <code>standard</code> against both Electron itself as well as the unit tests. If you are using an editor with a plugin/addon system, you might want to use one of the many <a href=\"https://standardjs.com/#are-there-text-editor-plugins\">StandardJS addons</a> to be informed of coding style violations before you ever commit them.</p>\n<p>To run <code>standard</code> with parameters, run <code>npm run lint-js --</code> followed by arguments you want passed to <code>standard</code>.</p>\n<p>To ensure that your C++ is in compliance with the Electron coding style, run <code>npm run lint-cpp</code>, which runs a <code>cpplint</code> script. We recommend that you use <code>clang-format</code> and prepared <a href=\"/docs/development/clang-format\">a short tutorial</a>.</p>\n<p>There is not a lot of Python in this repository, but it too is governed by coding style rules. <code>npm run lint-py</code> will check all Python, using <code>pylint</code> to do so.</p>\n<h2 id=\"unit-tests\"><a href=\"#unit-tests\">Unit Tests</a></h2>\n<p>If you are not using <a href=\"https://github.com/electron/build-tools\">build-tools</a>, ensure that that name you have configured for your local build of Electron is one of <code>Testing</code>, <code>Release</code>, <code>Default</code>, <code>Debug</code>, or you have set <code>process.env.ELECTRON_OUT_DIR</code>. Without these set, Electron will fail to perform some pre-testing steps.</p>\n<p>To run all unit tests, run <code>npm run test</code>. The unit tests are an Electron app (surprise!) that can be found in the <code>spec</code> folder. Note that it has its own <code>package.json</code> and that its dependencies are therefore not defined in the top-level <code>package.json</code>.</p>\n<p>To run only specific tests matching a pattern, run <code>npm run test -- -g=PATTERN</code>, replacing the <code>PATTERN</code> with a regex that matches the tests you would like to run. As an example: If you want to run only IPC tests, you would run <code>npm run test -- -g ipc</code>.</p>\n<h3 id=\"проверка-на-устройствах-windows-10\"><a href=\"#проверка-на-устройствах-windows-10\">Проверка на устройствах Windows 10</a></h3>\n<h4 id=\"extra-steps-to-run-the-unit-test\"><a href=\"#extra-steps-to-run-the-unit-test\">Extra steps to run the unit test:</a></h4>\n<ol>\n<li>\n<p>Visual Studio 2019 must be installed.</p>\n</li>\n<li>\n<p>Node headers have to be compiled for your configuration.</p>\n<pre><code class=\"hljs language-powershell\">ninja -C out\\Testing third_party\\electron_node:headers\n</code></pre>\n</li>\n<li>\n<p>The electron.lib has to be copied as node.lib.</p>\n<pre><code class=\"hljs language-powershell\">cd out\\Testing\nmkdir gen\\node_headers\\Release\ncopy electron.lib gen\\node_headers\\Release\\node.lib\n</code></pre>\n</li>\n</ol>\n<h4 id=\"missing-fonts\"><a href=\"#missing-fonts\">Missing fonts</a></h4>\n<p><a href=\"https://docs.microsoft.com/en-us/typography/fonts/windows_10_font_list\">На некоторых устройства на Windows 10</a> может быть не установлен шрифт Meriyo, что может привести к провалу fallback теста. Для того чтобы установить шрифт Meiryo:</p>\n<ol>\n<li>Нажмите кнопку Windows и найдите <em>Управление дополнительными функциями</em>.</li>\n<li>Нажмите <em>Добавить функцию</em>.</li>\n<li>Выберите <em>Японские дополнительные шрифты</em> и нажмите <em>Установить</em>.</li>\n</ol>\n<h4 id=\"pixel-measurements\"><a href=\"#pixel-measurements\">Pixel measurements</a></h4>\n<p>Some tests which rely on precise pixel measurements may not work correctly on devices with Hi-DPI screen settings due to floating point precision errors. To run these tests correctly, make sure the device is set to 100% scaling.</p>\n<p>To configure display scaling:</p>\n<ol>\n<li>Push the Windows key and search for <em>Display settings</em>.</li>\n<li>Under <em>Scale and layout</em>, make sure that the device is set to 100%.</li>\n</ol>",
      "title": "Тестирование",
      "description": ""
    },
    "/docs/tutorial/testing-on-headless-ci": {
      "locale": "ru-RU",
      "slug": "testing-on-headless-ci",
      "href": "/docs/tutorial/testing-on-headless-ci",
      "crowdinFileId": "256255",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/testing-on-headless-ci.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"тестирование-с-помощью-систем-непрерывной-интеграции-travis-jenkins\"><a href=\"#тестирование-с-помощью-систем-непрерывной-интеграции-travis-jenkins\">Тестирование с помощью систем непрерывной интеграции (Travis, Jenkins)</a></h1>\n<p>Being based on Chromium, Electron requires a display driver to function. If Chromium can't find a display driver, Electron will fail to launch - and therefore not executing any of your tests, regardless of how you are running them. Testing Electron-based apps on Travis, Circle, Jenkins or similar Systems requires therefore a little bit of configuration. In essence, we need to use a virtual display driver.</p>\n<h2 id=\"configuring-the-virtual-display-server\"><a href=\"#configuring-the-virtual-display-server\">Configuring the Virtual Display Server</a></h2>\n<p>First, install <a href=\"https://en.wikipedia.org/wiki/Xvfb\">Xvfb</a>. It's a virtual framebuffer, implementing the X11 display server protocol - it performs all graphical operations in memory without showing any screen output, which is exactly what we need.</p>\n<p>Затем создайте виртуальный экран Xvfb и экспортируйте переменную окружения, называемую DISPLAY, которая указывает на него. Chromium in Electron will automatically look for <code>$DISPLAY</code>, so no further configuration of your app is required. This step can be automated with Anaïs Betts' <a href=\"https://github.com/anaisbetts/xvfb-maybe\">xvfb-maybe</a>: Prepend your test commands with <code>xvfb-maybe</code> and the little tool will automatically configure Xvfb, if required by the current system. On Windows or macOS, it will do nothing.</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-comment\">## On Windows or macOS, this invokes electron-mocha</span>\n<span class=\"hljs-comment\">## On Linux, if we are in a headless environment, this will be equivalent</span>\n<span class=\"hljs-comment\">## to xvfb-run electron-mocha ./test/*.js</span>\nxvfb-maybe electron-mocha ./<span class=\"hljs-built_in\">test</span>/*.js\n</code></pre>\n<h3 id=\"travis-ci\"><a href=\"#travis-ci\">Travis CI</a></h3>\n<p>Для Travis, ваш <code>.travis.yml</code> должен выглядеть примерно так:</p>\n<pre><code class=\"hljs language-yml\"><span class=\"hljs-attr\">addons:</span>\n  <span class=\"hljs-attr\">apt:</span>\n    <span class=\"hljs-attr\">packages:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">xvfb</span>\n\n<span class=\"hljs-attr\">install:</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">export</span> <span class=\"hljs-string\">DISPLAY=':99.0'</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">Xvfb</span> <span class=\"hljs-string\">:99</span> <span class=\"hljs-string\">-screen</span> <span class=\"hljs-number\">0</span> <span class=\"hljs-string\">1024x768x24</span> <span class=\"hljs-string\">></span> <span class=\"hljs-string\">/dev/null</span> <span class=\"hljs-number\">2</span><span class=\"hljs-string\">>&#x26;1</span> <span class=\"hljs-string\">&#x26;</span>\n</code></pre>\n<h3 id=\"jenkins\"><a href=\"#jenkins\">Jenkins</a></h3>\n<p>Для Jenkins доступен <a href=\"https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin\">плагин Xvfb</a>.</p>\n<h3 id=\"circle-ci\"><a href=\"#circle-ci\">Circle CI</a></h3>\n<p>Circle CI замечательный, так что xvfb и <code>$DISPLAY</code> <a href=\"https://circleci.com/docs/environment#browsers\">уже установлены, и дополнительной настройки не требуется</a>.</p>\n<h3 id=\"appveyor\"><a href=\"#appveyor\">AppVeyor</a></h3>\n<p>AppVeyor работает под Windows, поддерживает Selenium, Chromium, Electron и другие подобные инструменты \"из коробки\" - настройка не требуется.</p>",
      "title": "Тестирование с помощью систем непрерывной интеграции (Travis, Jenkins)",
      "description": ""
    },
    "/docs/tutorial/testing-widevine-cdm": {
      "locale": "ru-RU",
      "slug": "testing-widevine-cdm",
      "href": "/docs/tutorial/testing-widevine-cdm",
      "crowdinFileId": "256257",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/testing-widevine-cdm.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"testing-widevine-cdm\"><a href=\"#testing-widevine-cdm\">Testing Widevine CDM</a></h1>\n<p>In Electron you can use the Widevine CDM library shipped with Chrome browser.</p>\n<p>Widevine Content Decryption Modules (CDMs) are how streaming services protect content using HTML5 video to web browsers without relying on an NPAPI plugin like Flash or Silverlight. Widevine support is an alternative solution for streaming services that currently rely on Silverlight for playback of DRM-protected video content. It will allow websites to show DRM-protected video content in Firefox without the use of NPAPI plugins. The Widevine CDM runs in an open-source CDM sandbox providing better user security than NPAPI plugins.</p>\n<h4 id=\"note-on-vmp\"><a href=\"#note-on-vmp\">Note on VMP</a></h4>\n<p>As of <a href=\"https://electronjs.org/releases#1.8.1\"><code>Electron v1.8.0 (Chrome v59)</code></a>, the below steps are may only be some of the necessary steps to enable Widevine; any app on or after that version intending to use the Widevine CDM may need to be signed using a license obtained from <a href=\"https://www.widevine.com/\">Widevine</a> itself.</p>\n<p>Per <a href=\"https://www.widevine.com/\">Widevine</a>:</p>\n<blockquote>\n<p>Chrome 59 (and later) includes support for Verified Media Path (VMP). VMP provides a method to verify the authenticity of a device platform. For browser deployments, this will provide an additional signal to determine if a browser-based implementation is reliable and secure.</p>\n<p>The proxy integration guide has been updated with information about VMP and how to issue licenses.</p>\n<p>Widevine recommends our browser-based integrations (vendors and browser-based applications) add support for VMP.</p>\n</blockquote>\n<p>To enable video playback with this new restriction, <a href=\"https://castlabs.com/open-source/downstream/\">castLabs</a> has created a <a href=\"https://github.com/castlabs/electron-releases\">fork</a> that has implemented the necessary changes to enable Widevine to be played in an Electron application if one has obtained the necessary licenses from widevine.</p>\n<h2 id=\"getting-the-library\"><a href=\"#getting-the-library\">Getting the library</a></h2>\n<p>Open <code>chrome://components/</code> in Chrome browser, find <code>Widevine Content Decryption Module</code> and make sure it is up to date, then you can find the library files from the application directory.</p>\n<h3 id=\"на-windows\"><a href=\"#на-windows\">На Windows</a></h3>\n<p>The library file <code>widevinecdm.dll</code> will be under <code>Program Files(x86)/Google/Chrome/Application/CHROME_VERSION/WidevineCdm/_platform_specific/win_(x86|x64)/</code> directory.</p>\n<h3 id=\"на-macos\"><a href=\"#на-macos\">На macOS</a></h3>\n<p>The library file <code>libwidevinecdm.dylib</code> will be under <code>/Applications/Google Chrome.app/Contents/Versions/CHROME_VERSION/Google Chrome Framework.framework/Versions/A/Libraries/WidevineCdm/_platform_specific/mac_(x86|x64)/</code> directory.</p>\n<p><strong>Note:</strong> Make sure that chrome version used by Electron is greater than or equal to the <code>min_chrome_version</code> value of Chrome's widevine cdm component. The value can be found in <code>manifest.json</code> under <code>WidevineCdm</code> directory.</p>\n<h2 id=\"using-the-library\"><a href=\"#using-the-library\">Using the library</a></h2>\n<p>After getting the library files, you should pass the path to the file with <code>--widevine-cdm-path</code> command line switch, and the library's version with <code>--widevine-cdm-version</code> switch. The command line switches have to be passed before the <code>ready</code> event of <code>app</code> module gets emitted.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// You have to pass the directory that contains widevine library here, it is</span>\n<span class=\"hljs-comment\">// * `libwidevinecdm.dylib` on macOS,</span>\n<span class=\"hljs-comment\">// * `widevinecdm.dll` on Windows.</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'widevine-cdm-path'</span>, <span class=\"hljs-string\">'/path/to/widevine_library'</span>)\n<span class=\"hljs-comment\">// The version of plugin can be got from `chrome://components` page in Chrome.</span>\n\n<span class=\"hljs-number\">8</span>r\nooo6\n</code></pre>\n<h2 id=\"verifying-widevine-cdm-support\"><a href=\"#verifying-widevine-cdm-support\">Verifying Widevine CDM support</a></h2>\n<p>To verify whether widevine works, you can use following ways:</p>\n<ul>\n<li>Open <a href=\"https://shaka-player-demo.appspot.com/\">https://shaka-player-demo.appspot.com/</a> and load a manifest that uses <code>Widevine</code>.</li>\n<li>Open <a href=\"http://www.dash-player.com/demo/drm-test-area/\">http://www.dash-player.com/demo/drm-test-area/</a>, check whether the page says <code>bitdash uses Widevine in your browser</code>, then play the video.</li>\n</ul>",
      "title": "Testing Widevine CDM",
      "description": "Chrome 59 (and later) includes support for Verified Media Path (VMP). VMP provides a method to verify the authenticity of a device platform. For browser deployments, this will provide an additional signal to determine if a browser-based implementation is reliable and secure.\nThe proxy integration guide has been updated with information about VMP and how to issue licenses.\nWidevine recommends our browser-based integrations (vendors and browser-based applications) add support for VMP."
    },
    "/docs/api/structures/thumbar-button": {
      "locale": "ru-RU",
      "slug": "thumbar-button",
      "href": "/docs/api/structures/thumbar-button",
      "crowdinFileId": "256515",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/thumbar-button.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"thumbarbutton-object\"><a href=\"#thumbarbutton-object\">ThumbarButton Object</a></h1>\n<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - The icon showing in thumbnail toolbar.</li>\n<li><code>click</code> Function</li>\n<li><code>tooltip</code> String (optional) - The text of the button's tooltip.</li>\n<li><code>flags</code> String<a href=\"/docs/api/structures/optional\"></a> - Control specific states and behaviors of the button. By default, it is <code>['enabled']</code>.</li>\n</ul>\n<p>The <code>flags</code> is an array that can include following <code>String</code>s:</p>\n<ul>\n<li><code>enabled</code> - The button is active and available to the user.</li>\n<li><code>disabled</code> - The button is disabled. It is present, but has a visual state indicating it will not respond to user action.</li>\n<li><code>dismissonclick</code> - When the button is clicked, the thumbnail window closes immediately.</li>\n<li><code>nobackground</code> - Do not draw a button border, use only the image.</li>\n<li><code>hidden</code> - The button is not shown to the user.</li>\n<li><code>noninteractive</code> - The button is enabled but not interactive; no pressed button state is drawn. This value is intended for instances where the button is used in a notification.</li>\n</ul>",
      "title": "ThumbarButton Object",
      "description": ""
    },
    "/docs/api/touch-bar": {
      "locale": "ru-RU",
      "slug": "touch-bar",
      "href": "/docs/api/touch-bar",
      "crowdinFileId": "256395",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"touchbar\"><a href=\"#touchbar\">TouchBar</a></h1>\n<h2 id=\"class-touchbar\"><a href=\"#class-touchbar\">Class: TouchBar</a></h2>\n<blockquote>\n<p>Create TouchBar layouts for native macOS applications</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<h3 id=\"new-touchbaroptions\"><a href=\"#new-touchbaroptions\"><code>new TouchBar(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>items</code> (<a href=\"/docs/api/touch-bar-button\">TouchBarButton</a> | <a href=\"/docs/api/touch-bar-color-picker\">TouchBarColorPicker</a> | <a href=\"/docs/api/touch-bar-group\">TouchBarGroup</a> | <a href=\"/docs/api/touch-bar-label\">TouchBarLabel</a> | <a href=\"/docs/api/touch-bar-popover\">TouchBarPopover</a> | <a href=\"/docs/api/touch-bar-scrubber\">TouchBarScrubber</a> | <a href=\"/docs/api/touch-bar-segmented-control\">TouchBarSegmentedControl</a> | <a href=\"/docs/api/touch-bar-slider\">TouchBarSlider</a> | <a href=\"/docs/api/touch-bar-spacer\">TouchBarSpacer</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>escapeItem</code> (<a href=\"/docs/api/touch-bar-button\">TouchBarButton</a> | <a href=\"/docs/api/touch-bar-color-picker\">TouchBarColorPicker</a> | <a href=\"/docs/api/touch-bar-group\">TouchBarGroup</a> | <a href=\"/docs/api/touch-bar-label\">TouchBarLabel</a> | <a href=\"/docs/api/touch-bar-popover\">TouchBarPopover</a> | <a href=\"/docs/api/touch-bar-scrubber\">TouchBarScrubber</a> | <a href=\"/docs/api/touch-bar-segmented-control\">TouchBarSegmentedControl</a> | <a href=\"/docs/api/touch-bar-slider\">TouchBarSlider</a> | <a href=\"/docs/api/touch-bar-spacer\">TouchBarSpacer</a> | null) (optional)</li>\n</ul></li>\n</ul>\n<p>Creates a new touch bar with the specified items. Use <code>BrowserWindow.setTouchBar</code> to add the <code>TouchBar</code> to a window.</p>\n<p><strong>Примечание:</strong> TouchBar API в настоящее время является экспериментальным и может быть изменен или удален в будущих версиях Electron.</p>\n<p><strong>Tip:</strong> If you don't have a MacBook with Touch Bar, you can use <a href=\"https://github.com/sindresorhus/touch-bar-simulator\">Touch Bar Simulator</a> to test Touch Bar usage in your app.</p>\n<h3 id=\"static-properties\"><a href=\"#static-properties\">Static Properties</a></h3>\n<h4 id=\"touchbarbutton\"><a href=\"#touchbarbutton\"><code>TouchBarButton</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-button\"><code>typeof TouchBarButton</code></a> reference to the <code>TouchBarButton</code> class.</p>\n<h4 id=\"touchbarcolorpicker\"><a href=\"#touchbarcolorpicker\"><code>TouchBarColorPicker</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-color-picker\"><code>typeof TouchBarColorPicker</code></a> reference to the <code>TouchBarColorPicker</code> class.</p>\n<h4 id=\"touchbargroup\"><a href=\"#touchbargroup\"><code>TouchBarGroup</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-group\"><code>typeof TouchBarGroup</code></a> reference to the <code>TouchBarGroup</code> class.</p>\n<h4 id=\"touchbarlabel\"><a href=\"#touchbarlabel\"><code>TouchBarLabel</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-label\"><code>typeof TouchBarLabel</code></a> reference to the <code>TouchBarLabel</code> class.</p>\n<h4 id=\"touchbarpopover\"><a href=\"#touchbarpopover\"><code>TouchBarPopover</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-popover\"><code>typeof TouchBarPopover</code></a> reference to the <code>TouchBarPopover</code> class.</p>\n<h4 id=\"touchbarscrubber\"><a href=\"#touchbarscrubber\"><code>TouchBarScrubber</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-scrubber\"><code>typeof TouchBarScrubber</code></a> reference to the <code>TouchBarScrubber</code> class.</p>\n<h4 id=\"touchbarsegmentedcontrol\"><a href=\"#touchbarsegmentedcontrol\"><code>TouchBarSegmentedControl</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-segmented-control\"><code>typeof TouchBarSegmentedControl</code></a> reference to the <code>TouchBarSegmentedControl</code> class.</p>\n<h4 id=\"touchbarslider\"><a href=\"#touchbarslider\"><code>TouchBarSlider</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-slider\"><code>typeof TouchBarSlider</code></a> reference to the <code>TouchBarSlider</code> class.</p>\n<h4 id=\"touchbarspacer\"><a href=\"#touchbarspacer\"><code>TouchBarSpacer</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-spacer\"><code>typeof TouchBarSpacer</code></a> reference to the <code>TouchBarSpacer</code> class.</p>\n<h4 id=\"touchbarotheritemsproxy\"><a href=\"#touchbarotheritemsproxy\"><code>TouchBarOtherItemsProxy</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-other-items-proxy\"><code>typeof TouchBarOtherItemsProxy</code></a> reference to the <code>TouchBarOtherItemsProxy</code> class.</p>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<p>The following properties are available on instances of <code>TouchBar</code>:</p>\n<h4 id=\"touchbarescapeitem\"><a href=\"#touchbarescapeitem\"><code>touchBar.escapeItem</code></a></h4>\n<p>A <code>TouchBarItem</code> that will replace the \"esc\" button on the touch bar when set. Setting to <code>null</code> restores the default \"esc\" button. Changing this value immediately updates the escape item in the touch bar.</p>\n<h2 id=\"примеры\"><a href=\"#примеры\">Примеры</a></h2>\n<p>Below is an example of a simple slot machine touch bar game with a button and some labels.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, TouchBar } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> { TouchBarLabel, TouchBarButton, TouchBarSpacer } = TouchBar\n\n<span class=\"hljs-keyword\">let</span> spinning = <span class=\"hljs-literal\">false</span>\n\n<span class=\"hljs-comment\">// Reel labels</span>\n<span class=\"hljs-keyword\">const</span> reel1 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n<span class=\"hljs-keyword\">const</span> reel2 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n<span class=\"hljs-keyword\">const</span> reel3 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n\n<span class=\"hljs-comment\">// Spin result label</span>\n<span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n\n<span class=\"hljs-comment\">// Spin button</span>\n<span class=\"hljs-keyword\">const</span> spin = <span class=\"hljs-keyword\">new</span> TouchBarButton({\n  <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'🎰 Spin'</span>,\n  <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#7851A9'</span>,\n  <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// Ignore clicks if already spinning</span>\n    <span class=\"hljs-keyword\">if</span> (spinning) {\n      <span class=\"hljs-keyword\">return</span>\n    }\n\n    spinning = <span class=\"hljs-literal\">true</span>\n    result.label = <span class=\"hljs-string\">''</span>\n\n    <span class=\"hljs-keyword\">let</span> timeout = <span class=\"hljs-number\">10</span>\n    <span class=\"hljs-keyword\">const</span> spinLength = <span class=\"hljs-number\">4</span> * <span class=\"hljs-number\">1000</span> <span class=\"hljs-comment\">// 4 seconds</span>\n    <span class=\"hljs-keyword\">const</span> startTime = <span class=\"hljs-built_in\">Date</span>.now()\n\n    <span class=\"hljs-keyword\">const</span> spinReels = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      updateReels()\n\n      <span class=\"hljs-keyword\">if</span> ((<span class=\"hljs-built_in\">Date</span>.now() - startTime) >= spinLength) {\n        finishSpin()\n      } <span class=\"hljs-keyword\">else</span> {\n        <span class=\"hljs-comment\">// Slow down a bit on each spin</span>\n        timeout *= <span class=\"hljs-number\">1.1</span>\n        setTimeout(spinReels, timeout)\n      }\n    }\n\n    spinReels()\n  }\n})\n\n<span class=\"hljs-keyword\">const</span> getRandomValue = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> values = [<span class=\"hljs-string\">'🍒'</span>, <span class=\"hljs-string\">'💎'</span>, <span class=\"hljs-string\">'7️⃣'</span>, <span class=\"hljs-string\">'🍊'</span>, <span class=\"hljs-string\">'🔔'</span>, <span class=\"hljs-string\">'⭐'</span>, <span class=\"hljs-string\">'🍇'</span>, <span class=\"hljs-string\">'🍀'</span>]\n  <span class=\"hljs-keyword\">return</span> values[<span class=\"hljs-built_in\">Math</span>.floor(<span class=\"hljs-built_in\">Math</span>.random() * values.length)]\n}\n\n<span class=\"hljs-keyword\">const</span> updateReels = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  reel1.label = getRandomValue()\n  reel2.label = getRandomValue()\n  reel3.label = getRandomValue()\n}\n\n<span class=\"hljs-keyword\">const</span> finishSpin = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> uniqueValues = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Set</span>([reel1.label, reel2.label, reel3.label]).size\n  <span class=\"hljs-keyword\">if</span> (uniqueValues === <span class=\"hljs-number\">1</span>) {\n    <span class=\"hljs-comment\">// All 3 values are the same</span>\n    result.label = <span class=\"hljs-string\">'💰 Jackpot!'</span>\n    result.textColor = <span class=\"hljs-string\">'#FDFF00'</span>\n  } <span class=\"hljs-keyword\">else</span> <span class=\"hljs-keyword\">if</span> (uniqueValues === <span class=\"hljs-number\">2</span>) {\n    <span class=\"hljs-comment\">// 2 values are the same</span>\n    result.label = <span class=\"hljs-string\">'😍 Winner!'</span>\n    result.textColor = <span class=\"hljs-string\">'#FDFF00'</span>\n  } <span class=\"hljs-keyword\">else</span> {\n    <span class=\"hljs-comment\">// No values are the same</span>\n    result.label = <span class=\"hljs-string\">'🙁 Spin Again'</span>\n    result.textColor = <span class=\"hljs-literal\">null</span>\n  }\n  spinning = <span class=\"hljs-literal\">false</span>\n}\n\n<span class=\"hljs-keyword\">const</span> touchBar = <span class=\"hljs-keyword\">new</span> TouchBar({\n  <span class=\"hljs-attr\">items</span>: [\n    spin,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'large'</span> }),\n    reel1,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'small'</span> }),\n    reel2,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'small'</span> }),\n    reel3,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'large'</span> }),\n    result\n  ]\n})\n\n<span class=\"hljs-keyword\">let</span> <span class=\"hljs-built_in\">window</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-built_in\">window</span> = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span>,\n    <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span>,\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#000'</span>\n  })\n  <span class=\"hljs-built_in\">window</span>.loadURL(<span class=\"hljs-string\">'about:blank'</span>)\n  <span class=\"hljs-built_in\">window</span>.setTouchBar(touchBar)\n})\n</code></pre>\n<h3 id=\"running-the-above-example\"><a href=\"#running-the-above-example\">Running the above example</a></h3>\n<p>To run the example above, you'll need to (assuming you've got a terminal open in the directory you want to run the example):</p>\n<ol>\n<li>Save the above file to your computer as <code>touchbar.js</code></li>\n<li>Install Electron via <code>npm install electron</code></li>\n<li>Run the example inside Electron: <code>./node_modules/.bin/electron touchbar.js</code></li>\n</ol>\n<p>You should then see a new Electron window and the app running in your touch bar (or touch bar emulator).</p>",
      "title": "TouchBar",
      "description": "Create TouchBar layouts for native macOS applications"
    },
    "/docs/api/touch-bar-button": {
      "locale": "ru-RU",
      "slug": "touch-bar-button",
      "href": "/docs/api/touch-bar-button",
      "crowdinFileId": "256375",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-button.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"класс-touchbarbutton\"><a href=\"#класс-touchbarbutton\">Класс: TouchBarButton</a></h2>\n<blockquote>\n<p>Создает кнопку в сенсорной панели для нативных приложений macOS</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarbuttonoptions\"><a href=\"#new-touchbarbuttonoptions\"><code>new TouchBarButton(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>label</code> String (необязаельный) - Текст кнопки.</li>\n<li><code>accessibilityLabel</code> String (optional) - A short description of the button for use by screenreaders like VoiceOver.</li>\n<li><code>backgroundColor</code> String (необязательный) - Цвет фона кнопки в шестнадцатиричном представлении, т.е. <code>#ABCDEF</code>.</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String (optional) - Button icon.</li>\n<li><code>iconPosition</code> String (необязательный) - Позиция иконки, может иметь значения <code>left</code>, <code>right</code> или <code>overlay</code>. По умолчанию - <code>overlay</code>.</li>\n<li><code>click</code> Function (необязательный) - Функция которая будет вызвана при нажатии на кнопку.</li>\n<li><code>enabled</code> Boolean (optional) - Whether the button is in an enabled state.  По умолчанию - <code>true</code>.</li>\n</ul></li>\n</ul>\n<p>When defining <code>accessibilityLabel</code>, ensure you have considered macOS <a href=\"https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc\">best practices</a>.</p>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<p>Для экземпляров <code>TouchBarButton</code> доступны следующие свойства:</p>\n<h4 id=\"touchbarbuttonaccessibilitylabel\"><a href=\"#touchbarbuttonaccessibilitylabel\"><code>touchBarButton.accessibilityLabel</code></a></h4>\n<p>A <code>String</code> representing the description of the button to be read by a screen reader. Will only be read by screen readers if no label is set.</p>\n<h4 id=\"touchbarbuttonlabel\"><a href=\"#touchbarbuttonlabel\"><code>touchBarButton.label</code></a></h4>\n<p>Строка (<code>String</code>) представляющая текущий текст кнопки. Изменение этого значения немедленно обновляет кнопку в сенсорной панели.</p>\n<h4 id=\"touchbarbuttonbackgroundcolor\"><a href=\"#touchbarbuttonbackgroundcolor\"><code>touchBarButton.backgroundColor</code></a></h4>\n<p>Строка (<code>String</code>) представляющая текущий цвет кнопки в шестнадцатиричном формате. Изменение этого значения немедленно обновляет кнопку в сенсорной панели.</p>\n<h4 id=\"touchbarbuttonicon\"><a href=\"#touchbarbuttonicon\"><code>touchBarButton.icon</code></a></h4>\n<p><code>NativeImage,</code> представляющее текущую иконку кнопки. Изменение этого значения немедленно обновляет кнопку в сенсорной панели.</p>\n<h4 id=\"touchbarbuttoniconposition\"><a href=\"#touchbarbuttoniconposition\"><code>touchBarButton.iconPosition</code></a></h4>\n<p>A <code>String</code> - Can be <code>left</code>, <code>right</code> or <code>overlay</code>.  По умолчанию - <code>overlay</code>.</p>\n<h4 id=\"touchbarbuttonenabled\"><a href=\"#touchbarbuttonenabled\"><code>touchBarButton.enabled</code></a></h4>\n<p>A <code>Boolean</code> representing whether the button is in an enabled state.</p>",
      "title": "Класс: TouchBarButton",
      "description": "Создает кнопку в сенсорной панели для нативных приложений macOS"
    },
    "/docs/api/touch-bar-color-picker": {
      "locale": "ru-RU",
      "slug": "touch-bar-color-picker",
      "href": "/docs/api/touch-bar-color-picker",
      "crowdinFileId": "256377",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-color-picker.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarcolorpicker\"><a href=\"#class-touchbarcolorpicker\">Class: TouchBarColorPicker</a></h2>\n<blockquote>\n<p>Create a color picker in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarcolorpickeroptions\"><a href=\"#new-touchbarcolorpickeroptions\"><code>new TouchBarColorPicker(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>availableColors</code> String<a href=\"/docs/api/optional\"></a> - Array of hex color strings to appear as possible colors to select.</li>\n<li><code>selectedColor</code> String (optional) - The selected hex color in the picker, i.e <code>#ABCDEF</code>.</li>\n<li><code>change</code> Function (optional) - Function to call when a color is selected.<ul>\n<li><code>color</code> String - The color that the user selected from the picker.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<p>Для экземпляров <code>TouchBarColorPicker</code> доступны следующие свойства:</p>\n<h4 id=\"touchbarcolorpickeravailablecolors\"><a href=\"#touchbarcolorpickeravailablecolors\"><code>touchBarColorPicker.availableColors</code></a></h4>\n<p>A <code>String[]</code> array representing the color picker's available colors to select. Changing this value immediately updates the color picker in the touch bar.</p>\n<h4 id=\"touchbarcolorpickerselectedcolor\"><a href=\"#touchbarcolorpickerselectedcolor\"><code>touchBarColorPicker.selectedColor</code></a></h4>\n<p>A <code>String</code> hex code representing the color picker's currently selected color. Changing this value immediately updates the color picker in the touch bar.</p>",
      "title": "TouchBarColorPicker",
      "description": "Create a color picker in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-group": {
      "locale": "ru-RU",
      "slug": "touch-bar-group",
      "href": "/docs/api/touch-bar-group",
      "crowdinFileId": "256379",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-group.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbargroup\"><a href=\"#class-touchbargroup\">Class: TouchBarGroup</a></h2>\n<blockquote>\n<p>Create a group in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbargroupoptions\"><a href=\"#new-touchbargroupoptions\"><code>new TouchBarGroup(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>items</code> <a href=\"/docs/api/touch-bar\">TouchBar</a> - Items to display as a group.</li>\n</ul></li>\n</ul>",
      "title": "TouchBarGroup",
      "description": "Create a group in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-label": {
      "locale": "ru-RU",
      "slug": "touch-bar-label",
      "href": "/docs/api/touch-bar-label",
      "crowdinFileId": "256381",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-label.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"класс-touchbarlabel\"><a href=\"#класс-touchbarlabel\">Класс: TouchBarLabel</a></h2>\n<blockquote>\n<p>Создает метку на тач-панели, для найтивного macOS-приложения</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarlabeloptions\"><a href=\"#new-touchbarlabeloptions\"><code>new TouchBarLabel(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>label</code> String (optional) - Text to display.</li>\n<li><code>accessibilityLabel</code> String (optional) - A short description of the button for use by screenreaders like VoiceOver.</li>\n<li><code>textColor</code> String (optional) - Hex color of text, i.e <code>#ABCDEF</code>.</li>\n</ul></li>\n</ul>\n<p>When defining <code>accessibilityLabel</code>, ensure you have considered macOS <a href=\"https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc\">best practices</a>.</p>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<p>Для экземпляров <code>TouchBarLabel</code> доступны следующие свойства:</p>\n<h4 id=\"touchbarlabellabel\"><a href=\"#touchbarlabellabel\"><code>touchBarLabel.label</code></a></h4>\n<p>A <code>String</code> representing the label's current text. Changing this value immediately updates the label in the touch bar.</p>\n<h4 id=\"touchbarlabelaccessibilitylabel\"><a href=\"#touchbarlabelaccessibilitylabel\"><code>touchBarLabel.accessibilityLabel</code></a></h4>\n<p>A <code>String</code> representing the description of the label to be read by a screen reader.</p>\n<h4 id=\"touchbarlabeltextcolor\"><a href=\"#touchbarlabeltextcolor\"><code>touchBarLabel.textColor</code></a></h4>\n<p>A <code>String</code> hex code representing the label's current text color. Changing this value immediately updates the label in the touch bar.</p>",
      "title": "Класс: TouchBarLabel",
      "description": "Создает метку на тач-панели, для найтивного macOS-приложения"
    },
    "/docs/api/touch-bar-other-items-proxy": {
      "locale": "ru-RU",
      "slug": "touch-bar-other-items-proxy",
      "href": "/docs/api/touch-bar-other-items-proxy",
      "crowdinFileId": "256383",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-other-items-proxy.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarotheritemsproxy\"><a href=\"#class-touchbarotheritemsproxy\">Class: TouchBarOtherItemsProxy</a></h2>\n<blockquote>\n<p>Instantiates a special \"other items proxy\", which nests TouchBar elements inherited from Chromium at the space indicated by the proxy. By default, this proxy is added to each TouchBar at the end of the input. For more information, see the AppKit docs on <a href=\"https://developer.apple.com/documentation/appkit/nstouchbaritemidentifierotheritemsproxy\">NSTouchBarItemIdentifierOtherItemsProxy</a></p>\n<p>Note: Only one instance of this class can be added per TouchBar.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarotheritemsproxy\"><a href=\"#new-touchbarotheritemsproxy\"><code>new TouchBarOtherItemsProxy()</code></a></h3>",
      "title": "TouchBarOtherItemsProxy",
      "description": "Instantiates a special \"other items proxy\", which nests TouchBar elements inherited from Chromium at the space indicated by the proxy. By default, this proxy is added to each TouchBar at the end of the input. For more information, see the AppKit docs on NSTouchBarItemIdentifierOtherItemsProxy\nNote: Only one instance of this class can be added per TouchBar."
    },
    "/docs/api/touch-bar-popover": {
      "locale": "ru-RU",
      "slug": "touch-bar-popover",
      "href": "/docs/api/touch-bar-popover",
      "crowdinFileId": "256385",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-popover.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarpopover\"><a href=\"#class-touchbarpopover\">Class: TouchBarPopover</a></h2>\n<blockquote>\n<p>Create a popover in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarpopoveroptions\"><a href=\"#new-touchbarpopoveroptions\"><code>new TouchBarPopover(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>label</code> String (optional) - Popover button text.</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> (optional) - Popover button icon.</li>\n<li><code>items</code> <a href=\"/docs/api/touch-bar\">TouchBar</a> - Items to display in the popover.</li>\n<li><code>showCloseButton</code> Boolean (optional) - <code>true</code> to display a close button on the left of the popover, <code>false</code> to not show it. По умолчанию - <code>true</code>.</li>\n</ul></li>\n</ul>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<p>Для экземпляров <code>TouchBarPopover</code> доступны следующие свойства:</p>\n<h4 id=\"touchbarpopoverlabel\"><a href=\"#touchbarpopoverlabel\"><code>touchBarPopover.label</code></a></h4>\n<p>A <code>String</code> representing the popover's current button text. Changing this value immediately updates the popover in the touch bar.</p>\n<h4 id=\"touchbarpopovericon\"><a href=\"#touchbarpopovericon\"><code>touchBarPopover.icon</code></a></h4>\n<p>A <code>NativeImage</code> representing the popover's current button icon. Changing this value immediately updates the popover in the touch bar.</p>",
      "title": "TouchBarPopover",
      "description": "Create a popover in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-scrubber": {
      "locale": "ru-RU",
      "slug": "touch-bar-scrubber",
      "href": "/docs/api/touch-bar-scrubber",
      "crowdinFileId": "256387",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-scrubber.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarscrubber\"><a href=\"#class-touchbarscrubber\">Class: TouchBarScrubber</a></h2>\n<blockquote>\n<p>Create a scrubber (a scrollable selector)</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarscrubberoptions\"><a href=\"#new-touchbarscrubberoptions\"><code>new TouchBarScrubber(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>items</code> <a href=\"/docs/api/structures/scrubber-item\">ScrubberItem[]</a> - An array of items to place in this scrubber.</li>\n<li><code>select</code> Function (optional) - Called when the user taps an item that was not the last tapped item.<ul>\n<li><code>selectedIndex</code> Integer - The index of the item the user selected.</li>\n</ul></li>\n<li><code>highlight</code> Function (optional) - Called when the user taps any item.<ul>\n<li><code>highlightedIndex</code> Integer - The index of the item the user touched.</li>\n</ul></li>\n<li><code>selectedStyle</code> String (optional) - Selected item style. Can be <code>background</code>, <code>outline</code> or <code>none</code>. Defaults to <code>none</code>.</li>\n<li><code>overlayStyle</code> String (optional) - Selected overlay item style. Can be <code>background</code>, <code>outline</code> or <code>none</code>. Defaults to <code>none</code>.</li>\n<li><code>showArrowButtons</code> Boolean (опционально) - если нужно показать кнопки со стрелками. По умолчанию <code>false</code> и показывается только если <code>элемент</code> присутствует.</li>\n<li><code>mode</code> String (опционально) - Может быть <code>fixed</code> или <code>free</code>. The default is <code>free</code>.</li>\n<li><code>continuous</code> Boolean (опиционально) - по умолчанию <code>true</code>.</li>\n</ul></li>\n</ul>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<p>The following properties are available on instances of <code>TouchBarScrubber</code>:</p>\n<h4 id=\"touchbarscrubberitems\"><a href=\"#touchbarscrubberitems\"><code>touchBarScrubber.items</code></a></h4>\n<p>A <code>ScrubberItem[]</code> array representing the items in this scrubber. Updating this value immediately updates the control in the touch bar. Updating deep properties inside this array <strong>does not update the touch bar</strong>.</p>\n<h4 id=\"touchbarscrubberselectedstyle\"><a href=\"#touchbarscrubberselectedstyle\"><code>touchBarScrubber.selectedStyle</code></a></h4>\n<p>A <code>String</code> representing the style that selected items in the scrubber should have. Updating this value immediately updates the control in the touch bar. Возможные значения:</p>\n<ul>\n<li><code>background</code> - Maps to <code>[NSScrubberSelectionStyle roundedBackgroundStyle]</code>.</li>\n<li><code>outline</code> - Maps to <code>[NSScrubberSelectionStyle outlineOverlayStyle]</code>.</li>\n<li><code>none</code> - Removes all styles.</li>\n</ul>\n<h4 id=\"touchbarscrubberoverlaystyle\"><a href=\"#touchbarscrubberoverlaystyle\"><code>touchBarScrubber.overlayStyle</code></a></h4>\n<p>A <code>String</code> representing the style that selected items in the scrubber should have. This style is overlayed on top of the scrubber item instead of being placed behind it. Updating this value immediately updates the control in the touch bar. Возможные значения:</p>\n<ul>\n<li><code>background</code> - Maps to <code>[NSScrubberSelectionStyle roundedBackgroundStyle]</code>.</li>\n<li><code>outline</code> - Maps to <code>[NSScrubberSelectionStyle outlineOverlayStyle]</code>.</li>\n<li><code>none</code> - Removes all styles.</li>\n</ul>\n<h4 id=\"touchbarscrubbershowarrowbuttons\"><a href=\"#touchbarscrubbershowarrowbuttons\"><code>touchBarScrubber.showArrowButtons</code></a></h4>\n<p>A <code>Boolean</code> representing whether to show the left / right selection arrows in this scrubber. Updating this value immediately updates the control in the touch bar.</p>\n<h4 id=\"touchbarscrubbermode\"><a href=\"#touchbarscrubbermode\"><code>touchBarScrubber.mode</code></a></h4>\n<p>A <code>String</code> representing the mode of this scrubber. Updating this value immediately updates the control in the touch bar. Возможные значения:</p>\n<ul>\n<li><code>fixed</code> - Maps to <code>NSScrubberModeFixed</code>.</li>\n<li><code>free</code> - Maps to <code>NSScrubberModeFree</code>.</li>\n</ul>\n<h4 id=\"touchbarscrubbercontinuous\"><a href=\"#touchbarscrubbercontinuous\"><code>touchBarScrubber.continuous</code></a></h4>\n<p>A <code>Boolean</code> representing whether this scrubber is continuous or not. Updating this value immediately updates the control in the touch bar.</p>",
      "title": "TouchBarScrubber",
      "description": "Create a scrubber (a scrollable selector)"
    },
    "/docs/api/touch-bar-segmented-control": {
      "locale": "ru-RU",
      "slug": "touch-bar-segmented-control",
      "href": "/docs/api/touch-bar-segmented-control",
      "crowdinFileId": "256389",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-segmented-control.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"класс-touchbarsegmentedcontrol\"><a href=\"#класс-touchbarsegmentedcontrol\">Класс: TouchBarSegmentedControl</a></h2>\n<blockquote>\n<p>Create a segmented control (a button group) where one button has a selected state</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarsegmentedcontroloptions\"><a href=\"#new-touchbarsegmentedcontroloptions\"><code>new TouchBarSegmentedControl(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>segmentStyle</code> String (optional) - Style of the segments:<ul>\n<li><code>automatic</code> - Default. The appearance of the segmented control is automatically determined based on the type of window in which the control is displayed and the position within the window. Maps to <code>NSSegmentStyleAutomatic</code>.</li>\n<li><code>rounded</code> - The control is displayed using the rounded style. Maps to <code>NSSegmentStyleRounded</code>.</li>\n<li><code>textured-rounded</code> - The control is displayed using the textured rounded style. Maps to <code>NSSegmentStyleTexturedRounded</code>.</li>\n<li><code>round-rect</code> - The control is displayed using the round rect style. Maps to <code>NSSegmentStyleRoundRect</code>.</li>\n<li><code>textured-square</code> - The control is displayed using the textured square style. Maps to <code>NSSegmentStyleTexturedSquare</code>.</li>\n<li><code>capsule</code> - The control is displayed using the capsule style. Maps to <code>NSSegmentStyleCapsule</code>.</li>\n<li><code>small-square</code> - The control is displayed using the small square style. Maps to <code>NSSegmentStyleSmallSquare</code>.</li>\n<li><code>separated</code> - The segments in the control are displayed very close to each other but not touching. Maps to <code>NSSegmentStyleSeparated</code>.</li>\n</ul></li>\n<li><code>mode</code> String (optional) - The selection mode of the control:<ul>\n<li><code>single</code> - Default. One item selected at a time, selecting one deselects the previously selected item. Maps to <code>NSSegmentSwitchTrackingSelectOne</code>.</li>\n<li><code>multiple</code> - Multiple items can be selected at a time. Maps to <code>NSSegmentSwitchTrackingSelectAny</code>.</li>\n<li><code>buttons</code> - Make the segments act as buttons, each segment can be pressed and released but never marked as active. Maps to <code>NSSegmentSwitchTrackingMomentary</code>.</li>\n</ul></li>\n<li><code>segments</code> <a href=\"/docs/api/structures/segmented-control-segment\">SegmentedControlSegment[]</a> - An array of segments to place in this control.</li>\n<li><code>selectedIndex</code> Integer (optional) - The index of the currently selected segment, will update automatically with user interaction. When the mode is <code>multiple</code> it will be the last selected item.</li>\n<li><code>change</code> Function (optional) - Called when the user selects a new segment.<ul>\n<li><code>selectedIndex</code> Integer - The index of the segment the user selected.</li>\n<li><code>isSelected</code> Boolean - Whether as a result of user selection the segment is selected or not.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<p>Для экземпляров <code>TouchBarSegmentedControl</code> доступны следующие свойства:</p>\n<h4 id=\"touchbarsegmentedcontrolsegmentstyle\"><a href=\"#touchbarsegmentedcontrolsegmentstyle\"><code>touchBarSegmentedControl.segmentStyle</code></a></h4>\n<p>A <code>String</code> representing the controls current segment style. Updating this value immediately updates the control in the touch bar.</p>\n<h4 id=\"touchbarsegmentedcontrolsegments\"><a href=\"#touchbarsegmentedcontrolsegments\"><code>touchBarSegmentedControl.segments</code></a></h4>\n<p>A <code>SegmentedControlSegment[]</code> array representing the segments in this control. Updating this value immediately updates the control in the touch bar. Updating deep properties inside this array <strong>does not update the touch bar</strong>.</p>\n<h4 id=\"touchbarsegmentedcontrolselectedindex\"><a href=\"#touchbarsegmentedcontrolselectedindex\"><code>touchBarSegmentedControl.selectedIndex</code></a></h4>\n<p>An <code>Integer</code> representing the currently selected segment. Changing this value immediately updates the control in the touch bar. User interaction with the touch bar will update this value automatically.</p>\n<h4 id=\"touchbarsegmentedcontrolmode\"><a href=\"#touchbarsegmentedcontrolmode\"><code>touchBarSegmentedControl.mode</code></a></h4>\n<p>A <code>String</code> representing the current selection mode of the control.  Can be <code>single</code>, <code>multiple</code> or <code>buttons</code>.</p>",
      "title": "Класс: TouchBarSegmentedControl",
      "description": "Create a segmented control (a button group) where one button has a selected state"
    },
    "/docs/api/touch-bar-slider": {
      "locale": "ru-RU",
      "slug": "touch-bar-slider",
      "href": "/docs/api/touch-bar-slider",
      "crowdinFileId": "256391",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-slider.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarslider\"><a href=\"#class-touchbarslider\">Class: TouchBarSlider</a></h2>\n<blockquote>\n<p>Create a slider in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarslideroptions\"><a href=\"#new-touchbarslideroptions\"><code>new TouchBarSlider(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>label</code> String (optional) - Label text.</li>\n<li><code>value</code> Integer (optional) - Selected value.</li>\n<li><code>minValue</code> Integer (optional) - Minimum value.</li>\n<li><code>maxValue</code> Integer (optional) - Maximum value.</li>\n<li><code>change</code> Function (optional) - Function to call when the slider is changed.<ul>\n<li><code>newValue</code> Number - The value that the user selected on the Slider.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<p>Для экземпляров <code>TouchBarSlider</code> доступны следующие свойства:</p>\n<h4 id=\"touchbarsliderlabel\"><a href=\"#touchbarsliderlabel\"><code>touchBarSlider.label</code></a></h4>\n<p>A <code>String</code> representing the slider's current text. Changing this value immediately updates the slider in the touch bar.</p>\n<h4 id=\"touchbarslidervalue\"><a href=\"#touchbarslidervalue\"><code>touchBarSlider.value</code></a></h4>\n<p>A <code>Number</code> representing the slider's current value. Changing this value immediately updates the slider in the touch bar.</p>\n<h4 id=\"touchbarsliderminvalue\"><a href=\"#touchbarsliderminvalue\"><code>touchBarSlider.minValue</code></a></h4>\n<p>A <code>Number</code> representing the slider's current minimum value. Changing this value immediately updates the slider in the touch bar.</p>\n<h4 id=\"touchbarslidermaxvalue\"><a href=\"#touchbarslidermaxvalue\"><code>touchBarSlider.maxValue</code></a></h4>\n<p>A <code>Number</code> representing the slider's current maximum value. Changing this value immediately updates the slider in the touch bar.</p>",
      "title": "TouchBarSlider",
      "description": "Create a slider in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-spacer": {
      "locale": "ru-RU",
      "slug": "touch-bar-spacer",
      "href": "/docs/api/touch-bar-spacer",
      "crowdinFileId": "256393",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-spacer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarspacer\"><a href=\"#class-touchbarspacer\">Class: TouchBarSpacer</a></h2>\n<blockquote>\n<p>Создает разделитель между двумя элементами в сенсорной панели для нативных приложений macOS</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarspaceroptions\"><a href=\"#new-touchbarspaceroptions\"><code>new TouchBarSpacer(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>size</code> String (optional) - Size of spacer, possible values are:<ul>\n<li><code>small</code> - Небольшое пространство между элементами. Maps to <code>NSTouchBarItemIdentifierFixedSpaceSmall</code>. This is the default.</li>\n<li><code>large</code> - Большое пространство между элементами. Maps to <code>NSTouchBarItemIdentifierFixedSpaceLarge</code>.</li>\n<li><code>flexible</code> - Занимает всё доступное пространство. Maps to <code>NSTouchBarItemIdentifierFlexibleSpace</code>.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<p>The following properties are available on instances of <code>TouchBarSpacer</code>:</p>\n<h4 id=\"touchbarspacersize\"><a href=\"#touchbarspacersize\"><code>touchBarSpacer.size</code></a></h4>\n<p>A <code>String</code> representing the size of the spacer.  Can be <code>small</code>, <code>large</code> or <code>flexible</code>.</p>",
      "title": "TouchBarSpacer",
      "description": "Создает разделитель между двумя элементами в сенсорной панели для нативных приложений macOS"
    },
    "/docs/api/structures/trace-categories-and-options": {
      "locale": "ru-RU",
      "slug": "trace-categories-and-options",
      "href": "/docs/api/structures/trace-categories-and-options",
      "crowdinFileId": "256517",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/trace-categories-and-options.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"tracecategoriesandoptions-object\"><a href=\"#tracecategoriesandoptions-object\">TraceCategoriesAndOptions Object</a></h1>\n<ul>\n<li><code>categoryFilter</code> String - A filter to control what category groups should be traced. A filter can have an optional '-' prefix to exclude category groups that contain a matching category. Having both included and excluded category patterns in the same list is not supported. Examples: <code>test_MyTest*</code>, <code>test_MyTest*,test_OtherStuff</code>, <code>-excluded_category1,-excluded_category2</code>.</li>\n<li><code>traceOptions</code> String - Controls what kind of tracing is enabled, it is a comma-delimited sequence of the following strings: <code>record-until-full</code>, <code>record-continuously</code>, <code>trace-to-console</code>, <code>enable-sampling</code>, <code>enable-systrace</code>, e.g. <code>'record-until-full,enable-sampling'</code>. The first 3 options are trace recording modes and hence mutually exclusive. If more than one trace recording modes appear in the <code>traceOptions</code> string, the last one takes precedence. If none of the trace recording modes are specified, recording mode is <code>record-until-full</code>. The trace option will first be reset to the default option (<code>record_mode</code> set to <code>record-until-full</code>, <code>enable_sampling</code> and <code>enable_systrace</code> set to <code>false</code>) before options parsed from <code>traceOptions</code> are applied on it.</li>\n</ul>",
      "title": "TraceCategoriesAndOptions Object",
      "description": ""
    },
    "/docs/api/structures/trace-config": {
      "locale": "ru-RU",
      "slug": "trace-config",
      "href": "/docs/api/structures/trace-config",
      "crowdinFileId": "256519",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/trace-config.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"traceconfig-object\"><a href=\"#traceconfig-object\">TraceConfig Object</a></h1>\n<ul>\n<li><code>recording_mode</code> String (optional) - Can be <code>record-until-full</code>, <code>record-continuously</code>, <code>record-as-much-as-possible</code> or <code>trace-to-console</code>. Defaults to <code>record-until-full</code>.</li>\n<li><code>trace_buffer_size_in_kb</code> number (optional) - maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.</li>\n<li><code>trace_buffer_size_in_events</code> number (optional) - maximum size of the trace recording buffer in events.</li>\n<li><code>enable_argument_filter</code> boolean (optional) - if true, filter event data according to a specific list of events that have been manually vetted to not include any PII. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/services/tracing/public/cpp/trace_event_args_whitelist.cc\">the implementation in Chromium</a> for specifics.</li>\n<li><code>included_categories</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of tracing categories to include. Can include glob-like patterns using <code>*</code> at the end of the category name. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">tracing categories</a> for the list of categories.</li>\n<li><code>excluded_categories</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of tracing categories to exclude. Can include glob-like patterns using <code>*</code> at the end of the category name. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">tracing categories</a> for the list of categories.</li>\n<li><code>included_process_ids</code> number<a href=\"/docs/api/structures/optional\"></a> - a list of process IDs to include in the trace. If not specified, trace all processes.</li>\n<li><code>histogram_names</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of <a href=\"https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md\">histogram</a> names to report with the trace.</li>\n<li><code>memory_dump_config</code> Record&#x3C;String, any> (optional) - if the <code>disabled-by-default-memory-infra</code> category is enabled, this contains optional additional configuration for data collection. See the <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/memory-infra/memory_infra_startup_tracing.md#the-advanced-way\">Chromium memory-infra docs</a> for more information.</li>\n</ul>\n<p>An example TraceConfig that roughly matches what Chrome DevTools records:</p>\n<pre><code class=\"hljs language-js\">{\n  <span class=\"hljs-attr\">recording_mode</span>: <span class=\"hljs-string\">'record-until-full'</span>,\n  <span class=\"hljs-attr\">included_categories</span>: [\n    <span class=\"hljs-string\">'devtools.timeline'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline.frame'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline.stack'</span>,\n    <span class=\"hljs-string\">'v8.execute'</span>,\n    <span class=\"hljs-string\">'blink.console'</span>,\n    <span class=\"hljs-string\">'blink.user_timing'</span>,\n    <span class=\"hljs-string\">'latencyInfo'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-v8.cpu_profiler'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-v8.cpu_profiler.hires'</span>\n  ],\n  <span class=\"hljs-attr\">excluded_categories</span>: [<span class=\"hljs-string\">'*'</span>]\n}\n</code></pre>",
      "title": "TraceConfig Object",
      "description": ""
    },
    "/docs/api/structures/transaction": {
      "locale": "ru-RU",
      "slug": "transaction",
      "href": "/docs/api/structures/transaction",
      "crowdinFileId": "256521",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/transaction.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"transaction-object\"><a href=\"#transaction-object\">Transaction Object</a></h1>\n<ul>\n<li><code>transactionIdentifier</code> String - A string that uniquely identifies a successful payment transaction.</li>\n<li><code>transactionDate</code> String - The date the transaction was added to the App Store’s payment queue.</li>\n<li><code>originalTransactionIdentifier</code> String - The identifier of the restored transaction by the App Store.</li>\n<li><code>transactionState</code> String - The transaction state, can be <code>purchasing</code>, <code>purchased</code>, <code>failed</code>, <code>restored</code> or <code>deferred</code>.</li>\n<li><code>errorCode</code> Integer - The error code if an error occurred while processing the transaction.</li>\n<li><code>errorMessage</code> String - The error message if an error occurred while processing the transaction.</li>\n<li><code>payment</code> Object<ul>\n<li><code>productIdentifier</code> String - The identifier of the purchased product.</li>\n<li><code>quantity</code> Integer  - The quantity purchased.</li>\n</ul></li>\n</ul>",
      "title": "Transaction Object",
      "description": ""
    },
    "/docs/api/tray": {
      "locale": "ru-RU",
      "slug": "tray",
      "href": "/docs/api/tray",
      "crowdinFileId": "256397",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/tray.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"tray\"><a href=\"#tray\">Tray</a></h1>\n<h2 id=\"class-tray\"><a href=\"#class-tray\">Class: Tray</a></h2>\n<blockquote>\n<p>Добавить иконки и контекстные меню в системную область уведомлений.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p><code>Tray</code> является <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>'ом.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> tray = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/my/icon'</span>)\n  <span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item3'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item4'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n  ])\n  tray.setToolTip(<span class=\"hljs-string\">'This is my application.'</span>)\n  tray.setContextMenu(contextMenu)\n})\n</code></pre>\n<p><strong>Ограничения платформ:</strong></p>\n<ul>\n<li>В Linux индикатор приложения будет использован, если он поддерживается, иначе будет использован <code>GtkStatusIcon</code>.</li>\n<li>В дистрибутивах Linux, которые поддерживают только индикаторы приложений, вы должны установите <code>libappindicator1</code>, чтобы значок в трее заработал.</li>\n<li>Индикатор приложения будет отображаться только при наличии контекстного меню.</li>\n<li>Когда индикатор приложения используется в Linux, событие <code>click</code> игнорируется.</li>\n<li>On Linux in order for changes made to individual <code>MenuItem</code>s to take effect, you have to call <code>setContextMenu</code> again. Например:</li>\n</ul>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> appIcon = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/my/icon'</span>)\n  <span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n  ])\n\n  <span class=\"hljs-comment\">// Make a change to the context menu</span>\n  contextMenu.items[<span class=\"hljs-number\">1</span>].checked = <span class=\"hljs-literal\">false</span>\n\n  <span class=\"hljs-comment\">// Call this again for Linux because we modified the context menu</span>\n  appIcon.setContextMenu(contextMenu)\n})\n</code></pre>\n<ul>\n<li>В Windows рекомендуется использовать значки <code>ICO</code> для получения лучших визуальных эффектов.</li>\n</ul>\n<p>Если вы хотите сохранить одинаковое поведение на всех платформах, вам не следует полагаться на событие <code>click</code> и всегда прикреплять контекстное меню к значку в трее.</p>\n<h3 id=\"new-trayimage-guid\"><a href=\"#new-trayimage-guid\"><code>new Tray(image, [guid])</code></a></h3>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n<li><code>guid</code> String (optional) <em>Windows</em> - Assigns a GUID to the tray icon. If the executable is signed and the signature contains an organization in the subject line then the GUID is permanently associated with that signature. OS level settings like the position of the tray icon in the system tray will persist even if the path to the executable changes. If the executable is not code-signed then the GUID is permanently associated with the path to the executable. Changing the path to the executable will break the creation of the tray icon and a new GUID must be used. However, it is highly recommended to use the GUID parameter only in conjunction with code-signed executable. If an App defines multiple tray icons then each icon must use a separate GUID.</li>\n</ul>\n<p>Создаёт новую иконку в трее, связанную с <code>image</code>.</p>\n<h3 id=\"события-экземпляра\"><a href=\"#события-экземпляра\">События экземпляра</a></h3>\n<p>Модуль <code>Tray</code> генерирует следующие события:</p>\n<h4 id=\"событие-click\"><a href=\"#событие-click\">Событие: 'click'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - границы иконки в трее.</li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - позиция события.</li>\n</ul>\n<p>Вызывается при двойном клике на иконке в трее.</p>\n<h4 id=\"событие-right-click-macos-windows\"><a href=\"#событие-right-click-macos-windows\">Событие: 'right-click' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - границы иконки в трее.</li>\n</ul>\n<p>Возникает при правом клике на иконке в трее.</p>\n<h4 id=\"событие-double-click-macos-windows\"><a href=\"#событие-double-click-macos-windows\">Событие: 'double-click' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - границы иконки в трее.</li>\n</ul>\n<p>Вызывается при двойном нажатии на иконку в трее.</p>\n<h4 id=\"событие-balloon-show-windows\"><a href=\"#событие-balloon-show-windows\">Событие: 'balloon-show' <em>Windows</em></a></h4>\n<p>Возникает при всплывающем сообщении в трее.</p>\n<h4 id=\"событие-balloon-click-windows\"><a href=\"#событие-balloon-click-windows\">Событие: 'balloon-click' <em>Windows</em></a></h4>\n<p>Вызывается при клике на всплывающем сообщении в трее.</p>\n<h4 id=\"событие-balloon-closed-windows\"><a href=\"#событие-balloon-closed-windows\">Событие: 'balloon-closed' <em>Windows</em></a></h4>\n<p>Возникает, когда всплывающее сообщение в трее закрыто из-за тайм-аута или вручную пользователем.</p>\n<h4 id=\"событие-drop-macos\"><a href=\"#событие-drop-macos\">Событие: 'drop' <em>macOS</em></a></h4>\n<p>Возникает при перетаскивании элементов на значок в трее.</p>\n<h4 id=\"событие-drop-files-macos\"><a href=\"#событие-drop-files-macos\">Событие: 'drop-files' <em>macOS</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>files</code> String[] - пути брошенных файлов.</li>\n</ul>\n<p>Возникает при перетаскивании файлов на значок в трее.</p>\n<h4 id=\"событие-drop-text-macos\"><a href=\"#событие-drop-text-macos\">Событие: 'drop-text' <em>macOS</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>text</code> String - брошенная текстовая строка.</li>\n</ul>\n<p>Возникает при перетаскивании строки на значок в трее.</p>\n<h4 id=\"событие-drag-enter-macos\"><a href=\"#событие-drag-enter-macos\">Событие: 'drag-enter' <em>macOS</em></a></h4>\n<p>Возникает, когда операция перетаскивания происходит на иконке в трее.</p>\n<h4 id=\"событие-drag-leave-macos\"><a href=\"#событие-drag-leave-macos\">Событие: 'drag-leave' <em>macOS</em></a></h4>\n<p>Возникает, когда операция перетаскивания завершилась на иконке в трее.</p>\n<h4 id=\"событие-drag-end-macos\"><a href=\"#событие-drag-end-macos\">Событие: 'drag-end' <em>macOS</em></a></h4>\n<p>Возникает, когда операция перетаскивания заканчивается в трее или заканчивается в другом месте.</p>\n<h4 id=\"event-mouse-up-macos\"><a href=\"#event-mouse-up-macos\">Event: 'mouse-up' <em>macOS</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - позиция события.</li>\n</ul>\n<p>Emitted when the mouse is released from clicking the tray icon.</p>\n<p>Note: This will not be emitted if you have set a context menu for your Tray using <code>tray.setContextMenu</code>, as a result of macOS-level constraints.</p>\n<h4 id=\"event-mouse-down-macos\"><a href=\"#event-mouse-down-macos\">Event: 'mouse-down' <em>macOS</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - позиция события.</li>\n</ul>\n<p>Emitted when the mouse clicks the tray icon.</p>\n<h4 id=\"событие-mouse-enter-macos\"><a href=\"#событие-mouse-enter-macos\">Событие: 'mouse-enter' <em>macOS</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - позиция события.</li>\n</ul>\n<p>Возникает при входе курсора мыши на иконку в трее.</p>\n<h4 id=\"событие-mouse-leave-macos\"><a href=\"#событие-mouse-leave-macos\">Событие: 'mouse-leave' <em>macOS</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - позиция события.</li>\n</ul>\n<p>Возникает при выходе курсора мыши с иконки в трее.</p>\n<h4 id=\"событие-mouse-move-macos-windows\"><a href=\"#событие-mouse-move-macos-windows\">Событие: 'mouse-move' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - позиция события.</li>\n</ul>\n<p>Возникает при перемещении мыши на значке в трее.</p>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<p>Класс <code>Tray</code> имеет следующие методы:</p>\n<h4 id=\"traydestroy\"><a href=\"#traydestroy\"><code>tray.destroy()</code></a></h4>\n<p>Немедленно уничтожить иконку в трее.</p>\n<h4 id=\"traysetimageimage\"><a href=\"#traysetimageimage\"><code>tray.setImage(image)</code></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>Устанавливает <code>image</code> ассоциированный с значком в трее.</p>\n<h4 id=\"traysetpressedimageimage-macos\"><a href=\"#traysetpressedimageimage-macos\"><code>tray.setPressedImage(image)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>Устанавливает <code>image</code>, связанное с этим значком в трее, при нажатии в macOS.</p>\n<h4 id=\"traysettooltiptooltip\"><a href=\"#traysettooltiptooltip\"><code>tray.setToolTip(toolTip)</code></a></h4>\n<ul>\n<li><code>toolTip</code> String</li>\n</ul>\n<p>Устанавливает текст отображаемый при наведении на значок в трее.</p>\n<h4 id=\"traysettitletitle-options-macos\"><a href=\"#traysettitletitle-options-macos\"><code>tray.setTitle(title[, options])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>title</code> String</li>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>fontType</code> String (опционально) - Вариант семейства шрифтов для отображения, может быть <code>моноширинным</code> или <code>цифро-моноширинным</code>. <code>monospaced</code> is available in macOS 10.15+ and <code>monospacedDigit</code> is available in macOS 10.11+.  По умолчанию используют системный шрифт по умолчанию.</li>\n</ul></li>\n</ul>\n<p>Устанавливает заголовок, отображаемый рядом со значком в строке состояния (поддержка ANSI цветов).</p>\n<h4 id=\"traygettitle-macos\"><a href=\"#traygettitle-macos\"><code>tray.getTitle()</code> <em>macOS</em></a></h4>\n<p>Возвращает <code>String</code> - заголовок, отображаемый рядом со значком в области уведомлений в строке состояния</p>\n<h4 id=\"traysetignoredoubleclickeventsignore-macos\"><a href=\"#traysetignoredoubleclickeventsignore-macos\"><code>tray.setIgnoreDoubleClickEvents(ignore)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>ignore</code> Логическое значение</li>\n</ul>\n<p>Sets the option to ignore double click events. Ignoring these events allows you to detect every individual click of the tray icon.</p>\n<p>Значение по умолчанию установлено в значение false.</p>\n<h4 id=\"traygetignoredoubleclickevents-macos\"><a href=\"#traygetignoredoubleclickevents-macos\"><code>tray.getIgnoreDoubleClickEvents()</code> <em>macOS</em></a></h4>\n<p>Возвращает <code>Boolean</code> - будет ли игнорироваться события двойного щелчка.</p>\n<h4 id=\"traydisplayballoonoptions-windows\"><a href=\"#traydisplayballoonoptions-windows\"><code>tray.displayBalloon(options)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (optional) - Icon to use when <code>iconType</code> is <code>custom</code>.</li>\n<li><code>iconType</code> String (optional) - Can be <code>none</code>, <code>info</code>, <code>warning</code>, <code>error</code> or <code>custom</code>. По умолчанию - <code>custom</code>.</li>\n<li><code>title</code> String</li>\n<li><code>content</code> String</li>\n<li><code>largeIcon</code> Boolean (optional) - The large version of the icon should be used. По умолчанию - <code>true</code>. Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_large_icon-0x00000020\"><code>NIIF_LARGE_ICON</code></a>.</li>\n<li><code>noSound</code> Boolean (опционально) - Не проигрывать соответствующий звук. По умолчанию - <code>false</code>. Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_nosound-0x00000010\"><code>NIIF_NOSOUND</code></a>.</li>\n<li><code>respectQuietTime</code> Boolean (optional) - Do not display the balloon notification if the current user is in \"quiet time\". По умолчанию - <code>false</code>. Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_respect_quiet_time-0x00000080\"><code>NIIF_RESPECT_QUIET_TIME</code></a>.</li>\n</ul></li>\n</ul>\n<p>Отображает всплывающее сообщение в трее.</p>\n<h4 id=\"trayremoveballoon-windows\"><a href=\"#trayremoveballoon-windows\"><code>tray.removeBalloon()</code> <em>Windows</em></a></h4>\n<p>Удаляет всплывающее уведомление в трее.</p>\n<h4 id=\"trayfocus-windows\"><a href=\"#trayfocus-windows\"><code>tray.focus()</code> <em>Windows</em></a></h4>\n<p>Возвращает фокус в область уведомления панели задач. Notification area icons should use this message when they have completed their UI operation. For example, if the icon displays a shortcut menu, but the user presses ESC to cancel it, use <code>tray.focus()</code> to return focus to the notification area.</p>\n<h4 id=\"traypopupcontextmenumenu-position-macos-windows\"><a href=\"#traypopupcontextmenumenu-position-macos-windows\"><code>tray.popUpContextMenu([menu, position])</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>menu</code> Menu (опционально)</li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> (optional) - позиция всплывающего сообщения.</li>\n</ul>\n<p>Pops up the context menu of the tray icon. When <code>menu</code> is passed, the <code>menu</code> will be shown instead of the tray icon's context menu.</p>\n<p><code>position</code> доступна только для Windows, и это (0, 0) по умолчанию.</p>\n<h4 id=\"trayclosecontextmenu-macos-windows\"><a href=\"#trayclosecontextmenu-macos-windows\"><code>tray.closeContextMenu()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Closes an open context menu, as set by <code>tray.setContextMenu()</code>.</p>\n<h4 id=\"traysetcontextmenumenu\"><a href=\"#traysetcontextmenumenu\"><code>tray.setContextMenu(menu)</code></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Устанавливает контекстное меню для этого значка.</p>\n<h4 id=\"traygetbounds-macos-windows\"><a href=\"#traygetbounds-macos-windows\"><code>tray.getBounds()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Возвращает <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p><code>bounds</code> значка в трее как <code>Object</code>.</p>\n<h4 id=\"trayisdestroyed\"><a href=\"#trayisdestroyed\"><code>tray.isDestroyed()</code></a></h4>\n<p>Возвращает <code>Boolean</code> - уничтожен ли значок в трее.</p>",
      "title": "Tray",
      "description": "Добавить иконки и контекстные меню в системную область уведомлений."
    },
    "/docs/tutorial/tray": {
      "locale": "ru-RU",
      "slug": "tray",
      "href": "/docs/tutorial/tray",
      "crowdinFileId": "256259",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/tray.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<hr>\n<p>title: Tray\ndescription: This guide will take you through the process of creating a Tray icon with its own context menu to the system's notification area.\nslug: tray</p>\n<h2 id=\"hide_title-true\"><a href=\"#hide_title-true\">hide_title: true</a></h2>\n<h1 id=\"tray\"><a href=\"#tray\">Tray</a></h1>\n<h2 id=\"обзор\"><a href=\"#обзор\">Обзор</a></h2>\n<!-- ✍ Update this section if you want to provide more details -->\n<p>This guide will take you through the process of creating a <a href=\"https://www.electronjs.org/docs/api/tray\">Tray</a> icon with its own context menu to the system's notification area.</p>\n<p>On MacOS and Ubuntu, the Tray will be located on the top right corner of your screen, adjacent to your battery and wifi icons. On Windows, the Tray will usually be located in the bottom right corner.</p>\n<h2 id=\"пример\"><a href=\"#пример\">Пример</a></h2>\n<h3 id=\"mainjs\"><a href=\"#mainjs\">main.js</a></h3>\n<p>First we must import <code>app</code>, <code>Tray</code>, <code>Menu</code>, <code>nativeImage</code> from <code>electron</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, Tray, Menu, nativeImage } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>Next we will create our Tray. To do this, we will use a <a href=\"https://www.electronjs.org/docs/api/native-image\"><code>NativeImage</code></a> icon, which can be created through any one of these <a href=\"https://www.electronjs.org/docs/api/native-image#methods\">methods</a>. Note that we wrap our Tray creation code within an <a href=\"https://www.electronjs.org/docs/api/app#appwhenready\"><code>app.whenReady</code></a> as we will need to wait for our electron app to finish initializing.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">let</span> tray\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> icon = nativeImage.createFromPath(<span class=\"hljs-string\">'path/to/asset.png'</span>)\n  tray = <span class=\"hljs-keyword\">new</span> Tray(icon)\n\n  <span class=\"hljs-comment\">// note: your contextMenu, Tooltip and Title code will go here!</span>\n})\n</code></pre>\n<p>Great! Now we can start attaching a context menu to our Tray, like so:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item3'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item4'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n])\n\ntray.setContextMenu(contextMenu)\n</code></pre>\n<p>The code above will create 4 separate radio-type items in the context menu. To read more about constructing native menus, click <a href=\"https://www.electronjs.org/docs/api/menu#menubuildfromtemplatetemplate\">here</a>.</p>\n<p>Finally, let's give our tray a tooltip and a title.</p>\n<pre><code class=\"hljs language-js\">tray.setToolTip(<span class=\"hljs-string\">'This is my application'</span>)\ntray.setTitle(<span class=\"hljs-string\">'This is my title'</span>)\n</code></pre>\n<h2 id=\"conclusion\"><a href=\"#conclusion\">Conclusion</a></h2>\n<p>After you start your electron app, you should see the Tray residing in either the top or bottom right of your screen, depending on your operating system.\n<code>fiddle docs/fiddles/native-ui/tray</code></p>",
      "title": "Tray",
      "description": ""
    },
    "/docs/tutorial/updates": {
      "locale": "ru-RU",
      "slug": "updates",
      "href": "/docs/tutorial/updates",
      "crowdinFileId": "256261",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/updates.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"обновление-приложений\"><a href=\"#обновление-приложений\">Обновление приложений</a></h1>\n<p>Существует несколько способов по обновлению Electron приложений. Самый простой и официально поддерживаемый - воспользоваться встроенным <a href=\"https://github.com/Squirrel\">Squirrel</a> фреймворком и модулем Electron <a href=\"/docs/api/auto-updater\">autoUpdater</a>.</p>\n<h2 id=\"используя-updateelectronjsorg\"><a href=\"#используя-updateelectronjsorg\">Используя <code>update.electronjs.org</code></a></h2>\n<p>The Electron team maintains <a href=\"https://github.com/electron/update.electronjs.org\">update.electronjs.org</a>, a free and open-source webservice that Electron apps can use to self-update. Сервис разработан для приложений Electron, отвечающих следующим критериям:</p>\n<ul>\n<li>Приложение работает на macOS или Windows</li>\n<li>Приложение имеет публичный GitHub репозиторий</li>\n<li>Сборки публикуются в GitHub Releases</li>\n<li>Сборки с кодовой подписью</li>\n</ul>\n<p>Самый простой способ использовать этот сервис - установить <a href=\"https://github.com/electron/update-electron-app\">update-electron-app</a>, модуль Node.js, сконфигурированный для использования с update.electronjs.org.</p>\n<p>Установить модуль:</p>\n<pre><code class=\"hljs language-sh\">npm install update-electron-app\n</code></pre>\n<p>Вызвать обновление из основного файла процесса вашего приложения:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'update-electron-app'</span>)()\n</code></pre>\n<p>По умолчанию этот модуль будет проверять наличие обновлений при запуске приложения, а затем каждые десять минут. При обнаружении обновления оно будет автоматически загружено в фоновом режиме. Когда загрузка завершится, будет отображено диалоговое окно, позволяющее пользователю перезапустить приложение.</p>\n<p>Если вам нужно настроить конфигурацию, вы можете <a href=\"https://github.com/electron/update-electron-app\">передать параметры в <code>update-electron-app</code></a> или <a href=\"https://github.com/electron/update.electronjs.org\">использовать службу обновления напрямую</a>.</p>\n<h2 id=\"развертывание-сервера-обновлений\"><a href=\"#развертывание-сервера-обновлений\">Развертывание сервера обновлений</a></h2>\n<p>If you're developing a private Electron application, or if you're not publishing releases to GitHub Releases, it may be necessary to run your own update server.</p>\n<p>Depending on your needs, you can choose from one of these:</p>\n<ul>\n<li><a href=\"https://github.com/vercel/hazel\">Hazel</a> – сервер обновлений для частных приложений или приложений с открытым исходным кодом, которые можно бесплатно развернуть на <a href=\"https://vercel.com\">Vercel</a>. It pulls from <a href=\"https://help.github.com/articles/creating-releases/\">GitHub Releases</a> and leverages the power of GitHub's CDN.</li>\n<li><a href=\"https://github.com/GitbookIO/nuts\">Nuts</a> – Also uses <a href=\"https://help.github.com/articles/creating-releases/\">GitHub Releases</a>, but caches app updates on disk and supports private repositories.</li>\n<li><a href=\"https://github.com/ArekSredzki/electron-release-server\">electron-release-server</a> – Provides a dashboard for handling releases and does not require releases to originate on GitHub.</li>\n<li><a href=\"https://github.com/atlassian/nucleus\">Nucleus</a> – A complete update server for Electron apps maintained by Atlassian. Supports multiple applications and channels; uses a static file store to minify server cost.</li>\n</ul>\n<h2 id=\"внедрение-обновлений-в-ваше-приложение\"><a href=\"#внедрение-обновлений-в-ваше-приложение\">Внедрение обновлений в Ваше приложение</a></h2>\n<p>Once you've deployed your update server, continue with importing the required modules in your code. The following code might vary for different server software, but it works like described when using <a href=\"https://github.com/vercel/hazel\">Hazel</a>.</p>\n<p><strong>Important:</strong> Please ensure that the code below will only be executed in your packaged app, and not in development. You can use <a href=\"https://github.com/sindresorhus/electron-is-dev\">electron-is-dev</a> to check for the environment.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, autoUpdater, dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>Next, construct the URL of the update server and tell <a href=\"/docs/api/auto-updater\">autoUpdater</a> about it:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> server = <span class=\"hljs-string\">'https://your-deployment-url.com'</span>\n<span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-string\">`<span class=\"hljs-subst\">${server}</span>/update/<span class=\"hljs-subst\">${process.platform}</span>/<span class=\"hljs-subst\">${app.getVersion()}</span>`</span>\n\nautoUpdater.setFeedURL({ url })\n</code></pre>\n<p>As the final step, check for updates. The example below will check every minute:</p>\n<pre><code class=\"hljs language-javascript\">setInterval(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  autoUpdater.checkForUpdates()\n}, <span class=\"hljs-number\">60000</span>)\n</code></pre>\n<p>Once your application is <a href=\"/docs/tutorial/application-distribution\">packaged</a>, it will receive an update for each new <a href=\"https://help.github.com/articles/creating-releases/\">GitHub Release</a> that you publish.</p>\n<h2 id=\"применение-обновлений\"><a href=\"#применение-обновлений\">Применение обновлений</a></h2>\n<p>Now that you've configured the basic update mechanism for your application, you need to ensure that the user will get notified when there's an update. This can be achieved using the autoUpdater API <a href=\"/docs/api/auto-updater#events\">events</a>:</p>\n<pre><code class=\"hljs language-javascript\">autoUpdater.on(<span class=\"hljs-string\">'update-downloaded'</span>, (event, releaseNotes, releaseName) => {\n  <span class=\"hljs-keyword\">const</span> dialogOpts = {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'info'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Restart'</span>, <span class=\"hljs-string\">'Later'</span>],\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Application Update'</span>,\n    <span class=\"hljs-attr\">message</span>: process.platform === <span class=\"hljs-string\">'win32'</span> ? releaseNotes : releaseName,\n    <span class=\"hljs-attr\">detail</span>: <span class=\"hljs-string\">'A new version has been downloaded. Restart the application to apply the updates.'</span>\n  }\n\n  dialog.showMessageBox(dialogOpts).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">returnValue</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (returnValue.response === <span class=\"hljs-number\">0</span>) autoUpdater.quitAndInstall()\n  })\n})\n</code></pre>\n<p>Also make sure that errors are <a href=\"/docs/api/auto-updater#event-error\">being handled</a>. Here's an example for logging them to <code>stderr</code>:</p>\n<pre><code class=\"hljs language-javascript\">autoUpdater.on(<span class=\"hljs-string\">'error'</span>, message => {\n  <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'There was a problem updating the application'</span>)\n  <span class=\"hljs-built_in\">console</span>.error(message)\n})\n</code></pre>\n<h2 id=\"handling-updates-manually\"><a href=\"#handling-updates-manually\">Handling Updates Manually</a></h2>\n<p>Because the requests made by Auto Update aren't under your direct control, you may find situations that are difficult to handle (such as if the update server is behind authentication). The <code>url</code> field does support files, which means that with some effort, you can sidestep the server-communication aspect of the process. <a href=\"https://github.com/electron/electron/issues/5020#issuecomment-477636990\">Here's an example of how this could work</a>.</p>",
      "title": "Обновление приложений",
      "description": ""
    },
    "/docs/api/structures/upload-data": {
      "locale": "ru-RU",
      "slug": "upload-data",
      "href": "/docs/api/structures/upload-data",
      "crowdinFileId": "256523",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploaddata-object\"><a href=\"#uploaddata-object\">UploadData Object</a></h1>\n<ul>\n<li><code>bytes</code> Buffer - Content being sent.</li>\n<li><code>file</code> String (optional) - Path of file being uploaded.</li>\n<li><code>blobUUID</code> String (optional) - UUID of blob data. Use <a href=\"/docs/api/session#sesgetblobdataidentifier\">ses.getBlobData</a> method to retrieve the data.</li>\n</ul>",
      "title": "UploadData Object",
      "description": ""
    },
    "/docs/api/structures/upload-file": {
      "locale": "ru-RU",
      "slug": "upload-file",
      "href": "/docs/api/structures/upload-file",
      "crowdinFileId": "256525",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-file.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploadfile-object\"><a href=\"#uploadfile-object\">UploadFile Object</a></h1>\n<ul>\n<li><code>type</code> 'file' - <code>file</code>.</li>\n<li><code>filePath</code> String - Path of file to be uploaded.</li>\n<li><code>offset</code> Integer - Defaults to <code>0</code>.</li>\n<li><code>length</code> Integer - Number of bytes to read from <code>offset</code>. Defaults to <code>0</code>.</li>\n<li><code>modificationTime</code> Double - Last Modification time in number of seconds since the UNIX epoch.</li>\n</ul>",
      "title": "UploadFile Object",
      "description": ""
    },
    "/docs/api/structures/upload-raw-data": {
      "locale": "ru-RU",
      "slug": "upload-raw-data",
      "href": "/docs/api/structures/upload-raw-data",
      "crowdinFileId": "256527",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-raw-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploadrawdata-object\"><a href=\"#uploadrawdata-object\">UploadRawData Object</a></h1>\n<ul>\n<li><code>type</code> 'rawData' - <code>rawData</code>.</li>\n<li><code>bytes</code> Buffer - Data to be uploaded.</li>\n</ul>",
      "title": "UploadRawData Object",
      "description": ""
    },
    "/docs/api/structures/user-default-types": {
      "locale": "ru-RU",
      "slug": "user-default-types",
      "href": "/docs/api/structures/user-default-types",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/user-default-types.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"userdefaulttypes-object\"><a href=\"#userdefaulttypes-object\">UserDefaultTypes Object</a></h1>\n<ul>\n<li>Строка <code>string</code></li>\n<li><code>boolean</code> Boolean</li>\n<li><code>integer</code> Number</li>\n<li><code>float</code> Number</li>\n<li><code>double</code> Number</li>\n<li><code>url</code> String</li>\n<li><code>array</code> Array\\<unknown></unknown></li>\n<li><code>dictionary</code> Record\\&#x3C;string, unknown></li>\n</ul>\n<p>This type is a helper alias, no object will never exist of this type.</p>",
      "title": "UserDefaultTypes Object",
      "description": ""
    },
    "/docs/tutorial/using-native-node-modules": {
      "locale": "ru-RU",
      "slug": "using-native-node-modules",
      "href": "/docs/tutorial/using-native-node-modules",
      "crowdinFileId": "256263",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-native-node-modules.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"native-node-modules\"><a href=\"#native-node-modules\">Native Node Modules</a></h1>\n<p>Native Node.js modules are supported by Electron, but since Electron has a different <a href=\"https://en.wikipedia.org/wiki/Application_binary_interface\">application binary interface (ABI)</a> from a given Node.js binary (due to differences such as using Chromium's BoringSSL instead of OpenSSL), the native modules you use will need to be recompiled for Electron. Иначе, при запуске приложения вы получите следующий класс ошибок:</p>\n<pre><code class=\"hljs language-sh\">Error: The module <span class=\"hljs-string\">'/path/to/native/module.node'</span>\nwas compiled against a different Node.js version using\nNODE_MODULE_VERSION <span class=\"hljs-variable\">$XYZ</span>. This version of Node.js requires\nNODE_MODULE_VERSION <span class=\"hljs-variable\">$ABC</span>. Please try re-compiling or re-installing\nthe module (<span class=\"hljs-keyword\">for</span> instance, using `npm rebuild` or `npm install`).\n</code></pre>\n<h2 id=\"как-установить-нативные-модули\"><a href=\"#как-установить-нативные-модули\">Как установить нативные модули</a></h2>\n<p>Существует несколько способов установки нативных модулей:</p>\n<h3 id=\"installing-modules-and-rebuilding-for-electron\"><a href=\"#installing-modules-and-rebuilding-for-electron\">Installing modules and rebuilding for Electron</a></h3>\n<p>You can install modules like other Node projects, and then rebuild the modules for Electron with the <a href=\"https://github.com/electron/electron-rebuild\"><code>electron-rebuild</code></a> package. This module can automatically determine the version of Electron and handle the manual steps of downloading headers and rebuilding native modules for your app. If you are using <a href=\"https://electronforge.io/\">Electron Forge</a>, this tool is used automatically in both development mode and when making distributables.</p>\n<p>For example, to install the standalone <code>electron-rebuild</code> tool and then rebuild modules with it via the command line:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron-rebuild\n\n<span class=\"hljs-comment\"># Every time you run \"npm install\", run this:</span>\n./node_modules/.bin/electron-rebuild\n\n<span class=\"hljs-comment\"># If you have trouble on Windows, try:</span>\n.\\node_modules\\.bin\\electron-rebuild.cmd\n</code></pre>\n<p>For more information on usage and integration with other tools such as <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a>, consult the project's README.</p>\n<h3 id=\"при-помощи-npm\"><a href=\"#при-помощи-npm\">При помощи <code>npm</code></a></h3>\n<p>Устанавливая несколько переменных среды, вы можете использовать <code>npm</code> для непосредственной установки модулей.</p>\n<p>For example, to install all dependencies for Electron:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-comment\"># Electron's version.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_target=1.2.3\n<span class=\"hljs-comment\"># The architecture of Electron, see https://electronjs.org/docs/tutorial/support#supported-platforms</span>\n<span class=\"hljs-comment\"># for supported architectures.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_arch=x64\n<span class=\"hljs-built_in\">export</span> npm_config_target_arch=x64\n<span class=\"hljs-comment\"># Download headers for Electron.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_disturl=https://electronjs.org/headers\n<span class=\"hljs-comment\"># Говорит node-pre-gyp, что мы собираем для Electron.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_runtime=electron\n<span class=\"hljs-comment\"># Tell node-pre-gyp to build module from source code.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_build_from_source=<span class=\"hljs-literal\">true</span>\n<span class=\"hljs-comment\"># Install all dependencies, and store cache to ~/.electron-gyp.</span>\nHOME=~/.electron-gyp npm install\n</code></pre>\n<h3 id=\"manually-building-for-electron\"><a href=\"#manually-building-for-electron\">Manually building for Electron</a></h3>\n<p>If you are a developer developing a native module and want to test it against Electron, you might want to rebuild the module for Electron manually. You can use <code>node-gyp</code> directly to build for Electron:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">cd</span> /path-to-module/\nHOME=~/.electron-gyp node-gyp rebuild --target=1.2.3 --arch=x64 --dist-url=https://electronjs.org/headers\n</code></pre>\n<ul>\n<li><code>HOME=~/.electron-gyp</code> changes where to find development headers.</li>\n<li><code>--target=1.2.3</code> is the version of Electron.</li>\n<li><code>--dist-url=...</code> specifies where to download the headers.</li>\n<li><code>--arch=x64</code> says the module is built for a 64-bit system.</li>\n</ul>\n<h3 id=\"manually-building-for-a-custom-build-of-electron\"><a href=\"#manually-building-for-a-custom-build-of-electron\">Manually building for a custom build of Electron</a></h3>\n<p>To compile native Node modules against a custom build of Electron that doesn't match a public release, instruct <code>npm</code> to use the version of Node you have bundled with your custom build.</p>\n<pre><code class=\"hljs language-sh\">npm rebuild --nodedir=/path/to/src/out/Default/gen/node_headers\n</code></pre>\n<h2 id=\"устранение-проблем\"><a href=\"#устранение-проблем\">Устранение проблем</a></h2>\n<p>If you installed a native module and found it was not working, you need to check the following things:</p>\n<ul>\n<li>When in doubt, run <code>electron-rebuild</code> first.</li>\n<li>Make sure the native module is compatible with the target platform and architecture for your Electron app.</li>\n<li>Make sure <code>win_delay_load_hook</code> is not set to <code>false</code> in the module's <code>binding.gyp</code>.</li>\n<li>After you upgrade Electron, you usually need to rebuild the modules.</li>\n</ul>\n<h3 id=\"a-note-about-win_delay_load_hook\"><a href=\"#a-note-about-win_delay_load_hook\">A note about <code>win_delay_load_hook</code></a></h3>\n<p>On Windows, by default, <code>node-gyp</code> links native modules against <code>node.dll</code>. However, in Electron 4.x and higher, the symbols needed by native modules are exported by <code>electron.exe</code>, and there is no <code>node.dll</code>. In order to load native modules on Windows, <code>node-gyp</code> installs a <a href=\"https://msdn.microsoft.com/en-us/library/z9h1h6ty.aspx\">delay-load hook</a> that triggers when the native module is loaded, and redirects the <code>node.dll</code> reference to use the loading executable instead of looking for <code>node.dll</code> in the library search path (which would turn up nothing). As such, on Electron 4.x and higher, <code>'win_delay_load_hook': 'true'</code> is required to load native modules.</p>\n<p>If you get an error like <code>Module did not self-register</code>, or <code>The specified procedure could not be found</code>, it may mean that the module you're trying to use did not correctly include the delay-load hook.  If the module is built with node-gyp, ensure that the <code>win_delay_load_hook</code> variable is set to <code>true</code> in the <code>binding.gyp</code> file, and isn't getting overridden anywhere.  If the module is built with another system, you'll need to ensure that you build with a delay-load hook installed in the main <code>.node</code> file. Your <code>link.exe</code> invocation should look like this:</p>\n<pre><code class=\"hljs language-plaintext\"> link.exe /OUT:\"foo.node\" \"...\\node.lib\" delayimp.lib /DELAYLOAD:node.exe /DLL\n     \"my_addon.obj\" \"win_delay_load_hook.obj\"\n</code></pre>\n<p>In particular, it's important that:</p>\n<ul>\n<li>you link against <code>node.lib</code> from <em>Electron</em> and not Node. If you link against the wrong <code>node.lib</code> you will get load-time errors when you require the module in Electron.</li>\n<li>you include the flag <code>/DELAYLOAD:node.exe</code>. If the <code>node.exe</code> link is not delayed, then the delay-load hook won't get a chance to fire and the node symbols won't be correctly resolved.</li>\n<li><code>win_delay_load_hook.obj</code> is linked directly into the final DLL. If the hook is set up in a dependent DLL, it won't fire at the right time.</li>\n</ul>\n<p>See <a href=\"https://github.com/nodejs/node-gyp/blob/e2401e1395bef1d3c8acec268b42dc5fb71c4a38/src/win_delay_load_hook.cc\"><code>node-gyp</code></a> for an example delay-load hook if you're implementing your own.</p>\n<h2 id=\"modules-that-rely-on-prebuild\"><a href=\"#modules-that-rely-on-prebuild\">Modules that rely on <code>prebuild</code></a></h2>\n<p><a href=\"https://github.com/prebuild/prebuild\"><code>prebuild</code></a> provides a way to publish native Node modules with prebuilt binaries for multiple versions of Node and Electron.</p>\n<p>If the <code>prebuild</code>-powered module provide binaries for the usage in Electron, make sure to omit <code>--build-from-source</code> and the <code>npm_config_build_from_source</code> environment variable in order to take full advantage of the prebuilt binaries.</p>\n<h2 id=\"modules-that-rely-on-node-pre-gyp\"><a href=\"#modules-that-rely-on-node-pre-gyp\">Modules that rely on <code>node-pre-gyp</code></a></h2>\n<p>The <a href=\"https://github.com/mapbox/node-pre-gyp\"><code>node-pre-gyp</code> tool</a> provides a way to deploy native Node modules with prebuilt binaries, and many popular modules are using it.</p>\n<p>Sometimes those modules work fine under Electron, but when there are no Electron-specific binaries available, you'll need to build from source. Because of this, it is recommended to use <code>electron-rebuild</code> for these modules.</p>\n<p>If you are following the <code>npm</code> way of installing modules, you'll need to pass <code>--build-from-source</code> to <code>npm</code>, or set the <code>npm_config_build_from_source</code> environment variable.</p>",
      "title": "Native Node Modules",
      "description": ""
    },
    "/docs/tutorial/using-pepper-flash-plugin": {
      "locale": "ru-RU",
      "slug": "using-pepper-flash-plugin",
      "href": "/docs/tutorial/using-pepper-flash-plugin",
      "crowdinFileId": "256265",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-pepper-flash-plugin.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"pepper-flash-plugin\"><a href=\"#pepper-flash-plugin\">Pepper Flash Plugin</a></h1>\n<p>Electron no longer supports the Pepper Flash plugin, as Chrome has removed support.</p>\n<p>See <a href=\"https://www.chromium.org/flash-roadmap\">Chromium's Flash Roadmap</a> for more details.</p>",
      "title": "Pepper Flash Plugin",
      "description": ""
    },
    "/docs/tutorial/using-selenium-and-webdriver": {
      "locale": "ru-RU",
      "slug": "using-selenium-and-webdriver",
      "href": "/docs/tutorial/using-selenium-and-webdriver",
      "crowdinFileId": "256267",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-selenium-and-webdriver.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"selenium-and-webdriver\"><a href=\"#selenium-and-webdriver\">Selenium and WebDriver</a></h1>\n<p>От <a href=\"https://sites.google.com/a/chromium.org/chromedriver/\">ChromeDriver - WebDriver для Chrome</a>:</p>\n<blockquote>\n<p>WebDriver — это инструмент с открытым исходным кодом для автоматизации тестирования веб-приложений во многих браузерах. Он предоставляет возможности для навигации на веб-страницы, ввода пользователя, - выполнение JavaScript и многое другое. ChromeDriver - это автономный сервер, который использует протокол провода WebDriver для Chromium. Он разрабатывается членами команд Chromium и WebDriver.</p>\n</blockquote>\n<h2 id=\"настройка-spectron\"><a href=\"#настройка-spectron\">Настройка Spectron</a></h2>\n<p><a href=\"https://electronjs.org/spectron\">Spectron</a> - официально поддерживаемая среда тестирования ChromeDriver для Electron. Он построен на основе <a href=\"https://webdriver.io/\">WebdriverIO</a> и имеет помощников для доступа к API Electron в ваших тестах и в комплекте с ChromeDriver.</p>\n<pre><code class=\"hljs language-sh\">$ npm install --save-dev spectron\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Простой тест для проверки того, что видимое окно открывается с заголовком</span>\n<span class=\"hljs-keyword\">const</span> Application = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spectron'</span>).Application\n<span class=\"hljs-keyword\">const</span> assert = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'assert'</span>)\n\n<span class=\"hljs-keyword\">const</span> myApp = <span class=\"hljs-keyword\">new</span> Application({\n  <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'/Applications/MyApp.app/Contents/MacOS/MyApp'</span>\n})\n\n<span class=\"hljs-keyword\">const</span> verifyWindowIsVisibleWithTitle = <span class=\"hljs-keyword\">async</span> (app) => {\n  <span class=\"hljs-keyword\">await</span> app.start()\n  <span class=\"hljs-keyword\">try</span> {\n    <span class=\"hljs-comment\">// Проверить, видно ли окно</span>\n    <span class=\"hljs-keyword\">const</span> isVisible = <span class=\"hljs-keyword\">await</span> app.browserWindow.isVisible()\n    <span class=\"hljs-comment\">// Убедиться что окно видимое</span>\n    assert.strictEqual(isVisible, <span class=\"hljs-literal\">true</span>)\n    <span class=\"hljs-comment\">// Получить заголовок окна</span>\n    <span class=\"hljs-keyword\">const</span> title = <span class=\"hljs-keyword\">await</span> app.client.getTitle()\n    <span class=\"hljs-comment\">// Проверить заголовок окна</span>\n    assert.strictEqual(title, <span class=\"hljs-string\">'Мое Приложение'</span>)\n  } <span class=\"hljs-keyword\">catch</span> (error) {\n    <span class=\"hljs-comment\">// Журналировать любые сбои</span>\n    <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Тест не пройден'</span>, error.message)\n  }\n  <span class=\"hljs-comment\">// Остановить приложение</span>\n  <span class=\"hljs-keyword\">await</span> app.stop()\n}\n\nverifyWindowIsVisibleWithTitle(myApp)\n</code></pre>\n<h2 id=\"настройка-с-помощью-webdriverjs\"><a href=\"#настройка-с-помощью-webdriverjs\">Настройка с помощью WebDriverJs</a></h2>\n<p><a href=\"https://www.selenium.dev/selenium/docs/api/javascript/index.html\">WebDriverJs</a> provides a Node package for testing with web driver, we will use it as an example.</p>\n<h3 id=\"1-start-chromedriver\"><a href=\"#1-start-chromedriver\">1. Start ChromeDriver</a></h3>\n<p>Сначала вам нужно скачать бинарный файл <code>chromedriver</code> и запустить его:</p>\n<pre><code class=\"hljs language-sh\">$ npm install electron-chromedriver\n$ ./node_modules/.bin/chromedriver\nStarting ChromeDriver (v2.10.291558) on port 9515\nOnly <span class=\"hljs-built_in\">local</span> connections are allowed.\n</code></pre>\n<p>Запомните номер порта <code>9515</code>, который будет использоваться позже</p>\n<h3 id=\"2-install-webdriverjs\"><a href=\"#2-install-webdriverjs\">2. Install WebDriverJS</a></h3>\n<pre><code class=\"hljs language-sh\">$ npm install selenium-webdriver\n</code></pre>\n<h3 id=\"3-connect-to-chromedriver\"><a href=\"#3-connect-to-chromedriver\">3. Connect to ChromeDriver</a></h3>\n<p>The usage of <code>selenium-webdriver</code> with Electron is the same with upstream, except that you have to manually specify how to connect chrome driver and where to find Electron's binary:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webdriver = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'selenium-webdriver'</span>)\n\n<span class=\"hljs-keyword\">const</span> driver = <span class=\"hljs-keyword\">new</span> webdriver.Builder()\n  <span class=\"hljs-comment\">// The \"9515\" is the port opened by chrome driver.</span>\n  .usingServer(<span class=\"hljs-string\">'http://localhost:9515'</span>)\n  .withCapabilities({\n    <span class=\"hljs-string\">'goog:chromeOptions'</span>: {\n      <span class=\"hljs-comment\">// Here is the path to your Electron binary.</span>\n      <span class=\"hljs-attr\">binary</span>: <span class=\"hljs-string\">'/Path-to-Your-App.app/Contents/MacOS/Electron'</span>\n    }\n  })\n  .forBrowser(<span class=\"hljs-string\">'chrome'</span>) <span class=\"hljs-comment\">// note: use .forBrowser('electron') for selenium-webdriver &#x3C;= 3.6.0</span>\n  .build()\n\ndriver.get(<span class=\"hljs-string\">'http://www.google.com'</span>)\ndriver.findElement(webdriver.By.name(<span class=\"hljs-string\">'q'</span>)).sendKeys(<span class=\"hljs-string\">'webdriver'</span>)\ndriver.findElement(webdriver.By.name(<span class=\"hljs-string\">'btnG'</span>)).click()\ndriver.wait(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">return</span> driver.getTitle().then(<span class=\"hljs-function\">(<span class=\"hljs-params\">title</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> title === <span class=\"hljs-string\">'webdriver - Google Search'</span>\n  })\n}, <span class=\"hljs-number\">1000</span>)\n\ndriver.quit()\n</code></pre>\n<h2 id=\"setting-up-with-webdriverio\"><a href=\"#setting-up-with-webdriverio\">Setting up with WebdriverIO</a></h2>\n<p><a href=\"https://webdriver.io/\">WebdriverIO</a> provides a Node package for testing with web driver.</p>\n<h3 id=\"1-start-chromedriver-1\"><a href=\"#1-start-chromedriver-1\">1. Start ChromeDriver</a></h3>\n<p>Сначала вам нужно скачать бинарный файл <code>chromedriver</code> и запустить его:</p>\n<pre><code class=\"hljs language-sh\">$ npm install electron-chromedriver\n$ ./node_modules/.bin/chromedriver --url-base=wd/hub --port=9515\nStarting ChromeDriver (v2.10.291558) on port 9515\nOnly <span class=\"hljs-built_in\">local</span> connections are allowed.\n</code></pre>\n<p>Запомните номер порта <code>9515</code>, который будет использоваться позже</p>\n<h3 id=\"2-install-webdriverio\"><a href=\"#2-install-webdriverio\">2. Install WebdriverIO</a></h3>\n<pre><code class=\"hljs language-sh\">$ npm install webdriverio\n</code></pre>\n<h3 id=\"3-connect-to-chrome-driver\"><a href=\"#3-connect-to-chrome-driver\">3. Connect to chrome driver</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webdriverio = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'webdriverio'</span>)\n<span class=\"hljs-keyword\">const</span> options = {\n  <span class=\"hljs-attr\">host</span>: <span class=\"hljs-string\">'localhost'</span>, <span class=\"hljs-comment\">// Use localhost as chrome driver server</span>\n  <span class=\"hljs-attr\">port</span>: <span class=\"hljs-number\">9515</span>, <span class=\"hljs-comment\">// \"9515\" is the port opened by chrome driver.</span>\n  <span class=\"hljs-attr\">desiredCapabilities</span>: {\n    <span class=\"hljs-attr\">browserName</span>: <span class=\"hljs-string\">'chrome'</span>,\n    <span class=\"hljs-string\">'goog:chromeOptions'</span>: {\n      <span class=\"hljs-attr\">binary</span>: <span class=\"hljs-string\">'/Path-to-Your-App/electron'</span>, <span class=\"hljs-comment\">// Path to your Electron binary.</span>\n      <span class=\"hljs-attr\">args</span>: [<span class=\"hljs-comment\">/* cli arguments */</span>] <span class=\"hljs-comment\">// Optional, perhaps 'app=' + /path/to/your/app/</span>\n    }\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> client = webdriverio.remote(options)\n\nclient\n  .init()\n  .url(<span class=\"hljs-string\">'http://google.com'</span>)\n  .setValue(<span class=\"hljs-string\">'#q'</span>, <span class=\"hljs-string\">'webdriverio'</span>)\n  .click(<span class=\"hljs-string\">'#btnG'</span>)\n  .getTitle().then(<span class=\"hljs-function\">(<span class=\"hljs-params\">title</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Title was: '</span> + title)\n  })\n  .end()\n</code></pre>\n<h2 id=\"workflow\"><a href=\"#workflow\">Workflow</a></h2>\n<p>To test your application without rebuilding Electron, <a href=\"/docs/tutorial/application-distribution\">place</a> your app source into Electron's resource directory.</p>\n<p>Alternatively, pass an argument to run with your Electron binary that points to your app's folder. This eliminates the need to copy-paste your app into Electron's resource directory.</p>",
      "title": "Selenium and WebDriver",
      "description": "WebDriver — это инструмент с открытым исходным кодом для автоматизации тестирования веб-приложений во многих браузерах. Он предоставляет возможности для навигации на веб-страницы, ввода пользователя, - выполнение JavaScript и многое другое. ChromeDriver - это автономный сервер, который использует протокол провода WebDriver для Chromium. Он разрабатывается членами команд Chromium и WebDriver."
    },
    "/docs/development/v8-development": {
      "locale": "ru-RU",
      "slug": "v8-development",
      "href": "/docs/development/v8-development",
      "crowdinFileId": "256171",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/v8-development.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"разработка-v8\"><a href=\"#разработка-v8\">Разработка V8</a></h1>\n<blockquote>\n<p>Коллекция ссылок для изучения и использования V8</p>\n</blockquote>\n<ul>\n<li><a href=\"https://v8.dev/docs/trace\">Трассировка V8</a></li>\n<li><a href=\"https://v8.dev/docs/profile\">V8 Profiler</a> - комбинации команд профайлера, которые могут быть полезными: <code>--prof</code>, <code>--trace-ic</code>, <code>--trace-opt</code>, <code>--trace-deopt</code>, <code>--print-bytecode</code>, <code>--print-opt-code</code></li>\n<li><a href=\"https://docs.google.com/document/d/11T2CRex9hXxoJwbYqVQ32yIPMh0uouUZLdyrtmMoL44/edit?ts=56f27d9d#heading=h.6jz9dj3bnr8t\">Дизайн интерпретатора V8</a></li>\n<li><a href=\"https://v8.dev/docs/turbofan\">Оптимизация компилятора</a></li>\n<li><a href=\"https://v8.dev/docs/gdb-jit\">Отладка V8 в GDB</a></li>\n</ul>\n<p>См. также <a href=\"/docs/development/chromium-development\">Разработка Chromium</a></p>",
      "title": "Разработка V8",
      "description": "Коллекция ссылок для изучения и использования V8"
    },
    "/docs/api/web-contents": {
      "locale": "ru-RU",
      "slug": "web-contents",
      "href": "/docs/api/web-contents",
      "crowdinFileId": "256399",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-contents.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webcontents\"><a href=\"#webcontents\">webContents</a></h1>\n<blockquote>\n<p>Render and control web pages.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p><code>webContents</code> является <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>'ом. Он ответственен за рендер и управление веб-страницы и является свойством объекта <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. Пример доступа к объекту <code>webContents</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> contents = win.webContents\n<span class=\"hljs-built_in\">console</span>.log(contents)\n</code></pre>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>Эти методы доступны из модуля <code>webContents</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(webContents)\n</code></pre>\n<h3 id=\"webcontentsgetallwebcontents\"><a href=\"#webcontentsgetallwebcontents\"><code>webContents.getAllWebContents()</code></a></h3>\n<p>Возвращает <code>WebContents</code> - массив всех экземпляров <code>WebContents</code>. Этот массив содержит веб-контент всех окон, webviews, открытых инструментов разработчика и расширений инструментов разработчика на фоновых страницах.</p>\n<h3 id=\"webcontentsgetfocusedwebcontents\"><a href=\"#webcontentsgetfocusedwebcontents\"><code>webContents.getFocusedWebContents()</code></a></h3>\n<p>Возвращает <code>WebContents</code> - веб-контент, который сейчас активен в этом приложении, в ином случае возвращает <code>null</code>.</p>\n<h3 id=\"webcontentsfromidid\"><a href=\"#webcontentsfromidid\"><code>webContents.fromId(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Returns <code>WebContents</code> | undefined - A WebContents instance with the given ID, or <code>undefined</code> if there is no WebContents associated with the given ID.</p>\n<h3 id=\"webcontentsfromdevtoolstargetidtargetid\"><a href=\"#webcontentsfromdevtoolstargetidtargetid\"><code>webContents.fromDevToolsTargetId(targetId)</code></a></h3>\n<ul>\n<li><code>targetId</code> String - The Chrome DevTools Protocol <a href=\"https://chromedevtools.github.io/devtools-protocol/tot/Target/#type-TargetID\">TargetID</a> associated with the WebContents instance.</li>\n</ul>\n<p>Returns <code>WebContents</code> | undefined - A WebContents instance with the given TargetID, or <code>undefined</code> if there is no WebContents associated with the given TargetID.</p>\n<p>When communicating with the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">Chrome DevTools Protocol</a>, it can be useful to lookup a WebContents instance based on its assigned TargetID.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">lookupTargetId</span> (<span class=\"hljs-params\">browserWindow</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> wc = browserWindow.webContents\n  <span class=\"hljs-keyword\">await</span> wc.debugger.attach(<span class=\"hljs-string\">'1.3'</span>)\n  <span class=\"hljs-keyword\">const</span> { targetInfo } = <span class=\"hljs-keyword\">await</span> wc.debugger.sendCommand(<span class=\"hljs-string\">'Target.getTargetInfo'</span>)\n  <span class=\"hljs-keyword\">const</span> { targetId } = targetInfo\n  <span class=\"hljs-keyword\">const</span> targetWebContents = <span class=\"hljs-keyword\">await</span> webContents.fromDevToolsTargetId(targetId)\n}\n</code></pre>\n<h2 id=\"класс-webcontents\"><a href=\"#класс-webcontents\">Класс: WebContents</a></h2>\n<blockquote>\n<p>Рендерит и управляет контент экземпляра BrowserWindow.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"события-экземпляра\"><a href=\"#события-экземпляра\">События экземпляра</a></h3>\n<h4 id=\"event-did-finish-load\"><a href=\"#event-did-finish-load\">Event: 'did-finish-load'</a></h4>\n<p>Emitted when the navigation is done, i.e. the spinner of the tab has stopped spinning, and the <code>onload</code> event was dispatched.</p>\n<h4 id=\"event-did-fail-load\"><a href=\"#event-did-fail-load\">Event: 'did-fail-load'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>errorCode</code> Integer</li>\n<li>Строка <code>errorDescription</code></li>\n<li>Строка <code>validatedURL</code></li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>This event is like <code>did-finish-load</code> but emitted when the load failed. The full list of error codes and their meaning is available <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">here</a>.</p>\n<h4 id=\"event-did-fail-provisional-load\"><a href=\"#event-did-fail-provisional-load\">Event: 'did-fail-provisional-load'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>errorCode</code> Integer</li>\n<li>Строка <code>errorDescription</code></li>\n<li>Строка <code>validatedURL</code></li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>This event is like <code>did-fail-load</code> but emitted when the load was cancelled (e.g. <code>window.stop()</code> was invoked).</p>\n<h4 id=\"event-did-frame-finish-load\"><a href=\"#event-did-frame-finish-load\">Event: 'did-frame-finish-load'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when a frame has done navigation.</p>\n<h4 id=\"событие-did-start-loading\"><a href=\"#событие-did-start-loading\">Событие: 'did-start-loading'</a></h4>\n<p>Corresponds to the points in time when the spinner of the tab started spinning.</p>\n<h4 id=\"событие-did-stop-loading\"><a href=\"#событие-did-stop-loading\">Событие: 'did-stop-loading'</a></h4>\n<p>Corresponds to the points in time when the spinner of the tab stopped spinning.</p>\n<h4 id=\"событие-dom-ready\"><a href=\"#событие-dom-ready\">Событие: 'dom-ready'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n</ul>\n<p>Emitted when the document in the top-level frame is loaded.</p>\n<h4 id=\"событие-page-title-updated\"><a href=\"#событие-page-title-updated\">Событие: 'page-title-updated'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>Fired when page title is set during navigation. <code>explicitSet</code> is false when title is synthesized from file url.</p>\n<h4 id=\"событие-page-favicon-updated\"><a href=\"#событие-page-favicon-updated\">Событие: 'page-favicon-updated'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>favicons</code> String[] - Array of URLs.</li>\n</ul>\n<p>Emitted when page receives favicon urls.</p>\n<h4 id=\"event-new-window-deprecated\"><a href=\"#event-new-window-deprecated\">Event: 'new-window' <em>Deprecated</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li><code>event</code> NewWindowWebContentsEvent</li>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> and <code>other</code>.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - The options which will be used for creating the new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</li>\n<li><code>additionalFeatures</code> String[] - The non-standard features (features not handled by Chromium or Electron) given to <code>window.open()</code>. Deprecated, and will now always be the empty array <code>[]</code>.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer that will be passed to the new window. May or may not result in the <code>Referer</code> header being sent, depending on the referrer policy.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that will be sent to the new window, along with the appropriate headers that will be set. If no post data is to be sent, the value will be <code>null</code>. Only defined when the window is being created by a form that set <code>target=_blank</code>.</li>\n</ul>\n<p>Deprecated in favor of <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>.</p>\n<p>Emitted when the page requests to open a new window for a <code>url</code>. It could be requested by <code>window.open</code> or an external link like <code>&#x3C;a target='_blank'></code>.</p>\n<p>By default a new <code>BrowserWindow</code> will be created for the <code>url</code>.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent Electron from automatically creating a new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. If you call <code>event.preventDefault()</code> and manually create a new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> then you must set <code>event.newGuest</code> to reference the new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> instance, failing to do so may result in unexpected behavior. Например:</p>\n<pre><code class=\"hljs language-javascript\">myBrowserWindow.webContents.on(<span class=\"hljs-string\">'new-window'</span>, (event, url, frameName, disposition, options, additionalFeatures, referrer, postBody) => {\n  event.preventDefault()\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webContents</span>: options.webContents, <span class=\"hljs-comment\">// use existing webContents if provided</span>\n    <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span>\n  })\n  win.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => win.show())\n  <span class=\"hljs-keyword\">if</span> (!options.webContents) {\n    <span class=\"hljs-keyword\">const</span> loadOptions = {\n      <span class=\"hljs-attr\">httpReferrer</span>: referrer\n    }\n    <span class=\"hljs-keyword\">if</span> (postBody != <span class=\"hljs-literal\">null</span>) {\n      <span class=\"hljs-keyword\">const</span> { data, contentType, boundary } = postBody\n      loadOptions.postData = postBody.data\n      loadOptions.extraHeaders = <span class=\"hljs-string\">`content-type: <span class=\"hljs-subst\">${contentType}</span>; boundary=<span class=\"hljs-subst\">${boundary}</span>`</span>\n    }\n\n    win.loadURL(url, loadOptions) <span class=\"hljs-comment\">// existing webContents will be navigated automatically</span>\n  }\n  event.newGuest = win\n})\n</code></pre>\n<h4 id=\"event-did-create-window\"><a href=\"#event-did-create-window\">Event: 'did-create-window'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li><code>window</code> BrowserWindow</li>\n<li>Объект <code>details</code><ul>\n<li><code>url</code> String - URL for the created window.</li>\n<li><code>frameName</code> String - Name given to the created window in the <code>window.open()</code> call.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - The options used to create the BrowserWindow. They are merged in increasing precedence: parsed options from the <code>features</code> string from <code>window.open()</code>, security-related webPreferences inherited from the parent, and options given by <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>. Unrecognized options are not filtered out.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer that will be passed to the new window. May or may not result in the <code>Referer</code> header being sent, depending on the referrer policy.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that will be sent to the new window, along with the appropriate headers that will be set. If no post data is to be sent, the value will be <code>null</code>. Only defined when the window is being created by a form that set <code>target=_blank</code>.</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> and <code>other</code>.</li>\n</ul></li>\n</ul>\n<p>Emitted <em>after</em> successful creation of a window via <code>window.open</code> in the renderer. Not emitted if the creation of the window is canceled from <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>.</p>\n<p>See <a href=\"/docs/api/window-open\"><code>window.open()</code></a> for more details and how to use this in conjunction with <code>webContents.setWindowOpenHandler</code>.</p>\n<h4 id=\"событие-will-navigate\"><a href=\"#событие-will-navigate\">Событие: 'will-navigate'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when a user or the page wants to start navigation. It can happen when the <code>window.location</code> object is changed or a user clicks a link in the page.</p>\n<p>This event will not emit when the navigation is started programmatically with APIs like <code>webContents.loadURL</code> and <code>webContents.back</code>.</p>\n<p>It is also not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent the navigation.</p>\n<h4 id=\"event-did-start-navigation\"><a href=\"#event-did-start-navigation\">Event: 'did-start-navigation'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame (including main) starts navigating. <code>isInPlace</code> will be <code>true</code> for in-page navigations.</p>\n<h4 id=\"event-will-redirect\"><a href=\"#event-will-redirect\">Event: 'will-redirect'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted as a server side redirect occurs during navigation.  For example a 302 redirect.</p>\n<p>This event will be emitted after <code>did-start-navigation</code> and always before the <code>did-redirect-navigation</code> event for the same navigation.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent the navigation (not just the redirect).</p>\n<h4 id=\"event-did-redirect-navigation\"><a href=\"#event-did-redirect-navigation\">Event: 'did-redirect-navigation'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted after a server side redirect occurs during navigation.  For example a 302 redirect.</p>\n<p>Это событие не может быть предотвращено, если вы хотите предотвратить перенаправления, то должны проверить событие<code>will-redirect</code> выше.</p>\n<h4 id=\"событие-did-navigate\"><a href=\"#событие-did-navigate\">Событие: 'did-navigate'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - empty for non HTTP navigations</li>\n</ul>\n<p>Emitted when a main frame navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h4 id=\"event-did-frame-navigate\"><a href=\"#event-did-frame-navigate\">Event: 'did-frame-navigate'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - empty for non HTTP navigations,</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h4 id=\"event-did-navigate-in-page\"><a href=\"#event-did-navigate-in-page\">Event: 'did-navigate-in-page'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>url</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when an in-page navigation happened in any frame.</p>\n<p>When in-page navigation happens, the page URL changes but does not cause navigation outside of the page. Examples of this occurring are when anchor links are clicked or when the DOM <code>hashchange</code> event is triggered.</p>\n<h4 id=\"событие-will-prevent-unload\"><a href=\"#событие-will-prevent-unload\">Событие: 'will-prevent-unload'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n</ul>\n<p>Emitted when a <code>beforeunload</code> event handler is attempting to cancel a page unload.</p>\n<p>Calling <code>event.preventDefault()</code> will ignore the <code>beforeunload</code> event handler and allow the page to be unloaded.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.webContents.on(<span class=\"hljs-string\">'will-prevent-unload'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> choice = dialog.showMessageBoxSync(win, {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'question'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Leave'</span>, <span class=\"hljs-string\">'Stay'</span>],\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Do you want to leave this site?'</span>,\n    <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'Changes you made may not be saved.'</span>,\n    <span class=\"hljs-attr\">defaultId</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">cancelId</span>: <span class=\"hljs-number\">1</span>\n  })\n  <span class=\"hljs-keyword\">const</span> leave = (choice === <span class=\"hljs-number\">0</span>)\n  <span class=\"hljs-keyword\">if</span> (leave) {\n    event.preventDefault()\n  }\n})\n</code></pre>\n<p><strong>Note:</strong> This will be emitted for <code>BrowserViews</code> but will <em>not</em> be respected - this is because we have chosen not to tie the <code>BrowserView</code> lifecycle to its owning BrowserWindow should one exist per the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event\">specification</a>.</p>\n<h4 id=\"event-crashed-deprecated\"><a href=\"#event-crashed-deprecated\">Event: 'crashed' <em>Deprecated</em></a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>Emitted when the renderer process crashes or is killed.</p>\n<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>\n<h4 id=\"event-render-process-gone\"><a href=\"#event-render-process-gone\">Event: 'render-process-gone'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li>Объект <code>details</code><ul>\n<li><code>reason</code> String - The reason the render process is gone.  Возможные значения:<ul>\n<li><code>clean-exit</code> - Process exited with an exit code of zero</li>\n<li><code>abnormal-exit</code> - Process exited with a non-zero exit code</li>\n<li><code>killed</code> - Process was sent a SIGTERM or otherwise killed externally</li>\n<li><code>crashed</code> - Process crashed</li>\n<li><code>oom</code> - Process ran out of memory</li>\n<li><code>launch-failed</code> - Process never successfully launched</li>\n<li><code>integrity-failure</code> - Windows code integrity checks failed</li>\n</ul></li>\n<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>\n</ul></li>\n</ul>\n<p>Emitted when the renderer process unexpectedly disappears.  This is normally because it was crashed or killed.</p>\n<h4 id=\"событие-unresponsive\"><a href=\"#событие-unresponsive\">Событие: 'unresponsive'</a></h4>\n<p>Вызывается, когда страница \"не отвечает\".</p>\n<h4 id=\"событие-responsive\"><a href=\"#событие-responsive\">Событие: 'responsive'</a></h4>\n<p>Происходит, когда страница, которая \"не отвечала\", снова реагирует.</p>\n<h4 id=\"событие-plugin-crashed\"><a href=\"#событие-plugin-crashed\">Событие: 'plugin-crashed'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>\n<p>Emitted when a plugin process has crashed.</p>\n<h4 id=\"событие-destroyed\"><a href=\"#событие-destroyed\">Событие: 'destroyed'</a></h4>\n<p>Emitted when <code>webContents</code> is destroyed.</p>\n<h4 id=\"событие-before-input-event\"><a href=\"#событие-before-input-event\">Событие: 'before-input-event'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>input</code> Object - Input properties.<ul>\n<li><code>type</code> String - Either <code>keyUp</code> or <code>keyDown</code>.</li>\n<li><code>key</code> String - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.key</a>.</li>\n<li><code>code</code> String - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.code</a>.</li>\n<li><code>isAutoRepeat</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.repeat</a>.</li>\n<li><code>isComposing</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.isComposing</a>.</li>\n<li><code>shift</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.shiftKey</a>.</li>\n<li><code>control</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.controlKey</a>.</li>\n<li><code>alt</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.altKey</a>.</li>\n<li><code>meta</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.metaKey</a>.</li>\n<li><code>location</code> Number - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.location</a>.</li>\n<li><code>modifiers</code> String[] - See <a href=\"/docs/api/structures/input-event\">InputEvent.modifiers</a>.</li>\n</ul></li>\n</ul>\n<p>Emitted before dispatching the <code>keydown</code> and <code>keyup</code> events in the page. Calling <code>event.preventDefault</code> will prevent the page <code>keydown</code>/<code>keyup</code> events and the menu shortcuts.</p>\n<p>To only prevent the menu shortcuts, use <a href=\"#contentssetignoremenushortcutsignore\"><code>setIgnoreMenuShortcuts</code></a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\nwin.webContents.on(<span class=\"hljs-string\">'before-input-event'</span>, (event, input) => {\n  <span class=\"hljs-comment\">// Например, включать сочетания клавиш меню приложения</span>\n  <span class=\"hljs-comment\">// Только когда Ctrl/Cmd нажаты.</span>\n  win.webContents.setIgnoreMenuShortcuts(!input.control &#x26;&#x26; !input.meta)\n})\n</code></pre>\n<h4 id=\"событие-enter-html-full-screen\"><a href=\"#событие-enter-html-full-screen\">Событие: 'enter-html-full-screen'</a></h4>\n<p>Происходит, когда окно входит в полноэкранный режим с помощью HTML API.</p>\n<h4 id=\"событие-leave-html-full-screen\"><a href=\"#событие-leave-html-full-screen\">Событие: 'leave-html-full-screen'</a></h4>\n<p>Происходит, когда окно выходит из полноэкранного режима с помощью HTML API.</p>\n<h4 id=\"event-zoom-changed\"><a href=\"#event-zoom-changed\">Event: 'zoom-changed'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>zoomDirection</code> String - Can be <code>in</code> or <code>out</code>.</li>\n</ul>\n<p>Emitted when the user is requesting to change the zoom level using the mouse wheel.</p>\n<h4 id=\"событие-devtools-opened\"><a href=\"#событие-devtools-opened\">Событие: 'devtools-opened'</a></h4>\n<p>Emitted when DevTools is opened.</p>\n<h4 id=\"событие-devtools-closed\"><a href=\"#событие-devtools-closed\">Событие: 'devtools-closed'</a></h4>\n<p>Emitted when DevTools is closed.</p>\n<h4 id=\"event-devtools-focused\"><a href=\"#event-devtools-focused\">Event: 'devtools-focused'</a></h4>\n<p>Emitted when DevTools is focused / opened.</p>\n<h4 id=\"событие-certificate-error\"><a href=\"#событие-certificate-error\">Событие: 'certificate-error'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>url</code> String</li>\n<li><code>error</code> String - The error code.</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>isTrusted</code> Boolean - Indicates whether the certificate can be considered trusted.</li>\n</ul></li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Emitted when failed to verify the <code>certificate</code> for <code>url</code>.</p>\n<p>The usage is the same with <a href=\"/docs/api/app#event-certificate-error\">the <code>certificate-error</code> event of <code>app</code></a>.</p>\n<h4 id=\"событие-select-client-certificate\"><a href=\"#событие-select-client-certificate\">Событие: 'select-client-certificate'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>url</code> URL</li>\n<li><code>certificateList</code> <a href=\"/docs/api/structures/certificate\">Certificate[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> - Must be a certificate from the given list.</li>\n</ul></li>\n</ul>\n<p>Возникает при запросе сертификата клиента.</p>\n<p>The usage is the same with <a href=\"/docs/api/app#event-select-client-certificate\">the <code>select-client-certificate</code> event of <code>app</code></a>.</p>\n<h4 id=\"событие-login\"><a href=\"#событие-login\">Событие: 'login'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>authenticationResponseDetails</code> Object<ul>\n<li><code>url</code> URL</li>\n</ul></li>\n<li><code>authInfo</code> Object<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (опционально)</li>\n<li><code>password</code> String (опционально)</li>\n</ul></li>\n</ul>\n<p>Возникает <code>webContents</code>, когда делается базовый auth.</p>\n<p>The usage is the same with <a href=\"/docs/api/app#event-login\">the <code>login</code> event of <code>app</code></a>.</p>\n<h4 id=\"событие-certificate-error-1\"><a href=\"#событие-certificate-error-1\">Событие: 'certificate-error'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>result</code> Object<ul>\n<li><code>requestId</code> Integer</li>\n<li><code>activeMatchOrdinal</code> Integer - Position of the active match.</li>\n<li><code>matches</code> Integer - Number of Matches.</li>\n<li><code>selectionArea</code> Rectangle - Coordinates of first match region.</li>\n<li><code>finalUpdate</code> Boolean</li>\n</ul></li>\n</ul>\n<p>Emitted when a result is available for [<code>webContents.findInPage</code>] request.</p>\n<h4 id=\"событие-media-started-playing\"><a href=\"#событие-media-started-playing\">Событие: 'media-started-playing'</a></h4>\n<p>Emitted when media starts playing.</p>\n<h4 id=\"событие-media-paused\"><a href=\"#событие-media-paused\">Событие: 'media-paused'</a></h4>\n<p>Emitted when media is paused or done playing.</p>\n<h4 id=\"событие-did-change-theme-color\"><a href=\"#событие-did-change-theme-color\">Событие: 'did-change-theme-color'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>color</code> (String | null) - Theme color is in format of '#rrggbb'. It is <code>null</code> when no theme color is set.</li>\n</ul>\n<p>Emitted when a page's theme color changes. This is usually due to encountering a meta tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">'theme-color'</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">'#ff0000'</span>></span>\n</code></pre>\n<h4 id=\"событие-update-target-url\"><a href=\"#событие-update-target-url\">Событие: 'update-target-url'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when mouse moves over a link or the keyboard moves the focus to a link.</p>\n<h4 id=\"событие-cursor-changed\"><a href=\"#событие-cursor-changed\">Событие: 'cursor-changed'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>type</code> String</li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> (опционально)</li>\n<li><code>scale</code> Float (optional) - scaling factor for the custom cursor.</li>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) - the size of the <code>image</code>.</li>\n<li><code>hotspot</code> <a href=\"/docs/api/structures/point\">Point</a> (optional) - coordinates of the custom cursor's hotspot.</li>\n</ul>\n<p>Emitted when the cursor's type changes. The <code>type</code> parameter can be <code>default</code>, <code>crosshair</code>, <code>pointer</code>, <code>text</code>, <code>wait</code>, <code>help</code>, <code>e-resize</code>, <code>n-resize</code>, <code>ne-resize</code>, <code>nw-resize</code>, <code>s-resize</code>, <code>se-resize</code>, <code>sw-resize</code>, <code>w-resize</code>, <code>ns-resize</code>, <code>ew-resize</code>, <code>nesw-resize</code>, <code>nwse-resize</code>, <code>col-resize</code>, <code>row-resize</code>, <code>m-panning</code>, <code>e-panning</code>, <code>n-panning</code>, <code>ne-panning</code>, <code>nw-panning</code>, <code>s-panning</code>, <code>se-panning</code>, <code>sw-panning</code>, <code>w-panning</code>, <code>move</code>, <code>vertical-text</code>, <code>cell</code>, <code>context-menu</code>, <code>alias</code>, <code>progress</code>, <code>nodrop</code>, <code>copy</code>, <code>none</code>, <code>not-allowed</code>, <code>zoom-in</code>, <code>zoom-out</code>, <code>grab</code>, <code>grabbing</code> or <code>custom</code>.</p>\n<p>If the <code>type</code> parameter is <code>custom</code>, the <code>image</code> parameter will hold the custom cursor image in a <a href=\"/docs/api/native-image\"><code>NativeImage</code></a>, and <code>scale</code>, <code>size</code> and <code>hotspot</code> will hold additional information about the custom cursor.</p>\n<h4 id=\"событие-context-menu\"><a href=\"#событие-context-menu\">Событие: 'context-menu'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>params</code> Object<ul>\n<li><code>x</code> Integer - x coordinate.</li>\n<li><code>y</code> Integer - y coordinate.</li>\n<li><code>frame</code> WebFrameMain - Frame from which the context menu was invoked.</li>\n<li><code>linkURL</code> String - URL of the link that encloses the node the context menu was invoked on.</li>\n<li><code>linkText</code> String - Text associated with the link. May be an empty string if the contents of the link are an image.</li>\n<li><code>pageURL</code> String - URL of the top level page that the context menu was invoked on.</li>\n<li><code>frameURL</code> String - URL of the subframe that the context menu was invoked on.</li>\n<li><code>srcURL</code> String - Source URL for the element that the context menu was invoked on. Elements with source URLs are images, audio and video.</li>\n<li><code>mediaType</code> String - Type of the node the context menu was invoked on. Can be <code>none</code>, <code>image</code>, <code>audio</code>, <code>video</code>, <code>canvas</code>, <code>file</code> or <code>plugin</code>.</li>\n<li><code>hasImageContents</code> Boolean - Whether the context menu was invoked on an image which has non-empty contents.</li>\n<li><code>isEditable</code> Boolean - Whether the context is editable.</li>\n<li><code>selectionText</code> String - Text of the selection that the context menu was invoked on.</li>\n<li><code>titleText</code> String - Title text of the selection that the context menu was invoked on.</li>\n<li><code>altText</code> String - Alt text of the selection that the context menu was invoked on.</li>\n<li><code>suggestedFilename</code> String - Suggested filename to be used when saving file through 'Save Link As' option of context menu.</li>\n<li><code>selectionRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Rect representing the coordinates in the document space of the selection.</li>\n<li><code>selectionStartOffset</code> Number - Start position of the selection text.</li>\n<li><code>referrerPolicy</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer policy of the frame on which the menu is invoked.</li>\n<li><code>misspelledWord</code> String - The misspelled word under the cursor, if any.</li>\n<li><code>dictionarySuggestions</code> String[] - An array of suggested words to show the user to replace the <code>misspelledWord</code>.  Only available if there is a misspelled word and spellchecker is enabled.</li>\n<li><code>frameCharset</code> String - The character encoding of the frame on which the menu was invoked.</li>\n<li><code>inputFieldType</code> String - If the context menu was invoked on an input field, the type of that field. Possible values are <code>none</code>, <code>plainText</code>, <code>password</code>, <code>other</code>.</li>\n<li><code>spellcheckEnabled</code> Boolean - If the context is editable, whether or not spellchecking is enabled.</li>\n<li><code>menuSourceType</code> String - Input source that invoked the context menu. Can be <code>none</code>, <code>mouse</code>, <code>keyboard</code>, <code>touch</code>, <code>touchMenu</code>, <code>longPress</code>, <code>longTap</code>, <code>touchHandle</code>, <code>stylus</code>, <code>adjustSelection</code>, or <code>adjustSelectionReset</code>.</li>\n<li><code>mediaFlags</code> Object - The flags for the media element the context menu was invoked on.<ul>\n<li><code>inError</code> Boolean - Whether the media element has crashed.</li>\n<li><code>isPaused</code> Boolean - Whether the media element is paused.</li>\n<li><code>isMuted</code> Boolean - Whether the media element is muted.</li>\n<li><code>hasAudio</code> Boolean - Whether the media element has audio.</li>\n<li><code>isLooping</code> Boolean - Whether the media element is looping.</li>\n<li><code>isControlsVisible</code> Boolean - Whether the media element's controls are visible.</li>\n<li><code>canToggleControls</code> Boolean - Whether the media element's controls are toggleable.</li>\n<li><code>canPrint</code> Boolean - Whether the media element can be printed.</li>\n<li><code>canSave</code> Boolean - Whether or not the media element can be downloaded.</li>\n<li><code>canShowPictureInPicture</code> Boolean - Whether the media element can show picture-in-picture.</li>\n<li><code>isShowingPictureInPicture</code> Boolean - Whether the media element is currently showing picture-in-picture.</li>\n<li><code>canRotate</code> Boolean - Whether the media element can be rotated.</li>\n<li><code>canLoop</code> Boolean - Whether the media element can be looped.</li>\n</ul></li>\n<li><code>editFlags</code> Object - These flags indicate whether the renderer believes it is able to perform the corresponding action.<ul>\n<li><code>canUndo</code> Boolean - Whether the renderer believes it can undo.</li>\n<li><code>canRedo</code> Boolean - Whether the renderer believes it can redo.</li>\n<li><code>canCut</code> Boolean - Whether the renderer believes it can cut.</li>\n<li><code>canCopy</code> Boolean - Whether the renderer believes it can copy.</li>\n<li><code>canPaste</code> Boolean - Whether the renderer believes it can paste.</li>\n<li><code>canDelete</code> Boolean - Whether the renderer believes it can delete.</li>\n<li><code>canSelectAll</code> Boolean - Whether the renderer believes it can select all.</li>\n<li><code>canEditRichly</code> Boolean - Whether the renderer believes it can edit text richly.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Emitted when there is a new context menu that needs to be handled.</p>\n<h4 id=\"событие-select-bluetooth-device\"><a href=\"#событие-select-bluetooth-device\">Событие: 'select-bluetooth-device'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>devices</code> <a href=\"/docs/api/structures/bluetooth-device\">BluetoothDevice[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>deviceId</code> String</li>\n</ul></li>\n</ul>\n<p>Emitted when bluetooth device needs to be selected on call to <code>navigator.bluetooth.requestDevice</code>. To use <code>navigator.bluetooth</code> api <code>webBluetooth</code> should be enabled. If <code>event.preventDefault</code> is not called, first available device will be selected. <code>callback</code> should be called with <code>deviceId</code> to be selected, passing empty string to <code>callback</code> will cancel the request.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'enable-experimental-web-platform-features'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.webContents.on(<span class=\"hljs-string\">'select-bluetooth-device'</span>, (event, deviceList, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> result = deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.deviceName === <span class=\"hljs-string\">'test'</span>\n    })\n    <span class=\"hljs-keyword\">if</span> (!result) {\n      callback(<span class=\"hljs-string\">''</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      callback(result.deviceId)\n    }\n  })\n})\n</code></pre>\n<h4 id=\"событие-paint\"><a href=\"#событие-paint\">Событие: 'paint'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>dirtyRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> - The image data of the whole frame.</li>\n</ul>\n<p>Emitted when a new frame is generated. Only the dirty area is passed in the buffer.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">offscreen</span>: <span class=\"hljs-literal\">true</span> } })\nwin.webContents.on(<span class=\"hljs-string\">'paint'</span>, (event, dirty, image) => {\n  <span class=\"hljs-comment\">// updateBitmap(dirty, image.getBitmap())</span>\n})\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n</code></pre>\n<h4 id=\"событие-devtools-reload-page\"><a href=\"#событие-devtools-reload-page\">Событие: 'devtools-reload-page'</a></h4>\n<p>Emitted when the devtools window instructs the webContents to reload</p>\n<h4 id=\"событие-will-attach-webview\"><a href=\"#событие-will-attach-webview\">Событие: 'will-attach-webview'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>webPreferences</code> WebPreferences - The web preferences that will be used by the guest page. This object can be modified to adjust the preferences for the guest page.</li>\n<li><code>params</code> Record&#x3C;string, string> - The other <code>&#x3C;webview></code> parameters such as the <code>src</code> URL. This object can be modified to adjust the parameters of the guest page.</li>\n</ul>\n<p>Emitted when a <code>&#x3C;webview></code>'s web contents is being attached to this web contents. Calling <code>event.preventDefault()</code> will destroy the guest page.</p>\n<p>This event can be used to configure <code>webPreferences</code> for the <code>webContents</code> of a <code>&#x3C;webview></code> before it's loaded, and provides the ability to set settings that can't be set via <code>&#x3C;webview></code> attributes.</p>\n<p><strong>Note:</strong> The specified <code>preload</code> script option will appear as <code>preloadURL</code> (not <code>preload</code>) in the <code>webPreferences</code> object emitted with this event.</p>\n<h4 id=\"event-did-attach-webview\"><a href=\"#event-did-attach-webview\">Event: 'did-attach-webview'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>webContents</code> WebContents - The guest web contents that is used by the <code>&#x3C;webview></code>.</li>\n</ul>\n<p>Emitted when a <code>&#x3C;webview></code> has been attached to this web contents.</p>\n<h4 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>level</code> Integer - The log level, from 0 to 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>message</code> String - The actual console message</li>\n<li><code>line</code> Integer - The line number of the source that triggered this console message</li>\n<li><code>sourceId</code> String</li>\n</ul>\n<p>Emitted when the associated window logs a console message.</p>\n<h4 id=\"event-preload-error\"><a href=\"#event-preload-error\">Event: 'preload-error'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>preloadPath</code> String</li>\n<li><code>error</code> Error</li>\n</ul>\n<p>Emitted when the preload script <code>preloadPath</code> throws an unhandled exception <code>error</code>.</p>\n<h4 id=\"event-ipc-message\"><a href=\"#event-ipc-message\">Event: 'ipc-message'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>channel</code> String (Строка)</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Emitted when the renderer process sends an asynchronous message via <code>ipcRenderer.send()</code>.</p>\n<h4 id=\"event-ipc-message-sync\"><a href=\"#event-ipc-message-sync\">Event: 'ipc-message-sync'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>channel</code> String (Строка)</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Emitted when the renderer process sends a synchronous message via <code>ipcRenderer.sendSync()</code>.</p>\n<h4 id=\"событие-desktop-capturer-get-sources\"><a href=\"#событие-desktop-capturer-get-sources\">Событие: 'desktop-capturer-get-sources'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n</ul>\n<p>Emitted when <code>desktopCapturer.getSources()</code> is called in the renderer process. Вызов <code>event.preventDefault()</code> вернет пустые источники.</p>\n<h4 id=\"event-preferred-size-changed\"><a href=\"#event-preferred-size-changed\">Event: 'preferred-size-changed'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li><code>preferredSize</code> <a href=\"/docs/api/structures/size\">Size</a> - The minimum size needed to contain the layout of the document—without requiring scrolling.</li>\n</ul>\n<p>Emitted when the <code>WebContents</code> preferred size has changed.</p>\n<p>This event will only be emitted when <code>enablePreferredSizeMode</code> is set to <code>true</code> in <code>webPreferences</code>.</p>\n<h4 id=\"event-frame-created\"><a href=\"#event-frame-created\">Event: 'frame-created'</a></h4>\n<p>Возвращает:</p>\n<ul>\n<li>Событие типа <code>event</code></li>\n<li>Объект <code>details</code><ul>\n<li><code>frame</code> WebFrameMain</li>\n</ul></li>\n</ul>\n<p>Emitted when the <a href=\"/docs/api/web-contents#contentsmainframe-readonly\">mainFrame</a>, an <code>&#x3C;iframe></code>, or a nested <code>&#x3C;iframe></code> is loaded within the page.</p>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<h4 id=\"contentsloadurlurl-options\"><a href=\"#contentsloadurlurl-options\"><code>contents.loadURL(url[, options])</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (optional) - An HTTP Referrer url.</li>\n<li><code>userAgent</code> String (optional) - A user agent originating the request.</li>\n<li><code>extraHeaders</code> String (optional) - Extra headers separated by \"\\n\".</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified <code>url</code> is a data url and needs to load other files.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - the promise will resolve when the page has finished loading (see <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects if the page fails to load (see <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>). A noop rejection handler is already attached, which avoids unhandled rejection errors.</p>\n<p>Loads the <code>url</code> in the window. The <code>url</code> must contain the protocol prefix, e.g. the <code>http://</code> or <code>file://</code>. If the load should bypass http cache then use the <code>pragma</code> header to achieve it.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> options = { <span class=\"hljs-attr\">extraHeaders</span>: <span class=\"hljs-string\">'pragma: no-cache\\n'</span> }\nwebContents.loadURL(<span class=\"hljs-string\">'https://github.com'</span>, options)\n</code></pre>\n<h4 id=\"contentsloadfilefilepath-options\"><a href=\"#contentsloadfilefilepath-options\"><code>contents.loadFile(filePath[, options])</code></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>query</code> Record&#x3C;String, String> (опционально) - переданная в <code>url.format()</code>.</li>\n<li><code>search</code> String (optional) - Passed to <code>url.format()</code>.</li>\n<li><code>hash</code> String (optional) - Passed to <code>url.format()</code>.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code> - промис будет разрешен, когда страница завершит загрузку (см. <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), и отклоняет, если страница не удачно загрузилась (см. <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Loads the given file in the window, <code>filePath</code> should be a path to an HTML file relative to the root of your application.  For instance an app structure like this:</p>\n<pre><code class=\"hljs language-sh\">| root\n| - package.json\n| - src\n|   - main.js\n|   - index.html\n</code></pre>\n<p>Would require code like this</p>\n<pre><code class=\"hljs language-js\">win.loadFile(<span class=\"hljs-string\">'src/index.html'</span>)\n</code></pre>\n<h4 id=\"contentsdownloadurlurl\"><a href=\"#contentsdownloadurlurl\"><code>contents.downloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code> without navigating. The <code>will-download</code> event of <code>session</code> will be triggered.</p>\n<h4 id=\"contentsgeturl\"><a href=\"#contentsgeturl\"><code>contents.getURL()</code></a></h4>\n<p>Returns <code>String</code> - The URL of the current web page.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> currentURL = win.webContents.getURL()\n  <span class=\"hljs-built_in\">console</span>.log(currentURL)\n})\n</code></pre>\n<h4 id=\"contentsgettitle\"><a href=\"#contentsgettitle\"><code>contents.getTitle()</code></a></h4>\n<p>Returns <code>String</code> - The title of the current web page.</p>\n<h4 id=\"contentsisdestroyed\"><a href=\"#contentsisdestroyed\"><code>contents.isDestroyed()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the web page is destroyed.</p>\n<h4 id=\"contentsfocus\"><a href=\"#contentsfocus\"><code>contents.focus()</code></a></h4>\n<p>Focuses the web page.</p>\n<h4 id=\"contentsisfocused\"><a href=\"#contentsisfocused\"><code>contents.isFocused()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the web page is focused.</p>\n<h4 id=\"contentsisloading\"><a href=\"#contentsisloading\"><code>contents.isLoading()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether web page is still loading resources.</p>\n<h4 id=\"contentsisloadingmainframe\"><a href=\"#contentsisloadingmainframe\"><code>contents.isLoadingMainFrame()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the main frame (and not just iframes or frames within it) is still loading.</p>\n<h4 id=\"contentsiswaitingforresponse\"><a href=\"#contentsiswaitingforresponse\"><code>contents.isWaitingForResponse()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the web page is waiting for a first-response from the main resource of the page.</p>\n<h4 id=\"contentsstop\"><a href=\"#contentsstop\"><code>contents.stop()</code></a></h4>\n<p>Stops any pending navigation.</p>\n<h4 id=\"contentsreload\"><a href=\"#contentsreload\"><code>contents.reload()</code></a></h4>\n<p>Reloads the current web page.</p>\n<h4 id=\"contentsreloadignoringcache\"><a href=\"#contentsreloadignoringcache\"><code>contents.reloadIgnoringCache()</code></a></h4>\n<p>Reloads current page and ignores cache.</p>\n<h4 id=\"contentscangoback\"><a href=\"#contentscangoback\"><code>contents.canGoBack()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the browser can go back to previous web page.</p>\n<h4 id=\"contentscangoforward\"><a href=\"#contentscangoforward\"><code>contents.canGoForward()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the browser can go forward to next web page.</p>\n<h4 id=\"contentscangotooffsetoffset\"><a href=\"#contentscangotooffsetoffset\"><code>contents.canGoToOffset(offset)</code></a></h4>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the web page can go to <code>offset</code>.</p>\n<h4 id=\"contentsclearhistory\"><a href=\"#contentsclearhistory\"><code>contents.clearHistory()</code></a></h4>\n<p>Clears the navigation history.</p>\n<h4 id=\"contentsgoback\"><a href=\"#contentsgoback\"><code>contents.goBack()</code></a></h4>\n<p>Makes the browser go back a web page.</p>\n<h4 id=\"contentsgoforward\"><a href=\"#contentsgoforward\"><code>contents.goForward()</code></a></h4>\n<p>Makes the browser go forward a web page.</p>\n<h4 id=\"contentsgotoindexindex\"><a href=\"#contentsgotoindexindex\"><code>contents.goToIndex(index)</code></a></h4>\n<ul>\n<li><code>index</code> Integer</li>\n</ul>\n<p>Navigates browser to the specified absolute web page index.</p>\n<h4 id=\"contentsgotooffsetoffset\"><a href=\"#contentsgotooffsetoffset\"><code>contents.goToOffset(offset)</code></a></h4>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Navigates to the specified offset from the \"current entry\".</p>\n<h4 id=\"contentsiscrashed\"><a href=\"#contentsiscrashed\"><code>contents.isCrashed()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the renderer process has crashed.</p>\n<h4 id=\"contentsforcefullycrashrenderer\"><a href=\"#contentsforcefullycrashrenderer\"><code>contents.forcefullyCrashRenderer()</code></a></h4>\n<p>Forcefully terminates the renderer process that is currently hosting this <code>webContents</code>. This will cause the <code>render-process-gone</code> event to be emitted with the <code>reason=killed || reason=crashed</code>. Please note that some webContents share renderer processes and therefore calling this method may also crash the host process for other webContents as well.</p>\n<p>Calling <code>reload()</code> immediately after calling this method will force the reload to occur in a new process. This should be used when this process is unstable or unusable, for instance in order to recover from the <code>unresponsive</code> event.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'unresponsive'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> { response } = <span class=\"hljs-keyword\">await</span> dialog.showMessageBox({\n    <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'App X has become unresponsive'</span>,\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Do you want to try forcefully reloading the app?'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'OK'</span>, <span class=\"hljs-string\">'Cancel'</span>],\n    <span class=\"hljs-attr\">cancelId</span>: <span class=\"hljs-number\">1</span>\n  })\n  <span class=\"hljs-keyword\">if</span> (response === <span class=\"hljs-number\">0</span>) {\n    contents.forcefullyCrashRenderer()\n    contents.reload()\n  }\n})\n</code></pre>\n<h4 id=\"contentssetuseragentuseragent\"><a href=\"#contentssetuseragentuseragent\"><code>contents.setUserAgent(userAgent)</code></a></h4>\n<ul>\n<li><code>userAgent</code> String</li>\n</ul>\n<p>Overrides the user agent for this web page.</p>\n<h4 id=\"contentsgetuseragent\"><a href=\"#contentsgetuseragent\"><code>contents.getUserAgent()</code></a></h4>\n<p>Returns <code>String</code> - The user agent for this web page.</p>\n<h4 id=\"contentsinsertcsscss-options\"><a href=\"#contentsinsertcsscss-options\"><code>contents.insertCSS(css[, options])</code></a></h4>\n<ul>\n<li><code>css</code> String</li>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>cssOrigin</code> String (optional) - Can be either 'user' or 'author'; Specifying 'user' enables you to prevent websites from overriding the CSS you insert. Default is 'author'.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - A promise that resolves with a key for the inserted CSS that can later be used to remove the CSS via <code>contents.removeInsertedCSS(key)</code>.</p>\n<p>Injects CSS into the current web page and returns a unique key for the inserted stylesheet.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n  contents.insertCSS(<span class=\"hljs-string\">'html, body { background-color: #f00; }'</span>)\n})\n</code></pre>\n<h4 id=\"contentsremoveinsertedcsskey\"><a href=\"#contentsremoveinsertedcsskey\"><code>contents.removeInsertedCSS(key)</code></a></h4>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves if the removal was successful.</p>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from <code>contents.insertCSS(css)</code>.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'did-finish-load'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> key = <span class=\"hljs-keyword\">await</span> contents.insertCSS(<span class=\"hljs-string\">'html, body { background-color: #f00; }'</span>)\n  contents.removeInsertedCSS(key)\n})\n</code></pre>\n<h4 id=\"contentsexecutejavascriptcode-usergesture\"><a href=\"#contentsexecutejavascriptcode-usergesture\"><code>contents.executeJavaScript(code[, userGesture])</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (опиционально) - по умолчанию <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if the result of the code is a rejected promise.</p>\n<p>Вычисляет <code>code</code> на странице.</p>\n<p>В окне браузера некоторые HTML API как <code>requestFullScreen</code> может быть только вызван жестом пользователя. Указание <code>userGesture</code> как <code>true</code> снимает это ограничение.</p>\n<p>Code execution will be suspended until web page stop loading.</p>\n<pre><code class=\"hljs language-js\">contents.executeJavaScript(<span class=\"hljs-string\">'fetch(\"https://jsonplaceholder.typicode.com/users/1\").then(resp => resp.json())'</span>, <span class=\"hljs-literal\">true</span>)\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">result</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(result) <span class=\"hljs-comment\">// должен быть объект JSON  из запрашиваемого вызова</span>\n  })\n</code></pre>\n<h4 id=\"contentsexecutejavascriptinisolatedworldworldid-scripts-usergesture\"><a href=\"#contentsexecutejavascriptinisolatedworldworldid-scripts-usergesture\"><code>contents.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture])</code></a></h4>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default world, <code>999</code> is the world used by Electron's <code>contextIsolation</code> feature.  You can provide any integer here.</li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/web-source\">WebSource[]</a></li>\n<li><code>userGesture</code> Boolean (опиционально) - по умолчанию <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if the result of the code is a rejected promise.</p>\n<p>Works like <code>executeJavaScript</code> but evaluates <code>scripts</code> in an isolated context.</p>\n<h4 id=\"contentssetignoremenushortcutsignore\"><a href=\"#contentssetignoremenushortcutsignore\"><code>contents.setIgnoreMenuShortcuts(ignore)</code></a></h4>\n<ul>\n<li><code>ignore</code> Логическое значение</li>\n</ul>\n<p>Ignore application menu shortcuts while this web contents is focused.</p>\n<h4 id=\"contentssetwindowopenhandlerhandler\"><a href=\"#contentssetwindowopenhandlerhandler\"><code>contents.setWindowOpenHandler(handler)</code></a></h4>\n<ul>\n<li>\n<p><code>handler</code> Function&#x3C;{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}></p>\n<ul>\n<li>Объект <code>details</code><ul>\n<li><code>url</code> String - The <em>resolved</em> version of the URL passed to <code>window.open()</code>. e.g. opening a window with <code>window.open('foo')</code> will yield something like <code>https://the-origin/the/current/path/foo</code>.</li>\n<li><code>frameName</code> String - Name of the window provided in <code>window.open()</code></li>\n<li><code>features</code> String - Comma separated list of window features provided to <code>window.open()</code>.</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> or <code>other</code>.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer that will be passed to the new window. May or may not result in the <code>Referer</code> header being sent, depending on the referrer policy.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that will be sent to the new window, along with the appropriate headers that will be set. If no post data is to be sent, the value will be <code>null</code>. Only defined when the window is being created by a form that set <code>target=_blank</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}</code> - <code>deny</code> cancels the creation of the new window. <code>allow</code> will allow the new window to be created. Specifying <code>overrideBrowserWindowOptions</code> allows customization of the created window. Returning an unrecognized value such as a null, undefined, or an object without a recognized 'action' value will result in a console error and have the same effect as returning <code>{action: 'deny'}</code>.</p>\n</li>\n</ul>\n<p>Called before creating a window a new window is requested by the renderer, e.g. by <code>window.open()</code>, a link with <code>target=\"_blank\"</code>, shift+clicking on a link, or submitting a form with <code>&#x3C;form target=\"_blank\"></code>. See <a href=\"/docs/api/window-open\"><code>window.open()</code></a> for more details and how to use this in conjunction with <code>did-create-window</code>.</p>\n<h4 id=\"contentssetaudiomutedmuted\"><a href=\"#contentssetaudiomutedmuted\"><code>contents.setAudioMuted(muted)</code></a></h4>\n<ul>\n<li><code>muted</code> Boolean</li>\n</ul>\n<p>Mute the audio on the current web page.</p>\n<h4 id=\"contentsisaudiomuted\"><a href=\"#contentsisaudiomuted\"><code>contents.isAudioMuted()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether this page has been muted.</p>\n<h4 id=\"contentsiscurrentlyaudible\"><a href=\"#contentsiscurrentlyaudible\"><code>contents.isCurrentlyAudible()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether audio is currently playing.</p>\n<h4 id=\"contentssetzoomfactorfactor\"><a href=\"#contentssetzoomfactorfactor\"><code>contents.setZoomFactor(factor)</code></a></h4>\n<ul>\n<li><code>factor</code> Double - Zoom factor; default is 1.0.</li>\n</ul>\n<p>Changes the zoom factor to the specified factor. Zoom factor is zoom percent divided by 100, so 300% = 3.0.</p>\n<p>The factor must be greater than 0.0.</p>\n<h4 id=\"contentsgetzoomfactor\"><a href=\"#contentsgetzoomfactor\"><code>contents.getZoomFactor()</code></a></h4>\n<p>Returns <code>Number</code> - the current zoom factor.</p>\n<h4 id=\"contentssetzoomlevellevel\"><a href=\"#contentssetzoomlevellevel\"><code>contents.setZoomLevel(level)</code></a></h4>\n<ul>\n<li><code>level</code> Number - уровень увеличения.</li>\n</ul>\n<p>Изменяет уровень масштаба на указанный уровень. Оригинальный размер 0 и каждое приращение выше или ниже представляет масштабирование 20% больше или меньше, по умолчанию ограничение на 300% и 50% от исходного размера, соответственно. The formula for this is <code>scale := 1.2 ^ level</code>.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h4 id=\"contentsgetzoomlevel\"><a href=\"#contentsgetzoomlevel\"><code>contents.getZoomLevel()</code></a></h4>\n<p>Returns <code>Number</code> - the current zoom level.</p>\n<h4 id=\"contentssetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#contentssetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>contents.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h4>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code></p>\n<p>Устанавливает максимальный и минимальный уровень пинч-маштабирования.</p>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom is disabled by default in Electron. To re-enable it, call:</p>\n<pre><code class=\"hljs language-js\">contents.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">3</span>)\n</code></pre>\n</blockquote>\n<h4 id=\"contentsundo\"><a href=\"#contentsundo\"><code>contents.undo()</code></a></h4>\n<p>Executes the editing command <code>undo</code> in web page.</p>\n<h4 id=\"contentsredo\"><a href=\"#contentsredo\"><code>contents.redo()</code></a></h4>\n<p>Executes the editing command <code>redo</code> in web page.</p>\n<h4 id=\"contentscut\"><a href=\"#contentscut\"><code>contents.cut()</code></a></h4>\n<p>Executes the editing command <code>cut</code> in web page.</p>\n<h4 id=\"contentscopy\"><a href=\"#contentscopy\"><code>contents.copy()</code></a></h4>\n<p>Executes the editing command <code>copy</code> in web page.</p>\n<h4 id=\"contentscopyimageatx-y\"><a href=\"#contentscopyimageatx-y\"><code>contents.copyImageAt(x, y)</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Copy the image at the given position to the clipboard.</p>\n<h4 id=\"contentspaste\"><a href=\"#contentspaste\"><code>contents.paste()</code></a></h4>\n<p>Executes the editing command <code>paste</code> in web page.</p>\n<h4 id=\"contentspasteandmatchstyle\"><a href=\"#contentspasteandmatchstyle\"><code>contents.pasteAndMatchStyle()</code></a></h4>\n<p>Executes the editing command <code>pasteAndMatchStyle</code> in web page.</p>\n<h4 id=\"contentsdelete\"><a href=\"#contentsdelete\"><code>contents.delete()</code></a></h4>\n<p>Executes the editing command <code>delete</code> in web page.</p>\n<h4 id=\"contentsselectall\"><a href=\"#contentsselectall\"><code>contents.selectAll()</code></a></h4>\n<p>Executes the editing command <code>selectAll</code> in web page.</p>\n<h4 id=\"contentsunselect\"><a href=\"#contentsunselect\"><code>contents.unselect()</code></a></h4>\n<p>Executes the editing command <code>unselect</code> in web page.</p>\n<h4 id=\"contentsreplacetext\"><a href=\"#contentsreplacetext\"><code>contents.replace(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes the editing command <code>replace</code> in web page.</p>\n<h4 id=\"contentsreplacemisspellingtext\"><a href=\"#contentsreplacemisspellingtext\"><code>contents.replaceMisspelling(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes the editing command <code>replaceMisspelling</code> in web page.</p>\n<h4 id=\"contentsinserttexttext\"><a href=\"#contentsinserttexttext\"><code>contents.insertText(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code></p>\n<p>Вставляет <code>text</code> в элемент с фокусом.</p>\n<h4 id=\"contentsfindinpagetext-options\"><a href=\"#contentsfindinpagetext-options\"><code>contents.findInPage(text[, options])</code></a></h4>\n<ul>\n<li><code>text</code> String - Content to be searched, must not be empty.</li>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>forward</code> Boolean (optional) - Whether to search forward or backward, defaults to <code>true</code>.</li>\n<li><code>findNext</code> Boolean (optional) - Whether to begin a new text finding session with this request. Should be <code>true</code> for initial requests, and <code>false</code> for follow-up requests. Defaults to <code>false</code>.</li>\n<li><code>matchCase</code> Boolean (optional) - Whether search should be case-sensitive, defaults to <code>false</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code> - The request id used for the request.</p>\n<p>Starts a request to find all matches for the <code>text</code> in the web page. The result of the request can be obtained by subscribing to <a href=\"/docs/api/web-contents#event-found-in-page\"><code>found-in-page</code></a> event.</p>\n<h4 id=\"contentsstopfindinpageaction\"><a href=\"#contentsstopfindinpageaction\"><code>contents.stopFindInPage(action)</code></a></h4>\n<ul>\n<li><code>action</code> String - Specifies the action to take place when ending [<code>webContents.findInPage</code>] request.<ul>\n<li><code>clearSelection</code> - Clear the selection.</li>\n<li><code>keepSelection</code> - Translate the selection into a normal selection.</li>\n<li><code>activateSelection</code> - Focus and click the selection node.</li>\n</ul></li>\n</ul>\n<p>Stops any <code>findInPage</code> request for the <code>webContents</code> with the provided <code>action</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nwebContents.on(<span class=\"hljs-string\">'found-in-page'</span>, (event, result) => {\n  <span class=\"hljs-keyword\">if</span> (result.finalUpdate) webContents.stopFindInPage(<span class=\"hljs-string\">'clearSelection'</span>)\n})\n\n<span class=\"hljs-keyword\">const</span> requestId = webContents.findInPage(<span class=\"hljs-string\">'api'</span>)\n<span class=\"hljs-built_in\">console</span>.log(requestId)\n</code></pre>\n<h4 id=\"contentscapturepagerect\"><a href=\"#contentscapturepagerect\"><code>contents.capturePage([rect])</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (optional) - The area of the page to be captured.</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;NativeImage></code> - разрешается с <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Захватывает снимок страницы в границах <code>rect</code>. Пропустив <code>rect</code>, будет сделан захват всей видимой страницы.</p>\n<h4 id=\"contentsisbeingcaptured\"><a href=\"#contentsisbeingcaptured\"><code>contents.isBeingCaptured()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether this page is being captured. It returns true when the capturer count is large then 0.</p>\n<h4 id=\"contentsincrementcapturercountsize-stayhidden-stayawake\"><a href=\"#contentsincrementcapturercountsize-stayhidden-stayawake\"><code>contents.incrementCapturerCount([size, stayHidden, stayAwake])</code></a></h4>\n<ul>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) - The preferred size for the capturer.</li>\n<li><code>stayHidden</code> Boolean (optional) -  Keep the page hidden instead of visible.</li>\n<li><code>stayAwake</code> Boolean (optional) -  Keep the system awake instead of allowing it to sleep.</li>\n</ul>\n<p>Increase the capturer count by one. The page is considered visible when its browser window is hidden and the capturer count is non-zero. If you would like the page to stay hidden, you should ensure that <code>stayHidden</code> is set to true.</p>\n<p>This also affects the Page Visibility API.</p>\n<h4 id=\"contentsdecrementcapturercountstayhidden-stayawake\"><a href=\"#contentsdecrementcapturercountstayhidden-stayawake\"><code>contents.decrementCapturerCount([stayHidden, stayAwake])</code></a></h4>\n<ul>\n<li><code>stayHidden</code> Boolean (optional) -  Keep the page in hidden state instead of visible.</li>\n<li><code>stayAwake</code> Boolean (optional) -  Keep the system awake instead of allowing it to sleep.</li>\n</ul>\n<p>Decrease the capturer count by one. The page will be set to hidden or occluded state when its browser window is hidden or occluded and the capturer count reaches zero. If you want to decrease the hidden capturer count instead you should set <code>stayHidden</code> to true.</p>\n<h4 id=\"contentsgetprinters\"><a href=\"#contentsgetprinters\"><code>contents.getPrinters()</code></a></h4>\n<p>Get the system printer list.</p>\n<p>Возвращает <a href=\"/docs/api/structures/printer-info\"><code>PrinterInfo[]</code></a></p>\n<h4 id=\"contentsprintoptions-callback\"><a href=\"#contentsprintoptions-callback\"><code>contents.print([options], [callback])</code></a></h4>\n<ul>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>silent</code> Boolean (optional) - Don't ask user for print settings. По умолчанию - <code>false</code>.</li>\n<li><code>printBackground</code> Boolean (optional) - Prints the background color and image of the web page. По умолчанию - <code>false</code>.</li>\n<li><code>deviceName</code> String (optional) - Set the printer device name to use. Must be the system-defined name and not the 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.</li>\n<li><code>color</code> Boolean (optional) - Set whether the printed web page will be in color or grayscale. По умолчанию - <code>true</code>.</li>\n<li><code>margins</code> Object (опционально)<ul>\n<li><code>marginType</code> String (optional) - Can be <code>default</code>, <code>none</code>, <code>printableArea</code>, or <code>custom</code>. If <code>custom</code> is chosen, you will also need to specify <code>top</code>, <code>bottom</code>, <code>left</code>, and <code>right</code>.</li>\n<li><code>top</code> Number (optional) - The top margin of the printed web page, in pixels.</li>\n<li><code>bottom</code> Number (optional) - The bottom margin of the printed web page, in pixels.</li>\n<li><code>left</code> Number (optional) - The left margin of the printed web page, in pixels.</li>\n<li><code>right</code> Number (optional) - The right margin of the printed web page, in pixels.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - Whether the web page should be printed in landscape mode. По умолчанию - <code>false</code>.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page.</li>\n<li><code>pagesPerSheet</code> Number (optional) - The number of pages to print per page sheet.</li>\n<li><code>collate</code> Boolean (optional) - Whether the web page should be collated.</li>\n<li><code>copies</code> Number (optional) - The number of copies of the web page to print.</li>\n<li><code>pageRanges</code> Object<a href=\"/docs/api/optional\"></a> - The page range to print. On macOS, only one range is honored.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>duplexMode</code> String (optional) - Set the duplex mode of the printed web page. Can be <code>simplex</code>, <code>shortEdge</code>, or <code>longEdge</code>.</li>\n<li><code>dpi</code> Record&#x3C;string, number> (optional)<ul>\n<li><code>horizontal</code> Number (optional) - The horizontal dpi.</li>\n<li><code>vertical</code> Number (optional) - The vertical dpi.</li>\n</ul></li>\n<li><code>header</code> String (optional) - String to be printed as page header.</li>\n<li><code>footer</code> String (optional) - String to be printed as page footer.</li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the printed document. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code>.</li>\n</ul></li>\n<li><code>callback</code> Function (опционально)<ul>\n<li><code>success</code> Boolean - Indicates success of the print call.</li>\n<li><code>failureReason</code> String - Error description called back if the print fails.</li>\n</ul></li>\n</ul>\n<p>When a custom <code>pageSize</code> is passed, Chromium attempts to validate platform specific minimum values for <code>width_microns</code> and <code>height_microns</code>. Width and height must both be minimum 353 microns but may be higher on some operating systems.</p>\n<p>Prints window's web page. When <code>silent</code> is set to <code>true</code>, Electron will pick the system's default printer if <code>deviceName</code> is empty and the default settings for printing.</p>\n<p>Use <code>page-break-before: always;</code> CSS style to force to print to a new page.</p>\n<p>Пример использования:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> options = {\n  <span class=\"hljs-attr\">silent</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">deviceName</span>: <span class=\"hljs-string\">'My-Printer'</span>,\n  <span class=\"hljs-attr\">pageRanges</span>: [{\n    <span class=\"hljs-attr\">from</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">to</span>: <span class=\"hljs-number\">1</span>\n  }]\n}\nwin.webContents.print(options, (success, errorType) => {\n  <span class=\"hljs-keyword\">if</span> (!success) <span class=\"hljs-built_in\">console</span>.log(errorType)\n})\n</code></pre>\n<h4 id=\"contentsprinttopdfoptions\"><a href=\"#contentsprinttopdfoptions\"><code>contents.printToPDF(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>headerFooter</code> Record&#x3C;string, string> (optional) - the header and footer for the PDF.<ul>\n<li><code>title</code> String - The title for the PDF header.</li>\n<li><code>url</code> String - the url for the PDF footer.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - <code>true</code> for landscape, <code>false</code> for portrait.</li>\n<li><code>marginsType</code> Integer (optional) - Specifies the type of margins to use. Uses 0 for default margin, 1 for no margin, and 2 for minimum margin.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page. Can range from 0 to 100.</li>\n<li><code>pageRanges</code> Record&#x3C;string, number> (optional) - The page range to print.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the generated PDF. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code> and <code>width</code> in microns.</li>\n<li><code>printBackground</code> Boolean (optional) - Whether to print CSS backgrounds.</li>\n<li><code>printSelectionOnly</code> Boolean (optional) - Whether to print selection only.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Buffer></code> - Resolves with the generated PDF data.</p>\n<p>Prints window's web page as PDF with Chromium's preview printing custom settings.</p>\n<p>The <code>landscape</code> will be ignored if <code>@page</code> CSS at-rule is used in the web page.</p>\n<p>By default, an empty <code>options</code> will be regarded as:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">marginsType</span>: <span class=\"hljs-number\">0</span>,\n  <span class=\"hljs-attr\">printBackground</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">printSelectionOnly</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">landscape</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">pageSize</span>: <span class=\"hljs-string\">'A4'</span>,\n  <span class=\"hljs-attr\">scaleFactor</span>: <span class=\"hljs-number\">100</span>\n}\n</code></pre>\n<p>Use <code>page-break-before: always;</code> CSS style to force to print to a new page.</p>\n<p>An example of <code>webContents.printToPDF</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n<span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\nwin.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n  <span class=\"hljs-comment\">// Use default printing options</span>\n  win.webContents.printToPDF({}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">data</span> =></span> {\n    <span class=\"hljs-keyword\">const</span> pdfPath = path.join(os.homedir(), <span class=\"hljs-string\">'Desktop'</span>, <span class=\"hljs-string\">'temp.pdf'</span>)\n    fs.writeFile(pdfPath, data, (error) => {\n      <span class=\"hljs-keyword\">if</span> (error) <span class=\"hljs-keyword\">throw</span> error\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Wrote PDF successfully to <span class=\"hljs-subst\">${pdfPath}</span>`</span>)\n    })\n  }).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">error</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Failed to write PDF to <span class=\"hljs-subst\">${pdfPath}</span>: `</span>, error)\n  })\n})\n</code></pre>\n<h4 id=\"contentsaddworkspacepath\"><a href=\"#contentsaddworkspacepath\"><code>contents.addWorkSpace(path)</code></a></h4>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Adds the specified path to DevTools workspace. Must be used after DevTools creation:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.on(<span class=\"hljs-string\">'devtools-opened'</span>, () => {\n  win.webContents.addWorkSpace(__dirname)\n})\n</code></pre>\n<h4 id=\"contentsremoveworkspacepath\"><a href=\"#contentsremoveworkspacepath\"><code>contents.removeWorkSpace(path)</code></a></h4>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Removes the specified path from DevTools workspace.</p>\n<h4 id=\"contentssetdevtoolswebcontentsdevtoolswebcontents\"><a href=\"#contentssetdevtoolswebcontentsdevtoolswebcontents\"><code>contents.setDevToolsWebContents(devToolsWebContents)</code></a></h4>\n<ul>\n<li><code>devToolsWebContents</code> WebContents</li>\n</ul>\n<p>Uses the <code>devToolsWebContents</code> as the target <code>WebContents</code> to show devtools.</p>\n<p>The <code>devToolsWebContents</code> must not have done any navigation, and it should not be used for other purposes after the call.</p>\n<p>By default Electron manages the devtools by creating an internal <code>WebContents</code> with native view, which developers have very limited control of. With the <code>setDevToolsWebContents</code> method, developers can use any <code>WebContents</code> to show the devtools in it, including <code>BrowserWindow</code>, <code>BrowserView</code> and <code>&#x3C;webview></code> tag.</p>\n<p>Note that closing the devtools does not destroy the <code>devToolsWebContents</code>, it is caller's responsibility to destroy <code>devToolsWebContents</code>.</p>\n<p>An example of showing devtools in a <code>&#x3C;webview></code> tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">style</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/css\"</span>></span><span class=\"css\">\n    * { <span class=\"hljs-attribute\">margin</span>: <span class=\"hljs-number\">0</span>; }\n    <span class=\"hljs-selector-id\">#browser</span> { <span class=\"hljs-attribute\">height</span>: <span class=\"hljs-number\">70%</span>; }\n    <span class=\"hljs-selector-id\">#devtools</span> { <span class=\"hljs-attribute\">height</span>: <span class=\"hljs-number\">30%</span>; }\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">style</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"browser\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"devtools\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"about:blank\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n    <span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n    <span class=\"hljs-keyword\">const</span> emittedOnce = <span class=\"hljs-function\">(<span class=\"hljs-params\">element, eventName</span>) =></span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> {\n      element.addEventListener(eventName, event => resolve(event), { <span class=\"hljs-attr\">once</span>: <span class=\"hljs-literal\">true</span> })\n    })\n    <span class=\"hljs-keyword\">const</span> browserView = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'browser'</span>)\n    <span class=\"hljs-keyword\">const</span> devtoolsView = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'devtools'</span>)\n    <span class=\"hljs-keyword\">const</span> browserReady = emittedOnce(browserView, <span class=\"hljs-string\">'dom-ready'</span>)\n    <span class=\"hljs-keyword\">const</span> devtoolsReady = emittedOnce(devtoolsView, <span class=\"hljs-string\">'dom-ready'</span>)\n    <span class=\"hljs-built_in\">Promise</span>.all([browserReady, devtoolsReady]).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      <span class=\"hljs-keyword\">const</span> targetId = browserView.getWebContentsId()\n      <span class=\"hljs-keyword\">const</span> devtoolsId = devtoolsView.getWebContentsId()\n      ipcRenderer.send(<span class=\"hljs-string\">'open-devtools'</span>, targetId, devtoolsId)\n    })\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain, webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'open-devtools'</span>, (event, targetContentsId, devtoolsContentsId) => {\n  <span class=\"hljs-keyword\">const</span> target = webContents.fromId(targetContentsId)\n  <span class=\"hljs-keyword\">const</span> devtools = webContents.fromId(devtoolsContentsId)\n  target.setDevToolsWebContents(devtools)\n  target.openDevTools()\n})\n</code></pre>\n<p>An example of showing devtools in a <code>BrowserWindow</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n<span class=\"hljs-keyword\">let</span> devtools = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  devtools = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  win.webContents.setDevToolsWebContents(devtools.webContents)\n  win.webContents.openDevTools({ <span class=\"hljs-attr\">mode</span>: <span class=\"hljs-string\">'detach'</span> })\n})\n</code></pre>\n<h4 id=\"contentsopendevtoolsoptions\"><a href=\"#contentsopendevtoolsoptions\"><code>contents.openDevTools([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>mode</code> String - Opens the devtools with specified dock state, can be <code>right</code>, <code>bottom</code>, <code>undocked</code>, <code>detach</code>. Defaults to last used dock state. In <code>undocked</code> mode it's possible to dock back. In <code>detach</code> mode it's not.</li>\n<li><code>activate</code> Boolean (optional) - Whether to bring the opened devtools window to the foreground. По-умолчанию - <code>true</code>.</li>\n</ul></li>\n</ul>\n<p>Opens the devtools.</p>\n<p>When <code>contents</code> is a <code>&#x3C;webview></code> tag, the <code>mode</code> would be <code>detach</code> by default, explicitly passing an empty <code>mode</code> can force using last used dock state.</p>\n<h4 id=\"contentsclosedevtools\"><a href=\"#contentsclosedevtools\"><code>contents.closeDevTools()</code></a></h4>\n<p>Closes the devtools.</p>\n<h4 id=\"contentsisdevtoolsopened\"><a href=\"#contentsisdevtoolsopened\"><code>contents.isDevToolsOpened()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the devtools is opened.</p>\n<h4 id=\"contentsisdevtoolsfocused\"><a href=\"#contentsisdevtoolsfocused\"><code>contents.isDevToolsFocused()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the devtools view is focused .</p>\n<h4 id=\"contentstoggledevtools\"><a href=\"#contentstoggledevtools\"><code>contents.toggleDevTools()</code></a></h4>\n<p>Toggles the developer tools.</p>\n<h4 id=\"contentsinspectelementx-y\"><a href=\"#contentsinspectelementx-y\"><code>contents.inspectElement(x, y)</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Starts inspecting element at position (<code>x</code>, <code>y</code>).</p>\n<h4 id=\"contentsinspectsharedworker\"><a href=\"#contentsinspectsharedworker\"><code>contents.inspectSharedWorker()</code></a></h4>\n<p>Opens the developer tools for the shared worker context.</p>\n<h4 id=\"contentsinspectsharedworkerbyidworkerid\"><a href=\"#contentsinspectsharedworkerbyidworkerid\"><code>contents.inspectSharedWorkerById(workerId)</code></a></h4>\n<ul>\n<li><code>workerId</code> String</li>\n</ul>\n<p>Inspects the shared worker based on its ID.</p>\n<h4 id=\"contentsgetallsharedworkers\"><a href=\"#contentsgetallsharedworkers\"><code>contents.getAllSharedWorkers()</code></a></h4>\n<p>Returns <a href=\"/docs/api/structures/shared-worker-info\"><code>SharedWorkerInfo[]</code></a> - Information about all Shared Workers.</p>\n<h4 id=\"contentsinspectserviceworker\"><a href=\"#contentsinspectserviceworker\"><code>contents.inspectServiceWorker()</code></a></h4>\n<p>Opens the developer tools for the service worker context.</p>\n<h4 id=\"contentssendchannel-args\"><a href=\"#contentssendchannel-args\"><code>contents.send(channel, ...args)</code></a></h4>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to the renderer process via <code>channel</code>, along with arguments. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE</strong>: Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n</blockquote>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>An example of sending messages from the main process to the renderer process:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// В основном процессе.</span>\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/index.html`</span>)\n  win.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n    win.webContents.send(<span class=\"hljs-string\">'ping'</span>, <span class=\"hljs-string\">'whoooooooh!'</span>)\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- index.html --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n    <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).ipcRenderer.on(<span class=\"hljs-string\">'ping'</span>, (event, message) => {\n      <span class=\"hljs-built_in\">console</span>.log(message) <span class=\"hljs-comment\">// Prints 'whoooooooh!'</span>\n    })\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<h4 id=\"contentssendtoframeframeid-channel-args\"><a href=\"#contentssendtoframeframeid-channel-args\"><code>contents.sendToFrame(frameId, channel, ...args)</code></a></h4>\n<ul>\n<li><code>frameId</code> Integer | [number, number] - the ID of the frame to send to, or a pair of <code>[processId, frameId]</code> if the frame is in a different process to the main frame.</li>\n<li><code>channel</code> String (Строка)</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to a specific frame in a renderer process via <code>channel</code>, along with arguments. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n</blockquote>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>If you want to get the <code>frameId</code> of a given renderer context you should use the <code>webFrame.routingId</code> value.  Например,</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// In a renderer process</span>\n<span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'My frameId is:'</span>, <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).webFrame.routingId)\n</code></pre>\n<p>You can also read <code>frameId</code> from all incoming IPC messages in the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// In the main process</span>\nipcMain.on(<span class=\"hljs-string\">'ping'</span>, (event) => {\n  <span class=\"hljs-built_in\">console</span>.info(<span class=\"hljs-string\">'Message came from frameId:'</span>, event.frameId)\n})\n</code></pre>\n<h4 id=\"contentspostmessagechannel-message-transfer\"><a href=\"#contentspostmessagechannel-message-transfer\"><code>contents.postMessage(channel, message, [transfer])</code></a></h4>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Send a message to the renderer process, optionally transferring ownership of zero or more [<code>MessagePortMain</code>][] objects.</p>\n<p>The transferred <code>MessagePortMain</code> objects will be available in the renderer process by accessing the <code>ports</code> property of the emitted event. When they arrive in the renderer, they will be native DOM <code>MessagePort</code> objects.</p>\n<p>Например:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nwebContents.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<h4 id=\"contentsenabledeviceemulationparameters\"><a href=\"#contentsenabledeviceemulationparameters\"><code>contents.enableDeviceEmulation(parameters)</code></a></h4>\n<ul>\n<li>Объект <code>parameters</code><ul>\n<li><code>screenPosition</code> String - Specify the screen type to emulate (default: <code>desktop</code>):<ul>\n<li><code>desktop</code> - Desktop screen type.</li>\n<li><code>mobile</code> - Mobile screen type.</li>\n</ul></li>\n<li><code>screenSize</code> <a href=\"/docs/api/structures/size\">Size</a> - Set the emulated screen size (screenPosition == mobile).</li>\n<li><code>viewPosition</code> <a href=\"/docs/api/structures/point\">Point</a> - Position the view on the screen (screenPosition == mobile) (default: <code>{ x: 0, y: 0 }</code>).</li>\n<li><code>deviceScaleFactor</code> Integer - Set the device scale factor (if zero defaults to original device scale factor) (default: <code>0</code>).</li>\n<li><code>viewSize</code> <a href=\"/docs/api/structures/size\">Size</a> - Set the emulated view size (empty means no override)</li>\n<li><code>scale</code> Float - Scale of emulated view inside available space (not in fit to view mode) (default: <code>1</code>).</li>\n</ul></li>\n</ul>\n<p>Enable device emulation with the given parameters.</p>\n<h4 id=\"contentsdisabledeviceemulation\"><a href=\"#contentsdisabledeviceemulation\"><code>contents.disableDeviceEmulation()</code></a></h4>\n<p>Disable device emulation enabled by <code>webContents.enableDeviceEmulation</code>.</p>\n<h4 id=\"contentssendinputeventinputevent\"><a href=\"#contentssendinputeventinputevent\"><code>contents.sendInputEvent(inputEvent)</code></a></h4>\n<ul>\n<li><code>inputEvent</code> <a href=\"/docs/api/structures/mouse-input-event\">MouseInputEvent</a> | <a href=\"/docs/api/structures/mouse-wheel-input-event\">MouseWheelInputEvent</a> | <a href=\"/docs/api/structures/keyboard-input-event\">KeyboardInputEvent</a></li>\n</ul>\n<p>Sends an input <code>event</code> to the page. <strong>Note:</strong> The <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> containing the contents needs to be focused for <code>sendInputEvent()</code> to work.</p>\n<h4 id=\"contentsbeginframesubscriptiononlydirty-callback\"><a href=\"#contentsbeginframesubscriptiononlydirty-callback\"><code>contents.beginFrameSubscription([onlyDirty ,]callback)</code></a></h4>\n<ul>\n<li><code>onlyDirty</code> Boolean (опиционально) - по умолчанию <code>false</code>.</li>\n<li><code>callback</code> Function<ul>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a></li>\n<li><code>dirtyRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul></li>\n</ul>\n<p>Begin subscribing for presentation events and captured frames, the <code>callback</code> will be called with <code>callback(image, dirtyRect)</code> when there is a presentation event.</p>\n<p>The <code>image</code> is an instance of <a href=\"/docs/api/native-image\">NativeImage</a> that stores the captured frame.</p>\n<p>The <code>dirtyRect</code> is an object with <code>x, y, width, height</code> properties that describes which part of the page was repainted. If <code>onlyDirty</code> is set to <code>true</code>, <code>image</code> will only contain the repainted area. <code>onlyDirty</code> defaults to <code>false</code>.</p>\n<h4 id=\"contentsendframesubscription\"><a href=\"#contentsendframesubscription\"><code>contents.endFrameSubscription()</code></a></h4>\n<p>End subscribing for frame presentation events.</p>\n<h4 id=\"contentsstartdragitem\"><a href=\"#contentsstartdragitem\"><code>contents.startDrag(item)</code></a></h4>\n<ul>\n<li>Объект <code>item</code><ul>\n<li><code>file</code> String - The path to the file being dragged.</li>\n<li><code>files</code> String<a href=\"/docs/api/optional\"></a> - The paths to the files being dragged. (<code>files</code> will override <code>file</code> field)</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String - The image must be non-empty on macOS.</li>\n</ul></li>\n</ul>\n<p>Sets the <code>item</code> as dragging item for current drag-drop operation, <code>file</code> is the absolute path of the file to be dragged, and <code>icon</code> is the image showing under the cursor when dragging.</p>\n<h4 id=\"contentssavepagefullpath-savetype\"><a href=\"#contentssavepagefullpath-savetype\"><code>contents.savePage(fullPath, saveType)</code></a></h4>\n<ul>\n<li><code>fullPath</code> String - The full file path.</li>\n<li><code>saveType</code> String - Specify the save type.<ul>\n<li><code>HTMLOnly</code> - Save only the HTML of the page.</li>\n<li><code>HTMLComplete</code> - Save complete-html page.</li>\n<li><code>MHTML</code> - Save complete-html page as MHTML.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves if the page is saved.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\nwin.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  win.webContents.savePage(<span class=\"hljs-string\">'/tmp/test.html'</span>, <span class=\"hljs-string\">'HTMLComplete'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Page was saved successfully.'</span>)\n  }).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(err)\n  })\n})\n</code></pre>\n<h4 id=\"contentsshowdefinitionforselection-macos\"><a href=\"#contentsshowdefinitionforselection-macos\"><code>contents.showDefinitionForSelection()</code> <em>macOS</em></a></h4>\n<p>Shows pop-up dictionary that searches the selected word on the page.</p>\n<h4 id=\"contentsisoffscreen\"><a href=\"#contentsisoffscreen\"><code>contents.isOffscreen()</code></a></h4>\n<p>Returns <code>Boolean</code> - Indicates whether <em>offscreen rendering</em> is enabled.</p>\n<h4 id=\"contentsstartpainting\"><a href=\"#contentsstartpainting\"><code>contents.startPainting()</code></a></h4>\n<p>If <em>offscreen rendering</em> is enabled and not painting, start painting.</p>\n<h4 id=\"contentsstoppainting\"><a href=\"#contentsstoppainting\"><code>contents.stopPainting()</code></a></h4>\n<p>If <em>offscreen rendering</em> is enabled and painting, stop painting.</p>\n<h4 id=\"contentsispainting\"><a href=\"#contentsispainting\"><code>contents.isPainting()</code></a></h4>\n<p>Returns <code>Boolean</code> - If <em>offscreen rendering</em> is enabled returns whether it is currently painting.</p>\n<h4 id=\"contentssetframeratefps\"><a href=\"#contentssetframeratefps\"><code>contents.setFrameRate(fps)</code></a></h4>\n<ul>\n<li><code>fps</code> Integer</li>\n</ul>\n<p>If <em>offscreen rendering</em> is enabled sets the frame rate to the specified number. Only values between 1 and 240 are accepted.</p>\n<h4 id=\"contentsgetframerate\"><a href=\"#contentsgetframerate\"><code>contents.getFrameRate()</code></a></h4>\n<p>Returns <code>Integer</code> - If <em>offscreen rendering</em> is enabled returns the current frame rate.</p>\n<h4 id=\"contentsinvalidate\"><a href=\"#contentsinvalidate\"><code>contents.invalidate()</code></a></h4>\n<p>Schedules a full repaint of the window this web contents is in.</p>\n<p>If <em>offscreen rendering</em> is enabled invalidates the frame and generates a new one through the <code>'paint'</code> event.</p>\n<h4 id=\"contentsgetwebrtciphandlingpolicy\"><a href=\"#contentsgetwebrtciphandlingpolicy\"><code>contents.getWebRTCIPHandlingPolicy()</code></a></h4>\n<p>Returns <code>String</code> - Returns the WebRTC IP Handling Policy.</p>\n<h4 id=\"contentssetwebrtciphandlingpolicypolicy\"><a href=\"#contentssetwebrtciphandlingpolicypolicy\"><code>contents.setWebRTCIPHandlingPolicy(policy)</code></a></h4>\n<ul>\n<li><code>policy</code> String - Specify the WebRTC IP Handling Policy.<ul>\n<li><code>default</code> - Exposes user's public and local IPs. This is the default behavior. When this policy is used, WebRTC has the right to enumerate all interfaces and bind them to discover public interfaces.</li>\n<li><code>default_public_interface_only</code> - Exposes user's public IP, but does not expose user's local IP. When this policy is used, WebRTC should only use the default route used by http. This doesn't expose any local addresses.</li>\n<li><code>default_public_and_private_interfaces</code> - Exposes user's public and local IPs. When this policy is used, WebRTC should only use the default route used by http. This also exposes the associated default private address. Default route is the route chosen by the OS on a multi-homed endpoint.</li>\n<li><code>disable_non_proxied_udp</code> - Does not expose public or local IPs. When this policy is used, WebRTC should only use TCP to contact peers or servers unless the proxy server supports UDP.</li>\n</ul></li>\n</ul>\n<p>Setting the WebRTC IP handling policy allows you to control which IPs are exposed via WebRTC. See <a href=\"https://browserleaks.com/webrtc\">BrowserLeaks</a> for more details.</p>\n<h4 id=\"contentsgetosprocessid\"><a href=\"#contentsgetosprocessid\"><code>contents.getOSProcessId()</code></a></h4>\n<p>Returns <code>Integer</code> - The operating system <code>pid</code> of the associated renderer process.</p>\n<h4 id=\"contentsgetprocessid\"><a href=\"#contentsgetprocessid\"><code>contents.getProcessId()</code></a></h4>\n<p>Returns <code>Integer</code> - The Chromium internal <code>pid</code> of the associated renderer. Can be compared to the <code>frameProcessId</code> passed by frame specific navigation events (e.g. <code>did-frame-navigate</code>)</p>\n<h4 id=\"contentstakeheapsnapshotfilepath\"><a href=\"#contentstakeheapsnapshotfilepath\"><code>contents.takeHeapSnapshot(filePath)</code></a></h4>\n<ul>\n<li><code>filePath</code> String - Path to the output file.</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code>, который указывает успешно ли создан снимок.</p>\n<p>Делает снимок кучи V8 и сохраняет его в <code>filePath</code>.</p>\n<h4 id=\"contentsgetbackgroundthrottling\"><a href=\"#contentsgetbackgroundthrottling\"><code>contents.getBackgroundThrottling()</code></a></h4>\n<p>Returns <code>Boolean</code> - whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentssetbackgroundthrottlingallowed\"><a href=\"#contentssetbackgroundthrottlingallowed\"><code>contents.setBackgroundThrottling(allowed)</code></a></h4>\n<ul>\n<li><code>allowed</code> Boolean</li>\n</ul>\n<p>Controls whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentsgettype\"><a href=\"#contentsgettype\"><code>contents.getType()</code></a></h4>\n<p>Returns <code>String</code> - the type of the webContent. Can be <code>backgroundPage</code>, <code>window</code>, <code>browserView</code>, <code>remote</code>, <code>webview</code> or <code>offscreen</code>.</p>\n<h4 id=\"contentssetimageanimationpolicypolicy\"><a href=\"#contentssetimageanimationpolicypolicy\"><code>contents.setImageAnimationPolicy(policy)</code></a></h4>\n<ul>\n<li><code>policy</code> String - может быть завершено <code>animate</code>, отменено <code>animateOnce</code> или прервано <code>noAnimation</code>.</li>\n</ul>\n<p>Sets the image animation policy for this webContents.  The policy only affects <em>new</em> images, existing images that are currently being animated are unaffected. This is a known limitation in Chromium, you can force image animation to be recalculated with <code>img.src = img.src</code> which will result in no network traffic but will update the animation policy.</p>\n<p>This corresponds to the <a href=\"https://developer.chrome.com/docs/extensions/reference/accessibilityFeatures/#property-animationPolicy\">animationPolicy</a> accessibility feature in Chromium.</p>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<h4 id=\"contentsaudiomuted\"><a href=\"#contentsaudiomuted\"><code>contents.audioMuted</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether this page is muted.</p>\n<h4 id=\"contentsuseragent\"><a href=\"#contentsuseragent\"><code>contents.userAgent</code></a></h4>\n<p>A <code>String</code> property that determines the user agent for this web page.</p>\n<h4 id=\"contentszoomlevel\"><a href=\"#contentszoomlevel\"><code>contents.zoomLevel</code></a></h4>\n<p>A <code>Number</code> property that determines the zoom level for this web contents.</p>\n<p>The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. The formula for this is <code>scale := 1.2 ^ level</code>.</p>\n<h4 id=\"contentszoomfactor\"><a href=\"#contentszoomfactor\"><code>contents.zoomFactor</code></a></h4>\n<p>A <code>Number</code> property that determines the zoom factor for this web contents.</p>\n<p>The zoom factor is the zoom percent divided by 100, so 300% = 3.0.</p>\n<h4 id=\"contentsframerate\"><a href=\"#contentsframerate\"><code>contents.frameRate</code></a></h4>\n<p>An <code>Integer</code> property that sets the frame rate of the web contents to the specified number. Only values between 1 and 240 are accepted.</p>\n<p>Only applicable if <em>offscreen rendering</em> is enabled.</p>\n<h4 id=\"contentsid-только-чтение\"><a href=\"#contentsid-только-чтение\"><code>contents.id</code> <em>Только чтение</em></a></h4>\n<p>A <code>Integer</code> representing the unique ID of this WebContents. Each ID is unique among all <code>WebContents</code> instances of the entire Electron application.</p>\n<h4 id=\"contentssession-только-чтение\"><a href=\"#contentssession-только-чтение\"><code>contents.session</code> <em>Только чтение</em></a></h4>\n<p>A <a href=\"/docs/api/session\"><code>Session</code></a> used by this webContents.</p>\n<h4 id=\"contentshostwebcontents-только-чтение\"><a href=\"#contentshostwebcontents-только-чтение\"><code>contents.hostWebContents</code> <em>Только чтение</em></a></h4>\n<p>A <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> instance that might own this <code>WebContents</code>.</p>\n<h4 id=\"contentsdevtoolswebcontents-только-чтение\"><a href=\"#contentsdevtoolswebcontents-только-чтение\"><code>contents.devToolsWebContents</code> <em>Только чтение</em></a></h4>\n<p>A <code>WebContents | null</code> property that represents the of DevTools <code>WebContents</code> associated with a given <code>WebContents</code>.</p>\n<p><strong>Note:</strong> Users should never store this object because it may become <code>null</code> when the DevTools has been closed.</p>\n<h4 id=\"contentsdebugger-только-чтение\"><a href=\"#contentsdebugger-только-чтение\"><code>contents.debugger</code> <em>Только чтение</em></a></h4>\n<p>A <a href=\"/docs/api/debugger\"><code>Debugger</code></a> instance for this webContents.</p>\n<h4 id=\"contentsbackgroundthrottling\"><a href=\"#contentsbackgroundthrottling\"><code>contents.backgroundThrottling</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentsmainframe-только-чтение\"><a href=\"#contentsmainframe-только-чтение\"><code>contents.mainFrame</code> <em>Только чтение</em></a></h4>\n<p>A <a href=\"/docs/api/web-frame-main\"><code>WebFrameMain</code></a> property that represents the top frame of the page's frame hierarchy.</p>",
      "title": "webContents",
      "description": "Render and control web pages."
    },
    "/docs/tutorial/web-embeds": {
      "locale": "ru-RU",
      "slug": "web-embeds",
      "href": "/docs/tutorial/web-embeds",
      "crowdinFileId": "256269",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/web-embeds.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"web-embeds\"><a href=\"#web-embeds\">Web Embeds</a></h1>\n<h2 id=\"обзор\"><a href=\"#обзор\">Обзор</a></h2>\n<p>If you want to embed (third-party) web content in an Electron <code>BrowserWindow</code>, there are three options available to you: <code>&#x3C;iframe></code> tags, <code>&#x3C;webview></code> tags, and <code>BrowserViews</code>. Each one offers slightly different functionality and is useful in different situations. To help you choose between these, this guide explains the differences and capabilities of each option.</p>\n<h3 id=\"iframes\"><a href=\"#iframes\">Iframes</a></h3>\n<p>Iframe в Electron ведет себя так же, как iframe в обычных браузерах. An <code>&#x3C;iframe></code> element in your page can show external web pages, provided that their <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP\">Content Security Policy</a> allows it. To limit the number of capabilities of a site in an <code>&#x3C;iframe></code> tag, it is recommended to use the <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox\"><code>sandbox</code> attribute</a> and only allow the capabilities you want to support.</p>\n<h3 id=\"webviews\"><a href=\"#webviews\">WebViews</a></h3>\n<blockquote>\n<p>Important Note: <a href=\"/docs/api/webview-tag#warning\">we do not recommend you to use WebViews</a>, as this tag undergoes dramatic architectural changes that may affect stability of your application. Consider switching to alternatives, like <code>iframe</code> and Electron's <code>BrowserView</code>, or an architecture that avoids embedded content by design.</p>\n</blockquote>\n<p><a href=\"/docs/api/webview-tag\">WebViews</a> are based on Chromium's WebViews and are not explicitly supported by Electron. We do not guarantee that the WebView API will remain available in future versions of Electron. To use <code>&#x3C;webview></code> tags, you will need to set <code>webviewTag</code> to <code>true</code> in the <code>webPreferences</code> of your <code>BrowserWindow</code>.</p>\n<p>WebView is a custom element (<code>&#x3C;webview></code>) that will only work inside Electron. They are implemented as an \"out-of-process iframe\". This means that all communication with the <code>&#x3C;webview></code> is done asynchronously using IPC. The <code>&#x3C;webview></code> element has many custom methods and events, similar to <code>webContents</code>, that provide you with greater control over the content.</p>\n<p>Compared to an <code>&#x3C;iframe></code>, <code>&#x3C;webview></code> tends to be slightly slower but offers much greater control in loading and communicating with the third-party content and handling various events.</p>\n<h3 id=\"browserviews\"><a href=\"#browserviews\">BrowserViews</a></h3>\n<p><a href=\"/docs/api/browser-view\">BrowserViews</a> are not a part of the DOM - instead, they are created in and controlled by your Main process. They are simply another layer of web content on top of your existing window. This means that they are completely separate from your own <code>BrowserWindow</code> content and their position is not controlled by the DOM or CSS. Instead, it is controlled by setting the bounds in the Main process.</p>\n<p><code>BrowserViews</code> offer the greatest control over their contents, since they implement the <code>webContents</code> similarly to how the <code>BrowserWindow</code> does it. However, as <code>BrowserViews</code> are not a part of your DOM, but are rather overlaid on top of them, you will have to manage their position manually.</p>",
      "title": "Web Embeds",
      "description": "Important Note: we do not recommend you to use WebViews, as this tag undergoes dramatic architectural changes that may affect stability of your application. Consider switching to alternatives, like iframe and Electron's BrowserView, or an architecture that avoids embedded content by design."
    },
    "/docs/api/web-frame": {
      "locale": "ru-RU",
      "slug": "web-frame",
      "href": "/docs/api/web-frame",
      "crowdinFileId": "256403",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-frame.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webframe\"><a href=\"#webframe\">webFrame</a></h1>\n<blockquote>\n<p>Настройка отображения текущей веб-страницы.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#renderer-process\">Графический</a></p>\n<p><code>webFrame</code> export of the Electron module is an instance of the <code>WebFrame</code> class representing the top frame of the current <code>BrowserWindow</code>. Sub-frames can be retrieved by certain properties and methods (e.g. <code>webFrame.firstChild</code>).</p>\n<p>Пример масштабирования текущей страницы до 200%.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nwebFrame.setZoomFactor(<span class=\"hljs-number\">2</span>)\n</code></pre>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>The <code>WebFrame</code> class has the following instance methods:</p>\n<h3 id=\"webframesetzoomfactorfactor\"><a href=\"#webframesetzoomfactorfactor\"><code>webFrame.setZoomFactor(factor)</code></a></h3>\n<ul>\n<li><code>factor</code> Double - Zoom factor; default is 1.0.</li>\n</ul>\n<p>Changes the zoom factor to the specified factor. Zoom factor is zoom percent divided by 100, so 300% = 3.0.</p>\n<p>The factor must be greater than 0.0.</p>\n<h3 id=\"webframegetzoomfactor\"><a href=\"#webframegetzoomfactor\"><code>webFrame.getZoomFactor()</code></a></h3>\n<p>Возвращает <code>Number</code> - текущего маштаба.</p>\n<h3 id=\"webframesetzoomlevellevel\"><a href=\"#webframesetzoomlevellevel\"><code>webFrame.setZoomLevel(level)</code></a></h3>\n<ul>\n<li><code>level</code> Number - уровень увеличения.</li>\n</ul>\n<p>Изменяет уровень масштаба на указанный уровень. Оригинальный размер 0 и каждое приращение выше или ниже представляет масштабирование 20% больше или меньше, по умолчанию ограничение на 300% и 50% от исходного размера, соответственно.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h3 id=\"webframegetzoomlevel\"><a href=\"#webframegetzoomlevel\"><code>webFrame.getZoomLevel()</code></a></h3>\n<p>Возвращает <code>Number</code> - текущего уровня маштаба.</p>\n<h3 id=\"webframesetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#webframesetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>webFrame.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h3>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>Устанавливает максимальный и минимальный уровень пинч-маштабирования.</p>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom is disabled by default in Electron. To re-enable it, call:</p>\n<pre><code class=\"hljs language-js\">webFrame.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">3</span>)\n</code></pre>\n</blockquote>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom shortcuts are controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem roles in the application Menu. To disable shortcuts, manually <a href=\"/docs/api/menu#examples\">define the Menu</a> and omit zoom roles from the definition.</p>\n</blockquote>\n<h3 id=\"webframesetspellcheckproviderlanguage-provider\"><a href=\"#webframesetspellcheckproviderlanguage-provider\"><code>webFrame.setSpellCheckProvider(language, provider)</code></a></h3>\n<ul>\n<li><code>language</code> String</li>\n<li>Объект <code>provider</code><ul>\n<li><code>spellCheck</code> Function<ul>\n<li>Строка <code>words</code>[]</li>\n<li><code>callback</code> Function<ul>\n<li>Строка <code>misspeltWords</code>[]</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Задает поставщика для проверки орфографии в полях ввода и текстовых областях.</p>\n<p>If you want to use this method you must disable the builtin spellchecker when you construct the window.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">spellcheck</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\n</code></pre>\n<p>The <code>provider</code> must be an object that has a <code>spellCheck</code> method that accepts an array of individual words for spellchecking. The <code>spellCheck</code> function runs asynchronously and calls the <code>callback</code> function with an array of misspelt words when complete.</p>\n<p>Пример использования <a href=\"https://github.com/atom/node-spellchecker\">node-spellchecker</a> как поставщик:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> spellChecker = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spellchecker'</span>)\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, {\n  spellCheck (words, callback) {\n    setTimeout(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      <span class=\"hljs-keyword\">const</span> spellchecker = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spellchecker'</span>)\n      <span class=\"hljs-keyword\">const</span> misspelled = words.filter(<span class=\"hljs-function\"><span class=\"hljs-params\">x</span> =></span> spellchecker.isMisspelled(x))\n      callback(misspelled)\n    }, <span class=\"hljs-number\">0</span>)\n  }\n})\n</code></pre>\n<h3 id=\"webframeinsertcsscss\"><a href=\"#webframeinsertcsscss\"><code>webFrame.insertCSS(css)</code></a></h3>\n<ul>\n<li><code>css</code> String - CSS source code.</li>\n</ul>\n<p>Returns <code>String</code> - A key for the inserted CSS that can later be used to remove the CSS via <code>webFrame.removeInsertedCSS(key)</code>.</p>\n<p>Injects CSS into the current web page and returns a unique key for the inserted stylesheet.</p>\n<h3 id=\"webframeremoveinsertedcsskey\"><a href=\"#webframeremoveinsertedcsskey\"><code>webFrame.removeInsertedCSS(key)</code></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from <code>webFrame.insertCSS(css)</code>.</p>\n<h3 id=\"webframeinserttexttext\"><a href=\"#webframeinserttexttext\"><code>webFrame.insertText(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Вставляет <code>text</code> в элемент с фокусом.</p>\n<h3 id=\"webframeexecutejavascriptcode-usergesture-callback\"><a href=\"#webframeexecutejavascriptcode-usergesture-callback\"><code>webFrame.executeJavaScript(code[, userGesture, callback])</code></a></h3>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (опиционально) - по умолчанию <code>false</code>.</li>\n<li><code>callback</code> Function (optional) - Called after script has been executed. Unless the frame is suspended (e.g. showing a modal alert), execution will be synchronous and the callback will be invoked before the method returns. For compatibility with an older version of this method, the error parameter is second.<ul>\n<li><code>result</code> Any</li>\n<li><code>error</code> Error</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if execution throws or results in a rejected promise.</p>\n<p>Вычисляет <code>code</code> на странице.</p>\n<p>В окне браузера некоторые HTML API как <code>requestFullScreen</code> может быть только вызван жестом пользователя. Указание <code>userGesture</code> как <code>true</code> снимает это ограничение.</p>\n<h3 id=\"webframeexecutejavascriptinisolatedworldworldid-scripts-usergesture-callback\"><a href=\"#webframeexecutejavascriptinisolatedworldworldid-scripts-usergesture-callback\"><code>webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture, callback])</code></a></h3>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default main world (where content runs), <code>999</code> is the world used by Electron's <code>contextIsolation</code> feature. Accepts values in the range 1..536870911.</li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/web-source\">WebSource[]</a></li>\n<li><code>userGesture</code> Boolean (опиционально) - по умолчанию <code>false</code>.</li>\n<li><code>callback</code> Function (optional) - Called after script has been executed. Unless the frame is suspended (e.g. showing a modal alert), execution will be synchronous and the callback will be invoked before the method returns.  For compatibility with an older version of this method, the error parameter is second.<ul>\n<li><code>result</code> Any</li>\n<li><code>error</code> Error</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if execution could not start.</p>\n<p>Works like <code>executeJavaScript</code> but evaluates <code>scripts</code> in an isolated context.</p>\n<p>Note that when the execution of script fails, the returned promise will not reject and the <code>result</code> would be <code>undefined</code>. This is because Chromium does not dispatch errors of isolated worlds to foreign worlds.</p>\n<h3 id=\"webframesetisolatedworldinfoworldid-info\"><a href=\"#webframesetisolatedworldinfoworldid-info\"><code>webFrame.setIsolatedWorldInfo(worldId, info)</code></a></h3>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default world, <code>999</code> is the world used by Electrons <code>contextIsolation</code> feature. Chrome extensions reserve the range of IDs in <code>[1 &#x3C;&#x3C; 20, 1 &#x3C;&#x3C; 29)</code>. You can provide any integer here.</li>\n<li>Объект <code>info</code><ul>\n<li><code>securityOrigin</code> String (optional) - Security origin for the isolated world.</li>\n<li><code>csp</code> String (optional) - Content Security Policy for the isolated world.</li>\n<li><code>name</code> String (optional) - Name for isolated world. Useful in devtools.</li>\n</ul></li>\n</ul>\n<p>Set the security origin, content security policy and name of the isolated world. Note: If the <code>csp</code> is specified, then the <code>securityOrigin</code> also has to be specified.</p>\n<h3 id=\"webframegetresourceusage\"><a href=\"#webframegetresourceusage\"><code>webFrame.getResourceUsage()</code></a></h3>\n<p>Возвращает <code>Object</code>:</p>\n<ul>\n<li><code>images</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>cssStyleSheets</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>xslStyleSheets</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>fonts</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>other</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n</ul>\n<p>Возвращает объект, описывающий сведения об использовании Blink внутренней памяти кэшей.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(webFrame.getResourceUsage())\n</code></pre>\n<p>Это будет генерировать:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">images</span>: {\n    <span class=\"hljs-attr\">count</span>: <span class=\"hljs-number\">22</span>,\n    <span class=\"hljs-attr\">size</span>: <span class=\"hljs-number\">2549</span>,\n    <span class=\"hljs-attr\">liveSize</span>: <span class=\"hljs-number\">2542</span>\n  },\n  <span class=\"hljs-attr\">cssStyleSheets</span>: { <span class=\"hljs-comment\">/* то же самое с \"images\" */</span> },\n  <span class=\"hljs-attr\">xslStyleSheets</span>: { <span class=\"hljs-comment\">/* то же самое с \"images\" */</span> },\n  <span class=\"hljs-attr\">fonts</span>: { <span class=\"hljs-comment\">/* то же самое с \"images\" */</span> },\n  <span class=\"hljs-attr\">other</span>: { <span class=\"hljs-comment\">/* то же самое с \"images\" */</span> }\n}\n</code></pre>\n<h3 id=\"webframeclearcache\"><a href=\"#webframeclearcache\"><code>webFrame.clearCache()</code></a></h3>\n<p>Пытается освободить память, которая больше не используется (например, изображения из предыдущей навигации).</p>\n<p>Обратите внимание, что безрассудный вызов этого метода вероятно замедлит Electron, поскольку ему придется чистить кэши даже если они уже пустые, так что этот метод следует вызывать только в случае, когда вы уверены, что страница стала использовать меньше памяти (например, произошел переход с супер-тяжёлой страницы на лёгкую без ожидаемого возврата обратно на тяжёлую).</p>\n<h3 id=\"webframegetframeforselectorselector\"><a href=\"#webframegetframeforselectorselector\"><code>webFrame.getFrameForSelector(selector)</code></a></h3>\n<ul>\n<li><code>selector</code> String - CSS selector for a frame element.</li>\n</ul>\n<p>Returns <code>WebFrame</code> - The frame element in <code>webFrame's</code> document selected by <code>selector</code>, <code>null</code> would be returned if <code>selector</code> does not select a frame or if the frame is not in the current renderer process.</p>\n<h3 id=\"webframefindframebynamename\"><a href=\"#webframefindframebynamename\"><code>webFrame.findFrameByName(name)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n</ul>\n<p>Returns <code>WebFrame</code> - A child of <code>webFrame</code> with the supplied <code>name</code>, <code>null</code> would be returned if there's no such frame or if the frame is not in the current renderer process.</p>\n<h3 id=\"webframefindframebyroutingidroutingid\"><a href=\"#webframefindframebyroutingidroutingid\"><code>webFrame.findFrameByRoutingId(routingId)</code></a></h3>\n<ul>\n<li><code>routingId</code> Integer - An <code>Integer</code> representing the unique frame id in the current renderer process. Routing IDs can be retrieved from <code>WebFrame</code> instances (<code>webFrame.routingId</code>) and are also passed by frame specific <code>WebContents</code> navigation events (e.g. <code>did-frame-navigate</code>)</li>\n</ul>\n<p>Returns <code>WebFrame</code> - that has the supplied <code>routingId</code>, <code>null</code> if not found.</p>\n<h3 id=\"webframeiswordmisspelledword\"><a href=\"#webframeiswordmisspelledword\"><code>webFrame.isWordMisspelled(word)</code></a></h3>\n<ul>\n<li><code>word</code> String - The word to be spellchecked.</li>\n</ul>\n<p>Returns <code>Boolean</code> - True if the word is misspelled according to the built in spellchecker, false otherwise. If no dictionary is loaded, always return false.</p>\n<h3 id=\"webframegetwordsuggestionsword\"><a href=\"#webframegetwordsuggestionsword\"><code>webFrame.getWordSuggestions(word)</code></a></h3>\n<ul>\n<li><code>word</code> String - The misspelled word.</li>\n</ul>\n<p>Returns <code>String[]</code> - A list of suggested words for a given word. If the word is spelled correctly, the result will be empty.</p>\n<h2 id=\"свойства\"><a href=\"#свойства\">Свойства</a></h2>\n<h3 id=\"webframetop-только-чтение\"><a href=\"#webframetop-только-чтение\"><code>webFrame.top</code> <em>Только чтение</em></a></h3>\n<p>A <code>WebFrame | null</code> representing top frame in frame hierarchy to which <code>webFrame</code> belongs, the property would be <code>null</code> if top frame is not in the current renderer process.</p>\n<h3 id=\"webframeopener-только-чтение\"><a href=\"#webframeopener-только-чтение\"><code>webFrame.opener</code> <em>Только чтение</em></a></h3>\n<p>A <code>WebFrame | null</code> representing the frame which opened <code>webFrame</code>, the property would be <code>null</code> if there's no opener or opener is not in the current renderer process.</p>\n<h3 id=\"webframeparent-только-чтение\"><a href=\"#webframeparent-только-чтение\"><code>webFrame.parent</code> <em>Только чтение</em></a></h3>\n<p>A <code>WebFrame | null</code> representing parent frame of <code>webFrame</code>, the property would be <code>null</code> if <code>webFrame</code> is top or parent is not in the current renderer process.</p>\n<h3 id=\"webframefirstchild-только-чтение\"><a href=\"#webframefirstchild-только-чтение\"><code>webFrame.firstChild</code> <em>Только чтение</em></a></h3>\n<p>A <code>WebFrame | null</code> representing the first child frame of <code>webFrame</code>, the property would be <code>null</code> if <code>webFrame</code> has no children or if first child is not in the current renderer process.</p>\n<h3 id=\"webframenextsibling-только-чтение\"><a href=\"#webframenextsibling-только-чтение\"><code>webFrame.nextSibling</code> <em>Только чтение</em></a></h3>\n<p>A <code>WebFrame | null</code> representing next sibling frame, the property would be <code>null</code> if <code>webFrame</code> is the last frame in its parent or if the next sibling is not in the current renderer process.</p>\n<h3 id=\"webframeroutingid-только-чтение\"><a href=\"#webframeroutingid-только-чтение\"><code>webFrame.routingId</code> <em>Только чтение</em></a></h3>\n<p>An <code>Integer</code> representing the unique frame id in the current renderer process. Distinct WebFrame instances that refer to the same underlying frame will have the same <code>routingId</code>.</p>",
      "title": "webFrame",
      "description": "Настройка отображения текущей веб-страницы."
    },
    "/docs/api/web-frame-main": {
      "locale": "ru-RU",
      "slug": "web-frame-main",
      "href": "/docs/api/web-frame-main",
      "crowdinFileId": "256401",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-frame-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webframemain\"><a href=\"#webframemain\">webFrameMain</a></h1>\n<blockquote>\n<p>Control web pages and iframes.</p>\n</blockquote>\n<p>Процесс: <a href=\"/docs/glossary#main-process\">Основной</a></p>\n<p>The <code>webFrameMain</code> module can be used to lookup frames across existing <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> instances. Navigation events are the common use case.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, webFrameMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://twitter.com'</span>)\n\nwin.webContents.on(\n  <span class=\"hljs-string\">'did-frame-navigate'</span>,\n  (event, url, isMainFrame, frameProcessId, frameRoutingId) => {\n    <span class=\"hljs-keyword\">const</span> frame = webFrameMain.fromId(frameProcessId, frameRoutingId)\n    <span class=\"hljs-keyword\">if</span> (frame) {\n      <span class=\"hljs-keyword\">const</span> code = <span class=\"hljs-string\">'document.body.innerHTML = document.body.innerHTML.replaceAll(\"heck\", \"h*ck\")'</span>\n      frame.executeJavaScript(code)\n    }\n  }\n)\n</code></pre>\n<p>You can also access frames of existing pages by using the <code>mainFrame</code> property of <a href=\"/docs/api/web-contents\"><code>WebContents</code></a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">main</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  <span class=\"hljs-keyword\">await</span> win.loadURL(<span class=\"hljs-string\">'https://reddit.com'</span>)\n\n  <span class=\"hljs-keyword\">const</span> youtubeEmbeds = win.webContents.mainFrame.frames.filter(<span class=\"hljs-function\">(<span class=\"hljs-params\">frame</span>) =></span> {\n    <span class=\"hljs-keyword\">try</span> {\n      <span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-keyword\">new</span> URL(frame.url)\n      <span class=\"hljs-keyword\">return</span> url.host === <span class=\"hljs-string\">'www.youtube.com'</span>\n    } <span class=\"hljs-keyword\">catch</span> {\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n    }\n  })\n\n  <span class=\"hljs-built_in\">console</span>.log(youtubeEmbeds)\n}\n\nmain()\n</code></pre>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>These methods can be accessed from the <code>webFrameMain</code> module:</p>\n<h3 id=\"webframemainfromidprocessid-routingid\"><a href=\"#webframemainfromidprocessid-routingid\"><code>webFrameMain.fromId(processId, routingId)</code></a></h3>\n<ul>\n<li><code>processId</code> Integer - An <code>Integer</code> representing the internal ID of the process which owns the frame.</li>\n<li><code>routingId</code> Integer - An <code>Integer</code> representing the unique frame ID in the current renderer process. Routing IDs can be retrieved from <code>WebFrameMain</code> instances (<code>frame.routingId</code>) and are also passed by frame specific <code>WebContents</code> navigation events (e.g. <code>did-frame-navigate</code>).</li>\n</ul>\n<p>Returns <code>WebFrameMain | undefined</code> - A frame with the given process and routing IDs, or <code>undefined</code> if there is no WebFrameMain associated with the given IDs.</p>\n<h2 id=\"class-webframemain\"><a href=\"#class-webframemain\">Class: WebFrameMain</a></h2>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"события-экземпляра\"><a href=\"#события-экземпляра\">События экземпляра</a></h3>\n<h4 id=\"событие-dom-ready\"><a href=\"#событие-dom-ready\">Событие: 'dom-ready'</a></h4>\n<p>Emitted when the document is loaded.</p>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<h4 id=\"frameexecutejavascriptcode-usergesture\"><a href=\"#frameexecutejavascriptcode-usergesture\"><code>frame.executeJavaScript(code[, userGesture])</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (опиционально) - по умолчанию <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;unknown></code> - A promise that resolves with the result of the executed code or is rejected if execution throws or results in a rejected promise.</p>\n<p>Вычисляет <code>code</code> на странице.</p>\n<p>В окне браузера некоторые HTML API как <code>requestFullScreen</code> может быть только вызван жестом пользователя. Указание <code>userGesture</code> как <code>true</code> снимает это ограничение.</p>\n<h4 id=\"framereload\"><a href=\"#framereload\"><code>frame.reload()</code></a></h4>\n<p>Returns <code>boolean</code> - Whether the reload was initiated successfully. Only results in <code>false</code> when the frame has no history.</p>\n<h4 id=\"framesendchannel-args\"><a href=\"#framesendchannel-args\"><code>frame.send(channel, ...args)</code></a></h4>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to the renderer process via <code>channel</code>, along with arguments. Arguments will be serialized with the [Structured Clone Algorithm][SCA], just like [<code>postMessage</code>][], so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<h4 id=\"framepostmessagechannel-message-transfer\"><a href=\"#framepostmessagechannel-message-transfer\"><code>frame.postMessage(channel, message, [transfer])</code></a></h4>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Send a message to the renderer process, optionally transferring ownership of zero or more [<code>MessagePortMain</code>][] objects.</p>\n<p>The transferred <code>MessagePortMain</code> objects will be available in the renderer process by accessing the <code>ports</code> property of the emitted event. When they arrive in the renderer, they will be native DOM <code>MessagePort</code> objects.</p>\n<p>Например:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nwebContents.mainFrame.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<h3 id=\"свойства-экземпляра\"><a href=\"#свойства-экземпляра\">Свойства экземпляра</a></h3>\n<h4 id=\"frameurl-readonly\"><a href=\"#frameurl-readonly\"><code>frame.url</code> <em>Readonly</em></a></h4>\n<p>A <code>string</code> representing the current URL of the frame.</p>\n<h4 id=\"frametop-readonly\"><a href=\"#frametop-readonly\"><code>frame.top</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain | null</code> representing top frame in the frame hierarchy to which <code>frame</code> belongs.</p>\n<h4 id=\"frameparent-readonly\"><a href=\"#frameparent-readonly\"><code>frame.parent</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain | null</code> representing parent frame of <code>frame</code>, the property would be <code>null</code> if <code>frame</code> is the top frame in the frame hierarchy.</p>\n<h4 id=\"frameframes-readonly\"><a href=\"#frameframes-readonly\"><code>frame.frames</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain[]</code> collection containing the direct descendents of <code>frame</code>.</p>\n<h4 id=\"frameframesinsubtree-readonly\"><a href=\"#frameframesinsubtree-readonly\"><code>frame.framesInSubtree</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain[]</code> collection containing every frame in the subtree of <code>frame</code>, including itself. This can be useful when traversing through all frames.</p>\n<h4 id=\"frameframetreenodeid-readonly\"><a href=\"#frameframetreenodeid-readonly\"><code>frame.frameTreeNodeId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the id of the frame's internal FrameTreeNode instance. This id is browser-global and uniquely identifies a frame that hosts content. The identifier is fixed at the creation of the frame and stays constant for the lifetime of the frame. When the frame is removed, the id is not used again.</p>\n<h4 id=\"framename-readonly\"><a href=\"#framename-readonly\"><code>frame.name</code> <em>Readonly</em></a></h4>\n<p>A <code>String</code> representing the frame name.</p>\n<h4 id=\"frameosprocessid-readonly\"><a href=\"#frameosprocessid-readonly\"><code>frame.osProcessId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the operating system <code>pid</code> of the process which owns this frame.</p>\n<h4 id=\"frameprocessid-readonly\"><a href=\"#frameprocessid-readonly\"><code>frame.processId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the Chromium internal <code>pid</code> of the process which owns this frame. This is not the same as the OS process ID; to read that use <code>frame.osProcessId</code>.</p>\n<h4 id=\"frameroutingid-readonly\"><a href=\"#frameroutingid-readonly\"><code>frame.routingId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the unique frame id in the current renderer process. Distinct <code>WebFrameMain</code> instances that refer to the same underlying frame will have the same <code>routingId</code>.</p>\n<h4 id=\"framevisibilitystate-только-чтение\"><a href=\"#framevisibilitystate-только-чтение\"><code>frame.visibilityState</code> <em>Только чтение</em></a></h4>\n<p>A <code>string</code> representing the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState\">visibility state</a> of the frame.</p>\n<p>See also how the <a href=\"/docs/api/browser-window#page-visibility\">Page Visibility API</a> is affected by other Electron APIs.</p>",
      "title": "webFrameMain",
      "description": "Control web pages and iframes."
    },
    "/docs/api/web-request": {
      "locale": "ru-RU",
      "slug": "web-request",
      "href": "/docs/api/web-request",
      "crowdinFileId": "256405",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-request.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-webrequest\"><a href=\"#class-webrequest\">Class: WebRequest</a></h2>\n<blockquote>\n<p>Intercept and modify the contents of a request at various stages of its lifetime.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Instances of the <code>WebRequest</code> class are accessed by using the <code>webRequest</code> property of a <code>Session</code>.</p>\n<p>The methods of <code>WebRequest</code> accept an optional <code>filter</code> and a <code>listener</code>. The <code>listener</code> will be called with <code>listener(details)</code> when the API's event has happened. The <code>details</code> object describes the request.</p>\n<p>⚠️ Only the last attached <code>listener</code> will be used. Passing <code>null</code> as <code>listener</code> will unsubscribe from the event.</p>\n<p>The <code>filter</code> object has a <code>urls</code> property which is an Array of URL patterns that will be used to filter out the requests that do not match the URL patterns. If the <code>filter</code> is omitted then all requests will be matched.</p>\n<p>For certain events the <code>listener</code> is passed with a <code>callback</code>, which should be called with a <code>response</code> object when <code>listener</code> has done its work.</p>\n<p>An example of adding <code>User-Agent</code> header for requests:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Modify the user agent for all requests to the following urls.</span>\n<span class=\"hljs-keyword\">const</span> filter = {\n  <span class=\"hljs-attr\">urls</span>: [<span class=\"hljs-string\">'https://*.github.com/*'</span>, <span class=\"hljs-string\">'*://electron.github.io'</span>]\n}\n\nsession.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback) => {\n  details.requestHeaders[<span class=\"hljs-string\">'User-Agent'</span>] = <span class=\"hljs-string\">'MyAgent'</span>\n  callback({ <span class=\"hljs-attr\">requestHeaders</span>: details.requestHeaders })\n})\n</code></pre>\n<h3 id=\"методы-экземпляра\"><a href=\"#методы-экземпляра\">Методы экземпляра</a></h3>\n<p>Для экземпляров <code>WebRequest</code> доступны следующие методы:</p>\n<h4 id=\"webrequestonbeforerequestfilter-listener\"><a href=\"#webrequestonbeforerequestfilter-listener\"><code>webRequest.onBeforeRequest([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Объект <code>details</code><ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (опционально)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/upload-data\">UploadData[]</a></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> Object<ul>\n<li><code>cancel</code> Boolean (опционально)</li>\n<li><code>redirectURL</code> String (optional) - The original request is prevented from being sent or completed and is instead redirected to the given URL.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details, callback)</code> when a request is about to occur.</p>\n<p><code>uploadData</code> является массивом объектов <code>UploadData</code>.</p>\n<p>The <code>callback</code> has to be called with an <code>response</code> object.</p>\n<p>Some examples of valid <code>urls</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-string\">'http://foo:1234/'</span>\n<span class=\"hljs-string\">'http://foo.com/'</span>\n<span class=\"hljs-string\">'http://foo:1234/bar'</span>\n<span class=\"hljs-string\">'*://*/*'</span>\n<span class=\"hljs-string\">'*://example.com/*'</span>\n<span class=\"hljs-string\">'*://example.com/foo/*'</span>\n<span class=\"hljs-string\">'http://*.foo:1234/'</span>\n<span class=\"hljs-string\">'file://foo:1234/bar'</span>\n<span class=\"hljs-string\">'http://foo:*/'</span>\n<span class=\"hljs-string\">'*://www.foo.com/'</span>\n</code></pre>\n<h4 id=\"webrequestonbeforesendheadersfilter-listener\"><a href=\"#webrequestonbeforesendheadersfilter-listener\"><code>webRequest.onBeforeSendHeaders([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Объект <code>details</code><ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (опционально)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>beforeSendResponse</code> Object<ul>\n<li><code>cancel</code> Boolean (опционально)</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string | string[]> (optional) - When provided, request will be made with these headers.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details, callback)</code> before sending an HTTP request, once the request headers are available. This may occur after a TCP connection is made to the server, but before any http data is sent.</p>\n<p>The <code>callback</code> has to be called with a <code>response</code> object.</p>\n<h4 id=\"webrequestonsendheadersfilter-listener\"><a href=\"#webrequestonsendheadersfilter-listener\"><code>webRequest.onSendHeaders([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Объект <code>details</code><ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (опционально)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> just before a request is going to be sent to the server, modifications of previous <code>onBeforeSendHeaders</code> response are visible by the time this listener is fired.</p>\n<h4 id=\"webrequestonheadersreceivedfilter-listener\"><a href=\"#webrequestonheadersreceivedfilter-listener\"><code>webRequest.onHeadersReceived([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Объект <code>details</code><ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (опционально)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li>Строка <code>statusLine</code></li>\n<li><code>statusCode</code> Integer</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>headersReceivedResponse</code> Object<ul>\n<li><code>cancel</code> Boolean (опционально)</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string | string[]> (optional) - When provided, the server is assumed to have responded with these headers.</li>\n<li><code>statusLine</code> String (optional) - Should be provided when overriding <code>responseHeaders</code> to change header status otherwise original response header's status will be used.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details, callback)</code> when HTTP response headers of a request have been received.</p>\n<p>The <code>callback</code> has to be called with a <code>response</code> object.</p>\n<h4 id=\"webrequestonresponsestartedfilter-listener\"><a href=\"#webrequestonresponsestartedfilter-listener\"><code>webRequest.onResponseStarted([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Объект <code>details</code><ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (опционально)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n<li><code>fromCache</code> Boolean - Indicates whether the response was fetched from disk cache.</li>\n<li><code>statusCode</code> Integer</li>\n<li>Строка <code>statusLine</code></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when first byte of the response body is received. For HTTP requests, this means that the status line and response headers are available.</p>\n<h4 id=\"webrequestonbeforeredirectfilter-listener\"><a href=\"#webrequestonbeforeredirectfilter-listener\"><code>webRequest.onBeforeRedirect([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Объект <code>details</code><ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (опционально)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>redirectURL</code> String</li>\n<li><code>statusCode</code> Integer</li>\n<li>Строка <code>statusLine</code></li>\n<li><code>ip</code> String (optional) - The server IP address that the request was actually sent to.</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when a server initiated redirect is about to occur.</p>\n<h4 id=\"webrequestoncompletedfilter-listener\"><a href=\"#webrequestoncompletedfilter-listener\"><code>webRequest.onCompleted([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Объект <code>details</code><ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (опционально)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>statusCode</code> Integer</li>\n<li>Строка <code>statusLine</code></li>\n<li>Строка <code>error</code></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when a request is completed.</p>\n<h4 id=\"webrequestonerroroccurredfilter-listener\"><a href=\"#webrequestonerroroccurredfilter-listener\"><code>webRequest.onErrorOccurred([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Объект <code>details</code><ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (опционально)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>error</code> String - The error description.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when an error occurs.</p>",
      "title": "WebRequest",
      "description": "Intercept and modify the contents of a request at various stages of its lifetime."
    },
    "/docs/api/structures/web-request-filter": {
      "locale": "ru-RU",
      "slug": "web-request-filter",
      "href": "/docs/api/structures/web-request-filter",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/web-request-filter.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"webrequestfilter-object\"><a href=\"#webrequestfilter-object\">WebRequestFilter Object</a></h1>\n<ul>\n<li><code>urls</code> String[] - Array of URL patterns that will be used to filter out the requests that do not match the URL patterns.</li>\n</ul>",
      "title": "WebRequestFilter Object",
      "description": ""
    },
    "/docs/api/structures/web-source": {
      "locale": "ru-RU",
      "slug": "web-source",
      "href": "/docs/api/structures/web-source",
      "crowdinFileId": "256529",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/web-source.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"websource-object\"><a href=\"#websource-object\">WebSource Object</a></h1>\n<ul>\n<li><code>code</code> String</li>\n<li><code>url</code> String (optional)</li>\n<li><code>startLine</code> Integer (optional) - Default is 1.</li>\n</ul>",
      "title": "WebSource Object",
      "description": ""
    },
    "/docs/api/webview-tag": {
      "locale": "ru-RU",
      "slug": "webview-tag",
      "href": "/docs/api/webview-tag",
      "crowdinFileId": "256407",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/webview-tag.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"тег-webview\"><a href=\"#тег-webview\">Тег <code>&#x3C;webview></code></a></h1>\n<h2 id=\"предупреждение\"><a href=\"#предупреждение\">Предупреждение</a></h2>\n<p>Electron's <code>webview</code> tag is based on <a href=\"https://developer.chrome.com/docs/extensions/reference/webviewTag/\">Chromium's <code>webview</code></a>, which is undergoing dramatic architectural changes. This impacts the stability of <code>webviews</code>, including rendering, navigation, and event routing. We currently recommend to not use the <code>webview</code> tag and to consider alternatives, like <code>iframe</code>, <a href=\"/docs/api/browser-view\">Electron's <code>BrowserView</code></a>, or an architecture that avoids embedded content altogether.</p>\n<h2 id=\"enabling\"><a href=\"#enabling\">Enabling</a></h2>\n<p>By default the <code>webview</code> tag is disabled in Electron >= 5.  You need to enable the tag by setting the <code>webviewTag</code> webPreferences option when constructing your <code>BrowserWindow</code>. For more information see the <a href=\"/docs/api/browser-window\">BrowserWindow constructor docs</a>.</p>\n<h2 id=\"обзор\"><a href=\"#обзор\">Обзор</a></h2>\n<blockquote>\n<p>Display external web content in an isolated frame and process.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Use the <code>webview</code> tag to embed 'guest' content (such as web pages) in your Electron app. The guest content is contained within the <code>webview</code> container. An embedded page within your app controls how the guest content is laid out and rendered.</p>\n<p>Unlike an <code>iframe</code>, the <code>webview</code> runs in a separate process than your app. It doesn't have the same permissions as your web page and all interactions between your app and embedded content will be asynchronous. This keeps your app safe from the embedded content. <strong>Note:</strong> Most methods called on the webview from the host page require a synchronous call to the main process.</p>\n<h2 id=\"пример\"><a href=\"#пример\">Пример</a></h2>\n<p>To embed a web page in your app, add the <code>webview</code> tag to your app's embedder page (this is the app page that will display the guest content). In its simplest form, the <code>webview</code> tag includes the <code>src</code> of the web page and css styles that control the appearance of the <code>webview</code> container:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"foo\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"display:inline-flex; width:640px; height:480px\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>If you want to control the guest content in any way, you can write JavaScript that listens for <code>webview</code> events and responds to those events using the <code>webview</code> methods. Here's sample code with two event listeners: one that listens for the web page to start loading, the other for the web page to stop loading, and displays a \"loading...\" message during the load time:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  onload = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\n    <span class=\"hljs-keyword\">const</span> indicator = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'.indicator'</span>)\n\n    <span class=\"hljs-keyword\">const</span> loadstart = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      indicator.innerText = <span class=\"hljs-string\">'loading...'</span>\n    }\n\n    <span class=\"hljs-keyword\">const</span> loadstop = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      indicator.innerText = <span class=\"hljs-string\">''</span>\n    }\n\n    webview.addEventListener(<span class=\"hljs-string\">'did-start-loading'</span>, loadstart)\n    webview.addEventListener(<span class=\"hljs-string\">'did-stop-loading'</span>, loadstop)\n  }\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h2 id=\"internal-implementation\"><a href=\"#internal-implementation\">Internal implementation</a></h2>\n<p>Under the hood <code>webview</code> is implemented with <a href=\"https://www.chromium.org/developers/design-documents/oop-iframes\">Out-of-Process iframes (OOPIFs)</a>. The <code>webview</code> tag is essentially a custom element using shadow DOM to wrap an <code>iframe</code> element inside it.</p>\n<p>So the behavior of <code>webview</code> is very similar to a cross-domain <code>iframe</code>, as examples:</p>\n<ul>\n<li>When clicking into a <code>webview</code>, the page focus will move from the embedder frame to <code>webview</code>.</li>\n<li>You can not add keyboard, mouse, and scroll event listeners to <code>webview</code>.</li>\n<li>All reactions between the embedder frame and <code>webview</code> are asynchronous.</li>\n</ul>\n<h2 id=\"css-styling-notes\"><a href=\"#css-styling-notes\">CSS Styling Notes</a></h2>\n<p>Please note that the <code>webview</code> tag's style uses <code>display:flex;</code> internally to ensure the child <code>iframe</code> element fills the full height and width of its <code>webview</code> container when used with traditional and flexbox layouts. Please do not overwrite the default <code>display:flex;</code> CSS property, unless specifying <code>display:inline-flex;</code> for inline layout.</p>\n<h2 id=\"tag-attributes\"><a href=\"#tag-attributes\">Tag Attributes</a></h2>\n<p>The <code>webview</code> tag has the following attributes:</p>\n<h3 id=\"src\"><a href=\"#src\"><code>src</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> representing the visible URL. Writing to this attribute initiates top-level navigation.</p>\n<p>Assigning <code>src</code> its own value will reload the current page.</p>\n<p>The <code>src</code> attribute can also accept data URLs, such as <code>data:text/plain,Hello, world!</code>.</p>\n<h3 id=\"nodeintegration\"><a href=\"#nodeintegration\"><code>nodeintegration</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://www.google.com/\"</span> <span class=\"hljs-attr\">nodeintegration</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page in <code>webview</code> will have node integration and can use node APIs like <code>require</code> and <code>process</code> to access low level system resources. Node integration is disabled by default in the guest page.</p>\n<h3 id=\"nodeintegrationinsubframes\"><a href=\"#nodeintegrationinsubframes\"><code>nodeintegrationinsubframes</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://www.google.com/\"</span> <span class=\"hljs-attr\">nodeintegrationinsubframes</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code> for the experimental option for enabling NodeJS support in sub-frames such as iframes inside the <code>webview</code>. All your preloads will load for every iframe, you can use <code>process.isMainFrame</code> to determine if you are in the main frame or not. This option is disabled by default in the guest page.</p>\n<h3 id=\"plugins\"><a href=\"#plugins\"><code>plugins</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">plugins</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page in <code>webview</code> will be able to use browser plugins. Plugins are disabled by default.</p>\n<h3 id=\"предварительная-загрузка\"><a href=\"#предварительная-загрузка\"><code>предварительная загрузка</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- from a file --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">preload</span>=<span class=\"hljs-string\">\"./test.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n<span class=\"hljs-comment\">&#x3C;!-- or if you want to load from an asar archive --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">preload</span>=<span class=\"hljs-string\">\"./app.asar/test.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that specifies a script that will be loaded before other scripts run in the guest page. Протокол URL скрипта должен быть <code>file:</code> (даже при использовании <code>asar:</code> архивов), потому что он будет загружен \"под капотом\" в узле <code>require</code>, который обрабатывает <code>asar:</code> архивы как виртуальные каталоги.</p>\n<p>When the guest page doesn't have node integration this script will still have access to all Node APIs, but global objects injected by Node will be deleted after this script has finished executing.</p>\n<p><strong>Note:</strong> This option will appear as <code>preloadURL</code> (not <code>preload</code>) in the <code>webPreferences</code> specified to the <code>will-attach-webview</code> event.</p>\n<h3 id=\"httpreferrer\"><a href=\"#httpreferrer\"><code>httpreferrer</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">httpreferrer</span>=<span class=\"hljs-string\">\"http://cheng.guru\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the referrer URL for the guest page.</p>\n<h3 id=\"useragent\"><a href=\"#useragent\"><code>useragent</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">useragent</span>=<span class=\"hljs-string\">\"Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the user agent for the guest page before the page is navigated to. Once the page is loaded, use the <code>setUserAgent</code> method to change the user agent.</p>\n<h3 id=\"disablewebsecurity\"><a href=\"#disablewebsecurity\"><code>disablewebsecurity</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">disablewebsecurity</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page will have web security disabled. Web security is enabled by default.</p>\n<h3 id=\"partition\"><a href=\"#partition\"><code>partition</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span> <span class=\"hljs-attr\">partition</span>=<span class=\"hljs-string\">\"persist:github\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://electronjs.org\"</span> <span class=\"hljs-attr\">partition</span>=<span class=\"hljs-string\">\"electron\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the session used by the page. If <code>partition</code> starts with <code>persist:</code>, the page will use a persistent session available to all pages in the app with the same <code>partition</code>. если нет <code>persist:</code> префикса, страница будет использовать сеанс в памяти. При присваивании одинаковой <code>partition</code>, разные страницы могут иметь одинаковую сессию. If the <code>partition</code> is unset then default session of the app will be used.</p>\n<p>This value can only be modified before the first navigation, since the session of an active renderer process cannot change. Subsequent attempts to modify the value will fail with a DOM exception.</p>\n<h3 id=\"allowpopups\"><a href=\"#allowpopups\"><code>allowpopups</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">allowpopups</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page will be allowed to open new windows. Popups are disabled by default.</p>\n<h3 id=\"webpreferences\"><a href=\"#webpreferences\"><code>webpreferences</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span> <span class=\"hljs-attr\">webpreferences</span>=<span class=\"hljs-string\">\"allowRunningInsecureContent, javascript=no\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> which is a comma separated list of strings which specifies the web preferences to be set on the webview. The full list of supported preference strings can be found in <a href=\"/docs/api/browser-window#new-browserwindowoptions\">BrowserWindow</a>.</p>\n<p>The string follows the same format as the features string in <code>window.open</code>. A name by itself is given a <code>true</code> boolean value. A preference can be set to another value by including an <code>=</code>, followed by the value. Special values <code>yes</code> and <code>1</code> are interpreted as <code>true</code>, while <code>no</code> and <code>0</code> are interpreted as <code>false</code>.</p>\n<h3 id=\"enableblinkfeatures\"><a href=\"#enableblinkfeatures\"><code>enableblinkfeatures</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">enableblinkfeatures</span>=<span class=\"hljs-string\">\"PreciseMemoryInfo, CSSVariables\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> which is a list of strings which specifies the blink features to be enabled separated by <code>,</code>. The full list of supported feature strings can be found in the <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> file.</p>\n<h3 id=\"disableblinkfeatures\"><a href=\"#disableblinkfeatures\"><code>disableblinkfeatures</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">disableblinkfeatures</span>=<span class=\"hljs-string\">\"PreciseMemoryInfo, CSSVariables\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> which is a list of strings which specifies the blink features to be disabled separated by <code>,</code>. The full list of supported feature strings can be found in the <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> file.</p>\n<h2 id=\"методы\"><a href=\"#методы\">Методы</a></h2>\n<p>The <code>webview</code> tag has the following methods:</p>\n<p><strong>Note:</strong> The webview element must be loaded before using the methods.</p>\n<p><strong>Пример</strong></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'dom-ready'</span>, () => {\n  webview.openDevTools()\n})\n</code></pre>\n<h3 id=\"webviewloadurlurl-options\"><a href=\"#webviewloadurlurl-options\"><code>&#x3C;webview>.loadURL(url[, options])</code></a></h3>\n<ul>\n<li><code>url</code> URL</li>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (optional) - An HTTP Referrer url.</li>\n<li><code>userAgent</code> String (optional) - A user agent originating the request.</li>\n<li><code>extraHeaders</code> String (optional) - Extra headers separated by \"\\n\"</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified <code>url</code> is a data url and needs to load other files.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - The promise will resolve when the page has finished loading (see <a href=\"/docs/api/webview-tag#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects if the page fails to load (see <a href=\"/docs/api/webview-tag#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Loads the <code>url</code> in the webview, the <code>url</code> must contain the protocol prefix, e.g. the <code>http://</code> or <code>file://</code>.</p>\n<h3 id=\"webviewdownloadurlurl\"><a href=\"#webviewdownloadurlurl\"><code>&#x3C;webview>.downloadURL(url)</code></a></h3>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code> without navigating.</p>\n<h3 id=\"webviewgeturl\"><a href=\"#webviewgeturl\"><code>&#x3C;webview>.getURL()</code></a></h3>\n<p>Returns <code>String</code> - The URL of guest page.</p>\n<h3 id=\"webviewgettitle\"><a href=\"#webviewgettitle\"><code>&#x3C;webview>.getTitle()</code></a></h3>\n<p>Returns <code>String</code> - The title of guest page.</p>\n<h3 id=\"webviewisloading\"><a href=\"#webviewisloading\"><code>&#x3C;webview>.isLoading()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether guest page is still loading resources.</p>\n<h3 id=\"webviewisloadingmainframe\"><a href=\"#webviewisloadingmainframe\"><code>&#x3C;webview>.isLoadingMainFrame()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the main frame (and not just iframes or frames within it) is still loading.</p>\n<h3 id=\"webviewiswaitingforresponse\"><a href=\"#webviewiswaitingforresponse\"><code>&#x3C;webview>.isWaitingForResponse()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the guest page is waiting for a first-response for the main resource of the page.</p>\n<h3 id=\"webviewstop\"><a href=\"#webviewstop\"><code>&#x3C;webview>.stop()</code></a></h3>\n<p>Stops any pending navigation.</p>\n<h3 id=\"webviewreload\"><a href=\"#webviewreload\"><code>&#x3C;webview>.reload()</code></a></h3>\n<p>Reloads the guest page.</p>\n<h3 id=\"webviewreloadignoringcache\"><a href=\"#webviewreloadignoringcache\"><code>&#x3C;webview>.reloadIgnoringCache()</code></a></h3>\n<p>Reloads the guest page and ignores cache.</p>\n<h3 id=\"webviewcangoback\"><a href=\"#webviewcangoback\"><code>&#x3C;webview>.canGoBack()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the guest page can go back.</p>\n<h3 id=\"webviewcangoforward\"><a href=\"#webviewcangoforward\"><code>&#x3C;webview>.canGoForward()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the guest page can go forward.</p>\n<h3 id=\"webviewcangotooffsetoffset\"><a href=\"#webviewcangotooffsetoffset\"><code>&#x3C;webview>.canGoToOffset(offset)</code></a></h3>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the guest page can go to <code>offset</code>.</p>\n<h3 id=\"webviewclearhistory\"><a href=\"#webviewclearhistory\"><code>&#x3C;webview>.clearHistory()</code></a></h3>\n<p>Clears the navigation history.</p>\n<h3 id=\"webviewgoback\"><a href=\"#webviewgoback\"><code>&#x3C;webview>.goBack()</code></a></h3>\n<p>Makes the guest page go back.</p>\n<h3 id=\"webviewgoforward\"><a href=\"#webviewgoforward\"><code>&#x3C;webview>.goForward()</code></a></h3>\n<p>Makes the guest page go forward.</p>\n<h3 id=\"webviewgotoindexindex\"><a href=\"#webviewgotoindexindex\"><code>&#x3C;webview>.goToIndex(index)</code></a></h3>\n<ul>\n<li><code>index</code> Integer</li>\n</ul>\n<p>Navigates to the specified absolute index.</p>\n<h3 id=\"webviewgotooffsetoffset\"><a href=\"#webviewgotooffsetoffset\"><code>&#x3C;webview>.goToOffset(offset)</code></a></h3>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Navigates to the specified offset from the \"current entry\".</p>\n<h3 id=\"webviewiscrashed\"><a href=\"#webviewiscrashed\"><code>&#x3C;webview>.isCrashed()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the renderer process has crashed.</p>\n<h3 id=\"webviewsetuseragentuseragent\"><a href=\"#webviewsetuseragentuseragent\"><code>&#x3C;webview>.setUserAgent(userAgent)</code></a></h3>\n<ul>\n<li><code>userAgent</code> String</li>\n</ul>\n<p>Overrides the user agent for the guest page.</p>\n<h3 id=\"webviewgetuseragent\"><a href=\"#webviewgetuseragent\"><code>&#x3C;webview>.getUserAgent()</code></a></h3>\n<p>Returns <code>String</code> - The user agent for guest page.</p>\n<h3 id=\"webviewinsertcsscss\"><a href=\"#webviewinsertcsscss\"><code>&#x3C;webview>.insertCSS(css)</code></a></h3>\n<ul>\n<li><code>css</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - A promise that resolves with a key for the inserted CSS that can later be used to remove the CSS via <code>&#x3C;webview>.removeInsertedCSS(key)</code>.</p>\n<p>Injects CSS into the current web page and returns a unique key for the inserted stylesheet.</p>\n<h3 id=\"webviewremoveinsertedcsskey\"><a href=\"#webviewremoveinsertedcsskey\"><code>&#x3C;webview>.removeInsertedCSS(key)</code></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves if the removal was successful.</p>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from <code>&#x3C;webview>.insertCSS(css)</code>.</p>\n<h3 id=\"webviewexecutejavascriptcode-usergesture\"><a href=\"#webviewexecutejavascriptcode-usergesture\"><code>&#x3C;webview>.executeJavaScript(code[, userGesture])</code></a></h3>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (optional) - Default <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if the result of the code is a rejected promise.</p>\n<p>Вычисляет <code>code</code> на странице. If <code>userGesture</code> is set, it will create the user gesture context in the page. HTML APIs like <code>requestFullScreen</code>, which require user action, can take advantage of this option for automation.</p>\n<h3 id=\"webviewopendevtools\"><a href=\"#webviewopendevtools\"><code>&#x3C;webview>.openDevTools()</code></a></h3>\n<p>Opens a DevTools window for guest page.</p>\n<h3 id=\"webviewclosedevtools\"><a href=\"#webviewclosedevtools\"><code>&#x3C;webview>.closeDevTools()</code></a></h3>\n<p>Closes the DevTools window of guest page.</p>\n<h3 id=\"webviewisdevtoolsopened\"><a href=\"#webviewisdevtoolsopened\"><code>&#x3C;webview>.isDevToolsOpened()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether guest page has a DevTools window attached.</p>\n<h3 id=\"webviewisdevtoolsfocused\"><a href=\"#webviewisdevtoolsfocused\"><code>&#x3C;webview>.isDevToolsFocused()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether DevTools window of guest page is focused.</p>\n<h3 id=\"webviewinspectelementx-y\"><a href=\"#webviewinspectelementx-y\"><code>&#x3C;webview>.inspectElement(x, y)</code></a></h3>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Starts inspecting element at position (<code>x</code>, <code>y</code>) of guest page.</p>\n<h3 id=\"webviewinspectsharedworker\"><a href=\"#webviewinspectsharedworker\"><code>&#x3C;webview>.inspectSharedWorker()</code></a></h3>\n<p>Opens the DevTools for the shared worker context present in the guest page.</p>\n<h3 id=\"webviewinspectserviceworker\"><a href=\"#webviewinspectserviceworker\"><code>&#x3C;webview>.inspectServiceWorker()</code></a></h3>\n<p>Opens the DevTools for the service worker context present in the guest page.</p>\n<h3 id=\"webviewsetaudiomutedmuted\"><a href=\"#webviewsetaudiomutedmuted\"><code>&#x3C;webview>.setAudioMuted(muted)</code></a></h3>\n<ul>\n<li><code>muted</code> Boolean</li>\n</ul>\n<p>Set guest page muted.</p>\n<h3 id=\"webviewisaudiomuted\"><a href=\"#webviewisaudiomuted\"><code>&#x3C;webview>.isAudioMuted()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether guest page has been muted.</p>\n<h3 id=\"webviewiscurrentlyaudible\"><a href=\"#webviewiscurrentlyaudible\"><code>&#x3C;webview>.isCurrentlyAudible()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether audio is currently playing.</p>\n<h3 id=\"webviewundo\"><a href=\"#webviewundo\"><code>&#x3C;webview>.undo()</code></a></h3>\n<p>Executes editing command <code>undo</code> in page.</p>\n<h3 id=\"webviewredo\"><a href=\"#webviewredo\"><code>&#x3C;webview>.redo()</code></a></h3>\n<p>Executes editing command <code>redo</code> in page.</p>\n<h3 id=\"webviewcut\"><a href=\"#webviewcut\"><code>&#x3C;webview>.cut()</code></a></h3>\n<p>Executes editing command <code>cut</code> in page.</p>\n<h3 id=\"webviewcopy\"><a href=\"#webviewcopy\"><code>&#x3C;webview>.copy()</code></a></h3>\n<p>Executes editing command <code>copy</code> in page.</p>\n<h3 id=\"webviewpaste\"><a href=\"#webviewpaste\"><code>&#x3C;webview>.paste()</code></a></h3>\n<p>Executes editing command <code>paste</code> in page.</p>\n<h3 id=\"webviewpasteandmatchstyle\"><a href=\"#webviewpasteandmatchstyle\"><code>&#x3C;webview>.pasteAndMatchStyle()</code></a></h3>\n<p>Executes editing command <code>pasteAndMatchStyle</code> in page.</p>\n<h3 id=\"webviewdelete\"><a href=\"#webviewdelete\"><code>&#x3C;webview>.delete()</code></a></h3>\n<p>Executes editing command <code>delete</code> in page.</p>\n<h3 id=\"webviewselectall\"><a href=\"#webviewselectall\"><code>&#x3C;webview>.selectAll()</code></a></h3>\n<p>Executes editing command <code>selectAll</code> in page.</p>\n<h3 id=\"webviewunselect\"><a href=\"#webviewunselect\"><code>&#x3C;webview>.unselect()</code></a></h3>\n<p>Executes editing command <code>unselect</code> in page.</p>\n<h3 id=\"webviewreplacetext\"><a href=\"#webviewreplacetext\"><code>&#x3C;webview>.replace(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes editing command <code>replace</code> in page.</p>\n<h3 id=\"webviewreplacemisspellingtext\"><a href=\"#webviewreplacemisspellingtext\"><code>&#x3C;webview>.replaceMisspelling(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes editing command <code>replaceMisspelling</code> in page.</p>\n<h3 id=\"webviewinserttexttext\"><a href=\"#webviewinserttexttext\"><code>&#x3C;webview>.insertText(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code></p>\n<p>Вставляет <code>text</code> в элемент с фокусом.</p>\n<h3 id=\"webviewfindinpagetext-options\"><a href=\"#webviewfindinpagetext-options\"><code>&#x3C;webview>.findInPage(text[, options])</code></a></h3>\n<ul>\n<li><code>text</code> String - Content to be searched, must not be empty.</li>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>forward</code> Boolean (optional) - Whether to search forward or backward, defaults to <code>true</code>.</li>\n<li><code>findNext</code> Boolean (optional) - Whether to begin a new text finding session with this request. Should be <code>true</code> for initial requests, and <code>false</code> for follow-up requests. Defaults to <code>false</code>.</li>\n<li><code>matchCase</code> Boolean (optional) - Whether search should be case-sensitive, defaults to <code>false</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code> - The request id used for the request.</p>\n<p>Starts a request to find all matches for the <code>text</code> in the web page. The result of the request can be obtained by subscribing to <a href=\"/docs/api/webview-tag#event-found-in-page\"><code>found-in-page</code></a> event.</p>\n<h3 id=\"webviewstopfindinpageaction\"><a href=\"#webviewstopfindinpageaction\"><code>&#x3C;webview>.stopFindInPage(action)</code></a></h3>\n<ul>\n<li><code>action</code> String - Specifies the action to take place when ending <a href=\"#webviewfindinpagetext-options\"><code>&#x3C;webview>.findInPage</code></a> request.<ul>\n<li><code>clearSelection</code> - Clear the selection.</li>\n<li><code>keepSelection</code> - Translate the selection into a normal selection.</li>\n<li><code>activateSelection</code> - Focus and click the selection node.</li>\n</ul></li>\n</ul>\n<p>Stops any <code>findInPage</code> request for the <code>webview</code> with the provided <code>action</code>.</p>\n<h3 id=\"webviewprintoptions\"><a href=\"#webviewprintoptions\"><code>&#x3C;webview>.print([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (опционально)<ul>\n<li><code>silent</code> Boolean (optional) - Don't ask user for print settings. По умолчанию - <code>false</code>.</li>\n<li><code>printBackground</code> Boolean (optional) - Prints the background color and image of the web page. По умолчанию - <code>false</code>.</li>\n<li><code>deviceName</code> String (optional) - Set the printer device name to use. Must be the system-defined name and not the 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.</li>\n<li><code>color</code> Boolean (optional) - Set whether the printed web page will be in color or grayscale. По умолчанию - <code>true</code>.</li>\n<li><code>margins</code> Object (опционально)<ul>\n<li><code>marginType</code> String (optional) - Can be <code>default</code>, <code>none</code>, <code>printableArea</code>, or <code>custom</code>. If <code>custom</code> is chosen, you will also need to specify <code>top</code>, <code>bottom</code>, <code>left</code>, and <code>right</code>.</li>\n<li><code>top</code> Number (optional) - The top margin of the printed web page, in pixels.</li>\n<li><code>bottom</code> Number (optional) - The bottom margin of the printed web page, in pixels.</li>\n<li><code>left</code> Number (optional) - The left margin of the printed web page, in pixels.</li>\n<li><code>right</code> Number (optional) - The right margin of the printed web page, in pixels.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - Whether the web page should be printed in landscape mode. По умолчанию - <code>false</code>.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page.</li>\n<li><code>pagesPerSheet</code> Number (optional) - The number of pages to print per page sheet.</li>\n<li><code>collate</code> Boolean (optional) - Whether the web page should be collated.</li>\n<li><code>copies</code> Number (optional) - The number of copies of the web page to print.</li>\n<li><code>pageRanges</code> Object<a href=\"/docs/api/optional\"></a> - The page range to print.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>duplexMode</code> String (optional) - Set the duplex mode of the printed web page. Can be <code>simplex</code>, <code>shortEdge</code>, or <code>longEdge</code>.</li>\n<li><code>dpi</code> Record&#x3C;string, number> (optional)<ul>\n<li><code>horizontal</code> Number (optional) - The horizontal dpi.</li>\n<li><code>vertical</code> Number (optional) - The vertical dpi.</li>\n</ul></li>\n<li><code>header</code> String (optional) - String to be printed as page header.</li>\n<li><code>footer</code> String (optional) - String to be printed as page footer.</li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the printed document. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code>.</li>\n</ul></li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code></p>\n<p>Prints <code>webview</code>'s web page. Same as <code>webContents.print([options])</code>.</p>\n<h3 id=\"webviewprinttopdfoptions\"><a href=\"#webviewprinttopdfoptions\"><code>&#x3C;webview>.printToPDF(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>headerFooter</code> Record&#x3C;string, string> (optional) - the header and footer for the PDF.<ul>\n<li><code>title</code> String - The title for the PDF header.</li>\n<li><code>url</code> String - the url for the PDF footer.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - <code>true</code> for landscape, <code>false</code> for portrait.</li>\n<li><code>marginsType</code> Integer (optional) - Specifies the type of margins to use. Uses 0 for default margin, 1 for no margin, and 2 for minimum margin. and <code>width</code> in microns.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page. Can range from 0 to 100.</li>\n<li><code>pageRanges</code> Record&#x3C;string, number> (optional) - The page range to print. On macOS, only the first range is honored.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the generated PDF. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code></li>\n<li><code>printBackground</code> Boolean (optional) - Whether to print CSS backgrounds.</li>\n<li><code>printSelectionOnly</code> Boolean (optional) - Whether to print selection only.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Uint8Array></code> - Resolves with the generated PDF data.</p>\n<p>Prints <code>webview</code>'s web page as PDF, Same as <code>webContents.printToPDF(options)</code>.</p>\n<h3 id=\"webviewcapturepagerect\"><a href=\"#webviewcapturepagerect\"><code>&#x3C;webview>.capturePage([rect])</code></a></h3>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (optional) - The area of the page to be captured.</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;NativeImage></code> - разрешается с <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Захватывает снимок страницы в границах <code>rect</code>. Пропустив <code>rect</code>, будет сделан захват всей видимой страницы.</p>\n<h3 id=\"webviewsendchannel-args\"><a href=\"#webviewsendchannel-args\"><code>&#x3C;webview>.send(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String (Строка)</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code></p>\n<p>Send an asynchronous message to renderer process via <code>channel</code>, you can also send arbitrary arguments. The renderer process can handle the message by listening to the <code>channel</code> event with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>See <a href=\"/docs/api/web-contents#contentssendchannel-args\">webContents.send</a> for examples.</p>\n<h3 id=\"webviewsendtoframeframeid-channel-args\"><a href=\"#webviewsendtoframeframeid-channel-args\"><code>&#x3C;webview>.sendToFrame(frameId, channel, ...args)</code></a></h3>\n<ul>\n<li><code>frameId</code> [number, number] - <code>[processId, frameId]</code></li>\n<li><code>channel</code> String (Строка)</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code></p>\n<p>Send an asynchronous message to renderer process via <code>channel</code>, you can also send arbitrary arguments. The renderer process can handle the message by listening to the <code>channel</code> event with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>See <a href=\"/docs/api/web-contents#contentssendtoframeframeid-channel-args\">webContents.sendToFrame</a> for examples.</p>\n<h3 id=\"webviewsendinputeventevent\"><a href=\"#webviewsendinputeventevent\"><code>&#x3C;webview>.sendInputEvent(event)</code></a></h3>\n<ul>\n<li><code>event</code>  <a href=\"/docs/api/structures/mouse-input-event\">MouseInputEvent</a> | <a href=\"/docs/api/structures/mouse-wheel-input-event\">MouseWheelInputEvent</a> | <a href=\"/docs/api/structures/keyboard-input-event\">KeyboardInputEvent</a></li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code></p>\n<p>Sends an input <code>event</code> to the page.</p>\n<p>See <a href=\"/docs/api/web-contents#contentssendinputeventinputevent\">webContents.sendInputEvent</a> for detailed description of <code>event</code> object.</p>\n<h3 id=\"webviewsetzoomfactorfactor\"><a href=\"#webviewsetzoomfactorfactor\"><code>&#x3C;webview>.setZoomFactor(factor)</code></a></h3>\n<ul>\n<li><code>factor</code> Number - фактор увилечения.</li>\n</ul>\n<p>Changes the zoom factor to the specified factor. Zoom factor is zoom percent divided by 100, so 300% = 3.0.</p>\n<h3 id=\"webviewsetzoomlevellevel\"><a href=\"#webviewsetzoomlevellevel\"><code>&#x3C;webview>.setZoomLevel(level)</code></a></h3>\n<ul>\n<li><code>level</code> Number - уровень увеличения.</li>\n</ul>\n<p>Изменяет уровень масштаба на указанный уровень. Оригинальный размер 0 и каждое приращение выше или ниже представляет масштабирование 20% больше или меньше, по умолчанию ограничение на 300% и 50% от исходного размера, соответственно. The formula for this is <code>scale := 1.2 ^ level</code>.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h3 id=\"webviewgetzoomfactor\"><a href=\"#webviewgetzoomfactor\"><code>&#x3C;webview>.getZoomFactor()</code></a></h3>\n<p>Returns <code>Number</code> - the current zoom factor.</p>\n<h3 id=\"webviewgetzoomlevel\"><a href=\"#webviewgetzoomlevel\"><code>&#x3C;webview>.getZoomLevel()</code></a></h3>\n<p>Returns <code>Number</code> - the current zoom level.</p>\n<h3 id=\"webviewsetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#webviewsetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>&#x3C;webview>.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h3>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>Возвращает <code>Promise&#x3C;void></code></p>\n<p>Устанавливает максимальный и минимальный уровень пинч-маштабирования.</p>\n<h3 id=\"webviewshowdefinitionforselection-macos\"><a href=\"#webviewshowdefinitionforselection-macos\"><code>&#x3C;webview>.showDefinitionForSelection()</code> <em>macOS</em></a></h3>\n<p>Shows pop-up dictionary that searches the selected word on the page.</p>\n<h3 id=\"webviewgetwebcontentsid\"><a href=\"#webviewgetwebcontentsid\"><code>&#x3C;webview>.getWebContentsId()</code></a></h3>\n<p>Returns <code>Number</code> - The WebContents ID of this <code>webview</code>.</p>\n<h2 id=\"dom-events\"><a href=\"#dom-events\">DOM Events</a></h2>\n<p>The following DOM events are available to the <code>webview</code> tag:</p>\n<h3 id=\"event-load-commit\"><a href=\"#event-load-commit\">Event: 'load-commit'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Fired when a load has committed. This includes navigation within the current document as well as subframe document-level loads, but does not include asynchronous resource loads.</p>\n<h3 id=\"event-did-finish-load\"><a href=\"#event-did-finish-load\">Event: 'did-finish-load'</a></h3>\n<p>Fired when the navigation is done, i.e. the spinner of the tab will stop spinning, and the <code>onload</code> event is dispatched.</p>\n<h3 id=\"event-did-fail-load\"><a href=\"#event-did-fail-load\">Event: 'did-fail-load'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>errorCode</code> Integer</li>\n<li>Строка <code>errorDescription</code></li>\n<li>Строка <code>validatedURL</code></li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>This event is like <code>did-finish-load</code>, but fired when the load failed or was cancelled, e.g. <code>window.stop()</code> is invoked.</p>\n<h3 id=\"event-did-frame-finish-load\"><a href=\"#event-did-frame-finish-load\">Event: 'did-frame-finish-load'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Fired when a frame has done navigation.</p>\n<h3 id=\"событие-did-start-loading\"><a href=\"#событие-did-start-loading\">Событие: 'did-start-loading'</a></h3>\n<p>Corresponds to the points in time when the spinner of the tab starts spinning.</p>\n<h3 id=\"событие-did-stop-loading\"><a href=\"#событие-did-stop-loading\">Событие: 'did-stop-loading'</a></h3>\n<p>Corresponds to the points in time when the spinner of the tab stops spinning.</p>\n<h3 id=\"событие-did-attach\"><a href=\"#событие-did-attach\">Событие: 'did-attach'</a></h3>\n<p>Fired when attached to the embedder web contents.</p>\n<h3 id=\"событие-dom-ready\"><a href=\"#событие-dom-ready\">Событие: 'dom-ready'</a></h3>\n<p>Fired when document in the given frame is loaded.</p>\n<h3 id=\"событие-page-title-updated\"><a href=\"#событие-page-title-updated\">Событие: 'page-title-updated'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>Fired when page title is set during navigation. <code>explicitSet</code> is false when title is synthesized from file url.</p>\n<h3 id=\"событие-page-favicon-updated\"><a href=\"#событие-page-favicon-updated\">Событие: 'page-favicon-updated'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>favicons</code> String[] - Array of URLs.</li>\n</ul>\n<p>Fired when page receives favicon urls.</p>\n<h3 id=\"событие-enter-html-full-screen\"><a href=\"#событие-enter-html-full-screen\">Событие: 'enter-html-full-screen'</a></h3>\n<p>Fired when page enters fullscreen triggered by HTML API.</p>\n<h3 id=\"событие-leave-html-full-screen\"><a href=\"#событие-leave-html-full-screen\">Событие: 'leave-html-full-screen'</a></h3>\n<p>Fired when page leaves fullscreen triggered by HTML API.</p>\n<h3 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>level</code> Integer - The log level, from 0 to 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>message</code> String - The actual console message</li>\n<li><code>line</code> Integer - The line number of the source that triggered this console message</li>\n<li><code>sourceId</code> String</li>\n</ul>\n<p>Fired when the guest window logs a console message.</p>\n<p>The following example code forwards all log messages to the embedder's console without regard for log level or other properties.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'console-message'</span>, (e) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Guest page logged a message:'</span>, e.message)\n})\n</code></pre>\n<h3 id=\"событие-certificate-error\"><a href=\"#событие-certificate-error\">Событие: 'certificate-error'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>result</code> Object<ul>\n<li><code>requestId</code> Integer</li>\n<li><code>activeMatchOrdinal</code> Integer - Position of the active match.</li>\n<li><code>matches</code> Integer - Number of Matches.</li>\n<li><code>selectionArea</code> Rectangle - Coordinates of first match region.</li>\n<li><code>finalUpdate</code> Boolean</li>\n</ul></li>\n</ul>\n<p>Fired when a result is available for <a href=\"#webviewfindinpagetext-options\"><code>webview.findInPage</code></a> request.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'found-in-page'</span>, (e) => {\n  webview.stopFindInPage(<span class=\"hljs-string\">'keepSelection'</span>)\n})\n\n<span class=\"hljs-keyword\">const</span> requestId = webview.findInPage(<span class=\"hljs-string\">'test'</span>)\n<span class=\"hljs-built_in\">console</span>.log(requestId)\n</code></pre>\n<h3 id=\"событие-new-window\"><a href=\"#событие-new-window\">Событие: 'new-window'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> and <code>other</code>.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - The options which should be used for creating the new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</li>\n</ul>\n<p>Fired when the guest page attempts to open a new browser window.</p>\n<p>The following example code opens the new url in system's default browser.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\n\nwebview.addEventListener(<span class=\"hljs-string\">'new-window'</span>, <span class=\"hljs-keyword\">async</span> (e) => {\n  <span class=\"hljs-keyword\">const</span> protocol = (<span class=\"hljs-keyword\">new</span> URL(e.url)).protocol\n  <span class=\"hljs-keyword\">if</span> (protocol === <span class=\"hljs-string\">'http:'</span> || protocol === <span class=\"hljs-string\">'https:'</span>) {\n    <span class=\"hljs-keyword\">await</span> shell.openExternal(e.url)\n  }\n})\n</code></pre>\n<h3 id=\"событие-will-navigate\"><a href=\"#событие-will-navigate\">Событие: 'will-navigate'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when a user or the page wants to start navigation. It can happen when the <code>window.location</code> object is changed or a user clicks a link in the page.</p>\n<p>This event will not emit when the navigation is started programmatically with APIs like <code>&#x3C;webview>.loadURL</code> and <code>&#x3C;webview>.back</code>.</p>\n<p>It is also not emitted during in-page navigation, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<p>Calling <code>event.preventDefault()</code> does <strong>NOT</strong> have any effect.</p>\n<h3 id=\"event-did-start-navigation\"><a href=\"#event-did-start-navigation\">Event: 'did-start-navigation'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame (including main) starts navigating. <code>isInPlace</code> will be <code>true</code> for in-page navigations.</p>\n<h3 id=\"event-did-redirect-navigation\"><a href=\"#event-did-redirect-navigation\">Event: 'did-redirect-navigation'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted after a server side redirect occurs during navigation. For example a 302 redirect.</p>\n<h3 id=\"событие-did-navigate\"><a href=\"#событие-did-navigate\">Событие: 'did-navigate'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when a navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h3 id=\"event-did-frame-navigate\"><a href=\"#event-did-frame-navigate\">Event: 'did-frame-navigate'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - empty for non HTTP navigations,</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h3 id=\"event-did-navigate-in-page\"><a href=\"#event-did-navigate-in-page\">Event: 'did-navigate-in-page'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when an in-page navigation happened.</p>\n<p>When in-page navigation happens, the page URL changes but does not cause navigation outside of the page. Examples of this occurring are when anchor links are clicked or when the DOM <code>hashchange</code> event is triggered.</p>\n<h3 id=\"событие-close\"><a href=\"#событие-close\">Событие: 'close'</a></h3>\n<p>Fired when the guest page attempts to close itself.</p>\n<p>The following example code navigates the <code>webview</code> to <code>about:blank</code> when the guest attempts to close itself.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'close'</span>, () => {\n  webview.src = <span class=\"hljs-string\">'about:blank'</span>\n})\n</code></pre>\n<h3 id=\"event-ipc-message\"><a href=\"#event-ipc-message\">Event: 'ipc-message'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>frameId</code> [number, number] - pair of <code>[processId, frameId]</code>.</li>\n<li><code>channel</code> String (Строка)</li>\n<li><code>args</code> any[]</li>\n</ul>\n<p>Fired when the guest page has sent an asynchronous message to embedder page.</p>\n<p>With <code>sendToHost</code> method and <code>ipc-message</code> event you can communicate between guest page and embedder page:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In embedder page.</span>\n<span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'ipc-message'</span>, (event) => {\n  <span class=\"hljs-built_in\">console</span>.log(event.channel)\n  <span class=\"hljs-comment\">// Prints \"pong\"</span>\n})\nwebview.send(<span class=\"hljs-string\">'ping'</span>)\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In guest page.</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcRenderer.on(<span class=\"hljs-string\">'ping'</span>, () => {\n  ipcRenderer.sendToHost(<span class=\"hljs-string\">'pong'</span>)\n})\n</code></pre>\n<h3 id=\"событие-crashed\"><a href=\"#событие-crashed\">Событие: 'crashed'</a></h3>\n<p>Fired when the renderer process is crashed.</p>\n<h3 id=\"событие-plugin-crashed\"><a href=\"#событие-plugin-crashed\">Событие: 'plugin-crashed'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>\n<p>Fired when a plugin process is crashed.</p>\n<h3 id=\"событие-destroyed\"><a href=\"#событие-destroyed\">Событие: 'destroyed'</a></h3>\n<p>Fired when the WebContents is destroyed.</p>\n<h3 id=\"событие-media-started-playing\"><a href=\"#событие-media-started-playing\">Событие: 'media-started-playing'</a></h3>\n<p>Emitted when media starts playing.</p>\n<h3 id=\"событие-media-paused\"><a href=\"#событие-media-paused\">Событие: 'media-paused'</a></h3>\n<p>Emitted when media is paused or done playing.</p>\n<h3 id=\"событие-did-change-theme-color\"><a href=\"#событие-did-change-theme-color\">Событие: 'did-change-theme-color'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li>Строка <code>themeColor</code></li>\n</ul>\n<p>Emitted when a page's theme color changes. This is usually due to encountering a meta tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">'theme-color'</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">'#ff0000'</span>></span>\n</code></pre>\n<h3 id=\"событие-update-target-url\"><a href=\"#событие-update-target-url\">Событие: 'update-target-url'</a></h3>\n<p>Возвращает:</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when mouse moves over a link or the keyboard moves the focus to a link.</p>\n<h3 id=\"событие-devtools-opened\"><a href=\"#событие-devtools-opened\">Событие: 'devtools-opened'</a></h3>\n<p>Emitted when DevTools is opened.</p>\n<h3 id=\"событие-devtools-closed\"><a href=\"#событие-devtools-closed\">Событие: 'devtools-closed'</a></h3>\n<p>Emitted when DevTools is closed.</p>\n<h3 id=\"event-devtools-focused\"><a href=\"#event-devtools-focused\">Event: 'devtools-focused'</a></h3>\n<p>Emitted when DevTools is focused / opened.</p>",
      "title": "Тег <webview>",
      "description": "Display external web content in an isolated frame and process."
    },
    "/docs/api/window-open": {
      "locale": "ru-RU",
      "slug": "window-open",
      "href": "/docs/api/window-open",
      "crowdinFileId": "256409",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/window-open.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"opening-windows-from-the-renderer\"><a href=\"#opening-windows-from-the-renderer\">Opening windows from the renderer</a></h1>\n<p>There are several ways to control how windows are created from trusted or untrusted content within a renderer. Windows can be created from the renderer in two ways:</p>\n<ul>\n<li>clicking on links or submitting forms adorned with <code>target=_blank</code></li>\n<li>JavaScript calling <code>window.open()</code></li>\n</ul>\n<p>For same-origin content, the new window is created within the same process, enabling the parent to access the child window directly. This can be very useful for app sub-windows that act as preference panels, or similar, as the parent can render to the sub-window directly, as if it were a <code>div</code> in the parent. This is the same behavior as in the browser.</p>\n<p>When <code>nativeWindowOpen</code> is set to false, <code>window.open</code> instead results in the creation of a <a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code></a>, a light wrapper around <code>BrowserWindow</code>.</p>\n<p>Electron pairs this native Chrome <code>Window</code> with a BrowserWindow under the hood. You can take advantage of all the customization available when creating a BrowserWindow in the main process by using <code>webContents.setWindowOpenHandler()</code> for renderer-created windows.</p>\n<p>BrowserWindow constructor options are set by, in increasing precedence order: parsed options from the <code>features</code> string from <code>window.open()</code>, security-related webPreferences inherited from the parent, and options given by <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>. Note that <code>webContents.setWindowOpenHandler</code> has final say and full privilege because it is invoked in the main process.</p>\n<h3 id=\"windowopenurl-framename-features\"><a href=\"#windowopenurl-framename-features\"><code>window.open(url[, frameName][, features])</code></a></h3>\n<ul>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String (опционально)</li>\n<li><code>features</code> String (опционально)</li>\n</ul>\n<p>Returns <a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code></a> | <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window\"><code>Window</code></a></p>\n<p><code>features</code> is a comma-separated key-value list, following the standard format of the browser. Electron will parse <code>BrowserWindowConstructorOptions</code> out of this list where possible, for convenience. For full control and better ergonomics, consider using <code>webContents.setWindowOpenHandler</code> to customize the BrowserWindow creation.</p>\n<p>A subset of <code>WebPreferences</code> can be set directly, unnested, from the features string: <code>zoomFactor</code>, <code>nodeIntegration</code>, <code>preload</code>, <code>javascript</code>, <code>contextIsolation</code>, and <code>webviewTag</code>.</p>\n<p>Например:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">'https://github.com'</span>, <span class=\"hljs-string\">'_blank'</span>, <span class=\"hljs-string\">'top=500,left=200,frame=false,nodeIntegration=no'</span>)\n</code></pre>\n<p><strong>Примечания:</strong></p>\n<ul>\n<li>Интеграция с Node будет всегда выключена в открытых <code>window</code> если она была выключена в родительском окне.</li>\n<li>Изоляция контекста будет всегда включена в открытых <code>window</code> если она была включена в родительском окне.</li>\n<li>JavaScript будет всегда включен в открытых <code>window</code> если он был включен в родительском окне.</li>\n<li>Non-standard features (that are not handled by Chromium or Electron) given in <code>features</code> will be passed to any registered <code>webContents</code>'s <code>did-create-window</code> event handler in the <code>options</code> argument.</li>\n<li><code>frameName</code> follows the specification of <code>windowName</code> located in the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters\">native documentation</a>.</li>\n</ul>\n<p>To customize or cancel the creation of the window, you can optionally set an override handler with <code>webContents.setWindowOpenHandler()</code> from the main process. Returning <code>{ action: 'deny' }</code> cancels the window. Returning <code>{ action: 'allow', overrideBrowserWindowOptions: { ... } }</code> will allow opening the window and setting the <code>BrowserWindowConstructorOptions</code> to be used when creating the window. Note that this is more powerful than passing options through the feature string, as the renderer has more limited privileges in deciding security preferences than the main process.</p>\n<h3 id=\"native-window-example\"><a href=\"#native-window-example\">Native <code>Window</code> example</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// main.js</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-comment\">// In this example, only windows with the `about:blank` url will be created.</span>\n<span class=\"hljs-comment\">// All other urls will be blocked.</span>\nmainWindow.webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (url === <span class=\"hljs-string\">'about:blank'</span>) {\n    <span class=\"hljs-keyword\">return</span> {\n      <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span>,\n      <span class=\"hljs-attr\">overrideBrowserWindowOptions</span>: {\n        <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span>,\n        <span class=\"hljs-attr\">fullscreenable</span>: <span class=\"hljs-literal\">false</span>,\n        <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'black'</span>,\n        <span class=\"hljs-attr\">webPreferences</span>: {\n          <span class=\"hljs-attr\">preload</span>: <span class=\"hljs-string\">'my-child-window-preload-script.js'</span>\n        }\n      }\n    }\n  }\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// renderer process (mainWindow)</span>\n<span class=\"hljs-keyword\">const</span> childWindow = <span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">''</span>, <span class=\"hljs-string\">'modal'</span>)\nchildWindow.document.write(<span class=\"hljs-string\">'&#x3C;h1>Hello&#x3C;/h1>'</span>)\n</code></pre>\n<h3 id=\"browserwindowproxy-example\"><a href=\"#browserwindowproxy-example\"><code>BrowserWindowProxy</code> example</a></h3>\n<pre><code class=\"hljs language-javascript\">\n<span class=\"hljs-comment\">// main.js</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nativeWindowOpen</span>: <span class=\"hljs-literal\">false</span> }\n})\n\nmainWindow.webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (url.startsWith(<span class=\"hljs-string\">'https://github.com/'</span>)) {\n    <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span> }\n  }\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n\nmainWindow.webContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (childWindow) => {\n  <span class=\"hljs-comment\">// For example...</span>\n  childWindow.webContents.on(<span class=\"hljs-string\">'will-navigate'</span>, (e) => {\n    e.preventDefault()\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// renderer.js</span>\n<span class=\"hljs-keyword\">const</span> windowProxy = <span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">'https://github.com/'</span>, <span class=\"hljs-literal\">null</span>, <span class=\"hljs-string\">'minimizable=false'</span>)\nwindowProxy.postMessage(<span class=\"hljs-string\">'hi'</span>, <span class=\"hljs-string\">'*'</span>)\n</code></pre>",
      "title": "Opening windows from the renderer",
      "description": ""
    },
    "/docs/tutorial/windows-arm": {
      "locale": "ru-RU",
      "slug": "windows-arm",
      "href": "/docs/tutorial/windows-arm",
      "crowdinFileId": "256271",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-arm.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"windows-on-arm\"><a href=\"#windows-on-arm\">Windows on ARM</a></h1>\n<p>If your app runs with Electron 6.0.8 or later, you can now build it for Windows 10 on Arm. This considerably improves performance, but requires recompilation of any native modules used in your app. It may also require small fixups to your build and packaging scripts.</p>\n<h2 id=\"running-a-basic-app\"><a href=\"#running-a-basic-app\">Running a basic app</a></h2>\n<p>If your app doesn't use any native modules, then it's really easy to create an Arm version of your app.</p>\n<ol>\n<li>Убедитесь, что каталог <code>node_modules</code> вашего приложения пуст.</li>\n<li>Using a <em>Command Prompt</em>, run <code>set npm_config_arch=arm64</code> before running <code>npm install</code>/<code>yarn install</code> as usual.</li>\n<li><a href=\"/docs/tutorial/quick-start#prerequisites\">If you have Electron installed as a development dependency</a>, npm will download and unpack the arm64 version. You can then package and distribute your app as normal.</li>\n</ol>\n<h2 id=\"general-considerations\"><a href=\"#general-considerations\">General considerations</a></h2>\n<h3 id=\"architecture-specific-code\"><a href=\"#architecture-specific-code\">Architecture-specific code</a></h3>\n<p>Lots of Windows-specific code contains if... else logic that selects between either the x64 or x86 architectures.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">if</span> (process.arch === <span class=\"hljs-string\">'x64'</span>) {\n  <span class=\"hljs-comment\">// Do 64-bit thing...</span>\n} <span class=\"hljs-keyword\">else</span> {\n  <span class=\"hljs-comment\">// Do 32-bit thing...</span>\n}\n</code></pre>\n<p>If you want to target arm64, logic like this will typically select the wrong architecture, so carefully check your application and build scripts for conditions like this. In custom build and packaging scripts, you should always check the value of <code>npm_config_arch</code> in the environment, rather than relying on the current process arch.</p>\n<h3 id=\"native-modules\"><a href=\"#native-modules\">Native modules</a></h3>\n<p>If you use native modules, you must make sure that they compile against v142 of the MSVC compiler (provided in Visual Studio 2017). You must also check that any pre-built <code>.dll</code> or <code>.lib</code> files provided or referenced by the native module are available for Windows on Arm.</p>\n<h3 id=\"testing-your-app\"><a href=\"#testing-your-app\">Testing your app</a></h3>\n<p>To test your app, use a Windows on Arm device running Windows 10 (version 1903 or later). Make sure that you copy your application over to the target device - Chromium's sandbox will not work correctly when loading your application assets from a network location.</p>\n<h2 id=\"development-prerequisites\"><a href=\"#development-prerequisites\">Development prerequisites</a></h2>\n<h3 id=\"nodejsnode-gyp\"><a href=\"#nodejsnode-gyp\">Node.js/node-gyp</a></h3>\n<p><a href=\"https://nodejs.org/en/\">Node.js v12.9.0 or later is recommended.</a> If updating to a new version of Node is  undesirable, you can instead <a href=\"https://github.com/nodejs/node-gyp/wiki/Updating-npm&#x27;s-bundled-node-gyp\">update npm's copy of node-gyp manually</a> to version 5.0.2 or later, which contains the required changes to compile native modules for Arm.</p>\n<h3 id=\"visual-studio-2017\"><a href=\"#visual-studio-2017\">Visual Studio 2017</a></h3>\n<p>Visual Studio 2017 (any edition) is required for cross-compiling native modules. You can download Visual Studio Community 2017 via Microsoft's <a href=\"https://visualstudio.microsoft.com/dev-essentials/\">Visual Studio Dev Essentials program</a>. After installation, you can add the Arm-specific components by running the following from a <em>Command Prompt</em>:</p>\n<pre><code class=\"hljs language-powershell\">vs_installer.exe ^\n--add Microsoft.VisualStudio.Workload.NativeDesktop ^\n--add Microsoft.VisualStudio.Component.VC.ATLMFC ^\n--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ^\n--add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ^\n--includeRecommended\n</code></pre>\n<h4 id=\"creating-a-cross-compilation-command-prompt\"><a href=\"#creating-a-cross-compilation-command-prompt\">Creating a cross-compilation command prompt</a></h4>\n<p>Setting <code>npm_config_arch=arm64</code> in the environment creates the correct arm64 <code>.obj</code> files, but the standard <em>Developer Command Prompt for VS 2017</em> will use the x64 linker. To fix this:</p>\n<ol>\n<li>Duplicate the <em>x64_x86 Cross Tools Command Prompt for VS 2017</em> shortcut (e.g. by locating it in the start menu, right clicking, selecting <em>Open File Location</em>, copying and pasting) to somewhere convenient.</li>\n<li>Right click the new shortcut and choose <em>Properties</em>.</li>\n<li>Change the <em>Target</em> field to read <code>vcvarsamd64_arm64.bat</code> at the end instead of <code>vcvarsamd64_x86.bat</code>.</li>\n</ol>\n<p>If done successfully, the command prompt should print something similar to this on startup:</p>\n<pre><code class=\"hljs language-bat\">**********************************************************************\n** Visual Studio <span class=\"hljs-number\">2017</span> Developer Command Prompt v15.<span class=\"hljs-number\">9</span>.<span class=\"hljs-number\">15</span>\n** Copyright (c) <span class=\"hljs-number\">2017</span> Microsoft Corporation\n**********************************************************************\n[vcvarsall.bat] Environment initialized <span class=\"hljs-keyword\">for</span>: 'x64_arm64'\n</code></pre>\n<p>If you want to develop your application directly on a Windows on Arm device, substitute <code>vcvarsx86_arm64.bat</code> in <em>Target</em> so that cross-compilation can happen with the device's x86 emulation.</p>\n<h3 id=\"linking-against-the-correct-nodelib\"><a href=\"#linking-against-the-correct-nodelib\">Linking against the correct <code>node.lib</code></a></h3>\n<p>By default, <code>node-gyp</code> unpacks Electron's node headers and downloads the x86 and x64 versions of <code>node.lib</code> into <code>%APPDATA%\\..\\Local\\node-gyp\\Cache</code>, but it does not download the arm64 version (<a href=\"https://github.com/nodejs/node-gyp/pull/1875\">a fix for this is in development</a>.) To fix this:</p>\n<ol>\n<li>Download the arm64 <code>node.lib</code> from <a href=\"https://electronjs.org/headers/v6.0.9/win-arm64/node.lib\">https://electronjs.org/headers/v6.0.9/win-arm64/node.lib</a></li>\n<li>Move it to <code>%APPDATA%\\..\\Local\\node-gyp\\Cache\\6.0.9\\arm64\\node.lib</code></li>\n</ol>\n<p>Substitute <code>6.0.9</code> for the version you're using.</p>\n<h2 id=\"cross-compiling-native-modules\"><a href=\"#cross-compiling-native-modules\">Cross-compiling native modules</a></h2>\n<p>After completing all of the above, open your cross-compilation command prompt and run <code>set npm_config_arch=arm64</code>. Then use <code>npm install</code> to build your project as normal. As with cross-compiling x86 modules, you may need to remove <code>node_modules</code> to force recompilation of native modules if they were previously compiled for another architecture.</p>\n<h2 id=\"debugging-native-modules\"><a href=\"#debugging-native-modules\">Debugging native modules</a></h2>\n<p>Debugging native modules can be done with Visual Studio 2017 (running on your development machine) and corresponding <a href=\"https://docs.microsoft.com/en-us/visualstudio/debugger/remote-debugging-cpp?view=vs-2019\">Visual Studio Remote Debugger</a> running on the target device. To debug:</p>\n<ol>\n<li>Launch your app <code>.exe</code> on the target device via the <em>Command Prompt</em> (passing <code>--inspect-brk</code> to pause it before any native modules are loaded).</li>\n<li>Launch Visual Studio 2017 on your development machine.</li>\n<li>Connect to the target device by selecting <em>Debug > Attach to Process...</em> and enter the device's IP address and the port number displayed by the Visual Studio Remote Debugger tool.</li>\n<li>Click <em>Refresh</em> and select the <a href=\"/docs/development/debug-instructions-windows\">appropriate Electron process to attach</a>.</li>\n<li>You may need to make sure that any symbols for native modules in your app are loaded correctly. To configure this, head to <em>Debug > Options...</em> in Visual Studio 2017, and add the folders containing your <code>.pdb</code> symbols under <em>Debugging > Symbols</em>.</li>\n<li>Once attached, set any appropriate breakpoints and resume JavaScript execution using Chrome's <a href=\"/docs/tutorial/debugging-main-process\">remote tools for Node</a>.</li>\n</ol>\n<h2 id=\"getting-additional-help\"><a href=\"#getting-additional-help\">Getting additional help</a></h2>\n<p>If you encounter a problem with this documentation, or if your app works when compiled for x86 but not for arm64, please <a href=\"/docs/development/issues\">file an issue</a> with \"Windows on Arm\" in the title.</p>",
      "title": "Windows on ARM",
      "description": ""
    },
    "/docs/tutorial/windows-store-guide": {
      "locale": "ru-RU",
      "slug": "windows-store-guide",
      "href": "/docs/tutorial/windows-store-guide",
      "crowdinFileId": "256273",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-store-guide.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"руководство-по-распространению-с-помощью-windows-store\"><a href=\"#руководство-по-распространению-с-помощью-windows-store\">Руководство по распространению с помощью Windows Store</a></h1>\n<p>С выходом Windows 10, старый добрый исполнительный файл win32 обзавелся новым братом: универсальной платформой Windows (The Universal Windows Platform). Новый формат <code>.appx</code> не только позволяет применять различные новые API, как push-уведомления от Кортаны, но также значительно упрощает установку и обновления через Windows Store.</p>\n<p>Microsoft <a href=\"https://github.com/catalystcode/electron-windows-store\">developed a tool that compiles Electron apps as <code>.appx</code> packages</a>, enabling developers to use some of the goodies found in the new application model. Этот гайд объясняет как его использовать - и какие возможности и ограничения присутствуют у пакета Electron AppX.</p>\n<h2 id=\"предыстория-и-требования\"><a href=\"#предыстория-и-требования\">Предыстория и требования</a></h2>\n<p>\"Юбилейное обновление\" Windows 10 (Windows 10 \"Anniversary Update\") позволяет запускать win32 <code>.exe</code>-файлы, запуская их вместе с виртуализованными файловой системой и реестром. Они оба создаются во время компиляции запуском приложения и установщика внутри контейнера Windows (Windows Container), позволяя Windows определить, какие именно изменения были внесены в операционную систему во время установки. Соединение исполнительного файла с виртуальными файловой системой и реестром позволяет Windows задействовать установку и деинсталляцию в одно касание (one-click installation / uninstallation).</p>\n<p>Вдобавок, exe-файл запускается внутри appx модели - это означает, что он может использовать множество API, доступных универсальной платформе Windows (Universal Windows Platform). Для получения еще больших возможностей, приложение на Electron можно соединить с невидимым фоновым процессом UWP, запущенным вместе с <code>exe</code>-файлом - что-то типа напарника, который будет запускать фоновые процессы, получать push-уведомления или взаимодействовать с другими UWP приложениями.</p>\n<p>Для компиляции любого существующего приложения на Electron, удостоверьтесь, что вы попадаете под следующие требования:</p>\n<ul>\n<li>Windows 10 with Anniversary Update (выпущено 2-го Августа, 2016)</li>\n<li>The Windows 10 SDK, <a href=\"https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk\">загрузить здесь</a></li>\n<li>Как минимум Node 4 (для проверки версии, запустите в терминале <code>node -v</code>)</li>\n</ul>\n<p>После этого, установите <code>electron-windows-store</code> CLI:</p>\n<pre><code class=\"hljs language-sh\">npm install -g electron-windows-store\n</code></pre>\n<h2 id=\"1-шаг-упакуйте-ваше-приложение\"><a href=\"#1-шаг-упакуйте-ваше-приложение\">1 Шаг: Упакуйте ваше приложение</a></h2>\n<p>Упакуйте приложение, используя <a href=\"https://github.com/electron/electron-packager\">electron-packager</a> (или подобный инструмент). Удостоверьтесь, что вы удалили <code>node_modules</code>, которые не понадобятся вам в финальной версии приложения, так как любой неиспользуемый модуль в конечном счете увеличит размер вашего приложения.</p>\n<p>Консольный вывод должен иметь примерный вид:</p>\n<pre><code class=\"hljs language-plaintext\">├── Ghost.exe\n├── LICENSE\n├── content_resources_200_percent.pak\n├── content_shell.pak\n├── d3dcompiler_47.dll\n├── ffmpeg.dll\n├── icudtl.dat\n├── libEGL.dll\n├── libGLESv2.dll\n├── locales\n│   ├── am.pak\n│   ├── ar.pak\n│   ├── [...]\n├── node.dll\n├── resources\n│   └── app.asar\n├── v8_context_snapshot.bin\n├── squirrel.exe\n└── ui_resources_200_percent.pak\n</code></pre>\n<h2 id=\"шаг-2-запуск-electron-windows-store\"><a href=\"#шаг-2-запуск-electron-windows-store\">Шаг 2: Запуск electron-windows-store</a></h2>\n<p>Из под PowerShell с расширенными разрешениями (откройте как \"Администратор\"), запустите <code>electron-windows-store</code> с обязательными параметрами, подав как входные, так и выводные директории, имя приложения и версию, и подтверждение, что <code>node_modules</code> будут сжаты.</p>\n<pre><code class=\"hljs language-powershell\">electron-windows-store `\n    --input-directory C:\\myelectronapp `\n    --output-directory C:\\output\\myelectronapp `\n    --package-version <span class=\"hljs-number\">1.0</span>.<span class=\"hljs-number\">0.0</span> `\n    --package-name myelectronapp\n</code></pre>\n<p>После запуска инструмент начнет работу: он принимает ваше приложение как ввод, сжимая <code>node_modules</code>. Затем, он архивирует ваше приложение как <code>app.zip</code>. Используя установщик и Windows Container, он создает \"расширенный\" AppX пакет - включая Windows Application Manifest (<code>AppXManifest.xml</code>), а также виртуальные файловую систему и реестр внутри выходной папки.</p>\n<p>После создания файлов расширенной AppX, инструмент использует упаковщик приложений Windows - Windows App Packager (<code>MakeAppx.exe</code>) - чтобы из всех файлов создать пакет AppX в одном файле. Наконец, инструмент может быть использован для создания доверенного сертификата на вашем компьютере, чтобы подписывать новые пакеты AppX. С подписанным AppX пакетом, CLI также может автоматически установить пакет на вашу машину.</p>\n<h2 id=\"шаг-3-использование-appx-пакета\"><a href=\"#шаг-3-использование-appx-пакета\">Шаг 3: Использование AppX пакета</a></h2>\n<p>Чтобы запустить ваш пакет, вашим пользователям необходима Windows 10 с так называемым \"Юбилейным обновлением\" - дополнительная информация по обновлению Windows <a href=\"https://blogs.windows.com/windowsexperience/2016/08/02/how-to-get-the-windows-10-anniversary-update\">здесь</a>.</p>\n<p>В отличие от традиционных UWP приложений, упакованные приложения должны пройти процесс ручной проверки, записаться на которую можно <a href=\"https://developer.microsoft.com/en-us/windows/projects/campaigns/desktop-bridge\">здесь</a>. Тем временем, все пользователи смогут установить ваш пакет, кликнув по нему два раза, так что передача в магазин может быть не обязательной, если вы хотите более легкий способ установки. В управляемых средах (обычно на уровне предприятия), <code>Add-AppxPackage</code> <a href=\"https://technet.microsoft.com/en-us/library/hh856048.aspx\">PowerShell Cmdlet может использоваться для установки в автоматическом режиме</a>.</p>\n<p>Еще одним важным ограничением является то, что скомпилированный AppX пакет все еще содержит win32 запускаемый файл - как следствие, он не запустится на Xbox, Hololens или смартфонах.</p>\n<h2 id=\"опционально-добавьте-uwp-функционал-используя-backgroundtask\"><a href=\"#опционально-добавьте-uwp-функционал-используя-backgroundtask\">Опционально: Добавьте UWP функционал, используя BackgroundTask</a></h2>\n<p>Вы можете соединить свое приложение с невидимым фоновым UWP процессом, который будет использовать функционал Windows 10 на полную - push-уведомления, интеграция Кортаны или живые тайлы в меню Пуск.</p>\n<p>Чтобы проверить, как приложение на Electron использует этот процесс для отправки Toast-уведомлений и живых тайлов, <a href=\"https://github.com/felixrieseberg/electron-uwp-background\">посмотрите на пример от Microsoft</a>.</p>\n<h2 id=\"опционально-конвертируйте-с-помощью-виртуализации-контейнера\"><a href=\"#опционально-конвертируйте-с-помощью-виртуализации-контейнера\">Опционально: Конвертируйте с помощью виртуализации контейнера</a></h2>\n<p>Чтобы создать AppX пакет, <code>electron-windows-store</code> CLI использует шаблон, который должен подойти для большинства приложений на Electron. Однако, если вы используете кастомный установщик, или вы испытываете какие-либо проблемы с созданным пакетом, вы можете попытаться создать пакет с использованием компиляции с Windows контейнером, CLI установит и запустит ваше приложение в пустом Windows контейнере, чтобы определить, какие изменения ваше приложение вносит в операционную систему.</p>\n<p>Перед запуском CLI в первый раз, вам нужно настроить \"Конвертер десктопных приложений Windows\" (\"Windows Desktop App Converter\"). Этот процесс займет пару минут, но не беспокойтесь - его нужно запустить лишь один раз. Загрузите Desktop App Converter <a href=\"https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-run-desktop-app-converter\">здесь</a>. Вы получите два файла: <code>DesktopAppConverter.zip</code> и <code>BaseImage-14316.wim</code>.</p>\n<ol>\n<li>Распакуйте <code>DesktopAppConverter.zip</code>. Из под PowerShell с расширенными разрешениями (\"открыть как Администратор\", убедитесь, что политика запуска на вашей системе позволяет нам запускать все, что потребуется, использовав <code> обход Set-ExecutionPolicy</code>).</li>\n<li>Затем, запустите установку Desktop App Converter, указав место Windows base Image (загружено как <code>BaseImage-14316.wim</code>), вызвав  <code>.\\DesktopAppConverter.ps1 -Setup -BaseImage .\\BaseImage-14316.wim</code>.</li>\n<li>Если запуск вышеуказанных команд потребует перезагрузки, пожалуйста, сделайте это и снова выполните эти команды после успешной перезагрузки.</li>\n</ol>\n<p>После успешной установки вы можете перейти к компиляции вашего приложения.</p>",
      "title": "Руководство по распространению с помощью Windows Store",
      "description": ""
    },
    "/docs/tutorial/windows-taskbar": {
      "locale": "ru-RU",
      "slug": "windows-taskbar",
      "href": "/docs/tutorial/windows-taskbar",
      "crowdinFileId": "256275",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-taskbar.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"taskbar-customization-windows\"><a href=\"#taskbar-customization-windows\">Taskbar Customization (Windows)</a></h1>\n<h2 id=\"обзор\"><a href=\"#обзор\">Обзор</a></h2>\n<p>Electron имеет API для настройки значка приложения на панели задач Windows. This API supports both Windows-only features like <a href=\"#jumplist\">creation of a <code>JumpList</code></a>, <a href=\"#thumbnail-toolbars\">custom thumbnails and toolbars</a>, <a href=\"#icon-overlays-in-taskbar\">icon overlays</a>, and the so-called <a href=\"#flash-frame\">\"Flash Frame\" effect</a>, and cross-platform features like <a href=\"/docs/tutorial/recent-documents\">recent documents</a> and <a href=\"/docs/tutorial/progress-bar\">application progress</a>.</p>\n<h2 id=\"jumplist\"><a href=\"#jumplist\">JumpList</a></h2>\n<p>Windows позволяет приложениям определять пользовательское контекстное меню, которое появляется, когда пользователи щелкают правой кнопкой мыши значок приложения на панели задач. Это контекстное меню называется <code>JumpList</code>. You specify custom actions in the <code>Tasks</code> category of JumpList, as quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#tasks\">MSDN</a>:</p>\n<blockquote>\n<p>Приложения определяют задачи, основанные как на функциях программы, так и на ключевых моментах, которые пользователь должен делать с ними. Задачи должны быть контекстно-свободными, в данном случае, приложению не потребуется запускать их для работы. Они также должны быть статистически наиболее распространенными действиями, которые обычный пользователь будет выполнять в приложении, например, составить сообщение электронной почты или открыть календарь в почтовой программе, создать новый документ в текстовом редакторе, запустить приложение в определенном режиме, или запустить одну из своих подкоманд. Приложение не должно загромождать меню с расширенными функциями, которые не требуются обычным пользователям или одноразовыми действиями, такими как регистрация. Не используйте задачи для рекламных материалов, таких как обновления или специальные предложения.</p>\n<p>Настоятельно рекомендуется, чтобы список задач был статическим. Он должен оставаться неизменным независимо от состояния или статуса приложения. Хотя можно динамически изменять список, вы должны учитывать, что это может смутить пользователя, который не ожидает изменения этой части списка адресатов.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420539.png\" alt=\"IE\"></p>\n<blockquote>\n<p>ПРИМЕЧАНИЕ: Скриншот выше является примером общих задач  Internet Explorer</p>\n</blockquote>\n<p>В отличие от меню dock в macOS, которое является реальным меню, пользовательские задачи в Windows работают как ярлыки приложений. Например, когда пользователь нажимает на задачу, программа будет выполняться с заданными аргументами.</p>\n<p>To set user tasks for your application, you can use <a href=\"/docs/api/app#appsetusertaskstasks-windows\">app.setUserTasks</a> API.</p>\n<h4 id=\"примеры\"><a href=\"#примеры\">Примеры</a></h4>\n<h5 id=\"set-user-tasks\"><a href=\"#set-user-tasks\">Set user tasks</a></h5>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setUserTasks([\n  {\n    <span class=\"hljs-attr\">program</span>: process.execPath,\n    <span class=\"hljs-attr\">arguments</span>: <span class=\"hljs-string\">'--new-window'</span>,\n    <span class=\"hljs-attr\">iconPath</span>: process.execPath,\n    <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'New Window'</span>,\n    <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Create a new window'</span>\n  }\n])\n</code></pre>\n<h5 id=\"clear-tasks-list\"><a href=\"#clear-tasks-list\">Clear tasks list</a></h5>\n<p>To clear your tasks list, you need to call <code>app.setUserTasks</code> with an empty array in the <code>main.js</code> file.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setUserTasks([])\n</code></pre>\n<blockquote>\n<p>NOTE: The user tasks will still be displayed even after closing your application, so the icon and program path specified for a task should exist until your application is uninstalled.</p>\n</blockquote>\n<h3 id=\"thumbnail-toolbars\"><a href=\"#thumbnail-toolbars\">Thumbnail Toolbars</a></h3>\n<p>On Windows, you can add a thumbnail toolbar with specified buttons to a taskbar layout of an application window. It provides users with a way to access a particular window's command without restoring or activating the window.</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#thumbnail-toolbars\">MSDN</a>:</p>\n<blockquote>\n<p>This toolbar is the familiar standard toolbar common control. It has a maximum of seven buttons. Each button's ID, image, tooltip, and state are defined in a structure, which is then passed to the taskbar. The application can show, enable, disable, or hide buttons from the thumbnail toolbar as required by its current state.</p>\n<p>For example, Windows Media Player might offer standard media transport controls such as play, pause, mute, and stop.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420540.png\" alt=\"player\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example of thumbnail toolbar of Windows Media Player</p>\n</blockquote>\n<p>To set thumbnail toolbar in your application, you need to use <a href=\"/docs/api/browser-window#winsetthumbarbuttonsbuttons-windows\">BrowserWindow.setThumbarButtons</a></p>\n<h4 id=\"примеры-1\"><a href=\"#примеры-1\">Примеры</a></h4>\n<h5 id=\"set-thumbnail-toolbar\"><a href=\"#set-thumbnail-toolbar\">Set thumbnail toolbar</a></h5>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.setThumbarButtons([\n  {\n    <span class=\"hljs-attr\">tooltip</span>: <span class=\"hljs-string\">'button1'</span>,\n    <span class=\"hljs-attr\">icon</span>: path.join(__dirname, <span class=\"hljs-string\">'button1.png'</span>),\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'button1 clicked'</span>) }\n  }, {\n    <span class=\"hljs-attr\">tooltip</span>: <span class=\"hljs-string\">'button2'</span>,\n    <span class=\"hljs-attr\">icon</span>: path.join(__dirname, <span class=\"hljs-string\">'button2.png'</span>),\n    <span class=\"hljs-attr\">flags</span>: [<span class=\"hljs-string\">'enabled'</span>, <span class=\"hljs-string\">'dismissonclick'</span>],\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'button2 clicked.'</span>) }\n  }\n])\n</code></pre>\n<h5 id=\"clear-thumbnail-toolbar\"><a href=\"#clear-thumbnail-toolbar\">Clear thumbnail toolbar</a></h5>\n<p>To clear thumbnail toolbar buttons, you need to call <code>BrowserWindow.setThumbarButtons</code> with an empty array in the <code>main.js</code> file.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.setThumbarButtons([])\n</code></pre>\n<h3 id=\"icon-overlays-in-taskbar\"><a href=\"#icon-overlays-in-taskbar\">Icon Overlays in Taskbar</a></h3>\n<p>On Windows, a taskbar button can use a small overlay to display application status.</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#icon-overlays\">MSDN</a>:</p>\n<blockquote>\n<p>Icon overlays serve as a contextual notification of status, and are intended to negate the need for a separate notification area status icon to communicate that information to the user. For instance, the new mail status in Microsoft Outlook, currently shown in the notification area, can now be indicated through an overlay on the taskbar button. Again, you must decide during your development cycle which method is best for your application. Overlay icons are intended to supply important, long-standing status or notifications such as network status, messenger status, or new mail. The user should not be presented with constantly changing overlays or animations.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420441.png\" alt=\"Overlay on taskbar button\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example of overlay on a taskbar button</p>\n</blockquote>\n<p>To set the overlay icon for a window, you need to use the <a href=\"/docs/api/browser-window#winsetoverlayiconoverlay-description-windows\">BrowserWindow.setOverlayIcon</a> API.</p>\n<h4 id=\"пример\"><a href=\"#пример\">Пример</a></h4>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.setOverlayIcon(<span class=\"hljs-string\">'path/to/overlay.png'</span>, <span class=\"hljs-string\">'Description for overlay'</span>)\n</code></pre>\n<h3 id=\"flash-frame\"><a href=\"#flash-frame\">Flash Frame</a></h3>\n<p>On Windows, you can highlight the taskbar button to get the user's attention. This is similar to bouncing the dock icon in macOS.</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-flashwindow#remarks\">MSDN</a>:</p>\n<blockquote>\n<p>Typically, a window is flashed to inform the user that the window requires attention but that it does not currently have the keyboard focus.</p>\n</blockquote>\n<p>To flash the BrowserWindow taskbar button, you need to use the <a href=\"/docs/api/browser-window#winflashframeflag\">BrowserWindow.flashFrame</a> API.</p>\n<h4 id=\"пример-1\"><a href=\"#пример-1\">Пример</a></h4>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.once(<span class=\"hljs-string\">'focus'</span>, () => win.flashFrame(<span class=\"hljs-literal\">false</span>))\nwin.flashFrame(<span class=\"hljs-literal\">true</span>)\n</code></pre>\n<blockquote>\n<p>NOTE: Don't forget to call <code>win.flashFrame(false)</code> to turn off the flash. In the above example, it is called when the window comes into focus, but you might use a timeout or some other event to disable it.</p>\n</blockquote>",
      "title": "Taskbar Customization (Windows)",
      "description": "Приложения определяют задачи, основанные как на функциях программы, так и на ключевых моментах, которые пользователь должен делать с ними. Задачи должны быть контекстно-свободными, в данном случае, приложению не потребуется запускать их для работы. Они также должны быть статистически наиболее распространенными действиями, которые обычный пользователь будет выполнять в приложении, например, составить сообщение электронной почты или открыть календарь в почтовой программе, создать новый документ в текстовом редакторе, запустить приложение в определенном режиме, или запустить одну из своих подкоманд. Приложение не должно загромождать меню с расширенными функциями, которые не требуются обычным пользователям или одноразовыми действиями, такими как регистрация. Не используйте задачи для рекламных материалов, таких как обновления или специальные предложения.\nНастоятельно рекомендуется, чтобы список задач был статическим. Он должен оставаться неизменным независимо от состояния или статуса приложения. Хотя можно динамически изменять список, вы должны учитывать, что это может смутить пользователя, который не ожидает изменения этой части списка адресатов."
    }
  },
  "pt-BR": {
    "/docs/api/accelerator": {
      "locale": "pt-BR",
      "slug": "accelerator",
      "href": "/docs/api/accelerator",
      "crowdinFileId": "256277",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/accelerator.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"aceleradores\"><a href=\"#aceleradores\">Aceleradores</a></h1>\n<blockquote>\n<p>Definem atalhos de teclado.</p>\n</blockquote>\n<p>Aceleradores são Strings que podem conter múltiplos modificadores e um código de teclas combinados pelo '<code>+</code>' e que são utilizados para definir atalhos de teclado para sua aplicação.</p>\n<p>Exemplos:</p>\n<ul>\n<li><code>CommandOrControl+A</code></li>\n<li><code>CommandOrControl+Shift+Z</code></li>\n</ul>\n<p>Os atalhos são registrados com o módulo <a href=\"/docs/api/global-shortcut\"><code>globalShortcut</code></a> usando o método <a href=\"/docs/api/global-shortcut#globalshortcutregisteraccelerator-callback\"><code>registrar</code></a>, ou seja:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Register a 'CommandOrControl+Y' shortcut listener.</span>\n  globalShortcut.register(<span class=\"hljs-string\">'CommandOrControl+Y'</span>, () => {\n  <span class=\"hljs-comment\">// Fazer algo quando Y e Command ou Control forem pressionados.</span>\n  })\n})\n</code></pre>\n<h2 id=\"aviso-de-plataforma\"><a href=\"#aviso-de-plataforma\">Aviso de plataforma</a></h2>\n<p>No Linux e no Windows, a tecla <code>Command</code> não tem nenhum efeito, então, para definir alguns aceleradores é recomendado utilizar <code>CommandOrControl</code> que representa <code>Command</code> no macOS e <code>Control</code> no Linux e no Windows.</p>\n<p>Use <code>Alt</code> instead of <code>Option</code>. The <code>Option</code> key only exists on macOS, whereas the <code>Alt</code> key is available on all platforms.</p>\n<p>The <code>Super</code> (or <code>Meta</code>) key is mapped to the <code>Windows</code> key on Windows and Linux and <code>Cmd</code> on macOS.</p>\n<h2 id=\"modificadores-disponíveis\"><a href=\"#modificadores-disponíveis\">Modificadores disponíveis</a></h2>\n<ul>\n<li><code>Command</code> (ou <code>Cmd</code>)</li>\n<li><code>Control</code> (ou <code>Ctrl</code>)</li>\n<li><code>CommandOrControl</code> (ou <code>CmdOrCtrl</code>)</li>\n<li><code>Alt</code></li>\n<li><code>Option</code></li>\n<li><code>AltGr</code></li>\n<li><code>Shift</code></li>\n<li><code>Super</code></li>\n<li><code>Meta</code></li>\n</ul>\n<h2 id=\"códigos-de-tecla-disponíveis\"><a href=\"#códigos-de-tecla-disponíveis\">Códigos de tecla disponíveis</a></h2>\n<ul>\n<li><code>0</code> a <code>9</code></li>\n<li><code>A</code> a <code>Z</code></li>\n<li><code>F1</code> a <code>F24</code></li>\n<li>Punctuation like <code>~</code>, <code>!</code>, <code>@</code>, <code>#</code>, <code>$</code>, etc.</li>\n<li><code>Plus (+)</code></li>\n<li><code>Space (Espaço)</code></li>\n<li><code>Tab</code></li>\n<li><code>CapsLock</code></li>\n<li><code>NumLock</code></li>\n<li><code>Scrolllock</code></li>\n<li><code>Backspace</code></li>\n<li><code>Delete</code></li>\n<li><code>Insert</code></li>\n<li><code>Return</code> (ou <code>Enter</code>)</li>\n<li><code>Up</code>, <code>Down</code>, <code>Left</code> e <code>Right</code> (Setas do teclado: cima, baixo, esquerda e direita respectivamente)</li>\n<li><code>Home</code> e <code>End</code></li>\n<li><code>PageUp</code> e <code>PageDown</code></li>\n<li><code>Escape</code> (ou <code>Esc</code>)</li>\n<li><code>VolumeUp</code>, <code>VolumeDown</code> e <code>VolumeMute</code></li>\n<li><code>MediaNextTrack</code>, <code>MediaPreviousTrack</code>, <code>MediaStop</code> e <code>MediaPlayPause</code></li>\n<li><code>PrintScreen</code></li>\n<li>Teclas numéricas<ul>\n<li><code>num0</code> - <code>num9</code></li>\n<li><code>numdec</code> - tecla decimal</li>\n<li><code>numadd</code> - tecla <code>+</code></li>\n<li><code>numsub</code> - tecla <code>-</code></li>\n<li><code>nummult</code> - tecla <code>*</code></li>\n<li><code>numdiv</code> - tecla <code>÷</code></li>\n</ul></li>\n</ul>",
      "title": "Aceleradores",
      "description": "Definem atalhos de teclado."
    },
    "/docs/tutorial/accessibility": {
      "locale": "pt-BR",
      "slug": "accessibility",
      "href": "/docs/tutorial/accessibility",
      "crowdinFileId": "256173",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/accessibility.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"acessibilidade\"><a href=\"#acessibilidade\">Acessibilidade</a></h1>\n<p>Making accessible applications is important and we're happy to provide functionality to <a href=\"https://electronjs.org/devtron\">Devtron</a> and <a href=\"https://electronjs.org/spectron\">Spectron</a> that gives developers the opportunity to make their apps better for everyone.</p>\n<hr>\n<p>As questões de acessibilidade em aplicativos Electron são semelhantes às de sites na Web, já que ambos fazem uso do HTML. No entanto, com apps Electron, você não pode usar ferramentas online para auditorias de acessibilidade, pois seu aplicativo não tem uma URL para o auditor poder acessá-lo.</p>\n<p>These features bring those auditing tools to your Electron app. You can choose to add audits to your tests with Spectron or use them within DevTools with Devtron. Confira a seguir um resumo das ferramentas.</p>\n<h2 id=\"spectron\"><a href=\"#spectron\">Spectron</a></h2>\n<p>In the testing framework Spectron, you can now audit each window and <code>&#x3C;webview></code> tag in your application. Como por exemplo:</p>\n<pre><code class=\"hljs language-javascript\">app.client.auditAccessibility().then(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\">audit</span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (audit.failed) {\n    <span class=\"hljs-built_in\">console</span>.error(audit.message)\n  }\n})\n</code></pre>\n<p>Você pode ler mais sobre esse recurso na <a href=\"https://github.com/electron/spectron#accessibility-testing\">documentação do Spectron</a>.</p>\n<h2 id=\"devtron\"><a href=\"#devtron\">Devtron</a></h2>\n<p>In Devtron, there is an accessibility tab which will allow you to audit a page in your app, sort and filter the results.</p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/1305617/17156618/9f9bcd72-533f-11e6-880d-389115f40a2a.png\" alt=\"captura de tela do devtron\"></p>\n<p>Ambas essas ferramentas usam a biblioteca de <a href=\"https://github.com/GoogleChrome/accessibility-developer-tools\">ferramentas de acessibilidade para desenvolvedores</a> feita para o Google Chrome. Você pode aprender mais sobre as regras de auditoria de acessibilidade que essa biblioteca usa no <a href=\"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules\">wiki do repositório</a>.</p>\n<p>Se você souber de outra fantástica ferramenta de acessibilidade para o Electron, adicione-a na documentação de acessibilidade com um pull request.</p>\n<h2 id=\"manually-enabling-accessibility-features\"><a href=\"#manually-enabling-accessibility-features\">Manually enabling accessibility features</a></h2>\n<p>Electron applications will automatically enable accessibility features in the presence of assistive technology (e.g. <a href=\"https://www.freedomscientific.com/products/software/jaws/\">JAWS</a> on Windows or <a href=\"https://help.apple.com/voiceover/mac/10.15/\">VoiceOver</a> on macOS). See Chrome's <a href=\"https://www.chromium.org/developers/design-documents/accessibility#TOC-How-Chrome-detects-the-presence-of-Assistive-Technology\">accessibility documentation</a> for more details.</p>\n<p>You can also manually toggle these features either within your Electron application or by setting flags in third-party native software.</p>\n<h3 id=\"using-electrons-api\"><a href=\"#using-electrons-api\">Using Electron's API</a></h3>\n<p>By using the <a href=\"/docs/api/app#appsetaccessibilitysupportenabledenabled-macos-windows\"><code>app.setAccessibilitySupportEnabled(enabled)</code></a> API, you can manually expose Chrome's accessibility tree to users in the application preferences. Note that the user's system assistive utilities have priority over this setting and will override it.</p>\n<h3 id=\"within-third-party-software\"><a href=\"#within-third-party-software\">Within third-party software</a></h3>\n<h4 id=\"macos\"><a href=\"#macos\">macOS</a></h4>\n<p>On macOS, third-party assistive technology can toggle accessibility features inside Electron applications by setting the <code>AXManualAccessibility</code> attribute programmatically:</p>\n<pre><code class=\"hljs language-objc\"><span class=\"hljs-built_in\">CFStringRef</span> kAXManualAccessibility = <span class=\"hljs-built_in\">CFSTR</span>(<span class=\"hljs-string\">\"AXManualAccessibility\"</span>);\n\n+ (<span class=\"hljs-keyword\">void</span>)enableAccessibility:(<span class=\"hljs-built_in\">BOOL</span>)enable inElectronApplication:(<span class=\"hljs-built_in\">NSRunningApplication</span> *)app\n{\n    AXUIElementRef appRef = AXUIElementCreateApplication(app.processIdentifier);\n    <span class=\"hljs-keyword\">if</span> (appRef == <span class=\"hljs-literal\">nil</span>)\n        <span class=\"hljs-keyword\">return</span>;\n\n    <span class=\"hljs-built_in\">CFBooleanRef</span> value = enable ? kCFBooleanTrue : kCFBooleanFalse;\n    AXUIElementSetAttributeValue(appRef, kAXManualAccessibility, value);\n    <span class=\"hljs-built_in\">CFRelease</span>(appRef);\n}\n</code></pre>",
      "title": "Acessibilidade",
      "description": ""
    },
    "/docs/api/app": {
      "locale": "pt-BR",
      "slug": "app",
      "href": "/docs/api/app",
      "crowdinFileId": "256279",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/app.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"app\"><a href=\"#app\">app</a></h1>\n<blockquote>\n<p>Controle os eventos do ciclo de vida da sua aplicação.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>O seguinte exemplo mostra como encerrar a aplicação quando a última janela é fechada:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  app.quit()\n})\n</code></pre>\n<h2 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h2>\n<p>O objeto <code>app</code> emite os seguintes eventos:</p>\n<h3 id=\"evento-will-finish-launching\"><a href=\"#evento-will-finish-launching\">Evento: 'will-finish-launching'</a></h3>\n<p>Emitido quando a aplicação termina inicialização básica. No Windows e Linux o evento <code>will-finish-launching</code> é o mesmo que o evento <code>ready</code>; no macOS, este evento representa a notificação <code>applicationWillFinishLaunching</code> de <code>NSApplication</code>. Você normalmente poderia escutar os eventos de <code>open-file</code> e <code>open-url</code> aqui e iniciar o crash reporter e auto atualização.</p>\n<p>Na maioria dos casos, você deve fazer tudo no manipulador do evento <code>ready</code>.</p>\n<h3 id=\"evento-ready\"><a href=\"#evento-ready\">Evento: 'ready'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>launchInfo</code> Record&#x3C;string, any> | <a href=\"/docs/api/structures/notification-response\">NotificationResponse</a> <em>macOS</em></li>\n</ul>\n<p>Emitted once, when Electron has finished initializing. On macOS, <code>launchInfo</code> holds the <code>userInfo</code> of the <code>NSUserNotification</code> or information from <a href=\"/docs/api/structures/notification-response\"><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>\n<h3 id=\"evento-window-all-closed\"><a href=\"#evento-window-all-closed\">Evento: 'window-all-closed'</a></h3>\n<p>Emitido quando todas as janelas foram fechadas.</p>\n<p>Se você não escutar esse evento e todas as janelas forem fechadas, o comportamento padrão é fechar a aplicação. No entanto, se você estiver escutando, você controla se a aplicação fecha ou não. Se o usuário pressionou <code>Cmd + Q</code> ou o desenvolvedor chamou <code>app.quit()</code>, o Electron irá primeiro tentar fechar todas as janelas e então emitir o evento <code>will-quit</code> e neste caso, <code>window-all-closed</code> não será emitido.</p>\n<h3 id=\"evento-before-quit\"><a href=\"#evento-before-quit\">Evento: 'before-quit'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<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>\n<p><strong>Nota:</strong> Se o encerramento da aplicação for iniciado pelo <code>autoUpdater.quitAndInstall()</code>, então o <code>before-quit</code> é emitido <em>depois</em> de lançar o evento <code>close</code> em todas as janelas e fechá-las.</p>\n<p><strong>Nota:</strong> No Windows, este evento não será emitido se o aplicativo for fechado devido a um desligamento / reinício do sistema ou a um logout do usuário.</p>\n<h3 id=\"evento-will-quit\"><a href=\"#evento-will-quit\">Evento: 'will-quit'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<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>\n<p>Consulte a descrição do evento <code>window-all-closed</code> para as diferenças entre os eventos <code>will-quit</code> e <code>window-all-closed</code>.</p>\n<p><strong>Nota:</strong> No Windows, este evento não será emitido se o aplicativo for fechado devido a um desligamento / reinício do sistema ou a um logout do usuário.</p>\n<h3 id=\"evento-quit\"><a href=\"#evento-quit\">Evento: 'quit'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>exitCode</code> Integer</li>\n</ul>\n<p>Emitido quando a aplicação esta sendo encerrada(quitting).</p>\n<p><strong>Nota:</strong> No Windows, este evento não será emitido se o aplicativo for fechado devido a um desligamento / reinício do sistema ou a um logout do usuário.</p>\n<h3 id=\"evento-open-file-macos\"><a href=\"#evento-open-file-macos\">Evento: 'open-file' <em>macOS</em></a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>path</code> String</li>\n</ul>\n<p>Emitido quando o usuário deseja abrir um arquivo com a aplicação. O evento <code>open-file</code> geralmente é emitido quando a aplicação já está aberta e o SO deseja reutilizar a aplicação para abrir o arquivo. <code>open-file</code> também é emitido quando um arquivo é solto sobre o dock e a aplicação ainda não está em execução. Certifique-se que o evento <code>open-file</code> seja detectado desde o início da aplicação para manipulá-lo (inclusive antes do evento <code>ready</code> ser emitido).</p>\n<p>Se você deseja manipular esse evento, você deve chamar <code>event.preventDefault()</code>.</p>\n<p>No Windows, você tem que analisar <code>process.argv</code> (no processo principal) para obter o filepath.</p>\n<h3 id=\"evento-open-url-macos\"><a href=\"#evento-open-url-macos\">Evento: 'open-url' <em>macOS</em></a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>String <code>url</code></li>\n</ul>\n<p>Emitido quando o usuário deseja abrir um URL com a aplicação. 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>\n<p>Se você deseja manipular esse evento, você deve chamar <code>event.preventDefault()</code>.</p>\n<h3 id=\"evento-activate-macos\"><a href=\"#evento-activate-macos\">Evento: 'activate' <em>macOS</em></a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>hasVisibleWindows</code> Boolean</li>\n</ul>\n<p>Emitido quando a aplicação é ativada. Várias ações podem disparar esse evento, tais como iniciando o aplicativo pela primeira vez, a tentativa de re-iniciar o aplicativo quando ele já está sendo executado, ou clicando no ícone de barra de tarefas ou doca do aplicativo.</p>\n<h3 id=\"evento-did-become-active-macos\"><a href=\"#evento-did-become-active-macos\">Evento: 'did-become-active' <em>macOS</em></a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitido quando a aplicação mac se torna ativa. Diferença do <code>evento</code> ativo é que <code>ativado</code> é emitido toda vez que o app se torna ativo, não somente quando o ícone do Dock é clicado ou a aplicação é relançada.</p>\n<h3 id=\"evento-continue-activity-macos\"><a href=\"#evento-continue-activity-macos\">Evento: 'continue-activity' <em>macOS</em></a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - Uma string identificando a atividade. É mapeada para <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> unknown - Contains app-specific state stored by the activity on another device.</li>\n<li>Objeto <code>details</code><ul>\n<li><code>webpageURL</code> String (optional) - A string identifying the URL of the webpage accessed by the activity on another device, if available.</li>\n</ul></li>\n</ul>\n<p>Emitido durante <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> quando a atividade em outro dispositivo deseja ser continuada. Você deve chamar <code>event.preventDefault()</code> caso queira manipular esse evento.</p>\n<p>Uma atividade do usuário pode ser continuada apenas em uma aplicação que tem o mesmo Team ID do desenvolvedor como o aplicativo fonte da atividade e que suporta o tipo da atividade. Tipos de atividade suportadas são especificadas no <code>Info.plist</code> do aplicativo sob a chave <code>NSUserActivityTypes</code>.</p>\n<h3 id=\"evento-will-continue-activity-macos\"><a href=\"#evento-will-continue-activity-macos\">Evento: 'will-continue-activity' <em>macOS</em></a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - Uma string identificando a atividade. É mapeada para <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n</ul>\n<p>Emitido durante o <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> antes de uma atividade em outro dispositivo desejar ser continuada. Você deve chamar <code>event.preventDefault()</code> caso queira manipular esse evento.</p>\n<h3 id=\"evento-continue-activity-error-macos\"><a href=\"#evento-continue-activity-error-macos\">Evento: 'continue-activity-error' <em>macOS</em></a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - Uma string identificando a atividade. É mapeada para <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>error</code> String - Uma string com a descrição traduzida do erro.</li>\n</ul>\n<p>Emitido durante o <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> quando uma atividade de outro dispositivo falha ao ser resumida.</p>\n<h3 id=\"evento-activity-was-continued-macos\"><a href=\"#evento-activity-was-continued-macos\">Evento: 'activity-was-continued' <em>macOS</em></a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - Uma string identificando a atividade. É mapeada para <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> unknown - Contains app-specific state stored by the activity.</li>\n</ul>\n<p>Emitido durante o <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> depois que uma atividade deste dispositivo foi continuada com sucesso em outro dispositivo.</p>\n<h3 id=\"evento-update-activity-state-macos\"><a href=\"#evento-update-activity-state-macos\">Evento: 'update-activity-state' <em>macOS</em></a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - Uma string identificando a atividade. É mapeada para <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> unknown - Contains app-specific state stored by the activity.</li>\n</ul>\n<p>Emitido quando o <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> está prestes a ser continuado em outro dispositivo. 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. Caso contrário, a operação irá falhar e <code>continue-activity-error</code> será chamado.</p>\n<h3 id=\"evento-new-window-for-tab-macos\"><a href=\"#evento-new-window-for-tab-macos\">Evento: 'new-window-for-tab' <em>macOS</em></a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<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>\n<h3 id=\"evento-browser-window-blur\"><a href=\"#evento-browser-window-blur\">Evento: 'browser-window-blur'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Emitido quando uma <a href=\"/docs/api/browser-window\">browserWindow</a> é desfocada.</p>\n<h3 id=\"evento-browser-window-focus\"><a href=\"#evento-browser-window-focus\">Evento: 'browser-window-focus'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Emitido quando <a href=\"/docs/api/browser-window\">browserWindow</a> é focado.</p>\n<h3 id=\"evento-browser-window-created\"><a href=\"#evento-browser-window-created\">Evento: 'browser-window-created'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Emitido quando um novo <a href=\"/docs/api/browser-window\">browserWindow</a> é criado.</p>\n<h3 id=\"evento-web-contents-created\"><a href=\"#evento-web-contents-created\">Evento: 'web-contents-created'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitido quando um novo <a href=\"/docs/api/web-contents\">webContents</a> é criado.</p>\n<h3 id=\"evento-certificate-error\"><a href=\"#evento-certificate-error\">Evento: 'certificate-error'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li>String <code>url</code></li>\n<li><code>error</code> String - O código do erro</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>isTrusted</code> Boolean - Define considerar o certificado como confiável</li>\n</ul></li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Emitido quando a verificação do <code>certificate</code> para o <code>url</code> falha, para confiar no certificado você deve prevenir o comportamento padrão com <code>event.preventDefault()</code> e chamar <code>callback(true)</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'certificate-error'</span>, (event, webContents, url, error, certificate, callback) => {\n  <span class=\"hljs-keyword\">if</span> (url === <span class=\"hljs-string\">'https://github.com'</span>) {\n    <span class=\"hljs-comment\">// Lógica de verificação.</span>\n    event.preventDefault()\n    callback(<span class=\"hljs-literal\">true</span>)\n  } <span class=\"hljs-keyword\">else</span> {\n    callback(<span class=\"hljs-literal\">false</span>)\n  }\n})\n</code></pre>\n<h3 id=\"evento-select-client-certificate\"><a href=\"#evento-select-client-certificate\">Evento: 'select-client-certificate'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>url</code> URL</li>\n<li><code>certificateList</code> <a href=\"/docs/api/structures/certificate\">Certificate[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> (opcional)</li>\n</ul></li>\n</ul>\n<p>Emitido quando um certificado de cliente é solicitado.</p>\n<p>O <code>url</code> corresponde à entrada de navegação solicitando o certificado do cliente e <code>callback</code> pode ser chamado com uma entrada filtrada da lista. Usar <code>event.preventDefault()</code> previne a aplicação de utilizar o primeiro certificado da store.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'select-client-certificate'</span>, (event, webContents, url, list, callback) => {\n  event.preventDefault()\n  callback(list[<span class=\"hljs-number\">0</span>])\n})\n</code></pre>\n<h3 id=\"evento-login\"><a href=\"#evento-login\">Evento: 'login'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li>Objeto <code>authenticationResponseDetails</code><ul>\n<li><code>url</code> URL</li>\n</ul></li>\n<li>Objeto <code>authInfo</code><ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (opcional)</li>\n<li><code>password</code> String (opcional)</li>\n</ul></li>\n</ul>\n<p>Emitido quando <code>webContents</code> quer fazer uma autenticação básica.</p>\n<p>O comportamento padrão é cancelar todas as autenticações. Para sobrescrever isso você deve prevenir o comportamento padrão com <code>event.preventDefault()</code> e chamar o <code>callback(username, password)</code> com as credenciais.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'login'</span>, (event, webContents, details, authInfo, callback) => {\n  event.preventDefault()\n  callback(<span class=\"hljs-string\">'username'</span>, <span class=\"hljs-string\">'secret'</span>)\n})\n</code></pre>\n<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>\n<h3 id=\"event-gpu-info-update\"><a href=\"#event-gpu-info-update\">Event: 'gpu-info-update'</a></h3>\n<p>Emitted whenever there is a GPU info update.</p>\n<h3 id=\"evento-processo-gpu-caiu--depreciado\"><a href=\"#evento-processo-gpu-caiu--depreciado\">Evento 'processo-gpu-caiu <em> Depreciado</em></a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>Emitted when the GPU process crashes or is killed.</p>\n<p><strong>Depreciado</strong> Este evento é substituído pelo evento <code>processo-filho-finalizado</code> que contém mais informação sobre porque o processo filho desapareceu. 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>\n<h3 id=\"evento-processo-renderizador-rompido-depreciado\"><a href=\"#evento-processo-renderizador-rompido-depreciado\">Evento: 'processo-renderizador-rompido' <em>Depreciado</em></a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>Emitido quando o processo de renderização do <code>webContents</code> trava ou é interrompido.</p>\n<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>\n<h3 id=\"event-render-process-gone\"><a href=\"#event-render-process-gone\">Event: 'render-process-gone'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li>Objeto <code>details</code><ul>\n<li><code>reason</code> String - The reason the render process is gone.  Valores possíveis:<ul>\n<li><code>clean-exit</code> - Process exited with an exit code of zero</li>\n<li><code>abnormal-exit</code> - Process exited with a non-zero exit code</li>\n<li><code>killed</code> - Process was sent a SIGTERM or otherwise killed externally</li>\n<li><code>crashed</code> - Process crashed</li>\n<li><code>oom</code> - Process ran out of memory</li>\n<li><code>launch-failed</code> - Process never successfully launched</li>\n<li><code>integrity-failure</code> - Windows code integrity checks failed</li>\n</ul></li>\n<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>\n</ul></li>\n</ul>\n<p>Emitted when the renderer process unexpectedly disappears.  This is normally because it was crashed or killed.</p>\n<h3 id=\"event-child-process-gone\"><a href=\"#event-child-process-gone\">Event: 'child-process-gone'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>Objeto <code>details</code><ul>\n<li><code>type</code> String - Process type. One of the following values:<ul>\n<li><code>Utilidade</code></li>\n<li><code>Zygote</code></li>\n<li><code>Ajuda ao Sandbox</code></li>\n<li><code>GPU</code></li>\n<li><code>Pepper Plugin</code></li>\n<li><code>Pepper Plugin Broker</code></li>\n<li><code>Desconhecido</code></li>\n</ul></li>\n<li><code>reason</code> String - The reason the child process is gone. Valores possíveis:<ul>\n<li><code>clean-exit</code> - Process exited with an exit code of zero</li>\n<li><code>abnormal-exit</code> - Process exited with a non-zero exit code</li>\n<li><code>killed</code> - Process was sent a SIGTERM or otherwise killed externally</li>\n<li><code>crashed</code> - Process crashed</li>\n<li><code>oom</code> - Process ran out of memory</li>\n<li><code>launch-failed</code> - Process never successfully launched</li>\n<li><code>integrity-failure</code> - Windows code integrity checks failed</li>\n</ul></li>\n<li><code>exitCode</code> Number - The exit code for the process (e.g. status from waitpid if on posix, from GetExitCodeProcess on Windows).</li>\n<li><code>serviceName</code> String (optional) - The non-localized name of the process.</li>\n<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>\n</ul></li>\n</ul>\n<p>Emitted when the child process unexpectedly disappears. This is normally because it was crashed or killed. It does not include renderer processes.</p>\n<h3 id=\"event-accessibility-support-changed-no-macos-e-no-windows\"><a href=\"#event-accessibility-support-changed-no-macos-e-no-windows\">Event: 'accessibility-support-changed' no <em>macOS</em> e no <em>Windows</em></a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>accessibilitySupportEnabled</code> Boolean - <code>true</code> quando o suporte a acessibilidade do Chrome estiver ativo, <code>false</code> caso contrário.</li>\n</ul>\n<p>Emitido quando o suporte de acessibilidade do Chrome muda. Este evento é acionado quando a tecnologias assistivas, tais como leitores de tela, estão habilitadas ou desabilitadas. Veja <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">https://www.chromium.org/developers/design-documents/accessibility</a> para mais detalhes.</p>\n<h3 id=\"evento-session-created\"><a href=\"#evento-session-created\">Evento: 'session-created'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>session</code> <a href=\"/docs/api/session\">Session</a></li>\n</ul>\n<p>Emitido quando Electron criar uma nova <code>session</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'session-created'</span>, (session) => {\n  <span class=\"hljs-built_in\">console</span>.log(session)\n})\n</code></pre>\n<h3 id=\"evento-second-instance\"><a href=\"#evento-second-instance\">Evento: 'second-instance'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>argv</code> String[] - Um array dos argumentos da linha de comando da segunda instância</li>\n<li><code>workingDirectory</code> String - O diretório de trabalho da segunda instância</li>\n</ul>\n<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>\n<p><code>argv</code> is an Array of the second instance's command line arguments, and <code>workingDirectory</code> is its current working directory. Geralmente, aplicativos reagem a isso tornando a janela principal deles visível e em primeiro plano.</p>\n<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>\n<p>Esse evento é garantido que será emitido após o evento <code>ready</code> do objeto <code>app</code> ser emitido.</p>\n<p><strong>Note:</strong> Extra command line arguments might be added by Chromium, such as <code>--original-process-start-time</code>.</p>\n<h3 id=\"event-desktop-capturer-get-sources\"><a href=\"#event-desktop-capturer-get-sources\">Event: 'desktop-capturer-get-sources'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Este evento será emitido quando <code>desktopCapturer.getSources()</code> é chamado no processo de renderização do <code>webContents</code>. Calling <code>event.preventDefault()</code> will make it return empty sources.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O objeto <code>app</code> tem os seguintes métodos:</p>\n<p><strong>Nota:</strong> Alguns métodos estão disponíveis somente em sistemas operacionais específicos e são rotulados como tal.</p>\n<h3 id=\"appquit\"><a href=\"#appquit\"><code>app.quit()</code></a></h3>\n<p>Tenta fechar todas as janelas. O evento <code>before-quit</code> será emitido primeiro. Se todas as janelas forem fechadas com sucesso, o evento <code>will-quit</code> será emitido e por padrão, e o aplicativo será encerrado.</p>\n<p>Este método garante que todos os manipuladores de vento <code>beforeunload</code> e <code>unload</code> seja executados corretamente. É possível que a janela cancele, retornando <code>false</code> no manipulador de eventos <code>beforeunload</code>.</p>\n<h3 id=\"appexitexitcode\"><a href=\"#appexitexitcode\"><code>app.exit([exitCode])</code></a></h3>\n<ul>\n<li><code>exitCode</code> Integer (opcional)</li>\n</ul>\n<p>Exits immediately with <code>exitCode</code>. <code>exitCode</code> defaults to 0.</p>\n<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>\n<h3 id=\"apprelaunchoptions\"><a href=\"#apprelaunchoptions\"><code>app.relaunch([options])</code></a></h3>\n<ul>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>args</code> String<a href=\"/docs/api/opcional\"></a></li>\n<li><code>execPath</code> String (opcional)</li>\n</ul></li>\n</ul>\n<p>Reinicia a aplicação quando a instância atual sair.</p>\n<p>By default, the new instance will use the same working directory and command line arguments with current instance. Quando <code>args</code> são especificado, os <code>args</code> vão ser passados como argumentos de linha de comando em seu lugar. Quando <code>execPath</code> é especificado, o <code>execPath</code> será executado no reinício no lugar da aplicação atual.</p>\n<p>Note que nesse método a aplicação não fecha quando executado. Você deve chamar <code>app.quit</code> ou <code>app.exit</code> depois de chamar <code>app.relaunch</code> para fazer a aplicação reiniciar.</p>\n<p>Quando <code>app.relaunch</code> é chamado por várias vezes, várias instâncias serão iniciadas depois da instância atual sair.</p>\n<p>Um exemplo de reinício da instância atual imediatamente e adicionar um novo argumento de linha de comando à nova instância:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.relaunch({ <span class=\"hljs-attr\">args</span>: process.argv.slice(<span class=\"hljs-number\">1</span>).concat([<span class=\"hljs-string\">'--relaunch'</span>]) })\napp.exit(<span class=\"hljs-number\">0</span>)\n</code></pre>\n<h3 id=\"appisready\"><a href=\"#appisready\"><code>app.isReady()</code></a></h3>\n<p>Retorna <code>Boolean</code> - <code>true</code> se o Electron tiver inicializado, <code>false</code> caso contrário. See also <code>app.whenReady()</code>.</p>\n<h3 id=\"appwhenready\"><a href=\"#appwhenready\"><code>app.whenReady()</code></a></h3>\n<p>Retorna <code>Promise&#x3C;void></code> - cumprido quando o Electron é inicializado. Pode ser usado como uma alternativa conveniente para a verificação <code>app.isReady()</code> e subscrever o evento <code>ready</code> se a aplicação ainda não estiver pronta.</p>\n<h3 id=\"appfocusoptions\"><a href=\"#appfocusoptions\"><code>app.focus([options])</code></a></h3>\n<ul>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>steal</code> Boolean <em>macOS</em> - Make the receiver the active app even if another app is currently active.</li>\n</ul></li>\n</ul>\n<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>\n<p>You should seek to use the <code>steal</code> option as sparingly as possible.</p>\n<h3 id=\"apphide-no-macos\"><a href=\"#apphide-no-macos\"><code>app.hide()</code> no <em>macOS</em></a></h3>\n<p>Oculta todas as janelas do aplicativo sem minimizar-las.</p>\n<h3 id=\"appshow-no-macos\"><a href=\"#appshow-no-macos\"><code>app.show()</code> no <em>macOS</em></a></h3>\n<p>Shows application windows after they were hidden. Does not automatically focus them.</p>\n<h3 id=\"appsetapplogspathpath\"><a href=\"#appsetapplogspathpath\"><code>app.setAppLogsPath([path])</code></a></h3>\n<ul>\n<li><code>path</code> String (optional) - A custom path for your logs. Must be absolute.</li>\n</ul>\n<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>\n<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>macOS</em>, and inside the <code>userData</code> directory on <em>Linux</em> and <em>Windows</em>.</p>\n<h3 id=\"appgetapppath\"><a href=\"#appgetapppath\"><code>app.getAppPath()</code></a></h3>\n<p>Retorna <code>String</code> - O diretório da aplicação atual.</p>\n<h3 id=\"appgetpathname\"><a href=\"#appgetpathname\"><code>app.getPath(name)</code></a></h3>\n<ul>\n<li><code>name</code> String - You can request the following paths by the name:<ul>\n<li><code>home</code> Diretório central do usuário.</li>\n<li><code>appData</code> Per-user application data directory, which by default points to:<ul>\n<li><code>%APPDATA%</code> no Windows</li>\n<li><code>$XDG_CONFIG_HOME</code> ou <code>~/.config</code> no Linux</li>\n<li><code>~/Library/Application Support</code> no macOS</li>\n</ul></li>\n<li><code>userData</code> O diretório que guarda as configurações da sua aplicação, que por padrão é o diretório <code>appData</code> anexado com o nome da sua aplicação.</li>\n<li><code>cache</code></li>\n<li><code>temp</code> Diretório temporário.</li>\n<li><code>exe</code> O arquivo executável atual.</li>\n<li><code>module</code> A biblioteca <code>libchromiumcontent</code>.</li>\n<li><code>desktop</code> O diretório da Área de Trabalho do usuário atual.</li>\n<li><code>documents</code> Diretório dos \"Meus Documentos\" de um usuário.</li>\n<li><code>downloads</code> Diretório dos Downloads de um usuário.</li>\n<li><code>music</code> Diretório para a música de um usuário.</li>\n<li><code>pictures</code> Diretório para as imagens de um usuário.</li>\n<li><code>videos</code> Diretório para os vídeos de um usuário.</li>\n<li><code>recent</code> Directory for the user's recent files (Windows only).</li>\n<li><code>logs</code> Diretório que armazena os logs da aplicação.</li>\n<li><code>crashDumps</code> Directory where crash dumps are stored.</li>\n</ul></li>\n</ul>\n<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>\n<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>\n<h3 id=\"appgetfileiconpath-options\"><a href=\"#appgetfileiconpath-options\"><code>app.getFileIcon(path[, options])</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>size</code> String<ul>\n<li><code>small</code> - 16x16</li>\n<li><code>normal</code> - 32x32</li>\n<li><code>large</code> - 48x48 no <em>Linux</em>, 32x32 no <em>Windows</em>, não suportado no <em>macOS</em>.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - fulfilled with the app's icon, which is a <a href=\"/docs/api/native-image\">NativeImage</a>.</p>\n<p>Obtém o ícone associado a um caminho.</p>\n<p>No <em>Windows</em>, há 2 tipos de ícones:</p>\n<ul>\n<li>Ícones associados a certas extensões de arquivo, como <code>.mp3</code>, <code>.png</code>, etc.</li>\n<li>Ícones contidos no próprio arquivo, como <code>.exe</code>, <code>.dll</code>, <code>.ico</code>.</li>\n</ul>\n<p>On <em>Linux</em> and <em>macOS</em>, icons depend on the application associated with file mime type.</p>\n<h3 id=\"appsetpathname-path\"><a href=\"#appsetpathname-path\"><code>app.setPath(name, path)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n<li><code>path</code> String</li>\n</ul>\n<p>Muda o <code>path</code> à um diretório especial ou arquivo relacionado ao <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>\n<p>Você pode modificar apenas caminhos de um <code>name</code> definidos no <code>app.getPath</code>.</p>\n<p>Por padrão, cachês e cookies de páginas web serão guardados dentro do diretório <code>userData</code>. Se você quer mudar esse local, você deve modificar o caminho <code>userData</code> antes que o evento <code>ready</code> do <code>app</code> seja emitido.</p>\n<h3 id=\"appgetversion\"><a href=\"#appgetversion\"><code>app.getVersion()</code></a></h3>\n<p>Retorna <code>String</code> - A versão da aplicação carregada. Se nenhuma versão é encontrada no <code>package.json</code> da aplicação, a versão do conjunto atual ou executável será retornada.</p>\n<h3 id=\"appgetname\"><a href=\"#appgetname\"><code>app.getName()</code></a></h3>\n<p>Retorna <code>String</code> - O atual nome da aplicação, que é o nome da aplicação no arquivo <code>package.json</code>.</p>\n<p>Usually the <code>name</code> field of <code>package.json</code> is a short lowercase name, according to the npm modules spec. Você normalmente deve especificar um campo <code>productName</code>, que é o nome completo da aplicação contendo letras maiúsculas e minúsculas e qual será preferido por <code>name</code> pelo Electron.</p>\n<h3 id=\"appsetnamename\"><a href=\"#appsetnamename\"><code>app.setName(name)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n</ul>\n<p>Sobrescreve o atual nome da aplicação.</p>\n<p><strong>Note:</strong> This function overrides the name used internally by Electron; it does not affect the name that the OS uses.</p>\n<h3 id=\"appgetlocale\"><a href=\"#appgetlocale\"><code>app.getLocale()</code></a></h3>\n<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://source.chromium.org/chromium/chromium/src/+/master:ui/base/l10n/l10n_util.cc\">here</a>.</p>\n<p>To set the locale, you'll want to use a command line switch at app startup, which may be found <a href=\"/docs/api/command-line-switches\">here</a>.</p>\n<p><strong>Nota:</strong> Quando estiver distribuindo seu aplicativo, você também deve entregar a pasta <code>locales</code>.</p>\n<p><strong>Note:</strong> On Windows, you have to call it after the <code>ready</code> events gets emitted.</p>\n<h3 id=\"appgetlocalecountrycode\"><a href=\"#appgetlocalecountrycode\"><code>app.getLocaleCountryCode()</code></a></h3>\n<p>Returns <code>String</code> - User operating system's locale two-letter <a href=\"https://www.iso.org/iso-3166-country-codes.html\">ISO 3166</a> country code. The value is taken from native OS APIs.</p>\n<p><strong>Note:</strong> When unable to detect locale country code, it returns empty string.</p>\n<h3 id=\"appaddrecentdocumentpath-macos-windows\"><a href=\"#appaddrecentdocumentpath-macos-windows\"><code>app.addRecentDocument(path)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Adiciona o parâmetro <code>path</code> à lista de documentos recentes.</p>\n<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>\n<h3 id=\"appclearrecentdocuments-macos-windows\"><a href=\"#appclearrecentdocuments-macos-windows\"><code>app.clearRecentDocuments()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Limpa a lista de documentos recentes.</p>\n<h3 id=\"appsetasdefaultprotocolclientprotocol-path-args\"><a href=\"#appsetasdefaultprotocolclientprotocol-path-args\"><code>app.setAsDefaultProtocolClient(protocol[, path, args])</code></a></h3>\n<ul>\n<li><code>protocol</code> String - O nome do protocolo sem <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>\n<li><code>path</code> String (optional) <em>Windows</em> - The path to the Electron executable. O padrão é <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - Arguments passed to the executable. Defaults to an empty array</li>\n</ul>\n<p>Retorna <code>Boolean</code> - Se a chamada foi realizada com sucesso.</p>\n<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>\n<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://www.electronforge.io/\">Electron Forge</a>, <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a>, or by editing <code>info.plist</code> with a text editor. Caso precise de mais detalhes, consulte a <a href=\"https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102207-TPXREF115\">documentação da Apple</a>.</p>\n<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://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol\">declare the protocol in your manifest</a>.</p>\n<p>The API uses the Windows Registry and <code>LSSetDefaultHandlerForURLScheme</code> internally.</p>\n<h3 id=\"appremoveasdefaultprotocolclientprotocol-path-args-macos-windows\"><a href=\"#appremoveasdefaultprotocolclientprotocol-path-args-macos-windows\"><code>app.removeAsDefaultProtocolClient(protocol[, path, args])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>protocol</code> String - O nome do protocolo sem <code>://</code>.</li>\n<li><code>path</code> String (opcional) <em>Windows</em> - O padrão é <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/opcional\"></a> <em>Windows</em> - O padrão é um array vazio</li>\n</ul>\n<p>Retorna <code>Boolean</code> - Se a chamada foi realizada com sucesso.</p>\n<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>\n<h3 id=\"appisdefaultprotocolclientprotocol-path-args\"><a href=\"#appisdefaultprotocolclientprotocol-path-args\"><code>app.isDefaultProtocolClient(protocol[, path, args])</code></a></h3>\n<ul>\n<li><code>protocol</code> String - O nome do protocolo sem <code>://</code>.</li>\n<li><code>path</code> String (opcional) <em>Windows</em> - O padrão é <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/opcional\"></a> <em>Windows</em> - O padrão é um array vazio</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the current executable is the default handler for a protocol (aka URI scheme).</p>\n<p><strong>Nota:</strong> No macOS, você pode usar este método para verificar se a aplicação foi registrada como o manipulador padrão de um protocolo. Você também pode verificar isso consultando o <code>~/Library/Preferences/com.apple.LaunchServices.plist</code> na máquina macOS. Caso precise de mais detalhes, consulte a <a href=\"https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme\">documentação da Apple</a>.</p>\n<p>The API uses the Windows Registry and <code>LSCopyDefaultHandlerForURLScheme</code> internally.</p>\n<h3 id=\"appgetapplicationnameforprotocolurl\"><a href=\"#appgetapplicationnameforprotocolurl\"><code>app.getApplicationNameForProtocol(url)</code></a></h3>\n<ul>\n<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>\n</ul>\n<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>\n<p>This method returns the application name of the default handler for the protocol (aka URI scheme) of a URL.</p>\n<h3 id=\"appgetapplicationinfoforprotocolurl-macos-windows\"><a href=\"#appgetapplicationinfoforprotocolurl-macos-windows\"><code>app.getApplicationInfoForProtocol(url)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<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>\n</ul>\n<p>Returns <code>Promise&#x3C;Object></code> - Resolve with an object containing the following:</p>\n<ul>\n<li><code>icon</code> NativeImage - the display icon of the app handling the protocol.</li>\n<li><code>path</code> String  - installation path of the app handling the protocol.</li>\n<li><code>name</code> String - display name of the app handling the protocol.</li>\n</ul>\n<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>\n<h3 id=\"appsetusertaskstasks-windows\"><a href=\"#appsetusertaskstasks-windows\"><code>app.setUserTasks(tasks)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>tasks</code> <a href=\"/docs/api/structures/task\">Task[]</a> - Um array de objetos <code>Task</code></li>\n</ul>\n<p>Adds <code>tasks</code> to the <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks\">Tasks</a> category of the Jump List on Windows.</p>\n<p><code>tasks</code> é um array de objetos <a href=\"/docs/api/structures/task\"><code>Task</code></a>.</p>\n<p>Retorna <code>Boolean</code> - Se a chamada foi realizada com sucesso.</p>\n<p><strong>Nota:</strong> Se desejar personalizar ainda mais a Jump List, use <code>app.setJumpList(categories)</code> em vez deste método.</p>\n<h3 id=\"appgetjumplistsettings-windows\"><a href=\"#appgetjumplistsettings-windows\"><code>app.getJumpListSettings()</code> <em>Windows</em></a></h3>\n<p>Retorna <code>Object</code>:</p>\n<ul>\n<li><code>minItems</code> Integer - O número mínimo de itens que serão mostrados na Jump List (para uma descrição mais detalhada deste valor, consulte a <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx\">documentação no MSDN</a>).</li>\n<li><code>removedItems</code> <a href=\"/docs/api/structures/jump-list-item\">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. Estes itens não devem ser adicionados novamente à Jump List na <strong>próxima</strong> chamada a <code>app.setJumpList()</code>. O Windows não irá mostrar nenhuma categoria personalizada que tiver qualquer um dos itens removidos.</li>\n</ul>\n<h3 id=\"appsetjumplistcategories-windows\"><a href=\"#appsetjumplistcategories-windows\"><code>app.setJumpList(categories)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>categories</code> <a href=\"/docs/api/structures/jump-list-category\">JumpListCategory[]</a> | <code>null</code> - Array of <code>JumpListCategory</code> objects.</li>\n</ul>\n<p>Define ou remove uma Jump List personalizada para a aplicação e retorna uma das seguintes strings:</p>\n<ul>\n<li><code>ok</code> - Nada deu errado.</li>\n<li><code>error</code> - Um ou mais erros ocorreram. Ative a geração de logs em tempo de execução para descobrir a causa provável.</li>\n<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>\n<li><code>fileTypeRegistrationError</code> - Foi realizada uma tentativa de adicionar à Jump List um link de arquivo cujo tipo de arquivo não foi registrado para ser manipulado pela aplicação.</li>\n<li><code>customCategoryAccessDeniedError</code> - Categorias personalizadas não podem ser adicionadas à Jump List devido a restrições de privacidade do usuário ou de políticas de grupo.</li>\n</ul>\n<p>Se <code>categories</code> for <code>null</code>, a Jump List personalizada anteriormente definida (se houver) será substituída por uma Jump List padrão para o app (gerenciada pelo Windows).</p>\n<p><strong>Nota:</strong> Se um objeto <code>JumpListCategory</code> não tiver for nem a propriedade <code>type</code> nem a <code>name</code> definidas, então seu <code>type</code> é assumido como <code>tasks</code>. Se a propriedade <code>name</code> está definida mas a propriedade <code>type</code> é omissa, então o <code>type</code> é assumido como <code>custom</code>.</p>\n<p><strong>Note:</strong> Os usuários podem remover itens de categorias personalizadas, e o Windows não permitirá que um item removido seja adicionado novamente a uma categoria personalizada até <strong>após</strong> a próxima chamada bem-sucedida a <code>app.setJumpList(categories)</code>. Qualquer tentativa de adicionar novamente um item removido de uma categoria personalizada antes disso resultará na omissão da categoria inteira da Jump List. A lista dos itens removidos pode ser obtida usando <code>app.getJumpListSettings()</code>.</p>\n<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>\n<p>Aqui vai um exemplo muito simples de como criar uma Jump List personalizada:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setJumpList([\n  {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'custom'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Recent Projects'</span>,\n    <span class=\"hljs-attr\">items</span>: [\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'file'</span>, <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'C:\\\\Projects\\\\project1.proj'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'file'</span>, <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'C:\\\\Projects\\\\project2.proj'</span> }\n    ]\n  },\n  { <span class=\"hljs-comment\">// has a name so `type` is assumed to be \"custom\"</span>\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Tools'</span>,\n    <span class=\"hljs-attr\">items</span>: [\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Tool A'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--run-tool-a'</span>,\n        <span class=\"hljs-attr\">icon</span>: process.execPath,\n        <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Runs Tool A'</span>\n      },\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Tool B'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--run-tool-b'</span>,\n        <span class=\"hljs-attr\">icon</span>: process.execPath,\n        <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Runs Tool B'</span>\n      }\n    ]\n  },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'frequent'</span> },\n  { <span class=\"hljs-comment\">// has no name and no type so `type` is assumed to be \"tasks\"</span>\n    <span class=\"hljs-attr\">items</span>: [\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'New Project'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--new-project'</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Create a new project.'</span>\n      },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Recover Project'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--recover-project'</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Recover Project'</span>\n      }\n    ]\n  }\n])\n</code></pre>\n<h3 id=\"apprequestsingleinstancelock\"><a href=\"#apprequestsingleinstancelock\"><code>app.requestSingleInstanceLock()</code></a></h3>\n<p>Retorna <code>Boolean</code></p>\n<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>\n<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>\n<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>\n<p>Aqui vai um exemplo de como ativar a janela da instância principal quando uma segunda instância for iniciada:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> myWindow = <span class=\"hljs-literal\">null</span>\n\n<span class=\"hljs-keyword\">const</span> gotTheLock = app.requestSingleInstanceLock()\n\n<span class=\"hljs-keyword\">if</span> (!gotTheLock) {\n  app.quit()\n} <span class=\"hljs-keyword\">else</span> {\n  app.on(<span class=\"hljs-string\">'second-instance'</span>, (event, commandLine, workingDirectory) => {\n    <span class=\"hljs-comment\">// Someone tried to run a second instance, we should focus our window.</span>\n    <span class=\"hljs-keyword\">if</span> (myWindow) {\n      <span class=\"hljs-keyword\">if</span> (myWindow.isMinimized()) myWindow.restore()\n      myWindow.focus()\n    }\n  })\n\n  <span class=\"hljs-comment\">// Create myWindow, load the rest of the app, etc...</span>\n  app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    myWindow = createWindow()\n  })\n}\n</code></pre>\n<h3 id=\"apphassingleinstancelock\"><a href=\"#apphassingleinstancelock\"><code>app.hasSingleInstanceLock()</code></a></h3>\n<p>Retorna <code>Boolean</code></p>\n<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>\n<h3 id=\"appreleasesingleinstancelock\"><a href=\"#appreleasesingleinstancelock\"><code>app.releaseSingleInstanceLock()</code></a></h3>\n<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>\n<h3 id=\"appsetuseractivitytype-userinfo-webpageurl-macos\"><a href=\"#appsetuseractivitytype-userinfo-webpageurl-macos\"><code>app.setUserActivity(type, userInfo[, webpageURL])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>type</code> String - Identificação única da atividade. É mapeada para <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> any - App-specific state to store for use by another device.</li>\n<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>\n</ul>\n<p>Cria um <code>NSUserActivity</code> e o define como a atividade atual. A atividade, então, é qualificada para ser repassada (via <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a>) a outro dispositivo de agora em diante.</p>\n<h3 id=\"appgetcurrentactivitytype-macos\"><a href=\"#appgetcurrentactivitytype-macos\"><code>app.getCurrentActivityType()</code> <em>macOS</em></a></h3>\n<p>Retorna <code>String</code> - O tipo da atividade atualmente em execução.</p>\n<h3 id=\"appinvalidatecurrentactivity-macos\"><a href=\"#appinvalidatecurrentactivity-macos\"><code>app.invalidateCurrentActivity()</code> <em>macOS</em></a></h3>\n<p>Invalida a atividade de usuário atual do <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a>.</p>\n<h3 id=\"appresigncurrentactivity-no-macos\"><a href=\"#appresigncurrentactivity-no-macos\"><code>app.resignCurrentActivity()</code> no <em>macOS</em></a></h3>\n<p>Marks the current <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> user activity as inactive without invalidating it.</p>\n<h3 id=\"appupdatecurrentactivitytype-userinfo-macos\"><a href=\"#appupdatecurrentactivitytype-userinfo-macos\"><code>app.updateCurrentActivity(type, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>type</code> String - Identificação única da atividade. É mapeada para <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> any - App-specific state to store for use by another device.</li>\n</ul>\n<p>Atualiza a atividade atual se seu tipo corresponder a <code>type</code>, mesclando as entradas de <code>userInfo</code> ao seu dicionário <code>userInfo</code> atual.</p>\n<h3 id=\"appsetappusermodelidid-windows\"><a href=\"#appsetappusermodelidid-windows\"><code>app.setAppUserModelId(id)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>id</code> String</li>\n</ul>\n<p>Muda o <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> para <code>id</code>.</p>\n<h3 id=\"appsetactivationpolicypolicy-no-macos\"><a href=\"#appsetactivationpolicypolicy-no-macos\"><code>app.setActivationPolicy(policy)</code> no <em>macOS</em></a></h3>\n<ul>\n<li><code>policy</code> String - Can be 'regular', 'accessory', or 'prohibited'.</li>\n</ul>\n<p>Sets the activation policy for a given app.</p>\n<p>Activation policy types:</p>\n<ul>\n<li>'regular' - The application is an ordinary app that appears in the Dock and may have a user interface.</li>\n<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>\n<li>'prohibited' - The application doesn’t appear in the Dock and may not create windows or be activated.</li>\n</ul>\n<h3 id=\"appimportcertificateoptions-callback-linux\"><a href=\"#appimportcertificateoptions-callback-linux\"><code>app.importCertificate(options, callback)</code> <em>Linux</em></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>certificate</code> String - Caminho para o arquivo pkcs12.</li>\n<li><code>password</code> String - Passphrase do certificado.</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>result</code> Integer - Resultado da importação.</li>\n</ul></li>\n</ul>\n<p>Importa o certificado em formato pkcs12 ao armazenamento de certificados da plataforma. <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://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">net_error_list</a>.</p>\n<h3 id=\"appconfigurehostresolveroptions\"><a href=\"#appconfigurehostresolveroptions\"><code>app.configureHostResolver(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<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>\n<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>\n<li><code>secureDnsServers</code> String[] (optional) - A list of DNS-over-HTTP server templates. See <a href=\"https://datatracker.ietf.org/doc/html/rfc8484#section-3\">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://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&#x26;ss=chromium%2Fchromium%2Fsrc\">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>\n<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>\n</ul></li>\n</ul>\n<p>Configures host resolution (DNS and DNS-over-HTTPS). By default, the following resolvers will be used, in order:</p>\n<ol>\n<li>DNS-over-HTTPS, if the <a href=\"https://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&#x26;ss=chromium%2Fchromium%2Fsrc\">DNS provider supports it</a>, then</li>\n<li>the built-in resolver (enabled on macOS only by default), then</li>\n<li>the system's resolver (e.g. <code>getaddrinfo</code>).</li>\n</ol>\n<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>\n<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>\n<pre><code class=\"hljs language-js\">app.configureHostResolver({\n  <span class=\"hljs-attr\">secureDnsMode</span>: <span class=\"hljs-string\">'secure'</span>,\n  <span class=\"hljs-attr\">secureDnsServers</span>: [\n    <span class=\"hljs-string\">'https://cloudflare-dns.com/dns-query'</span>\n  ]\n})\n</code></pre>\n<p>This API must be called after the <code>ready</code> event is emitted.</p>\n<h3 id=\"appdisablehardwareacceleration\"><a href=\"#appdisablehardwareacceleration\"><code>app.disableHardwareAcceleration()</code></a></h3>\n<p>Desativa a aceleração de hardware para o aplicativo atual.</p>\n<p>Este método somente pode ser chamado antes do aplicativo estiver pronto.</p>\n<h3 id=\"appdisabledomainblockingfor3dapis\"><a href=\"#appdisabledomainblockingfor3dapis\"><code>app.disableDomainBlockingFor3DAPIs()</code></a></h3>\n<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>\n<p>Este método somente pode ser chamado antes do aplicativo estiver pronto.</p>\n<h3 id=\"appgetappmetrics\"><a href=\"#appgetappmetrics\"><code>app.getAppMetrics()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/process-metric\"><code>ProcessMetric[]</code></a>: Array of <code>ProcessMetric</code> objects that correspond to memory and CPU usage statistics of all the processes associated with the app.</p>\n<h3 id=\"appgetgpufeaturestatus\"><a href=\"#appgetgpufeaturestatus\"><code>app.getGPUFeatureStatus()</code></a></h3>\n<p>Retorna <a href=\"/docs/api/structures/gpu-feature-status\"><code>GPUFeatureStatus</code></a> - Os status de recursos gráficos descritos em <code>chrome://gpu/</code>.</p>\n<p><strong>Note:</strong> This information is only usable after the <code>gpu-info-update</code> event is emitted.</p>\n<h3 id=\"appgetgpuinfoinfotype\"><a href=\"#appgetgpuinfoinfotype\"><code>app.getGPUInfo(infoType)</code></a></h3>\n<ul>\n<li><code>infoType</code> String - Pode ser <code>basic</code> ou <code>complete</code>.</li>\n</ul>\n<p>Retorna <code>Promise&#x3C;unknown></code></p>\n<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://chromium.googlesource.com/chromium/src/+/4178e190e9da409b055e5dff469911ec6f6b716f/gpu/config/gpu_info.cc\">chromium's GPUInfo object</a>. This includes the version and driver information that's shown on <code>chrome://gpu</code> page.</p>\n<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>\n<pre><code class=\"hljs language-js\">{\n  <span class=\"hljs-attr\">auxAttributes</span>:\n   {\n     <span class=\"hljs-attr\">amdSwitchable</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">canSupportThreadedTextureMailbox</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">directComposition</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">directRendering</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">glResetNotificationStrategy</span>: <span class=\"hljs-number\">0</span>,\n     <span class=\"hljs-attr\">inProcessGpu</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">initializationTime</span>: <span class=\"hljs-number\">0</span>,\n     <span class=\"hljs-attr\">jpegDecodeAcceleratorSupported</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">optimus</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">passthroughCmdDecoder</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">sandboxed</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">softwareRendering</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">supportsOverlays</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">videoDecodeAcceleratorFlags</span>: <span class=\"hljs-number\">0</span>\n   },\n  <span class=\"hljs-attr\">gpuDevice</span>:\n   [{ <span class=\"hljs-attr\">active</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">deviceId</span>: <span class=\"hljs-number\">26657</span>, <span class=\"hljs-attr\">vendorId</span>: <span class=\"hljs-number\">4098</span> },\n     { <span class=\"hljs-attr\">active</span>: <span class=\"hljs-literal\">false</span>, <span class=\"hljs-attr\">deviceId</span>: <span class=\"hljs-number\">3366</span>, <span class=\"hljs-attr\">vendorId</span>: <span class=\"hljs-number\">32902</span> }],\n  <span class=\"hljs-attr\">machineModelName</span>: <span class=\"hljs-string\">'MacBookPro'</span>,\n  <span class=\"hljs-attr\">machineModelVersion</span>: <span class=\"hljs-string\">'11.5'</span>\n}\n</code></pre>\n<p>Using <code>basic</code> should be preferred if only basic information like <code>vendorId</code> or <code>driverId</code> is needed.</p>\n<h3 id=\"appsetbadgecountcount-linux-macos\"><a href=\"#appsetbadgecountcount-linux-macos\"><code>app.setBadgeCount([count])</code> <em>Linux</em> <em>macOS</em></a></h3>\n<ul>\n<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>\n</ul>\n<p>Retorna <code>Boolean</code> - Se a chamada foi realizada com sucesso.</p>\n<p>Sets the counter badge for current app. Setting the count to <code>0</code> will hide the badge.</p>\n<p>On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.</p>\n<p><strong>Note:</strong> Unity launcher requires a <code>.desktop</code> file to work. For more information, please read the <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Unity integration documentation</a>.</p>\n<h3 id=\"appgetbadgecount-linux-macos\"><a href=\"#appgetbadgecount-linux-macos\"><code>app.getBadgeCount()</code> <em>Linux</em> <em>macOS</em></a></h3>\n<p>Retorna <code>Integer</code> - O valor sendo atualmente mostrado no selo contador.</p>\n<h3 id=\"appisunityrunning-linux\"><a href=\"#appisunityrunning-linux\"><code>app.isUnityRunning()</code> <em>Linux</em></a></h3>\n<p>Retorna <code>Boolean</code> - Indica se o ambiente de trabalho atual é o Unity ou não.</p>\n<h3 id=\"appgetloginitemsettingsoptions-macos-windows\"><a href=\"#appgetloginitemsettingsoptions-macos-windows\"><code>app.getLoginItemSettings([options])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>path</code> String (optional) <em>Windows</em> - The executable path to compare against. Defaults to <code>process.execPath</code>.</li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - The command-line arguments to compare against. Defaults to an empty array.</li>\n</ul></li>\n</ul>\n<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>\n<p>Retorna <code>Object</code>:</p>\n<ul>\n<li><code>openAtLogin</code> Boolean - <code>true</code> se o aplicativo está configurado para abrir no login.</li>\n<li><code>openAsHidden</code> Boolean <em>macOS</em> - <code>true</code> if the app is set to open as hidden at login. This setting is not available on <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>wasOpenedAtLogin</code> Boolean <em>macOS</em> - <code>true</code> if the app was opened at login automatically. This setting is not available on <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>wasOpenedAsHidden</code> Boolean <em>macOS</em> - <code>true</code> if the app was opened as a hidden login item. Isso indica que o aplicativo não deverá abrir nenhuma janela durante a inicialização. This setting is not available on <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>restoreState</code> Boolean <em>macOS</em> - <code>true</code> if the app was opened as a login item that should restore the state from the previous session. Isso indica que o aplicativo deverá restaurar as janelas que foram abertas da última vez que o aplicativo fora fechado. This setting is not available on <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>executableWillLaunchAtLogin</code> Boolean <em>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>\n<li><code>launchItems</code> Object[] <em>Windows</em><ul>\n<li><code>name</code> String <em>Windows</em> - name value of a registry entry.</li>\n<li><code>path</code> String <em>Windows</em> - The executable to an app that corresponds to a registry entry.</li>\n<li><code>args</code> String[] <em>Windows</em> - the command-line arguments to pass to the executable.</li>\n<li><code>scope</code> String <em>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>\n<li><code>enabled</code> Boolean <em>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>\n</ul></li>\n</ul>\n<h3 id=\"appsetloginitemsettingssettings-macos-windows\"><a href=\"#appsetloginitemsettingssettings-macos-windows\"><code>app.setLoginItemSettings(settings)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>settings</code> Object<ul>\n<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>\n<li><code>openAsHidden</code> Boolean (optional) <em>macOS</em> - <code>true</code> to open the app as hidden. Padrão sendo <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=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>path</code> String (optional) <em>Windows</em> - The executable to launch at login. Defaults to <code>process.execPath</code>.</li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - The command-line arguments to pass to the executable. Defaults to an empty array. Take care to wrap paths in quotes.</li>\n<li><code>enabled</code> Boolean (optional) <em>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>\n<li><code>name</code> String (optional) <em>Windows</em> - value name to write into registry. Defaults to the app's AppUserModelId(). Define as opções de execução do aplicativo na inicialização do sistema.</li>\n</ul></li>\n</ul>\n<p>Para funcionar com o <code>autoUpdater</code> do Electron no Windows, o qual usa o <a href=\"https://github.com/Squirrel/Squirrel.Windows\">Squirrel</a>, recomendamos definir o caminho de inicialização para Update.exe e passar a ele os argumentos que especificam o nome do seu aplicativo. Como por exemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> appFolder = path.dirname(process.execPath)\n<span class=\"hljs-keyword\">const</span> updateExe = path.resolve(appFolder, <span class=\"hljs-string\">'..'</span>, <span class=\"hljs-string\">'Update.exe'</span>)\n<span class=\"hljs-keyword\">const</span> exeName = path.basename(process.execPath)\n\napp.setLoginItemSettings({\n  <span class=\"hljs-attr\">openAtLogin</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">path</span>: updateExe,\n  <span class=\"hljs-attr\">args</span>: [\n    <span class=\"hljs-string\">'--processStart'</span>, <span class=\"hljs-string\">`\"<span class=\"hljs-subst\">${exeName}</span>\"`</span>,\n    <span class=\"hljs-string\">'--process-start-args'</span>, <span class=\"hljs-string\">`\"--hidden\"`</span>\n  ]\n})\n</code></pre>\n<h3 id=\"appisaccessibilitysupportenabled-macos-windows\"><a href=\"#appisaccessibilitysupportenabled-macos-windows\"><code>app.isAccessibilitySupportEnabled()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Retorna <code>Boolean</code> - <code>true</code> se o suporte à acessibilidade do Chrome estiver ativado, <code>false</code> caso contrário. Essa API retornará <code>true</code> se o uso de tecnologias assistivas, tais como leitores de tela, foi detectado. Consulte <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">https://www.chromium.org/developers/design-documents/accessibility</a> para mais detalhes.</p>\n<h3 id=\"appsetaccessibilitysupportenabledenabled-macos-windows\"><a href=\"#appsetaccessibilitysupportenabledenabled-macos-windows\"><code>app.setAccessibilitySupportEnabled(enabled)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>enabled</code> Boolean - Ativa ou desativa a renderização da <a href=\"https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree\">árvore de acessibilidade</a></li>\n</ul>\n<p>Ativa manualmente o suporte à acessibilidade do Chrome, permitindo expor uma opção para ativar/desativar a acessibilidade nas configurações do aplicativo. See <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">Chromium's accessibility docs</a> for more details. Desativado por padrão.</p>\n<p>This API must be called after the <code>ready</code> event is emitted.</p>\n<p><strong>Note:</strong> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.</p>\n<h3 id=\"appshowaboutpanel\"><a href=\"#appshowaboutpanel\"><code>app.showAboutPanel()</code></a></h3>\n<p>Show the app's about panel options. These options can be overridden with <code>app.setAboutPanelOptions(options)</code>.</p>\n<h3 id=\"appsetaboutpaneloptionsoptions\"><a href=\"#appsetaboutpaneloptionsoptions\"><code>app.setAboutPanelOptions(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>applicationName</code> String (opcional) - O nome do aplicativo.</li>\n<li><code>applicationVersion</code> String (opcional) - A versão do aplicativo.</li>\n<li><code>copyright</code> String (opcional) - Informações de copyright.</li>\n<li><code>version</code> String (optional) <em>macOS</em> - The app's build version number.</li>\n<li><code>credits</code> String (optional) <em>macOS</em> <em>Windows</em> - Credit information.</li>\n<li><code>authors</code> String<a href=\"/docs/api/optional\"></a> <em>Linux</em> - List of app authors.</li>\n<li><code>website</code> String (optional) <em>Linux</em> - The app's website.</li>\n<li><code>iconPath</code> String (optional) <em>Linux</em> <em>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>\n</ul></li>\n</ul>\n<p>Define as opções do painel sobre. This will override the values defined in the app's <code>.plist</code> file on macOS. Consulte a <a href=\"https://developer.apple.com/reference/appkit/nsapplication/1428479-orderfrontstandardaboutpanelwith?language=objc\">documentação da Apple</a> para mais detalhes. On Linux, values must be set in order to be shown; there are no defaults.</p>\n<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://developer.apple.com/documentation/appkit/nsaboutpaneloptioncredits?language=objc\">documentation</a> for more information.</p>\n<h3 id=\"appisemojipanelsupported\"><a href=\"#appisemojipanelsupported\"><code>app.isEmojiPanelSupported()</code></a></h3>\n<p>Returns <code>Boolean</code> - whether or not the current OS version allows for native emoji pickers.</p>\n<h3 id=\"appshowemojipanel-macos-windows\"><a href=\"#appshowemojipanel-macos-windows\"><code>app.showEmojiPanel()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Show the platform's native emoji picker.</p>\n<h3 id=\"appstartaccessingsecurityscopedresourcebookmarkdata-mas\"><a href=\"#appstartaccessingsecurityscopedresourcebookmarkdata-mas\"><code>app.startAccessingSecurityScopedResource(bookmarkData)</code> <em>mas</em></a></h3>\n<ul>\n<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>\n</ul>\n<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://developer.apple.com/reference/foundation/nsurl/1417051-startaccessingsecurityscopedreso?language=objc\">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>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Start accessing the file.</span>\n<span class=\"hljs-keyword\">const</span> stopAccessingSecurityScopedResource = app.startAccessingSecurityScopedResource(data)\n<span class=\"hljs-comment\">// You can now access the file outside of the sandbox 🎉</span>\n\n<span class=\"hljs-comment\">// Remember to stop accessing the file once you've finished with it.</span>\nstopAccessingSecurityScopedResource()\n</code></pre>\n<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://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">Apple's documentation</a> for a description of how this system works.</p>\n<h3 id=\"appenablesandbox\"><a href=\"#appenablesandbox\"><code>app.enableSandbox()</code></a></h3>\n<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>\n<p>Este método somente pode ser chamado antes do aplicativo estiver pronto.</p>\n<h3 id=\"appisinapplicationsfolder-macos\"><a href=\"#appisinapplicationsfolder-macos\"><code>app.isInApplicationsFolder()</code> <em>macOS</em></a></h3>\n<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>\n<h3 id=\"appmovetoapplicationsfolderoptions-macos\"><a href=\"#appmovetoapplicationsfolderoptions-macos\"><code>app.moveToApplicationsFolder([options])</code> <em>macOS</em></a></h3>\n<ul>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>conflictHandler</code> Function\\<boolean> (optional) - A handler for potential conflict in move failure.<ul>\n<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>\n</ul></boolean></li>\n</ul></li>\n</ul>\n<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>\n<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=\"/docs/api/dialog\"><code>dialog</code></a> API.</p>\n<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>\n<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>\n<p>Como por exemplo:</p>\n<pre><code class=\"hljs language-js\">app.moveToApplicationsFolder({\n  <span class=\"hljs-attr\">conflictHandler</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">conflictType</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (conflictType === <span class=\"hljs-string\">'exists'</span>) {\n      <span class=\"hljs-keyword\">return</span> dialog.showMessageBoxSync({\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'question'</span>,\n        <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Halt Move'</span>, <span class=\"hljs-string\">'Continue Move'</span>],\n        <span class=\"hljs-attr\">defaultId</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'An app of this name already exists'</span>\n      }) === <span class=\"hljs-number\">1</span>\n    }\n  }\n})\n</code></pre>\n<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>\n<h3 id=\"appissecurekeyboardentryenabled-macos\"><a href=\"#appissecurekeyboardentryenabled-macos\"><code>app.isSecureKeyboardEntryEnabled()</code> <em>macOS</em></a></h3>\n<p>Returns <code>Boolean</code> - whether <code>Secure Keyboard Entry</code> is enabled.</p>\n<p>By default this API will return <code>false</code>.</p>\n<h3 id=\"appsetsecurekeyboardentryenabledenabled-macos\"><a href=\"#appsetsecurekeyboardentryenabledenabled-macos\"><code>app.setSecureKeyboardEntryEnabled(enabled)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>enabled</code> Boolean - Enable or disable <code>Secure Keyboard Entry</code></li>\n</ul>\n<p>Set the <code>Secure Keyboard Entry</code> is enabled in your application.</p>\n<p>By using this API, important information such as password and other sensitive information can be prevented from being intercepted by other processes.</p>\n<p>See <a href=\"https://developer.apple.com/library/archive/technotes/tn2150/_index.html\">Apple's documentation</a> for more details.</p>\n<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>\n<h2 id=\"propriedades\"><a href=\"#propriedades\">Propriedades</a></h2>\n<h3 id=\"appaccessibilitysupportenabled-macos-windows\"><a href=\"#appaccessibilitysupportenabled-macos-windows\"><code>app.accessibilitySupportEnabled</code> <em>macOS</em> <em>Windows</em></a></h3>\n<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>\n<p>See <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">Chromium's accessibility docs</a> for more details. Desativado por padrão.</p>\n<p>This API must be called after the <code>ready</code> event is emitted.</p>\n<p><strong>Note:</strong> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.</p>\n<h3 id=\"appapplicationmenu\"><a href=\"#appapplicationmenu\"><code>app.applicationMenu</code></a></h3>\n<p>A <code>Menu | null</code> property that returns <a href=\"/docs/api/menu\"><code>Menu</code></a> if one has been set and <code>null</code> otherwise. Users can pass a <a href=\"/docs/api/menu\">Menu</a> to set this property.</p>\n<h3 id=\"appbadgecount-linux-macos\"><a href=\"#appbadgecount-linux-macos\"><code>app.badgeCount</code> <em>Linux</em> <em>macOS</em></a></h3>\n<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>\n<p>On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher.</p>\n<p><strong>Note:</strong> Unity launcher requires a <code>.desktop</code> file to work. For more information, please read the <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Unity integration documentation</a>.</p>\n<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>\n<h3 id=\"appcommandline-readonly\"><a href=\"#appcommandline-readonly\"><code>app.commandLine</code> <em>Readonly</em></a></h3>\n<p>A <a href=\"/docs/api/command-line\"><code>CommandLine</code></a> object that allows you to read and manipulate the command line arguments that Chromium uses.</p>\n<h3 id=\"appdock-macos-readonly\"><a href=\"#appdock-macos-readonly\"><code>app.dock</code> <em>macOS</em> <em>Readonly</em></a></h3>\n<p>A <a href=\"/docs/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>\n<h3 id=\"appispackaged-readonly\"><a href=\"#appispackaged-readonly\"><code>app.isPackaged</code> <em>Readonly</em></a></h3>\n<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>\n<h3 id=\"appname\"><a href=\"#appname\"><code>app.name</code></a></h3>\n<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>\n<p>Usually the <code>name</code> field of <code>package.json</code> is a short lowercase name, according to the npm modules spec. Você normalmente deve especificar um campo <code>productName</code>, que é o nome completo da aplicação contendo letras maiúsculas e minúsculas e qual será preferido por <code>name</code> pelo Electron.</p>\n<h3 id=\"appuseragentfallback\"><a href=\"#appuseragentfallback\"><code>app.userAgentFallback</code></a></h3>\n<p>A <code>String</code> which is the user agent string Electron will use as a global fallback.</p>\n<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>\n<h3 id=\"apprunningunderrosettatranslation-macos-readonly-deprecated\"><a href=\"#apprunningunderrosettatranslation-macos-readonly-deprecated\"><code>app.runningUnderRosettaTranslation</code> <em>macOS</em> <em>Readonly</em> <em>Deprecated</em></a></h3>\n<p>A <code>Boolean</code> which when <code>true</code> indicates that the app is currently running under the <a href=\"https://en.wikipedia.org/wiki/Rosetta_(software)\">Rosetta Translator Environment</a>.</p>\n<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>\n<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>\n<h3 id=\"apprunningunderarm64translation-readonly-macos-windows\"><a href=\"#apprunningunderarm64translation-readonly-macos-windows\"><code>app.runningUnderARM64Translation</code> <em>Readonly</em> <em>macOS</em> <em>Windows</em></a></h3>\n<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://en.wikipedia.org/wiki/Rosetta_(software)\">Rosetta Translator Environment</a> or Windows <a href=\"https://en.wikipedia.org/wiki/Windows_on_Windows\">WOW</a>).</p>\n<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>",
      "title": "app",
      "description": "Controle os eventos do ciclo de vida da sua aplicação."
    },
    "/docs/tutorial/application-debugging": {
      "locale": "pt-BR",
      "slug": "application-debugging",
      "href": "/docs/tutorial/application-debugging",
      "crowdinFileId": "256175",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/application-debugging.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"depuração-de-aplicativos\"><a href=\"#depuração-de-aplicativos\">Depuração de Aplicativos</a></h1>\n<p>Sempre que seu aplicativo Electron não estiver se comportando do jeito que você queria, você pode usar uma gama de ferramentas te dão uma força para descobrir erros no seu código, gargalos de desempenho e oportunidades de otimização.</p>\n<h2 id=\"processo-de-renderização\"><a href=\"#processo-de-renderização\">Processo de Renderização</a></h2>\n<p>A ferramenta mais recomendada para depurar processos de renderização individuais é o Chromium DevTools. Ele está disponível em todos os processos de renderização, incluindo instâncias de <code>BrowserWindow</code>, <code>BrowserView</code> e <code>WebView</code>. Você pode abrí-lo a partir do seu código chamando a API <code>openDevTools()</code> no <code>webContents</code> da instância:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.openDevTools()\n</code></pre>\n<p>O Google oferece [uma excelente documentação de suas ferramentas de desenvolvimento][devtools]. Recomendamos que você aprenda bem a usá-lo - ele está entre as ferramentas mais poderosas no cinto de utilidades de qualquer desenvolvedor Electron.</p>\n<h2 id=\"processo-principal\"><a href=\"#processo-principal\">Processo Principal</a></h2>\n<p>Depurar o processo principal é um pouquinho mais complicado, já que não dá de abrir ferramentas de desenvolvimento pra ele. O Chromium DevTools pode <a href=\"https://nodejs.org/en/docs/inspector/\">ser usado para depurar o processo principal do Electron</a> graças a uma colaboração mais próxima entre o Google / Chrome e o Node.js, mas você poderá encontrar algumas desvantagens, como a indisponibilidade do método <code>require</code> no console.</p>\n<p>Para mais informações, consulte o documento <a href=\"/docs/tutorial/debugging-main-process\">Depurando o Processo Principal</a>.</p>\n<h2 id=\"travamento-v8\"><a href=\"#travamento-v8\">Travamento V8</a></h2>\n<p>Se o contexto V8 parar de funcionar, as ferramentas de desenvolvimento mostratão a seguinte mensagem.</p>\n<p><code>DevTools was disconnected from the page. Once page is reloaded, DevTools will automatically reconnect.</code></p>\n<p>Logs para Chromium podem ser habilitados através da variável de ambiente <code>ELECTRON_ENABLE_LOGGING</code>. Para mais informações, consulte o documento <a href=\"/docs/api/environment-variables#electron_enable_logging\">Variáveis de ambiente</a>.</p>\n<p>Alternativamente, o argumento da linha de comando <code>--enable-logging</code> pode ser passado. Mais informações estão disponíveis na documentação de <a href=\"/docs/api/command-line-switches#--enable-loggingfile\">Alteradores de linha de comando</a>.</p>\n<p>[devtools]: <a href=\"https://developers\">https://developers</a>. google. com/web/tools/chrome-devtools/</p>",
      "title": "Depuração de Aplicativos",
      "description": ""
    },
    "/docs/tutorial/application-distribution": {
      "locale": "pt-BR",
      "slug": "application-distribution",
      "href": "/docs/tutorial/application-distribution",
      "crowdinFileId": "256177",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/application-distribution.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"distribuição-de-aplicativos\"><a href=\"#distribuição-de-aplicativos\">Distribuição de Aplicativos</a></h1>\n<h2 id=\"visão-geral\"><a href=\"#visão-geral\">Visão Geral</a></h2>\n<p>To distribute your app with Electron, you need to package and rebrand it. To do this, you can either use specialized tooling or manual approaches.</p>\n<h2 id=\"with-tooling\"><a href=\"#with-tooling\">With tooling</a></h2>\n<p>You can use the following tools to distribute your application:</p>\n<ul>\n<li><a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a></li>\n<li><a href=\"https://github.com/electron-userland/electron-builder\">electron-builder</a></li>\n<li><a href=\"https://github.com/electron/electron-packager\">electron-packager</a></li>\n</ul>\n<p>These tools will take care of all the steps you need to take to end up with a distributable Electron application, such as bundling your application, rebranding the executable, and setting the right icons.</p>\n<p>You can check the example of how to package your app with <code>electron-forge</code> in the <a href=\"/docs/tutorial/quick-start#package-and-distribute-your-application\">Quick Start guide</a>.</p>\n<h2 id=\"distribuição-manual\"><a href=\"#distribuição-manual\">Distribuição manual</a></h2>\n<h3 id=\"with-prebuilt-binaries\"><a href=\"#with-prebuilt-binaries\">With prebuilt binaries</a></h3>\n<p>To distribute your app manually, you need to download Electron's <a href=\"https://github.com/electron/electron/releases\">prebuilt binaries</a>. Depois disso, a pasta contendo seu aplicativo deve ser renomeada para <code>app</code> e colocada dentro do diretório de recursos (resources) do Electron como mostrado nos seguintes exemplos.</p>\n<blockquote>\n<p><em>NOTE:</em> the location of Electron's prebuilt binaries is indicated with <code>electron/</code> in the examples below.</p>\n</blockquote>\n<p><em>No macOS:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/Electron.app/Contents/Resources/app/\n├── package.json\n├── main.js\n└── index.html\n</code></pre>\n<p><em>No Windows e Linux:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/resources/app\n├── package.json\n├── main.js\n└── index.html\n</code></pre>\n<p>Then execute <code>Electron.app</code> on macOS, <code>electron</code> on Linux, or <code>electron.exe</code> on Windows, and Electron will start as your app. The <code>electron</code> directory will then be your distribution to deliver to users.</p>\n<h3 id=\"with-an-app-source-code-archive\"><a href=\"#with-an-app-source-code-archive\">With an app source code archive</a></h3>\n<p>Instead of from shipping your app by copying all of its source files, you can package your app into an <a href=\"https://github.com/electron/asar\">asar</a> archive to improve the performance of reading files on platforms like Windows, if you are not already using a bundler such as Parcel or Webpack.</p>\n<p>Para usar um arquivo <code>asar</code> para substituir a pasta <code>app</code>, você precisa renomear o arquivo para <code>app.asar</code> e colocá-lo dentro da pasta de recursos do Electron como mostrado abaixo, e o Electron irá então ler o arquivo e executar seu app.</p>\n<p><em>No macOS:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/Electron.app/Contents/Resources/\n└── app.asar\n</code></pre>\n<p><em>No Windows e Linux:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/resources/\n└── app.asar\n</code></pre>\n<p>You can find more details on how to use <code>asar</code> in the <a href=\"https://github.com/electron/asar\"><code>electron/asar</code> repository</a>.</p>\n<h3 id=\"rebranding-with-downloaded-binaries\"><a href=\"#rebranding-with-downloaded-binaries\">Rebranding with downloaded binaries</a></h3>\n<p>Após deixar seu app Electron pronto para usar, você pode querer personalizar os executáveis do Electron antes de distribuí-los aos usuários.</p>\n<h4 id=\"macos\"><a href=\"#macos\">macOS</a></h4>\n<p>Você pode renomear o <code>Electron.app</code> para qualquer nome que você quiser, porém você também deve renomear os campos <code>CFBundleDisplayName</code>, <code>CFBundleIdentifier</code> e <code>CFBundleName</code> nos seguintes arquivos:</p>\n<ul>\n<li><code>Electron.app/Contents/Info.plist</code></li>\n<li><code>Electron.app/Contents/Frameworks/Electron Helper.app/Contents/Info.plist</code></li>\n</ul>\n<p>Você também pode renomear o app auxiliar para evitar de mostrar <code>Electron Helper</code> no Monitor de Atividade, mas não esqueça de renomear o arquivo executável do app auxiliar.</p>\n<p>Veja como ficaria a estrutura de um aplicativo renomeado:</p>\n<pre><code class=\"hljs language-plaintext\">MyApp.app/Contents\n├── Info.plist\n├── MacOS/\n│   └── MyApp\n└── Frameworks/\n    └── MyApp Helper.app\n        ├── Info.plist\n        └── MacOS/\n            └── MyApp Helper\n</code></pre>\n<h4 id=\"windows\"><a href=\"#windows\">Windows</a></h4>\n<p>Você pode renomear o <code>electron.exe</code> para qualquer nome que você quiser, além de editar seu ícone e outras informações com ferramentas como o <a href=\"https://github.com/electron/rcedit\">rcedit</a>.</p>\n<h4 id=\"linux\"><a href=\"#linux\">Linux</a></h4>\n<p>Você pode renomear o executável <code>electron</code> para qualquer nome que você quiser.</p>\n<h3 id=\"rebranding-by-rebuilding-electron-from-source\"><a href=\"#rebranding-by-rebuilding-electron-from-source\">Rebranding by rebuilding Electron from source</a></h3>\n<p>Também é possível remarcar o Electron mudando o nome do produto e construindo a partir fonte. To do this you need to set the build argument corresponding to the product name (<code>electron_product_name = \"YourProductName\"</code>) in the <code>args.gn</code> file and rebuild.</p>",
      "title": "Distribuição de Aplicativos",
      "description": "NOTE: the location of Electron's prebuilt binaries is indicated with electron/ in the examples below."
    },
    "/docs/api/auto-updater": {
      "locale": "pt-BR",
      "slug": "auto-updater",
      "href": "/docs/api/auto-updater",
      "crowdinFileId": "256281",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/auto-updater.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"autoupdater\"><a href=\"#autoupdater\">autoUpdater</a></h1>\n<blockquote>\n<p>Habilita aplicações a se atualizarem automaticamente.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><strong>See also: <a href=\"/docs/tutorial/updates\">A detailed guide about how to implement updates in your application</a>.</strong></p>\n<p><code>autoUpdater</code> é um <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h2 id=\"avisos-de-plataforma\"><a href=\"#avisos-de-plataforma\">Avisos de plataforma</a></h2>\n<p>Atualmente, apenas o macOS e o Windows são suportados. Não há suporte nativo para o atualizador automático no Linux - portanto, recomendamos usar o gerenciador de pacotes da distribuição para atualizar seu app.</p>\n<p>Além disso, existem algumas diferenças sutis em cada plataforma:</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>No macOS, o módulo <code>autoUpdater</code> é construído em cima do <a href=\"https://github.com/Squirrel/Squirrel.Mac\">Squirrel.Mac</a>, ou seja, você não precisa de nenhuma configuração especial para que funcione. Para os requisitos do lado do servidor, você pode ler o <a href=\"https://github.com/Squirrel/Squirrel.Mac#server-support\">Suporte do servidor</a>. Observe que o <a href=\"https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW35\">App Transport Security</a> (ATS) aplica-se a todas as solicitações feitas como parte do processo de atualização. Aplicações que precisam desativar o ATS podem adicionar a chave <code>NSAllowsArbitraryLoads</code> no plist de sua aplicação.</p>\n<p><strong>Nota:</strong> Seu aplicativo precisa estar assinado para que seja automaticamente atualizado no macOS. Isto é um requisito do <code>Squirrel.Mac</code>.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<p>On Windows, you have to install your app into a user's machine before you can use the <code>autoUpdater</code>, so it is recommended that you use the <a href=\"https://github.com/electron/windows-installer\">electron-winstaller</a>, <a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a> or the <a href=\"https://github.com/electron/grunt-electron-installer\">grunt-electron-installer</a> package to generate a Windows installer.</p>\n<p>When using <a href=\"https://github.com/electron/windows-installer\">electron-winstaller</a> or <a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a> make sure you do not try to update your app <a href=\"https://github.com/electron/windows-installer#handling-squirrel-events\">the first time it runs</a> (Also see <a href=\"https://github.com/electron/electron/issues/7155\">this issue for more info</a>). Também é recomendado utilizar o <a href=\"https://github.com/mongodb-js/electron-squirrel-startup\">electron-squirrel-startup</a> para obter atalhos da área de trabalho para sua aplicação.</p>\n<p>The installer generated with Squirrel will create a shortcut icon with an <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> in the format of <code>com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE</code>, examples are <code>com.squirrel.slack.Slack</code> and <code>com.squirrel.code.Code</code>. Você deve usar o mesmo ID para sua aplicação com a API <code>app.setAppUserModelId</code>, caso contrário, o Windows não será capaz de fixar sua aplicação corretamente na barra de tarefas.</p>\n<p>Like Squirrel.Mac, Windows can host updates on S3 or any other static file host. You can read the documents of <a href=\"https://github.com/Squirrel/Squirrel.Windows\">Squirrel.Windows</a> to get more details about how Squirrel.Windows works.</p>\n<h2 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h2>\n<p>O objeto <code>autoUpdater</code> emite os seguintes eventos:</p>\n<h3 id=\"evento-error\"><a href=\"#evento-error\">Evento: 'error'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li>Erro <code>error</code></li>\n</ul>\n<p>Emitido quando há um erro durante a atualização.</p>\n<h3 id=\"evento-checking-for-update\"><a href=\"#evento-checking-for-update\">Evento: 'checking-for-update'</a></h3>\n<p>Emitido ao verificar se uma atualização começou.</p>\n<h3 id=\"evento-update-available\"><a href=\"#evento-update-available\">Evento: 'update-available'</a></h3>\n<p>Emitido quando houver uma atualização disponível. A atualização é baixada automaticamente.</p>\n<h3 id=\"evento-update-not-available\"><a href=\"#evento-update-not-available\">Evento: 'update-not-available'</a></h3>\n<p>Emitido quando não há atualização disponível.</p>\n<h3 id=\"evento-update-downloaded\"><a href=\"#evento-update-downloaded\">Evento: 'update-downloaded'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>String <code>releaseNotes</code></li>\n<li>String <code>releaseName</code></li>\n<li>Data <code>releaseDate</code></li>\n<li>String <code>updateURL</code></li>\n</ul>\n<p>Emitido quando uma atualização foi baixada.</p>\n<p>No Windows apenas o <code>releaseName</code> está disponível.</p>\n<p><strong>Nota:</strong> Não é estritamente necessário tratar este evento. Uma atualização baixada com sucesso ainda será aplicada na próxima vez que o aplicativo iniciar.</p>\n<h3 id=\"evento-before-quit-for-update\"><a href=\"#evento-before-quit-for-update\">Evento: 'before-quit-for-update'</a></h3>\n<p>Este evento é emitido depois de um usuário chamar <code>quitAndInstall()</code>.</p>\n<p>Quando esta API é chamada, o evento <code>before-quit</code> não é emitido antes de todas as janelas serem fechadas. Como resultado, você deve ouvir este evento se você deseja executar ações antes das janelas serem fechadas enquanto um processo é encerrado, Além de ouvir <code>before-quit</code>.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O objeto <code>autoUpdater</code> possui os seguintes métodos:</p>\n<h3 id=\"autoupdatersetfeedurloptions\"><a href=\"#autoupdatersetfeedurloptions\"><code>autoUpdater.setFeedURL(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li>String <code>url</code></li>\n<li><code>headers</code> Record&#x3C;String, String> (opcional) <em>macOS</em> - Cabeçalhos da solicitação HTTP.</li>\n<li><code>serverType</code> String (optional) <em>macOS</em> - Can be <code>json</code> or <code>default</code>, see the <a href=\"https://github.com/Squirrel/Squirrel.Mac\">Squirrel.Mac</a> README for more information.</li>\n</ul></li>\n</ul>\n<p>Define a <code>url</code> e inicializa a atualização automática.</p>\n<h3 id=\"autoupdatergetfeedurl\"><a href=\"#autoupdatergetfeedurl\"><code>autoUpdater.getFeedURL()</code></a></h3>\n<p>Returns <code>String</code> - The current update feed URL.</p>\n<h3 id=\"autoupdatercheckforupdates\"><a href=\"#autoupdatercheckforupdates\"><code>autoUpdater.checkForUpdates()</code></a></h3>\n<p>Pergunta para o servidor se há alguma atualização. Você precisa chamar o <code>setFeedURL</code> antes de usar esta API.</p>\n<p><strong>Note:</strong> If an update is available it will be downloaded automatically. Calling <code>autoUpdater.checkForUpdates()</code> twice will download the update two times.</p>\n<h3 id=\"autoupdaterquitandinstall\"><a href=\"#autoupdaterquitandinstall\"><code>autoUpdater.quitAndInstall()</code></a></h3>\n<p>Reinicia o aplicativo e instala a atualização após ela ter sido baixada. Deve ser chamado apenas após o evento <code>update-downloaded</code> ter sido emitido.</p>\n<p>Sob o capô chamando <code>autoUpdater.quitAndInstall()</code> fechará todos os aplicativos janelas primeiro, e automaticamente chamar <code>app.quit()</code> depois de todas as janelas foram Fechado.</p>\n<p><strong>Nota:</strong> Não é estritamente necessário para lidar com este evento. Uma atualização baixada com sucesso ainda será aplicada na próxima vez que o aplicativo for iniciado.</p>",
      "title": "autoUpdater",
      "description": "Habilita aplicações a se atualizarem automaticamente."
    },
    "/docs/tutorial/automated-testing-with-a-custom-driver": {
      "locale": "pt-BR",
      "slug": "automated-testing-with-a-custom-driver",
      "href": "/docs/tutorial/automated-testing-with-a-custom-driver",
      "crowdinFileId": "256179",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/automated-testing-with-a-custom-driver.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"automatizando-teste-com-driver-personalizado\"><a href=\"#automatizando-teste-com-driver-personalizado\">Automatizando Teste com Driver Personalizado</a></h1>\n<p>Para escrever testes automatizados para seu aplicativo Electron, você precisará de uma maneira de \"conduzir\" seu aplicativo. <a href=\"https://electronjs.org/spectron\">Spectron</a> is a commonly-used solution which lets you emulate user actions via <a href=\"https://webdriver.io/\">WebDriver</a>. However, it's also possible to write your own custom driver using node's builtin IPC-over-STDIO. The benefit of a custom driver is that it tends to require less overhead than Spectron, and lets you expose custom methods to your test suite.</p>\n<p>To create a custom driver, we'll use Node.js' <a href=\"https://nodejs.org/api/child_process.html\">child_process</a> API. The test suite will spawn the Electron process, then establish a simple messaging protocol:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> childProcess = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'child_process'</span>)\n<span class=\"hljs-keyword\">const</span> electronPath = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// spawn the process</span>\n<span class=\"hljs-keyword\">const</span> env = { <span class=\"hljs-comment\">/* ... */</span> }\n<span class=\"hljs-keyword\">const</span> stdio = [<span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'ipc'</span>]\n<span class=\"hljs-keyword\">const</span> appProcess = childProcess.spawn(electronPath, [<span class=\"hljs-string\">'./app'</span>], { stdio, env })\n\n<span class=\"hljs-comment\">// listen for IPC messages from the app</span>\nappProcess.on(<span class=\"hljs-string\">'message'</span>, (msg) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// send an IPC message to the app</span>\nappProcess.send({ <span class=\"hljs-attr\">my</span>: <span class=\"hljs-string\">'message'</span> })\n</code></pre>\n<p>From within the Electron app, you can listen for messages and send replies using the Node.js <a href=\"https://nodejs.org/api/process.html\">process</a> API:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// listen for IPC messages from the test suite</span>\nprocess.on(<span class=\"hljs-string\">'message'</span>, (msg) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// send an IPC message to the test suite</span>\nprocess.send({ <span class=\"hljs-attr\">my</span>: <span class=\"hljs-string\">'message'</span> })\n</code></pre>\n<p>We can now communicate from the test suite to the Electron app using the <code>appProcess</code> object.</p>\n<p>For convenience, you may want to wrap <code>appProcess</code> in a driver object that provides more high-level functions. Here is an example of how you can do this:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">TestDriver</span> </span>{\n  <span class=\"hljs-keyword\">constructor</span> ({ path, args, env }) {\n    <span class=\"hljs-keyword\">this</span>.rpcCalls = []\n\n    <span class=\"hljs-comment\">// start child process</span>\n    env.APP_TEST_DRIVER = <span class=\"hljs-number\">1</span> <span class=\"hljs-comment\">// let the app know it should listen for messages</span>\n    <span class=\"hljs-keyword\">this</span>.process = childProcess.spawn(path, args, { <span class=\"hljs-attr\">stdio</span>: [<span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'ipc'</span>], env })\n\n    <span class=\"hljs-comment\">// handle rpc responses</span>\n    <span class=\"hljs-keyword\">this</span>.process.on(<span class=\"hljs-string\">'message'</span>, (message) => {\n      <span class=\"hljs-comment\">// pop the handler</span>\n      <span class=\"hljs-keyword\">const</span> rpcCall = <span class=\"hljs-keyword\">this</span>.rpcCalls[message.msgId]\n      <span class=\"hljs-keyword\">if</span> (!rpcCall) <span class=\"hljs-keyword\">return</span>\n      <span class=\"hljs-keyword\">this</span>.rpcCalls[message.msgId] = <span class=\"hljs-literal\">null</span>\n      <span class=\"hljs-comment\">// reject/resolve</span>\n      <span class=\"hljs-keyword\">if</span> (message.reject) rpcCall.reject(message.reject)\n      <span class=\"hljs-keyword\">else</span> rpcCall.resolve(message.resolve)\n    })\n\n    <span class=\"hljs-comment\">// wait for ready</span>\n    <span class=\"hljs-keyword\">this</span>.isReady = <span class=\"hljs-keyword\">this</span>.rpc(<span class=\"hljs-string\">'isReady'</span>).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">err</span>) =></span> {\n      <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Application failed to start'</span>, err)\n      <span class=\"hljs-keyword\">this</span>.stop()\n      process.exit(<span class=\"hljs-number\">1</span>)\n    })\n  }\n\n  <span class=\"hljs-comment\">// simple RPC call</span>\n  <span class=\"hljs-comment\">// to use: driver.rpc('method', 1, 2, 3).then(...)</span>\n  <span class=\"hljs-keyword\">async</span> rpc (cmd, ...args) {\n    <span class=\"hljs-comment\">// send rpc request</span>\n    <span class=\"hljs-keyword\">const</span> msgId = <span class=\"hljs-keyword\">this</span>.rpcCalls.length\n    <span class=\"hljs-keyword\">this</span>.process.send({ msgId, cmd, args })\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\">(<span class=\"hljs-params\">resolve, reject</span>) =></span> <span class=\"hljs-keyword\">this</span>.rpcCalls.push({ resolve, reject }))\n  }\n\n  stop () {\n    <span class=\"hljs-keyword\">this</span>.process.kill()\n  }\n}\n</code></pre>\n<p>In the app, you'd need to write a simple handler for the RPC calls:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">if</span> (process.env.APP_TEST_DRIVER) {\n  process.on(<span class=\"hljs-string\">'message'</span>, onMessage)\n}\n\n<span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">onMessage</span> (<span class=\"hljs-params\">{ msgId, cmd, args }</span>) </span>{\n  <span class=\"hljs-keyword\">let</span> method = METHODS[cmd]\n  <span class=\"hljs-keyword\">if</span> (!method) method = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Invalid method: '</span> + cmd)\n  <span class=\"hljs-keyword\">try</span> {\n    <span class=\"hljs-keyword\">const</span> resolve = <span class=\"hljs-keyword\">await</span> method(...args)\n    process.send({ msgId, resolve })\n  } <span class=\"hljs-keyword\">catch</span> (err) {\n    <span class=\"hljs-keyword\">const</span> reject = {\n      <span class=\"hljs-attr\">message</span>: err.message,\n      <span class=\"hljs-attr\">stack</span>: err.stack,\n      <span class=\"hljs-attr\">name</span>: err.name\n    }\n    process.send({ msgId, reject })\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> METHODS = {\n  isReady () {\n    <span class=\"hljs-comment\">// do any setup needed</span>\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-comment\">// define your RPC-able methods here</span>\n}\n</code></pre>\n<p>Then, in your test suite, you can use your test-driver as follows:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> test = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'ava'</span>)\n<span class=\"hljs-keyword\">const</span> electronPath = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> app = <span class=\"hljs-keyword\">new</span> TestDriver({\n  <span class=\"hljs-attr\">path</span>: electronPath,\n  <span class=\"hljs-attr\">args</span>: [<span class=\"hljs-string\">'./app'</span>],\n  <span class=\"hljs-attr\">env</span>: {\n    <span class=\"hljs-attr\">NODE_ENV</span>: <span class=\"hljs-string\">'test'</span>\n  }\n})\ntest.before(<span class=\"hljs-keyword\">async</span> t => {\n  <span class=\"hljs-keyword\">await</span> app.isReady\n})\ntest.after.always(<span class=\"hljs-string\">'cleanup'</span>, <span class=\"hljs-keyword\">async</span> t => {\n  <span class=\"hljs-keyword\">await</span> app.stop()\n})\n</code></pre>",
      "title": "Automatizando Teste com Driver Personalizado",
      "description": ""
    },
    "/docs/development/azure-vm-setup": {
      "locale": "pt-BR",
      "slug": "azure-vm-setup",
      "href": "/docs/development/azure-vm-setup",
      "crowdinFileId": "256129",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/azure-vm-setup.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"atualizando-um-appveyor-azure-image\"><a href=\"#atualizando-um-appveyor-azure-image\">Atualizando um Appveyor Azure Image</a></h1>\n<p>Electron Cl no Windows usa o AppVeyor, que por sua vez usa imagens do Azure Vm para executar.  Occasionally, these VM images need to be updated due to changes in Chromium requirements.  In order to update you will need <a href=\"https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6\">PowerShell</a> and the <a href=\"https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-1.8.0&#x26;viewFallbackFrom=azurermps-6.13.0\">Azure PowerShell module</a>.</p>\n<p>Occasionally we need to update these images owing to changes in Chromium or other miscellaneous build requirement changes.</p>\n<p>Example Use Case:\n* We need <code>VS15.9</code> and we have <code>VS15.7</code> installed; this would require us to update an Azure image.</p>\n<ol>\n<li>\n<p>Identify the image you wish to modify.</p>\n<ul>\n<li>In <a href=\"https://github.com/electron/electron/blob/main/appveyor.yml\">appveyor.yml</a>, the image is identified by the property <em>image</em>.<ul>\n<li>The names used correspond to the <em>\"images\"</em> defined for a build cloud, eg the <a href=\"https://windows-ci.electronjs.org/build-clouds/8\">libcc-20 cloud</a>.</li>\n</ul></li>\n<li>Find the image you wish to modify in the build cloud and make note of the <strong>VHD Blob Path</strong> for that image, which is the value for that corresponding key.<ul>\n<li>You will need this URI path to copy into a new image.</li>\n</ul></li>\n<li>You will also need the storage account name which is labeled in AppVeyor as the <strong>Disk Storage Account Name</strong></li>\n</ul>\n</li>\n<li>\n<p>Get the Azure storage account key</p>\n<ul>\n<li>Log into Azure using credentials stored in LastPass (under Azure Enterprise) and then find the storage account corresponding to the name found in AppVeyor.<ul>\n<li>Example, for <code>appveyorlibccbuilds</code> <strong>Disk Storage Account Name</strong> you'd look for <code>appveyorlibccbuilds</code> in the list of storage accounts @ Home &#x3C; Storage Accounts<ul>\n<li>Click into it and look for <code>Access Keys</code>, and then you can use any of the keys present in the list.</li>\n</ul></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Get the full virtual machine image URI from Azure</p>\n<ul>\n<li>Navigate to Home &#x3C; Storage Accounts &#x3C; <code>$ACCT_NAME</code> &#x3C; Blobs &#x3C; Images<ul>\n<li>In the following list, look for the VHD path name you got from Appveyor and then click on it.<ul>\n<li>Copy the whole URL from the top of the subsequent window.</li>\n</ul></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Copy the image using the <a href=\"https://github.com/appveyor/ci/blob/master/scripts/enterprise/copy-master-image-azure.ps1\">Copy Master Image PowerShell script</a>.</p>\n<ul>\n<li>It is essential to copy the VM because if you spin up a VM against an image that image cannot at the same time be used by AppVeyor.</li>\n<li>Use the storage account name, key, and URI obtained from Azure to run this script.<ul>\n<li>See Step 3 for URI &#x26; when prompted, press enter to use same storage account as destination.</li>\n<li>Use default destination container name <code>(images)</code></li>\n<li>Also, when naming the copy, use a name that indicates what the new image will contain (if that has changed) and date stamp.<ul>\n<li>Ex. <code>libcc-20core-vs2017-15.9-2019-04-15.vhd</code></li>\n</ul></li>\n</ul></li>\n<li>Go into Azure and get the URI for the newly created image as described in a previous step</li>\n</ul>\n</li>\n<li>\n<p>Spin up a new VM using the <a href=\"https://github.com/appveyor/ci/blob/master/scripts/enterprise/create_master_vm_from_vhd.ps1\">Create Master VM from VHD PowerShell</a>.</p>\n<ul>\n<li>From PowerShell, execute <code>ps1</code> file with <code>./create_master_vm_from_vhd.ps1</code></li>\n<li>You will need the credential information available in the AppVeyor build cloud definition.<ul>\n<li>Isto inclui:<ul>\n<li>ID do cliente</li>\n<li>Client Secret</li>\n<li>Tenant ID</li>\n<li>Subscription ID</li>\n<li>Resource Group</li>\n<li>Virtual Network</li>\n</ul></li>\n</ul></li>\n<li>You will also need to specify<ul>\n<li>Master VM name - just a unique name to identify the temporary VM</li>\n<li>Master VM size - use <code>Standard_F32s_v2</code></li>\n<li>Master VHD URI - use URI obtained @ end of previous step</li>\n<li>Location use <code>East US</code></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Log back into Azure and find the VM you just created in Home &#x3C; Virtual Machines &#x3C; <code>$YOUR_NEW_VM</code></p>\n<ul>\n<li>You can download a RDP (Remote Desktop) file to access the VM.</li>\n</ul>\n</li>\n<li>\n<p>Using Microsoft Remote Desktop, click <code>Connect</code> to connect to the VM.</p>\n<ul>\n<li>Credentials for logging into the VM are found in LastPass under the <code>AppVeyor Enterprise master VM</code> credentials.</li>\n</ul>\n</li>\n<li>\n<p>Modify the VM as required.</p>\n</li>\n<li>\n<p>Shut down the VM and then delete it in Azure.</p>\n</li>\n<li>\n<p>Add the new image to the Appveyor Cloud settings or modify an existing image to point to the new VHD.</p>\n</li>\n</ol>",
      "title": "Atualizando um Appveyor Azure Image",
      "description": ""
    },
    "/docs/api/structures/bluetooth-device": {
      "locale": "pt-BR",
      "slug": "bluetooth-device",
      "href": "/docs/api/structures/bluetooth-device",
      "crowdinFileId": "256411",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/bluetooth-device.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"bluetoothdevice-object\"><a href=\"#bluetoothdevice-object\">BluetoothDevice Object</a></h1>\n<ul>\n<li><code>deviceName</code> String</li>\n<li><code>deviceId</code> String</li>\n</ul>",
      "title": "BluetoothDevice Object",
      "description": ""
    },
    "/docs/tutorial/boilerplates-and-clis": {
      "locale": "pt-BR",
      "slug": "boilerplates-and-clis",
      "href": "/docs/tutorial/boilerplates-and-clis",
      "crowdinFileId": "256181",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/boilerplates-and-clis.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"boilerplates-e-clis\"><a href=\"#boilerplates-e-clis\">Boilerplates e CLIs</a></h1>\n<p>Electron development is unopinionated - there is no \"one true way\" to develop, build, package, or release an Electron application. Additional features for Electron, both for build- and run-time, can usually be found on <a href=\"https://www.npmjs.com/search?q=electron\">npm</a> in individual packages, allowing developers to build both the app and build pipeline they need.</p>\n<p>That level of modularity and extendability ensures that all developers working with Electron, both big and small in team-size, are never restricted in what they can or cannot do at any time during their development lifecycle. However, for many developers, one of the community-driven boilerplates or command line tools might make it dramatically easier to compile, package, and release an app.</p>\n<h2 id=\"boilerplate-vs-cli\"><a href=\"#boilerplate-vs-cli\">Boilerplate vs CLI</a></h2>\n<p>A boilerplate is only a starting point - a canvas, so to speak - from which you build your application. They usually come in the form of a repository you can clone and customize to your heart's content.</p>\n<p>A command line tool on the other hand continues to support you throughout the development and release. They are more helpful and supportive but enforce guidelines on how your code should be structured and built. <em>Especially for beginners, using a command line tool is likely to be helpful</em>.</p>\n<h2 id=\"electron-forge\"><a href=\"#electron-forge\">electron-forge</a></h2>\n<p>A \"complete tool for building modern Electron applications\". Electron Forge unifies the existing (and well maintained) build tools for Electron development into a cohesive package so that anyone can jump right in to Electron development.</p>\n<p>Forge comes with <a href=\"https://electronforge.io/templates\">a ready-to-use template</a> using Webpack as a bundler. It includes an example typescript configuration and provides two configuration files to enable easy customization. It uses the same core modules used by the greater Electron community (like <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>) – changes made by Electron maintainers (like Slack) benefit Forge's users, too.</p>\n<p>You can find more information and documentation on <a href=\"https://electronforge.io/\">electronforge.io</a>.</p>\n<h2 id=\"electron-builder\"><a href=\"#electron-builder\">electron-builder</a></h2>\n<p>A \"complete solution to package and build a ready-for-distribution Electron app\" that focuses on an integrated experience. <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> adds one single dependency focused on simplicity and manages all further requirements internally.</p>\n<p><code>electron-builder</code> replaces features and modules used by the Electron maintainers (such as the auto-updater) with custom ones. They are generally tighter integrated but will have less in common with popular Electron apps like Atom, Visual Studio Code, or Slack.</p>\n<p>You can find more information and documentation in <a href=\"https://github.com/electron-userland/electron-builder\">the repository</a>.</p>\n<h2 id=\"electron-react-boilerplate\"><a href=\"#electron-react-boilerplate\">electron-react-boilerplate</a></h2>\n<p>If you don't want any tools but only a solid boilerplate to build from, CT Lin's <a href=\"https://github.com/chentsulin/electron-react-boilerplate\"><code>electron-react-boilerplate</code></a> might be worth a look. It's quite popular in the community and uses <code>electron-builder</code> internally.</p>\n<h2 id=\"outras-ferramentas-e-boilerplates\"><a href=\"#outras-ferramentas-e-boilerplates\">Outras Ferramentas e Boilerplates</a></h2>\n<p>The <a href=\"https://github.com/sindresorhus/awesome-electron#boilerplates\">\"Awesome Electron\" list</a> contains more tools and boilerplates to choose from. If you find the length of the list intimidating, don't forget that adding tools as you go along is a valid approach, too.</p>",
      "title": "Boilerplates e CLIs",
      "description": ""
    },
    "/docs/breaking-changes": {
      "locale": "pt-BR",
      "slug": "breaking-changes",
      "href": "/docs/breaking-changes",
      "crowdinFileId": "256117",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/breaking-changes.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"breaking-changes\"><a href=\"#breaking-changes\">Breaking Changes</a></h1>\n<p>Breaking changes will be documented here, and deprecation warnings added to JS code where possible, at least <a href=\"/docs/tutorial/electron-versioning#semver\">one major version</a> before the change is made.</p>\n<h3 id=\"types-of-breaking-changes\"><a href=\"#types-of-breaking-changes\">Types of Breaking Changes</a></h3>\n<p>This document uses the following convention to categorize breaking changes:</p>\n<ul>\n<li><strong>API Changed:</strong> An API was changed in such a way that code that has not been updated is guaranteed to throw an exception.</li>\n<li><strong>Behavior Changed:</strong> The behavior of Electron has changed, but not in such a way that an exception will necessarily be thrown.</li>\n<li><strong>Default Changed:</strong> Code depending on the old default may break, not necessarily throwing an exception. The old behavior can be restored by explicitly specifying the value.</li>\n<li><strong>Deprecated:</strong> An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.</li>\n<li><strong>Removed:</strong> An API or feature was removed, and is no longer supported by Electron.</li>\n</ul>\n<h2 id=\"alterações-planejadas-na-api-140\"><a href=\"#alterações-planejadas-na-api-140\">Alterações planejadas na API (14.0)</a></h2>\n<h3 id=\"removed-remote-module\"><a href=\"#removed-remote-module\">Removed: <code>remote</code> module</a></h3>\n<p>The <code>remote</code> module was deprecated in Electron 12, and will be removed in Electron 14. It is replaced by the <a href=\"https://github.com/electron/remote\"><code>@electron/remote</code></a> module.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 12:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Replace with:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote'</span>)\n\n<span class=\"hljs-comment\">// In the main process:</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote/main'</span>).initialize()\n</code></pre>\n<h3 id=\"removido-appallowrendererprocessreuse\"><a href=\"#removido-appallowrendererprocessreuse\">Removido: <code>app.allowRendererProcessReuse</code></a></h3>\n<p>The <code>app.allowRendererProcessReuse</code> property will be removed as part of our plan to more closely align with Chromium's process model for security, performance and maintainability.</p>\n<p>For more detailed information see <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"removed-browser-window-affinity\"><a href=\"#removed-browser-window-affinity\">Removed: Browser Window Affinity</a></h3>\n<p>The <code>affinity</code> option when constructing a new <code>BrowserWindow</code> will be removed as part of our plan to more closely align with Chromium's process model for security, performance and maintainability.</p>\n<p>For more detailed information see <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"api-changed-windowopen\"><a href=\"#api-changed-windowopen\">API Changed: <code>window.open()</code></a></h3>\n<p>The optional parameter <code>frameName</code> will no longer set the title of the window. This now follows the specification described by the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters\">native documentation</a> under the corresponding parameter <code>windowName</code>.</p>\n<p>If you were using this parameter to set the title of a window, you can instead use <a href=\"/docs/api/browser-window#winsettitletitle\">win.setTitle(title)</a>.</p>\n<h3 id=\"removido-worldsafeexecutejavascript\"><a href=\"#removido-worldsafeexecutejavascript\">Removido: <code>worldSafeExecuteJavaScript</code></a></h3>\n<p>No Electron 14, <code>worldSafeExecuteJavaScript</code> será removido.  There is no alternative, please ensure your code works with this property enabled.  It has been enabled by default since Electron\n12.</p>\n<p>You will be affected by this change if you use either <code>webFrame.executeJavaScript</code> or <code>webFrame.executeJavaScriptInIsolatedWorld</code>. You will need to ensure that values returned by either of those methods are supported by the <a href=\"/docs/api/context-bridge#parameter--error--return-type-support\">Context Bridge API</a> as these methods use the same value passing semantics.</p>\n<h3 id=\"default-changed-nativewindowopen-defaults-to-true\"><a href=\"#default-changed-nativewindowopen-defaults-to-true\">Default Changed: <code>nativeWindowOpen</code> defaults to <code>true</code></a></h3>\n<p>Prior to Electron 14, <code>window.open</code> was by default shimmed to use <code>BrowserWindowProxy</code>. This meant that <code>window.open('about:blank')</code> did not work to open synchronously scriptable child windows, among other incompatibilities. <code>nativeWindowOpen</code> is no longer experimental, and is now the default.</p>\n<p>See the documentation for <a href=\"/docs/api/window-open\">window.open in Electron</a> for more details.</p>\n<h3 id=\"removed-browserwindowconstructoroptions-inheriting-from-parent-windows\"><a href=\"#removed-browserwindowconstructoroptions-inheriting-from-parent-windows\">Removed: BrowserWindowConstructorOptions inheriting from parent windows</a></h3>\n<p>Prior to Electron 14, windows opened with <code>window.open</code> would inherit BrowserWindow constructor options such as <code>transparent</code> and <code>resizable</code> from their parent window. Beginning with Electron 14, this behavior is removed, and windows will not inherit any BrowserWindow constructor options from their parents.</p>\n<p>Instead, explicitly set options for the new window with <code>setWindowOpenHandler</code>:</p>\n<pre><code class=\"hljs language-js\">webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n  <span class=\"hljs-keyword\">return</span> {\n    <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span>,\n    <span class=\"hljs-attr\">overrideBrowserWindowOptions</span>: {\n      <span class=\"hljs-comment\">// ...</span>\n    }\n  }\n})\n</code></pre>\n<h3 id=\"removido-additionalfeatures\"><a href=\"#removido-additionalfeatures\">Removido: <code>additionalFeatures</code></a></h3>\n<p>The deprecated <code>additionalFeatures</code> property in the <code>new-window</code> and <code>did-create-window</code> events of WebContents has been removed. Since <code>new-window</code> uses positional arguments, the argument is still present, but will always be the empty array <code>[]</code>. (Though note, the <code>new-window</code> event itself is deprecated, and is replaced by <code>setWindowOpenHandler</code>.) Bare keys in window features will now present as keys with the value <code>true</code> in the options object.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 14</span>\n<span class=\"hljs-comment\">// Triggered by window.open('...', '', 'my-key')</span>\nwebContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (<span class=\"hljs-built_in\">window</span>, details) => {\n  <span class=\"hljs-keyword\">if</span> (details.additionalFeatures.includes(<span class=\"hljs-string\">'my-key'</span>)) {\n    <span class=\"hljs-comment\">// ...</span>\n  }\n})\n\n<span class=\"hljs-comment\">// Replace with</span>\nwebContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (<span class=\"hljs-built_in\">window</span>, details) => {\n  <span class=\"hljs-keyword\">if</span> (details.options[<span class=\"hljs-string\">'my-key'</span>]) {\n    <span class=\"hljs-comment\">// ...</span>\n  }\n})\n</code></pre>\n<h2 id=\"alterações-planejadas-na-api-130\"><a href=\"#alterações-planejadas-na-api-130\">Alterações planejadas na API (13.0)</a></h2>\n<h3 id=\"api-changed-sessionsetpermissioncheckhandlerhandler\"><a href=\"#api-changed-sessionsetpermissioncheckhandlerhandler\">API Changed: <code>session.setPermissionCheckHandler(handler)</code></a></h3>\n<p>The <code>handler</code> methods first parameter was previously always a <code>webContents</code>, it can now sometimes be <code>null</code>.  You should use the <code>requestingOrigin</code>, <code>embeddingOrigin</code> and <code>securityOrigin</code> properties to respond to the permission check correctly.  As the <code>webContents</code> can be <code>null</code> it can no longer be relied on.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Old code</span>\nsession.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (webContents.getURL().startsWith(<span class=\"hljs-string\">'https://google.com/'</span>) &#x26;&#x26; permission === <span class=\"hljs-string\">'notification'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n\n<span class=\"hljs-comment\">// Replace with</span>\nsession.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(requestingOrigin).hostname === <span class=\"hljs-string\">'google.com'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notification'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n</code></pre>\n<h3 id=\"removido-shellmoveitemtotrash\"><a href=\"#removido-shellmoveitemtotrash\">Removido: <code>shell.moveItemToTrash()</code></a></h3>\n<p>The deprecated synchronous <code>shell.moveItemToTrash()</code> API has been removed. Use the asynchronous <code>shell.trashItem()</code> instead.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 13</span>\nshell.moveItemToTrash(path)\n<span class=\"hljs-comment\">// Replace with</span>\nshell.trashItem(path).then(<span class=\"hljs-comment\">/* ... */</span>)\n</code></pre>\n<h3 id=\"removed-browserwindow-extension-apis\"><a href=\"#removed-browserwindow-extension-apis\">Removed: <code>BrowserWindow</code> extension APIs</a></h3>\n<p>The deprecated extension APIs have been removed:</p>\n<ul>\n<li><code>BrowserWindow.addExtension(path)</code></li>\n<li><code>BrowserWindow.addDevToolsExtension(path)</code></li>\n<li><code>BrowserWindow.removeExtension(name)</code></li>\n<li><code>BrowserWindow.removeDevToolsExtension(name)</code></li>\n<li><code>BrowserWindow.getExtensions()</code></li>\n<li><code>BrowserWindow.getDevToolsExtensions()</code></li>\n</ul>\n<p>Use the session APIs instead:</p>\n<ul>\n<li><code>ses.loadExtension(path)</code></li>\n<li><code>ses.removeExtension(extension_id)</code></li>\n<li><code>ses.getAllExtensions()</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 13</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 13</span>\nBrowserWindow.removeExtension(name)\nBrowserWindow.removeDevToolsExtension(name)\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.removeExtension(extension_id)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 13</span>\nBrowserWindow.getExtensions()\nBrowserWindow.getDevToolsExtensions()\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.getAllExtensions()\n</code></pre>\n<h3 id=\"removed-methods-in-systempreferences\"><a href=\"#removed-methods-in-systempreferences\">Removed: methods in <code>systemPreferences</code></a></h3>\n<p>The following <code>systemPreferences</code> methods have been deprecated:</p>\n<ul>\n<li><code>systemPreferences.isDarkMode()</code></li>\n<li><code>systemPreferences.isInvertedColorScheme()</code></li>\n<li><code>systemPreferences.isHighContrastColorScheme()</code></li>\n</ul>\n<p>Use the following <code>nativeTheme</code> properties instead:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code></li>\n<li><code>nativeTheme.shouldUseInvertedColorScheme</code></li>\n<li><code>nativeTheme.shouldUseHighContrastColors</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 13</span>\nsystemPreferences.isDarkMode()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseDarkColors\n\n<span class=\"hljs-comment\">// Removed in Electron 13</span>\nsystemPreferences.isInvertedColorScheme()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseInvertedColorScheme\n\n<span class=\"hljs-comment\">// Removed in Electron 13</span>\nsystemPreferences.isHighContrastColorScheme()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseHighContrastColors\n</code></pre>\n<h3 id=\"deprecated-webcontents-new-window-event\"><a href=\"#deprecated-webcontents-new-window-event\">Deprecated: WebContents <code>new-window</code> event</a></h3>\n<p>The <code>new-window</code> event of WebContents has been deprecated. It is replaced by <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler()</code></a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 13</span>\nwebContents.on(<span class=\"hljs-string\">'new-window'</span>, (event) => {\n  event.preventDefault()\n})\n\n<span class=\"hljs-comment\">// Replace with</span>\nwebContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n</code></pre>\n<h2 id=\"alterações-planejadas-na-api-120\"><a href=\"#alterações-planejadas-na-api-120\">Alterações planejadas na API (12.0)</a></h2>\n<h3 id=\"removed-pepper-flash-support\"><a href=\"#removed-pepper-flash-support\">Removed: Pepper Flash support</a></h3>\n<p>Chromium has removed support for Flash, and so we must follow suit. See Chromium's <a href=\"https://www.chromium.org/flash-roadmap\">Flash Roadmap</a> for more details.</p>\n<h3 id=\"default-changed-worldsafeexecutejavascript-defaults-to-true\"><a href=\"#default-changed-worldsafeexecutejavascript-defaults-to-true\">Default Changed: <code>worldSafeExecuteJavaScript</code> defaults to <code>true</code></a></h3>\n<p>In Electron 12, <code>worldSafeExecuteJavaScript</code> will be enabled by default.  To restore the previous behavior, <code>worldSafeExecuteJavaScript: false</code> must be specified in WebPreferences. Please note that setting this option to <code>false</code> is <strong>insecure</strong>.</p>\n<p>This option will be removed in Electron 14 so please migrate your code to support the default value.</p>\n<h3 id=\"default-changed-contextisolation-defaults-to-true\"><a href=\"#default-changed-contextisolation-defaults-to-true\">Default Changed: <code>contextIsolation</code> defaults to <code>true</code></a></h3>\n<p>In Electron 12, <code>contextIsolation</code> will be enabled by default.  To restore the previous behavior, <code>contextIsolation: false</code> must be specified in WebPreferences.</p>\n<p>We <a href=\"/docs/tutorial/security#3-enable-context-isolation-for-remote-content\">recommend having contextIsolation enabled</a> for the security of your application.</p>\n<p>Another implication is that <code>require()</code> cannot be used in the renderer process unless <code>nodeIntegration</code> is <code>true</code> and <code>contextIsolation</code> is <code>false</code>.</p>\n<p>For more details see: <a href=\"https://github.com/electron/electron/issues/23506\">https://github.com/electron/electron/issues/23506</a></p>\n<h3 id=\"removido-crashreportergetcrashesdirectory\"><a href=\"#removido-crashreportergetcrashesdirectory\">Removido: <code>crashReporter.getCrashesDirectory()</code></a></h3>\n<p>O método <code>crashReporter.getCrashesDirectory</code> foi removido. Usage should be replaced by <code>app.getPath('crashDumps')</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removido no Electron 12</span>\ncrashReporter.getCrashesDirectory()\n<span class=\"hljs-comment\">// Substitua por</span>\napp.getPath(<span class=\"hljs-string\">'crashDumps'</span>)\n</code></pre>\n<h3 id=\"removed-crashreporter-methods-in-the-renderer-process\"><a href=\"#removed-crashreporter-methods-in-the-renderer-process\">Removed: <code>crashReporter</code> methods in the renderer process</a></h3>\n<p>The following <code>crashReporter</code> methods are no longer available in the renderer process:</p>\n<ul>\n<li><code>crashReporter.start</code></li>\n<li><code>crashReporter.getLastCrashReport</code></li>\n<li><code>crashReporter.getUploadedReports</code></li>\n<li><code>crashReporter.getUploadToServer</code></li>\n<li><code>crashReporter.setUploadToServer</code></li>\n<li><code>crashReporter.getCrashesDirectory</code></li>\n</ul>\n<p>They should be called only from the main process.</p>\n<p>See <a href=\"https://github.com/electron/electron/pull/23265\">#23265</a> for more details.</p>\n<h3 id=\"default-changed-crashreporterstart-compress-true-\"><a href=\"#default-changed-crashreporterstart-compress-true-\">Default Changed: <code>crashReporter.start({ compress: true })</code></a></h3>\n<p>The default value of the <code>compress</code> option to <code>crashReporter.start</code> has changed from <code>false</code> to <code>true</code>. This means that crash dumps will be uploaded to the crash ingestion server with the <code>Content-Encoding: gzip</code> header, and the body will be compressed.</p>\n<p>If your crash ingestion server does not support compressed payloads, you can turn off compression by specifying <code>{ compress: false }</code> in the crash reporter options.</p>\n<h3 id=\"deprecated-remote-module\"><a href=\"#deprecated-remote-module\">Deprecated: <code>remote</code> module</a></h3>\n<p>The <code>remote</code> module is deprecated in Electron 12, and will be removed in Electron 14. It is replaced by the <a href=\"https://github.com/electron/remote\"><code>@electron/remote</code></a> module.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 12:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Replace with:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote'</span>)\n\n<span class=\"hljs-comment\">// In the main process:</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote/main'</span>).initialize()\n</code></pre>\n<h3 id=\"deprecated-shellmoveitemtotrash\"><a href=\"#deprecated-shellmoveitemtotrash\">Deprecated: <code>shell.moveItemToTrash()</code></a></h3>\n<p>The synchronous <code>shell.moveItemToTrash()</code> has been replaced by the new, asynchronous <code>shell.trashItem()</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Descontinuado no Electron 12</span>\nshell.moveItemToTrash(path)\n<span class=\"hljs-comment\">// Substitua por</span>\nshell.trashItem(path).then(<span class=\"hljs-comment\">/* ... */</span>)\n</code></pre>\n<h2 id=\"alterações-planejadas-na-api-110\"><a href=\"#alterações-planejadas-na-api-110\">Alterações planejadas na API (11.0)</a></h2>\n<h3 id=\"removed-browserviewdestroy-fromid-fromwebcontents-getallviews-and-id-property-of-browserview\"><a href=\"#removed-browserviewdestroy-fromid-fromwebcontents-getallviews-and-id-property-of-browserview\">Removed: <code>BrowserView.{destroy, fromId, fromWebContents, getAllViews}</code> and <code>id</code> property of <code>BrowserView</code></a></h3>\n<p>The experimental APIs <code>BrowserView.{destroy, fromId, fromWebContents, getAllViews}</code> have now been removed. Additionally, the <code>id</code> property of <code>BrowserView</code> has also been removed.</p>\n<p>For more detailed information, see <a href=\"https://github.com/electron/electron/pull/23578\">#23578</a>.</p>\n<h2 id=\"alterações-planejadas-na-api-100\"><a href=\"#alterações-planejadas-na-api-100\">Alterações planejadas na API (10.0)</a></h2>\n<h3 id=\"deprecated-companyname-argument-to-crashreporterstart\"><a href=\"#deprecated-companyname-argument-to-crashreporterstart\">Deprecated: <code>companyName</code> argument to <code>crashReporter.start()</code></a></h3>\n<p>The <code>companyName</code> argument to <code>crashReporter.start()</code>, which was previously required, is now optional, and further, is deprecated. To get the same behavior in a non-deprecated way, you can pass a <code>companyName</code> value in <code>globalExtra</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 10</span>\ncrashReporter.start({ <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Umbrella Corporation'</span> })\n<span class=\"hljs-comment\">// Replace with</span>\ncrashReporter.start({ <span class=\"hljs-attr\">globalExtra</span>: { <span class=\"hljs-attr\">_companyName</span>: <span class=\"hljs-string\">'Umbrella Corporation'</span> } })\n</code></pre>\n<h3 id=\"deprecated-crashreportergetcrashesdirectory\"><a href=\"#deprecated-crashreportergetcrashesdirectory\">Deprecated: <code>crashReporter.getCrashesDirectory()</code></a></h3>\n<p>The <code>crashReporter.getCrashesDirectory</code> method has been deprecated. Usage should be replaced by <code>app.getPath('crashDumps')</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 10</span>\ncrashReporter.getCrashesDirectory()\n<span class=\"hljs-comment\">// Replace with</span>\napp.getPath(<span class=\"hljs-string\">'crashDumps'</span>)\n</code></pre>\n<h3 id=\"deprecated-crashreporter-methods-in-the-renderer-process\"><a href=\"#deprecated-crashreporter-methods-in-the-renderer-process\">Deprecated: <code>crashReporter</code> methods in the renderer process</a></h3>\n<p>Calling the following <code>crashReporter</code> methods from the renderer process is deprecated:</p>\n<ul>\n<li><code>crashReporter.start</code></li>\n<li><code>crashReporter.getLastCrashReport</code></li>\n<li><code>crashReporter.getUploadedReports</code></li>\n<li><code>crashReporter.getUploadToServer</code></li>\n<li><code>crashReporter.setUploadToServer</code></li>\n<li><code>crashReporter.getCrashesDirectory</code></li>\n</ul>\n<p>The only non-deprecated methods remaining in the <code>crashReporter</code> module in the renderer are <code>addExtraParameter</code>, <code>removeExtraParameter</code> and <code>getParameters</code>.</p>\n<p>All above methods remain non-deprecated when called from the main process.</p>\n<p>See <a href=\"https://github.com/electron/electron/pull/23265\">#23265</a> for more details.</p>\n<h3 id=\"deprecated-crashreporterstart-compress-false-\"><a href=\"#deprecated-crashreporterstart-compress-false-\">Deprecated: <code>crashReporter.start({ compress: false })</code></a></h3>\n<p>Setting <code>{ compress: false }</code> in <code>crashReporter.start</code> is deprecated. Nearly all crash ingestion servers support gzip compression. This option will be removed in a future version of Electron.</p>\n<h3 id=\"default-changed-enableremotemodule-defaults-to-false\"><a href=\"#default-changed-enableremotemodule-defaults-to-false\">Default Changed: <code>enableRemoteModule</code> defaults to <code>false</code></a></h3>\n<p>In Electron 9, using the remote module without explicitly enabling it via the <code>enableRemoteModule</code> WebPreferences option began emitting a warning. In Electron 10, the remote module is now disabled by default. To use the remote module, <code>enableRemoteModule: true</code> must be specified in WebPreferences:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> w = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">enableRemoteModule</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<p>We <a href=\"https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31\">recommend moving away from the remote module</a>.</p>\n<h3 id=\"protocolunregisterprotocol\"><a href=\"#protocolunregisterprotocol\"><code>protocol.unregisterProtocol</code></a></h3>\n<h3 id=\"protocoluninterceptprotocol\"><a href=\"#protocoluninterceptprotocol\"><code>protocol.uninterceptProtocol</code></a></h3>\n<p>The APIs are now synchronous and the optional callback is no longer needed.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Deprecated</span>\nprotocol.unregisterProtocol(scheme, () => { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nprotocol.unregisterProtocol(scheme)\n</code></pre>\n<h3 id=\"protocolregisterfileprotocol\"><a href=\"#protocolregisterfileprotocol\"><code>protocol.registerFileProtocol</code></a></h3>\n<h3 id=\"protocolregisterbufferprotocol\"><a href=\"#protocolregisterbufferprotocol\"><code>protocol.registerBufferProtocol</code></a></h3>\n<h3 id=\"protocolregisterstringprotocol\"><a href=\"#protocolregisterstringprotocol\"><code>protocol.registerStringProtocol</code></a></h3>\n<h3 id=\"protocolregisterhttpprotocol\"><a href=\"#protocolregisterhttpprotocol\"><code>protocol.registerHttpProtocol</code></a></h3>\n<h3 id=\"protocolregisterstreamprotocol\"><a href=\"#protocolregisterstreamprotocol\"><code>protocol.registerStreamProtocol</code></a></h3>\n<h3 id=\"protocolinterceptfileprotocol\"><a href=\"#protocolinterceptfileprotocol\"><code>protocol.interceptFileProtocol</code></a></h3>\n<h3 id=\"protocolinterceptstringprotocol\"><a href=\"#protocolinterceptstringprotocol\"><code>protocol.interceptStringProtocol</code></a></h3>\n<h3 id=\"protocolinterceptbufferprotocol\"><a href=\"#protocolinterceptbufferprotocol\"><code>protocol.interceptBufferProtocol</code></a></h3>\n<h3 id=\"protocolintercepthttpprotocol\"><a href=\"#protocolintercepthttpprotocol\"><code>protocol.interceptHttpProtocol</code></a></h3>\n<h3 id=\"protocolinterceptstreamprotocol\"><a href=\"#protocolinterceptstreamprotocol\"><code>protocol.interceptStreamProtocol</code></a></h3>\n<p>The APIs are now synchronous and the optional callback is no longer needed.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Deprecated</span>\nprotocol.registerFileProtocol(scheme, handler, () => { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nprotocol.registerFileProtocol(scheme, handler)\n</code></pre>\n<p>The registered or intercepted protocol does not have effect on current page until navigation happens.</p>\n<h3 id=\"protocolisprotocolhandled\"><a href=\"#protocolisprotocolhandled\"><code>protocol.isProtocolHandled</code></a></h3>\n<p>This API is deprecated and users should use <code>protocol.isProtocolRegistered</code> and <code>protocol.isProtocolIntercepted</code> instead.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Deprecated</span>\nprotocol.isProtocolHandled(scheme).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> isRegistered = protocol.isProtocolRegistered(scheme)\n<span class=\"hljs-keyword\">const</span> isIntercepted = protocol.isProtocolIntercepted(scheme)\n</code></pre>\n<h2 id=\"alterações-planejadas-na-api-90\"><a href=\"#alterações-planejadas-na-api-90\">Alterações planejadas na API (9.0)</a></h2>\n<h3 id=\"default-changed-loading-non-context-aware-native-modules-in-the-renderer-process-is-disabled-by-default\"><a href=\"#default-changed-loading-non-context-aware-native-modules-in-the-renderer-process-is-disabled-by-default\">Default Changed: Loading non-context-aware native modules in the renderer process is disabled by default</a></h3>\n<p>As of Electron 9 we do not allow loading of non-context-aware native modules in the renderer process.  This is to improve security, performance and maintainability of Electron as a project.</p>\n<p>If this impacts you, you can temporarily set <code>app.allowRendererProcessReuse</code> to <code>false</code> to revert to the old behavior.  This flag will only be an option until Electron 11 so you should plan to update your native modules to be context aware.</p>\n<p>For more detailed information see <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"deprecated-browserwindow-extension-apis\"><a href=\"#deprecated-browserwindow-extension-apis\">Deprecated: <code>BrowserWindow</code> extension APIs</a></h3>\n<p>The following extension APIs have been deprecated:</p>\n<ul>\n<li><code>BrowserWindow.addExtension(path)</code></li>\n<li><code>BrowserWindow.addDevToolsExtension(path)</code></li>\n<li><code>BrowserWindow.removeExtension(name)</code></li>\n<li><code>BrowserWindow.removeDevToolsExtension(name)</code></li>\n<li><code>BrowserWindow.getExtensions()</code></li>\n<li><code>BrowserWindow.getDevToolsExtensions()</code></li>\n</ul>\n<p>Use the session APIs instead:</p>\n<ul>\n<li><code>ses.loadExtension(path)</code></li>\n<li><code>ses.removeExtension(extension_id)</code></li>\n<li><code>ses.getAllExtensions()</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 9</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 9</span>\nBrowserWindow.removeExtension(name)\nBrowserWindow.removeDevToolsExtension(name)\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.removeExtension(extension_id)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 9</span>\nBrowserWindow.getExtensions()\nBrowserWindow.getDevToolsExtensions()\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.getAllExtensions()\n</code></pre>\n<h3 id=\"removed-webviewgetwebcontents\"><a href=\"#removed-webviewgetwebcontents\">Removed: <code>&#x3C;webview>.getWebContents()</code></a></h3>\n<p>This API, which was deprecated in Electron 8.0, is now removed.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 9.0</span>\nwebview.getWebContents()\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> { remote } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nremote.webContents.fromId(webview.getWebContentsId())\n</code></pre>\n<h3 id=\"removido-webframesetlayoutzoomlevellimits\"><a href=\"#removido-webframesetlayoutzoomlevellimits\">Removido: <code>webFrame.setLayoutZoomLevelLimits()</code></a></h3>\n<p>Chromium has removed support for changing the layout zoom level limits, and it is beyond Electron's capacity to maintain it. The function was deprecated in Electron 8.x, and has been removed in Electron 9.x. The layout zoom level limits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined <a href=\"https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11\">here</a>.</p>\n<h3 id=\"behavior-changed-sending-non-js-objects-over-ipc-now-throws-an-exception\"><a href=\"#behavior-changed-sending-non-js-objects-over-ipc-now-throws-an-exception\">Behavior Changed: Sending non-JS objects over IPC now throws an exception</a></h3>\n<p>In Electron 8.0, IPC was changed to use the Structured Clone Algorithm, bringing significant performance improvements. To help ease the transition, the old IPC serialization algorithm was kept and used for some objects that aren't serializable with Structured Clone. In particular, DOM objects (e.g. <code>Element</code>, <code>Location</code> and <code>DOMMatrix</code>), Node.js objects backed by C++ classes (e.g. <code>process.env</code>, some members of <code>Stream</code>), and Electron objects backed by C++ classes (e.g. <code>WebContents</code>, <code>BrowserWindow</code> and <code>WebFrame</code>) are not serializable with Structured Clone. Whenever the old algorithm was invoked, a deprecation warning was printed.</p>\n<p>In Electron 9.0, the old serialization algorithm has been removed, and sending such non-serializable objects will now throw an \"object could not be cloned\" error.</p>\n<h3 id=\"api-changed-shellopenitem-is-now-shellopenpath\"><a href=\"#api-changed-shellopenitem-is-now-shellopenpath\">API Changed: <code>shell.openItem</code> is now <code>shell.openPath</code></a></h3>\n<p>The <code>shell.openItem</code> API has been replaced with an asynchronous <code>shell.openPath</code> API. Você pode ver a proposta original da API e o raciocínio <a href=\"https://github.com/electron/governance/blob/main/wg-api/spec-documents/shell-openitem.md\">aqui</a>.</p>\n<h2 id=\"alterações-planejadas-na-api-80\"><a href=\"#alterações-planejadas-na-api-80\">Alterações planejadas na API (8.0)</a></h2>\n<h3 id=\"comportamento-alterado-os-valores-enviados-por-ipc-agora-são-serializados-com-algoritmo-de-clone-estruturado\"><a href=\"#comportamento-alterado-os-valores-enviados-por-ipc-agora-são-serializados-com-algoritmo-de-clone-estruturado\">Comportamento alterado: os valores enviados por IPC agora são serializados com Algoritmo de Clone Estruturado</a></h3>\n<p>The algorithm used to serialize objects sent over IPC (through <code>ipcRenderer.send</code>, <code>ipcRenderer.sendSync</code>, <code>WebContents.send</code> and related methods) has been switched from a custom algorithm to V8's built-in <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, the same algorithm used to serialize messages for <code>postMessage</code>. This brings about a 2x performance improvement for large messages, but also brings some breaking changes in behavior.</p>\n<ul>\n<li>Sending Functions, Promises, WeakMaps, WeakSets, or objects containing any such values, over IPC will now throw an exception, instead of silently converting the functions to <code>undefined</code>.</li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Previously:</span>\nipcRenderer.send(<span class=\"hljs-string\">'channel'</span>, { <span class=\"hljs-attr\">value</span>: <span class=\"hljs-number\">3</span>, <span class=\"hljs-attr\">someFunction</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {} })\n<span class=\"hljs-comment\">// => results in { value: 3 } arriving in the main process</span>\n\n<span class=\"hljs-comment\">// From Electron 8:</span>\nipcRenderer.send(<span class=\"hljs-string\">'channel'</span>, { <span class=\"hljs-attr\">value</span>: <span class=\"hljs-number\">3</span>, <span class=\"hljs-attr\">someFunction</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {} })\n<span class=\"hljs-comment\">// => throws Error(\"() => {} could not be cloned.\")</span>\n</code></pre>\n<ul>\n<li><code>NaN</code>, <code>Infinity</code> and <code>-Infinity</code> will now be correctly serialized, instead of being converted to <code>null</code>.</li>\n<li>Objects containing cyclic references will now be correctly serialized, instead of being converted to <code>null</code>.</li>\n<li><code>Set</code>, <code>Map</code>, <code>Error</code> and <code>RegExp</code> values will be correctly serialized, instead of being converted to <code>{}</code>.</li>\n<li><code>BigInt</code> values will be correctly serialized, instead of being converted to <code>null</code>.</li>\n<li>Sparse arrays will be serialized as such, instead of being converted to dense arrays with <code>null</code>s.</li>\n<li><code>Date</code> objects will be transferred as <code>Date</code> objects, instead of being converted to their ISO string representation.</li>\n<li>Typed Arrays (such as <code>Uint8Array</code>, <code>Uint16Array</code>, <code>Uint32Array</code> and so on) will be transferred as such, instead of being converted to Node.js <code>Buffer</code>.</li>\n<li>Node.js <code>Buffer</code> objects will be transferred as <code>Uint8Array</code>s. You can convert a <code>Uint8Array</code> back to a Node.js <code>Buffer</code> by wrapping the underlying <code>ArrayBuffer</code>:</li>\n</ul>\n<pre><code class=\"hljs language-js\">Buffer.from(value.buffer, value.byteOffset, value.byteLength)\n</code></pre>\n<p>Sending any objects that aren't native JS types, such as DOM objects (e.g. <code>Element</code>, <code>Location</code>, <code>DOMMatrix</code>), Node.js objects (e.g. <code>process.env</code>, <code>Stream</code>), or Electron objects (e.g. <code>WebContents</code>, <code>BrowserWindow</code>, <code>WebFrame</code>) is deprecated. In Electron 8, these objects will be serialized as before with a DeprecationWarning message, but starting in Electron 9, sending these kinds of objects will throw a 'could not be cloned' error.</p>\n<h3 id=\"deprecated-webviewgetwebcontents\"><a href=\"#deprecated-webviewgetwebcontents\">Deprecated: <code>&#x3C;webview>.getWebContents()</code></a></h3>\n<p>This API is implemented using the <code>remote</code> module, which has both performance and security implications. Therefore its usage should be explicit.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebview.getWebContents()\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> { remote } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nremote.webContents.fromId(webview.getWebContentsId())\n</code></pre>\n<p>However, it is recommended to avoid using the <code>remote</code> module altogether.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain, webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> getGuestForWebContents = <span class=\"hljs-function\">(<span class=\"hljs-params\">webContentsId, contents</span>) =></span> {\n  <span class=\"hljs-keyword\">const</span> guest = webContents.fromId(webContentsId)\n  <span class=\"hljs-keyword\">if</span> (!guest) {\n    <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">`Invalid webContentsId: <span class=\"hljs-subst\">${webContentsId}</span>`</span>)\n  }\n  <span class=\"hljs-keyword\">if</span> (guest.hostWebContents !== contents) {\n    <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Access denied to webContents'</span>)\n  }\n  <span class=\"hljs-keyword\">return</span> guest\n}\n\nipcMain.handle(<span class=\"hljs-string\">'openDevTools'</span>, (event, webContentsId) => {\n  <span class=\"hljs-keyword\">const</span> guest = getGuestForWebContents(webContentsId, event.sender)\n  guest.openDevTools()\n})\n\n<span class=\"hljs-comment\">// renderer</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nipcRenderer.invoke(<span class=\"hljs-string\">'openDevTools'</span>, webview.getWebContentsId())\n</code></pre>\n<h3 id=\"deprecated-webframesetlayoutzoomlevellimits\"><a href=\"#deprecated-webframesetlayoutzoomlevellimits\">Deprecated: <code>webFrame.setLayoutZoomLevelLimits()</code></a></h3>\n<p>Chromium has removed support for changing the layout zoom level limits, and it is beyond Electron's capacity to maintain it. The function will emit a warning in Electron 8.x, and cease to exist in Electron 9.x. The layout zoom level limits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined <a href=\"https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11\">here</a>.</p>\n<h3 id=\"deprecated-events-in-systempreferences\"><a href=\"#deprecated-events-in-systempreferences\">Deprecated events in <code>systemPreferences</code></a></h3>\n<p>The following <code>systemPreferences</code> events have been deprecated:</p>\n<ul>\n<li><code>inverted-color-scheme-changed</code></li>\n<li><code>high-contrast-color-scheme-changed</code></li>\n</ul>\n<p>Use the new <code>updated</code> event on the <code>nativeTheme</code> module instead.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.on(<span class=\"hljs-string\">'inverted-color-scheme-changed'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\nsystemPreferences.on(<span class=\"hljs-string\">'high-contrast-color-scheme-changed'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\n\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.on(<span class=\"hljs-string\">'updated'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\n</code></pre>\n<h3 id=\"deprecated-methods-in-systempreferences\"><a href=\"#deprecated-methods-in-systempreferences\">Deprecated: methods in <code>systemPreferences</code></a></h3>\n<p>The following <code>systemPreferences</code> methods have been deprecated:</p>\n<ul>\n<li><code>systemPreferences.isDarkMode()</code></li>\n<li><code>systemPreferences.isInvertedColorScheme()</code></li>\n<li><code>systemPreferences.isHighContrastColorScheme()</code></li>\n</ul>\n<p>Use the following <code>nativeTheme</code> properties instead:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code></li>\n<li><code>nativeTheme.shouldUseInvertedColorScheme</code></li>\n<li><code>nativeTheme.shouldUseHighContrastColors</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.isDarkMode()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseDarkColors\n\n<span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.isInvertedColorScheme()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseInvertedColorScheme\n\n<span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.isHighContrastColorScheme()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseHighContrastColors\n</code></pre>\n<h2 id=\"planned-breaking-api-changes-70\"><a href=\"#planned-breaking-api-changes-70\">Planned Breaking API Changes (7.0)</a></h2>\n<h3 id=\"deprecated-atomio-node-headers-url\"><a href=\"#deprecated-atomio-node-headers-url\">Deprecated: Atom.io Node Headers URL</a></h3>\n<p>This is the URL specified as <code>disturl</code> in a <code>.npmrc</code> file or as the <code>--dist-url</code> command line flag when building native Node modules.  Both will be supported for the foreseeable future but it is recommended that you switch.</p>\n<p>Deprecated: <a href=\"https://atom.io/download/electron\">https://atom.io/download/electron</a></p>\n<p>Replace with: <a href=\"https://electronjs.org/headers\">https://electronjs.org/headers</a></p>\n<h3 id=\"api-changed-sessionclearauthcache-no-longer-accepts-options\"><a href=\"#api-changed-sessionclearauthcache-no-longer-accepts-options\">API Changed: <code>session.clearAuthCache()</code> no longer accepts options</a></h3>\n<p>The <code>session.clearAuthCache</code> API no longer accepts options for what to clear, and instead unconditionally clears the whole cache.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nsession.clearAuthCache({ <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'password'</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nsession.clearAuthCache()\n</code></pre>\n<h3 id=\"api-changed-powermonitorquerysystemidlestate-is-now-powermonitorgetsystemidlestate\"><a href=\"#api-changed-powermonitorquerysystemidlestate-is-now-powermonitorgetsystemidlestate\">API Changed: <code>powerMonitor.querySystemIdleState</code> is now <code>powerMonitor.getSystemIdleState</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\npowerMonitor.querySystemIdleState(threshold, callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleState = powerMonitor.getSystemIdleState(threshold)\n</code></pre>\n<h3 id=\"api-changed-powermonitorquerysystemidletime-is-now-powermonitorgetsystemidletime\"><a href=\"#api-changed-powermonitorquerysystemidletime-is-now-powermonitorgetsystemidletime\">API Changed: <code>powerMonitor.querySystemIdleTime</code> is now <code>powerMonitor.getSystemIdleTime</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\npowerMonitor.querySystemIdleTime(callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleTime = powerMonitor.getSystemIdleTime()\n</code></pre>\n<h3 id=\"api-changed-webframesetisolatedworldinfo-replaces-separate-methods\"><a href=\"#api-changed-webframesetisolatedworldinfo-replaces-separate-methods\">API Changed: <code>webFrame.setIsolatedWorldInfo</code> replaces separate methods</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\nwebFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)\nwebFrame.setIsolatedWorldHumanReadableName(worldId, name)\nwebFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)\n<span class=\"hljs-comment\">// Replace with</span>\nwebFrame.setIsolatedWorldInfo(\n  worldId,\n  {\n    <span class=\"hljs-attr\">securityOrigin</span>: <span class=\"hljs-string\">'some_origin'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'human_readable_name'</span>,\n    <span class=\"hljs-attr\">csp</span>: <span class=\"hljs-string\">'content_security_policy'</span>\n  })\n</code></pre>\n<h3 id=\"removed-marked-property-on-getblinkmemoryinfo\"><a href=\"#removed-marked-property-on-getblinkmemoryinfo\">Removed: <code>marked</code> property on <code>getBlinkMemoryInfo</code></a></h3>\n<p>This property was removed in Chromium 77, and as such is no longer available.</p>\n<h3 id=\"behavior-changed-webkitdirectory-attribute-for-input-typefile-now-lists-directory-contents\"><a href=\"#behavior-changed-webkitdirectory-attribute-for-input-typefile-now-lists-directory-contents\">Behavior Changed: <code>webkitdirectory</code> attribute for <code>&#x3C;input type=\"file\"/></code> now lists directory contents</a></h3>\n<p>The <code>webkitdirectory</code> property on HTML file inputs allows them to select folders. Previous versions of Electron had an incorrect implementation where the <code>event.target.files</code> of the input returned a <code>FileList</code> that returned one <code>File</code> corresponding to the selected folder.</p>\n<p>As of Electron 7, that <code>FileList</code> is now list of all files contained within the folder, similarly to Chrome, Firefox, and Edge (<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory\">link to MDN docs</a>).</p>\n<p>As an illustration, take a folder with this structure:</p>\n<pre><code class=\"hljs language-console\">folder\n├── file1\n├── file2\n└── file3\n</code></pre>\n<p>In Electron &#x3C;=6, this would return a <code>FileList</code> with a <code>File</code> object for:</p>\n<pre><code class=\"hljs language-console\">path/to/folder\n</code></pre>\n<p>In Electron 7, this now returns a <code>FileList</code> with a <code>File</code> object for:</p>\n<pre><code class=\"hljs language-console\">/path/to/folder/file3\n/path/to/folder/file2\n/path/to/folder/file1\n</code></pre>\n<p>Note that <code>webkitdirectory</code> no longer exposes the path to the selected folder. If you require the path to the selected folder rather than the folder contents, see the <code>dialog.showOpenDialog</code> API (<a href=\"/docs/api/dialog#dialogshowopendialogbrowserwindow-options\">link</a>).</p>\n<h3 id=\"api-changed-callback-based-versions-of-promisified-apis\"><a href=\"#api-changed-callback-based-versions-of-promisified-apis\">API Changed: Callback-based versions of promisified APIs</a></h3>\n<p>Electron 5 and Electron 6 introduced Promise-based versions of existing asynchronous APIs and deprecated their older, callback-based counterparts. In Electron 7, all deprecated callback-based APIs are now removed.</p>\n<p>These functions now only return Promises:</p>\n<ul>\n<li><code>app.getFileIcon()</code> <a href=\"https://github.com/electron/electron/pull/15742\">#15742</a></li>\n<li><code>app.dock.show()</code> <a href=\"https://github.com/electron/electron/pull/16904\">#16904</a></li>\n<li><code>contentTracing.getCategories()</code> <a href=\"https://github.com/electron/electron/pull/16583\">#16583</a></li>\n<li><code>contentTracing.getTraceBufferUsage()</code> <a href=\"https://github.com/electron/electron/pull/16600\">#16600</a></li>\n<li><code>contentTracing.startRecording()</code> <a href=\"https://github.com/electron/electron/pull/16584\">#16584</a></li>\n<li><code>contentTracing.stopRecording()</code> <a href=\"https://github.com/electron/electron/pull/16584\">#16584</a></li>\n<li><code>contents.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>cookies.flushStore()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.get()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.remove()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.set()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>debugger.sendCommand()</code> <a href=\"https://github.com/electron/electron/pull/16861\">#16861</a></li>\n<li><code>dialog.showCertificateTrustDialog()</code> <a href=\"https://github.com/electron/electron/pull/17181\">#17181</a></li>\n<li><code>inAppPurchase.getProducts()</code> <a href=\"https://github.com/electron/electron/pull/17355\">#17355</a></li>\n<li><code>inAppPurchase.purchaseProduct()</code><a href=\"https://github.com/electron/electron/pull/17355\">#17355</a></li>\n<li><code>netLog.stopLogging()</code> <a href=\"https://github.com/electron/electron/pull/16862\">#16862</a></li>\n<li><code>session.clearAuthCache()</code> <a href=\"https://github.com/electron/electron/pull/17259\">#17259</a></li>\n<li><code>session.clearCache()</code>  <a href=\"https://github.com/electron/electron/pull/17185\">#17185</a></li>\n<li><code>session.clearHostResolverCache()</code> <a href=\"https://github.com/electron/electron/pull/17229\">#17229</a></li>\n<li><code>session.clearStorageData()</code> <a href=\"https://github.com/electron/electron/pull/17249\">#17249</a></li>\n<li><code>session.getBlobData()</code> <a href=\"https://github.com/electron/electron/pull/17303\">#17303</a></li>\n<li><code>session.getCacheSize()</code>  <a href=\"https://github.com/electron/electron/pull/17185\">#17185</a></li>\n<li><code>session.resolveProxy()</code> <a href=\"https://github.com/electron/electron/pull/17222\">#17222</a></li>\n<li><code>session.setProxy()</code>  <a href=\"https://github.com/electron/electron/pull/17222\">#17222</a></li>\n<li><code>shell.openExternal()</code> <a href=\"https://github.com/electron/electron/pull/16176\">#16176</a></li>\n<li><code>webContents.loadFile()</code> <a href=\"https://github.com/electron/electron/pull/15855\">#15855</a></li>\n<li><code>webContents.loadURL()</code> <a href=\"https://github.com/electron/electron/pull/15855\">#15855</a></li>\n<li><code>webContents.hasServiceWorker()</code> <a href=\"https://github.com/electron/electron/pull/16535\">#16535</a></li>\n<li><code>webContents.printToPDF()</code> <a href=\"https://github.com/electron/electron/pull/16795\">#16795</a></li>\n<li><code>webContents.savePage()</code> <a href=\"https://github.com/electron/electron/pull/16742\">#16742</a></li>\n<li><code>webFrame.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>webFrame.executeJavaScriptInIsolatedWorld()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>webviewTag.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>win.capturePage()</code> <a href=\"https://github.com/electron/electron/pull/15743\">#15743</a></li>\n</ul>\n<p>These functions now have two forms, synchronous and Promise-based asynchronous:</p>\n<ul>\n<li><code>dialog.showMessageBox()</code>/<code>dialog.showMessageBoxSync()</code> <a href=\"https://github.com/electron/electron/pull/17298\">#17298</a></li>\n<li><code>dialog.showOpenDialog()</code>/<code>dialog.showOpenDialogSync()</code> <a href=\"https://github.com/electron/electron/pull/16973\">#16973</a></li>\n<li><code>dialog.showSaveDialog()</code>/<code>dialog.showSaveDialogSync()</code> <a href=\"https://github.com/electron/electron/pull/17054\">#17054</a></li>\n</ul>\n<h2 id=\"planned-breaking-api-changes-60\"><a href=\"#planned-breaking-api-changes-60\">Planned Breaking API Changes (6.0)</a></h2>\n<h3 id=\"api-changed-winsetmenunull-is-now-winremovemenu\"><a href=\"#api-changed-winsetmenunull-is-now-winremovemenu\">API Changed: <code>win.setMenu(null)</code> is now <code>win.removeMenu()</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwin.setMenu(<span class=\"hljs-literal\">null</span>)\n<span class=\"hljs-comment\">// Replace with</span>\nwin.removeMenu()\n</code></pre>\n<h3 id=\"api-changed-electronscreen-in-the-renderer-process-should-be-accessed-via-remote\"><a href=\"#api-changed-electronscreen-in-the-renderer-process-should-be-accessed-via-remote\">API Changed: <code>electron.screen</code> in the renderer process should be accessed via <code>remote</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).screen\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.screen\n</code></pre>\n<h3 id=\"api-changed-requireing-node-builtins-in-sandboxed-renderers-no-longer-implicitly-loads-the-remote-version\"><a href=\"#api-changed-requireing-node-builtins-in-sandboxed-renderers-no-longer-implicitly-loads-the-remote-version\">API Changed: <code>require()</code>ing node builtins in sandboxed renderers no longer implicitly loads the <code>remote</code> version</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'child_process'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'child_process'</span>)\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'os'</span>)\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'path'</span>)\n</code></pre>\n<h3 id=\"deprecated-powermonitorquerysystemidlestate-replaced-with-powermonitorgetsystemidlestate\"><a href=\"#deprecated-powermonitorquerysystemidlestate-replaced-with-powermonitorgetsystemidlestate\">Deprecated: <code>powerMonitor.querySystemIdleState</code> replaced with <code>powerMonitor.getSystemIdleState</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\npowerMonitor.querySystemIdleState(threshold, callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleState = powerMonitor.getSystemIdleState(threshold)\n</code></pre>\n<h3 id=\"deprecated-powermonitorquerysystemidletime-replaced-with-powermonitorgetsystemidletime\"><a href=\"#deprecated-powermonitorquerysystemidletime-replaced-with-powermonitorgetsystemidletime\">Deprecated: <code>powerMonitor.querySystemIdleTime</code> replaced with <code>powerMonitor.getSystemIdleTime</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\npowerMonitor.querySystemIdleTime(callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleTime = powerMonitor.getSystemIdleTime()\n</code></pre>\n<h3 id=\"deprecated-appenablemixedsandbox-is-no-longer-needed\"><a href=\"#deprecated-appenablemixedsandbox-is-no-longer-needed\">Deprecated: <code>app.enableMixedSandbox()</code> is no longer needed</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\napp.enableMixedSandbox()\n</code></pre>\n<p>Mixed-sandbox mode is now enabled by default.</p>\n<h3 id=\"deprecated-traysethighlightmode\"><a href=\"#deprecated-traysethighlightmode\">Deprecated: <code>Tray.setHighlightMode</code></a></h3>\n<p>Under macOS Catalina our former Tray implementation breaks. Apple's native substitute doesn't support changing the highlighting behavior.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\ntray.setHighlightMode(mode)\n<span class=\"hljs-comment\">// API will be removed in v7.0 without replacement.</span>\n</code></pre>\n<h2 id=\"planned-breaking-api-changes-50\"><a href=\"#planned-breaking-api-changes-50\">Planned Breaking API Changes (5.0)</a></h2>\n<h3 id=\"default-changed-nodeintegration-and-webviewtag-default-to-false-contextisolation-defaults-to-true\"><a href=\"#default-changed-nodeintegration-and-webviewtag-default-to-false-contextisolation-defaults-to-true\">Default Changed: <code>nodeIntegration</code> and <code>webviewTag</code> default to false, <code>contextIsolation</code> defaults to true</a></h3>\n<p>The following <code>webPreferences</code> option default values are deprecated in favor of the new defaults listed below.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Property</th><th>Deprecated Default</th><th>New Default</th></tr></thead><tbody><tr><td><code>contextIsolation</code></td><td><code>falso</code></td><td><code>true</code></td></tr><tr><td><code>nodeIntegration</code></td><td><code>true</code></td><td><code>falso</code></td></tr><tr><td><code>webviewTag</code></td><td><code>nodeIntegration</code> if set else <code>true</code></td><td><code>falso</code></td></tr></tbody></table>\n<p>Ex. Re-enabling the webviewTag</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> w = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">webviewTag</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h3 id=\"behavior-changed-nodeintegration-in-child-windows-opened-via-nativewindowopen\"><a href=\"#behavior-changed-nodeintegration-in-child-windows-opened-via-nativewindowopen\">Behavior Changed: <code>nodeIntegration</code> in child windows opened via <code>nativeWindowOpen</code></a></h3>\n<p>Child windows opened with the <code>nativeWindowOpen</code> option will always have Node.js integration disabled, unless <code>nodeIntegrationInSubFrames</code> is <code>true</code>.</p>\n<h3 id=\"api-changed-registering-privileged-schemes-must-now-be-done-before-app-ready\"><a href=\"#api-changed-registering-privileged-schemes-must-now-be-done-before-app-ready\">API Changed: Registering privileged schemes must now be done before app ready</a></h3>\n<p>Renderer process APIs <code>webFrame.registerURLSchemeAsPrivileged</code> and <code>webFrame.registerURLSchemeAsBypassingCSP</code> as well as browser process API <code>protocol.registerStandardSchemes</code> have been removed. A new API, <code>protocol.registerSchemesAsPrivileged</code> has been added and should be used for registering custom schemes with the required privileges. Custom schemes are required to be registered before app ready.</p>\n<h3 id=\"deprecated-webframesetisolatedworld-replaced-with-webframesetisolatedworldinfo\"><a href=\"#deprecated-webframesetisolatedworld-replaced-with-webframesetisolatedworldinfo\">Deprecated: <code>webFrame.setIsolatedWorld*</code> replaced with <code>webFrame.setIsolatedWorldInfo</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)\nwebFrame.setIsolatedWorldHumanReadableName(worldId, name)\nwebFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)\n<span class=\"hljs-comment\">// Replace with</span>\nwebFrame.setIsolatedWorldInfo(\n  worldId,\n  {\n    <span class=\"hljs-attr\">securityOrigin</span>: <span class=\"hljs-string\">'some_origin'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'human_readable_name'</span>,\n    <span class=\"hljs-attr\">csp</span>: <span class=\"hljs-string\">'content_security_policy'</span>\n  })\n</code></pre>\n<h3 id=\"api-changed-webframesetspellcheckprovider-now-takes-an-asynchronous-callback\"><a href=\"#api-changed-webframesetspellcheckprovider-now-takes-an-asynchronous-callback\">API Changed: <code>webFrame.setSpellCheckProvider</code> now takes an asynchronous callback</a></h3>\n<p>The <code>spellCheck</code> callback is now asynchronous, and <code>autoCorrectWord</code> parameter has been removed.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, <span class=\"hljs-literal\">true</span>, {\n  <span class=\"hljs-attr\">spellCheck</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">text</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> !spellchecker.isMisspelled(text)\n  }\n})\n<span class=\"hljs-comment\">// Replace with</span>\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, {\n  <span class=\"hljs-attr\">spellCheck</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">words, callback</span>) =></span> {\n    callback(words.filter(<span class=\"hljs-function\"><span class=\"hljs-params\">text</span> =></span> spellchecker.isMisspelled(text)))\n  }\n})\n</code></pre>\n<h3 id=\"api-changed-webcontentsgetzoomlevel-and-webcontentsgetzoomfactor-are-now-synchronous\"><a href=\"#api-changed-webcontentsgetzoomlevel-and-webcontentsgetzoomfactor-are-now-synchronous\">API Changed: <code>webContents.getZoomLevel</code> and <code>webContents.getZoomFactor</code> are now synchronous</a></h3>\n<p><code>webContents.getZoomLevel</code> and <code>webContents.getZoomFactor</code> no longer take callback parameters, instead directly returning their number values.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebContents.getZoomLevel(<span class=\"hljs-function\">(<span class=\"hljs-params\">level</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(level)\n})\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> level = webContents.getZoomLevel()\n<span class=\"hljs-built_in\">console</span>.log(level)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebContents.getZoomFactor(<span class=\"hljs-function\">(<span class=\"hljs-params\">factor</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(factor)\n})\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> factor = webContents.getZoomFactor()\n<span class=\"hljs-built_in\">console</span>.log(factor)\n</code></pre>\n<h2 id=\"alterações-planejadas-na-api-40\"><a href=\"#alterações-planejadas-na-api-40\">Alterações planejadas na API (4.0)</a></h2>\n<p>The following list includes the breaking API changes made in Electron 4.0.</p>\n<h3 id=\"appmakesingleinstance\"><a href=\"#appmakesingleinstance\"><code>app.makeSingleInstance</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\napp.makeSingleInstance(<span class=\"hljs-function\">(<span class=\"hljs-params\">argv, cwd</span>) =></span> {\n  <span class=\"hljs-comment\">/* ... */</span>\n})\n<span class=\"hljs-comment\">// Replace with</span>\napp.requestSingleInstanceLock()\napp.on(<span class=\"hljs-string\">'second-instance'</span>, (event, argv, cwd) => {\n  <span class=\"hljs-comment\">/* ... */</span>\n})\n</code></pre>\n<h3 id=\"appreleasesingleinstance\"><a href=\"#appreleasesingleinstance\"><code>app.releaseSingleInstance</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// depreciado</span>\napp.releaseSingleInstance()\n<span class=\"hljs-comment\">// Substituir com</span>\napp.releaseSingleInstanceLock()\n</code></pre>\n<h3 id=\"appgetgpuinfo\"><a href=\"#appgetgpuinfo\"><code>app.getGPUInfo</code></a></h3>\n<pre><code class=\"hljs language-js\">app.getGPUInfo(<span class=\"hljs-string\">'complete'</span>)\n<span class=\"hljs-comment\">// Now behaves the same with `basic` on macOS</span>\napp.getGPUInfo(<span class=\"hljs-string\">'basic'</span>)\n</code></pre>\n<h3 id=\"win_delay_load_hook\"><a href=\"#win_delay_load_hook\"><code>win_delay_load_hook</code></a></h3>\n<p>When building native modules for windows, the <code>win_delay_load_hook</code> variable in the module's <code>binding.gyp</code> must be true (which is the default). If this hook is not present, then the native module will fail to load on Windows, with an error message like <code>Cannot find module</code>. See the <a href=\"/docs/tutorial/using-native-node-modules\">native module guide</a> for more.</p>\n<h2 id=\"alterações-na-api-30\"><a href=\"#alterações-na-api-30\">Alterações na API (3.0)</a></h2>\n<p>A lista a seguir inclui as alterações na API do Election 3.0.</p>\n<h3 id=\"app\"><a href=\"#app\"><code>app</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\napp.getAppMemoryInfo()\n<span class=\"hljs-comment\">// Replace with</span>\napp.getAppMetrics()\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-keyword\">const</span> metrics = app.getAppMetrics()\n<span class=\"hljs-keyword\">const</span> { memory } = metrics[<span class=\"hljs-number\">0</span>] <span class=\"hljs-comment\">// Deprecated property</span>\n</code></pre>\n<h3 id=\"browserwindow\"><a href=\"#browserwindow\"><code>BrowserWindow</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-keyword\">const</span> optionsA = { <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">blinkFeatures</span>: <span class=\"hljs-string\">''</span> } }\n<span class=\"hljs-keyword\">const</span> windowA = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsA)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> optionsB = { <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">enableBlinkFeatures</span>: <span class=\"hljs-string\">''</span> } }\n<span class=\"hljs-keyword\">const</span> windowB = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsB)\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">window</span>.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'media-play_pause'</span>) {\n    <span class=\"hljs-comment\">// do something</span>\n  }\n})\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">window</span>.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'media-play-pause'</span>) {\n    <span class=\"hljs-comment\">// do something</span>\n  }\n})\n</code></pre>\n<h3 id=\"clipboard\"><a href=\"#clipboard\"><code>clipboard</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// depreciado</span>\nclipboard.readRtf()\n<span class=\"hljs-comment\">// Substitua com</span>\nclipboard.readRTF()\n\n<span class=\"hljs-comment\">// depreciado</span>\nclipboard.writeRtf()\n<span class=\"hljs-comment\">// Substitua com</span>\nclipboard.writeRTF()\n\n<span class=\"hljs-comment\">// depreciado</span>\nclipboard.readHtml()\n<span class=\"hljs-comment\">// Substitua com</span>\nclipboard.readHTML()\n\n<span class=\"hljs-comment\">// depreciado</span>\nclipboard.writeHtml()\n<span class=\"hljs-comment\">// Substitua com</span>\nclipboard.writeHTML()\n</code></pre>\n<h3 id=\"crashreporter\"><a href=\"#crashreporter\"><code>crashReporter</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// depreciado</span>\ncrashReporter.start({\n  <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Crashly'</span>,\n  <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://crash.server.com'</span>,\n  <span class=\"hljs-attr\">autoSubmit</span>: <span class=\"hljs-literal\">true</span>\n})\n<span class=\"hljs-comment\">// Substitua com</span>\ncrashReporter.start({\n  <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Crashly'</span>,\n  <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://crash.server.com'</span>,\n  <span class=\"hljs-attr\">uploadToServer</span>: <span class=\"hljs-literal\">true</span>\n})\n</code></pre>\n<h3 id=\"nativeimage\"><a href=\"#nativeimage\"><code>nativeImage</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// depreciado</span>\nnativeImage.createFromBuffer(buffer, <span class=\"hljs-number\">1.0</span>)\n<span class=\"hljs-comment\">// Substitua com</span>\nnativeImage.createFromBuffer(buffer, {\n  <span class=\"hljs-attr\">scaleFactor</span>: <span class=\"hljs-number\">1.0</span>\n})\n</code></pre>\n<h3 id=\"process\"><a href=\"#process\"><code>process</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-keyword\">const</span> info = process.getProcessMemoryInfo()\n</code></pre>\n<h3 id=\"screen\"><a href=\"#screen\"><code>screen</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nscreen.getMenuBarHeight()\n<span class=\"hljs-comment\">// Replace with</span>\nscreen.getPrimaryDisplay().workArea\n</code></pre>\n<h3 id=\"session\"><a href=\"#session\"><code>session</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nses.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">hostname, certificate, callback</span>) =></span> {\n  callback(<span class=\"hljs-literal\">true</span>)\n})\n<span class=\"hljs-comment\">// Replace with</span>\nses.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">request, callback</span>) =></span> {\n  callback(<span class=\"hljs-number\">0</span>)\n})\n</code></pre>\n<h3 id=\"tray\"><a href=\"#tray\"><code>Tray</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\ntray.setHighlightMode(<span class=\"hljs-literal\">true</span>)\n<span class=\"hljs-comment\">// Replace with</span>\ntray.setHighlightMode(<span class=\"hljs-string\">'on'</span>)\n\n<span class=\"hljs-comment\">// Deprecated</span>\ntray.setHighlightMode(<span class=\"hljs-literal\">false</span>)\n<span class=\"hljs-comment\">// Replace with</span>\ntray.setHighlightMode(<span class=\"hljs-string\">'off'</span>)\n</code></pre>\n<h3 id=\"webcontents\"><a href=\"#webcontents\"><code>webContents</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebContents.openDevTools({ <span class=\"hljs-attr\">detach</span>: <span class=\"hljs-literal\">true</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nwebContents.openDevTools({ <span class=\"hljs-attr\">mode</span>: <span class=\"hljs-string\">'detach'</span> })\n\n<span class=\"hljs-comment\">// Removed</span>\nwebContents.setSize(options)\n<span class=\"hljs-comment\">// There is no replacement for this API</span>\n</code></pre>\n<h3 id=\"webframe\"><a href=\"#webframe\"><code>webFrame</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.registerURLSchemeAsSecure(<span class=\"hljs-string\">'app'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\nprotocol.registerStandardSchemes([<span class=\"hljs-string\">'app'</span>], { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n\n<span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.registerURLSchemeAsPrivileged(<span class=\"hljs-string\">'app'</span>, { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nprotocol.registerStandardSchemes([<span class=\"hljs-string\">'app'</span>], { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n</code></pre>\n<h3 id=\"webview\"><a href=\"#webview\"><code>&#x3C;webview></code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed</span>\nwebview.setAttribute(<span class=\"hljs-string\">'disableguestresize'</span>, <span class=\"hljs-string\">''</span>)\n<span class=\"hljs-comment\">// There is no replacement for this API</span>\n\n<span class=\"hljs-comment\">// Removed</span>\nwebview.setAttribute(<span class=\"hljs-string\">'guestinstance'</span>, instanceId)\n<span class=\"hljs-comment\">// There is no replacement for this API</span>\n\n<span class=\"hljs-comment\">// Keyboard listeners no longer work on webview tag</span>\nwebview.onkeydown = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* handler */</span> }\nwebview.onkeyup = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* handler */</span> }\n</code></pre>\n<h3 id=\"node-headers-url\"><a href=\"#node-headers-url\">Node Headers URL</a></h3>\n<p>This is the URL specified as <code>disturl</code> in a <code>.npmrc</code> file or as the <code>--dist-url</code> command line flag when building native Node modules.</p>\n<p>Deprecated: <a href=\"https://atom.io/download/atom-shell\">https://atom.io/download/atom-shell</a></p>\n<p>Replace with: <a href=\"https://atom.io/download/electron\">https://atom.io/download/electron</a></p>\n<h2 id=\"breaking-api-changes-20\"><a href=\"#breaking-api-changes-20\">Breaking API Changes (2.0)</a></h2>\n<p>The following list includes the breaking API changes made in Electron 2.0.</p>\n<h3 id=\"browserwindow-1\"><a href=\"#browserwindow-1\"><code>BrowserWindow</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-keyword\">const</span> optionsA = { <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden-inset'</span> }\n<span class=\"hljs-keyword\">const</span> windowA = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsA)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> optionsB = { <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span> }\n<span class=\"hljs-keyword\">const</span> windowB = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsB)\n</code></pre>\n<h3 id=\"menu\"><a href=\"#menu\"><code>menu</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed</span>\nmenu.popup(browserWindow, <span class=\"hljs-number\">100</span>, <span class=\"hljs-number\">200</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Replaced with</span>\nmenu.popup(browserWindow, { <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">100</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">200</span>, <span class=\"hljs-attr\">positioningItem</span>: <span class=\"hljs-number\">2</span> })\n</code></pre>\n<h3 id=\"nativeimage-1\"><a href=\"#nativeimage-1\"><code>nativeImage</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed</span>\nnativeImage.toPng()\n<span class=\"hljs-comment\">// Replaced with</span>\nnativeImage.toPNG()\n\n<span class=\"hljs-comment\">// Removed</span>\nnativeImage.toJpeg()\n<span class=\"hljs-comment\">// Replaced with</span>\nnativeImage.toJPEG()\n</code></pre>\n<h3 id=\"process-1\"><a href=\"#process-1\"><code>process</code></a></h3>\n<ul>\n<li><code>process.versions.electron</code> and <code>process.version.chrome</code> will be made read-only properties for consistency with the other <code>process.versions</code> properties set by Node.</li>\n</ul>\n<h3 id=\"webcontents-1\"><a href=\"#webcontents-1\"><code>webContents</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed</span>\nwebContents.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Replaced with</span>\nwebContents.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"webframe-1\"><a href=\"#webframe-1\"><code>webFrame</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed</span>\nwebFrame.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Replaced with</span>\nwebFrame.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"webview-1\"><a href=\"#webview-1\"><code>&#x3C;webview></code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed</span>\nwebview.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Replaced with</span>\nwebview.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"duplicate-arm-assets\"><a href=\"#duplicate-arm-assets\">Duplicate ARM Assets</a></h3>\n<p>Each Electron release includes two identical ARM builds with slightly different filenames, like <code>electron-v1.7.3-linux-arm.zip</code> and <code>electron-v1.7.3-linux-armv7l.zip</code>. The asset with the <code>v7l</code> prefix was added to clarify to users which ARM version it supports, and to disambiguate it from future armv6l and arm64 assets that may be produced.</p>\n<p>The file <em>without the prefix</em> is still being published to avoid breaking any setups that may be consuming it. Starting at 2.0, the unprefixed file will no longer be published.</p>\n<p>For details, see <a href=\"https://github.com/electron/electron/pull/6986\">6986</a> and <a href=\"https://github.com/electron/electron/pull/7189\">7189</a>.</p>",
      "title": "Breaking Changes",
      "description": ""
    },
    "/docs/api/browser-view": {
      "locale": "pt-BR",
      "slug": "browser-view",
      "href": "/docs/api/browser-view",
      "crowdinFileId": "256283",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-view.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"browserview\"><a href=\"#browserview\">BrowserView</a></h1>\n<p>Uma <code>BrowserView</code> pode ser usado para transformar um conteúdo web em</p>\n<p>BrowserWindow<code>. Ela é como uma janela filha, exceto que ela está posicionada em relação à janela a que pertence. Isso quer dizer que ela pretende ser uma alternativa à tag &#x3C;code>webview</code>.</p> <p></p>\n<h2 id=\"class-browserview\"><a href=\"#class-browserview\">Class: BrowserView</a></h2>\n<blockquote>\n<p>Cria e controla views.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h3 id=\"exemplo\"><a href=\"#exemplo\">Exemplo</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// No processo main.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserView, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-keyword\">const</span> view = <span class=\"hljs-keyword\">new</span> BrowserView()\nwin.setBrowserView(view)\nview.setBounds({ <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">0</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">0</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">300</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">300</span> })\nview.webContents.loadURL(<span class=\"hljs-string\">'https://electronjs.org'</span>)\n</code></pre>\n<h3 id=\"new-browserviewoptions-experimental\"><a href=\"#new-browserviewoptions-experimental\"><code>new BrowserView([options])</code> <em>Experimental</em></a></h3>\n<ul>\n<li>Objeto <code>options</code> (opcional) <ul>\n<li><code>webPreferences</code> Objeto (opcional) - Veja <a href=\"/docs/api/browser-window\">BrowserWindow</a>.</li>\n</ul></li>\n</ul>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<p>Objectos criados com <code>new BrowserView</code> posuem as seguintes propriedades:</p>\n<h4 id=\"viewwebcontents-experimental\"><a href=\"#viewwebcontents-experimental\"><code>view.webContents</code> <em>Experimental</em></a></h4>\n<p>Um objeto <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> que pertence à esta vizualização.</p>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<p>Objectos criados com <code>new BrowserView</code> possuem os seguintes métodos de instâncias:</p>\n<h4 id=\"viewsetautoresizeoptions-experimental\"><a href=\"#viewsetautoresizeoptions-experimental\"><code>view.setAutoResize(options)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>options</code> Object <ul>\n<li><code>width</code> Boolean (optional) - If <code>true</code>, the view's width will grow and shrink together with the window. <code>false</code> by default.</li>\n<li><code>height</code> Boolean (optional) - If <code>true</code>, the view's height will grow and shrink together with the window. <code>false</code> by default.</li>\n<li><code>horizontal</code> Boolean (optional) - If <code>true</code>, the view's x position and width will grow and shrink proportionally with the window. <code>false</code> by default.</li>\n<li><code>vertical</code> Boolean (optional) - If <code>true</code>, the view's y position and height will grow and shrink proportionally with the window. <code>false</code> by default.</li>\n</ul></li>\n</ul>\n<h4 id=\"viewsetboundsbounds-experimental\"><a href=\"#viewsetboundsbounds-experimental\"><code>view.setBounds(bounds)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Retângulo</a></li>\n</ul>\n<p>Resizes and moves the view to the supplied bounds relative to the window.</p>\n<h4 id=\"viewgetbounds-experimental\"><a href=\"#viewgetbounds-experimental\"><code>view.getBounds()</code> <em>Experimental</em></a></h4>\n<p>Retorna <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>The <code>bounds</code> of this BrowserView instance as <code>Object</code>.</p>\n<h4 id=\"viewsetbackgroundcolorcolor-experimental\"><a href=\"#viewsetbackgroundcolorcolor-experimental\"><code>view.setBackgroundColor(color)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>color</code> String - Color in <code>#aarrggbb</code> or <code>#argb</code> form. The alpha channel is optional.</li>\n</ul>",
      "title": "BrowserView",
      "description": "Cria e controla views."
    },
    "/docs/api/browser-window": {
      "locale": "pt-BR",
      "slug": "browser-window",
      "href": "/docs/api/browser-window",
      "crowdinFileId": "256287",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-window.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"browserwindow\"><a href=\"#browserwindow\">BrowserWindow</a></h1>\n<blockquote>\n<p>Crier e controle janelas de navegação.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// No processo main.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-comment\">// Load a remote URL</span>\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\n<span class=\"hljs-comment\">// Or load a local HTML file</span>\nwin.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n</code></pre>\n<h2 id=\"janela-sem-frame\"><a href=\"#janela-sem-frame\">Janela sem frame</a></h2>\n<p>Para criar uma janela sem frame ou uma janela transparente de formato arbitrário, use a API <a href=\"/docs/api/frameless-window\">Frameless Window</a>.</p>\n<h2 id=\"showing-the-window-gracefully\"><a href=\"#showing-the-window-gracefully\">Showing the window gracefully</a></h2>\n<p>When loading a page in the window directly, users may see the page load incrementally, which is not a good experience for a native app. To make the window display without a visual flash, there are two solutions for different situations.</p>\n<h3 id=\"using-the-ready-to-show-event\"><a href=\"#using-the-ready-to-show-event\">Using the <code>ready-to-show</code> event</a></h3>\n<p>Enquanto a página é carregada, o evento <code>ready-to-show</code> será disparado quando o processo de renderização estiver renderizado completamente a página pela primeira vez, caso a janela ainda não tenha sido exibida. Exibindo a janela após este evento não resultará em um flash visual:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span> })\nwin.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => {\n  win.show()\n})\n</code></pre>\n<p>Este evento geralmente é emitido depois do evento <code>did-finish-load</code>, porém para páginas com vários recursos remotos, tal evento pode ser emitido antes.</p>\n<p>Please note that using this event implies that the renderer will be considered \"visible\" and paint even though <code>show</code> is false.  This event will never fire if you use <code>paintWhenInitiallyHidden: false</code></p>\n<h3 id=\"setting-the-backgroundcolor-property\"><a href=\"#setting-the-backgroundcolor-property\">Setting the <code>backgroundColor</code> property</a></h3>\n<p>Para um aplicativo complexo, o evento <code>ready-to-show</code> poderia ser emitido tarde demais, fazendo com que o aplicativo aparente lentidão. Neste caso, é recomendado exibir a janela imediatamente e utilizar a propriedade <code>backgroundColor</code> com cor semelhante a cor de fundo do seu aplicativo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#2e2c29'</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<p>Note que mesmo para aplicativos que utilizam o evento <code>ready-to-show</code>, é recomendado informar a propriedade <code>backgroundColor</code> para fazer com que o aplicativo passe a sensação de um aplicativo nativo.</p>\n<h2 id=\"janelas-parent-e-child\"><a href=\"#janelas-parent-e-child\">Janelas parent e child</a></h2>\n<p>Ao utilizar a opção <code>parent</code>, é possível criar janelas secundarias:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> top = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n<span class=\"hljs-keyword\">const</span> child = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">parent</span>: top })\nchild.show()\ntop.show()\n</code></pre>\n<p>A janela secundaria (<code>child</code>) sempre será exibida em frente a janela principal (<code>top</code>).</p>\n<h2 id=\"janelas-modais\"><a href=\"#janelas-modais\">Janelas Modais</a></h2>\n<p>Uma janela modal é uma janela secundaria que desabilita a janela principal, para criar uma janela moda, você deve especificar ambas opções <code>parent</code> e <code>modal</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> child = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">parent</span>: top, <span class=\"hljs-attr\">modal</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span> })\nchild.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\nchild.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => {\n  child.show()\n})\n</code></pre>\n<h2 id=\"visibilidade-de-página\"><a href=\"#visibilidade-de-página\">Visibilidade de página</a></h2>\n<p>A <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API\">API de visibilidade de página</a> funciona da seguinte forma:</p>\n<ul>\n<li>Em todas as plataformas, o estado de visibilidade verifica quando a janela é ocultada/minimizada ou não.</li>\n<li>Adicionalmente, no macOS, o estado de visibilidade também verifica o estado de oclusão da janela. Se a janela estive obstruída (ou seja, completamente coberta) por outra janela, o estado de visibilidade será <code>hidden</code>. Em outras plataformas, o estado de visibilidade será <code>hidden</code> somente quando a janela for minimizada ou explicitamente ocultada com o método <code>win.hide()</code>.</li>\n<li>Se um <code>BrowserWindow</code> é criado com a propriedade <code>show: false</code>, a visibilidade inicial será <code>visible</code> independente da janela estar de fato ocultada.</li>\n<li>Se a propriedade <code>backgroundThrottling</code> estive desativado, o estado de visibilidade continuará <code>visible</code> mesmo que a janela esteja minimizada, ocultada ou escondida.</li>\n</ul>\n<p>É recomendado que você pause operações \"caras\" quando o estado de visibilidadade for <code>hidden</code> com o objetivo de minimizar o consumo de energia.</p>\n<h2 id=\"avisos-de-plataformas\"><a href=\"#avisos-de-plataformas\">Avisos de plataformas</a></h2>\n<ul>\n<li>No macOS, janelas modal serão exibidas como \"folhas\" vinculadas a janela principal.</li>\n<li>No macOS, as janelas secundarias manterão a posição relativa com a janela principal quando a mesma se mover, enquanto que no Windows e Linux as janelas secundarias não se movem.</li>\n<li>No Linux, o tipo de janelas modais será modificado para <code>dialog</code>.</li>\n<li>No Linux, vários ambientes desktop não há suporte para esconder uma janela modal.</li>\n</ul>\n<h2 id=\"class-browserwindow\"><a href=\"#class-browserwindow\">Class: BrowserWindow</a></h2>\n<blockquote>\n<p>Crier e controle janelas de navegação.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>BrowserWindow</code> é um <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p>O mesmo cria um novo <code>BrowserWindow</code> com propriedades nativas informadas como a opção <code>options</code>.</p>\n<h3 id=\"new-browserwindowoptions\"><a href=\"#new-browserwindowoptions\"><code>new BrowserWindow([options])</code></a></h3>\n<ul>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>width</code> Integer (optional) - Window's width in pixels. Por padrão é <code>800</code>.</li>\n<li><code>height</code> Integer (optional) - Window's height in pixels. Por padrão é <code>600</code>.</li>\n<li><code>x</code> Integer (optional) - (<strong>required</strong> if y is used) Window's left offset from screen. Default is to center the window.</li>\n<li><code>y</code> Integer (optional) - (<strong>required</strong> if x is used) Window's top offset from screen. Default is to center the window.</li>\n<li><code>useContentSize</code> Boolean (optional) - The <code>width</code> and <code>height</code> would be used as web page's size, which means the actual window's size will include window frame's size and be slightly larger. Por padrão é <code>false</code>.</li>\n<li><code>center</code> Boolean (opcional) - Mostra a janela no centro da tela.</li>\n<li><code>minWidth</code> Integer (optional) - Window's minimum width. Por padrão é <code>0</code>.</li>\n<li><code>minHeight</code> Integer (optional) - Window's minimum height. Por padrão é <code>0</code>.</li>\n<li><code>maxWidth</code> Integer (optional) - Window's maximum width. Default is no limit.</li>\n<li><code>maxHeight</code> Integer (optional) - Window's maximum height. Default is no limit.</li>\n<li><code>resizable</code> Boolean (optional) - Whether window is resizable. Por padrão é <code>true</code>.</li>\n<li><code>movable</code> Boolean (optional) - Whether window is movable. This is not implemented on Linux. Por padrão é <code>true</code>.</li>\n<li><code>minimizable</code> Boolean (optional) - Whether window is minimizable. This is not implemented on Linux. Por padrão é <code>true</code>.</li>\n<li><code>maximizable</code> Boolean (optional) - Whether window is maximizable. This is not implemented on Linux. Por padrão é <code>true</code>.</li>\n<li><code>closable</code> Boolean (optional) - Whether window is closable. This is not implemented on Linux. Por padrão é <code>true</code>.</li>\n<li><code>focusable</code> Boolean (optional) - Whether the window can be focused. Default is <code>true</code>. On Windows setting <code>focusable: false</code> also implies setting <code>skipTaskbar: true</code>. On Linux setting <code>focusable: false</code> makes the window stop interacting with wm, so the window will always stay on top in all workspaces.</li>\n<li><code>alwaysOnTop</code> Boolean (optional) - Whether the window should always stay on top of other windows. Por padrão é <code>false</code>.</li>\n<li><code>fullscreen</code> Boolean (optional) - Whether the window should show in fullscreen. When explicitly set to <code>false</code> the fullscreen button will be hidden or disabled on macOS. Por padrão é <code>false</code>.</li>\n<li><code>fullscreenable</code> Boolean (optional) - Whether the window can be put into fullscreen mode. On macOS, also whether the maximize/zoom button should toggle full screen mode or maximize window. Por padrão é <code>true</code>.</li>\n<li><code>simpleFullscreen</code> Boolean (optional) - Use pre-Lion fullscreen on macOS. Por padrão é <code>false</code>.</li>\n<li><code>skipTaskbar</code> Boolean (optional) - Whether to show the window in taskbar. Default is <code>false</code>.</li>\n<li><code>kiosk</code> Boolean (optional) - Whether the window is in kiosk mode. Por padrão é <code>false</code>.</li>\n<li><code>title</code> String (optional) - Default window title. Por padrão é <code>\"Electron\"</code>. If the HTML tag <code>&#x3C;title></code> is defined in the HTML file loaded by <code>loadURL()</code>, this property will be ignored.</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (optional) - The window icon. On Windows it is recommended to use <code>ICO</code> icons to get best visual effects, you can also leave it undefined so the executable's icon will be used.</li>\n<li><code>show</code> Boolean (optional) - Whether window should be shown when created. Default is <code>true</code>.</li>\n<li><code>paintWhenInitiallyHidden</code> Boolean (optional) - Whether the renderer should be active when <code>show</code> is <code>false</code> and it has just been created.  In order for <code>document.visibilityState</code> to work correctly on first load with <code>show: false</code> you should set this to <code>false</code>.  Setting this to <code>false</code> will cause the <code>ready-to-show</code> event to not fire.  Por padrão é <code>true</code>.</li>\n<li><code>frame</code> Boolean (optional) - Specify <code>false</code> to create a <a href=\"/docs/api/frameless-window\">Frameless Window</a>. Por padrão é <code>true</code>.</li>\n<li><code>parent</code> BrowserWindow (optional) - Specify parent window. Por padrão é <code>null</code>.</li>\n<li><code>modal</code> Boolean (optional) - Whether this is a modal window. This only works when the window is a child window. Por padrão é <code>false</code>.</li>\n<li><code>acceptFirstMouse</code> Boolean (optional) - Whether clicking an inactive window will also click through to the web contents. Default is <code>false</code> on macOS. This option is not configurable on other platforms.</li>\n<li><code>disableAutoHideCursor</code> Boolean (optional) - Whether to hide cursor when typing. Por padrão é <code>false</code>.</li>\n<li><code>autoHideMenuBar</code> Boolean (optional) - Auto hide the menu bar unless the <code>Alt</code> key is pressed. Por padrão é <code>false</code>.</li>\n<li><code>enableLargerThanScreen</code> Boolean (optional) - Enable the window to be resized larger than screen. Only relevant for macOS, as other OSes allow larger-than-screen windows by default. Por padrão é <code>false</code>.</li>\n<li><code>backgroundColor</code> String (optional) - Window's background color as a hexadecimal value, like <code>#66CD00</code> or <code>#FFF</code> or <code>#80FFFFFF</code> (alpha in #AARRGGBB format is supported if <code>transparent</code> is set to <code>true</code>). Default is <code>#FFF</code> (white).</li>\n<li><code>hasShadow</code> Boolean (optional) - Whether window should have a shadow. Por padrão é <code>true</code>.</li>\n<li><code>opacity</code> Number (optional) - Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0 (fully opaque). This is only implemented on Windows and macOS.</li>\n<li><code>darkTheme</code> Boolean (optional) - Forces using dark theme for the window, only works on some GTK+3 desktop environments. Por padrão é <code>false</code>.</li>\n<li><code>transparent</code> Boolean (optional) - Makes the window <a href=\"/docs/api/frameless-window#transparent-window\">transparent</a>. Por padrão é <code>false</code>. On Windows, does not work unless the window is frameless.</li>\n<li><code>type</code> String (optional) - The type of window, default is normal window. See more about this below.</li>\n<li><code>visualEffectState</code> String (optional) - Specify how the material appearance should reflect window activity state on macOS. Must be used with the <code>vibrancy</code> property. Possible values are:<ul>\n<li><code>followWindow</code> - The backdrop should automatically appear active when the window is active, and inactive when it is not. This is the default.</li>\n<li><code>active</code> - The backdrop should always appear active.</li>\n<li><code>inactive</code> - The backdrop should always appear inactive.</li>\n</ul></li>\n<li><code>titleBarStyle</code> String (optional) <em>macOS</em> <em>Windows</em> - The style of window title bar. Por padrão é <code>default</code>. Possible values are:<ul>\n<li><code>default</code> - Results in the standard title bar for macOS or Windows respectively.</li>\n<li><code>hidden</code> - Results in a hidden title bar and a full size content window. On macOS, the window still has the standard window controls (“traffic lights”) in the top left. On Windows, when combined with <code>titleBarOverlay: true</code> it will activate the Window Controls Overlay (see <code>titleBarOverlay</code> for more information), otherwise no window controls will be shown.</li>\n<li><code>hiddenInset</code> - Only on macOS, results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge.</li>\n<li><code>customButtonsOnHover</code> - Only on macOS, results in a hidden title bar and a full size content window, the traffic light buttons will display when being hovered over in the top left of the window.  <strong>Note:</strong> This option is currently experimental.</li>\n</ul></li>\n<li><code>trafficLightPosition</code> <a href=\"/docs/api/structures/point\">Point</a> (optional) - Set a custom position for the traffic light buttons in frameless windows.</li>\n<li><code>roundedCorners</code> Boolean (optional) - Whether frameless window should have rounded corners on macOS. Por padrão é <code>true</code>.</li>\n<li><code>fullscreenWindowTitle</code> Boolean (optional) <em>Deprecated</em> - Shows the title in the title bar in full screen mode on macOS for <code>hiddenInset</code> titleBarStyle. Por padrão é <code>false</code>.</li>\n<li><code>thickFrame</code> Boolean (optional) - Use <code>WS_THICKFRAME</code> style for frameless windows on Windows, which adds standard window frame. Setting it to <code>false</code> will remove window shadow and window animations. Por padrão é <code>true</code>.</li>\n<li><code>vibrancy</code> String (optional) - Add a type of vibrancy effect to the window, only on macOS. Can be <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>titlebar</code>, <code>selection</code>, <code>menu</code>, <code>popover</code>, <code>sidebar</code>, <code>medium-light</code>, <code>ultra-dark</code>, <code>header</code>, <code>sheet</code>, <code>window</code>, <code>hud</code>, <code>fullscreen-ui</code>, <code>tooltip</code>, <code>content</code>, <code>under-window</code>, or <code>under-page</code>. Please note that <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>medium-light</code>, and <code>ultra-dark</code> are deprecated and have been removed in macOS Catalina (10.15).</li>\n<li><code>zoomToPageWidth</code> Boolean (optional) - Controls the behavior on macOS when option-clicking the green stoplight button on the toolbar or by clicking the Window > Zoom menu item. If <code>true</code>, the window will grow to the preferred width of the web page when zoomed, <code>false</code> will cause it to zoom to the width of the screen. This will also affect the behavior when calling <code>maximize()</code> directly. Por padrão é <code>false</code>.</li>\n<li><code>tabbingIdentifier</code> String (optional) - Tab group name, allows opening the window as a native tab on macOS 10.12+. Windows with the same tabbing identifier will be grouped together. This also adds a native new tab button to your window's tab bar and allows your <code>app</code> and window to receive the <code>new-window-for-tab</code> event.</li>\n<li><code>webPreferences</code> Object (optional) - Settings of web page's features.<ul>\n<li><code>devTools</code> Boolean (optional) - Whether to enable DevTools. If it is set to <code>false</code>, can not use <code>BrowserWindow.webContents.openDevTools()</code> to open DevTools. Por padrão é <code>true</code>.</li>\n<li><code>nodeIntegration</code> Boolean (optional) - Whether node integration is enabled. Por padrão é <code>false</code>.</li>\n<li><code>nodeIntegrationInWorker</code> Boolean (optional) - Whether node integration is enabled in web workers. Por padrão é <code>false</code>. More about this can be found in <a href=\"/docs/tutorial/multithreading\">Multithreading</a>.</li>\n<li><code>nodeIntegrationInSubFrames</code> Boolean (optional) - Experimental option for enabling Node.js support in sub-frames such as iframes and child windows. All your preloads will load for every iframe, you can use <code>process.isMainFrame</code> to determine if you are in the main frame or not.</li>\n<li><code>preload</code> String (optional) - Specifies a script that will be loaded before other scripts run in the page. This script will always have access to node APIs no matter whether node integration is turned on or off. The value should be the absolute file path to the script. When node integration is turned off, the preload script can reintroduce Node global symbols back to the global scope. See example <a href=\"/docs/api/context-bridge#exposing-node-global-symbols\">here</a>.</li>\n<li><code>sandbox</code> Boolean (optional) - If set, this will sandbox the renderer associated with the window, making it compatible with the Chromium OS-level sandbox and disabling the Node.js engine. This is not the same as the <code>nodeIntegration</code> option and the APIs available to the preload script are more limited. Read more about the option <a href=\"/docs/tutorial/sandbox\">here</a>.</li>\n<li><code>session</code> <a href=\"/docs/api/session#class-session\">Session</a> (optional) - Sets the session used by the page. Instead of passing the Session object directly, you can also choose to use the <code>partition</code> option instead, which accepts a partition string. When both <code>session</code> and <code>partition</code> are provided, <code>session</code> will be preferred. Default is the default session.</li>\n<li><code>partition</code> String (optional) - Sets the session used by the page according to the session's partition string. If <code>partition</code> starts with <code>persist:</code>, the page will use a persistent session available to all pages in the app with the same <code>partition</code>. If there is no <code>persist:</code> prefix, the page will use an in-memory session. By assigning the same <code>partition</code>, multiple pages can share the same session. Default is the default session.</li>\n<li><code>zoomFactor</code> Number (optional) - The default zoom factor of the page, <code>3.0</code> represents <code>300%</code>. Por padrão é <code>1.0</code>.</li>\n<li><code>javascript</code> Boolean (optional) - Enables JavaScript support. Por padrão é <code>true</code>.</li>\n<li><code>webSecurity</code> Boolean (optional) - When <code>false</code>, it will disable the same-origin policy (usually using testing websites by people), and set <code>allowRunningInsecureContent</code> to <code>true</code> if this options has not been set by user. Por padrão é <code>true</code>.</li>\n<li><code>allowRunningInsecureContent</code> Boolean (optional) - Allow an https page to run JavaScript, CSS or plugins from http URLs. Por padrão é <code>false</code>.</li>\n<li><code>images</code> Boolean (optional) - Enables image support. Por padrão é <code>true</code>.</li>\n<li><code>imageAnimationPolicy</code> String (optional) - Specifies how to run image animations (E.g. GIFs).  Can be <code>animate</code>, <code>animateOnce</code> or <code>noAnimation</code>.  Padrão é <code>animate</code>.</li>\n<li><code>textAreasAreResizable</code> Boolean (optional) - Make TextArea elements resizable. Default is <code>true</code>.</li>\n<li><code>webgl</code> Boolean (optional) - Enables WebGL support. Por padrão é <code>true</code>.</li>\n<li><code>plugins</code> Boolean (optional) - Whether plugins should be enabled. Por padrão é <code>false</code>.</li>\n<li><code>experimentalFeatures</code> Boolean (optional) - Enables Chromium's experimental features. Por padrão é <code>false</code>.</li>\n<li><code>scrollBounce</code> Boolean (optional) - Enables scroll bounce (rubber banding) effect on macOS. Por padrão é <code>false</code>.</li>\n<li><code>enableBlinkFeatures</code> String (optional) - A list of feature strings separated by <code>,</code>, like <code>CSSVariables,KeyboardEventKey</code> to enable. The full list of supported feature strings can be found in the <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> file.</li>\n<li><code>disableBlinkFeatures</code> String (optional) - A list of feature strings separated by <code>,</code>, like <code>CSSVariables,KeyboardEventKey</code> to disable. The full list of supported feature strings can be found in the <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> file.</li>\n<li><code>defaultFontFamily</code> Object (optional) - Sets the default font for the font-family.<ul>\n<li><code>standard</code> String (optional) - Defaults to <code>Times New Roman</code>.</li>\n<li><code>serif</code> String (optional) - Defaults to <code>Times New Roman</code>.</li>\n<li><code>sansSerif</code> String (optional) - Defaults to <code>Arial</code>.</li>\n<li><code>monospace</code> String (optional) - Defaults to <code>Courier New</code>.</li>\n<li><code>cursive</code> String (optional) - Defaults to <code>Script</code>.</li>\n<li><code>fantasy</code> String (optional) - Defaults to <code>Impact</code>.</li>\n</ul></li>\n<li><code>defaultFontSize</code> Integer (optional) - Defaults to <code>16</code>.</li>\n<li><code>defaultMonospaceFontSize</code> Integer (optional) - Defaults to <code>13</code>.</li>\n<li><code>minimumFontSize</code> Integer (optional) - Defaults to <code>0</code>.</li>\n<li><code>defaultEncoding</code> String (optional) - Defaults to <code>ISO-8859-1</code>.</li>\n<li><code>backgroundThrottling</code> Boolean (optional) - Whether to throttle animations and timers when the page becomes background. This also affects the <a href=\"#page-visibility\">Page Visibility API</a>. Defaults to <code>true</code>.</li>\n<li><code>offscreen</code> Boolean (optional) - Whether to enable offscreen rendering for the browser window. Defaults to <code>false</code>. See the <a href=\"/docs/tutorial/offscreen-rendering\">offscreen rendering tutorial</a> for more details.</li>\n<li><code>contextIsolation</code> Boolean (optional) - Whether to run Electron APIs and the specified <code>preload</code> script in a separate JavaScript context. Defaults to <code>true</code>. The context that the <code>preload</code> script runs in will only have access to its own dedicated <code>document</code> and <code>window</code> globals, as well as its own set of JavaScript builtins (<code>Array</code>, <code>Object</code>, <code>JSON</code>, etc.), which are all invisible to the loaded content. The Electron API will only be available in the <code>preload</code> script and not the loaded page. This option should be used when loading potentially untrusted remote content to ensure the loaded content cannot tamper with the <code>preload</code> script and any Electron APIs being used.  This option uses the same technique used by <a href=\"https://developer.chrome.com/extensions/content_scripts#execution-environment\">Chrome Content Scripts</a>.  You can access this context in the dev tools by selecting the 'Electron Isolated Context' entry in the combo box at the top of the Console tab.</li>\n<li><code>nativeWindowOpen</code> Boolean (optional) - Whether to use native <code>window.open()</code>. Defaults to <code>true</code>. Child windows will always have node integration disabled unless <code>nodeIntegrationInSubFrames</code> is true.</li>\n<li><code>webviewTag</code> Boolean (optional) - Whether to enable the <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code> tag</a>. Defaults to <code>false</code>. <strong>Note:</strong> The <code>preload</code> script configured for the <code>&#x3C;webview></code> will have node integration enabled when it is executed so you should ensure remote/untrusted content is not able to create a <code>&#x3C;webview></code> tag with a possibly malicious <code>preload</code> script. You can use the <code>will-attach-webview</code> event on <a href=\"/docs/api/web-contents\">webContents</a> to strip away the <code>preload</code> script and to validate or alter the <code>&#x3C;webview></code>'s initial settings.</li>\n<li><code>additionalArguments</code> String<a href=\"/docs/api/optional\"></a> - A list of strings that will be appended to <code>process.argv</code> in the renderer process of this app.  Useful for passing small bits of data down to renderer process preload scripts.</li>\n<li><code>safeDialogs</code> Boolean (optional) - Whether to enable browser style consecutive dialog protection. Por padrão é <code>false</code>.</li>\n<li><code>safeDialogsMessage</code> String (optional) - The message to display when consecutive dialog protection is triggered. If not defined the default message would be used, note that currently the default message is in English and not localized.</li>\n<li><code>disableDialogs</code> Boolean (optional) - Whether to disable dialogs completely. Overrides <code>safeDialogs</code>. Por padrão é <code>false</code>.</li>\n<li><code>navigateOnDragDrop</code> Boolean (optional) - Whether dragging and dropping a file or link onto the page causes a navigation. Por padrão é <code>false</code>.</li>\n<li><code>autoplayPolicy</code> String (optional) - Autoplay policy to apply to content in the window, can be <code>no-user-gesture-required</code>, <code>user-gesture-required</code>, <code>document-user-activation-required</code>. Padrão sendo <code>no-user-gesture-required</code>.</li>\n<li><code>disableHtmlFullscreenWindowResize</code> Boolean (optional) - Whether to prevent the window from resizing when entering HTML Fullscreen. Default is <code>false</code>.</li>\n<li><code>accessibleTitle</code> String (optional) - An alternative title string provided only to accessibility tools such as screen readers. This string is not directly visible to users.</li>\n<li><code>spellcheck</code> Boolean (optional) - Whether to enable the builtin spellchecker. Por padrão é <code>true</code>.</li>\n<li><code>enableWebSQL</code> Boolean (optional) - Whether to enable the <a href=\"https://www.w3.org/TR/webdatabase/\">WebSQL api</a>. Por padrão é <code>true</code>.</li>\n<li><code>v8CacheOptions</code> String (optional) - Enforces the v8 code caching policy used by blink. Accepted values are<ul>\n<li><code>none</code> - Disables code caching</li>\n<li><code>code</code> - Heuristic based code caching</li>\n<li><code>bypassHeatCheck</code> - Bypass code caching heuristics but with lazy compilation</li>\n<li><code>bypassHeatCheckAndEagerCompile</code> - Same as above except compilation is eager. Default policy is <code>code</code>.</li>\n</ul></li>\n<li><code>enablePreferredSizeMode</code> Boolean (optional) - Whether to enable preferred size mode. The preferred size is the minimum size needed to contain the layout of the document—without requiring scrolling. Enabling this will cause the <code>preferred-size-changed</code> event to be emitted on the <code>WebContents</code> when the preferred size changes. Por padrão é <code>false</code>.</li>\n</ul></li>\n<li><code>titleBarOverlay</code> Object | Boolean (optional) -  When using a frameless window in conjuction with <code>win.setWindowButtonVisibility(true)</code> on macOS or using a <code>titleBarStyle</code> so that the standard window controls (\"traffic lights\" on macOS) are visible, this property enables the Window Controls Overlay <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis\">JavaScript APIs</a> and <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables\">CSS Environment Variables</a>. Specifying <code>true</code> will result in an overlay with default system colors. Por padrão é <code>false</code>.<ul>\n<li><code>color</code> String (optional) <em>Windows</em> - The CSS color of the Window Controls Overlay when enabled. Default is the system color.</li>\n<li><code>symbolColor</code> String (optional) <em>Windows</em> - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>When setting minimum or maximum window size with <code>minWidth</code>/<code>maxWidth</code>/ <code>minHeight</code>/<code>maxHeight</code>, it only constrains the users. It won't prevent you from passing a size that does not follow size constraints to <code>setBounds</code>/<code>setSize</code> or to the constructor of <code>BrowserWindow</code>.</p>\n<p>The possible values and behaviors of the <code>type</code> option are platform dependent. Possible values are:</p>\n<ul>\n<li>On Linux, possible types are <code>desktop</code>, <code>dock</code>, <code>toolbar</code>, <code>splash</code>, <code>notification</code>.</li>\n<li>On macOS, possible types are <code>desktop</code>, <code>textured</code>.<ul>\n<li>The <code>textured</code> type adds metal gradient appearance (<code>NSTexturedBackgroundWindowMask</code>).</li>\n<li>The <code>desktop</code> type places the window at the desktop background window level (<code>kCGDesktopWindowLevel - 1</code>). Note that desktop window will not receive focus, keyboard or mouse events, but you can use <code>globalShortcut</code> to receive input sparingly.</li>\n</ul></li>\n<li>On Windows, possible type is <code>toolbar</code>.</li>\n</ul>\n<h3 id=\"eventos-de-instância\"><a href=\"#eventos-de-instância\">Eventos de instância</a></h3>\n<p>Objects created with <code>new BrowserWindow</code> emit the following events:</p>\n<p><strong>Note:</strong> Some events are only available on specific operating systems and are labeled as such.</p>\n<h4 id=\"evento-page-title-updated\"><a href=\"#evento-page-title-updated\">Evento: 'page-title-updated'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>Emitido quando o documento mudou seu título, chamando <code>event.preventDefault()</code> impedirá que o título da janela nativa mude. <code>explicitSet</code> is false when title is synthesized from file URL.</p>\n<h4 id=\"evento-close\"><a href=\"#evento-close\">Evento: 'close'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the window is going to be closed. It's emitted before the <code>beforeunload</code> and <code>unload</code> event of the DOM. Calling <code>event.preventDefault()</code> will cancel the close.</p>\n<p>Usually you would want to use the <code>beforeunload</code> handler to decide whether the window should be closed, which will also be called when the window is reloaded. In Electron, returning any value other than <code>undefined</code> would cancel the close. Como por exemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-built_in\">window</span>.onbeforeunload = <span class=\"hljs-function\">(<span class=\"hljs-params\">e</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'I do not want to be closed'</span>)\n\n  <span class=\"hljs-comment\">// Unlike usual browsers that a message box will be prompted to users, returning</span>\n  <span class=\"hljs-comment\">// a non-void value will silently cancel the close.</span>\n  <span class=\"hljs-comment\">// It is recommended to use the dialog API to let the user confirm closing the</span>\n  <span class=\"hljs-comment\">// application.</span>\n  e.returnValue = <span class=\"hljs-literal\">false</span> <span class=\"hljs-comment\">// equivalent to `return false` but not recommended</span>\n}\n</code></pre>\n<p><em><strong>Note</strong>: There is a subtle difference between the behaviors of <code>window.onbeforeunload = handler</code> and <code>window.addEventListener('beforeunload', handler)</code>. It is recommended to always set the <code>event.returnValue</code> explicitly, instead of only returning a value, as the former works more consistently within Electron.</em></p>\n<h4 id=\"evento-closed\"><a href=\"#evento-closed\">Evento: 'closed'</a></h4>\n<p>Emitted when the window is closed. After you have received this event you should remove the reference to the window and avoid using it any more.</p>\n<h4 id=\"evento-session-end-windows\"><a href=\"#evento-session-end-windows\">Evento: 'session-end' <em>Windows</em></a></h4>\n<p>Emitted when window session is going to end due to force shutdown or machine restart or session log off.</p>\n<h4 id=\"evento-unresponsive\"><a href=\"#evento-unresponsive\">Evento: 'unresponsive'</a></h4>\n<p>Emitted when the web page becomes unresponsive.</p>\n<h4 id=\"evento-responsive\"><a href=\"#evento-responsive\">Evento: 'responsive'</a></h4>\n<p>Emitted when the unresponsive web page becomes responsive again.</p>\n<h4 id=\"evento-blur\"><a href=\"#evento-blur\">Evento: 'blur'</a></h4>\n<p>Emitted when the window loses focus.</p>\n<h4 id=\"evento-focus\"><a href=\"#evento-focus\">Evento: 'focus'</a></h4>\n<p>Emitted when the window gains focus.</p>\n<h4 id=\"evento-show\"><a href=\"#evento-show\">Evento: 'show'</a></h4>\n<p>Emitted when the window is shown.</p>\n<h4 id=\"evento-hide\"><a href=\"#evento-hide\">Evento: 'hide'</a></h4>\n<p>Emitted when the window is hidden.</p>\n<h4 id=\"evento-ready-to-show\"><a href=\"#evento-ready-to-show\">Evento: 'ready-to-show'</a></h4>\n<p>Emitted when the web page has been rendered (while not being shown) and window can be displayed without a visual flash.</p>\n<p>Please note that using this event implies that the renderer will be considered \"visible\" and paint even though <code>show</code> is false.  This event will never fire if you use <code>paintWhenInitiallyHidden: false</code></p>\n<h4 id=\"evento-maximize\"><a href=\"#evento-maximize\">Evento: 'maximize'</a></h4>\n<p>Emitted when window is maximized.</p>\n<h4 id=\"evento-unmaximize\"><a href=\"#evento-unmaximize\">Evento: 'unmaximize'</a></h4>\n<p>Emitted when the window exits from a maximized state.</p>\n<h4 id=\"evento-minimize\"><a href=\"#evento-minimize\">Evento: 'minimize'</a></h4>\n<p>Emitted when the window is minimized.</p>\n<h4 id=\"evento-restore\"><a href=\"#evento-restore\">Evento: 'restore'</a></h4>\n<p>Emitted when the window is restored from a minimized state.</p>\n<h4 id=\"event-will-resize-macos-windows\"><a href=\"#event-will-resize-macos-windows\">Event: 'will-resize' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newBounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Size the window is being resized to.</li>\n<li>Objeto <code>details</code><ul>\n<li><code>edge</code> (String) - The edge of the window being dragged for resizing. Can be <code>bottom</code>, <code>left</code>, <code>right</code>, <code>top-left</code>, <code>top-right</code>, <code>bottom-left</code> or <code>bottom-right</code>.</li>\n</ul></li>\n</ul>\n<p>Emitted before the window is resized. Calling <code>event.preventDefault()</code> will prevent the window from being resized.</p>\n<p>Note that this is only emitted when the window is being resized manually. Resizing the window with <code>setBounds</code>/<code>setSize</code> will not emit this event.</p>\n<p>The possible values and behaviors of the <code>edge</code> option are platform dependent. Possible values are:</p>\n<ul>\n<li>On Windows, possible values are <code>bottom</code>, <code>top</code>, <code>left</code>, <code>right</code>, <code>top-left</code>, <code>top-right</code>, <code>bottom-left</code>, <code>bottom-right</code>.</li>\n<li>On macOS, possible values are <code>bottom</code> and <code>right</code>.<ul>\n<li>The value <code>bottom</code> is used to denote vertical resizing.</li>\n<li>The value <code>right</code> is used to denote horizontal resizing.</li>\n</ul></li>\n</ul>\n<h4 id=\"evento-resize\"><a href=\"#evento-resize\">Evento: 'resize'</a></h4>\n<p>Emitted after the window has been resized.</p>\n<h4 id=\"event-resized-macos-windows\"><a href=\"#event-resized-macos-windows\">Event: 'resized' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Emitted once when the window has finished being resized.</p>\n<p>This is usually emitted when the window has been resized manually. On macOS, resizing the window with <code>setBounds</code>/<code>setSize</code> and setting the <code>animate</code> parameter to <code>true</code> will also emit this event once resizing has finished.</p>\n<h4 id=\"event-will-move-macos-windows\"><a href=\"#event-will-move-macos-windows\">Event: 'will-move' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newBounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Location the window is being moved to.</li>\n</ul>\n<p>Emitted before the window is moved. On Windows, calling <code>event.preventDefault()</code> will prevent the window from being moved.</p>\n<p>Note that this is only emitted when the window is being resized manually. Resizing the window with <code>setBounds</code>/<code>setSize</code> will not emit this event.</p>\n<h4 id=\"evento-move\"><a href=\"#evento-move\">Evento: 'move'</a></h4>\n<p>Emitted when the window is being moved to a new position.</p>\n<h4 id=\"event-moved-macos-windows\"><a href=\"#event-moved-macos-windows\">Event: 'moved' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Emitted once when the window is moved to a new position.</p>\n<p><strong>Note</strong>: On macOS this event is an alias of <code>move</code>.</p>\n<h4 id=\"evento-enter-full-screen\"><a href=\"#evento-enter-full-screen\">Evento: 'enter-full-screen'</a></h4>\n<p>Emitted when the window enters a full-screen state.</p>\n<h4 id=\"evento-leave-full-screen\"><a href=\"#evento-leave-full-screen\">Evento: 'leave-full-screen'</a></h4>\n<p>Emitted when the window leaves a full-screen state.</p>\n<h4 id=\"evento-enter-html-full-screen\"><a href=\"#evento-enter-html-full-screen\">Evento: 'enter-html-full-screen'</a></h4>\n<p>Emitted when the window enters a full-screen state triggered by HTML API.</p>\n<h4 id=\"evento-leave-html-full-screen\"><a href=\"#evento-leave-html-full-screen\">Evento: 'leave-html-full-screen'</a></h4>\n<p>Emitted when the window leaves a full-screen state triggered by HTML API.</p>\n<h4 id=\"evento-always-on-top-changed\"><a href=\"#evento-always-on-top-changed\">Evento: 'always-on-top-changed'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>isAlwaysOnTop</code> Boolean</li>\n</ul>\n<p>Emitted when the window is set or unset to show always on top of other windows.</p>\n<h4 id=\"event-app-command-windows-linux\"><a href=\"#event-app-command-windows-linux\">Event: 'app-command' <em>Windows</em> <em>Linux</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>command</code> String</li>\n</ul>\n<p>Emitted when an <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/ms646275(v=vs.85).aspx\">App Command</a> is invoked. These are typically related to keyboard media keys or browser commands, as well as the \"Back\" button built into some mice on Windows.</p>\n<p>Commands are lowercased, underscores are replaced with hyphens, and the <code>APPCOMMAND_</code> prefix is stripped off. e.g. <code>APPCOMMAND_BROWSER_BACKWARD</code> is emitted as <code>browser-backward</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-comment\">// Navigate the window back when the user hits their mouse back button</span>\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'browser-backward'</span> &#x26;&#x26; win.webContents.canGoBack()) {\n    win.webContents.goBack()\n  }\n})\n</code></pre>\n<p>The following app commands are explicitly supported on Linux:</p>\n<ul>\n<li><code>browser-backward</code></li>\n<li><code>browser-forward</code></li>\n</ul>\n<h4 id=\"event-scroll-touch-begin-macos\"><a href=\"#event-scroll-touch-begin-macos\">Event: 'scroll-touch-begin' <em>macOS</em></a></h4>\n<p>Emitted when scroll wheel event phase has begun.</p>\n<h4 id=\"event-scroll-touch-end-macos\"><a href=\"#event-scroll-touch-end-macos\">Event: 'scroll-touch-end' <em>macOS</em></a></h4>\n<p>Emitted when scroll wheel event phase has ended.</p>\n<h4 id=\"event-scroll-touch-edge-macos\"><a href=\"#event-scroll-touch-edge-macos\">Event: 'scroll-touch-edge' <em>macOS</em></a></h4>\n<p>Emitted when scroll wheel event phase filed upon reaching the edge of element.</p>\n<h4 id=\"event-swipe-macos\"><a href=\"#event-swipe-macos\">Event: 'swipe' <em>macOS</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>direction</code> String</li>\n</ul>\n<p>Emitted on 3-finger swipe. Possible directions are <code>up</code>, <code>right</code>, <code>down</code>, <code>left</code>.</p>\n<p>The method underlying this event is built to handle older macOS-style trackpad swiping, where the content on the screen doesn't move with the swipe. Most macOS trackpads are not configured to allow this kind of swiping anymore, so in order for it to emit properly the 'Swipe between pages' preference in <code>System Preferences > Trackpad > More Gestures</code> must be set to 'Swipe with two or three fingers'.</p>\n<h4 id=\"event-rotate-gesture-macos\"><a href=\"#event-rotate-gesture-macos\">Event: 'rotate-gesture' <em>macOS</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>rotation</code> Float</li>\n</ul>\n<p>Emitted on trackpad rotation gesture. Continually emitted until rotation gesture is ended. The <code>rotation</code> value on each emission is the angle in degrees rotated since the last emission. The last emitted event upon a rotation gesture will always be of value <code>0</code>. Counter-clockwise rotation values are positive, while clockwise ones are negative.</p>\n<h4 id=\"event-sheet-begin-macos\"><a href=\"#event-sheet-begin-macos\">Event: 'sheet-begin' <em>macOS</em></a></h4>\n<p>Emitted when the window opens a sheet.</p>\n<h4 id=\"event-sheet-end-macos\"><a href=\"#event-sheet-end-macos\">Event: 'sheet-end' <em>macOS</em></a></h4>\n<p>Emitted when the window has closed a sheet.</p>\n<h4 id=\"evento-new-window-for-tab-macos\"><a href=\"#evento-new-window-for-tab-macos\">Evento: 'new-window-for-tab' <em>macOS</em></a></h4>\n<p>Emitted when the native new tab button is clicked.</p>\n<h4 id=\"event-system-context-menu-windows\"><a href=\"#event-system-context-menu-windows\">Event: 'system-context-menu' <em>Windows</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a> - The screen coordinates the context menu was triggered at</li>\n</ul>\n<p>Emitted when the system context menu is triggered on the window, this is normally only triggered when the user right clicks on the non-client area of your window.  This is the window titlebar or any area you have declared as <code>-webkit-app-region: drag</code> in a frameless window.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent the menu from being displayed.</p>\n<h3 id=\"métodos-estáticos\"><a href=\"#métodos-estáticos\">Métodos estáticos</a></h3>\n<p>A classe <code>BrowserWindow</code> tem os seguintes métodos estáticos:</p>\n<h4 id=\"browserwindowgetallwindows\"><a href=\"#browserwindowgetallwindows\"><code>BrowserWindow.getAllWindows()</code></a></h4>\n<p>Returns <code>BrowserWindow[]</code> - An array of all opened browser windows.</p>\n<h4 id=\"browserwindowgetfocusedwindow\"><a href=\"#browserwindowgetfocusedwindow\"><code>BrowserWindow.getFocusedWindow()</code></a></h4>\n<p>Returns <code>BrowserWindow | null</code> - The window that is focused in this application, otherwise returns <code>null</code>.</p>\n<h4 id=\"browserwindowfromwebcontentswebcontents\"><a href=\"#browserwindowfromwebcontentswebcontents\"><code>BrowserWindow.fromWebContents(webContents)</code></a></h4>\n<ul>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Returns <code>BrowserWindow | null</code> - The window that owns the given <code>webContents</code> or <code>null</code> if the contents are not owned by a window.</p>\n<h4 id=\"browserwindowfrombrowserviewbrowserview\"><a href=\"#browserwindowfrombrowserviewbrowserview\"><code>BrowserWindow.fromBrowserView(browserView)</code></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>Returns <code>BrowserWindow | null</code> - The window that owns the given <code>browserView</code>. If the given view is not attached to any window, returns <code>null</code>.</p>\n<h4 id=\"browserwindowfromidid\"><a href=\"#browserwindowfromidid\"><code>BrowserWindow.fromId(id)</code></a></h4>\n<ul>\n<li><code>id</code> Inteiro</li>\n</ul>\n<p>Returns <code>BrowserWindow | null</code> - The window with the given <code>id</code>.</p>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<p>Objectos criados com <code>new BrowserWindow</code> posuem as seguintes propriedades:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">// In this example `win` is our instance</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<h4 id=\"winwebcontents-readonly\"><a href=\"#winwebcontents-readonly\"><code>win.webContents</code> <em>Readonly</em></a></h4>\n<p>A <code>WebContents</code> object this window owns. All web page related events and operations will be done via it.</p>\n<p>See the <a href=\"/docs/api/web-contents\"><code>webContents</code> documentation</a> for its methods and events.</p>\n<h4 id=\"winid-readonly\"><a href=\"#winid-readonly\"><code>win.id</code> <em>Readonly</em></a></h4>\n<p>A <code>Integer</code> property representing the unique ID of the window. Each ID is unique among all <code>BrowserWindow</code> instances of the entire Electron application.</p>\n<h4 id=\"winautohidemenubar\"><a href=\"#winautohidemenubar\"><code>win.autoHideMenuBar</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window menu bar should hide itself automatically. Once set, the menu bar will only show when users press the single <code>Alt</code> key.</p>\n<p>If the menu bar is already visible, setting this property to <code>true</code> won't hide it immediately.</p>\n<h4 id=\"winsimplefullscreen\"><a href=\"#winsimplefullscreen\"><code>win.simpleFullScreen</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in simple (pre-Lion) fullscreen mode.</p>\n<h4 id=\"winfullscreen\"><a href=\"#winfullscreen\"><code>win.fullScreen</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in fullscreen mode.</p>\n<h4 id=\"winfocusable-windows-macos\"><a href=\"#winfocusable-windows-macos\"><code>win.focusable</code> <em>Windows</em> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is focusable.</p>\n<h4 id=\"winvisibleonallworkspaces\"><a href=\"#winvisibleonallworkspaces\"><code>win.visibleOnAllWorkspaces</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is visible on all workspaces.</p>\n<p><strong>Note:</strong> Always returns false on Windows.</p>\n<h4 id=\"winshadow\"><a href=\"#winshadow\"><code>win.shadow</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window has a shadow.</p>\n<h4 id=\"winmenubarvisible-windows-linux\"><a href=\"#winmenubarvisible-windows-linux\"><code>win.menuBarVisible</code> <em>Windows</em> <em>Linux</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the menu bar should be visible.</p>\n<p><strong>Note:</strong> If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single <code>Alt</code> key.</p>\n<h4 id=\"winkiosk\"><a href=\"#winkiosk\"><code>win.kiosk</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in kiosk mode.</p>\n<h4 id=\"windocumentedited-macos\"><a href=\"#windocumentedited-macos\"><code>win.documentEdited</code> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that specifies whether the window’s document has been edited.</p>\n<p>The icon in title bar will become gray when set to <code>true</code>.</p>\n<h4 id=\"winrepresentedfilename-macos\"><a href=\"#winrepresentedfilename-macos\"><code>win.representedFilename</code> <em>macOS</em></a></h4>\n<p>A <code>String</code> property that determines the pathname of the file the window represents, and the icon of the file will show in window's title bar.</p>\n<h4 id=\"wintitle\"><a href=\"#wintitle\"><code>win.title</code></a></h4>\n<p>A <code>String</code> property that determines the title of the native window.</p>\n<p><strong>Note:</strong> The title of the web page can be different from the title of the native window.</p>\n<h4 id=\"winminimizable\"><a href=\"#winminimizable\"><code>win.minimizable</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window can be manually minimized by user.</p>\n<p>On Linux the setter is a no-op, although the getter returns <code>true</code>.</p>\n<h4 id=\"winmaximizable\"><a href=\"#winmaximizable\"><code>win.maximizable</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window can be manually maximized by user.</p>\n<p>On Linux the setter is a no-op, although the getter returns <code>true</code>.</p>\n<h4 id=\"winfullscreenable\"><a href=\"#winfullscreenable\"><code>win.fullScreenable</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.</p>\n<h4 id=\"winresizable\"><a href=\"#winresizable\"><code>win.resizable</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window can be manually resized by user.</p>\n<h4 id=\"winclosable\"><a href=\"#winclosable\"><code>win.closable</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window can be manually closed by user.</p>\n<p>On Linux the setter is a no-op, although the getter returns <code>true</code>.</p>\n<h4 id=\"winmovable\"><a href=\"#winmovable\"><code>win.movable</code></a></h4>\n<p>A <code>Boolean</code> property that determines Whether the window can be moved by user.</p>\n<p>On Linux the setter is a no-op, although the getter returns <code>true</code>.</p>\n<h4 id=\"winexcludedfromshownwindowsmenu-macos\"><a href=\"#winexcludedfromshownwindowsmenu-macos\"><code>win.excludedFromShownWindowsMenu</code> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is excluded from the application’s Windows menu. <code>false</code> by default.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-keyword\">const</span> template = [\n  {\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'windowmenu'</span>\n  }\n]\n\nwin.excludedFromShownWindowsMenu = <span class=\"hljs-literal\">true</span>\n\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\nMenu.setApplicationMenu(menu)\n</code></pre>\n<h4 id=\"winaccessibletitle\"><a href=\"#winaccessibletitle\"><code>win.accessibleTitle</code></a></h4>\n<p>A <code>String</code> property that defines an alternative title provided only to accessibility tools such as screen readers. This string is not directly visible to users.</p>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<p>Objectos criados com <code>new BrowserWindow</code> possuem os seguintes métodos de instâncias:</p>\n<p><strong>Nota:</strong> Alguns métodos estão disponíveis somente em sistemas operacionais específicos e são rotulados como tal.</p>\n<h4 id=\"windestroy\"><a href=\"#windestroy\"><code>win.destroy()</code></a></h4>\n<p>Force closing the window, the <code>unload</code> and <code>beforeunload</code> event won't be emitted for the web page, and <code>close</code> event will also not be emitted for this window, but it guarantees the <code>closed</code> event will be emitted.</p>\n<h4 id=\"winclose\"><a href=\"#winclose\"><code>win.close()</code></a></h4>\n<p>Try to close the window. This has the same effect as a user manually clicking the close button of the window. The web page may cancel the close though. See the <a href=\"#event-close\">close event</a>.</p>\n<h4 id=\"winfocus\"><a href=\"#winfocus\"><code>win.focus()</code></a></h4>\n<p>Focuses on the window.</p>\n<h4 id=\"winblur\"><a href=\"#winblur\"><code>win.blur()</code></a></h4>\n<p>Removes focus from the window.</p>\n<h4 id=\"winisfocused\"><a href=\"#winisfocused\"><code>win.isFocused()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is focused.</p>\n<h4 id=\"winisdestroyed\"><a href=\"#winisdestroyed\"><code>win.isDestroyed()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is destroyed.</p>\n<h4 id=\"winshow\"><a href=\"#winshow\"><code>win.show()</code></a></h4>\n<p>Shows and gives focus to the window.</p>\n<h4 id=\"winshowinactive\"><a href=\"#winshowinactive\"><code>win.showInactive()</code></a></h4>\n<p>Shows the window but doesn't focus on it.</p>\n<h4 id=\"winhide\"><a href=\"#winhide\"><code>win.hide()</code></a></h4>\n<p>Hides the window.</p>\n<h4 id=\"winisvisible\"><a href=\"#winisvisible\"><code>win.isVisible()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is visible to the user.</p>\n<h4 id=\"winismodal\"><a href=\"#winismodal\"><code>win.isModal()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether current window is a modal window.</p>\n<h4 id=\"winmaximize\"><a href=\"#winmaximize\"><code>win.maximize()</code></a></h4>\n<p>Maximizes the window. This will also show (but not focus) the window if it isn't being displayed already.</p>\n<h4 id=\"winunmaximize\"><a href=\"#winunmaximize\"><code>win.unmaximize()</code></a></h4>\n<p>Unmaximizes the window.</p>\n<h4 id=\"winismaximized\"><a href=\"#winismaximized\"><code>win.isMaximized()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is maximized.</p>\n<h4 id=\"winminimize\"><a href=\"#winminimize\"><code>win.minimize()</code></a></h4>\n<p>Minimizes the window. On some platforms the minimized window will be shown in the Dock.</p>\n<h4 id=\"winrestore\"><a href=\"#winrestore\"><code>win.restore()</code></a></h4>\n<p>Restores the window from minimized state to its previous state.</p>\n<h4 id=\"winisminimized\"><a href=\"#winisminimized\"><code>win.isMinimized()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is minimized.</p>\n<h4 id=\"winsetfullscreenflag\"><a href=\"#winsetfullscreenflag\"><code>win.setFullScreen(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Sets whether the window should be in fullscreen mode.</p>\n<h4 id=\"winisfullscreen\"><a href=\"#winisfullscreen\"><code>win.isFullScreen()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in fullscreen mode.</p>\n<h4 id=\"winsetsimplefullscreenflag-macos\"><a href=\"#winsetsimplefullscreenflag-macos\"><code>win.setSimpleFullScreen(flag)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Enters or leaves simple fullscreen mode.</p>\n<p>Simple fullscreen mode emulates the native fullscreen behavior found in versions of macOS prior to Lion (10.7).</p>\n<h4 id=\"winissimplefullscreen-macos\"><a href=\"#winissimplefullscreen-macos\"><code>win.isSimpleFullScreen()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in simple (pre-Lion) fullscreen mode.</p>\n<h4 id=\"winisnormal\"><a href=\"#winisnormal\"><code>win.isNormal()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in normal state (not maximized, not minimized, not in fullscreen mode).</p>\n<h4 id=\"winsetaspectratioaspectratio-extrasize\"><a href=\"#winsetaspectratioaspectratio-extrasize\"><code>win.setAspectRatio(aspectRatio[, extraSize])</code></a></h4>\n<ul>\n<li><code>aspectRatio</code> Float - The aspect ratio to maintain for some portion of the content view.</li>\n<li><code>extraSize</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) <em>macOS</em> - The extra size not to be included while maintaining the aspect ratio.</li>\n</ul>\n<p>This will make a window maintain an aspect ratio. The extra size allows a developer to have space, specified in pixels, not included within the aspect ratio calculations. This API already takes into account the difference between a window's size and its content size.</p>\n<p>Consider a normal window with an HD video player and associated controls. Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls on the right edge and 50 pixels of controls below the player. In order to maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within the player itself we would call this function with arguments of 16/9 and\n{ width: 40, height: 50 }. The second argument doesn't care where the extra width and height are within the content view--only that they exist. Sum any extra width and height areas you have within the overall content view.</p>\n<p>The aspect ratio is not respected when window is resized programmatically with APIs like <code>win.setSize</code>.</p>\n<h4 id=\"winsetbackgroundcolorbackgroundcolor\"><a href=\"#winsetbackgroundcolorbackgroundcolor\"><code>win.setBackgroundColor(backgroundColor)</code></a></h4>\n<ul>\n<li><code>backgroundColor</code> String - Window's background color as a hexadecimal value, like <code>#66CD00</code> or <code>#FFF</code> or <code>#80FFFFFF</code> (alpha is supported if <code>transparent</code> is <code>true</code>). Default is <code>#FFF</code> (white).</li>\n</ul>\n<p>Sets the background color of the window. See <a href=\"#setting-backgroundcolor\">Setting <code>backgroundColor</code></a>.</p>\n<h4 id=\"winpreviewfilepath-displayname-macos\"><a href=\"#winpreviewfilepath-displayname-macos\"><code>win.previewFile(path[, displayName])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>path</code> String - The absolute path to the file to preview with QuickLook. This is important as Quick Look uses the file name and file extension on the path to determine the content type of the file to open.</li>\n<li><code>displayName</code> String (optional) - The name of the file to display on the Quick Look modal view. This is purely visual and does not affect the content type of the file. O padrão é <code>path</code>.</li>\n</ul>\n<p>Uses <a href=\"https://en.wikipedia.org/wiki/Quick_Look\">Quick Look</a> to preview a file at a given path.</p>\n<h4 id=\"winclosefilepreview-macos\"><a href=\"#winclosefilepreview-macos\"><code>win.closeFilePreview()</code> <em>macOS</em></a></h4>\n<p>Closes the currently open <a href=\"https://en.wikipedia.org/wiki/Quick_Look\">Quick Look</a> panel.</p>\n<h4 id=\"winsetboundsbounds-animate\"><a href=\"#winsetboundsbounds-animate\"><code>win.setBounds(bounds[, animate])</code></a></h4>\n<ul>\n<li><code>bounds</code> Partial&#x3C;<a href=\"/docs/api/structures/rectangle\">Rectangle</a>></li>\n<li><code>animate</code> Boolean (optional) <em>macOS</em></li>\n</ul>\n<p>Resizes and moves the window to the supplied bounds. Any properties that are not supplied will default to their current values.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-comment\">// set all bounds properties</span>\nwin.setBounds({ <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">440</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">225</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-comment\">// set a single bounds property</span>\nwin.setBounds({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">100</span> })\n\n<span class=\"hljs-comment\">// { x: 440, y: 225, width: 100, height: 600 }</span>\n<span class=\"hljs-built_in\">console</span>.log(win.getBounds())\n</code></pre>\n<h4 id=\"wingetbounds\"><a href=\"#wingetbounds\"><code>win.getBounds()</code></a></h4>\n<p>Retorna <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - Os <code>limites</code> da janela como <code>Objeto</code>.</p>\n<h4 id=\"wingetbackgroundcolor\"><a href=\"#wingetbackgroundcolor\"><code>win.getBackgroundColor()</code></a></h4>\n<p>Returns <code>String</code> - Gets the background color of the window. See <a href=\"#setting-backgroundcolor\">Setting <code>backgroundColor</code></a>.</p>\n<h4 id=\"winsetcontentboundsbounds-animate\"><a href=\"#winsetcontentboundsbounds-animate\"><code>win.setContentBounds(bounds[, animate])</code></a></h4>\n<ul>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Retângulo</a></li>\n<li><code>animate</code> Boolean (optional) <em>macOS</em></li>\n</ul>\n<p>Resizes and moves the window's client area (e.g. the web page) to the supplied bounds.</p>\n<h4 id=\"wingetcontentbounds\"><a href=\"#wingetcontentbounds\"><code>win.getContentBounds()</code></a></h4>\n<p>Returns <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - The <code>bounds</code> of the window's client area as <code>Object</code>.</p>\n<h4 id=\"wingetnormalbounds\"><a href=\"#wingetnormalbounds\"><code>win.getNormalBounds()</code></a></h4>\n<p>Returns <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - Contains the window bounds of the normal state</p>\n<p><strong>Note:</strong> whatever the current state of the window : maximized, minimized or in fullscreen, this function always returns the position and size of the window in normal state. In normal state, getBounds and getNormalBounds returns the same <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a>.</p>\n<h4 id=\"winsetenabledenable\"><a href=\"#winsetenabledenable\"><code>win.setEnabled(enable)</code></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Disable or enable the window.</p>\n<h4 id=\"winisenabled\"><a href=\"#winisenabled\"><code>win.isEnabled()</code></a></h4>\n<p>Returns <code>Boolean</code> - whether the window is enabled.</p>\n<h4 id=\"winsetsizewidth-height-animate\"><a href=\"#winsetsizewidth-height-animate\"><code>win.setSize(width, height[, animate])</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>animate</code> Boolean (optional) <em>macOS</em></li>\n</ul>\n<p>Resizes the window to <code>width</code> and <code>height</code>. If <code>width</code> or <code>height</code> are below any set minimum size constraints the window will snap to its minimum size.</p>\n<h4 id=\"wingetsize\"><a href=\"#wingetsize\"><code>win.getSize()</code></a></h4>\n<p>Returns <code>Integer[]</code> - Contains the window's width and height.</p>\n<h4 id=\"winsetcontentsizewidth-height-animate\"><a href=\"#winsetcontentsizewidth-height-animate\"><code>win.setContentSize(width, height[, animate])</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>animate</code> Boolean (optional) <em>macOS</em></li>\n</ul>\n<p>Resizes the window's client area (e.g. the web page) to <code>width</code> and <code>height</code>.</p>\n<h4 id=\"wingetcontentsize\"><a href=\"#wingetcontentsize\"><code>win.getContentSize()</code></a></h4>\n<p>Returns <code>Integer[]</code> - Contains the window's client area's width and height.</p>\n<h4 id=\"winsetminimumsizewidth-height\"><a href=\"#winsetminimumsizewidth-height\"><code>win.setMinimumSize(width, height)</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n</ul>\n<p>Sets the minimum size of window to <code>width</code> and <code>height</code>.</p>\n<h4 id=\"wingetminimumsize\"><a href=\"#wingetminimumsize\"><code>win.getMinimumSize()</code></a></h4>\n<p>Returns <code>Integer[]</code> - Contains the window's minimum width and height.</p>\n<h4 id=\"winsetmaximumsizewidth-height\"><a href=\"#winsetmaximumsizewidth-height\"><code>win.setMaximumSize(width, height)</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n</ul>\n<p>Sets the maximum size of window to <code>width</code> and <code>height</code>.</p>\n<h4 id=\"wingetmaximumsize\"><a href=\"#wingetmaximumsize\"><code>win.getMaximumSize()</code></a></h4>\n<p>Returns <code>Integer[]</code> - Contains the window's maximum width and height.</p>\n<h4 id=\"winsetresizableresizable\"><a href=\"#winsetresizableresizable\"><code>win.setResizable(resizable)</code></a></h4>\n<ul>\n<li><code>resizable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually resized by the user.</p>\n<h4 id=\"winisresizable\"><a href=\"#winisresizable\"><code>win.isResizable()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be manually resized by the user.</p>\n<h4 id=\"winsetmovablemovable-macos-windows\"><a href=\"#winsetmovablemovable-macos-windows\"><code>win.setMovable(movable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>movable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be moved by user. On Linux does nothing.</p>\n<h4 id=\"winismovable-macos-windows\"><a href=\"#winismovable-macos-windows\"><code>win.isMovable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be moved by user.</p>\n<p>On Linux always returns <code>true</code>.</p>\n<h4 id=\"winsetminimizableminimizable-macos-windows\"><a href=\"#winsetminimizableminimizable-macos-windows\"><code>win.setMinimizable(minimizable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>minimizable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually minimized by user. On Linux does nothing.</p>\n<h4 id=\"winisminimizable-macos-windows\"><a href=\"#winisminimizable-macos-windows\"><code>win.isMinimizable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be manually minimized by the user.</p>\n<p>On Linux always returns <code>true</code>.</p>\n<h4 id=\"winsetmaximizablemaximizable-macos-windows\"><a href=\"#winsetmaximizablemaximizable-macos-windows\"><code>win.setMaximizable(maximizable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>maximizable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually maximized by user. On Linux does nothing.</p>\n<h4 id=\"winismaximizable-macos-windows\"><a href=\"#winismaximizable-macos-windows\"><code>win.isMaximizable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be manually maximized by user.</p>\n<p>On Linux always returns <code>true</code>.</p>\n<h4 id=\"winsetfullscreenablefullscreenable\"><a href=\"#winsetfullscreenablefullscreenable\"><code>win.setFullScreenable(fullscreenable)</code></a></h4>\n<ul>\n<li><code>fullscreenable</code> Boolean</li>\n</ul>\n<p>Sets whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.</p>\n<h4 id=\"winisfullscreenable\"><a href=\"#winisfullscreenable\"><code>win.isFullScreenable()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.</p>\n<h4 id=\"winsetclosableclosable-macos-windows\"><a href=\"#winsetclosableclosable-macos-windows\"><code>win.setClosable(closable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>closable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually closed by user. On Linux does nothing.</p>\n<h4 id=\"winisclosable-macos-windows\"><a href=\"#winisclosable-macos-windows\"><code>win.isClosable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be manually closed by user.</p>\n<p>On Linux always returns <code>true</code>.</p>\n<h4 id=\"winsetalwaysontopflag-level-relativelevel\"><a href=\"#winsetalwaysontopflag-level-relativelevel\"><code>win.setAlwaysOnTop(flag[, level][, relativeLevel])</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n<li><code>level</code> String (optional) <em>macOS</em> <em>Windows</em> - Values include <code>normal</code>, <code>floating</code>, <code>torn-off-menu</code>, <code>modal-panel</code>, <code>main-menu</code>, <code>status</code>, <code>pop-up-menu</code>, <code>screen-saver</code>, and <del><code>dock</code></del> (Deprecated). The default is <code>floating</code> when <code>flag</code> is true. The <code>level</code> is reset to <code>normal</code> when the flag is false. Note that from <code>floating</code> to <code>status</code> included, the window is placed below the Dock on macOS and below the taskbar on Windows. From <code>pop-up-menu</code> to a higher it is shown above the Dock on macOS and above the taskbar on Windows. See the <a href=\"https://developer.apple.com/documentation/appkit/nswindow/level\">macOS docs</a> for more details.</li>\n<li><code>relativeLevel</code> Integer (optional) <em>macOS</em> - The number of layers higher to set this window relative to the given <code>level</code>. O padrão é <code>0</code>. Note that Apple discourages setting levels higher than 1 above <code>screen-saver</code>.</li>\n</ul>\n<p>Sets whether the window should show always on top of other windows. After setting this, the window is still a normal window, not a toolbox window which can not be focused on.</p>\n<h4 id=\"winisalwaysontop\"><a href=\"#winisalwaysontop\"><code>win.isAlwaysOnTop()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is always on top of other windows.</p>\n<h4 id=\"winmoveabovemediasourceid\"><a href=\"#winmoveabovemediasourceid\"><code>win.moveAbove(mediaSourceId)</code></a></h4>\n<ul>\n<li><code>mediaSourceId</code> String - Window id in the format of DesktopCapturerSource's id. For example \"window:1869:0\".</li>\n</ul>\n<p>Moves window above the source window in the sense of z-order. If the <code>mediaSourceId</code> is not of type window or if the window does not exist then this method throws an error.</p>\n<h4 id=\"winmovetop\"><a href=\"#winmovetop\"><code>win.moveTop()</code></a></h4>\n<p>Moves window to top(z-order) regardless of focus</p>\n<h4 id=\"wincenter\"><a href=\"#wincenter\"><code>win.center()</code></a></h4>\n<p>Moves window to the center of the screen.</p>\n<h4 id=\"winsetpositionx-y-animate\"><a href=\"#winsetpositionx-y-animate\"><code>win.setPosition(x, y[, animate])</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n<li><code>animate</code> Boolean (optional) <em>macOS</em></li>\n</ul>\n<p>Moves window to <code>x</code> and <code>y</code>.</p>\n<h4 id=\"wingetposition\"><a href=\"#wingetposition\"><code>win.getPosition()</code></a></h4>\n<p>Returns <code>Integer[]</code> - Contains the window's current position.</p>\n<h4 id=\"winsettitletitle\"><a href=\"#winsettitletitle\"><code>win.setTitle(title)</code></a></h4>\n<ul>\n<li><code>title</code> String</li>\n</ul>\n<p>Changes the title of native window to <code>title</code>.</p>\n<h4 id=\"wingettitle\"><a href=\"#wingettitle\"><code>win.getTitle()</code></a></h4>\n<p>Returns <code>String</code> - The title of the native window.</p>\n<p><strong>Note:</strong> The title of the web page can be different from the title of the native window.</p>\n<h4 id=\"winsetsheetoffsetoffsety-offsetx-macos\"><a href=\"#winsetsheetoffsetoffsety-offsetx-macos\"><code>win.setSheetOffset(offsetY[, offsetX])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>offsetY</code> Float</li>\n<li><code>offsetX</code> Float (optional)</li>\n</ul>\n<p>Changes the attachment point for sheets on macOS. By default, sheets are attached just below the window frame, but you may want to display them beneath a HTML-rendered toolbar. Como por exemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-keyword\">const</span> toolbarRect = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'toolbar'</span>).getBoundingClientRect()\nwin.setSheetOffset(toolbarRect.height)\n</code></pre>\n<h4 id=\"winflashframeflag\"><a href=\"#winflashframeflag\"><code>win.flashFrame(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Starts or stops flashing the window to attract user's attention.</p>\n<h4 id=\"winsetskiptaskbarskip\"><a href=\"#winsetskiptaskbarskip\"><code>win.setSkipTaskbar(skip)</code></a></h4>\n<ul>\n<li><code>skip</code> Boolean</li>\n</ul>\n<p>Makes the window not show in the taskbar.</p>\n<h4 id=\"winsetkioskflag\"><a href=\"#winsetkioskflag\"><code>win.setKiosk(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Enters or leaves kiosk mode.</p>\n<h4 id=\"winiskiosk\"><a href=\"#winiskiosk\"><code>win.isKiosk()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in kiosk mode.</p>\n<h4 id=\"winistabletmode-windows\"><a href=\"#winistabletmode-windows\"><code>win.isTabletMode()</code> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in Windows 10 tablet mode.</p>\n<p>Since Windows 10 users can <a href=\"https://support.microsoft.com/en-us/help/17210/windows-10-use-your-pc-like-a-tablet\">use their PC as tablet</a>, under this mode apps can choose to optimize their UI for tablets, such as enlarging the titlebar and hiding titlebar buttons.</p>\n<p>This API returns whether the window is in tablet mode, and the <code>resize</code> event can be be used to listen to changes to tablet mode.</p>\n<h4 id=\"wingetmediasourceid\"><a href=\"#wingetmediasourceid\"><code>win.getMediaSourceId()</code></a></h4>\n<p>Returns <code>String</code> - Window id in the format of DesktopCapturerSource's id. For example \"window:1324:0\".</p>\n<p>More precisely the format is <code>window:id:other_id</code> where <code>id</code> is <code>HWND</code> on Windows, <code>CGWindowID</code> (<code>uint64_t</code>) on macOS and <code>Window</code> (<code>unsigned long</code>) on Linux. <code>other_id</code> is used to identify web contents (tabs) so within the same top level window.</p>\n<h4 id=\"wingetnativewindowhandle\"><a href=\"#wingetnativewindowhandle\"><code>win.getNativeWindowHandle()</code></a></h4>\n<p>Returns <code>Buffer</code> - The platform-specific handle of the window.</p>\n<p>The native type of the handle is <code>HWND</code> on Windows, <code>NSView*</code> on macOS, and <code>Window</code> (<code>unsigned long</code>) on Linux.</p>\n<h4 id=\"winhookwindowmessagemessage-callback-windows\"><a href=\"#winhookwindowmessagemessage-callback-windows\"><code>win.hookWindowMessage(message, callback)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n<li><code>callback</code> Function<ul>\n<li><code>wParam</code> any - The <code>wParam</code> provided to the WndProc</li>\n<li><code>lParam</code> any - The <code>lParam</code> provided to the WndProc</li>\n</ul></li>\n</ul>\n<p>Hooks a windows message. The <code>callback</code> is called when the message is received in the WndProc.</p>\n<h4 id=\"winiswindowmessagehookedmessage-windows\"><a href=\"#winiswindowmessagehookedmessage-windows\"><code>win.isWindowMessageHooked(message)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n</ul>\n<p>Returns <code>Boolean</code> - <code>true</code> or <code>false</code> depending on whether the message is hooked.</p>\n<h4 id=\"winunhookwindowmessagemessage-windows\"><a href=\"#winunhookwindowmessagemessage-windows\"><code>win.unhookWindowMessage(message)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n</ul>\n<p>Unhook the window message.</p>\n<h4 id=\"winunhookallwindowmessages-windows\"><a href=\"#winunhookallwindowmessages-windows\"><code>win.unhookAllWindowMessages()</code> <em>Windows</em></a></h4>\n<p>Unhooks all of the window messages.</p>\n<h4 id=\"winsetrepresentedfilenamefilename-macos\"><a href=\"#winsetrepresentedfilenamefilename-macos\"><code>win.setRepresentedFilename(filename)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>filename</code> String</li>\n</ul>\n<p>Sets the pathname of the file the window represents, and the icon of the file will show in window's title bar.</p>\n<h4 id=\"wingetrepresentedfilename-macos\"><a href=\"#wingetrepresentedfilename-macos\"><code>win.getRepresentedFilename()</code> <em>macOS</em></a></h4>\n<p>Returns <code>String</code> - The pathname of the file the window represents.</p>\n<h4 id=\"winsetdocumenteditededited-macos\"><a href=\"#winsetdocumenteditededited-macos\"><code>win.setDocumentEdited(edited)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>edited</code> Boolean</li>\n</ul>\n<p>Specifies whether the window’s document has been edited, and the icon in title bar will become gray when set to <code>true</code>.</p>\n<h4 id=\"winisdocumentedited-macos\"><a href=\"#winisdocumentedited-macos\"><code>win.isDocumentEdited()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window's document has been edited.</p>\n<h4 id=\"winfocusonwebview\"><a href=\"#winfocusonwebview\"><code>win.focusOnWebView()</code></a></h4>\n<h4 id=\"winblurwebview\"><a href=\"#winblurwebview\"><code>win.blurWebView()</code></a></h4>\n<h4 id=\"wincapturepagerect\"><a href=\"#wincapturepagerect\"><code>win.capturePage([rect])</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (optional) - The bounds to capture</li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - Resolves with a <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Captures a snapshot of the page within <code>rect</code>. Omitting <code>rect</code> will capture the whole visible page. If the page is not visible, <code>rect</code> may be empty.</p>\n<h4 id=\"winloadurlurl-options\"><a href=\"#winloadurlurl-options\"><code>win.loadURL(url[, options])</code></a></h4>\n<ul>\n<li>String <code>url</code></li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (optional) - An HTTP Referrer URL.</li>\n<li><code>userAgent</code> String (optional) - A user agent originating the request.</li>\n<li><code>extraHeaders</code> String (optional) - Extra headers separated by \"\\n\"</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (optional) - Base URL (with trailing path separator) for files to be loaded by the data URL. This is needed only if the specified <code>url</code> is a data URL and needs to load other files.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - the promise will resolve when the page has finished loading (see <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects if the page fails to load (see <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Same as <a href=\"/docs/api/web-contents#contentsloadurlurl-options\"><code>webContents.loadURL(url[, options])</code></a>.</p>\n<p>The <code>url</code> can be a remote address (e.g. <code>http://</code>) or a path to a local HTML file using the <code>file://</code> protocol.</p>\n<p>To ensure that file URLs are properly formatted, it is recommended to use Node's <a href=\"https://nodejs.org/api/url.html#url_url_format_urlobject\"><code>url.format</code></a> method:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>).format({\n  <span class=\"hljs-attr\">protocol</span>: <span class=\"hljs-string\">'file'</span>,\n  <span class=\"hljs-attr\">slashes</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">pathname</span>: <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>).join(__dirname, <span class=\"hljs-string\">'index.html'</span>)\n})\n\nwin.loadURL(url)\n</code></pre>\n<p>You can load a URL using a <code>POST</code> request with URL-encoded data by doing the following:</p>\n<pre><code class=\"hljs language-javascript\">win.loadURL(<span class=\"hljs-string\">'http://localhost:8000/post'</span>, {\n  <span class=\"hljs-attr\">postData</span>: [{\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'rawData'</span>,\n    <span class=\"hljs-attr\">bytes</span>: Buffer.from(<span class=\"hljs-string\">'hello=world'</span>)\n  }],\n  <span class=\"hljs-attr\">extraHeaders</span>: <span class=\"hljs-string\">'Content-Type: application/x-www-form-urlencoded'</span>\n})\n</code></pre>\n<h4 id=\"winloadfilefilepath-options\"><a href=\"#winloadfilefilepath-options\"><code>win.loadFile(filePath[, options])</code></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>query</code> Record&#x3C;String, String> (optional) - Passed to <code>url.format()</code>.</li>\n<li><code>search</code> String (optional) - Passed to <code>url.format()</code>.</li>\n<li><code>hash</code> String (optional) - Passed to <code>url.format()</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - the promise will resolve when the page has finished loading (see <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects if the page fails to load (see <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Same as <code>webContents.loadFile</code>, <code>filePath</code> should be a path to an HTML file relative to the root of your application.  See the <code>webContents</code> docs for more information.</p>\n<h4 id=\"winreload\"><a href=\"#winreload\"><code>win.reload()</code></a></h4>\n<p>Same as <code>webContents.reload</code>.</p>\n<h4 id=\"winsetmenumenu-linux-windows\"><a href=\"#winsetmenumenu-linux-windows\"><code>win.setMenu(menu)</code> <em>Linux</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Sets the <code>menu</code> as the window's menu bar.</p>\n<h4 id=\"winremovemenu-linux-windows\"><a href=\"#winremovemenu-linux-windows\"><code>win.removeMenu()</code> <em>Linux</em> <em>Windows</em></a></h4>\n<p>Remove the window's menu bar.</p>\n<h4 id=\"winsetprogressbarprogress-options\"><a href=\"#winsetprogressbarprogress-options\"><code>win.setProgressBar(progress[, options])</code></a></h4>\n<ul>\n<li><code>progress</code> Double</li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>mode</code> String <em>Windows</em> - Mode for the progress bar. Can be <code>none</code>, <code>normal</code>, <code>indeterminate</code>, <code>error</code> or <code>paused</code>.</li>\n</ul></li>\n</ul>\n<p>Sets progress value in progress bar. Valid range is [0, 1.0].</p>\n<p>Remove progress bar when progress &#x3C; 0; Change to indeterminate mode when progress > 1.</p>\n<p>On Linux platform, only supports Unity desktop environment, you need to specify the <code>*.desktop</code> file name to <code>desktopName</code> field in <code>package.json</code>. By default, it will assume <code>{app.name}.desktop</code>.</p>\n<p>On Windows, a mode can be passed. Accepted values are <code>none</code>, <code>normal</code>, <code>indeterminate</code>, <code>error</code>, and <code>paused</code>. If you call <code>setProgressBar</code> without a mode set (but with a value within the valid range), <code>normal</code> will be assumed.</p>\n<h4 id=\"winsetoverlayiconoverlay-description-windows\"><a href=\"#winsetoverlayiconoverlay-description-windows\"><code>win.setOverlayIcon(overlay, description)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>overlay</code> <a href=\"/docs/api/native-image\">NativeImage</a> | null - the icon to display on the bottom right corner of the taskbar icon. If this parameter is <code>null</code>, the overlay is cleared</li>\n<li><code>description</code> String - a description that will be provided to Accessibility screen readers</li>\n</ul>\n<p>Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to convey some sort of application status or to passively notify the user.</p>\n<h4 id=\"winsethasshadowhasshadow\"><a href=\"#winsethasshadowhasshadow\"><code>win.setHasShadow(hasShadow)</code></a></h4>\n<ul>\n<li><code>hasShadow</code> Boolean</li>\n</ul>\n<p>Sets whether the window should have a shadow.</p>\n<h4 id=\"winhasshadow\"><a href=\"#winhasshadow\"><code>win.hasShadow()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window has a shadow.</p>\n<h4 id=\"winsetopacityopacity-windows-macos\"><a href=\"#winsetopacityopacity-windows-macos\"><code>win.setOpacity(opacity)</code> <em>Windows</em> <em>macOS</em></a></h4>\n<ul>\n<li><code>opacity</code> Number - between 0.0 (fully transparent) and 1.0 (fully opaque)</li>\n</ul>\n<p>Sets the opacity of the window. On Linux, does nothing. Out of bound number values are clamped to the [0, 1] range.</p>\n<h4 id=\"wingetopacity\"><a href=\"#wingetopacity\"><code>win.getOpacity()</code></a></h4>\n<p>Returns <code>Number</code> - between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns 1.</p>\n<h4 id=\"winsetshaperects-windows-linux-experimental\"><a href=\"#winsetshaperects-windows-linux-experimental\"><code>win.setShape(rects)</code> <em>Windows</em> <em>Linux</em> <em>Experimental</em></a></h4>\n<ul>\n<li><code>rects</code> <a href=\"/docs/api/structures/rectangle\">Rectangle[]</a> - Sets a shape on the window. Passing an empty list reverts the window to being rectangular.</li>\n</ul>\n<p>Setting a window shape determines the area within the window where the system permits drawing and user interaction. Outside of the given region, no pixels will be drawn and no mouse events will be registered. Mouse events outside of the region will not be received by that window, but will fall through to whatever is behind the window.</p>\n<h4 id=\"winsetthumbarbuttonsbuttons-windows\"><a href=\"#winsetthumbarbuttonsbuttons-windows\"><code>win.setThumbarButtons(buttons)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>buttons</code> <a href=\"/docs/api/structures/thumbar-button\">ThumbarButton[]</a></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the buttons were added successfully</p>\n<p>Add a thumbnail toolbar with a specified set of buttons to the thumbnail image of a window in a taskbar button layout. Returns a <code>Boolean</code> object indicates whether the thumbnail has been added successfully.</p>\n<p>The number of buttons in thumbnail toolbar should be no greater than 7 due to the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be removed due to the platform's limitation. But you can call the API with an empty array to clean the buttons.</p>\n<p>The <code>buttons</code> is an array of <code>Button</code> objects:</p>\n<ul>\n<li><code>Button</code> Object<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - O icone exibido na barra de ferramentas de miniaturas.</li>\n<li><code>click</code> Function</li>\n<li><code>tooltip</code> String (opcional) - O texto do tooltip do botão.</li>\n<li><code>flags</code> String<a href=\"/docs/api/optional\"></a> - Control specific states and behaviors of the button. By default, it is <code>['enabled']</code>.</li>\n</ul></li>\n</ul>\n<p>As <code>flags</code> são um array que pode conter as seguintes <code>String</code>s:</p>\n<ul>\n<li><code>enabled</code> - O botão está ativo e disponível ao usuário.</li>\n<li><code>disabled</code> - The button is disabled. It is present, but has a visual state indicating it will not respond to user action.</li>\n<li><code>dismissonclick</code> - Quando o botão é clicado, o janela da miniatura é fechada imediatamente.</li>\n<li><code>nobackground</code> - Não desenha a borda do botão, utiliza apenas a imagem.</li>\n<li><code>hidden</code> - O botão não é exibido ao usuário.</li>\n<li><code>noninteractive</code> - The button is enabled but not interactive; no pressed button state is drawn. This value is intended for instances where the button is used in a notification.</li>\n</ul>\n<h4 id=\"winsetthumbnailclipregion-windows\"><a href=\"#winsetthumbnailclipregion-windows\"><code>win.setThumbnailClip(region)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>region</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Region of the window</li>\n</ul>\n<p>Sets the region of the window to show as the thumbnail image displayed when hovering over the window in the taskbar. You can reset the thumbnail to be the entire window by specifying an empty region: <code>{ x: 0, y: 0, width: 0, height: 0 }</code>.</p>\n<h4 id=\"winsetthumbnailtooltiptooltip-windows\"><a href=\"#winsetthumbnailtooltiptooltip-windows\"><code>win.setThumbnailToolTip(toolTip)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>toolTip</code> String</li>\n</ul>\n<p>Sets the toolTip that is displayed when hovering over the window thumbnail in the taskbar.</p>\n<h4 id=\"winsetappdetailsoptions-windows\"><a href=\"#winsetappdetailsoptions-windows\"><code>win.setAppDetails(options)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>appId</code> String (optional) - Window's <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391569(v=vs.85).aspx\">App User Model ID</a>. It has to be set, otherwise the other options will have no effect.</li>\n<li><code>appIconPath</code> String (optional) - Window's <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391573(v=vs.85).aspx\">Relaunch Icon</a>.</li>\n<li><code>appIconIndex</code> Integer (optional) - Index of the icon in <code>appIconPath</code>. Ignored when <code>appIconPath</code> is not set. Por padrão é <code>0</code>.</li>\n<li><code>relaunchCommand</code> String (optional) - Window's <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391571(v=vs.85).aspx\">Relaunch Command</a>.</li>\n<li><code>relaunchDisplayName</code> String (optional) - Window's <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391572(v=vs.85).aspx\">Relaunch Display Name</a>.</li>\n</ul></li>\n</ul>\n<p>Sets the properties for the window's taskbar button.</p>\n<p><strong>Note:</strong> <code>relaunchCommand</code> and <code>relaunchDisplayName</code> must always be set together. If one of those properties is not set, then neither will be used.</p>\n<h4 id=\"winshowdefinitionforselection-macos\"><a href=\"#winshowdefinitionforselection-macos\"><code>win.showDefinitionForSelection()</code> <em>macOS</em></a></h4>\n<p>Same as <code>webContents.showDefinitionForSelection()</code>.</p>\n<h4 id=\"winseticonicon-windows-linux\"><a href=\"#winseticonicon-windows-linux\"><code>win.setIcon(icon)</code> <em>Windows</em> <em>Linux</em></a></h4>\n<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String</li>\n</ul>\n<p>Changes window icon.</p>\n<h4 id=\"winsetwindowbuttonvisibilityvisible-macos\"><a href=\"#winsetwindowbuttonvisibilityvisible-macos\"><code>win.setWindowButtonVisibility(visible)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n</ul>\n<p>Sets whether the window traffic light buttons should be visible.</p>\n<h4 id=\"winsetautohidemenubarhide\"><a href=\"#winsetautohidemenubarhide\"><code>win.setAutoHideMenuBar(hide)</code></a></h4>\n<ul>\n<li><code>hide</code> Boolean</li>\n</ul>\n<p>Sets whether the window menu bar should hide itself automatically. Once set the menu bar will only show when users press the single <code>Alt</code> key.</p>\n<p>If the menu bar is already visible, calling <code>setAutoHideMenuBar(true)</code> won't hide it immediately.</p>\n<h4 id=\"winismenubarautohide\"><a href=\"#winismenubarautohide\"><code>win.isMenuBarAutoHide()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether menu bar automatically hides itself.</p>\n<h4 id=\"winsetmenubarvisibilityvisible-windows-linux\"><a href=\"#winsetmenubarvisibilityvisible-windows-linux\"><code>win.setMenuBarVisibility(visible)</code> <em>Windows</em> <em>Linux</em></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n</ul>\n<p>Sets whether the menu bar should be visible. If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single <code>Alt</code> key.</p>\n<h4 id=\"winismenubarvisible\"><a href=\"#winismenubarvisible\"><code>win.isMenuBarVisible()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the menu bar is visible.</p>\n<h4 id=\"winsetvisibleonallworkspacesvisible-options\"><a href=\"#winsetvisibleonallworkspacesvisible-options\"><code>win.setVisibleOnAllWorkspaces(visible[, options])</code></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>visibleOnFullScreen</code> Boolean (optional) <em>macOS</em> - Sets whether the window should be visible above fullscreen windows.</li>\n<li><code>skipTransformProcessType</code> Boolean (optional) <em>macOS</em> - Calling setVisibleOnAllWorkspaces will by default transform the process type between UIElementApplication and ForegroundApplication to ensure the correct behavior. However, this will hide the window and dock for a short time every time it is called. If your window is already of type UIElementApplication, you can bypass this transformation by passing true to skipTransformProcessType.</li>\n</ul></li>\n</ul>\n<p>Sets whether the window should be visible on all workspaces.</p>\n<p><strong>Note:</strong> This API does nothing on Windows.</p>\n<h4 id=\"winisvisibleonallworkspaces\"><a href=\"#winisvisibleonallworkspaces\"><code>win.isVisibleOnAllWorkspaces()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is visible on all workspaces.</p>\n<p><strong>Note:</strong> This API always returns false on Windows.</p>\n<h4 id=\"winsetignoremouseeventsignore-options\"><a href=\"#winsetignoremouseeventsignore-options\"><code>win.setIgnoreMouseEvents(ignore[, options])</code></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>forward</code> Boolean (optional) <em>macOS</em> <em>Windows</em> - If true, forwards mouse move messages to Chromium, enabling mouse related events such as <code>mouseleave</code>. Only used when <code>ignore</code> is true. If <code>ignore</code> is false, forwarding is always disabled regardless of this value.</li>\n</ul></li>\n</ul>\n<p>Makes the window ignore all mouse events.</p>\n<p>All mouse events happened in this window will be passed to the window below this window, but if this window has focus, it will still receive keyboard events.</p>\n<h4 id=\"winsetcontentprotectionenable-macos-windows\"><a href=\"#winsetcontentprotectionenable-macos-windows\"><code>win.setContentProtection(enable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Prevents the window contents from being captured by other apps.</p>\n<p>On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows it calls SetWindowDisplayAffinity with <code>WDA_EXCLUDEFROMCAPTURE</code>. For Windows 10 version 2004 and up the window will be removed from capture entirely, older Windows versions behave as if <code>WDA_MONITOR</code> is applied capturing a black window.</p>\n<h4 id=\"winsetfocusablefocusable-macos-windows\"><a href=\"#winsetfocusablefocusable-macos-windows\"><code>win.setFocusable(focusable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>focusable</code> Boolean</li>\n</ul>\n<p>Changes whether the window can be focused.</p>\n<p>On macOS it does not remove the focus from the window.</p>\n<h4 id=\"winisfocusable-macos-windows\"><a href=\"#winisfocusable-macos-windows\"><code>win.isFocusable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns whether the window can be focused.</p>\n<h4 id=\"winsetparentwindowparent\"><a href=\"#winsetparentwindowparent\"><code>win.setParentWindow(parent)</code></a></h4>\n<ul>\n<li><code>parent</code> BrowserWindow | null</li>\n</ul>\n<p>Sets <code>parent</code> as current window's parent window, passing <code>null</code> will turn current window into a top-level window.</p>\n<h4 id=\"wingetparentwindow\"><a href=\"#wingetparentwindow\"><code>win.getParentWindow()</code></a></h4>\n<p>Returns <code>BrowserWindow</code> - The parent window.</p>\n<h4 id=\"wingetchildwindows\"><a href=\"#wingetchildwindows\"><code>win.getChildWindows()</code></a></h4>\n<p>Returns <code>BrowserWindow[]</code> - All child windows.</p>\n<h4 id=\"winsetautohidecursorautohide-no-macos\"><a href=\"#winsetautohidecursorautohide-no-macos\"><code>win.setAutoHideCursor(autoHide)</code> no <em>macOS</em></a></h4>\n<ul>\n<li><code>autoHide</code> Boolean</li>\n</ul>\n<p>Controls whether to hide cursor when typing.</p>\n<h4 id=\"winselectprevioustab-no-macos\"><a href=\"#winselectprevioustab-no-macos\"><code>win.selectPreviousTab()</code> no <em>macOS</em></a></h4>\n<p>Selects the previous tab when native tabs are enabled and there are other tabs in the window.</p>\n<h4 id=\"winselectnexttab-no-macos\"><a href=\"#winselectnexttab-no-macos\"><code>win.selectNextTab()</code> no <em>macOS</em></a></h4>\n<p>Selects the next tab when native tabs are enabled and there are other tabs in the window.</p>\n<h4 id=\"winmergeallwindows-no-macos\"><a href=\"#winmergeallwindows-no-macos\"><code>win.mergeAllWindows()</code> no <em>macOS</em></a></h4>\n<p>Merges all windows into one window with multiple tabs when native tabs are enabled and there is more than one open window.</p>\n<h4 id=\"winmovetabtonewwindow-no-macos\"><a href=\"#winmovetabtonewwindow-no-macos\"><code>win.moveTabToNewWindow()</code> no <em>macOS</em></a></h4>\n<p>Moves the current tab into a new window if native tabs are enabled and there is more than one tab in the current window.</p>\n<h4 id=\"wintoggletabbar-no-macos\"><a href=\"#wintoggletabbar-no-macos\"><code>win.toggleTabBar()</code> no <em>macOS</em></a></h4>\n<p>Toggles the visibility of the tab bar if native tabs are enabled and there is only one tab in the current window.</p>\n<h4 id=\"winaddtabbedwindowbrowserwindow-no-macos\"><a href=\"#winaddtabbedwindowbrowserwindow-no-macos\"><code>win.addTabbedWindow(browserWindow)</code> no <em>macOS</em></a></h4>\n<ul>\n<li><code>browserWindow</code> BrowserWindow</li>\n</ul>\n<p>Adds a window as a tab on this window, after the tab for the window instance.</p>\n<h4 id=\"winsetvibrancytype-macos\"><a href=\"#winsetvibrancytype-macos\"><code>win.setVibrancy(type)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>type</code> String | null - Can be <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>titlebar</code>, <code>selection</code>, <code>menu</code>, <code>popover</code>, <code>sidebar</code>, <code>medium-light</code>, <code>ultra-dark</code>, <code>header</code>, <code>sheet</code>, <code>window</code>, <code>hud</code>, <code>fullscreen-ui</code>, <code>tooltip</code>, <code>content</code>, <code>under-window</code>, or <code>under-page</code>. See the <a href=\"https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc\">macOS documentation</a> for more details.</li>\n</ul>\n<p>Adds a vibrancy effect to the browser window. Passing <code>null</code> or an empty string will remove the vibrancy effect on the window.</p>\n<p>Note that <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>medium-light</code>, and <code>ultra-dark</code> have been deprecated and will be removed in an upcoming version of macOS.</p>\n<h4 id=\"winsettrafficlightpositionposition-no-macos\"><a href=\"#winsettrafficlightpositionposition-no-macos\"><code>win.setTrafficLightPosition(position)</code> no <em>macOS</em></a></h4>\n<ul>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Set a custom position for the traffic light buttons in frameless window.</p>\n<h4 id=\"wingettrafficlightposition-no-macos\"><a href=\"#wingettrafficlightposition-no-macos\"><code>win.getTrafficLightPosition()</code> no <em>macOS</em></a></h4>\n<p>Returns <code>Point</code> - The custom position for the traffic light buttons in frameless window.</p>\n<h4 id=\"winsettouchbartouchbar-no-macos\"><a href=\"#winsettouchbartouchbar-no-macos\"><code>win.setTouchBar(touchBar)</code> no <em>macOS</em></a></h4>\n<ul>\n<li><code>touchBar</code> TouchBar | null</li>\n</ul>\n<p>Sets the touchBar layout for the current window. Specifying <code>null</code> or <code>undefined</code> clears the touch bar. This method only has an effect if the machine has a touch bar and is running on macOS 10.12.1+.</p>\n<p><strong>Note:</strong> The TouchBar API is currently experimental and may change or be removed in future Electron releases.</p>\n<h4 id=\"winsetbrowserviewbrowserview-experimental\"><a href=\"#winsetbrowserviewbrowserview-experimental\"><code>win.setBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a> | null - Attach <code>browserView</code> to <code>win</code>. If there are other <code>BrowserView</code>s attached, they will be removed from this window.</li>\n</ul>\n<h4 id=\"wingetbrowserview-experimental\"><a href=\"#wingetbrowserview-experimental\"><code>win.getBrowserView()</code> <em>Experimental</em></a></h4>\n<p>Returns <code>BrowserView | null</code> - The <code>BrowserView</code> attached to <code>win</code>. Returns <code>null</code> if one is not attached. Throws an error if multiple <code>BrowserView</code>s are attached.</p>\n<h4 id=\"winaddbrowserviewbrowserview-experimental\"><a href=\"#winaddbrowserviewbrowserview-experimental\"><code>win.addBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>Replacement API for setBrowserView supporting work with multi browser views.</p>\n<h4 id=\"winremovebrowserviewbrowserview-experimental\"><a href=\"#winremovebrowserviewbrowserview-experimental\"><code>win.removeBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<h4 id=\"winsettopbrowserviewbrowserview-experimental\"><a href=\"#winsettopbrowserviewbrowserview-experimental\"><code>win.setTopBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>Raises <code>browserView</code> above other <code>BrowserView</code>s attached to <code>win</code>. Throws an error if <code>browserView</code> is not attached to <code>win</code>.</p>\n<h4 id=\"wingetbrowserviews-experimental\"><a href=\"#wingetbrowserviews-experimental\"><code>win.getBrowserViews()</code> <em>Experimental</em></a></h4>\n<p>Returns <code>BrowserView[]</code> - an array of all BrowserViews that have been attached with <code>addBrowserView</code> or <code>setBrowserView</code>.</p>\n<p><strong>Nota:</strong> A API BrowserView atualmente é experimental e pode mudar ou ser removida em versões futuras do Electron.</p>",
      "title": "BrowserWindow",
      "description": "Crier e controle janelas de navegação."
    },
    "/docs/api/browser-window-proxy": {
      "locale": "pt-BR",
      "slug": "browser-window-proxy",
      "href": "/docs/api/browser-window-proxy",
      "crowdinFileId": "256285",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-window-proxy.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-browserwindowproxy\"><a href=\"#class-browserwindowproxy\">Class: BrowserWindowProxy</a></h2>\n<blockquote>\n<p>Manipular a janela filha</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>The <code>BrowserWindowProxy</code> object is returned from <code>window.open</code> and provides limited functionality with the child window.</p>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<p>O objeto <code>BrowserWindowProxy</code> possui os seguintes métodos de instância:</p>\n<h4 id=\"winblur\"><a href=\"#winblur\"><code>win.blur()</code></a></h4>\n<p>Remove o foco da janela filha.</p>\n<h4 id=\"winclose\"><a href=\"#winclose\"><code>win.close()</code></a></h4>\n<p>Forçadamente fecha a janela filha sem chamar o evento unload.</p>\n<h4 id=\"winevalcode\"><a href=\"#winevalcode\"><code>win.eval(code)</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n</ul>\n<p>Evaluates the code in the child window.</p>\n<h4 id=\"winfocus\"><a href=\"#winfocus\"><code>win.focus()</code></a></h4>\n<p>Focuses the child window (brings the window to front).</p>\n<h4 id=\"winprint\"><a href=\"#winprint\"><code>win.print()</code></a></h4>\n<p>Invokes the print dialog on the child window.</p>\n<h4 id=\"winpostmessagemessage-targetorigin\"><a href=\"#winpostmessagemessage-targetorigin\"><code>win.postMessage(message, targetOrigin)</code></a></h4>\n<ul>\n<li><code>message</code> any</li>\n<li><code>targetOrigin</code> String</li>\n</ul>\n<p>Sends a message to the child window with the specified origin or <code>*</code> for no origin preference.</p>\n<p>In addition to these methods, the child window implements <code>window.opener</code> object with no properties and a single method.</p>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<p>The <code>BrowserWindowProxy</code> object has the following instance properties:</p>\n<h4 id=\"winclosed\"><a href=\"#winclosed\"><code>win.closed</code></a></h4>\n<p>A <code>Boolean</code> that is set to true after the child window gets closed.</p>",
      "title": "BrowserWindowProxy",
      "description": "Manipular a janela filha"
    },
    "/docs/development/build-instructions-gn": {
      "locale": "pt-BR",
      "slug": "build-instructions-gn",
      "href": "/docs/development/build-instructions-gn",
      "crowdinFileId": "256131",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-gn.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"instruções-de-compilação\"><a href=\"#instruções-de-compilação\">Instruções de Compilação</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong>, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"pré-requisitos-da-plataforma\"><a href=\"#pré-requisitos-da-plataforma\">Pré-requisitos da plataforma</a></h2>\n<p>Verifique os pré-requisitos de compilação para sua plataforma antes de prosseguir</p>\n<ul>\n<li><a href=\"/docs/development/build-instructions-macos#prerequisites\">macOS</a></li>\n<li><a href=\"/docs/development/build-instructions-linux#prerequisites\">Linux</a></li>\n<li><a href=\"/docs/development/build-instructions-windows#prerequisites\">Windows</a></li>\n</ul>\n<h2 id=\"build-tools\"><a href=\"#build-tools\">Build Tools</a></h2>\n<p><a href=\"https://github.com/electron/build-tools\">Electron's Build Tools</a> automate much of the setup for compiling Electron from source with different configurations and build targets. If you wish to set up the environment manually, the instructions are listed below.</p>\n<h2 id=\"pré-requisitos-gn\"><a href=\"#pré-requisitos-gn\">Pré-requisitos GN</a></h2>\n<p>Você precisará instalar <a href=\"https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up\"><code>depot_tools</code></a>, o toolset usado para obter Chromium e suas dependências.</p>\n<p>Also, on Windows, you'll need to set the environment variable <code>DEPOT_TOOLS_WIN_TOOLCHAIN=0</code>. To do so, open <code>Control Panel</code> → <code>System and Security</code> → <code>System</code> → <code>Advanced system settings</code> and add a system variable <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> with value <code>0</code>.  This tells <code>depot_tools</code> to use your locally installed version of Visual Studio (by default, <code>depot_tools</code> will try to download a Google-internal version that only Googlers have access to).</p>\n<h3 id=\"setting-up-the-git-cache\"><a href=\"#setting-up-the-git-cache\">Setting up the git cache</a></h3>\n<p>If you plan on checking out Electron more than once (for example, to have multiple parallel directories checked out to different branches), using the git cache will speed up subsequent calls to <code>gclient</code>. To do this, set a <code>GIT_CACHE_PATH</code> environment variable:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">export</span> GIT_CACHE_PATH=<span class=\"hljs-string\">\"<span class=\"hljs-variable\">${HOME}</span>/.git_cache\"</span>\n$ mkdir -p <span class=\"hljs-string\">\"<span class=\"hljs-variable\">${GIT_CACHE_PATH}</span>\"</span>\n<span class=\"hljs-comment\"># This will use about 16G.</span>\n</code></pre>\n<h2 id=\"getting-the-code\"><a href=\"#getting-the-code\">Getting the code</a></h2>\n<pre><code class=\"hljs language-sh\">$ mkdir electron &#x26;&#x26; <span class=\"hljs-built_in\">cd</span> electron\n$ gclient config --name <span class=\"hljs-string\">\"src/electron\"</span> --unmanaged https://github.com/electron/electron\n$ gclient sync --with_branch_heads --with_tags\n<span class=\"hljs-comment\"># This will take a while, go get a coffee.</span>\n</code></pre>\n<blockquote>\n<p>Instead of <code>https://github.com/electron/electron</code>, you can use your own fork here (something like <code>https://github.com/&#x3C;username>/electron</code>).</p>\n</blockquote>\n<h3 id=\"a-note-on-pullingpushing\"><a href=\"#a-note-on-pullingpushing\">A note on pulling/pushing</a></h3>\n<p>If you intend to <code>git pull</code> or <code>git push</code> from the official <code>electron</code> repository in the future, you now need to update the respective folder's origin URLs.</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src/electron\n$ git remote remove origin\n$ git remote add origin https://github.com/electron/electron\n$ git checkout main\n$ git branch --<span class=\"hljs-built_in\">set</span>-upstream-to=origin/main\n$ <span class=\"hljs-built_in\">cd</span> -\n</code></pre>\n<p>📝 <code>gclient</code> works by checking a file called <code>DEPS</code> inside the <code>src/electron</code> folder for dependencies (like Chromium or Node.js). Running <code>gclient sync -f</code> ensures that all dependencies required to build Electron match that file.</p>\n<p>So, in order to pull, you'd run the following commands:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src/electron\n$ git pull\n$ gclient sync -f\n</code></pre>\n<h2 id=\"compilando\"><a href=\"#compilando\">Compilando</a></h2>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src\n$ <span class=\"hljs-built_in\">export</span> CHROMIUM_BUILDTOOLS_PATH=`<span class=\"hljs-built_in\">pwd</span>`/buildtools\n$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p>Or on Windows (without the optional argument):</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src\n$ <span class=\"hljs-built_in\">set</span> CHROMIUM_BUILDTOOLS_PATH=%<span class=\"hljs-built_in\">cd</span>%\\buildtools\n$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\")\"</span>\n</code></pre>\n<p>This will generate a build directory <code>out/Testing</code> under <code>src/</code> with the testing build configuration. You can replace <code>Testing</code> with another name, but it should be a subdirectory of <code>out</code>. Also you shouldn't have to run <code>gn gen</code> again—if you want to change the build arguments, you can run <code>gn args out/Testing</code> to bring up an editor.</p>\n<p>To see the list of available build configuration options, run <code>gn args out/Testing --list</code>.</p>\n<p><strong>For generating Testing build config of Electron:</strong></p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p><strong>For generating Release (aka \"non-component\" or \"static\") build config of Electron:</strong></p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Release --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/release.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p><strong>To build, run <code>ninja</code> with the <code>electron</code> target:</strong> Nota Bene: This will also take a while and probably heat up your lap.</p>\n<p>For the testing configuration:</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Testing electron\n</code></pre>\n<p>For the release configuration:</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Release electron\n</code></pre>\n<p>This will build all of what was previously 'libchromiumcontent' (i.e. the <code>content/</code> directory of <code>chromium</code> and its dependencies, incl. WebKit and V8), so it will take a while.</p>\n<p>The built executable will be under <code>./out/Testing</code>:</p>\n<pre><code class=\"hljs language-sh\">$ ./out/Testing/Electron.app/Contents/MacOS/Electron\n<span class=\"hljs-comment\"># or, on Windows</span>\n$ ./out/Testing/electron.exe\n<span class=\"hljs-comment\"># or, on Linux</span>\n$ ./out/Testing/electron\n</code></pre>\n<h3 id=\"empacotando\"><a href=\"#empacotando\">Empacotando</a></h3>\n<p>On linux, first strip the debugging and symbol information:</p>\n<pre><code class=\"hljs language-sh\">electron/script/strip-binaries.py -d out/Release\n</code></pre>\n<p>To package the electron build as a distributable zip file:</p>\n<pre><code class=\"hljs language-sh\">ninja -C out/Release electron:electron_dist_zip\n</code></pre>\n<h3 id=\"cross-compiling\"><a href=\"#cross-compiling\">Cross-compiling</a></h3>\n<p>To compile for a platform that isn't the same as the one you're building on, set the <code>target_cpu</code> and <code>target_os</code> GN arguments. For example, to compile an x86 target from an x64 host, specify <code>target_cpu = \"x86\"</code> in <code>gn args</code>.</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing-x86 --args=<span class=\"hljs-string\">'... target_cpu = \"x86\"'</span>\n</code></pre>\n<p>Not all combinations of source and target CPU/OS are supported by Chromium.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Host</th><th>Objetivo</th><th>Status</th></tr></thead><tbody><tr><td>Windows x64</td><td>Windows arm64</td><td>Experimental</td></tr><tr><td>Windows x64</td><td>Windows x86</td><td>Testado automaticamente</td></tr><tr><td>Linux x64</td><td>Linux x86</td><td>Testado automaticamente</td></tr></tbody></table>\n<p>If you test other combinations and find them to work, please update this document :)</p>\n<p>See the GN reference for allowable values of <a href=\"https://gn.googlesource.com/gn/+/master/docs/reference.md#built_in-predefined-variables-target_os_the-desired-operating-system-for-the-build-possible-values\"><code>target_os</code></a> and <a href=\"https://gn.googlesource.com/gn/+/master/docs/reference.md#built_in-predefined-variables-target_cpu_the-desired-cpu-architecture-for-the-build-possible-values\"><code>target_cpu</code></a>.</p>\n<h4 id=\"windows-no-arm-experimental\"><a href=\"#windows-no-arm-experimental\">Windows no Arm (experimental)</a></h4>\n<p>To cross-compile for Windows on Arm, <a href=\"https://chromium.googlesource.com/chromium/src/+/refs/heads/master/docs/windows_build_instructions.md#Visual-Studio\">follow Chromium's guide</a> to get the necessary dependencies, SDK and libraries, then build with <code>ELECTRON_BUILDING_WOA=1</code> in your environment before running <code>gclient sync</code>.</p>\n<pre><code class=\"hljs language-bat\"><span class=\"hljs-built_in\">set</span> ELECTRON_BUILDING_WOA=<span class=\"hljs-number\">1</span>\ngclient sync -f --with_branch_heads --with_tags\n</code></pre>\n<p>Ou (se usando PowerShell):</p>\n<pre><code class=\"hljs language-powershell\"><span class=\"hljs-variable\">$env:ELECTRON_BUILDING_WOA</span>=<span class=\"hljs-number\">1</span>\ngclient sync -f --with_branch_heads --with_tags\n</code></pre>\n<p>Next, run <code>gn gen</code> as above with <code>target_cpu=\"arm64\"</code>.</p>\n<h2 id=\"testes\"><a href=\"#testes\">Testes</a></h2>\n<p>To run the tests, you'll first need to build the test modules against the same version of Node.js that was built as part of the build process. To generate build headers for the modules to compile against, run the following under <code>src/</code> directory.</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Testing third_party/electron_node:headers\n</code></pre>\n<p>You can now <a href=\"/docs/development/testing#unit-tests\">run the tests</a>.</p>\n<p>If you're debugging something, it can be helpful to pass some extra flags to the Electron binary:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span> -- \\\n  --<span class=\"hljs-built_in\">enable</span>-logging -g <span class=\"hljs-string\">'BrowserWindow module'</span>\n</code></pre>\n<h2 id=\"sharing-the-git-cache-between-multiple-machines\"><a href=\"#sharing-the-git-cache-between-multiple-machines\">Sharing the git cache between multiple machines</a></h2>\n<p>It is possible to share the gclient git cache with other machines by exporting it as SMB share on linux, but only one process/machine can be using the cache at a time. The locks created by git-cache script will try to prevent this, but it may not work perfectly in a network.</p>\n<p>On Windows, SMBv2 has a directory cache that will cause problems with the git cache script, so it is necessary to disable it by setting the registry key</p>\n<pre><code class=\"hljs language-sh\">HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\Lanmanworkstation\\Parameters\\DirectoryCacheLifetime\n</code></pre>\n<p>to 0. More information: <a href=\"https://stackoverflow.com/a/9935126\">https://stackoverflow.com/a/9935126</a></p>\n<p>This can be set quickly in powershell (ran as administrator):</p>\n<pre><code class=\"hljs language-powershell\"><span class=\"hljs-built_in\">New-ItemProperty</span> -Path <span class=\"hljs-string\">\"HKLM:\\System\\CurrentControlSet\\Services\\Lanmanworkstation\\Parameters\"</span> -Name DirectoryCacheLifetime -Value <span class=\"hljs-number\">0</span> -PropertyType DWORD -Force\n</code></pre>\n<h2 id=\"solução-de-problemas\"><a href=\"#solução-de-problemas\">Solução de Problemas</a></h2>\n<h3 id=\"gclient-sync-complains-about-rebase\"><a href=\"#gclient-sync-complains-about-rebase\">gclient sync complains about rebase</a></h3>\n<p>If <code>gclient sync</code> is interrupted the git tree may be left in a bad state, leading to a cryptic message when running <code>gclient sync</code> in the future:</p>\n<pre><code class=\"hljs language-plaintext\">2> Conflict while rebasing this branch.\n2> Fix the conflict and run gclient again.\n2> See man git-rebase for details.\n</code></pre>\n<p>If there are no git conflicts or rebases in <code>src/electron</code>, you may need to abort a <code>git am</code> in <code>src</code>:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> ../\n$ git am --abort\n$ <span class=\"hljs-built_in\">cd</span> electron\n$ gclient sync -f\n</code></pre>\n<h3 id=\"estão-me-solicitando-um-nome-de-usuáriosenha-para-o-chromium-internogooglesourcecom\"><a href=\"#estão-me-solicitando-um-nome-de-usuáriosenha-para-o-chromium-internogooglesourcecom\">Estão me Solicitando um nome de Usuário/Senha para o chromium-interno.googlesource.com</a></h3>\n<p>Se você ver um prompt solicitando o <code>Usuário em 'https://chrome-internal.googlesource.com':</code> ao executar o <code>gclient sync</code> no Windows, Provavelmente é porque a variável de ambiente <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> não está definida como 0. Abra <code>Painel de Controle</code> → <code>Sistema e Segurança</code> → <code>Sistema</code> → <code>Configurações avançadas do sistema</code> e adicione uma variável do sistema chamada <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> com valor <code>0</code>.  This tells <code>depot_tools</code> to use your locally installed version of Visual Studio (by default, <code>depot_tools</code> will try to download a Google-internal version that only Googlers have access to).</p>",
      "title": "Instruções de Compilação",
      "description": "Instead of https://github.com/electron/electron, you can use your own fork here (something like https://github.com/<username>/electron)."
    },
    "/docs/development/build-instructions-linux": {
      "locale": "pt-BR",
      "slug": "build-instructions-linux",
      "href": "/docs/development/build-instructions-linux",
      "crowdinFileId": "256133",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-linux.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"instruções-para-configurar-linux\"><a href=\"#instruções-para-configurar-linux\">Instruções para Configurar (Linux)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on Linux, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>\n<p>At least 25GB disk space and 8GB RAM.</p>\n</li>\n<li>\n<p>Python 2.7.x. Some distributions like CentOS 6.x still use Python 2.6.x so you may need to check your Python version with <code>python -V</code>.</p>\n<p>Please also ensure that your system and Python version support at least TLS 1.2. For a quick test, run the following script:</p>\n<pre><code class=\"hljs language-sh\">$ npx @electron/check-python-tls\n</code></pre>\n<p>If the script returns that your configuration is using an outdated security protocol, use your system's package manager to update Python to the latest version in the 2.7.x branch. Alternatively, visit <a href=\"https://www.python.org/downloads/\">https://www.python.org/downloads/</a> for detailed instructions.</p>\n</li>\n<li>\n<p>Node.js. There are various ways to install Node. You can download source code from <a href=\"https://nodejs.org\">nodejs.org</a> and compile it. Doing so permits installing Node on your own home directory as a standard user. Or try repositories such as <a href=\"https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories\">NodeSource</a>.</p>\n</li>\n<li>\n<p><a href=\"https://clang.llvm.org/get_started.html\">clang</a> 3.4 or later.</p>\n</li>\n<li>\n<p>Development headers of GTK 3 and libnotify.</p>\n</li>\n</ul>\n<p>On Ubuntu, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install build-essential clang libdbus-1-dev libgtk-3-dev \\\n                       libnotify-dev libgnome-keyring-dev \\\n                       libasound2-dev libcap-dev libcups2-dev libxtst-dev \\\n                       libxss1 libnss3-dev gcc-multilib g++-multilib curl \\\n                       gperf bison python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On RHEL / CentOS, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo yum install clang dbus-devel gtk3-devel libnotify-devel \\\n                   libgnome-keyring-devel xorg-x11-server-utils libcap-devel \\\n                   cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \\\n                   nss-devel python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On Fedora, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo dnf install clang dbus-devel gtk3-devel libnotify-devel \\\n                   libgnome-keyring-devel xorg-x11-server-utils libcap-devel \\\n                   cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \\\n                   nss-devel python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On Arch Linux / Manjaro, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo pacman -Syu base-devel clang libdbus gtk2 libnotify \\\n                   libgnome-keyring alsa-lib libcap libcups libxtst \\\n                   libxss nss gcc-multilib curl gperf bison \\\n                   python2 python-dbusmock jdk8-openjdk\n</code></pre>\n<p>Other distributions may offer similar packages for installation via package managers such as pacman. Or one can compile from source code.</p>\n<h3 id=\"cross-compilation\"><a href=\"#cross-compilation\">Cross compilation</a></h3>\n<p>If you want to build for an <code>arm</code> target you should also install the following dependencies:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install libc6-dev-armhf-cross linux-libc-dev-armhf-cross \\\n                       g++-arm-linux-gnueabihf\n</code></pre>\n<p>Similarly for <code>arm64</code>, install the following:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install libc6-dev-arm64-cross linux-libc-dev-arm64-cross \\\n                       g++-aarch64-linux-gnu\n</code></pre>\n<p>And to cross-compile for <code>arm</code> or <code>ia32</code> targets, you should pass the <code>target_cpu</code> parameter to <code>gn gen</code>:</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">'import(...) target_cpu=\"arm\"'</span>\n</code></pre>\n<h2 id=\"compilando\"><a href=\"#compilando\">Compilando</a></h2>\n<p>See <a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a></p>\n<h2 id=\"solução-de-problemas\"><a href=\"#solução-de-problemas\">Solução de Problemas</a></h2>\n<h3 id=\"error-while-loading-shared-libraries-libtinfoso5\"><a href=\"#error-while-loading-shared-libraries-libtinfoso5\">Error While Loading Shared Libraries: libtinfo.so.5</a></h3>\n<p>Prebuilt <code>clang</code> will try to link to <code>libtinfo.so.5</code>. Depending on the host architecture, symlink to appropriate <code>libncurses</code>:</p>\n<pre><code class=\"hljs language-sh\">$ sudo ln -s /usr/lib/libncurses.so.5 /usr/lib/libtinfo.so.5\n</code></pre>\n<h2 id=\"advanced-topics\"><a href=\"#advanced-topics\">Advanced topics</a></h2>\n<p>The default building configuration is targeted for major desktop Linux distributions. To build for a specific distribution or device, the following information may help you.</p>\n<h3 id=\"using-system-clang-instead-of-downloaded-clang-binaries\"><a href=\"#using-system-clang-instead-of-downloaded-clang-binaries\">Using system <code>clang</code> instead of downloaded <code>clang</code> binaries</a></h3>\n<p>By default Electron is built with prebuilt <a href=\"https://clang.llvm.org/get_started.html\"><code>clang</code></a> binaries provided by the Chromium project. If for some reason you want to build with the <code>clang</code> installed in your system, you can specify the <code>clang_base_path</code> argument in the GN args.</p>\n<p>For example if you installed <code>clang</code> under <code>/usr/local/bin/clang</code>:</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">'import(\"//electron/build/args/testing.gn\") clang_base_path = \"/usr/local/bin\"'</span>\n</code></pre>\n<h3 id=\"using-compilers-other-than-clang\"><a href=\"#using-compilers-other-than-clang\">Using compilers other than <code>clang</code></a></h3>\n<p>Building Electron with compilers other than <code>clang</code> is not supported.</p>",
      "title": "Instruções para Configurar (Linux)",
      "description": ""
    },
    "/docs/development/build-instructions-macos": {
      "locale": "pt-BR",
      "slug": "build-instructions-macos",
      "href": "/docs/development/build-instructions-macos",
      "crowdinFileId": "256135",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-macos.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"instruções-de-compilação-macos\"><a href=\"#instruções-de-compilação-macos\">Instruções de Compilação (macOS)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on macOS, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>macOS >= 10.11.6</li>\n<li><a href=\"https://developer.apple.com/technologies/tools/\">Xcode</a> >= 9.0.0</li>\n<li><a href=\"https://nodejs.org\">node.js</a> (externo)</li>\n<li>Python 2.7 com suporte para TLS 1.2</li>\n</ul>\n<h2 id=\"python\"><a href=\"#python\">Python</a></h2>\n<p>Please also ensure that your system and Python version support at least TLS 1.2. This depends on both your version of macOS and Python. For a quick test, run:</p>\n<pre><code class=\"hljs language-sh\">$ npx @electron/check-python-tls\n</code></pre>\n<p>If the script returns that your configuration is using an outdated security protocol, you can either update macOS to High Sierra or install a new version of Python 2.7.x. To upgrade Python, use <a href=\"https://brew.sh/\">Homebrew</a>:</p>\n<pre><code class=\"hljs language-sh\">$ brew install python@2 &#x26;&#x26; brew link python@2 --force\n</code></pre>\n<p>If you are using Python as provided by Homebrew, you also need to install the following Python modules:</p>\n<ul>\n<li><a href=\"https://pypi.org/project/pyobjc/#description\">pyobjc</a></li>\n</ul>\n<p>You can use <code>pip</code> to install it:</p>\n<pre><code class=\"hljs language-sh\">$ pip instalar pyobjc\n</code></pre>\n<h2 id=\"macos-sdk\"><a href=\"#macos-sdk\">macOS SDK</a></h2>\n<p>Se está desenvolvendo com Electron e não planeja redistribuir sua construção personalizada, pode pular essa seção.</p>\n<p>Official Electron builds are built with <a href=\"https://download.developer.apple.com/Developer_Tools/Xcode_12.2/Xcode_12.2.xip\">Xcode 12.2</a>, and the macOS 11.0 SDK. Compilar com um SDK mais recente também funciona, mas os lançamentos atualmente usam o SDK 11.0.</p>\n<h2 id=\"construindo-electron\"><a href=\"#construindo-electron\">Construindo Electron</a></h2>\n<p>Veja <a href=\"/docs/development/build-instructions-gn\">Instruções de build: GN</a>.</p>",
      "title": "Instruções de Compilação (macOS)",
      "description": ""
    },
    "/docs/development/build-instructions-windows": {
      "locale": "pt-BR",
      "slug": "build-instructions-windows",
      "href": "/docs/development/build-instructions-windows",
      "crowdinFileId": "256137",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-windows.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"instruções-para-configuração-windows\"><a href=\"#instruções-para-configuração-windows\">Instruções para Configuração (Windows)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on Windows, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>Windows 10 / Server 2012 R2 ou superior</li>\n<li>Visual Studio 2017 15.7.2 or higher - <a href=\"https://www.visualstudio.com/vs/\">download VS 2019 Community Edition for free</a><ul>\n<li>See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md#visual-studio\">the Chromium build documentation</a> for more details on which Visual Studio components are required.</li>\n<li>If your Visual Studio is installed in a directory other than the default, you'll need to set a few environment variables to point the toolchains to your installation path.<ul>\n<li><code>vs2019_install = DRIVE:\\path\\to\\Microsoft Visual Studio\\2019\\Community</code>, replacing <code>2019</code> and <code>Community</code> with your installed versions and replacing <code>DRIVE:</code> with the drive that Visual Studio is on. Often, this will be <code>C:</code>.</li>\n<li><code>WINDOWSSDKDIR = DRIVE:\\path\\to\\Windows Kits\\10</code>, replacing <code>DRIVE:</code> with the drive that Windows Kits is on. Often, this will be <code>C:</code>.</li>\n</ul></li>\n<li><a href=\"https://pypi.org/project/pywin32/#files\">Python for Windows (pywin32) Extensions</a> is also needed in order to run the build process.</li>\n</ul></li>\n<li><a href=\"https://nodejs.org/download/\">Node.js</a></li>\n<li><a href=\"https://git-scm.com\">Git</a></li>\n<li>Debugging Tools for Windows of Windows SDK 10.0.15063.468 if you plan on creating a full distribution since <code>symstore.exe</code> is used for creating a symbol store from <code>.pdb</code> files.<ul>\n<li>Different versions of the SDK can be installed side by side. To install the SDK, open Visual Studio Installer, select <code>Modify</code> → <code>Individual Components</code>, scroll down and select the appropriate Windows SDK to install. Another option would be to look at the <a href=\"https://developer.microsoft.com/en-us/windows/downloads/sdk-archive\">Windows SDK and emulator archive</a> and download the standalone version of the SDK respectively.</li>\n<li>As Ferramentas de Depuração do SDK também devem ser instaladas. If the Windows 10 SDK was installed via the Visual Studio installer, then they can be installed by going to: <code>Control Panel</code> → <code>Programs</code> → <code>Programs and Features</code> → Select the \"Windows Software Development Kit\" → <code>Change</code> → <code>Change</code> → Check \"Debugging Tools For Windows\" → <code>Change</code>. Or, you can download the standalone SDK installer and use it to install the Debugging Tools.</li>\n</ul></li>\n</ul>\n<p>Caso você não tenha uma instalação do Windows, acesso o endereço <a href=\"https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/\">dev.microsoftedge.com</a>, tem uma versão para que possa configurar o Electron.</p>\n<p>A configuração do Electron é feita totalmente por linha de comando, não é possível fazer pelo o Visual Studio. Você pode desenvolver com Electron utilizando qualquer editor, futuramente haverá suporte para o Visual Studio.</p>\n<p><strong>Note:</strong> Mesmo que o Visual Studio não seja utilizado para desenvolver com Electron, ainda é preciso ter instalado. <strong>required</strong> Porque é necessário a toolchains fornecida.</p>\n<h2 id=\"exclude-source-tree-from-windows-security\"><a href=\"#exclude-source-tree-from-windows-security\">Exclude source tree from Windows Security</a></h2>\n<p>Windows Security doesn't like one of the files in the Chromium source code (see <a href=\"https://crbug.com/441184\">https://crbug.com/441184</a>), so it will constantly delete it, causing <code>gclient sync</code> issues. You can exclude the source tree from being monitored by Windows Security by <a href=\"https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26\">following these instructions</a>.</p>\n<h2 id=\"compilando\"><a href=\"#compilando\">Compilando</a></h2>\n<p>See <a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a></p>\n<h2 id=\"compilação-32bit\"><a href=\"#compilação-32bit\">Compilação 32bit</a></h2>\n<p>To build for the 32bit target, you need to pass <code>target_cpu = \"x86\"</code> as a GN arg. You can build the 32bit target alongside the 64bit target by using a different output directory for GN, e.g. <code>out/Release-x86</code>, with different arguments.</p>\n<pre><code class=\"hljs language-powershell\">$ gn gen out/Release-x86 --args=<span class=\"hljs-string\">\"import(\\\"</span>//electron/build/args/release.gn\\<span class=\"hljs-string\">\") target_cpu=\\\"</span>x86\\<span class=\"hljs-string\">\"\"</span>\n</code></pre>\n<p>Os outros passos para a compilação são os mesmos.</p>\n<h2 id=\"projeto-visual-studio\"><a href=\"#projeto-visual-studio\">Projeto Visual Studio</a></h2>\n<p>To generate a Visual Studio project, you can pass the <code>--ide=vs2017</code> parameter to <code>gn gen</code>:</p>\n<pre><code class=\"hljs language-powershell\">$ gn gen out/Testing --ide=vs2017\n</code></pre>\n<h2 id=\"solução-de-problemas\"><a href=\"#solução-de-problemas\">Solução de Problemas</a></h2>\n<h3 id=\"comando-xxxx-não-encontrado\"><a href=\"#comando-xxxx-não-encontrado\">Comando xxxx não encontrado</a></h3>\n<p>Se você encontrar um erro parecido com <code>Command xxxx not found</code>, você pode tentar usar o console do <code>Prompt de Comando do VS2015</code> para executar os scripts do build.</p>\n<h3 id=\"erro-fatal-do-compilador-interno-c1001\"><a href=\"#erro-fatal-do-compilador-interno-c1001\">Erro fatal do compilador interno: C1001</a></h3>\n<p>Verifique se você tem a atualização mais recente do Visual Studio instalada.</p>\n<h3 id=\"lnk1181-não-é-possível-abrir-o-arquivo-kernel32lib\"><a href=\"#lnk1181-não-é-possível-abrir-o-arquivo-kernel32lib\">LNK1181: não é possível abrir o arquivo 'kernel32.lib'</a></h3>\n<p>Tente reinstalar o Node.js 32bit.</p>\n<h3 id=\"erro-enoent-stat-cusersusernameappdataroamingnpm\"><a href=\"#erro-enoent-stat-cusersusernameappdataroamingnpm\">Erro: ENOENT, stat 'C:\\Users\\USERNAME\\AppData\\Roaming\\npm'</a></h3>\n<p>Creating that directory <a href=\"https://stackoverflow.com/a/25095327/102704\">should fix the problem</a>:</p>\n<pre><code class=\"hljs language-powershell\">$ mkdir ~\\AppData\\Roaming\\npm\n</code></pre>\n<h3 id=\"node-gyp-não-é-reconhecido-como-um-comando-interno-ou-externo\"><a href=\"#node-gyp-não-é-reconhecido-como-um-comando-interno-ou-externo\">node-gyp não é reconhecido como um comando interno ou externo</a></h3>\n<p>Você pode obter este erro se você estiver usando Git Bash para construção, você deve usar o PowerShell ou VS2015 Command Prompt.</p>\n<h3 id=\"cannot-create-directory-at--filename-too-long\"><a href=\"#cannot-create-directory-at--filename-too-long\">cannot create directory at '...': Filename too long</a></h3>\n<p>node.js has some <a href=\"https://github.com/electron/node/tree/electron/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/read-pkg-up/node_modules/read-pkg/node_modules/load-json-file/node_modules/parse-json/node_modules/error-ex/node_modules/is-arrayish\">extremely long pathnames</a>, and by default git on windows doesn't handle long pathnames correctly (even though windows supports them). This should fix it:</p>\n<pre><code class=\"hljs language-sh\">$ git config --system core.longpaths <span class=\"hljs-literal\">true</span>\n</code></pre>\n<h3 id=\"error-use-of-undeclared-identifier-defaultdelegatecheckmode\"><a href=\"#error-use-of-undeclared-identifier-defaultdelegatecheckmode\">error: use of undeclared identifier 'DefaultDelegateCheckMode'</a></h3>\n<p>This can happen during build, when Debugging Tools for Windows has been installed with Windows Driver Kit. Uninstall Windows Driver Kit and install Debugging Tools with steps described above.</p>\n<h3 id=\"importerror-no-module-named-win32file\"><a href=\"#importerror-no-module-named-win32file\">ImportError: No module named win32file</a></h3>\n<p>Make sure you have installed <code>pywin32</code> with <code>pip install pywin32</code>.</p>\n<h3 id=\"build-scripts-hang-until-keypress\"><a href=\"#build-scripts-hang-until-keypress\">Build Scripts Hang Until Keypress</a></h3>\n<p>This bug is a \"feature\" of Windows' command prompt. It happens when clicking inside the prompt window with <code>QuickEdit</code> enabled and is intended to allow selecting and copying output text easily. Since each accidental click will pause the build process, you might want to disable this feature in the command prompt properties.</p>",
      "title": "Instruções para Configuração (Windows)",
      "description": ""
    },
    "/docs/development/build-system-overview": {
      "locale": "pt-BR",
      "slug": "build-system-overview",
      "href": "/docs/development/build-system-overview",
      "crowdinFileId": "256139",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-system-overview.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"construir-resumo-do-sistema\"><a href=\"#construir-resumo-do-sistema\">Construir Resumo do Sistema</a></h1>\n<p>Electron uses <a href=\"https://gn.googlesource.com/gn\">GN</a> for project generation and <a href=\"https://ninja-build.org/\">ninja</a> for building. Configurações do projeto podem ser encontradas em arquivos <code>.gn</code> e <code>.gni</code>.</p>\n<h2 id=\"gn-files\"><a href=\"#gn-files\">GN Files</a></h2>\n<p>The following <code>gn</code> files contain the main rules for building Electron:</p>\n<ul>\n<li><code>BUILD.gn</code> defines how Electron itself is built and includes the default configurations for linking with Chromium.</li>\n<li><code>build/args/{debug,release,all}.gn</code> contain the default build arguments for building Electron.</li>\n</ul>\n<h2 id=\"component-build\"><a href=\"#component-build\">Component Build</a></h2>\n<p>Since Chromium is quite a large project, the final linking stage can take quite a few minutes, which makes it hard for development. In order to solve this, Chromium introduced the \"component build\", which builds each component as a separate shared library, making linking very quick but sacrificing file size and performance.</p>\n<p>Electron inherits this build option from Chromium. In <code>Debug</code> builds, the binary will be linked to a shared library version of Chromium's components to achieve fast linking time; for <code>Release</code> builds, the binary will be linked to the static library versions, so we can have the best possible binary size and performance.</p>\n<h2 id=\"testes\"><a href=\"#testes\">Testes</a></h2>\n<p><strong>NB</strong> <em>this section is out of date and contains information that is no longer relevant to the GN-built electron.</em></p>\n<p>Teste suas modificações de acordo com o projeto, usando o estilo de codificação:</p>\n<pre><code class=\"hljs language-sh\">$ npm run lint\n</code></pre>\n<p>Teste a funcionalidade usando:</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>Sempre que fizer alterações no seu código Electron, terá de reconstruir antes de rodar os testes:</p>\n<pre><code class=\"hljs language-sh\">$ npm run build &#x26;&#x26; npm <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>You can make the test suite run faster by isolating the specific test or block you're currently working on using Mocha's <a href=\"https://mochajs.org/#exclusive-tests\">exclusive tests</a> feature. Append <code>.only</code> to any <code>describe</code> or <code>it</code> function call:</p>\n<pre><code class=\"hljs language-js\">describe.only(<span class=\"hljs-string\">'some feature'</span>, () => {\n  <span class=\"hljs-comment\">// ... only tests in this block will be run</span>\n})\n</code></pre>\n<p>Alternatively, you can use mocha's <code>grep</code> option to only run tests matching the given regular expression pattern:</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span> -- --grep child_process\n</code></pre>\n<p>Tests that include native modules (e.g. <code>runas</code>) can't be executed with the debug build (see <a href=\"https://github.com/electron/electron/issues/2558\">#2558</a> for details), but they will work with the release build.</p>\n<p>To run the tests with the release build use:</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span> -- -R\n</code></pre>",
      "title": "Construir Resumo do Sistema",
      "description": ""
    },
    "/docs/api/structures/certificate": {
      "locale": "pt-BR",
      "slug": "certificate",
      "href": "/docs/api/structures/certificate",
      "crowdinFileId": "256415",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/certificate.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"certificate-object\"><a href=\"#certificate-object\">Certificate Object</a></h1>\n<ul>\n<li><code>data</code> String - PEM encoded data</li>\n<li><code>issuer</code> <a href=\"/docs/api/structures/certificate-principal\">CertificatePrincipal</a> - Issuer principal</li>\n<li><code>issuerName</code> String - Issuer's Common Name</li>\n<li><code>issuerCert</code> Certificate - Issuer certificate (if not self-signed)</li>\n<li><code>subject</code> <a href=\"/docs/api/structures/certificate-principal\">CertificatePrincipal</a> - Subject principal</li>\n<li><code>subjectName</code> String - Subject's Common Name</li>\n<li><code>serialNumber</code> String - Hex value represented string</li>\n<li><code>validStart</code> Number - Start date of the certificate being valid in seconds</li>\n<li><code>validExpiry</code> Number - End date of the certificate being valid in seconds</li>\n<li><code>fingerprint</code> String - Fingerprint of the certificate</li>\n</ul>",
      "title": "Certificate Object",
      "description": ""
    },
    "/docs/api/structures/certificate-principal": {
      "locale": "pt-BR",
      "slug": "certificate-principal",
      "href": "/docs/api/structures/certificate-principal",
      "crowdinFileId": "256413",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/certificate-principal.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"certificateprincipal-object\"><a href=\"#certificateprincipal-object\">CertificatePrincipal Object</a></h1>\n<ul>\n<li><code>commonName</code> String - Common Name.</li>\n<li><code>organizations</code> String[] - Organization names.</li>\n<li><code>organizationUnits</code> String[] - Organization Unit names.</li>\n<li><code>locality</code> String - Locality.</li>\n<li><code>state</code> String - State or province.</li>\n<li><code>country</code> String - Country or region.</li>\n</ul>",
      "title": "CertificatePrincipal Object",
      "description": ""
    },
    "/docs/development/chromium-development": {
      "locale": "pt-BR",
      "slug": "chromium-development",
      "href": "/docs/development/chromium-development",
      "crowdinFileId": "256141",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/chromium-development.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"desenvolvimento-do-chromium\"><a href=\"#desenvolvimento-do-chromium\">Desenvolvimento do Chromium</a></h1>\n<blockquote>\n<p>Uma coleção de recursos para a aprendizagem sobre o Chromium e controle de seu desenvolvimento</p>\n</blockquote>\n<ul>\n<li><a href=\"https://twitter.com/ChromiumDev\">@ChromiumDev</a> no Twitter</li>\n<li><a href=\"https://twitter.com/googlechrome\">@googlechrome</a> no Twitter</li>\n<li><a href=\"https://blog.chromium.org\">Blog</a></li>\n<li><a href=\"https://cs.chromium.org/\">Pesquisa de código</a></li>\n<li><a href=\"https://cs.chromium.org/chromium/src/\">Código Fonte</a></li>\n<li><a href=\"https://www.chromium.org/developers/calendar\">Calendário de desenvolvimento e informações sobre novas versões</a></li>\n<li><a href=\"https://www.chromium.org/developers/discussion-groups\">Grupos de discussão</a></li>\n</ul>\n<p>Veja também <a href=\"/docs/development/v8-development\">V8 Development</a></p>",
      "title": "Desenvolvimento do Chromium",
      "description": "Uma coleção de recursos para a aprendizagem sobre o Chromium e controle de seu desenvolvimento"
    },
    "/docs/development/clang-format": {
      "locale": "pt-BR",
      "slug": "clang-format",
      "href": "/docs/development/clang-format",
      "crowdinFileId": "256143",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/clang-format.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"usando-clang-format-em-código-c\"><a href=\"#usando-clang-format-em-código-c\">Usando clang-format em Código C++</a></h1>\n<p><a href=\"https://clang.llvm.org/docs/ClangFormat.html\"><code>clang-format</code></a> é uma ferramenta para aplica estilo de codificação em C/C++/Objective-C para que os desenvolvedores não precisem se preocuparem com questões desse tipo, durante as revisões de código.</p>\n<p>É altamente recomendável para formatar o seu código alterado em C++, antes de abir uma solicitação de pull requests, que irão salvar você e o tempo de revisores.</p>\n<p>Você pode instalar o <code>clang-format</code> e <code>git-clang-format</code> através do <code>npm install -g clang-format</code>.</p>\n<p>To automatically format a file according to Electron C++ code style, run <code>clang-format -i path/to/electron/file.cc</code>. It should work on macOS/Linux/Windows.</p>\n<p>O fluxo de trabalho para formatar o seu código alterado:</p>\n<ol>\n<li>Fazer alterações de código no repositório do Electron.</li>\n<li>Use <code>git add your_changed_file.cc</code>.</li>\n<li>Use <code>git-clang-format</code>, e você vai provavelmente ver uma notificação em <code>your_changed_file.cc</code>, essas modificações são geradas do <code>clang-format</code>.</li>\n<li>Use <code>git add your_changed_file.cc</code>, e confirme a sua alteração.</li>\n<li>Agora a branch está pronto para ser aberto em uma solicitação de pull request.</li>\n</ol>\n<p>If you want to format the changed code on your latest git commit (HEAD), you can run <code>git-clang-format HEAD~1</code>. See <code>git-clang-format -h</code> for more details.</p>\n<h2 id=\"integração-com-editor\"><a href=\"#integração-com-editor\">Integração com Editor</a></h2>\n<p>You can also integrate <code>clang-format</code> directly into your favorite editors. For further guidance on setting up editor integration, see these pages:</p>\n<ul>\n<li><a href=\"https://atom.io/packages/clang-format\">Atom</a></li>\n<li><a href=\"https://clang.llvm.org/docs/ClangFormat.html#vim-integration\">Vim &#x26; Emacs</a></li>\n<li><a href=\"https://marketplace.visualstudio.com/items?itemName=xaver.clang-format\">Visual Studio Code</a></li>\n</ul>",
      "title": "Usando clang-format em Código C++",
      "description": ""
    },
    "/docs/development/clang-tidy": {
      "locale": "pt-BR",
      "slug": "clang-tidy",
      "href": "/docs/development/clang-tidy",
      "crowdinFileId": "256145",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/clang-tidy.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"using-clang-tidy-on-c-code\"><a href=\"#using-clang-tidy-on-c-code\">Using clang-tidy on C++ Code</a></h1>\n<p><a href=\"https://clang.llvm.org/extra/clang-tidy/\"><code>clang-tidy</code></a> is a tool to automatically check C/C++/Objective-C code for style violations, programming errors, and best practices.</p>\n<p>Electron's <code>clang-tidy</code> integration is provided as a linter script which can be run with <code>npm run lint:clang-tidy</code>. While <code>clang-tidy</code> checks your on-disk files, you need to have built Electron so that it knows which compiler flags were used. There is one required option for the script <code>--output-dir</code>, which tells the script which build directory to pull the compilation information from. A typical usage would be: <code>npm run lint:clang-tidy --out-dir ../out/Testing</code></p>\n<p>With no filenames provided, all C/C++/Objective-C files will be checked. You can provide a list of files to be checked by passing the filenames after the options: <code>npm run lint:clang-tidy --out-dir ../out/Testing shell/browser/api/electron_api_app.cc</code></p>\n<p>While <code>clang-tidy</code> has a <a href=\"https://clang.llvm.org/extra/clang-tidy/checks/list.html\">long list</a> of possible checks, in Electron only a few are enabled by default. At the moment Electron doesn't have a <code>.clang-tidy</code> config, so <code>clang-tidy</code> will find the one from Chromium at <code>src/.clang-tidy</code> and use the checks which Chromium has enabled. You can change which checks are run by using the <code>--checks=</code> option. This is passed straight through to <code>clang-tidy</code>, so see its documentation for full details. Wildcards can be used, and checks can be disabled by prefixing a <code>-</code>. By default any checks listed are added to those in <code>.clang-tidy</code>, so if you'd like to limit the checks to specific ones you should first exclude all checks then add back what you want, like <code>--checks=-*,performance*</code>.</p>\n<p>Running <code>clang-tidy</code> is rather slow - internally it compiles each file and then runs the checks so it will always be some factor slower than compilation. While you can use parallel runs to speed it up using the <code>--jobs|-j</code> option, <code>clang-tidy</code> also uses a lot of memory during its checks, so it can easily run into out-of-memory errors. As such the default number of jobs is one.</p>",
      "title": "Using clang-tidy on C++ Code",
      "description": ""
    },
    "/docs/api/client-request": {
      "locale": "pt-BR",
      "slug": "client-request",
      "href": "/docs/api/client-request",
      "crowdinFileId": "256289",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/client-request.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-clientrequest\"><a href=\"#class-clientrequest\">Class: ClientRequest</a></h2>\n<blockquote>\n<p>Realiza requisições HTTP/HTTPS.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>ClientRequest</code> implementa a interface <a href=\"https://nodejs.org/api/stream.html#stream_writable_streams\">Writable Stream</a> e deste modo um <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h3 id=\"new-clientrequestopções\"><a href=\"#new-clientrequestopções\"><code>new ClientRequest(opções)</code></a></h3>\n<ul>\n<li><code>options</code> (Object | String) - If <code>options</code> is a String, it is interpreted as the request URL. If it is an object, it is expected to fully specify an HTTP request via the following properties:<ul>\n<li><code>method</code> String (optional) - The HTTP request method. Defaults to the GET method.</li>\n<li><code>url</code> String (optional) - The request URL. Must be provided in the absolute form with the protocol scheme specified as http or https.</li>\n<li><code>session</code> Session (optional) - The <a href=\"/docs/api/session\"><code>Session</code></a> instance with which the request is associated.</li>\n<li><code>partition</code> String (opcional) - O nome da <a href=\"/docs/api/session\"><code>partição</code></a> com a qual a requisição está associada. O padrão é uma string vazia. The <code>session</code> option supersedes <code>partition</code>. Assim, se a <code>sessão</code> é explicitamente especificada, a <code>partição</code> é ignorada.</li>\n<li><code>credentials</code> String (optional) - Can be <code>include</code> or <code>omit</code>. Whether to send <a href=\"https://fetch.spec.whatwg.org/#credentials\">credentials</a> with this request. If set to <code>include</code>, credentials from the session associated with the request will be used. If set to <code>omit</code>, credentials will not be sent with the request (and the <code>'login'</code> event will not be triggered in the event of a 401). This matches the behavior of the <a href=\"https://fetch.spec.whatwg.org/#concept-request-credentials-mode\">fetch</a> option of the same name. If this option is not specified, authentication data from the session will be sent, and cookies will not be sent (unless <code>useSessionCookies</code> is set).</li>\n<li><code>useSessionCookies</code> Boolean (optional) - Whether to send cookies with this request from the provided session. If <code>credentials</code> is specified, this option has no effect. Por padrão é <code>false</code>.</li>\n<li><code>protocol</code> String (optional) - Can be <code>http:</code> or <code>https:</code>. The protocol scheme in the form 'scheme:'. Defaults to 'http:'.</li>\n<li><code>host</code> String (opcional) - O servidor, definido como a concatenação do nome com a porta: 'nome:porta'.</li>\n<li><code>hostname</code> String (opcional) - O nome do servidor.</li>\n<li><code>port</code> Integer (opcional) - O número da porta do servidor.</li>\n<li><code>path</code> String (opcional) - A parte do caminho da URL de requisição.</li>\n<li><code>redirect</code> String (optional) - Can be <code>follow</code>, <code>error</code> or <code>manual</code>. The redirect mode for this request. When mode is <code>error</code>, any redirection will be aborted. When mode is <code>manual</code> the redirection will be cancelled unless <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> is invoked synchronously during the <a href=\"#event-redirect\"><code>redirect</code></a> event.  O padrão é <code>follow</code>.</li>\n<li><code>origin</code> String (optional) - The origin URL of the request.</li>\n</ul></li>\n</ul>\n<p>As propriedades em <code>options</code>, como <code>protocol</code>, <code>host</code>, <code>hostname</code>, <code>port</code> e <code>path</code> seguem estritamente o modelo Node.js, como descrito no módulo <a href=\"https://nodejs.org/api/url.html\">URL</a>.</p>\n<p>Por exemplo, nós poderíamos criar a mesma requisição para 'github.com' da seguinte forma:</p>\n<pre><code class=\"hljs language-JavaScript\"><span class=\"hljs-keyword\">const</span> request = net.request({\n  <span class=\"hljs-attr\">method</span>: <span class=\"hljs-string\">'GET'</span>,\n  <span class=\"hljs-attr\">protocol</span>: <span class=\"hljs-string\">'https:'</span>,\n  <span class=\"hljs-attr\">hostname</span>: <span class=\"hljs-string\">'github.com'</span>,\n  <span class=\"hljs-attr\">port</span>: <span class=\"hljs-number\">443</span>,\n  <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'/'</span>\n})\n</code></pre>\n<h3 id=\"eventos-de-instância\"><a href=\"#eventos-de-instância\">Eventos de instância</a></h3>\n<h4 id=\"evento-response\"><a href=\"#evento-response\">Evento: 'response'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>response</code> <a href=\"/docs/api/incoming-message\">IncomingMessage</a> - An object representing the HTTP response message.</li>\n</ul>\n<h4 id=\"evento-login\"><a href=\"#evento-login\">Evento: 'login'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li>Objeto <code>authInfo</code><ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (opcional)</li>\n<li><code>password</code> String (opcional)</li>\n</ul></li>\n</ul>\n<p>Emitido quando um proxy de autenticação está solicitando as credenciais de usuário.</p>\n<p>A função de <code>callback</code> é esperada para chamar de volta as credenciais do usuário:</p>\n<ul>\n<li><code>username</code> String</li>\n<li><code>password</code> String</li>\n</ul>\n<pre><code class=\"hljs language-JavaScript\">request.on(<span class=\"hljs-string\">'login'</span>, (authInfo, callback) => {\n  callback(<span class=\"hljs-string\">'username'</span>, <span class=\"hljs-string\">'password'</span>)\n})\n</code></pre>\n<p>Informar credenciais vazias irá cancelar a requisição e reportar um erro de autenticação no objeto de resposta:</p>\n<pre><code class=\"hljs language-JavaScript\">request.on(<span class=\"hljs-string\">'response'</span>, (response) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`STATUS: <span class=\"hljs-subst\">${response.statusCode}</span>`</span>);\n  response.on(<span class=\"hljs-string\">'error'</span>, (error) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`ERROR: <span class=\"hljs-subst\">${<span class=\"hljs-built_in\">JSON</span>.stringify(error)}</span>`</span>)\n  })\n})\nrequest.on(<span class=\"hljs-string\">'login'</span>, (authInfo, callback) => {\n  callback()\n})\n</code></pre>\n<h4 id=\"evento-finish\"><a href=\"#evento-finish\">Evento: 'finish'</a></h4>\n<p>Emitido logo após o último pedaço dos dados de <code>request</code> for escrito no objeto <code>request</code>.</p>\n<h4 id=\"evento-abort\"><a href=\"#evento-abort\">Evento: 'abort'</a></h4>\n<p>Emitted when the <code>request</code> is aborted. The <code>abort</code> event will not be fired if the <code>request</code> is already closed.</p>\n<h4 id=\"evento-error\"><a href=\"#evento-error\">Evento: 'error'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>error</code> Error - um objeto de erro que provê informações sobre a falha.</li>\n</ul>\n<p>Emitido quando o módulo <code>net</code> falha ao emitir uma requisição de rede. Normalmente quando o objeto <code>request</code> emite um evento <code>error</code>, um evento <code>close</code> virá a seguir e nenhum objeto de resposta será fornecido.</p>\n<h4 id=\"evento-close\"><a href=\"#evento-close\">Evento: 'close'</a></h4>\n<p>Emitido como último evento na transação HTTP de requisição-resposta. O evento <code>close</code> indica que nenhum outro evento será emitido no objeto <code>request</code> e nem no objeto <code>response</code>.</p>\n<h4 id=\"evento-redirect\"><a href=\"#evento-redirect\">Evento: 'redirect'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>statusCode</code> Integer</li>\n<li><code>method</code> String</li>\n<li><code>redirectUrl</code> String</li>\n<li><code>responseHeaders</code> Record&#x3C;String, String[]></li>\n</ul>\n<p>Emitted when the server returns a redirect response (e.g. 301 Moved Permanently). Calling <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> will continue with the redirection.  If this event is handled, <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> must be called <strong>synchronously</strong>, otherwise the request will be cancelled.</p>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<h4 id=\"requestchunkedencoding\"><a href=\"#requestchunkedencoding\"><code>request.chunkedEncoding</code></a></h4>\n<p>A <code>Boolean</code> specifying whether the request will use HTTP chunked transfer encoding or not. Defaults to false. The property is readable and writable, however it can be set only before the first write operation as the HTTP headers are not yet put on the wire. Trying to set the <code>chunkedEncoding</code> property after the first write will throw an error.</p>\n<p>Using chunked encoding is strongly recommended if you need to send a large request body as data will be streamed in small chunks instead of being internally buffered inside Electron process memory.</p>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<h4 id=\"requestsetheadername-value\"><a href=\"#requestsetheadername-value\"><code>request.setHeader(name, value)</code></a></h4>\n<ul>\n<li><code>name</code> String - An extra HTTP header name.</li>\n<li><code>value</code> String - An extra HTTP header value.</li>\n</ul>\n<p>Adds an extra HTTP header. The header name will be issued as-is without lowercasing. It can be called only before first write. Calling this method after the first write will throw an error. If the passed value is not a <code>String</code>, its <code>toString()</code> method will be called to obtain the final value.</p>\n<p>Certain headers are restricted from being set by apps. These headers are listed below. More information on restricted headers can be found in <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:services/network/public/cpp/header_util.cc;drc=1562cab3f1eda927938f8f4a5a91991fefde66d3;bpv=1;bpt=1;l=22\">Chromium's header utils</a>.</p>\n<ul>\n<li><code>Content-Length</code></li>\n<li><code>Host</code></li>\n<li><code>Trailer</code> ou <code>Te</code></li>\n<li><code>Upgrade</code></li>\n<li><code>Cookie2</code></li>\n<li><code>Keep-Alive</code></li>\n<li><code>Transfer-Encoding</code></li>\n</ul>\n<p>Additionally, setting the <code>Connection</code> header to the value <code>upgrade</code> is also disallowed.</p>\n<h4 id=\"requestgetheadername\"><a href=\"#requestgetheadername\"><code>request.getHeader(name)</code></a></h4>\n<ul>\n<li><code>name</code> String - Specify an extra header name.</li>\n</ul>\n<p>Returns <code>String</code> - The value of a previously set extra header name.</p>\n<h4 id=\"requestremoveheadername\"><a href=\"#requestremoveheadername\"><code>request.removeHeader(name)</code></a></h4>\n<ul>\n<li><code>name</code> String - Specify an extra header name.</li>\n</ul>\n<p>Removes a previously set extra header name. This method can be called only before first write. Trying to call it after the first write will throw an error.</p>\n<h4 id=\"requestwritechunk-encoding-callback\"><a href=\"#requestwritechunk-encoding-callback\"><code>request.write(chunk[, encoding][, callback])</code></a></h4>\n<ul>\n<li><code>chunk</code> (String | Buffer) - A chunk of the request body's data. If it is a string, it is converted into a Buffer using the specified encoding.</li>\n<li><code>encoding</code> String (optional) - Used to convert string chunks into Buffer objects. Defaults to 'utf-8'.</li>\n<li><code>callback</code> Function (optional) - Called after the write operation ends.</li>\n</ul>\n<p><code>callback</code> is essentially a dummy function introduced in the purpose of keeping similarity with the Node.js API. It is called asynchronously in the next tick after <code>chunk</code> content have been delivered to the Chromium networking layer. Contrary to the Node.js implementation, it is not guaranteed that <code>chunk</code> content have been flushed on the wire before <code>callback</code> is called.</p>\n<p>Adds a chunk of data to the request body. The first write operation may cause the request headers to be issued on the wire. After the first write operation, it is not allowed to add or remove a custom header.</p>\n<h4 id=\"requestendchunk-encoding-callback\"><a href=\"#requestendchunk-encoding-callback\"><code>request.end([chunk][, encoding][, callback])</code></a></h4>\n<ul>\n<li><code>chunk</code> (String | Buffer) (optional)</li>\n<li><code>encoding</code> String (opcional)</li>\n<li><code>callback</code> Function (optional)</li>\n</ul>\n<p>Sends the last chunk of the request data. Subsequent write or end operations will not be allowed. The <code>finish</code> event is emitted just after the end operation.</p>\n<h4 id=\"requestabort\"><a href=\"#requestabort\"><code>request.abort()</code></a></h4>\n<p>Cancels an ongoing HTTP transaction. If the request has already emitted the <code>close</code> event, the abort operation will have no effect. Otherwise an ongoing event will emit <code>abort</code> and <code>close</code> events. Additionally, if there is an ongoing response object,it will emit the <code>aborted</code> event.</p>\n<h4 id=\"requestfollowredirect\"><a href=\"#requestfollowredirect\"><code>request.followRedirect()</code></a></h4>\n<p>Continues any pending redirection. Can only be called during a <code>'redirect'</code> event.</p>\n<h4 id=\"requestgetuploadprogress\"><a href=\"#requestgetuploadprogress\"><code>request.getUploadProgress()</code></a></h4>\n<p>Retorna <code>Object</code>:</p>\n<ul>\n<li><code>active</code> Boolean - Whether the request is currently active. If this is false no other properties will be set</li>\n<li><code>started</code> Boolean - Whether the upload has started. If this is false both <code>current</code> and <code>total</code> will be set to 0.</li>\n<li><code>current</code> Integer - The number of bytes that have been uploaded so far</li>\n<li><code>total</code> Integer - The number of bytes that will be uploaded this request</li>\n</ul>\n<p>You can use this method in conjunction with <code>POST</code> requests to get the progress of a file upload or other data transfer.</p>",
      "title": "ClientRequest",
      "description": "Realiza requisições HTTP/HTTPS."
    },
    "/docs/api/clipboard": {
      "locale": "pt-BR",
      "slug": "clipboard",
      "href": "/docs/api/clipboard",
      "crowdinFileId": "256291",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/clipboard.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"clipboard\"><a href=\"#clipboard\">clipboard</a></h1>\n<blockquote>\n<p>Realizar cópia e colar operações na área de transferência do sistema.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>On Linux, there is also a <code>selection</code> clipboard. To manipulate it you need to pass <code>selection</code> to each method:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeText(<span class=\"hljs-string\">'Example String'</span>, <span class=\"hljs-string\">'selection'</span>)\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readText(<span class=\"hljs-string\">'selection'</span>))\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>clipboard</code> possui os seguintes métodos:</p>\n<p><strong>Nota:</strong> APIs experimentais são marcadas como tal e podem ser removidas no futuro.</p>\n<h3 id=\"clipboardreadtexttype\"><a href=\"#clipboardreadtexttype\"><code>clipboard.readText([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Retorna <code>String</code> - o conteúdo da área de transferência como texto sem formatação.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeText(<span class=\"hljs-string\">'hello i am a bit of text!'</span>)\n\n<span class=\"hljs-keyword\">const</span> text = clipboard.readText()\n<span class=\"hljs-built_in\">console</span>.log(text)\n<span class=\"hljs-comment\">// hello i am a bit of text!'</span>\n</code></pre>\n<h3 id=\"clipboardwritetexttext-type\"><a href=\"#clipboardwritetexttext-type\"><code>clipboard.writeText(text[, type])</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Escreve o <code>text</code> na área de transferência como texto sem formatação.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> text = <span class=\"hljs-string\">'hello i am a bit of text!'</span>\nclipboard.writeText(text)\n</code></pre>\n<h3 id=\"clipboardreadhtmltype\"><a href=\"#clipboardreadhtmltype\"><code>clipboard.readHTML([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Retorna <code>String</code> - o conteúdo da área de transferência como marcação.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeHTML(<span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b>'</span>)\n<span class=\"hljs-keyword\">const</span> html = clipboard.readHTML()\n\n<span class=\"hljs-built_in\">console</span>.log(html)\n<span class=\"hljs-comment\">// &#x3C;meta charset='utf-8'>&#x3C;b>Hi&#x3C;/b></span>\n</code></pre>\n<h3 id=\"clipboardwritehtmlmarkup-type\"><a href=\"#clipboardwritehtmlmarkup-type\"><code>clipboard.writeHTML(markup[, type])</code></a></h3>\n<ul>\n<li><code>markup</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Escreve <code>markup</code> na área de transferência.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeHTML(<span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b'</span>)\n</code></pre>\n<h3 id=\"clipboardreadimagetype\"><a href=\"#clipboardreadimagetype\"><code>clipboard.readImage([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Retorna <a href=\"/docs/api/native-image\"><code>Nativeimage</code></a> - o conteúdo da imagem na área de transferência.</p>\n<h3 id=\"clipboardwriteimageimage-type\"><a href=\"#clipboardwriteimageimage-type\"><code>clipboard.writeImage(image[, type])</code></a></h3>\n<ul>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a></li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Escreve <code>image</code> na área de transferência.</p>\n<h3 id=\"clipboardreadrtftype\"><a href=\"#clipboardreadrtftype\"><code>clipboard.readRTF([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Retorna <code>String</code> - o conteúdo da área de transferência como RTF.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeRTF(<span class=\"hljs-string\">'{\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}'</span>)\n\n<span class=\"hljs-keyword\">const</span> rtf = clipboard.readRTF()\n<span class=\"hljs-built_in\">console</span>.log(rtf)\n<span class=\"hljs-comment\">// {\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}</span>\n</code></pre>\n<h3 id=\"clipboardwritertftext-type\"><a href=\"#clipboardwritertftext-type\"><code>clipboard.writeRTF(text[, type])</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Escreve o <code>text</code> na área de transferência em RTF.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> rtf = <span class=\"hljs-string\">'{\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}'</span>\nclipboard.writeRTF(rtf)\n</code></pre>\n<h3 id=\"clipboardreadbookmark-macos-windows\"><a href=\"#clipboardreadbookmark-macos-windows\"><code>clipboard.readBookmark()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Retorna <code>Object</code>:</p>\n<ul>\n<li><code>title</code> String</li>\n<li>String <code>url</code></li>\n</ul>\n<p>Retorna um Objeto que contém as chaves <code>title</code> e <code>url</code> representando o bookmark na área de transferência. Os valores de <code>title</code> e <code>url</code> serão strings vazias quando o bookmark estiver indisponível.</p>\n<h3 id=\"clipboardwritebookmarktitle-url-type-macos-windows\"><a href=\"#clipboardwritebookmarktitle-url-type-macos-windows\"><code>clipboard.writeBookmark(title, url[, type])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>title</code> String</li>\n<li>String <code>url</code></li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Escreve o <code>title</code> e o <code>url</code> na área de transferência como um bookmark.</p>\n<p><strong>Note:</strong> Most apps on Windows don't support pasting bookmarks into them so you can use <code>clipboard.write</code> to write both a bookmark and fallback text to the clipboard.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeBookmark({\n  <span class=\"hljs-attr\">text</span>: <span class=\"hljs-string\">'https://electronjs.org'</span>,\n  <span class=\"hljs-attr\">bookmark</span>: <span class=\"hljs-string\">'Electron Homepage'</span>\n})\n</code></pre>\n<h3 id=\"clipboardreadfindtext-macos\"><a href=\"#clipboardreadfindtext-macos\"><code>clipboard.readFindText()</code> <em>macOS</em></a></h3>\n<p>Returns <code>String</code> - The text on the find pasteboard, which is the pasteboard that holds information about the current state of the active application’s find panel.</p>\n<p>This method uses synchronous IPC when called from the renderer process. The cached value is reread from the find pasteboard whenever the application is activated.</p>\n<h3 id=\"clipboardwritefindtexttext-macos\"><a href=\"#clipboardwritefindtexttext-macos\"><code>clipboard.writeFindText(text)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Writes the <code>text</code> into the find pasteboard (the pasteboard that holds information about the current state of the active application’s find panel) as plain text. This method uses synchronous IPC when called from the renderer process.</p>\n<h3 id=\"clipboardcleartype\"><a href=\"#clipboardcleartype\"><code>clipboard.clear([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Clears the clipboard content.</p>\n<h3 id=\"clipboardavailableformatstype\"><a href=\"#clipboardavailableformatstype\"><code>clipboard.availableFormats([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Returns <code>String[]</code> - An array of supported formats for the clipboard <code>type</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> formats = clipboard.availableFormats()\n<span class=\"hljs-built_in\">console</span>.log(formats)\n<span class=\"hljs-comment\">// [ 'text/plain', 'text/html' ]</span>\n</code></pre>\n<h3 id=\"clipboardhasformat-type-experimental\"><a href=\"#clipboardhasformat-type-experimental\"><code>clipboard.has(format[, type])</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the clipboard supports the specified <code>format</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> hasFormat = clipboard.has(<span class=\"hljs-string\">'&#x3C;p>selection&#x3C;/p>'</span>)\n<span class=\"hljs-built_in\">console</span>.log(hasFormat)\n<span class=\"hljs-comment\">// 'true' or 'false'</span>\n</code></pre>\n<h3 id=\"clipboardreadformat-experimental\"><a href=\"#clipboardreadformat-experimental\"><code>clipboard.read(format)</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n</ul>\n<p>Returns <code>String</code> - Reads <code>format</code> type from the clipboard.</p>\n<p><code>format</code> should contain valid ASCII characters and have <code>/</code> separator. <code>a/c</code>, <code>a/bc</code> are valid formats while <code>/abc</code>, <code>abc/</code>, <code>a/</code>, <code>/a</code>, <code>a</code> are not valid.</p>\n<h3 id=\"clipboardreadbufferformat-experimental\"><a href=\"#clipboardreadbufferformat-experimental\"><code>clipboard.readBuffer(format)</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n</ul>\n<p>Returns <code>Buffer</code> - Reads <code>format</code> type from the clipboard.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> buffer = Buffer.from(<span class=\"hljs-string\">'this is binary'</span>, <span class=\"hljs-string\">'utf8'</span>)\nclipboard.writeBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>, buffer)\n\n<span class=\"hljs-keyword\">const</span> ret = clipboard.readBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>)\n\n<span class=\"hljs-built_in\">console</span>.log(buffer.equals(out))\n<span class=\"hljs-comment\">// true</span>\n</code></pre>\n<h3 id=\"clipboardwritebufferformat-buffer-type-experimental\"><a href=\"#clipboardwritebufferformat-buffer-type-experimental\"><code>clipboard.writeBuffer(format, buffer[, type])</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n<li><code>buffer</code> Buffer</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Writes the <code>buffer</code> into the clipboard as <code>format</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> buffer = Buffer.from(<span class=\"hljs-string\">'writeBuffer'</span>, <span class=\"hljs-string\">'utf8'</span>)\nclipboard.writeBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>, buffer)\n</code></pre>\n<h3 id=\"clipboardwritedata-type\"><a href=\"#clipboardwritedata-type\"><code>clipboard.write(data[, type])</code></a></h3>\n<ul>\n<li><code>data</code> Object<ul>\n<li><code>text</code> String (opcional)</li>\n<li><code>html</code> String (opcional)</li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> (opcional)</li>\n<li><code>rtf</code> String (opcional)</li>\n<li><code>bookmark</code> String (optional) - The title of the URL at <code>text</code>.</li>\n</ul></li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> is only available on Linux.</li>\n</ul>\n<p>Escreve <code>data</code> na área de transferência.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.write({\n  <span class=\"hljs-attr\">text</span>: <span class=\"hljs-string\">'test'</span>,\n  <span class=\"hljs-attr\">html</span>: <span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b>'</span>,\n  <span class=\"hljs-attr\">rtf</span>: <span class=\"hljs-string\">'{\\\\rtf1\\\\utf8 text}'</span>,\n  <span class=\"hljs-attr\">bookmark</span>: <span class=\"hljs-string\">'a title'</span>\n})\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readText())\n<span class=\"hljs-comment\">// 'test'</span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readHTML())\n<span class=\"hljs-comment\">// &#x3C;meta charset='utf-8'>&#x3C;b>Hi&#x3C;/b></span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readRTF())\n<span class=\"hljs-comment\">// '{\\\\rtf1\\\\utf8 text}'</span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readBookmark())\n<span class=\"hljs-comment\">// { title: 'a title', url: 'test' }</span>\n</code></pre>",
      "title": "clipboard",
      "description": "Realizar cópia e colar operações na área de transferência do sistema."
    },
    "/docs/tutorial/code-signing": {
      "locale": "pt-BR",
      "slug": "code-signing",
      "href": "/docs/tutorial/code-signing",
      "crowdinFileId": "256183",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/code-signing.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"assinando-código\"><a href=\"#assinando-código\">Assinando Código</a></h1>\n<p>Code signing is a security technology that you use to certify that an app was created by you.</p>\n<p>On macOS the system can detect any change to the app, whether the change is introduced accidentally or by malicious code.</p>\n<p>On Windows, the system assigns a trust level to your code signing certificate which if you don't have, or if your trust level is low, will cause security dialogs to appear when users start using your application.  Trust level builds over time so it's better to start code signing as early as possible.</p>\n<p>While it is possible to distribute unsigned apps, it is not recommended. Both Windows and macOS will, by default, prevent either the download or the execution of unsigned applications. Starting with macOS Catalina (version 10.15), users have to go through multiple manual steps to open unsigned applications.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/gatekeeper.png\" alt=\"macOS Catalina Gatekeeper warning: The app cannot be opened because the\ndeveloper cannot be verified\"></p>\n<p>As you can see, users get two options: Move the app straight to the trash or cancel running it. You don't want your users to see that dialog.</p>\n<p>If you are building an Electron app that you intend to package and distribute, it should be code-signed.</p>\n<h1 id=\"signing--notarizing-macos-builds\"><a href=\"#signing--notarizing-macos-builds\">Signing &#x26; notarizing macOS builds</a></h1>\n<p>Properly preparing macOS applications for release requires two steps: First, the app needs to be code-signed. Then, the app needs to be uploaded to Apple for a process called \"notarization\", where automated systems will further verify that your app isn't doing anything to endanger its users.</p>\n<p>To start the process, ensure that you fulfill the requirements for signing and notarizing your app:</p>\n<ol>\n<li>Enroll in the <a href=\"https://developer.apple.com/programs/\">Apple Developer Program</a> (requires an annual fee)</li>\n<li>Download and install <a href=\"https://developer.apple.com/xcode\">Xcode</a> - this requires a computer running macOS</li>\n<li>Generate, download, and install <a href=\"https://github.com/electron/electron-osx-sign/wiki/1.-Getting-Started#certificates\">signing certificates</a></li>\n</ol>\n<p>Electron's ecosystem favors configuration and freedom, so there are multiple ways to get your application signed and notarized.</p>\n<h2 id=\"electron-forge\"><a href=\"#electron-forge\"><code>electron-forge</code></a></h2>\n<p>If you're using Electron's favorite build tool, getting your application signed and notarized requires a few additions to your configuration. <a href=\"https://electronforge.io\">Forge</a> is a collection of the official Electron tools, using <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>, <a href=\"https://github.com/electron-userland/electron-osx-sign\"><code>electron-osx-sign</code></a>, and <a href=\"https://github.com/electron/electron-notarize\"><code>electron-notarize</code></a> under the hood.</p>\n<p>Let's take a look at an example configuration with all required fields. Not all of them are required: the tools will be clever enough to automatically find a suitable <code>identity</code>, for instance, but we recommend that you are explicit.</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"my-app\"</span>,\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.0.1\"</span>,\n  <span class=\"hljs-attr\">\"config\"</span>: {\n    <span class=\"hljs-attr\">\"forge\"</span>: {\n      <span class=\"hljs-attr\">\"packagerConfig\"</span>: {\n        <span class=\"hljs-attr\">\"osxSign\"</span>: {\n          <span class=\"hljs-attr\">\"identity\"</span>: <span class=\"hljs-string\">\"Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)\"</span>,\n          <span class=\"hljs-attr\">\"hardened-runtime\"</span>: <span class=\"hljs-literal\">true</span>,\n          <span class=\"hljs-attr\">\"entitlements\"</span>: <span class=\"hljs-string\">\"entitlements.plist\"</span>,\n          <span class=\"hljs-attr\">\"entitlements-inherit\"</span>: <span class=\"hljs-string\">\"entitlements.plist\"</span>,\n          <span class=\"hljs-attr\">\"signature-flags\"</span>: <span class=\"hljs-string\">\"library\"</span>\n        },\n        <span class=\"hljs-attr\">\"osxNotarize\"</span>: {\n          <span class=\"hljs-attr\">\"appleId\"</span>: <span class=\"hljs-string\">\"felix@felix.fun\"</span>,\n          <span class=\"hljs-attr\">\"appleIdPassword\"</span>: <span class=\"hljs-string\">\"my-apple-id-password\"</span>,\n        }\n      }\n    }\n  }\n}\n</code></pre>\n<p>The <code>plist</code> file referenced here needs the following macOS-specific entitlements to assure the Apple security mechanisms that your app is doing these things without meaning any harm:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.allow-jit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.debugger<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>Note that up until Electron 12, the <code>com.apple.security.cs.allow-unsigned-executable-memory</code> entitlement was required as well. However, it should not be used anymore if it can be avoided.</p>\n<p>To see all of this in action, check out Electron Fiddle's source code, <a href=\"https://github.com/electron/fiddle/blob/master/forge.config.js\">especially its <code>electron-forge</code> configuration file</a>.</p>\n<p>If you plan to access the microphone or camera within your app using Electron's APIs, you'll also need to add the following entitlements:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.device.audio-input<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.device.camera<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>If these are not present in your app's entitlements when you invoke, for example:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> microphone = systemPreferences.askForMediaAccess(<span class=\"hljs-string\">'microphone'</span>)\n</code></pre>\n<p>Your app may crash. See the Resource Access section in <a href=\"https://developer.apple.com/documentation/security/hardened_runtime\">Hardened Runtime</a> for more information and entitlements you may need.</p>\n<h2 id=\"electron-builder\"><a href=\"#electron-builder\"><code>electron-builder</code></a></h2>\n<p>Electron Builder comes with a custom solution for signing your application. You can find <a href=\"https://www.electron.build/code-signing\">its documentation here</a>.</p>\n<h2 id=\"electron-packager\"><a href=\"#electron-packager\"><code>electron-packager</code></a></h2>\n<p>If you're not using an integrated build pipeline like Forge or Builder, you are likely using <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>, which includes <a href=\"https://github.com/electron-userland/electron-osx-sign\"><code>electron-osx-sign</code></a> and <a href=\"https://github.com/electron/electron-notarize\"><code>electron-notarize</code></a>.</p>\n<p>If you're using Packager's API, you can pass <a href=\"https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html\">in configuration that both signs and notarizes your application</a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> packager = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-packager'</span>)\n\npackager({\n  <span class=\"hljs-attr\">dir</span>: <span class=\"hljs-string\">'/path/to/my/app'</span>,\n  <span class=\"hljs-attr\">osxSign</span>: {\n    <span class=\"hljs-attr\">identity</span>: <span class=\"hljs-string\">'Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)'</span>,\n    <span class=\"hljs-string\">'hardened-runtime'</span>: <span class=\"hljs-literal\">true</span>,\n    <span class=\"hljs-attr\">entitlements</span>: <span class=\"hljs-string\">'entitlements.plist'</span>,\n    <span class=\"hljs-string\">'entitlements-inherit'</span>: <span class=\"hljs-string\">'entitlements.plist'</span>,\n    <span class=\"hljs-string\">'signature-flags'</span>: <span class=\"hljs-string\">'library'</span>\n  },\n  <span class=\"hljs-attr\">osxNotarize</span>: {\n    <span class=\"hljs-attr\">appleId</span>: <span class=\"hljs-string\">'felix@felix.fun'</span>,\n    <span class=\"hljs-attr\">appleIdPassword</span>: <span class=\"hljs-string\">'my-apple-id-password'</span>\n  }\n})\n</code></pre>\n<p>The <code>plist</code> file referenced here needs the following macOS-specific entitlements to assure the Apple security mechanisms that your app is doing these things without meaning any harm:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.allow-jit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.debugger<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>Up until Electron 12, the <code>com.apple.security.cs.allow-unsigned-executable-memory</code> entitlement was required as well. However, it should not be used anymore if it can be avoided.</p>\n<h2 id=\"mac-app-store\"><a href=\"#mac-app-store\">Mac App Store</a></h2>\n<p>See the <a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store Guide</a>.</p>\n<h1 id=\"signing-windows-builds\"><a href=\"#signing-windows-builds\">Signing Windows builds</a></h1>\n<p>Before signing Windows builds, you must do the following:</p>\n<ol>\n<li>Obtenha um certificado de assinatura de código do Windows Authenticode (requer uma taxa anual)</li>\n<li>Install Visual Studio to get the signing utility (the free <a href=\"https://visualstudio.microsoft.com/vs/community/\">Community Edition</a> is enough)</li>\n</ol>\n<p>Você pode obter um certificado de assinatura de um grande número de revendedores. Prices vary, so it may be worth your time to shop around. Revendedores populares incluem:</p>\n<ul>\n<li><a href=\"https://www.digicert.com/code-signing/microsoft-authenticode.htm\">digicert</a></li>\n<li><a href=\"https://sectigo.com/ssl-certificates-tls/code-signing\">Sectigo</a></li>\n<li>Amongst others, please shop around to find one that suits your needs, Google is your friend 😄</li>\n</ul>\n<p>There are a number of tools for signing your packaged app:</p>\n<ul>\n<li><a href=\"https://github.com/electron/windows-installer\"><code>electron-winstaller</code></a> will generate an installer for windows and sign it for you</li>\n<li><a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a> can sign installers it generates through the Squirrel.Windows or MSI targets.</li>\n<li><a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> can sign some of its windows targets</li>\n</ul>\n<h2 id=\"windows-store\"><a href=\"#windows-store\">Windows Store</a></h2>\n<p>See the <a href=\"/docs/tutorial/windows-store-guide\">Windows Store Guide</a>.</p>",
      "title": "Assinando Código",
      "description": ""
    },
    "/docs/development/coding-style": {
      "locale": "pt-BR",
      "slug": "coding-style",
      "href": "/docs/development/coding-style",
      "crowdinFileId": "256147",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/coding-style.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"estilo-de-codificação\"><a href=\"#estilo-de-codificação\">Estilo de Codificação</a></h1>\n<p>Essas são as diretrizes para programar no Electron.</p>\n<p>Você pode executar <code>npm run lint</code> para visualizar qualquer problemas de estilos detectados com <code>cpplint</code> e <code>eslint</code>.</p>\n<h2 id=\"código-em-geral\"><a href=\"#código-em-geral\">Código em Geral</a></h2>\n<ul>\n<li>Termine arquivos com uma nova linha.</li>\n<li>Apresente condições na seguinte ordem:<ul>\n<li>Módulos internos do Node (assim como <code>path</code>)</li>\n<li>Módulos internos do Electron (assim como <code>ipc</code>, <code>app</code>)</li>\n<li>Módulos locais (usando caminhos relativos)</li>\n</ul></li>\n<li>Apresente propriedades de classe na seguinte ordem:<ul>\n<li>Métodos e propriedades de classe (métodos começando com um <code>@</code>)</li>\n<li>Instancie métodos e propriedades</li>\n</ul></li>\n<li>Evite código dependente à uma plataforma:<ul>\n<li>Use <code>path.join()</code> para concatenar nome de arquivos.</li>\n<li>Use <code>os.tmpdir()</code> ao invés de <code>/tmp</code> quando você precisar fazer referência ao diretório temporário.</li>\n</ul></li>\n<li>Using a plain <code>return</code> when returning explicitly at the end of a function.<ul>\n<li>Not <code>return null</code>, <code>return undefined</code>, <code>null</code> or <code>undefined</code></li>\n</ul></li>\n</ul>\n<h2 id=\"c-e-python\"><a href=\"#c-e-python\">C++ e Python</a></h2>\n<p>For C++ and Python, we follow Chromium's <a href=\"https://chromium.googlesource.com/chromium/src/+/refs/heads/main/styleguide/styleguide.md\">Coding Style</a>. You can use <a href=\"/docs/development/clang-format\">clang-format</a> to format the C++ code automatically. There is also a script <code>script/cpplint.py</code> to check whether all files conform.</p>\n<p>The Python version we are using now is Python 2.7.</p>\n<p>The C++ code uses a lot of Chromium's abstractions and types, so it's recommended to get acquainted with them. A good place to start is Chromium's <a href=\"https://www.chromium.org/developers/coding-style/important-abstractions-and-data-structures\">Important Abstractions and Data Structures</a> document. The document mentions some special types, scoped types (that automatically release their memory when going out of scope), logging mechanisms etc.</p>\n<h2 id=\"documentação\"><a href=\"#documentação\">Documentação</a></h2>\n<ul>\n<li>Write <a href=\"https://github.com/remarkjs/remark\">remark</a> markdown style.</li>\n</ul>\n<p>You can run <code>npm run lint-docs</code> to ensure that your documentation changes are formatted correctly.</p>\n<h2 id=\"javascript\"><a href=\"#javascript\">JavaScript</a></h2>\n<ul>\n<li>Write <a href=\"https://www.npmjs.com/package/standard\">standard</a> JavaScript style.</li>\n<li>File names should be concatenated with <code>-</code> instead of <code>_</code>, e.g. <code>file-name.js</code> rather than <code>file_name.js</code>, because in <a href=\"https://github.com/github/atom\">github/atom</a> module names are usually in the <code>module-name</code> form. This rule only applies to <code>.js</code> files.</li>\n<li>Use newer ES6/ES2015 syntax where appropriate<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const\"><code>const</code></a> for requires and other constants.  If the value is a primitive, use uppercase naming (eg <code>const NUMBER_OF_RETRIES = 5</code>).</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let\"><code>let</code></a> for defining variables</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions\">Arrow functions</a> instead of <code>function () { }</code></li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals\">Template literals</a> instead of string concatenation using <code>+</code></li>\n</ul></li>\n</ul>\n<h2 id=\"naming-things\"><a href=\"#naming-things\">Naming Things</a></h2>\n<p>As APIs do Electron usam o mesmo esquema de capitalização do Node.js:</p>\n<ul>\n<li>Quando o módulo em si é uma classe como <code>BrowserWindow</code>, use <code>PascalCase</code>.</li>\n<li>Quando o módulo é um conjunto de APIs, como <code>globalShortcut</code>, use <code>camelCase</code>.</li>\n<li>Quando a API é uma propriedade de objeto, e é complexo o suficiente para estar em capítulo separado como <code>win.webContents</code>, use <code>mixedCase</code>.</li>\n<li>Para outras APIs não-módulo, use títulos naturais, como <code>&#x3C;webview> Tag</code> ou <code>Process Object</code>.</li>\n</ul>\n<p>Ao criar uma nova API, é preferível usar getters e setters em vez de estilo de uma função do jQuery. For example, <code>.getText()</code> and <code>.setText(text)</code> are preferred to <code>.text([text])</code>. There is a <a href=\"https://github.com/electron/electron/issues/46\">discussion</a> on this.</p>",
      "title": "Estilo de Codificação",
      "description": ""
    },
    "/docs/api/command-line": {
      "locale": "pt-BR",
      "slug": "command-line",
      "href": "/docs/api/command-line",
      "crowdinFileId": "256295",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/command-line.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"classe-linha-de-comando\"><a href=\"#classe-linha-de-comando\">Classe: Linha de Comando</a></h2>\n<blockquote>\n<p>Manipulate the command line arguments for your app that Chromium reads</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>The following example shows how to check if the <code>--disable-gpu</code> flag is set.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.hasSwitch(<span class=\"hljs-string\">'disable-gpu'</span>)\n</code></pre>\n<p>For more information on what kinds of flags and switches you can use, check out the <a href=\"/docs/api/command-line-switches\">Command Line Switches</a> document.</p>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<h4 id=\"commandlineappendswitchswitch-value\"><a href=\"#commandlineappendswitchswitch-value\"><code>commandLine.appendSwitch(switch[, value])</code></a></h4>\n<ul>\n<li><code>switch</code> String - A command-line switch, without the leading <code>--</code></li>\n<li><code>value</code> String - (opcional) - Um valor para a opção desejada</li>\n</ul>\n<p>Insere uma opção (com um <code>value</code> opcional) à linha de comando do Chromium.</p>\n<p><strong>Note:</strong> This will not affect <code>process.argv</code>. The intended usage of this function is to control Chromium's behavior.</p>\n<h4 id=\"commandlineappendargumentvalue\"><a href=\"#commandlineappendargumentvalue\"><code>commandLine.appendArgument(value)</code></a></h4>\n<ul>\n<li><code>value</code> String - The argument to append to the command line</li>\n</ul>\n<p>Append an argument to Chromium's command line. The argument will be quoted correctly. Switches will precede arguments regardless of appending order.</p>\n<p>If you're appending an argument like <code>--switch=value</code>, consider using <code>appendSwitch('switch', 'value')</code> instead.</p>\n<p><strong>Note:</strong> This will not affect <code>process.argv</code>. The intended usage of this function is to control Chromium's behavior.</p>\n<h4 id=\"commandlinehasswitchswitch\"><a href=\"#commandlinehasswitchswitch\"><code>commandLine.hasSwitch(switch)</code></a></h4>\n<ul>\n<li><code>switch</code> String - Uma opção de linha de comando</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the command-line switch is present.</p>\n<h4 id=\"commandlinegetswitchvalueswitch\"><a href=\"#commandlinegetswitchvalueswitch\"><code>commandLine.getSwitchValue(switch)</code></a></h4>\n<ul>\n<li><code>switch</code> String - Uma opção de linha de comando</li>\n</ul>\n<p>Returns <code>String</code> - The command-line switch value.</p>\n<p><strong>Note:</strong> When the switch is not present or has no value, it returns empty string.</p>",
      "title": "Classe: Linha de Comando",
      "description": "Manipulate the command line arguments for your app that Chromium reads"
    },
    "/docs/api/command-line-switches": {
      "locale": "pt-BR",
      "slug": "command-line-switches",
      "href": "/docs/api/command-line-switches",
      "crowdinFileId": "256293",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/command-line-switches.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"switches-de-linha-de-comando-suportadas\"><a href=\"#switches-de-linha-de-comando-suportadas\">Switches de Linha de Comando Suportadas</a></h1>\n<blockquote>\n<p>Opções de linha de comando suportados pelo Electron.</p>\n</blockquote>\n<p>You can use <a href=\"/docs/api/command-line#commandlineappendswitchswitch-value\">app.commandLine.appendSwitch</a> to append them in your app's main script before the <a href=\"/docs/api/app#event-ready\">ready</a> event of the <a href=\"/docs/api/app\">app</a> module is emitted:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'remote-debugging-port'</span>, <span class=\"hljs-string\">'8315'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'host-rules'</span>, <span class=\"hljs-string\">'MAP * 127.0.0.1'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Your code here</span>\n})\n</code></pre>\n<h2 id=\"electron-cli-flags\"><a href=\"#electron-cli-flags\">Electron CLI Flags</a></h2>\n<h3 id=\"--auth-server-whitelisturl\"><a href=\"#--auth-server-whitelisturl\">--auth-server-whitelist=<code>url</code></a></h3>\n<p>A comma-separated list of servers for which integrated authentication is enabled.</p>\n<p>Como por exemplo:</p>\n<pre><code class=\"hljs language-sh\">--auth-server-whitelist=<span class=\"hljs-string\">'*example.com, *foobar.com, *baz'</span>\n</code></pre>\n<p>then any <code>url</code> ending with <code>example.com</code>, <code>foobar.com</code>, <code>baz</code> will be considered for integrated authentication. Without <code>*</code> prefix the URL has to match exactly.</p>\n<h3 id=\"--auth-negotiate-delegate-whitelisturl\"><a href=\"#--auth-negotiate-delegate-whitelisturl\">--auth-negotiate-delegate-whitelist=<code>url</code></a></h3>\n<p>A comma-separated list of servers for which delegation of user credentials is required. Without <code>*</code> prefix the URL has to match exactly.</p>\n<h3 id=\"--disable-ntlm-v2\"><a href=\"#--disable-ntlm-v2\">--disable-ntlm-v2</a></h3>\n<p>Disables NTLM v2 for posix platforms, no effect elsewhere.</p>\n<h3 id=\"--disable-http-cache\"><a href=\"#--disable-http-cache\">--disable-http-cache</a></h3>\n<p>Desabilita o cache de disco para as requisições HTTP.</p>\n<h3 id=\"--disable-http2\"><a href=\"#--disable-http2\">--disable-http2</a></h3>\n<p>Disable HTTP/2 and SPDY/3.1 protocols.</p>\n<h3 id=\"--disable-renderer-backgrounding\"><a href=\"#--disable-renderer-backgrounding\">--disable-renderer-backgrounding</a></h3>\n<p>Prevents Chromium from lowering the priority of invisible pages' renderer processes.</p>\n<p>This flag is global to all renderer processes, if you only want to disable throttling in one window, you can take the hack of <a href=\"https://github.com/atom/atom/pull/9485/files\">playing silent audio</a>.</p>\n<h3 id=\"--disk-cache-sizesize\"><a href=\"#--disk-cache-sizesize\">--disk-cache-size=<code>size</code></a></h3>\n<p>Força o máximo de espaço em disco a ser usado pelo cache de disco, em bytes.</p>\n<h3 id=\"--enable-api-filtering-logging\"><a href=\"#--enable-api-filtering-logging\">--enable-api-filtering-logging</a></h3>\n<p>Enables caller stack logging for the following APIs (filtering events):</p>\n<ul>\n<li><code>desktopCapturer.getSources()</code> / <code>desktop-capturer-get-sources</code></li>\n</ul>\n<h3 id=\"--enable-loggingfile\"><a href=\"#--enable-loggingfile\">--enable-logging[=file]</a></h3>\n<p>Prints Chromium's logging to stderr (or a log file).</p>\n<p>The <code>ELECTRON_ENABLE_LOGGING</code> environment variable has the same effect as passing <code>--enable-logging</code>.</p>\n<p>Passing <code>--enable-logging</code> will result in logs being printed on stderr. Passing <code>--enable-logging=file</code> will result in logs being saved to the file specified by <code>--log-file=...</code>, or to <code>electron_debug.log</code> in the user-data directory if <code>--log-file</code> is not specified.</p>\n<blockquote>\n<p><strong>Note:</strong> On Windows, logs from child processes cannot be sent to stderr. Logging to a file is the most reliable way to collect logs on Windows.</p>\n</blockquote>\n<p>See also <code>--log-file</code>, <code>--log-level</code>, <code>--v</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--force-fieldtrialstrials\"><a href=\"#--force-fieldtrialstrials\">--force-fieldtrials=<code>trials</code></a></h3>\n<p>Field trials to be forcefully enabled or disabled.</p>\n<p>Por exemplo: <code>WebRTC-Audio-Red-For-Opus/Enabled/</code></p>\n<h3 id=\"--host-rulesrules\"><a href=\"#--host-rulesrules\">--host-rules=<code>rules</code></a></h3>\n<p>A comma-separated list of <code>rules</code> that control how hostnames are mapped.</p>\n<p>Como por exemplo:</p>\n<ul>\n<li><code>MAP * 127.0.0.1</code> Forces all hostnames to be mapped to 127.0.0.1</li>\n<li><code>MAP *.google.com proxy</code> Forces all google.com subdomains to be resolved to \"proxy\".</li>\n<li><code>MAP test.com [::1]:77</code> Forces \"test.com\" to resolve to IPv6 loopback. Will also force the port of the resulting socket address to be 77.</li>\n<li><code>MAP * baz, EXCLUDE www.google.com</code> Remaps everything to \"baz\", except for \"www.google.com\".</li>\n</ul>\n<p>These mappings apply to the endpoint host in a net request (the TCP connect and host resolver in a direct connection, and the <code>CONNECT</code> in an HTTP proxy connection, and the endpoint host in a <code>SOCKS</code> proxy connection).</p>\n<h3 id=\"--host-resolver-rulesrules\"><a href=\"#--host-resolver-rulesrules\">--host-resolver-rules=<code>rules</code></a></h3>\n<p>Like <code>--host-rules</code> but these <code>rules</code> only apply to the host resolver.</p>\n<h3 id=\"--ignore-certificate-errors\"><a href=\"#--ignore-certificate-errors\">--ignore-certificate-errors</a></h3>\n<p>Ignores certificate related errors.</p>\n<h3 id=\"--ignore-connections-limitdomains\"><a href=\"#--ignore-connections-limitdomains\">--ignore-connections-limit=<code>domains</code></a></h3>\n<p>Ignora o limite de conexão por <code>domains</code> lista separada por <code>,</code>.</p>\n<h3 id=\"--js-flagsflags\"><a href=\"#--js-flagsflags\">--js-flags=<code>flags</code></a></h3>\n<p>Specifies the flags passed to the Node.js engine. It has to be passed when starting Electron if you want to enable the <code>flags</code> in the main process.</p>\n<pre><code class=\"hljs language-sh\">$ electron --js-flags=<span class=\"hljs-string\">\"--harmony_proxies --harmony_collections\"</span> seu-app\n</code></pre>\n<p>See the <a href=\"https://nodejs.org/api/cli.html\">Node.js documentation</a> or run <code>node --help</code> in your terminal for a list of available flags. Additionally, run <code>node --v8-options</code> to see a list of flags that specifically refer to Node.js's V8 JavaScript engine.</p>\n<h3 id=\"--lang\"><a href=\"#--lang\">--lang</a></h3>\n<p>Definir uma localidade customizada.</p>\n<h3 id=\"--log-filepath\"><a href=\"#--log-filepath\">--log-file=<code>path</code></a></h3>\n<p>If <code>--enable-logging</code> is specified, logs will be written to the given path. The parent directory must exist.</p>\n<p>Setting the <code>ELECTRON_LOG_FILE</code> environment variable is equivalent to passing this flag. If both are present, the command-line switch takes precedence.</p>\n<h3 id=\"--log-net-logpath\"><a href=\"#--log-net-logpath\">--log-net-log=<code>path</code></a></h3>\n<p>Enables net log events to be saved and writes them to <code>path</code>.</p>\n<h3 id=\"--log-leveln\"><a href=\"#--log-leveln\">--log-level=<code>N</code></a></h3>\n<p>Sets the verbosity of logging when used together with <code>--enable-logging</code>. <code>N</code> should be one of <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h?q=logging::LogSeverity&#x26;ss=chromium\">Chrome's LogSeverities</a>.</p>\n<p>Note that two complimentary logging mechanisms in Chromium -- <code>LOG()</code> and <code>VLOG()</code> -- are controlled by different switches. <code>--log-level</code> controls <code>LOG()</code> messages, while <code>--v</code> and <code>--vmodule</code> control <code>VLOG()</code> messages. So you may want to use a combination of these three switches depending on the granularity you want and what logging calls are made by the code you're trying to watch.</p>\n<p>See <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h\">Chromium Logging source</a> for more information on how <code>LOG()</code> and <code>VLOG()</code> interact. Loosely speaking, <code>VLOG()</code> can be thought of as sub-levels / per-module levels inside <code>LOG(INFO)</code> to control the firehose of <code>LOG(INFO)</code> data.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, <code>--v</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--no-proxy-server\"><a href=\"#--no-proxy-server\">--no-proxy-server</a></h3>\n<p>Don't use a proxy server and always make direct connections. Overrides any other proxy server flags that are passed.</p>\n<h3 id=\"--no-sandbox\"><a href=\"#--no-sandbox\">--no-sandbox</a></h3>\n<p>Disables the Chromium <a href=\"https://www.chromium.org/developers/design-documents/sandbox\">sandbox</a>. Forces renderer process and Chromium helper processes to run un-sandboxed. Should only be used for testing.</p>\n<h3 id=\"--proxy-bypass-listhosts\"><a href=\"#--proxy-bypass-listhosts\">--proxy-bypass-list=<code>hosts</code></a></h3>\n<p>Instructs Electron to bypass the proxy server for the given semi-colon-separated list of hosts. This flag has an effect only if used in tandem with <code>--proxy-server</code>.</p>\n<p>Como por exemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'proxy-bypass-list'</span>, <span class=\"hljs-string\">'&#x3C;local>;*.google.com;*foo.com;1.2.3.4:5678'</span>)\n</code></pre>\n<p>Will use the proxy server for all hosts except for local addresses (<code>localhost</code>, <code>127.0.0.1</code> etc.), <code>google.com</code> subdomains, hosts that contain the suffix <code>foo.com</code> and anything at <code>1.2.3.4:5678</code>.</p>\n<h3 id=\"--proxy-pac-urlurl\"><a href=\"#--proxy-pac-urlurl\">--proxy-pac-url=<code>url</code></a></h3>\n<p>Uses the PAC script at the specified <code>url</code>.</p>\n<h3 id=\"--proxy-serveraddressport\"><a href=\"#--proxy-serveraddressport\">--proxy-server=<code>address:port</code></a></h3>\n<p>Use a specified proxy server, which overrides the system setting. This switch only affects requests with HTTP protocol, including HTTPS and WebSocket requests. It is also noteworthy that not all proxy servers support HTTPS and WebSocket requests. The proxy URL does not support username and password authentication <a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=615947\">per Chromium issue</a>.</p>\n<h3 id=\"--remote-debugging-portport\"><a href=\"#--remote-debugging-portport\">--remote-debugging-port=<code>port</code></a></h3>\n<p>Habilita depuração remota sobre o HTTP na <code>port</code> especificada.</p>\n<h3 id=\"--vlog_level\"><a href=\"#--vlog_level\">--v=<code>log_level</code></a></h3>\n<p>Gives the default maximal active V-logging level; 0 is the default. Normally positive values are used for V-logging levels.</p>\n<p>This switch only works when <code>--enable-logging</code> is also passed.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--vmodulepattern\"><a href=\"#--vmodulepattern\">--vmodule=<code>pattern</code></a></h3>\n<p>Gives the per-module maximal V-logging levels to override the value given by <code>--v</code>. Ex. <code>my_module=2,foo*=3</code> would change the logging level for all code in source files <code>my_module.*</code> and <code>foo*.*</code>.</p>\n<p>Any pattern containing a forward or backward slash will be tested against the whole pathname and not only the module. Ex. <code>*/foo/bar/*=2</code> would change the logging level for all code in the source files under a <code>foo/bar</code> directory.</p>\n<p>This switch only works when <code>--enable-logging</code> is also passed.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, and <code>--v</code>.</p>\n<h3 id=\"--force_high_performance_gpu\"><a href=\"#--force_high_performance_gpu\">--force_high_performance_gpu</a></h3>\n<p>Force using discrete GPU when there are multiple GPUs available.</p>\n<h3 id=\"--force_low_power_gpu\"><a href=\"#--force_low_power_gpu\">--force_low_power_gpu</a></h3>\n<p>Force using integrated GPU when there are multiple GPUs available.</p>\n<h2 id=\"nodejs-flags\"><a href=\"#nodejs-flags\">Node.js Flags</a></h2>\n<p>Electron supports some of the <a href=\"https://nodejs.org/api/cli.html\">CLI flags</a> supported by Node.js.</p>\n<p><strong>Note:</strong> Passing unsupported command line switches to Electron when it is not running in <code>ELECTRON_RUN_AS_NODE</code> will have no effect.</p>\n<h3 id=\"--inspect-brkhostport\"><a href=\"#--inspect-brkhostport\">--inspect-brk[=[host:]port]</a></h3>\n<p>Activate inspector on host:port and break at start of user script. Default host:port is 127.0.0.1:9229.</p>\n<p>Aliased to <code>--debug-brk=[host:]port</code>.</p>\n<h3 id=\"--inspect-porthostport\"><a href=\"#--inspect-porthostport\">--inspect-port=[host:]port</a></h3>\n<p>Set the <code>host:port</code> to be used when the inspector is activated. Useful when activating the inspector by sending the SIGUSR1 signal. Default host is <code>127.0.0.1</code>.</p>\n<p>Aliased to <code>--debug-port=[host:]port</code>.</p>\n<h3 id=\"--inspecthostport\"><a href=\"#--inspecthostport\">--inspect[=[host:]port]</a></h3>\n<p>Activate inspector on <code>host:port</code>. Por padrão é <code>127.0.0.1:9229</code>.</p>\n<p>V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug and profile Electron instances. The tools attach to Electron instances via a TCP port and communicate using the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">Chrome DevTools Protocol</a>.</p>\n<p>See the <a href=\"/docs/tutorial/debugging-main-process\">Debugging the Main Process</a> guide for more details.</p>\n<p>Aliased to <code>--debug[=[host:]port</code>.</p>\n<h3 id=\"--inspect-publish-uidstderrhttp\"><a href=\"#--inspect-publish-uidstderrhttp\">--inspect-publish-uid=stderr,http</a></h3>\n<p>Specify ways of the inspector web socket url exposure.</p>\n<p>By default inspector websocket url is available in stderr and under /json/list endpoint on <a href=\"http://host:port/json/list\">http://host:port/json/list</a>.</p>",
      "title": "Switches de Linha de Comando Suportadas",
      "description": "Opções de linha de comando suportados pelo Electron."
    },
    "/docs/api/content-tracing": {
      "locale": "pt-BR",
      "slug": "content-tracing",
      "href": "/docs/api/content-tracing",
      "crowdinFileId": "256297",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/content-tracing.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"contenttracing\"><a href=\"#contenttracing\">contentTracing</a></h1>\n<blockquote>\n<p>Collect tracing data from Chromium to find performance bottlenecks and slow operations.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>This module does not include a web interface. To view recorded traces, use <a href=\"https://chromium.googlesource.com/catapult/+/HEAD/tracing/README.md\">trace viewer</a>, available at <code>chrome://tracing</code> in Chrome.</p>\n<p><strong>Nota:</strong> Voce nao deve usar este modulo ate que o '<code>ready</code> event' do modulo da aplicacao esteja finalizado e emitido.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, contentTracing } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  (<span class=\"hljs-keyword\">async</span> () => {\n    <span class=\"hljs-keyword\">await</span> contentTracing.startRecording({\n      <span class=\"hljs-attr\">included_categories</span>: [<span class=\"hljs-string\">'*'</span>]\n    })\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Tracing started'</span>)\n    <span class=\"hljs-keyword\">await</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> setTimeout(resolve, <span class=\"hljs-number\">5000</span>))\n    <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> contentTracing.stopRecording()\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Tracing data recorded to '</span> + path)\n  })()\n})\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>contentTracing</code> tem os seguintes métodos:</p>\n<h3 id=\"contenttracinggetcategories\"><a href=\"#contenttracinggetcategories\"><code>contentTracing.getCategories()</code></a></h3>\n<p>Returns <code>Promise&#x3C;String[]></code> - resolves with an array of category groups once all child processes have acknowledged the <code>getCategories</code> request</p>\n<p>Get a set of category groups. The category groups can change as new code paths are reached. See also the <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">list of built-in tracing categories</a>.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Electron adds a non-default tracing category called <code>\"electron\"</code>. This category can be used to capture Electron-specific tracing events.</p>\n</blockquote>\n<h3 id=\"contenttracingstartrecordingoptions\"><a href=\"#contenttracingstartrecordingoptions\"><code>contentTracing.startRecording(options)</code></a></h3>\n<ul>\n<li><code>options</code> (<a href=\"/docs/api/structures/trace-config\">TraceConfig</a> | <a href=\"/docs/api/structures/trace-categories-and-options\">TraceCategoriesAndOptions</a>)</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolved once all child processes have acknowledged the <code>startRecording</code> request.</p>\n<p>Start recording on all processes.</p>\n<p>Recording begins immediately locally and asynchronously on child processes as soon as they receive the EnableRecording request.</p>\n<p>If a recording is already running, the promise will be immediately resolved, as only one trace operation can be in progress at a time.</p>\n<h3 id=\"contenttracingstoprecordingresultfilepath\"><a href=\"#contenttracingstoprecordingresultfilepath\"><code>contentTracing.stopRecording([resultFilePath])</code></a></h3>\n<ul>\n<li><code>resultFilePath</code> String (opcional)</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - resolves with a path to a file that contains the traced data once all child processes have acknowledged the <code>stopRecording</code> request</p>\n<p>Stop recording on all processes.</p>\n<p>Child processes typically cache trace data and only rarely flush and send trace data back to the main process. This helps to minimize the runtime overhead of tracing since sending trace data over IPC can be an expensive operation. So, to end tracing, Chromium asynchronously asks all child processes to flush any pending trace data.</p>\n<p>Trace data will be written into <code>resultFilePath</code>. If <code>resultFilePath</code> is empty or not provided, trace data will be written to a temporary file, and the path will be returned in the promise.</p>\n<h3 id=\"contenttracinggettracebufferusage\"><a href=\"#contenttracinggettracebufferusage\"><code>contentTracing.getTraceBufferUsage()</code></a></h3>\n<p>Returns <code>Promise&#x3C;Object></code> - Resolves with an object containing the <code>value</code> and <code>percentage</code> of trace buffer maximum usage</p>\n<ul>\n<li><code>value</code> Number</li>\n<li><code>percentage</code> Number</li>\n</ul>\n<p>Get the maximum usage across processes of trace buffer as a percentage of the full state.</p>",
      "title": "contentTracing",
      "description": "Collect tracing data from Chromium to find performance bottlenecks and slow operations."
    },
    "/docs/api/context-bridge": {
      "locale": "pt-BR",
      "slug": "context-bridge",
      "href": "/docs/api/context-bridge",
      "crowdinFileId": "256299",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/context-bridge.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"contextbridge\"><a href=\"#contextbridge\">contextBridge</a></h1>\n<blockquote>\n<p>Create a safe, bi-directional, synchronous bridge across isolated contexts</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#renderer-process\">Renderizador</a></p>\n<p>An example of exposing an API to a renderer from an isolated preload script is given below:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Preload (Isolated World)</span>\n<span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(\n  <span class=\"hljs-string\">'electron'</span>,\n  {\n    <span class=\"hljs-attr\">doThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.send(<span class=\"hljs-string\">'do-a-thing'</span>)\n  }\n)\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Renderer (Main World)</span>\n\n<span class=\"hljs-built_in\">window</span>.electron.doThing()\n</code></pre>\n<h2 id=\"glossário\"><a href=\"#glossário\">Glossário</a></h2>\n<h3 id=\"main-world\"><a href=\"#main-world\">Main World</a></h3>\n<p>The \"Main World\" is the JavaScript context that your main renderer code runs in. By default, the page you load in your renderer executes code in this world.</p>\n<h3 id=\"isolated-world\"><a href=\"#isolated-world\">Isolated World</a></h3>\n<p>When <code>contextIsolation</code> is enabled in your <code>webPreferences</code> (this is the default behavior since Electron 12.0.0), your <code>preload</code> scripts run in an \"Isolated World\".  You can read more about context isolation and what it affects in the <a href=\"/docs/tutorial/security#3-enable-context-isolation-for-remote-content\">security</a> docs.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>contextBridge</code> possui os seguintes métodos:</p>\n<h3 id=\"contextbridgeexposeinmainworldapikey-api\"><a href=\"#contextbridgeexposeinmainworldapikey-api\"><code>contextBridge.exposeInMainWorld(apiKey, api)</code></a></h3>\n<ul>\n<li><code>apiKey</code> String - The key to inject the API onto <code>window</code> with.  The API will be accessible on <code>window[apiKey]</code>.</li>\n<li><code>api</code> any - Your API, more information on what this API can be and how it works is available below.</li>\n</ul>\n<h2 id=\"usando\"><a href=\"#usando\">Usando</a></h2>\n<h3 id=\"api\"><a href=\"#api\">API</a></h3>\n<p>The <code>api</code> provided to <a href=\"#contextbridgeexposeinmainworldapikey-api\"><code>exposeInMainWorld</code></a> must be a <code>Function</code>, <code>String</code>, <code>Number</code>, <code>Array</code>, <code>Boolean</code>, or an object whose keys are strings and values are a <code>Function</code>, <code>String</code>, <code>Number</code>, <code>Array</code>, <code>Boolean</code>, or another nested object that meets the same conditions.</p>\n<p><code>Function</code> values are proxied to the other context and all other values are <strong>copied</strong> and <strong>frozen</strong>. Any data / primitives sent in the API become immutable and updates on either side of the bridge do not result in an update on the other side.</p>\n<p>An example of a complex API is shown below:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(\n  <span class=\"hljs-string\">'electron'</span>,\n  {\n    <span class=\"hljs-attr\">doThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.send(<span class=\"hljs-string\">'do-a-thing'</span>),\n    <span class=\"hljs-attr\">myPromises</span>: [<span class=\"hljs-built_in\">Promise</span>.resolve(), <span class=\"hljs-built_in\">Promise</span>.reject(<span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'whoops'</span>))],\n    <span class=\"hljs-attr\">anAsyncFunction</span>: <span class=\"hljs-keyword\">async</span> () => <span class=\"hljs-number\">123</span>,\n    <span class=\"hljs-attr\">data</span>: {\n      <span class=\"hljs-attr\">myFlags</span>: [<span class=\"hljs-string\">'a'</span>, <span class=\"hljs-string\">'b'</span>, <span class=\"hljs-string\">'c'</span>],\n      <span class=\"hljs-attr\">bootTime</span>: <span class=\"hljs-number\">1234</span>\n    },\n    <span class=\"hljs-attr\">nestedAPI</span>: {\n      <span class=\"hljs-attr\">evenDeeper</span>: {\n        <span class=\"hljs-attr\">youCanDoThisAsMuchAsYouWant</span>: {\n          <span class=\"hljs-attr\">fn</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ({\n            <span class=\"hljs-attr\">returnData</span>: <span class=\"hljs-number\">123</span>\n          })\n        }\n      }\n    }\n  }\n)\n</code></pre>\n<h3 id=\"api-functions\"><a href=\"#api-functions\">API Functions</a></h3>\n<p><code>Function</code> values that you bind through the <code>contextBridge</code> are proxied through Electron to ensure that contexts remain isolated.  This results in some key limitations that we've outlined below.</p>\n<h4 id=\"parameter--error--return-type-support\"><a href=\"#parameter--error--return-type-support\">Parameter / Error / Return Type support</a></h4>\n<p>Because parameters, errors and return values are <strong>copied</strong> when they are sent over the bridge, there are only certain types that can be used. At a high level, if the type you want to use can be serialized and deserialized into the same object it will work.  A table of type support has been included below for completeness:</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Tipo</th><th>Complexity</th><th>Parameter Support</th><th>Return Value Support</th><th>Limitações</th></tr></thead><tbody><tr><td><code>String</code></td><td>Simple</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Número</code></td><td>Simple</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Booleano</code></td><td>Simple</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Object</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Keys must be supported using only \"Simple\" types in this table.  Values must be supported in this table.  Prototype modifications are dropped.  Sending custom classes will copy values but not the prototype.</td></tr><tr><td><code>Array</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Same limitations as the <code>Object</code> type</td></tr><tr><td><code>Erro</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Errors that are thrown are also copied, this can result in the message and stack trace of the error changing slightly due to being thrown in a different context</td></tr><tr><td><code>Promise</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Promises are only proxied if they are the return value or exact parameter.  Promises nested in arrays or objects will be dropped.</td></tr><tr><td><code>Function</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Prototype modifications are dropped.  Sending classes or constructors will not work.</td></tr><tr><td><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Cloneable Types</a></td><td>Simple</td><td>✅</td><td>✅</td><td>See the linked document on cloneable types</td></tr><tr><td><code>Element</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Prototype modifications are dropped.  Sending custom elements will not work.</td></tr><tr><td><code>Blob</code></td><td>Complex</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Symbol</code></td><td>N/A</td><td>❌</td><td>❌</td><td>Symbols cannot be copied across contexts so they are dropped</td></tr></tbody></table>\n<p>If the type you care about is not in the above table, it is probably not supported.</p>\n<h3 id=\"exposing-node-global-symbols\"><a href=\"#exposing-node-global-symbols\">Exposing Node Global Symbols</a></h3>\n<p>The <code>contextBridge</code> can be used by the preload script to give your renderer access to Node APIs. The table of supported types described above also applies to Node APIs that you expose through <code>contextBridge</code>. Please note that many Node APIs grant access to local system resources. Be very cautious about which globals and APIs you expose to untrusted remote content.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> crypto = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'crypto'</span>)\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'nodeCrypto'</span>, {\n  sha256sum (data) {\n    <span class=\"hljs-keyword\">const</span> hash = crypto.createHash(<span class=\"hljs-string\">'sha256'</span>)\n    hash.update(data)\n    <span class=\"hljs-keyword\">return</span> hash.digest(<span class=\"hljs-string\">'hex'</span>)\n  }\n})\n</code></pre>",
      "title": "contextBridge",
      "description": "Create a safe, bi-directional, synchronous bridge across isolated contexts"
    },
    "/docs/tutorial/context-isolation": {
      "locale": "pt-BR",
      "slug": "context-isolation",
      "href": "/docs/tutorial/context-isolation",
      "crowdinFileId": "256185",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/context-isolation.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"context-isolation\"><a href=\"#context-isolation\">Context Isolation</a></h1>\n<h2 id=\"what-is-it\"><a href=\"#what-is-it\">What is it?</a></h2>\n<p>Isolamento de Contexto é um recurso que garante que tanto os seus <code>scripts do preload</code> quanto a lógica interna do Electron sejam executados em um contexto separado para a pagina que você carregar em um <a href=\"/docs/api/web-contents\"><code>webContent</code></a>.  Isso é importante por questões de segurança, pois ajuda a impedir que a pagina web acesse os módulos internos do Electron ou aos privelégios de APIs que seu script de preload tem acesso.</p>\n<p>Isto significa que o objeto <code>window</code> ao qual seu script de preload tem acesso seja realmente um objeto <strong>diferente</strong> do qual a sua pagina web teria acesso.  For example, if you set <code>window.hello = 'wave'</code> in your preload script and context isolation is enabled, <code>window.hello</code> will be undefined if the website tries to access it.</p>\n<p>Context isolation has been enabled by default since Electron 12, and it is a recommended security setting for <em>all applications</em>.</p>\n<h2 id=\"migração\"><a href=\"#migração\">Migração</a></h2>\n<blockquote>\n<p>Without context isolation, I used to provide APIs from my preload script using <code>window.X = apiObject</code>. Now what?</p>\n</blockquote>\n<h3 id=\"before-context-isolation-disabled\"><a href=\"#before-context-isolation-disabled\">Before: context isolation disabled</a></h3>\n<p>Exposing APIs from your preload script to a loaded website in the renderer process is a common use-case. With context isolation disabled, your preload script would share a common global <code>window</code> object with the renderer. You could then attach arbitrary properties to a preload script:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// preload with contextIsolation disabled</span>\n<span class=\"hljs-built_in\">window</span>.myAPI = {\n  <span class=\"hljs-attr\">doAThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {}\n}\n</code></pre>\n<p>The <code>doAThing()</code> function could then be used directly in the renderer process:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// use the exposed API in the renderer</span>\n<span class=\"hljs-built_in\">window</span>.myAPI.doAThing()\n</code></pre>\n<h3 id=\"after-context-isolation-enabled\"><a href=\"#after-context-isolation-enabled\">After: context isolation enabled</a></h3>\n<p>There is a dedicated module in Electron to help you do this in a painless way. The <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> module can be used to <strong>safely</strong> expose APIs from your preload script's isolated context to the context the website is running in. The API will also be accessible from the website on <code>window.myAPI</code> just like it was before.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// preload with contextIsolation enabled</span>\n<span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">doAThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {}\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// use the exposed API in the renderer</span>\n<span class=\"hljs-built_in\">window</span>.myAPI.doAThing()\n</code></pre>\n<p>Please read the <code>contextBridge</code> documentation linked above to fully understand its limitations. For instance, you can't send custom prototypes or symbols over the bridge.</p>\n<h2 id=\"security-considerations\"><a href=\"#security-considerations\">Security considerations</a></h2>\n<p>Just enabling <code>contextIsolation</code> and using <code>contextBridge</code> does not automatically mean that everything you do is safe. For instance, this code is <strong>unsafe</strong>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// ❌ Bad code</span>\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">send</span>: ipcRenderer.send\n})\n</code></pre>\n<p>It directly exposes a powerful API without any kind of argument filtering. This would allow any website to send arbitrary IPC messages, which you do not want to be possible. The correct way to expose IPC-based APIs would instead be to provide one method per IPC message.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// ✅ Good code</span>\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">loadPreferences</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'load-prefs'</span>)\n})\n</code></pre>\n<h2 id=\"usage-with-typescript\"><a href=\"#usage-with-typescript\">Usage with TypeScript</a></h2>\n<p>If you're building your Electron app with TypeScript, you'll want to add types to your APIs exposed over the context bridge. The renderer's <code>window</code> object won't have the correct typings unless you extend the types with a <a href=\"https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html\">declaration file</a>.</p>\n<p>For example, given this <code>preload.ts</code> script:</p>\n<pre><code class=\"hljs language-typescript\">contextBridge.exposeInMainWorld(<span class=\"hljs-string\">'electronAPI'</span>, {\n  loadPreferences: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'load-prefs'</span>)\n})\n</code></pre>\n<p>You can create a <code>renderer.d.ts</code> declaration file and globally augment the <code>Window</code> interface:</p>\n<pre><code class=\"hljs language-typescript\"><span class=\"hljs-keyword\">export</span> <span class=\"hljs-keyword\">interface</span> IElectronAPI {\n  loadPreferences: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-built_in\">Promise</span>&#x3C;<span class=\"hljs-built_in\">void</span>>,\n}\n\n<span class=\"hljs-keyword\">declare</span> global {\n  <span class=\"hljs-keyword\">interface</span> Window {\n    electronAPI: IElectronAPI\n  }\n}\n</code></pre>\n<p>Doing so will ensure that the TypeScript compiler will know about the <code>electronAPI</code> property on your global <code>window</code> object when writing scripts in your renderer process:</p>\n<pre><code class=\"hljs language-typescript\"><span class=\"hljs-built_in\">window</span>.electronAPI.loadPreferences()\n</code></pre>",
      "title": "Context Isolation",
      "description": "Without context isolation, I used to provide APIs from my preload script using window.X = apiObject. Now what?"
    },
    "/docs/api/structures/cookie": {
      "locale": "pt-BR",
      "slug": "cookie",
      "href": "/docs/api/structures/cookie",
      "crowdinFileId": "256417",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/cookie.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"cookie-object\"><a href=\"#cookie-object\">Cookie Object</a></h1>\n<ul>\n<li><code>name</code> String - The name of the cookie.</li>\n<li><code>value</code> String - The value of the cookie.</li>\n<li><code>domain</code> String (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains.</li>\n<li><code>hostOnly</code> Boolean (optional) - Whether the cookie is a host-only cookie; this will only be <code>true</code> if no domain was passed.</li>\n<li><code>path</code> String (optional) - The path of the cookie.</li>\n<li><code>secure</code> Boolean (optional) - Whether the cookie is marked as secure.</li>\n<li><code>httpOnly</code> Boolean (optional) - Whether the cookie is marked as HTTP only.</li>\n<li><code>session</code> Boolean (optional) - Whether the cookie is a session cookie or a persistent cookie with an expiration date.</li>\n<li><code>expirationDate</code> Double (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies.</li>\n<li><code>sameSite</code> String - The <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies\">Same Site</a> policy applied to this cookie.  Can be <code>unspecified</code>, <code>no_restriction</code>, <code>lax</code> or <code>strict</code>.</li>\n</ul>",
      "title": "Cookie Object",
      "description": ""
    },
    "/docs/api/cookies": {
      "locale": "pt-BR",
      "slug": "cookies",
      "href": "/docs/api/cookies",
      "crowdinFileId": "256301",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/cookies.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-cookies\"><a href=\"#class-cookies\">Class: Cookies</a></h2>\n<blockquote>\n<p>Query and modify a session's cookies.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Instâncias da classe <code>Cookies</code> são acessadas através da propriedade <code>cookies</code> de uma <code>Sessão</code>.</p>\n<p>Como por exemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Query all cookies.</span>\nsession.defaultSession.cookies.get({})\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">cookies</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(cookies)\n  }).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">error</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(error)\n  })\n\n<span class=\"hljs-comment\">// Query all cookies associated with a specific url.</span>\nsession.defaultSession.cookies.get({ <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'http://www.github.com'</span> })\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">cookies</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(cookies)\n  }).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">error</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(error)\n  })\n\n<span class=\"hljs-comment\">// Set a cookie with the given cookie data;</span>\n<span class=\"hljs-comment\">// may overwrite equivalent cookies if they exist.</span>\n<span class=\"hljs-keyword\">const</span> cookie = { <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'http://www.github.com'</span>, <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'dummy_name'</span>, <span class=\"hljs-attr\">value</span>: <span class=\"hljs-string\">'dummy'</span> }\nsession.defaultSession.cookies.set(cookie)\n  .then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// success</span>\n  }, (error) => {\n    <span class=\"hljs-built_in\">console</span>.error(error)\n  })\n</code></pre>\n<h3 id=\"eventos-de-instância\"><a href=\"#eventos-de-instância\">Eventos de instância</a></h3>\n<p>Os seguintes eventos estão disponíveis em instâncias de <code>Cookies</code>:</p>\n<h4 id=\"evento-changed\"><a href=\"#evento-changed\">Evento: 'changed'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>cookie</code> <a href=\"/docs/api/structures/cookie\">Cookie</a> - O cookie que foi modificado.</li>\n<li><code>cause</code> String - The cause of the change with one of the following values:<ul>\n<li><code>explicit</code> - O cookie foi modificado diretamente por uma ação do consumidor.</li>\n<li><code>overwrite</code> - O cookie foi removido automaticamente devido à uma ação de inserção que o sobrescreveu.</li>\n<li><code>expired</code> - O cookie foi automaticamente removido conforme expirou.</li>\n<li><code>evicted</code> - The cookie was automatically evicted during garbage collection.</li>\n<li><code>expired-overwrite</code> - The cookie was overwritten with an already-expired expiration date.</li>\n</ul></li>\n<li><code>removed</code> Boolean - <code>true</code> se o cookie foi removido, <code>false</code> caso contrário.</li>\n</ul>\n<p>Emitido quando um cookie é modificado devido à adição, edição, remoção ou expiração.</p>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<p>Os metódos a seguir estão disponíveis em instâncias <code>de Cookies</code>:</p>\n<h4 id=\"cookiesgetfilter\"><a href=\"#cookiesgetfilter\"><code>cookies.get(filter)</code></a></h4>\n<ul>\n<li><code>filter</code> Object<ul>\n<li><code>url</code> String (optional) - Retrieves cookies which are associated with <code>url</code>. Empty implies retrieving cookies of all URLs.</li>\n<li><code>name</code> String (opcional) - Filtra cookies por nome.</li>\n<li><code>domain</code> String (opcional) - Recupera cookies nos quais os domínios sejam iguais ou subdomínios de <code>domain</code>.</li>\n<li><code>path</code> String (opcional) - Recupera cookies nos quais o caminho seja igual a <code>path</code>.</li>\n<li><code>secure</code> Boolean (opcional) - Filtra cookies pela propriedade Secure.</li>\n<li><code>session</code> Boolean (optional) - Filters out session or persistent cookies.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Cookie[]></code> - A promise which resolves an array of cookie objects.</p>\n<p>Sends a request to get all cookies matching <code>filter</code>, and resolves a promise with the response.</p>\n<h4 id=\"cookiessetdetails\"><a href=\"#cookiessetdetails\"><code>cookies.set(details)</code></a></h4>\n<ul>\n<li>Objeto <code>details</code><ul>\n<li><code>url</code> String - The URL to associate the cookie with. The promise will be rejected if the URL is invalid.</li>\n<li><code>name</code> String (optional) - The name of the cookie. Empty by default if omitted.</li>\n<li><code>value</code> String (optional) - The value of the cookie. Empty by default if omitted.</li>\n<li><code>domain</code> String (opcional) - O domínio do cookie; isto será normalizado com um ponto no início para que ele também seja válido para subdomínios. Empty by default if omitted.</li>\n<li><code>path</code> String (opcional) - O Diretório do cookie. Empty by default if omitted.</li>\n<li><code>secure</code> Boolean (optional) - Whether the cookie should be marked as Secure. Defaults to false unless <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite#samesitenone_requires_secure\">Same Site=None</a> attribute is used.</li>\n<li><code>httpOnly</code> Boolean (optional) - Whether the cookie should be marked as HTTP only. Defaults to false.</li>\n<li><code>expirationDate</code> Double (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted then the cookie becomes a session cookie and will not be retained between sessions.</li>\n<li><code>sameSite</code> String (optional) - The <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies\">Same Site</a> policy to apply to this cookie.  Pode ser <code>unspecified</code>, <code>no_restriction</code>, <code>lax</code> ou <code>strict</code>.  Por padrão é <code>no_restriction</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - A promise which resolves when the cookie has been set</p>\n<p>Sets a cookie with <code>details</code>.</p>\n<h4 id=\"cookiesremoveurl-name\"><a href=\"#cookiesremoveurl-name\"><code>cookies.remove(url, name)</code></a></h4>\n<ul>\n<li><code>url</code> String - A URL associada com o cookie.</li>\n<li><code>name</code> String - O nome do cookie a ser removido.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - A promise which resolves when the cookie has been removed</p>\n<p>Removes the cookies matching <code>url</code> and <code>name</code></p>\n<h4 id=\"cookiesflushstore\"><a href=\"#cookiesflushstore\"><code>cookies.flushStore()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - A promise which resolves when the cookie store has been flushed</p>\n<p>Escreve qualquer cookie que não tenha sido escrito no disco.</p>",
      "title": "Cookies",
      "description": "Query and modify a session's cookies."
    },
    "/docs/api/structures/cpu-usage": {
      "locale": "pt-BR",
      "slug": "cpu-usage",
      "href": "/docs/api/structures/cpu-usage",
      "crowdinFileId": "256419",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/cpu-usage.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"cpuusage-object\"><a href=\"#cpuusage-object\">CPUUsage Object</a></h1>\n<ul>\n<li><code>percentCPUUsage</code> Number - Percentage of CPU used since the last call to getCPUUsage. First call returns 0.</li>\n<li><code>idleWakeupsPerSecond</code> Number - The number of average idle CPU wakeups per second since the last call to getCPUUsage. First call returns 0. Will always return 0 on Windows.</li>\n</ul>",
      "title": "CPUUsage Object",
      "description": ""
    },
    "/docs/api/structures/crash-report": {
      "locale": "pt-BR",
      "slug": "crash-report",
      "href": "/docs/api/structures/crash-report",
      "crowdinFileId": "256421",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/crash-report.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"crashreport-object\"><a href=\"#crashreport-object\">CrashReport Object</a></h1>\n<ul>\n<li><code>date</code> Date</li>\n<li><code>id</code> String</li>\n</ul>",
      "title": "CrashReport Object",
      "description": ""
    },
    "/docs/api/crash-reporter": {
      "locale": "pt-BR",
      "slug": "crash-reporter",
      "href": "/docs/api/crash-reporter",
      "crowdinFileId": "256303",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/crash-reporter.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"crashreporter\"><a href=\"#crashreporter\">crashReporter</a></h1>\n<blockquote>\n<p>Submit crash reports to a remote server.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>The following is an example of setting up Electron to automatically submit crash reports to a remote server:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { crashReporter } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncrashReporter.start({ <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://your-domain.com/url-to-submit'</span> })\n</code></pre>\n<p>For setting up a server to accept and process crash reports, you can use following projects:</p>\n<ul>\n<li><a href=\"https://github.com/mozilla/socorro\">socorro</a></li>\n<li><a href=\"https://github.com/electron/mini-breakpad-server\">mini-breakpad-server</a></li>\n</ul>\n<p>Or use a 3rd party hosted solution:</p>\n<ul>\n<li><a href=\"https://backtrace.io/electron/\">Backtrace</a></li>\n<li><a href=\"https://docs.sentry.io/clients/electron\">Sentry</a></li>\n<li><a href=\"https://www.bugsplat.com/docs/platforms/electron\">BugSplat</a></li>\n</ul>\n<p>Crash reports are stored temporarily before being uploaded in a directory underneath the app's user data directory (called 'Crashpad' on Windows and Mac, or 'Crash Reports' on Linux). You can override this directory by calling <code>app.setPath('crashDumps', '/path/to/crashes')</code> before starting the crash reporter.</p>\n<p>On Windows and macOS, Electron uses <a href=\"https://chromium.googlesource.com/crashpad/crashpad/+/master/README.md\">crashpad</a> to monitor and report crashes. On Linux, Electron uses <a href=\"https://chromium.googlesource.com/breakpad/breakpad/+/master/\">breakpad</a>. This is an implementation detail driven by Chromium, and it may change in future. In particular, crashpad is newer and will likely eventually replace breakpad on all platforms.</p>\n<h3 id=\"note-about-node-child-processes-on-linux\"><a href=\"#note-about-node-child-processes-on-linux\">Note about Node child processes on Linux</a></h3>\n<p>If you are using the Node.js <code>child_process</code> module and want to report crashes from those processes on Linux, there is an extra step you will need to take to properly initialize the crash reporter in the child process. This is not necessary on Mac or Windows, as those platforms use Crashpad, which automatically monitors child processes.</p>\n<p>Since <code>require('electron')</code> is not available in Node child processes, the following APIs are available on the <code>process</code> object in Node child processes. Note that, on Linux, each Node child process has its own separate instance of the breakpad crash reporter. This is dissimilar to renderer child processes, which have a \"stub\" breakpad reporter which returns information to the main process for reporting.</p>\n<h4 id=\"processcrashreporterstartoptions\"><a href=\"#processcrashreporterstartoptions\"><code>process.crashReporter.start(options)</code></a></h4>\n<p>See <a href=\"#crashreporterstartoptions\"><code>crashReporter.start()</code></a>.</p>\n<h4 id=\"processcrashreportergetparameters\"><a href=\"#processcrashreportergetparameters\"><code>process.crashReporter.getParameters()</code></a></h4>\n<p>See <a href=\"#crashreportergetparameters\"><code>crashReporter.getParameters()</code></a>.</p>\n<h4 id=\"processcrashreporteraddextraparameterkey-value\"><a href=\"#processcrashreporteraddextraparameterkey-value\"><code>process.crashReporter.addExtraParameter(key, value)</code></a></h4>\n<p>See <a href=\"#crashreporteraddextraparameterkey-value\"><code>crashReporter.addExtraParameter(key, value)</code></a>.</p>\n<h4 id=\"processcrashreporterremoveextraparameterkey\"><a href=\"#processcrashreporterremoveextraparameterkey\"><code>process.crashReporter.removeExtraParameter(key)</code></a></h4>\n<p>See <a href=\"#crashreporterremoveextraparameterkey\"><code>crashReporter.removeExtraParameter(key)</code></a>.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>crashReporter</code> tem os seguintes métodos:</p>\n<h3 id=\"crashreporterstartoptions\"><a href=\"#crashreporterstartoptions\"><code>crashReporter.start(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>submitURL</code> String (optional) - URL that crash reports will be sent to as POST. Required unless <code>uploadToServer</code> is <code>false</code>.</li>\n<li><code>productName</code> String (optional) - Defaults to <code>app.name</code>.</li>\n<li><code>companyName</code> String (optional) <em>Deprecated</em> - Deprecated alias for <code>{ globalExtra: { _companyName: ... } }</code>.</li>\n<li><code>uploadToServer</code> Boolean (optional) - Whether crash reports should be sent to the server. If false, crash reports will be collected and stored in the crashes directory, but not uploaded. Por padrão é <code>true</code>.</li>\n<li><code>ignoreSystemCrashHandler</code> Boolean (optional) - If true, crashes generated in the main process will not be forwarded to the system crash handler. Por padrão é <code>false</code>.</li>\n<li><code>rateLimit</code> Boolean (optional) <em>macOS</em> <em>Windows</em> - If true, limit the number of crashes uploaded to 1/hour. Por padrão é <code>false</code>.</li>\n<li><code>compress</code> Boolean (optional) - If true, crash reports will be compressed and uploaded with <code>Content-Encoding: gzip</code>. Por padrão é <code>true</code>.</li>\n<li><code>extra</code> Record&#x3C;String, String> (optional) - Extra string key/value annotations that will be sent along with crash reports that are generated in the main process. Only string values are supported. Crashes generated in child processes will not contain these extra parameters to crash reports generated from child processes, call <a href=\"#crashreporteraddextraparameterkey-value\"><code>addExtraParameter</code></a> from the child process.</li>\n<li><code>globalExtra</code> Record&#x3C;String, String> (optional) - Extra string key/value annotations that will be sent along with any crash reports generated in any process. These annotations cannot be changed once the crash reporter has been started. If a key is present in both the global extra parameters and the process-specific extra parameters, then the global one will take precedence. By default, <code>productName</code> and the app version are included, as well as the Electron version.</li>\n</ul></li>\n</ul>\n<p>This method must be called before using any other <code>crashReporter</code> APIs. Once initialized this way, the crashpad handler collects crashes from all subsequently created processes. The crash reporter cannot be disabled once started.</p>\n<p>This method should be called as early as possible in app startup, preferably before <code>app.on('ready')</code>. If the crash reporter is not initialized at the time a renderer process is created, then that renderer process will not be monitored by the crash reporter.</p>\n<p><strong>Note:</strong> You can test out the crash reporter by generating a crash using <code>process.crash()</code>.</p>\n<p><strong>Note:</strong> If you need to send additional/updated <code>extra</code> parameters after your first call <code>start</code> you can call <code>addExtraParameter</code>.</p>\n<p><strong>Note:</strong> Parameters passed in <code>extra</code>, <code>globalExtra</code> or set with <code>addExtraParameter</code> have limits on the length of the keys and values. Key names must be at most 39 bytes long, and values must be no longer than 127 bytes. Keys with names longer than the maximum will be silently ignored. Key values longer than the maximum length will be truncated.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportergetlastcrashreport\"><a href=\"#crashreportergetlastcrashreport\"><code>crashReporter.getLastCrashReport()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/crash-report\"><code>CrashReport</code></a> - The date and ID of the last crash report. Only crash reports that have been uploaded will be returned; even if a crash report is present on disk it will not be returned until it is uploaded. No caso de não existirem relatórios enviados, <code>null</code> é retornado.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportergetuploadedreports\"><a href=\"#crashreportergetuploadedreports\"><code>crashReporter.getUploadedReports()</code></a></h3>\n<p>Retorna <a href=\"/docs/api/structures/crash-report\"><code>CrashReport[]</code></a>:</p>\n<p>Returns all uploaded crash reports. Each report contains the date and uploaded ID.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportergetuploadtoserver\"><a href=\"#crashreportergetuploadtoserver\"><code>crashReporter.getUploadToServer()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether reports should be submitted to the server. Set through the <code>start</code> method or <code>setUploadToServer</code>.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportersetuploadtoserveruploadtoserver\"><a href=\"#crashreportersetuploadtoserveruploadtoserver\"><code>crashReporter.setUploadToServer(uploadToServer)</code></a></h3>\n<ul>\n<li><code>uploadToServer</code> Boolean - Whether reports should be submitted to the server.</li>\n</ul>\n<p>This would normally be controlled by user preferences. This has no effect if called before <code>start</code> is called.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreporteraddextraparameterkey-value\"><a href=\"#crashreporteraddextraparameterkey-value\"><code>crashReporter.addExtraParameter(key, value)</code></a></h3>\n<ul>\n<li><code>key</code> String - Parameter key, must be no longer than 39 bytes.</li>\n<li><code>value</code> String - Parameter value, must be no longer than 127 bytes.</li>\n</ul>\n<p>Set an extra parameter to be sent with the crash report. The values specified here will be sent in addition to any values set via the <code>extra</code> option when <code>start</code> was called.</p>\n<p>Parameters added in this fashion (or via the <code>extra</code> parameter to <code>crashReporter.start</code>) are specific to the calling process. Adding extra parameters in the main process will not cause those parameters to be sent along with crashes from renderer or other child processes. Similarly, adding extra parameters in a renderer process will not result in those parameters being sent with crashes that occur in other renderer processes or in the main process.</p>\n<p><strong>Note:</strong> Parameters have limits on the length of the keys and values. Key names must be no longer than 39 bytes, and values must be no longer than 20320 bytes. Keys with names longer than the maximum will be silently ignored. Key values longer than the maximum length will be truncated.</p>\n<p><strong>Note:</strong> On linux values that are longer than 127 bytes will be chunked into multiple keys, each 127 bytes in length.  Ex. <code>addExtraParameter('foo', 'a'.repeat(130))</code> will result in two chunked keys <code>foo__1</code> and <code>foo__2</code>, the first will contain the first 127 bytes and the second will contain the remaining 3 bytes.  On your crash reporting backend you should stitch together keys in this format.</p>\n<h3 id=\"crashreporterremoveextraparameterkey\"><a href=\"#crashreporterremoveextraparameterkey\"><code>crashReporter.removeExtraParameter(key)</code></a></h3>\n<ul>\n<li><code>key</code> String - Parameter key, must be no longer than 39 bytes.</li>\n</ul>\n<p>Remove an extra parameter from the current set of parameters. Future crashes will not include this parameter.</p>\n<h3 id=\"crashreportergetparameters\"><a href=\"#crashreportergetparameters\"><code>crashReporter.getParameters()</code></a></h3>\n<p>Returns <code>Record&#x3C;String, String></code> - The current 'extra' parameters of the crash reporter.</p>\n<h2 id=\"crash-report-payload\"><a href=\"#crash-report-payload\">Crash Report Payload</a></h2>\n<p>The crash reporter will send the following data to the <code>submitURL</code> as a <code>multipart/form-data</code> <code>POST</code>:</p>\n<ul>\n<li><code>ver</code> String - The version of Electron.</li>\n<li><code>platform</code> String - e.g. 'win32'.</li>\n<li><code>process_type</code> String - e.g. 'renderer'.</li>\n<li><code>guid</code> String - e.g. '5e1286fc-da97-479e-918b-6bfb0c3d1c72'.</li>\n<li><code>_version</code> String - The version in <code>package.json</code>.</li>\n<li><code>_productName</code> String - The product name in the <code>crashReporter</code> <code>options</code> object.</li>\n<li><code>prod</code> String - Name of the underlying product. In this case Electron.</li>\n<li><code>_companyName</code> String - The company name in the <code>crashReporter</code> <code>options</code> object.</li>\n<li><code>upload_file_minidump</code> File - The crash report in the format of <code>minidump</code>.</li>\n<li>All level one properties of the <code>extra</code> object in the <code>crashReporter</code> <code>options</code> object.</li>\n</ul>",
      "title": "crashReporter",
      "description": "Submit crash reports to a remote server."
    },
    "/docs/api/structures/custom-scheme": {
      "locale": "pt-BR",
      "slug": "custom-scheme",
      "href": "/docs/api/structures/custom-scheme",
      "crowdinFileId": "256423",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/custom-scheme.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"customscheme-object\"><a href=\"#customscheme-object\">CustomScheme Object</a></h1>\n<ul>\n<li><code>scheme</code> String - Custom schemes to be registered with options.</li>\n<li><code>privileges</code> Object (optional)<ul>\n<li><code>standard</code> Boolean (optional) - Default false.</li>\n<li><code>secure</code> Boolean (optional) - Default false.</li>\n<li><code>bypassCSP</code> Boolean (optional) - Default false.</li>\n<li><code>allowServiceWorkers</code> Boolean (optional) - Default false.</li>\n<li><code>supportFetchAPI</code> Boolean (optional) - Default false.</li>\n<li><code>corsEnabled</code> Boolean (optional) - Default false.</li>\n<li><code>stream</code> Boolean (optional) - Default false.</li>\n</ul></li>\n</ul>",
      "title": "CustomScheme Object",
      "description": ""
    },
    "/docs/tutorial/dark-mode": {
      "locale": "pt-BR",
      "slug": "dark-mode",
      "href": "/docs/tutorial/dark-mode",
      "crowdinFileId": "256187",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/dark-mode.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"modo-escuro\"><a href=\"#modo-escuro\">Modo escuro</a></h1>\n<h2 id=\"visão-geral\"><a href=\"#visão-geral\">Visão Geral</a></h2>\n<h3 id=\"atualiza-automaticamente-as-interfaces-nativas\"><a href=\"#atualiza-automaticamente-as-interfaces-nativas\">Atualiza automaticamente as interfaces nativas</a></h3>\n<p>\"Native interfaces\" include the file picker, window border, dialogs, context menus, and more - anything where the UI comes from your operating system and not from your app. O comportamento padrão é optar por esse tema automático do sistema operacional.</p>\n<h3 id=\"automatically-update-your-own-interfaces\"><a href=\"#automatically-update-your-own-interfaces\">Automatically update your own interfaces</a></h3>\n<p>If your app has its own dark mode, you should toggle it on and off in sync with the system's dark mode setting. You can do this by using the [prefer-color-scheme] CSS media query.</p>\n<h3 id=\"manually-update-your-own-interfaces\"><a href=\"#manually-update-your-own-interfaces\">Manually update your own interfaces</a></h3>\n<p>If you want to manually switch between light/dark modes, you can do this by setting the desired mode in the <a href=\"/docs/api/native-theme#nativethemethemesource\">themeSource</a> property of the <code>nativeTheme</code> module. This property's value will be propagated to your Renderer process. Any CSS rules related to <code>prefers-color-scheme</code> will be updated accordingly.</p>\n<h2 id=\"macos-settings\"><a href=\"#macos-settings\">macOS settings</a></h2>\n<p>No macOS 10.14 Mojave, a Apple introduziu um novo <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/dark-mode/\">system-wide dark mode</a> para todos computadores macOS. If your Electron app has a dark mode, you can make it follow the system-wide dark mode setting using <a href=\"/docs/api/native-theme\">the <code>nativeTheme</code> api</a>.</p>\n<p>In macOS 10.15 Catalina, Apple introduced a new \"automatic\" dark mode option for all macOS computers. In order for the <code>nativeTheme.shouldUseDarkColors</code> and <code>Tray</code> APIs to work correctly in this mode on Catalina, you need to use Electron <code>>=7.0.0</code>, or set <code>NSRequiresAquaSystemAppearance</code> to <code>false</code> in your <code>Info.plist</code> file for older versions. Both <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a> and <a href=\"https://www.electronforge.io/\">Electron Forge</a> have a <a href=\"https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html#darwindarkmodesupport\"><code>darwinDarkModeSupport</code> option</a> to automate the <code>Info.plist</code> changes during app build time.</p>\n<p>If you wish to opt-out while using Electron > 8.0.0, you must set the <code>NSRequiresAquaSystemAppearance</code> key in the <code>Info.plist</code> file to <code>true</code>. Please note that Electron 8.0.0 and above will not let you opt-out of this theming, due to the use of the macOS 10.14 SDK.</p>\n<h2 id=\"exemplo\"><a href=\"#exemplo\">Exemplo</a></h2>\n<p>This example demonstrates an Electron application that derives its theme colors from the <code>nativeTheme</code>. Additionally, it provides theme toggle and reset controls using IPC channels.</p>\n<h3 id=\"how-does-this-work\"><a href=\"#how-does-this-work\">How does this work?</a></h3>\n<p>Starting with the <code>index.html</code> file:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"script-src 'self' 'unsafe-inline';\"</span> /></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/css\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"./styles.css\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">p</span>></span>Current theme source: <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">strong</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"theme-source\"</span>></span>System<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">strong</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">p</span>></span>\n\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"toggle-dark-mode\"</span>></span>Toggle Dark Mode<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">button</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"reset-to-system\"</span>></span>Reset to System Theme<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">button</span>></span>\n\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>And the <code>styles.css</code> file:</p>\n<pre><code class=\"hljs language-css\">@<span class=\"hljs-keyword\">media</span> (prefers-color-scheme: dark) {\n  <span class=\"hljs-selector-tag\">body</span> { <span class=\"hljs-attribute\">background</span>: <span class=\"hljs-number\">#333</span>; <span class=\"hljs-attribute\">color</span>: white; }\n}\n\n@<span class=\"hljs-keyword\">media</span> (prefers-color-scheme: light) {\n  <span class=\"hljs-selector-tag\">body</span> { <span class=\"hljs-attribute\">background</span>: <span class=\"hljs-number\">#ddd</span>; <span class=\"hljs-attribute\">color</span>: black; }\n}\n</code></pre>\n<p>The example renders an HTML page with a couple elements. The <code>&#x3C;strong id=\"theme-source\"></code> element shows which theme is currently selected, and the two <code>&#x3C;button></code> elements are the controls. The CSS file uses the <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> media query to set the <code>&#x3C;body></code> element background and text colors.</p>\n<p>The <code>preload.js</code> script adds a new API to the <code>window</code> object called <code>darkMode</code>. This API exposes two IPC channels to the renderer process, <code>'dark-mode:toggle'</code> and <code>'dark-mode:system'</code>. It also assigns two methods, <code>toggle</code> and <code>system</code>, which pass messages from the renderer to the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'darkMode'</span>, {\n  <span class=\"hljs-attr\">toggle</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'dark-mode:toggle'</span>),\n  <span class=\"hljs-attr\">system</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'dark-mode:system'</span>)\n})\n</code></pre>\n<p>Now the renderer process can communicate with the main process securely and perform the necessary mutations to the <code>nativeTheme</code> object.</p>\n<p>The <code>renderer.js</code> file is responsible for controlling the <code>&#x3C;button></code> functionality.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'toggle-dark-mode'</span>).addEventListener(<span class=\"hljs-string\">'click'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> isDarkMode = <span class=\"hljs-keyword\">await</span> <span class=\"hljs-built_in\">window</span>.darkMode.toggle()\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'theme-source'</span>).innerHTML = isDarkMode ? <span class=\"hljs-string\">'Dark'</span> : <span class=\"hljs-string\">'Light'</span>\n})\n\n<span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'reset-to-system'</span>).addEventListener(<span class=\"hljs-string\">'click'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> <span class=\"hljs-built_in\">window</span>.darkMode.system()\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'theme-source'</span>).innerHTML = <span class=\"hljs-string\">'System'</span>\n})\n</code></pre>\n<p>Using <code>addEventListener</code>, the <code>renderer.js</code> file adds <code>'click'</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\">event listeners</a> to each button element. Each event listener handler makes calls to the respective <code>window.darkMode</code> API methods.</p>\n<p>Finally, the <code>main.js</code> file represents the main process and contains the actual <code>nativeTheme</code> API.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, ipcMain, nativeTheme } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  ipcMain.handle(<span class=\"hljs-string\">'dark-mode:toggle'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (nativeTheme.shouldUseDarkColors) {\n      nativeTheme.themeSource = <span class=\"hljs-string\">'light'</span>\n    } <span class=\"hljs-keyword\">else</span> {\n      nativeTheme.themeSource = <span class=\"hljs-string\">'dark'</span>\n    }\n    <span class=\"hljs-keyword\">return</span> nativeTheme.shouldUseDarkColors\n  })\n\n  ipcMain.handle(<span class=\"hljs-string\">'dark-mode:system'</span>, () => {\n    nativeTheme.themeSource = <span class=\"hljs-string\">'system'</span>\n  })\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n      createWindow()\n    }\n  })\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n</code></pre>\n<p>The <code>ipcMain.handle</code> methods are how the main process responds to the click events from the buttons on the HTML page.</p>\n<p>The <code>'dark-mode:toggle'</code> IPC channel handler method checks the <code>shouldUseDarkColors</code> boolean property, sets the corresponding <code>themeSource</code>, and then returns the current <code>shouldUseDarkColors</code> property. Looking back on the renderer process event listener for this IPC channel, the return value from this handler is utilized to assign the correct text to the <code>&#x3C;strong id='theme-source'></code> element.</p>\n<p>The <code>'dark-mode:system'</code> IPC channel handler method assigns the string <code>'system'</code> to the <code>themeSource</code> and returns nothing. This also corresponds with the relative renderer process event listener as the method is awaited with no return value expected.</p>\n<p>Run the example using Electron Fiddle and then click the \"Toggle Dark Mode\" button; the app should start alternating between a light and dark background color.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/dark_mode.gif\" alt=\"Modo escuro\"></p>",
      "title": "Modo escuro",
      "description": ""
    },
    "/docs/development/debug-instructions-windows": {
      "locale": "pt-BR",
      "slug": "debug-instructions-windows",
      "href": "/docs/development/debug-instructions-windows",
      "crowdinFileId": "256149",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debug-instructions-windows.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"depuração-no-windows\"><a href=\"#depuração-no-windows\">Depuração no Windows</a></h1>\n<p>Se experimentar falhas ou problemas no Electron que acredita que não são causados pelo seu aplicativo de JavaScript, mas devido ao próprio Electron, a depuração pode ser um pouco complicada, especialmente para os desenvolvedores que não usam a depuração nativa/C++. However, using Visual Studio, Electron's hosted Symbol Server, and the Electron source code, you can enable step-through debugging with breakpoints inside Electron's source code.</p>\n<p><strong>See also</strong>: There's a wealth of information on debugging Chromium, much of which also applies to Electron, on the Chromium developers site: <a href=\"https://www.chromium.org/developers/how-tos/debugging-on-windows\">Debugging Chromium on Windows</a>.</p>\n<h2 id=\"requisitos\"><a href=\"#requisitos\">Requisitos</a></h2>\n<ul>\n<li>\n<p><strong>Depurar uma compilação de Electron</strong>: A maneira mais fácil é normalmente construí-lo você mesmo, usando as ferramentas e os pré-requisitos listados na <a href=\"/docs/development/build-instructions-windows\">construir instruções para Windows</a>. While you can attach to and debug Electron as you can download it directly, you will find that it is heavily optimized, making debugging substantially more difficult: The debugger will not be able to show you the content of all variables and the execution path can seem strange because of inlining, tail calls, and other compiler optimizations.</p>\n</li>\n<li>\n<p><strong>Visual Studio com ferramentas C++</strong>: As edições de comunidade livre de Visual Studio de 2013 e Visual Studio 2015, ambos trabalham. Once installed, <a href=\"/docs/development/setting-up-symbol-server\">configure Visual Studio to use Electron's Symbol server</a>. Permitirá que o Visual Studio obtenha uma melhor compreensão do que acontece dentro de Electron, tornando mais fácil para apresentar as variáveis num formato legível.</p>\n</li>\n<li>\n<p><strong>ProcMon</strong>: The <a href=\"https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx\">free SysInternals tool</a> allows you to inspect a processes parameters, file handles, and registry operations.</p>\n</li>\n</ul>\n<h2 id=\"anexar-e-depurar-o-electron\"><a href=\"#anexar-e-depurar-o-electron\">Anexar e depurar o Electron</a></h2>\n<p>Para iniciar uma sessão de depuração, abrá CMD/PowerShell e execute a sua compilação para depuração do Electron, usando o aplicativo para abrir como um parâmetro.</p>\n<pre><code class=\"hljs language-powershell\">$ ./out/Testing/electron.exe ~/my-electron-app/\n</code></pre>\n<h3 id=\"definir-pontos-de-interrupção\"><a href=\"#definir-pontos-de-interrupção\">Definir pontos de interrupção</a></h3>\n<p>Em seguida, abra o Visual Studio. Electron is not built with Visual Studio and hence does not contain a project file - you can however open up the source code files \"As File\", meaning that Visual Studio will open them up by themselves. You can still set breakpoints - Visual Studio will automatically figure out that the source code matches the code running in the attached process and break accordingly.</p>\n<p>Relevant code files can be found in <code>./shell/</code>.</p>\n<h3 id=\"attaching\"><a href=\"#attaching\">Attaching</a></h3>\n<p>You can attach the Visual Studio debugger to a running process on a local or remote computer. After the process is running, click Debug / Attach to Process (or press <code>CTRL+ALT+P</code>) to open the \"Attach to Process\" dialog box. You can use this capability to debug apps that are running on a local or remote computer, debug multiple processes simultaneously.</p>\n<p>If Electron is running under a different user account, select the <code>Show processes from all users</code> check box. Notice that depending on how many BrowserWindows your app opened, you will see multiple processes. A typical one-window app will result in Visual Studio presenting you with two <code>Electron.exe</code> entries - one for the main process and one for the renderer process. Since the list only gives you names, there's currently no reliable way of figuring out which is which.</p>\n<h3 id=\"which-process-should-i-attach-to\"><a href=\"#which-process-should-i-attach-to\">Which Process Should I Attach to?</a></h3>\n<p>Code executed within the main process (that is, code found in or eventually run by your main JavaScript file) will run inside the main process, while other code will execute inside its respective renderer process.</p>\n<p>You can be attached to multiple programs when you are debugging, but only one program is active in the debugger at any time. You can set the active program in the <code>Debug Location</code> toolbar or the <code>Processes window</code>.</p>\n<h2 id=\"using-procmon-to-observe-a-process\"><a href=\"#using-procmon-to-observe-a-process\">Using ProcMon to Observe a Process</a></h2>\n<p>While Visual Studio is fantastic for inspecting specific code paths, ProcMon's strength is really in observing everything your application is doing with the operating system - it captures File, Registry, Network, Process, and Profiling details of processes. It attempts to log <strong>all</strong> events occurring and can be quite overwhelming, but if you seek to understand what and how your application is doing to the operating system, it can be a valuable resource.</p>\n<p>For an introduction to ProcMon's basic and advanced debugging features, go check out <a href=\"https://channel9.msdn.com/shows/defrag-tools/defrag-tools-4-process-monitor\">this video tutorial</a> provided by Microsoft.</p>",
      "title": "Depuração no Windows",
      "description": ""
    },
    "/docs/api/debugger": {
      "locale": "pt-BR",
      "slug": "debugger",
      "href": "/docs/api/debugger",
      "crowdinFileId": "256305",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/debugger.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-debugger\"><a href=\"#class-debugger\">Class: Debugger</a></h2>\n<blockquote>\n<p>Um transporte alternativo para o protocolo de depuração remoto do Chrome.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>As ferramentas de desenvolvedor do Chrome possuem <a href=\"https://chromedevtools.github.io/devtools-protocol/\">special binding</a> disponível no runtime do JavaScript que permite interagir com páginas e instrumentá-las.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-keyword\">try</span> {\n  win.webContents.debugger.attach(<span class=\"hljs-string\">'1.1'</span>)\n} <span class=\"hljs-keyword\">catch</span> (err) {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Debugger attach failed : '</span>, err)\n}\n\nwin.webContents.debugger.on(<span class=\"hljs-string\">'detach'</span>, (event, reason) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Debugger detached due to : '</span>, reason)\n})\n\nwin.webContents.debugger.on(<span class=\"hljs-string\">'message'</span>, (event, method, params) => {\n  <span class=\"hljs-keyword\">if</span> (method === <span class=\"hljs-string\">'Network.requestWillBeSent'</span>) {\n    <span class=\"hljs-keyword\">if</span> (params.request.url === <span class=\"hljs-string\">'https://www.github.com'</span>) {\n      win.webContents.debugger.detach()\n    }\n  }\n})\n\nwin.webContents.debugger.sendCommand(<span class=\"hljs-string\">'Network.enable'</span>)\n</code></pre>\n<h3 id=\"eventos-de-instância\"><a href=\"#eventos-de-instância\">Eventos de instância</a></h3>\n<h4 id=\"event-detach\"><a href=\"#event-detach\">Event: 'detach'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>reason</code> String - Reason for detaching debugger.</li>\n</ul>\n<p>Emitted when the debugging session is terminated. This happens either when <code>webContents</code> is closed or devtools is invoked for the attached <code>webContents</code>.</p>\n<h4 id=\"event-message\"><a href=\"#event-message\">Event: 'message'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>method</code> String - Method name.</li>\n<li><code>params</code> any - Event parameters defined by the 'parameters' attribute in the remote debugging protocol.</li>\n<li><code>sessionId</code> String - Unique identifier of attached debugging session, will match the value sent from <code>debugger.sendCommand</code>.</li>\n</ul>\n<p>Emitted whenever the debugging target issues an instrumentation event.</p>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<h4 id=\"debuggerattachprotocolversion\"><a href=\"#debuggerattachprotocolversion\"><code>debugger.attach([protocolVersion])</code></a></h4>\n<ul>\n<li><code>protocolVersion</code> String (opcional) - Versão do protocolo de debugging solicitado.</li>\n</ul>\n<p>Anexa o debugger à <code>webContents</code>.</p>\n<h4 id=\"debuggerisattached\"><a href=\"#debuggerisattached\"><code>debugger.isAttached()</code></a></h4>\n<p>Retorna um <code>Boolean</code> - que mostra se o debugger está anexado à <code>webContents</code>.</p>\n<h4 id=\"debuggerdetach\"><a href=\"#debuggerdetach\"><code>debugger.detach()</code></a></h4>\n<p>Retira o debugger de <code>webContents</code>.</p>\n<h4 id=\"debuggersendcommandmethod-commandparams-sessionid\"><a href=\"#debuggersendcommandmethod-commandparams-sessionid\"><code>debugger.sendCommand(method[, commandParams, sessionId])</code></a></h4>\n<ul>\n<li><code>method</code> String - Method name, should be one of the methods defined by the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">remote debugging protocol</a>.</li>\n<li><code>commandParams</code> any (optional) - JSON object with request parameters.</li>\n<li><code>sessionId</code> String (optional) - send command to the target with associated debugging session id. The initial value can be obtained by sending <a href=\"https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-attachToTarget\">Target.attachToTarget</a> message.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the response defined by the 'returns' attribute of the command description in the remote debugging protocol or is rejected indicating the failure of the command.</p>\n<p>Send given command to the debugging target.</p>",
      "title": "Debugger",
      "description": "Um transporte alternativo para o protocolo de depuração remoto do Chrome."
    },
    "/docs/development/debugging-instructions-macos": {
      "locale": "pt-BR",
      "slug": "debugging-instructions-macos",
      "href": "/docs/development/debugging-instructions-macos",
      "crowdinFileId": "256153",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debugging-instructions-macos.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"depuração-no-macos\"><a href=\"#depuração-no-macos\">Depuração no macOS</a></h1>\n<p>Se experimentar falhas ou problemas no Electron que acredita que não são causados pelo seu aplicativo de JavaScript, mas devido ao próprio Electron, a depuração pode ser um pouco complicada, especialmente para os desenvolvedores que não usam a depuração nativa/C++. However, using lldb, and the Electron source code, you can enable step-through debugging with breakpoints inside Electron's source code. You can also use <a href=\"/docs/development/debugging-instructions-macos-xcode\">XCode for debugging</a> if you prefer a graphical interface.</p>\n<h2 id=\"requisitos\"><a href=\"#requisitos\">Requisitos</a></h2>\n<ul>\n<li>\n<p><strong>A debug build of Electron</strong>: The easiest way is usually building it yourself, using the tools and prerequisites listed in the <a href=\"/docs/development/build-instructions-macos\">build instructions for macOS</a>. While you can attach to and debug Electron as you can download it directly, you will find that it is heavily optimized, making debugging substantially more difficult: The debugger will not be able to show you the content of all variables and the execution path can seem strange because of inlining, tail calls, and other compiler optimizations.</p>\n</li>\n<li>\n<p><strong>Xcode</strong>: In addition to Xcode, also install the Xcode command line tools. They include LLDB, the default debugger in Xcode on macOS. It supports debugging C, Objective-C and C++ on the desktop and iOS devices and simulator.</p>\n</li>\n<li>\n<p><strong>.lldbinit</strong>: Create or edit <code>~/.lldbinit</code> to allow Chromium code to be properly source-mapped.</p>\n<pre><code class=\"hljs language-plaintext\"># e.g: ['~/electron/src/tools/lldb']\nscript sys.path[:0] = ['&#x3C;...path/to/electron/src/tools/lldb>']\nscript import lldbinit\n</code></pre>\n</li>\n</ul>\n<h2 id=\"anexar-e-depurar-o-electron\"><a href=\"#anexar-e-depurar-o-electron\">Anexar e depurar o Electron</a></h2>\n<p>To start a debugging session, open up Terminal and start <code>lldb</code>, passing a non-release build of Electron as a parameter.</p>\n<pre><code class=\"hljs language-sh\">$ lldb ./out/Testing/Electron.app\n(lldb) target create <span class=\"hljs-string\">\"./out/Testing/Electron.app\"</span>\nCurrent executable <span class=\"hljs-built_in\">set</span> to <span class=\"hljs-string\">'./out/Testing/Electron.app'</span> (x86_64).\n</code></pre>\n<h3 id=\"definir-pontos-de-interrupção\"><a href=\"#definir-pontos-de-interrupção\">Definir pontos de interrupção</a></h3>\n<p>LLDB is a powerful tool and supports multiple strategies for code inspection. For this basic introduction, let's assume that you're calling a command from JavaScript that isn't behaving correctly - so you'd like to break on that command's C++ counterpart inside the Electron source.</p>\n<p>Relevant code files can be found in <code>./shell/</code>.</p>\n<p>Let's assume that you want to debug <code>app.setName()</code>, which is defined in <code>browser.cc</code> as <code>Browser::SetName()</code>. Set the breakpoint using the <code>breakpoint</code> command, specifying file and line to break on:</p>\n<pre><code class=\"hljs language-sh\">(lldb) breakpoint <span class=\"hljs-built_in\">set</span> --file browser.cc --line 117\nBreakpoint 1: <span class=\"hljs-built_in\">where</span> = Electron Framework`atom::Browser::SetName(std::__1::basic_string&#x3C;char, std::__1::char_traits&#x3C;char>, std::__1::allocator&#x3C;char> > const&#x26;) + 20 at browser.cc:118, address = 0x000000000015fdb4\n</code></pre>\n<p>Then, start Electron:</p>\n<pre><code class=\"hljs language-sh\">(lldb) run\n</code></pre>\n<p>The app will immediately be paused, since Electron sets the app's name on launch:</p>\n<pre><code class=\"hljs language-sh\">(lldb) run\nProcess 25244 launched: <span class=\"hljs-string\">'/Users/fr/Code/electron/out/Testing/Electron.app/Contents/MacOS/Electron'</span> (x86_64)\nProcess 25244 stopped\n* thread <span class=\"hljs-comment\">#1: tid = 0x839a4c, 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 20 at browser.cc:118, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1</span>\n    frame <span class=\"hljs-comment\">#0: 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 20 at browser.cc:118</span>\n   115  }\n   116\n   117  void Browser::SetName(const std::string&#x26; name) {\n-> 118    name_override_ = name;\n   119  }\n   120\n   121  int Browser::<span class=\"hljs-function\"><span class=\"hljs-title\">GetBadgeCount</span></span>() {\n(lldb)\n</code></pre>\n<p>To show the arguments and local variables for the current frame, run <code>frame variable</code> (or <code>fr v</code>), which will show you that the app is currently setting the name to \"Electron\".</p>\n<pre><code class=\"hljs language-sh\">(lldb) frame variable\n(atom::Browser *) this = 0x0000000108b14f20\n(const string &#x26;) name = <span class=\"hljs-string\">\"Electron\"</span>: {\n    [...]\n}\n</code></pre>\n<p>To do a source level single step in the currently selected thread, execute <code>step</code> (or <code>s</code>). This would take you into <code>name_override_.empty()</code>. To proceed and do a step over, run <code>next</code> (or <code>n</code>).</p>\n<pre><code class=\"hljs language-sh\">(lldb) step\nProcess 25244 stopped\n* thread <span class=\"hljs-comment\">#1: tid = 0x839a4c, 0x0000000100162dcc Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 44 at browser.cc:119, queue = 'com.apple.main-thread', stop reason = step in</span>\n    frame <span class=\"hljs-comment\">#0: 0x0000000100162dcc Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 44 at browser.cc:119</span>\n   116\n   117  void Browser::SetName(const std::string&#x26; name) {\n   118    name_override_ = name;\n-> 119  }\n   120\n   121  int Browser::<span class=\"hljs-function\"><span class=\"hljs-title\">GetBadgeCount</span></span>() {\n   122    <span class=\"hljs-built_in\">return</span> badge_count_;\n</code></pre>\n<p><strong>NOTE:</strong> If you don't see source code when you think you should, you may not have added the <code>~/.lldbinit</code> file above.</p>\n<p>To finish debugging at this point, run <code>process continue</code>. You can also continue until a certain line is hit in this thread (<code>thread until 100</code>). This command will run the thread in the current frame till it reaches line 100 in this frame or stops if it leaves the current frame.</p>\n<p>Now, if you open up Electron's developer tools and call <code>setName</code>, you will once again hit the breakpoint.</p>\n<h3 id=\"leia-mais\"><a href=\"#leia-mais\">Leia mais</a></h3>\n<p>LLDB is a powerful tool with a great documentation. To learn more about it, consider Apple's debugging documentation, for instance the <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-basics.html#//apple_ref/doc/uid/TP40012917-CH2-SW2\">LLDB Command Structure Reference</a> or the introduction to <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-terminal-workflow-tutorial.html\">Using LLDB as a Standalone Debugger</a>.</p>\n<p>You can also check out LLDB's fantastic <a href=\"https://lldb.llvm.org/tutorial.html\">manual and tutorial</a>, which will explain more complex debugging scenarios.</p>",
      "title": "Depuração no macOS",
      "description": ""
    },
    "/docs/development/debugging-instructions-macos-xcode": {
      "locale": "pt-BR",
      "slug": "debugging-instructions-macos-xcode",
      "href": "/docs/development/debugging-instructions-macos-xcode",
      "crowdinFileId": "256151",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debugging-instructions-macos-xcode.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h2 id=\"debugging-with-xcode\"><a href=\"#debugging-with-xcode\">Debugging with XCode</a></h2>\n<h3 id=\"generate-xcode-project-for-debugging-sources-cannot-build-code-from-xcode\"><a href=\"#generate-xcode-project-for-debugging-sources-cannot-build-code-from-xcode\">Generate xcode project for debugging sources (cannot build code from xcode)</a></h3>\n<p>Run <code>gn gen</code> with the --ide=xcode argument.</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --ide=xcode\n</code></pre>\n<p>This will generate the electron.ninja.xcworkspace. You will have to open this workspace to set breakpoints and inspect.</p>\n<p>See <code>gn help gen</code> for more information on generating IDE projects with GN.</p>\n<h3 id=\"debugging-and-breakpoints\"><a href=\"#debugging-and-breakpoints\">Debugging and breakpoints</a></h3>\n<p>Launch Electron app after build. You can now open the xcode workspace created above and attach to the Electron process through the Debug > Attach To Process > Electron debug menu. [Note: If you want to debug the renderer process, you need to attach to the Electron Helper as well.]</p>\n<p>You can now set breakpoints in any of the indexed files. However, you will not be able to set breakpoints directly in the Chromium source. To set break points in the Chromium source, you can choose Debug > Breakpoints > Create Symbolic Breakpoint and set any function name as the symbol. This will set the breakpoint for all functions with that name, from all the classes if there are more than one. You can also do this step of setting break points prior to attaching the debugger, however, actual breakpoints for symbolic breakpoint functions may not show up until the debugger is attached to the app.</p>",
      "title": "Debugging with XCode",
      "description": ""
    },
    "/docs/tutorial/debugging-main-process": {
      "locale": "pt-BR",
      "slug": "debugging-main-process",
      "href": "/docs/tutorial/debugging-main-process",
      "crowdinFileId": "256189",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/debugging-main-process.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"o-processo-principal-de-depuração\"><a href=\"#o-processo-principal-de-depuração\">O Processo Principal de Depuração</a></h1>\n<p>O DevTools em uma janela do navegador do Electron, só pode depurar JavaScript que é executado na janela (ex. uma web página). Para depurar JavaScript que é executado no processo principal você precisá usar um depurador externo e fazer o carregamento do Electron com o <code>--inspect</code> ou <code>--inspect-brk</code>.</p>\n<h2 id=\"opções-de-linha-de-comandos\"><a href=\"#opções-de-linha-de-comandos\">Opções de Linha de Comandos</a></h2>\n<p>Use uma das seguintes opções de linha de comando para habilitar a depuração principal processo:</p>\n<h3 id=\"--inspectporta\"><a href=\"#--inspectporta\"><code>--inspect=[porta]</code></a></h3>\n<p>Electron will listen for V8 inspector protocol messages on the specified <code>port</code>, an external debugger will need to connect on this port. The default <code>port</code> is <code>5858</code>.</p>\n<pre><code class=\"hljs language-shell\">electron --inspect=5858 seu/app\n</code></pre>\n<h3 id=\"--inspect-brkporta\"><a href=\"#--inspect-brkporta\"><code>--inspect-brk=[porta]</code></a></h3>\n<p>Como o <code>--inspect</code> mas pausa a execução na primeira linha de JavaScript.</p>\n<h2 id=\"depuradores-externos\"><a href=\"#depuradores-externos\">Depuradores Externos</a></h2>\n<p>Você precisá usar um depurador que suporta o protocolo de inspeção do V8.</p>\n<ul>\n<li>Conecte com o Chrome visitando <code>chrome://inspect</code> e selecionando para inspecionar o Electron app.</li>\n<li><a href=\"/docs/tutorial/debugging-vscode\">Debugging in VSCode</a></li>\n</ul>",
      "title": "O Processo Principal de Depuração",
      "description": ""
    },
    "/docs/tutorial/debugging-vscode": {
      "locale": "pt-BR",
      "slug": "debugging-vscode",
      "href": "/docs/tutorial/debugging-vscode",
      "crowdinFileId": "256191",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/debugging-vscode.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"debugging-in-vscode\"><a href=\"#debugging-in-vscode\">Debugging in VSCode</a></h1>\n<p>Este guia trata de como configurar a depuração usando VSCode tanto para seu próprio projeto no Electron como para código nativo do Electron.</p>\n<h2 id=\"depurando-seu-app-electron\"><a href=\"#depurando-seu-app-electron\">Depurando seu app Electron</a></h2>\n<h3 id=\"processo-principal\"><a href=\"#processo-principal\">Processo principal</a></h3>\n<h4 id=\"1-open-an-electron-project-in-vscode\"><a href=\"#1-open-an-electron-project-in-vscode\">1. Open an Electron project in VSCode.</a></h4>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:electron/electron-quick-start.git\n$ code electron-quick-start\n</code></pre>\n<h4 id=\"2-adicione-um-arquivo-vscodelaunchjson-com-a-seguinte-configuração\"><a href=\"#2-adicione-um-arquivo-vscodelaunchjson-com-a-seguinte-configuração\">2. Adicione um arquivo <code>.vscode/launch.json</code> com a seguinte configuração:</a></h4>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.2.0\"</span>,\n  <span class=\"hljs-attr\">\"configurations\"</span>: [\n    {\n      <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"Debug Main Process\"</span>,\n      <span class=\"hljs-attr\">\"type\"</span>: <span class=\"hljs-string\">\"node\"</span>,\n      <span class=\"hljs-attr\">\"request\"</span>: <span class=\"hljs-string\">\"launch\"</span>,\n      <span class=\"hljs-attr\">\"cwd\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      <span class=\"hljs-attr\">\"runtimeExecutable\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}/node_modules/.bin/electron\"</span>,\n      <span class=\"hljs-attr\">\"windows\"</span>: {\n        <span class=\"hljs-attr\">\"runtimeExecutable\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}/node_modules/.bin/electron.cmd\"</span>\n      },\n      <span class=\"hljs-attr\">\"args\"</span> : [<span class=\"hljs-string\">\".\"</span>],\n      <span class=\"hljs-attr\">\"outputCapture\"</span>: <span class=\"hljs-string\">\"std\"</span>\n    }\n  ]\n}\n</code></pre>\n<h4 id=\"3-debugging\"><a href=\"#3-debugging\">3. Debugging</a></h4>\n<p>Set some breakpoints in <code>main.js</code>, and start debugging in the <a href=\"https://code.visualstudio.com/docs/editor/debugging\">Debug View</a>. You should be able to hit the breakpoints.</p>\n<p>Aqui está um projeto pré-configurado que você pode baixar e depurar diretamente no VSCode: <a href=\"https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start\">https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start</a></p>\n<h2 id=\"debugging-the-electron-codebase\"><a href=\"#debugging-the-electron-codebase\">Debugging the Electron codebase</a></h2>\n<p>If you want to build Electron from source and modify the native Electron codebase, this section will help you in testing your modifications.</p>\n<p>For those unsure where to acquire this code or how to build it, <a href=\"https://github.com/electron/build-tools\">Electron's Build Tools</a> automates and explains most of this process. If you wish to manually set up the environment, you can instead use these <a href=\"/docs/development/build-instructions-gn\">build instructions</a>.</p>\n<h3 id=\"windows-c\"><a href=\"#windows-c\">Windows (C++)</a></h3>\n<h4 id=\"1-open-an-electron-project-in-vscode-1\"><a href=\"#1-open-an-electron-project-in-vscode-1\">1. Open an Electron project in VSCode.</a></h4>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:electron/electron-quick-start.git\n$ code electron-quick-start\n</code></pre>\n<h4 id=\"2-adicione-um-arquivo-vscodelaunchjson-com-a-seguinte-configuração-1\"><a href=\"#2-adicione-um-arquivo-vscodelaunchjson-com-a-seguinte-configuração-1\">2. Adicione um arquivo <code>.vscode/launch.json</code> com a seguinte configuração:</a></h4>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.2.0\"</span>,\n  <span class=\"hljs-attr\">\"configurations\"</span>: [\n    {\n      <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"(Windows) Launch\"</span>,\n      <span class=\"hljs-attr\">\"type\"</span>: <span class=\"hljs-string\">\"cppvsdbg\"</span>,\n      <span class=\"hljs-attr\">\"request\"</span>: <span class=\"hljs-string\">\"launch\"</span>,\n      <span class=\"hljs-attr\">\"program\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\\\\out\\\\your-executable-location\\\\electron.exe\"</span>,\n      <span class=\"hljs-attr\">\"args\"</span>: [<span class=\"hljs-string\">\"your-electron-project-path\"</span>],\n      <span class=\"hljs-attr\">\"stopAtEntry\"</span>: <span class=\"hljs-literal\">false</span>,\n      <span class=\"hljs-attr\">\"cwd\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      <span class=\"hljs-attr\">\"environment\"</span>: [\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_ENABLE_LOGGING\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"true\"</span>},\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_ENABLE_STACK_DUMPING\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"true\"</span>},\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_RUN_AS_NODE\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"\"</span>},\n      ],\n      <span class=\"hljs-attr\">\"externalConsole\"</span>: <span class=\"hljs-literal\">false</span>,\n      <span class=\"hljs-attr\">\"sourceFileMap\"</span>: {\n          <span class=\"hljs-attr\">\"o:\\\\\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      },\n    },\n  ]\n}\n</code></pre>\n<p><strong>Configuration Notes</strong></p>\n<ul>\n<li><code>cppvsdbg</code> requires the <a href=\"https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools\">built-in C/C++ extension</a> be enabled.</li>\n<li><code>${workspaceFolder}</code> is the full path to Chromium's <code>src</code> directory.</li>\n<li><code>your-executable-location</code> will be one of the following depending on a few items:<ul>\n<li><code>Testing</code>: If you are using the default settings of <a href=\"https://github.com/electron/build-tools\">Electron's Build-Tools</a> or the default instructions when <a href=\"/docs/development/build-instructions-gn#building\">building from source</a>.</li>\n<li><code>Release</code>: If you built a Release build rather than a Testing build.</li>\n<li><code>your-directory-name</code>: If you modified this during your build process from the default, this will be whatever you specified.</li>\n</ul></li>\n<li>The <code>args</code> array string <code>\"your-electron-project-path\"</code> should be the absolute path to either the directory or <code>main.js</code> file of the Electron project you are using for testing. In this example, it should be your path to <code>electron-quick-start</code>.</li>\n</ul>\n<h4 id=\"3-debugging-1\"><a href=\"#3-debugging-1\">3. Debugging</a></h4>\n<p>Set some breakpoints in the .cc files of your choosing in the native Electron C++ code, and start debugging in the <a href=\"https://code.visualstudio.com/docs/editor/debugging\">Debug View</a>.</p>",
      "title": "Debugging in VSCode",
      "description": ""
    },
    "/docs/api/desktop-capturer": {
      "locale": "pt-BR",
      "slug": "desktop-capturer",
      "href": "/docs/api/desktop-capturer",
      "crowdinFileId": "256307",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/desktop-capturer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktopcapturer\"><a href=\"#desktopcapturer\">desktopCapturer</a></h1>\n<blockquote>\n<p>Access information about media sources that can be used to capture audio and video from the desktop using the <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> API.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>O exemplo a seguir mostra como capturar vídeo de uma janela desktop com o título <code>Electron</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// No processo renderer.</span>\n<span class=\"hljs-keyword\">const</span> { desktopCapturer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ndesktopCapturer.getSources({ <span class=\"hljs-attr\">types</span>: [<span class=\"hljs-string\">'window'</span>, <span class=\"hljs-string\">'screen'</span>] }).then(<span class=\"hljs-keyword\">async</span> sources => {\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> source <span class=\"hljs-keyword\">of</span> sources) {\n    <span class=\"hljs-keyword\">if</span> (source.name === <span class=\"hljs-string\">'Electron'</span>) {\n      <span class=\"hljs-keyword\">try</span> {\n        <span class=\"hljs-keyword\">const</span> stream = <span class=\"hljs-keyword\">await</span> navigator.mediaDevices.getUserMedia({\n          <span class=\"hljs-attr\">audio</span>: <span class=\"hljs-literal\">false</span>,\n          <span class=\"hljs-attr\">video</span>: {\n            <span class=\"hljs-attr\">mandatory</span>: {\n              <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>,\n              <span class=\"hljs-attr\">chromeMediaSourceId</span>: source.id,\n              <span class=\"hljs-attr\">minWidth</span>: <span class=\"hljs-number\">1280</span>,\n              <span class=\"hljs-attr\">maxWidth</span>: <span class=\"hljs-number\">1280</span>,\n              <span class=\"hljs-attr\">minHeight</span>: <span class=\"hljs-number\">720</span>,\n              <span class=\"hljs-attr\">maxHeight</span>: <span class=\"hljs-number\">720</span>\n            }\n          }\n        })\n        handleStream(stream)\n      } <span class=\"hljs-keyword\">catch</span> (e) {\n        handleError(e)\n      }\n      <span class=\"hljs-keyword\">return</span>\n    }\n  }\n})\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleStream</span> (<span class=\"hljs-params\">stream</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> video = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'video'</span>)\n  video.srcObject = stream\n  video.onloadedmetadata = <span class=\"hljs-function\">(<span class=\"hljs-params\">e</span>) =></span> video.play()\n}\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleError</span> (<span class=\"hljs-params\">e</span>) </span>{\n  <span class=\"hljs-built_in\">console</span>.log(e)\n}\n</code></pre>\n<p>To capture video from a source provided by <code>desktopCapturer</code> the constraints passed to <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> must include <code>chromeMediaSource: 'desktop'</code>, and <code>audio: false</code>.</p>\n<p>To capture both audio and video from the entire desktop the constraints passed to <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> must include <code>chromeMediaSource: 'desktop'</code>, for both <code>audio</code> and <code>video</code>, but should not include a <code>chromeMediaSourceId</code> constraint.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> constraints = {\n  <span class=\"hljs-attr\">audio</span>: {\n    <span class=\"hljs-attr\">mandatory</span>: {\n      <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>\n    }\n  },\n  <span class=\"hljs-attr\">video</span>: {\n    <span class=\"hljs-attr\">mandatory</span>: {\n      <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>\n    }\n  }\n}\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>desktopCapturer</code> tem os seguintes métodos:</p>\n<h3 id=\"desktopcapturergetsourcesoptions\"><a href=\"#desktopcapturergetsourcesoptions\"><code>desktopCapturer.getSources(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>types</code> String[] - Um array de Strings que lista os tipos de área de trabalho a serem capturadas, tipos disponíveis são <code>screen</code> e <code>window</code>.</li>\n<li><code>thumbnailSize</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) - The size that the media source thumbnail should be scaled to. Default is <code>150</code> x <code>150</code>. Set width or height to 0 when you do not need the thumbnails. This will save the processing time required for capturing the content of each window and screen.</li>\n<li><code>fetchWindowIcons</code> Boolean (optional) - Set to true to enable fetching window icons. The default value is false. When false the appIcon property of the sources return null. Same if a source has the type screen.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;DesktopCapturerSource[]></code> - Resolves with an array of <a href=\"/docs/api/structures/desktop-capturer-source\"><code>DesktopCapturerSource</code></a> objects, each <code>DesktopCapturerSource</code> represents a screen or an individual window that can be captured.</p>\n<p><strong>Note</strong> Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher, which can detected by <a href=\"/docs/api/system-preferences#systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><code>systemPreferences.getMediaAccessStatus</code></a>.</p>\n<h2 id=\"caveats\"><a href=\"#caveats\">Caveats</a></h2>\n<p><code>navigator.mediaDevices.getUserMedia</code> does not work on macOS for audio capture due to a fundamental limitation whereby apps that want to access the system's audio require a <a href=\"https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/KernelExtensions/KernelExtensions.html\">signed kernel extension</a>. Chromium, and by extension Electron, does not provide this.</p>\n<p>It is possible to circumvent this limitation by capturing system audio with another macOS app like Soundflower and passing it through a virtual audio input device. This virtual device can then be queried with <code>navigator.mediaDevices.getUserMedia</code>.</p>",
      "title": "desktopCapturer",
      "description": "Access information about media sources that can be used to capture audio and video from the desktop using the navigator.mediaDevices.getUserMedia API."
    },
    "/docs/api/structures/desktop-capturer-source": {
      "locale": "pt-BR",
      "slug": "desktop-capturer-source",
      "href": "/docs/api/structures/desktop-capturer-source",
      "crowdinFileId": "256425",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/desktop-capturer-source.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktopcapturersource-object\"><a href=\"#desktopcapturersource-object\">DesktopCapturerSource Object</a></h1>\n<ul>\n<li><code>id</code> String - The identifier of a window or screen that can be used as a <code>chromeMediaSourceId</code> constraint when calling [<code>navigator.webkitGetUserMedia</code>]. The format of the identifier will be <code>window:XX:YY</code> or <code>screen:ZZ:0</code>. XX is the windowID/handle. YY is 1 for the current process, and 0 for all others. ZZ is a sequential number that represents the screen, and it does not equal to the index in the source's name.</li>\n<li><code>name</code> String - A screen source will be named either <code>Entire Screen</code> or <code>Screen &#x3C;index></code>, while the name of a window source will match the window title.</li>\n<li><code>thumbnail</code> <a href=\"/docs/api/native-image\">NativeImage</a> - A thumbnail image. <strong>Note:</strong> There is no guarantee that the size of the thumbnail is the same as the <code>thumbnailSize</code> specified in the <code>options</code> passed to <code>desktopCapturer.getSources</code>. The actual size depends on the scale of the screen or window.</li>\n<li><code>display_id</code> String - A unique identifier that will correspond to the <code>id</code> of the matching <a href=\"/docs/api/structures/display\">Display</a> returned by the <a href=\"/docs/api/screen\">Screen API</a>. On some platforms, this is equivalent to the <code>XX</code> portion of the <code>id</code> field above and on others it will differ. It will be an empty string if not available.</li>\n<li><code>appIcon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - An icon image of the application that owns the window or null if the source has a type screen. The size of the icon is not known in advance and depends on what the application provides.</li>\n</ul>",
      "title": "DesktopCapturerSource Object",
      "description": ""
    },
    "/docs/tutorial/devices": {
      "locale": "pt-BR",
      "slug": "devices",
      "href": "/docs/tutorial/devices",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/devices.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"device-access\"><a href=\"#device-access\">Device Access</a></h1>\n<p>Like Chromium based browsers, Electron provides access to device hardware through web APIs.  For the most part these APIs work like they do in a browser, but there are some differences that need to be taken into account.  The primary difference between Electron and browsers is what happens when device access is requested.  In a browser, users are presented with a popup where they can grant access to an individual device.  In Electron APIs are provided which can be used by a developer to either automatically pick a device or prompt users to pick a device via a developer created interface.</p>\n<h2 id=\"web-bluetooth-api\"><a href=\"#web-bluetooth-api\">Web Bluetooth API</a></h2>\n<p>The <a href=\"https://web.dev/bluetooth/\">Web Bluetooth API</a> can be used to communicate with bluetooth devices. In order to use this API in Electron, developers will need to handle the <a href=\"/docs/api/web-contents#event-select-bluetooth-device\"><code>select-bluetooth-device</code> event on the webContents</a> associated with the device request.</p>\n<h3 id=\"exemplo\"><a href=\"#exemplo\">Exemplo</a></h3>\n<p>This example demonstrates an Electron application that automatically selects the first available bluetooth device when the <code>Test Bluetooth</code> button is clicked.</p>\n<h2 id=\"webhid-api\"><a href=\"#webhid-api\">WebHID API</a></h2>\n<p>The <a href=\"https://web.dev/hid/\">WebHID API</a> can be used to access HID devices such as keyboards and gamepads.  Electron provides several APIs for working with the WebHID API:</p>\n<ul>\n<li>The <a href=\"/docs/api/session#event-select-hid-device\"><code>select-hid-device</code> event on the Session</a> can be used to select a HID device when a call to <code>navigator.hid.requestDevice</code> is made.  Additionally the <a href=\"/docs/api/session#event-hid-device-added\"><code>hid-device-added</code></a> and <a href=\"/docs/api/session#event-hid-device-removed\"><code>hid-device-removed</code></a> events on the Session can be used to handle devices being plugged in or unplugged during the <code>navigator.hid.requestDevice</code> process.</li>\n<li><a href=\"/docs/api/session#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a> can be used to provide default permissioning to devices without first calling for permission to devices via <code>navigator.hid.requestDevice</code>.  Additionally, the default behavior of Electron is to store granted device permision through the lifetime of the corresponding WebContents.  If longer term storage is needed, a developer can store granted device permissions (eg when handling the <code>select-hid-device</code> event) and then read from that storage with <code>setDevicePermissionHandler</code>.</li>\n<li><a href=\"/docs/api/session#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a> can be used to disable HID access for specific origins.</li>\n</ul>\n<h3 id=\"blocklist\"><a href=\"#blocklist\">Blocklist</a></h3>\n<p>By default Electron employs the same <a href=\"https://github.com/WICG/webhid/blob/main/blocklist.txt\">blocklist</a> used by Chromium.  If you wish to override this behavior, you can do so by setting the <code>disable-hid-blocklist</code> flag:</p>\n<pre><code class=\"hljs language-javascript\">app.commandLine.appendSwitch(<span class=\"hljs-string\">'disable-hid-blocklist'</span>)\n</code></pre>\n<h3 id=\"exemplo-1\"><a href=\"#exemplo-1\">Exemplo</a></h3>\n<p>This example demonstrates an Electron application that automatically selects HID devices through <a href=\"/docs/api/session#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a> and through <a href=\"/docs/api/session#event-select-hid-device\"><code>select-hid-device</code> event on the Session</a> when the <code>Test WebHID</code> button is clicked.</p>\n<h2 id=\"web-serial-api\"><a href=\"#web-serial-api\">Web Serial API</a></h2>\n<p>The <a href=\"https://web.dev/serial/\">Web Serial API</a> can be used to access serial devices that are connected via serial port, USB, or Bluetooth.  In order to use this API in Electron, developers will need to handle the <a href=\"/docs/api/session#event-select-serial-port\"><code>select-serial-port</code> event on the Session</a> associated with the serial port request.</p>\n<p>There are several additional APIs for working with the Web Serial API:</p>\n<ul>\n<li>The <a href=\"/docs/api/session#event-serial-port-added\"><code>serial-port-added</code></a> and <a href=\"/docs/api/session#event-serial-port-removed\"><code>serial-port-removed</code></a> events on the Session can be used to handle devices being plugged in or unplugged during the <code>navigator.serial.requestPort</code> process.</li>\n<li><a href=\"/docs/api/session#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a> can be used to disable serial access for specific origins.</li>\n</ul>\n<h3 id=\"exemplo-2\"><a href=\"#exemplo-2\">Exemplo</a></h3>\n<p>This example demonstrates an Electron application that automatically selects the first available Arduino Uno serial device (if connected) through <a href=\"/docs/api/session#event-select-serial-port\"><code>select-serial-port</code> event on the Session</a> when the <code>Test Web Serial</code> button is clicked.</p>",
      "title": "Device Access",
      "description": ""
    },
    "/docs/tutorial/devtools-extension": {
      "locale": "pt-BR",
      "slug": "devtools-extension",
      "href": "/docs/tutorial/devtools-extension",
      "crowdinFileId": "256195",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/devtools-extension.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"extensão-de-devtools\"><a href=\"#extensão-de-devtools\">Extensão de DevTools</a></h1>\n<p>Electron supports <a href=\"https://developer.chrome.com/extensions/devtools\">Chrome DevTools extensions</a>, which can be used to extend the ability of Chrome's developer tools for debugging popular web frameworks.</p>\n<h2 id=\"loading-a-devtools-extension-with-tooling\"><a href=\"#loading-a-devtools-extension-with-tooling\">Loading a DevTools extension with tooling</a></h2>\n<p>The easiest way to load a DevTools extension is to use third-party tooling to automate the process for you. <a href=\"https://github.com/MarshallOfSound/electron-devtools-installer\">electron-devtools-installer</a> is a popular NPM package that does just that.</p>\n<h2 id=\"manually-loading-a-devtools-extension\"><a href=\"#manually-loading-a-devtools-extension\">Manually loading a DevTools extension</a></h2>\n<p>If you don't want to use the tooling approach, you can also do all of the necessary operations by hand. To load an extension in Electron, you need to download it via Chrome, locate its filesystem path, and then load it into your <a href=\"/docs/api/session\">Session</a> by calling the [<code>ses.loadExtension</code>] API.</p>\n<p>Using the <a href=\"https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi\">React Developer Tools</a> as an example:</p>\n<ol>\n<li>\n<p>Install the extension in Google Chrome.</p>\n</li>\n<li>\n<p>Navigate to <code>chrome://extensions</code>, and find its extension ID, which is a hash string like <code>fmkadmapgofadopljbjfkapdkoienihi</code>.</p>\n</li>\n<li>\n<p>Find out the filesystem location used by Chrome for storing extensions:</p>\n<ul>\n<li>on Windows it is <code>%LOCALAPPDATA%\\Google\\Chrome\\User Data\\Default\\Extensions</code>;</li>\n<li>on Linux it could be:<ul>\n<li><code>~/.config/google-chrome/Default/Extensions/</code></li>\n<li><code>~/.config/google-chrome-beta/Default/Extensions/</code></li>\n<li><code>~/.config/google-chrome-canary/Default/Extensions/</code></li>\n<li><code>~/.config/chromium/Default/Extensions/</code></li>\n</ul></li>\n<li>on macOS it is <code>~/Library/Application Support/Google/Chrome/Default/Extensions</code>.</li>\n</ul>\n</li>\n<li>\n<p>Pass the location of the extension to the <a href=\"/docs/api/session#sesloadextensionpath-options\"><code>ses.loadExtension</code></a> API. For React Developer Tools <code>v4.9.0</code>, it looks something like:</p>\n<pre><code class=\"hljs language-javascript\"> <span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n <span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n\n <span class=\"hljs-comment\">// on macOS</span>\n <span class=\"hljs-keyword\">const</span> reactDevToolsPath = path.join(\n   os.homedir(),\n   <span class=\"hljs-string\">'/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/4.9.0_0'</span>\n )\n\n app.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n   <span class=\"hljs-keyword\">await</span> session.defaultSession.loadExtension(reactDevToolsPath)\n })\n</code></pre>\n</li>\n</ol>\n<p><strong>Notas:</strong></p>\n<ul>\n<li><code>loadExtension</code> returns a Promise with an <a href=\"/docs/api/structures/extension\">Extension object</a>, which contains metadata about the extension that was loaded. This promise needs to resolve (e.g. with an <code>await</code> expression) before loading a page. Otherwise, the extension won't be guaranteed to load.</li>\n<li><code>loadExtension</code> cannot be called before the <code>ready</code> event of the <code>app</code> module is emitted, nor can it be called on in-memory (non-persistent) sessions.</li>\n<li><code>loadExtension</code> must be called on every boot of your app if you want the extension to be loaded.</li>\n</ul>\n<h3 id=\"removing-a-devtools-extension\"><a href=\"#removing-a-devtools-extension\">Removing a DevTools extension</a></h3>\n<p>You can pass the extension's ID to the <a href=\"/docs/api/session#sesremoveextensionextensionid\"><code>ses.removeExtension</code></a> API to remove it from your Session. Loaded extensions are not persisted between app launches.</p>\n<h2 id=\"devtools-extension-support\"><a href=\"#devtools-extension-support\">DevTools extension support</a></h2>\n<p>Electron only supports <a href=\"/docs/api/extensions\">a limited set of <code>chrome.*</code> APIs</a>, so extensions using unsupported <code>chrome.*</code> APIs under the hood may not work.</p>\n<p>The following Devtools extensions have been tested to work in Electron:</p>\n<ul>\n<li><a href=\"https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi\">Ember Inspector</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi\">React Developer Tools</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/backbone-debugger/bhljhndlimiafopmmhjlgfpnnchjjbhd\">Backbone Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/jquery-debugger/dbhhnnnpaeobfddmlalhnehgclcmjimi\">jQuery Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/angularjs-batarang/ighdmehidhipcmcojjgiloacoafjmpfk\">AngularJS Batarang</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd\">Vue.js devtools</a></li>\n<li><a href=\"https://cerebraljs.com/docs/introduction/devtools.html\">Cerebral Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd\">Redux DevTools Extension</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/mobx-developer-tools/pfgnfdagidkfgccljigdamigbcnndkod\">MobX Developer Tools</a></li>\n</ul>\n<h3 id=\"what-should-i-do-if-a-devtools-extension-is-not-working\"><a href=\"#what-should-i-do-if-a-devtools-extension-is-not-working\">What should I do if a DevTools extension is not working?</a></h3>\n<p>First, please make sure the extension is still being maintained and is compatible with the latest version of Google Chrome. We cannot provide additional support for unsupported extensions.</p>\n<p>If the extension works on Chrome but not on Electron, file a bug in Electron's <a href=\"https://github.com/electron/electron/issues\">issue tracker</a> and describe which part of the extension is not working as expected.</p>",
      "title": "Extensão de DevTools",
      "description": ""
    },
    "/docs/api/dialog": {
      "locale": "pt-BR",
      "slug": "dialog",
      "href": "/docs/api/dialog",
      "crowdinFileId": "256309",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/dialog.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dialog\"><a href=\"#dialog\">dialog</a></h1>\n<blockquote>\n<p>Exibe diálogos nativos do sistema para abrir e salvar arquivos, alertas, etc.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>An example of showing a dialog to select multiple files:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(dialog.showOpenDialog({ <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'multiSelections'</span>] }))\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>dialog</code> possúi os seguintes métodos:</p>\n<h3 id=\"dialogshowopendialogsyncbrowserwindow-options-callback\"><a href=\"#dialogshowopendialogsyncbrowserwindow-options-callback\"><code>dialog.showOpenDialogSync([browserWindow, ]options[, callback)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a>)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> String (opcional)</li>\n<li><code>defaultPath</code> String (opcional)</li>\n<li><code>buttonLabel</code> String (opcional) - Rótulo personalizado para o botão de confirmação, quando deixado em branco o label padrão será usado.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (opcional)</li>\n<li><code>properties</code> String[] (optional) - Contains which features the dialog should use. The following values are supported:<ul>\n<li><code>openFile</code> - Permite selecionar arquivos.</li>\n<li><code>openDirectory</code> - Permite selecionar diretórios.</li>\n<li><code>multiSelections</code> - Permite selecionar múltiplos caminhos.</li>\n<li><code>showHiddenFiles</code> - Mostra arquivos escondidos no dialog.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Allow creating new directories from dialog.</li>\n<li><code>promptToCreate</code> <em>Windows</em> - Prompt for creation if the file path entered in the dialog does not exist. Na verdade este valor não cria o arquivo no caminho especificado mas permite que o aplicativo entenda que deverá criar o diretório não existente.</li>\n<li><code>noResolveAliases</code> <em>macOS</em> - Disable the automatic alias (symlink) path resolution. Selected aliases will now return the alias path instead of their target path.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Treat packages, such as <code>.app</code> folders, as a directory instead of a file.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - Do not add the item being opened to the recent documents list.</li>\n</ul></li>\n<li><code>message</code> String (opcional) <em>macOS</em> - Mensagem a ser apresentada acima da janela de entrada.</li>\n<li><code>securityScopedBookmarks</code> Boolean (optional) <em>macOS</em> <em>mas</em> - Create <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmarks</a> when packaged for the Mac App Store.</li>\n</ul></li>\n</ul>\n<p>Returns <code>String[] | undefined</code>, the file paths chosen by the user; if the dialog is cancelled it returns <code>undefined</code>.</p>\n<p>O argumento <code>browserWindow</code> permite que o diálogo seja acoplado a janela parent, tornando-a modal.</p>\n<p>The <code>filters</code> specifies an array of file types that can be displayed or selected when you want to limit the user to a specific type. Como por exemplo:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">filters</span>: [\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Images'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'jpg'</span>, <span class=\"hljs-string\">'png'</span>, <span class=\"hljs-string\">'gif'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Movies'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'mkv'</span>, <span class=\"hljs-string\">'avi'</span>, <span class=\"hljs-string\">'mp4'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Custom File Type'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'as'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'All Files'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'*'</span>] }\n  ]\n}\n</code></pre>\n<p>As array de <code>extensions</code> devem conter extensões sem caracteres-curinga ou pontos. (<code>'png'</code> é bom mas, <code>'.png'</code> e <code>'*.png'</code> são ruins). Para mostrar todos os arquivos use o caracter-curinga <code>*</code> (nenhum ouro caracter-curinga é suportado).</p>\n<p><strong>Nota.:</strong> No Windows e Linux um diálogo aberto não pode ser usado ao mesmo tempo para selecionar arquivos e diretórios, portanto se você estabelecer <code>properties</code> para <code>['openFile', 'openDirectory']</code> nessas plataformas, um seletor de diretório será mostrado.</p>\n<pre><code class=\"hljs language-js\">dialog.showOpenDialogSync(mainWindow, {\n  <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'openDirectory'</span>]\n})\n</code></pre>\n<h3 id=\"dialogshowopendialogbrowserwindow-options-callback\"><a href=\"#dialogshowopendialogbrowserwindow-options-callback\"><code>dialog.showOpenDialog([browserWindow, ]options[, callback)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a>)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> String (opcional)</li>\n<li><code>defaultPath</code> String (opcional)</li>\n<li><code>buttonLabel</code> String (opcional) - Rótulo personalizado para o botão de confirmação, quando deixado em branco o label padrão será usado.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (opcional)</li>\n<li><code>properties</code> String[] (optional) - Contains which features the dialog should use. The following values are supported:<ul>\n<li><code>openFile</code> - Permite selecionar arquivos.</li>\n<li><code>openDirectory</code> - Permite selecionar diretórios.</li>\n<li><code>multiSelections</code> - Permite selecionar múltiplos caminhos.</li>\n<li><code>showHiddenFiles</code> - Mostra arquivos escondidos no dialog.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Allow creating new directories from dialog.</li>\n<li><code>promptToCreate</code> <em>Windows</em> - Prompt for creation if the file path entered in the dialog does not exist. Na verdade este valor não cria o arquivo no caminho especificado mas permite que o aplicativo entenda que deverá criar o diretório não existente.</li>\n<li><code>noResolveAliases</code> <em>macOS</em> - Disable the automatic alias (symlink) path resolution. Selected aliases will now return the alias path instead of their target path.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Treat packages, such as <code>.app</code> folders, as a directory instead of a file.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - Do not add the item being opened to the recent documents list.</li>\n</ul></li>\n<li><code>message</code> String (opcional) <em>macOS</em> - Mensagem a ser apresentada acima da janela de entrada.</li>\n<li><code>securityScopedBookmarks</code> Boolean (optional) <em>macOS</em> <em>mas</em> - Create <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmarks</a> when packaged for the Mac App Store.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Object></code> - Resolve with an object containing the following:</p>\n<ul>\n<li><code>canceled</code> Boolean - whether or not the dialog was canceled.</li>\n<li><code>filePaths</code> String[] - Um array de caminhos de arquivos selecionados pelo usuário. If the dialog is cancelled this will be an empty array.</li>\n<li><code>bookmarks</code> String[] (optional) <em>macOS</em> <em>mas</em> - An array matching the <code>filePaths</code> array of base64 encoded strings which contains security scoped bookmark data. <code>securityScopedBookmarks</code> must be enabled for this to be populated. (For return values, see <a href=\"#bookmarks-array\">table here</a>.)</li>\n</ul>\n<p>O argumento <code>browserWindow</code> permite que o diálogo seja acoplado a janela parent, tornando-a modal.</p>\n<p>The <code>filters</code> specifies an array of file types that can be displayed or selected when you want to limit the user to a specific type. Como por exemplo:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">filters</span>: [\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Images'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'jpg'</span>, <span class=\"hljs-string\">'png'</span>, <span class=\"hljs-string\">'gif'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Movies'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'mkv'</span>, <span class=\"hljs-string\">'avi'</span>, <span class=\"hljs-string\">'mp4'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Custom File Type'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'as'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'All Files'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'*'</span>] }\n  ]\n}\n</code></pre>\n<p>As array de <code>extensions</code> devem conter extensões sem caracteres-curinga ou pontos. (<code>'png'</code> é bom mas, <code>'.png'</code> e <code>'*.png'</code> são ruins). Para mostrar todos os arquivos use o caracter-curinga <code>*</code> (nenhum ouro caracter-curinga é suportado).</p>\n<p><strong>Nota.:</strong> No Windows e Linux um diálogo aberto não pode ser usado ao mesmo tempo para selecionar arquivos e diretórios, portanto se você estabelecer <code>properties</code> para <code>['openFile', 'openDirectory']</code> nessas plataformas, um seletor de diretório será mostrado.</p>\n<pre><code class=\"hljs language-js\">dialog.showOpenDialog(mainWindow, {\n  <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'openDirectory'</span>]\n}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">result</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(result.canceled)\n  <span class=\"hljs-built_in\">console</span>.log(result.filePaths)\n}).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(err)\n})\n</code></pre>\n<h3 id=\"dialogshowsavedialogsyncbrowserwindow-options-callback\"><a href=\"#dialogshowsavedialogsyncbrowserwindow-options-callback\"><code>dialog.showSaveDialogSync([browserWindow, ]options[, callback)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a>)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> String (optional) - The dialog title. Cannot be displayed on some <em>Linux</em> desktop environments.</li>\n<li><code>defaultPath</code> String (opcional) - Caminho absoluto do diretório, caminho absoluto do arquivo, ou o nome do arquivo a ser usado como padrão.</li>\n<li><code>buttonLabel</code> String (opcional) - Rótulo personalizado para o botão de confirmação, quando deixado em branco o label padrão será usado.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (opcional)</li>\n<li><code>message</code> String (opcional) <em>macOS</em> - Mensagem a ser exibida acima de campos de texto.</li>\n<li><code>nameFieldLabel</code> String (opcional) <em>macOS</em> - Rótulo personalizado do texto a ser exibido em frente ao campo do nome do arquivo.</li>\n<li><code>showsTagField</code> Boolean (opcional) <em>macOS</em> - apresenta a tag do campo de entrada, por padrão <code>true</code>.</li>\n<li><code>properties</code> String[] (optional)<ul>\n<li><code>showHiddenFiles</code> - Mostra arquivos escondidos no dialog.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Allow creating new directories from dialog.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Treat packages, such as <code>.app</code> folders, as a directory instead of a file.</li>\n<li><code>showOverwriteConfirmation</code> <em>Linux</em> - Sets whether the user will be presented a confirmation dialog if the user types a file name that already exists.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - Do not add the item being saved to the recent documents list.</li>\n</ul></li>\n<li><code>securityScopedBookmarks</code> Boolean (optional) <em>macOS</em> <em>mas</em> - Create a <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmark</a> when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.</li>\n</ul></li>\n</ul>\n<p>Returns <code>String | undefined</code>, the path of the file chosen by the user; if the dialog is cancelled it returns <code>undefined</code>.</p>\n<p>O argumento <code>browserWindow</code> permite que o diálogo seja acoplado a janela parent, tornando-a modal.</p>\n<p>Os <code>filters</code> especificam um array de tipos de arquivo que podem ser exibidos, veja <code>dialog.ShowOpenDialog</code> para exemplos.</p>\n<h3 id=\"dialogshowsavedialogbrowserwindow-options-callback\"><a href=\"#dialogshowsavedialogbrowserwindow-options-callback\"><code>dialog.showSaveDialog([browserWindow, ]options[, callback)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a>)</li>\n<li><code>options</code> Object<ul>\n<li><code>title</code> String (optional) - The dialog title. Cannot be displayed on some <em>Linux</em> desktop environments.</li>\n<li><code>defaultPath</code> String (opcional) - Caminho absoluto do diretório, caminho absoluto do arquivo, ou o nome do arquivo a ser usado como padrão.</li>\n<li><code>buttonLabel</code> String (opcional) - Rótulo personalizado para o botão de confirmação, quando deixado em branco o label padrão será usado.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (opcional)</li>\n<li><code>message</code> String (opcional) <em>macOS</em> - Mensagem a ser exibida acima de campos de texto.</li>\n<li><code>nameFieldLabel</code> String (opcional) <em>macOS</em> - Rótulo personalizado do texto a ser exibido em frente ao campo do nome do arquivo.</li>\n<li><code>showsTagField</code> Boolean (optional) <em>macOS</em> - Show the tags input box, defaults to <code>true</code>.</li>\n<li><code>properties</code> String[] (optional)<ul>\n<li><code>showHiddenFiles</code> - Mostra arquivos escondidos no dialog.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Allow creating new directories from dialog.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Treat packages, such as <code>.app</code> folders, as a directory instead of a file.</li>\n<li><code>showOverwriteConfirmation</code> <em>Linux</em> - Sets whether the user will be presented a confirmation dialog if the user types a file name that already exists.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - Do not add the item being saved to the recent documents list.</li>\n</ul></li>\n<li><code>securityScopedBookmarks</code> Boolean (optional) <em>macOS</em> <em>mas</em> - Create a <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmark</a> when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Object></code> - Resolve with an object containing the following:</p>\n<ul>\n<li><code>canceled</code> Boolean - whether or not the dialog was canceled.</li>\n<li><code>filePath</code> String (optional) - If the dialog is canceled, this will be <code>undefined</code>.</li>\n<li><code>bookmark</code> String (optional) <em>macOS</em> <em>mas</em> - Base64 encoded string which contains the security scoped bookmark data for the saved file. <code>securityScopedBookmarks</code> must be enabled for this to be present. (For return values, see <a href=\"#bookmarks-array\">table here</a>.)</li>\n</ul>\n<p>O argumento <code>browserWindow</code> permite que o diálogo seja acoplado a janela parent, tornando-a modal.</p>\n<p>Os <code>filters</code> especificam um array de tipos de arquivo que podem ser exibidos, veja <code>dialog.ShowOpenDialog</code> para exemplos.</p>\n<p><strong>Note:</strong> On macOS, using the asynchronous version is recommended to avoid issues when expanding and collapsing the dialog.</p>\n<h3 id=\"dialogshowmessageboxsyncbrowserwindow-options-callback\"><a href=\"#dialogshowmessageboxsyncbrowserwindow-options-callback\"><code>dialog.showMessageBoxSync([browserWindow, ]options[, callback)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a>)</li>\n<li><code>options</code> Object<ul>\n<li><code>message</code> String - Conteúdo da caixa de mensagem.</li>\n<li><code>type</code> String (opcional) - Pode ser <code>\"none\"</code>, <code>\"info\"</code>, <code>\"error\"</code>, <code>\"question\"</code> ou <code>\"warning\"</code>. No Windows, <code>\"question\"</code> exibe o mesmo ícone que <code>\"info\"</code>, a menos que você especifique um ícone usando a opção <code>\"icon\"</code>. No macOS, tanto <code>\"warning\"</code> como <code>\"error\"</code> exibirão o mesmo ícone de alerta.</li>\n<li><code>buttons</code> String[] (optional) - Array of texts for buttons. On Windows, an empty array will result in one button labeled \"OK\".</li>\n<li><code>defaultId</code> Integer (opcional) - Indicador do botão na array de botões que será selecionado como padrão quando a caixa de mensagem abrir.</li>\n<li><code>title</code> String (opcional) - Título da caixa de mensagem, algumas plataformas não o exibirão.</li>\n<li><code>detail</code> String (opcional) - Informações adicionais da mensagem.</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (opcional)</li>\n<li><code>textWidth</code> Integer (optional) <em>macOS</em> - Custom width of the text in the message box.</li>\n<li><code>cancelId</code> Integer (opcional) - O indicador do botão será usado para cancelar o diálogo, por via da tecla <code>Esc</code>. Por padrão é atribuído ao primeiro botão como \"cancelar\" ou \"não\" como rótulos. If no such labeled buttons exist and this option is not set, <code>0</code> will be used as the return value.</li>\n<li><code>noLink</code> Boolean (opcional) - No Windows, o Electron tentará identificar qual dos <code>buttons</code> são botões comuns (como \"cancelar\" ou \"sim\"), e exibir os outros como links de comandos no diálogo. Ele pode fazer o diálogo ser apresentado com o estilo dos aplicativos modernos do Windows. Se você não deseja esse comportamento, você pode definir <code>noLink</code> para <code>true</code>.</li>\n<li><code>normalizeAccessKeys</code> Boolean (opcional) - Normaliza o acesso às teclas do teclado entre as plataformas. Por padrão é <code>false</code>. Ativando-o assume-se que <code>&#x26;</code> é usado nos rótulos dos botões para atribuir a tecla de atalho de acesso do teclado assim os rótulos serão convertidos para que funcionem corretamente em cada plataforma, os caracteres <code>&#x26;</code> são removidos no macOS, convertidos para <code>_</code> no Linux, e deixados intactos no Windows. Por exemplo, um rótulo de botão <code>Vie&#x26;w</code> será convertido para <code>Vie_w</code> no Linux e <code>View</code> no macOS e pode ser selecionado através de <code>Alt-W</code> no Windows e Linux.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code> - the index of the clicked button.</p>\n<p>Shows a message box, it will block the process until the message box is closed. It returns the index of the clicked button.</p>\n<p>O argumento <code>browserWindow</code> permite que o diálogo seja acoplado a janela parent, tornando-a modal. If <code>browserWindow</code> is not shown dialog will not be attached to it. In such case it will be displayed as an independent window.</p>\n<h3 id=\"dialogshowmessageboxbrowserwindow-options-callback\"><a href=\"#dialogshowmessageboxbrowserwindow-options-callback\"><code>dialog.showMessageBox([browserWindow, ]options[, callback)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a>)</li>\n<li><code>options</code> Object<ul>\n<li><code>message</code> String - Conteúdo da caixa de mensagem.</li>\n<li><code>type</code> String (opcional) - Pode ser <code>\"none\"</code>, <code>\"info\"</code>, <code>\"error\"</code>, <code>\"question\"</code> ou <code>\"warning\"</code>. No Windows, <code>\"question\"</code> exibe o mesmo ícone que <code>\"info\"</code>, a menos que você especifique um ícone usando a opção <code>\"icon\"</code>. No macOS, tanto <code>\"warning\"</code> como <code>\"error\"</code> exibirão o mesmo ícone de alerta.</li>\n<li><code>buttons</code> String[] (optional) - Array of texts for buttons. On Windows, an empty array will result in one button labeled \"OK\".</li>\n<li><code>defaultId</code> Integer (opcional) - Indicador do botão na array de botões que será selecionado como padrão quando a caixa de mensagem abrir.</li>\n<li><code>signal</code> AbortSignal (optional) - Pass an instance of <a href=\"https://nodejs.org/api/globals.html#globals_class_abortsignal\">AbortSignal</a> to optionally close the message box, the message box will behave as if it was cancelled by the user. On macOS, <code>signal</code> does not work with message boxes that do not have a parent window, since those message boxes run synchronously due to platform limitations.</li>\n<li><code>title</code> String (opcional) - Título da caixa de mensagem, algumas plataformas não o exibirão.</li>\n<li><code>detail</code> String (opcional) - Informações adicionais da mensagem.</li>\n<li><code>checkboxLabel</code> String (optional) - If provided, the message box will include a checkbox with the given label.</li>\n<li><code>checkboxChecked</code> Boolean (optional) - Initial checked state of the checkbox. <code>false</code> by default.</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> (opcional)</li>\n<li><code>textWidth</code> Integer (optional) <em>macOS</em> - Custom width of the text in the message box.</li>\n<li><code>cancelId</code> Integer (opcional) - O indicador do botão será usado para cancelar o diálogo, por via da tecla <code>Esc</code>. Por padrão é atribuído ao primeiro botão como \"cancelar\" ou \"não\" como rótulos. If no such labeled buttons exist and this option is not set, <code>0</code> will be used as the return value.</li>\n<li><code>noLink</code> Boolean (opcional) - No Windows, o Electron tentará identificar qual dos <code>buttons</code> são botões comuns (como \"cancelar\" ou \"sim\"), e exibir os outros como links de comandos no diálogo. Ele pode fazer o diálogo ser apresentado com o estilo dos aplicativos modernos do Windows. Se você não deseja esse comportamento, você pode definir <code>noLink</code> para <code>true</code>.</li>\n<li><code>normalizeAccessKeys</code> Boolean (opcional) - Normaliza o acesso às teclas do teclado entre as plataformas. Por padrão é <code>false</code>. Ativando-o assume-se que <code>&#x26;</code> é usado nos rótulos dos botões para atribuir a tecla de atalho de acesso do teclado assim os rótulos serão convertidos para que funcionem corretamente em cada plataforma, os caracteres <code>&#x26;</code> são removidos no macOS, convertidos para <code>_</code> no Linux, e deixados intactos no Windows. Por exemplo, um rótulo de botão <code>Vie&#x26;w</code> será convertido para <code>Vie_w</code> no Linux e <code>View</code> no macOS e pode ser selecionado através de <code>Alt-W</code> no Windows e Linux.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Object></code> - resolves with a promise containing the following properties:</p>\n<ul>\n<li><code>response</code> Number - The index of the clicked button.</li>\n<li><code>checkboxChecked</code> Boolean - The checked state of the checkbox if <code>checkboxLabel</code> was set. Otherwise <code>false</code>.</li>\n</ul>\n<p>Shows a message box.</p>\n<p>O argumento <code>browserWindow</code> permite que o diálogo seja acoplado a janela parent, tornando-a modal.</p>\n<h3 id=\"dialogshowerrorboxtitle-content\"><a href=\"#dialogshowerrorboxtitle-content\"><code>dialog.showErrorBox(title, content)</code></a></h3>\n<ul>\n<li><code>title</code> String - O título a ser exibido na caixa de erro.</li>\n<li><code>content</code> String - O conteúdo a ser exibido na caixa de erro.</li>\n</ul>\n<p>Exibe um dialog modal que apresenta uma mensagem de erro.</p>\n<p>Esse API pode ser chamado com segurança antes de que o evento <code>ready</code> que é emitido pelo <code>app</code>, é usado para reportar erros nos estágios iniciais da execução do aplicativo. Se chamado antes do evento <code>ready</code> do aplicativo no Linux, a mensagem será emitida para stderr, e o GUI do dialog não será mostrado.</p>\n<h3 id=\"dialogshowcertificatetrustdialogbrowserwindow-options-macos-windows\"><a href=\"#dialogshowcertificatetrustdialogbrowserwindow-options-macos-windows\"><code>dialog.showCertificateTrustDialog([browserWindow, ]options)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a>)</li>\n<li><code>options</code> Object<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> - O certificado para trust/import.</li>\n<li><code>message</code> String - A mensagem a ser exibida para o usuário.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the certificate trust dialog is shown.</p>\n<p>No macOS, esse método exibe um dialog modal que apresenta uma mensagem e informação de certificado, dando ao usuário a opção de confiar/importar o certificado. Se você fornecer um argumento <code>browserWindow</code> o dialog será acoplado à janela parent, fazendo-a modal.</p>\n<p>No Windows as opções são mais limitadas, devido às API's do Win32 usadas:</p>\n<ul>\n<li>Como o macOS fornece o seu próprio diálogo de confirmação o argumento <code>message</code> não é usado.</li>\n<li>O argumento <code>browserWindow</code> é ignorado já que não é possível fazer essa confirmação um diálogo modal.</li>\n</ul>\n<h2 id=\"bookmarks-array\"><a href=\"#bookmarks-array\">Bookmarks array</a></h2>\n<p><code>showOpenDialog</code>, <code>showOpenDialogSync</code>, <code>showSaveDialog</code>, and <code>showSaveDialogSync</code> will return a <code>bookmarks</code> array.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Build Type</th><th>securityScopedBookmarks boolean</th><th align=\"center\">Return Type</th><th>Return Value</th></tr></thead><tbody><tr><td>macOS mas</td><td>True</td><td align=\"center\">Sucesso</td><td><code>['LONGBOOKMARKSTRING']</code></td></tr><tr><td>macOS mas</td><td>True</td><td align=\"center\">Erro</td><td><code>['']</code> (array of empty string)</td></tr><tr><td>macOS mas</td><td>False</td><td align=\"center\">NA</td><td><code>[]</code> (empty array)</td></tr><tr><td>non mas</td><td>any</td><td align=\"center\">NA</td><td><code>[]</code> (empty array)</td></tr></tbody></table>\n<h2 id=\"sheets\"><a href=\"#sheets\">Sheets</a></h2>\n<p>On macOS, dialogs are presented as sheets attached to a window if you provide a <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> reference in the <code>browserWindow</code> parameter, or modals if no window is provided.</p>\n<p>Você pode chamar <code>BrowserWindow.getCurrentWindow().setSheetOffset (offset)</code>para mudar o offset da janela aonde os diálogos (sheets) estão acoplados.</p>",
      "title": "dialog",
      "description": "Exibe diálogos nativos do sistema para abrir e salvar arquivos, alertas, etc."
    },
    "/docs/api/structures/display": {
      "locale": "pt-BR",
      "slug": "display",
      "href": "/docs/api/structures/display",
      "crowdinFileId": "256427",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/display.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"display-object\"><a href=\"#display-object\">Display Object</a></h1>\n<ul>\n<li><code>id</code> Number - Unique identifier associated with the display.</li>\n<li><code>rotation</code> Number - Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.</li>\n<li><code>scaleFactor</code> Number - Output device's pixel scale factor.</li>\n<li><code>touchSupport</code> String - Can be <code>available</code>, <code>unavailable</code>, <code>unknown</code>.</li>\n<li><code>monochrome</code> Boolean - Whether or not the display is a monochrome display.</li>\n<li><code>accelerometerSupport</code> String - Can be <code>available</code>, <code>unavailable</code>, <code>unknown</code>.</li>\n<li><code>colorSpace</code> String -  represent a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions</li>\n<li><code>colorDepth</code> Number - The number of bits per pixel.</li>\n<li><code>depthPerComponent</code> Number - The number of bits per color component.</li>\n<li><code>displayFrequency</code> Number - The display refresh rate.</li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - the bounds of the display in DIP points.</li>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a></li>\n<li><code>workArea</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - the work area of the display in DIP points.</li>\n<li><code>workAreaSize</code> <a href=\"/docs/api/structures/size\">Size</a></li>\n<li><code>internal</code> Boolean - <code>true</code> for an internal display and <code>false</code> for an external display</li>\n</ul>\n<p>The <code>Display</code> object represents a physical display connected to the system. A fake <code>Display</code> may exist on a headless system, or a <code>Display</code> may correspond to a remote, virtual display.</p>",
      "title": "Display Object",
      "description": ""
    },
    "/docs/api/dock": {
      "locale": "pt-BR",
      "slug": "dock",
      "href": "/docs/api/dock",
      "crowdinFileId": "256311",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/dock.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-dock\"><a href=\"#class-dock\">Class: Dock</a></h2>\n<blockquote>\n<p>Control your app in the macOS dock</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>The following example shows how to bounce your icon on the dock.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.dock.bounce()\n</code></pre>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<h4 id=\"dockbouncetype-macos\"><a href=\"#dockbouncetype-macos\"><code>dock.bounce([type])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>critical</code> or <code>informational</code>. The default is <code>informational</code></li>\n</ul>\n<p>Returns <code>Integer</code> - an ID representing the request.</p>\n<p>When <code>critical</code> is passed, the dock icon will bounce until either the application becomes active or the request is canceled.</p>\n<p>When <code>informational</code> is passed, the dock icon will bounce for one second. However, the request remains active until either the application becomes active or the request is canceled.</p>\n<p><strong>Nota Bene:</strong> This method can only be used while the app is not focused; when the app is focused it will return -1.</p>\n<h4 id=\"dockcancelbounceid-macos\"><a href=\"#dockcancelbounceid-macos\"><code>dock.cancelBounce(id)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>id</code> Inteiro</li>\n</ul>\n<p>Cancel the bounce of <code>id</code>.</p>\n<h4 id=\"dockdownloadfinishedfilepath-no-macos\"><a href=\"#dockdownloadfinishedfilepath-no-macos\"><code>dock.downloadFinished(filePath)</code> no <em>macOS</em></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n</ul>\n<p>Bounces the Downloads stack if the filePath is inside the Downloads folder.</p>\n<h4 id=\"docksetbadgetext-no-macos\"><a href=\"#docksetbadgetext-no-macos\"><code>dock.setBadge(text)</code> no <em>macOS</em></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Sets the string to be displayed in the dock’s badging area.</p>\n<h4 id=\"dockgetbadge-no-macos\"><a href=\"#dockgetbadge-no-macos\"><code>dock.getBadge()</code> no <em>macOS</em></a></h4>\n<p>Returns <code>String</code> - The badge string of the dock.</p>\n<h4 id=\"dockhide-no-macos\"><a href=\"#dockhide-no-macos\"><code>dock.hide()</code> no <em>macOS</em></a></h4>\n<p>Esconde o ícone na Dock.</p>\n<h4 id=\"dockshow-no-macos\"><a href=\"#dockshow-no-macos\"><code>dock.show()</code> no <em>macOS</em></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the dock icon is shown.</p>\n<h4 id=\"dockisvisible-no-macos\"><a href=\"#dockisvisible-no-macos\"><code>dock.isVisible()</code> no <em>macOS</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the dock icon is visible.</p>\n<h4 id=\"docksetmenumenu-no-macos\"><a href=\"#docksetmenumenu-no-macos\"><code>dock.setMenu(menu)</code> no <em>macOS</em></a></h4>\n<ul>\n<li><code>menu</code> <a href=\"/docs/api/menu\">Menu</a></li>\n</ul>\n<p>Sets the application's [dock menu][dock-menu].</p>\n<h4 id=\"dockgetmenu-no-macos\"><a href=\"#dockgetmenu-no-macos\"><code>dock.getMenu()</code> no <em>macOS</em></a></h4>\n<p>Returns <code>Menu | null</code> - The application's [dock menu][dock-menu].</p>\n<h4 id=\"dockseticonimage-no-macos\"><a href=\"#dockseticonimage-no-macos\"><code>dock.setIcon(image)</code> no <em>macOS</em></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>Define a <code>imagem</code> associada com o ícone do dock.</p>",
      "title": "Dock",
      "description": "Control your app in the macOS dock"
    },
    "/docs/api/download-item": {
      "locale": "pt-BR",
      "slug": "download-item",
      "href": "/docs/api/download-item",
      "crowdinFileId": "256313",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/download-item.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-downloaditem\"><a href=\"#class-downloaditem\">Class: DownloadItem</a></h2>\n<blockquote>\n<p>Controla o download de arquivos de fontes remotas.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>DownloadItem</code> is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a> that represents a download item in Electron. É usado no evento <code>will-download</code> da classe <code>Session</code>, e permite aos usuários controlarem o item de download.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// No processo main.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.session.on(<span class=\"hljs-string\">'will-download'</span>, (event, item, webContents) => {\n  <span class=\"hljs-comment\">// Set the save path, making Electron not to prompt a save dialog.</span>\n  item.setSavePath(<span class=\"hljs-string\">'/tmp/save.pdf'</span>)\n\n  item.on(<span class=\"hljs-string\">'updated'</span>, (event, state) => {\n    <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'interrupted'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download is interrupted but can be resumed'</span>)\n    } <span class=\"hljs-keyword\">else</span> <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'progressing'</span>) {\n      <span class=\"hljs-keyword\">if</span> (item.isPaused()) {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download is paused'</span>)\n      } <span class=\"hljs-keyword\">else</span> {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Received bytes: <span class=\"hljs-subst\">${item.getReceivedBytes()}</span>`</span>)\n      }\n    }\n  })\n  item.once(<span class=\"hljs-string\">'done'</span>, (event, state) => {\n    <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'completed'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download successfully'</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Download failed: <span class=\"hljs-subst\">${state}</span>`</span>)\n    }\n  })\n})\n</code></pre>\n<h3 id=\"eventos-de-instância\"><a href=\"#eventos-de-instância\">Eventos de instância</a></h3>\n<h4 id=\"event-updated\"><a href=\"#event-updated\">Event: 'updated'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>state</code> String - Pode ser <code>progressing</code> ou <code>interrupted</code>.</li>\n</ul>\n<p>Emitida quando o download foi atualizado e ainda não terminou.</p>\n<p><code>state</code> pode ser um dos seguintes:</p>\n<ul>\n<li><code>progressing</code> - O download está em andamento.</li>\n<li><code>interrupted</code> - O download foi interrompido e pode ser retomado.</li>\n</ul>\n<h4 id=\"evento-done\"><a href=\"#evento-done\">Evento: 'done'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>state</code> String - Can be <code>completed</code>, <code>cancelled</code> or <code>interrupted</code>.</li>\n</ul>\n<p>Emitted when the download is in a terminal state. This includes a completed download, a cancelled download (via <code>downloadItem.cancel()</code>), and interrupted download that can't be resumed.</p>\n<p><code>state</code> pode ser um dos seguintes:</p>\n<ul>\n<li><code>completed</code> - The download completed successfully.</li>\n<li><code>cancelled</code> - The download has been cancelled.</li>\n<li><code>interrupted</code> - The download has interrupted and can not resume.</li>\n</ul>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<p>The <code>downloadItem</code> object has the following methods:</p>\n<h4 id=\"downloaditemsetsavepathpath\"><a href=\"#downloaditemsetsavepathpath\"><code>downloadItem.setSavePath(path)</code></a></h4>\n<ul>\n<li><code>path</code> String - Set the save file path of the download item.</li>\n</ul>\n<p>The API is only available in session's <code>will-download</code> callback function. If <code>path</code> doesn't exist, Electron will try to make the directory recursively. If user doesn't set the save path via the API, Electron will use the original routine to determine the save path; this usually prompts a save dialog.</p>\n<h4 id=\"downloaditemgetsavepath\"><a href=\"#downloaditemgetsavepath\"><code>downloadItem.getSavePath()</code></a></h4>\n<p>Returns <code>String</code> - The save path of the download item. This will be either the path set via <code>downloadItem.setSavePath(path)</code> or the path selected from the shown save dialog.</p>\n<h4 id=\"downloaditemsetsavedialogoptionsoptions\"><a href=\"#downloaditemsetsavedialogoptionsoptions\"><code>downloadItem.setSaveDialogOptions(options)</code></a></h4>\n<ul>\n<li><code>options</code> SaveDialogOptions - Set the save file dialog options. This object has the same properties as the <code>options</code> parameter of <a href=\"/docs/api/dialog\"><code>dialog.showSaveDialog()</code></a>.</li>\n</ul>\n<p>This API allows the user to set custom options for the save dialog that opens for the download item by default. The API is only available in session's <code>will-download</code> callback function.</p>\n<h4 id=\"downloaditemgetsavedialogoptions\"><a href=\"#downloaditemgetsavedialogoptions\"><code>downloadItem.getSaveDialogOptions()</code></a></h4>\n<p>Returns <code>SaveDialogOptions</code> - Returns the object previously set by <code>downloadItem.setSaveDialogOptions(options)</code>.</p>\n<h4 id=\"downloaditempause\"><a href=\"#downloaditempause\"><code>downloadItem.pause()</code></a></h4>\n<p>Pauses the download.</p>\n<h4 id=\"downloaditemispaused\"><a href=\"#downloaditemispaused\"><code>downloadItem.isPaused()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the download is paused.</p>\n<h4 id=\"downloaditemresume\"><a href=\"#downloaditemresume\"><code>downloadItem.resume()</code></a></h4>\n<p>Resumes the download that has been paused.</p>\n<p><strong>Note:</strong> To enable resumable downloads the server you are downloading from must support range requests and provide both <code>Last-Modified</code> and <code>ETag</code> header values. Otherwise <code>resume()</code> will dismiss previously received bytes and restart the download from the beginning.</p>\n<h4 id=\"downloaditemcanresume\"><a href=\"#downloaditemcanresume\"><code>downloadItem.canResume()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the download can resume.</p>\n<h4 id=\"downloaditemcancel\"><a href=\"#downloaditemcancel\"><code>downloadItem.cancel()</code></a></h4>\n<p>Cancels the download operation.</p>\n<h4 id=\"downloaditemgeturl\"><a href=\"#downloaditemgeturl\"><code>downloadItem.getURL()</code></a></h4>\n<p>Returns <code>String</code> - The origin URL where the item is downloaded from.</p>\n<h4 id=\"downloaditemgetmimetype\"><a href=\"#downloaditemgetmimetype\"><code>downloadItem.getMimeType()</code></a></h4>\n<p>Returns <code>String</code> - The files mime type.</p>\n<h4 id=\"downloaditemhasusergesture\"><a href=\"#downloaditemhasusergesture\"><code>downloadItem.hasUserGesture()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the download has user gesture.</p>\n<h4 id=\"downloaditemgetfilename\"><a href=\"#downloaditemgetfilename\"><code>downloadItem.getFilename()</code></a></h4>\n<p>Returns <code>String</code> - The file name of the download item.</p>\n<p><strong>Note:</strong> The file name is not always the same as the actual one saved in local disk. If user changes the file name in a prompted download saving dialog, the actual name of saved file will be different.</p>\n<h4 id=\"downloaditemgettotalbytes\"><a href=\"#downloaditemgettotalbytes\"><code>downloadItem.getTotalBytes()</code></a></h4>\n<p>Returns <code>Integer</code> - The total size in bytes of the download item.</p>\n<p>If the size is unknown, it returns 0.</p>\n<h4 id=\"downloaditemgetreceivedbytes\"><a href=\"#downloaditemgetreceivedbytes\"><code>downloadItem.getReceivedBytes()</code></a></h4>\n<p>Returns <code>Integer</code> - The received bytes of the download item.</p>\n<h4 id=\"downloaditemgetcontentdisposition\"><a href=\"#downloaditemgetcontentdisposition\"><code>downloadItem.getContentDisposition()</code></a></h4>\n<p>Returns <code>String</code> - The Content-Disposition field from the response header.</p>\n<h4 id=\"downloaditemgetstate\"><a href=\"#downloaditemgetstate\"><code>downloadItem.getState()</code></a></h4>\n<p>Returns <code>String</code> - The current state. Can be <code>progressing</code>, <code>completed</code>, <code>cancelled</code> or <code>interrupted</code>.</p>\n<p><strong>Note:</strong> The following methods are useful specifically to resume a <code>cancelled</code> item when session is restarted.</p>\n<h4 id=\"downloaditemgeturlchain\"><a href=\"#downloaditemgeturlchain\"><code>downloadItem.getURLChain()</code></a></h4>\n<p>Returns <code>String[]</code> - The complete URL chain of the item including any redirects.</p>\n<h4 id=\"downloaditemgetlastmodifiedtime\"><a href=\"#downloaditemgetlastmodifiedtime\"><code>downloadItem.getLastModifiedTime()</code></a></h4>\n<p>Returns <code>String</code> - Last-Modified header value.</p>\n<h4 id=\"downloaditemgetetag\"><a href=\"#downloaditemgetetag\"><code>downloadItem.getETag()</code></a></h4>\n<p>Returns <code>String</code> - ETag header value.</p>\n<h4 id=\"downloaditemgetstarttime\"><a href=\"#downloaditemgetstarttime\"><code>downloadItem.getStartTime()</code></a></h4>\n<p>Returns <code>Double</code> - Number of seconds since the UNIX epoch when the download was started.</p>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<h4 id=\"downloaditemsavepath\"><a href=\"#downloaditemsavepath\"><code>downloadItem.savePath</code></a></h4>\n<p>A <code>String</code> property that determines the save file path of the download item.</p>\n<p>The property is only available in session's <code>will-download</code> callback function. If user doesn't set the save path via the property, Electron will use the original routine to determine the save path; this usually prompts a save dialog.</p>",
      "title": "DownloadItem",
      "description": "Controla o download de arquivos de fontes remotas."
    },
    "/docs/tutorial/electron-timelines": {
      "locale": "pt-BR",
      "slug": "electron-timelines",
      "href": "/docs/tutorial/electron-timelines",
      "crowdinFileId": "256197",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/electron-timelines.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"linha-do-tempo-das-versões-do-electron\"><a href=\"#linha-do-tempo-das-versões-do-electron\">Linha do tempo das versões do Electron</a></h1>\n<p>Special notes:</p>\n<ul>\n<li>The <code>-beta.1</code> and <code>stable</code> dates are our solid release dates.</li>\n<li>We strive for weekly beta releases, however we often release more betas than scheduled.</li>\n<li>All dates are our goals but there may be reasons for adjusting the stable deadline, such as security bugs.</li>\n<li>Take a look at the <a href=\"https://electronjs.org/blog/electron-5-0-timeline\">5.0.0 Timeline blog post</a> for info about publicizing our release dates.</li>\n<li>Since Electron 6.0, we've been targeting every other Chromium version and releasing our stable on the same day as Chrome stable. You can reference Chromium's release schedule <a href=\"https://chromiumdash.appspot.com/schedule\">here</a>. See <a href=\"https://www.electronjs.org/blog/12-week-cadence\">Electron's new release cadence blog post</a> for more details on our release schedule.</li>\n<li>Electron 15.0 only will include a special Alpha release. Starting in Electron 16.0, we will release on an 8-week cadence. See <a href=\"https://www.electronjs.org/blog/8-week-cadence\">Electron's new 8-week cadence blog post</a> for more details.</li>\n</ul>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Electron</th><th>Alfa</th><th>Beta</th><th>Stable</th><th>Chrome</th><th>Nó</th></tr></thead><tbody><tr><td>2.0.0</td><td>--</td><td>2018-Feb-21</td><td>2018-May-01</td><td>M61</td><td>v8.9</td></tr><tr><td>3.0.0</td><td>--</td><td>2018-Jun-21</td><td>2018-Sep-18</td><td>M66</td><td>v10.2</td></tr><tr><td>4.0.0</td><td>--</td><td>2018-Oct-11</td><td>2018-Dec-20</td><td>M69</td><td>v10.11</td></tr><tr><td>5.0.0</td><td>--</td><td>2019-Jan-22</td><td>2019-Apr-24</td><td>M73</td><td>v12.0</td></tr><tr><td>6.0.0</td><td>--</td><td>2019-May-01</td><td>2019-Jul-30</td><td>M76</td><td>v12.4</td></tr><tr><td>7.0.0</td><td>--</td><td>2019-Aug-01</td><td>2019-Oct-22</td><td>M78</td><td>v12.8</td></tr><tr><td>8.0.0</td><td>--</td><td>2019-Oct-24</td><td>2020-Feb-04</td><td>M80</td><td>v12.13</td></tr><tr><td>9.0.0</td><td>--</td><td>2020-Feb-06</td><td>2020-May-19</td><td>M83</td><td>v12.14</td></tr><tr><td>10.0.0</td><td>--</td><td>2020-May-21</td><td>2020-Aug-25</td><td>M85</td><td>v12.16</td></tr><tr><td>11.0.0</td><td>--</td><td>2020-Aug-27</td><td>2020-Nov-17</td><td>M87</td><td>v12.18</td></tr><tr><td>12.0.0</td><td>--</td><td>2020-Nov-19</td><td>2021-Mar-02</td><td>M89</td><td>v14.16</td></tr><tr><td>13.0.0</td><td>--</td><td>2021-Mar-04</td><td>2021-May-25</td><td>M91</td><td>v14.16</td></tr><tr><td>14.0.0</td><td>--</td><td>2021-May-27</td><td>2021-Aug-31</td><td>M93</td><td>v14.17</td></tr><tr><td>15.0.0</td><td>2021-Jul-20</td><td>2021-Sep-01</td><td>2021-Sep-21</td><td>M94</td><td>v16.5</td></tr><tr><td>16.0.0</td><td>--</td><td>2021-Sep-23</td><td>2021-Nov-16</td><td>M96</td><td>TBD</td></tr></tbody></table>",
      "title": "Linha do tempo das versões do Electron",
      "description": ""
    },
    "/docs/tutorial/electron-versioning": {
      "locale": "pt-BR",
      "slug": "electron-versioning",
      "href": "/docs/tutorial/electron-versioning",
      "crowdinFileId": "256199",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/electron-versioning.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"versionamento-do-electron\"><a href=\"#versionamento-do-electron\">Versionamento do Electron</a></h1>\n<blockquote>\n<p>Uma visão detalhada da nossa política de versionamento e implementação.</p>\n</blockquote>\n<p>As of version 2.0.0, Electron follows <a href=\"#semver\">SemVer</a>. The following command will install the most recent stable build of Electron:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron\n</code></pre>\n<p>Para atualizar a versão do Electron de um projeto existente para a versão mais recente, use:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron@latest\n</code></pre>\n<h2 id=\"versão-1x\"><a href=\"#versão-1x\">Versão 1.x</a></h2>\n<p>Electron versions <em>&#x3C; 2.0</em> did not conform to the <a href=\"https://semver.org\">SemVer</a> spec: major versions corresponded to end-user API changes, minor versions corresponded to Chromium major releases, and patch versions corresponded to new features and bug fixes. Por mais que isso seja conveniente para que desenvolvedores do Electron mesclassem funcionalidades, isso cria problemas para desenvolvedores de aplicativos para o usuário final. Os ciclos de testes de QA de grandes aplicativos como Slack, Stride, Teams, Skype, VS Code, Atom e Desktop podem se tornar demorados, e a estabilidade é um resultado bastante desejado. Existe um alto risco ao se adotar novas funcionalidades ao mesmo tempo em que se tenta absorver correções de bugs.</p>\n<p>Aqui está um exemplo da estratégia da era 1.x:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-0.png\" alt=\"1.x Versioning\"></p>\n<p>Um app desenvolvido com o Electron versão <code>1.8.1</code> não pode receber as correções de bugs da <code>1.8.3</code> sem antes ter que ou absorver a funcionalidade da <code>1.8.2</code> ou fazer o backport das correções e manter uma nova linha de lançamento.</p>\n<h2 id=\"versão-20-em-diante\"><a href=\"#versão-20-em-diante\">Versão 2.0 em diante</a></h2>\n<p>There are several major changes from our 1.x strategy outlined below. Each change is intended to satisfy the needs and priorities of developers/maintainers and app developers.</p>\n<ol>\n<li>Strict use of SemVer</li>\n<li>Uso de tags <code>-beta</code> em conformidade com o semver</li>\n<li>Uso de <a href=\"https://conventionalcommits.org/\">mensagens de commit convencionais</a></li>\n<li>Branches de estabilização bem definidas</li>\n<li>A branch <code>master</code> não tem versão - apenas as branches de estabilização contêm informações de versão</li>\n</ol>\n<p>Explicaremos em detalhes como funcionam o esquema de branches do git, o esquema de tags do npm, o que desenvolvedores devem esperar ver e como é possível fazer o backport de alterações.</p>\n<h1 id=\"semver\"><a href=\"#semver\">SemVer</a></h1>\n<p>From 2.0 onward, Electron will follow SemVer.</p>\n<p>Below is a table explicitly mapping types of changes to their corresponding category of SemVer (e.g. Major, Minor, Patch).</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Major Version Increments</th><th>Minor Version Increments</th><th>Patch Version Increments</th></tr></thead><tbody><tr><td>Electron breaking API changes</td><td>Electron non-breaking API changes</td><td>Electron bug fixes</td></tr><tr><td>Node.js major version updates</td><td>Node.js minor version updates</td><td>Node.js patch version updates</td></tr><tr><td>Chromium version updates</td><td></td><td>fix-related chromium patches</td></tr></tbody></table>\n<p>Note that most Chromium updates will be considered breaking. Fixes that can be backported will likely be cherry-picked as patches.</p>\n<h1 id=\"estabilizando-branches\"><a href=\"#estabilizando-branches\">Estabilizando Branches</a></h1>\n<p>Stabilization branches are branches that run parallel to master, taking in only cherry-picked commits that are related to security or stability. These branches are never merged back to master.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-1.png\" alt=\"Estabilizando Branches\"></p>\n<p>Since Electron 8, stabilization branches are always <strong>major</strong> version lines, and named against the following template <code>$MAJOR-x-y</code> e.g. <code>8-x-y</code>.  Prior to that we used <strong>minor</strong> version lines and named them as <code>$MAJOR-$MINOR-x</code> e.g. <code>2-0-x</code></p>\n<p>We allow for multiple stabilization branches to exist simultaneously, and intend to support at least two in parallel at all times, backporting security fixes as necessary. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-2.png\" alt=\"Multiple Stability Branches\"></p>\n<p>Older lines will not be supported by GitHub, but other groups can take ownership and backport stability and security fixes on their own. We discourage this, but recognize that it makes life easier for many app developers.</p>\n<h1 id=\"versões-betas-e-correções-de-bugs\"><a href=\"#versões-betas-e-correções-de-bugs\">Versões Betas e Correções de Bugs</a></h1>\n<p>Developers want to know which releases are <em>safe</em> to use. Even seemingly innocent features can introduce regressions in complex applications. At the same time, locking to a fixed version is dangerous because you’re ignoring security patches and bug fixes that may have come out since your version. Our goal is to allow the following standard semver ranges in <code>package.json</code> :</p>\n<ul>\n<li>Use <code>~2.0.0</code> to admit only stability or security related fixes to your <code>2.0.0</code> release.</li>\n<li>Use <code>^2.0.0</code> to admit non-breaking <em>reasonably stable</em> feature work as well as security and bug fixes.</li>\n</ul>\n<p>What’s important about the second point is that apps using <code>^</code> should still be able to expect a reasonable level of stability. To accomplish this, SemVer allows for a <em>pre-release identifier</em> to indicate a particular version is not yet <em>safe</em> or <em>stable</em>.</p>\n<p>Whatever you choose, you will periodically have to bump the version in your <code>package.json</code> as breaking changes are a fact of Chromium life.</p>\n<p>The process is as follows:</p>\n<ol>\n<li>All new major and minor releases lines begin with a beta series indicated by SemVer prerelease tags of <code>beta.N</code>, e.g. <code>2.0.0-beta.1</code>. After the first beta, subsequent beta releases must meet all of the following conditions:<ol>\n<li>The change is backwards API-compatible (deprecations are allowed)</li>\n<li>The risk to meeting our stability timeline must be low.</li>\n</ol></li>\n<li>If allowed changes need to be made once a release is beta, they are applied and the prerelease tag is incremented, e.g. <code>2.0.0-beta.2</code>.</li>\n<li>If a particular beta release is <em>generally regarded</em> as stable, it will be re-released as a stable build, changing only the version information. e.g. <code>2.0.0</code>. After the first stable, all changes must be backwards-compatible bug or security fixes.</li>\n<li>If future bug fixes or security patches need to be made once a release is stable, they are applied and the <em>patch</em> version is incremented e.g. <code>2.0.1</code>.</li>\n</ol>\n<p>Specifically, the above means:</p>\n<ol>\n<li>Admitting non-breaking-API changes before Week 3 in the beta cycle is okay, even if those changes have the potential to cause moderate side-effects.</li>\n<li>Admitting feature-flagged changes, that do not otherwise alter existing code paths, at most points in the beta cycle is okay. Users can explicitly enable those flags in their apps.</li>\n<li>Admitting features of any sort after Week 3 in the beta cycle is 👎 without a very good reason.</li>\n</ol>\n<p>For each major and minor bump, you should expect to see something like the following:</p>\n<pre><code class=\"hljs language-plaintext\">2.0.0-beta.1\n2.0.0-beta.2\n2.0.0-beta.3\n2.0.0\n2.0.1\n2.0.2\n</code></pre>\n<p>An example lifecycle in pictures:</p>\n<ul>\n<li>A new release branch is created that includes the latest set of features. It is published as <code>2.0.0-beta.1</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-3.png\" alt=\"New Release Branch\"></li>\n<li>A bug fix comes into master that can be backported to the release branch. The patch is applied, and a new beta is published as <code>2.0.0-beta.2</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-4.png\" alt=\"Bugfix Backport to Beta\"></li>\n<li>The beta is considered <em>generally stable</em> and it is published again as a non-beta under <code>2.0.0</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-5.png\" alt=\"Beta to Stable\"></li>\n<li>Later, a zero-day exploit is revealed and a fix is applied to master. We backport the fix to the <code>2-0-x</code> line and release <code>2.0.1</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-6.png\" alt=\"Security Backports\"></li>\n</ul>\n<p>A few examples of how various SemVer ranges will pick up new releases:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-7.png\" alt=\"Semvers and Releases\"></p>\n<h1 id=\"missing-features-alphas\"><a href=\"#missing-features-alphas\">Missing Features: Alphas</a></h1>\n<p>Our strategy has a few tradeoffs, which for now we feel are appropriate. Most importantly that new features in master may take a while before reaching a stable release line. If you want to try a new feature immediately, you will have to build Electron yourself.</p>\n<p>As a future consideration, we may introduce one or both of the following:</p>\n<ul>\n<li>alpha releases that have looser stability constraints to betas; for example it would be allowable to admit new features while a stability channel is in <em>alpha</em></li>\n</ul>\n<h1 id=\"feature-flags\"><a href=\"#feature-flags\">Feature Flags</a></h1>\n<p>Feature flags are a common practice in Chromium, and are well-established in the web-development ecosystem. In the context of Electron, a feature flag or <strong>soft branch</strong> must have the following properties:</p>\n<ul>\n<li>it is enabled/disabled either at runtime, or build-time; we do not support the concept of a request-scoped feature flag</li>\n<li>it completely segments new and old code paths; refactoring old code to support a new feature <em>violates</em> the feature-flag contract</li>\n<li>feature flags are eventually removed after the feature is released</li>\n</ul>\n<h1 id=\"semantic-commits\"><a href=\"#semantic-commits\">Semantic Commits</a></h1>\n<p>We seek to increase clarity at all levels of the update and releases process. Starting with <code>2.0.0</code> we will require pull requests adhere to the <a href=\"https://conventionalcommits.org/\">Conventional Commits</a> spec, which can be summarized as follows:</p>\n<ul>\n<li>\n<p>Commits that would result in a SemVer <strong>major</strong> bump must start their body with <code>BREAKING CHANGE:</code>.</p>\n</li>\n<li>\n<p>Commits that would result in a SemVer <strong>minor</strong> bump must start with <code>feat:</code>.</p>\n</li>\n<li>\n<p>Commits that would result in a SemVer <strong>patch</strong> bump must start with <code>fix:</code>.</p>\n</li>\n<li>\n<p>We allow squashing of commits, provided that the squashed message adheres to the above message format.</p>\n</li>\n<li>\n<p>It is acceptable for some commits in a pull request to not include a semantic prefix, as long as the pull request title contains a meaningful encompassing semantic message.</p>\n</li>\n</ul>\n<h1 id=\"versioned-master\"><a href=\"#versioned-master\">Versioned <code>master</code></a></h1>\n<ul>\n<li>The <code>master</code> branch will always contain the next major version <code>X.0.0-nightly.DATE</code> in its <code>package.json</code></li>\n<li>Release branches are never merged back to master</li>\n<li>Release branches <em>do</em> contain the correct version in their <code>package.json</code></li>\n<li>As soon as a release branch is cut for a major, master must be bumped to the next major.  I.e. <code>master</code> is always versioned as the next theoretical release branch</li>\n</ul>",
      "title": "Versionamento do Electron",
      "description": "Uma visão detalhada da nossa política de versionamento e implementação."
    },
    "/docs/development/electron-vs-nwjs": {
      "locale": "pt-BR",
      "slug": "electron-vs-nwjs",
      "href": "/docs/development/electron-vs-nwjs",
      "crowdinFileId": "256155",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/electron-vs-nwjs.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"technical-differences-between-electron-and-nwjs\"><a href=\"#technical-differences-between-electron-and-nwjs\">Technical Differences Between Electron and NW.js</a></h1>\n<p>Like <a href=\"https://nwjs.io/\">NW.js</a>, Electron provides a platform to write desktop applications with web technologies. Both platforms enable developers to utilize HTML, JavaScript, and Node.js. On the surface, they seem very similar.</p>\n<p>There are however fundamental differences between the two projects that make Electron a completely separate product from NW.js.</p>\n<h2 id=\"1-entry-of-application\"><a href=\"#1-entry-of-application\">1) Entry of Application</a></h2>\n<p>In NW.js, the main entry point of an application can be an HTML web page. In that case, NW.js will open the given entry point in a browser window.</p>\n<p>In Electron, the entry point is always a JavaScript script. Instead of providing a URL directly, you manually create a browser window and load an HTML file using the API. You also need to listen to window events to decide when to quit the application.</p>\n<p>Electron works more like the Node.js runtime. Electron's APIs are lower level so you can use it for browser testing in place of <a href=\"https://phantomjs.org/\">PhantomJS</a>.</p>\n<h2 id=\"2-node-integration\"><a href=\"#2-node-integration\">2) Node Integration</a></h2>\n<p>In NW.js, the Node integration in web pages requires patching Chromium to work, while in Electron we chose a different way to integrate the <code>libuv</code> loop with each platform's message loop to avoid hacking Chromium. Veja o código do <a href=\"https://github.com/electron/electron/tree/main/lib/common\"><code>node_bindings</code></a> para saber como foi feito.</p>\n<h2 id=\"3-javascript-contexts\"><a href=\"#3-javascript-contexts\">3) JavaScript Contexts</a></h2>\n<p>If you are an experienced NW.js user, you should be familiar with the concept of Node context and web context. These concepts were invented because of how NW.js was implemented.</p>\n<p>By using the <a href=\"https://github.com/nodejs/node-v0.x-archive/commit/756b622\">multi-context</a> feature of Node, Electron doesn't introduce a new JavaScript context in web pages.</p>\n<p>Nota: Múltiplos contextos são opcionais no NW.js desde da versão 0.13.</p>\n<h2 id=\"4-legacy-support\"><a href=\"#4-legacy-support\">4) Legacy Support</a></h2>\n<p>NW.js still offers a \"legacy release\" that supports Windows XP. It doesn't receive security updates.</p>\n<p>Given that hardware manufacturers, Microsoft, Chromium, and Node.js haven't released even critical security updates for that system, we have to warn you that using Windows XP is wildly insecure and outright irresponsible.</p>\n<p>However, we understand that requirements outside our wildest imagination may exist, so if you're looking for something like Electron that runs on Windows XP, the NW.js legacy release might be the right fit for you.</p>\n<h2 id=\"5-features\"><a href=\"#5-features\">5) Features</a></h2>\n<p>There are numerous differences in the amount of supported features. Electron has a bigger community, more production apps using it, and <a href=\"https://www.npmjs.com/search?q=electron\">a large amount of userland modules available on npm</a>.</p>\n<p>As an example, Electron has built-in support for automatic updates and countless tools that make the creation of installers easier. As an example in favor of NW.js, NW.js supports more <code>Chrome.*</code> APIs for the development of Chrome Apps.</p>\n<p>Naturally, we believe that Electron is the better platform for polished production applications built with web technologies (like Visual Studio Code, Slack, or Facebook Messenger); however, we want to be fair to our web technology friends. If you have feature needs that Electron does not meet, you might want to try NW.js.</p>",
      "title": "Technical Differences Between Electron and NW.js",
      "description": ""
    },
    "/docs/api/environment-variables": {
      "locale": "pt-BR",
      "slug": "environment-variables",
      "href": "/docs/api/environment-variables",
      "crowdinFileId": "256315",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/environment-variables.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"variáveis-de-ambiente\"><a href=\"#variáveis-de-ambiente\">Variáveis de Ambiente</a></h1>\n<blockquote>\n<p>Controle configurações e comportamento de aplicações sem mudar o código.</p>\n</blockquote>\n<p>Certos comportamentos do Electron são controlados por variáveis de ambientes porque são inicializados antes que as flags da linha de comando e o código da aplicação.</p>\n<p>Exemplo de shell POSIX:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">export</span> ELECTRON_ENABLE_LOGGING=<span class=\"hljs-literal\">true</span>\n$ electron\n</code></pre>\n<p>Exemplo de console do Windows:</p>\n<pre><code class=\"hljs language-powershell\">> set ELECTRON_ENABLE_LOGGING=true\n> electron\n</code></pre>\n<h2 id=\"production-variables\"><a href=\"#production-variables\">Production Variables</a></h2>\n<p>The following environment variables are intended primarily for use at runtime in packaged Electron applications.</p>\n<h3 id=\"node_options\"><a href=\"#node_options\"><code>NODE_OPTIONS</code></a></h3>\n<p>Electron includes support for a subset of Node's <a href=\"https://nodejs.org/api/cli.html#cli_node_options_options\"><code>NODE_OPTIONS</code></a>. The majority are supported with the exception of those which conflict with Chromium's use of BoringSSL.</p>\n<p>Exemplo:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">export</span> NODE_OPTIONS=<span class=\"hljs-string\">\"--no-warnings --max-old-space-size=2048\"</span>\n</code></pre>\n<p>Unsupported options are:</p>\n<pre><code class=\"hljs language-sh\">--use-bundled-ca\n--force-fips\n--<span class=\"hljs-built_in\">enable</span>-fips\n--openssl-config\n--use-openssl-ca\n</code></pre>\n<p><code>NODE_OPTIONS</code> are explicitly disallowed in packaged apps, except for the following:</p>\n<pre><code class=\"hljs language-sh\">--max-http-header-size\n--http-parser\n</code></pre>\n<h3 id=\"google_api_key\"><a href=\"#google_api_key\"><code>GOOGLE_API_KEY</code></a></h3>\n<p>Geolocation support in Electron requires the use of Google Cloud Platform's geolocation webservice. To enable this feature, acquire a <a href=\"https://developers.google.com/maps/documentation/geolocation/get-api-key\">Google API key</a> and place the following code in your main process file, before opening any browser windows that will make geolocation requests:</p>\n<pre><code class=\"hljs language-javascript\">process.env.GOOGLE_API_KEY = <span class=\"hljs-string\">'YOUR_KEY_HERE'</span>\n</code></pre>\n<p>By default, a newly generated Google API key may not be allowed to make geolocation requests. To enable the geolocation webservice for your project, enable it through the <a href=\"https://console.cloud.google.com/apis/library\">API library</a>.</p>\n<p>N.B. You will need to add a <a href=\"https://cloud.google.com/billing/docs/how-to/payment-methods#add_a_payment_method\">Billing Account</a> to the project associated to the API key for the geolocation webservice to work.</p>\n<h3 id=\"electron_no_asar\"><a href=\"#electron_no_asar\"><code>ELECTRON_NO_ASAR</code></a></h3>\n<p>Disables ASAR support. This variable is only supported in forked child processes and spawned child processes that set <code>ELECTRON_RUN_AS_NODE</code>.</p>\n<h3 id=\"electron_run_as_node\"><a href=\"#electron_run_as_node\"><code>ELECTRON_RUN_AS_NODE</code></a></h3>\n<p>Starts the process as a normal Node.js process.</p>\n<p>In this mode, you will be able to pass <a href=\"https://nodejs.org/api/cli.html\">cli options</a> to Node.js as you would when running the normal Node.js executable, with the exception of the following flags:</p>\n<ul>\n<li>\"--openssl-config\"</li>\n<li>\"--use-bundled-ca\"</li>\n<li>\"--use-openssl-ca\",</li>\n<li>\"--force-fips\"</li>\n<li>\"--enable-fips\"</li>\n</ul>\n<p>These flags are disabled owing to the fact that Electron uses BoringSSL instead of OpenSSL when building Node.js' <code>crypto</code> module, and so will not work as designed.</p>\n<h3 id=\"electron_no_attach_console-windows\"><a href=\"#electron_no_attach_console-windows\"><code>ELECTRON_NO_ATTACH_CONSOLE</code> <em>Windows</em></a></h3>\n<p>Don't attach to the current console session.</p>\n<h3 id=\"electron_force_window_menu_bar-linux\"><a href=\"#electron_force_window_menu_bar-linux\"><code>ELECTRON_FORCE_WINDOW_MENU_BAR</code> <em>Linux</em></a></h3>\n<p>Don't use the global menu bar on Linux.</p>\n<h3 id=\"electron_trash-linux\"><a href=\"#electron_trash-linux\"><code>ELECTRON_TRASH</code> <em>Linux</em></a></h3>\n<p>Set the trash implementation on Linux. Por padrão é <code>gio</code>.</p>\n<p>Opções:</p>\n<ul>\n<li><code>gvfs-trash</code></li>\n<li><code>trash-cli</code></li>\n<li><code>kioclient5</code></li>\n<li><code>kioclient</code></li>\n</ul>\n<h2 id=\"variáveis-de-desenvolvimento\"><a href=\"#variáveis-de-desenvolvimento\">Variáveis de desenvolvimento</a></h2>\n<p>As seguintes variáveis de ambiente são destinadas principalmente para fins de depuração e desenvolvimento.</p>\n<h3 id=\"electron_enable_logging\"><a href=\"#electron_enable_logging\"><code>ELECTRON_ENABLE_LOGGING</code></a></h3>\n<p>Prints Chromium's internal logging to the console.</p>\n<p>Setting this variable is the same as passing <code>--enable-logging</code> on the command line. For more info, see <code>--enable-logging</code> in <a href=\"/docs/api/command-line-switches#enable-loggingfile\">command-line switches</a>.</p>\n<h3 id=\"electron_log_file\"><a href=\"#electron_log_file\"><code>ELECTRON_LOG_FILE</code></a></h3>\n<p>Sets the file destination for Chromium's internal logging.</p>\n<p>Setting this variable is the same as passing <code>--log-file</code> on the command line. For more info, see <code>--log-file</code> in <a href=\"/docs/api/command-line-switches#log-filepath\">command-line switches</a>.</p>\n<h3 id=\"electron_debug_drag_regions\"><a href=\"#electron_debug_drag_regions\"><code>ELECTRON_DEBUG_DRAG_REGIONS</code></a></h3>\n<p>Adds coloration to draggable regions on <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>s on macOS - draggable regions will be colored green and non-draggable regions will be colored red to aid debugging.</p>\n<h3 id=\"electron_debug_notifications\"><a href=\"#electron_debug_notifications\"><code>ELECTRON_DEBUG_NOTIFICATIONS</code></a></h3>\n<p>Adds extra logs to <a href=\"/docs/api/notification\"><code>Notification</code></a> lifecycles on macOS to aid in debugging. Extra logging will be displayed when new Notifications are created or activated. They will also be displayed when common a tions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.</p>\n<p>Sample output:</p>\n<pre><code class=\"hljs language-sh\">Notification created (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification displayed (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification activated (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification replied to (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\n</code></pre>\n<h3 id=\"electron_log_asar_reads\"><a href=\"#electron_log_asar_reads\"><code>ELECTRON_LOG_ASAR_READS</code></a></h3>\n<p>When Electron reads from an ASAR file, log the read offset and file path to the system <code>tmpdir</code>. The resulting file can be provided to the ASAR module to optimize file ordering.</p>\n<h3 id=\"electron_enable_stack_dumping\"><a href=\"#electron_enable_stack_dumping\"><code>ELECTRON_ENABLE_STACK_DUMPING</code></a></h3>\n<p>Imprime o rastreamento da pilha para o console quando o Electron trava.</p>\n<p>Essa variável de ambiente não funcionará se o <code>crashReporter</code> tiver iniciado.</p>\n<h3 id=\"electron_default_error_mode-windows\"><a href=\"#electron_default_error_mode-windows\"><code>ELECTRON_DEFAULT_ERROR_MODE</code> <em>Windows</em></a></h3>\n<p>Mostra a caixa de diálogo de travamento do Windows quando o Electron trava.</p>\n<p>Essa variável de ambiente não funcionará se o <code>crashReporter</code> tiver iniciado.</p>\n<h3 id=\"electron_override_dist_path\"><a href=\"#electron_override_dist_path\"><code>ELECTRON_OVERRIDE_DIST_PATH</code></a></h3>\n<p>When running from the <code>electron</code> package, this variable tells the <code>electron</code> command to use the specified build of Electron instead of the one downloaded by <code>npm install</code>. Usando:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">export</span> ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Testing\n</code></pre>\n<h2 id=\"set-by-electron\"><a href=\"#set-by-electron\">Set By Electron</a></h2>\n<p>Electron sets some variables in your environment at runtime.</p>\n<h3 id=\"original_xdg_current_desktop\"><a href=\"#original_xdg_current_desktop\"><code>ORIGINAL_XDG_CURRENT_DESKTOP</code></a></h3>\n<p>This variable is set to the value of <code>XDG_CURRENT_DESKTOP</code> that your application originally launched with.  Electron sometimes modifies the value of <code>XDG_CURRENT_DESKTOP</code> to affect other logic within Chromium so if you want access to the <em>original</em> value you should look up this environment variable instead.</p>",
      "title": "Variáveis de Ambiente",
      "description": "Controle configurações e comportamento de aplicações sem mudar o código."
    },
    "/docs/api/structures/event": {
      "locale": "pt-BR",
      "slug": "event",
      "href": "/docs/api/structures/event",
      "crowdinFileId": "256429",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"event-object-extends-globalevent\"><a href=\"#event-object-extends-globalevent\">Event Object extends <code>GlobalEvent</code></a></h1>\n<ul>\n<li><code>preventDefault</code> VoidFunction</li>\n</ul>",
      "title": "Event Object extends GlobalEvent",
      "description": ""
    },
    "/docs/experimental": {
      "locale": "pt-BR",
      "slug": "experimental",
      "href": "/docs/experimental",
      "crowdinFileId": "256119",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/experimental.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"experimental-apis\"><a href=\"#experimental-apis\">Experimental APIs</a></h1>\n<p>Some of Electrons APIs are tagged with <code>_Experimental_</code> in the documentation. This tag indicates that the API may not be considered stable and the API may be removed or modified more frequently than other APIs with less warning.</p>\n<h2 id=\"conditions-for-an-api-to-be-tagged-as-experimental\"><a href=\"#conditions-for-an-api-to-be-tagged-as-experimental\">Conditions for an API to be tagged as Experimental</a></h2>\n<p>Anyone can request an API be tagged as experimental in a feature PR, disagreements on the experimental nature of a feature can be discussed in the API WG if they can't be resolved in the PR.</p>\n<h2 id=\"process-for-removing-the-experimental-tag\"><a href=\"#process-for-removing-the-experimental-tag\">Process for removing the Experimental tag</a></h2>\n<p>Once an API has been stable and in at least two major stable release lines it can be nominated to have its experimental tag removed.  This discussion should happen at an API WG meeting.  Things to consider when discussing / nominating:</p>\n<ul>\n<li>The above \"two major stables release lines\" condition must have been met</li>\n<li>During that time no major bugs / issues should have been caused by the adoption of this feature</li>\n<li>The API is stable enough and hasn't been heavily impacted by Chromium upgrades</li>\n<li>Is anyone using the API?</li>\n<li>Is the API fulfilling the original proposed usecases, does it have any gaps?</li>\n</ul>",
      "title": "Experimental APIs",
      "description": ""
    },
    "/docs/api/structures/extension": {
      "locale": "pt-BR",
      "slug": "extension",
      "href": "/docs/api/structures/extension",
      "crowdinFileId": "256433",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/extension.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"extension-object\"><a href=\"#extension-object\">Extension Object</a></h1>\n<ul>\n<li><code>id</code> String</li>\n<li><code>manifest</code> any - Copy of the <a href=\"https://developer.chrome.com/extensions/manifest\">extension's manifest data</a>.</li>\n<li><code>name</code> String</li>\n<li><code>path</code> String - The extension's file path.</li>\n<li><code>version</code> String</li>\n<li><code>url</code> String - The extension's <code>chrome-extension://</code> URL.</li>\n</ul>",
      "title": "Extension Object",
      "description": ""
    },
    "/docs/api/structures/extension-info": {
      "locale": "pt-BR",
      "slug": "extension-info",
      "href": "/docs/api/structures/extension-info",
      "crowdinFileId": "256431",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/extension-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"extensioninfo-object\"><a href=\"#extensioninfo-object\">ExtensionInfo Object</a></h1>\n<ul>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>",
      "title": "ExtensionInfo Object",
      "description": ""
    },
    "/docs/api/extensions": {
      "locale": "pt-BR",
      "slug": "extensions",
      "href": "/docs/api/extensions",
      "crowdinFileId": "256317",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/extensions.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"chrome-extension-support\"><a href=\"#chrome-extension-support\">Chrome Extension Support</a></h1>\n<p>Electron supports a subset of the <a href=\"https://developer.chrome.com/extensions/api_index\">Chrome Extensions API</a>, primarily to support DevTools extensions and Chromium-internal extensions, but it also happens to support some other extension capabilities.</p>\n<blockquote>\n<p><strong>Note:</strong> Electron does not support arbitrary Chrome extensions from the store, and it is a <strong>non-goal</strong> of the Electron project to be perfectly compatible with Chrome's implementation of Extensions.</p>\n</blockquote>\n<h2 id=\"loading-extensions\"><a href=\"#loading-extensions\">Loading extensions</a></h2>\n<p>Electron only supports loading unpacked extensions (i.e., <code>.crx</code> files do not work). Extensions are installed per-<code>session</code>. To load an extension, call <a href=\"/docs/api/session#sesloadextensionpath-options\"><code>ses.loadExtension</code></a>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession.loadExtension(<span class=\"hljs-string\">'path/to/unpacked/extension'</span>).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ id }</span>) =></span> {\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<p>Loaded extensions will not be automatically remembered across exits; if you do not call <code>loadExtension</code> when the app runs, the extension will not be loaded.</p>\n<p>Note that loading extensions is only supported in persistent sessions. Attempting to load an extension into an in-memory session will throw an error.</p>\n<p>See the <a href=\"/docs/api/session\"><code>session</code></a> documentation for more information about loading, unloading, and querying active extensions.</p>\n<h2 id=\"supported-extensions-apis\"><a href=\"#supported-extensions-apis\">Supported Extensions APIs</a></h2>\n<p>We support the following extensions APIs, with some caveats. Other APIs may additionally be supported, but support for any APIs not listed here is provisional and may be removed.</p>\n<h3 id=\"chromedevtoolsinspectedwindow\"><a href=\"#chromedevtoolsinspectedwindow\"><code>chrome.devtools.inspectedWindow</code></a></h3>\n<p>All features of this API are supported.</p>\n<h3 id=\"chromedevtoolsnetwork\"><a href=\"#chromedevtoolsnetwork\"><code>chrome.devtools.network</code></a></h3>\n<p>All features of this API are supported.</p>\n<h3 id=\"chromedevtoolspanels\"><a href=\"#chromedevtoolspanels\"><code>chrome.devtools.panels</code></a></h3>\n<p>All features of this API are supported.</p>\n<h3 id=\"chromeextension\"><a href=\"#chromeextension\"><code>chrome.extension</code></a></h3>\n<p>The following properties of <code>chrome.extension</code> are supported:</p>\n<ul>\n<li><code>chrome.extension.lastError</code></li>\n</ul>\n<p>The following methods of <code>chrome.extension</code> are supported:</p>\n<ul>\n<li><code>chrome.extension.getURL</code></li>\n<li><code>chrome.extension.getBackgroundPage</code></li>\n</ul>\n<h3 id=\"chromeruntime\"><a href=\"#chromeruntime\"><code>chrome.runtime</code></a></h3>\n<p>The following properties of <code>chrome.runtime</code> are supported:</p>\n<ul>\n<li><code>chrome.runtime.lastError</code></li>\n<li><code>chrome.runtime.id</code></li>\n</ul>\n<p>The following methods of <code>chrome.runtime</code> are supported:</p>\n<ul>\n<li><code>chrome.runtime.getBackgroundPage</code></li>\n<li><code>chrome.runtime.getManifest</code></li>\n<li><code>chrome.runtime.getPlatformInfo</code></li>\n<li><code>chrome.runtime.getURL</code></li>\n<li><code>chrome.runtime.connect</code></li>\n<li><code>chrome.runtime.sendMessage</code></li>\n<li><code>chrome.runtime.reload</code></li>\n</ul>\n<p>The following events of <code>chrome.runtime</code> are supported:</p>\n<ul>\n<li><code>chrome.runtime.onStartup</code></li>\n<li><code>chrome.runtime.onInstalled</code></li>\n<li><code>chrome.runtime.onSuspend</code></li>\n<li><code>chrome.runtime.onSuspendCanceled</code></li>\n<li><code>chrome.runtime.onConnect</code></li>\n<li><code>chrome.runtime.onMessage</code></li>\n</ul>\n<h3 id=\"chromestorage\"><a href=\"#chromestorage\"><code>chrome.storage</code></a></h3>\n<p>Only <code>chrome.storage.local</code> is supported; <code>chrome.storage.sync</code> and <code>chrome.storage.managed</code> are not.</p>\n<h3 id=\"chrometabs\"><a href=\"#chrometabs\"><code>chrome.tabs</code></a></h3>\n<p>The following methods of <code>chrome.tabs</code> are supported:</p>\n<ul>\n<li><code>chrome.tabs.sendMessage</code></li>\n<li><code>chrome.tabs.executeScript</code></li>\n</ul>\n<blockquote>\n<p><strong>Note:</strong> In Chrome, passing <code>-1</code> as a tab ID signifies the \"currently active tab\". Since Electron has no such concept, passing <code>-1</code> as a tab ID is not supported and will raise an error.</p>\n</blockquote>\n<h3 id=\"chromemanagement\"><a href=\"#chromemanagement\"><code>chrome.management</code></a></h3>\n<p>The following methods of <code>chrome.management</code> are supported:</p>\n<ul>\n<li><code>chrome.management.getAll</code></li>\n<li><code>chrome.management.get</code></li>\n<li><code>chrome.management.getSelf</code></li>\n<li><code>chrome.management.getPermissionWarningsById</code></li>\n<li><code>chrome.management.getPermissionWarningsByManifest</code></li>\n<li><code>chrome.management.onEnabled</code></li>\n<li><code>chrome.management.onDisabled</code></li>\n</ul>\n<h3 id=\"chromewebrequest\"><a href=\"#chromewebrequest\"><code>chrome.webRequest</code></a></h3>\n<p>All features of this API are supported.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Electron's <a href=\"/docs/api/web-request\"><code>webRequest</code></a> module takes precedence over <code>chrome.webRequest</code> if there are conflicting handlers.</p>\n</blockquote>",
      "title": "Chrome Extension Support",
      "description": "Note: Electron does not support arbitrary Chrome extensions from the store, and it is a non-goal of the Electron project to be perfectly compatible with Chrome's implementation of Extensions."
    },
    "/docs/faq": {
      "locale": "pt-BR",
      "slug": "faq",
      "href": "/docs/faq",
      "crowdinFileId": "256121",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/faq.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"perguntas-frequentes-no-electron\"><a href=\"#perguntas-frequentes-no-electron\">Perguntas Frequentes no Electron</a></h1>\n<h2 id=\"por-que-estou-tendo-problemas-para-instalar-o-electron\"><a href=\"#por-que-estou-tendo-problemas-para-instalar-o-electron\">Por que estou tendo problemas para instalar o Electron?</a></h2>\n<p>Ao executar o <code>npm install electron</code>, alguns usuários encontram erros de instalação.</p>\n<p>Em quase todos os casos, esses problemas são resultado de problemas de rede e não de problemas reais com o pacote npm <code>electron</code>. Erros como <code>ELIFECYCLE</code>, <code>EAI_AGAIN</code>, <code>ECONNRESET</code>, e <code>ETIMEDOUT</code> são resultados da falta de internet. A melhor solução é tentar trocar de rede, ou aguardar um pouco e tentar instalar novamente.</p>\n<p>Se a instalação via <code>npm</code> falhar, você também pode tentar baixar o Electron diretamente do código fonte em <a href=\"https://github.com/electron/electron/releases\">electron/electron/releases</a>.</p>\n<h2 id=\"quando-o-electron-será-atualizado-para-a-versão-mais-recente-do-chrome\"><a href=\"#quando-o-electron-será-atualizado-para-a-versão-mais-recente-do-chrome\">Quando o Electron será atualizado para a versão mais recente do Chrome?</a></h2>\n<p>A versão do Chrome utilizada no Electron normalmente é disponibilizada dentro de uma ou duas semanas depois que uma versão estável do Chrome é liberada. Esta estimativa não é garantida, depende da quantidade de trabalho envolvido na atualização.</p>\n<p>Somente a versão estável do Chrome é usada. If an important fix is in beta or dev channel, we will back-port it.</p>\n<p>Para mais informações, consulte a <a href=\"/docs/tutorial/security\">introdução de segurança</a>.</p>\n<h2 id=\"quando-o-electron-será-atualizado-para-a-versão-mais-recente-do-nodejs\"><a href=\"#quando-o-electron-será-atualizado-para-a-versão-mais-recente-do-nodejs\">Quando o Electron será atualizado para a versão mais recente do Node.js?</a></h2>\n<p>Quando uma nova versão do Node.js é lançada, geralmente esperamos por cerca de um mês antes de atualizar a do Electron. Assim, podemos evitar sermos afetados por erros introduzidos na nova versão do Node.js, o que acontece muito frequentemente.</p>\n<p>Novos recursos do Node.js geralmente são trazidos por atualização da V8, desde que o Electron usa o V8 enviado pelo navegador Chrome. Os novos recursos brilhante do JavaScript de uma nova versão Node.js esta geralmente no Electron.</p>\n<h2 id=\"como-compartilhar-dados-entre-página-da-web\"><a href=\"#como-compartilhar-dados-entre-página-da-web\">Como compartilhar dados entre página da web?</a></h2>\n<p>Para compartilhar dados entre páginas web (os processos de renderização) a maneira mais simples é usar as APIs do HTML5 que já estão disponíveis nos navegadores. Good candidates are <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Storage\">Storage API</a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage\"><code>localStorage</code></a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage\"><code>sessionStorage</code></a>, and <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API\">IndexedDB</a>.</p>\n<p>Alternatively, you can use the IPC primitives that are provided by Electron. To share data between the main and renderer processes, you can use the <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> and <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> modules. To communicate directly between web pages, you can send a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> from one to the other, possibly via the main process using <a href=\"/docs/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage()</code></a>. Subsequent communication over message ports is direct and does not detour through the main process.</p>\n<h2 id=\"a-minha-bandeja-de-aplicativo-desapareceu-depois-de-alguns-minutos\"><a href=\"#a-minha-bandeja-de-aplicativo-desapareceu-depois-de-alguns-minutos\">A minha bandeja de aplicativo desapareceu depois de alguns minutos.</a></h2>\n<p>Isto acontece quando a variável que é usada para armazenar a bandeja é coletada pelo garbage collector.</p>\n<p>Se você encontrar esse problema, esses artigos podem ser úteis:</p>\n<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management\">Gerenciamento de Memória</a></li>\n<li><a href=\"https://msdn.microsoft.com/library/bzt2dkta(v=vs.94).aspx\">Escopo de Variável</a></li>\n</ul>\n<p>Se você quer uma solução rápida, você pode fazer as variáveis globais, alterando seu código:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span>{\n <span class=\"hljs-keyword\">const</span> tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/icon.png'</span>)\n tray.setTitle(<span class=\"hljs-string\">'hello world'</span>)\n})\n</code></pre>\n<p>para isto:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> tray = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/icon.png'</span>)\n  tray.setTitle(<span class=\"hljs-string\">'hello world'</span>)\n})\n</code></pre>\n<h2 id=\"eu-não-posso-usar-jqueryrequirejsmeteorangularjs-em-electron\"><a href=\"#eu-não-posso-usar-jqueryrequirejsmeteorangularjs-em-electron\">Eu não posso usar jQuery/RequireJS/Meteor/AngularJS em Electron.</a></h2>\n<p>Devido à integração de Node.js do Electron, existem alguns símbolos extras inseridos o DOM como <code>module</code>, <code>exports</code> e <code>require</code>. Isso causa problemas por causa de algumas bibliotecas que querem inserir os símbolos com os mesmos nomes.</p>\n<p>Para resolver isso, você pode desativar a integração com node no Electron:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// No processo main.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\nwin.show()\n</code></pre>\n<p>Mas se você quer manter as habilidades de usar Node.JS e Electron APIs, você tem que renomear os símbolos na página, antes de incluir outras bibliotecas:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-built_in\">window</span>.nodeRequire = <span class=\"hljs-built_in\">require</span>;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.require;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.exports;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.module;\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/javascript\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"jquery.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n</code></pre>\n<h2 id=\"requireelectronxxx-é-indefinido\"><a href=\"#requireelectronxxx-é-indefinido\"><code>require('electron').xxx</code> é indefinido.</a></h2>\n<p>Quando usar o módulo built-in do Electron você pode encontrar um erro como este:</p>\n<pre><code class=\"hljs language-sh\">> require(<span class=\"hljs-string\">'electron'</span>).webFrame.setZoomFactor(1.0)\nUncaught TypeError: Cannot <span class=\"hljs-built_in\">read</span> property <span class=\"hljs-string\">'setZoomLevel'</span> of undefined\n</code></pre>\n<p>É bem provável que você esteja utilizando o módulo no processo errado. Por exemplo, <code>electron.app</code> pode apenas ser usado pelo processo principal, enquanto <code>electron.webFrame</code> está apenas disponível no processo de renderização.</p>\n<h2 id=\"a-fonte-parece-borrada-o-que-é-isso-e-o-que-eu-posso-fazer\"><a href=\"#a-fonte-parece-borrada-o-que-é-isso-e-o-que-eu-posso-fazer\">A fonte parece borrada, o que é isso e o que eu posso fazer?</a></h2>\n<p>If <a href=\"https://alienryderflex.com/sub_pixel/\">sub-pixel anti-aliasing</a> is deactivated, then fonts on LCD screens can look blurry. Exemplo:</p>\n<p><img src=\"/docs/images/subpixel-rendering-screenshot.gif\" alt=\"subpixel rendering example\"></p>\n<p>A anti-aliasing de sub-pixel precisa de um fundo não transparente na camada que contem os glyphs de texto. (Veja <a href=\"https://github.com/electron/electron/issues/6344#issuecomment-420371918\">esta publicação</a> para mais informações).</p>\n<p>To achieve this goal, set the background in the constructor for <a href=\"/docs/api/browser-window\">BrowserWindow</a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#fff'</span>\n})\n</code></pre>\n<p>The effect is visible only on (some?) LCD screens. Even if you don't see a difference, some of your users may. It is best to always set the background this way, unless you have reasons not to do so.</p>\n<p>Aviso que apenas definir o background no CSS não tem o mesmo efeito desejado.</p>",
      "title": "Perguntas Frequentes no Electron",
      "description": ""
    },
    "/docs/api/structures/file-filter": {
      "locale": "pt-BR",
      "slug": "file-filter",
      "href": "/docs/api/structures/file-filter",
      "crowdinFileId": "256435",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/file-filter.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"filefilter-object\"><a href=\"#filefilter-object\">FileFilter Object</a></h1>\n<ul>\n<li><code>name</code> String</li>\n<li><code>extensions</code> String[]</li>\n</ul>",
      "title": "FileFilter Object",
      "description": ""
    },
    "/docs/api/file-object": {
      "locale": "pt-BR",
      "slug": "file-object",
      "href": "/docs/api/file-object",
      "crowdinFileId": "256319",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/file-object.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"file-object\"><a href=\"#file-object\"><code>File</code> Object</a></h1>\n<blockquote>\n<p>Use a API do HTML5 <code>File</code> para funcionar nativamente com arquivos no sistema de arquivos.</p>\n</blockquote>\n<p>The DOM's File interface provides abstraction around native files in order to let users work on native files directly with the HTML5 file API. Electron has added a <code>path</code> attribute to the <code>File</code> interface which exposes the file's real path on filesystem.</p>\n<p>Example of getting a real path from a dragged-onto-the-app file:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">div</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"holder\"</span>></span>\n  Drag your file here\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">div</span>></span>\n\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  <span class=\"hljs-built_in\">document</span>.addEventListener(<span class=\"hljs-string\">'drop'</span>, (e) => {\n    e.preventDefault();\n    e.stopPropagation();\n\n    <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> f <span class=\"hljs-keyword\">of</span> e.dataTransfer.files) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'File(s) you dragged here: '</span>, f.path)\n    }\n  });\n  <span class=\"hljs-built_in\">document</span>.addEventListener(<span class=\"hljs-string\">'dragover'</span>, (e) => {\n    e.preventDefault();\n    e.stopPropagation();\n  });\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>",
      "title": "File Object",
      "description": "Use a API do HTML5 File para funcionar nativamente com arquivos no sistema de arquivos."
    },
    "/docs/api/structures/file-path-with-headers": {
      "locale": "pt-BR",
      "slug": "file-path-with-headers",
      "href": "/docs/api/structures/file-path-with-headers",
      "crowdinFileId": "256437",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/file-path-with-headers.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"filepathwithheaders-object\"><a href=\"#filepathwithheaders-object\">FilePathWithHeaders Object</a></h1>\n<ul>\n<li><code>path</code> String - The path to the file to send.</li>\n<li><code>headers</code> Record&#x3C;string, string> (optional) - Additional headers to be sent.</li>\n</ul>",
      "title": "FilePathWithHeaders Object",
      "description": ""
    },
    "/docs/api/frameless-window": {
      "locale": "pt-BR",
      "slug": "frameless-window",
      "href": "/docs/api/frameless-window",
      "crowdinFileId": "256321",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/frameless-window.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"frameless-window\"><a href=\"#frameless-window\">Frameless Window</a></h1>\n<blockquote>\n<p>Abra uma janela sem barra de ferramentas, bordas ou outros elementos gráficos do \"Chrome\".</p>\n</blockquote>\n<p>Uma janela 'frameless' é uma janela que não possui <a href=\"https://developer.mozilla.org/en-US/docs/Glossary/Chrome\">chrome</a>, ou seja, não possui partes da janela que não são partes da página web, como a barra de ferramentas. Estas são opções na classe <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<h2 id=\"criando-uma-frameless-window\"><a href=\"#criando-uma-frameless-window\">Criando uma frameless window</a></h2>\n<p>Para criar uma frameless window, você precisa definir <code>frame</code> como <code>false</code> nas <code>options</code> da <a href=\"/docs/api/browser-window\">BrowserWindow</a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h3 id=\"alternatives\"><a href=\"#alternatives\">Alternatives</a></h3>\n<p>There's an alternative way to specify a chromeless window on macOS and Windows. Instead of setting <code>frame</code> to <code>false</code> which disables both the titlebar and window controls, you may want to have the title bar hidden and your content extend to the full window size, yet still preserve the window controls (\"traffic lights\" on macOS) for standard window actions. Você pode fazê-lo, especificando a opção <code>titleBarStyle</code>:</p>\n<h4 id=\"hidden\"><a href=\"#hidden\"><code>hidden</code></a></h4>\n<p>Results in a hidden title bar and a full size content window. On macOS, the title bar still has the standard window controls (“traffic lights”) in the top left.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span> })\nwin.show()\n</code></pre>\n<h3 id=\"alternativas-no-macos\"><a href=\"#alternativas-no-macos\">Alternativas no macOS</a></h3>\n<h4 id=\"hiddeninset\"><a href=\"#hiddeninset\"><code>hiddenInset</code></a></h4>\n<p>Resulta em uma barra de título escondida com uma aparência alternativa, onde os botões de controle da janela estão um pouco mais dentro do limite da janela.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span> })\nwin.show()\n</code></pre>\n<h4 id=\"custombuttonsonhover\"><a href=\"#custombuttonsonhover\"><code>customButtonsOnHover</code></a></h4>\n<p>Uses custom drawn close, and miniaturize buttons that display when hovering in the top left of the window. The fullscreen button is not available due to restrictions of frameless windows as they interface with Apple's macOS window masks. These custom buttons prevent issues with mouse events that occur with the standard window toolbar buttons. This option is only applicable for frameless windows.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'customButtonsOnHover'</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h2 id=\"windows-control-overlay\"><a href=\"#windows-control-overlay\">Windows Control Overlay</a></h2>\n<p>When using a frameless window in conjuction with <code>win.setWindowButtonVisibility(true)</code> on macOS, using one of the <code>titleBarStyle</code>s as described above so that the traffic lights are visible, or using <code>titleBarStyle: hidden</code> on Windows, you can access the Window Controls Overlay <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis\">JavaScript APIs</a> and <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables\">CSS Environment Variables</a> by setting the <code>titleBarOverlay</code> option to true. Specifying <code>true</code> will result in an overlay with default system colors.</p>\n<p>On Windows, you can also specify the color of the overlay and its symbols by setting <code>titleBarOverlay</code> to an object with the options <code>color</code> and <code>symbolColor</code>. If an option is not specified, the color will default to its system color for the window control buttons:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span>,\n  <span class=\"hljs-attr\">titleBarOverlay</span>: <span class=\"hljs-literal\">true</span>\n})\nwin.show()\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span>,\n  <span class=\"hljs-attr\">titleBarOverlay</span>: {\n    <span class=\"hljs-attr\">color</span>: <span class=\"hljs-string\">'#2f3241'</span>,\n    <span class=\"hljs-attr\">symbolColor</span>: <span class=\"hljs-string\">'#74b1be'</span>\n  }\n})\nwin.show()\n</code></pre>\n<h2 id=\"janela-transparente\"><a href=\"#janela-transparente\">Janela transparente</a></h2>\n<p>Definindo a opção <code>transparent</code> como <code>true</code> você também pode fazer a frameless window transparente:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">transparent</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h3 id=\"limitações\"><a href=\"#limitações\">Limitações</a></h3>\n<ul>\n<li>Você não pode clicar através da área transparente. Nós iremos introduzir uma API para definir a forma da janela para solucionar isto, veja <a href=\"https://github.com/electron/electron/issues/1335\">nosso issue no Github</a> para mais detalhes.</li>\n<li>Transparent windows are not resizable. Setting <code>resizable</code> to <code>true</code> may make a transparent window stop working on some platforms.</li>\n<li>O filtro <code>blur</code> apenas se aplica a página web, logo, não há uma maneira de aplicar o efeito de borrado ao conteúdo abaixo da janela (ou seja, outras aplicações abertas no sistema do usuário).</li>\n<li>The window will not be transparent when DevTools is opened.</li>\n<li>On Windows operating systems,<ul>\n<li>transparent windows will not work when DWM is disabled.</li>\n<li>transparent windows can not be maximized using the Windows system menu or by double clicking the title bar. The reasoning behind this can be seen on <a href=\"https://github.com/electron/electron/pull/28207\">this pull request</a>.</li>\n</ul></li>\n<li>On Linux, users have to put <code>--enable-transparent-visuals --disable-gpu</code> in the command line to disable GPU and allow ARGB to make transparent window, this is caused by an upstream bug that <a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=369209\">alpha channel doesn't work on some NVidia drivers</a> on Linux.</li>\n<li>On Mac, the native window shadow will not be shown on a transparent window.</li>\n</ul>\n<h2 id=\"click-through-window\"><a href=\"#click-through-window\">Click-through window</a></h2>\n<p>To create a click-through window, i.e. making the window ignore all mouse events, you can call the <a href=\"/docs/api/browser-window#winsetignoremouseeventsignore-options\">win.setIgnoreMouseEvents(ignore)</a> API:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.setIgnoreMouseEvents(<span class=\"hljs-literal\">true</span>)\n</code></pre>\n<h3 id=\"forwarding\"><a href=\"#forwarding\">Forwarding</a></h3>\n<p>Ignoring mouse messages makes the web page oblivious to mouse movement, meaning that mouse movement events will not be emitted. On Windows operating systems an optional parameter can be used to forward mouse move messages to the web page, allowing events such as <code>mouseleave</code> to be emitted:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> el = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'clickThroughElement'</span>)\nel.addEventListener(<span class=\"hljs-string\">'mouseenter'</span>, () => {\n  ipcRenderer.send(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, <span class=\"hljs-literal\">true</span>, { <span class=\"hljs-attr\">forward</span>: <span class=\"hljs-literal\">true</span> })\n})\nel.addEventListener(<span class=\"hljs-string\">'mouseleave'</span>, () => {\n  ipcRenderer.send(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, <span class=\"hljs-literal\">false</span>)\n})\n\n<span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, (event, ...args) => {\n  BrowserWindow.fromWebContents(event.sender).setIgnoreMouseEvents(...args)\n})\n</code></pre>\n<p>This makes the web page click-through when over <code>el</code>, and returns to normal outside it.</p>\n<h2 id=\"draggable-region\"><a href=\"#draggable-region\">Draggable region</a></h2>\n<p>By default, the frameless window is non-draggable. Apps need to specify <code>-webkit-app-region: drag</code> in CSS to tell Electron which regions are draggable (like the OS's standard titlebar), and apps can also use <code>-webkit-app-region: no-drag</code> to exclude the non-draggable area from the draggable region. Note that only rectangular shapes are currently supported.</p>\n<p>Note: <code>-webkit-app-region: drag</code> is known to have problems while the developer tools are open. See this <a href=\"https://github.com/electron/electron/issues/3647\">GitHub issue</a> for more information including a workaround.</p>\n<p>To make the whole window draggable, you can add <code>-webkit-app-region: drag</code> as <code>body</code>'s style:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"-webkit-app-region: drag\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n</code></pre>\n<p>And note that if you have made the whole window draggable, you must also mark buttons as non-draggable, otherwise it would be impossible for users to click on them:</p>\n<pre><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">button</span> {\n  <span class=\"hljs-attribute\">-webkit-app-region</span>: no-drag;\n}\n</code></pre>\n<p>If you're only setting a custom titlebar as draggable, you also need to make all buttons in titlebar non-draggable.</p>\n<h2 id=\"text-selection\"><a href=\"#text-selection\">Text selection</a></h2>\n<p>In a frameless window the dragging behavior may conflict with selecting text. For example, when you drag the titlebar you may accidentally select the text on the titlebar. To prevent this, you need to disable text selection within a draggable area like this:</p>\n<pre><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.titlebar</span> {\n  <span class=\"hljs-attribute\">-webkit-user-select</span>: none;\n  <span class=\"hljs-attribute\">-webkit-app-region</span>: drag;\n}\n</code></pre>\n<h2 id=\"context-menu\"><a href=\"#context-menu\">Context menu</a></h2>\n<p>On some platforms, the draggable area will be treated as a non-client frame, so when you right click on it a system menu will pop up. To make the context menu behave correctly on all platforms you should never use a custom context menu on draggable areas.</p>",
      "title": "Frameless Window",
      "description": "Abra uma janela sem barra de ferramentas, bordas ou outros elementos gráficos do \"Chrome\"."
    },
    "/docs/tutorial/fuses": {
      "locale": "pt-BR",
      "slug": "fuses",
      "href": "/docs/tutorial/fuses",
      "crowdinFileId": "256201",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/fuses.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-fuses\"><a href=\"#electron-fuses\">Electron Fuses</a></h1>\n<blockquote>\n<p>Package time feature toggles</p>\n</blockquote>\n<h2 id=\"what-are-fuses\"><a href=\"#what-are-fuses\">What are fuses?</a></h2>\n<p>For a subset of Electron functionality it makes sense to disable certain features for an entire application.  For example, 99% of apps don't make use of <code>ELECTRON_RUN_AS_NODE</code>, these applications want to be able to ship a binary that is incapable of using that feature.  We also don't want Electron consumers building Electron from source as that is both a massive technical challenge and has a high cost of both time and money.</p>\n<p>Fuses are the solution to this problem, at a high level they are \"magic bits\" in the Electron binary that can be flipped when packaging your Electron app to enable / disable certain features / restrictions.  Because they are flipped at package time before you code sign your app the OS becomes responsible for ensuring those bits aren't flipped back via OS level code signing validation (Gatekeeper / App Locker).</p>\n<h2 id=\"how-do-i-flip-the-fuses\"><a href=\"#how-do-i-flip-the-fuses\">How do I flip the fuses?</a></h2>\n<h3 id=\"the-easy-way\"><a href=\"#the-easy-way\">The easy way</a></h3>\n<p>We've made a handy module <code>@electron/fuses</code> to make flipping these fuses easy.  Check out the README of that module for more details on usage and potential error cases.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/fuses'</span>).flipFuses(\n  <span class=\"hljs-comment\">// Path to electron</span>\n  <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>),\n  <span class=\"hljs-comment\">// Fuses to flip</span>\n  {\n    <span class=\"hljs-attr\">runAsNode</span>: <span class=\"hljs-literal\">false</span>\n  }\n)\n</code></pre>\n<h3 id=\"the-hard-way\"><a href=\"#the-hard-way\">The hard way</a></h3>\n<h4 id=\"quick-glossary\"><a href=\"#quick-glossary\">Quick Glossary</a></h4>\n<ul>\n<li><strong>Fuse Wire</strong>: A sequence of bytes in the Electron binary used to control the fuses</li>\n<li><strong>Sentinel</strong>: A static known sequence of bytes you can use to locate the fuse wire</li>\n<li><strong>Fuse Schema</strong>: The format / allowed values for the fuse wire</li>\n</ul>\n<p>Manually flipping fuses requires editing the Electron binary and modifying the fuse wire to be the sequence of bytes that represent the state of the fuses you want.</p>\n<p>Somewhere in the Electron binary there will be a sequence of bytes that look like this:</p>\n<pre><code class=\"hljs language-plaintext\">| ...binary | sentinel_bytes | fuse_version | fuse_wire_length | fuse_wire | ...binary |\n</code></pre>\n<ul>\n<li><code>sentinel_bytes</code> is always this exact string <code>dL7pKGdnNz796PbbjQWNKmHXBZaB9tsX</code></li>\n<li><code>fuse_version</code> is a single byte whose unsigned integer value represents the version of the fuse schema</li>\n<li><code>fuse_wire_length</code> is a single byte whose unsigned integer value represents the number of fuses in the following fuse wire</li>\n<li><code>fuse_wire</code> is a sequence of N bytes, each byte represents a single fuse and its state.<ul>\n<li>\"0\" (0x30) indicates the fuse is disabled</li>\n<li>\"1\" (0x31) indicates the fuse is enabled</li>\n<li>\"r\" (0x72) indicates the fuse has been removed and changing the byte to either 1 or 0 will have no effect.</li>\n</ul></li>\n</ul>\n<p>To flip a fuse you find its position in the fuse wire and change it to \"0\" or \"1\" depending on the state you'd like.</p>\n<p>You can view the current schema <a href=\"https://github.com/electron/electron/blob/main/build/fuses/fuses.json5\">here</a>.</p>",
      "title": "Electron Fuses",
      "description": "Package time feature toggles"
    },
    "/docs/api/global-shortcut": {
      "locale": "pt-BR",
      "slug": "global-shortcut",
      "href": "/docs/api/global-shortcut",
      "crowdinFileId": "256323",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/global-shortcut.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"globalshortcut\"><a href=\"#globalshortcut\">globalShortcut</a></h1>\n<blockquote>\n<p>Detecta eventos de teclado quando o aplicativo não tiver o foco do teclado.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>O módulo <code>globalShortcut</code> pode registrar/cancelar o registro de um atalho de teclado global com o sistema operativo que você possa personalizar as operações para os vários atalhos.</p>\n<p><strong> Nota:</strong> O atalho é global; Isso funcionará mesmo se o aplicativo não tenha o foco do teclado. This module cannot be used before the <code>ready</code> event of the app module is emitted.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Register a 'CommandOrControl+X' shortcut listener.</span>\n  <span class=\"hljs-keyword\">const</span> ret = globalShortcut.register(<span class=\"hljs-string\">'CommandOrControl+X'</span>, () => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'CommandOrControl+X is pressed'</span>)\n  })\n\n  <span class=\"hljs-keyword\">if</span> (!ret) {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'registration failed'</span>)\n  }\n\n  <span class=\"hljs-comment\">// Check whether a shortcut is registered.</span>\n  <span class=\"hljs-built_in\">console</span>.log(globalShortcut.isRegistered(<span class=\"hljs-string\">'CommandOrControl+X'</span>))\n})\n\napp.on(<span class=\"hljs-string\">'will-quit'</span>, () => {\n  <span class=\"hljs-comment\">// Unregister a shortcut.</span>\n  globalShortcut.unregister(<span class=\"hljs-string\">'CommandOrControl+X'</span>)\n\n  <span class=\"hljs-comment\">// Unregister all shortcuts.</span>\n  globalShortcut.unregisterAll()\n})\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>globalShortcut</code> tem os seguintes métodos:</p>\n<h3 id=\"globalshortcutregisteraccelerator-callback\"><a href=\"#globalshortcutregisteraccelerator-callback\"><code>globalShortcut.register(accelerator, callback)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n<li><code>callback</code> Function</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether or not the shortcut was registered successfully.</p>\n<p>Registers a global shortcut of <code>accelerator</code>. The <code>callback</code> is called when the registered shortcut is pressed by the user.</p>\n<p>Quando o acelerador já está sendo utilizado por outras aplicações, esta chamada falhará silenciosamente. Este comportamento é pretendido pelos sistemas operacionais, uma vez que eles não querem que os aplicativos lutem por atalhos globais.</p>\n<p>The following accelerators will not be registered successfully on macOS 10.14 Mojave unless the app has been authorized as a <a href=\"https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html\">trusted accessibility client</a>:</p>\n<ul>\n<li>\"Media Play/Pause\"</li>\n<li>\"Media Next Track\"</li>\n<li>\"Media Previous Track\"</li>\n<li>\"Media Stop\"</li>\n</ul>\n<h3 id=\"globalshortcutregisterallaccelerators-callback\"><a href=\"#globalshortcutregisterallaccelerators-callback\"><code>globalShortcut.registerAll(accelerators, callback)</code></a></h3>\n<ul>\n<li><code>accelerators</code> String[] - an array of <a href=\"/docs/api/accelerator\">Accelerator</a>s.</li>\n<li><code>callback</code> Function</li>\n</ul>\n<p>Registers a global shortcut of all <code>accelerator</code> items in <code>accelerators</code>. The <code>callback</code> is called when any of the registered shortcuts are pressed by the user.</p>\n<p>When a given accelerator is already taken by other applications, this call will silently fail. Este comportamento é pretendido pelos sistemas operacionais, uma vez que eles não querem que os aplicativos lutem por atalhos globais.</p>\n<p>The following accelerators will not be registered successfully on macOS 10.14 Mojave unless the app has been authorized as a <a href=\"https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html\">trusted accessibility client</a>:</p>\n<ul>\n<li>\"Media Play/Pause\"</li>\n<li>\"Media Next Track\"</li>\n<li>\"Media Previous Track\"</li>\n<li>\"Media Stop\"</li>\n</ul>\n<h3 id=\"globalshortcutisregisteredaccelerator\"><a href=\"#globalshortcutisregisteredaccelerator\"><code>globalShortcut.isRegistered(accelerator)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n</ul>\n<p>Retorna <code>Boolean</code> - Se esta aplicação registrou o <code>accelerator</code>.</p>\n<p>Quando o acelerador já está sendo utilizado por outras aplicações, esta ainda retorna <code>false</code>. Este comportamento é pretendido pelos sistemas operacionais, uma vez que eles não querem que os aplicativos lutem por atalhos globais.</p>\n<h3 id=\"globalshortcutunregisteraccelerator\"><a href=\"#globalshortcutunregisteraccelerator\"><code>globalShortcut.unregister(accelerator)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n</ul>\n<p>Não registra o atalho global de <code>accelerator</code>.</p>\n<h3 id=\"globalshortcutunregisterall\"><a href=\"#globalshortcutunregisterall\"><code>globalShortcut.unregisterAll()</code></a></h3>\n<p>Não registra todos os atalhos globais.</p>",
      "title": "globalShortcut",
      "description": "Detecta eventos de teclado quando o aplicativo não tiver o foco do teclado."
    },
    "/docs/glossary": {
      "locale": "pt-BR",
      "slug": "glossary",
      "href": "/docs/glossary",
      "crowdinFileId": "256123",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/glossary.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"glossário\"><a href=\"#glossário\">Glossário</a></h1>\n<p>Esta página define alguns termos usados frequentemente no desenvolvimento com Electron.</p>\n<h3 id=\"asar\"><a href=\"#asar\">ASAR</a></h3>\n<p>ASAR significa formato de arquivo Atom Shell (em inglês, Atom Shell Archive Format). Um arquivo de <a href=\"https://github.com/electron/asar\">asar</a> é um simples <code>tar</code> formato que juntas os arquivos para um único arquivo. Electron pode ler arquivos arbitrários sem descompactar o arquivo inteiro.</p>\n<p>The ASAR format was created primarily to improve performance on Windows when reading large quantities of small files (e.g. when loading your app's JavaScript dependency tree from <code>node_modules</code>).</p>\n<h3 id=\"code-signing\"><a href=\"#code-signing\">code signing</a></h3>\n<p>Code signing is a process where an app developer digitally signs their code to ensure that it hasn't been tampered with after packaging. Both Windows and macOS implement their own version of code signing. As a desktop app developer, it's important that you sign your code if you plan on distributing it to the general public.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/code-signing\">Code Signing</a> tutorial.</p>\n<h3 id=\"context-isolation\"><a href=\"#context-isolation\">context isolation</a></h3>\n<p>Context isolation is a security measure in Electron that ensures that your preload script cannot leak privileged Electron or Node.js APIs to the web contents in your renderer process. With context isolation enabled, the only way to expose APIs from your preload script is through the <code>contextBridge</code> API.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/context-isolation\">Context Isolation</a> tutorial.</p>\n<p>See also: <a href=\"#preload-script\">preload script</a>, <a href=\"#renderer-process\">renderer process</a></p>\n<h3 id=\"crt\"><a href=\"#crt\">CRT</a></h3>\n<p>The C Runtime Library (CRT) is the part of the C++ Standard Library that incorporates the ISO C99 standard library. As bibliotecas do Visual C++ que implementam o CRT apoiar o desenvolvimento de código nativo e misto de código nativo e gerenciado e código gerenciado puro para desenvolvimento .NET.</p>\n<h3 id=\"dmg\"><a href=\"#dmg\">DMG</a></h3>\n<p>Uma imagem de disco da Apple é um formato de embalagem usado pelo macOS. DMG arquivos são componentes usados para distribuir um aplicativo \"instaladores\".</p>\n<h3 id=\"ime\"><a href=\"#ime\">IME</a></h3>\n<p>Editor de Método de Entrada. Um programa que permite os usuários inserir caracteres e símbolos não encontrados no seu teclado. Por exemplo, isso permite que usuários com teclado Latinos teclados troque as entradas de caracteres para Chinês, Japonês e Koreano.</p>\n<h3 id=\"idl\"><a href=\"#idl\">IDL</a></h3>\n<p>Interface description language. Write function signatures and data types in a format that can be used to generate interfaces in Java, C++, JavaScript, etc.</p>\n<h3 id=\"ipc\"><a href=\"#ipc\">IPC</a></h3>\n<p>IPC stands for inter-process communication. Electron uses IPC to send serialized JSON messages between the main and renderer processes.</p>\n<p>consulte também: <a href=\"#main-process\">processo principal</a>, <a href=\"#renderer-process\">processo de processador</a></p>\n<h3 id=\"main-process\"><a href=\"#main-process\">main process</a></h3>\n<p>The main process, commonly a file named <code>main.js</code>, is the entry point to every Electron app. It controls the life of the app, from open to close. Isso também é gerencia elementos nativos, como o Menu, Barra de Menus, Dock, Bandeja e etc. The main process is responsible for creating each new renderer process in the app. The full Node API is built in.</p>\n<p>Every app's main process file is specified in the <code>main</code> property in <code>package.json</code>. This is how <code>electron .</code> knows what file to execute at startup.</p>\n<p>In Chromium, this process is referred to as the \"browser process\". It is renamed in Electron to avoid confusion with renderer processes.</p>\n<p>Consulte também: <a href=\"#process\">processo</a>, <a href=\"#renderer-process\">processo de processador</a></p>\n<h3 id=\"mas\"><a href=\"#mas\">MAS</a></h3>\n<p>Acronym for Apple's Mac App Store. For details on submitting your app to the MAS, see the <a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store Submission Guide</a>.</p>\n<h3 id=\"mojo\"><a href=\"#mojo\">Mojo</a></h3>\n<p>An IPC system for communicating intra- or inter-process, and that's important because Chrome is keen on being able to split its work into separate processes or not, depending on memory pressures etc.</p>\n<p>Veja <a href=\"https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md\">https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md</a></p>\n<p>See also: <a href=\"#ipc\">IPC</a></p>\n<h3 id=\"msi\"><a href=\"#msi\">MSI</a></h3>\n<p>On Windows, MSI packages are used by the Windows Installer (also known as Microsoft Installer) service to install and configure applications.</p>\n<p>More information can be found in <a href=\"https://docs.microsoft.com/en-us/windows/win32/msi/windows-installer-portal\">Microsoft's documentation</a>.</p>\n<h3 id=\"native-modules\"><a href=\"#native-modules\">native modules</a></h3>\n<p>Módulos nativos (também chamados <a href=\"https://nodejs.org/api/addons.html\">addons</a> em Node.Js) são módulos escritos em C ou C++ que pode ser carregado em Node.js ou Electron usando a função require() e fazer o uso de modo como se fossem um módulo comum de Node.js. Eles são usados principalmente para fornecer uma interface entre o JavaScript em execução em bibliotecas de Node.js e C/C++.</p>\n<p>Os módulos nativos do Node são suportados pelo Electron, mas considerando que o Electron provavelmente irá utilizar uma versão do V8 dos binários do Node instalados no seu sistema, você deve especificar manualmente a localização dos headers do Electron quando for copilar módulos nativos.</p>\n<p>For more information, read the [Native Node Modules] tutorial.</p>\n<h3 id=\"notarization\"><a href=\"#notarization\">notarization</a></h3>\n<p>Notarization is a macOS-specific process where a developer can send a code-signed app to Apple servers to get verified for malicious components through an automated service.</p>\n<p>See also: <a href=\"#code-signing\">code signing</a></p>\n<h3 id=\"osr\"><a href=\"#osr\">OSR</a></h3>\n<p>OSR (offscreen rendering) can be used for loading heavy page in background and then displaying it after (it will be much faster). It allows you to render page without showing it on screen.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/offscreen-rendering\">Offscreen Rendering</a>[osr] tutorial.</p>\n<h3 id=\"preload-script\"><a href=\"#preload-script\">preload script</a></h3>\n<p>Preload scripts contain code that executes in a renderer process before its web contents begin loading. These scripts run within the renderer context, but are granted more privileges by having access to Node.js APIs.</p>\n<p>See also: <a href=\"#renderer-process\">renderer process</a>, <a href=\"#context-isolation\">context isolation</a></p>\n<h3 id=\"process\"><a href=\"#process\">process</a></h3>\n<p>Um processo é uma instância de um programa de computador que está sendo executado. Apps de Electron que fazem usam do <a href=\"#main-process\">main</a> e um ou vários processo de <a href=\"#renderer-process\">renderer</a> estão executando vários programas simultaneamente.</p>\n<p>Em Node.js e Electron, cada processo em execução tem um objeto de <code>process</code>. Este objeto é um global que fornece informações sobre e controle sobre, o atual processo. Como um global, é sempre disponível para aplicações sem o uso de require().</p>\n<p>Consulte também: <a href=\"#main-process\">processo principal</a>, <a href=\"#renderer-process\">processo de processador</a></p>\n<h3 id=\"renderer-process\"><a href=\"#renderer-process\">renderer process</a></h3>\n<p>The renderer process is a browser window in your app. Unlike the main process, there can be multiple of these and each is run in a separate process. They can also be hidden.</p>\n<p>Consulte também: <a href=\"#process\">process</a>, <a href=\"#main-process\">main process</a></p>\n<h3 id=\"sandbox\"><a href=\"#sandbox\">sandbox</a></h3>\n<p>The sandbox is a security feature inherited from Chromium that restricts your renderer processes to a limited set of permissions.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/sandbox\">Process Sandboxing</a> tutorial.</p>\n<p>See also: <a href=\"#process\">process</a></p>\n<h3 id=\"squirrel\"><a href=\"#squirrel\">Squirrel</a></h3>\n<p>Squirrel é um framework de código aberto que permite que aplicativos de elétron atualizar automaticamente como novas versões são lançadas. Consulte o <a href=\"/docs/api/auto-updater\">autoUpdater</a> API para obter informações sobre como começar com o Squirrel.</p>\n<h3 id=\"userland\"><a href=\"#userland\">userland</a></h3>\n<p>Este termo originou-se da comunidade Unix, onde \"userland\" ou \"userspace\" refere-se a programas que são executados fora da kernel do sistema operacional. Mais recentemente, o termo foi popularizado na comunidade Node e npm para distinguir entre os recursos disponíveis em \"Node core\" de pacotes publicados no registro do npm pela maior comunidade \"usuários\".</p>\n<p>Como Node, o Electron é focado em ter um pequeno conjunto de APIs que fornecem todos os primitivos necessários para o desenvolvimento de aplicativos de multi-plataformas desktop. Esta filosofia do projeto permite que o Electron permaneça uma ferramenta flexível sem ser excessivamente prescritiva sobre como deve ser usado. Userland permite que os usuários criar e compartilhar ferramentas que fornecem funcionalidade adicional em cima do que é disponível no \"Núcleo\".</p>\n<h3 id=\"v8\"><a href=\"#v8\">V8</a></h3>\n<p>V8 is Google's open source JavaScript engine. It is written in C++ and is used in Google Chrome. V8 can run standalone, or can be embedded into any C++ application.</p>\n<p>Electron forma o V8 como parte do Chromium e em seguida, aponta o Node ao V8 quando construindo.</p>\n<p>V8's version numbers always correspond to those of Google Chrome. Chrome 59 includes V8 5.9, Chrome 58 includes V8 5.8, etc.</p>\n<ul>\n<li><a href=\"https://v8.dev/\">v8.dev</a></li>\n<li><a href=\"https://nodejs.org/api/v8.html\">nodejs.org/api/v8.html</a></li>\n<li><a href=\"/docs/development/v8-development\">docs/development/v8-development.md</a></li>\n</ul>\n<h3 id=\"webview\"><a href=\"#webview\">webview</a></h3>\n<p><code>webview</code> tags are used to embed 'guest' content (such as external web pages) in your Electron app. They are similar to <code>iframe</code>s, but differ in that each webview runs in a separate process. Ele não tem a mesma permissões como sua página web e todas as interações entre seu aplicativo e conteúdo incorporado será assíncrono. Isso mantém seu aplicativo seguro do conteúdo incorporado.</p>",
      "title": "Glossário",
      "description": ""
    },
    "/docs/development/goma": {
      "locale": "pt-BR",
      "slug": "goma",
      "href": "/docs/development/goma",
      "crowdinFileId": "256157",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/goma.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"goma\"><a href=\"#goma\">Goma</a></h1>\n<blockquote>\n<p>Goma é um serviço distribuído de compilador para projetos open-source como Chromium e Android.</p>\n</blockquote>\n<p>O Electron possui uma implantação de um Backend Goma personalizado que nós deixamos disponível para todos que fazem a manutenção do Electron.  Veja a seção <a href=\"#access\">Acesso</a> abaixo para detalhes sobre autenticação.  Existe também um endpoint Goma <code>cache-only</code> que será usado por padrão caso você não tenha credenciais.  Requisições para o cache-only Goma não chamará nosso cluster, mas lerá do nosso cache, o que deve resultar em tempos de build significativamente mais rápidos.</p>\n<h2 id=\"habilitando-o-goma\"><a href=\"#habilitando-o-goma\">Habilitando o Goma</a></h2>\n<p>Atualmente, a única maneira suportada de utilizar o Goma é usando nossas <a href=\"https://github.com/electron/build-tools\">Ferramentas de Construção</a>. Uma configuração do Goma é automaticamente incluída quando você configurar as <code>build-tools</code>.</p>\n<p>If you are a maintainer and have access to our cluster, please ensure that you run <code>e init</code> with <code>--goma=cluster</code> in order to configure <code>build-tools</code> to use the Goma cluster.  If you have an existing config, you can just set <code>\"goma\": \"cluster\"</code> in your config file.</p>\n<h2 id=\"building-with-goma\"><a href=\"#building-with-goma\">Building with Goma</a></h2>\n<p>When you are using Goma you can run <code>ninja</code> with a substantially higher <code>j</code> value than would normally be supported by your machine.</p>\n<p>Please do not set a value higher than <strong>200</strong> on Windows or Linux and <strong>50</strong> on macOS. We monitor Goma system usage, and users found to be abusing it with unreasonable concurrency will be de-activated.</p>\n<pre><code class=\"hljs language-bash\">ninja -C out/Testing electron -j 200\n</code></pre>\n<p>If you're using <code>build-tools</code>, appropriate <code>-j</code> values will automatically be used for you.</p>\n<h2 id=\"monitoring-goma\"><a href=\"#monitoring-goma\">Monitoring Goma</a></h2>\n<p>If you access <a href=\"http://localhost:8088\">http://localhost:8088</a> on your local machine you can monitor compile jobs as they flow through the goma system.</p>\n<h2 id=\"access\"><a href=\"#access\">Access</a></h2>\n<p>For security and cost reasons, access to Electron's Goma cluster is currently restricted to Electron Maintainers.  If you want access please head to <code>#access-requests</code> in Slack and ping <code>@goma-squad</code> to ask for access.  Please be aware that being a maintainer does not <em>automatically</em> grant access and access is determined on a case by case basis.</p>\n<h2 id=\"uptime--support\"><a href=\"#uptime--support\">Uptime / Support</a></h2>\n<p>We have automated monitoring of our Goma cluster and cache at <a href=\"https://status.notgoma.com\">https://status.notgoma.com</a></p>\n<p>We do not provide support for usage of Goma and any issues raised asking for help / having issues will <em>probably</em> be closed without much reason, we do not have the capacity to handle that kind of support.</p>",
      "title": "Goma",
      "description": "Goma é um serviço distribuído de compilador para projetos open-source como Chromium e Android."
    },
    "/docs/api/structures/gpu-feature-status": {
      "locale": "pt-BR",
      "slug": "gpu-feature-status",
      "href": "/docs/api/structures/gpu-feature-status",
      "crowdinFileId": "256439",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/gpu-feature-status.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"gpufeaturestatus-object\"><a href=\"#gpufeaturestatus-object\">GPUFeatureStatus Object</a></h1>\n<ul>\n<li><code>2d_canvas</code> String - Canvas.</li>\n<li><code>flash_3d</code> String - Flash.</li>\n<li><code>flash_stage3d</code> String - Flash Stage3D.</li>\n<li><code>flash_stage3d_baseline</code> String - Flash Stage3D Baseline profile.</li>\n<li><code>gpu_compositing</code> String - Compositing.</li>\n<li><code>multiple_raster_threads</code> String - Multiple Raster Threads.</li>\n<li><code>native_gpu_memory_buffers</code> String - Native GpuMemoryBuffers.</li>\n<li><code>rasterization</code> String - Rasterization.</li>\n<li><code>video_decode</code> String - Video Decode.</li>\n<li><code>video_encode</code> String - Video Encode.</li>\n<li><code>vpx_decode</code> String - VPx Video Decode.</li>\n<li><code>webgl</code> String - WebGL.</li>\n<li><code>webgl2</code> String - WebGL2.</li>\n</ul>\n<p>Valores possíveis:</p>\n<ul>\n<li><code>disabled_software</code> - Software only. Hardware acceleration disabled (yellow)</li>\n<li><code>disabled_off</code> - Disabled (red)</li>\n<li><code>disabled_off_ok</code> - Disabled (yellow)</li>\n<li><code>unavailable_software</code> - Software only, hardware acceleration unavailable (yellow)</li>\n<li><code>unavailable_off</code> - Unavailable (red)</li>\n<li><code>unavailable_off_ok</code> - Unavailable (yellow)</li>\n<li><code>enabled_readback</code> - Hardware accelerated but at reduced performance (yellow)</li>\n<li><code>enabled_force</code> - Hardware accelerated on all pages (green)</li>\n<li><code>enabled</code> - Hardware accelerated (green)</li>\n<li><code>enabled_on</code> - Enabled (green)</li>\n<li><code>enabled_force_on</code> - Force enabled (green)</li>\n</ul>",
      "title": "GPUFeatureStatus Object",
      "description": ""
    },
    "/docs/api/structures/hid-device": {
      "locale": "pt-BR",
      "slug": "hid-device",
      "href": "/docs/api/structures/hid-device",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/hid-device.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"hiddevice-object\"><a href=\"#hiddevice-object\">HIDDevice Object</a></h1>\n<ul>\n<li><code>deviceId</code> String - Unique identifier for the device.</li>\n<li><code>name</code> String - Name of the device.</li>\n<li><code>vendorId</code> Integer - The USB vendor ID.</li>\n<li><code>productId</code> Integer - The USB product ID.</li>\n<li><code>serialNumber</code> String (optional) - The USB device serial number.</li>\n<li><code>guid</code> String (optional) - Unique identifier for the HID interface.  A device may have multiple HID interfaces.</li>\n</ul>",
      "title": "HIDDevice Object",
      "description": ""
    },
    "/docs/api/in-app-purchase": {
      "locale": "pt-BR",
      "slug": "in-app-purchase",
      "href": "/docs/api/in-app-purchase",
      "crowdinFileId": "256325",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/in-app-purchase.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"inapppurchase\"><a href=\"#inapppurchase\">inAppPurchase</a></h1>\n<blockquote>\n<p>In-app purchases on Mac App Store.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h2 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h2>\n<p>O módulo <code>inAppPurchase</code> emite os seguintes eventos:</p>\n<h3 id=\"event-transactions-updated\"><a href=\"#event-transactions-updated\">Event: 'transactions-updated'</a></h3>\n<p>Emitted when one or more transactions have been updated.</p>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>transactions</code> Transaction[] - Array of <a href=\"/docs/api/structures/transaction\"><code>Transaction</code></a> objects.</li>\n</ul>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>inAppPurchase</code> tem os seguintes métodos:</p>\n<h3 id=\"inapppurchasepurchaseproductproductid-quantity\"><a href=\"#inapppurchasepurchaseproductproductid-quantity\"><code>inAppPurchase.purchaseProduct(productID[, quantity])</code></a></h3>\n<ul>\n<li><code>productID</code> String - The identifiers of the product to purchase. (The identifier of <code>com.example.app.product1</code> is <code>product1</code>).</li>\n<li><code>quantity</code> Integer (optional) - The number of items the user wants to purchase.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Boolean></code> - Returns <code>true</code> if the product is valid and added to the payment queue.</p>\n<p>You should listen for the <code>transactions-updated</code> event as soon as possible and certainly before you call <code>purchaseProduct</code>.</p>\n<h3 id=\"inapppurchasegetproductsproductids\"><a href=\"#inapppurchasegetproductsproductids\"><code>inAppPurchase.getProducts(productIDs)</code></a></h3>\n<ul>\n<li><code>productIDs</code> String[] - The identifiers of the products to get.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Product[]></code> - Resolves with an array of <a href=\"/docs/api/structures/product\"><code>Product</code></a> objects.</p>\n<p>Retrieves the product descriptions.</p>\n<h3 id=\"inapppurchasecanmakepayments\"><a href=\"#inapppurchasecanmakepayments\"><code>inAppPurchase.canMakePayments()</code></a></h3>\n<p>Returns <code>Boolean</code> - whether a user can make a payment.</p>\n<h3 id=\"inapppurchaserestorecompletedtransactions\"><a href=\"#inapppurchaserestorecompletedtransactions\"><code>inAppPurchase.restoreCompletedTransactions()</code></a></h3>\n<p>Restores finished transactions. This method can be called either to install purchases on additional devices, or to restore purchases for an application that the user deleted and reinstalled.</p>\n<p><a href=\"https://developer.apple.com/documentation/storekit/skpaymentqueue?language=objc\">The payment queue</a> delivers a new transaction for each previously completed transaction that can be restored. Each transaction includes a copy of the original transaction.</p>\n<h3 id=\"inapppurchasegetreceipturl\"><a href=\"#inapppurchasegetreceipturl\"><code>inAppPurchase.getReceiptURL()</code></a></h3>\n<p>Returns <code>String</code> - the path to the receipt.</p>\n<h3 id=\"inapppurchasefinishalltransactions\"><a href=\"#inapppurchasefinishalltransactions\"><code>inAppPurchase.finishAllTransactions()</code></a></h3>\n<p>Completes all pending transactions.</p>\n<h3 id=\"inapppurchasefinishtransactionbydatedate\"><a href=\"#inapppurchasefinishtransactionbydatedate\"><code>inAppPurchase.finishTransactionByDate(date)</code></a></h3>\n<ul>\n<li><code>date</code> String - The ISO formatted date of the transaction to finish.</li>\n</ul>\n<p>Completes the pending transactions corresponding to the date.</p>",
      "title": "inAppPurchase",
      "description": "In-app purchases on Mac App Store."
    },
    "/docs/tutorial/in-app-purchases": {
      "locale": "pt-BR",
      "slug": "in-app-purchases",
      "href": "/docs/tutorial/in-app-purchases",
      "crowdinFileId": "256203",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/in-app-purchases.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"in-app-purchases-macos\"><a href=\"#in-app-purchases-macos\">In-App Purchases (macOS)</a></h1>\n<h2 id=\"preparando\"><a href=\"#preparando\">Preparando</a></h2>\n<h3 id=\"contrato-de-aplicativos-pagos\"><a href=\"#contrato-de-aplicativos-pagos\">Contrato de aplicativos pagos</a></h3>\n<p>Se você ainda não o fez, precisará assinar o Contrato de aplicativos pagos e configurar suas informações bancárias e fiscais no iTunes Connect.</p>\n<p><a href=\"https://help.apple.com/itunes-connect/developer/#/devb6df5ee51\">Ajuda do desenvolvedor do iTunes Connect: Visão geral de contratos, impostos e serviços bancários</a></p>\n<h3 id=\"crie-suas-compras-no-aplicativo\"><a href=\"#crie-suas-compras-no-aplicativo\">Crie suas compras no aplicativo</a></h3>\n<p>Then, you'll need to configure your in-app purchases in iTunes Connect, and include details such as name, pricing, and description that highlights the features and functionality of your in-app purchase.</p>\n<p><a href=\"https://help.apple.com/itunes-connect/developer/#/devae49fb316\">iTunes Connect Developer Help: Create an in-app purchase</a></p>\n<h3 id=\"change-the-cfbundleidentifier\"><a href=\"#change-the-cfbundleidentifier\">Change the CFBundleIdentifier</a></h3>\n<p>To test In-App Purchase in development with Electron you'll have to change the <code>CFBundleIdentifier</code> in <code>node_modules/electron/dist/Electron.app/Contents/Info.plist</code>. You have to replace <code>com.github.electron</code> by the bundle identifier of the application you created with iTunes Connect.</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>CFBundleIdentifier<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>com.example.app<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n</code></pre>\n<h2 id=\"exemplo-de-código\"><a href=\"#exemplo-de-código\">Exemplo de código</a></h2>\n<p>Here is an example that shows how to use In-App Purchases in Electron. You'll have to replace the product ids by the identifiers of the products created with iTunes Connect (the identifier of <code>com.example.app.product1</code> is <code>product1</code>). Note that you have to listen to the <code>transactions-updated</code> event as soon as possible in your app.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { inAppPurchase } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> PRODUCT_IDS = [<span class=\"hljs-string\">'id1'</span>, <span class=\"hljs-string\">'id2'</span>]\n\n<span class=\"hljs-comment\">// Listen for transactions as soon as possible.</span>\ninAppPurchase.on(<span class=\"hljs-string\">'transactions-updated'</span>, (event, transactions) => {\n  <span class=\"hljs-keyword\">if</span> (!<span class=\"hljs-built_in\">Array</span>.isArray(transactions)) {\n    <span class=\"hljs-keyword\">return</span>\n  }\n\n  <span class=\"hljs-comment\">// Check each transaction.</span>\n  transactions.forEach(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\">transaction</span>) </span>{\n    <span class=\"hljs-keyword\">const</span> payment = transaction.payment\n\n    <span class=\"hljs-keyword\">switch</span> (transaction.transactionState) {\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'purchasing'</span>:\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Purchasing <span class=\"hljs-subst\">${payment.productIdentifier}</span>...`</span>)\n        <span class=\"hljs-keyword\">break</span>\n\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'purchased'</span>: {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${payment.productIdentifier}</span> purchased.`</span>)\n\n        <span class=\"hljs-comment\">// Get the receipt url.</span>\n        <span class=\"hljs-keyword\">const</span> receiptURL = inAppPurchase.getReceiptURL()\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Receipt URL: <span class=\"hljs-subst\">${receiptURL}</span>`</span>)\n\n        <span class=\"hljs-comment\">// Submit the receipt file to the server and check if it is valid.</span>\n        <span class=\"hljs-comment\">// @see https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html</span>\n        <span class=\"hljs-comment\">// ...</span>\n        <span class=\"hljs-comment\">// If the receipt is valid, the product is purchased</span>\n        <span class=\"hljs-comment\">// ...</span>\n\n        <span class=\"hljs-comment\">// Finish the transaction.</span>\n        inAppPurchase.finishTransactionByDate(transaction.transactionDate)\n\n        <span class=\"hljs-keyword\">break</span>\n      }\n\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'failed'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Failed to purchase <span class=\"hljs-subst\">${payment.productIdentifier}</span>.`</span>)\n\n        <span class=\"hljs-comment\">// Finish the transaction.</span>\n        inAppPurchase.finishTransactionByDate(transaction.transactionDate)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'restored'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The purchase of <span class=\"hljs-subst\">${payment.productIdentifier}</span> has been restored.`</span>)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'deferred'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The purchase of <span class=\"hljs-subst\">${payment.productIdentifier}</span> has been deferred.`</span>)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-attr\">default</span>:\n        <span class=\"hljs-keyword\">break</span>\n    }\n  })\n})\n\n<span class=\"hljs-comment\">// Check if the user is allowed to make in-app purchase.</span>\n<span class=\"hljs-keyword\">if</span> (!inAppPurchase.canMakePayments()) {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The user is not allowed to make in-app purchase.'</span>)\n}\n\n<span class=\"hljs-comment\">// Retrieve and display the product descriptions.</span>\ninAppPurchase.getProducts(PRODUCT_IDS).then(<span class=\"hljs-function\"><span class=\"hljs-params\">products</span> =></span> {\n  <span class=\"hljs-comment\">// Check the parameters.</span>\n  <span class=\"hljs-keyword\">if</span> (!<span class=\"hljs-built_in\">Array</span>.isArray(products) || products.length &#x3C;= <span class=\"hljs-number\">0</span>) {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Unable to retrieve the product informations.'</span>)\n    <span class=\"hljs-keyword\">return</span>\n  }\n\n  <span class=\"hljs-comment\">// Display the name and price of each product.</span>\n  products.forEach(<span class=\"hljs-function\"><span class=\"hljs-params\">product</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The price of <span class=\"hljs-subst\">${product.localizedTitle}</span> is <span class=\"hljs-subst\">${product.formattedPrice}</span>.`</span>)\n  })\n\n  <span class=\"hljs-comment\">// Ask the user which product he/she wants to purchase.</span>\n  <span class=\"hljs-keyword\">const</span> selectedProduct = products[<span class=\"hljs-number\">0</span>]\n  <span class=\"hljs-keyword\">const</span> selectedQuantity = <span class=\"hljs-number\">1</span>\n\n  <span class=\"hljs-comment\">// Purchase the selected product.</span>\n  inAppPurchase.purchaseProduct(selectedProduct.productIdentifier, selectedQuantity).then(<span class=\"hljs-function\"><span class=\"hljs-params\">isProductValid</span> =></span> {\n    <span class=\"hljs-keyword\">if</span> (!isProductValid) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The product is not valid.'</span>)\n      <span class=\"hljs-keyword\">return</span>\n    }\n\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The payment has been added to the payment queue.'</span>)\n  })\n})\n</code></pre>",
      "title": "In-App Purchases (macOS)",
      "description": ""
    },
    "/docs/api/incoming-message": {
      "locale": "pt-BR",
      "slug": "incoming-message",
      "href": "/docs/api/incoming-message",
      "crowdinFileId": "256327",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/incoming-message.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-incomingmessage\"><a href=\"#class-incomingmessage\">Class: IncomingMessage</a></h2>\n<blockquote>\n<p>Handle responses to HTTP/HTTPS requests.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>IncomingMessage</code> implements the <a href=\"https://nodejs.org/api/stream.html#stream_readable_streams\">Readable Stream</a> interface and is therefore an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h3 id=\"eventos-de-instância\"><a href=\"#eventos-de-instância\">Eventos de instância</a></h3>\n<h4 id=\"event-data\"><a href=\"#event-data\">Event: 'data'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>chunk</code> Buffer - A chunk of response body's data.</li>\n</ul>\n<p>The <code>data</code> event is the usual method of transferring response data into applicative code.</p>\n<h4 id=\"event-end\"><a href=\"#event-end\">Event: 'end'</a></h4>\n<p>Indicates that response body has ended. Must be placed before 'data' event.</p>\n<h4 id=\"event-aborted\"><a href=\"#event-aborted\">Event: 'aborted'</a></h4>\n<p>Emitido quando uma solicitação foi cancelada durante uma transação HTTP em curso.</p>\n<h4 id=\"evento-error\"><a href=\"#evento-error\">Evento: 'error'</a></h4>\n<p>Retorna:</p>\n<p><code>error</code> Error - Typically holds an error string identifying failure root cause.</p>\n<p>Emitido quando ocorreu um erro ao transmitir eventos de dados de resposta. For instance, if the server closes the underlying while the response is still streaming, an <code>error</code> event will be emitted on the response object and a <code>close</code> event will subsequently follow on the request object.</p>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<p>An <code>IncomingMessage</code> instance has the following readable properties:</p>\n<h4 id=\"responsestatuscode\"><a href=\"#responsestatuscode\"><code>response.statusCode</code></a></h4>\n<p>Um <code>Integer</code> indica o estado do código de resposta HTTP.</p>\n<h4 id=\"responsestatusmessage\"><a href=\"#responsestatusmessage\"><code>response.statusMessage</code></a></h4>\n<p>Uma <code>String</code> representa a mensagem de estado HTTP.</p>\n<h4 id=\"responseheaders\"><a href=\"#responseheaders\"><code>response.headers</code></a></h4>\n<p>A <code>Record&#x3C;string, string | string[]></code> representing the HTTP response headers. The <code>headers</code> object is formatted as follows:</p>\n<ul>\n<li>Todos os nomes de cabeçalho são em minúsculas.</li>\n<li>Duplicates of <code>age</code>, <code>authorization</code>, <code>content-length</code>, <code>content-type</code>, <code>etag</code>, <code>expires</code>, <code>from</code>, <code>host</code>, <code>if-modified-since</code>, <code>if-unmodified-since</code>, <code>last-modified</code>, <code>location</code>, <code>max-forwards</code>, <code>proxy-authorization</code>, <code>referer</code>, <code>retry-after</code>, <code>server</code>, or <code>user-agent</code> are discarded.</li>\n<li><code>set-cookie</code> is always an array. Duplicates are added to the array.</li>\n<li>For duplicate <code>cookie</code> headers, the values are joined together with '; '.</li>\n<li>For all other headers, the values are joined together with ', '.</li>\n</ul>\n<h4 id=\"responsehttpversion\"><a href=\"#responsehttpversion\"><code>response.httpVersion</code></a></h4>\n<p>A <code>String</code> indicating the HTTP protocol version number. Typical values are '1.0' or '1.1'. Additionally <code>httpVersionMajor</code> and <code>httpVersionMinor</code> are two Integer-valued readable properties that return respectively the HTTP major and minor version numbers.</p>\n<h4 id=\"responsehttpversionmajor\"><a href=\"#responsehttpversionmajor\"><code>response.httpVersionMajor</code></a></h4>\n<p>An <code>Integer</code> indicating the HTTP protocol major version number.</p>\n<h4 id=\"responsehttpversionminor\"><a href=\"#responsehttpversionminor\"><code>response.httpVersionMinor</code></a></h4>\n<p>An <code>Integer</code> indicating the HTTP protocol minor version number.</p>",
      "title": "IncomingMessage",
      "description": "Handle responses to HTTP/HTTPS requests."
    },
    "/docs/api/structures/input-event": {
      "locale": "pt-BR",
      "slug": "input-event",
      "href": "/docs/api/structures/input-event",
      "crowdinFileId": "256441",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"inputevent-object\"><a href=\"#inputevent-object\">InputEvent Object</a></h1>\n<ul>\n<li><code>modifiers</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of modifiers of the event, can be <code>shift</code>, <code>control</code>, <code>ctrl</code>, <code>alt</code>, <code>meta</code>, <code>command</code>, <code>cmd</code>, <code>isKeypad</code>, <code>isAutoRepeat</code>, <code>leftButtonDown</code>, <code>middleButtonDown</code>, <code>rightButtonDown</code>, <code>capsLock</code>, <code>numLock</code>, <code>left</code>, <code>right</code>.</li>\n</ul>",
      "title": "InputEvent Object",
      "description": ""
    },
    "/docs/tutorial/installation": {
      "locale": "pt-BR",
      "slug": "installation",
      "href": "/docs/tutorial/installation",
      "crowdinFileId": "256205",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/installation.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"advanced-installation-instructions\"><a href=\"#advanced-installation-instructions\">Advanced Installation Instructions</a></h1>\n<p>npm install electron --save-dev The preferred method is to install Electron as a development dependency in your app:</p>\n<pre><code class=\"hljs language-sh\">npm install electron --save-dev\n</code></pre>\n<p>Veja a <a href=\"/docs/tutorial/electron-versioning\">documentação de versionamento do Electron</a> para informação de como gerenciar as versões em seus aplicativos.</p>\n<h2 id=\"running-electron-ad-hoc\"><a href=\"#running-electron-ad-hoc\">Running Electron ad-hoc</a></h2>\n<p>If you're in a pinch and would prefer to not use <code>npm install</code> in your local project, you can also run Electron ad-hoc using the <a href=\"https://docs.npmjs.com/cli/v7/commands/npx\"><code>npx</code></a> command runner bundled with <code>npm</code>:</p>\n<pre><code class=\"hljs language-sh\">npx electron .\n</code></pre>\n<p>The above command will run the current working directory with Electron. Note that any dependencies in your app will not be installed.</p>\n<h2 id=\"personalização\"><a href=\"#personalização\">Personalização</a></h2>\n<p>Se você quer alterar a arquitetura que é baixada (Ex: <code>ia32</code> em uma máquina <code>x64</code>), você pode usar a opção <code>--arch</code> com npm install ou definir a variável de ambiente <code>npm_config_arch</code>:</p>\n<pre><code class=\"hljs language-shell\">npm install --arch=ia32 electron\n</code></pre>\n<p>Além de alterar a arquitetura, você pode também especificar a plataforma (ex: <code>win32</code>, <code>linux</code>, etc.) usando a opção <code>--platform</code>:</p>\n<pre><code class=\"hljs language-shell\">npm install --platform=win32 electron\n</code></pre>\n<h2 id=\"proxies\"><a href=\"#proxies\">Proxies</a></h2>\n<p>Se você necessitar usar um HTTP proxy, é preciso adicionar a variável para múltiplos valores,<code>ELECTRON_GET_USE_PROXY</code>, além das variáveis de ambientes adicionais, dependendo da versão do Node:</p>\n<ul>\n<li><a href=\"https://github.com/gajus/global-agent/blob/v2.1.5/README.md#environment-variables\">Node 10 and above</a></li>\n<li><a href=\"https://github.com/np-maintain/global-tunnel/blob/v2.7.1/README.md#auto-config\">Before Node 10</a></li>\n</ul>\n<h2 id=\"mirrors-e-caches-customizados\"><a href=\"#mirrors-e-caches-customizados\">Mirrors e Caches Customizados</a></h2>\n<p>Durante a instalação, o módulo <code>electron</code> vai se conectar para o <a href=\"https://github.com/electron/get\"><code>@electron/get</code></a> para fazer o download de binários pré-construídos do Electron para a sua plataforma. Ele fará isso entrando em contato a página de lançamento da GitHub (<code>https://github.com/electron/electron/releases/tag/v$VERSION</code>, onde <code>$VERSION</code> é a versão exata do Electron).</p>\n<p>Se você não conseguir acessar o GitHub ou precisar fornecer uma compilação personalizada, poderá fazê-lo fornecendo um espelho ou um diretório de cache existente.</p>\n<h4 id=\"mirror-espelhamento\"><a href=\"#mirror-espelhamento\">Mirror (espelhamento)</a></h4>\n<p>Você pode usar variáveis de ambiente para substituir a URL base, o caminho no qual procurar por binários Electron e o nome do arquivo binário. The URL used by <code>@electron/get</code> is composed as follows:</p>\n<pre><code class=\"hljs language-javascript\">url = ELECTRON_MIRROR + ELECTRON_CUSTOM_DIR + <span class=\"hljs-string\">'/'</span> + ELECTRON_CUSTOM_FILENAME\n</code></pre>\n<p>For instance, to use the China CDN mirror:</p>\n<pre><code class=\"hljs language-shell\">ELECTRON_MIRROR=\"https://cdn.npm.taobao.org/dist/electron/\"\n</code></pre>\n<p>By default, <code>ELECTRON_CUSTOM_DIR</code> is set to <code>v$VERSION</code>. To change the format, use the <code>{{ version }}</code> placeholder. For example, <code>version-{{ version }}</code> resolves to <code>version-5.0.0</code>, <code>{{ version }}</code> resolves to <code>5.0.0</code>, and <code>v{{ version }}</code> is equivalent to the default. As a more concrete example, to use the China non-CDN mirror:</p>\n<pre><code class=\"hljs language-shell\">ELECTRON_MIRROR=\"https://npm.taobao.org/mirrors/electron/\"\nELECTRON_CUSTOM_DIR=\"{{ version }}\"\n</code></pre>\n<p>The above configuration will download from URLs such as <code>https://npm.taobao.org/mirrors/electron/8.0.0/electron-v8.0.0-linux-x64.zip</code>.</p>\n<p>If your mirror serves artifacts with different checksums to the official Electron release you may have to set <code>ELECTRON_USE_REMOTE_CHECKSUMS=1</code> to force Electron to use the remote <code>SHASUMS256.txt</code> file to verify the checksum instead of the embedded checksums.</p>\n<h4 id=\"cache\"><a href=\"#cache\">Cache</a></h4>\n<p>Como alternativa, você pode substituir o cache local. O <code>@electron/get</code> armazenará em cache os binários baixados em um diretório local para não estressar sua rede. Você pode usar essa pasta de cache para fornecer construções personalizadas do Electron ou evitar contato com a rede.</p>\n<ul>\n<li>Linux: <code>$XDG_CACHE_HOME</code> ou <code>~/.cache/electron/</code></li>\n<li>macOS: <code>~/Library/Caches/electron/</code></li>\n<li>Windows: <code>$LOCALAPPDATA/electron/Cache</code> ou <code>~/AppData/Local/electron/Cache/</code></li>\n</ul>\n<p>Em ambientes que usam versões mais antigas do Electron, você pode encontrar cache também em <code>~/.electron</code>.</p>\n<p>Você também pode sobrescrever o local do cache local fornecendo uma variável <code>electron_config_cache</code> de ambiente.</p>\n<p>The cache contains the version's official zip file as well as a checksum, stored as a text file. A typical cache might look like this:</p>\n<pre><code class=\"hljs language-sh\">├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9electron-v1.7.9-darwin-x64.zip\n│   └── electron-v1.7.9-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1electron-v1.8.1-darwin-x64.zip\n│   └── electron-v1.8.1-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1electron-v1.8.2-beta.1-darwin-x64.zip\n│   └── electron-v1.8.2-beta.1-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2electron-v1.8.2-beta.2-darwin-x64.zip\n│   └── electron-v1.8.2-beta.2-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3electron-v1.8.2-beta.3-darwin-x64.zip\n│   └── electron-v1.8.2-beta.3-darwin-x64.zip\n└── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3SHASUMS256.txt\n    └── SHASUMS256.txt\n</code></pre>\n<h2 id=\"skip-binary-download\"><a href=\"#skip-binary-download\">Skip binary download</a></h2>\n<p>Under the hood, Electron's JavaScript API binds to a binary that contains its implementations. Because this binary is crucial to the function of any Electron app, it is downloaded by default in the <code>postinstall</code> step every time you install <code>electron</code> from the npm registry.</p>\n<p>However, if you want to install your project's dependencies but don't need to use Electron functionality, you can set the <code>ELECTRON_SKIP_BINARY_DOWNLOAD</code> environment variable to prevent the binary from being downloaded. For instance, this feature can be useful in continuous integration environments when running unit tests that mock out the <code>electron</code> module.</p>\n<pre><code class=\"hljs language-sh\">ELECTRON_SKIP_BINARY_DOWNLOAD=1 npm install\n</code></pre>\n<h2 id=\"solução-de-problemas\"><a href=\"#solução-de-problemas\">Solução de Problemas</a></h2>\n<p>Ao executar o <code>npm install electron</code>, alguns usuários encontram erros de instalação.</p>\n<p>Em quase todos os casos, esses problemas são resultado de problemas de rede e não de problemas reais com o pacote npm <code>electron</code>. Erros como <code>ELIFECYCLE</code>, <code>EAI_AGAIN</code>, <code>ECONNRESET</code>, e <code>ETIMEDOUT</code> são resultados da falta de internet. A melhor solução é tentar trocar de rede, ou aguardar um pouco e tentar instalar novamente.</p>\n<p>You can also attempt to download Electron directly from <a href=\"https://github.com/electron/electron/releases\">electron/electron/releases</a> if installing via <code>npm</code> is failing.</p>\n<p>If installation fails with an <code>EACCESS</code> error you may need to <a href=\"https://docs.npmjs.com/getting-started/fixing-npm-permissions\">fix your npm permissions</a>.</p>\n<p>If the above error persists, the <a href=\"https://docs.npmjs.com/misc/config#unsafe-perm\">unsafe-perm</a> flag may need to be set to true:</p>\n<pre><code class=\"hljs language-sh\">sudo npm install electron --unsafe-perm=<span class=\"hljs-literal\">true</span>\n</code></pre>\n<p>Em redes mais lentas, pode ser aconselhável usar o sinalizador <code>--verbose</code> para mostrar o progresso do download:</p>\n<pre><code class=\"hljs language-sh\">npm install --verbose electron\n</code></pre>\n<p>Se você precisar forçar um novo download do ativo e o arquivo SHASUM, defina a variável <code>force_no_cache</code> do ambiente para <code>true</code>.</p>",
      "title": "Advanced Installation Instructions",
      "description": ""
    },
    "/docs/tutorial/introduction": {
      "locale": "pt-BR",
      "slug": "introduction",
      "href": "/docs/tutorial/introduction",
      "crowdinFileId": "256207",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/introduction.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"introdução\"><a href=\"#introdução\">Introdução</a></h1>\n<p>Bem vindo a documentação do Electron Se esta é a primeira vez que desenvolve um aplicativo com Electron, leia esta seção de Introdução para se familiarizar com o básico. Caso contrário, sinta-se à vontade para explorar nossos guias e documentação da API!</p>\n<h2 id=\"o-que-é-o-electron\"><a href=\"#o-que-é-o-electron\">O que é o Electron?</a></h2>\n<p>Electron é um framework que te permite criar aplicações desktop com JavaScript, HTML e CSS. Incorporando [Chromium][chromium] e [Node.js][node] no seu binário, Electron permite que você mantenha uma base de código para JavaScript e crie aplicações multiplataforma que funcionam no Windows macOS, e Linux — sem necessidade de experiência de desenvolvimento nativo.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<p>Estes documentos operam sob a suposição de que o leitor está familiarizado com Node.js e desenvolvimento web geral. Se você precisar se sentir mais confortável com qualquer uma dessas áreas, recomendamos os seguintes recursos:</p>\n<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web\">Introdução à Web (MDN)</a></li>\n<li><a href=\"https://nodejs.dev/learn\">Introdução ao Node.js</a></li>\n</ul>\n<p>Além disso, você terá um tempo melhor para entender como o Electron funciona se você tiver conhecido o modelo de processo do Chromium. Você pode ter uma breve visão geral de Arquitetura do Chrome com a <a href=\"https://www.google.com/googlebooks/chrome/\"> história do Chrome </a>, que foi lançada junto com Lançamento do Chrome em 2008. Embora já tenha mais de uma década desde então, os princípios fundamentais introduzidos na Google Comic permanecem úteis para entender a Electron.</p>\n<h2 id=\"exemplos-de-execução-com-electron-fiddle\"><a href=\"#exemplos-de-execução-com-electron-fiddle\">Exemplos de execução com Electron Fiddle</a></h2>\n<p><a href=\"https://electronjs.org/fiddle\"> Electron Fiddle </a> é um aplicativo sandbox escrito com Electron e suportado por mantenedores do Electron. É altamente recomendável instalá-lo como uma ferramenta de aprendizado para experiências com APIs do Electron, ou para protótipos de recursos durante o desenvolvimento.</p>\n<p>O Fiddle também se integra muito bem com a nossa documentação. Ao navegar pelos exemplos em nossos tutoriais, você frequentemente verá um botão \"Abrir no Electron Fiddle\" abaixo de um bloco de código. Se você tiver o Fiddle instalado, este botão abrirá um <code>fiddle.electronjs. rg</code> link que carregará automaticamente o exemplo no Fiddle, nenhuma cópia é necessária.</p>\n<h2 id=\"você-precisa-de-ajuda\"><a href=\"#você-precisa-de-ajuda\">Você precisa de ajuda</a></h2>\n<p>Você está ficando preso em algum lugar? Aqui estão alguns links de lugares para procurar:</p>\n<ul>\n<li>Se precisar de ajuda com o desenvolvimento de seu aplicativo, nosso <a href=\"https://discord.gg/electron\"> servidor do Discord da comunidade </a> é um ótimo lugar para obter conselhos de outros desenvolvedores de aplicativos Electron.</li>\n<li>Se você suspeitar que está encontrando um bug no <code>electron</code>, verifique o <a href=\"https://github.com/electron/electron/issues\"> problemas no GitHub </a> para ver se algum problema existente corresponde ao seu problema Caso contrário, sinta-se à vontade para preencher o nosso modelo de relatório de erros e envie uma nova issue.</li>\n</ul>",
      "title": "Introdução",
      "description": ""
    },
    "/docs/api/structures/io-counters": {
      "locale": "pt-BR",
      "slug": "io-counters",
      "href": "/docs/api/structures/io-counters",
      "crowdinFileId": "256443",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/io-counters.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"iocounters-object\"><a href=\"#iocounters-object\">IOCounters Object</a></h1>\n<ul>\n<li><code>readOperationCount</code> Number - The number of I/O read operations.</li>\n<li><code>writeOperationCount</code> Number - The number of I/O write operations.</li>\n<li><code>otherOperationCount</code> Number - Then number of I/O other operations.</li>\n<li><code>readTransferCount</code> Number - The number of I/O read transfers.</li>\n<li><code>writeTransferCount</code> Number - The number of I/O write transfers.</li>\n<li><code>otherTransferCount</code> Number - Then number of I/O other transfers.</li>\n</ul>",
      "title": "IOCounters Object",
      "description": ""
    },
    "/docs/api/ipc-main": {
      "locale": "pt-BR",
      "slug": "ipc-main",
      "href": "/docs/api/ipc-main",
      "crowdinFileId": "256329",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/ipc-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmain\"><a href=\"#ipcmain\">ipcMain</a></h1>\n<blockquote>\n<p>Comunica de forma assíncrona o processo principal aos processos de renderização.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>O módulo <code>ipcMain</code> é um <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">emissor de eventos</a>. Quando usado no processo principal, ele lida com mensagens assíncronas e síncronas enviadas a partir de um processo de renderização (página da web). As mensagens enviadas de um renderizador serão emitidas para este módulo.</p>\n<h2 id=\"enviando-mensagens\"><a href=\"#enviando-mensagens\">Enviando Mensagens</a></h2>\n<p>Também é possível enviar mensagens do processo principal para o processo de renderização, veja <a href=\"/docs/api/web-contents#contentssendchannel-args\">webContents.send</a> para obter mais informações.</p>\n<ul>\n<li>Ao enviar uma mensagem, o nome do evento é o <code>channel</code>.</li>\n<li>Para responder a uma mensagem síncrona, você precisa de configurar <code>event.returnValue</code>.</li>\n<li>Para enviar uma mensagem assíncrona de volta para o remetente, você pode usar <code>event.reply(...)</code>.  This helper method will automatically handle messages coming from frames that aren't the main frame (e.g. iframes) whereas <code>event.sender.send(...)</code> will always send to the main frame.</li>\n</ul>\n<p>Um exemplo de enviar e manipular mensagens entre os processos de renderização e principais:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In main process.</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'asynchronous-message'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"ping\"</span>\n  event.reply(<span class=\"hljs-string\">'asynchronous-reply'</span>, <span class=\"hljs-string\">'pong'</span>)\n})\n\nipcMain.on(<span class=\"hljs-string\">'synchronous-message'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"ping\"</span>\n  event.returnValue = <span class=\"hljs-string\">'pong'</span>\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In renderer process (web page).</span>\n<span class=\"hljs-comment\">// NB. Electron APIs are only accessible from preload, unless contextIsolation is disabled.</span>\n<span class=\"hljs-comment\">// See https://www.electronjs.org/docs/tutorial/process-model#preload-scripts for more details.</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(ipcRenderer.sendSync(<span class=\"hljs-string\">'synchronous-message'</span>, <span class=\"hljs-string\">'ping'</span>)) <span class=\"hljs-comment\">// prints \"pong\"</span>\n\nipcRenderer.on(<span class=\"hljs-string\">'asynchronous-reply'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"pong\"</span>\n})\nipcRenderer.send(<span class=\"hljs-string\">'asynchronous-message'</span>, <span class=\"hljs-string\">'ping'</span>)\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>ipcMain</code> possui o seguinte método para ouvir eventos:</p>\n<h3 id=\"ipcmainonchannel-listener\"><a href=\"#ipcmainonchannel-listener\"><code>ipcMain.on(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Função<ul>\n<li><code>event</code> IpcMainEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Ouve o <code>channel</code>, quando uma mensagem chega, o <code>listener</code> deve ser chamado com <code>listener(event, args...)</code>.</p>\n<h3 id=\"ipcmainoncechannel-listener\"><a href=\"#ipcmainoncechannel-listener\"><code>ipcMain.once(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Função<ul>\n<li><code>event</code> IpcMainEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Adds a one time <code>listener</code> function for the event. This <code>listener</code> is invoked only the next time a message is sent to <code>channel</code>, after which it is removed.</p>\n<h3 id=\"ipcmainremovelistenerchannel-listener\"><a href=\"#ipcmainremovelistenerchannel-listener\"><code>ipcMain.removeListener(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Função<ul>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Removes the specified <code>listener</code> from the listener array for the specified <code>channel</code>.</p>\n<h3 id=\"ipcmainremovealllistenerschannel\"><a href=\"#ipcmainremovealllistenerschannel\"><code>ipcMain.removeAllListeners([channel])</code></a></h3>\n<ul>\n<li><code>channel</code> String (opcional)</li>\n</ul>\n<p>Removes listeners of the specified <code>channel</code>.</p>\n<h3 id=\"ipcmainhandlechannel-listener\"><a href=\"#ipcmainhandlechannel-listener\"><code>ipcMain.handle(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function&#x3C;Promise\\<void> | any><ul>\n<li><code>event</code> IpcMainInvokeEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></void></li>\n</ul>\n<p>Adds a handler for an <code>invoke</code>able IPC. This handler will be called whenever a renderer calls <code>ipcRenderer.invoke(channel, ...args)</code>.</p>\n<p>If <code>listener</code> returns a Promise, the eventual result of the promise will be returned as a reply to the remote caller. Otherwise, the return value of the listener will be used as the value of the reply.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\nipcMain.handle(<span class=\"hljs-string\">'my-invokable-ipc'</span>, <span class=\"hljs-keyword\">async</span> (event, ...args) => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> somePromise(...args)\n  <span class=\"hljs-keyword\">return</span> result\n})\n\n<span class=\"hljs-comment\">// Renderer process</span>\n<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> ipcRenderer.invoke(<span class=\"hljs-string\">'my-invokable-ipc'</span>, arg1, arg2)\n  <span class=\"hljs-comment\">// ...</span>\n}\n</code></pre>\n<p>The <code>event</code> that is passed as the first argument to the handler is the same as that passed to a regular event listener. It includes information about which WebContents is the source of the invoke request.</p>\n<p>Errors thrown through <code>handle</code> in the main process are not transparent as they are serialized and only the <code>message</code> property from the original error is provided to the renderer process. Please refer to <a href=\"https://github.com/electron/electron/issues/24427\">#24427</a> for details.</p>\n<h3 id=\"ipcmainhandleoncechannel-listener\"><a href=\"#ipcmainhandleoncechannel-listener\"><code>ipcMain.handleOnce(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function&#x3C;Promise\\<void> | any><ul>\n<li><code>event</code> IpcMainInvokeEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></void></li>\n</ul>\n<p>Handles a single <code>invoke</code>able IPC message, then removes the listener. See <code>ipcMain.handle(channel, listener)</code>.</p>\n<h3 id=\"ipcmainremovehandlerchannel\"><a href=\"#ipcmainremovehandlerchannel\"><code>ipcMain.removeHandler(channel)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n</ul>\n<p>Removes any handler for <code>channel</code>, if present.</p>\n<h2 id=\"ipcmainevent-object\"><a href=\"#ipcmainevent-object\">IpcMainEvent object</a></h2>\n<p>The documentation for the <code>event</code> object passed to the <code>callback</code> can be found in the <a href=\"/docs/api/structures/ipc-main-event\"><code>ipc-main-event</code></a> structure docs.</p>\n<h2 id=\"ipcmaininvokeevent-object\"><a href=\"#ipcmaininvokeevent-object\">IpcMainInvokeEvent object</a></h2>\n<p>The documentation for the <code>event</code> object passed to <code>handle</code> callbacks can be found in the <a href=\"/docs/api/structures/ipc-main-invoke-event\"><code>ipc-main-invoke-event</code></a> structure docs.</p>",
      "title": "ipcMain",
      "description": "Comunica de forma assíncrona o processo principal aos processos de renderização."
    },
    "/docs/api/structures/ipc-main-event": {
      "locale": "pt-BR",
      "slug": "ipc-main-event",
      "href": "/docs/api/structures/ipc-main-event",
      "crowdinFileId": "256445",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-main-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmainevent-object-extends-event\"><a href=\"#ipcmainevent-object-extends-event\">IpcMainEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>processId</code> Integer - The internal ID of the renderer process that sent this message</li>\n<li><code>frameId</code> Integer - The ID of the renderer frame that sent this message</li>\n<li><code>returnValue</code> any - Set this to the value to be returned in a synchronous message</li>\n<li><code>sender</code> WebContents - Returns the <code>webContents</code> that sent the message</li>\n<li><code>senderFrame</code> WebFrameMain <em>Readonly</em> - The frame that sent this message</li>\n<li><code>ports</code> MessagePortMain[] - A list of MessagePorts that were transferred with this message</li>\n<li><code>reply</code> Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling.  You should use this method to \"reply\" to the sent message in order to guarantee the reply will go to the correct process and frame.<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>",
      "title": "IpcMainEvent Object extends Event",
      "description": ""
    },
    "/docs/api/structures/ipc-main-invoke-event": {
      "locale": "pt-BR",
      "slug": "ipc-main-invoke-event",
      "href": "/docs/api/structures/ipc-main-invoke-event",
      "crowdinFileId": "256447",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-main-invoke-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmaininvokeevent-object-extends-event\"><a href=\"#ipcmaininvokeevent-object-extends-event\">IpcMainInvokeEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>processId</code> Integer - The internal ID of the renderer process that sent this message</li>\n<li><code>frameId</code> Integer - The ID of the renderer frame that sent this message</li>\n<li><code>sender</code> WebContents - Returns the <code>webContents</code> that sent the message</li>\n<li><code>senderFrame</code> WebFrameMain <em>Readonly</em> - The frame that sent this message</li>\n</ul>",
      "title": "IpcMainInvokeEvent Object extends Event",
      "description": ""
    },
    "/docs/api/ipc-renderer": {
      "locale": "pt-BR",
      "slug": "ipc-renderer",
      "href": "/docs/api/ipc-renderer",
      "crowdinFileId": "256331",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/ipc-renderer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcrenderer\"><a href=\"#ipcrenderer\">ipcRenderer</a></h1>\n<blockquote>\n<p>Comunica de forma assíncrona de um processo de renderização para o processo principal.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#renderer-process\">Renderizador</a></p>\n<p>O módulo <code>ipcRenderer</code> é um <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>. Ele fornece alguns métodos para que você possa enviar mensagens síncronas e assíncronas do processo de renderização (página da web) para o processo principal. Você também pode receber respostas do processo principal.</p>\n<p>Veja <a href=\"/docs/api/ipc-main\">ipcMain</a> para exemplos de código.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>ipcRenderer</code> possui o seguinte método para ouvir eventos e enviar mensagens:</p>\n<h3 id=\"ipcrendereronchannel-listener\"><a href=\"#ipcrendereronchannel-listener\"><code>ipcRenderer.on(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Função<ul>\n<li><code>event</code> IpcRendererEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Ouve o <code>channel</code>, quando uma mensagem chega, o <code>listener</code> deve ser chamado com <code>listener(event, args...)</code>.</p>\n<h3 id=\"ipcrendereroncechannel-listener\"><a href=\"#ipcrendereroncechannel-listener\"><code>ipcRenderer.once(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Função<ul>\n<li><code>event</code> IpcRendererEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Adds a one time <code>listener</code> function for the event. This <code>listener</code> is invoked only the next time a message is sent to <code>channel</code>, after which it is removed.</p>\n<h3 id=\"ipcrendererremovelistenerchannel-listener\"><a href=\"#ipcrendererremovelistenerchannel-listener\"><code>ipcRenderer.removeListener(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Função<ul>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Removes the specified <code>listener</code> from the listener array for the specified <code>channel</code>.</p>\n<h3 id=\"ipcrendererremovealllistenerschannel\"><a href=\"#ipcrendererremovealllistenerschannel\"><code>ipcRenderer.removeAllListeners(channel)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n</ul>\n<p>Remove todos os listeners, ou apenas os do <code>channel</code> especificado.</p>\n<h3 id=\"ipcrenderersendchannel-args\"><a href=\"#ipcrenderersendchannel-args\"><code>ipcRenderer.send(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Envie uma mensagem assíncrona para o processo principal através do <code>channel</code>, juntamente com argumentos. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be included. O envio de funções, promessas, símbolos, weakmaps ou WeakSets lançará uma exceção.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over Electron's IPC to the main process, as the main process would have no way to decode them. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>The main process handles it by listening for <code>channel</code> with the <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> module.</p>\n<p>If you need to transfer a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> to the main process, use <a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a>.</p>\n<p>If you want to receive a single response from the main process, like the result of a method call, consider using <a href=\"#ipcrendererinvokechannel-args\"><code>ipcRenderer.invoke</code></a>.</p>\n<h3 id=\"ipcrendererinvokechannel-args\"><a href=\"#ipcrendererinvokechannel-args\"><code>ipcRenderer.invoke(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - Resolves with the response from the main process.</p>\n<p>Send a message to the main process via <code>channel</code> and expect a result asynchronously. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be included. O envio de funções, promessas, símbolos, weakmaps ou WeakSets lançará uma exceção.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over Electron's IPC to the main process, as the main process would have no way to decode them. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>The main process should listen for <code>channel</code> with <a href=\"/docs/api/ipc-main#ipcmainhandlechannel-listener\"><code>ipcMain.handle()</code></a>.</p>\n<p>Como por exemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.invoke(<span class=\"hljs-string\">'some-name'</span>, someArgument).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">result</span>) =></span> {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// Main process</span>\nipcMain.handle(<span class=\"hljs-string\">'some-name'</span>, <span class=\"hljs-keyword\">async</span> (event, someArgument) => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> doSomeWork(someArgument)\n  <span class=\"hljs-keyword\">return</span> result\n})\n</code></pre>\n<p>If you need to transfer a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> to the main process, use <a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a>.</p>\n<p>If you do not need a response to the message, consider using <a href=\"#ipcrenderersendchannel-args\"><code>ipcRenderer.send</code></a>.</p>\n<h3 id=\"ipcrenderersendsyncchannel-args\"><a href=\"#ipcrenderersendsyncchannel-args\"><code>ipcRenderer.sendSync(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Returns <code>any</code> - The value sent back by the <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> handler.</p>\n<p>Send a message to the main process via <code>channel</code> and expect a result synchronously. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be included. O envio de funções, promessas, símbolos, weakmaps ou WeakSets lançará uma exceção.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over Electron's IPC to the main process, as the main process would have no way to decode them. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>The main process handles it by listening for <code>channel</code> with <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> module, and replies by setting <code>event.returnValue</code>.</p>\n<blockquote>\n<p>⚠️ <strong>WARNING</strong>: Sending a synchronous message will block the whole renderer process until the reply is received, so use this method only as a last resort. It's much better to use the asynchronous version, <a href=\"/docs/api/ipc-renderer#ipcrendererinvokechannel-args\"><code>invoke()</code></a>.</p>\n</blockquote>\n<h3 id=\"ipcrendererpostmessagechannel-message-transfer\"><a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage(channel, message, [transfer])</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePort<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Send a message to the main process, optionally transferring ownership of zero or more <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> objects.</p>\n<p>The transferred <code>MessagePort</code> objects will be available in the main process as <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> objects by accessing the <code>ports</code> property of the emitted event.</p>\n<p>Como por exemplo:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Renderer process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannel()\nipcRenderer.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Main process</span>\nipcMain.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<p>For more information on using <code>MessagePort</code> and <code>MessageChannel</code>, see the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\">MDN documentation</a>.</p>\n<h3 id=\"ipcrenderersendtowebcontentsid-channel-args\"><a href=\"#ipcrenderersendtowebcontentsid-channel-args\"><code>ipcRenderer.sendTo(webContentsId, channel, ...args)</code></a></h3>\n<ul>\n<li><code>webContentsId</code> Number</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Sends a message to a window with <code>webContentsId</code> via <code>channel</code>.</p>\n<h3 id=\"ipcrenderersendtohostchannel-args\"><a href=\"#ipcrenderersendtohostchannel-args\"><code>ipcRenderer.sendToHost(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Like <code>ipcRenderer.send</code> but the event will be sent to the <code>&#x3C;webview></code> element in the host page instead of the main process.</p>\n<h2 id=\"event-object\"><a href=\"#event-object\">Event object</a></h2>\n<p>The documentation for the <code>event</code> object passed to the <code>callback</code> can be found in the <a href=\"/docs/api/structures/ipc-renderer-event\"><code>ipc-renderer-event</code></a> structure docs.</p>",
      "title": "ipcRenderer",
      "description": "Comunica de forma assíncrona de um processo de renderização para o processo principal."
    },
    "/docs/api/structures/ipc-renderer-event": {
      "locale": "pt-BR",
      "slug": "ipc-renderer-event",
      "href": "/docs/api/structures/ipc-renderer-event",
      "crowdinFileId": "256449",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-renderer-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcrendererevent-object-extends-event\"><a href=\"#ipcrendererevent-object-extends-event\">IpcRendererEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>sender</code> IpcRenderer - The <code>IpcRenderer</code> instance that emitted the event originally</li>\n<li><code>senderId</code> Integer - The <code>webContents.id</code> that sent the message, you can call <code>event.sender.sendTo(event.senderId, ...)</code> to reply to the message, see <a href=\"/docs/api/ipc-renderer#ipcrenderersendtowebcontentsid-channel-args\">ipcRenderer.sendTo</a> for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set <code>event.senderId</code> to <code>0</code>.</li>\n<li><code>ports</code> MessagePort[] - A list of MessagePorts that were transferred with this message</li>\n</ul>",
      "title": "IpcRendererEvent Object extends Event",
      "description": ""
    },
    "/docs/development/issues": {
      "locale": "pt-BR",
      "slug": "issues",
      "href": "/docs/development/issues",
      "crowdinFileId": "256159",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/issues.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"questões-com-o-electron\"><a href=\"#questões-com-o-electron\">Questões com o Electron</a></h1>\n<ul>\n<li><a href=\"#how-to-contribute-to-issues\">How to Contribute to Issues</a></li>\n<li><a href=\"#asking-for-general-help\">Perguntas Sobre de Ajuda Geral</a></li>\n<li><a href=\"#submitting-a-bug-report\">Enviando um Relatório de Erro</a></li>\n<li><a href=\"#triaging-a-bug-report\">Fazendo Triagem de um Relatório de Erro</a></li>\n<li><a href=\"#resolving-a-bug-report\">Resolvendo um Relatório de Erro</a></li>\n</ul>\n<h2 id=\"how-to-contribute-to-issues\"><a href=\"#how-to-contribute-to-issues\">How to Contribute to Issues</a></h2>\n<p>Para qualquer problema, existem fundamentalmente três maneiras que alguém pode contribuir:</p>\n<ol>\n<li>By opening the issue for discussion: If you believe that you have found a new bug in Electron, you should report it by creating a new issue in the <a href=\"https://github.com/electron/electron/issues\"><code>electron/electron</code> issue tracker</a>.</li>\n<li>Ajudando a fazer uma triagem acerca do problema: Você pode fazer-lo fornecendo detalhes assistivos (um teste o qual apresenta um bug) ou fornecer sugestões para ajudar com o problema.</li>\n<li>Ajudando à resolver o problema: Isso pode ser feito demonstrando que o problema não é problema ou já foi resolvido; so que mais frequentemente, abrindo uma requisição à qual muda a fonte do problema no <code>electron/electron</code> de uma forma concreta e revisável.</li>\n</ol>\n<h2 id=\"perguntas-sobre-de-ajuda-geral\"><a href=\"#perguntas-sobre-de-ajuda-geral\">Perguntas Sobre de Ajuda Geral</a></h2>\n<p><a href=\"/docs/tutorial/support#finding-support\">\"Encontrando Suporte\"</a> tem uma lista com informações para obter ajuda de programação, reportar problemas de segurança, contribuir e mais. Por favor, utilize o rastreador de problemas apenas para bugs!</p>\n<h2 id=\"enviando-um-relatório-de-erro\"><a href=\"#enviando-um-relatório-de-erro\">Enviando um Relatório de Erro</a></h2>\n<p>To submit a bug report:</p>\n<p>When opening a new issue in the <a href=\"https://github.com/electron/electron/issues/new/choose\"><code>electron/electron</code> issue tracker</a>, users will be presented with a template that should be filled in.</p>\n<p>If you believe that you have found a bug in Electron, please fill out the template to the best of your ability.</p>\n<p>As duas informações mais importantes necessárias para avaliar o relato de um bug são a descrição e um caso de teste simples para recriá-lo. It is easier to fix a bug if it can be reproduced.</p>\n<p>Veja <a href=\"https://stackoverflow.com/help/mcve\">Como criar um exemplo Mínimo, Completo e Verificável</a>.</p>\n<h2 id=\"fazendo-triagem-de-um-relatório-de-erro\"><a href=\"#fazendo-triagem-de-um-relatório-de-erro\">Fazendo Triagem de um Relatório de Erro</a></h2>\n<p>É comum que questões abertas envolvam discussão. Alguns contribuidores podem diferir em opiniões em relação ao comportamento ser um bug ou uma característica. Esta discussão faz parte do processo e deve ser mantida em foco, útil, e profissional.</p>\n<p>Respostas que não fornecem contexto adicional nem detalhes de suporte não são úteis ou profissionais. Para muitos, essas respostas são irritantes e nada amigáveis.</p>\n<p>Os colaboradores são encorajados a resolver problemas colaborativamente e ajudar uns aos outros a fazer progresso. If you encounter an issue that you feel is invalid, or which contains incorrect information, explain <em>why</em> you feel that way with additional supporting context, and be willing to be convinced that you may be wrong. Ao fazê-lo, podemos frequentemente chegar mais rapidamente ao resultado correto.</p>\n<h2 id=\"resolvendo-um-relatório-de-erro\"><a href=\"#resolvendo-um-relatório-de-erro\">Resolvendo um Relatório de Erro</a></h2>\n<p>A maioria das questões são resolvidas abrindo um pull request. O processo para abertura e revisão de um pull request é semelhante ao de abertura e triagem de questões, mas carrega consigo um fluxo de trabalho de revisão e aprovação necessário que garante que as alterações propostas atendem às orientações de qualidade mínima e funcionais do projeto Electron.</p>",
      "title": "Questões com o Electron",
      "description": ""
    },
    "/docs/api/structures/jump-list-category": {
      "locale": "pt-BR",
      "slug": "jump-list-category",
      "href": "/docs/api/structures/jump-list-category",
      "crowdinFileId": "256451",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/jump-list-category.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"jumplistcategory-object\"><a href=\"#jumplistcategory-object\">JumpListCategory Object</a></h1>\n<ul>\n<li><code>type</code> String (optional) - One of the following:<ul>\n<li><code>tasks</code> - Items in this category will be placed into the standard <code>Tasks</code> category. There can be only one such category, and it will always be displayed at the bottom of the Jump List.</li>\n<li><code>frequent</code> - Displays a list of files frequently opened by the app, the name of the category and its items are set by Windows.</li>\n<li><code>recent</code> - Displays a list of files recently opened by the app, the name of the category and its items are set by Windows. Items may be added to this category indirectly using <code>app.addRecentDocument(path)</code>.</li>\n<li><code>custom</code> - Displays tasks or file links, <code>name</code> must be set by the app.</li>\n</ul></li>\n<li><code>name</code> String (optional) - Must be set if <code>type</code> is <code>custom</code>, otherwise it should be omitted.</li>\n<li><code>items</code> JumpListItem<a href=\"/docs/api/structures/optional\"></a> - Array of <a href=\"/docs/api/structures/jump-list-item\"><code>JumpListItem</code></a> objects if <code>type</code> is <code>tasks</code> or <code>custom</code>, otherwise it should be omitted.</li>\n</ul>\n<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>\n<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>",
      "title": "JumpListCategory Object",
      "description": ""
    },
    "/docs/api/structures/jump-list-item": {
      "locale": "pt-BR",
      "slug": "jump-list-item",
      "href": "/docs/api/structures/jump-list-item",
      "crowdinFileId": "256453",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/jump-list-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"jumplistitem-object\"><a href=\"#jumplistitem-object\">JumpListItem Object</a></h1>\n<ul>\n<li><code>type</code> String (optional) - One of the following:<ul>\n<li><code>task</code> - A task will launch an app with specific arguments.</li>\n<li><code>separator</code> - Can be used to separate items in the standard <code>Tasks</code> category.</li>\n<li><code>file</code> - A file link will open a file using the app that created the Jump List, for this to work the app must be registered as a handler for the file type (though it doesn't have to be the default handler).</li>\n</ul></li>\n<li><code>path</code> String (optional) - Path of the file to open, should only be set if <code>type</code> is <code>file</code>.</li>\n<li><code>program</code> String (optional) - Path of the program to execute, usually you should specify <code>process.execPath</code> which opens the current program. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>args</code> String (optional) - The command line arguments when <code>program</code> is executed. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>title</code> String (optional) - The text to be displayed for the item in the Jump List. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>description</code> String (optional) - Description of the task (displayed in a tooltip). Should only be set if <code>type</code> is <code>task</code>. Maximum length 260 characters.</li>\n<li><code>iconPath</code> String (optional) - The absolute path to an icon to be displayed in a Jump List, which can be an arbitrary resource file that contains an icon (e.g. <code>.ico</code>, <code>.exe</code>, <code>.dll</code>). You can usually specify <code>process.execPath</code> to show the program icon.</li>\n<li><code>iconIndex</code> Number (optional) - The index of the icon in the resource file. If a resource file contains multiple icons this value can be used to specify the zero-based index of the icon that should be displayed for this task. If a resource file contains only one icon, this property should be set to zero.</li>\n<li><code>workingDirectory</code> String (optional) - The working directory. Default is empty.</li>\n</ul>",
      "title": "JumpListItem Object",
      "description": ""
    },
    "/docs/api/structures/keyboard-event": {
      "locale": "pt-BR",
      "slug": "keyboard-event",
      "href": "/docs/api/structures/keyboard-event",
      "crowdinFileId": "256455",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/keyboard-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"keyboardevent-object\"><a href=\"#keyboardevent-object\">KeyboardEvent Object</a></h1>\n<ul>\n<li><code>ctrlKey</code> Boolean (optional) - whether the Control key was used in an accelerator to trigger the Event</li>\n<li><code>metaKey</code> Boolean (optional) - whether a meta key was used in an accelerator to trigger the Event</li>\n<li><code>shiftKey</code> Boolean (optional) - whether a Shift key was used in an accelerator to trigger the Event</li>\n<li><code>altKey</code> Boolean (optional) - whether an Alt key was used in an accelerator to trigger the Event</li>\n<li><code>triggeredByAccelerator</code> Boolean (optional) - whether an accelerator was used to trigger the event as opposed to another user gesture like mouse click</li>\n</ul>",
      "title": "KeyboardEvent Object",
      "description": ""
    },
    "/docs/api/structures/keyboard-input-event": {
      "locale": "pt-BR",
      "slug": "keyboard-input-event",
      "href": "/docs/api/structures/keyboard-input-event",
      "crowdinFileId": "256457",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/keyboard-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"keyboardinputevent-object-extends-inputevent\"><a href=\"#keyboardinputevent-object-extends-inputevent\">KeyboardInputEvent Object extends <code>InputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>keyDown</code>, <code>keyUp</code> or <code>char</code>.</li>\n<li><code>keyCode</code> String - The character that will be sent as the keyboard event. Should only use the valid key codes in <a href=\"/docs/api/accelerator\">Accelerator</a>.</li>\n</ul>",
      "title": "KeyboardInputEvent Object extends InputEvent",
      "description": ""
    },
    "/docs/tutorial/keyboard-shortcuts": {
      "locale": "pt-BR",
      "slug": "keyboard-shortcuts",
      "href": "/docs/tutorial/keyboard-shortcuts",
      "crowdinFileId": "256209",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/keyboard-shortcuts.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"atalhos-do-teclado\"><a href=\"#atalhos-do-teclado\">Atalhos do Teclado</a></h1>\n<h2 id=\"visão-geral\"><a href=\"#visão-geral\">Visão Geral</a></h2>\n<p>This feature allows you to configure local and global keyboard shortcuts for your Electron application.</p>\n<h2 id=\"exemplo\"><a href=\"#exemplo\">Exemplo</a></h2>\n<h3 id=\"atalhos-locais\"><a href=\"#atalhos-locais\">Atalhos Locais</a></h3>\n<p>Local keyboard shortcuts are triggered only when the application is focused. To configure a local keyboard shortcut, you need to specify an <a href=\"/docs/api/accelerator\"><code>accelerator</code></a> property when creating a <a href=\"/docs/api/menu-item\">MenuItem</a> within the <a href=\"/docs/api/menu\">Menu</a> module.</p>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/local\"><span class=\"hljs-keyword\">const</span> { Menu, MenuItem } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> menu = <span class=\"hljs-keyword\">new</span> Menu()\nmenu.append(<span class=\"hljs-keyword\">new</span> MenuItem({\n  <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Electron'</span>,\n  <span class=\"hljs-attr\">submenu</span>: [{\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'help'</span>,\n    <span class=\"hljs-attr\">accelerator</span>: process.platform === <span class=\"hljs-string\">'darwin'</span> ? <span class=\"hljs-string\">'Alt+Cmd+I'</span> : <span class=\"hljs-string\">'Alt+Shift+I'</span>,\n    <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Electron rocks!'</span>) }\n  }]\n}))\n\nMenu.setApplicationMenu(menu)\n</code></pre>\n<blockquote>\n<p>NOTE: In the code above, you can see that the accelerator differs based on the user's operating system. For MacOS, it is <code>Alt+Cmd+I</code>, whereas for Linux and Windows, it is <code>Alt+Shift+I</code>.</p>\n</blockquote>\n<p>After launching the Electron application, you should see the application menu along with the local shortcut you just defined:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/local-shortcut.png\" alt=\"Menu with a local shortcut\"></p>\n<p>If you click <code>Help</code> or press the defined accelerator and then open the terminal that you ran your Electron application from, you will see the message that was generated after triggering the <code>click</code> event: \"Electron rocks!\".</p>\n<h3 id=\"atalhos-globais\"><a href=\"#atalhos-globais\">Atalhos Globais</a></h3>\n<p>To configure a global keyboard shortcut, you need to use the <a href=\"/docs/api/global-shortcut\">globalShortcut</a> module to detect keyboard events even when the application does not have keyboard focus.</p>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/global\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  globalShortcut.register(<span class=\"hljs-string\">'Alt+CommandOrControl+I'</span>, () => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Electron loves global shortcuts!'</span>)\n  })\n}).then(createWindow)\n</code></pre>\n<blockquote>\n<p>NOTE: In the code above, the <code>CommandOrControl</code> combination uses <code>Command</code> on macOS and <code>Control</code> on Windows/Linux.</p>\n</blockquote>\n<p>After launching the Electron application, if you press the defined key combination then open the terminal that you ran your Electron application from, you will see that Electron loves global shortcuts!</p>\n<h3 id=\"atalhos-em-uma-janela-do-navegador\"><a href=\"#atalhos-em-uma-janela-do-navegador\">Atalhos em uma janela do navegador</a></h3>\n<h4 id=\"using-web-apis\"><a href=\"#using-web-apis\">Using web APIs</a></h4>\n<p>If you want to handle keyboard shortcuts within a <a href=\"/docs/api/browser-window\">BrowserWindow</a>, you can listen for the <code>keyup</code> and <code>keydown</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/Events\">DOM events</a> inside the renderer process using the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\">addEventListener() API</a>.</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/web-apis\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleKeyPress</span>(<span class=\"hljs-params\">event</span>) </span>{\n  <span class=\"hljs-comment\">// You can put code here to handle the keypress.</span>\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">\"last-keypress\"</span>).innerText = event.key;\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`You pressed <span class=\"hljs-subst\">${event.key}</span>`</span>);\n}\n\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'keyup'</span>, handleKeyPress, <span class=\"hljs-literal\">true</span>);\n</code></pre>\n<blockquote>\n<p>Note:  the third parameter <code>true</code> indicates that the listener will always receive key presses before other listeners so they can't have <code>stopPropagation()</code> called on them.</p>\n</blockquote>\n<h4 id=\"intercepting-events-in-the-main-process\"><a href=\"#intercepting-events-in-the-main-process\">Intercepting events in the main process</a></h4>\n<p>O evento <a href=\"/docs/api/web-contents#event-before-input-event\"><code>before-input-event</code></a> é emitido antes enviar os eventos <code>keydown</code> e <code>keyup</code> na página. Ele pode ser usado para capturar e manipular atalhos personalizados que não estão visíveis no menu.</p>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/interception-from-main\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n  win.webContents.on(<span class=\"hljs-string\">'before-input-event'</span>, (event, input) => {\n    <span class=\"hljs-keyword\">if</span> (input.control &#x26;&#x26; input.key.toLowerCase() === <span class=\"hljs-string\">'i'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Pressed Control+I'</span>)\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<p>After launching the Electron application, if you open the terminal that you ran your Electron application from and press <code>Ctrl+I</code> key combination, you will see that this key combination was successfully intercepted.</p>\n<h4 id=\"using-third-party-libraries\"><a href=\"#using-third-party-libraries\">Using third-party libraries</a></h4>\n<p>If you don't want to do manual shortcut parsing, there are libraries that do advanced key detection, such as <a href=\"https://github.com/ccampbell/mousetrap\">mousetrap</a>. Below are examples of usage of the <code>mousetrap</code> running in the Renderer process:</p>\n<pre><code class=\"hljs language-js\">Mousetrap.bind(<span class=\"hljs-string\">'4'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'4'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'?'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'show shortcuts!'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'esc'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'escape'</span>) }, <span class=\"hljs-string\">'keyup'</span>)\n\n<span class=\"hljs-comment\">// combinations</span>\nMousetrap.bind(<span class=\"hljs-string\">'command+shift+k'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'command shift k'</span>) })\n\n<span class=\"hljs-comment\">// map multiple combinations to the same callback</span>\nMousetrap.bind([<span class=\"hljs-string\">'command+k'</span>, <span class=\"hljs-string\">'ctrl+k'</span>], () => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'command k or control k'</span>)\n\n  <span class=\"hljs-comment\">// return false to prevent default behavior and stop event from bubbling</span>\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n\n<span class=\"hljs-comment\">// gmail style sequences</span>\nMousetrap.bind(<span class=\"hljs-string\">'g i'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'go to inbox'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'* a'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'select all'</span>) })\n\n<span class=\"hljs-comment\">// konami code!</span>\nMousetrap.bind(<span class=\"hljs-string\">'up up down down left right left right b a enter'</span>, () => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'konami code'</span>)\n})\n</code></pre>",
      "title": "Atalhos do Teclado",
      "description": "NOTE: In the code above, you can see that the accelerator differs based on the user's operating system. For MacOS, it is Alt+Cmd+I, whereas for Linux and Windows, it is Alt+Shift+I."
    },
    "/docs/tutorial/launch-app-from-url-in-another-app": {
      "locale": "pt-BR",
      "slug": "launch-app-from-url-in-another-app",
      "href": "/docs/tutorial/launch-app-from-url-in-another-app",
      "crowdinFileId": "256211",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/launch-app-from-url-in-another-app.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<hr>\n<p>title: Launching Your Electron App From a URL In Another App\ndescription: This guide will take you through the process of setting your electron app as the default handler for a specific protocol.\nslug: launch-app-from-url-in-another-app</p>\n<h2 id=\"hide_title-true\"><a href=\"#hide_title-true\">hide_title: true</a></h2>\n<h1 id=\"launching-your-electron-app-from-a-url-in-another-app\"><a href=\"#launching-your-electron-app-from-a-url-in-another-app\">Launching Your Electron App From A URL In Another App</a></h1>\n<h2 id=\"visão-geral\"><a href=\"#visão-geral\">Visão Geral</a></h2>\n<!-- ✍ Update this section if you want to provide more details -->\n<p>This guide will take you through the process of setting your Electron app as the default handler for a specific <a href=\"https://www.electronjs.org/docs/api/protocol\">protocol</a>.</p>\n<p>By the end of this tutorial, we will have set our app to intercept and handle any clicked URLs that start with a specific protocol. In this guide, the protocol we will use will be \"<code>electron-fiddle://</code>\".</p>\n<h2 id=\"exemplos\"><a href=\"#exemplos\">Exemplos</a></h2>\n<h3 id=\"main-process-mainjs\"><a href=\"#main-process-mainjs\">Main Process (main.js)</a></h3>\n<p>First, we will import the required modules from <code>electron</code>. These modules help control our application lifecycle and create a native browser window.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n</code></pre>\n<p>Next, we will proceed to register our application to handle all \"<code>electron-fiddle://</code>\" protocols.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">if</span> (process.defaultApp) {\n  <span class=\"hljs-keyword\">if</span> (process.argv.length >= <span class=\"hljs-number\">2</span>) {\n    app.setAsDefaultProtocolClient(<span class=\"hljs-string\">'electron-fiddle'</span>, process.execPath, [path.resolve(process.argv[<span class=\"hljs-number\">1</span>])])\n  }\n} <span class=\"hljs-keyword\">else</span> {\n  app.setAsDefaultProtocolClient(<span class=\"hljs-string\">'electron-fiddle'</span>)\n}\n</code></pre>\n<p>We will now define the function in charge of creating our browser window and load our application's <code>index.html</code> file.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> createWindow = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Create the browser window.</span>\n  mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  mainWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n</code></pre>\n<p>In this next step, we will create our  <code>BrowserWindow</code> and tell our application how to handle an event in which an external protocol is clicked.</p>\n<p>This code will be different in Windows compared to MacOS and Linux. This is due to Windows requiring additional code in order to open the contents of the protocol link within the same Electron instance. Read more about this <a href=\"https://www.electronjs.org/docs/api/app#apprequestsingleinstancelock\">here</a>.</p>\n<h4 id=\"windows-code\"><a href=\"#windows-code\">Windows code:</a></h4>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> gotTheLock = app.requestSingleInstanceLock()\n\n<span class=\"hljs-keyword\">if</span> (!gotTheLock) {\n  app.quit()\n} <span class=\"hljs-keyword\">else</span> {\n  app.on(<span class=\"hljs-string\">'second-instance'</span>, (event, commandLine, workingDirectory) => {\n    <span class=\"hljs-comment\">// Someone tried to run a second instance, we should focus our window.</span>\n    <span class=\"hljs-keyword\">if</span> (mainWindow) {\n      <span class=\"hljs-keyword\">if</span> (mainWindow.isMinimized()) mainWindow.restore()\n      mainWindow.focus()\n    }\n  })\n\n  <span class=\"hljs-comment\">// Create mainWindow, load the rest of the app, etc...</span>\n  app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    createWindow()\n  })\n\n  <span class=\"hljs-comment\">// Handle the protocol. In this case, we choose to show an Error Box.</span>\n  app.on(<span class=\"hljs-string\">'open-url'</span>, (event, url) => {\n    dialog.showErrorBox(<span class=\"hljs-string\">'Welcome Back'</span>, <span class=\"hljs-string\">`You arrived from: <span class=\"hljs-subst\">${url}</span>`</span>)\n  })\n}\n</code></pre>\n<h4 id=\"macos-and-linux-code\"><a href=\"#macos-and-linux-code\">MacOS and Linux code:</a></h4>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// This method will be called when Electron has finished</span>\n<span class=\"hljs-comment\">// initialization and is ready to create browser windows.</span>\n<span class=\"hljs-comment\">// Algumas APIs podem ser usadas somente depois que este evento ocorre.</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n})\n\n<span class=\"hljs-comment\">// Handle the protocol. In this case, we choose to show an Error Box.</span>\napp.on(<span class=\"hljs-string\">'open-url'</span>, (event, url) => {\n  dialog.showErrorBox(<span class=\"hljs-string\">'Welcome Back'</span>, <span class=\"hljs-string\">`You arrived from: <span class=\"hljs-subst\">${url}</span>`</span>)\n})\n</code></pre>\n<p>Finally, we will add some additional code to handle when someone closes our application.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Quit when all windows are closed, except on macOS. There, it's common</span>\n<span class=\"hljs-comment\">// for applications and their menu bar to stay active until the user quits</span>\n<span class=\"hljs-comment\">// explicitly with Cmd + Q.</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h2 id=\"important-notes\"><a href=\"#important-notes\">Important notes</a></h2>\n<h3 id=\"empacotando\"><a href=\"#empacotando\">Empacotando</a></h3>\n<p>On macOS and Linux, this feature will only work when your app is packaged. It will not work when you're launching it in development from the command-line. When you package your app you'll need to make sure the macOS <code>Info.plist</code> and the Linux <code>.desktop</code> files for the app are updated to include the new protocol handler. Some of the Electron tools for bundling and distributing apps handle this for you.</p>\n<h4 id=\"electron-forge\"><a href=\"#electron-forge\"></a><a href=\"https://electronforge.io\">Electron Forge</a></h4>\n<p>If you're using Electron Forge, adjust <code>packagerConfig</code> for macOS support, and the configuration for the appropriate Linux makers for Linux support, in your <a href=\"https://www.electronforge.io/configuration\">Forge configuration</a> <em>(please note the following example only shows the bare minimum needed to add the configuration changes)</em>:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"config\"</span>: {\n    <span class=\"hljs-attr\">\"forge\"</span>: {\n      <span class=\"hljs-attr\">\"packagerConfig\"</span>: {\n        <span class=\"hljs-attr\">\"protocols\"</span>: [\n          {\n            <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"Electron Fiddle\"</span>,\n            <span class=\"hljs-attr\">\"schemes\"</span>: [<span class=\"hljs-string\">\"electron-fiddle\"</span>]\n          }\n        ]\n      },\n      <span class=\"hljs-attr\">\"makers\"</span>: [\n        {\n          <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"@electron-forge/maker-deb\"</span>,\n          <span class=\"hljs-attr\">\"config\"</span>: {\n            <span class=\"hljs-attr\">\"mimeType\"</span>: [<span class=\"hljs-string\">\"x-scheme-handler/electron-fiddle\"</span>]\n          }\n        }\n      ]\n    }\n  }\n}\n</code></pre>\n<h4 id=\"electron-packager\"><a href=\"#electron-packager\"></a><a href=\"https://github.com/electron/electron-packager\">Electron Packager</a></h4>\n<p>For macOS support:</p>\n<p>If you're using Electron Packager's API, adding support for protocol handlers is similar to how Electron Forge is handled, except <code>protocols</code> is part of the Packager options passed to the <code>packager</code> function.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> packager = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-packager'</span>)\n\npackager({\n  <span class=\"hljs-comment\">// ...other options...</span>\n  <span class=\"hljs-attr\">protocols</span>: [\n    {\n      <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Electron Fiddle'</span>,\n      <span class=\"hljs-attr\">schemes</span>: [<span class=\"hljs-string\">'electron-fiddle'</span>]\n    }\n  ]\n\n}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">paths</span> =></span> <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`SUCCESS: Created <span class=\"hljs-subst\">${paths.join(<span class=\"hljs-string\">', '</span>)}</span>`</span>))\n  .catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">`ERROR: <span class=\"hljs-subst\">${err.message}</span>`</span>))\n</code></pre>\n<p>If you're using Electron Packager's CLI, use the <code>--protocol</code> and <code>--protocol-name</code> flags. For example:</p>\n<pre><code class=\"hljs language-shell\">npx electron-packager . --protocol=electron-fiddle --protocol-name=\"Electron Fiddle\"\n</code></pre>\n<h2 id=\"conclusão\"><a href=\"#conclusão\">Conclusão</a></h2>\n<p>After you start your Electron app, you can enter in a URL in your browser that contains the custom protocol, for example <code>\"electron-fiddle://open\"</code> and observe that the application will respond and show an error dialog box.</p>\n<!--\n    Because Electron examples usually require multiple files (HTML, CSS, JS\n    for the main and renderer process, etc.), we use this custom code block\n    for Fiddle (https://www.electronjs.org/fiddle).\n    Please modify any of the files in the referenced folder to fit your\n    example.\n    The content in this codeblock will not be rendered in the website so you\n    can leave it empty.\n-->\n<!-- ✍ Explanation of the code below -->",
      "title": "Launching Your Electron App From A URL In Another App",
      "description": ""
    },
    "/docs/tutorial/linux-desktop-actions": {
      "locale": "pt-BR",
      "slug": "linux-desktop-actions",
      "href": "/docs/tutorial/linux-desktop-actions",
      "crowdinFileId": "256213",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/linux-desktop-actions.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktop-launcher-actions-linux\"><a href=\"#desktop-launcher-actions-linux\">Desktop Launcher Actions (Linux)</a></h1>\n<h2 id=\"visão-geral\"><a href=\"#visão-geral\">Visão Geral</a></h2>\n<p>On many Linux environments, you can add custom entries to the system launcher by modifying the <code>.desktop</code> file. For Canonical's Unity documentation, see <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Adding Shortcuts to a Launcher</a>. For details on a more generic implementation, see the <a href=\"https://specifications.freedesktop.org/desktop-entry-spec/1.1/ar01s11.html\">freedesktop.org Specification</a>.</p>\n<p><img src=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles?action=AttachFile&#x26;do=get&#x26;target=shortcuts.png\" alt=\"audaz\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example of launcher shortcuts in Audacious audio player</p>\n</blockquote>\n<p>To create a shortcut, you need to provide <code>Name</code> and <code>Exec</code> properties for the entry you want to add to the shortcut menu. Unity will execute the command defined in the <code>Exec</code> field after the user clicked the shortcut menu item. An example of the <code>.desktop</code> file may look as follows:</p>\n<pre><code class=\"hljs language-plaintext\">Actions=PlayPause;Next;Previous\n\n[Desktop Action PlayPause]\nName=Play-Pause\nExec=audacious -t\nOnlyShowIn=Unity;\n\n[Desktop Action Next]\nName=Next\nExec=audacious -f\nOnlyShowIn=Unity;\n\n[Desktop Action Previous]\nName=Previous\nExec=audacious -r\nOnlyShowIn=Unity;\n</code></pre>\n<p>The preferred way for Unity to instruct your application on what to do is using parameters. You can find them in your application in the global variable <code>process.argv</code>.</p>",
      "title": "Desktop Launcher Actions (Linux)",
      "description": "NOTE: The screenshot above is an example of launcher shortcuts in Audacious audio player"
    },
    "/docs/tutorial/mac-app-store-submission-guide": {
      "locale": "pt-BR",
      "slug": "mac-app-store-submission-guide",
      "href": "/docs/tutorial/mac-app-store-submission-guide",
      "crowdinFileId": "256215",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/mac-app-store-submission-guide.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"guia-para-mac-app-store\"><a href=\"#guia-para-mac-app-store\">Guia para Mac App Store</a></h1>\n<p>Este guia fornece informações sobre:</p>\n<ul>\n<li>Como assinar aplicativos Electron no macOS;</li>\n<li>Como enviar aplicativos Electron para a Mac App Store (MAS);</li>\n<li>As limitações de construção do MAS.</li>\n</ul>\n<h2 id=\"requisitos\"><a href=\"#requisitos\">Requisitos</a></h2>\n<p>Para assinar os aplicativos Electron, as seguintes ferramentas devem ser instaladas primeiro:</p>\n<ul>\n<li>Xcode 11 ou superior.</li>\n<li>O módulo npm <a href=\"https://github.com/electron/electron-osx-sign\">electron-osx-sign</a>.</li>\n</ul>\n<p>Você também tem que registrar uma conta do Apple Developer e participar do <a href=\"https://developer.apple.com/support/compare-memberships/\">Apple Developer Program</a>.</p>\n<h2 id=\"assinar-aplicativos-electron\"><a href=\"#assinar-aplicativos-electron\">Assinar aplicativos Electron</a></h2>\n<p>Electron apps can be distributed through Mac App Store or outside it. Each way requires different ways of signing and testing. This guide focuses on distribution via Mac App Store, but will also mention other methods.</p>\n<p>The following steps describe how to get the certificates from Apple, how to sign Electron apps, and how to test them.</p>\n<h3 id=\"get-certificates\"><a href=\"#get-certificates\">Get certificates</a></h3>\n<p>The simplest way to get signing certificates is to use Xcode:</p>\n<ol>\n<li>Open Xcode and open \"Accounts\" preferences;</li>\n<li>Sign in with your Apple account;</li>\n<li>Select a team and click \"Manage Certificates\";</li>\n<li>In the lower-left corner of the signing certificates sheet, click the Add button (+), and add following certificates:<ul>\n<li>\"Apple Development\"</li>\n<li>\"Apple Distribution\"</li>\n</ul></li>\n</ol>\n<p>The \"Apple Development\" certificate is used to sign apps for development and testing, on machines that have been registered on Apple Developer website. The method of registration will be described in <a href=\"#prepare-provisioning-profile\">Prepare provisioning profile</a>.</p>\n<p>Apps signed with the \"Apple Development\" certificate cannot be submitted to Mac App Store. For that purpose, apps must be signed with the \"Apple Distribution\" certificate instead. But note that apps signed with the \"Apple Distribution\" certificate cannot run directly, they must be re-signed by Apple to be able to run, which will only be possible after being downloaded from the Mac App Store.</p>\n<h4 id=\"other-certificates\"><a href=\"#other-certificates\">Other certificates</a></h4>\n<p>You may notice that there are also other kinds of certificates.</p>\n<p>The \"Developer ID Application\" certificate is used to sign apps before distributing them outside the Mac App Store.</p>\n<p>The \"Developer ID Installer\" and \"Mac Installer Distribution\" certificates are used to sign the Mac Installer Package instead of the app itself. Most Electron apps do not use Mac Installer Package so they are generally not needed.</p>\n<p>The full list of certificate types can be found <a href=\"https://help.apple.com/xcode/mac/current/#/dev80c6204ec\">here</a>.</p>\n<p>Apps signed with \"Apple Development\" and \"Apple Distribution\" certificates can only run under <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandbox</a>, so they must use the MAS build of Electron. However, the \"Developer ID Application\" certificate does not have this restrictions, so apps signed with it can use either the normal build or the MAS build of Electron.</p>\n<h4 id=\"legacy-certificate-names\"><a href=\"#legacy-certificate-names\">Legacy certificate names</a></h4>\n<p>Apple has been changing the names of certificates during past years, you might encounter them when reading old documentations, and some utilities are still using one of the old names.</p>\n<ul>\n<li>The \"Apple Distribution\" certificate was also named as \"3rd Party Mac Developer Application\" and \"Mac App Distribution\".</li>\n<li>The \"Apple Development\" certificate was also named as \"Mac Developer\" and \"Development\".</li>\n</ul>\n<h3 id=\"prepare-provisioning-profile\"><a href=\"#prepare-provisioning-profile\">Prepare provisioning profile</a></h3>\n<p>If you want to test your app on your local machine before submitting your app to the Mac App Store, you have to sign the app with the \"Apple Development\" certificate with the provisioning profile embedded in the app bundle.</p>\n<p>To <a href=\"https://help.apple.com/developer-account/#/devf2eb157f8\">create a provisioning profile</a>, you can follow the below steps:</p>\n<ol>\n<li>Open the \"Certificates, Identifiers &#x26; Profiles\" page on the <a href=\"https://developer.apple.com/account\">Apple Developer</a> website.</li>\n<li>Add a new App ID for your app in the \"Identifiers\" page.</li>\n<li>Register your local machine in the \"Devices\" page. You can find your machine's \"Device ID\" in the \"Hardware\" page of the \"System Information\" app.</li>\n<li>Register a new Provisioning Profile in the \"Profiles\" page, and download it to <code>/path/to/yourapp.provisionprofile</code>.</li>\n</ol>\n<h3 id=\"enable-apples-app-sandbox\"><a href=\"#enable-apples-app-sandbox\">Enable Apple's App Sandbox</a></h3>\n<p>Apps submitted to the Mac App Store must run under Apple's <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandbox</a>, and only the MAS build of Electron can run with the App Sandbox. The standard darwin build of Electron will fail to launch when run under App Sandbox.</p>\n<p>When signing the app with <code>electron-osx-sign</code>, it will automatically add the necessary entitlements to your app's entitlements, but if you are using custom entitlements, you must ensure App Sandbox capacity is added:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<h4 id=\"extra-steps-without-electron-osx-sign\"><a href=\"#extra-steps-without-electron-osx-sign\">Extra steps without <code>electron-osx-sign</code></a></h4>\n<p>If you are signing your app without using <code>electron-osx-sign</code>, you must ensure the app bundle's entitlements have at least following keys:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.application-groups<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">array</span>></span>\n      <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>TEAM_ID.your.bundle.id<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n    <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">array</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>The <code>TEAM_ID</code> should be replaced with your Apple Developer account's Team ID, and the <code>your.bundle.id</code> should be replaced with the App ID of the app.</p>\n<p>And the following entitlements must be added to the binaries and helpers in the app's bundle:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.inherit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>And the app bundle's <code>Info.plist</code> must include <code>ElectronTeamID</code> key, which has your Apple Developer account's Team ID as its value:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n  ...\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>ElectronTeamID<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>TEAM_ID<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>When using <code>electron-osx-sign</code> the <code>ElectronTeamID</code> key will be added automatically by extracting the Team ID from the certificate's name. You may need to manually add this key if <code>electron-osx-sign</code> could not find the correct Team ID.</p>\n<h3 id=\"sign-apps-for-development\"><a href=\"#sign-apps-for-development\">Sign apps for development</a></h3>\n<p>To sign an app that can run on your development machine, you must sign it with the \"Apple Development\" certificate and pass the provisioning profile to <code>electron-osx-sign</code>.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Apple Development'</span> --provisioning-profile=/path/to/yourapp.provisionprofile\n</code></pre>\n<p>If you are signing without <code>electron-osx-sign</code>, you must place the provisioning profile to <code>YourApp.app/Contents/embedded.provisionprofile</code>.</p>\n<p>The signed app can only run on the machines that registered by the provisioning profile, and this is the only way to test the signed app before submitting to Mac App Store.</p>\n<h3 id=\"sign-apps-for-submitting-to-the-mac-app-store\"><a href=\"#sign-apps-for-submitting-to-the-mac-app-store\">Sign apps for submitting to the Mac App Store</a></h3>\n<p>To sign an app that will be submitted to Mac App Store, you must sign it with the \"Apple Distribution\" certificate. Note that apps signed with this certificate will not run anywhere, unless it is downloaded from Mac App Store.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Apple Distribution'</span>\n</code></pre>\n<h3 id=\"sign-apps-for-distribution-outside-the-mac-app-store\"><a href=\"#sign-apps-for-distribution-outside-the-mac-app-store\">Sign apps for distribution outside the Mac App Store</a></h3>\n<p>If you don't plan to submit the app to Mac App Store, you can sign it the \"Developer ID Application\" certificate. In this way there is no requirement on App Sandbox, and you should use the normal darwin build of Electron if you don't use App Sandbox.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Developer ID Application'</span> --no-gatekeeper-assess\n</code></pre>\n<p>By passing <code>--no-gatekeeper-assess</code>, the <code>electron-osx-sign</code> will skip the macOS GateKeeper check as your app usually has not been notarized yet by this step.</p>\n<!-- TODO(zcbenz): Add a chapter about App Notarization -->\n<p>This guide does not cover <a href=\"https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution\">App Notarization</a>, but you might want to do it otherwise Apple may prevent users from using your app outside Mac App Store.</p>\n<h2 id=\"submit-apps-to-the-mac-app-store\"><a href=\"#submit-apps-to-the-mac-app-store\">Submit Apps to the Mac App Store</a></h2>\n<p>After signing the app with the \"Apple Distribution\" certificate, you can continue to submit it to Mac App Store.</p>\n<p>However, this guide do not ensure your app will be approved by Apple; you still need to read Apple's <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/SubmittingYourApp/SubmittingYourApp.html\">Submitting Your App</a> guide on how to meet the Mac App Store requirements.</p>\n<h3 id=\"upload\"><a href=\"#upload\">Upload</a></h3>\n<p>The Application Loader should be used to upload the signed app to iTunes Connect for processing, making sure you have <a href=\"https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/CreatingiTunesConnectRecord.html\">created a record</a> before uploading.</p>\n<p>If you are seeing errors like private APIs uses, you should check if the app is using the MAS build of Electron.</p>\n<h3 id=\"submit-for-review\"><a href=\"#submit-for-review\">Submit for review</a></h3>\n<p>After uploading, you should <a href=\"https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html\">submit your app for review</a>.</p>\n<h2 id=\"limitations-of-mas-build\"><a href=\"#limitations-of-mas-build\">Limitations of MAS Build</a></h2>\n<p>In order to satisfy all requirements for app sandboxing, the following modules have been disabled in the MAS build:</p>\n<ul>\n<li><code>crashReporter</code></li>\n<li><code>autoUpdater</code></li>\n</ul>\n<p>and the following behaviors have been changed:</p>\n<ul>\n<li>Video capture may not work for some machines.</li>\n<li>Certain accessibility features may not work.</li>\n<li>Apps will not be aware of DNS changes.</li>\n</ul>\n<p>Also, due to the usage of app sandboxing, the resources which can be accessed by the app are strictly limited; you can read <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandboxing</a> for more information.</p>\n<h3 id=\"additional-entitlements\"><a href=\"#additional-entitlements\">Additional entitlements</a></h3>\n<p>Depending on which Electron APIs your app uses, you may need to add additional entitlements to your app's entitlements file. Otherwise, the App Sandbox may prevent you from using them.</p>\n<h4 id=\"network-access\"><a href=\"#network-access\">Network access</a></h4>\n<p>Enable outgoing network connections to allow your app to connect to a server:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.network.client<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>Enable incoming network connections to allow your app to open a network listening socket:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.network.server<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>See the <a href=\"https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW9\">Enabling Network Access documentation</a> for more details.</p>\n<h4 id=\"dialogshowopendialog\"><a href=\"#dialogshowopendialog\">dialog.showOpenDialog</a></h4>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.files.user-selected.read-only<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>See the <a href=\"https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6\">Enabling User-Selected File Access documentation</a> for more details.</p>\n<h4 id=\"dialogshowsavedialog\"><a href=\"#dialogshowsavedialog\">dialog.showSaveDialog</a></h4>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.files.user-selected.read-write<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>See the <a href=\"https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6\">Enabling User-Selected File Access documentation</a> for more details.</p>\n<h2 id=\"cryptographic-algorithms-used-by-electron\"><a href=\"#cryptographic-algorithms-used-by-electron\">Cryptographic Algorithms Used by Electron</a></h2>\n<p>Dependendo dos países em que você esteja liberando seu aplicativo, você pode ser obrigado a fornecer informações sobre os algoritmos criptográficos usados em seu software. Veja a <a href=\"https://help.apple.com/app-store-connect/#/devc3f64248f\">documentação de conformidade com a criptografia</a> para mais informações.</p>\n<p>Electron uses following cryptographic algorithms:</p>\n<ul>\n<li>AES - <a href=\"https://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf\">NIST SP 800-38A</a>, <a href=\"https://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf\">NIST SP 800-38D</a>, <a href=\"https://www.ietf.org/rfc/rfc3394.txt\">RFC 3394</a></li>\n<li>HMAC - <a href=\"https://csrc.nist.gov/publications/fips/fips198-1/FIPS-198-1_final.pdf\">FIPS 198-1</a></li>\n<li>ECDSA - ANS X9.62–2005</li>\n<li>ECDH - ANS X9.63–2001</li>\n<li>HKDF - <a href=\"https://csrc.nist.gov/publications/nistpubs/800-56C/SP-800-56C.pdf\">NIST SP 800-56C</a></li>\n<li>PBKDF2 - <a href=\"https://tools.ietf.org/html/rfc2898\">RFC 2898</a></li>\n<li>RSA - <a href=\"https://www.ietf.org/rfc/rfc3447\">RFC 3447</a></li>\n<li>SHA - <a href=\"https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf\">FIPS 180-4</a></li>\n<li>Blowfish - <a href=\"https://www.schneier.com/cryptography/blowfish/\">https://www.schneier.com/cryptography/blowfish/</a></li>\n<li>CAST - <a href=\"https://tools.ietf.org/html/rfc2144\">RFC 2144</a>, <a href=\"https://tools.ietf.org/html/rfc2612\">RFC 2612</a></li>\n<li>DES - <a href=\"https://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf\">FIPS 46-3</a></li>\n<li>DH - <a href=\"https://tools.ietf.org/html/rfc2631\">RFC 2631</a></li>\n<li>DSA - <a href=\"https://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+X9.30-1%3A1997\">ANSI X9.30</a></li>\n<li>EC - <a href=\"https://www.secg.org/sec1-v2.pdf\">SEC 1</a></li>\n<li>IDEA - \"On the Design and Security of Block Ciphers\" book by X. Lai</li>\n<li>MD2 - <a href=\"https://tools.ietf.org/html/rfc1319\">RFC 1319</a></li>\n<li>MD4 - <a href=\"https://tools.ietf.org/html/rfc6150\">RFC 6150</a></li>\n<li>MD5 - <a href=\"https://tools.ietf.org/html/rfc1321\">RFC 1321</a></li>\n<li>MDC2 - <a href=\"https://wiki.openssl.org/index.php/Manual:Mdc2(3)\">ISO/IEC 10118-2</a></li>\n<li>RC2 - <a href=\"https://tools.ietf.org/html/rfc2268\">RFC 2268</a></li>\n<li>RC4 - <a href=\"https://tools.ietf.org/html/rfc4345\">RFC 4345</a></li>\n<li>RC5 - <a href=\"https://people.csail.mit.edu/rivest/Rivest-rc5rev.pdf\">https://people.csail.mit.edu/rivest/Rivest-rc5rev.pdf</a></li>\n<li>RIPEMD - <a href=\"https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2010118-3:2004\">ISO/IEC 10118-3</a></li>\n</ul>",
      "title": "Guia para Mac App Store",
      "description": ""
    },
    "/docs/tutorial/macos-dock": {
      "locale": "pt-BR",
      "slug": "macos-dock",
      "href": "/docs/tutorial/macos-dock",
      "crowdinFileId": "256217",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/macos-dock.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dock-macos\"><a href=\"#dock-macos\">Dock (macOS)</a></h1>\n<p>Electron possui API's para configurar ícones de aplicativos no dock do macOS. A macOS-only API exists to create a custom dock menu, but Electron also uses the app dock icon as the entry point for cross-platform features like <a href=\"/docs/tutorial/recent-documents\">recent documents</a> and <a href=\"/docs/tutorial/progress-bar\">application progress</a>.</p>\n<p>O dock customizado é frequentemente usado para adicionar atalhos para tarefas as quais o usuário não irá querer abrir totalmente a janela do aplicativo para acessá-la.</p>\n<p><strong>Menu do Dock do Terminal.app:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5069962/6032658a-6e9c-11e4-9953-aa84006bdfff.png\" alt=\"Menu do Dock\"></p>\n<p>To set your custom dock menu, you need to use the <a href=\"/docs/api/dock#docksetmenumenu-macos\"><code>app.dock.setMenu</code></a> API, which is only available on macOS.</p>\n<h2 id=\"exemplo\"><a href=\"#exemplo\">Exemplo</a></h2>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/macos-dock-menu\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\n<span class=\"hljs-keyword\">const</span> dockMenu = Menu.buildFromTemplate([\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Window'</span>,\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'New Window'</span>) }\n  }, {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Window with Settings'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Basic'</span> },\n      { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Pro'</span> }\n    ]\n  },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Command...'</span> }\n])\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">if</span> (process.platform === <span class=\"hljs-string\">'darwin'</span>) {\n    app.dock.setMenu(dockMenu)\n  }\n}).then(createWindow)\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n\n</code></pre>\n<p>After launching the Electron application, right click the application icon. You should see the custom menu you just defined:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/macos-dock-menu.png\" alt=\"macOS dock menu\"></p>",
      "title": "Dock (macOS)",
      "description": ""
    },
    "/docs/api/structures/memory-info": {
      "locale": "pt-BR",
      "slug": "memory-info",
      "href": "/docs/api/structures/memory-info",
      "crowdinFileId": "256459",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/memory-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"memoryinfo-object\"><a href=\"#memoryinfo-object\">MemoryInfo Object</a></h1>\n<ul>\n<li><code>workingSetSize</code> Integer - The amount of memory currently pinned to actual physical RAM.</li>\n<li><code>peakWorkingSetSize</code> Integer - The maximum amount of memory that has ever been pinned to actual physical RAM.</li>\n<li><code>privateBytes</code> Integer (optional) <em>Windows</em> - The amount of memory not shared by other processes, such as JS heap or HTML content.</li>\n</ul>\n<p>Note that all statistics are reported in Kilobytes.</p>",
      "title": "MemoryInfo Object",
      "description": ""
    },
    "/docs/api/structures/memory-usage-details": {
      "locale": "pt-BR",
      "slug": "memory-usage-details",
      "href": "/docs/api/structures/memory-usage-details",
      "crowdinFileId": "256461",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/memory-usage-details.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"memoryusagedetails-object\"><a href=\"#memoryusagedetails-object\">MemoryUsageDetails Object</a></h1>\n<ul>\n<li><code>count</code> Number</li>\n<li><code>size</code> Number</li>\n<li><code>liveSize</code> Number</li>\n</ul>",
      "title": "MemoryUsageDetails Object",
      "description": ""
    },
    "/docs/api/menu": {
      "locale": "pt-BR",
      "slug": "menu",
      "href": "/docs/api/menu",
      "crowdinFileId": "256335",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/menu.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"menu\"><a href=\"#menu\">Menu</a></h1>\n<h2 id=\"class-menu\"><a href=\"#class-menu\">Class: Menu</a></h2>\n<blockquote>\n<p>Cria menus de aplicativo e menus de contexto nativos.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h3 id=\"new-menu\"><a href=\"#new-menu\"><code>new Menu()</code></a></h3>\n<p>Cria um novo menu.</p>\n<h3 id=\"métodos-estáticos\"><a href=\"#métodos-estáticos\">Métodos estáticos</a></h3>\n<p>A classe <code>Menu</code> tem os seguintes métodos estáticos:</p>\n<h4 id=\"menusetapplicationmenumenu\"><a href=\"#menusetapplicationmenumenu\"><code>Menu.setApplicationMenu(menu)</code></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Sets <code>menu</code> as the application menu on macOS. On Windows and Linux, the <code>menu</code> will be set as each window's top menu.</p>\n<p>Also on Windows and Linux, you can use a <code>&#x26;</code> in the top-level item name to indicate which letter should get a generated accelerator. For example, using <code>&#x26;File</code> for the file menu would result in a generated <code>Alt-F</code> accelerator that opens the associated menu. The indicated character in the button label then gets an underline, and the <code>&#x26;</code> character is not displayed on the button label.</p>\n<p>In order to escape the <code>&#x26;</code> character in an item name, add a proceeding <code>&#x26;</code>. For example, <code>&#x26;&#x26;File</code> would result in <code>&#x26;File</code> displayed on the button label.</p>\n<p>Passing <code>null</code> will suppress the default menu. On Windows and Linux, this has the additional effect of removing the menu bar from the window.</p>\n<p><strong>Note:</strong> The default menu will be created automatically if the app does not set one. It contains standard items such as <code>File</code>, <code>Edit</code>, <code>View</code>, <code>Window</code> and <code>Help</code>.</p>\n<h4 id=\"menugetapplicationmenu\"><a href=\"#menugetapplicationmenu\"><code>Menu.getApplicationMenu()</code></a></h4>\n<p>Retorna <code>Menu | null</code> - O menu do aplicativo, se definido, ou <code>null</code>, se não fora definido.</p>\n<p><strong>Nota:</strong> A instancia <code>Menu</code> retornada não suporta adição dinâmica ou remoção de itens de menu. <a href=\"#instance-properties\">Instance properties</a> ainda podem ser modificadas dinamicamente.</p>\n<h4 id=\"menusendactiontofirstresponderaction-no-macos\"><a href=\"#menusendactiontofirstresponderaction-no-macos\"><code>Menu.sendActionToFirstResponder(action)</code> no <em>macOS</em></a></h4>\n<ul>\n<li><code>action</code> String</li>\n</ul>\n<p>Sends the <code>action</code> to the first responder of application. This is used for emulating default macOS menu behaviors. Usually you would use the <a href=\"/docs/api/menu-item#roles\"><code>role</code></a> property of a <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>.</p>\n<p>See the <a href=\"https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW7\">macOS Cocoa Event Handling Guide</a> for more information on macOS' native actions.</p>\n<h4 id=\"menubuildfromtemplatetemplate\"><a href=\"#menubuildfromtemplatetemplate\"><code>Menu.buildFromTemplate(template)</code></a></h4>\n<ul>\n<li><code>template</code> (MenuItemConstructorOptions | MenuItem)[]</li>\n</ul>\n<p>Retorna <code>Menu</code></p>\n<p>Generally, the <code>template</code> is an array of <code>options</code> for constructing a <a href=\"/docs/api/menu-item\">MenuItem</a>. The usage can be referenced above.</p>\n<p>You can also attach other fields to the element of the <code>template</code> and they will become properties of the constructed menu items.</p>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<p>O objeto <code>menu</code> possui os seguintes métodos de instância:</p>\n<h4 id=\"menupopupoptions\"><a href=\"#menupopupoptions\"><code>menu.popup([options])</code></a></h4>\n<ul>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional) - Default is the focused window.</li>\n<li><code>x</code> Number (optional) - Default is the current mouse cursor position. Must be declared if <code>y</code> is declared.</li>\n<li><code>y</code> Number (optional) - Default is the current mouse cursor position. Must be declared if <code>x</code> is declared.</li>\n<li><code>positioningItem</code> Number (optional) <em>macOS</em> - The index of the menu item to be positioned under the mouse cursor at the specified coordinates. Default is -1.</li>\n<li><code>callback</code> Function (optional) - Called when menu is closed.</li>\n</ul></li>\n</ul>\n<p>Pops up this menu as a context menu in the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<h4 id=\"menuclosepopupbrowserwindow\"><a href=\"#menuclosepopupbrowserwindow\"><code>menu.closePopup([browserWindow])</code></a></h4>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional) - Default is the focused window.</li>\n</ul>\n<p>Fecha o menu de contexto em <code>browserWindow</code>.</p>\n<h4 id=\"menuappendmenuitem\"><a href=\"#menuappendmenuitem\"><code>menu.append(menuItem)</code></a></h4>\n<ul>\n<li><code>menuItem</code> <a href=\"/docs/api/menu-item\">MenuItem</a></li>\n</ul>\n<p>Acrescenta o <code>menuItem</code> ao menu.</p>\n<h4 id=\"menugetmenuitembyidid\"><a href=\"#menugetmenuitembyidid\"><code>menu.getMenuItemById(id)</code></a></h4>\n<ul>\n<li><code>id</code> String</li>\n</ul>\n<p>Returns <code>MenuItem | null</code> the item with the specified <code>id</code></p>\n<h4 id=\"menuinsertpos-menuitem\"><a href=\"#menuinsertpos-menuitem\"><code>menu.Insert(pos, menuItem)</code></a></h4>\n<ul>\n<li><code>pos</code> Integer</li>\n<li><code>menuItem</code> <a href=\"/docs/api/menu-item\">MenuItem</a></li>\n</ul>\n<p>Insere o <code>menuItem</code> na posição <code>pos</code> do menu.</p>\n<h3 id=\"eventos-de-instância\"><a href=\"#eventos-de-instância\">Eventos de instância</a></h3>\n<p>Objects created with <code>new Menu</code> or returned by <code>Menu.buildFromTemplate</code> emit the following events:</p>\n<p><strong>Note:</strong> Some events are only available on specific operating systems and are labeled as such.</p>\n<h4 id=\"event-menu-will-show\"><a href=\"#event-menu-will-show\">Event: 'menu-will-show'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when <code>menu.popup()</code> is called.</p>\n<h4 id=\"event-menu-will-close\"><a href=\"#event-menu-will-close\">Event: 'menu-will-close'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when a popup is closed either manually or with <code>menu.closePopup()</code>.</p>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<p>Objetos <code>menu</code> também possuem as seguintes propriedades:</p>\n<h4 id=\"menuitems\"><a href=\"#menuitems\"><code>menu.items</code></a></h4>\n<p>Um array <code>MenuItem[]</code> contendo os itens do menu.</p>\n<p>Cada <code>Menu</code> consiste de múltiplos <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>s e cada <code>MenuItem</code> pode ter um submenu.</p>\n<h2 id=\"exemplos\"><a href=\"#exemplos\">Exemplos</a></h2>\n<p>An example of creating the application menu with the simple template API:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> isMac = process.platform === <span class=\"hljs-string\">'darwin'</span>\n\n<span class=\"hljs-keyword\">const</span> template = [\n  <span class=\"hljs-comment\">// { role: 'appMenu' }</span>\n  ...(isMac ? [{\n    <span class=\"hljs-attr\">label</span>: app.name,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'about'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'services'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'hide'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'hideOthers'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'unhide'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'quit'</span> }\n    ]\n  }] : []),\n  <span class=\"hljs-comment\">// { role: 'fileMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'File'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      isMac ? { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'close'</span> } : { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'quit'</span> }\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'editMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Edit'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'undo'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'redo'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'cut'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'copy'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'paste'</span> },\n      ...(isMac ? [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'pasteAndMatchStyle'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'delete'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'selectAll'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        {\n          <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Speech'</span>,\n          <span class=\"hljs-attr\">submenu</span>: [\n            { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'startSpeaking'</span> },\n            { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'stopSpeaking'</span> }\n          ]\n        }\n      ] : [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'delete'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'selectAll'</span> }\n      ])\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'viewMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'View'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'reload'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'forceReload'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'toggleDevTools'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'resetZoom'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoomIn'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoomOut'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'togglefullscreen'</span> }\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'windowMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Window'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'minimize'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoom'</span> },\n      ...(isMac ? [\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'front'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'window'</span> }\n      ] : [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'close'</span> }\n      ])\n    ]\n  },\n  {\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'help'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      {\n        <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Learn More'</span>,\n        <span class=\"hljs-attr\">click</span>: <span class=\"hljs-keyword\">async</span> () => {\n          <span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n          <span class=\"hljs-keyword\">await</span> shell.openExternal(<span class=\"hljs-string\">'https://electronjs.org'</span>)\n        }\n      }\n    ]\n  }\n]\n\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\nMenu.setApplicationMenu(menu)\n</code></pre>\n<h3 id=\"processo-de-renderização\"><a href=\"#processo-de-renderização\">Processo de renderização</a></h3>\n<p>To create menus initiated by the renderer process, send the required information to the main process using IPC and have the main process display the menu on behalf of the renderer.</p>\n<p>Below is an example of showing a menu when the user right clicks the page:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer</span>\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'contextmenu'</span>, (e) => {\n  e.preventDefault()\n  ipcRenderer.send(<span class=\"hljs-string\">'show-context-menu'</span>)\n})\n\nipcRenderer.on(<span class=\"hljs-string\">'context-menu-command'</span>, (e, command) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// main</span>\nipcMain.on(<span class=\"hljs-string\">'show-context-menu'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> template = [\n    {\n      <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Menu Item 1'</span>,\n      <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { event.sender.send(<span class=\"hljs-string\">'context-menu-command'</span>, <span class=\"hljs-string\">'menu-item-1'</span>) }\n    },\n    { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Menu Item 2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'checkbox'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> }\n  ]\n  <span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\n  menu.popup(BrowserWindow.fromWebContents(event.sender))\n})\n</code></pre>\n<h2 id=\"notas-sobre-o-menu-de-aplicativo-no-macos\"><a href=\"#notas-sobre-o-menu-de-aplicativo-no-macos\">Notas sobre o Menu de aplicativo no macOS</a></h2>\n<p>macOS has a completely different style of application menu from Windows and Linux. Here are some notes on making your app's menu more native-like.</p>\n<h3 id=\"menus-padrão\"><a href=\"#menus-padrão\">Menus Padrão</a></h3>\n<p>On macOS there are many system-defined standard menus, like the <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc\"><code>Services</code></a> and <code>Windows</code> menus. To make your menu a standard menu, you should set your menu's <code>role</code> to one of the following and Electron will recognize them and make them become standard menus:</p>\n<ul>\n<li><code>window</code></li>\n<li><code>help</code></li>\n<li><code>services</code></li>\n</ul>\n<h3 id=\"ações-padronizadas-para-item-de-menu\"><a href=\"#ações-padronizadas-para-item-de-menu\">Ações padronizadas para Item de Menu</a></h3>\n<p>O macOS fornece ações padronizadas para alguns itens de menu, como <code>About xxx</code>, <code>Hide xxx</code>, and <code>Hide Others</code>. To set the action of a menu item to a standard action, you should set the <code>role</code> attribute of the menu item.</p>\n<h3 id=\"nome-do-menu-principal\"><a href=\"#nome-do-menu-principal\">Nome do Menu Principal</a></h3>\n<p>On macOS the label of the application menu's first item is always your app's name, no matter what label you set. To change it, modify your app bundle's <code>Info.plist</code> file. See <a href=\"https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html\">About Information Property List Files</a> for more information.</p>\n<h2 id=\"setting-menu-for-specific-browser-window-linux-windows\"><a href=\"#setting-menu-for-specific-browser-window-linux-windows\">Setting Menu for Specific Browser Window (<em>Linux</em> <em>Windows</em>)</a></h2>\n<p>The <a href=\"/docs/api/browser-window#winsetmenumenu-linux-windows\"><code>setMenu</code> method</a> of browser windows can set the menu of certain browser windows.</p>\n<h2 id=\"posição-do-item-de-menu\"><a href=\"#posição-do-item-de-menu\">Posição do Item de menu</a></h2>\n<p>You can make use of <code>before</code>, <code>after</code>, <code>beforeGroupContaining</code>, <code>afterGroupContaining</code> and <code>id</code> to control how the item will be placed when building a menu with <code>Menu.buildFromTemplate</code>.</p>\n<ul>\n<li><code>before</code> - Inserts this item before the item with the specified label. If the referenced item doesn't exist the item will be inserted at the end of the menu. Also implies that the menu item in question should be placed in the same “group” as the item.</li>\n<li><code>after</code> - Inserts this item after the item with the specified label. If the referenced item doesn't exist the item will be inserted at the end of the menu. Also implies that the menu item in question should be placed in the same “group” as the item.</li>\n<li><code>beforeGroupContaining</code> - Provides a means for a single context menu to declare the placement of their containing group before the containing group of the item with the specified label.</li>\n<li><code>afterGroupContaining</code> - Provides a means for a single context menu to declare the placement of their containing group after the containing group of the item with the specified label.</li>\n</ul>\n<p>By default, items will be inserted in the order they exist in the template unless one of the specified positioning keywords is used.</p>\n<h3 id=\"exemplos-1\"><a href=\"#exemplos-1\">Exemplos</a></h3>\n<p>Modelo:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'4'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'four'</span> }\n]\n</code></pre>\n<p>Menu:</p>\n<pre><code class=\"hljs language-sh\">- 1\n- 2\n- 3\n- 4\n</code></pre>\n<p>Modelo:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span> },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span>, <span class=\"hljs-attr\">beforeGroupContaining</span>: [<span class=\"hljs-string\">'1'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'4'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'four'</span>, <span class=\"hljs-attr\">afterGroupContaining</span>: [<span class=\"hljs-string\">'2'</span>] },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span> }\n]\n</code></pre>\n<p>Menu:</p>\n<pre><code class=\"hljs language-sh\">- 3\n- 4\n- ---\n- 1\n- ---\n- 2\n</code></pre>\n<p>Modelo:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span>, <span class=\"hljs-attr\">after</span>: [<span class=\"hljs-string\">'3'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span>, <span class=\"hljs-attr\">before</span>: [<span class=\"hljs-string\">'1'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span> }\n]\n</code></pre>\n<p>Menu:</p>\n<pre><code class=\"hljs language-sh\">- ---\n- 3\n- 2\n- 1\n</code></pre>",
      "title": "Menu",
      "description": "Cria menus de aplicativo e menus de contexto nativos."
    },
    "/docs/api/menu-item": {
      "locale": "pt-BR",
      "slug": "menu-item",
      "href": "/docs/api/menu-item",
      "crowdinFileId": "256333",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/menu-item.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-menuitem\"><a href=\"#class-menuitem\">Class: MenuItem</a></h2>\n<blockquote>\n<p>Adicione itens para menus e menus de contexto para aplicações nativas.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>Veja <a href=\"/docs/api/menu\"><code>Menu</code></a> para exemplos.</p>\n<h3 id=\"new-menuitemoptions\"><a href=\"#new-menuitemoptions\"><code>new MenuItem(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>click</code> Function (optional) - Will be called with <code>click(menuItem, browserWindow, event)</code> when the menu item is clicked.<ul>\n<li><code>menuItem</code> MenuItem</li>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | undefined - This will not be defined if no window is open.</li>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n</ul></li>\n<li><code>role</code> String (optional) - Can be <code>undo</code>, <code>redo</code>, <code>cut</code>, <code>copy</code>, <code>paste</code>, <code>pasteAndMatchStyle</code>, <code>delete</code>, <code>selectAll</code>, <code>reload</code>, <code>forceReload</code>, <code>toggleDevTools</code>, <code>resetZoom</code>, <code>zoomIn</code>, <code>zoomOut</code>, <code>toggleSpellChecker</code>, <code>togglefullscreen</code>, <code>window</code>, <code>minimize</code>, <code>close</code>, <code>help</code>, <code>about</code>, <code>services</code>, <code>hide</code>, <code>hideOthers</code>, <code>unhide</code>, <code>quit</code>, <code>startSpeaking</code>, <code>stopSpeaking</code>, <code>zoom</code>, <code>front</code>, <code>appMenu</code>, <code>fileMenu</code>, <code>editMenu</code>, <code>viewMenu</code>, <code>shareMenu</code>, <code>recentDocuments</code>, <code>toggleTabBar</code>, <code>selectNextTab</code>, <code>selectPreviousTab</code>, <code>mergeAllWindows</code>, <code>clearRecentDocuments</code>, <code>moveTabToNewWindow</code> or <code>windowMenu</code> - Define the action of the menu item, when specified the <code>click</code> property will be ignored. See <a href=\"#roles\">roles</a>.</li>\n<li><code>type</code> String (opcional) - Pode ser <code>normal</code>, <code>separator</code>, <code>submenu</code>, <code>checkbox</code> ou <code>radio</code>.</li>\n<li><code>label</code> String (optional)</li>\n<li><code>sublabel</code> String (optional)</li>\n<li><code>toolTip</code> String (optional) <em>macOS</em> - Hover text for this menu item.</li>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a> (opcional) - Atalho</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (opcional)</li>\n<li><code>enabled</code> Boolean (optional) - Se falso, o item do menu vai ser não-clicável e cinza.</li>\n<li><code>acceleratorWorksWhenHidden</code> Boolean (optional) <em>macOS</em> - default is <code>true</code>, and when <code>false</code> will prevent the accelerator from triggering the item if the item is not visible`.</li>\n<li><code>visible</code> Boolean (opcional) - Se falso, o item do menu será inteiramente escondido.</li>\n<li><code>checked</code> Boolean (opcinal) - Deve ser especificado apenas para <code>checkbox</code> ou <code>radio</code> tipos de item de menu.</li>\n<li><code>registerAccelerator</code> Boolean (optional) <em>Linux</em> <em>Windows</em> - If false, the accelerator won't be registered with the system, but it will still be displayed. Defaults to true.</li>\n<li><code>sharingItem</code> SharingItem (optional) <em>macOS</em> - The item to share when the <code>role</code> is <code>shareMenu</code>.</li>\n<li><code>submenu</code> (MenuItemConstructorOptions[] | <a href=\"/docs/api/menu\">Menu</a>) (optional) - Should be specified for <code>submenu</code> type menu items. If <code>submenu</code> is specified, the <code>type: 'submenu'</code> can be omitted. If the value is not a <a href=\"/docs/api/menu\"><code>Menu</code></a> then it will be automatically converted to one using <code>Menu.buildFromTemplate</code>.</li>\n<li><code>id</code> String (optional) - Unique within a single menu. If defined then it can be used as a reference to this item by the position attribute.</li>\n<li><code>before</code> String<a href=\"/docs/api/optional\"></a> - Inserts this item before the item with the specified label. If the referenced item doesn't exist the item will be inserted at the end of  the menu. Also implies that the menu item in question should be placed in the same “group” as the item.</li>\n<li><code>after</code> String<a href=\"/docs/api/optional\"></a> - Inserts this item after the item with the specified label. If the referenced item doesn't exist the item will be inserted at the end of the menu.</li>\n<li><code>beforeGroupContaining</code> String<a href=\"/docs/api/optional\"></a> - Provides a means for a single context menu to declare the placement of their containing group before the containing group of the item with the specified label.</li>\n<li><code>afterGroupContaining</code> String<a href=\"/docs/api/optional\"></a> - Provides a means for a single context menu to declare the placement of their containing group after the containing group of the item with the specified label.</li>\n</ul></li>\n</ul>\n<p><strong>Note:</strong> <code>acceleratorWorksWhenHidden</code> is specified as being macOS-only because accelerators always work when items are hidden on Windows and Linux. The option is exposed to users to give them the option to turn it off, as this is possible in native macOS development. This property is only usable on macOS High Sierra 10.13 or newer.</p>\n<h3 id=\"roles\"><a href=\"#roles\">Roles</a></h3>\n<p>Roles permitem itens de menu items terem funcionamentos pré-definidos.</p>\n<p>É melhor especificar <code>role</code> para qualquer item de menu que utiliza uma role padrão, ao invés de tentar implementar manualmente um funcionamento em uma função de <code>click</code>. O funcionamento built-in <code>role</code> dará a melhor experiência nativa.</p>\n<p>O valor de <code>label</code> e de <code>accelerator</code>são opcionais quando utilizando uma <code>role</code> e lhes serão dados valores padrão apropriados para cada plataforma.</p>\n<p>Every menu item must have either a <code>role</code>, <code>label</code>, or in the case of a separator a <code>type</code>.</p>\n<p>A propriedade <code>role</code> pode ter os seguintes valores:</p>\n<ul>\n<li><code>undo</code></li>\n<li><code>about</code> - Trigger a native about panel (custom message box on Window, which does not provide its own).</li>\n<li><code>redo</code></li>\n<li><code>cut</code></li>\n<li><code>copy</code></li>\n<li><code>paste</code></li>\n<li><code>pasteAndMatchStyle</code></li>\n<li><code>selectAll</code></li>\n<li><code>delete</code></li>\n<li><code>minimize</code> - Minimize current window.</li>\n<li><code>close</code> - Close current window.</li>\n<li><code>quit</code> - Quit the application.</li>\n<li><code>reload</code> - Reload the current window.</li>\n<li><code>forceReload</code> - Reload the current window ignoring the cache.</li>\n<li><code>toggleDevTools</code> - Toggle developer tools in the current window.</li>\n<li><code>togglefullscreen</code> - Toggle full screen mode on the current window.</li>\n<li><code>resetZoom</code> - Reset the focused page's zoom level to the original size.</li>\n<li><code>zoomIn</code> - Zoom in the focused page by 10%.</li>\n<li><code>zoomOut</code> - Zoom out the focused page by 10%.</li>\n<li><code>toggleSpellChecker</code> - Enable/disable builtin spell checker.</li>\n<li><code>fileMenu</code> - Whole default \"File\" menu (Close / Quit)</li>\n<li><code>editMenu</code> - Whole default \"Edit\" menu (Undo, Copy, etc.).</li>\n<li><code>viewMenu</code> - Whole default \"View\" menu (Reload, Toggle Developer Tools, etc.)</li>\n<li><code>windowMenu</code> - Whole default \"Window\" menu (Minimize, Zoom, etc.).</li>\n</ul>\n<p>The following additional roles are available on <em>macOS</em>:</p>\n<ul>\n<li><code>appMenu</code> - Whole default \"App\" menu (About, Services, etc.)</li>\n<li><code>hide</code> - Map to the <code>hide</code> action.</li>\n<li><code>hideOthers</code> - Map to the <code>hideOtherApplications</code> action.</li>\n<li><code>unhide</code> - Map to the <code>unhideAllApplications</code> action.</li>\n<li><code>startSpeaking</code> - Map to the <code>startSpeaking</code> action.</li>\n<li><code>stopSpeaking</code> - Map to the <code>stopSpeaking</code> action.</li>\n<li><code>front</code> - Map to the <code>arrangeInFront</code> action.</li>\n<li><code>zoom</code> - Map to the <code>performZoom</code> action.</li>\n<li><code>toggleTabBar</code> - Map to the <code>toggleTabBar</code> action.</li>\n<li><code>selectNextTab</code> - Map to the <code>selectNextTab</code> action.</li>\n<li><code>selectPreviousTab</code> - Map to the <code>selectPreviousTab</code> action.</li>\n<li><code>mergeAllWindows</code> - Map to the <code>mergeAllWindows</code> action.</li>\n<li><code>moveTabToNewWindow</code> - Map to the <code>moveTabToNewWindow</code> action.</li>\n<li><code>window</code> - The submenu is a \"Window\" menu.</li>\n<li><code>help</code> - The submenu is a \"Help\" menu.</li>\n<li><code>services</code> - The submenu is a <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc\">\"Services\"</a> menu. This is only intended for use in the Application Menu and is <em>not</em> the same as the \"Services\" submenu used in context menus in macOS apps, which is not implemented in Electron.</li>\n<li><code>recentDocuments</code> - The submenu is an \"Open Recent\" menu.</li>\n<li><code>clearRecentDocuments</code> - Map to the <code>clearRecentDocuments</code> action.</li>\n<li><code>shareMenu</code> - The submenu is <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/\">share menu</a>. The <code>sharingItem</code> property must also be set to indicate the item to share.</li>\n</ul>\n<p>When specifying a <code>role</code> on macOS, <code>label</code> and <code>accelerator</code> are the only options that will affect the menu item. All other options will be ignored. Lowercase <code>role</code>, e.g. <code>toggledevtools</code>, is still supported.</p>\n<p><strong>Nota Bene:</strong> The <code>enabled</code> and <code>visibility</code> properties are not available for top-level menu items in the tray on macOS.</p>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<p>As seguintes propriedades estão disponíveis em instâncias de <code>MenuItem</code>:</p>\n<h4 id=\"menuitemid\"><a href=\"#menuitemid\"><code>menuItem.id</code></a></h4>\n<p>A <code>String</code> indicating the item's unique id, this property can be dynamically changed.</p>\n<h4 id=\"menuitemlabel\"><a href=\"#menuitemlabel\"><code>menuItem.label</code></a></h4>\n<p>A <code>String</code> indicating the item's visible label.</p>\n<h4 id=\"menuitemclick\"><a href=\"#menuitemclick\"><code>menuItem.click</code></a></h4>\n<p>A <code>Function</code> that is fired when the MenuItem receives a click event. It can be called with <code>menuItem.click(event, focusedWindow, focusedWebContents)</code>.</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>focusedWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n<li><code>focusedWebContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<h4 id=\"menuitemsubmenu\"><a href=\"#menuitemsubmenu\"><code>menuItem.submenu</code></a></h4>\n<p>A <code>Menu</code> (optional) containing the menu item's submenu, if present.</p>\n<h4 id=\"menuitemtype\"><a href=\"#menuitemtype\"><code>menuItem.type</code></a></h4>\n<p>A <code>String</code> indicating the type of the item. Can be <code>normal</code>, <code>separator</code>, <code>submenu</code>, <code>checkbox</code> or <code>radio</code>.</p>\n<h4 id=\"menuitemrole\"><a href=\"#menuitemrole\"><code>menuItem.role</code></a></h4>\n<p>A <code>String</code> (optional) indicating the item's role, if set. Can be <code>undo</code>, <code>redo</code>, <code>cut</code>, <code>copy</code>, <code>paste</code>, <code>pasteAndMatchStyle</code>, <code>delete</code>, <code>selectAll</code>, <code>reload</code>, <code>forceReload</code>, <code>toggleDevTools</code>, <code>resetZoom</code>, <code>zoomIn</code>, <code>zoomOut</code>, <code>toggleSpellChecker</code>, <code>togglefullscreen</code>, <code>window</code>, <code>minimize</code>, <code>close</code>, <code>help</code>, <code>about</code>, <code>services</code>, <code>hide</code>, <code>hideOthers</code>, <code>unhide</code>, <code>quit</code>, <code>startSpeaking</code>, <code>stopSpeaking</code>, <code>zoom</code>, <code>front</code>, <code>appMenu</code>, <code>fileMenu</code>, <code>editMenu</code>, <code>viewMenu</code>, <code>shareMenu</code>, <code>recentDocuments</code>, <code>toggleTabBar</code>, <code>selectNextTab</code>, <code>selectPreviousTab</code>, <code>mergeAllWindows</code>, <code>clearRecentDocuments</code>, <code>moveTabToNewWindow</code> or <code>windowMenu</code></p>\n<h4 id=\"menuitemaccelerator\"><a href=\"#menuitemaccelerator\"><code>menuItem.accelerator</code></a></h4>\n<p>An <code>Accelerator</code> (optional) indicating the item's accelerator, if set.</p>\n<h4 id=\"menuitemuseraccelerator-readonly-macos\"><a href=\"#menuitemuseraccelerator-readonly-macos\"><code>menuItem.userAccelerator</code> <em>Readonly</em> <em>macOS</em></a></h4>\n<p>An <code>Accelerator | null</code> indicating the item's <a href=\"https://developer.apple.com/documentation/appkit/nsmenuitem/1514850-userkeyequivalent?language=objc\">user-assigned accelerator</a> for the menu item.</p>\n<p><strong>Note:</strong> This property is only initialized after the <code>MenuItem</code> has been added to a <code>Menu</code>. Either via <code>Menu.buildFromTemplate</code> or via <code>Menu.append()/insert()</code>.  Accessing before initialization will just return <code>null</code>.</p>\n<h4 id=\"menuitemicon\"><a href=\"#menuitemicon\"><code>menuItem.icon</code></a></h4>\n<p>A <code>NativeImage | String</code> (optional) indicating the item's icon, if set.</p>\n<h4 id=\"menuitemsublabel\"><a href=\"#menuitemsublabel\"><code>menuItem.sublabel</code></a></h4>\n<p>A <code>String</code> indicating the item's sublabel.</p>\n<h4 id=\"menuitemtooltip-macos\"><a href=\"#menuitemtooltip-macos\"><code>menuItem.toolTip</code> <em>macOS</em></a></h4>\n<p>A <code>String</code> indicating the item's hover text.</p>\n<h4 id=\"menuitemenabled\"><a href=\"#menuitemenabled\"><code>menuItem.enabled</code></a></h4>\n<p>Um <code>Boolean</code> indicando se o item está ativo, essa propriedade pode ser alterada dinamicamente.</p>\n<h4 id=\"menuitemvisible\"><a href=\"#menuitemvisible\"><code>menuItem.visible</code></a></h4>\n<p>Um <code>Boolean</code> indicando se o item está visível, essa propriedade pode ser alterada dinamicamente.</p>\n<h4 id=\"menuitemchecked\"><a href=\"#menuitemchecked\"><code>menuItem.checked</code></a></h4>\n<p>Um <code>Boolean</code> indicando se o item está ativo ou não, essa propriedade pode ser alterada dinamicamente.</p>\n<p>Um item do menu de um <code>checkbox</code> irá mudar a propriedade <code>checked</code> para ativa ou não quando selecionada.</p>\n<p>Um item do menu de um <code>radio</code> irá ativar a sua propriedade <code>checked</code> quando clicado, e irá desativar essa propriedade para todos os itens adjacentes no mesmo menu.</p>\n<p>Você pode adicionar uma função <code>click</code> para comportamentos adicionais.</p>\n<h4 id=\"menuitemregisteraccelerator\"><a href=\"#menuitemregisteraccelerator\"><code>menuItem.registerAccelerator</code></a></h4>\n<p>A <code>Boolean</code> indicating if the accelerator should be registered with the system or just displayed.</p>\n<p>This property can be dynamically changed.</p>\n<h4 id=\"menuitemsharingitem-macos\"><a href=\"#menuitemsharingitem-macos\"><code>menuItem.sharingItem</code> <em>macOS</em></a></h4>\n<p>A <code>SharingItem</code> indicating the item to share when the <code>role</code> is <code>shareMenu</code>.</p>\n<p>This property can be dynamically changed.</p>\n<h4 id=\"menuitemcommandid\"><a href=\"#menuitemcommandid\"><code>menuItem.commandId</code></a></h4>\n<p>A <code>Number</code> indicating an item's sequential unique id.</p>\n<h4 id=\"menuitemmenu\"><a href=\"#menuitemmenu\"><code>menuItem.menu</code></a></h4>\n<p>A <code>Menu</code> that the item is a part of.</p>",
      "title": "MenuItem",
      "description": "Adicione itens para menus e menus de contexto para aplicações nativas."
    },
    "/docs/api/message-channel-main": {
      "locale": "pt-BR",
      "slug": "message-channel-main",
      "href": "/docs/api/message-channel-main",
      "crowdinFileId": "256337",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/message-channel-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messagechannelmain\"><a href=\"#messagechannelmain\">MessageChannelMain</a></h1>\n<p><code>MessageChannelMain</code> is the main-process-side equivalent of the DOM <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\"><code>MessageChannel</code></a> object. Its singular function is to create a pair of connected <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> objects.</p>\n<p>See the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> documentation for more information on using channel messaging.</p>\n<h2 id=\"class-messagechannelmain\"><a href=\"#class-messagechannelmain\">Class: MessageChannelMain</a></h2>\n<blockquote>\n<p>Channel interface for channel messaging in the main process.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>Exemplo:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nw.webContents.postMessage(<span class=\"hljs-string\">'port'</span>, <span class=\"hljs-literal\">null</span>, [port2])\nport1.postMessage({ <span class=\"hljs-attr\">some</span>: <span class=\"hljs-string\">'message'</span> })\n\n<span class=\"hljs-comment\">// Renderer process</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e) => {\n  <span class=\"hljs-comment\">// e.ports is a list of ports sent along with this message</span>\n  e.ports[<span class=\"hljs-number\">0</span>].on(<span class=\"hljs-string\">'message'</span>, (messageEvent) => {\n    <span class=\"hljs-built_in\">console</span>.log(messageEvent.data)\n  })\n})\n</code></pre>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<h4 id=\"channelport1\"><a href=\"#channelport1\"><code>channel.port1</code></a></h4>\n<p>A <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> property.</p>\n<h4 id=\"channelport2\"><a href=\"#channelport2\"><code>channel.port2</code></a></h4>\n<p>A <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> property.</p>",
      "title": "MessageChannelMain",
      "description": "Channel interface for channel messaging in the main process."
    },
    "/docs/api/message-port-main": {
      "locale": "pt-BR",
      "slug": "message-port-main",
      "href": "/docs/api/message-port-main",
      "crowdinFileId": "256339",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/message-port-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messageportmain\"><a href=\"#messageportmain\">MessagePortMain</a></h1>\n<p><code>MessagePortMain</code> is the main-process-side equivalent of the DOM <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> object. It behaves similarly to the DOM version, with the exception that it uses the Node.js <code>EventEmitter</code> event system, instead of the DOM <code>EventTarget</code> system. This means you should use <code>port.on('message', ...)</code> to listen for events, instead of <code>port.onmessage = ...</code> or <code>port.addEventListener('message', ...)</code></p>\n<p>See the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> documentation for more information on using channel messaging.</p>\n<p><code>MessagePortMain</code> is an [EventEmitter][event-emitter].</p>\n<h2 id=\"class-messageportmain\"><a href=\"#class-messageportmain\">Class: MessagePortMain</a></h2>\n<blockquote>\n<p>Port interface for channel messaging in the main process.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<h4 id=\"portpostmessagemessage-transfer\"><a href=\"#portpostmessagemessage-transfer\"><code>port.postMessage(message, [transfer])</code></a></h4>\n<ul>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.</p>\n<h4 id=\"portstart\"><a href=\"#portstart\"><code>port.start()</code></a></h4>\n<p>Starts the sending of messages queued on the port. Messages will be queued until this method is called.</p>\n<h4 id=\"portclose\"><a href=\"#portclose\"><code>port.close()</code></a></h4>\n<p>Disconnects the port, so it is no longer active.</p>\n<h3 id=\"eventos-de-instância\"><a href=\"#eventos-de-instância\">Eventos de instância</a></h3>\n<h4 id=\"event-message\"><a href=\"#event-message\">Event: 'message'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>messageEvent</code> Object<ul>\n<li><code>data</code> any</li>\n<li><code>ports</code> MessagePortMain[]</li>\n</ul></li>\n</ul>\n<p>Emitted when a MessagePortMain object receives a message.</p>\n<h4 id=\"evento-close\"><a href=\"#evento-close\">Evento: 'close'</a></h4>\n<p>Emitted when the remote end of a MessagePortMain object becomes disconnected.</p>",
      "title": "MessagePortMain",
      "description": "Port interface for channel messaging in the main process."
    },
    "/docs/tutorial/message-ports": {
      "locale": "pt-BR",
      "slug": "message-ports",
      "href": "/docs/tutorial/message-ports",
      "crowdinFileId": "256219",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/message-ports.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messageports-in-electron\"><a href=\"#messageports-in-electron\">MessagePorts in Electron</a></h1>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a>s are a web feature that allow passing messages between different contexts. It's like <code>window.postMessage</code>, but on different channels. The goal of this document is to describe how Electron extends the Channel Messaging model, and to give some examples of how you might use MessagePorts in your app.</p>\n<p>Here is a very brief example of what a MessagePort is and how it works:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer.js ///////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-comment\">// MessagePorts are created in pairs. A connected pair of message ports is</span>\n<span class=\"hljs-comment\">// called a channel.</span>\n<span class=\"hljs-keyword\">const</span> channel = <span class=\"hljs-keyword\">new</span> MessageChannel()\n\n<span class=\"hljs-comment\">// The only difference between port1 and port2 is in how you use them. Messages</span>\n<span class=\"hljs-comment\">// sent to port1 will be received by port2 and vice-versa.</span>\n<span class=\"hljs-keyword\">const</span> port1 = channel.port1\n<span class=\"hljs-keyword\">const</span> port2 = channel.port2\n\n<span class=\"hljs-comment\">// It's OK to send a message on the channel before the other end has registered</span>\n<span class=\"hljs-comment\">// a listener. Messages will be queued until a listener is registered.</span>\nport2.postMessage({ <span class=\"hljs-attr\">answer</span>: <span class=\"hljs-number\">42</span> })\n\n<span class=\"hljs-comment\">// Here we send the other end of the channel, port1, to the main process. It's</span>\n<span class=\"hljs-comment\">// also possible to send MessagePorts to other frames, or to Web Workers, etc.</span>\nipcRenderer.postMessage(<span class=\"hljs-string\">'port'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-comment\">// In the main process, we receive the port.</span>\nipcMain.on(<span class=\"hljs-string\">'port'</span>, (event) => {\n  <span class=\"hljs-comment\">// When we receive a MessagePort in the main process, it becomes a</span>\n  <span class=\"hljs-comment\">// MessagePortMain.</span>\n  <span class=\"hljs-keyword\">const</span> port = event.ports[<span class=\"hljs-number\">0</span>]\n\n  <span class=\"hljs-comment\">// MessagePortMain uses the Node.js-style events API, rather than the</span>\n  <span class=\"hljs-comment\">// web-style events API. So .on('message', ...) instead of .onmessage = ...</span>\n  port.on(<span class=\"hljs-string\">'message'</span>, (event) => {\n    <span class=\"hljs-comment\">// data is { answer: 42 }</span>\n    <span class=\"hljs-keyword\">const</span> data = event.data\n  })\n\n  <span class=\"hljs-comment\">// MessagePortMain queues messages until the .start() method has been called.</span>\n  port.start()\n})\n</code></pre>\n<p>The <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> documentation is a great way to learn more about how MessagePorts work.</p>\n<h2 id=\"messageports-in-the-main-process\"><a href=\"#messageports-in-the-main-process\">MessagePorts in the main process</a></h2>\n<p>In the renderer, the <code>MessagePort</code> class behaves exactly as it does on the web. The main process is not a web page, though—it has no Blink integration—and so it does not have the <code>MessagePort</code> or <code>MessageChannel</code> classes. In order to handle and interact with MessagePorts in the main process, Electron adds two new classes: <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> and <a href=\"/docs/api/message-channel-main\"><code>MessageChannelMain</code></a>. These behave similarly to the analogous classes in the renderer.</p>\n<p><code>MessagePort</code> objects can be created in either the renderer or the main process, and passed back and forth using the <a href=\"/docs/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a> and <a href=\"/docs/api/web-contents#contentspostmessagechannel-message-transfer\"><code>WebContents.postMessage</code></a> methods. Note that the usual IPC methods like <code>send</code> and <code>invoke</code> cannot be used to transfer <code>MessagePort</code>s, only the <code>postMessage</code> methods can transfer <code>MessagePort</code>s.</p>\n<p>By passing <code>MessagePort</code>s via the main process, you can connect two pages that might not otherwise be able to communicate (e.g. due to same-origin restrictions).</p>\n<h2 id=\"extension-close-event\"><a href=\"#extension-close-event\">Extension: <code>close</code> event</a></h2>\n<p>Electron adds one feature to <code>MessagePort</code> that isn't present on the web, in order to make MessagePorts more useful. That is the <code>close</code> event, which is emitted when the other end of the channel is closed. Ports can also be implicitly closed by being garbage-collected.</p>\n<p>In the renderer, you can listen for the <code>close</code> event either by assigning to <code>port.onclose</code> or by calling <code>port.addEventListener('close', ...)</code>. In the main process, you can listen for the <code>close</code> event by calling <code>port.on('close', ...)</code>.</p>\n<h2 id=\"example-use-cases\"><a href=\"#example-use-cases\">Example use cases</a></h2>\n<h3 id=\"worker-process\"><a href=\"#worker-process\">Worker process</a></h3>\n<p>In this example, your app has a worker process implemented as a hidden window. You want the app page to be able to communicate directly with the worker process, without the performance overhead of relaying via the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow, app, ipcMain, MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-comment\">// The worker process is a hidden BrowserWindow, so that it will have access</span>\n  <span class=\"hljs-comment\">// to a full Blink context (including e.g. &#x3C;canvas>, audio, fetch(), etc.)</span>\n  <span class=\"hljs-keyword\">const</span> worker = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span> }\n  })\n  <span class=\"hljs-keyword\">await</span> worker.loadFile(<span class=\"hljs-string\">'worker.html'</span>)\n\n  <span class=\"hljs-comment\">// The main window will send work to the worker process and receive results</span>\n  <span class=\"hljs-comment\">// over a MessagePort.</span>\n  <span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span> }\n  })\n  mainWindow.loadFile(<span class=\"hljs-string\">'app.html'</span>)\n\n  <span class=\"hljs-comment\">// We can't use ipcMain.handle() here, because the reply needs to transfer a</span>\n  <span class=\"hljs-comment\">// MessagePort.</span>\n  ipcMain.on(<span class=\"hljs-string\">'request-worker-channel'</span>, (event) => {\n    <span class=\"hljs-comment\">// For security reasons, let's make sure only the frames we expect can</span>\n    <span class=\"hljs-comment\">// access the worker.</span>\n    <span class=\"hljs-keyword\">if</span> (event.senderFrame === mainWindow.webContents.mainFrame) {\n      <span class=\"hljs-comment\">// Create a new channel ...</span>\n      <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\n      <span class=\"hljs-comment\">// ... send one end to the worker ...</span>\n      worker.webContents.postMessage(<span class=\"hljs-string\">'new-client'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n      <span class=\"hljs-comment\">// ... and the other end to the main window.</span>\n      event.senderFrame.postMessage(<span class=\"hljs-string\">'provide-worker-channel'</span>, <span class=\"hljs-literal\">null</span>, [port2])\n      <span class=\"hljs-comment\">// Now the main window and the worker can communicate with each other</span>\n      <span class=\"hljs-comment\">// without going through the main process!</span>\n    }\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- worker.html ------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">doWork</span>(<span class=\"hljs-params\">input</span>) </span>{\n  <span class=\"hljs-comment\">// Something cpu-intensive.</span>\n  <span class=\"hljs-keyword\">return</span> input * <span class=\"hljs-number\">2</span>\n}\n\n<span class=\"hljs-comment\">// We might get multiple clients, for instance if there are multiple windows,</span>\n<span class=\"hljs-comment\">// or if the main window reloads.</span>\nipcRenderer.on(<span class=\"hljs-string\">'new-client'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n  port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    <span class=\"hljs-comment\">// The event data can be any serializable object (and the event could even</span>\n    <span class=\"hljs-comment\">// carry other MessagePorts with it!)</span>\n    <span class=\"hljs-keyword\">const</span> result = doWork(event.data)\n    port.postMessage(result)\n  }\n})\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- app.html ---------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// We request that the main process sends us a channel we can use to</span>\n<span class=\"hljs-comment\">// communicate with the worker.</span>\nipcRenderer.send(<span class=\"hljs-string\">'request-worker-channel'</span>)\n\nipcRenderer.once(<span class=\"hljs-string\">'provide-worker-channel'</span>, (event) => {\n  <span class=\"hljs-comment\">// Once we receive the reply, we can take the port...</span>\n  <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n  <span class=\"hljs-comment\">// ... register a handler to receive results ...</span>\n  port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'received result:'</span>, event.data)\n  }\n  <span class=\"hljs-comment\">// ... and start sending it work!</span>\n  port.postMessage(<span class=\"hljs-number\">21</span>)\n})\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h3 id=\"reply-streams\"><a href=\"#reply-streams\">Reply streams</a></h3>\n<p>Electron's built-in IPC methods only support two modes: fire-and-forget (e.g. <code>send</code>), or request-response (e.g. <code>invoke</code>). Using MessageChannels, you can implement a \"response stream\", where a single request responds with a stream of data.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer.js ///////////////////////////////////////////////////////////////</span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">makeStreamingRequest</span> (<span class=\"hljs-params\">element, callback</span>) </span>{\n  <span class=\"hljs-comment\">// MessageChannels are lightweight--it's cheap to create a new one for each</span>\n  <span class=\"hljs-comment\">// request.</span>\n  <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannel()\n\n  <span class=\"hljs-comment\">// We send one end of the port to the main process ...</span>\n  ipcRenderer.postMessage(\n    <span class=\"hljs-string\">'give-me-a-stream'</span>,\n    { element, <span class=\"hljs-attr\">count</span>: <span class=\"hljs-number\">10</span> },\n    [port2]\n  )\n\n  <span class=\"hljs-comment\">// ... and we hang on to the other end. The main process will send messages</span>\n  <span class=\"hljs-comment\">// to its end of the port, and close it when it's finished.</span>\n  port1.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    callback(event.data)\n  }\n  port1.onclose = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'stream ended'</span>)\n  }\n}\n\nmakeStreamingRequest(<span class=\"hljs-number\">42</span>, (data) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'got response data:'</span>, event.data)\n})\n<span class=\"hljs-comment\">// We will see \"got response data: 42\" 10 times.</span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n\nipcMain.on(<span class=\"hljs-string\">'give-me-a-stream'</span>, (event, msg) => {\n  <span class=\"hljs-comment\">// The renderer has sent us a MessagePort that it wants us to send our</span>\n  <span class=\"hljs-comment\">// response over.</span>\n  <span class=\"hljs-keyword\">const</span> [replyPort] = event.ports\n\n  <span class=\"hljs-comment\">// Here we send the messages synchronously, but we could just as easily store</span>\n  <span class=\"hljs-comment\">// the port somewhere and send messages asynchronously.</span>\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">let</span> i = <span class=\"hljs-number\">0</span>; i &#x3C; msg.count; i++) {\n    replyPort.postMessage(msg.element)\n  }\n\n  <span class=\"hljs-comment\">// We close the port when we're done to indicate to the other end that we</span>\n  <span class=\"hljs-comment\">// won't be sending any more messages. This isn't strictly necessary--if we</span>\n  <span class=\"hljs-comment\">// didn't explicitly close the port, it would eventually be garbage</span>\n  <span class=\"hljs-comment\">// collected, which would also trigger the 'close' event in the renderer.</span>\n  replyPort.close()\n})\n</code></pre>\n<h3 id=\"communicating-directly-between-the-main-process-and-the-main-world-of-a-context-isolated-page\"><a href=\"#communicating-directly-between-the-main-process-and-the-main-world-of-a-context-isolated-page\">Communicating directly between the main process and the main world of a context-isolated page</a></h3>\n<p>When <a href=\"/docs/tutorial/context-isolation\">context isolation</a> is enabled, IPC messages from the main process to the renderer are delivered to the isolated world, rather than to the main world. Sometimes you want to deliver messages to the main world directly, without having to step through the isolated world.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow, app, MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-comment\">// Create a BrowserWindow with contextIsolation enabled.</span>\n  <span class=\"hljs-keyword\">const</span> bw = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">contextIsolation</span>: <span class=\"hljs-literal\">true</span>,\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n  bw.loadURL(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-comment\">// We'll be sending one end of this channel to the main world of the</span>\n  <span class=\"hljs-comment\">// context-isolated page.</span>\n  <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\n\n  <span class=\"hljs-comment\">// It's OK to send a message on the channel before the other end has</span>\n  <span class=\"hljs-comment\">// registered a listener. Messages will be queued until a listener is</span>\n  <span class=\"hljs-comment\">// registered.</span>\n  port2.postMessage({ <span class=\"hljs-attr\">test</span>: <span class=\"hljs-number\">21</span> })\n\n  <span class=\"hljs-comment\">// We can also receive messages from the main world of the renderer.</span>\n  port2.on(<span class=\"hljs-string\">'message'</span>, (event) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'from renderer main world:'</span>, event.data)\n  })\n  port2.start()\n\n  <span class=\"hljs-comment\">// The preload script will receive this IPC message and transfer the port</span>\n  <span class=\"hljs-comment\">// over to the main world.</span>\n  bw.webContents.postMessage(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// preload.js ////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// We need to wait until the main world is ready to receive the message before</span>\n<span class=\"hljs-comment\">// sending the port. We create this promise in the preload so it's guaranteed</span>\n<span class=\"hljs-comment\">// to register the onload listener before the load event is fired.</span>\n<span class=\"hljs-keyword\">const</span> windowLoaded = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> {\n  <span class=\"hljs-built_in\">window</span>.onload = resolve\n})\n\nipcRenderer.on(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-keyword\">async</span> (event) => {\n  <span class=\"hljs-keyword\">await</span> windowLoaded\n  <span class=\"hljs-comment\">// We use regular window.postMessage to transfer the port from the isolated</span>\n  <span class=\"hljs-comment\">// world to the main world.</span>\n  <span class=\"hljs-built_in\">window</span>.postMessage(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-string\">'*'</span>, event.ports)\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- index.html -------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-built_in\">window</span>.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n  <span class=\"hljs-comment\">// event.source === window means the message is coming from the preload</span>\n  <span class=\"hljs-comment\">// script, as opposed to from an &#x3C;iframe> or other source.</span>\n  <span class=\"hljs-keyword\">if</span> (event.source === <span class=\"hljs-built_in\">window</span> &#x26;&#x26; event.data === <span class=\"hljs-string\">'main-world-port'</span>) {\n    <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n    <span class=\"hljs-comment\">// Once we have the port, we can communicate directly with the main</span>\n    <span class=\"hljs-comment\">// process.</span>\n    port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'from main process:'</span>, event.data)\n      port.postMessage(event.data * <span class=\"hljs-number\">2</span>)\n    }\n  }\n}\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>",
      "title": "MessagePorts in Electron",
      "description": ""
    },
    "/docs/api/structures/mime-typed-buffer": {
      "locale": "pt-BR",
      "slug": "mime-typed-buffer",
      "href": "/docs/api/structures/mime-typed-buffer",
      "crowdinFileId": "256463",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mime-typed-buffer.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mimetypedbuffer-object\"><a href=\"#mimetypedbuffer-object\">MimeTypedBuffer Object</a></h1>\n<ul>\n<li><code>mimeType</code> String (optional) - MIME type of the buffer.</li>\n<li><code>charset</code> String (optional) - Charset of the buffer.</li>\n<li><code>data</code> Buffer - The actual Buffer content.</li>\n</ul>",
      "title": "MimeTypedBuffer Object",
      "description": ""
    },
    "/docs/api/structures/mouse-input-event": {
      "locale": "pt-BR",
      "slug": "mouse-input-event",
      "href": "/docs/api/structures/mouse-input-event",
      "crowdinFileId": "256465",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mouse-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mouseinputevent-object-extends-inputevent\"><a href=\"#mouseinputevent-object-extends-inputevent\">MouseInputEvent Object extends <code>InputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>mouseDown</code>, <code>mouseUp</code>, <code>mouseEnter</code>, <code>mouseLeave</code>, <code>contextMenu</code>, <code>mouseWheel</code> or <code>mouseMove</code>.</li>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n<li><code>button</code> String (optional) - The button pressed, can be <code>left</code>, <code>middle</code>, <code>right</code>.</li>\n<li><code>globalX</code> Integer (optional)</li>\n<li><code>globalY</code> Integer (optional)</li>\n<li><code>movementX</code> Integer (optional)</li>\n<li><code>movementY</code> Integer (optional)</li>\n<li><code>clickCount</code> Integer (optional)</li>\n</ul>",
      "title": "MouseInputEvent Object extends InputEvent",
      "description": ""
    },
    "/docs/api/structures/mouse-wheel-input-event": {
      "locale": "pt-BR",
      "slug": "mouse-wheel-input-event",
      "href": "/docs/api/structures/mouse-wheel-input-event",
      "crowdinFileId": "256467",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mouse-wheel-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mousewheelinputevent-object-extends-mouseinputevent\"><a href=\"#mousewheelinputevent-object-extends-mouseinputevent\">MouseWheelInputEvent Object extends <code>MouseInputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>mouseWheel</code>.</li>\n<li><code>deltaX</code> Integer (optional)</li>\n<li><code>deltaY</code> Integer (optional)</li>\n<li><code>wheelTicksX</code> Integer (optional)</li>\n<li><code>wheelTicksY</code> Integer (optional)</li>\n<li><code>accelerationRatioX</code> Integer (optional)</li>\n<li><code>accelerationRatioY</code> Integer (optional)</li>\n<li><code>hasPreciseScrollingDeltas</code> Boolean (optional)</li>\n<li><code>canScroll</code> Boolean (optional)</li>\n</ul>",
      "title": "MouseWheelInputEvent Object extends MouseInputEvent",
      "description": ""
    },
    "/docs/tutorial/multithreading": {
      "locale": "pt-BR",
      "slug": "multithreading",
      "href": "/docs/tutorial/multithreading",
      "crowdinFileId": "256221",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/multithreading.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"multitarefa\"><a href=\"#multitarefa\">Multitarefa</a></h1>\n<p>Com o <a href=\"https://developer.mozilla.org/en/docs/Web/API/Web_Workers_API/Using_web_workers\">Web Workers</a>, é possível executar JavaScript em nível de tarefas de um sistema operacional.</p>\n<h2 id=\"multi-tarefas-com-nodejs\"><a href=\"#multi-tarefas-com-nodejs\">Multi-tarefas com Node.js</a></h2>\n<p>É possível usar os recursos de Node.js em Electron Web Workers,para fazer issso use a opção <code>nodeIntegrationInWorker</code> deve ser definida como <code>true</code> em <code>webPreferences</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegrationInWorker</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<p>O <code>nodeIntegrationInWorker</code> pode ser usado independente do <code>nodeIntegration</code>, mas o <code>sandbox</code> não deve ser definido para <code>true</code>.</p>\n<h2 id=\"apis-disponíveis\"><a href=\"#apis-disponíveis\">APIs Disponíveis</a></h2>\n<p>Todos os módulos internos do Node.js são suportados em Web Workers e <code>asar</code>, arquivos ainda podem ser lidos com Node.js APIs. No entando, nenhum dos módulos internos do Electron pode ser usado em um ambiente multitarefa.</p>\n<h2 id=\"módulos-nativos-do-nodejs\"><a href=\"#módulos-nativos-do-nodejs\">Módulos nativos do Node.js</a></h2>\n<p>Qualquer módulo nativo do Node.js pode ser carregado diretamente em Web Workers, mas é altamente recomendável não fazer isso. A maioria dos módulos nativos existentes foram escritos para ambiente single-threaded (sem multitarefa), usá-los em Web Workers vai levar a falhas e corrupções de memória.</p>\n<p>Observe que mesmo se um módulo nativo do Node.js é thread-safe (tarefa seguro) ele ainda assim não é seguro para carregá-lo em um Web Worker, porque a função <code>process.dlopen</code> não é thread-safe.</p>\n<p>A única maneira de carregar um módulo nativo, com segurança, por enquanto, é certificar-se de que o aplicativo carrega os módulos nativos após começar o Web Workers.</p>\n<pre><code class=\"hljs language-javascript\">process.dlopen = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Load native module is not safe'</span>)\n}\n<span class=\"hljs-keyword\">const</span> worker = <span class=\"hljs-keyword\">new</span> Worker(<span class=\"hljs-string\">'script.js'</span>)\n</code></pre>",
      "title": "Multitarefa",
      "description": ""
    },
    "/docs/tutorial/native-file-drag-drop": {
      "locale": "pt-BR",
      "slug": "native-file-drag-drop",
      "href": "/docs/tutorial/native-file-drag-drop",
      "crowdinFileId": "256223",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/native-file-drag-drop.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nativo-arquivo-drag--drop\"><a href=\"#nativo-arquivo-drag--drop\">Nativo Arquivo Drag &#x26; Drop</a></h1>\n<h2 id=\"visão-geral\"><a href=\"#visão-geral\">Visão Geral</a></h2>\n<p>Alguns tipos de aplicativos que manipulam arquivos talvez queiram oferecer suporte ao recurso de drag &#x26; drop (arrastar e soltar) nativo do sistema operacional. Arrastar arquivos para a web é bastante comum e utilizado por muitos sites. Além disso, Electron adicionou suporte para arrastar arquivos e conteúdos de fora do conteúdo web para o mundo do sistema operacional.</p>\n<p>To implement this feature in your app, you need to call the <a href=\"/docs/api/web-contents#contentsstartdragitem\"><code>webContents.startDrag(item)</code></a> API in response to the <code>ondragstart</code> event.</p>\n<h2 id=\"exemplo\"><a href=\"#exemplo\">Exemplo</a></h2>\n<p>An example demonstrating how you can create a file on the fly to be dragged out of the window.</p>\n<h3 id=\"preloadjs\"><a href=\"#preloadjs\">Preload.js</a></h3>\n<p>In <code>preload.js</code> use the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> to inject a method <code>window.electron.startDrag(...)</code> that will send an IPC message to the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'electron'</span>, {\n  <span class=\"hljs-attr\">startDrag</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">fileName</span>) =></span> {\n    ipcRenderer.send(<span class=\"hljs-string\">'ondragstart'</span>, path.join(process.cwd(), fileName))\n  }\n})\n</code></pre>\n<h3 id=\"indexhtml\"><a href=\"#indexhtml\">Index.html</a></h3>\n<p>Add a draggable element to <code>index.html</code>, and reference your renderer script:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">div</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"border:2px solid black;border-radius:3px;padding:5px;display:inline-block\"</span> <span class=\"hljs-attr\">draggable</span>=<span class=\"hljs-string\">\"true\"</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"drag\"</span>></span>Drag me<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">div</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h3 id=\"rendererjs\"><a href=\"#rendererjs\">Renderer.js</a></h3>\n<p>In <code>renderer.js</code> set up the renderer process to handle drag events by calling the method you added via the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> above.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'drag'</span>).ondragstart = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n  event.preventDefault()\n  <span class=\"hljs-built_in\">window</span>.electron.startDrag(<span class=\"hljs-string\">'drag-and-drop.md'</span>)\n}\n</code></pre>\n<h3 id=\"mainjs\"><a href=\"#mainjs\">Main.js</a></h3>\n<p>In the Main process (<code>main.js</code> file), expand the received event with a path to the file that is being dragged and an icon:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/drag-and-drop\"><span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nipcMain.on(<span class=\"hljs-string\">'ondragstart'</span>, (event, filePath) => {\n  event.sender.startDrag({\n    <span class=\"hljs-attr\">file</span>: filePath,\n    <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'/path/to/icon.png'</span>\n  })\n})\n</code></pre>\n<p>After launching the Electron application, try dragging and dropping the item from the BrowserWindow onto your desktop. In this guide, the item is a Markdown file located in the root of the project:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/drag-and-drop.gif\" alt=\"Drag and drop\"></p>",
      "title": "Nativo Arquivo Drag & Drop",
      "description": ""
    },
    "/docs/api/native-image": {
      "locale": "pt-BR",
      "slug": "native-image",
      "href": "/docs/api/native-image",
      "crowdinFileId": "256341",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/native-image.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nativeimage\"><a href=\"#nativeimage\">nativeImage</a></h1>\n<blockquote>\n<p>Cria ícones de bandeija, dock e aplicações usando arquivos PNG ou JPG.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>In Electron, for the APIs that take images, you can pass either file paths or <code>NativeImage</code> instances. An empty image will be used when <code>null</code> is passed.</p>\n<p>Por exemplo, quando for criar uma bandeija ou designar um ícone para uma janela, você pode passar um caminho de arquivo de imagem com a <code>String</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'/Users/somebody/images/window.png'</span> })\n<span class=\"hljs-built_in\">console</span>.log(appIcon, win)\n</code></pre>\n<p>Or read the image from the clipboard, which returns a <code>NativeImage</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { clipboard, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> image = clipboard.readImage()\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(image)\n<span class=\"hljs-built_in\">console</span>.log(appIcon)\n</code></pre>\n<h2 id=\"formatos-suportados\"><a href=\"#formatos-suportados\">Formatos Suportados</a></h2>\n<p>Currently <code>PNG</code> and <code>JPEG</code> image formats are supported. <code>PNG</code> is recommended because of its support for transparency and lossless compression.</p>\n<p>On Windows, you can also load <code>ICO</code> icons from file paths. For best visual quality, it is recommended to include at least the following sizes in the:</p>\n<ul>\n<li>Ícone pequeno<ul>\n<li>16x16 (com escala de DPI com 100%)</li>\n<li>20x20 (com escala de DPI com 125%)</li>\n<li>24x24 (com escala de DPI com 150%)</li>\n<li>32x32 (com escala de DPI com 200%)</li>\n</ul></li>\n<li>Ícone grande<ul>\n<li>32x32 (com escala de DPI com 100%)</li>\n<li>40x40 (com escala de DPI com 150%)</li>\n<li>48x48 (com escala de DPI com 150%)</li>\n<li>64x64 (com escala de DPI com 200%)</li>\n<li>256x256</li>\n</ul></li>\n</ul>\n<p>Confira a seção <em>Size requirements</em> <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dn742485(v=vs.85).aspx\">nesse artigo</a>.</p>\n<h2 id=\"imagem-em-alta-resolução\"><a href=\"#imagem-em-alta-resolução\">Imagem em Alta Resolução</a></h2>\n<p>Em plataformas que possuem suporte para high-DPI como a tela Retina da Apple, você pode acrescentar <code>@2x</code> depois do nome base da imagem para marcar-la como imagem de alta resolução.</p>\n<p>For example, if <code>icon.png</code> is a normal image that has standard resolution, then <code>icon@2x.png</code> will be treated as a high resolution image that has double DPI density.</p>\n<p>If you want to support displays with different DPI densities at the same time, you can put images with different sizes in the same folder and use the filename without DPI suffixes. Como por exemplo:</p>\n<pre><code class=\"hljs language-plaintext\">images/\n├── icon.png\n├── icon@2x.png\n└── icon@3x.png\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-built_in\">console</span>.log(appIcon)\n</code></pre>\n<p>The following suffixes for DPI are also supported:</p>\n<ul>\n<li><code>@1x</code></li>\n<li><code>@1.25x</code></li>\n<li><code>@1.33x</code></li>\n<li><code>@1.4x</code></li>\n<li><code>@1.5x</code></li>\n<li><code>@1.8x</code></li>\n<li><code>@2x</code></li>\n<li><code>@2.5x</code></li>\n<li><code>@3x</code></li>\n<li><code>@4x</code></li>\n<li><code>@5x</code></li>\n</ul>\n<h2 id=\"modelo-de-imagem\"><a href=\"#modelo-de-imagem\">Modelo de Imagem</a></h2>\n<p>Template images consist of black and an alpha channel. Imagens padrão não são destinadas a serem usadas sozinhas, e geralmente são acompanhadas por outros conteúdos para criar a aparência final desejada.</p>\n<p>The most common case is to use template images for a menu bar icon, so it can adapt to both light and dark menu bars.</p>\n<p><strong>Nota:</strong> Imagens padrão são suportadas somente no macOS.</p>\n<p>To mark an image as a template image, its filename should end with the word <code>Template</code>. Como por exemplo:</p>\n<ul>\n<li><code>xxxTemplate.png</code></li>\n<li><code>xxxTemplate@2x.png</code></li>\n</ul>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>nativeImage</code> possui os seguintes métodos, todos os quais retornam uma instância da classe <code>NativeImage</code>:</p>\n<h3 id=\"nativeimagecreateempty\"><a href=\"#nativeimagecreateempty\"><code>nativeImage.createEmpty()</code></a></h3>\n<p>Retorna <code>NativeImage</code></p>\n<p>Cria uma instância <code>NativeImage</code> vazia.</p>\n<h3 id=\"nativeimagecreatethumbnailfrompathpath-maxsize-macos-windows\"><a href=\"#nativeimagecreatethumbnailfrompathpath-maxsize-macos-windows\"><code>nativeImage.createThumbnailFromPath(path, maxSize)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>path</code> String - path to a file that we intend to construct a thumbnail out of.</li>\n<li><code>maxSize</code> <a href=\"/docs/api/structures/size\">Size</a> - the maximum width and height (positive numbers) the thumbnail returned can be. The Windows implementation will ignore <code>maxSize.height</code> and scale the height according to <code>maxSize.width</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - fulfilled with the file's thumbnail preview image, which is a <a href=\"/docs/api/native-image\">NativeImage</a>.</p>\n<h3 id=\"nativeimagecreatefrompathpath\"><a href=\"#nativeimagecreatefrompathpath\"><code>nativeImage.createFromPath(path)</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Retorna <code>NativeImage</code></p>\n<p>Cria uma nova instância <code>NativeImage</code> de um arquivo localizado em <code>path</code>. Esse método retorna uma imagem vazia se <code>path</code> não existir, não poder ser lido, ou não ser uma imagem válida.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> nativeImage = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).nativeImage\n\n<span class=\"hljs-keyword\">const</span> image = nativeImage.createFromPath(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-built_in\">console</span>.log(image)\n</code></pre>\n<h3 id=\"nativeimagecreatefrombitmapbuffer-options\"><a href=\"#nativeimagecreatefrombitmapbuffer-options\"><code>nativeImage.createFromBitmap(buffer, options)</code></a></h3>\n<ul>\n<li><code>buffer</code> <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a></li>\n<li><code>options</code> Object<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>scaleFactor</code> Double (opcional) - Padrão sendo 1.0.</li>\n</ul></li>\n</ul>\n<p>Retorna <code>NativeImage</code></p>\n<p>Creates a new <code>NativeImage</code> instance from <code>buffer</code> that contains the raw bitmap pixel data returned by <code>toBitmap()</code>. The specific format is platform-dependent.</p>\n<h3 id=\"nativeimagecreatefrombufferbuffer-options\"><a href=\"#nativeimagecreatefrombufferbuffer-options\"><code>nativeImage.createFromBuffer(buffer[, options])</code></a></h3>\n<ul>\n<li><code>buffer</code> <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a></li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>width</code> Integer (opicional) - Necessário para buffers de bitmap.</li>\n<li><code>height</code> Integer (opicional) - Necessário para buffers de bitmap.</li>\n<li><code>scaleFactor</code> Double (opcional) - Padrão sendo 1.0.</li>\n</ul></li>\n</ul>\n<p>Retorna <code>NativeImage</code></p>\n<p>Cria uma nova instância <code>NativeImage</code> a partir do <code>buffer</code>. Tries to decode as PNG or JPEG first.</p>\n<h3 id=\"nativeimagecreatefromdataurldataurl\"><a href=\"#nativeimagecreatefromdataurldataurl\"><code>nativeImage.createFromDataURL(dataURL)</code></a></h3>\n<ul>\n<li><code>dataURL</code> String</li>\n</ul>\n<p>Retorna <code>NativeImage</code></p>\n<p>Cria uma nova instância <code>NativeImage</code> a partir do <code>dataURL</code>.</p>\n<h3 id=\"nativeimagecreatefromnamedimageimagename-hslshift-macos\"><a href=\"#nativeimagecreatefromnamedimageimagename-hslshift-macos\"><code>nativeImage.createFromNamedImage(imageName[, hslShift])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>imageName</code> String</li>\n<li><code>hslShift</code> Number<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Retorna <code>NativeImage</code></p>\n<p>Cria uma nova instância de <code>NativeImage</code> a partir de NSImage o qual direciona para o dado nome da Imagem. Veja <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/system-icons/\"><code>System Icons</code></a> para uma lista dos possíveis valores.</p>\n<p>O <code>hslShift</code> é aplicado à imagem com as seguintes regras:</p>\n<ul>\n<li><code>hsl_shift[0]</code> (hue): The absolute hue value for the image - 0 and 1 map to 0 and 360 on the hue color wheel (red).</li>\n<li><code>hsl_shift[1]</code> (saturation): A saturation shift for the image, with the following key values: 0 = remove all color. 0.5 = leave unchanged. 1 = fully saturate the image.</li>\n<li><code>hsl_shift[2]</code> (lightness): A lightness shift for the image, with the following key values: 0 = remove all lightness (make all pixels black). 0.5 = leave unchanged. 1 = full lightness (make all pixels white).</li>\n</ul>\n<p>Isso significa que <code>[-1, 0, 1]</code> irá deixar a imagem totalmente branca e <code>[-1, 1, 0]</code> irá deixar a imagem totalmente preta.</p>\n<p>In some cases, the <code>NSImageName</code> doesn't match its string representation; one example of this is <code>NSFolderImageName</code>, whose string representation would actually be <code>NSFolder</code>. Therefore, you'll need to determine the correct string representation for your image before passing it in. This can be done with the following:</p>\n<p><code>echo -e '#import &#x3C;Cocoa/Cocoa.h>\\nint main() { NSLog(@\"%@\", SYSTEM_IMAGE_NAME); }' | clang -otest -x objective-c -framework Cocoa - &#x26;&#x26; ./test</code></p>\n<p>where <code>SYSTEM_IMAGE_NAME</code> should be replaced with any value from <a href=\"https://developer.apple.com/documentation/appkit/nsimagename?language=objc\">this list</a>.</p>\n<h2 id=\"class-nativeimage\"><a href=\"#class-nativeimage\">Class: NativeImage</a></h2>\n<blockquote>\n<p>Natively wrap images such as tray, dock, and application icons.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<p>Os seguintes métodos estão disponíveis nas instâncias da classe <code>NativeImage</code>:</p>\n<h4 id=\"imagetopngoptions\"><a href=\"#imagetopngoptions\"><code>image.toPNG([options])</code></a></h4>\n<ul>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>scaleFactor</code> Double (opcional) - Padrão sendo 1.0.</li>\n</ul></li>\n</ul>\n<p>Retorna <code>Buffer</code> - Um <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> que contém os dados codificados de <code>PNG</code> da imagem.</p>\n<h4 id=\"imagetojpegquality\"><a href=\"#imagetojpegquality\"><code>image.toJPEG(quality)</code></a></h4>\n<ul>\n<li><code>quality</code> Integer - Between 0 - 100.</li>\n</ul>\n<p>Retorna <code>Buffer</code> - Um <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> que contém os dados codificados de <code>JPG</code> da imagem.</p>\n<h4 id=\"imagetobitmapoptions\"><a href=\"#imagetobitmapoptions\"><code>image.toBitmap([options])</code></a></h4>\n<ul>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>scaleFactor</code> Double (opcional) - Padrão sendo 1.0.</li>\n</ul></li>\n</ul>\n<p>Retorna <code>Buffer</code> - Um <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> que contém uma copia dos dados de bitmap crus (sem alterações) da imagem.</p>\n<h4 id=\"imagetodataurloptions\"><a href=\"#imagetodataurloptions\"><code>image.toDataURL([options])</code></a></h4>\n<ul>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>scaleFactor</code> Double (opcional) - Padrão sendo 1.0.</li>\n</ul></li>\n</ul>\n<p>Retorna <code>String</code> - Os dados de URL da imagem.</p>\n<h4 id=\"imagegetbitmapoptions\"><a href=\"#imagegetbitmapoptions\"><code>image.getBitmap([options])</code></a></h4>\n<ul>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>scaleFactor</code> Double (opcional) - Padrão sendo 1.0.</li>\n</ul></li>\n</ul>\n<p>Retorna <code>Buffer</code> - Um <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> que contém os dados de bitmap crus (sem alterações) da imagem.</p>\n<p>The difference between <code>getBitmap()</code> and <code>toBitmap()</code> is that <code>getBitmap()</code> does not copy the bitmap data, so you have to use the returned Buffer immediately in current event loop tick; otherwise the data might be changed or destroyed.</p>\n<h4 id=\"imagegetnativehandle-no-macos\"><a href=\"#imagegetnativehandle-no-macos\"><code>image.getNativeHandle()</code> no <em>macOS</em></a></h4>\n<p>Returns <code>Buffer</code> - A <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> that stores C pointer to underlying native handle of the image. On macOS, a pointer to <code>NSImage</code> instance would be returned.</p>\n<p>Perceba que o ponteiro retornado é um ponteiro fraco para a imagem nativa subjacente invés de uma cópia, então você <em>deve</em> se certificar de que a instância <code>nativeImage</code> esteja próxima.</p>\n<h4 id=\"imageisempty\"><a href=\"#imageisempty\"><code>image.isEmpty()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the image is empty.</p>\n<h4 id=\"imagegetsizescalefactor\"><a href=\"#imagegetsizescalefactor\"><code>image.getSize([scaleFactor])</code></a></h4>\n<ul>\n<li><code>scaleFactor</code> Double (opcional) - Padrão sendo 1.0.</li>\n</ul>\n<p>Retorna <a href=\"/docs/api/structures/size\"><code>Size</code></a>.</p>\n<p>If <code>scaleFactor</code> is passed, this will return the size corresponding to the image representation most closely matching the passed value.</p>\n<h4 id=\"imagesettemplateimageoption\"><a href=\"#imagesettemplateimageoption\"><code>image.setTemplateImage(option)</code></a></h4>\n<ul>\n<li><code>option</code> Boolean</li>\n</ul>\n<p>Marca a imagem como uma imagem padrão.</p>\n<h4 id=\"imageistemplateimage\"><a href=\"#imageistemplateimage\"><code>image.isTemplateImage()</code></a></h4>\n<p>Retorna <code>Boolean</code> - sendo a imagem uma imagem padrão ou não.</p>\n<h4 id=\"imagecroprect\"><a href=\"#imagecroprect\"><code>image.crop(rect)</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - A área da imagem a ser cortada.</li>\n</ul>\n<p>Retorna <code>NativeImage</code> - A imagem cortada.</p>\n<h4 id=\"imageresizeoptions\"><a href=\"#imageresizeoptions\"><code>image.resize(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>width</code> Integer (optional) - Defaults to the image's width.</li>\n<li><code>height</code> Integer (optional) - Defaults to the image's height.</li>\n<li><code>quality</code> String (optional) - The desired quality of the resize image. Os valores possíveis são: <code>good</code>, <code>better</code> ou <code>best</code>. O padrão é <code>best</code>. Esses valores apresentam a qualidade/velocidade de troca desejada. They are translated into an algorithm-specific method that depends on the capabilities (CPU, GPU) of the underlying platform. It is possible for all three methods to be mapped to the same algorithm on a given platform.</li>\n</ul></li>\n</ul>\n<p>Retorna <code>NativeImage</code> - A imagem redimensionada.</p>\n<p>Se apenas o <code>height</code> ou o <code>width</code> forem definidos então a atual proporção de tela da imagem será preservada na imagem redimensionada.</p>\n<h4 id=\"imagegetaspectratioscalefactor\"><a href=\"#imagegetaspectratioscalefactor\"><code>image.getAspectRatio([scaleFactor])</code></a></h4>\n<ul>\n<li><code>scaleFactor</code> Double (opcional) - Padrão sendo 1.0.</li>\n</ul>\n<p>Retorna <code>Float</code> - A proporção de tela da imagem.</p>\n<p>If <code>scaleFactor</code> is passed, this will return the aspect ratio corresponding to the image representation most closely matching the passed value.</p>\n<h4 id=\"imagegetscalefactors\"><a href=\"#imagegetscalefactors\"><code>image.getScaleFactors()</code></a></h4>\n<p>Returns <code>Float[]</code> - An array of all scale factors corresponding to representations for a given nativeImage.</p>\n<h4 id=\"imageaddrepresentationoptions\"><a href=\"#imageaddrepresentationoptions\"><code>image.addRepresentation(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>scaleFactor</code> Double - The scale factor to add the image representation for.</li>\n<li><code>width</code> Integer (optional) - Padrão sendo 0. Required if a bitmap buffer is specified as <code>buffer</code>.</li>\n<li><code>height</code> Integer (opcional) - Padrão sendo 0. Required if a bitmap buffer is specified as <code>buffer</code>.</li>\n<li><code>buffer</code> Buffer (opcional) - O buffer contendo os dados crus (sem alteração) da imagem.</li>\n<li><code>dataURL</code> String (optional) - The data URL containing either a base 64 encoded PNG or JPEG image.</li>\n</ul></li>\n</ul>\n<p>Add an image representation for a specific scale factor. This can be used to explicitly add different scale factor representations to an image. This can be called on empty images.</p>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<h4 id=\"nativeimageismactemplateimage-no-macos\"><a href=\"#nativeimageismactemplateimage-no-macos\"><code>nativeImage.isMacTemplateImage</code> no <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the image is considered a <a href=\"https://developer.apple.com/documentation/appkit/nsimage/1520017-template\">template image</a>.</p>\n<p>Please note that this property only has an effect on macOS.</p>",
      "title": "nativeImage",
      "description": "Cria ícones de bandeija, dock e aplicações usando arquivos PNG ou JPG."
    },
    "/docs/api/native-theme": {
      "locale": "pt-BR",
      "slug": "native-theme",
      "href": "/docs/api/native-theme",
      "crowdinFileId": "256343",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/native-theme.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nativetheme\"><a href=\"#nativetheme\">nativeTheme</a></h1>\n<blockquote>\n<p>Read and respond to changes in Chromium's native color theme.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h2 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h2>\n<p>O módulo <code>nativeTheme</code> emite os seguintes eventos:</p>\n<h3 id=\"event-updated\"><a href=\"#event-updated\">Event: 'updated'</a></h3>\n<p>Emitted when something in the underlying NativeTheme has changed. This normally means that either the value of <code>shouldUseDarkColors</code>, <code>shouldUseHighContrastColors</code> or <code>shouldUseInvertedColorScheme</code> has changed. You will have to check them to determine which one has changed.</p>\n<h2 id=\"propriedades\"><a href=\"#propriedades\">Propriedades</a></h2>\n<p>The <code>nativeTheme</code> module has the following properties:</p>\n<h3 id=\"nativethemeshouldusedarkcolors-readonly\"><a href=\"#nativethemeshouldusedarkcolors-readonly\"><code>nativeTheme.shouldUseDarkColors</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> for if the OS / Chromium currently has a dark mode enabled or is being instructed to show a dark-style UI.  If you want to modify this value you should use <code>themeSource</code> below.</p>\n<h3 id=\"nativethemethemesource\"><a href=\"#nativethemethemesource\"><code>nativeTheme.themeSource</code></a></h3>\n<p>A <code>String</code> property that can be <code>system</code>, <code>light</code> or <code>dark</code>.  Ela é usada para sobrepor e substituir o valor que o Chromium escolheu para usar internamente.</p>\n<p>Setting this property to <code>system</code> will remove the override and everything will be reset to the OS default.  By default <code>themeSource</code> is <code>system</code>.</p>\n<p>Settings this property to <code>dark</code> will have the following effects:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code> will be <code>true</code> when accessed</li>\n<li>Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the dark UI.</li>\n<li>Any UI the OS renders on macOS including menus, window frames, etc. will use the dark UI.</li>\n<li>The <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> CSS query will match <code>dark</code> mode.</li>\n<li>The <code>updated</code> event will be emitted</li>\n</ul>\n<p>Settings this property to <code>light</code> will have the following effects:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code> will be <code>false</code> when accessed</li>\n<li>Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the light UI.</li>\n<li>Any UI the OS renders on macOS including menus, window frames, etc. will use the light UI.</li>\n<li>The <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> CSS query will match <code>light</code> mode.</li>\n<li>The <code>updated</code> event will be emitted</li>\n</ul>\n<p>The usage of this property should align with a classic \"dark mode\" state machine in your application where the user has three options.</p>\n<ul>\n<li><code>Padrão do Sistema</code> --> <code>themeSource = 'system'</code></li>\n<li><code>Modo Escuro</code> --> <code>themeSource = 'dark'</code></li>\n<li><code>Modo Claro</code> --> <code>themeSource = 'light'</code></li>\n</ul>\n<p>Your application should then always use <code>shouldUseDarkColors</code> to determine what CSS to apply.</p>\n<h3 id=\"nativethemeshouldusehighcontrastcolors-macos-windows-readonly\"><a href=\"#nativethemeshouldusehighcontrastcolors-macos-windows-readonly\"><code>nativeTheme.shouldUseHighContrastColors</code> <em>macOS</em> <em>Windows</em> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> for if the OS / Chromium currently has high-contrast mode enabled or is being instructed to show a high-contrast UI.</p>\n<h3 id=\"nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly\"><a href=\"#nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly\"><code>nativeTheme.shouldUseInvertedColorScheme</code> <em>macOS</em> <em>Windows</em> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> for if the OS / Chromium currently has an inverted color scheme or is being instructed to use an inverted color scheme.</p>",
      "title": "nativeTheme",
      "description": "Read and respond to changes in Chromium's native color theme."
    },
    "/docs/api/net": {
      "locale": "pt-BR",
      "slug": "net",
      "href": "/docs/api/net",
      "crowdinFileId": "256347",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/net.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"net\"><a href=\"#net\">net</a></h1>\n<blockquote>\n<p>Issue HTTP/HTTPS requests using Chromium's native networking library</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>The <code>net</code> module is a client-side API for issuing HTTP(S) requests. It is similar to the <a href=\"https://nodejs.org/api/http.html\">HTTP</a> and <a href=\"https://nodejs.org/api/https.html\">HTTPS</a> modules of Node.js but uses Chromium's native networking library instead of the Node.js implementation, offering better support for web proxies. It also supports checking network status.</p>\n<p>The following is a non-exhaustive list of why you may consider using the <code>net</code> module instead of the native Node.js modules:</p>\n<ul>\n<li>Automatic management of system proxy configuration, support of the wpad protocol and proxy pac configuration files.</li>\n<li>Automatic tunneling of HTTPS requests.</li>\n<li>Support for authenticating proxies using basic, digest, NTLM, Kerberos or negotiate authentication schemes.</li>\n<li>Support for traffic monitoring proxies: Fiddler-like proxies used for access control and monitoring.</li>\n</ul>\n<p>The API components (including classes, methods, properties and event names) are similar to those used in Node.js.</p>\n<p>Example usage:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> { net } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n  <span class=\"hljs-keyword\">const</span> request = net.request(<span class=\"hljs-string\">'https://github.com'</span>)\n  request.on(<span class=\"hljs-string\">'response'</span>, (response) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`STATUS: <span class=\"hljs-subst\">${response.statusCode}</span>`</span>)\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`HEADERS: <span class=\"hljs-subst\">${<span class=\"hljs-built_in\">JSON</span>.stringify(response.headers)}</span>`</span>)\n    response.on(<span class=\"hljs-string\">'data'</span>, (chunk) => {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`BODY: <span class=\"hljs-subst\">${chunk}</span>`</span>)\n    })\n    response.on(<span class=\"hljs-string\">'end'</span>, () => {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'No more data in response.'</span>)\n    })\n  })\n  request.end()\n})\n</code></pre>\n<p>The <code>net</code> API can be used only after the application emits the <code>ready</code> event. Trying to use the module before the <code>ready</code> event will throw an error.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>net</code> possui os seguintes métodos:</p>\n<h3 id=\"netrequestoptions\"><a href=\"#netrequestoptions\"><code>net.request(options)</code></a></h3>\n<ul>\n<li><code>options</code> (ClientRequestConstructorOptions | String) - The <code>ClientRequest</code> constructor options.</li>\n</ul>\n<p>Retorna <a href=\"/docs/api/client-request\"><code>ClientRequest</code></a></p>\n<p>Creates a <a href=\"/docs/api/client-request\"><code>ClientRequest</code></a> instance using the provided <code>options</code> which are directly forwarded to the <code>ClientRequest</code> constructor. The <code>net.request</code> method would be used to issue both secure and insecure HTTP requests according to the specified protocol scheme in the <code>options</code> object.</p>\n<h3 id=\"netisonline\"><a href=\"#netisonline\"><code>net.isOnline()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether there is currently internet connection.</p>\n<p>A return value of <code>false</code> is a pretty strong indicator that the user won't be able to connect to remote sites. However, a return value of <code>true</code> is inconclusive; even if some link is up, it is uncertain whether a particular connection attempt to a particular remote site will be successful.</p>\n<h2 id=\"propriedades\"><a href=\"#propriedades\">Propriedades</a></h2>\n<h3 id=\"netonline-readonly\"><a href=\"#netonline-readonly\"><code>net.online</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> property. Whether there is currently internet connection.</p>\n<p>A return value of <code>false</code> is a pretty strong indicator that the user won't be able to connect to remote sites. However, a return value of <code>true</code> is inconclusive; even if some link is up, it is uncertain whether a particular connection attempt to a particular remote site will be successful.</p>",
      "title": "net",
      "description": "Issue HTTP/HTTPS requests using Chromium's native networking library"
    },
    "/docs/api/net-log": {
      "locale": "pt-BR",
      "slug": "net-log",
      "href": "/docs/api/net-log",
      "crowdinFileId": "256345",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/net-log.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"netlog\"><a href=\"#netlog\">netLog</a></h1>\n<blockquote>\n<p>Logging network events for a session.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { netLog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> netLog.startLogging(<span class=\"hljs-string\">'/path/to/net-log'</span>)\n  <span class=\"hljs-comment\">// After some network events</span>\n  <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> netLog.stopLogging()\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Net-logs written to'</span>, path)\n})\n</code></pre>\n<p>See <a href=\"/docs/api/command-line-switches#--log-net-logpath\"><code>--log-net-log</code></a> to log network events throughout the app's lifecycle.</p>\n<p><strong>Nota:</strong> Todos os métodos, a menos que seja especificados, só podem ser usados ​​após o evento <code>app</code> quando é emitido.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<h3 id=\"netlogstartloggingpath-options\"><a href=\"#netlogstartloggingpath-options\"><code>netLog.startLogging(path[, options])</code></a></h3>\n<ul>\n<li><code>path</code> String - File path to record network logs.</li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>captureMode</code> String (optional) - What kinds of data should be captured. By default, only metadata about requests will be captured. Setting this to <code>includeSensitive</code> will include cookies and authentication data. Setting it to <code>everything</code> will include all bytes transferred on sockets. Can be <code>default</code>, <code>includeSensitive</code> or <code>everything</code>.</li>\n<li><code>maxFileSize</code> Number (optional) - When the log grows beyond this size, logging will automatically stop. Defaults to unlimited.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the net log has begun recording.</p>\n<p>Starts recording network events to <code>path</code>.</p>\n<h3 id=\"netlogstoplogging\"><a href=\"#netlogstoplogging\"><code>netLog.stopLogging()</code></a></h3>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the net log has been flushed to disk.</p>\n<p>Stops recording network events. If not called, net logging will automatically end when app quits.</p>\n<h2 id=\"propriedades\"><a href=\"#propriedades\">Propriedades</a></h2>\n<h3 id=\"netlogcurrentlylogging-readonly\"><a href=\"#netlogcurrentlylogging-readonly\"><code>netLog.currentlyLogging</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> property that indicates whether network logs are currently being recorded.</p>",
      "title": "netLog",
      "description": "Logging network events for a session."
    },
    "/docs/api/structures/new-window-web-contents-event": {
      "locale": "pt-BR",
      "slug": "new-window-web-contents-event",
      "href": "/docs/api/structures/new-window-web-contents-event",
      "crowdinFileId": "256469",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/new-window-web-contents-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"newwindowwebcontentsevent-object-extends-event\"><a href=\"#newwindowwebcontentsevent-object-extends-event\">NewWindowWebContentsEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>newGuest</code> BrowserWindow (optional)</li>\n</ul>",
      "title": "NewWindowWebContentsEvent Object extends Event",
      "description": ""
    },
    "/docs/api/notification": {
      "locale": "pt-BR",
      "slug": "notification",
      "href": "/docs/api/notification",
      "crowdinFileId": "256349",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/notification.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificação\"><a href=\"#notificação\">Notificação</a></h1>\n<blockquote>\n<p>Criar notificações para o desktop do sistema</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h2 id=\"using-in-the-renderer-process\"><a href=\"#using-in-the-renderer-process\">Using in the renderer process</a></h2>\n<p>If you want to show Notifications from a renderer process you should use the <a href=\"/docs/tutorial/notifications\">HTML5 Notification API</a></p>\n<h2 id=\"class-notification\"><a href=\"#class-notification\">Class: Notification</a></h2>\n<blockquote>\n<p>Criar notificações para o desktop do sistema</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>Notification</code> é um <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p>O mesmo cria um novo <code>Notification</code> com propriedades nativas informadas como a opção <code>options</code>.</p>\n<h3 id=\"métodos-estáticos\"><a href=\"#métodos-estáticos\">Métodos estáticos</a></h3>\n<p>A classe <code>Notification</code> tem os seguintes métodos estáticos:</p>\n<h4 id=\"notificationissupported\"><a href=\"#notificationissupported\"><code>Notification.isSupported()</code></a></h4>\n<p>Retorna <code>Boolean</code> - se as notificações do desktop são suportadas ou não pelo atual sistema</p>\n<h3 id=\"new-notificationoptions\"><a href=\"#new-notificationoptions\"><code>new Notification([options])</code></a></h3>\n<ul>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>title</code> String (optional) - A title for the notification, which will be shown at the top of the notification window when it is shown.</li>\n<li><code>subtitle</code> String (optional) <em>macOS</em> - A subtitle for the notification, which will be displayed below the title.</li>\n<li><code>body</code> String (optional) - The body text of the notification, which will be displayed below the title or subtitle.</li>\n<li><code>silent</code> Boolean (optional) - Whether or not to emit an OS notification noise when showing the notification.</li>\n<li><code>icon</code> (String | <a href=\"/docs/api/native-image\">NativeImage</a>) (optional) - An icon to use in the notification.</li>\n<li><code>hasReply</code> Boolean (optional) <em>macOS</em> - Whether or not to add an inline reply option to the notification.</li>\n<li><code>timeoutType</code> String (optional) <em>Linux</em> <em>Windows</em> - The timeout duration of the notification. Can be 'default' or 'never'.</li>\n<li><code>replyPlaceholder</code> String (optional) <em>macOS</em> - The placeholder to write in the inline reply input field.</li>\n<li><code>sound</code> String (optional) <em>macOS</em> - The name of the sound file to play when the notification is shown.</li>\n<li><code>urgency</code> String (optional) <em>Linux</em> - The urgency level of the notification. Can be 'normal', 'critical', or 'low'.</li>\n<li><code>actions</code> <a href=\"/docs/api/structures/notification-action\">NotificationAction[]</a> (optional) <em>macOS</em> - Actions to add to the notification. Please read the available actions and limitations in the <code>NotificationAction</code> documentation.</li>\n<li><code>closeButtonText</code> String (optional) <em>macOS</em> - A custom title for the close button of an alert. An empty string will cause the default localized text to be used.</li>\n<li><code>toastXml</code> String (optional) <em>Windows</em> - A custom description of the Notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification.</li>\n</ul></li>\n</ul>\n<h3 id=\"eventos-de-instância\"><a href=\"#eventos-de-instância\">Eventos de instância</a></h3>\n<p>Objects created with <code>new Notification</code> emit the following events:</p>\n<p><strong>Note:</strong> Some events are only available on specific operating systems and are labeled as such.</p>\n<h4 id=\"evento-show\"><a href=\"#evento-show\">Evento: 'show'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the notification is shown to the user, note this could be fired multiple times as a notification can be shown multiple times through the <code>show()</code> method.</p>\n<h4 id=\"event-click\"><a href=\"#event-click\">Event: 'click'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the notification is clicked by the user.</p>\n<h4 id=\"evento-close\"><a href=\"#evento-close\">Evento: 'close'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the notification is closed by manual intervention from the user.</p>\n<p>This event is not guaranteed to be emitted in all cases where the notification is closed.</p>\n<h4 id=\"event-reply-macos\"><a href=\"#event-reply-macos\">Event: 'reply' <em>macOS</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>reply</code> String - The string the user entered into the inline reply field.</li>\n</ul>\n<p>Emitted when the user clicks the \"Reply\" button on a notification with <code>hasReply: true</code>.</p>\n<h4 id=\"event-action-macos\"><a href=\"#event-action-macos\">Event: 'action' <em>macOS</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>index</code> Number - The index of the action that was activated.</li>\n</ul>\n<h4 id=\"event-failed-windows\"><a href=\"#event-failed-windows\">Event: 'failed' <em>Windows</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>error</code> String - The error encountered during execution of the <code>show()</code> method.</li>\n</ul>\n<p>Emitted when an error is encountered while creating and showing the native notification.</p>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<p>Objectos criados com <code>new Notification</code> possuem os seguintes métodos de instâncias:</p>\n<h4 id=\"notificationshow\"><a href=\"#notificationshow\"><code>notification.show()</code></a></h4>\n<p>Immediately shows the notification to the user, please note this means unlike the HTML5 Notification implementation, instantiating a <code>new Notification</code> does not immediately show it to the user, you need to call this method before the OS will display it.</p>\n<p>If the notification has been shown before, this method will dismiss the previously shown notification and create a new one with identical properties.</p>\n<h4 id=\"notificationclose\"><a href=\"#notificationclose\"><code>notification.close()</code></a></h4>\n<p>Dismisses the notification.</p>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<h4 id=\"notificationtitle\"><a href=\"#notificationtitle\"><code>notification.title</code></a></h4>\n<p>A <code>String</code> property representing the title of the notification.</p>\n<h4 id=\"notificationsubtitle\"><a href=\"#notificationsubtitle\"><code>notification.subtitle</code></a></h4>\n<p>A <code>String</code> property representing the subtitle of the notification.</p>\n<h4 id=\"notificationbody\"><a href=\"#notificationbody\"><code>notification.body</code></a></h4>\n<p>A <code>String</code> property representing the body of the notification.</p>\n<h4 id=\"notificationreplyplaceholder\"><a href=\"#notificationreplyplaceholder\"><code>notification.replyPlaceholder</code></a></h4>\n<p>A <code>String</code> property representing the reply placeholder of the notification.</p>\n<h4 id=\"notificationsound\"><a href=\"#notificationsound\"><code>notification.sound</code></a></h4>\n<p>A <code>String</code> property representing the sound of the notification.</p>\n<h4 id=\"notificationclosebuttontext\"><a href=\"#notificationclosebuttontext\"><code>notification.closeButtonText</code></a></h4>\n<p>A <code>String</code> property representing the close button text of the notification.</p>\n<h4 id=\"notificationsilent\"><a href=\"#notificationsilent\"><code>notification.silent</code></a></h4>\n<p>A <code>Boolean</code> property representing whether the notification is silent.</p>\n<h4 id=\"notificationhasreply\"><a href=\"#notificationhasreply\"><code>notification.hasReply</code></a></h4>\n<p>A <code>Boolean</code> property representing whether the notification has a reply action.</p>\n<h4 id=\"notificationurgency-linux\"><a href=\"#notificationurgency-linux\"><code>notification.urgency</code> <em>Linux</em></a></h4>\n<p>A <code>String</code> property representing the urgency level of the notification. Can be 'normal', 'critical', or 'low'.</p>\n<p>Default is 'low' - see <a href=\"https://developer.gnome.org/notification-spec/#urgency-levels\">NotifyUrgency</a> for more information.</p>\n<h4 id=\"notificationtimeouttype-linux-windows\"><a href=\"#notificationtimeouttype-linux-windows\"><code>notification.timeoutType</code> <em>Linux</em> <em>Windows</em></a></h4>\n<p>A <code>String</code> property representing the type of timeout duration for the notification. Can be 'default' or 'never'.</p>\n<p>If <code>timeoutType</code> is set to 'never', the notification never expires. It stays open until closed by the calling API or the user.</p>\n<h4 id=\"notificationactions\"><a href=\"#notificationactions\"><code>notification.actions</code></a></h4>\n<p>A <a href=\"/docs/api/structures/notification-action\"><code>NotificationAction[]</code></a> property representing the actions of the notification.</p>\n<h4 id=\"notificationtoastxml-windows\"><a href=\"#notificationtoastxml-windows\"><code>notification.toastXml</code> <em>Windows</em></a></h4>\n<p>A <code>String</code> property representing the custom Toast XML of the notification.</p>\n<h3 id=\"playing-sounds\"><a href=\"#playing-sounds\">Playing Sounds</a></h3>\n<p>On macOS, you can specify the name of the sound you'd like to play when the notification is shown. Any of the default sounds (under System Preferences > Sound) can be used, in addition to custom sound files. Be sure that the sound file is copied under the app bundle (e.g., <code>YourApp.app/Contents/Resources</code>), or one of the following locations:</p>\n<ul>\n<li><code>~/Library/Sounds</code></li>\n<li><code>/Library/Sounds</code></li>\n<li><code>/Network/Library/Sounds</code></li>\n<li><code>/System/Library/Sounds</code></li>\n</ul>\n<p>See the <a href=\"https://developer.apple.com/documentation/appkit/nssound\"><code>NSSound</code></a> docs for more information.</p>",
      "title": "Notificação",
      "description": "Criar notificações para o desktop do sistema"
    },
    "/docs/api/structures/notification-action": {
      "locale": "pt-BR",
      "slug": "notification-action",
      "href": "/docs/api/structures/notification-action",
      "crowdinFileId": "256471",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/notification-action.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificationaction-object\"><a href=\"#notificationaction-object\">NotificationAction Object</a></h1>\n<ul>\n<li><code>type</code> String - The type of action, can be <code>button</code>.</li>\n<li><code>text</code> String (optional) - The label for the given action.</li>\n</ul>\n<h2 id=\"platform--action-support\"><a href=\"#platform--action-support\">Platform / Action Support</a></h2>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Action Type</th><th>Platform Support</th><th>Usage of <code>text</code></th><th>Default <code>text</code></th><th>Limitations</th></tr></thead><tbody><tr><td><code>button</code></td><td>macOS</td><td>Used as the label for the button</td><td>\"Show\" (or a localized string by system default if first of such <code>button</code>, otherwise empty)</td><td>Only the first one is used. If multiple are provided, those beyond the first will be listed as additional actions (displayed when mouse active over the action button). Any such action also is incompatible with <code>hasReply</code> and will be ignored if <code>hasReply</code> is <code>true</code>.</td></tr></tbody></table>\n<h3 id=\"button-support-on-macos\"><a href=\"#button-support-on-macos\">Button support on macOS</a></h3>\n<p>In order for extra notification buttons to work on macOS your app must meet the following criteria.</p>\n<ul>\n<li>App is signed</li>\n<li>App has it's <code>NSUserNotificationAlertStyle</code> set to <code>alert</code> in the <code>Info.plist</code>.</li>\n</ul>\n<p>If either of these requirements are not met the button won't appear.</p>",
      "title": "NotificationAction Object",
      "description": ""
    },
    "/docs/api/structures/notification-response": {
      "locale": "pt-BR",
      "slug": "notification-response",
      "href": "/docs/api/structures/notification-response",
      "crowdinFileId": "256473",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/notification-response.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificationresponse-object\"><a href=\"#notificationresponse-object\">NotificationResponse Object</a></h1>\n<ul>\n<li><code>actionIdentifier</code> String - The identifier string of the action that the user selected.</li>\n<li><code>date</code> Number - The delivery date of the notification.</li>\n<li><code>identifier</code> String - The unique identifier for this notification request.</li>\n<li><code>userInfo</code> Record&#x3C;String, any> - A dictionary of custom information associated with the notification.</li>\n<li><code>userText</code> String (optional) - The text entered or chosen by the user.</li>\n</ul>",
      "title": "NotificationResponse Object",
      "description": ""
    },
    "/docs/tutorial/notifications": {
      "locale": "pt-BR",
      "slug": "notifications",
      "href": "/docs/tutorial/notifications",
      "crowdinFileId": "256225",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/notifications.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificações\"><a href=\"#notificações\">Notificações</a></h1>\n<h2 id=\"visão-geral\"><a href=\"#visão-geral\">Visão Geral</a></h2>\n<p>All three operating systems provide means for applications to send notifications to the user. The technique of showing notifications is different for the Main and Renderer processes.</p>\n<p>For the Renderer process, Electron conveniently allows developers to send notifications with the <a href=\"https://notifications.spec.whatwg.org/\">HTML5 Notification API</a>, using the currently running operating system's native notification APIs to display it.</p>\n<p>To show notifications in the Main process, you need to use the <a href=\"/docs/api/notification\">Notification</a> module.</p>\n<h2 id=\"exemplo\"><a href=\"#exemplo\">Exemplo</a></h2>\n<h3 id=\"show-notifications-in-the-renderer-process\"><a href=\"#show-notifications-in-the-renderer-process\">Show notifications in the Renderer process</a></h3>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, add the following line to the <code>index.html</code> file before the closing <code>&#x3C;/body></code> tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<p>...and add the <code>renderer.js</code> file:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/notifications/renderer\"><span class=\"hljs-keyword\">const</span> NOTIFICACAO_TITULO = <span class=\"hljs-string\">'Title'</span>\n<span class=\"hljs-keyword\">const</span> NOTIFICACAO_CORPO = <span class=\"hljs-string\">'Notification from the Renderer process. Click to log to console.'</span>\n<span class=\"hljs-keyword\">const</span> CLICK_MENSAGEM = <span class=\"hljs-string\">'Notificação clicada!'</span>\n\n<span class=\"hljs-keyword\">new</span> Notification(NOTIFICACAO_TITULO, { <span class=\"hljs-attr\">body</span>: NOTIFICACAO_CORPO })\n  .onclick = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-built_in\">console</span>.log(CLICK_MENSAGEM)\n</code></pre>\n<p>Após iniciar o aplicativo Electron, você verá a notificação:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/notification-renderer.png\" alt=\"Notification in the Renderer process\"></p>\n<p>Além disso, se você clicar na notificação, o DOM atualizará para exibir 'Notificação clicada!\".</p>\n<h3 id=\"show-notifications-in-the-main-process\"><a href=\"#show-notifications-in-the-main-process\">Show notifications in the Main process</a></h3>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/notifications/main\"><span class=\"hljs-keyword\">const</span> { Notification } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_TITLE = <span class=\"hljs-string\">'Basic Notification'</span>\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_BODY = <span class=\"hljs-string\">'Notification from the Main process'</span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">showNotification</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">new</span> Notification({ <span class=\"hljs-attr\">title</span>: NOTIFICATION_TITLE, <span class=\"hljs-attr\">body</span>: NOTIFICATION_BODY }).show()\n}\n\napp.whenReady().then(createWindow).then(showNotification)\n</code></pre>\n<p>Após executar a aplicação em Electron, você deve ver a notificação do sistema:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/notification-main.png\" alt=\"Notification in the Main process\"></p>\n<h2 id=\"additional-information\"><a href=\"#additional-information\">Additional information</a></h2>\n<p>Enquanto o código e a experiência do usuário em sistemas operacionais sejam semelhantes, há algumas diferenças.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<ul>\n<li>On Windows 10, a shortcut to your app with an <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> must be installed to the Start Menu. This can be overkill during development, so adding <code>node_modules\\electron\\dist\\electron.exe</code> to your Start Menu also does the trick. Navegue até o arquivo no Explorer, clique com o botão direito e \"Fixar em Iniciar\". You will then need to add the line <code>app.setAppUserModelId(process.execPath)</code> to your main process to see notifications.</li>\n<li>No Windows 8.1 e Windows 8, um atalho para o seu aplicativo, com um, <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> deve ser instalado na tela inicial. No entanto, ele não precisa ser fixado na a tela iniciar.</li>\n<li>No Windows 7, notificações funcionam através de uma implementação personalizada que visualmente se assemelha aos sistemas mais novos.</li>\n</ul>\n<p>O Electron tenta automatizar o trabalho em torno do Application User Model ID. Quando o Electron é usado juntamente com o framework de instalação e atualização Squirrel, <a href=\"https://github.com/electron/windows-installer/blob/master/README.md#handling-squirrel-events\">atalhos serão definidos automaticamente corretamente</a>. Além disso, Electron irá detectar que o Squirrel foi usado e irá chamar automaticamente <code>app.setAppUserModelId()</code> com o valor correto. Durante o desenvolvimento, você pode ter que chamar <a href=\"/docs/api/app#appsetappusermodelidid-windows\"><code>app.setAppUserModelId()</code></a> por si só.</p>\n<p>Além disso, no Windows 8, o comprimento máximo para o corpo da notificação é de 250 caracteres, o time do Windows recomenda que a notificações tenha 200 caracteres. Dito isto, essa limitação foi removida no Windows 10, mas a equipe do Windows pede que os desenvolvedores seja razoável. Tentativa de enviar gigantescas quantidades de texto pela API (milhares de caracteres) pode resultar em instabilidade.</p>\n<h4 id=\"notificações-avançadas\"><a href=\"#notificações-avançadas\">Notificações Avançadas</a></h4>\n<p>Versões posteriores do Windows permitem notificações avançadas, com os modelos personalizados, imagens e outros elementos flexíveis. Para enviar essas notificações(tanto do processo principal, quanto do processo de renderização), use o módulo de userland <a href=\"https://github.com/felixrieseberg/electron-windows-notifications\">electron-windows-notifications</a>, que usa addons nativos Node parar enviar <code>ToastNotification</code> e objetos <code>TileNotification</code>.</p>\n<p>While notifications including buttons work with <code>electron-windows-notifications</code>, handling replies requires the use of <a href=\"https://github.com/felixrieseberg/electron-windows-interactive-notifications\"><code>electron-windows-interactive-notifications</code></a>, which helps with registering the required COM components and calling your Electron app with the entered user data.</p>\n<h4 id=\"modo-silêncio-apresentação\"><a href=\"#modo-silêncio-apresentação\">Modo Silêncio/ Apresentação</a></h4>\n<p>To detect whether or not you're allowed to send a notification, use the userland module <a href=\"https://github.com/felixrieseberg/electron-notification-state\">electron-notification-state</a>.</p>\n<p>This allows you to determine ahead of time whether or not Windows will silently throw the notification away.</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>As notificações são simples no macOS, mas você deve estar ciente das <a href=\"https://developer.apple.com/macos/human-interface-guidelines/system-capabilities/notifications/\">diretrizes da Interface Humana da Apple sobre notificações</a>.</p>\n<p>Note que as notificações tem um limite de 256 bytes de tamanho e serão truncadas se você exceder esse limite.</p>\n<h4 id=\"não-perturbe--estado-de-sessão\"><a href=\"#não-perturbe--estado-de-sessão\">Não perturbe / Estado de sessão</a></h4>\n<p>Para detectar se é ou não permitido enviar uma notificação, use o módulo da userland <a href=\"https://github.com/felixrieseberg/electron-notification-state\">electron-notification-state</a>.</p>\n<p>Isso permitirá você detectar antes do tempo ou não a notificação que será exibida.</p>\n<h3 id=\"linux\"><a href=\"#linux\">Linux</a></h3>\n<p>Notificações são enviadas usando <code>libnotify</code> que podem mostrar notificações em qualquer ambiente de trabalho que segue as <a href=\"https://developer.gnome.org/notification-spec/\">Especificação de Notificação em Desktop</a>, incluindo Cinnamon, Enlightenment, Unity, GNOME, KDE.</p>",
      "title": "Notificações",
      "description": ""
    },
    "/docs/tutorial/offscreen-rendering": {
      "locale": "pt-BR",
      "slug": "offscreen-rendering",
      "href": "/docs/tutorial/offscreen-rendering",
      "crowdinFileId": "256227",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/offscreen-rendering.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"renderização-fora-da-tela\"><a href=\"#renderização-fora-da-tela\">Renderização fora da tela</a></h1>\n<h2 id=\"visão-geral\"><a href=\"#visão-geral\">Visão Geral</a></h2>\n<p>Offscreen rendering lets you obtain the content of a <code>BrowserWindow</code> in a bitmap, so it can be rendered anywhere, for example, on texture in a 3D scene. The offscreen rendering in Electron uses a similar approach to that of the <a href=\"https://bitbucket.org/chromiumembedded/cef\">Chromium Embedded Framework</a> project.</p>\n<p><em>Notes</em>:</p>\n<ul>\n<li>There are two rendering modes that can be used (see the section below) and only the dirty area is passed to the <code>paint</code> event to be more efficient.</li>\n<li>You can stop/continue the rendering as well as set the frame rate.</li>\n<li>The maximum frame rate is 240 because greater values bring only performance losses with no benefits.</li>\n<li>When nothing is happening on a webpage, no frames are generated.</li>\n<li>An offscreen window is always created as a <a href=\"/docs/api/frameless-window\">Frameless Window</a>.</li>\n</ul>\n<h3 id=\"rendering-modes\"><a href=\"#rendering-modes\">Rendering Modes</a></h3>\n<h4 id=\"aceleração-da-gpu\"><a href=\"#aceleração-da-gpu\">Aceleração da GPU</a></h4>\n<p>GPU accelerated rendering means that the GPU is used for composition. Because of that, the frame has to be copied from the GPU which requires more resources, thus this mode is slower than the Software output device. The benefit of this mode is that WebGL and 3D CSS animations are supported.</p>\n<h4 id=\"software-output-device\"><a href=\"#software-output-device\">Software output device</a></h4>\n<p>This mode uses a software output device for rendering in the CPU, so the frame generation is much faster. As a result, this mode is preferred over the GPU accelerated one.</p>\n<p>To enable this mode, GPU acceleration has to be disabled by calling the <a href=\"/docs/api/app#appdisablehardwareacceleration\"><code>app.disableHardwareAcceleration()</code></a> API.</p>\n<h2 id=\"exemplo\"><a href=\"#exemplo\">Exemplo</a></h2>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/offscreen-rendering\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\napp.disableHardwareAcceleration()\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">offscreen</span>: <span class=\"hljs-literal\">true</span> } })\n\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  win.webContents.on(<span class=\"hljs-string\">'paint'</span>, (event, dirty, image) => {\n    fs.writeFileSync(<span class=\"hljs-string\">'ex.png'</span>, image.toPNG())\n  })\n  win.webContents.setFrameRate(<span class=\"hljs-number\">60</span>)\n})\n</code></pre>\n<p>After launching the Electron application, navigate to your application's working folder, where you'll find the rendered image.</p>",
      "title": "Renderização fora da tela",
      "description": ""
    },
    "/docs/tutorial/online-offline-events": {
      "locale": "pt-BR",
      "slug": "online-offline-events",
      "href": "/docs/tutorial/online-offline-events",
      "crowdinFileId": "256229",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/online-offline-events.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"detecção-de-evento-onlineoffline\"><a href=\"#detecção-de-evento-onlineoffline\">Detecção de Evento Online/Offline</a></h1>\n<h2 id=\"visão-geral\"><a href=\"#visão-geral\">Visão Geral</a></h2>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Online_and_offline_events\">Online and offline event</a> detection can be implemented in the Renderer process using the <a href=\"http://html5index.org/Offline%20-%20NavigatorOnLine.html\"><code>navigator.onLine</code></a> attribute, part of standard HTML5 API.</p>\n<p>The <code>navigator.onLine</code> attribute returns:</p>\n<ul>\n<li><code>false</code> if all network requests are guaranteed to fail (e.g. when disconnected from the network).</li>\n<li><code>true</code> in all other cases.</li>\n</ul>\n<p>Since many cases return <code>true</code>, you should treat with care situations of getting false positives, as we cannot always assume that <code>true</code> value means that Electron can access the Internet. For example, in cases when the computer is running a virtualization software that has virtual Ethernet adapters in \"always connected\" state. Therefore, if you want to determine the Internet access status of Electron, you should develop additional means for this check.</p>\n<h2 id=\"exemplo\"><a href=\"#exemplo\">Exemplo</a></h2>\n<p>Starting with an HTML file <code>index.html</code>, this example will demonstrate how the <code>navigator.onLine</code> API can be used to build a connection status indicator.</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"script-src 'self' 'unsafe-inline';\"</span> /></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Connection status: <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">strong</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">'status'</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">strong</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>In order to mutate the DOM, create a <code>renderer.js</code> file that adds event listeners to the <code>'online'</code> and <code>'offline'</code> <code>window</code> events. The event handler sets the content of the <code>&#x3C;strong id='status'></code> element depending on the result of <code>navigator.onLine</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">updateOnlineStatus</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'status'</span>).innerHTML = navigator.onLine ? <span class=\"hljs-string\">'online'</span> : <span class=\"hljs-string\">'offline'</span>\n}\n\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'online'</span>, updateOnlineStatus)\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'offline'</span>, updateOnlineStatus)\n\nupdateOnlineStatus()\n</code></pre>\n<p>Finally, create a <code>main.js</code> file for main process that creates the window.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> onlineStatusWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">400</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">100</span>\n  })\n\n  onlineStatusWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n      createWindow()\n    }\n  })\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n</code></pre>\n<p>Após iniciar o aplicativo Electron, você verá a notificação:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/connection-status.png\" alt=\"Connection status\"></p>\n<blockquote>\n<p>Note: If you need to communicate the connection status to the main process, use the <a href=\"/docs/api/ipc-renderer\">IPC renderer</a> API.</p>\n</blockquote>",
      "title": "Detecção de Evento Online/Offline",
      "description": "Note: If you need to communicate the connection status to the main process, use the IPC renderer API."
    },
    "/docs/development/patches": {
      "locale": "pt-BR",
      "slug": "patches",
      "href": "/docs/development/patches",
      "crowdinFileId": "256161",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/patches.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"patches-in-electron\"><a href=\"#patches-in-electron\">Patches in Electron</a></h1>\n<p>Electron is built on two major upstream projects: Chromium and Node.js. Each of these projects has several of their own dependencies, too. We try our best to use these dependencies exactly as they are but sometimes we can't achieve our goals without patching those upstream dependencies to fit our use cases.</p>\n<h2 id=\"patch-justification\"><a href=\"#patch-justification\">Patch justification</a></h2>\n<p>Every patch in Electron is a maintenance burden. When upstream code changes, patches can break—sometimes without even a patch conflict or a compilation error. It's an ongoing effort to keep our patch set up-to-date and effective. So we strive to keep our patch count at a minimum. To that end, every patch must describe its reason for existence in its commit message. That reason must be one of the following:</p>\n<ol>\n<li>The patch is temporary, and is intended to be (or has been) committed upstream or otherwise eventually removed. Include a link to an upstream PR or code review if available, or a procedure for verifying whether the patch is still needed at a later date.</li>\n<li>The patch allows the code to compile in the Electron environment, but cannot be upstreamed because it's Electron-specific (e.g. patching out references to Chrome's <code>Profile</code>). Include reasoning about why the change cannot be implemented without a patch (e.g. by subclassing or copying the code).</li>\n<li>The patch makes Electron-specific changes in functionality which are fundamentally incompatible with upstream.</li>\n</ol>\n<p>In general, all the upstream projects we work with are friendly folks and are often happy to accept refactorings that allow the code in question to be compatible with both Electron and the upstream project. (See e.g. <a href=\"https://chromium-review.googlesource.com/c/chromium/src/+/1637040\">this</a> change in Chromium, which allowed us to remove a patch that did the same thing, or <a href=\"https://github.com/nodejs/node/pull/22110\">this</a> change in Node, which was a no-op for Node but fixed a bug in Electron.) <strong>We should aim to upstream changes whenever we can, and avoid indefinite-lifetime patches</strong>.</p>\n<h2 id=\"patch-system\"><a href=\"#patch-system\">Patch system</a></h2>\n<p>If you find yourself in the unfortunate position of having to make a change which can only be made through patching an upstream project, you'll need to know how to manage patches in Electron.</p>\n<p>All patches to upstream projects in Electron are contained in the <code>patches/</code> directory. Each subdirectory of <code>patches/</code> contains several patch files, along with a <code>.patches</code> file which lists the order in which the patches should be applied. Think of these files as making up a series of git commits that are applied on top of the upstream project after we check it out.</p>\n<pre><code class=\"hljs language-plaintext\">patches\n├── config.json   &#x3C;-- this describes which patchset directory is applied to what project\n├── chromium\n│   ├── .patches\n│   ├── accelerator.patch\n│   ├── add_contentgpuclient_precreatemessageloop_callback.patch\n│   ⋮\n├── node\n│   ├── .patches\n│   ├── add_openssl_is_boringssl_guard_to_oaep_hash_check.patch\n│   ├── build_add_gn_build_files.patch\n│   ⋮\n⋮\n</code></pre>\n<p>To help manage these patch sets, we provide two tools: <code>git-import-patches</code> and <code>git-export-patches</code>. <code>git-import-patches</code> imports a set of patch files into a git repository by applying each patch in the correct order and creating a commit for each one. <code>git-export-patches</code> does the reverse; it exports a series of git commits in a repository into a set of files in a directory and an accompanying <code>.patches</code> file.</p>\n<blockquote>\n<p>Side note: the reason we use a <code>.patches</code> file to maintain the order of applied patches, rather than prepending a number like <code>001-</code> to each file, is because it reduces conflicts related to patch ordering. It prevents the situation where two PRs both add a patch at the end of the series with the same numbering and end up both getting merged resulting in a duplicate identifier, and it also reduces churn when a patch is added or deleted in the middle of the series.</p>\n</blockquote>\n<h3 id=\"usando\"><a href=\"#usando\">Usando</a></h3>\n<h4 id=\"adding-a-new-patch\"><a href=\"#adding-a-new-patch\">Adding a new patch</a></h4>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n$ vim some/code/file.cc\n$ git commit\n$ ../../electron/script/git-export-patches -o ../../electron/patches/node\n</code></pre>\n<blockquote>\n<p><strong>NOTE</strong>: <code>git-export-patches</code> ignores any uncommitted files, so you must create a commit if you want your changes to be exported. The subject line of the commit message will be used to derive the patch file name, and the body of the commit message should include the reason for the patch's existence.</p>\n</blockquote>\n<p>Re-exporting patches will sometimes cause shasums in unrelated patches to change. This is generally harmless and can be ignored (but go ahead and add those changes to your PR, it'll stop them from showing up for other people).</p>\n<h4 id=\"editing-an-existing-patch\"><a href=\"#editing-an-existing-patch\">Editing an existing patch</a></h4>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/v8\n$ vim some/code/file.cc\n$ git <span class=\"hljs-built_in\">log</span>\n<span class=\"hljs-comment\"># Find the commit sha of the patch you want to edit.</span>\n$ git commit --fixup [COMMIT_SHA]\n$ git rebase --autosquash -i [COMMIT_SHA]^\n$ ../electron/script/git-export-patches -o ../electron/patches/v8\n</code></pre>\n<h4 id=\"removing-a-patch\"><a href=\"#removing-a-patch\">Removing a patch</a></h4>\n<pre><code class=\"hljs language-bash\">$ vim src/electron/patches/node/.patches\n<span class=\"hljs-comment\"># Delete the line with the name of the patch you want to remove</span>\n$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n$ git reset --hard refs/patches/upstream-head\n$ ../../electron/script/git-import-patches ../../electron/patches/node\n$ ../../electron/script/git-export-patches -o ../../electron/patches/node\n</code></pre>\n<p>Note that <code>git-import-patches</code> will mark the commit that was <code>HEAD</code> when it was run as <code>refs/patches/upstream-head</code>. This lets you keep track of which commits are from Electron patches (those that come after <code>refs/patches/upstream-head</code>) and which commits are in upstream (those before <code>refs/patches/upstream-head</code>).</p>\n<h4 id=\"resolver-conflitos\"><a href=\"#resolver-conflitos\">Resolver conflitos</a></h4>\n<p>When updating an upstream dependency, patches may fail to apply cleanly. Often, the conflict can be resolved automatically by git with a 3-way merge. You can instruct <code>git-import-patches</code> to use the 3-way merge algorithm by passing the <code>-3</code> argument:</p>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n<span class=\"hljs-comment\"># If the patch application failed midway through, you can reset it with:</span>\n$ git am --abort\n<span class=\"hljs-comment\"># And then retry with 3-way merge:</span>\n$ ../../electron/script/git-import-patches -3 ../../electron/patches/node\n</code></pre>\n<p>If <code>git-import-patches -3</code> encounters a merge conflict that it can't resolve automatically, it will pause and allow you to resolve the conflict manually. Once you have resolved the conflict, <code>git add</code> the resolved files and continue to apply the rest of the patches by running <code>git am --continue</code>.</p>",
      "title": "Patches in Electron",
      "description": "Side note: the reason we use a .patches file to maintain the order of applied patches, rather than prepending a number like 001- to each file, is because it reduces conflicts related to patch ordering. It prevents the situation where two PRs both add a patch at the end of the series with the same numbering and end up both getting merged resulting in a duplicate identifier, and it also reduces churn when a patch is added or deleted in the middle of the series."
    },
    "/docs/tutorial/performance": {
      "locale": "pt-BR",
      "slug": "performance",
      "href": "/docs/tutorial/performance",
      "crowdinFileId": "256231",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/performance.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"performance\"><a href=\"#performance\">Performance</a></h1>\n<p>Desenvolvedores frequentemente perguntam sobre formas de otimizar a performance de aplicações Electron. Engenheiros de software, consumidores e desenvolvedores de frameworks nem sempre estão de acordo com uma simples definição de a \"performance\" acontece. Esse documento demonstra algumas práticas favoritas dos mantenedores do Electron, com a finalidade de reduzir consumo de memória, CPU e recursos de disco, enquanto garante que o APP seja responsivo a entrada do usuário e complete as operações da forma mais rápida possível. Além disso, nós queremos todas os meios de performance para manter um alto padrão para a segurança dos Apps.</p>\n<p>Conhecimento e informação sobre como construir websites de performance com JavaScript geralmente também se aplicam à aplicativos Electron. Até certo ponto,recursos discutidos para performance de aplicações Node.js também se aplicam,porém fique atento que o termo \"performance\" no backend Node.js tem um significado diferente do de uma aplicação cliente.</p>\n<p>Esta lista é providenciada para sua conveniência - e é muito parecida com nossa <a href=\"/docs/tutorial/security\"> checklist de segurança </a> - não pretende ser cansativa. Provavelmente é possível construir uma aplicação Electron lenta seguindo todos os passos listados abaixo. Electron é uma poderosa plataforma de desenvolvimento que deixa você, o desenvolvedor, fazer mais ou menos o que você quiser. Toda essa liberdade significa que a performance é amplamente sua responsabilidade.</p>\n<h2 id=\"diminuir-diminuir-diminuir\"><a href=\"#diminuir-diminuir-diminuir\">Diminuir, diminuir, diminuir</a></h2>\n<p>A lista abaixo contém um número de passos razoavelmente diretos e fáceis de implementar. Entretanto, construir a melhor versão da sua aplicação vai exigir que você vá além de uma série de etapas. Ao invés disso, você deve examinar de perto todo o código rodando em sua aplicação sendo cuidadoso, meticuloso e observador. Onde estão os gargalos ? Quando o usuário clica em um botão, quais operações gastam mais tempo de processamento ? Enquanto a aplicação está ociosa, quais objetos gastam mais memória ?</p>\n<p>Dia após dia nós temos visto que a estratégia mais bem sucedida para construir aplicações Electron com bom desempenho é analisar o código rodando, encontrar a parte que mais precisa de recursos e otimizá-la. Repetir esse processo incansavelmente, de novo e de novo vai aumentar drasticamente a performance da sua aplicação. Experiências trabalhando com aplicativos maiores como o Visual Studio Code ou o Slack tem mostrado que essa prática é de longe a estratégia mais confiável para aumentar a performance.</p>\n<p>Para aprender mais sobre como analisar o código da sua aplicação se familiarize com as Ferramentas de Desenvolvedor do Chrome. For advanced analysis looking at multiple processes at once, consider the <a href=\"https://www.chromium.org/developers/how-tos/trace-event-profiling-tool\">Chrome Tracing</a> tool.</p>\n<h3 id=\"leituras-recomendadas\"><a href=\"#leituras-recomendadas\">Leituras Recomendadas</a></h3>\n<ul>\n<li><a href=\"https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/\">Começando na análise de performance em tempo de execução</a></li>\n<li><a href=\"https://www.youtube.com/watch?v=r0OeHRUCCb4\">Palestra:  \"O primeiro segundo - Visual Studio Code\"</a></li>\n</ul>\n<h2 id=\"sumário\"><a href=\"#sumário\">Sumário</a></h2>\n<p>Seu aplicativo pode ser um pouco mais enxuto, rápido e geralmente menos faminto por recursos se você se atentar a esses passos.</p>\n<ol>\n<li><a href=\"#1-carelessly-including-modules\">Descuido ao incluir módulos</a></li>\n<li><a href=\"#2-loading-and-running-code-too-soon\">Carregando e rodando o código muito cedo</a></li>\n<li><a href=\"#3-blocking-the-main-process\">Bloqueando o processo principal</a></li>\n<li><a href=\"#4-blocking-the-renderer-process\">Bloqueando o processo de renderização</a></li>\n<li><a href=\"#5-unnecessary-polyfills\">Sobrecargas desnecessárias</a></li>\n<li><a href=\"#6-unnecessary-or-blocking-network-requests\">Requisições desnecessárias ou bloqueadoras</a></li>\n<li><a href=\"#7-bundle-your-code\">Empacote seu código</a></li>\n</ol>\n<h2 id=\"1-descuido-ao-incluir-módulos\"><a href=\"#1-descuido-ao-incluir-módulos\">1) Descuido ao incluir módulos</a></h2>\n<p>Antes de adicionar um módulo Node.js em sua aplicação,examine-o primeiro. Quantas dependências esse módulo inclui ? Que tipo de recursos são necessários para ele simplesmente ser chamado em um <code>require()</code> ? Você pode descobrir que o módulo com mais downloads nos pacotes NPM registrados ou com mais estrelas no GitHub, não é de fato o mais enxuto ou menor disponível.</p>\n<h3 id=\"por-que\"><a href=\"#por-que\">Por que?</a></h3>\n<p>A razão por trás dessa recomendação é melhor ilustrada com um exemplo do mundo real. Durante os primórdios do Electron, garantir a descoberta de conexão de rede era um problema, resultando em muitas aplicações usando um módulo apenas para usar o método <code> isOnline()</code>.</p>\n<p>O módulo detecta sua conexão tentando chegar a um número conhecido de pontos de extremidade. Para a lista destes pontos, depende de um módulo diferente, que também continha uma lista de portas já conhecidas. Essa dependência por si mesma depende de um módulo contendo informações sobre portas, que vem em forma de um arquivo JSON com mais de 100.000 linhas de conteúdo. Sempre que o módulo é carregado (normalmente em um <code>require('módulo)</code>), isto vai carregar todas as suas dependências e eventualmente ler e transformar esse arquivo JSON. Interpretar milhares de linhas de um JSON é uma operação muito cara. Em uma máquina lenta isso pode levar vários segundos.</p>\n<p>Em ambientes de servidores, tempo de inicialização é irrelevante virtualmente. Um servidor Node.js que requer informações sobre todas as portas é provavelmente na verdade \"mais rápido\" se ele carregar todas as informações necessárias em memória sempre que o servidor iniciar para o ter o beneficio de atender às requisições mais rapidamente. O módulo discutido neste exemplo não é um módulo \"ruim\". Aplicativos Electron, contudo, não devem estar carregando, interpretando, e armazenando na memória informações que ele na verdade não precisa.</p>\n<p>Em suma, um módulo aparentemente ótimo escrito primordialmente para servidores Node.js rodando em Linux pode ser uma má noticia para a performance da sua aplicação. Nesse exemplo em particular, a solução correta era não usar o módulo no final das contas, e ao invés disso usar verificadores de conexão incluídos em versões posteriores do Chromium.</p>\n<h3 id=\"como\"><a href=\"#como\">Como?</a></h3>\n<p>Quando considerar um módulo, nos recomendados que você verifique:</p>\n<ol>\n<li>the size of dependencies included</li>\n<li>the resources required to load (<code>require()</code>) it</li>\n<li>os recursos requeridos para realizar a ação que você está interessado</li>\n</ol>\n<p>Gerar um perfil de consumo de CPU e de memória para carregar um módulo pode ser feito com um simples comando no terminal. No exemplo abaixo, nós estamos observando o popular módulo <code>request</code>.</p>\n<pre><code class=\"hljs language-sh\">node --cpu-prof --heap-prof -e <span class=\"hljs-string\">\"require('request')\"</span>\n</code></pre>\n<p>Executando esse comando temos um arquivo <code>.cpuprofile</code> e um arquivo <code>.heapprofile</code> no diretório em que você executou. Ambos os arquivos podem ser analisados usando a Ferramenta de Desenvolvedor do Chrome, usando as seções <code>Performance</code> e <code>Memory</code> respectivamente.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/performance-cpu-prof.png\" alt=\"Performance CPU Profile\"></p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/performance-heap-prof.png\" alt=\"Performance Heap Memory Profile\"></p>\n<p>Nesse exemplo, na máquina do autor, nós vimos que o <code>request</code> levou quase meio segundo, enquanto o <code>node-fetch</code> levou drasticamente menos memória e menos que 50ms.</p>\n<h2 id=\"2-carregar-e-rodar-o-código-muito-cedo\"><a href=\"#2-carregar-e-rodar-o-código-muito-cedo\">2) Carregar e rodar o código muito cedo</a></h2>\n<p>Se você tem operações de configurações gastonas, considere adiar elas. Inspecione todo o trabalho executado logo após o início da aplicação. Ao invés de disparar todas as funções imediatamente, considere escalona-las em uma sequencia mais ligada ao caminho do usuário.</p>\n<p>Em um desenvolvimento tradicional de Node.js, nós estamos acostumados a colocar todos as declarações <code>require()</code> no início. Se você atualmente desenvolve sua aplicação Electron usando a mesma estratégia <em>e</em> usando módulos consideráveis que você não precisa imediatamente, aplique a mesma estratégia e adie o carregamento para um momento mais oportuno.</p>\n<h3 id=\"por-que-1\"><a href=\"#por-que-1\">Por que?</a></h3>\n<p>Carregar módulos é surpreendentemente uma operação cara, especialmente no Windows. Quando sua aplicação inicia, não deve fazer seus usuários aguardarem por coisas que eles não precisam agora.</p>\n<p>Isto pode parecer óbvio, mas a maioria das aplicações tendem a fazer muitas operações imediatamente após o programa ser aberto - como checar atualizações, baixar conteúdo usado em uma sessão anterior, ou fazer operações I/O pesadas no disco.</p>\n<p>Vamos tomar o Visual Studio Code como exemplo. Quando você abre um arquivo, ele vai imediatamente aparecer para você sem nenhum destaque, priorizando sua capacidade de interagir com o texto. Uma vez que está funcionando, aí sim ele vai destacar o código.</p>\n<h3 id=\"como-1\"><a href=\"#como-1\">Como?</a></h3>\n<p>Vamos considerar um exemplo e assumir que sua aplicação está interpretando arquivos em um formato fictício <code>.foo</code>. Para fazer isso, ele depende do módulo igualmente fictício <code>foo-parser</code>. Em um desenvolvimento tradicional em Node.js, você provavelmente vai escrever um código que vai avidamente carregar dependências:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> fooParser = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'foo-parser'</span>)\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">Parser</span> </span>{\n  <span class=\"hljs-keyword\">constructor</span> () {\n    <span class=\"hljs-keyword\">this</span>.files = fs.readdirSync(<span class=\"hljs-string\">'.'</span>)\n  }\n\n  getParsedFiles () {\n    <span class=\"hljs-keyword\">return</span> fooParser.parse(<span class=\"hljs-keyword\">this</span>.files)\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> parser = <span class=\"hljs-keyword\">new</span> Parser()\n\n<span class=\"hljs-built_in\">module</span>.exports = { parser }\n</code></pre>\n<p>No exemplo acima, nós estamos fazendo muita coisa assim que o arquivo é carregado. Nós precisamos interpretar os arquivos imediatamente ? Nós podemos fazer isso um pouco mais tarde, quando o <code>getParsedFiles()</code> é realmente utilizado ?</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// \"fs\" já está sendo carregado, então o `require()` é \"barato\"</span>\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">Parser</span> </span>{\n  <span class=\"hljs-keyword\">async</span> getFiles () {\n    <span class=\"hljs-comment\">// Acesse o disco logo que o `getFiles` é chamado, não antes.</span>\n    <span class=\"hljs-comment\">// Além disso, assegure-se que nós não estamos bloqueando outras operações usando</span>\n<span class=\"hljs-comment\">// a versão assíncrona.</span>\n    <span class=\"hljs-keyword\">this</span>.files = <span class=\"hljs-keyword\">this</span>.files || <span class=\"hljs-keyword\">await</span> fs.readdir(<span class=\"hljs-string\">'.'</span>)\n\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-keyword\">this</span>.files\n  }\n\n  <span class=\"hljs-keyword\">async</span> getParsedFiles () {\n    <span class=\"hljs-comment\">// Our fictitious foo-parser is a big and expensive module to load, so</span>\n    <span class=\"hljs-comment\">// defer that work until we actually need to parse files.</span>\n    <span class=\"hljs-comment\">// Já que `require()` vem com um módulo em cache, o `require()` </span>\n    <span class=\"hljs-comment\">// vai sair caro apenas uma vez - as chamadas seguintes de `getParsedFiles()`</span>\n    <span class=\"hljs-comment\">// vão ser mais rápidas.</span>\n    <span class=\"hljs-keyword\">const</span> fooParser = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'foo-parser'</span>)\n    <span class=\"hljs-keyword\">const</span> files = <span class=\"hljs-keyword\">await</span> <span class=\"hljs-keyword\">this</span>.getFiles()\n\n    <span class=\"hljs-keyword\">return</span> fooParser.parse(files)\n  }\n}\n\n<span class=\"hljs-comment\">// Essa operação agora é muito mais barata que nosso exemplo anterior</span>\n<span class=\"hljs-keyword\">const</span> parser = <span class=\"hljs-keyword\">new</span> Parser()\n\n<span class=\"hljs-built_in\">module</span>.exports = { parser }\n</code></pre>\n<p>Em suma, aloque recursos quando precisar em vez de alocar todos eles quando sua aplicação iniciar.</p>\n<h2 id=\"3-bloqueando-o-processo-principal\"><a href=\"#3-bloqueando-o-processo-principal\">3) Bloqueando o processo principal</a></h2>\n<p>O processo principal do Electron (algumas vezes chamado de \"browser process\") é especial: é o processo pai de todos os outros na sua aplicação e o primeiro processo com quem o sistema operacional interage. It handles windows, interactions, and the communication between various components inside your app. It also houses the UI thread.</p>\n<p>Sob nenhuma circunstância você deve bloquear este processo e a thread da UI com operações longas. Bloquear a thread da UI significa que todo o seu programa vai travar até o processo principal estar pronto para continuar.</p>\n<h3 id=\"por-que-2\"><a href=\"#por-que-2\">Por que?</a></h3>\n<p>The main process and its UI thread are essentially the control tower for major operations inside your app. When the operating system tells your app about a mouse click, it'll go through the main process before it reaches your window. Se sua janela está renderizando uma animação suave, ela vai precisar conversar com o processo da GPU sobre isso - mais uma vez passando pelo processo principal.</p>\n<p>Electron e Chromium são cuidadosos ao colocar tarefas pesadas de I/P e operações pesadas em CPU dentro de novas threads para evitar o bloqueio da thread da UI. Você deve fazer o mesmo.</p>\n<h3 id=\"como-2\"><a href=\"#como-2\">Como?</a></h3>\n<p>A poderosa arquitetura multi-procedural fica pronta para ajudar você com suas tarefas demoradas, mas também inclue um pequeno número de armadilhas de performance.</p>\n<p>1) Para longas e pesadas tarefas na CPU, faça uso de <a href=\"https://nodejs.org/api/worker_threads.html\">worker threads</a>, considere move-las para a BrowserWindow ou (como último recurso) cria um processo dedicado.</p>\n<p>2) Evite usar o IPC síncrono e o módulo <code>remote</code> o máximo possível. Enquanto há casos legítimos de uso, é de longe muito fácil bloquear a thread da UI sem saber usando o módulo <code>remote</code>.</p>\n<p>3) Evite usar operações que bloqueiam I/O no processo principal. Em suma, sempre que um módulo Node.js (como <code>fs</code> ou <code>child_process</code>) oferecer uma versão assíncrona ou síncrona, você deve dar preferência a versão assíncrona e não-bloqueadora.</p>\n<h2 id=\"4-bloqueando-o-processo-de-renderização\"><a href=\"#4-bloqueando-o-processo-de-renderização\">4) Bloqueando o processo de renderização</a></h2>\n<p>Desde que o Electron esteja de acordo com a versão do Chrome, você pode usar os mais novos e melhores recursos que a plataforma Web oferece para adiar ou descarregar operações pesadas a fim de manter sua aplicação leve e responsiva.</p>\n<h3 id=\"por-que-3\"><a href=\"#por-que-3\">Por que?</a></h3>\n<p>Você provavelmente tem muito JavaScript para rodar no processo de renderização. A dica é executar operações o mais rápido possível sem deixar de lado recursos necessários para continuar liso, respondendo às entradas do usuário, ou animando a 60fps.</p>\n<p>Orquestrar o fluxo de operações no código de renderização é particularmente útil se usuários reclamam que seu programa \"engasga\" às vezes.</p>\n<h3 id=\"como-3\"><a href=\"#como-3\">Como?</a></h3>\n<p>Geralmente, todo conselho para construir aplicativos web melhores para navegadores modernos se aplicam à renderização do Electron também. As duas ferramentas primárias à sua disposição são atualmente <code>requestIdleCallback()</code> para pequenos processos e <code>Web Workers</code> para operações demoradas.</p>\n<p><em><code>requestIdleCallback()</code></em> permite ao desenvolvedor enfileirar uma função para ser executada assim que o processo estiver entrando em um período ocioso. Ela permite você fazer tarefas de baixa prioridade ou de fundo sem impactar a experiência do usuário. Para mais informações sobre como usar isso, cheque a sua documentação no <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\">MDN</a>.</p>\n<p><em>Web Workers</em> são uma ferramenta poderosa para rodar um código em uma thread separada. Há algumas ressalvas - consulte a <a href=\"/docs/tutorial/multithreading\">documentação de multi-thread do Electron</a> e a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers\">documentação do MDN para Web Workers</a>. Elas são a solução ideal para qualquer operação que precise de muito poder de CPU por um longo período de tempo.</p>\n<h2 id=\"5-sobrecargas-desnecessárias\"><a href=\"#5-sobrecargas-desnecessárias\">5) Sobrecargas desnecessárias</a></h2>\n<p>Um dos maiores benefícios do Electron é que você sabe exatamente qual engine vai interpretar seu JavaScript, HTML e CSS. Se você esta usando código que foi escrito para a web em geral, certifique-se de não sobrecarregar recursos já incluídos no Electron.</p>\n<h3 id=\"por-que-4\"><a href=\"#por-que-4\">Por que?</a></h3>\n<p>Ao construir uma aplicação web para a internet de hoje, os ambientes mais antigos ditam quais funcionalidades você pode e não pode usar. Embora o Electron suporte filtros e animações CSS de bom desempenho, um navegador mais antigo pode não suportar. Onde você poderia usar WebGL, seus desenvolvedores podem ter escolhido uma solução mais faminta por recursos para suportar telefones antigos.</p>\n<p>Quando isso vem para o JavaScript, você deve ter incluído bibliotecas ferramentais como JQuery para seletores DOM ou sobrecargas como o <code>regenerator-runtime</code> para suportar <code>async/await</code>.</p>\n<p>É raro que uma sobrecarga baseada em JavaScript seja mais rápida que o equivalente em uma funcionalidade nativa do Electron. Não deixe seu aplicativo Electron lento, enviando sua própria versão dos recursos de plataforma web padrão.</p>\n<h3 id=\"como-4\"><a href=\"#como-4\">Como?</a></h3>\n<p>Opere sobre a suposição que sobrecargas em versões atuais do Electron são desnecessárias. Se você tem dúvidas, cheque <a href=\"https://caniuse.com/\">caniuse.com</a> e verifique se a <a href=\"/docs/api/process#processversionschrome-readonly\">versão do Chromium usada em sua aplicação Electron</a> suporta a funcionalidade que deseja.</p>\n<p>Além disso, examine cuidadosamente as bibliotecas que você usa. São realmente necessárias? <code>jQuery</code>, por exemplo, foi um sucesso tal que muitos de seus recursos agora fazem parte da <a href=\"http://youmightnotneedjquery.com/\">configuração padrão de JavaScript disponível</a>.</p>\n<p>Se você estiver usando um compilador/transpilador como TypeScript, examine sua configuração e certifique-se de que esteja utilizando a versão mais recente do ECMAScript suportada pelo Electron.</p>\n<h2 id=\"6-requisições-desnecessárias-ou-bloqueadoras\"><a href=\"#6-requisições-desnecessárias-ou-bloqueadoras\">6) Requisições desnecessárias ou bloqueadoras</a></h2>\n<p>Evite buscar raramente recursos da internet se eles podem facilmente ser empacotados com seu aplicativo.</p>\n<h3 id=\"por-que-5\"><a href=\"#por-que-5\">Por que?</a></h3>\n<p>Muitos usuários do Electron começam com um aplicativo inteiramente baseado na web que estão transformando em uma aplicação desktop. Como desenvolvedores web, estamos acostumados a carregar recursos de uma variedade de redes de conteúdo. Now that you are shipping a proper desktop application, attempt to \"cut the cord\" where possible and avoid letting your users wait for resources that never change and could easily be included  in your app.</p>\n<p>Um típico exemplo é o Google Fonts. Muitos desenvolvedores usam a incrível coleção de fontes gratuitas do Google, que vem com um rede de entrega de conteúdo. O tom é direto: Inclua algumas linhas de CSS e o Google cuidará do resto.</p>\n<p>Quando está construindo uma aplicação Electron, seus usuários serão melhor atendidos se você baixar as fontes e incluí-las no pacote de seu programa.</p>\n<h3 id=\"como-5\"><a href=\"#como-5\">Como?</a></h3>\n<p>Em um mundo ideal, sua aplicação não precisaria de conexão com a internet para funcionar completamente. Para chegar lá, você deve entender quais recursos em sua aplicação estão baixando - e o quão grandes são esses recursos.</p>\n<p>Para isso, abra suas ferramentas de desenvolvedor. Navegue até a seção <code>Network</code> e marque a opção <code>Disable cache</code>. Em seguida, recarregue seu renderizador. A menos que sua aplicação proíba tais recarregamentos, você pode fazer ativar o recarregamento pressionando <code>Cmd +R</code> ou <code>Ctrl + R</code> com a ferramenta de desenvolvedor em foco.</p>\n<p>As ferramentas agora vão meticulosamente gravar todas as requisições de rede. No primeiro passo, faça um balanço de todos os recursos que estão sendo baixados, focando nos arquivos grandes primeiro. Há algumas dessas imagens, fontes ou arquivos de mídia que não mudam e poderiam ser incluídas em seu pacote ? Se sim, inclua elas.</p>\n<p>Como próximo passo, habilite o <code>Network Throttling</code>. Ache o menu suspenso que está em <code>Online</code> e selecione uma velocidade menor como o <code>Fast 3G</code>. Recarregue seu renderizador e veja se tem algum recurso que sua aplicação está esperando desnecessariamente. Em muitos casos, o programa vai aguardar uma requisição na rede ser concluída apesar de não precisar realmente do recurso envolvido.</p>\n<p>Uma dica, carregar recursos da Internet que você pode querer alterar sem enviar uma atualização de aplicativo é uma estratégia poderosa. Para o controle avançado de sobre como os recursos estão sendo carregados, considere investir em <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API\">Service Workers</a>.</p>\n<h2 id=\"7-empacote-seu-código\"><a href=\"#7-empacote-seu-código\">7) Empacote seu código</a></h2>\n<p>Como já apontado em \"<a href=\"#2-loading-and-running-code-too-soon\">Carregando e rodando o código muito cedo</a>\", o <code>require()</code> é uma operação cara. Se você for capaz, comprima sua aplicação em um único arquivo.</p>\n<h3 id=\"por-que-6\"><a href=\"#por-que-6\">Por que?</a></h3>\n<p>Desenvolvimentos modernos de JavaScript normalmente envolvem muitos arquivos e módulos. Enquanto isso é perfeito para desenvolver com Electron, nós recomendamos fortemente que você empacote todo o seu código em um único arquivos para garantir que a sobrecarga inclusa no método <code>require()</code> seja paga apenas uma vez quando sua aplicação inicia.</p>\n<h3 id=\"como-6\"><a href=\"#como-6\">Como?</a></h3>\n<p>Tem vários compressores de JavaScript lá fora e nós sabemos que melhor que irritar a comunidade recomendando uma única ferramenta em detrimento de outra. Nós recomendamos contudo que você use um empacotador que seja capaz de lidar com o ambiente único do Electron que precisa lidar com Node.js e Browser.</p>\n<p>A partir da escrita deste artigo, as escolhas populares incluem <a href=\"https://webpack.js.org/\">Webpack</a>, <a href=\"https://parceljs.org/\">Parcel</a>, e <a href=\"https://rollupjs.org/\">rollup.js</a>.</p>",
      "title": "Performance",
      "description": ""
    },
    "/docs/api/structures/point": {
      "locale": "pt-BR",
      "slug": "point",
      "href": "/docs/api/structures/point",
      "crowdinFileId": "256475",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/point.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"point-object\"><a href=\"#point-object\">Point Object</a></h1>\n<ul>\n<li><code>x</code> Number</li>\n<li><code>y</code> Number</li>\n</ul>\n<p><strong>Note:</strong> Both <code>x</code> and <code>y</code> must be whole integers, when providing a point object as input to an Electron API we will automatically round your <code>x</code> and <code>y</code> values to the nearest whole integer.</p>",
      "title": "Point Object",
      "description": ""
    },
    "/docs/api/structures/post-body": {
      "locale": "pt-BR",
      "slug": "post-body",
      "href": "/docs/api/structures/post-body",
      "crowdinFileId": "256477",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/post-body.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"postbody-object\"><a href=\"#postbody-object\">PostBody Object</a></h1>\n<ul>\n<li><code>data</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)[] - The post data to be sent to the new window.</li>\n<li><code>contentType</code> String - The <code>content-type</code> header used for the data. One of <code>application/x-www-form-urlencoded</code> or <code>multipart/form-data</code>. Corresponds to the <code>enctype</code> attribute of the submitted HTML form.</li>\n<li><code>boundary</code> String (optional) - The boundary used to separate multiple parts of the message. Only valid when <code>contentType</code> is <code>multipart/form-data</code>.</li>\n</ul>\n<p>Note that keys starting with <code>--</code> are not currently supported. For example, this will errantly submit as <code>multipart/form-data</code> when <code>nativeWindowOpen</code> is set to <code>false</code> in webPreferences:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">form</span>\n  <span class=\"hljs-attr\">target</span>=<span class=\"hljs-string\">\"_blank\"</span>\n  <span class=\"hljs-attr\">method</span>=<span class=\"hljs-string\">\"POST\"</span>\n  <span class=\"hljs-attr\">enctype</span>=<span class=\"hljs-string\">\"application/x-www-form-urlencoded\"</span>\n  <span class=\"hljs-attr\">action</span>=<span class=\"hljs-string\">\"https://postman-echo.com/post\"</span>\n></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">input</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text\"</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">\"--theKey\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">input</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"submit\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">form</span>></span>\n</code></pre>",
      "title": "PostBody Object",
      "description": ""
    },
    "/docs/api/power-monitor": {
      "locale": "pt-BR",
      "slug": "power-monitor",
      "href": "/docs/api/power-monitor",
      "crowdinFileId": "256351",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/power-monitor.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"powermonitor\"><a href=\"#powermonitor\">powerMonitor</a></h1>\n<blockquote>\n<p>Monitor power state changes.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h2 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h2>\n<p>O módulo <code>powerMonitor</code> emite os seguintes eventos:</p>\n<h3 id=\"event-suspend\"><a href=\"#event-suspend\">Event: 'suspend'</a></h3>\n<p>Emitted when the system is suspending.</p>\n<h3 id=\"event-resume\"><a href=\"#event-resume\">Event: 'resume'</a></h3>\n<p>Emitted when system is resuming.</p>\n<h3 id=\"evento-on-ac-macos-windows\"><a href=\"#evento-on-ac-macos-windows\">Evento: 'on-ac' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Emitted when the system changes to AC power.</p>\n<h3 id=\"evento-on-battery-macos--windows\"><a href=\"#evento-on-battery-macos--windows\">Evento: 'on-battery' <em>macOS</em>  <em>Windows</em></a></h3>\n<p>Emitted when system changes to battery power.</p>\n<h3 id=\"event-shutdown-linux-macos\"><a href=\"#event-shutdown-linux-macos\">Event: 'shutdown' <em>Linux</em> <em>macOS</em></a></h3>\n<p>Emitted when the system is about to reboot or shut down. If the event handler invokes <code>e.preventDefault()</code>, Electron will attempt to delay system shutdown in order for the app to exit cleanly. If <code>e.preventDefault()</code> is called, the app should exit as soon as possible by calling something like <code>app.quit()</code>.</p>\n<h3 id=\"event-lock-screen-macos-windows\"><a href=\"#event-lock-screen-macos-windows\">Event: 'lock-screen' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Emitted when the system is about to lock the screen.</p>\n<h3 id=\"event-unlock-screen-macos-windows\"><a href=\"#event-unlock-screen-macos-windows\">Event: 'unlock-screen' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Emitted as soon as the systems screen is unlocked.</p>\n<h3 id=\"event-user-did-become-active-macos\"><a href=\"#event-user-did-become-active-macos\">Event: 'user-did-become-active' <em>macOS</em></a></h3>\n<p>Emitted when a login session is activated. See <a href=\"https://developer.apple.com/documentation/appkit/nsworkspacesessiondidbecomeactivenotification?language=objc\">documentation</a> for more information.</p>\n<h3 id=\"event-user-did-resign-active-macos\"><a href=\"#event-user-did-resign-active-macos\">Event: 'user-did-resign-active' <em>macOS</em></a></h3>\n<p>Emitted when a login session is deactivated. See <a href=\"https://developer.apple.com/documentation/appkit/nsworkspacesessiondidresignactivenotification?language=objc\">documentation</a> for more information.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>powerMonitor</code> tem os seguintes métodos:</p>\n<h3 id=\"powermonitorgetsystemidlestateidlethreshold\"><a href=\"#powermonitorgetsystemidlestateidlethreshold\"><code>powerMonitor.getSystemIdleState(idleThreshold)</code></a></h3>\n<ul>\n<li><code>idleThreshold</code> Integer</li>\n</ul>\n<p>Returns <code>String</code> - The system's current state. Pode ser <code>active</code>, <code>idle</code>, <code>locked</code> ou <code>unknown</code>.</p>\n<p>Calculate the system idle state. <code>idleThreshold</code> is the amount of time (in seconds) before considered idle.  <code>locked</code> is available on supported systems only.</p>\n<h3 id=\"powermonitorgetsystemidletime\"><a href=\"#powermonitorgetsystemidletime\"><code>powerMonitor.getSystemIdleTime()</code></a></h3>\n<p>Returns <code>Integer</code> - Idle time in seconds</p>\n<p>Calculate system idle time in seconds.</p>\n<h3 id=\"powermonitorisonbatterypower\"><a href=\"#powermonitorisonbatterypower\"><code>powerMonitor.isOnBatteryPower()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the system is on battery power.</p>\n<p>To monitor for changes in this property, use the <code>on-battery</code> and <code>on-ac</code> events.</p>\n<h2 id=\"propriedades\"><a href=\"#propriedades\">Propriedades</a></h2>\n<h3 id=\"powermonitoronbatterypower\"><a href=\"#powermonitoronbatterypower\"><code>powerMonitor.onBatteryPower</code></a></h3>\n<p>A <code>Boolean</code> property. True if the system is on battery power.</p>\n<p>See <a href=\"#powermonitorisonbatterypower\"><code>powerMonitor.isOnBatteryPower()</code></a>.</p>",
      "title": "powerMonitor",
      "description": "Monitor power state changes."
    },
    "/docs/api/power-save-blocker": {
      "locale": "pt-BR",
      "slug": "power-save-blocker",
      "href": "/docs/api/power-save-blocker",
      "crowdinFileId": "256353",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/power-save-blocker.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"powersaveblocker\"><a href=\"#powersaveblocker\">powerSaveBlocker</a></h1>\n<blockquote>\n<p>Block the system from entering low-power (sleep) mode.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>Como por exemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { powerSaveBlocker } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> id = powerSaveBlocker.start(<span class=\"hljs-string\">'prevent-display-sleep'</span>)\n<span class=\"hljs-built_in\">console</span>.log(powerSaveBlocker.isStarted(id))\n\npowerSaveBlocker.stop(id)\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>powerSaveBlocker</code> tem os seguintes métodos:</p>\n<h3 id=\"powersaveblockerstarttype\"><a href=\"#powersaveblockerstarttype\"><code>powerSaveBlocker.start(type)</code></a></h3>\n<ul>\n<li><code>type</code> String - Power save blocker type.<ul>\n<li><code>prevent-app-suspension</code> - Prevent the application from being suspended. Keeps system active but allows screen to be turned off. Example use cases: downloading a file or playing audio.</li>\n<li><code>prevent-display-sleep</code> - Prevent the display from going to sleep. Keeps system and screen active. Example use case: playing video.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code> - The blocker ID that is assigned to this power blocker.</p>\n<p>Starts preventing the system from entering lower-power mode. Returns an integer identifying the power save blocker.</p>\n<p><strong>Note:</strong> <code>prevent-display-sleep</code> has higher precedence over <code>prevent-app-suspension</code>. Only the highest precedence type takes effect. In other words, <code>prevent-display-sleep</code> always takes precedence over <code>prevent-app-suspension</code>.</p>\n<p>For example, an API calling A requests for <code>prevent-app-suspension</code>, and another calling B requests for <code>prevent-display-sleep</code>. <code>prevent-display-sleep</code> will be used until B stops its request. After that, <code>prevent-app-suspension</code> is used.</p>\n<h3 id=\"powersaveblockerstopid\"><a href=\"#powersaveblockerstopid\"><code>powerSaveBlocker.stop(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer - The power save blocker id returned by <code>powerSaveBlocker.start</code>.</li>\n</ul>\n<p>Stops the specified power save blocker.</p>\n<h3 id=\"powersaveblockerisstartedid\"><a href=\"#powersaveblockerisstartedid\"><code>powerSaveBlocker.isStarted(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer - The power save blocker id returned by <code>powerSaveBlocker.start</code>.</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the corresponding <code>powerSaveBlocker</code> has started.</p>",
      "title": "powerSaveBlocker",
      "description": "Block the system from entering low-power (sleep) mode."
    },
    "/docs/api/structures/printer-info": {
      "locale": "pt-BR",
      "slug": "printer-info",
      "href": "/docs/api/structures/printer-info",
      "crowdinFileId": "256479",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/printer-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"printerinfo-object\"><a href=\"#printerinfo-object\">PrinterInfo Object</a></h1>\n<ul>\n<li><code>name</code> String - the name of the printer as understood by the OS.</li>\n<li><code>displayName</code> String - the name of the printer as shown in Print Preview.</li>\n<li><code>description</code> String - a longer description of the printer's type.</li>\n<li><code>status</code> Number - the current status of the printer.</li>\n<li><code>isDefault</code> Boolean - whether or not a given printer is set as the default printer on the OS.</li>\n<li><code>options</code> Object - an object containing a variable number of platform-specific printer information.</li>\n</ul>\n<p>The number represented by <code>status</code> means different things on different platforms: on Windows its potential values can be found <a href=\"https://docs.microsoft.com/en-us/windows/win32/printdocs/printer-info-2\">here</a>, and on Linux and macOS they can be found <a href=\"https://www.cups.org/doc/cupspm.html\">here</a>.</p>\n<h2 id=\"exemplo\"><a href=\"#exemplo\">Exemplo</a></h2>\n<p>Below is an example of some of the additional options that may be set which may be different on each platform.</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Austin_4th_Floor_Printer___C02XK13BJHD4'</span>,\n  <span class=\"hljs-attr\">displayName</span>: <span class=\"hljs-string\">'Austin 4th Floor Printer @ C02XK13BJHD4'</span>,\n  <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'TOSHIBA ColorMFP'</span>,\n  <span class=\"hljs-attr\">status</span>: <span class=\"hljs-number\">3</span>,\n  <span class=\"hljs-attr\">isDefault</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">options</span>: {\n    <span class=\"hljs-attr\">copies</span>: <span class=\"hljs-string\">'1'</span>,\n    <span class=\"hljs-string\">'device-uri'</span>: <span class=\"hljs-string\">'dnssd://Austin%204th%20Floor%20Printer%20%40%20C02XK13BJHD4._ipps._tcp.local./?uuid=71687f1e-1147-3274-6674-22de61b110bd'</span>,\n    <span class=\"hljs-attr\">finishings</span>: <span class=\"hljs-string\">'3'</span>,\n    <span class=\"hljs-string\">'job-cancel-after'</span>: <span class=\"hljs-string\">'10800'</span>,\n    <span class=\"hljs-string\">'job-hold-until'</span>: <span class=\"hljs-string\">'no-hold'</span>,\n    <span class=\"hljs-string\">'job-priority'</span>: <span class=\"hljs-string\">'50'</span>,\n    <span class=\"hljs-string\">'job-sheets'</span>: <span class=\"hljs-string\">'none,none'</span>,\n    <span class=\"hljs-string\">'marker-change-time'</span>: <span class=\"hljs-string\">'0'</span>,\n    <span class=\"hljs-string\">'number-up'</span>: <span class=\"hljs-string\">'1'</span>,\n    <span class=\"hljs-string\">'printer-commands'</span>: <span class=\"hljs-string\">'ReportLevels,PrintSelfTestPage,com.toshiba.ColourProfiles.update,com.toshiba.EFiling.update,com.toshiba.EFiling.checkPassword'</span>,\n    <span class=\"hljs-string\">'printer-info'</span>: <span class=\"hljs-string\">'Austin 4th Floor Printer @ C02XK13BJHD4'</span>,\n    <span class=\"hljs-string\">'printer-is-accepting-jobs'</span>: <span class=\"hljs-string\">'true'</span>,\n    <span class=\"hljs-string\">'printer-is-shared'</span>: <span class=\"hljs-string\">'false'</span>,\n    <span class=\"hljs-string\">'printer-is-temporary'</span>: <span class=\"hljs-string\">'false'</span>,\n    <span class=\"hljs-string\">'printer-location'</span>: <span class=\"hljs-string\">''</span>,\n    <span class=\"hljs-string\">'printer-make-and-model'</span>: <span class=\"hljs-string\">'TOSHIBA ColorMFP'</span>,\n    <span class=\"hljs-string\">'printer-state'</span>: <span class=\"hljs-string\">'3'</span>,\n    <span class=\"hljs-string\">'printer-state-change-time'</span>: <span class=\"hljs-string\">'1573472937'</span>,\n    <span class=\"hljs-string\">'printer-state-reasons'</span>: <span class=\"hljs-string\">'offline-report,com.toshiba.snmp.failed'</span>,\n    <span class=\"hljs-string\">'printer-type'</span>: <span class=\"hljs-string\">'10531038'</span>,\n    <span class=\"hljs-string\">'printer-uri-supported'</span>: <span class=\"hljs-string\">'ipp://localhost/printers/Austin_4th_Floor_Printer___C02XK13BJHD4'</span>,\n    <span class=\"hljs-attr\">system_driverinfo</span>: <span class=\"hljs-string\">'T'</span>\n  }\n}\n</code></pre>",
      "title": "PrinterInfo Object",
      "description": ""
    },
    "/docs/api/process": {
      "locale": "pt-BR",
      "slug": "process",
      "href": "/docs/api/process",
      "crowdinFileId": "256355",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/process.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"process\"><a href=\"#process\">process</a></h1>\n<blockquote>\n<p>Extensões para objeto process.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>O objeto <code>process</code> do Electron estende do <a href=\"https://nodejs.org/api/process.html\">objeto <code>process</code> do Node.js</a>. Ele adiciona os seguintes eventos, propriedades e métodos:</p>\n<h2 id=\"sandbox\"><a href=\"#sandbox\">Sandbox</a></h2>\n<p>In sandboxed renderers the <code>process</code> object contains only a subset of the APIs:</p>\n<ul>\n<li><code>crash()</code></li>\n<li><code>hang()</code></li>\n<li><code>getCreationTime()</code></li>\n<li><code>getHeapStatistics()</code></li>\n<li><code>getBlinkMemoryInfo()</code></li>\n<li><code>getProcessMemoryInfo()</code></li>\n<li><code>getSystemMemoryInfo()</code></li>\n<li><code>getSystemVersion()</code></li>\n<li><code>getCPUUsage()</code></li>\n<li><code>getIOCounters()</code></li>\n<li><code>uptime()</code></li>\n<li><code>argv</code></li>\n<li><code>execPath</code></li>\n<li><code>env</code></li>\n<li><code>pid</code></li>\n<li><code>arch</code></li>\n<li><code>plataforma</code></li>\n<li><code>sandboxed</code></li>\n<li><code>contextIsolated</code></li>\n<li><code>tipo</code></li>\n<li><code>versão</code></li>\n<li><code>versions</code></li>\n<li><code>mas</code></li>\n<li><code>windowsStore</code></li>\n<li><code>contextId</code></li>\n</ul>\n<h2 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h2>\n<h3 id=\"evento-loaded\"><a href=\"#evento-loaded\">Evento: 'loaded'</a></h3>\n<p>Emitido quando o Electron já carregou seu script de inicialização interno e começa a carregar a página da web ou o script principal.</p>\n<h2 id=\"propriedades\"><a href=\"#propriedades\">Propriedades</a></h2>\n<h3 id=\"processdefaultapp-readonly\"><a href=\"#processdefaultapp-readonly\"><code>process.defaultApp</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>. When app is started by being passed as parameter to the default app, this property is <code>true</code> in the main process, otherwise it is <code>undefined</code>.</p>\n<h3 id=\"processismainframe-readonly\"><a href=\"#processismainframe-readonly\"><code>process.isMainFrame</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>, <code>true</code> when the current renderer context is the \"main\" renderer frame. If you want the ID of the current frame you should use <code>webFrame.routingId</code>.</p>\n<h3 id=\"processmas-readonly\"><a href=\"#processmas-readonly\"><code>process.mas</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>. For Mac App Store build, this property is <code>true</code>, for other builds it is <code>undefined</code>.</p>\n<h3 id=\"processnoasar\"><a href=\"#processnoasar\"><code>process.noAsar</code></a></h3>\n<p>A <code>Boolean</code> that controls ASAR support inside your application. Setting this to <code>true</code> will disable the support for <code>asar</code> archives in Node's built-in modules.</p>\n<h3 id=\"processnodeprecation\"><a href=\"#processnodeprecation\"><code>process.noDeprecation</code></a></h3>\n<p>A <code>Boolean</code> that controls whether or not deprecation warnings are printed to <code>stderr</code>. Setting this to <code>true</code> will silence deprecation warnings. This property is used instead of the <code>--no-deprecation</code> command line flag.</p>\n<h3 id=\"processresourcespath-readonly\"><a href=\"#processresourcespath-readonly\"><code>process.resourcesPath</code> <em>Readonly</em></a></h3>\n<p>Uma <code>String</code> que representa o caminho para o diretório de recursos.</p>\n<h3 id=\"processsandboxed-readonly\"><a href=\"#processsandboxed-readonly\"><code>process.sandboxed</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>. When the renderer process is sandboxed, this property is <code>true</code>, otherwise it is <code>undefined</code>.</p>\n<h3 id=\"processcontextisolated-readonly\"><a href=\"#processcontextisolated-readonly\"><code>process.contextIsolated</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> that indicates whether the current renderer context has <code>contextIsolation</code> enabled. It is <code>undefined</code> in the main process.</p>\n<h3 id=\"processthrowdeprecation\"><a href=\"#processthrowdeprecation\"><code>process.throwDeprecation</code></a></h3>\n<p>A <code>Boolean</code> that controls whether or not deprecation warnings will be thrown as exceptions. Setting this to <code>true</code> will throw errors for deprecations. This property is used instead of the <code>--throw-deprecation</code> command line flag.</p>\n<h3 id=\"processtracedeprecation\"><a href=\"#processtracedeprecation\"><code>process.traceDeprecation</code></a></h3>\n<p>A <code>Boolean</code> that controls whether or not deprecations printed to <code>stderr</code> include their stack trace. Setting this to <code>true</code> will print stack traces for deprecations. This property is instead of the <code>--trace-deprecation</code> command line flag.</p>\n<h3 id=\"processtraceprocesswarnings\"><a href=\"#processtraceprocesswarnings\"><code>process.traceProcessWarnings</code></a></h3>\n<p>A <code>Boolean</code> that controls whether or not process warnings printed to <code>stderr</code> include their stack trace. Setting this to <code>true</code> will print stack traces for process warnings (including deprecations). This property is instead of the <code>--trace-warnings</code> command line flag.</p>\n<h3 id=\"processtype-readonly\"><a href=\"#processtype-readonly\"><code>process.type</code> <em>Readonly</em></a></h3>\n<p>A <code>String</code> representing the current process's type, can be:</p>\n<ul>\n<li><code>browser</code> - The main process</li>\n<li><code>renderer</code> - A renderer process</li>\n<li><code>worker</code> - In a web worker</li>\n</ul>\n<h3 id=\"processversionschrome-readonly\"><a href=\"#processversionschrome-readonly\"><code>process.versions.chrome</code> <em>Readonly</em></a></h3>\n<p>A <code>String</code> representing Chrome's version string.</p>\n<h3 id=\"processversionselectron-readonly\"><a href=\"#processversionselectron-readonly\"><code>process.versions.electron</code> <em>Readonly</em></a></h3>\n<p>A <code>String</code> representing Electron's version string.</p>\n<h3 id=\"processwindowsstore-readonly\"><a href=\"#processwindowsstore-readonly\"><code>process.windowsStore</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>. If the app is running as a Windows Store app (appx), this property is <code>true</code>, for otherwise it is <code>undefined</code>.</p>\n<h3 id=\"processcontextid-readonly\"><a href=\"#processcontextid-readonly\"><code>process.contextId</code> <em>Readonly</em></a></h3>\n<p>A <code>String</code> (optional) representing a globally unique ID of the current JavaScript context. Each frame has its own JavaScript context. When contextIsolation is enabled, the isolated world also has a separate JavaScript context. This property is only available in the renderer process.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O objeto <code>process</code> tem os seguintes métodos:</p>\n<h3 id=\"processcrash\"><a href=\"#processcrash\"><code>process.crash()</code></a></h3>\n<p>Causes the main thread of the current process crash.</p>\n<h3 id=\"processgetcreationtime\"><a href=\"#processgetcreationtime\"><code>process.getCreationTime()</code></a></h3>\n<p>Returns <code>Number | null</code> - The number of milliseconds since epoch, or <code>null</code> if the information is unavailable</p>\n<p>Indicates the creation time of the application. The time is represented as number of milliseconds since epoch. It returns null if it is unable to get the process creation time.</p>\n<h3 id=\"processgetcpuusage\"><a href=\"#processgetcpuusage\"><code>process.getCPUUsage()</code></a></h3>\n<p>Retorna <a href=\"/docs/api/structures/cpu-usage\"><code>CPUUsage</code></a></p>\n<h3 id=\"processgetiocounters-windows-linux\"><a href=\"#processgetiocounters-windows-linux\"><code>process.getIOCounters()</code> <em>Windows</em> <em>Linux</em></a></h3>\n<p>Retorna <a href=\"/docs/api/structures/io-counters\"><code>IOCounters</code></a></p>\n<h3 id=\"processgetheapstatistics\"><a href=\"#processgetheapstatistics\"><code>process.getHeapStatistics()</code></a></h3>\n<p>Retorna <code>Object</code>:</p>\n<ul>\n<li><code>totalHeapSize</code> Integer</li>\n<li><code>totalHeapSizeExecutable</code> Integer</li>\n<li><code>totalPhysicalSize</code> Integer</li>\n<li><code>totalAvailableSize</code> Integer</li>\n<li><code>usedHeapSize</code> Integer</li>\n<li><code>heapSizeLimit</code> Integer</li>\n<li><code>mallocedMemory</code> Integer</li>\n<li><code>peakMallocedMemory</code> Integer</li>\n<li><code>doesZapGarbage</code> Boolean</li>\n</ul>\n<p>Returns an object with V8 heap statistics. Note-se que todas as estatísticas são relatadas em Kilobytes.</p>\n<h3 id=\"processgetblinkmemoryinfo\"><a href=\"#processgetblinkmemoryinfo\"><code>process.getBlinkMemoryInfo()</code></a></h3>\n<p>Retorna <code>Object</code>:</p>\n<ul>\n<li><code>allocated</code> Integer - Size of all allocated objects in Kilobytes.</li>\n<li><code>marked</code> Integer - Size of all marked objects in Kilobytes.</li>\n<li><code>total</code> Integer - Total allocated space in Kilobytes.</li>\n</ul>\n<p>Returns an object with Blink memory information. It can be useful for debugging rendering / DOM related memory issues. Note that all values are reported in Kilobytes.</p>\n<h3 id=\"processgetprocessmemoryinfo\"><a href=\"#processgetprocessmemoryinfo\"><code>process.getProcessMemoryInfo()</code></a></h3>\n<p>Returns <code>Promise&#x3C;ProcessMemoryInfo></code> - Resolves with a <a href=\"/docs/api/structures/process-memory-info\">ProcessMemoryInfo</a></p>\n<p>Returns an object giving memory usage statistics about the current process. Note that all statistics are reported in Kilobytes. This api should be called after app ready.</p>\n<p>Chromium does not provide <code>residentSet</code> value for macOS. This is because macOS performs in-memory compression of pages that haven't been recently used. As a result the resident set size value is not what one would expect. <code>private</code> memory is more representative of the actual pre-compression memory usage of the process on macOS.</p>\n<h3 id=\"processgetsystemmemoryinfo\"><a href=\"#processgetsystemmemoryinfo\"><code>process.getSystemMemoryInfo()</code></a></h3>\n<p>Retorna <code>Object</code>:</p>\n<ul>\n<li><code>total</code> Integer - The total amount of physical memory in Kilobytes available to the system.</li>\n<li><code>free</code> Integer - The total amount of memory not being used by applications or disk cache.</li>\n<li><code>swapTotal</code> Integer <em>Windows</em> <em>Linux</em> - The total amount of swap memory in Kilobytes available to the system.</li>\n<li><code>swapFree</code> Integer <em>Windows</em> <em>Linux</em> - The free amount of swap memory in Kilobytes available to the system.</li>\n</ul>\n<p>Returns an object giving memory usage statistics about the entire system. Note that all statistics are reported in Kilobytes.</p>\n<h3 id=\"processgetsystemversion\"><a href=\"#processgetsystemversion\"><code>process.getSystemVersion()</code></a></h3>\n<p>Returns <code>String</code> - The version of the host operating system.</p>\n<p>Exemplo:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> version = process.getSystemVersion()\n<span class=\"hljs-built_in\">console</span>.log(version)\n<span class=\"hljs-comment\">// On macOS -> '10.13.6'</span>\n<span class=\"hljs-comment\">// On Windows -> '10.0.17763'</span>\n<span class=\"hljs-comment\">// On Linux -> '4.15.0-45-generic'</span>\n</code></pre>\n<p><strong>Note:</strong> It returns the actual operating system version instead of kernel version on macOS unlike <code>os.release()</code>.</p>\n<h3 id=\"processtakeheapsnapshotfilepath\"><a href=\"#processtakeheapsnapshotfilepath\"><code>process.takeHeapSnapshot(filePath)</code></a></h3>\n<ul>\n<li><code>filePath</code> String - Path to the output file.</li>\n</ul>\n<p>Returns <code>Boolean</code> - Indicates whether the snapshot has been created successfully.</p>\n<p>Takes a V8 heap snapshot and saves it to <code>filePath</code>.</p>\n<h3 id=\"processhang\"><a href=\"#processhang\"><code>process.hang()</code></a></h3>\n<p>Causes the main thread of the current process hang.</p>\n<h3 id=\"processsetfdlimitmaxdescriptors-macos-linux\"><a href=\"#processsetfdlimitmaxdescriptors-macos-linux\"><code>process.setFdLimit(maxDescriptors)</code> <em>macOS</em> <em>Linux</em></a></h3>\n<ul>\n<li><code>maxDescriptors</code> Integer</li>\n</ul>\n<p>Sets the file descriptor soft limit to <code>maxDescriptors</code> or the OS hard limit, whichever is lower for the current process.</p>",
      "title": "process",
      "description": "Extensões para objeto process."
    },
    "/docs/api/structures/process-memory-info": {
      "locale": "pt-BR",
      "slug": "process-memory-info",
      "href": "/docs/api/structures/process-memory-info",
      "crowdinFileId": "256481",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/process-memory-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"processmemoryinfo-object\"><a href=\"#processmemoryinfo-object\">ProcessMemoryInfo Object</a></h1>\n<ul>\n<li><code>residentSet</code> Integer <em>Linux</em> <em>Windows</em> - The amount of memory currently pinned to actual physical RAM in Kilobytes.</li>\n<li><code>private</code> Integer - The amount of memory not shared by other processes, such as JS heap or HTML content in Kilobytes.</li>\n<li><code>shared</code> Integer - The amount of memory shared between processes, typically memory consumed by the Electron code itself in Kilobytes.</li>\n</ul>",
      "title": "ProcessMemoryInfo Object",
      "description": ""
    },
    "/docs/api/structures/process-metric": {
      "locale": "pt-BR",
      "slug": "process-metric",
      "href": "/docs/api/structures/process-metric",
      "crowdinFileId": "256483",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/process-metric.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"processmetric-object\"><a href=\"#processmetric-object\">ProcessMetric Object</a></h1>\n<ul>\n<li><code>pid</code> Integer - Process id of the process.</li>\n<li><code>type</code> String - Process type. One of the following values:<ul>\n<li><code>Browser</code></li>\n<li><code>Tab</code></li>\n<li><code>Utilidade</code></li>\n<li><code>Zygote</code></li>\n<li><code>Ajuda ao Sandbox</code></li>\n<li><code>GPU</code></li>\n<li><code>Pepper Plugin</code></li>\n<li><code>Pepper Plugin Broker</code></li>\n<li><code>Desconhecido</code></li>\n</ul></li>\n<li><code>serviceName</code> String (optional) - The non-localized name of the process.</li>\n<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>\n<li><code>cpu</code> <a href=\"/docs/api/structures/cpu-usage\">CPUUsage</a> - CPU usage of the process.</li>\n<li><code>creationTime</code> Number - Creation time for this process. The time is represented as number of milliseconds since epoch. Since the <code>pid</code> can be reused after a process dies, it is useful to use both the <code>pid</code> and the <code>creationTime</code> to uniquely identify a process.</li>\n<li><code>memory</code> <a href=\"/docs/api/structures/memory-info\">MemoryInfo</a> - Memory information for the process.</li>\n<li><code>sandboxed</code> Boolean (optional) <em>macOS</em> <em>Windows</em> - Whether the process is sandboxed on OS level.</li>\n<li><code>integrityLevel</code> String (optional) <em>Windows</em> - One of the following values:<ul>\n<li><code>untrusted</code></li>\n<li><code>low</code></li>\n<li><code>medium</code></li>\n<li><code>high</code></li>\n<li><code>unknown</code></li>\n</ul></li>\n</ul>",
      "title": "ProcessMetric Object",
      "description": ""
    },
    "/docs/tutorial/process-model": {
      "locale": "pt-BR",
      "slug": "process-model",
      "href": "/docs/tutorial/process-model",
      "crowdinFileId": "256233",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/process-model.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"modelos-de-processo\"><a href=\"#modelos-de-processo\">Modelos de Processo</a></h1>\n<p>O Electron herda sua arquitetura multi-processo do Chromium, o que torna o framework muito semelhante a um navegador web moderno. Neste guia, nós vamos expor o conhecimento conceitual do Electron que aplicamos no básico <a href=\"/docs/tutorial/quick-start\">aplicativo de início rápido</a>.</p>\n<h2 id=\"porque-não-um-processo-único\"><a href=\"#porque-não-um-processo-único\">Porque não um processo único?</a></h2>\n<p>Navegadores da web são aplicações incrivelmente complicadas. Além da função principal de mostrar o conteúdo web, eles têm muitas responsabilidades secundárias, tais como gerenciar várias janelas (ou abas) e carregar extensões de terceiros.</p>\n<p>Nos dias anteriores, os navegadores costumavam usar um único processo para todas estas funcionalidades. Embora este padrão significasse menos sobrecarga para cada guia que você tinha aberta, também significava que se um site falhasse ou travasse, isso afetaria todo o navegador.</p>\n<h2 id=\"o-modelo-multi-processo\"><a href=\"#o-modelo-multi-processo\">O modelo multi-processo</a></h2>\n<p>Para resolver este problema, a equipe do Chrome decidiu que cada aba renderizaria seu próprio processo, limitando o dano que códigos defeituosos ou maliciosos em uma página da web poderiam causar ao aplicativo como um todo. Um único processo de navegador, em seguida, controla esses processos, bem como o ciclo de vida da aplicação como um todo. Este diagrama abaixo do <a href=\"https://www.google.com/googlebooks/chrome/\">Chrome Comic</a> visualiza este modelo:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/chrome-processes.png\" alt=\"Chrome&#x27;s multi-process architecture\"></p>\n<p>Aplicações Electron são estruturadas de forma muito semelhante. Como um desenvolvedor, você controla dois tipos de processos: o principal e o renderizador. Essas são análogas ao próprio navegador do Chrome e aos processos de renderização descritos acima.</p>\n<h2 id=\"o-processo-principal\"><a href=\"#o-processo-principal\">O processo principal</a></h2>\n<p>Cada aplicativo do Electron tem um único processo principal, que atua como o ponto de entrada do aplicativo. O processo principal é executado em um ambiente de Node.js, o que significa que tem a habilidade de <code>exigir</code> módulos e usar todas as APIs do Node.js.</p>\n<h3 id=\"gerenciamento-de-janelas\"><a href=\"#gerenciamento-de-janelas\">Gerenciamento de janelas</a></h3>\n<p>O objetivo principal do processo é criar e gerenciar as janelas do aplicativo com o módulo <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<p>Cada instância da classe <code>BrowserWindow</code> cria uma janela do aplicativo que carrega uma página web em um processo de renderização separado. Você pode interagir com este conteúdo web do processo principal usando o objeto <a href=\"/docs/api/web-contents\"><code>webContents</code></a> da janela.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> contents = win.webContents\n<span class=\"hljs-built_in\">console</span>.log(contents)\n</code></pre>\n<blockquote>\n<p>Nota: Um processo de renderização também é criado para a <a href=\"/docs/tutorial/web-embeds\">web embeds</a>, como o módulo <code>BrowserView</code>. O objeto <code>de conteúdo</code> web também é acessível para conteúdo web embutido.</p>\n</blockquote>\n<p>Because the <code>BrowserWindow</code> module is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\"><code>EventEmitter</code></a>, you can also add handlers for various user events (for example, minimizing or maximizing your window).</p>\n<p>When a <code>BrowserWindow</code> instance is destroyed, its corresponding renderer process gets terminated as well.</p>\n<h3 id=\"application-lifecycle\"><a href=\"#application-lifecycle\">Application lifecycle</a></h3>\n<p>The main process also controls your application's lifecycle through Electron's <a href=\"/docs/api/app\"><code>app</code></a> module. This module provides a large set of events and methods that you can use to add custom application behaviour (for instance, programatically quitting your application, modifying the application dock, or showing an About panel).</p>\n<p>As a practical example, the app shown in the <a href=\"/docs/tutorial/quick-start#manage-your-windows-lifecycle\">quick start guide</a> uses <code>app</code> APIs to create a more native application window experience.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// quitting the app when no windows are open on non-macOS platforms</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h3 id=\"native-apis\"><a href=\"#native-apis\">Native APIs</a></h3>\n<p>To extend Electron's features beyond being a Chromium wrapper for web contents, the main process also adds custom APIs to interact with the user's operating system. Electron exposes various modules that control native desktop functionality, such as menus, dialogs, and tray icons.</p>\n<p>For a full list of Electron's main process modules, check out our API documentation.</p>\n<h2 id=\"the-renderer-process\"><a href=\"#the-renderer-process\">The renderer process</a></h2>\n<p>Each Electron app spawns a separate renderer process for each open <code>BrowserWindow</code> (and each web embed). As its name implies, a renderer is responsible for <em>rendering</em> web content. For all intents and purposes, code ran in renderer processes should behave according to web standards (insofar as Chromium does, at least).</p>\n<p>Therefore, all user interfaces and app functionality within a single browser window should be written with the same tools and paradigms that you use on the web.</p>\n<p>Although explaining every web spec is out of scope for this guide, the bare minimum to understand is:</p>\n<ul>\n<li>An HTML file is your entry point for the renderer process.</li>\n<li>UI styling is added through Cascading Style Sheets (CSS).</li>\n<li>Executable JavaScript code can be added through <code>&#x3C;script></code> elements.</li>\n</ul>\n<p>Moreover, this also means that the renderer has no direct access to <code>require</code> or other Node.js APIs. In order to directly include NPM modules in the renderer, you must use the same bundler toolchains (for example, <code>webpack</code> or <code>parcel</code>) that you use on the web.</p>\n<blockquote>\n<p>Note: Renderer processes can be spawned with a full Node.js environment for ease of development. Historically, this used to be the default, but this feature was disabled for security reasons.</p>\n</blockquote>\n<p>At this point, you might be wondering how your renderer process user interfaces can interact with Node.js and Electron's native desktop functionality if these features are only accessible from the main process. In fact, there is no direct way to import Electron's content scripts.</p>\n<h2 id=\"preload-scripts\"><a href=\"#preload-scripts\">Preload scripts</a></h2>\n<!-- Note: This guide doesn't take sandboxing into account, which might fundamentally \nchange the statements here. --> Preload scripts contain code that executes in a renderer process before its web content begins loading. These scripts run within the renderer context, but are granted more privileges by having access to Node.js APIs.\n<p>A preload script can be attached to the main process in the <code>BrowserWindow</code> constructor's <code>webPreferences</code> option.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">//...</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">preload</span>: <span class=\"hljs-string\">'path/to/preload.js'</span>\n  }\n})\n<span class=\"hljs-comment\">//...</span>\n</code></pre>\n<p>Because the preload script shares a global <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window\"><code>Window</code></a> interface with the renderers and can access Node.js APIs, it serves to enhance your renderer by exposing arbitrary APIs in the <code>window</code> global that your web contents can then consume.</p>\n<p>Although preload scripts share a <code>window</code> global with the renderer they're attached to, you cannot directly attach any variables from the preload script to <code>window</code> because of the <a href=\"/docs/tutorial/context-isolation\"><code>contextIsolation</code></a> default.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.myAPI = {\n  <span class=\"hljs-attr\">desktop</span>: <span class=\"hljs-literal\">true</span>\n}\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-built_in\">window</span>.myAPI)\n<span class=\"hljs-comment\">// => undefined</span>\n</code></pre>\n<p>Context Isolation means that preload scripts are isolated from the renderer's main world to avoid leaking any privileged APIs into your web content's code.</p>\n<p>Instead, use the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> module to accomplish this securely:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">desktop</span>: <span class=\"hljs-literal\">true</span>\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-built_in\">window</span>.myAPI)\n<span class=\"hljs-comment\">// => { desktop: true }</span>\n</code></pre>\n<p>This feature is incredibly useful for two main purposes:</p>\n<ul>\n<li>By exposing <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> helpers to the renderer, you can use inter-process communication (IPC) to trigger main process tasks from the renderer (and vice-versa).</li>\n<li>If you're developing an Electron wrapper for an existing web app hosted on a remote URL, you can add custom properties onto the renderer's <code>window</code> global that can be used for desktop-only logic on the web client's side.</li>\n</ul>",
      "title": "Modelos de Processo",
      "description": "Nota: Um processo de renderização também é criado para a web embeds, como o módulo BrowserView. O objeto de conteúdo web também é acessível para conteúdo web embutido."
    },
    "/docs/api/structures/product": {
      "locale": "pt-BR",
      "slug": "product",
      "href": "/docs/api/structures/product",
      "crowdinFileId": "256485",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/product.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"product-object\"><a href=\"#product-object\">Product Object</a></h1>\n<ul>\n<li><code>productIdentifier</code> String - The string that identifies the product to the Apple App Store.</li>\n<li><code>localizedDescription</code> String - A description of the product.</li>\n<li><code>localizedTitle</code> String - The name of the product.</li>\n<li><code>contentVersion</code> String - A string that identifies the version of the content.</li>\n<li><code>contentLengths</code> Number[] - The total size of the content, in bytes.</li>\n<li><code>price</code> Number - The cost of the product in the local currency.</li>\n<li><code>formattedPrice</code> String - The locale formatted price of the product.</li>\n<li><code>currencyCode</code> String - 3 character code presenting a product's currency based on the ISO 4217 standard.</li>\n<li><code>isDownloadable</code> Boolean - A Boolean value that indicates whether the App Store has downloadable content for this product. <code>true</code> if at least one file has been associated with the product.</li>\n</ul>",
      "title": "Product Object",
      "description": ""
    },
    "/docs/tutorial/progress-bar": {
      "locale": "pt-BR",
      "slug": "progress-bar",
      "href": "/docs/tutorial/progress-bar",
      "crowdinFileId": "256235",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/progress-bar.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"taskbar-progress-bar-windows--macos\"><a href=\"#taskbar-progress-bar-windows--macos\">Taskbar Progress Bar (Windows &#x26; macOS)</a></h1>\n<h2 id=\"visão-geral\"><a href=\"#visão-geral\">Visão Geral</a></h2>\n<p>A progress bar enables a window to provide progress information to the user without the need of switching to the window itself.</p>\n<p>On Windows, you can use a taskbar button to display a progress bar.</p>\n<p>![Windows Progress Bar][<a href=\"https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png%5C\">https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png\\</a>]</p>\n<p>On macOS, the progress bar will be displayed as a part of the dock icon.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/macos-progress-bar.png\" alt=\"macOS Progress Bar\"></p>\n<p>On Linux, the Unity graphical interface also has a similar feature that allows you to specify the progress bar in the launcher.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/linux-progress-bar.png\" alt=\"Linux Progress Bar\"></p>\n<blockquote>\n<p>NOTE: on Windows, each window can have its own progress bar, whereas on macOS and Linux (Unity) there can be only one progress bar for the application.</p>\n</blockquote>\n<hr>\n<p>All three cases are covered by the same API - the <a href=\"/docs/api/browser-window#winsetprogressbarprogress-options\"><code>setProgressBar()</code></a> method available on an instance of <code>BrowserWindow</code>. To indicate your progress, call this method with a number between <code>0</code> and <code>1</code>. For example, if you have a long-running task that is currently at 63% towards completion, you would call it as <code>setProgressBar(0.63)</code>.</p>\n<p>Setting the parameter to negative values (e.g. <code>-1</code>) will remove the progress bar. Setting it to a value greater than <code>1</code> will indicate an indeterminate progress bar in Windows or clamp to 100% in other operating systems. An indeterminate progress bar remains active but does not show an actual percentage, and is used for situations when you do not know how long an operation will take to complete.</p>\n<p>Veja a <a href=\"/docs/api/browser-window#winsetprogressbarprogress-options\">documentação da API para mais opções e modos</a>.</p>\n<h2 id=\"exemplo\"><a href=\"#exemplo\">Exemplo</a></h2>\n<p>In this example, we add a progress bar to the main window that increments over time using Node.js timers.</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/progress-bar\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> progressInterval\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-keyword\">const</span> INCREMENT = <span class=\"hljs-number\">0.03</span>\n  <span class=\"hljs-keyword\">const</span> INTERVAL_DELAY = <span class=\"hljs-number\">100</span> <span class=\"hljs-comment\">// ms</span>\n\n  <span class=\"hljs-keyword\">let</span> c = <span class=\"hljs-number\">0</span>\n  progressInterval = setInterval(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// update progress bar to next value</span>\n    <span class=\"hljs-comment\">// values between 0 and 1 will show progress, >1 will show indeterminate or stick at 100%</span>\n    win.setProgressBar(c)\n\n    <span class=\"hljs-comment\">// increment or reset progress bar</span>\n    <span class=\"hljs-keyword\">if</span> (c &#x3C; <span class=\"hljs-number\">2</span>) c += INCREMENT\n    <span class=\"hljs-keyword\">else</span> c = <span class=\"hljs-number\">0</span>\n  }, INTERVAL_DELAY)\n}\n\napp.whenReady().then(createWindow)\n\n<span class=\"hljs-comment\">// before the app is terminated, clear both timers</span>\napp.on(<span class=\"hljs-string\">'before-quit'</span>, () => {\n  clearInterval(progressInterval)\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<p>After launching the Electron application, the dock (macOS) or taskbar (Windows, Unity) should show a progress bar that starts at zero and progresses through 100% to completion. It should then show indeterminate (Windows) or pin to 100% (other operating systems) briefly and then loop.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/dock-progress-bar.png\" alt=\"macOS dock progress bar\"></p>\n<p>For macOS, the progress bar will also be indicated for your application when using <a href=\"https://support.apple.com/en-us/HT204100\">Mission Control</a>:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/mission-control-progress-bar.png\" alt=\"Mission Control Progress Bar\"></p>",
      "title": "Taskbar Progress Bar (Windows & macOS)",
      "description": "NOTE: on Windows, each window can have its own progress bar, whereas on macOS and Linux (Unity) there can be only one progress bar for the application."
    },
    "/docs/api/protocol": {
      "locale": "pt-BR",
      "slug": "protocol",
      "href": "/docs/api/protocol",
      "crowdinFileId": "256357",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/protocol.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocol\"><a href=\"#protocol\">protocol</a></h1>\n<blockquote>\n<p>Registra um protocolo personalizado e intercepta as solicitações de protocolo existentes.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>Um exemplo de implementação de um protocolo que tem o mesmo efeito que o <code>file://</code> protocol:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })\n})\n</code></pre>\n<p><strong>Nota:</strong> Todos os métodos, a menos que seja especificados, só podem ser usados ​​após o evento <code>app</code> quando é emitido.</p>\n<h2 id=\"using-protocol-with-a-custom-partition-or-session\"><a href=\"#using-protocol-with-a-custom-partition-or-session\">Using <code>protocol</code> with a custom <code>partition</code> or <code>session</code></a></h2>\n<p>A protocol is registered to a specific Electron <a href=\"/docs/api/session\"><code>session</code></a> object. If you don't specify a session, then your <code>protocol</code> will be applied to the default session that Electron uses. However, if you define a <code>partition</code> or <code>session</code> on your <code>browserWindow</code>'s <code>webPreferences</code>, then that window will use a different session and your custom protocol will not work if you just use <code>electron.protocol.XXX</code>.</p>\n<p>To have your custom protocol work in combination with a custom session, you need to register it to that session explicitly.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session, app, protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> partition = <span class=\"hljs-string\">'persist:example'</span>\n  <span class=\"hljs-keyword\">const</span> ses = session.fromPartition(partition)\n\n  ses.protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })\n\n  mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { partition } })\n})\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo de protocolo possui os seguintes métodos:</p>\n<h3 id=\"protocolregisterschemesasprivilegedcustomschemes\"><a href=\"#protocolregisterschemesasprivilegedcustomschemes\"><code>protocol.registerSchemesAsPrivileged(customSchemes)</code></a></h3>\n<ul>\n<li><code>customSchemes</code> <a href=\"/docs/api/structures/custom-scheme\">CustomScheme[]</a></li>\n</ul>\n<p><strong>Note:</strong> This method can only be used before the <code>ready</code> event of the <code>app</code> module gets emitted and can be called only once.</p>\n<p>Registers the <code>scheme</code> as standard, secure, bypasses content security policy for resources, allows registering ServiceWorker, supports fetch API, and streaming video/audio. Specify a privilege with the value of <code>true</code> to enable the capability.</p>\n<p>An example of registering a privileged scheme, that bypasses Content Security Policy:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nprotocol.registerSchemesAsPrivileged([\n  { <span class=\"hljs-attr\">scheme</span>: <span class=\"hljs-string\">'foo'</span>, <span class=\"hljs-attr\">privileges</span>: { <span class=\"hljs-attr\">bypassCSP</span>: <span class=\"hljs-literal\">true</span> } }\n])\n</code></pre>\n<p>Um esquema padrão adere ao que a RFC 3986 chama <a href=\"https://tools.ietf.org/html/rfc3986#section-3\">generic URI syntax</a>. Por exemplo <code>http</code> e <code>https</code> são esquema padrão, enquanto <code>file</code> não é.</p>\n<p>Registering a scheme as standard allows relative and absolute resources to be resolved correctly when served. Caso contrário, o esquema se comportará como o protocolo <code>file</code>, mas sem a capacidade de resolver URLs relativos.</p>\n<p>Por exemplo, quando você carrega a página seguinte com o protocolo personalizado sem registrando-o como esquema padrão, a imagem não será carregada porque esquemas não padrão não podem reconhecer URLs relativas:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">img</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">'test.png'</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n</code></pre>\n<p>Registrar um esquema como padrão permitirá o acesso aos arquivos através do<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/LocalFileSystem\">FileSystem API</a>. Caso contrário, o renderizador lançará um erro de segurança para o esquema.</p>\n<p>By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB, cookies) are disabled for non standard schemes. So in general if you want to register a custom protocol to replace the <code>http</code> protocol, you have to register it as a standard scheme.</p>\n<p>Protocols that use streams (http and stream protocols) should set <code>stream: true</code>. The <code>&#x3C;video></code> and <code>&#x3C;audio></code> HTML elements expect protocols to buffer their responses by default. The <code>stream</code> flag configures those elements to correctly expect streaming responses.</p>\n<h3 id=\"protocolregisterfileprotocolscheme-handler\"><a href=\"#protocolregisterfileprotocolscheme-handler\"><code>protocol.registerFileProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Função<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send a file as the response. The <code>handler</code> will be called with <code>request</code> and <code>callback</code> where <code>request</code> is an incoming request for the <code>scheme</code>.</p>\n<p>To handle the <code>request</code>, the <code>callback</code> should be called with either the file's path or an object that has a <code>path</code> property, e.g. <code>callback(filePath)</code> or <code>callback({ path: filePath })</code>. The <code>filePath</code> must be an absolute path.</p>\n<p>By default the <code>scheme</code> is treated like <code>http:</code>, which is parsed differently from protocols that follow the \"generic URI syntax\" like <code>file:</code>.</p>\n<h3 id=\"protocolregisterbufferprotocolscheme-handler\"><a href=\"#protocolregisterbufferprotocolscheme-handler\"><code>protocol.registerBufferProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Função<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (Buffer | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send a <code>Buffer</code> as a response.</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code> should be called with either a <code>Buffer</code> object or an object that has the <code>data</code> property.</p>\n<p>Exemplo:</p>\n<pre><code class=\"hljs language-javascript\">protocol.registerBufferProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback({ <span class=\"hljs-attr\">mimeType</span>: <span class=\"hljs-string\">'text/html'</span>, <span class=\"hljs-attr\">data</span>: Buffer.from(<span class=\"hljs-string\">'&#x3C;h5>Response&#x3C;/h5>'</span>) })\n})\n</code></pre>\n<h3 id=\"protocolregisterstringprotocolscheme-handler\"><a href=\"#protocolregisterstringprotocolscheme-handler\"><code>protocol.registerStringProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Função<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send a <code>String</code> as a response.</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code> should be called with either a <code>String</code> or an object that has the <code>data</code> property.</p>\n<h3 id=\"protocolregisterhttpprotocolscheme-handler\"><a href=\"#protocolregisterhttpprotocolscheme-handler\"><code>protocol.registerHttpProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Função<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> ProtocolResponse</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send an HTTP request as a response.</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code> should be called with an object that has the <code>url</code> property.</p>\n<h3 id=\"protocolregisterstreamprotocolscheme-handler\"><a href=\"#protocolregisterstreamprotocolscheme-handler\"><code>protocol.registerStreamProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Função<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (ReadableStream | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send a stream as a response.</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code> should be called with either a <a href=\"https://nodejs.org/api/stream.html#stream_class_stream_readable\"><code>ReadableStream</code></a> object or an object that has the <code>data</code> property.</p>\n<p>Exemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { PassThrough } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'stream'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createStream</span> (<span class=\"hljs-params\">text</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> rv = <span class=\"hljs-keyword\">new</span> PassThrough() <span class=\"hljs-comment\">// PassThrough is also a Readable stream</span>\n  rv.push(text)\n  rv.push(<span class=\"hljs-literal\">null</span>)\n  <span class=\"hljs-keyword\">return</span> rv\n}\n\nprotocol.registerStreamProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback({\n    <span class=\"hljs-attr\">statusCode</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">headers</span>: {\n      <span class=\"hljs-string\">'content-type'</span>: <span class=\"hljs-string\">'text/html'</span>\n    },\n    <span class=\"hljs-attr\">data</span>: createStream(<span class=\"hljs-string\">'&#x3C;h5>Response&#x3C;/h5>'</span>)\n  })\n})\n</code></pre>\n<p>It is possible to pass any object that implements the readable stream API (emits <code>data</code>/<code>end</code>/<code>error</code> events). For example, here's how a file could be returned:</p>\n<pre><code class=\"hljs language-javascript\">protocol.registerStreamProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback(fs.createReadStream(<span class=\"hljs-string\">'index.html'</span>))\n})\n</code></pre>\n<h3 id=\"protocolunregisterprotocolscheme\"><a href=\"#protocolunregisterprotocolscheme\"><code>protocol.unregisterProtocol(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully unregistered</p>\n<p>Unregisters the custom protocol of <code>scheme</code>.</p>\n<h3 id=\"protocolisprotocolregisteredscheme\"><a href=\"#protocolisprotocolregisteredscheme\"><code>protocol.isProtocolRegistered(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether <code>scheme</code> is already registered.</p>\n<h3 id=\"protocolinterceptfileprotocolscheme-handler\"><a href=\"#protocolinterceptfileprotocolscheme-handler\"><code>protocol.interceptFileProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Função<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepts <code>scheme</code> protocol and uses <code>handler</code> as the protocol's new handler which sends a file as a response.</p>\n<h3 id=\"protocolinterceptstringprotocolscheme-handler\"><a href=\"#protocolinterceptstringprotocolscheme-handler\"><code>protocol.interceptStringProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Função<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepts <code>scheme</code> protocol and uses <code>handler</code> as the protocol's new handler which sends a <code>String</code> as a response.</p>\n<h3 id=\"protocolinterceptbufferprotocolscheme-handler\"><a href=\"#protocolinterceptbufferprotocolscheme-handler\"><code>protocol.interceptBufferProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Função<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (Buffer | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepts <code>scheme</code> protocol and uses <code>handler</code> as the protocol's new handler which sends a <code>Buffer</code> as a response.</p>\n<h3 id=\"protocolintercepthttpprotocolscheme-handler\"><a href=\"#protocolintercepthttpprotocolscheme-handler\"><code>protocol.interceptHttpProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Função<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepts <code>scheme</code> protocol and uses <code>handler</code> as the protocol's new handler which sends a new HTTP request as a response.</p>\n<h3 id=\"protocolinterceptstreamprotocolscheme-handler\"><a href=\"#protocolinterceptstreamprotocolscheme-handler\"><code>protocol.interceptStreamProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Função<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (ReadableStream | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Same as <code>protocol.registerStreamProtocol</code>, except that it replaces an existing protocol handler.</p>\n<h3 id=\"protocoluninterceptprotocolscheme\"><a href=\"#protocoluninterceptprotocolscheme\"><code>protocol.uninterceptProtocol(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully unintercepted</p>\n<p>Remove the interceptor installed for <code>scheme</code> and restore its original handler.</p>\n<h3 id=\"protocolisprotocolinterceptedscheme\"><a href=\"#protocolisprotocolinterceptedscheme\"><code>protocol.isProtocolIntercepted(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether <code>scheme</code> is already intercepted.</p>",
      "title": "protocol",
      "description": "Registra um protocolo personalizado e intercepta as solicitações de protocolo existentes."
    },
    "/docs/api/structures/protocol-request": {
      "locale": "pt-BR",
      "slug": "protocol-request",
      "href": "/docs/api/structures/protocol-request",
      "crowdinFileId": "256487",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-request.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolrequest-object\"><a href=\"#protocolrequest-object\">ProtocolRequest Object</a></h1>\n<ul>\n<li>String <code>url</code></li>\n<li><code>referrer</code> String</li>\n<li><code>method</code> String</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/upload-data\">UploadData[]</a> (optional)</li>\n<li><code>headers</code> Record&#x3C;String, String></li>\n</ul>",
      "title": "ProtocolRequest Object",
      "description": ""
    },
    "/docs/api/structures/protocol-response": {
      "locale": "pt-BR",
      "slug": "protocol-response",
      "href": "/docs/api/structures/protocol-response",
      "crowdinFileId": "256491",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-response.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolresponse-object\"><a href=\"#protocolresponse-object\">ProtocolResponse Object</a></h1>\n<ul>\n<li><code>error</code> Integer (optional) - When assigned, the <code>request</code> will fail with the <code>error</code> number . For the available error numbers you can use, please see the <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">net error list</a>.</li>\n<li><code>statusCode</code> Number (optional) - The HTTP response code, default is 200.</li>\n<li><code>charset</code> String (optional) - The charset of response body, default is <code>\"utf-8\"</code>.</li>\n<li><code>mimeType</code> String (optional) - The MIME type of response body, default is <code>\"text/html\"</code>. Setting <code>mimeType</code> would implicitly set the <code>content-type</code> header in response, but if <code>content-type</code> is already set in <code>headers</code>, the <code>mimeType</code> would be ignored.</li>\n<li><code>headers</code> Record&#x3C;string, string | string[]> (optional) - An object containing the response headers. The keys must be String, and values must be either String or Array of String.</li>\n<li><code>data</code> (Buffer | String | ReadableStream) (optional) - The response body. When returning stream as response, this is a Node.js readable stream representing the response body. When returning <code>Buffer</code> as response, this is a <code>Buffer</code>. When returning <code>String</code> as response, this is a <code>String</code>. This is ignored for other types of responses.</li>\n<li><code>path</code> String (optional) - Path to the file which would be sent as response body. This is only used for file responses.</li>\n<li><code>url</code> String (optional) - Download the <code>url</code> and pipe the result as response body. This is only used for URL responses.</li>\n<li><code>referrer</code> String (optional) - The <code>referrer</code> URL. This is only used for file and URL responses.</li>\n<li><code>method</code> String (optional) - The HTTP <code>method</code>. This is only used for file and URL responses.</li>\n<li><code>session</code> Session (optional) - The session used for requesting URL, by default the HTTP request will reuse the current session. Setting <code>session</code> to <code>null</code> would use a random independent session. This is only used for URL responses.</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/protocol-response-upload-data\">ProtocolResponseUploadData</a> (optional) - The data used as upload data. This is only used for URL responses when <code>method</code> is <code>\"POST\"</code>.</li>\n</ul>",
      "title": "ProtocolResponse Object",
      "description": ""
    },
    "/docs/api/structures/protocol-response-upload-data": {
      "locale": "pt-BR",
      "slug": "protocol-response-upload-data",
      "href": "/docs/api/structures/protocol-response-upload-data",
      "crowdinFileId": "256489",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-response-upload-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolresponseuploaddata-object\"><a href=\"#protocolresponseuploaddata-object\">ProtocolResponseUploadData Object</a></h1>\n<ul>\n<li><code>contentType</code> String - MIME type of the content.</li>\n<li><code>data</code> String | Buffer - Content to be sent.</li>\n</ul>",
      "title": "ProtocolResponseUploadData Object",
      "description": ""
    },
    "/docs/development/pull-requests": {
      "locale": "pt-BR",
      "slug": "pull-requests",
      "href": "/docs/development/pull-requests",
      "crowdinFileId": "256163",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/pull-requests.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"pull-requests\"><a href=\"#pull-requests\">Pull Requests</a></h1>\n<ul>\n<li><a href=\"#setting-up-your-local-environment\">Setting up your local environment</a><ul>\n<li><a href=\"#step-1-fork\">Step 1: Fork</a></li>\n<li><a href=\"#step-2-build\">Step 2: Build</a></li>\n<li><a href=\"#step-3-branch\">Step 3: Branch</a></li>\n</ul></li>\n<li><a href=\"#making-changes\">Making Changes</a><ul>\n<li><a href=\"#step-4-code\">Step 4: Code</a></li>\n<li><a href=\"#step-5-commit\">Step 5: Commit</a><ul>\n<li><a href=\"#commit-message-guidelines\">Commit message guidelines</a></li>\n</ul></li>\n<li><a href=\"#step-6-rebase\">Step 6: Rebase</a></li>\n<li><a href=\"#step-7-test\">Step 7: Test</a></li>\n<li><a href=\"#step-8-push\">Step 8: Push</a></li>\n<li><a href=\"#step-9-opening-the-pull-request\">Step 9: Opening the Pull Request</a></li>\n<li><a href=\"#step-10-discuss-and-update\">Step 10: Discuss and Update</a><ul>\n<li><a href=\"#approval-and-request-changes-workflow\">Approval and Request Changes Workflow</a></li>\n</ul></li>\n<li><a href=\"#step-11-landing\">Step 11: Landing</a></li>\n<li><a href=\"#continuous-integration-testing\">Continuous Integration Testing</a></li>\n</ul></li>\n</ul>\n<h2 id=\"setting-up-your-local-environment\"><a href=\"#setting-up-your-local-environment\">Setting up your local environment</a></h2>\n<h3 id=\"step-1-fork\"><a href=\"#step-1-fork\">Step 1: Fork</a></h3>\n<p>Fork the project <a href=\"https://github.com/electron/electron\">on GitHub</a> and clone your fork locally.</p>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:username/electron.git\n$ <span class=\"hljs-built_in\">cd</span> electron\n$ git remote add upstream https://github.com/electron/electron.git\n$ git fetch upstream\n</code></pre>\n<h3 id=\"step-2-build\"><a href=\"#step-2-build\">Step 2: Build</a></h3>\n<p>Build steps and dependencies differ slightly depending on your operating system. See these detailed guides on building Electron locally:</p>\n<ul>\n<li><a href=\"/docs/development/build-instructions-macos\">Building on macOS</a></li>\n<li><a href=\"/docs/development/build-instructions-linux\">Building on Linux</a></li>\n<li><a href=\"/docs/development/build-instructions-windows\">Building on Windows</a></li>\n</ul>\n<p>Once you've built the project locally, you're ready to start making changes!</p>\n<h3 id=\"step-3-branch\"><a href=\"#step-3-branch\">Step 3: Branch</a></h3>\n<p>To keep your development environment organized, create local branches to hold your work. These should be branched directly off of the <code>main</code> branch.</p>\n<pre><code class=\"hljs language-sh\">$ git checkout -b my-branch -t upstream/main\n</code></pre>\n<h2 id=\"making-changes\"><a href=\"#making-changes\">Making Changes</a></h2>\n<h3 id=\"step-4-code\"><a href=\"#step-4-code\">Step 4: Code</a></h3>\n<p>Most pull requests opened against the <code>electron/electron</code> repository include changes to either the C/C++ code in the <code>shell/</code> folder, the JavaScript code in the <code>lib/</code> folder, the documentation in <code>docs/api/</code> or tests in the <code>spec/</code> folder.</p>\n<p>Please be sure to run <code>npm run lint</code> from time to time on any code changes to ensure that they follow the project's code style.</p>\n<p>See <a href=\"/docs/development/coding-style\">coding style</a> for more information about best practice when modifying code in different parts of the project.</p>\n<h3 id=\"step-5-commit\"><a href=\"#step-5-commit\">Step 5: Commit</a></h3>\n<p>It is recommended to keep your changes grouped logically within individual commits. Many contributors find it easier to review changes that are split across multiple commits. There is no limit to the number of commits in a pull request.</p>\n<pre><code class=\"hljs language-sh\">$ git add my/changed/files\n$ git commit\n</code></pre>\n<p>Note that multiple commits often get squashed when they are landed.</p>\n<h4 id=\"commit-message-guidelines\"><a href=\"#commit-message-guidelines\">Commit message guidelines</a></h4>\n<p>A good commit message should describe what changed and why. The Electron project uses <a href=\"https://conventionalcommits.org/\">semantic commit messages</a> to streamline the release process.</p>\n<p>Before a pull request can be merged, it <strong>must</strong> have a pull request title with a semantic prefix.</p>\n<p>Examples of commit messages with semantic prefixes:</p>\n<ul>\n<li><code>fix: don't overwrite prevent_default if default wasn't prevented</code></li>\n<li><code>feat: add app.isPackaged() method</code></li>\n<li><code>docs: app.isDefaultProtocolClient is now available on Linux</code></li>\n</ul>\n<p>Common prefixes:</p>\n<ul>\n<li>fix: A bug fix</li>\n<li>feat: A new feature</li>\n<li>docs: Documentation changes</li>\n<li>test: Adding missing tests or correcting existing tests</li>\n<li>build: Changes that affect the build system</li>\n<li>ci: Changes to our CI configuration files and scripts</li>\n<li>perf: A code change that improves performance</li>\n<li>refactor: A code change that neither fixes a bug nor adds a feature</li>\n<li>style: Changes that do not affect the meaning of the code (linting)</li>\n</ul>\n<p>Other things to keep in mind when writing a commit message:</p>\n<ol>\n<li>The first line should:<ul>\n<li>contain a short description of the change (preferably 50 characters or less, and no more than 72 characters)</li>\n<li>be entirely in lowercase with the exception of proper nouns, acronyms, and the words that refer to code, like function/variable names</li>\n</ul></li>\n<li>Keep the second line blank.</li>\n<li>Wrap all other lines at 72 columns.</li>\n</ol>\n<h4 id=\"breaking-changes\"><a href=\"#breaking-changes\">Breaking Changes</a></h4>\n<p>A commit that has the text <code>BREAKING CHANGE:</code> at the beginning of its optional body or footer section introduces a breaking API change (correlating with Major in semantic versioning). A breaking change can be part of commits of any type. e.g., a <code>fix:</code>, <code>feat:</code> &#x26; <code>chore:</code> types would all be valid, in addition to any other type.</p>\n<p>See <a href=\"https://conventionalcommits.org\">conventionalcommits.org</a> for more details.</p>\n<h3 id=\"step-6-rebase\"><a href=\"#step-6-rebase\">Step 6: Rebase</a></h3>\n<p>Once you have committed your changes, it is a good idea to use <code>git rebase</code> (not <code>git merge</code>) to synchronize your work with the main repository.</p>\n<pre><code class=\"hljs language-sh\">$ git fetch upstream\n$ git rebase upstream/main\n</code></pre>\n<p>This ensures that your working branch has the latest changes from <code>electron/electron</code> main.</p>\n<h3 id=\"step-7-test\"><a href=\"#step-7-test\">Step 7: Test</a></h3>\n<p>Bug fixes and features should always come with tests. A <a href=\"/docs/development/testing\">testing guide</a> has been provided to make the process easier. Looking at other tests to see how they should be structured can also help.</p>\n<p>Before submitting your changes in a pull request, always run the full test suite. To run the tests:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>Make sure the linter does not report any issues and that all tests pass. Please do not submit patches that fail either check.</p>\n<p>If you are updating tests and want to run a single spec to check it:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span> -match=menu\n</code></pre>\n<p>The above would only run spec modules matching <code>menu</code>, which is useful for anyone who's working on tests that would otherwise be at the very end of the testing cycle.</p>\n<h3 id=\"step-8-push\"><a href=\"#step-8-push\">Step 8: Push</a></h3>\n<p>Once your commits are ready to go -- with passing tests and linting -- begin the process of opening a pull request by pushing your working branch to your fork on GitHub.</p>\n<pre><code class=\"hljs language-sh\">$ git push origin my-branch\n</code></pre>\n<h3 id=\"step-9-opening-the-pull-request\"><a href=\"#step-9-opening-the-pull-request\">Step 9: Opening the Pull Request</a></h3>\n<p>From within GitHub, opening a new pull request will present you with a template that should be filled out:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"xml\"><span class=\"hljs-comment\">&#x3C;!--\nThank you for your pull request. Please provide a description above and review\nthe requirements below.\n\nBug fixes and new features should include tests and possibly benchmarks.\n\nContributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.md\n--></span></span>\n</code></pre>\n<h3 id=\"step-10-discuss-and-update\"><a href=\"#step-10-discuss-and-update\">Step 10: Discuss and update</a></h3>\n<p>You will probably get feedback or requests for changes to your pull request. This is a big part of the submission process so don't be discouraged! Some contributors may sign off on the pull request right away. Others may have detailed comments or feedback. This is a necessary part of the process in order to evaluate whether the changes are correct and necessary.</p>\n<p>To make changes to an existing pull request, make the changes to your local branch, add a new commit with those changes, and push those to your fork. GitHub will automatically update the pull request.</p>\n<pre><code class=\"hljs language-sh\">$ git add my/changed/files\n$ git commit\n$ git push origin my-branch\n</code></pre>\n<p>There are a number of more advanced mechanisms for managing commits using <code>git rebase</code> that can be used, but are beyond the scope of this guide.</p>\n<p>Feel free to post a comment in the pull request to ping reviewers if you are awaiting an answer on something. If you encounter words or acronyms that seem unfamiliar, refer to this <a href=\"https://sites.google.com/a/chromium.org/dev/glossary\">glossary</a>.</p>\n<h4 id=\"approval-and-request-changes-workflow\"><a href=\"#approval-and-request-changes-workflow\">Approval and Request Changes Workflow</a></h4>\n<p>All pull requests require approval from a <a href=\"https://github.com/electron/electron/blob/main/.github/CODEOWNERS\">Code Owner</a> of the area you modified in order to land. Whenever a maintainer reviews a pull request they may request changes. These may be small, such as fixing a typo, or may involve substantive changes. Such requests are intended to be helpful, but at times may come across as abrupt or unhelpful, especially if they do not include concrete suggestions on <em>how</em> to change them.</p>\n<p>Try not to be discouraged. If you feel that a review is unfair, say so or seek the input of another project contributor. Often such comments are the result of a reviewer having taken insufficient time to review and are not ill-intended. Such difficulties can often be resolved with a bit of patience. That said, reviewers should be expected to provide helpful feedback.</p>\n<h3 id=\"step-11-landing\"><a href=\"#step-11-landing\">Step 11: Landing</a></h3>\n<p>In order to land, a pull request needs to be reviewed and approved by at least one Electron Code Owner and pass CI. After that, if there are no objections from other contributors, the pull request can be merged.</p>\n<p>Congratulations and thanks for your contribution!</p>\n<h3 id=\"continuous-integration-testing\"><a href=\"#continuous-integration-testing\">Continuous Integration Testing</a></h3>\n<p>Every pull request is tested on the Continuous Integration (CI) system to confirm that it works on Electron's supported platforms.</p>\n<p>Ideally, the pull request will pass (\"be green\") on all of CI's platforms. This means that all tests pass and there are no linting errors. However, it is not uncommon for the CI infrastructure itself to fail on specific platforms or for so-called \"flaky\" tests to fail (\"be red\"). Each CI failure must be manually inspected to determine the cause.</p>\n<p>CI starts automatically when you open a pull request, but only core maintainers can restart a CI run. If you believe CI is giving a false negative, ask a maintainer to restart the tests.</p>",
      "title": "Pull Requests",
      "description": ""
    },
    "/docs/tutorial/quick-start": {
      "locale": "pt-BR",
      "slug": "quick-start",
      "href": "/docs/tutorial/quick-start",
      "crowdinFileId": "256237",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/quick-start.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"início-rápido\"><a href=\"#início-rápido\">Início Rápido</a></h1>\n<p>Este guia guiará você através do processo de criação de um aplicativo barebones Hello World no Electron, similar a <a href=\"https://github.com/electron/electron-quick-start\"><code>electron/electron-quick-start</code></a>.</p>\n<p>Ao final deste tutorial, sua aplicação abrirá uma janela do navegador que exibe uma página com informações sobre qual Chromium, Node.js, e versões do Electron estão sendo executadas.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<p>Para usar o Electron, você precisa instalar o <a href=\"https://nodejs.org/en/download/\">Node.js</a>. Recomendamos que você use a versão mais recente disponível do <code>LTS</code>.</p>\n<blockquote>\n<p>Por favor, instale o Node.js usando instaladores específicos para sua plataforma. Caso contrário, você pode encontrar problemas de incompatibilidade com ferramentas de desenvolvimento diferentes.</p>\n</blockquote>\n<p>Para verificar se o Node.js foi instalado corretamente, digite os seguintes comandos em seu terminal de comando:</p>\n<pre><code class=\"hljs language-sh\">node -v\nnpm -v\n</code></pre>\n<p>Os comandos devem imprimir as versões do Node.js e npm, respectivamente.</p>\n<p><strong> Observação: </strong> como o Electron incorpora Node.js em seu binário, a versão do Node.js em execução seu código não está relacionado à versão em execução em seu sistema.</p>\n<h2 id=\"crie-seu-aplicativo\"><a href=\"#crie-seu-aplicativo\">Crie seu aplicativo</a></h2>\n<h3 id=\"scaffold-the-project\"><a href=\"#scaffold-the-project\">Scaffold the project</a></h3>\n<p>Aplicativos Electron seguem a mesma estrutura geral que outros projetos Node.js. Comece criando uma pasta e inicializando um pacote npm.</p>\n<pre><code class=\"hljs language-sh\">mkdir my-electron-app &#x26;&#x26; <span class=\"hljs-built_in\">cd</span> my-electron-app\nnpm init\n</code></pre>\n<p>O comando interativo <code>init</code> solicitará que você defina alguns campos em sua configuração. Existem algumas regras a seguir para os propósitos deste tutorial:</p>\n<ul>\n<li><code>entry point</code> deve ser <code>main.js</code>.</li>\n<li><code>author</code> e <code>description</code> podem ser de qualquer valor, mas são necessários para o <a href=\"#package-and-distribute-your-application\">pacote do aplicativos</a>.</li>\n</ul>\n<p>Seu arquivo <code>package.json</code> deve ser parecido com isto:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"my-electron-app\"</span>,\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"1.0.0\"</span>,\n  <span class=\"hljs-attr\">\"description\"</span>: <span class=\"hljs-string\">\"Hello World!\"</span>,\n  <span class=\"hljs-attr\">\"main\"</span>: <span class=\"hljs-string\">\"main.js\"</span>,\n  <span class=\"hljs-attr\">\"author\"</span>: <span class=\"hljs-string\">\"Jane Doe\"</span>,\n  <span class=\"hljs-attr\">\"license\"</span>: <span class=\"hljs-string\">\"MIT\"</span>\n}\n</code></pre>\n<p>Em seguida, instale o pacote <code>electron</code> nas <code>devDependencies</code> do seu aplicativo.</p>\n<pre><code class=\"hljs language-sh\">$ npm install --save-dev electron\n</code></pre>\n<blockquote>\n<p>Nota: Se você estiver encontrando algum problema com a instalação do Electron, por favor consulte o guia de <a href=\"/docs/tutorial/installation\">Instalação avançada</a>.</p>\n</blockquote>\n<p>Finalmente, você deve ser capaz de executar o Electron. No campo <a href=\"https://docs.npmjs.com/cli/v7/using-npm/scripts\"><code>scripts</code></a> de sua <code>package.json</code> config, adicione um comando <code>start</code> assim:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"scripts\"</span>: {\n    <span class=\"hljs-attr\">\"start\"</span>: <span class=\"hljs-string\">\"electron .\"</span>\n  }\n}\n</code></pre>\n<p>Este comando <code>start</code> permitirá que você abra seu aplicativo em modo de desenvolvimento.</p>\n<pre><code class=\"hljs language-sh\">npm start\n</code></pre>\n<blockquote>\n<p>Nota: Este script diz ao Electron para ser executado na pasta raiz do seu projeto. Neste estágio, o seu aplicativo lançará imediatamente um erro informando que ele não consegue encontrar um aplicativo para executar.</p>\n</blockquote>\n<h3 id=\"execute-o-processo-principal\"><a href=\"#execute-o-processo-principal\">Execute o processo principal</a></h3>\n<p>O ponto de entrada de qualquer aplicação Electron é o script <code>main</code>. Este script controla o <strong>processo principal</strong>, que é executado em um ambiente Node.js completo e é responsável por controlar o ciclo de vida de seu aplicativo, exibindo interfaces nativas, realizando todas as operações necessárias e gerenciando os processos de renderização (mais sobre isso mais tarde).</p>\n<p>During execution, Electron will look for this script in the <a href=\"https://docs.npmjs.com/cli/v7/configuring-npm/package-json#main\"><code>main</code></a> field of the app's <code>package.json</code> config, which you should have configured during the <a href=\"#scaffold-the-project\">app scaffolding</a> step.</p>\n<p>Para inicializar o script <code>main</code>, crie um arquivo vazio com o nome <code>main.js</code> na pasta raíz do seu projeto.</p>\n<blockquote>\n<p>Nota: Se você executar o script <code>start</code> novamente neste ponto, sua aplicação não irá lançar qualquer erro! Entretanto, ela não fará nada, visto que não adicionamos nenhum código no arquivo <code>main.js</code>.</p>\n</blockquote>\n<h3 id=\"crie-uma-página-web\"><a href=\"#crie-uma-página-web\">Crie uma página web</a></h3>\n<p>Antes de criarmos uma janela para a nossa aplicação, precisamos criar o conteúdo que será carregado dentro dela. No Electron, cada janela exibe um conteúdo web, que pode ser carregado de um arquivo HTML local ou de um URL remoto.</p>\n<p>Para este tutorial, você fará a página html primeiro. Crie um arquivo <code>index.html</code> na pasta raíz do seu projeto:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-comment\">&#x3C;!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"X-Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    Estamos utilizando Node.js <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"node-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    Chromium <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"chrome-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    e Electron <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"electron-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>.\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<blockquote>\n<p>Nota: Olhando para este documento HTML, você pode observar que os números das versões estão faltando dentro do texto. Nós vamos inserir manualmente mais tarde, utilizando JavaScript.</p>\n</blockquote>\n<h3 id=\"abrindo-sua-página-web-em-uma-janela-do-navegador\"><a href=\"#abrindo-sua-página-web-em-uma-janela-do-navegador\">Abrindo sua página web em uma janela do navegador</a></h3>\n<p>Agora que você já tem uma página web, carregue-a na janela do aplicativo. Para fazer isso, você precisa de dois módulos do Electron:</p>\n<ul>\n<li>O módulo <a href=\"/docs/api/app\"><code>app</code></a>, que controla os eventos do ciclo de vida de sua aplicação.</li>\n<li>O módulo <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>, que cria e gerencia as janelas da sua aplicação.</li>\n</ul>\n<p>Pelo fato do processo principal ser executado em Node.js, você pode importá-los como módulos <a href=\"https://nodejs.org/docs/latest/api/modules.html#modules_modules_commonjs_modules\">CommonJS</a> no topo de seu arquivo:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>Então, adicione a função <code>createWindow()</code> que carregará o arquivo <code>index.html</code> em uma nova instância do <code>BrowserWindow</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n</code></pre>\n<p>O próximo passo é chamar a função <code>createWindow()</code> que abrirá a janela.</p>\n<p>No Electron, janelas do navegador só podem ser criadas após o módulo <code>app</code> disparar o evento <a href=\"/docs/api/app#event-ready\"><code>ready</code></a>. Você pode esperar por este evento utilizando a API <a href=\"/docs/api/app#appwhenready\"><code>app.whenReady()</code></a>. Chame a função <code>createWindow()</code> após <code>whenReady()</code> resolver a Promise.</p>\n<pre><code class=\"hljs language-js\">app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n})\n</code></pre>\n<blockquote>\n<p>Nota: Neste ponto do tutorial, sua aplicação Electron deve abrir uma janela que mostra o conteúdo de sua página web!</p>\n</blockquote>\n<h3 id=\"gerencie-o-ciclo-de-vida-de-sua-janela\"><a href=\"#gerencie-o-ciclo-de-vida-de-sua-janela\">Gerencie o ciclo de vida de sua janela</a></h3>\n<p>Although you can now open a browser window, you'll need some additional boilerplate code to make it feel more native to each platform. Application windows behave differently on each OS, and Electron puts the responsibility on developers to implement these conventions in their app.</p>\n<p>In general, you can use the <code>process</code> global's <a href=\"https://nodejs.org/api/process.html#process_process_platform\"><code>platform</code></a> attribute to run code specifically for certain operating systems.</p>\n<h4 id=\"encerrar-a-aplicação-quando-todas-as-janelas-estiverem-fechadas-windows-e-linux\"><a href=\"#encerrar-a-aplicação-quando-todas-as-janelas-estiverem-fechadas-windows-e-linux\">Encerrar a aplicação quando todas as janelas estiverem fechadas (Windows e Linux)</a></h4>\n<p>No Windows e no Linux, fechar todas as janelas geralmente encerra totalmente a aplicação.</p>\n<p>To implement this, listen for the <code>app</code> module's <a href=\"/docs/api/app#event-window-all-closed\"><code>'window-all-closed'</code></a> event, and call <a href=\"/docs/api/app#appquit\"><code>app.quit()</code></a> if the user is not on macOS (<code>darwin</code>).</p>\n<pre><code class=\"hljs language-js\">app.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h4 id=\"open-a-window-if-none-are-open-macos\"><a href=\"#open-a-window-if-none-are-open-macos\">Open a window if none are open (macOS)</a></h4>\n<p>Whereas Linux and Windows apps quit when they have no windows open, macOS apps generally continue running even without any windows open, and activating the app when no windows are available should open a new one.</p>\n<p>To implement this feature, listen for the <code>app</code> module's <a href=\"/docs/api/app#event-activate-macos\"><code>activate</code></a> event, and call your existing <code>createWindow()</code> method if no browser windows are open.</p>\n<p>Because windows cannot be created before the <code>ready</code> event, you should only listen for <code>activate</code> events after your app is initialized. Do this by attaching your event listener from within your existing <code>whenReady()</code> callback.</p>\n<pre><code class=\"hljs language-js\">app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) createWindow()\n  })\n})\n</code></pre>\n<blockquote>\n<p>Note: At this point, your window controls should be fully functional!</p>\n</blockquote>\n<h3 id=\"access-nodejs-from-the-renderer-with-a-preload-script\"><a href=\"#access-nodejs-from-the-renderer-with-a-preload-script\">Access Node.js from the renderer with a preload script</a></h3>\n<p>Now, the last thing to do is print out the version numbers for Electron and its dependencies onto your web page.</p>\n<p>Accessing this information is trivial to do in the main process through Node's global <code>process</code> object. However, you can't just edit the DOM from the main process because it has no access to the renderer's <code>document</code> context. They're in entirely different processes!</p>\n<blockquote>\n<p>Note: If you need a more in-depth look at Electron processes, see the <a href=\"/docs/tutorial/process-model\">Process Model</a> document.</p>\n</blockquote>\n<p>This is where attaching a <strong>preload</strong> script to your renderer comes in handy. A preload script runs before the renderer process is loaded, and has access to both renderer globals (e.g. <code>window</code> and <code>document</code>) and a Node.js environment.</p>\n<p>Create a new script named <code>preload.js</code> as such:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'DOMContentLoaded'</span>, () => {\n  <span class=\"hljs-keyword\">const</span> replaceText = <span class=\"hljs-function\">(<span class=\"hljs-params\">selector, text</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> element = <span class=\"hljs-built_in\">document</span>.getElementById(selector)\n    <span class=\"hljs-keyword\">if</span> (element) element.innerText = text\n  }\n\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> dependency <span class=\"hljs-keyword\">of</span> [<span class=\"hljs-string\">'chrome'</span>, <span class=\"hljs-string\">'node'</span>, <span class=\"hljs-string\">'electron'</span>]) {\n    replaceText(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${dependency}</span>-version`</span>, process.versions[dependency])\n  }\n})\n</code></pre>\n<p>The above code accesses the Node.js <code>process.versions</code> object and runs a basic <code>replaceText</code> helper function to insert the version numbers into the HTML document.</p>\n<p>To attach this script to your renderer process, pass in the path to your preload script to the <code>webPreferences.preload</code> option in your existing <code>BrowserWindow</code> constructor.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// include the Node.js 'path' module at the top of your file</span>\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-comment\">// modify your existing createWindow() function</span>\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n<span class=\"hljs-comment\">// ...</span>\n</code></pre>\n<p>There are two Node.js concepts that are used here:</p>\n<ul>\n<li>The <a href=\"https://nodejs.org/api/modules.html#modules_dirname\"><code>__dirname</code></a> string points to the path of the currently executing script (in this case, your project's root folder).</li>\n<li>The <a href=\"https://nodejs.org/api/path.html#path_path_join_paths\"><code>path.join</code></a> API joins multiple path segments together, creating a combined path string that works across all platforms.</li>\n</ul>\n<p>We use a path relative to the currently executing JavaScript file so that your relative path will work in both development and packaged mode.</p>\n<h3 id=\"bonus-add-functionality-to-your-web-contents\"><a href=\"#bonus-add-functionality-to-your-web-contents\">Bonus: Add functionality to your web contents</a></h3>\n<p>At this point, you might be wondering how to add more functionality to your application.</p>\n<p>For any interactions with your web contents, you want to add scripts to your renderer process. Because the renderer runs in a normal web environment, you can add a <code>&#x3C;script></code> tag right before your <code>index.html</code> file's closing <code>&#x3C;/body></code> tag to include any arbitrary scripts you want:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"./renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<p>The code contained in <code>renderer.js</code> can then use the same JavaScript APIs and tooling you use for typical front-end development, such as using <a href=\"https://webpack.js.org\"><code>webpack</code></a> to bundle and minify your code or <a href=\"https://reactjs.org\">React</a> to manage your user interfaces.</p>\n<h3 id=\"recap\"><a href=\"#recap\">Recap</a></h3>\n<p>After following the above steps, you should have a fully functional Electron application that looks like this:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/simplest-electron-app.png\" alt=\"Simplest Electron app\"></p>\n<!--TODO(erickzhao): Remove the individual code blocks for static website -->\n<p>The full code is available below:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\n\n<span class=\"hljs-comment\">// Modules to control application life and create native browser window</span>\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-comment\">// Create the browser window.</span>\n  <span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  <span class=\"hljs-comment\">// and load the index.html of the app.</span>\n  mainWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-comment\">// Open the DevTools.</span>\n  <span class=\"hljs-comment\">// mainWindow.webContents.openDevTools()</span>\n}\n\n<span class=\"hljs-comment\">// This method will be called when Electron has finished</span>\n<span class=\"hljs-comment\">// initialization and is ready to create browser windows.</span>\n<span class=\"hljs-comment\">// Algumas APIs podem ser usadas somente depois que este evento ocorre.</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n    <span class=\"hljs-comment\">// On macOS it's common to re-create a window in the app when the</span>\n    <span class=\"hljs-comment\">// dock icon is clicked and there are no other windows open.</span>\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) createWindow()\n  })\n})\n\n<span class=\"hljs-comment\">// Quit when all windows are closed, except on macOS. There, it's common</span>\n<span class=\"hljs-comment\">// for applications and their menu bar to stay active until the user quits</span>\n<span class=\"hljs-comment\">// explicitly with Cmd + Q.</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n\n<span class=\"hljs-comment\">// In this file you can include the rest of your app's specific main process</span>\n<span class=\"hljs-comment\">// code. Você também pode colocar eles em arquivos separados e requeridos-as aqui.</span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// preload.js</span>\n\n<span class=\"hljs-comment\">// All of the Node.js APIs are available in the preload process.</span>\n<span class=\"hljs-comment\">// It has the same sandbox as a Chrome extension.</span>\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'DOMContentLoaded'</span>, () => {\n  <span class=\"hljs-keyword\">const</span> replaceText = <span class=\"hljs-function\">(<span class=\"hljs-params\">selector, text</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> element = <span class=\"hljs-built_in\">document</span>.getElementById(selector)\n    <span class=\"hljs-keyword\">if</span> (element) element.innerText = text\n  }\n\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> dependency <span class=\"hljs-keyword\">of</span> [<span class=\"hljs-string\">'chrome'</span>, <span class=\"hljs-string\">'node'</span>, <span class=\"hljs-string\">'electron'</span>]) {\n    replaceText(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${dependency}</span>-version`</span>, process.versions[dependency])\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!--index.html--></span>\n\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-comment\">&#x3C;!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"X-Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    We are using Node.js <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"node-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    Chromium <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"chrome-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    and Electron <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"electron-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>.\n\n    <span class=\"hljs-comment\">&#x3C;!-- You can also require other files to run in this process --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"./renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>To summarize all the steps we've done:</p>\n<ul>\n<li>\n<p>We bootstrapped a Node.js application and added Electron as a dependency.</p>\n</li>\n<li>\n<p>We created a <code>main.js</code> script that runs our main process, which controls our app\nand runs in a Node.js environment. In this script, we used Electron's <code>app</code> and\n<code>BrowserWindow</code> modules to create a browser window that displays web content\nin a separate process (the renderer).</p>\n</li>\n<li>\n<p>In order to access certain Node.js functionality in the renderer, we attached\na preload script to our <code>BrowserWindow</code> constructor.</p>\n</li>\n</ul>\n<h2 id=\"package-and-distribute-your-application\"><a href=\"#package-and-distribute-your-application\">Package and distribute your application</a></h2>\n<p>The fastest way to distribute your newly created app is using\n<a href=\"https://www.electronforge.io\">Electron Forge</a>.</p>\n<ol>\n<li>\n<p>Add Electron Forge as a development dependency of your app, and use its <code>import</code> command to set up\nForge's scaffolding:</p>\n<pre><code class=\"hljs language-routeros\">```sh npm2yarn\nnpm install --save-dev @electron-forge/cli\nnpx electron-forge import\n\n✔ Checking your<span class=\"hljs-built_in\"> system\n</span>✔ Initializing Git Repository\n✔ Writing modified package.json file\n✔ Installing dependencies\n✔ Writing modified package.json file\n✔ Fixing .gitignore\n\nWe have ATTEMPTED <span class=\"hljs-keyword\">to</span> convert your app <span class=\"hljs-keyword\">to</span> be <span class=\"hljs-keyword\">in</span> a format that electron-forge understands.\n\nThanks <span class=\"hljs-keyword\">for</span> using <span class=\"hljs-string\">\"electron-forge\"</span>!!!\n```\n</code></pre>\n</li>\n<li>\n<p>Create a distributable using Forge's <code>make</code> command:</p>\n<pre><code class=\"hljs language-sh\">npm run make\n\n> my-electron-app@1.0.0 make /my-electron-app\n> electron-forge make\n\n✔ Checking your system\n✔ Resolving Forge Config\nWe need to package your application before we can make it\n✔ Preparing to Package Application <span class=\"hljs-keyword\">for</span> arch: x64\n✔ Preparing native dependencies\n✔ Packaging Application\nMaking <span class=\"hljs-keyword\">for</span> the following targets: zip\n✔ Making <span class=\"hljs-keyword\">for</span> target: zip - On platform: darwin - For arch: x64\n</code></pre>\n<p>Electron Forge creates the <code>out</code> folder where your package will be located:</p>\n<pre><code class=\"hljs language-plain\">// Example for macOS\nout/\n├── out/make/zip/darwin/x64/my-electron-app-darwin-x64-1.0.0.zip\n├── ...\n└── out/my-electron-app-darwin-x64/my-electron-app.app/Contents/MacOS/my-electron-app\n</code></pre>\n</li>\n</ol>",
      "title": "Início Rápido",
      "description": "Por favor, instale o Node.js usando instaladores específicos para sua plataforma. Caso contrário, você pode encontrar problemas de incompatibilidade com ferramentas de desenvolvimento diferentes."
    },
    "/docs/README": {
      "locale": "pt-BR",
      "slug": "README",
      "href": "/docs/README",
      "crowdinFileId": "256115",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/README.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"guia-oficial\"><a href=\"#guia-oficial\">Guia Oficial</a></h1>\n<p>Certifique-se de usar a documentação correspondente a versão do Electron que você esta usando. A versão faz parte da URL desta página. Se não, você provavelmente esta usando a documentação da branch de desenvolvimento qual pode conter mudanças da API que pode não ser compatível com a sua versão do Electron. Para ver a documentação de versões anteriores, você pode <a href=\"https://github.com/electron/electron/tree/v1.4.0\">procurar pelas tags</a> no GitHub, para isso, abra o menu \"Switch branches/tags\" e selecione a tag da versão que você gostaria de ver.</p>\n<h2 id=\"perguntas-frequentes\"><a href=\"#perguntas-frequentes\">Perguntas Frequentes</a></h2>\n<p>There are questions that are asked quite often. Check this out before creating an issue:</p>\n<ul>\n<li><a href=\"/docs/faq\">Perguntas Frequentes no Electron</a></li>\n</ul>\n<h2 id=\"guias-e-tutoriais\"><a href=\"#guias-e-tutoriais\">Guias e Tutoriais</a></h2>\n<h3 id=\"guia-de-introdução\"><a href=\"#guia-de-introdução\">Guia de Introdução</a></h3>\n<ul>\n<li><a href=\"/docs/tutorial/introduction\">Introdução</a></li>\n<li><a href=\"/docs/tutorial/quick-start\">Início Rápido</a></li>\n<li><a href=\"/docs/tutorial/process-model\">Modelos de Processo</a></li>\n</ul>\n<h3 id=\"learning-the-basics\"><a href=\"#learning-the-basics\">Learning the basics</a></h3>\n<ul>\n<li>Adicionando Recursos para Seu Aplicativo<ul>\n<li><a href=\"/docs/tutorial/notifications\">Notificações</a></li>\n<li><a href=\"/docs/tutorial/recent-documents\">Documentos Recentes</a></li>\n<li><a href=\"/docs/tutorial/progress-bar\">Progresso do Aplicativo</a></li>\n<li><a href=\"/docs/tutorial/macos-dock\">Menu Dock Personalizado</a></li>\n<li><a href=\"/docs/tutorial/windows-taskbar\">Barra de Tarefas do Windows Personalizado</a></li>\n<li><a href=\"/docs/tutorial/linux-desktop-actions\">Ações Desktop Linux Personalizado</a></li>\n<li><a href=\"/docs/tutorial/keyboard-shortcuts\">Atalhos do Teclado</a></li>\n<li><a href=\"/docs/tutorial/online-offline-events\">Detecção de Offline/Online</a></li>\n<li><a href=\"/docs/tutorial/represented-file\">Arquivo Representado para o macOS BrowserWindows</a></li>\n<li><a href=\"/docs/tutorial/native-file-drag-drop\">Nativo Arquivo Drag &#x26; Drop</a></li>\n<li><a href=\"/docs/tutorial/offscreen-rendering\">Renderização fora da tela</a></li>\n<li><a href=\"/docs/tutorial/dark-mode\">Modo escuro</a></li>\n<li><a href=\"/docs/tutorial/web-embeds\">Incluir conteúdos Web no Electron</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis\">Boilerplates e CLIs</a><ul>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#boilerplate-vs-cli\">Boilerplate vs CLI</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-forge\">electron-forge</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-builder\">electron-builder</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-react-boilerplate\">electron-react-boilerplate</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#other-tools-and-boilerplates\">Outras Ferramentas e Boilerplates</a></li>\n</ul></li>\n</ul>\n<h3 id=\"advanced-steps\"><a href=\"#advanced-steps\">Advanced steps</a></h3>\n<ul>\n<li>Arquitetura do Aplicativo<ul>\n<li><a href=\"/docs/tutorial/using-native-node-modules\">Usando Módulos Nativos do Node.js</a></li>\n<li><a href=\"/docs/tutorial/performance\">Estratégias de Performance</a></li>\n<li><a href=\"/docs/tutorial/security\">Security Strategies</a></li>\n<li><a href=\"/docs/tutorial/sandbox\">Process Sandboxing</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/accessibility\">Acessibilidade</a><ul>\n<li><a href=\"/docs/tutorial/accessibility#manually-enabling-accessibility-features\">Manually Enabling Accessibility Features</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/application-debugging\">Teste e Depuração</a><ul>\n<li><a href=\"/docs/tutorial/debugging-main-process\">O Processo Principal de Depuração</a></li>\n<li><a href=\"/docs/tutorial/debugging-vscode\">Debugging with Visual Studio Code</a></li>\n<li><a href=\"/docs/tutorial/using-selenium-and-webdriver\">Usando Selenium e WebDriver</a></li>\n<li><a href=\"/docs/tutorial/testing-on-headless-ci\">Testando em sistemas de CI (Travis, Jenkins)</a></li>\n<li><a href=\"/docs/tutorial/devtools-extension\">Extensão de DevTools</a></li>\n<li><a href=\"/docs/tutorial/automated-testing-with-a-custom-driver\">Automatizando Teste com Driver Personalizado</a></li>\n<li><a href=\"/docs/tutorial/repl\">REPL</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/application-distribution\">Distribuição</a><ul>\n<li><a href=\"/docs/tutorial/support#supported-platforms\">Plataformas Suportadas</a></li>\n<li><a href=\"/docs/tutorial/code-signing\">Assinando Código</a></li>\n<li><a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store</a></li>\n<li><a href=\"/docs/tutorial/windows-store-guide\">Windows Store</a></li>\n<li><a href=\"/docs/tutorial/snapcraft\">Snapcraft</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/updates\">Atualizações</a><ul>\n<li><a href=\"/docs/tutorial/updates#deploying-an-update-server\">Implementando um Servidor de Atualizações</a></li>\n<li><a href=\"/docs/tutorial/updates#implementing-updates-in-your-app\">Implementando Atualizações em Seu App</a></li>\n<li><a href=\"/docs/tutorial/updates#applying-updates\">Aplicando Atualizações</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/support\">Recebendo suporte</a></li>\n</ul>\n<h2 id=\"tutoriais-detalhados\"><a href=\"#tutoriais-detalhados\">Tutoriais Detalhados</a></h2>\n<p>Esses tutoriais individuais explicam os tópicos discutidos no guia acima.</p>\n<ul>\n<li><a href=\"/docs/tutorial/installation\">Instalando o Electron</a><ul>\n<li><a href=\"/docs/tutorial/installation#proxies\">Proxies</a></li>\n<li><a href=\"/docs/tutorial/installation#custom-mirrors-and-caches\">Mirrors e Caches Customizados</a></li>\n<li><a href=\"/docs/tutorial/installation#troubleshooting\">Solução de Problemas</a></li>\n</ul></li>\n<li>Electron Releases &#x26; Developer Feedback<ul>\n<li><a href=\"/docs/tutorial/electron-versioning\">Politica de versão</a></li>\n<li><a href=\"/docs/tutorial/electron-timelines\">Linha do Tempo de Lançamentos</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/testing-widevine-cdm\">Testando Widevine CCDM</a></li>\n</ul>\n<hr>\n<ul>\n<li><a href=\"/docs/glossary\">Glossário de Termos</a></li>\n</ul>\n<h2 id=\"referências-da-api\"><a href=\"#referências-da-api\">Referências da API</a></h2>\n<ul>\n<li><a href=\"/docs/api/synopsis\">Sinopse</a></li>\n<li><a href=\"/docs/api/process\">Processamento de Objeto</a></li>\n<li><a href=\"/docs/api/command-line-switches\">Switches de Linha de Comando Suportadas</a></li>\n<li><a href=\"/docs/api/environment-variables\">Variáveis de Ambiente</a></li>\n<li><a href=\"/docs/api/extensions\">Suporte para extensões do Chrome</a></li>\n<li><a href=\"/docs/breaking-changes\">Grandes Alterações na API</a></li>\n</ul>\n<h3 id=\"elementos-de-dom-personalizado\"><a href=\"#elementos-de-dom-personalizado\">Elementos de DOM Personalizado:</a></h3>\n<ul>\n<li><a href=\"/docs/api/file-object\"><code>File</code> Object</a></li>\n<li><a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code> Tag</a></li>\n<li><a href=\"/docs/api/window-open\"><code>window.open</code> Função</a></li>\n<li><a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code> Object</a></li>\n</ul>\n<h3 id=\"módulos-para-o-processo-principal\"><a href=\"#módulos-para-o-processo-principal\">Módulos para o Processo Principal:</a></h3>\n<ul>\n<li><a href=\"/docs/api/app\">app</a></li>\n<li><a href=\"/docs/api/auto-updater\">autoUpdater</a></li>\n<li><a href=\"/docs/api/browser-view\">BrowserView</a></li>\n<li><a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n<li><a href=\"/docs/api/content-tracing\">contentTracing</a></li>\n<li><a href=\"/docs/api/dialog\">dialog</a></li>\n<li><a href=\"/docs/api/global-shortcut\">globalShortcut</a></li>\n<li><a href=\"/docs/api/in-app-purchase\">inAppPurchase</a></li>\n<li><a href=\"/docs/api/ipc-main\">ipcMain</a></li>\n<li><a href=\"/docs/api/menu\">Menu</a></li>\n<li><a href=\"/docs/api/menu-item\">MenuItem</a></li>\n<li><a href=\"/docs/api/message-channel-main\">MessageChannelMain</a></li>\n<li><a href=\"/docs/api/message-port-main\">MessagePortMain</a></li>\n<li><a href=\"/docs/api/net\">net</a></li>\n<li><a href=\"/docs/api/net-log\">netLog</a></li>\n<li><a href=\"/docs/api/native-theme\">nativeTheme</a></li>\n<li><a href=\"/docs/api/notification\">Notificação</a></li>\n<li><a href=\"/docs/api/power-monitor\">powerMonitor</a></li>\n<li><a href=\"/docs/api/power-save-blocker\">powerSaveBlocker</a></li>\n<li><a href=\"/docs/api/protocol\">protocol</a></li>\n<li><a href=\"/docs/api/screen\">screen</a></li>\n<li><a href=\"/docs/api/session\">session</a></li>\n<li><a href=\"/docs/api/share-menu\">ShareMenu</a></li>\n<li><a href=\"/docs/api/system-preferences\">systemPreferences</a></li>\n<li><a href=\"/docs/api/touch-bar\">TouchBar</a></li>\n<li><a href=\"/docs/api/tray\">Tray</a></li>\n<li><a href=\"/docs/api/web-contents\">webContents</a></li>\n<li><a href=\"/docs/api/web-frame-main\">webFrameMain</a></li>\n</ul>\n<h3 id=\"módulos-para-o-processo-de-renderização-página-web\"><a href=\"#módulos-para-o-processo-de-renderização-página-web\">Módulos para o Processo de Renderização (Página Web):</a></h3>\n<ul>\n<li><a href=\"/docs/api/context-bridge\">contextBridge</a></li>\n<li><a href=\"/docs/api/ipc-renderer\">ipcRenderer</a></li>\n<li><a href=\"/docs/api/web-frame\">webFrame</a></li>\n</ul>\n<h3 id=\"módulos-para-ambos-os-processos\"><a href=\"#módulos-para-ambos-os-processos\">Módulos para Ambos os Processos:</a></h3>\n<ul>\n<li><a href=\"/docs/api/clipboard\">clipboard</a></li>\n<li><a href=\"/docs/api/crash-reporter\">crashReporter</a></li>\n<li><a href=\"/docs/api/desktop-capturer\">desktopCapturer</a></li>\n<li><a href=\"/docs/api/native-image\">nativeImage</a></li>\n<li><a href=\"/docs/api/shell\">shell</a></li>\n</ul>\n<h2 id=\"desenvolvimento\"><a href=\"#desenvolvimento\">Desenvolvimento</a></h2>\n<p>Veja <a href=\"/docs/development/README\">development/README.md</a></p>",
      "title": "Guia Oficial",
      "description": ""
    },
    "/docs/development/README": {
      "locale": "pt-BR",
      "slug": "README",
      "href": "/docs/development/README",
      "crowdinFileId": "256127",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/README.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"desenvolvendo-com-electron\"><a href=\"#desenvolvendo-com-electron\">Desenvolvendo com Electron</a></h1>\n<p>Estes guias destinam-se a pessoas que trabalham no projeto Electron. Para guias sobre o desenvolvimento de aplicativos Electron, consulte <a href=\"/docs/README#guides-and-tutorials\">/docs/README.md</a>.</p>\n<ul>\n<li><a href=\"https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md\">Código de Conduta</a></li>\n<li><a href=\"https://github.com/electron/electron/blob/main/CONTRIBUTING.md\">Contribuindo para o Electron</a></li>\n<li><a href=\"/docs/development/issues\">Problemas</a></li>\n<li><a href=\"/docs/development/pull-requests\">Pull Requests</a></li>\n<li><a href=\"/docs/development/coding-style#documentation\">Estilo da Documentação</a></li>\n<li><a href=\"/docs/development/source-code-directory-structure\">Estrutura de Diretório do Código Fonte</a></li>\n<li><a href=\"/docs/development/coding-style\">Estilo de Codificação</a></li>\n<li><a href=\"/docs/development/clang-format\">Usando clang-format em Código C++</a></li>\n<li><a href=\"/docs/development/clang-tidy\">Using clang-tidy on C++ Code</a></li>\n<li><a href=\"/docs/development/build-system-overview\">Construir Resumo do Sistema</a></li>\n<li><a href=\"/docs/development/build-instructions-macos\">Instruções de Compilação (macOS)</a></li>\n<li><a href=\"/docs/development/build-instructions-windows\">Instruções para Configuração (Windows)</a></li>\n<li><a href=\"/docs/development/build-instructions-linux\">Instruções para Configurar (Linux)</a></li>\n<li><a href=\"/docs/development/chromium-development\">Desenvolvimento do Chromium</a></li>\n<li><a href=\"/docs/development/v8-development\">V8 Desenvolvimento</a></li>\n<li><a href=\"/docs/development/testing\">Testando</a></li>\n<li><a href=\"/docs/development/debug-instructions-windows\">Depuração no Windows</a></li>\n<li><a href=\"/docs/development/debugging-instructions-macos\">Depuração no macOS</a></li>\n<li><a href=\"/docs/development/setting-up-symbol-server\">Configuração para servidor de símbolos no Depurador</a></li>\n<li><a href=\"/docs/development/patches\">Patches</a></li>\n</ul>",
      "title": "Desenvolvendo com Electron",
      "description": ""
    },
    "/docs/tutorial/recent-documents": {
      "locale": "pt-BR",
      "slug": "recent-documents",
      "href": "/docs/tutorial/recent-documents",
      "crowdinFileId": "256239",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/recent-documents.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"recent-documents-windows--macos\"><a href=\"#recent-documents-windows--macos\">Recent Documents (Windows &#x26; macOS)</a></h1>\n<h2 id=\"visão-geral\"><a href=\"#visão-geral\">Visão Geral</a></h2>\n<p>Windows and macOS provide access to a list of recent documents opened by the application via JumpList or dock menu, respectively.</p>\n<p><strong>JumpList:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/2289/23446924/11a27b98-fdfc-11e6-8485-cc3b1e86b80a.png\" alt=\"JumpList Recent Files\"></p>\n<p><strong>Application dock menu:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5069610/2aa80758-6e97-11e4-8cfb-c1a414a10774.png\" alt=\"macOS Dock Menu\"></p>\n<h2 id=\"exemplo\"><a href=\"#exemplo\">Exemplo</a></h2>\n<h3 id=\"managing-recent-documents\"><a href=\"#managing-recent-documents\">Managing recent documents</a></h3>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/recent-documents\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\n<span class=\"hljs-keyword\">const</span> fileName = <span class=\"hljs-string\">'recently-used.md'</span>\nfs.writeFile(fileName, <span class=\"hljs-string\">'Lorem Ipsum'</span>, () => {\n  app.addRecentDocument(path.join(__dirname, fileName))\n})\n\napp.whenReady().then(createWindow)\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  app.clearRecentDocuments()\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<h4 id=\"adding-a-recent-document\"><a href=\"#adding-a-recent-document\">Adding a recent document</a></h4>\n<p>To add a file to recent documents, use the <a href=\"/docs/api/app#appaddrecentdocumentpath-macos-windows\">app.addRecentDocument</a> API.</p>\n<p>After launching the Electron application, right click the application icon. In this guide, the item is a Markdown file located in the root of the project. You should see <code>recently-used.md</code> added to the list of recent files:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/recent-documents.png\" alt=\"Recent document\"></p>\n<h4 id=\"clearing-the-list-of-recent-documents\"><a href=\"#clearing-the-list-of-recent-documents\">Clearing the list of recent documents</a></h4>\n<p>To clear the list of recent documents, use the <a href=\"/docs/api/app#appclearrecentdocuments-macos-windows\">app.clearRecentDocuments</a> API. In this guide, the list of documents is cleared once all windows have been closed.</p>\n<h2 id=\"additional-information\"><a href=\"#additional-information\">Additional information</a></h2>\n<h3 id=\"windows-notes\"><a href=\"#windows-notes\">Windows Notes</a></h3>\n<p>To use this feature on Windows, your application has to be registered as a handler of the file type of the document, otherwise the file won't appear in JumpList even after you have added it. You can find everything on registering your application in <a href=\"https://msdn.microsoft.com/en-us/library/cc144104(VS.85).aspx\">Application Registration</a>.</p>\n<p>When a user clicks a file from the JumpList, a new instance of your application will be started with the path of the file added as a command line argument.</p>\n<h3 id=\"macos-notes\"><a href=\"#macos-notes\">macOS Notes</a></h3>\n<h4 id=\"add-the-recent-documents-list-to-the-application-menu\"><a href=\"#add-the-recent-documents-list-to-the-application-menu\">Add the Recent Documents list to the application menu</a></h4>\n<p>You can add menu items to access and clear recent documents by adding the following code snippet to your menu template:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"submenu\"</span>:[\n    {\n      <span class=\"hljs-attr\">\"label\"</span>:<span class=\"hljs-string\">\"Open Recent\"</span>,\n      <span class=\"hljs-attr\">\"role\"</span>:<span class=\"hljs-string\">\"recentdocuments\"</span>,\n      <span class=\"hljs-attr\">\"submenu\"</span>:[\n        {\n          <span class=\"hljs-attr\">\"label\"</span>:<span class=\"hljs-string\">\"Clear Recent\"</span>,\n          <span class=\"hljs-attr\">\"role\"</span>:<span class=\"hljs-string\">\"clearrecentdocuments\"</span>\n        }\n      ]\n    }\n  ]\n}\n</code></pre>\n<p>Make sure the application menu is added after the <a href=\"/docs/api/app#event-ready\"><code>'ready'</code></a> event and not before, or the menu item will be disabled:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> template = [\n  <span class=\"hljs-comment\">// Menu template here</span>\n]\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  Menu.setApplicationMenu(menu)\n})\n</code></pre>\n<p><img src=\"https://user-images.githubusercontent.com/3168941/33003655-ea601c3a-cd70-11e7-97fa-7c062149cfb1.png\" alt=\"macOS Recent Documents menu item\"></p>\n<p>When a file is requested from the recent documents menu, the <code>open-file</code> event of <code>app</code> module will be emitted for it.</p>",
      "title": "Recent Documents (Windows & macOS)",
      "description": ""
    },
    "/docs/api/structures/rectangle": {
      "locale": "pt-BR",
      "slug": "rectangle",
      "href": "/docs/api/structures/rectangle",
      "crowdinFileId": "256493",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/rectangle.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"rectangle-object\"><a href=\"#rectangle-object\">Rectangle Object</a></h1>\n<ul>\n<li><code>x</code> Number - The x coordinate of the origin of the rectangle (must be an integer).</li>\n<li><code>y</code> Number - The y coordinate of the origin of the rectangle (must be an integer).</li>\n<li><code>width</code> Number - The width of the rectangle (must be an integer).</li>\n<li><code>height</code> Number - The height of the rectangle (must be an integer).</li>\n</ul>",
      "title": "Rectangle Object",
      "description": ""
    },
    "/docs/api/structures/referrer": {
      "locale": "pt-BR",
      "slug": "referrer",
      "href": "/docs/api/structures/referrer",
      "crowdinFileId": "256495",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/referrer.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"referrer-object\"><a href=\"#referrer-object\">Referrer Object</a></h1>\n<ul>\n<li><code>url</code> String - HTTP Referrer URL.</li>\n<li><code>policy</code> String - Can be <code>default</code>, <code>unsafe-url</code>, <code>no-referrer-when-downgrade</code>, <code>no-referrer</code>, <code>origin</code>, <code>strict-origin-when-cross-origin</code>, <code>same-origin</code> or <code>strict-origin</code>. See the <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy\">Referrer-Policy spec</a> for more details on the meaning of these values.</li>\n</ul>",
      "title": "Referrer Object",
      "description": ""
    },
    "/docs/tutorial/repl": {
      "locale": "pt-BR",
      "slug": "repl",
      "href": "/docs/tutorial/repl",
      "crowdinFileId": "256241",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/repl.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"repl\"><a href=\"#repl\">REPL</a></h1>\n<p><a href=\"https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop\">Read-Eval-Print-Loop</a> (REPL) is a simple, interactive computer programming environment that takes single user inputs (i.e. single expressions), evaluates them, and returns the result to the user.</p>\n<h2 id=\"processo-principal\"><a href=\"#processo-principal\">Processo principal</a></h2>\n<p>Electron exposes the <a href=\"https://nodejs.org/dist/latest/docs/api/repl.html\">Node.js <code>repl</code> module</a> through the <code>--interactive</code> CLI flag. Assuming you have <code>electron</code> installed as a local project dependency, you should be able to access the REPL with the following command:</p>\n<pre><code class=\"hljs language-sh\">./node_modules/.bin/electron --interactive\n</code></pre>\n<p><strong>Note:</strong> <code>electron --interactive</code> is not available on Windows (see <a href=\"https://github.com/electron/electron/pull/5776\">electron/electron#5776</a> for more details).</p>\n<h2 id=\"renderer-process\"><a href=\"#renderer-process\">Renderer process</a></h2>\n<p>You can use the DevTools Console tab to get a REPL for any renderer process. To learn more, read <a href=\"https://developer.chrome.com/docs/devtools/console/\">the Chrome documentation</a>.</p>",
      "title": "REPL",
      "description": ""
    },
    "/docs/tutorial/represented-file": {
      "locale": "pt-BR",
      "slug": "represented-file",
      "href": "/docs/tutorial/represented-file",
      "crowdinFileId": "256243",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/represented-file.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"representing-files-in-a-browserwindow-macos\"><a href=\"#representing-files-in-a-browserwindow-macos\">Representing Files in a BrowserWindow (macOS)</a></h1>\n<h2 id=\"visão-geral\"><a href=\"#visão-geral\">Visão Geral</a></h2>\n<p>On macOS, you can set a represented file for any window in your application. The represented file's icon will be shown in the title bar, and when users <code>Command-Click</code> or <code>Control-Click</code>, a popup with a path to the file will be shown.</p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5082061/670a949a-6f14-11e4-987a-9aaa04b23c1d.png\" alt=\"Representação de Arquivo\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example where this feature is used to indicate the currently opened file in the Atom text editor.</p>\n</blockquote>\n<p>You can also set the edited state for a window so that the file icon can indicate whether the document in this window has been modified.</p>\n<p>Para definir uma representação de arquivo de uma janela, você pode usar as APIs <a href=\"/docs/api/browser-window#winsetrepresentedfilenamefilename-macos\">BrowserWindow.setRepresentedFilename</a> e <a href=\"/docs/api/browser-window#winsetdocumenteditededited-macos\">BrowserWindow.setDocumentEdited</a>.</p>\n<h2 id=\"exemplo\"><a href=\"#exemplo\">Exemplo</a></h2>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/represented-file\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>);\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.setRepresentedFilename(os.homedir())\n  win.setDocumentEdited(<span class=\"hljs-literal\">true</span>)\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<p>After launching the Electron application, click on the title with <code>Command</code> or <code>Control</code> key pressed. You should see a popup with the represented file at the top. In this guide, this is the current user's home directory:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/represented-file.png\" alt=\"Represented file\"></p>",
      "title": "Representing Files in a BrowserWindow (macOS)",
      "description": "NOTE: The screenshot above is an example where this feature is used to indicate the currently opened file in the Atom text editor."
    },
    "/docs/api/safe-storage": {
      "locale": "pt-BR",
      "slug": "safe-storage",
      "href": "/docs/api/safe-storage",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/safe-storage.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"safestorage\"><a href=\"#safestorage\">safeStorage</a></h1>\n<blockquote>\n<p>Allows access to simple encryption and decryption of strings for storage on the local machine.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>This module protects data stored on disk from being accessed by other applications or users with full disk access.</p>\n<p>Note that on Mac, access to the system Keychain is required and these calls can block the current thread to collect user input. The same is true for Linux, if a password management tool is available.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>safeStorage</code> tem os seguintes métodos:</p>\n<h3 id=\"safestorageisencryptionavailable\"><a href=\"#safestorageisencryptionavailable\"><code>safeStorage.isEncryptionAvailable()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether encryption is available.</p>\n<p>On Linux, returns true if the secret key is available. On MacOS, returns true if Keychain is available. On Windows, returns true with no other preconditions.</p>\n<h3 id=\"safestorageencryptstringplaintext\"><a href=\"#safestorageencryptstringplaintext\"><code>safeStorage.encryptString(plainText)</code></a></h3>\n<ul>\n<li><code>plainText</code> String</li>\n</ul>\n<p>Returns <code>Buffer</code> -  An array of bytes representing the encrypted string.</p>\n<p>This function will throw an error if encryption fails.</p>\n<h3 id=\"safestoragedecryptstringencrypted\"><a href=\"#safestoragedecryptstringencrypted\"><code>safeStorage.decryptString(encrypted)</code></a></h3>\n<ul>\n<li><code>encrypted</code> Buffer</li>\n</ul>\n<p>Returns <code>String</code> - the decrypted string. Decrypts the encrypted buffer obtained  with <code>safeStorage.encryptString</code> back into a string.</p>\n<p>This function will throw an error if decryption fails.</p>",
      "title": "safeStorage",
      "description": "Allows access to simple encryption and decryption of strings for storage on the local machine."
    },
    "/docs/tutorial/sandbox": {
      "locale": "pt-BR",
      "slug": "sandbox",
      "href": "/docs/tutorial/sandbox",
      "crowdinFileId": "256245",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/sandbox.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"process-sandboxing\"><a href=\"#process-sandboxing\">Process Sandboxing</a></h1>\n<p>One key security feature in Chromium is that processes can be executed within a sandbox. The sandbox limits the harm that malicious code can cause by limiting access to most system resources — sandboxed processes can only freely use CPU cycles and memory. In order to perform operations requiring additional privilege, sandboxed processes use dedicated communication channels to delegate tasks to more privileged processes.</p>\n<p>In Chromium, sandboxing is applied to most processes other than the main process. This includes renderer processes, as well as utility processes such as the audio service, the GPU service and the network service.</p>\n<p>See Chromium's <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/design/sandbox.md\">Sandbox design document</a> for more information.</p>\n<h2 id=\"electrons-sandboxing-policies\"><a href=\"#electrons-sandboxing-policies\">Electron's sandboxing policies</a></h2>\n<p>Electron comes with a mixed sandbox environment, meaning sandboxed processes can run alongside privileged ones. By default, renderer processes are not sandboxed, but utility processes are. Note that as in Chromium, the main (browser) process is privileged and cannot be sandboxed.</p>\n<p>Historically, this mixed sandbox approach was established because having Node.js available in the renderer is an extremely powerful tool for app developers. Unfortunately, this feature is also an equally massive security vulnerability.</p>\n<p>Theoretically, unsandboxed renderers are not a problem for desktop applications that only display trusted code, but they make Electron less secure than Chromium for displaying untrusted web content. However, even purportedly trusted code may be dangerous — there are countless attack vectors that malicious actors can use, from cross-site scripting to content injection to man-in-the-middle attacks on remotely loaded websites, just to name a few. For this reason, we recommend enabling renderer sandboxing for the vast majority of cases under an abundance of caution.</p>\n<!--TODO: update this guide when #28466 is either solved or closed -->\n<p>Note that there is an active discussion in the issue tracker to enable renderer sandboxing by default. See <a href=\"https://github.com/electron/electron/issues/28466\">#28466</a>) for details.</p>\n<h2 id=\"sandbox-behaviour-in-electron\"><a href=\"#sandbox-behaviour-in-electron\">Sandbox behaviour in Electron</a></h2>\n<p>Sandboxed processes in Electron behave <em>mostly</em> in the same way as Chromium's do, but Electron has a few additional concepts to consider because it interfaces with Node.js.</p>\n<h3 id=\"renderer-processes\"><a href=\"#renderer-processes\">Renderer processes</a></h3>\n<p>When renderer processes in Electron are sandboxed, they behave in the same way as a regular Chrome renderer would. A sandboxed renderer won't have a Node.js environment initialized.</p>\n<!-- TODO(erickzhao): when we have a solid guide for IPC, link it here -->\n<p>Therefore, when the sandbox is enabled, renderer processes can only perform privileged tasks (such as interacting with the filesystem, making changes to the system, or spawning subprocesses) by delegating these tasks to the main process via inter-process communication (IPC).</p>\n<h3 id=\"preload-scripts\"><a href=\"#preload-scripts\">Preload scripts</a></h3>\n<p>In order to allow renderer processes to communicate with the main process, preload scripts attached to sandboxed renderers will still have a polyfilled subset of Node.js APIs available. A <code>require</code> function similar to Node's <code>require</code> module is exposed, but can only import a subset of Electron and Node's built-in modules:</p>\n<ul>\n<li><code>electron</code> (only renderer process modules)</li>\n<li><a href=\"https://nodejs.org/api/events.html\"><code>eventos</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html\"><code>timers</code></a></li>\n<li><a href=\"https://nodejs.org/api/url.html\"><code>url</code></a></li>\n</ul>\n<p>In addition, the preload script also polyfills certain Node.js primitives as globals:</p>\n<ul>\n<li><a href=\"https://nodejs.org/api/Buffer.html\"><code>Buffer</code></a></li>\n<li><a href=\"/docs/api/process\"><code>process</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html#timers_clearimmediate_immediate\"><code>clearImmediate</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html#timers_setimmediate_callback_args\"><code>setImmediate</code></a></li>\n</ul>\n<p>Because the <code>require</code> function is a polyfill with limited functionality, you will not be able to use <a href=\"https://nodejs.org/api/modules.html#modules_modules_commonjs_modules\">CommonJS modules</a> to separate your preload script into multiple files. If you need to split your preload code, use a bundler such as <a href=\"https://webpack.js.org/\">webpack</a> or <a href=\"https://parceljs.org/\">Parcel</a>.</p>\n<p>Note that because the environment presented to the <code>preload</code> script is substantially more privileged than that of a sandboxed renderer, it is still possible to leak privileged APIs to untrusted code running in the renderer process unless <a href=\"/docs/tutorial/context-isolation\"><code>contextIsolation</code></a> is enabled.</p>\n<h2 id=\"configuring-the-sandbox\"><a href=\"#configuring-the-sandbox\">Configuring the sandbox</a></h2>\n<h3 id=\"enabling-the-sandbox-for-a-single-process\"><a href=\"#enabling-the-sandbox-for-a-single-process\">Enabling the sandbox for a single process</a></h3>\n<p>In Electron, renderer sandboxing can be enabled on a per-process basis with the <code>sandbox: true</code> preference in the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> constructor.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">sandbox</span>: <span class=\"hljs-literal\">true</span>\n    }\n  })\n  win.loadURL(<span class=\"hljs-string\">'https://google.com'</span>)\n})\n</code></pre>\n<h3 id=\"enabling-the-sandbox-globally\"><a href=\"#enabling-the-sandbox-globally\">Enabling the sandbox globally</a></h3>\n<p>If you want to force sandboxing for all renderers, you can also use the <a href=\"/docs/api/app#appenablesandbox\"><code>app.enableSandbox</code></a> API. Note that this API has to be called before the app's <code>ready</code> event.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\napp.enableSandbox()\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// no need to pass `sandbox: true` since `app.enableSandbox()` was called.</span>\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://google.com'</span>)\n})\n</code></pre>\n<h3 id=\"disabling-chromiums-sandbox-testing-only\"><a href=\"#disabling-chromiums-sandbox-testing-only\">Disabling Chromium's sandbox (testing only)</a></h3>\n<p>You can also disable Chromium's sandbox entirely with the <a href=\"/docs/api/command-line-switches#--no-sandbox\"><code>--no-sandbox</code></a> CLI flag, which will disable the sandbox for all processes (including utility processes). We highly recommend that you only use this flag for testing purposes, and <strong>never</strong> in production.</p>\n<p>Note that the <code>sandbox: true</code> option will still disable the renderer's Node.js environment.</p>\n<h2 id=\"a-note-on-rendering-untrusted-content\"><a href=\"#a-note-on-rendering-untrusted-content\">A note on rendering untrusted content</a></h2>\n<p>Rendering untrusted content in Electron is still somewhat uncharted territory, though some apps are finding success (e.g. <a href=\"https://github.com/beakerbrowser/beaker\">Beaker Browser</a>). Our goal is to get as close to Chrome as we can in terms of the security of sandboxed content, but ultimately we will always be behind due to a few fundamental issues:</p>\n<ol>\n<li>We do not have the dedicated resources or expertise that Chromium has to apply to the security of its product. We do our best to make use of what we have, to inherit everything we can from Chromium, and to respond quickly to security issues, but Electron cannot be as secure as Chromium without the resources that Chromium is able to dedicate.</li>\n<li>Some security features in Chrome (such as Safe Browsing and Certificate Transparency) require a centralized authority and dedicated servers, both of which run counter to the goals of the Electron project. As such, we disable those features in Electron, at the cost of the associated security they would otherwise bring.</li>\n<li>There is only one Chromium, whereas there are many thousands of apps built on Electron, all of which behave slightly differently. Accounting for those differences can yield a huge possibility space, and make it challenging to ensure the security of the platform in unusual use cases.</li>\n<li>We can't push security updates to users directly, so we rely on app vendors to upgrade the version of Electron underlying their app in order for security updates to reach users.</li>\n</ol>\n<p>While we make our best effort to backport Chromium security fixes to older versions of Electron, we do not make a guarantee that every fix will be backported. Your best chance at staying secure is to be on the latest stable version of Electron.</p>",
      "title": "Process Sandboxing",
      "description": ""
    },
    "/docs/api/screen": {
      "locale": "pt-BR",
      "slug": "screen",
      "href": "/docs/api/screen",
      "crowdinFileId": "256361",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/screen.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"screen\"><a href=\"#screen\">screen</a></h1>\n<blockquote>\n<p>Recupere informações sobre o tamanho da tela, monitores, posição do cursor, etc.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>Este módulo não pode ser usado até que o evento <code>ready</code> do módulo <code>app</code> seja emitido.</p>\n<p><code>screen</code> é um <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p><strong>Nota:</strong> No renderizador / DevTools, <code>window.screen</code> é uma propriedade reservada do DOM, portanto, escrever <code>let {screen} = require ('electron')</code> pode não funcionar.</p>\n<p>Um exemplo de criação de uma janela que preenche a tela inteira:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/screen/fit-screen\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, screen } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> { width, height } = screen.getPrimaryDisplay().workAreaSize\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ width, height })\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>Another example of creating a window in the external display:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, screen } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> displays = screen.getAllDisplays()\n  <span class=\"hljs-keyword\">const</span> externalDisplay = displays.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">display</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> display.bounds.x !== <span class=\"hljs-number\">0</span> || display.bounds.y !== <span class=\"hljs-number\">0</span>\n  })\n\n  <span class=\"hljs-keyword\">if</span> (externalDisplay) {\n    win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n      <span class=\"hljs-attr\">x</span>: externalDisplay.bounds.x + <span class=\"hljs-number\">50</span>,\n      <span class=\"hljs-attr\">y</span>: externalDisplay.bounds.y + <span class=\"hljs-number\">50</span>\n    })\n    win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  }\n})\n</code></pre>\n<h2 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h2>\n<p>O módulo <code>screen</code> emite os seguintes eventos:</p>\n<h3 id=\"evento-display-added\"><a href=\"#evento-display-added\">Evento: 'display-added'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newDisplay</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n</ul>\n<p>Emitted when <code>newDisplay</code> has been added.</p>\n<h3 id=\"event-display-removed\"><a href=\"#event-display-removed\">Event: 'display-removed'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>oldDisplay</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n</ul>\n<p>Emitted when <code>oldDisplay</code> has been removed.</p>\n<h3 id=\"event-display-metrics-changed\"><a href=\"#event-display-metrics-changed\">Event: 'display-metrics-changed'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>display</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n<li><code>changedMetrics</code> String[]</li>\n</ul>\n<p>Emitted when one or more metrics change in a <code>display</code>. The <code>changedMetrics</code> is an array of strings that describe the changes. Possible changes are <code>bounds</code>, <code>workArea</code>, <code>scaleFactor</code> and <code>rotation</code>.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>screen</code> tem os seguintes métodos:</p>\n<h3 id=\"screengetcursorscreenpoint\"><a href=\"#screengetcursorscreenpoint\"><code>screen.getCursorScreenPoint()</code></a></h3>\n<p>Retorna <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>The current absolute position of the mouse pointer.</p>\n<p><strong>Note:</strong> The return value is a DIP point, not a screen physical point.</p>\n<h3 id=\"screengetprimarydisplay\"><a href=\"#screengetprimarydisplay\"><code>screen.getPrimaryDisplay()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/display\"><code>Display</code></a> - The primary display.</p>\n<h3 id=\"screengetalldisplays\"><a href=\"#screengetalldisplays\"><code>screen.getAllDisplays()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/display\"><code>Display[]</code></a> - An array of displays that are currently available.</p>\n<h3 id=\"screengetdisplaynearestpointpoint\"><a href=\"#screengetdisplaynearestpointpoint\"><code>screen.getDisplayNearestPoint(point)</code></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/display\"><code>Display</code></a> - The display nearest the specified point.</p>\n<h3 id=\"screengetdisplaymatchingrect\"><a href=\"#screengetdisplaymatchingrect\"><code>screen.getDisplayMatching(rect)</code></a></h3>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/display\"><code>Display</code></a> - The display that most closely intersects the provided bounds.</p>\n<h3 id=\"screenscreentodippointpoint-windows\"><a href=\"#screenscreentodippointpoint-windows\"><code>screen.screenToDipPoint(point)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Retorna <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>Converts a screen physical point to a screen DIP point. The DPI scale is performed relative to the display containing the physical point.</p>\n<h3 id=\"screendiptoscreenpointpoint-windows\"><a href=\"#screendiptoscreenpointpoint-windows\"><code>screen.dipToScreenPoint(point)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Retorna <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>Converts a screen DIP point to a screen physical point. The DPI scale is performed relative to the display containing the DIP point.</p>\n<h3 id=\"screenscreentodiprectwindow-rect-windows\"><a href=\"#screenscreentodiprectwindow-rect-windows\"><code>screen.screenToDipRect(window, rect)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | null</li>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Retorna <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>Converts a screen physical rect to a screen DIP rect. The DPI scale is performed relative to the display nearest to <code>window</code>. If <code>window</code> is null, scaling will be performed to the display nearest to <code>rect</code>.</p>\n<h3 id=\"screendiptoscreenrectwindow-rect-windows\"><a href=\"#screendiptoscreenrectwindow-rect-windows\"><code>screen.dipToScreenRect(window, rect)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | null</li>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Retorna <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>Converts a screen DIP rect to a screen physical rect. The DPI scale is performed relative to the display nearest to <code>window</code>. If <code>window</code> is null, scaling will be performed to the display nearest to <code>rect</code>.</p>",
      "title": "screen",
      "description": "Recupere informações sobre o tamanho da tela, monitores, posição do cursor, etc."
    },
    "/docs/api/structures/scrubber-item": {
      "locale": "pt-BR",
      "slug": "scrubber-item",
      "href": "/docs/api/structures/scrubber-item",
      "crowdinFileId": "256497",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/scrubber-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"scrubberitem-object\"><a href=\"#scrubberitem-object\">ScrubberItem Object</a></h1>\n<ul>\n<li><code>label</code> String (optional) - The text to appear in this item.</li>\n<li><code>icon</code> NativeImage (optional) - The image to appear in this item.</li>\n</ul>",
      "title": "ScrubberItem Object",
      "description": ""
    },
    "/docs/tutorial/security": {
      "locale": "pt-BR",
      "slug": "security",
      "href": "/docs/tutorial/security",
      "crowdinFileId": "256247",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/security.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"segurança-capacidades-nativas-e-suas-responsabilidades\"><a href=\"#segurança-capacidades-nativas-e-suas-responsabilidades\">Segurança, Capacidades Nativas e Suas Responsabilidades</a></h1>\n<p>Como desenvolvedores web, nós geralmente usufruímos da forte segurança de rede disponibilizada pelos navegadores - os riscos associados com códigos que escrevemos são relativamente baixos. Nossos sites tem poderes limitados em uma caixa de areia e confiamos que nossos usuários desfrutam de num navegador construído por uma grande equipe de engenheiros os quais são capazes de responder rapidamente às ameaças de segurança recém-descobertas.</p>\n<p>Ao trabalhar com Electron, é importante entender que Electron não é um navegador web. Isto permite que você construa aplicações desktop ricas com tecnologias web familiar, mas seu código exerce um poder muito maior. JavaScript pode acessar o sistema de arquivos, o shell do usuário e muito mais. Isto permite que você crie aplicativos nativos de alta qualidade, mas os riscos de segurança inerentes escalam com os poderes adicionais concedidos ao seu código.</p>\n<p>Com isso em mente, esteja ciente de que exibir conteúdo arbitrário de fontes não confiáveis representa um grave risco de segurança que o Electron não pretende manipular. Na verdade, os mais populares aplicativos do Electron (Atom, Slack, Visual Studio Code, etc) exibem principalmente conteúdo local (ou confiáveis, conteúdo remoto seguro, sem a integração com Node) - se sua aplicação executa código de uma fonte online, é sua responsabilidade que o código não seja malicioso.</p>\n<h2 id=\"reportando-problemas-de-segurança\"><a href=\"#reportando-problemas-de-segurança\">Reportando problemas de Segurança</a></h2>\n<p>Para obter informações sobre como divulgar adequadamente uma vulnerabilidade do Electron, consulte <a href=\"https://github.com/electron/electron/tree/main/SECURITY.md\">SECURITY.md</a></p>\n<h2 id=\"upgrades-e-problemas-de-segurança-do-chromium\"><a href=\"#upgrades-e-problemas-de-segurança-do-chromium\">Upgrades e Problemas de Segurança do Chromium</a></h2>\n<p>Electron keeps up to date with alternating Chromium releases. For more information, see the <a href=\"https://electronjs.org/blog/12-week-cadence\">Electron Release Cadence blog post</a>.</p>\n<h2 id=\"security-is-everyones-responsibility\"><a href=\"#security-is-everyones-responsibility\">Security Is Everyone's Responsibility</a></h2>\n<p>It is important to remember that the security of your Electron application is the result of the overall security of the framework foundation (<em>Chromium</em>, <em>Node.js</em>), Electron itself, all NPM dependencies and your code. As such, it is your responsibility to follow a few important best practices:</p>\n<ul>\n<li>\n<p><strong>Mantenha sua aplicação atualizada com a última versão do framework Electron.</strong> Ao lançar seu produto, você também está enviando um pacote composto pelo Electron, Biblioteca Compartilhada do Chromium e Node.js. Vulnerabilidades afetando estes componentes podem afetar a segurança do seu aplicativo. Ao atualizar o Electron para a versão mais recente, você garante que as vulnerabilidades críticas (como <em>nodeIntegration bypasses</em>) já estão corrigidas e não podem ser exploradas em seu aplicativo. For more information, see \"<a href=\"#16-use-a-current-version-of-electron\">Use a current version of Electron</a>\".</p>\n</li>\n<li>\n<p><strong>Avalie suas dependências.</strong> O NPM fornece meio milhão de pacotes reutilizáveis, mas é sua responsabilidade escolher bibliotecas de terceiros confiáveis. Se você usar bibliotecas desatualizadas afetadas por vulnerabilidades conhecidas ou se depender de código mal mantido, a segurança do aplicativo pode estar comprometida.</p>\n</li>\n<li>\n<p><strong>Adote práticas seguras de codificação.</strong> A primeira linha de defesa para seu aplicativo é seu próprio código. Common web vulnerabilities, such as Cross-Site Scripting (XSS), have a higher security impact on Electron applications hence it is highly recommended to adopt secure software development best practices and perform security testing.</p>\n</li>\n</ul>\n<h2 id=\"isolation-for-untrusted-content\"><a href=\"#isolation-for-untrusted-content\">Isolation For Untrusted Content</a></h2>\n<p>A security issue exists whenever you receive code from an untrusted source (e.g. a remote server) and execute it locally. As an example, consider a remote website being displayed inside a default <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. If an attacker somehow manages to change said content (either by attacking the source directly, or by sitting between your app and the actual destination), they will be able to execute native code on the user's machine.</p>\n<blockquote>\n<p>⚠️ Under no circumstances should you load and execute remote code with Node.js integration enabled. Instead, use only local files (packaged together with your application) to execute Node.js code. To display remote content, use the <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> tag or <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, make sure to disable the <code>nodeIntegration</code> and enable <code>contextIsolation</code>.</p>\n</blockquote>\n<h2 id=\"aviso-de-segurança-do-electron\"><a href=\"#aviso-de-segurança-do-electron\">Aviso de Segurança do Electron</a></h2>\n<p>From Electron 2.0 on, developers will see warnings and recommendations printed to the developer console. They only show up when the binary's name is Electron, indicating that a developer is currently looking at the console.</p>\n<p>You can force-enable or force-disable these warnings by setting <code>ELECTRON_ENABLE_SECURITY_WARNINGS</code> or <code>ELECTRON_DISABLE_SECURITY_WARNINGS</code> on either <code>process.env</code> or the <code>window</code> object.</p>\n<h2 id=\"checklist-security-recommendations\"><a href=\"#checklist-security-recommendations\">Checklist: Security Recommendations</a></h2>\n<p>You should at least follow these steps to improve the security of your application:</p>\n<ol>\n<li><a href=\"#1-only-load-secure-content\">Only load secure content</a></li>\n<li><a href=\"#2-do-not-enable-nodejs-integration-for-remote-content\">Disable the Node.js integration in all renderers that display remote content</a></li>\n<li><a href=\"#3-enable-context-isolation-for-remote-content\">Enable context isolation in all renderers that display remote content</a></li>\n<li><a href=\"#4-enable-sandboxing\">Enable sandboxing</a></li>\n<li><a href=\"#5-handle-session-permission-requests-from-remote-content\">Use <code>ses.setPermissionRequestHandler()</code> in all sessions that load remote content</a></li>\n<li><a href=\"#6-do-not-disable-websecurity\">Do not disable <code>webSecurity</code></a></li>\n<li><a href=\"#7-define-a-content-security-policy\">Define a <code>Content-Security-Policy</code></a> and use restrictive rules (i.e. <code>script-src 'self'</code>)</li>\n<li><a href=\"#8-do-not-set-allowrunninginsecurecontent-to-true\">Do not set <code>allowRunningInsecureContent</code> to <code>true</code></a></li>\n<li><a href=\"#9-do-not-enable-experimental-features\">Do not enable experimental features</a></li>\n<li><a href=\"#10-do-not-use-enableblinkfeatures\">Do not use <code>enableBlinkFeatures</code></a></li>\n<li><a href=\"#11-do-not-use-allowpopups\"><code>&#x3C;webview></code>: Do not use <code>allowpopups</code></a></li>\n<li><a href=\"#12-verify-webview-options-before-creation\"><code>&#x3C;webview></code>: Verify options and params</a></li>\n<li><a href=\"#13-disable-or-limit-navigation\">Disable or limit navigation</a></li>\n<li><a href=\"#14-disable-or-limit-creation-of-new-windows\">Disable or limit creation of new windows</a></li>\n<li><a href=\"#15-do-not-use-openexternal-with-untrusted-content\">Do not use <code>openExternal</code> with untrusted content</a></li>\n<li><a href=\"#16-use-a-current-version-of-electron\">Use a current version of Electron</a></li>\n</ol>\n<p>To automate the detection of misconfigurations and insecure patterns, it is possible to use <a href=\"https://github.com/doyensec/electronegativity\">electronegativity</a>. For additional details on potential weaknesses and implementation bugs when developing applications using Electron, please refer to this <a href=\"https://doyensec.com/resources/us-17-Carettoni-Electronegativity-A-Study-Of-Electron-Security-wp.pdf\">guide for developers and auditors</a></p>\n<h2 id=\"1-only-load-secure-content\"><a href=\"#1-only-load-secure-content\">1) Only Load Secure Content</a></h2>\n<p>Any resources not included with your application should be loaded using a secure protocol like <code>HTTPS</code>. In other words, do not use insecure protocols like <code>HTTP</code>. Similarly, we recommend the use of <code>WSS</code> over <code>WS</code>, <code>FTPS</code> over <code>FTP</code>, and so on.</p>\n<h3 id=\"por-que\"><a href=\"#por-que\">Por que?</a></h3>\n<p><code>HTTPS</code> has three main benefits:</p>\n<p>1) It authenticates the remote server, ensuring your app connects to the correct host instead of an impersonator. 2) It ensures data integrity, asserting that the data was not modified while in transit between your application and the host. 3) It encrypts the traffic between your user and the destination host, making it more difficult to eavesdrop on the information sent between your app and the host.</p>\n<h3 id=\"como\"><a href=\"#como\">Como?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\nbrowserWindow.loadURL(<span class=\"hljs-string\">'http://example.com'</span>)\n\n<span class=\"hljs-comment\">// Good</span>\nbrowserWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Bad --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">crossorigin</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://example.com/react.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"http://example.com/style.css\"</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Good --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">crossorigin</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://example.com/react.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"https://example.com/style.css\"</span>></span>\n</code></pre>\n<h2 id=\"2-do-not-enable-nodejs-integration-for-remote-content\"><a href=\"#2-do-not-enable-nodejs-integration-for-remote-content\">2) Do not enable Node.js Integration for Remote Content</a></h2>\n<p><em>This recommendation is the default behavior in Electron since 5.0.0.</em></p>\n<p>It is paramount that you do not enable Node.js integration in any renderer (<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>, <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, or <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>) that loads remote content. The goal is to limit the powers you grant to remote content, thus making it dramatically more difficult for an attacker to harm your users should they gain the ability to execute JavaScript on your website.</p>\n<p>After this, you can grant additional permissions for specific hosts. For example, if you are opening a BrowserWindow pointed at <code>https://example.com/</code>, you can give that website exactly the abilities it needs, but no more.</p>\n<h3 id=\"por-que-1\"><a href=\"#por-que-1\">Por que?</a></h3>\n<p>A cross-site-scripting (XSS) attack is more dangerous if an attacker can jump out of the renderer process and execute code on the user's computer. Cross-site-scripting attacks are fairly common - and while an issue, their power is usually limited to messing with the website that they are executed on. Disabling Node.js integration helps prevent an XSS from being escalated into a so-called \"Remote Code Execution\" (RCE) attack.</p>\n<h3 id=\"como-1\"><a href=\"#como-1\">Como?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span>,\n    <span class=\"hljs-attr\">nodeIntegrationInWorker</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n\nmainWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">preload</span>: path.join(app.getAppPath(), <span class=\"hljs-string\">'preload.js'</span>)\n  }\n})\n\nmainWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Bad --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">nodeIntegration</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Good --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>When disabling Node.js integration, you can still expose APIs to your website that do consume Node.js modules or features. Preload scripts continue to have access to <code>require</code> and other Node.js features, allowing developers to expose a custom API to remotely loaded content.</p>\n<p>In the following example preload script, the later loaded website will have access to a <code>window.readConfig()</code> method, but no Node.js features.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { readFileSync } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-built_in\">window</span>.readConfig = <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> data = readFileSync(<span class=\"hljs-string\">'./config.json'</span>)\n  <span class=\"hljs-keyword\">return</span> data\n}\n</code></pre>\n<h2 id=\"3-enable-context-isolation-for-remote-content\"><a href=\"#3-enable-context-isolation-for-remote-content\">3) Enable Context Isolation for Remote Content</a></h2>\n<p>Context isolation is an Electron feature that allows developers to run code in preload scripts and in Electron APIs in a dedicated JavaScript context. In practice, that means that global objects like <code>Array.prototype.push</code> or <code>JSON.parse</code> cannot be modified by scripts running in the renderer process.</p>\n<p>Electron uses the same technology as Chromium's <a href=\"https://developer.chrome.com/extensions/content_scripts#execution-environment\">Content Scripts</a> to enable this behavior.</p>\n<p>Even when <code>nodeIntegration: false</code> is used, to truly enforce strong isolation and prevent the use of Node primitives <code>contextIsolation</code> <strong>must</strong> also be used.</p>\n<h3 id=\"why--how\"><a href=\"#why--how\">Why &#x26; How?</a></h3>\n<p>For more information on what <code>contextIsolation</code> is and how to enable it please see our dedicated <a href=\"/docs/tutorial/context-isolation\">Context Isolation</a> document.</p>\n<h2 id=\"4-enable-sandboxing\"><a href=\"#4-enable-sandboxing\">4) Enable Sandboxing</a></h2>\n<p><a href=\"/docs/tutorial/sandbox\">Sandboxing</a> is a Chromium feature that uses the operating system to significantly limit what renderer processes have access to. You should enable the sandbox in all renderers. Loading, reading or processing any untrusted content in an unsandboxed process, including the main process, is not advised.</p>\n<h3 id=\"como-2\"><a href=\"#como-2\">Como?</a></h3>\n<p>When creating a window, pass the <code>sandbox: true</code> option in <code>webPreferences</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">sandbox</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h2 id=\"5-handle-session-permission-requests-from-remote-content\"><a href=\"#5-handle-session-permission-requests-from-remote-content\">5) Handle Session Permission Requests From Remote Content</a></h2>\n<p>You may have seen permission requests while using Chrome: They pop up whenever the website attempts to use a feature that the user has to manually approve ( like notifications).</p>\n<p>The API is based on the <a href=\"https://developer.chrome.com/extensions/permissions\">Chromium permissions API</a> and implements the same types of permissions.</p>\n<h3 id=\"por-que-2\"><a href=\"#por-que-2\">Por que?</a></h3>\n<p>By default, Electron will automatically approve all permission requests unless the developer has manually configured a custom handler. While a solid default, security-conscious developers might want to assume the very opposite.</p>\n<h3 id=\"como-3\"><a href=\"#como-3\">Como?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession\n  .fromPartition(<span class=\"hljs-string\">'some-partition'</span>)\n  .setPermissionRequestHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, callback</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> url = webContents.getURL()\n\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'notifications'</span>) {\n      <span class=\"hljs-comment\">// Approves the permissions request</span>\n      callback(<span class=\"hljs-literal\">true</span>)\n    }\n\n    <span class=\"hljs-comment\">// Verify URL</span>\n    <span class=\"hljs-keyword\">if</span> (!url.startsWith(<span class=\"hljs-string\">'https://example.com/'</span>)) {\n      <span class=\"hljs-comment\">// Denies the permissions request</span>\n      <span class=\"hljs-keyword\">return</span> callback(<span class=\"hljs-literal\">false</span>)\n    }\n  })\n</code></pre>\n<h2 id=\"6-do-not-disable-websecurity\"><a href=\"#6-do-not-disable-websecurity\">6) Do Not Disable WebSecurity</a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>You may have already guessed that disabling the <code>webSecurity</code> property on a renderer process (<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>, <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, or <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>) disables crucial security features.</p>\n<p>Do not disable <code>webSecurity</code> in production applications.</p>\n<h3 id=\"por-que-3\"><a href=\"#por-que-3\">Por que?</a></h3>\n<p>Disabling <code>webSecurity</code> will disable the same-origin policy and set <code>allowRunningInsecureContent</code> property to <code>true</code>. In other words, it allows the execution of insecure code from different domains.</p>\n<h3 id=\"como-4\"><a href=\"#como-4\">Como?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">webSecurity</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Bad --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">disablewebsecurity</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Good --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<h2 id=\"7-define-a-content-security-policy\"><a href=\"#7-define-a-content-security-policy\">7) Define a Content Security Policy</a></h2>\n<p>A Content Security Policy (CSP) is an additional layer of protection against cross-site-scripting attacks and data injection attacks. We recommend that they be enabled by any website you load inside Electron.</p>\n<h3 id=\"por-que-4\"><a href=\"#por-que-4\">Por que?</a></h3>\n<p>CSP allows the server serving content to restrict and control the resources Electron can load for that given web page. <code>https://example.com</code> should be allowed to load scripts from the origins you defined while scripts from <code>https://evil.attacker.com</code> should not be allowed to run. Defining a CSP is an easy way to improve your application's security.</p>\n<p>The following CSP will allow Electron to execute scripts from the current website and from <code>apis.example.com</code>.</p>\n<pre><code class=\"hljs language-plaintext\">// Bad\nContent-Security-Policy: '*'\n\n// Good\nContent-Security-Policy: script-src 'self' https://apis.example.com\n</code></pre>\n<h3 id=\"csp-http-header\"><a href=\"#csp-http-header\">CSP HTTP Header</a></h3>\n<p>Electron respects the <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy\"><code>Content-Security-Policy</code> HTTP header</a> which can be set using Electron's <a href=\"/docs/api/web-request#webrequestonheadersreceivedfilter-listener\"><code>webRequest.onHeadersReceived</code></a> handler:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession.defaultSession.webRequest.onHeadersReceived(<span class=\"hljs-function\">(<span class=\"hljs-params\">details, callback</span>) =></span> {\n  callback({\n    <span class=\"hljs-attr\">responseHeaders</span>: {\n      ...details.responseHeaders,\n      <span class=\"hljs-string\">'Content-Security-Policy'</span>: [<span class=\"hljs-string\">'default-src \\'none\\''</span>]\n    }\n  })\n})\n</code></pre>\n<h3 id=\"csp-meta-tag\"><a href=\"#csp-meta-tag\">CSP Meta Tag</a></h3>\n<p>CSP's preferred delivery mechanism is an HTTP header, however it is not possible to use this method when loading a resource using the <code>file://</code> protocol. It can be useful in some cases, such as using the <code>file://</code> protocol, to set a policy on a page directly in the markup using a <code>&#x3C;meta></code> tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'none'\"</span>></span>\n</code></pre>\n<h2 id=\"8-do-not-set-allowrunninginsecurecontent-to-true\"><a href=\"#8-do-not-set-allowrunninginsecurecontent-to-true\">8) Do Not Set <code>allowRunningInsecureContent</code> to <code>true</code></a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>By default, Electron will not allow websites loaded over <code>HTTPS</code> to load and execute scripts, CSS, or plugins from insecure sources (<code>HTTP</code>). Setting the property <code>allowRunningInsecureContent</code> to <code>true</code> disables that protection.</p>\n<p>Loading the initial HTML of a website over <code>HTTPS</code> and attempting to load subsequent resources via <code>HTTP</code> is also known as \"mixed content\".</p>\n<h3 id=\"por-que-5\"><a href=\"#por-que-5\">Por que?</a></h3>\n<p>Loading content over <code>HTTPS</code> assures the authenticity and integrity of the loaded resources while encrypting the traffic itself. See the section on <a href=\"#1-only-load-secure-content\">only displaying secure content</a> for more details.</p>\n<h3 id=\"como-5\"><a href=\"#como-5\">Como?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">allowRunningInsecureContent</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({})\n</code></pre>\n<h2 id=\"9-do-not-enable-experimental-features\"><a href=\"#9-do-not-enable-experimental-features\">9) Do Not Enable Experimental Features</a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>Advanced users of Electron can enable experimental Chromium features using the <code>experimentalFeatures</code> property.</p>\n<h3 id=\"por-que-6\"><a href=\"#por-que-6\">Por que?</a></h3>\n<p>Experimental features are, as the name suggests, experimental and have not been enabled for all Chromium users. Furthermore, their impact on Electron as a whole has likely not been tested.</p>\n<p>Legitimate use cases exist, but unless you know what you are doing, you should not enable this property.</p>\n<h3 id=\"como-6\"><a href=\"#como-6\">Como?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">experimentalFeatures</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({})\n</code></pre>\n<h2 id=\"10-do-not-use-enableblinkfeatures\"><a href=\"#10-do-not-use-enableblinkfeatures\">10) Do Not Use <code>enableBlinkFeatures</code></a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>Blink is the name of the rendering engine behind Chromium. As with <code>experimentalFeatures</code>, the <code>enableBlinkFeatures</code> property allows developers to enable features that have been disabled by default.</p>\n<h3 id=\"por-que-7\"><a href=\"#por-que-7\">Por que?</a></h3>\n<p>Generally speaking, there are likely good reasons if a feature was not enabled by default. Legitimate use cases for enabling specific features exist. As a developer, you should know exactly why you need to enable a feature, what the ramifications are, and how it impacts the security of your application. Under no circumstances should you enable features speculatively.</p>\n<h3 id=\"como-7\"><a href=\"#como-7\">Como?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">enableBlinkFeatures</span>: <span class=\"hljs-string\">'ExecCommandInJavaScript'</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n</code></pre>\n<h2 id=\"11-do-not-use-allowpopups\"><a href=\"#11-do-not-use-allowpopups\">11) Do Not Use <code>allowpopups</code></a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>If you are using <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>, you might need the pages and scripts loaded in your <code>&#x3C;webview></code> tag to open new windows. The <code>allowpopups</code> attribute enables them to create new <a href=\"/docs/api/browser-window\"><code>BrowserWindows</code></a> using the <code>window.open()</code> method. <code>&#x3C;webview></code> tags are otherwise not allowed to create new windows.</p>\n<h3 id=\"por-que-8\"><a href=\"#por-que-8\">Por que?</a></h3>\n<p>If you do not need popups, you are better off not allowing the creation of new <a href=\"/docs/api/browser-window\"><code>BrowserWindows</code></a> by default. This follows the principle of minimally required access: Don't let a website create new popups unless you know it needs that feature.</p>\n<h3 id=\"como-8\"><a href=\"#como-8\">Como?</a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Bad --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">allowpopups</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Good --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<h2 id=\"12-verify-webview-options-before-creation\"><a href=\"#12-verify-webview-options-before-creation\">12) Verify WebView Options Before Creation</a></h2>\n<p>A WebView created in a renderer process that does not have Node.js integration enabled will not be able to enable integration itself. However, a WebView will always create an independent renderer process with its own <code>webPreferences</code>.</p>\n<p>It is a good idea to control the creation of new <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> tags from the main process and to verify that their webPreferences do not disable security features.</p>\n<h3 id=\"por-que-9\"><a href=\"#por-que-9\">Por que?</a></h3>\n<p>Since <code>&#x3C;webview></code> live in the DOM, they can be created by a script running on your website even if Node.js integration is otherwise disabled.</p>\n<p>Electron enables developers to disable various security features that control a renderer process. In most cases, developers do not need to disable any of those features - and you should therefore not allow different configurations for newly created <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> tags.</p>\n<h3 id=\"como-9\"><a href=\"#como-9\">Como?</a></h3>\n<p>Before a <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> tag is attached, Electron will fire the <code>will-attach-webview</code> event on the hosting <code>webContents</code>. Use the event to prevent the creation of <code>webViews</code> with possibly insecure options.</p>\n<pre><code class=\"hljs language-js\">app.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.on(<span class=\"hljs-string\">'will-attach-webview'</span>, (event, webPreferences, params) => {\n    <span class=\"hljs-comment\">// Strip away preload scripts if unused or verify their location is legitimate</span>\n    <span class=\"hljs-keyword\">delete</span> webPreferences.preload\n    <span class=\"hljs-keyword\">delete</span> webPreferences.preloadURL\n\n    <span class=\"hljs-comment\">// Disable Node.js integration</span>\n    webPreferences.nodeIntegration = <span class=\"hljs-literal\">false</span>\n\n    <span class=\"hljs-comment\">// Verify URL being loaded</span>\n    <span class=\"hljs-keyword\">if</span> (!params.src.startsWith(<span class=\"hljs-string\">'https://example.com/'</span>)) {\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<p>Again, this list merely minimizes the risk, it does not remove it. If your goal is to display a website, a browser will be a more secure option.</p>\n<h2 id=\"13-disable-or-limit-navigation\"><a href=\"#13-disable-or-limit-navigation\">13) Disable or limit navigation</a></h2>\n<p>If your app has no need to navigate or only needs to navigate to known pages, it is a good idea to limit navigation outright to that known scope, disallowing any other kinds of navigation.</p>\n<h3 id=\"por-que-10\"><a href=\"#por-que-10\">Por que?</a></h3>\n<p>Navigation is a common attack vector. If an attacker can convince your app to navigate away from its current page, they can possibly force your app to open web sites on the Internet. Even if your <code>webContents</code> are configured to be more secure (like having <code>nodeIntegration</code> disabled or <code>contextIsolation</code> enabled), getting your app to open a random web site will make the work of exploiting your app a lot easier.</p>\n<p>A common attack pattern is that the attacker convinces your app's users to interact with the app in such a way that it navigates to one of the attacker's pages. This is usually done via links, plugins, or other user-generated content.</p>\n<h3 id=\"como-10\"><a href=\"#como-10\">Como?</a></h3>\n<p>If your app has no need for navigation, you can call <code>event.preventDefault()</code> in a <a href=\"/docs/api/web-contents#event-will-navigate\"><code>will-navigate</code></a> handler. If you know which pages your app might navigate to, check the URL in the event handler and only let navigation occur if it matches the URLs you're expecting.</p>\n<p>We recommend that you use Node's parser for URLs. Simple string comparisons can sometimes be fooled - a <code>startsWith('https://example.com')</code> test would let <code>https://example.com.attacker.com</code> through.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> URL = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>).URL\n\napp.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.on(<span class=\"hljs-string\">'will-navigate'</span>, (event, navigationUrl) => {\n    <span class=\"hljs-keyword\">const</span> parsedUrl = <span class=\"hljs-keyword\">new</span> URL(navigationUrl)\n\n    <span class=\"hljs-keyword\">if</span> (parsedUrl.origin !== <span class=\"hljs-string\">'https://example.com'</span>) {\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<h2 id=\"14-disable-or-limit-creation-of-new-windows\"><a href=\"#14-disable-or-limit-creation-of-new-windows\">14) Disable or limit creation of new windows</a></h2>\n<p>If you have a known set of windows, it's a good idea to limit the creation of additional windows in your app.</p>\n<h3 id=\"por-que-11\"><a href=\"#por-que-11\">Por que?</a></h3>\n<p>Much like navigation, the creation of new <code>webContents</code> is a common attack vector. Attackers attempt to convince your app to create new windows, frames, or other renderer processes with more privileges than they had before; or with pages opened that they couldn't open before.</p>\n<p>If you have no need to create windows in addition to the ones you know you'll need to create, disabling the creation buys you a little bit of extra security at no cost. This is commonly the case for apps that open one <code>BrowserWindow</code> and do not need to open an arbitrary number of additional windows at runtime.</p>\n<h3 id=\"como-11\"><a href=\"#como-11\">Como?</a></h3>\n<p><a href=\"/docs/api/web-contents\"><code>webContents</code></a> will delegate to its <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\">window open handler</a> before creating new windows. The handler will receive, amongst other parameters, the <code>url</code> the window was requested to open and the options used to create it. We recommend that you register a handler to monitor the creation of windows, and deny any unexpected window creation.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n    <span class=\"hljs-comment\">// In this example, we'll ask the operating system</span>\n    <span class=\"hljs-comment\">// to open this event's url in the default browser.</span>\n    <span class=\"hljs-comment\">//</span>\n    <span class=\"hljs-comment\">// See the following item for considerations regarding what</span>\n    <span class=\"hljs-comment\">// URLs should be allowed through to shell.openExternal.</span>\n    <span class=\"hljs-keyword\">if</span> (isSafeForExternalOpen(url)) {\n      setImmediate(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n        shell.openExternal(url)\n      })\n    }\n\n    <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n  })\n})\n</code></pre>\n<h2 id=\"15-do-not-use-openexternal-with-untrusted-content\"><a href=\"#15-do-not-use-openexternal-with-untrusted-content\">15) Do not use <code>openExternal</code> with untrusted content</a></h2>\n<p>Shell's <a href=\"/docs/api/shell#shellopenexternalurl-options\"><code>openExternal</code></a> allows opening a given protocol URI with the desktop's native utilities. On macOS, for instance, this function is similar to the <code>open</code> terminal command utility and will open the specific application based on the URI and filetype association.</p>\n<h3 id=\"por-que-12\"><a href=\"#por-que-12\">Por que?</a></h3>\n<p>Improper use of <a href=\"/docs/api/shell#shellopenexternalurl-options\"><code>openExternal</code></a> can be leveraged to compromise the user's host. When openExternal is used with untrusted content, it can be leveraged to execute arbitrary commands.</p>\n<h3 id=\"como-12\"><a href=\"#como-12\">Como?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">//  Bad</span>\n<span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nshell.openExternal(USER_CONTROLLED_DATA_HERE)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">//  Good</span>\n<span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nshell.openExternal(<span class=\"hljs-string\">'https://example.com/index.html'</span>)\n</code></pre>\n<h2 id=\"16-use-a-current-version-of-electron\"><a href=\"#16-use-a-current-version-of-electron\">16) Use a current version of Electron</a></h2>\n<p>You should strive for always using the latest available version of Electron. Whenever a new major version is released, you should attempt to update your app as quickly as possible.</p>\n<h3 id=\"por-que-13\"><a href=\"#por-que-13\">Por que?</a></h3>\n<p>An application built with an older version of Electron, Chromium, and Node.js is an easier target than an application that is using more recent versions of those components. Generally speaking, security issues and exploits for older versions of Chromium and Node.js are more widely available.</p>\n<p>Both Chromium and Node.js are impressive feats of engineering built by thousands of talented developers. Given their popularity, their security is carefully tested and analyzed by equally skilled security researchers. Many of those researchers <a href=\"https://en.wikipedia.org/wiki/Responsible_disclosure\">disclose vulnerabilities responsibly</a>, which generally means that researchers will give Chromium and Node.js some time to fix issues before publishing them. Your application will be more secure if it is running a recent version of Electron (and thus, Chromium and Node.js) for which potential security issues are not as widely known.</p>",
      "title": "Segurança, Capacidades Nativas e Suas Responsabilidades",
      "description": "⚠️ Under no circumstances should you load and execute remote code with Node.js integration enabled. Instead, use only local files (packaged together with your application) to execute Node.js code. To display remote content, use the <webview> tag or BrowserView, make sure to disable the nodeIntegration and enable contextIsolation."
    },
    "/docs/api/structures/segmented-control-segment": {
      "locale": "pt-BR",
      "slug": "segmented-control-segment",
      "href": "/docs/api/structures/segmented-control-segment",
      "crowdinFileId": "256499",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/segmented-control-segment.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"segmentedcontrolsegment-object\"><a href=\"#segmentedcontrolsegment-object\">SegmentedControlSegment Object</a></h1>\n<ul>\n<li><code>label</code> String (optional) - The text to appear in this segment.</li>\n<li><code>icon</code> NativeImage (optional) - The image to appear in this segment.</li>\n<li><code>enabled</code> Boolean (optional) - Whether this segment is selectable. Default: true.</li>\n</ul>",
      "title": "SegmentedControlSegment Object",
      "description": ""
    },
    "/docs/api/structures/serial-port": {
      "locale": "pt-BR",
      "slug": "serial-port",
      "href": "/docs/api/structures/serial-port",
      "crowdinFileId": "256501",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/serial-port.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"serialport-object\"><a href=\"#serialport-object\">SerialPort Object</a></h1>\n<ul>\n<li><code>portId</code> String - Unique identifier for the port.</li>\n<li><code>portName</code> String - Name of the port.</li>\n<li><code>displayName</code> String - A string suitable for display to the user for describing this device.</li>\n<li><code>vendorId</code> String - Optional USB vendor ID.</li>\n<li><code>productId</code> String - Optional USB product ID.</li>\n<li><code>serialNumber</code> String - The USB device serial number.</li>\n<li><code>usbDriverName</code> String (optional) - Represents a single serial port on macOS can be enumerated by multiple drivers.</li>\n<li><code>deviceInstanceId</code> String (optional) - A stable identifier on Windows that can be used for device permissions.</li>\n</ul>",
      "title": "SerialPort Object",
      "description": ""
    },
    "/docs/api/structures/service-worker-info": {
      "locale": "pt-BR",
      "slug": "service-worker-info",
      "href": "/docs/api/structures/service-worker-info",
      "crowdinFileId": "256503",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/service-worker-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"serviceworkerinfo-object\"><a href=\"#serviceworkerinfo-object\">ServiceWorkerInfo Object</a></h1>\n<ul>\n<li><code>scriptUrl</code> String - The full URL to the script that this service worker runs</li>\n<li><code>scope</code> String - The base URL that this service worker is active for.</li>\n<li><code>renderProcessId</code> Number - The virtual ID of the process that this service worker is running in.  This is not an OS level PID.  This aligns with the ID set used for <code>webContents.getProcessId()</code>.</li>\n</ul>",
      "title": "ServiceWorkerInfo Object",
      "description": ""
    },
    "/docs/api/service-workers": {
      "locale": "pt-BR",
      "slug": "service-workers",
      "href": "/docs/api/service-workers",
      "crowdinFileId": "256363",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/service-workers.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-serviceworkers\"><a href=\"#class-serviceworkers\">Class: ServiceWorkers</a></h2>\n<blockquote>\n<p>Query and receive events from a sessions active service workers.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Instâncias da classe <code>ServiceWorkers</code> são acessadas através da propriedade <code>serviceWorkers</code> de uma <code>Sessão</code>.</p>\n<p>Como por exemplo:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Get all service workers.</span>\n<span class=\"hljs-built_in\">console</span>.log(session.defaultSession.serviceWorkers.getAllRunning())\n\n<span class=\"hljs-comment\">// Handle logs and get service worker info</span>\nsession.defaultSession.serviceWorkers.on(<span class=\"hljs-string\">'console-message'</span>, (event, messageDetails) => {\n  <span class=\"hljs-built_in\">console</span>.log(\n    <span class=\"hljs-string\">'Got service worker message'</span>,\n    messageDetails,\n    <span class=\"hljs-string\">'from'</span>,\n    session.defaultSession.serviceWorkers.getFromVersionID(messageDetails.versionId)\n  )\n})\n</code></pre>\n<h3 id=\"eventos-de-instância\"><a href=\"#eventos-de-instância\">Eventos de instância</a></h3>\n<p>Os seguintes eventos estão disponíveis em instâncias de <code>ServiceWorkers</code>:</p>\n<h4 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>messageDetails</code> Object - Information about the console message<ul>\n<li><code>message</code> String - The actual console message</li>\n<li><code>versionId</code> Number - The version ID of the service worker that sent the log message</li>\n<li><code>source</code> String - The type of source for this message.  Can be <code>javascript</code>, <code>xml</code>, <code>network</code>, <code>console-api</code>, <code>storage</code>, <code>app-cache</code>, <code>rendering</code>, <code>security</code>, <code>deprecation</code>, <code>worker</code>, <code>violation</code>, <code>intervention</code>, <code>recommendation</code> or <code>other</code>.</li>\n<li><code>level</code> Number - The log level, from 0 to 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>sourceUrl</code> String - The URL the message came from</li>\n<li><code>lineNumber</code> Number - The line number of the source that triggered this console message</li>\n</ul></li>\n</ul>\n<p>Emitted when a service worker logs something to the console.</p>\n<h4 id=\"event-registration-completed\"><a href=\"#event-registration-completed\">Event: 'registration-completed'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object - Information about the registered service worker<ul>\n<li><code>scope</code> String - The base URL that a service worker is registered for</li>\n</ul></li>\n</ul>\n<p>Emitted when a service worker has been registered. Can occur after a call to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\"><code>navigator.serviceWorker.register('/sw.js')</code></a> successfully resolves or when a Chrome extension is loaded.</p>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<p>The following methods are available on instances of <code>ServiceWorkers</code>:</p>\n<h4 id=\"serviceworkersgetallrunning\"><a href=\"#serviceworkersgetallrunning\"><code>serviceWorkers.getAllRunning()</code></a></h4>\n<p>Returns <code>Record&#x3C;Number, ServiceWorkerInfo></code> - A <a href=\"/docs/api/structures/service-worker-info\">ServiceWorkerInfo</a> object where the keys are the service worker version ID and the values are the information about that service worker.</p>\n<h4 id=\"serviceworkersgetfromversionidversionid\"><a href=\"#serviceworkersgetfromversionidversionid\"><code>serviceWorkers.getFromVersionID(versionId)</code></a></h4>\n<ul>\n<li><code>versionId</code> Number</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/service-worker-info\"><code>ServiceWorkerInfo</code></a> - Information about this service worker</p>\n<p>If the service worker does not exist or is not running this method will throw an exception.</p>",
      "title": "ServiceWorkers",
      "description": "Query and receive events from a sessions active service workers."
    },
    "/docs/api/session": {
      "locale": "pt-BR",
      "slug": "session",
      "href": "/docs/api/session",
      "crowdinFileId": "256365",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/session.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"session\"><a href=\"#session\">session</a></h1>\n<blockquote>\n<p>Manage browser sessions, cookies, cache, proxy settings, etc.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>The <code>session</code> module can be used to create new <code>Session</code> objects.</p>\n<p>You can also access the <code>session</code> of existing pages by using the <code>session</code> property of <a href=\"/docs/api/web-contents\"><code>WebContents</code></a>, or from the <code>session</code> module.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> ses = win.webContents.session\n<span class=\"hljs-built_in\">console</span>.log(ses.getUserAgent())\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>session</code> tem os seguintes métodos:</p>\n<h3 id=\"sessionfrompartitionpartition-options\"><a href=\"#sessionfrompartitionpartition-options\"><code>session.fromPartition(partition[, options])</code></a></h3>\n<ul>\n<li><code>partition</code> String</li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>cache</code> Boolean - Whether to enable cache.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Session</code> - A session instance from <code>partition</code> string. When there is an existing <code>Session</code> with the same <code>partition</code>, it will be returned; otherwise a new <code>Session</code> instance will be created with <code>options</code>.</p>\n<p>If <code>partition</code> starts with <code>persist:</code>, the page will use a persistent session available to all pages in the app with the same <code>partition</code>. if there is no <code>persist:</code> prefix, the page will use an in-memory session. If the <code>partition</code> is empty then default session of the app will be returned.</p>\n<p>To create a <code>Session</code> with <code>options</code>, you have to ensure the <code>Session</code> with the <code>partition</code> has never been used before. There is no way to change the <code>options</code> of an existing <code>Session</code> object.</p>\n<h2 id=\"propriedades\"><a href=\"#propriedades\">Propriedades</a></h2>\n<p>The <code>session</code> module has the following properties:</p>\n<h3 id=\"sessiondefaultsession\"><a href=\"#sessiondefaultsession\"><code>session.defaultsession</code></a></h3>\n<p>A <code>Session</code> object, the default session object of the app.</p>\n<h2 id=\"class-session\"><a href=\"#class-session\">Class: Session</a></h2>\n<blockquote>\n<p>Get and set properties of a session.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>You can create a <code>Session</code> object in the <code>session</code> module:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> ses = session.fromPartition(<span class=\"hljs-string\">'persist:name'</span>)\n<span class=\"hljs-built_in\">console</span>.log(ses.getUserAgent())\n</code></pre>\n<h3 id=\"eventos-de-instância\"><a href=\"#eventos-de-instância\">Eventos de instância</a></h3>\n<p>Os seguintes eventos estão disponíveis em instâncias de <code>Session</code>:</p>\n<h4 id=\"event-will-download\"><a href=\"#event-will-download\">Event: 'will-download'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>item</code> <a href=\"/docs/api/download-item\">DownloadItem</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitted when Electron is about to download <code>item</code> in <code>webContents</code>.</p>\n<p>Calling <code>event.preventDefault()</code> will cancel the download and <code>item</code> will not be available from next tick of the process.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nsession.defaultSession.on(<span class=\"hljs-string\">'will-download'</span>, (event, item, webContents) => {\n  event.preventDefault()\n  <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'got'</span>)(item.getURL()).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">response</span>) =></span> {\n    <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>).writeFileSync(<span class=\"hljs-string\">'/somewhere'</span>, response.body)\n  })\n})\n</code></pre>\n<h4 id=\"event-extension-loaded\"><a href=\"#event-extension-loaded\">Event: 'extension-loaded'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Emitted after an extension is loaded. This occurs whenever an extension is added to the \"enabled\" set of extensions. Isto inclui:</p>\n<ul>\n<li>Extensions being loaded from <code>Session.loadExtension</code>.</li>\n<li>Extensions being reloaded:<ul>\n<li>from a crash.</li>\n<li>if the extension requested it (<a href=\"https://developer.chrome.com/extensions/runtime#method-reload\"><code>chrome.runtime.reload()</code></a>).</li>\n</ul></li>\n</ul>\n<h4 id=\"event-extension-unloaded\"><a href=\"#event-extension-unloaded\">Event: 'extension-unloaded'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Emitted after an extension is unloaded. This occurs when <code>Session.removeExtension</code> is called.</p>\n<h4 id=\"event-extension-ready\"><a href=\"#event-extension-ready\">Event: 'extension-ready'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Emitted after an extension is loaded and all necessary browser state is initialized to support the start of the extension's background page.</p>\n<h4 id=\"event-preconnect\"><a href=\"#event-preconnect\">Event: 'preconnect'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preconnectUrl</code> String - The URL being requested for preconnection by the renderer.</li>\n<li><code>allowCredentials</code> Boolean - True if the renderer is requesting that the connection include credentials (see the <a href=\"https://w3c.github.io/resource-hints/#preconnect\">spec</a> for more details.)</li>\n</ul>\n<p>Emitted when a render process requests preconnection to a URL, generally due to a <a href=\"https://w3c.github.io/resource-hints/\">resource hint</a>.</p>\n<h4 id=\"event-spellcheck-dictionary-initialized\"><a href=\"#event-spellcheck-dictionary-initialized\">Event: 'spellcheck-dictionary-initialized'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file has been successfully initialized. This occurs after the file has been downloaded.</p>\n<h4 id=\"event-spellcheck-dictionary-download-begin\"><a href=\"#event-spellcheck-dictionary-download-begin\">Event: 'spellcheck-dictionary-download-begin'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file starts downloading</p>\n<h4 id=\"event-spellcheck-dictionary-download-success\"><a href=\"#event-spellcheck-dictionary-download-success\">Event: 'spellcheck-dictionary-download-success'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file has been successfully downloaded</p>\n<h4 id=\"event-spellcheck-dictionary-download-failure\"><a href=\"#event-spellcheck-dictionary-download-failure\">Event: 'spellcheck-dictionary-download-failure'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file download fails.  For details on the failure you should collect a netlog and inspect the download request.</p>\n<h4 id=\"event-select-hid-device\"><a href=\"#event-select-hid-device\">Event: 'select-hid-device'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>Objeto <code>details</code><ul>\n<li><code>deviceList</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>deviceId</code> String | null (optional)</li>\n</ul></li>\n</ul>\n<p>Emitted when a HID device needs to be selected when a call to <code>navigator.hid.requestDevice</code> is made. <code>callback</code> should be called with <code>deviceId</code> to be selected; passing no arguments to <code>callback</code> will cancel the request.  Additionally, permissioning on <code>navigator.hid</code> can be further managed by using <a href=\"#sessetpermissioncheckhandlerhandler\">ses.setPermissionCheckHandler(handler)</a> and <a href=\"#sessetdevicepermissionhandlerhandler\">ses.setDevicePermissionHandler(handler)`</a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.webContents.session.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin, details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-comment\">// Add logic here to determine if permission should be given to allow HID selection</span>\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  <span class=\"hljs-comment\">// Optionally, retrieve previously persisted devices from a persistent store</span>\n  <span class=\"hljs-keyword\">const</span> grantedDevices = fetchGrantedDevices()\n\n  win.webContents.session.setDevicePermissionHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(details.origin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; details.deviceType === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-keyword\">if</span> (details.device.vendorId === <span class=\"hljs-number\">123</span> &#x26;&#x26; details.device.productId === <span class=\"hljs-number\">345</span>) {\n        <span class=\"hljs-comment\">// Always allow this type of device (this allows skipping the call to `navigator.hid.requestDevice` first)</span>\n        <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n      }\n\n      <span class=\"hljs-comment\">// Search through the list of devices that have previously been granted permission</span>\n      <span class=\"hljs-keyword\">return</span> grantedDevices.some(<span class=\"hljs-function\">(<span class=\"hljs-params\">grantedDevice</span>) =></span> {\n        <span class=\"hljs-keyword\">return</span> grantedDevice.vendorId === details.device.vendorId &#x26;&#x26;\n              grantedDevice.productId === details.device.productId &#x26;&#x26;\n              grantedDevice.serialNumber &#x26;&#x26; grantedDevice.serialNumber === details.device.serialNumber\n      })\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  win.webContents.session.on(<span class=\"hljs-string\">'select-hid-device'</span>, (event, details, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedDevice = details.deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    callback(selectedPort?.deviceId)\n  })\n})\n</code></pre>\n<h4 id=\"event-hid-device-added\"><a href=\"#event-hid-device-added\">Event: 'hid-device-added'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>Objeto <code>details</code><ul>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n</ul>\n<p>Emitted when a new HID device becomes available. For example, when a new USB device is plugged in.</p>\n<p>This event will only be emitted after <code>navigator.hid.requestDevice</code> has been called and <code>select-hid-device</code> has fired.</p>\n<h4 id=\"event-hid-device-removed\"><a href=\"#event-hid-device-removed\">Event: 'hid-device-removed'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>Objeto <code>details</code><ul>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n</ul>\n<p>Emitted when a HID device has been removed.  For example, this event will fire when a USB device is unplugged.</p>\n<p>This event will only be emitted after <code>navigator.hid.requestDevice</code> has been called and <code>select-hid-device</code> has fired.</p>\n<h4 id=\"event-select-serial-port\"><a href=\"#event-select-serial-port\">Event: 'select-serial-port'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>portList</code> <a href=\"/docs/api/structures/serial-port\">SerialPort[]</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>portId</code> String</li>\n</ul></li>\n</ul>\n<p>Emitted when a serial port needs to be selected when a call to <code>navigator.serial.requestPort</code> is made. <code>callback</code> should be called with <code>portId</code> to be selected, passing an empty string to <code>callback</code> will cancel the request.  Additionally, permissioning on <code>navigator.serial</code> can be managed by using <a href=\"#sessetpermissioncheckhandlerhandler\">ses.setPermissionCheckHandler(handler)</a> with the <code>serial</code> permission.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n  win.webContents.session.on(<span class=\"hljs-string\">'select-serial-port'</span>, (event, portList, webContents, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedPort = portList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    <span class=\"hljs-keyword\">if</span> (!selectedPort) {\n      callback(<span class=\"hljs-string\">''</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      callback(selectedPort.portId)\n    }\n  })\n})\n</code></pre>\n<h4 id=\"event-serial-port-added\"><a href=\"#event-serial-port-added\">Event: 'serial-port-added'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>port</code> <a href=\"/docs/api/structures/serial-port\">SerialPort</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitted after <code>navigator.serial.requestPort</code> has been called and <code>select-serial-port</code> has fired if a new serial port becomes available.  For example, this event will fire when a new USB device is plugged in.</p>\n<h4 id=\"event-serial-port-removed\"><a href=\"#event-serial-port-removed\">Event: 'serial-port-removed'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>port</code> <a href=\"/docs/api/structures/serial-port\">SerialPort</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitted after <code>navigator.serial.requestPort</code> has been called and <code>select-serial-port</code> has fired if a serial port has been removed.  For example, this event will fire when a USB device is unplugged.</p>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<p>The following methods are available on instances of <code>Session</code>:</p>\n<h4 id=\"sesgetcachesize\"><a href=\"#sesgetcachesize\"><code>ses.getCacheSize()</code></a></h4>\n<p>Returns <code>Promise&#x3C;Integer></code> - the session's current cache size, in bytes.</p>\n<h4 id=\"sesclearcache\"><a href=\"#sesclearcache\"><code>ses.clearCache()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the cache clear operation is complete.</p>\n<p>Clears the session’s HTTP cache.</p>\n<h4 id=\"sesclearstoragedataoptions\"><a href=\"#sesclearstoragedataoptions\"><code>ses.clearStorageData([options])</code></a></h4>\n<ul>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>origin</code> String (optional) - Should follow <code>window.location.origin</code>’s representation <code>scheme://host:port</code>.</li>\n<li><code>storages</code> String<a href=\"/docs/api/optional\"></a> - The types of storages to clear, can contain: <code>appcache</code>, <code>cookies</code>, <code>filesystem</code>, <code>indexdb</code>, <code>localstorage</code>, <code>shadercache</code>, <code>websql</code>, <code>serviceworkers</code>, <code>cachestorage</code>. If not specified, clear all storage types.</li>\n<li><code>quotas</code> String<a href=\"/docs/api/optional\"></a> - The types of quotas to clear, can contain: <code>temporary</code>, <code>persistent</code>, <code>syncable</code>. If not specified, clear all quotas.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the storage data has been cleared.</p>\n<h4 id=\"sesflushstoragedata\"><a href=\"#sesflushstoragedata\"><code>ses.flushStorageData()</code></a></h4>\n<p>Writes any unwritten DOMStorage data to disk.</p>\n<h4 id=\"sessetproxyconfig\"><a href=\"#sessetproxyconfig\"><code>ses.setProxy(config)</code></a></h4>\n<ul>\n<li><code>config</code> Object<ul>\n<li><code>mode</code> String (optional) - The proxy mode. Should be one of <code>direct</code>, <code>auto_detect</code>, <code>pac_script</code>, <code>fixed_servers</code> or <code>system</code>. If it's unspecified, it will be automatically determined based on other specified options.<ul>\n<li><code>direct</code> In direct mode all connections are created directly, without any proxy involved.</li>\n<li><code>auto_detect</code> In auto_detect mode the proxy configuration is determined by a PAC script that can be downloaded at <a href=\"http://wpad/wpad.dat\">http://wpad/wpad.dat</a>.</li>\n<li><code>pac_script</code> In pac_script mode the proxy configuration is determined by a PAC script that is retrieved from the URL specified in the <code>pacScript</code>. This is the default mode if <code>pacScript</code> is specified.</li>\n<li><code>fixed_servers</code> In fixed_servers mode the proxy configuration is specified in <code>proxyRules</code>. This is the default mode if <code>proxyRules</code> is specified.</li>\n<li><code>system</code> In system mode the proxy configuration is taken from the operating system. Note that the system mode is different from setting no proxy configuration. In the latter case, Electron falls back to the system settings only if no command-line options influence the proxy configuration.</li>\n</ul></li>\n<li><code>pacScript</code> String (optional) - The URL associated with the PAC file.</li>\n<li><code>proxyRules</code> String (optional) - Rules indicating which proxies to use.</li>\n<li><code>proxyBypassRules</code> String (optional) - Rules indicating which URLs should bypass the proxy settings.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the proxy setting process is complete.</p>\n<p>Sets the proxy settings.</p>\n<p>When <code>mode</code> is unspecified, <code>pacScript</code> and <code>proxyRules</code> are provided together, the <code>proxyRules</code> option is ignored and <code>pacScript</code> configuration is applied.</p>\n<p>You may need <code>ses.closeAllConnections</code> to close currently in flight connections to prevent pooled sockets using previous proxy from being reused by future requests.</p>\n<p>The <code>proxyRules</code> has to follow the rules below:</p>\n<pre><code class=\"hljs language-sh\">proxyRules = schemeProxies[<span class=\"hljs-string\">\";\"</span>&#x3C;schemeProxies>]\nschemeProxies = [&#x3C;urlScheme><span class=\"hljs-string\">\"=\"</span>]&#x3C;proxyURIList>\nurlScheme = <span class=\"hljs-string\">\"http\"</span> | <span class=\"hljs-string\">\"https\"</span> | <span class=\"hljs-string\">\"ftp\"</span> | <span class=\"hljs-string\">\"socks\"</span>\nproxyURIList = &#x3C;proxyURL>[<span class=\"hljs-string\">\",\"</span>&#x3C;proxyURIList>]\nproxyURL = [&#x3C;proxyScheme><span class=\"hljs-string\">\"://\"</span>]&#x3C;proxyHost>[<span class=\"hljs-string\">\":\"</span>&#x3C;proxyPort>]\n</code></pre>\n<p>Como por exemplo:</p>\n<ul>\n<li><code>http=foopy:80;ftp=foopy2</code> - Use HTTP proxy <code>foopy:80</code> for <code>http://</code> URLs, and HTTP proxy <code>foopy2:80</code> for <code>ftp://</code> URLs.</li>\n<li><code>foopy:80</code> - Use HTTP proxy <code>foopy:80</code> for all URLs.</li>\n<li><code>foopy:80,bar,direct://</code> - Use HTTP proxy <code>foopy:80</code> for all URLs, failing over to <code>bar</code> if <code>foopy:80</code> is unavailable, and after that using no proxy.</li>\n<li><code>socks4://foopy</code> - Use SOCKS v4 proxy <code>foopy:1080</code> for all URLs.</li>\n<li><code>http=foopy,socks5://bar.com</code> - Use HTTP proxy <code>foopy</code> for http URLs, and fail over to the SOCKS5 proxy <code>bar.com</code> if <code>foopy</code> is unavailable.</li>\n<li><code>http=foopy,direct://</code> - Use HTTP proxy <code>foopy</code> for http URLs, and use no proxy if <code>foopy</code> is unavailable.</li>\n<li><code>http=foopy;socks=foopy2</code> - Use HTTP proxy <code>foopy</code> for http URLs, and use <code>socks4://foopy2</code> for all other URLs.</li>\n</ul>\n<p>The <code>proxyBypassRules</code> is a comma separated list of rules described below:</p>\n<ul>\n<li>\n<p><code>[ URL_SCHEME \"://\" ] HOSTNAME_PATTERN [ \":\" &#x3C;port> ]</code></p>\n<p> Match all hostnames that match the pattern HOSTNAME_PATTERN.</p>\n<p> Examples: \"foobar.com\", \"<em>foobar.com\", \"</em>.foobar.com\", \"<em>foobar.com:99\", \"<a href=\"https://x\">https://x</a>.</em>.y.com:99\"</p>\n</li>\n<li>\n<p><code>\".\" HOSTNAME_SUFFIX_PATTERN [ \":\" PORT ]</code></p>\n<p> Match a particular domain suffix.</p>\n<p> Examples: \".google.com\", \".com\", \"<a href=\"http://.google.com\">http://.google.com</a>\"</p>\n</li>\n<li>\n<p><code>[ SCHEME \"://\" ] IP_LITERAL [ \":\" PORT ]</code></p>\n<p> Match URLs which are IP address literals.</p>\n<p> Examples: \"127.0.1\", \"[0:0::1]\", \"[::1]\", \"<a href=\"http://%5B::1%5D:99\">http://[::1]:99</a>\"</p>\n</li>\n<li>\n<p><code>IP_LITERAL \"/\" PREFIX_LENGTH_IN_BITS</code></p>\n<p> Match any URL that is to an IP literal that falls between the given range. IP range is specified using CIDR notation.</p>\n<p> Examples: \"192.168.1.1/16\", \"fefe:13::abc/33\".</p>\n</li>\n<li>\n<p><code>&#x3C;local></code></p>\n<p> Match local addresses. The meaning of <code>&#x3C;local></code> is whether the host matches one of: \"127.0.0.1\", \"::1\", \"localhost\".</p>\n</li>\n</ul>\n<h4 id=\"sesresolveproxyurl\"><a href=\"#sesresolveproxyurl\"><code>ses.resolveProxy(url)</code></a></h4>\n<ul>\n<li><code>url</code> URL</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - Resolves with the proxy information for <code>url</code>.</p>\n<h4 id=\"sesforcereloadproxyconfig\"><a href=\"#sesforcereloadproxyconfig\"><code>ses.forceReloadProxyConfig()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the all internal states of proxy service is reset and the latest proxy configuration is reapplied if it's already available. The pac script will be fetched from <code>pacScript</code> again if the proxy mode is <code>pac_script</code>.</p>\n<h4 id=\"sessetdownloadpathpath\"><a href=\"#sessetdownloadpathpath\"><code>ses.setDownloadPath(path)</code></a></h4>\n<ul>\n<li><code>path</code> String - The download location.</li>\n</ul>\n<p>Sets download saving directory. By default, the download directory will be the <code>Downloads</code> under the respective app folder.</p>\n<h4 id=\"sesenablenetworkemulationoptions\"><a href=\"#sesenablenetworkemulationoptions\"><code>ses.enableNetworkEmulation(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>offline</code> Boolean (optional) - Whether to emulate network outage. Defaults to false.</li>\n<li><code>latency</code> Double (optional) - RTT in ms. Defaults to 0 which will disable latency throttling.</li>\n<li><code>downloadThroughput</code> Double (optional) - Download rate in Bps. Defaults to 0 which will disable download throttling.</li>\n<li><code>uploadThroughput</code> Double (optional) - Upload rate in Bps. Defaults to 0 which will disable upload throttling.</li>\n</ul></li>\n</ul>\n<p>Emulates network with the given configuration for the <code>session</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// To emulate a GPRS connection with 50kbps throughput and 500 ms latency.</span>\n<span class=\"hljs-built_in\">window</span>.webContents.session.enableNetworkEmulation({\n  <span class=\"hljs-attr\">latency</span>: <span class=\"hljs-number\">500</span>,\n  <span class=\"hljs-attr\">downloadThroughput</span>: <span class=\"hljs-number\">6400</span>,\n  <span class=\"hljs-attr\">uploadThroughput</span>: <span class=\"hljs-number\">6400</span>\n})\n\n<span class=\"hljs-comment\">// To emulate a network outage.</span>\n<span class=\"hljs-built_in\">window</span>.webContents.session.enableNetworkEmulation({ <span class=\"hljs-attr\">offline</span>: <span class=\"hljs-literal\">true</span> })\n</code></pre>\n<h4 id=\"sespreconnectoptions\"><a href=\"#sespreconnectoptions\"><code>ses.preconnect(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>url</code> String - URL for preconnect. Only the origin is relevant for opening the socket.</li>\n<li><code>numSockets</code> Number (optional) - number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.</li>\n</ul></li>\n</ul>\n<p>Preconnects the given number of sockets to an origin.</p>\n<h4 id=\"sescloseallconnections\"><a href=\"#sescloseallconnections\"><code>ses.closeAllConnections()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when all connections are closed.</p>\n<p><strong>Note:</strong> It will terminate / fail all requests currently in flight.</p>\n<h4 id=\"sesdisablenetworkemulation\"><a href=\"#sesdisablenetworkemulation\"><code>ses.disableNetworkEmulation()</code></a></h4>\n<p>Disables any network emulation already active for the <code>session</code>. Resets to the original network configuration.</p>\n<h4 id=\"sessetcertificateverifyprocproc\"><a href=\"#sessetcertificateverifyprocproc\"><code>ses.setCertificateVerifyProc(proc)</code></a></h4>\n<ul>\n<li><code>proc</code> Function | null<ul>\n<li><code>request</code> Object<ul>\n<li><code>hostname</code> String</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>validatedCertificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>verificationResult</code> String - Verification result from chromium.</li>\n<li><code>errorCode</code> Integer - Error code.</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>verificationResult</code> Integer - Value can be one of certificate error codes from <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">here</a>. Apart from the certificate error codes, the following special codes can be used.<ul>\n<li><code>0</code> - Indicates success and disables Certificate Transparency verification.</li>\n<li><code>-2</code> - Indicates failure.</li>\n<li><code>-3</code> - Uses the verification result from chromium.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Sets the certificate verify proc for <code>session</code>, the <code>proc</code> will be called with <code>proc(request, callback)</code> whenever a server certificate verification is requested. Calling <code>callback(0)</code> accepts the certificate, calling <code>callback(-2)</code> rejects it.</p>\n<p>Calling <code>setCertificateVerifyProc(null)</code> will revert back to default certificate verify proc.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.webContents.session.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">request, callback</span>) =></span> {\n  <span class=\"hljs-keyword\">const</span> { hostname } = request\n  <span class=\"hljs-keyword\">if</span> (hostname === <span class=\"hljs-string\">'github.com'</span>) {\n    callback(<span class=\"hljs-number\">0</span>)\n  } <span class=\"hljs-keyword\">else</span> {\n    callback(<span class=\"hljs-number\">-2</span>)\n  }\n})\n</code></pre>\n<blockquote>\n<p><strong>NOTE:</strong> The result of this procedure is cached by the network service.</p>\n</blockquote>\n<h4 id=\"sessetpermissionrequesthandlerhandler\"><a href=\"#sessetpermissionrequesthandlerhandler\"><code>ses.setPermissionRequestHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Function | null<ul>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a> - WebContents requesting the permission.  Please note that if the request comes from a subframe you should use <code>requestingUrl</code> to check the request origin.</li>\n<li><code>permission</code> String - The type of requested permission.<ul>\n<li><code>clipboard-read</code> - Request access to read from the clipboard.</li>\n<li><code>media</code> -  Request access to media devices such as camera, microphone and speakers.</li>\n<li><code>display-capture</code> - Request access to capture the screen.</li>\n<li><code>mediaKeySystem</code> - Request access to DRM protected content.</li>\n<li><code>geolocation</code> - Request access to user's current location.</li>\n<li><code>notifications</code> - Request notification creation and the ability to display them in the user's system tray.</li>\n<li><code>midi</code> - Request MIDI access in the <code>webmidi</code> API.</li>\n<li><code>midiSysex</code> - Request the use of system exclusive messages in the <code>webmidi</code> API.</li>\n<li><code>pointerLock</code> - Request to directly interpret mouse movements as an input method. Click <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API\">here</a> to know more.</li>\n<li><code>fullscreen</code> - Request for the app to enter fullscreen mode.</li>\n<li><code>openExternal</code> - Request to open links in external applications.</li>\n<li><code>unknown</code> - An unrecognized permission request</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>permissionGranted</code> Boolean - Allow or deny the permission.</li>\n</ul></li>\n<li><code>details</code> Object - Some properties are only available on certain permission types.<ul>\n<li><code>externalURL</code> String (optional) - The url of the <code>openExternal</code> request.</li>\n<li><code>mediaTypes</code> String<a href=\"/docs/api/optional\"></a> - The types of media access being requested, elements can be <code>video</code> or <code>audio</code></li>\n<li><code>requestingUrl</code> String - The last URL the requesting frame loaded</li>\n<li><code>isMainFrame</code> Boolean - Whether the frame making the request is the main frame</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Sets the handler which can be used to respond to permission requests for the <code>session</code>. Calling <code>callback(true)</code> will allow the permission and <code>callback(false)</code> will reject it. To clear the handler, call <code>setPermissionRequestHandler(null)</code>.  Please note that you must also implement <code>setPermissionCheckHandler</code> to get complete permission handling. Most web APIs do a permission check and then make a permission request if the check is denied.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nsession.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).setPermissionRequestHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, callback</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (webContents.getURL() === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notifications'</span>) {\n    <span class=\"hljs-keyword\">return</span> callback(<span class=\"hljs-literal\">false</span>) <span class=\"hljs-comment\">// denied.</span>\n  }\n\n  callback(<span class=\"hljs-literal\">true</span>)\n})\n</code></pre>\n<h4 id=\"sessetpermissioncheckhandlerhandler\"><a href=\"#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Função\\<boolean> | null<ul>\n<li><code>webContents</code> (<a href=\"/docs/api/web-contents\">WebContents</a> | null) - WebContents checking the permission.  Please note that if the request comes from a subframe you should use <code>requestingUrl</code> to check the request origin.  All cross origin sub frames making permission checks will pass a <code>null</code> webContents to this handler, while certain other permission checks such as <code>notifications</code> checks will always pass <code>null</code>.  You should use <code>embeddingOrigin</code> and <code>requestingOrigin</code> to determine what origin the owning frame and the requesting frame are on respectively.</li>\n<li><code>permission</code> String - Type of permission check.  Valid values are <code>midiSysex</code>, <code>notifications</code>, <code>geolocation</code>, <code>media</code>,<code>mediaKeySystem</code>,<code>midi</code>, <code>pointerLock</code>, <code>fullscreen</code>, <code>openExternal</code>, <code>hid</code>, or <code>serial</code>.</li>\n<li><code>requestingOrigin</code> String - The origin URL of the permission check</li>\n<li><code>details</code> Object - Some properties are only available on certain permission types.<ul>\n<li><code>embeddingOrigin</code> String (optional) - The origin of the frame embedding the frame that made the permission check.  Only set for cross-origin sub frames making permission checks.</li>\n<li><code>securityOrigin</code> String (optional) - The security origin of the <code>media</code> check.</li>\n<li><code>mediaType</code> String (optional) - The type of media access being requested, can be <code>video</code>, <code>audio</code> or <code>unknown</code></li>\n<li><code>requestingUrl</code> String (optional) - The last URL the requesting frame loaded.  This is not provided for cross-origin sub frames making permission checks.</li>\n<li><code>isMainFrame</code> Boolean - Whether the frame making the request is the main frame</li>\n</ul></li>\n</ul></boolean></li>\n</ul>\n<p>Sets the handler which can be used to respond to permission checks for the <code>session</code>. Returning <code>true</code> will allow the permission and <code>false</code> will reject it.  Please note that you must also implement <code>setPermissionRequestHandler</code> to get complete permission handling. Most web APIs do a permission check and then make a permission request if the check is denied. To clear the handler, call <code>setPermissionCheckHandler(null)</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>)\nsession.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(requestingOrigin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notifications'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span> <span class=\"hljs-comment\">// granted</span>\n  }\n\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span> <span class=\"hljs-comment\">// denied</span>\n})\n</code></pre>\n<h4 id=\"sessetdevicepermissionhandlerhandler\"><a href=\"#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Função\\<boolean> | null<ul>\n<li>Objeto <code>details</code><ul>\n<li><code>deviceType</code> String - The type of device that permission is being requested on, can be <code>hid</code>.</li>\n<li><code>origin</code> String - The origin URL of the device permission check.</li>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice</a> - the device that permission is being requested for.</li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a> - WebFrameMain checking the device permission.</li>\n</ul></li>\n</ul></boolean></li>\n</ul>\n<p>Sets the handler which can be used to respond to device permission checks for the <code>session</code>. Returning <code>true</code> will allow the device to be permitted and <code>false</code> will reject it. To clear the handler, call <code>setDevicePermissionHandler(null)</code>. This handler can be used to provide default permissioning to devices without first calling for permission to devices (eg via <code>navigator.hid.requestDevice</code>).  If this handler is not defined, the default device permissions as granted through device selection (eg via <code>navigator.hid.requestDevice</code>) will be used. Additionally, the default behavior of Electron is to store granted device permision through the lifetime of the corresponding WebContents.  If longer term storage is needed, a developer can store granted device permissions (eg when handling the <code>select-hid-device</code> event) and then read from that storage with <code>setDevicePermissionHandler</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.webContents.session.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin, details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-comment\">// Add logic here to determine if permission should be given to allow HID selection</span>\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  <span class=\"hljs-comment\">// Optionally, retrieve previously persisted devices from a persistent store</span>\n  <span class=\"hljs-keyword\">const</span> grantedDevices = fetchGrantedDevices()\n\n  win.webContents.session.setDevicePermissionHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(details.origin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; details.deviceType === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-keyword\">if</span> (details.device.vendorId === <span class=\"hljs-number\">123</span> &#x26;&#x26; details.device.productId === <span class=\"hljs-number\">345</span>) {\n        <span class=\"hljs-comment\">// Always allow this type of device (this allows skipping the call to `navigator.hid.requestDevice` first)</span>\n        <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n      }\n\n      <span class=\"hljs-comment\">// Search through the list of devices that have previously been granted permission</span>\n      <span class=\"hljs-keyword\">return</span> grantedDevices.some(<span class=\"hljs-function\">(<span class=\"hljs-params\">grantedDevice</span>) =></span> {\n        <span class=\"hljs-keyword\">return</span> grantedDevice.vendorId === details.device.vendorId &#x26;&#x26;\n              grantedDevice.productId === details.device.productId &#x26;&#x26;\n              grantedDevice.serialNumber &#x26;&#x26; grantedDevice.serialNumber === details.device.serialNumber\n      })\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  win.webContents.session.on(<span class=\"hljs-string\">'select-hid-device'</span>, (event, details, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedDevice = details.deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    callback(selectedPort?.deviceId)\n  })\n})\n</code></pre>\n<h4 id=\"sesclearhostresolvercache\"><a href=\"#sesclearhostresolvercache\"><code>ses.clearHostResolverCache()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the operation is complete.</p>\n<p>Clears the host resolver cache.</p>\n<h4 id=\"sesallowntlmcredentialsfordomainsdomains\"><a href=\"#sesallowntlmcredentialsfordomainsdomains\"><code>ses.allowNTLMCredentialsForDomains(domains)</code></a></h4>\n<ul>\n<li><code>domains</code> String - A comma-separated list of servers for which integrated authentication is enabled.</li>\n</ul>\n<p>Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate authentication.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">// consider any url ending with `example.com`, `foobar.com`, `baz`</span>\n<span class=\"hljs-comment\">// for integrated authentication.</span>\nsession.defaultSession.allowNTLMCredentialsForDomains(<span class=\"hljs-string\">'*example.com, *foobar.com, *baz'</span>)\n\n<span class=\"hljs-comment\">// consider all urls for integrated authentication.</span>\nsession.defaultSession.allowNTLMCredentialsForDomains(<span class=\"hljs-string\">'*'</span>)\n</code></pre>\n<h4 id=\"sessetuseragentuseragent-acceptlanguages\"><a href=\"#sessetuseragentuseragent-acceptlanguages\"><code>ses.setUserAgent(userAgent[, acceptLanguages])</code></a></h4>\n<ul>\n<li><code>userAgent</code> String</li>\n<li><code>acceptLanguages</code> String (opcional)</li>\n</ul>\n<p>Overrides the <code>userAgent</code> and <code>acceptLanguages</code> for this session.</p>\n<p>The <code>acceptLanguages</code> must a comma separated ordered list of language codes, for example <code>\"en-US,fr,de,ko,zh-CN,ja\"</code>.</p>\n<p>This doesn't affect existing <code>WebContents</code>, and each <code>WebContents</code> can use <code>webContents.setUserAgent</code> to override the session-wide user agent.</p>\n<h4 id=\"sesispersistent\"><a href=\"#sesispersistent\"><code>ses.isPersistent()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether or not this session is a persistent one. The default <code>webContents</code> session of a <code>BrowserWindow</code> is persistent. When creating a session from a partition, session prefixed with <code>persist:</code> will be persistent, while others will be temporary.</p>\n<h4 id=\"sesgetuseragent\"><a href=\"#sesgetuseragent\"><code>ses.getUserAgent()</code></a></h4>\n<p>Returns <code>String</code> - The user agent for this session.</p>\n<h4 id=\"sessetsslconfigconfig\"><a href=\"#sessetsslconfigconfig\"><code>ses.setSSLConfig(config)</code></a></h4>\n<ul>\n<li><code>config</code> Object<ul>\n<li><code>minVersion</code> String (optional) - Can be <code>tls1</code>, <code>tls1.1</code>, <code>tls1.2</code> or <code>tls1.3</code>. The minimum SSL version to allow when connecting to remote servers. Padrão sendo <code>tls1</code>.</li>\n<li><code>maxVersion</code> String (optional) - Can be <code>tls1.2</code> or <code>tls1.3</code>. The maximum SSL version to allow when connecting to remote servers. O padrão é <code>tls1.3</code>.</li>\n<li><code>disabledCipherSuites</code> Integer<a href=\"/docs/api/optional\"></a> - List of cipher suites which should be explicitly prevented from being used in addition to those disabled by the net built-in policy. Supported literal forms: 0xAABB, where AA is <code>cipher_suite[0]</code> and BB is <code>cipher_suite[1]</code>, as defined in RFC 2246, Section 7.4.1.2. Unrecognized but parsable cipher suites in this form will not return an error. Ex: To disable TLS_RSA_WITH_RC4_128_MD5, specify 0x0004, while to disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002. Note that TLSv1.3 ciphers cannot be disabled using this mechanism.</li>\n</ul></li>\n</ul>\n<p>Sets the SSL configuration for the session. All subsequent network requests will use the new configuration. Existing network connections (such as WebSocket connections) will not be terminated, but old sockets in the pool will not be reused for new connections.</p>\n<h4 id=\"sesgetblobdataidentifier\"><a href=\"#sesgetblobdataidentifier\"><code>ses.getBlobData(identifier)</code></a></h4>\n<ul>\n<li><code>identifier</code> String - Valid UUID.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Buffer></code> - resolves with blob data.</p>\n<h4 id=\"sesdownloadurlurl\"><a href=\"#sesdownloadurlurl\"><code>ses.downloadURL(url)</code></a></h4>\n<ul>\n<li>String <code>url</code></li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code>. The API will generate a <a href=\"/docs/api/download-item\">DownloadItem</a> that can be accessed with the <a href=\"#event-will-download\">will-download</a> event.</p>\n<p><strong>Note:</strong> This does not perform any security checks that relate to a page's origin, unlike <a href=\"/docs/api/web-contents#contentsdownloadurlurl\"><code>webContents.downloadURL</code></a>.</p>\n<h4 id=\"sescreateinterrupteddownloadoptions\"><a href=\"#sescreateinterrupteddownloadoptions\"><code>ses.createInterruptedDownload(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>path</code> String - Absolute path of the download.</li>\n<li><code>urlChain</code> String[] - Complete URL chain for the download.</li>\n<li><code>mimeType</code> String (opcional)</li>\n<li><code>offset</code> Integer - Start range for the download.</li>\n<li><code>length</code> Integer - Total length of the download.</li>\n<li><code>lastModified</code> String (optional) - Last-Modified header value.</li>\n<li><code>eTag</code> String (optional) - ETag header value.</li>\n<li><code>startTime</code> Double (optional) - Time when download was started in number of seconds since UNIX epoch.</li>\n</ul></li>\n</ul>\n<p>Allows resuming <code>cancelled</code> or <code>interrupted</code> downloads from previous <code>Session</code>. The API will generate a <a href=\"/docs/api/download-item\">DownloadItem</a> that can be accessed with the <a href=\"#event-will-download\">will-download</a> event. The <a href=\"/docs/api/download-item\">DownloadItem</a> will not have any <code>WebContents</code> associated with it and the initial state will be <code>interrupted</code>. The download will start only when the <code>resume</code> API is called on the <a href=\"/docs/api/download-item\">DownloadItem</a>.</p>\n<h4 id=\"sesclearauthcache\"><a href=\"#sesclearauthcache\"><code>ses.clearAuthCache()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the session’s HTTP authentication cache has been cleared.</p>\n<h4 id=\"sessetpreloadspreloads\"><a href=\"#sessetpreloadspreloads\"><code>ses.setPreloads(preloads)</code></a></h4>\n<ul>\n<li><code>preloads</code> String[] - An array of absolute path to preload scripts</li>\n</ul>\n<p>Adds scripts that will be executed on ALL web contents that are associated with this session just before normal <code>preload</code> scripts run.</p>\n<h4 id=\"sesgetpreloads\"><a href=\"#sesgetpreloads\"><code>ses.getPreloads()</code></a></h4>\n<p>Returns <code>String[]</code> an array of paths to preload scripts that have been registered.</p>\n<h4 id=\"sessetspellcheckerenabledenable\"><a href=\"#sessetspellcheckerenabledenable\"><code>ses.setSpellCheckerEnabled(enable)</code></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Sets whether to enable the builtin spell checker.</p>\n<h4 id=\"sesisspellcheckerenabled\"><a href=\"#sesisspellcheckerenabled\"><code>ses.isSpellCheckerEnabled()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the builtin spell checker is enabled.</p>\n<h4 id=\"sessetspellcheckerlanguageslanguages\"><a href=\"#sessetspellcheckerlanguageslanguages\"><code>ses.setSpellCheckerLanguages(languages)</code></a></h4>\n<ul>\n<li><code>languages</code> String[] - An array of language codes to enable the spellchecker for.</li>\n</ul>\n<p>The built in spellchecker does not automatically detect what language a user is typing in.  In order for the spell checker to correctly check their words you must call this API with an array of language codes.  You can get the list of supported language codes with the <code>ses.availableSpellCheckerLanguages</code> property.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and will detect your language automatically.  This API is a no-op on macOS.</p>\n<h4 id=\"sesgetspellcheckerlanguages\"><a href=\"#sesgetspellcheckerlanguages\"><code>ses.getSpellCheckerLanguages()</code></a></h4>\n<p>Returns <code>String[]</code> - An array of language codes the spellchecker is enabled for.  If this list is empty the spellchecker will fallback to using <code>en-US</code>.  By default on launch if this setting is an empty list Electron will try to populate this setting with the current OS locale.  This setting is persisted across restarts.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and has its own list of languages.  This API is a no-op on macOS.</p>\n<h4 id=\"sessetspellcheckerdictionarydownloadurlurl\"><a href=\"#sessetspellcheckerdictionarydownloadurlurl\"><code>ses.setSpellCheckerDictionaryDownloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String - A base URL for Electron to download hunspell dictionaries from.</li>\n</ul>\n<p>By default Electron will download hunspell dictionaries from the Chromium CDN.  If you want to override this behavior you can use this API to point the dictionary downloader at your own hosted version of the hunspell dictionaries.  We publish a <code>hunspell_dictionaries.zip</code> file with each release which contains the files you need to host here, the file server must be <strong>case insensitive</strong> you must upload each file twice, once with the case it has in the ZIP file and once with the filename as all lower case.</p>\n<p>Se os arquivos presentes em <code>hunspell_dictionaries.zip</code> estiverem disponíveis em <code>https://example.com/dictionaries/language-code.bdic</code> então você deve chamar esta api com <code>ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')</code>.  Tome atenção à barra no final.  A URL para os dicionários é formada como <code>${url}${filename}</code>.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and therefore we do not download any dictionary files.  This API is a no-op on macOS.</p>\n<h4 id=\"seslistwordsinspellcheckerdictionary\"><a href=\"#seslistwordsinspellcheckerdictionary\"><code>ses.listWordsInSpellCheckerDictionary()</code></a></h4>\n<p>Returns <code>Promise&#x3C;String[]></code> - An array of all words in app's custom dictionary. Resolves when the full dictionary is loaded from disk.</p>\n<h4 id=\"sesaddwordtospellcheckerdictionaryword\"><a href=\"#sesaddwordtospellcheckerdictionaryword\"><code>ses.addWordToSpellCheckerDictionary(word)</code></a></h4>\n<ul>\n<li><code>word</code> String - The word you want to add to the dictionary</li>\n</ul>\n<p>Retorna <code>Boolean</code> - Se a palavra foi escrita com sucesso no dicionário personalizado. This API will not work on non-persistent (in-memory) sessions.</p>\n<p><strong>Nota:</strong> No macOS e Windows 10, esta palavra será escrita também no dicionário personalizado do sistema operacional</p>\n<h4 id=\"sesremovewordfromspellcheckerdictionaryword\"><a href=\"#sesremovewordfromspellcheckerdictionaryword\"><code>ses.removeWordFromSpellCheckerDictionary(word)</code></a></h4>\n<ul>\n<li><code>word</code> String - The word you want to remove from the dictionary</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the word was successfully removed from the custom dictionary. This API will not work on non-persistent (in-memory) sessions.</p>\n<p><strong>Note:</strong> On macOS and Windows 10 this word will be removed from the OS custom dictionary as well</p>\n<h4 id=\"sesloadextensionpath-options\"><a href=\"#sesloadextensionpath-options\"><code>ses.loadExtension(path[, options])</code></a></h4>\n<ul>\n<li><code>path</code> String - Path to a directory containing an unpacked Chrome extension</li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>allowFileAccess</code> Boolean - Whether to allow the extension to read local files over <code>file://</code> protocol and inject content scripts into <code>file://</code> pages. This is required e.g. for loading devtools extensions on <code>file://</code> URLs. Defaults to false.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Extension></code> - resolves when the extension is loaded.</p>\n<p>This method will raise an exception if the extension could not be loaded. If there are warnings when installing the extension (e.g. if the extension requests an API that Electron does not support) then they will be logged to the console.</p>\n<p>Note that Electron does not support the full range of Chrome extensions APIs. See <a href=\"/docs/api/extensions#supported-extensions-apis\">Supported Extensions APIs</a> for more details on what is supported.</p>\n<p>Note that in previous versions of Electron, extensions that were loaded would be remembered for future runs of the application. This is no longer the case: <code>loadExtension</code> must be called on every boot of your app if you want the extension to be loaded.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.on(<span class=\"hljs-string\">'ready'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> session.defaultSession.loadExtension(\n    path.join(__dirname, <span class=\"hljs-string\">'react-devtools'</span>),\n    <span class=\"hljs-comment\">// allowFileAccess is required to load the devtools extension on file:// URLs.</span>\n    { <span class=\"hljs-attr\">allowFileAccess</span>: <span class=\"hljs-literal\">true</span> }\n  )\n  <span class=\"hljs-comment\">// Note that in order to use the React DevTools extension, you'll need to</span>\n  <span class=\"hljs-comment\">// download and unzip a copy of the extension.</span>\n})\n</code></pre>\n<p>This API does not support loading packed (.crx) extensions.</p>\n<p><strong>Note:</strong> This API cannot be called before the <code>ready</code> event of the <code>app</code> module is emitted.</p>\n<p><strong>Note:</strong> Loading extensions into in-memory (non-persistent) sessions is not supported and will throw an error.</p>\n<h4 id=\"sesremoveextensionextensionid\"><a href=\"#sesremoveextensionextensionid\"><code>ses.removeExtension(extensionId)</code></a></h4>\n<ul>\n<li><code>extensionId</code> String - ID of extension to remove</li>\n</ul>\n<p>Unloads an extension.</p>\n<p><strong>Note:</strong> This API cannot be called before the <code>ready</code> event of the <code>app</code> module is emitted.</p>\n<h4 id=\"sesgetextensionextensionid\"><a href=\"#sesgetextensionextensionid\"><code>ses.getExtension(extensionId)</code></a></h4>\n<ul>\n<li><code>extensionId</code> String - ID of extension to query</li>\n</ul>\n<p>Returns <code>Extension</code> | <code>null</code> - The loaded extension with the given ID.</p>\n<p><strong>Note:</strong> This API cannot be called before the <code>ready</code> event of the <code>app</code> module is emitted.</p>\n<h4 id=\"sesgetallextensions\"><a href=\"#sesgetallextensions\"><code>ses.getAllExtensions()</code></a></h4>\n<p>Returns <code>Extension[]</code> - A list of all loaded extensions.</p>\n<p><strong>Note:</strong> This API cannot be called before the <code>ready</code> event of the <code>app</code> module is emitted.</p>\n<h4 id=\"sesgetstoragepath\"><a href=\"#sesgetstoragepath\"><code>ses.getStoragePath()</code></a></h4>\n<p>A <code>String | null</code> indicating the absolute file system path where data for this session is persisted on disk.  For in memory sessions this returns <code>null</code>.</p>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<p>As seguintes propriedades estão disponíveis em instâncias de <code>Session</code>:</p>\n<h4 id=\"sesavailablespellcheckerlanguages-readonly\"><a href=\"#sesavailablespellcheckerlanguages-readonly\"><code>ses.availableSpellCheckerLanguages</code> <em>Readonly</em></a></h4>\n<p>Uma matriz <code>String[]</code> que consiste em todas as linguagens de correção ortográfica disponíveis.  Fornecer um código de idioma para a API <code>setSpellCheckerLanguages</code> que não está nesta matriz resultará em um erro.</p>\n<h4 id=\"sesspellcheckerenabled\"><a href=\"#sesspellcheckerenabled\"><code>ses.spellCheckerEnabled</code></a></h4>\n<p>A <code>Boolean</code> indicating whether builtin spell checker is enabled.</p>\n<h4 id=\"sesstoragepath-readonly\"><a href=\"#sesstoragepath-readonly\"><code>ses.storagePath</code> <em>Readonly</em></a></h4>\n<p>A <code>String | null</code> indicating the absolute file system path where data for this session is persisted on disk.  For in memory sessions this returns <code>null</code>.</p>\n<h4 id=\"sescookies-readonly\"><a href=\"#sescookies-readonly\"><code>ses.cookies</code> <em>Readonly</em></a></h4>\n<p>Um objeto <a href=\"/docs/api/cookies\"><code>Cookies</code></a> para esta sessão.</p>\n<h4 id=\"sesserviceworkers-readonly\"><a href=\"#sesserviceworkers-readonly\"><code>ses.serviceWorkers</code> <em>Readonly</em></a></h4>\n<p>Um objeto <a href=\"/docs/api/service-workers\"><code>ServiceWorkers</code></a> para esta sessão.</p>\n<h4 id=\"seswebrequest-readonly\"><a href=\"#seswebrequest-readonly\"><code>ses.webRequest</code> <em>Readonly</em></a></h4>\n<p>Um objeto <a href=\"/docs/api/web-request\"><code>WebRequest</code></a> para esta sessão.</p>\n<h4 id=\"sesprotocol-readonly\"><a href=\"#sesprotocol-readonly\"><code>ses.protocol</code> <em>Readonly</em></a></h4>\n<p>Um objeto <a href=\"/docs/api/protocol\"><code>Protocol</code></a> para esta sessão.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> protocol = session.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).protocol\n  <span class=\"hljs-keyword\">if</span> (!protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })) {\n    <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Failed to register protocol'</span>)\n  }\n})\n</code></pre>\n<h4 id=\"sesnetlog-readonly\"><a href=\"#sesnetlog-readonly\"><code>ses.netLog</code> <em>Readonly</em></a></h4>\n<p>Um objeto <a href=\"/docs/api/net-log\"><code>NetLog</code></a> para esta sessão.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> netLog = session.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).netLog\n  netLog.startLogging(<span class=\"hljs-string\">'/path/to/net-log'</span>)\n  <span class=\"hljs-comment\">// After some network events</span>\n  <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> netLog.stopLogging()\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Net-logs written to'</span>, path)\n})\n</code></pre>",
      "title": "session",
      "description": "Manage browser sessions, cookies, cache, proxy settings, etc."
    },
    "/docs/development/setting-up-symbol-server": {
      "locale": "pt-BR",
      "slug": "setting-up-symbol-server",
      "href": "/docs/development/setting-up-symbol-server",
      "crowdinFileId": "256165",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/setting-up-symbol-server.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"configuração-para-servidor-de-símbolos-no-depurador\"><a href=\"#configuração-para-servidor-de-símbolos-no-depurador\">Configuração para servidor de símbolos no Depurador</a></h1>\n<p>Debug symbols allow you to have better debugging sessions. They have information about the functions contained in executables and dynamic libraries and provide you with information to get clean call stacks. A Symbol Server allows the debugger to load the correct symbols, binaries and sources automatically without forcing users to download large debugging files. The server functions like <a href=\"https://support.microsoft.com/kb/311503\">Microsoft's symbol server</a> so the documentation there can be useful.</p>\n<p>Note that because released Electron builds are heavily optimized, debugging is not always easy. The debugger will not be able to show you the content of all variables and the execution path can seem strange because of inlining, tail calls, and other compiler optimizations. The only workaround is to build an unoptimized local build.</p>\n<p>The official symbol server URL for Electron is <a href=\"https://symbols.electronjs.org\">https://symbols.electronjs.org</a>. You cannot visit this URL directly, you must add it to the symbol path of your debugging tool. In the examples below, a local cache directory is used to avoid repeatedly fetching the PDB from the server. Replace <code>c:\\code\\symbols</code> with an appropriate cache directory on your machine.</p>\n<h2 id=\"using-the-symbol-server-in-windbg\"><a href=\"#using-the-symbol-server-in-windbg\">Using the Symbol Server in Windbg</a></h2>\n<p>The Windbg symbol path is configured with a string value delimited with asterisk characters. To use only the Electron symbol server, add the following entry to your symbol path (<strong>Note:</strong> you can replace <code>c:\\code\\symbols</code> with any writable directory on your computer, if you'd prefer a different location for downloaded symbols):</p>\n<pre><code class=\"hljs language-powershell\">SRV*c:\\code\\symbols\\*https://symbols.electronjs.org\n</code></pre>\n<p>Set this string as <code>_NT_SYMBOL_PATH</code> in the environment, using the Windbg menus, or by typing the <code>.sympath</code> command. If you would like to get symbols from Microsoft's symbol server as well, you should list that first:</p>\n<pre><code class=\"hljs language-powershell\">SRV*c:\\code\\symbols\\*https://msdl.microsoft.com/download/symbols;SRV*c:\\code\\symbols\\*https://symbols.electronjs.org\n</code></pre>\n<h2 id=\"using-the-symbol-server-in-visual-studio\"><a href=\"#using-the-symbol-server-in-visual-studio\">Using the symbol server in Visual Studio</a></h2>\n<p><img src=\"https://mdn.mozillademos.org/files/733/symbol-server-vc8express-menu.jpg\" alt=\"Tools -> Options\"> <img src=\"https://mdn.mozillademos.org/files/2497/2005_options.gif\" alt=\"Symbols Settings\"></p>\n<h2 id=\"troubleshooting-symbols-will-not-load\"><a href=\"#troubleshooting-symbols-will-not-load\">Troubleshooting: Symbols will not load</a></h2>\n<p>Type the following commands in Windbg to print why symbols are not loading:</p>\n<pre><code class=\"hljs language-powershell\">> !sym noisy\n> .reload /f electron.exe\n</code></pre>",
      "title": "Configuração para servidor de símbolos no Depurador",
      "description": ""
    },
    "/docs/api/share-menu": {
      "locale": "pt-BR",
      "slug": "share-menu",
      "href": "/docs/api/share-menu",
      "crowdinFileId": "256367",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/share-menu.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharemenu\"><a href=\"#sharemenu\">ShareMenu</a></h1>\n<p>The <code>ShareMenu</code> class creates <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/\">Share Menu</a> on macOS, which can be used to share information from the current context to apps, social media accounts, and other services.</p>\n<p>For including the share menu as a submenu of other menus, please use the <code>shareMenu</code> role of <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>.</p>\n<h2 id=\"class-sharemenu\"><a href=\"#class-sharemenu\">Class: ShareMenu</a></h2>\n<blockquote>\n<p>Create share menu on macOS.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h3 id=\"new-sharemenusharingitem\"><a href=\"#new-sharemenusharingitem\"><code>new ShareMenu(sharingItem)</code></a></h3>\n<ul>\n<li><code>sharingItem</code> SharingItem - The item to share.</li>\n</ul>\n<p>Creates a new share menu.</p>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<p>O objeto <code>shareMenu</code> possui os seguintes métodos de instância:</p>\n<h4 id=\"sharemenupopupoptions\"><a href=\"#sharemenupopupoptions\"><code>shareMenu.popup([options])</code></a></h4>\n<ul>\n<li><code>options</code> PopupOptions (optional)<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional) - Default is the focused window.</li>\n<li><code>x</code> Number (optional) - Default is the current mouse cursor position. Must be declared if <code>y</code> is declared.</li>\n<li><code>y</code> Number (optional) - Default is the current mouse cursor position. Must be declared if <code>x</code> is declared.</li>\n<li><code>positioningItem</code> Number (optional) <em>macOS</em> - The index of the menu item to be positioned under the mouse cursor at the specified coordinates. Default is -1.</li>\n<li><code>callback</code> Function (optional) - Called when menu is closed.</li>\n</ul></li>\n</ul>\n<p>Pops up this menu as a context menu in the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<h4 id=\"sharemenuclosepopupbrowserwindow\"><a href=\"#sharemenuclosepopupbrowserwindow\"><code>shareMenu.closePopup([browserWindow])</code></a></h4>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional) - Default is the focused window.</li>\n</ul>\n<p>Fecha o menu de contexto em <code>browserWindow</code>.</p>",
      "title": "ShareMenu",
      "description": "Create share menu on macOS."
    },
    "/docs/api/structures/shared-worker-info": {
      "locale": "pt-BR",
      "slug": "shared-worker-info",
      "href": "/docs/api/structures/shared-worker-info",
      "crowdinFileId": "256505",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/shared-worker-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharedworkerinfo-object\"><a href=\"#sharedworkerinfo-object\">SharedWorkerInfo Object</a></h1>\n<ul>\n<li><code>id</code> String - The unique id of the shared worker.</li>\n<li><code>url</code> String - The url of the shared worker.</li>\n</ul>",
      "title": "SharedWorkerInfo Object",
      "description": ""
    },
    "/docs/api/structures/sharing-item": {
      "locale": "pt-BR",
      "slug": "sharing-item",
      "href": "/docs/api/structures/sharing-item",
      "crowdinFileId": "256507",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/sharing-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharingitem-object\"><a href=\"#sharingitem-object\">SharingItem Object</a></h1>\n<ul>\n<li><code>texts</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of text to share.</li>\n<li><code>filePaths</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of files to share.</li>\n<li><code>urls</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of URLs to share.</li>\n</ul>",
      "title": "SharingItem Object",
      "description": ""
    },
    "/docs/api/shell": {
      "locale": "pt-BR",
      "slug": "shell",
      "href": "/docs/api/shell",
      "crowdinFileId": "256369",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/shell.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"shell\"><a href=\"#shell\">shell</a></h1>\n<blockquote>\n<p>Gerencia arquivos e URLs usando seus aplicativos padrão.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a> (non-sandboxed only)</p>\n<p>O módulo <code>shell</code> fornece funções relacionadas à integração com a área de trabalho.</p>\n<p>Um exemplo de como abrir uma URL no navegador padrão do usuário:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nshell.openExternal(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<p><strong>Note:</strong> While the <code>shell</code> module can be used in the renderer process, it will not function in a sandboxed renderer.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>O módulo <code>shell</code> tem os seguintes métodos:</p>\n<h3 id=\"shellshowiteminfolderfullpath\"><a href=\"#shellshowiteminfolderfullpath\"><code>shell.showItemInFolder(fullPath)</code></a></h3>\n<ul>\n<li><code>fullPath</code> String</li>\n</ul>\n<p>Show the given file in a file manager. If possible, select the file.</p>\n<h3 id=\"shellopenpathpath\"><a href=\"#shellopenpathpath\"><code>shell.openPath(path)</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - Resolves with a string containing the error message corresponding to the failure if a failure occurred, otherwise \"\".</p>\n<p>Abre o arquivo fornecido na maneira padrão da área de trabalho.</p>\n<h3 id=\"shellopenexternalurl-options\"><a href=\"#shellopenexternalurl-options\"><code>shell.openExternal(url[, options])</code></a></h3>\n<ul>\n<li><code>url</code> String - Max 2081 characters on windows.</li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>activate</code> Boolean (optional) <em>macOS</em> - <code>true</code> to bring the opened application to the foreground. O padrão é <code>verdadeiro</code>.</li>\n<li><code>workingDirectory</code> String (optional) <em>Windows</em> - The working directory.</li>\n</ul></li>\n</ul>\n<p>Retorna <code>Promise&#x3C;void></code></p>\n<p>Open the given external protocol URL in the desktop's default manner. (For example, mailto: URLs in the user's default mail agent).</p>\n<h3 id=\"shelltrashitempath\"><a href=\"#shelltrashitempath\"><code>shell.trashItem(path)</code></a></h3>\n<ul>\n<li><code>path</code> String - path to the item to be moved to the trash.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the operation has been completed. Rejects if there was an error while deleting the requested item.</p>\n<p>This moves a path to the OS-specific trash location (Trash on macOS, Recycle Bin on Windows, and a desktop-environment-specific location on Linux).</p>\n<h3 id=\"shellbeep\"><a href=\"#shellbeep\"><code>shell.beep()</code></a></h3>\n<p>Toca o sinal sonoro.</p>\n<h3 id=\"shellwriteshortcutlinkshortcutpath-operation-options-windows\"><a href=\"#shellwriteshortcutlinkshortcutpath-operation-options-windows\"><code>shell.writeShortcutLink(shortcutPath[, operation], options)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>shortcutPath</code> String</li>\n<li><code>operation</code> String (optional) - Default is <code>create</code>, can be one of following:<ul>\n<li><code>create</code> - Cria um novo atalho, sobrescrevendo se necessário.</li>\n<li><code>update</code> - Atualiza propriedades especificadas apenas em um atalho existente.</li>\n<li><code>replace</code> - Sobrescreve um atalho existente, falha se o atalho não existir.</li>\n</ul></li>\n<li><code>options</code> <a href=\"/docs/api/structures/shortcut-details\">ShortcutDetails</a></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the shortcut was created successfully.</p>\n<p>Creates or updates a shortcut link at <code>shortcutPath</code>.</p>\n<h3 id=\"shellreadshortcutlinkshortcutpath-windows\"><a href=\"#shellreadshortcutlinkshortcutpath-windows\"><code>shell.readShortcutLink(shortcutPath)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>shortcutPath</code> String</li>\n</ul>\n<p>Retorna <a href=\"/docs/api/structures/shortcut-details\"><code>ShortcutDetails</code></a></p>\n<p>Resolves the shortcut link at <code>shortcutPath</code>.</p>\n<p>Uma exceção será lançada quando qualquer erro acontecer.</p>",
      "title": "shell",
      "description": "Gerencia arquivos e URLs usando seus aplicativos padrão."
    },
    "/docs/api/structures/shortcut-details": {
      "locale": "pt-BR",
      "slug": "shortcut-details",
      "href": "/docs/api/structures/shortcut-details",
      "crowdinFileId": "256509",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/shortcut-details.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"shortcutdetails-object\"><a href=\"#shortcutdetails-object\">ShortcutDetails Object</a></h1>\n<ul>\n<li><code>target</code> String - The target to launch from this shortcut.</li>\n<li><code>cwd</code> String (optional) - The working directory. Default is empty.</li>\n<li><code>args</code> String (optional) - The arguments to be applied to <code>target</code> when launching from this shortcut. Default is empty.</li>\n<li><code>description</code> String (optional) - The description of the shortcut. Default is empty.</li>\n<li><code>icon</code> String (optional) - The path to the icon, can be a DLL or EXE. <code>icon</code> and <code>iconIndex</code> have to be set together. Default is empty, which uses the target's icon.</li>\n<li><code>iconIndex</code> Number (optional) - The resource ID of icon when <code>icon</code> is a DLL or EXE. Default is 0.</li>\n<li><code>appUserModelId</code> String (optional) - The Application User Model ID. Default is empty.</li>\n<li><code>toastActivatorClsid</code> String (optional) - The Application Toast Activator CLSID. Needed for participating in Action Center.</li>\n</ul>",
      "title": "ShortcutDetails Object",
      "description": ""
    },
    "/docs/api/structures/size": {
      "locale": "pt-BR",
      "slug": "size",
      "href": "/docs/api/structures/size",
      "crowdinFileId": "256511",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/size.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"size-object\"><a href=\"#size-object\">Size Object</a></h1>\n<ul>\n<li><code>width</code> Number</li>\n<li><code>height</code> Number</li>\n</ul>",
      "title": "Size Object",
      "description": ""
    },
    "/docs/tutorial/snapcraft": {
      "locale": "pt-BR",
      "slug": "snapcraft",
      "href": "/docs/tutorial/snapcraft",
      "crowdinFileId": "256249",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/snapcraft.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"snapcraft-guide-linux\"><a href=\"#snapcraft-guide-linux\">Snapcraft Guide (Linux)</a></h1>\n<p>This guide provides information on how to package your Electron application for any Snapcraft environment, including the Ubuntu Software Center.</p>\n<h2 id=\"contexto-e-requisitos\"><a href=\"#contexto-e-requisitos\">Contexto e Requisitos</a></h2>\n<p>Together with the broader Linux community, Canonical aims to fix many of the common software installation problems with the <a href=\"https://snapcraft.io/\"><code>snapcraft</code></a> project. Snaps are containerized software packages that include required dependencies, auto-update, and work on all major Linux distributions without system modification.</p>\n<p>There are three ways to create a <code>.snap</code> file:</p>\n<p>1) Using <a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a> or <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a>, both tools that come with <code>snap</code> support out of the box. This is the easiest option. 2) Using <code>electron-installer-snap</code>, which takes <code>electron-packager</code>'s output. 3) Using an already created <code>.deb</code> package.</p>\n<p>Em alguns casos, você precisará ter a ferramenta <code>snapcraft</code> instalada. Instruções para instalar <code>snapcraft</code> para sua distribuição específica estão disponíveis <a href=\"https://snapcraft.io/docs/installing-snapcraft\">aqui</a>.</p>\n<h2 id=\"usando-o-electron-installer-snap\"><a href=\"#usando-o-electron-installer-snap\">Usando o <code>electron-installer-snap</code></a></h2>\n<p>O módulo funciona como o <a href=\"https://github.com/electron/windows-installer\"><code>electron_winstaller</code></a>e módulos semelhantes em que seu escopo é limitado a construir pacotes snap. Você pode testá-lo com:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron-installer-snap\n</code></pre>\n<h3 id=\"etapa-1-empacotar-sua-aplicação-electron\"><a href=\"#etapa-1-empacotar-sua-aplicação-electron\">Etapa 1: Empacotar sua aplicação Electron</a></h3>\n<p>Package the application using <a href=\"https://github.com/electron/electron-packager\">electron-packager</a> (or a similar tool). Make sure to remove <code>node_modules</code> that you don't need in your final application, since any module you don't actually need will increase your application's size.</p>\n<p>A saída deve ser algo mais ou menos assim:</p>\n<pre><code class=\"hljs language-plaintext\">.\n└── dist\n    └── app-linux-x64\n        ├── LICENSE\n        ├── LICENSES.chromium.html\n        ├── content_shell.pak\n        ├── app\n        ├── icudtl.dat\n        ├── libgcrypt.so.11\n        ├── libnode.so\n        ├── locales\n        ├── resources\n        ├── v8_context_snapshot.bin\n        └── version\n</code></pre>\n<h3 id=\"step-2-running-electron-installer-snap\"><a href=\"#step-2-running-electron-installer-snap\">Step 2: Running <code>electron-installer-snap</code></a></h3>\n<p>From a terminal that has <code>snapcraft</code> in its <code>PATH</code>, run <code>electron-installer-snap</code> with the only required parameter <code>--src</code>, which is the location of your packaged Electron application created in the first step.</p>\n<pre><code class=\"hljs language-sh\">npx electron-installer-snap --src=out/myappname-linux-x64\n</code></pre>\n<p>If you have an existing build pipeline, you can use <code>electron-installer-snap</code> programmatically. For more information, see the <a href=\"https://docs.snapcraft.io/build-snaps/syntax\">Snapcraft API docs</a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> snap = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-installer-snap'</span>)\n\nsnap(options)\n  .then(<span class=\"hljs-function\"><span class=\"hljs-params\">snapPath</span> =></span> <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Created snap at <span class=\"hljs-subst\">${snapPath}</span>!`</span>))\n</code></pre>\n<h2 id=\"using-snapcraft-with-electron-packager\"><a href=\"#using-snapcraft-with-electron-packager\">Using <code>snapcraft</code> with <code>electron-packager</code></a></h2>\n<h3 id=\"step-1-create-sample-snapcraft-project\"><a href=\"#step-1-create-sample-snapcraft-project\">Step 1: Create Sample Snapcraft Project</a></h3>\n<p>Create your project directory and add the following to <code>snap/snapcraft.yaml</code>:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">electron-packager-hello-world</span>\n<span class=\"hljs-attr\">version:</span> <span class=\"hljs-string\">'0.1'</span>\n<span class=\"hljs-attr\">summary:</span> <span class=\"hljs-string\">Hello</span> <span class=\"hljs-string\">World</span> <span class=\"hljs-string\">Electron</span> <span class=\"hljs-string\">app</span>\n<span class=\"hljs-attr\">description:</span> <span class=\"hljs-string\">|\n  Simple Hello World Electron app as an example\n</span><span class=\"hljs-attr\">base:</span> <span class=\"hljs-string\">core18</span>\n<span class=\"hljs-attr\">confinement:</span> <span class=\"hljs-string\">strict</span>\n<span class=\"hljs-attr\">grade:</span> <span class=\"hljs-string\">stable</span>\n\n<span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">electron-packager-hello-world:</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">electron-quick-start/electron-quick-start</span> <span class=\"hljs-string\">--no-sandbox</span>\n    <span class=\"hljs-attr\">extensions:</span> <span class=\"hljs-string\">[gnome-3-34]</span>\n    <span class=\"hljs-attr\">plugs:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">browser-support</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">network</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">network-bind</span>\n    <span class=\"hljs-attr\">environment:</span>\n      <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n      <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n      <span class=\"hljs-attr\">TMPDIR:</span> <span class=\"hljs-string\">$XDG_RUNTIME_DIR</span>\n\n<span class=\"hljs-attr\">parts:</span>\n  <span class=\"hljs-attr\">electron-quick-start:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">nil</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">https://github.com/electron/electron-quick-start.git</span>\n    <span class=\"hljs-attr\">override-build:</span> <span class=\"hljs-string\">|\n        npm install electron electron-packager\n        npx electron-packager . --overwrite --platform=linux --output=release-build --prune=true\n        cp -rv ./electron-quick-start-linux-* $SNAPCRAFT_PART_INSTALL/electron-quick-start\n</span>    <span class=\"hljs-attr\">build-snaps:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">node/14/stable</span>\n    <span class=\"hljs-attr\">build-packages:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">unzip</span>\n    <span class=\"hljs-attr\">stage-packages:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnss3</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnspr4</span>\n</code></pre>\n<p>If you want to apply this example to an existing project:</p>\n<ul>\n<li>Replace <code>source: https://github.com/electron/electron-quick-start.git</code> with <code>source: .</code>.</li>\n<li>Replace all instances of <code>electron-quick-start</code> with your project's name.</li>\n</ul>\n<h3 id=\"step-2-build-the-snap\"><a href=\"#step-2-build-the-snap\">Step 2: Build the snap</a></h3>\n<pre><code class=\"hljs language-sh\">$ snapcraft\n\n&#x3C;output snipped>\nSnapped electron-packager-hello-world_0.1_amd64.snap\n</code></pre>\n<h3 id=\"step-3-install-the-snap\"><a href=\"#step-3-install-the-snap\">Step 3: Install the snap</a></h3>\n<pre><code class=\"hljs language-sh\">sudo snap install electron-packager-hello-world_0.1_amd64.snap --dangerous\n</code></pre>\n<h3 id=\"step-4-run-the-snap\"><a href=\"#step-4-run-the-snap\">Step 4: Run the snap</a></h3>\n<pre><code class=\"hljs language-sh\">electron-packager-hello-world\n</code></pre>\n<h2 id=\"using-an-existing-debian-package\"><a href=\"#using-an-existing-debian-package\">Using an Existing Debian Package</a></h2>\n<p>Snapcraft is capable of taking an existing <code>.deb</code> file and turning it into a <code>.snap</code> file. The creation of a snap is configured using a <code>snapcraft.yaml</code> file that describes the sources, dependencies, description, and other core building blocks.</p>\n<h3 id=\"step-1-create-a-debian-package\"><a href=\"#step-1-create-a-debian-package\">Step 1: Create a Debian Package</a></h3>\n<p>If you do not already have a <code>.deb</code> package, using <code>electron-installer-snap</code> might be an easier path to create snap packages. However, multiple solutions for creating Debian packages exist, including <a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a>, <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> or <a href=\"https://github.com/unindented/electron-installer-debian\"><code>electron-installer-debian</code></a>.</p>\n<h3 id=\"step-2-create-a-snapcraftyaml\"><a href=\"#step-2-create-a-snapcraftyaml\">Step 2: Create a snapcraft.yaml</a></h3>\n<p>For more information on the available configuration options, see the <a href=\"https://docs.snapcraft.io/build-snaps/syntax\">documentation on the snapcraft syntax</a>. Let's look at an example:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">myApp</span>\n<span class=\"hljs-attr\">version:</span> <span class=\"hljs-string\">'2.0.0'</span>\n<span class=\"hljs-attr\">summary:</span> <span class=\"hljs-string\">A</span> <span class=\"hljs-string\">little</span> <span class=\"hljs-string\">description</span> <span class=\"hljs-string\">for</span> <span class=\"hljs-string\">the</span> <span class=\"hljs-string\">app.</span>\n<span class=\"hljs-attr\">description:</span> <span class=\"hljs-string\">|\n You know what? This app is amazing! It does all the things\n for you. Some say it keeps you young, maybe even happy.\n</span>\n<span class=\"hljs-attr\">grade:</span> <span class=\"hljs-string\">stable</span>\n<span class=\"hljs-attr\">confinement:</span> <span class=\"hljs-string\">classic</span>\n\n<span class=\"hljs-attr\">parts:</span>\n  <span class=\"hljs-attr\">slack:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">dump</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">my-deb.deb</span>\n    <span class=\"hljs-attr\">source-type:</span> <span class=\"hljs-string\">deb</span>\n    <span class=\"hljs-attr\">after:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">desktop-gtk3</span>\n    <span class=\"hljs-attr\">stage-packages:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libasound2</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnotify4</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnspr4</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnss3</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libpcre3</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libpulse0</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libxss1</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libxtst6</span>\n  <span class=\"hljs-attr\">electron-launch:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">dump</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">files/</span>\n    <span class=\"hljs-attr\">prepare:</span> <span class=\"hljs-string\">|\n      chmod +x bin/electron-launch\n</span>\n<span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">myApp:</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">bin/electron-launch</span> <span class=\"hljs-string\">$SNAP/usr/lib/myApp/myApp</span>\n    <span class=\"hljs-attr\">desktop:</span> <span class=\"hljs-string\">usr/share/applications/myApp.desktop</span>\n    <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n    <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n    <span class=\"hljs-attr\">environment:</span>\n      <span class=\"hljs-attr\">TMPDIR:</span> <span class=\"hljs-string\">$XDG_RUNTIME_DIR</span>\n</code></pre>\n<p>As you can see, the <code>snapcraft.yaml</code> instructs the system to launch a file called <code>electron-launch</code>. In this example, it passes information on to the app's binary:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-meta\">#!/bin/sh\n</span>\n<span class=\"hljs-built_in\">exec</span> <span class=\"hljs-string\">\"<span class=\"hljs-variable\">$@</span>\"</span> --executed-from=<span class=\"hljs-string\">\"<span class=\"hljs-variable\">$(pwd)</span>\"</span> --pid=$$ > /dev/null 2>&#x26;1 &#x26;\n</code></pre>\n<p>Alternatively, if you're building your <code>snap</code> with <code>strict</code> confinement, you can use the <code>desktop-launch</code> command:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">myApp:</span>\n    <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n    <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">env</span> <span class=\"hljs-string\">TMPDIR=$XDG_RUNTIME_DIR</span> <span class=\"hljs-string\">PATH=/usr/local/bin:${PATH}</span> <span class=\"hljs-string\">${SNAP}/bin/desktop-launch</span> <span class=\"hljs-string\">$SNAP/myApp/desktop</span>\n    <span class=\"hljs-attr\">desktop:</span> <span class=\"hljs-string\">usr/share/applications/desktop.desktop</span>\n</code></pre>",
      "title": "Snapcraft Guide (Linux)",
      "description": ""
    },
    "/docs/development/source-code-directory-structure": {
      "locale": "pt-BR",
      "slug": "source-code-directory-structure",
      "href": "/docs/development/source-code-directory-structure",
      "crowdinFileId": "256167",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/source-code-directory-structure.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"estrutura-de-diretório-do-código-fonte\"><a href=\"#estrutura-de-diretório-do-código-fonte\">Estrutura de Diretório do Código Fonte</a></h1>\n<p>The source code of Electron is separated into a few parts, mostly following Chromium on the separation conventions.</p>\n<p>You may need to become familiar with <a href=\"https://dev.chromium.org/developers/design-documents/multi-process-architecture\">Chromium's multi-process architecture</a> to understand the source code better.</p>\n<h2 id=\"structure-of-source-code\"><a href=\"#structure-of-source-code\">Structure of Source Code</a></h2>\n<pre><code class=\"hljs language-diff\">Electron\n├── build/ - Build configuration files needed to build with GN.\n├── buildflags/ - Determines the set of features that can be conditionally built.\n├── chromium_src/ - Source code copied from Chromium that isn't part of the content layer.\n├── default_app/ - A default app run when Electron is started without\n|                  providing a consumer app.\n├── docs/ - Electron's documentation.\n|   ├── api/ - Documentation for Electron's externally-facing modules and APIs.\n|   ├── development/ - Documentation to aid in developing for and with Electron.\n|   ├── fiddles/ - A set of code snippets one can run in Electron Fiddle.\n|   ├── images/ - Images used in documentation.\n|   └── tutorial/ - Tutorial documents for various aspects of Electron.\n├── lib/ - JavaScript/TypeScript source code.\n|   ├── browser/ - Main process initialization code.\n|   |   ├── api/ - API implementation for main process modules.\n|   |   └── remote/ - Code related to the remote module as it is\n|   |                 used in the main process.\n|   ├── common/ - Relating to logic needed by both main and renderer processes.\n|   |   └── api/ - API implementation for modules that can be used in\n|   |              both the main and renderer processes\n|   ├── isolated_renderer/ - Handles creation of isolated renderer processes when\n|   |                        contextIsolation is enabled.\n|   ├── renderer/ - Renderer process initialization code.\n|   |   ├── api/ - API implementation for renderer process modules.\n|   |   ├── extension/ - Code related to use of Chrome Extensions\n|   |   |                in Electron's renderer process.\n|   |   ├── remote/ - Logic that handles use of the remote module in\n|   |   |             the main process.\n|   |   └── web-view/ - Logic that handles the use of webviews in the\n|   |                   renderer process.\n|   ├── sandboxed_renderer/ - Logic that handles creation of sandboxed renderer\n|   |   |                     processes.\n|   |   └── api/ - API implementation for sandboxed renderer processes.\n|   └── worker/ - Logic that handles proper functionality of Node.js\n|                 environments in Web Workers.\n├── patches/ - Patches applied on top of Electron's core dependencies\n|   |          in order to handle differences between our use cases and\n|   |          default functionality.\n|   ├── boringssl/ - Patches applied to Google's fork of OpenSSL, BoringSSL.\n|   ├── chromium/ - Patches applied to Chromium.\n|   ├── node/ - Patches applied on top of Node.js.\n|   └── v8/ - Patches applied on top of Google's V8 engine.\n├── shell/ - C++ source code.\n|   ├── app/ - System entry code.\n|   ├── browser/ - The frontend including the main window, UI, and all of the\n|   |   |          main process things. This talks to the renderer to manage web\n|   |   |          pages.\n|   |   ├── ui/ - Implementation of UI stuff for different platforms.\n|   |   |   ├── cocoa/ - Cocoa specific source code.\n|   |   |   ├── win/ - Windows GUI specific source code.\n|   |   |   └── x/ - X11 specific source code.\n|   |   ├── api/ - The implementation of the main process APIs.\n|   |   ├── net/ - Network related code.\n|   |   ├── mac/ - Mac specific Objective-C source code.\n|   |   └── resources/ - Icons, platform-dependent files, etc.\n|   ├── renderer/ - Code that runs in renderer process.\n|   |   └── api/ - The implementation of renderer process APIs.\n|   └── common/ - Code that used by both the main and renderer processes,\n|       |         including some utility functions and code to integrate node's\n|       |         message loop into Chromium's message loop.\n|       └── api/ - The implementation of common APIs, and foundations of\n|                  Electron's built-in modules.\n├── spec/ - Components of Electron's test suite run in the renderer process.\n├── spec-main/ - Components of Electron's test suite run in the main process.\n└── BUILD.gn - Building rules of Electron.\n</code></pre>\n<h2 id=\"structure-of-other-directories\"><a href=\"#structure-of-other-directories\">Structure of Other Directories</a></h2>\n<ul>\n<li><strong>.circleci</strong> - Config file for CI with CircleCI.</li>\n<li><strong>.github</strong> - GitHub-specific config files including issues templates and CODEOWNERS.</li>\n<li><strong>dist</strong> - Temporary directory created by <code>script/create-dist.py</code> script when creating a distribution.</li>\n<li><strong>node_modules</strong> - Third party node modules used for building.</li>\n<li><strong>npm</strong> - Logic for installation of Electron via npm.</li>\n<li><strong>out</strong> - Temporary output directory of <code>ninja</code>.</li>\n<li><strong>script</strong> - Scripts used for development purpose like building, packaging, testing, etc.</li>\n</ul>\n<pre><code class=\"hljs language-diff\">script/ - The set of all scripts Electron runs for a variety of purposes.\n├── codesign/ - Fakes codesigning for Electron apps; used for testing.\n├── lib/ - Miscellaneous python utility scripts.\n└── release/ - Scripts run during Electron's release process.\n    ├── notes/ - Generates release notes for new Electron versions.\n    └── uploaders/ - Uploads various release-related files during release.\n</code></pre>\n<ul>\n<li><strong>typings</strong> - TypeScript typings for Electron's internal code.</li>\n</ul>",
      "title": "Estrutura de Diretório do Código Fonte",
      "description": ""
    },
    "/docs/tutorial/spellchecker": {
      "locale": "pt-BR",
      "slug": "spellchecker",
      "href": "/docs/tutorial/spellchecker",
      "crowdinFileId": "256251",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/spellchecker.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"spellchecker\"><a href=\"#spellchecker\">SpellChecker</a></h1>\n<p>Electron has built-in support for Chromium's spellchecker since Electron 8.  On Windows and Linux this is powered by Hunspell dictionaries, and on macOS it makes use of the native spellchecker APIs.</p>\n<h2 id=\"how-to-enable-the-spellchecker\"><a href=\"#how-to-enable-the-spellchecker\">How to enable the spellchecker?</a></h2>\n<p>For Electron 9 and higher the spellchecker is enabled by default.  For Electron 8 you need to enable it in <code>webPreferences</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> myWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">spellcheck</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h2 id=\"how-to-set-the-languages-the-spellchecker-uses\"><a href=\"#how-to-set-the-languages-the-spellchecker-uses\">How to set the languages the spellchecker uses?</a></h2>\n<p>On macOS as we use the native APIs there is no way to set the language that the spellchecker uses. By default on macOS the native spellchecker will automatically detect the language being used for you.</p>\n<p>For Windows and Linux there are a few Electron APIs you should use to set the languages for the spellchecker.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Sets the spellchecker to check English US and French</span>\nmyWindow.session.setSpellCheckerLanguages([<span class=\"hljs-string\">'en-US'</span>, <span class=\"hljs-string\">'fr'</span>])\n\n<span class=\"hljs-comment\">// An array of all available language codes</span>\n<span class=\"hljs-keyword\">const</span> possibleLanguages = myWindow.session.availableSpellCheckerLanguages\n</code></pre>\n<p>By default the spellchecker will enable the language matching the current OS locale.</p>\n<h2 id=\"how-do-i-put-the-results-of-the-spellchecker-in-my-context-menu\"><a href=\"#how-do-i-put-the-results-of-the-spellchecker-in-my-context-menu\">How do I put the results of the spellchecker in my context menu?</a></h2>\n<p>All the required information to generate a context menu is provided in the <a href=\"/docs/api/web-contents#event-context-menu\"><code>context-menu</code></a> event on each <code>webContents</code> instance.  A small example of how to make a context menu with this information is provided below.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { Menu, MenuItem } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nmyWindow.webContents.on(<span class=\"hljs-string\">'context-menu'</span>, (event, params) => {\n  <span class=\"hljs-keyword\">const</span> menu = <span class=\"hljs-keyword\">new</span> Menu()\n\n  <span class=\"hljs-comment\">// Add each spelling suggestion</span>\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> suggestion <span class=\"hljs-keyword\">of</span> params.dictionarySuggestions) {\n    menu.append(<span class=\"hljs-keyword\">new</span> MenuItem({\n      <span class=\"hljs-attr\">label</span>: suggestion,\n      <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> mainWindow.webContents.replaceMisspelling(suggestion)\n    }))\n  }\n\n  <span class=\"hljs-comment\">// Allow users to add the misspelled word to the dictionary</span>\n  <span class=\"hljs-keyword\">if</span> (params.misspelledWord) {\n    menu.append(\n      <span class=\"hljs-keyword\">new</span> MenuItem({\n        <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Add to dictionary'</span>,\n        <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> mainWindow.webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord)\n      })\n    )\n  }\n\n  menu.popup()\n})\n</code></pre>\n<h2 id=\"does-the-spellchecker-use-any-google-services\"><a href=\"#does-the-spellchecker-use-any-google-services\">Does the spellchecker use any Google services?</a></h2>\n<p>Although the spellchecker itself does not send any typings, words or user input to Google services the hunspell dictionary files are downloaded from a Google CDN by default.  If you want to avoid this you can provide an alternative URL to download the dictionaries from.</p>\n<pre><code class=\"hljs language-js\">myWindow.session.setSpellCheckerDictionaryDownloadURL(<span class=\"hljs-string\">'https://example.com/dictionaries/'</span>)\n</code></pre>\n<p>Check out the docs for <a href=\"/docs/api/session#sessetspellcheckerdictionarydownloadurlurl\"><code>session.setSpellCheckerDictionaryDownloadURL</code></a> for more information on where to get the dictionary files from and how you need to host them.</p>",
      "title": "SpellChecker",
      "description": ""
    },
    "/docs/styleguide": {
      "locale": "pt-BR",
      "slug": "styleguide",
      "href": "/docs/styleguide",
      "crowdinFileId": "256125",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/styleguide.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"guia-de-estilo-de-documentação-do-electron\"><a href=\"#guia-de-estilo-de-documentação-do-electron\">Guia de estilo de Documentação do Electron</a></h1>\n<p>Estas são as diretrizes para escrever a documentação do Electron.</p>\n<h2 id=\"títulos\"><a href=\"#títulos\">Títulos</a></h2>\n<ul>\n<li>Cada página deve ter um único <code>#</code> no nível de título na parte superior.</li>\n<li>Chapters in the same page must have <code>##</code>-level headings.</li>\n<li>Sub-chapters need to increase the number of <code>#</code> in the heading according to their nesting depth.</li>\n<li>The page's title must follow <a href=\"https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case\">APA title case</a>.</li>\n<li>All chapters must follow <a href=\"https://apastyle.apa.org/style-grammar-guidelines/capitalization/sentence-case\">APA sentence case</a>.</li>\n</ul>\n<p>Usado o <code>Inicio Rápido</code> como exemplo:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># Quick Start</span>\n\n...\n\n<span class=\"hljs-section\">## Main process</span>\n\n...\n\n<span class=\"hljs-section\">## Renderer process</span>\n\n...\n\n<span class=\"hljs-section\">## Run your app</span>\n\n...\n\n<span class=\"hljs-section\">### Run as a distribution</span>\n\n...\n\n<span class=\"hljs-section\">### Manually downloaded Electron binary</span>\n\n...\n</code></pre>\n<p>Para referencias à API, existem exceções a está regra.</p>\n<h2 id=\"funcionalidades-markdown\"><a href=\"#funcionalidades-markdown\">Funcionalidades Markdown</a></h2>\n<p>This repository uses the <a href=\"https://github.com/DavidAnson/markdownlint\"><code>markdownlint</code></a> package to enforce consistent Markdown styling. For the exact rules, see the <code>.markdownlint.json</code> file in the root folder.</p>\n<p>There are a few style guidelines that aren't covered by the linter rules:</p>\n<!--TODO(erickzhao): make sure this matches with the lint:markdownlint task-->\n<ul>\n<li>Use <code>sh</code> ao invés de <code>cmd</code> nos blocos de código (devido ao destaque de sintaxe).</li>\n<li>Keep line lengths between 80 and 100 characters if possible for readability purposes.</li>\n<li>No nesting lists more than 2 levels (due to the markdown renderer).</li>\n<li>All <code>js</code> and <code>javascript</code> code blocks are linted with <a href=\"https://www.npmjs.com/package/standard-markdown\">standard-markdown</a>.</li>\n<li>For unordered lists, use asterisks instead of dashes.</li>\n</ul>\n<h2 id=\"picking-words\"><a href=\"#picking-words\">Picking words</a></h2>\n<ul>\n<li>Use \"will\" over \"would\" when describing outcomes.</li>\n<li>Prefer \"in the ___ process\" over \"on\".</li>\n</ul>\n<h2 id=\"referências-da-api\"><a href=\"#referências-da-api\">Referências da API</a></h2>\n<p>The following rules only apply to the documentation of APIs.</p>\n<h3 id=\"title-and-description\"><a href=\"#title-and-description\">Title and description</a></h3>\n<p>Each module's API doc must use the actual object name returned by <code>require('electron')</code> as its title (such as <code>BrowserWindow</code>, <code>autoUpdater</code>, and <code>session</code>).</p>\n<p>Directly under the page title, add a one-line description of the module as a markdown quote (beginning with <code>></code>).</p>\n<p>Using the <code>session</code> module as an example:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># session</span>\n\n<span class=\"hljs-quote\">> Manage browser sessions, cookies, cache, proxy settings, etc.</span>\n</code></pre>\n<h3 id=\"métodos-e-eventos-de-módulo\"><a href=\"#métodos-e-eventos-de-módulo\">Métodos e eventos de módulo</a></h3>\n<p>For modules that are not classes, their methods and events must be listed under the <code>## Methods</code> and <code>## Events</code> chapters.</p>\n<p>Using <code>autoUpdater</code> as an example:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># autoUpdater</span>\n\n<span class=\"hljs-section\">## Events</span>\n\n<span class=\"hljs-section\">### Event: 'error'</span>\n\n<span class=\"hljs-section\">## Methods</span>\n\n<span class=\"hljs-section\">### `autoUpdater.setFeedURL(url[, requestHeaders])`</span>\n</code></pre>\n<h3 id=\"classes\"><a href=\"#classes\">Classes</a></h3>\n<ul>\n<li>API classes or classes that are part of modules must be listed under a <code>## Class: TheClassName</code> chapter.</li>\n<li>One page can have multiple classes.</li>\n<li>Constructors must be listed with <code>###</code>-level headings.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static\">Static Methods</a> must be listed under a <code>### Static Methods</code> chapter.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Prototype_methods\">Instance Methods</a> must be listed under an <code>### Instance Methods</code> chapter.</li>\n<li>All methods that have a return value must start their description with \"Returns <code>[TYPE]</code> - [Return description]\"<ul>\n<li>If the method returns an <code>Object</code>, its structure can be specified using a colon followed by a newline then an unordered list of properties in the same style as function parameters.</li>\n</ul></li>\n<li>Los Eventos de Instancia deben aparecer listados bajo un capítulo de <code>### Eventos de Instancia</code>.</li>\n<li>Instance Properties must be listed under an <code>### Instance Properties</code> chapter.<ul>\n<li>Instance Properties must start with \"A [Property Type] ...\"</li>\n</ul></li>\n</ul>\n<p>Usando as classes <code>Session</code> e <code>Cookies</code> como exemplo:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># session</span>\n\n<span class=\"hljs-section\">## Métodos</span>\n\n<span class=\"hljs-section\">### session.fromPartition(partition)</span>\n\n<span class=\"hljs-section\">## Propriedades Estáticas</span>\n\n<span class=\"hljs-section\">### session.defaultSession</span>\n\n<span class=\"hljs-section\">## Classe: Session</span>\n\n<span class=\"hljs-section\">### Eventos de Instância</span>\n\n<span class=\"hljs-section\">#### Event: 'will-download'</span>\n\n<span class=\"hljs-section\">### Métodos de Instância</span>\n\n<span class=\"hljs-section\">#### `ses.getCacheSize()`</span>\n\n<span class=\"hljs-section\">### Propriedades de Instância</span>\n\n<span class=\"hljs-section\">#### `ses.cookies`</span>\n\n<span class=\"hljs-section\">## Classe: Cookies</span>\n\n<span class=\"hljs-section\">### Métodos de Instância</span>\n\n<span class=\"hljs-section\">#### `cookies.get(filter, callback)`</span>\n</code></pre>\n<h3 id=\"methods-and-their-arguments\"><a href=\"#methods-and-their-arguments\">Methods and their arguments</a></h3>\n<p>O capítulo de métodos deve estar no seguinte formato:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### `objectName.methodName(required[, optional]))`</span>\n<span class=\"hljs-bullet\">\n* </span><span class=\"hljs-code\">`required`</span> String - A parameter description.\n<span class=\"hljs-bullet\">* </span><span class=\"hljs-code\">`optional`</span> Integer (optional) - Another parameter description.\n\n...\n</code></pre>\n<h4 id=\"heading-level\"><a href=\"#heading-level\">Heading level</a></h4>\n<p>The heading can be <code>###</code> or <code>####</code>-levels depending on whether the method belongs to a module or a class.</p>\n<h4 id=\"function-signature\"><a href=\"#function-signature\">Function signature</a></h4>\n<p>For modules, the <code>objectName</code> is the module's name. For classes, it must be the name of the instance of the class, and must not be the same as the module's name.</p>\n<p>Por exemplo, os métodos da classe <code>Session</code> sob o módulo <code>session</code> usa <code>ses</code> como <code>objectName</code>.</p>\n<p>Optional arguments are notated by square brackets <code>[]</code> surrounding the optional argument as well as the comma required if this optional argument follows another argument:</p>\n<pre><code class=\"hljs language-markdown\">obrigatório[, opcional]\n</code></pre>\n<h4 id=\"argument-descriptions\"><a href=\"#argument-descriptions\">Argument descriptions</a></h4>\n<p>More detailed information on each of the arguments is noted in an unordered list below the method. The type of argument is notated by either JavaScript primitives (e.g. <code>String</code>, <code>Promise</code>, or <code>Object</code>), a custom API structure like Electron's <a href=\"/docs/api/structures/cookie\"><code>Cookie</code></a>, or the wildcard <code>any</code>.</p>\n<p>If the argument is of type <code>Array</code>, use <code>[]</code> shorthand with the type of value inside the array (for example,<code>any[]</code> or <code>String[]</code>).</p>\n<p>If the argument is of type <code>Promise</code>, parametrize the type with what the promise resolves to (for example, <code>Promise&#x3C;void></code> or <code>Promise&#x3C;String></code>).</p>\n<p>If an argument can be of multiple types, separate the types with <code>|</code>.</p>\n<p>The description for <code>Function</code> type arguments should make it clear how it may be called and list the types of the parameters that will be passed to it.</p>\n<h4 id=\"platform-specific-functionality\"><a href=\"#platform-specific-functionality\">Platform-specific functionality</a></h4>\n<p>Se um argumento ou um método for exclusivo para determinadas plataformas, essas plataformas são denotadas usando uma lista itálica delimitada pelo espaço seguindo o tipo de dados. Os valores podem ser <code>macOS</code>, <code>Windows</code> ou <code>Linux</code>.</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-bullet\">* </span>'animar' Boolean (opcional) <span class=\"hljs-emphasis\">_macOS_</span> <span class=\"hljs-emphasis\">_Windows_</span> - Animar a coisa.\n</code></pre>\n<h3 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h3>\n<p>O capítulo de eventos deve estar na seguinte forma:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### Evento: 'wake-up'</span>\n\nRetorno:\n<span class=\"hljs-bullet\">\n* </span><span class=\"hljs-code\">`time`</span> String\n\n...\n</code></pre>\n<p>The heading can be <code>###</code> or <code>####</code>-levels depending on whether the event belongs to a module or a class.</p>\n<p>Os argumentos de um evento seguem as mesmas regras e métodos.</p>\n<h3 id=\"propriedades\"><a href=\"#propriedades\">Propriedades</a></h3>\n<p>O capítulo de propriedades deve estar no seguinte formulário:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### session.defaultsession</span>\n\n...\n</code></pre>\n<p>The heading can be <code>###</code> or <code>####</code>-levels depending on whether the property belongs to a module or a class.</p>\n<h2 id=\"documentation-translations\"><a href=\"#documentation-translations\">Documentation translations</a></h2>\n<p>Veja <a href=\"https://github.com/electron/i18n#readme\">electron/i18n</a></p>",
      "title": "Guia de estilo de Documentação do Electron",
      "description": ""
    },
    "/docs/tutorial/support": {
      "locale": "pt-BR",
      "slug": "support",
      "href": "/docs/tutorial/support",
      "crowdinFileId": "256253",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/support.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-support\"><a href=\"#electron-support\">Electron Support</a></h1>\n<h2 id=\"finding-support\"><a href=\"#finding-support\">Finding Support</a></h2>\n<p>If you have a security concern, please see the <a href=\"https://github.com/electron/electron/tree/main/SECURITY.md\">security document</a>.</p>\n<p>If you're looking for programming help, for answers to questions, or to join in discussion with other developers who use Electron, you can interact with the community in these locations:</p>\n<ul>\n<li><a href=\"https://discord.com/invite/electron\"><code>Electron's Discord</code></a> has channels for:<ul>\n<li>Você precisa de ajuda</li>\n<li>Ecosystem apps like <a href=\"https://github.com/electron-userland/electron-forge\">Electron Forge</a> and <a href=\"https://github.com/electron/fiddle\">Electron Fiddle</a></li>\n<li>Sharing ideas with other Electron app developers</li>\n<li>And more!</li>\n</ul></li>\n<li><a href=\"https://discuss.atom.io/c/electron\"><code>electron</code></a> category on the Atom forums</li>\n<li><code>#electron</code> channel on <a href=\"https://discuss.atom.io/t/join-us-on-slack/16638?source_topic_id=25406\">Atom's Slack</a></li>\n<li><a href=\"https://telegram.me/electron_ru\"><code>electron-ru</code></a> <em>(Russian)</em></li>\n<li><a href=\"https://electron-br.slack.com\"><code>electron-br</code></a> <em>(Brazilian Portuguese)</em></li>\n<li><a href=\"https://electron-kr.github.io/electron-kr\"><code>electron-kr</code></a> <em>(Korean)</em></li>\n<li><a href=\"https://electron-jp.slack.com\"><code>electron-jp</code></a> <em>(Japanese)</em></li>\n<li><a href=\"https://electron-tr.herokuapp.com\"><code>electron-tr</code></a> <em>(Turkish)</em></li>\n<li><a href=\"https://electron-id.slack.com\"><code>electron-id</code></a> <em>(Indonesia)</em></li>\n<li><a href=\"https://electronpl.github.io\"><code>electron-pl</code></a> <em>(Poland)</em></li>\n</ul>\n<p>If you'd like to contribute to Electron, see the <a href=\"https://github.com/electron/electron/blob/main/CONTRIBUTING.md\">contributing document</a>.</p>\n<p>If you've found a bug in a <a href=\"#supported-versions\">supported version</a> of Electron, please report it with the <a href=\"/docs/development/issues\">issue tracker</a>.</p>\n<p><a href=\"https://github.com/sindresorhus/awesome-electron\">awesome-electron</a> is a community-maintained list of useful example apps, tools and resources.</p>\n<h2 id=\"supported-versions\"><a href=\"#supported-versions\">Supported Versions</a></h2>\n<p><em><strong>Note:</strong> Beginning in September 2021 with Electron 15, the Electron team will temporarily support the latest <strong>four</strong> stable major versions. This extended support is intended to help Electron developers transition to the <a href=\"https://electronjs.org/blog/8-week-cadence\">new eight week release cadence</a>, and will continue until May 2022, with the release of Electron 19. At that time, the Electron team will drop support back to the latest three stable major versions.</em></p>\n<p>The latest three <em>stable</em> major versions are supported by the Electron team. For example, if the latest release is 6.1.x, then the 5.0.x as well as the 4.2.x series are supported.  We only support the latest minor release for each stable release series.  This means that in the case of a security fix 6.1.x will receive the fix, but we will not release a new version of 6.0.x.</p>\n<p>The latest stable release unilaterally receives all fixes from <code>main</code>, and the version prior to that receives the vast majority of those fixes as time and bandwidth warrants. The oldest supported release line will receive only security fixes directly.</p>\n<p>All supported release lines will accept external pull requests to backport fixes previously merged to <code>main</code>, though this may be on a case-by-case basis for some older supported lines. All contested decisions around release line backports will be resolved by the <a href=\"https://github.com/electron/governance/tree/main/wg-releases\">Releases Working Group</a> as an agenda item at their weekly meeting the week the backport PR is raised.</p>\n<p>When an API is changed or removed in a way that breaks existing functionality, the previous functionality will be supported for a minimum of two major versions when possible before being removed. For example, if a function takes three arguments, and that number is reduced to two in major version 10, the three-argument version would continue to work until, at minimum, major version 12. Past the minimum two-version threshold, we will attempt to support backwards compatibility beyond two versions until the maintainers feel the maintenance burden is too high to continue doing so.</p>\n<h3 id=\"currently-supported-versions\"><a href=\"#currently-supported-versions\">Currently supported versions</a></h3>\n<ul>\n<li>15.x.y</li>\n<li>14.x.y</li>\n<li>13.x.y</li>\n<li>12</li>\n</ul>\n<h3 id=\"end-of-life\"><a href=\"#end-of-life\">End-of-life</a></h3>\n<p>When a release branch reaches the end of its support cycle, the series will be deprecated in NPM and a final end-of-support release will be made. This release will add a warning to inform that an unsupported version of Electron is in use.</p>\n<p>These steps are to help app developers learn when a branch they're using becomes unsupported, but without being excessively intrusive to end users.</p>\n<p>If an application has exceptional circumstances and needs to stay on an unsupported series of Electron, developers can silence the end-of-support warning by omitting the final release from the app's <code>package.json</code> <code>devDependencies</code>. For example, since the 1-6-x series ended with an end-of-support 1.6.18 release, developers could choose to stay in the 1-6-x series without warnings with <code>devDependency</code> of <code>\"electron\": 1.6.0 - 1.6.17</code>.</p>\n<h2 id=\"plataformas-suportadas\"><a href=\"#plataformas-suportadas\">Plataformas Suportadas</a></h2>\n<p>Seguintes plataformas são suportadas pelo Electron:</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>Only 64bit binaries are provided for macOS, and the minimum macOS version supported is macOS 10.11 (El Capitan).</p>\n<p>Native support for Apple Silicon (<code>arm64</code>) devices was added in Electron 11.0.0.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<p>Windows 7 e versões posteriores têm suporte, sistemas operacionais mais antigos não são suportados (e não funcionam).</p>\n<p>Both <code>ia32</code> (<code>x86</code>) and <code>x64</code> (<code>amd64</code>) binaries are provided for Windows. <a href=\"/docs/tutorial/windows-arm\">Native support for Windows on Arm (<code>arm64</code>) devices was added in Electron 6.0.8.</a>. Running apps packaged with previous versions is possible using the ia32 binary.</p>\n<h3 id=\"linux\"><a href=\"#linux\">Linux</a></h3>\n<p>The prebuilt binaries of Electron are built on Ubuntu 18.04.</p>\n<p>Whether the prebuilt binary can run on a distribution depends on whether the distribution includes the libraries that Electron is linked to on the building platform, so only Ubuntu 18.04 is guaranteed to work, but following platforms are also verified to be able to run the prebuilt binaries of Electron:</p>\n<ul>\n<li>Ubuntu 14.04 and newer</li>\n<li>Fedora 24 and newer</li>\n<li>Debian 8 and newer</li>\n</ul>",
      "title": "Electron Support",
      "description": ""
    },
    "/docs/api/synopsis": {
      "locale": "pt-BR",
      "slug": "synopsis",
      "href": "/docs/api/synopsis",
      "crowdinFileId": "256371",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/synopsis.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"sinopse\"><a href=\"#sinopse\">Sinopse</a></h1>\n<blockquote>\n<p>Como usar APIs Node.js e Electron.</p>\n</blockquote>\n<p>All of <a href=\"https://nodejs.org/api/\">Node.js's built-in modules</a> are available in Electron and third-party node modules also fully supported as well (including the <a href=\"/docs/tutorial/using-native-node-modules\">native modules</a>).</p>\n<p>O Electron também fornece alguns módulos extras para o desenvolvimento de aplicativos desktop. Some modules are only available in the main process, some are only available in the renderer process (web page), and some can be used in either process type.</p>\n<p>A regra básica é: se um módulo for <a href=\"https://en.wikipedia.org/wiki/Graphical_user_interface\">GUI</a> ou relacionado ao sistema de baixo nível, então deve estar disponível apenas no processo principal. You need to be familiar with the concept of main process vs. renderer process scripts to be able to use those modules.</p>\n<p>The main process script is like a normal Node.js script:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>The renderer process is no different than a normal web page, except for the extra ability to use node modules if <code>nodeIntegration</code> is enabled:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  <span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n  <span class=\"hljs-built_in\">console</span>.log(fs.readFileSync(__filename, <span class=\"hljs-string\">'utf8'</span>))\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<h2 id=\"atribuição-de-desestruturação\"><a href=\"#atribuição-de-desestruturação\">Atribuição de desestruturação</a></h2>\n<p>A partir de 0,37, você pode usar <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment\">tarefa de desestruturação</a> para facilitar a utilização módulos internos.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>Se você precisar de todo o módulo <code>electron</code>, você pode exigi-lo e depois usar desestruturação para acessar os módulos individuais do <code>electron</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> electron = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = electron\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>Isto equivale ao seguinte código:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> electron = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> app = electron.app\n<span class=\"hljs-keyword\">const</span> BrowserWindow = electron.BrowserWindow\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>",
      "title": "Sinopse",
      "description": "Como usar APIs Node.js e Electron."
    },
    "/docs/api/system-preferences": {
      "locale": "pt-BR",
      "slug": "system-preferences",
      "href": "/docs/api/system-preferences",
      "crowdinFileId": "256373",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/system-preferences.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"systempreferences\"><a href=\"#systempreferences\">systemPreferences</a></h1>\n<blockquote>\n<p>Obtenha preferências do sistema.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(systemPreferences.isDarkMode())\n</code></pre>\n<h2 id=\"eventos\"><a href=\"#eventos\">Eventos</a></h2>\n<p>O objeto <code>systemPreferences</code> emite os seguintes eventos:</p>\n<h3 id=\"event-accent-color-changed-windows\"><a href=\"#event-accent-color-changed-windows\">Event: 'accent-color-changed' <em>Windows</em></a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newColor</code> String - The new RGBA color the user assigned to be their system accent color.</li>\n</ul>\n<h3 id=\"event-color-changed-windows\"><a href=\"#event-color-changed-windows\">Event: 'color-changed' <em>Windows</em></a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<h3 id=\"event-inverted-color-scheme-changed-windows-deprecated\"><a href=\"#event-inverted-color-scheme-changed-windows-deprecated\">Event: 'inverted-color-scheme-changed' <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>invertedColorScheme</code> Boolean - <code>true</code> if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is being used, <code>false</code> otherwise.</li>\n</ul>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#event-updated\"><code>updated</code></a> event on the <code>nativeTheme</code> module.</p>\n<h3 id=\"event-high-contrast-color-scheme-changed-windows-deprecated\"><a href=\"#event-high-contrast-color-scheme-changed-windows-deprecated\">Event: 'high-contrast-color-scheme-changed' <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>highContrastColorScheme</code> Boolean - <code>true</code> if a high contrast theme is being used, <code>false</code> otherwise.</li>\n</ul>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#event-updated\"><code>updated</code></a> event on the <code>nativeTheme</code> module.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<h3 id=\"systempreferencesisdarkmode-macos-windows-deprecated\"><a href=\"#systempreferencesisdarkmode-macos-windows-deprecated\"><code>systemPreferences.isDarkMode()</code> <em>macOS</em> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Returns <code>Boolean</code> - Whether the system is in Dark Mode.</p>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#nativethemeshouldusedarkcolors-readonly\"><code>nativeTheme.shouldUseDarkColors</code></a> API.</p>\n<h3 id=\"systempreferencesisswipetrackingfromscrolleventsenabled-no-macos\"><a href=\"#systempreferencesisswipetrackingfromscrolleventsenabled-no-macos\"><code>systemPreferences.isSwipeTrackingFromScrollEventsEnabled()</code> no <em>macOS</em></a></h3>\n<p>Returns <code>Boolean</code> - Whether the Swipe between pages setting is on.</p>\n<h3 id=\"systempreferencespostnotificationevent-userinfo-deliverimmediately-macos\"><a href=\"#systempreferencespostnotificationevent-userinfo-deliverimmediately-macos\"><code>systemPreferences.postNotification(event, userInfo[, deliverImmediately])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n<li><code>deliverImmediately</code> Boolean (optional) - <code>true</code> to post notifications immediately even when the subscribing app is inactive.</li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencespostlocalnotificationevent-userinfo-macos\"><a href=\"#systempreferencespostlocalnotificationevent-userinfo-macos\"><code>systemPreferences.postLocalNotification(event, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencespostworkspacenotificationevent-userinfo-macos\"><a href=\"#systempreferencespostworkspacenotificationevent-userinfo-macos\"><code>systemPreferences.postWorkspaceNotification(event, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencessubscribenotificationevent-callback-no-macos\"><a href=\"#systempreferencessubscribenotificationevent-callback-no-macos\"><code>systemPreferences.subscribeNotification(event, callback)</code> no <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> String</li>\n</ul></li>\n</ul>\n<p>Returns <code>Number</code> - The ID of this subscription</p>\n<p>Subscribes to native notifications of macOS, <code>callback</code> will be called with <code>callback(event, userInfo)</code> when the corresponding <code>event</code> happens. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification. The <code>object</code> is the sender of the notification, and only supports <code>NSString</code> values for now.</p>\n<p>The <code>id</code> of the subscriber is returned, which can be used to unsubscribe the <code>event</code>.</p>\n<p>Under the hood this API subscribes to <code>NSDistributedNotificationCenter</code>, example values of <code>event</code> are:</p>\n<ul>\n<li><code>AppleInterfaceThemeChangedNotification</code></li>\n<li><code>AppleAquaColorVariantChanged</code></li>\n<li><code>AppleColorPreferencesChangedNotification</code></li>\n<li><code>AppleShowScrollBarsSettingChanged</code></li>\n</ul>\n<h3 id=\"systempreferencessubscribelocalnotificationevent-callback-macos\"><a href=\"#systempreferencessubscribelocalnotificationevent-callback-macos\"><code>systemPreferences.subscribeLocalNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> String</li>\n</ul></li>\n</ul>\n<p>Returns <code>Number</code> - The ID of this subscription</p>\n<p>Same as <code>subscribeNotification</code>, but uses <code>NSNotificationCenter</code> for local defaults. This is necessary for events such as <code>NSUserDefaultsDidChangeNotification</code>.</p>\n<h3 id=\"systempreferencessubscribeworkspacenotificationevent-callback-macos\"><a href=\"#systempreferencessubscribeworkspacenotificationevent-callback-macos\"><code>systemPreferences.subscribeWorkspaceNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> String</li>\n</ul></li>\n</ul>\n<p>Returns <code>Number</code> - The ID of this subscription</p>\n<p>Same as <code>subscribeNotification</code>, but uses <code>NSWorkspace.sharedWorkspace.notificationCenter</code>. This is necessary for events such as <code>NSWorkspaceDidActivateApplicationNotification</code>.</p>\n<h3 id=\"systempreferencesunsubscribenotificationid-macos\"><a href=\"#systempreferencesunsubscribenotificationid-macos\"><code>systemPreferences.unsubscribeNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Inteiro</li>\n</ul>\n<p>Removes the subscriber with <code>id</code>.</p>\n<h3 id=\"systempreferencesunsubscribelocalnotificationid-macos\"><a href=\"#systempreferencesunsubscribelocalnotificationid-macos\"><code>systemPreferences.unsubscribeLocalNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Inteiro</li>\n</ul>\n<p>Same as <code>unsubscribeNotification</code>, but removes the subscriber from <code>NSNotificationCenter</code>.</p>\n<h3 id=\"systempreferencesunsubscribeworkspacenotificationid-macos\"><a href=\"#systempreferencesunsubscribeworkspacenotificationid-macos\"><code>systemPreferences.unsubscribeWorkspaceNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Inteiro</li>\n</ul>\n<p>Same as <code>unsubscribeNotification</code>, but removes the subscriber from <code>NSWorkspace.sharedWorkspace.notificationCenter</code>.</p>\n<h3 id=\"systempreferencesregisterdefaultsdefaults-no-macos\"><a href=\"#systempreferencesregisterdefaultsdefaults-no-macos\"><code>systemPreferences.registerDefaults(defaults)</code> no <em>macOS</em></a></h3>\n<ul>\n<li><code>defaults</code> Record&#x3C;String, String | Boolean | Number> - a dictionary of (<code>key: value</code>) user defaults</li>\n</ul>\n<p>Add the specified defaults to your application's <code>NSUserDefaults</code>.</p>\n<h3 id=\"systempreferencesgetuserdefaulttype-extends-keyof-userdefaulttypeskey-type-macos\"><a href=\"#systempreferencesgetuserdefaulttype-extends-keyof-userdefaulttypeskey-type-macos\"><code>systemPreferences.getUserDefault&#x3C;Type extends keyof UserDefaultTypes>(key, type)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n<li><code>type</code> Type - Can be <code>string</code>, <code>boolean</code>, <code>integer</code>, <code>float</code>, <code>double</code>, <code>url</code>, <code>array</code> or <code>dictionary</code>.</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/user-default-types\"><code>UserDefaultTypes[Type]</code></a> - The value of <code>key</code> in <code>NSUserDefaults</code>.</p>\n<p>Some popular <code>key</code> and <code>type</code>s are:</p>\n<ul>\n<li><code>AppleInterfaceStyle</code>: <code>string</code></li>\n<li><code>AppleAquaColorVariant</code>: <code>integer</code></li>\n<li><code>AppleHighlightColor</code>: <code>string</code></li>\n<li><code>AppleShowScrollBars</code>: <code>string</code></li>\n<li><code>NSNavRecentPlaces</code>: <code>array</code></li>\n<li><code>NSPreferredWebServices</code>: <code>dictionary</code></li>\n<li><code>NSUserDictionaryReplacementItems</code>: <code>array</code></li>\n</ul>\n<h3 id=\"systempreferencessetuserdefaultkey-type-value-macos\"><a href=\"#systempreferencessetuserdefaultkey-type-value-macos\"><code>systemPreferences.setUserDefault(key, type, value)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n<li><code>type</code> String - Can be <code>string</code>, <code>boolean</code>, <code>integer</code>, <code>float</code>, <code>double</code>, <code>url</code>, <code>array</code> or <code>dictionary</code>.</li>\n<li><code>value</code> String</li>\n</ul>\n<p>Set the value of <code>key</code> in <code>NSUserDefaults</code>.</p>\n<p>Note that <code>type</code> should match actual type of <code>value</code>. An exception is thrown if they don't.</p>\n<p>Some popular <code>key</code> and <code>type</code>s are:</p>\n<ul>\n<li><code>ApplePressAndHoldEnabled</code>: <code>boolean</code></li>\n</ul>\n<h3 id=\"systempreferencesremoveuserdefaultkey-no-macos\"><a href=\"#systempreferencesremoveuserdefaultkey-no-macos\"><code>systemPreferences.removeUserDefault(key)</code> no <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Removes the <code>key</code> in <code>NSUserDefaults</code>. This can be used to restore the default or global value of a <code>key</code> previously set with <code>setUserDefault</code>.</p>\n<h3 id=\"systempreferencesisaeroglassenabled-windows\"><a href=\"#systempreferencesisaeroglassenabled-windows\"><code>systemPreferences.isAeroGlassEnabled()</code> <em>Windows</em></a></h3>\n<p>Returns <code>Boolean</code> - <code>true</code> if <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/aa969540.aspx\">DWM composition</a> (Aero Glass) is enabled, and <code>false</code> otherwise.</p>\n<p>An example of using it to determine if you should create a transparent window or not (transparent windows won't work correctly when DWM composition is disabled):</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> browserOptions = { <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">1000</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">800</span> }\n\n<span class=\"hljs-comment\">// Make the window transparent only if the platform supports it.</span>\n<span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'win32'</span> || systemPreferences.isAeroGlassEnabled()) {\n  browserOptions.transparent = <span class=\"hljs-literal\">true</span>\n  browserOptions.frame = <span class=\"hljs-literal\">false</span>\n}\n\n<span class=\"hljs-comment\">// Create the window.</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow(browserOptions)\n\n<span class=\"hljs-comment\">// Navigate.</span>\n<span class=\"hljs-keyword\">if</span> (browserOptions.transparent) {\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/index.html`</span>)\n} <span class=\"hljs-keyword\">else</span> {\n  <span class=\"hljs-comment\">// No transparency, so we load a fallback that uses basic styles.</span>\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/fallback.html`</span>)\n}\n</code></pre>\n<h3 id=\"systempreferencesgetaccentcolor-windows-macos\"><a href=\"#systempreferencesgetaccentcolor-windows-macos\"><code>systemPreferences.getAccentColor()</code> <em>Windows</em> <em>macOS</em></a></h3>\n<p>Returns <code>String</code> - The users current system wide accent color preference in RGBA hexadecimal form.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> color = systemPreferences.getAccentColor() <span class=\"hljs-comment\">// `\"aabbccdd\"`</span>\n<span class=\"hljs-keyword\">const</span> red = color.substr(<span class=\"hljs-number\">0</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"aa\"</span>\n<span class=\"hljs-keyword\">const</span> green = color.substr(<span class=\"hljs-number\">2</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"bb\"</span>\n<span class=\"hljs-keyword\">const</span> blue = color.substr(<span class=\"hljs-number\">4</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"cc\"</span>\n<span class=\"hljs-keyword\">const</span> alpha = color.substr(<span class=\"hljs-number\">6</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"dd\"</span>\n</code></pre>\n<p>This API is only available on macOS 10.14 Mojave or newer.</p>\n<h3 id=\"systempreferencesgetcolorcolor-windows-macos\"><a href=\"#systempreferencesgetcolorcolor-windows-macos\"><code>systemPreferences.getColor(color)</code> <em>Windows</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>color</code> String - One of the following values:<ul>\n<li>On <strong>Windows</strong>:<ul>\n<li><code>3d-dark-shadow</code> - Dark shadow for three-dimensional display elements.</li>\n<li><code>3d-face</code> - Face color for three-dimensional display elements and for dialog box backgrounds.</li>\n<li><code>3d-highlight</code> - Highlight color for three-dimensional display elements.</li>\n<li><code>3d-light</code> - Light color for three-dimensional display elements.</li>\n<li><code>3d-shadow</code> - Shadow color for three-dimensional display elements.</li>\n<li><code>active-border</code> - Active window border.</li>\n<li><code>active-caption</code> - Active window title bar. Specifies the left side color in the color gradient of an active window's title bar if the gradient effect is enabled.</li>\n<li><code>active-caption-gradient</code> - Right side color in the color gradient of an active window's title bar.</li>\n<li><code>app-workspace</code> - Background color of multiple document interface (MDI) applications.</li>\n<li><code>button-text</code> - Text on push buttons.</li>\n<li><code>caption-text</code> - Text in caption, size box, and scroll bar arrow box.</li>\n<li><code>desktop</code> - Desktop background color.</li>\n<li><code>disabled-text</code> - Grayed (disabled) text.</li>\n<li><code>highlight</code> - Item(s) selected in a control.</li>\n<li><code>highlight-text</code> - Text of item(s) selected in a control.</li>\n<li><code>hotlight</code> - Color for a hyperlink or hot-tracked item.</li>\n<li><code>inactive-border</code> - Inactive window border.</li>\n<li><code>inactive-caption</code> - Inactive window caption. Specifies the left side color in the color gradient of an inactive window's title bar if the gradient effect is enabled.</li>\n<li><code>inactive-caption-gradient</code> - Right side color in the color gradient of an inactive window's title bar.</li>\n<li><code>inactive-caption-text</code> - Color of text in an inactive caption.</li>\n<li><code>info-background</code> - Background color for tooltip controls.</li>\n<li><code>info-text</code> - Text color for tooltip controls.</li>\n<li><code>menu</code> - Menu background.</li>\n<li><code>menu-highlight</code> - The color used to highlight menu items when the menu appears as a flat menu.</li>\n<li><code>menubar</code> - The background color for the menu bar when menus appear as flat menus.</li>\n<li><code>menu-text</code> - Text in menus.</li>\n<li><code>scrollbar</code> - Scroll bar gray area.</li>\n<li><code>window</code> - Window background.</li>\n<li><code>window-frame</code> - Window frame.</li>\n<li><code>window-text</code> - Text in windows.</li>\n</ul></li>\n<li>On <strong>macOS</strong><ul>\n<li><code>alternate-selected-control-text</code> - The text on a selected surface in a list or table. <em>descontinuado</em></li>\n<li><code>control-background</code> - The background of a large interface element, such as a browser or table.</li>\n<li><code>control</code> - The surface of a control.</li>\n<li><code>control-text</code> -The text of a control that isn’t disabled.</li>\n<li><code>disabled-control-text</code> - The text of a control that’s disabled.</li>\n<li><code>find-highlight</code> - The color of a find indicator.</li>\n<li><code>grid</code> - The gridlines of an interface element such as a table.</li>\n<li><code>header-text</code> - The text of a header cell in a table.</li>\n<li><code>highlight</code> - The virtual light source onscreen.</li>\n<li><code>keyboard-focus-indicator</code> - The ring that appears around the currently focused control when using the keyboard for interface navigation.</li>\n<li><code>label</code> - The text of a label containing primary content.</li>\n<li><code>link</code> - A link to other content.</li>\n<li><code>placeholder-text</code> -  A placeholder string in a control or text view.</li>\n<li><code>quaternary-label</code> - The text of a label of lesser importance than a tertiary label such as watermark text.</li>\n<li><code>scrubber-textured-background</code> - The background of a scrubber in the Touch Bar.</li>\n<li><code>secondary-label</code> - The text of a label of lesser importance than a normal label such as a label used to represent a subheading or additional information.</li>\n<li><code>selected-content-background</code> - The background for selected content in a key window or view.</li>\n<li><code>selected-control</code> - The surface of a selected control.</li>\n<li><code>selected-control-text</code> - The text of a selected control.</li>\n<li><code>selected-menu-item-text</code> - The text of a selected menu.</li>\n<li><code>selected-text-background</code> - The background of selected text.</li>\n<li><code>selected-text</code> - Selected text.</li>\n<li><code>separator</code> - A separator between different sections of content.</li>\n<li><code>shadow</code> - The virtual shadow cast by a raised object onscreen.</li>\n<li><code>tertiary-label</code> - The text of a label of lesser importance than a secondary label such as a label used to represent disabled text.</li>\n<li><code>text-background</code> - Text background.</li>\n<li><code>text</code> -  The text in a document.</li>\n<li><code>under-page-background</code> -  The background behind a document's content.</li>\n<li><code>unemphasized-selected-content-background</code> - The selected content in a non-key window or view.</li>\n<li><code>unemphasized-selected-text-background</code> - A background for selected text in a non-key window or view.</li>\n<li><code>unemphasized-selected-text</code> - Selected text in a non-key window or view.</li>\n<li><code>window-background</code> - The background of a window.</li>\n<li><code>window-frame-text</code> - The text in the window's titlebar area.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>String</code> - The system color setting in RGB hexadecimal form (<code>#ABCDEF</code>). See the <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx\">Windows docs</a> and the <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#dynamic-system-colors\">macOS docs</a> for more details.</p>\n<p>The following colors are only available on macOS 10.14: <code>find-highlight</code>, <code>selected-content-background</code>, <code>separator</code>, <code>unemphasized-selected-content-background</code>, <code>unemphasized-selected-text-background</code>, and <code>unemphasized-selected-text</code>.</p>\n<h3 id=\"systempreferencesgetsystemcolorcolor-no-macos\"><a href=\"#systempreferencesgetsystemcolorcolor-no-macos\"><code>systemPreferences.getSystemColor(color)</code> no <em>macOS</em></a></h3>\n<ul>\n<li><code>color</code> String - One of the following values:<ul>\n<li><code>blue</code></li>\n<li><code>brown</code></li>\n<li><code>gray</code></li>\n<li><code>green</code></li>\n<li><code>orange</code></li>\n<li><code>pink</code></li>\n<li><code>purple</code></li>\n<li><code>red</code></li>\n<li><code>yellow</code></li>\n</ul></li>\n</ul>\n<p>Returns <code>String</code> - The standard system color formatted as <code>#RRGGBBAA</code>.</p>\n<p>Returns one of several standard system colors that automatically adapt to vibrancy and changes in accessibility settings like 'Increase contrast' and 'Reduce transparency'. See <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#system-colors\">Apple Documentation</a> for  more details.</p>\n<h3 id=\"systempreferencesisinvertedcolorscheme-windows-deprecated\"><a href=\"#systempreferencesisinvertedcolorscheme-windows-deprecated\"><code>systemPreferences.isInvertedColorScheme()</code> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Returns <code>Boolean</code> - <code>true</code> if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is active, <code>false</code> otherwise.</p>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly\"><code>nativeTheme.shouldUseInvertedColorScheme</code></a> API.</p>\n<h3 id=\"systempreferencesishighcontrastcolorscheme-macos-windows-deprecated\"><a href=\"#systempreferencesishighcontrastcolorscheme-macos-windows-deprecated\"><code>systemPreferences.isHighContrastColorScheme()</code> <em>macOS</em> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Returns <code>Boolean</code> - <code>true</code> if a high contrast theme is active, <code>false</code> otherwise.</p>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#nativethemeshouldusehighcontrastcolors-macos-windows-readonly\"><code>nativeTheme.shouldUseHighContrastColors</code></a> API.</p>\n<h3 id=\"systempreferencesgeteffectiveappearance-no-macos\"><a href=\"#systempreferencesgeteffectiveappearance-no-macos\"><code>systemPreferences.getEffectiveAppearance()</code> no <em>macOS</em></a></h3>\n<p>Returns <code>String</code> - Can be <code>dark</code>, <code>light</code> or <code>unknown</code>.</p>\n<p>Gets the macOS appearance setting that is currently applied to your application, maps to <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc\">NSApplication.effectiveAppearance</a></p>\n<h3 id=\"systempreferencesgetapplevelappearance-macos-deprecated\"><a href=\"#systempreferencesgetapplevelappearance-macos-deprecated\"><code>systemPreferences.getAppLevelAppearance()</code> <em>macOS</em> <em>Deprecated</em></a></h3>\n<p>Returns <code>String</code> | <code>null</code> - Can be <code>dark</code>, <code>light</code> or <code>unknown</code>.</p>\n<p>Gets the macOS appearance setting that you have declared you want for your application, maps to <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc\">NSApplication.appearance</a>. You can use the <code>setAppLevelAppearance</code> API to set this value.</p>\n<h3 id=\"systempreferencessetapplevelappearanceappearance-macos-deprecated\"><a href=\"#systempreferencessetapplevelappearanceappearance-macos-deprecated\"><code>systemPreferences.setAppLevelAppearance(appearance)</code> <em>macOS</em> <em>Deprecated</em></a></h3>\n<ul>\n<li><code>appearance</code> String | null - Can be <code>dark</code> or <code>light</code></li>\n</ul>\n<p>Sets the appearance setting for your application, this should override the system default and override the value of <code>getEffectiveAppearance</code>.</p>\n<h3 id=\"systempreferencescanprompttouchid-no-macos\"><a href=\"#systempreferencescanprompttouchid-no-macos\"><code>systemPreferences.canPromptTouchID()</code> no <em>macOS</em></a></h3>\n<p>Returns <code>Boolean</code> - whether or not this device has the ability to use Touch ID.</p>\n<p><strong>NOTE:</strong> This API will return <code>false</code> on macOS systems older than Sierra 10.12.2.</p>\n<h3 id=\"systempreferencesprompttouchidreason-no-macos\"><a href=\"#systempreferencesprompttouchidreason-no-macos\"><code>systemPreferences.promptTouchID(reason)</code> no <em>macOS</em></a></h3>\n<ul>\n<li><code>reason</code> String - The reason you are asking for Touch ID authentication</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves if the user has successfully authenticated with Touch ID.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsystemPreferences.promptTouchID(<span class=\"hljs-string\">'To get consent for a Security-Gated Thing'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">success</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'You have successfully authenticated with Touch ID!'</span>)\n}).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(err)\n})\n</code></pre>\n<p>This API itself will not protect your user data; rather, it is a mechanism to allow you to do so. Native apps will need to set <a href=\"https://developer.apple.com/documentation/security/secaccesscontrolcreateflags?language=objc\">Access Control Constants</a> like <a href=\"https://developer.apple.com/documentation/security/secaccesscontrolcreateflags/ksecaccesscontroluserpresence?language=objc\"><code>kSecAccessControlUserPresence</code></a> on their keychain entry so that reading it would auto-prompt for Touch ID biometric consent. This could be done with <a href=\"https://github.com/atom/node-keytar\"><code>node-keytar</code></a>, such that one would store an encryption key with <code>node-keytar</code> and only fetch it if <code>promptTouchID()</code> resolves.</p>\n<p><strong>NOTE:</strong> This API will return a rejected Promise on macOS systems older than Sierra 10.12.2.</p>\n<h3 id=\"systempreferencesistrustedaccessibilityclientprompt-no-macos\"><a href=\"#systempreferencesistrustedaccessibilityclientprompt-no-macos\"><code>systemPreferences.isTrustedAccessibilityClient(prompt)</code> no <em>macOS</em></a></h3>\n<ul>\n<li><code>prompt</code> Boolean - whether or not the user will be informed via prompt if the current process is untrusted.</li>\n</ul>\n<p>Returns <code>Boolean</code> - <code>true</code> if the current process is a trusted accessibility client and <code>false</code> if it is not.</p>\n<h3 id=\"systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><a href=\"#systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><code>systemPreferences.getMediaAccessStatus(mediaType)</code> <em>Windows</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>mediaType</code> String - Can be <code>microphone</code>, <code>camera</code> or <code>screen</code>.</li>\n</ul>\n<p>Returns <code>String</code> - Can be <code>not-determined</code>, <code>granted</code>, <code>denied</code>, <code>restricted</code> or <code>unknown</code>.</p>\n<p>This user consent was not required on macOS 10.13 High Sierra or lower so this method will always return <code>granted</code>. macOS 10.14 Mojave or higher requires consent for <code>microphone</code> and <code>camera</code> access. macOS 10.15 Catalina or higher requires consent for <code>screen</code> access.</p>\n<p>Windows 10 has a global setting controlling <code>microphone</code> and <code>camera</code> access for all win32 applications. It will always return <code>granted</code> for <code>screen</code> and for all media types on older versions of Windows.</p>\n<h3 id=\"systempreferencesaskformediaaccessmediatype-no-macos\"><a href=\"#systempreferencesaskformediaaccessmediatype-no-macos\"><code>systemPreferences.askForMediaAccess(mediaType)</code> no <em>macOS</em></a></h3>\n<ul>\n<li><code>mediaType</code> String - the type of media being requested; can be <code>microphone</code>, <code>camera</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Boolean></code> - A promise that resolves with <code>true</code> if consent was granted and <code>false</code> if it was denied. If an invalid <code>mediaType</code> is passed, the promise will be rejected. If an access request was denied and later is changed through the System Preferences pane, a restart of the app will be required for the new permissions to take effect. If access has already been requested and denied, it <em>must</em> be changed through the preference pane; an alert will not pop up and the promise will resolve with the existing access status.</p>\n<p><strong>Important:</strong> In order to properly leverage this API, you <a href=\"https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos?language=objc\">must set</a> the <code>NSMicrophoneUsageDescription</code> and <code>NSCameraUsageDescription</code> strings in your app's <code>Info.plist</code> file. The values for these keys will be used to populate the permission dialogs so that the user will be properly informed as to the purpose of the permission request. See <a href=\"/docs/tutorial/application-distribution#macos\">Electron Application Distribution</a> for more information about how to set these in the context of Electron.</p>\n<p>This user consent was not required until macOS 10.14 Mojave, so this method will always return <code>true</code> if your system is running 10.13 High Sierra or lower.</p>\n<h3 id=\"systempreferencesgetanimationsettings\"><a href=\"#systempreferencesgetanimationsettings\"><code>systemPreferences.getAnimationSettings()</code></a></h3>\n<p>Retorna <code>Object</code>:</p>\n<ul>\n<li><code>shouldRenderRichAnimation</code> Boolean - Returns true if rich animations should be rendered. Looks at session type (e.g. remote desktop) and accessibility settings to give guidance for heavy animations.</li>\n<li><code>scrollAnimationsEnabledBySystem</code> Boolean - Determines on a per-platform basis whether scroll animations (e.g. produced by home/end key) should be enabled.</li>\n<li><code>prefersReducedMotion</code> Boolean - Determines whether the user desires reduced motion based on platform APIs.</li>\n</ul>\n<p>Returns an object with system animation settings.</p>\n<h2 id=\"propriedades\"><a href=\"#propriedades\">Propriedades</a></h2>\n<h3 id=\"systempreferencesapplevelappearance-no-macos\"><a href=\"#systempreferencesapplevelappearance-no-macos\"><code>systemPreferences.appLevelAppearance</code> no <em>macOS</em></a></h3>\n<p>A <code>String</code> property that can be <code>dark</code>, <code>light</code> or <code>unknown</code>. It determines the macOS appearance setting for your application. This maps to values in: <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc\">NSApplication.appearance</a>. Setting this will override the system default as well as the value of <code>getEffectiveAppearance</code>.</p>\n<p>Possible values that can be set are <code>dark</code> and <code>light</code>, and possible return values are <code>dark</code>, <code>light</code>, and <code>unknown</code>.</p>\n<p>This property is only available on macOS 10.14 Mojave or newer.</p>\n<h3 id=\"systempreferenceseffectiveappearance-macos-readonly\"><a href=\"#systempreferenceseffectiveappearance-macos-readonly\"><code>systemPreferences.effectiveAppearance</code> <em>macOS</em> <em>Readonly</em></a></h3>\n<p>A <code>String</code> property that can be <code>dark</code>, <code>light</code> or <code>unknown</code>.</p>\n<p>Returns the macOS appearance setting that is currently applied to your application, maps to <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc\">NSApplication.effectiveAppearance</a></p>",
      "title": "systemPreferences",
      "description": "Obtenha preferências do sistema."
    },
    "/docs/api/structures/task": {
      "locale": "pt-BR",
      "slug": "task",
      "href": "/docs/api/structures/task",
      "crowdinFileId": "256513",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/task.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"task-object\"><a href=\"#task-object\">Task Object</a></h1>\n<ul>\n<li><code>program</code> String - Path of the program to execute, usually you should specify <code>process.execPath</code> which opens the current program.</li>\n<li><code>arguments</code> String - The command line arguments when <code>program</code> is executed.</li>\n<li><code>title</code> String - The string to be displayed in a JumpList.</li>\n<li><code>description</code> String - Description of this task.</li>\n<li><code>iconPath</code> String - The absolute path to an icon to be displayed in a JumpList, which can be an arbitrary resource file that contains an icon. You can usually specify <code>process.execPath</code> to show the icon of the program.</li>\n<li><code>iconIndex</code> Number - The icon index in the icon file. If an icon file consists of two or more icons, set this value to identify the icon. If an icon file consists of one icon, this value is 0.</li>\n<li><code>workingDirectory</code> String (optional) - The working directory. Default is empty.</li>\n</ul>",
      "title": "Task Object",
      "description": ""
    },
    "/docs/development/testing": {
      "locale": "pt-BR",
      "slug": "testing",
      "href": "/docs/development/testing",
      "crowdinFileId": "256169",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/testing.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"testando\"><a href=\"#testando\">Testando</a></h1>\n<p>We aim to keep the code coverage of Electron high. We ask that all pull request not only pass all existing tests, but ideally also add new tests to cover changed code and new scenarios. Ensuring that we capture as many code paths and use cases of Electron as possible ensures that we all ship apps with fewer bugs.</p>\n<p>This repository comes with linting rules for both JavaScript and C++ – as well as unit and integration tests. To learn more about Electron's coding style, please see the <a href=\"/docs/development/coding-style\">coding-style</a> document.</p>\n<h2 id=\"linting\"><a href=\"#linting\">Linting</a></h2>\n<p>To ensure that your JavaScript is in compliance with the Electron coding style, run <code>npm run lint-js</code>, which will run <code>standard</code> against both Electron itself as well as the unit tests. If you are using an editor with a plugin/addon system, you might want to use one of the many <a href=\"https://standardjs.com/#are-there-text-editor-plugins\">StandardJS addons</a> to be informed of coding style violations before you ever commit them.</p>\n<p>To run <code>standard</code> with parameters, run <code>npm run lint-js --</code> followed by arguments you want passed to <code>standard</code>.</p>\n<p>To ensure that your C++ is in compliance with the Electron coding style, run <code>npm run lint-cpp</code>, which runs a <code>cpplint</code> script. We recommend that you use <code>clang-format</code> and prepared <a href=\"/docs/development/clang-format\">a short tutorial</a>.</p>\n<p>There is not a lot of Python in this repository, but it too is governed by coding style rules. <code>npm run lint-py</code> will check all Python, using <code>pylint</code> to do so.</p>\n<h2 id=\"testes-unitários\"><a href=\"#testes-unitários\">Testes Unitários</a></h2>\n<p>If you are not using <a href=\"https://github.com/electron/build-tools\">build-tools</a>, ensure that that name you have configured for your local build of Electron is one of <code>Testing</code>, <code>Release</code>, <code>Default</code>, <code>Debug</code>, or you have set <code>process.env.ELECTRON_OUT_DIR</code>. Without these set, Electron will fail to perform some pre-testing steps.</p>\n<p>Para executar todos os testes unitários, execute: <code>npm run test</code>. Em uma aplicação Electron os testes podem ser encontrados na pasta <code>spec</code>. Note that it has its own <code>package.json</code> and that its dependencies are therefore not defined in the top-level <code>package.json</code>.</p>\n<p>To run only specific tests matching a pattern, run <code>npm run test -- -g=PATTERN</code>, replacing the <code>PATTERN</code> with a regex that matches the tests you would like to run. As an example: If you want to run only IPC tests, you would run <code>npm run test -- -g ipc</code>.</p>\n<h3 id=\"testing-on-windows-10-devices\"><a href=\"#testing-on-windows-10-devices\">Testing on Windows 10 devices</a></h3>\n<h4 id=\"extra-steps-to-run-the-unit-test\"><a href=\"#extra-steps-to-run-the-unit-test\">Extra steps to run the unit test:</a></h4>\n<ol>\n<li>\n<p>Visual Studio 2019 must be installed.</p>\n</li>\n<li>\n<p>Node headers have to be compiled for your configuration.</p>\n<pre><code class=\"hljs language-powershell\">ninja -C out\\Testing third_party\\electron_node:headers\n</code></pre>\n</li>\n<li>\n<p>The electron.lib has to be copied as node.lib.</p>\n<pre><code class=\"hljs language-powershell\">cd out\\Testing\nmkdir gen\\node_headers\\Release\ncopy electron.lib gen\\node_headers\\Release\\node.lib\n</code></pre>\n</li>\n</ol>\n<h4 id=\"missing-fonts\"><a href=\"#missing-fonts\">Missing fonts</a></h4>\n<p><a href=\"https://docs.microsoft.com/en-us/typography/fonts/windows_10_font_list\">Some Windows 10 devices</a> do not ship with the Meiryo font installed, which may cause a font fallback test to fail. To install Meiryo:</p>\n<ol>\n<li>Push the Windows key and search for <em>Manage optional features</em>.</li>\n<li>Click <em>Add a feature</em>.</li>\n<li>Select <em>Japanese Supplemental Fonts</em> and click <em>Install</em>.</li>\n</ol>\n<h4 id=\"pixel-measurements\"><a href=\"#pixel-measurements\">Pixel measurements</a></h4>\n<p>Some tests which rely on precise pixel measurements may not work correctly on devices with Hi-DPI screen settings due to floating point precision errors. To run these tests correctly, make sure the device is set to 100% scaling.</p>\n<p>To configure display scaling:</p>\n<ol>\n<li>Push the Windows key and search for <em>Display settings</em>.</li>\n<li>Under <em>Scale and layout</em>, make sure that the device is set to 100%.</li>\n</ol>",
      "title": "Testando",
      "description": ""
    },
    "/docs/tutorial/testing-on-headless-ci": {
      "locale": "pt-BR",
      "slug": "testing-on-headless-ci",
      "href": "/docs/tutorial/testing-on-headless-ci",
      "crowdinFileId": "256255",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/testing-on-headless-ci.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"testing-on-headless-ci-systems-travis-ci-jenkins\"><a href=\"#testing-on-headless-ci-systems-travis-ci-jenkins\">Testing on Headless CI Systems (Travis CI, Jenkins)</a></h1>\n<p>Sendo baseado no Chromium, o Electron necessita de um driver de vídeo para rodar. If Chromium can't find a display driver, Electron will fail to launch - and therefore not executing any of your tests, regardless of how you are running them. Para testar aplicativos com base no Electron em sistemas como Travis, Circle, Jenkins ou similares requer que algumas configurações sejam feitas. Basicamente, precisamos usar um driver de vídeo virtual.</p>\n<h2 id=\"configurando-o-servidor-de-vídeo-virtual\"><a href=\"#configurando-o-servidor-de-vídeo-virtual\">Configurando o Servidor de Vídeo Virtual</a></h2>\n<p>Primeiramente instale o <a href=\"https://en.wikipedia.org/wiki/Xvfb\">Xvfb</a>. É um framebuffer que implementa o protocolo de servidor de vídeo do X11 - ele realiza todas as operações gráficas na memória sem mostrar nenhuma mensagem, o que é exatamente o que precisamos.</p>\n<p>Then, create a virtual Xvfb screen and export an environment variable called DISPLAY that points to it. No Electron o Chromium irá procurar automaticamente pela variável <code>$DISPLAY</code>, sendo assim dispensáveis configurações adicionais em seu aplicativo. Esta etapa pode ser automatizada com o pacote <a href=\"https://github.com/anaisbetts/xvfb-maybe\">xvfb-maybe</a>: Preceda seus comandos de teste com <code>xvfb-maybe</code> e a ferramenta fará a configuração automaticamente do Xvfb, se requerido pelo sistema. On Windows or macOS, it will do nothing.</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-comment\">## On Windows or macOS, this invokes electron-mocha</span>\n<span class=\"hljs-comment\">## On Linux, if we are in a headless environment, this will be equivalent</span>\n<span class=\"hljs-comment\">## to xvfb-run electron-mocha ./test/*.js</span>\nxvfb-maybe electron-mocha ./<span class=\"hljs-built_in\">test</span>/*.js\n</code></pre>\n<h3 id=\"travis-ci\"><a href=\"#travis-ci\">Travis CI</a></h3>\n<p>No Travis, o seu <code>.travis;yml</code> deverá se parecer basicamente desta forma:</p>\n<pre><code class=\"hljs language-yml\"><span class=\"hljs-attr\">addons:</span>\n  <span class=\"hljs-attr\">apt:</span>\n    <span class=\"hljs-attr\">packages:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">xvfb</span>\n\n<span class=\"hljs-attr\">install:</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">export</span> <span class=\"hljs-string\">DISPLAY=':99.0'</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">Xvfb</span> <span class=\"hljs-string\">:99</span> <span class=\"hljs-string\">-screen</span> <span class=\"hljs-number\">0</span> <span class=\"hljs-string\">1024x768x24</span> <span class=\"hljs-string\">></span> <span class=\"hljs-string\">/dev/null</span> <span class=\"hljs-number\">2</span><span class=\"hljs-string\">>&#x26;1</span> <span class=\"hljs-string\">&#x26;</span>\n</code></pre>\n<h3 id=\"jenkins\"><a href=\"#jenkins\">Jenkins</a></h3>\n<p>Para o Jenkins, um <a href=\"https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin\">plugin Xvfb está disponível</a>.</p>\n<h3 id=\"circle-ci\"><a href=\"#circle-ci\">Circle CI</a></h3>\n<p>Circle CI is awesome and has Xvfb and <code>$DISPLAY</code> <a href=\"https://circleci.com/docs/environment#browsers\">already set up, so no further configuration is required</a>.</p>\n<h3 id=\"appveyor\"><a href=\"#appveyor\">AppVeyor</a></h3>\n<p>AppVeyor roda no Windows, tendo suporte para Selenium, Chomium, Electron e ferramentas similares de fora - configuração adicional é dispensada.</p>",
      "title": "Testing on Headless CI Systems (Travis CI, Jenkins)",
      "description": ""
    },
    "/docs/tutorial/testing-widevine-cdm": {
      "locale": "pt-BR",
      "slug": "testing-widevine-cdm",
      "href": "/docs/tutorial/testing-widevine-cdm",
      "crowdinFileId": "256257",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/testing-widevine-cdm.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"testando-widevine-ccdm\"><a href=\"#testando-widevine-ccdm\">Testando Widevine CCDM</a></h1>\n<p>No Electron você pode usar a biblioteca Widevine CDM inclusa no navegador Chrome.</p>\n<p>Widevine Content Decryption Modules (CDMs) are how streaming services protect content using HTML5 video to web browsers without relying on an NPAPI plugin like Flash or Silverlight. Widevine support is an alternative solution for streaming services that currently rely on Silverlight for playback of DRM-protected video content. It will allow websites to show DRM-protected video content in Firefox without the use of NPAPI plugins. The Widevine CDM runs in an open-source CDM sandbox providing better user security than NPAPI plugins.</p>\n<h4 id=\"note-on-vmp\"><a href=\"#note-on-vmp\">Note on VMP</a></h4>\n<p>As of <a href=\"https://electronjs.org/releases#1.8.1\"><code>Electron v1.8.0 (Chrome v59)</code></a>, the below steps are may only be some of the necessary steps to enable Widevine; any app on or after that version intending to use the Widevine CDM may need to be signed using a license obtained from <a href=\"https://www.widevine.com/\">Widevine</a> itself.</p>\n<p>Per <a href=\"https://www.widevine.com/\">Widevine</a>:</p>\n<blockquote>\n<p>Chrome 59 (and later) includes support for Verified Media Path (VMP). VMP provides a method to verify the authenticity of a device platform. For browser deployments, this will provide an additional signal to determine if a browser-based implementation is reliable and secure.</p>\n<p>The proxy integration guide has been updated with information about VMP and how to issue licenses.</p>\n<p>Widevine recommends our browser-based integrations (vendors and browser-based applications) add support for VMP.</p>\n</blockquote>\n<p>To enable video playback with this new restriction, <a href=\"https://castlabs.com/open-source/downstream/\">castLabs</a> has created a <a href=\"https://github.com/castlabs/electron-releases\">fork</a> that has implemented the necessary changes to enable Widevine to be played in an Electron application if one has obtained the necessary licenses from widevine.</p>\n<h2 id=\"getting-the-library\"><a href=\"#getting-the-library\">Getting the library</a></h2>\n<p>Open <code>chrome://components/</code> in Chrome browser, find <code>Widevine Content Decryption Module</code> and make sure it is up to date, then you can find the library files from the application directory.</p>\n<h3 id=\"on-windows\"><a href=\"#on-windows\">On Windows</a></h3>\n<p>The library file <code>widevinecdm.dll</code> will be under <code>Program Files(x86)/Google/Chrome/Application/CHROME_VERSION/WidevineCdm/_platform_specific/win_(x86|x64)/</code> directory.</p>\n<h3 id=\"no-macos\"><a href=\"#no-macos\">No macOS</a></h3>\n<p>The library file <code>libwidevinecdm.dylib</code> will be under <code>/Applications/Google Chrome.app/Contents/Versions/CHROME_VERSION/Google Chrome Framework.framework/Versions/A/Libraries/WidevineCdm/_platform_specific/mac_(x86|x64)/</code> directory.</p>\n<p><strong>Note:</strong> Make sure that chrome version used by Electron is greater than or equal to the <code>min_chrome_version</code> value of Chrome's widevine cdm component. The value can be found in <code>manifest.json</code> under <code>WidevineCdm</code> directory.</p>\n<h2 id=\"using-the-library\"><a href=\"#using-the-library\">Using the library</a></h2>\n<p>After getting the library files, you should pass the path to the file with <code>--widevine-cdm-path</code> command line switch, and the library's version with <code>--widevine-cdm-version</code> switch. The command line switches have to be passed before the <code>ready</code> event of <code>app</code> module gets emitted.</p>\n<p>Example code:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// You have to pass the directory that contains widevine library here, it is</span>\n<span class=\"hljs-comment\">// * `libwidevinecdm.dylib` on macOS,</span>\n<span class=\"hljs-comment\">// * `widevinecdm.dll` on Windows.</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'widevine-cdm-path'</span>, <span class=\"hljs-string\">'/path/to/widevine_library'</span>)\n<span class=\"hljs-comment\">// The version of plugin can be got from `chrome://components` page in Chrome.</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'widevine-cdm-version'</span>, <span class=\"hljs-string\">'1.4.8.866'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.show()\n})\n</code></pre>\n<h2 id=\"verifying-widevine-cdm-support\"><a href=\"#verifying-widevine-cdm-support\">Verifying Widevine CDM support</a></h2>\n<p>To verify whether widevine works, you can use following ways:</p>\n<ul>\n<li>Open <a href=\"https://shaka-player-demo.appspot.com/\">https://shaka-player-demo.appspot.com/</a> and load a manifest that uses <code>Widevine</code>.</li>\n<li>Open <a href=\"http://www.dash-player.com/demo/drm-test-area/\">http://www.dash-player.com/demo/drm-test-area/</a>, check whether the page says <code>bitdash uses Widevine in your browser</code>, then play the video.</li>\n</ul>",
      "title": "Testando Widevine CCDM",
      "description": "Chrome 59 (and later) includes support for Verified Media Path (VMP). VMP provides a method to verify the authenticity of a device platform. For browser deployments, this will provide an additional signal to determine if a browser-based implementation is reliable and secure.\nThe proxy integration guide has been updated with information about VMP and how to issue licenses.\nWidevine recommends our browser-based integrations (vendors and browser-based applications) add support for VMP."
    },
    "/docs/api/structures/thumbar-button": {
      "locale": "pt-BR",
      "slug": "thumbar-button",
      "href": "/docs/api/structures/thumbar-button",
      "crowdinFileId": "256515",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/thumbar-button.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"thumbarbutton-object\"><a href=\"#thumbarbutton-object\">ThumbarButton Object</a></h1>\n<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - The icon showing in thumbnail toolbar.</li>\n<li><code>click</code> Function</li>\n<li><code>tooltip</code> String (optional) - The text of the button's tooltip.</li>\n<li><code>flags</code> String<a href=\"/docs/api/structures/optional\"></a> - Control specific states and behaviors of the button. By default, it is <code>['enabled']</code>.</li>\n</ul>\n<p>The <code>flags</code> is an array that can include following <code>String</code>s:</p>\n<ul>\n<li><code>enabled</code> - The button is active and available to the user.</li>\n<li><code>disabled</code> - The button is disabled. It is present, but has a visual state indicating it will not respond to user action.</li>\n<li><code>dismissonclick</code> - When the button is clicked, the thumbnail window closes immediately.</li>\n<li><code>nobackground</code> - Do not draw a button border, use only the image.</li>\n<li><code>hidden</code> - The button is not shown to the user.</li>\n<li><code>noninteractive</code> - The button is enabled but not interactive; no pressed button state is drawn. This value is intended for instances where the button is used in a notification.</li>\n</ul>",
      "title": "ThumbarButton Object",
      "description": ""
    },
    "/docs/api/touch-bar": {
      "locale": "pt-BR",
      "slug": "touch-bar",
      "href": "/docs/api/touch-bar",
      "crowdinFileId": "256395",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"touchbar\"><a href=\"#touchbar\">TouchBar</a></h1>\n<h2 id=\"class-touchbar\"><a href=\"#class-touchbar\">Class: TouchBar</a></h2>\n<blockquote>\n<p>Create TouchBar layouts for native macOS applications</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<h3 id=\"new-touchbaroptions\"><a href=\"#new-touchbaroptions\"><code>new TouchBar(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>items</code> (<a href=\"/docs/api/touch-bar-button\">TouchBarButton</a> | <a href=\"/docs/api/touch-bar-color-picker\">TouchBarColorPicker</a> | <a href=\"/docs/api/touch-bar-group\">TouchBarGroup</a> | <a href=\"/docs/api/touch-bar-label\">TouchBarLabel</a> | <a href=\"/docs/api/touch-bar-popover\">TouchBarPopover</a> | <a href=\"/docs/api/touch-bar-scrubber\">TouchBarScrubber</a> | <a href=\"/docs/api/touch-bar-segmented-control\">TouchBarSegmentedControl</a> | <a href=\"/docs/api/touch-bar-slider\">TouchBarSlider</a> | <a href=\"/docs/api/touch-bar-spacer\">TouchBarSpacer</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>escapeItem</code> (<a href=\"/docs/api/touch-bar-button\">TouchBarButton</a> | <a href=\"/docs/api/touch-bar-color-picker\">TouchBarColorPicker</a> | <a href=\"/docs/api/touch-bar-group\">TouchBarGroup</a> | <a href=\"/docs/api/touch-bar-label\">TouchBarLabel</a> | <a href=\"/docs/api/touch-bar-popover\">TouchBarPopover</a> | <a href=\"/docs/api/touch-bar-scrubber\">TouchBarScrubber</a> | <a href=\"/docs/api/touch-bar-segmented-control\">TouchBarSegmentedControl</a> | <a href=\"/docs/api/touch-bar-slider\">TouchBarSlider</a> | <a href=\"/docs/api/touch-bar-spacer\">TouchBarSpacer</a> | null) (optional)</li>\n</ul></li>\n</ul>\n<p>Creates a new touch bar with the specified items. Use <code>BrowserWindow.setTouchBar</code> to add the <code>TouchBar</code> to a window.</p>\n<p><strong>Note:</strong> The TouchBar API is currently experimental and may change or be removed in future Electron releases.</p>\n<p><strong>Tip:</strong> If you don't have a MacBook with Touch Bar, you can use <a href=\"https://github.com/sindresorhus/touch-bar-simulator\">Touch Bar Simulator</a> to test Touch Bar usage in your app.</p>\n<h3 id=\"static-properties\"><a href=\"#static-properties\">Static Properties</a></h3>\n<h4 id=\"touchbarbutton\"><a href=\"#touchbarbutton\"><code>TouchBarButton</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-button\"><code>typeof TouchBarButton</code></a> reference to the <code>TouchBarButton</code> class.</p>\n<h4 id=\"touchbarcolorpicker\"><a href=\"#touchbarcolorpicker\"><code>TouchBarColorPicker</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-color-picker\"><code>typeof TouchBarColorPicker</code></a> reference to the <code>TouchBarColorPicker</code> class.</p>\n<h4 id=\"touchbargroup\"><a href=\"#touchbargroup\"><code>TouchBarGroup</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-group\"><code>typeof TouchBarGroup</code></a> reference to the <code>TouchBarGroup</code> class.</p>\n<h4 id=\"touchbarlabel\"><a href=\"#touchbarlabel\"><code>TouchBarLabel</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-label\"><code>typeof TouchBarLabel</code></a> reference to the <code>TouchBarLabel</code> class.</p>\n<h4 id=\"touchbarpopover\"><a href=\"#touchbarpopover\"><code>TouchBarPopover</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-popover\"><code>typeof TouchBarPopover</code></a> reference to the <code>TouchBarPopover</code> class.</p>\n<h4 id=\"touchbarscrubber\"><a href=\"#touchbarscrubber\"><code>TouchBarScrubber</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-scrubber\"><code>typeof TouchBarScrubber</code></a> reference to the <code>TouchBarScrubber</code> class.</p>\n<h4 id=\"touchbarsegmentedcontrol\"><a href=\"#touchbarsegmentedcontrol\"><code>TouchBarSegmentedControl</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-segmented-control\"><code>typeof TouchBarSegmentedControl</code></a> reference to the <code>TouchBarSegmentedControl</code> class.</p>\n<h4 id=\"touchbarslider\"><a href=\"#touchbarslider\"><code>TouchBarSlider</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-slider\"><code>typeof TouchBarSlider</code></a> reference to the <code>TouchBarSlider</code> class.</p>\n<h4 id=\"touchbarspacer\"><a href=\"#touchbarspacer\"><code>TouchBarSpacer</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-spacer\"><code>typeof TouchBarSpacer</code></a> reference to the <code>TouchBarSpacer</code> class.</p>\n<h4 id=\"touchbarotheritemsproxy\"><a href=\"#touchbarotheritemsproxy\"><code>TouchBarOtherItemsProxy</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-other-items-proxy\"><code>typeof TouchBarOtherItemsProxy</code></a> reference to the <code>TouchBarOtherItemsProxy</code> class.</p>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<p>The following properties are available on instances of <code>TouchBar</code>:</p>\n<h4 id=\"touchbarescapeitem\"><a href=\"#touchbarescapeitem\"><code>touchBar.escapeItem</code></a></h4>\n<p>A <code>TouchBarItem</code> that will replace the \"esc\" button on the touch bar when set. Setting to <code>null</code> restores the default \"esc\" button. Changing this value immediately updates the escape item in the touch bar.</p>\n<h2 id=\"exemplos\"><a href=\"#exemplos\">Exemplos</a></h2>\n<p>Below is an example of a simple slot machine touch bar game with a button and some labels.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, TouchBar } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> { TouchBarLabel, TouchBarButton, TouchBarSpacer } = TouchBar\n\n<span class=\"hljs-keyword\">let</span> spinning = <span class=\"hljs-literal\">false</span>\n\n<span class=\"hljs-comment\">// Reel labels</span>\n<span class=\"hljs-keyword\">const</span> reel1 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n<span class=\"hljs-keyword\">const</span> reel2 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n<span class=\"hljs-keyword\">const</span> reel3 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n\n<span class=\"hljs-comment\">// Spin result label</span>\n<span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n\n<span class=\"hljs-comment\">// Spin button</span>\n<span class=\"hljs-keyword\">const</span> spin = <span class=\"hljs-keyword\">new</span> TouchBarButton({\n  <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'🎰 Spin'</span>,\n  <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#7851A9'</span>,\n  <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// Ignore clicks if already spinning</span>\n    <span class=\"hljs-keyword\">if</span> (spinning) {\n      <span class=\"hljs-keyword\">return</span>\n    }\n\n    spinning = <span class=\"hljs-literal\">true</span>\n    result.label = <span class=\"hljs-string\">''</span>\n\n    <span class=\"hljs-keyword\">let</span> timeout = <span class=\"hljs-number\">10</span>\n    <span class=\"hljs-keyword\">const</span> spinLength = <span class=\"hljs-number\">4</span> * <span class=\"hljs-number\">1000</span> <span class=\"hljs-comment\">// 4 seconds</span>\n    <span class=\"hljs-keyword\">const</span> startTime = <span class=\"hljs-built_in\">Date</span>.now()\n\n    <span class=\"hljs-keyword\">const</span> spinReels = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      updateReels()\n\n      <span class=\"hljs-keyword\">if</span> ((<span class=\"hljs-built_in\">Date</span>.now() - startTime) >= spinLength) {\n        finishSpin()\n      } <span class=\"hljs-keyword\">else</span> {\n        <span class=\"hljs-comment\">// Slow down a bit on each spin</span>\n        timeout *= <span class=\"hljs-number\">1.1</span>\n        setTimeout(spinReels, timeout)\n      }\n    }\n\n    spinReels()\n  }\n})\n\n<span class=\"hljs-keyword\">const</span> getRandomValue = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> values = [<span class=\"hljs-string\">'🍒'</span>, <span class=\"hljs-string\">'💎'</span>, <span class=\"hljs-string\">'7️⃣'</span>, <span class=\"hljs-string\">'🍊'</span>, <span class=\"hljs-string\">'🔔'</span>, <span class=\"hljs-string\">'⭐'</span>, <span class=\"hljs-string\">'🍇'</span>, <span class=\"hljs-string\">'🍀'</span>]\n  <span class=\"hljs-keyword\">return</span> values[<span class=\"hljs-built_in\">Math</span>.floor(<span class=\"hljs-built_in\">Math</span>.random() * values.length)]\n}\n\n<span class=\"hljs-keyword\">const</span> updateReels = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  reel1.label = getRandomValue()\n  reel2.label = getRandomValue()\n  reel3.label = getRandomValue()\n}\n\n<span class=\"hljs-keyword\">const</span> finishSpin = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> uniqueValues = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Set</span>([reel1.label, reel2.label, reel3.label]).size\n  <span class=\"hljs-keyword\">if</span> (uniqueValues === <span class=\"hljs-number\">1</span>) {\n    <span class=\"hljs-comment\">// All 3 values are the same</span>\n    result.label = <span class=\"hljs-string\">'💰 Jackpot!'</span>\n    result.textColor = <span class=\"hljs-string\">'#FDFF00'</span>\n  } <span class=\"hljs-keyword\">else</span> <span class=\"hljs-keyword\">if</span> (uniqueValues === <span class=\"hljs-number\">2</span>) {\n    <span class=\"hljs-comment\">// 2 values are the same</span>\n    result.label = <span class=\"hljs-string\">'😍 Winner!'</span>\n    result.textColor = <span class=\"hljs-string\">'#FDFF00'</span>\n  } <span class=\"hljs-keyword\">else</span> {\n    <span class=\"hljs-comment\">// No values are the same</span>\n    result.label = <span class=\"hljs-string\">'🙁 Spin Again'</span>\n    result.textColor = <span class=\"hljs-literal\">null</span>\n  }\n  spinning = <span class=\"hljs-literal\">false</span>\n}\n\n<span class=\"hljs-keyword\">const</span> touchBar = <span class=\"hljs-keyword\">new</span> TouchBar({\n  <span class=\"hljs-attr\">items</span>: [\n    spin,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'large'</span> }),\n    reel1,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'small'</span> }),\n    reel2,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'small'</span> }),\n    reel3,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'large'</span> }),\n    result\n  ]\n})\n\n<span class=\"hljs-keyword\">let</span> <span class=\"hljs-built_in\">window</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-built_in\">window</span> = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span>,\n    <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span>,\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#000'</span>\n  })\n  <span class=\"hljs-built_in\">window</span>.loadURL(<span class=\"hljs-string\">'about:blank'</span>)\n  <span class=\"hljs-built_in\">window</span>.setTouchBar(touchBar)\n})\n</code></pre>\n<h3 id=\"running-the-above-example\"><a href=\"#running-the-above-example\">Running the above example</a></h3>\n<p>To run the example above, you'll need to (assuming you've got a terminal open in the directory you want to run the example):</p>\n<ol>\n<li>Save the above file to your computer as <code>touchbar.js</code></li>\n<li>Install Electron via <code>npm install electron</code></li>\n<li>Run the example inside Electron: <code>./node_modules/.bin/electron touchbar.js</code></li>\n</ol>\n<p>You should then see a new Electron window and the app running in your touch bar (or touch bar emulator).</p>",
      "title": "TouchBar",
      "description": "Create TouchBar layouts for native macOS applications"
    },
    "/docs/api/touch-bar-button": {
      "locale": "pt-BR",
      "slug": "touch-bar-button",
      "href": "/docs/api/touch-bar-button",
      "crowdinFileId": "256375",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-button.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarbutton\"><a href=\"#class-touchbarbutton\">Class: TouchBarButton</a></h2>\n<blockquote>\n<p>Create a button in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarbuttonoptions\"><a href=\"#new-touchbarbuttonoptions\"><code>new TouchBarButton(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>label</code> String (optional) - Button text.</li>\n<li><code>accessibilityLabel</code> String (optional) - A short description of the button for use by screenreaders like VoiceOver.</li>\n<li><code>backgroundColor</code> String (optional) - Button background color in hex format, i.e <code>#ABCDEF</code>.</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String (optional) - Button icon.</li>\n<li><code>iconPosition</code> String (optional) - Can be <code>left</code>, <code>right</code> or <code>overlay</code>. O padrão é <code>overlay</code>.</li>\n<li><code>click</code> Function (optional) - Function to call when the button is clicked.</li>\n<li><code>enabled</code> Boolean (optional) - Whether the button is in an enabled state.  Por padrão é <code>true</code>.</li>\n</ul></li>\n</ul>\n<p>When defining <code>accessibilityLabel</code>, ensure you have considered macOS <a href=\"https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc\">best practices</a>.</p>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<p>As seguintes propriedades estão disponíveis em instâncias de <code>TouchBarButton</code>:</p>\n<h4 id=\"touchbarbuttonaccessibilitylabel\"><a href=\"#touchbarbuttonaccessibilitylabel\"><code>touchBarButton.accessibilityLabel</code></a></h4>\n<p>A <code>String</code> representing the description of the button to be read by a screen reader. Will only be read by screen readers if no label is set.</p>\n<h4 id=\"touchbarbuttonlabel\"><a href=\"#touchbarbuttonlabel\"><code>touchBarButton.label</code></a></h4>\n<p>A <code>String</code> representing the button's current text. Changing this value immediately updates the button in the touch bar.</p>\n<h4 id=\"touchbarbuttonbackgroundcolor\"><a href=\"#touchbarbuttonbackgroundcolor\"><code>touchBarButton.backgroundColor</code></a></h4>\n<p>A <code>String</code> hex code representing the button's current background color. Changing this value immediately updates the button in the touch bar.</p>\n<h4 id=\"touchbarbuttonicon\"><a href=\"#touchbarbuttonicon\"><code>touchBarButton.icon</code></a></h4>\n<p>A <code>NativeImage</code> representing the button's current icon. Changing this value immediately updates the button in the touch bar.</p>\n<h4 id=\"touchbarbuttoniconposition\"><a href=\"#touchbarbuttoniconposition\"><code>touchBarButton.iconPosition</code></a></h4>\n<p>A <code>String</code> - Can be <code>left</code>, <code>right</code> or <code>overlay</code>.  O padrão é <code>overlay</code>.</p>\n<h4 id=\"touchbarbuttonenabled\"><a href=\"#touchbarbuttonenabled\"><code>touchBarButton.enabled</code></a></h4>\n<p>A <code>Boolean</code> representing whether the button is in an enabled state.</p>",
      "title": "TouchBarButton",
      "description": "Create a button in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-color-picker": {
      "locale": "pt-BR",
      "slug": "touch-bar-color-picker",
      "href": "/docs/api/touch-bar-color-picker",
      "crowdinFileId": "256377",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-color-picker.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarcolorpicker\"><a href=\"#class-touchbarcolorpicker\">Class: TouchBarColorPicker</a></h2>\n<blockquote>\n<p>Create a color picker in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarcolorpickeroptions\"><a href=\"#new-touchbarcolorpickeroptions\"><code>new TouchBarColorPicker(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>availableColors</code> String<a href=\"/docs/api/optional\"></a> - Array of hex color strings to appear as possible colors to select.</li>\n<li><code>selectedColor</code> String (optional) - The selected hex color in the picker, i.e <code>#ABCDEF</code>.</li>\n<li><code>change</code> Function (optional) - Function to call when a color is selected.<ul>\n<li><code>color</code> String - The color that the user selected from the picker.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<p>As seguintes propriedades estão disponíveis em instâncias de <code>TouchBarColorPicker</code>:</p>\n<h4 id=\"touchbarcolorpickeravailablecolors\"><a href=\"#touchbarcolorpickeravailablecolors\"><code>touchBarColorPicker.availableColors</code></a></h4>\n<p>A <code>String[]</code> array representing the color picker's available colors to select. Changing this value immediately updates the color picker in the touch bar.</p>\n<h4 id=\"touchbarcolorpickerselectedcolor\"><a href=\"#touchbarcolorpickerselectedcolor\"><code>touchBarColorPicker.selectedColor</code></a></h4>\n<p>A <code>String</code> hex code representing the color picker's currently selected color. Changing this value immediately updates the color picker in the touch bar.</p>",
      "title": "TouchBarColorPicker",
      "description": "Create a color picker in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-group": {
      "locale": "pt-BR",
      "slug": "touch-bar-group",
      "href": "/docs/api/touch-bar-group",
      "crowdinFileId": "256379",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-group.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbargroup\"><a href=\"#class-touchbargroup\">Class: TouchBarGroup</a></h2>\n<blockquote>\n<p>Create a group in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbargroupoptions\"><a href=\"#new-touchbargroupoptions\"><code>new TouchBarGroup(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>items</code> <a href=\"/docs/api/touch-bar\">TouchBar</a> - Items to display as a group.</li>\n</ul></li>\n</ul>",
      "title": "TouchBarGroup",
      "description": "Create a group in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-label": {
      "locale": "pt-BR",
      "slug": "touch-bar-label",
      "href": "/docs/api/touch-bar-label",
      "crowdinFileId": "256381",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-label.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarlabel\"><a href=\"#class-touchbarlabel\">Class: TouchBarLabel</a></h2>\n<blockquote>\n<p>Create a label in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarlabeloptions\"><a href=\"#new-touchbarlabeloptions\"><code>new TouchBarLabel(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>label</code> String (optional) - Text to display.</li>\n<li><code>accessibilityLabel</code> String (optional) - A short description of the button for use by screenreaders like VoiceOver.</li>\n<li><code>textColor</code> String (optional) - Hex color of text, i.e <code>#ABCDEF</code>.</li>\n</ul></li>\n</ul>\n<p>When defining <code>accessibilityLabel</code>, ensure you have considered macOS <a href=\"https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc\">best practices</a>.</p>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<p>As seguintes propriedades estão disponíveis em instâncias de <code>TouchBarLabel</code>:</p>\n<h4 id=\"touchbarlabellabel\"><a href=\"#touchbarlabellabel\"><code>touchBarLabel.label</code></a></h4>\n<p>A <code>String</code> representing the label's current text. Changing this value immediately updates the label in the touch bar.</p>\n<h4 id=\"touchbarlabelaccessibilitylabel\"><a href=\"#touchbarlabelaccessibilitylabel\"><code>touchBarLabel.accessibilityLabel</code></a></h4>\n<p>A <code>String</code> representing the description of the label to be read by a screen reader.</p>\n<h4 id=\"touchbarlabeltextcolor\"><a href=\"#touchbarlabeltextcolor\"><code>touchBarLabel.textColor</code></a></h4>\n<p>A <code>String</code> hex code representing the label's current text color. Changing this value immediately updates the label in the touch bar.</p>",
      "title": "TouchBarLabel",
      "description": "Create a label in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-other-items-proxy": {
      "locale": "pt-BR",
      "slug": "touch-bar-other-items-proxy",
      "href": "/docs/api/touch-bar-other-items-proxy",
      "crowdinFileId": "256383",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-other-items-proxy.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarotheritemsproxy\"><a href=\"#class-touchbarotheritemsproxy\">Class: TouchBarOtherItemsProxy</a></h2>\n<blockquote>\n<p>Instantiates a special \"other items proxy\", which nests TouchBar elements inherited from Chromium at the space indicated by the proxy. By default, this proxy is added to each TouchBar at the end of the input. For more information, see the AppKit docs on <a href=\"https://developer.apple.com/documentation/appkit/nstouchbaritemidentifierotheritemsproxy\">NSTouchBarItemIdentifierOtherItemsProxy</a></p>\n<p>Note: Only one instance of this class can be added per TouchBar.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarotheritemsproxy\"><a href=\"#new-touchbarotheritemsproxy\"><code>new TouchBarOtherItemsProxy()</code></a></h3>",
      "title": "TouchBarOtherItemsProxy",
      "description": "Instantiates a special \"other items proxy\", which nests TouchBar elements inherited from Chromium at the space indicated by the proxy. By default, this proxy is added to each TouchBar at the end of the input. For more information, see the AppKit docs on NSTouchBarItemIdentifierOtherItemsProxy\nNote: Only one instance of this class can be added per TouchBar."
    },
    "/docs/api/touch-bar-popover": {
      "locale": "pt-BR",
      "slug": "touch-bar-popover",
      "href": "/docs/api/touch-bar-popover",
      "crowdinFileId": "256385",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-popover.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarpopover\"><a href=\"#class-touchbarpopover\">Class: TouchBarPopover</a></h2>\n<blockquote>\n<p>Create a popover in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarpopoveroptions\"><a href=\"#new-touchbarpopoveroptions\"><code>new TouchBarPopover(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>label</code> String (optional) - Popover button text.</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> (optional) - Popover button icon.</li>\n<li><code>items</code> <a href=\"/docs/api/touch-bar\">TouchBar</a> - Items to display in the popover.</li>\n<li><code>showCloseButton</code> Boolean (optional) - <code>true</code> to display a close button on the left of the popover, <code>false</code> to not show it. Por padrão é <code>true</code>.</li>\n</ul></li>\n</ul>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<p>As seguintes propriedades estão disponíveis em instâncias de <code>TouchBarPopover</code>:</p>\n<h4 id=\"touchbarpopoverlabel\"><a href=\"#touchbarpopoverlabel\"><code>touchBarPopover.label</code></a></h4>\n<p>A <code>String</code> representing the popover's current button text. Changing this value immediately updates the popover in the touch bar.</p>\n<h4 id=\"touchbarpopovericon\"><a href=\"#touchbarpopovericon\"><code>touchBarPopover.icon</code></a></h4>\n<p>A <code>NativeImage</code> representing the popover's current button icon. Changing this value immediately updates the popover in the touch bar.</p>",
      "title": "TouchBarPopover",
      "description": "Create a popover in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-scrubber": {
      "locale": "pt-BR",
      "slug": "touch-bar-scrubber",
      "href": "/docs/api/touch-bar-scrubber",
      "crowdinFileId": "256387",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-scrubber.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarscrubber\"><a href=\"#class-touchbarscrubber\">Class: TouchBarScrubber</a></h2>\n<blockquote>\n<p>Create a scrubber (a scrollable selector)</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarscrubberoptions\"><a href=\"#new-touchbarscrubberoptions\"><code>new TouchBarScrubber(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>items</code> <a href=\"/docs/api/structures/scrubber-item\">ScrubberItem[]</a> - An array of items to place in this scrubber.</li>\n<li><code>select</code> Function (optional) - Called when the user taps an item that was not the last tapped item.<ul>\n<li><code>selectedIndex</code> Integer - The index of the item the user selected.</li>\n</ul></li>\n<li><code>highlight</code> Function (optional) - Called when the user taps any item.<ul>\n<li><code>highlightedIndex</code> Integer - The index of the item the user touched.</li>\n</ul></li>\n<li><code>selectedStyle</code> String (optional) - Selected item style. Can be <code>background</code>, <code>outline</code> or <code>none</code>. O padrão é <code>none</code>.</li>\n<li><code>overlayStyle</code> String (optional) - Selected overlay item style. Can be <code>background</code>, <code>outline</code> or <code>none</code>. O padrão é <code>none</code>.</li>\n<li><code>showArrowButtons</code> Boolean (optional) - Whether to show arrow buttons. Defaults to <code>false</code> and is only shown if <code>items</code> is non-empty.</li>\n<li><code>mode</code> String (optional) - Can be <code>fixed</code> or <code>free</code>. O padrão é <code>free</code>.</li>\n<li><code>continuous</code> Boolean (optional) - Defaults to <code>true</code>.</li>\n</ul></li>\n</ul>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<p>As seguintes propriedades estão disponíveis em instâncias de <code>TouchBarScrubber</code>:</p>\n<h4 id=\"touchbarscrubberitems\"><a href=\"#touchbarscrubberitems\"><code>touchBarScrubber.items</code></a></h4>\n<p>A <code>ScrubberItem[]</code> array representing the items in this scrubber. Updating this value immediately updates the control in the touch bar. Updating deep properties inside this array <strong>does not update the touch bar</strong>.</p>\n<h4 id=\"touchbarscrubberselectedstyle\"><a href=\"#touchbarscrubberselectedstyle\"><code>touchBarScrubber.selectedStyle</code></a></h4>\n<p>A <code>String</code> representing the style that selected items in the scrubber should have. Updating this value immediately updates the control in the touch bar. Valores possíveis:</p>\n<ul>\n<li><code>background</code> - Maps to <code>[NSScrubberSelectionStyle roundedBackgroundStyle]</code>.</li>\n<li><code>outline</code> - Maps to <code>[NSScrubberSelectionStyle outlineOverlayStyle]</code>.</li>\n<li><code>none</code> - Removes all styles.</li>\n</ul>\n<h4 id=\"touchbarscrubberoverlaystyle\"><a href=\"#touchbarscrubberoverlaystyle\"><code>touchBarScrubber.overlayStyle</code></a></h4>\n<p>A <code>String</code> representing the style that selected items in the scrubber should have. This style is overlayed on top of the scrubber item instead of being placed behind it. Updating this value immediately updates the control in the touch bar. Valores possíveis:</p>\n<ul>\n<li><code>background</code> - Maps to <code>[NSScrubberSelectionStyle roundedBackgroundStyle]</code>.</li>\n<li><code>outline</code> - Maps to <code>[NSScrubberSelectionStyle outlineOverlayStyle]</code>.</li>\n<li><code>none</code> - Removes all styles.</li>\n</ul>\n<h4 id=\"touchbarscrubbershowarrowbuttons\"><a href=\"#touchbarscrubbershowarrowbuttons\"><code>touchBarScrubber.showArrowButtons</code></a></h4>\n<p>A <code>Boolean</code> representing whether to show the left / right selection arrows in this scrubber. Updating this value immediately updates the control in the touch bar.</p>\n<h4 id=\"touchbarscrubbermode\"><a href=\"#touchbarscrubbermode\"><code>touchBarScrubber.mode</code></a></h4>\n<p>A <code>String</code> representing the mode of this scrubber. Updating this value immediately updates the control in the touch bar. Valores possíveis:</p>\n<ul>\n<li><code>fixed</code> - Maps to <code>NSScrubberModeFixed</code>.</li>\n<li><code>free</code> - Maps to <code>NSScrubberModeFree</code>.</li>\n</ul>\n<h4 id=\"touchbarscrubbercontinuous\"><a href=\"#touchbarscrubbercontinuous\"><code>touchBarScrubber.continuous</code></a></h4>\n<p>A <code>Boolean</code> representing whether this scrubber is continuous or not. Updating this value immediately updates the control in the touch bar.</p>",
      "title": "TouchBarScrubber",
      "description": "Create a scrubber (a scrollable selector)"
    },
    "/docs/api/touch-bar-segmented-control": {
      "locale": "pt-BR",
      "slug": "touch-bar-segmented-control",
      "href": "/docs/api/touch-bar-segmented-control",
      "crowdinFileId": "256389",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-segmented-control.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarsegmentedcontrol\"><a href=\"#class-touchbarsegmentedcontrol\">Class: TouchBarSegmentedControl</a></h2>\n<blockquote>\n<p>Create a segmented control (a button group) where one button has a selected state</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarsegmentedcontroloptions\"><a href=\"#new-touchbarsegmentedcontroloptions\"><code>new TouchBarSegmentedControl(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>segmentStyle</code> String (optional) - Style of the segments:<ul>\n<li><code>automatic</code> - Default. The appearance of the segmented control is automatically determined based on the type of window in which the control is displayed and the position within the window. Maps to <code>NSSegmentStyleAutomatic</code>.</li>\n<li><code>rounded</code> - The control is displayed using the rounded style. Maps to <code>NSSegmentStyleRounded</code>.</li>\n<li><code>textured-rounded</code> - The control is displayed using the textured rounded style. Maps to <code>NSSegmentStyleTexturedRounded</code>.</li>\n<li><code>round-rect</code> - The control is displayed using the round rect style. Maps to <code>NSSegmentStyleRoundRect</code>.</li>\n<li><code>textured-square</code> - The control is displayed using the textured square style. Maps to <code>NSSegmentStyleTexturedSquare</code>.</li>\n<li><code>capsule</code> - The control is displayed using the capsule style. Maps to <code>NSSegmentStyleCapsule</code>.</li>\n<li><code>small-square</code> - The control is displayed using the small square style. Maps to <code>NSSegmentStyleSmallSquare</code>.</li>\n<li><code>separated</code> - The segments in the control are displayed very close to each other but not touching. Maps to <code>NSSegmentStyleSeparated</code>.</li>\n</ul></li>\n<li><code>mode</code> String (optional) - The selection mode of the control:<ul>\n<li><code>single</code> - Default. One item selected at a time, selecting one deselects the previously selected item. Maps to <code>NSSegmentSwitchTrackingSelectOne</code>.</li>\n<li><code>multiple</code> - Multiple items can be selected at a time. Maps to <code>NSSegmentSwitchTrackingSelectAny</code>.</li>\n<li><code>buttons</code> - Make the segments act as buttons, each segment can be pressed and released but never marked as active. Maps to <code>NSSegmentSwitchTrackingMomentary</code>.</li>\n</ul></li>\n<li><code>segments</code> <a href=\"/docs/api/structures/segmented-control-segment\">SegmentedControlSegment[]</a> - An array of segments to place in this control.</li>\n<li><code>selectedIndex</code> Integer (optional) - The index of the currently selected segment, will update automatically with user interaction. When the mode is <code>multiple</code> it will be the last selected item.</li>\n<li><code>change</code> Function (optional) - Called when the user selects a new segment.<ul>\n<li><code>selectedIndex</code> Integer - The index of the segment the user selected.</li>\n<li><code>isSelected</code> Boolean - Whether as a result of user selection the segment is selected or not.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<p>As seguintes propriedades estão disponíveis em instâncias de <code>TouchBarSegmentedControl</code>:</p>\n<h4 id=\"touchbarsegmentedcontrolsegmentstyle\"><a href=\"#touchbarsegmentedcontrolsegmentstyle\"><code>touchBarSegmentedControl.segmentStyle</code></a></h4>\n<p>A <code>String</code> representing the controls current segment style. Updating this value immediately updates the control in the touch bar.</p>\n<h4 id=\"touchbarsegmentedcontrolsegments\"><a href=\"#touchbarsegmentedcontrolsegments\"><code>touchBarSegmentedControl.segments</code></a></h4>\n<p>A <code>SegmentedControlSegment[]</code> array representing the segments in this control. Updating this value immediately updates the control in the touch bar. Updating deep properties inside this array <strong>does not update the touch bar</strong>.</p>\n<h4 id=\"touchbarsegmentedcontrolselectedindex\"><a href=\"#touchbarsegmentedcontrolselectedindex\"><code>touchBarSegmentedControl.selectedIndex</code></a></h4>\n<p>An <code>Integer</code> representing the currently selected segment. Changing this value immediately updates the control in the touch bar. User interaction with the touch bar will update this value automatically.</p>\n<h4 id=\"touchbarsegmentedcontrolmode\"><a href=\"#touchbarsegmentedcontrolmode\"><code>touchBarSegmentedControl.mode</code></a></h4>\n<p>A <code>String</code> representing the current selection mode of the control.  Can be <code>single</code>, <code>multiple</code> or <code>buttons</code>.</p>",
      "title": "TouchBarSegmentedControl",
      "description": "Create a segmented control (a button group) where one button has a selected state"
    },
    "/docs/api/touch-bar-slider": {
      "locale": "pt-BR",
      "slug": "touch-bar-slider",
      "href": "/docs/api/touch-bar-slider",
      "crowdinFileId": "256391",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-slider.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarslider\"><a href=\"#class-touchbarslider\">Class: TouchBarSlider</a></h2>\n<blockquote>\n<p>Create a slider in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarslideroptions\"><a href=\"#new-touchbarslideroptions\"><code>new TouchBarSlider(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>label</code> String (optional) - Label text.</li>\n<li><code>value</code> Integer (optional) - Selected value.</li>\n<li><code>minValue</code> Integer (optional) - Minimum value.</li>\n<li><code>maxValue</code> Integer (optional) - Maximum value.</li>\n<li><code>change</code> Function (optional) - Function to call when the slider is changed.<ul>\n<li><code>newValue</code> Number - The value that the user selected on the Slider.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<p>As seguintes propriedades estão disponíveis em instâncias de <code>TouchBarSlider</code>:</p>\n<h4 id=\"touchbarsliderlabel\"><a href=\"#touchbarsliderlabel\"><code>touchBarSlider.label</code></a></h4>\n<p>A <code>String</code> representing the slider's current text. Changing this value immediately updates the slider in the touch bar.</p>\n<h4 id=\"touchbarslidervalue\"><a href=\"#touchbarslidervalue\"><code>touchBarSlider.value</code></a></h4>\n<p>A <code>Number</code> representing the slider's current value. Changing this value immediately updates the slider in the touch bar.</p>\n<h4 id=\"touchbarsliderminvalue\"><a href=\"#touchbarsliderminvalue\"><code>touchBarSlider.minValue</code></a></h4>\n<p>A <code>Number</code> representing the slider's current minimum value. Changing this value immediately updates the slider in the touch bar.</p>\n<h4 id=\"touchbarslidermaxvalue\"><a href=\"#touchbarslidermaxvalue\"><code>touchBarSlider.maxValue</code></a></h4>\n<p>A <code>Number</code> representing the slider's current maximum value. Changing this value immediately updates the slider in the touch bar.</p>",
      "title": "TouchBarSlider",
      "description": "Create a slider in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-spacer": {
      "locale": "pt-BR",
      "slug": "touch-bar-spacer",
      "href": "/docs/api/touch-bar-spacer",
      "crowdinFileId": "256393",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-spacer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarspacer\"><a href=\"#class-touchbarspacer\">Class: TouchBarSpacer</a></h2>\n<blockquote>\n<p>Create a spacer between two items in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarspaceroptions\"><a href=\"#new-touchbarspaceroptions\"><code>new TouchBarSpacer(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>size</code> String (optional) - Size of spacer, possible values are:<ul>\n<li><code>small</code> - Small space between items. Maps to <code>NSTouchBarItemIdentifierFixedSpaceSmall</code>. This is the default.</li>\n<li><code>large</code> - Large space between items. Maps to <code>NSTouchBarItemIdentifierFixedSpaceLarge</code>.</li>\n<li><code>flexible</code> - Take up all available space. Maps to <code>NSTouchBarItemIdentifierFlexibleSpace</code>.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<p>As seguintes propriedades estão disponíveis em instâncias de <code>TouchBarSpacer</code>:</p>\n<h4 id=\"touchbarspacersize\"><a href=\"#touchbarspacersize\"><code>touchBarSpacer.size</code></a></h4>\n<p>A <code>String</code> representing the size of the spacer.  Can be <code>small</code>, <code>large</code> or <code>flexible</code>.</p>",
      "title": "TouchBarSpacer",
      "description": "Create a spacer between two items in the touch bar for native macOS applications"
    },
    "/docs/api/structures/trace-categories-and-options": {
      "locale": "pt-BR",
      "slug": "trace-categories-and-options",
      "href": "/docs/api/structures/trace-categories-and-options",
      "crowdinFileId": "256517",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/trace-categories-and-options.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"tracecategoriesandoptions-object\"><a href=\"#tracecategoriesandoptions-object\">TraceCategoriesAndOptions Object</a></h1>\n<ul>\n<li><code>categoryFilter</code> String - A filter to control what category groups should be traced. A filter can have an optional '-' prefix to exclude category groups that contain a matching category. Having both included and excluded category patterns in the same list is not supported. Examples: <code>test_MyTest*</code>, <code>test_MyTest*,test_OtherStuff</code>, <code>-excluded_category1,-excluded_category2</code>.</li>\n<li><code>traceOptions</code> String - Controls what kind of tracing is enabled, it is a comma-delimited sequence of the following strings: <code>record-until-full</code>, <code>record-continuously</code>, <code>trace-to-console</code>, <code>enable-sampling</code>, <code>enable-systrace</code>, e.g. <code>'record-until-full,enable-sampling'</code>. The first 3 options are trace recording modes and hence mutually exclusive. If more than one trace recording modes appear in the <code>traceOptions</code> string, the last one takes precedence. If none of the trace recording modes are specified, recording mode is <code>record-until-full</code>. The trace option will first be reset to the default option (<code>record_mode</code> set to <code>record-until-full</code>, <code>enable_sampling</code> and <code>enable_systrace</code> set to <code>false</code>) before options parsed from <code>traceOptions</code> are applied on it.</li>\n</ul>",
      "title": "TraceCategoriesAndOptions Object",
      "description": ""
    },
    "/docs/api/structures/trace-config": {
      "locale": "pt-BR",
      "slug": "trace-config",
      "href": "/docs/api/structures/trace-config",
      "crowdinFileId": "256519",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/trace-config.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"traceconfig-object\"><a href=\"#traceconfig-object\">TraceConfig Object</a></h1>\n<ul>\n<li><code>recording_mode</code> String (optional) - Can be <code>record-until-full</code>, <code>record-continuously</code>, <code>record-as-much-as-possible</code> or <code>trace-to-console</code>. Defaults to <code>record-until-full</code>.</li>\n<li><code>trace_buffer_size_in_kb</code> number (optional) - maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.</li>\n<li><code>trace_buffer_size_in_events</code> number (optional) - maximum size of the trace recording buffer in events.</li>\n<li><code>enable_argument_filter</code> boolean (optional) - if true, filter event data according to a specific list of events that have been manually vetted to not include any PII. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/services/tracing/public/cpp/trace_event_args_whitelist.cc\">the implementation in Chromium</a> for specifics.</li>\n<li><code>included_categories</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of tracing categories to include. Can include glob-like patterns using <code>*</code> at the end of the category name. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">tracing categories</a> for the list of categories.</li>\n<li><code>excluded_categories</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of tracing categories to exclude. Can include glob-like patterns using <code>*</code> at the end of the category name. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">tracing categories</a> for the list of categories.</li>\n<li><code>included_process_ids</code> number<a href=\"/docs/api/structures/optional\"></a> - a list of process IDs to include in the trace. If not specified, trace all processes.</li>\n<li><code>histogram_names</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of <a href=\"https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md\">histogram</a> names to report with the trace.</li>\n<li><code>memory_dump_config</code> Record&#x3C;String, any> (optional) - if the <code>disabled-by-default-memory-infra</code> category is enabled, this contains optional additional configuration for data collection. See the <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/memory-infra/memory_infra_startup_tracing.md#the-advanced-way\">Chromium memory-infra docs</a> for more information.</li>\n</ul>\n<p>An example TraceConfig that roughly matches what Chrome DevTools records:</p>\n<pre><code class=\"hljs language-js\">{\n  <span class=\"hljs-attr\">recording_mode</span>: <span class=\"hljs-string\">'record-until-full'</span>,\n  <span class=\"hljs-attr\">included_categories</span>: [\n    <span class=\"hljs-string\">'devtools.timeline'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline.frame'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline.stack'</span>,\n    <span class=\"hljs-string\">'v8.execute'</span>,\n    <span class=\"hljs-string\">'blink.console'</span>,\n    <span class=\"hljs-string\">'blink.user_timing'</span>,\n    <span class=\"hljs-string\">'latencyInfo'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-v8.cpu_profiler'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-v8.cpu_profiler.hires'</span>\n  ],\n  <span class=\"hljs-attr\">excluded_categories</span>: [<span class=\"hljs-string\">'*'</span>]\n}\n</code></pre>",
      "title": "TraceConfig Object",
      "description": ""
    },
    "/docs/api/structures/transaction": {
      "locale": "pt-BR",
      "slug": "transaction",
      "href": "/docs/api/structures/transaction",
      "crowdinFileId": "256521",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/transaction.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"transaction-object\"><a href=\"#transaction-object\">Transaction Object</a></h1>\n<ul>\n<li><code>transactionIdentifier</code> String - A string that uniquely identifies a successful payment transaction.</li>\n<li><code>transactionDate</code> String - The date the transaction was added to the App Store’s payment queue.</li>\n<li><code>originalTransactionIdentifier</code> String - The identifier of the restored transaction by the App Store.</li>\n<li><code>transactionState</code> String - The transaction state, can be <code>purchasing</code>, <code>purchased</code>, <code>failed</code>, <code>restored</code> or <code>deferred</code>.</li>\n<li><code>errorCode</code> Integer - The error code if an error occurred while processing the transaction.</li>\n<li><code>errorMessage</code> String - The error message if an error occurred while processing the transaction.</li>\n<li><code>payment</code> Object<ul>\n<li><code>productIdentifier</code> String - The identifier of the purchased product.</li>\n<li><code>quantity</code> Integer  - The quantity purchased.</li>\n</ul></li>\n</ul>",
      "title": "Transaction Object",
      "description": ""
    },
    "/docs/api/tray": {
      "locale": "pt-BR",
      "slug": "tray",
      "href": "/docs/api/tray",
      "crowdinFileId": "256397",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/tray.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"tray\"><a href=\"#tray\">Tray</a></h1>\n<h2 id=\"class-tray\"><a href=\"#class-tray\">Class: Tray</a></h2>\n<blockquote>\n<p>Add icons and context menus to the system's notification area.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>Tray</code> é um <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> tray = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/my/icon'</span>)\n  <span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item3'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item4'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n  ])\n  tray.setToolTip(<span class=\"hljs-string\">'This is my application.'</span>)\n  tray.setContextMenu(contextMenu)\n})\n</code></pre>\n<p><strong>Limitações de plataforma:</strong></p>\n<ul>\n<li>On Linux the app indicator will be used if it is supported, otherwise <code>GtkStatusIcon</code> will be used instead.</li>\n<li>On Linux distributions that only have app indicator support, you have to install <code>libappindicator1</code> to make the tray icon work.</li>\n<li>App indicator will only be shown when it has a context menu.</li>\n<li>When app indicator is used on Linux, the <code>click</code> event is ignored.</li>\n<li>On Linux in order for changes made to individual <code>MenuItem</code>s to take effect, you have to call <code>setContextMenu</code> again. Como por exemplo:</li>\n</ul>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> appIcon = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/my/icon'</span>)\n  <span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n  ])\n\n  <span class=\"hljs-comment\">// Make a change to the context menu</span>\n  contextMenu.items[<span class=\"hljs-number\">1</span>].checked = <span class=\"hljs-literal\">false</span>\n\n  <span class=\"hljs-comment\">// Call this again for Linux because we modified the context menu</span>\n  appIcon.setContextMenu(contextMenu)\n})\n</code></pre>\n<ul>\n<li>On Windows it is recommended to use <code>ICO</code> icons to get best visual effects.</li>\n</ul>\n<p>If you want to keep exact same behaviors on all platforms, you should not rely on the <code>click</code> event and always attach a context menu to the tray icon.</p>\n<h3 id=\"new-trayimage-guid\"><a href=\"#new-trayimage-guid\"><code>new Tray(image, [guid])</code></a></h3>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n<li><code>guid</code> String (optional) <em>Windows</em> - Assigns a GUID to the tray icon. If the executable is signed and the signature contains an organization in the subject line then the GUID is permanently associated with that signature. OS level settings like the position of the tray icon in the system tray will persist even if the path to the executable changes. If the executable is not code-signed then the GUID is permanently associated with the path to the executable. Changing the path to the executable will break the creation of the tray icon and a new GUID must be used. However, it is highly recommended to use the GUID parameter only in conjunction with code-signed executable. If an App defines multiple tray icons then each icon must use a separate GUID.</li>\n</ul>\n<p>Creates a new tray icon associated with the <code>image</code>.</p>\n<h3 id=\"eventos-de-instância\"><a href=\"#eventos-de-instância\">Eventos de instância</a></h3>\n<p>O módulo <code>Tray</code> emite os seguintes eventos:</p>\n<h4 id=\"event-click\"><a href=\"#event-click\">Event: 'click'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - The bounds of tray icon.</li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - The position of the event.</li>\n</ul>\n<p>Emitted when the tray icon is clicked.</p>\n<h4 id=\"event-right-click-macos-windows\"><a href=\"#event-right-click-macos-windows\">Event: 'right-click' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - The bounds of tray icon.</li>\n</ul>\n<p>Emitted when the tray icon is right clicked.</p>\n<h4 id=\"event-double-click-macos-windows\"><a href=\"#event-double-click-macos-windows\">Event: 'double-click' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - The bounds of tray icon.</li>\n</ul>\n<p>Emitted when the tray icon is double clicked.</p>\n<h4 id=\"event-balloon-show-windows\"><a href=\"#event-balloon-show-windows\">Event: 'balloon-show' <em>Windows</em></a></h4>\n<p>Emitted when the tray balloon shows.</p>\n<h4 id=\"event-balloon-click-windows\"><a href=\"#event-balloon-click-windows\">Event: 'balloon-click' <em>Windows</em></a></h4>\n<p>Emitted when the tray balloon is clicked.</p>\n<h4 id=\"event-balloon-closed-windows\"><a href=\"#event-balloon-closed-windows\">Event: 'balloon-closed' <em>Windows</em></a></h4>\n<p>Emitted when the tray balloon is closed because of timeout or user manually closes it.</p>\n<h4 id=\"event-drop-macos\"><a href=\"#event-drop-macos\">Event: 'drop' <em>macOS</em></a></h4>\n<p>Emitted when any dragged items are dropped on the tray icon.</p>\n<h4 id=\"event-drop-files-macos\"><a href=\"#event-drop-files-macos\">Event: 'drop-files' <em>macOS</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>files</code> String[] - The paths of the dropped files.</li>\n</ul>\n<p>Emitted when dragged files are dropped in the tray icon.</p>\n<h4 id=\"event-drop-text-macos\"><a href=\"#event-drop-text-macos\">Event: 'drop-text' <em>macOS</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>text</code> String - the dropped text string.</li>\n</ul>\n<p>Emitted when dragged text is dropped in the tray icon.</p>\n<h4 id=\"event-drag-enter-macos\"><a href=\"#event-drag-enter-macos\">Event: 'drag-enter' <em>macOS</em></a></h4>\n<p>Emitted when a drag operation enters the tray icon.</p>\n<h4 id=\"event-drag-leave-macos\"><a href=\"#event-drag-leave-macos\">Event: 'drag-leave' <em>macOS</em></a></h4>\n<p>Emitted when a drag operation exits the tray icon.</p>\n<h4 id=\"event-drag-end-macos\"><a href=\"#event-drag-end-macos\">Event: 'drag-end' <em>macOS</em></a></h4>\n<p>Emitted when a drag operation ends on the tray or ends at another location.</p>\n<h4 id=\"event-mouse-up-macos\"><a href=\"#event-mouse-up-macos\">Event: 'mouse-up' <em>macOS</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - The position of the event.</li>\n</ul>\n<p>Emitted when the mouse is released from clicking the tray icon.</p>\n<p>Note: This will not be emitted if you have set a context menu for your Tray using <code>tray.setContextMenu</code>, as a result of macOS-level constraints.</p>\n<h4 id=\"event-mouse-down-macos\"><a href=\"#event-mouse-down-macos\">Event: 'mouse-down' <em>macOS</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - The position of the event.</li>\n</ul>\n<p>Emitted when the mouse clicks the tray icon.</p>\n<h4 id=\"event-mouse-enter-macos\"><a href=\"#event-mouse-enter-macos\">Event: 'mouse-enter' <em>macOS</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - The position of the event.</li>\n</ul>\n<p>Emitted when the mouse enters the tray icon.</p>\n<h4 id=\"event-mouse-leave-macos\"><a href=\"#event-mouse-leave-macos\">Event: 'mouse-leave' <em>macOS</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - The position of the event.</li>\n</ul>\n<p>Emitted when the mouse exits the tray icon.</p>\n<h4 id=\"event-mouse-move-macos-windows\"><a href=\"#event-mouse-move-macos-windows\">Event: 'mouse-move' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> - The position of the event.</li>\n</ul>\n<p>Emitted when the mouse moves in the tray icon.</p>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<p>The <code>Tray</code> class has the following methods:</p>\n<h4 id=\"traydestroy\"><a href=\"#traydestroy\"><code>tray.destroy()</code></a></h4>\n<p>Destroys the tray icon immediately.</p>\n<h4 id=\"traysetimageimage\"><a href=\"#traysetimageimage\"><code>tray.setImage(image)</code></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>Sets the <code>image</code> associated with this tray icon.</p>\n<h4 id=\"traysetpressedimageimage-macos\"><a href=\"#traysetpressedimageimage-macos\"><code>tray.setPressedImage(image)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>Sets the <code>image</code> associated with this tray icon when pressed on macOS.</p>\n<h4 id=\"traysettooltiptooltip\"><a href=\"#traysettooltiptooltip\"><code>tray.setToolTip(toolTip)</code></a></h4>\n<ul>\n<li><code>toolTip</code> String</li>\n</ul>\n<p>Sets the hover text for this tray icon.</p>\n<h4 id=\"traysettitletitle-options-macos\"><a href=\"#traysettitletitle-options-macos\"><code>tray.setTitle(title[, options])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>title</code> String</li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>fontType</code> String (optional) - The font family variant to display, can be <code>monospaced</code> or <code>monospacedDigit</code>. <code>monospaced</code> is available in macOS 10.15+ and <code>monospacedDigit</code> is available in macOS 10.11+.  When left blank, the title uses the default system font.</li>\n</ul></li>\n</ul>\n<p>Sets the title displayed next to the tray icon in the status bar (Support ANSI colors).</p>\n<h4 id=\"traygettitle-macos\"><a href=\"#traygettitle-macos\"><code>tray.getTitle()</code> <em>macOS</em></a></h4>\n<p>Returns <code>String</code> - the title displayed next to the tray icon in the status bar</p>\n<h4 id=\"traysetignoredoubleclickeventsignore-macos\"><a href=\"#traysetignoredoubleclickeventsignore-macos\"><code>tray.setIgnoreDoubleClickEvents(ignore)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n</ul>\n<p>Sets the option to ignore double click events. Ignoring these events allows you to detect every individual click of the tray icon.</p>\n<p>This value is set to false by default.</p>\n<h4 id=\"traygetignoredoubleclickevents-macos\"><a href=\"#traygetignoredoubleclickevents-macos\"><code>tray.getIgnoreDoubleClickEvents()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether double click events will be ignored.</p>\n<h4 id=\"traydisplayballoonoptions-windows\"><a href=\"#traydisplayballoonoptions-windows\"><code>tray.displayBalloon(options)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (optional) - Icon to use when <code>iconType</code> is <code>custom</code>.</li>\n<li><code>iconType</code> String (optional) - Can be <code>none</code>, <code>info</code>, <code>warning</code>, <code>error</code> or <code>custom</code>. Padrão é <code>custom</code>.</li>\n<li><code>title</code> String</li>\n<li><code>content</code> String</li>\n<li><code>largeIcon</code> Boolean (optional) - The large version of the icon should be used. Por padrão é <code>true</code>. Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_large_icon-0x00000020\"><code>NIIF_LARGE_ICON</code></a>.</li>\n<li><code>noSound</code> Boolean (optional) - Do not play the associated sound. Por padrão é <code>false</code>. Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_nosound-0x00000010\"><code>NIIF_NOSOUND</code></a>.</li>\n<li><code>respectQuietTime</code> Boolean (optional) - Do not display the balloon notification if the current user is in \"quiet time\". Por padrão é <code>false</code>. Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_respect_quiet_time-0x00000080\"><code>NIIF_RESPECT_QUIET_TIME</code></a>.</li>\n</ul></li>\n</ul>\n<p>Displays a tray balloon.</p>\n<h4 id=\"trayremoveballoon-windows\"><a href=\"#trayremoveballoon-windows\"><code>tray.removeBalloon()</code> <em>Windows</em></a></h4>\n<p>Removes a tray balloon.</p>\n<h4 id=\"trayfocus-windows\"><a href=\"#trayfocus-windows\"><code>tray.focus()</code> <em>Windows</em></a></h4>\n<p>Returns focus to the taskbar notification area. Notification area icons should use this message when they have completed their UI operation. For example, if the icon displays a shortcut menu, but the user presses ESC to cancel it, use <code>tray.focus()</code> to return focus to the notification area.</p>\n<h4 id=\"traypopupcontextmenumenu-position-macos-windows\"><a href=\"#traypopupcontextmenumenu-position-macos-windows\"><code>tray.popUpContextMenu([menu, position])</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>menu</code> Menu (optional)</li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a> (optional) - The pop up position.</li>\n</ul>\n<p>Pops up the context menu of the tray icon. When <code>menu</code> is passed, the <code>menu</code> will be shown instead of the tray icon's context menu.</p>\n<p><code>position</code> está apenas disponível no Windows, sendo (0, 0) por padrão.</p>\n<h4 id=\"trayclosecontextmenu-macos-windows\"><a href=\"#trayclosecontextmenu-macos-windows\"><code>tray.closeContextMenu()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Closes an open context menu, as set by <code>tray.setContextMenu()</code>.</p>\n<h4 id=\"traysetcontextmenumenu\"><a href=\"#traysetcontextmenumenu\"><code>tray.setContextMenu(menu)</code></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Sets the context menu for this icon.</p>\n<h4 id=\"traygetbounds-macos-windows\"><a href=\"#traygetbounds-macos-windows\"><code>tray.getBounds()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Retorna <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a></p>\n<p>The <code>bounds</code> of this tray icon as <code>Object</code>.</p>\n<h4 id=\"trayisdestroyed\"><a href=\"#trayisdestroyed\"><code>tray.isDestroyed()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the tray icon is destroyed.</p>",
      "title": "Tray",
      "description": "Add icons and context menus to the system's notification area."
    },
    "/docs/tutorial/tray": {
      "locale": "pt-BR",
      "slug": "tray",
      "href": "/docs/tutorial/tray",
      "crowdinFileId": "256259",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/tray.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<hr>\n<p>title: Tray\ndescription: This guide will take you through the process of creating a Tray icon with its own context menu to the system's notification area.\nslug: tray</p>\n<h2 id=\"hide_title-true\"><a href=\"#hide_title-true\">hide_title: true</a></h2>\n<h1 id=\"tray\"><a href=\"#tray\">Tray</a></h1>\n<h2 id=\"visão-geral\"><a href=\"#visão-geral\">Visão Geral</a></h2>\n<!-- ✍ Update this section if you want to provide more details -->\n<p>This guide will take you through the process of creating a <a href=\"https://www.electronjs.org/docs/api/tray\">Tray</a> icon with its own context menu to the system's notification area.</p>\n<p>On MacOS and Ubuntu, the Tray will be located on the top right corner of your screen, adjacent to your battery and wifi icons. On Windows, the Tray will usually be located in the bottom right corner.</p>\n<h2 id=\"exemplo\"><a href=\"#exemplo\">Exemplo</a></h2>\n<h3 id=\"mainjs\"><a href=\"#mainjs\">main.js</a></h3>\n<p>First we must import <code>app</code>, <code>Tray</code>, <code>Menu</code>, <code>nativeImage</code> from <code>electron</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, Tray, Menu, nativeImage } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>Next we will create our Tray. To do this, we will use a <a href=\"https://www.electronjs.org/docs/api/native-image\"><code>NativeImage</code></a> icon, which can be created through any one of these <a href=\"https://www.electronjs.org/docs/api/native-image#methods\">methods</a>. Note that we wrap our Tray creation code within an <a href=\"https://www.electronjs.org/docs/api/app#appwhenready\"><code>app.whenReady</code></a> as we will need to wait for our electron app to finish initializing.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">let</span> tray\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> icon = nativeImage.createFromPath(<span class=\"hljs-string\">'path/to/asset.png'</span>)\n  tray = <span class=\"hljs-keyword\">new</span> Tray(icon)\n\n  <span class=\"hljs-comment\">// note: your contextMenu, Tooltip and Title code will go here!</span>\n})\n</code></pre>\n<p>Ótimo! Now we can start attaching a context menu to our Tray, like so:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item3'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item4'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n])\n\ntray.setContextMenu(contextMenu)\n</code></pre>\n<p>The code above will create 4 separate radio-type items in the context menu. To read more about constructing native menus, click <a href=\"https://www.electronjs.org/docs/api/menu#menubuildfromtemplatetemplate\">here</a>.</p>\n<p>Finally, let's give our tray a tooltip and a title.</p>\n<pre><code class=\"hljs language-js\">tray.setToolTip(<span class=\"hljs-string\">'This is my application'</span>)\ntray.setTitle(<span class=\"hljs-string\">'This is my title'</span>)\n</code></pre>\n<h2 id=\"conclusão\"><a href=\"#conclusão\">Conclusão</a></h2>\n<p>After you start your electron app, you should see the Tray residing in either the top or bottom right of your screen, depending on your operating system.\n<code>fiddle docs/fiddles/native-ui/tray</code></p>",
      "title": "Tray",
      "description": ""
    },
    "/docs/tutorial/updates": {
      "locale": "pt-BR",
      "slug": "updates",
      "href": "/docs/tutorial/updates",
      "crowdinFileId": "256261",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/updates.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"atualizando-aplicativos\"><a href=\"#atualizando-aplicativos\">Atualizando Aplicativos</a></h1>\n<p>Existem várias maneiras de atualizar uma aplicação em Electron. A maneira mais fácil, suportada oficialmente é utilizando o framework embutido <a href=\"https://github.com/Squirrel\">Squirrel</a> e o módulo de <a href=\"/docs/api/auto-updater\">autoUpdater</a> do Electron.</p>\n<h2 id=\"usando-updateelectronjsorg\"><a href=\"#usando-updateelectronjsorg\">Usando <code>update.electronjs.org</code></a></h2>\n<p>The Electron team maintains <a href=\"https://github.com/electron/update.electronjs.org\">update.electronjs.org</a>, a free and open-source webservice that Electron apps can use to self-update. The service is designed for Electron apps that meet the following criteria:</p>\n<ul>\n<li>O app roda no macOS ou no Windows</li>\n<li>O app tem um repositório GitHub público</li>\n<li>As Builds são publicadas no GitHub Releases</li>\n<li>Builds são code-signed</li>\n</ul>\n<p>A forma mais fácil de usar este serviço é instalando o <a href=\"https://github.com/electron/update-electron-app\">update-electron-app</a>, um módulo Node.js pre-configurado para ser usado com update.electronjs.org.</p>\n<p>Instalando o módulo:</p>\n<pre><code class=\"hljs language-sh\">npm install update-electron-app\n</code></pre>\n<p>Invoke the updater from your app's main process file:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'update-electron-app'</span>)()\n</code></pre>\n<p>By default, this module will check for updates at app startup, then every ten minutes. When an update is found, it will automatically be downloaded in the background. When the download completes, a dialog is displayed allowing the user to restart the app.</p>\n<p>If you need to customize your configuration, you can <a href=\"https://github.com/electron/update-electron-app\">pass options to <code>update-electron-app</code></a> or <a href=\"https://github.com/electron/update.electronjs.org\">use the update service directly</a>.</p>\n<h2 id=\"implementando-um-servidor-de-atualizações\"><a href=\"#implementando-um-servidor-de-atualizações\">Implementando um Servidor de Atualizações</a></h2>\n<p>If you're developing a private Electron application, or if you're not publishing releases to GitHub Releases, it may be necessary to run your own update server.</p>\n<p>Dependendo de suas necessidades, você pode escolher um destes:</p>\n<ul>\n<li><a href=\"https://github.com/vercel/hazel\">Hazel</a> – Update server for private or open-source apps which can be deployed for free on <a href=\"https://vercel.com\">Vercel</a>. Ele puxa do <a href=\"https://help.github.com/articles/creating-releases/\">GitHub Releases</a> e utiliza o poder dos GitHub CDN.</li>\n<li><a href=\"https://github.com/GitbookIO/nuts\">Nuts</a> - Também usar <a href=\"https://help.github.com/articles/creating-releases/\">GitHub Releases</a>, mas armazena em cache as atualizações do app no disco e suporta repositórios.</li>\n<li><a href=\"https://github.com/ArekSredzki/electron-release-server\">electron-resease-server</a> - Fornece um painel para a manipulação de versões e não requer lançamentos que se originam do GitHub.</li>\n<li><a href=\"https://github.com/atlassian/nucleus\">Nucleus</a> - Um servidor de atualização completo para Electron apps mantido pela Atlassian. Suporta múltiplas aplicações e canais; usar um armazenamento de arquivo estático para diminuir o custo do servidor.</li>\n</ul>\n<h2 id=\"implementando-atualizações-em-seu-app\"><a href=\"#implementando-atualizações-em-seu-app\">Implementando Atualizações em Seu App</a></h2>\n<p>Uma vez que implantou em seu servidor de atualização, continue com a importação dos módulos em seu código. The following code might vary for different server software, but it works like described when using <a href=\"https://github.com/vercel/hazel\">Hazel</a>.</p>\n<p><strong>Important:</strong> Please ensure that the code below will only be executed in your packaged app, and not in development. You can use <a href=\"https://github.com/sindresorhus/electron-is-dev\">electron-is-dev</a> to check for the environment.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, autoUpdater, dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>Next, construct the URL of the update server and tell <a href=\"/docs/api/auto-updater\">autoUpdater</a> about it:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> server = <span class=\"hljs-string\">'https://your-deployment-url.com'</span>\n<span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-string\">`<span class=\"hljs-subst\">${server}</span>/update/<span class=\"hljs-subst\">${process.platform}</span>/<span class=\"hljs-subst\">${app.getVersion()}</span>`</span>\n\nautoUpdater.setFeedURL({ url })\n</code></pre>\n<p>As the final step, check for updates. The example below will check every minute:</p>\n<pre><code class=\"hljs language-javascript\">setInterval(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  autoUpdater.checkForUpdates()\n}, <span class=\"hljs-number\">60000</span>)\n</code></pre>\n<p>Once your application is <a href=\"/docs/tutorial/application-distribution\">packaged</a>, it will receive an update for each new <a href=\"https://help.github.com/articles/creating-releases/\">GitHub Release</a> that you publish.</p>\n<h2 id=\"aplicando-atualizações\"><a href=\"#aplicando-atualizações\">Aplicando Atualizações</a></h2>\n<p>Now that you've configured the basic update mechanism for your application, you need to ensure that the user will get notified when there's an update. This can be achieved using the autoUpdater API <a href=\"/docs/api/auto-updater#events\">events</a>:</p>\n<pre><code class=\"hljs language-javascript\">autoUpdater.on(<span class=\"hljs-string\">'update-downloaded'</span>, (event, releaseNotes, releaseName) => {\n  <span class=\"hljs-keyword\">const</span> dialogOpts = {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'info'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Restart'</span>, <span class=\"hljs-string\">'Later'</span>],\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Application Update'</span>,\n    <span class=\"hljs-attr\">message</span>: process.platform === <span class=\"hljs-string\">'win32'</span> ? releaseNotes : releaseName,\n    <span class=\"hljs-attr\">detail</span>: <span class=\"hljs-string\">'A new version has been downloaded. Restart the application to apply the updates.'</span>\n  }\n\n  dialog.showMessageBox(dialogOpts).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">returnValue</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (returnValue.response === <span class=\"hljs-number\">0</span>) autoUpdater.quitAndInstall()\n  })\n})\n</code></pre>\n<p>Also make sure that errors are <a href=\"/docs/api/auto-updater#event-error\">being handled</a>. Here's an example for logging them to <code>stderr</code>:</p>\n<pre><code class=\"hljs language-javascript\">autoUpdater.on(<span class=\"hljs-string\">'error'</span>, message => {\n  <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Erro ao atualizar o aplicativo'</span>)\n  <span class=\"hljs-built_in\">console</span>.error(message)\n})\n</code></pre>\n<h2 id=\"handling-updates-manually\"><a href=\"#handling-updates-manually\">Handling Updates Manually</a></h2>\n<p>Because the requests made by Auto Update aren't under your direct control, you may find situations that are difficult to handle (such as if the update server is behind authentication). The <code>url</code> field does support files, which means that with some effort, you can sidestep the server-communication aspect of the process. <a href=\"https://github.com/electron/electron/issues/5020#issuecomment-477636990\">Here's an example of how this could work</a>.</p>",
      "title": "Atualizando Aplicativos",
      "description": ""
    },
    "/docs/api/structures/upload-data": {
      "locale": "pt-BR",
      "slug": "upload-data",
      "href": "/docs/api/structures/upload-data",
      "crowdinFileId": "256523",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploaddata-object\"><a href=\"#uploaddata-object\">UploadData Object</a></h1>\n<ul>\n<li><code>bytes</code> Buffer - Content being sent.</li>\n<li><code>file</code> String (optional) - Path of file being uploaded.</li>\n<li><code>blobUUID</code> String (optional) - UUID of blob data. Use <a href=\"/docs/api/session#sesgetblobdataidentifier\">ses.getBlobData</a> method to retrieve the data.</li>\n</ul>",
      "title": "UploadData Object",
      "description": ""
    },
    "/docs/api/structures/upload-file": {
      "locale": "pt-BR",
      "slug": "upload-file",
      "href": "/docs/api/structures/upload-file",
      "crowdinFileId": "256525",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-file.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploadfile-object\"><a href=\"#uploadfile-object\">UploadFile Object</a></h1>\n<ul>\n<li><code>type</code> 'file' - <code>file</code>.</li>\n<li><code>filePath</code> String - Path of file to be uploaded.</li>\n<li><code>offset</code> Integer - Defaults to <code>0</code>.</li>\n<li><code>length</code> Integer - Number of bytes to read from <code>offset</code>. Defaults to <code>0</code>.</li>\n<li><code>modificationTime</code> Double - Last Modification time in number of seconds since the UNIX epoch.</li>\n</ul>",
      "title": "UploadFile Object",
      "description": ""
    },
    "/docs/api/structures/upload-raw-data": {
      "locale": "pt-BR",
      "slug": "upload-raw-data",
      "href": "/docs/api/structures/upload-raw-data",
      "crowdinFileId": "256527",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-raw-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploadrawdata-object\"><a href=\"#uploadrawdata-object\">UploadRawData Object</a></h1>\n<ul>\n<li><code>type</code> 'rawData' - <code>rawData</code>.</li>\n<li><code>bytes</code> Buffer - Data to be uploaded.</li>\n</ul>",
      "title": "UploadRawData Object",
      "description": ""
    },
    "/docs/api/structures/user-default-types": {
      "locale": "pt-BR",
      "slug": "user-default-types",
      "href": "/docs/api/structures/user-default-types",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/user-default-types.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"userdefaulttypes-object\"><a href=\"#userdefaulttypes-object\">UserDefaultTypes Object</a></h1>\n<ul>\n<li><code>string</code> String</li>\n<li><code>boolean</code> Boolean</li>\n<li><code>integer</code> Number</li>\n<li><code>float</code> Number</li>\n<li><code>double</code> Number</li>\n<li>String <code>url</code></li>\n<li><code>array</code> Array\\<unknown></unknown></li>\n<li><code>dictionary</code> Record\\&#x3C;string, unknown></li>\n</ul>\n<p>This type is a helper alias, no object will never exist of this type.</p>",
      "title": "UserDefaultTypes Object",
      "description": ""
    },
    "/docs/tutorial/using-native-node-modules": {
      "locale": "pt-BR",
      "slug": "using-native-node-modules",
      "href": "/docs/tutorial/using-native-node-modules",
      "crowdinFileId": "256263",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-native-node-modules.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"native-node-modules\"><a href=\"#native-node-modules\">Native Node Modules</a></h1>\n<p>Módulos Node,js nativos são suportados pelo Electron, mas, como Electron tem uma <a href=\"https://en.wikipedia.org/wiki/Application_binary_interface\">interface binária de aplicação (ABI)</a> diferente da interface do Node.js (devido a diferenças como o uso do BoringSSL do Chromium ao invés do OpenSSL), os módulos nativos que você usar precisam ser recompilados para Electron. Otherwise, you will get the following class of error when you try to run your app:</p>\n<pre><code class=\"hljs language-sh\">Error: The module <span class=\"hljs-string\">'/path/to/native/module.node'</span>\nwas compiled against a different Node.js version using\nNODE_MODULE_VERSION <span class=\"hljs-variable\">$XYZ</span>. This version of Node.js requires\nNODE_MODULE_VERSION <span class=\"hljs-variable\">$ABC</span>. Please try re-compiling or re-installing\nthe module (<span class=\"hljs-keyword\">for</span> instance, using `npm rebuild` or `npm install`).\n</code></pre>\n<h2 id=\"como-instalar-módulos-nativos\"><a href=\"#como-instalar-módulos-nativos\">Como instalar módulos nativos</a></h2>\n<p>There are several different ways to install native modules:</p>\n<h3 id=\"instalando-módulos-e-recopilando-para-electron\"><a href=\"#instalando-módulos-e-recopilando-para-electron\">Instalando módulos e recopilando para Electron</a></h3>\n<p>You can install modules like other Node projects, and then rebuild the modules for Electron with the <a href=\"https://github.com/electron/electron-rebuild\"><code>electron-rebuild</code></a> package. This module can automatically determine the version of Electron and handle the manual steps of downloading headers and rebuilding native modules for your app. If you are using <a href=\"https://electronforge.io/\">Electron Forge</a>, this tool is used automatically in both development mode and when making distributables.</p>\n<p>Por exemplo, para instalar a ferramenta standalone <code>electron-rebuild</code> e então reconstruir módulos com ela via linha de comando:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron-rebuild\n\n<span class=\"hljs-comment\"># Every time you run \"npm install\", run this:</span>\n./node_modules/.bin/electron-rebuild\n\n<span class=\"hljs-comment\"># If you have trouble on Windows, try:</span>\n.\\node_modules\\.bin\\electron-rebuild.cmd\n</code></pre>\n<p>Para mais informações sobre uso e integração com outras ferramentas como <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a>, consulte o README do projeto.</p>\n<h3 id=\"usando-npm\"><a href=\"#usando-npm\">Usando <code>npm</code></a></h3>\n<p>Definindo algumas variáveis de ambiente, você pode usar <code>npm</code> para instalar módulos diretamente.</p>\n<p>For example, to install all dependencies for Electron:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-comment\"># Versão do Electron.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_target=1.2.3\n<span class=\"hljs-comment\"># The architecture of Electron, see https://electronjs.org/docs/tutorial/support#supported-platforms</span>\n<span class=\"hljs-comment\"># for supported architectures.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_arch=x64\n<span class=\"hljs-built_in\">export</span> npm_config_target_arch=x64\n<span class=\"hljs-comment\"># Download de headers para Electron.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_disturl=https://electronjs.org/headers \n<span class=\"hljs-comment\"># Diga ao node-pre-gyp que estamos copilando para o Electron.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_runtime=electron \n<span class=\"hljs-comment\"># Diga ao node-pre-gyp para copilar os módulos do código fonte.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_build_from_source=<span class=\"hljs-literal\">true</span>\n<span class=\"hljs-comment\"># Instale todas as dependências e armazene cache para ~/.electron-gyp.</span>\nHOME=~/.electron-gyp npm install\n</code></pre>\n<h3 id=\"manually-building-for-electron\"><a href=\"#manually-building-for-electron\">Manually building for Electron</a></h3>\n<p>If you are a developer developing a native module and want to test it against Electron, you might want to rebuild the module for Electron manually. You can use <code>node-gyp</code> directly to build for Electron:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">cd</span> /path-to-module/\nHOME=~/.electron-gyp node-gyp rebuild --target=1.2.3 --arch=x64 --dist-url=https://electronjs.org/headers\n</code></pre>\n<ul>\n<li><code>HOME=~/.electron-gyp</code> changes where to find development headers.</li>\n<li><code>--target=1.2.3</code> is the version of Electron.</li>\n<li><code>--dist-url=...</code> specifies where to download the headers.</li>\n<li><code>--arch=x64</code> says the module is built for a 64-bit system.</li>\n</ul>\n<h3 id=\"manually-building-for-a-custom-build-of-electron\"><a href=\"#manually-building-for-a-custom-build-of-electron\">Manually building for a custom build of Electron</a></h3>\n<p>To compile native Node modules against a custom build of Electron that doesn't match a public release, instruct <code>npm</code> to use the version of Node you have bundled with your custom build.</p>\n<pre><code class=\"hljs language-sh\">npm rebuild --nodedir=/path/to/src/out/Default/gen/node_headers\n</code></pre>\n<h2 id=\"solução-de-problemas\"><a href=\"#solução-de-problemas\">Solução de Problemas</a></h2>\n<p>If you installed a native module and found it was not working, you need to check the following things:</p>\n<ul>\n<li>When in doubt, run <code>electron-rebuild</code> first.</li>\n<li>Make sure the native module is compatible with the target platform and architecture for your Electron app.</li>\n<li>Make sure <code>win_delay_load_hook</code> is not set to <code>false</code> in the module's <code>binding.gyp</code>.</li>\n<li>After you upgrade Electron, you usually need to rebuild the modules.</li>\n</ul>\n<h3 id=\"a-note-about-win_delay_load_hook\"><a href=\"#a-note-about-win_delay_load_hook\">A note about <code>win_delay_load_hook</code></a></h3>\n<p>On Windows, by default, <code>node-gyp</code> links native modules against <code>node.dll</code>. However, in Electron 4.x and higher, the symbols needed by native modules are exported by <code>electron.exe</code>, and there is no <code>node.dll</code>. In order to load native modules on Windows, <code>node-gyp</code> installs a <a href=\"https://msdn.microsoft.com/en-us/library/z9h1h6ty.aspx\">delay-load hook</a> that triggers when the native module is loaded, and redirects the <code>node.dll</code> reference to use the loading executable instead of looking for <code>node.dll</code> in the library search path (which would turn up nothing). As such, on Electron 4.x and higher, <code>'win_delay_load_hook': 'true'</code> is required to load native modules.</p>\n<p>If you get an error like <code>Module did not self-register</code>, or <code>The specified procedure could not be found</code>, it may mean that the module you're trying to use did not correctly include the delay-load hook.  If the module is built with node-gyp, ensure that the <code>win_delay_load_hook</code> variable is set to <code>true</code> in the <code>binding.gyp</code> file, and isn't getting overridden anywhere.  If the module is built with another system, you'll need to ensure that you build with a delay-load hook installed in the main <code>.node</code> file. Your <code>link.exe</code> invocation should look like this:</p>\n<pre><code class=\"hljs language-plaintext\"> link.exe /OUT:\"foo.node\" \"...\\node.lib\" delayimp.lib /DELAYLOAD:node.exe /DLL\n     \"my_addon.obj\" \"win_delay_load_hook.obj\"\n</code></pre>\n<p>In particular, it's important that:</p>\n<ul>\n<li>you link against <code>node.lib</code> from <em>Electron</em> and not Node. If you link against the wrong <code>node.lib</code> you will get load-time errors when you require the module in Electron.</li>\n<li>you include the flag <code>/DELAYLOAD:node.exe</code>. If the <code>node.exe</code> link is not delayed, then the delay-load hook won't get a chance to fire and the node symbols won't be correctly resolved.</li>\n<li><code>win_delay_load_hook.obj</code> is linked directly into the final DLL. If the hook is set up in a dependent DLL, it won't fire at the right time.</li>\n</ul>\n<p>See <a href=\"https://github.com/nodejs/node-gyp/blob/e2401e1395bef1d3c8acec268b42dc5fb71c4a38/src/win_delay_load_hook.cc\"><code>node-gyp</code></a> for an example delay-load hook if you're implementing your own.</p>\n<h2 id=\"modules-that-rely-on-prebuild\"><a href=\"#modules-that-rely-on-prebuild\">Modules that rely on <code>prebuild</code></a></h2>\n<p><a href=\"https://github.com/prebuild/prebuild\"><code>prebuild</code></a> provides a way to publish native Node modules with prebuilt binaries for multiple versions of Node and Electron.</p>\n<p>If the <code>prebuild</code>-powered module provide binaries for the usage in Electron, make sure to omit <code>--build-from-source</code> and the <code>npm_config_build_from_source</code> environment variable in order to take full advantage of the prebuilt binaries.</p>\n<h2 id=\"modules-that-rely-on-node-pre-gyp\"><a href=\"#modules-that-rely-on-node-pre-gyp\">Modules that rely on <code>node-pre-gyp</code></a></h2>\n<p>The <a href=\"https://github.com/mapbox/node-pre-gyp\"><code>node-pre-gyp</code> tool</a> provides a way to deploy native Node modules with prebuilt binaries, and many popular modules are using it.</p>\n<p>Sometimes those modules work fine under Electron, but when there are no Electron-specific binaries available, you'll need to build from source. Because of this, it is recommended to use <code>electron-rebuild</code> for these modules.</p>\n<p>If you are following the <code>npm</code> way of installing modules, you'll need to pass <code>--build-from-source</code> to <code>npm</code>, or set the <code>npm_config_build_from_source</code> environment variable.</p>",
      "title": "Native Node Modules",
      "description": ""
    },
    "/docs/tutorial/using-pepper-flash-plugin": {
      "locale": "pt-BR",
      "slug": "using-pepper-flash-plugin",
      "href": "/docs/tutorial/using-pepper-flash-plugin",
      "crowdinFileId": "256265",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-pepper-flash-plugin.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"pepper-flash-plugin\"><a href=\"#pepper-flash-plugin\">Pepper Flash Plugin</a></h1>\n<p>Electron no longer supports the Pepper Flash plugin, as Chrome has removed support.</p>\n<p>See <a href=\"https://www.chromium.org/flash-roadmap\">Chromium's Flash Roadmap</a> for more details.</p>",
      "title": "Pepper Flash Plugin",
      "description": ""
    },
    "/docs/tutorial/using-selenium-and-webdriver": {
      "locale": "pt-BR",
      "slug": "using-selenium-and-webdriver",
      "href": "/docs/tutorial/using-selenium-and-webdriver",
      "crowdinFileId": "256267",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-selenium-and-webdriver.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"selenium-and-webdriver\"><a href=\"#selenium-and-webdriver\">Selenium and WebDriver</a></h1>\n<p>From <a href=\"https://sites.google.com/a/chromium.org/chromedriver/\">ChromeDriver - WebDriver for Chrome</a>:</p>\n<blockquote>\n<p>WebDriver is an open source tool for automated testing of web apps across many browsers. It provides capabilities for navigating to web pages, user input, JavaScript execution, and more. ChromeDriver is a standalone server which implements WebDriver's wire protocol for Chromium. It is being developed by members of the Chromium and WebDriver teams.</p>\n</blockquote>\n<h2 id=\"setting-up-spectron\"><a href=\"#setting-up-spectron\">Setting up Spectron</a></h2>\n<p><a href=\"https://electronjs.org/spectron\">Spectron</a> is the officially supported ChromeDriver testing framework for Electron. It is built on top of <a href=\"https://webdriver.io/\">WebdriverIO</a> and has helpers to access Electron APIs in your tests and bundles ChromeDriver.</p>\n<pre><code class=\"hljs language-sh\">$ npm install --save-dev spectron\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// A simple test to verify a visible window is opened with a title</span>\n<span class=\"hljs-keyword\">const</span> Application = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spectron'</span>).Application\n<span class=\"hljs-keyword\">const</span> assert = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'assert'</span>)\n\n<span class=\"hljs-keyword\">const</span> myApp = <span class=\"hljs-keyword\">new</span> Application({\n  <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'/Applications/MyApp.app/Contents/MacOS/MyApp'</span>\n})\n\n<span class=\"hljs-keyword\">const</span> verifyWindowIsVisibleWithTitle = <span class=\"hljs-keyword\">async</span> (app) => {\n  <span class=\"hljs-keyword\">await</span> app.start()\n  <span class=\"hljs-keyword\">try</span> {\n    <span class=\"hljs-comment\">// Check if the window is visible</span>\n    <span class=\"hljs-keyword\">const</span> isVisible = <span class=\"hljs-keyword\">await</span> app.browserWindow.isVisible()\n    <span class=\"hljs-comment\">// Verify the window is visible</span>\n    assert.strictEqual(isVisible, <span class=\"hljs-literal\">true</span>)\n    <span class=\"hljs-comment\">// Get the window's title</span>\n    <span class=\"hljs-keyword\">const</span> title = <span class=\"hljs-keyword\">await</span> app.client.getTitle()\n    <span class=\"hljs-comment\">// Verify the window's title</span>\n    assert.strictEqual(title, <span class=\"hljs-string\">'My App'</span>)\n  } <span class=\"hljs-keyword\">catch</span> (error) {\n    <span class=\"hljs-comment\">// Log any failures</span>\n    <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Test failed'</span>, error.message)\n  }\n  <span class=\"hljs-comment\">// Stop the application</span>\n  <span class=\"hljs-keyword\">await</span> app.stop()\n}\n\nverifyWindowIsVisibleWithTitle(myApp)\n</code></pre>\n<h2 id=\"setting-up-with-webdriverjs\"><a href=\"#setting-up-with-webdriverjs\">Setting up with WebDriverJs</a></h2>\n<p><a href=\"https://www.selenium.dev/selenium/docs/api/javascript/index.html\">WebDriverJs</a> provides a Node package for testing with web driver, we will use it as an example.</p>\n<h3 id=\"1-start-chromedriver\"><a href=\"#1-start-chromedriver\">1. Start ChromeDriver</a></h3>\n<p>First you need to download the <code>chromedriver</code> binary, and run it:</p>\n<pre><code class=\"hljs language-sh\">$ npm install electron-chromedriver\n$ ./node_modules/.bin/chromedriver\nComeçando ChromeDriver (v2.10.291558) na porta 9515\nSomente conexão <span class=\"hljs-built_in\">local</span> é permitido.\n</code></pre>\n<p>Remember the port number <code>9515</code>, which will be used later</p>\n<h3 id=\"2-install-webdriverjs\"><a href=\"#2-install-webdriverjs\">2. Install WebDriverJS</a></h3>\n<pre><code class=\"hljs language-sh\">$ npm install selenium-webdriver\n</code></pre>\n<h3 id=\"3-connect-to-chromedriver\"><a href=\"#3-connect-to-chromedriver\">3. Connect to ChromeDriver</a></h3>\n<p>The usage of <code>selenium-webdriver</code> with Electron is the same with upstream, except that you have to manually specify how to connect chrome driver and where to find Electron's binary:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webdriver = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'selenium-webdriver'</span>)\n\n<span class=\"hljs-keyword\">const</span> driver = <span class=\"hljs-keyword\">new</span> webdriver.Builder()\n  <span class=\"hljs-comment\">// The \"9515\" is the port opened by chrome driver.</span>\n  .usingServer(<span class=\"hljs-string\">'http://localhost:9515'</span>)\n  .withCapabilities({\n    <span class=\"hljs-string\">'goog:chromeOptions'</span>: {\n      <span class=\"hljs-comment\">// Here is the path to your Electron binary.</span>\n      <span class=\"hljs-attr\">binary</span>: <span class=\"hljs-string\">'/Path-to-Your-App.app/Contents/MacOS/Electron'</span>\n    }\n  })\n  .forBrowser(<span class=\"hljs-string\">'chrome'</span>) <span class=\"hljs-comment\">// note: use .forBrowser('electron') for selenium-webdriver &#x3C;= 3.6.0</span>\n  .build()\n\ndriver.get(<span class=\"hljs-string\">'http://www.google.com'</span>)\ndriver.findElement(webdriver.By.name(<span class=\"hljs-string\">'q'</span>)).sendKeys(<span class=\"hljs-string\">'webdriver'</span>)\ndriver.findElement(webdriver.By.name(<span class=\"hljs-string\">'btnG'</span>)).click()\ndriver.wait(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">return</span> driver.getTitle().then(<span class=\"hljs-function\">(<span class=\"hljs-params\">title</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> title === <span class=\"hljs-string\">'webdriver - Google Search'</span>\n  })\n}, <span class=\"hljs-number\">1000</span>)\n\ndriver.quit()\n</code></pre>\n<h2 id=\"setting-up-with-webdriverio\"><a href=\"#setting-up-with-webdriverio\">Setting up with WebdriverIO</a></h2>\n<p><a href=\"https://webdriver.io/\">WebdriverIO</a> provides a Node package for testing with web driver.</p>\n<h3 id=\"1-start-chromedriver-1\"><a href=\"#1-start-chromedriver-1\">1. Start ChromeDriver</a></h3>\n<p>First you need to download the <code>chromedriver</code> binary, and run it:</p>\n<pre><code class=\"hljs language-sh\">$ npm install electron-chromedriver\n$ ./node_modules/.bin/chromedriver --url-base=wd/hub --port=9515\nComeçando ChromeDriver (v2.10.291558) na porta 9515\nSomente conexão <span class=\"hljs-built_in\">local</span> é permitido.\n</code></pre>\n<p>Remember the port number <code>9515</code>, which will be used later</p>\n<h3 id=\"2-install-webdriverio\"><a href=\"#2-install-webdriverio\">2. Install WebdriverIO</a></h3>\n<pre><code class=\"hljs language-sh\">$ npm install webdriverio\n</code></pre>\n<h3 id=\"3-connect-to-chrome-driver\"><a href=\"#3-connect-to-chrome-driver\">3. Connect to chrome driver</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webdriverio = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'webdriverio'</span>)\n<span class=\"hljs-keyword\">const</span> options = {\n  <span class=\"hljs-attr\">host</span>: <span class=\"hljs-string\">'localhost'</span>, <span class=\"hljs-comment\">// Use localhost as chrome driver server</span>\n  <span class=\"hljs-attr\">port</span>: <span class=\"hljs-number\">9515</span>, <span class=\"hljs-comment\">// \"9515\" is the port opened by chrome driver.</span>\n  <span class=\"hljs-attr\">desiredCapabilities</span>: {\n    <span class=\"hljs-attr\">browserName</span>: <span class=\"hljs-string\">'chrome'</span>,\n    <span class=\"hljs-string\">'goog:chromeOptions'</span>: {\n      <span class=\"hljs-attr\">binary</span>: <span class=\"hljs-string\">'/Path-to-Your-App/electron'</span>, <span class=\"hljs-comment\">// Path to your Electron binary.</span>\n      <span class=\"hljs-attr\">args</span>: [<span class=\"hljs-comment\">/* cli arguments */</span>] <span class=\"hljs-comment\">// Optional, perhaps 'app=' + /path/to/your/app/</span>\n    }\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> client = webdriverio.remote(options)\n\nclient\n  .init()\n  .url(<span class=\"hljs-string\">'http://google.com'</span>)\n  .setValue(<span class=\"hljs-string\">'#q'</span>, <span class=\"hljs-string\">'webdriverio'</span>)\n  .click(<span class=\"hljs-string\">'#btnG'</span>)\n  .getTitle().then(<span class=\"hljs-function\">(<span class=\"hljs-params\">title</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Title was: '</span> + title)\n  })\n  .end()\n</code></pre>\n<h2 id=\"fluxo-de-trabalho\"><a href=\"#fluxo-de-trabalho\">Fluxo de trabalho</a></h2>\n<p>To test your application without rebuilding Electron, <a href=\"/docs/tutorial/application-distribution\">place</a> your app source into Electron's resource directory.</p>\n<p>Alternatively, pass an argument to run with your Electron binary that points to your app's folder. This eliminates the need to copy-paste your app into Electron's resource directory.</p>",
      "title": "Selenium and WebDriver",
      "description": "WebDriver is an open source tool for automated testing of web apps across many browsers. It provides capabilities for navigating to web pages, user input, JavaScript execution, and more. ChromeDriver is a standalone server which implements WebDriver's wire protocol for Chromium. It is being developed by members of the Chromium and WebDriver teams."
    },
    "/docs/development/v8-development": {
      "locale": "pt-BR",
      "slug": "v8-development",
      "href": "/docs/development/v8-development",
      "crowdinFileId": "256171",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/v8-development.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"v8-desenvolvimento\"><a href=\"#v8-desenvolvimento\">V8 Desenvolvimento</a></h1>\n<blockquote>\n<p>Uma coleção de recursos para aprender e usar o V8</p>\n</blockquote>\n<ul>\n<li><a href=\"https://v8.dev/docs/trace\">V8 Rastreamento</a></li>\n<li><a href=\"https://v8.dev/docs/profile\">V8 Perfil</a> - Combinações úteis para a criação de perfil: <code>--prof</code>, <code>--trace-ic</code>, <code>--trace-opt</code>, <code>--trace-deopt</code>, <code>--print-bytecode</code>, <code>--print-opt-code</code></li>\n<li><a href=\"https://docs.google.com/document/d/11T2CRex9hXxoJwbYqVQ32yIPMh0uouUZLdyrtmMoL44/edit?ts=56f27d9d#heading=h.6jz9dj3bnr8t\">V8 Intérprete Design</a></li>\n<li><a href=\"https://v8.dev/docs/turbofan\">Otimizar compilador</a></li>\n<li><a href=\"https://v8.dev/docs/gdb-jit\">V8 GDB Depuração</a></li>\n</ul>\n<p>Veja também <a href=\"/docs/development/chromium-development\">Chromium Desenvolvimento</a></p>",
      "title": "V8 Desenvolvimento",
      "description": "Uma coleção de recursos para aprender e usar o V8"
    },
    "/docs/api/web-contents": {
      "locale": "pt-BR",
      "slug": "web-contents",
      "href": "/docs/api/web-contents",
      "crowdinFileId": "256399",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-contents.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webcontents\"><a href=\"#webcontents\">webContents</a></h1>\n<blockquote>\n<p>Render and control web pages.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p><code>webContents</code> é um <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>. It is responsible for rendering and controlling a web page and is a property of the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> object. An example of accessing the <code>webContents</code> object:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> contents = win.webContents\n<span class=\"hljs-built_in\">console</span>.log(contents)\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>These methods can be accessed from the <code>webContents</code> module:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(webContents)\n</code></pre>\n<h3 id=\"webcontentsgetallwebcontents\"><a href=\"#webcontentsgetallwebcontents\"><code>webContents.getAllWebContents()</code></a></h3>\n<p>Returns <code>WebContents[]</code> - An array of all <code>WebContents</code> instances. This will contain web contents for all windows, webviews, opened devtools, and devtools extension background pages.</p>\n<h3 id=\"webcontentsgetfocusedwebcontents\"><a href=\"#webcontentsgetfocusedwebcontents\"><code>webContents.getFocusedWebContents()</code></a></h3>\n<p>Returns <code>WebContents</code> - The web contents that is focused in this application, otherwise returns <code>null</code>.</p>\n<h3 id=\"webcontentsfromidid\"><a href=\"#webcontentsfromidid\"><code>webContents.fromId(id)</code></a></h3>\n<ul>\n<li><code>id</code> Inteiro</li>\n</ul>\n<p>Returns <code>WebContents</code> | undefined - A WebContents instance with the given ID, or <code>undefined</code> if there is no WebContents associated with the given ID.</p>\n<h3 id=\"webcontentsfromdevtoolstargetidtargetid\"><a href=\"#webcontentsfromdevtoolstargetidtargetid\"><code>webContents.fromDevToolsTargetId(targetId)</code></a></h3>\n<ul>\n<li><code>targetId</code> String - The Chrome DevTools Protocol <a href=\"https://chromedevtools.github.io/devtools-protocol/tot/Target/#type-TargetID\">TargetID</a> associated with the WebContents instance.</li>\n</ul>\n<p>Returns <code>WebContents</code> | undefined - A WebContents instance with the given TargetID, or <code>undefined</code> if there is no WebContents associated with the given TargetID.</p>\n<p>When communicating with the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">Chrome DevTools Protocol</a>, it can be useful to lookup a WebContents instance based on its assigned TargetID.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">lookupTargetId</span> (<span class=\"hljs-params\">browserWindow</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> wc = browserWindow.webContents\n  <span class=\"hljs-keyword\">await</span> wc.debugger.attach(<span class=\"hljs-string\">'1.3'</span>)\n  <span class=\"hljs-keyword\">const</span> { targetInfo } = <span class=\"hljs-keyword\">await</span> wc.debugger.sendCommand(<span class=\"hljs-string\">'Target.getTargetInfo'</span>)\n  <span class=\"hljs-keyword\">const</span> { targetId } = targetInfo\n  <span class=\"hljs-keyword\">const</span> targetWebContents = <span class=\"hljs-keyword\">await</span> webContents.fromDevToolsTargetId(targetId)\n}\n</code></pre>\n<h2 id=\"class-webcontents\"><a href=\"#class-webcontents\">Class: WebContents</a></h2>\n<blockquote>\n<p>Render and control the contents of a BrowserWindow instance.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"eventos-de-instância\"><a href=\"#eventos-de-instância\">Eventos de instância</a></h3>\n<h4 id=\"event-did-finish-load\"><a href=\"#event-did-finish-load\">Event: 'did-finish-load'</a></h4>\n<p>Emitted when the navigation is done, i.e. the spinner of the tab has stopped spinning, and the <code>onload</code> event was dispatched.</p>\n<h4 id=\"event-did-fail-load\"><a href=\"#event-did-fail-load\">Event: 'did-fail-load'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>This event is like <code>did-finish-load</code> but emitted when the load failed. The full list of error codes and their meaning is available <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">here</a>.</p>\n<h4 id=\"event-did-fail-provisional-load\"><a href=\"#event-did-fail-provisional-load\">Event: 'did-fail-provisional-load'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>This event is like <code>did-fail-load</code> but emitted when the load was cancelled (e.g. <code>window.stop()</code> was invoked).</p>\n<h4 id=\"event-did-frame-finish-load\"><a href=\"#event-did-frame-finish-load\">Event: 'did-frame-finish-load'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when a frame has done navigation.</p>\n<h4 id=\"event-did-start-loading\"><a href=\"#event-did-start-loading\">Event: 'did-start-loading'</a></h4>\n<p>Corresponds to the points in time when the spinner of the tab started spinning.</p>\n<h4 id=\"event-did-stop-loading\"><a href=\"#event-did-stop-loading\">Event: 'did-stop-loading'</a></h4>\n<p>Corresponds to the points in time when the spinner of the tab stopped spinning.</p>\n<h4 id=\"event-dom-ready\"><a href=\"#event-dom-ready\">Event: 'dom-ready'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the document in the top-level frame is loaded.</p>\n<h4 id=\"evento-page-title-updated\"><a href=\"#evento-page-title-updated\">Evento: 'page-title-updated'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>Fired when page title is set during navigation. <code>explicitSet</code> is false when title is synthesized from file url.</p>\n<h4 id=\"evento-page-title-updated-1\"><a href=\"#evento-page-title-updated-1\">Evento: 'page-title-updated'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>favicons</code> String[] - Array de URLs.</li>\n</ul>\n<p>Emitido quando a página recebe urls de favicon.</p>\n<h4 id=\"event-new-window-deprecated\"><a href=\"#event-new-window-deprecated\">Event: 'new-window' <em>Deprecated</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> NewWindowWebContentsEvent</li>\n<li>String <code>url</code></li>\n<li><code>frameName</code> String</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> and <code>other</code>.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - The options which will be used for creating the new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</li>\n<li><code>additionalFeatures</code> String[] - The non-standard features (features not handled by Chromium or Electron) given to <code>window.open()</code>. Deprecated, and will now always be the empty array <code>[]</code>.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer that will be passed to the new window. May or may not result in the <code>Referer</code> header being sent, depending on the referrer policy.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that will be sent to the new window, along with the appropriate headers that will be set. If no post data is to be sent, the value will be <code>null</code>. Only defined when the window is being created by a form that set <code>target=_blank</code>.</li>\n</ul>\n<p>Deprecated in favor of <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>.</p>\n<p>Emitted when the page requests to open a new window for a <code>url</code>. It could be requested by <code>window.open</code> or an external link like <code>&#x3C;a target='_blank'></code>.</p>\n<p>By default a new <code>BrowserWindow</code> will be created for the <code>url</code>.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent Electron from automatically creating a new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. If you call <code>event.preventDefault()</code> and manually create a new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> then you must set <code>event.newGuest</code> to reference the new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> instance, failing to do so may result in unexpected behavior. Como por exemplo:</p>\n<pre><code class=\"hljs language-javascript\">myBrowserWindow.webContents.on(<span class=\"hljs-string\">'new-window'</span>, (event, url, frameName, disposition, options, additionalFeatures, referrer, postBody) => {\n  event.preventDefault()\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webContents</span>: options.webContents, <span class=\"hljs-comment\">// use existing webContents if provided</span>\n    <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span>\n  })\n  win.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => win.show())\n  <span class=\"hljs-keyword\">if</span> (!options.webContents) {\n    <span class=\"hljs-keyword\">const</span> loadOptions = {\n      <span class=\"hljs-attr\">httpReferrer</span>: referrer\n    }\n    <span class=\"hljs-keyword\">if</span> (postBody != <span class=\"hljs-literal\">null</span>) {\n      <span class=\"hljs-keyword\">const</span> { data, contentType, boundary } = postBody\n      loadOptions.postData = postBody.data\n      loadOptions.extraHeaders = <span class=\"hljs-string\">`content-type: <span class=\"hljs-subst\">${contentType}</span>; boundary=<span class=\"hljs-subst\">${boundary}</span>`</span>\n    }\n\n    win.loadURL(url, loadOptions) <span class=\"hljs-comment\">// existing webContents will be navigated automatically</span>\n  }\n  event.newGuest = win\n})\n</code></pre>\n<h4 id=\"event-did-create-window\"><a href=\"#event-did-create-window\">Event: 'did-create-window'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>window</code> BrowserWindow</li>\n<li>Objeto <code>details</code><ul>\n<li><code>url</code> String - URL for the created window.</li>\n<li><code>frameName</code> String - Name given to the created window in the <code>window.open()</code> call.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - The options used to create the BrowserWindow. They are merged in increasing precedence: parsed options from the <code>features</code> string from <code>window.open()</code>, security-related webPreferences inherited from the parent, and options given by <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>. Unrecognized options are not filtered out.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer that will be passed to the new window. May or may not result in the <code>Referer</code> header being sent, depending on the referrer policy.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that will be sent to the new window, along with the appropriate headers that will be set. If no post data is to be sent, the value will be <code>null</code>. Only defined when the window is being created by a form that set <code>target=_blank</code>.</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> and <code>other</code>.</li>\n</ul></li>\n</ul>\n<p>Emitted <em>after</em> successful creation of a window via <code>window.open</code> in the renderer. Not emitted if the creation of the window is canceled from <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>.</p>\n<p>See <a href=\"/docs/api/window-open\"><code>window.open()</code></a> for more details and how to use this in conjunction with <code>webContents.setWindowOpenHandler</code>.</p>\n<h4 id=\"evento-will-navigate\"><a href=\"#evento-will-navigate\">Evento: 'will-navigate'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>String <code>url</code></li>\n</ul>\n<p>Emitted when a user or the page wants to start navigation. It can happen when the <code>window.location</code> object is changed or a user clicks a link in the page.</p>\n<p>This event will not emit when the navigation is started programmatically with APIs like <code>webContents.loadURL</code> and <code>webContents.back</code>.</p>\n<p>It is also not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent the navigation.</p>\n<h4 id=\"event-did-start-navigation\"><a href=\"#event-did-start-navigation\">Event: 'did-start-navigation'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>String <code>url</code></li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame (including main) starts navigating. <code>isInPlace</code> will be <code>true</code> for in-page navigations.</p>\n<h4 id=\"event-will-redirect\"><a href=\"#event-will-redirect\">Event: 'will-redirect'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>String <code>url</code></li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted as a server side redirect occurs during navigation.  For example a 302 redirect.</p>\n<p>This event will be emitted after <code>did-start-navigation</code> and always before the <code>did-redirect-navigation</code> event for the same navigation.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent the navigation (not just the redirect).</p>\n<h4 id=\"event-did-redirect-navigation\"><a href=\"#event-did-redirect-navigation\">Event: 'did-redirect-navigation'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>String <code>url</code></li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted after a server side redirect occurs during navigation.  For example a 302 redirect.</p>\n<p>This event cannot be prevented, if you want to prevent redirects you should checkout out the <code>will-redirect</code> event above.</p>\n<h4 id=\"event-did-navigate\"><a href=\"#event-did-navigate\">Event: 'did-navigate'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>String <code>url</code></li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - empty for non HTTP navigations</li>\n</ul>\n<p>Emitted when a main frame navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h4 id=\"event-did-frame-navigate\"><a href=\"#event-did-frame-navigate\">Event: 'did-frame-navigate'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>String <code>url</code></li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - empty for non HTTP navigations,</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h4 id=\"event-did-navigate-in-page\"><a href=\"#event-did-navigate-in-page\">Event: 'did-navigate-in-page'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>String <code>url</code></li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when an in-page navigation happened in any frame.</p>\n<p>When in-page navigation happens, the page URL changes but does not cause navigation outside of the page. Examples of this occurring are when anchor links are clicked or when the DOM <code>hashchange</code> event is triggered.</p>\n<h4 id=\"event-will-prevent-unload\"><a href=\"#event-will-prevent-unload\">Event: 'will-prevent-unload'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when a <code>beforeunload</code> event handler is attempting to cancel a page unload.</p>\n<p>Calling <code>event.preventDefault()</code> will ignore the <code>beforeunload</code> event handler and allow the page to be unloaded.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.webContents.on(<span class=\"hljs-string\">'will-prevent-unload'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> choice = dialog.showMessageBoxSync(win, {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'question'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Leave'</span>, <span class=\"hljs-string\">'Stay'</span>],\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Do you want to leave this site?'</span>,\n    <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'Changes you made may not be saved.'</span>,\n    <span class=\"hljs-attr\">defaultId</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">cancelId</span>: <span class=\"hljs-number\">1</span>\n  })\n  <span class=\"hljs-keyword\">const</span> leave = (choice === <span class=\"hljs-number\">0</span>)\n  <span class=\"hljs-keyword\">if</span> (leave) {\n    event.preventDefault()\n  }\n})\n</code></pre>\n<p><strong>Note:</strong> This will be emitted for <code>BrowserViews</code> but will <em>not</em> be respected - this is because we have chosen not to tie the <code>BrowserView</code> lifecycle to its owning BrowserWindow should one exist per the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event\">specification</a>.</p>\n<h4 id=\"event-crashed-deprecated\"><a href=\"#event-crashed-deprecated\">Event: 'crashed' <em>Deprecated</em></a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>Emitted when the renderer process crashes or is killed.</p>\n<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>\n<h4 id=\"event-render-process-gone\"><a href=\"#event-render-process-gone\">Event: 'render-process-gone'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>Objeto <code>details</code><ul>\n<li><code>reason</code> String - The reason the render process is gone.  Valores possíveis:<ul>\n<li><code>clean-exit</code> - Process exited with an exit code of zero</li>\n<li><code>abnormal-exit</code> - Process exited with a non-zero exit code</li>\n<li><code>killed</code> - Process was sent a SIGTERM or otherwise killed externally</li>\n<li><code>crashed</code> - Process crashed</li>\n<li><code>oom</code> - Process ran out of memory</li>\n<li><code>launch-failed</code> - Process never successfully launched</li>\n<li><code>integrity-failure</code> - Windows code integrity checks failed</li>\n</ul></li>\n<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>\n</ul></li>\n</ul>\n<p>Emitted when the renderer process unexpectedly disappears.  This is normally because it was crashed or killed.</p>\n<h4 id=\"evento-unresponsive\"><a href=\"#evento-unresponsive\">Evento: 'unresponsive'</a></h4>\n<p>Emitted when the web page becomes unresponsive.</p>\n<h4 id=\"evento-responsive\"><a href=\"#evento-responsive\">Evento: 'responsive'</a></h4>\n<p>Emitted when the unresponsive web page becomes responsive again.</p>\n<h4 id=\"event-plugin-crashed\"><a href=\"#event-plugin-crashed\">Event: 'plugin-crashed'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>\n<p>Emitted when a plugin process has crashed.</p>\n<h4 id=\"event-destroyed\"><a href=\"#event-destroyed\">Event: 'destroyed'</a></h4>\n<p>Emitted when <code>webContents</code> is destroyed.</p>\n<h4 id=\"event-before-input-event\"><a href=\"#event-before-input-event\">Event: 'before-input-event'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>input</code> Object - Input properties.<ul>\n<li><code>type</code> String - Either <code>keyUp</code> or <code>keyDown</code>.</li>\n<li><code>key</code> String - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.key</a>.</li>\n<li><code>code</code> String - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.code</a>.</li>\n<li><code>isAutoRepeat</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.repeat</a>.</li>\n<li><code>isComposing</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.isComposing</a>.</li>\n<li><code>shift</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.shiftKey</a>.</li>\n<li><code>control</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.controlKey</a>.</li>\n<li><code>alt</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.altKey</a>.</li>\n<li><code>meta</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.metaKey</a>.</li>\n<li><code>location</code> Number - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.location</a>.</li>\n<li><code>modifiers</code> String[] - See <a href=\"/docs/api/structures/input-event\">InputEvent.modifiers</a>.</li>\n</ul></li>\n</ul>\n<p>Emitted before dispatching the <code>keydown</code> and <code>keyup</code> events in the page. Calling <code>event.preventDefault</code> will prevent the page <code>keydown</code>/<code>keyup</code> events and the menu shortcuts.</p>\n<p>To only prevent the menu shortcuts, use <a href=\"#contentssetignoremenushortcutsignore\"><code>setIgnoreMenuShortcuts</code></a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\nwin.webContents.on(<span class=\"hljs-string\">'before-input-event'</span>, (event, input) => {\n  <span class=\"hljs-comment\">// For example, only enable application menu keyboard shortcuts when</span>\n  <span class=\"hljs-comment\">// Ctrl/Cmd are down.</span>\n  win.webContents.setIgnoreMenuShortcuts(!input.control &#x26;&#x26; !input.meta)\n})\n</code></pre>\n<h4 id=\"evento-enter-html-full-screen\"><a href=\"#evento-enter-html-full-screen\">Evento: 'enter-html-full-screen'</a></h4>\n<p>Emitted when the window enters a full-screen state triggered by HTML API.</p>\n<h4 id=\"evento-leave-html-full-screen\"><a href=\"#evento-leave-html-full-screen\">Evento: 'leave-html-full-screen'</a></h4>\n<p>Emitted when the window leaves a full-screen state triggered by HTML API.</p>\n<h4 id=\"event-zoom-changed\"><a href=\"#event-zoom-changed\">Event: 'zoom-changed'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>zoomDirection</code> String - Can be <code>in</code> or <code>out</code>.</li>\n</ul>\n<p>Emitted when the user is requesting to change the zoom level using the mouse wheel.</p>\n<h4 id=\"event-devtools-opened\"><a href=\"#event-devtools-opened\">Event: 'devtools-opened'</a></h4>\n<p>Emitted when DevTools is opened.</p>\n<h4 id=\"event-devtools-closed\"><a href=\"#event-devtools-closed\">Event: 'devtools-closed'</a></h4>\n<p>Emitted when DevTools is closed.</p>\n<h4 id=\"event-devtools-focused\"><a href=\"#event-devtools-focused\">Event: 'devtools-focused'</a></h4>\n<p>Emitted when DevTools is focused / opened.</p>\n<h4 id=\"evento-certificate-error\"><a href=\"#evento-certificate-error\">Evento: 'certificate-error'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>String <code>url</code></li>\n<li><code>error</code> String - The error code.</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>isTrusted</code> Boolean - Indicates whether the certificate can be considered trusted.</li>\n</ul></li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Emitted when failed to verify the <code>certificate</code> for <code>url</code>.</p>\n<p>The usage is the same with <a href=\"/docs/api/app#event-certificate-error\">the <code>certificate-error</code> event of <code>app</code></a>.</p>\n<h4 id=\"evento-select-client-certificate\"><a href=\"#evento-select-client-certificate\">Evento: 'select-client-certificate'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> URL</li>\n<li><code>certificateList</code> <a href=\"/docs/api/structures/certificate\">Certificate[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> - Must be a certificate from the given list.</li>\n</ul></li>\n</ul>\n<p>Emitido quando um certificado de cliente é solicitado.</p>\n<p>The usage is the same with <a href=\"/docs/api/app#event-select-client-certificate\">the <code>select-client-certificate</code> event of <code>app</code></a>.</p>\n<h4 id=\"evento-login\"><a href=\"#evento-login\">Evento: 'login'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>Objeto <code>authenticationResponseDetails</code><ul>\n<li><code>url</code> URL</li>\n</ul></li>\n<li>Objeto <code>authInfo</code><ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (opcional)</li>\n<li><code>password</code> String (opcional)</li>\n</ul></li>\n</ul>\n<p>Emitido quando <code>webContents</code> quer fazer uma autenticação básica.</p>\n<p>The usage is the same with <a href=\"/docs/api/app#event-login\">the <code>login</code> event of <code>app</code></a>.</p>\n<h4 id=\"event-found-in-page\"><a href=\"#event-found-in-page\">Event: 'found-in-page'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>result</code> Object<ul>\n<li><code>requestId</code> Integer</li>\n<li><code>activeMatchOrdinal</code> Integer - Position of the active match.</li>\n<li><code>matches</code> Integer - Number of Matches.</li>\n<li><code>selectionArea</code> Rectangle - Coordinates of first match region.</li>\n<li><code>finalUpdate</code> Boolean</li>\n</ul></li>\n</ul>\n<p>Emitted when a result is available for [<code>webContents.findInPage</code>] request.</p>\n<h4 id=\"event-media-started-playing\"><a href=\"#event-media-started-playing\">Event: 'media-started-playing'</a></h4>\n<p>Emitted when media starts playing.</p>\n<h4 id=\"event-media-paused\"><a href=\"#event-media-paused\">Event: 'media-paused'</a></h4>\n<p>Emitted when media is paused or done playing.</p>\n<h4 id=\"event-did-change-theme-color\"><a href=\"#event-did-change-theme-color\">Event: 'did-change-theme-color'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>color</code> (String | null) - Theme color is in format of '#rrggbb'. It is <code>null</code> when no theme color is set.</li>\n</ul>\n<p>Emitted when a page's theme color changes. This is usually due to encountering a meta tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">'theme-color'</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">'#ff0000'</span>></span>\n</code></pre>\n<h4 id=\"event-update-target-url\"><a href=\"#event-update-target-url\">Event: 'update-target-url'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>String <code>url</code></li>\n</ul>\n<p>Emitted when mouse moves over a link or the keyboard moves the focus to a link.</p>\n<h4 id=\"event-cursor-changed\"><a href=\"#event-cursor-changed\">Event: 'cursor-changed'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String</li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> (opcional)</li>\n<li><code>scale</code> Float (optional) - scaling factor for the custom cursor.</li>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) - the size of the <code>image</code>.</li>\n<li><code>hotspot</code> <a href=\"/docs/api/structures/point\">Point</a> (optional) - coordinates of the custom cursor's hotspot.</li>\n</ul>\n<p>Emitted when the cursor's type changes. The <code>type</code> parameter can be <code>default</code>, <code>crosshair</code>, <code>pointer</code>, <code>text</code>, <code>wait</code>, <code>help</code>, <code>e-resize</code>, <code>n-resize</code>, <code>ne-resize</code>, <code>nw-resize</code>, <code>s-resize</code>, <code>se-resize</code>, <code>sw-resize</code>, <code>w-resize</code>, <code>ns-resize</code>, <code>ew-resize</code>, <code>nesw-resize</code>, <code>nwse-resize</code>, <code>col-resize</code>, <code>row-resize</code>, <code>m-panning</code>, <code>e-panning</code>, <code>n-panning</code>, <code>ne-panning</code>, <code>nw-panning</code>, <code>s-panning</code>, <code>se-panning</code>, <code>sw-panning</code>, <code>w-panning</code>, <code>move</code>, <code>vertical-text</code>, <code>cell</code>, <code>context-menu</code>, <code>alias</code>, <code>progress</code>, <code>nodrop</code>, <code>copy</code>, <code>none</code>, <code>not-allowed</code>, <code>zoom-in</code>, <code>zoom-out</code>, <code>grab</code>, <code>grabbing</code> or <code>custom</code>.</p>\n<p>If the <code>type</code> parameter is <code>custom</code>, the <code>image</code> parameter will hold the custom cursor image in a <a href=\"/docs/api/native-image\"><code>NativeImage</code></a>, and <code>scale</code>, <code>size</code> and <code>hotspot</code> will hold additional information about the custom cursor.</p>\n<h4 id=\"event-context-menu\"><a href=\"#event-context-menu\">Event: 'context-menu'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>params</code> Object<ul>\n<li><code>x</code> Integer - x coordinate.</li>\n<li><code>y</code> Integer - y coordinate.</li>\n<li><code>frame</code> WebFrameMain - Frame from which the context menu was invoked.</li>\n<li><code>linkURL</code> String - URL of the link that encloses the node the context menu was invoked on.</li>\n<li><code>linkText</code> String - Text associated with the link. May be an empty string if the contents of the link are an image.</li>\n<li><code>pageURL</code> String - URL of the top level page that the context menu was invoked on.</li>\n<li><code>frameURL</code> String - URL of the subframe that the context menu was invoked on.</li>\n<li><code>srcURL</code> String - Source URL for the element that the context menu was invoked on. Elements with source URLs are images, audio and video.</li>\n<li><code>mediaType</code> String - Type of the node the context menu was invoked on. Can be <code>none</code>, <code>image</code>, <code>audio</code>, <code>video</code>, <code>canvas</code>, <code>file</code> or <code>plugin</code>.</li>\n<li><code>hasImageContents</code> Boolean - Whether the context menu was invoked on an image which has non-empty contents.</li>\n<li><code>isEditable</code> Boolean - Whether the context is editable.</li>\n<li><code>selectionText</code> String - Text of the selection that the context menu was invoked on.</li>\n<li><code>titleText</code> String - Title text of the selection that the context menu was invoked on.</li>\n<li><code>altText</code> String - Alt text of the selection that the context menu was invoked on.</li>\n<li><code>suggestedFilename</code> String - Suggested filename to be used when saving file through 'Save Link As' option of context menu.</li>\n<li><code>selectionRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Rect representing the coordinates in the document space of the selection.</li>\n<li><code>selectionStartOffset</code> Number - Start position of the selection text.</li>\n<li><code>referrerPolicy</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer policy of the frame on which the menu is invoked.</li>\n<li><code>misspelledWord</code> String - The misspelled word under the cursor, if any.</li>\n<li><code>dictionarySuggestions</code> String[] - An array of suggested words to show the user to replace the <code>misspelledWord</code>.  Only available if there is a misspelled word and spellchecker is enabled.</li>\n<li><code>frameCharset</code> String - The character encoding of the frame on which the menu was invoked.</li>\n<li><code>inputFieldType</code> String - If the context menu was invoked on an input field, the type of that field. Possible values are <code>none</code>, <code>plainText</code>, <code>password</code>, <code>other</code>.</li>\n<li><code>spellcheckEnabled</code> Boolean - If the context is editable, whether or not spellchecking is enabled.</li>\n<li><code>menuSourceType</code> String - Input source that invoked the context menu. Pode ser <code>none</code>, <code>mouse</code>, <code>keyboard</code>, <code>touch</code>, <code>touchMenu</code>, <code>longPress</code>, <code>longTap</code>, <code>touchHandle</code>, <code>stylus</code>, <code>adjustSelection</code> ou <code>adjustSelectionReset</code>.</li>\n<li><code>mediaFlags</code> Object - The flags for the media element the context menu was invoked on.<ul>\n<li><code>inError</code> Boolean - Whether the media element has crashed.</li>\n<li><code>isPaused</code> Boolean - Whether the media element is paused.</li>\n<li><code>isMuted</code> Boolean - Whether the media element is muted.</li>\n<li><code>hasAudio</code> Boolean - Whether the media element has audio.</li>\n<li><code>isLooping</code> Boolean - Whether the media element is looping.</li>\n<li><code>isControlsVisible</code> Boolean - Whether the media element's controls are visible.</li>\n<li><code>canToggleControls</code> Boolean - Whether the media element's controls are toggleable.</li>\n<li><code>canPrint</code> Boolean - Whether the media element can be printed.</li>\n<li><code>canSave</code> Boolean - Whether or not the media element can be downloaded.</li>\n<li><code>canShowPictureInPicture</code> Boolean - Whether the media element can show picture-in-picture.</li>\n<li><code>isShowingPictureInPicture</code> Boolean - Whether the media element is currently showing picture-in-picture.</li>\n<li><code>canRotate</code> Boolean - Whether the media element can be rotated.</li>\n<li><code>canLoop</code> Boolean - Whether the media element can be looped.</li>\n</ul></li>\n<li><code>editFlags</code> Object - These flags indicate whether the renderer believes it is able to perform the corresponding action.<ul>\n<li><code>canUndo</code> Boolean - Whether the renderer believes it can undo.</li>\n<li><code>canRedo</code> Boolean - Whether the renderer believes it can redo.</li>\n<li><code>canCut</code> Boolean - Whether the renderer believes it can cut.</li>\n<li><code>canCopy</code> Boolean - Whether the renderer believes it can copy.</li>\n<li><code>canPaste</code> Boolean - Whether the renderer believes it can paste.</li>\n<li><code>canDelete</code> Boolean - Whether the renderer believes it can delete.</li>\n<li><code>canSelectAll</code> Boolean - Whether the renderer believes it can select all.</li>\n<li><code>canEditRichly</code> Boolean - Whether the renderer believes it can edit text richly.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Emitted when there is a new context menu that needs to be handled.</p>\n<h4 id=\"event-select-bluetooth-device\"><a href=\"#event-select-bluetooth-device\">Event: 'select-bluetooth-device'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>devices</code> <a href=\"/docs/api/structures/bluetooth-device\">BluetoothDevice[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>deviceId</code> String</li>\n</ul></li>\n</ul>\n<p>Emitted when bluetooth device needs to be selected on call to <code>navigator.bluetooth.requestDevice</code>. To use <code>navigator.bluetooth</code> api <code>webBluetooth</code> should be enabled. If <code>event.preventDefault</code> is not called, first available device will be selected. <code>callback</code> should be called with <code>deviceId</code> to be selected, passing empty string to <code>callback</code> will cancel the request.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'enable-experimental-web-platform-features'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.webContents.on(<span class=\"hljs-string\">'select-bluetooth-device'</span>, (event, deviceList, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> result = deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.deviceName === <span class=\"hljs-string\">'test'</span>\n    })\n    <span class=\"hljs-keyword\">if</span> (!result) {\n      callback(<span class=\"hljs-string\">''</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      callback(result.deviceId)\n    }\n  })\n})\n</code></pre>\n<h4 id=\"event-paint\"><a href=\"#event-paint\">Event: 'paint'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>dirtyRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> - The image data of the whole frame.</li>\n</ul>\n<p>Emitted when a new frame is generated. Only the dirty area is passed in the buffer.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">offscreen</span>: <span class=\"hljs-literal\">true</span> } })\nwin.webContents.on(<span class=\"hljs-string\">'paint'</span>, (event, dirty, image) => {\n  <span class=\"hljs-comment\">// updateBitmap(dirty, image.getBitmap())</span>\n})\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n</code></pre>\n<h4 id=\"event-devtools-reload-page\"><a href=\"#event-devtools-reload-page\">Event: 'devtools-reload-page'</a></h4>\n<p>Emitted when the devtools window instructs the webContents to reload</p>\n<h4 id=\"event-will-attach-webview\"><a href=\"#event-will-attach-webview\">Event: 'will-attach-webview'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webPreferences</code> WebPreferences - The web preferences that will be used by the guest page. This object can be modified to adjust the preferences for the guest page.</li>\n<li><code>params</code> Record&#x3C;string, string> - The other <code>&#x3C;webview></code> parameters such as the <code>src</code> URL. This object can be modified to adjust the parameters of the guest page.</li>\n</ul>\n<p>Emitted when a <code>&#x3C;webview></code>'s web contents is being attached to this web contents. Calling <code>event.preventDefault()</code> will destroy the guest page.</p>\n<p>This event can be used to configure <code>webPreferences</code> for the <code>webContents</code> of a <code>&#x3C;webview></code> before it's loaded, and provides the ability to set settings that can't be set via <code>&#x3C;webview></code> attributes.</p>\n<p><strong>Note:</strong> The specified <code>preload</code> script option will appear as <code>preloadURL</code> (not <code>preload</code>) in the <code>webPreferences</code> object emitted with this event.</p>\n<h4 id=\"event-did-attach-webview\"><a href=\"#event-did-attach-webview\">Event: 'did-attach-webview'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> WebContents - The guest web contents that is used by the <code>&#x3C;webview></code>.</li>\n</ul>\n<p>Emitted when a <code>&#x3C;webview></code> has been attached to this web contents.</p>\n<h4 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>level</code> Integer - The log level, from 0 to 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>message</code> String - The actual console message</li>\n<li><code>line</code> Integer - The line number of the source that triggered this console message</li>\n<li><code>sourceId</code> String</li>\n</ul>\n<p>Emitted when the associated window logs a console message.</p>\n<h4 id=\"event-preload-error\"><a href=\"#event-preload-error\">Event: 'preload-error'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preloadPath</code> String</li>\n<li>Erro <code>error</code></li>\n</ul>\n<p>Emitted when the preload script <code>preloadPath</code> throws an unhandled exception <code>error</code>.</p>\n<h4 id=\"event-ipc-message\"><a href=\"#event-ipc-message\">Event: 'ipc-message'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Emitted when the renderer process sends an asynchronous message via <code>ipcRenderer.send()</code>.</p>\n<h4 id=\"event-ipc-message-sync\"><a href=\"#event-ipc-message-sync\">Event: 'ipc-message-sync'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Emitted when the renderer process sends a synchronous message via <code>ipcRenderer.sendSync()</code>.</p>\n<h4 id=\"event-desktop-capturer-get-sources\"><a href=\"#event-desktop-capturer-get-sources\">Event: 'desktop-capturer-get-sources'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when <code>desktopCapturer.getSources()</code> is called in the renderer process. Calling <code>event.preventDefault()</code> will make it return empty sources.</p>\n<h4 id=\"event-preferred-size-changed\"><a href=\"#event-preferred-size-changed\">Event: 'preferred-size-changed'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preferredSize</code> <a href=\"/docs/api/structures/size\">Size</a> - The minimum size needed to contain the layout of the document—without requiring scrolling.</li>\n</ul>\n<p>Emitted when the <code>WebContents</code> preferred size has changed.</p>\n<p>This event will only be emitted when <code>enablePreferredSizeMode</code> is set to <code>true</code> in <code>webPreferences</code>.</p>\n<h4 id=\"event-frame-created\"><a href=\"#event-frame-created\">Event: 'frame-created'</a></h4>\n<p>Retorna:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li>Objeto <code>details</code><ul>\n<li><code>frame</code> WebFrameMain</li>\n</ul></li>\n</ul>\n<p>Emitted when the <a href=\"/docs/api/web-contents#contentsmainframe-readonly\">mainFrame</a>, an <code>&#x3C;iframe></code>, or a nested <code>&#x3C;iframe></code> is loaded within the page.</p>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<h4 id=\"contentsloadurlurl-options\"><a href=\"#contentsloadurlurl-options\"><code>contents.loadURL(url[, options])</code></a></h4>\n<ul>\n<li>String <code>url</code></li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (optional) - An HTTP Referrer url.</li>\n<li><code>userAgent</code> String (optional) - A user agent originating the request.</li>\n<li><code>extraHeaders</code> String (optional) - Extra headers separated by \"\\n\".</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified <code>url</code> is a data url and needs to load other files.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - the promise will resolve when the page has finished loading (see <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects if the page fails to load (see <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>). A noop rejection handler is already attached, which avoids unhandled rejection errors.</p>\n<p>Loads the <code>url</code> in the window. The <code>url</code> must contain the protocol prefix, e.g. the <code>http://</code> or <code>file://</code>. If the load should bypass http cache then use the <code>pragma</code> header to achieve it.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> options = { <span class=\"hljs-attr\">extraHeaders</span>: <span class=\"hljs-string\">'pragma: no-cache\\n'</span> }\nwebContents.loadURL(<span class=\"hljs-string\">'https://github.com'</span>, options)\n</code></pre>\n<h4 id=\"contentsloadfilefilepath-options\"><a href=\"#contentsloadfilefilepath-options\"><code>contents.loadFile(filePath[, options])</code></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>query</code> Record&#x3C;String, String> (optional) - Passed to <code>url.format()</code>.</li>\n<li><code>search</code> String (optional) - Passed to <code>url.format()</code>.</li>\n<li><code>hash</code> String (optional) - Passed to <code>url.format()</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - the promise will resolve when the page has finished loading (see <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects if the page fails to load (see <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Loads the given file in the window, <code>filePath</code> should be a path to an HTML file relative to the root of your application.  For instance an app structure like this:</p>\n<pre><code class=\"hljs language-sh\">| root\n| - package.json\n| - src\n|   - main.js\n|   - index.html\n</code></pre>\n<p>Would require code like this</p>\n<pre><code class=\"hljs language-js\">win.loadFile(<span class=\"hljs-string\">'src/index.html'</span>)\n</code></pre>\n<h4 id=\"contentsdownloadurlurl\"><a href=\"#contentsdownloadurlurl\"><code>contents.downloadURL(url)</code></a></h4>\n<ul>\n<li>String <code>url</code></li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code> without navigating. The <code>will-download</code> event of <code>session</code> will be triggered.</p>\n<h4 id=\"contentsgeturl\"><a href=\"#contentsgeturl\"><code>contents.getURL()</code></a></h4>\n<p>Returns <code>String</code> - The URL of the current web page.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> currentURL = win.webContents.getURL()\n  <span class=\"hljs-built_in\">console</span>.log(currentURL)\n})\n</code></pre>\n<h4 id=\"contentsgettitle\"><a href=\"#contentsgettitle\"><code>contents.getTitle()</code></a></h4>\n<p>Returns <code>String</code> - The title of the current web page.</p>\n<h4 id=\"contentsisdestroyed\"><a href=\"#contentsisdestroyed\"><code>contents.isDestroyed()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the web page is destroyed.</p>\n<h4 id=\"contentsfocus\"><a href=\"#contentsfocus\"><code>contents.focus()</code></a></h4>\n<p>Focuses the web page.</p>\n<h4 id=\"contentsisfocused\"><a href=\"#contentsisfocused\"><code>contents.isFocused()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the web page is focused.</p>\n<h4 id=\"contentsisloading\"><a href=\"#contentsisloading\"><code>contents.isLoading()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether web page is still loading resources.</p>\n<h4 id=\"contentsisloadingmainframe\"><a href=\"#contentsisloadingmainframe\"><code>contents.isLoadingMainFrame()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the main frame (and not just iframes or frames within it) is still loading.</p>\n<h4 id=\"contentsiswaitingforresponse\"><a href=\"#contentsiswaitingforresponse\"><code>contents.isWaitingForResponse()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the web page is waiting for a first-response from the main resource of the page.</p>\n<h4 id=\"contentsstop\"><a href=\"#contentsstop\"><code>contents.stop()</code></a></h4>\n<p>Stops any pending navigation.</p>\n<h4 id=\"contentsreload\"><a href=\"#contentsreload\"><code>contents.reload()</code></a></h4>\n<p>Reloads the current web page.</p>\n<h4 id=\"contentsreloadignoringcache\"><a href=\"#contentsreloadignoringcache\"><code>contents.reloadIgnoringCache()</code></a></h4>\n<p>Reloads current page and ignores cache.</p>\n<h4 id=\"contentscangoback\"><a href=\"#contentscangoback\"><code>contents.canGoBack()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the browser can go back to previous web page.</p>\n<h4 id=\"contentscangoforward\"><a href=\"#contentscangoforward\"><code>contents.canGoForward()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the browser can go forward to next web page.</p>\n<h4 id=\"contentscangotooffsetoffset\"><a href=\"#contentscangotooffsetoffset\"><code>contents.canGoToOffset(offset)</code></a></h4>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the web page can go to <code>offset</code>.</p>\n<h4 id=\"contentsclearhistory\"><a href=\"#contentsclearhistory\"><code>contents.clearHistory()</code></a></h4>\n<p>Clears the navigation history.</p>\n<h4 id=\"contentsgoback\"><a href=\"#contentsgoback\"><code>contents.goBack()</code></a></h4>\n<p>Makes the browser go back a web page.</p>\n<h4 id=\"contentsgoforward\"><a href=\"#contentsgoforward\"><code>contents.goForward()</code></a></h4>\n<p>Makes the browser go forward a web page.</p>\n<h4 id=\"contentsgotoindexindex\"><a href=\"#contentsgotoindexindex\"><code>contents.goToIndex(index)</code></a></h4>\n<ul>\n<li><code>index</code> Integer</li>\n</ul>\n<p>Navigates browser to the specified absolute web page index.</p>\n<h4 id=\"contentsgotooffsetoffset\"><a href=\"#contentsgotooffsetoffset\"><code>contents.goToOffset(offset)</code></a></h4>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Navigates to the specified offset from the \"current entry\".</p>\n<h4 id=\"contentsiscrashed\"><a href=\"#contentsiscrashed\"><code>contents.isCrashed()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the renderer process has crashed.</p>\n<h4 id=\"contentsforcefullycrashrenderer\"><a href=\"#contentsforcefullycrashrenderer\"><code>contents.forcefullyCrashRenderer()</code></a></h4>\n<p>Forcefully terminates the renderer process that is currently hosting this <code>webContents</code>. This will cause the <code>render-process-gone</code> event to be emitted with the <code>reason=killed || reason=crashed</code>. Please note that some webContents share renderer processes and therefore calling this method may also crash the host process for other webContents as well.</p>\n<p>Calling <code>reload()</code> immediately after calling this method will force the reload to occur in a new process. This should be used when this process is unstable or unusable, for instance in order to recover from the <code>unresponsive</code> event.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'unresponsive'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> { response } = <span class=\"hljs-keyword\">await</span> dialog.showMessageBox({\n    <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'App X has become unresponsive'</span>,\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Do you want to try forcefully reloading the app?'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'OK'</span>, <span class=\"hljs-string\">'Cancel'</span>],\n    <span class=\"hljs-attr\">cancelId</span>: <span class=\"hljs-number\">1</span>\n  })\n  <span class=\"hljs-keyword\">if</span> (response === <span class=\"hljs-number\">0</span>) {\n    contents.forcefullyCrashRenderer()\n    contents.reload()\n  }\n})\n</code></pre>\n<h4 id=\"contentssetuseragentuseragent\"><a href=\"#contentssetuseragentuseragent\"><code>contents.setUserAgent(userAgent)</code></a></h4>\n<ul>\n<li><code>userAgent</code> String</li>\n</ul>\n<p>Overrides the user agent for this web page.</p>\n<h4 id=\"contentsgetuseragent\"><a href=\"#contentsgetuseragent\"><code>contents.getUserAgent()</code></a></h4>\n<p>Returns <code>String</code> - The user agent for this web page.</p>\n<h4 id=\"contentsinsertcsscss-options\"><a href=\"#contentsinsertcsscss-options\"><code>contents.insertCSS(css[, options])</code></a></h4>\n<ul>\n<li><code>css</code> String</li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>cssOrigin</code> String (optional) - Can be either 'user' or 'author'; Specifying 'user' enables you to prevent websites from overriding the CSS you insert. Default is 'author'.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - A promise that resolves with a key for the inserted CSS that can later be used to remove the CSS via <code>contents.removeInsertedCSS(key)</code>.</p>\n<p>Injects CSS into the current web page and returns a unique key for the inserted stylesheet.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n  contents.insertCSS(<span class=\"hljs-string\">'html, body { background-color: #f00; }'</span>)\n})\n</code></pre>\n<h4 id=\"contentsremoveinsertedcsskey\"><a href=\"#contentsremoveinsertedcsskey\"><code>contents.removeInsertedCSS(key)</code></a></h4>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves if the removal was successful.</p>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from <code>contents.insertCSS(css)</code>.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'did-finish-load'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> key = <span class=\"hljs-keyword\">await</span> contents.insertCSS(<span class=\"hljs-string\">'html, body { background-color: #f00; }'</span>)\n  contents.removeInsertedCSS(key)\n})\n</code></pre>\n<h4 id=\"contentsexecutejavascriptcode-usergesture\"><a href=\"#contentsexecutejavascriptcode-usergesture\"><code>contents.executeJavaScript(code[, userGesture])</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if the result of the code is a rejected promise.</p>\n<p>Evaluates <code>code</code> in page.</p>\n<p>In the browser window some HTML APIs like <code>requestFullScreen</code> can only be invoked by a gesture from the user. Setting <code>userGesture</code> to <code>true</code> will remove this limitation.</p>\n<p>Code execution will be suspended until web page stop loading.</p>\n<pre><code class=\"hljs language-js\">contents.executeJavaScript(<span class=\"hljs-string\">'fetch(\"https://jsonplaceholder.typicode.com/users/1\").then(resp => resp.json())'</span>, <span class=\"hljs-literal\">true</span>)\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">result</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(result) <span class=\"hljs-comment\">// Will be the JSON object from the fetch call</span>\n  })\n</code></pre>\n<h4 id=\"contentsexecutejavascriptinisolatedworldworldid-scripts-usergesture\"><a href=\"#contentsexecutejavascriptinisolatedworldworldid-scripts-usergesture\"><code>contents.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture])</code></a></h4>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default world, <code>999</code> is the world used by Electron's <code>contextIsolation</code> feature.  You can provide any integer here.</li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/web-source\">WebSource[]</a></li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if the result of the code is a rejected promise.</p>\n<p>Works like <code>executeJavaScript</code> but evaluates <code>scripts</code> in an isolated context.</p>\n<h4 id=\"contentssetignoremenushortcutsignore\"><a href=\"#contentssetignoremenushortcutsignore\"><code>contents.setIgnoreMenuShortcuts(ignore)</code></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n</ul>\n<p>Ignore application menu shortcuts while this web contents is focused.</p>\n<h4 id=\"contentssetwindowopenhandlerhandler\"><a href=\"#contentssetwindowopenhandlerhandler\"><code>contents.setWindowOpenHandler(handler)</code></a></h4>\n<ul>\n<li>\n<p><code>handler</code> Função&#x3C;{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}></p>\n<ul>\n<li>Objeto <code>details</code><ul>\n<li><code>url</code> String - The <em>resolved</em> version of the URL passed to <code>window.open()</code>. e.g. opening a window with <code>window.open('foo')</code> will yield something like <code>https://the-origin/the/current/path/foo</code>.</li>\n<li><code>frameName</code> String - Name of the window provided in <code>window.open()</code></li>\n<li><code>features</code> String - Comma separated list of window features provided to <code>window.open()</code>.</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> or <code>other</code>.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer that will be passed to the new window. May or may not result in the <code>Referer</code> header being sent, depending on the referrer policy.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that will be sent to the new window, along with the appropriate headers that will be set. If no post data is to be sent, the value will be <code>null</code>. Only defined when the window is being created by a form that set <code>target=_blank</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}</code> - <code>deny</code> cancels the creation of the new window. <code>allow</code> will allow the new window to be created. Specifying <code>overrideBrowserWindowOptions</code> allows customization of the created window. Returning an unrecognized value such as a null, undefined, or an object without a recognized 'action' value will result in a console error and have the same effect as returning <code>{action: 'deny'}</code>.</p>\n</li>\n</ul>\n<p>Called before creating a window a new window is requested by the renderer, e.g. by <code>window.open()</code>, a link with <code>target=\"_blank\"</code>, shift+clicking on a link, or submitting a form with <code>&#x3C;form target=\"_blank\"></code>. See <a href=\"/docs/api/window-open\"><code>window.open()</code></a> for more details and how to use this in conjunction with <code>did-create-window</code>.</p>\n<h4 id=\"contentssetaudiomutedmuted\"><a href=\"#contentssetaudiomutedmuted\"><code>contents.setAudioMuted(muted)</code></a></h4>\n<ul>\n<li><code>muted</code> Boolean</li>\n</ul>\n<p>Mute the audio on the current web page.</p>\n<h4 id=\"contentsisaudiomuted\"><a href=\"#contentsisaudiomuted\"><code>contents.isAudioMuted()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether this page has been muted.</p>\n<h4 id=\"contentsiscurrentlyaudible\"><a href=\"#contentsiscurrentlyaudible\"><code>contents.isCurrentlyAudible()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether audio is currently playing.</p>\n<h4 id=\"contentssetzoomfactorfactor\"><a href=\"#contentssetzoomfactorfactor\"><code>contents.setZoomFactor(factor)</code></a></h4>\n<ul>\n<li><code>factor</code> Double - Zoom factor; default is 1.0.</li>\n</ul>\n<p>Changes the zoom factor to the specified factor. Zoom factor is zoom percent divided by 100, so 300% = 3.0.</p>\n<p>The factor must be greater than 0.0.</p>\n<h4 id=\"contentsgetzoomfactor\"><a href=\"#contentsgetzoomfactor\"><code>contents.getZoomFactor()</code></a></h4>\n<p>Returns <code>Number</code> - the current zoom factor.</p>\n<h4 id=\"contentssetzoomlevellevel\"><a href=\"#contentssetzoomlevellevel\"><code>contents.setZoomLevel(level)</code></a></h4>\n<ul>\n<li><code>level</code> Number - Zoom level.</li>\n</ul>\n<p>Changes the zoom level to the specified level. The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. The formula for this is <code>scale := 1.2 ^ level</code>.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h4 id=\"contentsgetzoomlevel\"><a href=\"#contentsgetzoomlevel\"><code>contents.getZoomLevel()</code></a></h4>\n<p>Returns <code>Number</code> - the current zoom level.</p>\n<h4 id=\"contentssetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#contentssetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>contents.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h4>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>Retorna <code>Promise&#x3C;void></code></p>\n<p>Sets the maximum and minimum pinch-to-zoom level.</p>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom is disabled by default in Electron. To re-enable it, call:</p>\n<pre><code class=\"hljs language-js\">contents.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">3</span>)\n</code></pre>\n</blockquote>\n<h4 id=\"contentsundo\"><a href=\"#contentsundo\"><code>contents.undo()</code></a></h4>\n<p>Executes the editing command <code>undo</code> in web page.</p>\n<h4 id=\"contentsredo\"><a href=\"#contentsredo\"><code>contents.redo()</code></a></h4>\n<p>Executes the editing command <code>redo</code> in web page.</p>\n<h4 id=\"contentscut\"><a href=\"#contentscut\"><code>contents.cut()</code></a></h4>\n<p>Executes the editing command <code>cut</code> in web page.</p>\n<h4 id=\"contentscopy\"><a href=\"#contentscopy\"><code>contents.copy()</code></a></h4>\n<p>Executes the editing command <code>copy</code> in web page.</p>\n<h4 id=\"contentscopyimageatx-y\"><a href=\"#contentscopyimageatx-y\"><code>contents.copyImageAt(x, y)</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Copy the image at the given position to the clipboard.</p>\n<h4 id=\"contentspaste\"><a href=\"#contentspaste\"><code>contents.paste()</code></a></h4>\n<p>Executes the editing command <code>paste</code> in web page.</p>\n<h4 id=\"contentspasteandmatchstyle\"><a href=\"#contentspasteandmatchstyle\"><code>contents.pasteAndMatchStyle()</code></a></h4>\n<p>Executes the editing command <code>pasteAndMatchStyle</code> in web page.</p>\n<h4 id=\"contentsdelete\"><a href=\"#contentsdelete\"><code>contents.delete()</code></a></h4>\n<p>Executes the editing command <code>delete</code> in web page.</p>\n<h4 id=\"contentsselectall\"><a href=\"#contentsselectall\"><code>contents.selectAll()</code></a></h4>\n<p>Executes the editing command <code>selectAll</code> in web page.</p>\n<h4 id=\"contentsunselect\"><a href=\"#contentsunselect\"><code>contents.unselect()</code></a></h4>\n<p>Executes the editing command <code>unselect</code> in web page.</p>\n<h4 id=\"contentsreplacetext\"><a href=\"#contentsreplacetext\"><code>contents.replace(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes the editing command <code>replace</code> in web page.</p>\n<h4 id=\"contentsreplacemisspellingtext\"><a href=\"#contentsreplacemisspellingtext\"><code>contents.replaceMisspelling(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes the editing command <code>replaceMisspelling</code> in web page.</p>\n<h4 id=\"contentsinserttexttext\"><a href=\"#contentsinserttexttext\"><code>contents.insertText(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Retorna <code>Promise&#x3C;void></code></p>\n<p>Inserts <code>text</code> to the focused element.</p>\n<h4 id=\"contentsfindinpagetext-options\"><a href=\"#contentsfindinpagetext-options\"><code>contents.findInPage(text[, options])</code></a></h4>\n<ul>\n<li><code>text</code> String - Content to be searched, must not be empty.</li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>forward</code> Boolean (optional) - Whether to search forward or backward, defaults to <code>true</code>.</li>\n<li><code>findNext</code> Boolean (optional) - Whether to begin a new text finding session with this request. Should be <code>true</code> for initial requests, and <code>false</code> for follow-up requests. Defaults to <code>false</code>.</li>\n<li><code>matchCase</code> Boolean (optional) - Whether search should be case-sensitive, defaults to <code>false</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code> - The request id used for the request.</p>\n<p>Starts a request to find all matches for the <code>text</code> in the web page. The result of the request can be obtained by subscribing to <a href=\"/docs/api/web-contents#event-found-in-page\"><code>found-in-page</code></a> event.</p>\n<h4 id=\"contentsstopfindinpageaction\"><a href=\"#contentsstopfindinpageaction\"><code>contents.stopFindInPage(action)</code></a></h4>\n<ul>\n<li><code>action</code> String - Specifies the action to take place when ending [<code>webContents.findInPage</code>] request.<ul>\n<li><code>clearSelection</code> - Clear the selection.</li>\n<li><code>keepSelection</code> - Translate the selection into a normal selection.</li>\n<li><code>activateSelection</code> - Focus and click the selection node.</li>\n</ul></li>\n</ul>\n<p>Stops any <code>findInPage</code> request for the <code>webContents</code> with the provided <code>action</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nwebContents.on(<span class=\"hljs-string\">'found-in-page'</span>, (event, result) => {\n  <span class=\"hljs-keyword\">if</span> (result.finalUpdate) webContents.stopFindInPage(<span class=\"hljs-string\">'clearSelection'</span>)\n})\n\n<span class=\"hljs-keyword\">const</span> requestId = webContents.findInPage(<span class=\"hljs-string\">'api'</span>)\n<span class=\"hljs-built_in\">console</span>.log(requestId)\n</code></pre>\n<h4 id=\"contentscapturepagerect\"><a href=\"#contentscapturepagerect\"><code>contents.capturePage([rect])</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (optional) - The area of the page to be captured.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - Resolves with a <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Captures a snapshot of the page within <code>rect</code>. Omitting <code>rect</code> will capture the whole visible page.</p>\n<h4 id=\"contentsisbeingcaptured\"><a href=\"#contentsisbeingcaptured\"><code>contents.isBeingCaptured()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether this page is being captured. It returns true when the capturer count is large then 0.</p>\n<h4 id=\"contentsincrementcapturercountsize-stayhidden-stayawake\"><a href=\"#contentsincrementcapturercountsize-stayhidden-stayawake\"><code>contents.incrementCapturerCount([size, stayHidden, stayAwake])</code></a></h4>\n<ul>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) - The preferred size for the capturer.</li>\n<li><code>stayHidden</code> Boolean (optional) -  Keep the page hidden instead of visible.</li>\n<li><code>stayAwake</code> Boolean (optional) -  Keep the system awake instead of allowing it to sleep.</li>\n</ul>\n<p>Increase the capturer count by one. The page is considered visible when its browser window is hidden and the capturer count is non-zero. If you would like the page to stay hidden, you should ensure that <code>stayHidden</code> is set to true.</p>\n<p>This also affects the Page Visibility API.</p>\n<h4 id=\"contentsdecrementcapturercountstayhidden-stayawake\"><a href=\"#contentsdecrementcapturercountstayhidden-stayawake\"><code>contents.decrementCapturerCount([stayHidden, stayAwake])</code></a></h4>\n<ul>\n<li><code>stayHidden</code> Boolean (optional) -  Keep the page in hidden state instead of visible.</li>\n<li><code>stayAwake</code> Boolean (optional) -  Keep the system awake instead of allowing it to sleep.</li>\n</ul>\n<p>Decrease the capturer count by one. The page will be set to hidden or occluded state when its browser window is hidden or occluded and the capturer count reaches zero. If you want to decrease the hidden capturer count instead you should set <code>stayHidden</code> to true.</p>\n<h4 id=\"contentsgetprinters\"><a href=\"#contentsgetprinters\"><code>contents.getPrinters()</code></a></h4>\n<p>Get the system printer list.</p>\n<p>Retorna <a href=\"/docs/api/structures/printer-info\"><code>PrinterInfo[]</code></a></p>\n<h4 id=\"contentsprintoptions-callback\"><a href=\"#contentsprintoptions-callback\"><code>contents.print([options], [callback])</code></a></h4>\n<ul>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>silent</code> Boolean (optional) - Don't ask user for print settings. Por padrão é <code>false</code>.</li>\n<li><code>printBackground</code> Boolean (optional) - Prints the background color and image of the web page. Por padrão é <code>false</code>.</li>\n<li><code>deviceName</code> String (optional) - Set the printer device name to use. Must be the system-defined name and not the 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.</li>\n<li><code>color</code> Boolean (optional) - Set whether the printed web page will be in color or grayscale. Por padrão é <code>true</code>.</li>\n<li>Objeto <code>margins</code> (opcional)<ul>\n<li><code>marginType</code> String (optional) - Can be <code>default</code>, <code>none</code>, <code>printableArea</code>, or <code>custom</code>. If <code>custom</code> is chosen, you will also need to specify <code>top</code>, <code>bottom</code>, <code>left</code>, and <code>right</code>.</li>\n<li><code>top</code> Number (optional) - The top margin of the printed web page, in pixels.</li>\n<li><code>bottom</code> Number (optional) - The bottom margin of the printed web page, in pixels.</li>\n<li><code>left</code> Number (optional) - The left margin of the printed web page, in pixels.</li>\n<li><code>right</code> Number (optional) - The right margin of the printed web page, in pixels.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - Whether the web page should be printed in landscape mode. Por padrão é <code>false</code>.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page.</li>\n<li><code>pagesPerSheet</code> Number (optional) - The number of pages to print per page sheet.</li>\n<li><code>collate</code> Boolean (optional) - Whether the web page should be collated.</li>\n<li><code>copies</code> Number (optional) - The number of copies of the web page to print.</li>\n<li><code>pageRanges</code> Object<a href=\"/docs/api/optional\"></a> - The page range to print. On macOS, only one range is honored.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>duplexMode</code> String (optional) - Set the duplex mode of the printed web page. Pode ser <code>simplex</code>, <code>shortEdge</code> ou <code>longEdge</code>.</li>\n<li><code>dpi</code> Record&#x3C;string, number> (optional)<ul>\n<li><code>horizontal</code> Number (optional) - The horizontal dpi.</li>\n<li><code>vertical</code> Number (optional) - The vertical dpi.</li>\n</ul></li>\n<li><code>header</code> String (optional) - String to be printed as page header.</li>\n<li><code>footer</code> String (optional) - String to be printed as page footer.</li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the printed document. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code>.</li>\n</ul></li>\n<li><code>callback</code> Function (optional)<ul>\n<li><code>success</code> Boolean - Indicates success of the print call.</li>\n<li><code>failureReason</code> String - Error description called back if the print fails.</li>\n</ul></li>\n</ul>\n<p>When a custom <code>pageSize</code> is passed, Chromium attempts to validate platform specific minimum values for <code>width_microns</code> and <code>height_microns</code>. Width and height must both be minimum 353 microns but may be higher on some operating systems.</p>\n<p>Prints window's web page. When <code>silent</code> is set to <code>true</code>, Electron will pick the system's default printer if <code>deviceName</code> is empty and the default settings for printing.</p>\n<p>Use <code>page-break-before: always;</code> CSS style to force to print to a new page.</p>\n<p>Example usage:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> options = {\n  <span class=\"hljs-attr\">silent</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">deviceName</span>: <span class=\"hljs-string\">'My-Printer'</span>,\n  <span class=\"hljs-attr\">pageRanges</span>: [{\n    <span class=\"hljs-attr\">from</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">to</span>: <span class=\"hljs-number\">1</span>\n  }]\n}\nwin.webContents.print(options, (success, errorType) => {\n  <span class=\"hljs-keyword\">if</span> (!success) <span class=\"hljs-built_in\">console</span>.log(errorType)\n})\n</code></pre>\n<h4 id=\"contentsprinttopdfoptions\"><a href=\"#contentsprinttopdfoptions\"><code>contents.printToPDF(options)</code></a></h4>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>headerFooter</code> Record&#x3C;string, string> (optional) - the header and footer for the PDF.<ul>\n<li><code>title</code> String - The title for the PDF header.</li>\n<li><code>url</code> String - the url for the PDF footer.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - <code>true</code> for landscape, <code>false</code> for portrait.</li>\n<li><code>marginsType</code> Integer (optional) - Specifies the type of margins to use. Uses 0 for default margin, 1 for no margin, and 2 for minimum margin.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page. Can range from 0 to 100.</li>\n<li><code>pageRanges</code> Record&#x3C;string, number> (optional) - The page range to print.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the generated PDF. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code> and <code>width</code> in microns.</li>\n<li><code>printBackground</code> Boolean (optional) - Whether to print CSS backgrounds.</li>\n<li><code>printSelectionOnly</code> Boolean (optional) - Whether to print selection only.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Buffer></code> - Resolves with the generated PDF data.</p>\n<p>Prints window's web page as PDF with Chromium's preview printing custom settings.</p>\n<p>The <code>landscape</code> will be ignored if <code>@page</code> CSS at-rule is used in the web page.</p>\n<p>By default, an empty <code>options</code> will be regarded as:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">marginsType</span>: <span class=\"hljs-number\">0</span>,\n  <span class=\"hljs-attr\">printBackground</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">printSelectionOnly</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">landscape</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">pageSize</span>: <span class=\"hljs-string\">'A4'</span>,\n  <span class=\"hljs-attr\">scaleFactor</span>: <span class=\"hljs-number\">100</span>\n}\n</code></pre>\n<p>Use <code>page-break-before: always;</code> CSS style to force to print to a new page.</p>\n<p>An example of <code>webContents.printToPDF</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n<span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\nwin.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n  <span class=\"hljs-comment\">// Use default printing options</span>\n  win.webContents.printToPDF({}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">data</span> =></span> {\n    <span class=\"hljs-keyword\">const</span> pdfPath = path.join(os.homedir(), <span class=\"hljs-string\">'Desktop'</span>, <span class=\"hljs-string\">'temp.pdf'</span>)\n    fs.writeFile(pdfPath, data, (error) => {\n      <span class=\"hljs-keyword\">if</span> (error) <span class=\"hljs-keyword\">throw</span> error\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Wrote PDF successfully to <span class=\"hljs-subst\">${pdfPath}</span>`</span>)\n    })\n  }).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">error</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Failed to write PDF to <span class=\"hljs-subst\">${pdfPath}</span>: `</span>, error)\n  })\n})\n</code></pre>\n<h4 id=\"contentsaddworkspacepath\"><a href=\"#contentsaddworkspacepath\"><code>contents.addWorkSpace(path)</code></a></h4>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Adds the specified path to DevTools workspace. Must be used after DevTools creation:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.on(<span class=\"hljs-string\">'devtools-opened'</span>, () => {\n  win.webContents.addWorkSpace(__dirname)\n})\n</code></pre>\n<h4 id=\"contentsremoveworkspacepath\"><a href=\"#contentsremoveworkspacepath\"><code>contents.removeWorkSpace(path)</code></a></h4>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Removes the specified path from DevTools workspace.</p>\n<h4 id=\"contentssetdevtoolswebcontentsdevtoolswebcontents\"><a href=\"#contentssetdevtoolswebcontentsdevtoolswebcontents\"><code>contents.setDevToolsWebContents(devToolsWebContents)</code></a></h4>\n<ul>\n<li><code>devToolsWebContents</code> WebContents</li>\n</ul>\n<p>Uses the <code>devToolsWebContents</code> as the target <code>WebContents</code> to show devtools.</p>\n<p>The <code>devToolsWebContents</code> must not have done any navigation, and it should not be used for other purposes after the call.</p>\n<p>By default Electron manages the devtools by creating an internal <code>WebContents</code> with native view, which developers have very limited control of. With the <code>setDevToolsWebContents</code> method, developers can use any <code>WebContents</code> to show the devtools in it, including <code>BrowserWindow</code>, <code>BrowserView</code> and <code>&#x3C;webview></code> tag.</p>\n<p>Note that closing the devtools does not destroy the <code>devToolsWebContents</code>, it is caller's responsibility to destroy <code>devToolsWebContents</code>.</p>\n<p>An example of showing devtools in a <code>&#x3C;webview></code> tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">style</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/css\"</span>></span><span class=\"css\">\n    * { <span class=\"hljs-attribute\">margin</span>: <span class=\"hljs-number\">0</span>; }\n    <span class=\"hljs-selector-id\">#browser</span> { <span class=\"hljs-attribute\">height</span>: <span class=\"hljs-number\">70%</span>; }\n    <span class=\"hljs-selector-id\">#devtools</span> { <span class=\"hljs-attribute\">height</span>: <span class=\"hljs-number\">30%</span>; }\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">style</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"browser\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"devtools\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"about:blank\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n    <span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n    <span class=\"hljs-keyword\">const</span> emittedOnce = <span class=\"hljs-function\">(<span class=\"hljs-params\">element, eventName</span>) =></span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> {\n      element.addEventListener(eventName, event => resolve(event), { <span class=\"hljs-attr\">once</span>: <span class=\"hljs-literal\">true</span> })\n    })\n    <span class=\"hljs-keyword\">const</span> browserView = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'browser'</span>)\n    <span class=\"hljs-keyword\">const</span> devtoolsView = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'devtools'</span>)\n    <span class=\"hljs-keyword\">const</span> browserReady = emittedOnce(browserView, <span class=\"hljs-string\">'dom-ready'</span>)\n    <span class=\"hljs-keyword\">const</span> devtoolsReady = emittedOnce(devtoolsView, <span class=\"hljs-string\">'dom-ready'</span>)\n    <span class=\"hljs-built_in\">Promise</span>.all([browserReady, devtoolsReady]).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      <span class=\"hljs-keyword\">const</span> targetId = browserView.getWebContentsId()\n      <span class=\"hljs-keyword\">const</span> devtoolsId = devtoolsView.getWebContentsId()\n      ipcRenderer.send(<span class=\"hljs-string\">'open-devtools'</span>, targetId, devtoolsId)\n    })\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain, webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'open-devtools'</span>, (event, targetContentsId, devtoolsContentsId) => {\n  <span class=\"hljs-keyword\">const</span> target = webContents.fromId(targetContentsId)\n  <span class=\"hljs-keyword\">const</span> devtools = webContents.fromId(devtoolsContentsId)\n  target.setDevToolsWebContents(devtools)\n  target.openDevTools()\n})\n</code></pre>\n<p>An example of showing devtools in a <code>BrowserWindow</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n<span class=\"hljs-keyword\">let</span> devtools = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  devtools = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  win.webContents.setDevToolsWebContents(devtools.webContents)\n  win.webContents.openDevTools({ <span class=\"hljs-attr\">mode</span>: <span class=\"hljs-string\">'detach'</span> })\n})\n</code></pre>\n<h4 id=\"contentsopendevtoolsoptions\"><a href=\"#contentsopendevtoolsoptions\"><code>contents.openDevTools([options])</code></a></h4>\n<ul>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>mode</code> String - Opens the devtools with specified dock state, can be <code>right</code>, <code>bottom</code>, <code>undocked</code>, <code>detach</code>. Defaults to last used dock state. In <code>undocked</code> mode it's possible to dock back. In <code>detach</code> mode it's not.</li>\n<li><code>activate</code> Boolean (optional) - Whether to bring the opened devtools window to the foreground. O padrão é <code>verdadeiro</code>.</li>\n</ul></li>\n</ul>\n<p>Opens the devtools.</p>\n<p>When <code>contents</code> is a <code>&#x3C;webview></code> tag, the <code>mode</code> would be <code>detach</code> by default, explicitly passing an empty <code>mode</code> can force using last used dock state.</p>\n<h4 id=\"contentsclosedevtools\"><a href=\"#contentsclosedevtools\"><code>contents.closeDevTools()</code></a></h4>\n<p>Closes the devtools.</p>\n<h4 id=\"contentsisdevtoolsopened\"><a href=\"#contentsisdevtoolsopened\"><code>contents.isDevToolsOpened()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the devtools is opened.</p>\n<h4 id=\"contentsisdevtoolsfocused\"><a href=\"#contentsisdevtoolsfocused\"><code>contents.isDevToolsFocused()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the devtools view is focused .</p>\n<h4 id=\"contentstoggledevtools\"><a href=\"#contentstoggledevtools\"><code>contents.toggleDevTools()</code></a></h4>\n<p>Toggles the developer tools.</p>\n<h4 id=\"contentsinspectelementx-y\"><a href=\"#contentsinspectelementx-y\"><code>contents.inspectElement(x, y)</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Starts inspecting element at position (<code>x</code>, <code>y</code>).</p>\n<h4 id=\"contentsinspectsharedworker\"><a href=\"#contentsinspectsharedworker\"><code>contents.inspectSharedWorker()</code></a></h4>\n<p>Opens the developer tools for the shared worker context.</p>\n<h4 id=\"contentsinspectsharedworkerbyidworkerid\"><a href=\"#contentsinspectsharedworkerbyidworkerid\"><code>contents.inspectSharedWorkerById(workerId)</code></a></h4>\n<ul>\n<li><code>workerId</code> String</li>\n</ul>\n<p>Inspects the shared worker based on its ID.</p>\n<h4 id=\"contentsgetallsharedworkers\"><a href=\"#contentsgetallsharedworkers\"><code>contents.getAllSharedWorkers()</code></a></h4>\n<p>Returns <a href=\"/docs/api/structures/shared-worker-info\"><code>SharedWorkerInfo[]</code></a> - Information about all Shared Workers.</p>\n<h4 id=\"contentsinspectserviceworker\"><a href=\"#contentsinspectserviceworker\"><code>contents.inspectServiceWorker()</code></a></h4>\n<p>Opens the developer tools for the service worker context.</p>\n<h4 id=\"contentssendchannel-args\"><a href=\"#contentssendchannel-args\"><code>contents.send(channel, ...args)</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to the renderer process via <code>channel</code>, along with arguments. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>postMessage</code></a>, so prototype chains will not be included. O envio de funções, promessas, símbolos, weakmaps ou WeakSets lançará uma exceção.</p>\n<blockquote>\n<p><strong>NOTE</strong>: Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n</blockquote>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>An example of sending messages from the main process to the renderer process:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// No processo main.</span>\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/index.html`</span>)\n  win.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n    win.webContents.send(<span class=\"hljs-string\">'ping'</span>, <span class=\"hljs-string\">'whoooooooh!'</span>)\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- index.html --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n    <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).ipcRenderer.on(<span class=\"hljs-string\">'ping'</span>, (event, message) => {\n      <span class=\"hljs-built_in\">console</span>.log(message) <span class=\"hljs-comment\">// Prints 'whoooooooh!'</span>\n    })\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<h4 id=\"contentssendtoframeframeid-channel-args\"><a href=\"#contentssendtoframeframeid-channel-args\"><code>contents.sendToFrame(frameId, channel, ...args)</code></a></h4>\n<ul>\n<li><code>frameId</code> Integer | [number, number] - the ID of the frame to send to, or a pair of <code>[processId, frameId]</code> if the frame is in a different process to the main frame.</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to a specific frame in a renderer process via <code>channel</code>, along with arguments. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n</blockquote>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>If you want to get the <code>frameId</code> of a given renderer context you should use the <code>webFrame.routingId</code> value.  Ex.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// In a renderer process</span>\n<span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'My frameId is:'</span>, <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).webFrame.routingId)\n</code></pre>\n<p>You can also read <code>frameId</code> from all incoming IPC messages in the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// In the main process</span>\nipcMain.on(<span class=\"hljs-string\">'ping'</span>, (event) => {\n  <span class=\"hljs-built_in\">console</span>.info(<span class=\"hljs-string\">'Message came from frameId:'</span>, event.frameId)\n})\n</code></pre>\n<h4 id=\"contentspostmessagechannel-message-transfer\"><a href=\"#contentspostmessagechannel-message-transfer\"><code>contents.postMessage(channel, message, [transfer])</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Send a message to the renderer process, optionally transferring ownership of zero or more [<code>MessagePortMain</code>][] objects.</p>\n<p>The transferred <code>MessagePortMain</code> objects will be available in the renderer process by accessing the <code>ports</code> property of the emitted event. When they arrive in the renderer, they will be native DOM <code>MessagePort</code> objects.</p>\n<p>Como por exemplo:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nwebContents.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<h4 id=\"contentsenabledeviceemulationparameters\"><a href=\"#contentsenabledeviceemulationparameters\"><code>contents.enableDeviceEmulation(parameters)</code></a></h4>\n<ul>\n<li>Objeto <code>parameters</code><ul>\n<li><code>screenPosition</code> String - Specify the screen type to emulate (default: <code>desktop</code>):<ul>\n<li><code>desktop</code> - Desktop screen type.</li>\n<li><code>mobile</code> - Mobile screen type.</li>\n</ul></li>\n<li><code>screenSize</code> <a href=\"/docs/api/structures/size\">Size</a> - Set the emulated screen size (screenPosition == mobile).</li>\n<li><code>viewPosition</code> <a href=\"/docs/api/structures/point\">Point</a> - Position the view on the screen (screenPosition == mobile) (default: <code>{ x: 0, y: 0 }</code>).</li>\n<li><code>deviceScaleFactor</code> Integer - Set the device scale factor (if zero defaults to original device scale factor) (default: <code>0</code>).</li>\n<li><code>viewSize</code> <a href=\"/docs/api/structures/size\">Size</a> - Set the emulated view size (empty means no override)</li>\n<li><code>scale</code> Float - Scale of emulated view inside available space (not in fit to view mode) (default: <code>1</code>).</li>\n</ul></li>\n</ul>\n<p>Enable device emulation with the given parameters.</p>\n<h4 id=\"contentsdisabledeviceemulation\"><a href=\"#contentsdisabledeviceemulation\"><code>contents.disableDeviceEmulation()</code></a></h4>\n<p>Disable device emulation enabled by <code>webContents.enableDeviceEmulation</code>.</p>\n<h4 id=\"contentssendinputeventinputevent\"><a href=\"#contentssendinputeventinputevent\"><code>contents.sendInputEvent(inputEvent)</code></a></h4>\n<ul>\n<li><code>inputEvent</code> <a href=\"/docs/api/structures/mouse-input-event\">MouseInputEvent</a> | <a href=\"/docs/api/structures/mouse-wheel-input-event\">MouseWheelInputEvent</a> | <a href=\"/docs/api/structures/keyboard-input-event\">KeyboardInputEvent</a></li>\n</ul>\n<p>Sends an input <code>event</code> to the page. <strong>Note:</strong> The <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> containing the contents needs to be focused for <code>sendInputEvent()</code> to work.</p>\n<h4 id=\"contentsbeginframesubscriptiononlydirty-callback\"><a href=\"#contentsbeginframesubscriptiononlydirty-callback\"><code>contents.beginFrameSubscription([onlyDirty ,]callback)</code></a></h4>\n<ul>\n<li><code>onlyDirty</code> Boolean (optional) - Defaults to <code>false</code>.</li>\n<li><code>callback</code> Function<ul>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a></li>\n<li><code>dirtyRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul></li>\n</ul>\n<p>Begin subscribing for presentation events and captured frames, the <code>callback</code> will be called with <code>callback(image, dirtyRect)</code> when there is a presentation event.</p>\n<p>The <code>image</code> is an instance of <a href=\"/docs/api/native-image\">NativeImage</a> that stores the captured frame.</p>\n<p>The <code>dirtyRect</code> is an object with <code>x, y, width, height</code> properties that describes which part of the page was repainted. If <code>onlyDirty</code> is set to <code>true</code>, <code>image</code> will only contain the repainted area. <code>onlyDirty</code> defaults to <code>false</code>.</p>\n<h4 id=\"contentsendframesubscription\"><a href=\"#contentsendframesubscription\"><code>contents.endFrameSubscription()</code></a></h4>\n<p>End subscribing for frame presentation events.</p>\n<h4 id=\"contentsstartdragitem\"><a href=\"#contentsstartdragitem\"><code>contents.startDrag(item)</code></a></h4>\n<ul>\n<li>Objeto <code>item</code><ul>\n<li><code>file</code> String - The path to the file being dragged.</li>\n<li><code>files</code> String<a href=\"/docs/api/optional\"></a> - The paths to the files being dragged. (<code>files</code> will override <code>file</code> field)</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String - The image must be non-empty on macOS.</li>\n</ul></li>\n</ul>\n<p>Sets the <code>item</code> as dragging item for current drag-drop operation, <code>file</code> is the absolute path of the file to be dragged, and <code>icon</code> is the image showing under the cursor when dragging.</p>\n<h4 id=\"contentssavepagefullpath-savetype\"><a href=\"#contentssavepagefullpath-savetype\"><code>contents.savePage(fullPath, saveType)</code></a></h4>\n<ul>\n<li><code>fullPath</code> String - The full file path.</li>\n<li><code>saveType</code> String - Specify the save type.<ul>\n<li><code>HTMLOnly</code> - Save only the HTML of the page.</li>\n<li><code>HTMLComplete</code> - Save complete-html page.</li>\n<li><code>MHTML</code> - Save complete-html page as MHTML.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves if the page is saved.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\nwin.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  win.webContents.savePage(<span class=\"hljs-string\">'/tmp/test.html'</span>, <span class=\"hljs-string\">'HTMLComplete'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Page was saved successfully.'</span>)\n  }).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(err)\n  })\n})\n</code></pre>\n<h4 id=\"contentsshowdefinitionforselection-no-macos\"><a href=\"#contentsshowdefinitionforselection-no-macos\"><code>contents.showDefinitionForSelection()</code> no <em>macOS</em></a></h4>\n<p>Shows pop-up dictionary that searches the selected word on the page.</p>\n<h4 id=\"contentsisoffscreen\"><a href=\"#contentsisoffscreen\"><code>contents.isOffscreen()</code></a></h4>\n<p>Returns <code>Boolean</code> - Indicates whether <em>offscreen rendering</em> is enabled.</p>\n<h4 id=\"contentsstartpainting\"><a href=\"#contentsstartpainting\"><code>contents.startPainting()</code></a></h4>\n<p>If <em>offscreen rendering</em> is enabled and not painting, start painting.</p>\n<h4 id=\"contentsstoppainting\"><a href=\"#contentsstoppainting\"><code>contents.stopPainting()</code></a></h4>\n<p>If <em>offscreen rendering</em> is enabled and painting, stop painting.</p>\n<h4 id=\"contentsispainting\"><a href=\"#contentsispainting\"><code>contents.isPainting()</code></a></h4>\n<p>Returns <code>Boolean</code> - If <em>offscreen rendering</em> is enabled returns whether it is currently painting.</p>\n<h4 id=\"contentssetframeratefps\"><a href=\"#contentssetframeratefps\"><code>contents.setFrameRate(fps)</code></a></h4>\n<ul>\n<li><code>fps</code> Integer</li>\n</ul>\n<p>If <em>offscreen rendering</em> is enabled sets the frame rate to the specified number. Only values between 1 and 240 are accepted.</p>\n<h4 id=\"contentsgetframerate\"><a href=\"#contentsgetframerate\"><code>contents.getFrameRate()</code></a></h4>\n<p>Returns <code>Integer</code> - If <em>offscreen rendering</em> is enabled returns the current frame rate.</p>\n<h4 id=\"contentsinvalidate\"><a href=\"#contentsinvalidate\"><code>contents.invalidate()</code></a></h4>\n<p>Schedules a full repaint of the window this web contents is in.</p>\n<p>If <em>offscreen rendering</em> is enabled invalidates the frame and generates a new one through the <code>'paint'</code> event.</p>\n<h4 id=\"contentsgetwebrtciphandlingpolicy\"><a href=\"#contentsgetwebrtciphandlingpolicy\"><code>contents.getWebRTCIPHandlingPolicy()</code></a></h4>\n<p>Returns <code>String</code> - Returns the WebRTC IP Handling Policy.</p>\n<h4 id=\"contentssetwebrtciphandlingpolicypolicy\"><a href=\"#contentssetwebrtciphandlingpolicypolicy\"><code>contents.setWebRTCIPHandlingPolicy(policy)</code></a></h4>\n<ul>\n<li><code>policy</code> String - Specify the WebRTC IP Handling Policy.<ul>\n<li><code>default</code> - Exposes user's public and local IPs. This is the default behavior. When this policy is used, WebRTC has the right to enumerate all interfaces and bind them to discover public interfaces.</li>\n<li><code>default_public_interface_only</code> - Exposes user's public IP, but does not expose user's local IP. When this policy is used, WebRTC should only use the default route used by http. This doesn't expose any local addresses.</li>\n<li><code>default_public_and_private_interfaces</code> - Exposes user's public and local IPs. When this policy is used, WebRTC should only use the default route used by http. This also exposes the associated default private address. Default route is the route chosen by the OS on a multi-homed endpoint.</li>\n<li><code>disable_non_proxied_udp</code> - Does not expose public or local IPs. When this policy is used, WebRTC should only use TCP to contact peers or servers unless the proxy server supports UDP.</li>\n</ul></li>\n</ul>\n<p>Setting the WebRTC IP handling policy allows you to control which IPs are exposed via WebRTC. See <a href=\"https://browserleaks.com/webrtc\">BrowserLeaks</a> for more details.</p>\n<h4 id=\"contentsgetosprocessid\"><a href=\"#contentsgetosprocessid\"><code>contents.getOSProcessId()</code></a></h4>\n<p>Returns <code>Integer</code> - The operating system <code>pid</code> of the associated renderer process.</p>\n<h4 id=\"contentsgetprocessid\"><a href=\"#contentsgetprocessid\"><code>contents.getProcessId()</code></a></h4>\n<p>Returns <code>Integer</code> - The Chromium internal <code>pid</code> of the associated renderer. Can be compared to the <code>frameProcessId</code> passed by frame specific navigation events (e.g. <code>did-frame-navigate</code>)</p>\n<h4 id=\"contentstakeheapsnapshotfilepath\"><a href=\"#contentstakeheapsnapshotfilepath\"><code>contents.takeHeapSnapshot(filePath)</code></a></h4>\n<ul>\n<li><code>filePath</code> String - Path to the output file.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Indicates whether the snapshot has been created successfully.</p>\n<p>Takes a V8 heap snapshot and saves it to <code>filePath</code>.</p>\n<h4 id=\"contentsgetbackgroundthrottling\"><a href=\"#contentsgetbackgroundthrottling\"><code>contents.getBackgroundThrottling()</code></a></h4>\n<p>Returns <code>Boolean</code> - whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentssetbackgroundthrottlingallowed\"><a href=\"#contentssetbackgroundthrottlingallowed\"><code>contents.setBackgroundThrottling(allowed)</code></a></h4>\n<ul>\n<li><code>allowed</code> Boolean</li>\n</ul>\n<p>Controls whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentsgettype\"><a href=\"#contentsgettype\"><code>contents.getType()</code></a></h4>\n<p>Returns <code>String</code> - the type of the webContent. Can be <code>backgroundPage</code>, <code>window</code>, <code>browserView</code>, <code>remote</code>, <code>webview</code> or <code>offscreen</code>.</p>\n<h4 id=\"contentssetimageanimationpolicypolicy\"><a href=\"#contentssetimageanimationpolicypolicy\"><code>contents.setImageAnimationPolicy(policy)</code></a></h4>\n<ul>\n<li><code>policy</code> String - Can be <code>animate</code>, <code>animateOnce</code> or <code>noAnimation</code>.</li>\n</ul>\n<p>Sets the image animation policy for this webContents.  The policy only affects <em>new</em> images, existing images that are currently being animated are unaffected. This is a known limitation in Chromium, you can force image animation to be recalculated with <code>img.src = img.src</code> which will result in no network traffic but will update the animation policy.</p>\n<p>This corresponds to the <a href=\"https://developer.chrome.com/docs/extensions/reference/accessibilityFeatures/#property-animationPolicy\">animationPolicy</a> accessibility feature in Chromium.</p>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<h4 id=\"contentsaudiomuted\"><a href=\"#contentsaudiomuted\"><code>contents.audioMuted</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether this page is muted.</p>\n<h4 id=\"contentsuseragent\"><a href=\"#contentsuseragent\"><code>contents.userAgent</code></a></h4>\n<p>A <code>String</code> property that determines the user agent for this web page.</p>\n<h4 id=\"contentszoomlevel\"><a href=\"#contentszoomlevel\"><code>contents.zoomLevel</code></a></h4>\n<p>A <code>Number</code> property that determines the zoom level for this web contents.</p>\n<p>The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. The formula for this is <code>scale := 1.2 ^ level</code>.</p>\n<h4 id=\"contentszoomfactor\"><a href=\"#contentszoomfactor\"><code>contents.zoomFactor</code></a></h4>\n<p>A <code>Number</code> property that determines the zoom factor for this web contents.</p>\n<p>The zoom factor is the zoom percent divided by 100, so 300% = 3.0.</p>\n<h4 id=\"contentsframerate\"><a href=\"#contentsframerate\"><code>contents.frameRate</code></a></h4>\n<p>An <code>Integer</code> property that sets the frame rate of the web contents to the specified number. Only values between 1 and 240 are accepted.</p>\n<p>Only applicable if <em>offscreen rendering</em> is enabled.</p>\n<h4 id=\"contentsid-readonly\"><a href=\"#contentsid-readonly\"><code>contents.id</code> <em>Readonly</em></a></h4>\n<p>A <code>Integer</code> representing the unique ID of this WebContents. Each ID is unique among all <code>WebContents</code> instances of the entire Electron application.</p>\n<h4 id=\"contentssession-readonly\"><a href=\"#contentssession-readonly\"><code>contents.session</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/session\"><code>Session</code></a> used by this webContents.</p>\n<h4 id=\"contentshostwebcontents-readonly\"><a href=\"#contentshostwebcontents-readonly\"><code>contents.hostWebContents</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> instance that might own this <code>WebContents</code>.</p>\n<h4 id=\"contentsdevtoolswebcontents-readonly\"><a href=\"#contentsdevtoolswebcontents-readonly\"><code>contents.devToolsWebContents</code> <em>Readonly</em></a></h4>\n<p>A <code>WebContents | null</code> property that represents the of DevTools <code>WebContents</code> associated with a given <code>WebContents</code>.</p>\n<p><strong>Note:</strong> Users should never store this object because it may become <code>null</code> when the DevTools has been closed.</p>\n<h4 id=\"contentsdebugger-readonly\"><a href=\"#contentsdebugger-readonly\"><code>contents.debugger</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/debugger\"><code>Debugger</code></a> instance for this webContents.</p>\n<h4 id=\"contentsbackgroundthrottling\"><a href=\"#contentsbackgroundthrottling\"><code>contents.backgroundThrottling</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentsmainframe-readonly\"><a href=\"#contentsmainframe-readonly\"><code>contents.mainFrame</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/web-frame-main\"><code>WebFrameMain</code></a> property that represents the top frame of the page's frame hierarchy.</p>",
      "title": "webContents",
      "description": "Render and control web pages."
    },
    "/docs/tutorial/web-embeds": {
      "locale": "pt-BR",
      "slug": "web-embeds",
      "href": "/docs/tutorial/web-embeds",
      "crowdinFileId": "256269",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/web-embeds.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"web-embeds\"><a href=\"#web-embeds\">Web Embeds</a></h1>\n<h2 id=\"visão-geral\"><a href=\"#visão-geral\">Visão Geral</a></h2>\n<p>If you want to embed (third-party) web content in an Electron <code>BrowserWindow</code>, there are three options available to you: <code>&#x3C;iframe></code> tags, <code>&#x3C;webview></code> tags, and <code>BrowserViews</code>. Each one offers slightly different functionality and is useful in different situations. To help you choose between these, this guide explains the differences and capabilities of each option.</p>\n<h3 id=\"iframes\"><a href=\"#iframes\">Iframes</a></h3>\n<p>Iframes no Electron se comportam como em navegadores regulares. An <code>&#x3C;iframe></code> element in your page can show external web pages, provided that their <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP\">Content Security Policy</a> allows it. To limit the number of capabilities of a site in an <code>&#x3C;iframe></code> tag, it is recommended to use the <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox\"><code>sandbox</code> attribute</a> and only allow the capabilities you want to support.</p>\n<h3 id=\"webviews\"><a href=\"#webviews\">WebViews</a></h3>\n<blockquote>\n<p>Important Note: <a href=\"/docs/api/webview-tag#warning\">we do not recommend you to use WebViews</a>, as this tag undergoes dramatic architectural changes that may affect stability of your application. Consider switching to alternatives, like <code>iframe</code> and Electron's <code>BrowserView</code>, or an architecture that avoids embedded content by design.</p>\n</blockquote>\n<p><a href=\"/docs/api/webview-tag\">WebViews</a> are based on Chromium's WebViews and are not explicitly supported by Electron. We do not guarantee that the WebView API will remain available in future versions of Electron. To use <code>&#x3C;webview></code> tags, you will need to set <code>webviewTag</code> to <code>true</code> in the <code>webPreferences</code> of your <code>BrowserWindow</code>.</p>\n<p>WebView is a custom element (<code>&#x3C;webview></code>) that will only work inside Electron. Eles são implementados como um \"iframe fora de processo\". This means that all communication with the <code>&#x3C;webview></code> is done asynchronously using IPC. The <code>&#x3C;webview></code> element has many custom methods and events, similar to <code>webContents</code>, that provide you with greater control over the content.</p>\n<p>Compared to an <code>&#x3C;iframe></code>, <code>&#x3C;webview></code> tends to be slightly slower but offers much greater control in loading and communicating with the third-party content and handling various events.</p>\n<h3 id=\"browserviews\"><a href=\"#browserviews\">BrowserViews</a></h3>\n<p><a href=\"/docs/api/browser-view\">BrowserViews</a> are not a part of the DOM - instead, they are created in and controlled by your Main process. They are simply another layer of web content on top of your existing window. This means that they are completely separate from your own <code>BrowserWindow</code> content and their position is not controlled by the DOM or CSS. Instead, it is controlled by setting the bounds in the Main process.</p>\n<p><code>BrowserViews</code> offer the greatest control over their contents, since they implement the <code>webContents</code> similarly to how the <code>BrowserWindow</code> does it. However, as <code>BrowserViews</code> are not a part of your DOM, but are rather overlaid on top of them, you will have to manage their position manually.</p>",
      "title": "Web Embeds",
      "description": "Important Note: we do not recommend you to use WebViews, as this tag undergoes dramatic architectural changes that may affect stability of your application. Consider switching to alternatives, like iframe and Electron's BrowserView, or an architecture that avoids embedded content by design."
    },
    "/docs/api/web-frame": {
      "locale": "pt-BR",
      "slug": "web-frame",
      "href": "/docs/api/web-frame",
      "crowdinFileId": "256403",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-frame.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webframe\"><a href=\"#webframe\">webFrame</a></h1>\n<blockquote>\n<p>Customize the rendering of the current web page.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#renderer-process\">Renderizador</a></p>\n<p><code>webFrame</code> export of the Electron module is an instance of the <code>WebFrame</code> class representing the top frame of the current <code>BrowserWindow</code>. Sub-frames can be retrieved by certain properties and methods (e.g. <code>webFrame.firstChild</code>).</p>\n<p>An example of zooming current page to 200%.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nwebFrame.setZoomFactor(<span class=\"hljs-number\">2</span>)\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>The <code>WebFrame</code> class has the following instance methods:</p>\n<h3 id=\"webframesetzoomfactorfactor\"><a href=\"#webframesetzoomfactorfactor\"><code>webFrame.setZoomFactor(factor)</code></a></h3>\n<ul>\n<li><code>factor</code> Double - Zoom factor; default is 1.0.</li>\n</ul>\n<p>Changes the zoom factor to the specified factor. Zoom factor is zoom percent divided by 100, so 300% = 3.0.</p>\n<p>The factor must be greater than 0.0.</p>\n<h3 id=\"webframegetzoomfactor\"><a href=\"#webframegetzoomfactor\"><code>webFrame.getZoomFactor()</code></a></h3>\n<p>Returns <code>Number</code> - The current zoom factor.</p>\n<h3 id=\"webframesetzoomlevellevel\"><a href=\"#webframesetzoomlevellevel\"><code>webFrame.setZoomLevel(level)</code></a></h3>\n<ul>\n<li><code>level</code> Number - Zoom level.</li>\n</ul>\n<p>Changes the zoom level to the specified level. The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h3 id=\"webframegetzoomlevel\"><a href=\"#webframegetzoomlevel\"><code>webFrame.getZoomLevel()</code></a></h3>\n<p>Returns <code>Number</code> - The current zoom level.</p>\n<h3 id=\"webframesetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#webframesetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>webFrame.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h3>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>Sets the maximum and minimum pinch-to-zoom level.</p>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom is disabled by default in Electron. To re-enable it, call:</p>\n<pre><code class=\"hljs language-js\">webFrame.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">3</span>)\n</code></pre>\n</blockquote>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom shortcuts are controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem roles in the application Menu. To disable shortcuts, manually <a href=\"/docs/api/menu#examples\">define the Menu</a> and omit zoom roles from the definition.</p>\n</blockquote>\n<h3 id=\"webframesetspellcheckproviderlanguage-provider\"><a href=\"#webframesetspellcheckproviderlanguage-provider\"><code>webFrame.setSpellCheckProvider(language, provider)</code></a></h3>\n<ul>\n<li><code>language</code> String</li>\n<li>Objeto <code>provider</code><ul>\n<li><code>spellCheck</code> Função<ul>\n<li><code>words</code> String[]</li>\n<li><code>callback</code> Function<ul>\n<li><code>misspeltWords</code> String[]</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Sets a provider for spell checking in input fields and text areas.</p>\n<p>If you want to use this method you must disable the builtin spellchecker when you construct the window.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">spellcheck</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\n</code></pre>\n<p>The <code>provider</code> must be an object that has a <code>spellCheck</code> method that accepts an array of individual words for spellchecking. The <code>spellCheck</code> function runs asynchronously and calls the <code>callback</code> function with an array of misspelt words when complete.</p>\n<p>An example of using <a href=\"https://github.com/atom/node-spellchecker\">node-spellchecker</a> as provider:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> spellChecker = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spellchecker'</span>)\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, {\n  spellCheck (words, callback) {\n    setTimeout(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      <span class=\"hljs-keyword\">const</span> spellchecker = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spellchecker'</span>)\n      <span class=\"hljs-keyword\">const</span> misspelled = words.filter(<span class=\"hljs-function\"><span class=\"hljs-params\">x</span> =></span> spellchecker.isMisspelled(x))\n      callback(misspelled)\n    }, <span class=\"hljs-number\">0</span>)\n  }\n})\n</code></pre>\n<h3 id=\"webframeinsertcsscss\"><a href=\"#webframeinsertcsscss\"><code>webFrame.insertCSS(css)</code></a></h3>\n<ul>\n<li><code>css</code> String - CSS source code.</li>\n</ul>\n<p>Returns <code>String</code> - A key for the inserted CSS that can later be used to remove the CSS via <code>webFrame.removeInsertedCSS(key)</code>.</p>\n<p>Injects CSS into the current web page and returns a unique key for the inserted stylesheet.</p>\n<h3 id=\"webframeremoveinsertedcsskey\"><a href=\"#webframeremoveinsertedcsskey\"><code>webFrame.removeInsertedCSS(key)</code></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from <code>webFrame.insertCSS(css)</code>.</p>\n<h3 id=\"webframeinserttexttext\"><a href=\"#webframeinserttexttext\"><code>webFrame.insertText(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Inserts <code>text</code> to the focused element.</p>\n<h3 id=\"webframeexecutejavascriptcode-usergesture-callback\"><a href=\"#webframeexecutejavascriptcode-usergesture-callback\"><code>webFrame.executeJavaScript(code[, userGesture, callback])</code></a></h3>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n<li><code>callback</code> Function (optional) - Called after script has been executed. Unless the frame is suspended (e.g. showing a modal alert), execution will be synchronous and the callback will be invoked before the method returns. For compatibility with an older version of this method, the error parameter is second.<ul>\n<li><code>result</code> Any</li>\n<li>Erro <code>error</code></li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if execution throws or results in a rejected promise.</p>\n<p>Evaluates <code>code</code> in page.</p>\n<p>In the browser window some HTML APIs like <code>requestFullScreen</code> can only be invoked by a gesture from the user. Setting <code>userGesture</code> to <code>true</code> will remove this limitation.</p>\n<h3 id=\"webframeexecutejavascriptinisolatedworldworldid-scripts-usergesture-callback\"><a href=\"#webframeexecutejavascriptinisolatedworldworldid-scripts-usergesture-callback\"><code>webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture, callback])</code></a></h3>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default main world (where content runs), <code>999</code> is the world used by Electron's <code>contextIsolation</code> feature. Accepts values in the range 1..536870911.</li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/web-source\">WebSource[]</a></li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n<li><code>callback</code> Function (optional) - Called after script has been executed. Unless the frame is suspended (e.g. showing a modal alert), execution will be synchronous and the callback will be invoked before the method returns.  For compatibility with an older version of this method, the error parameter is second.<ul>\n<li><code>result</code> Any</li>\n<li>Erro <code>error</code></li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if execution could not start.</p>\n<p>Works like <code>executeJavaScript</code> but evaluates <code>scripts</code> in an isolated context.</p>\n<p>Note that when the execution of script fails, the returned promise will not reject and the <code>result</code> would be <code>undefined</code>. This is because Chromium does not dispatch errors of isolated worlds to foreign worlds.</p>\n<h3 id=\"webframesetisolatedworldinfoworldid-info\"><a href=\"#webframesetisolatedworldinfoworldid-info\"><code>webFrame.setIsolatedWorldInfo(worldId, info)</code></a></h3>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default world, <code>999</code> is the world used by Electrons <code>contextIsolation</code> feature. Chrome extensions reserve the range of IDs in <code>[1 &#x3C;&#x3C; 20, 1 &#x3C;&#x3C; 29)</code>. You can provide any integer here.</li>\n<li>Objeto <code>info</code><ul>\n<li><code>securityOrigin</code> String (optional) - Security origin for the isolated world.</li>\n<li><code>csp</code> String (optional) - Content Security Policy for the isolated world.</li>\n<li><code>name</code> String (optional) - Name for isolated world. Useful in devtools.</li>\n</ul></li>\n</ul>\n<p>Set the security origin, content security policy and name of the isolated world. Note: If the <code>csp</code> is specified, then the <code>securityOrigin</code> also has to be specified.</p>\n<h3 id=\"webframegetresourceusage\"><a href=\"#webframegetresourceusage\"><code>webFrame.getResourceUsage()</code></a></h3>\n<p>Retorna <code>Object</code>:</p>\n<ul>\n<li><code>images</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>cssStyleSheets</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>xslStyleSheets</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>fonts</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>other</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n</ul>\n<p>Returns an object describing usage information of Blink's internal memory caches.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(webFrame.getResourceUsage())\n</code></pre>\n<p>This will generate:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">images</span>: {\n    <span class=\"hljs-attr\">count</span>: <span class=\"hljs-number\">22</span>,\n    <span class=\"hljs-attr\">size</span>: <span class=\"hljs-number\">2549</span>,\n    <span class=\"hljs-attr\">liveSize</span>: <span class=\"hljs-number\">2542</span>\n  },\n  <span class=\"hljs-attr\">cssStyleSheets</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> },\n  <span class=\"hljs-attr\">xslStyleSheets</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> },\n  <span class=\"hljs-attr\">fonts</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> },\n  <span class=\"hljs-attr\">other</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> }\n}\n</code></pre>\n<h3 id=\"webframeclearcache\"><a href=\"#webframeclearcache\"><code>webFrame.clearCache()</code></a></h3>\n<p>Attempts to free memory that is no longer being used (like images from a previous navigation).</p>\n<p>Note that blindly calling this method probably makes Electron slower since it will have to refill these emptied caches, you should only call it if an event in your app has occurred that makes you think your page is actually using less memory (i.e. you have navigated from a super heavy page to a mostly empty one, and intend to stay there).</p>\n<h3 id=\"webframegetframeforselectorselector\"><a href=\"#webframegetframeforselectorselector\"><code>webFrame.getFrameForSelector(selector)</code></a></h3>\n<ul>\n<li><code>selector</code> String - CSS selector for a frame element.</li>\n</ul>\n<p>Returns <code>WebFrame</code> - The frame element in <code>webFrame's</code> document selected by <code>selector</code>, <code>null</code> would be returned if <code>selector</code> does not select a frame or if the frame is not in the current renderer process.</p>\n<h3 id=\"webframefindframebynamename\"><a href=\"#webframefindframebynamename\"><code>webFrame.findFrameByName(name)</code></a></h3>\n<ul>\n<li><code>name</code> String</li>\n</ul>\n<p>Returns <code>WebFrame</code> - A child of <code>webFrame</code> with the supplied <code>name</code>, <code>null</code> would be returned if there's no such frame or if the frame is not in the current renderer process.</p>\n<h3 id=\"webframefindframebyroutingidroutingid\"><a href=\"#webframefindframebyroutingidroutingid\"><code>webFrame.findFrameByRoutingId(routingId)</code></a></h3>\n<ul>\n<li><code>routingId</code> Integer - An <code>Integer</code> representing the unique frame id in the current renderer process. Routing IDs can be retrieved from <code>WebFrame</code> instances (<code>webFrame.routingId</code>) and are also passed by frame specific <code>WebContents</code> navigation events (e.g. <code>did-frame-navigate</code>)</li>\n</ul>\n<p>Returns <code>WebFrame</code> - that has the supplied <code>routingId</code>, <code>null</code> if not found.</p>\n<h3 id=\"webframeiswordmisspelledword\"><a href=\"#webframeiswordmisspelledword\"><code>webFrame.isWordMisspelled(word)</code></a></h3>\n<ul>\n<li><code>word</code> String - The word to be spellchecked.</li>\n</ul>\n<p>Returns <code>Boolean</code> - True if the word is misspelled according to the built in spellchecker, false otherwise. If no dictionary is loaded, always return false.</p>\n<h3 id=\"webframegetwordsuggestionsword\"><a href=\"#webframegetwordsuggestionsword\"><code>webFrame.getWordSuggestions(word)</code></a></h3>\n<ul>\n<li><code>word</code> String - The misspelled word.</li>\n</ul>\n<p>Returns <code>String[]</code> - A list of suggested words for a given word. If the word is spelled correctly, the result will be empty.</p>\n<h2 id=\"propriedades\"><a href=\"#propriedades\">Propriedades</a></h2>\n<h3 id=\"webframetop-readonly\"><a href=\"#webframetop-readonly\"><code>webFrame.top</code> <em>Readonly</em></a></h3>\n<p>A <code>WebFrame | null</code> representing top frame in frame hierarchy to which <code>webFrame</code> belongs, the property would be <code>null</code> if top frame is not in the current renderer process.</p>\n<h3 id=\"webframeopener-readonly\"><a href=\"#webframeopener-readonly\"><code>webFrame.opener</code> <em>Readonly</em></a></h3>\n<p>A <code>WebFrame | null</code> representing the frame which opened <code>webFrame</code>, the property would be <code>null</code> if there's no opener or opener is not in the current renderer process.</p>\n<h3 id=\"webframeparent-readonly\"><a href=\"#webframeparent-readonly\"><code>webFrame.parent</code> <em>Readonly</em></a></h3>\n<p>A <code>WebFrame | null</code> representing parent frame of <code>webFrame</code>, the property would be <code>null</code> if <code>webFrame</code> is top or parent is not in the current renderer process.</p>\n<h3 id=\"webframefirstchild-readonly\"><a href=\"#webframefirstchild-readonly\"><code>webFrame.firstChild</code> <em>Readonly</em></a></h3>\n<p>A <code>WebFrame | null</code> representing the first child frame of <code>webFrame</code>, the property would be <code>null</code> if <code>webFrame</code> has no children or if first child is not in the current renderer process.</p>\n<h3 id=\"webframenextsibling-readonly\"><a href=\"#webframenextsibling-readonly\"><code>webFrame.nextSibling</code> <em>Readonly</em></a></h3>\n<p>A <code>WebFrame | null</code> representing next sibling frame, the property would be <code>null</code> if <code>webFrame</code> is the last frame in its parent or if the next sibling is not in the current renderer process.</p>\n<h3 id=\"webframeroutingid-readonly\"><a href=\"#webframeroutingid-readonly\"><code>webFrame.routingId</code> <em>Readonly</em></a></h3>\n<p>An <code>Integer</code> representing the unique frame id in the current renderer process. Distinct WebFrame instances that refer to the same underlying frame will have the same <code>routingId</code>.</p>",
      "title": "webFrame",
      "description": "Customize the rendering of the current web page."
    },
    "/docs/api/web-frame-main": {
      "locale": "pt-BR",
      "slug": "web-frame-main",
      "href": "/docs/api/web-frame-main",
      "crowdinFileId": "256401",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-frame-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webframemain\"><a href=\"#webframemain\">webFrameMain</a></h1>\n<blockquote>\n<p>Control web pages and iframes.</p>\n</blockquote>\n<p>Processo: <a href=\"/docs/glossary#main-process\">Main</a></p>\n<p>The <code>webFrameMain</code> module can be used to lookup frames across existing <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> instances. Navigation events are the common use case.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, webFrameMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://twitter.com'</span>)\n\nwin.webContents.on(\n  <span class=\"hljs-string\">'did-frame-navigate'</span>,\n  (event, url, isMainFrame, frameProcessId, frameRoutingId) => {\n    <span class=\"hljs-keyword\">const</span> frame = webFrameMain.fromId(frameProcessId, frameRoutingId)\n    <span class=\"hljs-keyword\">if</span> (frame) {\n      <span class=\"hljs-keyword\">const</span> code = <span class=\"hljs-string\">'document.body.innerHTML = document.body.innerHTML.replaceAll(\"heck\", \"h*ck\")'</span>\n      frame.executeJavaScript(code)\n    }\n  }\n)\n</code></pre>\n<p>You can also access frames of existing pages by using the <code>mainFrame</code> property of <a href=\"/docs/api/web-contents\"><code>WebContents</code></a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">main</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  <span class=\"hljs-keyword\">await</span> win.loadURL(<span class=\"hljs-string\">'https://reddit.com'</span>)\n\n  <span class=\"hljs-keyword\">const</span> youtubeEmbeds = win.webContents.mainFrame.frames.filter(<span class=\"hljs-function\">(<span class=\"hljs-params\">frame</span>) =></span> {\n    <span class=\"hljs-keyword\">try</span> {\n      <span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-keyword\">new</span> URL(frame.url)\n      <span class=\"hljs-keyword\">return</span> url.host === <span class=\"hljs-string\">'www.youtube.com'</span>\n    } <span class=\"hljs-keyword\">catch</span> {\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n    }\n  })\n\n  <span class=\"hljs-built_in\">console</span>.log(youtubeEmbeds)\n}\n\nmain()\n</code></pre>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>These methods can be accessed from the <code>webFrameMain</code> module:</p>\n<h3 id=\"webframemainfromidprocessid-routingid\"><a href=\"#webframemainfromidprocessid-routingid\"><code>webFrameMain.fromId(processId, routingId)</code></a></h3>\n<ul>\n<li><code>processId</code> Integer - An <code>Integer</code> representing the internal ID of the process which owns the frame.</li>\n<li><code>routingId</code> Integer - An <code>Integer</code> representing the unique frame ID in the current renderer process. Routing IDs can be retrieved from <code>WebFrameMain</code> instances (<code>frame.routingId</code>) and are also passed by frame specific <code>WebContents</code> navigation events (e.g. <code>did-frame-navigate</code>).</li>\n</ul>\n<p>Returns <code>WebFrameMain | undefined</code> - A frame with the given process and routing IDs, or <code>undefined</code> if there is no WebFrameMain associated with the given IDs.</p>\n<h2 id=\"class-webframemain\"><a href=\"#class-webframemain\">Class: WebFrameMain</a></h2>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"eventos-de-instância\"><a href=\"#eventos-de-instância\">Eventos de instância</a></h3>\n<h4 id=\"event-dom-ready\"><a href=\"#event-dom-ready\">Event: 'dom-ready'</a></h4>\n<p>Emitted when the document is loaded.</p>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<h4 id=\"frameexecutejavascriptcode-usergesture\"><a href=\"#frameexecutejavascriptcode-usergesture\"><code>frame.executeJavaScript(code[, userGesture])</code></a></h4>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;unknown></code> - A promise that resolves with the result of the executed code or is rejected if execution throws or results in a rejected promise.</p>\n<p>Evaluates <code>code</code> in page.</p>\n<p>In the browser window some HTML APIs like <code>requestFullScreen</code> can only be invoked by a gesture from the user. Setting <code>userGesture</code> to <code>true</code> will remove this limitation.</p>\n<h4 id=\"framereload\"><a href=\"#framereload\"><code>frame.reload()</code></a></h4>\n<p>Returns <code>boolean</code> - Whether the reload was initiated successfully. Only results in <code>false</code> when the frame has no history.</p>\n<h4 id=\"framesendchannel-args\"><a href=\"#framesendchannel-args\"><code>frame.send(channel, ...args)</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to the renderer process via <code>channel</code>, along with arguments. Arguments will be serialized with the [Structured Clone Algorithm][SCA], just like [<code>postMessage</code>][], so prototype chains will not be included. O envio de funções, promessas, símbolos, weakmaps ou WeakSets lançará uma exceção.</p>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<h4 id=\"framepostmessagechannel-message-transfer\"><a href=\"#framepostmessagechannel-message-transfer\"><code>frame.postMessage(channel, message, [transfer])</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Send a message to the renderer process, optionally transferring ownership of zero or more [<code>MessagePortMain</code>][] objects.</p>\n<p>The transferred <code>MessagePortMain</code> objects will be available in the renderer process by accessing the <code>ports</code> property of the emitted event. When they arrive in the renderer, they will be native DOM <code>MessagePort</code> objects.</p>\n<p>Como por exemplo:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nwebContents.mainFrame.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<h3 id=\"propriedades-da-instância\"><a href=\"#propriedades-da-instância\">Propriedades da Instância</a></h3>\n<h4 id=\"frameurl-readonly\"><a href=\"#frameurl-readonly\"><code>frame.url</code> <em>Readonly</em></a></h4>\n<p>A <code>string</code> representing the current URL of the frame.</p>\n<h4 id=\"frametop-readonly\"><a href=\"#frametop-readonly\"><code>frame.top</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain | null</code> representing top frame in the frame hierarchy to which <code>frame</code> belongs.</p>\n<h4 id=\"frameparent-readonly\"><a href=\"#frameparent-readonly\"><code>frame.parent</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain | null</code> representing parent frame of <code>frame</code>, the property would be <code>null</code> if <code>frame</code> is the top frame in the frame hierarchy.</p>\n<h4 id=\"frameframes-readonly\"><a href=\"#frameframes-readonly\"><code>frame.frames</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain[]</code> collection containing the direct descendents of <code>frame</code>.</p>\n<h4 id=\"frameframesinsubtree-readonly\"><a href=\"#frameframesinsubtree-readonly\"><code>frame.framesInSubtree</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain[]</code> collection containing every frame in the subtree of <code>frame</code>, including itself. This can be useful when traversing through all frames.</p>\n<h4 id=\"frameframetreenodeid-readonly\"><a href=\"#frameframetreenodeid-readonly\"><code>frame.frameTreeNodeId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the id of the frame's internal FrameTreeNode instance. This id is browser-global and uniquely identifies a frame that hosts content. The identifier is fixed at the creation of the frame and stays constant for the lifetime of the frame. When the frame is removed, the id is not used again.</p>\n<h4 id=\"framename-readonly\"><a href=\"#framename-readonly\"><code>frame.name</code> <em>Readonly</em></a></h4>\n<p>A <code>String</code> representing the frame name.</p>\n<h4 id=\"frameosprocessid-readonly\"><a href=\"#frameosprocessid-readonly\"><code>frame.osProcessId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the operating system <code>pid</code> of the process which owns this frame.</p>\n<h4 id=\"frameprocessid-readonly\"><a href=\"#frameprocessid-readonly\"><code>frame.processId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the Chromium internal <code>pid</code> of the process which owns this frame. This is not the same as the OS process ID; to read that use <code>frame.osProcessId</code>.</p>\n<h4 id=\"frameroutingid-readonly\"><a href=\"#frameroutingid-readonly\"><code>frame.routingId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the unique frame id in the current renderer process. Distinct <code>WebFrameMain</code> instances that refer to the same underlying frame will have the same <code>routingId</code>.</p>\n<h4 id=\"framevisibilitystate-readonly\"><a href=\"#framevisibilitystate-readonly\"><code>frame.visibilityState</code> <em>Readonly</em></a></h4>\n<p>A <code>string</code> representing the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState\">visibility state</a> of the frame.</p>\n<p>See also how the <a href=\"/docs/api/browser-window#page-visibility\">Page Visibility API</a> is affected by other Electron APIs.</p>",
      "title": "webFrameMain",
      "description": "Control web pages and iframes."
    },
    "/docs/api/web-request": {
      "locale": "pt-BR",
      "slug": "web-request",
      "href": "/docs/api/web-request",
      "crowdinFileId": "256405",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-request.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-webrequest\"><a href=\"#class-webrequest\">Class: WebRequest</a></h2>\n<blockquote>\n<p>Intercept and modify the contents of a request at various stages of its lifetime.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Instances of the <code>WebRequest</code> class are accessed by using the <code>webRequest</code> property of a <code>Session</code>.</p>\n<p>The methods of <code>WebRequest</code> accept an optional <code>filter</code> and a <code>listener</code>. The <code>listener</code> will be called with <code>listener(details)</code> when the API's event has happened. The <code>details</code> object describes the request.</p>\n<p>⚠️ Only the last attached <code>listener</code> will be used. Passing <code>null</code> as <code>listener</code> will unsubscribe from the event.</p>\n<p>The <code>filter</code> object has a <code>urls</code> property which is an Array of URL patterns that will be used to filter out the requests that do not match the URL patterns. If the <code>filter</code> is omitted then all requests will be matched.</p>\n<p>For certain events the <code>listener</code> is passed with a <code>callback</code>, which should be called with a <code>response</code> object when <code>listener</code> has done its work.</p>\n<p>An example of adding <code>User-Agent</code> header for requests:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Modify the user agent for all requests to the following urls.</span>\n<span class=\"hljs-keyword\">const</span> filter = {\n  <span class=\"hljs-attr\">urls</span>: [<span class=\"hljs-string\">'https://*.github.com/*'</span>, <span class=\"hljs-string\">'*://electron.github.io'</span>]\n}\n\nsession.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback) => {\n  details.requestHeaders[<span class=\"hljs-string\">'User-Agent'</span>] = <span class=\"hljs-string\">'MyAgent'</span>\n  callback({ <span class=\"hljs-attr\">requestHeaders</span>: details.requestHeaders })\n})\n</code></pre>\n<h3 id=\"métodos-de-instância\"><a href=\"#métodos-de-instância\">Métodos de Instância</a></h3>\n<p>The following methods are available on instances of <code>WebRequest</code>:</p>\n<h4 id=\"webrequestonbeforerequestfilter-listener\"><a href=\"#webrequestonbeforerequestfilter-listener\"><code>webRequest.onBeforeRequest([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Objeto <code>details</code><ul>\n<li><code>id</code> Inteiro</li>\n<li>String <code>url</code></li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (opcional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/upload-data\">UploadData[]</a></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> Object<ul>\n<li><code>cancel</code> Boolean (opcional)</li>\n<li><code>redirectURL</code> String (optional) - The original request is prevented from being sent or completed and is instead redirected to the given URL.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details, callback)</code> when a request is about to occur.</p>\n<p>The <code>uploadData</code> is an array of <code>UploadData</code> objects.</p>\n<p>O <code>callback</code> tem que ser chamado com um objeto <code>response</code>.</p>\n<p>Alguns exemplos de <code>urls</code> válidas:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-string\">'http://foo:1234/'</span>\n<span class=\"hljs-string\">'http://foo.com/'</span>\n<span class=\"hljs-string\">'http://foo:1234/bar'</span>\n<span class=\"hljs-string\">'*://*/*'</span>\n<span class=\"hljs-string\">'*://example.com/*'</span>\n<span class=\"hljs-string\">'*://example.com/foo/*'</span>\n<span class=\"hljs-string\">'http://*.foo:1234/'</span>\n<span class=\"hljs-string\">'file://foo:1234/bar'</span>\n<span class=\"hljs-string\">'http://foo:*/'</span>\n<span class=\"hljs-string\">'*://www.foo.com/'</span>\n</code></pre>\n<h4 id=\"webrequestonbeforesendheadersfilter-listener\"><a href=\"#webrequestonbeforesendheadersfilter-listener\"><code>webRequest.onBeforeSendHeaders([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Objeto <code>details</code><ul>\n<li><code>id</code> Inteiro</li>\n<li>String <code>url</code></li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (opcional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>beforeSendResponse</code> Object<ul>\n<li><code>cancel</code> Boolean (opcional)</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string | string[]> (optional) - When provided, request will be made with these headers.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details, callback)</code> before sending an HTTP request, once the request headers are available. Isto pode ocorrer após uma conexão TCP ser feita ao servidor, mas antes que qualquer dado http seja enviado.</p>\n<p>The <code>callback</code> has to be called with a <code>response</code> object.</p>\n<h4 id=\"webrequestonsendheadersfilter-listener\"><a href=\"#webrequestonsendheadersfilter-listener\"><code>webRequest.onSendHeaders([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Objeto <code>details</code><ul>\n<li><code>id</code> Inteiro</li>\n<li>String <code>url</code></li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (opcional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> just before a request is going to be sent to the server, modifications of previous <code>onBeforeSendHeaders</code> response are visible by the time this listener is fired.</p>\n<h4 id=\"webrequestonheadersreceivedfilter-listener\"><a href=\"#webrequestonheadersreceivedfilter-listener\"><code>webRequest.onHeadersReceived([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Objeto <code>details</code><ul>\n<li><code>id</code> Inteiro</li>\n<li>String <code>url</code></li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (opcional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>statusLine</code> String</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>headersReceivedResponse</code> Object<ul>\n<li><code>cancel</code> Boolean (opcional)</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string | string[]> (optional) - When provided, the server is assumed to have responded with these headers.</li>\n<li><code>statusLine</code> String (optional) - Should be provided when overriding <code>responseHeaders</code> to change header status otherwise original response header's status will be used.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details, callback)</code> when HTTP response headers of a request have been received.</p>\n<p>The <code>callback</code> has to be called with a <code>response</code> object.</p>\n<h4 id=\"webrequestonresponsestartedfilter-listener\"><a href=\"#webrequestonresponsestartedfilter-listener\"><code>webRequest.onResponseStarted([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Objeto <code>details</code><ul>\n<li><code>id</code> Inteiro</li>\n<li>String <code>url</code></li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (opcional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n<li><code>fromCache</code> Boolean - Indicates whether the response was fetched from disk cache.</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when first byte of the response body is received. For HTTP requests, this means that the status line and response headers are available.</p>\n<h4 id=\"webrequestonbeforeredirectfilter-listener\"><a href=\"#webrequestonbeforeredirectfilter-listener\"><code>webRequest.onBeforeRedirect([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Objeto <code>details</code><ul>\n<li><code>id</code> Inteiro</li>\n<li>String <code>url</code></li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (opcional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>redirectURL</code> String</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n<li><code>ip</code> String (optional) - The server IP address that the request was actually sent to.</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when a server initiated redirect is about to occur.</p>\n<h4 id=\"webrequestoncompletedfilter-listener\"><a href=\"#webrequestoncompletedfilter-listener\"><code>webRequest.onCompleted([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Objeto <code>details</code><ul>\n<li><code>id</code> Inteiro</li>\n<li>String <code>url</code></li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (opcional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n<li><code>error</code> String</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when a request is completed.</p>\n<h4 id=\"webrequestonerroroccurredfilter-listener\"><a href=\"#webrequestonerroroccurredfilter-listener\"><code>webRequest.onErrorOccurred([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li>Objeto <code>details</code><ul>\n<li><code>id</code> Inteiro</li>\n<li>String <code>url</code></li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (opcional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>error</code> String - The error description.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when an error occurs.</p>",
      "title": "WebRequest",
      "description": "Intercept and modify the contents of a request at various stages of its lifetime."
    },
    "/docs/api/structures/web-request-filter": {
      "locale": "pt-BR",
      "slug": "web-request-filter",
      "href": "/docs/api/structures/web-request-filter",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/web-request-filter.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"webrequestfilter-object\"><a href=\"#webrequestfilter-object\">WebRequestFilter Object</a></h1>\n<ul>\n<li><code>urls</code> String[] - Array of URL patterns that will be used to filter out the requests that do not match the URL patterns.</li>\n</ul>",
      "title": "WebRequestFilter Object",
      "description": ""
    },
    "/docs/api/structures/web-source": {
      "locale": "pt-BR",
      "slug": "web-source",
      "href": "/docs/api/structures/web-source",
      "crowdinFileId": "256529",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/web-source.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"websource-object\"><a href=\"#websource-object\">WebSource Object</a></h1>\n<ul>\n<li><code>code</code> String</li>\n<li><code>url</code> String (optional)</li>\n<li><code>startLine</code> Integer (optional) - Default is 1.</li>\n</ul>",
      "title": "WebSource Object",
      "description": ""
    },
    "/docs/api/webview-tag": {
      "locale": "pt-BR",
      "slug": "webview-tag",
      "href": "/docs/api/webview-tag",
      "crowdinFileId": "256407",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/webview-tag.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webview-tag\"><a href=\"#webview-tag\"><code>&#x3C;webview></code> Tag</a></h1>\n<h2 id=\"atenção\"><a href=\"#atenção\">Atenção</a></h2>\n<p>Electron's <code>webview</code> tag is based on <a href=\"https://developer.chrome.com/docs/extensions/reference/webviewTag/\">Chromium's <code>webview</code></a>, which is undergoing dramatic architectural changes. This impacts the stability of <code>webviews</code>, including rendering, navigation, and event routing. We currently recommend to not use the <code>webview</code> tag and to consider alternatives, like <code>iframe</code>, <a href=\"/docs/api/browser-view\">Electron's <code>BrowserView</code></a>, or an architecture that avoids embedded content altogether.</p>\n<h2 id=\"enabling\"><a href=\"#enabling\">Enabling</a></h2>\n<p>By default the <code>webview</code> tag is disabled in Electron >= 5.  You need to enable the tag by setting the <code>webviewTag</code> webPreferences option when constructing your <code>BrowserWindow</code>. For more information see the <a href=\"/docs/api/browser-window\">BrowserWindow constructor docs</a>.</p>\n<h2 id=\"visão-geral\"><a href=\"#visão-geral\">Visão Geral</a></h2>\n<blockquote>\n<p>Display external web content in an isolated frame and process.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Use the <code>webview</code> tag to embed 'guest' content (such as web pages) in your Electron app. The guest content is contained within the <code>webview</code> container. An embedded page within your app controls how the guest content is laid out and rendered.</p>\n<p>Unlike an <code>iframe</code>, the <code>webview</code> runs in a separate process than your app. It doesn't have the same permissions as your web page and all interactions between your app and embedded content will be asynchronous. This keeps your app safe from the embedded content. <strong>Note:</strong> Most methods called on the webview from the host page require a synchronous call to the main process.</p>\n<h2 id=\"exemplo\"><a href=\"#exemplo\">Exemplo</a></h2>\n<p>To embed a web page in your app, add the <code>webview</code> tag to your app's embedder page (this is the app page that will display the guest content). In its simplest form, the <code>webview</code> tag includes the <code>src</code> of the web page and css styles that control the appearance of the <code>webview</code> container:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"foo\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"display:inline-flex; width:640px; height:480px\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>If you want to control the guest content in any way, you can write JavaScript that listens for <code>webview</code> events and responds to those events using the <code>webview</code> methods. Here's sample code with two event listeners: one that listens for the web page to start loading, the other for the web page to stop loading, and displays a \"loading...\" message during the load time:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  onload = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\n    <span class=\"hljs-keyword\">const</span> indicator = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'.indicator'</span>)\n\n    <span class=\"hljs-keyword\">const</span> loadstart = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      indicator.innerText = <span class=\"hljs-string\">'loading...'</span>\n    }\n\n    <span class=\"hljs-keyword\">const</span> loadstop = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      indicator.innerText = <span class=\"hljs-string\">''</span>\n    }\n\n    webview.addEventListener(<span class=\"hljs-string\">'did-start-loading'</span>, loadstart)\n    webview.addEventListener(<span class=\"hljs-string\">'did-stop-loading'</span>, loadstop)\n  }\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h2 id=\"internal-implementation\"><a href=\"#internal-implementation\">Internal implementation</a></h2>\n<p>Under the hood <code>webview</code> is implemented with <a href=\"https://www.chromium.org/developers/design-documents/oop-iframes\">Out-of-Process iframes (OOPIFs)</a>. The <code>webview</code> tag is essentially a custom element using shadow DOM to wrap an <code>iframe</code> element inside it.</p>\n<p>So the behavior of <code>webview</code> is very similar to a cross-domain <code>iframe</code>, as examples:</p>\n<ul>\n<li>When clicking into a <code>webview</code>, the page focus will move from the embedder frame to <code>webview</code>.</li>\n<li>You can not add keyboard, mouse, and scroll event listeners to <code>webview</code>.</li>\n<li>All reactions between the embedder frame and <code>webview</code> are asynchronous.</li>\n</ul>\n<h2 id=\"css-styling-notes\"><a href=\"#css-styling-notes\">CSS Styling Notes</a></h2>\n<p>Please note that the <code>webview</code> tag's style uses <code>display:flex;</code> internally to ensure the child <code>iframe</code> element fills the full height and width of its <code>webview</code> container when used with traditional and flexbox layouts. Please do not overwrite the default <code>display:flex;</code> CSS property, unless specifying <code>display:inline-flex;</code> for inline layout.</p>\n<h2 id=\"tag-attributes\"><a href=\"#tag-attributes\">Tag Attributes</a></h2>\n<p>The <code>webview</code> tag has the following attributes:</p>\n<h3 id=\"src\"><a href=\"#src\"><code>src</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> representing the visible URL. Writing to this attribute initiates top-level navigation.</p>\n<p>Assigning <code>src</code> its own value will reload the current page.</p>\n<p>The <code>src</code> attribute can also accept data URLs, such as <code>data:text/plain,Hello, world!</code>.</p>\n<h3 id=\"nodeintegration\"><a href=\"#nodeintegration\"><code>nodeintegration</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://www.google.com/\"</span> <span class=\"hljs-attr\">nodeintegration</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page in <code>webview</code> will have node integration and can use node APIs like <code>require</code> and <code>process</code> to access low level system resources. Node integration is disabled by default in the guest page.</p>\n<h3 id=\"nodeintegrationinsubframes\"><a href=\"#nodeintegrationinsubframes\"><code>nodeintegrationinsubframes</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://www.google.com/\"</span> <span class=\"hljs-attr\">nodeintegrationinsubframes</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code> for the experimental option for enabling NodeJS support in sub-frames such as iframes inside the <code>webview</code>. All your preloads will load for every iframe, you can use <code>process.isMainFrame</code> to determine if you are in the main frame or not. This option is disabled by default in the guest page.</p>\n<h3 id=\"plugins\"><a href=\"#plugins\"><code>plugins</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">plugins</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page in <code>webview</code> will be able to use browser plugins. Plugins are disabled by default.</p>\n<h3 id=\"preload\"><a href=\"#preload\"><code>preload</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- from a file --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">preload</span>=<span class=\"hljs-string\">\"./test.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n<span class=\"hljs-comment\">&#x3C;!-- or if you want to load from an asar archive --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">preload</span>=<span class=\"hljs-string\">\"./app.asar/test.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that specifies a script that will be loaded before other scripts run in the guest page. The protocol of script's URL must be <code>file:</code> (even when using <code>asar:</code> archives) because it will be loaded by Node's <code>require</code> under the hood, which treats <code>asar:</code> archives as virtual directories.</p>\n<p>When the guest page doesn't have node integration this script will still have access to all Node APIs, but global objects injected by Node will be deleted after this script has finished executing.</p>\n<p><strong>Note:</strong> This option will appear as <code>preloadURL</code> (not <code>preload</code>) in the <code>webPreferences</code> specified to the <code>will-attach-webview</code> event.</p>\n<h3 id=\"httpreferrer\"><a href=\"#httpreferrer\"><code>httpreferrer</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">httpreferrer</span>=<span class=\"hljs-string\">\"http://cheng.guru\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the referrer URL for the guest page.</p>\n<h3 id=\"useragent\"><a href=\"#useragent\"><code>useragent</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">useragent</span>=<span class=\"hljs-string\">\"Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the user agent for the guest page before the page is navigated to. Once the page is loaded, use the <code>setUserAgent</code> method to change the user agent.</p>\n<h3 id=\"disablewebsecurity\"><a href=\"#disablewebsecurity\"><code>disablewebsecurity</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">disablewebsecurity</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page will have web security disabled. Web security is enabled by default.</p>\n<h3 id=\"partition\"><a href=\"#partition\"><code>partition</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span> <span class=\"hljs-attr\">partition</span>=<span class=\"hljs-string\">\"persist:github\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://electronjs.org\"</span> <span class=\"hljs-attr\">partition</span>=<span class=\"hljs-string\">\"electron\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the session used by the page. If <code>partition</code> starts with <code>persist:</code>, the page will use a persistent session available to all pages in the app with the same <code>partition</code>. if there is no <code>persist:</code> prefix, the page will use an in-memory session. By assigning the same <code>partition</code>, multiple pages can share the same session. If the <code>partition</code> is unset then default session of the app will be used.</p>\n<p>This value can only be modified before the first navigation, since the session of an active renderer process cannot change. Subsequent attempts to modify the value will fail with a DOM exception.</p>\n<h3 id=\"allowpopups\"><a href=\"#allowpopups\"><code>allowpopups</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">allowpopups</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page will be allowed to open new windows. Popups are disabled by default.</p>\n<h3 id=\"webpreferences\"><a href=\"#webpreferences\"><code>webpreferences</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span> <span class=\"hljs-attr\">webpreferences</span>=<span class=\"hljs-string\">\"allowRunningInsecureContent, javascript=no\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> which is a comma separated list of strings which specifies the web preferences to be set on the webview. The full list of supported preference strings can be found in <a href=\"/docs/api/browser-window#new-browserwindowoptions\">BrowserWindow</a>.</p>\n<p>The string follows the same format as the features string in <code>window.open</code>. A name by itself is given a <code>true</code> boolean value. A preference can be set to another value by including an <code>=</code>, followed by the value. Special values <code>yes</code> and <code>1</code> are interpreted as <code>true</code>, while <code>no</code> and <code>0</code> are interpreted as <code>false</code>.</p>\n<h3 id=\"enableblinkfeatures\"><a href=\"#enableblinkfeatures\"><code>enableblinkfeatures</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">enableblinkfeatures</span>=<span class=\"hljs-string\">\"PreciseMemoryInfo, CSSVariables\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> which is a list of strings which specifies the blink features to be enabled separated by <code>,</code>. The full list of supported feature strings can be found in the <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> file.</p>\n<h3 id=\"disableblinkfeatures\"><a href=\"#disableblinkfeatures\"><code>disableblinkfeatures</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">disableblinkfeatures</span>=<span class=\"hljs-string\">\"PreciseMemoryInfo, CSSVariables\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> which is a list of strings which specifies the blink features to be disabled separated by <code>,</code>. The full list of supported feature strings can be found in the <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> file.</p>\n<h2 id=\"métodos\"><a href=\"#métodos\">Métodos</a></h2>\n<p>The <code>webview</code> tag has the following methods:</p>\n<p><strong>Note:</strong> The webview element must be loaded before using the methods.</p>\n<p><strong>Exemplo</strong></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'dom-ready'</span>, () => {\n  webview.openDevTools()\n})\n</code></pre>\n<h3 id=\"webviewloadurlurl-options\"><a href=\"#webviewloadurlurl-options\"><code>&#x3C;webview>.loadURL(url[, options])</code></a></h3>\n<ul>\n<li><code>url</code> URL</li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (optional) - An HTTP Referrer url.</li>\n<li><code>userAgent</code> String (optional) - A user agent originating the request.</li>\n<li><code>extraHeaders</code> String (optional) - Extra headers separated by \"\\n\"</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified <code>url</code> is a data url and needs to load other files.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - The promise will resolve when the page has finished loading (see <a href=\"/docs/api/webview-tag#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects if the page fails to load (see <a href=\"/docs/api/webview-tag#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Loads the <code>url</code> in the webview, the <code>url</code> must contain the protocol prefix, e.g. the <code>http://</code> or <code>file://</code>.</p>\n<h3 id=\"webviewdownloadurlurl\"><a href=\"#webviewdownloadurlurl\"><code>&#x3C;webview>.downloadURL(url)</code></a></h3>\n<ul>\n<li>String <code>url</code></li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code> without navigating.</p>\n<h3 id=\"webviewgeturl\"><a href=\"#webviewgeturl\"><code>&#x3C;webview>.getURL()</code></a></h3>\n<p>Returns <code>String</code> - The URL of guest page.</p>\n<h3 id=\"webviewgettitle\"><a href=\"#webviewgettitle\"><code>&#x3C;webview>.getTitle()</code></a></h3>\n<p>Returns <code>String</code> - The title of guest page.</p>\n<h3 id=\"webviewisloading\"><a href=\"#webviewisloading\"><code>&#x3C;webview>.isLoading()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether guest page is still loading resources.</p>\n<h3 id=\"webviewisloadingmainframe\"><a href=\"#webviewisloadingmainframe\"><code>&#x3C;webview>.isLoadingMainFrame()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the main frame (and not just iframes or frames within it) is still loading.</p>\n<h3 id=\"webviewiswaitingforresponse\"><a href=\"#webviewiswaitingforresponse\"><code>&#x3C;webview>.isWaitingForResponse()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the guest page is waiting for a first-response for the main resource of the page.</p>\n<h3 id=\"webviewstop\"><a href=\"#webviewstop\"><code>&#x3C;webview>.stop()</code></a></h3>\n<p>Stops any pending navigation.</p>\n<h3 id=\"webviewreload\"><a href=\"#webviewreload\"><code>&#x3C;webview>.reload()</code></a></h3>\n<p>Reloads the guest page.</p>\n<h3 id=\"webviewreloadignoringcache\"><a href=\"#webviewreloadignoringcache\"><code>&#x3C;webview>.reloadIgnoringCache()</code></a></h3>\n<p>Reloads the guest page and ignores cache.</p>\n<h3 id=\"webviewcangoback\"><a href=\"#webviewcangoback\"><code>&#x3C;webview>.canGoBack()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the guest page can go back.</p>\n<h3 id=\"webviewcangoforward\"><a href=\"#webviewcangoforward\"><code>&#x3C;webview>.canGoForward()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the guest page can go forward.</p>\n<h3 id=\"webviewcangotooffsetoffset\"><a href=\"#webviewcangotooffsetoffset\"><code>&#x3C;webview>.canGoToOffset(offset)</code></a></h3>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the guest page can go to <code>offset</code>.</p>\n<h3 id=\"webviewclearhistory\"><a href=\"#webviewclearhistory\"><code>&#x3C;webview>.clearHistory()</code></a></h3>\n<p>Clears the navigation history.</p>\n<h3 id=\"webviewgoback\"><a href=\"#webviewgoback\"><code>&#x3C;webview>.goBack()</code></a></h3>\n<p>Makes the guest page go back.</p>\n<h3 id=\"webviewgoforward\"><a href=\"#webviewgoforward\"><code>&#x3C;webview>.goForward()</code></a></h3>\n<p>Makes the guest page go forward.</p>\n<h3 id=\"webviewgotoindexindex\"><a href=\"#webviewgotoindexindex\"><code>&#x3C;webview>.goToIndex(index)</code></a></h3>\n<ul>\n<li><code>index</code> Integer</li>\n</ul>\n<p>Navigates to the specified absolute index.</p>\n<h3 id=\"webviewgotooffsetoffset\"><a href=\"#webviewgotooffsetoffset\"><code>&#x3C;webview>.goToOffset(offset)</code></a></h3>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Navigates to the specified offset from the \"current entry\".</p>\n<h3 id=\"webviewiscrashed\"><a href=\"#webviewiscrashed\"><code>&#x3C;webview>.isCrashed()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the renderer process has crashed.</p>\n<h3 id=\"webviewsetuseragentuseragent\"><a href=\"#webviewsetuseragentuseragent\"><code>&#x3C;webview>.setUserAgent(userAgent)</code></a></h3>\n<ul>\n<li><code>userAgent</code> String</li>\n</ul>\n<p>Overrides the user agent for the guest page.</p>\n<h3 id=\"webviewgetuseragent\"><a href=\"#webviewgetuseragent\"><code>&#x3C;webview>.getUserAgent()</code></a></h3>\n<p>Returns <code>String</code> - The user agent for guest page.</p>\n<h3 id=\"webviewinsertcsscss\"><a href=\"#webviewinsertcsscss\"><code>&#x3C;webview>.insertCSS(css)</code></a></h3>\n<ul>\n<li><code>css</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - A promise that resolves with a key for the inserted CSS that can later be used to remove the CSS via <code>&#x3C;webview>.removeInsertedCSS(key)</code>.</p>\n<p>Injects CSS into the current web page and returns a unique key for the inserted stylesheet.</p>\n<h3 id=\"webviewremoveinsertedcsskey\"><a href=\"#webviewremoveinsertedcsskey\"><code>&#x3C;webview>.removeInsertedCSS(key)</code></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves if the removal was successful.</p>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from <code>&#x3C;webview>.insertCSS(css)</code>.</p>\n<h3 id=\"webviewexecutejavascriptcode-usergesture\"><a href=\"#webviewexecutejavascriptcode-usergesture\"><code>&#x3C;webview>.executeJavaScript(code[, userGesture])</code></a></h3>\n<ul>\n<li><code>code</code> String</li>\n<li><code>userGesture</code> Boolean (optional) - Default <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if the result of the code is a rejected promise.</p>\n<p>Evaluates <code>code</code> in page. If <code>userGesture</code> is set, it will create the user gesture context in the page. HTML APIs like <code>requestFullScreen</code>, which require user action, can take advantage of this option for automation.</p>\n<h3 id=\"webviewopendevtools\"><a href=\"#webviewopendevtools\"><code>&#x3C;webview>.openDevTools()</code></a></h3>\n<p>Opens a DevTools window for guest page.</p>\n<h3 id=\"webviewclosedevtools\"><a href=\"#webviewclosedevtools\"><code>&#x3C;webview>.closeDevTools()</code></a></h3>\n<p>Closes the DevTools window of guest page.</p>\n<h3 id=\"webviewisdevtoolsopened\"><a href=\"#webviewisdevtoolsopened\"><code>&#x3C;webview>.isDevToolsOpened()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether guest page has a DevTools window attached.</p>\n<h3 id=\"webviewisdevtoolsfocused\"><a href=\"#webviewisdevtoolsfocused\"><code>&#x3C;webview>.isDevToolsFocused()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether DevTools window of guest page is focused.</p>\n<h3 id=\"webviewinspectelementx-y\"><a href=\"#webviewinspectelementx-y\"><code>&#x3C;webview>.inspectElement(x, y)</code></a></h3>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Starts inspecting element at position (<code>x</code>, <code>y</code>) of guest page.</p>\n<h3 id=\"webviewinspectsharedworker\"><a href=\"#webviewinspectsharedworker\"><code>&#x3C;webview>.inspectSharedWorker()</code></a></h3>\n<p>Opens the DevTools for the shared worker context present in the guest page.</p>\n<h3 id=\"webviewinspectserviceworker\"><a href=\"#webviewinspectserviceworker\"><code>&#x3C;webview>.inspectServiceWorker()</code></a></h3>\n<p>Opens the DevTools for the service worker context present in the guest page.</p>\n<h3 id=\"webviewsetaudiomutedmuted\"><a href=\"#webviewsetaudiomutedmuted\"><code>&#x3C;webview>.setAudioMuted(muted)</code></a></h3>\n<ul>\n<li><code>muted</code> Boolean</li>\n</ul>\n<p>Set guest page muted.</p>\n<h3 id=\"webviewisaudiomuted\"><a href=\"#webviewisaudiomuted\"><code>&#x3C;webview>.isAudioMuted()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether guest page has been muted.</p>\n<h3 id=\"webviewiscurrentlyaudible\"><a href=\"#webviewiscurrentlyaudible\"><code>&#x3C;webview>.isCurrentlyAudible()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether audio is currently playing.</p>\n<h3 id=\"webviewundo\"><a href=\"#webviewundo\"><code>&#x3C;webview>.undo()</code></a></h3>\n<p>Executes editing command <code>undo</code> in page.</p>\n<h3 id=\"webviewredo\"><a href=\"#webviewredo\"><code>&#x3C;webview>.redo()</code></a></h3>\n<p>Executes editing command <code>redo</code> in page.</p>\n<h3 id=\"webviewcut\"><a href=\"#webviewcut\"><code>&#x3C;webview>.cut()</code></a></h3>\n<p>Executes editing command <code>cut</code> in page.</p>\n<h3 id=\"webviewcopy\"><a href=\"#webviewcopy\"><code>&#x3C;webview>.copy()</code></a></h3>\n<p>Executes editing command <code>copy</code> in page.</p>\n<h3 id=\"webviewpaste\"><a href=\"#webviewpaste\"><code>&#x3C;webview>.paste()</code></a></h3>\n<p>Executes editing command <code>paste</code> in page.</p>\n<h3 id=\"webviewpasteandmatchstyle\"><a href=\"#webviewpasteandmatchstyle\"><code>&#x3C;webview>.pasteAndMatchStyle()</code></a></h3>\n<p>Executes editing command <code>pasteAndMatchStyle</code> in page.</p>\n<h3 id=\"webviewdelete\"><a href=\"#webviewdelete\"><code>&#x3C;webview>.delete()</code></a></h3>\n<p>Executes editing command <code>delete</code> in page.</p>\n<h3 id=\"webviewselectall\"><a href=\"#webviewselectall\"><code>&#x3C;webview>.selectAll()</code></a></h3>\n<p>Executes editing command <code>selectAll</code> in page.</p>\n<h3 id=\"webviewunselect\"><a href=\"#webviewunselect\"><code>&#x3C;webview>.unselect()</code></a></h3>\n<p>Executes editing command <code>unselect</code> in page.</p>\n<h3 id=\"webviewreplacetext\"><a href=\"#webviewreplacetext\"><code>&#x3C;webview>.replace(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes editing command <code>replace</code> in page.</p>\n<h3 id=\"webviewreplacemisspellingtext\"><a href=\"#webviewreplacemisspellingtext\"><code>&#x3C;webview>.replaceMisspelling(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes editing command <code>replaceMisspelling</code> in page.</p>\n<h3 id=\"webviewinserttexttext\"><a href=\"#webviewinserttexttext\"><code>&#x3C;webview>.insertText(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Retorna <code>Promise&#x3C;void></code></p>\n<p>Inserts <code>text</code> to the focused element.</p>\n<h3 id=\"webviewfindinpagetext-options\"><a href=\"#webviewfindinpagetext-options\"><code>&#x3C;webview>.findInPage(text[, options])</code></a></h3>\n<ul>\n<li><code>text</code> String - Content to be searched, must not be empty.</li>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>forward</code> Boolean (optional) - Whether to search forward or backward, defaults to <code>true</code>.</li>\n<li><code>findNext</code> Boolean (optional) - Whether to begin a new text finding session with this request. Should be <code>true</code> for initial requests, and <code>false</code> for follow-up requests. Defaults to <code>false</code>.</li>\n<li><code>matchCase</code> Boolean (optional) - Whether search should be case-sensitive, defaults to <code>false</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code> - The request id used for the request.</p>\n<p>Starts a request to find all matches for the <code>text</code> in the web page. The result of the request can be obtained by subscribing to <a href=\"/docs/api/webview-tag#event-found-in-page\"><code>found-in-page</code></a> event.</p>\n<h3 id=\"webviewstopfindinpageaction\"><a href=\"#webviewstopfindinpageaction\"><code>&#x3C;webview>.stopFindInPage(action)</code></a></h3>\n<ul>\n<li><code>action</code> String - Specifies the action to take place when ending <a href=\"#webviewfindinpagetext-options\"><code>&#x3C;webview>.findInPage</code></a> request.<ul>\n<li><code>clearSelection</code> - Clear the selection.</li>\n<li><code>keepSelection</code> - Translate the selection into a normal selection.</li>\n<li><code>activateSelection</code> - Focus and click the selection node.</li>\n</ul></li>\n</ul>\n<p>Stops any <code>findInPage</code> request for the <code>webview</code> with the provided <code>action</code>.</p>\n<h3 id=\"webviewprintoptions\"><a href=\"#webviewprintoptions\"><code>&#x3C;webview>.print([options])</code></a></h3>\n<ul>\n<li>Objeto <code>options</code> (opcional)<ul>\n<li><code>silent</code> Boolean (optional) - Don't ask user for print settings. Por padrão é <code>false</code>.</li>\n<li><code>printBackground</code> Boolean (optional) - Prints the background color and image of the web page. Por padrão é <code>false</code>.</li>\n<li><code>deviceName</code> String (optional) - Set the printer device name to use. Must be the system-defined name and not the 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.</li>\n<li><code>color</code> Boolean (optional) - Set whether the printed web page will be in color or grayscale. Por padrão é <code>true</code>.</li>\n<li>Objeto <code>margins</code> (opcional)<ul>\n<li><code>marginType</code> String (optional) - Can be <code>default</code>, <code>none</code>, <code>printableArea</code>, or <code>custom</code>. If <code>custom</code> is chosen, you will also need to specify <code>top</code>, <code>bottom</code>, <code>left</code>, and <code>right</code>.</li>\n<li><code>top</code> Number (optional) - The top margin of the printed web page, in pixels.</li>\n<li><code>bottom</code> Number (optional) - The bottom margin of the printed web page, in pixels.</li>\n<li><code>left</code> Number (optional) - The left margin of the printed web page, in pixels.</li>\n<li><code>right</code> Number (optional) - The right margin of the printed web page, in pixels.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - Whether the web page should be printed in landscape mode. Por padrão é <code>false</code>.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page.</li>\n<li><code>pagesPerSheet</code> Number (optional) - The number of pages to print per page sheet.</li>\n<li><code>collate</code> Boolean (optional) - Whether the web page should be collated.</li>\n<li><code>copies</code> Number (optional) - The number of copies of the web page to print.</li>\n<li><code>pageRanges</code> Object<a href=\"/docs/api/optional\"></a> - The page range to print.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>duplexMode</code> String (optional) - Set the duplex mode of the printed web page. Pode ser <code>simplex</code>, <code>shortEdge</code> ou <code>longEdge</code>.</li>\n<li><code>dpi</code> Record&#x3C;string, number> (optional)<ul>\n<li><code>horizontal</code> Number (optional) - The horizontal dpi.</li>\n<li><code>vertical</code> Number (optional) - The vertical dpi.</li>\n</ul></li>\n<li><code>header</code> String (optional) - String to be printed as page header.</li>\n<li><code>footer</code> String (optional) - String to be printed as page footer.</li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the printed document. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code>.</li>\n</ul></li>\n</ul>\n<p>Retorna <code>Promise&#x3C;void></code></p>\n<p>Prints <code>webview</code>'s web page. Same as <code>webContents.print([options])</code>.</p>\n<h3 id=\"webviewprinttopdfoptions\"><a href=\"#webviewprinttopdfoptions\"><code>&#x3C;webview>.printToPDF(options)</code></a></h3>\n<ul>\n<li><code>options</code> Object<ul>\n<li><code>headerFooter</code> Record&#x3C;string, string> (optional) - the header and footer for the PDF.<ul>\n<li><code>title</code> String - The title for the PDF header.</li>\n<li><code>url</code> String - the url for the PDF footer.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - <code>true</code> for landscape, <code>false</code> for portrait.</li>\n<li><code>marginsType</code> Integer (optional) - Specifies the type of margins to use. Uses 0 for default margin, 1 for no margin, and 2 for minimum margin. and <code>width</code> in microns.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page. Can range from 0 to 100.</li>\n<li><code>pageRanges</code> Record&#x3C;string, number> (optional) - The page range to print. On macOS, only the first range is honored.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the generated PDF. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code></li>\n<li><code>printBackground</code> Boolean (optional) - Whether to print CSS backgrounds.</li>\n<li><code>printSelectionOnly</code> Boolean (optional) - Whether to print selection only.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Uint8Array></code> - Resolves with the generated PDF data.</p>\n<p>Prints <code>webview</code>'s web page as PDF, Same as <code>webContents.printToPDF(options)</code>.</p>\n<h3 id=\"webviewcapturepagerect\"><a href=\"#webviewcapturepagerect\"><code>&#x3C;webview>.capturePage([rect])</code></a></h3>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (optional) - The area of the page to be captured.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - Resolves with a <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Captures a snapshot of the page within <code>rect</code>. Omitting <code>rect</code> will capture the whole visible page.</p>\n<h3 id=\"webviewsendchannel-args\"><a href=\"#webviewsendchannel-args\"><code>&#x3C;webview>.send(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Retorna <code>Promise&#x3C;void></code></p>\n<p>Send an asynchronous message to renderer process via <code>channel</code>, you can also send arbitrary arguments. The renderer process can handle the message by listening to the <code>channel</code> event with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>See <a href=\"/docs/api/web-contents#contentssendchannel-args\">webContents.send</a> for examples.</p>\n<h3 id=\"webviewsendtoframeframeid-channel-args\"><a href=\"#webviewsendtoframeframeid-channel-args\"><code>&#x3C;webview>.sendToFrame(frameId, channel, ...args)</code></a></h3>\n<ul>\n<li><code>frameId</code> [number, number] - <code>[processId, frameId]</code></li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Retorna <code>Promise&#x3C;void></code></p>\n<p>Send an asynchronous message to renderer process via <code>channel</code>, you can also send arbitrary arguments. The renderer process can handle the message by listening to the <code>channel</code> event with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>See <a href=\"/docs/api/web-contents#contentssendtoframeframeid-channel-args\">webContents.sendToFrame</a> for examples.</p>\n<h3 id=\"webviewsendinputeventevent\"><a href=\"#webviewsendinputeventevent\"><code>&#x3C;webview>.sendInputEvent(event)</code></a></h3>\n<ul>\n<li><code>event</code>  <a href=\"/docs/api/structures/mouse-input-event\">MouseInputEvent</a> | <a href=\"/docs/api/structures/mouse-wheel-input-event\">MouseWheelInputEvent</a> | <a href=\"/docs/api/structures/keyboard-input-event\">KeyboardInputEvent</a></li>\n</ul>\n<p>Retorna <code>Promise&#x3C;void></code></p>\n<p>Sends an input <code>event</code> to the page.</p>\n<p>See <a href=\"/docs/api/web-contents#contentssendinputeventinputevent\">webContents.sendInputEvent</a> for detailed description of <code>event</code> object.</p>\n<h3 id=\"webviewsetzoomfactorfactor\"><a href=\"#webviewsetzoomfactorfactor\"><code>&#x3C;webview>.setZoomFactor(factor)</code></a></h3>\n<ul>\n<li><code>factor</code> Number - Zoom factor.</li>\n</ul>\n<p>Changes the zoom factor to the specified factor. Zoom factor is zoom percent divided by 100, so 300% = 3.0.</p>\n<h3 id=\"webviewsetzoomlevellevel\"><a href=\"#webviewsetzoomlevellevel\"><code>&#x3C;webview>.setZoomLevel(level)</code></a></h3>\n<ul>\n<li><code>level</code> Number - Zoom level.</li>\n</ul>\n<p>Changes the zoom level to the specified level. The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. The formula for this is <code>scale := 1.2 ^ level</code>.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h3 id=\"webviewgetzoomfactor\"><a href=\"#webviewgetzoomfactor\"><code>&#x3C;webview>.getZoomFactor()</code></a></h3>\n<p>Returns <code>Number</code> - the current zoom factor.</p>\n<h3 id=\"webviewgetzoomlevel\"><a href=\"#webviewgetzoomlevel\"><code>&#x3C;webview>.getZoomLevel()</code></a></h3>\n<p>Returns <code>Number</code> - the current zoom level.</p>\n<h3 id=\"webviewsetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#webviewsetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>&#x3C;webview>.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h3>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>Retorna <code>Promise&#x3C;void></code></p>\n<p>Sets the maximum and minimum pinch-to-zoom level.</p>\n<h3 id=\"webviewshowdefinitionforselection-macos\"><a href=\"#webviewshowdefinitionforselection-macos\"><code>&#x3C;webview>.showDefinitionForSelection()</code> <em>macOS</em></a></h3>\n<p>Shows pop-up dictionary that searches the selected word on the page.</p>\n<h3 id=\"webviewgetwebcontentsid\"><a href=\"#webviewgetwebcontentsid\"><code>&#x3C;webview>.getWebContentsId()</code></a></h3>\n<p>Returns <code>Number</code> - The WebContents ID of this <code>webview</code>.</p>\n<h2 id=\"dom-events\"><a href=\"#dom-events\">DOM Events</a></h2>\n<p>The following DOM events are available to the <code>webview</code> tag:</p>\n<h3 id=\"event-load-commit\"><a href=\"#event-load-commit\">Event: 'load-commit'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li>String <code>url</code></li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Fired when a load has committed. This includes navigation within the current document as well as subframe document-level loads, but does not include asynchronous resource loads.</p>\n<h3 id=\"event-did-finish-load\"><a href=\"#event-did-finish-load\">Event: 'did-finish-load'</a></h3>\n<p>Fired when the navigation is done, i.e. the spinner of the tab will stop spinning, and the <code>onload</code> event is dispatched.</p>\n<h3 id=\"event-did-fail-load\"><a href=\"#event-did-fail-load\">Event: 'did-fail-load'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>This event is like <code>did-finish-load</code>, but fired when the load failed or was cancelled, e.g. <code>window.stop()</code> is invoked.</p>\n<h3 id=\"event-did-frame-finish-load\"><a href=\"#event-did-frame-finish-load\">Event: 'did-frame-finish-load'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Fired when a frame has done navigation.</p>\n<h3 id=\"event-did-start-loading\"><a href=\"#event-did-start-loading\">Event: 'did-start-loading'</a></h3>\n<p>Corresponds to the points in time when the spinner of the tab starts spinning.</p>\n<h3 id=\"event-did-stop-loading\"><a href=\"#event-did-stop-loading\">Event: 'did-stop-loading'</a></h3>\n<p>Corresponds to the points in time when the spinner of the tab stops spinning.</p>\n<h3 id=\"event-did-attach\"><a href=\"#event-did-attach\">Event: 'did-attach'</a></h3>\n<p>Fired when attached to the embedder web contents.</p>\n<h3 id=\"event-dom-ready\"><a href=\"#event-dom-ready\">Event: 'dom-ready'</a></h3>\n<p>Fired when document in the given frame is loaded.</p>\n<h3 id=\"evento-page-title-updated\"><a href=\"#evento-page-title-updated\">Evento: 'page-title-updated'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>Fired when page title is set during navigation. <code>explicitSet</code> is false when title is synthesized from file url.</p>\n<h3 id=\"evento-page-title-updated-1\"><a href=\"#evento-page-title-updated-1\">Evento: 'page-title-updated'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>favicons</code> String[] - Array de URLs.</li>\n</ul>\n<p>Fired when page receives favicon urls.</p>\n<h3 id=\"evento-enter-html-full-screen\"><a href=\"#evento-enter-html-full-screen\">Evento: 'enter-html-full-screen'</a></h3>\n<p>Fired when page enters fullscreen triggered by HTML API.</p>\n<h3 id=\"evento-leave-html-full-screen\"><a href=\"#evento-leave-html-full-screen\">Evento: 'leave-html-full-screen'</a></h3>\n<p>Fired when page leaves fullscreen triggered by HTML API.</p>\n<h3 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>level</code> Integer - The log level, from 0 to 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>message</code> String - The actual console message</li>\n<li><code>line</code> Integer - The line number of the source that triggered this console message</li>\n<li><code>sourceId</code> String</li>\n</ul>\n<p>Fired when the guest window logs a console message.</p>\n<p>The following example code forwards all log messages to the embedder's console without regard for log level or other properties.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'console-message'</span>, (e) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Guest page logged a message:'</span>, e.message)\n})\n</code></pre>\n<h3 id=\"event-found-in-page\"><a href=\"#event-found-in-page\">Event: 'found-in-page'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>result</code> Object<ul>\n<li><code>requestId</code> Integer</li>\n<li><code>activeMatchOrdinal</code> Integer - Position of the active match.</li>\n<li><code>matches</code> Integer - Number of Matches.</li>\n<li><code>selectionArea</code> Rectangle - Coordinates of first match region.</li>\n<li><code>finalUpdate</code> Boolean</li>\n</ul></li>\n</ul>\n<p>Fired when a result is available for <a href=\"#webviewfindinpagetext-options\"><code>webview.findInPage</code></a> request.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'found-in-page'</span>, (e) => {\n  webview.stopFindInPage(<span class=\"hljs-string\">'keepSelection'</span>)\n})\n\n<span class=\"hljs-keyword\">const</span> requestId = webview.findInPage(<span class=\"hljs-string\">'test'</span>)\n<span class=\"hljs-built_in\">console</span>.log(requestId)\n</code></pre>\n<h3 id=\"evento-new-window\"><a href=\"#evento-new-window\">Evento: 'new-window'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li>String <code>url</code></li>\n<li><code>frameName</code> String</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> and <code>other</code>.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - The options which should be used for creating the new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</li>\n</ul>\n<p>Fired when the guest page attempts to open a new browser window.</p>\n<p>The following example code opens the new url in system's default browser.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\n\nwebview.addEventListener(<span class=\"hljs-string\">'new-window'</span>, <span class=\"hljs-keyword\">async</span> (e) => {\n  <span class=\"hljs-keyword\">const</span> protocol = (<span class=\"hljs-keyword\">new</span> URL(e.url)).protocol\n  <span class=\"hljs-keyword\">if</span> (protocol === <span class=\"hljs-string\">'http:'</span> || protocol === <span class=\"hljs-string\">'https:'</span>) {\n    <span class=\"hljs-keyword\">await</span> shell.openExternal(e.url)\n  }\n})\n</code></pre>\n<h3 id=\"evento-will-navigate\"><a href=\"#evento-will-navigate\">Evento: 'will-navigate'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li>String <code>url</code></li>\n</ul>\n<p>Emitted when a user or the page wants to start navigation. It can happen when the <code>window.location</code> object is changed or a user clicks a link in the page.</p>\n<p>This event will not emit when the navigation is started programmatically with APIs like <code>&#x3C;webview>.loadURL</code> and <code>&#x3C;webview>.back</code>.</p>\n<p>It is also not emitted during in-page navigation, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<p>Calling <code>event.preventDefault()</code> does <strong>NOT</strong> have any effect.</p>\n<h3 id=\"event-did-start-navigation\"><a href=\"#event-did-start-navigation\">Event: 'did-start-navigation'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li>String <code>url</code></li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame (including main) starts navigating. <code>isInPlace</code> will be <code>true</code> for in-page navigations.</p>\n<h3 id=\"event-did-redirect-navigation\"><a href=\"#event-did-redirect-navigation\">Event: 'did-redirect-navigation'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li>String <code>url</code></li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted after a server side redirect occurs during navigation. For example a 302 redirect.</p>\n<h3 id=\"event-did-navigate\"><a href=\"#event-did-navigate\">Event: 'did-navigate'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li>String <code>url</code></li>\n</ul>\n<p>Emitted when a navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h3 id=\"event-did-frame-navigate\"><a href=\"#event-did-frame-navigate\">Event: 'did-frame-navigate'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li>String <code>url</code></li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - empty for non HTTP navigations,</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h3 id=\"event-did-navigate-in-page\"><a href=\"#event-did-navigate-in-page\">Event: 'did-navigate-in-page'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>isMainFrame</code> Boolean</li>\n<li>String <code>url</code></li>\n</ul>\n<p>Emitted when an in-page navigation happened.</p>\n<p>When in-page navigation happens, the page URL changes but does not cause navigation outside of the page. Examples of this occurring are when anchor links are clicked or when the DOM <code>hashchange</code> event is triggered.</p>\n<h3 id=\"evento-close\"><a href=\"#evento-close\">Evento: 'close'</a></h3>\n<p>Fired when the guest page attempts to close itself.</p>\n<p>The following example code navigates the <code>webview</code> to <code>about:blank</code> when the guest attempts to close itself.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'close'</span>, () => {\n  webview.src = <span class=\"hljs-string\">'about:blank'</span>\n})\n</code></pre>\n<h3 id=\"event-ipc-message\"><a href=\"#event-ipc-message\">Event: 'ipc-message'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>frameId</code> [number, number] - pair of <code>[processId, frameId]</code>.</li>\n<li><code>channel</code> String</li>\n<li><code>args</code> any[]</li>\n</ul>\n<p>Fired when the guest page has sent an asynchronous message to embedder page.</p>\n<p>With <code>sendToHost</code> method and <code>ipc-message</code> event you can communicate between guest page and embedder page:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In embedder page.</span>\n<span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'ipc-message'</span>, (event) => {\n  <span class=\"hljs-built_in\">console</span>.log(event.channel)\n  <span class=\"hljs-comment\">// Prints \"pong\"</span>\n})\nwebview.send(<span class=\"hljs-string\">'ping'</span>)\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In guest page.</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcRenderer.on(<span class=\"hljs-string\">'ping'</span>, () => {\n  ipcRenderer.sendToHost(<span class=\"hljs-string\">'pong'</span>)\n})\n</code></pre>\n<h3 id=\"event-crashed\"><a href=\"#event-crashed\">Event: 'crashed'</a></h3>\n<p>Fired when the renderer process is crashed.</p>\n<h3 id=\"event-plugin-crashed\"><a href=\"#event-plugin-crashed\">Event: 'plugin-crashed'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>name</code> String</li>\n<li><code>version</code> String</li>\n</ul>\n<p>Fired when a plugin process is crashed.</p>\n<h3 id=\"event-destroyed\"><a href=\"#event-destroyed\">Event: 'destroyed'</a></h3>\n<p>Fired when the WebContents is destroyed.</p>\n<h3 id=\"event-media-started-playing\"><a href=\"#event-media-started-playing\">Event: 'media-started-playing'</a></h3>\n<p>Emitted when media starts playing.</p>\n<h3 id=\"event-media-paused\"><a href=\"#event-media-paused\">Event: 'media-paused'</a></h3>\n<p>Emitted when media is paused or done playing.</p>\n<h3 id=\"event-did-change-theme-color\"><a href=\"#event-did-change-theme-color\">Event: 'did-change-theme-color'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li><code>themeColor</code> String</li>\n</ul>\n<p>Emitted when a page's theme color changes. This is usually due to encountering a meta tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">'theme-color'</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">'#ff0000'</span>></span>\n</code></pre>\n<h3 id=\"event-update-target-url\"><a href=\"#event-update-target-url\">Event: 'update-target-url'</a></h3>\n<p>Retorna:</p>\n<ul>\n<li>String <code>url</code></li>\n</ul>\n<p>Emitted when mouse moves over a link or the keyboard moves the focus to a link.</p>\n<h3 id=\"event-devtools-opened\"><a href=\"#event-devtools-opened\">Event: 'devtools-opened'</a></h3>\n<p>Emitted when DevTools is opened.</p>\n<h3 id=\"event-devtools-closed\"><a href=\"#event-devtools-closed\">Event: 'devtools-closed'</a></h3>\n<p>Emitted when DevTools is closed.</p>\n<h3 id=\"event-devtools-focused\"><a href=\"#event-devtools-focused\">Event: 'devtools-focused'</a></h3>\n<p>Emitted when DevTools is focused / opened.</p>",
      "title": "<webview> Tag",
      "description": "Display external web content in an isolated frame and process."
    },
    "/docs/api/window-open": {
      "locale": "pt-BR",
      "slug": "window-open",
      "href": "/docs/api/window-open",
      "crowdinFileId": "256409",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/window-open.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"abrindo-janelas-a-partir-do-renderizador\"><a href=\"#abrindo-janelas-a-partir-do-renderizador\">Abrindo janelas a partir do renderizador</a></h1>\n<p>Existem várias maneiras de controlar como as janelas são criadas a partir de conteúdo confiável ou não confiável dentro de um renderizador. Windows can be created from the renderer in two ways:</p>\n<ul>\n<li>clicking on links or submitting forms adorned with <code>target=_blank</code></li>\n<li>JavaScript calling <code>window.open()</code></li>\n</ul>\n<p>For same-origin content, the new window is created within the same process, enabling the parent to access the child window directly. This can be very useful for app sub-windows that act as preference panels, or similar, as the parent can render to the sub-window directly, as if it were a <code>div</code> in the parent. This is the same behavior as in the browser.</p>\n<p>When <code>nativeWindowOpen</code> is set to false, <code>window.open</code> instead results in the creation of a <a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code></a>, a light wrapper around <code>BrowserWindow</code>.</p>\n<p>Electron pairs this native Chrome <code>Window</code> with a BrowserWindow under the hood. You can take advantage of all the customization available when creating a BrowserWindow in the main process by using <code>webContents.setWindowOpenHandler()</code> for renderer-created windows.</p>\n<p>BrowserWindow constructor options are set by, in increasing precedence order: parsed options from the <code>features</code> string from <code>window.open()</code>, security-related webPreferences inherited from the parent, and options given by <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>. Note that <code>webContents.setWindowOpenHandler</code> has final say and full privilege because it is invoked in the main process.</p>\n<h3 id=\"windowopenurl-framename-features\"><a href=\"#windowopenurl-framename-features\"><code>window.open(url[, frameName][, features])</code></a></h3>\n<ul>\n<li>String <code>url</code></li>\n<li><code>frameName</code> String (opcional)</li>\n<li><code>features</code> String (opcional)</li>\n</ul>\n<p>Returns <a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code></a> | <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window\"><code>Window</code></a></p>\n<p><code>features</code> is a comma-separated key-value list, following the standard format of the browser. Electron will parse <code>BrowserWindowConstructorOptions</code> out of this list where possible, for convenience. For full control and better ergonomics, consider using <code>webContents.setWindowOpenHandler</code> to customize the BrowserWindow creation.</p>\n<p>A subset of <code>WebPreferences</code> can be set directly, unnested, from the features string: <code>zoomFactor</code>, <code>nodeIntegration</code>, <code>preload</code>, <code>javascript</code>, <code>contextIsolation</code>, and <code>webviewTag</code>.</p>\n<p>Como por exemplo:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">'https://github.com'</span>, <span class=\"hljs-string\">'_blank'</span>, <span class=\"hljs-string\">'top=500,left=200,frame=false,nodeIntegration=no'</span>)\n</code></pre>\n<p><strong>Notas:</strong></p>\n<ul>\n<li>Node integration will always be disabled in the opened <code>window</code> if it is disabled on the parent window.</li>\n<li>Context isolation will always be enabled in the opened <code>window</code> if it is enabled on the parent window.</li>\n<li>JavaScript will always be disabled in the opened <code>window</code> if it is disabled on the parent window.</li>\n<li>Non-standard features (that are not handled by Chromium or Electron) given in <code>features</code> will be passed to any registered <code>webContents</code>'s <code>did-create-window</code> event handler in the <code>options</code> argument.</li>\n<li><code>frameName</code> follows the specification of <code>windowName</code> located in the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters\">native documentation</a>.</li>\n</ul>\n<p>To customize or cancel the creation of the window, you can optionally set an override handler with <code>webContents.setWindowOpenHandler()</code> from the main process. Returning <code>{ action: 'deny' }</code> cancels the window. Returning <code>{ action: 'allow', overrideBrowserWindowOptions: { ... } }</code> will allow opening the window and setting the <code>BrowserWindowConstructorOptions</code> to be used when creating the window. Note that this is more powerful than passing options through the feature string, as the renderer has more limited privileges in deciding security preferences than the main process.</p>\n<h3 id=\"native-window-example\"><a href=\"#native-window-example\">Native <code>Window</code> example</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// main.js</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-comment\">// In this example, only windows with the `about:blank` url will be created.</span>\n<span class=\"hljs-comment\">// All other urls will be blocked.</span>\nmainWindow.webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (url === <span class=\"hljs-string\">'about:blank'</span>) {\n    <span class=\"hljs-keyword\">return</span> {\n      <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span>,\n      <span class=\"hljs-attr\">overrideBrowserWindowOptions</span>: {\n        <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span>,\n        <span class=\"hljs-attr\">fullscreenable</span>: <span class=\"hljs-literal\">false</span>,\n        <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'black'</span>,\n        <span class=\"hljs-attr\">webPreferences</span>: {\n          <span class=\"hljs-attr\">preload</span>: <span class=\"hljs-string\">'my-child-window-preload-script.js'</span>\n        }\n      }\n    }\n  }\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// renderer process (mainWindow)</span>\n<span class=\"hljs-keyword\">const</span> childWindow = <span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">''</span>, <span class=\"hljs-string\">'modal'</span>)\nchildWindow.document.write(<span class=\"hljs-string\">'&#x3C;h1>Hello&#x3C;/h1>'</span>)\n</code></pre>\n<h3 id=\"browserwindowproxy-example\"><a href=\"#browserwindowproxy-example\"><code>BrowserWindowProxy</code> example</a></h3>\n<pre><code class=\"hljs language-javascript\">\n<span class=\"hljs-comment\">// main.js</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nativeWindowOpen</span>: <span class=\"hljs-literal\">false</span> }\n})\n\nmainWindow.webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (url.startsWith(<span class=\"hljs-string\">'https://github.com/'</span>)) {\n    <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span> }\n  }\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n\nmainWindow.webContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (childWindow) => {\n  <span class=\"hljs-comment\">// For example...</span>\n  childWindow.webContents.on(<span class=\"hljs-string\">'will-navigate'</span>, (e) => {\n    e.preventDefault()\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// renderer.js</span>\n<span class=\"hljs-keyword\">const</span> windowProxy = <span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">'https://github.com/'</span>, <span class=\"hljs-literal\">null</span>, <span class=\"hljs-string\">'minimizable=false'</span>)\nwindowProxy.postMessage(<span class=\"hljs-string\">'hi'</span>, <span class=\"hljs-string\">'*'</span>)\n</code></pre>",
      "title": "Abrindo janelas a partir do renderizador",
      "description": ""
    },
    "/docs/tutorial/windows-arm": {
      "locale": "pt-BR",
      "slug": "windows-arm",
      "href": "/docs/tutorial/windows-arm",
      "crowdinFileId": "256271",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-arm.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"windows-on-arm\"><a href=\"#windows-on-arm\">Windows on ARM</a></h1>\n<p>Se seu aplicativo roda com o Electron 6.0.8 ou superior, agora você pode construí-lo para o Windows 10 no ARM. This considerably improves performance, but requires recompilation of any native modules used in your app. It may also require small fixups to your build and packaging scripts.</p>\n<h2 id=\"executando-um-app-básico\"><a href=\"#executando-um-app-básico\">Executando um app básico</a></h2>\n<p>Se o seu aplicativo não usa nenhum módulo nativo, então é muito mais fácil criar uma versão do ARM do seu aplicativo.</p>\n<ol>\n<li>Certifique-se de que o diretório <code>node_modules</code> do seu app esteja vazio.</li>\n<li>Usando um <em>Prompt de Comando</em>, execute <code>set npm_config_arch=arm64</code> antes de executar <code>npm install</code>/<code>yarn install</code> como de costume.</li>\n<li><a href=\"/docs/tutorial/quick-start#prerequisites\">If you have Electron installed as a development dependency</a>, npm will download and unpack the arm64 version. Você pode então empacotar e distribuir seu aplicativo normalmente.</li>\n</ol>\n<h2 id=\"general-considerations\"><a href=\"#general-considerations\">General considerations</a></h2>\n<h3 id=\"architecture-specific-code\"><a href=\"#architecture-specific-code\">Architecture-specific code</a></h3>\n<p>Lots of Windows-specific code contains if... else logic that selects between either the x64 or x86 architectures.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">if</span> (process.arch === <span class=\"hljs-string\">'x64'</span>) {\n  <span class=\"hljs-comment\">// Do 64-bit thing...</span>\n} <span class=\"hljs-keyword\">else</span> {\n  <span class=\"hljs-comment\">// Do 32-bit thing...</span>\n}\n</code></pre>\n<p>Se você quiser o arm64 como arquitetura de destino, uma lógica como essa normalmente vai selecionar a arquitetura errada, então verifique com muita atenção o seu aplicativo e seus scripts de compilação em busca de condições como essa. Em scripts de compilação e empacotamento personalizados, você sempre deve verificar o valor de <code>npm_config_arch</code> no ambiente, em vez de depender da arquitetura no processo atual.</p>\n<h3 id=\"módulos-nativos\"><a href=\"#módulos-nativos\">Módulos nativos</a></h3>\n<p>If you use native modules, you must make sure that they compile against v142 of the MSVC compiler (provided in Visual Studio 2017). You must also check that any pre-built <code>.dll</code> or <code>.lib</code> files provided or referenced by the native module are available for Windows on Arm.</p>\n<h3 id=\"testando-seu-aplicativo\"><a href=\"#testando-seu-aplicativo\">Testando seu aplicativo</a></h3>\n<p>Para testar seu aplicativo, use um dispositivo ARM executando o Windows 10 ARM (versão 1903 ou mais tarde). Certifique-se de copiar seu aplicativo para o dispositivo de destino - a sandbox do Chromium não funcionará corretamente ao carregar seus recursos de aplicativo a partir de um local de rede.</p>\n<h2 id=\"development-prerequisites\"><a href=\"#development-prerequisites\">Development prerequisites</a></h2>\n<h3 id=\"nodejsnode-gyp\"><a href=\"#nodejsnode-gyp\">Node.js/node-gyp</a></h3>\n<p><a href=\"https://nodejs.org/en/\">Recomenda-se o Node.js v12.9.0 ou posterior.</a> Se atualizar para uma nova versão do Node não for desejável, em vez disso, <a href=\"https://github.com/nodejs/node-gyp/wiki/Updating-npm&#x27;s-bundled-node-gyp\">atualize a cópia do npm do node-gyp manualmente</a> para a versão 5.0.2 ou posterior, que contém as alterações necessárias para compilar módulos nativos para ARM.</p>\n<h3 id=\"visual-studio-2017\"><a href=\"#visual-studio-2017\">Visual Studio 2017</a></h3>\n<p>O Visual Studio 2017 (qualquer edição) é necessário para a compilação de módulos nativos. Você pode baixar o Visual Studio Community 2017 através do <a href=\"https://visualstudio.microsoft.com/dev-essentials/\">programa Visual Studio Dev Essentials</a> da Microsoft. Após a instalação, você pode adicionar os componentes específicos do ARM executando o seguinte comando a partir de um <em>Prompt de Comando</em>:</p>\n<pre><code class=\"hljs language-powershell\">vs_installer.exe ^\n--add Microsoft.VisualStudio.Workload.NativeDesktop ^\n--add Microsoft.VisualStudio.Component.VC.ATLMFC ^\n--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ^\n--add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ^\n--includeRecommended\n</code></pre>\n<h4 id=\"criando-um-prompt-de-comando-para-compilação-cruzada\"><a href=\"#criando-um-prompt-de-comando-para-compilação-cruzada\">Criando um prompt de comando para compilação cruzada</a></h4>\n<p>Definir <code>npm_config_arch=arm64</code> no ambiente cria os arquivos <code>.obj</code> corretos para arm64, mas o <em>Prompt de Comando do Desenvolvedor para VS 2017</em> padrão utilizará o vinculador x64. Para corrigir isto:</p>\n<ol>\n<li>Duplique o atalho do <em>Prompt de Comando de Ferramentas Cruzadas do x86_x64 para VS 2017</em> (por exemplo, ao localizá-lo no menu iniciar, clique com o botão direito, selecione <em>Abrir local do arquivo</em>, copie e cole) para algum lugar conveniente.</li>\n<li>Clique com o botão direito no novo atalho e clique em <em>Propriedades</em>.</li>\n<li>Altere o campo <em>Destino</em> para que o final dele seja <code>vcvarsamd64_arm64.bat</code> ao invés de <code>vcvarsamd64_x86.bat</code>.</li>\n</ol>\n<p>Se feito com sucesso, o prompt de comando deverá imprimir algo semelhante a isso na inicialização:</p>\n<pre><code class=\"hljs language-bat\">**********************************************************************\n** Visual Studio <span class=\"hljs-number\">2017</span> Developer Command Prompt v15.<span class=\"hljs-number\">9</span>.<span class=\"hljs-number\">15</span>\n** Copyright (c) <span class=\"hljs-number\">2017</span> Microsoft Corporation\n**********************************************************************\n[vcvarsall.bat] Environment initialized <span class=\"hljs-keyword\">for</span>: 'x64_arm64'\n</code></pre>\n<p>Se você deseja desenvolver seu aplicativo diretamente em um dispositivo do Arm, substitua <code>vcvarsx86_arm64.bat</code> no <em>Destino</em> para que a compilação cruzada ocorra com a emulação x86 do dispositivo.</p>\n<h3 id=\"vinculando-com-o-nodelib-correto\"><a href=\"#vinculando-com-o-nodelib-correto\">Vinculando com o <code>node.lib</code> correto</a></h3>\n<p>By default, <code>node-gyp</code> unpacks Electron's node headers and downloads the x86 and x64 versions of <code>node.lib</code> into <code>%APPDATA%\\..\\Local\\node-gyp\\Cache</code>, but it does not download the arm64 version (<a href=\"https://github.com/nodejs/node-gyp/pull/1875\">a fix for this is in development</a>.) Para corrigir isto:</p>\n<ol>\n<li>Baixe a versão arm64 do <code>node.lib</code> de <a href=\"https://electronjs.org/headers/v6.0.9/win-arm64/node.lib\">https://electronjs.org/headers/v6.0.9/win-arm64/node.lib</a></li>\n<li>Mova-a para <code>%APPDATA%\\..\\Local\\node-gyp\\Cache\\6.0.9\\arm64\\node.lib</code></li>\n</ol>\n<p>Substitua <code>6.0.9</code> pela versão que você está usando.</p>\n<h2 id=\"compilação-cruzada-de-módulos-nativos\"><a href=\"#compilação-cruzada-de-módulos-nativos\">Compilação cruzada de módulos nativos</a></h2>\n<p>Depois de completar tudo acima, abra o seu prompt de comando de compilação cruzada e execute <code>set npm_config_arch=arm64</code>. Então use o <code>npm install</code> para construir seu projeto normalmente. Como com a compilação cruzada de módulos x86, você pode precisar excluir a pasta <code>node_modules</code> para forçar a recompilação de módulos nativos se eles tiverem sido compilados anteriormente para outra arquitetura.</p>\n<h2 id=\"depurando-módulos-nativos\"><a href=\"#depurando-módulos-nativos\">Depurando módulos nativos</a></h2>\n<p>Módulos nativos podem ser depurados com o Visual Studio 2017 (funcionando na sua máquina de desenvolvimento) e o <a href=\"https://docs.microsoft.com/en-us/visualstudio/debugger/remote-debugging-cpp?view=vs-2019\">depurador remoto do Visual Studio</a> correspondente rodando no dispositivo de destino. Para depurar:</p>\n<ol>\n<li>Launch your app <code>.exe</code> on the target device via the <em>Command Prompt</em> (passing <code>--inspect-brk</code> to pause it before any native modules are loaded).</li>\n<li>Inicie o Visual Studio 2017 em sua máquina de desenvolvimento.</li>\n<li>Connect to the target device by selecting <em>Debug > Attach to Process...</em> and enter the device's IP address and the port number displayed by the Visual Studio Remote Debugger tool.</li>\n<li>Clique em <em>Atualizar</em> e selecione o <a href=\"/docs/development/debug-instructions-windows\">processo do Electron apropriado para anexar</a>.</li>\n<li>You may need to make sure that any symbols for native modules in your app are loaded correctly. To configure this, head to <em>Debug > Options...</em> in Visual Studio 2017, and add the folders containing your <code>.pdb</code> symbols under <em>Debugging > Symbols</em>.</li>\n<li>Uma vez anexados, defina quaisquer pontos de interrupção apropriados e retome a execução do JavaScript usando as <a href=\"/docs/tutorial/debugging-main-process\">ferramentas remotas do Chrome para o Node</a>.</li>\n</ol>\n<h2 id=\"getting-additional-help\"><a href=\"#getting-additional-help\">Getting additional help</a></h2>\n<p>Se você encontrar um problema com esta documentação, ou se seu aplicativo funciona quando compilado para x86, mas não para arm64, por favor <a href=\"/docs/development/issues\">registre um problema</a> com \"Windows on Arm\" no título.</p>",
      "title": "Windows on ARM",
      "description": ""
    },
    "/docs/tutorial/windows-store-guide": {
      "locale": "pt-BR",
      "slug": "windows-store-guide",
      "href": "/docs/tutorial/windows-store-guide",
      "crowdinFileId": "256273",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-store-guide.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"guia-para-windows-store\"><a href=\"#guia-para-windows-store\">Guia para Windows Store</a></h1>\n<p>Com o Windows 10, o bom e velho executável win32 ganhou uma nova irmã: A Plataforma Universal do Windows. O novo formato <code>.appx</code> não apenas disponibiliza várias APIs poderosas como Cortana e Notificações Push, mas através da Windows Store, também simplifica a instalação e atualização das aplicações.</p>\n<p>A Microsoft <a href=\"https://github.com/catalystcode/electron-windows-store\">desenvolveu uma ferramenta que compila aplicações Electron em formato <code>.appx</code></a>, possibilitando que desenvolvedores utilizem algumas das facilidades no novo modelo de aplicação. Este modelo explica como utilizá-lo e quais as capacidades e limitações de uma aplicação Electron AppX.</p>\n<h2 id=\"contexto-e-requisitos\"><a href=\"#contexto-e-requisitos\">Contexto e Requisitos</a></h2>\n<p>A \"Atualização de Aniversário\" do Windows 10 é capaz de rodar binários win32 <code>.exe</code> os executando juntamente com um sistema de arquivos e de registros virtualizados. Ambos são criados durante a compilação ao executar a aplicação e o instalador dentro de um Container Windows, permitindo que o Windows identifique exatamente quais modificações ao sistema operacional são realizadas durante a instalação. Parear o executável com um sistema de arquivos e de registros virtualizados permite com que o Windows habilite a instalação e desinstalação de um clique.</p>\n<p>Adicionalmente, o exe é executado dentro do modelo appx, ou seja, ele pode utilizar muitas das APIs disponívels para a Plataforma Universal do Windows. Para ganhar ainda mais recursos, uma aplicação Electron pode parear com um processo em segundo plano da UWP (Plataforma Universal do Windows), que é executado juntamente com o <code>exe</code>, ou seja, uma espécie de ajudante para rodar processos em segundo plano, receber notificações push ou para se comunicar com outras aplicações UWP.</p>\n<p>Para compilar qualquer aplicação Electron já existente, certifique-se de que você está de acordo com os seguintes requisitos:</p>\n<ul>\n<li>Atualização de Aniversário do Windows 10 (lançada em 2 de agosto de 2016)</li>\n<li>SDK do Windows 10, <a href=\"https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk\">disponível para download aqui</a></li>\n<li>Pelo menos Node na versão 4 (para verificar, execute o comando <code>node -v</code>)</li>\n</ul>\n<p>Então, instale o <code>electron-windows-store</code> CLI:</p>\n<pre><code class=\"hljs language-sh\">npm install -g electron-windows-store\n</code></pre>\n<h2 id=\"etapa-1-empacotar-sua-aplicação-electron\"><a href=\"#etapa-1-empacotar-sua-aplicação-electron\">Etapa 1: Empacotar sua aplicação Electron</a></h2>\n<p>Empacote a aplicação utilizando <a href=\"https://github.com/electron/electron-packager\">electron-packager</a> (ou uma ferramenta similar). Make sure to remove <code>node_modules</code> that you don't need in your final application, since any module you don't actually need will increase your application's size.</p>\n<p>A saída deve ser algo mais ou menos assim:</p>\n<pre><code class=\"hljs language-plaintext\">├── Ghost.exe\n├── LICENSE\n├── content_resources_200_percent.pak\n├── content_shell.pak\n├── d3dcompiler_47.dll\n├── ffmpeg.dll\n├── icudtl.dat\n├── libEGL.dll\n├── libGLESv2.dll\n├── locales\n│   ├── am.pak\n│   ├── ar.pak\n│   ├── [...]\n├── node.dll\n├── resources\n│   └── app.asar\n├── v8_context_snapshot.bin\n├── squirrel.exe\n└── ui_resources_200_percent.pak\n</code></pre>\n<h2 id=\"etapa-2-executando-o-electron-windows-store\"><a href=\"#etapa-2-executando-o-electron-windows-store\">Etapa 2: Executando o electron-windows-store</a></h2>\n<p>Abra o PowerShell em modo de administrador e execute <code>electron-windows-store</code> com os parâmetros necessários, informando tanto o diretório de origem quanto o diretório de destino, o nome da aplicação, sua versão e a confirmação de que os <code>node_modules</code> devem estar achatados.</p>\n<pre><code class=\"hljs language-powershell\">electron-windows-store `\n    --input-directory C:\\myelectronapp `\n    --output-directory C:\\output\\myelectronapp `\n    --package-version <span class=\"hljs-number\">1.0</span>.<span class=\"hljs-number\">0.0</span> `\n    --package-name myelectronapp\n</code></pre>\n<p>Assim que executada, a ferramenta faz seu trabalho: Ela aceita sua aplicação Electron como entrada, achatando os <code>node_modules</code>. Então, ela empacota sua aplicação como <code>app.zip</code>. Utilizando um instalador e um container Windows, a ferramenta cria um pacote AppX \"expandido\" - incluindo o Manifesto de Aplicação Windows (<code>AppXManifest.xml</code>), assim como o sistema de arquivos e sistema de registros virtual dentro da pasta de destino.</p>\n<p>Assim que os arquivos AppX expandidos são criados, a ferramente utiliza o Windows App Packager (<code>MakeAppx.exe</code>) para criar um arquivo AppX único baseado em aqueles arquivos no disco. Finalmente, a ferramenta pode ser utilizada para criar um certificado confiável em seu computador para assinar a nova aplicação AppX. Com a aplicação AppX assinada, o CLI pode também instalar automaticamente a mesma em sua máquina.</p>\n<h2 id=\"etapa-3-utilizando-a-aplicação-appx\"><a href=\"#etapa-3-utilizando-a-aplicação-appx\">Etapa 3: Utilizando a aplicação AppX</a></h2>\n<p>Para conseguir executar sua aplicação, seus usuários precisarão do Windows 10 com sua então chamada \"Atualização de Aniversário\" - detalhes em como atualizar o Windows podem ser encontrados <a href=\"https://blogs.windows.com/windowsexperience/2016/08/02/how-to-get-the-windows-10-anniversary-update\">aqui</a>.</p>\n<p>Ao contrário de aplicações UWP tradicionais, aplicações empacotadas deverão seguir um processo de verificação manual, em qual você pode se increver <a href=\"https://developer.microsoft.com/en-us/windows/projects/campaigns/desktop-bridge\">aqui</a>. In the meantime, all users will be able to install your package by double-clicking it, so a submission to the store might not be necessary if you're looking for an easier installation method. Em ambientes gerenciados (geralmente empresas) o <code>Add-AppxPackage</code>, que é um <a href=\"https://technet.microsoft.com/en-us/library/hh856048.aspx\">Cmdlet do PowerShell, pode ser utilizado para instalá-lo de uma forma automatizada</a>.</p>\n<p>Outra limitação importante é que a aplicação AppX compilada contém um executável win32 - e, portanto, não pode ser executado no Xbox, Hololens ou smartphones.</p>\n<h2 id=\"opcional-adicionar-recursos-uwp-utilizando-uma-backgroundtask\"><a href=\"#opcional-adicionar-recursos-uwp-utilizando-uma-backgroundtask\">Opcional: Adicionar recursos UWP utilizando uma BackgroundTask</a></h2>\n<p>Você pode parear sua aplicação Electron com um processo UWP em segundo plano, esta, pode fazer pleno uso dos recursos do Windows 10 - como notificações em push, Cortana ou Live Tiles.</p>\n<p>Para verificar como uma aplicação Electron utiliza um processo em segundo plano para enviar notificações e Live Tiles, <a href=\"https://github.com/felixrieseberg/electron-uwp-background\">confira a amostra fornecida pela própria Microsoft</a>.</p>\n<h2 id=\"opcional-converter-utilizando-virtualização-de-container\"><a href=\"#opcional-converter-utilizando-virtualização-de-container\">Opcional: Converter utilizando virtualização de Container</a></h2>\n<p>Para gerar a aplicação AppX, o <code>electron-windows-store</code> CLI utiliza um template que deve funcionar para a maioria das aplicações Electron. De qualquer maneira, se você estiver utilizando um instalador customizado ou você tiver algum problema com o pacote gerado, você pode tentar criar um pacote utilizando compilação com um Container Windows. Neste modo, o CLI irá instalar e rodar sua aplicação em um Container Windows cru para determinar quais modificações sua aplicação sua aplicação esta fazendo no sistema operacional.</p>\n<p>Antes de executar o CLI pela primeira vez, você deverá configurar o \"Windows Desktop App Converter\". Isso deverá levar alguns minutos, mas não se preocupe - você só terá de fazer isso uma vez. Faça o Download do Desktop App Converter <a href=\"https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-run-desktop-app-converter\">aqui</a>. Você receberá dois arquivos: <code>DesktopAppConverter.zip</code> e <code>BaseImage-14316.wim</code>.</p>\n<ol>\n<li>Descompacte <code>DesktopAppConverter.zip</code>. De um PowerShell com poderes administrativos (aberto com \"executar como Administrador\", certifique-se de que a política de execução do seu sistema nos permita executar tudo que temos a intenção chamando <code>Set-ExecutionPolicybypass</code>.</li>\n<li>Então, execute a instação do Desktop App Converter, passando a localização da Windows Base Image (baixada como <code>BaseImage-14316.wim</code>), chamando <code>.\\DesktopAppConverter.ps1-Setup-BaseImage.\\BaseImage-14316.wim</code>.</li>\n<li>Se, ao executar o comando acima, seja requisitado reiniciar o computador, reinicie e execute o comando novamente após o computador reiniciar.</li>\n</ol>\n<p>Assim que instalação estiver bem sucedida, você pode seguir e compilar sua aplicação Electron.</p>",
      "title": "Guia para Windows Store",
      "description": ""
    },
    "/docs/tutorial/windows-taskbar": {
      "locale": "pt-BR",
      "slug": "windows-taskbar",
      "href": "/docs/tutorial/windows-taskbar",
      "crowdinFileId": "256275",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-taskbar.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"taskbar-customization-windows\"><a href=\"#taskbar-customization-windows\">Taskbar Customization (Windows)</a></h1>\n<h2 id=\"visão-geral\"><a href=\"#visão-geral\">Visão Geral</a></h2>\n<p>O Electron possui APIs para a configuração do ícone do aplicativo na barra de tarefas do Windows. This API supports both Windows-only features like <a href=\"#jumplist\">creation of a <code>JumpList</code></a>, <a href=\"#thumbnail-toolbars\">custom thumbnails and toolbars</a>, <a href=\"#icon-overlays-in-taskbar\">icon overlays</a>, and the so-called <a href=\"#flash-frame\">\"Flash Frame\" effect</a>, and cross-platform features like <a href=\"/docs/tutorial/recent-documents\">recent documents</a> and <a href=\"/docs/tutorial/progress-bar\">application progress</a>.</p>\n<h2 id=\"jumplist\"><a href=\"#jumplist\">JumpList</a></h2>\n<p>Windows allows apps to define a custom context menu that shows up when users right-click the app's icon in the taskbar. Esse menu de contexto é chamado <code>JumpList</code>. You specify custom actions in the <code>Tasks</code> category of JumpList, as quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#tasks\">MSDN</a>:</p>\n<blockquote>\n<p>Aplicativos definem tarefas com base em recursos do programa e as principais coisas que um usuário espera fazer com eles. Tasks should be context-free, in that the application does not need to be running for them to work. They should also be the statistically most common actions that a normal user would perform in an application, such as compose an email message or open the calendar in a mail program, create a new document in a word processor, launch an application in a certain mode, or launch one of its subcommands. An application should not clutter the menu with advanced features that standard users won't need or one-time actions such as registration. Do not use tasks for promotional items such as upgrades or special offers.</p>\n<p>It is strongly recommended that the task list be static. It should remain the same regardless of the state or status of the application. While it is possible to vary the list dynamically, you should consider that this could confuse the user who does not expect that portion of the destination list to change.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420539.png\" alt=\"IE\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example of general tasks of Internet Explorer</p>\n</blockquote>\n<p>Unlike the dock menu in macOS which is a real menu, user tasks in Windows work like application shortcuts. For example, when a user clicks a task, the program will be executed with specified arguments.</p>\n<p>To set user tasks for your application, you can use <a href=\"/docs/api/app#appsetusertaskstasks-windows\">app.setUserTasks</a> API.</p>\n<h4 id=\"exemplos\"><a href=\"#exemplos\">Exemplos</a></h4>\n<h5 id=\"set-user-tasks\"><a href=\"#set-user-tasks\">Set user tasks</a></h5>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setUserTasks([\n  {\n    <span class=\"hljs-attr\">program</span>: process.execPath,\n    <span class=\"hljs-attr\">arguments</span>: <span class=\"hljs-string\">'--new-window'</span>,\n    <span class=\"hljs-attr\">iconPath</span>: process.execPath,\n    <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'New Window'</span>,\n    <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Create a new window'</span>\n  }\n])\n</code></pre>\n<h5 id=\"clear-tasks-list\"><a href=\"#clear-tasks-list\">Clear tasks list</a></h5>\n<p>To clear your tasks list, you need to call <code>app.setUserTasks</code> with an empty array in the <code>main.js</code> file.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setUserTasks([])\n</code></pre>\n<blockquote>\n<p>NOTE: The user tasks will still be displayed even after closing your application, so the icon and program path specified for a task should exist until your application is uninstalled.</p>\n</blockquote>\n<h3 id=\"thumbnail-toolbars\"><a href=\"#thumbnail-toolbars\">Thumbnail Toolbars</a></h3>\n<p>On Windows, you can add a thumbnail toolbar with specified buttons to a taskbar layout of an application window. It provides users with a way to access a particular window's command without restoring or activating the window.</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#thumbnail-toolbars\">MSDN</a>:</p>\n<blockquote>\n<p>This toolbar is the familiar standard toolbar common control. It has a maximum of seven buttons. Each button's ID, image, tooltip, and state are defined in a structure, which is then passed to the taskbar. The application can show, enable, disable, or hide buttons from the thumbnail toolbar as required by its current state.</p>\n<p>For example, Windows Media Player might offer standard media transport controls such as play, pause, mute, and stop.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420540.png\" alt=\"player\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example of thumbnail toolbar of Windows Media Player</p>\n</blockquote>\n<p>To set thumbnail toolbar in your application, you need to use <a href=\"/docs/api/browser-window#winsetthumbarbuttonsbuttons-windows\">BrowserWindow.setThumbarButtons</a></p>\n<h4 id=\"exemplos-1\"><a href=\"#exemplos-1\">Exemplos</a></h4>\n<h5 id=\"set-thumbnail-toolbar\"><a href=\"#set-thumbnail-toolbar\">Set thumbnail toolbar</a></h5>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.setThumbarButtons([\n  {\n    <span class=\"hljs-attr\">tooltip</span>: <span class=\"hljs-string\">'button1'</span>,\n    <span class=\"hljs-attr\">icon</span>: path.join(__dirname, <span class=\"hljs-string\">'button1.png'</span>),\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'button1 clicked'</span>) }\n  }, {\n    <span class=\"hljs-attr\">tooltip</span>: <span class=\"hljs-string\">'button2'</span>,\n    <span class=\"hljs-attr\">icon</span>: path.join(__dirname, <span class=\"hljs-string\">'button2.png'</span>),\n    <span class=\"hljs-attr\">flags</span>: [<span class=\"hljs-string\">'enabled'</span>, <span class=\"hljs-string\">'dismissonclick'</span>],\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'button2 clicked.'</span>) }\n  }\n])\n</code></pre>\n<h5 id=\"clear-thumbnail-toolbar\"><a href=\"#clear-thumbnail-toolbar\">Clear thumbnail toolbar</a></h5>\n<p>To clear thumbnail toolbar buttons, you need to call <code>BrowserWindow.setThumbarButtons</code> with an empty array in the <code>main.js</code> file.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.setThumbarButtons([])\n</code></pre>\n<h3 id=\"icon-overlays-in-taskbar\"><a href=\"#icon-overlays-in-taskbar\">Icon Overlays in Taskbar</a></h3>\n<p>On Windows, a taskbar button can use a small overlay to display application status.</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#icon-overlays\">MSDN</a>:</p>\n<blockquote>\n<p>Icon overlays serve as a contextual notification of status, and are intended to negate the need for a separate notification area status icon to communicate that information to the user. For instance, the new mail status in Microsoft Outlook, currently shown in the notification area, can now be indicated through an overlay on the taskbar button. Again, you must decide during your development cycle which method is best for your application. Overlay icons are intended to supply important, long-standing status or notifications such as network status, messenger status, or new mail. The user should not be presented with constantly changing overlays or animations.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420441.png\" alt=\"Overlay on taskbar button\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example of overlay on a taskbar button</p>\n</blockquote>\n<p>To set the overlay icon for a window, you need to use the <a href=\"/docs/api/browser-window#winsetoverlayiconoverlay-description-windows\">BrowserWindow.setOverlayIcon</a> API.</p>\n<h4 id=\"exemplo\"><a href=\"#exemplo\">Exemplo</a></h4>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.setOverlayIcon(<span class=\"hljs-string\">'path/to/overlay.png'</span>, <span class=\"hljs-string\">'Description for overlay'</span>)\n</code></pre>\n<h3 id=\"flash-frame\"><a href=\"#flash-frame\">Flash Frame</a></h3>\n<p>On Windows, you can highlight the taskbar button to get the user's attention. This is similar to bouncing the dock icon in macOS.</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-flashwindow#remarks\">MSDN</a>:</p>\n<blockquote>\n<p>Typically, a window is flashed to inform the user that the window requires attention but that it does not currently have the keyboard focus.</p>\n</blockquote>\n<p>To flash the BrowserWindow taskbar button, you need to use the <a href=\"/docs/api/browser-window#winflashframeflag\">BrowserWindow.flashFrame</a> API.</p>\n<h4 id=\"exemplo-1\"><a href=\"#exemplo-1\">Exemplo</a></h4>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.once(<span class=\"hljs-string\">'focus'</span>, () => win.flashFrame(<span class=\"hljs-literal\">false</span>))\nwin.flashFrame(<span class=\"hljs-literal\">true</span>)\n</code></pre>\n<blockquote>\n<p>NOTE: Don't forget to call <code>win.flashFrame(false)</code> to turn off the flash. In the above example, it is called when the window comes into focus, but you might use a timeout or some other event to disable it.</p>\n</blockquote>",
      "title": "Taskbar Customization (Windows)",
      "description": "Aplicativos definem tarefas com base em recursos do programa e as principais coisas que um usuário espera fazer com eles. Tasks should be context-free, in that the application does not need to be running for them to work. They should also be the statistically most common actions that a normal user would perform in an application, such as compose an email message or open the calendar in a mail program, create a new document in a word processor, launch an application in a certain mode, or launch one of its subcommands. An application should not clutter the menu with advanced features that standard users won't need or one-time actions such as registration. Do not use tasks for promotional items such as upgrades or special offers.\nIt is strongly recommended that the task list be static. It should remain the same regardless of the state or status of the application. While it is possible to vary the list dynamically, you should consider that this could confuse the user who does not expect that portion of the destination list to change."
    }
  },
  "de-DE": {
    "/docs/api/accelerator": {
      "locale": "de-DE",
      "slug": "accelerator",
      "href": "/docs/api/accelerator",
      "crowdinFileId": "256277",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/accelerator.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"accelerator\"><a href=\"#accelerator\">Accelerator</a></h1>\n<blockquote>\n<p>Definiere Tastenkürzel</p>\n</blockquote>\n<p>Acceleratoren sind String die mehrere Modifikatoren und einzelne Key Codes enthalten können. Diese werden mit einem <code>+</code> Zeichen verknüpft und werden dazu verwendet, Tastenkürzel für deine App zu definieren.</p>\n<p>Beispiele:</p>\n<ul>\n<li><code>CommandOrControl+A</code></li>\n<li><code>CommandOrControl+Shift+Z</code></li>\n</ul>\n<p>Tastenkürzel werden registriert mit dem  <a href=\"/docs/api/global-shortcut\"><code>globalShortcut</code></a> Modul durch die  <a href=\"/docs/api/global-shortcut#globalshortcutregisteraccelerator-callback\"><code>register</code></a> Methode, z.B.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Register a 'CommandOrControl+Y' shortcut listener.</span>\n  globalShortcut.register(<span class=\"hljs-string\">'CommandOrControl+Y'</span>, () => {\n    <span class=\"hljs-comment\">// Do stuff when Y and either Command/Control is pressed.</span>\n  })\n})\n</code></pre>\n<h2 id=\"hinweis-zu-betriebssystemen\"><a href=\"#hinweis-zu-betriebssystemen\">Hinweis zu Betriebssystemen</a></h2>\n<p>Unter Linux und Windows hat die <code>Command</code> Taste keinen Effekt, weshalb <code>CommandOrControl</code> benutzt werden sollte. Es repräsentiert  <code>Command</code> unter macOS und  <code>Control</code> unter Linux und Windows um Tastenkürzel zu definieren.</p>\n<p>Verwenden Sie <code>Alt</code> anstelle von <code>Option</code>. <code>Option</code> existiert nur unter macOS, wohingegen <code>Alt</code> in allen Betriebssystemen verfügbar ist.</p>\n<p>The <code>Super</code> (or <code>Meta</code>) key is mapped to the <code>Windows</code> key on Windows and Linux and <code>Cmd</code> on macOS.</p>\n<h2 id=\"verfügbare-modifikatoren\"><a href=\"#verfügbare-modifikatoren\">Verfügbare Modifikatoren</a></h2>\n<ul>\n<li><code>Command</code> (oder kurz <code>Cmd</code>)</li>\n<li><code>Control</code> (oder kurz <code>Ctrl</code>)</li>\n<li><code>CommandOrControl</code> (oder kurz <code>CmdOrCtrl</code>)</li>\n<li><code>Alt</code></li>\n<li><code>Option</code></li>\n<li><code>AltGr</code></li>\n<li><code>Shift</code></li>\n<li><code>Super</code></li>\n<li><code>Meta</code></li>\n</ul>\n<h2 id=\"verfügbare-tastencodes\"><a href=\"#verfügbare-tastencodes\">Verfügbare Tastencodes</a></h2>\n<ul>\n<li><code>0</code> bis <code>9</code></li>\n<li><code>A</code> bis <code>Z</code></li>\n<li><code>F1</code> bis <code>F24</code></li>\n<li>Sonderzeichen wie <code>~</code>, <code>!</code>, <code>@</code>, <code>#</code>, <code>$</code>, etc.</li>\n<li><code>Plus</code></li>\n<li><code>Space (Leerzeichen)</code></li>\n<li><code>Tab</code></li>\n<li><code>Capslock</code></li>\n<li><code>Numlock</code></li>\n<li><code>Scrolllock</code></li>\n<li><code>Backspace</code></li>\n<li><code>Delete</code></li>\n<li><code>Insert</code></li>\n<li><code>Return</code> (Oder <code>Enter</code> als Alias)</li>\n<li><code>Up</code>, <code>Down</code>, <code>Left</code> und <code>Right</code></li>\n<li><code>Home</code> und <code>End</code></li>\n<li><code>PageUp</code> und <code>PageDown</code></li>\n<li><code>Escape</code> (oder <code>Esc</code> als Abkürzung)</li>\n<li><code>VolumeUp</code>, <code>VolumeDown</code> und <code>VolumeMute</code></li>\n<li><code>MediaNextTrack</code>, <code>MediaPreviousTrack</code>, <code>MediaStop</code> und <code>MediaPlayPause</code></li>\n<li><code>PrintScreen</code></li>\n<li>NumPad-Tasten<ul>\n<li><code>num0</code> - <code>num9</code></li>\n<li><code>numdec</code> - decimal key</li>\n<li><code>numadd</code> - numpad <code>+</code> key</li>\n<li><code>numsub</code> - numpad <code>-</code> key</li>\n<li><code>nummult</code> - numpad <code>*</code> key</li>\n<li><code>numdiv</code> - numpad <code>÷</code> key</li>\n</ul></li>\n</ul>",
      "title": "Accelerator",
      "description": "Definiere Tastenkürzel"
    },
    "/docs/tutorial/accessibility": {
      "locale": "de-DE",
      "slug": "accessibility",
      "href": "/docs/tutorial/accessibility",
      "crowdinFileId": "256173",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/accessibility.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"barrierefreiheit\"><a href=\"#barrierefreiheit\">Barrierefreiheit</a></h1>\n<p>Making accessible applications is important and we're happy to provide functionality to <a href=\"https://electronjs.org/devtron\">Devtron</a> and <a href=\"https://electronjs.org/spectron\">Spectron</a> that gives developers the opportunity to make their apps better for everyone.</p>\n<hr>\n<p>Accessibility concerns in Electron applications are similar to those of websites because they're both ultimately HTML. With Electron apps, however, you can't use the online resources for accessibility audits because your app doesn't have a URL to point the auditor to.</p>\n<p>These features bring those auditing tools to your Electron app. You can choose to add audits to your tests with Spectron or use them within DevTools with Devtron. Lesen Sie weiter für eine Zusammenfassung der Werkzeuge.</p>\n<h2 id=\"spectron\"><a href=\"#spectron\">Spectron</a></h2>\n<p>In the testing framework Spectron, you can now audit each window and <code>&#x3C;webview></code> tag in your application. Ein Beispiel:</p>\n<pre><code class=\"hljs language-javascript\">app.client.auditAccessibility().then(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\">audit</span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (audit.failed) {\n    <span class=\"hljs-built_in\">console</span>.error(audit.message)\n  }\n})\n</code></pre>\n<p>Erfahren Sie mehr über dieses Feature in der <a href=\"https://github.com/electron/spectron#accessibility-testing\">Spectron Dokumentation</a>.</p>\n<h2 id=\"devtron\"><a href=\"#devtron\">Devtron</a></h2>\n<p>In Devtron, there is an accessibility tab which will allow you to audit a page in your app, sort and filter the results.</p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/1305617/17156618/9f9bcd72-533f-11e6-880d-389115f40a2a.png\" alt=\"Screenshot von Devtron\"></p>\n<p>Both of these tools are using the <a href=\"https://github.com/GoogleChrome/accessibility-developer-tools\">Accessibility Developer Tools</a> library built by Google for Chrome. You can learn more about the accessibility audit rules this library uses on that <a href=\"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules\">repository's wiki</a>.</p>\n<p>If you know of other great accessibility tools for Electron, add them to the accessibility documentation with a pull request.</p>\n<h2 id=\"manually-enabling-accessibility-features\"><a href=\"#manually-enabling-accessibility-features\">Manually enabling accessibility features</a></h2>\n<p>Electron applications will automatically enable accessibility features in the presence of assistive technology (e.g. <a href=\"https://www.freedomscientific.com/products/software/jaws/\">JAWS</a> on Windows or <a href=\"https://help.apple.com/voiceover/mac/10.15/\">VoiceOver</a> on macOS). Schauen Sie in die <a href=\"https://www.chromium.org/developers/design-documents/accessibility#TOC-How-Chrome-detects-the-presence-of-Assistive-Technology\">Dokumentation für Barrierefreiheit</a> für weitere Informationen.</p>\n<p>You can also manually toggle these features either within your Electron application or by setting flags in third-party native software.</p>\n<h3 id=\"using-electrons-api\"><a href=\"#using-electrons-api\">Using Electron's API</a></h3>\n<p>By using the <a href=\"/docs/api/app#appsetaccessibilitysupportenabledenabled-macos-windows\"><code>app.setAccessibilitySupportEnabled(enabled)</code></a> API, you can manually expose Chrome's accessibility tree to users in the application preferences. Note that the user's system assistive utilities have priority over this setting and will override it.</p>\n<h3 id=\"within-third-party-software\"><a href=\"#within-third-party-software\">Within third-party software</a></h3>\n<h4 id=\"macos\"><a href=\"#macos\">macOS</a></h4>\n<p>On macOS, third-party assistive technology can toggle accessibility features inside Electron applications by setting the <code>AXManualAccessibility</code> attribute programmatically:</p>\n<pre><code class=\"hljs language-objc\"><span class=\"hljs-built_in\">CFStringRef</span> kAXManualAccessibility = <span class=\"hljs-built_in\">CFSTR</span>(<span class=\"hljs-string\">\"AXManualAccessibility\"</span>);\n\n+ (<span class=\"hljs-keyword\">void</span>)enableAccessibility:(<span class=\"hljs-built_in\">BOOL</span>)enable inElectronApplication:(<span class=\"hljs-built_in\">NSRunningApplication</span> *)app\n{\n    AXUIElementRef appRef = AXUIElementCreateApplication(app.processIdentifier);\n    <span class=\"hljs-keyword\">if</span> (appRef == <span class=\"hljs-literal\">nil</span>)\n        <span class=\"hljs-keyword\">return</span>;\n\n    <span class=\"hljs-built_in\">CFBooleanRef</span> value = enable ? kCFBooleanTrue : kCFBooleanFalse;\n    AXUIElementSetAttributeValue(appRef, kAXManualAccessibility, value);\n    <span class=\"hljs-built_in\">CFRelease</span>(appRef);\n}\n</code></pre>",
      "title": "Barrierefreiheit",
      "description": ""
    },
    "/docs/api/app": {
      "locale": "de-DE",
      "slug": "app",
      "href": "/docs/api/app",
      "crowdinFileId": "256279",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/app.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"app\"><a href=\"#app\">app</a></h1>\n<blockquote>\n<p>Kontrolliere den Ereignisverlauf deiner Anwendung.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p>Das folgende Beispiel zeigt, wie die Applikation beendet wird, wenn das letzte Fenster geschlossen wurde:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  app.quit()\n})\n</code></pre>\n<h2 id=\"ereignisse\"><a href=\"#ereignisse\">Ereignisse</a></h2>\n<p>Das <code>app</code> Objekt stellt folgende Event zur Verfügung:</p>\n<h3 id=\"event-will-finish-launching\"><a href=\"#event-will-finish-launching\">Event: 'will-finish-launching'</a></h3>\n<p>Wird ausgelöst wenn die Anwendung den grundlegenenden Start abgeschlossen hat. Unter Windows und Linux, hat das <code>will-finish-launching</code>-Ereignis das gleiche Verhalten wie das <code>ready</code>-Event; unter macOS, repräsentiert dieses Event die <code>applicationWillFinishLaunching</code>-Benachrichtung von <code>NSApplication</code>. In der Regel würden hier Listener für die Events <code>open-file</code> und <code>open-url</code> registriert und der Crash Reporter und Auto-Updater gestartet werden.</p>\n<p>In den meisten Fällen, sollte man alles im <code>ready</code> Eventhandler machen.</p>\n<h3 id=\"event-ready\"><a href=\"#event-ready\">Event: 'ready'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>launchInfo</code> Record&#x3C;string, any> | <a href=\"/docs/api/structures/notification-response\">NotificationResponse</a> <em>macOS</em></li>\n</ul>\n<p>Wird einmal ausgesendet, wenn Electron die Initialisierung beendet hat. On macOS, <code>launchInfo</code> holds the <code>userInfo</code> of the <code>NSUserNotification</code> or information from <a href=\"/docs/api/structures/notification-response\"><code>UNNotificationResponse</code></a> that was used to open the application, if it was launched from Notification Center. Sie können auch <code>app.isReady()</code> um zu prüfen, ob dieses Ereignis bereits ausgelöst wurde und <code>app.whenReady()</code> um ein Promise zu initialisieren, das ausgeführt wird, wenn Electron initialisiert wird.</p>\n<h3 id=\"event-window-all-closed\"><a href=\"#event-window-all-closed\">Event: 'window-all-closed'</a></h3>\n<p>Wird gefeuert, wenn alle Fenster geschlossen wurden.</p>\n<p>Wenn du keinen einzigen Listener für dieses Event nutzt und alle Fenster geschlossen sind, ist die standardmäßige Handhabung des Events das Beenden der App. Wenn du allerdings auf das Event hörst, hast du die Kontrolle darüber, ob die App beendet werden soll oder nicht. Wenn entweder der Nutzer durch Drücken von <code>Cmd + Q</code> oder der Entwickler durch einen Aufruf von <code>app.quit()</code> die App zum Beenden bewegt, wird Electron zuerst versuchen alle Fenster zu schließen und danach erst das <code>will-emit</code> auslösen. In einem solchen Fall wird das <code>window-all-closed</code> Event übrigens überhaupt nicht ausgelöst.</p>\n<h3 id=\"event-before-quit\"><a href=\"#event-before-quit\">Event: 'before-quit'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Ausgelöst, bevor sich die Fenster der Anwendung schließen. Ein Aufruf von <code>event.preventDefault()</code> verhindert das Standardverhalten, welches die Anwendung schließt.</p>\n<p><strong>Wichtig</strong>: Wenn das Beenden der App durch einen Aufruf von <code>autoUpdater.quitAndInstall()</code> initiiert wurde, wird das <code>before-quit</code> Event <em>nach</em> der Auslösung aller <code>close</code> Events für alle Fenster ausgelöst und diese werden geschlossen.</p>\n<p><strong>Hinweis:</strong> Wenn die Anwendung unter Windows beendet wird, weil das System heruntergefahren oder neu gestartet wird oder der Benutzer sich abmeldet, wird dieses Event nicht ausgelöst.</p>\n<h3 id=\"event-before-quit-1\"><a href=\"#event-before-quit-1\">Event: 'before-quit'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Ausgelöst, wenn alle Fenster geschlossen sind und sich die Anwendung beenden wird. Ein Aufruf von <code>event.preventDefault()</code> verhindert das Standardverhalten, welches die Anwendung schließt.</p>\n<p>Schau dir die Beschreibung/Dokumentation des <code>window-all-closed</code> Events an um die Unterschiede zwischen dem <code>will-quit</code> und dem <code>window-all-closed</code> Event zu verstehen.</p>\n<p><strong>Hinweis:</strong> Wenn die Anwendung unter Windows beendet wird, weil das System heruntergefahren oder neu gestartet wird oder der Benutzer sich abmeldet, wird dieses Event nicht ausgelöst.</p>\n<h3 id=\"event-quit\"><a href=\"#event-quit\">Event: 'quit'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>exitCode</code> Integer</li>\n</ul>\n<p>Wird ausgelöst wenn die App beendet wird.</p>\n<p><strong>Hinweis:</strong> Wenn die Anwendung unter Windows beendet wird, weil das System heruntergefahren oder neu gestartet wird oder der Benutzer sich abmeldet, wird dieses Event nicht ausgelöst.</p>\n<h3 id=\"event-open-file-macos\"><a href=\"#event-open-file-macos\">Event: 'open-file' <em>macOS</em></a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>path</code> String</li>\n</ul>\n<p>Wird ausgelöst wenn der Nutzer versucht eine Datei mit der App zu öffnen. The <code>open-file</code> Event wird auch ausgelöst wenn die App bereits offen ist und das Betriebssystem die App nochmal zum Öffnen einer Datei benutzen will. <code>open-file</code> wird auch ausgelöst wenn eine Datei auf das Dock-Icon der App gezogen wird (macOS) und die App noch nicht gestartet ist. Behandle das <code>open-file</code> Event so früh wie möglich in deiner App um diesen Fall zu berücksichtigen (Also definitiv bevor das <code>ready</code> Event ausgelöst wird).</p>\n<p>Du musst <code>event.preventDefault()</code> aufrufen um dieses Event selbst zu nutzen.</p>\n<p>In Windows musst du <code>process.argv</code> (im Main-Prozess) parsen, um den Dateipfad zu erhalten.</p>\n<h3 id=\"event-open-url-macos\"><a href=\"#event-open-url-macos\">Event: 'open-url' <em>macOS</em></a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Wird ausgelöst wenn der Nutzer versucht, eine URL mit der App zu öffnen. 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>\n<p>Du musst <code>event.preventDefault()</code> aufrufen um dieses Event selbst zu nutzen.</p>\n<h3 id=\"event-activate-macos\"><a href=\"#event-activate-macos\">Event: 'activate' <em>macOS</em></a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>hasVisibleWindows</code> Boolean</li>\n</ul>\n<p>Wird ausgelöst wenn die App aktiviert wird. Eine ganze Menge an Aktionen können dieses Event auslösen. So zum Beispiel das Starten der App zum ersten mal als solches, eine Wiederbenutzung der App während sie bereits läuft oder einfach ein Klick auf das Dock oder Tastbar Icon der App.</p>\n<h3 id=\"event-did-become-active-macos\"><a href=\"#event-did-become-active-macos\">Event: 'did-become-active' <em>macOS</em></a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<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>\n<h3 id=\"event-continue-activity-macos\"><a href=\"#event-continue-activity-macos\">Event: 'continue-activity' <em>macOS</em></a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - Ein string zum identifizieren einer Aktivität. Maped auf <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> Object - Enthält den app-spezifischen Zustand, der von einer Aktivität auf einem anderen Gerät gespeichert wurde.</li>\n<li><code>details</code> Objekt<ul>\n<li><code>webpageURL</code> String (optional) - A string identifying the URL of the webpage accessed by the activity on another device, if available.</li>\n</ul></li>\n</ul>\n<p>Wird während <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> ausgelöst, wenn eine Aktivität von einem anderen Gerät wieder aufgenommen werden soll. Du solltest <code>event.preventDefault()</code> aufrufen wenn du dieses Event verwenden willst.</p>\n<p>Eine Benutzeraktivität kann nur in einer App fortgesetzt werden, die die gleiche Entwicklerteam-ID als die Quell-App der Aktivität hat und den Typ der Aktivität unterstützt. Unterstützte Aktivitätstypen sind spezifiziert in <code>Info.plist</code> unter dem <code>NSUserActivityTypes</code> Schlüssel.</p>\n<h3 id=\"event-will-continue-activity-macos\"><a href=\"#event-will-continue-activity-macos\">Event: 'will-continue-activity' <em>macOS</em></a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - Ein string zum identifizieren einer Aktivität. Maped auf <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n</ul>\n<p>Wird während <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> ausgelöst, bevor eine Aktivität von einem anderen Gerät wieder aufgenommen werden soll. Du solltest <code>event.preventDefault()</code> aufrufen wenn du dieses Event verwenden willst.</p>\n<h3 id=\"event-continue-activity-error-macos\"><a href=\"#event-continue-activity-error-macos\">Event: 'continue-activity-error' <em>macOS</em></a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - Ein string zum identifizieren einer Aktivität. Maped auf <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>error</code> String - Ein String mit der lokalisierten Beschreibung des Fehlers.</li>\n</ul>\n<p>Wird während <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> ausgelöst, wenn eine Aktivität von einem anderen Gerät nicht wieder aufgenommen werden kann.</p>\n<h3 id=\"ereignis-activity-was-continued-macos\"><a href=\"#ereignis-activity-was-continued-macos\">Ereignis: 'activity-was-continued' <em>macOS</em></a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - Ein string zum identifizieren einer Aktivität. Maped auf <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> unknown - Enthält app-spezifischen Zustand, der von der Aktivität gespeichert wird.</li>\n</ul>\n<p>Wird während <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> ausgelöst, wenn eine Aktivität von diesem Gerät auf einem anderen Gerät erfolgreich fortgesetzt wurde.</p>\n<h3 id=\"event-update-activity-state-macos\"><a href=\"#event-update-activity-state-macos\">Event: 'update-activity-state' <em>macOS</em></a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String - Ein string zum identifizieren einer Aktivität. Maped auf <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> unknown - Enthält app-spezifischen Zustand, der von der Aktivität gespeichert wird.</li>\n</ul>\n<p>Wird ausgelöst wenn <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> auf einem anderen Gerät fortgesetzt wird. Wenn Sie den zu übertragenden Status aktualisieren müssen, sollten Sie <code>event.preventDefault()</code> sofort aufrufen, ein neues <code>userInfo-Wörterbuch</code> erstellen und <code>app.updateCurrentActivity()</code> zeitnah aufrufen. Andernfalls wird die Operation fehlschlagen und <code>Continue-Activity-error</code> wird aufgerufen.</p>\n<h3 id=\"event-new-window-for-tab-macos\"><a href=\"#event-new-window-for-tab-macos\">Event: 'new-window-for-tab' <em>macOS</em></a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emittiert, wenn der Benutzer auf die neue Registerkarte macOS mit systemeigenem MacOS klickt. The new tab button is only visible if the current <code>BrowserWindow</code> has a <code>tabbingIdentifier</code></p>\n<h3 id=\"event-browser-window-blur\"><a href=\"#event-browser-window-blur\">Event: 'browser-window-blur'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Wird ausgegeben, wenn ein <a href=\"/docs/api/browser-window\"> browserWindow </a> ausgeblendet wird.</p>\n<h3 id=\"event-browser-window-focus\"><a href=\"#event-browser-window-focus\">Event: 'browser-window-focus'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Emittiert wenn ein <a href=\"/docs/api/browser-window\">browserWindow</a> in den Fokus kommt.</p>\n<h3 id=\"event-browser-window-created\"><a href=\"#event-browser-window-created\">Event: 'browser-window-created'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n</ul>\n<p>Emittiert wenn ein neues <a href=\"/docs/api/browser-window\">browserWindow</a> erstellt wird.</p>\n<h3 id=\"event-web-contents-created\"><a href=\"#event-web-contents-created\">Event: 'web-contents-created'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emittiert wen ein neues <a href=\"/docs/api/web-contents\">webContents</a> erstellt wird.</p>\n<h3 id=\"event-certificate-error\"><a href=\"#event-certificate-error\">Event: 'certificate-error'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>url</code> String</li>\n<li><code>error</code> String - Der error code</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>isTrusted</code> Boolean - Gibt an ob das Zertifikat als vertrauenswürdig angesehen werden soll</li>\n</ul></li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Emittiert wenn die Verifizierung des <code>certificate</code> für die <code>url</code> fehlschlägt, um dem Zertifikat dennoch zu vertrauen müssen die das normale Verhalten abschalten mit <code>event.preventDefault()</code> und <code>callback(true)</code> aufrufen.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'certificate-error'</span>, (event, webContents, url, error, certificate, callback) => {\n  <span class=\"hljs-keyword\">if</span> (url === <span class=\"hljs-string\">'https://github.com'</span>) {\n    <span class=\"hljs-comment\">// Verification logic.</span>\n    event.preventDefault()\n    callback(<span class=\"hljs-literal\">true</span>)\n  } <span class=\"hljs-keyword\">else</span> {\n    callback(<span class=\"hljs-literal\">false</span>)\n  }\n})\n</code></pre>\n<h3 id=\"event-select-client-certificate\"><a href=\"#event-select-client-certificate\">Event: 'select-client-certificate'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>url</code> URL</li>\n<li><code>certificateList</code> <a href=\"/docs/api/structures/certificate\">Certificate[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> (optional)</li>\n</ul></li>\n</ul>\n<p>Emittiert wenn ein Client Zertifikat angefordert wird.</p>\n<p>Die <code>url</code> entspricht dem Navigationseintrag, der das Client-Zertifikat anfordert und <code>Callback</code> kann mit einem Eintrag aufgerufen werden, der aus der Liste gefiltert wird. Die Verwendung von <code>event.preventDefault()</code> verhindert, dass die App das erste Zertifikat aus dem Store verwendet.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'select-client-certificate'</span>, (event, webContents, url, list, callback) => {\n  event.preventDefault()\n  callback(list[<span class=\"hljs-number\">0</span>])\n})\n</code></pre>\n<h3 id=\"event-login\"><a href=\"#event-login\">Event: 'login'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>authenticationResponseDetails</code> Objekt<ul>\n<li><code>url</code> URL</li>\n</ul></li>\n<li><code>authInfo</code> Objekt<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (optional)</li>\n<li><code>password</code> String (optional)</li>\n</ul></li>\n</ul>\n<p>Wird ausgelöst wenn <code>webContents</code> grundlegende Authentifizierung durchführen will.</p>\n<p>Standardmäßig werden alle Authentifizierungen abgebrochen. 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>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'login'</span>, (event, webContents, details, authInfo, callback) => {\n  event.preventDefault()\n  callback(<span class=\"hljs-string\">'username'</span>, <span class=\"hljs-string\">'secret'</span>)\n})\n</code></pre>\n<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>\n<h3 id=\"event-gpu-info-update\"><a href=\"#event-gpu-info-update\">Event: 'gpu-info-update'</a></h3>\n<p>Emitted whenever there is a GPU info update.</p>\n<h3 id=\"event-gpu-process-crashed-deprecated\"><a href=\"#event-gpu-process-crashed-deprecated\">Event: 'gpu-process-crashed' <em>Deprecated</em></a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>Emitted when the GPU process crashes or is killed.</p>\n<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. Ist es nicht immer, wenn es abgestürzt ist. Der Boolesche Wert <code>killed</code> kann ersetzt werden durch Überprüfung von <code>reason === 'killed'</code>, wenn Sie zu diesem Ereignis wechseln.</p>\n<h3 id=\"event-renderer-process-crashed-deprecated\"><a href=\"#event-renderer-process-crashed-deprecated\">Event: 'renderer-process-crashed' <em>Deprecated</em></a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>Emitted when the renderer process of <code>webContents</code> crashes or is killed.</p>\n<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. Ist es nicht immer, wenn es abgestürzt ist.  Der Boolesche Wert <code>killed</code> kann ersetzt werden durch Überprüfung von <code>reason === 'killed'</code>, wenn Sie zu diesem Ereignis wechseln.</p>\n<h3 id=\"event-render-process-gone\"><a href=\"#event-render-process-gone\">Event: 'render-process-gone'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>details</code> Objekt<ul>\n<li><code>reason</code> String - The reason the render process is gone.  Mögliche werte:<ul>\n<li><code>clean-exit</code> - Process exited with an exit code of zero</li>\n<li><code>abnormal-exit</code> - Process exited with a non-zero exit code</li>\n<li><code>killed</code> - Process was sent a SIGTERM or otherwise killed externally</li>\n<li><code>crashed</code> - Process crashed</li>\n<li><code>oom</code> - Process ran out of memory</li>\n<li><code>launch-failed</code> - Process never successfully launched</li>\n<li><code>integrity-failure</code> - Windows code integrity checks failed</li>\n</ul></li>\n<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>\n</ul></li>\n</ul>\n<p>Emitted when the renderer process unexpectedly disappears.  This is normally because it was crashed or killed.</p>\n<h3 id=\"event-child-process-gone\"><a href=\"#event-child-process-gone\">Event: 'child-process-gone'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Objekt<ul>\n<li><code>Typ</code> String - Prozess-Typ. Einer der folgenden Werte:<ul>\n<li><code>Utility</code></li>\n<li><code>Zygote</code></li>\n<li><code>Sandbox helper</code></li>\n<li><code>GPU</code></li>\n<li><code>Pepper Plugin</code></li>\n<li><code>Pepper Plugin Broker</code></li>\n<li><code>Unknown</code></li>\n</ul></li>\n<li><code>reason</code> String - The reason the child process is gone. Mögliche werte:<ul>\n<li><code>clean-exit</code> - Process exited with an exit code of zero</li>\n<li><code>abnormal-exit</code> - Process exited with a non-zero exit code</li>\n<li><code>killed</code> - Process was sent a SIGTERM or otherwise killed externally</li>\n<li><code>crashed</code> - Process crashed</li>\n<li><code>oom</code> - Process ran out of memory</li>\n<li><code>launch-failed</code> - Process never successfully launched</li>\n<li><code>integrity-failure</code> - Windows code integrity checks failed</li>\n</ul></li>\n<li><code>exitCode</code> Number - The exit code for the process (e.g. status from waitpid if on posix, from GetExitCodeProcess on Windows).</li>\n<li><code>serviceName</code> String (optional) - The non-localized name of the process.</li>\n<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>\n</ul></li>\n</ul>\n<p>Emitted when the child process unexpectedly disappears. This is normally because it was crashed or killed. It does not include renderer processes.</p>\n<h3 id=\"event-accessibility-support-changed-macos-windows\"><a href=\"#event-accessibility-support-changed-macos-windows\">Event: 'accessibility-support-changed' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>accessibilitySupportEnabled</code> Boolean - <code>true</code> when Chrome's accessibility support is enabled, <code>false</code> otherwise.</li>\n</ul>\n<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://www.chromium.org/developers/design-documents/accessibility\">https://www.chromium.org/developers/design-documents/accessibility</a> for more details.</p>\n<h3 id=\"event-session-created\"><a href=\"#event-session-created\">Event: 'session-created'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>session</code> <a href=\"/docs/api/session\">Session</a></li>\n</ul>\n<p>Emittiert wenn Electron eine neue <code>Session</code> erstellt.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'session-created'</span>, (session) => {\n  <span class=\"hljs-built_in\">console</span>.log(session)\n})\n</code></pre>\n<h3 id=\"event-second-instance\"><a href=\"#event-second-instance\">Event: 'second-instance'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>argv</code> String[] - An array of the second instance's command line arguments</li>\n<li><code>workingDirectory</code> String - The second instance's working directory</li>\n</ul>\n<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>\n<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>\n<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>\n<p>This event is guaranteed to be emitted after the <code>ready</code> event of <code>app</code> gets emitted.</p>\n<p><strong>Hinweis:</strong> Zusätzliche Kommandozeilenargumente könnten von Chromium hinzugefügt werden, wie <code>--original-process-start-time</code>.</p>\n<h3 id=\"event-desktop-capturer-get-sources\"><a href=\"#event-desktop-capturer-get-sources\">Event: 'desktop-capturer-get-sources'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<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>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das <code>app</code> Objekt enthält die folgenden Methoden:</p>\n<p><strong>Hinweis:</strong> Manche Methoden sind nur auf spezifischen Betriebssystemen verfügbar und sind dementsprechend gekennzeichnet.</p>\n<h3 id=\"appquit\"><a href=\"#appquit\"><code>app.quit()</code></a></h3>\n<p>Versucht sämtliche Fenster zu schließen. Das <code>before-quit</code> Ereignis wird zuerst aufgerufen. Wurden alle Fenster erfolgreich geschlossen, wird das <code>will-quit</code> Ereignis aufgerufen und die Anwendung wird standardmäßig terminiert.</p>\n<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>\n<h3 id=\"appexitexitcode\"><a href=\"#appexitexitcode\"><code>app.exit([exitCode])</code></a></h3>\n<ul>\n<li><code>exitCode</code> Integer (optional)</li>\n</ul>\n<p>Exits immediately with <code>exitCode</code>. <code>exitCode</code> defaults to 0.</p>\n<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>\n<h3 id=\"apprelaunchoptions\"><a href=\"#apprelaunchoptions\"><code>app.relaunch([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a></li>\n<li><code>execPath</code> String (optional)</li>\n</ul></li>\n</ul>\n<p>Relaunches the app when current instance exits.</p>\n<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>\n<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>\n<p>When <code>app.relaunch</code> is called for multiple times, multiple instances will be started after current instance exited.</p>\n<p>An example of restarting current instance immediately and adding a new command line argument to the new instance:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.relaunch({ <span class=\"hljs-attr\">args</span>: process.argv.slice(<span class=\"hljs-number\">1</span>).concat([<span class=\"hljs-string\">'--relaunch'</span>]) })\napp.exit(<span class=\"hljs-number\">0</span>)\n</code></pre>\n<h3 id=\"appisready\"><a href=\"#appisready\"><code>app.isReady()</code></a></h3>\n<p>Gibt <code>Boolean</code> - <code>true</code> zurück, wenn Electron das Initialisieren beendet hat, ansonsten <code>false</code>. See also <code>app.whenReady()</code>.</p>\n<h3 id=\"appwhenready\"><a href=\"#appwhenready\"><code>app.whenReady()</code></a></h3>\n<p>Returns <code>Promise&#x3C;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>\n<h3 id=\"appfocusoptions\"><a href=\"#appfocusoptions\"><code>app.focus([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>steal</code> Boolean <em>macOS</em> - Make the receiver the active app even if another app is currently active.</li>\n</ul></li>\n</ul>\n<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>\n<p>Du solltest versuchen, die <code>steal</code> Option so selten wie möglich zu verwenden.</p>\n<h3 id=\"apphide-macos\"><a href=\"#apphide-macos\"><code>app.hide()</code> <em>macOS</em></a></h3>\n<p>Blendet alle Anwendungsfenster aus ohne sie zu minimieren.</p>\n<h3 id=\"appshow-macos\"><a href=\"#appshow-macos\"><code>app.show()</code> <em>macOS</em></a></h3>\n<p>Shows application windows after they were hidden. Does not automatically focus them.</p>\n<h3 id=\"appsetapplogspathpath\"><a href=\"#appsetapplogspathpath\"><code>app.setAppLogsPath([path])</code></a></h3>\n<ul>\n<li><code>path</code> String (optional) - A custom path for your logs. Must be absolute.</li>\n</ul>\n<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>\n<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>macOS</em>, and inside the <code>userData</code> directory on <em>Linux</em> and <em>Windows</em>.</p>\n<h3 id=\"appgetapppath\"><a href=\"#appgetapppath\"><code>app.getAppPath()</code></a></h3>\n<p>Returns <code>String</code> - The current application directory.</p>\n<h3 id=\"appgetpathname\"><a href=\"#appgetpathname\"><code>app.getPath(name)</code></a></h3>\n<ul>\n<li><code>name</code> String - You can request the following paths by the name:<ul>\n<li><code>home</code> Des Benutzers Home Verzeichnis.</li>\n<li><code>appData</code> Per-user application data directory, which by default points to:<ul>\n<li><code>%APPDATA%</code> in Windows</li>\n<li><code>$XDG_CONFIG_HOME</code> oder <code>~/.config</code> in Linux</li>\n<li><code>~/Library/Application Support</code> in macOS</li>\n</ul></li>\n<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>\n<li><code>Cache</code></li>\n<li><code>temp</code> Temporäres Verzeichnis.</li>\n<li><code>exe</code> Die aktuell ausführbare Datei.</li>\n<li><code>module</code> Die <code>libchromiumcontent</code> Bibliothek.</li>\n<li><code>desktop</code> Das Desktop Verzeichnis des aktuellen Benuters.</li>\n<li><code>documents</code> Directory for a user's \"My Documents\".</li>\n<li><code>downloads</code> \"Downloads\" Verzeichnis des aktuellen Benutzers.</li>\n<li><code>music</code> Musik Verzeichnis des aktuellen Benutzers.</li>\n<li><code>pictures</code> Bilder Verzeichnis des aktuellen Benutzers.</li>\n<li><code>videos</code> Filme Verzeichnis des aktuellen Benutzers.</li>\n<li><code>recent</code> Directory for the user's recent files (Windows only).</li>\n<li><code>logs</code> Verzeichnis für die Logfiles deiner App.</li>\n<li><code>crashDumps</code> Directory where crash dumps are stored.</li>\n</ul></li>\n</ul>\n<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>\n<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>\n<h3 id=\"appgetfileiconpath-options\"><a href=\"#appgetfileiconpath-options\"><code>app.getFileIcon(path[, options])</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>size</code> String<ul>\n<li><code>small</code> - 16x16</li>\n<li><code>normal</code> - 32x32</li>\n<li><code>large</code> - 48x48 in <em>Linux</em>, 32x32 in <em>Windows</em>, wird in <em>macOS</em> nicht unterstützt.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - fulfilled with the app's icon, which is a <a href=\"/docs/api/native-image\">NativeImage</a>.</p>\n<p>Ruft das zugeordnete Symbol eines Pfades ab.</p>\n<p>In <em>Windows</em> gibt es zwei arten von Icons:</p>\n<ul>\n<li>Icons welche den verschiedenen Dateiendungen zugeordnet sind, wie <code>.mp3</code>, <code>.png</code>, usw.</li>\n<li>Icons welche in der Datei selbst stecken, wie <code>.exe</code>, <code>.dll</code>, <code>.ico</code>.</li>\n</ul>\n<p>On <em>Linux</em> and <em>macOS</em>, icons depend on the application associated with file mime type.</p>\n<h3 id=\"appsetpathname-path\"><a href=\"#appsetpathname-path\"><code>app.setPath(name, path)</code></a></h3>\n<ul>\n<li><code>name</code> Zeichenfolge</li>\n<li><code>path</code> String</li>\n</ul>\n<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>\n<p>You can only override paths of a <code>name</code> defined in <code>app.getPath</code>.</p>\n<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>\n<h3 id=\"appgetversion\"><a href=\"#appgetversion\"><code>app.getVersion()</code></a></h3>\n<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>\n<h3 id=\"appgetname\"><a href=\"#appgetname\"><code>app.getName()</code></a></h3>\n<p>Returns <code>String</code> - The current application's name, which is the name in the application's <code>package.json</code> file.</p>\n<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>\n<h3 id=\"appsetnamename\"><a href=\"#appsetnamename\"><code>app.setName(name)</code></a></h3>\n<ul>\n<li><code>name</code> Zeichenfolge</li>\n</ul>\n<p>Überschreibt den Namen der aktuellen Anwendung.</p>\n<p><strong>Note:</strong> This function overrides the name used internally by Electron; it does not affect the name that the OS uses.</p>\n<h3 id=\"appgetlocale\"><a href=\"#appgetlocale\"><code>app.getLocale()</code></a></h3>\n<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://source.chromium.org/chromium/chromium/src/+/master:ui/base/l10n/l10n_util.cc\">here</a>.</p>\n<p>To set the locale, you'll want to use a command line switch at app startup, which may be found <a href=\"/docs/api/command-line-switches\">here</a>.</p>\n<p><strong>Note:</strong> When distributing your packaged app, you have to also ship the <code>locales</code> folder.</p>\n<p><strong>Note:</strong> On Windows, you have to call it after the <code>ready</code> events gets emitted.</p>\n<h3 id=\"appgetlocalecountrycode\"><a href=\"#appgetlocalecountrycode\"><code>app.getLocaleCountryCode()</code></a></h3>\n<p>Returns <code>String</code> - User operating system's locale two-letter <a href=\"https://www.iso.org/iso-3166-country-codes.html\">ISO 3166</a> country code. The value is taken from native OS APIs.</p>\n<p><strong>Note:</strong> When unable to detect locale country code, it returns empty string.</p>\n<h3 id=\"appaddrecentdocumentpath-macos-windows\"><a href=\"#appaddrecentdocumentpath-macos-windows\"><code>app.addRecentDocument(path)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Adds <code>path</code> to the recent documents list.</p>\n<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>\n<h3 id=\"appclearrecentdocuments-macos-windows\"><a href=\"#appclearrecentdocuments-macos-windows\"><code>app.clearRecentDocuments()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Leere die zuletzt verwendete Dokumenten Liste.</p>\n<h3 id=\"appsetasdefaultprotocolclientprotocol-path-args\"><a href=\"#appsetasdefaultprotocolclientprotocol-path-args\"><code>app.setAsDefaultProtocolClient(protocol[, path, args])</code></a></h3>\n<ul>\n<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>\n<li><code>path</code> String (optional) <em>Windows</em> - The path to the Electron executable. Standardwert ist <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - Arguments passed to the executable. Defaults to an empty array</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the call succeeded.</p>\n<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>\n<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://www.electronforge.io/\">Electron Forge</a>, <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a>, or by editing <code>info.plist</code> with a text editor. Please refer to <a href=\"https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102207-TPXREF115\">Apple's documentation</a> for details.</p>\n<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://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol\">declare the protocol in your manifest</a>.</p>\n<p>The API uses the Windows Registry and <code>LSSetDefaultHandlerForURLScheme</code> internally.</p>\n<h3 id=\"appremoveasdefaultprotocolclientprotocol-path-args-macos-windows\"><a href=\"#appremoveasdefaultprotocolclientprotocol-path-args-macos-windows\"><code>app.removeAsDefaultProtocolClient(protocol[, path, args])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>protocol</code> String - The name of your protocol, without <code>://</code>.</li>\n<li><code>path</code> String (optional) <em>Windows</em> - Defaults to <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - Defaults to an empty array</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the call succeeded.</p>\n<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>\n<h3 id=\"appisdefaultprotocolclientprotocol-path-args\"><a href=\"#appisdefaultprotocolclientprotocol-path-args\"><code>app.isDefaultProtocolClient(protocol[, path, args])</code></a></h3>\n<ul>\n<li><code>protocol</code> String - The name of your protocol, without <code>://</code>.</li>\n<li><code>path</code> String (optional) <em>Windows</em> - Defaults to <code>process.execPath</code></li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - Defaults to an empty array</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the current executable is the default handler for a protocol (aka URI scheme).</p>\n<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://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme\">Apple's documentation</a> for details.</p>\n<p>The API uses the Windows Registry and <code>LSCopyDefaultHandlerForURLScheme</code> internally.</p>\n<h3 id=\"appgetapplicationnameforprotocolurl\"><a href=\"#appgetapplicationnameforprotocolurl\"><code>app.getApplicationNameForProtocol(url)</code></a></h3>\n<ul>\n<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>\n</ul>\n<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>\n<p>This method returns the application name of the default handler for the protocol (aka URI scheme) of a URL.</p>\n<h3 id=\"appgetapplicationinfoforprotocolurl-macos-windows\"><a href=\"#appgetapplicationinfoforprotocolurl-macos-windows\"><code>app.getApplicationInfoForProtocol(url)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<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>\n</ul>\n<p>Returns <code>Promise&#x3C;Object></code> - Resolve with an object containing the following:</p>\n<ul>\n<li><code>icon</code> NativeImage - the display icon of the app handling the protocol.</li>\n<li><code>path</code> String  - installation path of the app handling the protocol.</li>\n<li><code>name</code> String - display name of the app handling the protocol.</li>\n</ul>\n<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>\n<h3 id=\"appsetusertaskstasks-windows\"><a href=\"#appsetusertaskstasks-windows\"><code>app.setUserTasks(tasks)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>tasks</code> <a href=\"/docs/api/structures/task\">Task[]</a> - Array mit <code>Task</code> Objekten</li>\n</ul>\n<p>Adds <code>tasks</code> to the <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks\">Tasks</a> category of the Jump List on Windows.</p>\n<p><code>tasks</code> Ein Array mit <a href=\"/docs/api/structures/task\"><code>Task</code></a> Objekten.</p>\n<p>Returns <code>Boolean</code> - Whether the call succeeded.</p>\n<p><strong>Hinweis:</strong> Wenn du die Jump List weiter anpassen möchtest, dann verwende statt dessen die <code>app.setJumpList(categories)</code>.</p>\n<h3 id=\"appgetjumplistsettings-windows\"><a href=\"#appgetjumplistsettings-windows\"><code>app.getJumpListSettings()</code> <em>Windows</em></a></h3>\n<p>Gibt das <code>Object</code> zurück:</p>\n<ul>\n<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://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx\">MSDN docs</a>).</li>\n<li><code>removedItems</code> <a href=\"/docs/api/structures/jump-list-item\">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>\n</ul>\n<h3 id=\"appsetjumplistcategories-windows\"><a href=\"#appsetjumplistcategories-windows\"><code>app.setJumpList(categories)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>categories</code> <a href=\"/docs/api/structures/jump-list-category\">JumpListCategory[]</a> | <code>null</code> - Array of <code>JumpListCategory</code> objects.</li>\n</ul>\n<p>Sets or removes a custom Jump List for the application, and returns one of the following strings:</p>\n<ul>\n<li><code>ok</code> - Nichts ist schief gelaufen.</li>\n<li><code>error</code> - One or more errors occurred, enable runtime logging to figure out the likely cause.</li>\n<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>\n<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>\n<li><code>customCategoryAccessDeniedError</code> - Custom categories can't be added to the Jump List due to user privacy or group policy settings.</li>\n</ul>\n<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>\n<p><strong>Anmerkung:</strong> Wenn eine <code>JumpListCategory</code>Objekt nie den Typ <code>nie den &#x3C;code>Namen</code> hat Die eingestellte Funktion von seinem Typ <code> ist dann als &#x3C;code>tasks</code>wahrgenommen. Wenn die Eigenschaft <code>name</code> gesetzt ist, aber die Eigenschaft <code>type</code> weggelassen wird, dann wird angenommen, dass die Eigenschaft <code>type</code> <code>custom</code> ist.</p>\n<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>\n<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>\n<p>Hier ist ein einfaches Beispiel, wie man eine eigene Jump List anlegt:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setJumpList([\n  {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'custom'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Recent Projects'</span>,\n    <span class=\"hljs-attr\">items</span>: [\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'file'</span>, <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'C:\\\\Projects\\\\project1.proj'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'file'</span>, <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'C:\\\\Projects\\\\project2.proj'</span> }\n    ]\n  },\n  { <span class=\"hljs-comment\">// has a name so `type` is assumed to be \"custom\"</span>\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Tools'</span>,\n    <span class=\"hljs-attr\">items</span>: [\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Tool A'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--run-tool-a'</span>,\n        <span class=\"hljs-attr\">icon</span>: process.execPath,\n        <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Runs Tool A'</span>\n      },\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Tool B'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--run-tool-b'</span>,\n        <span class=\"hljs-attr\">icon</span>: process.execPath,\n        <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Runs Tool B'</span>\n      }\n    ]\n  },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'frequent'</span> },\n  { <span class=\"hljs-comment\">// has no name and no type so `type` is assumed to be \"tasks\"</span>\n    <span class=\"hljs-attr\">items</span>: [\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'New Project'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--new-project'</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Create a new project.'</span>\n      },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      {\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'task'</span>,\n        <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Recover Project'</span>,\n        <span class=\"hljs-attr\">program</span>: process.execPath,\n        <span class=\"hljs-attr\">args</span>: <span class=\"hljs-string\">'--recover-project'</span>,\n        <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Recover Project'</span>\n      }\n    ]\n  }\n])\n</code></pre>\n<h3 id=\"apprequestsingleinstancelock\"><a href=\"#apprequestsingleinstancelock\"><code>app.requestSingleInstanceLock()</code></a></h3>\n<p>Gibt <code>Boolean</code> zurück</p>\n<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>\n<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>\n<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>\n<p>An example of activating the window of primary instance when a second instance starts:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> myWindow = <span class=\"hljs-literal\">null</span>\n\n<span class=\"hljs-keyword\">const</span> gotTheLock = app.requestSingleInstanceLock()\n\n<span class=\"hljs-keyword\">if</span> (!gotTheLock) {\n  app.quit()\n} <span class=\"hljs-keyword\">else</span> {\n  app.on(<span class=\"hljs-string\">'second-instance'</span>, (event, commandLine, workingDirectory) => {\n    <span class=\"hljs-comment\">// Someone tried to run a second instance, we should focus our window.</span>\n    <span class=\"hljs-keyword\">if</span> (myWindow) {\n      <span class=\"hljs-keyword\">if</span> (myWindow.isMinimized()) myWindow.restore()\n      myWindow.focus()\n    }\n  })\n\n  <span class=\"hljs-comment\">// Create myWindow, load the rest of the app, etc...</span>\n  app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    myWindow = createWindow()\n  })\n}\n</code></pre>\n<h3 id=\"apphassingleinstancelock\"><a href=\"#apphassingleinstancelock\"><code>app.hasSingleInstanceLock()</code></a></h3>\n<p>Gibt <code>Boolean</code> zurück</p>\n<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>\n<h3 id=\"appreleasesingleinstancelock\"><a href=\"#appreleasesingleinstancelock\"><code>app.releaseSingleInstanceLock()</code></a></h3>\n<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>\n<h3 id=\"appsetuseractivitytype-userinfo-webpageurl-macos\"><a href=\"#appsetuseractivitytype-userinfo-webpageurl-macos\"><code>app.setUserActivity(type, userInfo[, webpageURL])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>type</code> String - Uniquely identifies the activity. Maped auf <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> any - App-specific state to store for use by another device.</li>\n<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>\n</ul>\n<p>Creates an <code>NSUserActivity</code> and sets it as the current activity. The activity is eligible for <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> to another device afterward.</p>\n<h3 id=\"appgetcurrentactivitytype-macos\"><a href=\"#appgetcurrentactivitytype-macos\"><code>app.getCurrentActivityType()</code> <em>macOS</em></a></h3>\n<p>Returns <code>String</code> - Typ der aktuell laufenden Aktivität.</p>\n<h3 id=\"appinvalidatecurrentactivity-macos\"><a href=\"#appinvalidatecurrentactivity-macos\"><code>app.invalidateCurrentActivity()</code> <em>macOS</em></a></h3>\n<p>Invalidates the current <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> user activity.</p>\n<h3 id=\"appresigncurrentactivity-macos\"><a href=\"#appresigncurrentactivity-macos\"><code>app.resignCurrentActivity()</code> <em>macOS</em></a></h3>\n<p>Marks the current <a href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html\">Handoff</a> user activity as inactive without invalidating it.</p>\n<h3 id=\"appupdatecurrentactivitytype-userinfo-macos\"><a href=\"#appupdatecurrentactivitytype-userinfo-macos\"><code>app.updateCurrentActivity(type, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>type</code> String - Uniquely identifies the activity. Maped auf <a href=\"https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType\"><code>NSUserActivity.activityType</code></a>.</li>\n<li><code>userInfo</code> any - App-specific state to store for use by another device.</li>\n</ul>\n<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>\n<h3 id=\"appsetappusermodelidid-windows\"><a href=\"#appsetappusermodelidid-windows\"><code>app.setAppUserModelId(id)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>id</code> Zeichenfolge</li>\n</ul>\n<p>Changes the <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> to <code>id</code>.</p>\n<h3 id=\"appsetactivationpolicypolicy-macos\"><a href=\"#appsetactivationpolicypolicy-macos\"><code>app.setActivationPolicy(policy)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>policy</code> String - Can be 'regular', 'accessory', or 'prohibited'.</li>\n</ul>\n<p>Sets the activation policy for a given app.</p>\n<p>Activation policy types:</p>\n<ul>\n<li>'regular' - The application is an ordinary app that appears in the Dock and may have a user interface.</li>\n<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>\n<li>'prohibited' - The application doesn’t appear in the Dock and may not create windows or be activated.</li>\n</ul>\n<h3 id=\"appimportcertificateoptions-callback-linux\"><a href=\"#appimportcertificateoptions-callback-linux\"><code>app.importCertificate(options, callback)</code> <em>Linux</em></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>certificate</code> String - Pfad zur pkcs12 Datei.</li>\n<li><code>password</code> String - Passphrase des Zertifikats.</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>result</code> Integer - Resultat des Imports.</li>\n</ul></li>\n</ul>\n<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://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">net_error_list</a>.</p>\n<h3 id=\"appconfigurehostresolveroptions\"><a href=\"#appconfigurehostresolveroptions\"><code>app.configureHostResolver(options)</code></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<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>\n<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>\n<li><code>secureDnsServers</code> String[] (optional) - A list of DNS-over-HTTP server templates. See <a href=\"https://datatracker.ietf.org/doc/html/rfc8484#section-3\">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://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&#x26;ss=chromium%2Fchromium%2Fsrc\">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>\n<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. Standard ist true.</li>\n</ul></li>\n</ul>\n<p>Configures host resolution (DNS and DNS-over-HTTPS). By default, the following resolvers will be used, in order:</p>\n<ol>\n<li>DNS-over-HTTPS, if the <a href=\"https://source.chromium.org/chromium/chromium/src/+/main:net/dns/public/doh_provider_entry.cc;l=31?q=%22DohProviderEntry::GetList()%22&#x26;ss=chromium%2Fchromium%2Fsrc\">DNS provider supports it</a>, then</li>\n<li>the built-in resolver (enabled on macOS only by default), then</li>\n<li>the system's resolver (e.g. <code>getaddrinfo</code>).</li>\n</ol>\n<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>\n<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>\n<pre><code class=\"hljs language-js\">app.configureHostResolver({\n  <span class=\"hljs-attr\">secureDnsMode</span>: <span class=\"hljs-string\">'secure'</span>,\n  <span class=\"hljs-attr\">secureDnsServers</span>: [\n    <span class=\"hljs-string\">'https://cloudflare-dns.com/dns-query'</span>\n  ]\n})\n</code></pre>\n<p>This API must be called after the <code>ready</code> event is emitted.</p>\n<h3 id=\"appdisablehardwareacceleration\"><a href=\"#appdisablehardwareacceleration\"><code>app.disableHardwareAcceleration()</code></a></h3>\n<p>Schaltet die Hardware Beschleunigung für die aktuelle App ab.</p>\n<p>Diese Methode kann nur vor dem Start der App aufgerufen werden.</p>\n<h3 id=\"appdisabledomainblockingfor3dapis\"><a href=\"#appdisabledomainblockingfor3dapis\"><code>app.disableDomainBlockingFor3DAPIs()</code></a></h3>\n<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>\n<p>Diese Methode kann nur vor dem Start der App aufgerufen werden.</p>\n<h3 id=\"appgetappmetrics\"><a href=\"#appgetappmetrics\"><code>app.getAppMetrics()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/process-metric\"><code>ProcessMetric[]</code></a>: Array of <code>ProcessMetric</code> objects that correspond to memory and CPU usage statistics of all the processes associated with the app.</p>\n<h3 id=\"appgetgpufeaturestatus\"><a href=\"#appgetgpufeaturestatus\"><code>app.getGPUFeatureStatus()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/gpu-feature-status\"><code>GPUFeatureStatus</code></a> - The Graphics Feature Status from <code>chrome://gpu/</code>.</p>\n<p><strong>Note:</strong> This information is only usable after the <code>gpu-info-update</code> event is emitted.</p>\n<h3 id=\"appgetgpuinfoinfotype\"><a href=\"#appgetgpuinfoinfotype\"><code>app.getGPUInfo(infoType)</code></a></h3>\n<ul>\n<li><code>infoType</code> String - Kann <code>basic</code> oder <code>complete</code> sein.</li>\n</ul>\n<p>Gibt das <code>Promise&#x3C;unknown></code> zurück</p>\n<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://chromium.googlesource.com/chromium/src/+/4178e190e9da409b055e5dff469911ec6f6b716f/gpu/config/gpu_info.cc\">chromium's GPUInfo object</a>. This includes the version and driver information that's shown on <code>chrome://gpu</code> page.</p>\n<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>\n<pre><code class=\"hljs language-js\">{\n  <span class=\"hljs-attr\">auxAttributes</span>:\n   {\n     <span class=\"hljs-attr\">amdSwitchable</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">canSupportThreadedTextureMailbox</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">directComposition</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">directRendering</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">glResetNotificationStrategy</span>: <span class=\"hljs-number\">0</span>,\n     <span class=\"hljs-attr\">inProcessGpu</span>: <span class=\"hljs-literal\">true</span>,\n     <span class=\"hljs-attr\">initializationTime</span>: <span class=\"hljs-number\">0</span>,\n     <span class=\"hljs-attr\">jpegDecodeAcceleratorSupported</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">optimus</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">passthroughCmdDecoder</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">sandboxed</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">softwareRendering</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">supportsOverlays</span>: <span class=\"hljs-literal\">false</span>,\n     <span class=\"hljs-attr\">videoDecodeAcceleratorFlags</span>: <span class=\"hljs-number\">0</span>\n   },\n  <span class=\"hljs-attr\">gpuDevice</span>:\n   [{ <span class=\"hljs-attr\">active</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">deviceId</span>: <span class=\"hljs-number\">26657</span>, <span class=\"hljs-attr\">vendorId</span>: <span class=\"hljs-number\">4098</span> },\n     { <span class=\"hljs-attr\">active</span>: <span class=\"hljs-literal\">false</span>, <span class=\"hljs-attr\">deviceId</span>: <span class=\"hljs-number\">3366</span>, <span class=\"hljs-attr\">vendorId</span>: <span class=\"hljs-number\">32902</span> }],\n  <span class=\"hljs-attr\">machineModelName</span>: <span class=\"hljs-string\">'MacBookPro'</span>,\n  <span class=\"hljs-attr\">machineModelVersion</span>: <span class=\"hljs-string\">'11.5'</span>\n}\n</code></pre>\n<p>Using <code>basic</code> should be preferred if only basic information like <code>vendorId</code> or <code>driverId</code> is needed.</p>\n<h3 id=\"appsetbadgecountcount-linux-macos\"><a href=\"#appsetbadgecountcount-linux-macos\"><code>app.setBadgeCount([count])</code> <em>Linux</em> <em>macOS</em></a></h3>\n<ul>\n<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>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the call succeeded.</p>\n<p>Sets the counter badge for current app. Setting the count to <code>0</code> will hide the badge.</p>\n<p>On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.</p>\n<p><strong>Note:</strong> Unity launcher requires a <code>.desktop</code> file to work. For more information, please read the <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Unity integration documentation</a>.</p>\n<h3 id=\"appgetbadgecount-linux-macos\"><a href=\"#appgetbadgecount-linux-macos\"><code>app.getBadgeCount()</code> <em>Linux</em> <em>macOS</em></a></h3>\n<p>Returns <code>Integer</code> - The current value displayed in the counter badge.</p>\n<h3 id=\"appisunityrunning-linux\"><a href=\"#appisunityrunning-linux\"><code>app.isUnityRunning()</code> <em>Linux</em></a></h3>\n<p>Returns <code>Boolean</code> - Whether the current desktop environment is Unity launcher.</p>\n<h3 id=\"appgetloginitemsettingsoptions-macos-windows\"><a href=\"#appgetloginitemsettingsoptions-macos-windows\"><code>app.getLoginItemSettings([options])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>path</code> String (optional) <em>Windows</em> - The executable path to compare against. Defaults to <code>process.execPath</code>.</li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - The command-line arguments to compare against. Defaults to an empty array.</li>\n</ul></li>\n</ul>\n<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>\n<p>Gibt das <code>Object</code> zurück:</p>\n<ul>\n<li><code>openAtLogin</code> Boolean - <code>true</code> wenn die App definiert wurde, sich bei Login zu öffnen.</li>\n<li><code>openAsHidden</code> Boolean <em>macOS</em> - <code>true</code> if the app is set to open as hidden at login. This setting is not available on <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>wasOpenedAtLogin</code> Boolean <em>macOS</em> - <code>true</code> if the app was opened at login automatically. This setting is not available on <a href=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>wasOpenedAsHidden</code> Boolean <em>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=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>restoreState</code> Boolean <em>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=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>executableWillLaunchAtLogin</code> Boolean <em>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>\n<li><code>launchItems</code> Object[] <em>Windows</em><ul>\n<li><code>name</code> String <em>Windows</em> - name value of a registry entry.</li>\n<li><code>path</code> String <em>Windows</em> - The executable to an app that corresponds to a registry entry.</li>\n<li><code>args</code> String[] <em>Windows</em> - the command-line arguments to pass to the executable.</li>\n<li><code>scope</code> String <em>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>\n<li><code>enabled</code> Boolean <em>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>\n</ul></li>\n</ul>\n<h3 id=\"appsetloginitemsettingssettings-macos-windows\"><a href=\"#appsetloginitemsettingssettings-macos-windows\"><code>app.setLoginItemSettings(settings)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>settings</code> Object<ul>\n<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>\n<li><code>openAsHidden</code> Boolean (optional) <em>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=\"/docs/tutorial/mac-app-store-submission-guide\">MAS builds</a>.</li>\n<li><code>path</code> String (optional) <em>Windows</em> - The executable to launch at login. Defaults to <code>process.execPath</code>.</li>\n<li><code>args</code> String<a href=\"/docs/api/optional\"></a> <em>Windows</em> - The command-line arguments to pass to the executable. Defaults to an empty array. Take care to wrap paths in quotes.</li>\n<li><code>enabled</code> Boolean (optional) <em>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>\n<li><code>name</code> String (optional) <em>Windows</em> - value name to write into registry. Defaults to the app's AppUserModelId(). Set the app's login item settings.</li>\n</ul></li>\n</ul>\n<p>To work with Electron's <code>autoUpdater</code> on Windows, which uses <a href=\"https://github.com/Squirrel/Squirrel.Windows\">Squirrel</a>, you'll want to set the launch path to Update.exe, and pass arguments that specify your application name. Ein Beispiel:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> appFolder = path.dirname(process.execPath)\n<span class=\"hljs-keyword\">const</span> updateExe = path.resolve(appFolder, <span class=\"hljs-string\">'..'</span>, <span class=\"hljs-string\">'Update.exe'</span>)\n<span class=\"hljs-keyword\">const</span> exeName = path.basename(process.execPath)\n\napp.setLoginItemSettings({\n  <span class=\"hljs-attr\">openAtLogin</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">path</span>: updateExe,\n  <span class=\"hljs-attr\">args</span>: [\n    <span class=\"hljs-string\">'--processStart'</span>, <span class=\"hljs-string\">`\"<span class=\"hljs-subst\">${exeName}</span>\"`</span>,\n    <span class=\"hljs-string\">'--process-start-args'</span>, <span class=\"hljs-string\">`\"--hidden\"`</span>\n  ]\n})\n</code></pre>\n<h3 id=\"appisaccessibilitysupportenabled-macos-windows\"><a href=\"#appisaccessibilitysupportenabled-macos-windows\"><code>app.isAccessibilitySupportEnabled()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<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://www.chromium.org/developers/design-documents/accessibility\">https://www.chromium.org/developers/design-documents/accessibility</a> for more details.</p>\n<h3 id=\"appsetaccessibilitysupportenabledenabled-macos-windows\"><a href=\"#appsetaccessibilitysupportenabledenabled-macos-windows\"><code>app.setAccessibilitySupportEnabled(enabled)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>enabled</code> Boolean - Enable or disable <a href=\"https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree\">accessibility tree</a> rendering</li>\n</ul>\n<p>Manually enables Chrome's accessibility support, allowing to expose accessibility switch to users in application settings. See <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">Chromium's accessibility docs</a> for more details. Disabled by default.</p>\n<p>This API must be called after the <code>ready</code> event is emitted.</p>\n<p><strong>Note:</strong> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.</p>\n<h3 id=\"appshowaboutpanel\"><a href=\"#appshowaboutpanel\"><code>app.showAboutPanel()</code></a></h3>\n<p>Show the app's about panel options. These options can be overridden with <code>app.setAboutPanelOptions(options)</code>.</p>\n<h3 id=\"appsetaboutpaneloptionsoptions\"><a href=\"#appsetaboutpaneloptionsoptions\"><code>app.setAboutPanelOptions(options)</code></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>applicationName</code> String (optional) - Der Name der App.</li>\n<li><code>applicationVersion</code> String (optional) - Die Version der App.</li>\n<li><code>copyright</code> String (optional) - Copyright Information.</li>\n<li><code>version</code> String (optional) <em>macOS</em> - The app's build version number.</li>\n<li><code>credits</code> String (optional) <em>macOS</em> <em>Windows</em> - Credit information.</li>\n<li><code>authors</code> String<a href=\"/docs/api/optional\"></a> <em>Linux</em> - List of app authors.</li>\n<li><code>website</code> String (optional) <em>Linux</em> - The app's website.</li>\n<li><code>iconPath</code> String (optional) <em>Linux</em> <em>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>\n</ul></li>\n</ul>\n<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://developer.apple.com/reference/appkit/nsapplication/1428479-orderfrontstandardaboutpanelwith?language=objc\">Apple docs</a> for more details. On Linux, values must be set in order to be shown; there are no defaults.</p>\n<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://developer.apple.com/documentation/appkit/nsaboutpaneloptioncredits?language=objc\">documentation</a> for more information.</p>\n<h3 id=\"appisemojipanelsupported\"><a href=\"#appisemojipanelsupported\"><code>app.isEmojiPanelSupported()</code></a></h3>\n<p>Returns <code>Boolean</code> - whether or not the current OS version allows for native emoji pickers.</p>\n<h3 id=\"appshowemojipanel-macos-windows\"><a href=\"#appshowemojipanel-macos-windows\"><code>app.showEmojiPanel()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Show the platform's native emoji picker.</p>\n<h3 id=\"appstartaccessingsecurityscopedresourcebookmarkdata-mas\"><a href=\"#appstartaccessingsecurityscopedresourcebookmarkdata-mas\"><code>app.startAccessingSecurityScopedResource(bookmarkData)</code> <em>mas</em></a></h3>\n<ul>\n<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>\n</ul>\n<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://developer.apple.com/reference/foundation/nsurl/1417051-startaccessingsecurityscopedreso?language=objc\">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>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Start accessing the file.</span>\n<span class=\"hljs-keyword\">const</span> stopAccessingSecurityScopedResource = app.startAccessingSecurityScopedResource(data)\n<span class=\"hljs-comment\">// You can now access the file outside of the sandbox 🎉</span>\n\n<span class=\"hljs-comment\">// Remember to stop accessing the file once you've finished with it.</span>\nstopAccessingSecurityScopedResource()\n</code></pre>\n<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://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">Apple's documentation</a> for a description of how this system works.</p>\n<h3 id=\"appenablesandbox\"><a href=\"#appenablesandbox\"><code>app.enableSandbox()</code></a></h3>\n<p>Aktiviert den vollen Sandbox-Modus auf der App. This means that all renderers will be launched sandboxed, regardless of the value of the <code>sandbox</code> flag in WebPreferences.</p>\n<p>Diese Methode kann nur vor dem Start der App aufgerufen werden.</p>\n<h3 id=\"appisinapplicationsfolder-macos\"><a href=\"#appisinapplicationsfolder-macos\"><code>app.isInApplicationsFolder()</code> <em>macOS</em></a></h3>\n<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>\n<h3 id=\"appmovetoapplicationsfolderoptions-macos\"><a href=\"#appmovetoapplicationsfolderoptions-macos\"><code>app.moveToApplicationsFolder([options])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>conflictHandler</code> Function\\<boolean> (optional) - A handler for potential conflict in move failure.<ul>\n<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>\n</ul></boolean></li>\n</ul></li>\n</ul>\n<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>\n<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=\"/docs/api/dialog\"><code>dialog</code></a> API.</p>\n<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>\n<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>\n<p>Ein Beispiel:</p>\n<pre><code class=\"hljs language-js\">app.moveToApplicationsFolder({\n  <span class=\"hljs-attr\">conflictHandler</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">conflictType</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (conflictType === <span class=\"hljs-string\">'exists'</span>) {\n      <span class=\"hljs-keyword\">return</span> dialog.showMessageBoxSync({\n        <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'question'</span>,\n        <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Halt Move'</span>, <span class=\"hljs-string\">'Continue Move'</span>],\n        <span class=\"hljs-attr\">defaultId</span>: <span class=\"hljs-number\">0</span>,\n        <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'An app of this name already exists'</span>\n      }) === <span class=\"hljs-number\">1</span>\n    }\n  }\n})\n</code></pre>\n<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>\n<h3 id=\"appissecurekeyboardentryenabled-macos\"><a href=\"#appissecurekeyboardentryenabled-macos\"><code>app.isSecureKeyboardEntryEnabled()</code> <em>macOS</em></a></h3>\n<p>Returns <code>Boolean</code> - whether <code>Secure Keyboard Entry</code> is enabled.</p>\n<p>By default this API will return <code>false</code>.</p>\n<h3 id=\"appsetsecurekeyboardentryenabledenabled-macos\"><a href=\"#appsetsecurekeyboardentryenabledenabled-macos\"><code>app.setSecureKeyboardEntryEnabled(enabled)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>enabled</code> Boolean - Enable or disable <code>Secure Keyboard Entry</code></li>\n</ul>\n<p>Set the <code>Secure Keyboard Entry</code> is enabled in your application.</p>\n<p>By using this API, important information such as password and other sensitive information can be prevented from being intercepted by other processes.</p>\n<p>See <a href=\"https://developer.apple.com/library/archive/technotes/tn2150/_index.html\">Apple's documentation</a> for more details.</p>\n<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>\n<h2 id=\"eigenschaften\"><a href=\"#eigenschaften\">Eigenschaften</a></h2>\n<h3 id=\"appaccessibilitysupportenabled-macos-windows\"><a href=\"#appaccessibilitysupportenabled-macos-windows\"><code>app.accessibilitySupportEnabled</code> <em>macOS</em> <em>Windows</em></a></h3>\n<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>\n<p>See <a href=\"https://www.chromium.org/developers/design-documents/accessibility\">Chromium's accessibility docs</a> for more details. Disabled by default.</p>\n<p>This API must be called after the <code>ready</code> event is emitted.</p>\n<p><strong>Note:</strong> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.</p>\n<h3 id=\"appapplicationmenu\"><a href=\"#appapplicationmenu\"><code>app.applicationMenu</code></a></h3>\n<p>A <code>Menu | null</code> property that returns <a href=\"/docs/api/menu\"><code>Menu</code></a> if one has been set and <code>null</code> otherwise. Users can pass a <a href=\"/docs/api/menu\">Menu</a> to set this property.</p>\n<h3 id=\"appbadgecount-linux-macos\"><a href=\"#appbadgecount-linux-macos\"><code>app.badgeCount</code> <em>Linux</em> <em>macOS</em></a></h3>\n<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>\n<p>On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher.</p>\n<p><strong>Note:</strong> Unity launcher requires a <code>.desktop</code> file to work. For more information, please read the <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Unity integration documentation</a>.</p>\n<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>\n<h3 id=\"appcommandline-readonly\"><a href=\"#appcommandline-readonly\"><code>app.commandLine</code> <em>Readonly</em></a></h3>\n<p>A <a href=\"/docs/api/command-line\"><code>CommandLine</code></a> object that allows you to read and manipulate the command line arguments that Chromium uses.</p>\n<h3 id=\"appdock-macos-readonly\"><a href=\"#appdock-macos-readonly\"><code>app.dock</code> <em>macOS</em> <em>Readonly</em></a></h3>\n<p>A <a href=\"/docs/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>\n<h3 id=\"appispackaged-readonly\"><a href=\"#appispackaged-readonly\"><code>app.isPackaged</code> <em>Readonly</em></a></h3>\n<p>Eine <code>Boolean</code> Eigenschaft, die <code>true</code> zurückgegeben, wenn die App gepackt ist, ansonsten <code>false</code>. Für viele Apps kann diese Eigenschaft verwendet werden, um Entwicklungs- und Produktionsumgebungen zu unterscheiden.</p>\n<h3 id=\"appname\"><a href=\"#appname\"><code>app.name</code></a></h3>\n<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>\n<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>\n<h3 id=\"appuseragentfallback\"><a href=\"#appuseragentfallback\"><code>app.userAgentFallback</code></a></h3>\n<p>A <code>String</code> which is the user agent string Electron will use as a global fallback.</p>\n<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>\n<h3 id=\"apprunningunderrosettatranslation-macos-readonly-deprecated\"><a href=\"#apprunningunderrosettatranslation-macos-readonly-deprecated\"><code>app.runningUnderRosettaTranslation</code> <em>macOS</em> <em>Readonly</em> <em>Deprecated</em></a></h3>\n<p>A <code>Boolean</code> which when <code>true</code> indicates that the app is currently running under the <a href=\"https://en.wikipedia.org/wiki/Rosetta_(software)\">Rosetta Translator Environment</a>.</p>\n<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>\n<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>\n<h3 id=\"apprunningunderarm64translation-readonly-macos-windows\"><a href=\"#apprunningunderarm64translation-readonly-macos-windows\"><code>app.runningUnderARM64Translation</code> <em>Readonly</em> <em>macOS</em> <em>Windows</em></a></h3>\n<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://en.wikipedia.org/wiki/Rosetta_(software)\">Rosetta Translator Environment</a> or Windows <a href=\"https://en.wikipedia.org/wiki/Windows_on_Windows\">WOW</a>).</p>\n<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>",
      "title": "app",
      "description": "Kontrolliere den Ereignisverlauf deiner Anwendung."
    },
    "/docs/tutorial/application-debugging": {
      "locale": "de-DE",
      "slug": "application-debugging",
      "href": "/docs/tutorial/application-debugging",
      "crowdinFileId": "256175",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/application-debugging.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"anwendungs-debugging\"><a href=\"#anwendungs-debugging\">Anwendungs Debugging</a></h1>\n<p>Wann auch immer deine Electron App sich nicht so verhält wie gewünscht, dann stehen dir eine Vielzahl von Debugging-Tools zur Verfügung um Fehler im Code, einen Flaschenhals für die Pervormance oder Möglichkeiten zur Optimierung zu finden.</p>\n<h2 id=\"renderer-prozess\"><a href=\"#renderer-prozess\">Renderer-Prozess</a></h2>\n<p>Das umfassendste Tool zum Debuggen individueller Render-Pozesse ist das Chromium Developer Toolset. Das Toolset steht zur Verfügung in allen Render-Prozessen, inklusive Instanzen von <code>BrowserWindow</code>, <code>BrowserView</code> und <code>WebView</code>. Du kannst diese programmatisch öffnen durch Aufruf der <code>openDevTools()</code> API auf <code>webContents</code> der Instanz:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.openDevTools()\n</code></pre>\n<p>Google bietet <a href=\"https://developer.chrome.com/devtools\">ausgezeichnete Dokumentation für ihre Entwickler-Tools</a>. Wir empfehlen Ihnen, sich mit ihnen vertraut zu machen - sie sind in der Regel ein der leistungsstärksten Werkzeuge in jedem Werkzeuggurt von Electron Developer.</p>\n<h2 id=\"main-prozess\"><a href=\"#main-prozess\">Main-Prozess</a></h2>\n<p>Debugging des Main-Prozess ist etwas schwieriger, denn du kannst die Developer Tools hier nicht öffnen. Die Chromium Developer Tools können verwendet werden um <a href=\"https://nodejs.org/en/docs/inspector/\">Electrons Main-Prozess zu Debuggen</a> dank einer engen Zusammenarbeit zwischen Google / Chrome und Node.js. Du wirst aber vielleicht auch auf Eigenartiges stoßen, so ist <code>require</code> zum Beispiel nicht verfügbar in der Console.</p>\n<p>Für weitere Informationen, ließ einfach die <a href=\"/docs/tutorial/debugging-main-process\">Debugging des Main-Prozess</a> Dokumentation.</p>\n<h2 id=\"v8-abstürze\"><a href=\"#v8-abstürze\">V8 Abstürze</a></h2>\n<p>Wenn der V8-Kontext abstützen sollte, wird folgende Nachricht in DevTools angezeigt:</p>\n<p><code>DevTools was disconnected from the page. Once page is reloaded, DevTools will automatically reconnect.</code></p>\n<p>Chromium Logs können durch das Einstellen der Umgebungsvariabel <code>ELECTRON_ENABLE_LOGGING</code> aktiviert werden. Weitere Informationen könenn in der <a href=\"/docs/api/environment-variables#electron_enable_logging\">Dokumentation zu den Umgebungsvariablen</a> gefunden werden.</p>\n<p>Alternativ kann dies aber auch durch das Argument <code>--enable-logging</code> im Terminal aktiviert werden. Weitere Informationen hierzu kann in der <a href=\"/docs/api/command-line-switches#--enable-loggingfile\">Dokumentation der Konsolen-Argumente</a> gefunden werden.</p>",
      "title": "Anwendungs Debugging",
      "description": ""
    },
    "/docs/tutorial/application-distribution": {
      "locale": "de-DE",
      "slug": "application-distribution",
      "href": "/docs/tutorial/application-distribution",
      "crowdinFileId": "256177",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/application-distribution.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"veröffentlichung-der-anwendung\"><a href=\"#veröffentlichung-der-anwendung\">Veröffentlichung der Anwendung</a></h1>\n<h2 id=\"übersicht\"><a href=\"#übersicht\">Übersicht</a></h2>\n<p>To distribute your app with Electron, you need to package and rebrand it. To do this, you can either use specialized tooling or manual approaches.</p>\n<h2 id=\"with-tooling\"><a href=\"#with-tooling\">With tooling</a></h2>\n<p>You can use the following tools to distribute your application:</p>\n<ul>\n<li><a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a></li>\n<li><a href=\"https://github.com/electron-userland/electron-builder\">electron-builder</a></li>\n<li><a href=\"https://github.com/electron/electron-packager\">electron-packager</a></li>\n</ul>\n<p>These tools will take care of all the steps you need to take to end up with a distributable Electron application, such as bundling your application, rebranding the executable, and setting the right icons.</p>\n<p>You can check the example of how to package your app with <code>electron-forge</code> in the <a href=\"/docs/tutorial/quick-start#package-and-distribute-your-application\">Quick Start guide</a>.</p>\n<h2 id=\"manuelle-verteilung\"><a href=\"#manuelle-verteilung\">Manuelle Verteilung</a></h2>\n<h3 id=\"with-prebuilt-binaries\"><a href=\"#with-prebuilt-binaries\">With prebuilt binaries</a></h3>\n<p>To distribute your app manually, you need to download Electron's <a href=\"https://github.com/electron/electron/releases\">prebuilt binaries</a>. Als nächstes sollte der Ordner, der die App beinhaltet, <code>app</code> genannt werden und in das Electron-Resources-Verzeichnis verschoben werden, wie in den unten stehenden Beispielen zu erkennnen ist.</p>\n<blockquote>\n<p><em>NOTE:</em> the location of Electron's prebuilt binaries is indicated with <code>electron/</code> in the examples below.</p>\n</blockquote>\n<p><em>Unter macOS:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/Electron.app/Contents/Resources/app/\n├── package.json\n├── main.js\n└── index.html\n</code></pre>\n<p><em>Unter Windows und Linux:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/resources/app\n├── package.json\n├── main.js\n└── index.html\n</code></pre>\n<p>Then execute <code>Electron.app</code> on macOS, <code>electron</code> on Linux, or <code>electron.exe</code> on Windows, and Electron will start as your app. The <code>electron</code> directory will then be your distribution to deliver to users.</p>\n<h3 id=\"with-an-app-source-code-archive\"><a href=\"#with-an-app-source-code-archive\">With an app source code archive</a></h3>\n<p>Instead of from shipping your app by copying all of its source files, you can package your app into an <a href=\"https://github.com/electron/asar\">asar</a> archive to improve the performance of reading files on platforms like Windows, if you are not already using a bundler such as Parcel or Webpack.</p>\n<p>Um ein <code>asar</code>-Archiv zu nutzen, um den <code>app</code> Ordner zu ersetzen, müssen Sie das Archiv in <code>app.asar</code> umbenennen und, wie unten, in das Resources-Verzeichnis von Electron verschieben. Erst dann wird Electron versuchen das Archiv zu lesen und daraus starten.</p>\n<p><em>Unter macOS:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/Electron.app/Contents/Resources/\n└── app.asar\n</code></pre>\n<p><em>Unter Windows und Linux:</em></p>\n<pre><code class=\"hljs language-plaintext\">electron/resources/\n└── app.asar\n</code></pre>\n<p>You can find more details on how to use <code>asar</code> in the <a href=\"https://github.com/electron/asar\"><code>electron/asar</code> repository</a>.</p>\n<h3 id=\"rebranding-with-downloaded-binaries\"><a href=\"#rebranding-with-downloaded-binaries\">Rebranding with downloaded binaries</a></h3>\n<p>Nachdem Sie Ihre App in Electron gebündelt haben, sollten Sie Electron umbennen, bevor Sie es an Ihre Nutzer weiterreichen.</p>\n<h4 id=\"macos\"><a href=\"#macos\">macOS</a></h4>\n<p>Sie können <code>Electron.app</code> einen beliebigen Namen geben, aber Sie müssen zusätzlich die Felder <code>CFBundleDisplayName</code>, <code>CFBundleIdentifier</code> und <code>CFBundleName</code> in den folgenden Dateien umbenennen:</p>\n<ul>\n<li><code>Electron.app/Contents/Info.plist</code></li>\n<li><code>Electron.app/Contents/Frameworks/Electron Helper.app/Contents/Info.plist</code></li>\n</ul>\n<p>Sie können desweiteren die 'Helper App' von Electron umbenennen um das Auftauchen von <code>Electron Helper</code> im Activity Monitor zu vermeiden. Stellen Sie dabei sicher, dass Sie die ausführbare Datei der 'Helper App' umbenannt haben.</p>\n<p>Die Struktur der umbenannten App könnte so aussehen:</p>\n<pre><code class=\"hljs language-plaintext\">MyApp.app/Contents\n├── Info.plist\n├── MacOS/\n│   └── MyApp\n└── Frameworks/\n    └── MyApp Helper.app\n        ├── Info.plist\n        └── MacOS/\n            └── MyApp Helper\n</code></pre>\n<h4 id=\"windows\"><a href=\"#windows\">Windows</a></h4>\n<p>Sie können <code>electron.exe</code> einen beliebigen Namen geben und das Icon der App bzw. weitere Metadaten mit Tools wie <a href=\"https://github.com/electron/rcedit\">rcedit</a> bearbeiten.</p>\n<h4 id=\"linux\"><a href=\"#linux\">Linux</a></h4>\n<p>Sie können der ausführbaren <code>electron</code>-Datei einen beliebigen Namen geben.</p>\n<h3 id=\"rebranding-by-rebuilding-electron-from-source\"><a href=\"#rebranding-by-rebuilding-electron-from-source\">Rebranding by rebuilding Electron from source</a></h3>\n<p>Es ist auch möglich Electron zu rebranden, indem man den Produktnamen ändert und es vom Sourcecode buildet. Um dies zu Tun müssen sie das Buildargument, das zum Produktnamen gehört (<code>electron_product_name = \"IhrProduktName\"</code>) in der <code>args.gn</code> Datei setzen und rebuilden.</p>",
      "title": "Veröffentlichung der Anwendung",
      "description": "NOTE: the location of Electron's prebuilt binaries is indicated with electron/ in the examples below."
    },
    "/docs/api/auto-updater": {
      "locale": "de-DE",
      "slug": "auto-updater",
      "href": "/docs/api/auto-updater",
      "crowdinFileId": "256281",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/auto-updater.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"autoupdater\"><a href=\"#autoupdater\">autoUpdater</a></h1>\n<blockquote>\n<p>Aktivieren Sie Apps, um sich automatisch selbst zu aktualisieren.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p><strong>Siehe auch: <a href=\"/docs/tutorial/updates\">Eine detaillierte Anleitung zur Implementierung von Updates in Ihrer Anwendung</a>.</strong></p>\n<p><code>autoUpdater</code> ist ein <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h2 id=\"plattform-hinweise\"><a href=\"#plattform-hinweise\">Plattform-Hinweise</a></h2>\n<p>Aktuell werden nur macOS und Windows unterstützt. Da es keinen eingebauten auto-updater auf den meisten Linux-Basierenden Betriebssystemen gibt, wird empfohlen, den eingebauten Pakete-Verwalter der Distribution zu verwenden, um die App zu updaten.</p>\n<p>Außerdem gibt es auf jeder Plattform einige subtile Unterschiede:</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>Unter MacOS basiert das <code>autoUpdater</code> Modul auf <a href=\"https://github.com/Squirrel/Squirrel.Mac\"> Squirrel.Mac</a>, was bedeutet daß keine spezifische Konfiguration vonnöten ist. Für serverseitige Anforderungen können Sie <a href=\"https://github.com/Squirrel/Squirrel.Mac#server-support\">Serverunterstützung</a> lesen. Beachten Sie, dass <a href=\"https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW35\">App-Transportsicherheit</a> (ATS) für alle Anforderungen gilt, die im Rahmen des Aktualisierungsprozesses vorgenommen werden. Apps, die ATS deaktivieren müssen, können den Schlüssel <code>NSAllowsArbitraryLoads</code> zu ihrer App hinzufügen.</p>\n<p><strong>Notiz</strong>: Eine App muss zuerst signiert werden, um automatisch auf macOS updatet zu werden. Dies ist eine Voraussetzung von <code>Squirrel.Mac</code>.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<p>Unter Windows muss die App zuerst auf dem Gerät des Benutzers installiert werden, bevor <code>autoUpdater</code> genutzt werden kann. Deswegen wird empfohlen <a href=\"https://github.com/electron/windows-installer\">electron-winstaller</a>, <a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a> oder <a href=\"https://github.com/electron/grunt-electron-installer\">grunt-electron-installer</a> zu verwenden, um einen Installer zu generieren.</p>\n<p>Bei der Benutzung von <a href=\"https://github.com/electron/windows-installer\">electron-winstaller</a> oder <a href=\"https://github.com/electron-userland/electron-forge\">electron-forge</a> ist zu Beachten, dass die App nicht versucht, sich selbst zu update, wenn sie <a href=\"https://github.com/electron/windows-installer#handling-squirrel-events\">zum Ersten mal ausgeführt wird</a> (Weitere Informationen in diesem <a href=\"https://github.com/electron/electron/issues/7155\">issue</a>). Es wird auch empfohlen, <a href=\"https://github.com/mongodb-js/electron-squirrel-startup\">electron-squirrel-startup</a> zu verwenden, um Desktop-Verknüpfungen für Ihre App zu erhalten.</p>\n<p>Der Squirrel-Installer wird eine Desktop-Verknüpfung erstellen mit der <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> im Format <code>com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE</code>, zum Beispiel: <code>com.squirrel.slack.Slack</code> oder <code>com.squirrel.code.Code</code>. Sie müssen dieselbe ID für Ihre App mit der <code>app.setAppUserModelId</code> API verwenden, da Windows sonst Ihre App nicht ordnungsgemäß in der Taskleiste anheften kann.</p>\n<p>Like Squirrel.Mac, Windows can host updates on S3 or any other static file host. Weitere Informationen können in der Dokumentation von <a href=\"https://github.com/Squirrel/Squirrel.Windows\">Squirrel.Windows</a> gefunden werden.</p>\n<h2 id=\"ereignisse\"><a href=\"#ereignisse\">Ereignisse</a></h2>\n<p>Das <code>autoUpdater</code> - Object gibt die folgenden Ereignisse aus:</p>\n<h3 id=\"event-error\"><a href=\"#event-error\">Event: 'error'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>error</code> Fehler</li>\n</ul>\n<p>Wird gesendet, wenn beim Aktualisieren ein Fehler auftritt.</p>\n<h3 id=\"ereignis--nach-updates-suchen\"><a href=\"#ereignis--nach-updates-suchen\">Ereignis : \"Nach Updates suchen\"</a></h3>\n<p>Wird gesendet, wenn geprüft wird, ob ein Update gestartet wurde.</p>\n<h3 id=\"ereignis--update-verfügbar\"><a href=\"#ereignis--update-verfügbar\">Ereignis : 'Update-verfügbar'</a></h3>\n<p>Wird ausgelöst, wenn ein Update verfügbar ist. Das Update wird automatisch heruntergeladen.</p>\n<h3 id=\"ereignis--update-nicht-verfügbar\"><a href=\"#ereignis--update-nicht-verfügbar\">Ereignis : \"Update nicht verfügbar\"</a></h3>\n<p>Wird gesendet, wenn kein Update verfügbar ist.</p>\n<h3 id=\"ereignis--update-download\"><a href=\"#ereignis--update-download\">Ereignis : 'Update-Download'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>releaseNotes</code> String</li>\n<li><code>releaseName</code> String</li>\n<li><code>releaseDate</code> Date</li>\n<li><code>updateURL</code> String</li>\n</ul>\n<p>Wird gesendet, wenn ein Update heruntergeladen wurde.</p>\n<p>Unter Windows ist nur <code>releaseName</code> verfügbar.</p>\n<p><strong>Hinweis:</strong> Es ist nicht unbedingt notwendig, dieses Ereignis zu behandeln. Ein fehlerfreie Heruntergeladenes Update wird automatisch übernommen, wenn die App das nächste mal gestartet wird.</p>\n<h3 id=\"ereignis-before-quit-for-update\"><a href=\"#ereignis-before-quit-for-update\">Ereignis: 'before-quit-for-update'</a></h3>\n<p>Dieses Event wird ausgelöst, wenn die Funktion <code>quitAndInstall()</code> aufgerufen wird.</p>\n<p>Das <code>before-quit</code> Event wird erst ausgelöst nachdem alle Fenster geschlossen sind. Daher sollten Sie Aktionen, die Sie vor dem Beenden Ihrer Anwendung ausführen möchten, sowohl in diesem Event als auch im <code>before-quit</code> Event einbauen.</p>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das Objekt <code>autoUpdater</code> verfügt über die folgenden Methoden:</p>\n<h3 id=\"autoupdatersetfeedurloptionen\"><a href=\"#autoupdatersetfeedurloptionen\"><code>autoUpdater.setFeedURL(optionen)</code></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>url</code> String</li>\n<li><code>headers</code> Record&#x3C;String, String> (optional) <em>macOS</em> - HTTP-Anfrage-Header.</li>\n<li><code>serverType</code> String (optional) <em>macOS</em> - Kann <code>json</code> oder <code>default</code> sein, siehe dazu <a href=\"https://github.com/Squirrel/Squirrel.Mac\">Squirrel.Mac</a> README für weitere informationen.</li>\n</ul></li>\n</ul>\n<p>Setzt die <code>url</code> und initialisiert den automatischen Updater.</p>\n<h3 id=\"autoupdatergetfeedurl\"><a href=\"#autoupdatergetfeedurl\"><code>autoUpdater.getFeedURL()</code></a></h3>\n<p>Gibt <code>String</code> - Die aktuelle URL des Aktualisierungsfeeds.</p>\n<h3 id=\"autoupdatercheckforupdates\"><a href=\"#autoupdatercheckforupdates\"><code>autoUpdater.checkForUpdates()</code></a></h3>\n<p>Fragt den Server, ob es ein Update gibt. Es muss zuerst <code>setFeedURL</code> aufrufen werden, bevor diese API verwendet werden kann.</p>\n<p><strong>Note:</strong> If an update is available it will be downloaded automatically. Calling <code>autoUpdater.checkForUpdates()</code> twice will download the update two times.</p>\n<h3 id=\"autoupdaterquitandinstall\"><a href=\"#autoupdaterquitandinstall\"><code>autoUpdater.quitAndInstall()</code></a></h3>\n<p>Startet die App neu und installiert damit das Update, sofern es heruntergeladen wurde. Diese Funktion sollte nur aufgerufen werden, nachdem <code>update-downloaded</code> ausgelöst wurde.</p>\n<p>Unter der Haube schließt <code>autoUpdater.quitAndInstall()</code> zuerst alle Fenster und führt danach automatisch <code>app.quit()</code> aus.</p>\n<p><strong>Hinweis.</strong>: Es ist nicht unbedingt notwendig, diese Funktion auszulösen, denn ein fehlerfrei heruntergeladenes Update wird immer automatisch installiert, wenn die App das nächste mal startet.</p>",
      "title": "autoUpdater",
      "description": "Aktivieren Sie Apps, um sich automatisch selbst zu aktualisieren."
    },
    "/docs/tutorial/automated-testing-with-a-custom-driver": {
      "locale": "de-DE",
      "slug": "automated-testing-with-a-custom-driver",
      "href": "/docs/tutorial/automated-testing-with-a-custom-driver",
      "crowdinFileId": "256179",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/automated-testing-with-a-custom-driver.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"automatisiertes-testen-mit-einem-benutzerdefinierten-treiber\"><a href=\"#automatisiertes-testen-mit-einem-benutzerdefinierten-treiber\">Automatisiertes Testen mit einem benutzerdefinierten Treiber</a></h1>\n<p>To write automated tests for your Electron app, you will need a way to \"drive\" your application. <a href=\"https://electronjs.org/spectron\">Spectron</a> is a commonly-used solution which lets you emulate user actions via <a href=\"https://webdriver.io/\">WebDriver</a>. However, it's also possible to write your own custom driver using node's builtin IPC-over-STDIO. The benefit of a custom driver is that it tends to require less overhead than Spectron, and lets you expose custom methods to your test suite.</p>\n<p>To create a custom driver, we'll use Node.js' <a href=\"https://nodejs.org/api/child_process.html\">child_process</a> API. The test suite will spawn the Electron process, then establish a simple messaging protocol:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> childProcess = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'child_process'</span>)\n<span class=\"hljs-keyword\">const</span> electronPath = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// spawn the process</span>\n<span class=\"hljs-keyword\">const</span> env = { <span class=\"hljs-comment\">/* ... */</span> }\n<span class=\"hljs-keyword\">const</span> stdio = [<span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'ipc'</span>]\n<span class=\"hljs-keyword\">const</span> appProcess = childProcess.spawn(electronPath, [<span class=\"hljs-string\">'./app'</span>], { stdio, env })\n\n<span class=\"hljs-comment\">// listen for IPC messages from the app</span>\nappProcess.on(<span class=\"hljs-string\">'message'</span>, (msg) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// send an IPC message to the app</span>\nappProcess.send({ <span class=\"hljs-attr\">my</span>: <span class=\"hljs-string\">'message'</span> })\n</code></pre>\n<p>From within the Electron app, you can listen for messages and send replies using the Node.js <a href=\"https://nodejs.org/api/process.html\">process</a> API:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// listen for IPC messages from the test suite</span>\nprocess.on(<span class=\"hljs-string\">'message'</span>, (msg) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// send an IPC message to the test suite</span>\nprocess.send({ <span class=\"hljs-attr\">my</span>: <span class=\"hljs-string\">'message'</span> })\n</code></pre>\n<p>We can now communicate from the test suite to the Electron app using the <code>appProcess</code> object.</p>\n<p>For convenience, you may want to wrap <code>appProcess</code> in a driver object that provides more high-level functions. Here is an example of how you can do this:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">TestDriver</span> </span>{\n  <span class=\"hljs-keyword\">constructor</span> ({ path, args, env }) {\n    <span class=\"hljs-keyword\">this</span>.rpcCalls = []\n\n    <span class=\"hljs-comment\">// start child process</span>\n    env.APP_TEST_DRIVER = <span class=\"hljs-number\">1</span> <span class=\"hljs-comment\">// let the app know it should listen for messages</span>\n    <span class=\"hljs-keyword\">this</span>.process = childProcess.spawn(path, args, { <span class=\"hljs-attr\">stdio</span>: [<span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'inherit'</span>, <span class=\"hljs-string\">'ipc'</span>], env })\n\n    <span class=\"hljs-comment\">// handle rpc responses</span>\n    <span class=\"hljs-keyword\">this</span>.process.on(<span class=\"hljs-string\">'message'</span>, (message) => {\n      <span class=\"hljs-comment\">// pop the handler</span>\n      <span class=\"hljs-keyword\">const</span> rpcCall = <span class=\"hljs-keyword\">this</span>.rpcCalls[message.msgId]\n      <span class=\"hljs-keyword\">if</span> (!rpcCall) <span class=\"hljs-keyword\">return</span>\n      <span class=\"hljs-keyword\">this</span>.rpcCalls[message.msgId] = <span class=\"hljs-literal\">null</span>\n      <span class=\"hljs-comment\">// reject/resolve</span>\n      <span class=\"hljs-keyword\">if</span> (message.reject) rpcCall.reject(message.reject)\n      <span class=\"hljs-keyword\">else</span> rpcCall.resolve(message.resolve)\n    })\n\n    <span class=\"hljs-comment\">// wait for ready</span>\n    <span class=\"hljs-keyword\">this</span>.isReady = <span class=\"hljs-keyword\">this</span>.rpc(<span class=\"hljs-string\">'isReady'</span>).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">err</span>) =></span> {\n      <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Application failed to start'</span>, err)\n      <span class=\"hljs-keyword\">this</span>.stop()\n      process.exit(<span class=\"hljs-number\">1</span>)\n    })\n  }\n\n  <span class=\"hljs-comment\">// simple RPC call</span>\n  <span class=\"hljs-comment\">// to use: driver.rpc('method', 1, 2, 3).then(...)</span>\n  <span class=\"hljs-keyword\">async</span> rpc (cmd, ...args) {\n    <span class=\"hljs-comment\">// send rpc request</span>\n    <span class=\"hljs-keyword\">const</span> msgId = <span class=\"hljs-keyword\">this</span>.rpcCalls.length\n    <span class=\"hljs-keyword\">this</span>.process.send({ msgId, cmd, args })\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\">(<span class=\"hljs-params\">resolve, reject</span>) =></span> <span class=\"hljs-keyword\">this</span>.rpcCalls.push({ resolve, reject }))\n  }\n\n  stop () {\n    <span class=\"hljs-keyword\">this</span>.process.kill()\n  }\n}\n</code></pre>\n<p>In the app, you'd need to write a simple handler for the RPC calls:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">if</span> (process.env.APP_TEST_DRIVER) {\n  process.on(<span class=\"hljs-string\">'message'</span>, onMessage)\n}\n\n<span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">onMessage</span> (<span class=\"hljs-params\">{ msgId, cmd, args }</span>) </span>{\n  <span class=\"hljs-keyword\">let</span> method = METHODS[cmd]\n  <span class=\"hljs-keyword\">if</span> (!method) method = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Invalid method: '</span> + cmd)\n  <span class=\"hljs-keyword\">try</span> {\n    <span class=\"hljs-keyword\">const</span> resolve = <span class=\"hljs-keyword\">await</span> method(...args)\n    process.send({ msgId, resolve })\n  } <span class=\"hljs-keyword\">catch</span> (err) {\n    <span class=\"hljs-keyword\">const</span> reject = {\n      <span class=\"hljs-attr\">message</span>: err.message,\n      <span class=\"hljs-attr\">stack</span>: err.stack,\n      <span class=\"hljs-attr\">name</span>: err.name\n    }\n    process.send({ msgId, reject })\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> METHODS = {\n  isReady () {\n    <span class=\"hljs-comment\">// do any setup needed</span>\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-comment\">// define your RPC-able methods here</span>\n}\n</code></pre>\n<p>Then, in your test suite, you can use your test-driver as follows:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> test = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'ava'</span>)\n<span class=\"hljs-keyword\">const</span> electronPath = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> app = <span class=\"hljs-keyword\">new</span> TestDriver({\n  <span class=\"hljs-attr\">path</span>: electronPath,\n  <span class=\"hljs-attr\">args</span>: [<span class=\"hljs-string\">'./app'</span>],\n  <span class=\"hljs-attr\">env</span>: {\n    <span class=\"hljs-attr\">NODE_ENV</span>: <span class=\"hljs-string\">'test'</span>\n  }\n})\ntest.before(<span class=\"hljs-keyword\">async</span> t => {\n  <span class=\"hljs-keyword\">await</span> app.isReady\n})\ntest.after.always(<span class=\"hljs-string\">'cleanup'</span>, <span class=\"hljs-keyword\">async</span> t => {\n  <span class=\"hljs-keyword\">await</span> app.stop()\n})\n</code></pre>",
      "title": "Automatisiertes Testen mit einem benutzerdefinierten Treiber",
      "description": ""
    },
    "/docs/development/azure-vm-setup": {
      "locale": "de-DE",
      "slug": "azure-vm-setup",
      "href": "/docs/development/azure-vm-setup",
      "crowdinFileId": "256129",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/azure-vm-setup.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"updating-an-appveyor-azure-image\"><a href=\"#updating-an-appveyor-azure-image\">Updating an Appveyor Azure Image</a></h1>\n<p>Electron CI on Windows uses AppVeyor, which in turn uses Azure VM images to run.  Occasionally, these VM images need to be updated due to changes in Chromium requirements.  In order to update you will need <a href=\"https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6\">PowerShell</a> and the <a href=\"https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-1.8.0&#x26;viewFallbackFrom=azurermps-6.13.0\">Azure PowerShell module</a>.</p>\n<p>Occasionally we need to update these images owing to changes in Chromium or other miscellaneous build requirement changes.</p>\n<p>Example Use Case:\n* We need <code>VS15.9</code> and we have <code>VS15.7</code> installed; this would require us to update an Azure image.</p>\n<ol>\n<li>\n<p>Identify the image you wish to modify.</p>\n<ul>\n<li>In <a href=\"https://github.com/electron/electron/blob/main/appveyor.yml\">appveyor.yml</a>, the image is identified by the property <em>image</em>.<ul>\n<li>The names used correspond to the <em>\"images\"</em> defined for a build cloud, eg the <a href=\"https://windows-ci.electronjs.org/build-clouds/8\">libcc-20 cloud</a>.</li>\n</ul></li>\n<li>Find the image you wish to modify in the build cloud and make note of the <strong>VHD Blob Path</strong> for that image, which is the value for that corresponding key.<ul>\n<li>You will need this URI path to copy into a new image.</li>\n</ul></li>\n<li>You will also need the storage account name which is labeled in AppVeyor as the <strong>Disk Storage Account Name</strong></li>\n</ul>\n</li>\n<li>\n<p>Get the Azure storage account key</p>\n<ul>\n<li>Log into Azure using credentials stored in LastPass (under Azure Enterprise) and then find the storage account corresponding to the name found in AppVeyor.<ul>\n<li>Example, for <code>appveyorlibccbuilds</code> <strong>Disk Storage Account Name</strong> you'd look for <code>appveyorlibccbuilds</code> in the list of storage accounts @ Home &#x3C; Storage Accounts<ul>\n<li>Click into it and look for <code>Access Keys</code>, and then you can use any of the keys present in the list.</li>\n</ul></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Get the full virtual machine image URI from Azure</p>\n<ul>\n<li>Navigate to Home &#x3C; Storage Accounts &#x3C; <code>$ACCT_NAME</code> &#x3C; Blobs &#x3C; Images<ul>\n<li>In the following list, look for the VHD path name you got from Appveyor and then click on it.<ul>\n<li>Copy the whole URL from the top of the subsequent window.</li>\n</ul></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Copy the image using the <a href=\"https://github.com/appveyor/ci/blob/master/scripts/enterprise/copy-master-image-azure.ps1\">Copy Master Image PowerShell script</a>.</p>\n<ul>\n<li>It is essential to copy the VM because if you spin up a VM against an image that image cannot at the same time be used by AppVeyor.</li>\n<li>Use the storage account name, key, and URI obtained from Azure to run this script.<ul>\n<li>See Step 3 for URI &#x26; when prompted, press enter to use same storage account as destination.</li>\n<li>Use default destination container name <code>(images)</code></li>\n<li>Also, when naming the copy, use a name that indicates what the new image will contain (if that has changed) and date stamp.<ul>\n<li>Ex. <code>libcc-20core-vs2017-15.9-2019-04-15.vhd</code></li>\n</ul></li>\n</ul></li>\n<li>Go into Azure and get the URI for the newly created image as described in a previous step</li>\n</ul>\n</li>\n<li>\n<p>Spin up a new VM using the <a href=\"https://github.com/appveyor/ci/blob/master/scripts/enterprise/create_master_vm_from_vhd.ps1\">Create Master VM from VHD PowerShell</a>.</p>\n<ul>\n<li>From PowerShell, execute <code>ps1</code> file with <code>./create_master_vm_from_vhd.ps1</code></li>\n<li>You will need the credential information available in the AppVeyor build cloud definition.<ul>\n<li>This includes:<ul>\n<li>Client ID</li>\n<li>Client Secret</li>\n<li>Tenant ID</li>\n<li>Subscription ID</li>\n<li>Resource Group</li>\n<li>Virtual Network</li>\n</ul></li>\n</ul></li>\n<li>You will also need to specify<ul>\n<li>Master VM name - just a unique name to identify the temporary VM</li>\n<li>Master VM size - use <code>Standard_F32s_v2</code></li>\n<li>Master VHD URI - use URI obtained @ end of previous step</li>\n<li>Location use <code>East US</code></li>\n</ul></li>\n</ul>\n</li>\n<li>\n<p>Log back into Azure and find the VM you just created in Home &#x3C; Virtual Machines &#x3C; <code>$YOUR_NEW_VM</code></p>\n<ul>\n<li>You can download a RDP (Remote Desktop) file to access the VM.</li>\n</ul>\n</li>\n<li>\n<p>Using Microsoft Remote Desktop, click <code>Connect</code> to connect to the VM.</p>\n<ul>\n<li>Credentials for logging into the VM are found in LastPass under the <code>AppVeyor Enterprise master VM</code> credentials.</li>\n</ul>\n</li>\n<li>\n<p>Modify the VM as required.</p>\n</li>\n<li>\n<p>Shut down the VM and then delete it in Azure.</p>\n</li>\n<li>\n<p>Add the new image to the Appveyor Cloud settings or modify an existing image to point to the new VHD.</p>\n</li>\n</ol>",
      "title": "Updating an Appveyor Azure Image",
      "description": ""
    },
    "/docs/api/structures/bluetooth-device": {
      "locale": "de-DE",
      "slug": "bluetooth-device",
      "href": "/docs/api/structures/bluetooth-device",
      "crowdinFileId": "256411",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/bluetooth-device.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"bluetoothdevice-object\"><a href=\"#bluetoothdevice-object\">BluetoothDevice Object</a></h1>\n<ul>\n<li><code>deviceName</code> String</li>\n<li><code>deviceId</code> String</li>\n</ul>",
      "title": "BluetoothDevice Object",
      "description": ""
    },
    "/docs/tutorial/boilerplates-and-clis": {
      "locale": "de-DE",
      "slug": "boilerplates-and-clis",
      "href": "/docs/tutorial/boilerplates-and-clis",
      "crowdinFileId": "256181",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/boilerplates-and-clis.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"boilerplates-und-clis\"><a href=\"#boilerplates-und-clis\">Boilerplates und CLIs</a></h1>\n<p>Die Entwicklung von Electron ist nicht dogmatisch - es gibt nicht \"die richtige Methode\", um eine Electron-Anwendung zu entwickeln, bauen, verpacken oder veröffentlichen. Zusätzliche Funktionen für Electron, sowohl für die Build- als auch für die Laufzeit, können im <a href=\"https://www.npmjs.com/search?q=electron\">npm</a> in Form von individuellen Paketen gefunden werden, was Entwicklern erlaubt, sowohl App als auch Build-Pipeline zu erstellen, die sie brauchen.</p>\n<p>Dieses Level an Modularität und Erweiterbarkeit stellt sicher, dass jede Entwickler, die mit Electron arbeiten, im kleinem wie auch im großen Team, zu keinem Zeitpunkt in ihrem Entwicklungszyklus in dem was sie tun oder nicht tun können eingeschränkt sind. Allerdings können von der Community getragene Boilerplates oder Befehlszeilentools das Kompilieren, Verpacken und Veröffentlichen einer App für viele Entwickler erheblich vereinfachen.</p>\n<h2 id=\"boilerplate-vs-cli\"><a href=\"#boilerplate-vs-cli\">Boilerplate vs CLI</a></h2>\n<p>\"Boilerplates\" kann man sich wie eine unbemalte Leinwand vorstellen, die als Einstiegspunkt für die Entwicklung einer Anwendung dienen. Sie liegen in der Regel in Form eines Repositories vor, das man klonen und anschließend nach eigenen Wünschen individualisieren kann.</p>\n<p>Kommandozeilenwerkzeuge (CLI) hingegen unterstützen den Entwickler auch weiterhin während den verschiedenen Phasen der Entwicklung und Veröffentlichung. Sie sind hilfreicher und wirken unterstützend, erzwingen aber diverse Richtlinien bezogen auf den Aufbau und die Struktur des Programms. <em>Speziell für Anfänger ist die Verwendung eines Befehlszeilenwerkzeugs häufig hilfreich</em>.</p>\n<h2 id=\"electron-forge\"><a href=\"#electron-forge\">electron-forge</a></h2>\n<p>Ein \"vollständiges Werkzeug für die Erstellung moderner Electron-Anwendungen\". Electron Forge vereint die vorhandenen (und gut gepflegten) Build-Werkzeuge für die Electron-Entwicklung in ein zusammenhängendes Paket, mit dessen Hilfe jeder direkt in die Electron-Entwicklung einsteigen kann.</p>\n<p>Forge wird mit <a href=\"https://electronforge.io/templates\">einer einsatzbereiten Schablone</a> geliefert und nutzt Webpack als Modul-Packer. Es enthält eine beispielhafte TypeScript-Konfiguration und bietet zwei Konfigurationsdateien, um so eine einfache Anpassung zu ermöglichen. It uses the same core modules used by the greater Electron community (like <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>) – changes made by Electron maintainers (like Slack) benefit Forge's users, too.</p>\n<p>Weitere Informationen und die Dokumentation ist auf <a href=\"https://electronforge.io/\">electronforge.io</a> verfügbar.</p>\n<h2 id=\"electron-builder\"><a href=\"#electron-builder\">electron-builder</a></h2>\n<p>A \"complete solution to package and build a ready-for-distribution Electron app\" that focuses on an integrated experience. <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> adds one single dependency focused on simplicity and manages all further requirements internally.</p>\n<p><code>electron-builder</code> replaces features and modules used by the Electron maintainers (such as the auto-updater) with custom ones. They are generally tighter integrated but will have less in common with popular Electron apps like Atom, Visual Studio Code, or Slack.</p>\n<p>You can find more information and documentation in <a href=\"https://github.com/electron-userland/electron-builder\">the repository</a>.</p>\n<h2 id=\"electron-react-boilerplate\"><a href=\"#electron-react-boilerplate\">electron-react-boilerplate</a></h2>\n<p>Wenn du kein Tool benötigst, sondern nur ein stabiles Fundament auf dem du bauen kannst, dann könnte CT Lins <a href=\"https://github.com/chentsulin/electron-react-boilerplate\"><code>electron-react-boilerplate</code></a> einen Blick wert sein. Es ist recht beliebt in der Community und verwendet intern <code>elektron-builder</code>.</p>\n<h2 id=\"andere-tools-und-boilerplates\"><a href=\"#andere-tools-und-boilerplates\">Andere Tools und Boilerplates</a></h2>\n<p>The <a href=\"https://github.com/sindresorhus/awesome-electron#boilerplates\">\"Awesome Electron\" list</a> contains more tools and boilerplates to choose from. Wenn du die Länge der Liste einschüchternd findest, vergesse nicht, dass das spätere Hinzufügen von Tools auch ein brauchbarer Ansatz ist.</p>",
      "title": "Boilerplates und CLIs",
      "description": ""
    },
    "/docs/breaking-changes": {
      "locale": "de-DE",
      "slug": "breaking-changes",
      "href": "/docs/breaking-changes",
      "crowdinFileId": "256117",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/breaking-changes.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"breaking-changes\"><a href=\"#breaking-changes\">Breaking Changes</a></h1>\n<p>Breaking-Änderungen werden hier dokumentiert, und Veraltungswarnungen werden js-Code nach Möglichkeit hinzugefügt, mindestens <a href=\"/docs/tutorial/electron-versioning#semver\">eine Hauptversion</a>, bevor die Änderung vorgenommen wird.</p>\n<h3 id=\"typen-von-breaking-änderungen\"><a href=\"#typen-von-breaking-änderungen\">Typen von Breaking-Änderungen</a></h3>\n<p>In diesem Dokument wird die folgende Konvention zur Kategorisierung von Breaking-Änderungen verwendet:</p>\n<ul>\n<li><strong>API geändert:</strong> Die API wurde so geändert, dass Code, der nicht aktualisiert wurde, garantiert eine Ausnahme wirft.</li>\n<li><strong>Verhalten geändert:</strong> Das Verhalten von Electron hat sich geändert, aber nicht so, dass eine Ausnahme unbedingt geworfen wird.</li>\n<li><strong>Standard geändert:</strong> Code, der vom alten Standardwert abhängig ist, funktioniert möglicherweise nicht mehr und wirft nicht notwendigerweise eine Ausnahme. Das alte Verhalten kann durch explizite Angabe des Wertes wiederhergestellt werden.</li>\n<li><strong>Veraltet:</strong> Eine API wurde als veraltet markiert. Die API wird weiterhin funktionieren, sendet aber eine Veraltungswarnung aus und wird in einer zukünftigen Version entfernt.</li>\n<li><strong>Entfernt:</strong> Eine API oder Funktion wurde entfernt und wird von Electron nicht mehr unterstützt.</li>\n</ul>\n<h2 id=\"geplante-bruch-api-änderungen-140\"><a href=\"#geplante-bruch-api-änderungen-140\">Geplante Bruch-API-Änderungen (14.0)</a></h2>\n<h3 id=\"removed-remote-module\"><a href=\"#removed-remote-module\">Removed: <code>remote</code> module</a></h3>\n<p>The <code>remote</code> module was deprecated in Electron 12, and will be removed in Electron 14. It is replaced by the <a href=\"https://github.com/electron/remote\"><code>@electron/remote</code></a> module.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 12:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Replace with:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote'</span>)\n\n<span class=\"hljs-comment\">// In the main process:</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote/main'</span>).initialize()\n</code></pre>\n<h3 id=\"entfernt-appallowrendererprocessreuse\"><a href=\"#entfernt-appallowrendererprocessreuse\">Entfernt: <code>app.allowRendererProcessReuse</code></a></h3>\n<p>The <code>app.allowRendererProcessReuse</code> property will be removed as part of our plan to more closely align with Chromium's process model for security, performance and maintainability.</p>\n<p>Weitere Informationen findest du unter <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"entfernt-browserfenster-affinität\"><a href=\"#entfernt-browserfenster-affinität\">Entfernt: Browserfenster-Affinität</a></h3>\n<p>Die Einstellung <code>Affinität</code> beim Erstellen eines neuen <code>BrowserWindow</code> wird entfernt als Teil unseres Plans, sich stärker an das Prozessmodell von Chromium für Sicherheit, Leistung und Wartbarkeit anzupassen.</p>\n<p>Weitere Informationen findest du unter <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"api-geändert-windowopen\"><a href=\"#api-geändert-windowopen\">API geändert: <code>window.open()</code></a></h3>\n<p>Der optionale Parameter <code>FrameName</code> legt nicht mehr den Titel des Fensters fest. Dies folgt nun der Spezifikation, die in der <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters\">nativen Dokumentation</a> unter dem zugehörigen Parameter <code>windowName</code> beschrieben wird.</p>\n<p>Wenn Sie diesen Parameter verwenden, um den Titel eines Fensters festzulegen, können Sie stattdessen <a href=\"/docs/api/browser-window#winsettitletitle\">win.setTitle(title)</a> verwenden.</p>\n<h3 id=\"entfernt-worldsafeexecutejavascript\"><a href=\"#entfernt-worldsafeexecutejavascript\">Entfernt: <code>worldSafeExecuteJavaScript</code></a></h3>\n<p>In Electron 14 wird <code>worldSafeExecuteJavaScript</code> entfernt.  Es gibt keine Alternative, bitte stelle sicher, dass dein Code mit dieser Eigenschaft funktioniert.  Es wurde standardmäßig aktiviert, da Electron\n12.</p>\n<p>Sie werden von dieser Änderung betroffen sein, wenn Sie entweder <code>webFrame.executeJavaScript</code> oder <code>webFrame.executeJavaScriptInIsolatedWorld</code> verwenden. Sie müssen sicherstellen, dass die von einer dieser Methoden zurückgegebenen Werte von der <a href=\"/docs/api/context-bridge#parameter--error--return-type-support\">Context Bridge API</a> unterstützt werden, da diese Methoden denselben Wert verwenden, der die Semantik übergeht.</p>\n<h3 id=\"standardwert-geändert-nativewindowopen-ist-standardmäßig-auf-true-eingestellt\"><a href=\"#standardwert-geändert-nativewindowopen-ist-standardmäßig-auf-true-eingestellt\">Standardwert geändert: <code>nativeWindowOpen</code> ist standardmäßig auf <code>true</code> eingestellt</a></h3>\n<p>Prior to Electron 14, <code>window.open</code> was by default shimmed to use <code>BrowserWindowProxy</code>. This meant that <code>window.open('about:blank')</code> did not work to open synchronously scriptable child windows, among other incompatibilities. <code>nativeWindowOpen</code> is no longer experimental, and is now the default.</p>\n<p>See the documentation for <a href=\"/docs/api/window-open\">window.open in Electron</a> for more details.</p>\n<h3 id=\"removed-browserwindowconstructoroptions-inheriting-from-parent-windows\"><a href=\"#removed-browserwindowconstructoroptions-inheriting-from-parent-windows\">Removed: BrowserWindowConstructorOptions inheriting from parent windows</a></h3>\n<p>Prior to Electron 14, windows opened with <code>window.open</code> would inherit BrowserWindow constructor options such as <code>transparent</code> and <code>resizable</code> from their parent window. Beginning with Electron 14, this behavior is removed, and windows will not inherit any BrowserWindow constructor options from their parents.</p>\n<p>Instead, explicitly set options for the new window with <code>setWindowOpenHandler</code>:</p>\n<pre><code class=\"hljs language-js\">webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n  <span class=\"hljs-keyword\">return</span> {\n    <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span>,\n    <span class=\"hljs-attr\">overrideBrowserWindowOptions</span>: {\n      <span class=\"hljs-comment\">// ...</span>\n    }\n  }\n})\n</code></pre>\n<h3 id=\"entfernt-additionalfeatures\"><a href=\"#entfernt-additionalfeatures\">Entfernt: <code>additionalFeatures</code></a></h3>\n<p>The deprecated <code>additionalFeatures</code> property in the <code>new-window</code> and <code>did-create-window</code> events of WebContents has been removed. Since <code>new-window</code> uses positional arguments, the argument is still present, but will always be the empty array <code>[]</code>. (Though note, the <code>new-window</code> event itself is deprecated, and is replaced by <code>setWindowOpenHandler</code>.) Bare keys in window features will now present as keys with the value <code>true</code> in the options object.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 14</span>\n<span class=\"hljs-comment\">// Triggered by window.open('...', '', 'my-key')</span>\nwebContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (<span class=\"hljs-built_in\">window</span>, details) => {\n  <span class=\"hljs-keyword\">if</span> (details.additionalFeatures.includes(<span class=\"hljs-string\">'my-key'</span>)) {\n    <span class=\"hljs-comment\">// ...</span>\n  }\n})\n\n<span class=\"hljs-comment\">// Replace with</span>\nwebContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (<span class=\"hljs-built_in\">window</span>, details) => {\n  <span class=\"hljs-keyword\">if</span> (details.options[<span class=\"hljs-string\">'my-key'</span>]) {\n    <span class=\"hljs-comment\">// ...</span>\n  }\n})\n</code></pre>\n<h2 id=\"geplante-bruch-api-änderungen-130\"><a href=\"#geplante-bruch-api-änderungen-130\">Geplante Bruch-API-Änderungen (13.0)</a></h2>\n<h3 id=\"api-geändert-sessionsetpermissioncheckhandlerhandler\"><a href=\"#api-geändert-sessionsetpermissioncheckhandlerhandler\">API geändert: <code>session.setPermissionCheckHandler(handler)</code></a></h3>\n<p>Die <code>Handler</code> Methoden ersten Parameters waren zuvor immer ein <code>webContents</code>, es kann jetzt manchmal <code>null</code> sein.  Sie sollten die <code>requestingOrigin</code>, <code>einbettenOrigin</code> und <code>securityOrigin</code> Eigenschaften verwenden, um auf die Berechtigungsprüfung korrekt zu reagieren.  Da der <code>Webcontent</code> <code>null sein kann</code> nicht mehr auf ihn angewiesen werden.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Alter Code</span>\nsession.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (webContents.getURL().startsWith(<span class=\"hljs-string\">'https://google.com/'</span>) &#x26;&#x26; permission === <span class=\"hljs-string\">'notification'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n\n<span class=\"hljs-comment\">// Ersetzen mit</span>\nsession.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(requestingOrigin).hostname === <span class=\"hljs-string\">'google.com'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notification'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n  }\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n</code></pre>\n<h3 id=\"entfernt-shellmoveitemtotrash\"><a href=\"#entfernt-shellmoveitemtotrash\">Entfernt: <code>shell.moveItemToTrash()</code></a></h3>\n<p>Die veraltete synchrone <code>shell.moveItemToTrash()</code> API wurde entfernt. Verwende stattdessen die asynchrone <code>shell.trashItem()</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Entfernt in Electron 13</span>\nshell.moveItemTosh(path)\n<span class=\"hljs-comment\">// Ersetzen durch</span>\nshell.trashItem(path).then(<span class=\"hljs-comment\">/* ... */</span>)\n</code></pre>\n<h3 id=\"entfernt-browserwindow-erweiterungs-apis\"><a href=\"#entfernt-browserwindow-erweiterungs-apis\">Entfernt: <code>BrowserWindow</code> Erweiterungs-APIs</a></h3>\n<p>Die veralteten Erweiterungs-APIs wurden entfernt:</p>\n<ul>\n<li><code>BrowserWindow.addExtension(path)</code></li>\n<li><code>BrowserWindow.addDevToolsExtension(path)</code></li>\n<li><code>BrowserWindow.removeExtension(name)</code></li>\n<li><code>BrowserWindow.removeDevToolsExtension(name)</code></li>\n<li><code>BrowserWindow.getExtensions()</code></li>\n<li><code>BrowserWindow.getDevToolsExtensions()</code></li>\n</ul>\n<p>Use the session APIs instead:</p>\n<ul>\n<li><code>ses.loadExtension(path)</code></li>\n<li><code>ses.removeExtension(extension_id)</code></li>\n<li><code>ses.getAllExtensions()</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// In Electron 13 entfernt</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// Ersetzen durch</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// In Electron 13 entfernt</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// Ersetzen durch</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// In Electron 13 entfernt</span>\nBrowserWindow.getExtensions()\nBrowserWindow.getDevToolsExtensions()\n<span class=\"hljs-comment\">// Ersetzen durch</span>\nsession.defaultSession.getAllExtensions()\n</code></pre>\n<h3 id=\"eliminado-métodos-en-systempreferences\"><a href=\"#eliminado-métodos-en-systempreferences\">Eliminado: métodos en <code>systemPreferences</code></a></h3>\n<p>Die folgenden <code>systemPreferences</code> Methoden wurden veraltet:</p>\n<ul>\n<li><code>systemPreferences.isDarkMode()</code></li>\n<li><code>systemPreferences.isInvertedColorScheme()</code></li>\n<li><code>systemPreferences.isHighContrastColorScheme()</code></li>\n</ul>\n<p>Verwende stattdessen die folgenden <code>nativeTheme</code> Eigenschaften:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code></li>\n<li><code>nativeTheme.shouldUseInvertedColorScheme</code></li>\n<li><code>nativeTheme.shouldUseHighContrastColors</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Entfernt in Electron 13</span>\nsystemPreferences.isDarkMode()\n<span class=\"hljs-comment\">// Ersetzen durch</span>\nnativeTheme.shouldUseDarkColors\n\n<span class=\"hljs-comment\">// Entfernt in Electron 13</span>\nsystemPreferences. sInvertedColorScheme()\n<span class=\"hljs-comment\">// Ersetzen durch</span>\nnativeTheme.shouldUseInvertedColorScheme\n\n<span class=\"hljs-comment\">// In Electron 13 entfernt</span>\nsystemPreferences.isHighContrastColorScheme()\n<span class=\"hljs-comment\">// Ersetzen durch</span>\nnativeTheme.shouldUseHighContrastColorColorScheme\n</code></pre>\n<h3 id=\"veraltet-webcontents-new-window-ereignis\"><a href=\"#veraltet-webcontents-new-window-ereignis\">Veraltet: WebContents <code>new-window</code> Ereignis</a></h3>\n<p>Das <code>new-window</code> Ereignis von WebContents wurde veraltet. It is replaced by <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler()</code></a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Veraltet in Electron 13</span>\nwebContents.on(<span class=\"hljs-string\">'new-window'</span>, (event) => {\n  event. reventDefault()\n})\n\n<span class=\"hljs-comment\">// Ersetzen durch</span>\nwebContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n</code></pre>\n<h2 id=\"geplante-bruch-api-änderungen-120\"><a href=\"#geplante-bruch-api-änderungen-120\">Geplante Bruch-API-Änderungen (12.0)</a></h2>\n<h3 id=\"entfernt-pepper-flash-unterstützung\"><a href=\"#entfernt-pepper-flash-unterstützung\">Entfernt: Pepper Flash Unterstützung</a></h3>\n<p>Chromium hat die Unterstützung für Flash entfernt, und deshalb müssen wir diesem Beispiel folgen. Weitere Details findest du in der <a href=\"https://www.chromium.org/flash-roadmap\">Flash-Roadmap</a> von Chromium.</p>\n<h3 id=\"standardwert-geändert-worldsafeexecutejavascript-ist-standardmäßig-auf-true-eingestellt\"><a href=\"#standardwert-geändert-worldsafeexecutejavascript-ist-standardmäßig-auf-true-eingestellt\">Standardwert geändert: <code>worldSafeExecuteJavaScript</code> ist standardmäßig auf <code>true</code> eingestellt</a></h3>\n<p>In Electron 12, <code>worldSafeExecuteJavaScript</code> wird standardmäßig aktiviert.  Um das vorherige Verhalten wiederherzustellen, muss <code>worldSafeExecuteJavaScript: false</code> in WebPreferences angegeben werden. Bitte beachte, dass die Einstellung dieser Option auf <code>false</code> <strong>unsicher</strong> ist.</p>\n<p>Diese Einstellung wird in Electron 14 entfernt, also migriere bitte deinen Code um den Standardwert zu unterstützen.</p>\n<h3 id=\"default-changed-contextisolation-defaults-to-true\"><a href=\"#default-changed-contextisolation-defaults-to-true\">Default Changed: <code>contextIsolation</code> defaults to <code>true</code></a></h3>\n<p>In Electron 12, <code>contextIsolation</code> will be enabled by default.  To restore the previous behavior, <code>contextIsolation: false</code> must be specified in WebPreferences.</p>\n<p>We <a href=\"/docs/tutorial/security#3-enable-context-isolation-for-remote-content\">recommend having contextIsolation enabled</a> for the security of your application.</p>\n<p>Another implication is that <code>require()</code> cannot be used in the renderer process unless <code>nodeIntegration</code> is <code>true</code> and <code>contextIsolation</code> is <code>false</code>.</p>\n<p>For more details see: <a href=\"https://github.com/electron/electron/issues/23506\">https://github.com/electron/electron/issues/23506</a></p>\n<h3 id=\"entfernt-crashreportergetcrashesdirectory\"><a href=\"#entfernt-crashreportergetcrashesdirectory\">Entfernt: <code>crashReporter.getCrashesDirectory()</code></a></h3>\n<p>The <code>crashReporter.getCrashesDirectory</code> method has been removed. Usage should be replaced by <code>app.getPath('crashDumps')</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 12</span>\ncrashReporter.getCrashesDirectory()\n<span class=\"hljs-comment\">// Replace with</span>\napp.getPath(<span class=\"hljs-string\">'crashDumps'</span>)\n</code></pre>\n<h3 id=\"removed-crashreporter-methods-in-the-renderer-process\"><a href=\"#removed-crashreporter-methods-in-the-renderer-process\">Removed: <code>crashReporter</code> methods in the renderer process</a></h3>\n<p>The following <code>crashReporter</code> methods are no longer available in the renderer process:</p>\n<ul>\n<li><code>crashReporter.start</code></li>\n<li><code>crashReporter.getLastCrashReport</code></li>\n<li><code>crashReporter.getUploadedReports</code></li>\n<li><code>crashReporter.getUploadToServer</code></li>\n<li><code>crashReporter.setUploadToServer</code></li>\n<li><code>crashReporter.getCrashesDirectory</code></li>\n</ul>\n<p>They should be called only from the main process.</p>\n<p>See <a href=\"https://github.com/electron/electron/pull/23265\">#23265</a> for more details.</p>\n<h3 id=\"default-changed-crashreporterstart-compress-true-\"><a href=\"#default-changed-crashreporterstart-compress-true-\">Default Changed: <code>crashReporter.start({ compress: true })</code></a></h3>\n<p>The default value of the <code>compress</code> option to <code>crashReporter.start</code> has changed from <code>false</code> to <code>true</code>. This means that crash dumps will be uploaded to the crash ingestion server with the <code>Content-Encoding: gzip</code> header, and the body will be compressed.</p>\n<p>If your crash ingestion server does not support compressed payloads, you can turn off compression by specifying <code>{ compress: false }</code> in the crash reporter options.</p>\n<h3 id=\"deprecated-remote-module\"><a href=\"#deprecated-remote-module\">Deprecated: <code>remote</code> module</a></h3>\n<p>The <code>remote</code> module is deprecated in Electron 12, and will be removed in Electron 14. It is replaced by the <a href=\"https://github.com/electron/remote\"><code>@electron/remote</code></a> module.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 12:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Replace with:</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote'</span>)\n\n<span class=\"hljs-comment\">// In the main process:</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/remote/main'</span>).initialize()\n</code></pre>\n<h3 id=\"deprecated-shellmoveitemtotrash\"><a href=\"#deprecated-shellmoveitemtotrash\">Deprecated: <code>shell.moveItemToTrash()</code></a></h3>\n<p>The synchronous <code>shell.moveItemToTrash()</code> has been replaced by the new, asynchronous <code>shell.trashItem()</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 12</span>\nshell.moveItemToTrash(path)\n<span class=\"hljs-comment\">// Replace with</span>\nshell.trashItem(path).then(<span class=\"hljs-comment\">/* ... */</span>)\n</code></pre>\n<h2 id=\"geplante-bruch-api-änderungen-110\"><a href=\"#geplante-bruch-api-änderungen-110\">Geplante Bruch-API-Änderungen (11.0)</a></h2>\n<h3 id=\"removed-browserviewdestroy-fromid-fromwebcontents-getallviews-and-id-property-of-browserview\"><a href=\"#removed-browserviewdestroy-fromid-fromwebcontents-getallviews-and-id-property-of-browserview\">Removed: <code>BrowserView.{destroy, fromId, fromWebContents, getAllViews}</code> and <code>id</code> property of <code>BrowserView</code></a></h3>\n<p>The experimental APIs <code>BrowserView.{destroy, fromId, fromWebContents, getAllViews}</code> have now been removed. Additionally, the <code>id</code> property of <code>BrowserView</code> has also been removed.</p>\n<p>For more detailed information, see <a href=\"https://github.com/electron/electron/pull/23578\">#23578</a>.</p>\n<h2 id=\"geplante-bruch-api-änderungen-100\"><a href=\"#geplante-bruch-api-änderungen-100\">Geplante Bruch-API-Änderungen (10.0)</a></h2>\n<h3 id=\"veraltet-companyname-argument-um-crashreporterstart\"><a href=\"#veraltet-companyname-argument-um-crashreporterstart\">Veraltet: <code>companyName</code> Argument, um <code>crashReporter.start()</code></a></h3>\n<p>The <code>companyName</code> argument to <code>crashReporter.start()</code>, which was previously required, is now optional, and further, is deprecated. Um das gleiche Verhalten auf nicht veraltete Weise zu erhalten, können Sie einen <code>companyName</code> Wert in <code>globalExtra</code>übergeben.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 10</span>\ncrashReporter.start({ <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Umbrella Corporation'</span> })\n<span class=\"hljs-comment\">// Replace with</span>\ncrashReporter.start({ <span class=\"hljs-attr\">globalExtra</span>: { <span class=\"hljs-attr\">_companyName</span>: <span class=\"hljs-string\">'Umbrella Corporation'</span> } })\n</code></pre>\n<h3 id=\"deprecated-crashreportergetcrashesdirectory\"><a href=\"#deprecated-crashreportergetcrashesdirectory\">Deprecated: <code>crashReporter.getCrashesDirectory()</code></a></h3>\n<p>The <code>crashReporter.getCrashesDirectory</code> method has been deprecated. Usage should be replaced by <code>app.getPath('crashDumps')</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 10</span>\ncrashReporter.getCrashesDirectory()\n<span class=\"hljs-comment\">// Replace with</span>\napp.getPath(<span class=\"hljs-string\">'crashDumps'</span>)\n</code></pre>\n<h3 id=\"deprecated-crashreporter-methods-in-the-renderer-process\"><a href=\"#deprecated-crashreporter-methods-in-the-renderer-process\">Deprecated: <code>crashReporter</code> methods in the renderer process</a></h3>\n<p>Calling the following <code>crashReporter</code> methods from the renderer process is deprecated:</p>\n<ul>\n<li><code>crashReporter.start</code></li>\n<li><code>crashReporter.getLastCrashReport</code></li>\n<li><code>crashReporter.getUploadedReports</code></li>\n<li><code>crashReporter.getUploadToServer</code></li>\n<li><code>crashReporter.setUploadToServer</code></li>\n<li><code>crashReporter.getCrashesDirectory</code></li>\n</ul>\n<p>The only non-deprecated methods remaining in the <code>crashReporter</code> module in the renderer are <code>addExtraParameter</code>, <code>removeExtraParameter</code> and <code>getParameters</code>.</p>\n<p>All above methods remain non-deprecated when called from the main process.</p>\n<p>See <a href=\"https://github.com/electron/electron/pull/23265\">#23265</a> for more details.</p>\n<h3 id=\"deprecated-crashreporterstart-compress-false-\"><a href=\"#deprecated-crashreporterstart-compress-false-\">Deprecated: <code>crashReporter.start({ compress: false })</code></a></h3>\n<p>Setting <code>{ compress: false }</code> in <code>crashReporter.start</code> is deprecated. Nearly all crash ingestion servers support gzip compression. This option will be removed in a future version of Electron.</p>\n<h3 id=\"default-changed-enableremotemodule-defaults-to-false\"><a href=\"#default-changed-enableremotemodule-defaults-to-false\">Default Changed: <code>enableRemoteModule</code> defaults to <code>false</code></a></h3>\n<p>In Electron 9, using the remote module without explicitly enabling it via the <code>enableRemoteModule</code> WebPreferences option began emitting a warning. In Electron 10, the remote module is now disabled by default. To use the remote module, <code>enableRemoteModule: true</code> must be specified in WebPreferences:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> w = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">enableRemoteModule</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<p>We <a href=\"https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31\">recommend moving away from the remote module</a>.</p>\n<h3 id=\"protocolunregisterprotocol\"><a href=\"#protocolunregisterprotocol\"><code>protocol.unregisterProtocol</code></a></h3>\n<h3 id=\"protocoluninterceptprotocol\"><a href=\"#protocoluninterceptprotocol\"><code>protocol.uninterceptProtocol</code></a></h3>\n<p>Diese Schnittstelle ist jetzt Synchron und der optionale callback wird nicht länger gebraucht.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Deprecated</span>\nprotocol.unregisterProtocol(scheme, () => { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nprotocol.unregisterProtocol(scheme)\n</code></pre>\n<h3 id=\"protocolregisterfileprotocol\"><a href=\"#protocolregisterfileprotocol\"><code>protocol.registerFileProtocol</code></a></h3>\n<h3 id=\"protocolregisterbufferprotocol\"><a href=\"#protocolregisterbufferprotocol\"><code>protocol.registerBufferProtocol</code></a></h3>\n<h3 id=\"protocolregisterstringprotocol\"><a href=\"#protocolregisterstringprotocol\"><code>protocol.registerStringProtocol</code></a></h3>\n<h3 id=\"protocolregisterhttpprotocol\"><a href=\"#protocolregisterhttpprotocol\"><code>protocol.registerHttpProtocol</code></a></h3>\n<h3 id=\"protocolregisterstreamprotocol\"><a href=\"#protocolregisterstreamprotocol\"><code>protocol.registerStreamProtocol</code></a></h3>\n<h3 id=\"protocolinterceptfileprotocol\"><a href=\"#protocolinterceptfileprotocol\"><code>protocol.interceptFileProtocol</code></a></h3>\n<h3 id=\"protocolinterceptstringprotocol\"><a href=\"#protocolinterceptstringprotocol\"><code>protocol.interceptStringProtocol</code></a></h3>\n<h3 id=\"protocolinterceptbufferprotocol\"><a href=\"#protocolinterceptbufferprotocol\"><code>protocol.interceptBufferProtocol</code></a></h3>\n<h3 id=\"protocolintercepthttpprotocol\"><a href=\"#protocolintercepthttpprotocol\"><code>protocol.interceptHttpProtocol</code></a></h3>\n<h3 id=\"protocolinterceptstreamprotocol\"><a href=\"#protocolinterceptstreamprotocol\"><code>protocol.interceptStreamProtocol</code></a></h3>\n<p>Diese Schnittstelle ist jetzt Synchron und der optionale callback wird nicht länger gebraucht.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Deprecated</span>\nprotocol.registerFileProtocol(scheme, handler, () => { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nprotocol.registerFileProtocol(scheme, handler)\n</code></pre>\n<p>Das registrierte oder abgefangene Protokoll hat keine Auswirkungen auf die aktuelle Seite, bis eine Navigation stattfindet.</p>\n<h3 id=\"protocolisprotocolhandled\"><a href=\"#protocolisprotocolhandled\"><code>protocol.isProtocolHandled</code></a></h3>\n<p>Diese Schnittstelle ist veraltet anstatt dessen sollten Benutzer <code>protocol.isProtocolRegistered</code> und <code>protocol.isProtocolIntercepted</code> nutzen.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Deprecated</span>\nprotocol.isProtocolHandled(scheme).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* ... */</span> })\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> isRegistered = protocol.isProtocolRegistered(scheme)\n<span class=\"hljs-keyword\">const</span> isIntercepted = protocol.isProtocolIntercepted(scheme)\n</code></pre>\n<h2 id=\"geplante-bruch-api-änderungen-90\"><a href=\"#geplante-bruch-api-änderungen-90\">Geplante Bruch-API-Änderungen (9.0)</a></h2>\n<h3 id=\"default-changed-loading-non-context-aware-native-modules-in-the-renderer-process-is-disabled-by-default\"><a href=\"#default-changed-loading-non-context-aware-native-modules-in-the-renderer-process-is-disabled-by-default\">Default Changed: Loading non-context-aware native modules in the renderer process is disabled by default</a></h3>\n<p>As of Electron 9 we do not allow loading of non-context-aware native modules in the renderer process.  This is to improve security, performance and maintainability of Electron as a project.</p>\n<p>If this impacts you, you can temporarily set <code>app.allowRendererProcessReuse</code> to <code>false</code> to revert to the old behavior.  This flag will only be an option until Electron 11 so you should plan to update your native modules to be context aware.</p>\n<p>Weitere Informationen findest du unter <a href=\"https://github.com/electron/electron/issues/18397\">#18397</a>.</p>\n<h3 id=\"deprecated-browserwindow-extension-apis\"><a href=\"#deprecated-browserwindow-extension-apis\">Deprecated: <code>BrowserWindow</code> extension APIs</a></h3>\n<p>The following extension APIs have been deprecated:</p>\n<ul>\n<li><code>BrowserWindow.addExtension(path)</code></li>\n<li><code>BrowserWindow.addDevToolsExtension(path)</code></li>\n<li><code>BrowserWindow.removeExtension(name)</code></li>\n<li><code>BrowserWindow.removeDevToolsExtension(name)</code></li>\n<li><code>BrowserWindow.getExtensions()</code></li>\n<li><code>BrowserWindow.getDevToolsExtensions()</code></li>\n</ul>\n<p>Use the session APIs instead:</p>\n<ul>\n<li><code>ses.loadExtension(path)</code></li>\n<li><code>ses.removeExtension(extension_id)</code></li>\n<li><code>ses.getAllExtensions()</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 9</span>\nBrowserWindow.addExtension(path)\nBrowserWindow.addDevToolsExtension(path)\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.loadExtension(path)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 9</span>\nBrowserWindow.removeExtension(name)\nBrowserWindow.removeDevToolsExtension(name)\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.removeExtension(extension_id)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated in Electron 9</span>\nBrowserWindow.getExtensions()\nBrowserWindow.getDevToolsExtensions()\n<span class=\"hljs-comment\">// Replace with</span>\nsession.defaultSession.getAllExtensions()\n</code></pre>\n<h3 id=\"removed-webviewgetwebcontents\"><a href=\"#removed-webviewgetwebcontents\">Removed: <code>&#x3C;webview>.getWebContents()</code></a></h3>\n<p>Diese API, die seit Electron 8.0 veraltet ist, wird nun entfernt.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 9.0</span>\nwebview.getWebContents()\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> { remote } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nremote.webContents.fromId(webview.getWebContentsId())\n</code></pre>\n<h3 id=\"entfernt-webframesetlayoutzoomlevellimits\"><a href=\"#entfernt-webframesetlayoutzoomlevellimits\">Entfernt: <code>webFrame.setLayoutZoomLevelLimits()</code></a></h3>\n<p>Chromium hat die Unterstützung für das Ändern des Layout-Zoomniveaus entfernt und es übersteigt die Möglichkeiten von uns, dies zu pflegen. The function was deprecated in Electron 8.x, and has been removed in Electron 9.x. The layout zoom level limits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined <a href=\"https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11\">here</a>.</p>\n<h3 id=\"behavior-changed-sending-non-js-objects-over-ipc-now-throws-an-exception\"><a href=\"#behavior-changed-sending-non-js-objects-over-ipc-now-throws-an-exception\">Behavior Changed: Sending non-JS objects over IPC now throws an exception</a></h3>\n<p>In Electron 8.0, IPC was changed to use the Structured Clone Algorithm, bringing significant performance improvements. To help ease the transition, the old IPC serialization algorithm was kept and used for some objects that aren't serializable with Structured Clone. In particular, DOM objects (e.g. <code>Element</code>, <code>Location</code> and <code>DOMMatrix</code>), Node.js objects backed by C++ classes (e.g. <code>process.env</code>, some members of <code>Stream</code>), and Electron objects backed by C++ classes (e.g. <code>WebContents</code>, <code>BrowserWindow</code> and <code>WebFrame</code>) are not serializable with Structured Clone. Whenever the old algorithm was invoked, a deprecation warning was printed.</p>\n<p>In Electron 9.0, the old serialization algorithm has been removed, and sending such non-serializable objects will now throw an \"object could not be cloned\" error.</p>\n<h3 id=\"api-changed-shellopenitem-is-now-shellopenpath\"><a href=\"#api-changed-shellopenitem-is-now-shellopenpath\">API Changed: <code>shell.openItem</code> is now <code>shell.openPath</code></a></h3>\n<p>The <code>shell.openItem</code> API has been replaced with an asynchronous <code>shell.openPath</code> API. You can see the original API proposal and reasoning <a href=\"https://github.com/electron/governance/blob/main/wg-api/spec-documents/shell-openitem.md\">here</a>.</p>\n<h2 id=\"geplante-bruch-api-änderungen-80\"><a href=\"#geplante-bruch-api-änderungen-80\">Geplante Bruch-API-Änderungen (8.0)</a></h2>\n<h3 id=\"behavior-changed-values-sent-over-ipc-are-now-serialized-with-structured-clone-algorithm\"><a href=\"#behavior-changed-values-sent-over-ipc-are-now-serialized-with-structured-clone-algorithm\">Behavior Changed: Values sent over IPC are now serialized with Structured Clone Algorithm</a></h3>\n<p>The algorithm used to serialize objects sent over IPC (through <code>ipcRenderer.send</code>, <code>ipcRenderer.sendSync</code>, <code>WebContents.send</code> and related methods) has been switched from a custom algorithm to V8's built-in <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, the same algorithm used to serialize messages for <code>postMessage</code>. This brings about a 2x performance improvement for large messages, but also brings some breaking changes in behavior.</p>\n<ul>\n<li>Sending Functions, Promises, WeakMaps, WeakSets, or objects containing any such values, over IPC will now throw an exception, instead of silently converting the functions to <code>undefined</code>.</li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Previously:</span>\nipcRenderer.send(<span class=\"hljs-string\">'channel'</span>, { <span class=\"hljs-attr\">value</span>: <span class=\"hljs-number\">3</span>, <span class=\"hljs-attr\">someFunction</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {} })\n<span class=\"hljs-comment\">// => results in { value: 3 } arriving in the main process</span>\n\n<span class=\"hljs-comment\">// From Electron 8:</span>\nipcRenderer.send(<span class=\"hljs-string\">'channel'</span>, { <span class=\"hljs-attr\">value</span>: <span class=\"hljs-number\">3</span>, <span class=\"hljs-attr\">someFunction</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {} })\n<span class=\"hljs-comment\">// => throws Error(\"() => {} could not be cloned.\")</span>\n</code></pre>\n<ul>\n<li><code>NaN</code>, <code>Infinity</code> and <code>-Infinity</code> will now be correctly serialized, instead of being converted to <code>null</code>.</li>\n<li>Objects containing cyclic references will now be correctly serialized, instead of being converted to <code>null</code>.</li>\n<li><code>Set</code>, <code>Map</code>, <code>Error</code> and <code>RegExp</code> values will be correctly serialized, instead of being converted to <code>{}</code>.</li>\n<li><code>BigInt</code> values will be correctly serialized, instead of being converted to <code>null</code>.</li>\n<li>Sparse arrays will be serialized as such, instead of being converted to dense arrays with <code>null</code>s.</li>\n<li><code>Date</code> objects will be transferred as <code>Date</code> objects, instead of being converted to their ISO string representation.</li>\n<li>Typed Arrays (such as <code>Uint8Array</code>, <code>Uint16Array</code>, <code>Uint32Array</code> and so on) will be transferred as such, instead of being converted to Node.js <code>Buffer</code>.</li>\n<li>Node.js <code>Buffer</code> objects will be transferred as <code>Uint8Array</code>s. You can convert a <code>Uint8Array</code> back to a Node.js <code>Buffer</code> by wrapping the underlying <code>ArrayBuffer</code>:</li>\n</ul>\n<pre><code class=\"hljs language-js\">Buffer.from(value.buffer, value.byteOffset, value.byteLength)\n</code></pre>\n<p>Sending any objects that aren't native JS types, such as DOM objects (e.g. <code>Element</code>, <code>Location</code>, <code>DOMMatrix</code>), Node.js objects (e.g. <code>process.env</code>, <code>Stream</code>), or Electron objects (e.g. <code>WebContents</code>, <code>BrowserWindow</code>, <code>WebFrame</code>) is deprecated. In Electron 8, these objects will be serialized as before with a DeprecationWarning message, but starting in Electron 9, sending these kinds of objects will throw a 'could not be cloned' error.</p>\n<h3 id=\"deprecated-webviewgetwebcontents\"><a href=\"#deprecated-webviewgetwebcontents\">Deprecated: <code>&#x3C;webview>.getWebContents()</code></a></h3>\n<p>This API is implemented using the <code>remote</code> module, which has both performance and security implications. Therefore its usage should be explicit.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebview.getWebContents()\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> { remote } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nremote.webContents.fromId(webview.getWebContentsId())\n</code></pre>\n<p>However, it is recommended to avoid using the <code>remote</code> module altogether.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain, webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> getGuestForWebContents = <span class=\"hljs-function\">(<span class=\"hljs-params\">webContentsId, contents</span>) =></span> {\n  <span class=\"hljs-keyword\">const</span> guest = webContents.fromId(webContentsId)\n  <span class=\"hljs-keyword\">if</span> (!guest) {\n    <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">`Invalid webContentsId: <span class=\"hljs-subst\">${webContentsId}</span>`</span>)\n  }\n  <span class=\"hljs-keyword\">if</span> (guest.hostWebContents !== contents) {\n    <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Access denied to webContents'</span>)\n  }\n  <span class=\"hljs-keyword\">return</span> guest\n}\n\nipcMain.handle(<span class=\"hljs-string\">'openDevTools'</span>, (event, webContentsId) => {\n  <span class=\"hljs-keyword\">const</span> guest = getGuestForWebContents(webContentsId, event.sender)\n  guest.openDevTools()\n})\n\n<span class=\"hljs-comment\">// renderer</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nipcRenderer.invoke(<span class=\"hljs-string\">'openDevTools'</span>, webview.getWebContentsId())\n</code></pre>\n<h3 id=\"deprecated-webframesetlayoutzoomlevellimits\"><a href=\"#deprecated-webframesetlayoutzoomlevellimits\">Deprecated: <code>webFrame.setLayoutZoomLevelLimits()</code></a></h3>\n<p>Chromium hat die Unterstützung für das Ändern des Layout-Zoomniveaus entfernt und es übersteigt die Möglichkeiten von uns, dies zu pflegen. The function will emit a warning in Electron 8.x, and cease to exist in Electron 9.x. The layout zoom level limits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined <a href=\"https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11\">here</a>.</p>\n<h3 id=\"deprecated-events-in-systempreferences\"><a href=\"#deprecated-events-in-systempreferences\">Deprecated events in <code>systemPreferences</code></a></h3>\n<p>The following <code>systemPreferences</code> events have been deprecated:</p>\n<ul>\n<li><code>inverted-color-scheme-changed</code></li>\n<li><code>high-contrast-color-scheme-changed</code></li>\n</ul>\n<p>Use the new <code>updated</code> event on the <code>nativeTheme</code> module instead.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.on(<span class=\"hljs-string\">'inverted-color-scheme-changed'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\nsystemPreferences.on(<span class=\"hljs-string\">'high-contrast-color-scheme-changed'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\n\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.on(<span class=\"hljs-string\">'updated'</span>, () => { <span class=\"hljs-comment\">/* ... */</span> })\n</code></pre>\n<h3 id=\"deprecated-methods-in-systempreferences\"><a href=\"#deprecated-methods-in-systempreferences\">Deprecated: methods in <code>systemPreferences</code></a></h3>\n<p>Die folgenden <code>systemPreferences</code> Methoden wurden veraltet:</p>\n<ul>\n<li><code>systemPreferences.isDarkMode()</code></li>\n<li><code>systemPreferences.isInvertedColorScheme()</code></li>\n<li><code>systemPreferences.isHighContrastColorScheme()</code></li>\n</ul>\n<p>Verwende stattdessen die folgenden <code>nativeTheme</code> Eigenschaften:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code></li>\n<li><code>nativeTheme.shouldUseInvertedColorScheme</code></li>\n<li><code>nativeTheme.shouldUseHighContrastColors</code></li>\n</ul>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.isDarkMode()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseDarkColors\n\n<span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.isInvertedColorScheme()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseInvertedColorScheme\n\n<span class=\"hljs-comment\">// Deprecated</span>\nsystemPreferences.isHighContrastColorScheme()\n<span class=\"hljs-comment\">// Replace with</span>\nnativeTheme.shouldUseHighContrastColors\n</code></pre>\n<h2 id=\"planned-breaking-api-changes-70\"><a href=\"#planned-breaking-api-changes-70\">Planned Breaking API Changes (7.0)</a></h2>\n<h3 id=\"deprecated-atomio-node-headers-url\"><a href=\"#deprecated-atomio-node-headers-url\">Deprecated: Atom.io Node Headers URL</a></h3>\n<p>This is the URL specified as <code>disturl</code> in a <code>.npmrc</code> file or as the <code>--dist-url</code> command line flag when building native Node modules.  Both will be supported for the foreseeable future but it is recommended that you switch.</p>\n<p>Deprecated: <a href=\"https://atom.io/download/electron\">https://atom.io/download/electron</a></p>\n<p>Replace with: <a href=\"https://electronjs.org/headers\">https://electronjs.org/headers</a></p>\n<h3 id=\"api-changed-sessionclearauthcache-no-longer-accepts-options\"><a href=\"#api-changed-sessionclearauthcache-no-longer-accepts-options\">API Changed: <code>session.clearAuthCache()</code> no longer accepts options</a></h3>\n<p>The <code>session.clearAuthCache</code> API no longer accepts options for what to clear, and instead unconditionally clears the whole cache.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nsession.clearAuthCache({ <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'password'</span> })\n<span class=\"hljs-comment\">// Replace with</span>\nsession.clearAuthCache()\n</code></pre>\n<h3 id=\"api-changed-powermonitorquerysystemidlestate-is-now-powermonitorgetsystemidlestate\"><a href=\"#api-changed-powermonitorquerysystemidlestate-is-now-powermonitorgetsystemidlestate\">API Changed: <code>powerMonitor.querySystemIdleState</code> is now <code>powerMonitor.getSystemIdleState</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\npowerMonitor.querySystemIdleState(threshold, callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleState = powerMonitor.getSystemIdleState(threshold)\n</code></pre>\n<h3 id=\"api-changed-powermonitorquerysystemidletime-is-now-powermonitorgetsystemidletime\"><a href=\"#api-changed-powermonitorquerysystemidletime-is-now-powermonitorgetsystemidletime\">API Changed: <code>powerMonitor.querySystemIdleTime</code> is now <code>powerMonitor.getSystemIdleTime</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\npowerMonitor.querySystemIdleTime(callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleTime = powerMonitor.getSystemIdleTime()\n</code></pre>\n<h3 id=\"api-changed-webframesetisolatedworldinfo-replaces-separate-methods\"><a href=\"#api-changed-webframesetisolatedworldinfo-replaces-separate-methods\">API Changed: <code>webFrame.setIsolatedWorldInfo</code> replaces separate methods</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Removed in Electron 7.0</span>\nwebFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)\nwebFrame.setIsolatedWorldHumanReadableName(worldId, name)\nwebFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)\n<span class=\"hljs-comment\">// Replace with</span>\nwebFrame.setIsolatedWorldInfo(\n  worldId,\n  {\n    <span class=\"hljs-attr\">securityOrigin</span>: <span class=\"hljs-string\">'some_origin'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'human_readable_name'</span>,\n    <span class=\"hljs-attr\">csp</span>: <span class=\"hljs-string\">'content_security_policy'</span>\n  })\n</code></pre>\n<h3 id=\"removed-marked-property-on-getblinkmemoryinfo\"><a href=\"#removed-marked-property-on-getblinkmemoryinfo\">Removed: <code>marked</code> property on <code>getBlinkMemoryInfo</code></a></h3>\n<p>This property was removed in Chromium 77, and as such is no longer available.</p>\n<h3 id=\"behavior-changed-webkitdirectory-attribute-for-input-typefile-now-lists-directory-contents\"><a href=\"#behavior-changed-webkitdirectory-attribute-for-input-typefile-now-lists-directory-contents\">Behavior Changed: <code>webkitdirectory</code> attribute for <code>&#x3C;input type=\"file\"/></code> now lists directory contents</a></h3>\n<p>The <code>webkitdirectory</code> property on HTML file inputs allows them to select folders. Previous versions of Electron had an incorrect implementation where the <code>event.target.files</code> of the input returned a <code>FileList</code> that returned one <code>File</code> corresponding to the selected folder.</p>\n<p>As of Electron 7, that <code>FileList</code> is now list of all files contained within the folder, similarly to Chrome, Firefox, and Edge (<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory\">link to MDN docs</a>).</p>\n<p>As an illustration, take a folder with this structure:</p>\n<pre><code class=\"hljs language-console\">folder\n├── file1\n├── file2\n└── file3\n</code></pre>\n<p>In Electron &#x3C;=6, this would return a <code>FileList</code> with a <code>File</code> object for:</p>\n<pre><code class=\"hljs language-console\">path/to/folder\n</code></pre>\n<p>In Electron 7, this now returns a <code>FileList</code> with a <code>File</code> object for:</p>\n<pre><code class=\"hljs language-console\">/path/to/folder/file3\n/path/to/folder/file2\n/path/to/folder/file1\n</code></pre>\n<p>Note that <code>webkitdirectory</code> no longer exposes the path to the selected folder. If you require the path to the selected folder rather than the folder contents, see the <code>dialog.showOpenDialog</code> API (<a href=\"/docs/api/dialog#dialogshowopendialogbrowserwindow-options\">link</a>).</p>\n<h3 id=\"api-changed-callback-based-versions-of-promisified-apis\"><a href=\"#api-changed-callback-based-versions-of-promisified-apis\">API Changed: Callback-based versions of promisified APIs</a></h3>\n<p>Electron 5 and Electron 6 introduced Promise-based versions of existing asynchronous APIs and deprecated their older, callback-based counterparts. In Electron 7, all deprecated callback-based APIs are now removed.</p>\n<p>These functions now only return Promises:</p>\n<ul>\n<li><code>app.getFileIcon()</code> <a href=\"https://github.com/electron/electron/pull/15742\">#15742</a></li>\n<li><code>app.dock.show()</code> <a href=\"https://github.com/electron/electron/pull/16904\">#16904</a></li>\n<li><code>contentTracing.getCategories()</code> <a href=\"https://github.com/electron/electron/pull/16583\">#16583</a></li>\n<li><code>contentTracing.getTraceBufferUsage()</code> <a href=\"https://github.com/electron/electron/pull/16600\">#16600</a></li>\n<li><code>contentTracing.startRecording()</code> <a href=\"https://github.com/electron/electron/pull/16584\">#16584</a></li>\n<li><code>contentTracing.stopRecording()</code> <a href=\"https://github.com/electron/electron/pull/16584\">#16584</a></li>\n<li><code>contents.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>cookies.flushStore()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.get()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.remove()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>cookies.set()</code> <a href=\"https://github.com/electron/electron/pull/16464\">#16464</a></li>\n<li><code>debugger.sendCommand()</code> <a href=\"https://github.com/electron/electron/pull/16861\">#16861</a></li>\n<li><code>dialog.showCertificateTrustDialog()</code> <a href=\"https://github.com/electron/electron/pull/17181\">#17181</a></li>\n<li><code>inAppPurchase.getProducts()</code> <a href=\"https://github.com/electron/electron/pull/17355\">#17355</a></li>\n<li><code>inAppPurchase.purchaseProduct()</code><a href=\"https://github.com/electron/electron/pull/17355\">#17355</a></li>\n<li><code>netLog.stopLogging()</code> <a href=\"https://github.com/electron/electron/pull/16862\">#16862</a></li>\n<li><code>session.clearAuthCache()</code> <a href=\"https://github.com/electron/electron/pull/17259\">#17259</a></li>\n<li><code>session.clearCache()</code>  <a href=\"https://github.com/electron/electron/pull/17185\">#17185</a></li>\n<li><code>session.clearHostResolverCache()</code> <a href=\"https://github.com/electron/electron/pull/17229\">#17229</a></li>\n<li><code>session.clearStorageData()</code> <a href=\"https://github.com/electron/electron/pull/17249\">#17249</a></li>\n<li><code>session.getBlobData()</code> <a href=\"https://github.com/electron/electron/pull/17303\">#17303</a></li>\n<li><code>session.getCacheSize()</code>  <a href=\"https://github.com/electron/electron/pull/17185\">#17185</a></li>\n<li><code>session.resolveProxy()</code> <a href=\"https://github.com/electron/electron/pull/17222\">#17222</a></li>\n<li><code>session.setProxy()</code>  <a href=\"https://github.com/electron/electron/pull/17222\">#17222</a></li>\n<li><code>shell.openExternal()</code> <a href=\"https://github.com/electron/electron/pull/16176\">#16176</a></li>\n<li><code>webContents.loadFile()</code> <a href=\"https://github.com/electron/electron/pull/15855\">#15855</a></li>\n<li><code>webContents.loadURL()</code> <a href=\"https://github.com/electron/electron/pull/15855\">#15855</a></li>\n<li><code>webContents.hasServiceWorker()</code> <a href=\"https://github.com/electron/electron/pull/16535\">#16535</a></li>\n<li><code>webContents.printToPDF()</code> <a href=\"https://github.com/electron/electron/pull/16795\">#16795</a></li>\n<li><code>webContents.savePage()</code> <a href=\"https://github.com/electron/electron/pull/16742\">#16742</a></li>\n<li><code>webFrame.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>webFrame.executeJavaScriptInIsolatedWorld()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>webviewTag.executeJavaScript()</code> <a href=\"https://github.com/electron/electron/pull/17312\">#17312</a></li>\n<li><code>win.capturePage()</code> <a href=\"https://github.com/electron/electron/pull/15743\">#15743</a></li>\n</ul>\n<p>These functions now have two forms, synchronous and Promise-based asynchronous:</p>\n<ul>\n<li><code>dialog.showMessageBox()</code>/<code>dialog.showMessageBoxSync()</code> <a href=\"https://github.com/electron/electron/pull/17298\">#17298</a></li>\n<li><code>dialog.showOpenDialog()</code>/<code>dialog.showOpenDialogSync()</code> <a href=\"https://github.com/electron/electron/pull/16973\">#16973</a></li>\n<li><code>dialog.showSaveDialog()</code>/<code>dialog.showSaveDialogSync()</code> <a href=\"https://github.com/electron/electron/pull/17054\">#17054</a></li>\n</ul>\n<h2 id=\"planned-breaking-api-changes-60\"><a href=\"#planned-breaking-api-changes-60\">Planned Breaking API Changes (6.0)</a></h2>\n<h3 id=\"api-changed-winsetmenunull-is-now-winremovemenu\"><a href=\"#api-changed-winsetmenunull-is-now-winremovemenu\">API Changed: <code>win.setMenu(null)</code> is now <code>win.removeMenu()</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwin.setMenu(<span class=\"hljs-literal\">null</span>)\n<span class=\"hljs-comment\">// Replace with</span>\nwin.removeMenu()\n</code></pre>\n<h3 id=\"api-changed-electronscreen-in-the-renderer-process-should-be-accessed-via-remote\"><a href=\"#api-changed-electronscreen-in-the-renderer-process-should-be-accessed-via-remote\">API Changed: <code>electron.screen</code> in the renderer process should be accessed via <code>remote</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).screen\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.screen\n</code></pre>\n<h3 id=\"api-changed-requireing-node-builtins-in-sandboxed-renderers-no-longer-implicitly-loads-the-remote-version\"><a href=\"#api-changed-requireing-node-builtins-in-sandboxed-renderers-no-longer-implicitly-loads-the-remote-version\">API Changed: <code>require()</code>ing node builtins in sandboxed renderers no longer implicitly loads the <code>remote</code> version</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'child_process'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'child_process'</span>)\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'os'</span>)\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).remote.require(<span class=\"hljs-string\">'path'</span>)\n</code></pre>\n<h3 id=\"deprecated-powermonitorquerysystemidlestate-replaced-with-powermonitorgetsystemidlestate\"><a href=\"#deprecated-powermonitorquerysystemidlestate-replaced-with-powermonitorgetsystemidlestate\">Deprecated: <code>powerMonitor.querySystemIdleState</code> replaced with <code>powerMonitor.getSystemIdleState</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\npowerMonitor.querySystemIdleState(threshold, callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleState = powerMonitor.getSystemIdleState(threshold)\n</code></pre>\n<h3 id=\"deprecated-powermonitorquerysystemidletime-replaced-with-powermonitorgetsystemidletime\"><a href=\"#deprecated-powermonitorquerysystemidletime-replaced-with-powermonitorgetsystemidletime\">Deprecated: <code>powerMonitor.querySystemIdleTime</code> replaced with <code>powerMonitor.getSystemIdleTime</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\npowerMonitor.querySystemIdleTime(callback)\n<span class=\"hljs-comment\">// Replace with synchronous API</span>\n<span class=\"hljs-keyword\">const</span> idleTime = powerMonitor.getSystemIdleTime()\n</code></pre>\n<h3 id=\"deprecated-appenablemixedsandbox-is-no-longer-needed\"><a href=\"#deprecated-appenablemixedsandbox-is-no-longer-needed\">Deprecated: <code>app.enableMixedSandbox()</code> is no longer needed</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\napp.enableMixedSandbox()\n</code></pre>\n<p>Mixed-sandbox mode is now enabled by default.</p>\n<h3 id=\"deprecated-traysethighlightmode\"><a href=\"#deprecated-traysethighlightmode\">Deprecated: <code>Tray.setHighlightMode</code></a></h3>\n<p>Under macOS Catalina our former Tray implementation breaks. Apple's native substitute doesn't support changing the highlighting behavior.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\ntray.setHighlightMode(mode)\n<span class=\"hljs-comment\">// API will be removed in v7.0 without replacement.</span>\n</code></pre>\n<h2 id=\"planned-breaking-api-changes-50\"><a href=\"#planned-breaking-api-changes-50\">Planned Breaking API Changes (5.0)</a></h2>\n<h3 id=\"default-changed-nodeintegration-and-webviewtag-default-to-false-contextisolation-defaults-to-true\"><a href=\"#default-changed-nodeintegration-and-webviewtag-default-to-false-contextisolation-defaults-to-true\">Default Changed: <code>nodeIntegration</code> and <code>webviewTag</code> default to false, <code>contextIsolation</code> defaults to true</a></h3>\n<p>The following <code>webPreferences</code> option default values are deprecated in favor of the new defaults listed below.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Property</th><th>Deprecated Default</th><th>New Default</th></tr></thead><tbody><tr><td><code>contextIsolation</code></td><td><code>false</code></td><td><code>true</code></td></tr><tr><td><code>nodeIntegration</code></td><td><code>true</code></td><td><code>false</code></td></tr><tr><td><code>webviewTag</code></td><td><code>nodeIntegration</code> if set else <code>true</code></td><td><code>false</code></td></tr></tbody></table>\n<p>z.B. Re-enabling the webviewTag</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> w = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">webviewTag</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h3 id=\"behavior-changed-nodeintegration-in-child-windows-opened-via-nativewindowopen\"><a href=\"#behavior-changed-nodeintegration-in-child-windows-opened-via-nativewindowopen\">Behavior Changed: <code>nodeIntegration</code> in child windows opened via <code>nativeWindowOpen</code></a></h3>\n<p>Child windows opened with the <code>nativeWindowOpen</code> option will always have Node.js integration disabled, unless <code>nodeIntegrationInSubFrames</code> is <code>true</code>.</p>\n<h3 id=\"api-changed-registering-privileged-schemes-must-now-be-done-before-app-ready\"><a href=\"#api-changed-registering-privileged-schemes-must-now-be-done-before-app-ready\">API Changed: Registering privileged schemes must now be done before app ready</a></h3>\n<p>Renderer process APIs <code>webFrame.registerURLSchemeAsPrivileged</code> and <code>webFrame.registerURLSchemeAsBypassingCSP</code> as well as browser process API <code>protocol.registerStandardSchemes</code> have been removed. A new API, <code>protocol.registerSchemesAsPrivileged</code> has been added and should be used for registering custom schemes with the required privileges. Custom schemes are required to be registered before app ready.</p>\n<h3 id=\"deprecated-webframesetisolatedworld-replaced-with-webframesetisolatedworldinfo\"><a href=\"#deprecated-webframesetisolatedworld-replaced-with-webframesetisolatedworldinfo\">Deprecated: <code>webFrame.setIsolatedWorld*</code> replaced with <code>webFrame.setIsolatedWorldInfo</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)\nwebFrame.setIsolatedWorldHumanReadableName(worldId, name)\nwebFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)\n<span class=\"hljs-comment\">// Replace with</span>\nwebFrame.setIsolatedWorldInfo(\n  worldId,\n  {\n    <span class=\"hljs-attr\">securityOrigin</span>: <span class=\"hljs-string\">'some_origin'</span>,\n    <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'human_readable_name'</span>,\n    <span class=\"hljs-attr\">csp</span>: <span class=\"hljs-string\">'content_security_policy'</span>\n  })\n</code></pre>\n<h3 id=\"api-changed-webframesetspellcheckprovider-now-takes-an-asynchronous-callback\"><a href=\"#api-changed-webframesetspellcheckprovider-now-takes-an-asynchronous-callback\">API Changed: <code>webFrame.setSpellCheckProvider</code> now takes an asynchronous callback</a></h3>\n<p>The <code>spellCheck</code> callback is now asynchronous, and <code>autoCorrectWord</code> parameter has been removed.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, <span class=\"hljs-literal\">true</span>, {\n  <span class=\"hljs-attr\">spellCheck</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">text</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> !spellchecker.isMisspelled(text)\n  }\n})\n<span class=\"hljs-comment\">// Replace with</span>\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, {\n  <span class=\"hljs-attr\">spellCheck</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">words, callback</span>) =></span> {\n    callback(words.filter(<span class=\"hljs-function\"><span class=\"hljs-params\">text</span> =></span> spellchecker.isMisspelled(text)))\n  }\n})\n</code></pre>\n<h3 id=\"api-changed-webcontentsgetzoomlevel-and-webcontentsgetzoomfactor-are-now-synchronous\"><a href=\"#api-changed-webcontentsgetzoomlevel-and-webcontentsgetzoomfactor-are-now-synchronous\">API Changed: <code>webContents.getZoomLevel</code> and <code>webContents.getZoomFactor</code> are now synchronous</a></h3>\n<p><code>webContents.getZoomLevel</code> and <code>webContents.getZoomFactor</code> no longer take callback parameters, instead directly returning their number values.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebContents.getZoomLevel(<span class=\"hljs-function\">(<span class=\"hljs-params\">level</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(level)\n})\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> level = webContents.getZoomLevel()\n<span class=\"hljs-built_in\">console</span>.log(level)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nwebContents.getZoomFactor(<span class=\"hljs-function\">(<span class=\"hljs-params\">factor</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(factor)\n})\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> factor = webContents.getZoomFactor()\n<span class=\"hljs-built_in\">console</span>.log(factor)\n</code></pre>\n<h2 id=\"planned-breaking-api-changes-40\"><a href=\"#planned-breaking-api-changes-40\">Planned Breaking API Changes (4.0)</a></h2>\n<p>The following list includes the breaking API changes made in Electron 4.0.</p>\n<h3 id=\"appmakesingleinstance\"><a href=\"#appmakesingleinstance\"><code>app.makeSingleInstance</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\napp.makeSingleInstance(<span class=\"hljs-function\">(<span class=\"hljs-params\">argv, cwd</span>) =></span> {\n  <span class=\"hljs-comment\">/* ... */</span>\n})\n<span class=\"hljs-comment\">// Replace with</span>\napp.requestSingleInstanceLock()\napp.on(<span class=\"hljs-string\">'second-instance'</span>, (event, argv, cwd) => {\n  <span class=\"hljs-comment\">/* ... */</span>\n})\n</code></pre>\n<h3 id=\"appreleasesingleinstance\"><a href=\"#appreleasesingleinstance\"><code>app.releaseSingleInstance</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Veraltet</span>\napp.releaseSingleInstance()\n<span class=\"hljs-comment\">// Ersetze mit</span>\napp.releaseSingleInstanceLock()\n</code></pre>\n<h3 id=\"appgetgpuinfo\"><a href=\"#appgetgpuinfo\"><code>app.getGPUInfo</code></a></h3>\n<pre><code class=\"hljs language-js\">app.getGPUInfo(<span class=\"hljs-string\">'complete'</span>)\n<span class=\"hljs-comment\">// Verhält sich jetzt gleich wie `basic` auf macOS</span>\napp.getGPUInfo(<span class=\"hljs-string\">'basic'</span>)\n</code></pre>\n<h3 id=\"win_delay_load_hook\"><a href=\"#win_delay_load_hook\"><code>win_delay_load_hook</code></a></h3>\n<p>When building native modules for windows, the <code>win_delay_load_hook</code> variable in the module's <code>binding.gyp</code> must be true (which is the default). If this hook is not present, then the native module will fail to load on Windows, with an error message like <code>Cannot find module</code>. See the <a href=\"/docs/tutorial/using-native-node-modules\">native module guide</a> for more.</p>\n<h2 id=\"breaking-api-changes-30\"><a href=\"#breaking-api-changes-30\">Breaking API Changes (3.0)</a></h2>\n<p>The following list includes the breaking API changes in Electron 3.0.</p>\n<h3 id=\"app\"><a href=\"#app\"><code>app</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Veraltet</span>\napp.getAppMemoryInfo()\n<span class=\"hljs-comment\">// Ersetze mit</span>\napp.getAppMetrics()\n\n<span class=\"hljs-comment\">// Veraltet</span>\n<span class=\"hljs-keyword\">const</span> metrics = app.getAppMetrics()\n<span class=\"hljs-keyword\">const</span> { memory } = metrics[<span class=\"hljs-number\">0</span>] <span class=\"hljs-comment\">// Deprecated property</span>\n</code></pre>\n<h3 id=\"browserfenster\"><a href=\"#browserfenster\"><code>Browserfenster</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-keyword\">const</span> optionsA = { <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">blinkFeatures</span>: <span class=\"hljs-string\">''</span> } }\n<span class=\"hljs-keyword\">const</span> windowA = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsA)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> optionsB = { <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">enableBlinkFeatures</span>: <span class=\"hljs-string\">''</span> } }\n<span class=\"hljs-keyword\">const</span> windowB = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsB)\n\n<span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-built_in\">window</span>.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'media-play_pause'</span>) {\n    <span class=\"hljs-comment\">// do something</span>\n  }\n})\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-built_in\">window</span>.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'media-play-pause'</span>) {\n    <span class=\"hljs-comment\">// do something</span>\n  }\n})\n</code></pre>\n<h3 id=\"clipboard\"><a href=\"#clipboard\"><code>clipboard</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Veraltet</span>\nclipboard.readRtf()\n<span class=\"hljs-comment\">// Ersetze mit</span>\nclipboard.readRTF()\n\n<span class=\"hljs-comment\">// Veraltet</span>\nclipboard.writeRtf()\n<span class=\"hljs-comment\">// Ersetze mit</span>\nclipboard.writeRTF()\n\n<span class=\"hljs-comment\">// Veraltet</span>\nclipboard.readHtml()\n<span class=\"hljs-comment\">// Ersetze mit</span>\nclipboard.readHTML()\n\n<span class=\"hljs-comment\">// Veraltet</span>\nclipboard.writeHtml()\n<span class=\"hljs-comment\">// Ersetze mit</span>\nclipboard.writeHTML()\n</code></pre>\n<h3 id=\"crashreporter\"><a href=\"#crashreporter\"><code>crashReporter</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Veraltet</span>\ncrashReporter.start({\n  <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Crashly'</span>,\n  <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://crash.server.com'</span>,\n  <span class=\"hljs-attr\">autoSubmit</span>: <span class=\"hljs-literal\">true</span>\n})\n<span class=\"hljs-comment\">// Ersetze mit</span>\ncrashReporter.start({\n  <span class=\"hljs-attr\">companyName</span>: <span class=\"hljs-string\">'Crashly'</span>,\n  <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://crash.server.com'</span>,\n  <span class=\"hljs-attr\">uploadToServer</span>: <span class=\"hljs-literal\">true</span>\n})\n</code></pre>\n<h3 id=\"nativeimage\"><a href=\"#nativeimage\"><code>nativeImage</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Veraltet</span>\nnativeImage.createFromBuffer(buffer, <span class=\"hljs-number\">1.0</span>)\n<span class=\"hljs-comment\">// Ersetze mit</span>\nnativeImage.createFromBuffer(buffer, {\n  <span class=\"hljs-attr\">scaleFactor</span>: <span class=\"hljs-number\">1.0</span>\n})\n</code></pre>\n<h3 id=\"process\"><a href=\"#process\"><code>process</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Veraltet</span>\n<span class=\"hljs-keyword\">const</span> info = process.getProcessMemoryInfo()\n</code></pre>\n<h3 id=\"screen\"><a href=\"#screen\"><code>screen</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Veraltet</span>\nscreen.getMenuBarHeight()\n<span class=\"hljs-comment\">// Ersetze mit</span>\nscreen.getPrimaryDisplay().workArea\n</code></pre>\n<h3 id=\"session\"><a href=\"#session\"><code>session</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\nses.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">hostname, certificate, callback</span>) =></span> {\n  callback(<span class=\"hljs-literal\">true</span>)\n})\n<span class=\"hljs-comment\">// Replace with</span>\nses.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">request, callback</span>) =></span> {\n  callback(<span class=\"hljs-number\">0</span>)\n})\n</code></pre>\n<h3 id=\"fach\"><a href=\"#fach\"><code>Fach</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Veraltet</span>\ntray.setHighlightMode(<span class=\"hljs-literal\">true</span>)\n<span class=\"hljs-comment\">// Ersetze mit</span>\ntray.setHighlightMode(<span class=\"hljs-string\">'on'</span>)\n\n<span class=\"hljs-comment\">// Veraltet</span>\ntray.setHighlightMode(<span class=\"hljs-literal\">false</span>)\n<span class=\"hljs-comment\">// Ersetze mit</span>\ntray.setHighlightMode(<span class=\"hljs-string\">'off'</span>)\n</code></pre>\n<h3 id=\"webcontents\"><a href=\"#webcontents\"><code>webContents</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Veraltet</span>\nwebContents.openDevTools({ <span class=\"hljs-attr\">detach</span>: <span class=\"hljs-literal\">true</span> })\n<span class=\"hljs-comment\">// Ersetze mit</span>\nwebContents.openDevTools({ <span class=\"hljs-attr\">mode</span>: <span class=\"hljs-string\">'detach'</span> })\n\n<span class=\"hljs-comment\">// Entfernt</span>\nwebContents.setSize(options)\n<span class=\"hljs-comment\">// Für diese API gibt es keinen Ersatz</span>\n</code></pre>\n<h3 id=\"webframe\"><a href=\"#webframe\"><code>webFrame</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Veraltet</span>\nwebFrame.registerURLSchemeAsSecure(<span class=\"hljs-string\">'app'</span>)\n<span class=\"hljs-comment\">// Ersetze mit</span>\nprotocol.registerStandardSchemes([<span class=\"hljs-string\">'app'</span>], { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n\n<span class=\"hljs-comment\">// Veraltet</span>\nwebFrame.registerURLSchemeAsPrivileged(<span class=\"hljs-string\">'app'</span>, { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n<span class=\"hljs-comment\">// Ersetze mit</span>\nprotocol.registerStandardSchemes([<span class=\"hljs-string\">'app'</span>], { <span class=\"hljs-attr\">secure</span>: <span class=\"hljs-literal\">true</span> })\n</code></pre>\n<h3 id=\"webview\"><a href=\"#webview\"><code>&#x3C;webview></code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Entfernt</span>\nwebview.setAttribute(<span class=\"hljs-string\">'disableguestresize'</span>, <span class=\"hljs-string\">''</span>)\n<span class=\"hljs-comment\">// Für diese API gibt es keinen Ersatz</span>\n\n<span class=\"hljs-comment\">// Entfernt</span>\nwebview.setAttribute(<span class=\"hljs-string\">'guestinstance'</span>, instanceId)\n<span class=\"hljs-comment\">// Für diese API gibt es keinen Ersatz</span>\n\n<span class=\"hljs-comment\">// Keyboard listener funktionieren nicht länger für webview tag</span>\nwebview.onkeydown = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* handler */</span> }\nwebview.onkeyup = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-comment\">/* handler */</span> }\n</code></pre>\n<h3 id=\"node-headers-url\"><a href=\"#node-headers-url\">Node Headers URL</a></h3>\n<p>This is the URL specified as <code>disturl</code> in a <code>.npmrc</code> file or as the <code>--dist-url</code> command line flag when building native Node modules.</p>\n<p>Deprecated: <a href=\"https://atom.io/download/atom-shell\">https://atom.io/download/atom-shell</a></p>\n<p>Replace with: <a href=\"https://atom.io/download/electron\">https://atom.io/download/electron</a></p>\n<h2 id=\"breaking-api-changes-20\"><a href=\"#breaking-api-changes-20\">Breaking API Changes (2.0)</a></h2>\n<p>The following list includes the breaking API changes made in Electron 2.0.</p>\n<h3 id=\"browserfenster-1\"><a href=\"#browserfenster-1\"><code>Browserfenster</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Deprecated</span>\n<span class=\"hljs-keyword\">const</span> optionsA = { <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden-inset'</span> }\n<span class=\"hljs-keyword\">const</span> windowA = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsA)\n<span class=\"hljs-comment\">// Replace with</span>\n<span class=\"hljs-keyword\">const</span> optionsB = { <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span> }\n<span class=\"hljs-keyword\">const</span> windowB = <span class=\"hljs-keyword\">new</span> BrowserWindow(optionsB)\n</code></pre>\n<h3 id=\"menu\"><a href=\"#menu\"><code>menu</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Entfernt</span>\nmenu.popup(browserWindow, <span class=\"hljs-number\">100</span>, <span class=\"hljs-number\">200</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Ersetze mit</span>\nmenu.popup(browserWindow, { <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">100</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">200</span>, <span class=\"hljs-attr\">positioningItem</span>: <span class=\"hljs-number\">2</span> })\n</code></pre>\n<h3 id=\"nativeimage-1\"><a href=\"#nativeimage-1\"><code>nativeImage</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Entfernt</span>\nnativeImage.toPng()\n<span class=\"hljs-comment\">// Ersetze mit</span>\nnativeImage.toPNG()\n\n<span class=\"hljs-comment\">// Entfernt</span>\nnativeImage.toJpeg()\n<span class=\"hljs-comment\">// Ersetze mit</span>\nnativeImage.toJPEG()\n</code></pre>\n<h3 id=\"process-1\"><a href=\"#process-1\"><code>process</code></a></h3>\n<ul>\n<li><code>process.versions.electron</code> and <code>process.version.chrome</code> will be made read-only properties for consistency with the other <code>process.versions</code> properties set by Node.</li>\n</ul>\n<h3 id=\"webcontents-1\"><a href=\"#webcontents-1\"><code>webContents</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Entfernt</span>\nwebContents.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Ersetze mit</span>\nwebContents.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"webframe-1\"><a href=\"#webframe-1\"><code>webFrame</code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Entfernt</span>\nwebFrame.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Ersetze mit</span>\nwebFrame.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"webview-1\"><a href=\"#webview-1\"><code>&#x3C;webview></code></a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Entfernt</span>\nwebview.setZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n<span class=\"hljs-comment\">// Ersetze mit</span>\nwebview.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">2</span>)\n</code></pre>\n<h3 id=\"duplicate-arm-assets\"><a href=\"#duplicate-arm-assets\">Duplicate ARM Assets</a></h3>\n<p>Each Electron release includes two identical ARM builds with slightly different filenames, like <code>electron-v1.7.3-linux-arm.zip</code> and <code>electron-v1.7.3-linux-armv7l.zip</code>. The asset with the <code>v7l</code> prefix was added to clarify to users which ARM version it supports, and to disambiguate it from future armv6l and arm64 assets that may be produced.</p>\n<p>The file <em>without the prefix</em> is still being published to avoid breaking any setups that may be consuming it. Starting at 2.0, the unprefixed file will no longer be published.</p>\n<p>For details, see <a href=\"https://github.com/electron/electron/pull/6986\">6986</a> and <a href=\"https://github.com/electron/electron/pull/7189\">7189</a>.</p>",
      "title": "Breaking Changes",
      "description": ""
    },
    "/docs/api/browser-view": {
      "locale": "de-DE",
      "slug": "browser-view",
      "href": "/docs/api/browser-view",
      "crowdinFileId": "256283",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-view.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"browserview\"><a href=\"#browserview\">BrowserView</a></h1>\n<p>Eine <code>Browseransicht</code> kann verwendet werden, um zusätzliche Webinhalte in ein <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> einzubetten. Es ist wie ein untergeordnetes Fenster, mit der Ausnahme, dass es relativ zu dem übergeordneten Fenster positioniert ist. Es ist als Alternative zum <code>Webview</code> Tag gedacht.</p>\n<h2 id=\"klasse-browserview\"><a href=\"#klasse-browserview\">Klasse: BrowserView</a></h2>\n<blockquote>\n<p>Erstelle und kontrolliere Ansichten.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<h3 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Im Hauptprozess.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserView, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-keyword\">const</span> view = <span class=\"hljs-keyword\">new</span> BrowserView()\nwin.setBrowserView(view)\nview.setBounds({ <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">0</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">0</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">300</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">300</span> })\nview.webContents.loadURL(<span class=\"hljs-string\">'https://electronjs.org'</span>)\n</code></pre>\n<h3 id=\"new-browserviewoptions-experimental\"><a href=\"#new-browserviewoptions-experimental\"><code>new BrowserView([options])</code> <em>Experimental</em></a></h3>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>webPreferences</code> Object (optional) - Siehe <a href=\"/docs/api/browser-window\">BrowserWindow</a>.</li>\n</ul></li>\n</ul>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<p>Objekte, die mit <code>new BrowserView</code> erstellt wurden, haben folgende Eigenschaften:</p>\n<h4 id=\"viewwebcontents-experimental\"><a href=\"#viewwebcontents-experimental\"><code>view.webContents</code> <em>Experimental</em></a></h4>\n<p>A <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> object owned by this view.</p>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<p>Objekte, die mit <code>new BrowserView</code> erstellt wurden, haben folgende Instanzmethoden:</p>\n<h4 id=\"viewsetautoresizeoptions-experimental\"><a href=\"#viewsetautoresizeoptions-experimental\"><code>view.setAutoResize(options)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>width</code> Boolean (optional) - Wenn <code>true</code>, wächst und schrumpft die Breite der Ansicht zusammen mit dem übergeordneten Fenster. Automatisch <code>false</code>.</li>\n<li><code>height</code> Boolean (optional) - Wenn <code>true</code>, wächst und schrumpft die Höhe der Ansicht zusammen mit dem übergeordneten Fenster. Automatisch <code>false</code>.</li>\n<li><code>horizontal</code> Boolean (optional) - Wenn <code>true</code>, ändert sich sowohl die X-Position als auch die Breite der Ansicht zusammen mit dem übergeordneten Fenster. Automatisch <code>false</code>.</li>\n<li><code>vertical</code> Boolean (optional) - Wenn <code>true</code>, ändert sich sowohl die Y-Position als auch die Höhe der Ansicht zusammen mit dem übergeordneten Fenster. Automatisch <code>false</code>.</li>\n</ul></li>\n</ul>\n<h4 id=\"viewsetboundsbounds-experimental\"><a href=\"#viewsetboundsbounds-experimental\"><code>view.setBounds(bounds)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> Die Grenzen der Ansicht als Rechteck</li>\n</ul>\n<p>Passt die Ansicht an die Dimensionen und die Ausrichtung des Rechteckes relativ zum übergeordneten Fenster an.</p>\n<h4 id=\"viewgetbounds-experimental\"><a href=\"#viewgetbounds-experimental\"><code>view.getBounds()</code> <em>Experimental</em></a></h4>\n<p>Gibt <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> zurück</p>\n<p>Die <code>bounds</code> dieser BrowserView-Instanz als <code>Object</code>.</p>\n<h4 id=\"viewsetbackgroundcolorcolor-experimental\"><a href=\"#viewsetbackgroundcolorcolor-experimental\"><code>view.setBackgroundColor(color)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>color</code> String - Farbe in <code>#aarrggbb</code> oder <code>#argb</code> Form. Der Alpha-Kanal ist optional.</li>\n</ul>",
      "title": "BrowserView",
      "description": "Erstelle und kontrolliere Ansichten."
    },
    "/docs/api/browser-window": {
      "locale": "de-DE",
      "slug": "browser-window",
      "href": "/docs/api/browser-window",
      "crowdinFileId": "256287",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-window.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"browserfenster\"><a href=\"#browserfenster\">Browserfenster</a></h1>\n<blockquote>\n<p>Erstellung und Steuerung von Browserfenstern.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Im Hauptprozess.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-comment\">// Load a remote URL</span>\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\n<span class=\"hljs-comment\">// Or load a local HTML file</span>\nwin.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n</code></pre>\n<h2 id=\"rahmenloses-fenster\"><a href=\"#rahmenloses-fenster\">Rahmenloses Fenster</a></h2>\n<p>Um ein Fenster ohne Chrome, ein transparentes Fenster oder ein Fenster in einer beliebigen Form zu erzeugen, können sie die <a href=\"/docs/api/frameless-window\">Frameless Window</a> API verwenden.</p>\n<h2 id=\"showing-the-window-gracefully\"><a href=\"#showing-the-window-gracefully\">Showing the window gracefully</a></h2>\n<p>When loading a page in the window directly, users may see the page load incrementally, which is not a good experience for a native app. To make the window display without a visual flash, there are two solutions for different situations.</p>\n<h3 id=\"using-the-ready-to-show-event\"><a href=\"#using-the-ready-to-show-event\">Using the <code>ready-to-show</code> event</a></h3>\n<p>Das <code>ready-to-show</code> Ereignis wird während des Ladens der Seite ausgelöst, falls das Fenster noch nicht angezeigt wurde nachdem der Rendererprozess die Seite erstmalig gerendert hat. Wenn das Fenster nach diesem Ereignis gezeigt wird, gibt es keinen bemerkbaren Seitenaufbau:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span> })\nwin.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => {\n  win.show()\n})\n</code></pre>\n<p>Für gewöhnlich wird dieses Ereignis nach dem <code>did-finish-load</code> Ereignis ausgelöst. Bei Seiten mit vielen Remoteressourcen kann es aber passieren dass das Event vor dem <code>did-finish-load</code> Ereignis ausgelöst wird.</p>\n<p>Bitte beachten Sie, dass die Verwendung dieses Ereignisses impliziert, dass der Renderer als \"sichtbar\" und bemalt betrachtet wird, obwohl <code>show</code> falsch ist.  Dieses Ereignis wird nie abfeuern, wenn <code>paintWhenInitiallyHidden: false</code> gesetzt ist.</p>\n<h3 id=\"setting-the-backgroundcolor-property\"><a href=\"#setting-the-backgroundcolor-property\">Setting the <code>backgroundColor</code> property</a></h3>\n<p>Bei umfangreichen Apps könnte das <code>ready-to-show</code> Ereignis zu spät ausgelöst werden, sodass sich die App langsam anfühlt. In diesem Fall empfiehlt es sich, das Fenster sofort anzuzeigen und die <code>backgroundColor</code> auf einen Wert zu setzen der dem Hintergrund ihrer App ähnelt:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#2e2c29'</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<p>Beachten Sie dass es sich auch bei Apps die das <code>ready-to-show</code> Ereignis verwenden empfiehlt die <code>backgroundColor</code> zu setzen, damit sich die App nativer anfühlt.</p>\n<h2 id=\"übergeordnete-und-untergeordnete-fenster\"><a href=\"#übergeordnete-und-untergeordnete-fenster\">Übergeordnete und untergeordnete Fenster</a></h2>\n<p>Mithilfe der <code>parent</code> Option können Sie untergeordnete Fenster erstellen:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> top = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n<span class=\"hljs-keyword\">const</span> child = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">parent</span>: top })\nchild.show()\ntop.show()\n</code></pre>\n<p>Das <code>child</code> Fenster wird stets über dem <code>top</code> Fenster angezeigt.</p>\n<h2 id=\"modale-fenster\"><a href=\"#modale-fenster\">Modale Fenster</a></h2>\n<p>Ein modales Fenster ist ein untergeordnetes Fenster, das das übergeordnete Fenster sperrt. Um ein modales Fenster zu erzeugen müssen sie sowohl die <code>parent</code> als auch die <code>modal</code> Optionen setzen:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> child = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">parent</span>: top, <span class=\"hljs-attr\">modal</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span> })\nchild.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\nchild.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => {\n  child.show()\n})\n</code></pre>\n<h2 id=\"seiten-sichtbarkeit\"><a href=\"#seiten-sichtbarkeit\">Seiten Sichtbarkeit</a></h2>\n<p>Die <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API\">Page Visibility API</a> Funktioniert wie folgt:</p>\n<ul>\n<li>Auf allen Plattformen gibt der Sichtbarkeitszustand an ob das Fenster versteckt bzw. minimiert ist oder nicht.</li>\n<li>Zusätzlich wird unter macOS auch angegeben ob das Fenster verdeckt ist. Wenn das Fenster vollständig durch ein anderes Fenster verdeckt ist, ist der Sichtbarkeitszustand <code>hidden</code>. Auf den anderen Plattformen ist der Sichtbarkeitszustand nur <code>hidden</code>, wenn das Fenster minimiert oder explizit durch <code>win.hide()</code> verseckt wurde.</li>\n<li>Wenn ein <code>BrowserWindow</code> mit der Option <code>show: false</code> erzeugt wurde, ist der anfängliche Sichtbarkeitszustand <code>visible</code>, obwohl das Fenster eigentlich versteckt ist.</li>\n<li>Wenn <code>backgroundThrottling</code> deaktiviert ist, bleibt der Sichtbarkeitszustand <code>visible</code>, selbst wenn das Fenster minimiert, verdeckt oder versteckt wird.</li>\n</ul>\n<p>Es wird empfohlen aufwendige Aufgaben zu pausieren wenn der Sichtbarkeitszustand <code>hidden</code> ist, um Energie zu sparen.</p>\n<h2 id=\"plattformhinweise\"><a href=\"#plattformhinweise\">Plattformhinweise</a></h2>\n<ul>\n<li>Unter macOS werden modale Fenster als Seiten angezeigt, die an das übergeordnete Fenster angehängt sind.</li>\n<li>Wenn unter macOS übergeordnete Fenster bewegt werden, behalten untergeordnete Fenster ihre Position relativ zum übergeordneten Fenster bei. Unter Windows und Linux bewegen sich die untergeordneten Fenster nicht.</li>\n<li>Unter Linux wird der Typ von modalen Fenstern zu <code>dialog</code> geändert.</li>\n<li>Unter Linux wird das verstecken von modalen Fenstern von vielen Desktop Umgebungen nicht unterstützt.</li>\n</ul>\n<h2 id=\"klasse-browserwindow\"><a href=\"#klasse-browserwindow\">Klasse: BrowserWindow</a></h2>\n<blockquote>\n<p>Erstellung und Steuerung von Browserfenstern.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p><code>BrowserWindow</code> ist ein <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p>Es erzeugt ein neues <code>BrowserWindow</code> mit nativen Eigenschaften die durch <code>options</code> gesetzt wurden.</p>\n<h3 id=\"new-browserwindowoptions\"><a href=\"#new-browserwindowoptions\"><code>new BrowserWindow([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>width</code> Integer (optional) - Fensterbreite in Pixel. Standard ist <code>800</code>.</li>\n<li><code>height</code> Integer (optional) - Fensterhöhe in Pixel. Standard ist <code>600</code>.</li>\n<li><code>x</code> Integer (optional) - (<strong>notwendig</strong> wenn y gegeben wird) der x-Versatz des Fensters zum Bildschirm. Standardmäßig wird das Fenster zentriert.</li>\n<li><code>y</code> Integer (optional) - (<strong>notwendig</strong> wenn x gegeben wird) der y-Versatz des Fensters zum Bildschirm. Standardmäßig wird das Fenster zentriert.</li>\n<li><code>useContentSize</code> Boolean (optional) - Die <code>width</code> und <code>height</code> Werte werden als Größe der angezeigten Webseite verwendet. D.h. die tatsächliche Größe des Fensters beinhaltet noch die Rahmengröße und ist deshalb etwas größer. Standard ist <code>false</code>.</li>\n<li><code>center</code> Boolean (optional) - Zeige das Fenster in der Mitte des Bildschirms.</li>\n<li><code>minWidth</code> Integer (optional) - die minimale Fensterbreite. Standard ist <code>0</code>.</li>\n<li><code>minHeight</code> Integer (optional) - die minimale Fensterhöhe. Standard ist <code>0</code>.</li>\n<li><code>maxWidth</code> Integer (optional) - die maximale Fensterbreite. Der Standardwert ist kein Limit.</li>\n<li><code>maxHeight</code> Integer (optional) - die maximale Fensterhöhe. Der Standardwert ist kein Limit.</li>\n<li><code>resizable</code> Boolean (optional) - Gibt an, ob die Fenstergröße geändert werden kann. Standard ist <code>true</code>.</li>\n<li><code>movable</code> Boolean (optional) - Gibt an, ob das Fenster verschoben werden kann. Diese Option ist unter Linux noch nicht implementiert. Standard ist <code>true</code>.</li>\n<li><code>minimizable</code> Boolean (optional) - ob das Fenster minimiert werden kann. Diese Option ist unter Linux noch nicht implementiert. Standard ist <code>true</code>.</li>\n<li><code>maximizable</code> Boolean (optional) - ob das Fenster maximiert werden kann. Diese Option ist unter Linux noch nicht implementiert. Standard ist <code>true</code>.</li>\n<li><code>closable</code> Boolean (optional) - Gibt an, ob das Fenster geschlossen werden kann. Diese Option ist unter Linux noch nicht implementiert. Standard ist <code>true</code>.</li>\n<li><code>focusable</code> Boolean (optional) - Gibt an ob das Fenster fokussiert werden kann. Standard ist <code>true</code>. Unter Windows impliziert die Option <code>focusable: false</code> die Option <code>skipTaskbar: true</code>. Unter Linux sorgt <code>focusable: false</code> dafür dass das Fenster nicht mehr mit dem Fenstermanager interagiert, d.h. das Fenster bleibt in allen Arbeitsoberflächen ganz oben.</li>\n<li><code>alwaysOnTop</code> Boolean (optional) - Gibt an ob das Fenster immer über anderen Fenstern angezeigt werden soll. Standard ist <code>false</code>.</li>\n<li><code>fullscreen</code> Boolean (optional) - Gibt an ob das Fenster im Vollbildmodus angezeigt werden soll. Wenn diese Option explizit auf <code>false</code> gesetzt wird, wird der Button für Vollbildmodus unter macOS versteckt oder deaktiviert. Standard ist <code>false</code>.</li>\n<li><code>fullscreenable</code> Boolean (optional) - Gibt an ob das Fenster in den Vollbildmodus versetzt werden kann. Unter macOS gibt diese Option auch an, ob der Maximieren/Zoom Button das Fenster in den Vollbildmodus versetzt oder maximiert. Standard ist <code>true</code>.</li>\n<li><code>simpleFullscreen</code>Boolean (optional) - Gibt an ob der pre-Lion Vollbildmodus unter macOS verwendet werden soll. Standard ist <code>false</code>.</li>\n<li><code>skipTaskbar</code> Boolean (optional) - Gibt an ob das Fenster in der Taskbar anzeigt werden soll. Standard ist <code>false</code>.</li>\n<li><code>kiosk</code> Boolean (optional) - Gibt an, ob der Benutzer eingeschränkte Rechte besitzt (Kiosk-Modus). Standard ist <code>false</code>.</li>\n<li><code>Titel</code> String (optional) - der Standardfenstertitel. Standard ist <code>\"Electron\"</code>. Wenn der HTML-Tag <code>&#x3C;title></code> in der von <code>loadUrl()</code> geladenen HTML-Datei festgelegt ist, dann wird dieser Wert ignoriert.</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (optional) - Das Fenstericon. Es empfiehlt sich unter Windows ein <code>ICO</code> Icon zu verwenden um die besten visuellen Effekte zu erreichen. Das Icon der Executable wird verwendet wenn dieser Wert nicht definiert wird.</li>\n<li><code>show</code> Boolean (optional) - Gibt an ob das Fenster angezeigt wird, sobald es erstellt wurde. Standard ist <code>true</code>.</li>\n<li><code>paintWhenInitiallyHidden</code> Boolean (optional) - Gibt an, ob der Renderer aktiv sein soll, wenn <code>show</code> <code>false</code> ist und das Fenster gerade erstellt wurde.  Damit <code>document.visibilityState</code> beim ersten Laden mit <code>show: false</code> korrekt funktioniert, sollten Sie diesen Wert auf <code>false</code>setzen.  Wenn Sie diese Einstellung auf <code>false</code> festlegen, wird das <code>ready-to-show</code> -Ereignis nicht ausgelöst.  Standard ist <code>true</code>.</li>\n<li><code>frame</code> Boolean (optional) - Geben Sie <code>false</code> an, um ein <a href=\"/docs/api/frameless-window\">Frameless Window</a>zu erstellen. Standard ist <code>true</code>.</li>\n<li><code>parent</code> BrowserWindow (optional) - Geben Sie das übergeordnete Fenster an. Standard ist <code>null</code>.</li>\n<li><code>modal</code> Boolean (optional) - Gibt an, ob es das Fenster ein modales Fenster sein soll. Diese Funktion funktioniert nur, wenn das Fenster ein untergeordnetes Fenster ist. Standard ist <code>false</code>.</li>\n<li><code>acceptFirstMouse</code> Boolean (optional) - Whether clicking an inactive window will also click through to the web contents. Default is <code>false</code> on macOS. This option is not configurable on other platforms.</li>\n<li><code>disableAutoHideCursor</code> Boolean (optional) - Ob der Cursor ausgeblendet werden soll, wenn der Benutzer tippt. Standard ist <code>false</code>.</li>\n<li><code>autoHideMenuBar</code> Boolean (optional) - Blendet die Menüleiste automatisch aus, es sei denn, die <code>Alt</code> Taste wird gedrückt. Standard ist <code>false</code>.</li>\n<li><code>enableLargerThanScreen</code> Boolean (optional) - Dieser Wert gibt an, ob das Fenster größer als der Bildschirm sein kann. Nur relevant für macOS, da andere Betriebssysteme standardmäßig Fenster erlauben, die größer als der Bildschirm sind. Standard ist <code>false</code>.</li>\n<li><code>backgroundColor</code> String (optional) - Die Hintergrundfarbe des Fensters als hexadezimaler Wert, wie zum Beispiel <code>#66CD00</code> oder <code>#FFF</code> oder <code>#80FFFFFF</code> (alpha im #AARRGGBB Format wird unterstützt, wenn <code>transparent</code> auf <code>true</code> gesetzt ist). Der Standardwert ist <code>#FFF</code> (weiß).</li>\n<li><code>hasShadow</code> Boolean (optional) - Gibt an, ob das Fenster einen Schatten haben soll. Standard ist <code>true</code>.</li>\n<li><code>opacity</code> Zahl (optional) - Setzt die anfängliche Deckkraft des Fensters zwischen 0,0 (vollständig transparent) und 1,0 (vollständig undurchsichtig). Dies ist nur unter Windows und macOS implementiert.</li>\n<li><code>darkTheme</code> Boolean (optional) - Erzwingt ein dunkles Farbschema. Funktioniert nur mit manchen GTK+3 Desktopumgebungen. Standard ist <code>false</code>.</li>\n<li><code>transparent</code> Boolean (optional) - Macht das Fenster <a href=\"/docs/api/frameless-window#transparent-window\">transparent</a>. Standard ist <code>false</code>. Unter Windows funktioniert es nur, wenn das Fenster rahmenlos ist.</li>\n<li><code>type</code> String (optional) - Der Fenstertyp. Standard ist ein normales Fenster. Mehr dazu kann weiter unten gelesen werden.</li>\n<li><code>visualEffectState</code> String (optional) - Specify how the material appearance should reflect window activity state on macOS. Must be used with the <code>vibrancy</code> property. Mögliche Werte sind:<ul>\n<li><code>followWindow</code> - The backdrop should automatically appear active when the window is active, and inactive when it is not. This is the default.</li>\n<li><code>active</code> - The backdrop should always appear active.</li>\n<li><code>inactive</code> - The backdrop should always appear inactive.</li>\n</ul></li>\n<li><code>titleBarStyle</code> String (optional) <em>macOS</em> <em>Windows</em> - The style of window title bar. Standard ist <code>default</code>. Mögliche Werte sind:<ul>\n<li><code>default</code> - Results in the standard title bar for macOS or Windows respectively.</li>\n<li><code>hidden</code> - Results in a hidden title bar and a full size content window. On macOS, the window still has the standard window controls (“traffic lights”) in the top left. On Windows, when combined with <code>titleBarOverlay: true</code> it will activate the Window Controls Overlay (see <code>titleBarOverlay</code> for more information), otherwise no window controls will be shown.</li>\n<li><code>hiddenInset</code> - Only on macOS, results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge.</li>\n<li><code>customButtonsOnHover</code> - Only on macOS, results in a hidden title bar and a full size content window, the traffic light buttons will display when being hovered over in the top left of the window.  <strong>Note:</strong> This option is currently experimental.</li>\n</ul></li>\n<li><code>trafficLightPosition</code> <a href=\"/docs/api/structures/point\">Point</a> (optional) - Set a custom position for the traffic light buttons in frameless windows.</li>\n<li><code>roundedCorners</code> Boolean (optional) - Whether frameless window should have rounded corners on macOS. Standard ist <code>true</code>.</li>\n<li><code>fullscreenWindowTitle</code> Boolean (optional) <em>Deprecated</em> - Shows the title in the title bar in full screen mode on macOS for <code>hiddenInset</code> titleBarStyle. Standard ist <code>false</code>.</li>\n<li><code>thickFrame</code> Boolean (optional) - Use <code>WS_THICKFRAME</code> style for frameless windows on Windows, which adds standard window frame. Fensterschatten und Fensteranimationen werden entfernt wenn dieser Wert <code>false</code> ist. Standard ist <code>true</code>.</li>\n<li><code>vibrancy</code> String (optional) - Add a type of vibrancy effect to the window, only on macOS. Can be <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>titlebar</code>, <code>selection</code>, <code>menu</code>, <code>popover</code>, <code>sidebar</code>, <code>medium-light</code>, <code>ultra-dark</code>, <code>header</code>, <code>sheet</code>, <code>window</code>, <code>hud</code>, <code>fullscreen-ui</code>, <code>tooltip</code>, <code>content</code>, <code>under-window</code>, or <code>under-page</code>. Please note that <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>medium-light</code>, and <code>ultra-dark</code> are deprecated and have been removed in macOS Catalina (10.15).</li>\n<li><code>zoomToPageWidth</code> Boolean (optional) - Controls the behavior on macOS when option-clicking the green stoplight button on the toolbar or by clicking the Window > Zoom menu item. If <code>true</code>, the window will grow to the preferred width of the web page when zoomed, <code>false</code> will cause it to zoom to the width of the screen. This will also affect the behavior when calling <code>maximize()</code> directly. Standard ist <code>false</code>.</li>\n<li><code>tabbingIdentifier</code> String (optional) - Reitergruppenname, erlaubt das öffnen des Fensters als nativen Reiter unter macOS 10.12+. Fenster mit dem selben Reitergruppennamen werden gruppiert. This also adds a native new tab button to your window's tab bar and allows your <code>app</code> and window to receive the <code>new-window-for-tab</code> event.</li>\n<li><code>webPreferences</code> Object (optional) - Settings of web page's features.<ul>\n<li><code>devTools</code> Boolean (optional) - Gibt an ob die Entwicklerwerkzeuge aktiviert sind. Falls dies auf <code>false</code> gesetzt ist, kann <code>BrowserWindow.webContents.openDevTools()</code> nicht verwendet werden um die Entwicklerwerkzeuge zu öffnen. Standard ist <code>true</code>.</li>\n<li><code>nodeIntegration</code> Boolean (optional) - Whether node integration is enabled. Standard ist <code>false</code>.</li>\n<li><code>nodeIntegrationsInWorker</code> Boolean (optional) - Gibt an ob die Node Integration in Web Workern aktiviert ist. Standard ist <code>false</code>. Mehr dazu kann in <a href=\"/docs/tutorial/multithreading\">Multithreading</a> gefunden werden.</li>\n<li><code>nodeIntegrationInSubFrames</code> Boolean (optional) - Experimental option for enabling Node.js support in sub-frames such as iframes and child windows. All your preloads will load for every iframe, you can use <code>process.isMainFrame</code> to determine if you are in the main frame or not.</li>\n<li><code>preload</code> String (optional) - Gibt ein Skript an das vor allen anderen Skripten geladen wird bevor andere Skripte der Seite ausgeführt werden. Dieses Skript hat immer Zugriff auf die Node APIs, unabhängig davon ob die Node Integration aktiviert ist oder nicht. Der Wert sollte der absolute Pfad zum Skript sein. Wenn die Node Integration ausgeschaltet ist, kann das Preload Skript globale Node Symbole in den Globalen Scope zurückbringen. Siehe <a href=\"/docs/api/context-bridge#exposing-node-global-symbols\">dieses Beispiel</a>.</li>\n<li><code>sandbox</code> Boolean (optional) - Wenn gesetzt, wird der Renderer des Fensters in einer Sandbox ausgeführt, wodurch es kompatibel mit der Chromium Sandbox wird und die Node.js Integration deaktiviert wird. Dies ist nicht das gleiche wie <code>nodeIntegration</code>, da die APIs die dem Preload Skript zur Verfügung stehen stärker limitiert sind. Lesen sie <a href=\"/docs/tutorial/sandbox\">hier</a> mehr über diese Option.</li>\n<li><code>session</code> <a href=\"/docs/api/session#class-session\">Session</a> (optional) - Sets the session used by the page. Instead of passing the Session object directly, you can also choose to use the <code>partition</code> option instead, which accepts a partition string. When both <code>session</code> and <code>partition</code> are provided, <code>session</code> will be preferred. Default is the default session.</li>\n<li><code>partition</code> String (optional) - Sets the session used by the page according to the session's partition string. If <code>partition</code> starts with <code>persist:</code>, the page will use a persistent session available to all pages in the app with the same <code>partition</code>. If there is no <code>persist:</code> prefix, the page will use an in-memory session. By assigning the same <code>partition</code>, multiple pages can share the same session. Default is the default session.</li>\n<li><code>zoomFactor</code> Number (optional) - The default zoom factor of the page, <code>3.0</code> represents <code>300%</code>. Standard ist <code>1.0</code>.</li>\n<li><code>javascript</code> Boolean (optional) - Enables JavaScript support. Standard ist <code>true</code>.</li>\n<li><code>webSecurity</code> Boolean (optional) - When <code>false</code>, it will disable the same-origin policy (usually using testing websites by people), and set <code>allowRunningInsecureContent</code> to <code>true</code> if this options has not been set by user. Standard ist <code>true</code>.</li>\n<li><code>allowRunningInsecureContent</code> Boolean (optional) - Allow an https page to run JavaScript, CSS or plugins from http URLs. Standard ist <code>false</code>.</li>\n<li><code>images</code> Boolean (optional) - Enables image support. Standard ist <code>true</code>.</li>\n<li><code>imageAnimationPolicy</code> String (optional) - Specifies how to run image animations (E.g. GIFs).  Can be <code>animate</code>, <code>animateOnce</code> or <code>noAnimation</code>.  Standard ist <code>animate</code>.</li>\n<li><code>textAreasAreResizable</code> Boolean (optional) - Make TextArea elements resizable. Default is <code>true</code>.</li>\n<li><code>webgl</code> Boolean (optional) - Enables WebGL support. Standard ist <code>true</code>.</li>\n<li><code>plugins</code> Boolean (optional) - Whether plugins should be enabled. Standard ist <code>false</code>.</li>\n<li><code>experimentalFeatures</code> Boolean (optional) - Enables Chromium's experimental features. Standard ist <code>false</code>.</li>\n<li><code>scrollBounce</code> Boolean (optional) - Enables scroll bounce (rubber banding) effect on macOS. Standard ist <code>false</code>.</li>\n<li><code>enableBlinkFeatures</code> String (optional) - A list of feature strings separated by <code>,</code>, like <code>CSSVariables,KeyboardEventKey</code> to enable. The full list of supported feature strings can be found in the <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> file.</li>\n<li><code>disableBlinkFeatures</code> String (optional) - A list of feature strings separated by <code>,</code>, like <code>CSSVariables,KeyboardEventKey</code> to disable. The full list of supported feature strings can be found in the <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> file.</li>\n<li><code>defaultFontFamily</code> Object (optional) - Sets the default font for the font-family.<ul>\n<li><code>standard</code> String (optional) - Defaults to <code>Times New Roman</code>.</li>\n<li><code>serif</code> String (optional) - Defaults to <code>Times New Roman</code>.</li>\n<li><code>sansSerif</code> String (optional) - Defaults to <code>Arial</code>.</li>\n<li><code>monospace</code> String (optional) - Defaults to <code>Courier New</code>.</li>\n<li><code>cursive</code> String (optional) - Defaults to <code>Script</code>.</li>\n<li><code>fantasy</code> String (optional) - Defaults to <code>Impact</code>.</li>\n</ul></li>\n<li><code>defaultFontSize</code> Integer (optional) - Defaults to <code>16</code>.</li>\n<li><code>defaultMonospaceFontSize</code> Integer (optional) - Defaults to <code>13</code>.</li>\n<li><code>minimumFontSize</code> Integer (optional) - Defaults to <code>0</code>.</li>\n<li><code>defaultEncoding</code> String (optional) - Defaults to <code>ISO-8859-1</code>.</li>\n<li><code>backgroundThrottling</code> Boolean (optional) - Whether to throttle animations and timers when the page becomes background. This also affects the <a href=\"#page-visibility\">Page Visibility API</a>. Defaults to <code>true</code>.</li>\n<li><code>offscreen</code> Boolean (optional) - Whether to enable offscreen rendering for the browser window. Defaults to <code>false</code>. See the <a href=\"/docs/tutorial/offscreen-rendering\">offscreen rendering tutorial</a> for more details.</li>\n<li><code>contextIsolation</code> Boolean (optional) - Whether to run Electron APIs and the specified <code>preload</code> script in a separate JavaScript context. Defaults to <code>true</code>. The context that the <code>preload</code> script runs in will only have access to its own dedicated <code>document</code> and <code>window</code> globals, as well as its own set of JavaScript builtins (<code>Array</code>, <code>Object</code>, <code>JSON</code>, etc.), which are all invisible to the loaded content. The Electron API will only be available in the <code>preload</code> script and not the loaded page. This option should be used when loading potentially untrusted remote content to ensure the loaded content cannot tamper with the <code>preload</code> script and any Electron APIs being used.  This option uses the same technique used by <a href=\"https://developer.chrome.com/extensions/content_scripts#execution-environment\">Chrome Content Scripts</a>.  You can access this context in the dev tools by selecting the 'Electron Isolated Context' entry in the combo box at the top of the Console tab.</li>\n<li><code>nativeWindowOpen</code> Boolean (optional) - Whether to use native <code>window.open()</code>. Defaults to <code>true</code>. Child windows will always have node integration disabled unless <code>nodeIntegrationInSubFrames</code> is true.</li>\n<li><code>webviewTag</code> Boolean (optional) - Whether to enable the <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code> tag</a>. Defaults to <code>false</code>. <strong>Note:</strong> The <code>preload</code> script configured for the <code>&#x3C;webview></code> will have node integration enabled when it is executed so you should ensure remote/untrusted content is not able to create a <code>&#x3C;webview></code> tag with a possibly malicious <code>preload</code> script. You can use the <code>will-attach-webview</code> event on <a href=\"/docs/api/web-contents\">webContents</a> to strip away the <code>preload</code> script and to validate or alter the <code>&#x3C;webview></code>'s initial settings.</li>\n<li><code>additionalArguments</code> String<a href=\"/docs/api/optional\"></a> - A list of strings that will be appended to <code>process.argv</code> in the renderer process of this app.  Useful for passing small bits of data down to renderer process preload scripts.</li>\n<li><code>safeDialogs</code> Boolean (optional) - Whether to enable browser style consecutive dialog protection. Standard ist <code>false</code>.</li>\n<li><code>safeDialogsMessage</code> String (optional) - The message to display when consecutive dialog protection is triggered. If not defined the default message would be used, note that currently the default message is in English and not localized.</li>\n<li><code>disableDialogs</code> Boolean (optional) - Whether to disable dialogs completely. Overrides <code>safeDialogs</code>. Standard ist <code>false</code>.</li>\n<li><code>navigateOnDragDrop</code> Boolean (optional) - Whether dragging and dropping a file or link onto the page causes a navigation. Standard ist <code>false</code>.</li>\n<li><code>autoplayPolicy</code> String (optional) - Autoplay policy to apply to content in the window, can be <code>no-user-gesture-required</code>, <code>user-gesture-required</code>, <code>document-user-activation-required</code>. Defaults to <code>no-user-gesture-required</code>.</li>\n<li><code>disableHtmlFullscreenWindowResize</code> Boolean (optional) - Whether to prevent the window from resizing when entering HTML Fullscreen. Default is <code>false</code>.</li>\n<li><code>accessibleTitle</code> String (optional) - An alternative title string provided only to accessibility tools such as screen readers. This string is not directly visible to users.</li>\n<li><code>spellcheck</code> Boolean (optional) - Whether to enable the builtin spellchecker. Standard ist <code>true</code>.</li>\n<li><code>enableWebSQL</code> Boolean (optional) - Whether to enable the <a href=\"https://www.w3.org/TR/webdatabase/\">WebSQL api</a>. Standard ist <code>true</code>.</li>\n<li><code>v8CacheOptions</code> String (optional) - Enforces the v8 code caching policy used by blink. Accepted values are<ul>\n<li><code>none</code> - Disables code caching</li>\n<li><code>code</code> - Heuristic based code caching</li>\n<li><code>bypassHeatCheck</code> - Bypass code caching heuristics but with lazy compilation</li>\n<li><code>bypassHeatCheckAndEagerCompile</code> - Same as above except compilation is eager. Default policy is <code>code</code>.</li>\n</ul></li>\n<li><code>enablePreferredSizeMode</code> Boolean (optional) - Whether to enable preferred size mode. The preferred size is the minimum size needed to contain the layout of the document—without requiring scrolling. Enabling this will cause the <code>preferred-size-changed</code> event to be emitted on the <code>WebContents</code> when the preferred size changes. Standard ist <code>false</code>.</li>\n</ul></li>\n<li><code>titleBarOverlay</code> Object | Boolean (optional) -  When using a frameless window in conjuction with <code>win.setWindowButtonVisibility(true)</code> on macOS or using a <code>titleBarStyle</code> so that the standard window controls (\"traffic lights\" on macOS) are visible, this property enables the Window Controls Overlay <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis\">JavaScript APIs</a> and <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables\">CSS Environment Variables</a>. Specifying <code>true</code> will result in an overlay with default system colors. Standard ist <code>false</code>.<ul>\n<li><code>color</code> String (optional) <em>Windows</em> - The CSS color of the Window Controls Overlay when enabled. Default is the system color.</li>\n<li><code>symbolColor</code> String (optional) <em>Windows</em> - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>When setting minimum or maximum window size with <code>minWidth</code>/<code>maxWidth</code>/ <code>minHeight</code>/<code>maxHeight</code>, it only constrains the users. It won't prevent you from passing a size that does not follow size constraints to <code>setBounds</code>/<code>setSize</code> or to the constructor of <code>BrowserWindow</code>.</p>\n<p>The possible values and behaviors of the <code>type</code> option are platform dependent. Mögliche Werte sind:</p>\n<ul>\n<li>On Linux, possible types are <code>desktop</code>, <code>dock</code>, <code>toolbar</code>, <code>splash</code>, <code>notification</code>.</li>\n<li>On macOS, possible types are <code>desktop</code>, <code>textured</code>.<ul>\n<li>The <code>textured</code> type adds metal gradient appearance (<code>NSTexturedBackgroundWindowMask</code>).</li>\n<li>The <code>desktop</code> type places the window at the desktop background window level (<code>kCGDesktopWindowLevel - 1</code>). Note that desktop window will not receive focus, keyboard or mouse events, but you can use <code>globalShortcut</code> to receive input sparingly.</li>\n</ul></li>\n<li>On Windows, possible type is <code>toolbar</code>.</li>\n</ul>\n<h3 id=\"instanz-ereignisse\"><a href=\"#instanz-ereignisse\">Instanz-Ereignisse</a></h3>\n<p>Objekte welche mit <code>new BrowserWindow</code> erzeugt wurden emitieren folgende Events:</p>\n<p><strong>Hinweis:</strong> Manche Methoden sind nur auf spezifischen Betriebssystemen verfügbar und sind dementsprechend gekennzeichnet.</p>\n<h4 id=\"event-page-title-updated\"><a href=\"#event-page-title-updated\">Event: 'page-title-updated'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>Emitted when the document changed its title, calling <code>event.preventDefault()</code> will prevent the native window's title from changing. <code>explicitSet</code> is false when title is synthesized from file URL.</p>\n<h4 id=\"event-close\"><a href=\"#event-close\">Event: 'close'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the window is going to be closed. It's emitted before the <code>beforeunload</code> and <code>unload</code> event of the DOM. Calling <code>event.preventDefault()</code> will cancel the close.</p>\n<p>Usually you would want to use the <code>beforeunload</code> handler to decide whether the window should be closed, which will also be called when the window is reloaded. In Electron, returning any value other than <code>undefined</code> would cancel the close. Ein Beispiel:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-built_in\">window</span>.onbeforeunload = <span class=\"hljs-function\">(<span class=\"hljs-params\">e</span>) =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'I do not want to be closed'</span>)\n\n  <span class=\"hljs-comment\">// Unlike usual browsers that a message box will be prompted to users, returning</span>\n  <span class=\"hljs-comment\">// a non-void value will silently cancel the close.</span>\n  <span class=\"hljs-comment\">// It is recommended to use the dialog API to let the user confirm closing the</span>\n  <span class=\"hljs-comment\">// application.</span>\n  e.returnValue = <span class=\"hljs-literal\">false</span> <span class=\"hljs-comment\">// equivalent to `return false` but not recommended</span>\n}\n</code></pre>\n<p><em><strong>Note</strong>: There is a subtle difference between the behaviors of <code>window.onbeforeunload = handler</code> and <code>window.addEventListener('beforeunload', handler)</code>. It is recommended to always set the <code>event.returnValue</code> explicitly, instead of only returning a value, as the former works more consistently within Electron.</em></p>\n<h4 id=\"event-closed\"><a href=\"#event-closed\">Event: 'closed'</a></h4>\n<p>Emitted when the window is closed. After you have received this event you should remove the reference to the window and avoid using it any more.</p>\n<h4 id=\"event-session-end-windows\"><a href=\"#event-session-end-windows\">Event: 'session-end' <em>Windows</em></a></h4>\n<p>Ausgegeben wenn die Fenstersitzung aufgrund von erzwungenem Abschalten, einem Neustart oder durch Abmelden enden wird.</p>\n<h4 id=\"event-unresponsive\"><a href=\"#event-unresponsive\">Event: 'unresponsive'</a></h4>\n<p>Ausgegeben wenn die Webseite nicht mehr antwortet.</p>\n<h4 id=\"event-responsive\"><a href=\"#event-responsive\">Event: 'responsive'</a></h4>\n<p>Ausgegeben wenn eine Webseite, die zuvor nicht mehr antwortete, wieder antwortet.</p>\n<h4 id=\"event-blur\"><a href=\"#event-blur\">Event: 'blur'</a></h4>\n<p>Ausgegeben wenn das Fenster den Fokus verliert.</p>\n<h4 id=\"event-focus\"><a href=\"#event-focus\">Event: 'focus'</a></h4>\n<p>Ausgegeben wenn das Fenster den Fokus erhält.</p>\n<h4 id=\"event-show\"><a href=\"#event-show\">Event: 'show'</a></h4>\n<p>Ausgegeben wenn das Fenster gezeigt wird.</p>\n<h4 id=\"event-hide\"><a href=\"#event-hide\">Event: 'hide'</a></h4>\n<p>Ausgegeben wenn das Fenster versteckt wird.</p>\n<h4 id=\"event-ready-to-show\"><a href=\"#event-ready-to-show\">Event: 'ready-to-show'</a></h4>\n<p>Emitted when the web page has been rendered (while not being shown) and window can be displayed without a visual flash.</p>\n<p>Bitte beachten Sie, dass die Verwendung dieses Ereignisses impliziert, dass der Renderer als \"sichtbar\" und bemalt betrachtet wird, obwohl <code>show</code> falsch ist.  Dieses Ereignis wird nie abfeuern, wenn <code>paintWhenInitiallyHidden: false</code> gesetzt ist.</p>\n<h4 id=\"event-maximize\"><a href=\"#event-maximize\">Event: 'maximize'</a></h4>\n<p>Emitted when window is maximized.</p>\n<h4 id=\"event-unmaximize\"><a href=\"#event-unmaximize\">Event: 'unmaximize'</a></h4>\n<p>Emitted when the window exits from a maximized state.</p>\n<h4 id=\"event-minimize\"><a href=\"#event-minimize\">Event: 'minimize'</a></h4>\n<p>Emitted when the window is minimized.</p>\n<h4 id=\"event-restore\"><a href=\"#event-restore\">Event: 'restore'</a></h4>\n<p>Emitted when the window is restored from a minimized state.</p>\n<h4 id=\"event-will-resize-macos-windows\"><a href=\"#event-will-resize-macos-windows\">Event: 'will-resize' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newBounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Size the window is being resized to.</li>\n<li><code>details</code> Objekt<ul>\n<li><code>edge</code> (String) - The edge of the window being dragged for resizing. Can be <code>bottom</code>, <code>left</code>, <code>right</code>, <code>top-left</code>, <code>top-right</code>, <code>bottom-left</code> or <code>bottom-right</code>.</li>\n</ul></li>\n</ul>\n<p>Emitted before the window is resized. Calling <code>event.preventDefault()</code> will prevent the window from being resized.</p>\n<p>Note that this is only emitted when the window is being resized manually. Resizing the window with <code>setBounds</code>/<code>setSize</code> will not emit this event.</p>\n<p>The possible values and behaviors of the <code>edge</code> option are platform dependent. Mögliche Werte sind:</p>\n<ul>\n<li>On Windows, possible values are <code>bottom</code>, <code>top</code>, <code>left</code>, <code>right</code>, <code>top-left</code>, <code>top-right</code>, <code>bottom-left</code>, <code>bottom-right</code>.</li>\n<li>On macOS, possible values are <code>bottom</code> and <code>right</code>.<ul>\n<li>The value <code>bottom</code> is used to denote vertical resizing.</li>\n<li>The value <code>right</code> is used to denote horizontal resizing.</li>\n</ul></li>\n</ul>\n<h4 id=\"event-resize\"><a href=\"#event-resize\">Event: 'resize'</a></h4>\n<p>Emitted after the window has been resized.</p>\n<h4 id=\"event-resized-macos-windows\"><a href=\"#event-resized-macos-windows\">Event: 'resized' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Emitted once when the window has finished being resized.</p>\n<p>This is usually emitted when the window has been resized manually. On macOS, resizing the window with <code>setBounds</code>/<code>setSize</code> and setting the <code>animate</code> parameter to <code>true</code> will also emit this event once resizing has finished.</p>\n<h4 id=\"event-will-move-macos-windows\"><a href=\"#event-will-move-macos-windows\">Event: 'will-move' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newBounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Location the window is being moved to.</li>\n</ul>\n<p>Emitted before the window is moved. On Windows, calling <code>event.preventDefault()</code> will prevent the window from being moved.</p>\n<p>Note that this is only emitted when the window is being resized manually. Resizing the window with <code>setBounds</code>/<code>setSize</code> will not emit this event.</p>\n<h4 id=\"event-move\"><a href=\"#event-move\">Event: 'move'</a></h4>\n<p>Emitted when the window is being moved to a new position.</p>\n<h4 id=\"event-moved-macos-windows\"><a href=\"#event-moved-macos-windows\">Event: 'moved' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Emitted once when the window is moved to a new position.</p>\n<p><strong>Note</strong>: On macOS this event is an alias of <code>move</code>.</p>\n<h4 id=\"event-enter-full-screen\"><a href=\"#event-enter-full-screen\">Event: 'enter-full-screen'</a></h4>\n<p>Emitted when the window enters a full-screen state.</p>\n<h4 id=\"event-leave-full-screen\"><a href=\"#event-leave-full-screen\">Event: 'leave-full-screen'</a></h4>\n<p>Emitted when the window leaves a full-screen state.</p>\n<h4 id=\"event-enter-html-full-screen\"><a href=\"#event-enter-html-full-screen\">Event: 'enter-html-full-screen'</a></h4>\n<p>Emitted when the window enters a full-screen state triggered by HTML API.</p>\n<h4 id=\"event-leave-html-full-screen\"><a href=\"#event-leave-html-full-screen\">Event: 'leave-html-full-screen'</a></h4>\n<p>Emitted when the window leaves a full-screen state triggered by HTML API.</p>\n<h4 id=\"event-always-on-top-changed\"><a href=\"#event-always-on-top-changed\">Event: 'always-on-top-changed'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>isAlwaysOnTop</code> Boolean</li>\n</ul>\n<p>Emitted when the window is set or unset to show always on top of other windows.</p>\n<h4 id=\"event-app-command-windows-linux\"><a href=\"#event-app-command-windows-linux\">Event: 'app-command' <em>Windows</em> <em>Linux</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>command</code> String</li>\n</ul>\n<p>Emitted when an <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/ms646275(v=vs.85).aspx\">App Command</a> is invoked. These are typically related to keyboard media keys or browser commands, as well as the \"Back\" button built into some mice on Windows.</p>\n<p>Commands are lowercased, underscores are replaced with hyphens, and the <code>APPCOMMAND_</code> prefix is stripped off. e.g. <code>APPCOMMAND_BROWSER_BACKWARD</code> is emitted as <code>browser-backward</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.on(<span class=\"hljs-string\">'app-command'</span>, (e, cmd) => {\n  <span class=\"hljs-comment\">// Navigate the window back when the user hits their mouse back button</span>\n  <span class=\"hljs-keyword\">if</span> (cmd === <span class=\"hljs-string\">'browser-backward'</span> &#x26;&#x26; win.webContents.canGoBack()) {\n    win.webContents.goBack()\n  }\n})\n</code></pre>\n<p>The following app commands are explicitly supported on Linux:</p>\n<ul>\n<li><code>browser-backward</code></li>\n<li><code>browser-forward</code></li>\n</ul>\n<h4 id=\"event-scroll-touch-begin-macos\"><a href=\"#event-scroll-touch-begin-macos\">Event: 'scroll-touch-begin' <em>macOS</em></a></h4>\n<p>Emitted when scroll wheel event phase has begun.</p>\n<h4 id=\"event-scroll-touch-end-macos\"><a href=\"#event-scroll-touch-end-macos\">Event: 'scroll-touch-end' <em>macOS</em></a></h4>\n<p>Emitted when scroll wheel event phase has ended.</p>\n<h4 id=\"event-scroll-touch-edge-macos\"><a href=\"#event-scroll-touch-edge-macos\">Event: 'scroll-touch-edge' <em>macOS</em></a></h4>\n<p>Emitted when scroll wheel event phase filed upon reaching the edge of element.</p>\n<h4 id=\"event-swipe-macos\"><a href=\"#event-swipe-macos\">Event: 'swipe' <em>macOS</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>direction</code> String</li>\n</ul>\n<p>Emitted on 3-finger swipe. Possible directions are <code>up</code>, <code>right</code>, <code>down</code>, <code>left</code>.</p>\n<p>The method underlying this event is built to handle older macOS-style trackpad swiping, where the content on the screen doesn't move with the swipe. Most macOS trackpads are not configured to allow this kind of swiping anymore, so in order for it to emit properly the 'Swipe between pages' preference in <code>System Preferences > Trackpad > More Gestures</code> must be set to 'Swipe with two or three fingers'.</p>\n<h4 id=\"event-rotate-gesture-macos\"><a href=\"#event-rotate-gesture-macos\">Event: 'rotate-gesture' <em>macOS</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>rotation</code> Float</li>\n</ul>\n<p>Emitted on trackpad rotation gesture. Continually emitted until rotation gesture is ended. The <code>rotation</code> value on each emission is the angle in degrees rotated since the last emission. The last emitted event upon a rotation gesture will always be of value <code>0</code>. Counter-clockwise rotation values are positive, while clockwise ones are negative.</p>\n<h4 id=\"event-sheet-begin-macos\"><a href=\"#event-sheet-begin-macos\">Event: 'sheet-begin' <em>macOS</em></a></h4>\n<p>Emitted when the window opens a sheet.</p>\n<h4 id=\"event-sheet-end-macos\"><a href=\"#event-sheet-end-macos\">Event: 'sheet-end' <em>macOS</em></a></h4>\n<p>Emitted when the window has closed a sheet.</p>\n<h4 id=\"event-new-window-for-tab-macos\"><a href=\"#event-new-window-for-tab-macos\">Event: 'new-window-for-tab' <em>macOS</em></a></h4>\n<p>Emitted when the native new tab button is clicked.</p>\n<h4 id=\"event-system-context-menu-windows\"><a href=\"#event-system-context-menu-windows\">Event: 'system-context-menu' <em>Windows</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a> - The screen coordinates the context menu was triggered at</li>\n</ul>\n<p>Emitted when the system context menu is triggered on the window, this is normally only triggered when the user right clicks on the non-client area of your window.  This is the window titlebar or any area you have declared as <code>-webkit-app-region: drag</code> in a frameless window.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent the menu from being displayed.</p>\n<h3 id=\"static-methods\"><a href=\"#static-methods\">Static Methods</a></h3>\n<p>Die <code>BrowserWindow</code> Klasse hat folgende statische Methoden:</p>\n<h4 id=\"browserwindowgetallwindows\"><a href=\"#browserwindowgetallwindows\"><code>BrowserWindow.getAllWindows()</code></a></h4>\n<p>Gibt <code>BrowserWindow[]</code> zurück - Ein Array aller geöffneten Browser Fenster.</p>\n<h4 id=\"browserwindowgetfocusedwindow\"><a href=\"#browserwindowgetfocusedwindow\"><code>BrowserWindow.getFocusedWindow()</code></a></h4>\n<p>Returns <code>BrowserWindow | null</code> - The window that is focused in this application, otherwise returns <code>null</code>.</p>\n<h4 id=\"browserwindowfromwebcontentswebcontents\"><a href=\"#browserwindowfromwebcontentswebcontents\"><code>BrowserWindow.fromWebContents(webContents)</code></a></h4>\n<ul>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Returns <code>BrowserWindow | null</code> - The window that owns the given <code>webContents</code> or <code>null</code> if the contents are not owned by a window.</p>\n<h4 id=\"browserwindowfrombrowserviewbrowserview\"><a href=\"#browserwindowfrombrowserviewbrowserview\"><code>BrowserWindow.fromBrowserView(browserView)</code></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>Returns <code>BrowserWindow | null</code> - The window that owns the given <code>browserView</code>. If the given view is not attached to any window, returns <code>null</code>.</p>\n<h4 id=\"browserwindowfromidid\"><a href=\"#browserwindowfromidid\"><code>BrowserWindow.fromId(id)</code></a></h4>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Returns <code>BrowserWindow | null</code> - The window with the given <code>id</code>.</p>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<p>Objekte, die mit <code>new BrowserWindow</code> erstellt wurden, haben folgende Eigenschaften:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">// In this example `win` is our instance</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<h4 id=\"winwebcontents-readonly\"><a href=\"#winwebcontents-readonly\"><code>win.webContents</code> <em>Readonly</em></a></h4>\n<p>A <code>WebContents</code> object this window owns. All web page related events and operations will be done via it.</p>\n<p>See the <a href=\"/docs/api/web-contents\"><code>webContents</code> documentation</a> for its methods and events.</p>\n<h4 id=\"winid-readonly\"><a href=\"#winid-readonly\"><code>win.id</code> <em>Readonly</em></a></h4>\n<p>A <code>Integer</code> property representing the unique ID of the window. Each ID is unique among all <code>BrowserWindow</code> instances of the entire Electron application.</p>\n<h4 id=\"winautohidemenubar\"><a href=\"#winautohidemenubar\"><code>win.autoHideMenuBar</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window menu bar should hide itself automatically. Once set, the menu bar will only show when users press the single <code>Alt</code> key.</p>\n<p>If the menu bar is already visible, setting this property to <code>true</code> won't hide it immediately.</p>\n<h4 id=\"winsimplefullscreen\"><a href=\"#winsimplefullscreen\"><code>win.simpleFullScreen</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in simple (pre-Lion) fullscreen mode.</p>\n<h4 id=\"winfullscreen\"><a href=\"#winfullscreen\"><code>win.fullScreen</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in fullscreen mode.</p>\n<h4 id=\"winfocusable-windows-macos\"><a href=\"#winfocusable-windows-macos\"><code>win.focusable</code> <em>Windows</em> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is focusable.</p>\n<h4 id=\"winvisibleonallworkspaces\"><a href=\"#winvisibleonallworkspaces\"><code>win.visibleOnAllWorkspaces</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is visible on all workspaces.</p>\n<p><strong>Note:</strong> Always returns false on Windows.</p>\n<h4 id=\"winshadow\"><a href=\"#winshadow\"><code>win.shadow</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window has a shadow.</p>\n<h4 id=\"winmenubarvisible-windows-linux\"><a href=\"#winmenubarvisible-windows-linux\"><code>win.menuBarVisible</code> <em>Windows</em> <em>Linux</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the menu bar should be visible.</p>\n<p><strong>Note:</strong> If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single <code>Alt</code> key.</p>\n<h4 id=\"winkiosk\"><a href=\"#winkiosk\"><code>win.kiosk</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is in kiosk mode.</p>\n<h4 id=\"windocumentedited-macos\"><a href=\"#windocumentedited-macos\"><code>win.documentEdited</code> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that specifies whether the window’s document has been edited.</p>\n<p>The icon in title bar will become gray when set to <code>true</code>.</p>\n<h4 id=\"winrepresentedfilename-macos\"><a href=\"#winrepresentedfilename-macos\"><code>win.representedFilename</code> <em>macOS</em></a></h4>\n<p>A <code>String</code> property that determines the pathname of the file the window represents, and the icon of the file will show in window's title bar.</p>\n<h4 id=\"wintitle\"><a href=\"#wintitle\"><code>win.title</code></a></h4>\n<p>A <code>String</code> property that determines the title of the native window.</p>\n<p><strong>Note:</strong> The title of the web page can be different from the title of the native window.</p>\n<h4 id=\"winminimizable\"><a href=\"#winminimizable\"><code>win.minimizable</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window can be manually minimized by user.</p>\n<p>On Linux the setter is a no-op, although the getter returns <code>true</code>.</p>\n<h4 id=\"winmaximizable\"><a href=\"#winmaximizable\"><code>win.maximizable</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window can be manually maximized by user.</p>\n<p>On Linux the setter is a no-op, although the getter returns <code>true</code>.</p>\n<h4 id=\"winfullscreenable\"><a href=\"#winfullscreenable\"><code>win.fullScreenable</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.</p>\n<h4 id=\"winresizable\"><a href=\"#winresizable\"><code>win.resizable</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window can be manually resized by user.</p>\n<h4 id=\"winclosable\"><a href=\"#winclosable\"><code>win.closable</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window can be manually closed by user.</p>\n<p>On Linux the setter is a no-op, although the getter returns <code>true</code>.</p>\n<h4 id=\"winmovable\"><a href=\"#winmovable\"><code>win.movable</code></a></h4>\n<p>A <code>Boolean</code> property that determines Whether the window can be moved by user.</p>\n<p>On Linux the setter is a no-op, although the getter returns <code>true</code>.</p>\n<h4 id=\"winexcludedfromshownwindowsmenu-macos\"><a href=\"#winexcludedfromshownwindowsmenu-macos\"><code>win.excludedFromShownWindowsMenu</code> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the window is excluded from the application’s Windows menu. Automatisch <code>false</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-keyword\">const</span> template = [\n  {\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'windowmenu'</span>\n  }\n]\n\nwin.excludedFromShownWindowsMenu = <span class=\"hljs-literal\">true</span>\n\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\nMenu.setApplicationMenu(menu)\n</code></pre>\n<h4 id=\"winaccessibletitle\"><a href=\"#winaccessibletitle\"><code>win.accessibleTitle</code></a></h4>\n<p>A <code>String</code> property that defines an alternative title provided only to accessibility tools such as screen readers. This string is not directly visible to users.</p>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<p>Objekte, die mit <code>new BrowserWindow</code> erstellt wurden, haben folgende Instanzmethoden:</p>\n<p><strong>Hinweis:</strong> Manche Methoden sind nur auf spezifischen Betriebssystemen verfügbar und sind dementsprechend gekennzeichnet.</p>\n<h4 id=\"windestroy\"><a href=\"#windestroy\"><code>win.destroy()</code></a></h4>\n<p>Force closing the window, the <code>unload</code> and <code>beforeunload</code> event won't be emitted for the web page, and <code>close</code> event will also not be emitted for this window, but it guarantees the <code>closed</code> event will be emitted.</p>\n<h4 id=\"winclose\"><a href=\"#winclose\"><code>win.close()</code></a></h4>\n<p>Try to close the window. This has the same effect as a user manually clicking the close button of the window. The web page may cancel the close though. See the <a href=\"#event-close\">close event</a>.</p>\n<h4 id=\"winfocus\"><a href=\"#winfocus\"><code>win.focus()</code></a></h4>\n<p>Focuses on the window.</p>\n<h4 id=\"winblur\"><a href=\"#winblur\"><code>win.blur()</code></a></h4>\n<p>Removes focus from the window.</p>\n<h4 id=\"winisfocused\"><a href=\"#winisfocused\"><code>win.isFocused()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is focused.</p>\n<h4 id=\"winisdestroyed\"><a href=\"#winisdestroyed\"><code>win.isDestroyed()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is destroyed.</p>\n<h4 id=\"winshow\"><a href=\"#winshow\"><code>win.show()</code></a></h4>\n<p>Shows and gives focus to the window.</p>\n<h4 id=\"winshowinactive\"><a href=\"#winshowinactive\"><code>win.showInactive()</code></a></h4>\n<p>Shows the window but doesn't focus on it.</p>\n<h4 id=\"winhide\"><a href=\"#winhide\"><code>win.hide()</code></a></h4>\n<p>Hides the window.</p>\n<h4 id=\"winisvisible\"><a href=\"#winisvisible\"><code>win.isVisible()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is visible to the user.</p>\n<h4 id=\"winismodal\"><a href=\"#winismodal\"><code>win.isModal()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether current window is a modal window.</p>\n<h4 id=\"winmaximize\"><a href=\"#winmaximize\"><code>win.maximize()</code></a></h4>\n<p>Maximizes the window. This will also show (but not focus) the window if it isn't being displayed already.</p>\n<h4 id=\"winunmaximize\"><a href=\"#winunmaximize\"><code>win.unmaximize()</code></a></h4>\n<p>Unmaximizes the window.</p>\n<h4 id=\"winismaximized\"><a href=\"#winismaximized\"><code>win.isMaximized()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is maximized.</p>\n<h4 id=\"winminimize\"><a href=\"#winminimize\"><code>win.minimize()</code></a></h4>\n<p>Minimizes the window. On some platforms the minimized window will be shown in the Dock.</p>\n<h4 id=\"winrestore\"><a href=\"#winrestore\"><code>win.restore()</code></a></h4>\n<p>Restores the window from minimized state to its previous state.</p>\n<h4 id=\"winisminimized\"><a href=\"#winisminimized\"><code>win.isMinimized()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is minimized.</p>\n<h4 id=\"winsetfullscreenflag\"><a href=\"#winsetfullscreenflag\"><code>win.setFullScreen(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Sets whether the window should be in fullscreen mode.</p>\n<h4 id=\"winisfullscreen\"><a href=\"#winisfullscreen\"><code>win.isFullScreen()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in fullscreen mode.</p>\n<h4 id=\"winsetsimplefullscreenflag-macos\"><a href=\"#winsetsimplefullscreenflag-macos\"><code>win.setSimpleFullScreen(flag)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Enters or leaves simple fullscreen mode.</p>\n<p>Simple fullscreen mode emulates the native fullscreen behavior found in versions of macOS prior to Lion (10.7).</p>\n<h4 id=\"winissimplefullscreen-macos\"><a href=\"#winissimplefullscreen-macos\"><code>win.isSimpleFullScreen()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in simple (pre-Lion) fullscreen mode.</p>\n<h4 id=\"winisnormal\"><a href=\"#winisnormal\"><code>win.isNormal()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in normal state (not maximized, not minimized, not in fullscreen mode).</p>\n<h4 id=\"winsetaspectratioaspectratio-extrasize\"><a href=\"#winsetaspectratioaspectratio-extrasize\"><code>win.setAspectRatio(aspectRatio[, extraSize])</code></a></h4>\n<ul>\n<li><code>aspectRatio</code> Float - The aspect ratio to maintain for some portion of the content view.</li>\n<li><code>extraSize</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) <em>macOS</em> - The extra size not to be included while maintaining the aspect ratio.</li>\n</ul>\n<p>This will make a window maintain an aspect ratio. The extra size allows a developer to have space, specified in pixels, not included within the aspect ratio calculations. This API already takes into account the difference between a window's size and its content size.</p>\n<p>Consider a normal window with an HD video player and associated controls. Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls on the right edge and 50 pixels of controls below the player. In order to maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within the player itself we would call this function with arguments of 16/9 and\n{ width: 40, height: 50 }. The second argument doesn't care where the extra width and height are within the content view--only that they exist. Sum any extra width and height areas you have within the overall content view.</p>\n<p>The aspect ratio is not respected when window is resized programmatically with APIs like <code>win.setSize</code>.</p>\n<h4 id=\"winsetbackgroundcolorbackgroundcolor\"><a href=\"#winsetbackgroundcolorbackgroundcolor\"><code>win.setBackgroundColor(backgroundColor)</code></a></h4>\n<ul>\n<li><code>backgroundColor</code> String - Window's background color as a hexadecimal value, like <code>#66CD00</code> or <code>#FFF</code> or <code>#80FFFFFF</code> (alpha is supported if <code>transparent</code> is <code>true</code>). Der Standardwert ist <code>#FFF</code> (weiß).</li>\n</ul>\n<p>Sets the background color of the window. See <a href=\"#setting-backgroundcolor\">Setting <code>backgroundColor</code></a>.</p>\n<h4 id=\"winpreviewfilepath-displayname-macos\"><a href=\"#winpreviewfilepath-displayname-macos\"><code>win.previewFile(path[, displayName])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>path</code> String - The absolute path to the file to preview with QuickLook. This is important as Quick Look uses the file name and file extension on the path to determine the content type of the file to open.</li>\n<li><code>displayName</code> String (optional) - The name of the file to display on the Quick Look modal view. This is purely visual and does not affect the content type of the file. Standardwert ist <code>path</code>.</li>\n</ul>\n<p>Uses <a href=\"https://en.wikipedia.org/wiki/Quick_Look\">Quick Look</a> to preview a file at a given path.</p>\n<h4 id=\"winclosefilepreview-macos\"><a href=\"#winclosefilepreview-macos\"><code>win.closeFilePreview()</code> <em>macOS</em></a></h4>\n<p>Closes the currently open <a href=\"https://en.wikipedia.org/wiki/Quick_Look\">Quick Look</a> panel.</p>\n<h4 id=\"winsetboundsbounds-animate\"><a href=\"#winsetboundsbounds-animate\"><code>win.setBounds(bounds[, animate])</code></a></h4>\n<ul>\n<li><code>bounds</code> Partial&#x3C;<a href=\"/docs/api/structures/rectangle\">Rectangle</a>></li>\n<li><code>animate</code> Boolean (optional) <em>macOS</em></li>\n</ul>\n<p>Resizes and moves the window to the supplied bounds. Any properties that are not supplied will default to their current values.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-comment\">// set all bounds properties</span>\nwin.setBounds({ <span class=\"hljs-attr\">x</span>: <span class=\"hljs-number\">440</span>, <span class=\"hljs-attr\">y</span>: <span class=\"hljs-number\">225</span>, <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n<span class=\"hljs-comment\">// set a single bounds property</span>\nwin.setBounds({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">100</span> })\n\n<span class=\"hljs-comment\">// { x: 440, y: 225, width: 100, height: 600 }</span>\n<span class=\"hljs-built_in\">console</span>.log(win.getBounds())\n</code></pre>\n<h4 id=\"wingetbounds\"><a href=\"#wingetbounds\"><code>win.getBounds()</code></a></h4>\n<p>Returns <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - The <code>bounds</code> of the window as <code>Object</code>.</p>\n<h4 id=\"wingetbackgroundcolor\"><a href=\"#wingetbackgroundcolor\"><code>win.getBackgroundColor()</code></a></h4>\n<p>Returns <code>String</code> - Gets the background color of the window. See <a href=\"#setting-backgroundcolor\">Setting <code>backgroundColor</code></a>.</p>\n<h4 id=\"winsetcontentboundsbounds-animate\"><a href=\"#winsetcontentboundsbounds-animate\"><code>win.setContentBounds(bounds[, animate])</code></a></h4>\n<ul>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> Die Grenzen der Ansicht als Rechteck</li>\n<li><code>animate</code> Boolean (optional) <em>macOS</em></li>\n</ul>\n<p>Resizes and moves the window's client area (e.g. the web page) to the supplied bounds.</p>\n<h4 id=\"wingetcontentbounds\"><a href=\"#wingetcontentbounds\"><code>win.getContentBounds()</code></a></h4>\n<p>Returns <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - The <code>bounds</code> of the window's client area as <code>Object</code>.</p>\n<h4 id=\"wingetnormalbounds\"><a href=\"#wingetnormalbounds\"><code>win.getNormalBounds()</code></a></h4>\n<p>Returns <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> - Contains the window bounds of the normal state</p>\n<p><strong>Note:</strong> whatever the current state of the window : maximized, minimized or in fullscreen, this function always returns the position and size of the window in normal state. In normal state, getBounds and getNormalBounds returns the same <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a>.</p>\n<h4 id=\"winsetenabledenable\"><a href=\"#winsetenabledenable\"><code>win.setEnabled(enable)</code></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Disable or enable the window.</p>\n<h4 id=\"winisenabled\"><a href=\"#winisenabled\"><code>win.isEnabled()</code></a></h4>\n<p>Returns <code>Boolean</code> - whether the window is enabled.</p>\n<h4 id=\"winsetsizewidth-height-animate\"><a href=\"#winsetsizewidth-height-animate\"><code>win.setSize(width, height[, animate])</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>animate</code> Boolean (optional) <em>macOS</em></li>\n</ul>\n<p>Resizes the window to <code>width</code> and <code>height</code>. If <code>width</code> or <code>height</code> are below any set minimum size constraints the window will snap to its minimum size.</p>\n<h4 id=\"wingetsize\"><a href=\"#wingetsize\"><code>win.getSize()</code></a></h4>\n<p>Returns <code>Integer[]</code> - Contains the window's width and height.</p>\n<h4 id=\"winsetcontentsizewidth-height-animate\"><a href=\"#winsetcontentsizewidth-height-animate\"><code>win.setContentSize(width, height[, animate])</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>animate</code> Boolean (optional) <em>macOS</em></li>\n</ul>\n<p>Resizes the window's client area (e.g. the web page) to <code>width</code> and <code>height</code>.</p>\n<h4 id=\"wingetcontentsize\"><a href=\"#wingetcontentsize\"><code>win.getContentSize()</code></a></h4>\n<p>Returns <code>Integer[]</code> - Contains the window's client area's width and height.</p>\n<h4 id=\"winsetminimumsizewidth-height\"><a href=\"#winsetminimumsizewidth-height\"><code>win.setMinimumSize(width, height)</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n</ul>\n<p>Sets the minimum size of window to <code>width</code> and <code>height</code>.</p>\n<h4 id=\"wingetminimumsize\"><a href=\"#wingetminimumsize\"><code>win.getMinimumSize()</code></a></h4>\n<p>Returns <code>Integer[]</code> - Contains the window's minimum width and height.</p>\n<h4 id=\"winsetmaximumsizewidth-height\"><a href=\"#winsetmaximumsizewidth-height\"><code>win.setMaximumSize(width, height)</code></a></h4>\n<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n</ul>\n<p>Sets the maximum size of window to <code>width</code> and <code>height</code>.</p>\n<h4 id=\"wingetmaximumsize\"><a href=\"#wingetmaximumsize\"><code>win.getMaximumSize()</code></a></h4>\n<p>Returns <code>Integer[]</code> - Contains the window's maximum width and height.</p>\n<h4 id=\"winsetresizableresizable\"><a href=\"#winsetresizableresizable\"><code>win.setResizable(resizable)</code></a></h4>\n<ul>\n<li><code>resizable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually resized by the user.</p>\n<h4 id=\"winisresizable\"><a href=\"#winisresizable\"><code>win.isResizable()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be manually resized by the user.</p>\n<h4 id=\"winsetmovablemovable-macos-windows\"><a href=\"#winsetmovablemovable-macos-windows\"><code>win.setMovable(movable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>movable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be moved by user. On Linux does nothing.</p>\n<h4 id=\"winismovable-macos-windows\"><a href=\"#winismovable-macos-windows\"><code>win.isMovable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be moved by user.</p>\n<p>Unter Linux wird immer <code>true</code> zurückgegeben.</p>\n<h4 id=\"winsetminimizableminimizable-macos-windows\"><a href=\"#winsetminimizableminimizable-macos-windows\"><code>win.setMinimizable(minimizable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>minimizable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually minimized by user. On Linux does nothing.</p>\n<h4 id=\"winisminimizable-macos-windows\"><a href=\"#winisminimizable-macos-windows\"><code>win.isMinimizable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be manually minimized by the user.</p>\n<p>Unter Linux wird immer <code>true</code> zurückgegeben.</p>\n<h4 id=\"winsetmaximizablemaximizable-macos-windows\"><a href=\"#winsetmaximizablemaximizable-macos-windows\"><code>win.setMaximizable(maximizable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>maximizable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually maximized by user. On Linux does nothing.</p>\n<h4 id=\"winismaximizable-macos-windows\"><a href=\"#winismaximizable-macos-windows\"><code>win.isMaximizable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window can be manually maximized by user.</p>\n<p>Unter Linux wird immer <code>true</code> zurückgegeben.</p>\n<h4 id=\"winsetfullscreenablefullscreenable\"><a href=\"#winsetfullscreenablefullscreenable\"><code>win.setFullScreenable(fullscreenable)</code></a></h4>\n<ul>\n<li><code>fullscreenable</code> Boolean</li>\n</ul>\n<p>Sets whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.</p>\n<h4 id=\"winisfullscreenable\"><a href=\"#winisfullscreenable\"><code>win.isFullScreenable()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.</p>\n<h4 id=\"winsetclosableclosable-macos-windows\"><a href=\"#winsetclosableclosable-macos-windows\"><code>win.setClosable(closable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>closable</code> Boolean</li>\n</ul>\n<p>Sets whether the window can be manually closed by user. On Linux does nothing.</p>\n<h4 id=\"winisclosable-macos-windows\"><a href=\"#winisclosable-macos-windows\"><code>win.isClosable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Gibt <code>Boolean</code> zurück - Gibt an ob das Fenster durch den Nutzer manuell geschlossen werden kann.</p>\n<p>Unter Linux wird immer <code>true</code> zurückgegeben.</p>\n<h4 id=\"winsetalwaysontopflag-level-relativelevel\"><a href=\"#winsetalwaysontopflag-level-relativelevel\"><code>win.setAlwaysOnTop(flag[, level][, relativeLevel])</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n<li><code>level</code> String (optional) <em>macOS</em> <em>Windows</em> - Values include <code>normal</code>, <code>floating</code>, <code>torn-off-menu</code>, <code>modal-panel</code>, <code>main-menu</code>, <code>status</code>, <code>pop-up-menu</code>, <code>screen-saver</code>, and <del><code>dock</code></del> (Deprecated). The default is <code>floating</code> when <code>flag</code> is true. The <code>level</code> is reset to <code>normal</code> when the flag is false. Note that from <code>floating</code> to <code>status</code> included, the window is placed below the Dock on macOS and below the taskbar on Windows. From <code>pop-up-menu</code> to a higher it is shown above the Dock on macOS and above the taskbar on Windows. See the <a href=\"https://developer.apple.com/documentation/appkit/nswindow/level\">macOS docs</a> for more details.</li>\n<li><code>relativeLevel</code> Integer (optional) <em>macOS</em> - The number of layers higher to set this window relative to the given <code>level</code>. The default is <code>0</code>. Note that Apple discourages setting levels higher than 1 above <code>screen-saver</code>.</li>\n</ul>\n<p>Sets whether the window should show always on top of other windows. After setting this, the window is still a normal window, not a toolbox window which can not be focused on.</p>\n<h4 id=\"winisalwaysontop\"><a href=\"#winisalwaysontop\"><code>win.isAlwaysOnTop()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is always on top of other windows.</p>\n<h4 id=\"winmoveabovemediasourceid\"><a href=\"#winmoveabovemediasourceid\"><code>win.moveAbove(mediaSourceId)</code></a></h4>\n<ul>\n<li><code>mediaSourceId</code> String - Window id in the format of DesktopCapturerSource's id. For example \"window:1869:0\".</li>\n</ul>\n<p>Moves window above the source window in the sense of z-order. If the <code>mediaSourceId</code> is not of type window or if the window does not exist then this method throws an error.</p>\n<h4 id=\"winmovetop\"><a href=\"#winmovetop\"><code>win.moveTop()</code></a></h4>\n<p>Moves window to top(z-order) regardless of focus</p>\n<h4 id=\"wincenter\"><a href=\"#wincenter\"><code>win.center()</code></a></h4>\n<p>Moves window to the center of the screen.</p>\n<h4 id=\"winsetpositionx-y-animate\"><a href=\"#winsetpositionx-y-animate\"><code>win.setPosition(x, y[, animate])</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n<li><code>animate</code> Boolean (optional) <em>macOS</em></li>\n</ul>\n<p>Moves window to <code>x</code> and <code>y</code>.</p>\n<h4 id=\"wingetposition\"><a href=\"#wingetposition\"><code>win.getPosition()</code></a></h4>\n<p>Returns <code>Integer[]</code> - Contains the window's current position.</p>\n<h4 id=\"winsettitletitle\"><a href=\"#winsettitletitle\"><code>win.setTitle(title)</code></a></h4>\n<ul>\n<li><code>title</code> String</li>\n</ul>\n<p>Changes the title of native window to <code>title</code>.</p>\n<h4 id=\"wingettitle\"><a href=\"#wingettitle\"><code>win.getTitle()</code></a></h4>\n<p>Returns <code>String</code> - The title of the native window.</p>\n<p><strong>Note:</strong> The title of the web page can be different from the title of the native window.</p>\n<h4 id=\"winsetsheetoffsetoffsety-offsetx-macos\"><a href=\"#winsetsheetoffsetoffsety-offsetx-macos\"><code>win.setSheetOffset(offsetY[, offsetX])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>offsetY</code> Float</li>\n<li><code>offsetX</code> Float (optional)</li>\n</ul>\n<p>Changes the attachment point for sheets on macOS. By default, sheets are attached just below the window frame, but you may want to display them beneath a HTML-rendered toolbar. Ein Beispiel:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-keyword\">const</span> toolbarRect = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'toolbar'</span>).getBoundingClientRect()\nwin.setSheetOffset(toolbarRect.height)\n</code></pre>\n<h4 id=\"winflashframeflag\"><a href=\"#winflashframeflag\"><code>win.flashFrame(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Starts or stops flashing the window to attract user's attention.</p>\n<h4 id=\"winsetskiptaskbarskip\"><a href=\"#winsetskiptaskbarskip\"><code>win.setSkipTaskbar(skip)</code></a></h4>\n<ul>\n<li><code>skip</code> Boolean</li>\n</ul>\n<p>Makes the window not show in the taskbar.</p>\n<h4 id=\"winsetkioskflag\"><a href=\"#winsetkioskflag\"><code>win.setKiosk(flag)</code></a></h4>\n<ul>\n<li><code>flag</code> Boolean</li>\n</ul>\n<p>Enters or leaves kiosk mode.</p>\n<h4 id=\"winiskiosk\"><a href=\"#winiskiosk\"><code>win.isKiosk()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in kiosk mode.</p>\n<h4 id=\"winistabletmode-windows\"><a href=\"#winistabletmode-windows\"><code>win.isTabletMode()</code> <em>Windows</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is in Windows 10 tablet mode.</p>\n<p>Since Windows 10 users can <a href=\"https://support.microsoft.com/en-us/help/17210/windows-10-use-your-pc-like-a-tablet\">use their PC as tablet</a>, under this mode apps can choose to optimize their UI for tablets, such as enlarging the titlebar and hiding titlebar buttons.</p>\n<p>This API returns whether the window is in tablet mode, and the <code>resize</code> event can be be used to listen to changes to tablet mode.</p>\n<h4 id=\"wingetmediasourceid\"><a href=\"#wingetmediasourceid\"><code>win.getMediaSourceId()</code></a></h4>\n<p>Returns <code>String</code> - Window id in the format of DesktopCapturerSource's id. For example \"window:1324:0\".</p>\n<p>More precisely the format is <code>window:id:other_id</code> where <code>id</code> is <code>HWND</code> on Windows, <code>CGWindowID</code> (<code>uint64_t</code>) on macOS and <code>Window</code> (<code>unsigned long</code>) on Linux. <code>other_id</code> is used to identify web contents (tabs) so within the same top level window.</p>\n<h4 id=\"wingetnativewindowhandle\"><a href=\"#wingetnativewindowhandle\"><code>win.getNativeWindowHandle()</code></a></h4>\n<p>Returns <code>Buffer</code> - The platform-specific handle of the window.</p>\n<p>The native type of the handle is <code>HWND</code> on Windows, <code>NSView*</code> on macOS, and <code>Window</code> (<code>unsigned long</code>) on Linux.</p>\n<h4 id=\"winhookwindowmessagemessage-callback-windows\"><a href=\"#winhookwindowmessagemessage-callback-windows\"><code>win.hookWindowMessage(message, callback)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n<li><code>callback</code> Function<ul>\n<li><code>wParam</code> any - The <code>wParam</code> provided to the WndProc</li>\n<li><code>lParam</code> any - The <code>lParam</code> provided to the WndProc</li>\n</ul></li>\n</ul>\n<p>Hooks a windows message. The <code>callback</code> is called when the message is received in the WndProc.</p>\n<h4 id=\"winiswindowmessagehookedmessage-windows\"><a href=\"#winiswindowmessagehookedmessage-windows\"><code>win.isWindowMessageHooked(message)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n</ul>\n<p>Returns <code>Boolean</code> - <code>true</code> or <code>false</code> depending on whether the message is hooked.</p>\n<h4 id=\"winunhookwindowmessagemessage-windows\"><a href=\"#winunhookwindowmessagemessage-windows\"><code>win.unhookWindowMessage(message)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>message</code> Integer</li>\n</ul>\n<p>Unhook the window message.</p>\n<h4 id=\"winunhookallwindowmessages-windows\"><a href=\"#winunhookallwindowmessages-windows\"><code>win.unhookAllWindowMessages()</code> <em>Windows</em></a></h4>\n<p>Unhooks all of the window messages.</p>\n<h4 id=\"winsetrepresentedfilenamefilename-macos\"><a href=\"#winsetrepresentedfilenamefilename-macos\"><code>win.setRepresentedFilename(filename)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>filename</code> String</li>\n</ul>\n<p>Sets the pathname of the file the window represents, and the icon of the file will show in window's title bar.</p>\n<h4 id=\"wingetrepresentedfilename-macos\"><a href=\"#wingetrepresentedfilename-macos\"><code>win.getRepresentedFilename()</code> <em>macOS</em></a></h4>\n<p>Returns <code>String</code> - The pathname of the file the window represents.</p>\n<h4 id=\"winsetdocumenteditededited-macos\"><a href=\"#winsetdocumenteditededited-macos\"><code>win.setDocumentEdited(edited)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>edited</code> Boolean</li>\n</ul>\n<p>Specifies whether the window’s document has been edited, and the icon in title bar will become gray when set to <code>true</code>.</p>\n<h4 id=\"winisdocumentedited-macos\"><a href=\"#winisdocumentedited-macos\"><code>win.isDocumentEdited()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window's document has been edited.</p>\n<h4 id=\"winfocusonwebview\"><a href=\"#winfocusonwebview\"><code>win.focusOnWebView()</code></a></h4>\n<h4 id=\"winblurwebview\"><a href=\"#winblurwebview\"><code>win.blurWebView()</code></a></h4>\n<h4 id=\"wincapturepagerect\"><a href=\"#wincapturepagerect\"><code>win.capturePage([rect])</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (optional) - The bounds to capture</li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - Resolves with a <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Captures a snapshot of the page within <code>rect</code>. Omitting <code>rect</code> will capture the whole visible page. If the page is not visible, <code>rect</code> may be empty.</p>\n<h4 id=\"winloadurlurl-options\"><a href=\"#winloadurlurl-options\"><code>win.loadURL(url[, options])</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (optional) - An HTTP Referrer URL.</li>\n<li><code>userAgent</code> String (optional) - A user agent originating the request.</li>\n<li><code>extraHeaders</code> String (optional) - Extra headers separated by \"\\n\"</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (optional) - Base URL (with trailing path separator) for files to be loaded by the data URL. This is needed only if the specified <code>url</code> is a data URL and needs to load other files.</li>\n</ul></li>\n</ul>\n<p>Gibt <code>Promise</code> zurück - das Versprechen wird aufgelöst, wenn die Seite das Laden beendet hat (siehe <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), und lehnt ab, wenn die Seite nicht geladen wird (siehe <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Same as <a href=\"/docs/api/web-contents#contentsloadurlurl-options\"><code>webContents.loadURL(url[, options])</code></a>.</p>\n<p>The <code>url</code> can be a remote address (e.g. <code>http://</code>) or a path to a local HTML file using the <code>file://</code> protocol.</p>\n<p>To ensure that file URLs are properly formatted, it is recommended to use Node's <a href=\"https://nodejs.org/api/url.html#url_url_format_urlobject\"><code>url.format</code></a> method:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>).format({\n  <span class=\"hljs-attr\">protocol</span>: <span class=\"hljs-string\">'file'</span>,\n  <span class=\"hljs-attr\">slashes</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">pathname</span>: <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>).join(__dirname, <span class=\"hljs-string\">'index.html'</span>)\n})\n\nwin.loadURL(url)\n</code></pre>\n<p>You can load a URL using a <code>POST</code> request with URL-encoded data by doing the following:</p>\n<pre><code class=\"hljs language-javascript\">win.loadURL(<span class=\"hljs-string\">'http://localhost:8000/post'</span>, {\n  <span class=\"hljs-attr\">postData</span>: [{\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'rawData'</span>,\n    <span class=\"hljs-attr\">bytes</span>: Buffer.from(<span class=\"hljs-string\">'hello=world'</span>)\n  }],\n  <span class=\"hljs-attr\">extraHeaders</span>: <span class=\"hljs-string\">'Content-Type: application/x-www-form-urlencoded'</span>\n})\n</code></pre>\n<h4 id=\"winloadfilefilepath-options\"><a href=\"#winloadfilefilepath-options\"><code>win.loadFile(filePath[, options])</code></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>query</code> Record&#x3C;String, String> (optional) - Passed to <code>url.format()</code>.</li>\n<li><code>search</code> String (optional) - Passed to <code>url.format()</code>.</li>\n<li><code>hash</code> String (optional) - Passed to <code>url.format()</code>.</li>\n</ul></li>\n</ul>\n<p>Gibt <code>Promise</code> zurück - das Versprechen wird aufgelöst, wenn die Seite das Laden beendet hat (siehe <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), und lehnt ab, wenn die Seite nicht geladen wird (siehe <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Same as <code>webContents.loadFile</code>, <code>filePath</code> should be a path to an HTML file relative to the root of your application.  See the <code>webContents</code> docs for more information.</p>\n<h4 id=\"winreload\"><a href=\"#winreload\"><code>win.reload()</code></a></h4>\n<p>Same as <code>webContents.reload</code>.</p>\n<h4 id=\"winsetmenumenu-linux-windows\"><a href=\"#winsetmenumenu-linux-windows\"><code>win.setMenu(menu)</code> <em>Linux</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Sets the <code>menu</code> as the window's menu bar.</p>\n<h4 id=\"winremovemenu-linux-windows\"><a href=\"#winremovemenu-linux-windows\"><code>win.removeMenu()</code> <em>Linux</em> <em>Windows</em></a></h4>\n<p>Remove the window's menu bar.</p>\n<h4 id=\"winsetprogressbarprogress-options\"><a href=\"#winsetprogressbarprogress-options\"><code>win.setProgressBar(progress[, options])</code></a></h4>\n<ul>\n<li><code>progress</code> Double</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>mode</code> String <em>Windows</em> - Mode for the progress bar. Can be <code>none</code>, <code>normal</code>, <code>indeterminate</code>, <code>error</code> or <code>paused</code>.</li>\n</ul></li>\n</ul>\n<p>Sets progress value in progress bar. Valid range is [0, 1.0].</p>\n<p>Remove progress bar when progress &#x3C; 0; Change to indeterminate mode when progress > 1.</p>\n<p>On Linux platform, only supports Unity desktop environment, you need to specify the <code>*.desktop</code> file name to <code>desktopName</code> field in <code>package.json</code>. By default, it will assume <code>{app.name}.desktop</code>.</p>\n<p>On Windows, a mode can be passed. Accepted values are <code>none</code>, <code>normal</code>, <code>indeterminate</code>, <code>error</code>, and <code>paused</code>. If you call <code>setProgressBar</code> without a mode set (but with a value within the valid range), <code>normal</code> will be assumed.</p>\n<h4 id=\"winsetoverlayiconoverlay-description-windows\"><a href=\"#winsetoverlayiconoverlay-description-windows\"><code>win.setOverlayIcon(overlay, description)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>overlay</code> <a href=\"/docs/api/native-image\">NativeImage</a> | null - the icon to display on the bottom right corner of the taskbar icon. If this parameter is <code>null</code>, the overlay is cleared</li>\n<li><code>description</code> String - a description that will be provided to Accessibility screen readers</li>\n</ul>\n<p>Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to convey some sort of application status or to passively notify the user.</p>\n<h4 id=\"winsethasshadowhasshadow\"><a href=\"#winsethasshadowhasshadow\"><code>win.setHasShadow(hasShadow)</code></a></h4>\n<ul>\n<li><code>hasShadow</code> Boolean</li>\n</ul>\n<p>Sets whether the window should have a shadow.</p>\n<h4 id=\"winhasshadow\"><a href=\"#winhasshadow\"><code>win.hasShadow()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window has a shadow.</p>\n<h4 id=\"winsetopacityopacity-windows-macos\"><a href=\"#winsetopacityopacity-windows-macos\"><code>win.setOpacity(opacity)</code> <em>Windows</em> <em>macOS</em></a></h4>\n<ul>\n<li><code>opacity</code> Number - between 0.0 (fully transparent) and 1.0 (fully opaque)</li>\n</ul>\n<p>Sets the opacity of the window. On Linux, does nothing. Out of bound number values are clamped to the [0, 1] range.</p>\n<h4 id=\"wingetopacity\"><a href=\"#wingetopacity\"><code>win.getOpacity()</code></a></h4>\n<p>Returns <code>Number</code> - between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns 1.</p>\n<h4 id=\"winsetshaperects-windows-linux-experimental\"><a href=\"#winsetshaperects-windows-linux-experimental\"><code>win.setShape(rects)</code> <em>Windows</em> <em>Linux</em> <em>Experimental</em></a></h4>\n<ul>\n<li><code>rects</code> <a href=\"/docs/api/structures/rectangle\">Rectangle[]</a> - Sets a shape on the window. Passing an empty list reverts the window to being rectangular.</li>\n</ul>\n<p>Setting a window shape determines the area within the window where the system permits drawing and user interaction. Outside of the given region, no pixels will be drawn and no mouse events will be registered. Mouse events outside of the region will not be received by that window, but will fall through to whatever is behind the window.</p>\n<h4 id=\"winsetthumbarbuttonsbuttons-windows\"><a href=\"#winsetthumbarbuttonsbuttons-windows\"><code>win.setThumbarButtons(buttons)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>buttons</code> <a href=\"/docs/api/structures/thumbar-button\">ThumbarButton[]</a></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the buttons were added successfully</p>\n<p>Add a thumbnail toolbar with a specified set of buttons to the thumbnail image of a window in a taskbar button layout. Returns a <code>Boolean</code> object indicates whether the thumbnail has been added successfully.</p>\n<p>The number of buttons in thumbnail toolbar should be no greater than 7 due to the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be removed due to the platform's limitation. But you can call the API with an empty array to clean the buttons.</p>\n<p><code>buttons</code> ist ein Array mit <code>Button</code> Objekten:</p>\n<ul>\n<li><code>Button</code> Object<ul>\n<li><code>Icon</code> <a href=\"/docs/api/native-image\"> NativeImage </a>-das Symbol zeigt in Thumbnail Leiste.</li>\n<li><code>Klicken Sie auf</code> Funktion</li>\n<li><code>Tooltip</code> String (optional)-der Text der Tooltip der Schaltfläche.</li>\n<li><code>flags</code> String<a href=\"/docs/api/optional\"></a> - Kontrollieren Sie bestimmte Zustände und Verhaltensweisen des Buttons. Standardmäßig ist es <code>['enabled']</code>.</li>\n</ul></li>\n</ul>\n<p>Die <code>Flags</code> ist ein Array, das folgende <code>Zeichenfolge</code> s enthalten kann:</p>\n<ul>\n<li><code>Enabled</code>-die Schaltfläche ist aktiv und für den Benutzer verfügbar.</li>\n<li><code>disabled</code> - Der Button ist deaktiviert. Er ist vorhanden, zeigt aber visuell, dass er nicht auf Nutzeraktionen reagiert.</li>\n<li><code>dismissonclick</code>-wenn auf die Schaltfläche geklickt wird, wird das Thumbnail-Fenster geschlossen sofort.</li>\n<li><code>nobackground</code>-zeichnen Sie keinen Schaltflächenrahmen, sondern verwenden Sie nur das Bild.</li>\n<li><code>Hidden</code>-die Schaltfläche wird dem Benutzer nicht angezeigt.</li>\n<li><code>noninteractive</code> - Der Button ist aktiviert aber nicht interaktiv. Es wird kein gedrückter Button angezeigt. Dieser Wert ist für Instanzen bestimmt, in denen der Button in einer Benachrichtigung verwendet wird.</li>\n</ul>\n<h4 id=\"winsetthumbnailclipregion-windows\"><a href=\"#winsetthumbnailclipregion-windows\"><code>win.setThumbnailClip(region)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>region</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Region of the window</li>\n</ul>\n<p>Sets the region of the window to show as the thumbnail image displayed when hovering over the window in the taskbar. You can reset the thumbnail to be the entire window by specifying an empty region: <code>{ x: 0, y: 0, width: 0, height: 0 }</code>.</p>\n<h4 id=\"winsetthumbnailtooltiptooltip-windows\"><a href=\"#winsetthumbnailtooltiptooltip-windows\"><code>win.setThumbnailToolTip(toolTip)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>toolTip</code> String</li>\n</ul>\n<p>Sets the toolTip that is displayed when hovering over the window thumbnail in the taskbar.</p>\n<h4 id=\"winsetappdetailsoptions-windows\"><a href=\"#winsetappdetailsoptions-windows\"><code>win.setAppDetails(options)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>appId</code> String (optional) - Window's <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391569(v=vs.85).aspx\">App User Model ID</a>. It has to be set, otherwise the other options will have no effect.</li>\n<li><code>appIconPath</code> String (optional) - Window's <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391573(v=vs.85).aspx\">Relaunch Icon</a>.</li>\n<li><code>appIconIndex</code> Integer (optional) - Index of the icon in <code>appIconPath</code>. Ignored when <code>appIconPath</code> is not set. Standard ist <code>0</code>.</li>\n<li><code>relaunchCommand</code> String (optional) - Window's <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391571(v=vs.85).aspx\">Relaunch Command</a>.</li>\n<li><code>relaunchDisplayName</code> String (optional) - Window's <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd391572(v=vs.85).aspx\">Relaunch Display Name</a>.</li>\n</ul></li>\n</ul>\n<p>Sets the properties for the window's taskbar button.</p>\n<p><strong>Note:</strong> <code>relaunchCommand</code> and <code>relaunchDisplayName</code> must always be set together. If one of those properties is not set, then neither will be used.</p>\n<h4 id=\"winshowdefinitionforselection-macos\"><a href=\"#winshowdefinitionforselection-macos\"><code>win.showDefinitionForSelection()</code> <em>macOS</em></a></h4>\n<p>Same as <code>webContents.showDefinitionForSelection()</code>.</p>\n<h4 id=\"winseticonicon-windows-linux\"><a href=\"#winseticonicon-windows-linux\"><code>win.setIcon(icon)</code> <em>Windows</em> <em>Linux</em></a></h4>\n<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String</li>\n</ul>\n<p>Changes window icon.</p>\n<h4 id=\"winsetwindowbuttonvisibilityvisible-macos\"><a href=\"#winsetwindowbuttonvisibilityvisible-macos\"><code>win.setWindowButtonVisibility(visible)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n</ul>\n<p>Sets whether the window traffic light buttons should be visible.</p>\n<h4 id=\"winsetautohidemenubarhide\"><a href=\"#winsetautohidemenubarhide\"><code>win.setAutoHideMenuBar(hide)</code></a></h4>\n<ul>\n<li><code>hide</code> Boolean</li>\n</ul>\n<p>Sets whether the window menu bar should hide itself automatically. Once set the menu bar will only show when users press the single <code>Alt</code> key.</p>\n<p>If the menu bar is already visible, calling <code>setAutoHideMenuBar(true)</code> won't hide it immediately.</p>\n<h4 id=\"winismenubarautohide\"><a href=\"#winismenubarautohide\"><code>win.isMenuBarAutoHide()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether menu bar automatically hides itself.</p>\n<h4 id=\"winsetmenubarvisibilityvisible-windows-linux\"><a href=\"#winsetmenubarvisibilityvisible-windows-linux\"><code>win.setMenuBarVisibility(visible)</code> <em>Windows</em> <em>Linux</em></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n</ul>\n<p>Sets whether the menu bar should be visible. If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single <code>Alt</code> key.</p>\n<h4 id=\"winismenubarvisible\"><a href=\"#winismenubarvisible\"><code>win.isMenuBarVisible()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the menu bar is visible.</p>\n<h4 id=\"winsetvisibleonallworkspacesvisible-options\"><a href=\"#winsetvisibleonallworkspacesvisible-options\"><code>win.setVisibleOnAllWorkspaces(visible[, options])</code></a></h4>\n<ul>\n<li><code>visible</code> Boolean</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>visibleOnFullScreen</code> Boolean (optional) <em>macOS</em> - Sets whether the window should be visible above fullscreen windows.</li>\n<li><code>skipTransformProcessType</code> Boolean (optional) <em>macOS</em> - Calling setVisibleOnAllWorkspaces will by default transform the process type between UIElementApplication and ForegroundApplication to ensure the correct behavior. However, this will hide the window and dock for a short time every time it is called. If your window is already of type UIElementApplication, you can bypass this transformation by passing true to skipTransformProcessType.</li>\n</ul></li>\n</ul>\n<p>Sets whether the window should be visible on all workspaces.</p>\n<p><strong>Note:</strong> This API does nothing on Windows.</p>\n<h4 id=\"winisvisibleonallworkspaces\"><a href=\"#winisvisibleonallworkspaces\"><code>win.isVisibleOnAllWorkspaces()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the window is visible on all workspaces.</p>\n<p><strong>Note:</strong> This API always returns false on Windows.</p>\n<h4 id=\"winsetignoremouseeventsignore-options\"><a href=\"#winsetignoremouseeventsignore-options\"><code>win.setIgnoreMouseEvents(ignore[, options])</code></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>forward</code> Boolean (optional) <em>macOS</em> <em>Windows</em> - If true, forwards mouse move messages to Chromium, enabling mouse related events such as <code>mouseleave</code>. Only used when <code>ignore</code> is true. If <code>ignore</code> is false, forwarding is always disabled regardless of this value.</li>\n</ul></li>\n</ul>\n<p>Makes the window ignore all mouse events.</p>\n<p>All mouse events happened in this window will be passed to the window below this window, but if this window has focus, it will still receive keyboard events.</p>\n<h4 id=\"winsetcontentprotectionenable-macos-windows\"><a href=\"#winsetcontentprotectionenable-macos-windows\"><code>win.setContentProtection(enable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Prevents the window contents from being captured by other apps.</p>\n<p>On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows it calls SetWindowDisplayAffinity with <code>WDA_EXCLUDEFROMCAPTURE</code>. For Windows 10 version 2004 and up the window will be removed from capture entirely, older Windows versions behave as if <code>WDA_MONITOR</code> is applied capturing a black window.</p>\n<h4 id=\"winsetfocusablefocusable-macos-windows\"><a href=\"#winsetfocusablefocusable-macos-windows\"><code>win.setFocusable(focusable)</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>focusable</code> Boolean</li>\n</ul>\n<p>Changes whether the window can be focused.</p>\n<p>On macOS it does not remove the focus from the window.</p>\n<h4 id=\"winisfocusable-macos-windows\"><a href=\"#winisfocusable-macos-windows\"><code>win.isFocusable()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Returns whether the window can be focused.</p>\n<h4 id=\"winsetparentwindowparent\"><a href=\"#winsetparentwindowparent\"><code>win.setParentWindow(parent)</code></a></h4>\n<ul>\n<li><code>parent</code> BrowserWindow | null</li>\n</ul>\n<p>Sets <code>parent</code> as current window's parent window, passing <code>null</code> will turn current window into a top-level window.</p>\n<h4 id=\"wingetparentwindow\"><a href=\"#wingetparentwindow\"><code>win.getParentWindow()</code></a></h4>\n<p>Returns <code>BrowserWindow</code> - The parent window.</p>\n<h4 id=\"wingetchildwindows\"><a href=\"#wingetchildwindows\"><code>win.getChildWindows()</code></a></h4>\n<p>Returns <code>BrowserWindow[]</code> - All child windows.</p>\n<h4 id=\"winsetautohidecursorautohide-macos\"><a href=\"#winsetautohidecursorautohide-macos\"><code>win.setAutoHideCursor(autoHide)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>autoHide</code> Boolean</li>\n</ul>\n<p>Controls whether to hide cursor when typing.</p>\n<h4 id=\"winselectprevioustab-macos\"><a href=\"#winselectprevioustab-macos\"><code>win.selectPreviousTab()</code> <em>macOS</em></a></h4>\n<p>Selects the previous tab when native tabs are enabled and there are other tabs in the window.</p>\n<h4 id=\"winselectnexttab-macos\"><a href=\"#winselectnexttab-macos\"><code>win.selectNextTab()</code> <em>macOS</em></a></h4>\n<p>Selects the next tab when native tabs are enabled and there are other tabs in the window.</p>\n<h4 id=\"winmergeallwindows-macos\"><a href=\"#winmergeallwindows-macos\"><code>win.mergeAllWindows()</code> <em>macOS</em></a></h4>\n<p>Merges all windows into one window with multiple tabs when native tabs are enabled and there is more than one open window.</p>\n<h4 id=\"winmovetabtonewwindow-macos\"><a href=\"#winmovetabtonewwindow-macos\"><code>win.moveTabToNewWindow()</code> <em>macOS</em></a></h4>\n<p>Moves the current tab into a new window if native tabs are enabled and there is more than one tab in the current window.</p>\n<h4 id=\"wintoggletabbar-macos\"><a href=\"#wintoggletabbar-macos\"><code>win.toggleTabBar()</code> <em>macOS</em></a></h4>\n<p>Toggles the visibility of the tab bar if native tabs are enabled and there is only one tab in the current window.</p>\n<h4 id=\"winaddtabbedwindowbrowserwindow-macos\"><a href=\"#winaddtabbedwindowbrowserwindow-macos\"><code>win.addTabbedWindow(browserWindow)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>browserWindow</code> BrowserWindow</li>\n</ul>\n<p>Adds a window as a tab on this window, after the tab for the window instance.</p>\n<h4 id=\"winsetvibrancytype-macos\"><a href=\"#winsetvibrancytype-macos\"><code>win.setVibrancy(type)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>type</code> String | null - Can be <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>titlebar</code>, <code>selection</code>, <code>menu</code>, <code>popover</code>, <code>sidebar</code>, <code>medium-light</code>, <code>ultra-dark</code>, <code>header</code>, <code>sheet</code>, <code>window</code>, <code>hud</code>, <code>fullscreen-ui</code>, <code>tooltip</code>, <code>content</code>, <code>under-window</code>, or <code>under-page</code>. See the <a href=\"https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc\">macOS documentation</a> for more details.</li>\n</ul>\n<p>Adds a vibrancy effect to the browser window. Passing <code>null</code> or an empty string will remove the vibrancy effect on the window.</p>\n<p>Note that <code>appearance-based</code>, <code>light</code>, <code>dark</code>, <code>medium-light</code>, and <code>ultra-dark</code> have been deprecated and will be removed in an upcoming version of macOS.</p>\n<h4 id=\"winsettrafficlightpositionposition-macos\"><a href=\"#winsettrafficlightpositionposition-macos\"><code>win.setTrafficLightPosition(position)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Set a custom position for the traffic light buttons in frameless window.</p>\n<h4 id=\"wingettrafficlightposition-macos\"><a href=\"#wingettrafficlightposition-macos\"><code>win.getTrafficLightPosition()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Point</code> - The custom position for the traffic light buttons in frameless window.</p>\n<h4 id=\"winsettouchbartouchbar-macos\"><a href=\"#winsettouchbartouchbar-macos\"><code>win.setTouchBar(touchBar)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>touchBar</code> TouchBar | null</li>\n</ul>\n<p>Sets the touchBar layout for the current window. Specifying <code>null</code> or <code>undefined</code> clears the touch bar. This method only has an effect if the machine has a touch bar and is running on macOS 10.12.1+.</p>\n<p><strong>Note:</strong> The TouchBar API is currently experimental and may change or be removed in future Electron releases.</p>\n<h4 id=\"winsetbrowserviewbrowserview-experimental\"><a href=\"#winsetbrowserviewbrowserview-experimental\"><code>win.setBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a> | null - Attach <code>browserView</code> to <code>win</code>. If there are other <code>BrowserView</code>s attached, they will be removed from this window.</li>\n</ul>\n<h4 id=\"wingetbrowserview-experimental\"><a href=\"#wingetbrowserview-experimental\"><code>win.getBrowserView()</code> <em>Experimental</em></a></h4>\n<p>Returns <code>BrowserView | null</code> - The <code>BrowserView</code> attached to <code>win</code>. Returns <code>null</code> if one is not attached. Throws an error if multiple <code>BrowserView</code>s are attached.</p>\n<h4 id=\"winaddbrowserviewbrowserview-experimental\"><a href=\"#winaddbrowserviewbrowserview-experimental\"><code>win.addBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>Replacement API for setBrowserView supporting work with multi browser views.</p>\n<h4 id=\"winremovebrowserviewbrowserview-experimental\"><a href=\"#winremovebrowserviewbrowserview-experimental\"><code>win.removeBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<h4 id=\"winsettopbrowserviewbrowserview-experimental\"><a href=\"#winsettopbrowserviewbrowserview-experimental\"><code>win.setTopBrowserView(browserView)</code> <em>Experimental</em></a></h4>\n<ul>\n<li><code>browserView</code> <a href=\"/docs/api/browser-view\">BrowserView</a></li>\n</ul>\n<p>Raises <code>browserView</code> above other <code>BrowserView</code>s attached to <code>win</code>. Throws an error if <code>browserView</code> is not attached to <code>win</code>.</p>\n<h4 id=\"wingetbrowserviews-experimental\"><a href=\"#wingetbrowserviews-experimental\"><code>win.getBrowserViews()</code> <em>Experimental</em></a></h4>\n<p>Returns <code>BrowserView[]</code> - an array of all BrowserViews that have been attached with <code>addBrowserView</code> or <code>setBrowserView</code>.</p>\n<p><strong>Note:</strong> The BrowserView API is currently experimental and may change or be removed in future Electron releases.</p>",
      "title": "Browserfenster",
      "description": "Erstellung und Steuerung von Browserfenstern."
    },
    "/docs/api/browser-window-proxy": {
      "locale": "de-DE",
      "slug": "browser-window-proxy",
      "href": "/docs/api/browser-window-proxy",
      "crowdinFileId": "256285",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/browser-window-proxy.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"klasse-browserwindow\"><a href=\"#klasse-browserwindow\">Klasse: BrowserWindow</a></h2>\n<blockquote>\n<p>Manipulate the child browser window</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>The <code>BrowserWindowProxy</code> object is returned from <code>window.open</code> and provides limited functionality with the child window.</p>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<p>Das <code>BrowserWindowProxy</code> Objekt hat die folgenden Instanz Methoden:</p>\n<h4 id=\"winblur\"><a href=\"#winblur\"><code>win.blur()</code></a></h4>\n<p>Removes focus from the child window.</p>\n<h4 id=\"winclose\"><a href=\"#winclose\"><code>win.close()</code></a></h4>\n<p>Forcefully closes the child window without calling its unload event.</p>\n<h4 id=\"winevalcode\"><a href=\"#winevalcode\"><code>win.eval(code)</code></a></h4>\n<ul>\n<li><code>code</code> Zeichenkette</li>\n</ul>\n<p>Evaluates the code in the child window.</p>\n<h4 id=\"winfocus\"><a href=\"#winfocus\"><code>win.focus()</code></a></h4>\n<p>Focuses the child window (brings the window to front).</p>\n<h4 id=\"winprint\"><a href=\"#winprint\"><code>win.print()</code></a></h4>\n<p>Invokes the print dialog on the child window.</p>\n<h4 id=\"winpostmessagemessage-targetorigin\"><a href=\"#winpostmessagemessage-targetorigin\"><code>win.postMessage(message, targetOrigin)</code></a></h4>\n<ul>\n<li><code>message</code> any</li>\n<li><code>targetOrigin</code> Zeichenkette</li>\n</ul>\n<p>Sends a message to the child window with the specified origin or <code>*</code> for no origin preference.</p>\n<p>In addition to these methods, the child window implements <code>window.opener</code> object with no properties and a single method.</p>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<p>The <code>BrowserWindowProxy</code> object has the following instance properties:</p>\n<h4 id=\"winclosed\"><a href=\"#winclosed\"><code>win.closed</code></a></h4>\n<p>A <code>Boolean</code> that is set to true after the child window gets closed.</p>",
      "title": "Klasse: BrowserWindow",
      "description": "Manipulate the child browser window"
    },
    "/docs/development/build-instructions-gn": {
      "locale": "de-DE",
      "slug": "build-instructions-gn",
      "href": "/docs/development/build-instructions-gn",
      "crowdinFileId": "256131",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-gn.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"build-instructions\"><a href=\"#build-instructions\">Build Instructions</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong>, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"platform-prerequisites\"><a href=\"#platform-prerequisites\">Platform prerequisites</a></h2>\n<p>Check the build prerequisites for your platform before proceeding</p>\n<ul>\n<li><a href=\"/docs/development/build-instructions-macos#prerequisites\">macOS</a></li>\n<li><a href=\"/docs/development/build-instructions-linux#prerequisites\">Linux</a></li>\n<li><a href=\"/docs/development/build-instructions-windows#prerequisites\">Windows</a></li>\n</ul>\n<h2 id=\"build-tools\"><a href=\"#build-tools\">Build Tools</a></h2>\n<p><a href=\"https://github.com/electron/build-tools\">Electron's Build Tools</a> automate much of the setup for compiling Electron from source with different configurations and build targets. If you wish to set up the environment manually, the instructions are listed below.</p>\n<h2 id=\"gn-prerequisites\"><a href=\"#gn-prerequisites\">GN prerequisites</a></h2>\n<p>You'll need to install <a href=\"https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up\"><code>depot_tools</code></a>, the toolset used for fetching Chromium and its dependencies.</p>\n<p>Also, on Windows, you'll need to set the environment variable <code>DEPOT_TOOLS_WIN_TOOLCHAIN=0</code>. To do so, open <code>Control Panel</code> → <code>System and Security</code> → <code>System</code> → <code>Advanced system settings</code> and add a system variable <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> with value <code>0</code>.  This tells <code>depot_tools</code> to use your locally installed version of Visual Studio (by default, <code>depot_tools</code> will try to download a Google-internal version that only Googlers have access to).</p>\n<h3 id=\"setting-up-the-git-cache\"><a href=\"#setting-up-the-git-cache\">Setting up the git cache</a></h3>\n<p>If you plan on checking out Electron more than once (for example, to have multiple parallel directories checked out to different branches), using the git cache will speed up subsequent calls to <code>gclient</code>. To do this, set a <code>GIT_CACHE_PATH</code> environment variable:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">export</span> GIT_CACHE_PATH=<span class=\"hljs-string\">\"<span class=\"hljs-variable\">${HOME}</span>/.git_cache\"</span>\n$ mkdir -p <span class=\"hljs-string\">\"<span class=\"hljs-variable\">${GIT_CACHE_PATH}</span>\"</span>\n<span class=\"hljs-comment\"># This will use about 16G.</span>\n</code></pre>\n<h2 id=\"getting-the-code\"><a href=\"#getting-the-code\">Getting the code</a></h2>\n<pre><code class=\"hljs language-sh\">$ mkdir electron &#x26;&#x26; <span class=\"hljs-built_in\">cd</span> electron\n$ gclient config --name <span class=\"hljs-string\">\"src/electron\"</span> --unmanaged https://github.com/electron/electron\n$ gclient sync --with_branch_heads --with_tags\n<span class=\"hljs-comment\"># This will take a while, go get a coffee.</span>\n</code></pre>\n<blockquote>\n<p>Instead of <code>https://github.com/electron/electron</code>, you can use your own fork here (something like <code>https://github.com/&#x3C;username>/electron</code>).</p>\n</blockquote>\n<h3 id=\"a-note-on-pullingpushing\"><a href=\"#a-note-on-pullingpushing\">A note on pulling/pushing</a></h3>\n<p>If you intend to <code>git pull</code> or <code>git push</code> from the official <code>electron</code> repository in the future, you now need to update the respective folder's origin URLs.</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src/electron\n$ git remote remove origin\n$ git remote add origin https://github.com/electron/electron\n$ git checkout main\n$ git branch --<span class=\"hljs-built_in\">set</span>-upstream-to=origin/main\n$ <span class=\"hljs-built_in\">cd</span> -\n</code></pre>\n<p>📝 <code>gclient</code> works by checking a file called <code>DEPS</code> inside the <code>src/electron</code> folder for dependencies (like Chromium or Node.js). Running <code>gclient sync -f</code> ensures that all dependencies required to build Electron match that file.</p>\n<p>So, in order to pull, you'd run the following commands:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src/electron\n$ git pull\n$ gclient sync -f\n</code></pre>\n<h2 id=\"building\"><a href=\"#building\">Building</a></h2>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src\n$ <span class=\"hljs-built_in\">export</span> CHROMIUM_BUILDTOOLS_PATH=`<span class=\"hljs-built_in\">pwd</span>`/buildtools\n$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p>Or on Windows (without the optional argument):</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> src\n$ <span class=\"hljs-built_in\">set</span> CHROMIUM_BUILDTOOLS_PATH=%<span class=\"hljs-built_in\">cd</span>%\\buildtools\n$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\")\"</span>\n</code></pre>\n<p>This will generate a build directory <code>out/Testing</code> under <code>src/</code> with the testing build configuration. You can replace <code>Testing</code> with another name, but it should be a subdirectory of <code>out</code>. Also you shouldn't have to run <code>gn gen</code> again—if you want to change the build arguments, you can run <code>gn args out/Testing</code> to bring up an editor.</p>\n<p>To see the list of available build configuration options, run <code>gn args out/Testing --list</code>.</p>\n<p><strong>For generating Testing build config of Electron:</strong></p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/testing.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p><strong>For generating Release (aka \"non-component\" or \"static\") build config of Electron:</strong></p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Release --args=<span class=\"hljs-string\">\"import(\\\"//electron/build/args/release.gn\\\") <span class=\"hljs-variable\">$GN_EXTRA_ARGS</span>\"</span>\n</code></pre>\n<p><strong>To build, run <code>ninja</code> with the <code>electron</code> target:</strong> Nota Bene: This will also take a while and probably heat up your lap.</p>\n<p>For the testing configuration:</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Testing electron\n</code></pre>\n<p>For the release configuration:</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Release electron\n</code></pre>\n<p>This will build all of what was previously 'libchromiumcontent' (i.e. the <code>content/</code> directory of <code>chromium</code> and its dependencies, incl. WebKit and V8), so it will take a while.</p>\n<p>The built executable will be under <code>./out/Testing</code>:</p>\n<pre><code class=\"hljs language-sh\">$ ./out/Testing/Electron.app/Contents/MacOS/Electron\n<span class=\"hljs-comment\"># or, on Windows</span>\n$ ./out/Testing/electron.exe\n<span class=\"hljs-comment\"># or, on Linux</span>\n$ ./out/Testing/electron\n</code></pre>\n<h3 id=\"pakete-erstellen\"><a href=\"#pakete-erstellen\">Pakete erstellen</a></h3>\n<p>On linux, first strip the debugging and symbol information:</p>\n<pre><code class=\"hljs language-sh\">electron/script/strip-binaries.py -d out/Release\n</code></pre>\n<p>To package the electron build as a distributable zip file:</p>\n<pre><code class=\"hljs language-sh\">ninja -C out/Release electron:electron_dist_zip\n</code></pre>\n<h3 id=\"cross-compiling\"><a href=\"#cross-compiling\">Cross-compiling</a></h3>\n<p>To compile for a platform that isn't the same as the one you're building on, set the <code>target_cpu</code> and <code>target_os</code> GN arguments. For example, to compile an x86 target from an x64 host, specify <code>target_cpu = \"x86\"</code> in <code>gn args</code>.</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing-x86 --args=<span class=\"hljs-string\">'... target_cpu = \"x86\"'</span>\n</code></pre>\n<p>Nicht alle Kombinationen von Quell- und Ziel-Prozessor/Betriebssystem werden von Chromium unterstützt.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Host</th><th>Ziel</th><th>Status</th></tr></thead><tbody><tr><td>Windows x64</td><td>Windows arm64</td><td>Experimental</td></tr><tr><td>Windows x64</td><td>Windows x86</td><td>Automatisch getestet</td></tr><tr><td>Linux x64</td><td>Linux x86</td><td>Automatisch getestet</td></tr></tbody></table>\n<p>Wenn Sie andere Kombinationen testen und diese funktionieren aktualisieren Sie bitte dieses Dokument :)</p>\n<p>See the GN reference for allowable values of <a href=\"https://gn.googlesource.com/gn/+/master/docs/reference.md#built_in-predefined-variables-target_os_the-desired-operating-system-for-the-build-possible-values\"><code>target_os</code></a> and <a href=\"https://gn.googlesource.com/gn/+/master/docs/reference.md#built_in-predefined-variables-target_cpu_the-desired-cpu-architecture-for-the-build-possible-values\"><code>target_cpu</code></a>.</p>\n<h4 id=\"windows-auf-arm-experimentell\"><a href=\"#windows-auf-arm-experimentell\">Windows auf Arm (experimentell)</a></h4>\n<p>Um Windows auf Arm zu kompilieren, folgen Sie<a href=\"https://chromium.googlesource.com/chromium/src/+/refs/heads/master/docs/windows_build_instructions.md#Visual-Studio\">dem Chromium-Guide</a> um die notwendigen Abhängigkeiten, SDK und Bibliotheken zu erhalten, und bauen Sie dann mit <code>ELECTRON_BUILDING_WOA=1</code> in Ihrer Umgebung, bevor Sie <code>gclient sync</code>ausführen.</p>\n<pre><code class=\"hljs language-bat\"><span class=\"hljs-built_in\">set</span> ELECTRON_BUILDING_WOA=<span class=\"hljs-number\">1</span>\ngclient sync -f --with_branch_heads --with_tags\n</code></pre>\n<p>Oder (wenn Sie PowerShell benutzen):</p>\n<pre><code class=\"hljs language-powershell\"><span class=\"hljs-variable\">$env:ELECTRON_BUILDING_WOA</span>=<span class=\"hljs-number\">1</span>\ngclient sync -f --with_branch_heads --with_tags\n</code></pre>\n<p>Als nächstes führe <code>gn gen</code> aus wie oben mit <code>target_cpu=\"arm64\"</code>.</p>\n<h2 id=\"tests\"><a href=\"#tests\">Tests</a></h2>\n<p>Um die Tests durchzuführen, müssen Sie zuerst die Testmodule gegen die gleiche Version von Node.js bauen, die als Teil des Build-Prozesses gebaut wurde. Um Build Header für die Module zu kompilieren, führen Sie folgende Befehle in dem <code>src/</code> Verzeichnis aus.</p>\n<pre><code class=\"hljs language-sh\">$ ninja -C out/Testing third_party/electron_node:headers\n</code></pre>\n<p>You can now <a href=\"/docs/development/testing#unit-tests\">run the tests</a>.</p>\n<p>Wenn Sie etwas debuggen kann es hilfreich sein einige zusätzlichen Flaggen zu der Electron Binärdatei zu übergeben:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span> -- \\\n  --<span class=\"hljs-built_in\">enable</span>-logging -g <span class=\"hljs-string\">'BrowserWindow module'</span>\n</code></pre>\n<h2 id=\"sharing-the-git-cache-between-multiple-machines\"><a href=\"#sharing-the-git-cache-between-multiple-machines\">Sharing the git cache between multiple machines</a></h2>\n<p>It is possible to share the gclient git cache with other machines by exporting it as SMB share on linux, but only one process/machine can be using the cache at a time. The locks created by git-cache script will try to prevent this, but it may not work perfectly in a network.</p>\n<p>On Windows, SMBv2 has a directory cache that will cause problems with the git cache script, so it is necessary to disable it by setting the registry key</p>\n<pre><code class=\"hljs language-sh\">HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\Lanmanworkstation\\Parameters\\DirectoryCacheLifetime\n</code></pre>\n<p>to 0. More information: <a href=\"https://stackoverflow.com/a/9935126\">https://stackoverflow.com/a/9935126</a></p>\n<p>This can be set quickly in powershell (ran as administrator):</p>\n<pre><code class=\"hljs language-powershell\"><span class=\"hljs-built_in\">New-ItemProperty</span> -Path <span class=\"hljs-string\">\"HKLM:\\System\\CurrentControlSet\\Services\\Lanmanworkstation\\Parameters\"</span> -Name DirectoryCacheLifetime -Value <span class=\"hljs-number\">0</span> -PropertyType DWORD -Force\n</code></pre>\n<h2 id=\"problemlösungen\"><a href=\"#problemlösungen\">Problemlösungen</a></h2>\n<h3 id=\"gclient-sync-complains-about-rebase\"><a href=\"#gclient-sync-complains-about-rebase\">gclient sync complains about rebase</a></h3>\n<p>If <code>gclient sync</code> is interrupted the git tree may be left in a bad state, leading to a cryptic message when running <code>gclient sync</code> in the future:</p>\n<pre><code class=\"hljs language-plaintext\">2> Conflict while rebasing this branch.\n2> Fix the conflict and run gclient again.\n2> See man git-rebase for details.\n</code></pre>\n<p>If there are no git conflicts or rebases in <code>src/electron</code>, you may need to abort a <code>git am</code> in <code>src</code>:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">cd</span> ../\n$ git am --abort\n$ <span class=\"hljs-built_in\">cd</span> electron\n$ gclient sync -f\n</code></pre>\n<h3 id=\"im-being-asked-for-a-usernamepassword-for-chromium-internalgooglesourcecom\"><a href=\"#im-being-asked-for-a-usernamepassword-for-chromium-internalgooglesourcecom\">I'm being asked for a username/password for chromium-internal.googlesource.com</a></h3>\n<p>If you see a prompt for <code>Username for 'https://chrome-internal.googlesource.com':</code> when running <code>gclient sync</code> on Windows, it's probably because the <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> environment variable is not set to 0. Open <code>Control Panel</code> → <code>System and Security</code> → <code>System</code> → <code>Advanced system settings</code> and add a system variable <code>DEPOT_TOOLS_WIN_TOOLCHAIN</code> with value <code>0</code>.  This tells <code>depot_tools</code> to use your locally installed version of Visual Studio (by default, <code>depot_tools</code> will try to download a Google-internal version that only Googlers have access to).</p>",
      "title": "Build Instructions",
      "description": "Instead of https://github.com/electron/electron, you can use your own fork here (something like https://github.com/<username>/electron)."
    },
    "/docs/development/build-instructions-linux": {
      "locale": "de-DE",
      "slug": "build-instructions-linux",
      "href": "/docs/development/build-instructions-linux",
      "crowdinFileId": "256133",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-linux.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"build-anweisungen-linux\"><a href=\"#build-anweisungen-linux\">Build Anweisungen (Linux)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on Linux, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>\n<p>At least 25GB disk space and 8GB RAM.</p>\n</li>\n<li>\n<p>Python 2.7.x. Some distributions like CentOS 6.x still use Python 2.6.x so you may need to check your Python version with <code>python -V</code>.</p>\n<p>Please also ensure that your system and Python version support at least TLS 1.2. For a quick test, run the following script:</p>\n<pre><code class=\"hljs language-sh\">$ npx @electron/check-python-tls\n</code></pre>\n<p>If the script returns that your configuration is using an outdated security protocol, use your system's package manager to update Python to the latest version in the 2.7.x branch. Alternatively, visit <a href=\"https://www.python.org/downloads/\">https://www.python.org/downloads/</a> for detailed instructions.</p>\n</li>\n<li>\n<p>Node.js. There are various ways to install Node. You can download source code from <a href=\"https://nodejs.org\">nodejs.org</a> and compile it. Doing so permits installing Node on your own home directory as a standard user. Or try repositories such as <a href=\"https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories\">NodeSource</a>.</p>\n</li>\n<li>\n<p><a href=\"https://clang.llvm.org/get_started.html\">clang</a> 3.4 or later.</p>\n</li>\n<li>\n<p>Development headers of GTK 3 and libnotify.</p>\n</li>\n</ul>\n<p>On Ubuntu, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install build-essential clang libdbus-1-dev libgtk-3-dev \\\n                       libnotify-dev libgnome-keyring-dev \\\n                       libasound2-dev libcap-dev libcups2-dev libxtst-dev \\\n                       libxss1 libnss3-dev gcc-multilib g++-multilib curl \\\n                       gperf bison python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On RHEL / CentOS, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo yum install clang dbus-devel gtk3-devel libnotify-devel \\\n                   libgnome-keyring-devel xorg-x11-server-utils libcap-devel \\\n                   cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \\\n                   nss-devel python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On Fedora, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo dnf install clang dbus-devel gtk3-devel libnotify-devel \\\n                   libgnome-keyring-devel xorg-x11-server-utils libcap-devel \\\n                   cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \\\n                   nss-devel python-dbusmock openjdk-8-jre\n</code></pre>\n<p>On Arch Linux / Manjaro, install the following libraries:</p>\n<pre><code class=\"hljs language-sh\">$ sudo pacman -Syu base-devel clang libdbus gtk2 libnotify \\\n                   libgnome-keyring alsa-lib libcap libcups libxtst \\\n                   libxss nss gcc-multilib curl gperf bison \\\n                   python2 python-dbusmock jdk8-openjdk\n</code></pre>\n<p>Other distributions may offer similar packages for installation via package managers such as pacman. Or one can compile from source code.</p>\n<h3 id=\"cross-compilation\"><a href=\"#cross-compilation\">Cross compilation</a></h3>\n<p>If you want to build for an <code>arm</code> target you should also install the following dependencies:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install libc6-dev-armhf-cross linux-libc-dev-armhf-cross \\\n                       g++-arm-linux-gnueabihf\n</code></pre>\n<p>Similarly for <code>arm64</code>, install the following:</p>\n<pre><code class=\"hljs language-sh\">$ sudo apt-get install libc6-dev-arm64-cross linux-libc-dev-arm64-cross \\\n                       g++-aarch64-linux-gnu\n</code></pre>\n<p>And to cross-compile for <code>arm</code> or <code>ia32</code> targets, you should pass the <code>target_cpu</code> parameter to <code>gn gen</code>:</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">'import(...) target_cpu=\"arm\"'</span>\n</code></pre>\n<h2 id=\"building\"><a href=\"#building\">Building</a></h2>\n<p>See <a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a></p>\n<h2 id=\"problemlösungen\"><a href=\"#problemlösungen\">Problemlösungen</a></h2>\n<h3 id=\"error-while-loading-shared-libraries-libtinfoso5\"><a href=\"#error-while-loading-shared-libraries-libtinfoso5\">Error While Loading Shared Libraries: libtinfo.so.5</a></h3>\n<p>Prebuilt <code>clang</code> will try to link to <code>libtinfo.so.5</code>. Depending on the host architecture, symlink to appropriate <code>libncurses</code>:</p>\n<pre><code class=\"hljs language-sh\">$ sudo ln -s /usr/lib/libncurses.so.5 /usr/lib/libtinfo.so.5\n</code></pre>\n<h2 id=\"advanced-topics\"><a href=\"#advanced-topics\">Advanced topics</a></h2>\n<p>The default building configuration is targeted for major desktop Linux distributions. To build for a specific distribution or device, the following information may help you.</p>\n<h3 id=\"using-system-clang-instead-of-downloaded-clang-binaries\"><a href=\"#using-system-clang-instead-of-downloaded-clang-binaries\">Using system <code>clang</code> instead of downloaded <code>clang</code> binaries</a></h3>\n<p>By default Electron is built with prebuilt <a href=\"https://clang.llvm.org/get_started.html\"><code>clang</code></a> binaries provided by the Chromium project. If for some reason you want to build with the <code>clang</code> installed in your system, you can specify the <code>clang_base_path</code> argument in the GN args.</p>\n<p>For example if you installed <code>clang</code> under <code>/usr/local/bin/clang</code>:</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --args=<span class=\"hljs-string\">'import(\"//electron/build/args/testing.gn\") clang_base_path = \"/usr/local/bin\"'</span>\n</code></pre>\n<h3 id=\"using-compilers-other-than-clang\"><a href=\"#using-compilers-other-than-clang\">Using compilers other than <code>clang</code></a></h3>\n<p>Building Electron with compilers other than <code>clang</code> is not supported.</p>",
      "title": "Build Anweisungen (Linux)",
      "description": ""
    },
    "/docs/development/build-instructions-macos": {
      "locale": "de-DE",
      "slug": "build-instructions-macos",
      "href": "/docs/development/build-instructions-macos",
      "crowdinFileId": "256135",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-macos.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"build-anweisungen-macos\"><a href=\"#build-anweisungen-macos\">Build Anweisungen (macOS)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on macOS, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>macOS >= 10.11.6</li>\n<li><a href=\"https://developer.apple.com/technologies/tools/\">Xcode</a> >= 9.0.0</li>\n<li><a href=\"https://nodejs.org\">node.js</a> (external)</li>\n<li>Python 2.7 with support for TLS 1.2</li>\n</ul>\n<h2 id=\"python\"><a href=\"#python\">Python</a></h2>\n<p>Please also ensure that your system and Python version support at least TLS 1.2. This depends on both your version of macOS and Python. For a quick test, run:</p>\n<pre><code class=\"hljs language-sh\">$ npx @electron/check-python-tls\n</code></pre>\n<p>If the script returns that your configuration is using an outdated security protocol, you can either update macOS to High Sierra or install a new version of Python 2.7.x. To upgrade Python, use <a href=\"https://brew.sh/\">Homebrew</a>:</p>\n<pre><code class=\"hljs language-sh\">$ brew install python@2 &#x26;&#x26; brew link python@2 --force\n</code></pre>\n<p>If you are using Python as provided by Homebrew, you also need to install the following Python modules:</p>\n<ul>\n<li><a href=\"https://pypi.org/project/pyobjc/#description\">pyobjc</a></li>\n</ul>\n<p>Sie können <code>pip</code> verwenden, um es zu installieren:</p>\n<pre><code class=\"hljs language-sh\">$ pip install pyobjc\n</code></pre>\n<h2 id=\"macos-sdk\"><a href=\"#macos-sdk\">macOS SDK</a></h2>\n<p>Wenn Sie Electron entwickeln und nicht vorhaben Ihre Version zu verteilen, können sie diesen Abschnitt überspringen.</p>\n<p>Official Electron builds are built with <a href=\"https://download.developer.apple.com/Developer_Tools/Xcode_12.2/Xcode_12.2.xip\">Xcode 12.2</a>, and the macOS 11.0 SDK. Das Erstellen der Software mit einem neueren SDK funktioniert ebenfalls, aber die veröffentlichten Versionen verwenden derzeit das 11.0 SDK.</p>\n<h2 id=\"building-electron\"><a href=\"#building-electron\">Building Electron</a></h2>\n<p>Siehe <a href=\"/docs/development/build-instructions-gn\">Build Instruktionen: GN</a>.</p>",
      "title": "Build Anweisungen (macOS)",
      "description": ""
    },
    "/docs/development/build-instructions-windows": {
      "locale": "de-DE",
      "slug": "build-instructions-windows",
      "href": "/docs/development/build-instructions-windows",
      "crowdinFileId": "256137",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-instructions-windows.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"build-anweisungen-windows\"><a href=\"#build-anweisungen-windows\">Build Anweisungen (Windows)</a></h1>\n<p>Follow the guidelines below for building <strong>Electron itself</strong> on Windows, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the <a href=\"/docs/tutorial/application-distribution\">application distribution</a> guide.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>Windows 10 / Server 2012 R2 or higher</li>\n<li>Visual Studio 2017 15.7.2 or higher - <a href=\"https://www.visualstudio.com/vs/\">download VS 2019 Community Edition for free</a><ul>\n<li>See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md#visual-studio\">the Chromium build documentation</a> for more details on which Visual Studio components are required.</li>\n<li>If your Visual Studio is installed in a directory other than the default, you'll need to set a few environment variables to point the toolchains to your installation path.<ul>\n<li><code>vs2019_install = DRIVE:\\path\\to\\Microsoft Visual Studio\\2019\\Community</code>, replacing <code>2019</code> and <code>Community</code> with your installed versions and replacing <code>DRIVE:</code> with the drive that Visual Studio is on. Often, this will be <code>C:</code>.</li>\n<li><code>WINDOWSSDKDIR = DRIVE:\\path\\to\\Windows Kits\\10</code>, replacing <code>DRIVE:</code> with the drive that Windows Kits is on. Often, this will be <code>C:</code>.</li>\n</ul></li>\n<li><a href=\"https://pypi.org/project/pywin32/#files\">Python for Windows (pywin32) Extensions</a> is also needed in order to run the build process.</li>\n</ul></li>\n<li><a href=\"https://nodejs.org/download/\">Node.js</a></li>\n<li><a href=\"https://git-scm.com\">Git</a></li>\n<li>Debugging Tools for Windows of Windows SDK 10.0.15063.468 if you plan on creating a full distribution since <code>symstore.exe</code> is used for creating a symbol store from <code>.pdb</code> files.<ul>\n<li>Different versions of the SDK can be installed side by side. To install the SDK, open Visual Studio Installer, select <code>Modify</code> → <code>Individual Components</code>, scroll down and select the appropriate Windows SDK to install. Another option would be to look at the <a href=\"https://developer.microsoft.com/en-us/windows/downloads/sdk-archive\">Windows SDK and emulator archive</a> and download the standalone version of the SDK respectively.</li>\n<li>The SDK Debugging Tools must also be installed. If the Windows 10 SDK was installed via the Visual Studio installer, then they can be installed by going to: <code>Control Panel</code> → <code>Programs</code> → <code>Programs and Features</code> → Select the \"Windows Software Development Kit\" → <code>Change</code> → <code>Change</code> → Check \"Debugging Tools For Windows\" → <code>Change</code>. Or, you can download the standalone SDK installer and use it to install the Debugging Tools.</li>\n</ul></li>\n</ul>\n<p>If you don't currently have a Windows installation, <a href=\"https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/\">dev.microsoftedge.com</a> has timebombed versions of Windows that you can use to build Electron.</p>\n<p>Building Electron is done entirely with command-line scripts and cannot be done with Visual Studio. You can develop Electron with any editor but support for building with Visual Studio will come in the future.</p>\n<p><strong>Note:</strong> Even though Visual Studio is not used for building, it's still <strong>required</strong> because we need the build toolchains it provides.</p>\n<h2 id=\"exclude-source-tree-from-windows-security\"><a href=\"#exclude-source-tree-from-windows-security\">Exclude source tree from Windows Security</a></h2>\n<p>Windows Security doesn't like one of the files in the Chromium source code (see <a href=\"https://crbug.com/441184\">https://crbug.com/441184</a>), so it will constantly delete it, causing <code>gclient sync</code> issues. You can exclude the source tree from being monitored by Windows Security by <a href=\"https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26\">following these instructions</a>.</p>\n<h2 id=\"building\"><a href=\"#building\">Building</a></h2>\n<p>See <a href=\"/docs/development/build-instructions-gn\">Build Instructions: GN</a></p>\n<h2 id=\"32-bit-build\"><a href=\"#32-bit-build\">32-Bit-Build</a></h2>\n<p>To build for the 32bit target, you need to pass <code>target_cpu = \"x86\"</code> as a GN arg. You can build the 32bit target alongside the 64bit target by using a different output directory for GN, e.g. <code>out/Release-x86</code>, with different arguments.</p>\n<pre><code class=\"hljs language-powershell\">$ gn gen out/Release-x86 --args=<span class=\"hljs-string\">\"import(\\\"</span>//electron/build/args/release.gn\\<span class=\"hljs-string\">\") target_cpu=\\\"</span>x86\\<span class=\"hljs-string\">\"\"</span>\n</code></pre>\n<p>The other building steps are exactly the same.</p>\n<h2 id=\"visual-studio-project\"><a href=\"#visual-studio-project\">Visual Studio project</a></h2>\n<p>To generate a Visual Studio project, you can pass the <code>--ide=vs2017</code> parameter to <code>gn gen</code>:</p>\n<pre><code class=\"hljs language-powershell\">$ gn gen out/Testing --ide=vs2017\n</code></pre>\n<h2 id=\"problemlösungen\"><a href=\"#problemlösungen\">Problemlösungen</a></h2>\n<h3 id=\"command-xxxx-not-found\"><a href=\"#command-xxxx-not-found\">Command xxxx not found</a></h3>\n<p>If you encountered an error like <code>Command xxxx not found</code>, you may try to use the <code>VS2015 Command Prompt</code> console to execute the build scripts.</p>\n<h3 id=\"fatal-internal-compiler-error-c1001\"><a href=\"#fatal-internal-compiler-error-c1001\">Fatal internal compiler error: C1001</a></h3>\n<p>Stellen Sie sicher, dass Sie die neueste Visual Studio Version installiert haben.</p>\n<h3 id=\"lnk1181-cannot-open-input-file-kernel32lib\"><a href=\"#lnk1181-cannot-open-input-file-kernel32lib\">LNK1181: cannot open input file 'kernel32.lib'</a></h3>\n<p>Try reinstalling 32bit Node.js.</p>\n<h3 id=\"error-enoent-stat-cusersusernameappdataroamingnpm\"><a href=\"#error-enoent-stat-cusersusernameappdataroamingnpm\">Error: ENOENT, stat 'C:\\Users\\USERNAME\\AppData\\Roaming\\npm'</a></h3>\n<p>Creating that directory <a href=\"https://stackoverflow.com/a/25095327/102704\">should fix the problem</a>:</p>\n<pre><code class=\"hljs language-powershell\">$ mkdir ~\\AppData\\Roaming\\npm\n</code></pre>\n<h3 id=\"node-gyp-is-not-recognized-as-an-internal-or-external-command\"><a href=\"#node-gyp-is-not-recognized-as-an-internal-or-external-command\">node-gyp is not recognized as an internal or external command</a></h3>\n<p>You may get this error if you are using Git Bash for building, you should use PowerShell or VS2015 Command Prompt instead.</p>\n<h3 id=\"cannot-create-directory-at--filename-too-long\"><a href=\"#cannot-create-directory-at--filename-too-long\">cannot create directory at '...': Filename too long</a></h3>\n<p>node.js has some <a href=\"https://github.com/electron/node/tree/electron/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/read-pkg-up/node_modules/read-pkg/node_modules/load-json-file/node_modules/parse-json/node_modules/error-ex/node_modules/is-arrayish\">extremely long pathnames</a>, and by default git on windows doesn't handle long pathnames correctly (even though windows supports them). This should fix it:</p>\n<pre><code class=\"hljs language-sh\">$ git config --system core.longpaths <span class=\"hljs-literal\">true</span>\n</code></pre>\n<h3 id=\"error-use-of-undeclared-identifier-defaultdelegatecheckmode\"><a href=\"#error-use-of-undeclared-identifier-defaultdelegatecheckmode\">error: use of undeclared identifier 'DefaultDelegateCheckMode'</a></h3>\n<p>This can happen during build, when Debugging Tools for Windows has been installed with Windows Driver Kit. Uninstall Windows Driver Kit and install Debugging Tools with steps described above.</p>\n<h3 id=\"importerror-no-module-named-win32file\"><a href=\"#importerror-no-module-named-win32file\">ImportError: No module named win32file</a></h3>\n<p>Make sure you have installed <code>pywin32</code> with <code>pip install pywin32</code>.</p>\n<h3 id=\"build-scripts-hang-until-keypress\"><a href=\"#build-scripts-hang-until-keypress\">Build Scripts Hang Until Keypress</a></h3>\n<p>This bug is a \"feature\" of Windows' command prompt. It happens when clicking inside the prompt window with <code>QuickEdit</code> enabled and is intended to allow selecting and copying output text easily. Since each accidental click will pause the build process, you might want to disable this feature in the command prompt properties.</p>",
      "title": "Build Anweisungen (Windows)",
      "description": ""
    },
    "/docs/development/build-system-overview": {
      "locale": "de-DE",
      "slug": "build-system-overview",
      "href": "/docs/development/build-system-overview",
      "crowdinFileId": "256139",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/build-system-overview.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"build-system-übersicht\"><a href=\"#build-system-übersicht\">Build System Übersicht</a></h1>\n<p>Electron uses <a href=\"https://gn.googlesource.com/gn\">GN</a> for project generation and <a href=\"https://ninja-build.org/\">ninja</a> for building. Projektkonfigurationen können in Dateien mit <code>.gn</code> und<code>.gni</code> Endung gefunden werden.</p>\n<h2 id=\"gn-files\"><a href=\"#gn-files\">GN Files</a></h2>\n<p>The following <code>gn</code> files contain the main rules for building Electron:</p>\n<ul>\n<li><code>BUILD.gn</code> defines how Electron itself is built and includes the default configurations for linking with Chromium.</li>\n<li><code>build/args/{debug,release,all}.gn</code> contain the default build arguments for building Electron.</li>\n</ul>\n<h2 id=\"bauen-von-komponenten\"><a href=\"#bauen-von-komponenten\">Bauen von Komponenten</a></h2>\n<p>Since Chromium is quite a large project, the final linking stage can take quite a few minutes, which makes it hard for development. In order to solve this, Chromium introduced the \"component build\", which builds each component as a separate shared library, making linking very quick but sacrificing file size and performance.</p>\n<p>Electron inherits this build option from Chromium. In <code>Debug</code> builds, the binary will be linked to a shared library version of Chromium's components to achieve fast linking time; for <code>Release</code> builds, the binary will be linked to the static library versions, so we can have the best possible binary size and performance.</p>\n<h2 id=\"tests\"><a href=\"#tests\">Tests</a></h2>\n<p><strong>NB</strong> <em>this section is out of date and contains information that is no longer relevant to the GN-built electron.</em></p>\n<p>Test your changes conform to the project coding style using:</p>\n<pre><code class=\"hljs language-sh\">$ npm run lint\n</code></pre>\n<p>Test functionality using:</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>Whenever you make changes to Electron source code, you'll need to re-run the build before the tests:</p>\n<pre><code class=\"hljs language-sh\">$ npm run build &#x26;&#x26; npm <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>You can make the test suite run faster by isolating the specific test or block you're currently working on using Mocha's <a href=\"https://mochajs.org/#exclusive-tests\">exclusive tests</a> feature. Append <code>.only</code> to any <code>describe</code> or <code>it</code> function call:</p>\n<pre><code class=\"hljs language-js\">describe.only(<span class=\"hljs-string\">'some feature'</span>, () => {\n  <span class=\"hljs-comment\">// ... only tests in this block will be run</span>\n})\n</code></pre>\n<p>Alternatively, you can use mocha's <code>grep</code> option to only run tests matching the given regular expression pattern:</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span> -- --grep child_process\n</code></pre>\n<p>Tests that include native modules (e.g. <code>runas</code>) can't be executed with the debug build (see <a href=\"https://github.com/electron/electron/issues/2558\">#2558</a> for details), but they will work with the release build.</p>\n<p>To run the tests with the release build use:</p>\n<pre><code class=\"hljs language-sh\">$ npm <span class=\"hljs-built_in\">test</span> -- -R\n</code></pre>",
      "title": "Build System Übersicht",
      "description": ""
    },
    "/docs/api/structures/certificate": {
      "locale": "de-DE",
      "slug": "certificate",
      "href": "/docs/api/structures/certificate",
      "crowdinFileId": "256415",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/certificate.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"certificate-object\"><a href=\"#certificate-object\">Certificate Object</a></h1>\n<ul>\n<li><code>data</code> String - PEM encoded data</li>\n<li><code>issuer</code> <a href=\"/docs/api/structures/certificate-principal\">CertificatePrincipal</a> - Issuer principal</li>\n<li><code>issuerName</code> String - Issuer's Common Name</li>\n<li><code>issuerCert</code> Certificate - Issuer certificate (if not self-signed)</li>\n<li><code>subject</code> <a href=\"/docs/api/structures/certificate-principal\">CertificatePrincipal</a> - Subject principal</li>\n<li><code>subjectName</code> String - Subject's Common Name</li>\n<li><code>serialNumber</code> String - Hex value represented string</li>\n<li><code>validStart</code> Number - Start date of the certificate being valid in seconds</li>\n<li><code>validExpiry</code> Number - End date of the certificate being valid in seconds</li>\n<li><code>fingerprint</code> String - Fingerprint of the certificate</li>\n</ul>",
      "title": "Certificate Object",
      "description": ""
    },
    "/docs/api/structures/certificate-principal": {
      "locale": "de-DE",
      "slug": "certificate-principal",
      "href": "/docs/api/structures/certificate-principal",
      "crowdinFileId": "256413",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/certificate-principal.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"certificateprincipal-object\"><a href=\"#certificateprincipal-object\">CertificatePrincipal Object</a></h1>\n<ul>\n<li><code>commonName</code> String - Common Name.</li>\n<li><code>organizations</code> String[] - Organization names.</li>\n<li><code>organizationUnits</code> String[] - Organization Unit names.</li>\n<li><code>locality</code> String - Locality.</li>\n<li><code>state</code> String - State or province.</li>\n<li><code>country</code> String - Country or region.</li>\n</ul>",
      "title": "CertificatePrincipal Object",
      "description": ""
    },
    "/docs/development/chromium-development": {
      "locale": "de-DE",
      "slug": "chromium-development",
      "href": "/docs/development/chromium-development",
      "crowdinFileId": "256141",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/chromium-development.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"chromium-entwicklung\"><a href=\"#chromium-entwicklung\">Chromium-Entwicklung</a></h1>\n<blockquote>\n<p>A collection of resources for learning about Chromium and tracking its development</p>\n</blockquote>\n<ul>\n<li><a href=\"https://twitter.com/ChromiumDev\">@ChromiumDev</a> on Twitter</li>\n<li><a href=\"https://twitter.com/googlechrome\">@googlechrome</a> on Twitter</li>\n<li><a href=\"https://blog.chromium.org\">Blog</a></li>\n<li><a href=\"https://cs.chromium.org/\">Code Search</a></li>\n<li><a href=\"https://cs.chromium.org/chromium/src/\">Source Code</a></li>\n<li><a href=\"https://www.chromium.org/developers/calendar\">Development Calendar and Release Info</a></li>\n<li><a href=\"https://www.chromium.org/developers/discussion-groups\">Discussion Groups</a></li>\n</ul>\n<p>See also <a href=\"/docs/development/v8-development\">V8 Development</a></p>",
      "title": "Chromium-Entwicklung",
      "description": "A collection of resources for learning about Chromium and tracking its development"
    },
    "/docs/development/clang-format": {
      "locale": "de-DE",
      "slug": "clang-format",
      "href": "/docs/development/clang-format",
      "crowdinFileId": "256143",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/clang-format.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"clang-format-im-c-code-verwenden\"><a href=\"#clang-format-im-c-code-verwenden\">clang-format im C++ Code verwenden</a></h1>\n<p><a href=\"https://clang.llvm.org/docs/ClangFormat.html\"><code>clang-format</code></a> is a tool to automatically format C/C++/Objective-C code, so that developers don't need to worry about style issues during code reviews.</p>\n<p>It is highly recommended to format your changed C++ code before opening pull requests, which will save you and the reviewers' time.</p>\n<p>You can install <code>clang-format</code> and <code>git-clang-format</code> via <code>npm install -g clang-format</code>.</p>\n<p>To automatically format a file according to Electron C++ code style, run <code>clang-format -i path/to/electron/file.cc</code>. It should work on macOS/Linux/Windows.</p>\n<p>The workflow to format your changed code:</p>\n<ol>\n<li>Make codes changes in Electron repository.</li>\n<li>Führen Sie <code>git add your_changed_file.cc</code> aus.</li>\n<li>Run <code>git-clang-format</code>, and you will probably see modifications in <code>your_changed_file.cc</code>, these modifications are generated from <code>clang-format</code>.</li>\n<li>Run <code>git add your_changed_file.cc</code>, and commit your change.</li>\n<li>Now the branch is ready to be opened as a pull request.</li>\n</ol>\n<p>If you want to format the changed code on your latest git commit (HEAD), you can run <code>git-clang-format HEAD~1</code>. See <code>git-clang-format -h</code> for more details.</p>\n<h2 id=\"editor-integration\"><a href=\"#editor-integration\">Editor Integration</a></h2>\n<p>You can also integrate <code>clang-format</code> directly into your favorite editors. For further guidance on setting up editor integration, see these pages:</p>\n<ul>\n<li><a href=\"https://atom.io/packages/clang-format\">Atom</a></li>\n<li><a href=\"https://clang.llvm.org/docs/ClangFormat.html#vim-integration\">Vim &#x26; Emacs</a></li>\n<li><a href=\"https://marketplace.visualstudio.com/items?itemName=xaver.clang-format\">Visual Studio Code</a></li>\n</ul>",
      "title": "clang-format im C++ Code verwenden",
      "description": ""
    },
    "/docs/development/clang-tidy": {
      "locale": "de-DE",
      "slug": "clang-tidy",
      "href": "/docs/development/clang-tidy",
      "crowdinFileId": "256145",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/clang-tidy.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"using-clang-tidy-on-c-code\"><a href=\"#using-clang-tidy-on-c-code\">Using clang-tidy on C++ Code</a></h1>\n<p><a href=\"https://clang.llvm.org/extra/clang-tidy/\"><code>clang-tidy</code></a> is a tool to automatically check C/C++/Objective-C code for style violations, programming errors, and best practices.</p>\n<p>Electron's <code>clang-tidy</code> integration is provided as a linter script which can be run with <code>npm run lint:clang-tidy</code>. While <code>clang-tidy</code> checks your on-disk files, you need to have built Electron so that it knows which compiler flags were used. There is one required option for the script <code>--output-dir</code>, which tells the script which build directory to pull the compilation information from. A typical usage would be: <code>npm run lint:clang-tidy --out-dir ../out/Testing</code></p>\n<p>With no filenames provided, all C/C++/Objective-C files will be checked. You can provide a list of files to be checked by passing the filenames after the options: <code>npm run lint:clang-tidy --out-dir ../out/Testing shell/browser/api/electron_api_app.cc</code></p>\n<p>While <code>clang-tidy</code> has a <a href=\"https://clang.llvm.org/extra/clang-tidy/checks/list.html\">long list</a> of possible checks, in Electron only a few are enabled by default. At the moment Electron doesn't have a <code>.clang-tidy</code> config, so <code>clang-tidy</code> will find the one from Chromium at <code>src/.clang-tidy</code> and use the checks which Chromium has enabled. You can change which checks are run by using the <code>--checks=</code> option. This is passed straight through to <code>clang-tidy</code>, so see its documentation for full details. Wildcards can be used, and checks can be disabled by prefixing a <code>-</code>. By default any checks listed are added to those in <code>.clang-tidy</code>, so if you'd like to limit the checks to specific ones you should first exclude all checks then add back what you want, like <code>--checks=-*,performance*</code>.</p>\n<p>Running <code>clang-tidy</code> is rather slow - internally it compiles each file and then runs the checks so it will always be some factor slower than compilation. While you can use parallel runs to speed it up using the <code>--jobs|-j</code> option, <code>clang-tidy</code> also uses a lot of memory during its checks, so it can easily run into out-of-memory errors. As such the default number of jobs is one.</p>",
      "title": "Using clang-tidy on C++ Code",
      "description": ""
    },
    "/docs/api/client-request": {
      "locale": "de-DE",
      "slug": "client-request",
      "href": "/docs/api/client-request",
      "crowdinFileId": "256289",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/client-request.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"klasse-clientrequest\"><a href=\"#klasse-clientrequest\">Klasse: ClientRequest</a></h2>\n<blockquote>\n<p>Tätigen von HTTP/HTTPS anfragen.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>ClientRequest</code> implementiert die <a href=\"https://nodejs.org/api/stream.html#stream_writable_streams\">Writable Stream</a>-Schnittstelle und ist somit ein <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h3 id=\"new-clientrequestoptions\"><a href=\"#new-clientrequestoptions\"><code>new ClientRequest(options)</code></a></h3>\n<ul>\n<li><code>options</code> (Object | String) - If <code>options</code> is a String, it is interpreted as the request URL. If it is an object, it is expected to fully specify an HTTP request via the following properties:<ul>\n<li><code>method</code> String (optional) - The HTTP request method. Defaults to the GET method.</li>\n<li><code>url</code> String (optional) - The request URL. Must be provided in the absolute form with the protocol scheme specified as http or https.</li>\n<li><code>session</code> Session (optional) - The <a href=\"/docs/api/session\"><code>Session</code></a> instance with which the request is associated.</li>\n<li><code>partition</code> String (optional) - Der Name der zur Anfrage gehörenden <a href=\"/docs/api/session\"><code>partition</code></a>. Standard ist ein leerer String. The <code>session</code> option supersedes <code>partition</code>. Somit, falls eine <code>session</code> explizit angegeben wird, wird <code>partition</code> ignoriert.</li>\n<li><code>credentials</code> String (optional) - Kann <code>include</code> oder <code>omit</code> sein. Whether to send <a href=\"https://fetch.spec.whatwg.org/#credentials\">credentials</a> with this request. If set to <code>include</code>, credentials from the session associated with the request will be used. If set to <code>omit</code>, credentials will not be sent with the request (and the <code>'login'</code> event will not be triggered in the event of a 401). This matches the behavior of the <a href=\"https://fetch.spec.whatwg.org/#concept-request-credentials-mode\">fetch</a> option of the same name. If this option is not specified, authentication data from the session will be sent, and cookies will not be sent (unless <code>useSessionCookies</code> is set).</li>\n<li><code>useSessionCookies</code> Boolean (optional) - Whether to send cookies with this request from the provided session. If <code>credentials</code> is specified, this option has no effect. Standard ist <code>false</code>.</li>\n<li><code>protocol</code> String (optional) - Kann <code>http:</code> oder <code>https:</code> sein. The protocol scheme in the form 'scheme:'. Defaults to 'http:'.</li>\n<li><code>host</code> String (optional) - Der Server Host angegeben als eine Zusammensetzung aus Hostnamen und der Port Nummer 'hostname:port'.</li>\n<li><code>hostname</code> String (optional) - Der Server Host Name.</li>\n<li><code>port</code> Integer (optional) - Die Port Nummer des Servers.</li>\n<li><code>path</code> String (optional) - Der Pfad Teil der Anfrage URL.</li>\n<li><code>redirect</code> String (optional) - Can be <code>follow</code>, <code>error</code> or <code>manual</code>. The redirect mode for this request. When mode is <code>error</code>, any redirection will be aborted. When mode is <code>manual</code> the redirection will be cancelled unless <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> is invoked synchronously during the <a href=\"#event-redirect\"><code>redirect</code></a> event.  Standardwert ist <code>follow</code>.</li>\n<li><code>origin</code> String (optional) - The origin URL of the request.</li>\n</ul></li>\n</ul>\n<p><code>options</code> Eigenschaften wie zum Beispiel <code>protocol</code>, <code>host</code>, <code>hostname</code>, <code>port</code> und <code>path</code>, folgen strikt dem Node.js Modell, wie im <a href=\"https://nodejs.org/api/url.html\">URL</a> Modul beschrieben.</p>\n<p>Zum Beispiel hätten wir die gleiche Anfrage an \"github.com\" wie folgt erstellen können:</p>\n<pre><code class=\"hljs language-JavaScript\"><span class=\"hljs-keyword\">const</span> request = net.request({\n  <span class=\"hljs-attr\">method</span>: <span class=\"hljs-string\">'GET'</span>,\n  <span class=\"hljs-attr\">protocol</span>: <span class=\"hljs-string\">'https:'</span>,\n  <span class=\"hljs-attr\">hostname</span>: <span class=\"hljs-string\">'github.com'</span>,\n  <span class=\"hljs-attr\">port</span>: <span class=\"hljs-number\">443</span>,\n  <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'/'</span>\n})\n</code></pre>\n<h3 id=\"instanz-ereignisse\"><a href=\"#instanz-ereignisse\">Instanz-Ereignisse</a></h3>\n<h4 id=\"event-response\"><a href=\"#event-response\">Event: 'response'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>response</code> <a href=\"/docs/api/incoming-message\">IncomingMessage</a> - An object representing the HTTP response message.</li>\n</ul>\n<h4 id=\"event-login\"><a href=\"#event-login\">Event: 'login'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>authInfo</code> Objekt<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (optional)</li>\n<li><code>password</code> String (optional)</li>\n</ul></li>\n</ul>\n<p>Ausgegeben, wenn ein Authentifizierung Proxy die Benutzeranmeldeinformationen anfragt.</p>\n<p>Die <code>callback</code> Funktion erwartet mit den Benutzerdaten aufgerufen zu werden:</p>\n<ul>\n<li><code>username</code> String</li>\n<li><code>password</code> String</li>\n</ul>\n<pre><code class=\"hljs language-JavaScript\">request.on(<span class=\"hljs-string\">'login'</span>, (authInfo, callback) => {\n  callback(<span class=\"hljs-string\">'username'</span>, <span class=\"hljs-string\">'password'</span>)\n})\n</code></pre>\n<p>Das nicht Angeben von Anmeldeinformationen wird die Anfrage abbrechen und dem Response-Objekt einen Authentifizierungsfehler melden:</p>\n<pre><code class=\"hljs language-JavaScript\">request.on(<span class=\"hljs-string\">'response'</span>, (response) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`STATUS: <span class=\"hljs-subst\">${response.statusCode}</span>`</span>);\n  response.on(<span class=\"hljs-string\">'error'</span>, (error) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`ERROR: <span class=\"hljs-subst\">${<span class=\"hljs-built_in\">JSON</span>.stringify(error)}</span>`</span>)\n  })\n})\nrequest.on(<span class=\"hljs-string\">'login'</span>, (authInfo, callback) => {\n  callback()\n})\n</code></pre>\n<h4 id=\"event-finish\"><a href=\"#event-finish\">Event: 'finish'</a></h4>\n<p>Ausgesendet, direkt nachdem der letzte Block der <code>request</code> Daten in das <code>request</code> Objekt geschrieben worden sind.</p>\n<h4 id=\"event-abort\"><a href=\"#event-abort\">Event: 'abort'</a></h4>\n<p>Emitted when the <code>request</code> is aborted. The <code>abort</code> event will not be fired if the <code>request</code> is already closed.</p>\n<h4 id=\"event-error\"><a href=\"#event-error\">Event: 'error'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>error</code> Error - Ein Error Objekt, welches Informationen über den Fehler enthält.</li>\n</ul>\n<p>Ausgegeben, wenn das <code>net</code> Modul es nicht schaft eine Netzwerkanfrage zu senden. In der Regel wenn das <code>request</code> Objekt ein <code>error</code> Event auslöst, folgt ein <code>close</code> Event und es wird kein response Objekt zur Verfügung gestellt.</p>\n<h4 id=\"event-close\"><a href=\"#event-close\">Event: 'close'</a></h4>\n<p>Ausgelöst als letztes Event in der HTTP request-response Interaktion. Das <code>close</code> Event gibt an, dass keine weiteren Events mehr auf die <code>request</code> oder <code>response</code> Objekte ausgelöst werden.</p>\n<h4 id=\"event-redirect\"><a href=\"#event-redirect\">Event: 'redirect'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>statusCode</code> Integer</li>\n<li><code>method</code> String</li>\n<li><code>redirectUrl</code> String</li>\n<li><code>responseHeaders</code> Record&#x3C;String, String[]></li>\n</ul>\n<p>Emitted when the server returns a redirect response (e.g. 301 Moved Permanently). Calling <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> will continue with the redirection.  If this event is handled, <a href=\"#requestfollowredirect\"><code>request.followRedirect</code></a> must be called <strong>synchronously</strong>, otherwise the request will be cancelled.</p>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<h4 id=\"requestchunkedencoding\"><a href=\"#requestchunkedencoding\"><code>request.chunkedEncoding</code></a></h4>\n<p>Ein <code>Boolean</code> gibt an, ob die HTTP Anfrage eine segmentierte Übertragungscodierung nutzt oder nicht. Der Standardwert ist false. Die Eigenschaft ist lesbar und beschreibbar, jedoch kann dies nur eingestellt werden, bevor der ersten Schreib-Operation, da die HTTP headers noch nicht abgeschickt worden sind. Der Versuch die <code>chunkedEncoding</code> Eigenschaft nach der ersten Übertragung zu ändern, wird einen Fehler verursachen.</p>\n<p>Das Benutzen von segmentierter Codierung wird dringend empfohlen, wenn du einen großen request body senden möchtest, da die Daten in kleinen Stücken gestreamt wird, anstatt das diese intern im Electron Prozess Speicher gebufferd werden.</p>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<h4 id=\"requestsetheadername-value\"><a href=\"#requestsetheadername-value\"><code>request.setHeader(name, value)</code></a></h4>\n<ul>\n<li><code>name</code> String - Ein extra HTTP header Name.</li>\n<li><code>value</code> String - An extra HTTP header value.</li>\n</ul>\n<p>Fügt einen extra HTTP header hinzu. The header name will be issued as-is without lowercasing. Es kann nur vor dem ersten Schreiben aufgerufen werden. Das Aufrufen der Methode nachdem das erste Schreiben erfolgte, wird einen Fehler erzeugen. Falls der übergebene wert kein <code>String</code> ist, wird die <code>toString()</code> Methode aufgerufen, um den Finalen wert zu erhalten.</p>\n<p>Certain headers are restricted from being set by apps. These headers are listed below. More information on restricted headers can be found in <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:services/network/public/cpp/header_util.cc;drc=1562cab3f1eda927938f8f4a5a91991fefde66d3;bpv=1;bpt=1;l=22\">Chromium's header utils</a>.</p>\n<ul>\n<li><code>Content-Length</code></li>\n<li><code>Host</code></li>\n<li><code>Trailer</code> oder <code>Te</code></li>\n<li><code>Upgrade</code></li>\n<li><code>Cookie2</code></li>\n<li><code>Keep-Alive</code></li>\n<li><code>Transfer-Encoding</code></li>\n</ul>\n<p>Additionally, setting the <code>Connection</code> header to the value <code>upgrade</code> is also disallowed.</p>\n<h4 id=\"requestgetheadername\"><a href=\"#requestgetheadername\"><code>request.getHeader(name)</code></a></h4>\n<ul>\n<li><code>name</code> String - Spezifiziert einen extra Header Namen.</li>\n</ul>\n<p>Gibt ein <code>String</code> wieder - Den wert des davor gesetzten extra Header Namen.</p>\n<h4 id=\"requestremoveheadername\"><a href=\"#requestremoveheadername\"><code>request.removeHeader(name)</code></a></h4>\n<ul>\n<li><code>name</code> String - Spezifiziert einen extra Header Namen.</li>\n</ul>\n<p>Removes a previously set extra header name. This method can be called only before first write. Trying to call it after the first write will throw an error.</p>\n<h4 id=\"requestwritechunk-encoding-callback\"><a href=\"#requestwritechunk-encoding-callback\"><code>request.write(chunk[, encoding][, callback])</code></a></h4>\n<ul>\n<li><code>chunk</code> (String | Buffer) - A chunk of the request body's data. If it is a string, it is converted into a Buffer using the specified encoding.</li>\n<li><code>encoding</code> String (optional) - Used to convert string chunks into Buffer objects. Defaults to 'utf-8'.</li>\n<li><code>callback</code> Function (optional) - Wird aufgerufen, nachdem der Schreibvorgang beendet ist.</li>\n</ul>\n<p><code>callback</code> ist im Wesentlichen eine dummy-Funktion die dem Zweck dient, Ähnlichkeiten mit der Node.js API beizubehalten. Es wird in den nächsten Tick asynchron aufgerufen, nachdem der <code>chunk</code> Inhalt auf der Chromium Netzwerkebene geliefert worden ist. Im Gegensatz zu der Node.js Implementierung, ist es nicht Garantiert das der <code>chunk</code> Inhalt hochgeladen worden ist, vor dem Aufrufen von <code>callback</code>.</p>\n<p>Fügt einen Teil der Daten zum request body. Der erste Schreiboperation könnte das hochladen des request headers einleiten. Nach der ersten Schreiboperation, ist es nicht mehr erlaubt, Benutzerdefinierte Header hinzuzufügen oder zu entfernen.</p>\n<h4 id=\"requestendchunk-encoding-callback\"><a href=\"#requestendchunk-encoding-callback\"><code>request.end([chunk][, encoding][, callback])</code></a></h4>\n<ul>\n<li><code>chunk</code> (String | Buffer) (optional)</li>\n<li><code>encoding</code> String (optional)</li>\n<li><code>callback</code> Funktion (optional)</li>\n</ul>\n<p>Sends the last chunk of the request data. Subsequent write or end operations will not be allowed. The <code>finish</code> event is emitted just after the end operation.</p>\n<h4 id=\"requestabort\"><a href=\"#requestabort\"><code>request.abort()</code></a></h4>\n<p>Bricht die laufende HTTP-Interaktion ab. Falls die Anfrage bereits das <code>close</code> Event ausgegeben hat, hat der Abbruch-Aktion keinen Effekt. Ansonsten wird ein laufendes Event <code>abort</code> und <code>close</code> Events ausgeben. Zusätzlich, falls es ein laufendes response-Objekt gibt, wir dieses ein <code>aborted</code> Event ausgeben.</p>\n<h4 id=\"requestfollowredirect\"><a href=\"#requestfollowredirect\"><code>request.followRedirect()</code></a></h4>\n<p>Continues any pending redirection. Can only be called during a <code>'redirect'</code> event.</p>\n<h4 id=\"requestgetuploadprogress\"><a href=\"#requestgetuploadprogress\"><code>request.getUploadProgress()</code></a></h4>\n<p>Gibt das <code>Object</code> zurück:</p>\n<ul>\n<li><code>active</code> Boolean - Whether the request is currently active. If this is false no other properties will be set</li>\n<li><code>started</code> Boolean - Whether the upload has started. If this is false both <code>current</code> and <code>total</code> will be set to 0.</li>\n<li><code>current</code> Integer - Die Anzahl der bereits hochgeladenen Bytes</li>\n<li><code>total</code> Integer - Die Anzahl der Bytes, die für diese Anforderung hochgeladen werden</li>\n</ul>\n<p>Sie können diese Methode in Verbindung mit <code>POST</code>-Anfragen verwenden, um den Fortschritt von einem Datei-Upload oder einer anderen Datenübertragung abzurufen.</p>",
      "title": "Klasse: ClientRequest",
      "description": "Tätigen von HTTP/HTTPS anfragen."
    },
    "/docs/api/clipboard": {
      "locale": "de-DE",
      "slug": "clipboard",
      "href": "/docs/api/clipboard",
      "crowdinFileId": "256291",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/clipboard.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"clipboard\"><a href=\"#clipboard\">clipboard</a></h1>\n<blockquote>\n<p>Ausführung von Kopier- und Einfüge-Operationen von der Zwischenablage des Betriebssystems.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>Unter Linux gibt es auch eine <code>selection</code> Zwischenablage. Zum Bearbeiten müssen Sie <code>selection</code> an jede Methode übergeben:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeText(<span class=\"hljs-string\">'Example String'</span>, <span class=\"hljs-string\">'selection'</span>)\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readText(<span class=\"hljs-string\">'selection'</span>))\n</code></pre>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das <code>clipboard</code> Modul besitzt die folgenden Methoden:</p>\n<p><strong>Notiz:</strong> Experimentelle Schnittstellen sind mit \"Experimentell\" markiert und könnten in der Zukunft wegfallen.</p>\n<h3 id=\"clipboardreadtexttype\"><a href=\"#clipboardreadtexttype\"><code>clipboard.readText([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> ist nur unter Linux verfügbar.</li>\n</ul>\n<p>Gibt einen <code>String</code> zurück - Der Inhalt der Zwischenablage liegt in Klartext vor.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeText(<span class=\"hljs-string\">'hello i am a bit of text!'</span>)\n\n<span class=\"hljs-keyword\">const</span> text = clipboard.readText()\n<span class=\"hljs-built_in\">console</span>.log(text)\n<span class=\"hljs-comment\">// hello i am a bit of text!'</span>\n</code></pre>\n<h3 id=\"clipboardwritetexttext-type\"><a href=\"#clipboardwritetexttext-type\"><code>clipboard.writeText(text[, type])</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> ist nur unter Linux verfügbar.</li>\n</ul>\n<p>Schreibt den <code>text</code> als Klartext in die Zwischenablage.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> text = <span class=\"hljs-string\">'hello i am a bit of text!'</span>\nclipboard.writeText(text)\n</code></pre>\n<h3 id=\"clipboardreadhtmltype\"><a href=\"#clipboardreadhtmltype\"><code>clipboard.readHTML([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> ist nur unter Linux verfügbar.</li>\n</ul>\n<p>Gibt einen <code>String</code> zurück - Der Inhalt der Zwischenablage liegt in Auszeichnungssprache (markup language) vor.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeHTML(<span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b>'</span>)\n<span class=\"hljs-keyword\">const</span> html = clipboard.readHTML()\n\n<span class=\"hljs-built_in\">console</span>.log(html)\n<span class=\"hljs-comment\">// &#x3C;meta charset='utf-8'>&#x3C;b>Hi&#x3C;/b></span>\n</code></pre>\n<h3 id=\"clipboardwritehtmlmarkup-type\"><a href=\"#clipboardwritehtmlmarkup-type\"><code>clipboard.writeHTML(markup[, type])</code></a></h3>\n<ul>\n<li><code>markup</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> ist nur unter Linux verfügbar.</li>\n</ul>\n<p>Schreibt <code>markup</code> in die Zwischenablage.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeHTML(<span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b'</span>)\n</code></pre>\n<h3 id=\"clipboardreadimagetype\"><a href=\"#clipboardreadimagetype\"><code>clipboard.readImage([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> ist nur unter Linux verfügbar.</li>\n</ul>\n<p>Gibt ein <a href=\"/docs/api/native-image\"><code>NativeImage</code></a> zurück - Der Inhalt des Bildes liegt in der Zwischenablage vor.</p>\n<h3 id=\"clipboardwriteimageimage-type\"><a href=\"#clipboardwriteimageimage-type\"><code>clipboard.writeImage(image[, type])</code></a></h3>\n<ul>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a></li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> ist nur unter Linux verfügbar.</li>\n</ul>\n<p>Schreibt das <code>image</code> in die Zwischenablage.</p>\n<h3 id=\"clipboardreadrtftype\"><a href=\"#clipboardreadrtftype\"><code>clipboard.readRTF([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> ist nur unter Linux verfügbar.</li>\n</ul>\n<p>Gibt einen <code>String</code> zurück - Der Inhalt der Zwischenablage liegt im Rich Text Format (RTF) vor.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeRTF(<span class=\"hljs-string\">'{\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}'</span>)\n\n<span class=\"hljs-keyword\">const</span> rtf = clipboard.readRTF()\n<span class=\"hljs-built_in\">console</span>.log(rtf)\n<span class=\"hljs-comment\">// {\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}</span>\n</code></pre>\n<h3 id=\"clipboardwritertftext-type\"><a href=\"#clipboardwritertftext-type\"><code>clipboard.writeRTF(text[, type])</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> ist nur unter Linux verfügbar.</li>\n</ul>\n<p>Schreibt den <code>text</code> im Rich Text Format (RTF) in die Zwischenablage.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> rtf = <span class=\"hljs-string\">'{\\\\rtf1\\\\ansi{\\\\fonttbl\\\\f0\\\\fswiss Helvetica;}\\\\f0\\\\pard\\nThis is some {\\\\b bold} text.\\\\par\\n}'</span>\nclipboard.writeRTF(rtf)\n</code></pre>\n<h3 id=\"clipboardreadbookmark-macos-windows\"><a href=\"#clipboardreadbookmark-macos-windows\"><code>clipboard.readBookmark()</code> <em>macOS</em> <em>Windows</em></a></h3>\n<p>Gibt das <code>Object</code> zurück:</p>\n<ul>\n<li><code>title</code> String</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Gibt ein Objekt, dass die Keys <code>title</code> und <code>url</code> enthält zurück. Diese Keys repräsentieren das Lesezeichen in der Zwischenablage. Wenn das Lesezeichen nicht verfügbar ist, sind die Werte <code>title</code> und <code>url</code> leer.</p>\n<h3 id=\"clipboardwritebookmarktitle-url-type-macos-windows\"><a href=\"#clipboardwritebookmarktitle-url-type-macos-windows\"><code>clipboard.writeBookmark(title, url[, type])</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>title</code> String</li>\n<li><code>url</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> ist nur unter Linux verfügbar.</li>\n</ul>\n<p>Schreibt den <code>title</code> und die <code>url</code> als Lesezeichen in die Zwischenablage.</p>\n<p><strong>Hinweis:</strong> Die meisten Apps unter Windows unterstützen das Einfügen von Lesezeichen nicht in sie, sodass Sie <code>clipboard.write</code> verwenden können, um sowohl ein Lesezeichen als auch einen Fallbacktext in die Zwischenablage zu schreiben.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.writeBookmark({\n  <span class=\"hljs-attr\">text</span>: <span class=\"hljs-string\">'https://electronjs.org'</span>,\n  <span class=\"hljs-attr\">bookmark</span>: <span class=\"hljs-string\">'Electron Homepage'</span>\n})\n</code></pre>\n<h3 id=\"clipboardreadfindtext-macos\"><a href=\"#clipboardreadfindtext-macos\"><code>clipboard.readFindText()</code> <em>macOS</em></a></h3>\n<p>Returns <code>String</code> - The text on the find pasteboard, which is the pasteboard that holds information about the current state of the active application’s find panel.</p>\n<p>This method uses synchronous IPC when called from the renderer process. The cached value is reread from the find pasteboard whenever the application is activated.</p>\n<h3 id=\"clipboardwritefindtexttext-macos\"><a href=\"#clipboardwritefindtexttext-macos\"><code>clipboard.writeFindText(text)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Writes the <code>text</code> into the find pasteboard (the pasteboard that holds information about the current state of the active application’s find panel) as plain text. This method uses synchronous IPC when called from the renderer process.</p>\n<h3 id=\"clipboardcleartype\"><a href=\"#clipboardcleartype\"><code>clipboard.clear([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> ist nur unter Linux verfügbar.</li>\n</ul>\n<p>Löscht den Inhalt aus der Zwischenablage.</p>\n<h3 id=\"clipboardavailableformatstype\"><a href=\"#clipboardavailableformatstype\"><code>clipboard.availableFormats([type])</code></a></h3>\n<ul>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> ist nur unter Linux verfügbar.</li>\n</ul>\n<p>Gibt ein <code>String[]</code> zurück - Ein Array mit allen von der Zwischenablage unterstützten Formattypen <code>type</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> formats = clipboard.availableFormats()\n<span class=\"hljs-built_in\">console</span>.log(formats)\n<span class=\"hljs-comment\">// [ 'text/plain', 'text/html' ]</span>\n</code></pre>\n<h3 id=\"clipboardhasformat-type-experimentell\"><a href=\"#clipboardhasformat-type-experimentell\"><code>clipboard.has(format[, type])</code> <em>Experimentell</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> ist nur unter Linux verfügbar.</li>\n</ul>\n<p>Gibt einen <code>Boolean</code> zurück - Prüft, ob die Zwischenablage das angegebene <code>format</code> unterstützt.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> hasFormat = clipboard.has(<span class=\"hljs-string\">'&#x3C;p>selection&#x3C;/p>'</span>)\n<span class=\"hljs-built_in\">console</span>.log(hasFormat)\n<span class=\"hljs-comment\">// 'true' or 'false'</span>\n</code></pre>\n<h3 id=\"clipboardreadformat-experimentell\"><a href=\"#clipboardreadformat-experimentell\"><code>clipboard.read(format)</code> <em>Experimentell</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n</ul>\n<p>Gibt den <code>String</code> zurück - Liest den <code>format</code> Typ von der Zwischenablage.</p>\n<p><code>format</code> should contain valid ASCII characters and have <code>/</code> separator. <code>a/c</code>, <code>a/bc</code> are valid formats while <code>/abc</code>, <code>abc/</code>, <code>a/</code>, <code>/a</code>, <code>a</code> are not valid.</p>\n<h3 id=\"clipboardreadbufferformat-experimentell\"><a href=\"#clipboardreadbufferformat-experimentell\"><code>clipboard.readBuffer(format)</code> <em>Experimentell</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n</ul>\n<p>Gibt den <code>Buffer</code> zurück - Liest den <code>format</code> Typ von der Zwischenablage.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> buffer = Buffer.from(<span class=\"hljs-string\">'this is binary'</span>, <span class=\"hljs-string\">'utf8'</span>)\nclipboard.writeBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>, buffer)\n\n<span class=\"hljs-keyword\">const</span> ret = clipboard.readBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>)\n\n<span class=\"hljs-built_in\">console</span>.log(buffer.equals(out))\n<span class=\"hljs-comment\">// true</span>\n</code></pre>\n<h3 id=\"clipboardwritebufferformat-buffer-type-experimentell\"><a href=\"#clipboardwritebufferformat-buffer-type-experimentell\"><code>clipboard.writeBuffer(format, buffer[, type])</code> <em>Experimentell</em></a></h3>\n<ul>\n<li><code>format</code> String</li>\n<li><code>buffer</code> Puffer</li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> ist nur unter Linux verfügbar.</li>\n</ul>\n<p>Schreibt den <code>buffer</code> mit dem angegebenen <code>format</code> in die Zwischenablage.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> buffer = Buffer.from(<span class=\"hljs-string\">'writeBuffer'</span>, <span class=\"hljs-string\">'utf8'</span>)\nclipboard.writeBuffer(<span class=\"hljs-string\">'public/utf8-plain-text'</span>, buffer)\n</code></pre>\n<h3 id=\"clipboardwritedata-type\"><a href=\"#clipboardwritedata-type\"><code>clipboard.write(data[, type])</code></a></h3>\n<ul>\n<li><code>data</code> Object<ul>\n<li><code>text</code> String (optional)</li>\n<li><code>html</code> String (optional)</li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> (optional)</li>\n<li><code>rtf</code> String (optional)</li>\n<li><code>bookmark</code> String (optional) - The title of the URL at <code>text</code>.</li>\n</ul></li>\n<li><code>type</code> String (optional) - Can be <code>selection</code> or <code>clipboard</code>; default is 'clipboard'. <code>selection</code> ist nur unter Linux verfügbar.</li>\n</ul>\n<p>Schreibt <code>data</code> in die Zwischenablage.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { clipboard } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nclipboard.write({\n  <span class=\"hljs-attr\">text</span>: <span class=\"hljs-string\">'test'</span>,\n  <span class=\"hljs-attr\">html</span>: <span class=\"hljs-string\">'&#x3C;b>Hi&#x3C;/b>'</span>,\n  <span class=\"hljs-attr\">rtf</span>: <span class=\"hljs-string\">'{\\\\rtf1\\\\utf8 text}'</span>,\n  <span class=\"hljs-attr\">bookmark</span>: <span class=\"hljs-string\">'a title'</span>\n})\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readText())\n<span class=\"hljs-comment\">// 'test'</span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readHTML())\n<span class=\"hljs-comment\">// &#x3C;meta charset='utf-8'>&#x3C;b>Hi&#x3C;/b></span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readRTF())\n<span class=\"hljs-comment\">// '{\\\\rtf1\\\\utf8 text}'</span>\n\n<span class=\"hljs-built_in\">console</span>.log(clipboard.readBookmark())\n<span class=\"hljs-comment\">// { title: 'a title', url: 'test' }</span>\n</code></pre>",
      "title": "clipboard",
      "description": "Ausführung von Kopier- und Einfüge-Operationen von der Zwischenablage des Betriebssystems."
    },
    "/docs/tutorial/code-signing": {
      "locale": "de-DE",
      "slug": "code-signing",
      "href": "/docs/tutorial/code-signing",
      "crowdinFileId": "256183",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/code-signing.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"code-signierung\"><a href=\"#code-signierung\">Code Signierung</a></h1>\n<p>Code signing is a security technology that you use to certify that an app was created by you.</p>\n<p>On macOS the system can detect any change to the app, whether the change is introduced accidentally or by malicious code.</p>\n<p>On Windows, the system assigns a trust level to your code signing certificate which if you don't have, or if your trust level is low, will cause security dialogs to appear when users start using your application.  Trust level builds over time so it's better to start code signing as early as possible.</p>\n<p>While it is possible to distribute unsigned apps, it is not recommended. Both Windows and macOS will, by default, prevent either the download or the execution of unsigned applications. Starting with macOS Catalina (version 10.15), users have to go through multiple manual steps to open unsigned applications.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/gatekeeper.png\" alt=\"macOS Catalina Gatekeeper warning: The app cannot be opened because the\ndeveloper cannot be verified\"></p>\n<p>As you can see, users get two options: Move the app straight to the trash or cancel running it. You don't want your users to see that dialog.</p>\n<p>If you are building an Electron app that you intend to package and distribute, it should be code-signed.</p>\n<h1 id=\"signing--notarizing-macos-builds\"><a href=\"#signing--notarizing-macos-builds\">Signing &#x26; notarizing macOS builds</a></h1>\n<p>Properly preparing macOS applications for release requires two steps: First, the app needs to be code-signed. Then, the app needs to be uploaded to Apple for a process called \"notarization\", where automated systems will further verify that your app isn't doing anything to endanger its users.</p>\n<p>To start the process, ensure that you fulfill the requirements for signing and notarizing your app:</p>\n<ol>\n<li>Enroll in the <a href=\"https://developer.apple.com/programs/\">Apple Developer Program</a> (requires an annual fee)</li>\n<li>Download and install <a href=\"https://developer.apple.com/xcode\">Xcode</a> - this requires a computer running macOS</li>\n<li>Generate, download, and install <a href=\"https://github.com/electron/electron-osx-sign/wiki/1.-Getting-Started#certificates\">signing certificates</a></li>\n</ol>\n<p>Electron's ecosystem favors configuration and freedom, so there are multiple ways to get your application signed and notarized.</p>\n<h2 id=\"electron-forge\"><a href=\"#electron-forge\"><code>electron-forge</code></a></h2>\n<p>If you're using Electron's favorite build tool, getting your application signed and notarized requires a few additions to your configuration. <a href=\"https://electronforge.io\">Forge</a> is a collection of the official Electron tools, using <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>, <a href=\"https://github.com/electron-userland/electron-osx-sign\"><code>electron-osx-sign</code></a>, and <a href=\"https://github.com/electron/electron-notarize\"><code>electron-notarize</code></a> under the hood.</p>\n<p>Let's take a look at an example configuration with all required fields. Not all of them are required: the tools will be clever enough to automatically find a suitable <code>identity</code>, for instance, but we recommend that you are explicit.</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"my-app\"</span>,\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.0.1\"</span>,\n  <span class=\"hljs-attr\">\"config\"</span>: {\n    <span class=\"hljs-attr\">\"forge\"</span>: {\n      <span class=\"hljs-attr\">\"packagerConfig\"</span>: {\n        <span class=\"hljs-attr\">\"osxSign\"</span>: {\n          <span class=\"hljs-attr\">\"identity\"</span>: <span class=\"hljs-string\">\"Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)\"</span>,\n          <span class=\"hljs-attr\">\"hardened-runtime\"</span>: <span class=\"hljs-literal\">true</span>,\n          <span class=\"hljs-attr\">\"entitlements\"</span>: <span class=\"hljs-string\">\"entitlements.plist\"</span>,\n          <span class=\"hljs-attr\">\"entitlements-inherit\"</span>: <span class=\"hljs-string\">\"entitlements.plist\"</span>,\n          <span class=\"hljs-attr\">\"signature-flags\"</span>: <span class=\"hljs-string\">\"library\"</span>\n        },\n        <span class=\"hljs-attr\">\"osxNotarize\"</span>: {\n          <span class=\"hljs-attr\">\"appleId\"</span>: <span class=\"hljs-string\">\"felix@felix.fun\"</span>,\n          <span class=\"hljs-attr\">\"appleIdPassword\"</span>: <span class=\"hljs-string\">\"my-apple-id-password\"</span>,\n        }\n      }\n    }\n  }\n}\n</code></pre>\n<p>The <code>plist</code> file referenced here needs the following macOS-specific entitlements to assure the Apple security mechanisms that your app is doing these things without meaning any harm:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.allow-jit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.debugger<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>Note that up until Electron 12, the <code>com.apple.security.cs.allow-unsigned-executable-memory</code> entitlement was required as well. However, it should not be used anymore if it can be avoided.</p>\n<p>To see all of this in action, check out Electron Fiddle's source code, <a href=\"https://github.com/electron/fiddle/blob/master/forge.config.js\">especially its <code>electron-forge</code> configuration file</a>.</p>\n<p>If you plan to access the microphone or camera within your app using Electron's APIs, you'll also need to add the following entitlements:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.device.audio-input<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.device.camera<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>If these are not present in your app's entitlements when you invoke, for example:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> microphone = systemPreferences.askForMediaAccess(<span class=\"hljs-string\">'microphone'</span>)\n</code></pre>\n<p>Your app may crash. See the Resource Access section in <a href=\"https://developer.apple.com/documentation/security/hardened_runtime\">Hardened Runtime</a> for more information and entitlements you may need.</p>\n<h2 id=\"electron-builder\"><a href=\"#electron-builder\"><code>electron-builder</code></a></h2>\n<p>Electron Builder comes with a custom solution for signing your application. You can find <a href=\"https://www.electron.build/code-signing\">its documentation here</a>.</p>\n<h2 id=\"electron-packager\"><a href=\"#electron-packager\"><code>electron-packager</code></a></h2>\n<p>If you're not using an integrated build pipeline like Forge or Builder, you are likely using <a href=\"https://github.com/electron/electron-packager\"><code>electron-packager</code></a>, which includes <a href=\"https://github.com/electron-userland/electron-osx-sign\"><code>electron-osx-sign</code></a> and <a href=\"https://github.com/electron/electron-notarize\"><code>electron-notarize</code></a>.</p>\n<p>If you're using Packager's API, you can pass <a href=\"https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html\">in configuration that both signs and notarizes your application</a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> packager = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-packager'</span>)\n\npackager({\n  <span class=\"hljs-attr\">dir</span>: <span class=\"hljs-string\">'/path/to/my/app'</span>,\n  <span class=\"hljs-attr\">osxSign</span>: {\n    <span class=\"hljs-attr\">identity</span>: <span class=\"hljs-string\">'Developer ID Application: Felix Rieseberg (LT94ZKYDCJ)'</span>,\n    <span class=\"hljs-string\">'hardened-runtime'</span>: <span class=\"hljs-literal\">true</span>,\n    <span class=\"hljs-attr\">entitlements</span>: <span class=\"hljs-string\">'entitlements.plist'</span>,\n    <span class=\"hljs-string\">'entitlements-inherit'</span>: <span class=\"hljs-string\">'entitlements.plist'</span>,\n    <span class=\"hljs-string\">'signature-flags'</span>: <span class=\"hljs-string\">'library'</span>\n  },\n  <span class=\"hljs-attr\">osxNotarize</span>: {\n    <span class=\"hljs-attr\">appleId</span>: <span class=\"hljs-string\">'felix@felix.fun'</span>,\n    <span class=\"hljs-attr\">appleIdPassword</span>: <span class=\"hljs-string\">'my-apple-id-password'</span>\n  }\n})\n</code></pre>\n<p>The <code>plist</code> file referenced here needs the following macOS-specific entitlements to assure the Apple security mechanisms that your app is doing these things without meaning any harm:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.allow-jit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.cs.debugger<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>Up until Electron 12, the <code>com.apple.security.cs.allow-unsigned-executable-memory</code> entitlement was required as well. However, it should not be used anymore if it can be avoided.</p>\n<h2 id=\"mac-app-store\"><a href=\"#mac-app-store\">Mac App Store</a></h2>\n<p>See the <a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store Guide</a>.</p>\n<h1 id=\"signing-windows-builds\"><a href=\"#signing-windows-builds\">Signing Windows builds</a></h1>\n<p>Before signing Windows builds, you must do the following:</p>\n<ol>\n<li>Get a Windows Authenticode code signing certificate (requires an annual fee)</li>\n<li>Install Visual Studio to get the signing utility (the free <a href=\"https://visualstudio.microsoft.com/vs/community/\">Community Edition</a> is enough)</li>\n</ol>\n<p>You can get a code signing certificate from a lot of resellers. Prices vary, so it may be worth your time to shop around. Popular resellers include:</p>\n<ul>\n<li><a href=\"https://www.digicert.com/code-signing/microsoft-authenticode.htm\">digicert</a></li>\n<li><a href=\"https://sectigo.com/ssl-certificates-tls/code-signing\">Sectigo</a></li>\n<li>Amongst others, please shop around to find one that suits your needs, Google is your friend 😄</li>\n</ul>\n<p>There are a number of tools for signing your packaged app:</p>\n<ul>\n<li><a href=\"https://github.com/electron/windows-installer\"><code>electron-winstaller</code></a> will generate an installer for windows and sign it for you</li>\n<li><a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a> can sign installers it generates through the Squirrel.Windows or MSI targets.</li>\n<li><a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> can sign some of its windows targets</li>\n</ul>\n<h2 id=\"windows-store\"><a href=\"#windows-store\">Windows Store</a></h2>\n<p>See the <a href=\"/docs/tutorial/windows-store-guide\">Windows Store Guide</a>.</p>",
      "title": "Code Signierung",
      "description": ""
    },
    "/docs/development/coding-style": {
      "locale": "de-DE",
      "slug": "coding-style",
      "href": "/docs/development/coding-style",
      "crowdinFileId": "256147",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/coding-style.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"coding-style\"><a href=\"#coding-style\">Coding Style</a></h1>\n<p>These are the style guidelines for coding in Electron.</p>\n<p>You can run <code>npm run lint</code> to show any style issues detected by <code>cpplint</code> and <code>eslint</code>.</p>\n<h2 id=\"general-code\"><a href=\"#general-code\">General Code</a></h2>\n<ul>\n<li>End files with a newline.</li>\n<li>Place requires in the following order:<ul>\n<li>Built in Node Modules (such as <code>path</code>)</li>\n<li>Built in Electron Modules (such as <code>ipc</code>, <code>app</code>)</li>\n<li>Local Modules (using relative paths)</li>\n</ul></li>\n<li>Place class properties in the following order:<ul>\n<li>Class methods and properties (methods starting with a <code>@</code>)</li>\n<li>Instance methods and properties</li>\n</ul></li>\n<li>Avoid platform-dependent code:<ul>\n<li>Use <code>path.join()</code> to concatenate filenames.</li>\n<li>Use <code>os.tmpdir()</code> rather than <code>/tmp</code> when you need to reference the temporary directory.</li>\n</ul></li>\n<li>Using a plain <code>return</code> when returning explicitly at the end of a function.<ul>\n<li>Not <code>return null</code>, <code>return undefined</code>, <code>null</code> or <code>undefined</code></li>\n</ul></li>\n</ul>\n<h2 id=\"c-and-python\"><a href=\"#c-and-python\">C++ and Python</a></h2>\n<p>For C++ and Python, we follow Chromium's <a href=\"https://chromium.googlesource.com/chromium/src/+/refs/heads/main/styleguide/styleguide.md\">Coding Style</a>. You can use <a href=\"/docs/development/clang-format\">clang-format</a> to format the C++ code automatically. There is also a script <code>script/cpplint.py</code> to check whether all files conform.</p>\n<p>The Python version we are using now is Python 2.7.</p>\n<p>The C++ code uses a lot of Chromium's abstractions and types, so it's recommended to get acquainted with them. A good place to start is Chromium's <a href=\"https://www.chromium.org/developers/coding-style/important-abstractions-and-data-structures\">Important Abstractions and Data Structures</a> document. The document mentions some special types, scoped types (that automatically release their memory when going out of scope), logging mechanisms etc.</p>\n<h2 id=\"dokumentation\"><a href=\"#dokumentation\">Dokumentation</a></h2>\n<ul>\n<li>Write <a href=\"https://github.com/remarkjs/remark\">remark</a> markdown style.</li>\n</ul>\n<p>You can run <code>npm run lint-docs</code> to ensure that your documentation changes are formatted correctly.</p>\n<h2 id=\"javascript\"><a href=\"#javascript\">JavaScript</a></h2>\n<ul>\n<li>Write <a href=\"https://www.npmjs.com/package/standard\">standard</a> JavaScript style.</li>\n<li>File names should be concatenated with <code>-</code> instead of <code>_</code>, e.g. <code>file-name.js</code> rather than <code>file_name.js</code>, because in <a href=\"https://github.com/github/atom\">github/atom</a> module names are usually in the <code>module-name</code> form. This rule only applies to <code>.js</code> files.</li>\n<li>Use newer ES6/ES2015 syntax where appropriate<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const\"><code>const</code></a> for requires and other constants.  If the value is a primitive, use uppercase naming (eg <code>const NUMBER_OF_RETRIES = 5</code>).</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let\"><code>let</code></a> for defining variables</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions\">Arrow functions</a> instead of <code>function () { }</code></li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals\">Template literals</a> instead of string concatenation using <code>+</code></li>\n</ul></li>\n</ul>\n<h2 id=\"naming-things\"><a href=\"#naming-things\">Naming Things</a></h2>\n<p>Electron APIs uses the same capitalization scheme as Node.js:</p>\n<ul>\n<li>When the module itself is a class like <code>BrowserWindow</code>, use <code>PascalCase</code>.</li>\n<li>When the module is a set of APIs, like <code>globalShortcut</code>, use <code>camelCase</code>.</li>\n<li>When the API is a property of object, and it is complex enough to be in a separate chapter like <code>win.webContents</code>, use <code>mixedCase</code>.</li>\n<li>For other non-module APIs, use natural titles, like <code>&#x3C;webview> Tag</code> or <code>Process Object</code>.</li>\n</ul>\n<p>When creating a new API, it is preferred to use getters and setters instead of jQuery's one-function style. For example, <code>.getText()</code> and <code>.setText(text)</code> are preferred to <code>.text([text])</code>. There is a <a href=\"https://github.com/electron/electron/issues/46\">discussion</a> on this.</p>",
      "title": "Coding Style",
      "description": ""
    },
    "/docs/api/command-line": {
      "locale": "de-DE",
      "slug": "command-line",
      "href": "/docs/api/command-line",
      "crowdinFileId": "256295",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/command-line.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-commandline\"><a href=\"#class-commandline\">Class: CommandLine</a></h2>\n<blockquote>\n<p>Manipulate the command line arguments for your app that Chromium reads</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>The following example shows how to check if the <code>--disable-gpu</code> flag is set.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.hasSwitch(<span class=\"hljs-string\">'disable-gpu'</span>)\n</code></pre>\n<p>For more information on what kinds of flags and switches you can use, check out the <a href=\"/docs/api/command-line-switches\">Command Line Switches</a> document.</p>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<h4 id=\"commandlineappendswitchswitch-value\"><a href=\"#commandlineappendswitchswitch-value\"><code>commandLine.appendSwitch(switch[, value])</code></a></h4>\n<ul>\n<li><code>switch</code> String - A command-line switch, without the leading <code>--</code></li>\n<li><code>value</code> String (optional) - A value for the given switch</li>\n</ul>\n<p>Append a switch (with optional <code>value</code>) to Chromium's command line.</p>\n<p><strong>Note:</strong> This will not affect <code>process.argv</code>. The intended usage of this function is to control Chromium's behavior.</p>\n<h4 id=\"commandlineappendargumentvalue\"><a href=\"#commandlineappendargumentvalue\"><code>commandLine.appendArgument(value)</code></a></h4>\n<ul>\n<li><code>value</code> String - The argument to append to the command line</li>\n</ul>\n<p>Append an argument to Chromium's command line. The argument will be quoted correctly. Switches will precede arguments regardless of appending order.</p>\n<p>If you're appending an argument like <code>--switch=value</code>, consider using <code>appendSwitch('switch', 'value')</code> instead.</p>\n<p><strong>Note:</strong> This will not affect <code>process.argv</code>. The intended usage of this function is to control Chromium's behavior.</p>\n<h4 id=\"commandlinehasswitchswitch\"><a href=\"#commandlinehasswitchswitch\"><code>commandLine.hasSwitch(switch)</code></a></h4>\n<ul>\n<li><code>switch</code> String - A command-line switch</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the command-line switch is present.</p>\n<h4 id=\"commandlinegetswitchvalueswitch\"><a href=\"#commandlinegetswitchvalueswitch\"><code>commandLine.getSwitchValue(switch)</code></a></h4>\n<ul>\n<li><code>switch</code> String - A command-line switch</li>\n</ul>\n<p>Returns <code>String</code> - The command-line switch value.</p>\n<p><strong>Note:</strong> When the switch is not present or has no value, it returns empty string.</p>",
      "title": "CommandLine",
      "description": "Manipulate the command line arguments for your app that Chromium reads"
    },
    "/docs/api/command-line-switches": {
      "locale": "de-DE",
      "slug": "command-line-switches",
      "href": "/docs/api/command-line-switches",
      "crowdinFileId": "256293",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/command-line-switches.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"supported-command-line-switches\"><a href=\"#supported-command-line-switches\">Supported Command Line Switches</a></h1>\n<blockquote>\n<p>Befehlszeilenoptionen unterstützt von Electron.</p>\n</blockquote>\n<p><a href=\"/docs/api/command-line#commandlineappendswitchswitch-value\">app.commandLine.appendSwitch</a> kann benutzt werden um die Befehlszeilenoptionen zu dem Hauptskript der App, bevor das <a href=\"/docs/api/app#event-ready\">ready</a>-Ereignis des <a href=\"/docs/api/app\">app</a>-Moduls eintritt, hinzuzufügen:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'remote-debugging-port'</span>, <span class=\"hljs-string\">'8315'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'host-rules'</span>, <span class=\"hljs-string\">'MAP * 127.0.0.1'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Your code here</span>\n})\n</code></pre>\n<h2 id=\"electron-cli-flags\"><a href=\"#electron-cli-flags\">Electron CLI Flags</a></h2>\n<h3 id=\"--auth-server-whitelisturl\"><a href=\"#--auth-server-whitelisturl\">--auth-server-whitelist=<code>url</code></a></h3>\n<p>A comma-separated list of servers for which integrated authentication is enabled.</p>\n<p>Ein Beispiel:</p>\n<pre><code class=\"hljs language-sh\">--auth-server-whitelist=<span class=\"hljs-string\">'*example.com, *foobar.com, *baz'</span>\n</code></pre>\n<p>then any <code>url</code> ending with <code>example.com</code>, <code>foobar.com</code>, <code>baz</code> will be considered for integrated authentication. Without <code>*</code> prefix the URL has to match exactly.</p>\n<h3 id=\"--auth-negotiate-delegate-whitelisturl\"><a href=\"#--auth-negotiate-delegate-whitelisturl\">--auth-negotiate-delegate-whitelist=<code>url</code></a></h3>\n<p>A comma-separated list of servers for which delegation of user credentials is required. Without <code>*</code> prefix the URL has to match exactly.</p>\n<h3 id=\"--disable-ntlm-v2\"><a href=\"#--disable-ntlm-v2\">--disable-ntlm-v2</a></h3>\n<p>Disables NTLM v2 for posix platforms, no effect elsewhere.</p>\n<h3 id=\"--disable-http-cache\"><a href=\"#--disable-http-cache\">--disable-http-cache</a></h3>\n<p>Disables the disk cache for HTTP requests.</p>\n<h3 id=\"--disable-http2\"><a href=\"#--disable-http2\">--disable-http2</a></h3>\n<p>Disable HTTP/2 and SPDY/3.1 protocols.</p>\n<h3 id=\"--disable-renderer-backgrounding\"><a href=\"#--disable-renderer-backgrounding\">--disable-renderer-backgrounding</a></h3>\n<p>Prevents Chromium from lowering the priority of invisible pages' renderer processes.</p>\n<p>This flag is global to all renderer processes, if you only want to disable throttling in one window, you can take the hack of <a href=\"https://github.com/atom/atom/pull/9485/files\">playing silent audio</a>.</p>\n<h3 id=\"--disk-cache-sizesize\"><a href=\"#--disk-cache-sizesize\">--disk-cache-size=<code>size</code></a></h3>\n<p>Forces the maximum disk space to be used by the disk cache, in bytes.</p>\n<h3 id=\"--enable-api-filtering-logging\"><a href=\"#--enable-api-filtering-logging\">--enable-api-filtering-logging</a></h3>\n<p>Enables caller stack logging for the following APIs (filtering events):</p>\n<ul>\n<li><code>desktopCapturer.getSources()</code> / <code>desktop-capturer-get-sources</code></li>\n</ul>\n<h3 id=\"--enable-loggingfile\"><a href=\"#--enable-loggingfile\">--enable-logging[=file]</a></h3>\n<p>Prints Chromium's logging to stderr (or a log file).</p>\n<p>The <code>ELECTRON_ENABLE_LOGGING</code> environment variable has the same effect as passing <code>--enable-logging</code>.</p>\n<p>Passing <code>--enable-logging</code> will result in logs being printed on stderr. Passing <code>--enable-logging=file</code> will result in logs being saved to the file specified by <code>--log-file=...</code>, or to <code>electron_debug.log</code> in the user-data directory if <code>--log-file</code> is not specified.</p>\n<blockquote>\n<p><strong>Note:</strong> On Windows, logs from child processes cannot be sent to stderr. Logging to a file is the most reliable way to collect logs on Windows.</p>\n</blockquote>\n<p>See also <code>--log-file</code>, <code>--log-level</code>, <code>--v</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--force-fieldtrialstrials\"><a href=\"#--force-fieldtrialstrials\">--force-fieldtrials=<code>trials</code></a></h3>\n<p>Feldversuche, die zwangsweise aktiviert oder deaktiviert werden können.</p>\n<p>Zum Beispiel: <code>WebRTC-Audio-Red-For-Opus/Enabled/</code></p>\n<h3 id=\"--host-rulesrules\"><a href=\"#--host-rulesrules\">--host-rules=<code>rules</code></a></h3>\n<p>A comma-separated list of <code>rules</code> that control how hostnames are mapped.</p>\n<p>Ein Beispiel:</p>\n<ul>\n<li><code>MAP * 127.0.0.1</code> Forces all hostnames to be mapped to 127.0.0.1</li>\n<li><code>MAP *.google.com proxy</code> Forces all google.com subdomains to be resolved to \"proxy\".</li>\n<li><code>MAP test.com [::1]:77</code> Forces \"test.com\" to resolve to IPv6 loopback. Will also force the port of the resulting socket address to be 77.</li>\n<li><code>MAP * baz, EXCLUDE www.google.com</code> Remaps everything to \"baz\", except for \"www.google.com\".</li>\n</ul>\n<p>These mappings apply to the endpoint host in a net request (the TCP connect and host resolver in a direct connection, and the <code>CONNECT</code> in an HTTP proxy connection, and the endpoint host in a <code>SOCKS</code> proxy connection).</p>\n<h3 id=\"--host-resolver-rulesrules\"><a href=\"#--host-resolver-rulesrules\">--host-resolver-rules=<code>rules</code></a></h3>\n<p>Like <code>--host-rules</code> but these <code>rules</code> only apply to the host resolver.</p>\n<h3 id=\"--ignore-certificate-errors\"><a href=\"#--ignore-certificate-errors\">--ignore-certificate-errors</a></h3>\n<p>Ignores certificate related errors.</p>\n<h3 id=\"--ignore-connections-limitdomains\"><a href=\"#--ignore-connections-limitdomains\">--ignore-connections-limit=<code>domains</code></a></h3>\n<p>Ignore the connections limit for <code>domains</code> list separated by <code>,</code>.</p>\n<h3 id=\"--js-flagsflags\"><a href=\"#--js-flagsflags\">--js-flags=<code>flags</code></a></h3>\n<p>Specifies the flags passed to the Node.js engine. It has to be passed when starting Electron if you want to enable the <code>flags</code> in the main process.</p>\n<pre><code class=\"hljs language-sh\">$ electron --js-flags=<span class=\"hljs-string\">\"--harmony_proxies --harmony_collections\"</span> your-app\n</code></pre>\n<p>See the <a href=\"https://nodejs.org/api/cli.html\">Node.js documentation</a> or run <code>node --help</code> in your terminal for a list of available flags. Additionally, run <code>node --v8-options</code> to see a list of flags that specifically refer to Node.js's V8 JavaScript engine.</p>\n<h3 id=\"--lang\"><a href=\"#--lang\">--lang</a></h3>\n<p>Set a custom locale.</p>\n<h3 id=\"--log-filepath\"><a href=\"#--log-filepath\">--log-file=<code>path</code></a></h3>\n<p>If <code>--enable-logging</code> is specified, logs will be written to the given path. The parent directory must exist.</p>\n<p>Setting the <code>ELECTRON_LOG_FILE</code> environment variable is equivalent to passing this flag. If both are present, the command-line switch takes precedence.</p>\n<h3 id=\"--log-net-logpath\"><a href=\"#--log-net-logpath\">--log-net-log=<code>path</code></a></h3>\n<p>Enables net log events to be saved and writes them to <code>path</code>.</p>\n<h3 id=\"--log-leveln\"><a href=\"#--log-leveln\">--log-level=<code>N</code></a></h3>\n<p>Sets the verbosity of logging when used together with <code>--enable-logging</code>. <code>N</code> should be one of <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h?q=logging::LogSeverity&#x26;ss=chromium\">Chrome's LogSeverities</a>.</p>\n<p>Note that two complimentary logging mechanisms in Chromium -- <code>LOG()</code> and <code>VLOG()</code> -- are controlled by different switches. <code>--log-level</code> controls <code>LOG()</code> messages, while <code>--v</code> and <code>--vmodule</code> control <code>VLOG()</code> messages. So you may want to use a combination of these three switches depending on the granularity you want and what logging calls are made by the code you're trying to watch.</p>\n<p>See <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h\">Chromium Logging source</a> for more information on how <code>LOG()</code> and <code>VLOG()</code> interact. Loosely speaking, <code>VLOG()</code> can be thought of as sub-levels / per-module levels inside <code>LOG(INFO)</code> to control the firehose of <code>LOG(INFO)</code> data.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, <code>--v</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--no-proxy-server\"><a href=\"#--no-proxy-server\">--no-proxy-server</a></h3>\n<p>Don't use a proxy server and always make direct connections. Overrides any other proxy server flags that are passed.</p>\n<h3 id=\"--no-sandbox\"><a href=\"#--no-sandbox\">--no-sandbox</a></h3>\n<p>Disables the Chromium <a href=\"https://www.chromium.org/developers/design-documents/sandbox\">sandbox</a>. Forces renderer process and Chromium helper processes to run un-sandboxed. Should only be used for testing.</p>\n<h3 id=\"--proxy-bypass-listhosts\"><a href=\"#--proxy-bypass-listhosts\">--proxy-bypass-list=<code>hosts</code></a></h3>\n<p>Instructs Electron to bypass the proxy server for the given semi-colon-separated list of hosts. This flag has an effect only if used in tandem with <code>--proxy-server</code>.</p>\n<p>Ein Beispiel:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'proxy-bypass-list'</span>, <span class=\"hljs-string\">'&#x3C;local>;*.google.com;*foo.com;1.2.3.4:5678'</span>)\n</code></pre>\n<p>Will use the proxy server for all hosts except for local addresses (<code>localhost</code>, <code>127.0.0.1</code> etc.), <code>google.com</code> subdomains, hosts that contain the suffix <code>foo.com</code> and anything at <code>1.2.3.4:5678</code>.</p>\n<h3 id=\"--proxy-pac-urlurl\"><a href=\"#--proxy-pac-urlurl\">--proxy-pac-url=<code>url</code></a></h3>\n<p>Uses the PAC script at the specified <code>url</code>.</p>\n<h3 id=\"--proxy-serveraddressport\"><a href=\"#--proxy-serveraddressport\">--proxy-server=<code>address:port</code></a></h3>\n<p>Use a specified proxy server, which overrides the system setting. This switch only affects requests with HTTP protocol, including HTTPS and WebSocket requests. It is also noteworthy that not all proxy servers support HTTPS and WebSocket requests. The proxy URL does not support username and password authentication <a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=615947\">per Chromium issue</a>.</p>\n<h3 id=\"--remote-debugging-portport\"><a href=\"#--remote-debugging-portport\">--remote-debugging-port=<code>port</code></a></h3>\n<p>Enables remote debugging over HTTP on the specified <code>port</code>.</p>\n<h3 id=\"--vlog_level\"><a href=\"#--vlog_level\">--v=<code>log_level</code></a></h3>\n<p>Gives the default maximal active V-logging level; 0 is the default. Normally positive values are used for V-logging levels.</p>\n<p>This switch only works when <code>--enable-logging</code> is also passed.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, and <code>--vmodule</code>.</p>\n<h3 id=\"--vmodulepattern\"><a href=\"#--vmodulepattern\">--vmodule=<code>pattern</code></a></h3>\n<p>Gives the per-module maximal V-logging levels to override the value given by <code>--v</code>. z.B. <code>my_module=2,foo*=3</code> would change the logging level for all code in source files <code>my_module.*</code> and <code>foo*.*</code>.</p>\n<p>Any pattern containing a forward or backward slash will be tested against the whole pathname and not only the module. z.B. <code>*/foo/bar/*=2</code> would change the logging level for all code in the source files under a <code>foo/bar</code> directory.</p>\n<p>This switch only works when <code>--enable-logging</code> is also passed.</p>\n<p>See also <code>--enable-logging</code>, <code>--log-level</code>, and <code>--v</code>.</p>\n<h3 id=\"--force_high_performance_gpu\"><a href=\"#--force_high_performance_gpu\">--force_high_performance_gpu</a></h3>\n<p>Force using discrete GPU when there are multiple GPUs available.</p>\n<h3 id=\"--force_low_power_gpu\"><a href=\"#--force_low_power_gpu\">--force_low_power_gpu</a></h3>\n<p>Force using integrated GPU when there are multiple GPUs available.</p>\n<h2 id=\"nodejs-flags\"><a href=\"#nodejs-flags\">Node.js Flags</a></h2>\n<p>Electron supports some of the <a href=\"https://nodejs.org/api/cli.html\">CLI flags</a> supported by Node.js.</p>\n<p><strong>Note:</strong> Passing unsupported command line switches to Electron when it is not running in <code>ELECTRON_RUN_AS_NODE</code> will have no effect.</p>\n<h3 id=\"--inspect-brkhostport\"><a href=\"#--inspect-brkhostport\">--inspect-brk[=[host:]port]</a></h3>\n<p>Activate inspector on host:port and break at start of user script. Default host:port is 127.0.0.1:9229.</p>\n<p>Aliased to <code>--debug-brk=[host:]port</code>.</p>\n<h3 id=\"--inspect-porthostport\"><a href=\"#--inspect-porthostport\">--inspect-port=[host:]port</a></h3>\n<p>Set the <code>host:port</code> to be used when the inspector is activated. Useful when activating the inspector by sending the SIGUSR1 signal. Default host is <code>127.0.0.1</code>.</p>\n<p>Aliased to <code>--debug-port=[host:]port</code>.</p>\n<h3 id=\"--inspecthostport\"><a href=\"#--inspecthostport\">--inspect[=[host:]port]</a></h3>\n<p>Activate inspector on <code>host:port</code>. Standard ist <code>127.0.0.1:9229</code>.</p>\n<p>V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug and profile Electron instances. The tools attach to Electron instances via a TCP port and communicate using the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">Chrome DevTools Protocol</a>.</p>\n<p>See the <a href=\"/docs/tutorial/debugging-main-process\">Debugging the Main Process</a> guide for more details.</p>\n<p>Aliased to <code>--debug[=[host:]port</code>.</p>\n<h3 id=\"--inspect-publish-uidstderrhttp\"><a href=\"#--inspect-publish-uidstderrhttp\">--inspect-publish-uid=stderr,http</a></h3>\n<p>Specify ways of the inspector web socket url exposure.</p>\n<p>By default inspector websocket url is available in stderr and under /json/list endpoint on <a href=\"http://host:port/json/list\">http://host:port/json/list</a>.</p>",
      "title": "Supported Command Line Switches",
      "description": "Befehlszeilenoptionen unterstützt von Electron."
    },
    "/docs/api/content-tracing": {
      "locale": "de-DE",
      "slug": "content-tracing",
      "href": "/docs/api/content-tracing",
      "crowdinFileId": "256297",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/content-tracing.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"contenttracing\"><a href=\"#contenttracing\">contentTracing</a></h1>\n<blockquote>\n<p>Collect tracing data from Chromium to find performance bottlenecks and slow operations.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p>This module does not include a web interface. To view recorded traces, use <a href=\"https://chromium.googlesource.com/catapult/+/HEAD/tracing/README.md\">trace viewer</a>, available at <code>chrome://tracing</code> in Chrome.</p>\n<p><strong>Note:</strong> You should not use this module until the <code>ready</code> event of the app module is emitted.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, contentTracing } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  (<span class=\"hljs-keyword\">async</span> () => {\n    <span class=\"hljs-keyword\">await</span> contentTracing.startRecording({\n      <span class=\"hljs-attr\">included_categories</span>: [<span class=\"hljs-string\">'*'</span>]\n    })\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Tracing started'</span>)\n    <span class=\"hljs-keyword\">await</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> setTimeout(resolve, <span class=\"hljs-number\">5000</span>))\n    <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> contentTracing.stopRecording()\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Tracing data recorded to '</span> + path)\n  })()\n})\n</code></pre>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das Modul <code>contentTracing</code> verfügt über die folgenden Methoden:</p>\n<h3 id=\"contenttracinggetcategories\"><a href=\"#contenttracinggetcategories\"><code>contentTracing.getCategories()</code></a></h3>\n<p>Returns <code>Promise&#x3C;String[]></code> - resolves with an array of category groups once all child processes have acknowledged the <code>getCategories</code> request</p>\n<p>Get a set of category groups. The category groups can change as new code paths are reached. See also the <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">list of built-in tracing categories</a>.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Electron adds a non-default tracing category called <code>\"electron\"</code>. This category can be used to capture Electron-specific tracing events.</p>\n</blockquote>\n<h3 id=\"contenttracingstartrecordingoptions\"><a href=\"#contenttracingstartrecordingoptions\"><code>contentTracing.startRecording(options)</code></a></h3>\n<ul>\n<li><code>options</code> (<a href=\"/docs/api/structures/trace-config\">TraceConfig</a> | <a href=\"/docs/api/structures/trace-categories-and-options\">TraceCategoriesAndOptions</a>)</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolved once all child processes have acknowledged the <code>startRecording</code> request.</p>\n<p>Start recording on all processes.</p>\n<p>Recording begins immediately locally and asynchronously on child processes as soon as they receive the EnableRecording request.</p>\n<p>If a recording is already running, the promise will be immediately resolved, as only one trace operation can be in progress at a time.</p>\n<h3 id=\"contenttracingstoprecordingresultfilepath\"><a href=\"#contenttracingstoprecordingresultfilepath\"><code>contentTracing.stopRecording([resultFilePath])</code></a></h3>\n<ul>\n<li><code>resultFilePath</code> String (optional)</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - resolves with a path to a file that contains the traced data once all child processes have acknowledged the <code>stopRecording</code> request</p>\n<p>Stop recording on all processes.</p>\n<p>Child processes typically cache trace data and only rarely flush and send trace data back to the main process. This helps to minimize the runtime overhead of tracing since sending trace data over IPC can be an expensive operation. So, to end tracing, Chromium asynchronously asks all child processes to flush any pending trace data.</p>\n<p>Trace data will be written into <code>resultFilePath</code>. If <code>resultFilePath</code> is empty or not provided, trace data will be written to a temporary file, and the path will be returned in the promise.</p>\n<h3 id=\"contenttracinggettracebufferusage\"><a href=\"#contenttracinggettracebufferusage\"><code>contentTracing.getTraceBufferUsage()</code></a></h3>\n<p>Returns <code>Promise&#x3C;Object></code> - Resolves with an object containing the <code>value</code> and <code>percentage</code> of trace buffer maximum usage</p>\n<ul>\n<li><code>value</code> Number</li>\n<li><code>percentage</code> Number</li>\n</ul>\n<p>Get the maximum usage across processes of trace buffer as a percentage of the full state.</p>",
      "title": "contentTracing",
      "description": "Collect tracing data from Chromium to find performance bottlenecks and slow operations."
    },
    "/docs/api/context-bridge": {
      "locale": "de-DE",
      "slug": "context-bridge",
      "href": "/docs/api/context-bridge",
      "crowdinFileId": "256299",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/context-bridge.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"kontextbridge\"><a href=\"#kontextbridge\">kontextBridge</a></h1>\n<blockquote>\n<p>Create a safe, bi-directional, synchronous bridge across isolated contexts</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>An example of exposing an API to a renderer from an isolated preload script is given below:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Preload (Isolated World)</span>\n<span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(\n  <span class=\"hljs-string\">'electron'</span>,\n  {\n    <span class=\"hljs-attr\">doThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.send(<span class=\"hljs-string\">'do-a-thing'</span>)\n  }\n)\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Renderer (Main World)</span>\n\n<span class=\"hljs-built_in\">window</span>.electron.doThing()\n</code></pre>\n<h2 id=\"glossar\"><a href=\"#glossar\">Glossar</a></h2>\n<h3 id=\"main-world\"><a href=\"#main-world\">Main World</a></h3>\n<p>The \"Main World\" is the JavaScript context that your main renderer code runs in. By default, the page you load in your renderer executes code in this world.</p>\n<h3 id=\"isolated-world\"><a href=\"#isolated-world\">Isolated World</a></h3>\n<p>When <code>contextIsolation</code> is enabled in your <code>webPreferences</code> (this is the default behavior since Electron 12.0.0), your <code>preload</code> scripts run in an \"Isolated World\".  You can read more about context isolation and what it affects in the <a href=\"/docs/tutorial/security#3-enable-context-isolation-for-remote-content\">security</a> docs.</p>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das <code>contextBridge</code> Modul hat folgende Methoden:</p>\n<h3 id=\"contextbridgeexposeinmainworldapikey-api\"><a href=\"#contextbridgeexposeinmainworldapikey-api\"><code>contextBridge.exposeInMainWorld(apiKey, api)</code></a></h3>\n<ul>\n<li><code>apiKey</code> String - The key to inject the API onto <code>window</code> with.  The API will be accessible on <code>window[apiKey]</code>.</li>\n<li><code>api</code> any - Your API, more information on what this API can be and how it works is available below.</li>\n</ul>\n<h2 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h2>\n<h3 id=\"api\"><a href=\"#api\">API</a></h3>\n<p>The <code>api</code> provided to <a href=\"#contextbridgeexposeinmainworldapikey-api\"><code>exposeInMainWorld</code></a> must be a <code>Function</code>, <code>String</code>, <code>Number</code>, <code>Array</code>, <code>Boolean</code>, or an object whose keys are strings and values are a <code>Function</code>, <code>String</code>, <code>Number</code>, <code>Array</code>, <code>Boolean</code>, or another nested object that meets the same conditions.</p>\n<p><code>Function</code> values are proxied to the other context and all other values are <strong>copied</strong> and <strong>frozen</strong>. Any data / primitives sent in the API become immutable and updates on either side of the bridge do not result in an update on the other side.</p>\n<p>An example of a complex API is shown below:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(\n  <span class=\"hljs-string\">'electron'</span>,\n  {\n    <span class=\"hljs-attr\">doThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.send(<span class=\"hljs-string\">'do-a-thing'</span>),\n    <span class=\"hljs-attr\">myPromises</span>: [<span class=\"hljs-built_in\">Promise</span>.resolve(), <span class=\"hljs-built_in\">Promise</span>.reject(<span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'whoops'</span>))],\n    <span class=\"hljs-attr\">anAsyncFunction</span>: <span class=\"hljs-keyword\">async</span> () => <span class=\"hljs-number\">123</span>,\n    <span class=\"hljs-attr\">data</span>: {\n      <span class=\"hljs-attr\">myFlags</span>: [<span class=\"hljs-string\">'a'</span>, <span class=\"hljs-string\">'b'</span>, <span class=\"hljs-string\">'c'</span>],\n      <span class=\"hljs-attr\">bootTime</span>: <span class=\"hljs-number\">1234</span>\n    },\n    <span class=\"hljs-attr\">nestedAPI</span>: {\n      <span class=\"hljs-attr\">evenDeeper</span>: {\n        <span class=\"hljs-attr\">youCanDoThisAsMuchAsYouWant</span>: {\n          <span class=\"hljs-attr\">fn</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ({\n            <span class=\"hljs-attr\">returnData</span>: <span class=\"hljs-number\">123</span>\n          })\n        }\n      }\n    }\n  }\n)\n</code></pre>\n<h3 id=\"api-functions\"><a href=\"#api-functions\">API Functions</a></h3>\n<p><code>Function</code> values that you bind through the <code>contextBridge</code> are proxied through Electron to ensure that contexts remain isolated.  This results in some key limitations that we've outlined below.</p>\n<h4 id=\"parameter--error--return-type-support\"><a href=\"#parameter--error--return-type-support\">Parameter / Error / Return Type support</a></h4>\n<p>Because parameters, errors and return values are <strong>copied</strong> when they are sent over the bridge, there are only certain types that can be used. At a high level, if the type you want to use can be serialized and deserialized into the same object it will work.  A table of type support has been included below for completeness:</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Typ</th><th>Complexity</th><th>Parameter Support</th><th>Return Value Support</th><th>Einschränkungen</th></tr></thead><tbody><tr><td><code>String</code></td><td>Simple</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Number</code></td><td>Simple</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Boolean</code></td><td>Simple</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Object</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Keys must be supported using only \"Simple\" types in this table.  Values must be supported in this table.  Prototype modifications are dropped.  Sending custom classes will copy values but not the prototype.</td></tr><tr><td><code>Array</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Same limitations as the <code>Object</code> type</td></tr><tr><td><code>Error</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Errors that are thrown are also copied, this can result in the message and stack trace of the error changing slightly due to being thrown in a different context</td></tr><tr><td><code>Promise</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Promises are only proxied if they are the return value or exact parameter.  Promises nested in arrays or objects will be dropped.</td></tr><tr><td><code>Funktion</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Prototype modifications are dropped.  Sending classes or constructors will not work.</td></tr><tr><td><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Cloneable Types</a></td><td>Simple</td><td>✅</td><td>✅</td><td>See the linked document on cloneable types</td></tr><tr><td><code>Element</code></td><td>Complex</td><td>✅</td><td>✅</td><td>Prototype modifications are dropped.  Sending custom elements will not work.</td></tr><tr><td><code>Blob</code></td><td>Complex</td><td>✅</td><td>✅</td><td>N/A</td></tr><tr><td><code>Symbol</code></td><td>N/A</td><td>❌</td><td>❌</td><td>Symbols cannot be copied across contexts so they are dropped</td></tr></tbody></table>\n<p>If the type you care about is not in the above table, it is probably not supported.</p>\n<h3 id=\"exposing-node-global-symbols\"><a href=\"#exposing-node-global-symbols\">Exposing Node Global Symbols</a></h3>\n<p>The <code>contextBridge</code> can be used by the preload script to give your renderer access to Node APIs. The table of supported types described above also applies to Node APIs that you expose through <code>contextBridge</code>. Please note that many Node APIs grant access to local system resources. Be very cautious about which globals and APIs you expose to untrusted remote content.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> crypto = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'crypto'</span>)\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'nodeCrypto'</span>, {\n  sha256sum (data) {\n    <span class=\"hljs-keyword\">const</span> hash = crypto.createHash(<span class=\"hljs-string\">'sha256'</span>)\n    hash.update(data)\n    <span class=\"hljs-keyword\">return</span> hash.digest(<span class=\"hljs-string\">'hex'</span>)\n  }\n})\n</code></pre>",
      "title": "kontextBridge",
      "description": "Create a safe, bi-directional, synchronous bridge across isolated contexts"
    },
    "/docs/tutorial/context-isolation": {
      "locale": "de-DE",
      "slug": "context-isolation",
      "href": "/docs/tutorial/context-isolation",
      "crowdinFileId": "256185",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/context-isolation.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"context-isolation\"><a href=\"#context-isolation\">Context Isolation</a></h1>\n<h2 id=\"what-is-it\"><a href=\"#what-is-it\">What is it?</a></h2>\n<p>Context Isolation is a feature that ensures that both your <code>preload</code> scripts and Electron's internal logic run in a separate context to the website you load in a <a href=\"/docs/api/web-contents\"><code>webContents</code></a>.  This is important for security purposes as it helps prevent the website from accessing Electron internals or the powerful APIs your preload script has access to.</p>\n<p>This means that the <code>window</code> object that your preload script has access to is actually a <strong>different</strong> object than the website would have access to.  For example, if you set <code>window.hello = 'wave'</code> in your preload script and context isolation is enabled, <code>window.hello</code> will be undefined if the website tries to access it.</p>\n<p>Context isolation has been enabled by default since Electron 12, and it is a recommended security setting for <em>all applications</em>.</p>\n<h2 id=\"migration\"><a href=\"#migration\">Migration</a></h2>\n<blockquote>\n<p>Without context isolation, I used to provide APIs from my preload script using <code>window.X = apiObject</code>. Now what?</p>\n</blockquote>\n<h3 id=\"before-context-isolation-disabled\"><a href=\"#before-context-isolation-disabled\">Before: context isolation disabled</a></h3>\n<p>Exposing APIs from your preload script to a loaded website in the renderer process is a common use-case. With context isolation disabled, your preload script would share a common global <code>window</code> object with the renderer. You could then attach arbitrary properties to a preload script:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// preload with contextIsolation disabled</span>\n<span class=\"hljs-built_in\">window</span>.myAPI = {\n  <span class=\"hljs-attr\">doAThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {}\n}\n</code></pre>\n<p>The <code>doAThing()</code> function could then be used directly in the renderer process:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// use the exposed API in the renderer</span>\n<span class=\"hljs-built_in\">window</span>.myAPI.doAThing()\n</code></pre>\n<h3 id=\"after-context-isolation-enabled\"><a href=\"#after-context-isolation-enabled\">After: context isolation enabled</a></h3>\n<p>There is a dedicated module in Electron to help you do this in a painless way. The <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> module can be used to <strong>safely</strong> expose APIs from your preload script's isolated context to the context the website is running in. The API will also be accessible from the website on <code>window.myAPI</code> just like it was before.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// preload with contextIsolation enabled</span>\n<span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">doAThing</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {}\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// use the exposed API in the renderer</span>\n<span class=\"hljs-built_in\">window</span>.myAPI.doAThing()\n</code></pre>\n<p>Please read the <code>contextBridge</code> documentation linked above to fully understand its limitations. For instance, you can't send custom prototypes or symbols over the bridge.</p>\n<h2 id=\"security-considerations\"><a href=\"#security-considerations\">Security considerations</a></h2>\n<p>Just enabling <code>contextIsolation</code> and using <code>contextBridge</code> does not automatically mean that everything you do is safe. For instance, this code is <strong>unsafe</strong>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// ❌ Bad code</span>\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">send</span>: ipcRenderer.send\n})\n</code></pre>\n<p>It directly exposes a powerful API without any kind of argument filtering. This would allow any website to send arbitrary IPC messages, which you do not want to be possible. The correct way to expose IPC-based APIs would instead be to provide one method per IPC message.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// ✅ Good code</span>\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">loadPreferences</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'load-prefs'</span>)\n})\n</code></pre>\n<h2 id=\"usage-with-typescript\"><a href=\"#usage-with-typescript\">Usage with TypeScript</a></h2>\n<p>If you're building your Electron app with TypeScript, you'll want to add types to your APIs exposed over the context bridge. The renderer's <code>window</code> object won't have the correct typings unless you extend the types with a <a href=\"https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html\">declaration file</a>.</p>\n<p>For example, given this <code>preload.ts</code> script:</p>\n<pre><code class=\"hljs language-typescript\">contextBridge.exposeInMainWorld(<span class=\"hljs-string\">'electronAPI'</span>, {\n  loadPreferences: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'load-prefs'</span>)\n})\n</code></pre>\n<p>You can create a <code>renderer.d.ts</code> declaration file and globally augment the <code>Window</code> interface:</p>\n<pre><code class=\"hljs language-typescript\"><span class=\"hljs-keyword\">export</span> <span class=\"hljs-keyword\">interface</span> IElectronAPI {\n  loadPreferences: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-built_in\">Promise</span>&#x3C;<span class=\"hljs-built_in\">void</span>>,\n}\n\n<span class=\"hljs-keyword\">declare</span> global {\n  <span class=\"hljs-keyword\">interface</span> Window {\n    electronAPI: IElectronAPI\n  }\n}\n</code></pre>\n<p>Doing so will ensure that the TypeScript compiler will know about the <code>electronAPI</code> property on your global <code>window</code> object when writing scripts in your renderer process:</p>\n<pre><code class=\"hljs language-typescript\"><span class=\"hljs-built_in\">window</span>.electronAPI.loadPreferences()\n</code></pre>",
      "title": "Context Isolation",
      "description": "Without context isolation, I used to provide APIs from my preload script using window.X = apiObject. Now what?"
    },
    "/docs/api/structures/cookie": {
      "locale": "de-DE",
      "slug": "cookie",
      "href": "/docs/api/structures/cookie",
      "crowdinFileId": "256417",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/cookie.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"cookie-object\"><a href=\"#cookie-object\">Cookie Object</a></h1>\n<ul>\n<li><code>name</code> String - The name of the cookie.</li>\n<li><code>value</code> String - The value of the cookie.</li>\n<li><code>domain</code> String (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains.</li>\n<li><code>hostOnly</code> Boolean (optional) - Whether the cookie is a host-only cookie; this will only be <code>true</code> if no domain was passed.</li>\n<li><code>path</code> String (optional) - The path of the cookie.</li>\n<li><code>secure</code> Boolean (optional) - Whether the cookie is marked as secure.</li>\n<li><code>httpOnly</code> Boolean (optional) - Whether the cookie is marked as HTTP only.</li>\n<li><code>session</code> Boolean (optional) - Whether the cookie is a session cookie or a persistent cookie with an expiration date.</li>\n<li><code>expirationDate</code> Double (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies.</li>\n<li><code>sameSite</code> String - The <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies\">Same Site</a> policy applied to this cookie.  Can be <code>unspecified</code>, <code>no_restriction</code>, <code>lax</code> or <code>strict</code>.</li>\n</ul>",
      "title": "Cookie Object",
      "description": ""
    },
    "/docs/api/cookies": {
      "locale": "de-DE",
      "slug": "cookies",
      "href": "/docs/api/cookies",
      "crowdinFileId": "256301",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/cookies.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-cookies\"><a href=\"#class-cookies\">Class: Cookies</a></h2>\n<blockquote>\n<p>Abfragen und modifizieren von Session Cookies.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Auf Instanzen der <code>Cookies-Klasse</code> wird über die Cookie-Eigenschaft einer Sitzung zugegriffen.</p>\n<p>Ein Beispiel:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Durchsuche all Cookies.</span>\nsession.defaultSession.cookies.get({})\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">cookies</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(cookies)\n  }).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">error</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(error)\n  })\n\n<span class=\"hljs-comment\">// Query all cookies associated with a specific url.</span>\nsession.defaultSession.cookies.get({ <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'http://www.github.com'</span> })\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">cookies</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(cookies)\n  }).catch(<span class=\"hljs-function\">(<span class=\"hljs-params\">error</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(error)\n  })\n\n<span class=\"hljs-comment\">// Set a cookie with the given cookie data;</span>\n<span class=\"hljs-comment\">// may overwrite equivalent cookies if they exist.</span>\n<span class=\"hljs-keyword\">const</span> cookie = { <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'http://www.github.com'</span>, <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'dummy_name'</span>, <span class=\"hljs-attr\">value</span>: <span class=\"hljs-string\">'dummy'</span> }\nsession.defaultSession.cookies.set(cookie)\n  .then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// success</span>\n  }, (error) => {\n    <span class=\"hljs-built_in\">console</span>.error(error)\n  })\n</code></pre>\n<h3 id=\"instanz-ereignisse\"><a href=\"#instanz-ereignisse\">Instanz-Ereignisse</a></h3>\n<p>The following events are available on instances of <code>Cookies</code>:</p>\n<h4 id=\"event-changed\"><a href=\"#event-changed\">Event: 'changed'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>cookie</code> <a href=\"/docs/api/structures/cookie\">Cookie</a> - The cookie that was changed.</li>\n<li><code>cause</code> String - The cause of the change with one of the following values:<ul>\n<li><code>explicit</code> - The cookie was changed directly by a consumer's action.</li>\n<li><code>overwrite</code> - The cookie was automatically removed due to an insert operation that overwrote it.</li>\n<li><code>expired</code> - The cookie was automatically removed as it expired.</li>\n<li><code>evicted</code> - The cookie was automatically evicted during garbage collection.</li>\n<li><code>expired-overwrite</code> - The cookie was overwritten with an already-expired expiration date.</li>\n</ul></li>\n<li><code>removed</code> Boolean - <code>true</code> if the cookie was removed, <code>false</code> otherwise.</li>\n</ul>\n<p>Emitted when a cookie is changed because it was added, edited, removed, or expired.</p>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<p>Die folgenden Methoden sind verfügbar in Instanzen von <code>Cookies</code>:</p>\n<h4 id=\"cookiesgetfilter\"><a href=\"#cookiesgetfilter\"><code>cookies.get(filter)</code></a></h4>\n<ul>\n<li><code>filter</code> Objekt<ul>\n<li><code>url</code> String (optional) - Retrieves cookies which are associated with <code>url</code>. Empty implies retrieving cookies of all URLs.</li>\n<li><code>name</code> String (optional) - Filters cookies by name.</li>\n<li><code>domain</code> String (optional) - Retrieves cookies whose domains match or are subdomains of <code>domains</code>.</li>\n<li><code>path</code> String (optional) - Retrieves cookies whose path matches <code>path</code>.</li>\n<li><code>secure</code> Boolean (optional) - Filters cookies by their Secure property.</li>\n<li><code>session</code> Boolean (optional) - Filters out session or persistent cookies.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Cookie[]></code> - A promise which resolves an array of cookie objects.</p>\n<p>Sends a request to get all cookies matching <code>filter</code>, and resolves a promise with the response.</p>\n<h4 id=\"cookiessetdetails\"><a href=\"#cookiessetdetails\"><code>cookies.set(details)</code></a></h4>\n<ul>\n<li><code>details</code> Objekt<ul>\n<li><code>url</code> String - The URL to associate the cookie with. The promise will be rejected if the URL is invalid.</li>\n<li><code>name</code> String (optional) - The name of the cookie. Empty by default if omitted.</li>\n<li><code>value</code> String (optional) - The value of the cookie. Empty by default if omitted.</li>\n<li><code>domain</code> String (optional) - Die Domain des Cookie; dies wird mit einem vorhergehenden Punkt normalisiert, so dass es auch für Subdomains gilt. Empty by default if omitted.</li>\n<li><code>path</code> String (optional) - Der Pfad des Cookie. Empty by default if omitted.</li>\n<li><code>secure</code> Boolean (optional) - Whether the cookie should be marked as Secure. Defaults to false unless <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite#samesitenone_requires_secure\">Same Site=None</a> attribute is used.</li>\n<li><code>httpOnly</code> Boolean (optional) - Whether the cookie should be marked as HTTP only. Der Standardwert ist false.</li>\n<li><code>expirationDate</code> Double (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted then the cookie becomes a session cookie and will not be retained between sessions.</li>\n<li><code>sameSite</code> String (optional) - The <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies\">Same Site</a> policy to apply to this cookie.  Sein Wert kann <code>nicht gesetzt </code>, <code>no_restriction</code>, <code>lax</code> oder <code>strict</code> sein.  Standard ist <code>no_restriction</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - A promise which resolves when the cookie has been set</p>\n<p>Sets a cookie with <code>details</code>.</p>\n<h4 id=\"cookiesremoveurl-name\"><a href=\"#cookiesremoveurl-name\"><code>cookies.remove(url, name)</code></a></h4>\n<ul>\n<li><code>url</code> String - The URL associated with the cookie.</li>\n<li><code>name</code> String - The name of cookie to remove.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - A promise which resolves when the cookie has been removed</p>\n<p>Removes the cookies matching <code>url</code> and <code>name</code></p>\n<h4 id=\"cookiesflushstore\"><a href=\"#cookiesflushstore\"><code>cookies.flushStore()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - A promise which resolves when the cookie store has been flushed</p>\n<p>Writes any unwritten cookies data to disk.</p>",
      "title": "Cookies",
      "description": "Abfragen und modifizieren von Session Cookies."
    },
    "/docs/api/structures/cpu-usage": {
      "locale": "de-DE",
      "slug": "cpu-usage",
      "href": "/docs/api/structures/cpu-usage",
      "crowdinFileId": "256419",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/cpu-usage.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"cpuusage-object\"><a href=\"#cpuusage-object\">CPUUsage Object</a></h1>\n<ul>\n<li><code>percentCPUUsage</code> Number - Percentage of CPU used since the last call to getCPUUsage. First call returns 0.</li>\n<li><code>idleWakeupsPerSecond</code> Number - The number of average idle CPU wakeups per second since the last call to getCPUUsage. First call returns 0. Will always return 0 on Windows.</li>\n</ul>",
      "title": "CPUUsage Object",
      "description": ""
    },
    "/docs/api/structures/crash-report": {
      "locale": "de-DE",
      "slug": "crash-report",
      "href": "/docs/api/structures/crash-report",
      "crowdinFileId": "256421",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/crash-report.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"crashreport-object\"><a href=\"#crashreport-object\">CrashReport Object</a></h1>\n<ul>\n<li><code>date</code> Date</li>\n<li><code>id</code> Zeichenfolge</li>\n</ul>",
      "title": "CrashReport Object",
      "description": ""
    },
    "/docs/api/crash-reporter": {
      "locale": "de-DE",
      "slug": "crash-reporter",
      "href": "/docs/api/crash-reporter",
      "crowdinFileId": "256303",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/crash-reporter.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"crashreporter\"><a href=\"#crashreporter\">crashReporter</a></h1>\n<blockquote>\n<p>Bestätige Crash Reports zu einem Remote Server</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>The following is an example of setting up Electron to automatically submit crash reports to a remote server:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { crashReporter } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncrashReporter.start({ <span class=\"hljs-attr\">submitURL</span>: <span class=\"hljs-string\">'https://your-domain.com/url-to-submit'</span> })\n</code></pre>\n<p>Zum einrichten eines Servers, zum aktzeptieren und verarbeiten von Crash Reports, können sie folgenden Projekte verwenden:</p>\n<ul>\n<li><a href=\"https://github.com/mozilla/socorro\">socorro</a></li>\n<li><a href=\"https://github.com/electron/mini-breakpad-server\">mini-breakpad-server</a></li>\n</ul>\n<p>Or use a 3rd party hosted solution:</p>\n<ul>\n<li><a href=\"https://backtrace.io/electron/\">Backtrace</a></li>\n<li><a href=\"https://docs.sentry.io/clients/electron\">Sentry</a></li>\n<li><a href=\"https://www.bugsplat.com/docs/platforms/electron\">BugSplat</a></li>\n</ul>\n<p>Crash reports are stored temporarily before being uploaded in a directory underneath the app's user data directory (called 'Crashpad' on Windows and Mac, or 'Crash Reports' on Linux). You can override this directory by calling <code>app.setPath('crashDumps', '/path/to/crashes')</code> before starting the crash reporter.</p>\n<p>On Windows and macOS, Electron uses <a href=\"https://chromium.googlesource.com/crashpad/crashpad/+/master/README.md\">crashpad</a> to monitor and report crashes. On Linux, Electron uses <a href=\"https://chromium.googlesource.com/breakpad/breakpad/+/master/\">breakpad</a>. This is an implementation detail driven by Chromium, and it may change in future. In particular, crashpad is newer and will likely eventually replace breakpad on all platforms.</p>\n<h3 id=\"note-about-node-child-processes-on-linux\"><a href=\"#note-about-node-child-processes-on-linux\">Note about Node child processes on Linux</a></h3>\n<p>If you are using the Node.js <code>child_process</code> module and want to report crashes from those processes on Linux, there is an extra step you will need to take to properly initialize the crash reporter in the child process. This is not necessary on Mac or Windows, as those platforms use Crashpad, which automatically monitors child processes.</p>\n<p>Since <code>require('electron')</code> is not available in Node child processes, the following APIs are available on the <code>process</code> object in Node child processes. Note that, on Linux, each Node child process has its own separate instance of the breakpad crash reporter. This is dissimilar to renderer child processes, which have a \"stub\" breakpad reporter which returns information to the main process for reporting.</p>\n<h4 id=\"processcrashreporterstartoptions\"><a href=\"#processcrashreporterstartoptions\"><code>process.crashReporter.start(options)</code></a></h4>\n<p>See <a href=\"#crashreporterstartoptions\"><code>crashReporter.start()</code></a>.</p>\n<h4 id=\"processcrashreportergetparameters\"><a href=\"#processcrashreportergetparameters\"><code>process.crashReporter.getParameters()</code></a></h4>\n<p>See <a href=\"#crashreportergetparameters\"><code>crashReporter.getParameters()</code></a>.</p>\n<h4 id=\"processcrashreporteraddextraparameterkey-value\"><a href=\"#processcrashreporteraddextraparameterkey-value\"><code>process.crashReporter.addExtraParameter(key, value)</code></a></h4>\n<p>See <a href=\"#crashreporteraddextraparameterkey-value\"><code>crashReporter.addExtraParameter(key, value)</code></a>.</p>\n<h4 id=\"processcrashreporterremoveextraparameterkey\"><a href=\"#processcrashreporterremoveextraparameterkey\"><code>process.crashReporter.removeExtraParameter(key)</code></a></h4>\n<p>See <a href=\"#crashreporterremoveextraparameterkey\"><code>crashReporter.removeExtraParameter(key)</code></a>.</p>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das Modul <code>crashReporter</code> verfügt über die folgenden Methoden:</p>\n<h3 id=\"crashreporterstartoptions\"><a href=\"#crashreporterstartoptions\"><code>crashReporter.start(options)</code></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>submitURL</code> String (optional) - URL that crash reports will be sent to as POST. Required unless <code>uploadToServer</code> is <code>false</code>.</li>\n<li><code>productName</code> String (optional) - Defaults to <code>app.name</code>.</li>\n<li><code>companyName</code> String (optional) <em>Deprecated</em> - Deprecated alias for <code>{ globalExtra: { _companyName: ... } }</code>.</li>\n<li><code>uploadToServer</code> Boolean (optional) - Whether crash reports should be sent to the server. If false, crash reports will be collected and stored in the crashes directory, but not uploaded. Standard ist <code>true</code>.</li>\n<li><code>ignoreSystemCrashHandler</code> Boolean (optional) - If true, crashes generated in the main process will not be forwarded to the system crash handler. Standard ist <code>false</code>.</li>\n<li><code>rateLimit</code> Boolean (optional) <em>macOS</em> <em>Windows</em> - If true, limit the number of crashes uploaded to 1/hour. Standard ist <code>false</code>.</li>\n<li><code>compress</code> Boolean (optional) - If true, crash reports will be compressed and uploaded with <code>Content-Encoding: gzip</code>. Standard ist <code>true</code>.</li>\n<li><code>extra</code> Record&#x3C;String, String> (optional) - Extra string key/value annotations that will be sent along with crash reports that are generated in the main process. Only string values are supported. Crashes generated in child processes will not contain these extra parameters to crash reports generated from child processes, call <a href=\"#crashreporteraddextraparameterkey-value\"><code>addExtraParameter</code></a> from the child process.</li>\n<li><code>globalExtra</code> Record&#x3C;String, String> (optional) - Extra string key/value annotations that will be sent along with any crash reports generated in any process. These annotations cannot be changed once the crash reporter has been started. If a key is present in both the global extra parameters and the process-specific extra parameters, then the global one will take precedence. By default, <code>productName</code> and the app version are included, as well as the Electron version.</li>\n</ul></li>\n</ul>\n<p>This method must be called before using any other <code>crashReporter</code> APIs. Once initialized this way, the crashpad handler collects crashes from all subsequently created processes. The crash reporter cannot be disabled once started.</p>\n<p>This method should be called as early as possible in app startup, preferably before <code>app.on('ready')</code>. If the crash reporter is not initialized at the time a renderer process is created, then that renderer process will not be monitored by the crash reporter.</p>\n<p><strong>Note:</strong> You can test out the crash reporter by generating a crash using <code>process.crash()</code>.</p>\n<p><strong>Note:</strong> If you need to send additional/updated <code>extra</code> parameters after your first call <code>start</code> you can call <code>addExtraParameter</code>.</p>\n<p><strong>Note:</strong> Parameters passed in <code>extra</code>, <code>globalExtra</code> or set with <code>addExtraParameter</code> have limits on the length of the keys and values. Key names must be at most 39 bytes long, and values must be no longer than 127 bytes. Keys with names longer than the maximum will be silently ignored. Key values longer than the maximum length will be truncated.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportergetlastcrashreport\"><a href=\"#crashreportergetlastcrashreport\"><code>crashReporter.getLastCrashReport()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/crash-report\"><code>CrashReport</code></a> - The date and ID of the last crash report. Only crash reports that have been uploaded will be returned; even if a crash report is present on disk it will not be returned until it is uploaded. In the case that there are no uploaded reports, <code>null</code> is returned.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportergetuploadedreports\"><a href=\"#crashreportergetuploadedreports\"><code>crashReporter.getUploadedReports()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/crash-report\"><code>CrashReport[]</code></a>:</p>\n<p>Returns all uploaded crash reports. Each report contains the date and uploaded ID.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportergetuploadtoserver\"><a href=\"#crashreportergetuploadtoserver\"><code>crashReporter.getUploadToServer()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether reports should be submitted to the server. Set through the <code>start</code> method or <code>setUploadToServer</code>.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreportersetuploadtoserveruploadtoserver\"><a href=\"#crashreportersetuploadtoserveruploadtoserver\"><code>crashReporter.setUploadToServer(uploadToServer)</code></a></h3>\n<ul>\n<li><code>uploadToServer</code> Boolean - Whether reports should be submitted to the server.</li>\n</ul>\n<p>This would normally be controlled by user preferences. This has no effect if called before <code>start</code> is called.</p>\n<p><strong>Note:</strong> This method is only available in the main process.</p>\n<h3 id=\"crashreporteraddextraparameterkey-value\"><a href=\"#crashreporteraddextraparameterkey-value\"><code>crashReporter.addExtraParameter(key, value)</code></a></h3>\n<ul>\n<li><code>key</code> String - Parameter key, must be no longer than 39 bytes.</li>\n<li><code>value</code> String - Parameter value, must be no longer than 127 bytes.</li>\n</ul>\n<p>Set an extra parameter to be sent with the crash report. The values specified here will be sent in addition to any values set via the <code>extra</code> option when <code>start</code> was called.</p>\n<p>Parameters added in this fashion (or via the <code>extra</code> parameter to <code>crashReporter.start</code>) are specific to the calling process. Adding extra parameters in the main process will not cause those parameters to be sent along with crashes from renderer or other child processes. Similarly, adding extra parameters in a renderer process will not result in those parameters being sent with crashes that occur in other renderer processes or in the main process.</p>\n<p><strong>Note:</strong> Parameters have limits on the length of the keys and values. Key names must be no longer than 39 bytes, and values must be no longer than 20320 bytes. Keys with names longer than the maximum will be silently ignored. Key values longer than the maximum length will be truncated.</p>\n<p><strong>Note:</strong> On linux values that are longer than 127 bytes will be chunked into multiple keys, each 127 bytes in length.  z.B. <code>addExtraParameter('foo', 'a'.repeat(130))</code> will result in two chunked keys <code>foo__1</code> and <code>foo__2</code>, the first will contain the first 127 bytes and the second will contain the remaining 3 bytes.  On your crash reporting backend you should stitch together keys in this format.</p>\n<h3 id=\"crashreporterremoveextraparameterkey\"><a href=\"#crashreporterremoveextraparameterkey\"><code>crashReporter.removeExtraParameter(key)</code></a></h3>\n<ul>\n<li><code>key</code> String - Parameter key, must be no longer than 39 bytes.</li>\n</ul>\n<p>Remove an extra parameter from the current set of parameters. Future crashes will not include this parameter.</p>\n<h3 id=\"crashreportergetparameters\"><a href=\"#crashreportergetparameters\"><code>crashReporter.getParameters()</code></a></h3>\n<p>Returns <code>Record&#x3C;String, String></code> - The current 'extra' parameters of the crash reporter.</p>\n<h2 id=\"crash-report-payload\"><a href=\"#crash-report-payload\">Crash Report Payload</a></h2>\n<p>The crash reporter will send the following data to the <code>submitURL</code> as a <code>multipart/form-data</code> <code>POST</code>:</p>\n<ul>\n<li><code>ver</code> String - The version of Electron.</li>\n<li><code>platform</code> String - e.g. 'win32'.</li>\n<li><code>process_type</code> String - e.g. 'renderer'.</li>\n<li><code>guid</code> String - e.g. '5e1286fc-da97-479e-918b-6bfb0c3d1c72'.</li>\n<li><code>_version</code> String - The version in <code>package.json</code>.</li>\n<li><code>_productName</code> String - The product name in the <code>crashReporter</code> <code>options</code> object.</li>\n<li><code>prod</code> String - Name of the underlying product. In this case Electron.</li>\n<li><code>_companyName</code> String - The company name in the <code>crashReporter</code> <code>options</code> object.</li>\n<li><code>upload_file_minidump</code> File - The crash report in the format of <code>minidump</code>.</li>\n<li>All level one properties of the <code>extra</code> object in the <code>crashReporter</code> <code>options</code> object.</li>\n</ul>",
      "title": "crashReporter",
      "description": "Bestätige Crash Reports zu einem Remote Server"
    },
    "/docs/api/structures/custom-scheme": {
      "locale": "de-DE",
      "slug": "custom-scheme",
      "href": "/docs/api/structures/custom-scheme",
      "crowdinFileId": "256423",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/custom-scheme.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"customscheme-object\"><a href=\"#customscheme-object\">CustomScheme Object</a></h1>\n<ul>\n<li><code>scheme</code> String - Custom schemes to be registered with options.</li>\n<li><code>privileges</code> Object (optional)<ul>\n<li><code>standard</code> Boolean (optional) - Default false.</li>\n<li><code>secure</code> Boolean (optional) - Default false.</li>\n<li><code>bypassCSP</code> Boolean (optional) - Default false.</li>\n<li><code>allowServiceWorkers</code> Boolean (optional) - Default false.</li>\n<li><code>supportFetchAPI</code> Boolean (optional) - Default false.</li>\n<li><code>corsEnabled</code> Boolean (optional) - Default false.</li>\n<li><code>stream</code> Boolean (optional) - Default false.</li>\n</ul></li>\n</ul>",
      "title": "CustomScheme Object",
      "description": ""
    },
    "/docs/tutorial/dark-mode": {
      "locale": "de-DE",
      "slug": "dark-mode",
      "href": "/docs/tutorial/dark-mode",
      "crowdinFileId": "256187",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/dark-mode.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nachtmodus\"><a href=\"#nachtmodus\">Nachtmodus</a></h1>\n<h2 id=\"übersicht\"><a href=\"#übersicht\">Übersicht</a></h2>\n<h3 id=\"automatically-update-the-native-interfaces\"><a href=\"#automatically-update-the-native-interfaces\">Automatically update the native interfaces</a></h3>\n<p>\"Native interfaces\" include the file picker, window border, dialogs, context menus, and more - anything where the UI comes from your operating system and not from your app. The default behavior is to opt into this automatic theming from the OS.</p>\n<h3 id=\"automatically-update-your-own-interfaces\"><a href=\"#automatically-update-your-own-interfaces\">Automatically update your own interfaces</a></h3>\n<p>If your app has its own dark mode, you should toggle it on and off in sync with the system's dark mode setting. You can do this by using the [prefer-color-scheme] CSS media query.</p>\n<h3 id=\"manually-update-your-own-interfaces\"><a href=\"#manually-update-your-own-interfaces\">Manually update your own interfaces</a></h3>\n<p>If you want to manually switch between light/dark modes, you can do this by setting the desired mode in the <a href=\"/docs/api/native-theme#nativethemethemesource\">themeSource</a> property of the <code>nativeTheme</code> module. This property's value will be propagated to your Renderer process. Any CSS rules related to <code>prefers-color-scheme</code> will be updated accordingly.</p>\n<h2 id=\"macos-settings\"><a href=\"#macos-settings\">macOS settings</a></h2>\n<p>In macOS 10.14 Mojave hat Apple einen neuen <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/dark-mode/\">systemweiten dunklen Modus </a> für alle Mac OS-Computer eingeführt. If your Electron app has a dark mode, you can make it follow the system-wide dark mode setting using <a href=\"/docs/api/native-theme\">the <code>nativeTheme</code> api</a>.</p>\n<p>In macOS 10.15 Catalina, Apple introduced a new \"automatic\" dark mode option for all macOS computers. In order for the <code>nativeTheme.shouldUseDarkColors</code> and <code>Tray</code> APIs to work correctly in this mode on Catalina, you need to use Electron <code>>=7.0.0</code>, or set <code>NSRequiresAquaSystemAppearance</code> to <code>false</code> in your <code>Info.plist</code> file for older versions. Both <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a> and <a href=\"https://www.electronforge.io/\">Electron Forge</a> have a <a href=\"https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html#darwindarkmodesupport\"><code>darwinDarkModeSupport</code> option</a> to automate the <code>Info.plist</code> changes during app build time.</p>\n<p>If you wish to opt-out while using Electron > 8.0.0, you must set the <code>NSRequiresAquaSystemAppearance</code> key in the <code>Info.plist</code> file to <code>true</code>. Please note that Electron 8.0.0 and above will not let you opt-out of this theming, due to the use of the macOS 10.14 SDK.</p>\n<h2 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h2>\n<p>This example demonstrates an Electron application that derives its theme colors from the <code>nativeTheme</code>. Additionally, it provides theme toggle and reset controls using IPC channels.</p>\n<h3 id=\"how-does-this-work\"><a href=\"#how-does-this-work\">How does this work?</a></h3>\n<p>Starting with the <code>index.html</code> file:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"script-src 'self' 'unsafe-inline';\"</span> /></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/css\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"./styles.css\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">p</span>></span>Current theme source: <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">strong</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"theme-source\"</span>></span>System<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">strong</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">p</span>></span>\n\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"toggle-dark-mode\"</span>></span>Toggle Dark Mode<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">button</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"reset-to-system\"</span>></span>Reset to System Theme<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">button</span>></span>\n\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>And the <code>styles.css</code> file:</p>\n<pre><code class=\"hljs language-css\">@<span class=\"hljs-keyword\">media</span> (prefers-color-scheme: dark) {\n  <span class=\"hljs-selector-tag\">body</span> { <span class=\"hljs-attribute\">background</span>: <span class=\"hljs-number\">#333</span>; <span class=\"hljs-attribute\">color</span>: white; }\n}\n\n@<span class=\"hljs-keyword\">media</span> (prefers-color-scheme: light) {\n  <span class=\"hljs-selector-tag\">body</span> { <span class=\"hljs-attribute\">background</span>: <span class=\"hljs-number\">#ddd</span>; <span class=\"hljs-attribute\">color</span>: black; }\n}\n</code></pre>\n<p>The example renders an HTML page with a couple elements. The <code>&#x3C;strong id=\"theme-source\"></code> element shows which theme is currently selected, and the two <code>&#x3C;button></code> elements are the controls. The CSS file uses the <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> media query to set the <code>&#x3C;body></code> element background and text colors.</p>\n<p>The <code>preload.js</code> script adds a new API to the <code>window</code> object called <code>darkMode</code>. This API exposes two IPC channels to the renderer process, <code>'dark-mode:toggle'</code> and <code>'dark-mode:system'</code>. It also assigns two methods, <code>toggle</code> and <code>system</code>, which pass messages from the renderer to the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'darkMode'</span>, {\n  <span class=\"hljs-attr\">toggle</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'dark-mode:toggle'</span>),\n  <span class=\"hljs-attr\">system</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> ipcRenderer.invoke(<span class=\"hljs-string\">'dark-mode:system'</span>)\n})\n</code></pre>\n<p>Now the renderer process can communicate with the main process securely and perform the necessary mutations to the <code>nativeTheme</code> object.</p>\n<p>The <code>renderer.js</code> file is responsible for controlling the <code>&#x3C;button></code> functionality.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'toggle-dark-mode'</span>).addEventListener(<span class=\"hljs-string\">'click'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> isDarkMode = <span class=\"hljs-keyword\">await</span> <span class=\"hljs-built_in\">window</span>.darkMode.toggle()\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'theme-source'</span>).innerHTML = isDarkMode ? <span class=\"hljs-string\">'Dark'</span> : <span class=\"hljs-string\">'Light'</span>\n})\n\n<span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'reset-to-system'</span>).addEventListener(<span class=\"hljs-string\">'click'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> <span class=\"hljs-built_in\">window</span>.darkMode.system()\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'theme-source'</span>).innerHTML = <span class=\"hljs-string\">'System'</span>\n})\n</code></pre>\n<p>Using <code>addEventListener</code>, the <code>renderer.js</code> file adds <code>'click'</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\">event listeners</a> to each button element. Each event listener handler makes calls to the respective <code>window.darkMode</code> API methods.</p>\n<p>Finally, the <code>main.js</code> file represents the main process and contains the actual <code>nativeTheme</code> API.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, ipcMain, nativeTheme } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  ipcMain.handle(<span class=\"hljs-string\">'dark-mode:toggle'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (nativeTheme.shouldUseDarkColors) {\n      nativeTheme.themeSource = <span class=\"hljs-string\">'light'</span>\n    } <span class=\"hljs-keyword\">else</span> {\n      nativeTheme.themeSource = <span class=\"hljs-string\">'dark'</span>\n    }\n    <span class=\"hljs-keyword\">return</span> nativeTheme.shouldUseDarkColors\n  })\n\n  ipcMain.handle(<span class=\"hljs-string\">'dark-mode:system'</span>, () => {\n    nativeTheme.themeSource = <span class=\"hljs-string\">'system'</span>\n  })\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n      createWindow()\n    }\n  })\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n</code></pre>\n<p>The <code>ipcMain.handle</code> methods are how the main process responds to the click events from the buttons on the HTML page.</p>\n<p>The <code>'dark-mode:toggle'</code> IPC channel handler method checks the <code>shouldUseDarkColors</code> boolean property, sets the corresponding <code>themeSource</code>, and then returns the current <code>shouldUseDarkColors</code> property. Looking back on the renderer process event listener for this IPC channel, the return value from this handler is utilized to assign the correct text to the <code>&#x3C;strong id='theme-source'></code> element.</p>\n<p>The <code>'dark-mode:system'</code> IPC channel handler method assigns the string <code>'system'</code> to the <code>themeSource</code> and returns nothing. This also corresponds with the relative renderer process event listener as the method is awaited with no return value expected.</p>\n<p>Run the example using Electron Fiddle and then click the \"Toggle Dark Mode\" button; the app should start alternating between a light and dark background color.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/dark_mode.gif\" alt=\"Nachtmodus\"></p>",
      "title": "Nachtmodus",
      "description": ""
    },
    "/docs/development/debug-instructions-windows": {
      "locale": "de-DE",
      "slug": "debug-instructions-windows",
      "href": "/docs/development/debug-instructions-windows",
      "crowdinFileId": "256149",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debug-instructions-windows.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"debugging-in-windows\"><a href=\"#debugging-in-windows\">Debugging in Windows</a></h1>\n<p>Wenn Sie Abstürze oder Probleme in Electron auftreten, von denen Sie glauben, dass sie nicht JavaScript-Anwendung, sondern von Electron selbst kann das Debuggen ein wenig schwierig sein, vor allem für Entwickler, die nicht an native/C++ gewöhnt sind Debuggen. However, using Visual Studio, Electron's hosted Symbol Server, and the Electron source code, you can enable step-through debugging with breakpoints inside Electron's source code.</p>\n<p><strong>See also</strong>: There's a wealth of information on debugging Chromium, much of which also applies to Electron, on the Chromium developers site: <a href=\"https://www.chromium.org/developers/how-tos/debugging-on-windows\">Debugging Chromium on Windows</a>.</p>\n<h2 id=\"anforderungen\"><a href=\"#anforderungen\">Anforderungen</a></h2>\n<ul>\n<li>\n<p><strong>A debug build of Electron</strong>: The easiest way is usually building it yourself, using the tools and prerequisites listed in the <a href=\"/docs/development/build-instructions-windows\">build instructions for Windows</a>. While you can attach to and debug Electron as you can download it directly, you will find that it is heavily optimized, making debugging substantially more difficult: The debugger will not be able to show you the content of all variables and the execution path can seem strange because of inlining, tail calls, and other compiler optimizations.</p>\n</li>\n<li>\n<p><strong>Visual Studio with C++ Tools</strong>: The free community editions of Visual Studio 2013 and Visual Studio 2015 both work. Once installed, <a href=\"/docs/development/setting-up-symbol-server\">configure Visual Studio to use Electron's Symbol server</a>. It will enable Visual Studio to gain a better understanding of what happens inside Electron, making it easier to present variables in a human-readable format.</p>\n</li>\n<li>\n<p><strong>ProcMon</strong>: The <a href=\"https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx\">free SysInternals tool</a> allows you to inspect a processes parameters, file handles, and registry operations.</p>\n</li>\n</ul>\n<h2 id=\"attaching-to-and-debugging-electron\"><a href=\"#attaching-to-and-debugging-electron\">Attaching to and Debugging Electron</a></h2>\n<p>To start a debugging session, open up PowerShell/CMD and execute your debug build of Electron, using the application to open as a parameter.</p>\n<pre><code class=\"hljs language-powershell\">$ ./out/Testing/electron.exe ~/my-electron-app/\n</code></pre>\n<h3 id=\"breakpoints-setzen\"><a href=\"#breakpoints-setzen\">Breakpoints setzen</a></h3>\n<p>Then, open up Visual Studio. Electron is not built with Visual Studio and hence does not contain a project file - you can however open up the source code files \"As File\", meaning that Visual Studio will open them up by themselves. You can still set breakpoints - Visual Studio will automatically figure out that the source code matches the code running in the attached process and break accordingly.</p>\n<p>Die wichtigen Code Files findest du in <code>./shell/</code>.</p>\n<h3 id=\"attaching\"><a href=\"#attaching\">Attaching</a></h3>\n<p>You can attach the Visual Studio debugger to a running process on a local or remote computer. After the process is running, click Debug / Attach to Process (or press <code>CTRL+ALT+P</code>) to open the \"Attach to Process\" dialog box. You can use this capability to debug apps that are running on a local or remote computer, debug multiple processes simultaneously.</p>\n<p>If Electron is running under a different user account, select the <code>Show processes from all users</code> check box. Notice that depending on how many BrowserWindows your app opened, you will see multiple processes. A typical one-window app will result in Visual Studio presenting you with two <code>Electron.exe</code> entries - one for the main process and one for the renderer process. Since the list only gives you names, there's currently no reliable way of figuring out which is which.</p>\n<h3 id=\"which-process-should-i-attach-to\"><a href=\"#which-process-should-i-attach-to\">Which Process Should I Attach to?</a></h3>\n<p>Code executed within the main process (that is, code found in or eventually run by your main JavaScript file) will run inside the main process, while other code will execute inside its respective renderer process.</p>\n<p>You can be attached to multiple programs when you are debugging, but only one program is active in the debugger at any time. You can set the active program in the <code>Debug Location</code> toolbar or the <code>Processes window</code>.</p>\n<h2 id=\"using-procmon-to-observe-a-process\"><a href=\"#using-procmon-to-observe-a-process\">Using ProcMon to Observe a Process</a></h2>\n<p>While Visual Studio is fantastic for inspecting specific code paths, ProcMon's strength is really in observing everything your application is doing with the operating system - it captures File, Registry, Network, Process, and Profiling details of processes. It attempts to log <strong>all</strong> events occurring and can be quite overwhelming, but if you seek to understand what and how your application is doing to the operating system, it can be a valuable resource.</p>\n<p>For an introduction to ProcMon's basic and advanced debugging features, go check out <a href=\"https://channel9.msdn.com/shows/defrag-tools/defrag-tools-4-process-monitor\">this video tutorial</a> provided by Microsoft.</p>",
      "title": "Debugging in Windows",
      "description": ""
    },
    "/docs/api/debugger": {
      "locale": "de-DE",
      "slug": "debugger",
      "href": "/docs/api/debugger",
      "crowdinFileId": "256305",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/debugger.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-debugger\"><a href=\"#class-debugger\">Class: Debugger</a></h2>\n<blockquote>\n<p>An alternate transport for Chrome's remote debugging protocol.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Chrome Developer Tools has a <a href=\"https://chromedevtools.github.io/devtools-protocol/\">special binding</a> available at JavaScript runtime that allows interacting with pages and instrumenting them.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-keyword\">try</span> {\n  win.webContents.debugger.attach(<span class=\"hljs-string\">'1.1'</span>)\n} <span class=\"hljs-keyword\">catch</span> (err) {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Debugger attach failed : '</span>, err)\n}\n\nwin.webContents.debugger.on(<span class=\"hljs-string\">'detach'</span>, (event, reason) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Debugger detached due to : '</span>, reason)\n})\n\nwin.webContents.debugger.on(<span class=\"hljs-string\">'message'</span>, (event, method, params) => {\n  <span class=\"hljs-keyword\">if</span> (method === <span class=\"hljs-string\">'Network.requestWillBeSent'</span>) {\n    <span class=\"hljs-keyword\">if</span> (params.request.url === <span class=\"hljs-string\">'https://www.github.com'</span>) {\n      win.webContents.debugger.detach()\n    }\n  }\n})\n\nwin.webContents.debugger.sendCommand(<span class=\"hljs-string\">'Network.enable'</span>)\n</code></pre>\n<h3 id=\"instanz-ereignisse\"><a href=\"#instanz-ereignisse\">Instanz-Ereignisse</a></h3>\n<h4 id=\"event-detach\"><a href=\"#event-detach\">Event: 'detach'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>reason</code> String - Reason for detaching debugger.</li>\n</ul>\n<p>Emitted when the debugging session is terminated. This happens either when <code>webContents</code> is closed or devtools is invoked for the attached <code>webContents</code>.</p>\n<h4 id=\"event-message\"><a href=\"#event-message\">Event: 'message'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>method</code> String - Method name.</li>\n<li><code>params</code> any - Event parameters defined by the 'parameters' attribute in the remote debugging protocol.</li>\n<li><code>sessionId</code> String - Unique identifier of attached debugging session, will match the value sent from <code>debugger.sendCommand</code>.</li>\n</ul>\n<p>Emitted whenever the debugging target issues an instrumentation event.</p>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<h4 id=\"debuggerattachprotocolversion\"><a href=\"#debuggerattachprotocolversion\"><code>debugger.attach([protocolVersion])</code></a></h4>\n<ul>\n<li><code>protocolVersion</code> String (optional) - Requested debugging protocol version.</li>\n</ul>\n<p>Attaches the debugger to the <code>webContents</code>.</p>\n<h4 id=\"debuggerisattached\"><a href=\"#debuggerisattached\"><code>debugger.isAttached()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether a debugger is attached to the <code>webContents</code>.</p>\n<h4 id=\"debuggerdetach\"><a href=\"#debuggerdetach\"><code>debugger.detach()</code></a></h4>\n<p>Detaches the debugger from the <code>webContents</code>.</p>\n<h4 id=\"debuggersendcommandmethod-commandparams-sessionid\"><a href=\"#debuggersendcommandmethod-commandparams-sessionid\"><code>debugger.sendCommand(method[, commandParams, sessionId])</code></a></h4>\n<ul>\n<li><code>method</code> String - Method name, should be one of the methods defined by the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">remote debugging protocol</a>.</li>\n<li><code>commandParams</code> any (optional) - JSON object with request parameters.</li>\n<li><code>sessionId</code> String (optional) - send command to the target with associated debugging session id. The initial value can be obtained by sending <a href=\"https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-attachToTarget\">Target.attachToTarget</a> message.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the response defined by the 'returns' attribute of the command description in the remote debugging protocol or is rejected indicating the failure of the command.</p>\n<p>Send given command to the debugging target.</p>",
      "title": "Debugger",
      "description": "An alternate transport for Chrome's remote debugging protocol."
    },
    "/docs/development/debugging-instructions-macos": {
      "locale": "de-DE",
      "slug": "debugging-instructions-macos",
      "href": "/docs/development/debugging-instructions-macos",
      "crowdinFileId": "256153",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debugging-instructions-macos.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"debugging-in-macos\"><a href=\"#debugging-in-macos\">Debugging in macOS</a></h1>\n<p>Wenn Sie Abstürze oder Probleme in Electron auftreten, von denen Sie glauben, dass sie nicht JavaScript-Anwendung, sondern von Electron selbst kann das Debuggen ein wenig schwierig sein, vor allem für Entwickler, die nicht an native/C++ gewöhnt sind Debuggen. However, using lldb, and the Electron source code, you can enable step-through debugging with breakpoints inside Electron's source code. You can also use <a href=\"/docs/development/debugging-instructions-macos-xcode\">XCode for debugging</a> if you prefer a graphical interface.</p>\n<h2 id=\"anforderungen\"><a href=\"#anforderungen\">Anforderungen</a></h2>\n<ul>\n<li>\n<p><strong>A debug build of Electron</strong>: The easiest way is usually building it yourself, using the tools and prerequisites listed in the <a href=\"/docs/development/build-instructions-macos\">build instructions for macOS</a>. While you can attach to and debug Electron as you can download it directly, you will find that it is heavily optimized, making debugging substantially more difficult: The debugger will not be able to show you the content of all variables and the execution path can seem strange because of inlining, tail calls, and other compiler optimizations.</p>\n</li>\n<li>\n<p><strong>Xcode</strong>: In addition to Xcode, also install the Xcode command line tools. They include LLDB, the default debugger in Xcode on macOS. It supports debugging C, Objective-C and C++ on the desktop and iOS devices and simulator.</p>\n</li>\n<li>\n<p><strong>.lldbinit</strong>: Create or edit <code>~/.lldbinit</code> to allow Chromium code to be properly source-mapped.</p>\n<pre><code class=\"hljs language-plaintext\"># e.g: ['~/electron/src/tools/lldb']\nscript sys.path[:0] = ['&#x3C;...path/to/electron/src/tools/lldb>']\nscript import lldbinit\n</code></pre>\n</li>\n</ul>\n<h2 id=\"attaching-to-and-debugging-electron\"><a href=\"#attaching-to-and-debugging-electron\">Attaching to and Debugging Electron</a></h2>\n<p>To start a debugging session, open up Terminal and start <code>lldb</code>, passing a non-release build of Electron as a parameter.</p>\n<pre><code class=\"hljs language-sh\">$ lldb ./out/Testing/Electron.app\n(lldb) target create <span class=\"hljs-string\">\"./out/Testing/Electron.app\"</span>\nCurrent executable <span class=\"hljs-built_in\">set</span> to <span class=\"hljs-string\">'./out/Testing/Electron.app'</span> (x86_64).\n</code></pre>\n<h3 id=\"breakpoints-setzen\"><a href=\"#breakpoints-setzen\">Breakpoints setzen</a></h3>\n<p>LLDB is a powerful tool and supports multiple strategies for code inspection. For this basic introduction, let's assume that you're calling a command from JavaScript that isn't behaving correctly - so you'd like to break on that command's C++ counterpart inside the Electron source.</p>\n<p>Die wichtigen Code Files findest du in <code>./shell/</code>.</p>\n<p>Let's assume that you want to debug <code>app.setName()</code>, which is defined in <code>browser.cc</code> as <code>Browser::SetName()</code>. Set the breakpoint using the <code>breakpoint</code> command, specifying file and line to break on:</p>\n<pre><code class=\"hljs language-sh\">(lldb) breakpoint <span class=\"hljs-built_in\">set</span> --file browser.cc --line 117\nBreakpoint 1: <span class=\"hljs-built_in\">where</span> = Electron Framework`atom::Browser::SetName(std::__1::basic_string&#x3C;char, std::__1::char_traits&#x3C;char>, std::__1::allocator&#x3C;char> > const&#x26;) + 20 at browser.cc:118, address = 0x000000000015fdb4\n</code></pre>\n<p>Dann starte Electron:</p>\n<pre><code class=\"hljs language-sh\">(lldb) run\n</code></pre>\n<p>The app will immediately be paused, since Electron sets the app's name on launch:</p>\n<pre><code class=\"hljs language-sh\">(lldb) run\nProcess 25244 launched: <span class=\"hljs-string\">'/Users/fr/Code/electron/out/Testing/Electron.app/Contents/MacOS/Electron'</span> (x86_64)\nProcess 25244 stopped\n* thread <span class=\"hljs-comment\">#1: tid = 0x839a4c, 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 20 at browser.cc:118, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1</span>\n    frame <span class=\"hljs-comment\">#0: 0x0000000100162db4 Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 20 at browser.cc:118</span>\n   115  }\n   116\n   117  void Browser::SetName(const std::string&#x26; name) {\n-> 118    name_override_ = name;\n   119  }\n   120\n   121  int Browser::<span class=\"hljs-function\"><span class=\"hljs-title\">GetBadgeCount</span></span>() {\n(lldb)\n</code></pre>\n<p>To show the arguments and local variables for the current frame, run <code>frame variable</code> (or <code>fr v</code>), which will show you that the app is currently setting the name to \"Electron\".</p>\n<pre><code class=\"hljs language-sh\">(lldb) frame variable\n(atom::Browser *) this = 0x0000000108b14f20\n(const string &#x26;) name = <span class=\"hljs-string\">\"Electron\"</span>: {\n    [...]\n}\n</code></pre>\n<p>To do a source level single step in the currently selected thread, execute <code>step</code> (or <code>s</code>). This would take you into <code>name_override_.empty()</code>. To proceed and do a step over, run <code>next</code> (or <code>n</code>).</p>\n<pre><code class=\"hljs language-sh\">(lldb) step\nProcess 25244 stopped\n* thread <span class=\"hljs-comment\">#1: tid = 0x839a4c, 0x0000000100162dcc Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 44 at browser.cc:119, queue = 'com.apple.main-thread', stop reason = step in</span>\n    frame <span class=\"hljs-comment\">#0: 0x0000000100162dcc Electron Framework`atom::Browser::SetName(this=0x0000000108b14f20, name=\"Electron\") + 44 at browser.cc:119</span>\n   116\n   117  void Browser::SetName(const std::string&#x26; name) {\n   118    name_override_ = name;\n-> 119  }\n   120\n   121  int Browser::<span class=\"hljs-function\"><span class=\"hljs-title\">GetBadgeCount</span></span>() {\n   122    <span class=\"hljs-built_in\">return</span> badge_count_;\n</code></pre>\n<p><strong>NOTE:</strong> If you don't see source code when you think you should, you may not have added the <code>~/.lldbinit</code> file above.</p>\n<p>To finish debugging at this point, run <code>process continue</code>. You can also continue until a certain line is hit in this thread (<code>thread until 100</code>). This command will run the thread in the current frame till it reaches line 100 in this frame or stops if it leaves the current frame.</p>\n<p>Jetzt wenn du Electrons DevTools öffnest und <code>setName</code> aufrufst triffst du wieder den Breakpoint.</p>\n<h3 id=\"weiterführende-informationen\"><a href=\"#weiterführende-informationen\">Weiterführende Informationen</a></h3>\n<p>LLDB is a powerful tool with a great documentation. To learn more about it, consider Apple's debugging documentation, for instance the <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-basics.html#//apple_ref/doc/uid/TP40012917-CH2-SW2\">LLDB Command Structure Reference</a> or the introduction to <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-terminal-workflow-tutorial.html\">Using LLDB as a Standalone Debugger</a>.</p>\n<p>You can also check out LLDB's fantastic <a href=\"https://lldb.llvm.org/tutorial.html\">manual and tutorial</a>, which will explain more complex debugging scenarios.</p>",
      "title": "Debugging in macOS",
      "description": ""
    },
    "/docs/development/debugging-instructions-macos-xcode": {
      "locale": "de-DE",
      "slug": "debugging-instructions-macos-xcode",
      "href": "/docs/development/debugging-instructions-macos-xcode",
      "crowdinFileId": "256151",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/debugging-instructions-macos-xcode.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h2 id=\"debugging-mit-xcode\"><a href=\"#debugging-mit-xcode\">Debugging mit XCode</a></h2>\n<h3 id=\"generate-xcode-project-for-debugging-sources-cannot-build-code-from-xcode\"><a href=\"#generate-xcode-project-for-debugging-sources-cannot-build-code-from-xcode\">Generate xcode project for debugging sources (cannot build code from xcode)</a></h3>\n<p>Run <code>gn gen</code> with the --ide=xcode argument.</p>\n<pre><code class=\"hljs language-sh\">$ gn gen out/Testing --ide=xcode\n</code></pre>\n<p>This will generate the electron.ninja.xcworkspace. You will have to open this workspace to set breakpoints and inspect.</p>\n<p>See <code>gn help gen</code> for more information on generating IDE projects with GN.</p>\n<h3 id=\"debugging-and-breakpoints\"><a href=\"#debugging-and-breakpoints\">Debugging and breakpoints</a></h3>\n<p>Launch Electron app after build. You can now open the xcode workspace created above and attach to the Electron process through the Debug > Attach To Process > Electron debug menu. [Note: If you want to debug the renderer process, you need to attach to the Electron Helper as well.]</p>\n<p>You can now set breakpoints in any of the indexed files. However, you will not be able to set breakpoints directly in the Chromium source. To set break points in the Chromium source, you can choose Debug > Breakpoints > Create Symbolic Breakpoint and set any function name as the symbol. This will set the breakpoint for all functions with that name, from all the classes if there are more than one. You can also do this step of setting break points prior to attaching the debugger, however, actual breakpoints for symbolic breakpoint functions may not show up until the debugger is attached to the app.</p>",
      "title": "Debugging mit XCode",
      "description": ""
    },
    "/docs/tutorial/debugging-main-process": {
      "locale": "de-DE",
      "slug": "debugging-main-process",
      "href": "/docs/tutorial/debugging-main-process",
      "crowdinFileId": "256189",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/debugging-main-process.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"debuggen-des-hauptprozesses\"><a href=\"#debuggen-des-hauptprozesses\">Debuggen des Hauptprozesses</a></h1>\n<p>Die DevTools in einem Electron Browserfenster können nur JavaScript debuggen, das auch in diesem Fenster ausgeführt wird (z.B. die Websites). Um JavaScript zu debuggen, das im Hauptprozess ausgeführt wird, benötigen Sie einen externen Debugger und müssen Electron mit der <code>--inspect</code> oder <code>--inspect-brk</code> Option starten.</p>\n<h2 id=\"befehlszeilenoptionen\"><a href=\"#befehlszeilenoptionen\">Befehlszeilenoptionen</a></h2>\n<p>Nutzen Sie eine der folgenden Befehlszeilenoptionen um das Debugging des Hauptprozesses zu aktivieren:</p>\n<h3 id=\"--inspectport\"><a href=\"#--inspectport\"><code>--inspect=[port]</code></a></h3>\n<p>Electron will listen for V8 inspector protocol messages on the specified <code>port</code>, an external debugger will need to connect on this port. The default <code>port</code> is <code>5858</code>.</p>\n<pre><code class=\"hljs language-shell\">electron --inspect=5858 your/app\n</code></pre>\n<h3 id=\"--inspect-brkport\"><a href=\"#--inspect-brkport\"><code>--inspect-brk=[port]</code></a></h3>\n<p>Änhlich wie <code>--inspect</code>, pausiert jedoch die Ausführung des JavaScript-Codes auf der ersten Zeile.</p>\n<h2 id=\"externe-debugger\"><a href=\"#externe-debugger\">Externe Debugger</a></h2>\n<p>Sie müssen einen Debugger verwenden, der das V8-Inspektor-Protokoll unterstützt.</p>\n<ul>\n<li>Verbinden Sie Chrome durch das Öffnen von <code>chrome://inspect</code> und wählen Sie 'Untersuchen' mit einem Rechtsklick auf die gestartete Electron-App aus.</li>\n<li><a href=\"/docs/tutorial/debugging-vscode\">Debugging in VSCode</a></li>\n</ul>",
      "title": "Debuggen des Hauptprozesses",
      "description": ""
    },
    "/docs/tutorial/debugging-vscode": {
      "locale": "de-DE",
      "slug": "debugging-vscode",
      "href": "/docs/tutorial/debugging-vscode",
      "crowdinFileId": "256191",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/debugging-vscode.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"debugging-in-vscode\"><a href=\"#debugging-in-vscode\">Debugging in VSCode</a></h1>\n<p>This guide goes over how to set up VSCode debugging for both your own Electron project as well as the native Electron codebase.</p>\n<h2 id=\"debugging-your-electron-app\"><a href=\"#debugging-your-electron-app\">Debugging your Electron app</a></h2>\n<h3 id=\"main-process\"><a href=\"#main-process\">Main process</a></h3>\n<h4 id=\"1-open-an-electron-project-in-vscode\"><a href=\"#1-open-an-electron-project-in-vscode\">1. Open an Electron project in VSCode.</a></h4>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:electron/electron-quick-start.git\n$ code electron-quick-start\n</code></pre>\n<h4 id=\"2-fügen-sie-eine-datei-vscodelaunchjson-mit-der-folgenden-konfiguration-hinzu\"><a href=\"#2-fügen-sie-eine-datei-vscodelaunchjson-mit-der-folgenden-konfiguration-hinzu\">2. Fügen Sie eine Datei <code>.vscode/launch.json</code> mit der folgenden Konfiguration hinzu:</a></h4>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.2.0\"</span>,\n  <span class=\"hljs-attr\">\"configurations\"</span>: [\n    {\n      <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"Debug Main Process\"</span>,\n      <span class=\"hljs-attr\">\"type\"</span>: <span class=\"hljs-string\">\"node\"</span>,\n      <span class=\"hljs-attr\">\"request\"</span>: <span class=\"hljs-string\">\"launch\"</span>,\n      <span class=\"hljs-attr\">\"cwd\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      <span class=\"hljs-attr\">\"runtimeExecutable\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}/node_modules/.bin/electron\"</span>,\n      <span class=\"hljs-attr\">\"windows\"</span>: {\n        <span class=\"hljs-attr\">\"runtimeExecutable\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}/node_modules/.bin/electron.cmd\"</span>\n      },\n      <span class=\"hljs-attr\">\"args\"</span> : [<span class=\"hljs-string\">\".\"</span>],\n      <span class=\"hljs-attr\">\"outputCapture\"</span>: <span class=\"hljs-string\">\"std\"</span>\n    }\n  ]\n}\n</code></pre>\n<h4 id=\"3-debugging\"><a href=\"#3-debugging\">3. Debugging</a></h4>\n<p>Set some breakpoints in <code>main.js</code>, and start debugging in the <a href=\"https://code.visualstudio.com/docs/editor/debugging\">Debug View</a>. You should be able to hit the breakpoints.</p>\n<p>Hier finden Sie ein vorkonfiguriertes Projekt, dass Sie herunterladen und direkt in VSCode debuggen können: <a href=\"https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start\">https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start</a></p>\n<h2 id=\"debugging-the-electron-codebase\"><a href=\"#debugging-the-electron-codebase\">Debugging the Electron codebase</a></h2>\n<p>If you want to build Electron from source and modify the native Electron codebase, this section will help you in testing your modifications.</p>\n<p>For those unsure where to acquire this code or how to build it, <a href=\"https://github.com/electron/build-tools\">Electron's Build Tools</a> automates and explains most of this process. If you wish to manually set up the environment, you can instead use these <a href=\"/docs/development/build-instructions-gn\">build instructions</a>.</p>\n<h3 id=\"windows-c\"><a href=\"#windows-c\">Windows (C++)</a></h3>\n<h4 id=\"1-open-an-electron-project-in-vscode-1\"><a href=\"#1-open-an-electron-project-in-vscode-1\">1. Open an Electron project in VSCode.</a></h4>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:electron/electron-quick-start.git\n$ code electron-quick-start\n</code></pre>\n<h4 id=\"2-fügen-sie-eine-datei-vscodelaunchjson-mit-der-folgenden-konfiguration-hinzu-1\"><a href=\"#2-fügen-sie-eine-datei-vscodelaunchjson-mit-der-folgenden-konfiguration-hinzu-1\">2. Fügen Sie eine Datei <code>.vscode/launch.json</code> mit der folgenden Konfiguration hinzu:</a></h4>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"0.2.0\"</span>,\n  <span class=\"hljs-attr\">\"configurations\"</span>: [\n    {\n      <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"(Windows) Launch\"</span>,\n      <span class=\"hljs-attr\">\"type\"</span>: <span class=\"hljs-string\">\"cppvsdbg\"</span>,\n      <span class=\"hljs-attr\">\"request\"</span>: <span class=\"hljs-string\">\"launch\"</span>,\n      <span class=\"hljs-attr\">\"program\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\\\\out\\\\your-executable-location\\\\electron.exe\"</span>,\n      <span class=\"hljs-attr\">\"args\"</span>: [<span class=\"hljs-string\">\"your-electron-project-path\"</span>],\n      <span class=\"hljs-attr\">\"stopAtEntry\"</span>: <span class=\"hljs-literal\">false</span>,\n      <span class=\"hljs-attr\">\"cwd\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      <span class=\"hljs-attr\">\"environment\"</span>: [\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_ENABLE_LOGGING\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"true\"</span>},\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_ENABLE_STACK_DUMPING\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"true\"</span>},\n          {<span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"ELECTRON_RUN_AS_NODE\"</span>, <span class=\"hljs-attr\">\"value\"</span>: <span class=\"hljs-string\">\"\"</span>},\n      ],\n      <span class=\"hljs-attr\">\"externalConsole\"</span>: <span class=\"hljs-literal\">false</span>,\n      <span class=\"hljs-attr\">\"sourceFileMap\"</span>: {\n          <span class=\"hljs-attr\">\"o:\\\\\"</span>: <span class=\"hljs-string\">\"${workspaceFolder}\"</span>,\n      },\n    },\n  ]\n}\n</code></pre>\n<p><strong>Configuration Notes</strong></p>\n<ul>\n<li><code>cppvsdbg</code> requires the <a href=\"https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools\">built-in C/C++ extension</a> be enabled.</li>\n<li><code>${workspaceFolder}</code> is the full path to Chromium's <code>src</code> directory.</li>\n<li><code>your-executable-location</code> will be one of the following depending on a few items:<ul>\n<li><code>Testing</code>: If you are using the default settings of <a href=\"https://github.com/electron/build-tools\">Electron's Build-Tools</a> or the default instructions when <a href=\"/docs/development/build-instructions-gn#building\">building from source</a>.</li>\n<li><code>Release</code>: If you built a Release build rather than a Testing build.</li>\n<li><code>your-directory-name</code>: If you modified this during your build process from the default, this will be whatever you specified.</li>\n</ul></li>\n<li>The <code>args</code> array string <code>\"your-electron-project-path\"</code> should be the absolute path to either the directory or <code>main.js</code> file of the Electron project you are using for testing. In this example, it should be your path to <code>electron-quick-start</code>.</li>\n</ul>\n<h4 id=\"3-debugging-1\"><a href=\"#3-debugging-1\">3. Debugging</a></h4>\n<p>Set some breakpoints in the .cc files of your choosing in the native Electron C++ code, and start debugging in the <a href=\"https://code.visualstudio.com/docs/editor/debugging\">Debug View</a>.</p>",
      "title": "Debugging in VSCode",
      "description": ""
    },
    "/docs/api/desktop-capturer": {
      "locale": "de-DE",
      "slug": "desktop-capturer",
      "href": "/docs/api/desktop-capturer",
      "crowdinFileId": "256307",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/desktop-capturer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktopcapturer\"><a href=\"#desktopcapturer\">desktopCapturer</a></h1>\n<blockquote>\n<p>Access information about media sources that can be used to capture audio and video from the desktop using the <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> API.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>Das folgende Beispiel zeigt, wie man Video von einem Desktop Fenster mit dem Titel <code>Electron</code> aufnehmen kann:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In the renderer process.</span>\n<span class=\"hljs-keyword\">const</span> { desktopCapturer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ndesktopCapturer.getSources({ <span class=\"hljs-attr\">types</span>: [<span class=\"hljs-string\">'window'</span>, <span class=\"hljs-string\">'screen'</span>] }).then(<span class=\"hljs-keyword\">async</span> sources => {\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> source <span class=\"hljs-keyword\">of</span> sources) {\n    <span class=\"hljs-keyword\">if</span> (source.name === <span class=\"hljs-string\">'Electron'</span>) {\n      <span class=\"hljs-keyword\">try</span> {\n        <span class=\"hljs-keyword\">const</span> stream = <span class=\"hljs-keyword\">await</span> navigator.mediaDevices.getUserMedia({\n          <span class=\"hljs-attr\">audio</span>: <span class=\"hljs-literal\">false</span>,\n          <span class=\"hljs-attr\">video</span>: {\n            <span class=\"hljs-attr\">mandatory</span>: {\n              <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>,\n              <span class=\"hljs-attr\">chromeMediaSourceId</span>: source.id,\n              <span class=\"hljs-attr\">minWidth</span>: <span class=\"hljs-number\">1280</span>,\n              <span class=\"hljs-attr\">maxWidth</span>: <span class=\"hljs-number\">1280</span>,\n              <span class=\"hljs-attr\">minHeight</span>: <span class=\"hljs-number\">720</span>,\n              <span class=\"hljs-attr\">maxHeight</span>: <span class=\"hljs-number\">720</span>\n            }\n          }\n        })\n        handleStream(stream)\n      } <span class=\"hljs-keyword\">catch</span> (e) {\n        handleError(e)\n      }\n      <span class=\"hljs-keyword\">return</span>\n    }\n  }\n})\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleStream</span> (<span class=\"hljs-params\">stream</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> video = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'video'</span>)\n  video.srcObject = stream\n  video.onloadedmetadata = <span class=\"hljs-function\">(<span class=\"hljs-params\">e</span>) =></span> video.play()\n}\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleError</span> (<span class=\"hljs-params\">e</span>) </span>{\n  <span class=\"hljs-built_in\">console</span>.log(e)\n}\n</code></pre>\n<p>To capture video from a source provided by <code>desktopCapturer</code> the constraints passed to <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> must include <code>chromeMediaSource: 'desktop'</code>, and <code>audio: false</code>.</p>\n<p>To capture both audio and video from the entire desktop the constraints passed to <a href=\"https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia\"><code>navigator.mediaDevices.getUserMedia</code></a> must include <code>chromeMediaSource: 'desktop'</code>, for both <code>audio</code> and <code>video</code>, but should not include a <code>chromeMediaSourceId</code> constraint.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> constraints = {\n  <span class=\"hljs-attr\">audio</span>: {\n    <span class=\"hljs-attr\">mandatory</span>: {\n      <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>\n    }\n  },\n  <span class=\"hljs-attr\">video</span>: {\n    <span class=\"hljs-attr\">mandatory</span>: {\n      <span class=\"hljs-attr\">chromeMediaSource</span>: <span class=\"hljs-string\">'desktop'</span>\n    }\n  }\n}\n</code></pre>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das Modul <code>desktopCapturer</code> verfügt über die folgenden Methoden:</p>\n<h3 id=\"desktopcapturergetsourcesoptions\"><a href=\"#desktopcapturergetsourcesoptions\"><code>desktopCapturer.getSources(options)</code></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>types</code> String[] - Ein Array von Strings, das die Typen der Desktop-Quellen auflistet die aufgezeichnet werden sollen, verfügbare Typen sind <code>screen</code> und <code>window</code>.</li>\n<li><code>thumbnailSize</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) - Die Größe, auf die die Miniaturansicht der Medienquelle skaliert werden soll. Voreinstellung ist <code>150</code> x <code>150</code>. Setzen Sie die Breite oder Höhe auf 0, wenn Sie kein Miniaturansichten benötigen. Dies reduziert die Verarbeitungszeit, die für die Erfassung des Inhalts der einzelnen Fenster und des Bildschirme benötigt wird.</li>\n<li><code>fetchWindowIcons</code> Boolean (optional) - Auf true setzen, um das Abrufen von Fenstersymbolen zu aktivieren. Der Standard Wert ist false. Bei false gibt die appIcon-Eigenschaft der Quellen null zurück. Dasselbe gilt, wenn eine Quelle den Typ \"screen\" hat.</li>\n</ul></li>\n</ul>\n<p>Rückgabe <code>Promise&#x3C;DesktopCapturerSource[]></code> - Löst mit einem Array von <a href=\"/docs/api/structures/desktop-capturer-source\"><code>DesktopCapturerSource</code></a>-Objekte auf, wobei jede <code>DesktopCapturerSource</code> einen Bildschirm oder ein einzelnes Fenster darstellt, das erfasst werden kann.</p>\n<p><strong>Note</strong> Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher, which can detected by <a href=\"/docs/api/system-preferences#systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><code>systemPreferences.getMediaAccessStatus</code></a>.</p>\n<h2 id=\"vorbehalte\"><a href=\"#vorbehalte\">Vorbehalte</a></h2>\n<p><code>navigator.mediaDevices.getUserMedia</code> funktioniert unter macOS nicht für Audioaufnahmen aufgrund einer grundsätzlichen Einschränkung, bei der Apps, die auf das Audiosystem zugreifen wollen, eine <a href=\"https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/KernelExtensions/KernelExtensions.html\">signierte Kernel-Erweiterung</a> benötigen. Chromium, und damit auch Electron, bieten dies nicht an.</p>\n<p>Es ist möglich, diese Einschränkung zu umgehen, indem Sie das Systemaudio mit einer anderen macOS-App wie Soundflower aufnehmen und durch ein virtuelles Audioeingabegerät leiten. Dieses virtuellen Geräte können dann mit <code>navigator.mediaDevices.getUserMedia</code> abgefragt werden.</p>",
      "title": "desktopCapturer",
      "description": "Access information about media sources that can be used to capture audio and video from the desktop using the navigator.mediaDevices.getUserMedia API."
    },
    "/docs/api/structures/desktop-capturer-source": {
      "locale": "de-DE",
      "slug": "desktop-capturer-source",
      "href": "/docs/api/structures/desktop-capturer-source",
      "crowdinFileId": "256425",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/desktop-capturer-source.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktopcapturersource-object\"><a href=\"#desktopcapturersource-object\">DesktopCapturerSource Object</a></h1>\n<ul>\n<li><code>id</code> String - The identifier of a window or screen that can be used as a <code>chromeMediaSourceId</code> constraint when calling [<code>navigator.webkitGetUserMedia</code>]. The format of the identifier will be <code>window:XX:YY</code> or <code>screen:ZZ:0</code>. XX is the windowID/handle. YY is 1 for the current process, and 0 for all others. ZZ is a sequential number that represents the screen, and it does not equal to the index in the source's name.</li>\n<li><code>name</code> String - A screen source will be named either <code>Entire Screen</code> or <code>Screen &#x3C;index></code>, while the name of a window source will match the window title.</li>\n<li><code>thumbnail</code> <a href=\"/docs/api/native-image\">NativeImage</a> - A thumbnail image. <strong>Note:</strong> There is no guarantee that the size of the thumbnail is the same as the <code>thumbnailSize</code> specified in the <code>options</code> passed to <code>desktopCapturer.getSources</code>. The actual size depends on the scale of the screen or window.</li>\n<li><code>display_id</code> String - A unique identifier that will correspond to the <code>id</code> of the matching <a href=\"/docs/api/structures/display\">Display</a> returned by the <a href=\"/docs/api/screen\">Screen API</a>. On some platforms, this is equivalent to the <code>XX</code> portion of the <code>id</code> field above and on others it will differ. It will be an empty string if not available.</li>\n<li><code>appIcon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - An icon image of the application that owns the window or null if the source has a type screen. The size of the icon is not known in advance and depends on what the application provides.</li>\n</ul>",
      "title": "DesktopCapturerSource Object",
      "description": ""
    },
    "/docs/tutorial/devices": {
      "locale": "de-DE",
      "slug": "devices",
      "href": "/docs/tutorial/devices",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/devices.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"device-access\"><a href=\"#device-access\">Device Access</a></h1>\n<p>Like Chromium based browsers, Electron provides access to device hardware through web APIs.  For the most part these APIs work like they do in a browser, but there are some differences that need to be taken into account.  The primary difference between Electron and browsers is what happens when device access is requested.  In a browser, users are presented with a popup where they can grant access to an individual device.  In Electron APIs are provided which can be used by a developer to either automatically pick a device or prompt users to pick a device via a developer created interface.</p>\n<h2 id=\"web-bluetooth-api\"><a href=\"#web-bluetooth-api\">Web Bluetooth API</a></h2>\n<p>The <a href=\"https://web.dev/bluetooth/\">Web Bluetooth API</a> can be used to communicate with bluetooth devices. In order to use this API in Electron, developers will need to handle the <a href=\"/docs/api/web-contents#event-select-bluetooth-device\"><code>select-bluetooth-device</code> event on the webContents</a> associated with the device request.</p>\n<h3 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h3>\n<p>This example demonstrates an Electron application that automatically selects the first available bluetooth device when the <code>Test Bluetooth</code> button is clicked.</p>\n<h2 id=\"webhid-api\"><a href=\"#webhid-api\">WebHID API</a></h2>\n<p>The <a href=\"https://web.dev/hid/\">WebHID API</a> can be used to access HID devices such as keyboards and gamepads.  Electron provides several APIs for working with the WebHID API:</p>\n<ul>\n<li>The <a href=\"/docs/api/session#event-select-hid-device\"><code>select-hid-device</code> event on the Session</a> can be used to select a HID device when a call to <code>navigator.hid.requestDevice</code> is made.  Additionally the <a href=\"/docs/api/session#event-hid-device-added\"><code>hid-device-added</code></a> and <a href=\"/docs/api/session#event-hid-device-removed\"><code>hid-device-removed</code></a> events on the Session can be used to handle devices being plugged in or unplugged during the <code>navigator.hid.requestDevice</code> process.</li>\n<li><a href=\"/docs/api/session#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a> can be used to provide default permissioning to devices without first calling for permission to devices via <code>navigator.hid.requestDevice</code>.  Additionally, the default behavior of Electron is to store granted device permision through the lifetime of the corresponding WebContents.  If longer term storage is needed, a developer can store granted device permissions (eg when handling the <code>select-hid-device</code> event) and then read from that storage with <code>setDevicePermissionHandler</code>.</li>\n<li><a href=\"/docs/api/session#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a> can be used to disable HID access for specific origins.</li>\n</ul>\n<h3 id=\"blocklist\"><a href=\"#blocklist\">Blocklist</a></h3>\n<p>By default Electron employs the same <a href=\"https://github.com/WICG/webhid/blob/main/blocklist.txt\">blocklist</a> used by Chromium.  If you wish to override this behavior, you can do so by setting the <code>disable-hid-blocklist</code> flag:</p>\n<pre><code class=\"hljs language-javascript\">app.commandLine.appendSwitch(<span class=\"hljs-string\">'disable-hid-blocklist'</span>)\n</code></pre>\n<h3 id=\"beispiel-1\"><a href=\"#beispiel-1\">Beispiel</a></h3>\n<p>This example demonstrates an Electron application that automatically selects HID devices through <a href=\"/docs/api/session#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a> and through <a href=\"/docs/api/session#event-select-hid-device\"><code>select-hid-device</code> event on the Session</a> when the <code>Test WebHID</code> button is clicked.</p>\n<h2 id=\"web-serial-api\"><a href=\"#web-serial-api\">Web Serial API</a></h2>\n<p>The <a href=\"https://web.dev/serial/\">Web Serial API</a> can be used to access serial devices that are connected via serial port, USB, or Bluetooth.  In order to use this API in Electron, developers will need to handle the <a href=\"/docs/api/session#event-select-serial-port\"><code>select-serial-port</code> event on the Session</a> associated with the serial port request.</p>\n<p>There are several additional APIs for working with the Web Serial API:</p>\n<ul>\n<li>The <a href=\"/docs/api/session#event-serial-port-added\"><code>serial-port-added</code></a> and <a href=\"/docs/api/session#event-serial-port-removed\"><code>serial-port-removed</code></a> events on the Session can be used to handle devices being plugged in or unplugged during the <code>navigator.serial.requestPort</code> process.</li>\n<li><a href=\"/docs/api/session#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a> can be used to disable serial access for specific origins.</li>\n</ul>\n<h3 id=\"beispiel-2\"><a href=\"#beispiel-2\">Beispiel</a></h3>\n<p>This example demonstrates an Electron application that automatically selects the first available Arduino Uno serial device (if connected) through <a href=\"/docs/api/session#event-select-serial-port\"><code>select-serial-port</code> event on the Session</a> when the <code>Test Web Serial</code> button is clicked.</p>",
      "title": "Device Access",
      "description": ""
    },
    "/docs/tutorial/devtools-extension": {
      "locale": "de-DE",
      "slug": "devtools-extension",
      "href": "/docs/tutorial/devtools-extension",
      "crowdinFileId": "256195",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/devtools-extension.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"devtools-erweiterung\"><a href=\"#devtools-erweiterung\">DevTools Erweiterung</a></h1>\n<p>Electron supports <a href=\"https://developer.chrome.com/extensions/devtools\">Chrome DevTools extensions</a>, which can be used to extend the ability of Chrome's developer tools for debugging popular web frameworks.</p>\n<h2 id=\"loading-a-devtools-extension-with-tooling\"><a href=\"#loading-a-devtools-extension-with-tooling\">Loading a DevTools extension with tooling</a></h2>\n<p>The easiest way to load a DevTools extension is to use third-party tooling to automate the process for you. <a href=\"https://github.com/MarshallOfSound/electron-devtools-installer\">electron-devtools-installer</a> is a popular NPM package that does just that.</p>\n<h2 id=\"manually-loading-a-devtools-extension\"><a href=\"#manually-loading-a-devtools-extension\">Manually loading a DevTools extension</a></h2>\n<p>If you don't want to use the tooling approach, you can also do all of the necessary operations by hand. To load an extension in Electron, you need to download it via Chrome, locate its filesystem path, and then load it into your <a href=\"/docs/api/session\">Session</a> by calling the [<code>ses.loadExtension</code>] API.</p>\n<p>Using the <a href=\"https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi\">React Developer Tools</a> as an example:</p>\n<ol>\n<li>\n<p>Install the extension in Google Chrome.</p>\n</li>\n<li>\n<p>Navigate to <code>chrome://extensions</code>, and find its extension ID, which is a hash string like <code>fmkadmapgofadopljbjfkapdkoienihi</code>.</p>\n</li>\n<li>\n<p>Find out the filesystem location used by Chrome for storing extensions:</p>\n<ul>\n<li>on Windows it is <code>%LOCALAPPDATA%\\Google\\Chrome\\User Data\\Default\\Extensions</code>;</li>\n<li>on Linux it could be:<ul>\n<li><code>~/.config/google-chrome/Default/Extensions/</code></li>\n<li><code>~/.config/google-chrome-beta/Default/Extensions/</code></li>\n<li><code>~/.config/google-chrome-canary/Default/Extensions/</code></li>\n<li><code>~/.config/chromium/Default/Extensions/</code></li>\n</ul></li>\n<li>on macOS it is <code>~/Library/Application Support/Google/Chrome/Default/Extensions</code>.</li>\n</ul>\n</li>\n<li>\n<p>Pass the location of the extension to the <a href=\"/docs/api/session#sesloadextensionpath-options\"><code>ses.loadExtension</code></a> API. For React Developer Tools <code>v4.9.0</code>, it looks something like:</p>\n<pre><code class=\"hljs language-javascript\"> <span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n <span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n\n <span class=\"hljs-comment\">// on macOS</span>\n <span class=\"hljs-keyword\">const</span> reactDevToolsPath = path.join(\n   os.homedir(),\n   <span class=\"hljs-string\">'/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/4.9.0_0'</span>\n )\n\n app.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n   <span class=\"hljs-keyword\">await</span> session.defaultSession.loadExtension(reactDevToolsPath)\n })\n</code></pre>\n</li>\n</ol>\n<p><strong>Hinweise:</strong></p>\n<ul>\n<li><code>loadExtension</code> returns a Promise with an <a href=\"/docs/api/structures/extension\">Extension object</a>, which contains metadata about the extension that was loaded. This promise needs to resolve (e.g. with an <code>await</code> expression) before loading a page. Otherwise, the extension won't be guaranteed to load.</li>\n<li><code>loadExtension</code> cannot be called before the <code>ready</code> event of the <code>app</code> module is emitted, nor can it be called on in-memory (non-persistent) sessions.</li>\n<li><code>loadExtension</code> must be called on every boot of your app if you want the extension to be loaded.</li>\n</ul>\n<h3 id=\"removing-a-devtools-extension\"><a href=\"#removing-a-devtools-extension\">Removing a DevTools extension</a></h3>\n<p>You can pass the extension's ID to the <a href=\"/docs/api/session#sesremoveextensionextensionid\"><code>ses.removeExtension</code></a> API to remove it from your Session. Loaded extensions are not persisted between app launches.</p>\n<h2 id=\"devtools-extension-support\"><a href=\"#devtools-extension-support\">DevTools extension support</a></h2>\n<p>Electron only supports <a href=\"/docs/api/extensions\">a limited set of <code>chrome.*</code> APIs</a>, so extensions using unsupported <code>chrome.*</code> APIs under the hood may not work.</p>\n<p>The following Devtools extensions have been tested to work in Electron:</p>\n<ul>\n<li><a href=\"https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi\">Ember Inspector</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi\">React Developer Tools</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/backbone-debugger/bhljhndlimiafopmmhjlgfpnnchjjbhd\">Backbone Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/jquery-debugger/dbhhnnnpaeobfddmlalhnehgclcmjimi\">jQuery Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/angularjs-batarang/ighdmehidhipcmcojjgiloacoafjmpfk\">AngularJS Batarang</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd\">Vue.js devtools</a></li>\n<li><a href=\"https://cerebraljs.com/docs/introduction/devtools.html\">Cerebral Debugger</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd\">Redux DevTools Extension</a></li>\n<li><a href=\"https://chrome.google.com/webstore/detail/mobx-developer-tools/pfgnfdagidkfgccljigdamigbcnndkod\">MobX Developer Tools</a></li>\n</ul>\n<h3 id=\"what-should-i-do-if-a-devtools-extension-is-not-working\"><a href=\"#what-should-i-do-if-a-devtools-extension-is-not-working\">What should I do if a DevTools extension is not working?</a></h3>\n<p>First, please make sure the extension is still being maintained and is compatible with the latest version of Google Chrome. We cannot provide additional support for unsupported extensions.</p>\n<p>If the extension works on Chrome but not on Electron, file a bug in Electron's <a href=\"https://github.com/electron/electron/issues\">issue tracker</a> and describe which part of the extension is not working as expected.</p>",
      "title": "DevTools Erweiterung",
      "description": ""
    },
    "/docs/api/dialog": {
      "locale": "de-DE",
      "slug": "dialog",
      "href": "/docs/api/dialog",
      "crowdinFileId": "256309",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/dialog.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dialog\"><a href=\"#dialog\">dialog</a></h1>\n<blockquote>\n<p>Für das Anzeigen von nativen Systemdialogen beim öffnen und speichern von Dateien, Warnungen, etc.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p>An example of showing a dialog to select multiple files:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(dialog.showOpenDialog({ <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'multiSelections'</span>] }))\n</code></pre>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das <code>dialog</code> module hat die folgenden Methoden:</p>\n<h3 id=\"dialogshowopendialogsyncbrowserwindow-options\"><a href=\"#dialogshowopendialogsyncbrowserwindow-options\"><code>dialog.showOpenDialogSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional)</li>\n<li><code>options</code> Objekt<ul>\n<li><code>title</code> String (optional)</li>\n<li><code>defaultPath</code> String (optional)</li>\n<li><code>buttonLabel</code> String (optional) - Custom label für den Bestätigen-Button. Wenn leer gelassen, dann wird das default label verwendet.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (optional)</li>\n<li><code>properties</code> String[] (optional) - Contains which features the dialog should use. The following values are supported:<ul>\n<li><code>openFile</code> - Erlaubt die Auswahl von Dateien.</li>\n<li><code>openDirectory</code> - Erlaubt die Auswahl von Verzeichnissen.</li>\n<li><code>multiSelections</code> - Erlaubt die Auswahl mehrerer Pfade.</li>\n<li><code>showHiddenFiles</code> - Zeige versteckte Dateien im Dialog.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Erlaube das Erstellen neuer Verzeichnisse im Dialog.</li>\n<li><code>promptToCreate</code> <em>Windows</em> - Prompt for creation if the file path entered in the dialog does not exist. This does not actually create the file at the path but allows non-existent paths to be returned that should be created by the application.</li>\n<li><code>noResolveAliases</code> <em>macOS</em> - Disable the automatic alias (symlink) path resolution. Selected aliases will now return the alias path instead of their target path.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Treat packages, such as <code>.app</code> folders, as a directory instead of a file.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - Do not add the item being opened to the recent documents list.</li>\n</ul></li>\n<li><code>message</code> String (optional) <em>macOS</em> - Message to display above input boxes.</li>\n<li><code>securityScopedBookmarks</code> Boolean (optional) <em>macOS</em> <em>mas</em> - Create <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmarks</a> when packaged for the Mac App Store.</li>\n</ul></li>\n</ul>\n<p>Returns <code>String[] | undefined</code>, the file paths chosen by the user; if the dialog is cancelled it returns <code>undefined</code>.</p>\n<p>The <code>browserWindow</code> argument allows the dialog to attach itself to a parent window, making it modal.</p>\n<p>The <code>filters</code> specifies an array of file types that can be displayed or selected when you want to limit the user to a specific type. Ein Beispiel:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">filters</span>: [\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Images'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'jpg'</span>, <span class=\"hljs-string\">'png'</span>, <span class=\"hljs-string\">'gif'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Movies'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'mkv'</span>, <span class=\"hljs-string\">'avi'</span>, <span class=\"hljs-string\">'mp4'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Custom File Type'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'as'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'All Files'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'*'</span>] }\n  ]\n}\n</code></pre>\n<p>The <code>extensions</code> array should contain extensions without wildcards or dots (e.g. <code>'png'</code> is good but <code>'.png'</code> and <code>'*.png'</code> are bad). To show all files, use the <code>'*'</code> wildcard (no other wildcard is supported).</p>\n<p><strong>Note:</strong> On Windows and Linux an open dialog can not be both a file selector and a directory selector, so if you set <code>properties</code> to <code>['openFile', 'openDirectory']</code> on these platforms, a directory selector will be shown.</p>\n<pre><code class=\"hljs language-js\">dialog.showOpenDialogSync(mainWindow, {\n  <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'openDirectory'</span>]\n})\n</code></pre>\n<h3 id=\"dialogshowopendialogbrowserwindow-options\"><a href=\"#dialogshowopendialogbrowserwindow-options\"><code>dialog.showOpenDialog([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional)</li>\n<li><code>options</code> Objekt<ul>\n<li><code>title</code> String (optional)</li>\n<li><code>defaultPath</code> String (optional)</li>\n<li><code>buttonLabel</code> String (optional) - Custom label für den Bestätigen-Button. Wenn leer gelassen, dann wird das default label verwendet.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (optional)</li>\n<li><code>properties</code> String[] (optional) - Contains which features the dialog should use. The following values are supported:<ul>\n<li><code>openFile</code> - Erlaubt die Auswahl von Dateien.</li>\n<li><code>openDirectory</code> - Erlaubt die Auswahl von Verzeichnissen.</li>\n<li><code>multiSelections</code> - Erlaubt die Auswahl mehrerer Pfade.</li>\n<li><code>showHiddenFiles</code> - Zeige versteckte Dateien im Dialog.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Erlaube das Erstellen neuer Verzeichnisse im Dialog.</li>\n<li><code>promptToCreate</code> <em>Windows</em> - Prompt for creation if the file path entered in the dialog does not exist. This does not actually create the file at the path but allows non-existent paths to be returned that should be created by the application.</li>\n<li><code>noResolveAliases</code> <em>macOS</em> - Disable the automatic alias (symlink) path resolution. Selected aliases will now return the alias path instead of their target path.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Treat packages, such as <code>.app</code> folders, as a directory instead of a file.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - Do not add the item being opened to the recent documents list.</li>\n</ul></li>\n<li><code>message</code> String (optional) <em>macOS</em> - Message to display above input boxes.</li>\n<li><code>securityScopedBookmarks</code> Boolean (optional) <em>macOS</em> <em>mas</em> - Create <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmarks</a> when packaged for the Mac App Store.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Object></code> - Resolve with an object containing the following:</p>\n<ul>\n<li><code>canceled</code> Boolean - whether or not the dialog was canceled.</li>\n<li><code>filePaths</code> String[] - An array of file paths chosen by the user. If the dialog is cancelled this will be an empty array.</li>\n<li><code>bookmarks</code> String[] (optional) <em>macOS</em> <em>mas</em> - An array matching the <code>filePaths</code> array of base64 encoded strings which contains security scoped bookmark data. <code>securityScopedBookmarks</code> must be enabled for this to be populated. (For return values, see <a href=\"#bookmarks-array\">table here</a>.)</li>\n</ul>\n<p>The <code>browserWindow</code> argument allows the dialog to attach itself to a parent window, making it modal.</p>\n<p>The <code>filters</code> specifies an array of file types that can be displayed or selected when you want to limit the user to a specific type. Ein Beispiel:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">filters</span>: [\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Images'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'jpg'</span>, <span class=\"hljs-string\">'png'</span>, <span class=\"hljs-string\">'gif'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Movies'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'mkv'</span>, <span class=\"hljs-string\">'avi'</span>, <span class=\"hljs-string\">'mp4'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Custom File Type'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'as'</span>] },\n    { <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'All Files'</span>, <span class=\"hljs-attr\">extensions</span>: [<span class=\"hljs-string\">'*'</span>] }\n  ]\n}\n</code></pre>\n<p>The <code>extensions</code> array should contain extensions without wildcards or dots (e.g. <code>'png'</code> is good but <code>'.png'</code> and <code>'*.png'</code> are bad). To show all files, use the <code>'*'</code> wildcard (no other wildcard is supported).</p>\n<p><strong>Note:</strong> On Windows and Linux an open dialog can not be both a file selector and a directory selector, so if you set <code>properties</code> to <code>['openFile', 'openDirectory']</code> on these platforms, a directory selector will be shown.</p>\n<pre><code class=\"hljs language-js\">dialog.showOpenDialog(mainWindow, {\n  <span class=\"hljs-attr\">properties</span>: [<span class=\"hljs-string\">'openFile'</span>, <span class=\"hljs-string\">'openDirectory'</span>]\n}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">result</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(result.canceled)\n  <span class=\"hljs-built_in\">console</span>.log(result.filePaths)\n}).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(err)\n})\n</code></pre>\n<h3 id=\"dialogshowsavedialogsyncbrowserwindow-options\"><a href=\"#dialogshowsavedialogsyncbrowserwindow-options\"><code>dialog.showSaveDialogSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional)</li>\n<li><code>options</code> Objekt<ul>\n<li><code>title</code> String (optional) - The dialog title. Cannot be displayed on some <em>Linux</em> desktop environments.</li>\n<li><code>defaultPath</code> String (optional) - Absolute directory path, absolute file path, or file name to use by default.</li>\n<li><code>buttonLabel</code> String (optional) - Custom label für den Bestätigen-Button. Wenn leer gelassen, dann wird das default label verwendet.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (optional)</li>\n<li><code>message</code> String (optional) <em>macOS</em> - Message to display above text fields.</li>\n<li><code>nameFieldLabel</code> String (optional) <em>macOS</em> - Custom label for the text displayed in front of the filename text field.</li>\n<li><code>showsTagField</code> Boolean (optional) <em>macOS</em> - Show the tags input box, defaults to <code>true</code>.</li>\n<li><code>properties</code> String[] (optional)<ul>\n<li><code>showHiddenFiles</code> - Zeige versteckte Dateien im Dialog.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Erlaube das Erstellen neuer Verzeichnisse im Dialog.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Treat packages, such as <code>.app</code> folders, as a directory instead of a file.</li>\n<li><code>showOverwriteConfirmation</code> <em>Linux</em> - Sets whether the user will be presented a confirmation dialog if the user types a file name that already exists.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - Do not add the item being saved to the recent documents list.</li>\n</ul></li>\n<li><code>securityScopedBookmarks</code> Boolean (optional) <em>macOS</em> <em>mas</em> - Create a <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmark</a> when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.</li>\n</ul></li>\n</ul>\n<p>Returns <code>String | undefined</code>, the path of the file chosen by the user; if the dialog is cancelled it returns <code>undefined</code>.</p>\n<p>The <code>browserWindow</code> argument allows the dialog to attach itself to a parent window, making it modal.</p>\n<p>The <code>filters</code> specifies an array of file types that can be displayed, see <code>dialog.showOpenDialog</code> for an example.</p>\n<h3 id=\"dialogshowsavedialogbrowserwindow-options\"><a href=\"#dialogshowsavedialogbrowserwindow-options\"><code>dialog.showSaveDialog([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional)</li>\n<li><code>options</code> Objekt<ul>\n<li><code>title</code> String (optional) - The dialog title. Cannot be displayed on some <em>Linux</em> desktop environments.</li>\n<li><code>defaultPath</code> String (optional) - Absolute directory path, absolute file path, or file name to use by default.</li>\n<li><code>buttonLabel</code> String (optional) - Custom label für den Bestätigen-Button. Wenn leer gelassen, dann wird das default label verwendet.</li>\n<li><code>filters</code> <a href=\"/docs/api/structures/file-filter\">FileFilter[]</a> (optional)</li>\n<li><code>message</code> String (optional) <em>macOS</em> - Message to display above text fields.</li>\n<li><code>nameFieldLabel</code> String (optional) <em>macOS</em> - Custom label for the text displayed in front of the filename text field.</li>\n<li><code>showsTagField</code> Boolean (optional) <em>macOS</em> - Show the tags input box, defaults to <code>true</code>.</li>\n<li><code>properties</code> String[] (optional)<ul>\n<li><code>showHiddenFiles</code> - Zeige versteckte Dateien im Dialog.</li>\n<li><code>createDirectory</code> <em>macOS</em> - Erlaube das Erstellen neuer Verzeichnisse im Dialog.</li>\n<li><code>treatPackageAsDirectory</code> <em>macOS</em> - Treat packages, such as <code>.app</code> folders, as a directory instead of a file.</li>\n<li><code>showOverwriteConfirmation</code> <em>Linux</em> - Sets whether the user will be presented a confirmation dialog if the user types a file name that already exists.</li>\n<li><code>dontAddToRecent</code> <em>Windows</em> - Do not add the item being saved to the recent documents list.</li>\n</ul></li>\n<li><code>securityScopedBookmarks</code> Boolean (optional) <em>macOS</em> <em>mas</em> - Create a <a href=\"https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16\">security scoped bookmark</a> when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Object></code> - Resolve with an object containing the following:</p>\n<ul>\n<li><code>canceled</code> Boolean - whether or not the dialog was canceled.</li>\n<li><code>filePath</code> String (optional) - If the dialog is canceled, this will be <code>undefined</code>.</li>\n<li><code>bookmark</code> String (optional) <em>macOS</em> <em>mas</em> - Base64 encoded string which contains the security scoped bookmark data for the saved file. <code>securityScopedBookmarks</code> must be enabled for this to be present. (For return values, see <a href=\"#bookmarks-array\">table here</a>.)</li>\n</ul>\n<p>The <code>browserWindow</code> argument allows the dialog to attach itself to a parent window, making it modal.</p>\n<p>The <code>filters</code> specifies an array of file types that can be displayed, see <code>dialog.showOpenDialog</code> for an example.</p>\n<p><strong>Note:</strong> On macOS, using the asynchronous version is recommended to avoid issues when expanding and collapsing the dialog.</p>\n<h3 id=\"dialogshowmessageboxsyncbrowserwindow-options\"><a href=\"#dialogshowmessageboxsyncbrowserwindow-options\"><code>dialog.showMessageBoxSync([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional)</li>\n<li><code>options</code> Objekt<ul>\n<li><code>message</code> String - Content of the message box.</li>\n<li><code>type</code> String (optional) - Can be <code>\"none\"</code>, <code>\"info\"</code>, <code>\"error\"</code>, <code>\"question\"</code> or <code>\"warning\"</code>. On Windows, <code>\"question\"</code> displays the same icon as <code>\"info\"</code>, unless you set an icon using the <code>\"icon\"</code> option. On macOS, both <code>\"warning\"</code> and <code>\"error\"</code> display the same warning icon.</li>\n<li><code>buttons</code> String[] (optional) - Array of texts for buttons. On Windows, an empty array will result in one button labeled \"OK\".</li>\n<li><code>defaultId</code> Integer (optional) - Index of the button in the buttons array which will be selected by default when the message box opens.</li>\n<li><code>title</code> String (optional) - Title of the message box, some platforms will not show it.</li>\n<li><code>detail</code> String (optional) - Extra information of the message.</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (optional)</li>\n<li><code>textWidth</code> Integer (optional) <em>macOS</em> - Custom width of the text in the message box.</li>\n<li><code>cancelId</code> Integer (optional) - The index of the button to be used to cancel the dialog, via the <code>Esc</code> key. By default this is assigned to the first button with \"cancel\" or \"no\" as the label. If no such labeled buttons exist and this option is not set, <code>0</code> will be used as the return value.</li>\n<li><code>noLink</code> Boolean (optional) - On Windows Electron will try to figure out which one of the <code>buttons</code> are common buttons (like \"Cancel\" or \"Yes\"), and show the others as command links in the dialog. This can make the dialog appear in the style of modern Windows apps. If you don't like this behavior, you can set <code>noLink</code> to <code>true</code>.</li>\n<li><code>normalizeAccessKeys</code> Boolean (optional) - Normalize the keyboard access keys across platforms. Standard ist <code>false</code>. Enabling this assumes <code>&#x26;</code> is used in the button labels for the placement of the keyboard shortcut access key and labels will be converted so they work correctly on each platform, <code>&#x26;</code> characters are removed on macOS, converted to <code>_</code> on Linux, and left untouched on Windows. For example, a button label of <code>Vie&#x26;w</code> will be converted to <code>Vie_w</code> on Linux and <code>View</code> on macOS and can be selected via <code>Alt-W</code> on Windows and Linux.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code> - the index of the clicked button.</p>\n<p>Shows a message box, it will block the process until the message box is closed. It returns the index of the clicked button.</p>\n<p>The <code>browserWindow</code> argument allows the dialog to attach itself to a parent window, making it modal. If <code>browserWindow</code> is not shown dialog will not be attached to it. In such case it will be displayed as an independent window.</p>\n<h3 id=\"dialogshowmessageboxbrowserwindow-options\"><a href=\"#dialogshowmessageboxbrowserwindow-options\"><code>dialog.showMessageBox([browserWindow, ]options)</code></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional)</li>\n<li><code>options</code> Objekt<ul>\n<li><code>message</code> String - Content of the message box.</li>\n<li><code>type</code> String (optional) - Can be <code>\"none\"</code>, <code>\"info\"</code>, <code>\"error\"</code>, <code>\"question\"</code> or <code>\"warning\"</code>. On Windows, <code>\"question\"</code> displays the same icon as <code>\"info\"</code>, unless you set an icon using the <code>\"icon\"</code> option. On macOS, both <code>\"warning\"</code> and <code>\"error\"</code> display the same warning icon.</li>\n<li><code>buttons</code> String[] (optional) - Array of texts for buttons. On Windows, an empty array will result in one button labeled \"OK\".</li>\n<li><code>defaultId</code> Integer (optional) - Index of the button in the buttons array which will be selected by default when the message box opens.</li>\n<li><code>signal</code> AbortSignal (optional) - Pass an instance of <a href=\"https://nodejs.org/api/globals.html#globals_class_abortsignal\">AbortSignal</a> to optionally close the message box, the message box will behave as if it was cancelled by the user. On macOS, <code>signal</code> does not work with message boxes that do not have a parent window, since those message boxes run synchronously due to platform limitations.</li>\n<li><code>title</code> String (optional) - Title of the message box, some platforms will not show it.</li>\n<li><code>detail</code> String (optional) - Extra information of the message.</li>\n<li><code>checkboxLabel</code> String (optional) - If provided, the message box will include a checkbox with the given label.</li>\n<li><code>checkboxChecked</code> Boolean (optional) - Initial checked state of the checkbox. Automatisch <code>false</code>.</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> (optional)</li>\n<li><code>textWidth</code> Integer (optional) <em>macOS</em> - Custom width of the text in the message box.</li>\n<li><code>cancelId</code> Integer (optional) - The index of the button to be used to cancel the dialog, via the <code>Esc</code> key. By default this is assigned to the first button with \"cancel\" or \"no\" as the label. If no such labeled buttons exist and this option is not set, <code>0</code> will be used as the return value.</li>\n<li><code>noLink</code> Boolean (optional) - On Windows Electron will try to figure out which one of the <code>buttons</code> are common buttons (like \"Cancel\" or \"Yes\"), and show the others as command links in the dialog. This can make the dialog appear in the style of modern Windows apps. If you don't like this behavior, you can set <code>noLink</code> to <code>true</code>.</li>\n<li><code>normalizeAccessKeys</code> Boolean (optional) - Normalize the keyboard access keys across platforms. Standard ist <code>false</code>. Enabling this assumes <code>&#x26;</code> is used in the button labels for the placement of the keyboard shortcut access key and labels will be converted so they work correctly on each platform, <code>&#x26;</code> characters are removed on macOS, converted to <code>_</code> on Linux, and left untouched on Windows. For example, a button label of <code>Vie&#x26;w</code> will be converted to <code>Vie_w</code> on Linux and <code>View</code> on macOS and can be selected via <code>Alt-W</code> on Windows and Linux.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Object></code> - resolves with a promise containing the following properties:</p>\n<ul>\n<li><code>response</code> Number - The index of the clicked button.</li>\n<li><code>checkboxChecked</code> Boolean - The checked state of the checkbox if <code>checkboxLabel</code> was set. Otherwise <code>false</code>.</li>\n</ul>\n<p>Shows a message box.</p>\n<p>The <code>browserWindow</code> argument allows the dialog to attach itself to a parent window, making it modal.</p>\n<h3 id=\"dialogshowerrorboxtitle-content\"><a href=\"#dialogshowerrorboxtitle-content\"><code>dialog.showErrorBox(title, content)</code></a></h3>\n<ul>\n<li><code>title</code> String - The title to display in the error box.</li>\n<li><code>content</code> String - The text content to display in the error box.</li>\n</ul>\n<p>Displays a modal dialog that shows an error message.</p>\n<p>This API can be called safely before the <code>ready</code> event the <code>app</code> module emits, it is usually used to report errors in early stage of startup. If called before the app <code>ready</code>event on Linux, the message will be emitted to stderr, and no GUI dialog will appear.</p>\n<h3 id=\"dialogshowcertificatetrustdialogbrowserwindow-options-macos-windows\"><a href=\"#dialogshowcertificatetrustdialogbrowserwindow-options-macos-windows\"><code>dialog.showCertificateTrustDialog([browserWindow, ]options)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional)</li>\n<li><code>options</code> Objekt<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> - The certificate to trust/import.</li>\n<li><code>message</code> String - The message to display to the user.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the certificate trust dialog is shown.</p>\n<p>On macOS, this displays a modal dialog that shows a message and certificate information, and gives the user the option of trusting/importing the certificate. If you provide a <code>browserWindow</code> argument the dialog will be attached to the parent window, making it modal.</p>\n<p>On Windows the options are more limited, due to the Win32 APIs used:</p>\n<ul>\n<li>The <code>message</code> argument is not used, as the OS provides its own confirmation dialog.</li>\n<li>The <code>browserWindow</code> argument is ignored since it is not possible to make this confirmation dialog modal.</li>\n</ul>\n<h2 id=\"bookmarks-array\"><a href=\"#bookmarks-array\">Bookmarks array</a></h2>\n<p><code>showOpenDialog</code>, <code>showOpenDialogSync</code>, <code>showSaveDialog</code>, and <code>showSaveDialogSync</code> will return a <code>bookmarks</code> array.</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Build Type</th><th>securityScopedBookmarks boolean</th><th align=\"center\">Return Type</th><th>Return Value</th></tr></thead><tbody><tr><td>macOS mas</td><td>True</td><td align=\"center\">Success</td><td><code>['LONGBOOKMARKSTRING']</code></td></tr><tr><td>macOS mas</td><td>True</td><td align=\"center\">Error</td><td><code>['']</code> (array of empty string)</td></tr><tr><td>macOS mas</td><td>False</td><td align=\"center\">NA</td><td><code>[]</code> (empty array)</td></tr><tr><td>non mas</td><td>any</td><td align=\"center\">NA</td><td><code>[]</code> (empty array)</td></tr></tbody></table>\n<h2 id=\"sheets\"><a href=\"#sheets\">Sheets</a></h2>\n<p>On macOS, dialogs are presented as sheets attached to a window if you provide a <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> reference in the <code>browserWindow</code> parameter, or modals if no window is provided.</p>\n<p>You can call <code>BrowserWindow.getCurrentWindow().setSheetOffset(offset)</code> to change the offset from the window frame where sheets are attached.</p>",
      "title": "dialog",
      "description": "Für das Anzeigen von nativen Systemdialogen beim öffnen und speichern von Dateien, Warnungen, etc."
    },
    "/docs/api/structures/display": {
      "locale": "de-DE",
      "slug": "display",
      "href": "/docs/api/structures/display",
      "crowdinFileId": "256427",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/display.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"display-object\"><a href=\"#display-object\">Display Object</a></h1>\n<ul>\n<li><code>id</code> Number - Unique identifier associated with the display.</li>\n<li><code>rotation</code> Number - Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.</li>\n<li><code>scaleFactor</code> Number - Output device's pixel scale factor.</li>\n<li><code>touchSupport</code> String - Can be <code>available</code>, <code>unavailable</code>, <code>unknown</code>.</li>\n<li><code>monochrome</code> Boolean - Whether or not the display is a monochrome display.</li>\n<li><code>accelerometerSupport</code> String - Can be <code>available</code>, <code>unavailable</code>, <code>unknown</code>.</li>\n<li><code>colorSpace</code> String -  represent a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions</li>\n<li><code>colorDepth</code> Number - The number of bits per pixel.</li>\n<li><code>depthPerComponent</code> Number - The number of bits per color component.</li>\n<li><code>displayFrequency</code> Number - The display refresh rate.</li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - the bounds of the display in DIP points.</li>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a></li>\n<li><code>workArea</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - the work area of the display in DIP points.</li>\n<li><code>workAreaSize</code> <a href=\"/docs/api/structures/size\">Size</a></li>\n<li><code>internal</code> Boolean - <code>true</code> for an internal display and <code>false</code> for an external display</li>\n</ul>\n<p>The <code>Display</code> object represents a physical display connected to the system. A fake <code>Display</code> may exist on a headless system, or a <code>Display</code> may correspond to a remote, virtual display.</p>",
      "title": "Display Object",
      "description": ""
    },
    "/docs/api/dock": {
      "locale": "de-DE",
      "slug": "dock",
      "href": "/docs/api/dock",
      "crowdinFileId": "256311",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/dock.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-dock\"><a href=\"#class-dock\">Class: Dock</a></h2>\n<blockquote>\n<p>Steuern Sie Ihre App im MacOS-Dock</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Das folgende Beispiel zeigt, wie Sie Ihr Icon auf dem Dock springen lassen.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.dock.bounce()\n</code></pre>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<h4 id=\"dockbouncetype-macos\"><a href=\"#dockbouncetype-macos\"><code>dock.bounce([type])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>type</code> String (optional) - Kann <code>critical</code> oder <code>informational</code> sein. Standard ist <code>informational</code></li>\n</ul>\n<p>Returns <code>Integer</code> - Eine ID welche den Request repräsentiert.</p>\n<p>When <code>critical</code> is passed, the dock icon will bounce until either the application becomes active or the request is canceled.</p>\n<p>When <code>informational</code> is passed, the dock icon will bounce for one second. However, the request remains active until either the application becomes active or the request is canceled.</p>\n<p><strong>Nota Bene:</strong> This method can only be used while the app is not focused; when the app is focused it will return -1.</p>\n<h4 id=\"dockcancelbounceid-macos\"><a href=\"#dockcancelbounceid-macos\"><code>dock.cancelBounce(id)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Cancel the bounce of <code>id</code>.</p>\n<h4 id=\"dockdownloadfinishedfilepath-macos\"><a href=\"#dockdownloadfinishedfilepath-macos\"><code>dock.downloadFinished(filePath)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n</ul>\n<p>Bounces the Downloads stack if the filePath is inside the Downloads folder.</p>\n<h4 id=\"docksetbadgetext-macos\"><a href=\"#docksetbadgetext-macos\"><code>dock.setBadge(text)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Sets the string to be displayed in the dock’s badging area.</p>\n<h4 id=\"dockgetbadge-macos\"><a href=\"#dockgetbadge-macos\"><code>dock.getBadge()</code> <em>macOS</em></a></h4>\n<p>Returns <code>String</code> - The badge string of the dock.</p>\n<h4 id=\"dockhide-macos\"><a href=\"#dockhide-macos\"><code>dock.hide()</code> <em>macOS</em></a></h4>\n<p>Versteckt das dock icon.</p>\n<h4 id=\"dockshow-macos\"><a href=\"#dockshow-macos\"><code>dock.show()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the dock icon is shown.</p>\n<h4 id=\"dockisvisible-macos\"><a href=\"#dockisvisible-macos\"><code>dock.isVisible()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether the dock icon is visible.</p>\n<h4 id=\"docksetmenumenu-macos\"><a href=\"#docksetmenumenu-macos\"><code>dock.setMenu(menu)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>menu</code> <a href=\"/docs/api/menu\">Menu</a></li>\n</ul>\n<p>Sets the application's [dock menu][dock-menu].</p>\n<h4 id=\"dockgetmenu-macos\"><a href=\"#dockgetmenu-macos\"><code>dock.getMenu()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Menu | null</code> - The application's [dock menu][dock-menu].</p>\n<h4 id=\"dockseticonimage-macos\"><a href=\"#dockseticonimage-macos\"><code>dock.setIcon(image)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>Setzt das <code>image</code> welches als Dock Icon verwendet werden soll.</p>",
      "title": "Dock",
      "description": "Steuern Sie Ihre App im MacOS-Dock"
    },
    "/docs/api/download-item": {
      "locale": "de-DE",
      "slug": "download-item",
      "href": "/docs/api/download-item",
      "crowdinFileId": "256313",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/download-item.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-downloaditem\"><a href=\"#class-downloaditem\">Class: DownloadItem</a></h2>\n<blockquote>\n<p>Control file downloads from remote sources.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>DownloadItem</code> is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a> that represents a download item in Electron. It is used in <code>will-download</code> event of <code>Session</code> class, and allows users to control the download item.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Im Hauptprozess.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.session.on(<span class=\"hljs-string\">'will-download'</span>, (event, item, webContents) => {\n  <span class=\"hljs-comment\">// Set the save path, making Electron not to prompt a save dialog.</span>\n  item.setSavePath(<span class=\"hljs-string\">'/tmp/save.pdf'</span>)\n\n  item.on(<span class=\"hljs-string\">'updated'</span>, (event, state) => {\n    <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'interrupted'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download is interrupted but can be resumed'</span>)\n    } <span class=\"hljs-keyword\">else</span> <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'progressing'</span>) {\n      <span class=\"hljs-keyword\">if</span> (item.isPaused()) {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download is paused'</span>)\n      } <span class=\"hljs-keyword\">else</span> {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Received bytes: <span class=\"hljs-subst\">${item.getReceivedBytes()}</span>`</span>)\n      }\n    }\n  })\n  item.once(<span class=\"hljs-string\">'done'</span>, (event, state) => {\n    <span class=\"hljs-keyword\">if</span> (state === <span class=\"hljs-string\">'completed'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Download successfully'</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Download failed: <span class=\"hljs-subst\">${state}</span>`</span>)\n    }\n  })\n})\n</code></pre>\n<h3 id=\"instanz-ereignisse\"><a href=\"#instanz-ereignisse\">Instanz-Ereignisse</a></h3>\n<h4 id=\"event-updated\"><a href=\"#event-updated\">Event: 'updated'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>state</code> String - Can be <code>progressing</code> or <code>interrupted</code>.</li>\n</ul>\n<p>Ausgelöst, wenn sich der Status des Downloads geändert hat, aber der Download nicht fertig ist.</p>\n<p>The <code>state</code> can be one of following:</p>\n<ul>\n<li><code>progressing</code> - The download is in-progress.</li>\n<li><code>interrupted</code> - The download has interrupted and can be resumed.</li>\n</ul>\n<h4 id=\"event-done\"><a href=\"#event-done\">Event: 'done'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>state</code> String - Can be <code>completed</code>, <code>cancelled</code> or <code>interrupted</code>.</li>\n</ul>\n<p>Ausgelöst, wenn der Download beendet wurde. This includes a completed download, a cancelled download (via <code>downloadItem.cancel()</code>), and interrupted download that can't be resumed.</p>\n<p>The <code>state</code> can be one of following:</p>\n<ul>\n<li><code>completed</code> - The download completed successfully.</li>\n<li><code>cancelled</code> - The download has been cancelled.</li>\n<li><code>interrupted</code> - The download has interrupted and can not resume.</li>\n</ul>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<p>The <code>downloadItem</code> object has the following methods:</p>\n<h4 id=\"downloaditemsetsavepathpath\"><a href=\"#downloaditemsetsavepathpath\"><code>downloadItem.setSavePath(path)</code></a></h4>\n<ul>\n<li><code>path</code> String - Set the save file path of the download item.</li>\n</ul>\n<p>The API is only available in session's <code>will-download</code> callback function. If <code>path</code> doesn't exist, Electron will try to make the directory recursively. If user doesn't set the save path via the API, Electron will use the original routine to determine the save path; this usually prompts a save dialog.</p>\n<h4 id=\"downloaditemgetsavepath\"><a href=\"#downloaditemgetsavepath\"><code>downloadItem.getSavePath()</code></a></h4>\n<p>Returns <code>String</code> - The save path of the download item. This will be either the path set via <code>downloadItem.setSavePath(path)</code> or the path selected from the shown save dialog.</p>\n<h4 id=\"downloaditemsetsavedialogoptionsoptions\"><a href=\"#downloaditemsetsavedialogoptionsoptions\"><code>downloadItem.setSaveDialogOptions(options)</code></a></h4>\n<ul>\n<li><code>options</code> SaveDialogOptions - Set the save file dialog options. This object has the same properties as the <code>options</code> parameter of <a href=\"/docs/api/dialog\"><code>dialog.showSaveDialog()</code></a>.</li>\n</ul>\n<p>This API allows the user to set custom options for the save dialog that opens for the download item by default. The API is only available in session's <code>will-download</code> callback function.</p>\n<h4 id=\"downloaditemgetsavedialogoptions\"><a href=\"#downloaditemgetsavedialogoptions\"><code>downloadItem.getSaveDialogOptions()</code></a></h4>\n<p>Returns <code>SaveDialogOptions</code> - Returns the object previously set by <code>downloadItem.setSaveDialogOptions(options)</code>.</p>\n<h4 id=\"downloaditempause\"><a href=\"#downloaditempause\"><code>downloadItem.pause()</code></a></h4>\n<p>Pauses the download.</p>\n<h4 id=\"downloaditemispaused\"><a href=\"#downloaditemispaused\"><code>downloadItem.isPaused()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the download is paused.</p>\n<h4 id=\"downloaditemresume\"><a href=\"#downloaditemresume\"><code>downloadItem.resume()</code></a></h4>\n<p>Resumes the download that has been paused.</p>\n<p><strong>Note:</strong> To enable resumable downloads the server you are downloading from must support range requests and provide both <code>Last-Modified</code> and <code>ETag</code> header values. Otherwise <code>resume()</code> will dismiss previously received bytes and restart the download from the beginning.</p>\n<h4 id=\"downloaditemcanresume\"><a href=\"#downloaditemcanresume\"><code>downloadItem.canResume()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the download can resume.</p>\n<h4 id=\"downloaditemcancel\"><a href=\"#downloaditemcancel\"><code>downloadItem.cancel()</code></a></h4>\n<p>Cancels the download operation.</p>\n<h4 id=\"downloaditemgeturl\"><a href=\"#downloaditemgeturl\"><code>downloadItem.getURL()</code></a></h4>\n<p>Returns <code>String</code> - The origin URL where the item is downloaded from.</p>\n<h4 id=\"downloaditemgetmimetype\"><a href=\"#downloaditemgetmimetype\"><code>downloadItem.getMimeType()</code></a></h4>\n<p>Returns <code>String</code> - The files mime type.</p>\n<h4 id=\"downloaditemhasusergesture\"><a href=\"#downloaditemhasusergesture\"><code>downloadItem.hasUserGesture()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the download has user gesture.</p>\n<h4 id=\"downloaditemgetfilename\"><a href=\"#downloaditemgetfilename\"><code>downloadItem.getFilename()</code></a></h4>\n<p>Returns <code>String</code> - The file name of the download item.</p>\n<p><strong>Note:</strong> The file name is not always the same as the actual one saved in local disk. If user changes the file name in a prompted download saving dialog, the actual name of saved file will be different.</p>\n<h4 id=\"downloaditemgettotalbytes\"><a href=\"#downloaditemgettotalbytes\"><code>downloadItem.getTotalBytes()</code></a></h4>\n<p>Returns <code>Integer</code> - The total size in bytes of the download item.</p>\n<p>If the size is unknown, it returns 0.</p>\n<h4 id=\"downloaditemgetreceivedbytes\"><a href=\"#downloaditemgetreceivedbytes\"><code>downloadItem.getReceivedBytes()</code></a></h4>\n<p>Returns <code>Integer</code> - The received bytes of the download item.</p>\n<h4 id=\"downloaditemgetcontentdisposition\"><a href=\"#downloaditemgetcontentdisposition\"><code>downloadItem.getContentDisposition()</code></a></h4>\n<p>Returns <code>String</code> - The Content-Disposition field from the response header.</p>\n<h4 id=\"downloaditemgetstate\"><a href=\"#downloaditemgetstate\"><code>downloadItem.getState()</code></a></h4>\n<p>Returns <code>String</code> - The current state. Can be <code>progressing</code>, <code>completed</code>, <code>cancelled</code> or <code>interrupted</code>.</p>\n<p><strong>Note:</strong> The following methods are useful specifically to resume a <code>cancelled</code> item when session is restarted.</p>\n<h4 id=\"downloaditemgeturlchain\"><a href=\"#downloaditemgeturlchain\"><code>downloadItem.getURLChain()</code></a></h4>\n<p>Returns <code>String[]</code> - The complete URL chain of the item including any redirects.</p>\n<h4 id=\"downloaditemgetlastmodifiedtime\"><a href=\"#downloaditemgetlastmodifiedtime\"><code>downloadItem.getLastModifiedTime()</code></a></h4>\n<p>Returns <code>String</code> - Last-Modified header value.</p>\n<h4 id=\"downloaditemgetetag\"><a href=\"#downloaditemgetetag\"><code>downloadItem.getETag()</code></a></h4>\n<p>Returns <code>String</code> - ETag header value.</p>\n<h4 id=\"downloaditemgetstarttime\"><a href=\"#downloaditemgetstarttime\"><code>downloadItem.getStartTime()</code></a></h4>\n<p>Returns <code>Double</code> - Number of seconds since the UNIX epoch when the download was started.</p>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<h4 id=\"downloaditemsavepath\"><a href=\"#downloaditemsavepath\"><code>downloadItem.savePath</code></a></h4>\n<p>A <code>String</code> property that determines the save file path of the download item.</p>\n<p>The property is only available in session's <code>will-download</code> callback function. If user doesn't set the save path via the property, Electron will use the original routine to determine the save path; this usually prompts a save dialog.</p>",
      "title": "DownloadItem",
      "description": "Control file downloads from remote sources."
    },
    "/docs/tutorial/electron-timelines": {
      "locale": "de-DE",
      "slug": "electron-timelines",
      "href": "/docs/tutorial/electron-timelines",
      "crowdinFileId": "256197",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/electron-timelines.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"графики-выпуска-electron\"><a href=\"#графики-выпуска-electron\">Графики выпуска Electron</a></h1>\n<p>Special notes:</p>\n<ul>\n<li>The <code>-beta.1</code> and <code>stable</code> dates are our solid release dates.</li>\n<li>We strive for weekly beta releases, however we often release more betas than scheduled.</li>\n<li>All dates are our goals but there may be reasons for adjusting the stable deadline, such as security bugs.</li>\n<li>Take a look at the <a href=\"https://electronjs.org/blog/electron-5-0-timeline\">5.0.0 Timeline blog post</a> for info about publicizing our release dates.</li>\n<li>Since Electron 6.0, we've been targeting every other Chromium version and releasing our stable on the same day as Chrome stable. You can reference Chromium's release schedule <a href=\"https://chromiumdash.appspot.com/schedule\">here</a>. See <a href=\"https://www.electronjs.org/blog/12-week-cadence\">Electron's new release cadence blog post</a> for more details on our release schedule.</li>\n<li>Electron 15.0 only will include a special Alpha release. Starting in Electron 16.0, we will release on an 8-week cadence. See <a href=\"https://www.electronjs.org/blog/8-week-cadence\">Electron's new 8-week cadence blog post</a> for more details.</li>\n</ul>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Electron</th><th>Alpha</th><th>Beta</th><th>Stabil</th><th>Chrome</th><th>Node</th></tr></thead><tbody><tr><td>2.0.0</td><td>--</td><td>2018-Feb-21</td><td>2018-May-01</td><td>M61</td><td>v8.9</td></tr><tr><td>3.0.0</td><td>--</td><td>2018-Jun-21</td><td>2018-Sep-18</td><td>M66</td><td>v10.2</td></tr><tr><td>4.0.0</td><td>--</td><td>2018-Oct-11</td><td>2018-Dec-20</td><td>M69</td><td>v10.11</td></tr><tr><td>5.0.0</td><td>--</td><td>2019-Jan-22</td><td>2019-Apr-24</td><td>M73</td><td>v12.0</td></tr><tr><td>6.0.0</td><td>--</td><td>2019-May-01</td><td>2019-Jul-30</td><td>M76</td><td>v12.4</td></tr><tr><td>7.0.0</td><td>--</td><td>2019-Aug-01</td><td>2019-Oct-22</td><td>M78</td><td>v12.8</td></tr><tr><td>8.0.0</td><td>--</td><td>2019-Oct-24</td><td>2020-Feb-04</td><td>M80</td><td>v12.13</td></tr><tr><td>9.0.0</td><td>--</td><td>2020-Feb-06</td><td>2020-May-19</td><td>M83</td><td>v12.14</td></tr><tr><td>10.0.0</td><td>--</td><td>2020-May-21</td><td>2020-Aug-25</td><td>M85</td><td>v12.16</td></tr><tr><td>11.0.0</td><td>--</td><td>2020-Aug-27</td><td>2020-Nov-17</td><td>M87</td><td>v12.18</td></tr><tr><td>12.0.0</td><td>--</td><td>2020-Nov-19</td><td>2021-Mar-02</td><td>M89</td><td>v14.16</td></tr><tr><td>13.0.0</td><td>--</td><td>2021-Mar-04</td><td>2021-May-25</td><td>M91</td><td>v14.16</td></tr><tr><td>14.0.0</td><td>--</td><td>2021-May-27</td><td>2021-Aug-31</td><td>M93</td><td>v14.17</td></tr><tr><td>15.0.0</td><td>2021-Jul-20</td><td>2021-Sep-01</td><td>2021-Sep-21</td><td>M94</td><td>v16.5</td></tr><tr><td>16.0.0</td><td>--</td><td>2021-Sep-23</td><td>2021-Nov-16</td><td>M96</td><td>TBD</td></tr></tbody></table>",
      "title": "Графики выпуска Electron",
      "description": ""
    },
    "/docs/tutorial/electron-versioning": {
      "locale": "de-DE",
      "slug": "electron-versioning",
      "href": "/docs/tutorial/electron-versioning",
      "crowdinFileId": "256199",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/electron-versioning.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"versionierung-von-electron\"><a href=\"#versionierung-von-electron\">Versionierung von Electron</a></h1>\n<blockquote>\n<p>A detailed look at our versioning policy and implementation.</p>\n</blockquote>\n<p>As of version 2.0.0, Electron follows <a href=\"#semver\">SemVer</a>. The following command will install the most recent stable build of Electron:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron\n</code></pre>\n<p>To update an existing project to use the latest stable version:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron@latest\n</code></pre>\n<h2 id=\"version-1x\"><a href=\"#version-1x\">Version 1.x</a></h2>\n<p>Electron versions <em>&#x3C; 2.0</em> did not conform to the <a href=\"https://semver.org\">SemVer</a> spec: major versions corresponded to end-user API changes, minor versions corresponded to Chromium major releases, and patch versions corresponded to new features and bug fixes. While convenient for developers merging features, it creates problems for developers of client-facing applications. The QA testing cycles of major apps like Slack, Stride, Teams, Skype, VS Code, Atom, and Desktop can be lengthy and stability is a highly desired outcome. There is a high risk in adopting new features while trying to absorb bug fixes.</p>\n<p>Here is an example of the 1.x strategy:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-0.png\" alt=\"1.x Versioning\"></p>\n<p>An app developed with <code>1.8.1</code> cannot take the <code>1.8.3</code> bug fix without either absorbing the <code>1.8.2</code> feature, or by backporting the fix and maintaining a new release line.</p>\n<h2 id=\"version-20-and-beyond\"><a href=\"#version-20-and-beyond\">Version 2.0 and Beyond</a></h2>\n<p>There are several major changes from our 1.x strategy outlined below. Each change is intended to satisfy the needs and priorities of developers/maintainers and app developers.</p>\n<ol>\n<li>Strict use of SemVer</li>\n<li>Introduction of semver-compliant <code>-beta</code> tags</li>\n<li>Introduction of <a href=\"https://conventionalcommits.org/\">conventional commit messages</a></li>\n<li>Well-defined stabilization branches</li>\n<li>The <code>master</code> branch is versionless; only stabilization branches contain version information</li>\n</ol>\n<p>We will cover in detail how git branching works, how npm tagging works, what developers should expect to see, and how one can backport changes.</p>\n<h1 id=\"semver\"><a href=\"#semver\">SemVer</a></h1>\n<p>From 2.0 onward, Electron will follow SemVer.</p>\n<p>Below is a table explicitly mapping types of changes to their corresponding category of SemVer (e.g. Major, Minor, Patch).</p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Major Version Increments</th><th>Minor Version Increments</th><th>Patch Version Increments</th></tr></thead><tbody><tr><td>Electron breaking API changes</td><td>Electron non-breaking API changes</td><td>Electron bug fixes</td></tr><tr><td>Node.js major version updates</td><td>Node.js minor version updates</td><td>Node.js patch version updates</td></tr><tr><td>Chromium version updates</td><td></td><td>fix-related chromium patches</td></tr></tbody></table>\n<p>Note that most Chromium updates will be considered breaking. Fixes that can be backported will likely be cherry-picked as patches.</p>\n<h1 id=\"stabillisations-branches\"><a href=\"#stabillisations-branches\">Stabillisations Branches</a></h1>\n<p>Stabilization branches are branches that run parallel to master, taking in only cherry-picked commits that are related to security or stability. These branches are never merged back to master.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-1.png\" alt=\"Stabillisations Branches\"></p>\n<p>Since Electron 8, stabilization branches are always <strong>major</strong> version lines, and named against the following template <code>$MAJOR-x-y</code> e.g. <code>8-x-y</code>.  Prior to that we used <strong>minor</strong> version lines and named them as <code>$MAJOR-$MINOR-x</code> e.g. <code>2-0-x</code></p>\n<p>We allow for multiple stabilization branches to exist simultaneously, and intend to support at least two in parallel at all times, backporting security fixes as necessary. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-2.png\" alt=\"Multiple Stability Branches\"></p>\n<p>Older lines will not be supported by GitHub, but other groups can take ownership and backport stability and security fixes on their own. We discourage this, but recognize that it makes life easier for many app developers.</p>\n<h1 id=\"beta-versionen-und-fehlerbehebungen\"><a href=\"#beta-versionen-und-fehlerbehebungen\">Beta-Versionen und Fehlerbehebungen</a></h1>\n<p>Developers want to know which releases are <em>safe</em> to use. Even seemingly innocent features can introduce regressions in complex applications. At the same time, locking to a fixed version is dangerous because you’re ignoring security patches and bug fixes that may have come out since your version. Our goal is to allow the following standard semver ranges in <code>package.json</code> :</p>\n<ul>\n<li>Use <code>~2.0.0</code> to admit only stability or security related fixes to your <code>2.0.0</code> release.</li>\n<li>Use <code>^2.0.0</code> to admit non-breaking <em>reasonably stable</em> feature work as well as security and bug fixes.</li>\n</ul>\n<p>What’s important about the second point is that apps using <code>^</code> should still be able to expect a reasonable level of stability. To accomplish this, SemVer allows for a <em>pre-release identifier</em> to indicate a particular version is not yet <em>safe</em> or <em>stable</em>.</p>\n<p>Whatever you choose, you will periodically have to bump the version in your <code>package.json</code> as breaking changes are a fact of Chromium life.</p>\n<p>The process is as follows:</p>\n<ol>\n<li>All new major and minor releases lines begin with a beta series indicated by SemVer prerelease tags of <code>beta.N</code>, e.g. <code>2.0.0-beta.1</code>. After the first beta, subsequent beta releases must meet all of the following conditions:<ol>\n<li>The change is backwards API-compatible (deprecations are allowed)</li>\n<li>The risk to meeting our stability timeline must be low.</li>\n</ol></li>\n<li>If allowed changes need to be made once a release is beta, they are applied and the prerelease tag is incremented, e.g. <code>2.0.0-beta.2</code>.</li>\n<li>If a particular beta release is <em>generally regarded</em> as stable, it will be re-released as a stable build, changing only the version information. e.g. <code>2.0.0</code>. After the first stable, all changes must be backwards-compatible bug or security fixes.</li>\n<li>If future bug fixes or security patches need to be made once a release is stable, they are applied and the <em>patch</em> version is incremented e.g. <code>2.0.1</code>.</li>\n</ol>\n<p>Specifically, the above means:</p>\n<ol>\n<li>Admitting non-breaking-API changes before Week 3 in the beta cycle is okay, even if those changes have the potential to cause moderate side-effects.</li>\n<li>Admitting feature-flagged changes, that do not otherwise alter existing code paths, at most points in the beta cycle is okay. Users can explicitly enable those flags in their apps.</li>\n<li>Admitting features of any sort after Week 3 in the beta cycle is 👎 without a very good reason.</li>\n</ol>\n<p>For each major and minor bump, you should expect to see something like the following:</p>\n<pre><code class=\"hljs language-plaintext\">2.0.0-beta.1\n2.0.0-beta.2\n2.0.0-beta.3\n2.0.0\n2.0.1\n2.0.2\n</code></pre>\n<p>An example lifecycle in pictures:</p>\n<ul>\n<li>A new release branch is created that includes the latest set of features. It is published as <code>2.0.0-beta.1</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-3.png\" alt=\"New Release Branch\"></li>\n<li>A bug fix comes into master that can be backported to the release branch. The patch is applied, and a new beta is published as <code>2.0.0-beta.2</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-4.png\" alt=\"Bugfix Backport to Beta\"></li>\n<li>The beta is considered <em>generally stable</em> and it is published again as a non-beta under <code>2.0.0</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-5.png\" alt=\"Beta to Stable\"></li>\n<li>Later, a zero-day exploit is revealed and a fix is applied to master. We backport the fix to the <code>2-0-x</code> line and release <code>2.0.1</code>. <img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-6.png\" alt=\"Security Backports\"></li>\n</ul>\n<p>A few examples of how various SemVer ranges will pick up new releases:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/versioning-sketch-7.png\" alt=\"Semvers and Releases\"></p>\n<h1 id=\"missing-features-alphas\"><a href=\"#missing-features-alphas\">Missing Features: Alphas</a></h1>\n<p>Our strategy has a few tradeoffs, which for now we feel are appropriate. Most importantly that new features in master may take a while before reaching a stable release line. If you want to try a new feature immediately, you will have to build Electron yourself.</p>\n<p>As a future consideration, we may introduce one or both of the following:</p>\n<ul>\n<li>alpha releases that have looser stability constraints to betas; for example it would be allowable to admit new features while a stability channel is in <em>alpha</em></li>\n</ul>\n<h1 id=\"feature-flags\"><a href=\"#feature-flags\">Feature Flags</a></h1>\n<p>Feature flags are a common practice in Chromium, and are well-established in the web-development ecosystem. In the context of Electron, a feature flag or <strong>soft branch</strong> must have the following properties:</p>\n<ul>\n<li>it is enabled/disabled either at runtime, or build-time; we do not support the concept of a request-scoped feature flag</li>\n<li>it completely segments new and old code paths; refactoring old code to support a new feature <em>violates</em> the feature-flag contract</li>\n<li>feature flags are eventually removed after the feature is released</li>\n</ul>\n<h1 id=\"semantic-commits\"><a href=\"#semantic-commits\">Semantic Commits</a></h1>\n<p>We seek to increase clarity at all levels of the update and releases process. Starting with <code>2.0.0</code> we will require pull requests adhere to the <a href=\"https://conventionalcommits.org/\">Conventional Commits</a> spec, which can be summarized as follows:</p>\n<ul>\n<li>\n<p>Commits that would result in a SemVer <strong>major</strong> bump must start their body with <code>BREAKING CHANGE:</code>.</p>\n</li>\n<li>\n<p>Commits that would result in a SemVer <strong>minor</strong> bump must start with <code>feat:</code>.</p>\n</li>\n<li>\n<p>Commits that would result in a SemVer <strong>patch</strong> bump must start with <code>fix:</code>.</p>\n</li>\n<li>\n<p>We allow squashing of commits, provided that the squashed message adheres to the above message format.</p>\n</li>\n<li>\n<p>It is acceptable for some commits in a pull request to not include a semantic prefix, as long as the pull request title contains a meaningful encompassing semantic message.</p>\n</li>\n</ul>\n<h1 id=\"versioned-master\"><a href=\"#versioned-master\">Versioned <code>master</code></a></h1>\n<ul>\n<li>The <code>master</code> branch will always contain the next major version <code>X.0.0-nightly.DATE</code> in its <code>package.json</code></li>\n<li>Release branches are never merged back to master</li>\n<li>Release branches <em>do</em> contain the correct version in their <code>package.json</code></li>\n<li>As soon as a release branch is cut for a major, master must be bumped to the next major.  I.e. <code>master</code> is always versioned as the next theoretical release branch</li>\n</ul>",
      "title": "Versionierung von Electron",
      "description": "A detailed look at our versioning policy and implementation."
    },
    "/docs/development/electron-vs-nwjs": {
      "locale": "de-DE",
      "slug": "electron-vs-nwjs",
      "href": "/docs/development/electron-vs-nwjs",
      "crowdinFileId": "256155",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/electron-vs-nwjs.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"technical-differences-between-electron-and-nwjs\"><a href=\"#technical-differences-between-electron-and-nwjs\">Technical Differences Between Electron and NW.js</a></h1>\n<p>Like <a href=\"https://nwjs.io/\">NW.js</a>, Electron provides a platform to write desktop applications with web technologies. Both platforms enable developers to utilize HTML, JavaScript, and Node.js. On the surface, they seem very similar.</p>\n<p>There are however fundamental differences between the two projects that make Electron a completely separate product from NW.js.</p>\n<h2 id=\"1-entry-of-application\"><a href=\"#1-entry-of-application\">1) Entry of Application</a></h2>\n<p>In NW.js, the main entry point of an application can be an HTML web page. In that case, NW.js will open the given entry point in a browser window.</p>\n<p>In Electron, the entry point is always a JavaScript script. Instead of providing a URL directly, you manually create a browser window and load an HTML file using the API. You also need to listen to window events to decide when to quit the application.</p>\n<p>Electron works more like the Node.js runtime. Electron's APIs are lower level so you can use it for browser testing in place of <a href=\"https://phantomjs.org/\">PhantomJS</a>.</p>\n<h2 id=\"2-node-integration\"><a href=\"#2-node-integration\">2) Node Integration</a></h2>\n<p>In NW.js, the Node integration in web pages requires patching Chromium to work, while in Electron we chose a different way to integrate the <code>libuv</code> loop with each platform's message loop to avoid hacking Chromium. See the <a href=\"https://github.com/electron/electron/tree/main/lib/common\"><code>node_bindings</code></a> code for how that was done.</p>\n<h2 id=\"3-javascript-contexts\"><a href=\"#3-javascript-contexts\">3) JavaScript Contexts</a></h2>\n<p>If you are an experienced NW.js user, you should be familiar with the concept of Node context and web context. These concepts were invented because of how NW.js was implemented.</p>\n<p>By using the <a href=\"https://github.com/nodejs/node-v0.x-archive/commit/756b622\">multi-context</a> feature of Node, Electron doesn't introduce a new JavaScript context in web pages.</p>\n<p>Note: NW.js has optionally supported multi-context since 0.13.</p>\n<h2 id=\"4-legacy-support\"><a href=\"#4-legacy-support\">4) Legacy Support</a></h2>\n<p>NW.js still offers a \"legacy release\" that supports Windows XP. It doesn't receive security updates.</p>\n<p>Given that hardware manufacturers, Microsoft, Chromium, and Node.js haven't released even critical security updates for that system, we have to warn you that using Windows XP is wildly insecure and outright irresponsible.</p>\n<p>However, we understand that requirements outside our wildest imagination may exist, so if you're looking for something like Electron that runs on Windows XP, the NW.js legacy release might be the right fit for you.</p>\n<h2 id=\"5-features\"><a href=\"#5-features\">5) Features</a></h2>\n<p>There are numerous differences in the amount of supported features. Electron has a bigger community, more production apps using it, and <a href=\"https://www.npmjs.com/search?q=electron\">a large amount of userland modules available on npm</a>.</p>\n<p>As an example, Electron has built-in support for automatic updates and countless tools that make the creation of installers easier. As an example in favor of NW.js, NW.js supports more <code>Chrome.*</code> APIs for the development of Chrome Apps.</p>\n<p>Naturally, we believe that Electron is the better platform for polished production applications built with web technologies (like Visual Studio Code, Slack, or Facebook Messenger); however, we want to be fair to our web technology friends. If you have feature needs that Electron does not meet, you might want to try NW.js.</p>",
      "title": "Technical Differences Between Electron and NW.js",
      "description": ""
    },
    "/docs/api/environment-variables": {
      "locale": "de-DE",
      "slug": "environment-variables",
      "href": "/docs/api/environment-variables",
      "crowdinFileId": "256315",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/environment-variables.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"umgebungsvariablen\"><a href=\"#umgebungsvariablen\">Umgebungsvariablen</a></h1>\n<blockquote>\n<p>Die Konfiguration und das Verhalten des Programms kontrollieren ohne das Programm umzuschreiben.</p>\n</blockquote>\n<p>Certain Electron behaviors are controlled by environment variables because they are initialized earlier than the command line flags and the app's code.</p>\n<p>POSIX shell example:</p>\n<pre><code class=\"hljs language-sh\">$ <span class=\"hljs-built_in\">export</span> ELECTRON_ENABLE_LOGGING=<span class=\"hljs-literal\">true</span>\n$ electron\n</code></pre>\n<p>Windows console example:</p>\n<pre><code class=\"hljs language-powershell\">> set ELECTRON_ENABLE_LOGGING=true\n> electron\n</code></pre>\n<h2 id=\"production-variables\"><a href=\"#production-variables\">Production Variables</a></h2>\n<p>The following environment variables are intended primarily for use at runtime in packaged Electron applications.</p>\n<h3 id=\"node_options\"><a href=\"#node_options\"><code>NODE_OPTIONS</code></a></h3>\n<p>Electron includes support for a subset of Node's <a href=\"https://nodejs.org/api/cli.html#cli_node_options_options\"><code>NODE_OPTIONS</code></a>. The majority are supported with the exception of those which conflict with Chromium's use of BoringSSL.</p>\n<p>Beispiel:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">export</span> NODE_OPTIONS=<span class=\"hljs-string\">\"--no-warnings --max-old-space-size=2048\"</span>\n</code></pre>\n<p>Unsupported options are:</p>\n<pre><code class=\"hljs language-sh\">--use-bundled-ca\n--force-fips\n--<span class=\"hljs-built_in\">enable</span>-fips\n--openssl-config\n--use-openssl-ca\n</code></pre>\n<p><code>NODE_OPTIONS</code> are explicitly disallowed in packaged apps, except for the following:</p>\n<pre><code class=\"hljs language-sh\">--max-http-header-size\n--http-parser\n</code></pre>\n<h3 id=\"google_api_key\"><a href=\"#google_api_key\"><code>GOOGLE_API_KEY</code></a></h3>\n<p>Geolocation support in Electron requires the use of Google Cloud Platform's geolocation webservice. To enable this feature, acquire a <a href=\"https://developers.google.com/maps/documentation/geolocation/get-api-key\">Google API key</a> and place the following code in your main process file, before opening any browser windows that will make geolocation requests:</p>\n<pre><code class=\"hljs language-javascript\">process.env.GOOGLE_API_KEY = <span class=\"hljs-string\">'YOUR_KEY_HERE'</span>\n</code></pre>\n<p>By default, a newly generated Google API key may not be allowed to make geolocation requests. To enable the geolocation webservice for your project, enable it through the <a href=\"https://console.cloud.google.com/apis/library\">API library</a>.</p>\n<p>N.B. You will need to add a <a href=\"https://cloud.google.com/billing/docs/how-to/payment-methods#add_a_payment_method\">Billing Account</a> to the project associated to the API key for the geolocation webservice to work.</p>\n<h3 id=\"electron_no_asar\"><a href=\"#electron_no_asar\"><code>ELECTRON_NO_ASAR</code></a></h3>\n<p>Disables ASAR support. This variable is only supported in forked child processes and spawned child processes that set <code>ELECTRON_RUN_AS_NODE</code>.</p>\n<h3 id=\"electron_run_as_node\"><a href=\"#electron_run_as_node\"><code>ELECTRON_RUN_AS_NODE</code></a></h3>\n<p>Starts the process as a normal Node.js process.</p>\n<p>In this mode, you will be able to pass <a href=\"https://nodejs.org/api/cli.html\">cli options</a> to Node.js as you would when running the normal Node.js executable, with the exception of the following flags:</p>\n<ul>\n<li>\"--openssl-config\"</li>\n<li>\"--use-bundled-ca\"</li>\n<li>\"--use-openssl-ca\",</li>\n<li>\"--force-fips\"</li>\n<li>\"--enable-fips\"</li>\n</ul>\n<p>These flags are disabled owing to the fact that Electron uses BoringSSL instead of OpenSSL when building Node.js' <code>crypto</code> module, and so will not work as designed.</p>\n<h3 id=\"electron_no_attach_console-windows\"><a href=\"#electron_no_attach_console-windows\"><code>ELECTRON_NO_ATTACH_CONSOLE</code> <em>Windows</em></a></h3>\n<p>Don't attach to the current console session.</p>\n<h3 id=\"electron_force_window_menu_bar-linux\"><a href=\"#electron_force_window_menu_bar-linux\"><code>ELECTRON_FORCE_WINDOW_MENU_BAR</code> <em>Linux</em></a></h3>\n<p>Don't use the global menu bar on Linux.</p>\n<h3 id=\"electron_trash-linux\"><a href=\"#electron_trash-linux\"><code>ELECTRON_TRASH</code> <em>Linux</em></a></h3>\n<p>Set the trash implementation on Linux. Standard ist <code>gio</code>.</p>\n<p>Options:</p>\n<ul>\n<li><code>gvfs-trash</code></li>\n<li><code>trash-cli</code></li>\n<li><code>kioclient5</code></li>\n<li><code>kioclient</code></li>\n</ul>\n<h2 id=\"development-variables\"><a href=\"#development-variables\">Development Variables</a></h2>\n<p>The following environment variables are intended primarily for development and debugging purposes.</p>\n<h3 id=\"electron_enable_logging\"><a href=\"#electron_enable_logging\"><code>ELECTRON_ENABLE_LOGGING</code></a></h3>\n<p>Prints Chromium's internal logging to the console.</p>\n<p>Setting this variable is the same as passing <code>--enable-logging</code> on the command line. For more info, see <code>--enable-logging</code> in <a href=\"/docs/api/command-line-switches#enable-loggingfile\">command-line switches</a>.</p>\n<h3 id=\"electron_log_file\"><a href=\"#electron_log_file\"><code>ELECTRON_LOG_FILE</code></a></h3>\n<p>Sets the file destination for Chromium's internal logging.</p>\n<p>Setting this variable is the same as passing <code>--log-file</code> on the command line. For more info, see <code>--log-file</code> in <a href=\"/docs/api/command-line-switches#log-filepath\">command-line switches</a>.</p>\n<h3 id=\"electron_debug_drag_regions\"><a href=\"#electron_debug_drag_regions\"><code>ELECTRON_DEBUG_DRAG_REGIONS</code></a></h3>\n<p>Adds coloration to draggable regions on <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>s on macOS - draggable regions will be colored green and non-draggable regions will be colored red to aid debugging.</p>\n<h3 id=\"electron_debug_notifications\"><a href=\"#electron_debug_notifications\"><code>ELECTRON_DEBUG_NOTIFICATIONS</code></a></h3>\n<p>Adds extra logs to <a href=\"/docs/api/notification\"><code>Notification</code></a> lifecycles on macOS to aid in debugging. Extra logging will be displayed when new Notifications are created or activated. They will also be displayed when common a tions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.</p>\n<p>Sample output:</p>\n<pre><code class=\"hljs language-sh\">Notification created (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification displayed (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification activated (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\nNotification replied to (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)\n</code></pre>\n<h3 id=\"electron_log_asar_reads\"><a href=\"#electron_log_asar_reads\"><code>ELECTRON_LOG_ASAR_READS</code></a></h3>\n<p>When Electron reads from an ASAR file, log the read offset and file path to the system <code>tmpdir</code>. The resulting file can be provided to the ASAR module to optimize file ordering.</p>\n<h3 id=\"electron_enable_stack_dumping\"><a href=\"#electron_enable_stack_dumping\"><code>ELECTRON_ENABLE_STACK_DUMPING</code></a></h3>\n<p>Prints the stack trace to the console when Electron crashes.</p>\n<p>This environment variable will not work if the <code>crashReporter</code> is started.</p>\n<h3 id=\"electron_default_error_mode-windows\"><a href=\"#electron_default_error_mode-windows\"><code>ELECTRON_DEFAULT_ERROR_MODE</code> <em>Windows</em></a></h3>\n<p>Shows the Windows's crash dialog when Electron crashes.</p>\n<p>This environment variable will not work if the <code>crashReporter</code> is started.</p>\n<h3 id=\"electron_override_dist_path\"><a href=\"#electron_override_dist_path\"><code>ELECTRON_OVERRIDE_DIST_PATH</code></a></h3>\n<p>When running from the <code>electron</code> package, this variable tells the <code>electron</code> command to use the specified build of Electron instead of the one downloaded by <code>npm install</code>. Nutzung:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">export</span> ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Testing\n</code></pre>\n<h2 id=\"set-by-electron\"><a href=\"#set-by-electron\">Set By Electron</a></h2>\n<p>Electron sets some variables in your environment at runtime.</p>\n<h3 id=\"original_xdg_current_desktop\"><a href=\"#original_xdg_current_desktop\"><code>ORIGINAL_XDG_CURRENT_DESKTOP</code></a></h3>\n<p>This variable is set to the value of <code>XDG_CURRENT_DESKTOP</code> that your application originally launched with.  Electron sometimes modifies the value of <code>XDG_CURRENT_DESKTOP</code> to affect other logic within Chromium so if you want access to the <em>original</em> value you should look up this environment variable instead.</p>",
      "title": "Umgebungsvariablen",
      "description": "Die Konfiguration und das Verhalten des Programms kontrollieren ohne das Programm umzuschreiben."
    },
    "/docs/api/structures/event": {
      "locale": "de-DE",
      "slug": "event",
      "href": "/docs/api/structures/event",
      "crowdinFileId": "256429",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"event-object-extends-globalevent\"><a href=\"#event-object-extends-globalevent\">Event Object extends <code>GlobalEvent</code></a></h1>\n<ul>\n<li><code>preventDefault</code> VoidFunction</li>\n</ul>",
      "title": "Event Object extends GlobalEvent",
      "description": ""
    },
    "/docs/experimental": {
      "locale": "de-DE",
      "slug": "experimental",
      "href": "/docs/experimental",
      "crowdinFileId": "256119",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/experimental.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"experimental-apis\"><a href=\"#experimental-apis\">Experimental APIs</a></h1>\n<p>Some of Electrons APIs are tagged with <code>_Experimental_</code> in the documentation. This tag indicates that the API may not be considered stable and the API may be removed or modified more frequently than other APIs with less warning.</p>\n<h2 id=\"conditions-for-an-api-to-be-tagged-as-experimental\"><a href=\"#conditions-for-an-api-to-be-tagged-as-experimental\">Conditions for an API to be tagged as Experimental</a></h2>\n<p>Anyone can request an API be tagged as experimental in a feature PR, disagreements on the experimental nature of a feature can be discussed in the API WG if they can't be resolved in the PR.</p>\n<h2 id=\"process-for-removing-the-experimental-tag\"><a href=\"#process-for-removing-the-experimental-tag\">Process for removing the Experimental tag</a></h2>\n<p>Once an API has been stable and in at least two major stable release lines it can be nominated to have its experimental tag removed.  This discussion should happen at an API WG meeting.  Things to consider when discussing / nominating:</p>\n<ul>\n<li>The above \"two major stables release lines\" condition must have been met</li>\n<li>During that time no major bugs / issues should have been caused by the adoption of this feature</li>\n<li>The API is stable enough and hasn't been heavily impacted by Chromium upgrades</li>\n<li>Is anyone using the API?</li>\n<li>Is the API fulfilling the original proposed usecases, does it have any gaps?</li>\n</ul>",
      "title": "Experimental APIs",
      "description": ""
    },
    "/docs/api/structures/extension": {
      "locale": "de-DE",
      "slug": "extension",
      "href": "/docs/api/structures/extension",
      "crowdinFileId": "256433",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/extension.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"extension-object\"><a href=\"#extension-object\">Extension Object</a></h1>\n<ul>\n<li><code>id</code> Zeichenfolge</li>\n<li><code>manifest</code> any - Copy of the <a href=\"https://developer.chrome.com/extensions/manifest\">extension's manifest data</a>.</li>\n<li><code>name</code> Zeichenfolge</li>\n<li><code>path</code> String - The extension's file path.</li>\n<li><code>version</code> String</li>\n<li><code>url</code> String - The extension's <code>chrome-extension://</code> URL.</li>\n</ul>",
      "title": "Extension Object",
      "description": ""
    },
    "/docs/api/structures/extension-info": {
      "locale": "de-DE",
      "slug": "extension-info",
      "href": "/docs/api/structures/extension-info",
      "crowdinFileId": "256431",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/extension-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"extensioninfo-object\"><a href=\"#extensioninfo-object\">ExtensionInfo Object</a></h1>\n<ul>\n<li><code>name</code> Zeichenfolge</li>\n<li><code>version</code> String</li>\n</ul>",
      "title": "ExtensionInfo Object",
      "description": ""
    },
    "/docs/api/extensions": {
      "locale": "de-DE",
      "slug": "extensions",
      "href": "/docs/api/extensions",
      "crowdinFileId": "256317",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/extensions.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"chrome-extension-support\"><a href=\"#chrome-extension-support\">Chrome Extension Support</a></h1>\n<p>Electron supports a subset of the <a href=\"https://developer.chrome.com/extensions/api_index\">Chrome Extensions API</a>, primarily to support DevTools extensions and Chromium-internal extensions, but it also happens to support some other extension capabilities.</p>\n<blockquote>\n<p><strong>Note:</strong> Electron does not support arbitrary Chrome extensions from the store, and it is a <strong>non-goal</strong> of the Electron project to be perfectly compatible with Chrome's implementation of Extensions.</p>\n</blockquote>\n<h2 id=\"loading-extensions\"><a href=\"#loading-extensions\">Loading extensions</a></h2>\n<p>Electron only supports loading unpacked extensions (i.e., <code>.crx</code> files do not work). Extensions are installed per-<code>session</code>. To load an extension, call <a href=\"/docs/api/session#sesloadextensionpath-options\"><code>ses.loadExtension</code></a>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession.loadExtension(<span class=\"hljs-string\">'path/to/unpacked/extension'</span>).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ id }</span>) =></span> {\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<p>Loaded extensions will not be automatically remembered across exits; if you do not call <code>loadExtension</code> when the app runs, the extension will not be loaded.</p>\n<p>Note that loading extensions is only supported in persistent sessions. Attempting to load an extension into an in-memory session will throw an error.</p>\n<p>See the <a href=\"/docs/api/session\"><code>session</code></a> documentation for more information about loading, unloading, and querying active extensions.</p>\n<h2 id=\"supported-extensions-apis\"><a href=\"#supported-extensions-apis\">Supported Extensions APIs</a></h2>\n<p>We support the following extensions APIs, with some caveats. Other APIs may additionally be supported, but support for any APIs not listed here is provisional and may be removed.</p>\n<h3 id=\"chromedevtoolsinspectedwindow\"><a href=\"#chromedevtoolsinspectedwindow\"><code>chrome.devtools.inspectedWindow</code></a></h3>\n<p>All features of this API are supported.</p>\n<h3 id=\"chromedevtoolsnetwork\"><a href=\"#chromedevtoolsnetwork\"><code>chrome.devtools.network</code></a></h3>\n<p>All features of this API are supported.</p>\n<h3 id=\"chromedevtoolspanels\"><a href=\"#chromedevtoolspanels\"><code>chrome.devtools.panels</code></a></h3>\n<p>All features of this API are supported.</p>\n<h3 id=\"chromeextension\"><a href=\"#chromeextension\"><code>chrome.extension</code></a></h3>\n<p>The following properties of <code>chrome.extension</code> are supported:</p>\n<ul>\n<li><code>chrome.extension.lastError</code></li>\n</ul>\n<p>The following methods of <code>chrome.extension</code> are supported:</p>\n<ul>\n<li><code>chrome.extension.getURL</code></li>\n<li><code>chrome.extension.getBackgroundPage</code></li>\n</ul>\n<h3 id=\"chromeruntime\"><a href=\"#chromeruntime\"><code>chrome.runtime</code></a></h3>\n<p>The following properties of <code>chrome.runtime</code> are supported:</p>\n<ul>\n<li><code>chrome.runtime.lastError</code></li>\n<li><code>chrome.runtime.id</code></li>\n</ul>\n<p>The following methods of <code>chrome.runtime</code> are supported:</p>\n<ul>\n<li><code>chrome.runtime.getBackgroundPage</code></li>\n<li><code>chrome.runtime.getManifest</code></li>\n<li><code>chrome.runtime.getPlatformInfo</code></li>\n<li><code>chrome.runtime.getURL</code></li>\n<li><code>chrome.runtime.connect</code></li>\n<li><code>chrome.runtime.sendMessage</code></li>\n<li><code>chrome.runtime.reload</code></li>\n</ul>\n<p>The following events of <code>chrome.runtime</code> are supported:</p>\n<ul>\n<li><code>chrome.runtime.onStartup</code></li>\n<li><code>chrome.runtime.onInstalled</code></li>\n<li><code>chrome.runtime.onSuspend</code></li>\n<li><code>chrome.runtime.onSuspendCanceled</code></li>\n<li><code>chrome.runtime.onConnect</code></li>\n<li><code>chrome.runtime.onMessage</code></li>\n</ul>\n<h3 id=\"chromestorage\"><a href=\"#chromestorage\"><code>chrome.storage</code></a></h3>\n<p>Only <code>chrome.storage.local</code> is supported; <code>chrome.storage.sync</code> and <code>chrome.storage.managed</code> are not.</p>\n<h3 id=\"chrometabs\"><a href=\"#chrometabs\"><code>chrome.tabs</code></a></h3>\n<p>The following methods of <code>chrome.tabs</code> are supported:</p>\n<ul>\n<li><code>chrome.tabs.sendMessage</code></li>\n<li><code>chrome.tabs.executeScript</code></li>\n</ul>\n<blockquote>\n<p><strong>Note:</strong> In Chrome, passing <code>-1</code> as a tab ID signifies the \"currently active tab\". Since Electron has no such concept, passing <code>-1</code> as a tab ID is not supported and will raise an error.</p>\n</blockquote>\n<h3 id=\"chromemanagement\"><a href=\"#chromemanagement\"><code>chrome.management</code></a></h3>\n<p>The following methods of <code>chrome.management</code> are supported:</p>\n<ul>\n<li><code>chrome.management.getAll</code></li>\n<li><code>chrome.management.get</code></li>\n<li><code>chrome.management.getSelf</code></li>\n<li><code>chrome.management.getPermissionWarningsById</code></li>\n<li><code>chrome.management.getPermissionWarningsByManifest</code></li>\n<li><code>chrome.management.onEnabled</code></li>\n<li><code>chrome.management.onDisabled</code></li>\n</ul>\n<h3 id=\"chromewebrequest\"><a href=\"#chromewebrequest\"><code>chrome.webRequest</code></a></h3>\n<p>All features of this API are supported.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Electron's <a href=\"/docs/api/web-request\"><code>webRequest</code></a> module takes precedence over <code>chrome.webRequest</code> if there are conflicting handlers.</p>\n</blockquote>",
      "title": "Chrome Extension Support",
      "description": "Note: Electron does not support arbitrary Chrome extensions from the store, and it is a non-goal of the Electron project to be perfectly compatible with Chrome's implementation of Extensions."
    },
    "/docs/faq": {
      "locale": "de-DE",
      "slug": "faq",
      "href": "/docs/faq",
      "crowdinFileId": "256121",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/faq.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-faq\"><a href=\"#electron-faq\">Electron FAQ</a></h1>\n<h2 id=\"warum-habe-ich-probleme-bei-der-installation-von-electron\"><a href=\"#warum-habe-ich-probleme-bei-der-installation-von-electron\">Warum habe ich Probleme bei der Installation von Electron?</a></h2>\n<p>Beim Ausführen von <code>npm install electron</code> können bei einigen Nutzern gelegentlich Installationsfehler auftreten.</p>\n<p>In fast allen Fällen sind diese Fehler das Ergebnis von Netzwerkproblemen und nicht von tatsächlichen Problemen mit dem Paket <code>electron</code> npm. Fehler wie <code>ELIFECYCLE</code>, <code>EAI_AGAIN</code>, <code>ECONNRESET</code>, and <code>ETIMEDOUT</code> weisen alle auf ein Problem mit dem Netzwerk hin. Die beste Lösung ist es zu Versuchen die Netzwerkverbindung zu wechseln oder etwas zu warten und die Installation erneut zu versuchen.</p>\n<p>Man kann auch versuchen, Electron direkt unter <a href=\"https://github.com/electron/electron/releases\">electron/electron/releases</a> herunterzuladen, falls die Installation über <code>npm</code> weiterhin fehlschlägt.</p>\n<h2 id=\"wann-wird-electron-auf-die-neueste-version-von-chrome-aktualisiert\"><a href=\"#wann-wird-electron-auf-die-neueste-version-von-chrome-aktualisiert\">Wann wird Electron auf die neueste Version von Chrome aktualisiert?</a></h2>\n<p>Die Chrome Version von Electron wird in der Regel innerhalb von ein oder zwei Wochen Implementiert nachdem eine neue stabile Version für Chrome veröffentlicht wird. Diese Schätzung kann nicht garantiert werden und hängt vom Arbeitsaufwand während der Aktualisierung ab.</p>\n<p>Nur der stabile Kanal von Chrome wird verwendet. Wenn ein wichtiger Fix im Beta- oder Dev-Kanal ist, werden wir ihn zurückportieren.</p>\n<p>Weitere Informationen finden Sie in der <a href=\"/docs/tutorial/security\">Einführung zur Sicherheit</a>.</p>\n<h2 id=\"wann-wird-electron-auf-die-neueste-version-von-nodejs-upgraden\"><a href=\"#wann-wird-electron-auf-die-neueste-version-von-nodejs-upgraden\">Wann wird Electron auf die neueste Version von Node.js upgraden?</a></h2>\n<p>Wenn eine neue Version von Node.js veröffentlicht wird, warten wir in der Regel etwa einen Monat vor dem Upgrade in Elektron. So können wir vermeiden, die häufigen Bugs in neuen Node.js Versionen mit in Electron einzubinden.</p>\n<p>Neue Funktionalitäten von Node.js werden in der Regel durch V8 Upgrades ermöglicht. Da Electron das vom Chrome Browser mitgelieferte V8 verwendet, stehen die neuen JavaScript Funktionalitäten der neuen Node.js Version in der Regel bereits in Electron zur Verfügung.</p>\n<h2 id=\"wie-kann-man-daten-zwischen-webseiten-austauschen\"><a href=\"#wie-kann-man-daten-zwischen-webseiten-austauschen\">Wie kann man Daten zwischen Webseiten austauschen?</a></h2>\n<p>Um Daten zwischen Web-Seiten (Renderer-Prozesse) zu teilen, ist der einfachste Weg, HTML5-APIs zu verwenden, die bereits in Browsern zur Verfügung stehen. Good candidates are <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Storage\">Storage API</a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage\"><code>localStorage</code></a>, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage\"><code>sessionStorage</code></a>, and <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API\">IndexedDB</a>.</p>\n<p>Alternatively, you can use the IPC primitives that are provided by Electron. To share data between the main and renderer processes, you can use the <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> and <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> modules. To communicate directly between web pages, you can send a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> from one to the other, possibly via the main process using <a href=\"/docs/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage()</code></a>. Subsequent communication over message ports is direct and does not detour through the main process.</p>\n<h2 id=\"das-fenstericon-meiner-app-verschwindet-nach-ein-paar-minuten\"><a href=\"#das-fenstericon-meiner-app-verschwindet-nach-ein-paar-minuten\">Das Fenster/Icon meiner App verschwindet nach ein paar Minuten.</a></h2>\n<p>Dies geschieht, wenn die Variable die das Fenster speichert abgeräumt wird.</p>\n<p>Wenn dieses Problem auftritt, könnten die folgenden Artikel hilfreich sein:</p>\n<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management\">Speicherverwaltung</a></li>\n<li><a href=\"https://msdn.microsoft.com/library/bzt2dkta(v=vs.94).aspx\">Geltungsbereich von Variablen</a></li>\n</ul>\n<p>Wenn Sie eine schnelle Lösung bevorzugen, machen Sie die Variablen global, indem Sie Ihren Code</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/icon.png'</span>)\n  tray.setTitle(<span class=\"hljs-string\">'Hallo Welt'</span>)\n})\n</code></pre>\n<p>wie folgt anpassen:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> tray = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/icon.png'</span>)\n  tray.setTitle(<span class=\"hljs-string\">'Hallo Welt'</span>)\n})\n</code></pre>\n<h2 id=\"ich-kann-jqueryrequirejsmeteorangularjs-in-electron-nicht-verwenden\"><a href=\"#ich-kann-jqueryrequirejsmeteorangularjs-in-electron-nicht-verwenden\">Ich kann jQuery/RequireJS/Meteor/AngularJS in Electron nicht verwenden.</a></h2>\n<p>Wegen der Node.js Integration in Electron gibt es einige zusätzlich eingefügte Symbole im DOM wie <code>module</code>, <code>exports</code>, <code>require</code>. Das verursacht Probleme für einige Bibliotheken, da diese versuchen, Symbole mit den gleichen Namen einzufügen.</p>\n<p>Um dies zu beheben können Sie die Node-Integration in Electron deaktivieren:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Im Hauptprozess.</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\nwin.show()\n</code></pre>\n<p>Wenn Sie sich jedoch die Möglichkeit, Node.js und Electron APIs zu nutzen, offen halten möchten, müssen Sie die Symbole auf der Seite umbenennen, bevor Sie andere Bibliotheken einbinden:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-built_in\">window</span>.nodeRequire = <span class=\"hljs-built_in\">require</span>;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.require;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.exports;\n<span class=\"hljs-keyword\">delete</span> <span class=\"hljs-built_in\">window</span>.module;\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/javascript\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"jquery.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n</code></pre>\n<h2 id=\"requireelectronxxx-is-undefined\"><a href=\"#requireelectronxxx-is-undefined\"><code>require('electron').xxx</code> is undefined.</a></h2>\n<p>Während Sie das in Electron integrierte Modul nutzen, könnten Sie auf einen Fehler wie diesen stoßen:</p>\n<pre><code class=\"hljs language-sh\">> require(<span class=\"hljs-string\">'electron'</span>).webFrame.setZoomFactor(1.0)\nUncaught TypeError: Cannot <span class=\"hljs-built_in\">read</span> property <span class=\"hljs-string\">'setZoomLevel'</span> of undefined\n</code></pre>\n<p>Es ist sehr wahrscheinlich, dass das Modul im falschen Prozess verwendet wird. Beispielsweise kann <code>electron.app</code> nur im Hauptprozess verwendet werden, während <code>electron.webFrame</code> nur im Renderer-Prozess verfügbar ist.</p>\n<h2 id=\"die-schrift-sieht-verschwommen-aus-was-ist-das-und-was-kann-ich-tun\"><a href=\"#die-schrift-sieht-verschwommen-aus-was-ist-das-und-was-kann-ich-tun\">Die Schrift sieht verschwommen aus, was ist das und was kann ich tun?</a></h2>\n<p>If <a href=\"https://alienryderflex.com/sub_pixel/\">sub-pixel anti-aliasing</a> is deactivated, then fonts on LCD screens can look blurry. Beispiel:</p>\n<p><img src=\"/docs/images/subpixel-rendering-screenshot.gif\" alt=\"subpixel rendering example\"></p>\n<p>Subpixel Antialiasing benötigt einen nicht-transparenten Hintergrund der Ebene, die die Schrift-Glyphen enthält. (Siehe <a href=\"https://github.com/electron/electron/issues/6344#issuecomment-420371918\">dieses Problem</a> für weitere Informationen).</p>\n<p>To achieve this goal, set the background in the constructor for <a href=\"/docs/api/browser-window\">BrowserWindow</a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#fff'</span>\n})\n</code></pre>\n<p>The effect is visible only on (some?) LCD screens. Even if you don't see a difference, some of your users may. It is best to always set the background this way, unless you have reasons not to do so.</p>\n<p>Beachten Sie, dass nur die Einstellung des Hintergrunds in der CSS nicht den gewünschten Effekt hat.</p>",
      "title": "Electron FAQ",
      "description": ""
    },
    "/docs/api/structures/file-filter": {
      "locale": "de-DE",
      "slug": "file-filter",
      "href": "/docs/api/structures/file-filter",
      "crowdinFileId": "256435",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/file-filter.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"filefilter-object\"><a href=\"#filefilter-object\">FileFilter Object</a></h1>\n<ul>\n<li><code>name</code> Zeichenfolge</li>\n<li><code>extensions</code> String[]</li>\n</ul>",
      "title": "FileFilter Object",
      "description": ""
    },
    "/docs/api/file-object": {
      "locale": "de-DE",
      "slug": "file-object",
      "href": "/docs/api/file-object",
      "crowdinFileId": "256319",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/file-object.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"file-objekt\"><a href=\"#file-objekt\"><code>File</code> Objekt</a></h1>\n<blockquote>\n<p>Use the HTML5 <code>File</code> API to work natively with files on the filesystem.</p>\n</blockquote>\n<p>The DOM's File interface provides abstraction around native files in order to let users work on native files directly with the HTML5 file API. Electron has added a <code>path</code> attribute to the <code>File</code> interface which exposes the file's real path on filesystem.</p>\n<p>Example of getting a real path from a dragged-onto-the-app file:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">div</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"holder\"</span>></span>\n  Drag your file here\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">div</span>></span>\n\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  <span class=\"hljs-built_in\">document</span>.addEventListener(<span class=\"hljs-string\">'drop'</span>, (e) => {\n    e.preventDefault();\n    e.stopPropagation();\n\n    <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> f <span class=\"hljs-keyword\">of</span> e.dataTransfer.files) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'File(s) you dragged here: '</span>, f.path)\n    }\n  });\n  <span class=\"hljs-built_in\">document</span>.addEventListener(<span class=\"hljs-string\">'dragover'</span>, (e) => {\n    e.preventDefault();\n    e.stopPropagation();\n  });\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>",
      "title": "File Objekt",
      "description": "Use the HTML5 File API to work natively with files on the filesystem."
    },
    "/docs/api/structures/file-path-with-headers": {
      "locale": "de-DE",
      "slug": "file-path-with-headers",
      "href": "/docs/api/structures/file-path-with-headers",
      "crowdinFileId": "256437",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/file-path-with-headers.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"filepathwithheaders-object\"><a href=\"#filepathwithheaders-object\">FilePathWithHeaders Object</a></h1>\n<ul>\n<li><code>path</code> String - The path to the file to send.</li>\n<li><code>headers</code> Record&#x3C;string, string> (optional) - Additional headers to be sent.</li>\n</ul>",
      "title": "FilePathWithHeaders Object",
      "description": ""
    },
    "/docs/api/frameless-window": {
      "locale": "de-DE",
      "slug": "frameless-window",
      "href": "/docs/api/frameless-window",
      "crowdinFileId": "256321",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/frameless-window.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"rahmenlose-fenster\"><a href=\"#rahmenlose-fenster\">Rahmenlose Fenster</a></h1>\n<blockquote>\n<p>Öffne ein Fenster ohne Werkzeug/Symbolleiste, Ränder oder anderen grafischen Schnickschnack.</p>\n</blockquote>\n<p>Ein rahmenloses Fenster ist ein Fenster ohne die üblichen <a href=\"https://developer.mozilla.org/en-US/docs/Glossary/Chrome\">Bestandteile</a>, wie Symbolleisten, die nicht Teil der Webseite sind. Die folgenden Optionen stehen in der Klasse <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> zur Verfügung.</p>\n<h2 id=\"erstelle-ein-rahmenloses-fenster\"><a href=\"#erstelle-ein-rahmenloses-fenster\">Erstelle ein rahmenloses Fenster</a></h2>\n<p>Um ein rahmenloses Fenster zu erstellen musst du <code>frame</code> in den <a href=\"/docs/api/browser-window\">BrowserWindow</a> <code>Optionen</code> auf <code>false</code> setzen:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h3 id=\"alternatives\"><a href=\"#alternatives\">Alternatives</a></h3>\n<p>There's an alternative way to specify a chromeless window on macOS and Windows. Instead of setting <code>frame</code> to <code>false</code> which disables both the titlebar and window controls, you may want to have the title bar hidden and your content extend to the full window size, yet still preserve the window controls (\"traffic lights\" on macOS) for standard window actions. Das kannst du erreichen indem du folgende <code>titleBarStyle</code>-Optionen verwendest:</p>\n<h4 id=\"hidden\"><a href=\"#hidden\"><code>hidden</code></a></h4>\n<p>Results in a hidden title bar and a full size content window. On macOS, the title bar still has the standard window controls (“traffic lights”) in the top left.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span> })\nwin.show()\n</code></pre>\n<h3 id=\"alternativen-auf-macos\"><a href=\"#alternativen-auf-macos\">Alternativen auf macOS</a></h3>\n<h4 id=\"hiddeninset\"><a href=\"#hiddeninset\"><code>hiddenInset</code></a></h4>\n<p>Results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span> })\nwin.show()\n</code></pre>\n<h4 id=\"custombuttonsonhover\"><a href=\"#custombuttonsonhover\"><code>customButtonsOnHover</code></a></h4>\n<p>Uses custom drawn close, and miniaturize buttons that display when hovering in the top left of the window. The fullscreen button is not available due to restrictions of frameless windows as they interface with Apple's macOS window masks. These custom buttons prevent issues with mouse events that occur with the standard window toolbar buttons. This option is only applicable for frameless windows.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'customButtonsOnHover'</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h2 id=\"windows-control-overlay\"><a href=\"#windows-control-overlay\">Windows Control Overlay</a></h2>\n<p>When using a frameless window in conjuction with <code>win.setWindowButtonVisibility(true)</code> on macOS, using one of the <code>titleBarStyle</code>s as described above so that the traffic lights are visible, or using <code>titleBarStyle: hidden</code> on Windows, you can access the Window Controls Overlay <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis\">JavaScript APIs</a> and <a href=\"https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables\">CSS Environment Variables</a> by setting the <code>titleBarOverlay</code> option to true. Specifying <code>true</code> will result in an overlay with default system colors.</p>\n<p>On Windows, you can also specify the color of the overlay and its symbols by setting <code>titleBarOverlay</code> to an object with the options <code>color</code> and <code>symbolColor</code>. If an option is not specified, the color will default to its system color for the window control buttons:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span>,\n  <span class=\"hljs-attr\">titleBarOverlay</span>: <span class=\"hljs-literal\">true</span>\n})\nwin.show()\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hidden'</span>,\n  <span class=\"hljs-attr\">titleBarOverlay</span>: {\n    <span class=\"hljs-attr\">color</span>: <span class=\"hljs-string\">'#2f3241'</span>,\n    <span class=\"hljs-attr\">symbolColor</span>: <span class=\"hljs-string\">'#74b1be'</span>\n  }\n})\nwin.show()\n</code></pre>\n<h2 id=\"transparent-window\"><a href=\"#transparent-window\">Transparent window</a></h2>\n<p>By setting the <code>transparent</code> option to <code>true</code>, you can also make the frameless window transparent:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">transparent</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span> })\nwin.show()\n</code></pre>\n<h3 id=\"einschränkungen\"><a href=\"#einschränkungen\">Einschränkungen</a></h3>\n<ul>\n<li>You can not click through the transparent area. We are going to introduce an API to set window shape to solve this, see <a href=\"https://github.com/electron/electron/issues/1335\">our issue</a> for details.</li>\n<li>Transparent windows are not resizable. Setting <code>resizable</code> to <code>true</code> may make a transparent window stop working on some platforms.</li>\n<li>The <code>blur</code> filter only applies to the web page, so there is no way to apply blur effect to the content below the window (i.e. other applications open on the user's system).</li>\n<li>The window will not be transparent when DevTools is opened.</li>\n<li>On Windows operating systems,<ul>\n<li>transparent windows will not work when DWM is disabled.</li>\n<li>transparent windows can not be maximized using the Windows system menu or by double clicking the title bar. The reasoning behind this can be seen on <a href=\"https://github.com/electron/electron/pull/28207\">this pull request</a>.</li>\n</ul></li>\n<li>On Linux, users have to put <code>--enable-transparent-visuals --disable-gpu</code> in the command line to disable GPU and allow ARGB to make transparent window, this is caused by an upstream bug that <a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=369209\">alpha channel doesn't work on some NVidia drivers</a> on Linux.</li>\n<li>On Mac, the native window shadow will not be shown on a transparent window.</li>\n</ul>\n<h2 id=\"click-through-window\"><a href=\"#click-through-window\">Click-through window</a></h2>\n<p>To create a click-through window, i.e. making the window ignore all mouse events, you can call the <a href=\"/docs/api/browser-window#winsetignoremouseeventsignore-options\">win.setIgnoreMouseEvents(ignore)</a> API:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.setIgnoreMouseEvents(<span class=\"hljs-literal\">true</span>)\n</code></pre>\n<h3 id=\"forwarding\"><a href=\"#forwarding\">Forwarding</a></h3>\n<p>Ignoring mouse messages makes the web page oblivious to mouse movement, meaning that mouse movement events will not be emitted. On Windows operating systems an optional parameter can be used to forward mouse move messages to the web page, allowing events such as <code>mouseleave</code> to be emitted:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> el = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'clickThroughElement'</span>)\nel.addEventListener(<span class=\"hljs-string\">'mouseenter'</span>, () => {\n  ipcRenderer.send(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, <span class=\"hljs-literal\">true</span>, { <span class=\"hljs-attr\">forward</span>: <span class=\"hljs-literal\">true</span> })\n})\nel.addEventListener(<span class=\"hljs-string\">'mouseleave'</span>, () => {\n  ipcRenderer.send(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, <span class=\"hljs-literal\">false</span>)\n})\n\n<span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'set-ignore-mouse-events'</span>, (event, ...args) => {\n  BrowserWindow.fromWebContents(event.sender).setIgnoreMouseEvents(...args)\n})\n</code></pre>\n<p>This makes the web page click-through when over <code>el</code>, and returns to normal outside it.</p>\n<h2 id=\"draggable-region\"><a href=\"#draggable-region\">Draggable region</a></h2>\n<p>By default, the frameless window is non-draggable. Apps need to specify <code>-webkit-app-region: drag</code> in CSS to tell Electron which regions are draggable (like the OS's standard titlebar), and apps can also use <code>-webkit-app-region: no-drag</code> to exclude the non-draggable area from the draggable region. Note that only rectangular shapes are currently supported.</p>\n<p>Note: <code>-webkit-app-region: drag</code> is known to have problems while the developer tools are open. See this <a href=\"https://github.com/electron/electron/issues/3647\">GitHub issue</a> for more information including a workaround.</p>\n<p>To make the whole window draggable, you can add <code>-webkit-app-region: drag</code> as <code>body</code>'s style:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"-webkit-app-region: drag\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n</code></pre>\n<p>And note that if you have made the whole window draggable, you must also mark buttons as non-draggable, otherwise it would be impossible for users to click on them:</p>\n<pre><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">button</span> {\n  <span class=\"hljs-attribute\">-webkit-app-region</span>: no-drag;\n}\n</code></pre>\n<p>If you're only setting a custom titlebar as draggable, you also need to make all buttons in titlebar non-draggable.</p>\n<h2 id=\"text-selection\"><a href=\"#text-selection\">Text selection</a></h2>\n<p>In a frameless window the dragging behavior may conflict with selecting text. For example, when you drag the titlebar you may accidentally select the text on the titlebar. To prevent this, you need to disable text selection within a draggable area like this:</p>\n<pre><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.titlebar</span> {\n  <span class=\"hljs-attribute\">-webkit-user-select</span>: none;\n  <span class=\"hljs-attribute\">-webkit-app-region</span>: drag;\n}\n</code></pre>\n<h2 id=\"context-menu\"><a href=\"#context-menu\">Context menu</a></h2>\n<p>On some platforms, the draggable area will be treated as a non-client frame, so when you right click on it a system menu will pop up. To make the context menu behave correctly on all platforms you should never use a custom context menu on draggable areas.</p>",
      "title": "Rahmenlose Fenster",
      "description": "Öffne ein Fenster ohne Werkzeug/Symbolleiste, Ränder oder anderen grafischen Schnickschnack."
    },
    "/docs/tutorial/fuses": {
      "locale": "de-DE",
      "slug": "fuses",
      "href": "/docs/tutorial/fuses",
      "crowdinFileId": "256201",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/fuses.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-fuses\"><a href=\"#electron-fuses\">Electron Fuses</a></h1>\n<blockquote>\n<p>Package time feature toggles</p>\n</blockquote>\n<h2 id=\"what-are-fuses\"><a href=\"#what-are-fuses\">What are fuses?</a></h2>\n<p>For a subset of Electron functionality it makes sense to disable certain features for an entire application.  For example, 99% of apps don't make use of <code>ELECTRON_RUN_AS_NODE</code>, these applications want to be able to ship a binary that is incapable of using that feature.  We also don't want Electron consumers building Electron from source as that is both a massive technical challenge and has a high cost of both time and money.</p>\n<p>Fuses are the solution to this problem, at a high level they are \"magic bits\" in the Electron binary that can be flipped when packaging your Electron app to enable / disable certain features / restrictions.  Because they are flipped at package time before you code sign your app the OS becomes responsible for ensuring those bits aren't flipped back via OS level code signing validation (Gatekeeper / App Locker).</p>\n<h2 id=\"how-do-i-flip-the-fuses\"><a href=\"#how-do-i-flip-the-fuses\">How do I flip the fuses?</a></h2>\n<h3 id=\"the-easy-way\"><a href=\"#the-easy-way\">The easy way</a></h3>\n<p>We've made a handy module <code>@electron/fuses</code> to make flipping these fuses easy.  Check out the README of that module for more details on usage and potential error cases.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'@electron/fuses'</span>).flipFuses(\n  <span class=\"hljs-comment\">// Path to electron</span>\n  <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>),\n  <span class=\"hljs-comment\">// Fuses to flip</span>\n  {\n    <span class=\"hljs-attr\">runAsNode</span>: <span class=\"hljs-literal\">false</span>\n  }\n)\n</code></pre>\n<h3 id=\"the-hard-way\"><a href=\"#the-hard-way\">The hard way</a></h3>\n<h4 id=\"quick-glossary\"><a href=\"#quick-glossary\">Quick Glossary</a></h4>\n<ul>\n<li><strong>Fuse Wire</strong>: A sequence of bytes in the Electron binary used to control the fuses</li>\n<li><strong>Sentinel</strong>: A static known sequence of bytes you can use to locate the fuse wire</li>\n<li><strong>Fuse Schema</strong>: The format / allowed values for the fuse wire</li>\n</ul>\n<p>Manually flipping fuses requires editing the Electron binary and modifying the fuse wire to be the sequence of bytes that represent the state of the fuses you want.</p>\n<p>Somewhere in the Electron binary there will be a sequence of bytes that look like this:</p>\n<pre><code class=\"hljs language-plaintext\">| ...binary | sentinel_bytes | fuse_version | fuse_wire_length | fuse_wire | ...binary |\n</code></pre>\n<ul>\n<li><code>sentinel_bytes</code> is always this exact string <code>dL7pKGdnNz796PbbjQWNKmHXBZaB9tsX</code></li>\n<li><code>fuse_version</code> is a single byte whose unsigned integer value represents the version of the fuse schema</li>\n<li><code>fuse_wire_length</code> is a single byte whose unsigned integer value represents the number of fuses in the following fuse wire</li>\n<li><code>fuse_wire</code> is a sequence of N bytes, each byte represents a single fuse and its state.<ul>\n<li>\"0\" (0x30) indicates the fuse is disabled</li>\n<li>\"1\" (0x31) indicates the fuse is enabled</li>\n<li>\"r\" (0x72) indicates the fuse has been removed and changing the byte to either 1 or 0 will have no effect.</li>\n</ul></li>\n</ul>\n<p>To flip a fuse you find its position in the fuse wire and change it to \"0\" or \"1\" depending on the state you'd like.</p>\n<p>You can view the current schema <a href=\"https://github.com/electron/electron/blob/main/build/fuses/fuses.json5\">here</a>.</p>",
      "title": "Electron Fuses",
      "description": "Package time feature toggles"
    },
    "/docs/api/global-shortcut": {
      "locale": "de-DE",
      "slug": "global-shortcut",
      "href": "/docs/api/global-shortcut",
      "crowdinFileId": "256323",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/global-shortcut.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"globalshortcut\"><a href=\"#globalshortcut\">globalShortcut</a></h1>\n<blockquote>\n<p>Detect keyboard events when the application does not have keyboard focus.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p>The <code>globalShortcut</code> module can register/unregister a global keyboard shortcut with the operating system so that you can customize the operations for various shortcuts.</p>\n<p><strong>Note:</strong> The shortcut is global; it will work even if the app does not have the keyboard focus. This module cannot be used before the <code>ready</code> event of the app module is emitted.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Register a 'CommandOrControl+X' shortcut listener.</span>\n  <span class=\"hljs-keyword\">const</span> ret = globalShortcut.register(<span class=\"hljs-string\">'CommandOrControl+X'</span>, () => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'CommandOrControl+X is pressed'</span>)\n  })\n\n  <span class=\"hljs-keyword\">if</span> (!ret) {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'registration failed'</span>)\n  }\n\n  <span class=\"hljs-comment\">// Check whether a shortcut is registered.</span>\n  <span class=\"hljs-built_in\">console</span>.log(globalShortcut.isRegistered(<span class=\"hljs-string\">'CommandOrControl+X'</span>))\n})\n\napp.on(<span class=\"hljs-string\">'will-quit'</span>, () => {\n  <span class=\"hljs-comment\">// Unregister a shortcut.</span>\n  globalShortcut.unregister(<span class=\"hljs-string\">'CommandOrControl+X'</span>)\n\n  <span class=\"hljs-comment\">// Unregister all shortcuts.</span>\n  globalShortcut.unregisterAll()\n})\n</code></pre>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das <code>globalShortcut</code> Modul hat folgende Methoden:</p>\n<h3 id=\"globalshortcutregisteraccelerator-callback\"><a href=\"#globalshortcutregisteraccelerator-callback\"><code>globalShortcut.register(accelerator, callback)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n<li><code>callback</code> Function</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether or not the shortcut was registered successfully.</p>\n<p>Registers a global shortcut of <code>accelerator</code>. The <code>callback</code> is called when the registered shortcut is pressed by the user.</p>\n<p>When the accelerator is already taken by other applications, this call will silently fail. This behavior is intended by operating systems, since they don't want applications to fight for global shortcuts.</p>\n<p>The following accelerators will not be registered successfully on macOS 10.14 Mojave unless the app has been authorized as a <a href=\"https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html\">trusted accessibility client</a>:</p>\n<ul>\n<li>\"Media Play/Pause\"</li>\n<li>\"Media Next Track\"</li>\n<li>\"Media Previous Track\"</li>\n<li>\"Media Stop\"</li>\n</ul>\n<h3 id=\"globalshortcutregisterallaccelerators-callback\"><a href=\"#globalshortcutregisterallaccelerators-callback\"><code>globalShortcut.registerAll(accelerators, callback)</code></a></h3>\n<ul>\n<li><code>accelerators</code> String[] - an array of <a href=\"/docs/api/accelerator\">Accelerator</a>s.</li>\n<li><code>callback</code> Function</li>\n</ul>\n<p>Registers a global shortcut of all <code>accelerator</code> items in <code>accelerators</code>. The <code>callback</code> is called when any of the registered shortcuts are pressed by the user.</p>\n<p>When a given accelerator is already taken by other applications, this call will silently fail. This behavior is intended by operating systems, since they don't want applications to fight for global shortcuts.</p>\n<p>The following accelerators will not be registered successfully on macOS 10.14 Mojave unless the app has been authorized as a <a href=\"https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXTestingApps.html\">trusted accessibility client</a>:</p>\n<ul>\n<li>\"Media Play/Pause\"</li>\n<li>\"Media Next Track\"</li>\n<li>\"Media Previous Track\"</li>\n<li>\"Media Stop\"</li>\n</ul>\n<h3 id=\"globalshortcutisregisteredaccelerator\"><a href=\"#globalshortcutisregisteredaccelerator\"><code>globalShortcut.isRegistered(accelerator)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether this application has registered <code>accelerator</code>.</p>\n<p>When the accelerator is already taken by other applications, this call will still return <code>false</code>. This behavior is intended by operating systems, since they don't want applications to fight for global shortcuts.</p>\n<h3 id=\"globalshortcutunregisteraccelerator\"><a href=\"#globalshortcutunregisteraccelerator\"><code>globalShortcut.unregister(accelerator)</code></a></h3>\n<ul>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a></li>\n</ul>\n<p>Unregisters the global shortcut of <code>accelerator</code>.</p>\n<h3 id=\"globalshortcutunregisterall\"><a href=\"#globalshortcutunregisterall\"><code>globalShortcut.unregisterAll()</code></a></h3>\n<p>Unregisters all of the global shortcuts.</p>",
      "title": "globalShortcut",
      "description": "Detect keyboard events when the application does not have keyboard focus."
    },
    "/docs/glossary": {
      "locale": "de-DE",
      "slug": "glossary",
      "href": "/docs/glossary",
      "crowdinFileId": "256123",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/glossary.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"glossar\"><a href=\"#glossar\">Glossar</a></h1>\n<p>Diese Seite enthält Begriffe, die während der Entwicklung von Electron häufig verwendet werden.</p>\n<h3 id=\"asar\"><a href=\"#asar\">ASAR</a></h3>\n<p>ASAR steht für Atom-Shell-Archiv-Format. Ein <a href=\"https://github.com/electron/asar\">asar</a>-Archiv ist ein simples, <code>tar</code>-ähnliches Format, das die Dateien in einer einzelnen Datei zusammenführt. Electron kann willkürliche Dateien aus dem Archiv lesen ohne diese zu entpacken.</p>\n<p>The ASAR format was created primarily to improve performance on Windows when reading large quantities of small files (e.g. when loading your app's JavaScript dependency tree from <code>node_modules</code>).</p>\n<h3 id=\"code-signing\"><a href=\"#code-signing\">code signing</a></h3>\n<p>Code signing is a process where an app developer digitally signs their code to ensure that it hasn't been tampered with after packaging. Both Windows and macOS implement their own version of code signing. As a desktop app developer, it's important that you sign your code if you plan on distributing it to the general public.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/code-signing\">Code Signing</a> tutorial.</p>\n<h3 id=\"context-isolation\"><a href=\"#context-isolation\">context isolation</a></h3>\n<p>Context isolation is a security measure in Electron that ensures that your preload script cannot leak privileged Electron or Node.js APIs to the web contents in your renderer process. With context isolation enabled, the only way to expose APIs from your preload script is through the <code>contextBridge</code> API.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/context-isolation\">Context Isolation</a> tutorial.</p>\n<p>See also: <a href=\"#preload-script\">preload script</a>, <a href=\"#renderer-process\">renderer process</a></p>\n<h3 id=\"crt\"><a href=\"#crt\">CRT</a></h3>\n<p>The C Runtime Library (CRT) is the part of the C++ Standard Library that incorporates the ISO C99 standard library. Die Visual C++ Bibliotheken, welche die CRT implementieren, unterstützen native Codeentwicklung sowie gemischt nativen und verwalteten Code als auch reiner verwalteter Code für .NET-Entwicklung.</p>\n<h3 id=\"dmg\"><a href=\"#dmg\">DMG</a></h3>\n<p>\"Apple Disk Image\" ist ein Paket-Format von macOS. DMG-Dateien werden oft zur Distribution von Installern verwendet.</p>\n<h3 id=\"ime\"><a href=\"#ime\">IME</a></h3>\n<p>Input Method Editor. Ein Programm, dass dem Benutzer die Eingabe von Buchstaben und Zeichen, welche nicht auf der Tastatur vertreten sind, erlaubt. Zum Beispiel können Benutzer einer lateinischen Tastatur chinesische, japanische, koreanische und indische Zeichen einzugeben.</p>\n<h3 id=\"idl\"><a href=\"#idl\">IDL</a></h3>\n<p>Interface description language. Write function signatures and data types in a format that can be used to generate interfaces in Java, C++, JavaScript, etc.</p>\n<h3 id=\"ipc\"><a href=\"#ipc\">IPC</a></h3>\n<p>IPC stands for inter-process communication. Electron uses IPC to send serialized JSON messages between the main and renderer processes.</p>\n<p>siehe auch: <a href=\"#main-process\">main process</a>, <a href=\"#renderer-process\">renderer process</a></p>\n<h3 id=\"main-prozess\"><a href=\"#main-prozess\">Main-Prozess</a></h3>\n<p>The main process, commonly a file named <code>main.js</code>, is the entry point to every Electron app. It controls the life of the app, from open to close. Er steurert auch Native Elemente wie Menu, Menu Bar, Dock, Tray, usw. The main process is responsible for creating each new renderer process in the app. The full Node API is built in.</p>\n<p>Die Datei für den Hauptprozess jeder App ist in der <code>main</code> Eigenschaft in <code>package.json</code> angegeben. This is how <code>electron .</code> knows what file to execute at startup.</p>\n<p>In Chromium wird dieser Prozess als \"Browser-Prozess\" bezeichnet. In Electron wird er umbenannt, um Verwechslung mit Renderer-Prozessen zu vermeiden.</p>\n<p>Siehe auch: <a href=\"#process\">process</a>, <a href=\"#renderer-process\">renderer process</a></p>\n<h3 id=\"mas\"><a href=\"#mas\">MAS</a></h3>\n<p>Abkürzung für Apple's Mac App Store. Für Infromationen zum Einreichen deiner App zum MAS siehe <a href=\"/docs/tutorial/mac-app-store-submission-guide\">Anleitung: Mac App Store Veröffentlichung</a>.</p>\n<h3 id=\"mojo\"><a href=\"#mojo\">Mojo</a></h3>\n<p>An IPC system for communicating intra- or inter-process, and that's important because Chrome is keen on being able to split its work into separate processes or not, depending on memory pressures etc.</p>\n<p>Siehe <a href=\"https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md\">https://chromium.googlesource.com/chromium/src/+/master/mojo/README.md</a></p>\n<p>See also: <a href=\"#ipc\">IPC</a></p>\n<h3 id=\"msi\"><a href=\"#msi\">MSI</a></h3>\n<p>On Windows, MSI packages are used by the Windows Installer (also known as Microsoft Installer) service to install and configure applications.</p>\n<p>More information can be found in <a href=\"https://docs.microsoft.com/en-us/windows/win32/msi/windows-installer-portal\">Microsoft's documentation</a>.</p>\n<h3 id=\"systemeigene-module\"><a href=\"#systemeigene-module\">systemeigene Module</a></h3>\n<p>Native Module, in Node.js auch <a href=\"https://nodejs.org/api/addons.html\">addons</a> genannt, sind Module, welche in C oder C++ geschrieben werden und genau wie normale mithilfe der require() Funktion geladen werden können. Sie werden in erster Linie dazu eingesetzt, um eine Schnittstelle zwischen JavaScript in Node.js und C/C++-Bibliotheken zur Verfügung zu stellen.</p>\n<p>Native Node-Module werden von Electron unterstützt, aber da Electron sehr es wahrscheinlich eine andere V8-Version als die von der auf ihrem System verwendete Node.js Version verwendet, musst du den Ort der Electron-Header beim Bauen von nativen Modulen manuell angeben.</p>\n<p>For more information, read the [Native Node Modules] tutorial.</p>\n<h3 id=\"notarization\"><a href=\"#notarization\">notarization</a></h3>\n<p>Notarization is a macOS-specific process where a developer can send a code-signed app to Apple servers to get verified for malicious components through an automated service.</p>\n<p>See also: <a href=\"#code-signing\">code signing</a></p>\n<h3 id=\"osr\"><a href=\"#osr\">OSR</a></h3>\n<p>OSR (offscreen rendering) can be used for loading heavy page in background and then displaying it after (it will be much faster). It allows you to render page without showing it on screen.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/offscreen-rendering\">Offscreen Rendering</a>[osr] tutorial.</p>\n<h3 id=\"preload-script\"><a href=\"#preload-script\">preload script</a></h3>\n<p>Preload scripts contain code that executes in a renderer process before its web contents begin loading. These scripts run within the renderer context, but are granted more privileges by having access to Node.js APIs.</p>\n<p>See also: <a href=\"#renderer-process\">renderer process</a>, <a href=\"#context-isolation\">context isolation</a></p>\n<h3 id=\"process\"><a href=\"#process\">process</a></h3>\n<p>Ein Prozess ist eine Instanz eines Computerprogramms, welches ausgeführt wird. Electron Anwendungen, welche einen <a href=\"#main-process\">main</a>- und einen oder mehrere <a href=\"#renderer-process\">renderer</a>-Prozesse verwenden, bestehen eigentlich aus mehreren parallel laufenden Programmen.</p>\n<p>In Node.js und Electron hat jeder laufende Prozess ein <code>process</code>-Objekt. Dieses globale Objekt stellt Informationen und Steuerungsmöglichkeiten über den aktuellen Prozess bereit. Als globales Objekt ist es immer verfügbar für Anwendungen, welche nicht require() benutzen.</p>\n<p>Siehe auch: <a href=\"#main-process\">main process</a>, <a href=\"#renderer-process\">renderer process</a></p>\n<h3 id=\"renderer-process\"><a href=\"#renderer-process\">renderer process</a></h3>\n<p>The renderer process is a browser window in your app. Unlike the main process, there can be multiple of these and each is run in a separate process. They can also be hidden.</p>\n<p>Siehe auch: <a href=\"#process\">process</a>, <a href=\"#main-process\">main process</a></p>\n<h3 id=\"sandbox\"><a href=\"#sandbox\">sandbox</a></h3>\n<p>The sandbox is a security feature inherited from Chromium that restricts your renderer processes to a limited set of permissions.</p>\n<p>For more information, read the <a href=\"/docs/tutorial/sandbox\">Process Sandboxing</a> tutorial.</p>\n<p>See also: <a href=\"#process\">process</a></p>\n<h3 id=\"squirrel\"><a href=\"#squirrel\">Squirrel</a></h3>\n<p>Squirrel ist ein Open-Source Framework, welches Electron Apps ermöglicht sich automatisch zu aktualisieren, wenn neue Versionen veröffentlicht werden. Siehe dir die <a href=\"/docs/api/auto-updater\">autoUpdater</a> API an für mehr Informationen wie du mit Squirrel startest.</p>\n<h3 id=\"userland\"><a href=\"#userland\">userland</a></h3>\n<p>Der Begriff hat seinen Ursprung in der Unix Community, wo \"userland\" oder \"userspace\" für Programme steht, die außerhalb des Kernels des Betriebssystems agieren. Seit einiger Zeit wird der Begriff auch in der Node und npm Community verwendet, um zwischen Features, die im \"Node core\" verfügbar sind, und Paketen, die in der npm registry veröffentlicht wurden, zu unterscheiden.</p>\n<p>Wie Node fokussiert sich auch Electron darauf, eine relativ einfache API mit allen nötigen primitiven Werkzeugen, die es braucht, um Multi-Plattform Desktop-Anwendungen zu entwickeln, bereitzustellen. Diese Design-Philosophie ermöglicht es Electron, ein flexibles Werkzeug zu sein, ohne zu stark in der Art, wie es benutzt werden kann, einzuschränken. Userland erlaubt Nutzern das Erstellen und Teilen von Tools, die weitere, komplexere Funktionalität bereitstellt, zusätzlich zu denen, die im \"Core\" existieren.</p>\n<h3 id=\"v8\"><a href=\"#v8\">V8</a></h3>\n<p>V8 is Google's open source JavaScript engine. It is written in C++ and is used in Google Chrome. V8 can run standalone, or can be embedded into any C++ application.</p>\n<p>Electron baut V8 als Teil von Chromium und weist dann Node beim Bauen darauf hin.</p>\n<p>V8's version numbers always correspond to those of Google Chrome. Chrome 59 includes V8 5.9, Chrome 58 includes V8 5.8, etc.</p>\n<ul>\n<li><a href=\"https://v8.dev/\">v8.dev</a></li>\n<li><a href=\"https://nodejs.org/api/v8.html\">nodejs.org/api/v8.html</a></li>\n<li><a href=\"/docs/development/v8-development\">docs/development/v8-development.md</a></li>\n</ul>\n<h3 id=\"webview\"><a href=\"#webview\">webview</a></h3>\n<p><code>webview</code> tags are used to embed 'guest' content (such as external web pages) in your Electron app. They are similar to <code>iframe</code>s, but differ in that each webview runs in a separate process. It doesn't have the same permissions as your web page and all interactions between your app and embedded content will be asynchronous. This keeps your app safe from the embedded content.</p>",
      "title": "Glossar",
      "description": ""
    },
    "/docs/development/goma": {
      "locale": "de-DE",
      "slug": "goma",
      "href": "/docs/development/goma",
      "crowdinFileId": "256157",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/goma.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"goma\"><a href=\"#goma\">Goma</a></h1>\n<blockquote>\n<p>Goma is a distributed compiler service for open-source projects such as Chromium and Android.</p>\n</blockquote>\n<p>Electron hat ein eigenes Goma-Backend, das wir allen Electron-Betreuern zur Verfügung stellen.  See the <a href=\"#access\">Access</a> section below for details on authentication.  There is also a <code>cache-only</code> Goma endpoint that will be used by default if you do not have credentials.  Requests to the cache-only Goma will not hit our cluster, but will read from our cache and should result in significantly faster build times.</p>\n<h2 id=\"enabling-goma\"><a href=\"#enabling-goma\">Enabling Goma</a></h2>\n<p>Currently the only supported way to use Goma is to use our <a href=\"https://github.com/electron/build-tools\">Build Tools</a>. Goma configuration is automatically included when you set up <code>build-tools</code>.</p>\n<p>If you are a maintainer and have access to our cluster, please ensure that you run <code>e init</code> with <code>--goma=cluster</code> in order to configure <code>build-tools</code> to use the Goma cluster.  If you have an existing config, you can just set <code>\"goma\": \"cluster\"</code> in your config file.</p>\n<h2 id=\"building-with-goma\"><a href=\"#building-with-goma\">Building with Goma</a></h2>\n<p>When you are using Goma you can run <code>ninja</code> with a substantially higher <code>j</code> value than would normally be supported by your machine.</p>\n<p>Please do not set a value higher than <strong>200</strong> on Windows or Linux and <strong>50</strong> on macOS. We monitor Goma system usage, and users found to be abusing it with unreasonable concurrency will be de-activated.</p>\n<pre><code class=\"hljs language-bash\">ninja -C out/Testing electron -j 200\n</code></pre>\n<p>If you're using <code>build-tools</code>, appropriate <code>-j</code> values will automatically be used for you.</p>\n<h2 id=\"monitoring-goma\"><a href=\"#monitoring-goma\">Monitoring Goma</a></h2>\n<p>If you access <a href=\"http://localhost:8088\">http://localhost:8088</a> on your local machine you can monitor compile jobs as they flow through the goma system.</p>\n<h2 id=\"zugriff\"><a href=\"#zugriff\">Zugriff</a></h2>\n<p>For security and cost reasons, access to Electron's Goma cluster is currently restricted to Electron Maintainers.  If you want access please head to <code>#access-requests</code> in Slack and ping <code>@goma-squad</code> to ask for access.  Please be aware that being a maintainer does not <em>automatically</em> grant access and access is determined on a case by case basis.</p>\n<h2 id=\"uptime--support\"><a href=\"#uptime--support\">Uptime / Support</a></h2>\n<p>We have automated monitoring of our Goma cluster and cache at <a href=\"https://status.notgoma.com\">https://status.notgoma.com</a></p>\n<p>We do not provide support for usage of Goma and any issues raised asking for help / having issues will <em>probably</em> be closed without much reason, we do not have the capacity to handle that kind of support.</p>",
      "title": "Goma",
      "description": "Goma is a distributed compiler service for open-source projects such as Chromium and Android."
    },
    "/docs/api/structures/gpu-feature-status": {
      "locale": "de-DE",
      "slug": "gpu-feature-status",
      "href": "/docs/api/structures/gpu-feature-status",
      "crowdinFileId": "256439",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/gpu-feature-status.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"gpufeaturestatus-object\"><a href=\"#gpufeaturestatus-object\">GPUFeatureStatus Object</a></h1>\n<ul>\n<li><code>2d_canvas</code> String - Canvas.</li>\n<li><code>flash_3d</code> String - Flash.</li>\n<li><code>flash_stage3d</code> String - Flash Stage3D.</li>\n<li><code>flash_stage3d_baseline</code> String - Flash Stage3D Baseline profile.</li>\n<li><code>gpu_compositing</code> String - Compositing.</li>\n<li><code>multiple_raster_threads</code> String - Multiple Raster Threads.</li>\n<li><code>native_gpu_memory_buffers</code> String - Native GpuMemoryBuffers.</li>\n<li><code>rasterization</code> String - Rasterization.</li>\n<li><code>video_decode</code> String - Video Decode.</li>\n<li><code>video_encode</code> String - Video Encode.</li>\n<li><code>vpx_decode</code> String - VPx Video Decode.</li>\n<li><code>webgl</code> String - WebGL.</li>\n<li><code>webgl2</code> String - WebGL2.</li>\n</ul>\n<p>Mögliche werte:</p>\n<ul>\n<li><code>disabled_software</code> - Software only. Hardware acceleration disabled (yellow)</li>\n<li><code>disabled_off</code> - Disabled (red)</li>\n<li><code>disabled_off_ok</code> - Disabled (yellow)</li>\n<li><code>unavailable_software</code> - Software only, hardware acceleration unavailable (yellow)</li>\n<li><code>unavailable_off</code> - Unavailable (red)</li>\n<li><code>unavailable_off_ok</code> - Unavailable (yellow)</li>\n<li><code>enabled_readback</code> - Hardware accelerated but at reduced performance (yellow)</li>\n<li><code>enabled_force</code> - Hardware accelerated on all pages (green)</li>\n<li><code>enabled</code> - Hardware accelerated (green)</li>\n<li><code>enabled_on</code> - Enabled (green)</li>\n<li><code>enabled_force_on</code> - Force enabled (green)</li>\n</ul>",
      "title": "GPUFeatureStatus Object",
      "description": ""
    },
    "/docs/api/structures/hid-device": {
      "locale": "de-DE",
      "slug": "hid-device",
      "href": "/docs/api/structures/hid-device",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/hid-device.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"hiddevice-object\"><a href=\"#hiddevice-object\">HIDDevice Object</a></h1>\n<ul>\n<li><code>deviceId</code> String - Unique identifier for the device.</li>\n<li><code>name</code> String - Name of the device.</li>\n<li><code>vendorId</code> Integer - The USB vendor ID.</li>\n<li><code>productId</code> Integer - The USB product ID.</li>\n<li><code>serialNumber</code> String (optional) - The USB device serial number.</li>\n<li><code>guid</code> String (optional) - Unique identifier for the HID interface.  A device may have multiple HID interfaces.</li>\n</ul>",
      "title": "HIDDevice Object",
      "description": ""
    },
    "/docs/api/in-app-purchase": {
      "locale": "de-DE",
      "slug": "in-app-purchase",
      "href": "/docs/api/in-app-purchase",
      "crowdinFileId": "256325",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/in-app-purchase.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"inapppurchase\"><a href=\"#inapppurchase\">inAppPurchase</a></h1>\n<blockquote>\n<p>In-app purchases on Mac App Store.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<h2 id=\"ereignisse\"><a href=\"#ereignisse\">Ereignisse</a></h2>\n<p>Das <code>inAppPurchase</code> Modul sendet folgende Ereignisse aus:</p>\n<h3 id=\"event-transactions-updated\"><a href=\"#event-transactions-updated\">Event: 'transactions-updated'</a></h3>\n<p>Emitted when one or more transactions have been updated.</p>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>transactions</code> Transaction[] - Array of <a href=\"/docs/api/structures/transaction\"><code>Transaction</code></a> objects.</li>\n</ul>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das Modul <code>inAppPurchase</code> verfügt über die folgenden Methoden:</p>\n<h3 id=\"inapppurchasepurchaseproductproductid-quantity\"><a href=\"#inapppurchasepurchaseproductproductid-quantity\"><code>inAppPurchase.purchaseProduct(productID[, quantity])</code></a></h3>\n<ul>\n<li><code>productID</code> String - The identifiers of the product to purchase. (The identifier of <code>com.example.app.product1</code> is <code>product1</code>).</li>\n<li><code>quantity</code> Integer (optional) - The number of items the user wants to purchase.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Boolean></code> - Returns <code>true</code> if the product is valid and added to the payment queue.</p>\n<p>You should listen for the <code>transactions-updated</code> event as soon as possible and certainly before you call <code>purchaseProduct</code>.</p>\n<h3 id=\"inapppurchasegetproductsproductids\"><a href=\"#inapppurchasegetproductsproductids\"><code>inAppPurchase.getProducts(productIDs)</code></a></h3>\n<ul>\n<li><code>productIDs</code> String[] - The identifiers of the products to get.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Product[]></code> - Resolves with an array of <a href=\"/docs/api/structures/product\"><code>Product</code></a> objects.</p>\n<p>Retrieves the product descriptions.</p>\n<h3 id=\"inapppurchasecanmakepayments\"><a href=\"#inapppurchasecanmakepayments\"><code>inAppPurchase.canMakePayments()</code></a></h3>\n<p>Returns <code>Boolean</code> - whether a user can make a payment.</p>\n<h3 id=\"inapppurchaserestorecompletedtransactions\"><a href=\"#inapppurchaserestorecompletedtransactions\"><code>inAppPurchase.restoreCompletedTransactions()</code></a></h3>\n<p>Restores finished transactions. This method can be called either to install purchases on additional devices, or to restore purchases for an application that the user deleted and reinstalled.</p>\n<p><a href=\"https://developer.apple.com/documentation/storekit/skpaymentqueue?language=objc\">The payment queue</a> delivers a new transaction for each previously completed transaction that can be restored. Each transaction includes a copy of the original transaction.</p>\n<h3 id=\"inapppurchasegetreceipturl\"><a href=\"#inapppurchasegetreceipturl\"><code>inAppPurchase.getReceiptURL()</code></a></h3>\n<p>Returns <code>String</code> - the path to the receipt.</p>\n<h3 id=\"inapppurchasefinishalltransactions\"><a href=\"#inapppurchasefinishalltransactions\"><code>inAppPurchase.finishAllTransactions()</code></a></h3>\n<p>Completes all pending transactions.</p>\n<h3 id=\"inapppurchasefinishtransactionbydatedate\"><a href=\"#inapppurchasefinishtransactionbydatedate\"><code>inAppPurchase.finishTransactionByDate(date)</code></a></h3>\n<ul>\n<li><code>date</code> String - The ISO formatted date of the transaction to finish.</li>\n</ul>\n<p>Completes the pending transactions corresponding to the date.</p>",
      "title": "inAppPurchase",
      "description": "In-app purchases on Mac App Store."
    },
    "/docs/tutorial/in-app-purchases": {
      "locale": "de-DE",
      "slug": "in-app-purchases",
      "href": "/docs/tutorial/in-app-purchases",
      "crowdinFileId": "256203",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/in-app-purchases.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"in-app-purchases-macos\"><a href=\"#in-app-purchases-macos\">In-App Purchases (macOS)</a></h1>\n<h2 id=\"preparing\"><a href=\"#preparing\">Preparing</a></h2>\n<h3 id=\"paid-applications-agreement\"><a href=\"#paid-applications-agreement\">Paid Applications Agreement</a></h3>\n<p>If you haven't already, you’ll need to sign the Paid Applications Agreement and set up your banking and tax information in iTunes Connect.</p>\n<p><a href=\"https://help.apple.com/itunes-connect/developer/#/devb6df5ee51\">iTunes Connect Developer Help: Agreements, tax, and banking overview</a></p>\n<h3 id=\"create-your-in-app-purchases\"><a href=\"#create-your-in-app-purchases\">Create Your In-App Purchases</a></h3>\n<p>Then, you'll need to configure your in-app purchases in iTunes Connect, and include details such as name, pricing, and description that highlights the features and functionality of your in-app purchase.</p>\n<p><a href=\"https://help.apple.com/itunes-connect/developer/#/devae49fb316\">iTunes Connect Developer Help: Create an in-app purchase</a></p>\n<h3 id=\"change-the-cfbundleidentifier\"><a href=\"#change-the-cfbundleidentifier\">Change the CFBundleIdentifier</a></h3>\n<p>To test In-App Purchase in development with Electron you'll have to change the <code>CFBundleIdentifier</code> in <code>node_modules/electron/dist/Electron.app/Contents/Info.plist</code>. You have to replace <code>com.github.electron</code> by the bundle identifier of the application you created with iTunes Connect.</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>CFBundleIdentifier<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>com.example.app<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n</code></pre>\n<h2 id=\"code-example\"><a href=\"#code-example\">Code example</a></h2>\n<p>Here is an example that shows how to use In-App Purchases in Electron. You'll have to replace the product ids by the identifiers of the products created with iTunes Connect (the identifier of <code>com.example.app.product1</code> is <code>product1</code>). Note that you have to listen to the <code>transactions-updated</code> event as soon as possible in your app.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { inAppPurchase } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> PRODUCT_IDS = [<span class=\"hljs-string\">'id1'</span>, <span class=\"hljs-string\">'id2'</span>]\n\n<span class=\"hljs-comment\">// Listen for transactions as soon as possible.</span>\ninAppPurchase.on(<span class=\"hljs-string\">'transactions-updated'</span>, (event, transactions) => {\n  <span class=\"hljs-keyword\">if</span> (!<span class=\"hljs-built_in\">Array</span>.isArray(transactions)) {\n    <span class=\"hljs-keyword\">return</span>\n  }\n\n  <span class=\"hljs-comment\">// Check each transaction.</span>\n  transactions.forEach(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\">transaction</span>) </span>{\n    <span class=\"hljs-keyword\">const</span> payment = transaction.payment\n\n    <span class=\"hljs-keyword\">switch</span> (transaction.transactionState) {\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'purchasing'</span>:\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Purchasing <span class=\"hljs-subst\">${payment.productIdentifier}</span>...`</span>)\n        <span class=\"hljs-keyword\">break</span>\n\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'purchased'</span>: {\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${payment.productIdentifier}</span> purchased.`</span>)\n\n        <span class=\"hljs-comment\">// Get the receipt url.</span>\n        <span class=\"hljs-keyword\">const</span> receiptURL = inAppPurchase.getReceiptURL()\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Receipt URL: <span class=\"hljs-subst\">${receiptURL}</span>`</span>)\n\n        <span class=\"hljs-comment\">// Submit the receipt file to the server and check if it is valid.</span>\n        <span class=\"hljs-comment\">// @see https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html</span>\n        <span class=\"hljs-comment\">// ...</span>\n        <span class=\"hljs-comment\">// If the receipt is valid, the product is purchased</span>\n        <span class=\"hljs-comment\">// ...</span>\n\n        <span class=\"hljs-comment\">// Finish the transaction.</span>\n        inAppPurchase.finishTransactionByDate(transaction.transactionDate)\n\n        <span class=\"hljs-keyword\">break</span>\n      }\n\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'failed'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Failed to purchase <span class=\"hljs-subst\">${payment.productIdentifier}</span>.`</span>)\n\n        <span class=\"hljs-comment\">// Finish the transaction.</span>\n        inAppPurchase.finishTransactionByDate(transaction.transactionDate)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'restored'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The purchase of <span class=\"hljs-subst\">${payment.productIdentifier}</span> has been restored.`</span>)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-keyword\">case</span> <span class=\"hljs-string\">'deferred'</span>:\n\n        <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The purchase of <span class=\"hljs-subst\">${payment.productIdentifier}</span> has been deferred.`</span>)\n\n        <span class=\"hljs-keyword\">break</span>\n      <span class=\"hljs-attr\">default</span>:\n        <span class=\"hljs-keyword\">break</span>\n    }\n  })\n})\n\n<span class=\"hljs-comment\">// Check if the user is allowed to make in-app purchase.</span>\n<span class=\"hljs-keyword\">if</span> (!inAppPurchase.canMakePayments()) {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The user is not allowed to make in-app purchase.'</span>)\n}\n\n<span class=\"hljs-comment\">// Retrieve and display the product descriptions.</span>\ninAppPurchase.getProducts(PRODUCT_IDS).then(<span class=\"hljs-function\"><span class=\"hljs-params\">products</span> =></span> {\n  <span class=\"hljs-comment\">// Check the parameters.</span>\n  <span class=\"hljs-keyword\">if</span> (!<span class=\"hljs-built_in\">Array</span>.isArray(products) || products.length &#x3C;= <span class=\"hljs-number\">0</span>) {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Unable to retrieve the product informations.'</span>)\n    <span class=\"hljs-keyword\">return</span>\n  }\n\n  <span class=\"hljs-comment\">// Display the name and price of each product.</span>\n  products.forEach(<span class=\"hljs-function\"><span class=\"hljs-params\">product</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`The price of <span class=\"hljs-subst\">${product.localizedTitle}</span> is <span class=\"hljs-subst\">${product.formattedPrice}</span>.`</span>)\n  })\n\n  <span class=\"hljs-comment\">// Ask the user which product he/she wants to purchase.</span>\n  <span class=\"hljs-keyword\">const</span> selectedProduct = products[<span class=\"hljs-number\">0</span>]\n  <span class=\"hljs-keyword\">const</span> selectedQuantity = <span class=\"hljs-number\">1</span>\n\n  <span class=\"hljs-comment\">// Purchase the selected product.</span>\n  inAppPurchase.purchaseProduct(selectedProduct.productIdentifier, selectedQuantity).then(<span class=\"hljs-function\"><span class=\"hljs-params\">isProductValid</span> =></span> {\n    <span class=\"hljs-keyword\">if</span> (!isProductValid) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The product is not valid.'</span>)\n      <span class=\"hljs-keyword\">return</span>\n    }\n\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'The payment has been added to the payment queue.'</span>)\n  })\n})\n</code></pre>",
      "title": "In-App Purchases (macOS)",
      "description": ""
    },
    "/docs/api/incoming-message": {
      "locale": "de-DE",
      "slug": "incoming-message",
      "href": "/docs/api/incoming-message",
      "crowdinFileId": "256327",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/incoming-message.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"klasse-incomingmessage\"><a href=\"#klasse-incomingmessage\">Klasse: IncomingMessage</a></h2>\n<blockquote>\n<p>Behandelt Antworten zu HTTP/HTTPS Anfragen.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p><code>IncomingMessage</code> implementiert das <a href=\"https://nodejs.org/api/stream.html#stream_readable_streams\">Readable Stream</a> interface und ist somit ein <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<h3 id=\"instanz-ereignisse\"><a href=\"#instanz-ereignisse\">Instanz-Ereignisse</a></h3>\n<h4 id=\"event-data\"><a href=\"#event-data\">Event: 'data'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>chunk</code> Buffer - Ein Stück der Antwortdaten.</li>\n</ul>\n<p>Das <code>data</code> Event ist die gewöhnliche Methode um Antwortdaten in Anwendungscode zu transferieren.</p>\n<h4 id=\"event-end\"><a href=\"#event-end\">Event: 'end'</a></h4>\n<p>Gibt an dass der Body der Antwort endet. Must be placed before 'data' event.</p>\n<h4 id=\"event-aborted\"><a href=\"#event-aborted\">Event: 'aborted'</a></h4>\n<p>Ausgegeben wenn eine Anfrage während einer laufenden HTTP Transaktion abgebrochen wurde.</p>\n<h4 id=\"event-error\"><a href=\"#event-error\">Event: 'error'</a></h4>\n<p>Kehrt zurück:</p>\n<p><code>error</code> Error - Typically holds an error string identifying failure root cause.</p>\n<p>Emitted when an error was encountered while streaming response data events. For instance, if the server closes the underlying while the response is still streaming, an <code>error</code> event will be emitted on the response object and a <code>close</code> event will subsequently follow on the request object.</p>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<p>An <code>IncomingMessage</code> instance has the following readable properties:</p>\n<h4 id=\"responsestatuscode\"><a href=\"#responsestatuscode\"><code>response.statusCode</code></a></h4>\n<p>An <code>Integer</code> indicating the HTTP response status code.</p>\n<h4 id=\"responsestatusmessage\"><a href=\"#responsestatusmessage\"><code>response.statusMessage</code></a></h4>\n<p>A <code>String</code> representing the HTTP status message.</p>\n<h4 id=\"responseheaders\"><a href=\"#responseheaders\"><code>response.headers</code></a></h4>\n<p>A <code>Record&#x3C;string, string | string[]></code> representing the HTTP response headers. The <code>headers</code> object is formatted as follows:</p>\n<ul>\n<li>All header names are lowercased.</li>\n<li>Duplicates of <code>age</code>, <code>authorization</code>, <code>content-length</code>, <code>content-type</code>, <code>etag</code>, <code>expires</code>, <code>from</code>, <code>host</code>, <code>if-modified-since</code>, <code>if-unmodified-since</code>, <code>last-modified</code>, <code>location</code>, <code>max-forwards</code>, <code>proxy-authorization</code>, <code>referer</code>, <code>retry-after</code>, <code>server</code>, or <code>user-agent</code> are discarded.</li>\n<li><code>set-cookie</code> is always an array. Duplicates are added to the array.</li>\n<li>For duplicate <code>cookie</code> headers, the values are joined together with '; '.</li>\n<li>For all other headers, the values are joined together with ', '.</li>\n</ul>\n<h4 id=\"responsehttpversion\"><a href=\"#responsehttpversion\"><code>response.httpVersion</code></a></h4>\n<p>A <code>String</code> indicating the HTTP protocol version number. Typical values are '1.0' or '1.1'. Additionally <code>httpVersionMajor</code> and <code>httpVersionMinor</code> are two Integer-valued readable properties that return respectively the HTTP major and minor version numbers.</p>\n<h4 id=\"responsehttpversionmajor\"><a href=\"#responsehttpversionmajor\"><code>response.httpVersionMajor</code></a></h4>\n<p>An <code>Integer</code> indicating the HTTP protocol major version number.</p>\n<h4 id=\"responsehttpversionminor\"><a href=\"#responsehttpversionminor\"><code>response.httpVersionMinor</code></a></h4>\n<p>An <code>Integer</code> indicating the HTTP protocol minor version number.</p>",
      "title": "Klasse: IncomingMessage",
      "description": "Behandelt Antworten zu HTTP/HTTPS Anfragen."
    },
    "/docs/api/structures/input-event": {
      "locale": "de-DE",
      "slug": "input-event",
      "href": "/docs/api/structures/input-event",
      "crowdinFileId": "256441",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"inputevent-object\"><a href=\"#inputevent-object\">InputEvent Object</a></h1>\n<ul>\n<li><code>modifiers</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of modifiers of the event, can be <code>shift</code>, <code>control</code>, <code>ctrl</code>, <code>alt</code>, <code>meta</code>, <code>command</code>, <code>cmd</code>, <code>isKeypad</code>, <code>isAutoRepeat</code>, <code>leftButtonDown</code>, <code>middleButtonDown</code>, <code>rightButtonDown</code>, <code>capsLock</code>, <code>numLock</code>, <code>left</code>, <code>right</code>.</li>\n</ul>",
      "title": "InputEvent Object",
      "description": ""
    },
    "/docs/tutorial/installation": {
      "locale": "de-DE",
      "slug": "installation",
      "href": "/docs/tutorial/installation",
      "crowdinFileId": "256205",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/installation.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"advanced-installation-instructions\"><a href=\"#advanced-installation-instructions\">Advanced Installation Instructions</a></h1>\n<p>To install prebuilt Electron binaries, use <a href=\"https://docs.npmjs.com\"><code>npm</code></a>. The preferred method is to install Electron as a development dependency in your app:</p>\n<pre><code class=\"hljs language-sh\">npm install electron --save-dev\n</code></pre>\n<p>See the <a href=\"/docs/tutorial/electron-versioning\">Electron versioning doc</a> for info on how to manage Electron versions in your apps.</p>\n<h2 id=\"running-electron-ad-hoc\"><a href=\"#running-electron-ad-hoc\">Running Electron ad-hoc</a></h2>\n<p>If you're in a pinch and would prefer to not use <code>npm install</code> in your local project, you can also run Electron ad-hoc using the <a href=\"https://docs.npmjs.com/cli/v7/commands/npx\"><code>npx</code></a> command runner bundled with <code>npm</code>:</p>\n<pre><code class=\"hljs language-sh\">npx electron .\n</code></pre>\n<p>The above command will run the current working directory with Electron. Note that any dependencies in your app will not be installed.</p>\n<h2 id=\"individuelle-anpassung\"><a href=\"#individuelle-anpassung\">Individuelle Anpassung</a></h2>\n<p>Falls Sie die herunterzuladende Architektur ändern möchten (z.B. <code>ia32</code> auf einem <code>x64</code>-Rechner), dann können Sie den <code>--arch</code>-Flag verwenden oder die Umgebungsvariable <code>npm_config_arch</code> setzen:</p>\n<pre><code class=\"hljs language-shell\">npm install --arch=ia32 electron\n</code></pre>\n<p>Zusätzlich zur Änderung der Architektur können Sie auch die Plattform (z.B. <code>win32</code>, <code>linux</code>, usw.) mittels des <code>--platform</code>-Flags spezifizieren:</p>\n<pre><code class=\"hljs language-shell\">npm install --platform=win32 electron\n</code></pre>\n<h2 id=\"proxys\"><a href=\"#proxys\">Proxys</a></h2>\n<p>If you need to use an HTTP proxy, you need to set the <code>ELECTRON_GET_USE_PROXY</code> variable to any value, plus additional environment variables depending on your host system's Node version:</p>\n<ul>\n<li><a href=\"https://github.com/gajus/global-agent/blob/v2.1.5/README.md#environment-variables\">Node 10 and above</a></li>\n<li><a href=\"https://github.com/np-maintain/global-tunnel/blob/v2.7.1/README.md#auto-config\">Before Node 10</a></li>\n</ul>\n<h2 id=\"benutzerdefinierte-mirrors-und-caches\"><a href=\"#benutzerdefinierte-mirrors-und-caches\">Benutzerdefinierte Mirrors und Caches</a></h2>\n<p>During installation, the <code>electron</code> module will call out to <a href=\"https://github.com/electron/get\"><code>@electron/get</code></a> to download prebuilt binaries of Electron for your platform. It will do so by contacting GitHub's release download page (<code>https://github.com/electron/electron/releases/tag/v$VERSION</code>, where <code>$VERSION</code> is the exact version of Electron).</p>\n<p>If you are unable to access GitHub or you need to provide a custom build, you can do so by either providing a mirror or an existing cache directory.</p>\n<h4 id=\"mirror\"><a href=\"#mirror\">Mirror</a></h4>\n<p>You can use environment variables to override the base URL, the path at which to look for Electron binaries, and the binary filename. The URL used by <code>@electron/get</code> is composed as follows:</p>\n<pre><code class=\"hljs language-javascript\">url = ELECTRON_MIRROR + ELECTRON_CUSTOM_DIR + <span class=\"hljs-string\">'/'</span> + ELECTRON_CUSTOM_FILENAME\n</code></pre>\n<p>For instance, to use the China CDN mirror:</p>\n<pre><code class=\"hljs language-shell\">ELECTRON_MIRROR=\"https://cdn.npm.taobao.org/dist/electron/\"\n</code></pre>\n<p>By default, <code>ELECTRON_CUSTOM_DIR</code> is set to <code>v$VERSION</code>. To change the format, use the <code>{{ version }}</code> placeholder. For example, <code>version-{{ version }}</code> resolves to <code>version-5.0.0</code>, <code>{{ version }}</code> resolves to <code>5.0.0</code>, and <code>v{{ version }}</code> is equivalent to the default. As a more concrete example, to use the China non-CDN mirror:</p>\n<pre><code class=\"hljs language-shell\">ELECTRON_MIRROR=\"https://npm.taobao.org/mirrors/electron/\"\nELECTRON_CUSTOM_DIR=\"{{ version }}\"\n</code></pre>\n<p>The above configuration will download from URLs such as <code>https://npm.taobao.org/mirrors/electron/8.0.0/electron-v8.0.0-linux-x64.zip</code>.</p>\n<p>If your mirror serves artifacts with different checksums to the official Electron release you may have to set <code>ELECTRON_USE_REMOTE_CHECKSUMS=1</code> to force Electron to use the remote <code>SHASUMS256.txt</code> file to verify the checksum instead of the embedded checksums.</p>\n<h4 id=\"cache\"><a href=\"#cache\">Cache</a></h4>\n<p>Alternatively, you can override the local cache. <code>@electron/get</code> will cache downloaded binaries in a local directory to not stress your network. You can use that cache folder to provide custom builds of Electron or to avoid making contact with the network at all.</p>\n<ul>\n<li>Linux: <code>$XDG_CACHE_HOME</code> or <code>~/.cache/electron/</code></li>\n<li>macOS: <code>~/Library/Caches/electron/</code></li>\n<li>Windows: <code>$LOCALAPPDATA/electron/Cache</code> or <code>~/AppData/Local/electron/Cache/</code></li>\n</ul>\n<p>On environments that have been using older versions of Electron, you might find the cache also in <code>~/.electron</code>.</p>\n<p>You can also override the local cache location by providing a <code>electron_config_cache</code> environment variable.</p>\n<p>The cache contains the version's official zip file as well as a checksum, stored as a text file. A typical cache might look like this:</p>\n<pre><code class=\"hljs language-sh\">├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9electron-v1.7.9-darwin-x64.zip\n│   └── electron-v1.7.9-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.7.9SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1electron-v1.8.1-darwin-x64.zip\n│   └── electron-v1.8.1-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.1SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1electron-v1.8.2-beta.1-darwin-x64.zip\n│   └── electron-v1.8.2-beta.1-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.1SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2electron-v1.8.2-beta.2-darwin-x64.zip\n│   └── electron-v1.8.2-beta.2-darwin-x64.zip\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.2SHASUMS256.txt\n│   └── SHASUMS256.txt\n├── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3electron-v1.8.2-beta.3-darwin-x64.zip\n│   └── electron-v1.8.2-beta.3-darwin-x64.zip\n└── httpsgithub.comelectronelectronreleasesdownloadv1.8.2-beta.3SHASUMS256.txt\n    └── SHASUMS256.txt\n</code></pre>\n<h2 id=\"skip-binary-download\"><a href=\"#skip-binary-download\">Skip binary download</a></h2>\n<p>Under the hood, Electron's JavaScript API binds to a binary that contains its implementations. Because this binary is crucial to the function of any Electron app, it is downloaded by default in the <code>postinstall</code> step every time you install <code>electron</code> from the npm registry.</p>\n<p>However, if you want to install your project's dependencies but don't need to use Electron functionality, you can set the <code>ELECTRON_SKIP_BINARY_DOWNLOAD</code> environment variable to prevent the binary from being downloaded. For instance, this feature can be useful in continuous integration environments when running unit tests that mock out the <code>electron</code> module.</p>\n<pre><code class=\"hljs language-sh\">ELECTRON_SKIP_BINARY_DOWNLOAD=1 npm install\n</code></pre>\n<h2 id=\"problemlösungen\"><a href=\"#problemlösungen\">Problemlösungen</a></h2>\n<p>Beim Ausführen von <code>npm install electron</code> können bei einigen Nutzern gelegentlich Installationsfehler auftreten.</p>\n<p>In fast allen Fällen sind diese Fehler das Ergebnis von Netzwerkproblemen und nicht von tatsächlichen Problemen mit dem Paket <code>electron</code> npm. Fehler wie <code>ELIFECYCLE</code>, <code>EAI_AGAIN</code>, <code>ECONNRESET</code>, and <code>ETIMEDOUT</code> weisen alle auf ein Problem mit dem Netzwerk hin. Die beste Lösung ist es zu Versuchen die Netzwerkverbindung zu wechseln oder etwas zu warten und die Installation erneut zu versuchen.</p>\n<p>You can also attempt to download Electron directly from <a href=\"https://github.com/electron/electron/releases\">electron/electron/releases</a> if installing via <code>npm</code> is failing.</p>\n<p>If installation fails with an <code>EACCESS</code> error you may need to <a href=\"https://docs.npmjs.com/getting-started/fixing-npm-permissions\">fix your npm permissions</a>.</p>\n<p>If the above error persists, the <a href=\"https://docs.npmjs.com/misc/config#unsafe-perm\">unsafe-perm</a> flag may need to be set to true:</p>\n<pre><code class=\"hljs language-sh\">sudo npm install electron --unsafe-perm=<span class=\"hljs-literal\">true</span>\n</code></pre>\n<p>On slower networks, it may be advisable to use the <code>--verbose</code> flag in order to show download progress:</p>\n<pre><code class=\"hljs language-sh\">npm install --verbose electron\n</code></pre>\n<p>If you need to force a re-download of the asset and the SHASUM file set the <code>force_no_cache</code> environment variable to <code>true</code>.</p>",
      "title": "Advanced Installation Instructions",
      "description": ""
    },
    "/docs/tutorial/introduction": {
      "locale": "de-DE",
      "slug": "introduction",
      "href": "/docs/tutorial/introduction",
      "crowdinFileId": "256207",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/introduction.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"einführung\"><a href=\"#einführung\">Einführung</a></h1>\n<p>Willkommen bei der Electron-Dokumentation! Wenn Sie zum ersten Mal eine Electron-App entwickeln, lesen Sie diesen Abschnitt \"Erste Schritte\" durch, um sich mit den Grundlagen vertraut zu machen. Andernfalls können Sie gerne unsere Anleitungen und die Api-Dokumentation erkunden! If this is your first time developing an Electron app, read through this Getting Started section to get familiar with the basics. Otherwise, feel free to explore our guides and API documentation!</p>\n<h2 id=\"what-is-electron\"><a href=\"#what-is-electron\">What is Electron?</a></h2>\n<p>Electron is a framework for building desktop applications using JavaScript, HTML, and CSS. By embedding <a href=\"https://www.chromium.org/\">Chromium</a> and <a href=\"https://nodejs.org/\">Node.js</a> into its binary, Electron allows you to maintain one JavaScript codebase and create cross-platform apps that work on Windows, macOS, and Linux — no native development experience required.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<p>These docs operate under the assumption that the reader is familiar with both Node.js and general web development. If you need to get more comfortable with either of these areas, we recommend the following resources:</p>\n<ul>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web\">Getting started with the Web (MDN)</a></li>\n<li><a href=\"https://nodejs.dev/learn\">Introduction to Node.js</a></li>\n</ul>\n<p>Moreover, you'll have a better time understanding how Electron works if you get acquainted with Chromium's process model. You can get a brief overview of Chrome architecture with the <a href=\"https://www.google.com/googlebooks/chrome/\">Chrome comic</a>, which was released alongside Chrome's launch back in 2008. Although it's been over a decade since then, the core principles introduced in the comic remain helpful to understand Electron.</p>\n<h2 id=\"running-examples-with-electron-fiddle\"><a href=\"#running-examples-with-electron-fiddle\">Running examples with Electron Fiddle</a></h2>\n<p><a href=\"https://electronjs.org/fiddle\">Electron Fiddle</a> is a sandbox app written with Electron and supported by Electron's maintainers. We highly recommend installing it as a learning tool to experiment with Electron's APIs or to prototype features during development.</p>\n<p>Fiddle also integrates nicely with our documentation. When browsing through examples in our tutorials, you'll frequently see an \"Open in Electron Fiddle\" button underneath a code block. If you have Fiddle installed, this button will open a <code>fiddle.electronjs.org</code> link that will automatically load the example into Fiddle, no copy-pasting required.</p>\n<h2 id=\"getting-help\"><a href=\"#getting-help\">Getting help</a></h2>\n<p>Are you getting stuck anywhere? Here are a few links to places to look:</p>\n<ul>\n<li>If you need help with developing your app, our <a href=\"https://discord.gg/electron\">community Discord server</a> is a great place to get advice from other Electron app developers.</li>\n<li>If you suspect you're running into a bug with the <code>electron</code> package, please check the <a href=\"https://github.com/electron/electron/issues\">GitHub issue tracker</a> to see if any existing issues match your problem. If not, feel free to fill out our bug report template and submit a new issue.</li>\n</ul>",
      "title": "Einführung",
      "description": ""
    },
    "/docs/api/structures/io-counters": {
      "locale": "de-DE",
      "slug": "io-counters",
      "href": "/docs/api/structures/io-counters",
      "crowdinFileId": "256443",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/io-counters.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"iocounters-object\"><a href=\"#iocounters-object\">IOCounters Object</a></h1>\n<ul>\n<li><code>readOperationCount</code> Number - The number of I/O read operations.</li>\n<li><code>writeOperationCount</code> Number - The number of I/O write operations.</li>\n<li><code>otherOperationCount</code> Number - Then number of I/O other operations.</li>\n<li><code>readTransferCount</code> Number - The number of I/O read transfers.</li>\n<li><code>writeTransferCount</code> Number - The number of I/O write transfers.</li>\n<li><code>otherTransferCount</code> Number - Then number of I/O other transfers.</li>\n</ul>",
      "title": "IOCounters Object",
      "description": ""
    },
    "/docs/api/ipc-main": {
      "locale": "de-DE",
      "slug": "ipc-main",
      "href": "/docs/api/ipc-main",
      "crowdinFileId": "256329",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/ipc-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmain\"><a href=\"#ipcmain\">ipcMain</a></h1>\n<blockquote>\n<p>Communicate asynchronously from the main process to renderer processes.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p>The <code>ipcMain</code> module is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">Event Emitter</a>. When used in the main process, it handles asynchronous and synchronous messages sent from a renderer process (web page). Messages sent from a renderer will be emitted to this module.</p>\n<h2 id=\"sending-messages\"><a href=\"#sending-messages\">Sending Messages</a></h2>\n<p>It is also possible to send messages from the main process to the renderer process, see <a href=\"/docs/api/web-contents#contentssendchannel-args\">webContents.send</a> for more information.</p>\n<ul>\n<li>When sending a message, the event name is the <code>channel</code>.</li>\n<li>To reply to a synchronous message, you need to set <code>event.returnValue</code>.</li>\n<li>To send an asynchronous message back to the sender, you can use <code>event.reply(...)</code>.  This helper method will automatically handle messages coming from frames that aren't the main frame (e.g. iframes) whereas <code>event.sender.send(...)</code> will always send to the main frame.</li>\n</ul>\n<p>An example of sending and handling messages between the render and main processes:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In main process.</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'asynchronous-message'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"ping\"</span>\n  event.reply(<span class=\"hljs-string\">'asynchronous-reply'</span>, <span class=\"hljs-string\">'pong'</span>)\n})\n\nipcMain.on(<span class=\"hljs-string\">'synchronous-message'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"ping\"</span>\n  event.returnValue = <span class=\"hljs-string\">'pong'</span>\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In renderer process (web page).</span>\n<span class=\"hljs-comment\">// NB. Electron APIs are only accessible from preload, unless contextIsolation is disabled.</span>\n<span class=\"hljs-comment\">// See https://www.electronjs.org/docs/tutorial/process-model#preload-scripts for more details.</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(ipcRenderer.sendSync(<span class=\"hljs-string\">'synchronous-message'</span>, <span class=\"hljs-string\">'ping'</span>)) <span class=\"hljs-comment\">// prints \"pong\"</span>\n\nipcRenderer.on(<span class=\"hljs-string\">'asynchronous-reply'</span>, (event, arg) => {\n  <span class=\"hljs-built_in\">console</span>.log(arg) <span class=\"hljs-comment\">// prints \"pong\"</span>\n})\nipcRenderer.send(<span class=\"hljs-string\">'asynchronous-message'</span>, <span class=\"hljs-string\">'ping'</span>)\n</code></pre>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>The <code>ipcMain</code> module has the following method to listen for events:</p>\n<h3 id=\"ipcmainonchannel-listener\"><a href=\"#ipcmainonchannel-listener\"><code>ipcMain.on(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Funktion<ul>\n<li><code>event</code> IpcMainEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Listens to <code>channel</code>, when a new message arrives <code>listener</code> would be called with <code>listener(event, args...)</code>.</p>\n<h3 id=\"ipcmainoncechannel-listener\"><a href=\"#ipcmainoncechannel-listener\"><code>ipcMain.once(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Funktion<ul>\n<li><code>event</code> IpcMainEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Adds a one time <code>listener</code> function for the event. This <code>listener</code> is invoked only the next time a message is sent to <code>channel</code>, after which it is removed.</p>\n<h3 id=\"ipcmainremovelistenerchannel-listener\"><a href=\"#ipcmainremovelistenerchannel-listener\"><code>ipcMain.removeListener(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Funktion<ul>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Removes the specified <code>listener</code> from the listener array for the specified <code>channel</code>.</p>\n<h3 id=\"ipcmainremovealllistenerschannel\"><a href=\"#ipcmainremovealllistenerschannel\"><code>ipcMain.removeAllListeners([channel])</code></a></h3>\n<ul>\n<li><code>channel</code> String (optional)</li>\n</ul>\n<p>Removes listeners of the specified <code>channel</code>.</p>\n<h3 id=\"ipcmainhandlechannel-listener\"><a href=\"#ipcmainhandlechannel-listener\"><code>ipcMain.handle(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function&#x3C;Promise\\<void> | any><ul>\n<li><code>event</code> IpcMainInvokeEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></void></li>\n</ul>\n<p>Adds a handler for an <code>invoke</code>able IPC. This handler will be called whenever a renderer calls <code>ipcRenderer.invoke(channel, ...args)</code>.</p>\n<p>If <code>listener</code> returns a Promise, the eventual result of the promise will be returned as a reply to the remote caller. Otherwise, the return value of the listener will be used as the value of the reply.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\nipcMain.handle(<span class=\"hljs-string\">'my-invokable-ipc'</span>, <span class=\"hljs-keyword\">async</span> (event, ...args) => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> somePromise(...args)\n  <span class=\"hljs-keyword\">return</span> result\n})\n\n<span class=\"hljs-comment\">// Renderer process</span>\n<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> ipcRenderer.invoke(<span class=\"hljs-string\">'my-invokable-ipc'</span>, arg1, arg2)\n  <span class=\"hljs-comment\">// ...</span>\n}\n</code></pre>\n<p>The <code>event</code> that is passed as the first argument to the handler is the same as that passed to a regular event listener. It includes information about which WebContents is the source of the invoke request.</p>\n<p>Errors thrown through <code>handle</code> in the main process are not transparent as they are serialized and only the <code>message</code> property from the original error is provided to the renderer process. Please refer to <a href=\"https://github.com/electron/electron/issues/24427\">#24427</a> for details.</p>\n<h3 id=\"ipcmainhandleoncechannel-listener\"><a href=\"#ipcmainhandleoncechannel-listener\"><code>ipcMain.handleOnce(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Function&#x3C;Promise\\<void> | any><ul>\n<li><code>event</code> IpcMainInvokeEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></void></li>\n</ul>\n<p>Handles a single <code>invoke</code>able IPC message, then removes the listener. See <code>ipcMain.handle(channel, listener)</code>.</p>\n<h3 id=\"ipcmainremovehandlerchannel\"><a href=\"#ipcmainremovehandlerchannel\"><code>ipcMain.removeHandler(channel)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n</ul>\n<p>Removes any handler for <code>channel</code>, if present.</p>\n<h2 id=\"ipcmainevent-object\"><a href=\"#ipcmainevent-object\">IpcMainEvent object</a></h2>\n<p>The documentation for the <code>event</code> object passed to the <code>callback</code> can be found in the <a href=\"/docs/api/structures/ipc-main-event\"><code>ipc-main-event</code></a> structure docs.</p>\n<h2 id=\"ipcmaininvokeevent-object\"><a href=\"#ipcmaininvokeevent-object\">IpcMainInvokeEvent object</a></h2>\n<p>The documentation for the <code>event</code> object passed to <code>handle</code> callbacks can be found in the <a href=\"/docs/api/structures/ipc-main-invoke-event\"><code>ipc-main-invoke-event</code></a> structure docs.</p>",
      "title": "ipcMain",
      "description": "Communicate asynchronously from the main process to renderer processes."
    },
    "/docs/api/structures/ipc-main-event": {
      "locale": "de-DE",
      "slug": "ipc-main-event",
      "href": "/docs/api/structures/ipc-main-event",
      "crowdinFileId": "256445",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-main-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmainevent-object-extends-event\"><a href=\"#ipcmainevent-object-extends-event\">IpcMainEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>processId</code> Integer - The internal ID of the renderer process that sent this message</li>\n<li><code>frameId</code> Integer - The ID of the renderer frame that sent this message</li>\n<li><code>returnValue</code> any - Set this to the value to be returned in a synchronous message</li>\n<li><code>sender</code> WebContents - Returns the <code>webContents</code> that sent the message</li>\n<li><code>senderFrame</code> WebFrameMain <em>Readonly</em> - The frame that sent this message</li>\n<li><code>ports</code> MessagePortMain[] - A list of MessagePorts that were transferred with this message</li>\n<li><code>reply</code> Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling.  You should use this method to \"reply\" to the sent message in order to guarantee the reply will go to the correct process and frame.<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>",
      "title": "IpcMainEvent Object extends Event",
      "description": ""
    },
    "/docs/api/structures/ipc-main-invoke-event": {
      "locale": "de-DE",
      "slug": "ipc-main-invoke-event",
      "href": "/docs/api/structures/ipc-main-invoke-event",
      "crowdinFileId": "256447",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-main-invoke-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcmaininvokeevent-object-extends-event\"><a href=\"#ipcmaininvokeevent-object-extends-event\">IpcMainInvokeEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>processId</code> Integer - The internal ID of the renderer process that sent this message</li>\n<li><code>frameId</code> Integer - The ID of the renderer frame that sent this message</li>\n<li><code>sender</code> WebContents - Returns the <code>webContents</code> that sent the message</li>\n<li><code>senderFrame</code> WebFrameMain <em>Readonly</em> - The frame that sent this message</li>\n</ul>",
      "title": "IpcMainInvokeEvent Object extends Event",
      "description": ""
    },
    "/docs/api/ipc-renderer": {
      "locale": "de-DE",
      "slug": "ipc-renderer",
      "href": "/docs/api/ipc-renderer",
      "crowdinFileId": "256331",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/ipc-renderer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcrenderer\"><a href=\"#ipcrenderer\">ipcRenderer</a></h1>\n<blockquote>\n<p>Communicate asynchronously from a renderer process to the main process.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>The <code>ipcRenderer</code> module is an  <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>. It provides a few methods so you can send synchronous and asynchronous messages from the render process (web page) to the main process. You can also receive replies from the main process.</p>\n<p>See <a href=\"/docs/api/ipc-main\">ipcMain</a> for code examples.</p>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>The <code>ipcRenderer</code> module has the following method to listen for events and send messages:</p>\n<h3 id=\"ipcrendereronchannel-listener\"><a href=\"#ipcrendereronchannel-listener\"><code>ipcRenderer.on(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Funktion<ul>\n<li><code>event</code> IpcRendererEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Listens to <code>channel</code>, when a new message arrives <code>listener</code> would be called with <code>listener(event, args...)</code>.</p>\n<h3 id=\"ipcrendereroncechannel-listener\"><a href=\"#ipcrendereroncechannel-listener\"><code>ipcRenderer.once(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Funktion<ul>\n<li><code>event</code> IpcRendererEvent</li>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Adds a one time <code>listener</code> function for the event. This <code>listener</code> is invoked only the next time a message is sent to <code>channel</code>, after which it is removed.</p>\n<h3 id=\"ipcrendererremovelistenerchannel-listener\"><a href=\"#ipcrendererremovelistenerchannel-listener\"><code>ipcRenderer.removeListener(channel, listener)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>listener</code> Funktion<ul>\n<li><code>...args</code> any[]</li>\n</ul></li>\n</ul>\n<p>Removes the specified <code>listener</code> from the listener array for the specified <code>channel</code>.</p>\n<h3 id=\"ipcrendererremovealllistenerschannel\"><a href=\"#ipcrendererremovealllistenerschannel\"><code>ipcRenderer.removeAllListeners(channel)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n</ul>\n<p>Removes all listeners, or those of the specified <code>channel</code>.</p>\n<h3 id=\"ipcrenderersendchannel-args\"><a href=\"#ipcrenderersendchannel-args\"><code>ipcRenderer.send(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to the main process via <code>channel</code>, along with arguments. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over Electron's IPC to the main process, as the main process would have no way to decode them. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>The main process handles it by listening for <code>channel</code> with the <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> module.</p>\n<p>If you need to transfer a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> to the main process, use <a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a>.</p>\n<p>If you want to receive a single response from the main process, like the result of a method call, consider using <a href=\"#ipcrendererinvokechannel-args\"><code>ipcRenderer.invoke</code></a>.</p>\n<h3 id=\"ipcrendererinvokechannel-args\"><a href=\"#ipcrendererinvokechannel-args\"><code>ipcRenderer.invoke(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - Resolves with the response from the main process.</p>\n<p>Send a message to the main process via <code>channel</code> and expect a result asynchronously. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over Electron's IPC to the main process, as the main process would have no way to decode them. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>The main process should listen for <code>channel</code> with <a href=\"/docs/api/ipc-main#ipcmainhandlechannel-listener\"><code>ipcMain.handle()</code></a>.</p>\n<p>Ein Beispiel:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.invoke(<span class=\"hljs-string\">'some-name'</span>, someArgument).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">result</span>) =></span> {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// Main process</span>\nipcMain.handle(<span class=\"hljs-string\">'some-name'</span>, <span class=\"hljs-keyword\">async</span> (event, someArgument) => {\n  <span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">await</span> doSomeWork(someArgument)\n  <span class=\"hljs-keyword\">return</span> result\n})\n</code></pre>\n<p>If you need to transfer a <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> to the main process, use <a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a>.</p>\n<p>If you do not need a response to the message, consider using <a href=\"#ipcrenderersendchannel-args\"><code>ipcRenderer.send</code></a>.</p>\n<h3 id=\"ipcrenderersendsyncchannel-args\"><a href=\"#ipcrenderersendsyncchannel-args\"><code>ipcRenderer.sendSync(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Returns <code>any</code> - The value sent back by the <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> handler.</p>\n<p>Send a message to the main process via <code>channel</code> and expect a result synchronously. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>window.postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n<p>Since the main process does not have support for DOM objects such as <code>ImageBitmap</code>, <code>File</code>, <code>DOMMatrix</code> and so on, such objects cannot be sent over Electron's IPC to the main process, as the main process would have no way to decode them. Attempting to send such objects over IPC will result in an error.</p>\n</blockquote>\n<p>The main process handles it by listening for <code>channel</code> with <a href=\"/docs/api/ipc-main\"><code>ipcMain</code></a> module, and replies by setting <code>event.returnValue</code>.</p>\n<blockquote>\n<p>⚠️ <strong>WARNING</strong>: Sending a synchronous message will block the whole renderer process until the reply is received, so use this method only as a last resort. It's much better to use the asynchronous version, <a href=\"/docs/api/ipc-renderer#ipcrendererinvokechannel-args\"><code>invoke()</code></a>.</p>\n</blockquote>\n<h3 id=\"ipcrendererpostmessagechannel-message-transfer\"><a href=\"#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage(channel, message, [transfer])</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePort<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Send a message to the main process, optionally transferring ownership of zero or more <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> objects.</p>\n<p>The transferred <code>MessagePort</code> objects will be available in the main process as <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> objects by accessing the <code>ports</code> property of the emitted event.</p>\n<p>Ein Beispiel:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Renderer process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannel()\nipcRenderer.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Main process</span>\nipcMain.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<p>For more information on using <code>MessagePort</code> and <code>MessageChannel</code>, see the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\">MDN documentation</a>.</p>\n<h3 id=\"ipcrenderersendtowebcontentsid-channel-args\"><a href=\"#ipcrenderersendtowebcontentsid-channel-args\"><code>ipcRenderer.sendTo(webContentsId, channel, ...args)</code></a></h3>\n<ul>\n<li><code>webContentsId</code> Number</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Sends a message to a window with <code>webContentsId</code> via <code>channel</code>.</p>\n<h3 id=\"ipcrenderersendtohostchannel-args\"><a href=\"#ipcrenderersendtohostchannel-args\"><code>ipcRenderer.sendToHost(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Like <code>ipcRenderer.send</code> but the event will be sent to the <code>&#x3C;webview></code> element in the host page instead of the main process.</p>\n<h2 id=\"event-object\"><a href=\"#event-object\">Event object</a></h2>\n<p>The documentation for the <code>event</code> object passed to the <code>callback</code> can be found in the <a href=\"/docs/api/structures/ipc-renderer-event\"><code>ipc-renderer-event</code></a> structure docs.</p>",
      "title": "ipcRenderer",
      "description": "Communicate asynchronously from a renderer process to the main process."
    },
    "/docs/api/structures/ipc-renderer-event": {
      "locale": "de-DE",
      "slug": "ipc-renderer-event",
      "href": "/docs/api/structures/ipc-renderer-event",
      "crowdinFileId": "256449",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/ipc-renderer-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"ipcrendererevent-object-extends-event\"><a href=\"#ipcrendererevent-object-extends-event\">IpcRendererEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>sender</code> IpcRenderer - The <code>IpcRenderer</code> instance that emitted the event originally</li>\n<li><code>senderId</code> Integer - The <code>webContents.id</code> that sent the message, you can call <code>event.sender.sendTo(event.senderId, ...)</code> to reply to the message, see <a href=\"/docs/api/ipc-renderer#ipcrenderersendtowebcontentsid-channel-args\">ipcRenderer.sendTo</a> for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set <code>event.senderId</code> to <code>0</code>.</li>\n<li><code>ports</code> MessagePort[] - A list of MessagePorts that were transferred with this message</li>\n</ul>",
      "title": "IpcRendererEvent Object extends Event",
      "description": ""
    },
    "/docs/development/issues": {
      "locale": "de-DE",
      "slug": "issues",
      "href": "/docs/development/issues",
      "crowdinFileId": "256159",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/issues.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"issues-in-electron\"><a href=\"#issues-in-electron\">Issues In Electron</a></h1>\n<ul>\n<li><a href=\"#how-to-contribute-to-issues\">How to Contribute to Issues</a></li>\n<li><a href=\"#asking-for-general-help\">Asking for General Help</a></li>\n<li><a href=\"#submitting-a-bug-report\">Submitting a Bug Report</a></li>\n<li><a href=\"#triaging-a-bug-report\">Triaging a Bug Report</a></li>\n<li><a href=\"#resolving-a-bug-report\">Resolving a Bug Report</a></li>\n</ul>\n<h2 id=\"how-to-contribute-to-issues\"><a href=\"#how-to-contribute-to-issues\">How to Contribute to Issues</a></h2>\n<p>For any issue, there are fundamentally three ways an individual can contribute:</p>\n<ol>\n<li>By opening the issue for discussion: If you believe that you have found a new bug in Electron, you should report it by creating a new issue in the <a href=\"https://github.com/electron/electron/issues\"><code>electron/electron</code> issue tracker</a>.</li>\n<li>By helping to triage the issue: You can do this either by providing assistive details (a reproducible test case that demonstrates a bug) or by providing suggestions to address the issue.</li>\n<li>By helping to resolve the issue: This can be done by demonstrating that the issue is not a bug or is fixed; but more often, by opening a pull request that changes the source in <code>electron/electron</code> in a concrete and reviewable manner.</li>\n</ol>\n<h2 id=\"asking-for-general-help\"><a href=\"#asking-for-general-help\">Asking for General Help</a></h2>\n<p><a href=\"/docs/tutorial/support#finding-support\">\"Finding Support\"</a> has a list of resources for getting programming help, reporting security issues, contributing, and more. Please use the issue tracker for bugs only!</p>\n<h2 id=\"submitting-a-bug-report\"><a href=\"#submitting-a-bug-report\">Submitting a Bug Report</a></h2>\n<p>To submit a bug report:</p>\n<p>When opening a new issue in the <a href=\"https://github.com/electron/electron/issues/new/choose\"><code>electron/electron</code> issue tracker</a>, users will be presented with a template that should be filled in.</p>\n<p>If you believe that you have found a bug in Electron, please fill out the template to the best of your ability.</p>\n<p>The two most important pieces of information needed to evaluate the report are a description of the bug and a simple test case to recreate it. It is easier to fix a bug if it can be reproduced.</p>\n<p>See <a href=\"https://stackoverflow.com/help/mcve\">How to create a Minimal, Complete, and Verifiable example</a>.</p>\n<h2 id=\"triaging-a-bug-report\"><a href=\"#triaging-a-bug-report\">Triaging a Bug Report</a></h2>\n<p>It's common for open issues to involve discussion. Some contributors may have differing opinions, including whether the behavior is a bug or feature. This discussion is part of the process and should be kept focused, helpful, and professional.</p>\n<p>Terse responses that provide neither additional context nor supporting detail are not helpful or professional. To many, such responses are annoying and unfriendly.</p>\n<p>Contributors are encouraged to solve issues collaboratively and help one another make progress. If you encounter an issue that you feel is invalid, or which contains incorrect information, explain <em>why</em> you feel that way with additional supporting context, and be willing to be convinced that you may be wrong. By doing so, we can often reach the correct outcome faster.</p>\n<h2 id=\"resolving-a-bug-report\"><a href=\"#resolving-a-bug-report\">Resolving a Bug Report</a></h2>\n<p>Most issues are resolved by opening a pull request. The process for opening and reviewing a pull request is similar to that of opening and triaging issues, but carries with it a necessary review and approval workflow that ensures that the proposed changes meet the minimal quality and functional guidelines of the Electron project.</p>",
      "title": "Issues In Electron",
      "description": ""
    },
    "/docs/api/structures/jump-list-category": {
      "locale": "de-DE",
      "slug": "jump-list-category",
      "href": "/docs/api/structures/jump-list-category",
      "crowdinFileId": "256451",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/jump-list-category.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"jumplistcategory-object\"><a href=\"#jumplistcategory-object\">JumpListCategory Object</a></h1>\n<ul>\n<li><code>type</code> String (optional) - One of the following:<ul>\n<li><code>tasks</code> - Items in this category will be placed into the standard <code>Tasks</code> category. There can be only one such category, and it will always be displayed at the bottom of the Jump List.</li>\n<li><code>frequent</code> - Displays a list of files frequently opened by the app, the name of the category and its items are set by Windows.</li>\n<li><code>recent</code> - Displays a list of files recently opened by the app, the name of the category and its items are set by Windows. Items may be added to this category indirectly using <code>app.addRecentDocument(path)</code>.</li>\n<li><code>custom</code> - Displays tasks or file links, <code>name</code> must be set by the app.</li>\n</ul></li>\n<li><code>name</code> String (optional) - Must be set if <code>type</code> is <code>custom</code>, otherwise it should be omitted.</li>\n<li><code>items</code> JumpListItem<a href=\"/docs/api/structures/optional\"></a> - Array of <a href=\"/docs/api/structures/jump-list-item\"><code>JumpListItem</code></a> objects if <code>type</code> is <code>tasks</code> or <code>custom</code>, otherwise it should be omitted.</li>\n</ul>\n<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>\n<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>",
      "title": "JumpListCategory Object",
      "description": ""
    },
    "/docs/api/structures/jump-list-item": {
      "locale": "de-DE",
      "slug": "jump-list-item",
      "href": "/docs/api/structures/jump-list-item",
      "crowdinFileId": "256453",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/jump-list-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"jumplistitem-object\"><a href=\"#jumplistitem-object\">JumpListItem Object</a></h1>\n<ul>\n<li><code>type</code> String (optional) - One of the following:<ul>\n<li><code>task</code> - A task will launch an app with specific arguments.</li>\n<li><code>separator</code> - Can be used to separate items in the standard <code>Tasks</code> category.</li>\n<li><code>file</code> - A file link will open a file using the app that created the Jump List, for this to work the app must be registered as a handler for the file type (though it doesn't have to be the default handler).</li>\n</ul></li>\n<li><code>path</code> String (optional) - Path of the file to open, should only be set if <code>type</code> is <code>file</code>.</li>\n<li><code>program</code> String (optional) - Path of the program to execute, usually you should specify <code>process.execPath</code> which opens the current program. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>args</code> String (optional) - The command line arguments when <code>program</code> is executed. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>title</code> String (optional) - The text to be displayed for the item in the Jump List. Should only be set if <code>type</code> is <code>task</code>.</li>\n<li><code>description</code> String (optional) - Description of the task (displayed in a tooltip). Should only be set if <code>type</code> is <code>task</code>. Maximum length 260 characters.</li>\n<li><code>iconPath</code> String (optional) - The absolute path to an icon to be displayed in a Jump List, which can be an arbitrary resource file that contains an icon (e.g. <code>.ico</code>, <code>.exe</code>, <code>.dll</code>). You can usually specify <code>process.execPath</code> to show the program icon.</li>\n<li><code>iconIndex</code> Number (optional) - The index of the icon in the resource file. If a resource file contains multiple icons this value can be used to specify the zero-based index of the icon that should be displayed for this task. If a resource file contains only one icon, this property should be set to zero.</li>\n<li><code>workingDirectory</code> String (optional) - The working directory. Default is empty.</li>\n</ul>",
      "title": "JumpListItem Object",
      "description": ""
    },
    "/docs/api/structures/keyboard-event": {
      "locale": "de-DE",
      "slug": "keyboard-event",
      "href": "/docs/api/structures/keyboard-event",
      "crowdinFileId": "256455",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/keyboard-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"keyboardevent-object\"><a href=\"#keyboardevent-object\">KeyboardEvent Object</a></h1>\n<ul>\n<li><code>ctrlKey</code> Boolean (optional) - whether the Control key was used in an accelerator to trigger the Event</li>\n<li><code>metaKey</code> Boolean (optional) - whether a meta key was used in an accelerator to trigger the Event</li>\n<li><code>shiftKey</code> Boolean (optional) - whether a Shift key was used in an accelerator to trigger the Event</li>\n<li><code>altKey</code> Boolean (optional) - whether an Alt key was used in an accelerator to trigger the Event</li>\n<li><code>triggeredByAccelerator</code> Boolean (optional) - whether an accelerator was used to trigger the event as opposed to another user gesture like mouse click</li>\n</ul>",
      "title": "KeyboardEvent Object",
      "description": ""
    },
    "/docs/api/structures/keyboard-input-event": {
      "locale": "de-DE",
      "slug": "keyboard-input-event",
      "href": "/docs/api/structures/keyboard-input-event",
      "crowdinFileId": "256457",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/keyboard-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"keyboardinputevent-object-extends-inputevent\"><a href=\"#keyboardinputevent-object-extends-inputevent\">KeyboardInputEvent Object extends <code>InputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>keyDown</code>, <code>keyUp</code> or <code>char</code>.</li>\n<li><code>keyCode</code> String - The character that will be sent as the keyboard event. Should only use the valid key codes in <a href=\"/docs/api/accelerator\">Accelerator</a>.</li>\n</ul>",
      "title": "KeyboardInputEvent Object extends InputEvent",
      "description": ""
    },
    "/docs/tutorial/keyboard-shortcuts": {
      "locale": "de-DE",
      "slug": "keyboard-shortcuts",
      "href": "/docs/tutorial/keyboard-shortcuts",
      "crowdinFileId": "256209",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/keyboard-shortcuts.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"tastenkürzel\"><a href=\"#tastenkürzel\">Tastenkürzel</a></h1>\n<h2 id=\"übersicht\"><a href=\"#übersicht\">Übersicht</a></h2>\n<p>This feature allows you to configure local and global keyboard shortcuts for your Electron application.</p>\n<h2 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h2>\n<h3 id=\"local-shortcuts\"><a href=\"#local-shortcuts\">Local Shortcuts</a></h3>\n<p>Local keyboard shortcuts are triggered only when the application is focused. To configure a local keyboard shortcut, you need to specify an <a href=\"/docs/api/accelerator\"><code>accelerator</code></a> property when creating a <a href=\"/docs/api/menu-item\">MenuItem</a> within the <a href=\"/docs/api/menu\">Menu</a> module.</p>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/local\"><span class=\"hljs-keyword\">const</span> { Menu, MenuItem } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> menu = <span class=\"hljs-keyword\">new</span> Menu()\nmenu.append(<span class=\"hljs-keyword\">new</span> MenuItem({\n  <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Electron'</span>,\n  <span class=\"hljs-attr\">submenu</span>: [{\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'help'</span>,\n    <span class=\"hljs-attr\">accelerator</span>: process.platform === <span class=\"hljs-string\">'darwin'</span> ? <span class=\"hljs-string\">'Alt+Cmd+I'</span> : <span class=\"hljs-string\">'Alt+Shift+I'</span>,\n    <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Electron rocks!'</span>) }\n  }]\n}))\n\nMenu.setApplicationMenu(menu)\n</code></pre>\n<blockquote>\n<p>NOTE: In the code above, you can see that the accelerator differs based on the user's operating system. For MacOS, it is <code>Alt+Cmd+I</code>, whereas for Linux and Windows, it is <code>Alt+Shift+I</code>.</p>\n</blockquote>\n<p>After launching the Electron application, you should see the application menu along with the local shortcut you just defined:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/local-shortcut.png\" alt=\"Menu with a local shortcut\"></p>\n<p>If you click <code>Help</code> or press the defined accelerator and then open the terminal that you ran your Electron application from, you will see the message that was generated after triggering the <code>click</code> event: \"Electron rocks!\".</p>\n<h3 id=\"global-shortcuts\"><a href=\"#global-shortcuts\">Global Shortcuts</a></h3>\n<p>To configure a global keyboard shortcut, you need to use the <a href=\"/docs/api/global-shortcut\">globalShortcut</a> module to detect keyboard events even when the application does not have keyboard focus.</p>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/global\"><span class=\"hljs-keyword\">const</span> { app, globalShortcut } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  globalShortcut.register(<span class=\"hljs-string\">'Alt+CommandOrControl+I'</span>, () => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Electron loves global shortcuts!'</span>)\n  })\n}).then(createWindow)\n</code></pre>\n<blockquote>\n<p>NOTE: In the code above, the <code>CommandOrControl</code> combination uses <code>Command</code> on macOS and <code>Control</code> on Windows/Linux.</p>\n</blockquote>\n<p>After launching the Electron application, if you press the defined key combination then open the terminal that you ran your Electron application from, you will see that Electron loves global shortcuts!</p>\n<h3 id=\"shortcuts-within-a-browserwindow\"><a href=\"#shortcuts-within-a-browserwindow\">Shortcuts within a BrowserWindow</a></h3>\n<h4 id=\"using-web-apis\"><a href=\"#using-web-apis\">Using web APIs</a></h4>\n<p>If you want to handle keyboard shortcuts within a <a href=\"/docs/api/browser-window\">BrowserWindow</a>, you can listen for the <code>keyup</code> and <code>keydown</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/Events\">DOM events</a> inside the renderer process using the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\">addEventListener() API</a>.</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/web-apis\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">handleKeyPress</span>(<span class=\"hljs-params\">event</span>) </span>{\n  <span class=\"hljs-comment\">// You can put code here to handle the keypress.</span>\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">\"last-keypress\"</span>).innerText = event.key;\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`You pressed <span class=\"hljs-subst\">${event.key}</span>`</span>);\n}\n\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'keyup'</span>, handleKeyPress, <span class=\"hljs-literal\">true</span>);\n</code></pre>\n<blockquote>\n<p>Note:  the third parameter <code>true</code> indicates that the listener will always receive key presses before other listeners so they can't have <code>stopPropagation()</code> called on them.</p>\n</blockquote>\n<h4 id=\"intercepting-events-in-the-main-process\"><a href=\"#intercepting-events-in-the-main-process\">Intercepting events in the main process</a></h4>\n<p>The <a href=\"/docs/api/web-contents#event-before-input-event\"><code>before-input-event</code></a> event is emitted before dispatching <code>keydown</code> and <code>keyup</code> events in the page. It can be used to catch and handle custom shortcuts that are not visible in the menu.</p>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/keyboard-shortcuts/interception-from-main\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n  win.webContents.on(<span class=\"hljs-string\">'before-input-event'</span>, (event, input) => {\n    <span class=\"hljs-keyword\">if</span> (input.control &#x26;&#x26; input.key.toLowerCase() === <span class=\"hljs-string\">'i'</span>) {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Pressed Control+I'</span>)\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<p>After launching the Electron application, if you open the terminal that you ran your Electron application from and press <code>Ctrl+I</code> key combination, you will see that this key combination was successfully intercepted.</p>\n<h4 id=\"using-third-party-libraries\"><a href=\"#using-third-party-libraries\">Using third-party libraries</a></h4>\n<p>If you don't want to do manual shortcut parsing, there are libraries that do advanced key detection, such as <a href=\"https://github.com/ccampbell/mousetrap\">mousetrap</a>. Below are examples of usage of the <code>mousetrap</code> running in the Renderer process:</p>\n<pre><code class=\"hljs language-js\">Mousetrap.bind(<span class=\"hljs-string\">'4'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'4'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'?'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'show shortcuts!'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'esc'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'escape'</span>) }, <span class=\"hljs-string\">'keyup'</span>)\n\n<span class=\"hljs-comment\">// combinations</span>\nMousetrap.bind(<span class=\"hljs-string\">'command+shift+k'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'command shift k'</span>) })\n\n<span class=\"hljs-comment\">// map multiple combinations to the same callback</span>\nMousetrap.bind([<span class=\"hljs-string\">'command+k'</span>, <span class=\"hljs-string\">'ctrl+k'</span>], () => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'command k or control k'</span>)\n\n  <span class=\"hljs-comment\">// return false to prevent default behavior and stop event from bubbling</span>\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n})\n\n<span class=\"hljs-comment\">// gmail style sequences</span>\nMousetrap.bind(<span class=\"hljs-string\">'g i'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'go to inbox'</span>) })\nMousetrap.bind(<span class=\"hljs-string\">'* a'</span>, () => { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'select all'</span>) })\n\n<span class=\"hljs-comment\">// konami code!</span>\nMousetrap.bind(<span class=\"hljs-string\">'up up down down left right left right b a enter'</span>, () => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'konami code'</span>)\n})\n</code></pre>",
      "title": "Tastenkürzel",
      "description": "NOTE: In the code above, you can see that the accelerator differs based on the user's operating system. For MacOS, it is Alt+Cmd+I, whereas for Linux and Windows, it is Alt+Shift+I."
    },
    "/docs/tutorial/launch-app-from-url-in-another-app": {
      "locale": "de-DE",
      "slug": "launch-app-from-url-in-another-app",
      "href": "/docs/tutorial/launch-app-from-url-in-another-app",
      "crowdinFileId": "256211",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/launch-app-from-url-in-another-app.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<hr>\n<p>title: Launching Your Electron App From a URL In Another App\ndescription: This guide will take you through the process of setting your electron app as the default handler for a specific protocol.\nslug: launch-app-from-url-in-another-app</p>\n<h2 id=\"hide_title-true\"><a href=\"#hide_title-true\">hide_title: true</a></h2>\n<h1 id=\"launching-your-electron-app-from-a-url-in-another-app\"><a href=\"#launching-your-electron-app-from-a-url-in-another-app\">Launching Your Electron App From A URL In Another App</a></h1>\n<h2 id=\"übersicht\"><a href=\"#übersicht\">Übersicht</a></h2>\n<!-- ✍ Update this section if you want to provide more details -->\n<p>This guide will take you through the process of setting your Electron app as the default handler for a specific <a href=\"https://www.electronjs.org/docs/api/protocol\">protocol</a>.</p>\n<p>By the end of this tutorial, we will have set our app to intercept and handle any clicked URLs that start with a specific protocol. In this guide, the protocol we will use will be \"<code>electron-fiddle://</code>\".</p>\n<h2 id=\"beispiele\"><a href=\"#beispiele\">Beispiele</a></h2>\n<h3 id=\"main-process-mainjs\"><a href=\"#main-process-mainjs\">Main Process (main.js)</a></h3>\n<p>First, we will import the required modules from <code>electron</code>. These modules help control our application lifecycle and create a native browser window.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n</code></pre>\n<p>Next, we will proceed to register our application to handle all \"<code>electron-fiddle://</code>\" protocols.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">if</span> (process.defaultApp) {\n  <span class=\"hljs-keyword\">if</span> (process.argv.length >= <span class=\"hljs-number\">2</span>) {\n    app.setAsDefaultProtocolClient(<span class=\"hljs-string\">'electron-fiddle'</span>, process.execPath, [path.resolve(process.argv[<span class=\"hljs-number\">1</span>])])\n  }\n} <span class=\"hljs-keyword\">else</span> {\n  app.setAsDefaultProtocolClient(<span class=\"hljs-string\">'electron-fiddle'</span>)\n}\n</code></pre>\n<p>We will now define the function in charge of creating our browser window and load our application's <code>index.html</code> file.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> createWindow = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// Create the browser window.</span>\n  mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  mainWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n</code></pre>\n<p>In this next step, we will create our  <code>BrowserWindow</code> and tell our application how to handle an event in which an external protocol is clicked.</p>\n<p>This code will be different in Windows compared to MacOS and Linux. This is due to Windows requiring additional code in order to open the contents of the protocol link within the same Electron instance. Read more about this <a href=\"https://www.electronjs.org/docs/api/app#apprequestsingleinstancelock\">here</a>.</p>\n<h4 id=\"windows-code\"><a href=\"#windows-code\">Windows code:</a></h4>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> gotTheLock = app.requestSingleInstanceLock()\n\n<span class=\"hljs-keyword\">if</span> (!gotTheLock) {\n  app.quit()\n} <span class=\"hljs-keyword\">else</span> {\n  app.on(<span class=\"hljs-string\">'second-instance'</span>, (event, commandLine, workingDirectory) => {\n    <span class=\"hljs-comment\">// Someone tried to run a second instance, we should focus our window.</span>\n    <span class=\"hljs-keyword\">if</span> (mainWindow) {\n      <span class=\"hljs-keyword\">if</span> (mainWindow.isMinimized()) mainWindow.restore()\n      mainWindow.focus()\n    }\n  })\n\n  <span class=\"hljs-comment\">// Create mainWindow, load the rest of the app, etc...</span>\n  app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    createWindow()\n  })\n\n  <span class=\"hljs-comment\">// Handle the protocol. In this case, we choose to show an Error Box.</span>\n  app.on(<span class=\"hljs-string\">'open-url'</span>, (event, url) => {\n    dialog.showErrorBox(<span class=\"hljs-string\">'Welcome Back'</span>, <span class=\"hljs-string\">`You arrived from: <span class=\"hljs-subst\">${url}</span>`</span>)\n  })\n}\n</code></pre>\n<h4 id=\"macos-and-linux-code\"><a href=\"#macos-and-linux-code\">MacOS and Linux code:</a></h4>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// This method will be called when Electron has finished</span>\n<span class=\"hljs-comment\">// initialization and is ready to create browser windows.</span>\n<span class=\"hljs-comment\">// Einige APIs können nur nach dem Auftreten dieses Events genutzt werden.</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n})\n\n<span class=\"hljs-comment\">// Handle the protocol. In this case, we choose to show an Error Box.</span>\napp.on(<span class=\"hljs-string\">'open-url'</span>, (event, url) => {\n  dialog.showErrorBox(<span class=\"hljs-string\">'Welcome Back'</span>, <span class=\"hljs-string\">`You arrived from: <span class=\"hljs-subst\">${url}</span>`</span>)\n})\n</code></pre>\n<p>Finally, we will add some additional code to handle when someone closes our application.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Quit when all windows are closed, except on macOS. There, it's common</span>\n<span class=\"hljs-comment\">// for applications and their menu bar to stay active until the user quits</span>\n<span class=\"hljs-comment\">// explicitly with Cmd + Q.</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h2 id=\"important-notes\"><a href=\"#important-notes\">Important notes</a></h2>\n<h3 id=\"pakete-erstellen\"><a href=\"#pakete-erstellen\">Pakete erstellen</a></h3>\n<p>On macOS and Linux, this feature will only work when your app is packaged. It will not work when you're launching it in development from the command-line. When you package your app you'll need to make sure the macOS <code>Info.plist</code> and the Linux <code>.desktop</code> files for the app are updated to include the new protocol handler. Some of the Electron tools for bundling and distributing apps handle this for you.</p>\n<h4 id=\"electron-forge\"><a href=\"#electron-forge\"></a><a href=\"https://electronforge.io\">Electron Forge</a></h4>\n<p>If you're using Electron Forge, adjust <code>packagerConfig</code> for macOS support, and the configuration for the appropriate Linux makers for Linux support, in your <a href=\"https://www.electronforge.io/configuration\">Forge configuration</a> <em>(please note the following example only shows the bare minimum needed to add the configuration changes)</em>:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"config\"</span>: {\n    <span class=\"hljs-attr\">\"forge\"</span>: {\n      <span class=\"hljs-attr\">\"packagerConfig\"</span>: {\n        <span class=\"hljs-attr\">\"protocols\"</span>: [\n          {\n            <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"Electron Fiddle\"</span>,\n            <span class=\"hljs-attr\">\"schemes\"</span>: [<span class=\"hljs-string\">\"electron-fiddle\"</span>]\n          }\n        ]\n      },\n      <span class=\"hljs-attr\">\"makers\"</span>: [\n        {\n          <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"@electron-forge/maker-deb\"</span>,\n          <span class=\"hljs-attr\">\"config\"</span>: {\n            <span class=\"hljs-attr\">\"mimeType\"</span>: [<span class=\"hljs-string\">\"x-scheme-handler/electron-fiddle\"</span>]\n          }\n        }\n      ]\n    }\n  }\n}\n</code></pre>\n<h4 id=\"electron-packager\"><a href=\"#electron-packager\"></a><a href=\"https://github.com/electron/electron-packager\">Electron Packager</a></h4>\n<p>For macOS support:</p>\n<p>If you're using Electron Packager's API, adding support for protocol handlers is similar to how Electron Forge is handled, except <code>protocols</code> is part of the Packager options passed to the <code>packager</code> function.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> packager = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-packager'</span>)\n\npackager({\n  <span class=\"hljs-comment\">// ...other options...</span>\n  <span class=\"hljs-attr\">protocols</span>: [\n    {\n      <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Electron Fiddle'</span>,\n      <span class=\"hljs-attr\">schemes</span>: [<span class=\"hljs-string\">'electron-fiddle'</span>]\n    }\n  ]\n\n}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">paths</span> =></span> <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`SUCCESS: Created <span class=\"hljs-subst\">${paths.join(<span class=\"hljs-string\">', '</span>)}</span>`</span>))\n  .catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">`ERROR: <span class=\"hljs-subst\">${err.message}</span>`</span>))\n</code></pre>\n<p>If you're using Electron Packager's CLI, use the <code>--protocol</code> and <code>--protocol-name</code> flags. For example:</p>\n<pre><code class=\"hljs language-shell\">npx electron-packager . --protocol=electron-fiddle --protocol-name=\"Electron Fiddle\"\n</code></pre>\n<h2 id=\"fazit\"><a href=\"#fazit\">Fazit</a></h2>\n<p>After you start your Electron app, you can enter in a URL in your browser that contains the custom protocol, for example <code>\"electron-fiddle://open\"</code> and observe that the application will respond and show an error dialog box.</p>\n<!--\n    Because Electron examples usually require multiple files (HTML, CSS, JS\n    for the main and renderer process, etc.), we use this custom code block\n    for Fiddle (https://www.electronjs.org/fiddle).\n    Please modify any of the files in the referenced folder to fit your\n    example.\n    The content in this codeblock will not be rendered in the website so you\n    can leave it empty.\n-->\n<!-- ✍ Explanation of the code below -->",
      "title": "Launching Your Electron App From A URL In Another App",
      "description": ""
    },
    "/docs/tutorial/linux-desktop-actions": {
      "locale": "de-DE",
      "slug": "linux-desktop-actions",
      "href": "/docs/tutorial/linux-desktop-actions",
      "crowdinFileId": "256213",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/linux-desktop-actions.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"desktop-launcher-actions-linux\"><a href=\"#desktop-launcher-actions-linux\">Desktop Launcher Actions (Linux)</a></h1>\n<h2 id=\"übersicht\"><a href=\"#übersicht\">Übersicht</a></h2>\n<p>On many Linux environments, you can add custom entries to the system launcher by modifying the <code>.desktop</code> file. For Canonical's Unity documentation, see <a href=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher\">Adding Shortcuts to a Launcher</a>. For details on a more generic implementation, see the <a href=\"https://specifications.freedesktop.org/desktop-entry-spec/1.1/ar01s11.html\">freedesktop.org Specification</a>.</p>\n<p><img src=\"https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles?action=AttachFile&#x26;do=get&#x26;target=shortcuts.png\" alt=\"audacious\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example of launcher shortcuts in Audacious audio player</p>\n</blockquote>\n<p>To create a shortcut, you need to provide <code>Name</code> and <code>Exec</code> properties for the entry you want to add to the shortcut menu. Unity will execute the command defined in the <code>Exec</code> field after the user clicked the shortcut menu item. An example of the <code>.desktop</code> file may look as follows:</p>\n<pre><code class=\"hljs language-plaintext\">Actions=PlayPause;Next;Previous\n\n[Desktop Action PlayPause]\nName=Play-Pause\nExec=audacious -t\nOnlyShowIn=Unity;\n\n[Desktop Action Next]\nName=Next\nExec=audacious -f\nOnlyShowIn=Unity;\n\n[Desktop Action Previous]\nName=Previous\nExec=audacious -r\nOnlyShowIn=Unity;\n</code></pre>\n<p>The preferred way for Unity to instruct your application on what to do is using parameters. You can find them in your application in the global variable <code>process.argv</code>.</p>",
      "title": "Desktop Launcher Actions (Linux)",
      "description": "NOTE: The screenshot above is an example of launcher shortcuts in Audacious audio player"
    },
    "/docs/tutorial/mac-app-store-submission-guide": {
      "locale": "de-DE",
      "slug": "mac-app-store-submission-guide",
      "href": "/docs/tutorial/mac-app-store-submission-guide",
      "crowdinFileId": "256215",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/mac-app-store-submission-guide.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"veröffentlichung-im-mac-app-store\"><a href=\"#veröffentlichung-im-mac-app-store\">Veröffentlichung im Mac App Store</a></h1>\n<p>This guide provides information on:</p>\n<ul>\n<li>How to sign Electron apps on macOS;</li>\n<li>How to submit Electron apps to Mac App Store (MAS);</li>\n<li>The limitations of the MAS build.</li>\n</ul>\n<h2 id=\"anforderungen\"><a href=\"#anforderungen\">Anforderungen</a></h2>\n<p>To sign Electron apps, the following tools must be installed first:</p>\n<ul>\n<li>Xcode 11 or above.</li>\n<li>The <a href=\"https://github.com/electron/electron-osx-sign\">electron-osx-sign</a> npm module.</li>\n</ul>\n<p>You also have to register an Apple Developer account and join the <a href=\"https://developer.apple.com/support/compare-memberships/\">Apple Developer Program</a>.</p>\n<h2 id=\"sign-electron-apps\"><a href=\"#sign-electron-apps\">Sign Electron apps</a></h2>\n<p>Electron apps can be distributed through Mac App Store or outside it. Each way requires different ways of signing and testing. This guide focuses on distribution via Mac App Store, but will also mention other methods.</p>\n<p>The following steps describe how to get the certificates from Apple, how to sign Electron apps, and how to test them.</p>\n<h3 id=\"get-certificates\"><a href=\"#get-certificates\">Get certificates</a></h3>\n<p>The simplest way to get signing certificates is to use Xcode:</p>\n<ol>\n<li>Open Xcode and open \"Accounts\" preferences;</li>\n<li>Sign in with your Apple account;</li>\n<li>Select a team and click \"Manage Certificates\";</li>\n<li>In the lower-left corner of the signing certificates sheet, click the Add button (+), and add following certificates:<ul>\n<li>\"Apple Development\"</li>\n<li>\"Apple Distribution\"</li>\n</ul></li>\n</ol>\n<p>The \"Apple Development\" certificate is used to sign apps for development and testing, on machines that have been registered on Apple Developer website. The method of registration will be described in <a href=\"#prepare-provisioning-profile\">Prepare provisioning profile</a>.</p>\n<p>Apps signed with the \"Apple Development\" certificate cannot be submitted to Mac App Store. For that purpose, apps must be signed with the \"Apple Distribution\" certificate instead. But note that apps signed with the \"Apple Distribution\" certificate cannot run directly, they must be re-signed by Apple to be able to run, which will only be possible after being downloaded from the Mac App Store.</p>\n<h4 id=\"other-certificates\"><a href=\"#other-certificates\">Other certificates</a></h4>\n<p>You may notice that there are also other kinds of certificates.</p>\n<p>The \"Developer ID Application\" certificate is used to sign apps before distributing them outside the Mac App Store.</p>\n<p>The \"Developer ID Installer\" and \"Mac Installer Distribution\" certificates are used to sign the Mac Installer Package instead of the app itself. Most Electron apps do not use Mac Installer Package so they are generally not needed.</p>\n<p>The full list of certificate types can be found <a href=\"https://help.apple.com/xcode/mac/current/#/dev80c6204ec\">here</a>.</p>\n<p>Apps signed with \"Apple Development\" and \"Apple Distribution\" certificates can only run under <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandbox</a>, so they must use the MAS build of Electron. However, the \"Developer ID Application\" certificate does not have this restrictions, so apps signed with it can use either the normal build or the MAS build of Electron.</p>\n<h4 id=\"legacy-certificate-names\"><a href=\"#legacy-certificate-names\">Legacy certificate names</a></h4>\n<p>Apple has been changing the names of certificates during past years, you might encounter them when reading old documentations, and some utilities are still using one of the old names.</p>\n<ul>\n<li>The \"Apple Distribution\" certificate was also named as \"3rd Party Mac Developer Application\" and \"Mac App Distribution\".</li>\n<li>The \"Apple Development\" certificate was also named as \"Mac Developer\" and \"Development\".</li>\n</ul>\n<h3 id=\"prepare-provisioning-profile\"><a href=\"#prepare-provisioning-profile\">Prepare provisioning profile</a></h3>\n<p>If you want to test your app on your local machine before submitting your app to the Mac App Store, you have to sign the app with the \"Apple Development\" certificate with the provisioning profile embedded in the app bundle.</p>\n<p>To <a href=\"https://help.apple.com/developer-account/#/devf2eb157f8\">create a provisioning profile</a>, you can follow the below steps:</p>\n<ol>\n<li>Open the \"Certificates, Identifiers &#x26; Profiles\" page on the <a href=\"https://developer.apple.com/account\">Apple Developer</a> website.</li>\n<li>Add a new App ID for your app in the \"Identifiers\" page.</li>\n<li>Register your local machine in the \"Devices\" page. You can find your machine's \"Device ID\" in the \"Hardware\" page of the \"System Information\" app.</li>\n<li>Register a new Provisioning Profile in the \"Profiles\" page, and download it to <code>/path/to/yourapp.provisionprofile</code>.</li>\n</ol>\n<h3 id=\"enable-apples-app-sandbox\"><a href=\"#enable-apples-app-sandbox\">Enable Apple's App Sandbox</a></h3>\n<p>Apps submitted to the Mac App Store must run under Apple's <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandbox</a>, and only the MAS build of Electron can run with the App Sandbox. The standard darwin build of Electron will fail to launch when run under App Sandbox.</p>\n<p>When signing the app with <code>electron-osx-sign</code>, it will automatically add the necessary entitlements to your app's entitlements, but if you are using custom entitlements, you must ensure App Sandbox capacity is added:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<h4 id=\"extra-steps-without-electron-osx-sign\"><a href=\"#extra-steps-without-electron-osx-sign\">Extra steps without <code>electron-osx-sign</code></a></h4>\n<p>If you are signing your app without using <code>electron-osx-sign</code>, you must ensure the app bundle's entitlements have at least following keys:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.application-groups<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">array</span>></span>\n      <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>TEAM_ID.your.bundle.id<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n    <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">array</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>The <code>TEAM_ID</code> should be replaced with your Apple Developer account's Team ID, and the <code>your.bundle.id</code> should be replaced with the App ID of the app.</p>\n<p>And the following entitlements must be added to the binaries and helpers in the app's bundle:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-meta\">&#x3C;?xml version=\"1.0\" encoding=\"UTF-8\"?></span>\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.app-sandbox<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.inherit<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>And the app bundle's <code>Info.plist</code> must include <code>ElectronTeamID</code> key, which has your Apple Developer account's Team ID as its value:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">plist</span> <span class=\"hljs-attr\">version</span>=<span class=\"hljs-string\">\"1.0\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">dict</span>></span>\n  ...\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>ElectronTeamID<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">string</span>></span>TEAM_ID<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">string</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">dict</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">plist</span>></span>\n</code></pre>\n<p>When using <code>electron-osx-sign</code> the <code>ElectronTeamID</code> key will be added automatically by extracting the Team ID from the certificate's name. You may need to manually add this key if <code>electron-osx-sign</code> could not find the correct Team ID.</p>\n<h3 id=\"sign-apps-for-development\"><a href=\"#sign-apps-for-development\">Sign apps for development</a></h3>\n<p>To sign an app that can run on your development machine, you must sign it with the \"Apple Development\" certificate and pass the provisioning profile to <code>electron-osx-sign</code>.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Apple Development'</span> --provisioning-profile=/path/to/yourapp.provisionprofile\n</code></pre>\n<p>If you are signing without <code>electron-osx-sign</code>, you must place the provisioning profile to <code>YourApp.app/Contents/embedded.provisionprofile</code>.</p>\n<p>The signed app can only run on the machines that registered by the provisioning profile, and this is the only way to test the signed app before submitting to Mac App Store.</p>\n<h3 id=\"sign-apps-for-submitting-to-the-mac-app-store\"><a href=\"#sign-apps-for-submitting-to-the-mac-app-store\">Sign apps for submitting to the Mac App Store</a></h3>\n<p>To sign an app that will be submitted to Mac App Store, you must sign it with the \"Apple Distribution\" certificate. Note that apps signed with this certificate will not run anywhere, unless it is downloaded from Mac App Store.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Apple Distribution'</span>\n</code></pre>\n<h3 id=\"sign-apps-for-distribution-outside-the-mac-app-store\"><a href=\"#sign-apps-for-distribution-outside-the-mac-app-store\">Sign apps for distribution outside the Mac App Store</a></h3>\n<p>If you don't plan to submit the app to Mac App Store, you can sign it the \"Developer ID Application\" certificate. In this way there is no requirement on App Sandbox, and you should use the normal darwin build of Electron if you don't use App Sandbox.</p>\n<pre><code class=\"hljs language-bash\">electron-osx-sign YourApp.app --identity=<span class=\"hljs-string\">'Developer ID Application'</span> --no-gatekeeper-assess\n</code></pre>\n<p>By passing <code>--no-gatekeeper-assess</code>, the <code>electron-osx-sign</code> will skip the macOS GateKeeper check as your app usually has not been notarized yet by this step.</p>\n<!-- TODO(zcbenz): Add a chapter about App Notarization -->\n<p>This guide does not cover <a href=\"https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution\">App Notarization</a>, but you might want to do it otherwise Apple may prevent users from using your app outside Mac App Store.</p>\n<h2 id=\"submit-apps-to-the-mac-app-store\"><a href=\"#submit-apps-to-the-mac-app-store\">Submit Apps to the Mac App Store</a></h2>\n<p>After signing the app with the \"Apple Distribution\" certificate, you can continue to submit it to Mac App Store.</p>\n<p>However, this guide do not ensure your app will be approved by Apple; you still need to read Apple's <a href=\"https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/SubmittingYourApp/SubmittingYourApp.html\">Submitting Your App</a> guide on how to meet the Mac App Store requirements.</p>\n<h3 id=\"upload\"><a href=\"#upload\">Upload</a></h3>\n<p>The Application Loader should be used to upload the signed app to iTunes Connect for processing, making sure you have <a href=\"https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/CreatingiTunesConnectRecord.html\">created a record</a> before uploading.</p>\n<p>If you are seeing errors like private APIs uses, you should check if the app is using the MAS build of Electron.</p>\n<h3 id=\"submit-for-review\"><a href=\"#submit-for-review\">Submit for review</a></h3>\n<p>After uploading, you should <a href=\"https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html\">submit your app for review</a>.</p>\n<h2 id=\"limitations-of-mas-build\"><a href=\"#limitations-of-mas-build\">Limitations of MAS Build</a></h2>\n<p>In order to satisfy all requirements for app sandboxing, the following modules have been disabled in the MAS build:</p>\n<ul>\n<li><code>crashReporter</code></li>\n<li><code>autoUpdater</code></li>\n</ul>\n<p>and the following behaviors have been changed:</p>\n<ul>\n<li>Video capture may not work for some machines.</li>\n<li>Certain accessibility features may not work.</li>\n<li>Apps will not be aware of DNS changes.</li>\n</ul>\n<p>Also, due to the usage of app sandboxing, the resources which can be accessed by the app are strictly limited; you can read <a href=\"https://developer.apple.com/app-sandboxing/\">App Sandboxing</a> for more information.</p>\n<h3 id=\"additional-entitlements\"><a href=\"#additional-entitlements\">Additional entitlements</a></h3>\n<p>Depending on which Electron APIs your app uses, you may need to add additional entitlements to your app's entitlements file. Otherwise, the App Sandbox may prevent you from using them.</p>\n<h4 id=\"network-access\"><a href=\"#network-access\">Network access</a></h4>\n<p>Enable outgoing network connections to allow your app to connect to a server:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.network.client<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>Enable incoming network connections to allow your app to open a network listening socket:</p>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.network.server<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>See the <a href=\"https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW9\">Enabling Network Access documentation</a> for more details.</p>\n<h4 id=\"dialogshowopendialog\"><a href=\"#dialogshowopendialog\">dialog.showOpenDialog</a></h4>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.files.user-selected.read-only<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>See the <a href=\"https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6\">Enabling User-Selected File Access documentation</a> for more details.</p>\n<h4 id=\"dialogshowsavedialog\"><a href=\"#dialogshowsavedialog\">dialog.showSaveDialog</a></h4>\n<pre><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">key</span>></span>com.apple.security.files.user-selected.read-write<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">key</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">true</span>/></span>\n</code></pre>\n<p>See the <a href=\"https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6\">Enabling User-Selected File Access documentation</a> for more details.</p>\n<h2 id=\"cryptographic-algorithms-used-by-electron\"><a href=\"#cryptographic-algorithms-used-by-electron\">Cryptographic Algorithms Used by Electron</a></h2>\n<p>Depending on the countries in which you are releasing your app, you may be required to provide information on the cryptographic algorithms used in your software. See the <a href=\"https://help.apple.com/app-store-connect/#/devc3f64248f\">encryption export compliance docs</a> for more information.</p>\n<p>Electron uses following cryptographic algorithms:</p>\n<ul>\n<li>AES - <a href=\"https://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf\">NIST SP 800-38A</a>, <a href=\"https://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf\">NIST SP 800-38D</a>, <a href=\"https://www.ietf.org/rfc/rfc3394.txt\">RFC 3394</a></li>\n<li>HMAC - <a href=\"https://csrc.nist.gov/publications/fips/fips198-1/FIPS-198-1_final.pdf\">FIPS 198-1</a></li>\n<li>ECDSA - ANS X9.62–2005</li>\n<li>ECDH - ANS X9.63–2001</li>\n<li>HKDF - <a href=\"https://csrc.nist.gov/publications/nistpubs/800-56C/SP-800-56C.pdf\">NIST SP 800-56C</a></li>\n<li>PBKDF2 - <a href=\"https://tools.ietf.org/html/rfc2898\">RFC 2898</a></li>\n<li>RSA - <a href=\"https://www.ietf.org/rfc/rfc3447\">RFC 3447</a></li>\n<li>SHA - <a href=\"https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf\">FIPS 180-4</a></li>\n<li>Blowfish - <a href=\"https://www.schneier.com/cryptography/blowfish/\">https://www.schneier.com/cryptography/blowfish/</a></li>\n<li>CAST - <a href=\"https://tools.ietf.org/html/rfc2144\">RFC 2144</a>, <a href=\"https://tools.ietf.org/html/rfc2612\">RFC 2612</a></li>\n<li>DES - <a href=\"https://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf\">FIPS 46-3</a></li>\n<li>DH - <a href=\"https://tools.ietf.org/html/rfc2631\">RFC 2631</a></li>\n<li>DSA - <a href=\"https://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+X9.30-1%3A1997\">ANSI X9.30</a></li>\n<li>EC - <a href=\"https://www.secg.org/sec1-v2.pdf\">SEC 1</a></li>\n<li>IDEA - \"On the Design and Security of Block Ciphers\" book by X. Lai</li>\n<li>MD2 - <a href=\"https://tools.ietf.org/html/rfc1319\">RFC 1319</a></li>\n<li>MD4 - <a href=\"https://tools.ietf.org/html/rfc6150\">RFC 6150</a></li>\n<li>MD5 - <a href=\"https://tools.ietf.org/html/rfc1321\">RFC 1321</a></li>\n<li>MDC2 - <a href=\"https://wiki.openssl.org/index.php/Manual:Mdc2(3)\">ISO/IEC 10118-2</a></li>\n<li>RC2 - <a href=\"https://tools.ietf.org/html/rfc2268\">RFC 2268</a></li>\n<li>RC4 - <a href=\"https://tools.ietf.org/html/rfc4345\">RFC 4345</a></li>\n<li>RC5 - <a href=\"https://people.csail.mit.edu/rivest/Rivest-rc5rev.pdf\">https://people.csail.mit.edu/rivest/Rivest-rc5rev.pdf</a></li>\n<li>RIPEMD - <a href=\"https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2010118-3:2004\">ISO/IEC 10118-3</a></li>\n</ul>",
      "title": "Veröffentlichung im Mac App Store",
      "description": ""
    },
    "/docs/tutorial/macos-dock": {
      "locale": "de-DE",
      "slug": "macos-dock",
      "href": "/docs/tutorial/macos-dock",
      "crowdinFileId": "256217",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/macos-dock.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"dock-macos\"><a href=\"#dock-macos\">Dock (macOS)</a></h1>\n<p>Electron has APIs to configure the app's icon in the macOS Dock. A macOS-only API exists to create a custom dock menu, but Electron also uses the app dock icon as the entry point for cross-platform features like <a href=\"/docs/tutorial/recent-documents\">recent documents</a> and <a href=\"/docs/tutorial/progress-bar\">application progress</a>.</p>\n<p>The custom dock is commonly used to add shortcuts to tasks the user wouldn't want to open the whole app window for.</p>\n<p><strong>Dock Menu der Terminal.app:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5069962/6032658a-6e9c-11e4-9953-aa84006bdfff.png\" alt=\"Dock Menu\"></p>\n<p>To set your custom dock menu, you need to use the <a href=\"/docs/api/dock#docksetmenumenu-macos\"><code>app.dock.setMenu</code></a> API, which is only available on macOS.</p>\n<h2 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h2>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/macos-dock-menu\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\n<span class=\"hljs-keyword\">const</span> dockMenu = Menu.buildFromTemplate([\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Window'</span>,\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'New Window'</span>) }\n  }, {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Window with Settings'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Basic'</span> },\n      { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Pro'</span> }\n    ]\n  },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'New Command...'</span> }\n])\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">if</span> (process.platform === <span class=\"hljs-string\">'darwin'</span>) {\n    app.dock.setMenu(dockMenu)\n  }\n}).then(createWindow)\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n\n</code></pre>\n<p>After launching the Electron application, right click the application icon. You should see the custom menu you just defined:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/macos-dock-menu.png\" alt=\"macOS dock menu\"></p>",
      "title": "Dock (macOS)",
      "description": ""
    },
    "/docs/api/structures/memory-info": {
      "locale": "de-DE",
      "slug": "memory-info",
      "href": "/docs/api/structures/memory-info",
      "crowdinFileId": "256459",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/memory-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"memoryinfo-object\"><a href=\"#memoryinfo-object\">MemoryInfo Object</a></h1>\n<ul>\n<li><code>workingSetSize</code> Integer - The amount of memory currently pinned to actual physical RAM.</li>\n<li><code>peakWorkingSetSize</code> Integer - The maximum amount of memory that has ever been pinned to actual physical RAM.</li>\n<li><code>privateBytes</code> Integer (optional) <em>Windows</em> - The amount of memory not shared by other processes, such as JS heap or HTML content.</li>\n</ul>\n<p>Note that all statistics are reported in Kilobytes.</p>",
      "title": "MemoryInfo Object",
      "description": ""
    },
    "/docs/api/structures/memory-usage-details": {
      "locale": "de-DE",
      "slug": "memory-usage-details",
      "href": "/docs/api/structures/memory-usage-details",
      "crowdinFileId": "256461",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/memory-usage-details.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"memoryusagedetails-object\"><a href=\"#memoryusagedetails-object\">MemoryUsageDetails Object</a></h1>\n<ul>\n<li><code>count</code> Number</li>\n<li><code>size</code> Number</li>\n<li><code>liveSize</code> Number</li>\n</ul>",
      "title": "MemoryUsageDetails Object",
      "description": ""
    },
    "/docs/api/menu": {
      "locale": "de-DE",
      "slug": "menu",
      "href": "/docs/api/menu",
      "crowdinFileId": "256335",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/menu.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"menü\"><a href=\"#menü\">Menü</a></h1>\n<h2 id=\"klasse-menü\"><a href=\"#klasse-menü\">Klasse: Menü</a></h2>\n<blockquote>\n<p>Create native application menus and context menus.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<h3 id=\"new-menu\"><a href=\"#new-menu\"><code>new Menu()</code></a></h3>\n<p>Neues Menü anlegen.</p>\n<h3 id=\"static-methods\"><a href=\"#static-methods\">Static Methods</a></h3>\n<p>Die <code>Menu</code> Klasse hat folgende statische Methoden:</p>\n<h4 id=\"menusetapplicationmenumenu\"><a href=\"#menusetapplicationmenumenu\"><code>Menu.setApplicationMenu(menu)</code></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Sets <code>menu</code> as the application menu on macOS. On Windows and Linux, the <code>menu</code> will be set as each window's top menu.</p>\n<p>Also on Windows and Linux, you can use a <code>&#x26;</code> in the top-level item name to indicate which letter should get a generated accelerator. For example, using <code>&#x26;File</code> for the file menu would result in a generated <code>Alt-F</code> accelerator that opens the associated menu. The indicated character in the button label then gets an underline, and the <code>&#x26;</code> character is not displayed on the button label.</p>\n<p>In order to escape the <code>&#x26;</code> character in an item name, add a proceeding <code>&#x26;</code>. For example, <code>&#x26;&#x26;File</code> would result in <code>&#x26;File</code> displayed on the button label.</p>\n<p>Passing <code>null</code> will suppress the default menu. On Windows and Linux, this has the additional effect of removing the menu bar from the window.</p>\n<p><strong>Note:</strong> The default menu will be created automatically if the app does not set one. It contains standard items such as <code>File</code>, <code>Edit</code>, <code>View</code>, <code>Window</code> and <code>Help</code>.</p>\n<h4 id=\"menugetapplicationmenu\"><a href=\"#menugetapplicationmenu\"><code>Menu.getApplicationMenu()</code></a></h4>\n<p>Returns <code>Menu | null</code> - The application menu, if set, or <code>null</code>, if not set.</p>\n<p><strong>Note:</strong> The returned <code>Menu</code> instance doesn't support dynamic addition or removal of menu items. <a href=\"#instance-properties\">Instance properties</a> can still be dynamically modified.</p>\n<h4 id=\"menusendactiontofirstresponderaction-macos\"><a href=\"#menusendactiontofirstresponderaction-macos\"><code>Menu.sendActionToFirstResponder(action)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>action</code> String</li>\n</ul>\n<p>Sends the <code>action</code> to the first responder of application. This is used for emulating default macOS menu behaviors. Usually you would use the <a href=\"/docs/api/menu-item#roles\"><code>role</code></a> property of a <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>.</p>\n<p>See the <a href=\"https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW7\">macOS Cocoa Event Handling Guide</a> for more information on macOS' native actions.</p>\n<h4 id=\"menubuildfromtemplatetemplate\"><a href=\"#menubuildfromtemplatetemplate\"><code>Menu.buildFromTemplate(template)</code></a></h4>\n<ul>\n<li><code>template</code> (MenuItemConstructorOptions | MenuItem)[]</li>\n</ul>\n<p>Returns <code>Menu</code></p>\n<p>Generally, the <code>template</code> is an array of <code>options</code> for constructing a <a href=\"/docs/api/menu-item\">MenuItem</a>. The usage can be referenced above.</p>\n<p>You can also attach other fields to the element of the <code>template</code> and they will become properties of the constructed menu items.</p>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<p>Das <code>menu</code> Objekt hat die folgenden Instanz Methoden:</p>\n<h4 id=\"menupopupoptions\"><a href=\"#menupopupoptions\"><code>menu.popup([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional) - Default ist das fokussierte Fenster.</li>\n<li><code>x</code> Number (optional) - Default is the current mouse cursor position. Must be declared if <code>y</code> is declared.</li>\n<li><code>y</code> Number (optional) - Default is the current mouse cursor position. Must be declared if <code>x</code> is declared.</li>\n<li><code>positioningItem</code> Number (optional) <em>macOS</em> - The index of the menu item to be positioned under the mouse cursor at the specified coordinates. Default is -1.</li>\n<li><code>callback</code> Funktion (optional) - Wird aufgerufen wenn das Menü geschlossen wird.</li>\n</ul></li>\n</ul>\n<p>Pops up this menu as a context menu in the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<h4 id=\"menuclosepopupbrowserwindow\"><a href=\"#menuclosepopupbrowserwindow\"><code>menu.closePopup([browserWindow])</code></a></h4>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional) - Default ist das fokussierte Fenster.</li>\n</ul>\n<p>Schließt das Kontext-Menü im <code>browserWindow</code>.</p>\n<h4 id=\"menuappendmenuitem\"><a href=\"#menuappendmenuitem\"><code>menu.append(menuItem)</code></a></h4>\n<ul>\n<li><code>menuItem</code> <a href=\"/docs/api/menu-item\">MenuItem</a></li>\n</ul>\n<p>Fügt dem Menü das <code>menuItem</code> hinzu.</p>\n<h4 id=\"menugetmenuitembyidid\"><a href=\"#menugetmenuitembyidid\"><code>menu.getMenuItemById(id)</code></a></h4>\n<ul>\n<li><code>id</code> Zeichenfolge</li>\n</ul>\n<p>Returns <code>MenuItem | null</code> the item with the specified <code>id</code></p>\n<h4 id=\"menuinsertpos-menuitem\"><a href=\"#menuinsertpos-menuitem\"><code>menu.insert(pos, menuItem)</code></a></h4>\n<ul>\n<li><code>pos</code> Integer</li>\n<li><code>menuItem</code> <a href=\"/docs/api/menu-item\">MenuItem</a></li>\n</ul>\n<p>Füre das <code>menuItem</code> an der <code>pos</code> Position im Menü ein.</p>\n<h3 id=\"instanz-ereignisse\"><a href=\"#instanz-ereignisse\">Instanz-Ereignisse</a></h3>\n<p>Objects created with <code>new Menu</code> or returned by <code>Menu.buildFromTemplate</code> emit the following events:</p>\n<p><strong>Hinweis:</strong> Manche Methoden sind nur auf spezifischen Betriebssystemen verfügbar und sind dementsprechend gekennzeichnet.</p>\n<h4 id=\"event-menu-will-show\"><a href=\"#event-menu-will-show\">Event: 'menu-will-show'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when <code>menu.popup()</code> is called.</p>\n<h4 id=\"event-menu-will-close\"><a href=\"#event-menu-will-close\">Event: 'menu-will-close'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitiert wenn ein Popup manuell oder mit <code>menu.closePopup()</code> geschlossen wird.</p>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<p><code>menu</code> objects also have the following properties:</p>\n<h4 id=\"menuitems\"><a href=\"#menuitems\"><code>menu.items</code></a></h4>\n<p>A <code>MenuItem[]</code> array containing the menu's items.</p>\n<p>Each <code>Menu</code> consists of multiple <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>s and each <code>MenuItem</code> can have a submenu.</p>\n<h2 id=\"beispiele\"><a href=\"#beispiele\">Beispiele</a></h2>\n<p>An example of creating the application menu with the simple template API:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> isMac = process.platform === <span class=\"hljs-string\">'darwin'</span>\n\n<span class=\"hljs-keyword\">const</span> template = [\n  <span class=\"hljs-comment\">// { role: 'appMenu' }</span>\n  ...(isMac ? [{\n    <span class=\"hljs-attr\">label</span>: app.name,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'about'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'services'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'hide'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'hideOthers'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'unhide'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'quit'</span> }\n    ]\n  }] : []),\n  <span class=\"hljs-comment\">// { role: 'fileMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'File'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      isMac ? { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'close'</span> } : { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'quit'</span> }\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'editMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Edit'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'undo'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'redo'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'cut'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'copy'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'paste'</span> },\n      ...(isMac ? [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'pasteAndMatchStyle'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'delete'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'selectAll'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        {\n          <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Speech'</span>,\n          <span class=\"hljs-attr\">submenu</span>: [\n            { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'startSpeaking'</span> },\n            { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'stopSpeaking'</span> }\n          ]\n        }\n      ] : [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'delete'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'selectAll'</span> }\n      ])\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'viewMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'View'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'reload'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'forceReload'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'toggleDevTools'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'resetZoom'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoomIn'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoomOut'</span> },\n      { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'togglefullscreen'</span> }\n    ]\n  },\n  <span class=\"hljs-comment\">// { role: 'windowMenu' }</span>\n  {\n    <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Window'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'minimize'</span> },\n      { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'zoom'</span> },\n      ...(isMac ? [\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'front'</span> },\n        { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'window'</span> }\n      ] : [\n        { <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'close'</span> }\n      ])\n    ]\n  },\n  {\n    <span class=\"hljs-attr\">role</span>: <span class=\"hljs-string\">'help'</span>,\n    <span class=\"hljs-attr\">submenu</span>: [\n      {\n        <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Learn More'</span>,\n        <span class=\"hljs-attr\">click</span>: <span class=\"hljs-keyword\">async</span> () => {\n          <span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n          <span class=\"hljs-keyword\">await</span> shell.openExternal(<span class=\"hljs-string\">'https://electronjs.org'</span>)\n        }\n      }\n    ]\n  }\n]\n\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\nMenu.setApplicationMenu(menu)\n</code></pre>\n<h3 id=\"render-process\"><a href=\"#render-process\">Render process</a></h3>\n<p>To create menus initiated by the renderer process, send the required information to the main process using IPC and have the main process display the menu on behalf of the renderer.</p>\n<p>Below is an example of showing a menu when the user right clicks the page:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer</span>\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'contextmenu'</span>, (e) => {\n  e.preventDefault()\n  ipcRenderer.send(<span class=\"hljs-string\">'show-context-menu'</span>)\n})\n\nipcRenderer.on(<span class=\"hljs-string\">'context-menu-command'</span>, (e, command) => {\n  <span class=\"hljs-comment\">// ...</span>\n})\n\n<span class=\"hljs-comment\">// main</span>\nipcMain.on(<span class=\"hljs-string\">'show-context-menu'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> template = [\n    {\n      <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Menu Item 1'</span>,\n      <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> { event.sender.send(<span class=\"hljs-string\">'context-menu-command'</span>, <span class=\"hljs-string\">'menu-item-1'</span>) }\n    },\n    { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Menu Item 2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'checkbox'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> }\n  ]\n  <span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\n  menu.popup(BrowserWindow.fromWebContents(event.sender))\n})\n</code></pre>\n<h2 id=\"hinweise-zu-application-menüs-in-macos\"><a href=\"#hinweise-zu-application-menüs-in-macos\">Hinweise zu Application Menüs in macOS</a></h2>\n<p>macOS has a completely different style of application menu from Windows and Linux. Here are some notes on making your app's menu more native-like.</p>\n<h3 id=\"standard-menus\"><a href=\"#standard-menus\">Standard Menus</a></h3>\n<p>On macOS there are many system-defined standard menus, like the <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc\"><code>Services</code></a> and <code>Windows</code> menus. To make your menu a standard menu, you should set your menu's <code>role</code> to one of the following and Electron will recognize them and make them become standard menus:</p>\n<ul>\n<li><code>window</code></li>\n<li><code>help</code></li>\n<li><code>services</code></li>\n</ul>\n<h3 id=\"standard-menu-item-actions\"><a href=\"#standard-menu-item-actions\">Standard Menu Item Actions</a></h3>\n<p>macOS has provided standard actions for some menu items, like <code>About xxx</code>, <code>Hide xxx</code>, and <code>Hide Others</code>. To set the action of a menu item to a standard action, you should set the <code>role</code> attribute of the menu item.</p>\n<h3 id=\"main-menus-name\"><a href=\"#main-menus-name\">Main Menu's Name</a></h3>\n<p>On macOS the label of the application menu's first item is always your app's name, no matter what label you set. To change it, modify your app bundle's <code>Info.plist</code> file. See <a href=\"https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html\">About Information Property List Files</a> for more information.</p>\n<h2 id=\"setting-menu-for-specific-browser-window-linux-windows\"><a href=\"#setting-menu-for-specific-browser-window-linux-windows\">Setting Menu for Specific Browser Window (<em>Linux</em> <em>Windows</em>)</a></h2>\n<p>The <a href=\"/docs/api/browser-window#winsetmenumenu-linux-windows\"><code>setMenu</code> method</a> of browser windows can set the menu of certain browser windows.</p>\n<h2 id=\"menu-item-position\"><a href=\"#menu-item-position\">Menu Item Position</a></h2>\n<p>You can make use of <code>before</code>, <code>after</code>, <code>beforeGroupContaining</code>, <code>afterGroupContaining</code> and <code>id</code> to control how the item will be placed when building a menu with <code>Menu.buildFromTemplate</code>.</p>\n<ul>\n<li><code>before</code> - Inserts this item before the item with the specified label. If the referenced item doesn't exist the item will be inserted at the end of the menu. Also implies that the menu item in question should be placed in the same “group” as the item.</li>\n<li><code>after</code> - Inserts this item after the item with the specified label. If the referenced item doesn't exist the item will be inserted at the end of the menu. Also implies that the menu item in question should be placed in the same “group” as the item.</li>\n<li><code>beforeGroupContaining</code> - Provides a means for a single context menu to declare the placement of their containing group before the containing group of the item with the specified label.</li>\n<li><code>afterGroupContaining</code> - Provides a means for a single context menu to declare the placement of their containing group after the containing group of the item with the specified label.</li>\n</ul>\n<p>By default, items will be inserted in the order they exist in the template unless one of the specified positioning keywords is used.</p>\n<h3 id=\"beispiele-1\"><a href=\"#beispiele-1\">Beispiele</a></h3>\n<p>Template:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'one'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'two'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'three'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'4'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'four'</span> }\n]\n</code></pre>\n<p>Menü:</p>\n<pre><code class=\"hljs language-sh\">- 1\n- 2\n- 3\n- 4\n</code></pre>\n<p>Template:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Eins'</span> },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Drei'</span>, <span class=\"hljs-attr\">beforeGroupContaining</span>: [<span class=\"hljs-string\">'1'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'4'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Vier'</span>, <span class=\"hljs-attr\">afterGroupContaining</span>: [<span class=\"hljs-string\">'2'</span>] },\n  { <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'separator'</span> },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Zwei'</span> }\n]\n</code></pre>\n<p>Menü:</p>\n<pre><code class=\"hljs language-sh\">- 3\n- 4\n- ---\n- 1\n- ---\n- 2\n</code></pre>\n<p>Template:</p>\n<pre><code class=\"hljs language-javascript\">[\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'1'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Eins'</span>, <span class=\"hljs-attr\">after</span>: [<span class=\"hljs-string\">'3'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'2'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Zwei'</span>, <span class=\"hljs-attr\">before</span>: [<span class=\"hljs-string\">'1'</span>] },\n  { <span class=\"hljs-attr\">id</span>: <span class=\"hljs-string\">'3'</span>, <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Drei'</span> }\n]\n</code></pre>\n<p>Menü:</p>\n<pre><code class=\"hljs language-sh\">- ---\n- 3\n- 2\n- 1\n</code></pre>",
      "title": "Menü",
      "description": "Create native application menus and context menus."
    },
    "/docs/api/menu-item": {
      "locale": "de-DE",
      "slug": "menu-item",
      "href": "/docs/api/menu-item",
      "crowdinFileId": "256333",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/menu-item.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-menuitem\"><a href=\"#class-menuitem\">Class: MenuItem</a></h2>\n<blockquote>\n<p>Add items to native application menus and context menus.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p>See <a href=\"/docs/api/menu\"><code>Menu</code></a> for examples.</p>\n<h3 id=\"new-menuitemoptions\"><a href=\"#new-menuitemoptions\"><code>new MenuItem(options)</code></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>click</code> Function (optional) - Will be called with <code>click(menuItem, browserWindow, event)</code> when the menu item is clicked.<ul>\n<li><code>menuItem</code> MenuItem</li>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | undefined - This will not be defined if no window is open.</li>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n</ul></li>\n<li><code>role</code> String (optional) - Can be <code>undo</code>, <code>redo</code>, <code>cut</code>, <code>copy</code>, <code>paste</code>, <code>pasteAndMatchStyle</code>, <code>delete</code>, <code>selectAll</code>, <code>reload</code>, <code>forceReload</code>, <code>toggleDevTools</code>, <code>resetZoom</code>, <code>zoomIn</code>, <code>zoomOut</code>, <code>toggleSpellChecker</code>, <code>togglefullscreen</code>, <code>window</code>, <code>minimize</code>, <code>close</code>, <code>help</code>, <code>about</code>, <code>services</code>, <code>hide</code>, <code>hideOthers</code>, <code>unhide</code>, <code>quit</code>, <code>startSpeaking</code>, <code>stopSpeaking</code>, <code>zoom</code>, <code>front</code>, <code>appMenu</code>, <code>fileMenu</code>, <code>editMenu</code>, <code>viewMenu</code>, <code>shareMenu</code>, <code>recentDocuments</code>, <code>toggleTabBar</code>, <code>selectNextTab</code>, <code>selectPreviousTab</code>, <code>mergeAllWindows</code>, <code>clearRecentDocuments</code>, <code>moveTabToNewWindow</code> or <code>windowMenu</code> - Define the action of the menu item, when specified the <code>click</code> property will be ignored. See <a href=\"#roles\">roles</a>.</li>\n<li><code>type</code> String (optional) - Can be <code>normal</code>, <code>separator</code>, <code>submenu</code>, <code>checkbox</code> or <code>radio</code>.</li>\n<li><code>label</code> String (optional)</li>\n<li><code>sublabel</code> String (optional)</li>\n<li><code>toolTip</code> String (optional) <em>macOS</em> - Hover-Text für diesen Nenüpunkt.</li>\n<li><code>accelerator</code> <a href=\"/docs/api/accelerator\">Accelerator</a> (optional)</li>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (optional)</li>\n<li><code>enabled</code> Boolean (optional) - If false, the menu item will be greyed out and unclickable.</li>\n<li><code>acceleratorWorksWhenHidden</code> Boolean (optional) <em>macOS</em> - Standard ist <code>true</code>, und wenn<code>false</code> wird es den Accelerator vom Ausführen hindern, sofern der Menüpunkt nicht sichtbar ist.</li>\n<li><code>visible</code> Boolean (optional) - If false, the menu item will be entirely hidden.</li>\n<li><code>checked</code> Boolean (optional) - Should only be specified for <code>checkbox</code> or <code>radio</code> type menu items.</li>\n<li><code>registerAccelerator</code> Boolean (optional) <em>Linux</em> <em>Windows</em> - Sofern false wird der Accelerator nicht im System registriert, aber weiterhin angezeigt. Standard ist true.</li>\n<li><code>sharingItem</code> SharingItem (optional) <em>macOS</em> - The item to share when the <code>role</code> is <code>shareMenu</code>.</li>\n<li><code>submenu</code> (MenuItemConstructorOptions[] | <a href=\"/docs/api/menu\">Menu</a>) (optional) - Should be specified for <code>submenu</code> type menu items. If <code>submenu</code> is specified, the <code>type: 'submenu'</code> can be omitted. If the value is not a <a href=\"/docs/api/menu\"><code>Menu</code></a> then it will be automatically converted to one using <code>Menu.buildFromTemplate</code>.</li>\n<li><code>id</code> String (optional) - Unique within a single menu. If defined then it can be used as a reference to this item by the position attribute.</li>\n<li><code>before</code> String<a href=\"/docs/api/optional\"></a> - Inserts this item before the item with the specified label. If the referenced item doesn't exist the item will be inserted at the end of  the menu. Also implies that the menu item in question should be placed in the same “group” as the item.</li>\n<li><code>after</code> String<a href=\"/docs/api/optional\"></a> - Inserts this item after the item with the specified label. If the referenced item doesn't exist the item will be inserted at the end of the menu.</li>\n<li><code>beforeGroupContaining</code> String<a href=\"/docs/api/optional\"></a> - Provides a means for a single context menu to declare the placement of their containing group before the containing group of the item with the specified label.</li>\n<li><code>afterGroupContaining</code> String<a href=\"/docs/api/optional\"></a> - Provides a means for a single context menu to declare the placement of their containing group after the containing group of the item with the specified label.</li>\n</ul></li>\n</ul>\n<p><strong>Notiz:</strong> <code>acceleratorWorksWhenHidden</code> ist als nur-macOS spezifiziert, day Acceleratoren auf Windows und Linux immer arbeiten wenn Einträge versteckt sind. The option is exposed to users to give them the option to turn it off, as this is possible in native macOS development. This property is only usable on macOS High Sierra 10.13 or newer.</p>\n<h3 id=\"roles\"><a href=\"#roles\">Roles</a></h3>\n<p>Roles allow menu items to have predefined behaviors.</p>\n<p>It is best to specify <code>role</code> for any menu item that matches a standard role, rather than trying to manually implement the behavior in a <code>click</code> function. The built-in <code>role</code> behavior will give the best native experience.</p>\n<p>The <code>label</code> and <code>accelerator</code> values are optional when using a <code>role</code> and will default to appropriate values for each platform.</p>\n<p>Every menu item must have either a <code>role</code>, <code>label</code>, or in the case of a separator a <code>type</code>.</p>\n<p>The <code>role</code> property can have following values:</p>\n<ul>\n<li><code>undo</code></li>\n<li><code>about</code> - Trigger a native about panel (custom message box on Window, which does not provide its own).</li>\n<li><code>redo</code></li>\n<li><code>cut</code></li>\n<li><code>copy</code></li>\n<li><code>paste</code></li>\n<li><code>pasteAndMatchStyle</code></li>\n<li><code>selectAll</code></li>\n<li><code>delete</code></li>\n<li><code>minimize</code> - Minimize current window.</li>\n<li><code>close</code> - Close current window.</li>\n<li><code>quit</code> - Quit the application.</li>\n<li><code>reload</code> - Reload the current window.</li>\n<li><code>forceReload</code> - Reload the current window ignoring the cache.</li>\n<li><code>toggleDevTools</code> - Toggle developer tools in the current window.</li>\n<li><code>togglefullscreen</code> - Toggle full screen mode on the current window.</li>\n<li><code>resetZoom</code> - Reset the focused page's zoom level to the original size.</li>\n<li><code>zoomIn</code> - Zoom in the focused page by 10%.</li>\n<li><code>zoomOut</code> - Zoom out the focused page by 10%.</li>\n<li><code>toggleSpellChecker</code> - Enable/disable builtin spell checker.</li>\n<li><code>fileMenu</code> - Whole default \"File\" menu (Close / Quit)</li>\n<li><code>editMenu</code> - Whole default \"Edit\" menu (Undo, Copy, etc.).</li>\n<li><code>viewMenu</code> - Whole default \"View\" menu (Reload, Toggle Developer Tools, etc.)</li>\n<li><code>windowMenu</code> - Whole default \"Window\" menu (Minimize, Zoom, etc.).</li>\n</ul>\n<p>The following additional roles are available on <em>macOS</em>:</p>\n<ul>\n<li><code>appMenu</code> - Whole default \"App\" menu (About, Services, etc.)</li>\n<li><code>hide</code> - Map to the <code>hide</code> action.</li>\n<li><code>hideOthers</code> - Map to the <code>hideOtherApplications</code> action.</li>\n<li><code>unhide</code> - Map to the <code>unhideAllApplications</code> action.</li>\n<li><code>startSpeaking</code> - Map to the <code>startSpeaking</code> action.</li>\n<li><code>stopSpeaking</code> - Map to the <code>stopSpeaking</code> action.</li>\n<li><code>front</code> - Map to the <code>arrangeInFront</code> action.</li>\n<li><code>zoom</code> - Map to the <code>performZoom</code> action.</li>\n<li><code>toggleTabBar</code> - Map to the <code>toggleTabBar</code> action.</li>\n<li><code>selectNextTab</code> - Map to the <code>selectNextTab</code> action.</li>\n<li><code>selectPreviousTab</code> - Map to the <code>selectPreviousTab</code> action.</li>\n<li><code>mergeAllWindows</code> - Map to the <code>mergeAllWindows</code> action.</li>\n<li><code>moveTabToNewWindow</code> - Map to the <code>moveTabToNewWindow</code> action.</li>\n<li><code>window</code> - The submenu is a \"Window\" menu.</li>\n<li><code>help</code> - The submenu is a \"Help\" menu.</li>\n<li><code>services</code> - The submenu is a <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc\">\"Services\"</a> menu. This is only intended for use in the Application Menu and is <em>not</em> the same as the \"Services\" submenu used in context menus in macOS apps, which is not implemented in Electron.</li>\n<li><code>recentDocuments</code> - The submenu is an \"Open Recent\" menu.</li>\n<li><code>clearRecentDocuments</code> - Map to the <code>clearRecentDocuments</code> action.</li>\n<li><code>shareMenu</code> - The submenu is <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/\">share menu</a>. The <code>sharingItem</code> property must also be set to indicate the item to share.</li>\n</ul>\n<p>When specifying a <code>role</code> on macOS, <code>label</code> and <code>accelerator</code> are the only options that will affect the menu item. All other options will be ignored. Lowercase <code>role</code>, e.g. <code>toggledevtools</code>, is still supported.</p>\n<p><strong>Nota Bene:</strong> The <code>enabled</code> and <code>visibility</code> properties are not available for top-level menu items in the tray on macOS.</p>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<p>The following properties are available on instances of <code>MenuItem</code>:</p>\n<h4 id=\"menuitemid\"><a href=\"#menuitemid\"><code>menuItem.id</code></a></h4>\n<p>Ein <code>String</code> welcher die eindeutige Id anzeigt, diese Eigenschaft kann dynamisch geändert werden.</p>\n<h4 id=\"menuitemlabel\"><a href=\"#menuitemlabel\"><code>menuItem.label</code></a></h4>\n<p>A <code>String</code> indicating the item's visible label.</p>\n<h4 id=\"menuitemclick\"><a href=\"#menuitemclick\"><code>menuItem.click</code></a></h4>\n<p>A <code>Function</code> that is fired when the MenuItem receives a click event. It can be called with <code>menuItem.click(event, focusedWindow, focusedWebContents)</code>.</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>focusedWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a></li>\n<li><code>focusedWebContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<h4 id=\"menuitemsubmenu\"><a href=\"#menuitemsubmenu\"><code>menuItem.submenu</code></a></h4>\n<p>A <code>Menu</code> (optional) containing the menu item's submenu, if present.</p>\n<h4 id=\"menuitemtype\"><a href=\"#menuitemtype\"><code>menuItem.type</code></a></h4>\n<p>A <code>String</code> indicating the type of the item. Can be <code>normal</code>, <code>separator</code>, <code>submenu</code>, <code>checkbox</code> or <code>radio</code>.</p>\n<h4 id=\"menuitemrole\"><a href=\"#menuitemrole\"><code>menuItem.role</code></a></h4>\n<p>A <code>String</code> (optional) indicating the item's role, if set. Can be <code>undo</code>, <code>redo</code>, <code>cut</code>, <code>copy</code>, <code>paste</code>, <code>pasteAndMatchStyle</code>, <code>delete</code>, <code>selectAll</code>, <code>reload</code>, <code>forceReload</code>, <code>toggleDevTools</code>, <code>resetZoom</code>, <code>zoomIn</code>, <code>zoomOut</code>, <code>toggleSpellChecker</code>, <code>togglefullscreen</code>, <code>window</code>, <code>minimize</code>, <code>close</code>, <code>help</code>, <code>about</code>, <code>services</code>, <code>hide</code>, <code>hideOthers</code>, <code>unhide</code>, <code>quit</code>, <code>startSpeaking</code>, <code>stopSpeaking</code>, <code>zoom</code>, <code>front</code>, <code>appMenu</code>, <code>fileMenu</code>, <code>editMenu</code>, <code>viewMenu</code>, <code>shareMenu</code>, <code>recentDocuments</code>, <code>toggleTabBar</code>, <code>selectNextTab</code>, <code>selectPreviousTab</code>, <code>mergeAllWindows</code>, <code>clearRecentDocuments</code>, <code>moveTabToNewWindow</code> or <code>windowMenu</code></p>\n<h4 id=\"menuitemaccelerator\"><a href=\"#menuitemaccelerator\"><code>menuItem.accelerator</code></a></h4>\n<p>An <code>Accelerator</code> (optional) indicating the item's accelerator, if set.</p>\n<h4 id=\"menuitemuseraccelerator-readonly-macos\"><a href=\"#menuitemuseraccelerator-readonly-macos\"><code>menuItem.userAccelerator</code> <em>Readonly</em> <em>macOS</em></a></h4>\n<p>An <code>Accelerator | null</code> indicating the item's <a href=\"https://developer.apple.com/documentation/appkit/nsmenuitem/1514850-userkeyequivalent?language=objc\">user-assigned accelerator</a> for the menu item.</p>\n<p><strong>Note:</strong> This property is only initialized after the <code>MenuItem</code> has been added to a <code>Menu</code>. Either via <code>Menu.buildFromTemplate</code> or via <code>Menu.append()/insert()</code>.  Accessing before initialization will just return <code>null</code>.</p>\n<h4 id=\"menuitemicon\"><a href=\"#menuitemicon\"><code>menuItem.icon</code></a></h4>\n<p>A <code>NativeImage | String</code> (optional) indicating the item's icon, if set.</p>\n<h4 id=\"menuitemsublabel\"><a href=\"#menuitemsublabel\"><code>menuItem.sublabel</code></a></h4>\n<p>A <code>String</code> indicating the item's sublabel.</p>\n<h4 id=\"menuitemtooltip-macos\"><a href=\"#menuitemtooltip-macos\"><code>menuItem.toolTip</code> <em>macOS</em></a></h4>\n<p>A <code>String</code> indicating the item's hover text.</p>\n<h4 id=\"menuitemenabled\"><a href=\"#menuitemenabled\"><code>menuItem.enabled</code></a></h4>\n<p>A <code>Boolean</code> indicating whether the item is enabled, this property can be dynamically changed.</p>\n<h4 id=\"menuitemvisible\"><a href=\"#menuitemvisible\"><code>menuItem.visible</code></a></h4>\n<p>A <code>Boolean</code> indicating whether the item is visible, this property can be dynamically changed.</p>\n<h4 id=\"menuitemchecked\"><a href=\"#menuitemchecked\"><code>menuItem.checked</code></a></h4>\n<p>A <code>Boolean</code> indicating whether the item is checked, this property can be dynamically changed.</p>\n<p>A <code>checkbox</code> menu item will toggle the <code>checked</code> property on and off when selected.</p>\n<p>A <code>radio</code> menu item will turn on its <code>checked</code> property when clicked, and will turn off that property for all adjacent items in the same menu.</p>\n<p>You can add a <code>click</code> function for additional behavior.</p>\n<h4 id=\"menuitemregisteraccelerator\"><a href=\"#menuitemregisteraccelerator\"><code>menuItem.registerAccelerator</code></a></h4>\n<p>A <code>Boolean</code> indicating if the accelerator should be registered with the system or just displayed.</p>\n<p>This property can be dynamically changed.</p>\n<h4 id=\"menuitemsharingitem-macos\"><a href=\"#menuitemsharingitem-macos\"><code>menuItem.sharingItem</code> <em>macOS</em></a></h4>\n<p>A <code>SharingItem</code> indicating the item to share when the <code>role</code> is <code>shareMenu</code>.</p>\n<p>This property can be dynamically changed.</p>\n<h4 id=\"menuitemcommandid\"><a href=\"#menuitemcommandid\"><code>menuItem.commandId</code></a></h4>\n<p>A <code>Number</code> indicating an item's sequential unique id.</p>\n<h4 id=\"menuitemmenu\"><a href=\"#menuitemmenu\"><code>menuItem.menu</code></a></h4>\n<p>A <code>Menu</code> that the item is a part of.</p>",
      "title": "MenuItem",
      "description": "Add items to native application menus and context menus."
    },
    "/docs/api/message-channel-main": {
      "locale": "de-DE",
      "slug": "message-channel-main",
      "href": "/docs/api/message-channel-main",
      "crowdinFileId": "256337",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/message-channel-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messagechannelmain\"><a href=\"#messagechannelmain\">MessageChannelMain</a></h1>\n<p><code>MessageChannelMain</code> is the main-process-side equivalent of the DOM <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\"><code>MessageChannel</code></a> object. Its singular function is to create a pair of connected <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> objects.</p>\n<p>See the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> documentation for more information on using channel messaging.</p>\n<h2 id=\"class-messagechannelmain\"><a href=\"#class-messagechannelmain\">Class: MessageChannelMain</a></h2>\n<blockquote>\n<p>Channel interface for channel messaging in the main process.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p>Beispiel:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nw.webContents.postMessage(<span class=\"hljs-string\">'port'</span>, <span class=\"hljs-literal\">null</span>, [port2])\nport1.postMessage({ <span class=\"hljs-attr\">some</span>: <span class=\"hljs-string\">'message'</span> })\n\n<span class=\"hljs-comment\">// Renderer process</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e) => {\n  <span class=\"hljs-comment\">// e.ports is a list of ports sent along with this message</span>\n  e.ports[<span class=\"hljs-number\">0</span>].on(<span class=\"hljs-string\">'message'</span>, (messageEvent) => {\n    <span class=\"hljs-built_in\">console</span>.log(messageEvent.data)\n  })\n})\n</code></pre>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<h4 id=\"channelport1\"><a href=\"#channelport1\"><code>channel.port1</code></a></h4>\n<p>A <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> property.</p>\n<h4 id=\"channelport2\"><a href=\"#channelport2\"><code>channel.port2</code></a></h4>\n<p>A <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> property.</p>",
      "title": "MessageChannelMain",
      "description": "Channel interface for channel messaging in the main process."
    },
    "/docs/api/message-port-main": {
      "locale": "de-DE",
      "slug": "message-port-main",
      "href": "/docs/api/message-port-main",
      "crowdinFileId": "256339",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/message-port-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"messageportmain\"><a href=\"#messageportmain\">MessagePortMain</a></h1>\n<p><code>MessagePortMain</code> is the main-process-side equivalent of the DOM <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>MessagePort</code></a> object. It behaves similarly to the DOM version, with the exception that it uses the Node.js <code>EventEmitter</code> event system, instead of the DOM <code>EventTarget</code> system. This means you should use <code>port.on('message', ...)</code> to listen for events, instead of <code>port.onmessage = ...</code> or <code>port.addEventListener('message', ...)</code></p>\n<p>See the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> documentation for more information on using channel messaging.</p>\n<p><code>MessagePortMain</code> is an [EventEmitter][event-emitter].</p>\n<h2 id=\"class-messageportmain\"><a href=\"#class-messageportmain\">Class: MessagePortMain</a></h2>\n<blockquote>\n<p>Port interface for channel messaging in the main process.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<h4 id=\"portpostmessagemessage-transfer\"><a href=\"#portpostmessagemessage-transfer\"><code>port.postMessage(message, [transfer])</code></a></h4>\n<ul>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.</p>\n<h4 id=\"portstart\"><a href=\"#portstart\"><code>port.start()</code></a></h4>\n<p>Starts the sending of messages queued on the port. Messages will be queued until this method is called.</p>\n<h4 id=\"portclose\"><a href=\"#portclose\"><code>port.close()</code></a></h4>\n<p>Disconnects the port, so it is no longer active.</p>\n<h3 id=\"instanz-ereignisse\"><a href=\"#instanz-ereignisse\">Instanz-Ereignisse</a></h3>\n<h4 id=\"event-message\"><a href=\"#event-message\">Event: 'message'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>messageEvent</code> Object<ul>\n<li><code>data</code> any</li>\n<li><code>ports</code> MessagePortMain[]</li>\n</ul></li>\n</ul>\n<p>Emitted when a MessagePortMain object receives a message.</p>\n<h4 id=\"event-close\"><a href=\"#event-close\">Event: 'close'</a></h4>\n<p>Emitted when the remote end of a MessagePortMain object becomes disconnected.</p>",
      "title": "MessagePortMain",
      "description": "Port interface for channel messaging in the main process."
    },
    "/docs/tutorial/message-ports": {
      "locale": "de-DE",
      "slug": "message-ports",
      "href": "/docs/tutorial/message-ports",
      "crowdinFileId": "256219",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/message-ports.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nachrichtenanschlüsse-in-electron\"><a href=\"#nachrichtenanschlüsse-in-electron\">Nachrichtenanschlüsse in Electron</a></h1>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\"><code>Nachrichtschluss</code></a>ist ein Kennzeichen von Internet, das die Nachrichte erlaubt durch verschiedene Texte einzugehen. Es ist wie <code>Fenster. Nachricht Post</code>, aber auf verschiedene Kanaelen. Das Ziel dieses Dokumentes ist zu beschreiben, wie Electron die Nachrichten einem Kanal uebertraegt, und Beispiele geben, wie Nachrichtschluesse in einem App verwenden.</p>\n<p>Hier ist ein kurzes Beispiel, was ein Nachrichtschluss genau ist und seine Funktion:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Geraet.js ///////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-comment\">//Nachrichtschluesse sind in Kuppeln geschaffen. Ein Kuppel von Nachrichtschluessen in Verbindung heisst</span>\n<span class=\"hljs-comment\">//Kanal.</span>\ndauernder. Kanal=neuer Nachrichtkanal()\n<span class=\"hljs-comment\">//Der eigene Unterschied zwischen Schluss 1 und Schluss2 ist wie Sie sie verwenden. Nachrichte</span>\n<span class=\"hljs-comment\">//die dem Schluss1 gesendet sind, werden vom Schluss2 bekommen werden und umgekehrt.</span>\n<span class=\"hljs-keyword\">const</span> port1 = channel.port1\n<span class=\"hljs-keyword\">const</span> port2 = channel.port2\n\n<span class=\"hljs-comment\">// It's OK to send a message on the channel before the other end has registered</span>\n<span class=\"hljs-comment\">// a listener. Messages will be queued until a listener is registered.</span>\nport2.postMessage({ <span class=\"hljs-attr\">answer</span>: <span class=\"hljs-number\">42</span> })\n\n<span class=\"hljs-comment\">// Here we send the other end of the channel, port1, to the main process. It's</span>\n<span class=\"hljs-comment\">// also possible to send MessagePorts to other frames, or to Web Workers, etc.</span>\nipcRenderer.postMessage(<span class=\"hljs-string\">'port'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-comment\">// In the main process, we receive the port.</span>\nipcMain.on(<span class=\"hljs-string\">'port'</span>, (event) => {\n  <span class=\"hljs-comment\">// When we receive a MessagePort in the main process, it becomes a</span>\n  <span class=\"hljs-comment\">// MessagePortMain.</span>\n  <span class=\"hljs-keyword\">const</span> port = event.ports[<span class=\"hljs-number\">0</span>]\n\n  <span class=\"hljs-comment\">// MessagePortMain uses the Node.js-style events API, rather than the</span>\n  <span class=\"hljs-comment\">// web-style events API. So .on('message', ...) instead of .onmessage = ...</span>\n  port.on(<span class=\"hljs-string\">'message'</span>, (event) => {\n    <span class=\"hljs-comment\">// data is { answer: 42 }</span>\n    <span class=\"hljs-keyword\">const</span> data = event.data\n  })\n\n  <span class=\"hljs-comment\">// MessagePortMain queues messages until the .start() method has been called.</span>\n  port.start()\n})\n</code></pre>\n<p>The <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API\">Channel Messaging API</a> documentation is a great way to learn more about how MessagePorts work.</p>\n<h2 id=\"messageports-in-the-main-process\"><a href=\"#messageports-in-the-main-process\">MessagePorts in the main process</a></h2>\n<p>In the renderer, the <code>MessagePort</code> class behaves exactly as it does on the web. The main process is not a web page, though—it has no Blink integration—and so it does not have the <code>MessagePort</code> or <code>MessageChannel</code> classes. In order to handle and interact with MessagePorts in the main process, Electron adds two new classes: <a href=\"/docs/api/message-port-main\"><code>MessagePortMain</code></a> and <a href=\"/docs/api/message-channel-main\"><code>MessageChannelMain</code></a>. These behave similarly to the analogous classes in the renderer.</p>\n<p><code>MessagePort</code> objects can be created in either the renderer or the main process, and passed back and forth using the <a href=\"/docs/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer\"><code>ipcRenderer.postMessage</code></a> and <a href=\"/docs/api/web-contents#contentspostmessagechannel-message-transfer\"><code>WebContents.postMessage</code></a> methods. Note that the usual IPC methods like <code>send</code> and <code>invoke</code> cannot be used to transfer <code>MessagePort</code>s, only the <code>postMessage</code> methods can transfer <code>MessagePort</code>s.</p>\n<p>By passing <code>MessagePort</code>s via the main process, you can connect two pages that might not otherwise be able to communicate (e.g. due to same-origin restrictions).</p>\n<h2 id=\"extension-close-event\"><a href=\"#extension-close-event\">Extension: <code>close</code> event</a></h2>\n<p>Electron adds one feature to <code>MessagePort</code> that isn't present on the web, in order to make MessagePorts more useful. That is the <code>close</code> event, which is emitted when the other end of the channel is closed. Ports can also be implicitly closed by being garbage-collected.</p>\n<p>In the renderer, you can listen for the <code>close</code> event either by assigning to <code>port.onclose</code> or by calling <code>port.addEventListener('close', ...)</code>. In the main process, you can listen for the <code>close</code> event by calling <code>port.on('close', ...)</code>.</p>\n<h2 id=\"example-use-cases\"><a href=\"#example-use-cases\">Example use cases</a></h2>\n<h3 id=\"worker-process\"><a href=\"#worker-process\">Worker process</a></h3>\n<p>In this example, your app has a worker process implemented as a hidden window. You want the app page to be able to communicate directly with the worker process, without the performance overhead of relaying via the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow, app, ipcMain, MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-comment\">// The worker process is a hidden BrowserWindow, so that it will have access</span>\n  <span class=\"hljs-comment\">// to a full Blink context (including e.g. &#x3C;canvas>, audio, fetch(), etc.)</span>\n  <span class=\"hljs-keyword\">const</span> worker = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span> }\n  })\n  <span class=\"hljs-keyword\">await</span> worker.loadFile(<span class=\"hljs-string\">'worker.html'</span>)\n\n  <span class=\"hljs-comment\">// The main window will send work to the worker process and receive results</span>\n  <span class=\"hljs-comment\">// over a MessagePort.</span>\n  <span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span> }\n  })\n  mainWindow.loadFile(<span class=\"hljs-string\">'app.html'</span>)\n\n  <span class=\"hljs-comment\">// We can't use ipcMain.handle() here, because the reply needs to transfer a</span>\n  <span class=\"hljs-comment\">// MessagePort.</span>\n  ipcMain.on(<span class=\"hljs-string\">'request-worker-channel'</span>, (event) => {\n    <span class=\"hljs-comment\">// For security reasons, let's make sure only the frames we expect can</span>\n    <span class=\"hljs-comment\">// access the worker.</span>\n    <span class=\"hljs-keyword\">if</span> (event.senderFrame === mainWindow.webContents.mainFrame) {\n      <span class=\"hljs-comment\">// Create a new channel ...</span>\n      <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\n      <span class=\"hljs-comment\">// ... send one end to the worker ...</span>\n      worker.webContents.postMessage(<span class=\"hljs-string\">'new-client'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n      <span class=\"hljs-comment\">// ... and the other end to the main window.</span>\n      event.senderFrame.postMessage(<span class=\"hljs-string\">'provide-worker-channel'</span>, <span class=\"hljs-literal\">null</span>, [port2])\n      <span class=\"hljs-comment\">// Now the main window and the worker can communicate with each other</span>\n      <span class=\"hljs-comment\">// without going through the main process!</span>\n    }\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- worker.html ------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">doWork</span>(<span class=\"hljs-params\">input</span>) </span>{\n  <span class=\"hljs-comment\">// Something cpu-intensive.</span>\n  <span class=\"hljs-keyword\">return</span> input * <span class=\"hljs-number\">2</span>\n}\n\n<span class=\"hljs-comment\">// We might get multiple clients, for instance if there are multiple windows,</span>\n<span class=\"hljs-comment\">// or if the main window reloads.</span>\nipcRenderer.on(<span class=\"hljs-string\">'new-client'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n  port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    <span class=\"hljs-comment\">// The event data can be any serializable object (and the event could even</span>\n    <span class=\"hljs-comment\">// carry other MessagePorts with it!)</span>\n    <span class=\"hljs-keyword\">const</span> result = doWork(event.data)\n    port.postMessage(result)\n  }\n})\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- app.html ---------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// We request that the main process sends us a channel we can use to</span>\n<span class=\"hljs-comment\">// communicate with the worker.</span>\nipcRenderer.send(<span class=\"hljs-string\">'request-worker-channel'</span>)\n\nipcRenderer.once(<span class=\"hljs-string\">'provide-worker-channel'</span>, (event) => {\n  <span class=\"hljs-comment\">// Once we receive the reply, we can take the port...</span>\n  <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n  <span class=\"hljs-comment\">// ... register a handler to receive results ...</span>\n  port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'received result:'</span>, event.data)\n  }\n  <span class=\"hljs-comment\">// ... and start sending it work!</span>\n  port.postMessage(<span class=\"hljs-number\">21</span>)\n})\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h3 id=\"reply-streams\"><a href=\"#reply-streams\">Reply streams</a></h3>\n<p>Electron's built-in IPC methods only support two modes: fire-and-forget (e.g. <code>send</code>), or request-response (e.g. <code>invoke</code>). Using MessageChannels, you can implement a \"response stream\", where a single request responds with a stream of data.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// renderer.js ///////////////////////////////////////////////////////////////</span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">makeStreamingRequest</span> (<span class=\"hljs-params\">element, callback</span>) </span>{\n  <span class=\"hljs-comment\">// MessageChannels are lightweight--it's cheap to create a new one for each</span>\n  <span class=\"hljs-comment\">// request.</span>\n  <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannel()\n\n  <span class=\"hljs-comment\">// We send one end of the port to the main process ...</span>\n  ipcRenderer.postMessage(\n    <span class=\"hljs-string\">'give-me-a-stream'</span>,\n    { element, <span class=\"hljs-attr\">count</span>: <span class=\"hljs-number\">10</span> },\n    [port2]\n  )\n\n  <span class=\"hljs-comment\">// ... and we hang on to the other end. The main process will send messages</span>\n  <span class=\"hljs-comment\">// to its end of the port, and close it when it's finished.</span>\n  port1.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n    callback(event.data)\n  }\n  port1.onclose = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'stream ended'</span>)\n  }\n}\n\nmakeStreamingRequest(<span class=\"hljs-number\">42</span>, (data) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'got response data:'</span>, event.data)\n})\n<span class=\"hljs-comment\">// We will see \"got response data: 42\" 10 times.</span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n\nipcMain.on(<span class=\"hljs-string\">'give-me-a-stream'</span>, (event, msg) => {\n  <span class=\"hljs-comment\">// The renderer has sent us a MessagePort that it wants us to send our</span>\n  <span class=\"hljs-comment\">// response over.</span>\n  <span class=\"hljs-keyword\">const</span> [replyPort] = event.ports\n\n  <span class=\"hljs-comment\">// Here we send the messages synchronously, but we could just as easily store</span>\n  <span class=\"hljs-comment\">// the port somewhere and send messages asynchronously.</span>\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">let</span> i = <span class=\"hljs-number\">0</span>; i &#x3C; msg.count; i++) {\n    replyPort.postMessage(msg.element)\n  }\n\n  <span class=\"hljs-comment\">// We close the port when we're done to indicate to the other end that we</span>\n  <span class=\"hljs-comment\">// won't be sending any more messages. This isn't strictly necessary--if we</span>\n  <span class=\"hljs-comment\">// didn't explicitly close the port, it would eventually be garbage</span>\n  <span class=\"hljs-comment\">// collected, which would also trigger the 'close' event in the renderer.</span>\n  replyPort.close()\n})\n</code></pre>\n<h3 id=\"communicating-directly-between-the-main-process-and-the-main-world-of-a-context-isolated-page\"><a href=\"#communicating-directly-between-the-main-process-and-the-main-world-of-a-context-isolated-page\">Communicating directly between the main process and the main world of a context-isolated page</a></h3>\n<p>When <a href=\"/docs/tutorial/context-isolation\">context isolation</a> is enabled, IPC messages from the main process to the renderer are delivered to the isolated world, rather than to the main world. Sometimes you want to deliver messages to the main world directly, without having to step through the isolated world.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js ///////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { BrowserWindow, app, MessageChannelMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-comment\">// Create a BrowserWindow with contextIsolation enabled.</span>\n  <span class=\"hljs-keyword\">const</span> bw = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">contextIsolation</span>: <span class=\"hljs-literal\">true</span>,\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n  bw.loadURL(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-comment\">// We'll be sending one end of this channel to the main world of the</span>\n  <span class=\"hljs-comment\">// context-isolated page.</span>\n  <span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\n\n  <span class=\"hljs-comment\">// It's OK to send a message on the channel before the other end has</span>\n  <span class=\"hljs-comment\">// registered a listener. Messages will be queued until a listener is</span>\n  <span class=\"hljs-comment\">// registered.</span>\n  port2.postMessage({ <span class=\"hljs-attr\">test</span>: <span class=\"hljs-number\">21</span> })\n\n  <span class=\"hljs-comment\">// We can also receive messages from the main world of the renderer.</span>\n  port2.on(<span class=\"hljs-string\">'message'</span>, (event) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'from renderer main world:'</span>, event.data)\n  })\n  port2.start()\n\n  <span class=\"hljs-comment\">// The preload script will receive this IPC message and transfer the port</span>\n  <span class=\"hljs-comment\">// over to the main world.</span>\n  bw.webContents.postMessage(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-literal\">null</span>, [port1])\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// preload.js ////////////////////////////////////////////////////////////////</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// We need to wait until the main world is ready to receive the message before</span>\n<span class=\"hljs-comment\">// sending the port. We create this promise in the preload so it's guaranteed</span>\n<span class=\"hljs-comment\">// to register the onload listener before the load event is fired.</span>\n<span class=\"hljs-keyword\">const</span> windowLoaded = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> {\n  <span class=\"hljs-built_in\">window</span>.onload = resolve\n})\n\nipcRenderer.on(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-keyword\">async</span> (event) => {\n  <span class=\"hljs-keyword\">await</span> windowLoaded\n  <span class=\"hljs-comment\">// We use regular window.postMessage to transfer the port from the isolated</span>\n  <span class=\"hljs-comment\">// world to the main world.</span>\n  <span class=\"hljs-built_in\">window</span>.postMessage(<span class=\"hljs-string\">'main-world-port'</span>, <span class=\"hljs-string\">'*'</span>, event.ports)\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- index.html -------------------------------------------------------------></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n<span class=\"hljs-built_in\">window</span>.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n  <span class=\"hljs-comment\">// event.source === window means the message is coming from the preload</span>\n  <span class=\"hljs-comment\">// script, as opposed to from an &#x3C;iframe> or other source.</span>\n  <span class=\"hljs-keyword\">if</span> (event.source === <span class=\"hljs-built_in\">window</span> &#x26;&#x26; event.data === <span class=\"hljs-string\">'main-world-port'</span>) {\n    <span class=\"hljs-keyword\">const</span> [ port ] = event.ports\n    <span class=\"hljs-comment\">// Once we have the port, we can communicate directly with the main</span>\n    <span class=\"hljs-comment\">// process.</span>\n    port.onmessage = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'from main process:'</span>, event.data)\n      port.postMessage(event.data * <span class=\"hljs-number\">2</span>)\n    }\n  }\n}\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>",
      "title": "Nachrichtenanschlüsse in Electron",
      "description": ""
    },
    "/docs/api/structures/mime-typed-buffer": {
      "locale": "de-DE",
      "slug": "mime-typed-buffer",
      "href": "/docs/api/structures/mime-typed-buffer",
      "crowdinFileId": "256463",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mime-typed-buffer.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mimetypedbuffer-object\"><a href=\"#mimetypedbuffer-object\">MimeTypedBuffer Object</a></h1>\n<ul>\n<li><code>mimeType</code> String (optional) - MIME type of the buffer.</li>\n<li><code>charset</code> String (optional) - Charset of the buffer.</li>\n<li><code>data</code> Buffer - The actual Buffer content.</li>\n</ul>",
      "title": "MimeTypedBuffer Object",
      "description": ""
    },
    "/docs/api/structures/mouse-input-event": {
      "locale": "de-DE",
      "slug": "mouse-input-event",
      "href": "/docs/api/structures/mouse-input-event",
      "crowdinFileId": "256465",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mouse-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mouseinputevent-object-extends-inputevent\"><a href=\"#mouseinputevent-object-extends-inputevent\">MouseInputEvent Object extends <code>InputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>mouseDown</code>, <code>mouseUp</code>, <code>mouseEnter</code>, <code>mouseLeave</code>, <code>contextMenu</code>, <code>mouseWheel</code> or <code>mouseMove</code>.</li>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n<li><code>button</code> String (optional) - The button pressed, can be <code>left</code>, <code>middle</code>, <code>right</code>.</li>\n<li><code>globalX</code> Integer (optional)</li>\n<li><code>globalY</code> Integer (optional)</li>\n<li><code>movementX</code> Integer (optional)</li>\n<li><code>movementY</code> Integer (optional)</li>\n<li><code>clickCount</code> Integer (optional)</li>\n</ul>",
      "title": "MouseInputEvent Object extends InputEvent",
      "description": ""
    },
    "/docs/api/structures/mouse-wheel-input-event": {
      "locale": "de-DE",
      "slug": "mouse-wheel-input-event",
      "href": "/docs/api/structures/mouse-wheel-input-event",
      "crowdinFileId": "256467",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/mouse-wheel-input-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"mousewheelinputevent-object-extends-mouseinputevent\"><a href=\"#mousewheelinputevent-object-extends-mouseinputevent\">MouseWheelInputEvent Object extends <code>MouseInputEvent</code></a></h1>\n<ul>\n<li><code>type</code> String - The type of the event, can be <code>mouseWheel</code>.</li>\n<li><code>deltaX</code> Integer (optional)</li>\n<li><code>deltaY</code> Integer (optional)</li>\n<li><code>wheelTicksX</code> Integer (optional)</li>\n<li><code>wheelTicksY</code> Integer (optional)</li>\n<li><code>accelerationRatioX</code> Integer (optional)</li>\n<li><code>accelerationRatioY</code> Integer (optional)</li>\n<li><code>hasPreciseScrollingDeltas</code> Boolean (optional)</li>\n<li><code>canScroll</code> Boolean (optional)</li>\n</ul>",
      "title": "MouseWheelInputEvent Object extends MouseInputEvent",
      "description": ""
    },
    "/docs/tutorial/multithreading": {
      "locale": "de-DE",
      "slug": "multithreading",
      "href": "/docs/tutorial/multithreading",
      "crowdinFileId": "256221",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/multithreading.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"multithreading\"><a href=\"#multithreading\">Multithreading</a></h1>\n<p>Mit <a href=\"https://developer.mozilla.org/en/docs/Web/API/Web_Workers_API/Using_web_workers\">Web Workers</a> ist es möglich, JavaScript in OS-Level Threads auszuführen.</p>\n<h2 id=\"multi-threaded-nodejs\"><a href=\"#multi-threaded-nodejs\">Multi-threaded Node.js</a></h2>\n<p>Es ist möglich <code>Node.js features</code> in <code>Electrons Webworkers</code> zu verwenden. Dazu muss die Option <code>nodeIntegrationInWorker</code> in den &#x3C;0>WebPreferences&#x3C;/0> auf &#x3C;0>true&#x3C;/0> gesetzt werden.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegrationInWorker</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<p>The <code>nodeIntegrationInWorker</code> can be used independent of <code>nodeIntegration</code>, but <code>sandbox</code> must not be set to <code>true</code>.</p>\n<h2 id=\"available-apis\"><a href=\"#available-apis\">Available APIs</a></h2>\n<p>All built-in modules of Node.js are supported in Web Workers, and <code>asar</code> archives can still be read with Node.js APIs. However none of Electron's built-in modules can be used in a multi-threaded environment.</p>\n<h2 id=\"native-nodejs-module\"><a href=\"#native-nodejs-module\">Native Node.js Module</a></h2>\n<p>Any native Node.js module can be loaded directly in Web Workers, but it is strongly recommended not to do so. Most existing native modules have been written assuming single-threaded environment, using them in Web Workers will lead to crashes and memory corruptions.</p>\n<p>Note that even if a native Node.js module is thread-safe it's still not safe to load it in a Web Worker because the <code>process.dlopen</code> function is not thread safe.</p>\n<p>The only way to load a native module safely for now, is to make sure the app loads no native modules after the Web Workers get started.</p>\n<pre><code class=\"hljs language-javascript\">process.dlopen = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">throw</span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Error</span>(<span class=\"hljs-string\">'Load native module is not safe'</span>)\n}\n<span class=\"hljs-keyword\">const</span> worker = <span class=\"hljs-keyword\">new</span> Worker(<span class=\"hljs-string\">'script.js'</span>)\n</code></pre>",
      "title": "Multithreading",
      "description": ""
    },
    "/docs/tutorial/native-file-drag-drop": {
      "locale": "de-DE",
      "slug": "native-file-drag-drop",
      "href": "/docs/tutorial/native-file-drag-drop",
      "crowdinFileId": "256223",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/native-file-drag-drop.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"natives-datei-drag--drop\"><a href=\"#natives-datei-drag--drop\">Natives Datei Drag &#x26; Drop</a></h1>\n<h2 id=\"übersicht\"><a href=\"#übersicht\">Übersicht</a></h2>\n<p>Certain kinds of applications that manipulate files might want to support the operating system's native file drag &#x26; drop feature. Dragging files into web content is common and supported by many websites. Electron additionally supports dragging files and content out from web content into the operating system's world.</p>\n<p>To implement this feature in your app, you need to call the <a href=\"/docs/api/web-contents#contentsstartdragitem\"><code>webContents.startDrag(item)</code></a> API in response to the <code>ondragstart</code> event.</p>\n<h2 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h2>\n<p>An example demonstrating how you can create a file on the fly to be dragged out of the window.</p>\n<h3 id=\"preloadjs\"><a href=\"#preloadjs\">Preload.js</a></h3>\n<p>In <code>preload.js</code> use the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> to inject a method <code>window.electron.startDrag(...)</code> that will send an IPC message to the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge, ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'electron'</span>, {\n  <span class=\"hljs-attr\">startDrag</span>: <span class=\"hljs-function\">(<span class=\"hljs-params\">fileName</span>) =></span> {\n    ipcRenderer.send(<span class=\"hljs-string\">'ondragstart'</span>, path.join(process.cwd(), fileName))\n  }\n})\n</code></pre>\n<h3 id=\"indexhtml\"><a href=\"#indexhtml\">Index.html</a></h3>\n<p>Add a draggable element to <code>index.html</code>, and reference your renderer script:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">div</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"border:2px solid black;border-radius:3px;padding:5px;display:inline-block\"</span> <span class=\"hljs-attr\">draggable</span>=<span class=\"hljs-string\">\"true\"</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"drag\"</span>></span>Drag me<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">div</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h3 id=\"rendererjs\"><a href=\"#rendererjs\">Renderer.js</a></h3>\n<p>In <code>renderer.js</code> set up the renderer process to handle drag events by calling the method you added via the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> above.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'drag'</span>).ondragstart = <span class=\"hljs-function\">(<span class=\"hljs-params\">event</span>) =></span> {\n  event.preventDefault()\n  <span class=\"hljs-built_in\">window</span>.electron.startDrag(<span class=\"hljs-string\">'drag-and-drop.md'</span>)\n}\n</code></pre>\n<h3 id=\"mainjs\"><a href=\"#mainjs\">Main.js</a></h3>\n<p>In the Main process (<code>main.js</code> file), expand the received event with a path to the file that is being dragged and an icon:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/drag-and-drop\"><span class=\"hljs-keyword\">const</span> { ipcMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nipcMain.on(<span class=\"hljs-string\">'ondragstart'</span>, (event, filePath) => {\n  event.sender.startDrag({\n    <span class=\"hljs-attr\">file</span>: filePath,\n    <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'/path/to/icon.png'</span>\n  })\n})\n</code></pre>\n<p>After launching the Electron application, try dragging and dropping the item from the BrowserWindow onto your desktop. In this guide, the item is a Markdown file located in the root of the project:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/drag-and-drop.gif\" alt=\"Drag and drop\"></p>",
      "title": "Natives Datei Drag & Drop",
      "description": ""
    },
    "/docs/api/native-image": {
      "locale": "de-DE",
      "slug": "native-image",
      "href": "/docs/api/native-image",
      "crowdinFileId": "256341",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/native-image.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nativeimage\"><a href=\"#nativeimage\">nativeImage</a></h1>\n<blockquote>\n<p>Create tray, dock, and application icons using PNG or JPG files.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>In Electron, for the APIs that take images, you can pass either file paths or <code>NativeImage</code> instances. An empty image will be used when <code>null</code> is passed.</p>\n<p>For example, when creating a tray or setting a window's icon, you can pass an image file path as a <code>String</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'/Users/somebody/images/window.png'</span> })\n<span class=\"hljs-built_in\">console</span>.log(appIcon, win)\n</code></pre>\n<p>Or read the image from the clipboard, which returns a <code>NativeImage</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { clipboard, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> image = clipboard.readImage()\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(image)\n<span class=\"hljs-built_in\">console</span>.log(appIcon)\n</code></pre>\n<h2 id=\"unterstütze-formate\"><a href=\"#unterstütze-formate\">Unterstütze Formate</a></h2>\n<p>Currently <code>PNG</code> and <code>JPEG</code> image formats are supported. <code>PNG</code> is recommended because of its support for transparency and lossless compression.</p>\n<p>On Windows, you can also load <code>ICO</code> icons from file paths. For best visual quality, it is recommended to include at least the following sizes in the:</p>\n<ul>\n<li>Kleines Icon<ul>\n<li>16x16 (100% DPI scale)</li>\n<li>20x20 (125% DPI scale)</li>\n<li>24x24 (150% DPI scale)</li>\n<li>32x32 (200% DPI scale)</li>\n</ul></li>\n<li>Großes Icon<ul>\n<li>32x32 (100% DPI scale)</li>\n<li>40x40 (125% DPI scale)</li>\n<li>48x48 (150% DPI scale)</li>\n<li>64x64 (200% DPI scale)</li>\n<li>256x256</li>\n</ul></li>\n</ul>\n<p>Check the <em>Size requirements</em> section in <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dn742485(v=vs.85).aspx\">this article</a>.</p>\n<h2 id=\"hochauflösende-bilder\"><a href=\"#hochauflösende-bilder\">Hochauflösende Bilder</a></h2>\n<p>On platforms that have high-DPI support such as Apple Retina displays, you can append <code>@2x</code> after image's base filename to mark it as a high resolution image.</p>\n<p>For example, if <code>icon.png</code> is a normal image that has standard resolution, then <code>icon@2x.png</code> will be treated as a high resolution image that has double DPI density.</p>\n<p>If you want to support displays with different DPI densities at the same time, you can put images with different sizes in the same folder and use the filename without DPI suffixes. Ein Beispiel:</p>\n<pre><code class=\"hljs language-plaintext\">images/\n├── icon.png\n├── icon@2x.png\n└── icon@3x.png\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-built_in\">console</span>.log(appIcon)\n</code></pre>\n<p>The following suffixes for DPI are also supported:</p>\n<ul>\n<li><code>@1x</code></li>\n<li><code>@1.25x</code></li>\n<li><code>@1.33x</code></li>\n<li><code>@1.4x</code></li>\n<li><code>@1.5x</code></li>\n<li><code>@1.8x</code></li>\n<li><code>@2x</code></li>\n<li><code>@2.5x</code></li>\n<li><code>@3x</code></li>\n<li><code>@4x</code></li>\n<li><code>@5x</code></li>\n</ul>\n<h2 id=\"template-bild\"><a href=\"#template-bild\">Template Bild</a></h2>\n<p>Template images consist of black and an alpha channel. Template images are not intended to be used as standalone images and are usually mixed with other content to create the desired final appearance.</p>\n<p>The most common case is to use template images for a menu bar icon, so it can adapt to both light and dark menu bars.</p>\n<p><strong>Note:</strong> Template image is only supported on macOS.</p>\n<p>To mark an image as a template image, its filename should end with the word <code>Template</code>. Ein Beispiel:</p>\n<ul>\n<li><code>xxxTemplate.png</code></li>\n<li><code>xxxTemplate@2x.png</code></li>\n</ul>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>The <code>nativeImage</code> module has the following methods, all of which return an instance of the <code>NativeImage</code> class:</p>\n<h3 id=\"nativeimagecreateempty\"><a href=\"#nativeimagecreateempty\"><code>nativeImage.createEmpty()</code></a></h3>\n<p>Gibt das <code>NativeImage</code> zurück</p>\n<p>Creates an empty <code>NativeImage</code> instance.</p>\n<h3 id=\"nativeimagecreatethumbnailfrompathpath-maxsize-macos-windows\"><a href=\"#nativeimagecreatethumbnailfrompathpath-maxsize-macos-windows\"><code>nativeImage.createThumbnailFromPath(path, maxSize)</code> <em>macOS</em> <em>Windows</em></a></h3>\n<ul>\n<li><code>path</code> String - path to a file that we intend to construct a thumbnail out of.</li>\n<li><code>maxSize</code> <a href=\"/docs/api/structures/size\">Size</a> - the maximum width and height (positive numbers) the thumbnail returned can be. The Windows implementation will ignore <code>maxSize.height</code> and scale the height according to <code>maxSize.width</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - fulfilled with the file's thumbnail preview image, which is a <a href=\"/docs/api/native-image\">NativeImage</a>.</p>\n<h3 id=\"nativeimagecreatefrompathpath\"><a href=\"#nativeimagecreatefrompathpath\"><code>nativeImage.createFromPath(path)</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Gibt das <code>NativeImage</code> zurück</p>\n<p>Creates a new <code>NativeImage</code> instance from a file located at <code>path</code>. This method returns an empty image if the <code>path</code> does not exist, cannot be read, or is not a valid image.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> nativeImage = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).nativeImage\n\n<span class=\"hljs-keyword\">const</span> image = nativeImage.createFromPath(<span class=\"hljs-string\">'/Users/somebody/images/icon.png'</span>)\n<span class=\"hljs-built_in\">console</span>.log(image)\n</code></pre>\n<h3 id=\"nativeimagecreatefrombitmapbuffer-options\"><a href=\"#nativeimagecreatefrombitmapbuffer-options\"><code>nativeImage.createFromBitmap(buffer, options)</code></a></h3>\n<ul>\n<li><code>buffer</code> <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a></li>\n<li><code>options</code> Objekt<ul>\n<li><code>width</code> Integer</li>\n<li><code>height</code> Integer</li>\n<li><code>scaleFactor</code> Double (optional) - Defaults to 1.0.</li>\n</ul></li>\n</ul>\n<p>Gibt das <code>NativeImage</code> zurück</p>\n<p>Creates a new <code>NativeImage</code> instance from <code>buffer</code> that contains the raw bitmap pixel data returned by <code>toBitmap()</code>. The specific format is platform-dependent.</p>\n<h3 id=\"nativeimagecreatefrombufferbuffer-options\"><a href=\"#nativeimagecreatefrombufferbuffer-options\"><code>nativeImage.createFromBuffer(buffer[, options])</code></a></h3>\n<ul>\n<li><code>buffer</code> <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a></li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>width</code> Integer (optional) - Required for bitmap buffers.</li>\n<li><code>height</code> Integer (optional) - Required for bitmap buffers.</li>\n<li><code>scaleFactor</code> Double (optional) - Defaults to 1.0.</li>\n</ul></li>\n</ul>\n<p>Gibt das <code>NativeImage</code> zurück</p>\n<p>Creates a new <code>NativeImage</code> instance from <code>buffer</code>. Tries to decode as PNG or JPEG first.</p>\n<h3 id=\"nativeimagecreatefromdataurldataurl\"><a href=\"#nativeimagecreatefromdataurldataurl\"><code>nativeImage.createFromDataURL(dataURL)</code></a></h3>\n<ul>\n<li><code>dataURL</code> String</li>\n</ul>\n<p>Gibt das <code>NativeImage</code> zurück</p>\n<p>Creates a new <code>NativeImage</code> instance from <code>dataURL</code>.</p>\n<h3 id=\"nativeimagecreatefromnamedimageimagename-hslshift-macos\"><a href=\"#nativeimagecreatefromnamedimageimagename-hslshift-macos\"><code>nativeImage.createFromNamedImage(imageName[, hslShift])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>imageName</code> String</li>\n<li><code>hslShift</code> Number<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Gibt das <code>NativeImage</code> zurück</p>\n<p>Creates a new <code>NativeImage</code> instance from the NSImage that maps to the given image name. See <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/system-icons/\"><code>System Icons</code></a> for a list of possible values.</p>\n<p>The <code>hslShift</code> is applied to the image with the following rules:</p>\n<ul>\n<li><code>hsl_shift[0]</code> (hue): The absolute hue value for the image - 0 and 1 map to 0 and 360 on the hue color wheel (red).</li>\n<li><code>hsl_shift[1]</code> (saturation): A saturation shift for the image, with the following key values: 0 = remove all color. 0.5 = leave unchanged. 1 = fully saturate the image.</li>\n<li><code>hsl_shift[2]</code> (lightness): A lightness shift for the image, with the following key values: 0 = remove all lightness (make all pixels black). 0.5 = leave unchanged. 1 = full lightness (make all pixels white).</li>\n</ul>\n<p>This means that <code>[-1, 0, 1]</code> will make the image completely white and <code>[-1, 1, 0]</code> will make the image completely black.</p>\n<p>In some cases, the <code>NSImageName</code> doesn't match its string representation; one example of this is <code>NSFolderImageName</code>, whose string representation would actually be <code>NSFolder</code>. Therefore, you'll need to determine the correct string representation for your image before passing it in. This can be done with the following:</p>\n<p><code>echo -e '#import &#x3C;Cocoa/Cocoa.h>\\nint main() { NSLog(@\"%@\", SYSTEM_IMAGE_NAME); }' | clang -otest -x objective-c -framework Cocoa - &#x26;&#x26; ./test</code></p>\n<p>where <code>SYSTEM_IMAGE_NAME</code> should be replaced with any value from <a href=\"https://developer.apple.com/documentation/appkit/nsimagename?language=objc\">this list</a>.</p>\n<h2 id=\"class-nativeimage\"><a href=\"#class-nativeimage\">Class: NativeImage</a></h2>\n<blockquote>\n<p>Natively wrap images such as tray, dock, and application icons.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<p>The following methods are available on instances of the <code>NativeImage</code> class:</p>\n<h4 id=\"imagetopngoptions\"><a href=\"#imagetopngoptions\"><code>image.toPNG([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>scaleFactor</code> Double (optional) - Defaults to 1.0.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Buffer</code> - A <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> that contains the image's <code>PNG</code> encoded data.</p>\n<h4 id=\"imagetojpegquality\"><a href=\"#imagetojpegquality\"><code>image.toJPEG(quality)</code></a></h4>\n<ul>\n<li><code>quality</code> Integer - Between 0 - 100.</li>\n</ul>\n<p>Returns <code>Buffer</code> - A <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> that contains the image's <code>JPEG</code> encoded data.</p>\n<h4 id=\"imagetobitmapoptions\"><a href=\"#imagetobitmapoptions\"><code>image.toBitmap([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>scaleFactor</code> Double (optional) - Defaults to 1.0.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Buffer</code> - A <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> that contains a copy of the image's raw bitmap pixel data.</p>\n<h4 id=\"imagetodataurloptions\"><a href=\"#imagetodataurloptions\"><code>image.toDataURL([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>scaleFactor</code> Double (optional) - Defaults to 1.0.</li>\n</ul></li>\n</ul>\n<p>Returns <code>String</code> - The data URL of the image.</p>\n<h4 id=\"imagegetbitmapoptions\"><a href=\"#imagegetbitmapoptions\"><code>image.getBitmap([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>scaleFactor</code> Double (optional) - Defaults to 1.0.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Buffer</code> - A <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> that contains the image's raw bitmap pixel data.</p>\n<p>The difference between <code>getBitmap()</code> and <code>toBitmap()</code> is that <code>getBitmap()</code> does not copy the bitmap data, so you have to use the returned Buffer immediately in current event loop tick; otherwise the data might be changed or destroyed.</p>\n<h4 id=\"imagegetnativehandle-macos\"><a href=\"#imagegetnativehandle-macos\"><code>image.getNativeHandle()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Buffer</code> - A <a href=\"https://nodejs.org/api/buffer.html#buffer_class_buffer\">Buffer</a> that stores C pointer to underlying native handle of the image. On macOS, a pointer to <code>NSImage</code> instance would be returned.</p>\n<p>Notice that the returned pointer is a weak pointer to the underlying native image instead of a copy, so you <em>must</em> ensure that the associated <code>nativeImage</code> instance is kept around.</p>\n<h4 id=\"imageisempty\"><a href=\"#imageisempty\"><code>image.isEmpty()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the image is empty.</p>\n<h4 id=\"imagegetsizescalefactor\"><a href=\"#imagegetsizescalefactor\"><code>image.getSize([scaleFactor])</code></a></h4>\n<ul>\n<li><code>scaleFactor</code> Double (optional) - Defaults to 1.0.</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/size\"><code>Size</code></a>.</p>\n<p>If <code>scaleFactor</code> is passed, this will return the size corresponding to the image representation most closely matching the passed value.</p>\n<h4 id=\"imagesettemplateimageoption\"><a href=\"#imagesettemplateimageoption\"><code>image.setTemplateImage(option)</code></a></h4>\n<ul>\n<li><code>option</code> Boolean</li>\n</ul>\n<p>Marks the image as a template image.</p>\n<h4 id=\"imageistemplateimage\"><a href=\"#imageistemplateimage\"><code>image.isTemplateImage()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the image is a template image.</p>\n<h4 id=\"imagecroprect\"><a href=\"#imagecroprect\"><code>image.crop(rect)</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - The area of the image to crop.</li>\n</ul>\n<p>Returns <code>NativeImage</code> - The cropped image.</p>\n<h4 id=\"imageresizeoptions\"><a href=\"#imageresizeoptions\"><code>image.resize(options)</code></a></h4>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>width</code> Integer (optional) - Defaults to the image's width.</li>\n<li><code>height</code> Integer (optional) - Defaults to the image's height.</li>\n<li><code>quality</code> String (optional) - The desired quality of the resize image. Mögliche Werte sind <code>good</code>, <code>better</code> oder <code>best</code>. The default is <code>best</code>. These values express a desired quality/speed tradeoff. They are translated into an algorithm-specific method that depends on the capabilities (CPU, GPU) of the underlying platform. It is possible for all three methods to be mapped to the same algorithm on a given platform.</li>\n</ul></li>\n</ul>\n<p>Returns <code>NativeImage</code> - The resized image.</p>\n<p>If only the <code>height</code> or the <code>width</code> are specified then the current aspect ratio will be preserved in the resized image.</p>\n<h4 id=\"imagegetaspectratioscalefactor\"><a href=\"#imagegetaspectratioscalefactor\"><code>image.getAspectRatio([scaleFactor])</code></a></h4>\n<ul>\n<li><code>scaleFactor</code> Double (optional) - Defaults to 1.0.</li>\n</ul>\n<p>Returns <code>Float</code> - The image's aspect ratio.</p>\n<p>If <code>scaleFactor</code> is passed, this will return the aspect ratio corresponding to the image representation most closely matching the passed value.</p>\n<h4 id=\"imagegetscalefactors\"><a href=\"#imagegetscalefactors\"><code>image.getScaleFactors()</code></a></h4>\n<p>Returns <code>Float[]</code> - An array of all scale factors corresponding to representations for a given nativeImage.</p>\n<h4 id=\"imageaddrepresentationoptions\"><a href=\"#imageaddrepresentationoptions\"><code>image.addRepresentation(options)</code></a></h4>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>scaleFactor</code> Double - The scale factor to add the image representation for.</li>\n<li><code>width</code> Integer (optional) - Defaults to 0. Required if a bitmap buffer is specified as <code>buffer</code>.</li>\n<li><code>height</code> Integer (optional) - Defaults to 0. Required if a bitmap buffer is specified as <code>buffer</code>.</li>\n<li><code>buffer</code> Buffer (optional) - The buffer containing the raw image data.</li>\n<li><code>dataURL</code> String (optional) - The data URL containing either a base 64 encoded PNG or JPEG image.</li>\n</ul></li>\n</ul>\n<p>Add an image representation for a specific scale factor. This can be used to explicitly add different scale factor representations to an image. This can be called on empty images.</p>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<h4 id=\"nativeimageismactemplateimage-macos\"><a href=\"#nativeimageismactemplateimage-macos\"><code>nativeImage.isMacTemplateImage</code> <em>macOS</em></a></h4>\n<p>A <code>Boolean</code> property that determines whether the image is considered a <a href=\"https://developer.apple.com/documentation/appkit/nsimage/1520017-template\">template image</a>.</p>\n<p>Please note that this property only has an effect on macOS.</p>",
      "title": "nativeImage",
      "description": "Create tray, dock, and application icons using PNG or JPG files."
    },
    "/docs/api/native-theme": {
      "locale": "de-DE",
      "slug": "native-theme",
      "href": "/docs/api/native-theme",
      "crowdinFileId": "256343",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/native-theme.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"nativetheme\"><a href=\"#nativetheme\">nativeTheme</a></h1>\n<blockquote>\n<p>Read and respond to changes in Chromium's native color theme.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<h2 id=\"ereignisse\"><a href=\"#ereignisse\">Ereignisse</a></h2>\n<p>Das <code>nativeTheme</code> Modul sendet folgende Ereignisse aus:</p>\n<h3 id=\"event-updated\"><a href=\"#event-updated\">Event: 'updated'</a></h3>\n<p>Emitted when something in the underlying NativeTheme has changed. This normally means that either the value of <code>shouldUseDarkColors</code>, <code>shouldUseHighContrastColors</code> or <code>shouldUseInvertedColorScheme</code> has changed. You will have to check them to determine which one has changed.</p>\n<h2 id=\"eigenschaften\"><a href=\"#eigenschaften\">Eigenschaften</a></h2>\n<p>The <code>nativeTheme</code> module has the following properties:</p>\n<h3 id=\"nativethemeshouldusedarkcolors-readonly\"><a href=\"#nativethemeshouldusedarkcolors-readonly\"><code>nativeTheme.shouldUseDarkColors</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> for if the OS / Chromium currently has a dark mode enabled or is being instructed to show a dark-style UI.  If you want to modify this value you should use <code>themeSource</code> below.</p>\n<h3 id=\"nativethemethemesource\"><a href=\"#nativethemethemesource\"><code>nativeTheme.themeSource</code></a></h3>\n<p>A <code>String</code> property that can be <code>system</code>, <code>light</code> or <code>dark</code>.  It is used to override and supersede the value that Chromium has chosen to use internally.</p>\n<p>Setting this property to <code>system</code> will remove the override and everything will be reset to the OS default.  By default <code>themeSource</code> is <code>system</code>.</p>\n<p>Settings this property to <code>dark</code> will have the following effects:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code> will be <code>true</code> when accessed</li>\n<li>Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the dark UI.</li>\n<li>Any UI the OS renders on macOS including menus, window frames, etc. will use the dark UI.</li>\n<li>The <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> CSS query will match <code>dark</code> mode.</li>\n<li>The <code>updated</code> event will be emitted</li>\n</ul>\n<p>Settings this property to <code>light</code> will have the following effects:</p>\n<ul>\n<li><code>nativeTheme.shouldUseDarkColors</code> will be <code>false</code> when accessed</li>\n<li>Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the light UI.</li>\n<li>Any UI the OS renders on macOS including menus, window frames, etc. will use the light UI.</li>\n<li>The <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme\"><code>prefers-color-scheme</code></a> CSS query will match <code>light</code> mode.</li>\n<li>The <code>updated</code> event will be emitted</li>\n</ul>\n<p>The usage of this property should align with a classic \"dark mode\" state machine in your application where the user has three options.</p>\n<ul>\n<li><code>Follow OS</code> --> <code>themeSource = 'system'</code></li>\n<li><code>Dark Mode</code> --> <code>themeSource = 'dark'</code></li>\n<li><code>Light Mode</code> --> <code>themeSource = 'light'</code></li>\n</ul>\n<p>Your application should then always use <code>shouldUseDarkColors</code> to determine what CSS to apply.</p>\n<h3 id=\"nativethemeshouldusehighcontrastcolors-macos-windows-readonly\"><a href=\"#nativethemeshouldusehighcontrastcolors-macos-windows-readonly\"><code>nativeTheme.shouldUseHighContrastColors</code> <em>macOS</em> <em>Windows</em> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> for if the OS / Chromium currently has high-contrast mode enabled or is being instructed to show a high-contrast UI.</p>\n<h3 id=\"nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly\"><a href=\"#nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly\"><code>nativeTheme.shouldUseInvertedColorScheme</code> <em>macOS</em> <em>Windows</em> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> for if the OS / Chromium currently has an inverted color scheme or is being instructed to use an inverted color scheme.</p>",
      "title": "nativeTheme",
      "description": "Read and respond to changes in Chromium's native color theme."
    },
    "/docs/api/net": {
      "locale": "de-DE",
      "slug": "net",
      "href": "/docs/api/net",
      "crowdinFileId": "256347",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/net.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"net\"><a href=\"#net\">net</a></h1>\n<blockquote>\n<p>Issue HTTP/HTTPS requests using Chromium's native networking library</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p>The <code>net</code> module is a client-side API for issuing HTTP(S) requests. It is similar to the <a href=\"https://nodejs.org/api/http.html\">HTTP</a> and <a href=\"https://nodejs.org/api/https.html\">HTTPS</a> modules of Node.js but uses Chromium's native networking library instead of the Node.js implementation, offering better support for web proxies. It also supports checking network status.</p>\n<p>The following is a non-exhaustive list of why you may consider using the <code>net</code> module instead of the native Node.js modules:</p>\n<ul>\n<li>Automatic management of system proxy configuration, support of the wpad protocol and proxy pac configuration files.</li>\n<li>Automatic tunneling of HTTPS requests.</li>\n<li>Support for authenticating proxies using basic, digest, NTLM, Kerberos or negotiate authentication schemes.</li>\n<li>Support for traffic monitoring proxies: Fiddler-like proxies used for access control and monitoring.</li>\n</ul>\n<p>The API components (including classes, methods, properties and event names) are similar to those used in Node.js.</p>\n<p>Example usage:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> { net } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n  <span class=\"hljs-keyword\">const</span> request = net.request(<span class=\"hljs-string\">'https://github.com'</span>)\n  request.on(<span class=\"hljs-string\">'response'</span>, (response) => {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`STATUS: <span class=\"hljs-subst\">${response.statusCode}</span>`</span>)\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`HEADERS: <span class=\"hljs-subst\">${<span class=\"hljs-built_in\">JSON</span>.stringify(response.headers)}</span>`</span>)\n    response.on(<span class=\"hljs-string\">'data'</span>, (chunk) => {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`BODY: <span class=\"hljs-subst\">${chunk}</span>`</span>)\n    })\n    response.on(<span class=\"hljs-string\">'end'</span>, () => {\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'No more data in response.'</span>)\n    })\n  })\n  request.end()\n})\n</code></pre>\n<p>The <code>net</code> API can be used only after the application emits the <code>ready</code> event. Trying to use the module before the <code>ready</code> event will throw an error.</p>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das Modul <code>net</code> besitzt folgende Methoden:</p>\n<h3 id=\"netrequestoptions\"><a href=\"#netrequestoptions\"><code>net.request(options)</code></a></h3>\n<ul>\n<li><code>options</code> (ClientRequestConstructorOptions | String) - The <code>ClientRequest</code> constructor options.</li>\n</ul>\n<p>Returns <a href=\"/docs/api/client-request\"><code>ClientRequest</code></a></p>\n<p>Creates a <a href=\"/docs/api/client-request\"><code>ClientRequest</code></a> instance using the provided <code>options</code> which are directly forwarded to the <code>ClientRequest</code> constructor. The <code>net.request</code> method would be used to issue both secure and insecure HTTP requests according to the specified protocol scheme in the <code>options</code> object.</p>\n<h3 id=\"netisonline\"><a href=\"#netisonline\"><code>net.isOnline()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether there is currently internet connection.</p>\n<p>A return value of <code>false</code> is a pretty strong indicator that the user won't be able to connect to remote sites. However, a return value of <code>true</code> is inconclusive; even if some link is up, it is uncertain whether a particular connection attempt to a particular remote site will be successful.</p>\n<h2 id=\"eigenschaften\"><a href=\"#eigenschaften\">Eigenschaften</a></h2>\n<h3 id=\"netonline-readonly\"><a href=\"#netonline-readonly\"><code>net.online</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> property. Whether there is currently internet connection.</p>\n<p>A return value of <code>false</code> is a pretty strong indicator that the user won't be able to connect to remote sites. However, a return value of <code>true</code> is inconclusive; even if some link is up, it is uncertain whether a particular connection attempt to a particular remote site will be successful.</p>",
      "title": "net",
      "description": "Issue HTTP/HTTPS requests using Chromium's native networking library"
    },
    "/docs/api/net-log": {
      "locale": "de-DE",
      "slug": "net-log",
      "href": "/docs/api/net-log",
      "crowdinFileId": "256345",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/net-log.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"netlog\"><a href=\"#netlog\">netLog</a></h1>\n<blockquote>\n<p>Logging network events for a session.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { netLog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> netLog.startLogging(<span class=\"hljs-string\">'/path/to/net-log'</span>)\n  <span class=\"hljs-comment\">// After some network events</span>\n  <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> netLog.stopLogging()\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Net-logs written to'</span>, path)\n})\n</code></pre>\n<p>See <a href=\"/docs/api/command-line-switches#--log-net-logpath\"><code>--log-net-log</code></a> to log network events throughout the app's lifecycle.</p>\n<p><strong>Note:</strong> All methods unless specified can only be used after the <code>ready</code> event of the <code>app</code> module gets emitted.</p>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<h3 id=\"netlogstartloggingpath-options\"><a href=\"#netlogstartloggingpath-options\"><code>netLog.startLogging(path[, options])</code></a></h3>\n<ul>\n<li><code>path</code> String - Dateipfad zu den Netzwerk Logfiles.</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>captureMode</code> String (optional) - What kinds of data should be captured. By default, only metadata about requests will be captured. Setting this to <code>includeSensitive</code> will include cookies and authentication data. Setting it to <code>everything</code> will include all bytes transferred on sockets. Can be <code>default</code>, <code>includeSensitive</code> or <code>everything</code>.</li>\n<li><code>maxFileSize</code> Number (optional) - When the log grows beyond this size, logging will automatically stop. Defaults to unlimited.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the net log has begun recording.</p>\n<p>Beginnt die Aufzeichnung von Netzwerk Events in <code>path</code>.</p>\n<h3 id=\"netlogstoplogging\"><a href=\"#netlogstoplogging\"><code>netLog.stopLogging()</code></a></h3>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the net log has been flushed to disk.</p>\n<p>Beendet die Aufzeichnung der Netzwerk Events. Wenn nicht aufgerufen, dann beendet net die Aufzeichnung automatisch wenn die App beendet wird.</p>\n<h2 id=\"eigenschaften\"><a href=\"#eigenschaften\">Eigenschaften</a></h2>\n<h3 id=\"netlogcurrentlylogging-readonly\"><a href=\"#netlogcurrentlylogging-readonly\"><code>netLog.currentlyLogging</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> property that indicates whether network logs are currently being recorded.</p>",
      "title": "netLog",
      "description": "Logging network events for a session."
    },
    "/docs/api/structures/new-window-web-contents-event": {
      "locale": "de-DE",
      "slug": "new-window-web-contents-event",
      "href": "/docs/api/structures/new-window-web-contents-event",
      "crowdinFileId": "256469",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/new-window-web-contents-event.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"newwindowwebcontentsevent-object-extends-event\"><a href=\"#newwindowwebcontentsevent-object-extends-event\">NewWindowWebContentsEvent Object extends <code>Event</code></a></h1>\n<ul>\n<li><code>newGuest</code> BrowserWindow (optional)</li>\n</ul>",
      "title": "NewWindowWebContentsEvent Object extends Event",
      "description": ""
    },
    "/docs/api/notification": {
      "locale": "de-DE",
      "slug": "notification",
      "href": "/docs/api/notification",
      "crowdinFileId": "256349",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/notification.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"mitteilung\"><a href=\"#mitteilung\">Mitteilung</a></h1>\n<blockquote>\n<p>Create OS desktop notifications</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<h2 id=\"using-in-the-renderer-process\"><a href=\"#using-in-the-renderer-process\">Using in the renderer process</a></h2>\n<p>If you want to show Notifications from a renderer process you should use the <a href=\"/docs/tutorial/notifications\">HTML5 Notification API</a></p>\n<h2 id=\"class-notification\"><a href=\"#class-notification\">Class: Notification</a></h2>\n<blockquote>\n<p>Create OS desktop notifications</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p><code>Notification</code> ist ein <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p>Es erzeugt ein neues <code>Notification</code> mit nativen Eigenschaften die durch <code>options</code> gesetzt wurden.</p>\n<h3 id=\"static-methods\"><a href=\"#static-methods\">Static Methods</a></h3>\n<p>Die <code>Notification</code> Klasse hat folgende statische Methoden:</p>\n<h4 id=\"notificationissupported\"><a href=\"#notificationissupported\"><code>Notification.isSupported()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether or not desktop notifications are supported on the current system</p>\n<h3 id=\"new-notificationoptions\"><a href=\"#new-notificationoptions\"><code>new Notification([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>title</code> String (optional) - A title for the notification, which will be shown at the top of the notification window when it is shown.</li>\n<li><code>subtitle</code> String (optional) <em>macOS</em> - A subtitle for the notification, which will be displayed below the title.</li>\n<li><code>body</code> String (optional) - The body text of the notification, which will be displayed below the title or subtitle.</li>\n<li><code>silent</code> Boolean (optional) - Whether or not to emit an OS notification noise when showing the notification.</li>\n<li><code>icon</code> (String | <a href=\"/docs/api/native-image\">NativeImage</a>) (optional) - An icon to use in the notification.</li>\n<li><code>hasReply</code> Boolean (optional) <em>macOS</em> - Whether or not to add an inline reply option to the notification.</li>\n<li><code>timeoutType</code> String (optional) <em>Linux</em> <em>Windows</em> - The timeout duration of the notification. Can be 'default' or 'never'.</li>\n<li><code>replyPlaceholder</code> String (optional) <em>macOS</em> - The placeholder to write in the inline reply input field.</li>\n<li><code>sound</code> String (optional) <em>macOS</em> - The name of the sound file to play when the notification is shown.</li>\n<li><code>urgency</code> String (optional) <em>Linux</em> - The urgency level of the notification. Can be 'normal', 'critical', or 'low'.</li>\n<li><code>actions</code> <a href=\"/docs/api/structures/notification-action\">NotificationAction[]</a> (optional) <em>macOS</em> - Actions to add to the notification. Please read the available actions and limitations in the <code>NotificationAction</code> documentation.</li>\n<li><code>closeButtonText</code> String (optional) <em>macOS</em> - A custom title for the close button of an alert. An empty string will cause the default localized text to be used.</li>\n<li><code>toastXml</code> String (optional) <em>Windows</em> - A custom description of the Notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification.</li>\n</ul></li>\n</ul>\n<h3 id=\"instanz-ereignisse\"><a href=\"#instanz-ereignisse\">Instanz-Ereignisse</a></h3>\n<p>Objekte welche mit <code>new Notification</code> erzeugt wurden emitieren folgende Events:</p>\n<p><strong>Hinweis:</strong> Manche Methoden sind nur auf spezifischen Betriebssystemen verfügbar und sind dementsprechend gekennzeichnet.</p>\n<h4 id=\"event-show\"><a href=\"#event-show\">Event: 'show'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the notification is shown to the user, note this could be fired multiple times as a notification can be shown multiple times through the <code>show()</code> method.</p>\n<h4 id=\"ereignis-click\"><a href=\"#ereignis-click\">Ereignis: 'click'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the notification is clicked by the user.</p>\n<h4 id=\"event-close\"><a href=\"#event-close\">Event: 'close'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the notification is closed by manual intervention from the user.</p>\n<p>This event is not guaranteed to be emitted in all cases where the notification is closed.</p>\n<h4 id=\"event-reply-macos\"><a href=\"#event-reply-macos\">Event: 'reply' <em>macOS</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>reply</code> String - The string the user entered into the inline reply field.</li>\n</ul>\n<p>Emitted when the user clicks the \"Reply\" button on a notification with <code>hasReply: true</code>.</p>\n<h4 id=\"event-action-macos\"><a href=\"#event-action-macos\">Event: 'action' <em>macOS</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>index</code> Number - The index of the action that was activated.</li>\n</ul>\n<h4 id=\"event-failed-windows\"><a href=\"#event-failed-windows\">Event: 'failed' <em>Windows</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>error</code> String - The error encountered during execution of the <code>show()</code> method.</li>\n</ul>\n<p>Emitted when an error is encountered while creating and showing the native notification.</p>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<p>Objekte, die mit <code>new Notification</code> erstellt wurden, haben folgende Instanzmethoden:</p>\n<h4 id=\"notificationshow\"><a href=\"#notificationshow\"><code>notification.show()</code></a></h4>\n<p>Immediately shows the notification to the user, please note this means unlike the HTML5 Notification implementation, instantiating a <code>new Notification</code> does not immediately show it to the user, you need to call this method before the OS will display it.</p>\n<p>If the notification has been shown before, this method will dismiss the previously shown notification and create a new one with identical properties.</p>\n<h4 id=\"notificationclose\"><a href=\"#notificationclose\"><code>notification.close()</code></a></h4>\n<p>Dismisses the notification.</p>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<h4 id=\"notificationtitle\"><a href=\"#notificationtitle\"><code>notification.title</code></a></h4>\n<p>A <code>String</code> property representing the title of the notification.</p>\n<h4 id=\"notificationsubtitle\"><a href=\"#notificationsubtitle\"><code>notification.subtitle</code></a></h4>\n<p>A <code>String</code> property representing the subtitle of the notification.</p>\n<h4 id=\"notificationbody\"><a href=\"#notificationbody\"><code>notification.body</code></a></h4>\n<p>A <code>String</code> property representing the body of the notification.</p>\n<h4 id=\"notificationreplyplaceholder\"><a href=\"#notificationreplyplaceholder\"><code>notification.replyPlaceholder</code></a></h4>\n<p>A <code>String</code> property representing the reply placeholder of the notification.</p>\n<h4 id=\"notificationsound\"><a href=\"#notificationsound\"><code>notification.sound</code></a></h4>\n<p>A <code>String</code> property representing the sound of the notification.</p>\n<h4 id=\"notificationclosebuttontext\"><a href=\"#notificationclosebuttontext\"><code>notification.closeButtonText</code></a></h4>\n<p>A <code>String</code> property representing the close button text of the notification.</p>\n<h4 id=\"notificationsilent\"><a href=\"#notificationsilent\"><code>notification.silent</code></a></h4>\n<p>A <code>Boolean</code> property representing whether the notification is silent.</p>\n<h4 id=\"notificationhasreply\"><a href=\"#notificationhasreply\"><code>notification.hasReply</code></a></h4>\n<p>A <code>Boolean</code> property representing whether the notification has a reply action.</p>\n<h4 id=\"notificationurgency-linux\"><a href=\"#notificationurgency-linux\"><code>notification.urgency</code> <em>Linux</em></a></h4>\n<p>A <code>String</code> property representing the urgency level of the notification. Can be 'normal', 'critical', or 'low'.</p>\n<p>Default is 'low' - see <a href=\"https://developer.gnome.org/notification-spec/#urgency-levels\">NotifyUrgency</a> for more information.</p>\n<h4 id=\"notificationtimeouttype-linux-windows\"><a href=\"#notificationtimeouttype-linux-windows\"><code>notification.timeoutType</code> <em>Linux</em> <em>Windows</em></a></h4>\n<p>A <code>String</code> property representing the type of timeout duration for the notification. Can be 'default' or 'never'.</p>\n<p>If <code>timeoutType</code> is set to 'never', the notification never expires. It stays open until closed by the calling API or the user.</p>\n<h4 id=\"notificationactions\"><a href=\"#notificationactions\"><code>notification.actions</code></a></h4>\n<p>A <a href=\"/docs/api/structures/notification-action\"><code>NotificationAction[]</code></a> property representing the actions of the notification.</p>\n<h4 id=\"notificationtoastxml-windows\"><a href=\"#notificationtoastxml-windows\"><code>notification.toastXml</code> <em>Windows</em></a></h4>\n<p>A <code>String</code> property representing the custom Toast XML of the notification.</p>\n<h3 id=\"playing-sounds\"><a href=\"#playing-sounds\">Playing Sounds</a></h3>\n<p>On macOS, you can specify the name of the sound you'd like to play when the notification is shown. Any of the default sounds (under System Preferences > Sound) can be used, in addition to custom sound files. Be sure that the sound file is copied under the app bundle (e.g., <code>YourApp.app/Contents/Resources</code>), or one of the following locations:</p>\n<ul>\n<li><code>~/Library/Sounds</code></li>\n<li><code>/Library/Sounds</code></li>\n<li><code>/Network/Library/Sounds</code></li>\n<li><code>/System/Library/Sounds</code></li>\n</ul>\n<p>See the <a href=\"https://developer.apple.com/documentation/appkit/nssound\"><code>NSSound</code></a> docs for more information.</p>",
      "title": "Mitteilung",
      "description": "Create OS desktop notifications"
    },
    "/docs/api/structures/notification-action": {
      "locale": "de-DE",
      "slug": "notification-action",
      "href": "/docs/api/structures/notification-action",
      "crowdinFileId": "256471",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/notification-action.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificationaction-object\"><a href=\"#notificationaction-object\">NotificationAction Object</a></h1>\n<ul>\n<li><code>type</code> String - The type of action, can be <code>button</code>.</li>\n<li><code>text</code> String (optional) - The label for the given action.</li>\n</ul>\n<h2 id=\"platform--action-support\"><a href=\"#platform--action-support\">Platform / Action Support</a></h2>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<table><thead><tr><th>Action Type</th><th>Platform Support</th><th>Usage of <code>text</code></th><th>Default <code>text</code></th><th>Limitations</th></tr></thead><tbody><tr><td><code>button</code></td><td>macOS</td><td>Used as the label for the button</td><td>\"Show\" (or a localized string by system default if first of such <code>button</code>, otherwise empty)</td><td>Only the first one is used. If multiple are provided, those beyond the first will be listed as additional actions (displayed when mouse active over the action button). Any such action also is incompatible with <code>hasReply</code> and will be ignored if <code>hasReply</code> is <code>true</code>.</td></tr></tbody></table>\n<h3 id=\"button-support-on-macos\"><a href=\"#button-support-on-macos\">Button support on macOS</a></h3>\n<p>In order for extra notification buttons to work on macOS your app must meet the following criteria.</p>\n<ul>\n<li>App is signed</li>\n<li>App has it's <code>NSUserNotificationAlertStyle</code> set to <code>alert</code> in the <code>Info.plist</code>.</li>\n</ul>\n<p>If either of these requirements are not met the button won't appear.</p>",
      "title": "NotificationAction Object",
      "description": ""
    },
    "/docs/api/structures/notification-response": {
      "locale": "de-DE",
      "slug": "notification-response",
      "href": "/docs/api/structures/notification-response",
      "crowdinFileId": "256473",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/notification-response.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"notificationresponse-object\"><a href=\"#notificationresponse-object\">NotificationResponse Object</a></h1>\n<ul>\n<li><code>actionIdentifier</code> String - The identifier string of the action that the user selected.</li>\n<li><code>date</code> Number - The delivery date of the notification.</li>\n<li><code>identifier</code> String - The unique identifier for this notification request.</li>\n<li><code>userInfo</code> Record&#x3C;String, any> - A dictionary of custom information associated with the notification.</li>\n<li><code>userText</code> String (optional) - The text entered or chosen by the user.</li>\n</ul>",
      "title": "NotificationResponse Object",
      "description": ""
    },
    "/docs/tutorial/notifications": {
      "locale": "de-DE",
      "slug": "notifications",
      "href": "/docs/tutorial/notifications",
      "crowdinFileId": "256225",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/notifications.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"benachrichtigungen\"><a href=\"#benachrichtigungen\">Benachrichtigungen</a></h1>\n<h2 id=\"übersicht\"><a href=\"#übersicht\">Übersicht</a></h2>\n<p>All three operating systems provide means for applications to send notifications to the user. The technique of showing notifications is different for the Main and Renderer processes.</p>\n<p>For the Renderer process, Electron conveniently allows developers to send notifications with the <a href=\"https://notifications.spec.whatwg.org/\">HTML5 Notification API</a>, using the currently running operating system's native notification APIs to display it.</p>\n<p>To show notifications in the Main process, you need to use the <a href=\"/docs/api/notification\">Notification</a> module.</p>\n<h2 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h2>\n<h3 id=\"show-notifications-in-the-renderer-process\"><a href=\"#show-notifications-in-the-renderer-process\">Show notifications in the Renderer process</a></h3>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, add the following line to the <code>index.html</code> file before the closing <code>&#x3C;/body></code> tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<p>...and add the <code>renderer.js</code> file:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/notifications/renderer\"><span class=\"hljs-keyword\">const</span> NOTIFICATION_TITLE = <span class=\"hljs-string\">'Title'</span>\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_BODY = <span class=\"hljs-string\">'Notification from the Renderer process. Click to log to console.'</span>\n<span class=\"hljs-keyword\">const</span> CLICK_MESSAGE = <span class=\"hljs-string\">'Notification clicked'</span>\n\n<span class=\"hljs-keyword\">new</span> Notification(NOTIFICATION_TITLE, { <span class=\"hljs-attr\">body</span>: NOTIFICATION_BODY })\n  .onclick = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> <span class=\"hljs-built_in\">console</span>.log(CLICK_MESSAGE)\n</code></pre>\n<p>After launching the Electron application, you should see the notification:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/notification-renderer.png\" alt=\"Notification in the Renderer process\"></p>\n<p>Additionally, if you click on the notification, the DOM will update to show \"Notification clicked!\".</p>\n<h3 id=\"show-notifications-in-the-main-process\"><a href=\"#show-notifications-in-the-main-process\">Show notifications in the Main process</a></h3>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/notifications/main\"><span class=\"hljs-keyword\">const</span> { Notification } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_TITLE = <span class=\"hljs-string\">'Basic Notification'</span>\n<span class=\"hljs-keyword\">const</span> NOTIFICATION_BODY = <span class=\"hljs-string\">'Notification from the Main process'</span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">showNotification</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">new</span> Notification({ <span class=\"hljs-attr\">title</span>: NOTIFICATION_TITLE, <span class=\"hljs-attr\">body</span>: NOTIFICATION_BODY }).show()\n}\n\napp.whenReady().then(createWindow).then(showNotification)\n</code></pre>\n<p>After launching the Electron application, you should see the system notification:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/notification-main.png\" alt=\"Notification in the Main process\"></p>\n<h2 id=\"additional-information\"><a href=\"#additional-information\">Additional information</a></h2>\n<p>Während Code und Benutzererfahrung innerhalb der Betriebssysteme ähnlich sind, gibt es leichte Unterschiede.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<ul>\n<li>On Windows 10, a shortcut to your app with an <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Application User Model ID</a> must be installed to the Start Menu. This can be overkill during development, so adding <code>node_modules\\electron\\dist\\electron.exe</code> to your Start Menu also does the trick. Navigate to the file in Explorer, right-click and 'Pin to Start Menu'. You will then need to add the line <code>app.setAppUserModelId(process.execPath)</code> to your main process to see notifications.</li>\n<li>Unter Windows 8.1 und Windows 8 muss eine Verknüpfung zu Ihrer App mit einer <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx\">Anwendungsbenutzer Model ID</a> auf dem Startbildschirm installiert sein. Note, however, that it does not need to be pinned to the Start screen.</li>\n<li>On Windows 7, notifications work via a custom implementation which visually resembles the native one on newer systems.</li>\n</ul>\n<p>Electron attempts to automate the work around the Application User Model ID. When Electron is used together with the installation and update framework Squirrel, <a href=\"https://github.com/electron/windows-installer/blob/master/README.md#handling-squirrel-events\">shortcuts will automatically be set correctly</a>. Furthermore, Electron will detect that Squirrel was used and will automatically call <code>app.setAppUserModelId()</code> with the correct value. During development, you may have to call <a href=\"/docs/api/app#appsetappusermodelidid-windows\"><code>app.setAppUserModelId()</code></a> yourself.</p>\n<p>Furthermore, in Windows 8, the maximum length for the notification body is 250 characters, with the Windows team recommending that notifications should be kept to 200 characters. That said, that limitation has been removed in Windows 10, with the Windows team asking developers to be reasonable. Attempting to send gigantic amounts of text to the API (thousands of characters) might result in instability.</p>\n<h4 id=\"advanced-notifications\"><a href=\"#advanced-notifications\">Advanced Notifications</a></h4>\n<p>Later versions of Windows allow for advanced notifications, with custom templates, images, and other flexible elements. To send those notifications (from either the main process or the renderer process), use the userland module <a href=\"https://github.com/felixrieseberg/electron-windows-notifications\">electron-windows-notifications</a>, which uses native Node addons to send <code>ToastNotification</code> and <code>TileNotification</code> objects.</p>\n<p>While notifications including buttons work with <code>electron-windows-notifications</code>, handling replies requires the use of <a href=\"https://github.com/felixrieseberg/electron-windows-interactive-notifications\"><code>electron-windows-interactive-notifications</code></a>, which helps with registering the required COM components and calling your Electron app with the entered user data.</p>\n<h4 id=\"quiet-hours--presentation-mode\"><a href=\"#quiet-hours--presentation-mode\">Quiet Hours / Presentation Mode</a></h4>\n<p>To detect whether or not you're allowed to send a notification, use the userland module <a href=\"https://github.com/felixrieseberg/electron-notification-state\">electron-notification-state</a>.</p>\n<p>This allows you to determine ahead of time whether or not Windows will silently throw the notification away.</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>Notifications are straight-forward on macOS, but you should be aware of <a href=\"https://developer.apple.com/macos/human-interface-guidelines/system-capabilities/notifications/\">Apple's Human Interface guidelines regarding notifications</a>.</p>\n<p>Note that notifications are limited to 256 bytes in size and will be truncated if you exceed that limit.</p>\n<h4 id=\"do-not-disturb--session-state\"><a href=\"#do-not-disturb--session-state\">Do not disturb / Session State</a></h4>\n<p>To detect whether or not you're allowed to send a notification, use the userland module <a href=\"https://github.com/felixrieseberg/electron-notification-state\">electron-notification-state</a>.</p>\n<p>This will allow you to detect ahead of time whether or not the notification will be displayed.</p>\n<h3 id=\"linux\"><a href=\"#linux\">Linux</a></h3>\n<p>Notifications are sent using <code>libnotify</code> which can show notifications on any desktop environment that follows <a href=\"https://developer.gnome.org/notification-spec/\">Desktop Notifications Specification</a>, including Cinnamon, Enlightenment, Unity, GNOME, KDE.</p>",
      "title": "Benachrichtigungen",
      "description": ""
    },
    "/docs/tutorial/offscreen-rendering": {
      "locale": "de-DE",
      "slug": "offscreen-rendering",
      "href": "/docs/tutorial/offscreen-rendering",
      "crowdinFileId": "256227",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/offscreen-rendering.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"offscreen-rendering\"><a href=\"#offscreen-rendering\">Offscreen Rendering</a></h1>\n<h2 id=\"übersicht\"><a href=\"#übersicht\">Übersicht</a></h2>\n<p>Offscreen rendering lets you obtain the content of a <code>BrowserWindow</code> in a bitmap, so it can be rendered anywhere, for example, on texture in a 3D scene. The offscreen rendering in Electron uses a similar approach to that of the <a href=\"https://bitbucket.org/chromiumembedded/cef\">Chromium Embedded Framework</a> project.</p>\n<p><em>Notes</em>:</p>\n<ul>\n<li>There are two rendering modes that can be used (see the section below) and only the dirty area is passed to the <code>paint</code> event to be more efficient.</li>\n<li>You can stop/continue the rendering as well as set the frame rate.</li>\n<li>The maximum frame rate is 240 because greater values bring only performance losses with no benefits.</li>\n<li>When nothing is happening on a webpage, no frames are generated.</li>\n<li>An offscreen window is always created as a <a href=\"/docs/api/frameless-window\">Frameless Window</a>.</li>\n</ul>\n<h3 id=\"render-modi\"><a href=\"#render-modi\">Render Modi</a></h3>\n<h4 id=\"gpu-beschleunigung\"><a href=\"#gpu-beschleunigung\">GPU Beschleunigung</a></h4>\n<p>GPU beschleunigtes Rendering bedeutet, dass der Grafikprozessor für die Bildgenerierung verwendet wird. Because of that, the frame has to be copied from the GPU which requires more resources, thus this mode is slower than the Software output device. The benefit of this mode is that WebGL and 3D CSS animations are supported.</p>\n<h4 id=\"software-ausgabegerät\"><a href=\"#software-ausgabegerät\">Software Ausgabegerät</a></h4>\n<p>This mode uses a software output device for rendering in the CPU, so the frame generation is much faster. As a result, this mode is preferred over the GPU accelerated one.</p>\n<p>To enable this mode, GPU acceleration has to be disabled by calling the <a href=\"/docs/api/app#appdisablehardwareacceleration\"><code>app.disableHardwareAcceleration()</code></a> API.</p>\n<h2 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h2>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/offscreen-rendering\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\napp.disableHardwareAcceleration()\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">offscreen</span>: <span class=\"hljs-literal\">true</span> } })\n\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  win.webContents.on(<span class=\"hljs-string\">'paint'</span>, (event, dirty, image) => {\n    fs.writeFileSync(<span class=\"hljs-string\">'ex.png'</span>, image.toPNG())\n  })\n  win.webContents.setFrameRate(<span class=\"hljs-number\">60</span>)\n})\n</code></pre>\n<p>After launching the Electron application, navigate to your application's working folder, where you'll find the rendered image.</p>",
      "title": "Offscreen Rendering",
      "description": ""
    },
    "/docs/tutorial/online-offline-events": {
      "locale": "de-DE",
      "slug": "online-offline-events",
      "href": "/docs/tutorial/online-offline-events",
      "crowdinFileId": "256229",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/online-offline-events.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"onlineoffline-ereigniserkennung\"><a href=\"#onlineoffline-ereigniserkennung\">Online/Offline Ereigniserkennung</a></h1>\n<h2 id=\"übersicht\"><a href=\"#übersicht\">Übersicht</a></h2>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Online_and_offline_events\">Online and offline event</a> detection can be implemented in the Renderer process using the <a href=\"http://html5index.org/Offline%20-%20NavigatorOnLine.html\"><code>navigator.onLine</code></a> attribute, part of standard HTML5 API.</p>\n<p>The <code>navigator.onLine</code> attribute returns:</p>\n<ul>\n<li><code>false</code> if all network requests are guaranteed to fail (e.g. when disconnected from the network).</li>\n<li><code>true</code> in all other cases.</li>\n</ul>\n<p>Since many cases return <code>true</code>, you should treat with care situations of getting false positives, as we cannot always assume that <code>true</code> value means that Electron can access the Internet. For example, in cases when the computer is running a virtualization software that has virtual Ethernet adapters in \"always connected\" state. Therefore, if you want to determine the Internet access status of Electron, you should develop additional means for this check.</p>\n<h2 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h2>\n<p>Starting with an HTML file <code>index.html</code>, this example will demonstrate how the <code>navigator.onLine</code> API can be used to build a connection status indicator.</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"script-src 'self' 'unsafe-inline';\"</span> /></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Connection status: <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">strong</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">'status'</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">strong</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>In order to mutate the DOM, create a <code>renderer.js</code> file that adds event listeners to the <code>'online'</code> and <code>'offline'</code> <code>window</code> events. The event handler sets the content of the <code>&#x3C;strong id='status'></code> element depending on the result of <code>navigator.onLine</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">updateOnlineStatus</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'status'</span>).innerHTML = navigator.onLine ? <span class=\"hljs-string\">'online'</span> : <span class=\"hljs-string\">'offline'</span>\n}\n\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'online'</span>, updateOnlineStatus)\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'offline'</span>, updateOnlineStatus)\n\nupdateOnlineStatus()\n</code></pre>\n<p>Finally, create a <code>main.js</code> file for main process that creates the window.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> onlineStatusWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">400</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">100</span>\n  })\n\n  onlineStatusWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, () => {\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n      createWindow()\n    }\n  })\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n</code></pre>\n<p>After launching the Electron application, you should see the notification:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/connection-status.png\" alt=\"Connection status\"></p>\n<blockquote>\n<p>Note: If you need to communicate the connection status to the main process, use the <a href=\"/docs/api/ipc-renderer\">IPC renderer</a> API.</p>\n</blockquote>",
      "title": "Online/Offline Ereigniserkennung",
      "description": "Note: If you need to communicate the connection status to the main process, use the IPC renderer API."
    },
    "/docs/development/patches": {
      "locale": "de-DE",
      "slug": "patches",
      "href": "/docs/development/patches",
      "crowdinFileId": "256161",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/patches.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"patches-in-electron\"><a href=\"#patches-in-electron\">Patches in Electron</a></h1>\n<p>Electron is built on two major upstream projects: Chromium and Node.js. Each of these projects has several of their own dependencies, too. We try our best to use these dependencies exactly as they are but sometimes we can't achieve our goals without patching those upstream dependencies to fit our use cases.</p>\n<h2 id=\"patch-justification\"><a href=\"#patch-justification\">Patch justification</a></h2>\n<p>Every patch in Electron is a maintenance burden. When upstream code changes, patches can break—sometimes without even a patch conflict or a compilation error. It's an ongoing effort to keep our patch set up-to-date and effective. So we strive to keep our patch count at a minimum. To that end, every patch must describe its reason for existence in its commit message. That reason must be one of the following:</p>\n<ol>\n<li>The patch is temporary, and is intended to be (or has been) committed upstream or otherwise eventually removed. Include a link to an upstream PR or code review if available, or a procedure for verifying whether the patch is still needed at a later date.</li>\n<li>The patch allows the code to compile in the Electron environment, but cannot be upstreamed because it's Electron-specific (e.g. patching out references to Chrome's <code>Profile</code>). Include reasoning about why the change cannot be implemented without a patch (e.g. by subclassing or copying the code).</li>\n<li>The patch makes Electron-specific changes in functionality which are fundamentally incompatible with upstream.</li>\n</ol>\n<p>In general, all the upstream projects we work with are friendly folks and are often happy to accept refactorings that allow the code in question to be compatible with both Electron and the upstream project. (See e.g. <a href=\"https://chromium-review.googlesource.com/c/chromium/src/+/1637040\">this</a> change in Chromium, which allowed us to remove a patch that did the same thing, or <a href=\"https://github.com/nodejs/node/pull/22110\">this</a> change in Node, which was a no-op for Node but fixed a bug in Electron.) <strong>We should aim to upstream changes whenever we can, and avoid indefinite-lifetime patches</strong>.</p>\n<h2 id=\"patch-system\"><a href=\"#patch-system\">Patch system</a></h2>\n<p>If you find yourself in the unfortunate position of having to make a change which can only be made through patching an upstream project, you'll need to know how to manage patches in Electron.</p>\n<p>All patches to upstream projects in Electron are contained in the <code>patches/</code> directory. Each subdirectory of <code>patches/</code> contains several patch files, along with a <code>.patches</code> file which lists the order in which the patches should be applied. Think of these files as making up a series of git commits that are applied on top of the upstream project after we check it out.</p>\n<pre><code class=\"hljs language-plaintext\">patches\n├── config.json   &#x3C;-- this describes which patchset directory is applied to what project\n├── chromium\n│   ├── .patches\n│   ├── accelerator.patch\n│   ├── add_contentgpuclient_precreatemessageloop_callback.patch\n│   ⋮\n├── node\n│   ├── .patches\n│   ├── add_openssl_is_boringssl_guard_to_oaep_hash_check.patch\n│   ├── build_add_gn_build_files.patch\n│   ⋮\n⋮\n</code></pre>\n<p>To help manage these patch sets, we provide two tools: <code>git-import-patches</code> and <code>git-export-patches</code>. <code>git-import-patches</code> imports a set of patch files into a git repository by applying each patch in the correct order and creating a commit for each one. <code>git-export-patches</code> does the reverse; it exports a series of git commits in a repository into a set of files in a directory and an accompanying <code>.patches</code> file.</p>\n<blockquote>\n<p>Side note: the reason we use a <code>.patches</code> file to maintain the order of applied patches, rather than prepending a number like <code>001-</code> to each file, is because it reduces conflicts related to patch ordering. It prevents the situation where two PRs both add a patch at the end of the series with the same numbering and end up both getting merged resulting in a duplicate identifier, and it also reduces churn when a patch is added or deleted in the middle of the series.</p>\n</blockquote>\n<h3 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h3>\n<h4 id=\"adding-a-new-patch\"><a href=\"#adding-a-new-patch\">Adding a new patch</a></h4>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n$ vim some/code/file.cc\n$ git commit\n$ ../../electron/script/git-export-patches -o ../../electron/patches/node\n</code></pre>\n<blockquote>\n<p><strong>NOTE</strong>: <code>git-export-patches</code> ignores any uncommitted files, so you must create a commit if you want your changes to be exported. The subject line of the commit message will be used to derive the patch file name, and the body of the commit message should include the reason for the patch's existence.</p>\n</blockquote>\n<p>Re-exporting patches will sometimes cause shasums in unrelated patches to change. This is generally harmless and can be ignored (but go ahead and add those changes to your PR, it'll stop them from showing up for other people).</p>\n<h4 id=\"editing-an-existing-patch\"><a href=\"#editing-an-existing-patch\">Editing an existing patch</a></h4>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/v8\n$ vim some/code/file.cc\n$ git <span class=\"hljs-built_in\">log</span>\n<span class=\"hljs-comment\"># Find the commit sha of the patch you want to edit.</span>\n$ git commit --fixup [COMMIT_SHA]\n$ git rebase --autosquash -i [COMMIT_SHA]^\n$ ../electron/script/git-export-patches -o ../electron/patches/v8\n</code></pre>\n<h4 id=\"removing-a-patch\"><a href=\"#removing-a-patch\">Removing a patch</a></h4>\n<pre><code class=\"hljs language-bash\">$ vim src/electron/patches/node/.patches\n<span class=\"hljs-comment\"># Delete the line with the name of the patch you want to remove</span>\n$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n$ git reset --hard refs/patches/upstream-head\n$ ../../electron/script/git-import-patches ../../electron/patches/node\n$ ../../electron/script/git-export-patches -o ../../electron/patches/node\n</code></pre>\n<p>Note that <code>git-import-patches</code> will mark the commit that was <code>HEAD</code> when it was run as <code>refs/patches/upstream-head</code>. This lets you keep track of which commits are from Electron patches (those that come after <code>refs/patches/upstream-head</code>) and which commits are in upstream (those before <code>refs/patches/upstream-head</code>).</p>\n<h4 id=\"konflikte-beheben\"><a href=\"#konflikte-beheben\">Konflikte beheben</a></h4>\n<p>When updating an upstream dependency, patches may fail to apply cleanly. Often, the conflict can be resolved automatically by git with a 3-way merge. You can instruct <code>git-import-patches</code> to use the 3-way merge algorithm by passing the <code>-3</code> argument:</p>\n<pre><code class=\"hljs language-bash\">$ <span class=\"hljs-built_in\">cd</span> src/third_party/electron_node\n<span class=\"hljs-comment\"># If the patch application failed midway through, you can reset it with:</span>\n$ git am --abort\n<span class=\"hljs-comment\"># And then retry with 3-way merge:</span>\n$ ../../electron/script/git-import-patches -3 ../../electron/patches/node\n</code></pre>\n<p>If <code>git-import-patches -3</code> encounters a merge conflict that it can't resolve automatically, it will pause and allow you to resolve the conflict manually. Once you have resolved the conflict, <code>git add</code> the resolved files and continue to apply the rest of the patches by running <code>git am --continue</code>.</p>",
      "title": "Patches in Electron",
      "description": "Side note: the reason we use a .patches file to maintain the order of applied patches, rather than prepending a number like 001- to each file, is because it reduces conflicts related to patch ordering. It prevents the situation where two PRs both add a patch at the end of the series with the same numbering and end up both getting merged resulting in a duplicate identifier, and it also reduces churn when a patch is added or deleted in the middle of the series."
    },
    "/docs/tutorial/performance": {
      "locale": "de-DE",
      "slug": "performance",
      "href": "/docs/tutorial/performance",
      "crowdinFileId": "256231",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/performance.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"performance\"><a href=\"#performance\">Performance</a></h1>\n<p>Developers frequently ask about strategies to optimize the performance of Electron applications. Software engineers, consumers, and framework developers do not always agree on one single definition of what \"performance\" means. This document outlines some of the Electron maintainers' favorite ways to reduce the amount of memory, CPU, and disk resources being used while ensuring that your app is responsive to user input and completes operations as quickly as possible. Furthermore, we want all performance strategies to maintain a high standard for your app's security.</p>\n<p>Wisdom and information about how to build performant websites with JavaScript generally applies to Electron apps, too. To a certain extent, resources discussing how to build performant Node.js applications also apply, but be careful to understand that the term \"performance\" means different things for a Node.js backend than it does for an application running on a client.</p>\n<p>This list is provided for your convenience – and is, much like our <a href=\"/docs/tutorial/security\">security checklist</a> – not meant to exhaustive. It is probably possible to build a slow Electron app that follows all the steps outlined below. Electron is a powerful development platform that enables you, the developer, to do more or less whatever you want. All that freedom means that performance is largely your responsibility.</p>\n<h2 id=\"measure-measure-measure\"><a href=\"#measure-measure-measure\">Measure, Measure, Measure</a></h2>\n<p>The list below contains a number of steps that are fairly straightforward and easy to implement. However, building the most performant version of your app will require you to go beyond a number of steps. Instead, you will have to closely examine all the code running in your app by carefully profiling and measuring. Where are the bottlenecks? When the user clicks a button, what operations take up the brunt of the time? While the app is simply idling, which objects take up the most memory?</p>\n<p>Time and time again, we have seen that the most successful strategy for building a performant Electron app is to profile the running code, find the most resource-hungry piece of it, and to optimize it. Repeating this seemingly laborious process over and over again will dramatically increase your app's performance. Experience from working with major apps like Visual Studio Code or Slack has shown that this practice is by far the most reliable strategy to improve performance.</p>\n<p>To learn more about how to profile your app's code, familiarize yourself with the Chrome Developer Tools. For advanced analysis looking at multiple processes at once, consider the <a href=\"https://www.chromium.org/developers/how-tos/trace-event-profiling-tool\">Chrome Tracing</a> tool.</p>\n<h3 id=\"recommended-reading\"><a href=\"#recommended-reading\">Recommended Reading</a></h3>\n<ul>\n<li><a href=\"https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/\">Get Started With Analyzing Runtime Performance</a></li>\n<li><a href=\"https://www.youtube.com/watch?v=r0OeHRUCCb4\">Talk: \"Visual Studio Code - The First Second\"</a></li>\n</ul>\n<h2 id=\"checklist\"><a href=\"#checklist\">Checklist</a></h2>\n<p>Chances are that your app could be a little leaner, faster, and generally less resource-hungry if you attempt these steps.</p>\n<ol>\n<li><a href=\"#1-carelessly-including-modules\">Carelessly including modules</a></li>\n<li><a href=\"#2-loading-and-running-code-too-soon\">Loading and running code too soon</a></li>\n<li><a href=\"#3-blocking-the-main-process\">Blocking the main process</a></li>\n<li><a href=\"#4-blocking-the-renderer-process\">Blocking the renderer process</a></li>\n<li><a href=\"#5-unnecessary-polyfills\">Unnecessary polyfills</a></li>\n<li><a href=\"#6-unnecessary-or-blocking-network-requests\">Unnecessary or blocking network requests</a></li>\n<li><a href=\"#7-bundle-your-code\">Bundle your code</a></li>\n</ol>\n<h2 id=\"1-carelessly-including-modules\"><a href=\"#1-carelessly-including-modules\">1) Carelessly including modules</a></h2>\n<p>Before adding a Node.js module to your application, examine said module. How many dependencies does that module include? What kind of resources does it need to simply be called in a <code>require()</code> statement? You might find that the module with the most downloads on the NPM package registry or the most stars on GitHub is not in fact the leanest or smallest one available.</p>\n<h3 id=\"why\"><a href=\"#why\">Why?</a></h3>\n<p>The reasoning behind this recommendation is best illustrated with a real-world example. During the early days of Electron, reliable detection of network connectivity was a problem, resulting many apps to use a module that exposed a simple <code>isOnline()</code> method.</p>\n<p>That module detected your network connectivity by attempting to reach out to a number of well-known endpoints. For the list of those endpoints, it depended on a different module, which also contained a list of well-known ports. This dependency itself relied on a module containing information about ports, which came in the form of a JSON file with more than 100,000 lines of content. Whenever the module was loaded (usually in a <code>require('module')</code> statement), it would load all its dependencies and eventually read and parse this JSON file. Parsing many thousands lines of JSON is a very expensive operation. On a slow machine it can take up whole seconds of time.</p>\n<p>In many server contexts, startup time is virtually irrelevant. A Node.js server that requires information about all ports is likely actually \"more performant\" if it loads all required information into memory whenever the server boots at the benefit of serving requests faster. The module discussed in this example is not a \"bad\" module. Electron apps, however, should not be loading, parsing, and storing in memory information that it does not actually need.</p>\n<p>In short, a seemingly excellent module written primarily for Node.js servers running Linux might be bad news for your app's performance. In this particular example, the correct solution was to use no module at all, and to instead use connectivity checks included in later versions of Chromium.</p>\n<h3 id=\"how\"><a href=\"#how\">How?</a></h3>\n<p>When considering a module, we recommend that you check:</p>\n<ol>\n<li>the size of dependencies included</li>\n<li>the resources required to load (<code>require()</code>) it</li>\n<li>the resources required to perform the action you're interested in</li>\n</ol>\n<p>Generating a CPU profile and a heap memory profile for loading a module can be done with a single command on the command line. In the example below, we're looking at the popular module <code>request</code>.</p>\n<pre><code class=\"hljs language-sh\">node --cpu-prof --heap-prof -e <span class=\"hljs-string\">\"require('request')\"</span>\n</code></pre>\n<p>Executing this command results in a <code>.cpuprofile</code> file and a <code>.heapprofile</code> file in the directory you executed it in. Both files can be analyzed using the Chrome Developer Tools, using the <code>Performance</code> and <code>Memory</code> tabs respectively.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/performance-cpu-prof.png\" alt=\"Performance CPU Profile\"></p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/performance-heap-prof.png\" alt=\"Performance Heap Memory Profile\"></p>\n<p>In this example, on the author's machine, we saw that loading <code>request</code> took almost half a second, whereas <code>node-fetch</code> took dramatically less memory and less than 50ms.</p>\n<h2 id=\"2-loading-and-running-code-too-soon\"><a href=\"#2-loading-and-running-code-too-soon\">2) Loading and running code too soon</a></h2>\n<p>If you have expensive setup operations, consider deferring those. Inspect all the work being executed right after the application starts. Instead of firing off all operations right away, consider staggering them in a sequence more closely aligned with the user's journey.</p>\n<p>In traditional Node.js development, we're used to putting all our <code>require()</code> statements at the top. If you're currently writing your Electron application using the same strategy <em>and</em> are using sizable modules that you do not immediately need, apply the same strategy and defer loading to a more opportune time.</p>\n<h3 id=\"why-1\"><a href=\"#why-1\">Why?</a></h3>\n<p>Loading modules is a surprisingly expensive operation, especially on Windows. When your app starts, it should not make users wait for operations that are currently not necessary.</p>\n<p>This might seem obvious, but many applications tend to do a large amount of work immediately after the app has launched - like checking for updates, downloading content used in a later flow, or performing heavy disk I/O operations.</p>\n<p>Let's consider Visual Studio Code as an example. When you open a file, it will immediately display the file to you without any code highlighting, prioritizing your ability to interact with the text. Once it has done that work, it will move on to code highlighting.</p>\n<h3 id=\"how-1\"><a href=\"#how-1\">How?</a></h3>\n<p>Let's consider an example and assume that your application is parsing files in the fictitious <code>.foo</code> format. In order to do that, it relies on the equally fictitious <code>foo-parser</code> module. In traditional Node.js development, you might write code that eagerly loads dependencies:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> fooParser = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'foo-parser'</span>)\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">Parser</span> </span>{\n  <span class=\"hljs-keyword\">constructor</span> () {\n    <span class=\"hljs-keyword\">this</span>.files = fs.readdirSync(<span class=\"hljs-string\">'.'</span>)\n  }\n\n  getParsedFiles () {\n    <span class=\"hljs-keyword\">return</span> fooParser.parse(<span class=\"hljs-keyword\">this</span>.files)\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> parser = <span class=\"hljs-keyword\">new</span> Parser()\n\n<span class=\"hljs-built_in\">module</span>.exports = { parser }\n</code></pre>\n<p>In the above example, we're doing a lot of work that's being executed as soon as the file is loaded. Do we need to get parsed files right away? Could we do this work a little later, when <code>getParsedFiles()</code> is actually called?</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// \"fs\" is likely already being loaded, so the `require()` call is cheap</span>\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class</span> <span class=\"hljs-title\">Parser</span> </span>{\n  <span class=\"hljs-keyword\">async</span> getFiles () {\n    <span class=\"hljs-comment\">// Touch the disk as soon as `getFiles` is called, not sooner.</span>\n    <span class=\"hljs-comment\">// Also, ensure that we're not blocking other operations by using</span>\n    <span class=\"hljs-comment\">// the asynchronous version.</span>\n    <span class=\"hljs-keyword\">this</span>.files = <span class=\"hljs-keyword\">this</span>.files || <span class=\"hljs-keyword\">await</span> fs.readdir(<span class=\"hljs-string\">'.'</span>)\n\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-keyword\">this</span>.files\n  }\n\n  <span class=\"hljs-keyword\">async</span> getParsedFiles () {\n    <span class=\"hljs-comment\">// Our fictitious foo-parser is a big and expensive module to load, so</span>\n    <span class=\"hljs-comment\">// defer that work until we actually need to parse files.</span>\n    <span class=\"hljs-comment\">// Since `require()` comes with a module cache, the `require()` call</span>\n    <span class=\"hljs-comment\">// will only be expensive once - subsequent calls of `getParsedFiles()`</span>\n    <span class=\"hljs-comment\">// will be faster.</span>\n    <span class=\"hljs-keyword\">const</span> fooParser = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'foo-parser'</span>)\n    <span class=\"hljs-keyword\">const</span> files = <span class=\"hljs-keyword\">await</span> <span class=\"hljs-keyword\">this</span>.getFiles()\n\n    <span class=\"hljs-keyword\">return</span> fooParser.parse(files)\n  }\n}\n\n<span class=\"hljs-comment\">// This operation is now a lot cheaper than in our previous example</span>\n<span class=\"hljs-keyword\">const</span> parser = <span class=\"hljs-keyword\">new</span> Parser()\n\n<span class=\"hljs-built_in\">module</span>.exports = { parser }\n</code></pre>\n<p>In short, allocate resources \"just in time\" rather than allocating them all when your app starts.</p>\n<h2 id=\"3-blocking-the-main-process\"><a href=\"#3-blocking-the-main-process\">3) Blocking the main process</a></h2>\n<p>Electron's main process (sometimes called \"browser process\") is special: It is the parent process to all your app's other processes and the primary process the operating system interacts with. It handles windows, interactions, and the communication between various components inside your app. It also houses the UI thread.</p>\n<p>Under no circumstances should you block this process and the UI thread with long-running operations. Blocking the UI thread means that your entire app will freeze until the main process is ready to continue processing.</p>\n<h3 id=\"why-2\"><a href=\"#why-2\">Why?</a></h3>\n<p>The main process and its UI thread are essentially the control tower for major operations inside your app. When the operating system tells your app about a mouse click, it'll go through the main process before it reaches your window. If your window is rendering a buttery-smooth animation, it'll need to talk to the GPU process about that – once again going through the main process.</p>\n<p>Electron and Chromium are careful to put heavy disk I/O and CPU-bound operations onto new threads to avoid blocking the UI thread. You should do the same.</p>\n<h3 id=\"how-2\"><a href=\"#how-2\">How?</a></h3>\n<p>Electron's powerful multi-process architecture stands ready to assist you with your long-running tasks, but also includes a small number of performance traps.</p>\n<p>1) For long running CPU-heavy tasks, make use of <a href=\"https://nodejs.org/api/worker_threads.html\">worker threads</a>, consider moving them to the BrowserWindow, or (as a last resort) spawn a dedicated process.</p>\n<p>2) Avoid using the synchronous IPC and the <code>remote</code> module as much as possible. While there are legitimate use cases, it is far too easy to unknowingly block the UI thread using the <code>remote</code> module.</p>\n<p>3) Avoid using blocking I/O operations in the main process. In short, whenever core Node.js modules (like <code>fs</code> or <code>child_process</code>) offer a synchronous or an asynchronous version, you should prefer the asynchronous and non-blocking variant.</p>\n<h2 id=\"4-blocking-the-renderer-process\"><a href=\"#4-blocking-the-renderer-process\">4) Blocking the renderer process</a></h2>\n<p>Since Electron ships with a current version of Chrome, you can make use of the latest and greatest features the Web Platform offers to defer or offload heavy operations in a way that keeps your app smooth and responsive.</p>\n<h3 id=\"why-3\"><a href=\"#why-3\">Why?</a></h3>\n<p>Your app probably has a lot of JavaScript to run in the renderer process. The trick is to execute operations as quickly as possible without taking away resources needed to keep scrolling smooth, respond to user input, or animations at 60fps.</p>\n<p>Orchestrating the flow of operations in your renderer's code is particularly useful if users complain about your app sometimes \"stuttering\".</p>\n<h3 id=\"how-3\"><a href=\"#how-3\">How?</a></h3>\n<p>Generally speaking, all advice for building performant web apps for modern browsers apply to Electron's renderers, too. The two primary tools at your disposal  are currently <code>requestIdleCallback()</code> for small operations and <code>Web Workers</code> for long-running operations.</p>\n<p><em><code>requestIdleCallback()</code></em> allows developers to queue up a function to be executed as soon as the process is entering an idle period. It enables you to perform low-priority or background work without impacting the user experience. For more information about how to use it, <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\">check out its documentation on MDN</a>.</p>\n<p><em>Web Workers</em> are a powerful tool to run code on a separate thread. There are some caveats to consider – consult Electron's <a href=\"/docs/tutorial/multithreading\">multithreading documentation</a> and the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers\">MDN documentation for Web Workers</a>. They're an ideal solution for any operation that requires a lot of CPU power for an extended period of time.</p>\n<h2 id=\"5-unnecessary-polyfills\"><a href=\"#5-unnecessary-polyfills\">5) Unnecessary polyfills</a></h2>\n<p>One of Electron's great benefits is that you know exactly which engine will parse your JavaScript, HTML, and CSS. If you're re-purposing code that was written for the web at large, make sure to not polyfill features included in Electron.</p>\n<h3 id=\"why-4\"><a href=\"#why-4\">Why?</a></h3>\n<p>When building a web application for today's Internet, the oldest environments dictate what features you can and cannot use. Even though Electron supports well-performing CSS filters and animations, an older browser might not. Where you could use WebGL, your developers may have chosen a more resource-hungry solution to support older phones.</p>\n<p>When it comes to JavaScript, you may have included toolkit libraries like jQuery for DOM selectors or polyfills like the <code>regenerator-runtime</code> to support <code>async/await</code>.</p>\n<p>It is rare for a JavaScript-based polyfill to be faster than the equivalent native feature in Electron. Do not slow down your Electron app by shipping your own version of standard web platform features.</p>\n<h3 id=\"how-4\"><a href=\"#how-4\">How?</a></h3>\n<p>Operate under the assumption that polyfills in current versions of Electron are unnecessary. If you have doubts, check <a href=\"https://caniuse.com/\">caniuse.com</a> and check if the <a href=\"/docs/api/process#processversionschrome-readonly\">version of Chromium used in your Electron version</a> supports the feature you desire.</p>\n<p>In addition, carefully examine the libraries you use. Are they really necessary? <code>jQuery</code>, for example, was such a success that many of its features are now part of the <a href=\"http://youmightnotneedjquery.com/\">standard JavaScript feature set available</a>.</p>\n<p>If you're using a transpiler/compiler like TypeScript, examine its configuration and ensure that you're targeting the latest ECMAScript version supported by Electron.</p>\n<h2 id=\"6-unnecessary-or-blocking-network-requests\"><a href=\"#6-unnecessary-or-blocking-network-requests\">6) Unnecessary or blocking network requests</a></h2>\n<p>Avoid fetching rarely changing resources from the internet if they could easily be bundled with your application.</p>\n<h3 id=\"why-5\"><a href=\"#why-5\">Why?</a></h3>\n<p>Many users of Electron start with an entirely web-based app that they're turning into a desktop application. As web developers, we are used to loading resources from a variety of content delivery networks. Now that you are shipping a proper desktop application, attempt to \"cut the cord\" where possible and avoid letting your users wait for resources that never change and could easily be included  in your app.</p>\n<p>A typical example is Google Fonts. Many developers make use of Google's impressive collection of free fonts, which comes with a content delivery network. The pitch is straightforward: Include a few lines of CSS and Google will take care of the rest.</p>\n<p>When building an Electron app, your users are better served if you download the fonts and include them in your app's bundle.</p>\n<h3 id=\"how-5\"><a href=\"#how-5\">How?</a></h3>\n<p>In an ideal world, your application wouldn't need the network to operate at all. To get there, you must understand what resources your app is downloading - and how large those resources are.</p>\n<p>To do so, open up the developer tools. Navigate to the <code>Network</code> tab and check the <code>Disable cache</code> option. Then, reload your renderer. Unless your app prohibits such reloads, you can usually trigger a reload by hitting <code>Cmd + R</code> or <code>Ctrl + R</code> with the developer tools in focus.</p>\n<p>The tools will now meticulously record all network requests. In a first pass, take stock of all the resources being downloaded, focusing on the larger files first. Are any of them images, fonts, or media files that don't change and could be included with your bundle? If so, include them.</p>\n<p>As a next step, enable <code>Network Throttling</code>. Find the drop-down that currently reads <code>Online</code> and select a slower speed such as <code>Fast 3G</code>. Reload your renderer and see if there are any resources that your app is unnecessarily waiting for. In many cases, an app will wait for a network request to complete despite not actually needing the involved resource.</p>\n<p>As a tip, loading resources from the Internet that you might want to change without shipping an application update is a powerful strategy. For advanced control over how resources are being loaded, consider investing in <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API\">Service Workers</a>.</p>\n<h2 id=\"7-bundle-your-code\"><a href=\"#7-bundle-your-code\">7) Bundle your code</a></h2>\n<p>As already pointed out in \"<a href=\"#2-loading-and-running-code-too-soon\">Loading and running code too soon</a>\", calling <code>require()</code> is an expensive operation. If you are able to do so, bundle your application's code into a single file.</p>\n<h3 id=\"why-6\"><a href=\"#why-6\">Why?</a></h3>\n<p>Modern JavaScript development usually involves many files and modules. While that's perfectly fine for developing with Electron, we heavily recommend that you bundle all your code into one single file to ensure that the overhead included in calling <code>require()</code> is only paid once when your application loads.</p>\n<h3 id=\"how-6\"><a href=\"#how-6\">How?</a></h3>\n<p>There are numerous JavaScript bundlers out there and we know better than to anger the community by recommending one tool over another. We do however recommend that you use a bundler that is able to handle Electron's unique environment that needs to handle both Node.js and browser environments.</p>\n<p>As of writing this article, the popular choices include <a href=\"https://webpack.js.org/\">Webpack</a>, <a href=\"https://parceljs.org/\">Parcel</a>, and <a href=\"https://rollupjs.org/\">rollup.js</a>.</p>",
      "title": "Performance",
      "description": ""
    },
    "/docs/api/structures/point": {
      "locale": "de-DE",
      "slug": "point",
      "href": "/docs/api/structures/point",
      "crowdinFileId": "256475",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/point.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"point-object\"><a href=\"#point-object\">Point Object</a></h1>\n<ul>\n<li><code>x</code> Number</li>\n<li><code>y</code> Number</li>\n</ul>\n<p><strong>Note:</strong> Both <code>x</code> and <code>y</code> must be whole integers, when providing a point object as input to an Electron API we will automatically round your <code>x</code> and <code>y</code> values to the nearest whole integer.</p>",
      "title": "Point Object",
      "description": ""
    },
    "/docs/api/structures/post-body": {
      "locale": "de-DE",
      "slug": "post-body",
      "href": "/docs/api/structures/post-body",
      "crowdinFileId": "256477",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/post-body.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"postbody-object\"><a href=\"#postbody-object\">PostBody Object</a></h1>\n<ul>\n<li><code>data</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)[] - The post data to be sent to the new window.</li>\n<li><code>contentType</code> String - The <code>content-type</code> header used for the data. One of <code>application/x-www-form-urlencoded</code> or <code>multipart/form-data</code>. Corresponds to the <code>enctype</code> attribute of the submitted HTML form.</li>\n<li><code>boundary</code> String (optional) - The boundary used to separate multiple parts of the message. Only valid when <code>contentType</code> is <code>multipart/form-data</code>.</li>\n</ul>\n<p>Note that keys starting with <code>--</code> are not currently supported. For example, this will errantly submit as <code>multipart/form-data</code> when <code>nativeWindowOpen</code> is set to <code>false</code> in webPreferences:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">form</span>\n  <span class=\"hljs-attr\">target</span>=<span class=\"hljs-string\">\"_blank\"</span>\n  <span class=\"hljs-attr\">method</span>=<span class=\"hljs-string\">\"POST\"</span>\n  <span class=\"hljs-attr\">enctype</span>=<span class=\"hljs-string\">\"application/x-www-form-urlencoded\"</span>\n  <span class=\"hljs-attr\">action</span>=<span class=\"hljs-string\">\"https://postman-echo.com/post\"</span>\n></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">input</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text\"</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">\"--theKey\"</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">input</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"submit\"</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">form</span>></span>\n</code></pre>",
      "title": "PostBody Object",
      "description": ""
    },
    "/docs/api/power-monitor": {
      "locale": "de-DE",
      "slug": "power-monitor",
      "href": "/docs/api/power-monitor",
      "crowdinFileId": "256351",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/power-monitor.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"powermonitor\"><a href=\"#powermonitor\">powerMonitor</a></h1>\n<blockquote>\n<p>Monitor power state changes.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<h2 id=\"ereignisse\"><a href=\"#ereignisse\">Ereignisse</a></h2>\n<p>Das <code>powerMonitor</code> Modul sendet folgende Ereignisse aus:</p>\n<h3 id=\"event-suspend\"><a href=\"#event-suspend\">Event: 'suspend'</a></h3>\n<p>Emitted when the system is suspending.</p>\n<h3 id=\"event-resume\"><a href=\"#event-resume\">Event: 'resume'</a></h3>\n<p>Emitted when system is resuming.</p>\n<h3 id=\"event-on-ac-macos-windows\"><a href=\"#event-on-ac-macos-windows\">Event: 'on-ac' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Emitted when the system changes to AC power.</p>\n<h3 id=\"event-on-battery-macos--windows\"><a href=\"#event-on-battery-macos--windows\">Event: 'on-battery' <em>macOS</em>  <em>Windows</em></a></h3>\n<p>Emitted when system changes to battery power.</p>\n<h3 id=\"event-shutdown-linux-macos\"><a href=\"#event-shutdown-linux-macos\">Event: 'shutdown' <em>Linux</em> <em>macOS</em></a></h3>\n<p>Emitted when the system is about to reboot or shut down. If the event handler invokes <code>e.preventDefault()</code>, Electron will attempt to delay system shutdown in order for the app to exit cleanly. If <code>e.preventDefault()</code> is called, the app should exit as soon as possible by calling something like <code>app.quit()</code>.</p>\n<h3 id=\"event-lock-screen-macos-windows\"><a href=\"#event-lock-screen-macos-windows\">Event: 'lock-screen' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Emitted when the system is about to lock the screen.</p>\n<h3 id=\"event-unlock-screen-macos-windows\"><a href=\"#event-unlock-screen-macos-windows\">Event: 'unlock-screen' <em>macOS</em> <em>Windows</em></a></h3>\n<p>Emitted as soon as the systems screen is unlocked.</p>\n<h3 id=\"event-user-did-become-active-macos\"><a href=\"#event-user-did-become-active-macos\">Event: 'user-did-become-active' <em>macOS</em></a></h3>\n<p>Emitted when a login session is activated. See <a href=\"https://developer.apple.com/documentation/appkit/nsworkspacesessiondidbecomeactivenotification?language=objc\">documentation</a> for more information.</p>\n<h3 id=\"event-user-did-resign-active-macos\"><a href=\"#event-user-did-resign-active-macos\">Event: 'user-did-resign-active' <em>macOS</em></a></h3>\n<p>Emitted when a login session is deactivated. See <a href=\"https://developer.apple.com/documentation/appkit/nsworkspacesessiondidresignactivenotification?language=objc\">documentation</a> for more information.</p>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das Modul <code>powerMonitor</code> verfügt über die folgenden Methoden:</p>\n<h3 id=\"powermonitorgetsystemidlestateidlethreshold\"><a href=\"#powermonitorgetsystemidlestateidlethreshold\"><code>powerMonitor.getSystemIdleState(idleThreshold)</code></a></h3>\n<ul>\n<li><code>idleThreshold</code> Integer</li>\n</ul>\n<p>Returns <code>String</code> - The system's current state. Can be <code>active</code>, <code>idle</code>, <code>locked</code> or <code>unknown</code>.</p>\n<p>Calculate the system idle state. <code>idleThreshold</code> is the amount of time (in seconds) before considered idle.  <code>locked</code> is available on supported systems only.</p>\n<h3 id=\"powermonitorgetsystemidletime\"><a href=\"#powermonitorgetsystemidletime\"><code>powerMonitor.getSystemIdleTime()</code></a></h3>\n<p>Returns <code>Integer</code> - Idle time in seconds</p>\n<p>Calculate system idle time in seconds.</p>\n<h3 id=\"powermonitorisonbatterypower\"><a href=\"#powermonitorisonbatterypower\"><code>powerMonitor.isOnBatteryPower()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the system is on battery power.</p>\n<p>To monitor for changes in this property, use the <code>on-battery</code> and <code>on-ac</code> events.</p>\n<h2 id=\"eigenschaften\"><a href=\"#eigenschaften\">Eigenschaften</a></h2>\n<h3 id=\"powermonitoronbatterypower\"><a href=\"#powermonitoronbatterypower\"><code>powerMonitor.onBatteryPower</code></a></h3>\n<p>A <code>Boolean</code> property. True if the system is on battery power.</p>\n<p>See <a href=\"#powermonitorisonbatterypower\"><code>powerMonitor.isOnBatteryPower()</code></a>.</p>",
      "title": "powerMonitor",
      "description": "Monitor power state changes."
    },
    "/docs/api/power-save-blocker": {
      "locale": "de-DE",
      "slug": "power-save-blocker",
      "href": "/docs/api/power-save-blocker",
      "crowdinFileId": "256353",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/power-save-blocker.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"powersaveblocker\"><a href=\"#powersaveblocker\">powerSaveBlocker</a></h1>\n<blockquote>\n<p>Verhindere, dass das System in den Stromspar-/Schlafmodus geht.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p>Ein Beispiel:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { powerSaveBlocker } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> id = powerSaveBlocker.start(<span class=\"hljs-string\">'prevent-display-sleep'</span>)\n<span class=\"hljs-built_in\">console</span>.log(powerSaveBlocker.isStarted(id))\n\npowerSaveBlocker.stop(id)\n</code></pre>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das <code>powerSaveBlocker</code>-Modul hat folgende Methoden:</p>\n<h3 id=\"powersaveblockerstarttype\"><a href=\"#powersaveblockerstarttype\"><code>powerSaveBlocker.start(type)</code></a></h3>\n<ul>\n<li><code>type</code> String - Power save blocker type.<ul>\n<li><code>prevent-app-suspension</code> - Prevent the application from being suspended. Keeps system active but allows screen to be turned off. Example use cases: downloading a file or playing audio.</li>\n<li><code>prevent-display-sleep</code> - Prevent the display from going to sleep. Keeps system and screen active. Example use case: playing video.</li>\n</ul></li>\n</ul>\n<p>Gibt <code>Integer</code> zurück - Die Blocker-ID, die diesem Power-Blocker zugeordnet ist.</p>\n<p>Starts preventing the system from entering lower-power mode. Returns an integer identifying the power save blocker.</p>\n<p><strong>Note:</strong> <code>prevent-display-sleep</code> has higher precedence over <code>prevent-app-suspension</code>. Only the highest precedence type takes effect. In other words, <code>prevent-display-sleep</code> always takes precedence over <code>prevent-app-suspension</code>.</p>\n<p>For example, an API calling A requests for <code>prevent-app-suspension</code>, and another calling B requests for <code>prevent-display-sleep</code>. <code>prevent-display-sleep</code> will be used until B stops its request. After that, <code>prevent-app-suspension</code> is used.</p>\n<h3 id=\"powersaveblockerstopid\"><a href=\"#powersaveblockerstopid\"><code>powerSaveBlocker.stop(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer - The power save blocker id returned by <code>powerSaveBlocker.start</code>.</li>\n</ul>\n<p>Stops the specified power save blocker.</p>\n<h3 id=\"powersaveblockerisstartedid\"><a href=\"#powersaveblockerisstartedid\"><code>powerSaveBlocker.isStarted(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer - The power save blocker id returned by <code>powerSaveBlocker.start</code>.</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the corresponding <code>powerSaveBlocker</code> has started.</p>",
      "title": "powerSaveBlocker",
      "description": "Verhindere, dass das System in den Stromspar-/Schlafmodus geht."
    },
    "/docs/api/structures/printer-info": {
      "locale": "de-DE",
      "slug": "printer-info",
      "href": "/docs/api/structures/printer-info",
      "crowdinFileId": "256479",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/printer-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"printerinfo-object\"><a href=\"#printerinfo-object\">PrinterInfo Object</a></h1>\n<ul>\n<li><code>name</code> String - the name of the printer as understood by the OS.</li>\n<li><code>displayName</code> String - the name of the printer as shown in Print Preview.</li>\n<li><code>description</code> String - a longer description of the printer's type.</li>\n<li><code>status</code> Number - the current status of the printer.</li>\n<li><code>isDefault</code> Boolean - whether or not a given printer is set as the default printer on the OS.</li>\n<li><code>options</code> Object - an object containing a variable number of platform-specific printer information.</li>\n</ul>\n<p>The number represented by <code>status</code> means different things on different platforms: on Windows its potential values can be found <a href=\"https://docs.microsoft.com/en-us/windows/win32/printdocs/printer-info-2\">here</a>, and on Linux and macOS they can be found <a href=\"https://www.cups.org/doc/cupspm.html\">here</a>.</p>\n<h2 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h2>\n<p>Below is an example of some of the additional options that may be set which may be different on each platform.</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Austin_4th_Floor_Printer___C02XK13BJHD4'</span>,\n  <span class=\"hljs-attr\">displayName</span>: <span class=\"hljs-string\">'Austin 4th Floor Printer @ C02XK13BJHD4'</span>,\n  <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'TOSHIBA ColorMFP'</span>,\n  <span class=\"hljs-attr\">status</span>: <span class=\"hljs-number\">3</span>,\n  <span class=\"hljs-attr\">isDefault</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">options</span>: {\n    <span class=\"hljs-attr\">copies</span>: <span class=\"hljs-string\">'1'</span>,\n    <span class=\"hljs-string\">'device-uri'</span>: <span class=\"hljs-string\">'dnssd://Austin%204th%20Floor%20Printer%20%40%20C02XK13BJHD4._ipps._tcp.local./?uuid=71687f1e-1147-3274-6674-22de61b110bd'</span>,\n    <span class=\"hljs-attr\">finishings</span>: <span class=\"hljs-string\">'3'</span>,\n    <span class=\"hljs-string\">'job-cancel-after'</span>: <span class=\"hljs-string\">'10800'</span>,\n    <span class=\"hljs-string\">'job-hold-until'</span>: <span class=\"hljs-string\">'no-hold'</span>,\n    <span class=\"hljs-string\">'job-priority'</span>: <span class=\"hljs-string\">'50'</span>,\n    <span class=\"hljs-string\">'job-sheets'</span>: <span class=\"hljs-string\">'none,none'</span>,\n    <span class=\"hljs-string\">'marker-change-time'</span>: <span class=\"hljs-string\">'0'</span>,\n    <span class=\"hljs-string\">'number-up'</span>: <span class=\"hljs-string\">'1'</span>,\n    <span class=\"hljs-string\">'printer-commands'</span>: <span class=\"hljs-string\">'ReportLevels,PrintSelfTestPage,com.toshiba.ColourProfiles.update,com.toshiba.EFiling.update,com.toshiba.EFiling.checkPassword'</span>,\n    <span class=\"hljs-string\">'printer-info'</span>: <span class=\"hljs-string\">'Austin 4th Floor Printer @ C02XK13BJHD4'</span>,\n    <span class=\"hljs-string\">'printer-is-accepting-jobs'</span>: <span class=\"hljs-string\">'true'</span>,\n    <span class=\"hljs-string\">'printer-is-shared'</span>: <span class=\"hljs-string\">'false'</span>,\n    <span class=\"hljs-string\">'printer-is-temporary'</span>: <span class=\"hljs-string\">'false'</span>,\n    <span class=\"hljs-string\">'printer-location'</span>: <span class=\"hljs-string\">''</span>,\n    <span class=\"hljs-string\">'printer-make-and-model'</span>: <span class=\"hljs-string\">'TOSHIBA ColorMFP'</span>,\n    <span class=\"hljs-string\">'printer-state'</span>: <span class=\"hljs-string\">'3'</span>,\n    <span class=\"hljs-string\">'printer-state-change-time'</span>: <span class=\"hljs-string\">'1573472937'</span>,\n    <span class=\"hljs-string\">'printer-state-reasons'</span>: <span class=\"hljs-string\">'offline-report,com.toshiba.snmp.failed'</span>,\n    <span class=\"hljs-string\">'printer-type'</span>: <span class=\"hljs-string\">'10531038'</span>,\n    <span class=\"hljs-string\">'printer-uri-supported'</span>: <span class=\"hljs-string\">'ipp://localhost/printers/Austin_4th_Floor_Printer___C02XK13BJHD4'</span>,\n    <span class=\"hljs-attr\">system_driverinfo</span>: <span class=\"hljs-string\">'T'</span>\n  }\n}\n</code></pre>",
      "title": "PrinterInfo Object",
      "description": ""
    },
    "/docs/api/process": {
      "locale": "de-DE",
      "slug": "process",
      "href": "/docs/api/process",
      "crowdinFileId": "256355",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/process.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"process\"><a href=\"#process\">process</a></h1>\n<blockquote>\n<p>Extensions to process object.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p>Electron's <code>process</code> object is extended from the <a href=\"https://nodejs.org/api/process.html\">Node.js <code>process</code> object</a>. It adds the following events, properties, and methods:</p>\n<h2 id=\"sandbox\"><a href=\"#sandbox\">Sandbox</a></h2>\n<p>In sandboxed renderers the <code>process</code> object contains only a subset of the APIs:</p>\n<ul>\n<li><code>crash()</code></li>\n<li><code>hang()</code></li>\n<li><code>getCreationTime()</code></li>\n<li><code>getHeapStatistics()</code></li>\n<li><code>getBlinkMemoryInfo()</code></li>\n<li><code>getProcessMemoryInfo()</code></li>\n<li><code>getSystemMemoryInfo()</code></li>\n<li><code>getSystemVersion()</code></li>\n<li><code>getCPUUsage()</code></li>\n<li><code>getIOCounters()</code></li>\n<li><code>uptime()</code></li>\n<li><code>argv</code></li>\n<li><code>execPath</code></li>\n<li><code>env</code></li>\n<li><code>pid</code></li>\n<li><code>arch</code></li>\n<li><code>plattform</code></li>\n<li><code>sandboxed</code></li>\n<li><code>contextIsolated</code></li>\n<li><code>type</code></li>\n<li><code>version</code></li>\n<li><code>versions</code></li>\n<li><code>mas</code></li>\n<li><code>windowsStore</code></li>\n<li><code>contextId</code></li>\n</ul>\n<h2 id=\"ereignisse\"><a href=\"#ereignisse\">Ereignisse</a></h2>\n<h3 id=\"event-loaded\"><a href=\"#event-loaded\">Event: 'loaded'</a></h3>\n<p>Emitted when Electron has loaded its internal initialization script and is beginning to load the web page or the main script.</p>\n<h2 id=\"eigenschaften\"><a href=\"#eigenschaften\">Eigenschaften</a></h2>\n<h3 id=\"processdefaultapp-readonly\"><a href=\"#processdefaultapp-readonly\"><code>process.defaultApp</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>. When app is started by being passed as parameter to the default app, this property is <code>true</code> in the main process, otherwise it is <code>undefined</code>.</p>\n<h3 id=\"processismainframe-readonly\"><a href=\"#processismainframe-readonly\"><code>process.isMainFrame</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>, <code>true</code> when the current renderer context is the \"main\" renderer frame. If you want the ID of the current frame you should use <code>webFrame.routingId</code>.</p>\n<h3 id=\"processmas-readonly\"><a href=\"#processmas-readonly\"><code>process.mas</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>. For Mac App Store build, this property is <code>true</code>, for other builds it is <code>undefined</code>.</p>\n<h3 id=\"processnoasar\"><a href=\"#processnoasar\"><code>process.noAsar</code></a></h3>\n<p>A <code>Boolean</code> that controls ASAR support inside your application. Setting this to <code>true</code> will disable the support for <code>asar</code> archives in Node's built-in modules.</p>\n<h3 id=\"processnodeprecation\"><a href=\"#processnodeprecation\"><code>process.noDeprecation</code></a></h3>\n<p>A <code>Boolean</code> that controls whether or not deprecation warnings are printed to <code>stderr</code>. Setting this to <code>true</code> will silence deprecation warnings. This property is used instead of the <code>--no-deprecation</code> command line flag.</p>\n<h3 id=\"processresourcespath-readonly\"><a href=\"#processresourcespath-readonly\"><code>process.resourcesPath</code> <em>Readonly</em></a></h3>\n<p>A <code>String</code> representing the path to the resources directory.</p>\n<h3 id=\"processsandboxed-readonly\"><a href=\"#processsandboxed-readonly\"><code>process.sandboxed</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>. When the renderer process is sandboxed, this property is <code>true</code>, otherwise it is <code>undefined</code>.</p>\n<h3 id=\"processcontextisolated-readonly\"><a href=\"#processcontextisolated-readonly\"><code>process.contextIsolated</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code> that indicates whether the current renderer context has <code>contextIsolation</code> enabled. It is <code>undefined</code> in the main process.</p>\n<h3 id=\"processthrowdeprecation\"><a href=\"#processthrowdeprecation\"><code>process.throwDeprecation</code></a></h3>\n<p>A <code>Boolean</code> that controls whether or not deprecation warnings will be thrown as exceptions. Setting this to <code>true</code> will throw errors for deprecations. This property is used instead of the <code>--throw-deprecation</code> command line flag.</p>\n<h3 id=\"processtracedeprecation\"><a href=\"#processtracedeprecation\"><code>process.traceDeprecation</code></a></h3>\n<p>A <code>Boolean</code> that controls whether or not deprecations printed to <code>stderr</code> include their stack trace. Setting this to <code>true</code> will print stack traces for deprecations. This property is instead of the <code>--trace-deprecation</code> command line flag.</p>\n<h3 id=\"processtraceprocesswarnings\"><a href=\"#processtraceprocesswarnings\"><code>process.traceProcessWarnings</code></a></h3>\n<p>A <code>Boolean</code> that controls whether or not process warnings printed to <code>stderr</code> include their stack trace. Setting this to <code>true</code> will print stack traces for process warnings (including deprecations). This property is instead of the <code>--trace-warnings</code> command line flag.</p>\n<h3 id=\"processtype-readonly\"><a href=\"#processtype-readonly\"><code>process.type</code> <em>Readonly</em></a></h3>\n<p>A <code>String</code> representing the current process's type, can be:</p>\n<ul>\n<li><code>browser</code> - The main process</li>\n<li><code>renderer</code> - A renderer process</li>\n<li><code>worker</code> - In a web worker</li>\n</ul>\n<h3 id=\"processversionschrome-readonly\"><a href=\"#processversionschrome-readonly\"><code>process.versions.chrome</code> <em>Readonly</em></a></h3>\n<p>A <code>String</code> representing Chrome's version string.</p>\n<h3 id=\"processversionselectron-readonly\"><a href=\"#processversionselectron-readonly\"><code>process.versions.electron</code> <em>Readonly</em></a></h3>\n<p>A <code>String</code> representing Electron's version string.</p>\n<h3 id=\"processwindowsstore-readonly\"><a href=\"#processwindowsstore-readonly\"><code>process.windowsStore</code> <em>Readonly</em></a></h3>\n<p>A <code>Boolean</code>. If the app is running as a Windows Store app (appx), this property is <code>true</code>, for otherwise it is <code>undefined</code>.</p>\n<h3 id=\"processcontextid-readonly\"><a href=\"#processcontextid-readonly\"><code>process.contextId</code> <em>Readonly</em></a></h3>\n<p>A <code>String</code> (optional) representing a globally unique ID of the current JavaScript context. Each frame has its own JavaScript context. When contextIsolation is enabled, the isolated world also has a separate JavaScript context. This property is only available in the renderer process.</p>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das <code>process</code> Objekt enthält die folgenden Methoden:</p>\n<h3 id=\"processcrash\"><a href=\"#processcrash\"><code>process.crash()</code></a></h3>\n<p>Causes the main thread of the current process crash.</p>\n<h3 id=\"processgetcreationtime\"><a href=\"#processgetcreationtime\"><code>process.getCreationTime()</code></a></h3>\n<p>Returns <code>Number | null</code> - The number of milliseconds since epoch, or <code>null</code> if the information is unavailable</p>\n<p>Indicates the creation time of the application. Die Zeit wird seit der Epoche als Anzahl von Millisekunden dargestellt. It returns null if it is unable to get the process creation time.</p>\n<h3 id=\"processgetcpuusage\"><a href=\"#processgetcpuusage\"><code>process.getCPUUsage()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/cpu-usage\"><code>CPUUsage</code></a></p>\n<h3 id=\"processgetiocounters-windows-linux\"><a href=\"#processgetiocounters-windows-linux\"><code>process.getIOCounters()</code> <em>Windows</em> <em>Linux</em></a></h3>\n<p>Returns <a href=\"/docs/api/structures/io-counters\"><code>IOCounters</code></a></p>\n<h3 id=\"processgetheapstatistics\"><a href=\"#processgetheapstatistics\"><code>process.getHeapStatistics()</code></a></h3>\n<p>Gibt das <code>Object</code> zurück:</p>\n<ul>\n<li><code>totalHeapSize</code> Integer</li>\n<li><code>totalHeapSizeExecutable</code> Integer</li>\n<li><code>totalPhysicalSize</code> Integer</li>\n<li><code>totalAvailableSize</code> Integer</li>\n<li><code>usedHeapSize</code> Integer</li>\n<li><code>heapSizeLimit</code> Integer</li>\n<li><code>mallocedMemory</code> Integer</li>\n<li><code>peakMallocedMemory</code> Integer</li>\n<li><code>doesZapGarbage</code> Boolean</li>\n</ul>\n<p>Returns an object with V8 heap statistics. Beachten Sie, dass alle Statistiken in Kilobyte angegeben werden.</p>\n<h3 id=\"processgetblinkmemoryinfo\"><a href=\"#processgetblinkmemoryinfo\"><code>process.getBlinkMemoryInfo()</code></a></h3>\n<p>Gibt das <code>Object</code> zurück:</p>\n<ul>\n<li><code>allocated</code> Integer - Size of all allocated objects in Kilobytes.</li>\n<li><code>marked</code> Integer - Size of all marked objects in Kilobytes.</li>\n<li><code>total</code> Integer - Total allocated space in Kilobytes.</li>\n</ul>\n<p>Returns an object with Blink memory information. It can be useful for debugging rendering / DOM related memory issues. Note that all values are reported in Kilobytes.</p>\n<h3 id=\"processgetprocessmemoryinfo\"><a href=\"#processgetprocessmemoryinfo\"><code>process.getProcessMemoryInfo()</code></a></h3>\n<p>Returns <code>Promise&#x3C;ProcessMemoryInfo></code> - Resolves with a <a href=\"/docs/api/structures/process-memory-info\">ProcessMemoryInfo</a></p>\n<p>Returns an object giving memory usage statistics about the current process. Note that all statistics are reported in Kilobytes. This api should be called after app ready.</p>\n<p>Chromium does not provide <code>residentSet</code> value for macOS. This is because macOS performs in-memory compression of pages that haven't been recently used. As a result the resident set size value is not what one would expect. <code>private</code> memory is more representative of the actual pre-compression memory usage of the process on macOS.</p>\n<h3 id=\"processgetsystemmemoryinfo\"><a href=\"#processgetsystemmemoryinfo\"><code>process.getSystemMemoryInfo()</code></a></h3>\n<p>Gibt das <code>Object</code> zurück:</p>\n<ul>\n<li><code>total</code> Integer - The total amount of physical memory in Kilobytes available to the system.</li>\n<li><code>free</code> Integer - The total amount of memory not being used by applications or disk cache.</li>\n<li><code>swapTotal</code> Integer <em>Windows</em> <em>Linux</em> - The total amount of swap memory in Kilobytes available to the system.</li>\n<li><code>swapFree</code> Integer <em>Windows</em> <em>Linux</em> - The free amount of swap memory in Kilobytes available to the system.</li>\n</ul>\n<p>Returns an object giving memory usage statistics about the entire system. Note that all statistics are reported in Kilobytes.</p>\n<h3 id=\"processgetsystemversion\"><a href=\"#processgetsystemversion\"><code>process.getSystemVersion()</code></a></h3>\n<p>Returns <code>String</code> - The version of the host operating system.</p>\n<p>Beispiel:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> version = process.getSystemVersion()\n<span class=\"hljs-built_in\">console</span>.log(version)\n<span class=\"hljs-comment\">// On macOS -> '10.13.6'</span>\n<span class=\"hljs-comment\">// On Windows -> '10.0.17763'</span>\n<span class=\"hljs-comment\">// On Linux -> '4.15.0-45-generic'</span>\n</code></pre>\n<p><strong>Note:</strong> It returns the actual operating system version instead of kernel version on macOS unlike <code>os.release()</code>.</p>\n<h3 id=\"processtakeheapsnapshotfilepath\"><a href=\"#processtakeheapsnapshotfilepath\"><code>process.takeHeapSnapshot(filePath)</code></a></h3>\n<ul>\n<li><code>filePath</code> String - Path to the output file.</li>\n</ul>\n<p>Returns <code>Boolean</code> - Indicates whether the snapshot has been created successfully.</p>\n<p>Takes a V8 heap snapshot and saves it to <code>filePath</code>.</p>\n<h3 id=\"processhang\"><a href=\"#processhang\"><code>process.hang()</code></a></h3>\n<p>Causes the main thread of the current process hang.</p>\n<h3 id=\"processsetfdlimitmaxdescriptors-macos-linux\"><a href=\"#processsetfdlimitmaxdescriptors-macos-linux\"><code>process.setFdLimit(maxDescriptors)</code> <em>macOS</em> <em>Linux</em></a></h3>\n<ul>\n<li><code>maxDescriptors</code> Integer</li>\n</ul>\n<p>Sets the file descriptor soft limit to <code>maxDescriptors</code> or the OS hard limit, whichever is lower for the current process.</p>",
      "title": "process",
      "description": "Extensions to process object."
    },
    "/docs/api/structures/process-memory-info": {
      "locale": "de-DE",
      "slug": "process-memory-info",
      "href": "/docs/api/structures/process-memory-info",
      "crowdinFileId": "256481",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/process-memory-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"processmemoryinfo-object\"><a href=\"#processmemoryinfo-object\">ProcessMemoryInfo Object</a></h1>\n<ul>\n<li><code>residentSet</code> Integer <em>Linux</em> <em>Windows</em> - The amount of memory currently pinned to actual physical RAM in Kilobytes.</li>\n<li><code>private</code> Integer - The amount of memory not shared by other processes, such as JS heap or HTML content in Kilobytes.</li>\n<li><code>shared</code> Integer - The amount of memory shared between processes, typically memory consumed by the Electron code itself in Kilobytes.</li>\n</ul>",
      "title": "ProcessMemoryInfo Object",
      "description": ""
    },
    "/docs/api/structures/process-metric": {
      "locale": "de-DE",
      "slug": "process-metric",
      "href": "/docs/api/structures/process-metric",
      "crowdinFileId": "256483",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/process-metric.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"processmetric-object\"><a href=\"#processmetric-object\">ProcessMetric Object</a></h1>\n<ul>\n<li><code>pid</code> Integer - Process id of the process.</li>\n<li><code>Typ</code> String - Prozess-Typ. Einer der folgenden Werte:<ul>\n<li><code>Browser</code></li>\n<li><code>Tab</code></li>\n<li><code>Utility</code></li>\n<li><code>Zygote</code></li>\n<li><code>Sandbox helper</code></li>\n<li><code>GPU</code></li>\n<li><code>Pepper Plugin</code></li>\n<li><code>Pepper Plugin Broker</code></li>\n<li><code>Unknown</code></li>\n</ul></li>\n<li><code>serviceName</code> String (optional) - The non-localized name of the process.</li>\n<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>\n<li><code>cpu</code> <a href=\"/docs/api/structures/cpu-usage\">CPUUsage</a> - CPU usage of the process.</li>\n<li><code>creationTime</code> Number - Creation time for this process. The time is represented as number of milliseconds since epoch. Since the <code>pid</code> can be reused after a process dies, it is useful to use both the <code>pid</code> and the <code>creationTime</code> to uniquely identify a process.</li>\n<li><code>memory</code> <a href=\"/docs/api/structures/memory-info\">MemoryInfo</a> - Memory information for the process.</li>\n<li><code>sandboxed</code> Boolean (optional) <em>macOS</em> <em>Windows</em> - Whether the process is sandboxed on OS level.</li>\n<li><code>integrityLevel</code> String (optional) <em>Windows</em> - One of the following values:<ul>\n<li><code>untrusted</code></li>\n<li><code>low</code></li>\n<li><code>medium</code></li>\n<li><code>high</code></li>\n<li><code>unknown</code></li>\n</ul></li>\n</ul>",
      "title": "ProcessMetric Object",
      "description": ""
    },
    "/docs/tutorial/process-model": {
      "locale": "de-DE",
      "slug": "process-model",
      "href": "/docs/tutorial/process-model",
      "crowdinFileId": "256233",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/process-model.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"prozessmodell\"><a href=\"#prozessmodell\">Prozessmodell</a></h1>\n<p>Electron inherits its multi-process architecture from Chromium, which makes the framework architecturally very similar to a modern web browser. In this guide, we'll expound on the conceptual knowledge of Electron that we applied in the minimal <a href=\"/docs/tutorial/quick-start\">quick start app</a>.</p>\n<h2 id=\"why-not-a-single-process\"><a href=\"#why-not-a-single-process\">Why not a single process?</a></h2>\n<p>Web browsers are incredibly complicated applications. Aside from their primary ability to display web content, they have many secondary responsibilities, such as managing multiple windows (or tabs) and loading third-party extensions.</p>\n<p>In the earlier days, browsers usually used a single process for all of this functionality. Although this pattern meant less overhead for each tab you had open, it also meant that one website crashing or hanging would affect the entire browser.</p>\n<h2 id=\"the-multi-process-model\"><a href=\"#the-multi-process-model\">The multi-process model</a></h2>\n<p>To solve this problem, the Chrome team decided that each tab would render in its own process, limiting the harm that buggy or malicious code on a web page could cause to the app as a whole. A single browser process then controls these processes, as well as the application lifecycle as a whole. This diagram below from the <a href=\"https://www.google.com/googlebooks/chrome/\">Chrome Comic</a> visualizes this model:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/chrome-processes.png\" alt=\"Chrome&#x27;s multi-process architecture\"></p>\n<p>Electron applications are structured very similarly. As an app developer, you control two types of processes: main and renderer. These are analogous to Chrome's own browser and renderer processes outlined above.</p>\n<h2 id=\"the-main-process\"><a href=\"#the-main-process\">The main process</a></h2>\n<p>Each Electron app has a single main process, which acts as the application's entry point. The main process runs in a Node.js environment, meaning it has the ability to <code>require</code> modules and use all of Node.js APIs.</p>\n<h3 id=\"window-management\"><a href=\"#window-management\">Window management</a></h3>\n<p>The main process' primary purpose is to create and manage application windows with the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> module.</p>\n<p>Each instance of the <code>BrowserWindow</code> class creates an application window that loads a web page in a separate renderer process. You can interact with this web content from the main process using the window's <a href=\"/docs/api/web-contents\"><code>webContents</code></a> object.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> contents = win.webContents\n<span class=\"hljs-built_in\">console</span>.log(contents)\n</code></pre>\n<blockquote>\n<p>Note: A renderer process is also created for <a href=\"/docs/tutorial/web-embeds\">web embeds</a> such as the <code>BrowserView</code> module. The <code>webContents</code> object is also accessible for embedded web content.</p>\n</blockquote>\n<p>Because the <code>BrowserWindow</code> module is an <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\"><code>EventEmitter</code></a>, you can also add handlers for various user events (for example, minimizing or maximizing your window).</p>\n<p>When a <code>BrowserWindow</code> instance is destroyed, its corresponding renderer process gets terminated as well.</p>\n<h3 id=\"application-lifecycle\"><a href=\"#application-lifecycle\">Application lifecycle</a></h3>\n<p>The main process also controls your application's lifecycle through Electron's <a href=\"/docs/api/app\"><code>app</code></a> module. This module provides a large set of events and methods that you can use to add custom application behaviour (for instance, programatically quitting your application, modifying the application dock, or showing an About panel).</p>\n<p>As a practical example, the app shown in the <a href=\"/docs/tutorial/quick-start#manage-your-windows-lifecycle\">quick start guide</a> uses <code>app</code> APIs to create a more native application window experience.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// quitting the app when no windows are open on non-macOS platforms</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h3 id=\"native-apis\"><a href=\"#native-apis\">Native APIs</a></h3>\n<p>To extend Electron's features beyond being a Chromium wrapper for web contents, the main process also adds custom APIs to interact with the user's operating system. Electron exposes various modules that control native desktop functionality, such as menus, dialogs, and tray icons.</p>\n<p>For a full list of Electron's main process modules, check out our API documentation.</p>\n<h2 id=\"the-renderer-process\"><a href=\"#the-renderer-process\">The renderer process</a></h2>\n<p>Each Electron app spawns a separate renderer process for each open <code>BrowserWindow</code> (and each web embed). As its name implies, a renderer is responsible for <em>rendering</em> web content. For all intents and purposes, code ran in renderer processes should behave according to web standards (insofar as Chromium does, at least).</p>\n<p>Therefore, all user interfaces and app functionality within a single browser window should be written with the same tools and paradigms that you use on the web.</p>\n<p>Although explaining every web spec is out of scope for this guide, the bare minimum to understand is:</p>\n<ul>\n<li>An HTML file is your entry point for the renderer process.</li>\n<li>UI styling is added through Cascading Style Sheets (CSS).</li>\n<li>Executable JavaScript code can be added through <code>&#x3C;script></code> elements.</li>\n</ul>\n<p>Moreover, this also means that the renderer has no direct access to <code>require</code> or other Node.js APIs. In order to directly include NPM modules in the renderer, you must use the same bundler toolchains (for example, <code>webpack</code> or <code>parcel</code>) that you use on the web.</p>\n<blockquote>\n<p>Note: Renderer processes can be spawned with a full Node.js environment for ease of development. Historically, this used to be the default, but this feature was disabled for security reasons.</p>\n</blockquote>\n<p>At this point, you might be wondering how your renderer process user interfaces can interact with Node.js and Electron's native desktop functionality if these features are only accessible from the main process. In fact, there is no direct way to import Electron's content scripts.</p>\n<h2 id=\"preload-scripts\"><a href=\"#preload-scripts\">Preload scripts</a></h2>\n<!-- Note: This guide doesn't take sandboxing into account, which might fundamentally \nchange the statements here. --> Preload scripts contain code that executes in a renderer process before its web content begins loading. These scripts run within the renderer context, but are granted more privileges by having access to Node.js APIs.\n<p>A preload script can be attached to the main process in the <code>BrowserWindow</code> constructor's <code>webPreferences</code> option.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">//...</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">preload</span>: <span class=\"hljs-string\">'path/to/preload.js'</span>\n  }\n})\n<span class=\"hljs-comment\">//...</span>\n</code></pre>\n<p>Because the preload script shares a global <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window\"><code>Window</code></a> interface with the renderers and can access Node.js APIs, it serves to enhance your renderer by exposing arbitrary APIs in the <code>window</code> global that your web contents can then consume.</p>\n<p>Although preload scripts share a <code>window</code> global with the renderer they're attached to, you cannot directly attach any variables from the preload script to <code>window</code> because of the <a href=\"/docs/tutorial/context-isolation\"><code>contextIsolation</code></a> default.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.myAPI = {\n  <span class=\"hljs-attr\">desktop</span>: <span class=\"hljs-literal\">true</span>\n}\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-built_in\">window</span>.myAPI)\n<span class=\"hljs-comment\">// => undefined</span>\n</code></pre>\n<p>Context Isolation means that preload scripts are isolated from the renderer's main world to avoid leaking any privileged APIs into your web content's code.</p>\n<p>Instead, use the <a href=\"/docs/api/context-bridge\"><code>contextBridge</code></a> module to accomplish this securely:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { contextBridge } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\ncontextBridge.exposeInMainWorld(<span class=\"hljs-string\">'myAPI'</span>, {\n  <span class=\"hljs-attr\">desktop</span>: <span class=\"hljs-literal\">true</span>\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-built_in\">window</span>.myAPI)\n<span class=\"hljs-comment\">// => { desktop: true }</span>\n</code></pre>\n<p>This feature is incredibly useful for two main purposes:</p>\n<ul>\n<li>By exposing <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> helpers to the renderer, you can use inter-process communication (IPC) to trigger main process tasks from the renderer (and vice-versa).</li>\n<li>If you're developing an Electron wrapper for an existing web app hosted on a remote URL, you can add custom properties onto the renderer's <code>window</code> global that can be used for desktop-only logic on the web client's side.</li>\n</ul>",
      "title": "Prozessmodell",
      "description": "Note: A renderer process is also created for web embeds such as the BrowserView module. The webContents object is also accessible for embedded web content."
    },
    "/docs/api/structures/product": {
      "locale": "de-DE",
      "slug": "product",
      "href": "/docs/api/structures/product",
      "crowdinFileId": "256485",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/product.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"product-object\"><a href=\"#product-object\">Product Object</a></h1>\n<ul>\n<li><code>productIdentifier</code> String - The string that identifies the product to the Apple App Store.</li>\n<li><code>localizedDescription</code> String - A description of the product.</li>\n<li><code>localizedTitle</code> String - The name of the product.</li>\n<li><code>contentVersion</code> String - A string that identifies the version of the content.</li>\n<li><code>contentLengths</code> Number[] - The total size of the content, in bytes.</li>\n<li><code>price</code> Number - The cost of the product in the local currency.</li>\n<li><code>formattedPrice</code> String - The locale formatted price of the product.</li>\n<li><code>currencyCode</code> String - 3 character code presenting a product's currency based on the ISO 4217 standard.</li>\n<li><code>isDownloadable</code> Boolean - A Boolean value that indicates whether the App Store has downloadable content for this product. <code>true</code> if at least one file has been associated with the product.</li>\n</ul>",
      "title": "Product Object",
      "description": ""
    },
    "/docs/tutorial/progress-bar": {
      "locale": "de-DE",
      "slug": "progress-bar",
      "href": "/docs/tutorial/progress-bar",
      "crowdinFileId": "256235",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/progress-bar.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"taskbar-progress-bar-windows--macos\"><a href=\"#taskbar-progress-bar-windows--macos\">Taskbar Progress Bar (Windows &#x26; macOS)</a></h1>\n<h2 id=\"übersicht\"><a href=\"#übersicht\">Übersicht</a></h2>\n<p>A progress bar enables a window to provide progress information to the user without the need of switching to the window itself.</p>\n<p>On Windows, you can use a taskbar button to display a progress bar.</p>\n<p>![Windows Progress Bar][<a href=\"https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png%5C\">https://cloud.githubusercontent.com/assets/639601/5081682/16691fda-6f0e-11e4-9676-49b6418f1264.png\\</a>]</p>\n<p>On macOS, the progress bar will be displayed as a part of the dock icon.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/macos-progress-bar.png\" alt=\"macOS Progress Bar\"></p>\n<p>On Linux, the Unity graphical interface also has a similar feature that allows you to specify the progress bar in the launcher.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/linux-progress-bar.png\" alt=\"Linux Progress Bar\"></p>\n<blockquote>\n<p>NOTE: on Windows, each window can have its own progress bar, whereas on macOS and Linux (Unity) there can be only one progress bar for the application.</p>\n</blockquote>\n<hr>\n<p>All three cases are covered by the same API - the <a href=\"/docs/api/browser-window#winsetprogressbarprogress-options\"><code>setProgressBar()</code></a> method available on an instance of <code>BrowserWindow</code>. To indicate your progress, call this method with a number between <code>0</code> and <code>1</code>. For example, if you have a long-running task that is currently at 63% towards completion, you would call it as <code>setProgressBar(0.63)</code>.</p>\n<p>Setting the parameter to negative values (e.g. <code>-1</code>) will remove the progress bar. Setting it to a value greater than <code>1</code> will indicate an indeterminate progress bar in Windows or clamp to 100% in other operating systems. An indeterminate progress bar remains active but does not show an actual percentage, and is used for situations when you do not know how long an operation will take to complete.</p>\n<p>Weitere Informationen können in der <a href=\"/docs/api/browser-window#winsetprogressbarprogress-options\">API-Dokumentation für mehr Optionen und Modulen</a> gefunden werden.</p>\n<h2 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h2>\n<p>In this example, we add a progress bar to the main window that increments over time using Node.js timers.</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/progress-bar\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> progressInterval\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-keyword\">const</span> INCREMENT = <span class=\"hljs-number\">0.03</span>\n  <span class=\"hljs-keyword\">const</span> INTERVAL_DELAY = <span class=\"hljs-number\">100</span> <span class=\"hljs-comment\">// ms</span>\n\n  <span class=\"hljs-keyword\">let</span> c = <span class=\"hljs-number\">0</span>\n  progressInterval = setInterval(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// update progress bar to next value</span>\n    <span class=\"hljs-comment\">// values between 0 and 1 will show progress, >1 will show indeterminate or stick at 100%</span>\n    win.setProgressBar(c)\n\n    <span class=\"hljs-comment\">// increment or reset progress bar</span>\n    <span class=\"hljs-keyword\">if</span> (c &#x3C; <span class=\"hljs-number\">2</span>) c += INCREMENT\n    <span class=\"hljs-keyword\">else</span> c = <span class=\"hljs-number\">0</span>\n  }, INTERVAL_DELAY)\n}\n\napp.whenReady().then(createWindow)\n\n<span class=\"hljs-comment\">// before the app is terminated, clear both timers</span>\napp.on(<span class=\"hljs-string\">'before-quit'</span>, () => {\n  clearInterval(progressInterval)\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<p>After launching the Electron application, the dock (macOS) or taskbar (Windows, Unity) should show a progress bar that starts at zero and progresses through 100% to completion. It should then show indeterminate (Windows) or pin to 100% (other operating systems) briefly and then loop.</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/dock-progress-bar.png\" alt=\"macOS dock progress bar\"></p>\n<p>For macOS, the progress bar will also be indicated for your application when using <a href=\"https://support.apple.com/en-us/HT204100\">Mission Control</a>:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/mission-control-progress-bar.png\" alt=\"Mission Control Progress Bar\"></p>",
      "title": "Taskbar Progress Bar (Windows & macOS)",
      "description": "NOTE: on Windows, each window can have its own progress bar, whereas on macOS and Linux (Unity) there can be only one progress bar for the application."
    },
    "/docs/api/protocol": {
      "locale": "de-DE",
      "slug": "protocol",
      "href": "/docs/api/protocol",
      "crowdinFileId": "256357",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/protocol.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocol\"><a href=\"#protocol\">protocol</a></h1>\n<blockquote>\n<p>Register a custom protocol and intercept existing protocol requests.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p>An example of implementing a protocol that has the same effect as the <code>file://</code> protocol:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })\n})\n</code></pre>\n<p><strong>Note:</strong> All methods unless specified can only be used after the <code>ready</code> event of the <code>app</code> module gets emitted.</p>\n<h2 id=\"using-protocol-with-a-custom-partition-or-session\"><a href=\"#using-protocol-with-a-custom-partition-or-session\">Using <code>protocol</code> with a custom <code>partition</code> or <code>session</code></a></h2>\n<p>A protocol is registered to a specific Electron <a href=\"/docs/api/session\"><code>session</code></a> object. If you don't specify a session, then your <code>protocol</code> will be applied to the default session that Electron uses. However, if you define a <code>partition</code> or <code>session</code> on your <code>browserWindow</code>'s <code>webPreferences</code>, then that window will use a different session and your custom protocol will not work if you just use <code>electron.protocol.XXX</code>.</p>\n<p>To have your custom protocol work in combination with a custom session, you need to register it to that session explicitly.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session, app, protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> partition = <span class=\"hljs-string\">'persist:example'</span>\n  <span class=\"hljs-keyword\">const</span> ses = session.fromPartition(partition)\n\n  ses.protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })\n\n  mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { partition } })\n})\n</code></pre>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das Modul <code>protocol</code> verfügt über die folgenden Methoden:</p>\n<h3 id=\"protocolregisterschemesasprivilegedcustomschemes\"><a href=\"#protocolregisterschemesasprivilegedcustomschemes\"><code>protocol.registerSchemesAsPrivileged(customSchemes)</code></a></h3>\n<ul>\n<li><code>customSchemes</code> <a href=\"/docs/api/structures/custom-scheme\">CustomScheme[]</a></li>\n</ul>\n<p><strong>Note:</strong> This method can only be used before the <code>ready</code> event of the <code>app</code> module gets emitted and can be called only once.</p>\n<p>Registers the <code>scheme</code> as standard, secure, bypasses content security policy for resources, allows registering ServiceWorker, supports fetch API, and streaming video/audio. Specify a privilege with the value of <code>true</code> to enable the capability.</p>\n<p>An example of registering a privileged scheme, that bypasses Content Security Policy:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nprotocol.registerSchemesAsPrivileged([\n  { <span class=\"hljs-attr\">scheme</span>: <span class=\"hljs-string\">'foo'</span>, <span class=\"hljs-attr\">privileges</span>: { <span class=\"hljs-attr\">bypassCSP</span>: <span class=\"hljs-literal\">true</span> } }\n])\n</code></pre>\n<p>A standard scheme adheres to what RFC 3986 calls <a href=\"https://tools.ietf.org/html/rfc3986#section-3\">generic URI syntax</a>. For example <code>http</code> and <code>https</code> are standard schemes, while <code>file</code> is not.</p>\n<p>Registering a scheme as standard allows relative and absolute resources to be resolved correctly when served. Otherwise the scheme will behave like the <code>file</code> protocol, but without the ability to resolve relative URLs.</p>\n<p>For example when you load following page with custom protocol without registering it as standard scheme, the image will not be loaded because non-standard schemes can not recognize relative URLs:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">img</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">'test.png'</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n</code></pre>\n<p>Registering a scheme as standard will allow access to files through the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/LocalFileSystem\">FileSystem API</a>. Otherwise the renderer will throw a security error for the scheme.</p>\n<p>By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB, cookies) are disabled for non standard schemes. So in general if you want to register a custom protocol to replace the <code>http</code> protocol, you have to register it as a standard scheme.</p>\n<p>Protocols that use streams (http and stream protocols) should set <code>stream: true</code>. The <code>&#x3C;video></code> and <code>&#x3C;audio></code> HTML elements expect protocols to buffer their responses by default. The <code>stream</code> flag configures those elements to correctly expect streaming responses.</p>\n<h3 id=\"protocolregisterfileprotocolscheme-handler\"><a href=\"#protocolregisterfileprotocolscheme-handler\"><code>protocol.registerFileProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Funktion<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send a file as the response. The <code>handler</code> will be called with <code>request</code> and <code>callback</code> where <code>request</code> is an incoming request for the <code>scheme</code>.</p>\n<p>To handle the <code>request</code>, the <code>callback</code> should be called with either the file's path or an object that has a <code>path</code> property, e.g. <code>callback(filePath)</code> or <code>callback({ path: filePath })</code>. The <code>filePath</code> must be an absolute path.</p>\n<p>By default the <code>scheme</code> is treated like <code>http:</code>, which is parsed differently from protocols that follow the \"generic URI syntax\" like <code>file:</code>.</p>\n<h3 id=\"protocolregisterbufferprotocolscheme-handler\"><a href=\"#protocolregisterbufferprotocolscheme-handler\"><code>protocol.registerBufferProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Funktion<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (Buffer | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send a <code>Buffer</code> as a response.</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code> should be called with either a <code>Buffer</code> object or an object that has the <code>data</code> property.</p>\n<p>Beispiel:</p>\n<pre><code class=\"hljs language-javascript\">protocol.registerBufferProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback({ <span class=\"hljs-attr\">mimeType</span>: <span class=\"hljs-string\">'text/html'</span>, <span class=\"hljs-attr\">data</span>: Buffer.from(<span class=\"hljs-string\">'&#x3C;h5>Response&#x3C;/h5>'</span>) })\n})\n</code></pre>\n<h3 id=\"protocolregisterstringprotocolscheme-handler\"><a href=\"#protocolregisterstringprotocolscheme-handler\"><code>protocol.registerStringProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Funktion<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send a <code>String</code> as a response.</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code> should be called with either a <code>String</code> or an object that has the <code>data</code> property.</p>\n<h3 id=\"protocolregisterhttpprotocolscheme-handler\"><a href=\"#protocolregisterhttpprotocolscheme-handler\"><code>protocol.registerHttpProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Funktion<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> ProtocolResponse</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send an HTTP request as a response.</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code> should be called with an object that has the <code>url</code> property.</p>\n<h3 id=\"protocolregisterstreamprotocolscheme-handler\"><a href=\"#protocolregisterstreamprotocolscheme-handler\"><code>protocol.registerStreamProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Funktion<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (ReadableStream | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully registered</p>\n<p>Registers a protocol of <code>scheme</code> that will send a stream as a response.</p>\n<p>The usage is the same with <code>registerFileProtocol</code>, except that the <code>callback</code> should be called with either a <a href=\"https://nodejs.org/api/stream.html#stream_class_stream_readable\"><code>ReadableStream</code></a> object or an object that has the <code>data</code> property.</p>\n<p>Beispiel:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { protocol } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { PassThrough } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'stream'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createStream</span> (<span class=\"hljs-params\">text</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> rv = <span class=\"hljs-keyword\">new</span> PassThrough() <span class=\"hljs-comment\">// PassThrough is also a Readable stream</span>\n  rv.push(text)\n  rv.push(<span class=\"hljs-literal\">null</span>)\n  <span class=\"hljs-keyword\">return</span> rv\n}\n\nprotocol.registerStreamProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback({\n    <span class=\"hljs-attr\">statusCode</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">headers</span>: {\n      <span class=\"hljs-string\">'content-type'</span>: <span class=\"hljs-string\">'text/html'</span>\n    },\n    <span class=\"hljs-attr\">data</span>: createStream(<span class=\"hljs-string\">'&#x3C;h5>Response&#x3C;/h5>'</span>)\n  })\n})\n</code></pre>\n<p>It is possible to pass any object that implements the readable stream API (emits <code>data</code>/<code>end</code>/<code>error</code> events). For example, here's how a file could be returned:</p>\n<pre><code class=\"hljs language-javascript\">protocol.registerStreamProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n  callback(fs.createReadStream(<span class=\"hljs-string\">'index.html'</span>))\n})\n</code></pre>\n<h3 id=\"protocolunregisterprotocolscheme\"><a href=\"#protocolunregisterprotocolscheme\"><code>protocol.unregisterProtocol(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully unregistered</p>\n<p>Unregisters the custom protocol of <code>scheme</code>.</p>\n<h3 id=\"protocolisprotocolregisteredscheme\"><a href=\"#protocolisprotocolregisteredscheme\"><code>protocol.isProtocolRegistered(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether <code>scheme</code> is already registered.</p>\n<h3 id=\"protocolinterceptfileprotocolscheme-handler\"><a href=\"#protocolinterceptfileprotocolscheme-handler\"><code>protocol.interceptFileProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Funktion<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepts <code>scheme</code> protocol and uses <code>handler</code> as the protocol's new handler which sends a file as a response.</p>\n<h3 id=\"protocolinterceptstringprotocolscheme-handler\"><a href=\"#protocolinterceptstringprotocolscheme-handler\"><code>protocol.interceptStringProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Funktion<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (String | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepts <code>scheme</code> protocol and uses <code>handler</code> as the protocol's new handler which sends a <code>String</code> as a response.</p>\n<h3 id=\"protocolinterceptbufferprotocolscheme-handler\"><a href=\"#protocolinterceptbufferprotocolscheme-handler\"><code>protocol.interceptBufferProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Funktion<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (Buffer | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepts <code>scheme</code> protocol and uses <code>handler</code> as the protocol's new handler which sends a <code>Buffer</code> as a response.</p>\n<h3 id=\"protocolintercepthttpprotocolscheme-handler\"><a href=\"#protocolintercepthttpprotocolscheme-handler\"><code>protocol.interceptHttpProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Funktion<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Intercepts <code>scheme</code> protocol and uses <code>handler</code> as the protocol's new handler which sends a new HTTP request as a response.</p>\n<h3 id=\"protocolinterceptstreamprotocolscheme-handler\"><a href=\"#protocolinterceptstreamprotocolscheme-handler\"><code>protocol.interceptStreamProtocol(scheme, handler)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n<li><code>handler</code> Funktion<ul>\n<li><code>request</code> <a href=\"/docs/api/structures/protocol-request\">ProtocolRequest</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> (ReadableStream | <a href=\"/docs/api/structures/protocol-response\">ProtocolResponse</a>)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully intercepted</p>\n<p>Same as <code>protocol.registerStreamProtocol</code>, except that it replaces an existing protocol handler.</p>\n<h3 id=\"protocoluninterceptprotocolscheme\"><a href=\"#protocoluninterceptprotocolscheme\"><code>protocol.uninterceptProtocol(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the protocol was successfully unintercepted</p>\n<p>Remove the interceptor installed for <code>scheme</code> and restore its original handler.</p>\n<h3 id=\"protocolisprotocolinterceptedscheme\"><a href=\"#protocolisprotocolinterceptedscheme\"><code>protocol.isProtocolIntercepted(scheme)</code></a></h3>\n<ul>\n<li><code>scheme</code> String</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether <code>scheme</code> is already intercepted.</p>",
      "title": "protocol",
      "description": "Register a custom protocol and intercept existing protocol requests."
    },
    "/docs/api/structures/protocol-request": {
      "locale": "de-DE",
      "slug": "protocol-request",
      "href": "/docs/api/structures/protocol-request",
      "crowdinFileId": "256487",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-request.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolrequest-object\"><a href=\"#protocolrequest-object\">ProtocolRequest Object</a></h1>\n<ul>\n<li>` URL &#x3C;/ 0>  Zeichenfolge</li><li><code>referrer` String</code></li><code>\n<li><code>method</code> String</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/upload-data\">UploadData[]</a> (optional)</li>\n<li><code>headers</code> Record&#x3C;String, String></li>\n</code></ul>",
      "title": "ProtocolRequest Object",
      "description": ""
    },
    "/docs/api/structures/protocol-response": {
      "locale": "de-DE",
      "slug": "protocol-response",
      "href": "/docs/api/structures/protocol-response",
      "crowdinFileId": "256491",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-response.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolresponse-object\"><a href=\"#protocolresponse-object\">ProtocolResponse Object</a></h1>\n<ul>\n<li><code>error</code> Integer (optional) - When assigned, the <code>request</code> will fail with the <code>error</code> number . For the available error numbers you can use, please see the <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">net error list</a>.</li>\n<li><code>statusCode</code> Number (optional) - The HTTP response code, default is 200.</li>\n<li><code>charset</code> String (optional) - The charset of response body, default is <code>\"utf-8\"</code>.</li>\n<li><code>mimeType</code> String (optional) - The MIME type of response body, default is <code>\"text/html\"</code>. Setting <code>mimeType</code> would implicitly set the <code>content-type</code> header in response, but if <code>content-type</code> is already set in <code>headers</code>, the <code>mimeType</code> would be ignored.</li>\n<li><code>headers</code> Record&#x3C;string, string | string[]> (optional) - An object containing the response headers. The keys must be String, and values must be either String or Array of String.</li>\n<li><code>data</code> (Buffer | String | ReadableStream) (optional) - The response body. When returning stream as response, this is a Node.js readable stream representing the response body. When returning <code>Buffer</code> as response, this is a <code>Buffer</code>. When returning <code>String</code> as response, this is a <code>String</code>. This is ignored for other types of responses.</li>\n<li><code>path</code> String (optional) - Path to the file which would be sent as response body. This is only used for file responses.</li>\n<li><code>url</code> String (optional) - Download the <code>url</code> and pipe the result as response body. This is only used for URL responses.</li>\n<li><code>referrer</code> String (optional) - The <code>referrer</code> URL. This is only used for file and URL responses.</li>\n<li><code>method</code> String (optional) - The HTTP <code>method</code>. This is only used for file and URL responses.</li>\n<li><code>session</code> Session (optional) - The session used for requesting URL, by default the HTTP request will reuse the current session. Setting <code>session</code> to <code>null</code> would use a random independent session. This is only used for URL responses.</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/protocol-response-upload-data\">ProtocolResponseUploadData</a> (optional) - The data used as upload data. This is only used for URL responses when <code>method</code> is <code>\"POST\"</code>.</li>\n</ul>",
      "title": "ProtocolResponse Object",
      "description": ""
    },
    "/docs/api/structures/protocol-response-upload-data": {
      "locale": "de-DE",
      "slug": "protocol-response-upload-data",
      "href": "/docs/api/structures/protocol-response-upload-data",
      "crowdinFileId": "256489",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/protocol-response-upload-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"protocolresponseuploaddata-object\"><a href=\"#protocolresponseuploaddata-object\">ProtocolResponseUploadData Object</a></h1>\n<ul>\n<li><code>contentType</code> String - MIME type of the content.</li>\n<li><code>data</code> String | Buffer - Content to be sent.</li>\n</ul>",
      "title": "ProtocolResponseUploadData Object",
      "description": ""
    },
    "/docs/development/pull-requests": {
      "locale": "de-DE",
      "slug": "pull-requests",
      "href": "/docs/development/pull-requests",
      "crowdinFileId": "256163",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/pull-requests.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"pull-requests\"><a href=\"#pull-requests\">Pull Requests</a></h1>\n<ul>\n<li><a href=\"#setting-up-your-local-environment\">Einrichtung deiner Lokalen Entwicklungsumgebung</a><ul>\n<li><a href=\"#step-1-fork\">Schritt 1: Fork</a></li>\n<li><a href=\"#step-2-build\">Schritt 2: Build</a></li>\n<li><a href=\"#step-3-branch\">Schritt 3: Branch</a></li>\n</ul></li>\n<li><a href=\"#making-changes\">Mache die Änderungen</a><ul>\n<li><a href=\"#step-4-code\">Schritt 4: Code</a></li>\n<li><a href=\"#step-5-commit\">Schritt 5: Commit</a><ul>\n<li><a href=\"#commit-message-guidelines\">Schritt 5: Commit</a></li>\n</ul></li>\n<li><a href=\"#step-6-rebase\">Schritt 6: Rebase</a></li>\n<li><a href=\"#step-7-test\">Schritt 7: Teste</a></li>\n<li><a href=\"#step-8-push\">Schritt 8: Push</a></li>\n<li><a href=\"#step-9-opening-the-pull-request\">Schritt 9: Erstelle einen Pull Request</a></li>\n<li><a href=\"#step-10-discuss-and-update\">Step 10: Discuss and Update</a><ul>\n<li><a href=\"#approval-and-request-changes-workflow\">Approval and Request Changes Workflow</a></li>\n</ul></li>\n<li><a href=\"#step-11-landing\">Step 11: Landing</a></li>\n<li><a href=\"#continuous-integration-testing\">Continuous Integration Testing</a></li>\n</ul></li>\n</ul>\n<h2 id=\"einrichtung-deiner-lokalen-entwicklungsumgebung\"><a href=\"#einrichtung-deiner-lokalen-entwicklungsumgebung\">Einrichtung deiner Lokalen Entwicklungsumgebung</a></h2>\n<h3 id=\"schritt-1-fork\"><a href=\"#schritt-1-fork\">Schritt 1: Fork</a></h3>\n<p>Forke das Projekt <a href=\"https://github.com/electron/electron\">auf GitHub</a> und clone deinen fork lokal.</p>\n<pre><code class=\"hljs language-sh\">$ git <span class=\"hljs-built_in\">clone</span> git@github.com:username/electron.git\n$ <span class=\"hljs-built_in\">cd</span> electron\n$ git remote add upstream https://github.com/electron/electron.git\n$ git fetch upstream\n</code></pre>\n<h3 id=\"schritt-2-build\"><a href=\"#schritt-2-build\">Schritt 2: Build</a></h3>\n<p>Build Schritte und Abhängigkeiten unterscheiden sich leicht, abhängig von Deinem Betriebssystem. Lies hier für eine detaillierte Anleitung zum lokalen bauen von Electron Apps:</p>\n<ul>\n<li><a href=\"/docs/development/build-instructions-macos\">Building on macOS</a></li>\n<li><a href=\"/docs/development/build-instructions-linux\">Bauen auf Linux</a></li>\n<li><a href=\"/docs/development/build-instructions-windows\">Bauen auf Windows</a></li>\n</ul>\n<p>Nach dem lokalen bauen des Projekts bist du startklar zum machen von Änderungen!</p>\n<h3 id=\"schritt-3-branch\"><a href=\"#schritt-3-branch\">Schritt 3: Branch</a></h3>\n<p>To keep your development environment organized, create local branches to hold your work. These should be branched directly off of the <code>main</code> branch.</p>\n<pre><code class=\"hljs language-sh\">$ git checkout -b my-branch -t upstream/main\n</code></pre>\n<h2 id=\"mache-die-änderungen\"><a href=\"#mache-die-änderungen\">Mache die Änderungen</a></h2>\n<h3 id=\"schritt-4-code\"><a href=\"#schritt-4-code\">Schritt 4: Code</a></h3>\n<p>Most pull requests opened against the <code>electron/electron</code> repository include changes to either the C/C++ code in the <code>shell/</code> folder, the JavaScript code in the <code>lib/</code> folder, the documentation in <code>docs/api/</code> or tests in the <code>spec/</code> folder.</p>\n<p>Please be sure to run <code>npm run lint</code> from time to time on any code changes to ensure that they follow the project's code style.</p>\n<p>See <a href=\"/docs/development/coding-style\">coding style</a> for more information about best practice when modifying code in different parts of the project.</p>\n<h3 id=\"schritt-5-commit\"><a href=\"#schritt-5-commit\">Schritt 5: Commit</a></h3>\n<p>It is recommended to keep your changes grouped logically within individual commits. Many contributors find it easier to review changes that are split across multiple commits. There is no limit to the number of commits in a pull request.</p>\n<pre><code class=\"hljs language-sh\">$ git add my/changed/files\n$ git commit\n</code></pre>\n<p>Note that multiple commits often get squashed when they are landed.</p>\n<h4 id=\"schritt-5-commit-1\"><a href=\"#schritt-5-commit-1\">Schritt 5: Commit</a></h4>\n<p>A good commit message should describe what changed and why. The Electron project uses <a href=\"https://conventionalcommits.org/\">semantic commit messages</a> to streamline the release process.</p>\n<p>Before a pull request can be merged, it <strong>must</strong> have a pull request title with a semantic prefix.</p>\n<p>Examples of commit messages with semantic prefixes:</p>\n<ul>\n<li><code>fix: don't overwrite prevent_default if default wasn't prevented</code></li>\n<li><code>feat: add app.isPackaged() method</code></li>\n<li><code>docs: app.isDefaultProtocolClient is now available on Linux</code></li>\n</ul>\n<p>Common prefixes:</p>\n<ul>\n<li>fix: A bug fix</li>\n<li>feat: A new feature</li>\n<li>docs: Documentation changes</li>\n<li>test: Adding missing tests or correcting existing tests</li>\n<li>build: Changes that affect the build system</li>\n<li>ci: Changes to our CI configuration files and scripts</li>\n<li>perf: A code change that improves performance</li>\n<li>refactor: A code change that neither fixes a bug nor adds a feature</li>\n<li>style: Changes that do not affect the meaning of the code (linting)</li>\n</ul>\n<p>Other things to keep in mind when writing a commit message:</p>\n<ol>\n<li>The first line should:<ul>\n<li>contain a short description of the change (preferably 50 characters or less, and no more than 72 characters)</li>\n<li>be entirely in lowercase with the exception of proper nouns, acronyms, and the words that refer to code, like function/variable names</li>\n</ul></li>\n<li>Keep the second line blank.</li>\n<li>Wrap all other lines at 72 columns.</li>\n</ol>\n<h4 id=\"breaking-changes\"><a href=\"#breaking-changes\">Breaking Changes</a></h4>\n<p>A commit that has the text <code>BREAKING CHANGE:</code> at the beginning of its optional body or footer section introduces a breaking API change (correlating with Major in semantic versioning). A breaking change can be part of commits of any type. e.g., a <code>fix:</code>, <code>feat:</code> &#x26; <code>chore:</code> types would all be valid, in addition to any other type.</p>\n<p>See <a href=\"https://conventionalcommits.org\">conventionalcommits.org</a> for more details.</p>\n<h3 id=\"schritt-6-rebase\"><a href=\"#schritt-6-rebase\">Schritt 6: Rebase</a></h3>\n<p>Once you have committed your changes, it is a good idea to use <code>git rebase</code> (not <code>git merge</code>) to synchronize your work with the main repository.</p>\n<pre><code class=\"hljs language-sh\">$ git fetch upstream\n$ git rebase upstream/main\n</code></pre>\n<p>This ensures that your working branch has the latest changes from <code>electron/electron</code> main.</p>\n<h3 id=\"schritt-7-teste\"><a href=\"#schritt-7-teste\">Schritt 7: Teste</a></h3>\n<p>Bug fixes and features should always come with tests. A <a href=\"/docs/development/testing\">testing guide</a> has been provided to make the process easier. Looking at other tests to see how they should be structured can also help.</p>\n<p>Before submitting your changes in a pull request, always run the full test suite. To run the tests:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span>\n</code></pre>\n<p>Make sure the linter does not report any issues and that all tests pass. Please do not submit patches that fail either check.</p>\n<p>If you are updating tests and want to run a single spec to check it:</p>\n<pre><code class=\"hljs language-sh\">$ npm run <span class=\"hljs-built_in\">test</span> -match=menu\n</code></pre>\n<p>The above would only run spec modules matching <code>menu</code>, which is useful for anyone who's working on tests that would otherwise be at the very end of the testing cycle.</p>\n<h3 id=\"schritt-8-push\"><a href=\"#schritt-8-push\">Schritt 8: Push</a></h3>\n<p>Once your commits are ready to go -- with passing tests and linting -- begin the process of opening a pull request by pushing your working branch to your fork on GitHub.</p>\n<pre><code class=\"hljs language-sh\">$ git push origin my-branch\n</code></pre>\n<h3 id=\"schritt-9-erstelle-einen-pull-request\"><a href=\"#schritt-9-erstelle-einen-pull-request\">Schritt 9: Erstelle einen Pull Request</a></h3>\n<p>From within GitHub, opening a new pull request will present you with a template that should be filled out:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"xml\"><span class=\"hljs-comment\">&#x3C;!--\nThank you for your pull request. Please provide a description above and review\nthe requirements below.\n\nBug fixes and new features should include tests and possibly benchmarks.\n\nContributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.md\n--></span></span>\n</code></pre>\n<h3 id=\"step-10-discuss-and-update\"><a href=\"#step-10-discuss-and-update\">Step 10: Discuss and update</a></h3>\n<p>You will probably get feedback or requests for changes to your pull request. This is a big part of the submission process so don't be discouraged! Some contributors may sign off on the pull request right away. Others may have detailed comments or feedback. This is a necessary part of the process in order to evaluate whether the changes are correct and necessary.</p>\n<p>To make changes to an existing pull request, make the changes to your local branch, add a new commit with those changes, and push those to your fork. GitHub will automatically update the pull request.</p>\n<pre><code class=\"hljs language-sh\">$ git add my/changed/files\n$ git commit\n$ git push origin my-branch\n</code></pre>\n<p>There are a number of more advanced mechanisms for managing commits using <code>git rebase</code> that can be used, but are beyond the scope of this guide.</p>\n<p>Feel free to post a comment in the pull request to ping reviewers if you are awaiting an answer on something. If you encounter words or acronyms that seem unfamiliar, refer to this <a href=\"https://sites.google.com/a/chromium.org/dev/glossary\">glossary</a>.</p>\n<h4 id=\"approval-and-request-changes-workflow\"><a href=\"#approval-and-request-changes-workflow\">Approval and Request Changes Workflow</a></h4>\n<p>All pull requests require approval from a <a href=\"https://github.com/electron/electron/blob/main/.github/CODEOWNERS\">Code Owner</a> of the area you modified in order to land. Whenever a maintainer reviews a pull request they may request changes. These may be small, such as fixing a typo, or may involve substantive changes. Such requests are intended to be helpful, but at times may come across as abrupt or unhelpful, especially if they do not include concrete suggestions on <em>how</em> to change them.</p>\n<p>Try not to be discouraged. If you feel that a review is unfair, say so or seek the input of another project contributor. Often such comments are the result of a reviewer having taken insufficient time to review and are not ill-intended. Such difficulties can often be resolved with a bit of patience. That said, reviewers should be expected to provide helpful feedback.</p>\n<h3 id=\"step-11-landing\"><a href=\"#step-11-landing\">Step 11: Landing</a></h3>\n<p>In order to land, a pull request needs to be reviewed and approved by at least one Electron Code Owner and pass CI. After that, if there are no objections from other contributors, the pull request can be merged.</p>\n<p>Congratulations and thanks for your contribution!</p>\n<h3 id=\"continuous-integration-testing\"><a href=\"#continuous-integration-testing\">Continuous Integration Testing</a></h3>\n<p>Every pull request is tested on the Continuous Integration (CI) system to confirm that it works on Electron's supported platforms.</p>\n<p>Ideally, the pull request will pass (\"be green\") on all of CI's platforms. This means that all tests pass and there are no linting errors. However, it is not uncommon for the CI infrastructure itself to fail on specific platforms or for so-called \"flaky\" tests to fail (\"be red\"). Each CI failure must be manually inspected to determine the cause.</p>\n<p>CI starts automatically when you open a pull request, but only core maintainers can restart a CI run. If you believe CI is giving a false negative, ask a maintainer to restart the tests.</p>",
      "title": "Pull Requests",
      "description": ""
    },
    "/docs/tutorial/quick-start": {
      "locale": "de-DE",
      "slug": "quick-start",
      "href": "/docs/tutorial/quick-start",
      "crowdinFileId": "256237",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/quick-start.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"schnellstart\"><a href=\"#schnellstart\">Schnellstart</a></h1>\n<p>This guide will step you through the process of creating a barebones Hello World app in Electron, similar to <a href=\"https://github.com/electron/electron-quick-start\"><code>electron/electron-quick-start</code></a>.</p>\n<p>By the end of this tutorial, your app will open a browser window that displays a web page with information about which Chromium, Node.js, and Electron versions are running.</p>\n<h2 id=\"prerequisites\"><a href=\"#prerequisites\">Prerequisites</a></h2>\n<p>To use Electron, you need to install <a href=\"https://nodejs.org/en/download/\">Node.js</a>. We recommend that you use the latest <code>LTS</code> version available.</p>\n<blockquote>\n<p>Please install Node.js using pre-built installers for your platform. You may encounter incompatibility issues with different development tools otherwise.</p>\n</blockquote>\n<p>To check that Node.js was installed correctly, type the following commands in your terminal client:</p>\n<pre><code class=\"hljs language-sh\">node -v\nnpm -v\n</code></pre>\n<p>Die Befehle sollten die entsprechenden Versionen von Node.js und npm ausgeben.</p>\n<p><strong>Note:</strong> Since Electron embeds Node.js into its binary, the version of Node.js running your code is unrelated to the version running on your system.</p>\n<h2 id=\"create-your-application\"><a href=\"#create-your-application\">Create your application</a></h2>\n<h3 id=\"scaffold-the-project\"><a href=\"#scaffold-the-project\">Scaffold the project</a></h3>\n<p>Electron apps follow the same general structure as other Node.js projects. Start by creating a folder and initializing an npm package.</p>\n<pre><code class=\"hljs language-sh\">mkdir my-electron-app &#x26;&#x26; <span class=\"hljs-built_in\">cd</span> my-electron-app\nnpm init\n</code></pre>\n<p>The interactive <code>init</code> command will prompt you to set some fields in your config. There are a few rules to follow for the purposes of this tutorial:</p>\n<ul>\n<li><code>entry point</code> should be <code>main.js</code>.</li>\n<li><code>author</code> and <code>description</code> can be any value, but are necessary for <a href=\"#package-and-distribute-your-application\">app packaging</a>.</li>\n</ul>\n<p>Your <code>package.json</code> file should look something like this:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"name\"</span>: <span class=\"hljs-string\">\"my-electron-app\"</span>,\n  <span class=\"hljs-attr\">\"version\"</span>: <span class=\"hljs-string\">\"1.0.0\"</span>,\n  <span class=\"hljs-attr\">\"description\"</span>: <span class=\"hljs-string\">\"Hello World!\"</span>,\n  <span class=\"hljs-attr\">\"main\"</span>: <span class=\"hljs-string\">\"main.js\"</span>,\n  <span class=\"hljs-attr\">\"author\"</span>: <span class=\"hljs-string\">\"Jane Doe\"</span>,\n  <span class=\"hljs-attr\">\"license\"</span>: <span class=\"hljs-string\">\"MIT\"</span>\n}\n</code></pre>\n<p>Then, install the <code>electron</code> package into your app's <code>devDependencies</code>.</p>\n<pre><code class=\"hljs language-sh\">$ npm install --save-dev electron\n</code></pre>\n<blockquote>\n<p>Note: If you're encountering any issues with installing Electron, please refer to the <a href=\"/docs/tutorial/installation\">Advanced Installation</a> guide.</p>\n</blockquote>\n<p>Finally, you want to be able to execute Electron. In the <a href=\"https://docs.npmjs.com/cli/v7/using-npm/scripts\"><code>scripts</code></a> field of your <code>package.json</code> config, add a <code>start</code> command like so:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"scripts\"</span>: {\n    <span class=\"hljs-attr\">\"start\"</span>: <span class=\"hljs-string\">\"electron .\"</span>\n  }\n}\n</code></pre>\n<p>This <code>start</code> command will let you open your app in development mode.</p>\n<pre><code class=\"hljs language-sh\">npm start\n</code></pre>\n<blockquote>\n<p>Note: This script tells Electron to run on your project's root folder. At this stage, your app will immediately throw an error telling you that it cannot find an app to run.</p>\n</blockquote>\n<h3 id=\"run-the-main-process\"><a href=\"#run-the-main-process\">Run the main process</a></h3>\n<p>The entry point of any Electron application is its <code>main</code> script. This script controls the <strong>main process</strong>, which runs in a full Node.js environment and is responsible for controlling your app's lifecycle, displaying native interfaces, performing privileged operations, and managing renderer processes (more on that later).</p>\n<p>During execution, Electron will look for this script in the <a href=\"https://docs.npmjs.com/cli/v7/configuring-npm/package-json#main\"><code>main</code></a> field of the app's <code>package.json</code> config, which you should have configured during the <a href=\"#scaffold-the-project\">app scaffolding</a> step.</p>\n<p>To initialize the <code>main</code> script, create an empty file named <code>main.js</code> in the root folder of your project.</p>\n<blockquote>\n<p>Note: If you run the <code>start</code> script again at this point, your app will no longer throw any errors! However, it won't do anything yet because we haven't added any code into <code>main.js</code>.</p>\n</blockquote>\n<h3 id=\"create-a-web-page\"><a href=\"#create-a-web-page\">Create a web page</a></h3>\n<p>Before we can create a window for our application, we need to create the content that will be loaded into it. In Electron, each window displays web contents that can be loaded from either from a local HTML file or a remote URL.</p>\n<p>For this tutorial, you will be doing the former. Create an <code>index.html</code> file in the root folder of your project:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-comment\">&#x3C;!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"X-Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    We are using Node.js <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"node-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    Chromium <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"chrome-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    and Electron <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"electron-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>.\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<blockquote>\n<p>Note: Looking at this HTML document, you can observe that the version numbers are missing from the body text. We'll manually insert them later using JavaScript.</p>\n</blockquote>\n<h3 id=\"opening-your-web-page-in-a-browser-window\"><a href=\"#opening-your-web-page-in-a-browser-window\">Opening your web page in a browser window</a></h3>\n<p>Now that you have a web page, load it into an application window. To do so, you'll need two Electron modules:</p>\n<ul>\n<li>The <a href=\"/docs/api/app\"><code>app</code></a> module, which controls your application's event lifecycle.</li>\n<li>The <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> module, which creates and manages application windows.</li>\n</ul>\n<p>Because the main process runs Node.js, you can import these as <a href=\"https://nodejs.org/docs/latest/api/modules.html#modules_modules_commonjs_modules\">CommonJS</a> modules at the top of your file:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>Then, add a <code>createWindow()</code> function that loads <code>index.html</code> into a new <code>BrowserWindow</code> instance.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n</code></pre>\n<p>Next, call this <code>createWindow()</code> function to open your window.</p>\n<p>In Electron, browser windows can only be created after the <code>app</code> module's <a href=\"/docs/api/app#event-ready\"><code>ready</code></a> event is fired. You can wait for this event by using the <a href=\"/docs/api/app#appwhenready\"><code>app.whenReady()</code></a> API. Call <code>createWindow()</code> after <code>whenReady()</code> resolves its Promise.</p>\n<pre><code class=\"hljs language-js\">app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n})\n</code></pre>\n<blockquote>\n<p>Note: At this point, your Electron application should successfully open a window that displays your web page!</p>\n</blockquote>\n<h3 id=\"manage-your-windows-lifecycle\"><a href=\"#manage-your-windows-lifecycle\">Manage your window's lifecycle</a></h3>\n<p>Although you can now open a browser window, you'll need some additional boilerplate code to make it feel more native to each platform. Application windows behave differently on each OS, and Electron puts the responsibility on developers to implement these conventions in their app.</p>\n<p>In general, you can use the <code>process</code> global's <a href=\"https://nodejs.org/api/process.html#process_process_platform\"><code>platform</code></a> attribute to run code specifically for certain operating systems.</p>\n<h4 id=\"quit-the-app-when-all-windows-are-closed-windows--linux\"><a href=\"#quit-the-app-when-all-windows-are-closed-windows--linux\">Quit the app when all windows are closed (Windows &#x26; Linux)</a></h4>\n<p>On Windows and Linux, exiting all windows generally quits an application entirely.</p>\n<p>To implement this, listen for the <code>app</code> module's <a href=\"/docs/api/app#event-window-all-closed\"><code>'window-all-closed'</code></a> event, and call <a href=\"/docs/api/app#appquit\"><code>app.quit()</code></a> if the user is not on macOS (<code>darwin</code>).</p>\n<pre><code class=\"hljs language-js\">app.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n</code></pre>\n<h4 id=\"open-a-window-if-none-are-open-macos\"><a href=\"#open-a-window-if-none-are-open-macos\">Open a window if none are open (macOS)</a></h4>\n<p>Whereas Linux and Windows apps quit when they have no windows open, macOS apps generally continue running even without any windows open, and activating the app when no windows are available should open a new one.</p>\n<p>To implement this feature, listen for the <code>app</code> module's <a href=\"/docs/api/app#event-activate-macos\"><code>activate</code></a> event, and call your existing <code>createWindow()</code> method if no browser windows are open.</p>\n<p>Because windows cannot be created before the <code>ready</code> event, you should only listen for <code>activate</code> events after your app is initialized. Do this by attaching your event listener from within your existing <code>whenReady()</code> callback.</p>\n<pre><code class=\"hljs language-js\">app.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) createWindow()\n  })\n})\n</code></pre>\n<blockquote>\n<p>Note: At this point, your window controls should be fully functional!</p>\n</blockquote>\n<h3 id=\"access-nodejs-from-the-renderer-with-a-preload-script\"><a href=\"#access-nodejs-from-the-renderer-with-a-preload-script\">Access Node.js from the renderer with a preload script</a></h3>\n<p>Now, the last thing to do is print out the version numbers for Electron and its dependencies onto your web page.</p>\n<p>Accessing this information is trivial to do in the main process through Node's global <code>process</code> object. However, you can't just edit the DOM from the main process because it has no access to the renderer's <code>document</code> context. They're in entirely different processes!</p>\n<blockquote>\n<p>Note: If you need a more in-depth look at Electron processes, see the <a href=\"/docs/tutorial/process-model\">Process Model</a> document.</p>\n</blockquote>\n<p>This is where attaching a <strong>preload</strong> script to your renderer comes in handy. A preload script runs before the renderer process is loaded, and has access to both renderer globals (e.g. <code>window</code> and <code>document</code>) and a Node.js environment.</p>\n<p>Create a new script named <code>preload.js</code> as such:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'DOMContentLoaded'</span>, () => {\n  <span class=\"hljs-keyword\">const</span> replaceText = <span class=\"hljs-function\">(<span class=\"hljs-params\">selector, text</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> element = <span class=\"hljs-built_in\">document</span>.getElementById(selector)\n    <span class=\"hljs-keyword\">if</span> (element) element.innerText = text\n  }\n\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> dependency <span class=\"hljs-keyword\">of</span> [<span class=\"hljs-string\">'chrome'</span>, <span class=\"hljs-string\">'node'</span>, <span class=\"hljs-string\">'electron'</span>]) {\n    replaceText(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${dependency}</span>-version`</span>, process.versions[dependency])\n  }\n})\n</code></pre>\n<p>The above code accesses the Node.js <code>process.versions</code> object and runs a basic <code>replaceText</code> helper function to insert the version numbers into the HTML document.</p>\n<p>To attach this script to your renderer process, pass in the path to your preload script to the <code>webPreferences.preload</code> option in your existing <code>BrowserWindow</code> constructor.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// include the Node.js 'path' module at the top of your file</span>\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-comment\">// modify your existing createWindow() function</span>\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n<span class=\"hljs-comment\">// ...</span>\n</code></pre>\n<p>There are two Node.js concepts that are used here:</p>\n<ul>\n<li>The <a href=\"https://nodejs.org/api/modules.html#modules_dirname\"><code>__dirname</code></a> string points to the path of the currently executing script (in this case, your project's root folder).</li>\n<li>The <a href=\"https://nodejs.org/api/path.html#path_path_join_paths\"><code>path.join</code></a> API joins multiple path segments together, creating a combined path string that works across all platforms.</li>\n</ul>\n<p>We use a path relative to the currently executing JavaScript file so that your relative path will work in both development and packaged mode.</p>\n<h3 id=\"bonus-add-functionality-to-your-web-contents\"><a href=\"#bonus-add-functionality-to-your-web-contents\">Bonus: Add functionality to your web contents</a></h3>\n<p>At this point, you might be wondering how to add more functionality to your application.</p>\n<p>For any interactions with your web contents, you want to add scripts to your renderer process. Because the renderer runs in a normal web environment, you can add a <code>&#x3C;script></code> tag right before your <code>index.html</code> file's closing <code>&#x3C;/body></code> tag to include any arbitrary scripts you want:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"./renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<p>The code contained in <code>renderer.js</code> can then use the same JavaScript APIs and tooling you use for typical front-end development, such as using <a href=\"https://webpack.js.org\"><code>webpack</code></a> to bundle and minify your code or <a href=\"https://reactjs.org\">React</a> to manage your user interfaces.</p>\n<h3 id=\"recap\"><a href=\"#recap\">Recap</a></h3>\n<p>After following the above steps, you should have a fully functional Electron application that looks like this:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/simplest-electron-app.png\" alt=\"Simplest Electron app\"></p>\n<!--TODO(erickzhao): Remove the individual code blocks for static website -->\n<p>The full code is available below:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\n\n<span class=\"hljs-comment\">// Modules to control application life and create native browser window</span>\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-comment\">// Create the browser window.</span>\n  <span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>,\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">preload</span>: path.join(__dirname, <span class=\"hljs-string\">'preload.js'</span>)\n    }\n  })\n\n  <span class=\"hljs-comment\">// and load the index.html of the app.</span>\n  mainWindow.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n\n  <span class=\"hljs-comment\">// Open the DevTools.</span>\n  <span class=\"hljs-comment\">// mainWindow.webContents.openDevTools()</span>\n}\n\n<span class=\"hljs-comment\">// This method will be called when Electron has finished</span>\n<span class=\"hljs-comment\">// initialization and is ready to create browser windows.</span>\n<span class=\"hljs-comment\">// Einige APIs können nur nach dem Auftreten dieses Events genutzt werden.</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  createWindow()\n\n  app.on(<span class=\"hljs-string\">'activate'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n    <span class=\"hljs-comment\">// On macOS it's common to re-create a window in the app when the</span>\n    <span class=\"hljs-comment\">// dock icon is clicked and there are no other windows open.</span>\n    <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) createWindow()\n  })\n})\n\n<span class=\"hljs-comment\">// Quit when all windows are closed, except on macOS. There, it's common</span>\n<span class=\"hljs-comment\">// for applications and their menu bar to stay active until the user quits</span>\n<span class=\"hljs-comment\">// explicitly with Cmd + Q.</span>\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) app.quit()\n})\n\n<span class=\"hljs-comment\">// In this file you can include the rest of your app's specific main process</span>\n<span class=\"hljs-comment\">// code. Sie können den Code auch </span>\n<span class=\"hljs-comment\">// auf mehrere Dateien aufteilen und diese hier einbinden.</span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// preload.js</span>\n\n<span class=\"hljs-comment\">// All of the Node.js APIs are available in the preload process.</span>\n<span class=\"hljs-comment\">// It has the same sandbox as a Chrome extension.</span>\n<span class=\"hljs-built_in\">window</span>.addEventListener(<span class=\"hljs-string\">'DOMContentLoaded'</span>, () => {\n  <span class=\"hljs-keyword\">const</span> replaceText = <span class=\"hljs-function\">(<span class=\"hljs-params\">selector, text</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> element = <span class=\"hljs-built_in\">document</span>.getElementById(selector)\n    <span class=\"hljs-keyword\">if</span> (element) element.innerText = text\n  }\n\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> dependency <span class=\"hljs-keyword\">of</span> [<span class=\"hljs-string\">'chrome'</span>, <span class=\"hljs-string\">'node'</span>, <span class=\"hljs-string\">'electron'</span>]) {\n    replaceText(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${dependency}</span>-version`</span>, process.versions[dependency])\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!--index.html--></span>\n\n<span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">charset</span>=<span class=\"hljs-string\">\"UTF-8\"</span>></span>\n    <span class=\"hljs-comment\">&#x3C;!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"X-Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'self'; script-src 'self'\"</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">title</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">title</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">h1</span>></span>Hello World!<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">h1</span>></span>\n    We are using Node.js <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"node-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    Chromium <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"chrome-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>,\n    and Electron <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">span</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"electron-version\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">span</span>></span>.\n\n    <span class=\"hljs-comment\">&#x3C;!-- You can also require other files to run in this process --></span>\n    <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"./renderer.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n  <span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<p>To summarize all the steps we've done:</p>\n<ul>\n<li>\n<p>We bootstrapped a Node.js application and added Electron as a dependency.</p>\n</li>\n<li>\n<p>We created a <code>main.js</code> script that runs our main process, which controls our app\nand runs in a Node.js environment. In this script, we used Electron's <code>app</code> and\n<code>BrowserWindow</code> modules to create a browser window that displays web content\nin a separate process (the renderer).</p>\n</li>\n<li>\n<p>In order to access certain Node.js functionality in the renderer, we attached\na preload script to our <code>BrowserWindow</code> constructor.</p>\n</li>\n</ul>\n<h2 id=\"package-and-distribute-your-application\"><a href=\"#package-and-distribute-your-application\">Package and distribute your application</a></h2>\n<p>The fastest way to distribute your newly created app is using\n<a href=\"https://www.electronforge.io\">Electron Forge</a>.</p>\n<ol>\n<li>\n<p>Add Electron Forge as a development dependency of your app, and use its <code>import</code> command to set up\nForge's scaffolding:</p>\n<pre><code class=\"hljs language-routeros\">```sh npm2yarn\nnpm install --save-dev @electron-forge/cli\nnpx electron-forge import\n\n✔ Checking your<span class=\"hljs-built_in\"> system\n</span>✔ Initializing Git Repository\n✔ Writing modified package.json file\n✔ Installing dependencies\n✔ Writing modified package.json file\n✔ Fixing .gitignore\n\nWe have ATTEMPTED <span class=\"hljs-keyword\">to</span> convert your app <span class=\"hljs-keyword\">to</span> be <span class=\"hljs-keyword\">in</span> a format that electron-forge understands.\n\nThanks <span class=\"hljs-keyword\">for</span> using <span class=\"hljs-string\">\"electron-forge\"</span>!!!\n```\n</code></pre>\n</li>\n<li>\n<p>Create a distributable using Forge's <code>make</code> command:</p>\n<pre><code class=\"hljs language-sh\">npm run make\n\n> my-electron-app@1.0.0 make /my-electron-app\n> electron-forge make\n\n✔ Checking your system\n✔ Resolving Forge Config\nWe need to package your application before we can make it\n✔ Preparing to Package Application <span class=\"hljs-keyword\">for</span> arch: x64\n✔ Preparing native dependencies\n✔ Packaging Application\nMaking <span class=\"hljs-keyword\">for</span> the following targets: zip\n✔ Making <span class=\"hljs-keyword\">for</span> target: zip - On platform: darwin - For arch: x64\n</code></pre>\n<p>Electron Forge creates the <code>out</code> folder where your package will be located:</p>\n<pre><code class=\"hljs language-plain\">// Example for macOS\nout/\n├── out/make/zip/darwin/x64/my-electron-app-darwin-x64-1.0.0.zip\n├── ...\n└── out/my-electron-app-darwin-x64/my-electron-app.app/Contents/MacOS/my-electron-app\n</code></pre>\n</li>\n</ol>",
      "title": "Schnellstart",
      "description": "Please install Node.js using pre-built installers for your platform. You may encounter incompatibility issues with different development tools otherwise."
    },
    "/docs/README": {
      "locale": "de-DE",
      "slug": "README",
      "href": "/docs/README",
      "crowdinFileId": "256115",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/README.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"offizielle-anleitungen\"><a href=\"#offizielle-anleitungen\">Offizielle Anleitungen</a></h1>\n<p>Bitte nutze die Dokumentation, die mit der Version von Electron übereinstimmt. Die Versionsnummer sollte ein Bestandteil der Seiten-URL sein. Falls nicht, verwenden Sie möglicherweise die Dokumentation einer Development Variante, welche eventuell API Änderungen enthält, die nicht mit Ihrer Electron Version kompatibel sind. Um sich ältere Versionen der Dokumentation anzuschauen, können Sie auf GitHub <a href=\"https://github.com/electron/electron/tree/v1.4.0\">nach Tag filtern</a> indem Sie das Dropdownmenü \"Switch branches/tags\" öffnen und den Tag auswählen, der mit Ihrer Version übereinstimmt.</p>\n<h2 id=\"häufig-gestellte-fragen\"><a href=\"#häufig-gestellte-fragen\">Häufig gestellte Fragen</a></h2>\n<p>Es gibt sehr häufig gestellte Fragen. Prüfe das bitte vor dem Erstellen eines Issue:</p>\n<ul>\n<li><a href=\"/docs/faq\">Electron FAQ</a></li>\n</ul>\n<h2 id=\"leitfäden-und-tutorials\"><a href=\"#leitfäden-und-tutorials\">Leitfäden und Tutorials</a></h2>\n<h3 id=\"erste-schritte\"><a href=\"#erste-schritte\">Erste Schritte</a></h3>\n<ul>\n<li><a href=\"/docs/tutorial/introduction\">Einführung</a></li>\n<li><a href=\"/docs/tutorial/quick-start\">Schnellstart</a></li>\n<li><a href=\"/docs/tutorial/process-model\">Prozessmodell</a></li>\n</ul>\n<h3 id=\"ไทย\"><a href=\"#ไทย\">ไทย</a></h3>\n<ul>\n<li>Features zu deiner App hinzufügen<ul>\n<li><a href=\"/docs/tutorial/notifications\">Benachrichtigungen</a></li>\n<li><a href=\"/docs/tutorial/recent-documents\">Kürzliche Dokumente</a></li>\n<li><a href=\"/docs/tutorial/progress-bar\">Anwendungsprozess</a></li>\n<li><a href=\"/docs/tutorial/macos-dock\">Benutzerdefiniertes Dockmenu</a></li>\n<li><a href=\"/docs/tutorial/windows-taskbar\">Benutzerdefinierte Windows Taskleiste</a></li>\n<li><a href=\"/docs/tutorial/linux-desktop-actions\">Benutzerdefinierte Linux Desktop Aktionen</a></li>\n<li><a href=\"/docs/tutorial/keyboard-shortcuts\">Tastenkürzel</a></li>\n<li><a href=\"/docs/tutorial/online-offline-events\">Offline/Online erkennung</a></li>\n<li><a href=\"/docs/tutorial/represented-file\">Repräsentative Datei für macOS BrowserWindows</a></li>\n<li><a href=\"/docs/tutorial/native-file-drag-drop\">Natives Datei Drag &#x26; Drop</a></li>\n<li><a href=\"/docs/tutorial/offscreen-rendering\">Offscreen Rendering</a></li>\n<li><a href=\"/docs/tutorial/dark-mode\">Dark Mode</a></li>\n<li><a href=\"/docs/tutorial/web-embeds\">Einbindung von Webseiten in Electron</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis\">Boilerplates und CLIs</a><ul>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#boilerplate-vs-cli\">Boilerplate vs CLI</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-forge\">electron-forge</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-builder\">electron-builder</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#electron-react-boilerplate\">electron-react-boilerplate</a></li>\n<li><a href=\"/docs/tutorial/boilerplates-and-clis#other-tools-and-boilerplates\">Andere Tools und Boilerplates</a></li>\n</ul></li>\n</ul>\n<h3 id=\"advanced-steps\"><a href=\"#advanced-steps\">Advanced steps</a></h3>\n<ul>\n<li>Anwendungsarchitektur<ul>\n<li><a href=\"/docs/tutorial/using-native-node-modules\">Native Node.js Module benutzen</a></li>\n<li><a href=\"/docs/tutorial/performance\">Performance Strategies</a></li>\n<li><a href=\"/docs/tutorial/security\">Security Strategies</a></li>\n<li><a href=\"/docs/tutorial/sandbox\">Process Sandboxing</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/accessibility\">Barrierefreiheit</a><ul>\n<li><a href=\"/docs/tutorial/accessibility#manually-enabling-accessibility-features\">Manually Enabling Accessibility Features</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/application-debugging\">Testen und Debuggen</a><ul>\n<li><a href=\"/docs/tutorial/debugging-main-process\">Debuggen des Hauptprozesses</a></li>\n<li><a href=\"/docs/tutorial/debugging-vscode\">Debugging with Visual Studio Code</a></li>\n<li><a href=\"/docs/tutorial/using-selenium-and-webdriver\">Verwendung von Selenium und WebDriver</a></li>\n<li><a href=\"/docs/tutorial/testing-on-headless-ci\">Testen auf Headless CI-Systems (Travis, Jenkins)</a></li>\n<li><a href=\"/docs/tutorial/devtools-extension\">DevTools Erweiterung</a></li>\n<li><a href=\"/docs/tutorial/automated-testing-with-a-custom-driver\">Automatisiertes Testen mit einem benutzerdefinierten Treiber</a></li>\n<li><a href=\"/docs/tutorial/repl\">REPL</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/application-distribution\">Distribution</a><ul>\n<li><a href=\"/docs/tutorial/support#supported-platforms\">Unterstützte Plattformen</a></li>\n<li><a href=\"/docs/tutorial/code-signing\">Code Signierung</a></li>\n<li><a href=\"/docs/tutorial/mac-app-store-submission-guide\">Mac App Store</a></li>\n<li><a href=\"/docs/tutorial/windows-store-guide\">Windows Store</a></li>\n<li><a href=\"/docs/tutorial/snapcraft\">Snapcraft</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/updates\">Updates</a><ul>\n<li><a href=\"/docs/tutorial/updates#deploying-an-update-server\">Bereitstellung eines Update-Servers</a></li>\n<li><a href=\"/docs/tutorial/updates#implementing-updates-in-your-app\">Implementieren von Updates in deiner App</a></li>\n<li><a href=\"/docs/tutorial/updates#applying-updates\">Updates anwenden</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/support\">Support erhalten</a></li>\n</ul>\n<h2 id=\"detaillierte-tutorials\"><a href=\"#detaillierte-tutorials\">Detaillierte Tutorials</a></h2>\n<p>Diese individuellen Tutorials bauen auf den Themen auf, die in dem Handbuch weiter oben diskutiert wurden.</p>\n<ul>\n<li><a href=\"/docs/tutorial/installation\">Installiere Electron</a><ul>\n<li><a href=\"/docs/tutorial/installation#proxies\">Proxys</a></li>\n<li><a href=\"/docs/tutorial/installation#custom-mirrors-and-caches\">Benutzerdefinierte Mirrors und Caches</a></li>\n<li><a href=\"/docs/tutorial/installation#troubleshooting\">Problemlösungen</a></li>\n</ul></li>\n<li>Electron Veröffentlichungen &#x26; Entwickler Feedback<ul>\n<li><a href=\"/docs/tutorial/electron-versioning\">Versionsrichtlinie</a></li>\n<li><a href=\"/docs/tutorial/electron-timelines\">Veröffentlichungszeitleisten</a></li>\n</ul></li>\n<li><a href=\"/docs/tutorial/testing-widevine-cdm\">Widevine CDM testen</a></li>\n</ul>\n<hr>\n<ul>\n<li><a href=\"/docs/glossary\">Glossar</a></li>\n</ul>\n<h2 id=\"api-referenz\"><a href=\"#api-referenz\">API-Referenz</a></h2>\n<ul>\n<li><a href=\"/docs/api/synopsis\">Übersicht</a></li>\n<li><a href=\"/docs/api/process\">Prozess-Objekt</a></li>\n<li><a href=\"/docs/api/command-line-switches\">Supported Command Line Switches</a></li>\n<li><a href=\"/docs/api/environment-variables\">Umgebungsvariablen</a></li>\n<li><a href=\"/docs/api/extensions\">Unterstützung für Chrome-Erweiterungen</a></li>\n<li><a href=\"/docs/breaking-changes\">Breaking API Veränderungen</a></li>\n</ul>\n<h3 id=\"benutzerdefinierte-dom-elemente\"><a href=\"#benutzerdefinierte-dom-elemente\">Benutzerdefinierte DOM-Elemente:</a></h3>\n<ul>\n<li><a href=\"/docs/api/file-object\"><code>File</code> Objekt</a></li>\n<li><a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code> Tag</a></li>\n<li><a href=\"/docs/api/window-open\"><code>window.open</code> Funktion</a></li>\n<li><a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code> Objekt</a></li>\n</ul>\n<h3 id=\"module-für-den-hauptprozess\"><a href=\"#module-für-den-hauptprozess\">Module für den Hauptprozess:</a></h3>\n<ul>\n<li><a href=\"/docs/api/app\">app</a></li>\n<li><a href=\"/docs/api/auto-updater\">autoUpdater</a></li>\n<li><a href=\"/docs/api/browser-view\">BrowserView</a></li>\n<li><a href=\"/docs/api/browser-window\">Browserfenster</a></li>\n<li><a href=\"/docs/api/content-tracing\">contentTracing</a></li>\n<li><a href=\"/docs/api/dialog\">dialog</a></li>\n<li><a href=\"/docs/api/global-shortcut\">globalShortcut</a></li>\n<li><a href=\"/docs/api/in-app-purchase\">inAppPurchase</a></li>\n<li><a href=\"/docs/api/ipc-main\">ipcMain</a></li>\n<li><a href=\"/docs/api/menu\">Menü</a></li>\n<li><a href=\"/docs/api/menu-item\">MenuItem</a></li>\n<li><a href=\"/docs/api/message-channel-main\">MessageChannelMain</a></li>\n<li><a href=\"/docs/api/message-port-main\">MessagePortMain</a></li>\n<li><a href=\"/docs/api/net\">net</a></li>\n<li><a href=\"/docs/api/net-log\">netLog</a></li>\n<li><a href=\"/docs/api/native-theme\">nativeTheme</a></li>\n<li><a href=\"/docs/api/notification\">Mitteilung</a></li>\n<li><a href=\"/docs/api/power-monitor\">powerMonitor</a></li>\n<li><a href=\"/docs/api/power-save-blocker\">powerSaveBlocker</a></li>\n<li><a href=\"/docs/api/protocol\">protocol</a></li>\n<li><a href=\"/docs/api/screen\">screen</a></li>\n<li><a href=\"/docs/api/session\">session</a></li>\n<li><a href=\"/docs/api/share-menu\">ShareMenu</a></li>\n<li><a href=\"/docs/api/system-preferences\">systemPreferences</a></li>\n<li><a href=\"/docs/api/touch-bar\">TouchBar</a></li>\n<li><a href=\"/docs/api/tray\">Fach</a></li>\n<li><a href=\"/docs/api/web-contents\">webContents</a></li>\n<li><a href=\"/docs/api/web-frame-main\">webFrameMain</a></li>\n</ul>\n<h3 id=\"module-für-den-renderer-prozess-webseite\"><a href=\"#module-für-den-renderer-prozess-webseite\">Module für den Renderer-Prozess (Webseite):</a></h3>\n<ul>\n<li><a href=\"/docs/api/context-bridge\">kontextBridge</a></li>\n<li><a href=\"/docs/api/ipc-renderer\">ipcRenderer</a></li>\n<li><a href=\"/docs/api/web-frame\">webFrame</a></li>\n</ul>\n<h3 id=\"module-für-beide-prozesse\"><a href=\"#module-für-beide-prozesse\">Module für beide Prozesse:</a></h3>\n<ul>\n<li><a href=\"/docs/api/clipboard\">clipboard</a></li>\n<li><a href=\"/docs/api/crash-reporter\">crashReporter</a></li>\n<li><a href=\"/docs/api/desktop-capturer\">desktopCapturer</a></li>\n<li><a href=\"/docs/api/native-image\">nativeImage</a></li>\n<li><a href=\"/docs/api/shell\">shell</a></li>\n</ul>\n<h2 id=\"entwicklung\"><a href=\"#entwicklung\">Entwicklung</a></h2>\n<p>Siehe <a href=\"/docs/development/README\">development/README.md</a></p>",
      "title": "Offizielle Anleitungen",
      "description": ""
    },
    "/docs/development/README": {
      "locale": "de-DE",
      "slug": "README",
      "href": "/docs/development/README",
      "crowdinFileId": "256127",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/README.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"entwicklung-von-electron\"><a href=\"#entwicklung-von-electron\">Entwicklung von Electron</a></h1>\n<p>Dieses Handbuch wendet sich an Entwickler des Electron Projekts. Guides zur App-Entwicklung für Electron finden sie auf <a href=\"/docs/README#guides-and-tutorials\">/docs/README.md</a>.</p>\n<ul>\n<li><a href=\"https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md\">Verhaltenskodex</a></li>\n<li><a href=\"https://github.com/electron/electron/blob/main/CONTRIBUTING.md\">Zu Electron beitragen</a></li>\n<li><a href=\"/docs/development/issues\">Issues</a></li>\n<li><a href=\"/docs/development/pull-requests\">Pull Requests</a></li>\n<li><a href=\"/docs/development/coding-style#documentation\">Gestaltungsrichtlinien für die Dokumentation</a></li>\n<li><a href=\"/docs/development/source-code-directory-structure\">Struktur des Quellcode-Verzeichnisses</a></li>\n<li><a href=\"/docs/development/coding-style\">Coding Style</a></li>\n<li><a href=\"/docs/development/clang-format\">clang-format im C++ Code verwenden</a></li>\n<li><a href=\"/docs/development/clang-tidy\">Using clang-tidy on C++ Code</a></li>\n<li><a href=\"/docs/development/build-system-overview\">Build System Übersicht</a></li>\n<li><a href=\"/docs/development/build-instructions-macos\">Build Anweisungen (macOS)</a></li>\n<li><a href=\"/docs/development/build-instructions-windows\">Build Anweisungen (Windows)</a></li>\n<li><a href=\"/docs/development/build-instructions-linux\">Build Anweisungen (Linux)</a></li>\n<li><a href=\"/docs/development/chromium-development\">Chromium-Entwicklung</a></li>\n<li><a href=\"/docs/development/v8-development\">V8 Entwicklung</a></li>\n<li><a href=\"/docs/development/testing\">Testen</a></li>\n<li><a href=\"/docs/development/debug-instructions-windows\">Debugging in Windows</a></li>\n<li><a href=\"/docs/development/debugging-instructions-macos\">Debugging in macOS</a></li>\n<li><a href=\"/docs/development/setting-up-symbol-server\">Einrichtung eines Symbol Servers im Debugger</a></li>\n<li><a href=\"/docs/development/patches\">Patches</a></li>\n</ul>",
      "title": "Entwicklung von Electron",
      "description": ""
    },
    "/docs/tutorial/recent-documents": {
      "locale": "de-DE",
      "slug": "recent-documents",
      "href": "/docs/tutorial/recent-documents",
      "crowdinFileId": "256239",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/recent-documents.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"zuletzt-geöffnete-dokumente-windows--macos\"><a href=\"#zuletzt-geöffnete-dokumente-windows--macos\">Zuletzt geöffnete Dokumente (Windows &#x26; macOS)</a></h1>\n<h2 id=\"übersicht\"><a href=\"#übersicht\">Übersicht</a></h2>\n<p>Windos und macOS bieten die Möglichkeit für Apps, die zuletzt geöffneten Dateien in der Taskbar per JumpList oder dock menu anzuzeigen.</p>\n<p><strong>JumpList:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/2289/23446924/11a27b98-fdfc-11e6-8485-cc3b1e86b80a.png\" alt=\"JumpList Zuletzt geöffnete Dateien\"></p>\n<p><strong>Dock Menu einer Anwendung:</strong></p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5069610/2aa80758-6e97-11e4-8cfb-c1a414a10774.png\" alt=\"macOS Dock Menü\"></p>\n<h2 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h2>\n<h3 id=\"managing-recent-documents\"><a href=\"#managing-recent-documents\">Managing recent documents</a></h3>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/recent-documents\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n\n  win.loadFile(<span class=\"hljs-string\">'index.html'</span>)\n}\n\n<span class=\"hljs-keyword\">const</span> fileName = <span class=\"hljs-string\">'recently-used.md'</span>\nfs.writeFile(fileName, <span class=\"hljs-string\">'Lorem Ipsum'</span>, () => {\n  app.addRecentDocument(path.join(__dirname, fileName))\n})\n\napp.whenReady().then(createWindow)\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  app.clearRecentDocuments()\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<h4 id=\"adding-a-recent-document\"><a href=\"#adding-a-recent-document\">Adding a recent document</a></h4>\n<p>To add a file to recent documents, use the <a href=\"/docs/api/app#appaddrecentdocumentpath-macos-windows\">app.addRecentDocument</a> API.</p>\n<p>After launching the Electron application, right click the application icon. In this guide, the item is a Markdown file located in the root of the project. You should see <code>recently-used.md</code> added to the list of recent files:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/recent-documents.png\" alt=\"Recent document\"></p>\n<h4 id=\"clearing-the-list-of-recent-documents\"><a href=\"#clearing-the-list-of-recent-documents\">Clearing the list of recent documents</a></h4>\n<p>To clear the list of recent documents, use the <a href=\"/docs/api/app#appclearrecentdocuments-macos-windows\">app.clearRecentDocuments</a> API. In this guide, the list of documents is cleared once all windows have been closed.</p>\n<h2 id=\"additional-information\"><a href=\"#additional-information\">Additional information</a></h2>\n<h3 id=\"bemerkungen-zu-windows\"><a href=\"#bemerkungen-zu-windows\">Bemerkungen zu Windows</a></h3>\n<p>To use this feature on Windows, your application has to be registered as a handler of the file type of the document, otherwise the file won't appear in JumpList even after you have added it. You can find everything on registering your application in <a href=\"https://msdn.microsoft.com/en-us/library/cc144104(VS.85).aspx\">Application Registration</a>.</p>\n<p>Sobald ein Nutzer auf eine Datei in der JumpList klickt, wird eine neue Instanz Ihrer Anwendung gestartet mit dem Pfad der Datei als Befehlszeilenargument.</p>\n<h3 id=\"bemerkungen-zu-macos\"><a href=\"#bemerkungen-zu-macos\">Bemerkungen zu macOS</a></h3>\n<h4 id=\"add-the-recent-documents-list-to-the-application-menu\"><a href=\"#add-the-recent-documents-list-to-the-application-menu\">Add the Recent Documents list to the application menu</a></h4>\n<p>You can add menu items to access and clear recent documents by adding the following code snippet to your menu template:</p>\n<pre><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"submenu\"</span>:[\n    {\n      <span class=\"hljs-attr\">\"label\"</span>:<span class=\"hljs-string\">\"Open Recent\"</span>,\n      <span class=\"hljs-attr\">\"role\"</span>:<span class=\"hljs-string\">\"recentdocuments\"</span>,\n      <span class=\"hljs-attr\">\"submenu\"</span>:[\n        {\n          <span class=\"hljs-attr\">\"label\"</span>:<span class=\"hljs-string\">\"Clear Recent\"</span>,\n          <span class=\"hljs-attr\">\"role\"</span>:<span class=\"hljs-string\">\"clearrecentdocuments\"</span>\n        }\n      ]\n    }\n  ]\n}\n</code></pre>\n<p>Make sure the application menu is added after the <a href=\"/docs/api/app#event-ready\"><code>'ready'</code></a> event and not before, or the menu item will be disabled:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> template = [\n  <span class=\"hljs-comment\">// Menu template here</span>\n]\n<span class=\"hljs-keyword\">const</span> menu = Menu.buildFromTemplate(template)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  Menu.setApplicationMenu(menu)\n})\n</code></pre>\n<p><img src=\"https://user-images.githubusercontent.com/3168941/33003655-ea601c3a-cd70-11e7-97fa-7c062149cfb1.png\" alt=\"macOS Recent Documents menu item\"></p>\n<p>Sobald eine Datei vom Menu der zuletzt hinzugefügten Dateien angefordert wird, so wird dafür das <code>open-file</code>-Event des <code>app</code>-Moduls ausgeworfen.</p>",
      "title": "Zuletzt geöffnete Dokumente (Windows & macOS)",
      "description": ""
    },
    "/docs/api/structures/rectangle": {
      "locale": "de-DE",
      "slug": "rectangle",
      "href": "/docs/api/structures/rectangle",
      "crowdinFileId": "256493",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/rectangle.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"rectangle-object\"><a href=\"#rectangle-object\">Rectangle Object</a></h1>\n<ul>\n<li><code>x</code> Number - The x coordinate of the origin of the rectangle (must be an integer).</li>\n<li><code>y</code> Number - The y coordinate of the origin of the rectangle (must be an integer).</li>\n<li><code>width</code> Number - The width of the rectangle (must be an integer).</li>\n<li><code>height</code> Number - The height of the rectangle (must be an integer).</li>\n</ul>",
      "title": "Rectangle Object",
      "description": ""
    },
    "/docs/api/structures/referrer": {
      "locale": "de-DE",
      "slug": "referrer",
      "href": "/docs/api/structures/referrer",
      "crowdinFileId": "256495",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/referrer.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"referrer-object\"><a href=\"#referrer-object\">Referrer Object</a></h1>\n<ul>\n<li><code>url</code> String - HTTP Referrer URL.</li>\n<li><code>policy</code> String - Can be <code>default</code>, <code>unsafe-url</code>, <code>no-referrer-when-downgrade</code>, <code>no-referrer</code>, <code>origin</code>, <code>strict-origin-when-cross-origin</code>, <code>same-origin</code> or <code>strict-origin</code>. See the <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy\">Referrer-Policy spec</a> for more details on the meaning of these values.</li>\n</ul>",
      "title": "Referrer Object",
      "description": ""
    },
    "/docs/tutorial/repl": {
      "locale": "de-DE",
      "slug": "repl",
      "href": "/docs/tutorial/repl",
      "crowdinFileId": "256241",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/repl.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"repl\"><a href=\"#repl\">REPL</a></h1>\n<p><a href=\"https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop\">Read-Eval-Print-Loop</a> (REPL) is a simple, interactive computer programming environment that takes single user inputs (i.e. single expressions), evaluates them, and returns the result to the user.</p>\n<h2 id=\"main-process\"><a href=\"#main-process\">Main process</a></h2>\n<p>Electron exposes the <a href=\"https://nodejs.org/dist/latest/docs/api/repl.html\">Node.js <code>repl</code> module</a> through the <code>--interactive</code> CLI flag. Assuming you have <code>electron</code> installed as a local project dependency, you should be able to access the REPL with the following command:</p>\n<pre><code class=\"hljs language-sh\">./node_modules/.bin/electron --interactive\n</code></pre>\n<p><strong>Note:</strong> <code>electron --interactive</code> is not available on Windows (see <a href=\"https://github.com/electron/electron/pull/5776\">electron/electron#5776</a> for more details).</p>\n<h2 id=\"renderer-process\"><a href=\"#renderer-process\">Renderer process</a></h2>\n<p>You can use the DevTools Console tab to get a REPL for any renderer process. To learn more, read <a href=\"https://developer.chrome.com/docs/devtools/console/\">the Chrome documentation</a>.</p>",
      "title": "REPL",
      "description": ""
    },
    "/docs/tutorial/represented-file": {
      "locale": "de-DE",
      "slug": "represented-file",
      "href": "/docs/tutorial/represented-file",
      "crowdinFileId": "256243",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/represented-file.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"representing-files-in-a-browserwindow-macos\"><a href=\"#representing-files-in-a-browserwindow-macos\">Representing Files in a BrowserWindow (macOS)</a></h1>\n<h2 id=\"übersicht\"><a href=\"#übersicht\">Übersicht</a></h2>\n<p>On macOS, you can set a represented file for any window in your application. The represented file's icon will be shown in the title bar, and when users <code>Command-Click</code> or <code>Control-Click</code>, a popup with a path to the file will be shown.</p>\n<p><img src=\"https://cloud.githubusercontent.com/assets/639601/5082061/670a949a-6f14-11e4-987a-9aaa04b23c1d.png\" alt=\"Represented File\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example where this feature is used to indicate the currently opened file in the Atom text editor.</p>\n</blockquote>\n<p>You can also set the edited state for a window so that the file icon can indicate whether the document in this window has been modified.</p>\n<p>To set the represented file of window, you can use the <a href=\"/docs/api/browser-window#winsetrepresentedfilenamefilename-macos\">BrowserWindow.setRepresentedFilename</a> and <a href=\"/docs/api/browser-window#winsetdocumenteditededited-macos\">BrowserWindow.setDocumentEdited</a> APIs.</p>\n<h2 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h2>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/features/represented-file\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>);\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">createWindow</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n}\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.setRepresentedFilename(os.homedir())\n  win.setDocumentEdited(<span class=\"hljs-literal\">true</span>)\n})\n\napp.on(<span class=\"hljs-string\">'window-all-closed'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'darwin'</span>) {\n    app.quit()\n  }\n})\n\napp.on(<span class=\"hljs-string\">'activate'</span>, () => {\n  <span class=\"hljs-keyword\">if</span> (BrowserWindow.getAllWindows().length === <span class=\"hljs-number\">0</span>) {\n    createWindow()\n  }\n})\n</code></pre>\n<p>After launching the Electron application, click on the title with <code>Command</code> or <code>Control</code> key pressed. You should see a popup with the represented file at the top. In this guide, this is the current user's home directory:</p>\n<p><img src=\"https://cdn.rawgit.com/electron/electron/v15.1.1//docs/images/represented-file.png\" alt=\"Represented file\"></p>",
      "title": "Representing Files in a BrowserWindow (macOS)",
      "description": "NOTE: The screenshot above is an example where this feature is used to indicate the currently opened file in the Atom text editor."
    },
    "/docs/api/safe-storage": {
      "locale": "de-DE",
      "slug": "safe-storage",
      "href": "/docs/api/safe-storage",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/safe-storage.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"safestorage\"><a href=\"#safestorage\">safeStorage</a></h1>\n<blockquote>\n<p>Allows access to simple encryption and decryption of strings for storage on the local machine.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p>This module protects data stored on disk from being accessed by other applications or users with full disk access.</p>\n<p>Note that on Mac, access to the system Keychain is required and these calls can block the current thread to collect user input. The same is true for Linux, if a password management tool is available.</p>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das Modul <code>safeStorage</code> verfügt über die folgenden Methoden:</p>\n<h3 id=\"safestorageisencryptionavailable\"><a href=\"#safestorageisencryptionavailable\"><code>safeStorage.isEncryptionAvailable()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether encryption is available.</p>\n<p>On Linux, returns true if the secret key is available. On MacOS, returns true if Keychain is available. On Windows, returns true with no other preconditions.</p>\n<h3 id=\"safestorageencryptstringplaintext\"><a href=\"#safestorageencryptstringplaintext\"><code>safeStorage.encryptString(plainText)</code></a></h3>\n<ul>\n<li><code>plainText</code> Zeichenkette</li>\n</ul>\n<p>Returns <code>Buffer</code> -  An array of bytes representing the encrypted string.</p>\n<p>This function will throw an error if encryption fails.</p>\n<h3 id=\"safestoragedecryptstringencrypted\"><a href=\"#safestoragedecryptstringencrypted\"><code>safeStorage.decryptString(encrypted)</code></a></h3>\n<ul>\n<li><code>encrypted</code> Puffer</li>\n</ul>\n<p>Returns <code>String</code> - the decrypted string. Decrypts the encrypted buffer obtained  with <code>safeStorage.encryptString</code> back into a string.</p>\n<p>This function will throw an error if decryption fails.</p>",
      "title": "safeStorage",
      "description": "Allows access to simple encryption and decryption of strings for storage on the local machine."
    },
    "/docs/tutorial/sandbox": {
      "locale": "de-DE",
      "slug": "sandbox",
      "href": "/docs/tutorial/sandbox",
      "crowdinFileId": "256245",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/sandbox.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"process-sandboxing\"><a href=\"#process-sandboxing\">Process-Sandboxing</a></h1>\n<p>One key security feature in Chromium is that processes can be executed within a sandbox. The sandbox limits the harm that malicious code can cause by limiting access to most system resources — sandboxed processes can only freely use CPU cycles and memory. In order to perform operations requiring additional privilege, sandboxed processes use dedicated communication channels to delegate tasks to more privileged processes.</p>\n<p>In Chromium, sandboxing is applied to most processes other than the main process. This includes renderer processes, as well as utility processes such as the audio service, the GPU service and the network service.</p>\n<p>See Chromium's <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/design/sandbox.md\">Sandbox design document</a> for more information.</p>\n<h2 id=\"electrons-sandboxing-policies\"><a href=\"#electrons-sandboxing-policies\">Electron's sandboxing policies</a></h2>\n<p>Electron comes with a mixed sandbox environment, meaning sandboxed processes can run alongside privileged ones. By default, renderer processes are not sandboxed, but utility processes are. Note that as in Chromium, the main (browser) process is privileged and cannot be sandboxed.</p>\n<p>Historically, this mixed sandbox approach was established because having Node.js available in the renderer is an extremely powerful tool for app developers. Unfortunately, this feature is also an equally massive security vulnerability.</p>\n<p>Theoretically, unsandboxed renderers are not a problem for desktop applications that only display trusted code, but they make Electron less secure than Chromium for displaying untrusted web content. However, even purportedly trusted code may be dangerous — there are countless attack vectors that malicious actors can use, from cross-site scripting to content injection to man-in-the-middle attacks on remotely loaded websites, just to name a few. For this reason, we recommend enabling renderer sandboxing for the vast majority of cases under an abundance of caution.</p>\n<!--TODO: update this guide when #28466 is either solved or closed -->\n<p>Note that there is an active discussion in the issue tracker to enable renderer sandboxing by default. See <a href=\"https://github.com/electron/electron/issues/28466\">#28466</a>) for details.</p>\n<h2 id=\"sandbox-behaviour-in-electron\"><a href=\"#sandbox-behaviour-in-electron\">Sandbox behaviour in Electron</a></h2>\n<p>Sandboxed processes in Electron behave <em>mostly</em> in the same way as Chromium's do, but Electron has a few additional concepts to consider because it interfaces with Node.js.</p>\n<h3 id=\"renderer-processes\"><a href=\"#renderer-processes\">Renderer processes</a></h3>\n<p>When renderer processes in Electron are sandboxed, they behave in the same way as a regular Chrome renderer would. A sandboxed renderer won't have a Node.js environment initialized.</p>\n<!-- TODO(erickzhao): when we have a solid guide for IPC, link it here -->\n<p>Therefore, when the sandbox is enabled, renderer processes can only perform privileged tasks (such as interacting with the filesystem, making changes to the system, or spawning subprocesses) by delegating these tasks to the main process via inter-process communication (IPC).</p>\n<h3 id=\"preload-scripts\"><a href=\"#preload-scripts\">Preload scripts</a></h3>\n<p>In order to allow renderer processes to communicate with the main process, preload scripts attached to sandboxed renderers will still have a polyfilled subset of Node.js APIs available. A <code>require</code> function similar to Node's <code>require</code> module is exposed, but can only import a subset of Electron and Node's built-in modules:</p>\n<ul>\n<li><code>electron</code> (only renderer process modules)</li>\n<li><a href=\"https://nodejs.org/api/events.html\"><code>ereignisse</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html\"><code>timers</code></a></li>\n<li><a href=\"https://nodejs.org/api/url.html\"><code>url</code></a></li>\n</ul>\n<p>In addition, the preload script also polyfills certain Node.js primitives as globals:</p>\n<ul>\n<li><a href=\"https://nodejs.org/api/Buffer.html\"><code>Buffer</code></a></li>\n<li><a href=\"/docs/api/process\"><code>process</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html#timers_clearimmediate_immediate\"><code>clearImmediate</code></a></li>\n<li><a href=\"https://nodejs.org/api/timers.html#timers_setimmediate_callback_args\"><code>setImmediate</code></a></li>\n</ul>\n<p>Because the <code>require</code> function is a polyfill with limited functionality, you will not be able to use <a href=\"https://nodejs.org/api/modules.html#modules_modules_commonjs_modules\">CommonJS modules</a> to separate your preload script into multiple files. If you need to split your preload code, use a bundler such as <a href=\"https://webpack.js.org/\">webpack</a> or <a href=\"https://parceljs.org/\">Parcel</a>.</p>\n<p>Note that because the environment presented to the <code>preload</code> script is substantially more privileged than that of a sandboxed renderer, it is still possible to leak privileged APIs to untrusted code running in the renderer process unless <a href=\"/docs/tutorial/context-isolation\"><code>contextIsolation</code></a> is enabled.</p>\n<h2 id=\"configuring-the-sandbox\"><a href=\"#configuring-the-sandbox\">Configuring the sandbox</a></h2>\n<h3 id=\"enabling-the-sandbox-for-a-single-process\"><a href=\"#enabling-the-sandbox-for-a-single-process\">Enabling the sandbox for a single process</a></h3>\n<p>In Electron, renderer sandboxing can be enabled on a per-process basis with the <code>sandbox: true</code> preference in the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> constructor.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webPreferences</span>: {\n      <span class=\"hljs-attr\">sandbox</span>: <span class=\"hljs-literal\">true</span>\n    }\n  })\n  win.loadURL(<span class=\"hljs-string\">'https://google.com'</span>)\n})\n</code></pre>\n<h3 id=\"enabling-the-sandbox-globally\"><a href=\"#enabling-the-sandbox-globally\">Enabling the sandbox globally</a></h3>\n<p>If you want to force sandboxing for all renderers, you can also use the <a href=\"/docs/api/app#appenablesandbox\"><code>app.enableSandbox</code></a> API. Note that this API has to be called before the app's <code>ready</code> event.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// main.js</span>\napp.enableSandbox()\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-comment\">// no need to pass `sandbox: true` since `app.enableSandbox()` was called.</span>\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://google.com'</span>)\n})\n</code></pre>\n<h3 id=\"disabling-chromiums-sandbox-testing-only\"><a href=\"#disabling-chromiums-sandbox-testing-only\">Disabling Chromium's sandbox (testing only)</a></h3>\n<p>You can also disable Chromium's sandbox entirely with the <a href=\"/docs/api/command-line-switches#--no-sandbox\"><code>--no-sandbox</code></a> CLI flag, which will disable the sandbox for all processes (including utility processes). We highly recommend that you only use this flag for testing purposes, and <strong>never</strong> in production.</p>\n<p>Note that the <code>sandbox: true</code> option will still disable the renderer's Node.js environment.</p>\n<h2 id=\"a-note-on-rendering-untrusted-content\"><a href=\"#a-note-on-rendering-untrusted-content\">A note on rendering untrusted content</a></h2>\n<p>Rendering untrusted content in Electron is still somewhat uncharted territory, though some apps are finding success (e.g. <a href=\"https://github.com/beakerbrowser/beaker\">Beaker Browser</a>). Our goal is to get as close to Chrome as we can in terms of the security of sandboxed content, but ultimately we will always be behind due to a few fundamental issues:</p>\n<ol>\n<li>We do not have the dedicated resources or expertise that Chromium has to apply to the security of its product. We do our best to make use of what we have, to inherit everything we can from Chromium, and to respond quickly to security issues, but Electron cannot be as secure as Chromium without the resources that Chromium is able to dedicate.</li>\n<li>Some security features in Chrome (such as Safe Browsing and Certificate Transparency) require a centralized authority and dedicated servers, both of which run counter to the goals of the Electron project. As such, we disable those features in Electron, at the cost of the associated security they would otherwise bring.</li>\n<li>There is only one Chromium, whereas there are many thousands of apps built on Electron, all of which behave slightly differently. Accounting for those differences can yield a huge possibility space, and make it challenging to ensure the security of the platform in unusual use cases.</li>\n<li>We can't push security updates to users directly, so we rely on app vendors to upgrade the version of Electron underlying their app in order for security updates to reach users.</li>\n</ol>\n<p>While we make our best effort to backport Chromium security fixes to older versions of Electron, we do not make a guarantee that every fix will be backported. Your best chance at staying secure is to be on the latest stable version of Electron.</p>",
      "title": "Process-Sandboxing",
      "description": ""
    },
    "/docs/api/screen": {
      "locale": "de-DE",
      "slug": "screen",
      "href": "/docs/api/screen",
      "crowdinFileId": "256361",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/screen.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"screen\"><a href=\"#screen\">screen</a></h1>\n<blockquote>\n<p>Retrieve information about screen size, displays, cursor position, etc.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p>This module cannot be used until the <code>ready</code> event of the <code>app</code> module is emitted.</p>\n<p><code>screen</code> ist ein <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<p><strong>Note:</strong> In the renderer / DevTools, <code>window.screen</code> is a reserved DOM property, so writing <code>let { screen } = require('electron')</code> will not work.</p>\n<p>An example of creating a window that fills the whole screen:</p>\n<pre><code class=\"hljs language-javascript\" data-fiddle-url=\"electron/v15.1.1/docs/fiddles/screen/fit-screen\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, screen } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> { width, height } = screen.getPrimaryDisplay().workAreaSize\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ width, height })\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>Another example of creating a window in the external display:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, screen } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> displays = screen.getAllDisplays()\n  <span class=\"hljs-keyword\">const</span> externalDisplay = displays.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">display</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> display.bounds.x !== <span class=\"hljs-number\">0</span> || display.bounds.y !== <span class=\"hljs-number\">0</span>\n  })\n\n  <span class=\"hljs-keyword\">if</span> (externalDisplay) {\n    win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n      <span class=\"hljs-attr\">x</span>: externalDisplay.bounds.x + <span class=\"hljs-number\">50</span>,\n      <span class=\"hljs-attr\">y</span>: externalDisplay.bounds.y + <span class=\"hljs-number\">50</span>\n    })\n    win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  }\n})\n</code></pre>\n<h2 id=\"ereignisse\"><a href=\"#ereignisse\">Ereignisse</a></h2>\n<p>Das <code>screen</code> Modul sendet folgende Ereignisse aus:</p>\n<h3 id=\"event-display-added\"><a href=\"#event-display-added\">Event: 'display-added'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newDisplay</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n</ul>\n<p>Emitted when <code>newDisplay</code> has been added.</p>\n<h3 id=\"event-display-removed\"><a href=\"#event-display-removed\">Event: 'display-removed'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>oldDisplay</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n</ul>\n<p>Emitted when <code>oldDisplay</code> has been removed.</p>\n<h3 id=\"event-display-metrics-changed\"><a href=\"#event-display-metrics-changed\">Event: 'display-metrics-changed'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>display</code> <a href=\"/docs/api/structures/display\">Display</a></li>\n<li><code>changedMetrics</code> String[]</li>\n</ul>\n<p>Emitted when one or more metrics change in a <code>display</code>. The <code>changedMetrics</code> is an array of strings that describe the changes. Possible changes are <code>bounds</code>, <code>workArea</code>, <code>scaleFactor</code> and <code>rotation</code>.</p>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das Modul <code>screen</code> verfügt über die folgenden Methoden:</p>\n<h3 id=\"screengetcursorscreenpoint\"><a href=\"#screengetcursorscreenpoint\"><code>screen.getCursorScreenPoint()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>The current absolute position of the mouse pointer.</p>\n<p><strong>Note:</strong> The return value is a DIP point, not a screen physical point.</p>\n<h3 id=\"screengetprimarydisplay\"><a href=\"#screengetprimarydisplay\"><code>screen.getPrimaryDisplay()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/display\"><code>Display</code></a> - The primary display.</p>\n<h3 id=\"screengetalldisplays\"><a href=\"#screengetalldisplays\"><code>screen.getAllDisplays()</code></a></h3>\n<p>Returns <a href=\"/docs/api/structures/display\"><code>Display[]</code></a> - An array of displays that are currently available.</p>\n<h3 id=\"screengetdisplaynearestpointpoint\"><a href=\"#screengetdisplaynearestpointpoint\"><code>screen.getDisplayNearestPoint(point)</code></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/display\"><code>Display</code></a> - The display nearest the specified point.</p>\n<h3 id=\"screengetdisplaymatchingrect\"><a href=\"#screengetdisplaymatchingrect\"><code>screen.getDisplayMatching(rect)</code></a></h3>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/display\"><code>Display</code></a> - The display that most closely intersects the provided bounds.</p>\n<h3 id=\"screenscreentodippointpoint-windows\"><a href=\"#screenscreentodippointpoint-windows\"><code>screen.screenToDipPoint(point)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>Converts a screen physical point to a screen DIP point. The DPI scale is performed relative to the display containing the physical point.</p>\n<h3 id=\"screendiptoscreenpointpoint-windows\"><a href=\"#screendiptoscreenpointpoint-windows\"><code>screen.dipToScreenPoint(point)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>point</code> <a href=\"/docs/api/structures/point\">Point</a></li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/point\"><code>Point</code></a></p>\n<p>Converts a screen DIP point to a screen physical point. The DPI scale is performed relative to the display containing the DIP point.</p>\n<h3 id=\"screenscreentodiprectwindow-rect-windows\"><a href=\"#screenscreentodiprectwindow-rect-windows\"><code>screen.screenToDipRect(window, rect)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | null</li>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Gibt <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> zurück</p>\n<p>Converts a screen physical rect to a screen DIP rect. The DPI scale is performed relative to the display nearest to <code>window</code>. If <code>window</code> is null, scaling will be performed to the display nearest to <code>rect</code>.</p>\n<h3 id=\"screendiptoscreenrectwindow-rect-windows\"><a href=\"#screendiptoscreenrectwindow-rect-windows\"><code>screen.dipToScreenRect(window, rect)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>window</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> | null</li>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul>\n<p>Gibt <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> zurück</p>\n<p>Converts a screen DIP rect to a screen physical rect. The DPI scale is performed relative to the display nearest to <code>window</code>. If <code>window</code> is null, scaling will be performed to the display nearest to <code>rect</code>.</p>",
      "title": "screen",
      "description": "Retrieve information about screen size, displays, cursor position, etc."
    },
    "/docs/api/structures/scrubber-item": {
      "locale": "de-DE",
      "slug": "scrubber-item",
      "href": "/docs/api/structures/scrubber-item",
      "crowdinFileId": "256497",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/scrubber-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"scrubberitem-object\"><a href=\"#scrubberitem-object\">ScrubberItem Object</a></h1>\n<ul>\n<li><code>label</code> String (optional) - The text to appear in this item.</li>\n<li><code>icon</code> NativeImage (optional) - The image to appear in this item.</li>\n</ul>",
      "title": "ScrubberItem Object",
      "description": ""
    },
    "/docs/tutorial/security": {
      "locale": "de-DE",
      "slug": "security",
      "href": "/docs/tutorial/security",
      "crowdinFileId": "256247",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/security.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"sicherheit-native-fähigkeiten-und-ihre-eigene-verantwortung\"><a href=\"#sicherheit-native-fähigkeiten-und-ihre-eigene-verantwortung\">Sicherheit, native Fähigkeiten und Ihre eigene Verantwortung</a></h1>\n<p>Als Webentwickler genießen wir normalerweise das starke Sicherheitsnetz des Browsers - Die Risiken, die mit dem von uns geschriebenen Code verbunden sind, sind relativ gering. Unseren Websites werden in einer Sandbox mit begrenzten Befugnissen ausgeführt und wir vertrauen darauf, dass unsere Benutzer einen Browser verwenden, der von einem großen Team von Ingenieuren entwickelt wurde und der in der Lage ist, schnell auf neu entdeckte Sicherheitsbedrohungen zu reagieren.</p>\n<p>Bei der Arbeit mit Electron ist es wichtig zu verstehen, dass Electron kein Webbrowser ist. Es erlaubt Ihnen, funktionstüchtige Desktop-Anwendungen mit vertrauten Web-Technologien zu erstellen, aber Ihr Code hat viel mehr Kraft. JavaScript kann auf das Dateisystem, die Benutzer-Shell und einiges mehr zugreifen. Dies erlaubt Ihnen, hochqualitative native Anwendungen zu erstellen, aber die inhärenten Sicherheitsrisiken skalieren mit den zusätzlichen Befugnissen, die Ihrem Code gewährt werden.</p>\n<p>Vor diesem Hintergrund sollten Sie sich bewusst sein, dass die Anzeige willkürlicher Inhalte aus nicht vertrauenswürdigen Quellen ein ernstes Sicherheitsrisiko darstellt, dass Electron nicht vollständig verhindern kann. Tatsächlich werden die beliebtesten Electron-Apps (Atom, Slack, Visual Studio Code, etc) in erster Linie lokale Inhalte anzeigen (oder vertrauenswürdige und sichere Remote-Inhalte ohne Node-Integration) – wenn Ihre Anwendung jedoch Code aus einer Online-Quelle ausführt, liegt es in Ihrer Verantwortung sicherzustellen, dass der Code nicht bösartig ist.</p>\n<h2 id=\"melden-von-sicherheitsproblemen\"><a href=\"#melden-von-sicherheitsproblemen\">Melden von Sicherheitsproblemen</a></h2>\n<p>Informationen dazu, wie sie eine Electron-Sicherheitslücke richtig melden können, finden Sie unter <a href=\"https://github.com/electron/electron/tree/main/SECURITY.md\">SECURITY.md</a></p>\n<h2 id=\"chromium-sicherheitsprobleme-und-updates\"><a href=\"#chromium-sicherheitsprobleme-und-updates\">Chromium Sicherheitsprobleme und Updates</a></h2>\n<p>Electron keeps up to date with alternating Chromium releases. For more information, see the <a href=\"https://electronjs.org/blog/12-week-cadence\">Electron Release Cadence blog post</a>.</p>\n<h2 id=\"security-is-everyones-responsibility\"><a href=\"#security-is-everyones-responsibility\">Security Is Everyone's Responsibility</a></h2>\n<p>It is important to remember that the security of your Electron application is the result of the overall security of the framework foundation (<em>Chromium</em>, <em>Node.js</em>), Electron itself, all NPM dependencies and your code. As such, it is your responsibility to follow a few important best practices:</p>\n<ul>\n<li>\n<p><strong>Keep your application up-to-date with the latest Electron framework release.</strong> When releasing your product, you’re also shipping a bundle composed of Electron, Chromium shared library and Node.js. Vulnerabilities affecting these components may impact the security of your application. By updating Electron to the latest version, you ensure that critical vulnerabilities (such as <em>nodeIntegration bypasses</em>) are already patched and cannot be exploited in your application. For more information, see \"<a href=\"#16-use-a-current-version-of-electron\">Use a current version of Electron</a>\".</p>\n</li>\n<li>\n<p><strong>Evaluate your dependencies.</strong> While NPM provides half a million reusable packages, it is your responsibility to choose trusted 3rd-party libraries. If you use outdated libraries affected by known vulnerabilities or rely on poorly maintained code, your application security could be in jeopardy.</p>\n</li>\n<li>\n<p><strong>Adopt secure coding practices.</strong> The first line of defense for your application is your own code. Common web vulnerabilities, such as Cross-Site Scripting (XSS), have a higher security impact on Electron applications hence it is highly recommended to adopt secure software development best practices and perform security testing.</p>\n</li>\n</ul>\n<h2 id=\"isolation-for-untrusted-content\"><a href=\"#isolation-for-untrusted-content\">Isolation For Untrusted Content</a></h2>\n<p>A security issue exists whenever you receive code from an untrusted source (e.g. a remote server) and execute it locally. As an example, consider a remote website being displayed inside a default <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. If an attacker somehow manages to change said content (either by attacking the source directly, or by sitting between your app and the actual destination), they will be able to execute native code on the user's machine.</p>\n<blockquote>\n<p>⚠️ Under no circumstances should you load and execute remote code with Node.js integration enabled. Instead, use only local files (packaged together with your application) to execute Node.js code. To display remote content, use the <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> tag or <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, make sure to disable the <code>nodeIntegration</code> and enable <code>contextIsolation</code>.</p>\n</blockquote>\n<h2 id=\"electron-sicherheitswarnungen\"><a href=\"#electron-sicherheitswarnungen\">Electron Sicherheitswarnungen</a></h2>\n<p>From Electron 2.0 on, developers will see warnings and recommendations printed to the developer console. They only show up when the binary's name is Electron, indicating that a developer is currently looking at the console.</p>\n<p>You can force-enable or force-disable these warnings by setting <code>ELECTRON_ENABLE_SECURITY_WARNINGS</code> or <code>ELECTRON_DISABLE_SECURITY_WARNINGS</code> on either <code>process.env</code> or the <code>window</code> object.</p>\n<h2 id=\"checklist-security-recommendations\"><a href=\"#checklist-security-recommendations\">Checklist: Security Recommendations</a></h2>\n<p>You should at least follow these steps to improve the security of your application:</p>\n<ol>\n<li><a href=\"#1-only-load-secure-content\">Only load secure content</a></li>\n<li><a href=\"#2-do-not-enable-nodejs-integration-for-remote-content\">Disable the Node.js integration in all renderers that display remote content</a></li>\n<li><a href=\"#3-enable-context-isolation-for-remote-content\">Enable context isolation in all renderers that display remote content</a></li>\n<li><a href=\"#4-enable-sandboxing\">Enable sandboxing</a></li>\n<li><a href=\"#5-handle-session-permission-requests-from-remote-content\">Use <code>ses.setPermissionRequestHandler()</code> in all sessions that load remote content</a></li>\n<li><a href=\"#6-do-not-disable-websecurity\">Do not disable <code>webSecurity</code></a></li>\n<li><a href=\"#7-define-a-content-security-policy\">Define a <code>Content-Security-Policy</code></a> and use restrictive rules (i.e. <code>script-src 'self'</code>)</li>\n<li><a href=\"#8-do-not-set-allowrunninginsecurecontent-to-true\">Do not set <code>allowRunningInsecureContent</code> to <code>true</code></a></li>\n<li><a href=\"#9-do-not-enable-experimental-features\">Do not enable experimental features</a></li>\n<li><a href=\"#10-do-not-use-enableblinkfeatures\">Do not use <code>enableBlinkFeatures</code></a></li>\n<li><a href=\"#11-do-not-use-allowpopups\"><code>&#x3C;webview></code>: Do not use <code>allowpopups</code></a></li>\n<li><a href=\"#12-verify-webview-options-before-creation\"><code>&#x3C;webview></code>: Verify options and params</a></li>\n<li><a href=\"#13-disable-or-limit-navigation\">Disable or limit navigation</a></li>\n<li><a href=\"#14-disable-or-limit-creation-of-new-windows\">Disable or limit creation of new windows</a></li>\n<li><a href=\"#15-do-not-use-openexternal-with-untrusted-content\">Do not use <code>openExternal</code> with untrusted content</a></li>\n<li><a href=\"#16-use-a-current-version-of-electron\">Use a current version of Electron</a></li>\n</ol>\n<p>To automate the detection of misconfigurations and insecure patterns, it is possible to use <a href=\"https://github.com/doyensec/electronegativity\">electronegativity</a>. For additional details on potential weaknesses and implementation bugs when developing applications using Electron, please refer to this <a href=\"https://doyensec.com/resources/us-17-Carettoni-Electronegativity-A-Study-Of-Electron-Security-wp.pdf\">guide for developers and auditors</a></p>\n<h2 id=\"1-only-load-secure-content\"><a href=\"#1-only-load-secure-content\">1) Only Load Secure Content</a></h2>\n<p>Any resources not included with your application should be loaded using a secure protocol like <code>HTTPS</code>. In other words, do not use insecure protocols like <code>HTTP</code>. Similarly, we recommend the use of <code>WSS</code> over <code>WS</code>, <code>FTPS</code> over <code>FTP</code>, and so on.</p>\n<h3 id=\"why\"><a href=\"#why\">Why?</a></h3>\n<p><code>HTTPS</code> has three main benefits:</p>\n<p>1) It authenticates the remote server, ensuring your app connects to the correct host instead of an impersonator. 2) It ensures data integrity, asserting that the data was not modified while in transit between your application and the host. 3) It encrypts the traffic between your user and the destination host, making it more difficult to eavesdrop on the information sent between your app and the host.</p>\n<h3 id=\"how\"><a href=\"#how\">How?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Schlecht</span>\nbrowserWindow.loadURL(<span class=\"hljs-string\">'http://example.com'</span>)\n\n<span class=\"hljs-comment\">// Gut</span>\nbrowserWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Schlecht --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">crossorigin</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://example.com/react.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"http://example.com/style.css\"</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Gut --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">crossorigin</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://example.com/react.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">link</span> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"stylesheet\"</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"https://example.com/style.css\"</span>></span>\n</code></pre>\n<h2 id=\"2-do-not-enable-nodejs-integration-for-remote-content\"><a href=\"#2-do-not-enable-nodejs-integration-for-remote-content\">2) Do not enable Node.js Integration for Remote Content</a></h2>\n<p><em>This recommendation is the default behavior in Electron since 5.0.0.</em></p>\n<p>It is paramount that you do not enable Node.js integration in any renderer (<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>, <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, or <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>) that loads remote content. The goal is to limit the powers you grant to remote content, thus making it dramatically more difficult for an attacker to harm your users should they gain the ability to execute JavaScript on your website.</p>\n<p>After this, you can grant additional permissions for specific hosts. For example, if you are opening a BrowserWindow pointed at <code>https://example.com/</code>, you can give that website exactly the abilities it needs, but no more.</p>\n<h3 id=\"why-1\"><a href=\"#why-1\">Why?</a></h3>\n<p>A cross-site-scripting (XSS) attack is more dangerous if an attacker can jump out of the renderer process and execute code on the user's computer. Cross-site-scripting attacks are fairly common - and while an issue, their power is usually limited to messing with the website that they are executed on. Disabling Node.js integration helps prevent an XSS from being escalated into a so-called \"Remote Code Execution\" (RCE) attack.</p>\n<h3 id=\"how-1\"><a href=\"#how-1\">How?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Bad</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">nodeIntegration</span>: <span class=\"hljs-literal\">true</span>,\n    <span class=\"hljs-attr\">nodeIntegrationInWorker</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n\nmainWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Good</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">preload</span>: path.join(app.getAppPath(), <span class=\"hljs-string\">'preload.js'</span>)\n  }\n})\n\nmainWindow.loadURL(<span class=\"hljs-string\">'https://example.com'</span>)\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Schlecht --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">nodeIntegration</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Gut --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>When disabling Node.js integration, you can still expose APIs to your website that do consume Node.js modules or features. Preload scripts continue to have access to <code>require</code> and other Node.js features, allowing developers to expose a custom API to remotely loaded content.</p>\n<p>In the following example preload script, the later loaded website will have access to a <code>window.readConfig()</code> method, but no Node.js features.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { readFileSync } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n\n<span class=\"hljs-built_in\">window</span>.readConfig = <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> data = readFileSync(<span class=\"hljs-string\">'./config.json'</span>)\n  <span class=\"hljs-keyword\">return</span> data\n}\n</code></pre>\n<h2 id=\"3-enable-context-isolation-for-remote-content\"><a href=\"#3-enable-context-isolation-for-remote-content\">3) Enable Context Isolation for Remote Content</a></h2>\n<p>Context isolation is an Electron feature that allows developers to run code in preload scripts and in Electron APIs in a dedicated JavaScript context. In practice, that means that global objects like <code>Array.prototype.push</code> or <code>JSON.parse</code> cannot be modified by scripts running in the renderer process.</p>\n<p>Electron uses the same technology as Chromium's <a href=\"https://developer.chrome.com/extensions/content_scripts#execution-environment\">Content Scripts</a> to enable this behavior.</p>\n<p>Even when <code>nodeIntegration: false</code> is used, to truly enforce strong isolation and prevent the use of Node primitives <code>contextIsolation</code> <strong>must</strong> also be used.</p>\n<h3 id=\"why--how\"><a href=\"#why--how\">Why &#x26; How?</a></h3>\n<p>For more information on what <code>contextIsolation</code> is and how to enable it please see our dedicated <a href=\"/docs/tutorial/context-isolation\">Context Isolation</a> document.</p>\n<h2 id=\"4-enable-sandboxing\"><a href=\"#4-enable-sandboxing\">4) Enable Sandboxing</a></h2>\n<p><a href=\"/docs/tutorial/sandbox\">Sandboxing</a> is a Chromium feature that uses the operating system to significantly limit what renderer processes have access to. You should enable the sandbox in all renderers. Loading, reading or processing any untrusted content in an unsandboxed process, including the main process, is not advised.</p>\n<h3 id=\"how-2\"><a href=\"#how-2\">How?</a></h3>\n<p>When creating a window, pass the <code>sandbox: true</code> option in <code>webPreferences</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">sandbox</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h2 id=\"5-handle-session-permission-requests-from-remote-content\"><a href=\"#5-handle-session-permission-requests-from-remote-content\">5) Handle Session Permission Requests From Remote Content</a></h2>\n<p>You may have seen permission requests while using Chrome: They pop up whenever the website attempts to use a feature that the user has to manually approve ( like notifications).</p>\n<p>The API is based on the <a href=\"https://developer.chrome.com/extensions/permissions\">Chromium permissions API</a> and implements the same types of permissions.</p>\n<h3 id=\"why-2\"><a href=\"#why-2\">Why?</a></h3>\n<p>By default, Electron will automatically approve all permission requests unless the developer has manually configured a custom handler. While a solid default, security-conscious developers might want to assume the very opposite.</p>\n<h3 id=\"how-3\"><a href=\"#how-3\">How?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession\n  .fromPartition(<span class=\"hljs-string\">'some-partition'</span>)\n  .setPermissionRequestHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, callback</span>) =></span> {\n    <span class=\"hljs-keyword\">const</span> url = webContents.getURL()\n\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'notifications'</span>) {\n      <span class=\"hljs-comment\">// Approves the permissions request</span>\n      callback(<span class=\"hljs-literal\">true</span>)\n    }\n\n    <span class=\"hljs-comment\">// Verify URL</span>\n    <span class=\"hljs-keyword\">if</span> (!url.startsWith(<span class=\"hljs-string\">'https://example.com/'</span>)) {\n      <span class=\"hljs-comment\">// Denies the permissions request</span>\n      <span class=\"hljs-keyword\">return</span> callback(<span class=\"hljs-literal\">false</span>)\n    }\n  })\n</code></pre>\n<h2 id=\"6-do-not-disable-websecurity\"><a href=\"#6-do-not-disable-websecurity\">6) Do Not Disable WebSecurity</a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>You may have already guessed that disabling the <code>webSecurity</code> property on a renderer process (<a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>, <a href=\"/docs/api/browser-view\"><code>BrowserView</code></a>, or <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>) disables crucial security features.</p>\n<p>Do not disable <code>webSecurity</code> in production applications.</p>\n<h3 id=\"why-3\"><a href=\"#why-3\">Why?</a></h3>\n<p>Disabling <code>webSecurity</code> will disable the same-origin policy and set <code>allowRunningInsecureContent</code> property to <code>true</code>. In other words, it allows the execution of insecure code from different domains.</p>\n<h3 id=\"how-4\"><a href=\"#how-4\">How?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Schlecht</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">webSecurity</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Gut</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Schlecht --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">disablewebsecurity</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Gut --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<h2 id=\"7-define-a-content-security-policy\"><a href=\"#7-define-a-content-security-policy\">7) Define a Content Security Policy</a></h2>\n<p>A Content Security Policy (CSP) is an additional layer of protection against cross-site-scripting attacks and data injection attacks. We recommend that they be enabled by any website you load inside Electron.</p>\n<h3 id=\"why-4\"><a href=\"#why-4\">Why?</a></h3>\n<p>CSP allows the server serving content to restrict and control the resources Electron can load for that given web page. <code>https://example.com</code> should be allowed to load scripts from the origins you defined while scripts from <code>https://evil.attacker.com</code> should not be allowed to run. Defining a CSP is an easy way to improve your application's security.</p>\n<p>The following CSP will allow Electron to execute scripts from the current website and from <code>apis.example.com</code>.</p>\n<pre><code class=\"hljs language-plaintext\">// Schlecht\nContent-Security-Policy: '*'\n\n// Gut\nContent-Security-Policy: script-src 'self' https://apis.example.com\n</code></pre>\n<h3 id=\"csp-http-header\"><a href=\"#csp-http-header\">CSP HTTP Header</a></h3>\n<p>Electron respects the <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy\"><code>Content-Security-Policy</code> HTTP header</a> which can be set using Electron's <a href=\"/docs/api/web-request#webrequestonheadersreceivedfilter-listener\"><code>webRequest.onHeadersReceived</code></a> handler:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsession.defaultSession.webRequest.onHeadersReceived(<span class=\"hljs-function\">(<span class=\"hljs-params\">details, callback</span>) =></span> {\n  callback({\n    <span class=\"hljs-attr\">responseHeaders</span>: {\n      ...details.responseHeaders,\n      <span class=\"hljs-string\">'Content-Security-Policy'</span>: [<span class=\"hljs-string\">'default-src \\'none\\''</span>]\n    }\n  })\n})\n</code></pre>\n<h3 id=\"csp-meta-tag\"><a href=\"#csp-meta-tag\">CSP Meta Tag</a></h3>\n<p>CSP's preferred delivery mechanism is an HTTP header, however it is not possible to use this method when loading a resource using the <code>file://</code> protocol. It can be useful in some cases, such as using the <code>file://</code> protocol, to set a policy on a page directly in the markup using a <code>&#x3C;meta></code> tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">http-equiv</span>=<span class=\"hljs-string\">\"Content-Security-Policy\"</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">\"default-src 'none'\"</span>></span>\n</code></pre>\n<h2 id=\"8-setze-allowrunninginsecurecontent-nicht-auf-true\"><a href=\"#8-setze-allowrunninginsecurecontent-nicht-auf-true\">8) Setze <code>allowRunningInsecureContent</code> nicht auf <code>true</code></a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>By default, Electron will not allow websites loaded over <code>HTTPS</code> to load and execute scripts, CSS, or plugins from insecure sources (<code>HTTP</code>). Setting the property <code>allowRunningInsecureContent</code> to <code>true</code> disables that protection.</p>\n<p>Loading the initial HTML of a website over <code>HTTPS</code> and attempting to load subsequent resources via <code>HTTP</code> is also known as \"mixed content\".</p>\n<h3 id=\"why-5\"><a href=\"#why-5\">Why?</a></h3>\n<p>Loading content over <code>HTTPS</code> assures the authenticity and integrity of the loaded resources while encrypting the traffic itself. See the section on <a href=\"#1-only-load-secure-content\">only displaying secure content</a> for more details.</p>\n<h3 id=\"how-5\"><a href=\"#how-5\">How?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Schlecht</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">allowRunningInsecureContent</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Gut</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({})\n</code></pre>\n<h2 id=\"9-do-not-enable-experimental-features\"><a href=\"#9-do-not-enable-experimental-features\">9) Do Not Enable Experimental Features</a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>Advanced users of Electron can enable experimental Chromium features using the <code>experimentalFeatures</code> property.</p>\n<h3 id=\"why-6\"><a href=\"#why-6\">Why?</a></h3>\n<p>Experimental features are, as the name suggests, experimental and have not been enabled for all Chromium users. Furthermore, their impact on Electron as a whole has likely not been tested.</p>\n<p>Legitimate use cases exist, but unless you know what you are doing, you should not enable this property.</p>\n<h3 id=\"how-6\"><a href=\"#how-6\">How?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Schlecht</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">experimentalFeatures</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Gut</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({})\n</code></pre>\n<h2 id=\"10-do-not-use-enableblinkfeatures\"><a href=\"#10-do-not-use-enableblinkfeatures\">10) Do Not Use <code>enableBlinkFeatures</code></a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>Blink is the name of the rendering engine behind Chromium. As with <code>experimentalFeatures</code>, the <code>enableBlinkFeatures</code> property allows developers to enable features that have been disabled by default.</p>\n<h3 id=\"why-7\"><a href=\"#why-7\">Why?</a></h3>\n<p>Generally speaking, there are likely good reasons if a feature was not enabled by default. Legitimate use cases for enabling specific features exist. As a developer, you should know exactly why you need to enable a feature, what the ramifications are, and how it impacts the security of your application. Under no circumstances should you enable features speculatively.</p>\n<h3 id=\"how-7\"><a href=\"#how-7\">How?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Schlecht</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">enableBlinkFeatures</span>: <span class=\"hljs-string\">'ExecCommandInJavaScript'</span>\n  }\n})\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Gut</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n</code></pre>\n<h2 id=\"11-do-not-use-allowpopups\"><a href=\"#11-do-not-use-allowpopups\">11) Do Not Use <code>allowpopups</code></a></h2>\n<p><em>Recommendation is Electron's default</em></p>\n<p>If you are using <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a>, you might need the pages and scripts loaded in your <code>&#x3C;webview></code> tag to open new windows. The <code>allowpopups</code> attribute enables them to create new <a href=\"/docs/api/browser-window\"><code>BrowserWindows</code></a> using the <code>window.open()</code> method. <code>&#x3C;webview></code> tags are otherwise not allowed to create new windows.</p>\n<h3 id=\"why-8\"><a href=\"#why-8\">Why?</a></h3>\n<p>If you do not need popups, you are better off not allowing the creation of new <a href=\"/docs/api/browser-window\"><code>BrowserWindows</code></a> by default. This follows the principle of minimally required access: Don't let a website create new popups unless you know it needs that feature.</p>\n<h3 id=\"how-8\"><a href=\"#how-8\">How?</a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- Schlecht --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">allowpopups</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n\n<span class=\"hljs-comment\">&#x3C;!-- Gut --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"page.html\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<h2 id=\"12-verify-webview-options-before-creation\"><a href=\"#12-verify-webview-options-before-creation\">12) Verify WebView Options Before Creation</a></h2>\n<p>A WebView created in a renderer process that does not have Node.js integration enabled will not be able to enable integration itself. However, a WebView will always create an independent renderer process with its own <code>webPreferences</code>.</p>\n<p>It is a good idea to control the creation of new <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> tags from the main process and to verify that their webPreferences do not disable security features.</p>\n<h3 id=\"why-9\"><a href=\"#why-9\">Why?</a></h3>\n<p>Since <code>&#x3C;webview></code> live in the DOM, they can be created by a script running on your website even if Node.js integration is otherwise disabled.</p>\n<p>Electron enables developers to disable various security features that control a renderer process. In most cases, developers do not need to disable any of those features - and you should therefore not allow different configurations for newly created <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> tags.</p>\n<h3 id=\"how-9\"><a href=\"#how-9\">How?</a></h3>\n<p>Before a <a href=\"/docs/api/webview-tag\"><code>&#x3C;webview></code></a> tag is attached, Electron will fire the <code>will-attach-webview</code> event on the hosting <code>webContents</code>. Use the event to prevent the creation of <code>webViews</code> with possibly insecure options.</p>\n<pre><code class=\"hljs language-js\">app.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.on(<span class=\"hljs-string\">'will-attach-webview'</span>, (event, webPreferences, params) => {\n    <span class=\"hljs-comment\">// Strip away preload scripts if unused or verify their location is legitimate</span>\n    <span class=\"hljs-keyword\">delete</span> webPreferences.preload\n    <span class=\"hljs-keyword\">delete</span> webPreferences.preloadURL\n\n    <span class=\"hljs-comment\">// Disable Node.js integration</span>\n    webPreferences.nodeIntegration = <span class=\"hljs-literal\">false</span>\n\n    <span class=\"hljs-comment\">// Verify URL being loaded</span>\n    <span class=\"hljs-keyword\">if</span> (!params.src.startsWith(<span class=\"hljs-string\">'https://example.com/'</span>)) {\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<p>Again, this list merely minimizes the risk, it does not remove it. If your goal is to display a website, a browser will be a more secure option.</p>\n<h2 id=\"13-disable-or-limit-navigation\"><a href=\"#13-disable-or-limit-navigation\">13) Disable or limit navigation</a></h2>\n<p>If your app has no need to navigate or only needs to navigate to known pages, it is a good idea to limit navigation outright to that known scope, disallowing any other kinds of navigation.</p>\n<h3 id=\"why-10\"><a href=\"#why-10\">Why?</a></h3>\n<p>Navigation is a common attack vector. If an attacker can convince your app to navigate away from its current page, they can possibly force your app to open web sites on the Internet. Even if your <code>webContents</code> are configured to be more secure (like having <code>nodeIntegration</code> disabled or <code>contextIsolation</code> enabled), getting your app to open a random web site will make the work of exploiting your app a lot easier.</p>\n<p>A common attack pattern is that the attacker convinces your app's users to interact with the app in such a way that it navigates to one of the attacker's pages. This is usually done via links, plugins, or other user-generated content.</p>\n<h3 id=\"how-10\"><a href=\"#how-10\">How?</a></h3>\n<p>If your app has no need for navigation, you can call <code>event.preventDefault()</code> in a <a href=\"/docs/api/web-contents#event-will-navigate\"><code>will-navigate</code></a> handler. If you know which pages your app might navigate to, check the URL in the event handler and only let navigation occur if it matches the URLs you're expecting.</p>\n<p>We recommend that you use Node's parser for URLs. Simple string comparisons can sometimes be fooled - a <code>startsWith('https://example.com')</code> test would let <code>https://example.com.attacker.com</code> through.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> URL = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>).URL\n\napp.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.on(<span class=\"hljs-string\">'will-navigate'</span>, (event, navigationUrl) => {\n    <span class=\"hljs-keyword\">const</span> parsedUrl = <span class=\"hljs-keyword\">new</span> URL(navigationUrl)\n\n    <span class=\"hljs-keyword\">if</span> (parsedUrl.origin !== <span class=\"hljs-string\">'https://example.com'</span>) {\n      event.preventDefault()\n    }\n  })\n})\n</code></pre>\n<h2 id=\"14-disable-or-limit-creation-of-new-windows\"><a href=\"#14-disable-or-limit-creation-of-new-windows\">14) Disable or limit creation of new windows</a></h2>\n<p>If you have a known set of windows, it's a good idea to limit the creation of additional windows in your app.</p>\n<h3 id=\"why-11\"><a href=\"#why-11\">Why?</a></h3>\n<p>Much like navigation, the creation of new <code>webContents</code> is a common attack vector. Attackers attempt to convince your app to create new windows, frames, or other renderer processes with more privileges than they had before; or with pages opened that they couldn't open before.</p>\n<p>If you have no need to create windows in addition to the ones you know you'll need to create, disabling the creation buys you a little bit of extra security at no cost. This is commonly the case for apps that open one <code>BrowserWindow</code> and do not need to open an arbitrary number of additional windows at runtime.</p>\n<h3 id=\"how-11\"><a href=\"#how-11\">How?</a></h3>\n<p><a href=\"/docs/api/web-contents\"><code>webContents</code></a> will delegate to its <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\">window open handler</a> before creating new windows. The handler will receive, amongst other parameters, the <code>url</code> the window was requested to open and the options used to create it. We recommend that you register a handler to monitor the creation of windows, and deny any unexpected window creation.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.on(<span class=\"hljs-string\">'web-contents-created'</span>, (event, contents) => {\n  contents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n    <span class=\"hljs-comment\">// In this example, we'll ask the operating system</span>\n    <span class=\"hljs-comment\">// to open this event's url in the default browser.</span>\n    <span class=\"hljs-comment\">//</span>\n    <span class=\"hljs-comment\">// See the following item for considerations regarding what</span>\n    <span class=\"hljs-comment\">// URLs should be allowed through to shell.openExternal.</span>\n    <span class=\"hljs-keyword\">if</span> (isSafeForExternalOpen(url)) {\n      setImmediate(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n        shell.openExternal(url)\n      })\n    }\n\n    <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n  })\n})\n</code></pre>\n<h2 id=\"15-do-not-use-openexternal-with-untrusted-content\"><a href=\"#15-do-not-use-openexternal-with-untrusted-content\">15) Do not use <code>openExternal</code> with untrusted content</a></h2>\n<p>Shell's <a href=\"/docs/api/shell#shellopenexternalurl-options\"><code>openExternal</code></a> allows opening a given protocol URI with the desktop's native utilities. On macOS, for instance, this function is similar to the <code>open</code> terminal command utility and will open the specific application based on the URI and filetype association.</p>\n<h3 id=\"why-12\"><a href=\"#why-12\">Why?</a></h3>\n<p>Improper use of <a href=\"/docs/api/shell#shellopenexternalurl-options\"><code>openExternal</code></a> can be leveraged to compromise the user's host. When openExternal is used with untrusted content, it can be leveraged to execute arbitrary commands.</p>\n<h3 id=\"how-12\"><a href=\"#how-12\">How?</a></h3>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">//  Bad</span>\n<span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nshell.openExternal(USER_CONTROLLED_DATA_HERE)\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">//  Good</span>\n<span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nshell.openExternal(<span class=\"hljs-string\">'https://example.com/index.html'</span>)\n</code></pre>\n<h2 id=\"16-use-a-current-version-of-electron\"><a href=\"#16-use-a-current-version-of-electron\">16) Use a current version of Electron</a></h2>\n<p>You should strive for always using the latest available version of Electron. Whenever a new major version is released, you should attempt to update your app as quickly as possible.</p>\n<h3 id=\"why-13\"><a href=\"#why-13\">Why?</a></h3>\n<p>An application built with an older version of Electron, Chromium, and Node.js is an easier target than an application that is using more recent versions of those components. Generally speaking, security issues and exploits for older versions of Chromium and Node.js are more widely available.</p>\n<p>Both Chromium and Node.js are impressive feats of engineering built by thousands of talented developers. Given their popularity, their security is carefully tested and analyzed by equally skilled security researchers. Many of those researchers <a href=\"https://en.wikipedia.org/wiki/Responsible_disclosure\">disclose vulnerabilities responsibly</a>, which generally means that researchers will give Chromium and Node.js some time to fix issues before publishing them. Your application will be more secure if it is running a recent version of Electron (and thus, Chromium and Node.js) for which potential security issues are not as widely known.</p>",
      "title": "Sicherheit, native Fähigkeiten und Ihre eigene Verantwortung",
      "description": "⚠️ Under no circumstances should you load and execute remote code with Node.js integration enabled. Instead, use only local files (packaged together with your application) to execute Node.js code. To display remote content, use the <webview> tag or BrowserView, make sure to disable the nodeIntegration and enable contextIsolation."
    },
    "/docs/api/structures/segmented-control-segment": {
      "locale": "de-DE",
      "slug": "segmented-control-segment",
      "href": "/docs/api/structures/segmented-control-segment",
      "crowdinFileId": "256499",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/segmented-control-segment.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"segmentedcontrolsegment-object\"><a href=\"#segmentedcontrolsegment-object\">SegmentedControlSegment Object</a></h1>\n<ul>\n<li><code>label</code> String (optional) - The text to appear in this segment.</li>\n<li><code>icon</code> NativeImage (optional) - The image to appear in this segment.</li>\n<li><code>enabled</code> Boolean (optional) - Whether this segment is selectable. Default: true.</li>\n</ul>",
      "title": "SegmentedControlSegment Object",
      "description": ""
    },
    "/docs/api/structures/serial-port": {
      "locale": "de-DE",
      "slug": "serial-port",
      "href": "/docs/api/structures/serial-port",
      "crowdinFileId": "256501",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/serial-port.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"serialport-object\"><a href=\"#serialport-object\">SerialPort Object</a></h1>\n<ul>\n<li><code>portId</code> String - Unique identifier for the port.</li>\n<li><code>portName</code> String - Name of the port.</li>\n<li><code>displayName</code> String - A string suitable for display to the user for describing this device.</li>\n<li><code>vendorId</code> String - Optional USB vendor ID.</li>\n<li><code>productId</code> String - Optional USB product ID.</li>\n<li><code>serialNumber</code> String - The USB device serial number.</li>\n<li><code>usbDriverName</code> String (optional) - Represents a single serial port on macOS can be enumerated by multiple drivers.</li>\n<li><code>deviceInstanceId</code> String (optional) - A stable identifier on Windows that can be used for device permissions.</li>\n</ul>",
      "title": "SerialPort Object",
      "description": ""
    },
    "/docs/api/structures/service-worker-info": {
      "locale": "de-DE",
      "slug": "service-worker-info",
      "href": "/docs/api/structures/service-worker-info",
      "crowdinFileId": "256503",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/service-worker-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"serviceworkerinfo-object\"><a href=\"#serviceworkerinfo-object\">ServiceWorkerInfo Object</a></h1>\n<ul>\n<li><code>scriptUrl</code> String - The full URL to the script that this service worker runs</li>\n<li><code>scope</code> String - The base URL that this service worker is active for.</li>\n<li><code>renderProcessId</code> Number - The virtual ID of the process that this service worker is running in.  This is not an OS level PID.  This aligns with the ID set used for <code>webContents.getProcessId()</code>.</li>\n</ul>",
      "title": "ServiceWorkerInfo Object",
      "description": ""
    },
    "/docs/api/service-workers": {
      "locale": "de-DE",
      "slug": "service-workers",
      "href": "/docs/api/service-workers",
      "crowdinFileId": "256363",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/service-workers.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-serviceworkers\"><a href=\"#class-serviceworkers\">Class: ServiceWorkers</a></h2>\n<blockquote>\n<p>Query and receive events from a sessions active service workers.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Instances of the <code>ServiceWorkers</code> class are accessed by using <code>serviceWorkers</code> property of a <code>Session</code>.</p>\n<p>Ein Beispiel:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Get all service workers.</span>\n<span class=\"hljs-built_in\">console</span>.log(session.defaultSession.serviceWorkers.getAllRunning())\n\n<span class=\"hljs-comment\">// Handle logs and get service worker info</span>\nsession.defaultSession.serviceWorkers.on(<span class=\"hljs-string\">'console-message'</span>, (event, messageDetails) => {\n  <span class=\"hljs-built_in\">console</span>.log(\n    <span class=\"hljs-string\">'Got service worker message'</span>,\n    messageDetails,\n    <span class=\"hljs-string\">'from'</span>,\n    session.defaultSession.serviceWorkers.getFromVersionID(messageDetails.versionId)\n  )\n})\n</code></pre>\n<h3 id=\"instanz-ereignisse\"><a href=\"#instanz-ereignisse\">Instanz-Ereignisse</a></h3>\n<p>The following events are available on instances of <code>ServiceWorkers</code>:</p>\n<h4 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>messageDetails</code> Object - Information about the console message<ul>\n<li><code>message</code> String - The actual console message</li>\n<li><code>versionId</code> Number - The version ID of the service worker that sent the log message</li>\n<li><code>source</code> String - The type of source for this message.  Can be <code>javascript</code>, <code>xml</code>, <code>network</code>, <code>console-api</code>, <code>storage</code>, <code>app-cache</code>, <code>rendering</code>, <code>security</code>, <code>deprecation</code>, <code>worker</code>, <code>violation</code>, <code>intervention</code>, <code>recommendation</code> or <code>other</code>.</li>\n<li><code>level</code> Number - The log level, from 0 to 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>sourceUrl</code> String - The URL the message came from</li>\n<li><code>lineNumber</code> Number - The line number of the source that triggered this console message</li>\n</ul></li>\n</ul>\n<p>Emitted when a service worker logs something to the console.</p>\n<h4 id=\"event-registration-completed\"><a href=\"#event-registration-completed\">Event: 'registration-completed'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Object - Information about the registered service worker<ul>\n<li><code>scope</code> String - The base URL that a service worker is registered for</li>\n</ul></li>\n</ul>\n<p>Emitted when a service worker has been registered. Can occur after a call to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\"><code>navigator.serviceWorker.register('/sw.js')</code></a> successfully resolves or when a Chrome extension is loaded.</p>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<p>Die folgenden Methoden sind verfügbar in Instanzen von <code>ServiceWorkers</code>:</p>\n<h4 id=\"serviceworkersgetallrunning\"><a href=\"#serviceworkersgetallrunning\"><code>serviceWorkers.getAllRunning()</code></a></h4>\n<p>Returns <code>Record&#x3C;Number, ServiceWorkerInfo></code> - A <a href=\"/docs/api/structures/service-worker-info\">ServiceWorkerInfo</a> object where the keys are the service worker version ID and the values are the information about that service worker.</p>\n<h4 id=\"serviceworkersgetfromversionidversionid\"><a href=\"#serviceworkersgetfromversionidversionid\"><code>serviceWorkers.getFromVersionID(versionId)</code></a></h4>\n<ul>\n<li><code>versionId</code> Number</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/service-worker-info\"><code>ServiceWorkerInfo</code></a> - Information about this service worker</p>\n<p>If the service worker does not exist or is not running this method will throw an exception.</p>",
      "title": "ServiceWorkers",
      "description": "Query and receive events from a sessions active service workers."
    },
    "/docs/api/session": {
      "locale": "de-DE",
      "slug": "session",
      "href": "/docs/api/session",
      "crowdinFileId": "256365",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/session.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"session\"><a href=\"#session\">session</a></h1>\n<blockquote>\n<p>Manage browser sessions, cookies, cache, proxy settings, etc.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p>The <code>session</code> module can be used to create new <code>Session</code> objects.</p>\n<p>You can also access the <code>session</code> of existing pages by using the <code>session</code> property of <a href=\"/docs/api/web-contents\"><code>WebContents</code></a>, or from the <code>session</code> module.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> ses = win.webContents.session\n<span class=\"hljs-built_in\">console</span>.log(ses.getUserAgent())\n</code></pre>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das Modul <code>session</code> verfügt über die folgenden Methoden:</p>\n<h3 id=\"sessionfrompartitionpartition-options\"><a href=\"#sessionfrompartitionpartition-options\"><code>session.fromPartition(partition[, options])</code></a></h3>\n<ul>\n<li><code>partition</code> Zeichenkette</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>cache</code> Boolean - Whether to enable cache.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Session</code> - A session instance from <code>partition</code> string. When there is an existing <code>Session</code> with the same <code>partition</code>, it will be returned; otherwise a new <code>Session</code> instance will be created with <code>options</code>.</p>\n<p>If <code>partition</code> starts with <code>persist:</code>, the page will use a persistent session available to all pages in the app with the same <code>partition</code>. if there is no <code>persist:</code> prefix, the page will use an in-memory session. If the <code>partition</code> is empty then default session of the app will be returned.</p>\n<p>To create a <code>Session</code> with <code>options</code>, you have to ensure the <code>Session</code> with the <code>partition</code> has never been used before. There is no way to change the <code>options</code> of an existing <code>Session</code> object.</p>\n<h2 id=\"eigenschaften\"><a href=\"#eigenschaften\">Eigenschaften</a></h2>\n<p>The <code>session</code> module has the following properties:</p>\n<h3 id=\"sessiondefaultsession\"><a href=\"#sessiondefaultsession\"><code>session.defaultSession</code></a></h3>\n<p>A <code>Session</code> object, the default session object of the app.</p>\n<h2 id=\"class-session\"><a href=\"#class-session\">Class: Session</a></h2>\n<blockquote>\n<p>Get and set properties of a session.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>You can create a <code>Session</code> object in the <code>session</code> module:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> ses = session.fromPartition(<span class=\"hljs-string\">'persist:name'</span>)\n<span class=\"hljs-built_in\">console</span>.log(ses.getUserAgent())\n</code></pre>\n<h3 id=\"instanz-ereignisse\"><a href=\"#instanz-ereignisse\">Instanz-Ereignisse</a></h3>\n<p>The following events are available on instances of <code>Session</code>:</p>\n<h4 id=\"event-will-download\"><a href=\"#event-will-download\">Event: 'will-download'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>item</code> <a href=\"/docs/api/download-item\">DownloadItem</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitted when Electron is about to download <code>item</code> in <code>webContents</code>.</p>\n<p>Calling <code>event.preventDefault()</code> will cancel the download and <code>item</code> will not be available from next tick of the process.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nsession.defaultSession.on(<span class=\"hljs-string\">'will-download'</span>, (event, item, webContents) => {\n  event.preventDefault()\n  <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'got'</span>)(item.getURL()).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">response</span>) =></span> {\n    <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>).writeFileSync(<span class=\"hljs-string\">'/somewhere'</span>, response.body)\n  })\n})\n</code></pre>\n<h4 id=\"event-extension-loaded\"><a href=\"#event-extension-loaded\">Event: 'extension-loaded'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Emitted after an extension is loaded. This occurs whenever an extension is added to the \"enabled\" set of extensions. This includes:</p>\n<ul>\n<li>Extensions being loaded from <code>Session.loadExtension</code>.</li>\n<li>Extensions being reloaded:<ul>\n<li>from a crash.</li>\n<li>if the extension requested it (<a href=\"https://developer.chrome.com/extensions/runtime#method-reload\"><code>chrome.runtime.reload()</code></a>).</li>\n</ul></li>\n</ul>\n<h4 id=\"event-extension-unloaded\"><a href=\"#event-extension-unloaded\">Event: 'extension-unloaded'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Emitted after an extension is unloaded. This occurs when <code>Session.removeExtension</code> is called.</p>\n<h4 id=\"event-extension-ready\"><a href=\"#event-extension-ready\">Event: 'extension-ready'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>extension</code> <a href=\"/docs/api/structures/extension\">Extension</a></li>\n</ul>\n<p>Emitted after an extension is loaded and all necessary browser state is initialized to support the start of the extension's background page.</p>\n<h4 id=\"event-preconnect\"><a href=\"#event-preconnect\">Event: 'preconnect'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preconnectUrl</code> String - The URL being requested for preconnection by the renderer.</li>\n<li><code>allowCredentials</code> Boolean - True if the renderer is requesting that the connection include credentials (see the <a href=\"https://w3c.github.io/resource-hints/#preconnect\">spec</a> for more details.)</li>\n</ul>\n<p>Emitted when a render process requests preconnection to a URL, generally due to a <a href=\"https://w3c.github.io/resource-hints/\">resource hint</a>.</p>\n<h4 id=\"event-spellcheck-dictionary-initialized\"><a href=\"#event-spellcheck-dictionary-initialized\">Event: 'spellcheck-dictionary-initialized'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file has been successfully initialized. This occurs after the file has been downloaded.</p>\n<h4 id=\"event-spellcheck-dictionary-download-begin\"><a href=\"#event-spellcheck-dictionary-download-begin\">Event: 'spellcheck-dictionary-download-begin'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file starts downloading</p>\n<h4 id=\"event-spellcheck-dictionary-download-success\"><a href=\"#event-spellcheck-dictionary-download-success\">Event: 'spellcheck-dictionary-download-success'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file has been successfully downloaded</p>\n<h4 id=\"event-spellcheck-dictionary-download-failure\"><a href=\"#event-spellcheck-dictionary-download-failure\">Event: 'spellcheck-dictionary-download-failure'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>languageCode</code> String - The language code of the dictionary file</li>\n</ul>\n<p>Emitted when a hunspell dictionary file download fails.  For details on the failure you should collect a netlog and inspect the download request.</p>\n<h4 id=\"event-select-hid-device\"><a href=\"#event-select-hid-device\">Event: 'select-hid-device'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Objekt<ul>\n<li><code>deviceList</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>deviceId</code> String | null (optional)</li>\n</ul></li>\n</ul>\n<p>Emitted when a HID device needs to be selected when a call to <code>navigator.hid.requestDevice</code> is made. <code>callback</code> should be called with <code>deviceId</code> to be selected; passing no arguments to <code>callback</code> will cancel the request.  Additionally, permissioning on <code>navigator.hid</code> can be further managed by using <a href=\"#sessetpermissioncheckhandlerhandler\">ses.setPermissionCheckHandler(handler)</a> and <a href=\"#sessetdevicepermissionhandlerhandler\">ses.setDevicePermissionHandler(handler)`</a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.webContents.session.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin, details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-comment\">// Add logic here to determine if permission should be given to allow HID selection</span>\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  <span class=\"hljs-comment\">// Optionally, retrieve previously persisted devices from a persistent store</span>\n  <span class=\"hljs-keyword\">const</span> grantedDevices = fetchGrantedDevices()\n\n  win.webContents.session.setDevicePermissionHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(details.origin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; details.deviceType === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-keyword\">if</span> (details.device.vendorId === <span class=\"hljs-number\">123</span> &#x26;&#x26; details.device.productId === <span class=\"hljs-number\">345</span>) {\n        <span class=\"hljs-comment\">// Always allow this type of device (this allows skipping the call to `navigator.hid.requestDevice` first)</span>\n        <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n      }\n\n      <span class=\"hljs-comment\">// Search through the list of devices that have previously been granted permission</span>\n      <span class=\"hljs-keyword\">return</span> grantedDevices.some(<span class=\"hljs-function\">(<span class=\"hljs-params\">grantedDevice</span>) =></span> {\n        <span class=\"hljs-keyword\">return</span> grantedDevice.vendorId === details.device.vendorId &#x26;&#x26;\n              grantedDevice.productId === details.device.productId &#x26;&#x26;\n              grantedDevice.serialNumber &#x26;&#x26; grantedDevice.serialNumber === details.device.serialNumber\n      })\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  win.webContents.session.on(<span class=\"hljs-string\">'select-hid-device'</span>, (event, details, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedDevice = details.deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    callback(selectedPort?.deviceId)\n  })\n})\n</code></pre>\n<h4 id=\"event-hid-device-added\"><a href=\"#event-hid-device-added\">Event: 'hid-device-added'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Objekt<ul>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n</ul>\n<p>Emitted when a new HID device becomes available. For example, when a new USB device is plugged in.</p>\n<p>This event will only be emitted after <code>navigator.hid.requestDevice</code> has been called and <code>select-hid-device</code> has fired.</p>\n<h4 id=\"event-hid-device-removed\"><a href=\"#event-hid-device-removed\">Event: 'hid-device-removed'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Objekt<ul>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice[]</a></li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a></li>\n</ul></li>\n</ul>\n<p>Emitted when a HID device has been removed.  For example, this event will fire when a USB device is unplugged.</p>\n<p>This event will only be emitted after <code>navigator.hid.requestDevice</code> has been called and <code>select-hid-device</code> has fired.</p>\n<h4 id=\"event-select-serial-port\"><a href=\"#event-select-serial-port\">Event: 'select-serial-port'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>portList</code> <a href=\"/docs/api/structures/serial-port\">SerialPort[]</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>portId</code> Zeichenkette</li>\n</ul></li>\n</ul>\n<p>Emitted when a serial port needs to be selected when a call to <code>navigator.serial.requestPort</code> is made. <code>callback</code> should be called with <code>portId</code> to be selected, passing an empty string to <code>callback</code> will cancel the request.  Additionally, permissioning on <code>navigator.serial</code> can be managed by using <a href=\"#sessetpermissioncheckhandlerhandler\">ses.setPermissionCheckHandler(handler)</a> with the <code>serial</code> permission.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span>\n  })\n  win.webContents.session.on(<span class=\"hljs-string\">'select-serial-port'</span>, (event, portList, webContents, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedPort = portList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    <span class=\"hljs-keyword\">if</span> (!selectedPort) {\n      callback(<span class=\"hljs-string\">''</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      callback(selectedPort.portId)\n    }\n  })\n})\n</code></pre>\n<h4 id=\"event-serial-port-added\"><a href=\"#event-serial-port-added\">Event: 'serial-port-added'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>port</code> <a href=\"/docs/api/structures/serial-port\">SerialPort</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitted after <code>navigator.serial.requestPort</code> has been called and <code>select-serial-port</code> has fired if a new serial port becomes available.  For example, this event will fire when a new USB device is plugged in.</p>\n<h4 id=\"event-serial-port-removed\"><a href=\"#event-serial-port-removed\">Event: 'serial-port-removed'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>port</code> <a href=\"/docs/api/structures/serial-port\">SerialPort</a></li>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a></li>\n</ul>\n<p>Emitted after <code>navigator.serial.requestPort</code> has been called and <code>select-serial-port</code> has fired if a serial port has been removed.  For example, this event will fire when a USB device is unplugged.</p>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<p>The following methods are available on instances of <code>Session</code>:</p>\n<h4 id=\"sesgetcachesize\"><a href=\"#sesgetcachesize\"><code>ses.getCacheSize()</code></a></h4>\n<p>Returns <code>Promise&#x3C;Integer></code> - the session's current cache size, in bytes.</p>\n<h4 id=\"sesclearcache\"><a href=\"#sesclearcache\"><code>ses.clearCache()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the cache clear operation is complete.</p>\n<p>Clears the session’s HTTP cache.</p>\n<h4 id=\"sesclearstoragedataoptions\"><a href=\"#sesclearstoragedataoptions\"><code>ses.clearStorageData([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>origin</code> String (optional) - Should follow <code>window.location.origin</code>’s representation <code>scheme://host:port</code>.</li>\n<li><code>storages</code> String<a href=\"/docs/api/optional\"></a> - The types of storages to clear, can contain: <code>appcache</code>, <code>cookies</code>, <code>filesystem</code>, <code>indexdb</code>, <code>localstorage</code>, <code>shadercache</code>, <code>websql</code>, <code>serviceworkers</code>, <code>cachestorage</code>. If not specified, clear all storage types.</li>\n<li><code>quotas</code> String<a href=\"/docs/api/optional\"></a> - The types of quotas to clear, can contain: <code>temporary</code>, <code>persistent</code>, <code>syncable</code>. If not specified, clear all quotas.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the storage data has been cleared.</p>\n<h4 id=\"sesflushstoragedata\"><a href=\"#sesflushstoragedata\"><code>ses.flushStorageData()</code></a></h4>\n<p>Writes any unwritten DOMStorage data to disk.</p>\n<h4 id=\"sessetproxyconfig\"><a href=\"#sessetproxyconfig\"><code>ses.setProxy(config)</code></a></h4>\n<ul>\n<li><code>config</code> Object<ul>\n<li><code>mode</code> String (optional) - The proxy mode. Should be one of <code>direct</code>, <code>auto_detect</code>, <code>pac_script</code>, <code>fixed_servers</code> or <code>system</code>. If it's unspecified, it will be automatically determined based on other specified options.<ul>\n<li><code>direct</code> In direct mode all connections are created directly, without any proxy involved.</li>\n<li><code>auto_detect</code> In auto_detect mode the proxy configuration is determined by a PAC script that can be downloaded at <a href=\"http://wpad/wpad.dat\">http://wpad/wpad.dat</a>.</li>\n<li><code>pac_script</code> In pac_script mode the proxy configuration is determined by a PAC script that is retrieved from the URL specified in the <code>pacScript</code>. This is the default mode if <code>pacScript</code> is specified.</li>\n<li><code>fixed_servers</code> In fixed_servers mode the proxy configuration is specified in <code>proxyRules</code>. This is the default mode if <code>proxyRules</code> is specified.</li>\n<li><code>system</code> In system mode the proxy configuration is taken from the operating system. Note that the system mode is different from setting no proxy configuration. In the latter case, Electron falls back to the system settings only if no command-line options influence the proxy configuration.</li>\n</ul></li>\n<li><code>pacScript</code> String (optional) - The URL associated with the PAC file.</li>\n<li><code>proxyRules</code> String (optional) - Rules indicating which proxies to use.</li>\n<li><code>proxyBypassRules</code> String (optional) - Rules indicating which URLs should bypass the proxy settings.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the proxy setting process is complete.</p>\n<p>Sets the proxy settings.</p>\n<p>When <code>mode</code> is unspecified, <code>pacScript</code> and <code>proxyRules</code> are provided together, the <code>proxyRules</code> option is ignored and <code>pacScript</code> configuration is applied.</p>\n<p>You may need <code>ses.closeAllConnections</code> to close currently in flight connections to prevent pooled sockets using previous proxy from being reused by future requests.</p>\n<p>The <code>proxyRules</code> has to follow the rules below:</p>\n<pre><code class=\"hljs language-sh\">proxyRules = schemeProxies[<span class=\"hljs-string\">\";\"</span>&#x3C;schemeProxies>]\nschemeProxies = [&#x3C;urlScheme><span class=\"hljs-string\">\"=\"</span>]&#x3C;proxyURIList>\nurlScheme = <span class=\"hljs-string\">\"http\"</span> | <span class=\"hljs-string\">\"https\"</span> | <span class=\"hljs-string\">\"ftp\"</span> | <span class=\"hljs-string\">\"socks\"</span>\nproxyURIList = &#x3C;proxyURL>[<span class=\"hljs-string\">\",\"</span>&#x3C;proxyURIList>]\nproxyURL = [&#x3C;proxyScheme><span class=\"hljs-string\">\"://\"</span>]&#x3C;proxyHost>[<span class=\"hljs-string\">\":\"</span>&#x3C;proxyPort>]\n</code></pre>\n<p>Ein Beispiel:</p>\n<ul>\n<li><code>http=foopy:80;ftp=foopy2</code> - Use HTTP proxy <code>foopy:80</code> for <code>http://</code> URLs, and HTTP proxy <code>foopy2:80</code> for <code>ftp://</code> URLs.</li>\n<li><code>foopy:80</code> - Use HTTP proxy <code>foopy:80</code> for all URLs.</li>\n<li><code>foopy:80,bar,direct://</code> - Use HTTP proxy <code>foopy:80</code> for all URLs, failing over to <code>bar</code> if <code>foopy:80</code> is unavailable, and after that using no proxy.</li>\n<li><code>socks4://foopy</code> - Use SOCKS v4 proxy <code>foopy:1080</code> for all URLs.</li>\n<li><code>http=foopy,socks5://bar.com</code> - Use HTTP proxy <code>foopy</code> for http URLs, and fail over to the SOCKS5 proxy <code>bar.com</code> if <code>foopy</code> is unavailable.</li>\n<li><code>http=foopy,direct://</code> - Use HTTP proxy <code>foopy</code> for http URLs, and use no proxy if <code>foopy</code> is unavailable.</li>\n<li><code>http=foopy;socks=foopy2</code> - Use HTTP proxy <code>foopy</code> for http URLs, and use <code>socks4://foopy2</code> for all other URLs.</li>\n</ul>\n<p>The <code>proxyBypassRules</code> is a comma separated list of rules described below:</p>\n<ul>\n<li>\n<p><code>[ URL_SCHEME \"://\" ] HOSTNAME_PATTERN [ \":\" &#x3C;port> ]</code></p>\n<p> Match all hostnames that match the pattern HOSTNAME_PATTERN.</p>\n<p> Examples: \"foobar.com\", \"<em>foobar.com\", \"</em>.foobar.com\", \"<em>foobar.com:99\", \"<a href=\"https://x\">https://x</a>.</em>.y.com:99\"</p>\n</li>\n<li>\n<p><code>\".\" HOSTNAME_SUFFIX_PATTERN [ \":\" PORT ]</code></p>\n<p> Match a particular domain suffix.</p>\n<p> Examples: \".google.com\", \".com\", \"<a href=\"http://.google.com\">http://.google.com</a>\"</p>\n</li>\n<li>\n<p><code>[ SCHEME \"://\" ] IP_LITERAL [ \":\" PORT ]</code></p>\n<p> Match URLs which are IP address literals.</p>\n<p> Examples: \"127.0.1\", \"[0:0::1]\", \"[::1]\", \"<a href=\"http://%5B::1%5D:99\">http://[::1]:99</a>\"</p>\n</li>\n<li>\n<p><code>IP_LITERAL \"/\" PREFIX_LENGTH_IN_BITS</code></p>\n<p> Match any URL that is to an IP literal that falls between the given range. IP range is specified using CIDR notation.</p>\n<p> Examples: \"192.168.1.1/16\", \"fefe:13::abc/33\".</p>\n</li>\n<li>\n<p><code>&#x3C;local></code></p>\n<p> Match local addresses. The meaning of <code>&#x3C;local></code> is whether the host matches one of: \"127.0.0.1\", \"::1\", \"localhost\".</p>\n</li>\n</ul>\n<h4 id=\"sesresolveproxyurl\"><a href=\"#sesresolveproxyurl\"><code>ses.resolveProxy(url)</code></a></h4>\n<ul>\n<li><code>url</code> URL</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - Resolves with the proxy information for <code>url</code>.</p>\n<h4 id=\"sesforcereloadproxyconfig\"><a href=\"#sesforcereloadproxyconfig\"><code>ses.forceReloadProxyConfig()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the all internal states of proxy service is reset and the latest proxy configuration is reapplied if it's already available. The pac script will be fetched from <code>pacScript</code> again if the proxy mode is <code>pac_script</code>.</p>\n<h4 id=\"sessetdownloadpathpath\"><a href=\"#sessetdownloadpathpath\"><code>ses.setDownloadPath(path)</code></a></h4>\n<ul>\n<li><code>path</code> String - The download location.</li>\n</ul>\n<p>Sets download saving directory. By default, the download directory will be the <code>Downloads</code> under the respective app folder.</p>\n<h4 id=\"sesenablenetworkemulationoptions\"><a href=\"#sesenablenetworkemulationoptions\"><code>ses.enableNetworkEmulation(options)</code></a></h4>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>offline</code> Boolean (optional) - Whether to emulate network outage. Defaults to false.</li>\n<li><code>latency</code> Double (optional) - RTT in ms. Defaults to 0 which will disable latency throttling.</li>\n<li><code>downloadThroughput</code> Double (optional) - Download rate in Bps. Defaults to 0 which will disable download throttling.</li>\n<li><code>uploadThroughput</code> Double (optional) - Upload rate in Bps. Defaults to 0 which will disable upload throttling.</li>\n</ul></li>\n</ul>\n<p>Emulates network with the given configuration for the <code>session</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// To emulate a GPRS connection with 50kbps throughput and 500 ms latency.</span>\n<span class=\"hljs-built_in\">window</span>.webContents.session.enableNetworkEmulation({\n  <span class=\"hljs-attr\">latency</span>: <span class=\"hljs-number\">500</span>,\n  <span class=\"hljs-attr\">downloadThroughput</span>: <span class=\"hljs-number\">6400</span>,\n  <span class=\"hljs-attr\">uploadThroughput</span>: <span class=\"hljs-number\">6400</span>\n})\n\n<span class=\"hljs-comment\">// To emulate a network outage.</span>\n<span class=\"hljs-built_in\">window</span>.webContents.session.enableNetworkEmulation({ <span class=\"hljs-attr\">offline</span>: <span class=\"hljs-literal\">true</span> })\n</code></pre>\n<h4 id=\"sespreconnectoptions\"><a href=\"#sespreconnectoptions\"><code>ses.preconnect(options)</code></a></h4>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>url</code> String - URL for preconnect. Only the origin is relevant for opening the socket.</li>\n<li><code>numSockets</code> Number (optional) - number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.</li>\n</ul></li>\n</ul>\n<p>Preconnects the given number of sockets to an origin.</p>\n<h4 id=\"sescloseallconnections\"><a href=\"#sescloseallconnections\"><code>ses.closeAllConnections()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when all connections are closed.</p>\n<p><strong>Note:</strong> It will terminate / fail all requests currently in flight.</p>\n<h4 id=\"sesdisablenetworkemulation\"><a href=\"#sesdisablenetworkemulation\"><code>ses.disableNetworkEmulation()</code></a></h4>\n<p>Disables any network emulation already active for the <code>session</code>. Resets to the original network configuration.</p>\n<h4 id=\"sessetcertificateverifyprocproc\"><a href=\"#sessetcertificateverifyprocproc\"><code>ses.setCertificateVerifyProc(proc)</code></a></h4>\n<ul>\n<li><code>proc</code> Function | null<ul>\n<li><code>request</code> Object<ul>\n<li><code>hostname</code> String</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>validatedCertificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>verificationResult</code> String - Verification result from chromium.</li>\n<li><code>errorCode</code> Integer - Error code.</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>verificationResult</code> Integer - Value can be one of certificate error codes from <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">here</a>. Apart from the certificate error codes, the following special codes can be used.<ul>\n<li><code>0</code> - Indicates success and disables Certificate Transparency verification.</li>\n<li><code>-2</code> - Indicates failure.</li>\n<li><code>-3</code> - Uses the verification result from chromium.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Sets the certificate verify proc for <code>session</code>, the <code>proc</code> will be called with <code>proc(request, callback)</code> whenever a server certificate verification is requested. Calling <code>callback(0)</code> accepts the certificate, calling <code>callback(-2)</code> rejects it.</p>\n<p>Calling <code>setCertificateVerifyProc(null)</code> will revert back to default certificate verify proc.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.webContents.session.setCertificateVerifyProc(<span class=\"hljs-function\">(<span class=\"hljs-params\">request, callback</span>) =></span> {\n  <span class=\"hljs-keyword\">const</span> { hostname } = request\n  <span class=\"hljs-keyword\">if</span> (hostname === <span class=\"hljs-string\">'github.com'</span>) {\n    callback(<span class=\"hljs-number\">0</span>)\n  } <span class=\"hljs-keyword\">else</span> {\n    callback(<span class=\"hljs-number\">-2</span>)\n  }\n})\n</code></pre>\n<blockquote>\n<p><strong>NOTE:</strong> The result of this procedure is cached by the network service.</p>\n</blockquote>\n<h4 id=\"sessetpermissionrequesthandlerhandler\"><a href=\"#sessetpermissionrequesthandlerhandler\"><code>ses.setPermissionRequestHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Function | null<ul>\n<li><code>webContents</code> <a href=\"/docs/api/web-contents\">WebContents</a> - WebContents requesting the permission.  Please note that if the request comes from a subframe you should use <code>requestingUrl</code> to check the request origin.</li>\n<li><code>permission</code> String - The type of requested permission.<ul>\n<li><code>clipboard-read</code> - Request access to read from the clipboard.</li>\n<li><code>media</code> -  Request access to media devices such as camera, microphone and speakers.</li>\n<li><code>aufstellen-Eingreif</code>-Zugang dem Bildschirm antragen.</li>\n<li><code>mediaKeySystem</code> - Request access to DRM protected content.</li>\n<li><code>geolocation</code> - Request access to user's current location.</li>\n<li><code>notifications</code> - Request notification creation and the ability to display them in the user's system tray.</li>\n<li><code>midi</code> - Request MIDI access in the <code>webmidi</code> API.</li>\n<li><code>midiSysex</code> - Request the use of system exclusive messages in the <code>webmidi</code> API.</li>\n<li><code>pointerLock</code> - Request to directly interpret mouse movements as an input method. Click <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API\">here</a> to know more.</li>\n<li><code>fullscreen</code> - Request for the app to enter fullscreen mode.</li>\n<li><code>openExternal</code> - Request to open links in external applications.</li>\n<li><code>unknown</code> - An unrecognized permission request</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>permissionGranted</code> Boolean - Allow or deny the permission.</li>\n</ul></li>\n<li><code>details</code> Object - Some properties are only available on certain permission types.<ul>\n<li><code>externalURL</code> String (optional) - The url of the <code>openExternal</code> request.</li>\n<li><code>mediaTypes</code> String<a href=\"/docs/api/optional\"></a> - The types of media access being requested, elements can be <code>video</code> or <code>audio</code></li>\n<li><code>requestingUrl</code> String - The last URL the requesting frame loaded</li>\n<li><code>isMainFrame</code> Boolean - Whether the frame making the request is the main frame</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Sets the handler which can be used to respond to permission requests for the <code>session</code>. Calling <code>callback(true)</code> will allow the permission and <code>callback(false)</code> will reject it. To clear the handler, call <code>setPermissionRequestHandler(null)</code>.  Please note that you must also implement <code>setPermissionCheckHandler</code> to get complete permission handling. Most web APIs do a permission check and then make a permission request if the check is denied.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nsession.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).setPermissionRequestHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, callback</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (webContents.getURL() === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notifications'</span>) {\n    <span class=\"hljs-keyword\">return</span> callback(<span class=\"hljs-literal\">false</span>) <span class=\"hljs-comment\">// denied.</span>\n  }\n\n  callback(<span class=\"hljs-literal\">true</span>)\n})\n</code></pre>\n<h4 id=\"sessetpermissioncheckhandlerhandler\"><a href=\"#sessetpermissioncheckhandlerhandler\"><code>ses.setPermissionCheckHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Funktion\\<boolean> | null<ul>\n<li><code>webContents</code> (<a href=\"/docs/api/web-contents\">WebContents</a> | null) - WebContents checking the permission.  Please note that if the request comes from a subframe you should use <code>requestingUrl</code> to check the request origin.  All cross origin sub frames making permission checks will pass a <code>null</code> webContents to this handler, while certain other permission checks such as <code>notifications</code> checks will always pass <code>null</code>.  You should use <code>embeddingOrigin</code> and <code>requestingOrigin</code> to determine what origin the owning frame and the requesting frame are on respectively.</li>\n<li><code>permission</code> String - Type of permission check.  Valid values are <code>midiSysex</code>, <code>notifications</code>, <code>geolocation</code>, <code>media</code>,<code>mediaKeySystem</code>,<code>midi</code>, <code>pointerLock</code>, <code>fullscreen</code>, <code>openExternal</code>, <code>hid</code>, or <code>serial</code>.</li>\n<li><code>requestingOrigin</code> String - The origin URL of the permission check</li>\n<li><code>details</code> Object - Some properties are only available on certain permission types.<ul>\n<li><code>embeddingOrigin</code> String (optional) - The origin of the frame embedding the frame that made the permission check.  Only set for cross-origin sub frames making permission checks.</li>\n<li><code>securityOrigin</code> String (optional) - The security origin of the <code>media</code> check.</li>\n<li><code>mediaType</code> String (optional) - The type of media access being requested, can be <code>video</code>, <code>audio</code> or <code>unknown</code></li>\n<li><code>requestingUrl</code> String (optional) - The last URL the requesting frame loaded.  This is not provided for cross-origin sub frames making permission checks.</li>\n<li><code>isMainFrame</code> Boolean - Whether the frame making the request is the main frame</li>\n</ul></li>\n</ul></boolean></li>\n</ul>\n<p>Sets the handler which can be used to respond to permission checks for the <code>session</code>. Returning <code>true</code> will allow the permission and <code>false</code> will reject it.  Please note that you must also implement <code>setPermissionRequestHandler</code> to get complete permission handling. Most web APIs do a permission check and then make a permission request if the check is denied. To clear the handler, call <code>setPermissionCheckHandler(null)</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'url'</span>)\nsession.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(requestingOrigin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; permission === <span class=\"hljs-string\">'notifications'</span>) {\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span> <span class=\"hljs-comment\">// granted</span>\n  }\n\n  <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span> <span class=\"hljs-comment\">// denied</span>\n})\n</code></pre>\n<h4 id=\"sessetdevicepermissionhandlerhandler\"><a href=\"#sessetdevicepermissionhandlerhandler\"><code>ses.setDevicePermissionHandler(handler)</code></a></h4>\n<ul>\n<li><code>handler</code> Funktion\\<boolean> | null<ul>\n<li><code>details</code> Objekt<ul>\n<li><code>deviceType</code> String - The type of device that permission is being requested on, can be <code>hid</code>.</li>\n<li><code>origin</code> String - The origin URL of the device permission check.</li>\n<li><code>device</code> <a href=\"/docs/api/structures/hid-device\">HIDDevice</a> - the device that permission is being requested for.</li>\n<li><code>frame</code> <a href=\"/docs/api/web-frame-main\">WebFrameMain</a> - WebFrameMain checking the device permission.</li>\n</ul></li>\n</ul></boolean></li>\n</ul>\n<p>Sets the handler which can be used to respond to device permission checks for the <code>session</code>. Returning <code>true</code> will allow the device to be permitted and <code>false</code> will reject it. To clear the handler, call <code>setDevicePermissionHandler(null)</code>. This handler can be used to provide default permissioning to devices without first calling for permission to devices (eg via <code>navigator.hid.requestDevice</code>).  If this handler is not defined, the default device permissions as granted through device selection (eg via <code>navigator.hid.requestDevice</code>) will be used. Additionally, the default behavior of Electron is to store granted device permision through the lifetime of the corresponding WebContents.  If longer term storage is needed, a developer can store granted device permissions (eg when handling the <code>select-hid-device</code> event) and then read from that storage with <code>setDevicePermissionHandler</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n  win.webContents.session.setPermissionCheckHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">webContents, permission, requestingOrigin, details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (permission === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-comment\">// Add logic here to determine if permission should be given to allow HID selection</span>\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  <span class=\"hljs-comment\">// Optionally, retrieve previously persisted devices from a persistent store</span>\n  <span class=\"hljs-keyword\">const</span> grantedDevices = fetchGrantedDevices()\n\n  win.webContents.session.setDevicePermissionHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">details</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (<span class=\"hljs-keyword\">new</span> URL(details.origin).hostname === <span class=\"hljs-string\">'some-host'</span> &#x26;&#x26; details.deviceType === <span class=\"hljs-string\">'hid'</span>) {\n      <span class=\"hljs-keyword\">if</span> (details.device.vendorId === <span class=\"hljs-number\">123</span> &#x26;&#x26; details.device.productId === <span class=\"hljs-number\">345</span>) {\n        <span class=\"hljs-comment\">// Always allow this type of device (this allows skipping the call to `navigator.hid.requestDevice` first)</span>\n        <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">true</span>\n      }\n\n      <span class=\"hljs-comment\">// Search through the list of devices that have previously been granted permission</span>\n      <span class=\"hljs-keyword\">return</span> grantedDevices.some(<span class=\"hljs-function\">(<span class=\"hljs-params\">grantedDevice</span>) =></span> {\n        <span class=\"hljs-keyword\">return</span> grantedDevice.vendorId === details.device.vendorId &#x26;&#x26;\n              grantedDevice.productId === details.device.productId &#x26;&#x26;\n              grantedDevice.serialNumber &#x26;&#x26; grantedDevice.serialNumber === details.device.serialNumber\n      })\n    }\n    <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n  })\n\n  win.webContents.session.on(<span class=\"hljs-string\">'select-hid-device'</span>, (event, details, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> selectedDevice = details.deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.vendorId === <span class=\"hljs-string\">'9025'</span> &#x26;&#x26; device.productId === <span class=\"hljs-string\">'67'</span>\n    })\n    callback(selectedPort?.deviceId)\n  })\n})\n</code></pre>\n<h4 id=\"sesclearhostresolvercache\"><a href=\"#sesclearhostresolvercache\"><code>ses.clearHostResolverCache()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the operation is complete.</p>\n<p>Clears the host resolver cache.</p>\n<h4 id=\"sesallowntlmcredentialsfordomainsdomains\"><a href=\"#sesallowntlmcredentialsfordomainsdomains\"><code>ses.allowNTLMCredentialsForDomains(domains)</code></a></h4>\n<ul>\n<li><code>domains</code> String - A comma-separated list of servers for which integrated authentication is enabled.</li>\n</ul>\n<p>Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate authentication.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-comment\">// consider any url ending with `example.com`, `foobar.com`, `baz`</span>\n<span class=\"hljs-comment\">// for integrated authentication.</span>\nsession.defaultSession.allowNTLMCredentialsForDomains(<span class=\"hljs-string\">'*example.com, *foobar.com, *baz'</span>)\n\n<span class=\"hljs-comment\">// consider all urls for integrated authentication.</span>\nsession.defaultSession.allowNTLMCredentialsForDomains(<span class=\"hljs-string\">'*'</span>)\n</code></pre>\n<h4 id=\"sessetuseragentuseragent-acceptlanguages\"><a href=\"#sessetuseragentuseragent-acceptlanguages\"><code>ses.setUserAgent(userAgent[, acceptLanguages])</code></a></h4>\n<ul>\n<li><code>userAgent</code> String</li>\n<li><code>acceptLanguages</code> String (optional)</li>\n</ul>\n<p>Overrides the <code>userAgent</code> and <code>acceptLanguages</code> for this session.</p>\n<p>The <code>acceptLanguages</code> must a comma separated ordered list of language codes, for example <code>\"en-US,fr,de,ko,zh-CN,ja\"</code>.</p>\n<p>This doesn't affect existing <code>WebContents</code>, and each <code>WebContents</code> can use <code>webContents.setUserAgent</code> to override the session-wide user agent.</p>\n<h4 id=\"sesispersistent\"><a href=\"#sesispersistent\"><code>ses.isPersistent()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether or not this session is a persistent one. The default <code>webContents</code> session of a <code>BrowserWindow</code> is persistent. When creating a session from a partition, session prefixed with <code>persist:</code> will be persistent, while others will be temporary.</p>\n<h4 id=\"sesgetuseragent\"><a href=\"#sesgetuseragent\"><code>ses.getUserAgent()</code></a></h4>\n<p>Returns <code>String</code> - The user agent for this session.</p>\n<h4 id=\"sessetsslconfigconfig\"><a href=\"#sessetsslconfigconfig\"><code>ses.setSSLConfig(config)</code></a></h4>\n<ul>\n<li><code>config</code> Object<ul>\n<li><code>minVersion</code> String (optional) - Can be <code>tls1</code>, <code>tls1.1</code>, <code>tls1.2</code> or <code>tls1.3</code>. The minimum SSL version to allow when connecting to remote servers. Defaults to <code>tls1</code>.</li>\n<li><code>maxVersion</code> String (optional) - Kann <code>tls1.2</code> oder <code>tls1.3</code> sein. The maximum SSL version to allow when connecting to remote servers. Standardwert ist <code>tls1.3</code>.</li>\n<li><code>disabledCipherSuites</code> Integer<a href=\"/docs/api/optional\"></a> - List of cipher suites which should be explicitly prevented from being used in addition to those disabled by the net built-in policy. Supported literal forms: 0xAABB, where AA is <code>cipher_suite[0]</code> and BB is <code>cipher_suite[1]</code>, as defined in RFC 2246, Section 7.4.1.2. Unrecognized but parsable cipher suites in this form will not return an error. Ex: To disable TLS_RSA_WITH_RC4_128_MD5, specify 0x0004, while to disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002. Note that TLSv1.3 ciphers cannot be disabled using this mechanism.</li>\n</ul></li>\n</ul>\n<p>Sets the SSL configuration for the session. All subsequent network requests will use the new configuration. Existing network connections (such as WebSocket connections) will not be terminated, but old sockets in the pool will not be reused for new connections.</p>\n<h4 id=\"sesgetblobdataidentifier\"><a href=\"#sesgetblobdataidentifier\"><code>ses.getBlobData(identifier)</code></a></h4>\n<ul>\n<li><code>identifier</code> String - Valid UUID.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Buffer></code> - resolves with blob data.</p>\n<h4 id=\"sesdownloadurlurl\"><a href=\"#sesdownloadurlurl\"><code>ses.downloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code>. The API will generate a <a href=\"/docs/api/download-item\">DownloadItem</a> that can be accessed with the <a href=\"#event-will-download\">will-download</a> event.</p>\n<p><strong>Note:</strong> This does not perform any security checks that relate to a page's origin, unlike <a href=\"/docs/api/web-contents#contentsdownloadurlurl\"><code>webContents.downloadURL</code></a>.</p>\n<h4 id=\"sescreateinterrupteddownloadoptions\"><a href=\"#sescreateinterrupteddownloadoptions\"><code>ses.createInterruptedDownload(options)</code></a></h4>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>path</code> String - Absolute path of the download.</li>\n<li><code>urlChain</code> String[] - Complete URL chain for the download.</li>\n<li><code>mimeType</code> String (optional)</li>\n<li><code>offset</code> Integer - Start range for the download.</li>\n<li><code>length</code> Integer - Total length of the download.</li>\n<li><code>lastModified</code> String (optional) - Last-Modified header value.</li>\n<li><code>eTag</code> String (optional) - ETag header value.</li>\n<li><code>startTime</code> Double (optional) - Time when download was started in number of seconds since UNIX epoch.</li>\n</ul></li>\n</ul>\n<p>Allows resuming <code>cancelled</code> or <code>interrupted</code> downloads from previous <code>Session</code>. The API will generate a <a href=\"/docs/api/download-item\">DownloadItem</a> that can be accessed with the <a href=\"#event-will-download\">will-download</a> event. The <a href=\"/docs/api/download-item\">DownloadItem</a> will not have any <code>WebContents</code> associated with it and the initial state will be <code>interrupted</code>. The download will start only when the <code>resume</code> API is called on the <a href=\"/docs/api/download-item\">DownloadItem</a>.</p>\n<h4 id=\"sesclearauthcache\"><a href=\"#sesclearauthcache\"><code>ses.clearAuthCache()</code></a></h4>\n<p>Returns <code>Promise&#x3C;void></code> - resolves when the session’s HTTP authentication cache has been cleared.</p>\n<h4 id=\"sessetpreloadspreloads\"><a href=\"#sessetpreloadspreloads\"><code>ses.setPreloads(preloads)</code></a></h4>\n<ul>\n<li><code>preloads</code> String[] - An array of absolute path to preload scripts</li>\n</ul>\n<p>Adds scripts that will be executed on ALL web contents that are associated with this session just before normal <code>preload</code> scripts run.</p>\n<h4 id=\"sesgetpreloads\"><a href=\"#sesgetpreloads\"><code>ses.getPreloads()</code></a></h4>\n<p>Returns <code>String[]</code> an array of paths to preload scripts that have been registered.</p>\n<h4 id=\"sessetspellcheckerenabledenable\"><a href=\"#sessetspellcheckerenabledenable\"><code>ses.setSpellCheckerEnabled(enable)</code></a></h4>\n<ul>\n<li><code>enable</code> Boolean</li>\n</ul>\n<p>Sets whether to enable the builtin spell checker.</p>\n<h4 id=\"sesisspellcheckerenabled\"><a href=\"#sesisspellcheckerenabled\"><code>ses.isSpellCheckerEnabled()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the builtin spell checker is enabled.</p>\n<h4 id=\"sessetspellcheckerlanguageslanguages\"><a href=\"#sessetspellcheckerlanguageslanguages\"><code>ses.setSpellCheckerLanguages(languages)</code></a></h4>\n<ul>\n<li><code>languages</code> String[] - An array of language codes to enable the spellchecker for.</li>\n</ul>\n<p>The built in spellchecker does not automatically detect what language a user is typing in.  In order for the spell checker to correctly check their words you must call this API with an array of language codes.  You can get the list of supported language codes with the <code>ses.availableSpellCheckerLanguages</code> property.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and will detect your language automatically.  This API is a no-op on macOS.</p>\n<h4 id=\"sesgetspellcheckerlanguages\"><a href=\"#sesgetspellcheckerlanguages\"><code>ses.getSpellCheckerLanguages()</code></a></h4>\n<p>Returns <code>String[]</code> - An array of language codes the spellchecker is enabled for.  If this list is empty the spellchecker will fallback to using <code>en-US</code>.  By default on launch if this setting is an empty list Electron will try to populate this setting with the current OS locale.  This setting is persisted across restarts.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and has its own list of languages.  This API is a no-op on macOS.</p>\n<h4 id=\"sessetspellcheckerdictionarydownloadurlurl\"><a href=\"#sessetspellcheckerdictionarydownloadurlurl\"><code>ses.setSpellCheckerDictionaryDownloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String - A base URL for Electron to download hunspell dictionaries from.</li>\n</ul>\n<p>By default Electron will download hunspell dictionaries from the Chromium CDN.  If you want to override this behavior you can use this API to point the dictionary downloader at your own hosted version of the hunspell dictionaries.  We publish a <code>hunspell_dictionaries.zip</code> file with each release which contains the files you need to host here, the file server must be <strong>case insensitive</strong> you must upload each file twice, once with the case it has in the ZIP file and once with the filename as all lower case.</p>\n<p>If the files present in <code>hunspell_dictionaries.zip</code> are available at <code>https://example.com/dictionaries/language-code.bdic</code> then you should call this api with <code>ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')</code>.  Please note the trailing slash.  The URL to the dictionaries is formed as <code>${url}${filename}</code>.</p>\n<p><strong>Note:</strong> On macOS the OS spellchecker is used and therefore we do not download any dictionary files.  This API is a no-op on macOS.</p>\n<h4 id=\"seslistwordsinspellcheckerdictionary\"><a href=\"#seslistwordsinspellcheckerdictionary\"><code>ses.listWordsInSpellCheckerDictionary()</code></a></h4>\n<p>Returns <code>Promise&#x3C;String[]></code> - An array of all words in app's custom dictionary. Resolves when the full dictionary is loaded from disk.</p>\n<h4 id=\"sesaddwordtospellcheckerdictionaryword\"><a href=\"#sesaddwordtospellcheckerdictionaryword\"><code>ses.addWordToSpellCheckerDictionary(word)</code></a></h4>\n<ul>\n<li><code>word</code> String - The word you want to add to the dictionary</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the word was successfully written to the custom dictionary. This API will not work on non-persistent (in-memory) sessions.</p>\n<p><strong>Note:</strong> On macOS and Windows 10 this word will be written to the OS custom dictionary as well</p>\n<h4 id=\"sesremovewordfromspellcheckerdictionaryword\"><a href=\"#sesremovewordfromspellcheckerdictionaryword\"><code>ses.removeWordFromSpellCheckerDictionary(word)</code></a></h4>\n<ul>\n<li><code>word</code> String - The word you want to remove from the dictionary</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the word was successfully removed from the custom dictionary. This API will not work on non-persistent (in-memory) sessions.</p>\n<p><strong>Note:</strong> On macOS and Windows 10 this word will be removed from the OS custom dictionary as well</p>\n<h4 id=\"sesloadextensionpath-options\"><a href=\"#sesloadextensionpath-options\"><code>ses.loadExtension(path[, options])</code></a></h4>\n<ul>\n<li><code>path</code> String - Path to a directory containing an unpacked Chrome extension</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>allowFileAccess</code> Boolean - Whether to allow the extension to read local files over <code>file://</code> protocol and inject content scripts into <code>file://</code> pages. This is required e.g. for loading devtools extensions on <code>file://</code> URLs. Der Standardwert ist false.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Extension></code> - resolves when the extension is loaded.</p>\n<p>This method will raise an exception if the extension could not be loaded. If there are warnings when installing the extension (e.g. if the extension requests an API that Electron does not support) then they will be logged to the console.</p>\n<p>Note that Electron does not support the full range of Chrome extensions APIs. See <a href=\"/docs/api/extensions#supported-extensions-apis\">Supported Extensions APIs</a> for more details on what is supported.</p>\n<p>Note that in previous versions of Electron, extensions that were loaded would be remembered for future runs of the application. This is no longer the case: <code>loadExtension</code> must be called on every boot of your app if you want the extension to be loaded.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.on(<span class=\"hljs-string\">'ready'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">await</span> session.defaultSession.loadExtension(\n    path.join(__dirname, <span class=\"hljs-string\">'react-devtools'</span>),\n    <span class=\"hljs-comment\">// allowFileAccess is required to load the devtools extension on file:// URLs.</span>\n    { <span class=\"hljs-attr\">allowFileAccess</span>: <span class=\"hljs-literal\">true</span> }\n  )\n  <span class=\"hljs-comment\">// Note that in order to use the React DevTools extension, you'll need to</span>\n  <span class=\"hljs-comment\">// download and unzip a copy of the extension.</span>\n})\n</code></pre>\n<p>This API does not support loading packed (.crx) extensions.</p>\n<p><strong>Note:</strong> This API cannot be called before the <code>ready</code> event of the <code>app</code> module is emitted.</p>\n<p><strong>Note:</strong> Loading extensions into in-memory (non-persistent) sessions is not supported and will throw an error.</p>\n<h4 id=\"sesremoveextensionextensionid\"><a href=\"#sesremoveextensionextensionid\"><code>ses.removeExtension(extensionId)</code></a></h4>\n<ul>\n<li><code>extensionId</code> String - ID of extension to remove</li>\n</ul>\n<p>Unloads an extension.</p>\n<p><strong>Note:</strong> This API cannot be called before the <code>ready</code> event of the <code>app</code> module is emitted.</p>\n<h4 id=\"sesgetextensionextensionid\"><a href=\"#sesgetextensionextensionid\"><code>ses.getExtension(extensionId)</code></a></h4>\n<ul>\n<li><code>extensionId</code> String - ID of extension to query</li>\n</ul>\n<p>Returns <code>Extension</code> | <code>null</code> - The loaded extension with the given ID.</p>\n<p><strong>Note:</strong> This API cannot be called before the <code>ready</code> event of the <code>app</code> module is emitted.</p>\n<h4 id=\"sesgetallextensions\"><a href=\"#sesgetallextensions\"><code>ses.getAllExtensions()</code></a></h4>\n<p>Returns <code>Extension[]</code> - A list of all loaded extensions.</p>\n<p><strong>Note:</strong> This API cannot be called before the <code>ready</code> event of the <code>app</code> module is emitted.</p>\n<h4 id=\"sesgetstoragepath\"><a href=\"#sesgetstoragepath\"><code>ses.getStoragePath()</code></a></h4>\n<p>A <code>String | null</code> indicating the absolute file system path where data for this session is persisted on disk.  For in memory sessions this returns <code>null</code>.</p>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<p>The following properties are available on instances of <code>Session</code>:</p>\n<h4 id=\"sesavailablespellcheckerlanguages-readonly\"><a href=\"#sesavailablespellcheckerlanguages-readonly\"><code>ses.availableSpellCheckerLanguages</code> <em>Readonly</em></a></h4>\n<p>A <code>String[]</code> array which consists of all the known available spell checker languages.  Providing a language code to the <code>setSpellCheckerLanguages</code> API that isn't in this array will result in an error.</p>\n<h4 id=\"sesspellcheckerenabled\"><a href=\"#sesspellcheckerenabled\"><code>ses.spellCheckerEnabled</code></a></h4>\n<p>A <code>Boolean</code> indicating whether builtin spell checker is enabled.</p>\n<h4 id=\"sesstoragepath-readonly\"><a href=\"#sesstoragepath-readonly\"><code>ses.storagePath</code> <em>Readonly</em></a></h4>\n<p>A <code>String | null</code> indicating the absolute file system path where data for this session is persisted on disk.  For in memory sessions this returns <code>null</code>.</p>\n<h4 id=\"sescookies-readonly\"><a href=\"#sescookies-readonly\"><code>ses.cookies</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/cookies\"><code>Cookies</code></a> object for this session.</p>\n<h4 id=\"sesserviceworkers-readonly\"><a href=\"#sesserviceworkers-readonly\"><code>ses.serviceWorkers</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/service-workers\"><code>ServiceWorkers</code></a> object for this session.</p>\n<h4 id=\"seswebrequest-readonly\"><a href=\"#seswebrequest-readonly\"><code>ses.webRequest</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/web-request\"><code>WebRequest</code></a> object for this session.</p>\n<h4 id=\"sesprotocol-readonly\"><a href=\"#sesprotocol-readonly\"><code>ses.protocol</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/protocol\"><code>Protocol</code></a> object for this session.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> protocol = session.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).protocol\n  <span class=\"hljs-keyword\">if</span> (!protocol.registerFileProtocol(<span class=\"hljs-string\">'atom'</span>, (request, callback) => {\n    <span class=\"hljs-keyword\">const</span> url = request.url.substr(<span class=\"hljs-number\">7</span>)\n    callback({ <span class=\"hljs-attr\">path</span>: path.normalize(<span class=\"hljs-string\">`<span class=\"hljs-subst\">${__dirname}</span>/<span class=\"hljs-subst\">${url}</span>`</span>) })\n  })) {\n    <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Failed to register protocol'</span>)\n  }\n})\n</code></pre>\n<h4 id=\"sesnetlog-readonly\"><a href=\"#sesnetlog-readonly\"><code>ses.netLog</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/net-log\"><code>NetLog</code></a> object for this session.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.whenReady().then(<span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> netLog = session.fromPartition(<span class=\"hljs-string\">'some-partition'</span>).netLog\n  netLog.startLogging(<span class=\"hljs-string\">'/path/to/net-log'</span>)\n  <span class=\"hljs-comment\">// After some network events</span>\n  <span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-keyword\">await</span> netLog.stopLogging()\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Net-logs written to'</span>, path)\n})\n</code></pre>",
      "title": "session",
      "description": "Manage browser sessions, cookies, cache, proxy settings, etc."
    },
    "/docs/development/setting-up-symbol-server": {
      "locale": "de-DE",
      "slug": "setting-up-symbol-server",
      "href": "/docs/development/setting-up-symbol-server",
      "crowdinFileId": "256165",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/setting-up-symbol-server.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"einrichtung-eines-symbol-servers-im-debugger\"><a href=\"#einrichtung-eines-symbol-servers-im-debugger\">Einrichtung eines Symbol Servers im Debugger</a></h1>\n<p>Debug-Symbole ermöglichen es Ihnen, bessere Debugging-Sitzungen zu haben. Sie enthalten Informationen über die Funktionen in Anwendungen und Bibliotheken und ermöglichen es ihnen saubere Call-Stacks zu erhalten. Ein Symbolserver erlaubt es dem Debugger die richtigen Symbole, Binärdateien und Quellcode automatisch zu laden, ohne den Nutzer zum Herunterladen großer Debuggingdateien zu zwingen. The server functions like <a href=\"https://support.microsoft.com/kb/311503\">Microsoft's symbol server</a> so the documentation there can be useful.</p>\n<p>Note that because released Electron builds are heavily optimized, debugging is not always easy. The debugger will not be able to show you the content of all variables and the execution path can seem strange because of inlining, tail calls, and other compiler optimizations. The only workaround is to build an unoptimized local build.</p>\n<p>The official symbol server URL for Electron is <a href=\"https://symbols.electronjs.org\">https://symbols.electronjs.org</a>. You cannot visit this URL directly, you must add it to the symbol path of your debugging tool. In the examples below, a local cache directory is used to avoid repeatedly fetching the PDB from the server. Replace <code>c:\\code\\symbols</code> with an appropriate cache directory on your machine.</p>\n<h2 id=\"using-the-symbol-server-in-windbg\"><a href=\"#using-the-symbol-server-in-windbg\">Using the Symbol Server in Windbg</a></h2>\n<p>The Windbg symbol path is configured with a string value delimited with asterisk characters. To use only the Electron symbol server, add the following entry to your symbol path (<strong>Note:</strong> you can replace <code>c:\\code\\symbols</code> with any writable directory on your computer, if you'd prefer a different location for downloaded symbols):</p>\n<pre><code class=\"hljs language-powershell\">SRV*c:\\code\\symbols\\*https://symbols.electronjs.org\n</code></pre>\n<p>Set this string as <code>_NT_SYMBOL_PATH</code> in the environment, using the Windbg menus, or by typing the <code>.sympath</code> command. If you would like to get symbols from Microsoft's symbol server as well, you should list that first:</p>\n<pre><code class=\"hljs language-powershell\">SRV*c:\\code\\symbols\\*https://msdl.microsoft.com/download/symbols;SRV*c:\\code\\symbols\\*https://symbols.electronjs.org\n</code></pre>\n<h2 id=\"using-the-symbol-server-in-visual-studio\"><a href=\"#using-the-symbol-server-in-visual-studio\">Using the symbol server in Visual Studio</a></h2>\n<p><img src=\"https://mdn.mozillademos.org/files/733/symbol-server-vc8express-menu.jpg\" alt=\"Tools -> Options\"> <img src=\"https://mdn.mozillademos.org/files/2497/2005_options.gif\" alt=\"Symbols Settings\"></p>\n<h2 id=\"troubleshooting-symbols-will-not-load\"><a href=\"#troubleshooting-symbols-will-not-load\">Troubleshooting: Symbols will not load</a></h2>\n<p>Type the following commands in Windbg to print why symbols are not loading:</p>\n<pre><code class=\"hljs language-powershell\">> !sym noisy\n> .reload /f electron.exe\n</code></pre>",
      "title": "Einrichtung eines Symbol Servers im Debugger",
      "description": ""
    },
    "/docs/api/share-menu": {
      "locale": "de-DE",
      "slug": "share-menu",
      "href": "/docs/api/share-menu",
      "crowdinFileId": "256367",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/share-menu.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharemenu\"><a href=\"#sharemenu\">ShareMenu</a></h1>\n<p>The <code>ShareMenu</code> class creates <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/\">Share Menu</a> on macOS, which can be used to share information from the current context to apps, social media accounts, and other services.</p>\n<p>For including the share menu as a submenu of other menus, please use the <code>shareMenu</code> role of <a href=\"/docs/api/menu-item\"><code>MenuItem</code></a>.</p>\n<h2 id=\"class-sharemenu\"><a href=\"#class-sharemenu\">Class: ShareMenu</a></h2>\n<blockquote>\n<p>Create share menu on macOS.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<h3 id=\"new-sharemenusharingitem\"><a href=\"#new-sharemenusharingitem\"><code>new ShareMenu(sharingItem)</code></a></h3>\n<ul>\n<li><code>sharingItem</code> SharingItem - The item to share.</li>\n</ul>\n<p>Creates a new share menu.</p>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<p>Das <code>shareMenu</code> Objekt hat die folgenden Instanz Methoden:</p>\n<h4 id=\"sharemenupopupoptions\"><a href=\"#sharemenupopupoptions\"><code>shareMenu.popup([options])</code></a></h4>\n<ul>\n<li><code>options</code> PopupOptions (optional)<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional) - Default ist das fokussierte Fenster.</li>\n<li><code>x</code> Number (optional) - Default is the current mouse cursor position. Must be declared if <code>y</code> is declared.</li>\n<li><code>y</code> Number (optional) - Default is the current mouse cursor position. Must be declared if <code>x</code> is declared.</li>\n<li><code>positioningItem</code> Number (optional) <em>macOS</em> - The index of the menu item to be positioned under the mouse cursor at the specified coordinates. Default is -1.</li>\n<li><code>callback</code> Funktion (optional) - Wird aufgerufen wenn das Menü geschlossen wird.</li>\n</ul></li>\n</ul>\n<p>Pops up this menu as a context menu in the <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</p>\n<h4 id=\"sharemenuclosepopupbrowserwindow\"><a href=\"#sharemenuclosepopupbrowserwindow\"><code>shareMenu.closePopup([browserWindow])</code></a></h4>\n<ul>\n<li><code>browserWindow</code> <a href=\"/docs/api/browser-window\">BrowserWindow</a> (optional) - Default ist das fokussierte Fenster.</li>\n</ul>\n<p>Schließt das Kontext-Menü im <code>browserWindow</code>.</p>",
      "title": "ShareMenu",
      "description": "Create share menu on macOS."
    },
    "/docs/api/structures/shared-worker-info": {
      "locale": "de-DE",
      "slug": "shared-worker-info",
      "href": "/docs/api/structures/shared-worker-info",
      "crowdinFileId": "256505",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/shared-worker-info.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharedworkerinfo-object\"><a href=\"#sharedworkerinfo-object\">SharedWorkerInfo Object</a></h1>\n<ul>\n<li><code>id</code> String - The unique id of the shared worker.</li>\n<li><code>url</code> String - The url of the shared worker.</li>\n</ul>",
      "title": "SharedWorkerInfo Object",
      "description": ""
    },
    "/docs/api/structures/sharing-item": {
      "locale": "de-DE",
      "slug": "sharing-item",
      "href": "/docs/api/structures/sharing-item",
      "crowdinFileId": "256507",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/sharing-item.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"sharingitem-object\"><a href=\"#sharingitem-object\">SharingItem Object</a></h1>\n<ul>\n<li><code>texts</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of text to share.</li>\n<li><code>filePaths</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of files to share.</li>\n<li><code>urls</code> String<a href=\"/docs/api/structures/optional\"></a> - An array of URLs to share.</li>\n</ul>",
      "title": "SharingItem Object",
      "description": ""
    },
    "/docs/api/shell": {
      "locale": "de-DE",
      "slug": "shell",
      "href": "/docs/api/shell",
      "crowdinFileId": "256369",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/shell.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"shell\"><a href=\"#shell\">shell</a></h1>\n<blockquote>\n<p>Verwalten von Dateien und URLs durch ihre Standardprogramme.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a>, <a href=\"/docs/glossary#renderer-process\">Renderer</a> (non-sandboxed only)</p>\n<p>The <code>shell</code> module provides functions related to desktop integration.</p>\n<p>An example of opening a URL in the user's default browser:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nshell.openExternal(<span class=\"hljs-string\">'https://github.com'</span>)\n</code></pre>\n<p><strong>Note:</strong> While the <code>shell</code> module can be used in the renderer process, it will not function in a sandboxed renderer.</p>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Das Modul <code>shell</code> verfügt über die folgenden Methoden:</p>\n<h3 id=\"shellshowiteminfolderfullpath\"><a href=\"#shellshowiteminfolderfullpath\"><code>shell.showItemInFolder(fullPath)</code></a></h3>\n<ul>\n<li><code>fullPath</code> Zeichenkette</li>\n</ul>\n<p>Show the given file in a file manager. If possible, select the file.</p>\n<h3 id=\"shellopenpathpath\"><a href=\"#shellopenpathpath\"><code>shell.openPath(path)</code></a></h3>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - Resolves with a string containing the error message corresponding to the failure if a failure occurred, otherwise \"\".</p>\n<p>Open the given file in the desktop's default manner.</p>\n<h3 id=\"shellopenexternalurl-options\"><a href=\"#shellopenexternalurl-options\"><code>shell.openExternal(url[, options])</code></a></h3>\n<ul>\n<li><code>url</code> String - Max 2081 characters on windows.</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>activate</code> Boolean (optional) <em>macOS</em> - <code>true</code> to bring the opened application to the foreground. The default is <code>true</code>.</li>\n<li><code>workingDirectory</code> String (optional) <em>Windows</em> - The working directory.</li>\n</ul></li>\n</ul>\n<p>Gibt das <code>Promise&#x3C;void></code> zurück</p>\n<p>Open the given external protocol URL in the desktop's default manner. (For example, mailto: URLs in the user's default mail agent).</p>\n<h3 id=\"shelltrashitempath\"><a href=\"#shelltrashitempath\"><code>shell.trashItem(path)</code></a></h3>\n<ul>\n<li><code>path</code> String - path to the item to be moved to the trash.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves when the operation has been completed. Rejects if there was an error while deleting the requested item.</p>\n<p>This moves a path to the OS-specific trash location (Trash on macOS, Recycle Bin on Windows, and a desktop-environment-specific location on Linux).</p>\n<h3 id=\"shellbeep\"><a href=\"#shellbeep\"><code>shell.beep()</code></a></h3>\n<p>Play the beep sound.</p>\n<h3 id=\"shellwriteshortcutlinkshortcutpath-operation-options-windows\"><a href=\"#shellwriteshortcutlinkshortcutpath-operation-options-windows\"><code>shell.writeShortcutLink(shortcutPath[, operation], options)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>shortcutPath</code> Zeichenkette</li>\n<li><code>operation</code> String (optional) - Default is <code>create</code>, can be one of following:<ul>\n<li><code>create</code> - Creates a new shortcut, overwriting if necessary.</li>\n<li><code>update</code> - Updates specified properties only on an existing shortcut.</li>\n<li><code>replace</code> - Overwrites an existing shortcut, fails if the shortcut doesn't exist.</li>\n</ul></li>\n<li><code>options</code> <a href=\"/docs/api/structures/shortcut-details\">ShortcutDetails</a></li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the shortcut was created successfully.</p>\n<p>Creates or updates a shortcut link at <code>shortcutPath</code>.</p>\n<h3 id=\"shellreadshortcutlinkshortcutpath-windows\"><a href=\"#shellreadshortcutlinkshortcutpath-windows\"><code>shell.readShortcutLink(shortcutPath)</code> <em>Windows</em></a></h3>\n<ul>\n<li><code>shortcutPath</code> Zeichenkette</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/shortcut-details\"><code>ShortcutDetails</code></a></p>\n<p>Resolves the shortcut link at <code>shortcutPath</code>.</p>\n<p>An exception will be thrown when any error happens.</p>",
      "title": "shell",
      "description": "Verwalten von Dateien und URLs durch ihre Standardprogramme."
    },
    "/docs/api/structures/shortcut-details": {
      "locale": "de-DE",
      "slug": "shortcut-details",
      "href": "/docs/api/structures/shortcut-details",
      "crowdinFileId": "256509",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/shortcut-details.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"shortcutdetails-object\"><a href=\"#shortcutdetails-object\">ShortcutDetails Object</a></h1>\n<ul>\n<li><code>target</code> String - The target to launch from this shortcut.</li>\n<li><code>cwd</code> String (optional) - The working directory. Default is empty.</li>\n<li><code>args</code> String (optional) - The arguments to be applied to <code>target</code> when launching from this shortcut. Default is empty.</li>\n<li><code>description</code> String (optional) - The description of the shortcut. Default is empty.</li>\n<li><code>icon</code> String (optional) - The path to the icon, can be a DLL or EXE. <code>icon</code> and <code>iconIndex</code> have to be set together. Default is empty, which uses the target's icon.</li>\n<li><code>iconIndex</code> Number (optional) - The resource ID of icon when <code>icon</code> is a DLL or EXE. Default is 0.</li>\n<li><code>appUserModelId</code> String (optional) - The Application User Model ID. Default is empty.</li>\n<li><code>toastActivatorClsid</code> String (optional) - The Application Toast Activator CLSID. Needed for participating in Action Center.</li>\n</ul>",
      "title": "ShortcutDetails Object",
      "description": ""
    },
    "/docs/api/structures/size": {
      "locale": "de-DE",
      "slug": "size",
      "href": "/docs/api/structures/size",
      "crowdinFileId": "256511",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/size.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"size-object\"><a href=\"#size-object\">Size Object</a></h1>\n<ul>\n<li><code>width</code> Number</li>\n<li><code>height</code> Number</li>\n</ul>",
      "title": "Size Object",
      "description": ""
    },
    "/docs/tutorial/snapcraft": {
      "locale": "de-DE",
      "slug": "snapcraft",
      "href": "/docs/tutorial/snapcraft",
      "crowdinFileId": "256249",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/snapcraft.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"snapcraft-guide-linux\"><a href=\"#snapcraft-guide-linux\">Snapcraft Guide (Linux)</a></h1>\n<p>This guide provides information on how to package your Electron application for any Snapcraft environment, including the Ubuntu Software Center.</p>\n<h2 id=\"hintergrund-und-voraussetzungen\"><a href=\"#hintergrund-und-voraussetzungen\">Hintergrund und Voraussetzungen</a></h2>\n<p>Together with the broader Linux community, Canonical aims to fix many of the common software installation problems with the <a href=\"https://snapcraft.io/\"><code>snapcraft</code></a> project. Snaps are containerized software packages that include required dependencies, auto-update, and work on all major Linux distributions without system modification.</p>\n<p>There are three ways to create a <code>.snap</code> file:</p>\n<p>1) Using <a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a> or <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a>, both tools that come with <code>snap</code> support out of the box. This is the easiest option. 2) Using <code>electron-installer-snap</code>, which takes <code>electron-packager</code>'s output. 3) Using an already created <code>.deb</code> package.</p>\n<p>In some cases, you will need to have the <code>snapcraft</code> tool installed. Instructions to install <code>snapcraft</code> for your particular distribution are available <a href=\"https://snapcraft.io/docs/installing-snapcraft\">here</a>.</p>\n<h2 id=\"nutzung-von-electron-installer-snap\"><a href=\"#nutzung-von-electron-installer-snap\">Nutzung von <code>electron-installer-snap</code></a></h2>\n<p>The module works like <a href=\"https://github.com/electron/windows-installer\"><code>electron-winstaller</code></a> and similar modules in that its scope is limited to building snap packages. You can install it with:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron-installer-snap\n</code></pre>\n<h3 id=\"schritt-1-die-electron-anwendung-packen\"><a href=\"#schritt-1-die-electron-anwendung-packen\">Schritt 1: Die Electron Anwendung packen</a></h3>\n<p>Package the application using <a href=\"https://github.com/electron/electron-packager\">electron-packager</a> (or a similar tool). Make sure to remove <code>node_modules</code> that you don't need in your final application, since any module you don't actually need will increase your application's size.</p>\n<p>Die Ausgabe sollte etwa wie folgt aussehen:</p>\n<pre><code class=\"hljs language-plaintext\">.\n└── dist\n    └── app-linux-x64\n        ├── LICENSE\n        ├── LICENSES.chromium.html\n        ├── content_shell.pak\n        ├── app\n        ├── icudtl.dat\n        ├── libgcrypt.so.11\n        ├── libnode.so\n        ├── locales\n        ├── resources\n        ├── v8_context_snapshot.bin\n        └── version\n</code></pre>\n<h3 id=\"step-2-running-electron-installer-snap\"><a href=\"#step-2-running-electron-installer-snap\">Step 2: Running <code>electron-installer-snap</code></a></h3>\n<p>From a terminal that has <code>snapcraft</code> in its <code>PATH</code>, run <code>electron-installer-snap</code> with the only required parameter <code>--src</code>, which is the location of your packaged Electron application created in the first step.</p>\n<pre><code class=\"hljs language-sh\">npx electron-installer-snap --src=out/myappname-linux-x64\n</code></pre>\n<p>If you have an existing build pipeline, you can use <code>electron-installer-snap</code> programmatically. For more information, see the <a href=\"https://docs.snapcraft.io/build-snaps/syntax\">Snapcraft API docs</a>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> snap = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron-installer-snap'</span>)\n\nsnap(options)\n  .then(<span class=\"hljs-function\"><span class=\"hljs-params\">snapPath</span> =></span> <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Created snap at <span class=\"hljs-subst\">${snapPath}</span>!`</span>))\n</code></pre>\n<h2 id=\"using-snapcraft-with-electron-packager\"><a href=\"#using-snapcraft-with-electron-packager\">Using <code>snapcraft</code> with <code>electron-packager</code></a></h2>\n<h3 id=\"step-1-create-sample-snapcraft-project\"><a href=\"#step-1-create-sample-snapcraft-project\">Step 1: Create Sample Snapcraft Project</a></h3>\n<p>Create your project directory and add the following to <code>snap/snapcraft.yaml</code>:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">electron-packager-hello-world</span>\n<span class=\"hljs-attr\">version:</span> <span class=\"hljs-string\">'0.1'</span>\n<span class=\"hljs-attr\">summary:</span> <span class=\"hljs-string\">Hello</span> <span class=\"hljs-string\">World</span> <span class=\"hljs-string\">Electron</span> <span class=\"hljs-string\">app</span>\n<span class=\"hljs-attr\">description:</span> <span class=\"hljs-string\">|\n  Simple Hello World Electron app as an example\n</span><span class=\"hljs-attr\">base:</span> <span class=\"hljs-string\">core18</span>\n<span class=\"hljs-attr\">confinement:</span> <span class=\"hljs-string\">strict</span>\n<span class=\"hljs-attr\">grade:</span> <span class=\"hljs-string\">stable</span>\n\n<span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">electron-packager-hello-world:</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">electron-quick-start/electron-quick-start</span> <span class=\"hljs-string\">--no-sandbox</span>\n    <span class=\"hljs-attr\">extensions:</span> <span class=\"hljs-string\">[gnome-3-34]</span>\n    <span class=\"hljs-attr\">plugs:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">browser-support</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">network</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">network-bind</span>\n    <span class=\"hljs-attr\">environment:</span>\n      <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n      <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n      <span class=\"hljs-attr\">TMPDIR:</span> <span class=\"hljs-string\">$XDG_RUNTIME_DIR</span>\n\n<span class=\"hljs-attr\">parts:</span>\n  <span class=\"hljs-attr\">electron-quick-start:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">nil</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">https://github.com/electron/electron-quick-start.git</span>\n    <span class=\"hljs-attr\">override-build:</span> <span class=\"hljs-string\">|\n        npm install electron electron-packager\n        npx electron-packager . --overwrite --platform=linux --output=release-build --prune=true\n        cp -rv ./electron-quick-start-linux-* $SNAPCRAFT_PART_INSTALL/electron-quick-start\n</span>    <span class=\"hljs-attr\">build-snaps:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">node/14/stable</span>\n    <span class=\"hljs-attr\">build-packages:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">unzip</span>\n    <span class=\"hljs-attr\">stage-packages:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnss3</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnspr4</span>\n</code></pre>\n<p>If you want to apply this example to an existing project:</p>\n<ul>\n<li>Replace <code>source: https://github.com/electron/electron-quick-start.git</code> with <code>source: .</code>.</li>\n<li>Replace all instances of <code>electron-quick-start</code> with your project's name.</li>\n</ul>\n<h3 id=\"step-2-build-the-snap\"><a href=\"#step-2-build-the-snap\">Step 2: Build the snap</a></h3>\n<pre><code class=\"hljs language-sh\">$ snapcraft\n\n&#x3C;output snipped>\nSnapped electron-packager-hello-world_0.1_amd64.snap\n</code></pre>\n<h3 id=\"step-3-install-the-snap\"><a href=\"#step-3-install-the-snap\">Step 3: Install the snap</a></h3>\n<pre><code class=\"hljs language-sh\">sudo snap install electron-packager-hello-world_0.1_amd64.snap --dangerous\n</code></pre>\n<h3 id=\"step-4-run-the-snap\"><a href=\"#step-4-run-the-snap\">Step 4: Run the snap</a></h3>\n<pre><code class=\"hljs language-sh\">electron-packager-hello-world\n</code></pre>\n<h2 id=\"using-an-existing-debian-package\"><a href=\"#using-an-existing-debian-package\">Using an Existing Debian Package</a></h2>\n<p>Snapcraft is capable of taking an existing <code>.deb</code> file and turning it into a <code>.snap</code> file. The creation of a snap is configured using a <code>snapcraft.yaml</code> file that describes the sources, dependencies, description, and other core building blocks.</p>\n<h3 id=\"step-1-create-a-debian-package\"><a href=\"#step-1-create-a-debian-package\">Step 1: Create a Debian Package</a></h3>\n<p>If you do not already have a <code>.deb</code> package, using <code>electron-installer-snap</code> might be an easier path to create snap packages. However, multiple solutions for creating Debian packages exist, including <a href=\"https://github.com/electron-userland/electron-forge\"><code>electron-forge</code></a>, <a href=\"https://github.com/electron-userland/electron-builder\"><code>electron-builder</code></a> or <a href=\"https://github.com/unindented/electron-installer-debian\"><code>electron-installer-debian</code></a>.</p>\n<h3 id=\"step-2-create-a-snapcraftyaml\"><a href=\"#step-2-create-a-snapcraftyaml\">Step 2: Create a snapcraft.yaml</a></h3>\n<p>For more information on the available configuration options, see the <a href=\"https://docs.snapcraft.io/build-snaps/syntax\">documentation on the snapcraft syntax</a>. Let's look at an example:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">myApp</span>\n<span class=\"hljs-attr\">version:</span> <span class=\"hljs-string\">'2.0.0'</span>\n<span class=\"hljs-attr\">summary:</span> <span class=\"hljs-string\">Eine</span> <span class=\"hljs-string\">kurze</span> <span class=\"hljs-string\">Beschreibung</span> <span class=\"hljs-string\">der</span> <span class=\"hljs-string\">App.</span>\n<span class=\"hljs-string\">weist</span> <span class=\"hljs-string\">du</span> <span class=\"hljs-string\">was?</span> <span class=\"hljs-string\">Diese</span> <span class=\"hljs-string\">App</span> <span class=\"hljs-string\">ist</span> <span class=\"hljs-string\">unglaublich!</span> <span class=\"hljs-string\">Sie</span> <span class=\"hljs-string\">tut</span> <span class=\"hljs-string\">all</span> <span class=\"hljs-string\">diese</span> <span class=\"hljs-string\">Dinge</span> <span class=\"hljs-string\">für</span> <span class=\"hljs-string\">dich.</span> <span class=\"hljs-string\">Manch</span> <span class=\"hljs-string\">einer</span> <span class=\"hljs-string\">behauptet,</span> <span class=\"hljs-string\">sie</span> <span class=\"hljs-string\">hält</span> <span class=\"hljs-string\">dich</span> <span class=\"hljs-string\">jung</span> <span class=\"hljs-string\">oder</span> <span class=\"hljs-string\">macht</span> <span class=\"hljs-string\">dich</span> <span class=\"hljs-string\">sogar</span> <span class=\"hljs-string\">glücklich.</span>\n\n<span class=\"hljs-attr\">grade:</span> <span class=\"hljs-string\">stable</span>\n<span class=\"hljs-attr\">confinement:</span> <span class=\"hljs-string\">classic</span>\n\n<span class=\"hljs-attr\">parts:</span>\n  <span class=\"hljs-attr\">slack:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">dump</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">my-deb.deb</span>\n    <span class=\"hljs-attr\">source-type:</span> <span class=\"hljs-string\">deb</span>\n    <span class=\"hljs-attr\">after:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">desktop-gtk3</span>\n    <span class=\"hljs-attr\">stage-packages:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libasound2</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnotify4</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnspr4</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libnss3</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libpcre3</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libpulse0</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libxss1</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">libxtst6</span>\n  <span class=\"hljs-attr\">electron-launch:</span>\n    <span class=\"hljs-attr\">plugin:</span> <span class=\"hljs-string\">dump</span>\n    <span class=\"hljs-attr\">source:</span> <span class=\"hljs-string\">files/</span>\n    <span class=\"hljs-attr\">prepare:</span> <span class=\"hljs-string\">|\n      chmod +x bin/electron-launch\n</span>\n<span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">myApp:</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">bin/electron-launch</span> <span class=\"hljs-string\">$SNAP/usr/lib/myApp/myApp</span>\n    <span class=\"hljs-attr\">desktop:</span> <span class=\"hljs-string\">usr/share/applications/myApp.desktop</span>\n    <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n    <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n    <span class=\"hljs-attr\">environment:</span>\n      <span class=\"hljs-attr\">TMPDIR:</span> <span class=\"hljs-string\">$XDG_RUNTIME_DIR</span>\n</code></pre>\n<p>As you can see, the <code>snapcraft.yaml</code> instructs the system to launch a file called <code>electron-launch</code>. In this example, it passes information on to the app's binary:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-meta\">#!/bin/sh\n</span>\n<span class=\"hljs-built_in\">exec</span> <span class=\"hljs-string\">\"<span class=\"hljs-variable\">$@</span>\"</span> --executed-from=<span class=\"hljs-string\">\"<span class=\"hljs-variable\">$(pwd)</span>\"</span> --pid=$$ > /dev/null 2>&#x26;1 &#x26;\n</code></pre>\n<p>Alternatively, if you're building your <code>snap</code> with <code>strict</code> confinement, you can use the <code>desktop-launch</code> command:</p>\n<pre><code class=\"hljs language-yaml\"><span class=\"hljs-attr\">apps:</span>\n  <span class=\"hljs-attr\">myApp:</span>\n    <span class=\"hljs-comment\"># Correct the TMPDIR path for Chromium Framework/Electron to ensure</span>\n    <span class=\"hljs-comment\"># libappindicator has readable resources.</span>\n    <span class=\"hljs-attr\">command:</span> <span class=\"hljs-string\">env</span> <span class=\"hljs-string\">TMPDIR=$XDG_RUNTIME_DIR</span> <span class=\"hljs-string\">PATH=/usr/local/bin:${PATH}</span> <span class=\"hljs-string\">${SNAP}/bin/desktop-launch</span> <span class=\"hljs-string\">$SNAP/myApp/desktop</span>\n    <span class=\"hljs-attr\">desktop:</span> <span class=\"hljs-string\">usr/share/applications/desktop.desktop</span>\n</code></pre>",
      "title": "Snapcraft Guide (Linux)",
      "description": ""
    },
    "/docs/development/source-code-directory-structure": {
      "locale": "de-DE",
      "slug": "source-code-directory-structure",
      "href": "/docs/development/source-code-directory-structure",
      "crowdinFileId": "256167",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/source-code-directory-structure.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"struktur-des-quellcode-verzeichnisses\"><a href=\"#struktur-des-quellcode-verzeichnisses\">Struktur des Quellcode-Verzeichnisses</a></h1>\n<p>Electrons Source Code ist aufgeteilt in einige Bereiche und folgt weitestgehend den Chromium separation conventions.</p>\n<p>Es wäre hilfreich sich in <a href=\"https://dev.chromium.org/developers/design-documents/multi-process-architecture\">Chromium's Multi-Prozess Architekture</a> einzulesen um den Source Code besser zu verstehen.</p>\n<h2 id=\"struktur-des-source-codes\"><a href=\"#struktur-des-source-codes\">Struktur des Source Codes</a></h2>\n<pre><code class=\"hljs language-diff\">Electron\n├── build/ - Build configuration files needed to build with GN.\n├── buildflags/ - Determines the set of features that can be conditionally built.\n├── chromium_src/ - Source code copied from Chromium that isn't part of the content layer.\n├── default_app/ - A default app run when Electron is started without\n|                  providing a consumer app.\n├── docs/ - Electron's documentation.\n|   ├── api/ - Documentation for Electron's externally-facing modules and APIs.\n|   ├── development/ - Documentation to aid in developing for and with Electron.\n|   ├── fiddles/ - A set of code snippets one can run in Electron Fiddle.\n|   ├── images/ - Images used in documentation.\n|   └── tutorial/ - Tutorial documents for various aspects of Electron.\n├── lib/ - JavaScript/TypeScript source code.\n|   ├── browser/ - Main process initialization code.\n|   |   ├── api/ - API implementation for main process modules.\n|   |   └── remote/ - Code related to the remote module as it is\n|   |                 used in the main process.\n|   ├── common/ - Relating to logic needed by both main and renderer processes.\n|   |   └── api/ - API implementation for modules that can be used in\n|   |              both the main and renderer processes\n|   ├── isolated_renderer/ - Handles creation of isolated renderer processes when\n|   |                        contextIsolation is enabled.\n|   ├── renderer/ - Renderer process initialization code.\n|   |   ├── api/ - API implementation for renderer process modules.\n|   |   ├── extension/ - Code related to use of Chrome Extensions\n|   |   |                in Electron's renderer process.\n|   |   ├── remote/ - Logic that handles use of the remote module in\n|   |   |             the main process.\n|   |   └── web-view/ - Logic that handles the use of webviews in the\n|   |                   renderer process.\n|   ├── sandboxed_renderer/ - Logic that handles creation of sandboxed renderer\n|   |   |                     processes.\n|   |   └── api/ - API implementation for sandboxed renderer processes.\n|   └── worker/ - Logic that handles proper functionality of Node.js\n|                 environments in Web Workers.\n├── patches/ - Patches applied on top of Electron's core dependencies\n|   |          in order to handle differences between our use cases and\n|   |          default functionality.\n|   ├── boringssl/ - Patches applied to Google's fork of OpenSSL, BoringSSL.\n|   ├── chromium/ - Patches applied to Chromium.\n|   ├── node/ - Patches applied on top of Node.js.\n|   └── v8/ - Patches applied on top of Google's V8 engine.\n├── shell/ - C++ source code.\n|   ├── app/ - System entry code.\n|   ├── browser/ - The frontend including the main window, UI, and all of the\n|   |   |          main process things. This talks to the renderer to manage web\n|   |   |          pages.\n|   |   ├── ui/ - Implementation of UI stuff for different platforms.\n|   |   |   ├── cocoa/ - Cocoa specific source code.\n|   |   |   ├── win/ - Windows GUI specific source code.\n|   |   |   └── x/ - X11 specific source code.\n|   |   ├── api/ - The implementation of the main process APIs.\n|   |   ├── net/ - Network related code.\n|   |   ├── mac/ - Mac specific Objective-C source code.\n|   |   └── resources/ - Icons, platform-dependent files, etc.\n|   ├── renderer/ - Code that runs in renderer process.\n|   |   └── api/ - The implementation of renderer process APIs.\n|   └── common/ - Code that used by both the main and renderer processes,\n|       |         including some utility functions and code to integrate node's\n|       |         message loop into Chromium's message loop.\n|       └── api/ - The implementation of common APIs, and foundations of\n|                  Electron's built-in modules.\n├── spec/ - Components of Electron's test suite run in the renderer process.\n├── spec-main/ - Components of Electron's test suite run in the main process.\n└── BUILD.gn - Building rules of Electron.\n</code></pre>\n<h2 id=\"struktur-der-anderen-verzeichnisse\"><a href=\"#struktur-der-anderen-verzeichnisse\">Struktur der anderen Verzeichnisse</a></h2>\n<ul>\n<li><strong>.circleci</strong> - Config file for CI with CircleCI.</li>\n<li><strong>.github</strong> - GitHub-specific config files including issues templates and CODEOWNERS.</li>\n<li><strong>dist</strong> - Temporary directory created by <code>script/create-dist.py</code> script when creating a distribution.</li>\n<li><strong>node_modules</strong> - Third party node modules used for building.</li>\n<li><strong>npm</strong> - Logic for installation of Electron via npm.</li>\n<li><strong>out</strong> - Temporary output directory of <code>ninja</code>.</li>\n<li><strong>script</strong> - Scripts used for development purpose like building, packaging, testing, etc.</li>\n</ul>\n<pre><code class=\"hljs language-diff\">script/ - The set of all scripts Electron runs for a variety of purposes.\n├── codesign/ - Fakes codesigning for Electron apps; used for testing.\n├── lib/ - Miscellaneous python utility scripts.\n└── release/ - Scripts run during Electron's release process.\n    ├── notes/ - Generates release notes for new Electron versions.\n    └── uploaders/ - Uploads various release-related files during release.\n</code></pre>\n<ul>\n<li><strong>typings</strong> - TypeScript typings for Electron's internal code.</li>\n</ul>",
      "title": "Struktur des Quellcode-Verzeichnisses",
      "description": ""
    },
    "/docs/tutorial/spellchecker": {
      "locale": "de-DE",
      "slug": "spellchecker",
      "href": "/docs/tutorial/spellchecker",
      "crowdinFileId": "256251",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/spellchecker.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"spellchecker\"><a href=\"#spellchecker\">SpellChecker</a></h1>\n<p>Electron has built-in support for Chromium's spellchecker since Electron 8.  On Windows and Linux this is powered by Hunspell dictionaries, and on macOS it makes use of the native spellchecker APIs.</p>\n<h2 id=\"how-to-enable-the-spellchecker\"><a href=\"#how-to-enable-the-spellchecker\">How to enable the spellchecker?</a></h2>\n<p>For Electron 9 and higher the spellchecker is enabled by default.  For Electron 8 you need to enable it in <code>webPreferences</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> myWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">spellcheck</span>: <span class=\"hljs-literal\">true</span>\n  }\n})\n</code></pre>\n<h2 id=\"how-to-set-the-languages-the-spellchecker-uses\"><a href=\"#how-to-set-the-languages-the-spellchecker-uses\">How to set the languages the spellchecker uses?</a></h2>\n<p>On macOS as we use the native APIs there is no way to set the language that the spellchecker uses. By default on macOS the native spellchecker will automatically detect the language being used for you.</p>\n<p>For Windows and Linux there are a few Electron APIs you should use to set the languages for the spellchecker.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Sets the spellchecker to check English US and French</span>\nmyWindow.session.setSpellCheckerLanguages([<span class=\"hljs-string\">'en-US'</span>, <span class=\"hljs-string\">'fr'</span>])\n\n<span class=\"hljs-comment\">// An array of all available language codes</span>\n<span class=\"hljs-keyword\">const</span> possibleLanguages = myWindow.session.availableSpellCheckerLanguages\n</code></pre>\n<p>By default the spellchecker will enable the language matching the current OS locale.</p>\n<h2 id=\"how-do-i-put-the-results-of-the-spellchecker-in-my-context-menu\"><a href=\"#how-do-i-put-the-results-of-the-spellchecker-in-my-context-menu\">How do I put the results of the spellchecker in my context menu?</a></h2>\n<p>All the required information to generate a context menu is provided in the <a href=\"/docs/api/web-contents#event-context-menu\"><code>context-menu</code></a> event on each <code>webContents</code> instance.  A small example of how to make a context menu with this information is provided below.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { Menu, MenuItem } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nmyWindow.webContents.on(<span class=\"hljs-string\">'context-menu'</span>, (event, params) => {\n  <span class=\"hljs-keyword\">const</span> menu = <span class=\"hljs-keyword\">new</span> Menu()\n\n  <span class=\"hljs-comment\">// Add each spelling suggestion</span>\n  <span class=\"hljs-keyword\">for</span> (<span class=\"hljs-keyword\">const</span> suggestion <span class=\"hljs-keyword\">of</span> params.dictionarySuggestions) {\n    menu.append(<span class=\"hljs-keyword\">new</span> MenuItem({\n      <span class=\"hljs-attr\">label</span>: suggestion,\n      <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> mainWindow.webContents.replaceMisspelling(suggestion)\n    }))\n  }\n\n  <span class=\"hljs-comment\">// Allow users to add the misspelled word to the dictionary</span>\n  <span class=\"hljs-keyword\">if</span> (params.misspelledWord) {\n    menu.append(\n      <span class=\"hljs-keyword\">new</span> MenuItem({\n        <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Add to dictionary'</span>,\n        <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> mainWindow.webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord)\n      })\n    )\n  }\n\n  menu.popup()\n})\n</code></pre>\n<h2 id=\"does-the-spellchecker-use-any-google-services\"><a href=\"#does-the-spellchecker-use-any-google-services\">Does the spellchecker use any Google services?</a></h2>\n<p>Although the spellchecker itself does not send any typings, words or user input to Google services the hunspell dictionary files are downloaded from a Google CDN by default.  If you want to avoid this you can provide an alternative URL to download the dictionaries from.</p>\n<pre><code class=\"hljs language-js\">myWindow.session.setSpellCheckerDictionaryDownloadURL(<span class=\"hljs-string\">'https://example.com/dictionaries/'</span>)\n</code></pre>\n<p>Check out the docs for <a href=\"/docs/api/session#sessetspellcheckerdictionarydownloadurlurl\"><code>session.setSpellCheckerDictionaryDownloadURL</code></a> for more information on where to get the dictionary files from and how you need to host them.</p>",
      "title": "SpellChecker",
      "description": ""
    },
    "/docs/styleguide": {
      "locale": "de-DE",
      "slug": "styleguide",
      "href": "/docs/styleguide",
      "crowdinFileId": "256125",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/styleguide.md",
      "category": "",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-documentation-style-guide\"><a href=\"#electron-documentation-style-guide\">Electron Documentation Style Guide</a></h1>\n<p>Dies sind die Richtlinien für das Schreiben von Dokumentation zu Elektron.</p>\n<h2 id=\"überschriften\"><a href=\"#überschriften\">Überschriften</a></h2>\n<ul>\n<li>Jede Seite hat ein einzelnen Titel mit <code>#</code> am Anfang.</li>\n<li>Chapters in the same page must have <code>##</code>-level headings.</li>\n<li>Sub-chapters need to increase the number of <code>#</code> in the heading according to their nesting depth.</li>\n<li>The page's title must follow <a href=\"https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case\">APA title case</a>.</li>\n<li>All chapters must follow <a href=\"https://apastyle.apa.org/style-grammar-guidelines/capitalization/sentence-case\">APA sentence case</a>.</li>\n</ul>\n<p>Am Beispiel von <code>Schnellstart</code>:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># Schnellstart</span>\n\n...\n\n<span class=\"hljs-section\">## Main-Prozess</span>\n\n...\n\n<span class=\"hljs-section\">## Renderer-Prozess</span>\n\n...\n\n<span class=\"hljs-section\">## Ihre App ausführen</span>\n\n...\n\n<span class=\"hljs-section\">### Als Distribution ausführen</span>\n\n...\n\n<span class=\"hljs-section\">### Electron-Binärdatei manuell herunterladen</span>\n\n...\n</code></pre>\n<p>Für API-Referenzen gibt es Ausnahmen von dieser Regel.</p>\n<h2 id=\"markdown-dateien\"><a href=\"#markdown-dateien\">Markdown-Dateien</a></h2>\n<p>This repository uses the <a href=\"https://github.com/DavidAnson/markdownlint\"><code>markdownlint</code></a> package to enforce consistent Markdown styling. For the exact rules, see the <code>.markdownlint.json</code> file in the root folder.</p>\n<p>There are a few style guidelines that aren't covered by the linter rules:</p>\n<!--TODO(erickzhao): make sure this matches with the lint:markdownlint task-->\n<ul>\n<li>Use <code>sh</code> instead of <code>cmd</code> in code blocks (due to the syntax highlighter).</li>\n<li>Keep line lengths between 80 and 100 characters if possible for readability purposes.</li>\n<li>Keine Schachtelungen sind mehr als 2 Ebenen (aufgrund des Markdown Renderers).</li>\n<li>Wszystkie bloki kodu <code>js</code> i <code>javascript</code> są sprawdzane pod względem zgodności ze stylem <a href=\"https://www.npmjs.com/package/standard-markdown\">standard-markdown</a>.</li>\n<li>For unordered lists, use asterisks instead of dashes.</li>\n</ul>\n<h2 id=\"wörter-auswählen\"><a href=\"#wörter-auswählen\">Wörter auswählen</a></h2>\n<ul>\n<li>\"Wird\" sollte statt \"würde\" verwendet werden, um Ergebnisse zu beschreiben.</li>\n<li>Debuggen des Hauptprozesses in VSCode\".</li>\n</ul>\n<h2 id=\"api-referenzen\"><a href=\"#api-referenzen\">API Referenzen</a></h2>\n<p>Die folgenden Regeln gelten nur für Dokumentationen der APIs.</p>\n<h3 id=\"title-and-description\"><a href=\"#title-and-description\">Title and description</a></h3>\n<p>Each module's API doc must use the actual object name returned by <code>require('electron')</code> as its title (such as <code>BrowserWindow</code>, <code>autoUpdater</code>, and <code>session</code>).</p>\n<p>Directly under the page title, add a one-line description of the module as a markdown quote (beginning with <code>></code>).</p>\n<p>Using the <code>session</code> module as an example:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># session</span>\n\n<span class=\"hljs-quote\">> Verwalte Browser-Sitzungen, Cookies, Cache, Proxy-Einstellungen, etc.</span>\n</code></pre>\n<h3 id=\"methoden-und-events-von-modulen\"><a href=\"#methoden-und-events-von-modulen\">Methoden und Events von Modulen</a></h3>\n<p>Für Module, die keine Klassen sind, müssen deren Methoden und Events unter <code>## Methods</code> und <code>## Events</code> aufgelistet werden.</p>\n<p>Verwende <code>AutoUpdater</code> als Beispiel:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># autoUpdater</span>\n\n<span class=\"hljs-section\">## Events</span>\n\n<span class=\"hljs-section\">### Event: 'error'</span>\n\n<span class=\"hljs-section\">## Methoden</span>\n\n<span class=\"hljs-section\">### `autoUpdater.setFeedURL(url[, requestHeaders])`</span>\n</code></pre>\n<h3 id=\"klassen\"><a href=\"#klassen\">Klassen</a></h3>\n<ul>\n<li>API-Klassen oder Klassen, die Teil von Modulen sind, müssen unter dem Kapitel <code>## Klassen: Klassenname</code> aufgeführt werden.</li>\n<li>Eine Seite kann mehrere Klassen haben.</li>\n<li>Constructors must be listed with <code>###</code>-level headings.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static\">Static Methods</a> must be listed under a <code>### Static Methods</code> chapter.</li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Prototype_methods\">Instance Methods</a> must be listed under an <code>### Instance Methods</code> chapter.</li>\n<li>All methods that have a return value must start their description with \"Returns <code>[TYPE]</code> - [Return description]\"<ul>\n<li>If the method returns an <code>Object</code>, its structure can be specified using a colon followed by a newline then an unordered list of properties in the same style as function parameters.</li>\n</ul></li>\n<li>Instance Events must be listed under an <code>### Instance Events</code> chapter.</li>\n<li>Instance Properties must be listed under an <code>### Instance Properties</code> chapter.<ul>\n<li>Instance Properties must start with \"A [Property Type] ...\"</li>\n</ul></li>\n</ul>\n<p>Using the <code>Session</code> and <code>Cookies</code> classes as an example:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\"># session</span>\n\n<span class=\"hljs-section\">## Methods</span>\n\n<span class=\"hljs-section\">### session.fromPartition(partition)</span>\n\n<span class=\"hljs-section\">## Static Properties</span>\n\n<span class=\"hljs-section\">### session.defaultSession</span>\n\n<span class=\"hljs-section\">## Class: Session</span>\n\n<span class=\"hljs-section\">### Instance Events</span>\n\n<span class=\"hljs-section\">#### Event: 'will-download'</span>\n\n<span class=\"hljs-section\">### Instance Methods</span>\n\n<span class=\"hljs-section\">#### `ses.getCacheSize()`</span>\n\n<span class=\"hljs-section\">### Instance Properties</span>\n\n<span class=\"hljs-section\">#### `ses.cookies`</span>\n\n<span class=\"hljs-section\">## Class: Cookies</span>\n\n<span class=\"hljs-section\">### Instance Methods</span>\n\n<span class=\"hljs-section\">#### `cookies.get(filter, callback)`</span>\n</code></pre>\n<h3 id=\"methods-and-their-arguments\"><a href=\"#methods-and-their-arguments\">Methods and their arguments</a></h3>\n<p>The methods chapter must be in the following form:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### `objectName.methodName(required[, optional]))`</span>\n<span class=\"hljs-bullet\">\n* </span><span class=\"hljs-code\">`required`</span> String - A parameter description.\n<span class=\"hljs-bullet\">* </span><span class=\"hljs-code\">`optional`</span> Integer (optional) - Another parameter description.\n\n...\n</code></pre>\n<h4 id=\"heading-level\"><a href=\"#heading-level\">Heading level</a></h4>\n<p>The heading can be <code>###</code> or <code>####</code>-levels depending on whether the method belongs to a module or a class.</p>\n<h4 id=\"function-signature\"><a href=\"#function-signature\">Function signature</a></h4>\n<p>For modules, the <code>objectName</code> is the module's name. For classes, it must be the name of the instance of the class, and must not be the same as the module's name.</p>\n<p>For example, the methods of the <code>Session</code> class under the <code>session</code> module must use <code>ses</code> as the <code>objectName</code>.</p>\n<p>Optional arguments are notated by square brackets <code>[]</code> surrounding the optional argument as well as the comma required if this optional argument follows another argument:</p>\n<pre><code class=\"hljs language-markdown\">erforderlich[, optional]\n</code></pre>\n<h4 id=\"argument-descriptions\"><a href=\"#argument-descriptions\">Argument descriptions</a></h4>\n<p>More detailed information on each of the arguments is noted in an unordered list below the method. The type of argument is notated by either JavaScript primitives (e.g. <code>String</code>, <code>Promise</code>, or <code>Object</code>), a custom API structure like Electron's <a href=\"/docs/api/structures/cookie\"><code>Cookie</code></a>, or the wildcard <code>any</code>.</p>\n<p>If the argument is of type <code>Array</code>, use <code>[]</code> shorthand with the type of value inside the array (for example,<code>any[]</code> or <code>String[]</code>).</p>\n<p>If the argument is of type <code>Promise</code>, parametrize the type with what the promise resolves to (for example, <code>Promise&#x3C;void></code> or <code>Promise&#x3C;String></code>).</p>\n<p>If an argument can be of multiple types, separate the types with <code>|</code>.</p>\n<p>The description for <code>Function</code> type arguments should make it clear how it may be called and list the types of the parameters that will be passed to it.</p>\n<h4 id=\"platform-specific-functionality\"><a href=\"#platform-specific-functionality\">Platform-specific functionality</a></h4>\n<p>If an argument or a method is unique to certain platforms, those platforms are denoted using a space-delimited italicized list following the datatype. Werte können <code>macOS</code>, <code>Windows</code> oder <code>Linux</code> sein.</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-bullet\">* </span><span class=\"hljs-code\">`animate`</span> Boolean (optional) <span class=\"hljs-emphasis\">_macOS_</span> <span class=\"hljs-emphasis\">_Windows_</span> - Animate the thing.\n</code></pre>\n<h3 id=\"ereignisse\"><a href=\"#ereignisse\">Ereignisse</a></h3>\n<p>The events chapter must be in following form:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### Ereignis: 'aufwachen'</span>\n\nGibt zurück:\n<span class=\"hljs-bullet\">\n* </span><span class=\"hljs-code\">`time`</span> String\n\n...\n</code></pre>\n<p>The heading can be <code>###</code> or <code>####</code>-levels depending on whether the event belongs to a module or a class.</p>\n<p>The arguments of an event follow the same rules as methods.</p>\n<h3 id=\"eigenschaften\"><a href=\"#eigenschaften\">Eigenschaften</a></h3>\n<p>The properties chapter must be in following form:</p>\n<pre><code class=\"hljs language-markdown\"><span class=\"hljs-section\">### session.defaultSession</span>\n\n...\n</code></pre>\n<p>The heading can be <code>###</code> or <code>####</code>-levels depending on whether the property belongs to a module or a class.</p>\n<h2 id=\"documentation-translations\"><a href=\"#documentation-translations\">Documentation translations</a></h2>\n<p>Siehe <a href=\"https://github.com/electron/i18n#readme\">Elektron/i18n</a></p>",
      "title": "Electron Documentation Style Guide",
      "description": ""
    },
    "/docs/tutorial/support": {
      "locale": "de-DE",
      "slug": "support",
      "href": "/docs/tutorial/support",
      "crowdinFileId": "256253",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/support.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"electron-support\"><a href=\"#electron-support\">Electron Support</a></h1>\n<h2 id=\"hilfe-finden\"><a href=\"#hilfe-finden\">Hilfe finden</a></h2>\n<p>If you have a security concern, please see the <a href=\"https://github.com/electron/electron/tree/main/SECURITY.md\">security document</a>.</p>\n<p>If you're looking for programming help, for answers to questions, or to join in discussion with other developers who use Electron, you can interact with the community in these locations:</p>\n<ul>\n<li><a href=\"https://discord.com/invite/electron\"><code>Electron's Discord</code></a> has channels for:<ul>\n<li>Getting help</li>\n<li>Ecosystem apps like <a href=\"https://github.com/electron-userland/electron-forge\">Electron Forge</a> and <a href=\"https://github.com/electron/fiddle\">Electron Fiddle</a></li>\n<li>Sharing ideas with other Electron app developers</li>\n<li>And more!</li>\n</ul></li>\n<li><a href=\"https://discuss.atom.io/c/electron\"><code>electron</code></a> category on the Atom forums</li>\n<li><code>#electron</code> Kanal auf <a href=\"https://discuss.atom.io/t/join-us-on-slack/16638?source_topic_id=25406\">Atom's Slack</a></li>\n<li><a href=\"https://telegram.me/electron_ru\"><code>electron-ru</code></a> <em>(Russian)</em></li>\n<li><a href=\"https://electron-br.slack.com\"><code>electron-br</code></a> <em>(Brazilian Portuguese)</em></li>\n<li><a href=\"https://electron-kr.github.io/electron-kr\"><code>electron-kr</code></a> <em>(Korean)</em></li>\n<li><a href=\"https://electron-jp.slack.com\"><code>electron-jp</code></a> <em>(Japanese)</em></li>\n<li><a href=\"https://electron-tr.herokuapp.com\"><code>electron-tr</code></a> <em>(Turkish)</em></li>\n<li><a href=\"https://electron-id.slack.com\"><code>electron-id</code></a> <em>(Indonesia)</em></li>\n<li><a href=\"https://electronpl.github.io\"><code>electron-pl</code></a> <em>(Poland)</em></li>\n</ul>\n<p>If you'd like to contribute to Electron, see the <a href=\"https://github.com/electron/electron/blob/main/CONTRIBUTING.md\">contributing document</a>.</p>\n<p>If you've found a bug in a <a href=\"#supported-versions\">supported version</a> of Electron, please report it with the <a href=\"/docs/development/issues\">issue tracker</a>.</p>\n<p><a href=\"https://github.com/sindresorhus/awesome-electron\">awesome-electron</a> is a community-maintained list of useful example apps, tools and resources.</p>\n<h2 id=\"supported-versions\"><a href=\"#supported-versions\">Supported Versions</a></h2>\n<p><em><strong>Note:</strong> Beginning in September 2021 with Electron 15, the Electron team will temporarily support the latest <strong>four</strong> stable major versions. This extended support is intended to help Electron developers transition to the <a href=\"https://electronjs.org/blog/8-week-cadence\">new eight week release cadence</a>, and will continue until May 2022, with the release of Electron 19. At that time, the Electron team will drop support back to the latest three stable major versions.</em></p>\n<p>The latest three <em>stable</em> major versions are supported by the Electron team. For example, if the latest release is 6.1.x, then the 5.0.x as well as the 4.2.x series are supported.  We only support the latest minor release for each stable release series.  This means that in the case of a security fix 6.1.x will receive the fix, but we will not release a new version of 6.0.x.</p>\n<p>The latest stable release unilaterally receives all fixes from <code>main</code>, and the version prior to that receives the vast majority of those fixes as time and bandwidth warrants. The oldest supported release line will receive only security fixes directly.</p>\n<p>All supported release lines will accept external pull requests to backport fixes previously merged to <code>main</code>, though this may be on a case-by-case basis for some older supported lines. All contested decisions around release line backports will be resolved by the <a href=\"https://github.com/electron/governance/tree/main/wg-releases\">Releases Working Group</a> as an agenda item at their weekly meeting the week the backport PR is raised.</p>\n<p>When an API is changed or removed in a way that breaks existing functionality, the previous functionality will be supported for a minimum of two major versions when possible before being removed. For example, if a function takes three arguments, and that number is reduced to two in major version 10, the three-argument version would continue to work until, at minimum, major version 12. Past the minimum two-version threshold, we will attempt to support backwards compatibility beyond two versions until the maintainers feel the maintenance burden is too high to continue doing so.</p>\n<h3 id=\"currently-supported-versions\"><a href=\"#currently-supported-versions\">Currently supported versions</a></h3>\n<ul>\n<li>15.x.y</li>\n<li>14.x.y</li>\n<li>13.x.y</li>\n<li>12</li>\n</ul>\n<h3 id=\"end-of-life\"><a href=\"#end-of-life\">End-of-life</a></h3>\n<p>When a release branch reaches the end of its support cycle, the series will be deprecated in NPM and a final end-of-support release will be made. This release will add a warning to inform that an unsupported version of Electron is in use.</p>\n<p>These steps are to help app developers learn when a branch they're using becomes unsupported, but without being excessively intrusive to end users.</p>\n<p>If an application has exceptional circumstances and needs to stay on an unsupported series of Electron, developers can silence the end-of-support warning by omitting the final release from the app's <code>package.json</code> <code>devDependencies</code>. For example, since the 1-6-x series ended with an end-of-support 1.6.18 release, developers could choose to stay in the 1-6-x series without warnings with <code>devDependency</code> of <code>\"electron\": 1.6.0 - 1.6.17</code>.</p>\n<h2 id=\"unterstützte-plattformen\"><a href=\"#unterstützte-plattformen\">Unterstützte Plattformen</a></h2>\n<p>Die folgenden Plattformen werden durch Electron unterstützt:</p>\n<h3 id=\"macos\"><a href=\"#macos\">macOS</a></h3>\n<p>Only 64bit binaries are provided for macOS, and the minimum macOS version supported is macOS 10.11 (El Capitan).</p>\n<p>Native support for Apple Silicon (<code>arm64</code>) devices was added in Electron 11.0.0.</p>\n<h3 id=\"windows\"><a href=\"#windows\">Windows</a></h3>\n<p>Windows 7 und neuere Versionen werden unterstützt. Ältere Betriebssysteme werden nicht unterstützt (und funktionieren nicht zusammen mit Electron).</p>\n<p>Both <code>ia32</code> (<code>x86</code>) and <code>x64</code> (<code>amd64</code>) binaries are provided for Windows. <a href=\"/docs/tutorial/windows-arm\">Native support for Windows on Arm (<code>arm64</code>) devices was added in Electron 6.0.8.</a>. Running apps packaged with previous versions is possible using the ia32 binary.</p>\n<h3 id=\"linux\"><a href=\"#linux\">Linux</a></h3>\n<p>The prebuilt binaries of Electron are built on Ubuntu 18.04.</p>\n<p>Ob die vorkompilierten Dateien auf einer Distribution laufen, hängt davon ab, ob die Distribution die Bibliotheken enthält, die auf der Build-Plattform verwendet wurden. Deshalb ist nur für Ubuntu 18.04 garantiert, dass es funktioniert, aber die folgenden Plattformen wurden ebenfalls bestätigt, kompatibel mit den vorkompilierten Dateien zu sein:</p>\n<ul>\n<li>Ubuntu 14.04 und neuer</li>\n<li>Fedora 24 and newer</li>\n<li>Debian 8 and newer</li>\n</ul>",
      "title": "Electron Support",
      "description": ""
    },
    "/docs/api/synopsis": {
      "locale": "de-DE",
      "slug": "synopsis",
      "href": "/docs/api/synopsis",
      "crowdinFileId": "256371",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/synopsis.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"übersicht\"><a href=\"#übersicht\">Übersicht</a></h1>\n<blockquote>\n<p>How to use Node.js and Electron APIs.</p>\n</blockquote>\n<p>All of <a href=\"https://nodejs.org/api/\">Node.js's built-in modules</a> are available in Electron and third-party node modules also fully supported as well (including the <a href=\"/docs/tutorial/using-native-node-modules\">native modules</a>).</p>\n<p>Electron also provides some extra built-in modules for developing native desktop applications. Some modules are only available in the main process, some are only available in the renderer process (web page), and some can be used in either process type.</p>\n<p>The basic rule is: if a module is <a href=\"https://en.wikipedia.org/wiki/Graphical_user_interface\">GUI</a> or low-level system related, then it should be only available in the main process. You need to be familiar with the concept of main process vs. renderer process scripts to be able to use those modules.</p>\n<p>Das Main-Prozess Script ist wie ein normales Node.js Script:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>The renderer process is no different than a normal web page, except for the extra ability to use node modules if <code>nodeIntegration</code> is enabled:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-meta\">&#x3C;!DOCTYPE html></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  <span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n  <span class=\"hljs-built_in\">console</span>.log(fs.readFileSync(__filename, <span class=\"hljs-string\">'utf8'</span>))\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<h2 id=\"destructuring-assignment\"><a href=\"#destructuring-assignment\">Destructuring assignment</a></h2>\n<p>As of 0.37, you can use <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment\">destructuring assignment</a> to make it easier to use built-in modules.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>Wenn du das gesamte <code>electron</code> Module brauchst, dann kannst du dieses per require einbinden und auf einzelne <code>electron</code> Module per destructuring zugreifen.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> electron = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = electron\n\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>\n<p>Dies ist equivalent zum folgenden Code:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> electron = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> app = electron.app\n<span class=\"hljs-keyword\">const</span> BrowserWindow = electron.BrowserWindow\n<span class=\"hljs-keyword\">let</span> win\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n})\n</code></pre>",
      "title": "Übersicht",
      "description": "How to use Node.js and Electron APIs."
    },
    "/docs/api/system-preferences": {
      "locale": "de-DE",
      "slug": "system-preferences",
      "href": "/docs/api/system-preferences",
      "crowdinFileId": "256373",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/system-preferences.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"systempreferences\"><a href=\"#systempreferences\">systemPreferences</a></h1>\n<blockquote>\n<p>Systemeinstellungen anschauen.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(systemPreferences.isDarkMode())\n</code></pre>\n<h2 id=\"ereignisse\"><a href=\"#ereignisse\">Ereignisse</a></h2>\n<p>Das <code>systemPreferences</code> Objekt stellt folgende Event zur Verfügung:</p>\n<h3 id=\"event-accent-color-changed-windows\"><a href=\"#event-accent-color-changed-windows\">Event: 'accent-color-changed' <em>Windows</em></a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>newColor</code> String - The new RGBA color the user assigned to be their system accent color.</li>\n</ul>\n<h3 id=\"event-color-changed-windows\"><a href=\"#event-color-changed-windows\">Event: 'color-changed' <em>Windows</em></a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<h3 id=\"event-inverted-color-scheme-changed-windows-deprecated\"><a href=\"#event-inverted-color-scheme-changed-windows-deprecated\">Event: 'inverted-color-scheme-changed' <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>invertedColorScheme</code> Boolean - <code>true</code> if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is being used, <code>false</code> otherwise.</li>\n</ul>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#event-updated\"><code>updated</code></a> event on the <code>nativeTheme</code> module.</p>\n<h3 id=\"event-high-contrast-color-scheme-changed-windows-deprecated\"><a href=\"#event-high-contrast-color-scheme-changed-windows-deprecated\">Event: 'high-contrast-color-scheme-changed' <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>highContrastColorScheme</code> Boolean - <code>true</code> if a high contrast theme is being used, <code>false</code> otherwise.</li>\n</ul>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#event-updated\"><code>updated</code></a> event on the <code>nativeTheme</code> module.</p>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<h3 id=\"systempreferencesisdarkmode-macos-windows-deprecated\"><a href=\"#systempreferencesisdarkmode-macos-windows-deprecated\"><code>systemPreferences.isDarkMode()</code> <em>macOS</em> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Returns <code>Boolean</code> - Whether the system is in Dark Mode.</p>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#nativethemeshouldusedarkcolors-readonly\"><code>nativeTheme.shouldUseDarkColors</code></a> API.</p>\n<h3 id=\"systempreferencesisswipetrackingfromscrolleventsenabled-macos\"><a href=\"#systempreferencesisswipetrackingfromscrolleventsenabled-macos\"><code>systemPreferences.isSwipeTrackingFromScrollEventsEnabled()</code> <em>macOS</em></a></h3>\n<p>Returns <code>Boolean</code> - Whether the Swipe between pages setting is on.</p>\n<h3 id=\"systempreferencespostnotificationevent-userinfo-deliverimmediately-macos\"><a href=\"#systempreferencespostnotificationevent-userinfo-deliverimmediately-macos\"><code>systemPreferences.postNotification(event, userInfo[, deliverImmediately])</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n<li><code>deliverImmediately</code> Boolean (optional) - <code>true</code> to post notifications immediately even when the subscribing app is inactive.</li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencespostlocalnotificationevent-userinfo-macos\"><a href=\"#systempreferencespostlocalnotificationevent-userinfo-macos\"><code>systemPreferences.postLocalNotification(event, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencespostworkspacenotificationevent-userinfo-macos\"><a href=\"#systempreferencespostworkspacenotificationevent-userinfo-macos\"><code>systemPreferences.postWorkspaceNotification(event, userInfo)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, any></li>\n</ul>\n<p>Posts <code>event</code> as native notifications of macOS. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification.</p>\n<h3 id=\"systempreferencessubscribenotificationevent-callback-macos\"><a href=\"#systempreferencessubscribenotificationevent-callback-macos\"><code>systemPreferences.subscribeNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> Zeichenkette</li>\n</ul></li>\n</ul>\n<p>Returns <code>Number</code> - The ID of this subscription</p>\n<p>Subscribes to native notifications of macOS, <code>callback</code> will be called with <code>callback(event, userInfo)</code> when the corresponding <code>event</code> happens. The <code>userInfo</code> is an Object that contains the user information dictionary sent along with the notification. The <code>object</code> is the sender of the notification, and only supports <code>NSString</code> values for now.</p>\n<p>The <code>id</code> of the subscriber is returned, which can be used to unsubscribe the <code>event</code>.</p>\n<p>Under the hood this API subscribes to <code>NSDistributedNotificationCenter</code>, example values of <code>event</code> are:</p>\n<ul>\n<li><code>AppleInterfaceThemeChangedNotification</code></li>\n<li><code>AppleAquaColorVariantChanged</code></li>\n<li><code>AppleColorPreferencesChangedNotification</code></li>\n<li><code>AppleShowScrollBarsSettingChanged</code></li>\n</ul>\n<h3 id=\"systempreferencessubscribelocalnotificationevent-callback-macos\"><a href=\"#systempreferencessubscribelocalnotificationevent-callback-macos\"><code>systemPreferences.subscribeLocalNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> Zeichenkette</li>\n</ul></li>\n</ul>\n<p>Returns <code>Number</code> - The ID of this subscription</p>\n<p>Same as <code>subscribeNotification</code>, but uses <code>NSNotificationCenter</code> for local defaults. This is necessary for events such as <code>NSUserDefaultsDidChangeNotification</code>.</p>\n<h3 id=\"systempreferencessubscribeworkspacenotificationevent-callback-macos\"><a href=\"#systempreferencessubscribeworkspacenotificationevent-callback-macos\"><code>systemPreferences.subscribeWorkspaceNotification(event, callback)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>event</code> String</li>\n<li><code>callback</code> Function<ul>\n<li><code>event</code> String</li>\n<li><code>userInfo</code> Record&#x3C;String, unknown></li>\n<li><code>object</code> Zeichenkette</li>\n</ul></li>\n</ul>\n<p>Returns <code>Number</code> - The ID of this subscription</p>\n<p>Same as <code>subscribeNotification</code>, but uses <code>NSWorkspace.sharedWorkspace.notificationCenter</code>. This is necessary for events such as <code>NSWorkspaceDidActivateApplicationNotification</code>.</p>\n<h3 id=\"systempreferencesunsubscribenotificationid-macos\"><a href=\"#systempreferencesunsubscribenotificationid-macos\"><code>systemPreferences.unsubscribeNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Removes the subscriber with <code>id</code>.</p>\n<h3 id=\"systempreferencesunsubscribelocalnotificationid-macos\"><a href=\"#systempreferencesunsubscribelocalnotificationid-macos\"><code>systemPreferences.unsubscribeLocalNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Same as <code>unsubscribeNotification</code>, but removes the subscriber from <code>NSNotificationCenter</code>.</p>\n<h3 id=\"systempreferencesunsubscribeworkspacenotificationid-macos\"><a href=\"#systempreferencesunsubscribeworkspacenotificationid-macos\"><code>systemPreferences.unsubscribeWorkspaceNotification(id)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Same as <code>unsubscribeNotification</code>, but removes the subscriber from <code>NSWorkspace.sharedWorkspace.notificationCenter</code>.</p>\n<h3 id=\"systempreferencesregisterdefaultsdefaults-macos\"><a href=\"#systempreferencesregisterdefaultsdefaults-macos\"><code>systemPreferences.registerDefaults(defaults)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>defaults</code> Record&#x3C;String, String | Boolean | Number> - a dictionary of (<code>key: value</code>) user defaults</li>\n</ul>\n<p>Add the specified defaults to your application's <code>NSUserDefaults</code>.</p>\n<h3 id=\"systempreferencesgetuserdefaulttype-extends-keyof-userdefaulttypeskey-type-macos\"><a href=\"#systempreferencesgetuserdefaulttype-extends-keyof-userdefaulttypeskey-type-macos\"><code>systemPreferences.getUserDefault&#x3C;Type extends keyof UserDefaultTypes>(key, type)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n<li><code>type</code> Type - Can be <code>string</code>, <code>boolean</code>, <code>integer</code>, <code>float</code>, <code>double</code>, <code>url</code>, <code>array</code> or <code>dictionary</code>.</li>\n</ul>\n<p>Returns <a href=\"/docs/api/structures/user-default-types\"><code>UserDefaultTypes[Type]</code></a> - The value of <code>key</code> in <code>NSUserDefaults</code>.</p>\n<p>Some popular <code>key</code> and <code>type</code>s are:</p>\n<ul>\n<li><code>AppleInterfaceStyle</code>: <code>string</code></li>\n<li><code>AppleAquaColorVariant</code>: <code>integer</code></li>\n<li><code>AppleHighlightColor</code>: <code>string</code></li>\n<li><code>AppleShowScrollBars</code>: <code>string</code></li>\n<li><code>NSNavRecentPlaces</code>: <code>array</code></li>\n<li><code>NSPreferredWebServices</code>: <code>dictionary</code></li>\n<li><code>NSUserDictionaryReplacementItems</code>: <code>array</code></li>\n</ul>\n<h3 id=\"systempreferencessetuserdefaultkey-type-value-macos\"><a href=\"#systempreferencessetuserdefaultkey-type-value-macos\"><code>systemPreferences.setUserDefault(key, type, value)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n<li><code>type</code> String - Can be <code>string</code>, <code>boolean</code>, <code>integer</code>, <code>float</code>, <code>double</code>, <code>url</code>, <code>array</code> or <code>dictionary</code>.</li>\n<li><code>value</code> String</li>\n</ul>\n<p>Set the value of <code>key</code> in <code>NSUserDefaults</code>.</p>\n<p>Note that <code>type</code> should match actual type of <code>value</code>. An exception is thrown if they don't.</p>\n<p>Some popular <code>key</code> and <code>type</code>s are:</p>\n<ul>\n<li><code>ApplePressAndHoldEnabled</code>: <code>boolean</code></li>\n</ul>\n<h3 id=\"systempreferencesremoveuserdefaultkey-macos\"><a href=\"#systempreferencesremoveuserdefaultkey-macos\"><code>systemPreferences.removeUserDefault(key)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Removes the <code>key</code> in <code>NSUserDefaults</code>. This can be used to restore the default or global value of a <code>key</code> previously set with <code>setUserDefault</code>.</p>\n<h3 id=\"systempreferencesisaeroglassenabled-windows\"><a href=\"#systempreferencesisaeroglassenabled-windows\"><code>systemPreferences.isAeroGlassEnabled()</code> <em>Windows</em></a></h3>\n<p>Returns <code>Boolean</code> - <code>true</code> if <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/aa969540.aspx\">DWM composition</a> (Aero Glass) is enabled, and <code>false</code> otherwise.</p>\n<p>An example of using it to determine if you should create a transparent window or not (transparent windows won't work correctly when DWM composition is disabled):</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> browserOptions = { <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">1000</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">800</span> }\n\n<span class=\"hljs-comment\">// Make the window transparent only if the platform supports it.</span>\n<span class=\"hljs-keyword\">if</span> (process.platform !== <span class=\"hljs-string\">'win32'</span> || systemPreferences.isAeroGlassEnabled()) {\n  browserOptions.transparent = <span class=\"hljs-literal\">true</span>\n  browserOptions.frame = <span class=\"hljs-literal\">false</span>\n}\n\n<span class=\"hljs-comment\">// Create the window.</span>\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow(browserOptions)\n\n<span class=\"hljs-comment\">// Navigate.</span>\n<span class=\"hljs-keyword\">if</span> (browserOptions.transparent) {\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/index.html`</span>)\n} <span class=\"hljs-keyword\">else</span> {\n  <span class=\"hljs-comment\">// No transparency, so we load a fallback that uses basic styles.</span>\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/fallback.html`</span>)\n}\n</code></pre>\n<h3 id=\"systempreferencesgetaccentcolor-windows-macos\"><a href=\"#systempreferencesgetaccentcolor-windows-macos\"><code>systemPreferences.getAccentColor()</code> <em>Windows</em> <em>macOS</em></a></h3>\n<p>Returns <code>String</code> - The users current system wide accent color preference in RGBA hexadecimal form.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> color = systemPreferences.getAccentColor() <span class=\"hljs-comment\">// `\"aabbccdd\"`</span>\n<span class=\"hljs-keyword\">const</span> red = color.substr(<span class=\"hljs-number\">0</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"aa\"</span>\n<span class=\"hljs-keyword\">const</span> green = color.substr(<span class=\"hljs-number\">2</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"bb\"</span>\n<span class=\"hljs-keyword\">const</span> blue = color.substr(<span class=\"hljs-number\">4</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"cc\"</span>\n<span class=\"hljs-keyword\">const</span> alpha = color.substr(<span class=\"hljs-number\">6</span>, <span class=\"hljs-number\">2</span>) <span class=\"hljs-comment\">// \"dd\"</span>\n</code></pre>\n<p>This API is only available on macOS 10.14 Mojave or newer.</p>\n<h3 id=\"systempreferencesgetcolorcolor-windows-macos\"><a href=\"#systempreferencesgetcolorcolor-windows-macos\"><code>systemPreferences.getColor(color)</code> <em>Windows</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>color</code> String - One of the following values:<ul>\n<li>On <strong>Windows</strong>:<ul>\n<li><code>3d-dark-shadow</code> - Dark shadow for three-dimensional display elements.</li>\n<li><code>3d-face</code> - Face color for three-dimensional display elements and for dialog box backgrounds.</li>\n<li><code>3d-highlight</code> - Highlight color for three-dimensional display elements.</li>\n<li><code>3d-light</code> - Light color for three-dimensional display elements.</li>\n<li><code>3d-shadow</code> - Shadow color for three-dimensional display elements.</li>\n<li><code>active-border</code> - Active window border.</li>\n<li><code>active-caption</code> - Active window title bar. Specifies the left side color in the color gradient of an active window's title bar if the gradient effect is enabled.</li>\n<li><code>active-caption-gradient</code> - Right side color in the color gradient of an active window's title bar.</li>\n<li><code>app-workspace</code> - Background color of multiple document interface (MDI) applications.</li>\n<li><code>button-text</code> - Text on push buttons.</li>\n<li><code>caption-text</code> - Text in caption, size box, and scroll bar arrow box.</li>\n<li><code>desktop</code> - Desktop background color.</li>\n<li><code>disabled-text</code> - Grayed (disabled) text.</li>\n<li><code>highlight</code> - Item(s) selected in a control.</li>\n<li><code>highlight-text</code> - Text of item(s) selected in a control.</li>\n<li><code>hotlight</code> - Color for a hyperlink or hot-tracked item.</li>\n<li><code>inactive-border</code> - Inactive window border.</li>\n<li><code>inactive-caption</code> - Inactive window caption. Specifies the left side color in the color gradient of an inactive window's title bar if the gradient effect is enabled.</li>\n<li><code>inactive-caption-gradient</code> - Right side color in the color gradient of an inactive window's title bar.</li>\n<li><code>inactive-caption-text</code> - Color of text in an inactive caption.</li>\n<li><code>info-background</code> - Background color for tooltip controls.</li>\n<li><code>info-text</code> - Text color for tooltip controls.</li>\n<li><code>menu</code> - Menu background.</li>\n<li><code>menu-highlight</code> - The color used to highlight menu items when the menu appears as a flat menu.</li>\n<li><code>menubar</code> - The background color for the menu bar when menus appear as flat menus.</li>\n<li><code>menu-text</code> - Text in menus.</li>\n<li><code>scrollbar</code> - Scroll bar gray area.</li>\n<li><code>window</code> - Window background.</li>\n<li><code>window-frame</code> - Window frame.</li>\n<li><code>window-text</code> - Text in windows.</li>\n</ul></li>\n<li>On <strong>macOS</strong><ul>\n<li><code>alternate-selected-control-text</code> - The text on a selected surface in a list or table. <em>deprecated</em></li>\n<li><code>control-background</code> - The background of a large interface element, such as a browser or table.</li>\n<li><code>control</code> - The surface of a control.</li>\n<li><code>control-text</code> -The text of a control that isn’t disabled.</li>\n<li><code>disabled-control-text</code> - The text of a control that’s disabled.</li>\n<li><code>find-highlight</code> - The color of a find indicator.</li>\n<li><code>grid</code> - The gridlines of an interface element such as a table.</li>\n<li><code>header-text</code> - The text of a header cell in a table.</li>\n<li><code>highlight</code> - The virtual light source onscreen.</li>\n<li><code>keyboard-focus-indicator</code> - The ring that appears around the currently focused control when using the keyboard for interface navigation.</li>\n<li><code>label</code> - The text of a label containing primary content.</li>\n<li><code>link</code> - A link to other content.</li>\n<li><code>placeholder-text</code> -  A placeholder string in a control or text view.</li>\n<li><code>quaternary-label</code> - The text of a label of lesser importance than a tertiary label such as watermark text.</li>\n<li><code>scrubber-textured-background</code> - The background of a scrubber in the Touch Bar.</li>\n<li><code>secondary-label</code> - The text of a label of lesser importance than a normal label such as a label used to represent a subheading or additional information.</li>\n<li><code>selected-content-background</code> - The background for selected content in a key window or view.</li>\n<li><code>selected-control</code> - The surface of a selected control.</li>\n<li><code>selected-control-text</code> - The text of a selected control.</li>\n<li><code>selected-menu-item-text</code> - The text of a selected menu.</li>\n<li><code>selected-text-background</code> - The background of selected text.</li>\n<li><code>selected-text</code> - Selected text.</li>\n<li><code>separator</code> - A separator between different sections of content.</li>\n<li><code>shadow</code> - The virtual shadow cast by a raised object onscreen.</li>\n<li><code>tertiary-label</code> - The text of a label of lesser importance than a secondary label such as a label used to represent disabled text.</li>\n<li><code>text-background</code> - Text background.</li>\n<li><code>text</code> -  The text in a document.</li>\n<li><code>under-page-background</code> -  The background behind a document's content.</li>\n<li><code>unemphasized-selected-content-background</code> - The selected content in a non-key window or view.</li>\n<li><code>unemphasized-selected-text-background</code> - A background for selected text in a non-key window or view.</li>\n<li><code>unemphasized-selected-text</code> - Selected text in a non-key window or view.</li>\n<li><code>window-background</code> - The background of a window.</li>\n<li><code>window-frame-text</code> - The text in the window's titlebar area.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Returns <code>String</code> - The system color setting in RGB hexadecimal form (<code>#ABCDEF</code>). See the <a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx\">Windows docs</a> and the <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#dynamic-system-colors\">macOS docs</a> for more details.</p>\n<p>The following colors are only available on macOS 10.14: <code>find-highlight</code>, <code>selected-content-background</code>, <code>separator</code>, <code>unemphasized-selected-content-background</code>, <code>unemphasized-selected-text-background</code>, and <code>unemphasized-selected-text</code>.</p>\n<h3 id=\"systempreferencesgetsystemcolorcolor-macos\"><a href=\"#systempreferencesgetsystemcolorcolor-macos\"><code>systemPreferences.getSystemColor(color)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>color</code> String - One of the following values:<ul>\n<li><code>blue</code></li>\n<li><code>brown</code></li>\n<li><code>gray</code></li>\n<li><code>green</code></li>\n<li><code>orange</code></li>\n<li><code>pink</code></li>\n<li><code>purple</code></li>\n<li><code>red</code></li>\n<li><code>yellow</code></li>\n</ul></li>\n</ul>\n<p>Returns <code>String</code> - The standard system color formatted as <code>#RRGGBBAA</code>.</p>\n<p>Returns one of several standard system colors that automatically adapt to vibrancy and changes in accessibility settings like 'Increase contrast' and 'Reduce transparency'. See <a href=\"https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#system-colors\">Apple Documentation</a> for  more details.</p>\n<h3 id=\"systempreferencesisinvertedcolorscheme-windows-deprecated\"><a href=\"#systempreferencesisinvertedcolorscheme-windows-deprecated\"><code>systemPreferences.isInvertedColorScheme()</code> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Returns <code>Boolean</code> - <code>true</code> if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is active, <code>false</code> otherwise.</p>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly\"><code>nativeTheme.shouldUseInvertedColorScheme</code></a> API.</p>\n<h3 id=\"systempreferencesishighcontrastcolorscheme-macos-windows-deprecated\"><a href=\"#systempreferencesishighcontrastcolorscheme-macos-windows-deprecated\"><code>systemPreferences.isHighContrastColorScheme()</code> <em>macOS</em> <em>Windows</em> <em>Deprecated</em></a></h3>\n<p>Returns <code>Boolean</code> - <code>true</code> if a high contrast theme is active, <code>false</code> otherwise.</p>\n<p><strong>Deprecated:</strong> Should use the new <a href=\"/docs/api/native-theme#nativethemeshouldusehighcontrastcolors-macos-windows-readonly\"><code>nativeTheme.shouldUseHighContrastColors</code></a> API.</p>\n<h3 id=\"systempreferencesgeteffectiveappearance-macos\"><a href=\"#systempreferencesgeteffectiveappearance-macos\"><code>systemPreferences.getEffectiveAppearance()</code> <em>macOS</em></a></h3>\n<p>Returns <code>String</code> - Can be <code>dark</code>, <code>light</code> or <code>unknown</code>.</p>\n<p>Gets the macOS appearance setting that is currently applied to your application, maps to <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc\">NSApplication.effectiveAppearance</a></p>\n<h3 id=\"systempreferencesgetapplevelappearance-macos-deprecated\"><a href=\"#systempreferencesgetapplevelappearance-macos-deprecated\"><code>systemPreferences.getAppLevelAppearance()</code> <em>macOS</em> <em>Deprecated</em></a></h3>\n<p>Returns <code>String</code> | <code>null</code> - Can be <code>dark</code>, <code>light</code> or <code>unknown</code>.</p>\n<p>Gets the macOS appearance setting that you have declared you want for your application, maps to <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc\">NSApplication.appearance</a>. You can use the <code>setAppLevelAppearance</code> API to set this value.</p>\n<h3 id=\"systempreferencessetapplevelappearanceappearance-macos-deprecated\"><a href=\"#systempreferencessetapplevelappearanceappearance-macos-deprecated\"><code>systemPreferences.setAppLevelAppearance(appearance)</code> <em>macOS</em> <em>Deprecated</em></a></h3>\n<ul>\n<li><code>appearance</code> String | null - Can be <code>dark</code> or <code>light</code></li>\n</ul>\n<p>Sets the appearance setting for your application, this should override the system default and override the value of <code>getEffectiveAppearance</code>.</p>\n<h3 id=\"systempreferencescanprompttouchid-macos\"><a href=\"#systempreferencescanprompttouchid-macos\"><code>systemPreferences.canPromptTouchID()</code> <em>macOS</em></a></h3>\n<p>Returns <code>Boolean</code> - whether or not this device has the ability to use Touch ID.</p>\n<p><strong>NOTE:</strong> This API will return <code>false</code> on macOS systems older than Sierra 10.12.2.</p>\n<h3 id=\"systempreferencesprompttouchidreason-macos\"><a href=\"#systempreferencesprompttouchidreason-macos\"><code>systemPreferences.promptTouchID(reason)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>reason</code> String - The reason you are asking for Touch ID authentication</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves if the user has successfully authenticated with Touch ID.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { systemPreferences } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nsystemPreferences.promptTouchID(<span class=\"hljs-string\">'To get consent for a Security-Gated Thing'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">success</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'You have successfully authenticated with Touch ID!'</span>)\n}).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n  <span class=\"hljs-built_in\">console</span>.log(err)\n})\n</code></pre>\n<p>This API itself will not protect your user data; rather, it is a mechanism to allow you to do so. Native apps will need to set <a href=\"https://developer.apple.com/documentation/security/secaccesscontrolcreateflags?language=objc\">Access Control Constants</a> like <a href=\"https://developer.apple.com/documentation/security/secaccesscontrolcreateflags/ksecaccesscontroluserpresence?language=objc\"><code>kSecAccessControlUserPresence</code></a> on their keychain entry so that reading it would auto-prompt for Touch ID biometric consent. This could be done with <a href=\"https://github.com/atom/node-keytar\"><code>node-keytar</code></a>, such that one would store an encryption key with <code>node-keytar</code> and only fetch it if <code>promptTouchID()</code> resolves.</p>\n<p><strong>NOTE:</strong> This API will return a rejected Promise on macOS systems older than Sierra 10.12.2.</p>\n<h3 id=\"systempreferencesistrustedaccessibilityclientprompt-macos\"><a href=\"#systempreferencesistrustedaccessibilityclientprompt-macos\"><code>systemPreferences.isTrustedAccessibilityClient(prompt)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>prompt</code> Boolean - whether or not the user will be informed via prompt if the current process is untrusted.</li>\n</ul>\n<p>Returns <code>Boolean</code> - <code>true</code> if the current process is a trusted accessibility client and <code>false</code> if it is not.</p>\n<h3 id=\"systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><a href=\"#systempreferencesgetmediaaccessstatusmediatype-windows-macos\"><code>systemPreferences.getMediaAccessStatus(mediaType)</code> <em>Windows</em> <em>macOS</em></a></h3>\n<ul>\n<li><code>mediaType</code> String - Can be <code>microphone</code>, <code>camera</code> or <code>screen</code>.</li>\n</ul>\n<p>Returns <code>String</code> - Can be <code>not-determined</code>, <code>granted</code>, <code>denied</code>, <code>restricted</code> or <code>unknown</code>.</p>\n<p>This user consent was not required on macOS 10.13 High Sierra or lower so this method will always return <code>granted</code>. macOS 10.14 Mojave or higher requires consent for <code>microphone</code> and <code>camera</code> access. macOS 10.15 Catalina or higher requires consent for <code>screen</code> access.</p>\n<p>Windows 10 has a global setting controlling <code>microphone</code> and <code>camera</code> access for all win32 applications. It will always return <code>granted</code> for <code>screen</code> and for all media types on older versions of Windows.</p>\n<h3 id=\"systempreferencesaskformediaaccessmediatype-macos\"><a href=\"#systempreferencesaskformediaaccessmediatype-macos\"><code>systemPreferences.askForMediaAccess(mediaType)</code> <em>macOS</em></a></h3>\n<ul>\n<li><code>mediaType</code> String - the type of media being requested; can be <code>microphone</code>, <code>camera</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;Boolean></code> - A promise that resolves with <code>true</code> if consent was granted and <code>false</code> if it was denied. If an invalid <code>mediaType</code> is passed, the promise will be rejected. If an access request was denied and later is changed through the System Preferences pane, a restart of the app will be required for the new permissions to take effect. If access has already been requested and denied, it <em>must</em> be changed through the preference pane; an alert will not pop up and the promise will resolve with the existing access status.</p>\n<p><strong>Important:</strong> In order to properly leverage this API, you <a href=\"https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos?language=objc\">must set</a> the <code>NSMicrophoneUsageDescription</code> and <code>NSCameraUsageDescription</code> strings in your app's <code>Info.plist</code> file. The values for these keys will be used to populate the permission dialogs so that the user will be properly informed as to the purpose of the permission request. See <a href=\"/docs/tutorial/application-distribution#macos\">Electron Application Distribution</a> for more information about how to set these in the context of Electron.</p>\n<p>This user consent was not required until macOS 10.14 Mojave, so this method will always return <code>true</code> if your system is running 10.13 High Sierra or lower.</p>\n<h3 id=\"systempreferencesgetanimationsettings\"><a href=\"#systempreferencesgetanimationsettings\"><code>systemPreferences.getAnimationSettings()</code></a></h3>\n<p>Gibt das <code>Object</code> zurück:</p>\n<ul>\n<li><code>shouldRenderRichAnimation</code> Boolean - Returns true if rich animations should be rendered. Looks at session type (e.g. remote desktop) and accessibility settings to give guidance for heavy animations.</li>\n<li><code>scrollAnimationsEnabledBySystem</code> Boolean - Determines on a per-platform basis whether scroll animations (e.g. produced by home/end key) should be enabled.</li>\n<li><code>prefersReducedMotion</code> Boolean - Determines whether the user desires reduced motion based on platform APIs.</li>\n</ul>\n<p>Returns an object with system animation settings.</p>\n<h2 id=\"eigenschaften\"><a href=\"#eigenschaften\">Eigenschaften</a></h2>\n<h3 id=\"systempreferencesapplevelappearance-macos\"><a href=\"#systempreferencesapplevelappearance-macos\"><code>systemPreferences.appLevelAppearance</code> <em>macOS</em></a></h3>\n<p>A <code>String</code> property that can be <code>dark</code>, <code>light</code> or <code>unknown</code>. It determines the macOS appearance setting for your application. This maps to values in: <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc\">NSApplication.appearance</a>. Setting this will override the system default as well as the value of <code>getEffectiveAppearance</code>.</p>\n<p>Possible values that can be set are <code>dark</code> and <code>light</code>, and possible return values are <code>dark</code>, <code>light</code>, and <code>unknown</code>.</p>\n<p>This property is only available on macOS 10.14 Mojave or newer.</p>\n<h3 id=\"systempreferenceseffectiveappearance-macos-readonly\"><a href=\"#systempreferenceseffectiveappearance-macos-readonly\"><code>systemPreferences.effectiveAppearance</code> <em>macOS</em> <em>Readonly</em></a></h3>\n<p>A <code>String</code> property that can be <code>dark</code>, <code>light</code> or <code>unknown</code>.</p>\n<p>Returns the macOS appearance setting that is currently applied to your application, maps to <a href=\"https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc\">NSApplication.effectiveAppearance</a></p>",
      "title": "systemPreferences",
      "description": "Systemeinstellungen anschauen."
    },
    "/docs/api/structures/task": {
      "locale": "de-DE",
      "slug": "task",
      "href": "/docs/api/structures/task",
      "crowdinFileId": "256513",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/task.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"task-object\"><a href=\"#task-object\">Task Object</a></h1>\n<ul>\n<li><code>program</code> String - Path of the program to execute, usually you should specify <code>process.execPath</code> which opens the current program.</li>\n<li><code>arguments</code> String - The command line arguments when <code>program</code> is executed.</li>\n<li><code>title</code> String - The string to be displayed in a JumpList.</li>\n<li><code>description</code> String - Description of this task.</li>\n<li><code>iconPath</code> String - The absolute path to an icon to be displayed in a JumpList, which can be an arbitrary resource file that contains an icon. You can usually specify <code>process.execPath</code> to show the icon of the program.</li>\n<li><code>iconIndex</code> Number - The icon index in the icon file. If an icon file consists of two or more icons, set this value to identify the icon. If an icon file consists of one icon, this value is 0.</li>\n<li><code>workingDirectory</code> String (optional) - The working directory. Default is empty.</li>\n</ul>",
      "title": "Task Object",
      "description": ""
    },
    "/docs/development/testing": {
      "locale": "de-DE",
      "slug": "testing",
      "href": "/docs/development/testing",
      "crowdinFileId": "256169",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/testing.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"testen\"><a href=\"#testen\">Testen</a></h1>\n<p>We aim to keep the code coverage of Electron high. We ask that all pull request not only pass all existing tests, but ideally also add new tests to cover changed code and new scenarios. Ensuring that we capture as many code paths and use cases of Electron as possible ensures that we all ship apps with fewer bugs.</p>\n<p>This repository comes with linting rules for both JavaScript and C++ – as well as unit and integration tests. To learn more about Electron's coding style, please see the <a href=\"/docs/development/coding-style\">coding-style</a> document.</p>\n<h2 id=\"linting\"><a href=\"#linting\">Linting</a></h2>\n<p>To ensure that your JavaScript is in compliance with the Electron coding style, run <code>npm run lint-js</code>, which will run <code>standard</code> against both Electron itself as well as the unit tests. If you are using an editor with a plugin/addon system, you might want to use one of the many <a href=\"https://standardjs.com/#are-there-text-editor-plugins\">StandardJS addons</a> to be informed of coding style violations before you ever commit them.</p>\n<p>To run <code>standard</code> with parameters, run <code>npm run lint-js --</code> followed by arguments you want passed to <code>standard</code>.</p>\n<p>To ensure that your C++ is in compliance with the Electron coding style, run <code>npm run lint-cpp</code>, which runs a <code>cpplint</code> script. We recommend that you use <code>clang-format</code> and prepared <a href=\"/docs/development/clang-format\">a short tutorial</a>.</p>\n<p>There is not a lot of Python in this repository, but it too is governed by coding style rules. <code>npm run lint-py</code> will check all Python, using <code>pylint</code> to do so.</p>\n<h2 id=\"unit-tests\"><a href=\"#unit-tests\">Unit Tests</a></h2>\n<p>If you are not using <a href=\"https://github.com/electron/build-tools\">build-tools</a>, ensure that that name you have configured for your local build of Electron is one of <code>Testing</code>, <code>Release</code>, <code>Default</code>, <code>Debug</code>, or you have set <code>process.env.ELECTRON_OUT_DIR</code>. Without these set, Electron will fail to perform some pre-testing steps.</p>\n<p>To run all unit tests, run <code>npm run test</code>. The unit tests are an Electron app (surprise!) that can be found in the <code>spec</code> folder. Note that it has its own <code>package.json</code> and that its dependencies are therefore not defined in the top-level <code>package.json</code>.</p>\n<p>To run only specific tests matching a pattern, run <code>npm run test -- -g=PATTERN</code>, replacing the <code>PATTERN</code> with a regex that matches the tests you would like to run. As an example: If you want to run only IPC tests, you would run <code>npm run test -- -g ipc</code>.</p>\n<h3 id=\"testing-on-windows-10-devices\"><a href=\"#testing-on-windows-10-devices\">Testing on Windows 10 devices</a></h3>\n<h4 id=\"zusätzliche-schritte-um-den-unit-test-auszuführen\"><a href=\"#zusätzliche-schritte-um-den-unit-test-auszuführen\">Zusätzliche Schritte um den Unit-Test auszuführen:</a></h4>\n<ol>\n<li>\n<p>Visual Studio 2019 muss installiert sein.</p>\n</li>\n<li>\n<p>Node-Header müssen für Ihre Konfiguration kompiliert werden.</p>\n<pre><code class=\"hljs language-powershell\">ninja -C out\\Testing third_party\\electron_node:headers\n</code></pre>\n</li>\n<li>\n<p>Die electron.lib muss als node.lib kopiert werden.</p>\n<pre><code class=\"hljs language-powershell\">cd out\\Testing\nmkdir gen\\node_headers\\Release\ncopy electron.lib gen\\node_headers\\Release\\node.lib\n</code></pre>\n</li>\n</ol>\n<h4 id=\"fehlende-schriften\"><a href=\"#fehlende-schriften\">Fehlende Schriften</a></h4>\n<p><a href=\"https://docs.microsoft.com/en-us/typography/fonts/windows_10_font_list\">Some Windows 10 devices</a> do not ship with the Meiryo font installed, which may cause a font fallback test to fail. To install Meiryo:</p>\n<ol>\n<li>Drücken Sie die Window-Taste und suchen Sie nach <em>Optionale Funktionen verwalten</em>.</li>\n<li>Klicken Sie auf <em>Funktion hinzufügen</em>.</li>\n<li>Wählen Sie <em>japanische Zusatzschrift</em> aus und klicken Sie auf <em>installieren</em>.</li>\n</ol>\n<h4 id=\"pixelmessungen\"><a href=\"#pixelmessungen\">Pixelmessungen</a></h4>\n<p>Some tests which rely on precise pixel measurements may not work correctly on devices with Hi-DPI screen settings due to floating point precision errors. To run these tests correctly, make sure the device is set to 100% scaling.</p>\n<p>To configure display scaling:</p>\n<ol>\n<li>Drücken Sie die Window-Taste und suchen Sie nach <em>Anzeigeeinstellungen</em>.</li>\n<li>Stellen Sie unter <em>Skalieren und Layout</em> sicher, dass das Gerät auf 100% gesetzt ist.</li>\n</ol>",
      "title": "Testen",
      "description": ""
    },
    "/docs/tutorial/testing-on-headless-ci": {
      "locale": "de-DE",
      "slug": "testing-on-headless-ci",
      "href": "/docs/tutorial/testing-on-headless-ci",
      "crowdinFileId": "256255",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/testing-on-headless-ci.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"testing-on-headless-ci-systems-travis-ci-jenkins\"><a href=\"#testing-on-headless-ci-systems-travis-ci-jenkins\">Testing on Headless CI Systems (Travis CI, Jenkins)</a></h1>\n<p>Being based on Chromium, Electron requires a display driver to function. If Chromium can't find a display driver, Electron will fail to launch - and therefore not executing any of your tests, regardless of how you are running them. Testing Electron-based apps on Travis, Circle, Jenkins or similar Systems requires therefore a little bit of configuration. In essence, we need to use a virtual display driver.</p>\n<h2 id=\"configuring-the-virtual-display-server\"><a href=\"#configuring-the-virtual-display-server\">Configuring the Virtual Display Server</a></h2>\n<p>First, install <a href=\"https://en.wikipedia.org/wiki/Xvfb\">Xvfb</a>. It's a virtual framebuffer, implementing the X11 display server protocol - it performs all graphical operations in memory without showing any screen output, which is exactly what we need.</p>\n<p>Then, create a virtual Xvfb screen and export an environment variable called DISPLAY that points to it. Chromium in Electron will automatically look for <code>$DISPLAY</code>, so no further configuration of your app is required. This step can be automated with Anaïs Betts' <a href=\"https://github.com/anaisbetts/xvfb-maybe\">xvfb-maybe</a>: Prepend your test commands with <code>xvfb-maybe</code> and the little tool will automatically configure Xvfb, if required by the current system. On Windows or macOS, it will do nothing.</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-comment\">## On Windows or macOS, this invokes electron-mocha</span>\n<span class=\"hljs-comment\">## On Linux, if we are in a headless environment, this will be equivalent</span>\n<span class=\"hljs-comment\">## to xvfb-run electron-mocha ./test/*.js</span>\nxvfb-maybe electron-mocha ./<span class=\"hljs-built_in\">test</span>/*.js\n</code></pre>\n<h3 id=\"travis-ci\"><a href=\"#travis-ci\">Travis CI</a></h3>\n<p>On Travis, your <code>.travis.yml</code> should look roughly like this:</p>\n<pre><code class=\"hljs language-yml\"><span class=\"hljs-attr\">addons:</span>\n  <span class=\"hljs-attr\">apt:</span>\n    <span class=\"hljs-attr\">packages:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">xvfb</span>\n\n<span class=\"hljs-attr\">install:</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">export</span> <span class=\"hljs-string\">DISPLAY=':99.0'</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">Xvfb</span> <span class=\"hljs-string\">:99</span> <span class=\"hljs-string\">-screen</span> <span class=\"hljs-number\">0</span> <span class=\"hljs-string\">1024x768x24</span> <span class=\"hljs-string\">></span> <span class=\"hljs-string\">/dev/null</span> <span class=\"hljs-number\">2</span><span class=\"hljs-string\">>&#x26;1</span> <span class=\"hljs-string\">&#x26;</span>\n</code></pre>\n<h3 id=\"jenkins\"><a href=\"#jenkins\">Jenkins</a></h3>\n<p>For Jenkins, a <a href=\"https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin\">Xvfb plugin is available</a>.</p>\n<h3 id=\"circle-ci\"><a href=\"#circle-ci\">Circle CI</a></h3>\n<p>Circle CI is awesome and has Xvfb and <code>$DISPLAY</code> <a href=\"https://circleci.com/docs/environment#browsers\">already set up, so no further configuration is required</a>.</p>\n<h3 id=\"appveyor\"><a href=\"#appveyor\">AppVeyor</a></h3>\n<p>AppVeyor runs on Windows, supporting Selenium, Chromium, Electron and similar tools out of the box - no configuration is required.</p>",
      "title": "Testing on Headless CI Systems (Travis CI, Jenkins)",
      "description": ""
    },
    "/docs/tutorial/testing-widevine-cdm": {
      "locale": "de-DE",
      "slug": "testing-widevine-cdm",
      "href": "/docs/tutorial/testing-widevine-cdm",
      "crowdinFileId": "256257",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/testing-widevine-cdm.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"widevine-cdm-testen\"><a href=\"#widevine-cdm-testen\">Widevine CDM testen</a></h1>\n<p>In Electron you can use the Widevine CDM library shipped with Chrome browser.</p>\n<p>Widevine Content Decryption Modules (CDMs) are how streaming services protect content using HTML5 video to web browsers without relying on an NPAPI plugin like Flash or Silverlight. Widevine support is an alternative solution for streaming services that currently rely on Silverlight for playback of DRM-protected video content. It will allow websites to show DRM-protected video content in Firefox without the use of NPAPI plugins. The Widevine CDM runs in an open-source CDM sandbox providing better user security than NPAPI plugins.</p>\n<h4 id=\"note-on-vmp\"><a href=\"#note-on-vmp\">Note on VMP</a></h4>\n<p>As of <a href=\"https://electronjs.org/releases#1.8.1\"><code>Electron v1.8.0 (Chrome v59)</code></a>, the below steps are may only be some of the necessary steps to enable Widevine; any app on or after that version intending to use the Widevine CDM may need to be signed using a license obtained from <a href=\"https://www.widevine.com/\">Widevine</a> itself.</p>\n<p>Per <a href=\"https://www.widevine.com/\">Widevine</a>:</p>\n<blockquote>\n<p>Chrome 59 (and later) includes support for Verified Media Path (VMP). VMP provides a method to verify the authenticity of a device platform. For browser deployments, this will provide an additional signal to determine if a browser-based implementation is reliable and secure.</p>\n<p>The proxy integration guide has been updated with information about VMP and how to issue licenses.</p>\n<p>Widevine recommends our browser-based integrations (vendors and browser-based applications) add support for VMP.</p>\n</blockquote>\n<p>To enable video playback with this new restriction, <a href=\"https://castlabs.com/open-source/downstream/\">castLabs</a> has created a <a href=\"https://github.com/castlabs/electron-releases\">fork</a> that has implemented the necessary changes to enable Widevine to be played in an Electron application if one has obtained the necessary licenses from widevine.</p>\n<h2 id=\"getting-the-library\"><a href=\"#getting-the-library\">Getting the library</a></h2>\n<p>Open <code>chrome://components/</code> in Chrome browser, find <code>Widevine Content Decryption Module</code> and make sure it is up to date, then you can find the library files from the application directory.</p>\n<h3 id=\"on-windows\"><a href=\"#on-windows\">On Windows</a></h3>\n<p>The library file <code>widevinecdm.dll</code> will be under <code>Program Files(x86)/Google/Chrome/Application/CHROME_VERSION/WidevineCdm/_platform_specific/win_(x86|x64)/</code> directory.</p>\n<h3 id=\"unter-macos\"><a href=\"#unter-macos\">Unter macOS</a></h3>\n<p>The library file <code>libwidevinecdm.dylib</code> will be under <code>/Applications/Google Chrome.app/Contents/Versions/CHROME_VERSION/Google Chrome Framework.framework/Versions/A/Libraries/WidevineCdm/_platform_specific/mac_(x86|x64)/</code> directory.</p>\n<p><strong>Note:</strong> Make sure that chrome version used by Electron is greater than or equal to the <code>min_chrome_version</code> value of Chrome's widevine cdm component. The value can be found in <code>manifest.json</code> under <code>WidevineCdm</code> directory.</p>\n<h2 id=\"using-the-library\"><a href=\"#using-the-library\">Using the library</a></h2>\n<p>After getting the library files, you should pass the path to the file with <code>--widevine-cdm-path</code> command line switch, and the library's version with <code>--widevine-cdm-version</code> switch. The command line switches have to be passed before the <code>ready</code> event of <code>app</code> module gets emitted.</p>\n<p>Example code:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// You have to pass the directory that contains widevine library here, it is</span>\n<span class=\"hljs-comment\">// * `libwidevinecdm.dylib` on macOS,</span>\n<span class=\"hljs-comment\">// * `widevinecdm.dll` on Windows.</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'widevine-cdm-path'</span>, <span class=\"hljs-string\">'/path/to/widevine_library'</span>)\n<span class=\"hljs-comment\">// Die Version des Plugins kann von der Seite `chrome://components` in Chrome erhalten werden.</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'widevine-cdm-version'</span>, <span class=\"hljs-string\">'1.4.8.866'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.show()\n})\n</code></pre>\n<h2 id=\"verifying-widevine-cdm-support\"><a href=\"#verifying-widevine-cdm-support\">Verifying Widevine CDM support</a></h2>\n<p>To verify whether widevine works, you can use following ways:</p>\n<ul>\n<li>Open <a href=\"https://shaka-player-demo.appspot.com/\">https://shaka-player-demo.appspot.com/</a> and load a manifest that uses <code>Widevine</code>.</li>\n<li>Open <a href=\"http://www.dash-player.com/demo/drm-test-area/\">http://www.dash-player.com/demo/drm-test-area/</a>, check whether the page says <code>bitdash uses Widevine in your browser</code>, then play the video.</li>\n</ul>",
      "title": "Widevine CDM testen",
      "description": "Chrome 59 (and later) includes support for Verified Media Path (VMP). VMP provides a method to verify the authenticity of a device platform. For browser deployments, this will provide an additional signal to determine if a browser-based implementation is reliable and secure.\nThe proxy integration guide has been updated with information about VMP and how to issue licenses.\nWidevine recommends our browser-based integrations (vendors and browser-based applications) add support for VMP."
    },
    "/docs/api/structures/thumbar-button": {
      "locale": "de-DE",
      "slug": "thumbar-button",
      "href": "/docs/api/structures/thumbar-button",
      "crowdinFileId": "256515",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/thumbar-button.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"thumbarbutton-object\"><a href=\"#thumbarbutton-object\">ThumbarButton Object</a></h1>\n<ul>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> - The icon showing in thumbnail toolbar.</li>\n<li><code>click</code> Function</li>\n<li><code>tooltip</code> String (optional) - The text of the button's tooltip.</li>\n<li><code>flags</code> String<a href=\"/docs/api/structures/optional\"></a> - Control specific states and behaviors of the button. By default, it is <code>['enabled']</code>.</li>\n</ul>\n<p>The <code>flags</code> is an array that can include following <code>String</code>s:</p>\n<ul>\n<li><code>enabled</code> - The button is active and available to the user.</li>\n<li><code>disabled</code> - The button is disabled. It is present, but has a visual state indicating it will not respond to user action.</li>\n<li><code>dismissonclick</code> - When the button is clicked, the thumbnail window closes immediately.</li>\n<li><code>nobackground</code> - Do not draw a button border, use only the image.</li>\n<li><code>hidden</code> - The button is not shown to the user.</li>\n<li><code>noninteractive</code> - The button is enabled but not interactive; no pressed button state is drawn. This value is intended for instances where the button is used in a notification.</li>\n</ul>",
      "title": "ThumbarButton Object",
      "description": ""
    },
    "/docs/api/touch-bar": {
      "locale": "de-DE",
      "slug": "touch-bar",
      "href": "/docs/api/touch-bar",
      "crowdinFileId": "256395",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"touchbar\"><a href=\"#touchbar\">TouchBar</a></h1>\n<h2 id=\"class-touchbar\"><a href=\"#class-touchbar\">Class: TouchBar</a></h2>\n<blockquote>\n<p>Create TouchBar layouts for native macOS applications</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<h3 id=\"new-touchbaroptions\"><a href=\"#new-touchbaroptions\"><code>new TouchBar(options)</code></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>items</code> (<a href=\"/docs/api/touch-bar-button\">TouchBarButton</a> | <a href=\"/docs/api/touch-bar-color-picker\">TouchBarColorPicker</a> | <a href=\"/docs/api/touch-bar-group\">TouchBarGroup</a> | <a href=\"/docs/api/touch-bar-label\">TouchBarLabel</a> | <a href=\"/docs/api/touch-bar-popover\">TouchBarPopover</a> | <a href=\"/docs/api/touch-bar-scrubber\">TouchBarScrubber</a> | <a href=\"/docs/api/touch-bar-segmented-control\">TouchBarSegmentedControl</a> | <a href=\"/docs/api/touch-bar-slider\">TouchBarSlider</a> | <a href=\"/docs/api/touch-bar-spacer\">TouchBarSpacer</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>escapeItem</code> (<a href=\"/docs/api/touch-bar-button\">TouchBarButton</a> | <a href=\"/docs/api/touch-bar-color-picker\">TouchBarColorPicker</a> | <a href=\"/docs/api/touch-bar-group\">TouchBarGroup</a> | <a href=\"/docs/api/touch-bar-label\">TouchBarLabel</a> | <a href=\"/docs/api/touch-bar-popover\">TouchBarPopover</a> | <a href=\"/docs/api/touch-bar-scrubber\">TouchBarScrubber</a> | <a href=\"/docs/api/touch-bar-segmented-control\">TouchBarSegmentedControl</a> | <a href=\"/docs/api/touch-bar-slider\">TouchBarSlider</a> | <a href=\"/docs/api/touch-bar-spacer\">TouchBarSpacer</a> | null) (optional)</li>\n</ul></li>\n</ul>\n<p>Creates a new touch bar with the specified items. Use <code>BrowserWindow.setTouchBar</code> to add the <code>TouchBar</code> to a window.</p>\n<p><strong>Note:</strong> The TouchBar API is currently experimental and may change or be removed in future Electron releases.</p>\n<p><strong>Tip:</strong> If you don't have a MacBook with Touch Bar, you can use <a href=\"https://github.com/sindresorhus/touch-bar-simulator\">Touch Bar Simulator</a> to test Touch Bar usage in your app.</p>\n<h3 id=\"static-properties\"><a href=\"#static-properties\">Static Properties</a></h3>\n<h4 id=\"touchbarbutton\"><a href=\"#touchbarbutton\"><code>TouchBarButton</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-button\"><code>typeof TouchBarButton</code></a> reference to the <code>TouchBarButton</code> class.</p>\n<h4 id=\"touchbarcolorpicker\"><a href=\"#touchbarcolorpicker\"><code>TouchBarColorPicker</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-color-picker\"><code>typeof TouchBarColorPicker</code></a> reference to the <code>TouchBarColorPicker</code> class.</p>\n<h4 id=\"touchbargroup\"><a href=\"#touchbargroup\"><code>TouchBarGroup</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-group\"><code>typeof TouchBarGroup</code></a> reference to the <code>TouchBarGroup</code> class.</p>\n<h4 id=\"touchbarlabel\"><a href=\"#touchbarlabel\"><code>TouchBarLabel</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-label\"><code>typeof TouchBarLabel</code></a> reference to the <code>TouchBarLabel</code> class.</p>\n<h4 id=\"touchbarpopover\"><a href=\"#touchbarpopover\"><code>TouchBarPopover</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-popover\"><code>typeof TouchBarPopover</code></a> reference to the <code>TouchBarPopover</code> class.</p>\n<h4 id=\"touchbarscrubber\"><a href=\"#touchbarscrubber\"><code>TouchBarScrubber</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-scrubber\"><code>typeof TouchBarScrubber</code></a> reference to the <code>TouchBarScrubber</code> class.</p>\n<h4 id=\"touchbarsegmentedcontrol\"><a href=\"#touchbarsegmentedcontrol\"><code>TouchBarSegmentedControl</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-segmented-control\"><code>typeof TouchBarSegmentedControl</code></a> reference to the <code>TouchBarSegmentedControl</code> class.</p>\n<h4 id=\"touchbarslider\"><a href=\"#touchbarslider\"><code>TouchBarSlider</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-slider\"><code>typeof TouchBarSlider</code></a> reference to the <code>TouchBarSlider</code> class.</p>\n<h4 id=\"touchbarspacer\"><a href=\"#touchbarspacer\"><code>TouchBarSpacer</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-spacer\"><code>typeof TouchBarSpacer</code></a> reference to the <code>TouchBarSpacer</code> class.</p>\n<h4 id=\"touchbarotheritemsproxy\"><a href=\"#touchbarotheritemsproxy\"><code>TouchBarOtherItemsProxy</code></a></h4>\n<p>A <a href=\"/docs/api/touch-bar-other-items-proxy\"><code>typeof TouchBarOtherItemsProxy</code></a> reference to the <code>TouchBarOtherItemsProxy</code> class.</p>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<p>The following properties are available on instances of <code>TouchBar</code>:</p>\n<h4 id=\"touchbarescapeitem\"><a href=\"#touchbarescapeitem\"><code>touchBar.escapeItem</code></a></h4>\n<p>A <code>TouchBarItem</code> that will replace the \"esc\" button on the touch bar when set. Setting to <code>null</code> restores the default \"esc\" button. Changing this value immediately updates the escape item in the touch bar.</p>\n<h2 id=\"beispiele\"><a href=\"#beispiele\">Beispiele</a></h2>\n<p>Below is an example of a simple slot machine touch bar game with a button and some labels.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow, TouchBar } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> { TouchBarLabel, TouchBarButton, TouchBarSpacer } = TouchBar\n\n<span class=\"hljs-keyword\">let</span> spinning = <span class=\"hljs-literal\">false</span>\n\n<span class=\"hljs-comment\">// Reel labels</span>\n<span class=\"hljs-keyword\">const</span> reel1 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n<span class=\"hljs-keyword\">const</span> reel2 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n<span class=\"hljs-keyword\">const</span> reel3 = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n\n<span class=\"hljs-comment\">// Spin result label</span>\n<span class=\"hljs-keyword\">const</span> result = <span class=\"hljs-keyword\">new</span> TouchBarLabel()\n\n<span class=\"hljs-comment\">// Spin button</span>\n<span class=\"hljs-keyword\">const</span> spin = <span class=\"hljs-keyword\">new</span> TouchBarButton({\n  <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'🎰 Spin'</span>,\n  <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#7851A9'</span>,\n  <span class=\"hljs-attr\">click</span>: <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-comment\">// Ignore clicks if already spinning</span>\n    <span class=\"hljs-keyword\">if</span> (spinning) {\n      <span class=\"hljs-keyword\">return</span>\n    }\n\n    spinning = <span class=\"hljs-literal\">true</span>\n    result.label = <span class=\"hljs-string\">''</span>\n\n    <span class=\"hljs-keyword\">let</span> timeout = <span class=\"hljs-number\">10</span>\n    <span class=\"hljs-keyword\">const</span> spinLength = <span class=\"hljs-number\">4</span> * <span class=\"hljs-number\">1000</span> <span class=\"hljs-comment\">// 4 seconds</span>\n    <span class=\"hljs-keyword\">const</span> startTime = <span class=\"hljs-built_in\">Date</span>.now()\n\n    <span class=\"hljs-keyword\">const</span> spinReels = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      updateReels()\n\n      <span class=\"hljs-keyword\">if</span> ((<span class=\"hljs-built_in\">Date</span>.now() - startTime) >= spinLength) {\n        finishSpin()\n      } <span class=\"hljs-keyword\">else</span> {\n        <span class=\"hljs-comment\">// Slow down a bit on each spin</span>\n        timeout *= <span class=\"hljs-number\">1.1</span>\n        setTimeout(spinReels, timeout)\n      }\n    }\n\n    spinReels()\n  }\n})\n\n<span class=\"hljs-keyword\">const</span> getRandomValue = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> values = [<span class=\"hljs-string\">'🍒'</span>, <span class=\"hljs-string\">'💎'</span>, <span class=\"hljs-string\">'7️⃣'</span>, <span class=\"hljs-string\">'🍊'</span>, <span class=\"hljs-string\">'🔔'</span>, <span class=\"hljs-string\">'⭐'</span>, <span class=\"hljs-string\">'🍇'</span>, <span class=\"hljs-string\">'🍀'</span>]\n  <span class=\"hljs-keyword\">return</span> values[<span class=\"hljs-built_in\">Math</span>.floor(<span class=\"hljs-built_in\">Math</span>.random() * values.length)]\n}\n\n<span class=\"hljs-keyword\">const</span> updateReels = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  reel1.label = getRandomValue()\n  reel2.label = getRandomValue()\n  reel3.label = getRandomValue()\n}\n\n<span class=\"hljs-keyword\">const</span> finishSpin = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> uniqueValues = <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Set</span>([reel1.label, reel2.label, reel3.label]).size\n  <span class=\"hljs-keyword\">if</span> (uniqueValues === <span class=\"hljs-number\">1</span>) {\n    <span class=\"hljs-comment\">// All 3 values are the same</span>\n    result.label = <span class=\"hljs-string\">'💰 Jackpot!'</span>\n    result.textColor = <span class=\"hljs-string\">'#FDFF00'</span>\n  } <span class=\"hljs-keyword\">else</span> <span class=\"hljs-keyword\">if</span> (uniqueValues === <span class=\"hljs-number\">2</span>) {\n    <span class=\"hljs-comment\">// 2 values are the same</span>\n    result.label = <span class=\"hljs-string\">'😍 Winner!'</span>\n    result.textColor = <span class=\"hljs-string\">'#FDFF00'</span>\n  } <span class=\"hljs-keyword\">else</span> {\n    <span class=\"hljs-comment\">// No values are the same</span>\n    result.label = <span class=\"hljs-string\">'🙁 Spin Again'</span>\n    result.textColor = <span class=\"hljs-literal\">null</span>\n  }\n  spinning = <span class=\"hljs-literal\">false</span>\n}\n\n<span class=\"hljs-keyword\">const</span> touchBar = <span class=\"hljs-keyword\">new</span> TouchBar({\n  <span class=\"hljs-attr\">items</span>: [\n    spin,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'large'</span> }),\n    reel1,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'small'</span> }),\n    reel2,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'small'</span> }),\n    reel3,\n    <span class=\"hljs-keyword\">new</span> TouchBarSpacer({ <span class=\"hljs-attr\">size</span>: <span class=\"hljs-string\">'large'</span> }),\n    result\n  ]\n})\n\n<span class=\"hljs-keyword\">let</span> <span class=\"hljs-built_in\">window</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-built_in\">window</span> = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span>,\n    <span class=\"hljs-attr\">titleBarStyle</span>: <span class=\"hljs-string\">'hiddenInset'</span>,\n    <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">200</span>,\n    <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'#000'</span>\n  })\n  <span class=\"hljs-built_in\">window</span>.loadURL(<span class=\"hljs-string\">'about:blank'</span>)\n  <span class=\"hljs-built_in\">window</span>.setTouchBar(touchBar)\n})\n</code></pre>\n<h3 id=\"running-the-above-example\"><a href=\"#running-the-above-example\">Running the above example</a></h3>\n<p>To run the example above, you'll need to (assuming you've got a terminal open in the directory you want to run the example):</p>\n<ol>\n<li>Save the above file to your computer as <code>touchbar.js</code></li>\n<li>Install Electron via <code>npm install electron</code></li>\n<li>Run the example inside Electron: <code>./node_modules/.bin/electron touchbar.js</code></li>\n</ol>\n<p>You should then see a new Electron window and the app running in your touch bar (or touch bar emulator).</p>",
      "title": "TouchBar",
      "description": "Create TouchBar layouts for native macOS applications"
    },
    "/docs/api/touch-bar-button": {
      "locale": "de-DE",
      "slug": "touch-bar-button",
      "href": "/docs/api/touch-bar-button",
      "crowdinFileId": "256375",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-button.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarbutton\"><a href=\"#class-touchbarbutton\">Class: TouchBarButton</a></h2>\n<blockquote>\n<p>Create a button in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarbuttonoptions\"><a href=\"#new-touchbarbuttonoptions\"><code>new TouchBarButton(options)</code></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>label</code> String (optional) - Button text.</li>\n<li><code>accessibilityLabel</code> String (optional) - A short description of the button for use by screenreaders like VoiceOver.</li>\n<li><code>backgroundColor</code> String (optional) - Button background color in hex format, i.e <code>#ABCDEF</code>.</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String (optional) - Button icon.</li>\n<li><code>iconPosition</code> String (optional) - Can be <code>left</code>, <code>right</code> or <code>overlay</code>. Standardwert ist <code>overlay</code>.</li>\n<li><code>click</code> Function (optional) - Function to call when the button is clicked.</li>\n<li><code>enabled</code> Boolean (optional) - Whether the button is in an enabled state.  Standard ist <code>true</code>.</li>\n</ul></li>\n</ul>\n<p>When defining <code>accessibilityLabel</code>, ensure you have considered macOS <a href=\"https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc\">best practices</a>.</p>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<p>The following properties are available on instances of <code>TouchBarButton</code>:</p>\n<h4 id=\"touchbarbuttonaccessibilitylabel\"><a href=\"#touchbarbuttonaccessibilitylabel\"><code>touchBarButton.accessibilityLabel</code></a></h4>\n<p>A <code>String</code> representing the description of the button to be read by a screen reader. Will only be read by screen readers if no label is set.</p>\n<h4 id=\"touchbarbuttonlabel\"><a href=\"#touchbarbuttonlabel\"><code>touchBarButton.label</code></a></h4>\n<p>A <code>String</code> representing the button's current text. Changing this value immediately updates the button in the touch bar.</p>\n<h4 id=\"touchbarbuttonbackgroundcolor\"><a href=\"#touchbarbuttonbackgroundcolor\"><code>touchBarButton.backgroundColor</code></a></h4>\n<p>A <code>String</code> hex code representing the button's current background color. Changing this value immediately updates the button in the touch bar.</p>\n<h4 id=\"touchbarbuttonicon\"><a href=\"#touchbarbuttonicon\"><code>touchBarButton.icon</code></a></h4>\n<p>A <code>NativeImage</code> representing the button's current icon. Changing this value immediately updates the button in the touch bar.</p>\n<h4 id=\"touchbarbuttoniconposition\"><a href=\"#touchbarbuttoniconposition\"><code>touchBarButton.iconPosition</code></a></h4>\n<p>A <code>String</code> - Can be <code>left</code>, <code>right</code> or <code>overlay</code>.  Standardwert ist <code>overlay</code>.</p>\n<h4 id=\"touchbarbuttonenabled\"><a href=\"#touchbarbuttonenabled\"><code>touchBarButton.enabled</code></a></h4>\n<p>A <code>Boolean</code> representing whether the button is in an enabled state.</p>",
      "title": "TouchBarButton",
      "description": "Create a button in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-color-picker": {
      "locale": "de-DE",
      "slug": "touch-bar-color-picker",
      "href": "/docs/api/touch-bar-color-picker",
      "crowdinFileId": "256377",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-color-picker.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarcolorpicker\"><a href=\"#class-touchbarcolorpicker\">Class: TouchBarColorPicker</a></h2>\n<blockquote>\n<p>Create a color picker in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarcolorpickeroptions\"><a href=\"#new-touchbarcolorpickeroptions\"><code>new TouchBarColorPicker(options)</code></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>availableColors</code> String<a href=\"/docs/api/optional\"></a> - Array of hex color strings to appear as possible colors to select.</li>\n<li><code>selectedColor</code> String (optional) - The selected hex color in the picker, i.e <code>#ABCDEF</code>.</li>\n<li><code>change</code> Function (optional) - Function to call when a color is selected.<ul>\n<li><code>color</code> String - The color that the user selected from the picker.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<p>The following properties are available on instances of <code>TouchBarColorPicker</code>:</p>\n<h4 id=\"touchbarcolorpickeravailablecolors\"><a href=\"#touchbarcolorpickeravailablecolors\"><code>touchBarColorPicker.availableColors</code></a></h4>\n<p>A <code>String[]</code> array representing the color picker's available colors to select. Changing this value immediately updates the color picker in the touch bar.</p>\n<h4 id=\"touchbarcolorpickerselectedcolor\"><a href=\"#touchbarcolorpickerselectedcolor\"><code>touchBarColorPicker.selectedColor</code></a></h4>\n<p>A <code>String</code> hex code representing the color picker's currently selected color. Changing this value immediately updates the color picker in the touch bar.</p>",
      "title": "TouchBarColorPicker",
      "description": "Create a color picker in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-group": {
      "locale": "de-DE",
      "slug": "touch-bar-group",
      "href": "/docs/api/touch-bar-group",
      "crowdinFileId": "256379",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-group.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbargroup\"><a href=\"#class-touchbargroup\">Class: TouchBarGroup</a></h2>\n<blockquote>\n<p>Create a group in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbargroupoptions\"><a href=\"#new-touchbargroupoptions\"><code>new TouchBarGroup(options)</code></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>items</code> <a href=\"/docs/api/touch-bar\">TouchBar</a> - Items to display as a group.</li>\n</ul></li>\n</ul>",
      "title": "TouchBarGroup",
      "description": "Create a group in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-label": {
      "locale": "de-DE",
      "slug": "touch-bar-label",
      "href": "/docs/api/touch-bar-label",
      "crowdinFileId": "256381",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-label.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarlabel\"><a href=\"#class-touchbarlabel\">Class: TouchBarLabel</a></h2>\n<blockquote>\n<p>Create a label in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarlabeloptions\"><a href=\"#new-touchbarlabeloptions\"><code>new TouchBarLabel(options)</code></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>label</code> String (optional) - Text to display.</li>\n<li><code>accessibilityLabel</code> String (optional) - A short description of the button for use by screenreaders like VoiceOver.</li>\n<li><code>textColor</code> String (optional) - Hex color of text, i.e <code>#ABCDEF</code>.</li>\n</ul></li>\n</ul>\n<p>When defining <code>accessibilityLabel</code>, ensure you have considered macOS <a href=\"https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc\">best practices</a>.</p>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<p>The following properties are available on instances of <code>TouchBarLabel</code>:</p>\n<h4 id=\"touchbarlabellabel\"><a href=\"#touchbarlabellabel\"><code>touchBarLabel.label</code></a></h4>\n<p>A <code>String</code> representing the label's current text. Changing this value immediately updates the label in the touch bar.</p>\n<h4 id=\"touchbarlabelaccessibilitylabel\"><a href=\"#touchbarlabelaccessibilitylabel\"><code>touchBarLabel.accessibilityLabel</code></a></h4>\n<p>A <code>String</code> representing the description of the label to be read by a screen reader.</p>\n<h4 id=\"touchbarlabeltextcolor\"><a href=\"#touchbarlabeltextcolor\"><code>touchBarLabel.textColor</code></a></h4>\n<p>A <code>String</code> hex code representing the label's current text color. Changing this value immediately updates the label in the touch bar.</p>",
      "title": "TouchBarLabel",
      "description": "Create a label in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-other-items-proxy": {
      "locale": "de-DE",
      "slug": "touch-bar-other-items-proxy",
      "href": "/docs/api/touch-bar-other-items-proxy",
      "crowdinFileId": "256383",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-other-items-proxy.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarotheritemsproxy\"><a href=\"#class-touchbarotheritemsproxy\">Class: TouchBarOtherItemsProxy</a></h2>\n<blockquote>\n<p>Instantiates a special \"other items proxy\", which nests TouchBar elements inherited from Chromium at the space indicated by the proxy. By default, this proxy is added to each TouchBar at the end of the input. For more information, see the AppKit docs on <a href=\"https://developer.apple.com/documentation/appkit/nstouchbaritemidentifierotheritemsproxy\">NSTouchBarItemIdentifierOtherItemsProxy</a></p>\n<p>Note: Only one instance of this class can be added per TouchBar.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarotheritemsproxy\"><a href=\"#new-touchbarotheritemsproxy\"><code>new TouchBarOtherItemsProxy()</code></a></h3>",
      "title": "TouchBarOtherItemsProxy",
      "description": "Instantiates a special \"other items proxy\", which nests TouchBar elements inherited from Chromium at the space indicated by the proxy. By default, this proxy is added to each TouchBar at the end of the input. For more information, see the AppKit docs on NSTouchBarItemIdentifierOtherItemsProxy\nNote: Only one instance of this class can be added per TouchBar."
    },
    "/docs/api/touch-bar-popover": {
      "locale": "de-DE",
      "slug": "touch-bar-popover",
      "href": "/docs/api/touch-bar-popover",
      "crowdinFileId": "256385",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-popover.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarpopover\"><a href=\"#class-touchbarpopover\">Class: TouchBarPopover</a></h2>\n<blockquote>\n<p>Create a popover in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarpopoveroptions\"><a href=\"#new-touchbarpopoveroptions\"><code>new TouchBarPopover(options)</code></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>label</code> String (optional) - Popover button text.</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> (optional) - Popover button icon.</li>\n<li><code>items</code> <a href=\"/docs/api/touch-bar\">TouchBar</a> - Items to display in the popover.</li>\n<li><code>showCloseButton</code> Boolean (optional) - <code>true</code> to display a close button on the left of the popover, <code>false</code> to not show it. Standard ist <code>true</code>.</li>\n</ul></li>\n</ul>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<p>The following properties are available on instances of <code>TouchBarPopover</code>:</p>\n<h4 id=\"touchbarpopoverlabel\"><a href=\"#touchbarpopoverlabel\"><code>touchBarPopover.label</code></a></h4>\n<p>A <code>String</code> representing the popover's current button text. Changing this value immediately updates the popover in the touch bar.</p>\n<h4 id=\"touchbarpopovericon\"><a href=\"#touchbarpopovericon\"><code>touchBarPopover.icon</code></a></h4>\n<p>A <code>NativeImage</code> representing the popover's current button icon. Changing this value immediately updates the popover in the touch bar.</p>",
      "title": "TouchBarPopover",
      "description": "Create a popover in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-scrubber": {
      "locale": "de-DE",
      "slug": "touch-bar-scrubber",
      "href": "/docs/api/touch-bar-scrubber",
      "crowdinFileId": "256387",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-scrubber.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarscrubber\"><a href=\"#class-touchbarscrubber\">Class: TouchBarScrubber</a></h2>\n<blockquote>\n<p>Create a scrubber (a scrollable selector)</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarscrubberoptions\"><a href=\"#new-touchbarscrubberoptions\"><code>new TouchBarScrubber(options)</code></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>items</code> <a href=\"/docs/api/structures/scrubber-item\">ScrubberItem[]</a> - An array of items to place in this scrubber.</li>\n<li><code>select</code> Function (optional) - Called when the user taps an item that was not the last tapped item.<ul>\n<li><code>selectedIndex</code> Integer - The index of the item the user selected.</li>\n</ul></li>\n<li><code>highlight</code> Function (optional) - Called when the user taps any item.<ul>\n<li><code>highlightedIndex</code> Integer - The index of the item the user touched.</li>\n</ul></li>\n<li><code>selectedStyle</code> String (optional) - Selected item style. Can be <code>background</code>, <code>outline</code> or <code>none</code>. Standardwert ist <code>none</code>.</li>\n<li><code>overlayStyle</code> String (optional) - Selected overlay item style. Can be <code>background</code>, <code>outline</code> or <code>none</code>. Standardwert ist <code>none</code>.</li>\n<li><code>showArrowButtons</code> Boolean (optional) - Whether to show arrow buttons. Defaults to <code>false</code> and is only shown if <code>items</code> is non-empty.</li>\n<li><code>mode</code> String (optional) - Kann <code>fixed</code> oder <code>free</code> sein. The default is <code>free</code>.</li>\n<li><code>continuous</code> Boolean (optional) - Defaults to <code>true</code>.</li>\n</ul></li>\n</ul>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<p>The following properties are available on instances of <code>TouchBarScrubber</code>:</p>\n<h4 id=\"touchbarscrubberitems\"><a href=\"#touchbarscrubberitems\"><code>touchBarScrubber.items</code></a></h4>\n<p>A <code>ScrubberItem[]</code> array representing the items in this scrubber. Updating this value immediately updates the control in the touch bar. Updating deep properties inside this array <strong>does not update the touch bar</strong>.</p>\n<h4 id=\"touchbarscrubberselectedstyle\"><a href=\"#touchbarscrubberselectedstyle\"><code>touchBarScrubber.selectedStyle</code></a></h4>\n<p>A <code>String</code> representing the style that selected items in the scrubber should have. Updating this value immediately updates the control in the touch bar. Mögliche werte:</p>\n<ul>\n<li><code>background</code> - Maps to <code>[NSScrubberSelectionStyle roundedBackgroundStyle]</code>.</li>\n<li><code>outline</code> - Maps to <code>[NSScrubberSelectionStyle outlineOverlayStyle]</code>.</li>\n<li><code>none</code> - Removes all styles.</li>\n</ul>\n<h4 id=\"touchbarscrubberoverlaystyle\"><a href=\"#touchbarscrubberoverlaystyle\"><code>touchBarScrubber.overlayStyle</code></a></h4>\n<p>A <code>String</code> representing the style that selected items in the scrubber should have. This style is overlayed on top of the scrubber item instead of being placed behind it. Updating this value immediately updates the control in the touch bar. Mögliche werte:</p>\n<ul>\n<li><code>background</code> - Maps to <code>[NSScrubberSelectionStyle roundedBackgroundStyle]</code>.</li>\n<li><code>outline</code> - Maps to <code>[NSScrubberSelectionStyle outlineOverlayStyle]</code>.</li>\n<li><code>none</code> - Removes all styles.</li>\n</ul>\n<h4 id=\"touchbarscrubbershowarrowbuttons\"><a href=\"#touchbarscrubbershowarrowbuttons\"><code>touchBarScrubber.showArrowButtons</code></a></h4>\n<p>A <code>Boolean</code> representing whether to show the left / right selection arrows in this scrubber. Updating this value immediately updates the control in the touch bar.</p>\n<h4 id=\"touchbarscrubbermode\"><a href=\"#touchbarscrubbermode\"><code>touchBarScrubber.mode</code></a></h4>\n<p>A <code>String</code> representing the mode of this scrubber. Updating this value immediately updates the control in the touch bar. Mögliche werte:</p>\n<ul>\n<li><code>fixed</code> - Maps to <code>NSScrubberModeFixed</code>.</li>\n<li><code>free</code> - Maps to <code>NSScrubberModeFree</code>.</li>\n</ul>\n<h4 id=\"touchbarscrubbercontinuous\"><a href=\"#touchbarscrubbercontinuous\"><code>touchBarScrubber.continuous</code></a></h4>\n<p>A <code>Boolean</code> representing whether this scrubber is continuous or not. Updating this value immediately updates the control in the touch bar.</p>",
      "title": "TouchBarScrubber",
      "description": "Create a scrubber (a scrollable selector)"
    },
    "/docs/api/touch-bar-segmented-control": {
      "locale": "de-DE",
      "slug": "touch-bar-segmented-control",
      "href": "/docs/api/touch-bar-segmented-control",
      "crowdinFileId": "256389",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-segmented-control.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarsegmentedcontrol\"><a href=\"#class-touchbarsegmentedcontrol\">Class: TouchBarSegmentedControl</a></h2>\n<blockquote>\n<p>Create a segmented control (a button group) where one button has a selected state</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarsegmentedcontroloptions\"><a href=\"#new-touchbarsegmentedcontroloptions\"><code>new TouchBarSegmentedControl(options)</code></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>segmentStyle</code> String (optional) - Style of the segments:<ul>\n<li><code>automatic</code> - Default. The appearance of the segmented control is automatically determined based on the type of window in which the control is displayed and the position within the window. Maps to <code>NSSegmentStyleAutomatic</code>.</li>\n<li><code>rounded</code> - The control is displayed using the rounded style. Maps to <code>NSSegmentStyleRounded</code>.</li>\n<li><code>textured-rounded</code> - The control is displayed using the textured rounded style. Maps to <code>NSSegmentStyleTexturedRounded</code>.</li>\n<li><code>round-rect</code> - The control is displayed using the round rect style. Maps to <code>NSSegmentStyleRoundRect</code>.</li>\n<li><code>textured-square</code> - The control is displayed using the textured square style. Maps to <code>NSSegmentStyleTexturedSquare</code>.</li>\n<li><code>capsule</code> - The control is displayed using the capsule style. Maps to <code>NSSegmentStyleCapsule</code>.</li>\n<li><code>small-square</code> - The control is displayed using the small square style. Maps to <code>NSSegmentStyleSmallSquare</code>.</li>\n<li><code>separated</code> - The segments in the control are displayed very close to each other but not touching. Maps to <code>NSSegmentStyleSeparated</code>.</li>\n</ul></li>\n<li><code>mode</code> String (optional) - The selection mode of the control:<ul>\n<li><code>single</code> - Default. One item selected at a time, selecting one deselects the previously selected item. Maps to <code>NSSegmentSwitchTrackingSelectOne</code>.</li>\n<li><code>multiple</code> - Multiple items can be selected at a time. Maps to <code>NSSegmentSwitchTrackingSelectAny</code>.</li>\n<li><code>buttons</code> - Make the segments act as buttons, each segment can be pressed and released but never marked as active. Maps to <code>NSSegmentSwitchTrackingMomentary</code>.</li>\n</ul></li>\n<li><code>segments</code> <a href=\"/docs/api/structures/segmented-control-segment\">SegmentedControlSegment[]</a> - An array of segments to place in this control.</li>\n<li><code>selectedIndex</code> Integer (optional) - The index of the currently selected segment, will update automatically with user interaction. When the mode is <code>multiple</code> it will be the last selected item.</li>\n<li><code>change</code> Function (optional) - Called when the user selects a new segment.<ul>\n<li><code>selectedIndex</code> Integer - The index of the segment the user selected.</li>\n<li><code>isSelected</code> Boolean - Whether as a result of user selection the segment is selected or not.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<p>The following properties are available on instances of <code>TouchBarSegmentedControl</code>:</p>\n<h4 id=\"touchbarsegmentedcontrolsegmentstyle\"><a href=\"#touchbarsegmentedcontrolsegmentstyle\"><code>touchBarSegmentedControl.segmentStyle</code></a></h4>\n<p>A <code>String</code> representing the controls current segment style. Updating this value immediately updates the control in the touch bar.</p>\n<h4 id=\"touchbarsegmentedcontrolsegments\"><a href=\"#touchbarsegmentedcontrolsegments\"><code>touchBarSegmentedControl.segments</code></a></h4>\n<p>A <code>SegmentedControlSegment[]</code> array representing the segments in this control. Updating this value immediately updates the control in the touch bar. Updating deep properties inside this array <strong>does not update the touch bar</strong>.</p>\n<h4 id=\"touchbarsegmentedcontrolselectedindex\"><a href=\"#touchbarsegmentedcontrolselectedindex\"><code>touchBarSegmentedControl.selectedIndex</code></a></h4>\n<p>An <code>Integer</code> representing the currently selected segment. Changing this value immediately updates the control in the touch bar. User interaction with the touch bar will update this value automatically.</p>\n<h4 id=\"touchbarsegmentedcontrolmode\"><a href=\"#touchbarsegmentedcontrolmode\"><code>touchBarSegmentedControl.mode</code></a></h4>\n<p>A <code>String</code> representing the current selection mode of the control.  Can be <code>single</code>, <code>multiple</code> or <code>buttons</code>.</p>",
      "title": "TouchBarSegmentedControl",
      "description": "Create a segmented control (a button group) where one button has a selected state"
    },
    "/docs/api/touch-bar-slider": {
      "locale": "de-DE",
      "slug": "touch-bar-slider",
      "href": "/docs/api/touch-bar-slider",
      "crowdinFileId": "256391",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-slider.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarslider\"><a href=\"#class-touchbarslider\">Class: TouchBarSlider</a></h2>\n<blockquote>\n<p>Create a slider in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarslideroptions\"><a href=\"#new-touchbarslideroptions\"><code>new TouchBarSlider(options)</code></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>label</code> String (optional) - Label text.</li>\n<li><code>value</code> Integer (optional) - Selected value.</li>\n<li><code>minValue</code> Integer (optional) - Minimum value.</li>\n<li><code>maxValue</code> Integer (optional) - Maximum value.</li>\n<li><code>change</code> Function (optional) - Function to call when the slider is changed.<ul>\n<li><code>newValue</code> Number - The value that the user selected on the Slider.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<p>The following properties are available on instances of <code>TouchBarSlider</code>:</p>\n<h4 id=\"touchbarsliderlabel\"><a href=\"#touchbarsliderlabel\"><code>touchBarSlider.label</code></a></h4>\n<p>A <code>String</code> representing the slider's current text. Changing this value immediately updates the slider in the touch bar.</p>\n<h4 id=\"touchbarslidervalue\"><a href=\"#touchbarslidervalue\"><code>touchBarSlider.value</code></a></h4>\n<p>A <code>Number</code> representing the slider's current value. Changing this value immediately updates the slider in the touch bar.</p>\n<h4 id=\"touchbarsliderminvalue\"><a href=\"#touchbarsliderminvalue\"><code>touchBarSlider.minValue</code></a></h4>\n<p>A <code>Number</code> representing the slider's current minimum value. Changing this value immediately updates the slider in the touch bar.</p>\n<h4 id=\"touchbarslidermaxvalue\"><a href=\"#touchbarslidermaxvalue\"><code>touchBarSlider.maxValue</code></a></h4>\n<p>A <code>Number</code> representing the slider's current maximum value. Changing this value immediately updates the slider in the touch bar.</p>",
      "title": "TouchBarSlider",
      "description": "Create a slider in the touch bar for native macOS applications"
    },
    "/docs/api/touch-bar-spacer": {
      "locale": "de-DE",
      "slug": "touch-bar-spacer",
      "href": "/docs/api/touch-bar-spacer",
      "crowdinFileId": "256393",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/touch-bar-spacer.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-touchbarspacer\"><a href=\"#class-touchbarspacer\">Class: TouchBarSpacer</a></h2>\n<blockquote>\n<p>Create a spacer between two items in the touch bar for native macOS applications</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"new-touchbarspaceroptions\"><a href=\"#new-touchbarspaceroptions\"><code>new TouchBarSpacer(options)</code></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>size</code> String (optional) - Size of spacer, possible values are:<ul>\n<li><code>small</code> - Small space between items. Maps to <code>NSTouchBarItemIdentifierFixedSpaceSmall</code>. This is the default.</li>\n<li><code>large</code> - Large space between items. Maps to <code>NSTouchBarItemIdentifierFixedSpaceLarge</code>.</li>\n<li><code>flexible</code> - Take up all available space. Maps to <code>NSTouchBarItemIdentifierFlexibleSpace</code>.</li>\n</ul></li>\n</ul></li>\n</ul>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<p>The following properties are available on instances of <code>TouchBarSpacer</code>:</p>\n<h4 id=\"touchbarspacersize\"><a href=\"#touchbarspacersize\"><code>touchBarSpacer.size</code></a></h4>\n<p>A <code>String</code> representing the size of the spacer.  Can be <code>small</code>, <code>large</code> or <code>flexible</code>.</p>",
      "title": "TouchBarSpacer",
      "description": "Create a spacer between two items in the touch bar for native macOS applications"
    },
    "/docs/api/structures/trace-categories-and-options": {
      "locale": "de-DE",
      "slug": "trace-categories-and-options",
      "href": "/docs/api/structures/trace-categories-and-options",
      "crowdinFileId": "256517",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/trace-categories-and-options.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"tracecategoriesandoptions-object\"><a href=\"#tracecategoriesandoptions-object\">TraceCategoriesAndOptions Object</a></h1>\n<ul>\n<li><code>categoryFilter</code> String - A filter to control what category groups should be traced. A filter can have an optional '-' prefix to exclude category groups that contain a matching category. Having both included and excluded category patterns in the same list is not supported. Examples: <code>test_MyTest*</code>, <code>test_MyTest*,test_OtherStuff</code>, <code>-excluded_category1,-excluded_category2</code>.</li>\n<li><code>traceOptions</code> String - Controls what kind of tracing is enabled, it is a comma-delimited sequence of the following strings: <code>record-until-full</code>, <code>record-continuously</code>, <code>trace-to-console</code>, <code>enable-sampling</code>, <code>enable-systrace</code>, e.g. <code>'record-until-full,enable-sampling'</code>. The first 3 options are trace recording modes and hence mutually exclusive. If more than one trace recording modes appear in the <code>traceOptions</code> string, the last one takes precedence. If none of the trace recording modes are specified, recording mode is <code>record-until-full</code>. The trace option will first be reset to the default option (<code>record_mode</code> set to <code>record-until-full</code>, <code>enable_sampling</code> and <code>enable_systrace</code> set to <code>false</code>) before options parsed from <code>traceOptions</code> are applied on it.</li>\n</ul>",
      "title": "TraceCategoriesAndOptions Object",
      "description": ""
    },
    "/docs/api/structures/trace-config": {
      "locale": "de-DE",
      "slug": "trace-config",
      "href": "/docs/api/structures/trace-config",
      "crowdinFileId": "256519",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/trace-config.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"traceconfig-object\"><a href=\"#traceconfig-object\">TraceConfig Object</a></h1>\n<ul>\n<li><code>recording_mode</code> String (optional) - Can be <code>record-until-full</code>, <code>record-continuously</code>, <code>record-as-much-as-possible</code> or <code>trace-to-console</code>. Defaults to <code>record-until-full</code>.</li>\n<li><code>trace_buffer_size_in_kb</code> number (optional) - maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.</li>\n<li><code>trace_buffer_size_in_events</code> number (optional) - maximum size of the trace recording buffer in events.</li>\n<li><code>enable_argument_filter</code> boolean (optional) - if true, filter event data according to a specific list of events that have been manually vetted to not include any PII. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/services/tracing/public/cpp/trace_event_args_whitelist.cc\">the implementation in Chromium</a> for specifics.</li>\n<li><code>included_categories</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of tracing categories to include. Can include glob-like patterns using <code>*</code> at the end of the category name. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">tracing categories</a> for the list of categories.</li>\n<li><code>excluded_categories</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of tracing categories to exclude. Can include glob-like patterns using <code>*</code> at the end of the category name. See <a href=\"https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h\">tracing categories</a> for the list of categories.</li>\n<li><code>included_process_ids</code> number<a href=\"/docs/api/structures/optional\"></a> - a list of process IDs to include in the trace. If not specified, trace all processes.</li>\n<li><code>histogram_names</code> String<a href=\"/docs/api/structures/optional\"></a> - a list of <a href=\"https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md\">histogram</a> names to report with the trace.</li>\n<li><code>memory_dump_config</code> Record&#x3C;String, any> (optional) - if the <code>disabled-by-default-memory-infra</code> category is enabled, this contains optional additional configuration for data collection. See the <a href=\"https://chromium.googlesource.com/chromium/src/+/master/docs/memory-infra/memory_infra_startup_tracing.md#the-advanced-way\">Chromium memory-infra docs</a> for more information.</li>\n</ul>\n<p>An example TraceConfig that roughly matches what Chrome DevTools records:</p>\n<pre><code class=\"hljs language-js\">{\n  <span class=\"hljs-attr\">recording_mode</span>: <span class=\"hljs-string\">'record-until-full'</span>,\n  <span class=\"hljs-attr\">included_categories</span>: [\n    <span class=\"hljs-string\">'devtools.timeline'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline.frame'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-devtools.timeline.stack'</span>,\n    <span class=\"hljs-string\">'v8.execute'</span>,\n    <span class=\"hljs-string\">'blink.console'</span>,\n    <span class=\"hljs-string\">'blink.user_timing'</span>,\n    <span class=\"hljs-string\">'latencyInfo'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-v8.cpu_profiler'</span>,\n    <span class=\"hljs-string\">'disabled-by-default-v8.cpu_profiler.hires'</span>\n  ],\n  <span class=\"hljs-attr\">excluded_categories</span>: [<span class=\"hljs-string\">'*'</span>]\n}\n</code></pre>",
      "title": "TraceConfig Object",
      "description": ""
    },
    "/docs/api/structures/transaction": {
      "locale": "de-DE",
      "slug": "transaction",
      "href": "/docs/api/structures/transaction",
      "crowdinFileId": "256521",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/transaction.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"transaction-object\"><a href=\"#transaction-object\">Transaction Object</a></h1>\n<ul>\n<li><code>transactionIdentifier</code> String - A string that uniquely identifies a successful payment transaction.</li>\n<li><code>transactionDate</code> String - The date the transaction was added to the App Store’s payment queue.</li>\n<li><code>originalTransactionIdentifier</code> String - The identifier of the restored transaction by the App Store.</li>\n<li><code>transactionState</code> String - The transaction state, can be <code>purchasing</code>, <code>purchased</code>, <code>failed</code>, <code>restored</code> or <code>deferred</code>.</li>\n<li><code>errorCode</code> Integer - The error code if an error occurred while processing the transaction.</li>\n<li><code>errorMessage</code> String - The error message if an error occurred while processing the transaction.</li>\n<li><code>payment</code> Object<ul>\n<li><code>productIdentifier</code> String - The identifier of the purchased product.</li>\n<li><code>quantity</code> Integer  - The quantity purchased.</li>\n</ul></li>\n</ul>",
      "title": "Transaction Object",
      "description": ""
    },
    "/docs/api/tray": {
      "locale": "de-DE",
      "slug": "tray",
      "href": "/docs/api/tray",
      "crowdinFileId": "256397",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/tray.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"fach\"><a href=\"#fach\">Fach</a></h1>\n<h2 id=\"klasse-tray\"><a href=\"#klasse-tray\">Klasse: Tray</a></h2>\n<blockquote>\n<p>Fügen Sie Symbole und Kontextmenüs in den Benachrichtigungsbereich des Systems hinzu.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p><code>Tray</code> ist ein <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> tray = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  tray = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/my/icon'</span>)\n  <span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item3'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item4'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n  ])\n  tray.setToolTip(<span class=\"hljs-string\">'This is my application.'</span>)\n  tray.setContextMenu(contextMenu)\n})\n</code></pre>\n<p><strong>Plattform-Einschränkungen:</strong></p>\n<ul>\n<li>Unter Linux wird der App-Indikator verwendet, wenn er unterstützt wird, ansonsten wird <code>GtkStatusIcon</code> verwendet.</li>\n<li>On Linux distributions that only have app indicator support, you have to install <code>libappindicator1</code> to make the tray icon work.</li>\n<li>App-Indikator wird nur angezeigt, wenn es ein Kontextmenü hat.</li>\n<li>Wenn die App-Anzeige auf Linux verwendet wird, wird das <code>click</code> Ereignis ignoriert.</li>\n<li>On Linux in order for changes made to individual <code>MenuItem</code>s to take effect, you have to call <code>setContextMenu</code> again. Ein Beispiel:</li>\n</ul>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, Menu, Tray } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> appIcon = <span class=\"hljs-literal\">null</span>\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  appIcon = <span class=\"hljs-keyword\">new</span> Tray(<span class=\"hljs-string\">'/path/to/my/icon'</span>)\n  <span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n    { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n  ])\n\n  <span class=\"hljs-comment\">// Make a change to the context menu</span>\n  contextMenu.items[<span class=\"hljs-number\">1</span>].checked = <span class=\"hljs-literal\">false</span>\n\n  <span class=\"hljs-comment\">// Call this again for Linux because we modified the context menu</span>\n  appIcon.setContextMenu(contextMenu)\n})\n</code></pre>\n<ul>\n<li>Unter Windows wird empfohlen, <code>ICO</code> Icons zu verwenden, um beste visuelle Effekte zu erhalten.</li>\n</ul>\n<p>If you want to keep exact same behaviors on all platforms, you should not rely on the <code>click</code> event and always attach a context menu to the tray icon.</p>\n<h3 id=\"new-trayimage-guid\"><a href=\"#new-trayimage-guid\"><code>new Tray(image, [guid])</code></a></h3>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n<li><code>guid</code> String (optional) <em>Windows</em> - Assigns a GUID to the tray icon. If the executable is signed and the signature contains an organization in the subject line then the GUID is permanently associated with that signature. OS level settings like the position of the tray icon in the system tray will persist even if the path to the executable changes. If the executable is not code-signed then the GUID is permanently associated with the path to the executable. Changing the path to the executable will break the creation of the tray icon and a new GUID must be used. However, it is highly recommended to use the GUID parameter only in conjunction with code-signed executable. If an App defines multiple tray icons then each icon must use a separate GUID.</li>\n</ul>\n<p>Creates a new tray icon associated with the <code>image</code>.</p>\n<h3 id=\"instanz-ereignisse\"><a href=\"#instanz-ereignisse\">Instanz-Ereignisse</a></h3>\n<p>Das <code>Tray</code> Modul sendet folgende Ereignisse aus:</p>\n<h4 id=\"ereignis-click\"><a href=\"#ereignis-click\">Ereignis: 'click'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rechteck</a> - Die Grenzen des Tray-Symbols.</li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Punkt</a> - Die Position des Events.</li>\n</ul>\n<p>Wird beim Klicken des Tray Icons gesendet.</p>\n<h4 id=\"ereignis-right-click-macos-windows\"><a href=\"#ereignis-right-click-macos-windows\">Ereignis: 'right-click' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rechteck</a> - Die Grenzen des Tray-Symbols.</li>\n</ul>\n<p>Wird durch einen Rechts Klick auf das Tray Icon gesendet.</p>\n<h4 id=\"ereignis-double-click-macos-windows\"><a href=\"#ereignis-double-click-macos-windows\">Ereignis: 'double-click' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>bounds</code> <a href=\"/docs/api/structures/rectangle\">Rechteck</a> - Die Grenzen des Tray-Symbols.</li>\n</ul>\n<p>Emitted when the tray icon is double clicked.</p>\n<h4 id=\"event-balloon-show-windows\"><a href=\"#event-balloon-show-windows\">Event: 'balloon-show' <em>Windows</em></a></h4>\n<p>Emitted when the tray balloon shows.</p>\n<h4 id=\"event-balloon-click-windows\"><a href=\"#event-balloon-click-windows\">Event: 'balloon-click' <em>Windows</em></a></h4>\n<p>Emitted when the tray balloon is clicked.</p>\n<h4 id=\"event-balloon-closed-windows\"><a href=\"#event-balloon-closed-windows\">Event: 'balloon-closed' <em>Windows</em></a></h4>\n<p>Emitted when the tray balloon is closed because of timeout or user manually closes it.</p>\n<h4 id=\"event-drop-macos\"><a href=\"#event-drop-macos\">Event: 'drop' <em>macOS</em></a></h4>\n<p>Emitted when any dragged items are dropped on the tray icon.</p>\n<h4 id=\"event-drop-files-macos\"><a href=\"#event-drop-files-macos\">Event: 'drop-files' <em>macOS</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>files</code> String[] - The paths of the dropped files.</li>\n</ul>\n<p>Emitted when dragged files are dropped in the tray icon.</p>\n<h4 id=\"event-drop-text-macos\"><a href=\"#event-drop-text-macos\">Event: 'drop-text' <em>macOS</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>text</code> String - the dropped text string.</li>\n</ul>\n<p>Emitted when dragged text is dropped in the tray icon.</p>\n<h4 id=\"event-drag-enter-macos\"><a href=\"#event-drag-enter-macos\">Event: 'drag-enter' <em>macOS</em></a></h4>\n<p>Emitted when a drag operation enters the tray icon.</p>\n<h4 id=\"event-drag-leave-macos\"><a href=\"#event-drag-leave-macos\">Event: 'drag-leave' <em>macOS</em></a></h4>\n<p>Emitted when a drag operation exits the tray icon.</p>\n<h4 id=\"event-drag-end-macos\"><a href=\"#event-drag-end-macos\">Event: 'drag-end' <em>macOS</em></a></h4>\n<p>Emitted when a drag operation ends on the tray or ends at another location.</p>\n<h4 id=\"event-mouse-up-macos\"><a href=\"#event-mouse-up-macos\">Event: 'mouse-up' <em>macOS</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Punkt</a> - Die Position des Events.</li>\n</ul>\n<p>Emitted when the mouse is released from clicking the tray icon.</p>\n<p>Note: This will not be emitted if you have set a context menu for your Tray using <code>tray.setContextMenu</code>, as a result of macOS-level constraints.</p>\n<h4 id=\"event-mouse-down-macos\"><a href=\"#event-mouse-down-macos\">Event: 'mouse-down' <em>macOS</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Punkt</a> - Die Position des Events.</li>\n</ul>\n<p>Emitted when the mouse clicks the tray icon.</p>\n<h4 id=\"event-mouse-enter-macos\"><a href=\"#event-mouse-enter-macos\">Event: 'mouse-enter' <em>macOS</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Punkt</a> - Die Position des Events.</li>\n</ul>\n<p>Emitted when the mouse enters the tray icon.</p>\n<h4 id=\"event-mouse-leave-macos\"><a href=\"#event-mouse-leave-macos\">Event: 'mouse-leave' <em>macOS</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Punkt</a> - Die Position des Events.</li>\n</ul>\n<p>Emitted when the mouse exits the tray icon.</p>\n<h4 id=\"event-mouse-move-macos-windows\"><a href=\"#event-mouse-move-macos-windows\">Event: 'mouse-move' <em>macOS</em> <em>Windows</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> <a href=\"/docs/api/structures/keyboard-event\">KeyboardEvent</a></li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Punkt</a> - Die Position des Events.</li>\n</ul>\n<p>Emitted when the mouse moves in the tray icon.</p>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<p>The <code>Tray</code> class has the following methods:</p>\n<h4 id=\"traydestroy\"><a href=\"#traydestroy\"><code>tray.destroy()</code></a></h4>\n<p>Destroys the tray icon immediately.</p>\n<h4 id=\"traysetimageimage\"><a href=\"#traysetimageimage\"><code>tray.setImage(image)</code></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>Sets the <code>image</code> associated with this tray icon.</p>\n<h4 id=\"traysetpressedimageimage-macos\"><a href=\"#traysetpressedimageimage-macos\"><code>tray.setPressedImage(image)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>image</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String)</li>\n</ul>\n<p>Sets the <code>image</code> associated with this tray icon when pressed on macOS.</p>\n<h4 id=\"traysettooltiptooltip\"><a href=\"#traysettooltiptooltip\"><code>tray.setToolTip(toolTip)</code></a></h4>\n<ul>\n<li><code>toolTip</code> String</li>\n</ul>\n<p>Legt den Hover-Text für dieses Tray-Symbol fest.</p>\n<h4 id=\"traysettitletitle-options-macos\"><a href=\"#traysettitletitle-options-macos\"><code>tray.setTitle(title[, options])</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>title</code> String</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>fontType</code> String (optional) - The font family variant to display, can be <code>monospaced</code> or <code>monospacedDigit</code>. <code>monospaced</code> is available in macOS 10.15+ and <code>monospacedDigit</code> is available in macOS 10.11+.  When left blank, the title uses the default system font.</li>\n</ul></li>\n</ul>\n<p>Legt den Titel fest, der neben dem Tray Icon in der Statusleiste angezeigt wird (Unterstütz ANSI-Farben).</p>\n<h4 id=\"traygettitle-macos\"><a href=\"#traygettitle-macos\"><code>tray.getTitle()</code> <em>macOS</em></a></h4>\n<p>Returns <code>String</code> - the title displayed next to the tray icon in the status bar</p>\n<h4 id=\"traysetignoredoubleclickeventsignore-macos\"><a href=\"#traysetignoredoubleclickeventsignore-macos\"><code>tray.setIgnoreDoubleClickEvents(ignore)</code> <em>macOS</em></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n</ul>\n<p>Sets the option to ignore double click events. Ignoring these events allows you to detect every individual click of the tray icon.</p>\n<p>This value is set to false by default.</p>\n<h4 id=\"traygetignoredoubleclickevents-macos\"><a href=\"#traygetignoredoubleclickevents-macos\"><code>tray.getIgnoreDoubleClickEvents()</code> <em>macOS</em></a></h4>\n<p>Returns <code>Boolean</code> - Whether double click events will be ignored.</p>\n<h4 id=\"traydisplayballoonoptions-windows\"><a href=\"#traydisplayballoonoptions-windows\"><code>tray.displayBalloon(options)</code> <em>Windows</em></a></h4>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>icon</code> (<a href=\"/docs/api/native-image\">NativeImage</a> | String) (optional) - Icon to use when <code>iconType</code> is <code>custom</code>.</li>\n<li><code>iconType</code> String (optional) - Can be <code>none</code>, <code>info</code>, <code>warning</code>, <code>error</code> or <code>custom</code>. Standard ist <code>custom</code>.</li>\n<li><code>title</code> String</li>\n<li><code>content</code> String</li>\n<li><code>largeIcon</code> Boolean (optional) - The large version of the icon should be used. Standard ist <code>true</code>. Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_large_icon-0x00000020\"><code>NIIF_LARGE_ICON</code></a>.</li>\n<li><code>noSound</code> Boolean (optional) - Do not play the associated sound. Standard ist <code>false</code>. Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_nosound-0x00000010\"><code>NIIF_NOSOUND</code></a>.</li>\n<li><code>respectQuietTime</code> Boolean (optional) - Do not display the balloon notification if the current user is in \"quiet time\". Standard ist <code>false</code>. Maps to <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_respect_quiet_time-0x00000080\"><code>NIIF_RESPECT_QUIET_TIME</code></a>.</li>\n</ul></li>\n</ul>\n<p>Displays a tray balloon.</p>\n<h4 id=\"trayremoveballoon-windows\"><a href=\"#trayremoveballoon-windows\"><code>tray.removeBalloon()</code> <em>Windows</em></a></h4>\n<p>Removes a tray balloon.</p>\n<h4 id=\"trayfocus-windows\"><a href=\"#trayfocus-windows\"><code>tray.focus()</code> <em>Windows</em></a></h4>\n<p>Returns focus to the taskbar notification area. Notification area icons should use this message when they have completed their UI operation. For example, if the icon displays a shortcut menu, but the user presses ESC to cancel it, use <code>tray.focus()</code> to return focus to the notification area.</p>\n<h4 id=\"traypopupcontextmenumenu-position-macos-windows\"><a href=\"#traypopupcontextmenumenu-position-macos-windows\"><code>tray.popUpContextMenu([menu, position])</code> <em>macOS</em> <em>Windows</em></a></h4>\n<ul>\n<li><code>menu</code> Menü (optional)</li>\n<li><code>position</code> <a href=\"/docs/api/structures/point\">Punkt</a> (optional) - Die Pop-up-Position.</li>\n</ul>\n<p>Pops up the context menu of the tray icon. When <code>menu</code> is passed, the <code>menu</code> will be shown instead of the tray icon's context menu.</p>\n<p>Die <code>position</code> ist nur unter Windows verfügbar und ist standardmäßig (0, 0).</p>\n<h4 id=\"trayclosecontextmenu-macos-windows\"><a href=\"#trayclosecontextmenu-macos-windows\"><code>tray.closeContextMenu()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Closes an open context menu, as set by <code>tray.setContextMenu()</code>.</p>\n<h4 id=\"traysetcontextmenumenu\"><a href=\"#traysetcontextmenumenu\"><code>tray.setContextMenu(menu)</code></a></h4>\n<ul>\n<li><code>menu</code> Menu | null</li>\n</ul>\n<p>Legt das Kontextmenü für dieses Symbol fest.</p>\n<h4 id=\"traygetbounds-macos-windows\"><a href=\"#traygetbounds-macos-windows\"><code>tray.getBounds()</code> <em>macOS</em> <em>Windows</em></a></h4>\n<p>Gibt <a href=\"/docs/api/structures/rectangle\"><code>Rectangle</code></a> zurück</p>\n<p>The <code>bounds</code> of this tray icon as <code>Object</code>.</p>\n<h4 id=\"trayisdestroyed\"><a href=\"#trayisdestroyed\"><code>tray.isDestroyed()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the tray icon is destroyed.</p>",
      "title": "Fach",
      "description": "Fügen Sie Symbole und Kontextmenüs in den Benachrichtigungsbereich des Systems hinzu."
    },
    "/docs/tutorial/tray": {
      "locale": "de-DE",
      "slug": "tray",
      "href": "/docs/tutorial/tray",
      "crowdinFileId": "256259",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/tray.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<hr>\n<p>title: Fach\ndescription: This guide will take you through the process of creating a Tray icon with its own context menu to the system's notification area.\nslug: fach</p>\n<h2 id=\"hide_title-true\"><a href=\"#hide_title-true\">hide_title: true</a></h2>\n<h1 id=\"fach\"><a href=\"#fach\">Fach</a></h1>\n<h2 id=\"übersicht\"><a href=\"#übersicht\">Übersicht</a></h2>\n<!-- ✍ Update this section if you want to provide more details -->\n<p>This guide will take you through the process of creating a <a href=\"https://www.electronjs.org/docs/api/tray\">Tray</a> icon with its own context menu to the system's notification area.</p>\n<p>On MacOS and Ubuntu, the Tray will be located on the top right corner of your screen, adjacent to your battery and wifi icons. On Windows, the Tray will usually be located in the bottom right corner.</p>\n<h2 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h2>\n<h3 id=\"mainjs\"><a href=\"#mainjs\">main.js</a></h3>\n<p>First we must import <code>app</code>, <code>Tray</code>, <code>Menu</code>, <code>nativeImage</code> from <code>electron</code>.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, Tray, Menu, nativeImage } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>Next we will create our Tray. To do this, we will use a <a href=\"https://www.electronjs.org/docs/api/native-image\"><code>NativeImage</code></a> icon, which can be created through any one of these <a href=\"https://www.electronjs.org/docs/api/native-image#methods\">methods</a>. Note that we wrap our Tray creation code within an <a href=\"https://www.electronjs.org/docs/api/app#appwhenready\"><code>app.whenReady</code></a> as we will need to wait for our electron app to finish initializing.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">let</span> tray\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> icon = nativeImage.createFromPath(<span class=\"hljs-string\">'path/to/asset.png'</span>)\n  tray = <span class=\"hljs-keyword\">new</span> Tray(icon)\n\n  <span class=\"hljs-comment\">// note: your contextMenu, Tooltip and Title code will go here!</span>\n})\n</code></pre>\n<p>Great! Now we can start attaching a context menu to our Tray, like so:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> contextMenu = Menu.buildFromTemplate([\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item1'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item2'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item3'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span>, <span class=\"hljs-attr\">checked</span>: <span class=\"hljs-literal\">true</span> },\n  { <span class=\"hljs-attr\">label</span>: <span class=\"hljs-string\">'Item4'</span>, <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'radio'</span> }\n])\n\ntray.setContextMenu(contextMenu)\n</code></pre>\n<p>The code above will create 4 separate radio-type items in the context menu. To read more about constructing native menus, click <a href=\"https://www.electronjs.org/docs/api/menu#menubuildfromtemplatetemplate\">here</a>.</p>\n<p>Finally, let's give our tray a tooltip and a title.</p>\n<pre><code class=\"hljs language-js\">tray.setToolTip(<span class=\"hljs-string\">'This is my application'</span>)\ntray.setTitle(<span class=\"hljs-string\">'This is my title'</span>)\n</code></pre>\n<h2 id=\"fazit\"><a href=\"#fazit\">Fazit</a></h2>\n<p>After you start your electron app, you should see the Tray residing in either the top or bottom right of your screen, depending on your operating system.\n<code>fiddle docs/fiddles/native-ui/tray</code></p>",
      "title": "Fach",
      "description": ""
    },
    "/docs/tutorial/updates": {
      "locale": "de-DE",
      "slug": "updates",
      "href": "/docs/tutorial/updates",
      "crowdinFileId": "256261",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/updates.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"anwendungen-aktualisieren\"><a href=\"#anwendungen-aktualisieren\">Anwendungen aktualisieren</a></h1>\n<p>Electron-Apps können auf verschiedenste Weise aktualisiert werden. Die einfachste und offiziell unterstützte ist, die Vorteile des eingebauten <a href=\"https://github.com/Squirrel\">Squirrel</a>-Frameworks und Electrons <a href=\"/docs/api/auto-updater\">autoUpdater</a>-Moduls zu nutzen.</p>\n<h2 id=\"benutzt-updateelectronjsorg\"><a href=\"#benutzt-updateelectronjsorg\">Benutzt <code>update.electronjs.org</code></a></h2>\n<p>The Electron team maintains <a href=\"https://github.com/electron/update.electronjs.org\">update.electronjs.org</a>, a free and open-source webservice that Electron apps can use to self-update. Der Service ist für Electron-Apps, die die folgenden Kriterien erfüllen ausgelegt:</p>\n<ul>\n<li>App läuft unter Mac OS oder Windows</li>\n<li>App hat ein öffentliches GitHub Repository</li>\n<li>Builds werden in GitHub-Releases veröffentlicht</li>\n<li>Builds sind Code-signiert</li>\n</ul>\n<p>Am einfachsten können Sie diesen Service nutzen, indem Sie <a href=\"https://github.com/electron/update-electron-app\">update-electron-app</a> installieren, ein Node.js-Modul, das für die Verwendung mit update.electronjs.org vorkonfiguriert ist.</p>\n<p>Installiere das Modul:</p>\n<pre><code class=\"hljs language-sh\">npm install update-electron-app\n</code></pre>\n<p>Rufen Sie den Updater über die Hauptprozessdatei Ihrer App auf:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'update-electron-app'</span>)()\n</code></pre>\n<p>By default, this module will check for updates at app startup, then every ten minutes. When an update is found, it will automatically be downloaded in the background. When the download completes, a dialog is displayed allowing the user to restart the app.</p>\n<p>Wenn Sie Ihre Konfiguration anpassen müssen, <a href=\"https://github.com/electron/update-electron-app\">übergeben Sie Optionen an <code>update-electron-app</code></a> oder <a href=\"https://github.com/electron/update.electronjs.org\">nutzen Sie den Update-Dienst direkt</a>.</p>\n<h2 id=\"bereitstellung-eines-update-servers\"><a href=\"#bereitstellung-eines-update-servers\">Bereitstellung eines Update-Servers</a></h2>\n<p>Wenn Sie eine private Electron-Anwendung entwickeln oder wenn Sie sie nicht auf GitHub Releases veröffentlichen, könnte notwendig sein, Ihren eigenen Update-Server bereitzustellen.</p>\n<p>Abhängig von Ihren Ansprüchen können Sie einen der folgenden Server nutzen:</p>\n<ul>\n<li><a href=\"https://github.com/vercel/hazel\">Hazel</a> – Update server for private or open-source apps which can be deployed for free on <a href=\"https://vercel.com\">Vercel</a>. It pulls from <a href=\"https://help.github.com/articles/creating-releases/\">GitHub Releases</a> and leverages the power of GitHub's CDN.</li>\n<li><a href=\"https://github.com/GitbookIO/nuts\">Nuts</a> – Also uses <a href=\"https://help.github.com/articles/creating-releases/\">GitHub Releases</a>, but caches app updates on disk and supports private repositories.</li>\n<li><a href=\"https://github.com/ArekSredzki/electron-release-server\">electron-release-server</a> – Provides a dashboard for handling releases and does not require releases to originate on GitHub.</li>\n<li><a href=\"https://github.com/atlassian/nucleus\">Nucleus</a> – A complete update server for Electron apps maintained by Atlassian. Supports multiple applications and channels; uses a static file store to minify server cost.</li>\n</ul>\n<h2 id=\"implementieren-von-updates-in-deiner-app\"><a href=\"#implementieren-von-updates-in-deiner-app\">Implementieren von Updates in deiner App</a></h2>\n<p>Wenn Sie Ihren Update-Server aufgesetzt haben, fahren Sie mit dem Importieren der erforderlichen Module in Ihrem Code fort. Der folgende Code kann etwas abweichen für die verschiedenen Server, aber er funktioniert wie beschrieben bei der Verwendung von <a href=\"https://github.com/vercel/hazel\">Hazel</a>.</p>\n<p><strong>Wichtig:</strong> Bitte stellen Sie sicher, das der Code nur in Ihrer gepackten App ausgeführt wird und nicht in der Entwicklungsumgebung. Sie können <a href=\"https://github.com/sindresorhus/electron-is-dev\">electron-is-dev</a> nutzen, um Ihre Entwicklungsumgebung zu überprüfen.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, autoUpdater, dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n</code></pre>\n<p>Als nächstes, stellen Sie die URL des Update-Servers bereit und stellen Sie diese dem <a href=\"/docs/api/auto-updater\">autoUpdater</a> zur Verfügung:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> server = <span class=\"hljs-string\">'https://your-deployment-url.com'</span>\n<span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-string\">`<span class=\"hljs-subst\">${server}</span>/update/<span class=\"hljs-subst\">${process.platform}</span>/<span class=\"hljs-subst\">${app.getVersion()}</span>`</span>\n\nautoUpdater.setFeedURL({ url })\n</code></pre>\n<p>As the final step, check for updates. The example below will check every minute:</p>\n<pre><code class=\"hljs language-javascript\">setInterval(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n autoUpdater.checkForUpdates()\n}, <span class=\"hljs-number\">60000</span>)\n</code></pre>\n<p>Once your application is <a href=\"/docs/tutorial/application-distribution\">packaged</a>, it will receive an update for each new <a href=\"https://help.github.com/articles/creating-releases/\">GitHub Release</a> that you publish.</p>\n<h2 id=\"updates-anwenden\"><a href=\"#updates-anwenden\">Updates anwenden</a></h2>\n<p>Nun, da Sie den grundlegenden Update-Mechanismus konfiguriert haben, müssen Sie sicherstellen, dass die Nutzer benachrichtigt werden, wenn es ein Update gibt. Das kann erreicht werden, indem man die API <a href=\"/docs/api/auto-updater#events\">events</a> des autoUpdater nutzt:</p>\n<pre><code class=\"hljs language-javascript\">autoUpdater.on(<span class=\"hljs-string\">'update-downloaded'</span>, (event, releaseNotes, releaseName) => {\n <span class=\"hljs-keyword\">const</span> dialogOpts = {\n   <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'info'</span>,\n   <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Restart'</span>, <span class=\"hljs-string\">'Later'</span>],\n   <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Application Update'</span>,\n   <span class=\"hljs-attr\">message</span>: process.platform === <span class=\"hljs-string\">'win32'</span> ? releaseNotes : releaseName,\n   <span class=\"hljs-attr\">detail</span>: <span class=\"hljs-string\">'A new version has been downloaded. Restart the application to apply the updates.'</span>\n  }\n\n  dialog.showMessageBox(dialogOpts).then(<span class=\"hljs-function\">(<span class=\"hljs-params\">returnValue</span>) =></span> {\n    <span class=\"hljs-keyword\">if</span> (returnValue.response === <span class=\"hljs-number\">0</span>) autoUpdater.quitAndInstall()\n  })\n})\n</code></pre>\n<p>Also make sure that errors are <a href=\"/docs/api/auto-updater#event-error\">being handled</a>. Here's an example for logging them to <code>stderr</code>:</p>\n<pre><code class=\"hljs language-javascript\">autoUpdater.on(<span class=\"hljs-string\">'error'</span>, message => {\n <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'There was a problem updating the application'</span>)\n <span class=\"hljs-built_in\">console</span>.error(message)\n})\n</code></pre>\n<h2 id=\"handling-updates-manually\"><a href=\"#handling-updates-manually\">Handling Updates Manually</a></h2>\n<p>Because the requests made by Auto Update aren't under your direct control, you may find situations that are difficult to handle (such as if the update server is behind authentication). The <code>url</code> field does support files, which means that with some effort, you can sidestep the server-communication aspect of the process. <a href=\"https://github.com/electron/electron/issues/5020#issuecomment-477636990\">Here's an example of how this could work</a>.</p>",
      "title": "Anwendungen aktualisieren",
      "description": ""
    },
    "/docs/api/structures/upload-data": {
      "locale": "de-DE",
      "slug": "upload-data",
      "href": "/docs/api/structures/upload-data",
      "crowdinFileId": "256523",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploaddata-object\"><a href=\"#uploaddata-object\">UploadData Object</a></h1>\n<ul>\n<li><code>bytes</code> Buffer - Content being sent.</li>\n<li><code>file</code> String (optional) - Path of file being uploaded.</li>\n<li><code>blobUUID</code> String (optional) - UUID of blob data. Use <a href=\"/docs/api/session#sesgetblobdataidentifier\">ses.getBlobData</a> method to retrieve the data.</li>\n</ul>",
      "title": "UploadData Object",
      "description": ""
    },
    "/docs/api/structures/upload-file": {
      "locale": "de-DE",
      "slug": "upload-file",
      "href": "/docs/api/structures/upload-file",
      "crowdinFileId": "256525",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-file.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploadfile-object\"><a href=\"#uploadfile-object\">UploadFile Object</a></h1>\n<ul>\n<li><code>type</code> 'file' - <code>file</code>.</li>\n<li><code>filePath</code> String - Path of file to be uploaded.</li>\n<li><code>offset</code> Integer - Defaults to <code>0</code>.</li>\n<li><code>length</code> Integer - Number of bytes to read from <code>offset</code>. Defaults to <code>0</code>.</li>\n<li><code>modificationTime</code> Double - Last Modification time in number of seconds since the UNIX epoch.</li>\n</ul>",
      "title": "UploadFile Object",
      "description": ""
    },
    "/docs/api/structures/upload-raw-data": {
      "locale": "de-DE",
      "slug": "upload-raw-data",
      "href": "/docs/api/structures/upload-raw-data",
      "crowdinFileId": "256527",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/upload-raw-data.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"uploadrawdata-object\"><a href=\"#uploadrawdata-object\">UploadRawData Object</a></h1>\n<ul>\n<li><code>type</code> 'rawData' - <code>rawData</code>.</li>\n<li><code>bytes</code> Buffer - Data to be uploaded.</li>\n</ul>",
      "title": "UploadRawData Object",
      "description": ""
    },
    "/docs/api/structures/user-default-types": {
      "locale": "de-DE",
      "slug": "user-default-types",
      "href": "/docs/api/structures/user-default-types",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/user-default-types.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"userdefaulttypes-object\"><a href=\"#userdefaulttypes-object\">UserDefaultTypes Object</a></h1>\n<ul>\n<li><code>string</code> Zeichenkette</li>\n<li><code>boolean</code> Boolean</li>\n<li><code>integer</code> Number</li>\n<li><code>float</code> Number</li>\n<li><code>double</code> Number</li>\n<li><code>url</code> String</li>\n<li><code>array</code> Array\\<unknown></unknown></li>\n<li><code>dictionary</code> Record\\&#x3C;string, unknown></li>\n</ul>\n<p>This type is a helper alias, no object will never exist of this type.</p>",
      "title": "UserDefaultTypes Object",
      "description": ""
    },
    "/docs/tutorial/using-native-node-modules": {
      "locale": "de-DE",
      "slug": "using-native-node-modules",
      "href": "/docs/tutorial/using-native-node-modules",
      "crowdinFileId": "256263",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-native-node-modules.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"native-node-modules\"><a href=\"#native-node-modules\">Native Node Modules</a></h1>\n<p>Native Node.js modules are supported by Electron, but since Electron has a different <a href=\"https://en.wikipedia.org/wiki/Application_binary_interface\">application binary interface (ABI)</a> from a given Node.js binary (due to differences such as using Chromium's BoringSSL instead of OpenSSL), the native modules you use will need to be recompiled for Electron. Otherwise, you will get the following class of error when you try to run your app:</p>\n<pre><code class=\"hljs language-sh\">Error: The module <span class=\"hljs-string\">'/path/to/native/module.node'</span>\nwas compiled against a different Node.js version using\nNODE_MODULE_VERSION <span class=\"hljs-variable\">$XYZ</span>. This version of Node.js requires\nNODE_MODULE_VERSION <span class=\"hljs-variable\">$ABC</span>. Please try re-compiling or re-installing\nthe module (<span class=\"hljs-keyword\">for</span> instance, using `npm rebuild` or `npm install`).\n</code></pre>\n<h2 id=\"how-to-install-native-modules\"><a href=\"#how-to-install-native-modules\">How to install native modules</a></h2>\n<p>There are several different ways to install native modules:</p>\n<h3 id=\"installing-modules-and-rebuilding-for-electron\"><a href=\"#installing-modules-and-rebuilding-for-electron\">Installing modules and rebuilding for Electron</a></h3>\n<p>You can install modules like other Node projects, and then rebuild the modules for Electron with the <a href=\"https://github.com/electron/electron-rebuild\"><code>electron-rebuild</code></a> package. This module can automatically determine the version of Electron and handle the manual steps of downloading headers and rebuilding native modules for your app. If you are using <a href=\"https://electronforge.io/\">Electron Forge</a>, this tool is used automatically in both development mode and when making distributables.</p>\n<p>For example, to install the standalone <code>electron-rebuild</code> tool and then rebuild modules with it via the command line:</p>\n<pre><code class=\"hljs language-sh\">npm install --save-dev electron-rebuild\n\n<span class=\"hljs-comment\"># Every time you run \"npm install\", run this:</span>\n./node_modules/.bin/electron-rebuild\n\n<span class=\"hljs-comment\"># If you have trouble on Windows, try:</span>\n.\\node_modules\\.bin\\electron-rebuild.cmd\n</code></pre>\n<p>For more information on usage and integration with other tools such as <a href=\"https://github.com/electron/electron-packager\">Electron Packager</a>, consult the project's README.</p>\n<h3 id=\"nutzung-von-npm\"><a href=\"#nutzung-von-npm\">Nutzung von <code>npm</code></a></h3>\n<p>By setting a few environment variables, you can use <code>npm</code> to install modules directly.</p>\n<p>For example, to install all dependencies for Electron:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-comment\"># Electron's version.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_target=1.2.3\n<span class=\"hljs-comment\"># The architecture of Electron, see https://electronjs.org/docs/tutorial/support#supported-platforms</span>\n<span class=\"hljs-comment\"># for supported architectures.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_arch=x64\n<span class=\"hljs-built_in\">export</span> npm_config_target_arch=x64\n<span class=\"hljs-comment\"># Download headers for Electron.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_disturl=https://electronjs.org/headers\n<span class=\"hljs-comment\"># Sage node-pre-gyp das wir fur Electron bauen.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_runtime=electron\n<span class=\"hljs-comment\"># Tell node-pre-gyp to build module from source code.</span>\n<span class=\"hljs-built_in\">export</span> npm_config_build_from_source=<span class=\"hljs-literal\">true</span>\n<span class=\"hljs-comment\"># Install all dependencies, and store cache to ~/.electron-gyp.</span>\nHOME=~/.electron-gyp npm install\n</code></pre>\n<h3 id=\"manually-building-for-electron\"><a href=\"#manually-building-for-electron\">Manually building for Electron</a></h3>\n<p>If you are a developer developing a native module and want to test it against Electron, you might want to rebuild the module for Electron manually. You can use <code>node-gyp</code> directly to build for Electron:</p>\n<pre><code class=\"hljs language-sh\"><span class=\"hljs-built_in\">cd</span> /path-to-module/\nHOME=~/.electron-gyp node-gyp rebuild --target=1.2.3 --arch=x64 --dist-url=https://electronjs.org/headers\n</code></pre>\n<ul>\n<li><code>HOME=~/.electron-gyp</code> changes where to find development headers.</li>\n<li><code>--target=1.2.3</code> is the version of Electron.</li>\n<li><code>--dist-url=...</code> specifies where to download the headers.</li>\n<li><code>--arch=x64</code> says the module is built for a 64-bit system.</li>\n</ul>\n<h3 id=\"manually-building-for-a-custom-build-of-electron\"><a href=\"#manually-building-for-a-custom-build-of-electron\">Manually building for a custom build of Electron</a></h3>\n<p>To compile native Node modules against a custom build of Electron that doesn't match a public release, instruct <code>npm</code> to use the version of Node you have bundled with your custom build.</p>\n<pre><code class=\"hljs language-sh\">npm rebuild --nodedir=/path/to/src/out/Default/gen/node_headers\n</code></pre>\n<h2 id=\"problemlösungen\"><a href=\"#problemlösungen\">Problemlösungen</a></h2>\n<p>If you installed a native module and found it was not working, you need to check the following things:</p>\n<ul>\n<li>When in doubt, run <code>electron-rebuild</code> first.</li>\n<li>Make sure the native module is compatible with the target platform and architecture for your Electron app.</li>\n<li>Make sure <code>win_delay_load_hook</code> is not set to <code>false</code> in the module's <code>binding.gyp</code>.</li>\n<li>After you upgrade Electron, you usually need to rebuild the modules.</li>\n</ul>\n<h3 id=\"a-note-about-win_delay_load_hook\"><a href=\"#a-note-about-win_delay_load_hook\">A note about <code>win_delay_load_hook</code></a></h3>\n<p>On Windows, by default, <code>node-gyp</code> links native modules against <code>node.dll</code>. However, in Electron 4.x and higher, the symbols needed by native modules are exported by <code>electron.exe</code>, and there is no <code>node.dll</code>. In order to load native modules on Windows, <code>node-gyp</code> installs a <a href=\"https://msdn.microsoft.com/en-us/library/z9h1h6ty.aspx\">delay-load hook</a> that triggers when the native module is loaded, and redirects the <code>node.dll</code> reference to use the loading executable instead of looking for <code>node.dll</code> in the library search path (which would turn up nothing). As such, on Electron 4.x and higher, <code>'win_delay_load_hook': 'true'</code> is required to load native modules.</p>\n<p>If you get an error like <code>Module did not self-register</code>, or <code>The specified procedure could not be found</code>, it may mean that the module you're trying to use did not correctly include the delay-load hook.  If the module is built with node-gyp, ensure that the <code>win_delay_load_hook</code> variable is set to <code>true</code> in the <code>binding.gyp</code> file, and isn't getting overridden anywhere.  If the module is built with another system, you'll need to ensure that you build with a delay-load hook installed in the main <code>.node</code> file. Your <code>link.exe</code> invocation should look like this:</p>\n<pre><code class=\"hljs language-plaintext\"> link.exe /OUT:\"foo.node\" \"...\\node.lib\" delayimp.lib /DELAYLOAD:node.exe /DLL\n     \"my_addon.obj\" \"win_delay_load_hook.obj\"\n</code></pre>\n<p>In particular, it's important that:</p>\n<ul>\n<li>you link against <code>node.lib</code> from <em>Electron</em> and not Node. If you link against the wrong <code>node.lib</code> you will get load-time errors when you require the module in Electron.</li>\n<li>you include the flag <code>/DELAYLOAD:node.exe</code>. If the <code>node.exe</code> link is not delayed, then the delay-load hook won't get a chance to fire and the node symbols won't be correctly resolved.</li>\n<li><code>win_delay_load_hook.obj</code> is linked directly into the final DLL. If the hook is set up in a dependent DLL, it won't fire at the right time.</li>\n</ul>\n<p>See <a href=\"https://github.com/nodejs/node-gyp/blob/e2401e1395bef1d3c8acec268b42dc5fb71c4a38/src/win_delay_load_hook.cc\"><code>node-gyp</code></a> for an example delay-load hook if you're implementing your own.</p>\n<h2 id=\"modules-that-rely-on-prebuild\"><a href=\"#modules-that-rely-on-prebuild\">Modules that rely on <code>prebuild</code></a></h2>\n<p><a href=\"https://github.com/prebuild/prebuild\"><code>prebuild</code></a> provides a way to publish native Node modules with prebuilt binaries for multiple versions of Node and Electron.</p>\n<p>If the <code>prebuild</code>-powered module provide binaries for the usage in Electron, make sure to omit <code>--build-from-source</code> and the <code>npm_config_build_from_source</code> environment variable in order to take full advantage of the prebuilt binaries.</p>\n<h2 id=\"modules-that-rely-on-node-pre-gyp\"><a href=\"#modules-that-rely-on-node-pre-gyp\">Modules that rely on <code>node-pre-gyp</code></a></h2>\n<p>The <a href=\"https://github.com/mapbox/node-pre-gyp\"><code>node-pre-gyp</code> tool</a> provides a way to deploy native Node modules with prebuilt binaries, and many popular modules are using it.</p>\n<p>Sometimes those modules work fine under Electron, but when there are no Electron-specific binaries available, you'll need to build from source. Because of this, it is recommended to use <code>electron-rebuild</code> for these modules.</p>\n<p>If you are following the <code>npm</code> way of installing modules, you'll need to pass <code>--build-from-source</code> to <code>npm</code>, or set the <code>npm_config_build_from_source</code> environment variable.</p>",
      "title": "Native Node Modules",
      "description": ""
    },
    "/docs/tutorial/using-pepper-flash-plugin": {
      "locale": "de-DE",
      "slug": "using-pepper-flash-plugin",
      "href": "/docs/tutorial/using-pepper-flash-plugin",
      "crowdinFileId": "256265",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-pepper-flash-plugin.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"pepper-flash-plugin\"><a href=\"#pepper-flash-plugin\">Pepper Flash Plugin</a></h1>\n<p>Electron no longer supports the Pepper Flash plugin, as Chrome has removed support.</p>\n<p>See <a href=\"https://www.chromium.org/flash-roadmap\">Chromium's Flash Roadmap</a> for more details.</p>",
      "title": "Pepper Flash Plugin",
      "description": ""
    },
    "/docs/tutorial/using-selenium-and-webdriver": {
      "locale": "de-DE",
      "slug": "using-selenium-and-webdriver",
      "href": "/docs/tutorial/using-selenium-and-webdriver",
      "crowdinFileId": "256267",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/using-selenium-and-webdriver.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"selenium-and-webdriver\"><a href=\"#selenium-and-webdriver\">Selenium and WebDriver</a></h1>\n<p>Aus <a href=\"https://sites.google.com/a/chromium.org/chromedriver/\">ChromeDriver - WebDriver for Chrome</a>:</p>\n<blockquote>\n<p>WebDriver ist ein Open-Source-Tool zum automatisierten Testen von Webanwendungen in vielen Browsern. Es bietet Funktionen für die Navigation zu Webseiten, Benutzereingaben, JavaScript-Ausführung und mehr. ChromeDriver ist ein eigenständiger Server, der das Wire-Protokoll vom WebDriver für Chromium implementiert. Es wird von Mitgliedern des Chromium- und WebDriver-Teams entwickelt.</p>\n</blockquote>\n<h2 id=\"spectron-einrichten\"><a href=\"#spectron-einrichten\">Spectron einrichten</a></h2>\n<p><a href=\"https://electronjs.org/spectron\">Spectron</a> ist das offiziell unterstützte ChromeDriver Test Framework für Electron. Es basiert auf <a href=\"https://webdriver.io/\">WebdriverIO</a> und hat Helfer, um auf die Electron APIs in Ihren Tests zuzugreifen und ChromeDriver zu bündeln.</p>\n<pre><code class=\"hljs language-sh\">$ npm install --save-dev spectron\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// A simple test to verify a visible window is opened with a title</span>\n<span class=\"hljs-keyword\">const</span> Application = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spectron'</span>).Application\n<span class=\"hljs-keyword\">const</span> assert = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'assert'</span>)\n\n<span class=\"hljs-keyword\">const</span> myApp = <span class=\"hljs-keyword\">new</span> Application({\n  <span class=\"hljs-attr\">path</span>: <span class=\"hljs-string\">'/Applications/MyApp.app/Contents/MacOS/MyApp'</span>\n})\n\n<span class=\"hljs-keyword\">const</span> verifyWindowIsVisibleWithTitle = <span class=\"hljs-keyword\">async</span> (app) => {\n  <span class=\"hljs-keyword\">await</span> app.start()\n  <span class=\"hljs-keyword\">try</span> {\n    <span class=\"hljs-comment\">// Check if the window is visible</span>\n    <span class=\"hljs-keyword\">const</span> isVisible = <span class=\"hljs-keyword\">await</span> app.browserWindow.isVisible()\n    <span class=\"hljs-comment\">// Verify the window is visible</span>\n    assert.strictEqual(isVisible, <span class=\"hljs-literal\">true</span>)\n    <span class=\"hljs-comment\">// Get the window's title</span>\n    <span class=\"hljs-keyword\">const</span> title = <span class=\"hljs-keyword\">await</span> app.client.getTitle()\n    <span class=\"hljs-comment\">// Verify the window's title</span>\n    assert.strictEqual(title, <span class=\"hljs-string\">'My App'</span>)\n  } <span class=\"hljs-keyword\">catch</span> (error) {\n    <span class=\"hljs-comment\">// Log any failures</span>\n    <span class=\"hljs-built_in\">console</span>.error(<span class=\"hljs-string\">'Test failed'</span>, error.message)\n  }\n  <span class=\"hljs-comment\">// Stop the application</span>\n  <span class=\"hljs-keyword\">await</span> app.stop()\n}\n\nverifyWindowIsVisibleWithTitle(myApp)\n</code></pre>\n<h2 id=\"einrichten-mit-webdriverjs\"><a href=\"#einrichten-mit-webdriverjs\">Einrichten mit WebDriverJs</a></h2>\n<p><a href=\"https://www.selenium.dev/selenium/docs/api/javascript/index.html\">WebDriverJs</a> provides a Node package for testing with web driver, we will use it as an example.</p>\n<h3 id=\"1-start-chromedriver\"><a href=\"#1-start-chromedriver\">1. Start ChromeDriver</a></h3>\n<p>Zuerst müssen Sie das <code>chromedriver</code>-Binary herunterladen und ausführen:</p>\n<pre><code class=\"hljs language-sh\">$ npm install electron-chromedriver\n$ ./node_modules/.bin/chromedriver\nStarting ChromeDriver (v2.10.291558) on port 9515\nOnly <span class=\"hljs-built_in\">local</span> connections are allowed.\n</code></pre>\n<p>Merken Sie sich die Portnummer <code>9515</code>, die später verwendet wird.</p>\n<h3 id=\"2-install-webdriverjs\"><a href=\"#2-install-webdriverjs\">2. Install WebDriverJS</a></h3>\n<pre><code class=\"hljs language-sh\">$ npm install selenium-webdriver\n</code></pre>\n<h3 id=\"3-connect-to-chromedriver\"><a href=\"#3-connect-to-chromedriver\">3. Connect to ChromeDriver</a></h3>\n<p>Die Verwendung von <code>selenium-webdriver</code> mit Electron ist die gleiche wie bei Upstream, nur dass Sie manuell angeben müssen, wie Sie den Chromtreiber anschließen und wo Sie die Binärdatei von Electron finden:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webdriver = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'selenium-webdriver'</span>)\n\n<span class=\"hljs-keyword\">const</span> driver = <span class=\"hljs-keyword\">new</span> webdriver.Builder()\n  <span class=\"hljs-comment\">// The \"9515\" is the port opened by chrome driver.</span>\n  .usingServer(<span class=\"hljs-string\">'http://localhost:9515'</span>)\n  .withCapabilities({\n    <span class=\"hljs-string\">'goog:chromeOptions'</span>: {\n      <span class=\"hljs-comment\">// Here is the path to your Electron binary.</span>\n      <span class=\"hljs-attr\">binary</span>: <span class=\"hljs-string\">'/Path-to-Your-App.app/Contents/MacOS/Electron'</span>\n    }\n  })\n  .forBrowser(<span class=\"hljs-string\">'chrome'</span>) <span class=\"hljs-comment\">// note: use .forBrowser('electron') for selenium-webdriver &#x3C;= 3.6.0</span>\n  .build()\n\ndriver.get(<span class=\"hljs-string\">'http://www.google.com'</span>)\ndriver.findElement(webdriver.By.name(<span class=\"hljs-string\">'q'</span>)).sendKeys(<span class=\"hljs-string\">'webdriver'</span>)\ndriver.findElement(webdriver.By.name(<span class=\"hljs-string\">'btnG'</span>)).click()\ndriver.wait(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">return</span> driver.getTitle().then(<span class=\"hljs-function\">(<span class=\"hljs-params\">title</span>) =></span> {\n    <span class=\"hljs-keyword\">return</span> title === <span class=\"hljs-string\">'webdriver - Google Search'</span>\n  })\n}, <span class=\"hljs-number\">1000</span>)\n\ndriver.quit()\n</code></pre>\n<h2 id=\"einrichten-mit-webdriverio\"><a href=\"#einrichten-mit-webdriverio\">Einrichten mit WebdriverIO</a></h2>\n<p><a href=\"https://webdriver.io/\">WebdriverIO</a> provides a Node package for testing with web driver.</p>\n<h3 id=\"1-start-chromedriver-1\"><a href=\"#1-start-chromedriver-1\">1. Start ChromeDriver</a></h3>\n<p>Zuerst müssen Sie das <code>chromedriver</code>-Binary herunterladen und ausführen:</p>\n<pre><code class=\"hljs language-sh\">$ npm install electron-chromedriver\n$ ./node_modules/.bin/chromedriver --url-base=wd/hub --port=9515\nStarting ChromeDriver (v2.10.291558) on port 9515\nOnly <span class=\"hljs-built_in\">local</span> connections are allowed.\n</code></pre>\n<p>Merken Sie sich die Portnummer <code>9515</code>, die später verwendet wird.</p>\n<h3 id=\"2-install-webdriverio\"><a href=\"#2-install-webdriverio\">2. Install WebdriverIO</a></h3>\n<pre><code class=\"hljs language-sh\">$ npm install webdriverio\n</code></pre>\n<h3 id=\"3-connect-to-chrome-driver\"><a href=\"#3-connect-to-chrome-driver\">3. Connect to chrome driver</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webdriverio = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'webdriverio'</span>)\n<span class=\"hljs-keyword\">const</span> options = {\n  <span class=\"hljs-attr\">host</span>: <span class=\"hljs-string\">'localhost'</span>, <span class=\"hljs-comment\">// Use localhost as chrome driver server</span>\n  <span class=\"hljs-attr\">port</span>: <span class=\"hljs-number\">9515</span>, <span class=\"hljs-comment\">// \"9515\" is the port opened by chrome driver.</span>\n  <span class=\"hljs-attr\">desiredCapabilities</span>: {\n    <span class=\"hljs-attr\">browserName</span>: <span class=\"hljs-string\">'chrome'</span>,\n    <span class=\"hljs-string\">'goog:chromeOptions'</span>: {\n      <span class=\"hljs-attr\">binary</span>: <span class=\"hljs-string\">'/Path-to-Your-App/electron'</span>, <span class=\"hljs-comment\">// Path to your Electron binary.</span>\n      <span class=\"hljs-attr\">args</span>: [<span class=\"hljs-comment\">/* cli arguments */</span>] <span class=\"hljs-comment\">// Optional, perhaps 'app=' + /path/to/your/app/</span>\n    }\n  }\n}\n\n<span class=\"hljs-keyword\">const</span> client = webdriverio.remote(options)\n\nclient\n  .init()\n  .url(<span class=\"hljs-string\">'http://google.com'</span>)\n  .setValue(<span class=\"hljs-string\">'#q'</span>, <span class=\"hljs-string\">'webdriverio'</span>)\n  .click(<span class=\"hljs-string\">'#btnG'</span>)\n  .getTitle().then(<span class=\"hljs-function\">(<span class=\"hljs-params\">title</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Title was: '</span> + title)\n  })\n  .end()\n</code></pre>\n<h2 id=\"workflow\"><a href=\"#workflow\">Workflow</a></h2>\n<p>Um Ihre Anwendung ohne Neuaufbau von Electron zu testen, <a href=\"/docs/tutorial/application-distribution\">platzieren</a> Sie Ihre App-Quelle in das Ressourcenverzeichnis von Electron.</p>\n<p>Alternatively, pass an argument to run with your Electron binary that points to your app's folder. This eliminates the need to copy-paste your app into Electron's resource directory.</p>",
      "title": "Selenium and WebDriver",
      "description": "WebDriver ist ein Open-Source-Tool zum automatisierten Testen von Webanwendungen in vielen Browsern. Es bietet Funktionen für die Navigation zu Webseiten, Benutzereingaben, JavaScript-Ausführung und mehr. ChromeDriver ist ein eigenständiger Server, der das Wire-Protokoll vom WebDriver für Chromium implementiert. Es wird von Mitgliedern des Chromium- und WebDriver-Teams entwickelt."
    },
    "/docs/development/v8-development": {
      "locale": "de-DE",
      "slug": "v8-development",
      "href": "/docs/development/v8-development",
      "crowdinFileId": "256171",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/development/v8-development.md",
      "category": "development",
      "categoryFancy": "Development",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": true,
      "html": "<h1 id=\"v8-entwicklung\"><a href=\"#v8-entwicklung\">V8 Entwicklung</a></h1>\n<blockquote>\n<p>A collection of resources for learning and using V8</p>\n</blockquote>\n<ul>\n<li><a href=\"https://v8.dev/docs/trace\">V8 Tracing</a></li>\n<li><a href=\"https://v8.dev/docs/profile\">V8 Profiler</a> - Profiler combinations which are useful for profiling: <code>--prof</code>, <code>--trace-ic</code>, <code>--trace-opt</code>, <code>--trace-deopt</code>, <code>--print-bytecode</code>, <code>--print-opt-code</code></li>\n<li><a href=\"https://docs.google.com/document/d/11T2CRex9hXxoJwbYqVQ32yIPMh0uouUZLdyrtmMoL44/edit?ts=56f27d9d#heading=h.6jz9dj3bnr8t\">V8 Interpreter Design</a></li>\n<li><a href=\"https://v8.dev/docs/turbofan\">Optimizing compiler</a></li>\n<li><a href=\"https://v8.dev/docs/gdb-jit\">V8 GDB Debugging</a></li>\n</ul>\n<p>See also <a href=\"/docs/development/chromium-development\">Chromium Development</a></p>",
      "title": "V8 Entwicklung",
      "description": "A collection of resources for learning and using V8"
    },
    "/docs/api/web-contents": {
      "locale": "de-DE",
      "slug": "web-contents",
      "href": "/docs/api/web-contents",
      "crowdinFileId": "256399",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-contents.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webcontents\"><a href=\"#webcontents\">webContents</a></h1>\n<blockquote>\n<p>Rendert und steuert web pages.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p><code>webContents</code> ist ein <a href=\"https://nodejs.org/api/events.html#events_class_eventemitter\">EventEmitter</a>. Ist zuständig für das rendering und die Steuerung einer web page und ist eine Property des <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> Objekts. Ein Beispiel für die Verwendung des <code>webContents</code> Objekts:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\n<span class=\"hljs-keyword\">const</span> contents = win.webContents\n<span class=\"hljs-built_in\">console</span>.log(contents)\n</code></pre>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Diese diese Methoden des <code>webContents</code> Modul hast du zugriff:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(webContents)\n</code></pre>\n<h3 id=\"webcontentsgetallwebcontents\"><a href=\"#webcontentsgetallwebcontents\"><code>webContents.getAllWebContents()</code></a></h3>\n<p>Gibt <code>WebContents[]</code> zurück - Ein array aller <code>WebContents</code> Instanzen. This will contain web contents for all windows, webviews, opened devtools, and devtools extension background pages.</p>\n<h3 id=\"webcontentsgetfocusedwebcontents\"><a href=\"#webcontentsgetfocusedwebcontents\"><code>webContents.getFocusedWebContents()</code></a></h3>\n<p>Returns <code>WebContents</code> - The web contents that is focused in this application, otherwise returns <code>null</code>.</p>\n<h3 id=\"webcontentsfromidid\"><a href=\"#webcontentsfromidid\"><code>webContents.fromId(id)</code></a></h3>\n<ul>\n<li><code>id</code> Integer</li>\n</ul>\n<p>Returns <code>WebContents</code> | undefined - A WebContents instance with the given ID, or <code>undefined</code> if there is no WebContents associated with the given ID.</p>\n<h3 id=\"webcontentsfromdevtoolstargetidtargetid\"><a href=\"#webcontentsfromdevtoolstargetidtargetid\"><code>webContents.fromDevToolsTargetId(targetId)</code></a></h3>\n<ul>\n<li><code>targetId</code> String - The Chrome DevTools Protocol <a href=\"https://chromedevtools.github.io/devtools-protocol/tot/Target/#type-TargetID\">TargetID</a> associated with the WebContents instance.</li>\n</ul>\n<p>Returns <code>WebContents</code> | undefined - A WebContents instance with the given TargetID, or <code>undefined</code> if there is no WebContents associated with the given TargetID.</p>\n<p>When communicating with the <a href=\"https://chromedevtools.github.io/devtools-protocol/\">Chrome DevTools Protocol</a>, it can be useful to lookup a WebContents instance based on its assigned TargetID.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">lookupTargetId</span> (<span class=\"hljs-params\">browserWindow</span>) </span>{\n  <span class=\"hljs-keyword\">const</span> wc = browserWindow.webContents\n  <span class=\"hljs-keyword\">await</span> wc.debugger.attach(<span class=\"hljs-string\">'1.3'</span>)\n  <span class=\"hljs-keyword\">const</span> { targetInfo } = <span class=\"hljs-keyword\">await</span> wc.debugger.sendCommand(<span class=\"hljs-string\">'Target.getTargetInfo'</span>)\n  <span class=\"hljs-keyword\">const</span> { targetId } = targetInfo\n  <span class=\"hljs-keyword\">const</span> targetWebContents = <span class=\"hljs-keyword\">await</span> webContents.fromDevToolsTargetId(targetId)\n}\n</code></pre>\n<h2 id=\"class-webcontents\"><a href=\"#class-webcontents\">Class: WebContents</a></h2>\n<blockquote>\n<p>Rendert und steuert den Inhalt einer BrowserWindow Instanze.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"instanz-ereignisse\"><a href=\"#instanz-ereignisse\">Instanz-Ereignisse</a></h3>\n<h4 id=\"event-did-finish-load\"><a href=\"#event-did-finish-load\">Event: 'did-finish-load'</a></h4>\n<p>Emittiert wenn die Navigation abgeschlossen ist, daher, wenn der Spinner des Tab fertig ist und das <code>onload</code> Event gesendet wurde.</p>\n<h4 id=\"event-did-fail-load\"><a href=\"#event-did-fail-load\">Event: 'did-fail-load'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>This event is like <code>did-finish-load</code> but emitted when the load failed. The full list of error codes and their meaning is available <a href=\"https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h\">here</a>.</p>\n<h4 id=\"event-did-fail-provisional-load\"><a href=\"#event-did-fail-provisional-load\">Event: 'did-fail-provisional-load'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>This event is like <code>did-fail-load</code> but emitted when the load was cancelled (e.g. <code>window.stop()</code> was invoked).</p>\n<h4 id=\"event-did-frame-finish-load\"><a href=\"#event-did-frame-finish-load\">Event: 'did-frame-finish-load'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when a frame has done navigation.</p>\n<h4 id=\"event-did-start-loading\"><a href=\"#event-did-start-loading\">Event: 'did-start-loading'</a></h4>\n<p>Corresponds to the points in time when the spinner of the tab started spinning.</p>\n<h4 id=\"event-did-stop-loading\"><a href=\"#event-did-stop-loading\">Event: 'did-stop-loading'</a></h4>\n<p>Corresponds to the points in time when the spinner of the tab stopped spinning.</p>\n<h4 id=\"event-dom-ready\"><a href=\"#event-dom-ready\">Event: 'dom-ready'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when the document in the top-level frame is loaded.</p>\n<h4 id=\"event-page-title-updated\"><a href=\"#event-page-title-updated\">Event: 'page-title-updated'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>Fired when page title is set during navigation. <code>explicitSet</code> is false when title is synthesized from file url.</p>\n<h4 id=\"event-page-favicon-updated\"><a href=\"#event-page-favicon-updated\">Event: 'page-favicon-updated'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>favicons</code> String[] - Array mit URLs.</li>\n</ul>\n<p>Emitted when page receives favicon urls.</p>\n<h4 id=\"event-new-window-deprecated\"><a href=\"#event-new-window-deprecated\">Event: 'new-window' <em>Deprecated</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> NewWindowWebContentsEvent</li>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> and <code>other</code>.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - The options which will be used for creating the new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</li>\n<li><code>additionalFeatures</code> String[] - The non-standard features (features not handled by Chromium or Electron) given to <code>window.open()</code>. Deprecated, and will now always be the empty array <code>[]</code>.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer that will be passed to the new window. May or may not result in the <code>Referer</code> header being sent, depending on the referrer policy.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that will be sent to the new window, along with the appropriate headers that will be set. If no post data is to be sent, the value will be <code>null</code>. Only defined when the window is being created by a form that set <code>target=_blank</code>.</li>\n</ul>\n<p>Deprecated in favor of <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>.</p>\n<p>Emitted when the page requests to open a new window for a <code>url</code>. It could be requested by <code>window.open</code> or an external link like <code>&#x3C;a target='_blank'></code>.</p>\n<p>By default a new <code>BrowserWindow</code> will be created for the <code>url</code>.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent Electron from automatically creating a new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>. If you call <code>event.preventDefault()</code> and manually create a new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> then you must set <code>event.newGuest</code> to reference the new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> instance, failing to do so may result in unexpected behavior. Ein Beispiel:</p>\n<pre><code class=\"hljs language-javascript\">myBrowserWindow.webContents.on(<span class=\"hljs-string\">'new-window'</span>, (event, url, frameName, disposition, options, additionalFeatures, referrer, postBody) => {\n  event.preventDefault()\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n    <span class=\"hljs-attr\">webContents</span>: options.webContents, <span class=\"hljs-comment\">// use existing webContents if provided</span>\n    <span class=\"hljs-attr\">show</span>: <span class=\"hljs-literal\">false</span>\n  })\n  win.once(<span class=\"hljs-string\">'ready-to-show'</span>, () => win.show())\n  <span class=\"hljs-keyword\">if</span> (!options.webContents) {\n    <span class=\"hljs-keyword\">const</span> loadOptions = {\n      <span class=\"hljs-attr\">httpReferrer</span>: referrer\n    }\n    <span class=\"hljs-keyword\">if</span> (postBody != <span class=\"hljs-literal\">null</span>) {\n      <span class=\"hljs-keyword\">const</span> { data, contentType, boundary } = postBody\n      loadOptions.postData = postBody.data\n      loadOptions.extraHeaders = <span class=\"hljs-string\">`content-type: <span class=\"hljs-subst\">${contentType}</span>; boundary=<span class=\"hljs-subst\">${boundary}</span>`</span>\n    }\n\n    win.loadURL(url, loadOptions) <span class=\"hljs-comment\">// existing webContents will be navigated automatically</span>\n  }\n  event.newGuest = win\n})\n</code></pre>\n<h4 id=\"event-did-create-window\"><a href=\"#event-did-create-window\">Event: 'did-create-window'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>window</code> BrowserWindow</li>\n<li><code>details</code> Objekt<ul>\n<li><code>url</code> String - URL for the created window.</li>\n<li><code>frameName</code> String - Name given to the created window in the <code>window.open()</code> call.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - The options used to create the BrowserWindow. They are merged in increasing precedence: parsed options from the <code>features</code> string from <code>window.open()</code>, security-related webPreferences inherited from the parent, and options given by <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>. Unrecognized options are not filtered out.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer that will be passed to the new window. May or may not result in the <code>Referer</code> header being sent, depending on the referrer policy.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that will be sent to the new window, along with the appropriate headers that will be set. If no post data is to be sent, the value will be <code>null</code>. Only defined when the window is being created by a form that set <code>target=_blank</code>.</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> and <code>other</code>.</li>\n</ul></li>\n</ul>\n<p>Emitted <em>after</em> successful creation of a window via <code>window.open</code> in the renderer. Not emitted if the creation of the window is canceled from <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>.</p>\n<p>See <a href=\"/docs/api/window-open\"><code>window.open()</code></a> for more details and how to use this in conjunction with <code>webContents.setWindowOpenHandler</code>.</p>\n<h4 id=\"event-will-navigate\"><a href=\"#event-will-navigate\">Event: 'will-navigate'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when a user or the page wants to start navigation. It can happen when the <code>window.location</code> object is changed or a user clicks a link in the page.</p>\n<p>This event will not emit when the navigation is started programmatically with APIs like <code>webContents.loadURL</code> and <code>webContents.back</code>.</p>\n<p>It is also not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent the navigation.</p>\n<h4 id=\"event-did-start-navigation\"><a href=\"#event-did-start-navigation\">Event: 'did-start-navigation'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame (including main) starts navigating. <code>isInPlace</code> will be <code>true</code> for in-page navigations.</p>\n<h4 id=\"event-will-redirect\"><a href=\"#event-will-redirect\">Event: 'will-redirect'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted as a server side redirect occurs during navigation.  For example a 302 redirect.</p>\n<p>This event will be emitted after <code>did-start-navigation</code> and always before the <code>did-redirect-navigation</code> event for the same navigation.</p>\n<p>Calling <code>event.preventDefault()</code> will prevent the navigation (not just the redirect).</p>\n<h4 id=\"event-did-redirect-navigation\"><a href=\"#event-did-redirect-navigation\">Event: 'did-redirect-navigation'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted after a server side redirect occurs during navigation.  For example a 302 redirect.</p>\n<p>This event cannot be prevented, if you want to prevent redirects you should checkout out the <code>will-redirect</code> event above.</p>\n<h4 id=\"event-did-navigate\"><a href=\"#event-did-navigate\">Event: 'did-navigate'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - empty for non HTTP navigations</li>\n</ul>\n<p>Emitted when a main frame navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h4 id=\"event-did-frame-navigate\"><a href=\"#event-did-frame-navigate\">Event: 'did-frame-navigate'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - empty for non HTTP navigations,</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h4 id=\"event-did-navigate-in-page\"><a href=\"#event-did-navigate-in-page\">Event: 'did-navigate-in-page'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when an in-page navigation happened in any frame.</p>\n<p>When in-page navigation happens, the page URL changes but does not cause navigation outside of the page. Examples of this occurring are when anchor links are clicked or when the DOM <code>hashchange</code> event is triggered.</p>\n<h4 id=\"event-will-prevent-unload\"><a href=\"#event-will-prevent-unload\">Event: 'will-prevent-unload'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when a <code>beforeunload</code> event handler is attempting to cancel a page unload.</p>\n<p>Calling <code>event.preventDefault()</code> will ignore the <code>beforeunload</code> event handler and allow the page to be unloaded.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, dialog } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.webContents.on(<span class=\"hljs-string\">'will-prevent-unload'</span>, (event) => {\n  <span class=\"hljs-keyword\">const</span> choice = dialog.showMessageBoxSync(win, {\n    <span class=\"hljs-attr\">type</span>: <span class=\"hljs-string\">'question'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'Leave'</span>, <span class=\"hljs-string\">'Stay'</span>],\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Do you want to leave this site?'</span>,\n    <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'Changes you made may not be saved.'</span>,\n    <span class=\"hljs-attr\">defaultId</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">cancelId</span>: <span class=\"hljs-number\">1</span>\n  })\n  <span class=\"hljs-keyword\">const</span> leave = (choice === <span class=\"hljs-number\">0</span>)\n  <span class=\"hljs-keyword\">if</span> (leave) {\n    event.preventDefault()\n  }\n})\n</code></pre>\n<p><strong>Note:</strong> This will be emitted for <code>BrowserViews</code> but will <em>not</em> be respected - this is because we have chosen not to tie the <code>BrowserView</code> lifecycle to its owning BrowserWindow should one exist per the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event\">specification</a>.</p>\n<h4 id=\"event-crashed-deprecated\"><a href=\"#event-crashed-deprecated\">Event: 'crashed' <em>Deprecated</em></a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>killed</code> Boolean</li>\n</ul>\n<p>Emitted when the renderer process crashes or is killed.</p>\n<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. Ist es nicht immer, wenn es abgestürzt ist.  Der Boolesche Wert <code>killed</code> kann ersetzt werden durch Überprüfung von <code>reason === 'killed'</code>, wenn Sie zu diesem Ereignis wechseln.</p>\n<h4 id=\"event-render-process-gone\"><a href=\"#event-render-process-gone\">Event: 'render-process-gone'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Objekt<ul>\n<li><code>reason</code> String - The reason the render process is gone.  Mögliche werte:<ul>\n<li><code>clean-exit</code> - Process exited with an exit code of zero</li>\n<li><code>abnormal-exit</code> - Process exited with a non-zero exit code</li>\n<li><code>killed</code> - Process was sent a SIGTERM or otherwise killed externally</li>\n<li><code>crashed</code> - Process crashed</li>\n<li><code>oom</code> - Process ran out of memory</li>\n<li><code>launch-failed</code> - Process never successfully launched</li>\n<li><code>integrity-failure</code> - Windows code integrity checks failed</li>\n</ul></li>\n<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>\n</ul></li>\n</ul>\n<p>Emitted when the renderer process unexpectedly disappears.  This is normally because it was crashed or killed.</p>\n<h4 id=\"event-unresponsive\"><a href=\"#event-unresponsive\">Event: 'unresponsive'</a></h4>\n<p>Ausgegeben wenn die Webseite nicht mehr antwortet.</p>\n<h4 id=\"event-responsive\"><a href=\"#event-responsive\">Event: 'responsive'</a></h4>\n<p>Ausgegeben wenn eine Webseite, die zuvor nicht mehr antwortete, wieder antwortet.</p>\n<h4 id=\"event-plugin-crashed\"><a href=\"#event-plugin-crashed\">Event: 'plugin-crashed'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>name</code> Zeichenfolge</li>\n<li><code>version</code> String</li>\n</ul>\n<p>Emitted when a plugin process has crashed.</p>\n<h4 id=\"event-destroyed\"><a href=\"#event-destroyed\">Event: 'destroyed'</a></h4>\n<p>Emitted when <code>webContents</code> is destroyed.</p>\n<h4 id=\"event-before-input-event\"><a href=\"#event-before-input-event\">Event: 'before-input-event'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>input</code> Object - Input properties.<ul>\n<li><code>type</code> String - Entweder <code>keyUp</code> oder <code>keyDown</code>.</li>\n<li><code>key</code> String - Equivalent zu <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.key</a>.</li>\n<li><code>code</code> String - Equivalent zu <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.code</a>.</li>\n<li><code>isAutoRepeat</code> Boolean - Equivalent zu <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.repeat</a>.</li>\n<li><code>isComposing</code> Boolean - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.isComposing</a>.</li>\n<li><code>shift</code> Boolean - Equivalent zu <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.shiftKey</a>.</li>\n<li><code>control</code> Boolean - Equivalent zu <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.controlKey</a>.</li>\n<li><code>alt</code> Boolean - Equivalent zu <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.altKey</a>.</li>\n<li><code>meta</code> Boolean - Equivalent zu <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.metaKey</a>.</li>\n<li><code>location</code> Number - Equivalent to <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\">KeyboardEvent.location</a>.</li>\n<li><code>modifiers</code> String[] - See <a href=\"/docs/api/structures/input-event\">InputEvent.modifiers</a>.</li>\n</ul></li>\n</ul>\n<p>Emitted before dispatching the <code>keydown</code> and <code>keyup</code> events in the page. Calling <code>event.preventDefault</code> will prevent the page <code>keydown</code>/<code>keyup</code> events and the menu shortcuts.</p>\n<p>To only prevent the menu shortcuts, use <a href=\"#contentssetignoremenushortcutsignore\"><code>setIgnoreMenuShortcuts</code></a>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n\nwin.webContents.on(<span class=\"hljs-string\">'before-input-event'</span>, (event, input) => {\n  <span class=\"hljs-comment\">// For example, only enable application menu keyboard shortcuts when</span>\n  <span class=\"hljs-comment\">// Ctrl/Cmd are down.</span>\n  win.webContents.setIgnoreMenuShortcuts(!input.control &#x26;&#x26; !input.meta)\n})\n</code></pre>\n<h4 id=\"event-enter-html-full-screen\"><a href=\"#event-enter-html-full-screen\">Event: 'enter-html-full-screen'</a></h4>\n<p>Emitted when the window enters a full-screen state triggered by HTML API.</p>\n<h4 id=\"event-leave-html-full-screen\"><a href=\"#event-leave-html-full-screen\">Event: 'leave-html-full-screen'</a></h4>\n<p>Emitted when the window leaves a full-screen state triggered by HTML API.</p>\n<h4 id=\"event-zoom-changed\"><a href=\"#event-zoom-changed\">Event: 'zoom-changed'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>zoomDirection</code> String - Can be <code>in</code> or <code>out</code>.</li>\n</ul>\n<p>Emitted when the user is requesting to change the zoom level using the mouse wheel.</p>\n<h4 id=\"event-devtools-opened\"><a href=\"#event-devtools-opened\">Event: 'devtools-opened'</a></h4>\n<p>Emittiert wenn die DevTools geöffnet wurden.</p>\n<h4 id=\"event-devtools-closed\"><a href=\"#event-devtools-closed\">Event: 'devtools-closed'</a></h4>\n<p>Emittiert wenn die DevTools geschlossen wurden.</p>\n<h4 id=\"event-devtools-focused\"><a href=\"#event-devtools-focused\">Event: 'devtools-focused'</a></h4>\n<p>Emitted when DevTools is focused / opened.</p>\n<h4 id=\"event-certificate-error\"><a href=\"#event-certificate-error\">Event: 'certificate-error'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n<li><code>error</code> String - Der error code.</li>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>isTrusted</code> Boolean - Indicates whether the certificate can be considered trusted.</li>\n</ul></li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Emitted when failed to verify the <code>certificate</code> for <code>url</code>.</p>\n<p>The usage is the same with <a href=\"/docs/api/app#event-certificate-error\">the <code>certificate-error</code> event of <code>app</code></a>.</p>\n<h4 id=\"event-select-client-certificate\"><a href=\"#event-select-client-certificate\">Event: 'select-client-certificate'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> URL</li>\n<li><code>certificateList</code> <a href=\"/docs/api/structures/certificate\">Certificate[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>certificate</code> <a href=\"/docs/api/structures/certificate\">Certificate</a> - Must be a certificate from the given list.</li>\n</ul></li>\n</ul>\n<p>Emittiert wenn ein Client Zertifikat angefordert wird.</p>\n<p>The usage is the same with <a href=\"/docs/api/app#event-select-client-certificate\">the <code>select-client-certificate</code> event of <code>app</code></a>.</p>\n<h4 id=\"event-login\"><a href=\"#event-login\">Event: 'login'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>authenticationResponseDetails</code> Objekt<ul>\n<li><code>url</code> URL</li>\n</ul></li>\n<li><code>authInfo</code> Objekt<ul>\n<li><code>isProxy</code> Boolean</li>\n<li><code>scheme</code> String</li>\n<li><code>host</code> String</li>\n<li><code>port</code> Integer</li>\n<li><code>realm</code> String</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>username</code> String (optional)</li>\n<li><code>password</code> String (optional)</li>\n</ul></li>\n</ul>\n<p>Wird ausgelöst wenn <code>webContents</code> grundlegende Authentifizierung durchführen will.</p>\n<p>The usage is the same with <a href=\"/docs/api/app#event-login\">the <code>login</code> event of <code>app</code></a>.</p>\n<h4 id=\"event-found-in-page\"><a href=\"#event-found-in-page\">Event: 'found-in-page'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>result</code> Object<ul>\n<li><code>requestId</code> Integer</li>\n<li><code>activeMatchOrdinal</code> Integer - Position of the active match.</li>\n<li><code>matches</code> Integer - Number of Matches.</li>\n<li><code>selectionArea</code> Rectangle - Coordinates of first match region.</li>\n<li><code>finalUpdate</code> Boolean</li>\n</ul></li>\n</ul>\n<p>Emitted when a result is available for [<code>webContents.findInPage</code>] request.</p>\n<h4 id=\"event-media-started-playing\"><a href=\"#event-media-started-playing\">Event: 'media-started-playing'</a></h4>\n<p>Emittiert wenn ein Media Element anfängt zu spielen.</p>\n<h4 id=\"event-media-paused\"><a href=\"#event-media-paused\">Event: 'media-paused'</a></h4>\n<p>Emitted when media is paused or done playing.</p>\n<h4 id=\"event-did-change-theme-color\"><a href=\"#event-did-change-theme-color\">Event: 'did-change-theme-color'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>color</code> (String | null) - Theme color is in format of '#rrggbb'. It is <code>null</code> when no theme color is set.</li>\n</ul>\n<p>Emitted when a page's theme color changes. This is usually due to encountering a meta tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">'theme-color'</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">'#ff0000'</span>></span>\n</code></pre>\n<h4 id=\"event-update-target-url\"><a href=\"#event-update-target-url\">Event: 'update-target-url'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when mouse moves over a link or the keyboard moves the focus to a link.</p>\n<h4 id=\"event-cursor-changed\"><a href=\"#event-cursor-changed\">Event: 'cursor-changed'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>type</code> String</li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> (optional)</li>\n<li><code>scale</code> Float (optional) - scaling factor for the custom cursor.</li>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) - Die Größe des<code>Bildes</code>.</li>\n<li><code>hotspot</code> <a href=\"/docs/api/structures/point\">Point</a> (optional) - coordinates of the custom cursor's hotspot.</li>\n</ul>\n<p>Emittiert wenn der Cursor Typ sich ändert. Der <code>type</code> Parameter kann folgenden Werte haben <code>default</code>, <code>crosshair</code>, <code>pointer</code>, <code>text</code>, <code>wait</code>, <code>help</code>, <code>e-resize</code>, <code>n-resize</code>, <code>ne-resize</code>, <code>nw-resize</code>, <code>s-resize</code>, <code>se-resize</code>, <code>sw-resize</code>, <code>w-resize</code>, <code>ns-resize</code>, <code>ew-resize</code>, <code>nesw-resize</code>, <code>nwse-resize</code>, <code>col-resize</code>, <code>row-resize</code>, <code>m-panning</code>, <code>e-panning</code>, <code>n-panning</code>, <code>ne-panning</code>, <code>nw-panning</code>, <code>s-panning</code>, <code>se-panning</code>, <code>sw-panning</code>, <code>w-panning</code>, <code>move</code>, <code>vertical-text</code>, <code>cell</code>, <code>context-menu</code>, <code>alias</code>, <code>progress</code>, <code>nodrop</code>, <code>copy</code>, <code>none</code>, <code>not-allowed</code>, <code>zoom-in</code>, <code>zoom-out</code>, <code>grab</code>, <code>grabbing</code> or <code>custom</code>.</p>\n<p>If the <code>type</code> parameter is <code>custom</code>, the <code>image</code> parameter will hold the custom cursor image in a <a href=\"/docs/api/native-image\"><code>NativeImage</code></a>, and <code>scale</code>, <code>size</code> and <code>hotspot</code> will hold additional information about the custom cursor.</p>\n<h4 id=\"event-context-menu\"><a href=\"#event-context-menu\">Event: 'context-menu'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>params</code> Object<ul>\n<li><code>x</code> Integer - x Koordinate.</li>\n<li><code>y</code> Integer - y Koordinate.</li>\n<li><code>frame</code> WebFrameMain - Frame from which the context menu was invoked.</li>\n<li><code>linkURL</code> String - URL of the link that encloses the node the context menu was invoked on.</li>\n<li><code>linkText</code> String - Text associated with the link. May be an empty string if the contents of the link are an image.</li>\n<li><code>pageURL</code> String - URL of the top level page that the context menu was invoked on.</li>\n<li><code>frameURL</code> String - URL of the subframe that the context menu was invoked on.</li>\n<li><code>srcURL</code> String - Source URL for the element that the context menu was invoked on. Elements with source URLs are images, audio and video.</li>\n<li><code>mediaType</code> String - Type of the node the context menu was invoked on. Can be <code>none</code>, <code>image</code>, <code>audio</code>, <code>video</code>, <code>canvas</code>, <code>file</code> or <code>plugin</code>.</li>\n<li><code>hasImageContents</code> Boolean - Whether the context menu was invoked on an image which has non-empty contents.</li>\n<li><code>isEditable</code> Boolean - Whether the context is editable.</li>\n<li><code>selectionText</code> String - Text of the selection that the context menu was invoked on.</li>\n<li><code>titleText</code> String - Title text of the selection that the context menu was invoked on.</li>\n<li><code>altText</code> String - Alt text of the selection that the context menu was invoked on.</li>\n<li><code>suggestedFilename</code> String - Suggested filename to be used when saving file through 'Save Link As' option of context menu.</li>\n<li><code>selectionRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> - Rect representing the coordinates in the document space of the selection.</li>\n<li><code>selectionStartOffset</code> Number - Start position of the selection text.</li>\n<li><code>referrerPolicy</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer policy of the frame on which the menu is invoked.</li>\n<li><code>misspelledWord</code> String - The misspelled word under the cursor, if any.</li>\n<li><code>dictionarySuggestions</code> String[] - An array of suggested words to show the user to replace the <code>misspelledWord</code>.  Only available if there is a misspelled word and spellchecker is enabled.</li>\n<li><code>frameCharset</code> String - The character encoding of the frame on which the menu was invoked.</li>\n<li><code>inputFieldType</code> String - If the context menu was invoked on an input field, the type of that field. Possible values are <code>none</code>, <code>plainText</code>, <code>password</code>, <code>other</code>.</li>\n<li><code>spellcheckEnabled</code> Boolean - If the context is editable, whether or not spellchecking is enabled.</li>\n<li><code>menuSourceType</code> String - Input source that invoked the context menu. Can be <code>none</code>, <code>mouse</code>, <code>keyboard</code>, <code>touch</code>, <code>touchMenu</code>, <code>longPress</code>, <code>longTap</code>, <code>touchHandle</code>, <code>stylus</code>, <code>adjustSelection</code>, or <code>adjustSelectionReset</code>.</li>\n<li><code>mediaFlags</code> Object - The flags for the media element the context menu was invoked on.<ul>\n<li><code>inError</code> Boolean - Whether the media element has crashed.</li>\n<li><code>isPaused</code> Boolean - Whether the media element is paused.</li>\n<li><code>isMuted</code> Boolean - Whether the media element is muted.</li>\n<li><code>hasAudio</code> Boolean - Whether the media element has audio.</li>\n<li><code>isLooping</code> Boolean - Whether the media element is looping.</li>\n<li><code>isControlsVisible</code> Boolean - Whether the media element's controls are visible.</li>\n<li><code>canToggleControls</code> Boolean - Whether the media element's controls are toggleable.</li>\n<li><code>canPrint</code> Boolean - Whether the media element can be printed.</li>\n<li><code>canSave</code> Boolean - Whether or not the media element can be downloaded.</li>\n<li><code>canShowPictureInPicture</code> Boolean - Whether the media element can show picture-in-picture.</li>\n<li><code>isShowingPictureInPicture</code> Boolean - Whether the media element is currently showing picture-in-picture.</li>\n<li><code>canRotate</code> Boolean - Whether the media element can be rotated.</li>\n<li><code>canLoop</code> Boolean - Whether the media element can be looped.</li>\n</ul></li>\n<li><code>editFlags</code> Object - These flags indicate whether the renderer believes it is able to perform the corresponding action.<ul>\n<li><code>canUndo</code> Boolean - Whether the renderer believes it can undo.</li>\n<li><code>canRedo</code> Boolean - Whether the renderer believes it can redo.</li>\n<li><code>canCut</code> Boolean - Whether the renderer believes it can cut.</li>\n<li><code>canCopy</code> Boolean - Whether the renderer believes it can copy.</li>\n<li><code>canPaste</code> Boolean - Whether the renderer believes it can paste.</li>\n<li><code>canDelete</code> Boolean - Whether the renderer believes it can delete.</li>\n<li><code>canSelectAll</code> Boolean - Whether the renderer believes it can select all.</li>\n<li><code>canEditRichly</code> Boolean - Whether the renderer believes it can edit text richly.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Emitted when there is a new context menu that needs to be handled.</p>\n<h4 id=\"event-select-bluetooth-device\"><a href=\"#event-select-bluetooth-device\">Event: 'select-bluetooth-device'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>devices</code> <a href=\"/docs/api/structures/bluetooth-device\">BluetoothDevice[]</a></li>\n<li><code>callback</code> Function<ul>\n<li><code>deviceId</code> String</li>\n</ul></li>\n</ul>\n<p>Emitted when bluetooth device needs to be selected on call to <code>navigator.bluetooth.requestDevice</code>. To use <code>navigator.bluetooth</code> api <code>webBluetooth</code> should be enabled. If <code>event.preventDefault</code> is not called, first available device will be selected. <code>callback</code> should be called with <code>deviceId</code> to be selected, passing empty string to <code>callback</code> will cancel the request.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\napp.commandLine.appendSwitch(<span class=\"hljs-string\">'enable-experimental-web-platform-features'</span>)\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.webContents.on(<span class=\"hljs-string\">'select-bluetooth-device'</span>, (event, deviceList, callback) => {\n    event.preventDefault()\n    <span class=\"hljs-keyword\">const</span> result = deviceList.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">device</span>) =></span> {\n      <span class=\"hljs-keyword\">return</span> device.deviceName === <span class=\"hljs-string\">'test'</span>\n    })\n    <span class=\"hljs-keyword\">if</span> (!result) {\n      callback(<span class=\"hljs-string\">''</span>)\n    } <span class=\"hljs-keyword\">else</span> {\n      callback(result.deviceId)\n    }\n  })\n})\n</code></pre>\n<h4 id=\"event-paint\"><a href=\"#event-paint\">Event: 'paint'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>dirtyRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a> - The image data of the whole frame.</li>\n</ul>\n<p>Emitted when a new frame is generated. Only the dirty area is passed in the buffer.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">offscreen</span>: <span class=\"hljs-literal\">true</span> } })\nwin.webContents.on(<span class=\"hljs-string\">'paint'</span>, (event, dirty, image) => {\n  <span class=\"hljs-comment\">// updateBitmap(dirty, image.getBitmap())</span>\n})\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n</code></pre>\n<h4 id=\"event-devtools-reload-page\"><a href=\"#event-devtools-reload-page\">Event: 'devtools-reload-page'</a></h4>\n<p>Emitted when the devtools window instructs the webContents to reload</p>\n<h4 id=\"event-will-attach-webview\"><a href=\"#event-will-attach-webview\">Event: 'will-attach-webview'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webPreferences</code> WebPreferences - The web preferences that will be used by the guest page. This object can be modified to adjust the preferences for the guest page.</li>\n<li><code>params</code> Record&#x3C;string, string> - The other <code>&#x3C;webview></code> parameters such as the <code>src</code> URL. This object can be modified to adjust the parameters of the guest page.</li>\n</ul>\n<p>Emitted when a <code>&#x3C;webview></code>'s web contents is being attached to this web contents. Calling <code>event.preventDefault()</code> will destroy the guest page.</p>\n<p>This event can be used to configure <code>webPreferences</code> for the <code>webContents</code> of a <code>&#x3C;webview></code> before it's loaded, and provides the ability to set settings that can't be set via <code>&#x3C;webview></code> attributes.</p>\n<p><strong>Note:</strong> The specified <code>preload</code> script option will appear as <code>preloadURL</code> (not <code>preload</code>) in the <code>webPreferences</code> object emitted with this event.</p>\n<h4 id=\"event-did-attach-webview\"><a href=\"#event-did-attach-webview\">Event: 'did-attach-webview'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>webContents</code> WebContents - The guest web contents that is used by the <code>&#x3C;webview></code>.</li>\n</ul>\n<p>Emitted when a <code>&#x3C;webview></code> has been attached to this web contents.</p>\n<h4 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>level</code> Integer - The log level, from 0 to 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>message</code> String - The actual console message</li>\n<li><code>line</code> Integer - The line number of the source that triggered this console message</li>\n<li><code>sourceId</code> String</li>\n</ul>\n<p>Emitted when the associated window logs a console message.</p>\n<h4 id=\"event-preload-error\"><a href=\"#event-preload-error\">Event: 'preload-error'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preloadPath</code> String</li>\n<li><code>error</code> Fehler</li>\n</ul>\n<p>Emitted when the preload script <code>preloadPath</code> throws an unhandled exception <code>error</code>.</p>\n<h4 id=\"event-ipc-message\"><a href=\"#event-ipc-message\">Event: 'ipc-message'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Emitted when the renderer process sends an asynchronous message via <code>ipcRenderer.send()</code>.</p>\n<h4 id=\"event-ipc-message-sync\"><a href=\"#event-ipc-message-sync\">Event: 'ipc-message-sync'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Emitted when the renderer process sends a synchronous message via <code>ipcRenderer.sendSync()</code>.</p>\n<h4 id=\"event-desktop-capturer-get-sources\"><a href=\"#event-desktop-capturer-get-sources\">Event: 'desktop-capturer-get-sources'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n</ul>\n<p>Emitted when <code>desktopCapturer.getSources()</code> is called in the renderer process. Calling <code>event.preventDefault()</code> will make it return empty sources.</p>\n<h4 id=\"event-preferred-size-changed\"><a href=\"#event-preferred-size-changed\">Event: 'preferred-size-changed'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>preferredSize</code> <a href=\"/docs/api/structures/size\">Size</a> - The minimum size needed to contain the layout of the document—without requiring scrolling.</li>\n</ul>\n<p>Emitted when the <code>WebContents</code> preferred size has changed.</p>\n<p>This event will only be emitted when <code>enablePreferredSizeMode</code> is set to <code>true</code> in <code>webPreferences</code>.</p>\n<h4 id=\"event-frame-created\"><a href=\"#event-frame-created\">Event: 'frame-created'</a></h4>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>event</code> Event</li>\n<li><code>details</code> Objekt<ul>\n<li><code>frame</code> WebFrameMain</li>\n</ul></li>\n</ul>\n<p>Emitted when the <a href=\"/docs/api/web-contents#contentsmainframe-readonly\">mainFrame</a>, an <code>&#x3C;iframe></code>, or a nested <code>&#x3C;iframe></code> is loaded within the page.</p>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<h4 id=\"contentsloadurlurl-options\"><a href=\"#contentsloadurlurl-options\"><code>contents.loadURL(url[, options])</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (optional) - An HTTP Referrer url.</li>\n<li><code>userAgent</code> String (optional) - A user agent originating the request.</li>\n<li><code>extraHeaders</code> String (optional) - Extra headers separated by \"\\n\".</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified <code>url</code> is a data url and needs to load other files.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - the promise will resolve when the page has finished loading (see <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects if the page fails to load (see <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>). A noop rejection handler is already attached, which avoids unhandled rejection errors.</p>\n<p>Loads the <code>url</code> in the window. The <code>url</code> must contain the protocol prefix, e.g. the <code>http://</code> or <code>file://</code>. If the load should bypass http cache then use the <code>pragma</code> header to achieve it.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> options = { <span class=\"hljs-attr\">extraHeaders</span>: <span class=\"hljs-string\">'pragma: no-cache\\n'</span> }\nwebContents.loadURL(<span class=\"hljs-string\">'https://github.com'</span>, options)\n</code></pre>\n<h4 id=\"contentsloadfilefilepath-options\"><a href=\"#contentsloadfilefilepath-options\"><code>contents.loadFile(filePath[, options])</code></a></h4>\n<ul>\n<li><code>filePath</code> String</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>query</code> Record&#x3C;String, String> (optional) - Passed to <code>url.format()</code>.</li>\n<li><code>search</code> String (optional) - Passed to <code>url.format()</code>.</li>\n<li><code>hash</code> String (optional) - Passed to <code>url.format()</code>.</li>\n</ul></li>\n</ul>\n<p>Gibt <code>Promise</code> zurück - das Versprechen wird aufgelöst, wenn die Seite das Laden beendet hat (siehe <a href=\"/docs/api/web-contents#event-did-finish-load\"><code>did-finish-load</code></a>), und lehnt ab, wenn die Seite nicht geladen wird (siehe <a href=\"/docs/api/web-contents#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Loads the given file in the window, <code>filePath</code> should be a path to an HTML file relative to the root of your application.  For instance an app structure like this:</p>\n<pre><code class=\"hljs language-sh\">| root\n| - package.json\n| - src\n|   - main.js\n|   - index.html\n</code></pre>\n<p>Würde Code wie diesen benötigen</p>\n<pre><code class=\"hljs language-js\">win.loadFile(<span class=\"hljs-string\">'src/index.html'</span>)\n</code></pre>\n<h4 id=\"contentsdownloadurlurl\"><a href=\"#contentsdownloadurlurl\"><code>contents.downloadURL(url)</code></a></h4>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code> without navigating. The <code>will-download</code> event of <code>session</code> will be triggered.</p>\n<h4 id=\"contentsgeturl\"><a href=\"#contentsgeturl\"><code>contents.getURL()</code></a></h4>\n<p>Gibt einen <code>String</code> zurück - Die URL der aktuellen web page.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  <span class=\"hljs-keyword\">const</span> currentURL = win.webContents.getURL()\n  <span class=\"hljs-built_in\">console</span>.log(currentURL)\n})\n</code></pre>\n<h4 id=\"contentsgettitle\"><a href=\"#contentsgettitle\"><code>contents.getTitle()</code></a></h4>\n<p>Returns <code>String</code> - The title of the current web page.</p>\n<h4 id=\"contentsisdestroyed\"><a href=\"#contentsisdestroyed\"><code>contents.isDestroyed()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the web page is destroyed.</p>\n<h4 id=\"contentsfocus\"><a href=\"#contentsfocus\"><code>contents.focus()</code></a></h4>\n<p>Focuses the web page.</p>\n<h4 id=\"contentsisfocused\"><a href=\"#contentsisfocused\"><code>contents.isFocused()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the web page is focused.</p>\n<h4 id=\"contentsisloading\"><a href=\"#contentsisloading\"><code>contents.isLoading()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether web page is still loading resources.</p>\n<h4 id=\"contentsisloadingmainframe\"><a href=\"#contentsisloadingmainframe\"><code>contents.isLoadingMainFrame()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the main frame (and not just iframes or frames within it) is still loading.</p>\n<h4 id=\"contentsiswaitingforresponse\"><a href=\"#contentsiswaitingforresponse\"><code>contents.isWaitingForResponse()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the web page is waiting for a first-response from the main resource of the page.</p>\n<h4 id=\"contentsstop\"><a href=\"#contentsstop\"><code>contents.stop()</code></a></h4>\n<p>Stops any pending navigation.</p>\n<h4 id=\"contentsreload\"><a href=\"#contentsreload\"><code>contents.reload()</code></a></h4>\n<p>Lädt die aktuelle web page neu.</p>\n<h4 id=\"contentsreloadignoringcache\"><a href=\"#contentsreloadignoringcache\"><code>contents.reloadIgnoringCache()</code></a></h4>\n<p>Lädt die aktuelle web page neu und ignoriert dabei die Caches.</p>\n<h4 id=\"contentscangoback\"><a href=\"#contentscangoback\"><code>contents.canGoBack()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the browser can go back to previous web page.</p>\n<h4 id=\"contentscangoforward\"><a href=\"#contentscangoforward\"><code>contents.canGoForward()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the browser can go forward to next web page.</p>\n<h4 id=\"contentscangotooffsetoffset\"><a href=\"#contentscangotooffsetoffset\"><code>contents.canGoToOffset(offset)</code></a></h4>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the web page can go to <code>offset</code>.</p>\n<h4 id=\"contentsclearhistory\"><a href=\"#contentsclearhistory\"><code>contents.clearHistory()</code></a></h4>\n<p>Clears the navigation history.</p>\n<h4 id=\"contentsgoback\"><a href=\"#contentsgoback\"><code>contents.goBack()</code></a></h4>\n<p>Makes the browser go back a web page.</p>\n<h4 id=\"contentsgoforward\"><a href=\"#contentsgoforward\"><code>contents.goForward()</code></a></h4>\n<p>Makes the browser go forward a web page.</p>\n<h4 id=\"contentsgotoindexindex\"><a href=\"#contentsgotoindexindex\"><code>contents.goToIndex(index)</code></a></h4>\n<ul>\n<li><code>index</code> Integer</li>\n</ul>\n<p>Navigates browser to the specified absolute web page index.</p>\n<h4 id=\"contentsgotooffsetoffset\"><a href=\"#contentsgotooffsetoffset\"><code>contents.goToOffset(offset)</code></a></h4>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Navigates to the specified offset from the \"current entry\".</p>\n<h4 id=\"contentsiscrashed\"><a href=\"#contentsiscrashed\"><code>contents.isCrashed()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the renderer process has crashed.</p>\n<h4 id=\"contentsforcefullycrashrenderer\"><a href=\"#contentsforcefullycrashrenderer\"><code>contents.forcefullyCrashRenderer()</code></a></h4>\n<p>Forcefully terminates the renderer process that is currently hosting this <code>webContents</code>. This will cause the <code>render-process-gone</code> event to be emitted with the <code>reason=killed || reason=crashed</code>. Please note that some webContents share renderer processes and therefore calling this method may also crash the host process for other webContents as well.</p>\n<p>Calling <code>reload()</code> immediately after calling this method will force the reload to occur in a new process. This should be used when this process is unstable or unusable, for instance in order to recover from the <code>unresponsive</code> event.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'unresponsive'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> { response } = <span class=\"hljs-keyword\">await</span> dialog.showMessageBox({\n    <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'App X has become unresponsive'</span>,\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'Do you want to try forcefully reloading the app?'</span>,\n    <span class=\"hljs-attr\">buttons</span>: [<span class=\"hljs-string\">'OK'</span>, <span class=\"hljs-string\">'Cancel'</span>],\n    <span class=\"hljs-attr\">cancelId</span>: <span class=\"hljs-number\">1</span>\n  })\n  <span class=\"hljs-keyword\">if</span> (response === <span class=\"hljs-number\">0</span>) {\n    contents.forcefullyCrashRenderer()\n    contents.reload()\n  }\n})\n</code></pre>\n<h4 id=\"contentssetuseragentuseragent\"><a href=\"#contentssetuseragentuseragent\"><code>contents.setUserAgent(userAgent)</code></a></h4>\n<ul>\n<li><code>userAgent</code> String</li>\n</ul>\n<p>Overrides the user agent for this web page.</p>\n<h4 id=\"contentsgetuseragent\"><a href=\"#contentsgetuseragent\"><code>contents.getUserAgent()</code></a></h4>\n<p>Returns <code>String</code> - The user agent for this web page.</p>\n<h4 id=\"contentsinsertcsscss-options\"><a href=\"#contentsinsertcsscss-options\"><code>contents.insertCSS(css[, options])</code></a></h4>\n<ul>\n<li><code>css</code> String</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>cssOrigin</code> String (optional) - Can be either 'user' or 'author'; Specifying 'user' enables you to prevent websites from overriding the CSS you insert. Default is 'author'.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - A promise that resolves with a key for the inserted CSS that can later be used to remove the CSS via <code>contents.removeInsertedCSS(key)</code>.</p>\n<p>Injects CSS into the current web page and returns a unique key for the inserted stylesheet.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n  contents.insertCSS(<span class=\"hljs-string\">'html, body { background-color: #f00; }'</span>)\n})\n</code></pre>\n<h4 id=\"contentsremoveinsertedcsskey\"><a href=\"#contentsremoveinsertedcsskey\"><code>contents.removeInsertedCSS(key)</code></a></h4>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves if the removal was successful.</p>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from <code>contents.insertCSS(css)</code>.</p>\n<pre><code class=\"hljs language-js\">contents.on(<span class=\"hljs-string\">'did-finish-load'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  <span class=\"hljs-keyword\">const</span> key = <span class=\"hljs-keyword\">await</span> contents.insertCSS(<span class=\"hljs-string\">'html, body { background-color: #f00; }'</span>)\n  contents.removeInsertedCSS(key)\n})\n</code></pre>\n<h4 id=\"contentsexecutejavascriptcode-usergesture\"><a href=\"#contentsexecutejavascriptcode-usergesture\"><code>contents.executeJavaScript(code[, userGesture])</code></a></h4>\n<ul>\n<li><code>code</code> Zeichenkette</li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if the result of the code is a rejected promise.</p>\n<p>Evaluates <code>code</code> in page.</p>\n<p>In the browser window some HTML APIs like <code>requestFullScreen</code> can only be invoked by a gesture from the user. Setting <code>userGesture</code> to <code>true</code> will remove this limitation.</p>\n<p>Code execution will be suspended until web page stop loading.</p>\n<pre><code class=\"hljs language-js\">contents.executeJavaScript(<span class=\"hljs-string\">'fetch(\"https://jsonplaceholder.typicode.com/users/1\").then(resp => resp.json())'</span>, <span class=\"hljs-literal\">true</span>)\n  .then(<span class=\"hljs-function\">(<span class=\"hljs-params\">result</span>) =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(result) <span class=\"hljs-comment\">// Will be the JSON object from the fetch call</span>\n  })\n</code></pre>\n<h4 id=\"contentsexecutejavascriptinisolatedworldworldid-scripts-usergesture\"><a href=\"#contentsexecutejavascriptinisolatedworldworldid-scripts-usergesture\"><code>contents.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture])</code></a></h4>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default world, <code>999</code> is the world used by Electron's <code>contextIsolation</code> feature.  You can provide any integer here.</li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/web-source\">WebSource[]</a></li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if the result of the code is a rejected promise.</p>\n<p>Works like <code>executeJavaScript</code> but evaluates <code>scripts</code> in an isolated context.</p>\n<h4 id=\"contentssetignoremenushortcutsignore\"><a href=\"#contentssetignoremenushortcutsignore\"><code>contents.setIgnoreMenuShortcuts(ignore)</code></a></h4>\n<ul>\n<li><code>ignore</code> Boolean</li>\n</ul>\n<p>Ignore application menu shortcuts while this web contents is focused.</p>\n<h4 id=\"contentssetwindowopenhandlerhandler\"><a href=\"#contentssetwindowopenhandlerhandler\"><code>contents.setWindowOpenHandler(handler)</code></a></h4>\n<ul>\n<li>\n<p><code>handler</code> Funktion&#x3C;{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}></p>\n<ul>\n<li><code>details</code> Objekt<ul>\n<li><code>url</code> String - The <em>resolved</em> version of the URL passed to <code>window.open()</code>. e.g. opening a window with <code>window.open('foo')</code> will yield something like <code>https://the-origin/the/current/path/foo</code>.</li>\n<li><code>frameName</code> String - Name of the window provided in <code>window.open()</code></li>\n<li><code>features</code> String - Comma separated list of window features provided to <code>window.open()</code>.</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> or <code>other</code>.</li>\n<li><code>referrer</code> <a href=\"/docs/api/structures/referrer\">Referrer</a> - The referrer that will be passed to the new window. May or may not result in the <code>Referer</code> header being sent, depending on the referrer policy.</li>\n<li><code>postBody</code> <a href=\"/docs/api/structures/post-body\">PostBody</a> (optional) - The post data that will be sent to the new window, along with the appropriate headers that will be set. If no post data is to be sent, the value will be <code>null</code>. Only defined when the window is being created by a form that set <code>target=_blank</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}</code> - <code>deny</code> cancels the creation of the new window. <code>allow</code> will allow the new window to be created. Specifying <code>overrideBrowserWindowOptions</code> allows customization of the created window. Returning an unrecognized value such as a null, undefined, or an object without a recognized 'action' value will result in a console error and have the same effect as returning <code>{action: 'deny'}</code>.</p>\n</li>\n</ul>\n<p>Called before creating a window a new window is requested by the renderer, e.g. by <code>window.open()</code>, a link with <code>target=\"_blank\"</code>, shift+clicking on a link, or submitting a form with <code>&#x3C;form target=\"_blank\"></code>. See <a href=\"/docs/api/window-open\"><code>window.open()</code></a> for more details and how to use this in conjunction with <code>did-create-window</code>.</p>\n<h4 id=\"contentssetaudiomutedmuted\"><a href=\"#contentssetaudiomutedmuted\"><code>contents.setAudioMuted(muted)</code></a></h4>\n<ul>\n<li><code>muted</code> Boolean</li>\n</ul>\n<p>Mute the audio on the current web page.</p>\n<h4 id=\"contentsisaudiomuted\"><a href=\"#contentsisaudiomuted\"><code>contents.isAudioMuted()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether this page has been muted.</p>\n<h4 id=\"contentsiscurrentlyaudible\"><a href=\"#contentsiscurrentlyaudible\"><code>contents.isCurrentlyAudible()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether audio is currently playing.</p>\n<h4 id=\"contentssetzoomfactorfactor\"><a href=\"#contentssetzoomfactorfactor\"><code>contents.setZoomFactor(factor)</code></a></h4>\n<ul>\n<li><code>factor</code> Double - Zoom factor; default is 1.0.</li>\n</ul>\n<p>Changes the zoom factor to the specified factor. Zoom factor is zoom percent divided by 100, so 300% = 3.0.</p>\n<p>The factor must be greater than 0.0.</p>\n<h4 id=\"contentsgetzoomfactor\"><a href=\"#contentsgetzoomfactor\"><code>contents.getZoomFactor()</code></a></h4>\n<p>Returns <code>Number</code> - the current zoom factor.</p>\n<h4 id=\"contentssetzoomlevellevel\"><a href=\"#contentssetzoomlevellevel\"><code>contents.setZoomLevel(level)</code></a></h4>\n<ul>\n<li><code>level</code> Number - Zoom level.</li>\n</ul>\n<p>Changes the zoom level to the specified level. The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. The formula for this is <code>scale := 1.2 ^ level</code>.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h4 id=\"contentsgetzoomlevel\"><a href=\"#contentsgetzoomlevel\"><code>contents.getZoomLevel()</code></a></h4>\n<p>Returns <code>Number</code> - the current zoom level.</p>\n<h4 id=\"contentssetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#contentssetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>contents.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h4>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>Gibt das <code>Promise&#x3C;void></code> zurück</p>\n<p>Setzt das Maximum und Minimum pinch-to-zoom Level.</p>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom is disabled by default in Electron. To re-enable it, call:</p>\n<pre><code class=\"hljs language-js\">contents.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">3</span>)\n</code></pre>\n</blockquote>\n<h4 id=\"contentsundo\"><a href=\"#contentsundo\"><code>contents.undo()</code></a></h4>\n<p>Executes the editing command <code>undo</code> in web page.</p>\n<h4 id=\"contentsredo\"><a href=\"#contentsredo\"><code>contents.redo()</code></a></h4>\n<p>Executes the editing command <code>redo</code> in web page.</p>\n<h4 id=\"contentscut\"><a href=\"#contentscut\"><code>contents.cut()</code></a></h4>\n<p>Executes the editing command <code>cut</code> in web page.</p>\n<h4 id=\"contentscopy\"><a href=\"#contentscopy\"><code>contents.copy()</code></a></h4>\n<p>Executes the editing command <code>copy</code> in web page.</p>\n<h4 id=\"contentscopyimageatx-y\"><a href=\"#contentscopyimageatx-y\"><code>contents.copyImageAt(x, y)</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Copy the image at the given position to the clipboard.</p>\n<h4 id=\"contentspaste\"><a href=\"#contentspaste\"><code>contents.paste()</code></a></h4>\n<p>Executes the editing command <code>paste</code> in web page.</p>\n<h4 id=\"contentspasteandmatchstyle\"><a href=\"#contentspasteandmatchstyle\"><code>contents.pasteAndMatchStyle()</code></a></h4>\n<p>Executes the editing command <code>pasteAndMatchStyle</code> in web page.</p>\n<h4 id=\"contentsdelete\"><a href=\"#contentsdelete\"><code>contents.delete()</code></a></h4>\n<p>Executes the editing command <code>delete</code> in web page.</p>\n<h4 id=\"contentsselectall\"><a href=\"#contentsselectall\"><code>contents.selectAll()</code></a></h4>\n<p>Executes the editing command <code>selectAll</code> in web page.</p>\n<h4 id=\"contentsunselect\"><a href=\"#contentsunselect\"><code>contents.unselect()</code></a></h4>\n<p>Executes the editing command <code>unselect</code> in web page.</p>\n<h4 id=\"contentsreplacetext\"><a href=\"#contentsreplacetext\"><code>contents.replace(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes the editing command <code>replace</code> in web page.</p>\n<h4 id=\"contentsreplacemisspellingtext\"><a href=\"#contentsreplacemisspellingtext\"><code>contents.replaceMisspelling(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes the editing command <code>replaceMisspelling</code> in web page.</p>\n<h4 id=\"contentsinserttexttext\"><a href=\"#contentsinserttexttext\"><code>contents.insertText(text)</code></a></h4>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Gibt das <code>Promise&#x3C;void></code> zurück</p>\n<p>Füge <code>text</code> in das fokusierte Element ein.</p>\n<h4 id=\"contentsfindinpagetext-options\"><a href=\"#contentsfindinpagetext-options\"><code>contents.findInPage(text[, options])</code></a></h4>\n<ul>\n<li><code>text</code> String - Content to be searched, must not be empty.</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>forward</code> Boolean (optional) - Whether to search forward or backward, defaults to <code>true</code>.</li>\n<li><code>findNext</code> Boolean (optional) - Whether to begin a new text finding session with this request. Should be <code>true</code> for initial requests, and <code>false</code> for follow-up requests. Defaults to <code>false</code>.</li>\n<li><code>matchCase</code> Boolean (optional) - Whether search should be case-sensitive, defaults to <code>false</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code> - The request id used for the request.</p>\n<p>Starts a request to find all matches for the <code>text</code> in the web page. The result of the request can be obtained by subscribing to <a href=\"/docs/api/web-contents#event-found-in-page\"><code>found-in-page</code></a> event.</p>\n<h4 id=\"contentsstopfindinpageaction\"><a href=\"#contentsstopfindinpageaction\"><code>contents.stopFindInPage(action)</code></a></h4>\n<ul>\n<li><code>action</code> String - Specifies the action to take place when ending [<code>webContents.findInPage</code>] request.<ul>\n<li><code>clearSelection</code> - Clear the selection.</li>\n<li><code>keepSelection</code> - Translate the selection into a normal selection.</li>\n<li><code>activateSelection</code> - Focus and click the selection node.</li>\n</ul></li>\n</ul>\n<p>Stops any <code>findInPage</code> request for the <code>webContents</code> with the provided <code>action</code>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nwebContents.on(<span class=\"hljs-string\">'found-in-page'</span>, (event, result) => {\n  <span class=\"hljs-keyword\">if</span> (result.finalUpdate) webContents.stopFindInPage(<span class=\"hljs-string\">'clearSelection'</span>)\n})\n\n<span class=\"hljs-keyword\">const</span> requestId = webContents.findInPage(<span class=\"hljs-string\">'api'</span>)\n<span class=\"hljs-built_in\">console</span>.log(requestId)\n</code></pre>\n<h4 id=\"contentscapturepagerect\"><a href=\"#contentscapturepagerect\"><code>contents.capturePage([rect])</code></a></h4>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (optional) - The area of the page to be captured.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - Resolves with a <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Captures a snapshot of the page within <code>rect</code>. Omitting <code>rect</code> will capture the whole visible page.</p>\n<h4 id=\"contentsisbeingcaptured\"><a href=\"#contentsisbeingcaptured\"><code>contents.isBeingCaptured()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether this page is being captured. It returns true when the capturer count is large then 0.</p>\n<h4 id=\"contentsincrementcapturercountsize-stayhidden-stayawake\"><a href=\"#contentsincrementcapturercountsize-stayhidden-stayawake\"><code>contents.incrementCapturerCount([size, stayHidden, stayAwake])</code></a></h4>\n<ul>\n<li><code>size</code> <a href=\"/docs/api/structures/size\">Size</a> (optional) - The preferred size for the capturer.</li>\n<li><code>stayHidden</code> Boolean (optional) -  Keep the page hidden instead of visible.</li>\n<li><code>stayAwake</code> Boolean (optional) -  Keep the system awake instead of allowing it to sleep.</li>\n</ul>\n<p>Increase the capturer count by one. The page is considered visible when its browser window is hidden and the capturer count is non-zero. If you would like the page to stay hidden, you should ensure that <code>stayHidden</code> is set to true.</p>\n<p>This also affects the Page Visibility API.</p>\n<h4 id=\"contentsdecrementcapturercountstayhidden-stayawake\"><a href=\"#contentsdecrementcapturercountstayhidden-stayawake\"><code>contents.decrementCapturerCount([stayHidden, stayAwake])</code></a></h4>\n<ul>\n<li><code>stayHidden</code> Boolean (optional) -  Keep the page in hidden state instead of visible.</li>\n<li><code>stayAwake</code> Boolean (optional) -  Keep the system awake instead of allowing it to sleep.</li>\n</ul>\n<p>Decrease the capturer count by one. The page will be set to hidden or occluded state when its browser window is hidden or occluded and the capturer count reaches zero. If you want to decrease the hidden capturer count instead you should set <code>stayHidden</code> to true.</p>\n<h4 id=\"contentsgetprinters\"><a href=\"#contentsgetprinters\"><code>contents.getPrinters()</code></a></h4>\n<p>Get the system printer list.</p>\n<p>Returns <a href=\"/docs/api/structures/printer-info\"><code>PrinterInfo[]</code></a></p>\n<h4 id=\"contentsprintoptions-callback\"><a href=\"#contentsprintoptions-callback\"><code>contents.print([options], [callback])</code></a></h4>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>silent</code> Boolean (optional) - Don't ask user for print settings. Standard ist <code>false</code>.</li>\n<li><code>printBackground</code> Boolean (optional) - Prints the background color and image of the web page. Standard ist <code>false</code>.</li>\n<li><code>deviceName</code> String (optional) - Set the printer device name to use. Must be the system-defined name and not the 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.</li>\n<li><code>color</code> Boolean (optional) - Set whether the printed web page will be in color or grayscale. Standard ist <code>true</code>.</li>\n<li><code>margins</code> Object (optional)<ul>\n<li><code>marginType</code> String (optional) - Can be <code>default</code>, <code>none</code>, <code>printableArea</code>, or <code>custom</code>. If <code>custom</code> is chosen, you will also need to specify <code>top</code>, <code>bottom</code>, <code>left</code>, and <code>right</code>.</li>\n<li><code>top</code> Number (optional) - The top margin of the printed web page, in pixels.</li>\n<li><code>bottom</code> Number (optional) - The bottom margin of the printed web page, in pixels.</li>\n<li><code>left</code> Number (optional) - The left margin of the printed web page, in pixels.</li>\n<li><code>right</code> Number (optional) - The right margin of the printed web page, in pixels.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - Whether the web page should be printed in landscape mode. Standard ist <code>false</code>.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page.</li>\n<li><code>pagesPerSheet</code> Number (optional) - The number of pages to print per page sheet.</li>\n<li><code>collate</code> Boolean (optional) - Whether the web page should be collated.</li>\n<li><code>copies</code> Number (optional) - The number of copies of the web page to print.</li>\n<li><code>pageRanges</code> Object<a href=\"/docs/api/optional\"></a> - The page range to print. On macOS, only one range is honored.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>duplexMode</code> String (optional) - Set the duplex mode of the printed web page. Can be <code>simplex</code>, <code>shortEdge</code>, or <code>longEdge</code>.</li>\n<li><code>dpi</code> Record&#x3C;string, number> (optional)<ul>\n<li><code>horizontal</code> Number (optional) - The horizontal dpi.</li>\n<li><code>vertical</code> Number (optional) - The vertical dpi.</li>\n</ul></li>\n<li><code>header</code> String (optional) - String to be printed as page header.</li>\n<li><code>footer</code> String (optional) - String to be printed as page footer.</li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the printed document. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code>.</li>\n</ul></li>\n<li><code>callback</code> Funktion (optional)<ul>\n<li><code>success</code> Boolean - Indicates success of the print call.</li>\n<li><code>failureReason</code> String - Error description called back if the print fails.</li>\n</ul></li>\n</ul>\n<p>When a custom <code>pageSize</code> is passed, Chromium attempts to validate platform specific minimum values for <code>width_microns</code> and <code>height_microns</code>. Width and height must both be minimum 353 microns but may be higher on some operating systems.</p>\n<p>Prints window's web page. When <code>silent</code> is set to <code>true</code>, Electron will pick the system's default printer if <code>deviceName</code> is empty and the default settings for printing.</p>\n<p>Use <code>page-break-before: always;</code> CSS style to force to print to a new page.</p>\n<p>Example usage:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> options = {\n  <span class=\"hljs-attr\">silent</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">deviceName</span>: <span class=\"hljs-string\">'My-Printer'</span>,\n  <span class=\"hljs-attr\">pageRanges</span>: [{\n    <span class=\"hljs-attr\">from</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">to</span>: <span class=\"hljs-number\">1</span>\n  }]\n}\nwin.webContents.print(options, (success, errorType) => {\n  <span class=\"hljs-keyword\">if</span> (!success) <span class=\"hljs-built_in\">console</span>.log(errorType)\n})\n</code></pre>\n<h4 id=\"contentsprinttopdfoptions\"><a href=\"#contentsprinttopdfoptions\"><code>contents.printToPDF(options)</code></a></h4>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>headerFooter</code> Record&#x3C;string, string> (optional) - the header and footer for the PDF.<ul>\n<li><code>title</code> String - The title for the PDF header.</li>\n<li><code>url</code> String - the url for the PDF footer.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - <code>true</code> for landscape, <code>false</code> for portrait.</li>\n<li><code>marginsType</code> Integer (optional) - Specifies the type of margins to use. Uses 0 for default margin, 1 for no margin, and 2 for minimum margin.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page. Can range from 0 to 100.</li>\n<li><code>pageRanges</code> Record&#x3C;string, number> (optional) - The page range to print.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the generated PDF. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code> and <code>width</code> in microns.</li>\n<li><code>printBackground</code> Boolean (optional) - Whether to print CSS backgrounds.</li>\n<li><code>printSelectionOnly</code> Boolean (optional) - Whether to print selection only.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Buffer></code> - Resolves with the generated PDF data.</p>\n<p>Prints window's web page as PDF with Chromium's preview printing custom settings.</p>\n<p>The <code>landscape</code> will be ignored if <code>@page</code> CSS at-rule is used in the web page.</p>\n<p>By default, an empty <code>options</code> will be regarded as:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">marginsType</span>: <span class=\"hljs-number\">0</span>,\n  <span class=\"hljs-attr\">printBackground</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">printSelectionOnly</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">landscape</span>: <span class=\"hljs-literal\">false</span>,\n  <span class=\"hljs-attr\">pageSize</span>: <span class=\"hljs-string\">'A4'</span>,\n  <span class=\"hljs-attr\">scaleFactor</span>: <span class=\"hljs-number\">100</span>\n}\n</code></pre>\n<p>Use <code>page-break-before: always;</code> CSS style to force to print to a new page.</p>\n<p>Ein Beispiel für <code>webContents.printToPDF</code>:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> fs = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'fs'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n<span class=\"hljs-keyword\">const</span> os = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'os'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\nwin.loadURL(<span class=\"hljs-string\">'http://github.com'</span>)\n\nwin.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n  <span class=\"hljs-comment\">// Use default printing options</span>\n  win.webContents.printToPDF({}).then(<span class=\"hljs-function\"><span class=\"hljs-params\">data</span> =></span> {\n    <span class=\"hljs-keyword\">const</span> pdfPath = path.join(os.homedir(), <span class=\"hljs-string\">'Desktop'</span>, <span class=\"hljs-string\">'temp.pdf'</span>)\n    fs.writeFile(pdfPath, data, (error) => {\n      <span class=\"hljs-keyword\">if</span> (error) <span class=\"hljs-keyword\">throw</span> error\n      <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Wrote PDF successfully to <span class=\"hljs-subst\">${pdfPath}</span>`</span>)\n    })\n  }).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">error</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">`Failed to write PDF to <span class=\"hljs-subst\">${pdfPath}</span>: `</span>, error)\n  })\n})\n</code></pre>\n<h4 id=\"contentsaddworkspacepath\"><a href=\"#contentsaddworkspacepath\"><code>contents.addWorkSpace(path)</code></a></h4>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Adds the specified path to DevTools workspace. Must be used after DevTools creation:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.webContents.on(<span class=\"hljs-string\">'devtools-opened'</span>, () => {\n  win.webContents.addWorkSpace(__dirname)\n})\n</code></pre>\n<h4 id=\"contentsremoveworkspacepath\"><a href=\"#contentsremoveworkspacepath\"><code>contents.removeWorkSpace(path)</code></a></h4>\n<ul>\n<li><code>path</code> String</li>\n</ul>\n<p>Removes the specified path from DevTools workspace.</p>\n<h4 id=\"contentssetdevtoolswebcontentsdevtoolswebcontents\"><a href=\"#contentssetdevtoolswebcontentsdevtoolswebcontents\"><code>contents.setDevToolsWebContents(devToolsWebContents)</code></a></h4>\n<ul>\n<li><code>devToolsWebContents</code> WebContents</li>\n</ul>\n<p>Uses the <code>devToolsWebContents</code> as the target <code>WebContents</code> to show devtools.</p>\n<p>The <code>devToolsWebContents</code> must not have done any navigation, and it should not be used for other purposes after the call.</p>\n<p>By default Electron manages the devtools by creating an internal <code>WebContents</code> with native view, which developers have very limited control of. With the <code>setDevToolsWebContents</code> method, developers can use any <code>WebContents</code> to show the devtools in it, including <code>BrowserWindow</code>, <code>BrowserView</code> and <code>&#x3C;webview></code> tag.</p>\n<p>Note that closing the devtools does not destroy the <code>devToolsWebContents</code>, it is caller's responsibility to destroy <code>devToolsWebContents</code>.</p>\n<p>An example of showing devtools in a <code>&#x3C;webview></code> tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">head</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">style</span> <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"text/css\"</span>></span><span class=\"css\">\n    * { <span class=\"hljs-attribute\">margin</span>: <span class=\"hljs-number\">0</span>; }\n    <span class=\"hljs-selector-id\">#browser</span> { <span class=\"hljs-attribute\">height</span>: <span class=\"hljs-number\">70%</span>; }\n    <span class=\"hljs-selector-id\">#devtools</span> { <span class=\"hljs-attribute\">height</span>: <span class=\"hljs-number\">30%</span>; }\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">style</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">head</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"browser\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"devtools\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"about:blank\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n    <span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n    <span class=\"hljs-keyword\">const</span> emittedOnce = <span class=\"hljs-function\">(<span class=\"hljs-params\">element, eventName</span>) =></span> <span class=\"hljs-keyword\">new</span> <span class=\"hljs-built_in\">Promise</span>(<span class=\"hljs-function\"><span class=\"hljs-params\">resolve</span> =></span> {\n      element.addEventListener(eventName, event => resolve(event), { <span class=\"hljs-attr\">once</span>: <span class=\"hljs-literal\">true</span> })\n    })\n    <span class=\"hljs-keyword\">const</span> browserView = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'browser'</span>)\n    <span class=\"hljs-keyword\">const</span> devtoolsView = <span class=\"hljs-built_in\">document</span>.getElementById(<span class=\"hljs-string\">'devtools'</span>)\n    <span class=\"hljs-keyword\">const</span> browserReady = emittedOnce(browserView, <span class=\"hljs-string\">'dom-ready'</span>)\n    <span class=\"hljs-keyword\">const</span> devtoolsReady = emittedOnce(devtoolsView, <span class=\"hljs-string\">'dom-ready'</span>)\n    <span class=\"hljs-built_in\">Promise</span>.all([browserReady, devtoolsReady]).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      <span class=\"hljs-keyword\">const</span> targetId = browserView.getWebContentsId()\n      <span class=\"hljs-keyword\">const</span> devtoolsId = devtoolsView.getWebContentsId()\n      ipcRenderer.send(<span class=\"hljs-string\">'open-devtools'</span>, targetId, devtoolsId)\n    })\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { ipcMain, webContents } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcMain.on(<span class=\"hljs-string\">'open-devtools'</span>, (event, targetContentsId, devtoolsContentsId) => {\n  <span class=\"hljs-keyword\">const</span> target = webContents.fromId(targetContentsId)\n  <span class=\"hljs-keyword\">const</span> devtools = webContents.fromId(devtoolsContentsId)\n  target.setDevToolsWebContents(devtools)\n  target.openDevTools()\n})\n</code></pre>\n<p>Ein Beispiel zum zeigen der DevTools in einem <code>BrowserWindow</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n<span class=\"hljs-keyword\">let</span> devtools = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  devtools = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n  win.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n  win.webContents.setDevToolsWebContents(devtools.webContents)\n  win.webContents.openDevTools({ <span class=\"hljs-attr\">mode</span>: <span class=\"hljs-string\">'detach'</span> })\n})\n</code></pre>\n<h4 id=\"contentsopendevtoolsoptions\"><a href=\"#contentsopendevtoolsoptions\"><code>contents.openDevTools([options])</code></a></h4>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>mode</code> String - Opens the devtools with specified dock state, can be <code>right</code>, <code>bottom</code>, <code>undocked</code>, <code>detach</code>. Defaults to last used dock state. In <code>undocked</code> mode it's possible to dock back. In <code>detach</code> mode it's not.</li>\n<li><code>activate</code> Boolean (optional) - Whether to bring the opened devtools window to the foreground. The default is <code>true</code>.</li>\n</ul></li>\n</ul>\n<p>Opens the devtools.</p>\n<p>When <code>contents</code> is a <code>&#x3C;webview></code> tag, the <code>mode</code> would be <code>detach</code> by default, explicitly passing an empty <code>mode</code> can force using last used dock state.</p>\n<h4 id=\"contentsclosedevtools\"><a href=\"#contentsclosedevtools\"><code>contents.closeDevTools()</code></a></h4>\n<p>Schließt die DevTools.</p>\n<h4 id=\"contentsisdevtoolsopened\"><a href=\"#contentsisdevtoolsopened\"><code>contents.isDevToolsOpened()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the devtools is opened.</p>\n<h4 id=\"contentsisdevtoolsfocused\"><a href=\"#contentsisdevtoolsfocused\"><code>contents.isDevToolsFocused()</code></a></h4>\n<p>Returns <code>Boolean</code> - Whether the devtools view is focused .</p>\n<h4 id=\"contentstoggledevtools\"><a href=\"#contentstoggledevtools\"><code>contents.toggleDevTools()</code></a></h4>\n<p>Toggles the developer tools.</p>\n<h4 id=\"contentsinspectelementx-y\"><a href=\"#contentsinspectelementx-y\"><code>contents.inspectElement(x, y)</code></a></h4>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Starts inspecting element at position (<code>x</code>, <code>y</code>).</p>\n<h4 id=\"contentsinspectsharedworker\"><a href=\"#contentsinspectsharedworker\"><code>contents.inspectSharedWorker()</code></a></h4>\n<p>Opens the developer tools for the shared worker context.</p>\n<h4 id=\"contentsinspectsharedworkerbyidworkerid\"><a href=\"#contentsinspectsharedworkerbyidworkerid\"><code>contents.inspectSharedWorkerById(workerId)</code></a></h4>\n<ul>\n<li><code>workerId</code> String</li>\n</ul>\n<p>Inspects the shared worker based on its ID.</p>\n<h4 id=\"contentsgetallsharedworkers\"><a href=\"#contentsgetallsharedworkers\"><code>contents.getAllSharedWorkers()</code></a></h4>\n<p>Returns <a href=\"/docs/api/structures/shared-worker-info\"><code>SharedWorkerInfo[]</code></a> - Information about all Shared Workers.</p>\n<h4 id=\"contentsinspectserviceworker\"><a href=\"#contentsinspectserviceworker\"><code>contents.inspectServiceWorker()</code></a></h4>\n<p>Opens the developer tools for the service worker context.</p>\n<h4 id=\"contentssendchannel-args\"><a href=\"#contentssendchannel-args\"><code>contents.send(channel, ...args)</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to the renderer process via <code>channel</code>, along with arguments. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE</strong>: Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n</blockquote>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>An example of sending messages from the main process to the renderer process:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// Im Hauptprozess.</span>\n<span class=\"hljs-keyword\">const</span> { app, BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">let</span> win = <span class=\"hljs-literal\">null</span>\n\napp.whenReady().then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n  win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  win.loadURL(<span class=\"hljs-string\">`file://<span class=\"hljs-subst\">${__dirname}</span>/index.html`</span>)\n  win.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, () => {\n    win.webContents.send(<span class=\"hljs-string\">'ping'</span>, <span class=\"hljs-string\">'whoooooooh!'</span>)\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- index.html --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">html</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">body</span>></span>\n  <span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n    <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).ipcRenderer.on(<span class=\"hljs-string\">'ping'</span>, (event, message) => {\n      <span class=\"hljs-built_in\">console</span>.log(message) <span class=\"hljs-comment\">// Prints 'whoooooooh!'</span>\n    })\n  </span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">body</span>></span>\n<span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">html</span>></span>\n</code></pre>\n<h4 id=\"contentssendtoframeframeid-channel-args\"><a href=\"#contentssendtoframeframeid-channel-args\"><code>contents.sendToFrame(frameId, channel, ...args)</code></a></h4>\n<ul>\n<li><code>frameId</code> Integer | [number, number] - the ID of the frame to send to, or a pair of <code>[processId, frameId]</code> if the frame is in a different process to the main frame.</li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to a specific frame in a renderer process via <code>channel</code>, along with arguments. Arguments will be serialized with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">Structured Clone Algorithm</a>, just like <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage\"><code>postMessage</code></a>, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<blockquote>\n<p><strong>NOTE:</strong> Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.</p>\n</blockquote>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>If you want to get the <code>frameId</code> of a given renderer context you should use the <code>webFrame.routingId</code> value.  z.B.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// In a renderer process</span>\n<span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'My frameId is:'</span>, <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>).webFrame.routingId)\n</code></pre>\n<p>You can also read <code>frameId</code> from all incoming IPC messages in the main process.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// In the main process</span>\nipcMain.on(<span class=\"hljs-string\">'ping'</span>, (event) => {\n  <span class=\"hljs-built_in\">console</span>.info(<span class=\"hljs-string\">'Message came from frameId:'</span>, event.frameId)\n})\n</code></pre>\n<h4 id=\"contentspostmessagechannel-message-transfer\"><a href=\"#contentspostmessagechannel-message-transfer\"><code>contents.postMessage(channel, message, [transfer])</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Send a message to the renderer process, optionally transferring ownership of zero or more [<code>MessagePortMain</code>][] objects.</p>\n<p>The transferred <code>MessagePortMain</code> objects will be available in the renderer process by accessing the <code>ports</code> property of the emitted event. When they arrive in the renderer, they will be native DOM <code>MessagePort</code> objects.</p>\n<p>Ein Beispiel:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nwebContents.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<h4 id=\"contentsenabledeviceemulationparameters\"><a href=\"#contentsenabledeviceemulationparameters\"><code>contents.enableDeviceEmulation(parameters)</code></a></h4>\n<ul>\n<li><code>parameters</code> Objekt<ul>\n<li><code>screenPosition</code> String - Specify the screen type to emulate (default: <code>desktop</code>):<ul>\n<li><code>desktop</code> - Desktop screen type.</li>\n<li><code>mobile</code> - Mobile screen type.</li>\n</ul></li>\n<li><code>screenSize</code> <a href=\"/docs/api/structures/size\">Size</a> - Set the emulated screen size (screenPosition == mobile).</li>\n<li><code>viewPosition</code> <a href=\"/docs/api/structures/point\">Point</a> - Position the view on the screen (screenPosition == mobile) (default: <code>{ x: 0, y: 0 }</code>).</li>\n<li><code>deviceScaleFactor</code> Integer - Set the device scale factor (if zero defaults to original device scale factor) (default: <code>0</code>).</li>\n<li><code>viewSize</code> <a href=\"/docs/api/structures/size\">Size</a> - Set the emulated view size (empty means no override)</li>\n<li><code>scale</code> Float - Scale of emulated view inside available space (not in fit to view mode) (default: <code>1</code>).</li>\n</ul></li>\n</ul>\n<p>Enable device emulation with the given parameters.</p>\n<h4 id=\"contentsdisabledeviceemulation\"><a href=\"#contentsdisabledeviceemulation\"><code>contents.disableDeviceEmulation()</code></a></h4>\n<p>Disable device emulation enabled by <code>webContents.enableDeviceEmulation</code>.</p>\n<h4 id=\"contentssendinputeventinputevent\"><a href=\"#contentssendinputeventinputevent\"><code>contents.sendInputEvent(inputEvent)</code></a></h4>\n<ul>\n<li><code>inputEvent</code> <a href=\"/docs/api/structures/mouse-input-event\">MouseInputEvent</a> | <a href=\"/docs/api/structures/mouse-wheel-input-event\">MouseWheelInputEvent</a> | <a href=\"/docs/api/structures/keyboard-input-event\">KeyboardInputEvent</a></li>\n</ul>\n<p>Sends an input <code>event</code> to the page. <strong>Note:</strong> The <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a> containing the contents needs to be focused for <code>sendInputEvent()</code> to work.</p>\n<h4 id=\"contentsbeginframesubscriptiononlydirty-callback\"><a href=\"#contentsbeginframesubscriptiononlydirty-callback\"><code>contents.beginFrameSubscription([onlyDirty ,]callback)</code></a></h4>\n<ul>\n<li><code>onlyDirty</code> Boolean (optional) - Defaults to <code>false</code>.</li>\n<li><code>callback</code> Function<ul>\n<li><code>image</code> <a href=\"/docs/api/native-image\">NativeImage</a></li>\n<li><code>dirtyRect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a></li>\n</ul></li>\n</ul>\n<p>Begin subscribing for presentation events and captured frames, the <code>callback</code> will be called with <code>callback(image, dirtyRect)</code> when there is a presentation event.</p>\n<p>The <code>image</code> is an instance of <a href=\"/docs/api/native-image\">NativeImage</a> that stores the captured frame.</p>\n<p>The <code>dirtyRect</code> is an object with <code>x, y, width, height</code> properties that describes which part of the page was repainted. If <code>onlyDirty</code> is set to <code>true</code>, <code>image</code> will only contain the repainted area. <code>onlyDirty</code> defaults to <code>false</code>.</p>\n<h4 id=\"contentsendframesubscription\"><a href=\"#contentsendframesubscription\"><code>contents.endFrameSubscription()</code></a></h4>\n<p>End subscribing for frame presentation events.</p>\n<h4 id=\"contentsstartdragitem\"><a href=\"#contentsstartdragitem\"><code>contents.startDrag(item)</code></a></h4>\n<ul>\n<li><code>item</code> Objekt<ul>\n<li><code>file</code> String - The path to the file being dragged.</li>\n<li><code>files</code> String<a href=\"/docs/api/optional\"></a> - The paths to the files being dragged. (<code>files</code> will override <code>file</code> field)</li>\n<li><code>icon</code> <a href=\"/docs/api/native-image\">NativeImage</a> | String - The image must be non-empty on macOS.</li>\n</ul></li>\n</ul>\n<p>Sets the <code>item</code> as dragging item for current drag-drop operation, <code>file</code> is the absolute path of the file to be dragged, and <code>icon</code> is the image showing under the cursor when dragging.</p>\n<h4 id=\"contentssavepagefullpath-savetype\"><a href=\"#contentssavepagefullpath-savetype\"><code>contents.savePage(fullPath, saveType)</code></a></h4>\n<ul>\n<li><code>fullPath</code> String - Der volle Dateipfad.</li>\n<li><code>saveType</code> String - Specify the save type.<ul>\n<li><code>HTMLOnly</code> - Save only the HTML of the page.</li>\n<li><code>HTMLComplete</code> - Save complete-html page.</li>\n<li><code>MHTML</code> - Save complete-html page as MHTML.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - resolves if the page is saved.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.loadURL(<span class=\"hljs-string\">'https://github.com'</span>)\n\nwin.webContents.on(<span class=\"hljs-string\">'did-finish-load'</span>, <span class=\"hljs-keyword\">async</span> () => {\n  win.webContents.savePage(<span class=\"hljs-string\">'/tmp/test.html'</span>, <span class=\"hljs-string\">'HTMLComplete'</span>).then(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Page was saved successfully.'</span>)\n  }).catch(<span class=\"hljs-function\"><span class=\"hljs-params\">err</span> =></span> {\n    <span class=\"hljs-built_in\">console</span>.log(err)\n  })\n})\n</code></pre>\n<h4 id=\"contentsshowdefinitionforselection-macos\"><a href=\"#contentsshowdefinitionforselection-macos\"><code>contents.showDefinitionForSelection()</code> <em>macOS</em></a></h4>\n<p>Shows pop-up dictionary that searches the selected word on the page.</p>\n<h4 id=\"contentsisoffscreen\"><a href=\"#contentsisoffscreen\"><code>contents.isOffscreen()</code></a></h4>\n<p>Returns <code>Boolean</code> - Indicates whether <em>offscreen rendering</em> is enabled.</p>\n<h4 id=\"contentsstartpainting\"><a href=\"#contentsstartpainting\"><code>contents.startPainting()</code></a></h4>\n<p>If <em>offscreen rendering</em> is enabled and not painting, start painting.</p>\n<h4 id=\"contentsstoppainting\"><a href=\"#contentsstoppainting\"><code>contents.stopPainting()</code></a></h4>\n<p>If <em>offscreen rendering</em> is enabled and painting, stop painting.</p>\n<h4 id=\"contentsispainting\"><a href=\"#contentsispainting\"><code>contents.isPainting()</code></a></h4>\n<p>Returns <code>Boolean</code> - If <em>offscreen rendering</em> is enabled returns whether it is currently painting.</p>\n<h4 id=\"contentssetframeratefps\"><a href=\"#contentssetframeratefps\"><code>contents.setFrameRate(fps)</code></a></h4>\n<ul>\n<li><code>fps</code> Integer</li>\n</ul>\n<p>If <em>offscreen rendering</em> is enabled sets the frame rate to the specified number. Only values between 1 and 240 are accepted.</p>\n<h4 id=\"contentsgetframerate\"><a href=\"#contentsgetframerate\"><code>contents.getFrameRate()</code></a></h4>\n<p>Returns <code>Integer</code> - If <em>offscreen rendering</em> is enabled returns the current frame rate.</p>\n<h4 id=\"contentsinvalidate\"><a href=\"#contentsinvalidate\"><code>contents.invalidate()</code></a></h4>\n<p>Schedules a full repaint of the window this web contents is in.</p>\n<p>If <em>offscreen rendering</em> is enabled invalidates the frame and generates a new one through the <code>'paint'</code> event.</p>\n<h4 id=\"contentsgetwebrtciphandlingpolicy\"><a href=\"#contentsgetwebrtciphandlingpolicy\"><code>contents.getWebRTCIPHandlingPolicy()</code></a></h4>\n<p>Returns <code>String</code> - Returns the WebRTC IP Handling Policy.</p>\n<h4 id=\"contentssetwebrtciphandlingpolicypolicy\"><a href=\"#contentssetwebrtciphandlingpolicypolicy\"><code>contents.setWebRTCIPHandlingPolicy(policy)</code></a></h4>\n<ul>\n<li><code>policy</code> String - Specify the WebRTC IP Handling Policy.<ul>\n<li><code>default</code> - Exposes user's public and local IPs. This is the default behavior. When this policy is used, WebRTC has the right to enumerate all interfaces and bind them to discover public interfaces.</li>\n<li><code>default_public_interface_only</code> - Exposes user's public IP, but does not expose user's local IP. When this policy is used, WebRTC should only use the default route used by http. This doesn't expose any local addresses.</li>\n<li><code>default_public_and_private_interfaces</code> - Exposes user's public and local IPs. When this policy is used, WebRTC should only use the default route used by http. This also exposes the associated default private address. Default route is the route chosen by the OS on a multi-homed endpoint.</li>\n<li><code>disable_non_proxied_udp</code> - Does not expose public or local IPs. When this policy is used, WebRTC should only use TCP to contact peers or servers unless the proxy server supports UDP.</li>\n</ul></li>\n</ul>\n<p>Setting the WebRTC IP handling policy allows you to control which IPs are exposed via WebRTC. See <a href=\"https://browserleaks.com/webrtc\">BrowserLeaks</a> for more details.</p>\n<h4 id=\"contentsgetosprocessid\"><a href=\"#contentsgetosprocessid\"><code>contents.getOSProcessId()</code></a></h4>\n<p>Returns <code>Integer</code> - The operating system <code>pid</code> of the associated renderer process.</p>\n<h4 id=\"contentsgetprocessid\"><a href=\"#contentsgetprocessid\"><code>contents.getProcessId()</code></a></h4>\n<p>Returns <code>Integer</code> - The Chromium internal <code>pid</code> of the associated renderer. Can be compared to the <code>frameProcessId</code> passed by frame specific navigation events (e.g. <code>did-frame-navigate</code>)</p>\n<h4 id=\"contentstakeheapsnapshotfilepath\"><a href=\"#contentstakeheapsnapshotfilepath\"><code>contents.takeHeapSnapshot(filePath)</code></a></h4>\n<ul>\n<li><code>filePath</code> String - Path to the output file.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Indicates whether the snapshot has been created successfully.</p>\n<p>Takes a V8 heap snapshot and saves it to <code>filePath</code>.</p>\n<h4 id=\"contentsgetbackgroundthrottling\"><a href=\"#contentsgetbackgroundthrottling\"><code>contents.getBackgroundThrottling()</code></a></h4>\n<p>Returns <code>Boolean</code> - whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentssetbackgroundthrottlingallowed\"><a href=\"#contentssetbackgroundthrottlingallowed\"><code>contents.setBackgroundThrottling(allowed)</code></a></h4>\n<ul>\n<li><code>allowed</code> Boolean</li>\n</ul>\n<p>Controls whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentsgettype\"><a href=\"#contentsgettype\"><code>contents.getType()</code></a></h4>\n<p>Returns <code>String</code> - the type of the webContent. Can be <code>backgroundPage</code>, <code>window</code>, <code>browserView</code>, <code>remote</code>, <code>webview</code> or <code>offscreen</code>.</p>\n<h4 id=\"contentssetimageanimationpolicypolicy\"><a href=\"#contentssetimageanimationpolicypolicy\"><code>contents.setImageAnimationPolicy(policy)</code></a></h4>\n<ul>\n<li><code>policy</code> String - Can be <code>animate</code>, <code>animateOnce</code> or <code>noAnimation</code>.</li>\n</ul>\n<p>Sets the image animation policy for this webContents.  The policy only affects <em>new</em> images, existing images that are currently being animated are unaffected. This is a known limitation in Chromium, you can force image animation to be recalculated with <code>img.src = img.src</code> which will result in no network traffic but will update the animation policy.</p>\n<p>This corresponds to the <a href=\"https://developer.chrome.com/docs/extensions/reference/accessibilityFeatures/#property-animationPolicy\">animationPolicy</a> accessibility feature in Chromium.</p>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<h4 id=\"contentsaudiomuted\"><a href=\"#contentsaudiomuted\"><code>contents.audioMuted</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether this page is muted.</p>\n<h4 id=\"contentsuseragent\"><a href=\"#contentsuseragent\"><code>contents.userAgent</code></a></h4>\n<p>A <code>String</code> property that determines the user agent for this web page.</p>\n<h4 id=\"contentszoomlevel\"><a href=\"#contentszoomlevel\"><code>contents.zoomLevel</code></a></h4>\n<p>A <code>Number</code> property that determines the zoom level for this web contents.</p>\n<p>The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. The formula for this is <code>scale := 1.2 ^ level</code>.</p>\n<h4 id=\"contentszoomfactor\"><a href=\"#contentszoomfactor\"><code>contents.zoomFactor</code></a></h4>\n<p>A <code>Number</code> property that determines the zoom factor for this web contents.</p>\n<p>The zoom factor is the zoom percent divided by 100, so 300% = 3.0.</p>\n<h4 id=\"contentsframerate\"><a href=\"#contentsframerate\"><code>contents.frameRate</code></a></h4>\n<p>An <code>Integer</code> property that sets the frame rate of the web contents to the specified number. Only values between 1 and 240 are accepted.</p>\n<p>Only applicable if <em>offscreen rendering</em> is enabled.</p>\n<h4 id=\"contentsid-readonly\"><a href=\"#contentsid-readonly\"><code>contents.id</code> <em>Readonly</em></a></h4>\n<p>A <code>Integer</code> representing the unique ID of this WebContents. Each ID is unique among all <code>WebContents</code> instances of the entire Electron application.</p>\n<h4 id=\"contentssession-readonly\"><a href=\"#contentssession-readonly\"><code>contents.session</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/session\"><code>Session</code></a> used by this webContents.</p>\n<h4 id=\"contentshostwebcontents-readonly\"><a href=\"#contentshostwebcontents-readonly\"><code>contents.hostWebContents</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> instance that might own this <code>WebContents</code>.</p>\n<h4 id=\"contentsdevtoolswebcontents-readonly\"><a href=\"#contentsdevtoolswebcontents-readonly\"><code>contents.devToolsWebContents</code> <em>Readonly</em></a></h4>\n<p>A <code>WebContents | null</code> property that represents the of DevTools <code>WebContents</code> associated with a given <code>WebContents</code>.</p>\n<p><strong>Note:</strong> Users should never store this object because it may become <code>null</code> when the DevTools has been closed.</p>\n<h4 id=\"contentsdebugger-readonly\"><a href=\"#contentsdebugger-readonly\"><code>contents.debugger</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/debugger\"><code>Debugger</code></a> instance for this webContents.</p>\n<h4 id=\"contentsbackgroundthrottling\"><a href=\"#contentsbackgroundthrottling\"><code>contents.backgroundThrottling</code></a></h4>\n<p>A <code>Boolean</code> property that determines whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API.</p>\n<h4 id=\"contentsmainframe-readonly\"><a href=\"#contentsmainframe-readonly\"><code>contents.mainFrame</code> <em>Readonly</em></a></h4>\n<p>A <a href=\"/docs/api/web-frame-main\"><code>WebFrameMain</code></a> property that represents the top frame of the page's frame hierarchy.</p>",
      "title": "webContents",
      "description": "Rendert und steuert web pages."
    },
    "/docs/tutorial/web-embeds": {
      "locale": "de-DE",
      "slug": "web-embeds",
      "href": "/docs/tutorial/web-embeds",
      "crowdinFileId": "256269",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/web-embeds.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"web-embeds\"><a href=\"#web-embeds\">Web Embeds</a></h1>\n<h2 id=\"übersicht\"><a href=\"#übersicht\">Übersicht</a></h2>\n<p>If you want to embed (third-party) web content in an Electron <code>BrowserWindow</code>, there are three options available to you: <code>&#x3C;iframe></code> tags, <code>&#x3C;webview></code> tags, and <code>BrowserViews</code>. Each one offers slightly different functionality and is useful in different situations. To help you choose between these, this guide explains the differences and capabilities of each option.</p>\n<h3 id=\"iframes\"><a href=\"#iframes\">Iframes</a></h3>\n<p>Iframes haben die selben Eigenschaften in Electron wie in normalen Browsern. An <code>&#x3C;iframe></code> element in your page can show external web pages, provided that their <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP\">Content Security Policy</a> allows it. To limit the number of capabilities of a site in an <code>&#x3C;iframe></code> tag, it is recommended to use the <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox\"><code>sandbox</code> attribute</a> and only allow the capabilities you want to support.</p>\n<h3 id=\"webviews\"><a href=\"#webviews\">WebViews</a></h3>\n<blockquote>\n<p>Important Note: <a href=\"/docs/api/webview-tag#warning\">we do not recommend you to use WebViews</a>, as this tag undergoes dramatic architectural changes that may affect stability of your application. Consider switching to alternatives, like <code>iframe</code> and Electron's <code>BrowserView</code>, or an architecture that avoids embedded content by design.</p>\n</blockquote>\n<p><a href=\"/docs/api/webview-tag\">WebViews</a> are based on Chromium's WebViews and are not explicitly supported by Electron. We do not guarantee that the WebView API will remain available in future versions of Electron. To use <code>&#x3C;webview></code> tags, you will need to set <code>webviewTag</code> to <code>true</code> in the <code>webPreferences</code> of your <code>BrowserWindow</code>.</p>\n<p>WebView is a custom element (<code>&#x3C;webview></code>) that will only work inside Electron. Sie sind als ein \"außerhalb-des-Prozesses iframe\" implementiert. This means that all communication with the <code>&#x3C;webview></code> is done asynchronously using IPC. The <code>&#x3C;webview></code> element has many custom methods and events, similar to <code>webContents</code>, that provide you with greater control over the content.</p>\n<p>Compared to an <code>&#x3C;iframe></code>, <code>&#x3C;webview></code> tends to be slightly slower but offers much greater control in loading and communicating with the third-party content and handling various events.</p>\n<h3 id=\"browserviews\"><a href=\"#browserviews\">BrowserViews</a></h3>\n<p><a href=\"/docs/api/browser-view\">BrowserViews</a> are not a part of the DOM - instead, they are created in and controlled by your Main process. They are simply another layer of web content on top of your existing window. This means that they are completely separate from your own <code>BrowserWindow</code> content and their position is not controlled by the DOM or CSS. Instead, it is controlled by setting the bounds in the Main process.</p>\n<p><code>BrowserViews</code> offer the greatest control over their contents, since they implement the <code>webContents</code> similarly to how the <code>BrowserWindow</code> does it. However, as <code>BrowserViews</code> are not a part of your DOM, but are rather overlaid on top of them, you will have to manage their position manually.</p>",
      "title": "Web Embeds",
      "description": "Important Note: we do not recommend you to use WebViews, as this tag undergoes dramatic architectural changes that may affect stability of your application. Consider switching to alternatives, like iframe and Electron's BrowserView, or an architecture that avoids embedded content by design."
    },
    "/docs/api/web-frame": {
      "locale": "de-DE",
      "slug": "web-frame",
      "href": "/docs/api/web-frame",
      "crowdinFileId": "256403",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-frame.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webframe\"><a href=\"#webframe\">webFrame</a></h1>\n<blockquote>\n<p>Customize the rendering of the current web page.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#renderer-process\">Renderer</a></p>\n<p><code>webFrame</code> export of the Electron module is an instance of the <code>WebFrame</code> class representing the top frame of the current <code>BrowserWindow</code>. Sub-frames can be retrieved by certain properties and methods (e.g. <code>webFrame.firstChild</code>).</p>\n<p>Ein Beispiel zum zoomen der aktuellen Page auf 200%.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\nwebFrame.setZoomFactor(<span class=\"hljs-number\">2</span>)\n</code></pre>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>Die <code>WebFrame</code> class hat die folgenden Methoden:</p>\n<h3 id=\"webframesetzoomfactorfactor\"><a href=\"#webframesetzoomfactorfactor\"><code>webFrame.setZoomFactor(factor)</code></a></h3>\n<ul>\n<li><code>factor</code> Double - Zoom factor; default is 1.0.</li>\n</ul>\n<p>Changes the zoom factor to the specified factor. Zoom factor is zoom percent divided by 100, so 300% = 3.0.</p>\n<p>The factor must be greater than 0.0.</p>\n<h3 id=\"webframegetzoomfactor\"><a href=\"#webframegetzoomfactor\"><code>webFrame.getZoomFactor()</code></a></h3>\n<p>Gibt eine <code>Number</code> zurück - Der aktuelle Zoom Faktor.</p>\n<h3 id=\"webframesetzoomlevellevel\"><a href=\"#webframesetzoomlevellevel\"><code>webFrame.setZoomLevel(level)</code></a></h3>\n<ul>\n<li><code>level</code> Number - Zoom level.</li>\n</ul>\n<p>Changes the zoom level to the specified level. The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h3 id=\"webframegetzoomlevel\"><a href=\"#webframegetzoomlevel\"><code>webFrame.getZoomLevel()</code></a></h3>\n<p>Returns <code>Number</code> - Das aktuelle Zoom Level.</p>\n<h3 id=\"webframesetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#webframesetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>webFrame.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h3>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>Setzt das Maximum und Minimum pinch-to-zoom Level.</p>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom is disabled by default in Electron. To re-enable it, call:</p>\n<pre><code class=\"hljs language-js\">webFrame.setVisualZoomLevelLimits(<span class=\"hljs-number\">1</span>, <span class=\"hljs-number\">3</span>)\n</code></pre>\n</blockquote>\n<blockquote>\n<p><strong>NOTE</strong>: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom shortcuts are controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem roles in the application Menu. To disable shortcuts, manually <a href=\"/docs/api/menu#examples\">define the Menu</a> and omit zoom roles from the definition.</p>\n</blockquote>\n<h3 id=\"webframesetspellcheckproviderlanguage-provider\"><a href=\"#webframesetspellcheckproviderlanguage-provider\"><code>webFrame.setSpellCheckProvider(language, provider)</code></a></h3>\n<ul>\n<li><code>language</code> String</li>\n<li><code>provider</code> Objekt<ul>\n<li><code>spellCheck</code> Funktion<ul>\n<li><code>words</code> Zeichenkette[]</li>\n<li><code>callback</code> Function<ul>\n<li><code>misspeltWords</code> Zeichenkette[]</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>Sets a provider for spell checking in input fields and text areas.</p>\n<p>If you want to use this method you must disable the builtin spellchecker when you construct the window.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: {\n    <span class=\"hljs-attr\">spellcheck</span>: <span class=\"hljs-literal\">false</span>\n  }\n})\n</code></pre>\n<p>The <code>provider</code> must be an object that has a <code>spellCheck</code> method that accepts an array of individual words for spellchecking. The <code>spellCheck</code> function runs asynchronously and calls the <code>callback</code> function with an array of misspelt words when complete.</p>\n<p>An example of using <a href=\"https://github.com/atom/node-spellchecker\">node-spellchecker</a> as provider:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> spellChecker = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spellchecker'</span>)\nwebFrame.setSpellCheckProvider(<span class=\"hljs-string\">'en-US'</span>, {\n  spellCheck (words, callback) {\n    setTimeout(<span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      <span class=\"hljs-keyword\">const</span> spellchecker = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'spellchecker'</span>)\n      <span class=\"hljs-keyword\">const</span> misspelled = words.filter(<span class=\"hljs-function\"><span class=\"hljs-params\">x</span> =></span> spellchecker.isMisspelled(x))\n      callback(misspelled)\n    }, <span class=\"hljs-number\">0</span>)\n  }\n})\n</code></pre>\n<h3 id=\"webframeinsertcsscss\"><a href=\"#webframeinsertcsscss\"><code>webFrame.insertCSS(css)</code></a></h3>\n<ul>\n<li><code>css</code> String - CSS source code.</li>\n</ul>\n<p>Returns <code>String</code> - A key for the inserted CSS that can later be used to remove the CSS via <code>webFrame.removeInsertedCSS(key)</code>.</p>\n<p>Injects CSS into the current web page and returns a unique key for the inserted stylesheet.</p>\n<h3 id=\"webframeremoveinsertedcsskey\"><a href=\"#webframeremoveinsertedcsskey\"><code>webFrame.removeInsertedCSS(key)</code></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from <code>webFrame.insertCSS(css)</code>.</p>\n<h3 id=\"webframeinserttexttext\"><a href=\"#webframeinserttexttext\"><code>webFrame.insertText(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Füge <code>text</code> in das fokusierte Element ein.</p>\n<h3 id=\"webframeexecutejavascriptcode-usergesture-callback\"><a href=\"#webframeexecutejavascriptcode-usergesture-callback\"><code>webFrame.executeJavaScript(code[, userGesture, callback])</code></a></h3>\n<ul>\n<li><code>code</code> Zeichenkette</li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n<li><code>callback</code> Function (optional) - Called after script has been executed. Unless the frame is suspended (e.g. showing a modal alert), execution will be synchronous and the callback will be invoked before the method returns. For compatibility with an older version of this method, the error parameter is second.<ul>\n<li><code>result</code> Any</li>\n<li>` Fehler &#x3C;/ 0> Fehler</li></ul></li>\n</ul>\n\n\n<p spaces-before=\"0\">Returns <code>Promise<any>` - A promise that resolves with the result of the executed code or is rejected if execution throws or results in a rejected promise.</any></code></p><code>\n<p>Evaluates <code>code</code> in page.</p>\n<p>In the browser window some HTML APIs like <code>requestFullScreen</code> can only be invoked by a gesture from the user. Setting <code>userGesture</code> to <code>true</code> will remove this limitation.</p>\n<h3 id=\"webframeexecutejavascriptinisolatedworldworldid-scripts-usergesture-callback\"><a href=\"#webframeexecutejavascriptinisolatedworldworldid-scripts-usergesture-callback\"><code>webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture, callback])</code></a></h3>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default main world (where content runs), <code>999</code> is the world used by Electron's <code>contextIsolation</code> feature. Accepts values in the range 1..536870911.</li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/web-source\">WebSource[]</a></li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n<li><code>callback</code> Function (optional) - Called after script has been executed. Unless the frame is suspended (e.g. showing a modal alert), execution will be synchronous and the callback will be invoked before the method returns.  For compatibility with an older version of this method, the error parameter is second.<ul>\n<li><code>result</code> Any</li>\n<li>` Fehler &#x3C;/ 0> Fehler</li></ul></li>\n</ul>\n\n\n<p spaces-before=\"0\">Returns <code>Promise<any>` - A promise that resolves with the result of the executed code or is rejected if execution could not start.</any></code></p><code>\n<p>Works like <code>executeJavaScript</code> but evaluates <code>scripts</code> in an isolated context.</p>\n<p>Note that when the execution of script fails, the returned promise will not reject and the <code>result</code> would be <code>undefined</code>. This is because Chromium does not dispatch errors of isolated worlds to foreign worlds.</p>\n<h3 id=\"webframesetisolatedworldinfoworldid-info\"><a href=\"#webframesetisolatedworldinfoworldid-info\"><code>webFrame.setIsolatedWorldInfo(worldId, info)</code></a></h3>\n<ul>\n<li><code>worldId</code> Integer - The ID of the world to run the javascript in, <code>0</code> is the default world, <code>999</code> is the world used by Electrons <code>contextIsolation</code> feature. Chrome extensions reserve the range of IDs in <code>[1 &#x3C;&#x3C; 20, 1 &#x3C;&#x3C; 29)</code>. You can provide any integer here.</li>\n<li><code>info</code> Objekt<ul>\n<li><code>securityOrigin</code> String (optional) - Security origin for the isolated world.</li>\n<li><code>csp</code> String (optional) - Content Security Policy for the isolated world.</li>\n<li><code>name</code> String (optional) - Name for isolated world. Useful in devtools.</li>\n</ul></li>\n</ul>\n<p>Set the security origin, content security policy and name of the isolated world. Note: If the <code>csp</code> is specified, then the <code>securityOrigin</code> also has to be specified.</p>\n<h3 id=\"webframegetresourceusage\"><a href=\"#webframegetresourceusage\"><code>webFrame.getResourceUsage()</code></a></h3>\n<p>Gibt das <code>Object</code> zurück:</p>\n<ul>\n<li><code>images</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>scripts</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>cssStyleSheets</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>xslStyleSheets</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>fonts</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n<li><code>other</code> <a href=\"/docs/api/structures/memory-usage-details\">MemoryUsageDetails</a></li>\n</ul>\n<p>Returns an object describing usage information of Blink's internal memory caches.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { webFrame } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-built_in\">console</span>.log(webFrame.getResourceUsage())\n</code></pre>\n<p>Dies generiert:</p>\n<pre><code class=\"hljs language-javascript\">{\n  <span class=\"hljs-attr\">images</span>: {\n    <span class=\"hljs-attr\">count</span>: <span class=\"hljs-number\">22</span>,\n    <span class=\"hljs-attr\">size</span>: <span class=\"hljs-number\">2549</span>,\n    <span class=\"hljs-attr\">liveSize</span>: <span class=\"hljs-number\">2542</span>\n  },\n  <span class=\"hljs-attr\">cssStyleSheets</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> },\n  <span class=\"hljs-attr\">xslStyleSheets</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> },\n  <span class=\"hljs-attr\">fonts</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> },\n  <span class=\"hljs-attr\">other</span>: { <span class=\"hljs-comment\">/* same with \"images\" */</span> }\n}\n</code></pre>\n<h3 id=\"webframeclearcache\"><a href=\"#webframeclearcache\"><code>webFrame.clearCache()</code></a></h3>\n<p>Attempts to free memory that is no longer being used (like images from a previous navigation).</p>\n<p>Note that blindly calling this method probably makes Electron slower since it will have to refill these emptied caches, you should only call it if an event in your app has occurred that makes you think your page is actually using less memory (i.e. you have navigated from a super heavy page to a mostly empty one, and intend to stay there).</p>\n<h3 id=\"webframegetframeforselectorselector\"><a href=\"#webframegetframeforselectorselector\"><code>webFrame.getFrameForSelector(selector)</code></a></h3>\n<ul>\n<li><code>selector</code> String - CSS selector für ein frame Element.</li>\n</ul>\n<p>Returns <code>WebFrame</code> - The frame element in <code>webFrame's</code> document selected by <code>selector</code>, <code>null</code> would be returned if <code>selector</code> does not select a frame or if the frame is not in the current renderer process.</p>\n<h3 id=\"webframefindframebynamename\"><a href=\"#webframefindframebynamename\"><code>webFrame.findFrameByName(name)</code></a></h3>\n<ul>\n<li><code>name</code> Zeichenfolge</li>\n</ul>\n<p>Returns <code>WebFrame</code> - A child of <code>webFrame</code> with the supplied <code>name</code>, <code>null</code> would be returned if there's no such frame or if the frame is not in the current renderer process.</p>\n<h3 id=\"webframefindframebyroutingidroutingid\"><a href=\"#webframefindframebyroutingidroutingid\"><code>webFrame.findFrameByRoutingId(routingId)</code></a></h3>\n<ul>\n<li><code>routingId</code> Integer - An <code>Integer</code> representing the unique frame id in the current renderer process. Routing IDs can be retrieved from <code>WebFrame</code> instances (<code>webFrame.routingId</code>) and are also passed by frame specific <code>WebContents</code> navigation events (e.g. <code>did-frame-navigate</code>)</li>\n</ul>\n<p>Returns <code>WebFrame</code> - that has the supplied <code>routingId</code>, <code>null</code> if not found.</p>\n<h3 id=\"webframeiswordmisspelledword\"><a href=\"#webframeiswordmisspelledword\"><code>webFrame.isWordMisspelled(word)</code></a></h3>\n<ul>\n<li><code>word</code> String - The word to be spellchecked.</li>\n</ul>\n<p>Returns <code>Boolean</code> - True if the word is misspelled according to the built in spellchecker, false otherwise. If no dictionary is loaded, always return false.</p>\n<h3 id=\"webframegetwordsuggestionsword\"><a href=\"#webframegetwordsuggestionsword\"><code>webFrame.getWordSuggestions(word)</code></a></h3>\n<ul>\n<li><code>word</code> String - The misspelled word.</li>\n</ul>\n<p>Returns <code>String[]</code> - A list of suggested words for a given word. If the word is spelled correctly, the result will be empty.</p>\n<h2 id=\"eigenschaften\"><a href=\"#eigenschaften\">Eigenschaften</a></h2>\n<h3 id=\"webframetop-readonly\"><a href=\"#webframetop-readonly\"><code>webFrame.top</code> <em>Readonly</em></a></h3>\n<p>A <code>WebFrame | null</code> representing top frame in frame hierarchy to which <code>webFrame</code> belongs, the property would be <code>null</code> if top frame is not in the current renderer process.</p>\n<h3 id=\"webframeopener-readonly\"><a href=\"#webframeopener-readonly\"><code>webFrame.opener</code> <em>Readonly</em></a></h3>\n<p>A <code>WebFrame | null</code> representing the frame which opened <code>webFrame</code>, the property would be <code>null</code> if there's no opener or opener is not in the current renderer process.</p>\n<h3 id=\"webframeparent-readonly\"><a href=\"#webframeparent-readonly\"><code>webFrame.parent</code> <em>Readonly</em></a></h3>\n<p>A <code>WebFrame | null</code> representing parent frame of <code>webFrame</code>, the property would be <code>null</code> if <code>webFrame</code> is top or parent is not in the current renderer process.</p>\n<h3 id=\"webframefirstchild-readonly\"><a href=\"#webframefirstchild-readonly\"><code>webFrame.firstChild</code> <em>Readonly</em></a></h3>\n<p>A <code>WebFrame | null</code> representing the first child frame of <code>webFrame</code>, the property would be <code>null</code> if <code>webFrame</code> has no children or if first child is not in the current renderer process.</p>\n<h3 id=\"webframenextsibling-readonly\"><a href=\"#webframenextsibling-readonly\"><code>webFrame.nextSibling</code> <em>Readonly</em></a></h3>\n<p>A <code>WebFrame | null</code> representing next sibling frame, the property would be <code>null</code> if <code>webFrame</code> is the last frame in its parent or if the next sibling is not in the current renderer process.</p>\n<h3 id=\"webframeroutingid-readonly\"><a href=\"#webframeroutingid-readonly\"><code>webFrame.routingId</code> <em>Readonly</em></a></h3>\n<p>An <code>Integer</code> representing the unique frame id in the current renderer process. Distinct WebFrame instances that refer to the same underlying frame will have the same <code>routingId</code>.</p></code></code>",
      "title": "webFrame",
      "description": "Customize the rendering of the current web page."
    },
    "/docs/api/web-frame-main": {
      "locale": "de-DE",
      "slug": "web-frame-main",
      "href": "/docs/api/web-frame-main",
      "crowdinFileId": "256401",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-frame-main.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webframemain\"><a href=\"#webframemain\">webFrameMain</a></h1>\n<blockquote>\n<p>Control web pages and iframes.</p>\n</blockquote>\n<p>Prozess: <a href=\"/docs/glossary#main-process\">Haupt</a></p>\n<p>The <code>webFrameMain</code> module can be used to lookup frames across existing <a href=\"/docs/api/web-contents\"><code>WebContents</code></a> instances. Navigation events are the common use case.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow, webFrameMain } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">1500</span> })\nwin.loadURL(<span class=\"hljs-string\">'https://twitter.com'</span>)\n\nwin.webContents.on(\n  <span class=\"hljs-string\">'did-frame-navigate'</span>,\n  (event, url, isMainFrame, frameProcessId, frameRoutingId) => {\n    <span class=\"hljs-keyword\">const</span> frame = webFrameMain.fromId(frameProcessId, frameRoutingId)\n    <span class=\"hljs-keyword\">if</span> (frame) {\n      <span class=\"hljs-keyword\">const</span> code = <span class=\"hljs-string\">'document.body.innerHTML = document.body.innerHTML.replaceAll(\"heck\", \"h*ck\")'</span>\n      frame.executeJavaScript(code)\n    }\n  }\n)\n</code></pre>\n<p>You can also access frames of existing pages by using the <code>mainFrame</code> property of <a href=\"/docs/api/web-contents\"><code>WebContents</code></a>.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">async</span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function</span> <span class=\"hljs-title\">main</span> (<span class=\"hljs-params\"></span>) </span>{\n  <span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow({ <span class=\"hljs-attr\">width</span>: <span class=\"hljs-number\">800</span>, <span class=\"hljs-attr\">height</span>: <span class=\"hljs-number\">600</span> })\n  <span class=\"hljs-keyword\">await</span> win.loadURL(<span class=\"hljs-string\">'https://reddit.com'</span>)\n\n  <span class=\"hljs-keyword\">const</span> youtubeEmbeds = win.webContents.mainFrame.frames.filter(<span class=\"hljs-function\">(<span class=\"hljs-params\">frame</span>) =></span> {\n    <span class=\"hljs-keyword\">try</span> {\n      <span class=\"hljs-keyword\">const</span> url = <span class=\"hljs-keyword\">new</span> URL(frame.url)\n      <span class=\"hljs-keyword\">return</span> url.host === <span class=\"hljs-string\">'www.youtube.com'</span>\n    } <span class=\"hljs-keyword\">catch</span> {\n      <span class=\"hljs-keyword\">return</span> <span class=\"hljs-literal\">false</span>\n    }\n  })\n\n  <span class=\"hljs-built_in\">console</span>.log(youtubeEmbeds)\n}\n\nmain()\n</code></pre>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>These methods can be accessed from the <code>webFrameMain</code> module:</p>\n<h3 id=\"webframemainfromidprocessid-routingid\"><a href=\"#webframemainfromidprocessid-routingid\"><code>webFrameMain.fromId(processId, routingId)</code></a></h3>\n<ul>\n<li><code>processId</code> Integer - An <code>Integer</code> representing the internal ID of the process which owns the frame.</li>\n<li><code>routingId</code> Integer - An <code>Integer</code> representing the unique frame ID in the current renderer process. Routing IDs can be retrieved from <code>WebFrameMain</code> instances (<code>frame.routingId</code>) and are also passed by frame specific <code>WebContents</code> navigation events (e.g. <code>did-frame-navigate</code>).</li>\n</ul>\n<p>Returns <code>WebFrameMain | undefined</code> - A frame with the given process and routing IDs, or <code>undefined</code> if there is no WebFrameMain associated with the given IDs.</p>\n<h2 id=\"class-webframemain\"><a href=\"#class-webframemain\">Class: WebFrameMain</a></h2>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<h3 id=\"instanz-ereignisse\"><a href=\"#instanz-ereignisse\">Instanz-Ereignisse</a></h3>\n<h4 id=\"event-dom-ready\"><a href=\"#event-dom-ready\">Event: 'dom-ready'</a></h4>\n<p>Emitted when the document is loaded.</p>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<h4 id=\"frameexecutejavascriptcode-usergesture\"><a href=\"#frameexecutejavascriptcode-usergesture\"><code>frame.executeJavaScript(code[, userGesture])</code></a></h4>\n<ul>\n<li><code>code</code> Zeichenkette</li>\n<li><code>userGesture</code> Boolean (optional) - Default is <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;unknown></code> - A promise that resolves with the result of the executed code or is rejected if execution throws or results in a rejected promise.</p>\n<p>Evaluates <code>code</code> in page.</p>\n<p>In the browser window some HTML APIs like <code>requestFullScreen</code> can only be invoked by a gesture from the user. Setting <code>userGesture</code> to <code>true</code> will remove this limitation.</p>\n<h4 id=\"framereload\"><a href=\"#framereload\"><code>frame.reload()</code></a></h4>\n<p>Returns <code>boolean</code> - Whether the reload was initiated successfully. Only results in <code>false</code> when the frame has no history.</p>\n<h4 id=\"framesendchannel-args\"><a href=\"#framesendchannel-args\"><code>frame.send(channel, ...args)</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Send an asynchronous message to the renderer process via <code>channel</code>, along with arguments. Arguments will be serialized with the [Structured Clone Algorithm][SCA], just like [<code>postMessage</code>][], so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.</p>\n<p>The renderer process can handle the message by listening to <code>channel</code> with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<h4 id=\"framepostmessagechannel-message-transfer\"><a href=\"#framepostmessagechannel-message-transfer\"><code>frame.postMessage(channel, message, [transfer])</code></a></h4>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>message</code> any</li>\n<li><code>transfer</code> MessagePortMain<a href=\"/docs/api/optional\"></a></li>\n</ul>\n<p>Send a message to the renderer process, optionally transferring ownership of zero or more [<code>MessagePortMain</code>][] objects.</p>\n<p>The transferred <code>MessagePortMain</code> objects will be available in the renderer process by accessing the <code>ports</code> property of the emitted event. When they arrive in the renderer, they will be native DOM <code>MessagePort</code> objects.</p>\n<p>Ein Beispiel:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// Main process</span>\n<span class=\"hljs-keyword\">const</span> { port1, port2 } = <span class=\"hljs-keyword\">new</span> MessageChannelMain()\nwebContents.mainFrame.postMessage(<span class=\"hljs-string\">'port'</span>, { <span class=\"hljs-attr\">message</span>: <span class=\"hljs-string\">'hello'</span> }, [port1])\n\n<span class=\"hljs-comment\">// Renderer process</span>\nipcRenderer.on(<span class=\"hljs-string\">'port'</span>, (e, msg) => {\n  <span class=\"hljs-keyword\">const</span> [port] = e.ports\n  <span class=\"hljs-comment\">// ...</span>\n})\n</code></pre>\n<h3 id=\"instanz-eigenschaften\"><a href=\"#instanz-eigenschaften\">Instanz Eigenschaften</a></h3>\n<h4 id=\"frameurl-readonly\"><a href=\"#frameurl-readonly\"><code>frame.url</code> <em>Readonly</em></a></h4>\n<p>A <code>string</code> representing the current URL of the frame.</p>\n<h4 id=\"frametop-readonly\"><a href=\"#frametop-readonly\"><code>frame.top</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain | null</code> representing top frame in the frame hierarchy to which <code>frame</code> belongs.</p>\n<h4 id=\"frameparent-readonly\"><a href=\"#frameparent-readonly\"><code>frame.parent</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain | null</code> representing parent frame of <code>frame</code>, the property would be <code>null</code> if <code>frame</code> is the top frame in the frame hierarchy.</p>\n<h4 id=\"frameframes-readonly\"><a href=\"#frameframes-readonly\"><code>frame.frames</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain[]</code> collection containing the direct descendents of <code>frame</code>.</p>\n<h4 id=\"frameframesinsubtree-readonly\"><a href=\"#frameframesinsubtree-readonly\"><code>frame.framesInSubtree</code> <em>Readonly</em></a></h4>\n<p>A <code>WebFrameMain[]</code> collection containing every frame in the subtree of <code>frame</code>, including itself. This can be useful when traversing through all frames.</p>\n<h4 id=\"frameframetreenodeid-readonly\"><a href=\"#frameframetreenodeid-readonly\"><code>frame.frameTreeNodeId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the id of the frame's internal FrameTreeNode instance. This id is browser-global and uniquely identifies a frame that hosts content. The identifier is fixed at the creation of the frame and stays constant for the lifetime of the frame. When the frame is removed, the id is not used again.</p>\n<h4 id=\"framename-readonly\"><a href=\"#framename-readonly\"><code>frame.name</code> <em>Readonly</em></a></h4>\n<p>A <code>String</code> representing the frame name.</p>\n<h4 id=\"frameosprocessid-readonly\"><a href=\"#frameosprocessid-readonly\"><code>frame.osProcessId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the operating system <code>pid</code> of the process which owns this frame.</p>\n<h4 id=\"frameprocessid-readonly\"><a href=\"#frameprocessid-readonly\"><code>frame.processId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the Chromium internal <code>pid</code> of the process which owns this frame. This is not the same as the OS process ID; to read that use <code>frame.osProcessId</code>.</p>\n<h4 id=\"frameroutingid-readonly\"><a href=\"#frameroutingid-readonly\"><code>frame.routingId</code> <em>Readonly</em></a></h4>\n<p>An <code>Integer</code> representing the unique frame id in the current renderer process. Distinct <code>WebFrameMain</code> instances that refer to the same underlying frame will have the same <code>routingId</code>.</p>\n<h4 id=\"framevisibilitystate-readonly\"><a href=\"#framevisibilitystate-readonly\"><code>frame.visibilityState</code> <em>Readonly</em></a></h4>\n<p>A <code>string</code> representing the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState\">visibility state</a> of the frame.</p>\n<p>See also how the <a href=\"/docs/api/browser-window#page-visibility\">Page Visibility API</a> is affected by other Electron APIs.</p>",
      "title": "webFrameMain",
      "description": "Control web pages and iframes."
    },
    "/docs/api/web-request": {
      "locale": "de-DE",
      "slug": "web-request",
      "href": "/docs/api/web-request",
      "crowdinFileId": "256405",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/web-request.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h2 id=\"class-webrequest\"><a href=\"#class-webrequest\">Class: WebRequest</a></h2>\n<blockquote>\n<p>Intercept and modify the contents of a request at various stages of its lifetime.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#main-process\">Main</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Instances of the <code>WebRequest</code> class are accessed by using the <code>webRequest</code> property of a <code>Session</code>.</p>\n<p>The methods of <code>WebRequest</code> accept an optional <code>filter</code> and a <code>listener</code>. The <code>listener</code> will be called with <code>listener(details)</code> when the API's event has happened. The <code>details</code> object describes the request.</p>\n<p>⚠️ Only the last attached <code>listener</code> will be used. Passing <code>null</code> as <code>listener</code> will unsubscribe from the event.</p>\n<p>The <code>filter</code> object has a <code>urls</code> property which is an Array of URL patterns that will be used to filter out the requests that do not match the URL patterns. If the <code>filter</code> is omitted then all requests will be matched.</p>\n<p>For certain events the <code>listener</code> is passed with a <code>callback</code>, which should be called with a <code>response</code> object when <code>listener</code> has done its work.</p>\n<p>Ein Beispiel zum hinzufügen von <code>User-Agent</code> Headern für Requests:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { session } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-comment\">// Modifiziert den user agent für alle requests zu den folgenden Urls.</span>\n<span class=\"hljs-keyword\">const</span> filter = {\n  <span class=\"hljs-attr\">urls</span>: [<span class=\"hljs-string\">'https://*.github.com/*'</span>, <span class=\"hljs-string\">'*://electron.github.io'</span>]\n}\n\nsession.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback) => {\n  details.requestHeaders[<span class=\"hljs-string\">'User-Agent'</span>] = <span class=\"hljs-string\">'MyAgent'</span>\n  callback({ <span class=\"hljs-attr\">requestHeaders</span>: details.requestHeaders })\n}){ <span class=\"hljs-attr\">requestHeaders</span>: details.requestHeaders }\n</code></pre>\n<h3 id=\"beispiel-methoden\"><a href=\"#beispiel-methoden\">Beispiel Methoden</a></h3>\n<p>Die folgenden Methoden sind verfügbar in Instanzen von <code>WebRequest</code>:</p>\n<h4 id=\"webrequestonbeforerequestfilter-listener\"><a href=\"#webrequestonbeforerequestfilter-listener\"><code>webRequest.onBeforeRequest([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Objekt<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (optional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>uploadData</code> <a href=\"/docs/api/structures/upload-data\">UploadData[]</a></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>response</code> Object<ul>\n<li><code>cancel</code> Boolean (optional)</li>\n<li><code>redirectURL</code> String (optional) - The original request is prevented from being sent or completed and is instead redirected to the given URL.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details, callback)</code> when a request is about to occur.</p>\n<p><code>uploadData</code> ist ein Array mit <code>UploadData</code> Objekten.</p>\n<p>Der <code>callback</code> muss aufgerufen werden mit einem <code>response</code> Objekt.</p>\n<p>Some examples of valid <code>urls</code>:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-string\">'http://foo:1234/'</span>\n<span class=\"hljs-string\">'http://foo.com/'</span>\n<span class=\"hljs-string\">'http://foo:1234/bar'</span>\n<span class=\"hljs-string\">'*://*/*'</span>\n<span class=\"hljs-string\">'*://example.com/*'</span>\n<span class=\"hljs-string\">'*://example.com/foo/*'</span>\n<span class=\"hljs-string\">'http://*.foo:1234/'</span>\n<span class=\"hljs-string\">'file://foo:1234/bar'</span>\n<span class=\"hljs-string\">'http://foo:*/'</span>\n<span class=\"hljs-string\">'*://www.foo.com/'</span>\n</code></pre>\n<h4 id=\"webrequestonbeforesendheadersfilter-listener\"><a href=\"#webrequestonbeforesendheadersfilter-listener\"><code>webRequest.onBeforeSendHeaders([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Objekt<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (optional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string></li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>beforeSendResponse</code> Object<ul>\n<li><code>cancel</code> Boolean (optional)</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string | string[]> (optional) - When provided, request will be made with these headers.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details, callback)</code> before sending an HTTP request, once the request headers are available. This may occur after a TCP connection is made to the server, but before any http data is sent.</p>\n<p>The <code>callback</code> has to be called with a <code>response</code> object.</p>\n<h4 id=\"webrequestonsendheadersfilter-listener\"><a href=\"#webrequestonsendheadersfilter-listener\"><code>webRequest.onSendHeaders([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Objekt<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (optional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>requestHeaders</code> Record&#x3C;string, string></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> just before a request is going to be sent to the server, modifications of previous <code>onBeforeSendHeaders</code> response are visible by the time this listener is fired.</p>\n<h4 id=\"webrequestonheadersreceivedfilter-listener\"><a href=\"#webrequestonheadersreceivedfilter-listener\"><code>webRequest.onHeadersReceived([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Objekt<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (optional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>statusLine</code> String</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n</ul></li>\n<li><code>callback</code> Function<ul>\n<li><code>headersReceivedResponse</code> Object<ul>\n<li><code>cancel</code> Boolean (optional)</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string | string[]> (optional) - When provided, the server is assumed to have responded with these headers.</li>\n<li><code>statusLine</code> String (optional) - Should be provided when overriding <code>responseHeaders</code> to change header status otherwise original response header's status will be used.</li>\n</ul></li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details, callback)</code> when HTTP response headers of a request have been received.</p>\n<p>The <code>callback</code> has to be called with a <code>response</code> object.</p>\n<h4 id=\"webrequestonresponsestartedfilter-listener\"><a href=\"#webrequestonresponsestartedfilter-listener\"><code>webRequest.onResponseStarted([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Objekt<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (optional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n<li><code>fromCache</code> Boolean - Indicates whether the response was fetched from disk cache.</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when first byte of the response body is received. For HTTP requests, this means that the status line and response headers are available.</p>\n<h4 id=\"webrequestonbeforeredirectfilter-listener\"><a href=\"#webrequestonbeforeredirectfilter-listener\"><code>webRequest.onBeforeRedirect([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Objekt<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (optional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>redirectURL</code> String</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n<li><code>ip</code> String (optional) - Die Server IP Adresse an den der Request ursprünglich gesendet wurde.</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when a server initiated redirect is about to occur.</p>\n<h4 id=\"webrequestoncompletedfilter-listener\"><a href=\"#webrequestoncompletedfilter-listener\"><code>webRequest.onCompleted([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Objekt<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (optional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>responseHeaders</code> Record&#x3C;string, string[]> (optional)</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>statusCode</code> Integer</li>\n<li><code>statusLine</code> String</li>\n<li><code>error</code> String</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when a request is completed.</p>\n<h4 id=\"webrequestonerroroccurredfilter-listener\"><a href=\"#webrequestonerroroccurredfilter-listener\"><code>webRequest.onErrorOccurred([filter, ]listener)</code></a></h4>\n<ul>\n<li><code>filter</code> <a href=\"/docs/api/structures/web-request-filter\">WebRequestFilter</a> (optional)</li>\n<li><code>listener</code> Function | null<ul>\n<li><code>details</code> Objekt<ul>\n<li><code>id</code> Integer</li>\n<li><code>url</code> String</li>\n<li><code>method</code> String</li>\n<li><code>webContentsId</code> Integer (optional)</li>\n<li><code>webContents</code> WebContents (optional)</li>\n<li><code>frame</code> WebFrameMain (optional)</li>\n<li><code>resourceType</code> String - Can be <code>mainFrame</code>, <code>subFrame</code>, <code>stylesheet</code>, <code>script</code>, <code>image</code>, <code>font</code>, <code>object</code>, <code>xhr</code>, <code>ping</code>, <code>cspReport</code>, <code>media</code>, <code>webSocket</code> or <code>other</code>.</li>\n<li><code>referrer</code> String</li>\n<li><code>timestamp</code> Double</li>\n<li><code>fromCache</code> Boolean</li>\n<li><code>error</code> String - The error description.</li>\n</ul></li>\n</ul></li>\n</ul>\n<p>The <code>listener</code> will be called with <code>listener(details)</code> when an error occurs.</p>",
      "title": "WebRequest",
      "description": "Intercept and modify the contents of a request at various stages of its lifetime."
    },
    "/docs/api/structures/web-request-filter": {
      "locale": "de-DE",
      "slug": "web-request-filter",
      "href": "/docs/api/structures/web-request-filter",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/web-request-filter.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"webrequestfilter-object\"><a href=\"#webrequestfilter-object\">WebRequestFilter Object</a></h1>\n<ul>\n<li><code>urls</code> String[] - Array of URL patterns that will be used to filter out the requests that do not match the URL patterns.</li>\n</ul>",
      "title": "WebRequestFilter Object",
      "description": ""
    },
    "/docs/api/structures/web-source": {
      "locale": "de-DE",
      "slug": "web-source",
      "href": "/docs/api/structures/web-source",
      "crowdinFileId": "256529",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/structures/web-source.md",
      "category": "api/structures",
      "categoryFancy": "API Structures",
      "isTutorial": false,
      "isApiDoc": false,
      "isApiStructureDoc": true,
      "isDevTutorial": false,
      "html": "<h1 id=\"websource-object\"><a href=\"#websource-object\">WebSource Object</a></h1>\n<ul>\n<li><code>code</code> Zeichenkette</li>\n<li><code>url</code> String (optional)</li>\n<li><code>startLine</code> Integer (optional) - Default is 1.</li>\n</ul>",
      "title": "WebSource Object",
      "description": ""
    },
    "/docs/api/webview-tag": {
      "locale": "de-DE",
      "slug": "webview-tag",
      "href": "/docs/api/webview-tag",
      "crowdinFileId": "256407",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/webview-tag.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"webview-tag\"><a href=\"#webview-tag\"><code>&#x3C;webview></code> Tag</a></h1>\n<h2 id=\"warnung\"><a href=\"#warnung\">Warnung</a></h2>\n<p>Electron's <code>webview</code> tag is based on <a href=\"https://developer.chrome.com/docs/extensions/reference/webviewTag/\">Chromium's <code>webview</code></a>, which is undergoing dramatic architectural changes. This impacts the stability of <code>webviews</code>, including rendering, navigation, and event routing. We currently recommend to not use the <code>webview</code> tag and to consider alternatives, like <code>iframe</code>, <a href=\"/docs/api/browser-view\">Electron's <code>BrowserView</code></a>, or an architecture that avoids embedded content altogether.</p>\n<h2 id=\"enabling\"><a href=\"#enabling\">Enabling</a></h2>\n<p>By default the <code>webview</code> tag is disabled in Electron >= 5.  You need to enable the tag by setting the <code>webviewTag</code> webPreferences option when constructing your <code>BrowserWindow</code>. For more information see the <a href=\"/docs/api/browser-window\">BrowserWindow constructor docs</a>.</p>\n<h2 id=\"übersicht\"><a href=\"#übersicht\">Übersicht</a></h2>\n<blockquote>\n<p>Display external web content in an isolated frame and process.</p>\n</blockquote>\n<p>Process: <a href=\"/docs/glossary#renderer-process\">Renderer</a><br> <em>This class is not exported from the <code>'electron'</code> module. It is only available as a return value of other methods in the Electron API.</em></p>\n<p>Use the <code>webview</code> tag to embed 'guest' content (such as web pages) in your Electron app. The guest content is contained within the <code>webview</code> container. An embedded page within your app controls how the guest content is laid out and rendered.</p>\n<p>Unlike an <code>iframe</code>, the <code>webview</code> runs in a separate process than your app. It doesn't have the same permissions as your web page and all interactions between your app and embedded content will be asynchronous. This keeps your app safe from the embedded content. <strong>Note:</strong> Most methods called on the webview from the host page require a synchronous call to the main process.</p>\n<h2 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h2>\n<p>To embed a web page in your app, add the <code>webview</code> tag to your app's embedder page (this is the app page that will display the guest content). In its simplest form, the <code>webview</code> tag includes the <code>src</code> of the web page and css styles that control the appearance of the <code>webview</code> container:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">id</span>=<span class=\"hljs-string\">\"foo\"</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\"display:inline-flex; width:640px; height:480px\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>If you want to control the guest content in any way, you can write JavaScript that listens for <code>webview</code> events and responds to those events using the <code>webview</code> methods. Here's sample code with two event listeners: one that listens for the web page to start loading, the other for the web page to stop loading, and displays a \"loading...\" message during the load time:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">script</span>></span><span class=\"javascript\">\n  onload = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n    <span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\n    <span class=\"hljs-keyword\">const</span> indicator = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'.indicator'</span>)\n\n    <span class=\"hljs-keyword\">const</span> loadstart = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      indicator.innerText = <span class=\"hljs-string\">'loading...'</span>\n    }\n\n    <span class=\"hljs-keyword\">const</span> loadstop = <span class=\"hljs-function\"><span class=\"hljs-params\">()</span> =></span> {\n      indicator.innerText = <span class=\"hljs-string\">''</span>\n    }\n\n    webview.addEventListener(<span class=\"hljs-string\">'did-start-loading'</span>, loadstart)\n    webview.addEventListener(<span class=\"hljs-string\">'did-stop-loading'</span>, loadstop)\n  }\n</span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">script</span>></span>\n</code></pre>\n<h2 id=\"internal-implementation\"><a href=\"#internal-implementation\">Internal implementation</a></h2>\n<p>Under the hood <code>webview</code> is implemented with <a href=\"https://www.chromium.org/developers/design-documents/oop-iframes\">Out-of-Process iframes (OOPIFs)</a>. The <code>webview</code> tag is essentially a custom element using shadow DOM to wrap an <code>iframe</code> element inside it.</p>\n<p>So the behavior of <code>webview</code> is very similar to a cross-domain <code>iframe</code>, as examples:</p>\n<ul>\n<li>When clicking into a <code>webview</code>, the page focus will move from the embedder frame to <code>webview</code>.</li>\n<li>You can not add keyboard, mouse, and scroll event listeners to <code>webview</code>.</li>\n<li>All reactions between the embedder frame and <code>webview</code> are asynchronous.</li>\n</ul>\n<h2 id=\"css-styling-notes\"><a href=\"#css-styling-notes\">CSS Styling Notes</a></h2>\n<p>Please note that the <code>webview</code> tag's style uses <code>display:flex;</code> internally to ensure the child <code>iframe</code> element fills the full height and width of its <code>webview</code> container when used with traditional and flexbox layouts. Please do not overwrite the default <code>display:flex;</code> CSS property, unless specifying <code>display:inline-flex;</code> for inline layout.</p>\n<h2 id=\"tag-attributes\"><a href=\"#tag-attributes\">Tag Attributes</a></h2>\n<p>The <code>webview</code> tag has the following attributes:</p>\n<h3 id=\"src\"><a href=\"#src\"><code>src</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> representing the visible URL. Writing to this attribute initiates top-level navigation.</p>\n<p>Assigning <code>src</code> its own value will reload the current page.</p>\n<p>The <code>src</code> attribute can also accept data URLs, such as <code>data:text/plain,Hello, world!</code>.</p>\n<h3 id=\"nodeintegration\"><a href=\"#nodeintegration\"><code>nodeintegration</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://www.google.com/\"</span> <span class=\"hljs-attr\">nodeintegration</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page in <code>webview</code> will have node integration and can use node APIs like <code>require</code> and <code>process</code> to access low level system resources. Node integration is disabled by default in the guest page.</p>\n<h3 id=\"nodeintegrationinsubframes\"><a href=\"#nodeintegrationinsubframes\"><code>nodeintegrationinsubframes</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"http://www.google.com/\"</span> <span class=\"hljs-attr\">nodeintegrationinsubframes</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code> for the experimental option for enabling NodeJS support in sub-frames such as iframes inside the <code>webview</code>. All your preloads will load for every iframe, you can use <code>process.isMainFrame</code> to determine if you are in the main frame or not. This option is disabled by default in the guest page.</p>\n<h3 id=\"plugins\"><a href=\"#plugins\"><code>plugins</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">plugins</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page in <code>webview</code> will be able to use browser plugins. Plugins are disabled by default.</p>\n<h3 id=\"preload\"><a href=\"#preload\"><code>preload</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-comment\">&#x3C;!-- from a file --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">preload</span>=<span class=\"hljs-string\">\"./test.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n<span class=\"hljs-comment\">&#x3C;!-- or if you want to load from an asar archive --></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">preload</span>=<span class=\"hljs-string\">\"./app.asar/test.js\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that specifies a script that will be loaded before other scripts run in the guest page. The protocol of script's URL must be <code>file:</code> (even when using <code>asar:</code> archives) because it will be loaded by Node's <code>require</code> under the hood, which treats <code>asar:</code> archives as virtual directories.</p>\n<p>When the guest page doesn't have node integration this script will still have access to all Node APIs, but global objects injected by Node will be deleted after this script has finished executing.</p>\n<p><strong>Note:</strong> This option will appear as <code>preloadURL</code> (not <code>preload</code>) in the <code>webPreferences</code> specified to the <code>will-attach-webview</code> event.</p>\n<h3 id=\"httpreferrer\"><a href=\"#httpreferrer\"><code>httpreferrer</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">httpreferrer</span>=<span class=\"hljs-string\">\"http://cheng.guru\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the referrer URL for the guest page.</p>\n<h3 id=\"useragent\"><a href=\"#useragent\"><code>useragent</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">useragent</span>=<span class=\"hljs-string\">\"Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the user agent for the guest page before the page is navigated to. Once the page is loaded, use the <code>setUserAgent</code> method to change the user agent.</p>\n<h3 id=\"disablewebsecurity\"><a href=\"#disablewebsecurity\"><code>disablewebsecurity</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">disablewebsecurity</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page will have web security disabled. Web security is enabled by default.</p>\n<h3 id=\"partition\"><a href=\"#partition\"><code>partition</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span> <span class=\"hljs-attr\">partition</span>=<span class=\"hljs-string\">\"persist:github\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n<span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://electronjs.org\"</span> <span class=\"hljs-attr\">partition</span>=<span class=\"hljs-string\">\"electron\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> that sets the session used by the page. If <code>partition</code> starts with <code>persist:</code>, the page will use a persistent session available to all pages in the app with the same <code>partition</code>. if there is no <code>persist:</code> prefix, the page will use an in-memory session. By assigning the same <code>partition</code>, multiple pages can share the same session. If the <code>partition</code> is unset then default session of the app will be used.</p>\n<p>This value can only be modified before the first navigation, since the session of an active renderer process cannot change. Subsequent attempts to modify the value will fail with a DOM exception.</p>\n<h3 id=\"allowpopups\"><a href=\"#allowpopups\"><code>allowpopups</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">allowpopups</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>Boolean</code>. When this attribute is present the guest page will be allowed to open new windows. Popups are disabled by default.</p>\n<h3 id=\"webpreferences\"><a href=\"#webpreferences\"><code>webpreferences</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://github.com\"</span> <span class=\"hljs-attr\">webpreferences</span>=<span class=\"hljs-string\">\"allowRunningInsecureContent, javascript=no\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> which is a comma separated list of strings which specifies the web preferences to be set on the webview. The full list of supported preference strings can be found in <a href=\"/docs/api/browser-window#new-browserwindowoptions\">BrowserWindow</a>.</p>\n<p>The string follows the same format as the features string in <code>window.open</code>. A name by itself is given a <code>true</code> boolean value. A preference can be set to another value by including an <code>=</code>, followed by the value. Special values <code>yes</code> and <code>1</code> are interpreted as <code>true</code>, while <code>no</code> and <code>0</code> are interpreted as <code>false</code>.</p>\n<h3 id=\"enableblinkfeatures\"><a href=\"#enableblinkfeatures\"><code>enableblinkfeatures</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">enableblinkfeatures</span>=<span class=\"hljs-string\">\"PreciseMemoryInfo, CSSVariables\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> which is a list of strings which specifies the blink features to be enabled separated by <code>,</code>. The full list of supported feature strings can be found in the <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> file.</p>\n<h3 id=\"disableblinkfeatures\"><a href=\"#disableblinkfeatures\"><code>disableblinkfeatures</code></a></h3>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">webview</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"https://www.github.com/\"</span> <span class=\"hljs-attr\">disableblinkfeatures</span>=<span class=\"hljs-string\">\"PreciseMemoryInfo, CSSVariables\"</span>></span><span class=\"hljs-tag\">&#x3C;/<span class=\"hljs-name\">webview</span>></span>\n</code></pre>\n<p>A <code>String</code> which is a list of strings which specifies the blink features to be disabled separated by <code>,</code>. The full list of supported feature strings can be found in the <a href=\"https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70\">RuntimeEnabledFeatures.json5</a> file.</p>\n<h2 id=\"methoden\"><a href=\"#methoden\">Methoden</a></h2>\n<p>The <code>webview</code> tag has the following methods:</p>\n<p><strong>Note:</strong> The webview element must be loaded before using the methods.</p>\n<p><strong>Beispiel</strong></p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'dom-ready'</span>, () => {\n  webview.openDevTools()\n})\n</code></pre>\n<h3 id=\"webviewloadurlurl-options\"><a href=\"#webviewloadurlurl-options\"><code>&#x3C;webview>.loadURL(url[, options])</code></a></h3>\n<ul>\n<li><code>url</code> URL</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>httpReferrer</code> (String | <a href=\"/docs/api/structures/referrer\">Referrer</a>) (optional) - An HTTP Referrer url.</li>\n<li><code>userAgent</code> String (optional) - A user agent originating the request.</li>\n<li><code>extraHeaders</code> String (optional) - Extra headers separated by \"\\n\"</li>\n<li><code>postData</code> (<a href=\"/docs/api/structures/upload-raw-data\">UploadRawData</a> | <a href=\"/docs/api/structures/upload-file\">UploadFile</a>)<a href=\"/docs/api/optional\"></a></li>\n<li><code>baseURLForDataURL</code> String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified <code>url</code> is a data url and needs to load other files.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - The promise will resolve when the page has finished loading (see <a href=\"/docs/api/webview-tag#event-did-finish-load\"><code>did-finish-load</code></a>), and rejects if the page fails to load (see <a href=\"/docs/api/webview-tag#event-did-fail-load\"><code>did-fail-load</code></a>).</p>\n<p>Loads the <code>url</code> in the webview, the <code>url</code> must contain the protocol prefix, e.g. the <code>http://</code> or <code>file://</code>.</p>\n<h3 id=\"webviewdownloadurlurl\"><a href=\"#webviewdownloadurlurl\"><code>&#x3C;webview>.downloadURL(url)</code></a></h3>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Initiates a download of the resource at <code>url</code> without navigating.</p>\n<h3 id=\"webviewgeturl\"><a href=\"#webviewgeturl\"><code>&#x3C;webview>.getURL()</code></a></h3>\n<p>Returns <code>String</code> - The URL of guest page.</p>\n<h3 id=\"webviewgettitle\"><a href=\"#webviewgettitle\"><code>&#x3C;webview>.getTitle()</code></a></h3>\n<p>Returns <code>String</code> - The title of guest page.</p>\n<h3 id=\"webviewisloading\"><a href=\"#webviewisloading\"><code>&#x3C;webview>.isLoading()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether guest page is still loading resources.</p>\n<h3 id=\"webviewisloadingmainframe\"><a href=\"#webviewisloadingmainframe\"><code>&#x3C;webview>.isLoadingMainFrame()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the main frame (and not just iframes or frames within it) is still loading.</p>\n<h3 id=\"webviewiswaitingforresponse\"><a href=\"#webviewiswaitingforresponse\"><code>&#x3C;webview>.isWaitingForResponse()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the guest page is waiting for a first-response for the main resource of the page.</p>\n<h3 id=\"webviewstop\"><a href=\"#webviewstop\"><code>&#x3C;webview>.stop()</code></a></h3>\n<p>Stops any pending navigation.</p>\n<h3 id=\"webviewreload\"><a href=\"#webviewreload\"><code>&#x3C;webview>.reload()</code></a></h3>\n<p>Reloads the guest page.</p>\n<h3 id=\"webviewreloadignoringcache\"><a href=\"#webviewreloadignoringcache\"><code>&#x3C;webview>.reloadIgnoringCache()</code></a></h3>\n<p>Reloads the guest page and ignores cache.</p>\n<h3 id=\"webviewcangoback\"><a href=\"#webviewcangoback\"><code>&#x3C;webview>.canGoBack()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the guest page can go back.</p>\n<h3 id=\"webviewcangoforward\"><a href=\"#webviewcangoforward\"><code>&#x3C;webview>.canGoForward()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the guest page can go forward.</p>\n<h3 id=\"webviewcangotooffsetoffset\"><a href=\"#webviewcangotooffsetoffset\"><code>&#x3C;webview>.canGoToOffset(offset)</code></a></h3>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Returns <code>Boolean</code> - Whether the guest page can go to <code>offset</code>.</p>\n<h3 id=\"webviewclearhistory\"><a href=\"#webviewclearhistory\"><code>&#x3C;webview>.clearHistory()</code></a></h3>\n<p>Clears the navigation history.</p>\n<h3 id=\"webviewgoback\"><a href=\"#webviewgoback\"><code>&#x3C;webview>.goBack()</code></a></h3>\n<p>Makes the guest page go back.</p>\n<h3 id=\"webviewgoforward\"><a href=\"#webviewgoforward\"><code>&#x3C;webview>.goForward()</code></a></h3>\n<p>Makes the guest page go forward.</p>\n<h3 id=\"webviewgotoindexindex\"><a href=\"#webviewgotoindexindex\"><code>&#x3C;webview>.goToIndex(index)</code></a></h3>\n<ul>\n<li><code>index</code> Integer</li>\n</ul>\n<p>Navigates to the specified absolute index.</p>\n<h3 id=\"webviewgotooffsetoffset\"><a href=\"#webviewgotooffsetoffset\"><code>&#x3C;webview>.goToOffset(offset)</code></a></h3>\n<ul>\n<li><code>offset</code> Integer</li>\n</ul>\n<p>Navigates to the specified offset from the \"current entry\".</p>\n<h3 id=\"webviewiscrashed\"><a href=\"#webviewiscrashed\"><code>&#x3C;webview>.isCrashed()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether the renderer process has crashed.</p>\n<h3 id=\"webviewsetuseragentuseragent\"><a href=\"#webviewsetuseragentuseragent\"><code>&#x3C;webview>.setUserAgent(userAgent)</code></a></h3>\n<ul>\n<li><code>userAgent</code> String</li>\n</ul>\n<p>Overrides the user agent for the guest page.</p>\n<h3 id=\"webviewgetuseragent\"><a href=\"#webviewgetuseragent\"><code>&#x3C;webview>.getUserAgent()</code></a></h3>\n<p>Returns <code>String</code> - The user agent for guest page.</p>\n<h3 id=\"webviewinsertcsscss\"><a href=\"#webviewinsertcsscss\"><code>&#x3C;webview>.insertCSS(css)</code></a></h3>\n<ul>\n<li><code>css</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;String></code> - A promise that resolves with a key for the inserted CSS that can later be used to remove the CSS via <code>&#x3C;webview>.removeInsertedCSS(key)</code>.</p>\n<p>Injects CSS into the current web page and returns a unique key for the inserted stylesheet.</p>\n<h3 id=\"webviewremoveinsertedcsskey\"><a href=\"#webviewremoveinsertedcsskey\"><code>&#x3C;webview>.removeInsertedCSS(key)</code></a></h3>\n<ul>\n<li><code>key</code> String</li>\n</ul>\n<p>Returns <code>Promise&#x3C;void></code> - Resolves if the removal was successful.</p>\n<p>Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from <code>&#x3C;webview>.insertCSS(css)</code>.</p>\n<h3 id=\"webviewexecutejavascriptcode-usergesture\"><a href=\"#webviewexecutejavascriptcode-usergesture\"><code>&#x3C;webview>.executeJavaScript(code[, userGesture])</code></a></h3>\n<ul>\n<li><code>code</code> Zeichenkette</li>\n<li><code>userGesture</code> Boolean (optional) - Default <code>false</code>.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;any></code> - A promise that resolves with the result of the executed code or is rejected if the result of the code is a rejected promise.</p>\n<p>Evaluates <code>code</code> in page. If <code>userGesture</code> is set, it will create the user gesture context in the page. HTML APIs like <code>requestFullScreen</code>, which require user action, can take advantage of this option for automation.</p>\n<h3 id=\"webviewopendevtools\"><a href=\"#webviewopendevtools\"><code>&#x3C;webview>.openDevTools()</code></a></h3>\n<p>Opens a DevTools window for guest page.</p>\n<h3 id=\"webviewclosedevtools\"><a href=\"#webviewclosedevtools\"><code>&#x3C;webview>.closeDevTools()</code></a></h3>\n<p>Closes the DevTools window of guest page.</p>\n<h3 id=\"webviewisdevtoolsopened\"><a href=\"#webviewisdevtoolsopened\"><code>&#x3C;webview>.isDevToolsOpened()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether guest page has a DevTools window attached.</p>\n<h3 id=\"webviewisdevtoolsfocused\"><a href=\"#webviewisdevtoolsfocused\"><code>&#x3C;webview>.isDevToolsFocused()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether DevTools window of guest page is focused.</p>\n<h3 id=\"webviewinspectelementx-y\"><a href=\"#webviewinspectelementx-y\"><code>&#x3C;webview>.inspectElement(x, y)</code></a></h3>\n<ul>\n<li><code>x</code> Integer</li>\n<li><code>y</code> Integer</li>\n</ul>\n<p>Starts inspecting element at position (<code>x</code>, <code>y</code>) of guest page.</p>\n<h3 id=\"webviewinspectsharedworker\"><a href=\"#webviewinspectsharedworker\"><code>&#x3C;webview>.inspectSharedWorker()</code></a></h3>\n<p>Opens the DevTools for the shared worker context present in the guest page.</p>\n<h3 id=\"webviewinspectserviceworker\"><a href=\"#webviewinspectserviceworker\"><code>&#x3C;webview>.inspectServiceWorker()</code></a></h3>\n<p>Opens the DevTools for the service worker context present in the guest page.</p>\n<h3 id=\"webviewsetaudiomutedmuted\"><a href=\"#webviewsetaudiomutedmuted\"><code>&#x3C;webview>.setAudioMuted(muted)</code></a></h3>\n<ul>\n<li><code>muted</code> Boolean</li>\n</ul>\n<p>Set guest page muted.</p>\n<h3 id=\"webviewisaudiomuted\"><a href=\"#webviewisaudiomuted\"><code>&#x3C;webview>.isAudioMuted()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether guest page has been muted.</p>\n<h3 id=\"webviewiscurrentlyaudible\"><a href=\"#webviewiscurrentlyaudible\"><code>&#x3C;webview>.isCurrentlyAudible()</code></a></h3>\n<p>Returns <code>Boolean</code> - Whether audio is currently playing.</p>\n<h3 id=\"webviewundo\"><a href=\"#webviewundo\"><code>&#x3C;webview>.undo()</code></a></h3>\n<p>Executes editing command <code>undo</code> in page.</p>\n<h3 id=\"webviewredo\"><a href=\"#webviewredo\"><code>&#x3C;webview>.redo()</code></a></h3>\n<p>Executes editing command <code>redo</code> in page.</p>\n<h3 id=\"webviewcut\"><a href=\"#webviewcut\"><code>&#x3C;webview>.cut()</code></a></h3>\n<p>Executes editing command <code>cut</code> in page.</p>\n<h3 id=\"webviewcopy\"><a href=\"#webviewcopy\"><code>&#x3C;webview>.copy()</code></a></h3>\n<p>Executes editing command <code>copy</code> in page.</p>\n<h3 id=\"webviewpaste\"><a href=\"#webviewpaste\"><code>&#x3C;webview>.paste()</code></a></h3>\n<p>Executes editing command <code>paste</code> in page.</p>\n<h3 id=\"webviewpasteandmatchstyle\"><a href=\"#webviewpasteandmatchstyle\"><code>&#x3C;webview>.pasteAndMatchStyle()</code></a></h3>\n<p>Executes editing command <code>pasteAndMatchStyle</code> in page.</p>\n<h3 id=\"webviewdelete\"><a href=\"#webviewdelete\"><code>&#x3C;webview>.delete()</code></a></h3>\n<p>Executes editing command <code>delete</code> in page.</p>\n<h3 id=\"webviewselectall\"><a href=\"#webviewselectall\"><code>&#x3C;webview>.selectAll()</code></a></h3>\n<p>Executes editing command <code>selectAll</code> in page.</p>\n<h3 id=\"webviewunselect\"><a href=\"#webviewunselect\"><code>&#x3C;webview>.unselect()</code></a></h3>\n<p>Executes editing command <code>unselect</code> in page.</p>\n<h3 id=\"webviewreplacetext\"><a href=\"#webviewreplacetext\"><code>&#x3C;webview>.replace(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes editing command <code>replace</code> in page.</p>\n<h3 id=\"webviewreplacemisspellingtext\"><a href=\"#webviewreplacemisspellingtext\"><code>&#x3C;webview>.replaceMisspelling(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Executes editing command <code>replaceMisspelling</code> in page.</p>\n<h3 id=\"webviewinserttexttext\"><a href=\"#webviewinserttexttext\"><code>&#x3C;webview>.insertText(text)</code></a></h3>\n<ul>\n<li><code>text</code> String</li>\n</ul>\n<p>Gibt das <code>Promise&#x3C;void></code> zurück</p>\n<p>Füge <code>text</code> in das fokusierte Element ein.</p>\n<h3 id=\"webviewfindinpagetext-options\"><a href=\"#webviewfindinpagetext-options\"><code>&#x3C;webview>.findInPage(text[, options])</code></a></h3>\n<ul>\n<li><code>text</code> String - Content to be searched, must not be empty.</li>\n<li><code>options</code> Object (optional)<ul>\n<li><code>forward</code> Boolean (optional) - Whether to search forward or backward, defaults to <code>true</code>.</li>\n<li><code>findNext</code> Boolean (optional) - Whether to begin a new text finding session with this request. Should be <code>true</code> for initial requests, and <code>false</code> for follow-up requests. Defaults to <code>false</code>.</li>\n<li><code>matchCase</code> Boolean (optional) - Whether search should be case-sensitive, defaults to <code>false</code>.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Integer</code> - The request id used for the request.</p>\n<p>Starts a request to find all matches for the <code>text</code> in the web page. The result of the request can be obtained by subscribing to <a href=\"/docs/api/webview-tag#event-found-in-page\"><code>found-in-page</code></a> event.</p>\n<h3 id=\"webviewstopfindinpageaction\"><a href=\"#webviewstopfindinpageaction\"><code>&#x3C;webview>.stopFindInPage(action)</code></a></h3>\n<ul>\n<li><code>action</code> String - Specifies the action to take place when ending <a href=\"#webviewfindinpagetext-options\"><code>&#x3C;webview>.findInPage</code></a> request.<ul>\n<li><code>clearSelection</code> - Clear the selection.</li>\n<li><code>keepSelection</code> - Translate the selection into a normal selection.</li>\n<li><code>activateSelection</code> - Focus and click the selection node.</li>\n</ul></li>\n</ul>\n<p>Stops any <code>findInPage</code> request for the <code>webview</code> with the provided <code>action</code>.</p>\n<h3 id=\"webviewprintoptions\"><a href=\"#webviewprintoptions\"><code>&#x3C;webview>.print([options])</code></a></h3>\n<ul>\n<li><code>options</code> Object (optional)<ul>\n<li><code>silent</code> Boolean (optional) - Don't ask user for print settings. Standard ist <code>false</code>.</li>\n<li><code>printBackground</code> Boolean (optional) - Prints the background color and image of the web page. Standard ist <code>false</code>.</li>\n<li><code>deviceName</code> String (optional) - Set the printer device name to use. Must be the system-defined name and not the 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.</li>\n<li><code>color</code> Boolean (optional) - Set whether the printed web page will be in color or grayscale. Standard ist <code>true</code>.</li>\n<li><code>margins</code> Object (optional)<ul>\n<li><code>marginType</code> String (optional) - Can be <code>default</code>, <code>none</code>, <code>printableArea</code>, or <code>custom</code>. If <code>custom</code> is chosen, you will also need to specify <code>top</code>, <code>bottom</code>, <code>left</code>, and <code>right</code>.</li>\n<li><code>top</code> Number (optional) - The top margin of the printed web page, in pixels.</li>\n<li><code>bottom</code> Number (optional) - The bottom margin of the printed web page, in pixels.</li>\n<li><code>left</code> Number (optional) - The left margin of the printed web page, in pixels.</li>\n<li><code>right</code> Number (optional) - The right margin of the printed web page, in pixels.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - Whether the web page should be printed in landscape mode. Standard ist <code>false</code>.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page.</li>\n<li><code>pagesPerSheet</code> Number (optional) - The number of pages to print per page sheet.</li>\n<li><code>collate</code> Boolean (optional) - Whether the web page should be collated.</li>\n<li><code>copies</code> Number (optional) - The number of copies of the web page to print.</li>\n<li><code>pageRanges</code> Object<a href=\"/docs/api/optional\"></a> - The page range to print.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>duplexMode</code> String (optional) - Set the duplex mode of the printed web page. Can be <code>simplex</code>, <code>shortEdge</code>, or <code>longEdge</code>.</li>\n<li><code>dpi</code> Record&#x3C;string, number> (optional)<ul>\n<li><code>horizontal</code> Number (optional) - The horizontal dpi.</li>\n<li><code>vertical</code> Number (optional) - The vertical dpi.</li>\n</ul></li>\n<li><code>header</code> String (optional) - String to be printed as page header.</li>\n<li><code>footer</code> String (optional) - String to be printed as page footer.</li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the printed document. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code>.</li>\n</ul></li>\n</ul>\n<p>Gibt das <code>Promise&#x3C;void></code> zurück</p>\n<p>Prints <code>webview</code>'s web page. Same as <code>webContents.print([options])</code>.</p>\n<h3 id=\"webviewprinttopdfoptions\"><a href=\"#webviewprinttopdfoptions\"><code>&#x3C;webview>.printToPDF(options)</code></a></h3>\n<ul>\n<li><code>options</code> Objekt<ul>\n<li><code>headerFooter</code> Record&#x3C;string, string> (optional) - the header and footer for the PDF.<ul>\n<li><code>title</code> String - The title for the PDF header.</li>\n<li><code>url</code> String - the url for the PDF footer.</li>\n</ul></li>\n<li><code>landscape</code> Boolean (optional) - <code>true</code> for landscape, <code>false</code> for portrait.</li>\n<li><code>marginsType</code> Integer (optional) - Specifies the type of margins to use. Uses 0 for default margin, 1 for no margin, and 2 for minimum margin. and <code>width</code> in microns.</li>\n<li><code>scaleFactor</code> Number (optional) - The scale factor of the web page. Can range from 0 to 100.</li>\n<li><code>pageRanges</code> Record&#x3C;string, number> (optional) - The page range to print. On macOS, only the first range is honored.<ul>\n<li><code>from</code> Number - Index of the first page to print (0-based).</li>\n<li><code>to</code> Number - Index of the last page to print (inclusive) (0-based).</li>\n</ul></li>\n<li><code>pageSize</code> String | Size (optional) - Specify page size of the generated PDF. Can be <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code> or an Object containing <code>height</code></li>\n<li><code>printBackground</code> Boolean (optional) - Whether to print CSS backgrounds.</li>\n<li><code>printSelectionOnly</code> Boolean (optional) - Whether to print selection only.</li>\n</ul></li>\n</ul>\n<p>Returns <code>Promise&#x3C;Uint8Array></code> - Resolves with the generated PDF data.</p>\n<p>Prints <code>webview</code>'s web page as PDF, Same as <code>webContents.printToPDF(options)</code>.</p>\n<h3 id=\"webviewcapturepagerect\"><a href=\"#webviewcapturepagerect\"><code>&#x3C;webview>.capturePage([rect])</code></a></h3>\n<ul>\n<li><code>rect</code> <a href=\"/docs/api/structures/rectangle\">Rectangle</a> (optional) - The area of the page to be captured.</li>\n</ul>\n<p>Returns <code>Promise&#x3C;NativeImage></code> - Resolves with a <a href=\"/docs/api/native-image\">NativeImage</a></p>\n<p>Captures a snapshot of the page within <code>rect</code>. Omitting <code>rect</code> will capture the whole visible page.</p>\n<h3 id=\"webviewsendchannel-args\"><a href=\"#webviewsendchannel-args\"><code>&#x3C;webview>.send(channel, ...args)</code></a></h3>\n<ul>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Gibt das <code>Promise&#x3C;void></code> zurück</p>\n<p>Send an asynchronous message to renderer process via <code>channel</code>, you can also send arbitrary arguments. The renderer process can handle the message by listening to the <code>channel</code> event with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>See <a href=\"/docs/api/web-contents#contentssendchannel-args\">webContents.send</a> for examples.</p>\n<h3 id=\"webviewsendtoframeframeid-channel-args\"><a href=\"#webviewsendtoframeframeid-channel-args\"><code>&#x3C;webview>.sendToFrame(frameId, channel, ...args)</code></a></h3>\n<ul>\n<li><code>frameId</code> [number, number] - <code>[processId, frameId]</code></li>\n<li><code>channel</code> String</li>\n<li><code>...args</code> any[]</li>\n</ul>\n<p>Gibt das <code>Promise&#x3C;void></code> zurück</p>\n<p>Send an asynchronous message to renderer process via <code>channel</code>, you can also send arbitrary arguments. The renderer process can handle the message by listening to the <code>channel</code> event with the <a href=\"/docs/api/ipc-renderer\"><code>ipcRenderer</code></a> module.</p>\n<p>See <a href=\"/docs/api/web-contents#contentssendtoframeframeid-channel-args\">webContents.sendToFrame</a> for examples.</p>\n<h3 id=\"webviewsendinputeventevent\"><a href=\"#webviewsendinputeventevent\"><code>&#x3C;webview>.sendInputEvent(event)</code></a></h3>\n<ul>\n<li><code>event</code>  <a href=\"/docs/api/structures/mouse-input-event\">MouseInputEvent</a> | <a href=\"/docs/api/structures/mouse-wheel-input-event\">MouseWheelInputEvent</a> | <a href=\"/docs/api/structures/keyboard-input-event\">KeyboardInputEvent</a></li>\n</ul>\n<p>Gibt das <code>Promise&#x3C;void></code> zurück</p>\n<p>Sends an input <code>event</code> to the page.</p>\n<p>See <a href=\"/docs/api/web-contents#contentssendinputeventinputevent\">webContents.sendInputEvent</a> for detailed description of <code>event</code> object.</p>\n<h3 id=\"webviewsetzoomfactorfactor\"><a href=\"#webviewsetzoomfactorfactor\"><code>&#x3C;webview>.setZoomFactor(factor)</code></a></h3>\n<ul>\n<li><code>factor</code> Number - Zoom Faktor.</li>\n</ul>\n<p>Changes the zoom factor to the specified factor. Zoom factor is zoom percent divided by 100, so 300% = 3.0.</p>\n<h3 id=\"webviewsetzoomlevellevel\"><a href=\"#webviewsetzoomlevellevel\"><code>&#x3C;webview>.setZoomLevel(level)</code></a></h3>\n<ul>\n<li><code>level</code> Number - Zoom level.</li>\n</ul>\n<p>Changes the zoom level to the specified level. The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. The formula for this is <code>scale := 1.2 ^ level</code>.</p>\n<blockquote>\n<p><strong>NOTE</strong>: The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.</p>\n</blockquote>\n<h3 id=\"webviewgetzoomfactor\"><a href=\"#webviewgetzoomfactor\"><code>&#x3C;webview>.getZoomFactor()</code></a></h3>\n<p>Returns <code>Number</code> - the current zoom factor.</p>\n<h3 id=\"webviewgetzoomlevel\"><a href=\"#webviewgetzoomlevel\"><code>&#x3C;webview>.getZoomLevel()</code></a></h3>\n<p>Returns <code>Number</code> - the current zoom level.</p>\n<h3 id=\"webviewsetvisualzoomlevellimitsminimumlevel-maximumlevel\"><a href=\"#webviewsetvisualzoomlevellimitsminimumlevel-maximumlevel\"><code>&#x3C;webview>.setVisualZoomLevelLimits(minimumLevel, maximumLevel)</code></a></h3>\n<ul>\n<li><code>minimumLevel</code> Number</li>\n<li><code>maximumLevel</code> Number</li>\n</ul>\n<p>Gibt das <code>Promise&#x3C;void></code> zurück</p>\n<p>Setzt das Maximum und Minimum pinch-to-zoom Level.</p>\n<h3 id=\"webviewshowdefinitionforselection-macos\"><a href=\"#webviewshowdefinitionforselection-macos\"><code>&#x3C;webview>.showDefinitionForSelection()</code> <em>macOS</em></a></h3>\n<p>Shows pop-up dictionary that searches the selected word on the page.</p>\n<h3 id=\"webviewgetwebcontentsid\"><a href=\"#webviewgetwebcontentsid\"><code>&#x3C;webview>.getWebContentsId()</code></a></h3>\n<p>Returns <code>Number</code> - The WebContents ID of this <code>webview</code>.</p>\n<h2 id=\"dom-events\"><a href=\"#dom-events\">DOM Events</a></h2>\n<p>The following DOM events are available to the <code>webview</code> tag:</p>\n<h3 id=\"event-load-commit\"><a href=\"#event-load-commit\">Event: 'load-commit'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Fired when a load has committed. This includes navigation within the current document as well as subframe document-level loads, but does not include asynchronous resource loads.</p>\n<h3 id=\"event-did-finish-load\"><a href=\"#event-did-finish-load\">Event: 'did-finish-load'</a></h3>\n<p>Fired when the navigation is done, i.e. the spinner of the tab will stop spinning, and the <code>onload</code> event is dispatched.</p>\n<h3 id=\"event-did-fail-load\"><a href=\"#event-did-fail-load\">Event: 'did-fail-load'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>errorCode</code> Integer</li>\n<li><code>errorDescription</code> String</li>\n<li><code>validatedURL</code> String</li>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>This event is like <code>did-finish-load</code>, but fired when the load failed or was cancelled, e.g. <code>window.stop()</code> is invoked.</p>\n<h3 id=\"event-did-frame-finish-load\"><a href=\"#event-did-frame-finish-load\">Event: 'did-frame-finish-load'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>isMainFrame</code> Boolean</li>\n</ul>\n<p>Fired when a frame has done navigation.</p>\n<h3 id=\"event-did-start-loading\"><a href=\"#event-did-start-loading\">Event: 'did-start-loading'</a></h3>\n<p>Corresponds to the points in time when the spinner of the tab starts spinning.</p>\n<h3 id=\"event-did-stop-loading\"><a href=\"#event-did-stop-loading\">Event: 'did-stop-loading'</a></h3>\n<p>Corresponds to the points in time when the spinner of the tab stops spinning.</p>\n<h3 id=\"event-did-attach\"><a href=\"#event-did-attach\">Event: 'did-attach'</a></h3>\n<p>Fired when attached to the embedder web contents.</p>\n<h3 id=\"event-dom-ready\"><a href=\"#event-dom-ready\">Event: 'dom-ready'</a></h3>\n<p>Fired when document in the given frame is loaded.</p>\n<h3 id=\"event-page-title-updated\"><a href=\"#event-page-title-updated\">Event: 'page-title-updated'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>title</code> String</li>\n<li><code>explicitSet</code> Boolean</li>\n</ul>\n<p>Fired when page title is set during navigation. <code>explicitSet</code> is false when title is synthesized from file url.</p>\n<h3 id=\"event-page-favicon-updated\"><a href=\"#event-page-favicon-updated\">Event: 'page-favicon-updated'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>favicons</code> String[] - Array mit URLs.</li>\n</ul>\n<p>Fired when page receives favicon urls.</p>\n<h3 id=\"event-enter-html-full-screen\"><a href=\"#event-enter-html-full-screen\">Event: 'enter-html-full-screen'</a></h3>\n<p>Fired when page enters fullscreen triggered by HTML API.</p>\n<h3 id=\"event-leave-html-full-screen\"><a href=\"#event-leave-html-full-screen\">Event: 'leave-html-full-screen'</a></h3>\n<p>Fired when page leaves fullscreen triggered by HTML API.</p>\n<h3 id=\"event-console-message\"><a href=\"#event-console-message\">Event: 'console-message'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>level</code> Integer - The log level, from 0 to 3. In order it matches <code>verbose</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</li>\n<li><code>message</code> String - The actual console message</li>\n<li><code>line</code> Integer - The line number of the source that triggered this console message</li>\n<li><code>sourceId</code> String</li>\n</ul>\n<p>Fired when the guest window logs a console message.</p>\n<p>The following example code forwards all log messages to the embedder's console without regard for log level or other properties.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'console-message'</span>, (e) => {\n  <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'Guest page logged a message:'</span>, e.message)\n})\n</code></pre>\n<h3 id=\"event-found-in-page\"><a href=\"#event-found-in-page\">Event: 'found-in-page'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>result</code> Object<ul>\n<li><code>requestId</code> Integer</li>\n<li><code>activeMatchOrdinal</code> Integer - Position of the active match.</li>\n<li><code>matches</code> Integer - Number of Matches.</li>\n<li><code>selectionArea</code> Rectangle - Coordinates of first match region.</li>\n<li><code>finalUpdate</code> Boolean</li>\n</ul></li>\n</ul>\n<p>Fired when a result is available for <a href=\"#webviewfindinpagetext-options\"><code>webview.findInPage</code></a> request.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'found-in-page'</span>, (e) => {\n  webview.stopFindInPage(<span class=\"hljs-string\">'keepSelection'</span>)\n})\n\n<span class=\"hljs-keyword\">const</span> requestId = webview.findInPage(<span class=\"hljs-string\">'test'</span>)\n<span class=\"hljs-built_in\">console</span>.log(requestId)\n</code></pre>\n<h3 id=\"event-new-window\"><a href=\"#event-new-window\">Event: 'new-window'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String</li>\n<li><code>disposition</code> String - Can be <code>default</code>, <code>foreground-tab</code>, <code>background-tab</code>, <code>new-window</code>, <code>save-to-disk</code> and <code>other</code>.</li>\n<li><code>options</code> BrowserWindowConstructorOptions - The options which should be used for creating the new <a href=\"/docs/api/browser-window\"><code>BrowserWindow</code></a>.</li>\n</ul>\n<p>Fired when the guest page attempts to open a new browser window.</p>\n<p>The following example code opens the new url in system's default browser.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { shell } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\n\nwebview.addEventListener(<span class=\"hljs-string\">'new-window'</span>, <span class=\"hljs-keyword\">async</span> (e) => {\n  <span class=\"hljs-keyword\">const</span> protocol = (<span class=\"hljs-keyword\">new</span> URL(e.url)).protocol\n  <span class=\"hljs-keyword\">if</span> (protocol === <span class=\"hljs-string\">'http:'</span> || protocol === <span class=\"hljs-string\">'https:'</span>) {\n    <span class=\"hljs-keyword\">await</span> shell.openExternal(e.url)\n  }\n})\n</code></pre>\n<h3 id=\"event-will-navigate\"><a href=\"#event-will-navigate\">Event: 'will-navigate'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when a user or the page wants to start navigation. It can happen when the <code>window.location</code> object is changed or a user clicks a link in the page.</p>\n<p>This event will not emit when the navigation is started programmatically with APIs like <code>&#x3C;webview>.loadURL</code> and <code>&#x3C;webview>.back</code>.</p>\n<p>It is also not emitted during in-page navigation, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<p>Calling <code>event.preventDefault()</code> does <strong>NOT</strong> have any effect.</p>\n<h3 id=\"event-did-start-navigation\"><a href=\"#event-did-start-navigation\">Event: 'did-start-navigation'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame (including main) starts navigating. <code>isInPlace</code> will be <code>true</code> for in-page navigations.</p>\n<h3 id=\"event-did-redirect-navigation\"><a href=\"#event-did-redirect-navigation\">Event: 'did-redirect-navigation'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>isInPlace</code> Boolean</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted after a server side redirect occurs during navigation. For example a 302 redirect.</p>\n<h3 id=\"event-did-navigate\"><a href=\"#event-did-navigate\">Event: 'did-navigate'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when a navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h3 id=\"event-did-frame-navigate\"><a href=\"#event-did-frame-navigate\">Event: 'did-frame-navigate'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>url</code> String</li>\n<li><code>httpResponseCode</code> Integer - -1 for non HTTP navigations</li>\n<li><code>httpStatusText</code> String - empty for non HTTP navigations,</li>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>frameProcessId</code> Integer</li>\n<li><code>frameRoutingId</code> Integer</li>\n</ul>\n<p>Emitted when any frame navigation is done.</p>\n<p>This event is not emitted for in-page navigations, such as clicking anchor links or updating the <code>window.location.hash</code>. Use <code>did-navigate-in-page</code> event for this purpose.</p>\n<h3 id=\"event-did-navigate-in-page\"><a href=\"#event-did-navigate-in-page\">Event: 'did-navigate-in-page'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>isMainFrame</code> Boolean</li>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when an in-page navigation happened.</p>\n<p>When in-page navigation happens, the page URL changes but does not cause navigation outside of the page. Examples of this occurring are when anchor links are clicked or when the DOM <code>hashchange</code> event is triggered.</p>\n<h3 id=\"event-close\"><a href=\"#event-close\">Event: 'close'</a></h3>\n<p>Fired when the guest page attempts to close itself.</p>\n<p>The following example code navigates the <code>webview</code> to <code>about:blank</code> when the guest attempts to close itself.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'close'</span>, () => {\n  webview.src = <span class=\"hljs-string\">'about:blank'</span>\n})\n</code></pre>\n<h3 id=\"event-ipc-message\"><a href=\"#event-ipc-message\">Event: 'ipc-message'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>frameId</code> [number, number] - pair of <code>[processId, frameId]</code>.</li>\n<li><code>channel</code> String</li>\n<li><code>args</code> any[]</li>\n</ul>\n<p>Fired when the guest page has sent an asynchronous message to embedder page.</p>\n<p>With <code>sendToHost</code> method and <code>ipc-message</code> event you can communicate between guest page and embedder page:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In embedder page.</span>\n<span class=\"hljs-keyword\">const</span> webview = <span class=\"hljs-built_in\">document</span>.querySelector(<span class=\"hljs-string\">'webview'</span>)\nwebview.addEventListener(<span class=\"hljs-string\">'ipc-message'</span>, (event) => {\n  <span class=\"hljs-built_in\">console</span>.log(event.channel)\n  <span class=\"hljs-comment\">// Prints \"pong\"</span>\n})\nwebview.send(<span class=\"hljs-string\">'ping'</span>)\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// In guest page.</span>\n<span class=\"hljs-keyword\">const</span> { ipcRenderer } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\nipcRenderer.on(<span class=\"hljs-string\">'ping'</span>, () => {\n  ipcRenderer.sendToHost(<span class=\"hljs-string\">'pong'</span>)\n})\n</code></pre>\n<h3 id=\"event-crashed\"><a href=\"#event-crashed\">Event: 'crashed'</a></h3>\n<p>Fired when the renderer process is crashed.</p>\n<h3 id=\"event-plugin-crashed\"><a href=\"#event-plugin-crashed\">Event: 'plugin-crashed'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>name</code> Zeichenfolge</li>\n<li><code>version</code> String</li>\n</ul>\n<p>Fired when a plugin process is crashed.</p>\n<h3 id=\"event-destroyed\"><a href=\"#event-destroyed\">Event: 'destroyed'</a></h3>\n<p>Fired when the WebContents is destroyed.</p>\n<h3 id=\"event-media-started-playing\"><a href=\"#event-media-started-playing\">Event: 'media-started-playing'</a></h3>\n<p>Emittiert wenn ein Media Element anfängt zu spielen.</p>\n<h3 id=\"event-media-paused\"><a href=\"#event-media-paused\">Event: 'media-paused'</a></h3>\n<p>Emitted when media is paused or done playing.</p>\n<h3 id=\"event-did-change-theme-color\"><a href=\"#event-did-change-theme-color\">Event: 'did-change-theme-color'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>themeColor</code> String</li>\n</ul>\n<p>Emitted when a page's theme color changes. This is usually due to encountering a meta tag:</p>\n<pre><code class=\"hljs language-html\"><span class=\"hljs-tag\">&#x3C;<span class=\"hljs-name\">meta</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">'theme-color'</span> <span class=\"hljs-attr\">content</span>=<span class=\"hljs-string\">'#ff0000'</span>></span>\n</code></pre>\n<h3 id=\"event-update-target-url\"><a href=\"#event-update-target-url\">Event: 'update-target-url'</a></h3>\n<p>Kehrt zurück:</p>\n<ul>\n<li><code>url</code> String</li>\n</ul>\n<p>Emitted when mouse moves over a link or the keyboard moves the focus to a link.</p>\n<h3 id=\"event-devtools-opened\"><a href=\"#event-devtools-opened\">Event: 'devtools-opened'</a></h3>\n<p>Emittiert wenn die DevTools geöffnet wurden.</p>\n<h3 id=\"event-devtools-closed\"><a href=\"#event-devtools-closed\">Event: 'devtools-closed'</a></h3>\n<p>Emittiert wenn die DevTools geschlossen wurden.</p>\n<h3 id=\"event-devtools-focused\"><a href=\"#event-devtools-focused\">Event: 'devtools-focused'</a></h3>\n<p>Emitted when DevTools is focused / opened.</p>",
      "title": "<webview> Tag",
      "description": "Display external web content in an isolated frame and process."
    },
    "/docs/api/window-open": {
      "locale": "de-DE",
      "slug": "window-open",
      "href": "/docs/api/window-open",
      "crowdinFileId": "256409",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/api/window-open.md",
      "category": "api",
      "categoryFancy": "API",
      "isTutorial": false,
      "isApiDoc": true,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"opening-windows-from-the-renderer\"><a href=\"#opening-windows-from-the-renderer\">Opening windows from the renderer</a></h1>\n<p>There are several ways to control how windows are created from trusted or untrusted content within a renderer. Windows can be created from the renderer in two ways:</p>\n<ul>\n<li>clicking on links or submitting forms adorned with <code>target=_blank</code></li>\n<li>JavaScript calling <code>window.open()</code></li>\n</ul>\n<p>For same-origin content, the new window is created within the same process, enabling the parent to access the child window directly. This can be very useful for app sub-windows that act as preference panels, or similar, as the parent can render to the sub-window directly, as if it were a <code>div</code> in the parent. This is the same behavior as in the browser.</p>\n<p>When <code>nativeWindowOpen</code> is set to false, <code>window.open</code> instead results in the creation of a <a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code></a>, a light wrapper around <code>BrowserWindow</code>.</p>\n<p>Electron pairs this native Chrome <code>Window</code> with a BrowserWindow under the hood. You can take advantage of all the customization available when creating a BrowserWindow in the main process by using <code>webContents.setWindowOpenHandler()</code> for renderer-created windows.</p>\n<p>BrowserWindow constructor options are set by, in increasing precedence order: parsed options from the <code>features</code> string from <code>window.open()</code>, security-related webPreferences inherited from the parent, and options given by <a href=\"/docs/api/web-contents#contentssetwindowopenhandlerhandler\"><code>webContents.setWindowOpenHandler</code></a>. Note that <code>webContents.setWindowOpenHandler</code> has final say and full privilege because it is invoked in the main process.</p>\n<h3 id=\"windowopenurl-framename-features\"><a href=\"#windowopenurl-framename-features\"><code>window.open(url[, frameName][, features])</code></a></h3>\n<ul>\n<li><code>url</code> String</li>\n<li><code>frameName</code> String (optional)</li>\n<li><code>features</code> String (optional)</li>\n</ul>\n<p>Returns <a href=\"/docs/api/browser-window-proxy\"><code>BrowserWindowProxy</code></a> | <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window\"><code>Window</code></a></p>\n<p><code>features</code> is a comma-separated key-value list, following the standard format of the browser. Electron will parse <code>BrowserWindowConstructorOptions</code> out of this list where possible, for convenience. For full control and better ergonomics, consider using <code>webContents.setWindowOpenHandler</code> to customize the BrowserWindow creation.</p>\n<p>A subset of <code>WebPreferences</code> can be set directly, unnested, from the features string: <code>zoomFactor</code>, <code>nodeIntegration</code>, <code>preload</code>, <code>javascript</code>, <code>contextIsolation</code>, and <code>webviewTag</code>.</p>\n<p>Ein Beispiel:</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">'https://github.com'</span>, <span class=\"hljs-string\">'_blank'</span>, <span class=\"hljs-string\">'top=500,left=200,frame=false,nodeIntegration=no'</span>)\n</code></pre>\n<p><strong>Hinweise:</strong></p>\n<ul>\n<li>Node integration will always be disabled in the opened <code>window</code> if it is disabled on the parent window.</li>\n<li>Context isolation will always be enabled in the opened <code>window</code> if it is enabled on the parent window.</li>\n<li>JavaScript will always be disabled in the opened <code>window</code> if it is disabled on the parent window.</li>\n<li>Non-standard features (that are not handled by Chromium or Electron) given in <code>features</code> will be passed to any registered <code>webContents</code>'s <code>did-create-window</code> event handler in the <code>options</code> argument.</li>\n<li><code>frameName</code> follows the specification of <code>windowName</code> located in the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters\">native documentation</a>.</li>\n</ul>\n<p>To customize or cancel the creation of the window, you can optionally set an override handler with <code>webContents.setWindowOpenHandler()</code> from the main process. Returning <code>{ action: 'deny' }</code> cancels the window. Returning <code>{ action: 'allow', overrideBrowserWindowOptions: { ... } }</code> will allow opening the window and setting the <code>BrowserWindowConstructorOptions</code> to be used when creating the window. Note that this is more powerful than passing options through the feature string, as the renderer has more limited privileges in deciding security preferences than the main process.</p>\n<h3 id=\"native-window-example\"><a href=\"#native-window-example\">Native <code>Window</code> example</a></h3>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// main.js</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\n<span class=\"hljs-comment\">// In this example, only windows with the `about:blank` url will be created.</span>\n<span class=\"hljs-comment\">// All other urls will be blocked.</span>\nmainWindow.webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (url === <span class=\"hljs-string\">'about:blank'</span>) {\n    <span class=\"hljs-keyword\">return</span> {\n      <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span>,\n      <span class=\"hljs-attr\">overrideBrowserWindowOptions</span>: {\n        <span class=\"hljs-attr\">frame</span>: <span class=\"hljs-literal\">false</span>,\n        <span class=\"hljs-attr\">fullscreenable</span>: <span class=\"hljs-literal\">false</span>,\n        <span class=\"hljs-attr\">backgroundColor</span>: <span class=\"hljs-string\">'black'</span>,\n        <span class=\"hljs-attr\">webPreferences</span>: {\n          <span class=\"hljs-attr\">preload</span>: <span class=\"hljs-string\">'my-child-window-preload-script.js'</span>\n        }\n      }\n    }\n  }\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// renderer process (mainWindow)</span>\n<span class=\"hljs-keyword\">const</span> childWindow = <span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">''</span>, <span class=\"hljs-string\">'modal'</span>)\nchildWindow.document.write(<span class=\"hljs-string\">'&#x3C;h1>Hello&#x3C;/h1>'</span>)\n</code></pre>\n<h3 id=\"browserwindowproxy-example\"><a href=\"#browserwindowproxy-example\"><code>BrowserWindowProxy</code> example</a></h3>\n<pre><code class=\"hljs language-javascript\">\n<span class=\"hljs-comment\">// main.js</span>\n<span class=\"hljs-keyword\">const</span> mainWindow = <span class=\"hljs-keyword\">new</span> BrowserWindow({\n  <span class=\"hljs-attr\">webPreferences</span>: { <span class=\"hljs-attr\">nativeWindowOpen</span>: <span class=\"hljs-literal\">false</span> }\n})\n\nmainWindow.webContents.setWindowOpenHandler(<span class=\"hljs-function\">(<span class=\"hljs-params\">{ url }</span>) =></span> {\n  <span class=\"hljs-keyword\">if</span> (url.startsWith(<span class=\"hljs-string\">'https://github.com/'</span>)) {\n    <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'allow'</span> }\n  }\n  <span class=\"hljs-keyword\">return</span> { <span class=\"hljs-attr\">action</span>: <span class=\"hljs-string\">'deny'</span> }\n})\n\nmainWindow.webContents.on(<span class=\"hljs-string\">'did-create-window'</span>, (childWindow) => {\n  <span class=\"hljs-comment\">// For example...</span>\n  childWindow.webContents.on(<span class=\"hljs-string\">'will-navigate'</span>, (e) => {\n    e.preventDefault()\n  })\n})\n</code></pre>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-comment\">// renderer.js</span>\n<span class=\"hljs-keyword\">const</span> windowProxy = <span class=\"hljs-built_in\">window</span>.open(<span class=\"hljs-string\">'https://github.com/'</span>, <span class=\"hljs-literal\">null</span>, <span class=\"hljs-string\">'minimizable=false'</span>)\nwindowProxy.postMessage(<span class=\"hljs-string\">'hi'</span>, <span class=\"hljs-string\">'*'</span>)\n</code></pre>",
      "title": "Opening windows from the renderer",
      "description": ""
    },
    "/docs/tutorial/windows-arm": {
      "locale": "de-DE",
      "slug": "windows-arm",
      "href": "/docs/tutorial/windows-arm",
      "crowdinFileId": "256271",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-arm.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"windows-on-arm\"><a href=\"#windows-on-arm\">Windows on ARM</a></h1>\n<p>Wenn Ihre App mit Electron 6.0.8 oder höher läuft, können Sie sie nun unter Arm für Windows 10 bauen. This considerably improves performance, but requires recompilation of any native modules used in your app. It may also require small fixups to your build and packaging scripts.</p>\n<h2 id=\"eine-einfache-app-ausführen\"><a href=\"#eine-einfache-app-ausführen\">Eine einfache App ausführen</a></h2>\n<p>Wenn Ihre App keine nativen Module verwendet, ist es wirklich einfach, eine Arm-Version Ihrer App zu erstellen.</p>\n<ol>\n<li>Stelle sicher, dass das <code>node_modules</code> Verzeichnis deiner App leer ist.</li>\n<li>Using a <em>Command Prompt</em>, run <code>set npm_config_arch=arm64</code> before running <code>npm install</code>/<code>yarn install</code> as usual.</li>\n<li><a href=\"/docs/tutorial/quick-start#prerequisites\">If you have Electron installed as a development dependency</a>, npm will download and unpack the arm64 version. You can then package and distribute your app as normal.</li>\n</ol>\n<h2 id=\"allgemeine-überlegungen\"><a href=\"#allgemeine-überlegungen\">Allgemeine Überlegungen</a></h2>\n<h3 id=\"architektur-spezifischer-code\"><a href=\"#architektur-spezifischer-code\">Architektur-spezifischer Code</a></h3>\n<p>Lots of Windows-specific code contains if... else logic that selects between either the x64 or x86 architectures.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-keyword\">if</span> (process.arch === <span class=\"hljs-string\">'x64'</span>) {\n  <span class=\"hljs-comment\">// Do 64-bit thing...</span>\n} <span class=\"hljs-keyword\">else</span> {\n  <span class=\"hljs-comment\">// Do 32-bit thing...</span>\n}\n</code></pre>\n<p>If you want to target arm64, logic like this will typically select the wrong architecture, so carefully check your application and build scripts for conditions like this. In custom build and packaging scripts, you should always check the value of <code>npm_config_arch</code> in the environment, rather than relying on the current process arch.</p>\n<h3 id=\"native-module\"><a href=\"#native-module\">Native Module</a></h3>\n<p>If you use native modules, you must make sure that they compile against v142 of the MSVC compiler (provided in Visual Studio 2017). You must also check that any pre-built <code>.dll</code> or <code>.lib</code> files provided or referenced by the native module are available for Windows on Arm.</p>\n<h3 id=\"testing-your-app\"><a href=\"#testing-your-app\">Testing your app</a></h3>\n<p>To test your app, use a Windows on Arm device running Windows 10 (version 1903 or later). Make sure that you copy your application over to the target device - Chromium's sandbox will not work correctly when loading your application assets from a network location.</p>\n<h2 id=\"development-prerequisites\"><a href=\"#development-prerequisites\">Development prerequisites</a></h2>\n<h3 id=\"nodejsnode-gyp\"><a href=\"#nodejsnode-gyp\">Node.js/node-gyp</a></h3>\n<p><a href=\"https://nodejs.org/en/\">Node.js v12.9.0 or later is recommended.</a> If updating to a new version of Node is  undesirable, you can instead <a href=\"https://github.com/nodejs/node-gyp/wiki/Updating-npm&#x27;s-bundled-node-gyp\">update npm's copy of node-gyp manually</a> to version 5.0.2 or later, which contains the required changes to compile native modules for Arm.</p>\n<h3 id=\"visual-studio-2017\"><a href=\"#visual-studio-2017\">Visual Studio 2017</a></h3>\n<p>Visual Studio 2017 (any edition) is required for cross-compiling native modules. You can download Visual Studio Community 2017 via Microsoft's <a href=\"https://visualstudio.microsoft.com/dev-essentials/\">Visual Studio Dev Essentials program</a>. After installation, you can add the Arm-specific components by running the following from a <em>Command Prompt</em>:</p>\n<pre><code class=\"hljs language-powershell\">vs_installer.exe ^\n--add Microsoft.VisualStudio.Workload.NativeDesktop ^\n--add Microsoft.VisualStudio.Component.VC.ATLMFC ^\n--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ^\n--add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ^\n--includeRecommended\n</code></pre>\n<h4 id=\"creating-a-cross-compilation-command-prompt\"><a href=\"#creating-a-cross-compilation-command-prompt\">Creating a cross-compilation command prompt</a></h4>\n<p>Setting <code>npm_config_arch=arm64</code> in the environment creates the correct arm64 <code>.obj</code> files, but the standard <em>Developer Command Prompt for VS 2017</em> will use the x64 linker. To fix this:</p>\n<ol>\n<li>Duplicate the <em>x64_x86 Cross Tools Command Prompt for VS 2017</em> shortcut (e.g. by locating it in the start menu, right clicking, selecting <em>Open File Location</em>, copying and pasting) to somewhere convenient.</li>\n<li>Right click the new shortcut and choose <em>Properties</em>.</li>\n<li>Change the <em>Target</em> field to read <code>vcvarsamd64_arm64.bat</code> at the end instead of <code>vcvarsamd64_x86.bat</code>.</li>\n</ol>\n<p>If done successfully, the command prompt should print something similar to this on startup:</p>\n<pre><code class=\"hljs language-bat\">**********************************************************************\n** Visual Studio <span class=\"hljs-number\">2017</span> Developer Command Prompt v15.<span class=\"hljs-number\">9</span>.<span class=\"hljs-number\">15</span>\n** Copyright (c) <span class=\"hljs-number\">2017</span> Microsoft Corporation\n**********************************************************************\n[vcvarsall.bat] Environment initialized <span class=\"hljs-keyword\">for</span>: 'x64_arm64'\n</code></pre>\n<p>If you want to develop your application directly on a Windows on Arm device, substitute <code>vcvarsx86_arm64.bat</code> in <em>Target</em> so that cross-compilation can happen with the device's x86 emulation.</p>\n<h3 id=\"linking-against-the-correct-nodelib\"><a href=\"#linking-against-the-correct-nodelib\">Linking against the correct <code>node.lib</code></a></h3>\n<p>By default, <code>node-gyp</code> unpacks Electron's node headers and downloads the x86 and x64 versions of <code>node.lib</code> into <code>%APPDATA%\\..\\Local\\node-gyp\\Cache</code>, but it does not download the arm64 version (<a href=\"https://github.com/nodejs/node-gyp/pull/1875\">a fix for this is in development</a>.) To fix this:</p>\n<ol>\n<li>Download the arm64 <code>node.lib</code> from <a href=\"https://electronjs.org/headers/v6.0.9/win-arm64/node.lib\">https://electronjs.org/headers/v6.0.9/win-arm64/node.lib</a></li>\n<li>Move it to <code>%APPDATA%\\..\\Local\\node-gyp\\Cache\\6.0.9\\arm64\\node.lib</code></li>\n</ol>\n<p>Substitute <code>6.0.9</code> for the version you're using.</p>\n<h2 id=\"cross-compiling-native-modules\"><a href=\"#cross-compiling-native-modules\">Cross-compiling native modules</a></h2>\n<p>After completing all of the above, open your cross-compilation command prompt and run <code>set npm_config_arch=arm64</code>. Then use <code>npm install</code> to build your project as normal. As with cross-compiling x86 modules, you may need to remove <code>node_modules</code> to force recompilation of native modules if they were previously compiled for another architecture.</p>\n<h2 id=\"debugging-native-modules\"><a href=\"#debugging-native-modules\">Debugging native modules</a></h2>\n<p>Debugging native modules can be done with Visual Studio 2017 (running on your development machine) and corresponding <a href=\"https://docs.microsoft.com/en-us/visualstudio/debugger/remote-debugging-cpp?view=vs-2019\">Visual Studio Remote Debugger</a> running on the target device. To debug:</p>\n<ol>\n<li>Launch your app <code>.exe</code> on the target device via the <em>Command Prompt</em> (passing <code>--inspect-brk</code> to pause it before any native modules are loaded).</li>\n<li>Launch Visual Studio 2017 on your development machine.</li>\n<li>Connect to the target device by selecting <em>Debug > Attach to Process...</em> and enter the device's IP address and the port number displayed by the Visual Studio Remote Debugger tool.</li>\n<li>Click <em>Refresh</em> and select the <a href=\"/docs/development/debug-instructions-windows\">appropriate Electron process to attach</a>.</li>\n<li>You may need to make sure that any symbols for native modules in your app are loaded correctly. To configure this, head to <em>Debug > Options...</em> in Visual Studio 2017, and add the folders containing your <code>.pdb</code> symbols under <em>Debugging > Symbols</em>.</li>\n<li>Once attached, set any appropriate breakpoints and resume JavaScript execution using Chrome's <a href=\"/docs/tutorial/debugging-main-process\">remote tools for Node</a>.</li>\n</ol>\n<h2 id=\"getting-additional-help\"><a href=\"#getting-additional-help\">Getting additional help</a></h2>\n<p>If you encounter a problem with this documentation, or if your app works when compiled for x86 but not for arm64, please <a href=\"/docs/development/issues\">file an issue</a> with \"Windows on Arm\" in the title.</p>",
      "title": "Windows on ARM",
      "description": ""
    },
    "/docs/tutorial/windows-store-guide": {
      "locale": "de-DE",
      "slug": "windows-store-guide",
      "href": "/docs/tutorial/windows-store-guide",
      "crowdinFileId": "256273",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-store-guide.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"windows-store-guide\"><a href=\"#windows-store-guide\">Windows Store Guide</a></h1>\n<p>Mit Windows 10, die bewährten win32-Programmdateien bekamen einen neuen Verwandten: die Universelle Windows-Plattform. Das neue <code>.appx</code>-Format ermöglicht nicht nur neue APIs wie 'Cortana' oder 'Push Notifications', sondern, durch den Windows Store, wird das Aktualisieren und die Installation vereinfacht.</p>\n<p>Microsoft <a href=\"https://github.com/catalystcode/electron-windows-store\">entwickelte ein Werkzeug, dass Electron-Apps in <code>.appx</code>-Pakete</a> kompiliert. Somit wird Entwicklern ermöglicht, einige der Annehmlichkeiten, welche sich im neuen Enticklungs-Modul finden, zu nutzen. Diese Anleitung erklärt Ihnen, wie man es benutzt - und was die Möglichkeiten und Begrenzungen von Electron-AppX-Paketen sind.</p>\n<h2 id=\"hintergrund-und-voraussetzungen\"><a href=\"#hintergrund-und-voraussetzungen\">Hintergrund und Voraussetzungen</a></h2>\n<p>Windows 10 \"Anniversary Update\" kann win32-<code>.exe</code>-Dateien ausführen, indem man sie zusammen mit einem virtualisiertem Dateisystem und einer Registry startet. Beides wird während der Kompilierung erstellt durch das Ausführen der App und des Installer in einem Windows-Container. Dies erlaubt Windows genau zu identifizieren, welche Änderungen am Betriebssystem gemacht werden während der Installation. Das Zusammenbringen der Programmdatei mit einem virtuellem Dateisystem und einer virtuellen Registry erlaubt Windows, dass Ein-Klick Installationen und Deinstallationen möglich sind.</p>\n<p>Zusätzlich wird die exe innerhalb eines appx-Modells ausgeführt. Somit können viele der APIs genutzt werden, welche in der Universellen Windows-Plattform verfügbar sind. Um noch mehr Möglichkeiten zu bekommen, kann sich eine Electron-App im Hintergrund mit einem unsichtbaren UWP-Hintergrund-Task verbinden, welcher zusammen mit der <code>exe</code> startet. Sie wird als eine Art \"Handlanger\" gestartet, um Tasks im Hintergrund zu starten, damit Push Notifications empfangen werden können oder um mit anderen UWP-Anwendungen kommunizieren zu können.</p>\n<p>Um eine existierende Ectron-App zu kompilieren, stellen Sie sicher, dass die folgenden Bedingungen erfüllt sind:</p>\n<ul>\n<li>Windows 10 mit Anniversary Update (veröffentlicht am 2. August 2016)</li>\n<li>Das Windows 10 SDK, <a href=\"https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk\">Download-Link</a></li>\n<li>Mindestens Node 4 (zum prüfen, <code>node -v</code> ausführen)</li>\n</ul>\n<p>Als nächstes: Installieren der <code>electron-windows-store</code> CLI:</p>\n<pre><code class=\"hljs language-sh\">npm install -g electron-windows-store\n</code></pre>\n<h2 id=\"schritt-1-die-electron-anwendung-packen\"><a href=\"#schritt-1-die-electron-anwendung-packen\">Schritt 1: Die Electron Anwendung packen</a></h2>\n<p>Packen Sie die Anwendung mittels des <a href=\"https://github.com/electron/electron-packager\">Electron-Packagers</a> (oder einer vergleichbaren Anwendung). Make sure to remove <code>node_modules</code> that you don't need in your final application, since any module you don't actually need will increase your application's size.</p>\n<p>Die Ausgabe sollte etwa wie folgt aussehen:</p>\n<pre><code class=\"hljs language-plaintext\">├── Ghost.exe\n├── LICENSE\n├── content_resources_200_percent.pak\n├── content_shell.pak\n├── d3dcompiler_47.dll\n├── ffmpeg.dll\n├── icudtl.dat\n├── libEGL.dll\n├── libGLESv2.dll\n├── locales\n│   ├── am.pak\n│   ├── ar.pak\n│   ├── [...]\n├── node.dll\n├── resources\n│   └── app.asar\n├── v8_context_snapshot.bin\n├── squirrel.exe\n└── ui_resources_200_percent.pak\n</code></pre>\n<h2 id=\"schritt-2-ausführen-des-electron-windows-store\"><a href=\"#schritt-2-ausführen-des-electron-windows-store\">Schritt 2: Ausführen des Electron-Windows-Store</a></h2>\n<p>From an elevated PowerShell (run it \"as Administrator\"), run <code>electron-windows-store</code> with the required parameters, passing both the input and output directories, the app's name and version, and confirmation that <code>node_modules</code> should be flattened.</p>\n<pre><code class=\"hljs language-powershell\">electron-windows-store `\n    --input-directory C:\\myelectronapp `\n    --output-directory C:\\output\\myelectronapp `\n    --package-version <span class=\"hljs-number\">1.0</span>.<span class=\"hljs-number\">0.0</span> `\n    --package-name myelectronapp\n</code></pre>\n<p>Once executed, the tool goes to work: It accepts your Electron app as an input, flattening the <code>node_modules</code>. Then, it archives your application as <code>app.zip</code>. Using an installer and a Windows Container, the tool creates an \"expanded\" AppX package - including the Windows Application Manifest (<code>AppXManifest.xml</code>) as well as the virtual file system and the virtual registry inside your output folder.</p>\n<p>Once the expanded AppX files are created, the tool uses the Windows App Packager (<code>MakeAppx.exe</code>) to create a single-file AppX package from those files on disk. Finally, the tool can be used to create a trusted certificate on your computer to sign the new AppX package. With the signed AppX package, the CLI can also automatically install the package on your machine.</p>\n<h2 id=\"schritt-3-nutzen-des-appx-pakets\"><a href=\"#schritt-3-nutzen-des-appx-pakets\">Schritt 3: Nutzen des AppX Pakets</a></h2>\n<p>Um Ihr Paket ausführen zu können, wird Windows 10 mit dem sogenannten \"Anniversary Update\" benötigt. Details, wie man Windows aktualisieren kann, können <a href=\"https://blogs.windows.com/windowsexperience/2016/08/02/how-to-get-the-windows-10-anniversary-update\">hier</a> gefunden werden.</p>\n<p>Im Gegensatz zu traditionellen UWP-Apps, müssen sich gepackte Apps einem manuellen Prüfprozess unterziehen. Dieser kann <a href=\"https://developer.microsoft.com/en-us/windows/projects/campaigns/desktop-bridge\">hier</a> beantragt werden. In the meantime, all users will be able to install your package by double-clicking it, so a submission to the store might not be necessary if you're looking for an easier installation method. In einer verwalteten Umgebung (normalerweise Unternehmen), das <code>Add-AppxPackage</code> <a href=\"https://technet.microsoft.com/en-us/library/hh856048.aspx\">Powershell Cmdlet</a> kann benutzt werden, um es auf automatischem Wege zu installieren.</p>\n<p>Eine weitere wichtige Beschränkung ist, dass das kompilierte AppX-Paket noch eine win32 Programmdatei beinhaltet. Somit wird es nicht auf der Xbox, HoloLens oder Mobiltelefonen ausführbar sein.</p>\n<h2 id=\"optional-hinzufügen-von-uwp-funktionen-mittels-eines-hintergrundprozesses\"><a href=\"#optional-hinzufügen-von-uwp-funktionen-mittels-eines-hintergrundprozesses\">Optional: Hinzufügen von UWP-Funktionen mittels eines Hintergrundprozesses</a></h2>\n<p>You can pair your Electron app up with an invisible UWP background task that gets to make full use of Windows 10 features - like push notifications, Cortana integration, or live tiles.</p>\n<p>To check out how an Electron app that uses a background task to send toast notifications and live tiles, <a href=\"https://github.com/felixrieseberg/electron-uwp-background\">check out the Microsoft-provided sample</a>.</p>\n<h2 id=\"optional-convert-using-container-virtualization\"><a href=\"#optional-convert-using-container-virtualization\">Optional: Convert using Container Virtualization</a></h2>\n<p>To generate the AppX package, the <code>electron-windows-store</code> CLI uses a template that should work for most Electron apps. However, if you are using a custom installer, or should you experience any trouble with the generated package, you can attempt to create a package using compilation with a Windows Container - in that mode, the CLI will install and run your application in blank Windows Container to determine what modifications your application is exactly doing to the operating system.</p>\n<p>Before running the CLI for the first time, you will have to setup the \"Windows Desktop App Converter\". This will take a few minutes, but don't worry - you only have to do this once. Download and Desktop App Converter from <a href=\"https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-run-desktop-app-converter\">here</a>. You will receive two files: <code>DesktopAppConverter.zip</code> and <code>BaseImage-14316.wim</code>.</p>\n<ol>\n<li>Unzip <code>DesktopAppConverter.zip</code>. From an elevated PowerShell (opened with \"run as Administrator\", ensure that your systems execution policy allows us to run everything we intend to run by calling <code>Set-ExecutionPolicy bypass</code>.</li>\n<li>Then, run the installation of the Desktop App Converter, passing in the location of the Windows base Image (downloaded as <code>BaseImage-14316.wim</code>), by calling <code>.\\DesktopAppConverter.ps1 -Setup -BaseImage .\\BaseImage-14316.wim</code>.</li>\n<li>If running the above command prompts you for a reboot, please restart your machine and run the above command again after a successful restart.</li>\n</ol>\n<p>Once installation succeeded, you can move on to compiling your Electron app.</p>",
      "title": "Windows Store Guide",
      "description": ""
    },
    "/docs/tutorial/windows-taskbar": {
      "locale": "de-DE",
      "slug": "windows-taskbar",
      "href": "/docs/tutorial/windows-taskbar",
      "crowdinFileId": "256275",
      "githubUrl": "https://github.com/electron/electron/tree/main/docs/tutorial/windows-taskbar.md",
      "category": "tutorial",
      "categoryFancy": "Guides",
      "isTutorial": true,
      "isApiDoc": false,
      "isApiStructureDoc": false,
      "isDevTutorial": false,
      "html": "<h1 id=\"taskbar-customization-windows\"><a href=\"#taskbar-customization-windows\">Taskbar Customization (Windows)</a></h1>\n<h2 id=\"übersicht\"><a href=\"#übersicht\">Übersicht</a></h2>\n<p>Electron has APIs to configure the app's icon in the Windows taskbar. This API supports both Windows-only features like <a href=\"#jumplist\">creation of a <code>JumpList</code></a>, <a href=\"#thumbnail-toolbars\">custom thumbnails and toolbars</a>, <a href=\"#icon-overlays-in-taskbar\">icon overlays</a>, and the so-called <a href=\"#flash-frame\">\"Flash Frame\" effect</a>, and cross-platform features like <a href=\"/docs/tutorial/recent-documents\">recent documents</a> and <a href=\"/docs/tutorial/progress-bar\">application progress</a>.</p>\n<h2 id=\"jumplist\"><a href=\"#jumplist\">JumpList</a></h2>\n<p>Windows allows apps to define a custom context menu that shows up when users right-click the app's icon in the taskbar. That context menu is called <code>JumpList</code>. You specify custom actions in the <code>Tasks</code> category of JumpList, as quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#tasks\">MSDN</a>:</p>\n<blockquote>\n<p>Applications define tasks based on both the program's features and the key things a user is expected to do with them. Tasks should be context-free, in that the application does not need to be running for them to work. They should also be the statistically most common actions that a normal user would perform in an application, such as compose an email message or open the calendar in a mail program, create a new document in a word processor, launch an application in a certain mode, or launch one of its subcommands. An application should not clutter the menu with advanced features that standard users won't need or one-time actions such as registration. Do not use tasks for promotional items such as upgrades or special offers.</p>\n<p>It is strongly recommended that the task list be static. It should remain the same regardless of the state or status of the application. While it is possible to vary the list dynamically, you should consider that this could confuse the user who does not expect that portion of the destination list to change.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420539.png\" alt=\"IE\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example of general tasks of Internet Explorer</p>\n</blockquote>\n<p>Unlike the dock menu in macOS which is a real menu, user tasks in Windows work like application shortcuts. For example, when a user clicks a task, the program will be executed with specified arguments.</p>\n<p>To set user tasks for your application, you can use <a href=\"/docs/api/app#appsetusertaskstasks-windows\">app.setUserTasks</a> API.</p>\n<h4 id=\"beispiele\"><a href=\"#beispiele\">Beispiele</a></h4>\n<h5 id=\"set-user-tasks\"><a href=\"#set-user-tasks\">Set user tasks</a></h5>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setUserTasks([\n  {\n    <span class=\"hljs-attr\">program</span>: process.execPath,\n    <span class=\"hljs-attr\">arguments</span>: <span class=\"hljs-string\">'--new-window'</span>,\n    <span class=\"hljs-attr\">iconPath</span>: process.execPath,\n    <span class=\"hljs-attr\">iconIndex</span>: <span class=\"hljs-number\">0</span>,\n    <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'New Window'</span>,\n    <span class=\"hljs-attr\">description</span>: <span class=\"hljs-string\">'Create a new window'</span>\n  }\n])\n</code></pre>\n<h5 id=\"clear-tasks-list\"><a href=\"#clear-tasks-list\">Clear tasks list</a></h5>\n<p>To clear your tasks list, you need to call <code>app.setUserTasks</code> with an empty array in the <code>main.js</code> file.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { app } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\napp.setUserTasks([])\n</code></pre>\n<blockquote>\n<p>NOTE: The user tasks will still be displayed even after closing your application, so the icon and program path specified for a task should exist until your application is uninstalled.</p>\n</blockquote>\n<h3 id=\"miniaturansicht-symbolleisten\"><a href=\"#miniaturansicht-symbolleisten\">Miniaturansicht-Symbolleisten</a></h3>\n<p>On Windows, you can add a thumbnail toolbar with specified buttons to a taskbar layout of an application window. It provides users with a way to access a particular window's command without restoring or activating the window.</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#thumbnail-toolbars\">MSDN</a>:</p>\n<blockquote>\n<p>This toolbar is the familiar standard toolbar common control. It has a maximum of seven buttons. Each button's ID, image, tooltip, and state are defined in a structure, which is then passed to the taskbar. The application can show, enable, disable, or hide buttons from the thumbnail toolbar as required by its current state.</p>\n<p>For example, Windows Media Player might offer standard media transport controls such as play, pause, mute, and stop.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420540.png\" alt=\"player\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example of thumbnail toolbar of Windows Media Player</p>\n</blockquote>\n<p>To set thumbnail toolbar in your application, you need to use <a href=\"/docs/api/browser-window#winsetthumbarbuttonsbuttons-windows\">BrowserWindow.setThumbarButtons</a></p>\n<h4 id=\"beispiele-1\"><a href=\"#beispiele-1\">Beispiele</a></h4>\n<h5 id=\"set-thumbnail-toolbar\"><a href=\"#set-thumbnail-toolbar\">Set thumbnail toolbar</a></h5>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n<span class=\"hljs-keyword\">const</span> path = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'path'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.setThumbarButtons([\n  {\n    <span class=\"hljs-attr\">tooltip</span>: <span class=\"hljs-string\">'button1'</span>,\n    <span class=\"hljs-attr\">icon</span>: path.join(__dirname, <span class=\"hljs-string\">'button1.png'</span>),\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'button1 clicked'</span>) }\n  }, {\n    <span class=\"hljs-attr\">tooltip</span>: <span class=\"hljs-string\">'button2'</span>,\n    <span class=\"hljs-attr\">icon</span>: path.join(__dirname, <span class=\"hljs-string\">'button2.png'</span>),\n    <span class=\"hljs-attr\">flags</span>: [<span class=\"hljs-string\">'enabled'</span>, <span class=\"hljs-string\">'dismissonclick'</span>],\n    click () { <span class=\"hljs-built_in\">console</span>.log(<span class=\"hljs-string\">'button2 clicked.'</span>) }\n  }\n])\n</code></pre>\n<h5 id=\"clear-thumbnail-toolbar\"><a href=\"#clear-thumbnail-toolbar\">Clear thumbnail toolbar</a></h5>\n<p>To clear thumbnail toolbar buttons, you need to call <code>BrowserWindow.setThumbarButtons</code> with an empty array in the <code>main.js</code> file.</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\nwin.setThumbarButtons([])\n</code></pre>\n<h3 id=\"icon-overlays-in-taskbar\"><a href=\"#icon-overlays-in-taskbar\">Icon Overlays in Taskbar</a></h3>\n<p>On Windows, a taskbar button can use a small overlay to display application status.</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/shell/taskbar-extensions#icon-overlays\">MSDN</a>:</p>\n<blockquote>\n<p>Icon overlays serve as a contextual notification of status, and are intended to negate the need for a separate notification area status icon to communicate that information to the user. For instance, the new mail status in Microsoft Outlook, currently shown in the notification area, can now be indicated through an overlay on the taskbar button. Again, you must decide during your development cycle which method is best for your application. Overlay icons are intended to supply important, long-standing status or notifications such as network status, messenger status, or new mail. The user should not be presented with constantly changing overlays or animations.</p>\n</blockquote>\n<p><img src=\"https://i-msdn.sec.s-msft.com/dynimg/IC420441.png\" alt=\"Overlay on taskbar button\"></p>\n<blockquote>\n<p>NOTE: The screenshot above is an example of overlay on a taskbar button</p>\n</blockquote>\n<p>To set the overlay icon for a window, you need to use the <a href=\"/docs/api/browser-window#winsetoverlayiconoverlay-description-windows\">BrowserWindow.setOverlayIcon</a> API.</p>\n<h4 id=\"beispiel\"><a href=\"#beispiel\">Beispiel</a></h4>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.setOverlayIcon(<span class=\"hljs-string\">'path/to/overlay.png'</span>, <span class=\"hljs-string\">'Description for overlay'</span>)\n</code></pre>\n<h3 id=\"flash-frame\"><a href=\"#flash-frame\">Flash Frame</a></h3>\n<p>On Windows, you can highlight the taskbar button to get the user's attention. This is similar to bouncing the dock icon in macOS.</p>\n<p>As quoted from <a href=\"https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-flashwindow#remarks\">MSDN</a>:</p>\n<blockquote>\n<p>Typically, a window is flashed to inform the user that the window requires attention but that it does not currently have the keyboard focus.</p>\n</blockquote>\n<p>To flash the BrowserWindow taskbar button, you need to use the <a href=\"/docs/api/browser-window#winflashframeflag\">BrowserWindow.flashFrame</a> API.</p>\n<h4 id=\"beispiel-1\"><a href=\"#beispiel-1\">Beispiel</a></h4>\n<p>Starting with a working application from the <a href=\"/docs/tutorial/quick-start\">Quick Start Guide</a>, update the <code>main.js</code> file with the following lines:</p>\n<pre><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const</span> { BrowserWindow } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'electron'</span>)\n\n<span class=\"hljs-keyword\">const</span> win = <span class=\"hljs-keyword\">new</span> BrowserWindow()\n\nwin.once(<span class=\"hljs-string\">'focus'</span>, () => win.flashFrame(<span class=\"hljs-literal\">false</span>))\nwin.flashFrame(<span class=\"hljs-literal\">true</span>)\n</code></pre>\n<blockquote>\n<p>NOTE: Don't forget to call <code>win.flashFrame(false)</code> to turn off the flash. In the above example, it is called when the window comes into focus, but you might use a timeout or some other event to disable it.</p>\n</blockquote>",
      "title": "Taskbar Customization (Windows)",
      "description": "Applications define tasks based on both the program's features and the key things a user is expected to do with them. Tasks should be context-free, in that the application does not need to be running for them to work. They should also be the statistically most common actions that a normal user would perform in an application, such as compose an email message or open the calendar in a mail program, create a new document in a word processor, launch an application in a certain mode, or launch one of its subcommands. An application should not clutter the menu with advanced features that standard users won't need or one-time actions such as registration. Do not use tasks for promotional items such as upgrades or special offers.\nIt is strongly recommended that the task list be static. It should remain the same regardless of the state or status of the application. While it is possible to vary the list dynamically, you should consider that this could confuse the user who does not expect that portion of the destination list to change."
    }
  }
}